From: Andrea Bianco Date: Thu, 7 Oct 2021 14:16:02 +0000 (+0200) Subject: Built motion from commit f3da74b7.|2.5.36 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=c27d3a0c42cfaa97e6fbb1044fb5614c78d58a58;p=motion2.git Built motion from commit f3da74b7.|2.5.36 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 2d0415d..bacf515 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-07T13:39:13.056Z", + "time": "2021-10-07T14:09:33.697Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0f90386..50b1857 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-07T13:39:13.056Z", + "time": "2021-10-07T14:09:33.697Z", "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 8143684..9a8b957 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 _0x4bf6=['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[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]','TEXT','urlForward[body]','sequelize','VIRTUAL','action','STRING','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x213213,_0x337d60){var _0x204b9b=function(_0x1912c4){while(--_0x1912c4){_0x213213['push'](_0x213213['shift']());}};_0x204b9b(++_0x337d60);}(_0x4bf6,0x1e5));var _0x64bf=function(_0x538be4,_0x2fd1b3){_0x538be4=_0x538be4-0x0;var _0x3fa1ec=_0x4bf6[_0x538be4];return _0x3fa1ec;};'use strict';var Sequelize=require(_0x64bf('0x0'));module['exports']={'name':{'type':Sequelize[_0x64bf('0x1')],'get':function(_0x3e6a5f){return this['getDataValue'](_0x64bf('0x2'));}},'action':{'type':Sequelize[_0x64bf('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x64bf('0x4'),'motionbar',_0x64bf('0x5'),_0x64bf('0x6'),_0x64bf('0x7'),_0x64bf('0x8'),_0x64bf('0x9')]],'msg':_0x64bf('0xa')}},'comment':_0x64bf('0xa')},'data1':{'type':Sequelize[_0x64bf('0x3')](0x1000),'comment':_0x64bf('0xb')},'data2':{'type':Sequelize[_0x64bf('0x3')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x64bf('0x3')](0x1000),'comment':_0x64bf('0xc')},'data4':{'type':Sequelize[_0x64bf('0x3')](0x1000),'comments':_0x64bf('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x64bf('0x3')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x64bf('0xe')],'comments':_0x64bf('0xf')}}; \ No newline at end of file +var _0x86d2=['STRING','integration','jscripty','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue'];(function(_0x37d79b,_0x189596){var _0x387f50=function(_0x3eba8d){while(--_0x3eba8d){_0x37d79b['push'](_0x37d79b['shift']());}};_0x387f50(++_0x189596);}(_0x86d2,0x15d));var _0x286d=function(_0x4c18c9,_0x27a9f0){_0x4c18c9=_0x4c18c9-0x0;var _0x9bdb1c=_0x86d2[_0x4c18c9];return _0x9bdb1c;};'use strict';var Sequelize=require('sequelize');module[_0x286d('0x0')]={'name':{'type':Sequelize[_0x286d('0x1')],'get':function(_0x49f3cf){return this[_0x286d('0x2')]('action');}},'action':{'type':Sequelize[_0x286d('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x286d('0x4'),'motionbar',_0x286d('0x5'),'urlForward','browser',_0x286d('0x6'),_0x286d('0x7')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x286d('0x8')},'data1':{'type':Sequelize[_0x286d('0x3')](0x1000),'comment':_0x286d('0x9')},'data2':{'type':Sequelize[_0x286d('0x3')](0x1000),'comment':_0x286d('0xa')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x286d('0xb')},'data4':{'type':Sequelize[_0x286d('0x3')](0x1000),'comments':_0x286d('0xc')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x286d('0x3')],'comments':_0x286d('0xd')},'data7':{'type':Sequelize[_0x286d('0xe')],'comments':_0x286d('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7193b00..72cf740 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 _0x601e=['Content-Range','apply','save','then','destroy','error','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x601e,0x1da));var _0xe601=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x601e[_0x590b63];return _0x3c9380;};'use strict';var emlformat=require(_0xe601('0x0'));var rimraf=require(_0xe601('0x1'));var zipdir=require(_0xe601('0x2'));var jsonpatch=require(_0xe601('0x3'));var rp=require('request-promise');var moment=require(_0xe601('0x4'));var BPromise=require(_0xe601('0x5'));var Mustache=require('mustache');var util=require(_0xe601('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe601('0x7'));var ejs=require(_0xe601('0x8'));var fs=require('fs');var fs_extra=require(_0xe601('0x9'));var _=require(_0xe601('0xa'));var squel=require(_0xe601('0xb'));var crypto=require(_0xe601('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe601('0xd'));var toCsv=require(_0xe601('0x7'));var querystring=require(_0xe601('0xe'));var Papa=require(_0xe601('0xf'));var Redis=require(_0xe601('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe601('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe601('0x12'));var logger=require('../../config/logger')(_0xe601('0x13'));var utils=require(_0xe601('0x14'));var config=require(_0xe601('0x15'));var licenseUtil=require(_0xe601('0x16'));var db=require(_0xe601('0x17'))['db'];function respondWithStatusCode(_0x1d66a9,_0x1b44d1){_0x1b44d1=_0x1b44d1||0xcc;return function(_0x2002d2){if(_0x2002d2){return _0x1d66a9[_0xe601('0x18')](_0x1b44d1);}return _0x1d66a9['status'](_0x1b44d1)[_0xe601('0x19')]();};}function respondWithResult(_0x347f83,_0x34c3f1){_0x34c3f1=_0x34c3f1||0xc8;return function(_0xdfb59f){if(_0xdfb59f){return _0x347f83[_0xe601('0x1a')](_0x34c3f1)[_0xe601('0x1b')](_0xdfb59f);}};}function respondWithFilteredResult(_0x3e5c62,_0x53a79a){return function(_0x2fa510){if(_0x2fa510){var _0x3d5f91=typeof _0x53a79a['offset']==='undefined'&&typeof _0x53a79a[_0xe601('0x1c')]===_0xe601('0x1d');var _0x5c02d3=_0x2fa510[_0xe601('0x1e')];var _0x2667d7=_0x3d5f91?0x0:_0x53a79a[_0xe601('0x1f')];var _0x3df80b=_0x3d5f91?_0x2fa510[_0xe601('0x1e')]:_0x53a79a['offset']+_0x53a79a[_0xe601('0x1c')];var _0x469176;if(_0x3df80b>=_0x5c02d3){_0x3df80b=_0x5c02d3;_0x469176=0xc8;}else{_0x469176=0xce;}_0x3e5c62[_0xe601('0x1a')](_0x469176);return _0x3e5c62['set'](_0xe601('0x20'),_0x2667d7+'-'+_0x3df80b+'/'+_0x5c02d3)[_0xe601('0x1b')](_0x2fa510);}return null;};}function patchUpdates(_0x262ad5){return function(_0x541241){try{jsonpatch[_0xe601('0x21')](_0x541241,_0x262ad5,!![]);}catch(_0x3ed9e6){return BPromise['reject'](_0x3ed9e6);}return _0x541241[_0xe601('0x22')]();};}function saveUpdates(_0x413bb5,_0x31e7d4){return function(_0x415dfd){if(_0x415dfd){return _0x415dfd['update'](_0x413bb5)[_0xe601('0x23')](function(_0x45508d){return _0x45508d;});}return null;};}function removeEntity(_0x55b401,_0x22507b){return function(_0x4c8629){if(_0x4c8629){return _0x4c8629[_0xe601('0x24')]()['then'](function(){_0x55b401[_0xe601('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x466d42,_0x1f09f2){return function(_0x5ef6ae){if(!_0x5ef6ae){_0x466d42[_0xe601('0x18')](0x194);}return _0x5ef6ae;};}function handleError(_0x407c35,_0xb5420a){_0xb5420a=_0xb5420a||0x1f4;return function(_0x374e27){logger[_0xe601('0x25')](_0x374e27['stack']);if(_0x374e27[_0xe601('0x26')]){delete _0x374e27[_0xe601('0x26')];}_0x407c35[_0xe601('0x1a')](_0xb5420a)[_0xe601('0x27')](_0x374e27);};}exports[_0xe601('0x28')]=function(_0x2e9c61,_0x54c10a){if(_0x2e9c61[_0xe601('0x29')]['id']){delete _0x2e9c61[_0xe601('0x29')]['id'];}return db[_0xe601('0x2a')][_0xe601('0x2b')]({'where':{'id':_0x2e9c61[_0xe601('0x2c')]['id']}})[_0xe601('0x23')](handleEntityNotFound(_0x54c10a,null))[_0xe601('0x23')](saveUpdates(_0x2e9c61[_0xe601('0x29')],null))[_0xe601('0x23')](respondWithResult(_0x54c10a,null))[_0xe601('0x2d')](handleError(_0x54c10a,null));};exports[_0xe601('0x24')]=function(_0x4145f8,_0x548873){return db[_0xe601('0x2a')][_0xe601('0x2b')]({'where':{'id':_0x4145f8[_0xe601('0x2c')]['id']}})[_0xe601('0x23')](handleEntityNotFound(_0x548873,null))[_0xe601('0x23')](removeEntity(_0x548873,null))[_0xe601('0x2d')](handleError(_0x548873,null));}; \ No newline at end of file +var _0x81d4=['util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../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','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x32bdea,_0x5d16ae){var _0x41843a=function(_0x51334c){while(--_0x51334c){_0x32bdea['push'](_0x32bdea['shift']());}};_0x41843a(++_0x5d16ae);}(_0x81d4,0xba));var _0x481d=function(_0x371b64,_0x67b4bb){_0x371b64=_0x371b64-0x0;var _0x3cf3b1=_0x81d4[_0x371b64];return _0x3cf3b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x481d('0x0'));var zipdir=require(_0x481d('0x1'));var jsonpatch=require(_0x481d('0x2'));var rp=require(_0x481d('0x3'));var moment=require('moment');var BPromise=require(_0x481d('0x4'));var Mustache=require(_0x481d('0x5'));var util=require(_0x481d('0x6'));var path=require(_0x481d('0x7'));var sox=require(_0x481d('0x8'));var csv=require('to-csv');var ejs=require(_0x481d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x481d('0xa'));var squel=require(_0x481d('0xb'));var crypto=require(_0x481d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x481d('0xd'));var toCsv=require(_0x481d('0xe'));var querystring=require('querystring');var Papa=require(_0x481d('0xf'));var Redis=require('ioredis');var authService=require(_0x481d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x481d('0x11'));var hardwareService=require(_0x481d('0x12'));var logger=require(_0x481d('0x13'))(_0x481d('0x14'));var utils=require(_0x481d('0x15'));var config=require(_0x481d('0x16'));var licenseUtil=require(_0x481d('0x17'));var db=require(_0x481d('0x18'))['db'];function respondWithStatusCode(_0x543d5b,_0x291b91){_0x291b91=_0x291b91||0xcc;return function(_0x47f060){if(_0x47f060){return _0x543d5b[_0x481d('0x19')](_0x291b91);}return _0x543d5b[_0x481d('0x1a')](_0x291b91)[_0x481d('0x1b')]();};}function respondWithResult(_0x4c3eb1,_0x17f9e7){_0x17f9e7=_0x17f9e7||0xc8;return function(_0x54acb9){if(_0x54acb9){return _0x4c3eb1[_0x481d('0x1a')](_0x17f9e7)[_0x481d('0x1c')](_0x54acb9);}};}function respondWithFilteredResult(_0x3dd471,_0x1d879a){return function(_0x102446){if(_0x102446){var _0x59236f=typeof _0x1d879a[_0x481d('0x1d')]===_0x481d('0x1e')&&typeof _0x1d879a[_0x481d('0x1f')]===_0x481d('0x1e');var _0x5de9ed=_0x102446[_0x481d('0x20')];var _0x355518=_0x59236f?0x0:_0x1d879a['offset'];var _0x5f2739=_0x59236f?_0x102446['count']:_0x1d879a[_0x481d('0x1d')]+_0x1d879a[_0x481d('0x1f')];var _0x3b2540;if(_0x5f2739>=_0x5de9ed){_0x5f2739=_0x5de9ed;_0x3b2540=0xc8;}else{_0x3b2540=0xce;}_0x3dd471[_0x481d('0x1a')](_0x3b2540);return _0x3dd471['set'](_0x481d('0x21'),_0x355518+'-'+_0x5f2739+'/'+_0x5de9ed)[_0x481d('0x1c')](_0x102446);}return null;};}function patchUpdates(_0x421b2a){return function(_0x291d1e){try{jsonpatch[_0x481d('0x22')](_0x291d1e,_0x421b2a,!![]);}catch(_0x54abb8){return BPromise[_0x481d('0x23')](_0x54abb8);}return _0x291d1e[_0x481d('0x24')]();};}function saveUpdates(_0x11fb9b,_0x192329){return function(_0x11a52e){if(_0x11a52e){return _0x11a52e[_0x481d('0x25')](_0x11fb9b)['then'](function(_0x1e346a){return _0x1e346a;});}return null;};}function removeEntity(_0x23583f,_0x5ddcc8){return function(_0x2d77ba){if(_0x2d77ba){return _0x2d77ba['destroy']()[_0x481d('0x26')](function(){_0x23583f[_0x481d('0x1a')](0xcc)[_0x481d('0x1b')]();});}};}function handleEntityNotFound(_0x359bfb,_0x2b3056){return function(_0x5c9dbf){if(!_0x5c9dbf){_0x359bfb[_0x481d('0x19')](0x194);}return _0x5c9dbf;};}function handleError(_0x1825b8,_0x5b856b){_0x5b856b=_0x5b856b||0x1f4;return function(_0x360849){logger[_0x481d('0x27')](_0x360849[_0x481d('0x28')]);if(_0x360849[_0x481d('0x29')]){delete _0x360849['name'];}_0x1825b8['status'](_0x5b856b)[_0x481d('0x2a')](_0x360849);};}exports[_0x481d('0x25')]=function(_0x5efa3c,_0x1bdab8){if(_0x5efa3c[_0x481d('0x2b')]['id']){delete _0x5efa3c['body']['id'];}return db[_0x481d('0x2c')][_0x481d('0x2d')]({'where':{'id':_0x5efa3c[_0x481d('0x2e')]['id']}})[_0x481d('0x26')](handleEntityNotFound(_0x1bdab8,null))[_0x481d('0x26')](saveUpdates(_0x5efa3c[_0x481d('0x2b')],null))[_0x481d('0x26')](respondWithResult(_0x1bdab8,null))[_0x481d('0x2f')](handleError(_0x1bdab8,null));};exports['destroy']=function(_0x4fc4e0,_0x1b5d42){return db['Action']['find']({'where':{'id':_0x4fc4e0['params']['id']}})[_0x481d('0x26')](handleEntityNotFound(_0x1b5d42,null))[_0x481d('0x26')](removeEntity(_0x1b5d42,null))[_0x481d('0x2f')](handleError(_0x1b5d42,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d5d3864..49d91f0 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 _0x2dd3=['define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x384d9c,_0x590275){var _0x4d32da=function(_0x5dab02){while(--_0x5dab02){_0x384d9c['push'](_0x384d9c['shift']());}};_0x4d32da(++_0x590275);}(_0x2dd3,0x99));var _0x32dd=function(_0x447aa2,_0x103d7b){_0x447aa2=_0x447aa2-0x0;var _0x456bb2=_0x2dd3[_0x447aa2];return _0x456bb2;};'use strict';var _=require(_0x32dd('0x0'));var util=require(_0x32dd('0x1'));var logger=require(_0x32dd('0x2'))(_0x32dd('0x3'));var moment=require(_0x32dd('0x4'));var BPromise=require(_0x32dd('0x5'));var rp=require(_0x32dd('0x6'));var fs=require('fs');var path=require(_0x32dd('0x7'));var rimraf=require(_0x32dd('0x8'));var config=require(_0x32dd('0x9'));var attributes=require(_0x32dd('0xa'));module[_0x32dd('0xb')]=function(_0x5ecea6,_0x142edc){return _0x5ecea6[_0x32dd('0xc')](_0x32dd('0xd'),attributes,{'tableName':_0x32dd('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eab=['tools_actions','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','define'];(function(_0x1213bd,_0x71a10f){var _0x3471d1=function(_0x381d8a){while(--_0x381d8a){_0x1213bd['push'](_0x1213bd['shift']());}};_0x3471d1(++_0x71a10f);}(_0x2eab,0x8d));var _0xb2ea=function(_0x574007,_0x58a36d){_0x574007=_0x574007-0x0;var _0x22be55=_0x2eab[_0x574007];return _0x22be55;};'use strict';var _=require(_0xb2ea('0x0'));var util=require(_0xb2ea('0x1'));var logger=require(_0xb2ea('0x2'))(_0xb2ea('0x3'));var moment=require(_0xb2ea('0x4'));var BPromise=require(_0xb2ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2ea('0x6'));var rimraf=require('rimraf');var config=require(_0xb2ea('0x7'));var attributes=require('./action.attributes');module['exports']=function(_0x117496,_0x3a6c1e){return _0x117496[_0xb2ea('0x8')]('Action',attributes,{'tableName':_0xb2ea('0x9'),'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 743d61f..3b8e7b4 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x53ec,0x192));var _0xc53e=function(_0x2100d6,_0x55362c){_0x2100d6=_0x2100d6-0x0;var _0x298ddd=_0x53ec[_0x2100d6];return _0x298ddd;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +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(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x4975,0x86));var _0x5497=function(_0xd47394,_0x42c0d2){_0xd47394=_0xd47394-0x0;var _0x198ac5=_0x4975[_0xd47394];return _0x198ac5;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 04dadbc..22268f9 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 _0x063b=['../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0x063b,0x94));var _0xb063=function(_0x490bd6,_0x24bf24){_0x490bd6=_0x490bd6-0x0;var _0x10eddd=_0x063b[_0x490bd6];return _0x10eddd;};'use strict';var multer=require(_0xb063('0x0'));var util=require('util');var path=require(_0xb063('0x1'));var timeout=require(_0xb063('0x2'));var express=require(_0xb063('0x3'));var router=express[_0xb063('0x4')]();var fs_extra=require(_0xb063('0x5'));var auth=require(_0xb063('0x6'));var interaction=require(_0xb063('0x7'));var config=require('../../config/environment');var controller=require(_0xb063('0x8'));router[_0xb063('0x9')](_0xb063('0xa'),auth['isAuthenticated'](),controller[_0xb063('0xb')]);router[_0xb063('0xc')](_0xb063('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xb063('0xd')]=router; \ No newline at end of file +var _0xd6c5=['put','/:id','delete','isAuthenticated','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0xe13c51,_0x1d5358){var _0x23c04d=function(_0xfc418a){while(--_0xfc418a){_0xe13c51['push'](_0xe13c51['shift']());}};_0x23c04d(++_0x1d5358);}(_0xd6c5,0x9f));var _0x5d6c=function(_0x21a09f,_0x3fce61){_0x21a09f=_0x21a09f-0x0;var _0x3fef3f=_0xd6c5[_0x21a09f];return _0x3fef3f;};'use strict';var multer=require(_0x5d6c('0x0'));var util=require(_0x5d6c('0x1'));var path=require('path');var timeout=require(_0x5d6c('0x2'));var express=require('express');var router=express[_0x5d6c('0x3')]();var fs_extra=require(_0x5d6c('0x4'));var auth=require(_0x5d6c('0x5'));var interaction=require(_0x5d6c('0x6'));var config=require(_0x5d6c('0x7'));var controller=require(_0x5d6c('0x8'));router[_0x5d6c('0x9')](_0x5d6c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5d6c('0xb')](_0x5d6c('0xa'),auth[_0x5d6c('0xc')](),controller['destroy']);module[_0x5d6c('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 248c11b..d6e5a02 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 _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0xdc97,0x13b));var _0x7dc9=function(_0x547ed1,_0x35b297){_0x547ed1=_0x547ed1-0x0;var _0x505896=_0xdc97[_0x547ed1];return _0x505896;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file +var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x30861a,_0x337deb){var _0xa37ad6=function(_0x4dad90){while(--_0x4dad90){_0x30861a['push'](_0x30861a['shift']());}};_0xa37ad6(++_0x337deb);}(_0xf494,0x1c6));var _0x4f49=function(_0x1aec02,_0x3a7f22){_0x1aec02=_0x1aec02-0x0;var _0x10a837=_0xf494[_0x1aec02];return _0x10a837;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0311ca9..5fe14eb 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 _0x1753=['AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','sequelize','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','save','update','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','fields','length','includeAll','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','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','options','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignTable','foreignKey','conditions','group','Limited\x20Query:','toString','QueryTypes','SELECT','SUM(%s)','MAX(%s)','IS\x20NULL','keyBy','metric','order','parentKey','%s.%s\x20=\x20%s.%s','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom'];(function(_0x52a505,_0x5dec98){var _0x1fc95e=function(_0xdc7744){while(--_0xdc7744){_0x52a505['push'](_0x52a505['shift']());}};_0x1fc95e(++_0x5dec98);}(_0x1753,0xb3));var _0x3175=function(_0x4fa46f,_0x5608a3){_0x4fa46f=_0x4fa46f-0x0;var _0x541e74=_0x1753[_0x4fa46f];return _0x541e74;};'use strict';var emlformat=require(_0x3175('0x0'));var rimraf=require(_0x3175('0x1'));var zipdir=require(_0x3175('0x2'));var jsonpatch=require(_0x3175('0x3'));var rp=require(_0x3175('0x4'));var moment=require(_0x3175('0x5'));var BPromise=require(_0x3175('0x6'));var Mustache=require('mustache');var util=require(_0x3175('0x7'));var path=require('path');var sox=require(_0x3175('0x8'));var csv=require(_0x3175('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3175('0xa'));var _=require(_0x3175('0xb'));var squel=require(_0x3175('0xc'));var crypto=require(_0x3175('0xd'));var jsforce=require(_0x3175('0xe'));var deskjs=require(_0x3175('0xf'));var toCsv=require(_0x3175('0x9'));var querystring=require(_0x3175('0x10'));var Papa=require('papaparse');var Redis=require(_0x3175('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3175('0x12'));var as=require(_0x3175('0x13'));var hardwareService=require(_0x3175('0x14'));var logger=require(_0x3175('0x15'))(_0x3175('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3175('0x17'));var db=require(_0x3175('0x18'))['db'];var dbH=require(_0x3175('0x18'))['dbH'];function respondWithStatusCode(_0x4f3f64,_0x41526a){_0x41526a=_0x41526a||0xcc;return function(_0x1f64f4){if(_0x1f64f4){return _0x4f3f64[_0x3175('0x19')](_0x41526a);}return _0x4f3f64['status'](_0x41526a)[_0x3175('0x1a')]();};}function respondWithResult(_0x43b6de,_0x1ee7b1){_0x1ee7b1=_0x1ee7b1||0xc8;return function(_0x1dd2d3){if(_0x1dd2d3){return _0x43b6de[_0x3175('0x1b')](_0x1ee7b1)[_0x3175('0x1c')](_0x1dd2d3);}};}function respondWithFilteredResult(_0x55d0c9,_0x2b388b){return function(_0x4b117b){if(_0x4b117b){var _0x3a9d78=typeof _0x2b388b['offset']===_0x3175('0x1d')&&typeof _0x2b388b[_0x3175('0x1e')]==='undefined';var _0x173889=_0x4b117b[_0x3175('0x1f')];var _0x5033c9=_0x3a9d78?0x0:_0x2b388b[_0x3175('0x20')];var _0x94fd2f=_0x3a9d78?_0x4b117b[_0x3175('0x1f')]:_0x2b388b['offset']+_0x2b388b[_0x3175('0x1e')];var _0x431e57;if(_0x94fd2f>=_0x173889){_0x94fd2f=_0x173889;_0x431e57=0xc8;}else{_0x431e57=0xce;}_0x55d0c9[_0x3175('0x1b')](_0x431e57);return _0x55d0c9['set'](_0x3175('0x21'),_0x5033c9+'-'+_0x94fd2f+'/'+_0x173889)[_0x3175('0x1c')](_0x4b117b);}return null;};}function patchUpdates(_0x5e6f62){return function(_0x5995d3){try{jsonpatch['apply'](_0x5995d3,_0x5e6f62,!![]);}catch(_0x473bb8){return BPromise['reject'](_0x473bb8);}return _0x5995d3[_0x3175('0x22')]();};}function saveUpdates(_0x19ecf0,_0x343346){return function(_0x3d4889){if(_0x3d4889){return _0x3d4889[_0x3175('0x23')](_0x19ecf0)['then'](function(_0xc6d271){return _0xc6d271;});}return null;};}function removeEntity(_0x3bef31,_0x57324b){return function(_0x10e567){if(_0x10e567){return _0x10e567[_0x3175('0x24')]()[_0x3175('0x25')](function(){var _0x33b9ac=_0x10e567[_0x3175('0x26')]({'plain':!![]});var _0x8fae72=_0x3175('0x27');return db[_0x3175('0x28')][_0x3175('0x24')]({'where':{'type':_0x8fae72,'resourceId':_0x33b9ac['id']}})[_0x3175('0x25')](function(){return _0x10e567;});})[_0x3175('0x25')](function(){_0x3bef31[_0x3175('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b62f7,_0x59c169){return function(_0x1c6e6b){if(!_0x1c6e6b){_0x5b62f7['sendStatus'](0x194);}return _0x1c6e6b;};}function handleError(_0x235dba,_0x14f298){_0x14f298=_0x14f298||0x1f4;return function(_0x11ea53){logger[_0x3175('0x29')](_0x11ea53[_0x3175('0x2a')]);if(_0x11ea53[_0x3175('0x2b')]){delete _0x11ea53[_0x3175('0x2b')];}_0x235dba[_0x3175('0x1b')](_0x14f298)[_0x3175('0x2c')](_0x11ea53);};}exports[_0x3175('0x2d')]=function(_0x25e5f9,_0x5471b6){var _0x4c8317={},_0x5a52f9={},_0x37bbd5={'count':0x0,'rows':[]};var _0x5932f7=_[_0x3175('0x2e')](db[_0x3175('0x2f')][_0x3175('0x30')],function(_0x513fa6){return{'name':_0x513fa6[_0x3175('0x31')],'type':_0x513fa6[_0x3175('0x32')]['key']};});_0x5a52f9[_0x3175('0x33')]=_['map'](_0x5932f7,_0x3175('0x2b'));_0x5a52f9[_0x3175('0x34')]=_[_0x3175('0x35')](_0x25e5f9[_0x3175('0x34')]);_0x5a52f9['filters']=_['intersection'](_0x5a52f9[_0x3175('0x33')],_0x5a52f9['query']);_0x4c8317[_0x3175('0x36')]=_[_0x3175('0x37')](_0x5a52f9[_0x3175('0x33')],qs['fields'](_0x25e5f9['query']['fields']));_0x4c8317[_0x3175('0x36')]=_0x4c8317[_0x3175('0x36')]['length']?_0x4c8317['attributes']:_0x5a52f9[_0x3175('0x33')];if(!_0x25e5f9['query'][_0x3175('0x38')](_0x3175('0x39'))){_0x4c8317[_0x3175('0x1e')]=qs[_0x3175('0x1e')](_0x25e5f9[_0x3175('0x34')][_0x3175('0x1e')]);_0x4c8317[_0x3175('0x20')]=qs[_0x3175('0x20')](_0x25e5f9['query'][_0x3175('0x20')]);}_0x4c8317['order']=qs[_0x3175('0x3a')](_0x25e5f9['query'][_0x3175('0x3a')]);_0x4c8317['where']=qs[_0x3175('0x3b')](_[_0x3175('0x3c')](_0x25e5f9[_0x3175('0x34')],_0x5a52f9[_0x3175('0x3b')]),_0x5932f7);if(_0x25e5f9['query'][_0x3175('0x3d')]){_0x4c8317[_0x3175('0x3e')]=_[_0x3175('0x3f')](_0x4c8317['where'],{'$or':_[_0x3175('0x2e')](_0x5932f7,function(_0x352749){if(_0x352749[_0x3175('0x32')]!==_0x3175('0x40')){var _0x54399e={};_0x54399e[_0x352749[_0x3175('0x2b')]]={'$like':'%'+_0x25e5f9[_0x3175('0x34')][_0x3175('0x3d')]+'%'};return _0x54399e;}})});}_0x4c8317=_[_0x3175('0x3f')]({},_0x4c8317,_0x25e5f9['options']);var _0x4f38a5={'where':_0x4c8317[_0x3175('0x3e')]};return db[_0x3175('0x2f')]['count'](_0x4f38a5)[_0x3175('0x25')](function(_0x1a08c1){_0x37bbd5[_0x3175('0x1f')]=_0x1a08c1;if(_0x25e5f9[_0x3175('0x34')]['includeAll']){_0x4c8317[_0x3175('0x41')]=[{'all':!![]}];}return db[_0x3175('0x2f')]['findAll'](_0x4c8317);})[_0x3175('0x25')](function(_0x42758c){_0x37bbd5[_0x3175('0x42')]=_0x42758c;return _0x37bbd5;})[_0x3175('0x25')](respondWithFilteredResult(_0x5471b6,_0x4c8317))[_0x3175('0x43')](handleError(_0x5471b6,null));};exports[_0x3175('0x44')]=function(_0x26a780,_0x26496c){var _0x39663a={'raw':![],'where':{'id':_0x26a780[_0x3175('0x45')]['id']}},_0x4ac1f4={};_0x4ac1f4[_0x3175('0x33')]=_[_0x3175('0x35')](db[_0x3175('0x2f')][_0x3175('0x30')]);_0x4ac1f4[_0x3175('0x34')]=_[_0x3175('0x35')](_0x26a780[_0x3175('0x34')]);_0x4ac1f4[_0x3175('0x3b')]=_[_0x3175('0x37')](_0x4ac1f4['model'],_0x4ac1f4[_0x3175('0x34')]);_0x39663a[_0x3175('0x36')]=_[_0x3175('0x37')](_0x4ac1f4[_0x3175('0x33')],qs[_0x3175('0x46')](_0x26a780[_0x3175('0x34')][_0x3175('0x46')]));_0x39663a[_0x3175('0x36')]=_0x39663a['attributes'][_0x3175('0x47')]?_0x39663a['attributes']:_0x4ac1f4[_0x3175('0x33')];if(_0x26a780['query'][_0x3175('0x48')]){_0x39663a[_0x3175('0x41')]=[{'all':!![]}];}_0x39663a=_['merge']({},_0x39663a,_0x26a780['options']);return db[_0x3175('0x2f')][_0x3175('0x49')](_0x39663a)['then'](handleEntityNotFound(_0x26496c,null))[_0x3175('0x25')](respondWithResult(_0x26496c,null))[_0x3175('0x43')](handleError(_0x26496c,null));};exports[_0x3175('0x4a')]=function(_0x476955,_0x366db2){return db[_0x3175('0x2f')][_0x3175('0x4a')](_0x476955[_0x3175('0x4b')],{})[_0x3175('0x25')](function(_0x435981){var _0x416b73=_0x476955[_0x3175('0x4c')][_0x3175('0x26')]({'plain':!![]});if(!_0x416b73)throw new Error(_0x3175('0x4d'));if(_0x416b73[_0x3175('0x4e')]===_0x3175('0x4c')){var _0x639850=_0x435981[_0x3175('0x26')]({'plain':!![]});var _0xc7cd='Reports';return db[_0x3175('0x4f')][_0x3175('0x49')]({'where':{'name':_0xc7cd,'userProfileId':_0x416b73[_0x3175('0x50')]},'raw':!![]})[_0x3175('0x25')](function(_0x2c0ebc){if(_0x2c0ebc&&_0x2c0ebc[_0x3175('0x51')]===0x0){return db[_0x3175('0x28')][_0x3175('0x4a')]({'name':_0x639850['name'],'resourceId':_0x639850['id'],'type':_0x3175('0x27'),'sectionId':_0x2c0ebc['id']},{})[_0x3175('0x25')](function(){return _0x435981;});}else{return _0x435981;}})[_0x3175('0x43')](function(_0x34429d){logger[_0x3175('0x29')](_0x3175('0x52'),_0x34429d);throw _0x34429d;});}return _0x435981;})[_0x3175('0x25')](respondWithResult(_0x366db2,0xc9))[_0x3175('0x43')](handleError(_0x366db2,null));};exports[_0x3175('0x23')]=function(_0x190ff9,_0x475a42){if(_0x190ff9['body']['id']){delete _0x190ff9[_0x3175('0x4b')]['id'];}return db['AnalyticCustomReport'][_0x3175('0x49')]({'where':{'id':_0x190ff9['params']['id']}})[_0x3175('0x25')](handleEntityNotFound(_0x475a42,null))[_0x3175('0x25')](saveUpdates(_0x190ff9[_0x3175('0x4b')],null))[_0x3175('0x25')](respondWithResult(_0x475a42,null))['catch'](handleError(_0x475a42,null));};exports[_0x3175('0x24')]=function(_0x3572a3,_0x243b7f){return db[_0x3175('0x2f')][_0x3175('0x49')]({'where':{'id':_0x3572a3[_0x3175('0x45')]['id']}})[_0x3175('0x25')](handleEntityNotFound(_0x243b7f,null))[_0x3175('0x25')](removeEntity(_0x243b7f,null))[_0x3175('0x43')](handleError(_0x243b7f,null));};exports[_0x3175('0x53')]=function(_0x4b072c,_0x5295c4){var _0x322abf=0xa;var _0x45a022=[_0x3175('0x54'),_0x3175('0x55'),_0x3175('0x56'),_0x3175('0x57')];var _0x4e537d={'SUM':'SUM(%s)','COUNT':_0x3175('0x58'),'COUNT DISTINCT':_0x3175('0x59'),'MAX':'MAX(%s)','MIN':_0x3175('0x5a'),'AVG':_0x3175('0x5b'),'GROUP_CONCAT':_0x3175('0x5c'),'GROUP_CONCAT ASC':_0x3175('0x5d'),'GROUP_CONCAT DESC':_0x3175('0x5e')};var _0x55931d={'SEC_TO_TIME':_0x3175('0x5f'),'DATE':_0x3175('0x60'),'HOUR':_0x3175('0x61'),'ROUND':_0x3175('0x62'),'UNIX_TIMESTAMP':_0x3175('0x63')};var _0x4c6137=function(_0x201e4d){return!_['includes'](['IS\x20NULL',_0x3175('0x64'),_0x3175('0x65'),_0x3175('0x66')],_0x201e4d);};var _0x3d56f8=function(_0x51c211){if(!_0x51c211||!_0x51c211['rules'][_0x3175('0x47')]){return'';}for(var _0x6eee88='(',_0x339411=0x0;_0x339411<_0x51c211[_0x3175('0x67')][_0x3175('0x47')];_0x339411+=0x1){_0x339411>0x0&&(_0x6eee88+='\x20'+_0x51c211[_0x3175('0x68')]+'\x20');_0x6eee88+=_0x51c211[_0x3175('0x67')][_0x339411]['group']?_0x3d56f8(_0x51c211[_0x3175('0x67')][_0x339411]['group']):_0x51c211[_0x3175('0x67')][_0x339411][_0x3175('0x69')]+'\x20'+_0x51c211['rules'][_0x339411][_0x3175('0x6a')]+(_0x4c6137(_0x51c211['rules'][_0x339411][_0x3175('0x6a')])?'\x20'+_0x51c211[_0x3175('0x67')][_0x339411][_0x3175('0x6b')]:'');}return _0x6eee88+')';};var _0x3c7b70={'where':{'id':_0x4b072c[_0x3175('0x45')]['id']}},_0x4cd059,_0x58a7f3,_0x27d5a1,_0x51a74d,_0x15923f;_0x3c7b70=_[_0x3175('0x3f')]({},_0x3c7b70,_0x4b072c[_0x3175('0x6c')]);return db[_0x3175('0x2f')][_0x3175('0x49')](_0x3c7b70)[_0x3175('0x25')](function(_0xd533f7){if(_0xd533f7){_0x4cd059=_0xd533f7;return _0xd533f7[_0x3175('0x6d')]();}return null;})['then'](function(_0x3cbeb9){if(_0x3cbeb9){if(!_0x3cbeb9['length']){throw new db[(_0x3175('0x6e'))][(_0x3175('0x6f'))](_0x3175('0x70'),0x193);}_0x58a7f3=_0x3cbeb9;return db[_0x3175('0x71')][_0x3175('0x72')]({'raw':!![]});}return null;})['then'](function(_0x5f64b3){if(_0x5f64b3){_0x27d5a1=_['keyBy'](_0x5f64b3,'id');var _0x5dc884;var _0x1137c9=squel[_0x3175('0x73')]();_0x1137c9[_0x3175('0x74')](_0x4cd059[_0x3175('0x75')]);for(var _0x1788b3=0x0;_0x1788b3<_0x58a7f3[_0x3175('0x47')];_0x1788b3+=0x1){_0x5dc884=_0x58a7f3[_0x1788b3][_0x3175('0x76')]?_0x27d5a1[_0x58a7f3[_0x1788b3][_0x3175('0x76')]]['metric']:_0x58a7f3[_0x1788b3][_0x3175('0x69')];_0x5dc884=_0x58a7f3[_0x1788b3][_0x3175('0x77')]?_[_0x3175('0x78')](_0x4e537d[_0x58a7f3[_0x1788b3][_0x3175('0x77')]],'%s',_0x5dc884):_0x5dc884;_0x5dc884=_0x58a7f3[_0x1788b3][_0x3175('0x79')]?_[_0x3175('0x78')](_0x55931d[_0x58a7f3[_0x1788b3]['format']],'%s',_0x5dc884):_0x5dc884;if(_0x58a7f3[_0x1788b3][_0x3175('0x7a')]){_0x1137c9['group'](_0x5dc884);}_0x58a7f3[_0x1788b3][_0x3175('0x7b')]&&_0x1137c9['order'](_0x5dc884,_0x58a7f3[_0x1788b3][_0x3175('0x7b')]===_0x3175('0x7c')?![]:!![]);_0x1137c9['field'](_0x5dc884,_0x58a7f3[_0x1788b3][_0x3175('0x7d')]||_0x5dc884);}if(_0x4cd059[_0x3175('0x7e')]){_0x4cd059['joins']=JSON[_0x3175('0x7f')](_0x4cd059['joins']);for(var _0x371e86=0x0;_0x371e86<_0x4cd059[_0x3175('0x7e')]['length'];_0x371e86+=0x1){if(_0x4cd059[_0x3175('0x7e')][_0x371e86][_0x3175('0x32')]&&_[_0x3175('0x80')](_0x45a022,_0x4cd059['joins'][_0x371e86][_0x3175('0x32')])&&_0x4cd059[_0x3175('0x7e')][_0x371e86]['parentKey']&&_0x4cd059[_0x3175('0x7e')][_0x371e86][_0x3175('0x81')]&&_0x4cd059[_0x3175('0x7e')][_0x371e86]['foreignKey']){_0x1137c9[_0x4cd059[_0x3175('0x7e')][_0x371e86][_0x3175('0x32')]](_0x4cd059[_0x3175('0x7e')][_0x371e86][_0x3175('0x81')],null,util[_0x3175('0x79')]('%s.%s\x20=\x20%s.%s',_0x4cd059[_0x3175('0x75')],_0x4cd059['joins'][_0x371e86]['parentKey'],_0x4cd059[_0x3175('0x7e')][_0x371e86]['foreignTable'],_0x4cd059[_0x3175('0x7e')][_0x371e86][_0x3175('0x82')]));}}}if(_0x4cd059[_0x3175('0x83')]){_0x4cd059[_0x3175('0x83')]=JSON[_0x3175('0x7f')](_0x4cd059[_0x3175('0x83')]);_0x1137c9[_0x3175('0x3e')](_0x3d56f8(_0x4cd059[_0x3175('0x83')][_0x3175('0x84')]));}_0x15923f=_0x1137c9['clone']();_0x1137c9[_0x3175('0x1e')](_0x322abf);_0x1137c9[_0x3175('0x20')](0x0);logger['debug'](_0x3175('0x85'),_0x1137c9[_0x3175('0x86')]());return dbH['sequelize'][_0x3175('0x34')](_0x1137c9[_0x3175('0x86')](),{'type':dbH['sequelize'][_0x3175('0x87')][_0x3175('0x88')]});}})[_0x3175('0x25')](respondWithResult(_0x5295c4,null))[_0x3175('0x43')](handleError(_0x5295c4,null));};function runReport(_0x30b3e3,_0x4ad6be,_0x557f96){var _0x49bc02=_0x4ad6be['name'];var _0x349742=0xa;var _0x3095c5=[_0x3175('0x54'),_0x3175('0x55'),'right_join',_0x3175('0x57')];var _0x57b7e2={'SUM':_0x3175('0x89'),'COUNT':_0x3175('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3175('0x8a'),'MIN':_0x3175('0x5a'),'AVG':_0x3175('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3175('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x9adcca={'SEC_TO_TIME':_0x3175('0x5f'),'DATE':_0x3175('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x3175('0x62'),'UNIX_TIMESTAMP':_0x3175('0x63')};var _0x49537c=function(_0x4ff7a0){return!_[_0x3175('0x80')]([_0x3175('0x8b'),_0x3175('0x64'),_0x3175('0x65'),_0x3175('0x66')],_0x4ff7a0);};var _0x300a82=function(_0x2dc0ee){if(!_0x2dc0ee||!_0x2dc0ee[_0x3175('0x67')][_0x3175('0x47')]){return'';}for(var _0x1e54fe='(',_0x2755a4=0x0;_0x2755a4<_0x2dc0ee[_0x3175('0x67')]['length'];_0x2755a4+=0x1){_0x2755a4>0x0&&(_0x1e54fe+='\x20'+_0x2dc0ee['operator']+'\x20');_0x1e54fe+=_0x2dc0ee[_0x3175('0x67')][_0x2755a4]['group']?_0x300a82(_0x2dc0ee[_0x3175('0x67')][_0x2755a4][_0x3175('0x84')]):_0x2dc0ee[_0x3175('0x67')][_0x2755a4][_0x3175('0x69')]+'\x20'+_0x2dc0ee['rules'][_0x2755a4][_0x3175('0x6a')]+(_0x49537c(_0x2dc0ee[_0x3175('0x67')][_0x2755a4][_0x3175('0x6a')])?'\x20'+_0x2dc0ee[_0x3175('0x67')][_0x2755a4][_0x3175('0x6b')]:'');}return _0x1e54fe+')';};var _0x52db26={'where':{'id':_0x30b3e3['id']}},_0x43045f,_0x2b7de9,_0x10a7c6,_0x353016,_0x57e002;_0x52db26=_[_0x3175('0x3f')]({},_0x52db26,_0x557f96);return db['AnalyticCustomReport'][_0x3175('0x49')](_0x52db26)[_0x3175('0x25')](function(_0x39ad9d){if(_0x39ad9d){_0x43045f=_0x39ad9d;return _0x39ad9d[_0x3175('0x6d')]();}return null;})['then'](function(_0x194154){if(_0x194154){if(!_0x194154[_0x3175('0x47')]){throw new db['Sequelize'][(_0x3175('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2b7de9=_0x194154;return db[_0x3175('0x71')][_0x3175('0x72')]({'raw':!![]});}return null;})[_0x3175('0x25')](function(_0x115e2b){if(_0x115e2b){_0x10a7c6=_[_0x3175('0x8c')](_0x115e2b,'id');var _0x2c4570;var _0x47fe85=squel['select']();_0x47fe85[_0x3175('0x74')](_0x43045f['table']);for(var _0x38eb82=0x0;_0x38eb82<_0x2b7de9[_0x3175('0x47')];_0x38eb82+=0x1){_0x2c4570=_0x2b7de9[_0x38eb82][_0x3175('0x76')]?_0x10a7c6[_0x2b7de9[_0x38eb82][_0x3175('0x76')]][_0x3175('0x8d')]:_0x2b7de9[_0x38eb82]['field'];_0x2c4570=_0x2b7de9[_0x38eb82][_0x3175('0x77')]?_[_0x3175('0x78')](_0x57b7e2[_0x2b7de9[_0x38eb82]['function']],'%s',_0x2c4570):_0x2c4570;_0x2c4570=_0x2b7de9[_0x38eb82][_0x3175('0x79')]?_[_0x3175('0x78')](_0x9adcca[_0x2b7de9[_0x38eb82][_0x3175('0x79')]],'%s',_0x2c4570):_0x2c4570;if(_0x2b7de9[_0x38eb82][_0x3175('0x7a')]){_0x47fe85['group'](_0x2c4570);}_0x2b7de9[_0x38eb82][_0x3175('0x7b')]&&_0x47fe85[_0x3175('0x8e')](_0x2c4570,_0x2b7de9[_0x38eb82][_0x3175('0x7b')]===_0x3175('0x7c')?![]:!![]);_0x47fe85[_0x3175('0x69')](_0x2c4570,_0x2b7de9[_0x38eb82][_0x3175('0x7d')]||_0x2c4570);}if(_0x43045f['joins']){_0x43045f[_0x3175('0x7e')]=JSON[_0x3175('0x7f')](_0x43045f[_0x3175('0x7e')]);for(var _0x4bf60c=0x0;_0x4bf60c<_0x43045f[_0x3175('0x7e')][_0x3175('0x47')];_0x4bf60c+=0x1){if(_0x43045f[_0x3175('0x7e')][_0x4bf60c][_0x3175('0x32')]&&_[_0x3175('0x80')](_0x3095c5,_0x43045f[_0x3175('0x7e')][_0x4bf60c][_0x3175('0x32')])&&_0x43045f['joins'][_0x4bf60c][_0x3175('0x8f')]&&_0x43045f[_0x3175('0x7e')][_0x4bf60c]['foreignTable']&&_0x43045f[_0x3175('0x7e')][_0x4bf60c][_0x3175('0x82')]){_0x47fe85[_0x43045f['joins'][_0x4bf60c][_0x3175('0x32')]](_0x43045f['joins'][_0x4bf60c][_0x3175('0x81')],null,util[_0x3175('0x79')](_0x3175('0x90'),_0x43045f[_0x3175('0x75')],_0x43045f[_0x3175('0x7e')][_0x4bf60c]['parentKey'],_0x43045f[_0x3175('0x7e')][_0x4bf60c][_0x3175('0x81')],_0x43045f['joins'][_0x4bf60c][_0x3175('0x82')]));}}}if(_0x43045f[_0x3175('0x83')]){_0x43045f[_0x3175('0x83')]=JSON[_0x3175('0x7f')](_0x43045f[_0x3175('0x83')]);_0x47fe85[_0x3175('0x3e')](_0x300a82(_0x43045f[_0x3175('0x83')][_0x3175('0x84')]));}_0x57e002=_0x47fe85[_0x3175('0x91')]();_0x47fe85[_0x3175('0x1e')](_0x349742);_0x47fe85[_0x3175('0x20')](0x0);return;}})[_0x3175('0x25')](function(){if(_0x4ad6be[_0x3175('0x92')]==='web'){return null;}var _0x536a9e=_[_0x3175('0x3f')](_0x4ad6be,{'name':_0x4ad6be[_0x3175('0x93')]||_0x4ad6be[_0x3175('0x2b')]||_0x43045f[_0x3175('0x2b')],'basename':_0x49bc02,'savename':util[_0x3175('0x79')](_0x3175('0x94'),_0x4ad6be[_0x3175('0x2b')]||_0x43045f[_0x3175('0x2b')],require(_0x3175('0x95'))[_0x3175('0x96')](0x4),_0x4ad6be[_0x3175('0x92')]||_0x3175('0x97')),'reportId':_0x43045f['id'],'reportType':_0x3175('0x98')});return db[_0x3175('0x99')]['create'](_0x536a9e,{'raw':!![]});})[_0x3175('0x25')](function(_0x399d06){if(_0x43045f[_0x3175('0x75')]==='cdr'){_0x57e002[_0x3175('0x3e')](_0x43045f[_0x3175('0x75')]+_0x3175('0x9a'),_0x4ad6be[_0x3175('0x9b')],_0x4ad6be[_0x3175('0x9c')]);}else{_0x57e002[_0x3175('0x3e')](_0x43045f[_0x3175('0x75')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4ad6be[_0x3175('0x9b')],_0x4ad6be['endDate']);}if(_0x399d06){logger[_0x3175('0x9d')]('Run\x20Query:',_0x57e002[_0x3175('0x86')]());require(_0x3175('0x9e'))[_0x3175('0x9f')](path[_0x3175('0x54')](__dirname,_0x3175('0xa0'),_0x399d06['output']),[_0x399d06['id'],_0x57e002[_0x3175('0x86')](),path[_0x3175('0x54')](__dirname,_0x3175('0xa1'),_0x399d06['savename']),_0x49bc02]);return _0x399d06;}else{var _0x12773f=squel[_0x3175('0x73')]();_0x12773f[_0x3175('0x74')]('('+_0x57e002['toString']()+')',_0x3175('0xa2'));_0x12773f[_0x3175('0x69')](_0x3175('0xa3'),_0x3175('0x1f'));_0x57e002['limit'](_0x4ad6be[_0x3175('0x1e')]||_0x349742);_0x57e002[_0x3175('0x20')](_0x4ad6be[_0x3175('0x20')]||0x0);return dbH[_0x3175('0xa4')][_0x3175('0x34')](_0x12773f['toString'](),{'type':dbH[_0x3175('0xa4')][_0x3175('0x87')]['SELECT']})['then'](function(_0x3a0ef5){if(!_0x3a0ef5[_0x3175('0x47')]){_0x353016=0x0;}else{_0x353016=_0x3a0ef5[0x0][_0x3175('0x1f')]||0x0;}return dbH[_0x3175('0xa4')]['query'](_0x57e002[_0x3175('0x86')](),{'type':dbH[_0x3175('0xa4')][_0x3175('0x87')][_0x3175('0x88')]});})[_0x3175('0x25')](function(_0x450b4f){return{'rows':_0x450b4f||[],'count':_0x353016};});}});}exports[_0x3175('0xa5')]=function(_0x5d523d,_0x2498e0){return runReport(_0x5d523d[_0x3175('0x45')],_0x5d523d[_0x3175('0x34')],_0x5d523d['options'])['then'](respondWithResult(_0x2498e0,null))[_0x3175('0x43')](handleError(_0x2498e0,null));};exports['runReport']=runReport;exports[_0x3175('0x34')]=function(_0x37d286,_0x30864b){var _0xfaca8d=0xa;var _0x2a3763=[_0x3175('0x54'),_0x3175('0x55'),'right_join',_0x3175('0x57')];var _0x13448d={'SUM':'SUM(%s)','COUNT':_0x3175('0x58'),'COUNT DISTINCT':_0x3175('0x59'),'MAX':_0x3175('0x8a'),'MIN':_0x3175('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x3175('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3175('0x5e')};var _0x2121eb={'SEC_TO_TIME':_0x3175('0x5f'),'DATE':_0x3175('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x3175('0x62'),'UNIX_TIMESTAMP':_0x3175('0x63')};var _0x4040e7=function(_0x435cf0){return!_['includes']([_0x3175('0x8b'),'IS\x20NOT\x20NULL',_0x3175('0x65'),'IS\x20NOT\x20EMPTY'],_0x435cf0);};var _0x4ab2e6=function(_0x4b77ba){if(!_0x4b77ba||!_0x4b77ba[_0x3175('0x67')][_0x3175('0x47')]){return'';}for(var _0x56b501='(',_0x10a2e3=0x0;_0x10a2e3<_0x4b77ba[_0x3175('0x67')][_0x3175('0x47')];_0x10a2e3+=0x1){_0x10a2e3>0x0&&(_0x56b501+='\x20'+_0x4b77ba[_0x3175('0x68')]+'\x20');_0x56b501+=_0x4b77ba[_0x3175('0x67')][_0x10a2e3][_0x3175('0x84')]?_0x4ab2e6(_0x4b77ba['rules'][_0x10a2e3]['group']):_0x4b77ba[_0x3175('0x67')][_0x10a2e3][_0x3175('0x69')]+'\x20'+_0x4b77ba['rules'][_0x10a2e3][_0x3175('0x6a')]+(_0x4040e7(_0x4b77ba[_0x3175('0x67')][_0x10a2e3][_0x3175('0x6a')])?'\x20'+_0x4b77ba[_0x3175('0x67')][_0x10a2e3][_0x3175('0x6b')]:'');}return _0x56b501+')';};var _0x3e9f82={'where':{'id':_0x37d286[_0x3175('0x45')]['id']}},_0x8a8463,_0x94b36e,_0x4ac2cc,_0x5f49a3,_0x1aa760;_0x3e9f82=_[_0x3175('0x3f')]({},_0x3e9f82,_0x37d286[_0x3175('0x6c')]);return db['AnalyticCustomReport'][_0x3175('0x49')](_0x3e9f82)[_0x3175('0x25')](function(_0x36a536){if(_0x36a536){_0x8a8463=_0x36a536;return _0x36a536['getFields']();}return null;})[_0x3175('0x25')](function(_0xd5b0a3){if(_0xd5b0a3){if(!_0xd5b0a3[_0x3175('0x47')]){throw new db[(_0x3175('0x6e'))][(_0x3175('0x6f'))](_0x3175('0x70'),0x193);}_0x94b36e=_0xd5b0a3;return db[_0x3175('0x71')]['findAll']({'raw':!![]});}return null;})[_0x3175('0x25')](function(_0x42d1f6){if(_0x42d1f6){_0x4ac2cc=_[_0x3175('0x8c')](_0x42d1f6,'id');var _0x4c6ad4;var _0x2517af=squel[_0x3175('0x73')]();_0x2517af[_0x3175('0x74')](_0x8a8463[_0x3175('0x75')]);for(var _0x4257ac=0x0;_0x4257ac<_0x94b36e[_0x3175('0x47')];_0x4257ac+=0x1){_0x4c6ad4=_0x94b36e[_0x4257ac][_0x3175('0x76')]?_0x4ac2cc[_0x94b36e[_0x4257ac][_0x3175('0x76')]]['metric']:_0x94b36e[_0x4257ac][_0x3175('0x69')];_0x4c6ad4=_0x94b36e[_0x4257ac][_0x3175('0x77')]?_[_0x3175('0x78')](_0x13448d[_0x94b36e[_0x4257ac]['function']],'%s',_0x4c6ad4):_0x4c6ad4;_0x4c6ad4=_0x94b36e[_0x4257ac][_0x3175('0x79')]?_['replace'](_0x2121eb[_0x94b36e[_0x4257ac][_0x3175('0x79')]],'%s',_0x4c6ad4):_0x4c6ad4;if(_0x94b36e[_0x4257ac]['groupBy']){_0x2517af[_0x3175('0x84')](_0x4c6ad4);}_0x94b36e[_0x4257ac][_0x3175('0x7b')]&&_0x2517af[_0x3175('0x8e')](_0x4c6ad4,_0x94b36e[_0x4257ac][_0x3175('0x7b')]===_0x3175('0x7c')?![]:!![]);_0x2517af[_0x3175('0x69')](_0x4c6ad4,_0x94b36e[_0x4257ac][_0x3175('0x7d')]||_0x4c6ad4);}if(_0x8a8463[_0x3175('0x7e')]){_0x8a8463[_0x3175('0x7e')]=JSON['parse'](_0x8a8463['joins']);for(var _0x3872b0=0x0;_0x3872b0<_0x8a8463[_0x3175('0x7e')][_0x3175('0x47')];_0x3872b0+=0x1){if(_0x8a8463[_0x3175('0x7e')][_0x3872b0][_0x3175('0x32')]&&_[_0x3175('0x80')](_0x2a3763,_0x8a8463[_0x3175('0x7e')][_0x3872b0]['type'])&&_0x8a8463[_0x3175('0x7e')][_0x3872b0]['parentKey']&&_0x8a8463['joins'][_0x3872b0][_0x3175('0x81')]&&_0x8a8463[_0x3175('0x7e')][_0x3872b0][_0x3175('0x82')]){_0x2517af[_0x8a8463['joins'][_0x3872b0][_0x3175('0x32')]](_0x8a8463[_0x3175('0x7e')][_0x3872b0][_0x3175('0x81')],null,util[_0x3175('0x79')](_0x3175('0x90'),_0x8a8463[_0x3175('0x75')],_0x8a8463[_0x3175('0x7e')][_0x3872b0][_0x3175('0x8f')],_0x8a8463[_0x3175('0x7e')][_0x3872b0][_0x3175('0x81')],_0x8a8463[_0x3175('0x7e')][_0x3872b0][_0x3175('0x82')]));}}}if(_0x8a8463[_0x3175('0x83')]){_0x8a8463['conditions']=JSON[_0x3175('0x7f')](_0x8a8463[_0x3175('0x83')]);_0x2517af[_0x3175('0x3e')](_0x4ab2e6(_0x8a8463['conditions']['group']));}_0x1aa760=_0x2517af[_0x3175('0x91')]();_0x2517af['limit'](_0xfaca8d);_0x2517af[_0x3175('0x20')](0x0);logger['debug'](_0x3175('0x85'),_0x2517af[_0x3175('0x86')]());return dbH[_0x3175('0xa4')][_0x3175('0x34')](_0x2517af[_0x3175('0x86')](),{'type':dbH[_0x3175('0xa4')][_0x3175('0x87')]['SELECT']});}})[_0x3175('0x25')](function(){return{'sql':_0x1aa760[_0x3175('0x86')]()};})[_0x3175('0x25')](respondWithResult(_0x30864b,null))['catch'](handleError(_0x30864b,null));}; \ No newline at end of file +var _0xf2d9=['joins','parentKey','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','IS\x20NOT\x20NULL','value','AnalyticMetric','DESC','foreignTable','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','run','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','reject','then','destroy','get','CustomReports','error','stack','send','index','AnalyticCustomReport','fieldName','key','keys','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','include','findAll','rows','show','params','rawAttributes','filters','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','alias'];(function(_0x39b7b6,_0x14bcf4){var _0x5e4e75=function(_0x4daadb){while(--_0x4daadb){_0x39b7b6['push'](_0x39b7b6['shift']());}};_0x5e4e75(++_0x14bcf4);}(_0xf2d9,0xd2));var _0x9f2d=function(_0x4da2a6,_0x261779){_0x4da2a6=_0x4da2a6-0x0;var _0x2a9788=_0xf2d9[_0x4da2a6];return _0x2a9788;};'use strict';var emlformat=require(_0x9f2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f2d('0x1'));var jsonpatch=require(_0x9f2d('0x2'));var rp=require(_0x9f2d('0x3'));var moment=require(_0x9f2d('0x4'));var BPromise=require(_0x9f2d('0x5'));var Mustache=require(_0x9f2d('0x6'));var util=require(_0x9f2d('0x7'));var path=require(_0x9f2d('0x8'));var sox=require(_0x9f2d('0x9'));var csv=require(_0x9f2d('0xa'));var ejs=require(_0x9f2d('0xb'));var fs=require('fs');var fs_extra=require(_0x9f2d('0xc'));var _=require('lodash');var squel=require(_0x9f2d('0xd'));var crypto=require(_0x9f2d('0xe'));var jsforce=require(_0x9f2d('0xf'));var deskjs=require(_0x9f2d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f2d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f2d('0x12'));var as=require(_0x9f2d('0x13'));var hardwareService=require(_0x9f2d('0x14'));var logger=require(_0x9f2d('0x15'))(_0x9f2d('0x16'));var utils=require(_0x9f2d('0x17'));var config=require(_0x9f2d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f2d('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x14f6ae,_0x184ce6){_0x184ce6=_0x184ce6||0xcc;return function(_0x13fc99){if(_0x13fc99){return _0x14f6ae[_0x9f2d('0x1a')](_0x184ce6);}return _0x14f6ae['status'](_0x184ce6)[_0x9f2d('0x1b')]();};}function respondWithResult(_0x1e6b4f,_0xbded3d){_0xbded3d=_0xbded3d||0xc8;return function(_0x486293){if(_0x486293){return _0x1e6b4f[_0x9f2d('0x1c')](_0xbded3d)[_0x9f2d('0x1d')](_0x486293);}};}function respondWithFilteredResult(_0x4a4a5d,_0x591878){return function(_0x22f7f4){if(_0x22f7f4){var _0x50f762=typeof _0x591878[_0x9f2d('0x1e')]==='undefined'&&typeof _0x591878['limit']==='undefined';var _0xa249bd=_0x22f7f4[_0x9f2d('0x1f')];var _0x100ef5=_0x50f762?0x0:_0x591878['offset'];var _0x45cd72=_0x50f762?_0x22f7f4['count']:_0x591878[_0x9f2d('0x1e')]+_0x591878[_0x9f2d('0x20')];var _0x124145;if(_0x45cd72>=_0xa249bd){_0x45cd72=_0xa249bd;_0x124145=0xc8;}else{_0x124145=0xce;}_0x4a4a5d[_0x9f2d('0x1c')](_0x124145);return _0x4a4a5d[_0x9f2d('0x21')]('Content-Range',_0x100ef5+'-'+_0x45cd72+'/'+_0xa249bd)[_0x9f2d('0x1d')](_0x22f7f4);}return null;};}function patchUpdates(_0x40e6a5){return function(_0x930309){try{jsonpatch['apply'](_0x930309,_0x40e6a5,!![]);}catch(_0x7dda0f){return BPromise[_0x9f2d('0x22')](_0x7dda0f);}return _0x930309['save']();};}function saveUpdates(_0x26ea93,_0x2c6dc5){return function(_0x520cdf){if(_0x520cdf){return _0x520cdf['update'](_0x26ea93)[_0x9f2d('0x23')](function(_0x175465){return _0x175465;});}return null;};}function removeEntity(_0x1026d2,_0x3a7d4e){return function(_0x3444f0){if(_0x3444f0){return _0x3444f0[_0x9f2d('0x24')]()[_0x9f2d('0x23')](function(){var _0x39f84b=_0x3444f0[_0x9f2d('0x25')]({'plain':!![]});var _0x2ae19d=_0x9f2d('0x26');return db['UserProfileResource'][_0x9f2d('0x24')]({'where':{'type':_0x2ae19d,'resourceId':_0x39f84b['id']}})['then'](function(){return _0x3444f0;});})[_0x9f2d('0x23')](function(){_0x1026d2[_0x9f2d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37190a,_0x1c18c1){return function(_0x106ed8){if(!_0x106ed8){_0x37190a[_0x9f2d('0x1a')](0x194);}return _0x106ed8;};}function handleError(_0x1b3c02,_0xa4219e){_0xa4219e=_0xa4219e||0x1f4;return function(_0x1f8270){logger[_0x9f2d('0x27')](_0x1f8270[_0x9f2d('0x28')]);if(_0x1f8270['name']){delete _0x1f8270['name'];}_0x1b3c02[_0x9f2d('0x1c')](_0xa4219e)[_0x9f2d('0x29')](_0x1f8270);};}exports[_0x9f2d('0x2a')]=function(_0x205d96,_0x29006b){var _0x27f6e3={},_0x20a827={},_0x36ad06={'count':0x0,'rows':[]};var _0x5a3ac6=_['map'](db[_0x9f2d('0x2b')]['rawAttributes'],function(_0xd7190f){return{'name':_0xd7190f[_0x9f2d('0x2c')],'type':_0xd7190f['type'][_0x9f2d('0x2d')]};});_0x20a827['model']=_['map'](_0x5a3ac6,'name');_0x20a827['query']=_[_0x9f2d('0x2e')](_0x205d96['query']);_0x20a827['filters']=_['intersection'](_0x20a827[_0x9f2d('0x2f')],_0x20a827[_0x9f2d('0x30')]);_0x27f6e3[_0x9f2d('0x31')]=_[_0x9f2d('0x32')](_0x20a827[_0x9f2d('0x2f')],qs[_0x9f2d('0x33')](_0x205d96[_0x9f2d('0x30')][_0x9f2d('0x33')]));_0x27f6e3[_0x9f2d('0x31')]=_0x27f6e3[_0x9f2d('0x31')][_0x9f2d('0x34')]?_0x27f6e3[_0x9f2d('0x31')]:_0x20a827['model'];if(!_0x205d96[_0x9f2d('0x30')][_0x9f2d('0x35')](_0x9f2d('0x36'))){_0x27f6e3['limit']=qs[_0x9f2d('0x20')](_0x205d96[_0x9f2d('0x30')][_0x9f2d('0x20')]);_0x27f6e3[_0x9f2d('0x1e')]=qs[_0x9f2d('0x1e')](_0x205d96[_0x9f2d('0x30')][_0x9f2d('0x1e')]);}_0x27f6e3['order']=qs[_0x9f2d('0x37')](_0x205d96['query'][_0x9f2d('0x37')]);_0x27f6e3[_0x9f2d('0x38')]=qs['filters'](_[_0x9f2d('0x39')](_0x205d96['query'],_0x20a827['filters']),_0x5a3ac6);if(_0x205d96[_0x9f2d('0x30')][_0x9f2d('0x3a')]){_0x27f6e3[_0x9f2d('0x38')]=_[_0x9f2d('0x3b')](_0x27f6e3[_0x9f2d('0x38')],{'$or':_['map'](_0x5a3ac6,function(_0x51921e){if(_0x51921e[_0x9f2d('0x3c')]!==_0x9f2d('0x3d')){var _0x2b08e8={};_0x2b08e8[_0x51921e[_0x9f2d('0x3e')]]={'$like':'%'+_0x205d96['query']['filter']+'%'};return _0x2b08e8;}})});}_0x27f6e3=_['merge']({},_0x27f6e3,_0x205d96['options']);var _0x204628={'where':_0x27f6e3[_0x9f2d('0x38')]};return db[_0x9f2d('0x2b')]['count'](_0x204628)[_0x9f2d('0x23')](function(_0x17e5e3){_0x36ad06[_0x9f2d('0x1f')]=_0x17e5e3;if(_0x205d96[_0x9f2d('0x30')]['includeAll']){_0x27f6e3[_0x9f2d('0x3f')]=[{'all':!![]}];}return db[_0x9f2d('0x2b')][_0x9f2d('0x40')](_0x27f6e3);})[_0x9f2d('0x23')](function(_0x529b3b){_0x36ad06[_0x9f2d('0x41')]=_0x529b3b;return _0x36ad06;})[_0x9f2d('0x23')](respondWithFilteredResult(_0x29006b,_0x27f6e3))['catch'](handleError(_0x29006b,null));};exports[_0x9f2d('0x42')]=function(_0x2668b3,_0x439a6b){var _0x5c261e={'raw':![],'where':{'id':_0x2668b3[_0x9f2d('0x43')]['id']}},_0x6b82d5={};_0x6b82d5[_0x9f2d('0x2f')]=_['keys'](db[_0x9f2d('0x2b')][_0x9f2d('0x44')]);_0x6b82d5[_0x9f2d('0x30')]=_[_0x9f2d('0x2e')](_0x2668b3[_0x9f2d('0x30')]);_0x6b82d5[_0x9f2d('0x45')]=_[_0x9f2d('0x32')](_0x6b82d5['model'],_0x6b82d5[_0x9f2d('0x30')]);_0x5c261e['attributes']=_[_0x9f2d('0x32')](_0x6b82d5['model'],qs[_0x9f2d('0x33')](_0x2668b3[_0x9f2d('0x30')][_0x9f2d('0x33')]));_0x5c261e['attributes']=_0x5c261e[_0x9f2d('0x31')][_0x9f2d('0x34')]?_0x5c261e[_0x9f2d('0x31')]:_0x6b82d5[_0x9f2d('0x2f')];if(_0x2668b3[_0x9f2d('0x30')][_0x9f2d('0x46')]){_0x5c261e[_0x9f2d('0x3f')]=[{'all':!![]}];}_0x5c261e=_[_0x9f2d('0x3b')]({},_0x5c261e,_0x2668b3[_0x9f2d('0x47')]);return db[_0x9f2d('0x2b')][_0x9f2d('0x48')](_0x5c261e)[_0x9f2d('0x23')](handleEntityNotFound(_0x439a6b,null))[_0x9f2d('0x23')](respondWithResult(_0x439a6b,null))[_0x9f2d('0x49')](handleError(_0x439a6b,null));};exports[_0x9f2d('0x4a')]=function(_0x3eddd5,_0x3e7996){return db[_0x9f2d('0x2b')]['create'](_0x3eddd5[_0x9f2d('0x4b')],{})[_0x9f2d('0x23')](function(_0x5ec9e5){var _0x5065d1=_0x3eddd5[_0x9f2d('0x4c')]['get']({'plain':!![]});if(!_0x5065d1)throw new Error(_0x9f2d('0x4d'));if(_0x5065d1['role']===_0x9f2d('0x4c')){var _0x3ff324=_0x5ec9e5[_0x9f2d('0x25')]({'plain':!![]});var _0x976b61='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x976b61,'userProfileId':_0x5065d1[_0x9f2d('0x4e')]},'raw':!![]})[_0x9f2d('0x23')](function(_0x25662a){if(_0x25662a&&_0x25662a['autoAssociation']===0x0){return db['UserProfileResource'][_0x9f2d('0x4a')]({'name':_0x3ff324[_0x9f2d('0x3e')],'resourceId':_0x3ff324['id'],'type':_0x9f2d('0x26'),'sectionId':_0x25662a['id']},{})['then'](function(){return _0x5ec9e5;});}else{return _0x5ec9e5;}})[_0x9f2d('0x49')](function(_0x5c0bdb){logger[_0x9f2d('0x27')](_0x9f2d('0x4f'),_0x5c0bdb);throw _0x5c0bdb;});}return _0x5ec9e5;})[_0x9f2d('0x23')](respondWithResult(_0x3e7996,0xc9))[_0x9f2d('0x49')](handleError(_0x3e7996,null));};exports['update']=function(_0x77452e,_0x2bc443){if(_0x77452e['body']['id']){delete _0x77452e['body']['id'];}return db['AnalyticCustomReport'][_0x9f2d('0x48')]({'where':{'id':_0x77452e[_0x9f2d('0x43')]['id']}})[_0x9f2d('0x23')](handleEntityNotFound(_0x2bc443,null))['then'](saveUpdates(_0x77452e[_0x9f2d('0x4b')],null))[_0x9f2d('0x23')](respondWithResult(_0x2bc443,null))[_0x9f2d('0x49')](handleError(_0x2bc443,null));};exports[_0x9f2d('0x24')]=function(_0x39c32f,_0x10b4d){return db['AnalyticCustomReport'][_0x9f2d('0x48')]({'where':{'id':_0x39c32f[_0x9f2d('0x43')]['id']}})[_0x9f2d('0x23')](handleEntityNotFound(_0x10b4d,null))[_0x9f2d('0x23')](removeEntity(_0x10b4d,null))['catch'](handleError(_0x10b4d,null));};exports[_0x9f2d('0x50')]=function(_0xbd2d57,_0xd6c755){var _0x55cd0c=0xa;var _0x6578bd=['join','left_join',_0x9f2d('0x51'),_0x9f2d('0x52')];var _0x40b4e0={'SUM':_0x9f2d('0x53'),'COUNT':_0x9f2d('0x54'),'COUNT DISTINCT':_0x9f2d('0x55'),'MAX':_0x9f2d('0x56'),'MIN':_0x9f2d('0x57'),'AVG':_0x9f2d('0x58'),'GROUP_CONCAT':_0x9f2d('0x59'),'GROUP_CONCAT ASC':_0x9f2d('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x165763={'SEC_TO_TIME':_0x9f2d('0x5b'),'DATE':_0x9f2d('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x9f2d('0x5d'),'UNIX_TIMESTAMP':_0x9f2d('0x5e')};var _0x20e730=function(_0x5cfa69){return!_[_0x9f2d('0x5f')]([_0x9f2d('0x60'),'IS\x20NOT\x20NULL',_0x9f2d('0x61'),_0x9f2d('0x62')],_0x5cfa69);};var _0x2fd373=function(_0x50397d){if(!_0x50397d||!_0x50397d['rules'][_0x9f2d('0x34')]){return'';}for(var _0x270e5e='(',_0x9fd238=0x0;_0x9fd238<_0x50397d['rules'][_0x9f2d('0x34')];_0x9fd238+=0x1){_0x9fd238>0x0&&(_0x270e5e+='\x20'+_0x50397d[_0x9f2d('0x63')]+'\x20');_0x270e5e+=_0x50397d['rules'][_0x9fd238]['group']?_0x2fd373(_0x50397d[_0x9f2d('0x64')][_0x9fd238][_0x9f2d('0x65')]):_0x50397d[_0x9f2d('0x64')][_0x9fd238][_0x9f2d('0x66')]+'\x20'+_0x50397d[_0x9f2d('0x64')][_0x9fd238][_0x9f2d('0x67')]+(_0x20e730(_0x50397d['rules'][_0x9fd238][_0x9f2d('0x67')])?'\x20'+_0x50397d[_0x9f2d('0x64')][_0x9fd238]['value']:'');}return _0x270e5e+')';};var _0x45788b={'where':{'id':_0xbd2d57[_0x9f2d('0x43')]['id']}},_0x2ba2cc,_0x446d8b,_0x48529b,_0x233724,_0x445063;_0x45788b=_[_0x9f2d('0x3b')]({},_0x45788b,_0xbd2d57[_0x9f2d('0x47')]);return db[_0x9f2d('0x2b')]['find'](_0x45788b)[_0x9f2d('0x23')](function(_0x970a06){if(_0x970a06){_0x2ba2cc=_0x970a06;return _0x970a06[_0x9f2d('0x68')]();}return null;})[_0x9f2d('0x23')](function(_0x3f0c1f){if(_0x3f0c1f){if(!_0x3f0c1f[_0x9f2d('0x34')]){throw new db[(_0x9f2d('0x69'))][(_0x9f2d('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x446d8b=_0x3f0c1f;return db['AnalyticMetric'][_0x9f2d('0x40')]({'raw':!![]});}return null;})[_0x9f2d('0x23')](function(_0x3b2841){if(_0x3b2841){_0x48529b=_[_0x9f2d('0x6b')](_0x3b2841,'id');var _0x5e7e6d;var _0x4c9954=squel[_0x9f2d('0x6c')]();_0x4c9954[_0x9f2d('0x6d')](_0x2ba2cc[_0x9f2d('0x6e')]);for(var _0x47b830=0x0;_0x47b830<_0x446d8b[_0x9f2d('0x34')];_0x47b830+=0x1){_0x5e7e6d=_0x446d8b[_0x47b830][_0x9f2d('0x6f')]?_0x48529b[_0x446d8b[_0x47b830][_0x9f2d('0x6f')]][_0x9f2d('0x70')]:_0x446d8b[_0x47b830][_0x9f2d('0x66')];_0x5e7e6d=_0x446d8b[_0x47b830]['function']?_[_0x9f2d('0x71')](_0x40b4e0[_0x446d8b[_0x47b830][_0x9f2d('0x72')]],'%s',_0x5e7e6d):_0x5e7e6d;_0x5e7e6d=_0x446d8b[_0x47b830][_0x9f2d('0x73')]?_['replace'](_0x165763[_0x446d8b[_0x47b830][_0x9f2d('0x73')]],'%s',_0x5e7e6d):_0x5e7e6d;if(_0x446d8b[_0x47b830][_0x9f2d('0x74')]){_0x4c9954[_0x9f2d('0x65')](_0x5e7e6d);}_0x446d8b[_0x47b830][_0x9f2d('0x75')]&&_0x4c9954[_0x9f2d('0x76')](_0x5e7e6d,_0x446d8b[_0x47b830][_0x9f2d('0x75')]==='DESC'?![]:!![]);_0x4c9954['field'](_0x5e7e6d,_0x446d8b[_0x47b830][_0x9f2d('0x77')]||_0x5e7e6d);}if(_0x2ba2cc[_0x9f2d('0x78')]){_0x2ba2cc[_0x9f2d('0x78')]=JSON['parse'](_0x2ba2cc[_0x9f2d('0x78')]);for(var _0x5c4e1=0x0;_0x5c4e1<_0x2ba2cc[_0x9f2d('0x78')][_0x9f2d('0x34')];_0x5c4e1+=0x1){if(_0x2ba2cc['joins'][_0x5c4e1][_0x9f2d('0x3c')]&&_[_0x9f2d('0x5f')](_0x6578bd,_0x2ba2cc[_0x9f2d('0x78')][_0x5c4e1][_0x9f2d('0x3c')])&&_0x2ba2cc[_0x9f2d('0x78')][_0x5c4e1][_0x9f2d('0x79')]&&_0x2ba2cc[_0x9f2d('0x78')][_0x5c4e1]['foreignTable']&&_0x2ba2cc['joins'][_0x5c4e1]['foreignKey']){_0x4c9954[_0x2ba2cc[_0x9f2d('0x78')][_0x5c4e1][_0x9f2d('0x3c')]](_0x2ba2cc['joins'][_0x5c4e1]['foreignTable'],null,util['format'](_0x9f2d('0x7a'),_0x2ba2cc[_0x9f2d('0x6e')],_0x2ba2cc[_0x9f2d('0x78')][_0x5c4e1][_0x9f2d('0x79')],_0x2ba2cc['joins'][_0x5c4e1]['foreignTable'],_0x2ba2cc[_0x9f2d('0x78')][_0x5c4e1][_0x9f2d('0x7b')]));}}}if(_0x2ba2cc['conditions']){_0x2ba2cc[_0x9f2d('0x7c')]=JSON[_0x9f2d('0x7d')](_0x2ba2cc['conditions']);_0x4c9954[_0x9f2d('0x38')](_0x2fd373(_0x2ba2cc[_0x9f2d('0x7c')]['group']));}_0x445063=_0x4c9954['clone']();_0x4c9954['limit'](_0x55cd0c);_0x4c9954[_0x9f2d('0x1e')](0x0);logger[_0x9f2d('0x7e')](_0x9f2d('0x7f'),_0x4c9954['toString']());return dbH[_0x9f2d('0x80')][_0x9f2d('0x30')](_0x4c9954[_0x9f2d('0x81')](),{'type':dbH[_0x9f2d('0x80')][_0x9f2d('0x82')][_0x9f2d('0x83')]});}})[_0x9f2d('0x23')](respondWithResult(_0xd6c755,null))[_0x9f2d('0x49')](handleError(_0xd6c755,null));};function runReport(_0x4b3571,_0x20bd66,_0x37bae9){var _0x11c822=_0x20bd66[_0x9f2d('0x3e')];var _0x2c6181=0xa;var _0x3d2c89=[_0x9f2d('0x84'),_0x9f2d('0x85'),_0x9f2d('0x51'),_0x9f2d('0x52')];var _0x5b9084={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9f2d('0x55'),'MAX':_0x9f2d('0x56'),'MIN':_0x9f2d('0x57'),'AVG':_0x9f2d('0x58'),'GROUP_CONCAT':_0x9f2d('0x59'),'GROUP_CONCAT ASC':_0x9f2d('0x5a'),'GROUP_CONCAT DESC':_0x9f2d('0x86')};var _0x14cfc1={'SEC_TO_TIME':_0x9f2d('0x5b'),'DATE':_0x9f2d('0x5c'),'HOUR':_0x9f2d('0x87'),'ROUND':_0x9f2d('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x48b5f0=function(_0x595989){return!_[_0x9f2d('0x5f')]([_0x9f2d('0x60'),_0x9f2d('0x88'),_0x9f2d('0x61'),_0x9f2d('0x62')],_0x595989);};var _0x12b67f=function(_0x5acac6){if(!_0x5acac6||!_0x5acac6[_0x9f2d('0x64')][_0x9f2d('0x34')]){return'';}for(var _0x2af1d9='(',_0x1ea74d=0x0;_0x1ea74d<_0x5acac6[_0x9f2d('0x64')]['length'];_0x1ea74d+=0x1){_0x1ea74d>0x0&&(_0x2af1d9+='\x20'+_0x5acac6[_0x9f2d('0x63')]+'\x20');_0x2af1d9+=_0x5acac6[_0x9f2d('0x64')][_0x1ea74d][_0x9f2d('0x65')]?_0x12b67f(_0x5acac6['rules'][_0x1ea74d][_0x9f2d('0x65')]):_0x5acac6[_0x9f2d('0x64')][_0x1ea74d][_0x9f2d('0x66')]+'\x20'+_0x5acac6['rules'][_0x1ea74d][_0x9f2d('0x67')]+(_0x48b5f0(_0x5acac6[_0x9f2d('0x64')][_0x1ea74d]['condition'])?'\x20'+_0x5acac6[_0x9f2d('0x64')][_0x1ea74d][_0x9f2d('0x89')]:'');}return _0x2af1d9+')';};var _0x588606={'where':{'id':_0x4b3571['id']}},_0x4f0974,_0x12ab9b,_0x134efa,_0x11a144,_0x35f20a;_0x588606=_['merge']({},_0x588606,_0x37bae9);return db[_0x9f2d('0x2b')]['find'](_0x588606)[_0x9f2d('0x23')](function(_0x289fa0){if(_0x289fa0){_0x4f0974=_0x289fa0;return _0x289fa0[_0x9f2d('0x68')]();}return null;})['then'](function(_0x292aba){if(_0x292aba){if(!_0x292aba[_0x9f2d('0x34')]){throw new db[(_0x9f2d('0x69'))][(_0x9f2d('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x12ab9b=_0x292aba;return db[_0x9f2d('0x8a')]['findAll']({'raw':!![]});}return null;})[_0x9f2d('0x23')](function(_0x697931){if(_0x697931){_0x134efa=_[_0x9f2d('0x6b')](_0x697931,'id');var _0x1be640;var _0x59e586=squel[_0x9f2d('0x6c')]();_0x59e586[_0x9f2d('0x6d')](_0x4f0974[_0x9f2d('0x6e')]);for(var _0x5f4046=0x0;_0x5f4046<_0x12ab9b[_0x9f2d('0x34')];_0x5f4046+=0x1){_0x1be640=_0x12ab9b[_0x5f4046]['MetricId']?_0x134efa[_0x12ab9b[_0x5f4046][_0x9f2d('0x6f')]][_0x9f2d('0x70')]:_0x12ab9b[_0x5f4046][_0x9f2d('0x66')];_0x1be640=_0x12ab9b[_0x5f4046]['function']?_[_0x9f2d('0x71')](_0x5b9084[_0x12ab9b[_0x5f4046][_0x9f2d('0x72')]],'%s',_0x1be640):_0x1be640;_0x1be640=_0x12ab9b[_0x5f4046]['format']?_[_0x9f2d('0x71')](_0x14cfc1[_0x12ab9b[_0x5f4046][_0x9f2d('0x73')]],'%s',_0x1be640):_0x1be640;if(_0x12ab9b[_0x5f4046]['groupBy']){_0x59e586[_0x9f2d('0x65')](_0x1be640);}_0x12ab9b[_0x5f4046][_0x9f2d('0x75')]&&_0x59e586[_0x9f2d('0x76')](_0x1be640,_0x12ab9b[_0x5f4046][_0x9f2d('0x75')]===_0x9f2d('0x8b')?![]:!![]);_0x59e586['field'](_0x1be640,_0x12ab9b[_0x5f4046]['alias']||_0x1be640);}if(_0x4f0974[_0x9f2d('0x78')]){_0x4f0974[_0x9f2d('0x78')]=JSON[_0x9f2d('0x7d')](_0x4f0974[_0x9f2d('0x78')]);for(var _0x439b15=0x0;_0x439b15<_0x4f0974['joins'][_0x9f2d('0x34')];_0x439b15+=0x1){if(_0x4f0974[_0x9f2d('0x78')][_0x439b15][_0x9f2d('0x3c')]&&_[_0x9f2d('0x5f')](_0x3d2c89,_0x4f0974[_0x9f2d('0x78')][_0x439b15][_0x9f2d('0x3c')])&&_0x4f0974[_0x9f2d('0x78')][_0x439b15][_0x9f2d('0x79')]&&_0x4f0974[_0x9f2d('0x78')][_0x439b15]['foreignTable']&&_0x4f0974[_0x9f2d('0x78')][_0x439b15]['foreignKey']){_0x59e586[_0x4f0974['joins'][_0x439b15][_0x9f2d('0x3c')]](_0x4f0974[_0x9f2d('0x78')][_0x439b15][_0x9f2d('0x8c')],null,util[_0x9f2d('0x73')]('%s.%s\x20=\x20%s.%s',_0x4f0974[_0x9f2d('0x6e')],_0x4f0974['joins'][_0x439b15][_0x9f2d('0x79')],_0x4f0974[_0x9f2d('0x78')][_0x439b15][_0x9f2d('0x8c')],_0x4f0974['joins'][_0x439b15]['foreignKey']));}}}if(_0x4f0974[_0x9f2d('0x7c')]){_0x4f0974[_0x9f2d('0x7c')]=JSON[_0x9f2d('0x7d')](_0x4f0974[_0x9f2d('0x7c')]);_0x59e586[_0x9f2d('0x38')](_0x12b67f(_0x4f0974[_0x9f2d('0x7c')][_0x9f2d('0x65')]));}_0x35f20a=_0x59e586[_0x9f2d('0x8d')]();_0x59e586['limit'](_0x2c6181);_0x59e586[_0x9f2d('0x1e')](0x0);return;}})[_0x9f2d('0x23')](function(){if(_0x20bd66[_0x9f2d('0x8e')]===_0x9f2d('0x8f')){return null;}var _0x3d0265=_['merge'](_0x20bd66,{'name':_0x20bd66[_0x9f2d('0x90')]||_0x20bd66[_0x9f2d('0x3e')]||_0x4f0974[_0x9f2d('0x3e')],'basename':_0x11c822,'savename':util['format'](_0x9f2d('0x91'),_0x20bd66['name']||_0x4f0974[_0x9f2d('0x3e')],require(_0x9f2d('0x92'))[_0x9f2d('0x93')](0x4),_0x20bd66[_0x9f2d('0x8e')]||_0x9f2d('0x94')),'reportId':_0x4f0974['id'],'reportType':_0x9f2d('0x95')});return db[_0x9f2d('0x96')][_0x9f2d('0x4a')](_0x3d0265,{'raw':!![]});})['then'](function(_0x58190e){if(_0x4f0974[_0x9f2d('0x6e')]===_0x9f2d('0x97')){_0x35f20a[_0x9f2d('0x38')](_0x4f0974[_0x9f2d('0x6e')]+_0x9f2d('0x98'),_0x20bd66[_0x9f2d('0x99')],_0x20bd66['endDate']);}else{_0x35f20a['where'](_0x4f0974[_0x9f2d('0x6e')]+_0x9f2d('0x9a'),_0x20bd66[_0x9f2d('0x99')],_0x20bd66[_0x9f2d('0x9b')]);}if(_0x58190e){logger[_0x9f2d('0x9c')](_0x9f2d('0x9d'),_0x35f20a[_0x9f2d('0x81')]());require(_0x9f2d('0x9e'))[_0x9f2d('0x9f')](path[_0x9f2d('0x84')](__dirname,_0x9f2d('0xa0'),_0x58190e[_0x9f2d('0x8e')]),[_0x58190e['id'],_0x35f20a[_0x9f2d('0x81')](),path[_0x9f2d('0x84')](__dirname,'../../files/reports',_0x58190e[_0x9f2d('0xa1')]),_0x11c822]);return _0x58190e;}else{var _0x1855e9=squel[_0x9f2d('0x6c')]();_0x1855e9['from']('('+_0x35f20a['toString']()+')',_0x9f2d('0xa2'));_0x1855e9[_0x9f2d('0x66')]('COUNT(*)','count');_0x35f20a[_0x9f2d('0x20')](_0x20bd66[_0x9f2d('0x20')]||_0x2c6181);_0x35f20a[_0x9f2d('0x1e')](_0x20bd66[_0x9f2d('0x1e')]||0x0);return dbH[_0x9f2d('0x80')]['query'](_0x1855e9[_0x9f2d('0x81')](),{'type':dbH[_0x9f2d('0x80')]['QueryTypes'][_0x9f2d('0x83')]})['then'](function(_0x2f66db){if(!_0x2f66db[_0x9f2d('0x34')]){_0x11a144=0x0;}else{_0x11a144=_0x2f66db[0x0]['count']||0x0;}return dbH[_0x9f2d('0x80')]['query'](_0x35f20a[_0x9f2d('0x81')](),{'type':dbH[_0x9f2d('0x80')][_0x9f2d('0x82')][_0x9f2d('0x83')]});})[_0x9f2d('0x23')](function(_0x2d5414){return{'rows':_0x2d5414||[],'count':_0x11a144};});}});}exports[_0x9f2d('0xa3')]=function(_0x3d7c40,_0xadd74a){return runReport(_0x3d7c40[_0x9f2d('0x43')],_0x3d7c40[_0x9f2d('0x30')],_0x3d7c40['options'])[_0x9f2d('0x23')](respondWithResult(_0xadd74a,null))[_0x9f2d('0x49')](handleError(_0xadd74a,null));};exports['runReport']=runReport;exports['query']=function(_0x58609a,_0x21bbe3){var _0x54cffe=0xa;var _0x343b3c=[_0x9f2d('0x84'),_0x9f2d('0x85'),_0x9f2d('0x51'),'cross_join'];var _0x406630={'SUM':_0x9f2d('0x53'),'COUNT':_0x9f2d('0x54'),'COUNT DISTINCT':_0x9f2d('0x55'),'MAX':_0x9f2d('0x56'),'MIN':'MIN(%s)','AVG':_0x9f2d('0x58'),'GROUP_CONCAT':_0x9f2d('0x59'),'GROUP_CONCAT ASC':_0x9f2d('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x48fa92={'SEC_TO_TIME':_0x9f2d('0x5b'),'DATE':_0x9f2d('0x5c'),'HOUR':_0x9f2d('0x87'),'ROUND':_0x9f2d('0x5d'),'UNIX_TIMESTAMP':_0x9f2d('0x5e')};var _0x2f832d=function(_0x159446){return!_[_0x9f2d('0x5f')](['IS\x20NULL',_0x9f2d('0x88'),_0x9f2d('0x61'),_0x9f2d('0x62')],_0x159446);};var _0x4fcc8c=function(_0x568a0e){if(!_0x568a0e||!_0x568a0e[_0x9f2d('0x64')][_0x9f2d('0x34')]){return'';}for(var _0x40ccfd='(',_0x335a1d=0x0;_0x335a1d<_0x568a0e[_0x9f2d('0x64')][_0x9f2d('0x34')];_0x335a1d+=0x1){_0x335a1d>0x0&&(_0x40ccfd+='\x20'+_0x568a0e[_0x9f2d('0x63')]+'\x20');_0x40ccfd+=_0x568a0e[_0x9f2d('0x64')][_0x335a1d]['group']?_0x4fcc8c(_0x568a0e[_0x9f2d('0x64')][_0x335a1d][_0x9f2d('0x65')]):_0x568a0e['rules'][_0x335a1d][_0x9f2d('0x66')]+'\x20'+_0x568a0e[_0x9f2d('0x64')][_0x335a1d][_0x9f2d('0x67')]+(_0x2f832d(_0x568a0e[_0x9f2d('0x64')][_0x335a1d][_0x9f2d('0x67')])?'\x20'+_0x568a0e['rules'][_0x335a1d][_0x9f2d('0x89')]:'');}return _0x40ccfd+')';};var _0x3657c7={'where':{'id':_0x58609a[_0x9f2d('0x43')]['id']}},_0x284827,_0x474294,_0x4b902b,_0x19aa80,_0x194a37;_0x3657c7=_[_0x9f2d('0x3b')]({},_0x3657c7,_0x58609a[_0x9f2d('0x47')]);return db[_0x9f2d('0x2b')][_0x9f2d('0x48')](_0x3657c7)[_0x9f2d('0x23')](function(_0x22e4e7){if(_0x22e4e7){_0x284827=_0x22e4e7;return _0x22e4e7['getFields']();}return null;})['then'](function(_0x33bc7e){if(_0x33bc7e){if(!_0x33bc7e[_0x9f2d('0x34')]){throw new db['Sequelize'][(_0x9f2d('0x6a'))](_0x9f2d('0xa4'),0x193);}_0x474294=_0x33bc7e;return db[_0x9f2d('0x8a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x27376b){if(_0x27376b){_0x4b902b=_[_0x9f2d('0x6b')](_0x27376b,'id');var _0x525bfe;var _0x153496=squel[_0x9f2d('0x6c')]();_0x153496[_0x9f2d('0x6d')](_0x284827[_0x9f2d('0x6e')]);for(var _0x32f8ef=0x0;_0x32f8ef<_0x474294[_0x9f2d('0x34')];_0x32f8ef+=0x1){_0x525bfe=_0x474294[_0x32f8ef][_0x9f2d('0x6f')]?_0x4b902b[_0x474294[_0x32f8ef][_0x9f2d('0x6f')]][_0x9f2d('0x70')]:_0x474294[_0x32f8ef]['field'];_0x525bfe=_0x474294[_0x32f8ef][_0x9f2d('0x72')]?_[_0x9f2d('0x71')](_0x406630[_0x474294[_0x32f8ef][_0x9f2d('0x72')]],'%s',_0x525bfe):_0x525bfe;_0x525bfe=_0x474294[_0x32f8ef][_0x9f2d('0x73')]?_[_0x9f2d('0x71')](_0x48fa92[_0x474294[_0x32f8ef][_0x9f2d('0x73')]],'%s',_0x525bfe):_0x525bfe;if(_0x474294[_0x32f8ef][_0x9f2d('0x74')]){_0x153496[_0x9f2d('0x65')](_0x525bfe);}_0x474294[_0x32f8ef][_0x9f2d('0x75')]&&_0x153496[_0x9f2d('0x76')](_0x525bfe,_0x474294[_0x32f8ef]['orderBy']===_0x9f2d('0x8b')?![]:!![]);_0x153496['field'](_0x525bfe,_0x474294[_0x32f8ef][_0x9f2d('0x77')]||_0x525bfe);}if(_0x284827[_0x9f2d('0x78')]){_0x284827[_0x9f2d('0x78')]=JSON[_0x9f2d('0x7d')](_0x284827[_0x9f2d('0x78')]);for(var _0x3abeb4=0x0;_0x3abeb4<_0x284827[_0x9f2d('0x78')][_0x9f2d('0x34')];_0x3abeb4+=0x1){if(_0x284827[_0x9f2d('0x78')][_0x3abeb4][_0x9f2d('0x3c')]&&_[_0x9f2d('0x5f')](_0x343b3c,_0x284827[_0x9f2d('0x78')][_0x3abeb4][_0x9f2d('0x3c')])&&_0x284827[_0x9f2d('0x78')][_0x3abeb4][_0x9f2d('0x79')]&&_0x284827[_0x9f2d('0x78')][_0x3abeb4]['foreignTable']&&_0x284827['joins'][_0x3abeb4]['foreignKey']){_0x153496[_0x284827[_0x9f2d('0x78')][_0x3abeb4]['type']](_0x284827[_0x9f2d('0x78')][_0x3abeb4][_0x9f2d('0x8c')],null,util[_0x9f2d('0x73')](_0x9f2d('0x7a'),_0x284827['table'],_0x284827[_0x9f2d('0x78')][_0x3abeb4]['parentKey'],_0x284827[_0x9f2d('0x78')][_0x3abeb4][_0x9f2d('0x8c')],_0x284827[_0x9f2d('0x78')][_0x3abeb4][_0x9f2d('0x7b')]));}}}if(_0x284827[_0x9f2d('0x7c')]){_0x284827[_0x9f2d('0x7c')]=JSON[_0x9f2d('0x7d')](_0x284827[_0x9f2d('0x7c')]);_0x153496[_0x9f2d('0x38')](_0x4fcc8c(_0x284827[_0x9f2d('0x7c')]['group']));}_0x194a37=_0x153496[_0x9f2d('0x8d')]();_0x153496[_0x9f2d('0x20')](_0x54cffe);_0x153496[_0x9f2d('0x1e')](0x0);logger[_0x9f2d('0x7e')]('Limited\x20Query:',_0x153496['toString']());return dbH[_0x9f2d('0x80')][_0x9f2d('0x30')](_0x153496['toString'](),{'type':dbH[_0x9f2d('0x80')][_0x9f2d('0x82')][_0x9f2d('0x83')]});}})[_0x9f2d('0x23')](function(){return{'sql':_0x194a37[_0x9f2d('0x81')]()};})[_0x9f2d('0x23')](respondWithResult(_0x21bbe3,null))[_0x9f2d('0x49')](handleError(_0x21bbe3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index f4973d7..42e7dff 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 _0xe854=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','moment'];(function(_0x1d0ca1,_0x3a4cb2){var _0xc246c7=function(_0x4777cd){while(--_0x4777cd){_0x1d0ca1['push'](_0x1d0ca1['shift']());}};_0xc246c7(++_0x3a4cb2);}(_0xe854,0x105));var _0x4e85=function(_0x47dac5,_0x3edb97){_0x47dac5=_0x47dac5-0x0;var _0x2049ae=_0xe854[_0x47dac5];return _0x2049ae;};'use strict';var _=require(_0x4e85('0x0'));var util=require(_0x4e85('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4e85('0x2'));var BPromise=require(_0x4e85('0x3'));var rp=require(_0x4e85('0x4'));var fs=require('fs');var path=require(_0x4e85('0x5'));var rimraf=require(_0x4e85('0x6'));var config=require(_0x4e85('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x4e85('0x8')]=function(_0x4fcc9a,_0x930878){return _0x4fcc9a[_0x4e85('0x9')](_0x4e85('0xa'),attributes,{'tableName':_0x4e85('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1027=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x1027,0xc1));var _0x7102=function(_0x35f83e,_0x30ec55){_0x35f83e=_0x35f83e-0x0;var _0x249b05=_0x1027[_0x35f83e];return _0x249b05;};'use strict';var _=require(_0x7102('0x0'));var util=require(_0x7102('0x1'));var logger=require(_0x7102('0x2'))(_0x7102('0x3'));var moment=require(_0x7102('0x4'));var BPromise=require(_0x7102('0x5'));var rp=require(_0x7102('0x6'));var fs=require('fs');var path=require(_0x7102('0x7'));var rimraf=require(_0x7102('0x8'));var config=require(_0x7102('0x9'));var attributes=require(_0x7102('0xa'));module[_0x7102('0xb')]=function(_0x373853,_0x35cdd7){return _0x373853[_0x7102('0xc')](_0x7102('0xd'),attributes,{'tableName':_0x7102('0xe'),'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 82fe95d..dea292e 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 _0x0469=['info','request\x20sent','debug','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x0469,0x68));var _0x9046=function(_0x3625ea,_0x437bb6){_0x3625ea=_0x3625ea-0x0;var _0x220dd0=_0x0469[_0x3625ea];return _0x220dd0;};'use strict';var _=require(_0x9046('0x0'));var util=require('util');var moment=require(_0x9046('0x1'));var BPromise=require('bluebird');var rs=require(_0x9046('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9046('0x3'))['db'];var utils=require(_0x9046('0x4'));var logger=require('../../config/logger')(_0x9046('0x5'));var config=require(_0x9046('0x6'));var jayson=require(_0x9046('0x7'));var client=jayson[_0x9046('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22ef57,_0x1c4282,_0x392f59){return new BPromise(function(_0x3e7017,_0xce31bf){return client[_0x9046('0x9')](_0x22ef57,_0x392f59)['then'](function(_0x2f16b7){logger[_0x9046('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1c4282,_0x9046('0xb'));logger[_0x9046('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1c4282,_0x9046('0xb'),JSON['stringify'](_0x2f16b7));if(_0x2f16b7[_0x9046('0xd')]){if(_0x2f16b7[_0x9046('0xd')][_0x9046('0xe')]===0x1f4){logger[_0x9046('0xd')](_0x9046('0xf'),_0x1c4282,_0x2f16b7['error'][_0x9046('0x10')]);return _0xce31bf(_0x2f16b7['error']['message']);}logger[_0x9046('0xd')](_0x9046('0xf'),_0x1c4282,_0x2f16b7[_0x9046('0xd')][_0x9046('0x10')]);return _0x3e7017(_0x2f16b7['error'][_0x9046('0x10')]);}else{logger['info'](_0x9046('0xf'),_0x1c4282,_0x9046('0xb'));_0x3e7017(_0x2f16b7[_0x9046('0x11')][_0x9046('0x10')]);}})[_0x9046('0x12')](function(_0x468ece){logger[_0x9046('0xd')](_0x9046('0xf'),_0x1c4282,_0x468ece);_0xce31bf(_0x468ece);});});} \ No newline at end of file +var _0x0ff9=['client','request','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb746a4,_0x355bdc){var _0x4b6a58=function(_0x3ebf70){while(--_0x3ebf70){_0xb746a4['push'](_0xb746a4['shift']());}};_0x4b6a58(++_0x355bdc);}(_0x0ff9,0x11a));var _0x90ff=function(_0x16ba7f,_0x2928f8){_0x16ba7f=_0x16ba7f-0x0;var _0x3ca577=_0x0ff9[_0x16ba7f];return _0x3ca577;};'use strict';var _=require(_0x90ff('0x0'));var util=require(_0x90ff('0x1'));var moment=require(_0x90ff('0x2'));var BPromise=require(_0x90ff('0x3'));var rs=require(_0x90ff('0x4'));var fs=require('fs');var Redis=require(_0x90ff('0x5'));var db=require(_0x90ff('0x6'))['db'];var utils=require(_0x90ff('0x7'));var logger=require(_0x90ff('0x8'))(_0x90ff('0x9'));var config=require(_0x90ff('0xa'));var jayson=require(_0x90ff('0xb'));var client=jayson[_0x90ff('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23109b,_0x2add9c,_0x320ca1){return new BPromise(function(_0x2b58a7,_0x1747b9){return client[_0x90ff('0xd')](_0x23109b,_0x320ca1)['then'](function(_0xeaab26){logger[_0x90ff('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2add9c,_0x90ff('0xf'));logger['debug'](_0x90ff('0x10'),_0x2add9c,_0x90ff('0xf'),JSON['stringify'](_0xeaab26));if(_0xeaab26[_0x90ff('0x11')]){if(_0xeaab26['error'][_0x90ff('0x12')]===0x1f4){logger[_0x90ff('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2add9c,_0xeaab26[_0x90ff('0x11')]['message']);return _0x1747b9(_0xeaab26['error']['message']);}logger[_0x90ff('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2add9c,_0xeaab26['error'][_0x90ff('0x13')]);return _0x2b58a7(_0xeaab26[_0x90ff('0x11')]['message']);}else{logger[_0x90ff('0xe')](_0x90ff('0x14'),_0x2add9c,_0x90ff('0xf'));_0x2b58a7(_0xeaab26['result']['message']);}})['catch'](function(_0x3d179d){logger[_0x90ff('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2add9c,_0x3d179d);_0x1747b9(_0x3d179d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index bce81f5..9adc441 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 _0x8017=['./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','run','/:id/query','query','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4eeb47,_0x5edf4a){var _0x1113f5=function(_0x170ea0){while(--_0x170ea0){_0x4eeb47['push'](_0x4eeb47['shift']());}};_0x1113f5(++_0x5edf4a);}(_0x8017,0xbe));var _0x7801=function(_0x53f897,_0x539857){_0x53f897=_0x53f897-0x0;var _0x6879f8=_0x8017[_0x53f897];return _0x6879f8;};'use strict';var multer=require(_0x7801('0x0'));var util=require(_0x7801('0x1'));var path=require(_0x7801('0x2'));var timeout=require(_0x7801('0x3'));var express=require(_0x7801('0x4'));var router=express[_0x7801('0x5')]();var fs_extra=require(_0x7801('0x6'));var auth=require(_0x7801('0x7'));var interaction=require(_0x7801('0x8'));var config=require(_0x7801('0x9'));var controller=require(_0x7801('0xa'));router[_0x7801('0xb')]('/',auth[_0x7801('0xc')](),controller[_0x7801('0xd')]);router[_0x7801('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7801('0xe')]);router['get'](_0x7801('0xf'),auth[_0x7801('0xc')](),controller[_0x7801('0x10')]);router[_0x7801('0xb')]('/:id/run',auth[_0x7801('0xc')](),controller[_0x7801('0x11')]);router[_0x7801('0xb')](_0x7801('0x12'),auth[_0x7801('0xc')](),controller[_0x7801('0x13')]);router[_0x7801('0x14')]('/',auth['isAuthenticated'](),controller[_0x7801('0x15')]);router['put']('/:id',auth[_0x7801('0xc')](),controller['update']);router[_0x7801('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7801('0x17')]);module[_0x7801('0x18')]=router; \ No newline at end of file +var _0x6c4f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','update','delete','exports','util','path','express','Router','fs-extra'];(function(_0x51ce23,_0x205248){var _0x211944=function(_0x92eae3){while(--_0x92eae3){_0x51ce23['push'](_0x51ce23['shift']());}};_0x211944(++_0x205248);}(_0x6c4f,0x1a4));var _0xf6c4=function(_0x1d8653,_0x5b05e3){_0x1d8653=_0x1d8653-0x0;var _0x59dbc0=_0x6c4f[_0x1d8653];return _0x59dbc0;};'use strict';var multer=require('multer');var util=require(_0xf6c4('0x0'));var path=require(_0xf6c4('0x1'));var timeout=require('connect-timeout');var express=require(_0xf6c4('0x2'));var router=express[_0xf6c4('0x3')]();var fs_extra=require(_0xf6c4('0x4'));var auth=require(_0xf6c4('0x5'));var interaction=require(_0xf6c4('0x6'));var config=require(_0xf6c4('0x7'));var controller=require(_0xf6c4('0x8'));router[_0xf6c4('0x9')]('/',auth[_0xf6c4('0xa')](),controller[_0xf6c4('0xb')]);router[_0xf6c4('0x9')](_0xf6c4('0xc'),auth['isAuthenticated'](),controller[_0xf6c4('0xd')]);router['get'](_0xf6c4('0xe'),auth[_0xf6c4('0xa')](),controller[_0xf6c4('0xf')]);router[_0xf6c4('0x9')](_0xf6c4('0x10'),auth['isAuthenticated'](),controller[_0xf6c4('0x11')]);router[_0xf6c4('0x9')](_0xf6c4('0x12'),auth[_0xf6c4('0xa')](),controller[_0xf6c4('0x13')]);router[_0xf6c4('0x14')]('/',auth[_0xf6c4('0xa')](),controller['create']);router[_0xf6c4('0x15')](_0xf6c4('0xc'),auth[_0xf6c4('0xa')](),controller[_0xf6c4('0x16')]);router[_0xf6c4('0x17')](_0xf6c4('0xc'),auth[_0xf6c4('0xa')](),controller['destroy']);module[_0xf6c4('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 707b67e..5ae1c00 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x1d143f,_0x1ac44e){var _0x163e17=function(_0x2e4d56){while(--_0x2e4d56){_0x1d143f['push'](_0x1d143f['shift']());}};_0x163e17(++_0x1ac44e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x474a40,_0x3377aa){var _0x21f947=function(_0xfe8aba){while(--_0xfe8aba){_0x474a40['push'](_0x474a40['shift']());}};_0x21f947(++_0x3377aa);}(_0xda19,0xd5));var _0x9da1=function(_0x4ba81e,_0x406c22){_0x4ba81e=_0x4ba81e-0x0;var _0x1d2886=_0xda19[_0x4ba81e];return _0x1d2886;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 1cb7a80..1fb3bb5 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 _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x5738d7,_0x424f69){var _0x19dd9c=function(_0x451278){while(--_0x451278){_0x5738d7['push'](_0x5738d7['shift']());}};_0x19dd9c(++_0x424f69);}(_0xba34,0x119));var _0x4ba3=function(_0x3d4028,_0x16c16d){_0x3d4028=_0x3d4028-0x0;var _0x1609a1=_0xba34[_0x3d4028];return _0x1609a1;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file +var _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x59b677,_0xf359aa){var _0x5bb449=function(_0x21cd87){while(--_0x21cd87){_0x59b677['push'](_0x59b677['shift']());}};_0x5bb449(++_0xf359aa);}(_0x814b,0x1a2));var _0xb814=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x814b[_0x1558ab];return _0x53b64a;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a0e1de9..a178562 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 _0x90e4=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1dd0f3,_0xa04175){var _0x4982ed=function(_0x255e25){while(--_0x255e25){_0x1dd0f3['push'](_0x1dd0f3['shift']());}};_0x4982ed(++_0xa04175);}(_0x90e4,0x1d6));var _0x490e=function(_0x6148ee,_0x4d2fca){_0x6148ee=_0x6148ee-0x0;var _0x5afc74=_0x90e4[_0x6148ee];return _0x5afc74;};'use strict';var _=require(_0x490e('0x0'));var util=require(_0x490e('0x1'));var logger=require(_0x490e('0x2'))(_0x490e('0x3'));var moment=require(_0x490e('0x4'));var BPromise=require(_0x490e('0x5'));var rp=require(_0x490e('0x6'));var fs=require('fs');var path=require(_0x490e('0x7'));var rimraf=require(_0x490e('0x8'));var config=require(_0x490e('0x9'));var attributes=require(_0x490e('0xa'));module[_0x490e('0xb')]=function(_0x25091a,_0x4f0532){return _0x25091a[_0x490e('0xc')](_0x490e('0xd'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa12f=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','util','api','moment','bluebird','path'];(function(_0xd0b141,_0x5fa4dc){var _0x3c06b5=function(_0x4b6a3c){while(--_0x4b6a3c){_0xd0b141['push'](_0xd0b141['shift']());}};_0x3c06b5(++_0x5fa4dc);}(_0xa12f,0xaf));var _0xfa12=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa12f[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xfa12('0x0'));var logger=require('../../config/logger')(_0xfa12('0x1'));var moment=require(_0xfa12('0x2'));var BPromise=require(_0xfa12('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa12('0x4'));var rimraf=require(_0xfa12('0x5'));var config=require(_0xfa12('0x6'));var attributes=require(_0xfa12('0x7'));module[_0xfa12('0x8')]=function(_0x39cd5d,_0x532950){return _0x39cd5d['define']('AnalyticDefaultReport',attributes,{'tableName':_0xfa12('0x9'),'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 59afde2..b28fe58 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 _0x98ae=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x384b7b,_0x5bc322){var _0x19afdb=function(_0x254a6c){while(--_0x254a6c){_0x384b7b['push'](_0x384b7b['shift']());}};_0x19afdb(++_0x5bc322);}(_0x98ae,0x1c1));var _0xe98a=function(_0x2394f7,_0x3c3ed6){_0x2394f7=_0x2394f7-0x0;var _0x121f33=_0x98ae[_0x2394f7];return _0x121f33;};'use strict';var _=require(_0xe98a('0x0'));var util=require(_0xe98a('0x1'));var moment=require(_0xe98a('0x2'));var BPromise=require(_0xe98a('0x3'));var rs=require(_0xe98a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe98a('0x5'))['db'];var utils=require(_0xe98a('0x6'));var logger=require('../../config/logger')(_0xe98a('0x7'));var config=require('../../config/environment');var jayson=require(_0xe98a('0x8'));var client=jayson[_0xe98a('0x9')][_0xe98a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6fefa4,_0xb398d0,_0x5d4f78){return new BPromise(function(_0xe8b40d,_0x51d9d4){return client[_0xe98a('0xb')](_0x6fefa4,_0x5d4f78)[_0xe98a('0xc')](function(_0x5ceeb9){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0xb398d0,_0xe98a('0xd'));logger[_0xe98a('0xe')](_0xe98a('0xf'),_0xb398d0,_0xe98a('0xd'),JSON[_0xe98a('0x10')](_0x5ceeb9));if(_0x5ceeb9[_0xe98a('0x11')]){if(_0x5ceeb9[_0xe98a('0x11')]['code']===0x1f4){logger[_0xe98a('0x11')](_0xe98a('0x12'),_0xb398d0,_0x5ceeb9[_0xe98a('0x11')][_0xe98a('0x13')]);return _0x51d9d4(_0x5ceeb9[_0xe98a('0x11')]['message']);}logger[_0xe98a('0x11')](_0xe98a('0x12'),_0xb398d0,_0x5ceeb9[_0xe98a('0x11')][_0xe98a('0x13')]);return _0xe8b40d(_0x5ceeb9[_0xe98a('0x11')][_0xe98a('0x13')]);}else{logger[_0xe98a('0x14')](_0xe98a('0x12'),_0xb398d0,_0xe98a('0xd'));_0xe8b40d(_0x5ceeb9['result'][_0xe98a('0x13')]);}})[_0xe98a('0x15')](function(_0xa3334a){logger[_0xe98a('0x11')](_0xe98a('0x12'),_0xb398d0,_0xa3334a);_0x51d9d4(_0xa3334a);});});} \ No newline at end of file +var _0x2525=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','ioredis'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2525,0xed));var _0x5252=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2525[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x5252('0x0'));var moment=require('moment');var BPromise=require(_0x5252('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5252('0x2'));var db=require(_0x5252('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5252('0x4'))('rpc');var config=require(_0x5252('0x5'));var jayson=require(_0x5252('0x6'));var client=jayson[_0x5252('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x299174,_0x53c4e6,_0x2de5f4){return new BPromise(function(_0x313201,_0x422f55){return client[_0x5252('0x8')](_0x299174,_0x2de5f4)[_0x5252('0x9')](function(_0x5c0469){logger[_0x5252('0xa')](_0x5252('0xb'),_0x53c4e6,_0x5252('0xc'));logger[_0x5252('0xd')](_0x5252('0xe'),_0x53c4e6,_0x5252('0xc'),JSON[_0x5252('0xf')](_0x5c0469));if(_0x5c0469['error']){if(_0x5c0469[_0x5252('0x10')][_0x5252('0x11')]===0x1f4){logger[_0x5252('0x10')](_0x5252('0xb'),_0x53c4e6,_0x5c0469['error'][_0x5252('0x12')]);return _0x422f55(_0x5c0469[_0x5252('0x10')][_0x5252('0x12')]);}logger[_0x5252('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x53c4e6,_0x5c0469[_0x5252('0x10')][_0x5252('0x12')]);return _0x313201(_0x5c0469[_0x5252('0x10')][_0x5252('0x12')]);}else{logger[_0x5252('0xa')](_0x5252('0xb'),_0x53c4e6,_0x5252('0xc'));_0x313201(_0x5c0469[_0x5252('0x13')][_0x5252('0x12')]);}})['catch'](function(_0x24db6f){logger[_0x5252('0x10')](_0x5252('0xb'),_0x53c4e6,_0x24db6f);_0x422f55(_0x24db6f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index fb10aca..7e906ce 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 _0xe7e0=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','preview','/:id/run','/:id/query','query','post','create'];(function(_0x477df8,_0x9cb2bb){var _0x54de0c=function(_0x3e092c){while(--_0x3e092c){_0x477df8['push'](_0x477df8['shift']());}};_0x54de0c(++_0x9cb2bb);}(_0xe7e0,0xd3));var _0x0e7e=function(_0x36d716,_0x449e9d){_0x36d716=_0x36d716-0x0;var _0x34df69=_0xe7e0[_0x36d716];return _0x34df69;};'use strict';var multer=require(_0x0e7e('0x0'));var util=require(_0x0e7e('0x1'));var path=require(_0x0e7e('0x2'));var timeout=require(_0x0e7e('0x3'));var express=require(_0x0e7e('0x4'));var router=express[_0x0e7e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0e7e('0x6'));var interaction=require(_0x0e7e('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x0e7e('0x8')]('/',auth[_0x0e7e('0x9')](),controller[_0x0e7e('0xa')]);router[_0x0e7e('0x8')](_0x0e7e('0xb'),auth['isAuthenticated'](),controller[_0x0e7e('0xc')]);router[_0x0e7e('0x8')]('/:id/preview',auth[_0x0e7e('0x9')](),controller[_0x0e7e('0xd')]);router[_0x0e7e('0x8')](_0x0e7e('0xe'),auth[_0x0e7e('0x9')](),controller['run']);router[_0x0e7e('0x8')](_0x0e7e('0xf'),auth[_0x0e7e('0x9')](),controller[_0x0e7e('0x10')]);router[_0x0e7e('0x11')]('/',auth[_0x0e7e('0x9')](),controller[_0x0e7e('0x12')]);router[_0x0e7e('0x13')]('/:id',auth[_0x0e7e('0x9')](),controller[_0x0e7e('0x14')]);router[_0x0e7e('0x15')](_0x0e7e('0xb'),auth['isAuthenticated'](),controller[_0x0e7e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x563f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x18141b,_0x45c769){var _0x474c30=function(_0x7de6d1){while(--_0x7de6d1){_0x18141b['push'](_0x18141b['shift']());}};_0x474c30(++_0x45c769);}(_0x563f,0x158));var _0xf563=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x563f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf563('0x0'));var util=require(_0xf563('0x1'));var path=require(_0xf563('0x2'));var timeout=require('connect-timeout');var express=require(_0xf563('0x3'));var router=express[_0xf563('0x4')]();var fs_extra=require(_0xf563('0x5'));var auth=require(_0xf563('0x6'));var interaction=require(_0xf563('0x7'));var config=require(_0xf563('0x8'));var controller=require(_0xf563('0x9'));router[_0xf563('0xa')]('/',auth[_0xf563('0xb')](),controller[_0xf563('0xc')]);router[_0xf563('0xa')](_0xf563('0xd'),auth[_0xf563('0xb')](),controller['show']);router[_0xf563('0xa')]('/:id/preview',auth[_0xf563('0xb')](),controller[_0xf563('0xe')]);router['get'](_0xf563('0xf'),auth[_0xf563('0xb')](),controller[_0xf563('0x10')]);router[_0xf563('0xa')](_0xf563('0x11'),auth['isAuthenticated'](),controller[_0xf563('0x12')]);router[_0xf563('0x13')]('/',auth['isAuthenticated'](),controller[_0xf563('0x14')]);router[_0xf563('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf563('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf563('0x17')]);module[_0xf563('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8b841ff..efb28f3 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 _0x9290=['ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','STRING'];(function(_0x245307,_0x12cbb9){var _0x4cf712=function(_0x1ee4af){while(--_0x1ee4af){_0x245307['push'](_0x245307['shift']());}};_0x4cf712(++_0x12cbb9);}(_0x9290,0xe1));var _0x0929=function(_0x340d75,_0x561cb0){_0x340d75=_0x340d75-0x0;var _0x3f1114=_0x9290[_0x340d75];return _0x3f1114;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0929('0x0'));module[_0x0929('0x1')]={'name':{'type':Sequelize[_0x0929('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x0929('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x0929('0x3')](_0x0929('0x4'),_0x0929('0x5'),_0x0929('0x6')),'allowNull':![],'defaultValue':_0x0929('0x4')},'savename':{'type':Sequelize[_0x0929('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0929('0x7')]},'endDate':{'type':Sequelize[_0x0929('0x7')]},'status':{'type':Sequelize[_0x0929('0x2')],'defaultValue':_0x0929('0x8')},'type':{'type':Sequelize[_0x0929('0x3')](_0x0929('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x0929('0x9')},'reportId':{'type':Sequelize[_0x0929('0xa')](0xb)[_0x0929('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x42d0=['UNSIGNED','moment','exports','STRING','ENUM','csv','xlsx','DATE','manual','INTEGER'];(function(_0x192f58,_0x79b210){var _0x86ebf5=function(_0x1f3046){while(--_0x1f3046){_0x192f58['push'](_0x192f58['shift']());}};_0x86ebf5(++_0x79b210);}(_0x42d0,0x187));var _0x042d=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x42d0[_0x1f239e];return _0x826971;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x042d('0x0'));module[_0x042d('0x1')]={'name':{'type':Sequelize[_0x042d('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x042d('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x042d('0x3')](_0x042d('0x4'),'pdf',_0x042d('0x5')),'allowNull':![],'defaultValue':_0x042d('0x4')},'savename':{'type':Sequelize[_0x042d('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x042d('0x6')]},'status':{'type':Sequelize[_0x042d('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x042d('0x7'),'scheduled'),'allowNull':![],'defaultValue':_0x042d('0x7')},'reportId':{'type':Sequelize[_0x042d('0x8')](0xb)[_0x042d('0x9')]},'reportType':{'type':Sequelize[_0x042d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 6d3ba09..54df10f 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 _0x806e=['get','ExtractedReports','UserProfileResource','error','stack','name','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4a9d82,_0x1195ba){var _0x4b712c=function(_0x46429b){while(--_0x46429b){_0x4a9d82['push'](_0x4a9d82['shift']());}};_0x4b712c(++_0x1195ba);}(_0x806e,0x1c8));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xe806('0x0'));var rimraf=require(_0xe806('0x1'));var zipdir=require(_0xe806('0x2'));var jsonpatch=require(_0xe806('0x3'));var rp=require(_0xe806('0x4'));var moment=require(_0xe806('0x5'));var BPromise=require(_0xe806('0x6'));var Mustache=require(_0xe806('0x7'));var util=require(_0xe806('0x8'));var path=require(_0xe806('0x9'));var sox=require(_0xe806('0xa'));var csv=require(_0xe806('0xb'));var ejs=require(_0xe806('0xc'));var fs=require('fs');var fs_extra=require(_0xe806('0xd'));var _=require(_0xe806('0xe'));var squel=require('squel');var crypto=require(_0xe806('0xf'));var jsforce=require(_0xe806('0x10'));var deskjs=require(_0xe806('0x11'));var toCsv=require(_0xe806('0xb'));var querystring=require(_0xe806('0x12'));var Papa=require('papaparse');var Redis=require(_0xe806('0x13'));var authService=require(_0xe806('0x14'));var qs=require(_0xe806('0x15'));var as=require(_0xe806('0x16'));var hardwareService=require(_0xe806('0x17'));var logger=require('../../config/logger')(_0xe806('0x18'));var utils=require(_0xe806('0x19'));var config=require(_0xe806('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe806('0x1b'))['db'];function respondWithStatusCode(_0x5b0194,_0x9a3e29){_0x9a3e29=_0x9a3e29||0xcc;return function(_0x14857c){if(_0x14857c){return _0x5b0194[_0xe806('0x1c')](_0x9a3e29);}return _0x5b0194[_0xe806('0x1d')](_0x9a3e29)[_0xe806('0x1e')]();};}function respondWithResult(_0x1ac4e4,_0x707269){_0x707269=_0x707269||0xc8;return function(_0x1f251f){if(_0x1f251f){return _0x1ac4e4[_0xe806('0x1d')](_0x707269)[_0xe806('0x1f')](_0x1f251f);}};}function respondWithFilteredResult(_0x413777,_0x2124e7){return function(_0x54e41a){if(_0x54e41a){var _0x5c007f=typeof _0x2124e7['offset']===_0xe806('0x20')&&typeof _0x2124e7[_0xe806('0x21')]===_0xe806('0x20');var _0x12d9b1=_0x54e41a[_0xe806('0x22')];var _0x41dbc2=_0x5c007f?0x0:_0x2124e7[_0xe806('0x23')];var _0x454cc9=_0x5c007f?_0x54e41a[_0xe806('0x22')]:_0x2124e7[_0xe806('0x23')]+_0x2124e7['limit'];var _0x4934b7;if(_0x454cc9>=_0x12d9b1){_0x454cc9=_0x12d9b1;_0x4934b7=0xc8;}else{_0x4934b7=0xce;}_0x413777[_0xe806('0x1d')](_0x4934b7);return _0x413777[_0xe806('0x24')](_0xe806('0x25'),_0x41dbc2+'-'+_0x454cc9+'/'+_0x12d9b1)['json'](_0x54e41a);}return null;};}function patchUpdates(_0x2eb601){return function(_0x3ac975){try{jsonpatch[_0xe806('0x26')](_0x3ac975,_0x2eb601,!![]);}catch(_0x469526){return BPromise[_0xe806('0x27')](_0x469526);}return _0x3ac975[_0xe806('0x28')]();};}function saveUpdates(_0xc90c42,_0x207609){return function(_0x37961f){if(_0x37961f){return _0x37961f[_0xe806('0x29')](_0xc90c42)[_0xe806('0x2a')](function(_0x596cb7){return _0x596cb7;});}return null;};}function removeEntity(_0xae85fa,_0x450e7f){return function(_0x3b8003){if(_0x3b8003){return _0x3b8003[_0xe806('0x2b')]()[_0xe806('0x2a')](function(){var _0x5be5fd=_0x3b8003[_0xe806('0x2c')]({'plain':!![]});var _0x310fd2=_0xe806('0x2d');return db[_0xe806('0x2e')]['destroy']({'where':{'type':_0x310fd2,'resourceId':_0x5be5fd['id']}})['then'](function(){return _0x3b8003;});})[_0xe806('0x2a')](function(){_0xae85fa['status'](0xcc)[_0xe806('0x1e')]();});}};}function handleEntityNotFound(_0x183a6b,_0x4dd1df){return function(_0x425572){if(!_0x425572){_0x183a6b[_0xe806('0x1c')](0x194);}return _0x425572;};}function handleError(_0x99f2c4,_0x74cd36){_0x74cd36=_0x74cd36||0x1f4;return function(_0x5ef2de){logger[_0xe806('0x2f')](_0x5ef2de[_0xe806('0x30')]);if(_0x5ef2de['name']){delete _0x5ef2de[_0xe806('0x31')];}_0x99f2c4[_0xe806('0x1d')](_0x74cd36)['send'](_0x5ef2de);};}exports[_0xe806('0x32')]=function(_0x160a0b,_0x6b2fa6){var _0x493d5d={},_0x5089d3={},_0xc2e8ac={'count':0x0,'rows':[]};var _0x50c97d=_['map'](db[_0xe806('0x33')][_0xe806('0x34')],function(_0x1165ab){return{'name':_0x1165ab[_0xe806('0x35')],'type':_0x1165ab[_0xe806('0x36')][_0xe806('0x37')]};});_0x5089d3[_0xe806('0x38')]=_[_0xe806('0x39')](_0x50c97d,_0xe806('0x31'));_0x5089d3[_0xe806('0x3a')]=_[_0xe806('0x3b')](_0x160a0b[_0xe806('0x3a')]);_0x5089d3[_0xe806('0x3c')]=_['intersection'](_0x5089d3[_0xe806('0x38')],_0x5089d3[_0xe806('0x3a')]);_0x493d5d[_0xe806('0x3d')]=_[_0xe806('0x3e')](_0x5089d3[_0xe806('0x38')],qs[_0xe806('0x3f')](_0x160a0b[_0xe806('0x3a')][_0xe806('0x3f')]));_0x493d5d[_0xe806('0x3d')]=_0x493d5d[_0xe806('0x3d')][_0xe806('0x40')]?_0x493d5d[_0xe806('0x3d')]:_0x5089d3[_0xe806('0x38')];if(!_0x160a0b[_0xe806('0x3a')][_0xe806('0x41')](_0xe806('0x42'))){_0x493d5d[_0xe806('0x21')]=qs[_0xe806('0x21')](_0x160a0b[_0xe806('0x3a')][_0xe806('0x21')]);_0x493d5d[_0xe806('0x23')]=qs[_0xe806('0x23')](_0x160a0b['query'][_0xe806('0x23')]);}_0x493d5d[_0xe806('0x43')]=qs[_0xe806('0x44')](_0x160a0b[_0xe806('0x3a')]['sort']);_0x493d5d[_0xe806('0x45')]=qs['filters'](_['pick'](_0x160a0b[_0xe806('0x3a')],_0x5089d3[_0xe806('0x3c')]),_0x50c97d);if(_0x160a0b[_0xe806('0x3a')][_0xe806('0x46')]){_0x493d5d[_0xe806('0x45')]=_[_0xe806('0x47')](_0x493d5d[_0xe806('0x45')],{'$or':_[_0xe806('0x39')](_0x50c97d,function(_0x46530d){if(_0x46530d[_0xe806('0x36')]!==_0xe806('0x48')){var _0x656921={};_0x656921[_0x46530d[_0xe806('0x31')]]={'$like':'%'+_0x160a0b[_0xe806('0x3a')][_0xe806('0x46')]+'%'};return _0x656921;}})});}_0x493d5d=_['merge']({},_0x493d5d,_0x160a0b[_0xe806('0x49')]);var _0x109d3a={'where':_0x493d5d[_0xe806('0x45')]};return db['AnalyticExtractedReport'][_0xe806('0x22')](_0x109d3a)[_0xe806('0x2a')](function(_0x36bc2b){_0xc2e8ac[_0xe806('0x22')]=_0x36bc2b;if(_0x160a0b['query']['includeAll']){_0x493d5d[_0xe806('0x4a')]=[{'all':!![]}];}return db[_0xe806('0x33')][_0xe806('0x4b')](_0x493d5d);})[_0xe806('0x2a')](function(_0x5ed867){_0xc2e8ac['rows']=_0x5ed867;return _0xc2e8ac;})[_0xe806('0x2a')](respondWithFilteredResult(_0x6b2fa6,_0x493d5d))[_0xe806('0x4c')](handleError(_0x6b2fa6,null));};exports[_0xe806('0x4d')]=function(_0x4fae85,_0x3f64d7){var _0x692c33={'raw':!![],'where':{'id':_0x4fae85[_0xe806('0x4e')]['id']}},_0x218f46={};_0x218f46['model']=_['keys'](db[_0xe806('0x33')][_0xe806('0x34')]);_0x218f46['query']=_[_0xe806('0x3b')](_0x4fae85['query']);_0x218f46[_0xe806('0x3c')]=_['intersection'](_0x218f46[_0xe806('0x38')],_0x218f46[_0xe806('0x3a')]);_0x692c33['attributes']=_['intersection'](_0x218f46[_0xe806('0x38')],qs[_0xe806('0x3f')](_0x4fae85['query'][_0xe806('0x3f')]));_0x692c33[_0xe806('0x3d')]=_0x692c33[_0xe806('0x3d')][_0xe806('0x40')]?_0x692c33['attributes']:_0x218f46['model'];if(_0x4fae85[_0xe806('0x3a')][_0xe806('0x4f')]){_0x692c33['include']=[{'all':!![]}];}_0x692c33=_[_0xe806('0x47')]({},_0x692c33,_0x4fae85[_0xe806('0x49')]);return db['AnalyticExtractedReport'][_0xe806('0x50')](_0x692c33)['then'](handleEntityNotFound(_0x3f64d7,null))[_0xe806('0x2a')](respondWithResult(_0x3f64d7,null))['catch'](handleError(_0x3f64d7,null));};exports[_0xe806('0x51')]=function(_0x1e58ac,_0xe4f7cf){return db[_0xe806('0x33')]['create'](_0x1e58ac[_0xe806('0x52')],{})[_0xe806('0x2a')](function(_0x361de7){var _0x1bf821=_0x1e58ac[_0xe806('0x53')][_0xe806('0x2c')]({'plain':!![]});if(!_0x1bf821)throw new Error(_0xe806('0x54'));if(_0x1bf821[_0xe806('0x55')]===_0xe806('0x53')){var _0xc0d8c7=_0x361de7['get']({'plain':!![]});var _0x1e1064='ExtractedReports';return db[_0xe806('0x56')]['find']({'where':{'name':_0x1e1064,'userProfileId':_0x1bf821['userProfileId']},'raw':!![]})['then'](function(_0x6d12d1){if(_0x6d12d1&&_0x6d12d1['autoAssociation']===0x0){return db[_0xe806('0x2e')]['create']({'name':_0xc0d8c7[_0xe806('0x31')],'resourceId':_0xc0d8c7['id'],'type':_0x6d12d1[_0xe806('0x31')],'sectionId':_0x6d12d1['id']},{})['then'](function(){return _0x361de7;});}else{return _0x361de7;}})[_0xe806('0x4c')](function(_0x44265e){logger['error'](_0xe806('0x57'),_0x44265e);throw _0x44265e;});}return _0x361de7;})[_0xe806('0x2a')](respondWithResult(_0xe4f7cf,0xc9))[_0xe806('0x4c')](handleError(_0xe4f7cf,null));};exports[_0xe806('0x29')]=function(_0x45b5a7,_0x26cd34){if(_0x45b5a7[_0xe806('0x52')]['id']){delete _0x45b5a7[_0xe806('0x52')]['id'];}return db[_0xe806('0x33')]['find']({'where':{'id':_0x45b5a7[_0xe806('0x4e')]['id']}})[_0xe806('0x2a')](handleEntityNotFound(_0x26cd34,null))[_0xe806('0x2a')](saveUpdates(_0x45b5a7[_0xe806('0x52')],null))['then'](respondWithResult(_0x26cd34,null))[_0xe806('0x4c')](handleError(_0x26cd34,null));};exports[_0xe806('0x2b')]=function(_0x24458f,_0x56aba2){return db['AnalyticExtractedReport'][_0xe806('0x50')]({'where':{'id':_0x24458f[_0xe806('0x4e')]['id']}})[_0xe806('0x2a')](handleEntityNotFound(_0x56aba2,null))[_0xe806('0x2a')](removeEntity(_0x56aba2,null))['catch'](handleError(_0x56aba2,null));};exports[_0xe806('0x58')]=function(_0xd0faa7,_0x2831b8,_0x58b212){return db[_0xe806('0x33')][_0xe806('0x50')]({'where':{'id':_0xd0faa7[_0xe806('0x4e')]['id']},'attributes':[_0xe806('0x31'),_0xe806('0x59'),_0xe806('0x5a'),_0xe806('0x5b')],'raw':!![]})['then'](handleEntityNotFound(_0x2831b8,null))[_0xe806('0x2a')](function(_0x1268a9){if(_0x1268a9){if(!fs['existsSync'](path['join'](config[_0xe806('0x5c')],_0xe806('0x5d'),_0x1268a9[_0xe806('0x5a')]))){throw new db[(_0xe806('0x5e'))]['ValidationError'](_0xe806('0x5f'));}if(_0xd0faa7[_0xe806('0x3a')]['exists']){return _0x2831b8['sendStatus'](0xc8);}return _0x2831b8[_0xe806('0x58')](path[_0xe806('0x60')](config[_0xe806('0x5c')],_0xe806('0x5d'),_0x1268a9['savename']),util[_0xe806('0x61')](_0xe806('0x62'),_0x1268a9['basename']||_0x1268a9[_0xe806('0x31')],_0x1268a9[_0xe806('0x5b')][_0xe806('0x63')]()));}})[_0xe806('0x4c')](handleError(_0x2831b8,null));}; \ No newline at end of file +var _0x4f95=['options','AnalyticExtractedReport','includeAll','include','findAll','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','get','ExtractedReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge'];(function(_0x26e864,_0x213b9d){var _0x5e0a65=function(_0x817b4){while(--_0x817b4){_0x26e864['push'](_0x26e864['shift']());}};_0x5e0a65(++_0x213b9d);}(_0x4f95,0xd8));var _0x54f9=function(_0x380165,_0x312a04){_0x380165=_0x380165-0x0;var _0x5ce714=_0x4f95[_0x380165];return _0x5ce714;};'use strict';var emlformat=require(_0x54f9('0x0'));var rimraf=require(_0x54f9('0x1'));var zipdir=require(_0x54f9('0x2'));var jsonpatch=require(_0x54f9('0x3'));var rp=require('request-promise');var moment=require(_0x54f9('0x4'));var BPromise=require(_0x54f9('0x5'));var Mustache=require(_0x54f9('0x6'));var util=require(_0x54f9('0x7'));var path=require(_0x54f9('0x8'));var sox=require(_0x54f9('0x9'));var csv=require(_0x54f9('0xa'));var ejs=require(_0x54f9('0xb'));var fs=require('fs');var fs_extra=require(_0x54f9('0xc'));var _=require(_0x54f9('0xd'));var squel=require(_0x54f9('0xe'));var crypto=require('crypto');var jsforce=require(_0x54f9('0xf'));var deskjs=require(_0x54f9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x54f9('0x11'));var Papa=require(_0x54f9('0x12'));var Redis=require('ioredis');var authService=require(_0x54f9('0x13'));var qs=require(_0x54f9('0x14'));var as=require(_0x54f9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54f9('0x16'))('api');var utils=require(_0x54f9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x54f9('0x18'));var db=require(_0x54f9('0x19'))['db'];function respondWithStatusCode(_0x130bb7,_0x2c6191){_0x2c6191=_0x2c6191||0xcc;return function(_0x245ef9){if(_0x245ef9){return _0x130bb7[_0x54f9('0x1a')](_0x2c6191);}return _0x130bb7[_0x54f9('0x1b')](_0x2c6191)['end']();};}function respondWithResult(_0x37fe29,_0x3edb06){_0x3edb06=_0x3edb06||0xc8;return function(_0x165bfa){if(_0x165bfa){return _0x37fe29['status'](_0x3edb06)[_0x54f9('0x1c')](_0x165bfa);}};}function respondWithFilteredResult(_0x506d77,_0x2c6d6e){return function(_0x4df12f){if(_0x4df12f){var _0x3f3e82=typeof _0x2c6d6e[_0x54f9('0x1d')]===_0x54f9('0x1e')&&typeof _0x2c6d6e[_0x54f9('0x1f')]===_0x54f9('0x1e');var _0x3d56ce=_0x4df12f[_0x54f9('0x20')];var _0x4f07ac=_0x3f3e82?0x0:_0x2c6d6e[_0x54f9('0x1d')];var _0x38a96b=_0x3f3e82?_0x4df12f[_0x54f9('0x20')]:_0x2c6d6e[_0x54f9('0x1d')]+_0x2c6d6e['limit'];var _0x2e63bf;if(_0x38a96b>=_0x3d56ce){_0x38a96b=_0x3d56ce;_0x2e63bf=0xc8;}else{_0x2e63bf=0xce;}_0x506d77[_0x54f9('0x1b')](_0x2e63bf);return _0x506d77['set'](_0x54f9('0x21'),_0x4f07ac+'-'+_0x38a96b+'/'+_0x3d56ce)[_0x54f9('0x1c')](_0x4df12f);}return null;};}function patchUpdates(_0xc399ba){return function(_0xf4ebdd){try{jsonpatch[_0x54f9('0x22')](_0xf4ebdd,_0xc399ba,!![]);}catch(_0x67e16c){return BPromise['reject'](_0x67e16c);}return _0xf4ebdd[_0x54f9('0x23')]();};}function saveUpdates(_0x445a3d,_0x4a26c4){return function(_0x255ed7){if(_0x255ed7){return _0x255ed7['update'](_0x445a3d)[_0x54f9('0x24')](function(_0x24aae1){return _0x24aae1;});}return null;};}function removeEntity(_0x3e90bc,_0x14a7aa){return function(_0x2235b7){if(_0x2235b7){return _0x2235b7[_0x54f9('0x25')]()[_0x54f9('0x24')](function(){var _0x3a836e=_0x2235b7[_0x54f9('0x26')]({'plain':!![]});var _0x41fac8=_0x54f9('0x27');return db[_0x54f9('0x28')][_0x54f9('0x25')]({'where':{'type':_0x41fac8,'resourceId':_0x3a836e['id']}})[_0x54f9('0x24')](function(){return _0x2235b7;});})[_0x54f9('0x24')](function(){_0x3e90bc[_0x54f9('0x1b')](0xcc)[_0x54f9('0x29')]();});}};}function handleEntityNotFound(_0xbe0659,_0x425ae6){return function(_0x9fa40c){if(!_0x9fa40c){_0xbe0659[_0x54f9('0x1a')](0x194);}return _0x9fa40c;};}function handleError(_0x14ddff,_0x544742){_0x544742=_0x544742||0x1f4;return function(_0x2d2faf){logger[_0x54f9('0x2a')](_0x2d2faf[_0x54f9('0x2b')]);if(_0x2d2faf[_0x54f9('0x2c')]){delete _0x2d2faf['name'];}_0x14ddff['status'](_0x544742)[_0x54f9('0x2d')](_0x2d2faf);};}exports[_0x54f9('0x2e')]=function(_0xb0927e,_0x6786a8){var _0x2d28a4={},_0xe8772d={},_0x20930b={'count':0x0,'rows':[]};var _0x236ac8=_[_0x54f9('0x2f')](db['AnalyticExtractedReport'][_0x54f9('0x30')],function(_0x53e263){return{'name':_0x53e263[_0x54f9('0x31')],'type':_0x53e263['type'][_0x54f9('0x32')]};});_0xe8772d['model']=_[_0x54f9('0x2f')](_0x236ac8,_0x54f9('0x2c'));_0xe8772d['query']=_[_0x54f9('0x33')](_0xb0927e['query']);_0xe8772d[_0x54f9('0x34')]=_[_0x54f9('0x35')](_0xe8772d[_0x54f9('0x36')],_0xe8772d[_0x54f9('0x37')]);_0x2d28a4[_0x54f9('0x38')]=_['intersection'](_0xe8772d[_0x54f9('0x36')],qs[_0x54f9('0x39')](_0xb0927e[_0x54f9('0x37')][_0x54f9('0x39')]));_0x2d28a4['attributes']=_0x2d28a4['attributes'][_0x54f9('0x3a')]?_0x2d28a4[_0x54f9('0x38')]:_0xe8772d['model'];if(!_0xb0927e['query'][_0x54f9('0x3b')](_0x54f9('0x3c'))){_0x2d28a4[_0x54f9('0x1f')]=qs['limit'](_0xb0927e[_0x54f9('0x37')][_0x54f9('0x1f')]);_0x2d28a4[_0x54f9('0x1d')]=qs[_0x54f9('0x1d')](_0xb0927e['query'][_0x54f9('0x1d')]);}_0x2d28a4['order']=qs[_0x54f9('0x3d')](_0xb0927e[_0x54f9('0x37')]['sort']);_0x2d28a4['where']=qs[_0x54f9('0x34')](_[_0x54f9('0x3e')](_0xb0927e['query'],_0xe8772d[_0x54f9('0x34')]),_0x236ac8);if(_0xb0927e[_0x54f9('0x37')][_0x54f9('0x3f')]){_0x2d28a4[_0x54f9('0x40')]=_[_0x54f9('0x41')](_0x2d28a4[_0x54f9('0x40')],{'$or':_[_0x54f9('0x2f')](_0x236ac8,function(_0x105988){if(_0x105988['type']!=='VIRTUAL'){var _0x374b3e={};_0x374b3e[_0x105988[_0x54f9('0x2c')]]={'$like':'%'+_0xb0927e['query'][_0x54f9('0x3f')]+'%'};return _0x374b3e;}})});}_0x2d28a4=_[_0x54f9('0x41')]({},_0x2d28a4,_0xb0927e[_0x54f9('0x42')]);var _0x291a33={'where':_0x2d28a4['where']};return db[_0x54f9('0x43')][_0x54f9('0x20')](_0x291a33)['then'](function(_0x18e160){_0x20930b['count']=_0x18e160;if(_0xb0927e[_0x54f9('0x37')][_0x54f9('0x44')]){_0x2d28a4[_0x54f9('0x45')]=[{'all':!![]}];}return db[_0x54f9('0x43')][_0x54f9('0x46')](_0x2d28a4);})[_0x54f9('0x24')](function(_0x212790){_0x20930b['rows']=_0x212790;return _0x20930b;})[_0x54f9('0x24')](respondWithFilteredResult(_0x6786a8,_0x2d28a4))[_0x54f9('0x47')](handleError(_0x6786a8,null));};exports[_0x54f9('0x48')]=function(_0x4c1c3d,_0x81fd31){var _0x10661f={'raw':!![],'where':{'id':_0x4c1c3d[_0x54f9('0x49')]['id']}},_0x286d96={};_0x286d96[_0x54f9('0x36')]=_[_0x54f9('0x33')](db['AnalyticExtractedReport'][_0x54f9('0x30')]);_0x286d96[_0x54f9('0x37')]=_[_0x54f9('0x33')](_0x4c1c3d['query']);_0x286d96[_0x54f9('0x34')]=_[_0x54f9('0x35')](_0x286d96[_0x54f9('0x36')],_0x286d96['query']);_0x10661f[_0x54f9('0x38')]=_[_0x54f9('0x35')](_0x286d96[_0x54f9('0x36')],qs[_0x54f9('0x39')](_0x4c1c3d['query']['fields']));_0x10661f[_0x54f9('0x38')]=_0x10661f[_0x54f9('0x38')]['length']?_0x10661f[_0x54f9('0x38')]:_0x286d96['model'];if(_0x4c1c3d['query'][_0x54f9('0x44')]){_0x10661f[_0x54f9('0x45')]=[{'all':!![]}];}_0x10661f=_[_0x54f9('0x41')]({},_0x10661f,_0x4c1c3d[_0x54f9('0x42')]);return db['AnalyticExtractedReport'][_0x54f9('0x4a')](_0x10661f)[_0x54f9('0x24')](handleEntityNotFound(_0x81fd31,null))[_0x54f9('0x24')](respondWithResult(_0x81fd31,null))['catch'](handleError(_0x81fd31,null));};exports['create']=function(_0x26027d,_0x12f230){return db[_0x54f9('0x43')]['create'](_0x26027d[_0x54f9('0x4b')],{})['then'](function(_0x4e2e04){var _0x95bd4a=_0x26027d['user']['get']({'plain':!![]});if(!_0x95bd4a)throw new Error(_0x54f9('0x4c'));if(_0x95bd4a[_0x54f9('0x4d')]===_0x54f9('0x4e')){var _0x34b159=_0x4e2e04[_0x54f9('0x26')]({'plain':!![]});var _0x4685cd='ExtractedReports';return db[_0x54f9('0x4f')][_0x54f9('0x4a')]({'where':{'name':_0x4685cd,'userProfileId':_0x95bd4a['userProfileId']},'raw':!![]})['then'](function(_0x4b4159){if(_0x4b4159&&_0x4b4159['autoAssociation']===0x0){return db[_0x54f9('0x28')][_0x54f9('0x50')]({'name':_0x34b159['name'],'resourceId':_0x34b159['id'],'type':_0x4b4159[_0x54f9('0x2c')],'sectionId':_0x4b4159['id']},{})[_0x54f9('0x24')](function(){return _0x4e2e04;});}else{return _0x4e2e04;}})[_0x54f9('0x47')](function(_0x2e6452){logger[_0x54f9('0x2a')](_0x54f9('0x51'),_0x2e6452);throw _0x2e6452;});}return _0x4e2e04;})[_0x54f9('0x24')](respondWithResult(_0x12f230,0xc9))[_0x54f9('0x47')](handleError(_0x12f230,null));};exports[_0x54f9('0x52')]=function(_0x49b64f,_0x30380e){if(_0x49b64f[_0x54f9('0x4b')]['id']){delete _0x49b64f[_0x54f9('0x4b')]['id'];}return db[_0x54f9('0x43')][_0x54f9('0x4a')]({'where':{'id':_0x49b64f[_0x54f9('0x49')]['id']}})[_0x54f9('0x24')](handleEntityNotFound(_0x30380e,null))[_0x54f9('0x24')](saveUpdates(_0x49b64f[_0x54f9('0x4b')],null))[_0x54f9('0x24')](respondWithResult(_0x30380e,null))['catch'](handleError(_0x30380e,null));};exports['destroy']=function(_0x405f8e,_0x10693b){return db[_0x54f9('0x43')]['find']({'where':{'id':_0x405f8e[_0x54f9('0x49')]['id']}})[_0x54f9('0x24')](handleEntityNotFound(_0x10693b,null))[_0x54f9('0x24')](removeEntity(_0x10693b,null))['catch'](handleError(_0x10693b,null));};exports[_0x54f9('0x53')]=function(_0x4ec5fb,_0x19b7bb,_0x341bbd){return db[_0x54f9('0x43')][_0x54f9('0x4a')]({'where':{'id':_0x4ec5fb[_0x54f9('0x49')]['id']},'attributes':[_0x54f9('0x2c'),_0x54f9('0x54'),_0x54f9('0x55'),'output'],'raw':!![]})[_0x54f9('0x24')](handleEntityNotFound(_0x19b7bb,null))[_0x54f9('0x24')](function(_0x9e8ce5){if(_0x9e8ce5){if(!fs['existsSync'](path[_0x54f9('0x56')](config[_0x54f9('0x57')],_0x54f9('0x58'),_0x9e8ce5['savename']))){throw new db['Sequelize'][(_0x54f9('0x59'))](_0x54f9('0x5a'));}if(_0x4ec5fb[_0x54f9('0x37')][_0x54f9('0x5b')]){return _0x19b7bb[_0x54f9('0x1a')](0xc8);}return _0x19b7bb['download'](path[_0x54f9('0x56')](config[_0x54f9('0x57')],_0x54f9('0x58'),_0x9e8ce5[_0x54f9('0x55')]),util['format']('%s.%s',_0x9e8ce5[_0x54f9('0x54')]||_0x9e8ce5['name'],_0x9e8ce5[_0x54f9('0x5c')][_0x54f9('0x5d')]()));}})[_0x54f9('0x47')](handleError(_0x19b7bb,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b522e3b..e099ced 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 _0x6cc2=['api','moment','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6cc2,0x1ee));var _0x26cc=function(_0x36fb18,_0x1577ec){_0x36fb18=_0x36fb18-0x0;var _0x281bf8=_0x6cc2[_0x36fb18];return _0x281bf8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x26cc('0x0'))(_0x26cc('0x1'));var moment=require(_0x26cc('0x2'));var BPromise=require('bluebird');var rp=require(_0x26cc('0x3'));var fs=require('fs');var path=require(_0x26cc('0x4'));var rimraf=require('rimraf');var config=require(_0x26cc('0x5'));var attributes=require(_0x26cc('0x6'));module['exports']=function(_0x1321cb,_0x482867){return _0x1321cb['define'](_0x26cc('0x7'),attributes,{'tableName':_0x26cc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3709=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3709,0x108));var _0x9370=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3709[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x9370('0x0'));var util=require(_0x9370('0x1'));var logger=require(_0x9370('0x2'))('api');var moment=require(_0x9370('0x3'));var BPromise=require(_0x9370('0x4'));var rp=require(_0x9370('0x5'));var fs=require('fs');var path=require(_0x9370('0x6'));var rimraf=require(_0x9370('0x7'));var config=require(_0x9370('0x8'));var attributes=require(_0x9370('0x9'));module[_0x9370('0xa')]=function(_0x9ae5c,_0x4c3bbc){return _0x9ae5c[_0x9370('0xb')](_0x9370('0xc'),attributes,{'tableName':_0x9370('0xd'),'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 a8470f1..af68ea8 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 _0xd01c=['jayson/promise','client','http','request','info','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd01c,0xfb));var _0xcd01=function(_0xcb6dec,_0x263746){_0xcb6dec=_0xcb6dec-0x0;var _0x196908=_0xd01c[_0xcb6dec];return _0x196908;};'use strict';var _=require(_0xcd01('0x0'));var util=require(_0xcd01('0x1'));var moment=require(_0xcd01('0x2'));var BPromise=require(_0xcd01('0x3'));var rs=require(_0xcd01('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd01('0x5'))['db'];var utils=require(_0xcd01('0x6'));var logger=require(_0xcd01('0x7'))('rpc');var config=require(_0xcd01('0x8'));var jayson=require(_0xcd01('0x9'));var client=jayson[_0xcd01('0xa')][_0xcd01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52bf91,_0x3d8249,_0x19c845){return new BPromise(function(_0x3b9975,_0x422b2f){return client[_0xcd01('0xc')](_0x52bf91,_0x19c845)['then'](function(_0x287988){logger[_0xcd01('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3d8249,'request\x20sent');logger[_0xcd01('0xe')](_0xcd01('0xf'),_0x3d8249,_0xcd01('0x10'),JSON['stringify'](_0x287988));if(_0x287988[_0xcd01('0x11')]){if(_0x287988[_0xcd01('0x11')][_0xcd01('0x12')]===0x1f4){logger[_0xcd01('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3d8249,_0x287988[_0xcd01('0x11')][_0xcd01('0x13')]);return _0x422b2f(_0x287988[_0xcd01('0x11')][_0xcd01('0x13')]);}logger[_0xcd01('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3d8249,_0x287988[_0xcd01('0x11')][_0xcd01('0x13')]);return _0x3b9975(_0x287988['error']['message']);}else{logger[_0xcd01('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3d8249,_0xcd01('0x10'));_0x3b9975(_0x287988['result'][_0xcd01('0x13')]);}})['catch'](function(_0x4419b6){logger[_0xcd01('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3d8249,_0x4419b6);_0x422b2f(_0x4419b6);});});} \ No newline at end of file +var _0x5b92=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5b92,0x1a0));var _0x25b9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5b92[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x25b9('0x0'));var util=require(_0x25b9('0x1'));var moment=require(_0x25b9('0x2'));var BPromise=require(_0x25b9('0x3'));var rs=require(_0x25b9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b9('0x5'))['db'];var utils=require(_0x25b9('0x6'));var logger=require('../../config/logger')(_0x25b9('0x7'));var config=require(_0x25b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25b9('0x9')][_0x25b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ee3c7,_0x3e4833,_0x148570){return new BPromise(function(_0xbea936,_0x452b97){return client[_0x25b9('0xb')](_0x4ee3c7,_0x148570)[_0x25b9('0xc')](function(_0x490e6b){logger[_0x25b9('0xd')](_0x25b9('0xe'),_0x3e4833,_0x25b9('0xf'));logger[_0x25b9('0x10')](_0x25b9('0x11'),_0x3e4833,'request\x20sent',JSON['stringify'](_0x490e6b));if(_0x490e6b[_0x25b9('0x12')]){if(_0x490e6b[_0x25b9('0x12')][_0x25b9('0x13')]===0x1f4){logger[_0x25b9('0x12')](_0x25b9('0xe'),_0x3e4833,_0x490e6b[_0x25b9('0x12')][_0x25b9('0x14')]);return _0x452b97(_0x490e6b['error'][_0x25b9('0x14')]);}logger[_0x25b9('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e4833,_0x490e6b['error'][_0x25b9('0x14')]);return _0xbea936(_0x490e6b['error']['message']);}else{logger[_0x25b9('0xd')](_0x25b9('0xe'),_0x3e4833,_0x25b9('0xf'));_0xbea936(_0x490e6b[_0x25b9('0x15')][_0x25b9('0x14')]);}})[_0x25b9('0x16')](function(_0x2ac891){logger[_0x25b9('0x12')](_0x25b9('0xe'),_0x3e4833,_0x2ac891);_0x452b97(_0x2ac891);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b2fb7c8..4715193 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 _0xf069=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3cdd66,_0x9e884e){var _0xf87a9=function(_0x2df39b){while(--_0x2df39b){_0x3cdd66['push'](_0x3cdd66['shift']());}};_0xf87a9(++_0x9e884e);}(_0xf069,0x161));var _0x9f06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf069[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9f06('0x0'));var util=require(_0x9f06('0x1'));var path=require(_0x9f06('0x2'));var timeout=require(_0x9f06('0x3'));var express=require('express');var router=express[_0x9f06('0x4')]();var fs_extra=require(_0x9f06('0x5'));var auth=require(_0x9f06('0x6'));var interaction=require(_0x9f06('0x7'));var config=require('../../config/environment');var controller=require(_0x9f06('0x8'));router[_0x9f06('0x9')]('/',auth[_0x9f06('0xa')](),controller['index']);router[_0x9f06('0x9')]('/:id',auth[_0x9f06('0xa')](),controller['show']);router[_0x9f06('0x9')](_0x9f06('0xb'),auth['isAuthenticated'](),controller[_0x9f06('0xc')]);router[_0x9f06('0xd')]('/',auth[_0x9f06('0xa')](),controller[_0x9f06('0xe')]);router[_0x9f06('0xf')](_0x9f06('0x10'),auth['isAuthenticated'](),controller[_0x9f06('0x11')]);router[_0x9f06('0x12')](_0x9f06('0x10'),auth['isAuthenticated'](),controller[_0x9f06('0x13')]);module[_0x9f06('0x14')]=router; \ No newline at end of file +var _0x3db6=['../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','/:id','show','/:id/download','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/auth/service'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x3db6,0x7c));var _0x63db=function(_0x100b1a,_0x30dd8d){_0x100b1a=_0x100b1a-0x0;var _0x14ac83=_0x3db6[_0x100b1a];return _0x14ac83;};'use strict';var multer=require(_0x63db('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x63db('0x1'));var express=require('express');var router=express[_0x63db('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x63db('0x3'));var interaction=require(_0x63db('0x4'));var config=require('../../config/environment');var controller=require(_0x63db('0x5'));router['get']('/',auth[_0x63db('0x6')](),controller['index']);router['get'](_0x63db('0x7'),auth[_0x63db('0x6')](),controller[_0x63db('0x8')]);router['get'](_0x63db('0x9'),auth[_0x63db('0x6')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x63db('0xa')]);router[_0x63db('0xb')](_0x63db('0x7'),auth[_0x63db('0x6')](),controller[_0x63db('0xc')]);router[_0x63db('0xd')]('/:id',auth[_0x63db('0x6')](),controller[_0x63db('0xe')]);module[_0x63db('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 6f54f36..647da44 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 _0xc383=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0xc383,0x1e1));var _0x3c38=function(_0x1c53e1,_0x16f552){_0x1c53e1=_0x1c53e1-0x0;var _0x2073f2=_0xc383[_0x1c53e1];return _0x2073f2;};'use strict';var Sequelize=require(_0x3c38('0x0'));module[_0x3c38('0x1')]={'field':{'type':Sequelize[_0x3c38('0x2')]},'alias':{'type':Sequelize[_0x3c38('0x3')]},'function':{'type':Sequelize[_0x3c38('0x3')]},'format':{'type':Sequelize[_0x3c38('0x3')]},'groupBy':{'type':Sequelize[_0x3c38('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3c38('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa6cb=['TEXT','STRING','BOOLEAN','exports'];(function(_0x382f76,_0x46c9e4){var _0x40a66f=function(_0x41d861){while(--_0x41d861){_0x382f76['push'](_0x382f76['shift']());}};_0x40a66f(++_0x46c9e4);}(_0xa6cb,0x123));var _0xba6c=function(_0x1ec498,_0x22a287){_0x1ec498=_0x1ec498-0x0;var _0x5e8fb7=_0xa6cb[_0x1ec498];return _0x5e8fb7;};'use strict';var Sequelize=require('sequelize');module[_0xba6c('0x0')]={'field':{'type':Sequelize[_0xba6c('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xba6c('0x2')]},'format':{'type':Sequelize[_0xba6c('0x2')]},'groupBy':{'type':Sequelize[_0xba6c('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xba6c('0x2')]},'custom':{'type':Sequelize[_0xba6c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d96f10a..49df0a6 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 _0x6214=['reject','save','destroy','end','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','then','includeAll','include','show','params','find','catch','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x4e907f,_0x5d6a36){var _0x380b56=function(_0xc18ed7){while(--_0xc18ed7){_0x4e907f['push'](_0x4e907f['shift']());}};_0x380b56(++_0x5d6a36);}(_0x6214,0xda));var _0x4621=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x6214[_0x1d87fc];return _0x492b56;};'use strict';var emlformat=require(_0x4621('0x0'));var rimraf=require(_0x4621('0x1'));var zipdir=require(_0x4621('0x2'));var jsonpatch=require(_0x4621('0x3'));var rp=require(_0x4621('0x4'));var moment=require(_0x4621('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4621('0x6'));var util=require(_0x4621('0x7'));var path=require(_0x4621('0x8'));var sox=require(_0x4621('0x9'));var csv=require(_0x4621('0xa'));var ejs=require(_0x4621('0xb'));var fs=require('fs');var fs_extra=require(_0x4621('0xc'));var _=require('lodash');var squel=require(_0x4621('0xd'));var crypto=require(_0x4621('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4621('0xa'));var querystring=require(_0x4621('0xf'));var Papa=require(_0x4621('0x10'));var Redis=require(_0x4621('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4621('0x12'));var hardwareService=require(_0x4621('0x13'));var logger=require(_0x4621('0x14'))(_0x4621('0x15'));var utils=require(_0x4621('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4621('0x17'));var db=require(_0x4621('0x18'))['db'];function respondWithStatusCode(_0x4a92f0,_0x284741){_0x284741=_0x284741||0xcc;return function(_0x295113){if(_0x295113){return _0x4a92f0[_0x4621('0x19')](_0x284741);}return _0x4a92f0[_0x4621('0x1a')](_0x284741)['end']();};}function respondWithResult(_0x5b041e,_0x2a9767){_0x2a9767=_0x2a9767||0xc8;return function(_0x2f033e){if(_0x2f033e){return _0x5b041e[_0x4621('0x1a')](_0x2a9767)[_0x4621('0x1b')](_0x2f033e);}};}function respondWithFilteredResult(_0xdd03f2,_0x1da6f4){return function(_0x2d570d){if(_0x2d570d){var _0x25bd22=typeof _0x1da6f4[_0x4621('0x1c')]===_0x4621('0x1d')&&typeof _0x1da6f4[_0x4621('0x1e')]===_0x4621('0x1d');var _0x23fb9f=_0x2d570d[_0x4621('0x1f')];var _0xa72b04=_0x25bd22?0x0:_0x1da6f4[_0x4621('0x1c')];var _0x16303c=_0x25bd22?_0x2d570d[_0x4621('0x1f')]:_0x1da6f4[_0x4621('0x1c')]+_0x1da6f4['limit'];var _0x2e40bc;if(_0x16303c>=_0x23fb9f){_0x16303c=_0x23fb9f;_0x2e40bc=0xc8;}else{_0x2e40bc=0xce;}_0xdd03f2[_0x4621('0x1a')](_0x2e40bc);return _0xdd03f2[_0x4621('0x20')](_0x4621('0x21'),_0xa72b04+'-'+_0x16303c+'/'+_0x23fb9f)['json'](_0x2d570d);}return null;};}function patchUpdates(_0x2f7606){return function(_0x172f58){try{jsonpatch['apply'](_0x172f58,_0x2f7606,!![]);}catch(_0x27a3ec){return BPromise[_0x4621('0x22')](_0x27a3ec);}return _0x172f58[_0x4621('0x23')]();};}function saveUpdates(_0x1469e8,_0x36077e){return function(_0x4e634a){if(_0x4e634a){return _0x4e634a['update'](_0x1469e8)['then'](function(_0x3763e0){return _0x3763e0;});}return null;};}function removeEntity(_0x12839a,_0x2f2591){return function(_0x553286){if(_0x553286){return _0x553286[_0x4621('0x24')]()['then'](function(){_0x12839a[_0x4621('0x1a')](0xcc)[_0x4621('0x25')]();});}};}function handleEntityNotFound(_0x219cb2,_0x195789){return function(_0x4b54fc){if(!_0x4b54fc){_0x219cb2[_0x4621('0x19')](0x194);}return _0x4b54fc;};}function handleError(_0x51d405,_0x37459d){_0x37459d=_0x37459d||0x1f4;return function(_0x216594){logger[_0x4621('0x26')](_0x216594[_0x4621('0x27')]);if(_0x216594[_0x4621('0x28')]){delete _0x216594['name'];}_0x51d405[_0x4621('0x1a')](_0x37459d)[_0x4621('0x29')](_0x216594);};}exports[_0x4621('0x2a')]=function(_0x35bd7a,_0x1f1bde){var _0x17e3bf={},_0x52bfd6={},_0x41b567={'count':0x0,'rows':[]};var _0x36c392=_['map'](db[_0x4621('0x2b')][_0x4621('0x2c')],function(_0x3f6b4f){return{'name':_0x3f6b4f[_0x4621('0x2d')],'type':_0x3f6b4f[_0x4621('0x2e')]['key']};});_0x52bfd6[_0x4621('0x2f')]=_[_0x4621('0x30')](_0x36c392,_0x4621('0x28'));_0x52bfd6['query']=_[_0x4621('0x31')](_0x35bd7a[_0x4621('0x32')]);_0x52bfd6[_0x4621('0x33')]=_[_0x4621('0x34')](_0x52bfd6[_0x4621('0x2f')],_0x52bfd6['query']);_0x17e3bf['attributes']=_[_0x4621('0x34')](_0x52bfd6[_0x4621('0x2f')],qs[_0x4621('0x35')](_0x35bd7a[_0x4621('0x32')][_0x4621('0x35')]));_0x17e3bf[_0x4621('0x36')]=_0x17e3bf[_0x4621('0x36')][_0x4621('0x37')]?_0x17e3bf[_0x4621('0x36')]:_0x52bfd6[_0x4621('0x2f')];if(!_0x35bd7a['query'][_0x4621('0x38')]('nolimit')){_0x17e3bf['limit']=qs[_0x4621('0x1e')](_0x35bd7a[_0x4621('0x32')][_0x4621('0x1e')]);_0x17e3bf[_0x4621('0x1c')]=qs[_0x4621('0x1c')](_0x35bd7a[_0x4621('0x32')][_0x4621('0x1c')]);}_0x17e3bf[_0x4621('0x39')]=qs[_0x4621('0x3a')](_0x35bd7a[_0x4621('0x32')][_0x4621('0x3a')]);_0x17e3bf['where']=qs['filters'](_[_0x4621('0x3b')](_0x35bd7a[_0x4621('0x32')],_0x52bfd6[_0x4621('0x33')]),_0x36c392);if(_0x35bd7a[_0x4621('0x32')]['filter']){_0x17e3bf[_0x4621('0x3c')]=_[_0x4621('0x3d')](_0x17e3bf[_0x4621('0x3c')],{'$or':_[_0x4621('0x30')](_0x36c392,function(_0x1eb879){if(_0x1eb879[_0x4621('0x2e')]!=='VIRTUAL'){var _0x3e1594={};_0x3e1594[_0x1eb879['name']]={'$like':'%'+_0x35bd7a['query'][_0x4621('0x3e')]+'%'};return _0x3e1594;}})});}_0x17e3bf=_[_0x4621('0x3d')]({},_0x17e3bf,_0x35bd7a[_0x4621('0x3f')]);var _0x52c03f={'where':_0x17e3bf[_0x4621('0x3c')]};return db[_0x4621('0x2b')]['count'](_0x52c03f)[_0x4621('0x40')](function(_0x38dd3e){_0x41b567['count']=_0x38dd3e;if(_0x35bd7a[_0x4621('0x32')][_0x4621('0x41')]){_0x17e3bf[_0x4621('0x42')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x17e3bf);})[_0x4621('0x40')](function(_0x22a62f){_0x41b567['rows']=_0x22a62f;return _0x41b567;})[_0x4621('0x40')](respondWithFilteredResult(_0x1f1bde,_0x17e3bf))['catch'](handleError(_0x1f1bde,null));};exports[_0x4621('0x43')]=function(_0x1082c6,_0xb0aa4c){var _0xe80948={'raw':![],'where':{'id':_0x1082c6[_0x4621('0x44')]['id']}},_0x5b3715={};_0x5b3715[_0x4621('0x2f')]=_[_0x4621('0x31')](db[_0x4621('0x2b')][_0x4621('0x2c')]);_0x5b3715['query']=_[_0x4621('0x31')](_0x1082c6[_0x4621('0x32')]);_0x5b3715['filters']=_[_0x4621('0x34')](_0x5b3715[_0x4621('0x2f')],_0x5b3715[_0x4621('0x32')]);_0xe80948[_0x4621('0x36')]=_[_0x4621('0x34')](_0x5b3715[_0x4621('0x2f')],qs['fields'](_0x1082c6[_0x4621('0x32')]['fields']));_0xe80948[_0x4621('0x36')]=_0xe80948[_0x4621('0x36')][_0x4621('0x37')]?_0xe80948[_0x4621('0x36')]:_0x5b3715[_0x4621('0x2f')];if(_0x1082c6[_0x4621('0x32')][_0x4621('0x41')]){_0xe80948['include']=[{'all':!![]}];}_0xe80948=_[_0x4621('0x3d')]({},_0xe80948,_0x1082c6[_0x4621('0x3f')]);return db[_0x4621('0x2b')][_0x4621('0x45')](_0xe80948)[_0x4621('0x40')](handleEntityNotFound(_0xb0aa4c,null))['then'](respondWithResult(_0xb0aa4c,null))[_0x4621('0x46')](handleError(_0xb0aa4c,null));};exports['create']=function(_0xe1cd6c,_0x498b80){return db[_0x4621('0x2b')][_0x4621('0x47')](_0xe1cd6c[_0x4621('0x48')],{})[_0x4621('0x40')](respondWithResult(_0x498b80,0xc9))[_0x4621('0x46')](handleError(_0x498b80,null));};exports[_0x4621('0x49')]=function(_0x3ae63a,_0x5a9d99){return db[_0x4621('0x2b')][_0x4621('0x49')](_0x3ae63a['body'],{'raw':![],'individualHooks':!![]})[_0x4621('0x40')](respondWithResult(_0x5a9d99,0xc9))[_0x4621('0x46')](handleError(_0x5a9d99,null));};exports[_0x4621('0x4a')]=function(_0xf1d93d,_0xed4d11){if(_0xf1d93d[_0x4621('0x48')]['id']){delete _0xf1d93d[_0x4621('0x48')]['id'];}return db[_0x4621('0x2b')]['find']({'where':{'id':_0xf1d93d[_0x4621('0x44')]['id']}})['then'](handleEntityNotFound(_0xed4d11,null))[_0x4621('0x40')](saveUpdates(_0xf1d93d[_0x4621('0x48')],null))[_0x4621('0x40')](respondWithResult(_0xed4d11,null))[_0x4621('0x46')](handleError(_0xed4d11,null));};exports[_0x4621('0x24')]=function(_0x1f68b8,_0x3661d5){return db['AnalyticFieldReport'][_0x4621('0x45')]({'where':{'id':_0x1f68b8['params']['id']}})[_0x4621('0x40')](handleEntityNotFound(_0x3661d5,null))['then'](removeEntity(_0x3661d5,null))[_0x4621('0x46')](handleError(_0x3661d5,null));};exports[_0x4621('0x4b')]=function(_0x27ace0,_0x5a32aa){return db['AnalyticFieldReport'][_0x4621('0x24')]({'where':{'id':_0x27ace0[_0x4621('0x32')][_0x4621('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x4621('0x40')](respondWithResult(_0x5a32aa,0xcc))[_0x4621('0x46')](handleError(_0x5a32aa,null));};exports[_0x4621('0x4d')]=function(_0x1b902d,_0x3c16dd,_0x26cf28){return db[_0x4621('0x4e')][_0x4621('0x4f')]({'where':{'id':_0x1b902d[_0x4621('0x44')]['id']}})[_0x4621('0x40')](handleEntityNotFound(_0x3c16dd,null))[_0x4621('0x40')](function(_0x85fa16){if(_0x85fa16){return db[_0x4621('0x50')][_0x4621('0x51')](function(_0x352261){return db[_0x4621('0x2b')]['destroy']({'where':{'CustomReportId':_0x1b902d[_0x4621('0x44')]['id']},'transaction':_0x352261})['then'](function(_0x748797){var _0x2d66e8=_[_0x4621('0x30')](_0x1b902d[_0x4621('0x48')],function(_0x5348bc){delete _0x5348bc['id'];_0x5348bc[_0x4621('0x52')]=_0x1b902d[_0x4621('0x44')]['id'];return _0x5348bc;});return db['AnalyticFieldReport'][_0x4621('0x49')](_0x2d66e8,{'transaction':_0x352261});});})[_0x4621('0x40')](function(){return db[_0x4621('0x2b')][_0x4621('0x53')]({'where':{'CustomReportId':_0x1b902d[_0x4621('0x44')]['id']}});});}})[_0x4621('0x40')](respondWithResult(_0x3c16dd,null))[_0x4621('0x46')](handleError(_0x3c16dd,null));}; \ No newline at end of file +var _0xa181=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters'];(function(_0x407844,_0x47eedc){var _0x36f5df=function(_0x31ee6d){while(--_0x31ee6d){_0x407844['push'](_0x407844['shift']());}};_0x36f5df(++_0x47eedc);}(_0xa181,0x10a));var _0x1a18=function(_0x13be3e,_0x10ff28){_0x13be3e=_0x13be3e-0x0;var _0x1fab88=_0xa181[_0x13be3e];return _0x1fab88;};'use strict';var emlformat=require(_0x1a18('0x0'));var rimraf=require(_0x1a18('0x1'));var zipdir=require(_0x1a18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a18('0x3'));var moment=require(_0x1a18('0x4'));var BPromise=require(_0x1a18('0x5'));var Mustache=require(_0x1a18('0x6'));var util=require(_0x1a18('0x7'));var path=require(_0x1a18('0x8'));var sox=require('sox');var csv=require(_0x1a18('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a18('0xa'));var _=require(_0x1a18('0xb'));var squel=require(_0x1a18('0xc'));var crypto=require(_0x1a18('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1a18('0xe'));var toCsv=require(_0x1a18('0x9'));var querystring=require(_0x1a18('0xf'));var Papa=require('papaparse');var Redis=require(_0x1a18('0x10'));var authService=require(_0x1a18('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1a18('0x12'));var hardwareService=require(_0x1a18('0x13'));var logger=require(_0x1a18('0x14'))(_0x1a18('0x15'));var utils=require(_0x1a18('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1a18('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17ae6a,_0x4224d0){_0x4224d0=_0x4224d0||0xcc;return function(_0x4ef94e){if(_0x4ef94e){return _0x17ae6a[_0x1a18('0x18')](_0x4224d0);}return _0x17ae6a['status'](_0x4224d0)[_0x1a18('0x19')]();};}function respondWithResult(_0x15f465,_0x55f592){_0x55f592=_0x55f592||0xc8;return function(_0x1ad393){if(_0x1ad393){return _0x15f465[_0x1a18('0x1a')](_0x55f592)[_0x1a18('0x1b')](_0x1ad393);}};}function respondWithFilteredResult(_0x5da6ce,_0x2785f6){return function(_0x47ac2e){if(_0x47ac2e){var _0x375527=typeof _0x2785f6['offset']===_0x1a18('0x1c')&&typeof _0x2785f6['limit']===_0x1a18('0x1c');var _0x520263=_0x47ac2e[_0x1a18('0x1d')];var _0x301947=_0x375527?0x0:_0x2785f6[_0x1a18('0x1e')];var _0x2a9d04=_0x375527?_0x47ac2e['count']:_0x2785f6['offset']+_0x2785f6['limit'];var _0x464a18;if(_0x2a9d04>=_0x520263){_0x2a9d04=_0x520263;_0x464a18=0xc8;}else{_0x464a18=0xce;}_0x5da6ce[_0x1a18('0x1a')](_0x464a18);return _0x5da6ce[_0x1a18('0x1f')](_0x1a18('0x20'),_0x301947+'-'+_0x2a9d04+'/'+_0x520263)[_0x1a18('0x1b')](_0x47ac2e);}return null;};}function patchUpdates(_0x93a0a7){return function(_0x520018){try{jsonpatch[_0x1a18('0x21')](_0x520018,_0x93a0a7,!![]);}catch(_0x3d86c6){return BPromise[_0x1a18('0x22')](_0x3d86c6);}return _0x520018[_0x1a18('0x23')]();};}function saveUpdates(_0x4d36ca,_0x2f17f6){return function(_0x2007ee){if(_0x2007ee){return _0x2007ee[_0x1a18('0x24')](_0x4d36ca)[_0x1a18('0x25')](function(_0xca4ae9){return _0xca4ae9;});}return null;};}function removeEntity(_0xb4a0b8,_0x3fc2c5){return function(_0x2ac2d7){if(_0x2ac2d7){return _0x2ac2d7[_0x1a18('0x26')]()[_0x1a18('0x25')](function(){_0xb4a0b8[_0x1a18('0x1a')](0xcc)[_0x1a18('0x19')]();});}};}function handleEntityNotFound(_0x5ea7b0,_0x8cebc6){return function(_0x33cef2){if(!_0x33cef2){_0x5ea7b0[_0x1a18('0x18')](0x194);}return _0x33cef2;};}function handleError(_0x397539,_0x3953dd){_0x3953dd=_0x3953dd||0x1f4;return function(_0x1a1d9b){logger['error'](_0x1a1d9b[_0x1a18('0x27')]);if(_0x1a1d9b[_0x1a18('0x28')]){delete _0x1a1d9b[_0x1a18('0x28')];}_0x397539[_0x1a18('0x1a')](_0x3953dd)['send'](_0x1a1d9b);};}exports[_0x1a18('0x29')]=function(_0x4699ab,_0x299277){var _0x17776b={},_0x14c983={},_0x855cca={'count':0x0,'rows':[]};var _0x464a44=_[_0x1a18('0x2a')](db[_0x1a18('0x2b')][_0x1a18('0x2c')],function(_0x3b566e){return{'name':_0x3b566e[_0x1a18('0x2d')],'type':_0x3b566e[_0x1a18('0x2e')][_0x1a18('0x2f')]};});_0x14c983[_0x1a18('0x30')]=_['map'](_0x464a44,_0x1a18('0x28'));_0x14c983['query']=_[_0x1a18('0x31')](_0x4699ab[_0x1a18('0x32')]);_0x14c983['filters']=_['intersection'](_0x14c983['model'],_0x14c983[_0x1a18('0x32')]);_0x17776b[_0x1a18('0x33')]=_[_0x1a18('0x34')](_0x14c983[_0x1a18('0x30')],qs[_0x1a18('0x35')](_0x4699ab[_0x1a18('0x32')][_0x1a18('0x35')]));_0x17776b[_0x1a18('0x33')]=_0x17776b[_0x1a18('0x33')][_0x1a18('0x36')]?_0x17776b['attributes']:_0x14c983['model'];if(!_0x4699ab[_0x1a18('0x32')][_0x1a18('0x37')](_0x1a18('0x38'))){_0x17776b[_0x1a18('0x39')]=qs[_0x1a18('0x39')](_0x4699ab['query']['limit']);_0x17776b[_0x1a18('0x1e')]=qs[_0x1a18('0x1e')](_0x4699ab[_0x1a18('0x32')][_0x1a18('0x1e')]);}_0x17776b['order']=qs[_0x1a18('0x3a')](_0x4699ab[_0x1a18('0x32')]['sort']);_0x17776b[_0x1a18('0x3b')]=qs['filters'](_[_0x1a18('0x3c')](_0x4699ab[_0x1a18('0x32')],_0x14c983[_0x1a18('0x3d')]),_0x464a44);if(_0x4699ab[_0x1a18('0x32')][_0x1a18('0x3e')]){_0x17776b[_0x1a18('0x3b')]=_[_0x1a18('0x3f')](_0x17776b[_0x1a18('0x3b')],{'$or':_[_0x1a18('0x2a')](_0x464a44,function(_0x40836f){if(_0x40836f[_0x1a18('0x2e')]!==_0x1a18('0x40')){var _0x1d8360={};_0x1d8360[_0x40836f[_0x1a18('0x28')]]={'$like':'%'+_0x4699ab[_0x1a18('0x32')]['filter']+'%'};return _0x1d8360;}})});}_0x17776b=_['merge']({},_0x17776b,_0x4699ab['options']);var _0x85acf0={'where':_0x17776b[_0x1a18('0x3b')]};return db['AnalyticFieldReport']['count'](_0x85acf0)[_0x1a18('0x25')](function(_0xf015b4){_0x855cca[_0x1a18('0x1d')]=_0xf015b4;if(_0x4699ab['query'][_0x1a18('0x41')]){_0x17776b[_0x1a18('0x42')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x1a18('0x43')](_0x17776b);})['then'](function(_0x31431d){_0x855cca[_0x1a18('0x44')]=_0x31431d;return _0x855cca;})[_0x1a18('0x25')](respondWithFilteredResult(_0x299277,_0x17776b))[_0x1a18('0x45')](handleError(_0x299277,null));};exports[_0x1a18('0x46')]=function(_0x3d127b,_0x30b397){var _0x50fb4e={'raw':![],'where':{'id':_0x3d127b[_0x1a18('0x47')]['id']}},_0x15c0d7={};_0x15c0d7[_0x1a18('0x30')]=_[_0x1a18('0x31')](db[_0x1a18('0x2b')][_0x1a18('0x2c')]);_0x15c0d7['query']=_[_0x1a18('0x31')](_0x3d127b['query']);_0x15c0d7[_0x1a18('0x3d')]=_['intersection'](_0x15c0d7[_0x1a18('0x30')],_0x15c0d7[_0x1a18('0x32')]);_0x50fb4e[_0x1a18('0x33')]=_[_0x1a18('0x34')](_0x15c0d7[_0x1a18('0x30')],qs['fields'](_0x3d127b[_0x1a18('0x32')][_0x1a18('0x35')]));_0x50fb4e[_0x1a18('0x33')]=_0x50fb4e['attributes'][_0x1a18('0x36')]?_0x50fb4e[_0x1a18('0x33')]:_0x15c0d7[_0x1a18('0x30')];if(_0x3d127b[_0x1a18('0x32')]['includeAll']){_0x50fb4e['include']=[{'all':!![]}];}_0x50fb4e=_['merge']({},_0x50fb4e,_0x3d127b['options']);return db[_0x1a18('0x2b')][_0x1a18('0x48')](_0x50fb4e)[_0x1a18('0x25')](handleEntityNotFound(_0x30b397,null))[_0x1a18('0x25')](respondWithResult(_0x30b397,null))[_0x1a18('0x45')](handleError(_0x30b397,null));};exports[_0x1a18('0x49')]=function(_0x377711,_0x45ea4b){return db[_0x1a18('0x2b')][_0x1a18('0x49')](_0x377711[_0x1a18('0x4a')],{})[_0x1a18('0x25')](respondWithResult(_0x45ea4b,0xc9))[_0x1a18('0x45')](handleError(_0x45ea4b,null));};exports[_0x1a18('0x4b')]=function(_0x340660,_0x5434e8){return db[_0x1a18('0x2b')][_0x1a18('0x4b')](_0x340660[_0x1a18('0x4a')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5434e8,0xc9))[_0x1a18('0x45')](handleError(_0x5434e8,null));};exports['update']=function(_0x15e848,_0x46bdc5){if(_0x15e848[_0x1a18('0x4a')]['id']){delete _0x15e848[_0x1a18('0x4a')]['id'];}return db[_0x1a18('0x2b')][_0x1a18('0x48')]({'where':{'id':_0x15e848[_0x1a18('0x47')]['id']}})['then'](handleEntityNotFound(_0x46bdc5,null))[_0x1a18('0x25')](saveUpdates(_0x15e848[_0x1a18('0x4a')],null))[_0x1a18('0x25')](respondWithResult(_0x46bdc5,null))['catch'](handleError(_0x46bdc5,null));};exports[_0x1a18('0x26')]=function(_0x100830,_0x322487){return db['AnalyticFieldReport'][_0x1a18('0x48')]({'where':{'id':_0x100830[_0x1a18('0x47')]['id']}})[_0x1a18('0x25')](handleEntityNotFound(_0x322487,null))[_0x1a18('0x25')](removeEntity(_0x322487,null))['catch'](handleError(_0x322487,null));};exports[_0x1a18('0x4c')]=function(_0x35e321,_0x4127e7){return db[_0x1a18('0x2b')]['destroy']({'where':{'id':_0x35e321[_0x1a18('0x32')][_0x1a18('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4127e7,0xcc))[_0x1a18('0x45')](handleError(_0x4127e7,null));};exports['addFields']=function(_0x48642c,_0x3998ac,_0xe42272){return db[_0x1a18('0x4e')]['findOne']({'where':{'id':_0x48642c[_0x1a18('0x47')]['id']}})[_0x1a18('0x25')](handleEntityNotFound(_0x3998ac,null))['then'](function(_0x37aeba){if(_0x37aeba){return db[_0x1a18('0x4f')][_0x1a18('0x50')](function(_0x5e961d){return db[_0x1a18('0x2b')][_0x1a18('0x26')]({'where':{'CustomReportId':_0x48642c[_0x1a18('0x47')]['id']},'transaction':_0x5e961d})['then'](function(_0x323716){var _0x4303cf=_[_0x1a18('0x2a')](_0x48642c[_0x1a18('0x4a')],function(_0x3bfa4c){delete _0x3bfa4c['id'];_0x3bfa4c[_0x1a18('0x51')]=_0x48642c['params']['id'];return _0x3bfa4c;});return db['AnalyticFieldReport']['bulkCreate'](_0x4303cf,{'transaction':_0x5e961d});});})[_0x1a18('0x25')](function(){return db['AnalyticFieldReport'][_0x1a18('0x43')]({'where':{'CustomReportId':_0x48642c['params']['id']}});});}})[_0x1a18('0x25')](respondWithResult(_0x3998ac,null))[_0x1a18('0x45')](handleError(_0x3998ac,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3b63340..fee67f7 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 _0xd0b0=['api','moment','rimraf','exports','AnalyticFieldReport','lodash','util','../../config/logger'];(function(_0x5225fe,_0x24e219){var _0x4a7d03=function(_0x3c042b){while(--_0x3c042b){_0x5225fe['push'](_0x5225fe['shift']());}};_0x4a7d03(++_0x24e219);}(_0xd0b0,0x9d));var _0x0d0b=function(_0x2babef,_0x275118){_0x2babef=_0x2babef-0x0;var _0x2274f6=_0xd0b0[_0x2babef];return _0x2274f6;};'use strict';var _=require(_0x0d0b('0x0'));var util=require(_0x0d0b('0x1'));var logger=require(_0x0d0b('0x2'))(_0x0d0b('0x3'));var moment=require(_0x0d0b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d0b('0x5'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x0d0b('0x6')]=function(_0x1cffb8,_0x46b38f){return _0x1cffb8['define'](_0x0d0b('0x7'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd472=['AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd472,0x77));var _0x2d47=function(_0x32b591,_0x83d4fe){_0x32b591=_0x32b591-0x0;var _0x1603f1=_0xd472[_0x32b591];return _0x1603f1;};'use strict';var _=require(_0x2d47('0x0'));var util=require('util');var logger=require(_0x2d47('0x1'))(_0x2d47('0x2'));var moment=require(_0x2d47('0x3'));var BPromise=require(_0x2d47('0x4'));var rp=require(_0x2d47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d47('0x6'));var config=require(_0x2d47('0x7'));var attributes=require(_0x2d47('0x8'));module[_0x2d47('0x9')]=function(_0x4c1c85,_0x5c08a8){return _0x4c1c85[_0x2d47('0xa')](_0x2d47('0xb'),attributes,{'tableName':_0x2d47('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 16caa96..bcc8798 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 _0x4373=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring'];(function(_0x4162b9,_0x4f83c3){var _0x99666b=function(_0x349604){while(--_0x349604){_0x4162b9['push'](_0x4162b9['shift']());}};_0x99666b(++_0x4f83c3);}(_0x4373,0xa5));var _0x3437=function(_0x26341a,_0xc9659d){_0x26341a=_0x26341a-0x0;var _0x56fa8c=_0x4373[_0x26341a];return _0x56fa8c;};'use strict';var _=require(_0x3437('0x0'));var util=require('util');var moment=require(_0x3437('0x1'));var BPromise=require('bluebird');var rs=require(_0x3437('0x2'));var fs=require('fs');var Redis=require(_0x3437('0x3'));var db=require(_0x3437('0x4'))['db'];var utils=require(_0x3437('0x5'));var logger=require(_0x3437('0x6'))(_0x3437('0x7'));var config=require(_0x3437('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3437('0x9')][_0x3437('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36588f,_0x36b915,_0x4b470c){return new BPromise(function(_0x491de3,_0x48ded1){return client['request'](_0x36588f,_0x4b470c)['then'](function(_0x3ef318){logger[_0x3437('0xb')](_0x3437('0xc'),_0x36b915,_0x3437('0xd'));logger[_0x3437('0xe')](_0x3437('0xf'),_0x36b915,_0x3437('0xd'),JSON[_0x3437('0x10')](_0x3ef318));if(_0x3ef318[_0x3437('0x11')]){if(_0x3ef318[_0x3437('0x11')][_0x3437('0x12')]===0x1f4){logger[_0x3437('0x11')](_0x3437('0xc'),_0x36b915,_0x3ef318[_0x3437('0x11')]['message']);return _0x48ded1(_0x3ef318[_0x3437('0x11')][_0x3437('0x13')]);}logger[_0x3437('0x11')](_0x3437('0xc'),_0x36b915,_0x3ef318['error'][_0x3437('0x13')]);return _0x491de3(_0x3ef318[_0x3437('0x11')]['message']);}else{logger[_0x3437('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x36b915,_0x3437('0xd'));_0x491de3(_0x3ef318['result'][_0x3437('0x13')]);}})[_0x3437('0x14')](function(_0x44bbfe){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x36b915,_0x44bbfe);_0x48ded1(_0x44bbfe);});});} \ No newline at end of file +var _0x11d2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3e78f4,_0x39412d){var _0x41ae6f=function(_0x32ad74){while(--_0x32ad74){_0x3e78f4['push'](_0x3e78f4['shift']());}};_0x41ae6f(++_0x39412d);}(_0x11d2,0x13d));var _0x211d=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x11d2[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x211d('0x0'));var util=require(_0x211d('0x1'));var moment=require(_0x211d('0x2'));var BPromise=require(_0x211d('0x3'));var rs=require(_0x211d('0x4'));var fs=require('fs');var Redis=require(_0x211d('0x5'));var db=require(_0x211d('0x6'))['db'];var utils=require(_0x211d('0x7'));var logger=require(_0x211d('0x8'))(_0x211d('0x9'));var config=require(_0x211d('0xa'));var jayson=require(_0x211d('0xb'));var client=jayson[_0x211d('0xc')][_0x211d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x51fdbd,_0x56ce0b,_0x23eb9f){return new BPromise(function(_0x46e85f,_0x144bfd){return client[_0x211d('0xe')](_0x51fdbd,_0x23eb9f)['then'](function(_0x4ae9d8){logger[_0x211d('0xf')](_0x211d('0x10'),_0x56ce0b,'request\x20sent');logger[_0x211d('0x11')](_0x211d('0x12'),_0x56ce0b,_0x211d('0x13'),JSON[_0x211d('0x14')](_0x4ae9d8));if(_0x4ae9d8['error']){if(_0x4ae9d8[_0x211d('0x15')][_0x211d('0x16')]===0x1f4){logger[_0x211d('0x15')](_0x211d('0x10'),_0x56ce0b,_0x4ae9d8[_0x211d('0x15')]['message']);return _0x144bfd(_0x4ae9d8[_0x211d('0x15')][_0x211d('0x17')]);}logger[_0x211d('0x15')](_0x211d('0x10'),_0x56ce0b,_0x4ae9d8[_0x211d('0x15')][_0x211d('0x17')]);return _0x46e85f(_0x4ae9d8[_0x211d('0x15')][_0x211d('0x17')]);}else{logger[_0x211d('0xf')](_0x211d('0x10'),_0x56ce0b,_0x211d('0x13'));_0x46e85f(_0x4ae9d8[_0x211d('0x18')]['message']);}})['catch'](function(_0x5baa24){logger[_0x211d('0x15')](_0x211d('0x10'),_0x56ce0b,_0x5baa24);_0x144bfd(_0x5baa24);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ab4e5fa..77cdd32 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(_0x5bbc16,_0x23de90){var _0x561b20=function(_0x5d6036){while(--_0x5d6036){_0x5bbc16['push'](_0x5bbc16['shift']());}};_0x561b20(++_0x23de90);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x22005d,_0x579a64){var _0x175b8e=function(_0x318fc4){while(--_0x318fc4){_0x22005d['push'](_0x22005d['shift']());}};_0x175b8e(++_0x579a64);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 fe8565b..d8252e9 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 _0x477a=['name','TEXT','sequelize','STRING'];(function(_0x2db2db,_0x5cabdf){var _0x4c8811=function(_0x2de564){while(--_0x2de564){_0x2db2db['push'](_0x2db2db['shift']());}};_0x4c8811(++_0x5cabdf);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa477('0x0'));module['exports']={'name':{'type':Sequelize[_0xa477('0x1')],'allowNull':![],'unique':_0xa477('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xa477('0x3')]},'description':{'type':Sequelize[_0xa477('0x1')]}}; \ No newline at end of file +var _0x9a86=['name','STRING','TEXT','sequelize','exports'];(function(_0x356758,_0x28d328){var _0x44610b=function(_0x105469){while(--_0x105469){_0x356758['push'](_0x356758['shift']());}};_0x44610b(++_0x28d328);}(_0x9a86,0x1ed));var _0x69a8=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x9a86[_0x3932eb];return _0x5316e5;};'use strict';var Sequelize=require(_0x69a8('0x0'));module[_0x69a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x69a8('0x2')},'table':{'type':Sequelize[_0x69a8('0x3')]},'metric':{'type':Sequelize[_0x69a8('0x4')]},'description':{'type':Sequelize[_0x69a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a30619d..4bc7c66 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 _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x28fd2e,_0x312107){var _0x4c6eb9=function(_0xb3f18a){while(--_0xb3f18a){_0x28fd2e['push'](_0x28fd2e['shift']());}};_0x4c6eb9(++_0x312107);}(_0x7217,0x19e));var _0x7721=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x7217[_0x9df060];return _0x338dfe;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file +var _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x7da7,0x10d));var _0x77da=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x7da7[_0x3b150c];return _0x5cd414;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b99b411..db7d346 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 _0x2086=['./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1d2adf,_0x8b056f){var _0x431bd7=function(_0x2785a7){while(--_0x2785a7){_0x1d2adf['push'](_0x1d2adf['shift']());}};_0x431bd7(++_0x8b056f);}(_0x2086,0x124));var _0x6208=function(_0x2bfedd,_0x44883f){_0x2bfedd=_0x2bfedd-0x0;var _0x293cd2=_0x2086[_0x2bfedd];return _0x293cd2;};'use strict';var _=require(_0x6208('0x0'));var util=require(_0x6208('0x1'));var logger=require(_0x6208('0x2'))(_0x6208('0x3'));var moment=require(_0x6208('0x4'));var BPromise=require(_0x6208('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6208('0x6'));var rimraf=require(_0x6208('0x7'));var config=require('../../config/environment');var attributes=require(_0x6208('0x8'));module[_0x6208('0x9')]=function(_0x38bc4d,_0xb3cf2a){return _0x38bc4d[_0x6208('0xa')]('AnalyticMetric',attributes,{'tableName':_0x6208('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','analytics_metrics','lodash'];(function(_0x53e3fa,_0xbcabb5){var _0xcb3861=function(_0x1d1196){while(--_0x1d1196){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xcb3861(++_0xbcabb5);}(_0x7da7,0x10d));var _0x77da=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x7da7[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('AnalyticMetric',attributes,{'tableName':_0x77da('0x9'),'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 2df813f..f2b6a20 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 _0xb224=['error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5ae154,_0x448e92){var _0x2650f5=function(_0x3d11fb){while(--_0x3d11fb){_0x5ae154['push'](_0x5ae154['shift']());}};_0x2650f5(++_0x448e92);}(_0xb224,0x193));var _0x4b22=function(_0x5adcb0,_0x11ecb8){_0x5adcb0=_0x5adcb0-0x0;var _0x90afed=_0xb224[_0x5adcb0];return _0x90afed;};'use strict';var _=require(_0x4b22('0x0'));var util=require(_0x4b22('0x1'));var moment=require('moment');var BPromise=require(_0x4b22('0x2'));var rs=require(_0x4b22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b22('0x4'))['db'];var utils=require(_0x4b22('0x5'));var logger=require(_0x4b22('0x6'))(_0x4b22('0x7'));var config=require('../../config/environment');var jayson=require(_0x4b22('0x8'));var client=jayson[_0x4b22('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a2c20,_0x5b10c2,_0x3df714){return new BPromise(function(_0x3c1ddb,_0x5c853a){return client[_0x4b22('0xa')](_0x4a2c20,_0x3df714)[_0x4b22('0xb')](function(_0x28cef8){logger[_0x4b22('0xc')](_0x4b22('0xd'),_0x5b10c2,'request\x20sent');logger['debug'](_0x4b22('0xe'),_0x5b10c2,_0x4b22('0xf'),JSON[_0x4b22('0x10')](_0x28cef8));if(_0x28cef8[_0x4b22('0x11')]){if(_0x28cef8[_0x4b22('0x11')][_0x4b22('0x12')]===0x1f4){logger[_0x4b22('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x5b10c2,_0x28cef8['error'][_0x4b22('0x13')]);return _0x5c853a(_0x28cef8[_0x4b22('0x11')][_0x4b22('0x13')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x5b10c2,_0x28cef8[_0x4b22('0x11')]['message']);return _0x3c1ddb(_0x28cef8[_0x4b22('0x11')][_0x4b22('0x13')]);}else{logger['info'](_0x4b22('0xd'),_0x5b10c2,_0x4b22('0xf'));_0x3c1ddb(_0x28cef8['result'][_0x4b22('0x13')]);}})[_0x4b22('0x14')](function(_0x53d52c){logger[_0x4b22('0x11')](_0x4b22('0xd'),_0x5b10c2,_0x53d52c);_0x5c853a(_0x53d52c);});});} \ No newline at end of file +var _0x3c91=['request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0x3c91,0xcc));var _0x13c9=function(_0x473c42,_0x286677){_0x473c42=_0x473c42-0x0;var _0x252886=_0x3c91[_0x473c42];return _0x252886;};'use strict';var _=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var moment=require(_0x13c9('0x2'));var BPromise=require(_0x13c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c9('0x4'));var db=require(_0x13c9('0x5'))['db'];var utils=require(_0x13c9('0x6'));var logger=require(_0x13c9('0x7'))(_0x13c9('0x8'));var config=require('../../config/environment');var jayson=require(_0x13c9('0x9'));var client=jayson[_0x13c9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25b9fd,_0x1d2715,_0x2613b3){return new BPromise(function(_0x1f5c57,_0x2b5c25){return client[_0x13c9('0xb')](_0x25b9fd,_0x2613b3)[_0x13c9('0xc')](function(_0x4d0c97){logger['info'](_0x13c9('0xd'),_0x1d2715,'request\x20sent');logger[_0x13c9('0xe')](_0x13c9('0xf'),_0x1d2715,_0x13c9('0x10'),JSON['stringify'](_0x4d0c97));if(_0x4d0c97[_0x13c9('0x11')]){if(_0x4d0c97[_0x13c9('0x11')][_0x13c9('0x12')]===0x1f4){logger[_0x13c9('0x11')](_0x13c9('0xd'),_0x1d2715,_0x4d0c97[_0x13c9('0x11')]['message']);return _0x2b5c25(_0x4d0c97['error']['message']);}logger['error'](_0x13c9('0xd'),_0x1d2715,_0x4d0c97[_0x13c9('0x11')][_0x13c9('0x13')]);return _0x1f5c57(_0x4d0c97[_0x13c9('0x11')][_0x13c9('0x13')]);}else{logger['info'](_0x13c9('0xd'),_0x1d2715,'request\x20sent');_0x1f5c57(_0x4d0c97[_0x13c9('0x14')][_0x13c9('0x13')]);}})[_0x13c9('0x15')](function(_0x5e7d46){logger[_0x13c9('0x11')](_0x13c9('0xd'),_0x1d2715,_0x5e7d46);_0x2b5c25(_0x5e7d46);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a5bba8c..6feccc8 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 _0x4350=['multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','isAuthenticated','put','/:id','update','destroy','exports'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x4350,0x1d0));var _0x0435=function(_0x4567dd,_0x2c7fc2){_0x4567dd=_0x4567dd-0x0;var _0x3e9cdc=_0x4350[_0x4567dd];return _0x3e9cdc;};'use strict';var multer=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var path=require('path');var timeout=require(_0x0435('0x2'));var express=require('express');var router=express[_0x0435('0x3')]();var fs_extra=require(_0x0435('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0435('0x5'));var config=require(_0x0435('0x6'));var controller=require(_0x0435('0x7'));router[_0x0435('0x8')]('/',auth['isAuthenticated'](),controller[_0x0435('0x9')]);router['get']('/:id',auth[_0x0435('0xa')](),controller['show']);router['post']('/',auth[_0x0435('0xa')](),controller['create']);router[_0x0435('0xb')](_0x0435('0xc'),auth['isAuthenticated'](),controller[_0x0435('0xd')]);router['delete'](_0x0435('0xc'),auth[_0x0435('0xa')](),controller[_0x0435('0xe')]);module[_0x0435('0xf')]=router; \ No newline at end of file +var _0xb1a3=['get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x597e39,_0x26f975){var _0x2cfc99=function(_0x5b40a2){while(--_0x5b40a2){_0x597e39['push'](_0x597e39['shift']());}};_0x2cfc99(++_0x26f975);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0xb1a3[_0x1034ca];return _0x1a023a;};'use strict';var multer=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var path=require(_0x3b1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b1a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b1a('0x4'));var interaction=require(_0x3b1a('0x5'));var config=require(_0x3b1a('0x6'));var controller=require(_0x3b1a('0x7'));router[_0x3b1a('0x8')]('/',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xa')]);router['get'](_0x3b1a('0xb'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xc')]);router[_0x3b1a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b1a('0xe')](_0x3b1a('0xb'),auth['isAuthenticated'](),controller[_0x3b1a('0xf')]);router['delete'](_0x3b1a('0xb'),auth['isAuthenticated'](),controller[_0x3b1a('0x10')]);module[_0x3b1a('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ef74bb3..f105c81 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 _0x3015=['sequelize','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3015,0x132));var _0x5301=function(_0xe5c823,_0x51cc2e){_0xe5c823=_0xe5c823-0x0;var _0x4a04e2=_0x3015[_0xe5c823];return _0x4a04e2;};'use strict';var Sequelize=require(_0x5301('0x0'));module['exports']={'tree':{'type':Sequelize[_0x5301('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8e45=['TEXT'];(function(_0x31fcb1,_0x45f216){var _0x2ea7e6=function(_0x3977e0){while(--_0x3977e0){_0x31fcb1['push'](_0x31fcb1['shift']());}};_0x2ea7e6(++_0x45f216);}(_0x8e45,0x1f2));var _0x58e4=function(_0x45218a,_0xbd1113){_0x45218a=_0x45218a-0x0;var _0x14027a=_0x8e45[_0x45218a];return _0x14027a;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x58e4('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 adb4968..cb709d3 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 _0xe3d8=['map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe3d8,0xff));var _0x8e3d=function(_0x3cad6d,_0x112027){_0x3cad6d=_0x3cad6d-0x0;var _0x5b86fb=_0xe3d8[_0x3cad6d];return _0x5b86fb;};'use strict';var emlformat=require(_0x8e3d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e3d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e3d('0x2'));var moment=require(_0x8e3d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8e3d('0x4'));var util=require('util');var path=require(_0x8e3d('0x5'));var sox=require(_0x8e3d('0x6'));var csv=require('to-csv');var ejs=require(_0x8e3d('0x7'));var fs=require('fs');var fs_extra=require(_0x8e3d('0x8'));var _=require(_0x8e3d('0x9'));var squel=require(_0x8e3d('0xa'));var crypto=require(_0x8e3d('0xb'));var jsforce=require(_0x8e3d('0xc'));var deskjs=require(_0x8e3d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8e3d('0xe'));var Papa=require(_0x8e3d('0xf'));var Redis=require(_0x8e3d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8e3d('0x11'));var as=require(_0x8e3d('0x12'));var hardwareService=require(_0x8e3d('0x13'));var logger=require(_0x8e3d('0x14'))(_0x8e3d('0x15'));var utils=require('../../config/utils');var config=require(_0x8e3d('0x16'));var licenseUtil=require(_0x8e3d('0x17'));var db=require(_0x8e3d('0x18'))['db'];function respondWithStatusCode(_0x265204,_0x321e85){_0x321e85=_0x321e85||0xcc;return function(_0x374a80){if(_0x374a80){return _0x265204[_0x8e3d('0x19')](_0x321e85);}return _0x265204['status'](_0x321e85)[_0x8e3d('0x1a')]();};}function respondWithResult(_0xa421b0,_0x3b172e){_0x3b172e=_0x3b172e||0xc8;return function(_0x353508){if(_0x353508){return _0xa421b0[_0x8e3d('0x1b')](_0x3b172e)[_0x8e3d('0x1c')](_0x353508);}};}function respondWithFilteredResult(_0x5c7338,_0x10ab77){return function(_0x7f00ce){if(_0x7f00ce){var _0xba28bb=typeof _0x10ab77[_0x8e3d('0x1d')]==='undefined'&&typeof _0x10ab77[_0x8e3d('0x1e')]===_0x8e3d('0x1f');var _0x8339d9=_0x7f00ce[_0x8e3d('0x20')];var _0x5a2856=_0xba28bb?0x0:_0x10ab77[_0x8e3d('0x1d')];var _0x108b0b=_0xba28bb?_0x7f00ce[_0x8e3d('0x20')]:_0x10ab77[_0x8e3d('0x1d')]+_0x10ab77[_0x8e3d('0x1e')];var _0x1933a0;if(_0x108b0b>=_0x8339d9){_0x108b0b=_0x8339d9;_0x1933a0=0xc8;}else{_0x1933a0=0xce;}_0x5c7338[_0x8e3d('0x1b')](_0x1933a0);return _0x5c7338[_0x8e3d('0x21')]('Content-Range',_0x5a2856+'-'+_0x108b0b+'/'+_0x8339d9)['json'](_0x7f00ce);}return null;};}function patchUpdates(_0x268c06){return function(_0x3df482){try{jsonpatch[_0x8e3d('0x22')](_0x3df482,_0x268c06,!![]);}catch(_0x458d4c){return BPromise[_0x8e3d('0x23')](_0x458d4c);}return _0x3df482[_0x8e3d('0x24')]();};}function saveUpdates(_0x17b100,_0x20610d){return function(_0xf90d06){if(_0xf90d06){return _0xf90d06[_0x8e3d('0x25')](_0x17b100)[_0x8e3d('0x26')](function(_0x561f76){return _0x561f76;});}return null;};}function removeEntity(_0x3190f5,_0x2c52d2){return function(_0x3545fd){if(_0x3545fd){return _0x3545fd[_0x8e3d('0x27')]()[_0x8e3d('0x26')](function(){_0x3190f5[_0x8e3d('0x1b')](0xcc)[_0x8e3d('0x1a')]();});}};}function handleEntityNotFound(_0x15d07e,_0x1bd85c){return function(_0x5b30bc){if(!_0x5b30bc){_0x15d07e['sendStatus'](0x194);}return _0x5b30bc;};}function handleError(_0x1c0cdc,_0x5c7868){_0x5c7868=_0x5c7868||0x1f4;return function(_0x11f821){logger[_0x8e3d('0x28')](_0x11f821[_0x8e3d('0x29')]);if(_0x11f821[_0x8e3d('0x2a')]){delete _0x11f821[_0x8e3d('0x2a')];}_0x1c0cdc[_0x8e3d('0x1b')](_0x5c7868)[_0x8e3d('0x2b')](_0x11f821);};}exports[_0x8e3d('0x2c')]=function(_0x342f16,_0xb4cfe4){var _0x18ebdc={},_0x17db8b={},_0x209cc1={'count':0x0,'rows':[]};var _0x57ef5d=_[_0x8e3d('0x2d')](db[_0x8e3d('0x2e')][_0x8e3d('0x2f')],function(_0x14cb79){return{'name':_0x14cb79[_0x8e3d('0x30')],'type':_0x14cb79[_0x8e3d('0x31')][_0x8e3d('0x32')]};});_0x17db8b[_0x8e3d('0x33')]=_[_0x8e3d('0x2d')](_0x57ef5d,_0x8e3d('0x2a'));_0x17db8b['query']=_[_0x8e3d('0x34')](_0x342f16['query']);_0x17db8b['filters']=_['intersection'](_0x17db8b[_0x8e3d('0x33')],_0x17db8b[_0x8e3d('0x35')]);_0x18ebdc[_0x8e3d('0x36')]=_[_0x8e3d('0x37')](_0x17db8b[_0x8e3d('0x33')],qs[_0x8e3d('0x38')](_0x342f16[_0x8e3d('0x35')]['fields']));_0x18ebdc[_0x8e3d('0x36')]=_0x18ebdc[_0x8e3d('0x36')][_0x8e3d('0x39')]?_0x18ebdc[_0x8e3d('0x36')]:_0x17db8b['model'];if(!_0x342f16[_0x8e3d('0x35')][_0x8e3d('0x3a')](_0x8e3d('0x3b'))){_0x18ebdc['limit']=qs[_0x8e3d('0x1e')](_0x342f16[_0x8e3d('0x35')]['limit']);_0x18ebdc[_0x8e3d('0x1d')]=qs[_0x8e3d('0x1d')](_0x342f16[_0x8e3d('0x35')][_0x8e3d('0x1d')]);}_0x18ebdc[_0x8e3d('0x3c')]=qs[_0x8e3d('0x3d')](_0x342f16[_0x8e3d('0x35')]['sort']);_0x18ebdc[_0x8e3d('0x3e')]=qs[_0x8e3d('0x3f')](_['pick'](_0x342f16[_0x8e3d('0x35')],_0x17db8b['filters']),_0x57ef5d);if(_0x342f16['query'][_0x8e3d('0x40')]){_0x18ebdc['where']=_[_0x8e3d('0x41')](_0x18ebdc[_0x8e3d('0x3e')],{'$or':_[_0x8e3d('0x2d')](_0x57ef5d,function(_0x113e2f){if(_0x113e2f['type']!==_0x8e3d('0x42')){var _0x1f6985={};_0x1f6985[_0x113e2f[_0x8e3d('0x2a')]]={'$like':'%'+_0x342f16[_0x8e3d('0x35')][_0x8e3d('0x40')]+'%'};return _0x1f6985;}})});}_0x18ebdc=_[_0x8e3d('0x41')]({},_0x18ebdc,_0x342f16[_0x8e3d('0x43')]);var _0x5e1edc={'where':_0x18ebdc[_0x8e3d('0x3e')]};return db[_0x8e3d('0x2e')]['count'](_0x5e1edc)[_0x8e3d('0x26')](function(_0x4c6e35){_0x209cc1[_0x8e3d('0x20')]=_0x4c6e35;if(_0x342f16[_0x8e3d('0x35')][_0x8e3d('0x44')]){_0x18ebdc[_0x8e3d('0x45')]=[{'all':!![]}];}return db[_0x8e3d('0x2e')]['findAll'](_0x18ebdc);})[_0x8e3d('0x26')](function(_0x271d9d){_0x209cc1['rows']=_0x271d9d;return _0x209cc1;})[_0x8e3d('0x26')](respondWithFilteredResult(_0xb4cfe4,_0x18ebdc))[_0x8e3d('0x46')](handleError(_0xb4cfe4,null));};exports['show']=function(_0x102de0,_0x10d5b9){var _0x3cfb77={'raw':!![],'where':{'id':_0x102de0[_0x8e3d('0x47')]['id']}},_0x16b81d={};_0x16b81d[_0x8e3d('0x33')]=_[_0x8e3d('0x34')](db['AnalyticTreeReport']['rawAttributes']);_0x16b81d[_0x8e3d('0x35')]=_[_0x8e3d('0x34')](_0x102de0['query']);_0x16b81d[_0x8e3d('0x3f')]=_['intersection'](_0x16b81d[_0x8e3d('0x33')],_0x16b81d['query']);_0x3cfb77[_0x8e3d('0x36')]=_['intersection'](_0x16b81d[_0x8e3d('0x33')],qs[_0x8e3d('0x38')](_0x102de0[_0x8e3d('0x35')][_0x8e3d('0x38')]));_0x3cfb77[_0x8e3d('0x36')]=_0x3cfb77[_0x8e3d('0x36')]['length']?_0x3cfb77[_0x8e3d('0x36')]:_0x16b81d[_0x8e3d('0x33')];if(_0x102de0[_0x8e3d('0x35')][_0x8e3d('0x44')]){_0x3cfb77[_0x8e3d('0x45')]=[{'all':!![]}];}_0x3cfb77=_[_0x8e3d('0x41')]({},_0x3cfb77,_0x102de0[_0x8e3d('0x43')]);return db[_0x8e3d('0x2e')][_0x8e3d('0x48')](_0x3cfb77)[_0x8e3d('0x26')](handleEntityNotFound(_0x10d5b9,null))[_0x8e3d('0x26')](respondWithResult(_0x10d5b9,null))[_0x8e3d('0x46')](handleError(_0x10d5b9,null));};exports[_0x8e3d('0x49')]=function(_0x42f19e,_0x8a0cac){return db[_0x8e3d('0x2e')][_0x8e3d('0x49')](_0x42f19e[_0x8e3d('0x4a')],{})[_0x8e3d('0x26')](respondWithResult(_0x8a0cac,0xc9))[_0x8e3d('0x46')](handleError(_0x8a0cac,null));};exports['update']=function(_0xbd3825,_0x410737){if(_0xbd3825[_0x8e3d('0x4a')]['id']){delete _0xbd3825[_0x8e3d('0x4a')]['id'];}return db[_0x8e3d('0x2e')][_0x8e3d('0x48')]({'where':{'id':_0xbd3825[_0x8e3d('0x47')]['id']}})['then'](handleEntityNotFound(_0x410737,null))[_0x8e3d('0x26')](saveUpdates(_0xbd3825['body'],null))[_0x8e3d('0x26')](respondWithResult(_0x410737,null))[_0x8e3d('0x46')](handleError(_0x410737,null));};exports[_0x8e3d('0x27')]=function(_0x374d37,_0x3e58df){return db[_0x8e3d('0x2e')][_0x8e3d('0x48')]({'where':{'id':_0x374d37[_0x8e3d('0x47')]['id']}})[_0x8e3d('0x26')](handleEntityNotFound(_0x3e58df,null))['then'](removeEntity(_0x3e58df,null))[_0x8e3d('0x46')](handleError(_0x3e58df,null));}; \ No newline at end of file +var _0x39a8=['ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','destroy','error','name','send','index','AnalyticTreeReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x35a76f,_0x158af7){var _0x184f62=function(_0xedbd82){while(--_0xedbd82){_0x35a76f['push'](_0x35a76f['shift']());}};_0x184f62(++_0x158af7);}(_0x39a8,0xdc));var _0x839a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39a8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x839a('0x0'));var zipdir=require(_0x839a('0x1'));var jsonpatch=require(_0x839a('0x2'));var rp=require(_0x839a('0x3'));var moment=require(_0x839a('0x4'));var BPromise=require(_0x839a('0x5'));var Mustache=require(_0x839a('0x6'));var util=require(_0x839a('0x7'));var path=require(_0x839a('0x8'));var sox=require(_0x839a('0x9'));var csv=require(_0x839a('0xa'));var ejs=require(_0x839a('0xb'));var fs=require('fs');var fs_extra=require(_0x839a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x839a('0xd'));var jsforce=require(_0x839a('0xe'));var deskjs=require(_0x839a('0xf'));var toCsv=require(_0x839a('0xa'));var querystring=require(_0x839a('0x10'));var Papa=require(_0x839a('0x11'));var Redis=require(_0x839a('0x12'));var authService=require(_0x839a('0x13'));var qs=require(_0x839a('0x14'));var as=require(_0x839a('0x15'));var hardwareService=require(_0x839a('0x16'));var logger=require(_0x839a('0x17'))(_0x839a('0x18'));var utils=require(_0x839a('0x19'));var config=require(_0x839a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x839a('0x1b'))['db'];function respondWithStatusCode(_0x140f0f,_0x392698){_0x392698=_0x392698||0xcc;return function(_0x138c35){if(_0x138c35){return _0x140f0f[_0x839a('0x1c')](_0x392698);}return _0x140f0f[_0x839a('0x1d')](_0x392698)[_0x839a('0x1e')]();};}function respondWithResult(_0x162209,_0x400aaf){_0x400aaf=_0x400aaf||0xc8;return function(_0x39cef6){if(_0x39cef6){return _0x162209[_0x839a('0x1d')](_0x400aaf)['json'](_0x39cef6);}};}function respondWithFilteredResult(_0x19e7ce,_0x59ba5e){return function(_0xb27002){if(_0xb27002){var _0x17b08b=typeof _0x59ba5e[_0x839a('0x1f')]==='undefined'&&typeof _0x59ba5e[_0x839a('0x20')]===_0x839a('0x21');var _0x14d6aa=_0xb27002['count'];var _0x4e663c=_0x17b08b?0x0:_0x59ba5e[_0x839a('0x1f')];var _0x26ed42=_0x17b08b?_0xb27002[_0x839a('0x22')]:_0x59ba5e[_0x839a('0x1f')]+_0x59ba5e[_0x839a('0x20')];var _0x569966;if(_0x26ed42>=_0x14d6aa){_0x26ed42=_0x14d6aa;_0x569966=0xc8;}else{_0x569966=0xce;}_0x19e7ce[_0x839a('0x1d')](_0x569966);return _0x19e7ce[_0x839a('0x23')](_0x839a('0x24'),_0x4e663c+'-'+_0x26ed42+'/'+_0x14d6aa)[_0x839a('0x25')](_0xb27002);}return null;};}function patchUpdates(_0x4b8ba9){return function(_0xe0e950){try{jsonpatch['apply'](_0xe0e950,_0x4b8ba9,!![]);}catch(_0x3a2839){return BPromise[_0x839a('0x26')](_0x3a2839);}return _0xe0e950['save']();};}function saveUpdates(_0x530a53,_0x579d27){return function(_0x57333b){if(_0x57333b){return _0x57333b[_0x839a('0x27')](_0x530a53)[_0x839a('0x28')](function(_0x2e272e){return _0x2e272e;});}return null;};}function removeEntity(_0x95b44b,_0x369f72){return function(_0x5a819f){if(_0x5a819f){return _0x5a819f[_0x839a('0x29')]()[_0x839a('0x28')](function(){_0x95b44b[_0x839a('0x1d')](0xcc)[_0x839a('0x1e')]();});}};}function handleEntityNotFound(_0x3b2e9e,_0x9fc3af){return function(_0x3d5cd8){if(!_0x3d5cd8){_0x3b2e9e[_0x839a('0x1c')](0x194);}return _0x3d5cd8;};}function handleError(_0x3feec1,_0x1d99eb){_0x1d99eb=_0x1d99eb||0x1f4;return function(_0x2d4207){logger[_0x839a('0x2a')](_0x2d4207['stack']);if(_0x2d4207[_0x839a('0x2b')]){delete _0x2d4207[_0x839a('0x2b')];}_0x3feec1[_0x839a('0x1d')](_0x1d99eb)[_0x839a('0x2c')](_0x2d4207);};}exports[_0x839a('0x2d')]=function(_0x275d20,_0x55846d){var _0x16df8c={},_0x5f3928={},_0x2bc7f0={'count':0x0,'rows':[]};var _0x12a68e=_['map'](db[_0x839a('0x2e')]['rawAttributes'],function(_0x43320f){return{'name':_0x43320f[_0x839a('0x2f')],'type':_0x43320f['type'][_0x839a('0x30')]};});_0x5f3928[_0x839a('0x31')]=_['map'](_0x12a68e,_0x839a('0x2b'));_0x5f3928[_0x839a('0x32')]=_[_0x839a('0x33')](_0x275d20[_0x839a('0x32')]);_0x5f3928[_0x839a('0x34')]=_['intersection'](_0x5f3928['model'],_0x5f3928['query']);_0x16df8c[_0x839a('0x35')]=_[_0x839a('0x36')](_0x5f3928['model'],qs[_0x839a('0x37')](_0x275d20[_0x839a('0x32')][_0x839a('0x37')]));_0x16df8c[_0x839a('0x35')]=_0x16df8c[_0x839a('0x35')][_0x839a('0x38')]?_0x16df8c[_0x839a('0x35')]:_0x5f3928[_0x839a('0x31')];if(!_0x275d20[_0x839a('0x32')][_0x839a('0x39')](_0x839a('0x3a'))){_0x16df8c['limit']=qs[_0x839a('0x20')](_0x275d20['query'][_0x839a('0x20')]);_0x16df8c['offset']=qs['offset'](_0x275d20[_0x839a('0x32')]['offset']);}_0x16df8c[_0x839a('0x3b')]=qs[_0x839a('0x3c')](_0x275d20[_0x839a('0x32')]['sort']);_0x16df8c[_0x839a('0x3d')]=qs['filters'](_['pick'](_0x275d20[_0x839a('0x32')],_0x5f3928[_0x839a('0x34')]),_0x12a68e);if(_0x275d20[_0x839a('0x32')][_0x839a('0x3e')]){_0x16df8c[_0x839a('0x3d')]=_[_0x839a('0x3f')](_0x16df8c[_0x839a('0x3d')],{'$or':_[_0x839a('0x40')](_0x12a68e,function(_0x583681){if(_0x583681[_0x839a('0x41')]!=='VIRTUAL'){var _0x4fbc63={};_0x4fbc63[_0x583681[_0x839a('0x2b')]]={'$like':'%'+_0x275d20['query']['filter']+'%'};return _0x4fbc63;}})});}_0x16df8c=_[_0x839a('0x3f')]({},_0x16df8c,_0x275d20['options']);var _0x4b14d5={'where':_0x16df8c['where']};return db['AnalyticTreeReport'][_0x839a('0x22')](_0x4b14d5)['then'](function(_0x2a15d0){_0x2bc7f0[_0x839a('0x22')]=_0x2a15d0;if(_0x275d20[_0x839a('0x32')][_0x839a('0x42')]){_0x16df8c[_0x839a('0x43')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x839a('0x44')](_0x16df8c);})[_0x839a('0x28')](function(_0x1b5735){_0x2bc7f0[_0x839a('0x45')]=_0x1b5735;return _0x2bc7f0;})[_0x839a('0x28')](respondWithFilteredResult(_0x55846d,_0x16df8c))[_0x839a('0x46')](handleError(_0x55846d,null));};exports[_0x839a('0x47')]=function(_0x35d98d,_0x26f539){var _0x2aca05={'raw':!![],'where':{'id':_0x35d98d['params']['id']}},_0x5949f8={};_0x5949f8[_0x839a('0x31')]=_['keys'](db[_0x839a('0x2e')][_0x839a('0x48')]);_0x5949f8[_0x839a('0x32')]=_[_0x839a('0x33')](_0x35d98d['query']);_0x5949f8[_0x839a('0x34')]=_['intersection'](_0x5949f8[_0x839a('0x31')],_0x5949f8[_0x839a('0x32')]);_0x2aca05['attributes']=_[_0x839a('0x36')](_0x5949f8[_0x839a('0x31')],qs[_0x839a('0x37')](_0x35d98d[_0x839a('0x32')][_0x839a('0x37')]));_0x2aca05['attributes']=_0x2aca05[_0x839a('0x35')][_0x839a('0x38')]?_0x2aca05[_0x839a('0x35')]:_0x5949f8[_0x839a('0x31')];if(_0x35d98d[_0x839a('0x32')][_0x839a('0x42')]){_0x2aca05[_0x839a('0x43')]=[{'all':!![]}];}_0x2aca05=_[_0x839a('0x3f')]({},_0x2aca05,_0x35d98d['options']);return db[_0x839a('0x2e')][_0x839a('0x49')](_0x2aca05)['then'](handleEntityNotFound(_0x26f539,null))[_0x839a('0x28')](respondWithResult(_0x26f539,null))[_0x839a('0x46')](handleError(_0x26f539,null));};exports[_0x839a('0x4a')]=function(_0x3d6602,_0xa9a62){return db[_0x839a('0x2e')]['create'](_0x3d6602[_0x839a('0x4b')],{})[_0x839a('0x28')](respondWithResult(_0xa9a62,0xc9))[_0x839a('0x46')](handleError(_0xa9a62,null));};exports[_0x839a('0x27')]=function(_0x178b45,_0x1f54dc){if(_0x178b45['body']['id']){delete _0x178b45[_0x839a('0x4b')]['id'];}return db[_0x839a('0x2e')][_0x839a('0x49')]({'where':{'id':_0x178b45[_0x839a('0x4c')]['id']}})[_0x839a('0x28')](handleEntityNotFound(_0x1f54dc,null))[_0x839a('0x28')](saveUpdates(_0x178b45['body'],null))[_0x839a('0x28')](respondWithResult(_0x1f54dc,null))[_0x839a('0x46')](handleError(_0x1f54dc,null));};exports['destroy']=function(_0x34c7ae,_0x307c38){return db[_0x839a('0x2e')][_0x839a('0x49')]({'where':{'id':_0x34c7ae[_0x839a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x307c38,null))[_0x839a('0x28')](removeEntity(_0x307c38,null))[_0x839a('0x46')](handleError(_0x307c38,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 602ad29..79f799b 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 _0x4386=['AnalyticTreeReport','analytics_report_trees','util','api','moment','bluebird','path','rimraf','./analyticTreeReport.attributes','exports','define'];(function(_0x11abf9,_0x1ff7e5){var _0x547878=function(_0x2ac98c){while(--_0x2ac98c){_0x11abf9['push'](_0x11abf9['shift']());}};_0x547878(++_0x1ff7e5);}(_0x4386,0x141));var _0x6438=function(_0x515232,_0x3de920){_0x515232=_0x515232-0x0;var _0x45685c=_0x4386[_0x515232];return _0x45685c;};'use strict';var _=require('lodash');var util=require(_0x6438('0x0'));var logger=require('../../config/logger')(_0x6438('0x1'));var moment=require(_0x6438('0x2'));var BPromise=require(_0x6438('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6438('0x4'));var rimraf=require(_0x6438('0x5'));var config=require('../../config/environment');var attributes=require(_0x6438('0x6'));module[_0x6438('0x7')]=function(_0x531071,_0x3888fe){return _0x531071[_0x6438('0x8')](_0x6438('0x9'),attributes,{'tableName':_0x6438('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe78f=['moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','analytics_report_trees','../../config/logger','api'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xe78f,0x1d2));var _0xfe78=function(_0xf1955f,_0x4b4cdc){_0xf1955f=_0xf1955f-0x0;var _0x185220=_0xe78f[_0xf1955f];return _0x185220;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe78('0x0'))(_0xfe78('0x1'));var moment=require(_0xfe78('0x2'));var BPromise=require('bluebird');var rp=require(_0xfe78('0x3'));var fs=require('fs');var path=require(_0xfe78('0x4'));var rimraf=require(_0xfe78('0x5'));var config=require(_0xfe78('0x6'));var attributes=require(_0xfe78('0x7'));module['exports']=function(_0x24294d,_0x5714ea){return _0x24294d['define']('AnalyticTreeReport',attributes,{'tableName':_0xfe78('0x8'),'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 3aeef4f..d7da79e 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2880f8,_0x1edc7e){var _0x2cedc0=function(_0x17dd17){while(--_0x17dd17){_0x2880f8['push'](_0x2880f8['shift']());}};_0x2cedc0(++_0x1edc7e);}(_0x1261,0x144));var _0x1126=function(_0x458e33,_0x4f8045){_0x458e33=_0x458e33-0x0;var _0x5109b0=_0x1261[_0x458e33];return _0x5109b0;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x52bd88,_0x52def0){var _0x40c088=function(_0x38036f){while(--_0x38036f){_0x52bd88['push'](_0x52bd88['shift']());}};_0x40c088(++_0x52def0);}(_0xdb28,0x106));var _0x8db2=function(_0x4b7ea5,_0x5b1ffe){_0x4b7ea5=_0x4b7ea5-0x0;var _0x5c744a=_0xdb28[_0x4b7ea5];return _0x5c744a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a7db003..385428b 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 _0xeaa9=['express','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','create','delete','destroy','exports','multer','util'];(function(_0x46cd48,_0xc91635){var _0x25258a=function(_0x249b14){while(--_0x249b14){_0x46cd48['push'](_0x46cd48['shift']());}};_0x25258a(++_0xc91635);}(_0xeaa9,0x19e));var _0x9eaa=function(_0x1fd601,_0x5cfcff){_0x1fd601=_0x1fd601-0x0;var _0x450d9c=_0xeaa9[_0x1fd601];return _0x450d9c;};'use strict';var multer=require(_0x9eaa('0x0'));var util=require(_0x9eaa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9eaa('0x2'));var router=express['Router']();var fs_extra=require(_0x9eaa('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9eaa('0x4'));var config=require(_0x9eaa('0x5'));var controller=require(_0x9eaa('0x6'));router['get']('/',auth[_0x9eaa('0x7')](),controller[_0x9eaa('0x8')]);router[_0x9eaa('0x9')](_0x9eaa('0xa'),auth[_0x9eaa('0x7')](),controller[_0x9eaa('0xb')]);router['post']('/',auth[_0x9eaa('0x7')](),controller[_0x9eaa('0xc')]);router['put'](_0x9eaa('0xa'),auth[_0x9eaa('0x7')](),controller['update']);router[_0x9eaa('0xd')](_0x9eaa('0xa'),auth[_0x9eaa('0x7')](),controller[_0x9eaa('0xe')]);module[_0x9eaa('0xf')]=router; \ No newline at end of file +var _0xaf49=['../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','path','Router','fs-extra','../../components/auth/service'];(function(_0x1b886e,_0x320e47){var _0x5280ea=function(_0x3cccce){while(--_0x3cccce){_0x1b886e['push'](_0x1b886e['shift']());}};_0x5280ea(++_0x320e47);}(_0xaf49,0xfb));var _0x9af4=function(_0x162d05,_0x22cc23){_0x162d05=_0x162d05-0x0;var _0x45c72d=_0xaf49[_0x162d05];return _0x45c72d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9af4('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9af4('0x1')]();var fs_extra=require(_0x9af4('0x2'));var auth=require(_0x9af4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9af4('0x4'));var controller=require('./analyticTreeReport.controller');router[_0x9af4('0x5')]('/',auth[_0x9af4('0x6')](),controller[_0x9af4('0x7')]);router[_0x9af4('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x9af4('0x8')]);router[_0x9af4('0x9')]('/',auth['isAuthenticated'](),controller[_0x9af4('0xa')]);router[_0x9af4('0xb')]('/:id',auth[_0x9af4('0x6')](),controller[_0x9af4('0xc')]);router[_0x9af4('0xd')](_0x9af4('0xe'),auth['isAuthenticated'](),controller[_0x9af4('0xf')]);module[_0x9af4('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1ac5971..97349d6 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 _0xe5d5=['STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xe5d5,0x156));var _0x5e5d=function(_0x480ea9,_0x36c5db){_0x480ea9=_0x480ea9-0x0;var _0x9c7327=_0xe5d5[_0x480ea9];return _0x9c7327;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5e5d('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5e5d('0x0')]}}; \ No newline at end of file +var _0x67a2=['STRING','sequelize','exports'];(function(_0xa74d82,_0x545983){var _0xc5d5ec=function(_0x10aed8){while(--_0x10aed8){_0xa74d82['push'](_0xa74d82['shift']());}};_0xc5d5ec(++_0x545983);}(_0x67a2,0xd3));var _0x267a=function(_0x1d1e50,_0x4ceaad){_0x1d1e50=_0x1d1e50-0x0;var _0xc4f0d0=_0x67a2[_0x1d1e50];return _0xc4f0d0;};'use strict';var Sequelize=require(_0x267a('0x0'));module[_0x267a('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x267a('0x2')]},'type':{'type':Sequelize[_0x267a('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index dfa044a..d700c48 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 _0x879a=['bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','Attachment','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','rawAttributes','clone','updatedAt','omit','body','createdAt','create','find','file','originalname','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x50a19b,_0x80c4d0){var _0x19b42d=function(_0x15a23f){while(--_0x15a23f){_0x50a19b['push'](_0x50a19b['shift']());}};_0x19b42d(++_0x80c4d0);}(_0x879a,0x103));var _0xa879=function(_0x452a75,_0x4bbff3){_0x452a75=_0x452a75-0x0;var _0x3d9d7e=_0x879a[_0x452a75];return _0x3d9d7e;};'use strict';var emlformat=require(_0xa879('0x0'));var rimraf=require(_0xa879('0x1'));var zipdir=require(_0xa879('0x2'));var jsonpatch=require(_0xa879('0x3'));var rp=require(_0xa879('0x4'));var moment=require('moment');var BPromise=require(_0xa879('0x5'));var Mustache=require(_0xa879('0x6'));var util=require('util');var path=require(_0xa879('0x7'));var sox=require(_0xa879('0x8'));var csv=require(_0xa879('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa879('0xa'));var _=require(_0xa879('0xb'));var squel=require(_0xa879('0xc'));var crypto=require('crypto');var jsforce=require(_0xa879('0xd'));var deskjs=require(_0xa879('0xe'));var toCsv=require(_0xa879('0x9'));var querystring=require(_0xa879('0xf'));var Papa=require(_0xa879('0x10'));var Redis=require(_0xa879('0x11'));var authService=require(_0xa879('0x12'));var qs=require(_0xa879('0x13'));var as=require(_0xa879('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa879('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa879('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa879('0x17'))['db'];function respondWithStatusCode(_0x42faf2,_0x1bcfca){_0x1bcfca=_0x1bcfca||0xcc;return function(_0x6f9755){if(_0x6f9755){return _0x42faf2['sendStatus'](_0x1bcfca);}return _0x42faf2[_0xa879('0x18')](_0x1bcfca)['end']();};}function respondWithResult(_0xdf133c,_0x590ad2){_0x590ad2=_0x590ad2||0xc8;return function(_0x4a27f6){if(_0x4a27f6){return _0xdf133c[_0xa879('0x18')](_0x590ad2)[_0xa879('0x19')](_0x4a27f6);}};}function respondWithFilteredResult(_0x1c5b83,_0xbb8546){return function(_0x7e8385){if(_0x7e8385){var _0x370523=typeof _0xbb8546['offset']==='undefined'&&typeof _0xbb8546[_0xa879('0x1a')]===_0xa879('0x1b');var _0x36f3ac=_0x7e8385[_0xa879('0x1c')];var _0x158f9e=_0x370523?0x0:_0xbb8546[_0xa879('0x1d')];var _0xf73e59=_0x370523?_0x7e8385['count']:_0xbb8546[_0xa879('0x1d')]+_0xbb8546[_0xa879('0x1a')];var _0x336480;if(_0xf73e59>=_0x36f3ac){_0xf73e59=_0x36f3ac;_0x336480=0xc8;}else{_0x336480=0xce;}_0x1c5b83[_0xa879('0x18')](_0x336480);return _0x1c5b83[_0xa879('0x1e')](_0xa879('0x1f'),_0x158f9e+'-'+_0xf73e59+'/'+_0x36f3ac)[_0xa879('0x19')](_0x7e8385);}return null;};}function patchUpdates(_0x43cf70){return function(_0x11a745){try{jsonpatch['apply'](_0x11a745,_0x43cf70,!![]);}catch(_0x28f102){return BPromise[_0xa879('0x20')](_0x28f102);}return _0x11a745[_0xa879('0x21')]();};}function saveUpdates(_0x3c813b,_0x5f2f36){return function(_0x2bc614){if(_0x2bc614){return _0x2bc614[_0xa879('0x22')](_0x3c813b)[_0xa879('0x23')](function(_0x4b0ad6){return _0x4b0ad6;});}return null;};}function removeEntity(_0x3db5e2,_0x15511a){return function(_0x594c8b){if(_0x594c8b){return _0x594c8b[_0xa879('0x24')]()[_0xa879('0x23')](function(){_0x3db5e2['status'](0xcc)[_0xa879('0x25')]();});}};}function handleEntityNotFound(_0x16d1f0,_0x338838){return function(_0x23bd90){if(!_0x23bd90){_0x16d1f0[_0xa879('0x26')](0x194);}return _0x23bd90;};}function handleError(_0xa419e,_0xc4f62d){_0xc4f62d=_0xc4f62d||0x1f4;return function(_0x36873b){logger[_0xa879('0x27')](_0x36873b['stack']);if(_0x36873b['name']){delete _0x36873b[_0xa879('0x28')];}_0xa419e['status'](_0xc4f62d)[_0xa879('0x29')](_0x36873b);};}exports[_0xa879('0x2a')]=function(_0x5a2341,_0x2f897e){var _0x5bfe13={},_0x1c7ab3={},_0x1172c4={'count':0x0,'rows':[]};var _0x5bc4cb=_[_0xa879('0x2b')](db[_0xa879('0x2c')]['rawAttributes'],function(_0x48da0a){return{'name':_0x48da0a[_0xa879('0x2d')],'type':_0x48da0a[_0xa879('0x2e')][_0xa879('0x2f')]};});_0x1c7ab3[_0xa879('0x30')]=_['map'](_0x5bc4cb,_0xa879('0x28'));_0x1c7ab3[_0xa879('0x31')]=_[_0xa879('0x32')](_0x5a2341[_0xa879('0x31')]);_0x1c7ab3['filters']=_[_0xa879('0x33')](_0x1c7ab3[_0xa879('0x30')],_0x1c7ab3[_0xa879('0x31')]);_0x5bfe13[_0xa879('0x34')]=_['intersection'](_0x1c7ab3[_0xa879('0x30')],qs[_0xa879('0x35')](_0x5a2341[_0xa879('0x31')][_0xa879('0x35')]));_0x5bfe13[_0xa879('0x34')]=_0x5bfe13[_0xa879('0x34')][_0xa879('0x36')]?_0x5bfe13['attributes']:_0x1c7ab3[_0xa879('0x30')];if(!_0x5a2341[_0xa879('0x31')]['hasOwnProperty'](_0xa879('0x37'))){_0x5bfe13['limit']=qs[_0xa879('0x1a')](_0x5a2341[_0xa879('0x31')][_0xa879('0x1a')]);_0x5bfe13['offset']=qs[_0xa879('0x1d')](_0x5a2341[_0xa879('0x31')][_0xa879('0x1d')]);}_0x5bfe13['order']=qs[_0xa879('0x38')](_0x5a2341[_0xa879('0x31')][_0xa879('0x38')]);_0x5bfe13[_0xa879('0x39')]=qs[_0xa879('0x3a')](_[_0xa879('0x3b')](_0x5a2341[_0xa879('0x31')],_0x1c7ab3[_0xa879('0x3a')]),_0x5bc4cb);if(_0x5a2341[_0xa879('0x31')][_0xa879('0x3c')]){_0x5bfe13[_0xa879('0x39')]=_['merge'](_0x5bfe13['where'],{'$or':_[_0xa879('0x2b')](_0x5bc4cb,function(_0xe49d74){if(_0xe49d74['type']!==_0xa879('0x3d')){var _0x43647f={};_0x43647f[_0xe49d74['name']]={'$like':'%'+_0x5a2341['query']['filter']+'%'};return _0x43647f;}})});}_0x5bfe13=_[_0xa879('0x3e')]({},_0x5bfe13,_0x5a2341[_0xa879('0x3f')]);var _0x5ab6eb={'where':_0x5bfe13[_0xa879('0x39')]};return db[_0xa879('0x2c')][_0xa879('0x1c')](_0x5ab6eb)[_0xa879('0x23')](function(_0x100e41){_0x1172c4[_0xa879('0x1c')]=_0x100e41;if(_0x5a2341['query'][_0xa879('0x40')]){_0x5bfe13[_0xa879('0x41')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x5bfe13);})[_0xa879('0x23')](function(_0x5f58b6){_0x1172c4['rows']=_0x5f58b6;return _0x1172c4;})['then'](respondWithFilteredResult(_0x2f897e,_0x5bfe13))[_0xa879('0x42')](handleError(_0x2f897e,null));};exports[_0xa879('0x43')]=function(_0x394814,_0x3a572f){var _0x1bac5b={'raw':!![],'where':{'id':_0x394814[_0xa879('0x44')]['id']}},_0x515a0d={};_0x515a0d[_0xa879('0x30')]=_[_0xa879('0x32')](db['Attachment'][_0xa879('0x45')]);_0x515a0d[_0xa879('0x31')]=_[_0xa879('0x32')](_0x394814[_0xa879('0x31')]);_0x515a0d['filters']=_['intersection'](_0x515a0d[_0xa879('0x30')],_0x515a0d[_0xa879('0x31')]);_0x1bac5b['attributes']=_[_0xa879('0x33')](_0x515a0d[_0xa879('0x30')],qs[_0xa879('0x35')](_0x394814[_0xa879('0x31')][_0xa879('0x35')]));_0x1bac5b[_0xa879('0x34')]=_0x1bac5b['attributes'][_0xa879('0x36')]?_0x1bac5b[_0xa879('0x34')]:_0x515a0d['model'];if(_0x394814[_0xa879('0x31')]['includeAll']){_0x1bac5b[_0xa879('0x41')]=[{'all':!![]}];}_0x1bac5b=_[_0xa879('0x3e')]({},_0x1bac5b,_0x394814['options']);return db[_0xa879('0x2c')]['find'](_0x1bac5b)[_0xa879('0x23')](handleEntityNotFound(_0x3a572f,null))[_0xa879('0x23')](respondWithResult(_0x3a572f,null))[_0xa879('0x42')](handleError(_0x3a572f,null));};exports[_0xa879('0x46')]=function(_0x5416c0,_0x1c676d){var _0x519b09={'where':{'id':_0x5416c0[_0xa879('0x44')]['id']}},_0x367ffc={};_0x367ffc[_0xa879('0x30')]=_[_0xa879('0x32')](db['Attachment'][_0xa879('0x45')]);_0x519b09[_0xa879('0x34')]=_[_0xa879('0x33')](_0x367ffc[_0xa879('0x30')],qs[_0xa879('0x35')](_0x5416c0[_0xa879('0x31')][_0xa879('0x35')]));_0x519b09[_0xa879('0x34')]=_0x519b09[_0xa879('0x34')][_0xa879('0x36')]?_0x519b09[_0xa879('0x34')]:_0x367ffc[_0xa879('0x30')];if(_0x5416c0[_0xa879('0x31')][_0xa879('0x40')]){_0x519b09[_0xa879('0x41')]=[{'all':!![]}];}_0x519b09=_[_0xa879('0x3e')]({},_0x519b09,_0x5416c0[_0xa879('0x3f')]);return db[_0xa879('0x2c')]['find'](_0x519b09)[_0xa879('0x23')](handleEntityNotFound(_0x1c676d,null))['then'](function(_0x169944){if(_0x169944){var _0x2da688=_0x169944['get']({'plain':!![]});_0x2da688=qs['omit'](_0x2da688,['id','createdAt',_0xa879('0x47')]);_0x5416c0['body']=_[_0xa879('0x48')](_0x5416c0[_0xa879('0x49')],['id',_0xa879('0x4a'),'updatedAt']);return db[_0xa879('0x2c')][_0xa879('0x4b')](_[_0xa879('0x3e')](_0x2da688,_0x5416c0[_0xa879('0x49')]),{'include':_0x5416c0['query'][_0xa879('0x40')]?[{'all':!![]}]:undefined});}})[_0xa879('0x23')](respondWithResult(_0x1c676d,0xc9))[_0xa879('0x42')](handleError(_0x1c676d,null));};exports['update']=function(_0x4ccec5,_0x48b2e8){if(_0x4ccec5['body']['id']){delete _0x4ccec5[_0xa879('0x49')]['id'];}return db[_0xa879('0x2c')][_0xa879('0x4c')]({'where':{'id':_0x4ccec5[_0xa879('0x44')]['id']}})[_0xa879('0x23')](handleEntityNotFound(_0x48b2e8,null))['then'](saveUpdates(_0x4ccec5[_0xa879('0x49')],null))[_0xa879('0x23')](respondWithResult(_0x48b2e8,null))['catch'](handleError(_0x48b2e8,null));};exports[_0xa879('0x24')]=function(_0x3d3972,_0x4cb284){return db[_0xa879('0x2c')][_0xa879('0x4c')]({'where':{'id':_0x3d3972['params']['id']}})[_0xa879('0x23')](handleEntityNotFound(_0x4cb284,null))['then'](removeEntity(_0x4cb284,null))['catch'](handleError(_0x4cb284,null));};exports[_0xa879('0x4b')]=function(_0x5b62a8,_0x51c737,_0x36ac0c){_0x5b62a8[_0xa879('0x49')][_0xa879('0x28')]=_0x5b62a8[_0xa879('0x4d')][_0xa879('0x4e')];_0x5b62a8[_0xa879('0x49')][_0xa879('0x4f')]=_0x5b62a8[_0xa879('0x4d')][_0xa879('0x50')];_0x5b62a8[_0xa879('0x49')][_0xa879('0x2e')]=_0x5b62a8[_0xa879('0x4d')][_0xa879('0x51')];return db[_0xa879('0x2c')][_0xa879('0x4b')](_0x5b62a8[_0xa879('0x49')])[_0xa879('0x23')](respondWithResult(_0x51c737,0xc9))[_0xa879('0x42')](handleError(_0x51c737,null));};exports[_0xa879('0x52')]=function(_0x4aee7c,_0x5b03e1,_0x492765){return db[_0xa879('0x2c')][_0xa879('0x53')]({'where':{'id':_0x4aee7c['params']['id']},'raw':!![]})[_0xa879('0x23')](handleEntityNotFound(_0x5b03e1,null))[_0xa879('0x23')](function(_0x3e1d33){if(_0x3e1d33){var _0x26ec16=_0x3e1d33['ChatOfflineMessageId']!==null;var _0xc14fb9=path[_0xa879('0x54')](config[_0xa879('0x55')],_0xa879('0x56'));if(_0x26ec16){_0xc14fb9=path[_0xa879('0x54')](_0xc14fb9,_0xa879('0x57'));}var _0x1560c4=path['join'](_0xc14fb9,_0x3e1d33['basename']);return _0x5b03e1[_0xa879('0x52')](_0x1560c4);}})[_0xa879('0x42')](handleError(_0x5b03e1,null));}; \ No newline at end of file +var _0x07c4=['count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Attachment','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','rawAttributes','find','clone','length','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit'];(function(_0x55f6d7,_0x5bd984){var _0x2153cc=function(_0x11ff8b){while(--_0x11ff8b){_0x55f6d7['push'](_0x55f6d7['shift']());}};_0x2153cc(++_0x5bd984);}(_0x07c4,0xee));var _0x407c=function(_0x3ebc22,_0x23c72c){_0x3ebc22=_0x3ebc22-0x0;var _0xb676b7=_0x07c4[_0x3ebc22];return _0xb676b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x407c('0x0'));var rp=require(_0x407c('0x1'));var moment=require(_0x407c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x407c('0x3'));var util=require(_0x407c('0x4'));var path=require(_0x407c('0x5'));var sox=require(_0x407c('0x6'));var csv=require('to-csv');var ejs=require(_0x407c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x407c('0x8'));var squel=require(_0x407c('0x9'));var crypto=require(_0x407c('0xa'));var jsforce=require(_0x407c('0xb'));var deskjs=require(_0x407c('0xc'));var toCsv=require(_0x407c('0xd'));var querystring=require(_0x407c('0xe'));var Papa=require(_0x407c('0xf'));var Redis=require(_0x407c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x407c('0x11'));var hardwareService=require(_0x407c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x407c('0x13'));var config=require(_0x407c('0x14'));var licenseUtil=require(_0x407c('0x15'));var db=require(_0x407c('0x16'))['db'];function respondWithStatusCode(_0x107c9f,_0x3c5dcf){_0x3c5dcf=_0x3c5dcf||0xcc;return function(_0x5248e6){if(_0x5248e6){return _0x107c9f['sendStatus'](_0x3c5dcf);}return _0x107c9f[_0x407c('0x17')](_0x3c5dcf)['end']();};}function respondWithResult(_0x27c194,_0x480244){_0x480244=_0x480244||0xc8;return function(_0x488b47){if(_0x488b47){return _0x27c194[_0x407c('0x17')](_0x480244)['json'](_0x488b47);}};}function respondWithFilteredResult(_0x3e2db7,_0x298f9e){return function(_0x4988a7){if(_0x4988a7){var _0x5f2924=typeof _0x298f9e[_0x407c('0x18')]==='undefined'&&typeof _0x298f9e[_0x407c('0x19')]==='undefined';var _0xa74f67=_0x4988a7[_0x407c('0x1a')];var _0x308275=_0x5f2924?0x0:_0x298f9e[_0x407c('0x18')];var _0x166bc5=_0x5f2924?_0x4988a7[_0x407c('0x1a')]:_0x298f9e[_0x407c('0x18')]+_0x298f9e['limit'];var _0x3beafe;if(_0x166bc5>=_0xa74f67){_0x166bc5=_0xa74f67;_0x3beafe=0xc8;}else{_0x3beafe=0xce;}_0x3e2db7[_0x407c('0x17')](_0x3beafe);return _0x3e2db7[_0x407c('0x1b')](_0x407c('0x1c'),_0x308275+'-'+_0x166bc5+'/'+_0xa74f67)['json'](_0x4988a7);}return null;};}function patchUpdates(_0x4c0427){return function(_0x422208){try{jsonpatch[_0x407c('0x1d')](_0x422208,_0x4c0427,!![]);}catch(_0x415242){return BPromise[_0x407c('0x1e')](_0x415242);}return _0x422208[_0x407c('0x1f')]();};}function saveUpdates(_0x108580,_0x31fb2c){return function(_0x4e28e8){if(_0x4e28e8){return _0x4e28e8[_0x407c('0x20')](_0x108580)[_0x407c('0x21')](function(_0x270af4){return _0x270af4;});}return null;};}function removeEntity(_0x212afa,_0x21a3da){return function(_0xd2fcc0){if(_0xd2fcc0){return _0xd2fcc0[_0x407c('0x22')]()[_0x407c('0x21')](function(){_0x212afa['status'](0xcc)[_0x407c('0x23')]();});}};}function handleEntityNotFound(_0x1d4f13,_0x47ca0e){return function(_0x32f515){if(!_0x32f515){_0x1d4f13[_0x407c('0x24')](0x194);}return _0x32f515;};}function handleError(_0x3fecbd,_0x33c6cf){_0x33c6cf=_0x33c6cf||0x1f4;return function(_0x20c734){logger[_0x407c('0x25')](_0x20c734[_0x407c('0x26')]);if(_0x20c734[_0x407c('0x27')]){delete _0x20c734['name'];}_0x3fecbd[_0x407c('0x17')](_0x33c6cf)[_0x407c('0x28')](_0x20c734);};}exports[_0x407c('0x29')]=function(_0x59ef01,_0x6636e4){var _0x11ad5a={},_0x1ac680={},_0x3cba0e={'count':0x0,'rows':[]};var _0x3adacf=_[_0x407c('0x2a')](db[_0x407c('0x2b')]['rawAttributes'],function(_0x33f2d2){return{'name':_0x33f2d2['fieldName'],'type':_0x33f2d2[_0x407c('0x2c')][_0x407c('0x2d')]};});_0x1ac680[_0x407c('0x2e')]=_[_0x407c('0x2a')](_0x3adacf,'name');_0x1ac680['query']=_[_0x407c('0x2f')](_0x59ef01['query']);_0x1ac680[_0x407c('0x30')]=_[_0x407c('0x31')](_0x1ac680[_0x407c('0x2e')],_0x1ac680[_0x407c('0x32')]);_0x11ad5a[_0x407c('0x33')]=_[_0x407c('0x31')](_0x1ac680[_0x407c('0x2e')],qs[_0x407c('0x34')](_0x59ef01[_0x407c('0x32')][_0x407c('0x34')]));_0x11ad5a['attributes']=_0x11ad5a[_0x407c('0x33')]['length']?_0x11ad5a[_0x407c('0x33')]:_0x1ac680[_0x407c('0x2e')];if(!_0x59ef01[_0x407c('0x32')][_0x407c('0x35')]('nolimit')){_0x11ad5a['limit']=qs['limit'](_0x59ef01[_0x407c('0x32')]['limit']);_0x11ad5a[_0x407c('0x18')]=qs['offset'](_0x59ef01['query'][_0x407c('0x18')]);}_0x11ad5a[_0x407c('0x36')]=qs[_0x407c('0x37')](_0x59ef01[_0x407c('0x32')][_0x407c('0x37')]);_0x11ad5a[_0x407c('0x38')]=qs[_0x407c('0x30')](_[_0x407c('0x39')](_0x59ef01[_0x407c('0x32')],_0x1ac680['filters']),_0x3adacf);if(_0x59ef01[_0x407c('0x32')][_0x407c('0x3a')]){_0x11ad5a[_0x407c('0x38')]=_['merge'](_0x11ad5a[_0x407c('0x38')],{'$or':_['map'](_0x3adacf,function(_0x13f8d7){if(_0x13f8d7[_0x407c('0x2c')]!=='VIRTUAL'){var _0x1bcfaf={};_0x1bcfaf[_0x13f8d7['name']]={'$like':'%'+_0x59ef01[_0x407c('0x32')]['filter']+'%'};return _0x1bcfaf;}})});}_0x11ad5a=_[_0x407c('0x3b')]({},_0x11ad5a,_0x59ef01[_0x407c('0x3c')]);var _0x4e9188={'where':_0x11ad5a[_0x407c('0x38')]};return db[_0x407c('0x2b')][_0x407c('0x1a')](_0x4e9188)[_0x407c('0x21')](function(_0x1060a3){_0x3cba0e[_0x407c('0x1a')]=_0x1060a3;if(_0x59ef01[_0x407c('0x32')][_0x407c('0x3d')]){_0x11ad5a[_0x407c('0x3e')]=[{'all':!![]}];}return db[_0x407c('0x2b')]['findAll'](_0x11ad5a);})[_0x407c('0x21')](function(_0x546475){_0x3cba0e['rows']=_0x546475;return _0x3cba0e;})[_0x407c('0x21')](respondWithFilteredResult(_0x6636e4,_0x11ad5a))[_0x407c('0x3f')](handleError(_0x6636e4,null));};exports[_0x407c('0x40')]=function(_0x155426,_0x34bf99){var _0x1ba512={'raw':!![],'where':{'id':_0x155426[_0x407c('0x41')]['id']}},_0x160501={};_0x160501['model']=_[_0x407c('0x2f')](db[_0x407c('0x2b')][_0x407c('0x42')]);_0x160501[_0x407c('0x32')]=_[_0x407c('0x2f')](_0x155426[_0x407c('0x32')]);_0x160501[_0x407c('0x30')]=_['intersection'](_0x160501[_0x407c('0x2e')],_0x160501[_0x407c('0x32')]);_0x1ba512['attributes']=_['intersection'](_0x160501[_0x407c('0x2e')],qs[_0x407c('0x34')](_0x155426[_0x407c('0x32')][_0x407c('0x34')]));_0x1ba512[_0x407c('0x33')]=_0x1ba512[_0x407c('0x33')]['length']?_0x1ba512[_0x407c('0x33')]:_0x160501[_0x407c('0x2e')];if(_0x155426[_0x407c('0x32')][_0x407c('0x3d')]){_0x1ba512[_0x407c('0x3e')]=[{'all':!![]}];}_0x1ba512=_[_0x407c('0x3b')]({},_0x1ba512,_0x155426['options']);return db[_0x407c('0x2b')][_0x407c('0x43')](_0x1ba512)[_0x407c('0x21')](handleEntityNotFound(_0x34bf99,null))[_0x407c('0x21')](respondWithResult(_0x34bf99,null))[_0x407c('0x3f')](handleError(_0x34bf99,null));};exports[_0x407c('0x44')]=function(_0x2f1666,_0x1c38e9){var _0x2a9fd0={'where':{'id':_0x2f1666['params']['id']}},_0x3d9b15={};_0x3d9b15[_0x407c('0x2e')]=_[_0x407c('0x2f')](db['Attachment'][_0x407c('0x42')]);_0x2a9fd0[_0x407c('0x33')]=_[_0x407c('0x31')](_0x3d9b15[_0x407c('0x2e')],qs[_0x407c('0x34')](_0x2f1666['query'][_0x407c('0x34')]));_0x2a9fd0[_0x407c('0x33')]=_0x2a9fd0[_0x407c('0x33')][_0x407c('0x45')]?_0x2a9fd0['attributes']:_0x3d9b15[_0x407c('0x2e')];if(_0x2f1666[_0x407c('0x32')][_0x407c('0x3d')]){_0x2a9fd0[_0x407c('0x3e')]=[{'all':!![]}];}_0x2a9fd0=_['merge']({},_0x2a9fd0,_0x2f1666[_0x407c('0x3c')]);return db[_0x407c('0x2b')][_0x407c('0x43')](_0x2a9fd0)[_0x407c('0x21')](handleEntityNotFound(_0x1c38e9,null))['then'](function(_0x4b44c8){if(_0x4b44c8){var _0x1bd66a=_0x4b44c8[_0x407c('0x46')]({'plain':!![]});_0x1bd66a=qs[_0x407c('0x47')](_0x1bd66a,['id',_0x407c('0x48'),_0x407c('0x49')]);_0x2f1666[_0x407c('0x4a')]=_['omit'](_0x2f1666[_0x407c('0x4a')],['id',_0x407c('0x48'),'updatedAt']);return db[_0x407c('0x2b')][_0x407c('0x4b')](_[_0x407c('0x3b')](_0x1bd66a,_0x2f1666[_0x407c('0x4a')]),{'include':_0x2f1666[_0x407c('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x407c('0x21')](respondWithResult(_0x1c38e9,0xc9))[_0x407c('0x3f')](handleError(_0x1c38e9,null));};exports[_0x407c('0x20')]=function(_0x474d01,_0x52f050){if(_0x474d01[_0x407c('0x4a')]['id']){delete _0x474d01['body']['id'];}return db[_0x407c('0x2b')][_0x407c('0x43')]({'where':{'id':_0x474d01['params']['id']}})[_0x407c('0x21')](handleEntityNotFound(_0x52f050,null))[_0x407c('0x21')](saveUpdates(_0x474d01['body'],null))[_0x407c('0x21')](respondWithResult(_0x52f050,null))['catch'](handleError(_0x52f050,null));};exports[_0x407c('0x22')]=function(_0x368dc6,_0x13c72){return db[_0x407c('0x2b')][_0x407c('0x43')]({'where':{'id':_0x368dc6['params']['id']}})[_0x407c('0x21')](handleEntityNotFound(_0x13c72,null))['then'](removeEntity(_0x13c72,null))[_0x407c('0x3f')](handleError(_0x13c72,null));};exports['create']=function(_0x188bf5,_0x556260,_0x4dc048){_0x188bf5[_0x407c('0x4a')][_0x407c('0x27')]=_0x188bf5[_0x407c('0x4c')][_0x407c('0x4d')];_0x188bf5[_0x407c('0x4a')][_0x407c('0x4e')]=_0x188bf5[_0x407c('0x4c')][_0x407c('0x4f')];_0x188bf5[_0x407c('0x4a')][_0x407c('0x2c')]=_0x188bf5[_0x407c('0x4c')][_0x407c('0x50')];return db[_0x407c('0x2b')][_0x407c('0x4b')](_0x188bf5[_0x407c('0x4a')])[_0x407c('0x21')](respondWithResult(_0x556260,0xc9))['catch'](handleError(_0x556260,null));};exports[_0x407c('0x51')]=function(_0x26f05e,_0x109b19,_0x4a6608){return db[_0x407c('0x2b')][_0x407c('0x52')]({'where':{'id':_0x26f05e['params']['id']},'raw':!![]})[_0x407c('0x21')](handleEntityNotFound(_0x109b19,null))[_0x407c('0x21')](function(_0x450416){if(_0x450416){var _0x339260=_0x450416[_0x407c('0x53')]!==null;var _0x5ed0b9=path[_0x407c('0x54')](config[_0x407c('0x55')],_0x407c('0x56'));if(_0x339260){_0x5ed0b9=path[_0x407c('0x54')](_0x5ed0b9,_0x407c('0x57'));}var _0x503de8=path[_0x407c('0x54')](_0x5ed0b9,_0x450416[_0x407c('0x4e')]);return _0x109b19[_0x407c('0x51')](_0x503de8);}})[_0x407c('0x3f')](handleError(_0x109b19,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 519440a..e496daa 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 _0xd114=['../../config/logger','moment','request-promise','path','rimraf','exports','attachments','lodash','util'];(function(_0x548db3,_0x9b9ee){var _0x3cc38c=function(_0x17d0e8){while(--_0x17d0e8){_0x548db3['push'](_0x548db3['shift']());}};_0x3cc38c(++_0x9b9ee);}(_0xd114,0x15d));var _0x4d11=function(_0x3be555,_0x3be8f7){_0x3be555=_0x3be555-0x0;var _0xd631ce=_0xd114[_0x3be555];return _0xd631ce;};'use strict';var _=require(_0x4d11('0x0'));var util=require(_0x4d11('0x1'));var logger=require(_0x4d11('0x2'))('api');var moment=require(_0x4d11('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d11('0x4'));var fs=require('fs');var path=require(_0x4d11('0x5'));var rimraf=require(_0x4d11('0x6'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x4d11('0x7')]=function(_0x15090f,_0x46c915){return _0x15090f['define']('Attachment',attributes,{'tableName':_0x4d11('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1189=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x257fd4,_0x446a74){var _0x3bbcba=function(_0x53549c){while(--_0x53549c){_0x257fd4['push'](_0x257fd4['shift']());}};_0x3bbcba(++_0x446a74);}(_0x1189,0x157));var _0x9118=function(_0x5dacd7,_0x4a0c65){_0x5dacd7=_0x5dacd7-0x0;var _0x566b81=_0x1189[_0x5dacd7];return _0x566b81;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var logger=require(_0x9118('0x2'))(_0x9118('0x3'));var moment=require(_0x9118('0x4'));var BPromise=require(_0x9118('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9118('0x6'));var rimraf=require(_0x9118('0x7'));var config=require(_0x9118('0x8'));var attributes=require('./attachment.attributes');module[_0x9118('0x9')]=function(_0x57e0c1,_0x59546a){return _0x57e0c1[_0x9118('0xa')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 718ee66..c95246a 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 _0x37dc=['error','code','message','catch','Attachment','create','options','raw','CreateAttachment','lodash','util','moment','bluebird','ioredis','../../config/utils','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6003d7,_0x4ecf4d){var _0x27cb94=function(_0x18bc74){while(--_0x18bc74){_0x6003d7['push'](_0x6003d7['shift']());}};_0x27cb94(++_0x4ecf4d);}(_0x37dc,0x1e9));var _0xc37d=function(_0xf60cfb,_0x3bb1f2){_0xf60cfb=_0xf60cfb-0x0;var _0x5eb02d=_0x37dc[_0xf60cfb];return _0x5eb02d;};'use strict';var _=require(_0xc37d('0x0'));var util=require(_0xc37d('0x1'));var moment=require(_0xc37d('0x2'));var BPromise=require(_0xc37d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc37d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc37d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc37d('0x6')][_0xc37d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11fe31,_0x368c3b,_0x1d6e8b){return new BPromise(function(_0x2076b3,_0x79252d){return client[_0xc37d('0x8')](_0x11fe31,_0x1d6e8b)[_0xc37d('0x9')](function(_0x5a0a61){logger[_0xc37d('0xa')](_0xc37d('0xb'),_0x368c3b,'request\x20sent');logger[_0xc37d('0xc')](_0xc37d('0xd'),_0x368c3b,'request\x20sent',JSON[_0xc37d('0xe')](_0x5a0a61));if(_0x5a0a61[_0xc37d('0xf')]){if(_0x5a0a61['error'][_0xc37d('0x10')]===0x1f4){logger[_0xc37d('0xf')](_0xc37d('0xb'),_0x368c3b,_0x5a0a61[_0xc37d('0xf')][_0xc37d('0x11')]);return _0x79252d(_0x5a0a61[_0xc37d('0xf')][_0xc37d('0x11')]);}logger[_0xc37d('0xf')](_0xc37d('0xb'),_0x368c3b,_0x5a0a61[_0xc37d('0xf')][_0xc37d('0x11')]);return _0x2076b3(_0x5a0a61[_0xc37d('0xf')]['message']);}else{logger['info'](_0xc37d('0xb'),_0x368c3b,'request\x20sent');_0x2076b3(_0x5a0a61['result'][_0xc37d('0x11')]);}})[_0xc37d('0x12')](function(_0x5b204f){logger[_0xc37d('0xf')]('Attachment,\x20%s,\x20%s',_0x368c3b,_0x5b204f);_0x79252d(_0x5b204f);});});}exports['CreateAttachment']=function(_0xcd23a5){var _0x1816f4=this;return new Promise(function(_0xfefa40,_0x36ee50){return db[_0xc37d('0x13')][_0xc37d('0x14')](_0xcd23a5['body'],{'raw':_0xcd23a5['options']?_0xcd23a5[_0xc37d('0x15')][_0xc37d('0x16')]===undefined?!![]:![]:!![]})[_0xc37d('0x9')](function(_0x526ae1){logger[_0xc37d('0xa')](_0xc37d('0x17'),_0xcd23a5);logger['debug'](_0xc37d('0x17'),_0xcd23a5,JSON['stringify'](_0x526ae1));_0xfefa40(_0x526ae1);})[_0xc37d('0x12')](function(_0x3db21b){logger[_0xc37d('0xf')](_0xc37d('0x17'),_0x3db21b[_0xc37d('0x11')],_0xcd23a5);_0x36ee50(_0x1816f4[_0xc37d('0xf')](0x1f4,_0x3db21b[_0xc37d('0x11')]));});});}; \ No newline at end of file +var _0x3299=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateAttachment','create','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd48545,_0x856e08){var _0x18094f=function(_0x528b05){while(--_0x528b05){_0xd48545['push'](_0xd48545['shift']());}};_0x18094f(++_0x856e08);}(_0x3299,0x1bc));var _0x9329=function(_0x3f906b,_0x42a1b5){_0x3f906b=_0x3f906b-0x0;var _0x5ce241=_0x3299[_0x3f906b];return _0x5ce241;};'use strict';var _=require('lodash');var util=require(_0x9329('0x0'));var moment=require(_0x9329('0x1'));var BPromise=require(_0x9329('0x2'));var rs=require(_0x9329('0x3'));var fs=require('fs');var Redis=require(_0x9329('0x4'));var db=require(_0x9329('0x5'))['db'];var utils=require(_0x9329('0x6'));var logger=require(_0x9329('0x7'))(_0x9329('0x8'));var config=require(_0x9329('0x9'));var jayson=require(_0x9329('0xa'));var client=jayson[_0x9329('0xb')][_0x9329('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14bc45,_0x1fa6c4,_0x218cf3){return new BPromise(function(_0x182d15,_0x531cf1){return client[_0x9329('0xd')](_0x14bc45,_0x218cf3)[_0x9329('0xe')](function(_0x1c1033){logger[_0x9329('0xf')](_0x9329('0x10'),_0x1fa6c4,'request\x20sent');logger[_0x9329('0x11')](_0x9329('0x12'),_0x1fa6c4,'request\x20sent',JSON['stringify'](_0x1c1033));if(_0x1c1033['error']){if(_0x1c1033[_0x9329('0x13')][_0x9329('0x14')]===0x1f4){logger[_0x9329('0x13')](_0x9329('0x10'),_0x1fa6c4,_0x1c1033[_0x9329('0x13')]['message']);return _0x531cf1(_0x1c1033[_0x9329('0x13')][_0x9329('0x15')]);}logger[_0x9329('0x13')]('Attachment,\x20%s,\x20%s',_0x1fa6c4,_0x1c1033[_0x9329('0x13')][_0x9329('0x15')]);return _0x182d15(_0x1c1033['error'][_0x9329('0x15')]);}else{logger[_0x9329('0xf')]('Attachment,\x20%s,\x20%s',_0x1fa6c4,_0x9329('0x16'));_0x182d15(_0x1c1033[_0x9329('0x17')][_0x9329('0x15')]);}})[_0x9329('0x18')](function(_0x4dfbc1){logger[_0x9329('0x13')]('Attachment,\x20%s,\x20%s',_0x1fa6c4,_0x4dfbc1);_0x531cf1(_0x4dfbc1);});});}exports[_0x9329('0x19')]=function(_0x1b5eed){var _0x57718b=this;return new Promise(function(_0x41db73,_0x26a3c2){return db['Attachment'][_0x9329('0x1a')](_0x1b5eed['body'],{'raw':_0x1b5eed[_0x9329('0x1b')]?_0x1b5eed['options'][_0x9329('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x6676d7){logger[_0x9329('0xf')](_0x9329('0x19'),_0x1b5eed);logger[_0x9329('0x11')](_0x9329('0x19'),_0x1b5eed,JSON[_0x9329('0x1d')](_0x6676d7));_0x41db73(_0x6676d7);})['catch'](function(_0x1fa600){logger[_0x9329('0x13')](_0x9329('0x19'),_0x1fa600[_0x9329('0x15')],_0x1b5eed);_0x26a3c2(_0x57718b[_0x9329('0x13')](0x1f4,_0x1fa600['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 0bb6338..6172c4b 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(_0x1a6690,_0x42c6b8){var _0x595682=function(_0x4d739c){while(--_0x4d739c){_0x1a6690['push'](_0x1a6690['shift']());}};_0x595682(++_0x42c6b8);}(_0x2032,0xd9));var _0x2203=function(_0x1bf306,_0x1fc986){_0x1bf306=_0x1bf306-0x0;var _0x572e11=_0x2032[_0x1bf306];return _0x572e11;};'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(_0x3c89bc,_0x210d5a){var _0x3dba77=function(_0x214dff){while(--_0x214dff){_0x3c89bc['push'](_0x3c89bc['shift']());}};_0x3dba77(++_0x210d5a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d8884,_0x2b6633){_0x4d8884=_0x4d8884-0x0;var _0x49300c=_0x5f2f[_0x4d8884];return _0x49300c;};'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/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d0eb30a..037826b 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 _0x4f83=['../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','clearBlockUser','getLicense','catch','Strategy','../../config/environment','../../components/auth/service','signToken'];(function(_0x9247d1,_0x567354){var _0x41b09d=function(_0x4c7b6f){while(--_0x4c7b6f){_0x9247d1['push'](_0x9247d1['shift']());}};_0x41b09d(++_0x567354);}(_0x4f83,0x65));var _0x34f8=function(_0x2225ca,_0x46ea1a){_0x2225ca=_0x2225ca-0x0;var _0x35a4c7=_0x4f83[_0x2225ca];return _0x35a4c7;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x34f8('0x0')];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0x34f8('0x1'));var signToken=require(_0x34f8('0x2'))[_0x34f8('0x3')];var utils=require(_0x34f8('0x4'));exports[_0x34f8('0x5')]=passport[_0x34f8('0x6')](_0x34f8('0x7'),{'failureRedirect':_0x34f8('0x8'),'scope':[_0x34f8('0x9'),_0x34f8('0xa')],'session':![]});exports[_0x34f8('0xb')]=passport[_0x34f8('0x6')]('google',{'failureRedirect':_0x34f8('0x8'),'session':![]});passport[_0x34f8('0xc')](new GoogleStrategy({'clientID':config[_0x34f8('0x7')]?config[_0x34f8('0x7')][_0x34f8('0xd')]:'id','clientSecret':config[_0x34f8('0x7')]?config['google']['clientSecret']:_0x34f8('0xe'),'callbackURL':config['google']?config[_0x34f8('0x7')][_0x34f8('0xf')]:''},function(_0x20f3da,_0x1668fb,_0x2313de,_0x32282b){var _0x58a091,_0x171e8a;return db[_0x34f8('0x10')][_0x34f8('0x11')]({'where':{'id':0x1},'attributes':[_0x34f8('0x12'),_0x34f8('0x13')],'raw':!![]})[_0x34f8('0x14')](function(_0x4f8330){_0x58a091=_0x4f8330;return db[_0x34f8('0x15')]['find']({'where':{'email':_[_0x34f8('0x16')](_0x2313de[_0x34f8('0x17')],_0x34f8('0x18')),'role':{'$or':[_0x34f8('0x19'),_0x34f8('0x1a'),_0x34f8('0x1b')]}}});})['then'](function(_0x4003ab){_0x171e8a=_0x4003ab;if(_0x171e8a){if(_0x171e8a[_0x34f8('0x1c')]){return _0x32282b(_0x34f8('0x1d'));}else if(_0x58a091[_0x34f8('0x13')]>0x0){if(_0x171e8a['blocked']){if(moment(_0x171e8a[_0x34f8('0x1e')])[_0x34f8('0x1f')](_0x58a091[_0x34f8('0x13')],'minutes')>moment()){return _0x32282b(_0x34f8('0x1d'));}else{return utils[_0x34f8('0x20')](_0x171e8a,0x0,![],null)[_0x34f8('0x14')](function(){return utils[_0x34f8('0x21')](_0x171e8a);})[_0x34f8('0x14')](function(){return _0x32282b(null,_0x171e8a);});}}else{return utils[_0x34f8('0x21')](_0x171e8a)[_0x34f8('0x14')](function(){return _0x32282b(null,_0x171e8a);});}}else{return utils[_0x34f8('0x21')](_0x171e8a)[_0x34f8('0x14')](function(){return _0x32282b(null,_0x171e8a);});}}return _0x32282b(_0x34f8('0x1d'));})[_0x34f8('0x22')](function(_0x56f6ef){_0x32282b(_0x56f6ef);});})); \ No newline at end of file +var _0x233c=['lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate','/login','profile','email','callback','google','use','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','disabled','blocked','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x233c,0x130));var _0xc233=function(_0x4348cf,_0x3c5e31){_0x4348cf=_0x4348cf-0x0;var _0xa33ff3=_0x233c[_0x4348cf];return _0xa33ff3;};'use strict';var _=require(_0xc233('0x0'));var passport=require(_0xc233('0x1'));var GoogleStrategy=require(_0xc233('0x2'))[_0xc233('0x3')];var moment=require('moment');var db=require(_0xc233('0x4'))['db'];var config=require(_0xc233('0x5'));var signToken=require(_0xc233('0x6'))[_0xc233('0x7')];var utils=require('../../config/utils');exports[_0xc233('0x8')]=passport[_0xc233('0x9')]('google',{'failureRedirect':_0xc233('0xa'),'scope':[_0xc233('0xb'),_0xc233('0xc')],'session':![]});exports[_0xc233('0xd')]=passport[_0xc233('0x9')](_0xc233('0xe'),{'failureRedirect':'/login','session':![]});passport[_0xc233('0xf')](new GoogleStrategy({'clientID':config[_0xc233('0xe')]?config['google']['clientID']:'id','clientSecret':config[_0xc233('0xe')]?config['google'][_0xc233('0x10')]:_0xc233('0x11'),'callbackURL':config[_0xc233('0xe')]?config[_0xc233('0xe')][_0xc233('0x12')]:''},function(_0x505ed3,_0x1bf040,_0x3a6592,_0xf83721){var _0x1c1a97,_0x4da362;return db[_0xc233('0x13')][_0xc233('0x14')]({'where':{'id':0x1},'attributes':[_0xc233('0x15'),_0xc233('0x16')],'raw':!![]})[_0xc233('0x17')](function(_0x574695){_0x1c1a97=_0x574695;return db[_0xc233('0x18')][_0xc233('0x19')]({'where':{'email':_[_0xc233('0x1a')](_0x3a6592['emails'],_0xc233('0x1b')),'role':{'$or':[_0xc233('0x1c'),_0xc233('0x1d'),_0xc233('0x1e')]}}});})[_0xc233('0x17')](function(_0x1b22d2){_0x4da362=_0x1b22d2;if(_0x4da362){if(_0x4da362[_0xc233('0x1f')]){return _0xf83721('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x1c1a97['blockDuration']>0x0){if(_0x4da362[_0xc233('0x20')]){if(moment(_0x4da362['blockedAt'])[_0xc233('0x21')](_0x1c1a97[_0xc233('0x16')],'minutes')>moment()){return _0xf83721(_0xc233('0x22'));}else{return utils[_0xc233('0x23')](_0x4da362,0x0,![],null)[_0xc233('0x17')](function(){return utils[_0xc233('0x24')](_0x4da362);})['then'](function(){return _0xf83721(null,_0x4da362);});}}else{return utils[_0xc233('0x24')](_0x4da362)[_0xc233('0x17')](function(){return _0xf83721(null,_0x4da362);});}}else{return utils[_0xc233('0x24')](_0x4da362)[_0xc233('0x17')](function(){return _0xf83721(null,_0x4da362);});}}return _0xf83721('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xc233('0x25')](function(_0x3455bc){_0xf83721(_0x3455bc);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 00ab633..fe98fee 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 _0xc52f=['callback','isMiddleware','exports','express','passport','../../components/auth/service','get','login'];(function(_0x1d74aa,_0x5709ab){var _0x26b038=function(_0x2e9b60){while(--_0x2e9b60){_0x1d74aa['push'](_0x1d74aa['shift']());}};_0x26b038(++_0x5709ab);}(_0xc52f,0x1e3));var _0xfc52=function(_0x407c08,_0x1ab7fb){_0x407c08=_0x407c08-0x0;var _0x4995b0=_0xc52f[_0x407c08];return _0x4995b0;};'use strict';var express=require(_0xfc52('0x0'));var passport=require(_0xfc52('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0xfc52('0x2'));router[_0xfc52('0x3')]('/',controller[_0xfc52('0x4')]);router['get']('/callback',controller[_0xfc52('0x5')],authService[_0xfc52('0x6')],userController[_0xfc52('0x4')],authService['setTokenCookie']);module[_0xfc52('0x7')]=router; \ No newline at end of file +var _0x1666=['../../components/auth/service','get','login','/callback','callback','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js'];(function(_0x4f9e17,_0x58a581){var _0x514a97=function(_0x1c48e1){while(--_0x1c48e1){_0x4f9e17['push'](_0x4f9e17['shift']());}};_0x514a97(++_0x58a581);}(_0x1666,0x75));var _0x6166=function(_0x3c73f3,_0x231858){_0x3c73f3=_0x3c73f3-0x0;var _0x435c58=_0x1666[_0x3c73f3];return _0x435c58;};'use strict';var express=require(_0x6166('0x0'));var passport=require(_0x6166('0x1'));var router=express['Router']();var controller=require(_0x6166('0x2'));var userController=require(_0x6166('0x3'));var authService=require(_0x6166('0x4'));router[_0x6166('0x5')]('/',controller[_0x6166('0x6')]);router[_0x6166('0x5')](_0x6166('0x7'),controller[_0x6166('0x8')],authService['isMiddleware'],userController[_0x6166('0x6')],authService[_0x6166('0x9')]);module[_0x6166('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 fa865f3..ab51c6f 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 _0x1307=['blocked','blockedAt','admin','loginAttempts','disabled','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','catch','getLicense','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','user','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','authenticate','local','signToken','online','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','util','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role'];(function(_0x5374a0,_0x2e1984){var _0x356501=function(_0xa3a652){while(--_0xa3a652){_0x5374a0['push'](_0x5374a0['shift']());}};_0x356501(++_0x2e1984);}(_0x1307,0xa1));var _0x7130=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x1307[_0xb24a3e];return _0x4038d7;};'use strict';var util=require(_0x7130('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x7130('0x1')];var jayson=require('jayson/promise');var _=require(_0x7130('0x2'));var rs=require(_0x7130('0x3'));var moment=require(_0x7130('0x4'));var db=require(_0x7130('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7130('0x6'));var client=jayson[_0x7130('0x7')][_0x7130('0x8')]({'port':0x232b});function localAuthenticate(_0x45af94,_0x5014af,_0x58b3d9,_0x397267){var _0x42d16d,_0x235871;return db[_0x7130('0x9')][_0x7130('0xa')]({'where':{'id':0x1},'attributes':[_0x7130('0xb'),_0x7130('0xc')],'raw':!![]})[_0x7130('0xd')](function(_0x3d48be){_0x42d16d=_0x3d48be;return _0x45af94[_0x7130('0xa')]({'attributes':['id',_0x7130('0xe'),'password',_0x7130('0xf'),_0x7130('0x10'),'disabled',_0x7130('0x11'),_0x7130('0x12'),'loginAttempts'],'where':{'name':_0x5014af,'role':{'$or':[_0x7130('0x13'),'user','agent']}}});})[_0x7130('0xd')](function(_0xf53a62){if(!_0xf53a62||_0xf53a62&&_0xf53a62['name']!==_0x5014af){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x235871=_0xf53a62;return _0x235871;}})[_0x7130('0xd')](function(){_0x235871['authenticate'](_0x58b3d9,function(_0x67471a,_0x57d1b2){var _0xc948b6=_0x235871[_0x7130('0x14')]+0x1;if(_0x67471a){return _0x397267(_0x67471a);}else if(!_0x57d1b2){if(_0x235871[_0x7130('0x15')]){return _0x397267(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x42d16d[_0x7130('0xb')]>0x0){if(_0x235871['blocked']){if(_0x42d16d[_0x7130('0xc')]>0x0){if(moment(_0x235871[_0x7130('0x12')])[_0x7130('0x16')](_0x42d16d['blockDuration'],_0x7130('0x17'))>moment()){return _0x397267(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x235871,_0xc948b6,![],null)[_0x7130('0xd')](function(){return _0x397267(null,![],{'message':_0x7130('0x18')});});}}else{return _0x397267(null,![],{'message':_0x7130('0x18')});}}else{if(_0xc948b6>=_0x42d16d[_0x7130('0xb')]){return utils['clearBlockUser'](_0x235871,0x0,!![],moment())['then'](function(){return _0x397267(null,![],{'message':_0x7130('0x18')});});}else{return utils['clearBlockUser'](_0x235871,_0xc948b6,![],null)[_0x7130('0xd')](function(){return _0x397267(null,![],{'message':_0x7130('0x18')});});}}}else{return _0x397267(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x235871['disabled']){return _0x397267(null,![],{'message':_0x7130('0x18')});}else if(_0x42d16d['allowedLoginAttempts']>0x0){if(_0x235871[_0x7130('0x11')]){if(_0x42d16d[_0x7130('0xc')]>0x0){if(moment(_0x235871['blockedAt'])['add'](_0x42d16d['blockDuration'],_0x7130('0x17'))>moment()){return _0x397267(null,![],{'message':_0x7130('0x18')});}else{return utils['clearBlockUser'](_0x235871,0x0,![],null)[_0x7130('0xd')](function(){return utils['getLicense'](_0x235871);})[_0x7130('0xd')](function(){return _0x397267(null,_0x235871);});}}else{return _0x397267(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x7130('0x19')](_0x235871,0x0,![],null)[_0x7130('0xd')](function(){return utils['getLicense'](_0x235871);})[_0x7130('0xd')](function(){return _0x397267(null,_0x235871);})[_0x7130('0x1a')](function(_0xe3d5e5){return _0x397267(null,![],_0xe3d5e5);});}}else{if(_0x235871[_0x7130('0x11')]){return _0x397267(null,![],{'message':_0x7130('0x18')});}else{return utils[_0x7130('0x1b')](_0x235871)[_0x7130('0xd')](function(){return _0x397267(null,_0x235871);});}}}});})[_0x7130('0x1a')](function(_0x33cbf3){return _0x397267(null,![],_0x33cbf3);});}function sendServiceMail(_0xf62d9b){return db[_0x7130('0x1c')]['find']({'where':{'service':!![]},'attributes':['id',_0x7130('0xe'),_0x7130('0x1d')],'include':[{'model':db[_0x7130('0x1e')],'as':'Smtp'}]})[_0x7130('0xd')](function(_0x2f5199){if(!_0x2f5199){throw new Error(_0x7130('0x1f'));}var _0x359cf4={'tls':{'rejectUnauthorized':![]}};if(_0x2f5199[_0x7130('0x20')][_0x7130('0x21')]){_0x359cf4['service']=_0x2f5199[_0x7130('0x20')]['service'];}else{_0x359cf4[_0x7130('0x22')]=_0x2f5199[_0x7130('0x20')]['host'];_0x359cf4[_0x7130('0x23')]=_0x2f5199[_0x7130('0x20')]['port'];_0x359cf4['secure']=_0x2f5199['Smtp'][_0x7130('0x24')];}if(_0x2f5199[_0x7130('0x20')][_0x7130('0x25')]){_0x359cf4[_0x7130('0x26')]={'user':_0x2f5199[_0x7130('0x20')][_0x7130('0x27')],'pass':_0x2f5199['Smtp']['pass']};}var _0x66bd0a={'account':_0x359cf4,'message':_[_0x7130('0x28')]({'from':util[_0x7130('0x29')](_0x7130('0x2a'),_0x2f5199[_0x7130('0xe')],_0x2f5199[_0x7130('0x1d')]||_0x2f5199[_0x7130('0x20')][_0x7130('0x27')])},_0xf62d9b)};return client[_0x7130('0x2b')]('SendMail',_0x66bd0a);})[_0x7130('0xd')](function(_0x5d2859){if(_0x5d2859[_0x7130('0x2c')]){throw new Error(util['format'](_0x7130('0x2d'),_0x5d2859['error'][_0x7130('0x2e')]||JSON[_0x7130('0x2f')](_0x5d2859[_0x7130('0x2c')])));}return!![];});}function handleError(_0x22e1ec,_0x3b20bc,_0x575842){return _0x22e1ec[_0x7130('0x30')](_0x3b20bc||0x1f4)['send']({'message':_0x575842?_0x575842['message']||_0x575842:''});}exports[_0x7130('0x31')]=function(_0xeb87be,_0x462aff,_0xefdb15){passport[_0x7130('0x32')](_0x7130('0x33'),function(_0x8a1473,_0x483a02,_0x4875b3){var _0x4eee5a=_0x8a1473||_0x4875b3;if(_0x4eee5a){return handleError(_0x462aff,0x191,_0x4eee5a);}if(!_0x483a02){return handleError(_0x462aff,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2a5752={'payload':{'id':_0x483a02['id'],'role':_0x483a02[_0x7130('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x7130('0x34')](_0x2a5752)[_0x7130('0xd')](function(_0x2f4223){_0x462aff['json']({'id':_0x483a02['id'],'token':_0x2f4223,'statusCall':'','isAlreadyLogged':_0x483a02[_0x7130('0x35')]});});}})(_0xeb87be,_0x462aff,_0xefdb15);};exports['forgot']=function(_0xaea3da,_0x1b3ccc,_0x2db9f8){if(!_0xaea3da['body'][_0x7130('0x1d')]){return handleError(_0x1b3ccc,0x1f4,{'message':_0x7130('0x36')});}var _0x4c88d7=rs[_0x7130('0x37')]();_0xaea3da['body']['email']=_0xaea3da[_0x7130('0x38')][_0x7130('0x1d')][_0x7130('0x39')]()[_0x7130('0x3a')]();var _0x52f162;return db['Setting'][_0x7130('0xa')]({'where':{'id':0x1},'attributes':[_0x7130('0xb'),_0x7130('0xc')],'raw':!![]})[_0x7130('0xd')](function(_0x318f17){_0x52f162=_0x318f17;return db[_0x7130('0x3b')][_0x7130('0x3c')]({'where':{'email':_0xaea3da['body'][_0x7130('0x1d')]}});})['then'](function(_0x5aef4a){if(!_0x5aef4a){throw new Error(_0x7130('0x3d'));}if(_0x5aef4a[_0x7130('0x15')]){throw new Error(_0x7130('0x3e'));}if(_0x5aef4a[_0x7130('0x11')]){if(moment(_0x5aef4a[_0x7130('0x12')])[_0x7130('0x16')](_0x52f162['blockDuration'],_0x7130('0x17'))>moment()){throw new Error(_0x7130('0x3f'));}else{_0x5aef4a[_0x7130('0x11')]=![];_0x5aef4a[_0x7130('0x12')]=null;}}_0x5aef4a[_0x7130('0x40')]=_0x4c88d7;_0x5aef4a[_0x7130('0x41')]=Date[_0x7130('0x42')]()+0x36ee80;return _0x5aef4a[_0x7130('0x43')]();})[_0x7130('0xd')](function(){return sendServiceMail({'to':_0xaea3da[_0x7130('0x38')][_0x7130('0x1d')],'subject':_0x7130('0x44'),'text':_0x7130('0x45')+_0x7130('0x46')+_0x7130('0x47')+_0xaea3da[_0x7130('0x48')]['host']+_0x7130('0x49')+_0x4c88d7+'\x0a\x0a'+_0x7130('0x4a')});})[_0x7130('0xd')](function(){_0x1b3ccc[_0x7130('0x30')](0xc8)[_0x7130('0x4b')]({'message':_0x7130('0x4c')});})[_0x7130('0x1a')](function(_0x494ecc){return handleError(_0x1b3ccc,0x1f4,_0x494ecc);});};exports[_0x7130('0x4d')]=function(_0x2df55b,_0x1f7abe,_0x3daf07){return db[_0x7130('0x3b')][_0x7130('0x3c')]({'where':{'resetPasswordToken':_0x2df55b[_0x7130('0x4e')][_0x7130('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x7130('0x42')]()}}})[_0x7130('0xd')](function(_0x3f138d){if(!_0x3f138d){throw new Error(_0x7130('0x50'));}return db[_0x7130('0x9')][_0x7130('0xa')]({'attributes':['id',_0x7130('0x51'),_0x7130('0x52'),_0x7130('0x53')]})[_0x7130('0xd')](function(_0x5e7362){if(_0x5e7362[_0x7130('0x51')])authService[_0x7130('0x54')](_0x2df55b[_0x7130('0x38')][_0x7130('0x55')]);if(!_0x5e7362[_0x7130('0x52')]||!_0x3f138d[_0x7130('0x56')])return _0x3f138d;authService[_0x7130('0x57')](_0x2df55b[_0x7130('0x38')][_0x7130('0x55')],_0x3f138d[_0x7130('0x56')],_0x5e7362[_0x7130('0x53')]);return _0x3f138d;})['then'](function(){_0x3f138d[_0x7130('0x55')]=_0x2df55b['body'][_0x7130('0x55')];_0x3f138d[_0x7130('0x40')]=null;_0x3f138d['resetPasswordExpires']=null;return _0x3f138d[_0x7130('0x43')]();});})['then'](function(){_0x1f7abe[_0x7130('0x30')](0xc8)['send']({'message':_0x7130('0x58')});})['catch'](function(_0x23c6b7){return handleError(_0x1f7abe,0x1f4,_0x23c6b7);});};passport['use'](new LocalStrategy({'usernameField':_0x7130('0xe'),'passwordField':'password'},function(_0x592624,_0x22f374,_0x26e061){return localAuthenticate(db[_0x7130('0x3b')],_0x592624,_0x22f374,_0x26e061);})); \ No newline at end of file +var _0x24cf=['body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','blockDuration','then','name','password','role','disabled','blocked','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blockedAt','add','minutes','clearBlockUser','getLicense','email','Smtp','service','host','port','secure','authentication','auth','user','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot'];(function(_0x1c31f4,_0x8e8aeb){var _0x5a3f66=function(_0x3ff723){while(--_0x3ff723){_0x1c31f4['push'](_0x1c31f4['shift']());}};_0x5a3f66(++_0x8e8aeb);}(_0x24cf,0x1d5));var _0xf24c=function(_0x3a497b,_0x4c5cb7){_0x3a497b=_0x3a497b-0x0;var _0x2cfdb3=_0x24cf[_0x3a497b];return _0x2cfdb3;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0xf24c('0x0'))[_0xf24c('0x1')];var jayson=require(_0xf24c('0x2'));var _=require(_0xf24c('0x3'));var rs=require(_0xf24c('0x4'));var moment=require('moment');var db=require(_0xf24c('0x5'))['db'];var authService=require(_0xf24c('0x6'));var utils=require(_0xf24c('0x7'));var client=jayson[_0xf24c('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x4983e2,_0x5104bd,_0x272d25,_0x596e81){var _0x3b7cf1,_0x13163e;return db[_0xf24c('0x9')][_0xf24c('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xf24c('0xb')],'raw':!![]})[_0xf24c('0xc')](function(_0x260dfd){_0x3b7cf1=_0x260dfd;return _0x4983e2[_0xf24c('0xa')]({'attributes':['id',_0xf24c('0xd'),_0xf24c('0xe'),'salt',_0xf24c('0xf'),_0xf24c('0x10'),_0xf24c('0x11'),'blockedAt',_0xf24c('0x12')],'where':{'name':_0x5104bd,'role':{'$or':[_0xf24c('0x13'),'user','agent']}}});})[_0xf24c('0xc')](function(_0x479b01){if(!_0x479b01||_0x479b01&&_0x479b01[_0xf24c('0xd')]!==_0x5104bd){throw new Error(_0xf24c('0x14'));}else{_0x13163e=_0x479b01;return _0x13163e;}})['then'](function(){_0x13163e[_0xf24c('0x15')](_0x272d25,function(_0x302daf,_0x1efef1){var _0x263c49=_0x13163e[_0xf24c('0x12')]+0x1;if(_0x302daf){return _0x596e81(_0x302daf);}else if(!_0x1efef1){if(_0x13163e['disabled']){return _0x596e81(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3b7cf1[_0xf24c('0x16')]>0x0){if(_0x13163e[_0xf24c('0x11')]){if(_0x3b7cf1['blockDuration']>0x0){if(moment(_0x13163e[_0xf24c('0x17')])[_0xf24c('0x18')](_0x3b7cf1[_0xf24c('0xb')],_0xf24c('0x19'))>moment()){return _0x596e81(null,![],{'message':_0xf24c('0x14')});}else{return utils[_0xf24c('0x1a')](_0x13163e,_0x263c49,![],null)[_0xf24c('0xc')](function(){return _0x596e81(null,![],{'message':_0xf24c('0x14')});});}}else{return _0x596e81(null,![],{'message':_0xf24c('0x14')});}}else{if(_0x263c49>=_0x3b7cf1[_0xf24c('0x16')]){return utils[_0xf24c('0x1a')](_0x13163e,0x0,!![],moment())[_0xf24c('0xc')](function(){return _0x596e81(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xf24c('0x1a')](_0x13163e,_0x263c49,![],null)[_0xf24c('0xc')](function(){return _0x596e81(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x596e81(null,![],{'message':_0xf24c('0x14')});}}else{if(_0x13163e[_0xf24c('0x10')]){return _0x596e81(null,![],{'message':_0xf24c('0x14')});}else if(_0x3b7cf1['allowedLoginAttempts']>0x0){if(_0x13163e[_0xf24c('0x11')]){if(_0x3b7cf1['blockDuration']>0x0){if(moment(_0x13163e[_0xf24c('0x17')])[_0xf24c('0x18')](_0x3b7cf1['blockDuration'],_0xf24c('0x19'))>moment()){return _0x596e81(null,![],{'message':_0xf24c('0x14')});}else{return utils[_0xf24c('0x1a')](_0x13163e,0x0,![],null)[_0xf24c('0xc')](function(){return utils[_0xf24c('0x1b')](_0x13163e);})[_0xf24c('0xc')](function(){return _0x596e81(null,_0x13163e);});}}else{return _0x596e81(null,![],{'message':_0xf24c('0x14')});}}else{return utils[_0xf24c('0x1a')](_0x13163e,0x0,![],null)[_0xf24c('0xc')](function(){return utils[_0xf24c('0x1b')](_0x13163e);})[_0xf24c('0xc')](function(){return _0x596e81(null,_0x13163e);})['catch'](function(_0x4b21f5){return _0x596e81(null,![],_0x4b21f5);});}}else{if(_0x13163e[_0xf24c('0x11')]){return _0x596e81(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x13163e)[_0xf24c('0xc')](function(){return _0x596e81(null,_0x13163e);});}}}});})['catch'](function(_0x191c46){return _0x596e81(null,![],_0x191c46);});}function sendServiceMail(_0x379f9a){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id','name',_0xf24c('0x1c')],'include':[{'model':db['MailServerOut'],'as':_0xf24c('0x1d')}]})[_0xf24c('0xc')](function(_0x2ee712){if(!_0x2ee712){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x2033a8={'tls':{'rejectUnauthorized':![]}};if(_0x2ee712['Smtp']['service']){_0x2033a8[_0xf24c('0x1e')]=_0x2ee712[_0xf24c('0x1d')][_0xf24c('0x1e')];}else{_0x2033a8[_0xf24c('0x1f')]=_0x2ee712['Smtp'][_0xf24c('0x1f')];_0x2033a8[_0xf24c('0x20')]=_0x2ee712[_0xf24c('0x1d')][_0xf24c('0x20')];_0x2033a8[_0xf24c('0x21')]=_0x2ee712[_0xf24c('0x1d')]['secure'];}if(_0x2ee712[_0xf24c('0x1d')][_0xf24c('0x22')]){_0x2033a8[_0xf24c('0x23')]={'user':_0x2ee712[_0xf24c('0x1d')][_0xf24c('0x24')],'pass':_0x2ee712[_0xf24c('0x1d')][_0xf24c('0x25')]};}var _0x5c8f4a={'account':_0x2033a8,'message':_[_0xf24c('0x26')]({'from':util['format'](_0xf24c('0x27'),_0x2ee712[_0xf24c('0xd')],_0x2ee712['email']||_0x2ee712[_0xf24c('0x1d')]['user'])},_0x379f9a)};return client[_0xf24c('0x28')](_0xf24c('0x29'),_0x5c8f4a);})[_0xf24c('0xc')](function(_0x47f733){if(_0x47f733[_0xf24c('0x2a')]){throw new Error(util['format'](_0xf24c('0x2b'),_0x47f733['error']['message']||JSON['stringify'](_0x47f733[_0xf24c('0x2a')])));}return!![];});}function handleError(_0x2bd44c,_0x447761,_0x3334b3){return _0x2bd44c[_0xf24c('0x2c')](_0x447761||0x1f4)[_0xf24c('0x2d')]({'message':_0x3334b3?_0x3334b3[_0xf24c('0x2e')]||_0x3334b3:''});}exports['login']=function(_0x19b372,_0x39b928,_0x2332e6){passport[_0xf24c('0x15')](_0xf24c('0x2f'),function(_0x484b7f,_0x177c02,_0x571075){var _0x3e027f=_0x484b7f||_0x571075;if(_0x3e027f){return handleError(_0x39b928,0x191,_0x3e027f);}if(!_0x177c02){return handleError(_0x39b928,0x194,{'message':_0xf24c('0x30')});}else{var _0x303ad4={'payload':{'id':_0x177c02['id'],'role':_0x177c02[_0xf24c('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xf24c('0x31')](_0x303ad4)[_0xf24c('0xc')](function(_0x3e5d78){_0x39b928[_0xf24c('0x32')]({'id':_0x177c02['id'],'token':_0x3e5d78,'statusCall':'','isAlreadyLogged':_0x177c02[_0xf24c('0x33')]});});}})(_0x19b372,_0x39b928,_0x2332e6);};exports[_0xf24c('0x34')]=function(_0x232688,_0x5d5ac1,_0x5d55f0){if(!_0x232688[_0xf24c('0x35')][_0xf24c('0x1c')]){return handleError(_0x5d5ac1,0x1f4,{'message':_0xf24c('0x36')});}var _0x11a9ca=rs[_0xf24c('0x37')]();_0x232688[_0xf24c('0x35')][_0xf24c('0x1c')]=_0x232688[_0xf24c('0x35')][_0xf24c('0x1c')][_0xf24c('0x38')]()[_0xf24c('0x39')]();var _0x5002a1;return db[_0xf24c('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xf24c('0x16'),_0xf24c('0xb')],'raw':!![]})[_0xf24c('0xc')](function(_0x2bd052){_0x5002a1=_0x2bd052;return db[_0xf24c('0x3a')][_0xf24c('0x3b')]({'where':{'email':_0x232688[_0xf24c('0x35')][_0xf24c('0x1c')]}});})[_0xf24c('0xc')](function(_0x2638f6){if(!_0x2638f6){throw new Error(_0xf24c('0x3c'));}if(_0x2638f6[_0xf24c('0x10')]){throw new Error(_0xf24c('0x3d'));}if(_0x2638f6[_0xf24c('0x11')]){if(moment(_0x2638f6[_0xf24c('0x17')])['add'](_0x5002a1['blockDuration'],_0xf24c('0x19'))>moment()){throw new Error(_0xf24c('0x3e'));}else{_0x2638f6[_0xf24c('0x11')]=![];_0x2638f6[_0xf24c('0x17')]=null;}}_0x2638f6[_0xf24c('0x3f')]=_0x11a9ca;_0x2638f6['resetPasswordExpires']=Date[_0xf24c('0x40')]()+0x36ee80;return _0x2638f6[_0xf24c('0x41')]();})[_0xf24c('0xc')](function(){return sendServiceMail({'to':_0x232688[_0xf24c('0x35')]['email'],'subject':_0xf24c('0x42'),'text':_0xf24c('0x43')+_0xf24c('0x44')+_0xf24c('0x45')+_0x232688[_0xf24c('0x46')][_0xf24c('0x1f')]+_0xf24c('0x47')+_0x11a9ca+'\x0a\x0a'+_0xf24c('0x48')});})[_0xf24c('0xc')](function(){_0x5d5ac1[_0xf24c('0x2c')](0xc8)[_0xf24c('0x2d')]({'message':_0xf24c('0x49')});})[_0xf24c('0x4a')](function(_0x2b99f1){return handleError(_0x5d5ac1,0x1f4,_0x2b99f1);});};exports[_0xf24c('0x4b')]=function(_0x340552,_0x296252,_0x4ab953){return db[_0xf24c('0x3a')][_0xf24c('0x3b')]({'where':{'resetPasswordToken':_0x340552[_0xf24c('0x4c')][_0xf24c('0x4d')],'resetPasswordExpires':{'$gt':Date[_0xf24c('0x40')]()}}})[_0xf24c('0xc')](function(_0x86dc69){if(!_0x86dc69){throw new Error(_0xf24c('0x4e'));}return db[_0xf24c('0x9')][_0xf24c('0xa')]({'attributes':['id','securePassword',_0xf24c('0x4f'),_0xf24c('0x50')]})['then'](function(_0x517dbf){if(_0x517dbf[_0xf24c('0x51')])authService[_0xf24c('0x52')](_0x340552[_0xf24c('0x35')][_0xf24c('0xe')]);if(!_0x517dbf[_0xf24c('0x4f')]||!_0x86dc69[_0xf24c('0x53')])return _0x86dc69;authService[_0xf24c('0x54')](_0x340552[_0xf24c('0x35')][_0xf24c('0xe')],_0x86dc69['previousPasswords'],_0x517dbf[_0xf24c('0x50')]);return _0x86dc69;})['then'](function(){_0x86dc69['password']=_0x340552[_0xf24c('0x35')][_0xf24c('0xe')];_0x86dc69[_0xf24c('0x3f')]=null;_0x86dc69[_0xf24c('0x55')]=null;return _0x86dc69[_0xf24c('0x41')]();});})[_0xf24c('0xc')](function(){_0x296252[_0xf24c('0x2c')](0xc8)[_0xf24c('0x2d')]({'message':_0xf24c('0x56')});})[_0xf24c('0x4a')](function(_0x5793f2){return handleError(_0x296252,0x1f4,_0x5793f2);});};passport['use'](new LocalStrategy({'usernameField':_0xf24c('0xd'),'passwordField':'password'},function(_0x2b9b2d,_0x35a63a,_0x18012b){return localAuthenticate(db[_0xf24c('0x3a')],_0x2b9b2d,_0x35a63a,_0x18012b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ac8a327..e7bcaba 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 _0x8bfb=['login','forgot','exports','express','Router','./authLocal.controller','post'];(function(_0x20d7e8,_0x24eaf0){var _0x36c98c=function(_0x178b3b){while(--_0x178b3b){_0x20d7e8['push'](_0x20d7e8['shift']());}};_0x36c98c(++_0x24eaf0);}(_0x8bfb,0x168));var _0xb8bf=function(_0x2d5f5f,_0x5d111f){_0x2d5f5f=_0x2d5f5f-0x0;var _0x2daff6=_0x8bfb[_0x2d5f5f];return _0x2daff6;};'use strict';var express=require(_0xb8bf('0x0'));var router=express[_0xb8bf('0x1')]();var controller=require(_0xb8bf('0x2'));router[_0xb8bf('0x3')]('/',controller[_0xb8bf('0x4')]);router[_0xb8bf('0x3')]('/forgot',controller[_0xb8bf('0x5')]);router[_0xb8bf('0x3')]('/reset/:token',controller['reset']);module[_0xb8bf('0x6')]=router; \ No newline at end of file +var _0x00e1=['forgot','Router','./authLocal.controller','post','login','/forgot'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x00e1,0xeb));var _0x100e=function(_0x1618b8,_0x50b4c1){_0x1618b8=_0x1618b8-0x0;var _0x5b0cfc=_0x00e1[_0x1618b8];return _0x5b0cfc;};'use strict';var express=require('express');var router=express[_0x100e('0x0')]();var controller=require(_0x100e('0x1'));router[_0x100e('0x2')]('/',controller[_0x100e('0x3')]);router['post'](_0x100e('0x4'),controller[_0x100e('0x5')]);router[_0x100e('0x2')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ef59731..6194764 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 _0xd788=['STRING','BOOLEAN'];(function(_0x47dc64,_0x30683d){var _0x2875d2=function(_0x592c64){while(--_0x592c64){_0x47dc64['push'](_0x47dc64['shift']());}};_0x2875d2(++_0x30683d);}(_0xd788,0x15a));var _0x8d78=function(_0x33af27,_0x473159){_0x33af27=_0x33af27-0x0;var _0x330cf7=_0xd788[_0x33af27];return _0x330cf7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x8d78('0x0')]},'description':{'type':Sequelize[_0x8d78('0x0')]},'status':{'type':Sequelize[_0x8d78('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xcc54=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x5a418a,_0x21bb20){var _0x41a70e=function(_0x39eb2c){while(--_0x39eb2c){_0x5a418a['push'](_0x5a418a['shift']());}};_0x41a70e(++_0x21bb20);}(_0xcc54,0xe1));var _0x4cc5=function(_0x24b170,_0x35ef06){_0x24b170=_0x24b170-0x0;var _0x2bdf9f=_0xcc54[_0x24b170];return _0x2bdf9f;};'use strict';var Sequelize=require(_0x4cc5('0x0'));module['exports']={'name':{'type':Sequelize[_0x4cc5('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x4cc5('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x4cc5('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4cc5('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 9c90da5..056ed16 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 _0x5c90=['save','then','destroy','stack','name','send','Automation','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','update','addConditions','Condition','omit','ids','getConditions','findOne','addActions','getActions','Action','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0x511331,_0x5b41c1){var _0x577cfc=function(_0x5ad5cc){while(--_0x5ad5cc){_0x511331['push'](_0x511331['shift']());}};_0x577cfc(++_0x5b41c1);}(_0x5c90,0x178));var _0x05c9=function(_0x4616cf,_0x3eacda){_0x4616cf=_0x4616cf-0x0;var _0x1d9abd=_0x5c90[_0x4616cf];return _0x1d9abd;};'use strict';var emlformat=require(_0x05c9('0x0'));var rimraf=require(_0x05c9('0x1'));var zipdir=require(_0x05c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c9('0x3'));var moment=require(_0x05c9('0x4'));var BPromise=require(_0x05c9('0x5'));var Mustache=require(_0x05c9('0x6'));var util=require(_0x05c9('0x7'));var path=require(_0x05c9('0x8'));var sox=require('sox');var csv=require(_0x05c9('0x9'));var ejs=require(_0x05c9('0xa'));var fs=require('fs');var fs_extra=require(_0x05c9('0xb'));var _=require(_0x05c9('0xc'));var squel=require('squel');var crypto=require(_0x05c9('0xd'));var jsforce=require(_0x05c9('0xe'));var deskjs=require(_0x05c9('0xf'));var toCsv=require(_0x05c9('0x9'));var querystring=require(_0x05c9('0x10'));var Papa=require(_0x05c9('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x05c9('0x12'));var as=require(_0x05c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05c9('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x05c9('0x15'));var licenseUtil=require(_0x05c9('0x16'));var db=require(_0x05c9('0x17'))['db'];function respondWithStatusCode(_0xd429b5,_0x21a720){_0x21a720=_0x21a720||0xcc;return function(_0x4ff0c9){if(_0x4ff0c9){return _0xd429b5[_0x05c9('0x18')](_0x21a720);}return _0xd429b5[_0x05c9('0x19')](_0x21a720)[_0x05c9('0x1a')]();};}function respondWithResult(_0x44f5b6,_0x1612a9){_0x1612a9=_0x1612a9||0xc8;return function(_0x58ef0f){if(_0x58ef0f){return _0x44f5b6[_0x05c9('0x19')](_0x1612a9)['json'](_0x58ef0f);}};}function respondWithFilteredResult(_0x21ac5e,_0x3051cf){return function(_0x9233ea){if(_0x9233ea){var _0x597ded=typeof _0x3051cf[_0x05c9('0x1b')]===_0x05c9('0x1c')&&typeof _0x3051cf['limit']==='undefined';var _0x1cac00=_0x9233ea[_0x05c9('0x1d')];var _0x94c0c9=_0x597ded?0x0:_0x3051cf[_0x05c9('0x1b')];var _0x1e71b6=_0x597ded?_0x9233ea['count']:_0x3051cf[_0x05c9('0x1b')]+_0x3051cf['limit'];var _0x13f6aa;if(_0x1e71b6>=_0x1cac00){_0x1e71b6=_0x1cac00;_0x13f6aa=0xc8;}else{_0x13f6aa=0xce;}_0x21ac5e[_0x05c9('0x19')](_0x13f6aa);return _0x21ac5e[_0x05c9('0x1e')](_0x05c9('0x1f'),_0x94c0c9+'-'+_0x1e71b6+'/'+_0x1cac00)['json'](_0x9233ea);}return null;};}function patchUpdates(_0x5d2f8b){return function(_0x46ea46){try{jsonpatch[_0x05c9('0x20')](_0x46ea46,_0x5d2f8b,!![]);}catch(_0x150e1a){return BPromise[_0x05c9('0x21')](_0x150e1a);}return _0x46ea46[_0x05c9('0x22')]();};}function saveUpdates(_0x18d4ae,_0x575c12){return function(_0x3ca364){if(_0x3ca364){return _0x3ca364['update'](_0x18d4ae)[_0x05c9('0x23')](function(_0xe767a5){return _0xe767a5;});}return null;};}function removeEntity(_0xd0b67f,_0x24a84a){return function(_0x28573f){if(_0x28573f){return _0x28573f[_0x05c9('0x24')]()[_0x05c9('0x23')](function(){_0xd0b67f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2716,_0x39593c){return function(_0x3cb179){if(!_0x3cb179){_0x4b2716[_0x05c9('0x18')](0x194);}return _0x3cb179;};}function handleError(_0x534718,_0x5794a7){_0x5794a7=_0x5794a7||0x1f4;return function(_0x3efc66){logger['error'](_0x3efc66[_0x05c9('0x25')]);if(_0x3efc66[_0x05c9('0x26')]){delete _0x3efc66[_0x05c9('0x26')];}_0x534718[_0x05c9('0x19')](_0x5794a7)[_0x05c9('0x27')](_0x3efc66);};}exports['index']=function(_0x265ee9,_0x330f89){var _0x3af4fa={},_0x57779e={},_0x30b7a5={'count':0x0,'rows':[]};var _0x347f77=_['map'](db[_0x05c9('0x28')][_0x05c9('0x29')],function(_0x25f683){return{'name':_0x25f683[_0x05c9('0x2a')],'type':_0x25f683[_0x05c9('0x2b')]['key']};});_0x57779e[_0x05c9('0x2c')]=_[_0x05c9('0x2d')](_0x347f77,_0x05c9('0x26'));_0x57779e[_0x05c9('0x2e')]=_[_0x05c9('0x2f')](_0x265ee9[_0x05c9('0x2e')]);_0x57779e['filters']=_[_0x05c9('0x30')](_0x57779e[_0x05c9('0x2c')],_0x57779e['query']);_0x3af4fa[_0x05c9('0x31')]=_[_0x05c9('0x30')](_0x57779e[_0x05c9('0x2c')],qs[_0x05c9('0x32')](_0x265ee9[_0x05c9('0x2e')][_0x05c9('0x32')]));_0x3af4fa['attributes']=_0x3af4fa[_0x05c9('0x31')][_0x05c9('0x33')]?_0x3af4fa[_0x05c9('0x31')]:_0x57779e[_0x05c9('0x2c')];if(!_0x265ee9[_0x05c9('0x2e')][_0x05c9('0x34')](_0x05c9('0x35'))){_0x3af4fa[_0x05c9('0x36')]=qs[_0x05c9('0x36')](_0x265ee9[_0x05c9('0x2e')]['limit']);_0x3af4fa['offset']=qs['offset'](_0x265ee9['query'][_0x05c9('0x1b')]);}_0x3af4fa[_0x05c9('0x37')]=qs[_0x05c9('0x38')](_0x265ee9[_0x05c9('0x2e')]['sort']);_0x3af4fa[_0x05c9('0x39')]=qs[_0x05c9('0x3a')](_[_0x05c9('0x3b')](_0x265ee9[_0x05c9('0x2e')],_0x57779e[_0x05c9('0x3a')]),_0x347f77);if(_0x265ee9['query']['filter']){_0x3af4fa[_0x05c9('0x39')]=_[_0x05c9('0x3c')](_0x3af4fa[_0x05c9('0x39')],{'$or':_[_0x05c9('0x2d')](_0x347f77,function(_0x42b290){if(_0x42b290[_0x05c9('0x2b')]!=='VIRTUAL'){var _0x5eb458={};_0x5eb458[_0x42b290[_0x05c9('0x26')]]={'$like':'%'+_0x265ee9[_0x05c9('0x2e')][_0x05c9('0x3d')]+'%'};return _0x5eb458;}})});}_0x3af4fa=_[_0x05c9('0x3c')]({},_0x3af4fa,_0x265ee9[_0x05c9('0x3e')]);var _0x5d1652={'where':_0x3af4fa[_0x05c9('0x39')]};return db[_0x05c9('0x28')]['count'](_0x5d1652)['then'](function(_0x2094bf){_0x30b7a5[_0x05c9('0x1d')]=_0x2094bf;if(_0x265ee9[_0x05c9('0x2e')][_0x05c9('0x3f')]){_0x3af4fa[_0x05c9('0x40')]=[{'all':!![]}];}return db[_0x05c9('0x28')][_0x05c9('0x41')](_0x3af4fa);})[_0x05c9('0x23')](function(_0x5e6cfc){_0x30b7a5['rows']=_0x5e6cfc;return _0x30b7a5;})[_0x05c9('0x23')](respondWithFilteredResult(_0x330f89,_0x3af4fa))[_0x05c9('0x42')](handleError(_0x330f89,null));};exports[_0x05c9('0x43')]=function(_0xd8d6f3,_0x5746c9){var _0x35c46a={'raw':![],'where':{'id':_0xd8d6f3[_0x05c9('0x44')]['id']}},_0x136597={};_0x136597[_0x05c9('0x2c')]=_[_0x05c9('0x2f')](db[_0x05c9('0x28')][_0x05c9('0x29')]);_0x136597['query']=_['keys'](_0xd8d6f3[_0x05c9('0x2e')]);_0x136597[_0x05c9('0x3a')]=_[_0x05c9('0x30')](_0x136597[_0x05c9('0x2c')],_0x136597['query']);_0x35c46a[_0x05c9('0x31')]=_[_0x05c9('0x30')](_0x136597[_0x05c9('0x2c')],qs[_0x05c9('0x32')](_0xd8d6f3[_0x05c9('0x2e')]['fields']));_0x35c46a['attributes']=_0x35c46a['attributes'][_0x05c9('0x33')]?_0x35c46a[_0x05c9('0x31')]:_0x136597[_0x05c9('0x2c')];if(_0xd8d6f3[_0x05c9('0x2e')][_0x05c9('0x3f')]){_0x35c46a[_0x05c9('0x40')]=[{'all':!![]}];}_0x35c46a=_[_0x05c9('0x3c')]({},_0x35c46a,_0xd8d6f3[_0x05c9('0x3e')]);return db['Automation'][_0x05c9('0x45')](_0x35c46a)['then'](handleEntityNotFound(_0x5746c9,null))['then'](respondWithResult(_0x5746c9,null))[_0x05c9('0x42')](handleError(_0x5746c9,null));};exports[_0x05c9('0x46')]=function(_0x1cb44f,_0x506281){return db['Automation']['create'](_0x1cb44f[_0x05c9('0x47')],{})['then'](respondWithResult(_0x506281,0xc9))[_0x05c9('0x42')](handleError(_0x506281,null));};exports[_0x05c9('0x48')]=function(_0x1deab7,_0x987380){if(_0x1deab7[_0x05c9('0x47')]['id']){delete _0x1deab7[_0x05c9('0x47')]['id'];}return db[_0x05c9('0x28')][_0x05c9('0x45')]({'where':{'id':_0x1deab7[_0x05c9('0x44')]['id']}})[_0x05c9('0x23')](handleEntityNotFound(_0x987380,null))[_0x05c9('0x23')](saveUpdates(_0x1deab7[_0x05c9('0x47')],null))['then'](respondWithResult(_0x987380,null))[_0x05c9('0x42')](handleError(_0x987380,null));};exports[_0x05c9('0x24')]=function(_0x92a0f9,_0x7e94dc){return db['Automation']['find']({'where':{'id':_0x92a0f9['params']['id']}})[_0x05c9('0x23')](handleEntityNotFound(_0x7e94dc,null))[_0x05c9('0x23')](removeEntity(_0x7e94dc,null))[_0x05c9('0x42')](handleError(_0x7e94dc,null));};exports[_0x05c9('0x49')]=function(_0x85853b,_0x6681f8,_0x105c7e){return db[_0x05c9('0x4a')][_0x05c9('0x45')]({'where':{'id':_0x85853b[_0x05c9('0x44')]['id']}})[_0x05c9('0x23')](handleEntityNotFound(_0x6681f8,null))[_0x05c9('0x23')](function(_0x8e9268){if(_0x8e9268){return _0x8e9268['addConditions'](_0x85853b[_0x05c9('0x47')]['ids'],_[_0x05c9('0x4b')](_0x85853b['body'],[_0x05c9('0x4c'),'id'])||{});}})[_0x05c9('0x23')](respondWithResult(_0x6681f8,null))[_0x05c9('0x42')](handleError(_0x6681f8,null));};exports[_0x05c9('0x4d')]=function(_0x14aa10,_0x4851d1,_0x23f19f){var _0x3c51c4={};var _0x48a4d1={};var _0x25547c;var _0xdd54b1;return db['Automation'][_0x05c9('0x4e')]({'where':{'id':_0x14aa10[_0x05c9('0x44')]['id']}})[_0x05c9('0x23')](handleEntityNotFound(_0x4851d1,null))[_0x05c9('0x23')](function(_0x4792a7){if(_0x4792a7){_0x25547c=_0x4792a7;_0x48a4d1[_0x05c9('0x2c')]=_[_0x05c9('0x2f')](db[_0x05c9('0x4a')]['rawAttributes']);_0x48a4d1[_0x05c9('0x2e')]=_['keys'](_0x14aa10['query']);_0x48a4d1[_0x05c9('0x3a')]=_[_0x05c9('0x30')](_0x48a4d1[_0x05c9('0x2c')],_0x48a4d1[_0x05c9('0x2e')]);_0x3c51c4[_0x05c9('0x31')]=_[_0x05c9('0x30')](_0x48a4d1['model'],qs[_0x05c9('0x32')](_0x14aa10['query'][_0x05c9('0x32')]));_0x3c51c4[_0x05c9('0x31')]=_0x3c51c4[_0x05c9('0x31')]['length']?_0x3c51c4[_0x05c9('0x31')]:_0x48a4d1[_0x05c9('0x2c')];_0x3c51c4[_0x05c9('0x37')]=qs[_0x05c9('0x38')](_0x14aa10['query'][_0x05c9('0x38')]);_0x3c51c4[_0x05c9('0x39')]=qs[_0x05c9('0x3a')](_[_0x05c9('0x3b')](_0x14aa10[_0x05c9('0x2e')],_0x48a4d1[_0x05c9('0x3a')]));if(_0x14aa10[_0x05c9('0x2e')][_0x05c9('0x3d')]){_0x3c51c4[_0x05c9('0x39')]=_[_0x05c9('0x3c')](_0x3c51c4['where'],{'$or':_[_0x05c9('0x2d')](_0x3c51c4[_0x05c9('0x31')],function(_0x1c95d3){var _0x3305e6={};_0x3305e6[_0x1c95d3]={'$like':'%'+_0x14aa10[_0x05c9('0x2e')][_0x05c9('0x3d')]+'%'};return _0x3305e6;})});}_0x3c51c4=_[_0x05c9('0x3c')]({},_0x3c51c4,_0x14aa10[_0x05c9('0x3e')]);return _0x25547c[_0x05c9('0x4d')](_0x3c51c4);}})[_0x05c9('0x23')](function(_0x10acba){if(_0x10acba){_0xdd54b1=_0x10acba[_0x05c9('0x33')];if(!_0x14aa10[_0x05c9('0x2e')][_0x05c9('0x34')]('nolimit')){_0x3c51c4[_0x05c9('0x36')]=qs['limit'](_0x14aa10[_0x05c9('0x2e')][_0x05c9('0x36')]);_0x3c51c4[_0x05c9('0x1b')]=qs['offset'](_0x14aa10[_0x05c9('0x2e')][_0x05c9('0x1b')]);}return _0x25547c[_0x05c9('0x4d')](_0x3c51c4);}})[_0x05c9('0x23')](function(_0x3f90e9){if(_0x3f90e9){return _0x3f90e9?{'count':_0xdd54b1,'rows':_0x3f90e9}:null;}})[_0x05c9('0x23')](respondWithResult(_0x4851d1,null))[_0x05c9('0x42')](handleError(_0x4851d1,null));};exports[_0x05c9('0x4f')]=function(_0x29ba78,_0x30bf7c,_0x82da55){return db['Action'][_0x05c9('0x45')]({'where':{'id':_0x29ba78['params']['id']}})['then'](handleEntityNotFound(_0x30bf7c,null))[_0x05c9('0x23')](function(_0x5b330b){if(_0x5b330b){return _0x5b330b['addActions'](_0x29ba78[_0x05c9('0x47')][_0x05c9('0x4c')],_[_0x05c9('0x4b')](_0x29ba78[_0x05c9('0x47')],['ids','id'])||{});}})[_0x05c9('0x23')](respondWithResult(_0x30bf7c,null))['catch'](handleError(_0x30bf7c,null));};exports[_0x05c9('0x50')]=function(_0x43bc54,_0x14161a,_0x40745f){var _0x360cad={};var _0x4fa426={};var _0x147a0b;var _0x2814e3;return db[_0x05c9('0x28')][_0x05c9('0x4e')]({'where':{'id':_0x43bc54[_0x05c9('0x44')]['id']}})[_0x05c9('0x23')](handleEntityNotFound(_0x14161a,null))[_0x05c9('0x23')](function(_0x5269eb){if(_0x5269eb){_0x147a0b=_0x5269eb;_0x4fa426[_0x05c9('0x2c')]=_[_0x05c9('0x2f')](db[_0x05c9('0x51')]['rawAttributes']);_0x4fa426[_0x05c9('0x2e')]=_[_0x05c9('0x2f')](_0x43bc54[_0x05c9('0x2e')]);_0x4fa426[_0x05c9('0x3a')]=_['intersection'](_0x4fa426[_0x05c9('0x2c')],_0x4fa426[_0x05c9('0x2e')]);_0x360cad[_0x05c9('0x31')]=_['intersection'](_0x4fa426[_0x05c9('0x2c')],qs[_0x05c9('0x32')](_0x43bc54[_0x05c9('0x2e')][_0x05c9('0x32')]));_0x360cad['attributes']=_0x360cad[_0x05c9('0x31')][_0x05c9('0x33')]?_0x360cad[_0x05c9('0x31')]:_0x4fa426[_0x05c9('0x2c')];_0x360cad[_0x05c9('0x37')]=qs['sort'](_0x43bc54[_0x05c9('0x2e')][_0x05c9('0x38')]);_0x360cad['where']=qs[_0x05c9('0x3a')](_['pick'](_0x43bc54[_0x05c9('0x2e')],_0x4fa426[_0x05c9('0x3a')]));if(_0x43bc54[_0x05c9('0x2e')][_0x05c9('0x3d')]){_0x360cad['where']=_['merge'](_0x360cad[_0x05c9('0x39')],{'$or':_['map'](_0x360cad[_0x05c9('0x31')],function(_0x4738d3){var _0x1170ce={};_0x1170ce[_0x4738d3]={'$like':'%'+_0x43bc54['query']['filter']+'%'};return _0x1170ce;})});}_0x360cad=_[_0x05c9('0x3c')]({},_0x360cad,_0x43bc54[_0x05c9('0x3e')]);return _0x147a0b['getActions'](_0x360cad);}})['then'](function(_0x1244e0){if(_0x1244e0){_0x2814e3=_0x1244e0[_0x05c9('0x33')];if(!_0x43bc54[_0x05c9('0x2e')][_0x05c9('0x34')](_0x05c9('0x35'))){_0x360cad['limit']=qs[_0x05c9('0x36')](_0x43bc54[_0x05c9('0x2e')][_0x05c9('0x36')]);_0x360cad[_0x05c9('0x1b')]=qs['offset'](_0x43bc54[_0x05c9('0x2e')][_0x05c9('0x1b')]);}return _0x147a0b[_0x05c9('0x50')](_0x360cad);}})[_0x05c9('0x23')](function(_0x47f2d8){if(_0x47f2d8){return _0x47f2d8?{'count':_0x2814e3,'rows':_0x47f2d8}:null;}})[_0x05c9('0x23')](respondWithResult(_0x14161a,null))[_0x05c9('0x42')](handleError(_0x14161a,null));}; \ No newline at end of file +var _0x9656=['name','send','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','Automation','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','addConditions','Condition','ids','getConditions','Action','addActions','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','set','Content-Range','reject','save','update','then','destroy','error'];(function(_0x3bf789,_0x52c120){var _0x880b25=function(_0x19844e){while(--_0x19844e){_0x3bf789['push'](_0x3bf789['shift']());}};_0x880b25(++_0x52c120);}(_0x9656,0x1d0));var _0x6965=function(_0xf61041,_0x40f594){_0xf61041=_0xf61041-0x0;var _0x5ece16=_0x9656[_0xf61041];return _0x5ece16;};'use strict';var emlformat=require(_0x6965('0x0'));var rimraf=require(_0x6965('0x1'));var zipdir=require(_0x6965('0x2'));var jsonpatch=require(_0x6965('0x3'));var rp=require(_0x6965('0x4'));var moment=require(_0x6965('0x5'));var BPromise=require(_0x6965('0x6'));var Mustache=require('mustache');var util=require(_0x6965('0x7'));var path=require('path');var sox=require(_0x6965('0x8'));var csv=require('to-csv');var ejs=require(_0x6965('0x9'));var fs=require('fs');var fs_extra=require(_0x6965('0xa'));var _=require(_0x6965('0xb'));var squel=require('squel');var crypto=require(_0x6965('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6965('0xd'));var toCsv=require(_0x6965('0xe'));var querystring=require(_0x6965('0xf'));var Papa=require(_0x6965('0x10'));var Redis=require(_0x6965('0x11'));var authService=require(_0x6965('0x12'));var qs=require(_0x6965('0x13'));var as=require(_0x6965('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6965('0x15'))(_0x6965('0x16'));var utils=require(_0x6965('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6965('0x18'));var db=require(_0x6965('0x19'))['db'];function respondWithStatusCode(_0x2e0109,_0x15169e){_0x15169e=_0x15169e||0xcc;return function(_0x4f8f48){if(_0x4f8f48){return _0x2e0109[_0x6965('0x1a')](_0x15169e);}return _0x2e0109[_0x6965('0x1b')](_0x15169e)['end']();};}function respondWithResult(_0x223318,_0x52f385){_0x52f385=_0x52f385||0xc8;return function(_0x534fee){if(_0x534fee){return _0x223318['status'](_0x52f385)[_0x6965('0x1c')](_0x534fee);}};}function respondWithFilteredResult(_0x2bfd97,_0x2ec07d){return function(_0x4b0342){if(_0x4b0342){var _0x3a14cf=typeof _0x2ec07d['offset']==='undefined'&&typeof _0x2ec07d[_0x6965('0x1d')]===_0x6965('0x1e');var _0x58aab6=_0x4b0342['count'];var _0x2c3ceb=_0x3a14cf?0x0:_0x2ec07d[_0x6965('0x1f')];var _0x2157a9=_0x3a14cf?_0x4b0342['count']:_0x2ec07d[_0x6965('0x1f')]+_0x2ec07d[_0x6965('0x1d')];var _0x1c4f77;if(_0x2157a9>=_0x58aab6){_0x2157a9=_0x58aab6;_0x1c4f77=0xc8;}else{_0x1c4f77=0xce;}_0x2bfd97[_0x6965('0x1b')](_0x1c4f77);return _0x2bfd97[_0x6965('0x20')](_0x6965('0x21'),_0x2c3ceb+'-'+_0x2157a9+'/'+_0x58aab6)[_0x6965('0x1c')](_0x4b0342);}return null;};}function patchUpdates(_0x2d9b10){return function(_0xdd7083){try{jsonpatch['apply'](_0xdd7083,_0x2d9b10,!![]);}catch(_0x10d7a1){return BPromise[_0x6965('0x22')](_0x10d7a1);}return _0xdd7083[_0x6965('0x23')]();};}function saveUpdates(_0x338c37,_0x569710){return function(_0x419c0e){if(_0x419c0e){return _0x419c0e[_0x6965('0x24')](_0x338c37)[_0x6965('0x25')](function(_0x356f1b){return _0x356f1b;});}return null;};}function removeEntity(_0x31a726,_0x3b9555){return function(_0x1d1afd){if(_0x1d1afd){return _0x1d1afd[_0x6965('0x26')]()[_0x6965('0x25')](function(){_0x31a726[_0x6965('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c253b,_0x21a8f2){return function(_0x298346){if(!_0x298346){_0x4c253b[_0x6965('0x1a')](0x194);}return _0x298346;};}function handleError(_0x1c46a4,_0x402c5e){_0x402c5e=_0x402c5e||0x1f4;return function(_0x19ea80){logger[_0x6965('0x27')](_0x19ea80['stack']);if(_0x19ea80['name']){delete _0x19ea80[_0x6965('0x28')];}_0x1c46a4[_0x6965('0x1b')](_0x402c5e)[_0x6965('0x29')](_0x19ea80);};}exports['index']=function(_0x3e4378,_0x267d60){var _0x57c4ce={},_0x4882cb={},_0x2620e1={'count':0x0,'rows':[]};var _0x2d5bcb=_[_0x6965('0x2a')](db['Automation']['rawAttributes'],function(_0x59b7f7){return{'name':_0x59b7f7[_0x6965('0x2b')],'type':_0x59b7f7[_0x6965('0x2c')][_0x6965('0x2d')]};});_0x4882cb['model']=_[_0x6965('0x2a')](_0x2d5bcb,_0x6965('0x28'));_0x4882cb[_0x6965('0x2e')]=_['keys'](_0x3e4378[_0x6965('0x2e')]);_0x4882cb[_0x6965('0x2f')]=_[_0x6965('0x30')](_0x4882cb[_0x6965('0x31')],_0x4882cb[_0x6965('0x2e')]);_0x57c4ce[_0x6965('0x32')]=_[_0x6965('0x30')](_0x4882cb[_0x6965('0x31')],qs[_0x6965('0x33')](_0x3e4378[_0x6965('0x2e')][_0x6965('0x33')]));_0x57c4ce['attributes']=_0x57c4ce[_0x6965('0x32')][_0x6965('0x34')]?_0x57c4ce[_0x6965('0x32')]:_0x4882cb['model'];if(!_0x3e4378['query'][_0x6965('0x35')](_0x6965('0x36'))){_0x57c4ce[_0x6965('0x1d')]=qs[_0x6965('0x1d')](_0x3e4378[_0x6965('0x2e')][_0x6965('0x1d')]);_0x57c4ce[_0x6965('0x1f')]=qs[_0x6965('0x1f')](_0x3e4378[_0x6965('0x2e')]['offset']);}_0x57c4ce[_0x6965('0x37')]=qs[_0x6965('0x38')](_0x3e4378[_0x6965('0x2e')][_0x6965('0x38')]);_0x57c4ce[_0x6965('0x39')]=qs['filters'](_[_0x6965('0x3a')](_0x3e4378[_0x6965('0x2e')],_0x4882cb[_0x6965('0x2f')]),_0x2d5bcb);if(_0x3e4378[_0x6965('0x2e')][_0x6965('0x3b')]){_0x57c4ce[_0x6965('0x39')]=_['merge'](_0x57c4ce['where'],{'$or':_['map'](_0x2d5bcb,function(_0x10abbc){if(_0x10abbc[_0x6965('0x2c')]!=='VIRTUAL'){var _0x4f4bab={};_0x4f4bab[_0x10abbc['name']]={'$like':'%'+_0x3e4378[_0x6965('0x2e')][_0x6965('0x3b')]+'%'};return _0x4f4bab;}})});}_0x57c4ce=_[_0x6965('0x3c')]({},_0x57c4ce,_0x3e4378[_0x6965('0x3d')]);var _0x235e94={'where':_0x57c4ce['where']};return db['Automation'][_0x6965('0x3e')](_0x235e94)['then'](function(_0x6ff23f){_0x2620e1[_0x6965('0x3e')]=_0x6ff23f;if(_0x3e4378[_0x6965('0x2e')][_0x6965('0x3f')]){_0x57c4ce[_0x6965('0x40')]=[{'all':!![]}];}return db[_0x6965('0x41')][_0x6965('0x42')](_0x57c4ce);})['then'](function(_0x448751){_0x2620e1[_0x6965('0x43')]=_0x448751;return _0x2620e1;})[_0x6965('0x25')](respondWithFilteredResult(_0x267d60,_0x57c4ce))[_0x6965('0x44')](handleError(_0x267d60,null));};exports[_0x6965('0x45')]=function(_0x9810f4,_0x24e8d2){var _0x279934={'raw':![],'where':{'id':_0x9810f4[_0x6965('0x46')]['id']}},_0x250353={};_0x250353['model']=_[_0x6965('0x47')](db[_0x6965('0x41')][_0x6965('0x48')]);_0x250353[_0x6965('0x2e')]=_[_0x6965('0x47')](_0x9810f4[_0x6965('0x2e')]);_0x250353[_0x6965('0x2f')]=_[_0x6965('0x30')](_0x250353[_0x6965('0x31')],_0x250353[_0x6965('0x2e')]);_0x279934['attributes']=_[_0x6965('0x30')](_0x250353[_0x6965('0x31')],qs['fields'](_0x9810f4['query'][_0x6965('0x33')]));_0x279934[_0x6965('0x32')]=_0x279934[_0x6965('0x32')][_0x6965('0x34')]?_0x279934['attributes']:_0x250353[_0x6965('0x31')];if(_0x9810f4[_0x6965('0x2e')]['includeAll']){_0x279934[_0x6965('0x40')]=[{'all':!![]}];}_0x279934=_[_0x6965('0x3c')]({},_0x279934,_0x9810f4[_0x6965('0x3d')]);return db[_0x6965('0x41')][_0x6965('0x49')](_0x279934)[_0x6965('0x25')](handleEntityNotFound(_0x24e8d2,null))[_0x6965('0x25')](respondWithResult(_0x24e8d2,null))[_0x6965('0x44')](handleError(_0x24e8d2,null));};exports['create']=function(_0x26fc68,_0x3fd941){return db['Automation'][_0x6965('0x4a')](_0x26fc68[_0x6965('0x4b')],{})[_0x6965('0x25')](respondWithResult(_0x3fd941,0xc9))['catch'](handleError(_0x3fd941,null));};exports[_0x6965('0x24')]=function(_0x6935d1,_0x57b382){if(_0x6935d1[_0x6965('0x4b')]['id']){delete _0x6935d1[_0x6965('0x4b')]['id'];}return db['Automation']['find']({'where':{'id':_0x6935d1[_0x6965('0x46')]['id']}})['then'](handleEntityNotFound(_0x57b382,null))['then'](saveUpdates(_0x6935d1[_0x6965('0x4b')],null))[_0x6965('0x25')](respondWithResult(_0x57b382,null))[_0x6965('0x44')](handleError(_0x57b382,null));};exports[_0x6965('0x26')]=function(_0x5032d7,_0x13a433){return db[_0x6965('0x41')][_0x6965('0x49')]({'where':{'id':_0x5032d7[_0x6965('0x46')]['id']}})[_0x6965('0x25')](handleEntityNotFound(_0x13a433,null))[_0x6965('0x25')](removeEntity(_0x13a433,null))['catch'](handleError(_0x13a433,null));};exports[_0x6965('0x4c')]=function(_0x166602,_0x22fc11,_0x37a265){return db[_0x6965('0x4d')]['find']({'where':{'id':_0x166602[_0x6965('0x46')]['id']}})['then'](handleEntityNotFound(_0x22fc11,null))['then'](function(_0x419072){if(_0x419072){return _0x419072['addConditions'](_0x166602[_0x6965('0x4b')]['ids'],_['omit'](_0x166602[_0x6965('0x4b')],[_0x6965('0x4e'),'id'])||{});}})[_0x6965('0x25')](respondWithResult(_0x22fc11,null))[_0x6965('0x44')](handleError(_0x22fc11,null));};exports['getConditions']=function(_0x14e4a6,_0x99c157,_0x1bafa0){var _0x293b0b={};var _0x55d865={};var _0x472a92;var _0x905251;return db[_0x6965('0x41')]['findOne']({'where':{'id':_0x14e4a6[_0x6965('0x46')]['id']}})[_0x6965('0x25')](handleEntityNotFound(_0x99c157,null))[_0x6965('0x25')](function(_0x19e797){if(_0x19e797){_0x472a92=_0x19e797;_0x55d865[_0x6965('0x31')]=_[_0x6965('0x47')](db[_0x6965('0x4d')][_0x6965('0x48')]);_0x55d865['query']=_['keys'](_0x14e4a6[_0x6965('0x2e')]);_0x55d865[_0x6965('0x2f')]=_[_0x6965('0x30')](_0x55d865[_0x6965('0x31')],_0x55d865[_0x6965('0x2e')]);_0x293b0b['attributes']=_['intersection'](_0x55d865['model'],qs[_0x6965('0x33')](_0x14e4a6[_0x6965('0x2e')][_0x6965('0x33')]));_0x293b0b[_0x6965('0x32')]=_0x293b0b['attributes']['length']?_0x293b0b[_0x6965('0x32')]:_0x55d865[_0x6965('0x31')];_0x293b0b['order']=qs[_0x6965('0x38')](_0x14e4a6['query'][_0x6965('0x38')]);_0x293b0b['where']=qs[_0x6965('0x2f')](_['pick'](_0x14e4a6[_0x6965('0x2e')],_0x55d865[_0x6965('0x2f')]));if(_0x14e4a6[_0x6965('0x2e')][_0x6965('0x3b')]){_0x293b0b['where']=_[_0x6965('0x3c')](_0x293b0b[_0x6965('0x39')],{'$or':_[_0x6965('0x2a')](_0x293b0b[_0x6965('0x32')],function(_0x127bae){var _0x6ecab8={};_0x6ecab8[_0x127bae]={'$like':'%'+_0x14e4a6[_0x6965('0x2e')]['filter']+'%'};return _0x6ecab8;})});}_0x293b0b=_[_0x6965('0x3c')]({},_0x293b0b,_0x14e4a6['options']);return _0x472a92['getConditions'](_0x293b0b);}})[_0x6965('0x25')](function(_0xe63f63){if(_0xe63f63){_0x905251=_0xe63f63[_0x6965('0x34')];if(!_0x14e4a6[_0x6965('0x2e')]['hasOwnProperty']('nolimit')){_0x293b0b[_0x6965('0x1d')]=qs['limit'](_0x14e4a6[_0x6965('0x2e')][_0x6965('0x1d')]);_0x293b0b[_0x6965('0x1f')]=qs['offset'](_0x14e4a6[_0x6965('0x2e')][_0x6965('0x1f')]);}return _0x472a92[_0x6965('0x4f')](_0x293b0b);}})[_0x6965('0x25')](function(_0x2198e2){if(_0x2198e2){return _0x2198e2?{'count':_0x905251,'rows':_0x2198e2}:null;}})['then'](respondWithResult(_0x99c157,null))[_0x6965('0x44')](handleError(_0x99c157,null));};exports['addActions']=function(_0x2ab3be,_0x28de18,_0x4f03be){return db[_0x6965('0x50')]['find']({'where':{'id':_0x2ab3be['params']['id']}})[_0x6965('0x25')](handleEntityNotFound(_0x28de18,null))[_0x6965('0x25')](function(_0x167733){if(_0x167733){return _0x167733[_0x6965('0x51')](_0x2ab3be[_0x6965('0x4b')][_0x6965('0x4e')],_['omit'](_0x2ab3be[_0x6965('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x28de18,null))[_0x6965('0x44')](handleError(_0x28de18,null));};exports[_0x6965('0x52')]=function(_0x2100c9,_0x536fe8,_0x3dd64c){var _0x422f91={};var _0x27722c={};var _0x4f720e;var _0x10075a;return db['Automation'][_0x6965('0x53')]({'where':{'id':_0x2100c9[_0x6965('0x46')]['id']}})[_0x6965('0x25')](handleEntityNotFound(_0x536fe8,null))['then'](function(_0x5a88ff){if(_0x5a88ff){_0x4f720e=_0x5a88ff;_0x27722c[_0x6965('0x31')]=_[_0x6965('0x47')](db['Action']['rawAttributes']);_0x27722c['query']=_[_0x6965('0x47')](_0x2100c9['query']);_0x27722c[_0x6965('0x2f')]=_[_0x6965('0x30')](_0x27722c[_0x6965('0x31')],_0x27722c['query']);_0x422f91[_0x6965('0x32')]=_[_0x6965('0x30')](_0x27722c[_0x6965('0x31')],qs[_0x6965('0x33')](_0x2100c9[_0x6965('0x2e')][_0x6965('0x33')]));_0x422f91[_0x6965('0x32')]=_0x422f91[_0x6965('0x32')][_0x6965('0x34')]?_0x422f91[_0x6965('0x32')]:_0x27722c[_0x6965('0x31')];_0x422f91[_0x6965('0x37')]=qs[_0x6965('0x38')](_0x2100c9[_0x6965('0x2e')][_0x6965('0x38')]);_0x422f91[_0x6965('0x39')]=qs[_0x6965('0x2f')](_[_0x6965('0x3a')](_0x2100c9[_0x6965('0x2e')],_0x27722c['filters']));if(_0x2100c9[_0x6965('0x2e')][_0x6965('0x3b')]){_0x422f91['where']=_[_0x6965('0x3c')](_0x422f91[_0x6965('0x39')],{'$or':_[_0x6965('0x2a')](_0x422f91[_0x6965('0x32')],function(_0x49b8db){var _0x43bd8f={};_0x43bd8f[_0x49b8db]={'$like':'%'+_0x2100c9[_0x6965('0x2e')][_0x6965('0x3b')]+'%'};return _0x43bd8f;})});}_0x422f91=_['merge']({},_0x422f91,_0x2100c9[_0x6965('0x3d')]);return _0x4f720e[_0x6965('0x52')](_0x422f91);}})[_0x6965('0x25')](function(_0x5a2de7){if(_0x5a2de7){_0x10075a=_0x5a2de7['length'];if(!_0x2100c9[_0x6965('0x2e')][_0x6965('0x35')](_0x6965('0x36'))){_0x422f91[_0x6965('0x1d')]=qs[_0x6965('0x1d')](_0x2100c9[_0x6965('0x2e')]['limit']);_0x422f91[_0x6965('0x1f')]=qs[_0x6965('0x1f')](_0x2100c9['query'][_0x6965('0x1f')]);}return _0x4f720e[_0x6965('0x52')](_0x422f91);}})[_0x6965('0x25')](function(_0x30246f){if(_0x30246f){return _0x30246f?{'count':_0x10075a,'rows':_0x30246f}:null;}})[_0x6965('0x25')](respondWithResult(_0x536fe8,null))['catch'](handleError(_0x536fe8,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d28b1c5..12968a7 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 _0x07a3=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x130dfb,_0x5ab467){var _0x120281=function(_0x139952){while(--_0x139952){_0x130dfb['push'](_0x130dfb['shift']());}};_0x120281(++_0x5ab467);}(_0x07a3,0x1ea));var _0x307a=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x07a3[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x307a('0x0'));var util=require('util');var logger=require(_0x307a('0x1'))(_0x307a('0x2'));var moment=require(_0x307a('0x3'));var BPromise=require(_0x307a('0x4'));var rp=require(_0x307a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x307a('0x6'));var config=require(_0x307a('0x7'));var attributes=require(_0x307a('0x8'));module[_0x307a('0x9')]=function(_0x18a12c,_0x54740e){return _0x18a12c['define']('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2b1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2b1,0xcf));var _0x1b2b=function(_0x24ee4d,_0x346b64){_0x24ee4d=_0x24ee4d-0x0;var _0x305b6d=_0xb2b1[_0x24ee4d];return _0x305b6d;};'use strict';var _=require(_0x1b2b('0x0'));var util=require(_0x1b2b('0x1'));var logger=require(_0x1b2b('0x2'))(_0x1b2b('0x3'));var moment=require(_0x1b2b('0x4'));var BPromise=require(_0x1b2b('0x5'));var rp=require(_0x1b2b('0x6'));var fs=require('fs');var path=require(_0x1b2b('0x7'));var rimraf=require(_0x1b2b('0x8'));var config=require(_0x1b2b('0x9'));var attributes=require(_0x1b2b('0xa'));module[_0x1b2b('0xb')]=function(_0x4d3467,_0x18e7b4){return _0x4d3467[_0x1b2b('0xc')](_0x1b2b('0xd'),attributes,{'tableName':_0x1b2b('0xe'),'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 e319ed6..92b2776 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 _0x45d8=['../../config/utils','rpc','../../config/environment','http','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1fcc7d,_0x4eb620){var _0x3daa39=function(_0x2b90f9){while(--_0x2b90f9){_0x1fcc7d['push'](_0x1fcc7d['shift']());}};_0x3daa39(++_0x4eb620);}(_0x45d8,0x174));var _0x845d=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x45d8[_0x2a453b];return _0x132f79;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var moment=require(_0x845d('0x2'));var BPromise=require(_0x845d('0x3'));var rs=require(_0x845d('0x4'));var fs=require('fs');var Redis=require(_0x845d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x845d('0x6'));var logger=require('../../config/logger')(_0x845d('0x7'));var config=require(_0x845d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x845d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a59a2,_0x33c493,_0x94a7f5){return new BPromise(function(_0x34a0bf,_0xc26c7d){return client[_0x845d('0xa')](_0x4a59a2,_0x94a7f5)[_0x845d('0xb')](function(_0x5a9113){logger[_0x845d('0xc')](_0x845d('0xd'),_0x33c493,'request\x20sent');logger['debug'](_0x845d('0xe'),_0x33c493,_0x845d('0xf'),JSON[_0x845d('0x10')](_0x5a9113));if(_0x5a9113[_0x845d('0x11')]){if(_0x5a9113[_0x845d('0x11')]['code']===0x1f4){logger[_0x845d('0x11')](_0x845d('0xd'),_0x33c493,_0x5a9113[_0x845d('0x11')][_0x845d('0x12')]);return _0xc26c7d(_0x5a9113['error']['message']);}logger[_0x845d('0x11')](_0x845d('0xd'),_0x33c493,_0x5a9113[_0x845d('0x11')]['message']);return _0x34a0bf(_0x5a9113[_0x845d('0x11')]['message']);}else{logger[_0x845d('0xc')]('Automation,\x20%s,\x20%s',_0x33c493,_0x845d('0xf'));_0x34a0bf(_0x5a9113[_0x845d('0x13')][_0x845d('0x12')]);}})[_0x845d('0x14')](function(_0x2a592){logger['error']('Automation,\x20%s,\x20%s',_0x33c493,_0x2a592);_0xc26c7d(_0x2a592);});});} \ No newline at end of file +var _0x5236=['http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b9d76,_0x1051ec){var _0x404112=function(_0xe695cd){while(--_0xe695cd){_0x2b9d76['push'](_0x2b9d76['shift']());}};_0x404112(++_0x1051ec);}(_0x5236,0x109));var _0x6523=function(_0x2e177f,_0x277cd4){_0x2e177f=_0x2e177f-0x0;var _0x148734=_0x5236[_0x2e177f];return _0x148734;};'use strict';var _=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var moment=require(_0x6523('0x2'));var BPromise=require(_0x6523('0x3'));var rs=require(_0x6523('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6523('0x5'))['db'];var utils=require(_0x6523('0x6'));var logger=require('../../config/logger')(_0x6523('0x7'));var config=require(_0x6523('0x8'));var jayson=require(_0x6523('0x9'));var client=jayson[_0x6523('0xa')][_0x6523('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53548c,_0x32e99c,_0x17b335){return new BPromise(function(_0x24550b,_0x514e29){return client[_0x6523('0xc')](_0x53548c,_0x17b335)[_0x6523('0xd')](function(_0x2afd63){logger[_0x6523('0xe')](_0x6523('0xf'),_0x32e99c,_0x6523('0x10'));logger['debug'](_0x6523('0x11'),_0x32e99c,_0x6523('0x10'),JSON[_0x6523('0x12')](_0x2afd63));if(_0x2afd63[_0x6523('0x13')]){if(_0x2afd63[_0x6523('0x13')]['code']===0x1f4){logger[_0x6523('0x13')](_0x6523('0xf'),_0x32e99c,_0x2afd63['error'][_0x6523('0x14')]);return _0x514e29(_0x2afd63['error']['message']);}logger[_0x6523('0x13')](_0x6523('0xf'),_0x32e99c,_0x2afd63[_0x6523('0x13')][_0x6523('0x14')]);return _0x24550b(_0x2afd63[_0x6523('0x13')][_0x6523('0x14')]);}else{logger['info'](_0x6523('0xf'),_0x32e99c,'request\x20sent');_0x24550b(_0x2afd63[_0x6523('0x15')][_0x6523('0x14')]);}})[_0x6523('0x16')](function(_0x34acbe){logger[_0x6523('0x13')](_0x6523('0xf'),_0x32e99c,_0x34acbe);_0x514e29(_0x34acbe);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 8977b89..6711d7b 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 _0x7f42=['index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get'];(function(_0x1ca829,_0x36ee42){var _0x46b52a=function(_0x313bd4){while(--_0x313bd4){_0x1ca829['push'](_0x1ca829['shift']());}};_0x46b52a(++_0x36ee42);}(_0x7f42,0x1dd));var _0x27f4=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7f42[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x27f4('0x0'));var util=require('util');var path=require(_0x27f4('0x1'));var timeout=require(_0x27f4('0x2'));var express=require('express');var router=express[_0x27f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x27f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x27f4('0x5'));var controller=require('./automation.controller');router[_0x27f4('0x6')]('/',auth['isAuthenticated'](),controller[_0x27f4('0x7')]);router[_0x27f4('0x6')](_0x27f4('0x8'),auth[_0x27f4('0x9')](),controller[_0x27f4('0xa')]);router[_0x27f4('0x6')](_0x27f4('0xb'),auth[_0x27f4('0x9')](),controller[_0x27f4('0xc')]);router[_0x27f4('0x6')](_0x27f4('0xd'),auth[_0x27f4('0x9')](),controller[_0x27f4('0xe')]);router[_0x27f4('0xf')]('/',auth[_0x27f4('0x9')](),controller[_0x27f4('0x10')]);router[_0x27f4('0xf')](_0x27f4('0xb'),auth['isAuthenticated'](),controller['addConditions']);router[_0x27f4('0xf')](_0x27f4('0xd'),auth[_0x27f4('0x9')](),controller[_0x27f4('0x11')]);router[_0x27f4('0x12')](_0x27f4('0x8'),auth[_0x27f4('0x9')](),controller[_0x27f4('0x13')]);router['delete']('/:id',auth[_0x27f4('0x9')](),controller[_0x27f4('0x14')]);module[_0x27f4('0x15')]=router; \ No newline at end of file +var _0x524a=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addActions','/:id','update'];(function(_0x365309,_0x31275a){var _0x197b05=function(_0x1666fc){while(--_0x1666fc){_0x365309['push'](_0x365309['shift']());}};_0x197b05(++_0x31275a);}(_0x524a,0xf5));var _0xa524=function(_0x267ea4,_0x4e191e){_0x267ea4=_0x267ea4-0x0;var _0x113e83=_0x524a[_0x267ea4];return _0x113e83;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require('express');var router=express[_0xa524('0x4')]();var fs_extra=require(_0xa524('0x5'));var auth=require(_0xa524('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa524('0x7'));router[_0xa524('0x8')]('/',auth[_0xa524('0x9')](),controller['index']);router[_0xa524('0x8')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0xa')]);router['get'](_0xa524('0xb'),auth[_0xa524('0x9')](),controller[_0xa524('0xc')]);router[_0xa524('0x8')](_0xa524('0xd'),auth['isAuthenticated'](),controller[_0xa524('0xe')]);router[_0xa524('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa524('0xf')](_0xa524('0xb'),auth[_0xa524('0x9')](),controller['addConditions']);router['post'](_0xa524('0xd'),auth['isAuthenticated'](),controller[_0xa524('0x10')]);router['put'](_0xa524('0x11'),auth['isAuthenticated'](),controller[_0xa524('0x12')]);router[_0xa524('0x13')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0x14')]);module[_0xa524('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5159d4b..a5316ea 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 _0xa292=['never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always'];(function(_0x4e4e2e,_0x383975){var _0x5eb19e=function(_0xa5839d){while(--_0xa5839d){_0x4e4e2e['push'](_0x4e4e2e['shift']());}};_0x5eb19e(++_0x383975);}(_0xa292,0x156));var _0x2a29=function(_0x5257bf,_0xf39844){_0x5257bf=_0x5257bf-0x0;var _0x30f32b=_0xa292[_0x5257bf];return _0x30f32b;};'use strict';var Sequelize=require(_0x2a29('0x0'));module[_0x2a29('0x1')]={'name':{'type':Sequelize[_0x2a29('0x2')],'unique':_0x2a29('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2a29('0x4')](_0x2a29('0x5')),'allowNull':![],'defaultValue':_0x2a29('0x5')},'description':{'type':Sequelize[_0x2a29('0x2')]},'active':{'type':Sequelize[_0x2a29('0x6')],'defaultValue':0x0,'comment':_0x2a29('0x7')},'limitCalls':{'type':Sequelize[_0x2a29('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2a29('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2a29('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2a29('0x8')](0x3)[_0x2a29('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a29('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a29('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2a29('0x8')](0x5)[_0x2a29('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a29('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a29('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a29('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2a29('0x8')](0x5)[_0x2a29('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2a29('0x8')](0x3)[_0x2a29('0xa')],'defaultValue':0x3,'comment':_0x2a29('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2a29('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2a29('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2a29('0xf')},'dialTimezone':{'type':Sequelize[_0x2a29('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2a29('0x2')],'defaultValue':_0x2a29('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x2a29('0x11'),_0x2a29('0x12'),'onlyIfOpen'),'defaultValue':_0x2a29('0x11')},'dialAMDActive':{'type':Sequelize[_0x2a29('0x6')],'defaultValue':0x0,'comment':_0x2a29('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x2a29('0x8')](0x9)[_0x2a29('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2a29('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x2a29('0x8')](0x9)[_0x2a29('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2a29('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2a29('0x8')](0x9)[_0x2a29('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2a29('0x8')](0x9)[_0x2a29('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2a29('0x8')](0x9)[_0x2a29('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2a29('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2a29('0x8')](0x9)[_0x2a29('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2a29('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2a29('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2a29('0x8')](0x5)[_0x2a29('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2a29('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2a29('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2a29('0x4')](_0x2a29('0x19'),_0x2a29('0x1a')),'defaultValue':_0x2a29('0x19')},'dialPrefix':{'type':Sequelize[_0x2a29('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x2a29('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a29('0x1b')},'dialCutDigit':{'type':Sequelize[_0x2a29('0x8')](0x3)[_0x2a29('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a29('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2a29('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a29('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2a29('0x8')](0x5)[_0x2a29('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a29('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a29('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x2a29('0x8')](0x5)[_0x2a29('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a29('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a29('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2a29('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x2a29('0x8')](0x3)[_0x2a29('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a29('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2a29('0x8')](0x5)[_0x2a29('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a29('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2a29('0x8')](0x3)[_0x2a29('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a29('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2a29('0x8')](0x5)[_0x2a29('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a29('0x23')}}; \ No newline at end of file +var _0x071f=['Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','INTEGER','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','ENUM','ivr','BOOLEAN'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0x071f,0xab));var _0xf071=function(_0x98432f,_0x277eee){_0x98432f=_0x98432f-0x0;var _0x2f1051=_0x071f[_0x98432f];return _0x2f1051;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf071('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf071('0x1')](_0xf071('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xf071('0x0')]},'active':{'type':Sequelize[_0xf071('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf071('0x4')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf071('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf071('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf071('0x6')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf071('0x7')](0x5)[_0xf071('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf071('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0xf071('0x7')](0x3)[_0xf071('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf071('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf071('0x7')](0x5)[_0xf071('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf071('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf071('0x7')](0x3)[_0xf071('0x5')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf071('0x7')](0x5)[_0xf071('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf071('0xb')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf071('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf071('0xc')},'dialTimezone':{'type':Sequelize[_0xf071('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf071('0x0')],'defaultValue':_0xf071('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xf071('0x1')](_0xf071('0xe'),_0xf071('0xf'),_0xf071('0x10')),'defaultValue':_0xf071('0xe')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf071('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xf071('0x7')](0x9)[_0xf071('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf071('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xf071('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf071('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf071('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf071('0x7')](0x9)[_0xf071('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf071('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xf071('0x7')](0x9)[_0xf071('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf071('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf071('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf071('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf071('0x7')](0x9)[_0xf071('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf071('0x7')](0x5)[_0xf071('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf071('0x7')](0x9)[_0xf071('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf071('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf071('0x1')](_0xf071('0x18'),_0xf071('0x19')),'defaultValue':_0xf071('0x18')},'dialPrefix':{'type':Sequelize[_0xf071('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf071('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xf071('0x7')](0x3)[_0xf071('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf071('0x7')](0x3)[_0xf071('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf071('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf071('0x7')](0x5)[_0xf071('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf071('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xf071('0x7')](0x3)[_0xf071('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf071('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xf071('0x7')](0x5)[_0xf071('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf071('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf071('0x7')](0x3)[_0xf071('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf071('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf071('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf071('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf071('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf071('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf071('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf071('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf071('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf071('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 65df3f7..220a306 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 _0x0794=['UserProfileResource','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','Campaign','rows','params','fields','create','body','user','role','UserProfileSection','find','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','destroy','getHoppers','CmHopper','hasOwnProperty','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','include','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get'];(function(_0x2835b1,_0xfb2d8c){var _0x2bd661=function(_0x2f24f0){while(--_0x2f24f0){_0x2835b1['push'](_0x2835b1['shift']());}};_0x2bd661(++_0xfb2d8c);}(_0x0794,0x168));var _0x4079=function(_0x53bbe0,_0x3ca06d){_0x53bbe0=_0x53bbe0-0x0;var _0x4cd8bd=_0x0794[_0x53bbe0];return _0x4cd8bd;};'use strict';var emlformat=require(_0x4079('0x0'));var rimraf=require(_0x4079('0x1'));var zipdir=require(_0x4079('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4079('0x3'));var Mustache=require(_0x4079('0x4'));var util=require(_0x4079('0x5'));var path=require(_0x4079('0x6'));var sox=require(_0x4079('0x7'));var csv=require(_0x4079('0x8'));var ejs=require(_0x4079('0x9'));var fs=require('fs');var fs_extra=require(_0x4079('0xa'));var _=require(_0x4079('0xb'));var squel=require(_0x4079('0xc'));var crypto=require(_0x4079('0xd'));var jsforce=require(_0x4079('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4079('0x8'));var querystring=require(_0x4079('0xf'));var Papa=require(_0x4079('0x10'));var Redis=require('ioredis');var authService=require(_0x4079('0x11'));var qs=require(_0x4079('0x12'));var as=require(_0x4079('0x13'));var hardwareService=require(_0x4079('0x14'));var logger=require(_0x4079('0x15'))(_0x4079('0x16'));var utils=require(_0x4079('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f376b,_0x24e85d){_0x24e85d=_0x24e85d||0xcc;return function(_0x3166ad){if(_0x3166ad){return _0x1f376b[_0x4079('0x18')](_0x24e85d);}return _0x1f376b[_0x4079('0x19')](_0x24e85d)[_0x4079('0x1a')]();};}function respondWithResult(_0x5b9c91,_0x5078cb){_0x5078cb=_0x5078cb||0xc8;return function(_0xb4a1f9){if(_0xb4a1f9){return _0x5b9c91[_0x4079('0x19')](_0x5078cb)[_0x4079('0x1b')](_0xb4a1f9);}};}function respondWithFilteredResult(_0xd23c66,_0x2fdf3b){return function(_0x2c4712){if(_0x2c4712){var _0x4e025b=typeof _0x2fdf3b['offset']===_0x4079('0x1c')&&typeof _0x2fdf3b[_0x4079('0x1d')]===_0x4079('0x1c');var _0x242eee=_0x2c4712[_0x4079('0x1e')];var _0x4429a7=_0x4e025b?0x0:_0x2fdf3b[_0x4079('0x1f')];var _0x113902=_0x4e025b?_0x2c4712[_0x4079('0x1e')]:_0x2fdf3b[_0x4079('0x1f')]+_0x2fdf3b[_0x4079('0x1d')];var _0x5d333f;if(_0x113902>=_0x242eee){_0x113902=_0x242eee;_0x5d333f=0xc8;}else{_0x5d333f=0xce;}_0xd23c66[_0x4079('0x19')](_0x5d333f);return _0xd23c66[_0x4079('0x20')](_0x4079('0x21'),_0x4429a7+'-'+_0x113902+'/'+_0x242eee)[_0x4079('0x1b')](_0x2c4712);}return null;};}function patchUpdates(_0x42feb8){return function(_0x171039){try{jsonpatch['apply'](_0x171039,_0x42feb8,!![]);}catch(_0x383fcf){return BPromise[_0x4079('0x22')](_0x383fcf);}return _0x171039[_0x4079('0x23')]();};}function saveUpdates(_0x47f78d,_0x44c904){return function(_0x40e428){if(_0x40e428){return _0x40e428[_0x4079('0x24')](_0x47f78d)[_0x4079('0x25')](function(_0x1d6c19){return _0x1d6c19;});}return null;};}function removeEntity(_0x5c2f74,_0x462fbe){return function(_0x1fd362){if(_0x1fd362){return _0x1fd362['destroy']()[_0x4079('0x25')](function(){var _0x1f2d33=_0x1fd362[_0x4079('0x26')]({'plain':!![]});var _0x384584='IvrCampaigns';return db[_0x4079('0x27')]['destroy']({'where':{'type':_0x384584,'resourceId':_0x1f2d33['id']}})[_0x4079('0x25')](function(){return _0x1fd362;});})[_0x4079('0x25')](function(){_0x5c2f74[_0x4079('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49378d,_0x7c1029){return function(_0x5d9a7c){if(!_0x5d9a7c){_0x49378d[_0x4079('0x18')](0x194);}return _0x5d9a7c;};}function handleError(_0x3d80f5,_0x297eae){_0x297eae=_0x297eae||0x1f4;return function(_0x2774a5){logger['error'](_0x2774a5[_0x4079('0x28')]);if(_0x2774a5[_0x4079('0x29')]){delete _0x2774a5[_0x4079('0x29')];}_0x3d80f5[_0x4079('0x19')](_0x297eae)['send'](_0x2774a5);};}exports['index']=function(_0x500b1a,_0x36921a){var _0x22588d={},_0x54a8f2={},_0x3a06b={'count':0x0,'rows':[]};var _0x1e4bd7=_[_0x4079('0x2a')](db['Campaign'][_0x4079('0x2b')],function(_0x1280a4){return{'name':_0x1280a4[_0x4079('0x2c')],'type':_0x1280a4[_0x4079('0x2d')]['key']};});_0x54a8f2[_0x4079('0x2e')]=_[_0x4079('0x2a')](_0x1e4bd7,_0x4079('0x29'));_0x54a8f2[_0x4079('0x2f')]=_[_0x4079('0x30')](_0x500b1a['query']);_0x54a8f2[_0x4079('0x31')]=_[_0x4079('0x32')](_0x54a8f2[_0x4079('0x2e')],_0x54a8f2[_0x4079('0x2f')]);_0x22588d[_0x4079('0x33')]=_[_0x4079('0x32')](_0x54a8f2[_0x4079('0x2e')],qs['fields'](_0x500b1a[_0x4079('0x2f')]['fields']));_0x22588d[_0x4079('0x33')]=_0x22588d['attributes'][_0x4079('0x34')]?_0x22588d[_0x4079('0x33')]:_0x54a8f2['model'];if(!_0x500b1a[_0x4079('0x2f')]['hasOwnProperty'](_0x4079('0x35'))){_0x22588d['limit']=qs['limit'](_0x500b1a[_0x4079('0x2f')][_0x4079('0x1d')]);_0x22588d[_0x4079('0x1f')]=qs[_0x4079('0x1f')](_0x500b1a[_0x4079('0x2f')][_0x4079('0x1f')]);}_0x22588d[_0x4079('0x36')]=qs[_0x4079('0x37')](_0x500b1a['query'][_0x4079('0x37')]);_0x22588d[_0x4079('0x38')]=qs[_0x4079('0x31')](_[_0x4079('0x39')](_0x500b1a['query'],_0x54a8f2['filters']),_0x1e4bd7);if(_0x500b1a[_0x4079('0x2f')]['filter']){_0x22588d[_0x4079('0x38')]=_[_0x4079('0x3a')](_0x22588d[_0x4079('0x38')],{'$or':_[_0x4079('0x2a')](_0x1e4bd7,function(_0x56cc60){if(_0x56cc60[_0x4079('0x2d')]!==_0x4079('0x3b')){var _0x5b29a3={};_0x5b29a3[_0x56cc60[_0x4079('0x29')]]={'$like':'%'+_0x500b1a[_0x4079('0x2f')][_0x4079('0x3c')]+'%'};return _0x5b29a3;}})});}_0x22588d=_['merge']({},_0x22588d,_0x500b1a[_0x4079('0x3d')]);var _0x2c694d={'where':_0x22588d[_0x4079('0x38')]};return db['Campaign'][_0x4079('0x1e')](_0x2c694d)[_0x4079('0x25')](function(_0x1d2a95){_0x3a06b['count']=_0x1d2a95;if(_0x500b1a[_0x4079('0x2f')][_0x4079('0x3e')]){_0x22588d['include']=[{'all':!![]}];}return db[_0x4079('0x3f')]['findAll'](_0x22588d);})['then'](function(_0x487f9e){_0x3a06b[_0x4079('0x40')]=_0x487f9e;return _0x3a06b;})['then'](respondWithFilteredResult(_0x36921a,_0x22588d))['catch'](handleError(_0x36921a,null));};exports['show']=function(_0x3a8cc2,_0x5b23af){var _0x36dfa2={'raw':![],'where':{'id':_0x3a8cc2[_0x4079('0x41')]['id']}},_0x52683d={};_0x52683d[_0x4079('0x2e')]=_[_0x4079('0x30')](db[_0x4079('0x3f')][_0x4079('0x2b')]);_0x52683d[_0x4079('0x2f')]=_[_0x4079('0x30')](_0x3a8cc2[_0x4079('0x2f')]);_0x52683d[_0x4079('0x31')]=_['intersection'](_0x52683d['model'],_0x52683d[_0x4079('0x2f')]);_0x36dfa2['attributes']=_['intersection'](_0x52683d[_0x4079('0x2e')],qs[_0x4079('0x42')](_0x3a8cc2['query'][_0x4079('0x42')]));_0x36dfa2['attributes']=_0x36dfa2[_0x4079('0x33')][_0x4079('0x34')]?_0x36dfa2[_0x4079('0x33')]:_0x52683d['model'];if(_0x3a8cc2[_0x4079('0x2f')][_0x4079('0x3e')]){_0x36dfa2['include']=[{'all':!![]}];}_0x36dfa2=_[_0x4079('0x3a')]({},_0x36dfa2,_0x3a8cc2[_0x4079('0x3d')]);return db[_0x4079('0x3f')]['find'](_0x36dfa2)[_0x4079('0x25')](handleEntityNotFound(_0x5b23af,null))['then'](respondWithResult(_0x5b23af,null))['catch'](handleError(_0x5b23af,null));};exports[_0x4079('0x43')]=function(_0x37e99b,_0x126958){return db[_0x4079('0x3f')]['create'](_0x37e99b[_0x4079('0x44')],{})['then'](function(_0x52f16e){var _0x4d2b4d=_0x37e99b[_0x4079('0x45')][_0x4079('0x26')]({'plain':!![]});if(!_0x4d2b4d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d2b4d[_0x4079('0x46')]===_0x4079('0x45')){var _0x36d127=_0x52f16e[_0x4079('0x26')]({'plain':!![]});var _0x1896f6='IvrCampaigns';return db[_0x4079('0x47')][_0x4079('0x48')]({'where':{'name':_0x1896f6,'userProfileId':_0x4d2b4d['userProfileId']},'raw':!![]})[_0x4079('0x25')](function(_0x427f3b){if(_0x427f3b&&_0x427f3b[_0x4079('0x49')]===0x0){return db[_0x4079('0x27')][_0x4079('0x43')]({'name':_0x36d127['name'],'resourceId':_0x36d127['id'],'type':_0x427f3b[_0x4079('0x29')],'sectionId':_0x427f3b['id']},{})['then'](function(){return _0x52f16e;});}else{return _0x52f16e;}})[_0x4079('0x4a')](function(_0x214305){logger[_0x4079('0x4b')](_0x4079('0x4c'),_0x214305);throw _0x214305;});}return _0x52f16e;})['then'](respondWithResult(_0x126958,0xc9))['catch'](handleError(_0x126958,null));};exports['clone']=function(_0x275fb3,_0x13f68d){var _0x1bc4b5={'where':{'id':_0x275fb3[_0x4079('0x41')]['id']}},_0x53608e={};_0x53608e['model']=_[_0x4079('0x30')](db['Campaign'][_0x4079('0x2b')]);_0x1bc4b5['attributes']=_['intersection'](_0x53608e[_0x4079('0x2e')],qs[_0x4079('0x42')](_0x275fb3['query'][_0x4079('0x42')]));_0x1bc4b5[_0x4079('0x33')]=_0x1bc4b5['attributes'][_0x4079('0x34')]?_0x1bc4b5[_0x4079('0x33')]:_0x53608e[_0x4079('0x2e')];if(_0x275fb3[_0x4079('0x2f')][_0x4079('0x3e')]){_0x1bc4b5['include']=[{'all':!![]}];}_0x1bc4b5=_[_0x4079('0x3a')]({},_0x1bc4b5,_0x275fb3[_0x4079('0x3d')]);return db['Campaign'][_0x4079('0x48')](_0x1bc4b5)[_0x4079('0x25')](handleEntityNotFound(_0x13f68d,null))['then'](function(_0x15a850){if(_0x15a850){var _0x59fbce=_0x15a850[_0x4079('0x26')]({'plain':!![]});_0x59fbce=qs[_0x4079('0x4d')](_0x59fbce,['id',_0x4079('0x4e'),_0x4079('0x4f')]);_0x275fb3[_0x4079('0x44')]=_['omit'](_0x275fb3[_0x4079('0x44')],['id',_0x4079('0x4e'),'updatedAt']);return db[_0x4079('0x3f')][_0x4079('0x43')](_[_0x4079('0x3a')](_0x59fbce,_0x275fb3[_0x4079('0x44')]),{'include':_0x275fb3[_0x4079('0x2f')][_0x4079('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x30e137){var _0x1b785c=_0x275fb3[_0x4079('0x45')]['get']({'plain':!![]});if(!_0x1b785c)throw new Error(_0x4079('0x50'));if(_0x1b785c[_0x4079('0x46')]===_0x4079('0x45')){var _0x389d5d=_0x30e137['get']({'plain':!![]});var _0x15b78e='IvrCampaigns';return db[_0x4079('0x47')][_0x4079('0x48')]({'where':{'name':_0x15b78e,'userProfileId':_0x1b785c[_0x4079('0x51')]},'raw':!![]})[_0x4079('0x25')](function(_0x1f9108){if(_0x1f9108&&_0x1f9108['autoAssociation']===0x0){return db[_0x4079('0x27')][_0x4079('0x43')]({'name':_0x389d5d['name'],'resourceId':_0x389d5d['id'],'type':_0x1f9108[_0x4079('0x29')],'sectionId':_0x1f9108['id']},{})[_0x4079('0x25')](function(){return _0x30e137;});}else{return _0x30e137;}})[_0x4079('0x4a')](function(_0x40a52d){logger[_0x4079('0x4b')](_0x4079('0x4c'),_0x40a52d);throw _0x40a52d;});}return _0x30e137;});}})[_0x4079('0x25')](respondWithResult(_0x13f68d,0xc9))[_0x4079('0x4a')](handleError(_0x13f68d,null));};exports[_0x4079('0x24')]=function(_0x375aef,_0x2d95ad){if(_0x375aef['body']['id']){delete _0x375aef[_0x4079('0x44')]['id'];}return db[_0x4079('0x3f')][_0x4079('0x48')]({'where':{'id':_0x375aef[_0x4079('0x41')]['id']}})[_0x4079('0x25')](handleEntityNotFound(_0x2d95ad,null))[_0x4079('0x25')](saveUpdates(_0x375aef[_0x4079('0x44')],null))[_0x4079('0x25')](respondWithResult(_0x2d95ad,null))[_0x4079('0x4a')](handleError(_0x2d95ad,null));};exports[_0x4079('0x52')]=function(_0x57d518,_0x44767a){return db[_0x4079('0x3f')][_0x4079('0x48')]({'where':{'id':_0x57d518[_0x4079('0x41')]['id']}})[_0x4079('0x25')](handleEntityNotFound(_0x44767a,null))[_0x4079('0x25')](removeEntity(_0x44767a,null))['catch'](handleError(_0x44767a,null));};exports[_0x4079('0x53')]=function(_0x394a5d,_0x4573a0,_0x1d888e){var _0xb6057b={'raw':!![],'where':{}};var _0x5c113e={};var _0x455a4a={'count':0x0,'rows':[]};return db[_0x4079('0x3f')]['findOne']({'where':{'id':_0x394a5d[_0x4079('0x41')]['id']}})[_0x4079('0x25')](handleEntityNotFound(_0x4573a0,null))[_0x4079('0x25')](function(_0x59236e){if(_0x59236e){_0x5c113e[_0x4079('0x2e')]=_[_0x4079('0x30')](db[_0x4079('0x54')]['rawAttributes']);_0x5c113e[_0x4079('0x2f')]=_[_0x4079('0x30')](_0x394a5d[_0x4079('0x2f')]);_0x5c113e[_0x4079('0x31')]=_['intersection'](_0x5c113e[_0x4079('0x2e')],_0x5c113e[_0x4079('0x2f')]);_0xb6057b[_0x4079('0x33')]=_['intersection'](_0x5c113e[_0x4079('0x2e')],qs['fields'](_0x394a5d[_0x4079('0x2f')][_0x4079('0x42')]));_0xb6057b[_0x4079('0x33')]=_0xb6057b['attributes'][_0x4079('0x34')]?_0xb6057b[_0x4079('0x33')]:_0x5c113e['model'];if(!_0x394a5d['query'][_0x4079('0x55')](_0x4079('0x35'))){_0xb6057b['limit']=qs[_0x4079('0x1d')](_0x394a5d['query'][_0x4079('0x1d')]);_0xb6057b[_0x4079('0x1f')]=qs['offset'](_0x394a5d[_0x4079('0x2f')][_0x4079('0x1f')]);}_0xb6057b[_0x4079('0x36')]=qs[_0x4079('0x37')](_0x394a5d[_0x4079('0x2f')][_0x4079('0x37')]);_0xb6057b[_0x4079('0x38')]=qs[_0x4079('0x31')](_[_0x4079('0x39')](_0x394a5d['query'],_0x5c113e['filters']));_0xb6057b['where'][_0x4079('0x56')]=_0x59236e['id'];if(_0x394a5d['query'][_0x4079('0x3c')]){_0xb6057b[_0x4079('0x38')]=_[_0x4079('0x3a')](_0xb6057b[_0x4079('0x38')],{'$or':_[_0x4079('0x2a')](_0xb6057b[_0x4079('0x33')],function(_0x5c2675){var _0x4f988b={};_0x4f988b[_0x5c2675]={'$like':'%'+_0x394a5d[_0x4079('0x2f')][_0x4079('0x3c')]+'%'};return _0x4f988b;})});}_0xb6057b=_['merge']({},_0xb6057b,_0x394a5d[_0x4079('0x3d')]);return db[_0x4079('0x54')][_0x4079('0x1e')]({'where':_0xb6057b[_0x4079('0x38')]})[_0x4079('0x25')](function(_0x5cd1f4){_0x455a4a['count']=_0x5cd1f4;if(_0x394a5d[_0x4079('0x2f')][_0x4079('0x3e')]){_0xb6057b['include']=[{'all':!![]}];}return db['CmHopper'][_0x4079('0x57')](_0xb6057b);})[_0x4079('0x25')](function(_0x47255c){_0x455a4a['rows']=_0x47255c;return _0x455a4a;});}})[_0x4079('0x25')](respondWithFilteredResult(_0x4573a0,_0xb6057b))['catch'](handleError(_0x4573a0,null));};exports[_0x4079('0x58')]=function(_0xe7b9c3,_0x18d2b7,_0x59b891){var _0x1332fa={'raw':!![],'where':{}};var _0x5c6aaf={};var _0x1e67a4={'count':0x0,'rows':[]};return db[_0x4079('0x3f')]['findOne']({'where':{'id':_0xe7b9c3[_0x4079('0x41')]['id']}})['then'](handleEntityNotFound(_0x18d2b7,null))[_0x4079('0x25')](function(_0x2d7b65){if(_0x2d7b65){_0x5c6aaf['model']=_[_0x4079('0x30')](db['CmHopperHistory'][_0x4079('0x2b')]);_0x5c6aaf[_0x4079('0x2f')]=_['keys'](_0xe7b9c3[_0x4079('0x2f')]);_0x5c6aaf['filters']=_[_0x4079('0x32')](_0x5c6aaf[_0x4079('0x2e')],_0x5c6aaf[_0x4079('0x2f')]);_0x1332fa[_0x4079('0x33')]=_[_0x4079('0x32')](_0x5c6aaf['model'],qs[_0x4079('0x42')](_0xe7b9c3['query'][_0x4079('0x42')]));_0x1332fa['attributes']=_0x1332fa[_0x4079('0x33')][_0x4079('0x34')]?_0x1332fa[_0x4079('0x33')]:_0x5c6aaf['model'];if(!_0xe7b9c3[_0x4079('0x2f')]['hasOwnProperty'](_0x4079('0x35'))){_0x1332fa['limit']=qs[_0x4079('0x1d')](_0xe7b9c3['query']['limit']);_0x1332fa['offset']=qs['offset'](_0xe7b9c3[_0x4079('0x2f')][_0x4079('0x1f')]);}_0x1332fa[_0x4079('0x36')]=qs[_0x4079('0x37')](_0xe7b9c3['query'][_0x4079('0x37')]);_0x1332fa[_0x4079('0x38')]=qs[_0x4079('0x31')](_['pick'](_0xe7b9c3[_0x4079('0x2f')],_0x5c6aaf['filters']));_0x1332fa[_0x4079('0x38')][_0x4079('0x56')]=_0x2d7b65['id'];if(_0xe7b9c3[_0x4079('0x2f')]['filter']){_0x1332fa['where']=_[_0x4079('0x3a')](_0x1332fa[_0x4079('0x38')],{'$or':_[_0x4079('0x2a')](_0x1332fa[_0x4079('0x33')],function(_0x1b644e){var _0x3be819={};_0x3be819[_0x1b644e]={'$like':'%'+_0xe7b9c3[_0x4079('0x2f')][_0x4079('0x3c')]+'%'};return _0x3be819;})});}_0x1332fa=_['merge']({},_0x1332fa,_0xe7b9c3[_0x4079('0x3d')]);return db[_0x4079('0x59')]['count']({'where':_0x1332fa[_0x4079('0x38')]})[_0x4079('0x25')](function(_0x498a06){_0x1e67a4[_0x4079('0x1e')]=_0x498a06;if(_0xe7b9c3[_0x4079('0x2f')][_0x4079('0x3e')]){_0x1332fa['include']=[{'all':!![]}];}return db[_0x4079('0x59')]['findAll'](_0x1332fa);})['then'](function(_0x37ef69){_0x1e67a4[_0x4079('0x40')]=_0x37ef69;return _0x1e67a4;});}})[_0x4079('0x25')](respondWithFilteredResult(_0x18d2b7,_0x1332fa))[_0x4079('0x4a')](handleError(_0x18d2b7,null));};exports[_0x4079('0x5a')]=function(_0x33e9f9,_0x129142,_0x1de281){var _0x2dac6f={'raw':!![],'where':{}};var _0x1c5b5a={};var _0x55c0bc={'count':0x0,'rows':[]};return db[_0x4079('0x3f')][_0x4079('0x5b')]({'where':{'id':_0x33e9f9[_0x4079('0x41')]['id']}})[_0x4079('0x25')](handleEntityNotFound(_0x129142,null))[_0x4079('0x25')](function(_0x3e2b82){if(_0x3e2b82){_0x1c5b5a[_0x4079('0x2e')]=_[_0x4079('0x30')](db[_0x4079('0x5c')][_0x4079('0x2b')]);_0x1c5b5a[_0x4079('0x2f')]=_['keys'](_0x33e9f9['query']);_0x1c5b5a[_0x4079('0x31')]=_[_0x4079('0x32')](_0x1c5b5a[_0x4079('0x2e')],_0x1c5b5a[_0x4079('0x2f')]);_0x2dac6f[_0x4079('0x33')]=_[_0x4079('0x32')](_0x1c5b5a['model'],qs['fields'](_0x33e9f9[_0x4079('0x2f')][_0x4079('0x42')]));_0x2dac6f[_0x4079('0x33')]=_0x2dac6f[_0x4079('0x33')][_0x4079('0x34')]?_0x2dac6f[_0x4079('0x33')]:_0x1c5b5a[_0x4079('0x2e')];if(!_0x33e9f9[_0x4079('0x2f')][_0x4079('0x55')](_0x4079('0x35'))){_0x2dac6f[_0x4079('0x1d')]=qs[_0x4079('0x1d')](_0x33e9f9[_0x4079('0x2f')][_0x4079('0x1d')]);_0x2dac6f['offset']=qs['offset'](_0x33e9f9['query']['offset']);}_0x2dac6f['order']=qs[_0x4079('0x37')](_0x33e9f9[_0x4079('0x2f')]['sort']);_0x2dac6f[_0x4079('0x38')]=qs[_0x4079('0x31')](_[_0x4079('0x39')](_0x33e9f9[_0x4079('0x2f')],_0x1c5b5a['filters']));_0x2dac6f[_0x4079('0x38')][_0x4079('0x56')]=_0x3e2b82['id'];if(_0x33e9f9[_0x4079('0x2f')][_0x4079('0x3c')]){_0x2dac6f[_0x4079('0x38')]=_[_0x4079('0x3a')](_0x2dac6f[_0x4079('0x38')],{'$or':_[_0x4079('0x2a')](_0x2dac6f[_0x4079('0x33')],function(_0x1f1965){var _0x4149ad={};_0x4149ad[_0x1f1965]={'$like':'%'+_0x33e9f9[_0x4079('0x2f')][_0x4079('0x3c')]+'%'};return _0x4149ad;})});}_0x2dac6f=_[_0x4079('0x3a')]({},_0x2dac6f,_0x33e9f9[_0x4079('0x3d')]);return db[_0x4079('0x5c')]['count']({'where':_0x2dac6f[_0x4079('0x38')]})[_0x4079('0x25')](function(_0x133201){_0x55c0bc['count']=_0x133201;if(_0x33e9f9[_0x4079('0x2f')][_0x4079('0x3e')]){_0x2dac6f[_0x4079('0x5d')]=[{'all':!![]}];}return db[_0x4079('0x5c')][_0x4079('0x57')](_0x2dac6f);})['then'](function(_0x3f0bba){_0x55c0bc['rows']=_0x3f0bba;return _0x55c0bc;});}})[_0x4079('0x25')](respondWithFilteredResult(_0x129142,_0x2dac6f))[_0x4079('0x4a')](handleError(_0x129142,null));};exports[_0x4079('0x5e')]=function(_0x3590f4,_0x51cc6c,_0x54fa21){var _0xe633ba={'raw':!![],'where':{}};var _0x36e901={};var _0x4e89c5={'count':0x0,'rows':[]};return db['Campaign'][_0x4079('0x5b')]({'where':{'id':_0x3590f4['params']['id']}})[_0x4079('0x25')](handleEntityNotFound(_0x51cc6c,null))[_0x4079('0x25')](function(_0x418a21){if(_0x418a21){_0x36e901[_0x4079('0x2e')]=_[_0x4079('0x30')](db[_0x4079('0x5f')][_0x4079('0x2b')]);_0x36e901[_0x4079('0x2f')]=_[_0x4079('0x30')](_0x3590f4[_0x4079('0x2f')]);_0x36e901[_0x4079('0x31')]=_[_0x4079('0x32')](_0x36e901[_0x4079('0x2e')],_0x36e901['query']);_0xe633ba[_0x4079('0x33')]=_['intersection'](_0x36e901['model'],qs[_0x4079('0x42')](_0x3590f4[_0x4079('0x2f')]['fields']));_0xe633ba[_0x4079('0x33')]=_0xe633ba[_0x4079('0x33')]['length']?_0xe633ba[_0x4079('0x33')]:_0x36e901[_0x4079('0x2e')];if(!_0x3590f4[_0x4079('0x2f')][_0x4079('0x55')](_0x4079('0x35'))){_0xe633ba[_0x4079('0x1d')]=qs['limit'](_0x3590f4[_0x4079('0x2f')][_0x4079('0x1d')]);_0xe633ba[_0x4079('0x1f')]=qs[_0x4079('0x1f')](_0x3590f4[_0x4079('0x2f')]['offset']);}_0xe633ba[_0x4079('0x36')]=qs[_0x4079('0x37')](_0x3590f4[_0x4079('0x2f')]['sort']);_0xe633ba[_0x4079('0x38')]=qs[_0x4079('0x31')](_[_0x4079('0x39')](_0x3590f4[_0x4079('0x2f')],_0x36e901[_0x4079('0x31')]));_0xe633ba['where'][_0x4079('0x56')]=_0x418a21['id'];if(_0x3590f4['query']['filter']){_0xe633ba[_0x4079('0x38')]=_['merge'](_0xe633ba['where'],{'$or':_[_0x4079('0x2a')](_0xe633ba[_0x4079('0x33')],function(_0x3df065){var _0x4a087f={};_0x4a087f[_0x3df065]={'$like':'%'+_0x3590f4[_0x4079('0x2f')]['filter']+'%'};return _0x4a087f;})});}_0xe633ba=_[_0x4079('0x3a')]({},_0xe633ba,_0x3590f4[_0x4079('0x3d')]);return db['CmHopperBlack'][_0x4079('0x1e')]({'where':_0xe633ba[_0x4079('0x38')]})[_0x4079('0x25')](function(_0x313719){_0x4e89c5[_0x4079('0x1e')]=_0x313719;if(_0x3590f4[_0x4079('0x2f')][_0x4079('0x3e')]){_0xe633ba[_0x4079('0x5d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x4079('0x57')](_0xe633ba);})['then'](function(_0x4dc020){_0x4e89c5[_0x4079('0x40')]=_0x4dc020;return _0x4e89c5;});}})[_0x4079('0x25')](respondWithFilteredResult(_0x51cc6c,_0xe633ba))[_0x4079('0x4a')](handleError(_0x51cc6c,null));};exports[_0x4079('0x60')]=function(_0x56a80e,_0x130b1d,_0x1f9486){var _0x32e6f1={};var _0x1e8981={};var _0x32dc74;var _0x13d693;return db[_0x4079('0x3f')]['findOne']({'where':{'id':_0x56a80e[_0x4079('0x41')]['id']}})['then'](handleEntityNotFound(_0x130b1d,null))[_0x4079('0x25')](function(_0x43a453){if(_0x43a453){_0x32dc74=_0x43a453;_0x1e8981[_0x4079('0x2e')]=_[_0x4079('0x30')](db['CmList'][_0x4079('0x2b')]);_0x1e8981['query']=_[_0x4079('0x30')](_0x56a80e[_0x4079('0x2f')]);_0x1e8981['filters']=_[_0x4079('0x32')](_0x1e8981[_0x4079('0x2e')],_0x1e8981[_0x4079('0x2f')]);_0x32e6f1[_0x4079('0x33')]=_['intersection'](_0x1e8981[_0x4079('0x2e')],qs[_0x4079('0x42')](_0x56a80e[_0x4079('0x2f')]['fields']));_0x32e6f1[_0x4079('0x33')]=_0x32e6f1[_0x4079('0x33')][_0x4079('0x34')]?_0x32e6f1[_0x4079('0x33')]:_0x1e8981[_0x4079('0x2e')];_0x32e6f1['order']=qs['sort'](_0x56a80e['query'][_0x4079('0x37')]);_0x32e6f1[_0x4079('0x38')]=qs[_0x4079('0x31')](_[_0x4079('0x39')](_0x56a80e['query'],_0x1e8981[_0x4079('0x31')]));if(_0x56a80e[_0x4079('0x2f')]['filter']){_0x32e6f1[_0x4079('0x38')]=_[_0x4079('0x3a')](_0x32e6f1[_0x4079('0x38')],{'$or':_[_0x4079('0x2a')](_0x32e6f1[_0x4079('0x33')],function(_0x4abcc4){var _0x207832={};_0x207832[_0x4abcc4]={'$like':'%'+_0x56a80e[_0x4079('0x2f')][_0x4079('0x3c')]+'%'};return _0x207832;})});}_0x32e6f1=_['merge']({},_0x32e6f1,_0x56a80e[_0x4079('0x3d')]);return _0x32dc74[_0x4079('0x60')](_0x32e6f1);}})[_0x4079('0x25')](function(_0x4282cf){if(_0x4282cf){_0x13d693=_0x4282cf[_0x4079('0x34')];if(!_0x56a80e['query'][_0x4079('0x55')]('nolimit')){_0x32e6f1[_0x4079('0x1d')]=qs[_0x4079('0x1d')](_0x56a80e[_0x4079('0x2f')][_0x4079('0x1d')]);_0x32e6f1[_0x4079('0x1f')]=qs[_0x4079('0x1f')](_0x56a80e['query'][_0x4079('0x1f')]);}return _0x32dc74[_0x4079('0x60')](_0x32e6f1);}})[_0x4079('0x25')](function(_0x4b9e0d){if(_0x4b9e0d){return _0x4b9e0d?{'count':_0x13d693,'rows':_0x4b9e0d}:null;}})[_0x4079('0x25')](respondWithResult(_0x130b1d,null))[_0x4079('0x4a')](handleError(_0x130b1d,null));};exports['addLists']=function(_0x3c809e,_0x45fc15,_0xd2f588){var _0x2120f9,_0xf423cb;return db['Campaign']['find']({'where':{'id':_0x3c809e['params']['id']}})[_0x4079('0x25')](handleEntityNotFound(_0x45fc15,null))[_0x4079('0x25')](function(_0x7b2c79){if(_0x7b2c79){_0xf423cb=_0x7b2c79;return _0x7b2c79[_0x4079('0x61')](_0x3c809e['body'][_0x4079('0x62')],_[_0x4079('0x4d')](_0x3c809e['body'],[_0x4079('0x62'),'id'])||{});}return null;})[_0x4079('0x63')](function(_0x2c0d22){var _0x267ccb;_0x2120f9=_0x2c0d22||[];var _0xd722fe=[];if(_0x2c0d22){for(var _0x553067=0x0;_0x553067<_0x2c0d22['length'];_0x553067+=0x1){var _0x14ac8f=_0x2c0d22[_0x553067]['get']({'plain':!![]});_0xf423cb['dialCheckDuplicateType']=_0x3c809e[_0x4079('0x44')][_0x4079('0x64')]?_0x3c809e[_0x4079('0x44')][_0x4079('0x64')]:_0xf423cb[_0x4079('0x64')];switch(_0xf423cb[_0x4079('0x64')]){case _0x4079('0x65'):_0x267ccb=squel[_0x4079('0x66')]()[_0x4079('0x67')](_0x4079('0x68'))[_0x4079('0x69')]([_0x4079('0x6a'),_0x4079('0x6b'),_0x4079('0x6c'),_0x4079('0x6d'),_0x4079('0x56'),_0x4079('0x4e'),_0x4079('0x4f')],squel[_0x4079('0x6e')]()['field'](_0x4079('0x6a'),_0x4079('0x6a'))[_0x4079('0x6f')](_0x4079('0x70'),_0x4079('0x6b'))[_0x4079('0x6f')]('id','ContactId')[_0x4079('0x6f')](_0x14ac8f[_0x4079('0x71')]['toString'](),_0x4079('0x6d'))[_0x4079('0x6f')](_0x3c809e['params']['id'][_0x4079('0x72')](),_0x4079('0x56'))[_0x4079('0x6f')]('NOW()',_0x4079('0x4e'))[_0x4079('0x6f')](_0x4079('0x70'),_0x4079('0x4f'))['from'](_0x4079('0x73'))[_0x4079('0x38')](_0x4079('0x74'))['where']('ListId\x20=\x20?',_0x14ac8f[_0x4079('0x71')][_0x4079('0x72')]())[_0x4079('0x38')](_0x4079('0x75'))[_0x4079('0x38')](_0x4079('0x76'),squel[_0x4079('0x6e')]()[_0x4079('0x6f')](_0x4079('0x77'))['from'](_0x4079('0x78'))['where'](_0x4079('0x79'),_0x3c809e[_0x4079('0x41')]['id']['toString']()))['where'](_0x4079('0x76'),squel['select']()[_0x4079('0x6f')](_0x4079('0x7a'))[_0x4079('0x7b')]('cm_hopper')[_0x4079('0x38')]('CampaignId\x20=\x20?',_0x3c809e['params']['id'][_0x4079('0x72')]())))[_0x4079('0x72')]();break;case'onlyIfOpen':_0x267ccb=squel['insert']()['into'](_0x4079('0x68'))[_0x4079('0x69')]([_0x4079('0x6a'),'scheduledAt',_0x4079('0x6c'),_0x4079('0x6d'),_0x4079('0x56'),_0x4079('0x4e'),'updatedAt'],squel[_0x4079('0x6e')]()[_0x4079('0x6f')](_0x4079('0x6a'),'phone')[_0x4079('0x6f')]('NOW()',_0x4079('0x6b'))[_0x4079('0x6f')]('id','ContactId')[_0x4079('0x6f')](_0x14ac8f[_0x4079('0x71')][_0x4079('0x72')](),'ListId')['field'](_0x3c809e['params']['id']['toString'](),_0x4079('0x56'))['field'](_0x4079('0x70'),_0x4079('0x4e'))['field'](_0x4079('0x70'),_0x4079('0x4f'))[_0x4079('0x7b')](_0x4079('0x73'))[_0x4079('0x38')](_0x4079('0x74'))[_0x4079('0x38')](_0x4079('0x7c'),_0x14ac8f[_0x4079('0x71')]['toString']())[_0x4079('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x4079('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4079('0x6e')]()[_0x4079('0x6f')]('COALESCE(phone,\x27\x27)')[_0x4079('0x7b')](_0x4079('0x68'))[_0x4079('0x38')](_0x4079('0x79'),_0x3c809e[_0x4079('0x41')]['id'][_0x4079('0x72')]())))[_0x4079('0x72')]();break;default:_0x267ccb=squel[_0x4079('0x66')]()[_0x4079('0x67')](_0x4079('0x68'))['fromQuery']([_0x4079('0x6a'),_0x4079('0x6b'),'ContactId',_0x4079('0x6d'),_0x4079('0x56'),_0x4079('0x4e'),_0x4079('0x4f')],squel['select']()['field'](_0x4079('0x6a'),_0x4079('0x6a'))[_0x4079('0x6f')](_0x4079('0x70'),_0x4079('0x6b'))[_0x4079('0x6f')]('id',_0x4079('0x6c'))[_0x4079('0x6f')](_0x14ac8f[_0x4079('0x71')][_0x4079('0x72')](),_0x4079('0x6d'))[_0x4079('0x6f')](_0x3c809e[_0x4079('0x41')]['id'][_0x4079('0x72')](),'CampaignId')['field'](_0x4079('0x70'),_0x4079('0x4e'))[_0x4079('0x6f')](_0x4079('0x70'),_0x4079('0x4f'))[_0x4079('0x7b')](_0x4079('0x73'))[_0x4079('0x38')](_0x4079('0x74'))[_0x4079('0x38')](_0x4079('0x7c'),_0x14ac8f[_0x4079('0x71')]['toString']())[_0x4079('0x38')](_0x4079('0x75')))[_0x4079('0x72')]();}_0xd722fe[_0x4079('0x7d')](db[_0x4079('0x7e')][_0x4079('0x2f')](_0x267ccb));}return BPromise[_0x4079('0x7f')](_0xd722fe);}})[_0x4079('0x25')](function(){return _0x2120f9;})['then'](respondWithResult(_0x45fc15,null))[_0x4079('0x4a')](handleError(_0x45fc15,null));};exports[_0x4079('0x80')]=function(_0x52dcd8,_0x116cc0,_0x3c0ef3){return db[_0x4079('0x3f')][_0x4079('0x48')]({'where':{'id':_0x52dcd8['params']['id']}})[_0x4079('0x25')](handleEntityNotFound(_0x116cc0,null))[_0x4079('0x25')](function(_0x2e047c){if(_0x2e047c){return _0x2e047c[_0x4079('0x80')](_0x52dcd8[_0x4079('0x2f')][_0x4079('0x62')]);}})[_0x4079('0x25')](function(_0x9e0e82){if(_0x9e0e82){return db[_0x4079('0x54')]['destroy']({'where':{'ListId':_0x52dcd8[_0x4079('0x2f')][_0x4079('0x62')],'CampaignId':_0x52dcd8[_0x4079('0x41')]['id']}})['then'](function(){return _0x9e0e82;});}})['then'](respondWithStatusCode(_0x116cc0,null))['catch'](handleError(_0x116cc0,null));};exports[_0x4079('0x81')]=function(_0x30d49d,_0x1f3265,_0xe7fe6a){var _0x26b5eb={};var _0x1bb00a={};var _0x452807;var _0x3d97d6;return db['Campaign'][_0x4079('0x5b')]({'where':{'id':_0x30d49d['params']['id']}})[_0x4079('0x25')](handleEntityNotFound(_0x1f3265,null))[_0x4079('0x25')](function(_0x20f07f){if(_0x20f07f){_0x452807=_0x20f07f;_0x1bb00a[_0x4079('0x2e')]=_['keys'](db[_0x4079('0x82')]['rawAttributes']);_0x1bb00a['query']=_[_0x4079('0x30')](_0x30d49d[_0x4079('0x2f')]);_0x1bb00a['filters']=_['intersection'](_0x1bb00a[_0x4079('0x2e')],_0x1bb00a[_0x4079('0x2f')]);_0x26b5eb[_0x4079('0x33')]=_[_0x4079('0x32')](_0x1bb00a[_0x4079('0x2e')],qs[_0x4079('0x42')](_0x30d49d[_0x4079('0x2f')][_0x4079('0x42')]));_0x26b5eb[_0x4079('0x33')]=_0x26b5eb[_0x4079('0x33')][_0x4079('0x34')]?_0x26b5eb[_0x4079('0x33')]:_0x1bb00a[_0x4079('0x2e')];_0x26b5eb[_0x4079('0x36')]=qs[_0x4079('0x37')](_0x30d49d[_0x4079('0x2f')][_0x4079('0x37')]);_0x26b5eb[_0x4079('0x38')]=qs['filters'](_[_0x4079('0x39')](_0x30d49d[_0x4079('0x2f')],_0x1bb00a['filters']));if(_0x30d49d[_0x4079('0x2f')]['filter']){_0x26b5eb[_0x4079('0x38')]=_[_0x4079('0x3a')](_0x26b5eb[_0x4079('0x38')],{'$or':_[_0x4079('0x2a')](_0x26b5eb[_0x4079('0x33')],function(_0x17c7f7){var _0x5a99f4={};_0x5a99f4[_0x17c7f7]={'$like':'%'+_0x30d49d[_0x4079('0x2f')][_0x4079('0x3c')]+'%'};return _0x5a99f4;})});}_0x26b5eb=_['merge']({},_0x26b5eb,_0x30d49d[_0x4079('0x3d')]);return _0x452807[_0x4079('0x81')](_0x26b5eb);}})[_0x4079('0x25')](function(_0x1e9c62){if(_0x1e9c62){_0x3d97d6=_0x1e9c62[_0x4079('0x34')];if(!_0x30d49d['query'][_0x4079('0x55')](_0x4079('0x35'))){_0x26b5eb['limit']=qs['limit'](_0x30d49d[_0x4079('0x2f')][_0x4079('0x1d')]);_0x26b5eb['offset']=qs[_0x4079('0x1f')](_0x30d49d['query'][_0x4079('0x1f')]);}return _0x452807['getBlackLists'](_0x26b5eb);}})['then'](function(_0x5121f6){if(_0x5121f6){return _0x5121f6?{'count':_0x3d97d6,'rows':_0x5121f6}:null;}})[_0x4079('0x25')](respondWithResult(_0x1f3265,null))[_0x4079('0x4a')](handleError(_0x1f3265,null));};exports[_0x4079('0x83')]=function(_0xea2875,_0x457bbc,_0x3dabbc){var _0x5a9b7a,_0x43fedd;return db['Campaign'][_0x4079('0x48')]({'where':{'id':_0xea2875['params']['id']}})['then'](handleEntityNotFound(_0x457bbc,null))[_0x4079('0x25')](function(_0x361958){if(_0x361958){_0x43fedd=_0x361958;return _0x361958[_0x4079('0x83')](_0xea2875['body'][_0x4079('0x62')],_[_0x4079('0x4d')](_0xea2875[_0x4079('0x44')],[_0x4079('0x62'),'id'])||{});}return null;})[_0x4079('0x63')](function(_0x3827d2){var _0xf140e9;_0x5a9b7a=_0x3827d2||[];var _0x29acda=[];if(_0x3827d2){for(var _0x21c12e=0x0;_0x21c12e<_0x3827d2[_0x4079('0x34')];_0x21c12e+=0x1){var _0x13c1c1=_0x3827d2[_0x21c12e][_0x4079('0x26')]({'plain':!![]});_0xf140e9=squel[_0x4079('0x66')]()['into'](_0x4079('0x84'))[_0x4079('0x69')](['phone',_0x4079('0x6c'),'ListId',_0x4079('0x56'),_0x4079('0x4e'),_0x4079('0x4f')],squel[_0x4079('0x6e')]()[_0x4079('0x6f')](_0x4079('0x6a'),'phone')['field']('id',_0x4079('0x6c'))[_0x4079('0x6f')](_0x13c1c1[_0x4079('0x71')]['toString'](),_0x4079('0x6d'))[_0x4079('0x6f')](_0xea2875[_0x4079('0x41')]['id'][_0x4079('0x72')](),'CampaignId')[_0x4079('0x6f')](_0x4079('0x70'),_0x4079('0x4e'))[_0x4079('0x6f')](_0x4079('0x70'),_0x4079('0x4f'))[_0x4079('0x7b')]('cm_contacts')[_0x4079('0x38')](_0x4079('0x74'))[_0x4079('0x38')](_0x4079('0x7c'),_0x13c1c1[_0x4079('0x71')][_0x4079('0x72')]())['where'](_0x4079('0x75')))[_0x4079('0x72')]();_0x29acda[_0x4079('0x7d')](db['sequelize'][_0x4079('0x2f')](_0xf140e9));}return BPromise[_0x4079('0x7f')](_0x29acda);}})['then'](function(){return _0x5a9b7a;})[_0x4079('0x25')](respondWithResult(_0x457bbc,null))[_0x4079('0x4a')](handleError(_0x457bbc,null));};exports['removeBlackLists']=function(_0x40c943,_0xcb264e,_0x12a706){return db[_0x4079('0x3f')][_0x4079('0x48')]({'where':{'id':_0x40c943[_0x4079('0x41')]['id']}})['then'](handleEntityNotFound(_0xcb264e,null))[_0x4079('0x25')](function(_0x501866){if(_0x501866){return _0x501866['removeBlackLists'](_0x40c943['query'][_0x4079('0x62')]);}})[_0x4079('0x25')](function(_0x1929d2){if(_0x1929d2){return db[_0x4079('0x5f')][_0x4079('0x52')]({'where':{'ListId':_0x40c943['query']['ids'],'CampaignId':_0x40c943[_0x4079('0x41')]['id']}})[_0x4079('0x25')](function(){return _0x1929d2;});}})['then'](respondWithStatusCode(_0xcb264e,null))[_0x4079('0x4a')](handleError(_0xcb264e,null));}; \ No newline at end of file +var _0xe8ea=['cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','cm_hopper','onlyIfOpen','fromQuery','phone\x20NOT\x20IN\x20(?)','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','params','findOne','pick','CampaignId','CmHopper','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','field','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)'];(function(_0x14fac6,_0x5d0726){var _0x137203=function(_0x389ccd){while(--_0x389ccd){_0x14fac6['push'](_0x14fac6['shift']());}};_0x137203(++_0x5d0726);}(_0xe8ea,0x1aa));var _0xae8e=function(_0x127b5e,_0x4ee9d2){_0x127b5e=_0x127b5e-0x0;var _0x22a0be=_0xe8ea[_0x127b5e];return _0x22a0be;};'use strict';var emlformat=require(_0xae8e('0x0'));var rimraf=require(_0xae8e('0x1'));var zipdir=require(_0xae8e('0x2'));var jsonpatch=require(_0xae8e('0x3'));var rp=require('request-promise');var moment=require(_0xae8e('0x4'));var BPromise=require(_0xae8e('0x5'));var Mustache=require(_0xae8e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xae8e('0x7'));var csv=require(_0xae8e('0x8'));var ejs=require(_0xae8e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae8e('0xa'));var squel=require('squel');var crypto=require(_0xae8e('0xb'));var jsforce=require(_0xae8e('0xc'));var deskjs=require(_0xae8e('0xd'));var toCsv=require(_0xae8e('0x8'));var querystring=require(_0xae8e('0xe'));var Papa=require(_0xae8e('0xf'));var Redis=require(_0xae8e('0x10'));var authService=require(_0xae8e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xae8e('0x12'));var hardwareService=require(_0xae8e('0x13'));var logger=require('../../config/logger')(_0xae8e('0x14'));var utils=require('../../config/utils');var config=require(_0xae8e('0x15'));var licenseUtil=require(_0xae8e('0x16'));var db=require(_0xae8e('0x17'))['db'];function respondWithStatusCode(_0x49ed2a,_0x4796a4){_0x4796a4=_0x4796a4||0xcc;return function(_0x245e6d){if(_0x245e6d){return _0x49ed2a['sendStatus'](_0x4796a4);}return _0x49ed2a[_0xae8e('0x18')](_0x4796a4)['end']();};}function respondWithResult(_0x99047d,_0x42f058){_0x42f058=_0x42f058||0xc8;return function(_0x3c2d06){if(_0x3c2d06){return _0x99047d['status'](_0x42f058)[_0xae8e('0x19')](_0x3c2d06);}};}function respondWithFilteredResult(_0x4f813b,_0x3528a7){return function(_0x13e490){if(_0x13e490){var _0x56ef6a=typeof _0x3528a7[_0xae8e('0x1a')]===_0xae8e('0x1b')&&typeof _0x3528a7[_0xae8e('0x1c')]===_0xae8e('0x1b');var _0x3f585c=_0x13e490[_0xae8e('0x1d')];var _0x58b6d6=_0x56ef6a?0x0:_0x3528a7[_0xae8e('0x1a')];var _0xa6d414=_0x56ef6a?_0x13e490[_0xae8e('0x1d')]:_0x3528a7[_0xae8e('0x1a')]+_0x3528a7[_0xae8e('0x1c')];var _0x155758;if(_0xa6d414>=_0x3f585c){_0xa6d414=_0x3f585c;_0x155758=0xc8;}else{_0x155758=0xce;}_0x4f813b[_0xae8e('0x18')](_0x155758);return _0x4f813b[_0xae8e('0x1e')](_0xae8e('0x1f'),_0x58b6d6+'-'+_0xa6d414+'/'+_0x3f585c)[_0xae8e('0x19')](_0x13e490);}return null;};}function patchUpdates(_0x515a3b){return function(_0x30eb6e){try{jsonpatch[_0xae8e('0x20')](_0x30eb6e,_0x515a3b,!![]);}catch(_0xa3f7b0){return BPromise[_0xae8e('0x21')](_0xa3f7b0);}return _0x30eb6e[_0xae8e('0x22')]();};}function saveUpdates(_0x4e6e14,_0x385e70){return function(_0x113044){if(_0x113044){return _0x113044['update'](_0x4e6e14)[_0xae8e('0x23')](function(_0x33d8a1){return _0x33d8a1;});}return null;};}function removeEntity(_0x260942,_0x3416d8){return function(_0x540b61){if(_0x540b61){return _0x540b61[_0xae8e('0x24')]()[_0xae8e('0x23')](function(){var _0x2bacdc=_0x540b61[_0xae8e('0x25')]({'plain':!![]});var _0x55c4b0='IvrCampaigns';return db[_0xae8e('0x26')][_0xae8e('0x24')]({'where':{'type':_0x55c4b0,'resourceId':_0x2bacdc['id']}})['then'](function(){return _0x540b61;});})[_0xae8e('0x23')](function(){_0x260942[_0xae8e('0x18')](0xcc)[_0xae8e('0x27')]();});}};}function handleEntityNotFound(_0x301f78,_0x5c1204){return function(_0x4db29a){if(!_0x4db29a){_0x301f78[_0xae8e('0x28')](0x194);}return _0x4db29a;};}function handleError(_0x22e563,_0x232501){_0x232501=_0x232501||0x1f4;return function(_0x3a6568){logger[_0xae8e('0x29')](_0x3a6568[_0xae8e('0x2a')]);if(_0x3a6568[_0xae8e('0x2b')]){delete _0x3a6568[_0xae8e('0x2b')];}_0x22e563[_0xae8e('0x18')](_0x232501)[_0xae8e('0x2c')](_0x3a6568);};}exports[_0xae8e('0x2d')]=function(_0x3d0c1f,_0x2f4db7){var _0x416e76={},_0x13c140={},_0x8e5f35={'count':0x0,'rows':[]};var _0x589f8a=_[_0xae8e('0x2e')](db[_0xae8e('0x2f')][_0xae8e('0x30')],function(_0x13a592){return{'name':_0x13a592[_0xae8e('0x31')],'type':_0x13a592['type'][_0xae8e('0x32')]};});_0x13c140[_0xae8e('0x33')]=_[_0xae8e('0x2e')](_0x589f8a,_0xae8e('0x2b'));_0x13c140[_0xae8e('0x34')]=_['keys'](_0x3d0c1f[_0xae8e('0x34')]);_0x13c140['filters']=_[_0xae8e('0x35')](_0x13c140[_0xae8e('0x33')],_0x13c140[_0xae8e('0x34')]);_0x416e76[_0xae8e('0x36')]=_['intersection'](_0x13c140['model'],qs[_0xae8e('0x37')](_0x3d0c1f[_0xae8e('0x34')][_0xae8e('0x37')]));_0x416e76[_0xae8e('0x36')]=_0x416e76[_0xae8e('0x36')][_0xae8e('0x38')]?_0x416e76[_0xae8e('0x36')]:_0x13c140[_0xae8e('0x33')];if(!_0x3d0c1f[_0xae8e('0x34')][_0xae8e('0x39')](_0xae8e('0x3a'))){_0x416e76['limit']=qs[_0xae8e('0x1c')](_0x3d0c1f[_0xae8e('0x34')][_0xae8e('0x1c')]);_0x416e76[_0xae8e('0x1a')]=qs[_0xae8e('0x1a')](_0x3d0c1f[_0xae8e('0x34')][_0xae8e('0x1a')]);}_0x416e76[_0xae8e('0x3b')]=qs['sort'](_0x3d0c1f[_0xae8e('0x34')][_0xae8e('0x3c')]);_0x416e76[_0xae8e('0x3d')]=qs[_0xae8e('0x3e')](_['pick'](_0x3d0c1f[_0xae8e('0x34')],_0x13c140[_0xae8e('0x3e')]),_0x589f8a);if(_0x3d0c1f[_0xae8e('0x34')][_0xae8e('0x3f')]){_0x416e76[_0xae8e('0x3d')]=_['merge'](_0x416e76[_0xae8e('0x3d')],{'$or':_['map'](_0x589f8a,function(_0x222463){if(_0x222463[_0xae8e('0x40')]!==_0xae8e('0x41')){var _0x558075={};_0x558075[_0x222463[_0xae8e('0x2b')]]={'$like':'%'+_0x3d0c1f['query'][_0xae8e('0x3f')]+'%'};return _0x558075;}})});}_0x416e76=_[_0xae8e('0x42')]({},_0x416e76,_0x3d0c1f[_0xae8e('0x43')]);var _0x32453e={'where':_0x416e76['where']};return db['Campaign'][_0xae8e('0x1d')](_0x32453e)[_0xae8e('0x23')](function(_0x270ef4){_0x8e5f35[_0xae8e('0x1d')]=_0x270ef4;if(_0x3d0c1f[_0xae8e('0x34')]['includeAll']){_0x416e76[_0xae8e('0x44')]=[{'all':!![]}];}return db[_0xae8e('0x2f')][_0xae8e('0x45')](_0x416e76);})['then'](function(_0x5300d3){_0x8e5f35[_0xae8e('0x46')]=_0x5300d3;return _0x8e5f35;})[_0xae8e('0x23')](respondWithFilteredResult(_0x2f4db7,_0x416e76))[_0xae8e('0x47')](handleError(_0x2f4db7,null));};exports[_0xae8e('0x48')]=function(_0x288bdd,_0x7a5d7a){var _0x1f8aef={'raw':![],'where':{'id':_0x288bdd['params']['id']}},_0xc6759={};_0xc6759[_0xae8e('0x33')]=_[_0xae8e('0x49')](db[_0xae8e('0x2f')][_0xae8e('0x30')]);_0xc6759[_0xae8e('0x34')]=_[_0xae8e('0x49')](_0x288bdd[_0xae8e('0x34')]);_0xc6759[_0xae8e('0x3e')]=_[_0xae8e('0x35')](_0xc6759[_0xae8e('0x33')],_0xc6759[_0xae8e('0x34')]);_0x1f8aef[_0xae8e('0x36')]=_[_0xae8e('0x35')](_0xc6759['model'],qs[_0xae8e('0x37')](_0x288bdd[_0xae8e('0x34')]['fields']));_0x1f8aef[_0xae8e('0x36')]=_0x1f8aef[_0xae8e('0x36')][_0xae8e('0x38')]?_0x1f8aef[_0xae8e('0x36')]:_0xc6759[_0xae8e('0x33')];if(_0x288bdd[_0xae8e('0x34')][_0xae8e('0x4a')]){_0x1f8aef[_0xae8e('0x44')]=[{'all':!![]}];}_0x1f8aef=_[_0xae8e('0x42')]({},_0x1f8aef,_0x288bdd[_0xae8e('0x43')]);return db['Campaign'][_0xae8e('0x4b')](_0x1f8aef)['then'](handleEntityNotFound(_0x7a5d7a,null))[_0xae8e('0x23')](respondWithResult(_0x7a5d7a,null))[_0xae8e('0x47')](handleError(_0x7a5d7a,null));};exports[_0xae8e('0x4c')]=function(_0x269e5b,_0x50a565){return db[_0xae8e('0x2f')][_0xae8e('0x4c')](_0x269e5b['body'],{})[_0xae8e('0x23')](function(_0x32044d){var _0x2c067e=_0x269e5b[_0xae8e('0x4d')]['get']({'plain':!![]});if(!_0x2c067e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c067e[_0xae8e('0x4e')]===_0xae8e('0x4d')){var _0x1bfe59=_0x32044d[_0xae8e('0x25')]({'plain':!![]});var _0x3c4190=_0xae8e('0x4f');return db[_0xae8e('0x50')]['find']({'where':{'name':_0x3c4190,'userProfileId':_0x2c067e[_0xae8e('0x51')]},'raw':!![]})[_0xae8e('0x23')](function(_0x5505d5){if(_0x5505d5&&_0x5505d5[_0xae8e('0x52')]===0x0){return db[_0xae8e('0x26')][_0xae8e('0x4c')]({'name':_0x1bfe59[_0xae8e('0x2b')],'resourceId':_0x1bfe59['id'],'type':_0x5505d5[_0xae8e('0x2b')],'sectionId':_0x5505d5['id']},{})['then'](function(){return _0x32044d;});}else{return _0x32044d;}})[_0xae8e('0x47')](function(_0x27207a){logger[_0xae8e('0x29')](_0xae8e('0x53'),_0x27207a);throw _0x27207a;});}return _0x32044d;})[_0xae8e('0x23')](respondWithResult(_0x50a565,0xc9))[_0xae8e('0x47')](handleError(_0x50a565,null));};exports['clone']=function(_0x15c483,_0x4e0e04){var _0x1b48a4={'where':{'id':_0x15c483['params']['id']}},_0x45bdb7={};_0x45bdb7['model']=_[_0xae8e('0x49')](db[_0xae8e('0x2f')][_0xae8e('0x30')]);_0x1b48a4[_0xae8e('0x36')]=_[_0xae8e('0x35')](_0x45bdb7['model'],qs[_0xae8e('0x37')](_0x15c483[_0xae8e('0x34')][_0xae8e('0x37')]));_0x1b48a4[_0xae8e('0x36')]=_0x1b48a4[_0xae8e('0x36')][_0xae8e('0x38')]?_0x1b48a4[_0xae8e('0x36')]:_0x45bdb7[_0xae8e('0x33')];if(_0x15c483[_0xae8e('0x34')][_0xae8e('0x4a')]){_0x1b48a4[_0xae8e('0x44')]=[{'all':!![]}];}_0x1b48a4=_[_0xae8e('0x42')]({},_0x1b48a4,_0x15c483['options']);return db['Campaign'][_0xae8e('0x4b')](_0x1b48a4)['then'](handleEntityNotFound(_0x4e0e04,null))['then'](function(_0x1883c0){if(_0x1883c0){var _0x30b4b0=_0x1883c0[_0xae8e('0x25')]({'plain':!![]});_0x30b4b0=qs['omit'](_0x30b4b0,['id',_0xae8e('0x54'),_0xae8e('0x55')]);_0x15c483[_0xae8e('0x56')]=_[_0xae8e('0x57')](_0x15c483[_0xae8e('0x56')],['id',_0xae8e('0x54'),_0xae8e('0x55')]);return db[_0xae8e('0x2f')][_0xae8e('0x4c')](_[_0xae8e('0x42')](_0x30b4b0,_0x15c483[_0xae8e('0x56')]),{'include':_0x15c483[_0xae8e('0x34')][_0xae8e('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b3615){var _0x54521e=_0x15c483['user'][_0xae8e('0x25')]({'plain':!![]});if(!_0x54521e)throw new Error(_0xae8e('0x58'));if(_0x54521e[_0xae8e('0x4e')]===_0xae8e('0x4d')){var _0x4857d2=_0x2b3615['get']({'plain':!![]});var _0x3ee9fb='IvrCampaigns';return db[_0xae8e('0x50')][_0xae8e('0x4b')]({'where':{'name':_0x3ee9fb,'userProfileId':_0x54521e[_0xae8e('0x51')]},'raw':!![]})[_0xae8e('0x23')](function(_0x3ffc18){if(_0x3ffc18&&_0x3ffc18[_0xae8e('0x52')]===0x0){return db[_0xae8e('0x26')][_0xae8e('0x4c')]({'name':_0x4857d2[_0xae8e('0x2b')],'resourceId':_0x4857d2['id'],'type':_0x3ffc18['name'],'sectionId':_0x3ffc18['id']},{})['then'](function(){return _0x2b3615;});}else{return _0x2b3615;}})['catch'](function(_0x2a23ae){logger['error'](_0xae8e('0x53'),_0x2a23ae);throw _0x2a23ae;});}return _0x2b3615;});}})['then'](respondWithResult(_0x4e0e04,0xc9))['catch'](handleError(_0x4e0e04,null));};exports['update']=function(_0x109e5a,_0x325af2){if(_0x109e5a['body']['id']){delete _0x109e5a['body']['id'];}return db['Campaign']['find']({'where':{'id':_0x109e5a[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x325af2,null))[_0xae8e('0x23')](saveUpdates(_0x109e5a['body'],null))['then'](respondWithResult(_0x325af2,null))[_0xae8e('0x47')](handleError(_0x325af2,null));};exports[_0xae8e('0x24')]=function(_0x3cf5d8,_0x401da1){return db['Campaign'][_0xae8e('0x4b')]({'where':{'id':_0x3cf5d8[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x401da1,null))[_0xae8e('0x23')](removeEntity(_0x401da1,null))[_0xae8e('0x47')](handleError(_0x401da1,null));};exports['getHoppers']=function(_0x1a2067,_0x323db3,_0x1dfb5f){var _0x8de537={'raw':!![],'where':{}};var _0x1eca13={};var _0x3adbe4={'count':0x0,'rows':[]};return db[_0xae8e('0x2f')][_0xae8e('0x5a')]({'where':{'id':_0x1a2067[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x323db3,null))[_0xae8e('0x23')](function(_0x321204){if(_0x321204){_0x1eca13[_0xae8e('0x33')]=_[_0xae8e('0x49')](db['CmHopper'][_0xae8e('0x30')]);_0x1eca13['query']=_[_0xae8e('0x49')](_0x1a2067[_0xae8e('0x34')]);_0x1eca13['filters']=_[_0xae8e('0x35')](_0x1eca13[_0xae8e('0x33')],_0x1eca13[_0xae8e('0x34')]);_0x8de537['attributes']=_[_0xae8e('0x35')](_0x1eca13[_0xae8e('0x33')],qs[_0xae8e('0x37')](_0x1a2067[_0xae8e('0x34')][_0xae8e('0x37')]));_0x8de537['attributes']=_0x8de537[_0xae8e('0x36')][_0xae8e('0x38')]?_0x8de537[_0xae8e('0x36')]:_0x1eca13['model'];if(!_0x1a2067[_0xae8e('0x34')][_0xae8e('0x39')](_0xae8e('0x3a'))){_0x8de537[_0xae8e('0x1c')]=qs[_0xae8e('0x1c')](_0x1a2067[_0xae8e('0x34')][_0xae8e('0x1c')]);_0x8de537[_0xae8e('0x1a')]=qs['offset'](_0x1a2067[_0xae8e('0x34')][_0xae8e('0x1a')]);}_0x8de537[_0xae8e('0x3b')]=qs['sort'](_0x1a2067['query'][_0xae8e('0x3c')]);_0x8de537['where']=qs['filters'](_[_0xae8e('0x5b')](_0x1a2067[_0xae8e('0x34')],_0x1eca13[_0xae8e('0x3e')]));_0x8de537[_0xae8e('0x3d')][_0xae8e('0x5c')]=_0x321204['id'];if(_0x1a2067[_0xae8e('0x34')]['filter']){_0x8de537[_0xae8e('0x3d')]=_[_0xae8e('0x42')](_0x8de537[_0xae8e('0x3d')],{'$or':_[_0xae8e('0x2e')](_0x8de537[_0xae8e('0x36')],function(_0x3176c0){var _0x31008b={};_0x31008b[_0x3176c0]={'$like':'%'+_0x1a2067['query'][_0xae8e('0x3f')]+'%'};return _0x31008b;})});}_0x8de537=_[_0xae8e('0x42')]({},_0x8de537,_0x1a2067['options']);return db[_0xae8e('0x5d')][_0xae8e('0x1d')]({'where':_0x8de537['where']})['then'](function(_0x1adf27){_0x3adbe4[_0xae8e('0x1d')]=_0x1adf27;if(_0x1a2067['query'][_0xae8e('0x4a')]){_0x8de537[_0xae8e('0x44')]=[{'all':!![]}];}return db[_0xae8e('0x5d')][_0xae8e('0x45')](_0x8de537);})[_0xae8e('0x23')](function(_0x317cb8){_0x3adbe4[_0xae8e('0x46')]=_0x317cb8;return _0x3adbe4;});}})['then'](respondWithFilteredResult(_0x323db3,_0x8de537))['catch'](handleError(_0x323db3,null));};exports['getHopperHistories']=function(_0xa89c13,_0x40b6ce,_0x551bf9){var _0x38cae9={'raw':!![],'where':{}};var _0x51f2cc={};var _0x39a4ac={'count':0x0,'rows':[]};return db[_0xae8e('0x2f')][_0xae8e('0x5a')]({'where':{'id':_0xa89c13[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x40b6ce,null))['then'](function(_0x541786){if(_0x541786){_0x51f2cc['model']=_[_0xae8e('0x49')](db['CmHopperHistory'][_0xae8e('0x30')]);_0x51f2cc['query']=_[_0xae8e('0x49')](_0xa89c13['query']);_0x51f2cc['filters']=_[_0xae8e('0x35')](_0x51f2cc['model'],_0x51f2cc[_0xae8e('0x34')]);_0x38cae9[_0xae8e('0x36')]=_[_0xae8e('0x35')](_0x51f2cc[_0xae8e('0x33')],qs[_0xae8e('0x37')](_0xa89c13[_0xae8e('0x34')][_0xae8e('0x37')]));_0x38cae9[_0xae8e('0x36')]=_0x38cae9[_0xae8e('0x36')]['length']?_0x38cae9[_0xae8e('0x36')]:_0x51f2cc[_0xae8e('0x33')];if(!_0xa89c13[_0xae8e('0x34')][_0xae8e('0x39')]('nolimit')){_0x38cae9[_0xae8e('0x1c')]=qs['limit'](_0xa89c13[_0xae8e('0x34')][_0xae8e('0x1c')]);_0x38cae9[_0xae8e('0x1a')]=qs[_0xae8e('0x1a')](_0xa89c13['query'][_0xae8e('0x1a')]);}_0x38cae9['order']=qs[_0xae8e('0x3c')](_0xa89c13[_0xae8e('0x34')][_0xae8e('0x3c')]);_0x38cae9[_0xae8e('0x3d')]=qs['filters'](_[_0xae8e('0x5b')](_0xa89c13[_0xae8e('0x34')],_0x51f2cc[_0xae8e('0x3e')]));_0x38cae9[_0xae8e('0x3d')][_0xae8e('0x5c')]=_0x541786['id'];if(_0xa89c13[_0xae8e('0x34')]['filter']){_0x38cae9[_0xae8e('0x3d')]=_[_0xae8e('0x42')](_0x38cae9[_0xae8e('0x3d')],{'$or':_[_0xae8e('0x2e')](_0x38cae9[_0xae8e('0x36')],function(_0x33877f){var _0x598298={};_0x598298[_0x33877f]={'$like':'%'+_0xa89c13[_0xae8e('0x34')][_0xae8e('0x3f')]+'%'};return _0x598298;})});}_0x38cae9=_[_0xae8e('0x42')]({},_0x38cae9,_0xa89c13[_0xae8e('0x43')]);return db[_0xae8e('0x5e')][_0xae8e('0x1d')]({'where':_0x38cae9[_0xae8e('0x3d')]})['then'](function(_0x2131ba){_0x39a4ac[_0xae8e('0x1d')]=_0x2131ba;if(_0xa89c13[_0xae8e('0x34')][_0xae8e('0x4a')]){_0x38cae9[_0xae8e('0x44')]=[{'all':!![]}];}return db[_0xae8e('0x5e')][_0xae8e('0x45')](_0x38cae9);})[_0xae8e('0x23')](function(_0x1541a5){_0x39a4ac['rows']=_0x1541a5;return _0x39a4ac;});}})[_0xae8e('0x23')](respondWithFilteredResult(_0x40b6ce,_0x38cae9))[_0xae8e('0x47')](handleError(_0x40b6ce,null));};exports[_0xae8e('0x5f')]=function(_0x42fa56,_0x46fb40,_0x225e7e){var _0x59845f={'raw':!![],'where':{}};var _0x41b4a4={};var _0x180774={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x42fa56[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x46fb40,null))['then'](function(_0x44169b){if(_0x44169b){_0x41b4a4[_0xae8e('0x33')]=_[_0xae8e('0x49')](db[_0xae8e('0x60')]['rawAttributes']);_0x41b4a4[_0xae8e('0x34')]=_[_0xae8e('0x49')](_0x42fa56[_0xae8e('0x34')]);_0x41b4a4[_0xae8e('0x3e')]=_['intersection'](_0x41b4a4[_0xae8e('0x33')],_0x41b4a4[_0xae8e('0x34')]);_0x59845f['attributes']=_[_0xae8e('0x35')](_0x41b4a4[_0xae8e('0x33')],qs[_0xae8e('0x37')](_0x42fa56[_0xae8e('0x34')][_0xae8e('0x37')]));_0x59845f[_0xae8e('0x36')]=_0x59845f[_0xae8e('0x36')][_0xae8e('0x38')]?_0x59845f[_0xae8e('0x36')]:_0x41b4a4[_0xae8e('0x33')];if(!_0x42fa56[_0xae8e('0x34')][_0xae8e('0x39')](_0xae8e('0x3a'))){_0x59845f['limit']=qs[_0xae8e('0x1c')](_0x42fa56[_0xae8e('0x34')]['limit']);_0x59845f[_0xae8e('0x1a')]=qs[_0xae8e('0x1a')](_0x42fa56[_0xae8e('0x34')][_0xae8e('0x1a')]);}_0x59845f['order']=qs[_0xae8e('0x3c')](_0x42fa56[_0xae8e('0x34')][_0xae8e('0x3c')]);_0x59845f['where']=qs[_0xae8e('0x3e')](_[_0xae8e('0x5b')](_0x42fa56[_0xae8e('0x34')],_0x41b4a4[_0xae8e('0x3e')]));_0x59845f[_0xae8e('0x3d')][_0xae8e('0x5c')]=_0x44169b['id'];if(_0x42fa56[_0xae8e('0x34')][_0xae8e('0x3f')]){_0x59845f[_0xae8e('0x3d')]=_[_0xae8e('0x42')](_0x59845f[_0xae8e('0x3d')],{'$or':_[_0xae8e('0x2e')](_0x59845f[_0xae8e('0x36')],function(_0x495c35){var _0x367e44={};_0x367e44[_0x495c35]={'$like':'%'+_0x42fa56[_0xae8e('0x34')][_0xae8e('0x3f')]+'%'};return _0x367e44;})});}_0x59845f=_['merge']({},_0x59845f,_0x42fa56['options']);return db[_0xae8e('0x60')]['count']({'where':_0x59845f[_0xae8e('0x3d')]})[_0xae8e('0x23')](function(_0x542a18){_0x180774['count']=_0x542a18;if(_0x42fa56[_0xae8e('0x34')][_0xae8e('0x4a')]){_0x59845f[_0xae8e('0x44')]=[{'all':!![]}];}return db[_0xae8e('0x60')][_0xae8e('0x45')](_0x59845f);})['then'](function(_0x1b00bb){_0x180774[_0xae8e('0x46')]=_0x1b00bb;return _0x180774;});}})[_0xae8e('0x23')](respondWithFilteredResult(_0x46fb40,_0x59845f))[_0xae8e('0x47')](handleError(_0x46fb40,null));};exports[_0xae8e('0x61')]=function(_0x34090b,_0x292655,_0x256b12){var _0x5606fb={'raw':!![],'where':{}};var _0x31f01e={};var _0x52ae1a={'count':0x0,'rows':[]};return db['Campaign'][_0xae8e('0x5a')]({'where':{'id':_0x34090b[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x292655,null))[_0xae8e('0x23')](function(_0x5547de){if(_0x5547de){_0x31f01e['model']=_[_0xae8e('0x49')](db[_0xae8e('0x62')]['rawAttributes']);_0x31f01e[_0xae8e('0x34')]=_[_0xae8e('0x49')](_0x34090b[_0xae8e('0x34')]);_0x31f01e[_0xae8e('0x3e')]=_['intersection'](_0x31f01e[_0xae8e('0x33')],_0x31f01e['query']);_0x5606fb['attributes']=_['intersection'](_0x31f01e['model'],qs[_0xae8e('0x37')](_0x34090b[_0xae8e('0x34')]['fields']));_0x5606fb['attributes']=_0x5606fb[_0xae8e('0x36')][_0xae8e('0x38')]?_0x5606fb[_0xae8e('0x36')]:_0x31f01e[_0xae8e('0x33')];if(!_0x34090b[_0xae8e('0x34')][_0xae8e('0x39')](_0xae8e('0x3a'))){_0x5606fb[_0xae8e('0x1c')]=qs[_0xae8e('0x1c')](_0x34090b['query'][_0xae8e('0x1c')]);_0x5606fb['offset']=qs[_0xae8e('0x1a')](_0x34090b[_0xae8e('0x34')]['offset']);}_0x5606fb[_0xae8e('0x3b')]=qs[_0xae8e('0x3c')](_0x34090b[_0xae8e('0x34')][_0xae8e('0x3c')]);_0x5606fb[_0xae8e('0x3d')]=qs[_0xae8e('0x3e')](_[_0xae8e('0x5b')](_0x34090b[_0xae8e('0x34')],_0x31f01e[_0xae8e('0x3e')]));_0x5606fb[_0xae8e('0x3d')][_0xae8e('0x5c')]=_0x5547de['id'];if(_0x34090b[_0xae8e('0x34')][_0xae8e('0x3f')]){_0x5606fb[_0xae8e('0x3d')]=_[_0xae8e('0x42')](_0x5606fb[_0xae8e('0x3d')],{'$or':_['map'](_0x5606fb[_0xae8e('0x36')],function(_0x56bee8){var _0x12c9f0={};_0x12c9f0[_0x56bee8]={'$like':'%'+_0x34090b['query'][_0xae8e('0x3f')]+'%'};return _0x12c9f0;})});}_0x5606fb=_[_0xae8e('0x42')]({},_0x5606fb,_0x34090b[_0xae8e('0x43')]);return db['CmHopperBlack'][_0xae8e('0x1d')]({'where':_0x5606fb[_0xae8e('0x3d')]})[_0xae8e('0x23')](function(_0x18d824){_0x52ae1a[_0xae8e('0x1d')]=_0x18d824;if(_0x34090b['query'][_0xae8e('0x4a')]){_0x5606fb['include']=[{'all':!![]}];}return db[_0xae8e('0x62')]['findAll'](_0x5606fb);})[_0xae8e('0x23')](function(_0x2ccca1){_0x52ae1a[_0xae8e('0x46')]=_0x2ccca1;return _0x52ae1a;});}})['then'](respondWithFilteredResult(_0x292655,_0x5606fb))[_0xae8e('0x47')](handleError(_0x292655,null));};exports[_0xae8e('0x63')]=function(_0x59f20d,_0x10e255,_0x5eafed){var _0x15c92a={};var _0x300ca6={};var _0xaa399a;var _0x95cc;return db[_0xae8e('0x2f')][_0xae8e('0x5a')]({'where':{'id':_0x59f20d[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x10e255,null))[_0xae8e('0x23')](function(_0x561732){if(_0x561732){_0xaa399a=_0x561732;_0x300ca6[_0xae8e('0x33')]=_[_0xae8e('0x49')](db[_0xae8e('0x64')][_0xae8e('0x30')]);_0x300ca6[_0xae8e('0x34')]=_[_0xae8e('0x49')](_0x59f20d[_0xae8e('0x34')]);_0x300ca6[_0xae8e('0x3e')]=_[_0xae8e('0x35')](_0x300ca6[_0xae8e('0x33')],_0x300ca6[_0xae8e('0x34')]);_0x15c92a[_0xae8e('0x36')]=_[_0xae8e('0x35')](_0x300ca6[_0xae8e('0x33')],qs[_0xae8e('0x37')](_0x59f20d[_0xae8e('0x34')][_0xae8e('0x37')]));_0x15c92a[_0xae8e('0x36')]=_0x15c92a[_0xae8e('0x36')][_0xae8e('0x38')]?_0x15c92a[_0xae8e('0x36')]:_0x300ca6[_0xae8e('0x33')];_0x15c92a[_0xae8e('0x3b')]=qs[_0xae8e('0x3c')](_0x59f20d[_0xae8e('0x34')][_0xae8e('0x3c')]);_0x15c92a[_0xae8e('0x3d')]=qs[_0xae8e('0x3e')](_['pick'](_0x59f20d[_0xae8e('0x34')],_0x300ca6[_0xae8e('0x3e')]));if(_0x59f20d['query'][_0xae8e('0x3f')]){_0x15c92a['where']=_[_0xae8e('0x42')](_0x15c92a['where'],{'$or':_['map'](_0x15c92a['attributes'],function(_0x3e96c6){var _0x45b015={};_0x45b015[_0x3e96c6]={'$like':'%'+_0x59f20d[_0xae8e('0x34')][_0xae8e('0x3f')]+'%'};return _0x45b015;})});}_0x15c92a=_[_0xae8e('0x42')]({},_0x15c92a,_0x59f20d[_0xae8e('0x43')]);return _0xaa399a[_0xae8e('0x63')](_0x15c92a);}})['then'](function(_0x371b39){if(_0x371b39){_0x95cc=_0x371b39['length'];if(!_0x59f20d[_0xae8e('0x34')][_0xae8e('0x39')](_0xae8e('0x3a'))){_0x15c92a[_0xae8e('0x1c')]=qs[_0xae8e('0x1c')](_0x59f20d[_0xae8e('0x34')][_0xae8e('0x1c')]);_0x15c92a[_0xae8e('0x1a')]=qs[_0xae8e('0x1a')](_0x59f20d[_0xae8e('0x34')][_0xae8e('0x1a')]);}return _0xaa399a[_0xae8e('0x63')](_0x15c92a);}})[_0xae8e('0x23')](function(_0x5df525){if(_0x5df525){return _0x5df525?{'count':_0x95cc,'rows':_0x5df525}:null;}})['then'](respondWithResult(_0x10e255,null))['catch'](handleError(_0x10e255,null));};exports[_0xae8e('0x65')]=function(_0x358751,_0x6f7758,_0x39dd4f){var _0xef5e7c,_0x159f79;return db[_0xae8e('0x2f')]['find']({'where':{'id':_0x358751[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x6f7758,null))[_0xae8e('0x23')](function(_0x4dc241){if(_0x4dc241){_0x159f79=_0x4dc241;return _0x4dc241[_0xae8e('0x65')](_0x358751[_0xae8e('0x56')][_0xae8e('0x66')],_['omit'](_0x358751[_0xae8e('0x56')],[_0xae8e('0x66'),'id'])||{});}return null;})[_0xae8e('0x67')](function(_0x31c7e9){var _0x1fce13;_0xef5e7c=_0x31c7e9||[];var _0x2bc120=[];if(_0x31c7e9){for(var _0x4a8a07=0x0;_0x4a8a07<_0x31c7e9[_0xae8e('0x38')];_0x4a8a07+=0x1){var _0x45b6b4=_0x31c7e9[_0x4a8a07][_0xae8e('0x25')]({'plain':!![]});_0x159f79[_0xae8e('0x68')]=_0x358751[_0xae8e('0x56')][_0xae8e('0x68')]?_0x358751[_0xae8e('0x56')][_0xae8e('0x68')]:_0x159f79['dialCheckDuplicateType'];switch(_0x159f79[_0xae8e('0x68')]){case _0xae8e('0x69'):_0x1fce13=squel[_0xae8e('0x6a')]()[_0xae8e('0x6b')]('cm_hopper')['fromQuery']([_0xae8e('0x6c'),_0xae8e('0x6d'),_0xae8e('0x6e'),_0xae8e('0x6f'),_0xae8e('0x5c'),_0xae8e('0x54'),'updatedAt'],squel['select']()['field'](_0xae8e('0x6c'),_0xae8e('0x6c'))[_0xae8e('0x70')]('NOW()',_0xae8e('0x6d'))['field']('id',_0xae8e('0x6e'))[_0xae8e('0x70')](_0x45b6b4['CmListId'][_0xae8e('0x71')](),'ListId')[_0xae8e('0x70')](_0x358751[_0xae8e('0x59')]['id'][_0xae8e('0x71')](),_0xae8e('0x5c'))[_0xae8e('0x70')](_0xae8e('0x72'),_0xae8e('0x54'))['field'](_0xae8e('0x72'),'updatedAt')['from'](_0xae8e('0x73'))[_0xae8e('0x3d')](_0xae8e('0x74'))[_0xae8e('0x3d')](_0xae8e('0x75'),_0x45b6b4[_0xae8e('0x76')][_0xae8e('0x71')]())[_0xae8e('0x3d')](_0xae8e('0x77'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xae8e('0x78')]()['field'](_0xae8e('0x79'))['from'](_0xae8e('0x7a'))['where'](_0xae8e('0x7b'),_0x358751[_0xae8e('0x59')]['id'][_0xae8e('0x71')]()))[_0xae8e('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xae8e('0x7c'))[_0xae8e('0x7d')](_0xae8e('0x7e'))[_0xae8e('0x3d')](_0xae8e('0x7b'),_0x358751[_0xae8e('0x59')]['id'][_0xae8e('0x71')]())))[_0xae8e('0x71')]();break;case _0xae8e('0x7f'):_0x1fce13=squel[_0xae8e('0x6a')]()[_0xae8e('0x6b')](_0xae8e('0x7e'))[_0xae8e('0x80')](['phone',_0xae8e('0x6d'),'ContactId',_0xae8e('0x6f'),_0xae8e('0x5c'),_0xae8e('0x54'),_0xae8e('0x55')],squel[_0xae8e('0x78')]()[_0xae8e('0x70')](_0xae8e('0x6c'),_0xae8e('0x6c'))[_0xae8e('0x70')](_0xae8e('0x72'),'scheduledAt')[_0xae8e('0x70')]('id','ContactId')[_0xae8e('0x70')](_0x45b6b4[_0xae8e('0x76')]['toString'](),'ListId')[_0xae8e('0x70')](_0x358751[_0xae8e('0x59')]['id'][_0xae8e('0x71')](),_0xae8e('0x5c'))[_0xae8e('0x70')](_0xae8e('0x72'),'createdAt')['field'](_0xae8e('0x72'),_0xae8e('0x55'))[_0xae8e('0x7d')]('cm_contacts')[_0xae8e('0x3d')](_0xae8e('0x74'))['where'](_0xae8e('0x75'),_0x45b6b4[_0xae8e('0x76')][_0xae8e('0x71')]())['where'](_0xae8e('0x77'))[_0xae8e('0x3d')](_0xae8e('0x81'),squel[_0xae8e('0x78')]()[_0xae8e('0x70')](_0xae8e('0x7c'))[_0xae8e('0x7d')](_0xae8e('0x7e'))['where'](_0xae8e('0x7b'),_0x358751['params']['id'][_0xae8e('0x71')]())))[_0xae8e('0x71')]();break;default:_0x1fce13=squel[_0xae8e('0x6a')]()['into'](_0xae8e('0x7e'))[_0xae8e('0x80')]([_0xae8e('0x6c'),_0xae8e('0x6d'),'ContactId',_0xae8e('0x6f'),_0xae8e('0x5c'),_0xae8e('0x54'),_0xae8e('0x55')],squel[_0xae8e('0x78')]()[_0xae8e('0x70')](_0xae8e('0x6c'),_0xae8e('0x6c'))[_0xae8e('0x70')](_0xae8e('0x72'),_0xae8e('0x6d'))['field']('id',_0xae8e('0x6e'))['field'](_0x45b6b4['CmListId'][_0xae8e('0x71')](),_0xae8e('0x6f'))[_0xae8e('0x70')](_0x358751[_0xae8e('0x59')]['id'][_0xae8e('0x71')](),_0xae8e('0x5c'))[_0xae8e('0x70')](_0xae8e('0x72'),_0xae8e('0x54'))['field'](_0xae8e('0x72'),_0xae8e('0x55'))['from']('cm_contacts')[_0xae8e('0x3d')](_0xae8e('0x74'))['where'](_0xae8e('0x75'),_0x45b6b4[_0xae8e('0x76')][_0xae8e('0x71')]())[_0xae8e('0x3d')](_0xae8e('0x77')))[_0xae8e('0x71')]();}_0x2bc120[_0xae8e('0x82')](db[_0xae8e('0x83')][_0xae8e('0x34')](_0x1fce13));}return BPromise[_0xae8e('0x84')](_0x2bc120);}})[_0xae8e('0x23')](function(){return _0xef5e7c;})[_0xae8e('0x23')](respondWithResult(_0x6f7758,null))[_0xae8e('0x47')](handleError(_0x6f7758,null));};exports[_0xae8e('0x85')]=function(_0xb15d60,_0x2c9502,_0x39fd52){return db[_0xae8e('0x2f')]['find']({'where':{'id':_0xb15d60[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x2c9502,null))[_0xae8e('0x23')](function(_0x3a41c3){if(_0x3a41c3){return _0x3a41c3[_0xae8e('0x85')](_0xb15d60[_0xae8e('0x34')][_0xae8e('0x66')]);}})[_0xae8e('0x23')](function(_0x35f8fa){if(_0x35f8fa){return db[_0xae8e('0x5d')][_0xae8e('0x24')]({'where':{'ListId':_0xb15d60[_0xae8e('0x34')]['ids'],'CampaignId':_0xb15d60[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](function(){return _0x35f8fa;});}})[_0xae8e('0x23')](respondWithStatusCode(_0x2c9502,null))[_0xae8e('0x47')](handleError(_0x2c9502,null));};exports['getBlackLists']=function(_0x289a5d,_0x386aa0,_0x36ab20){var _0x4bfab6={};var _0x10c4f0={};var _0x4f32cd;var _0x2583e3;return db['Campaign'][_0xae8e('0x5a')]({'where':{'id':_0x289a5d['params']['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x386aa0,null))[_0xae8e('0x23')](function(_0x1a194e){if(_0x1a194e){_0x4f32cd=_0x1a194e;_0x10c4f0[_0xae8e('0x33')]=_[_0xae8e('0x49')](db['CmList'][_0xae8e('0x30')]);_0x10c4f0['query']=_['keys'](_0x289a5d['query']);_0x10c4f0[_0xae8e('0x3e')]=_[_0xae8e('0x35')](_0x10c4f0[_0xae8e('0x33')],_0x10c4f0[_0xae8e('0x34')]);_0x4bfab6[_0xae8e('0x36')]=_[_0xae8e('0x35')](_0x10c4f0[_0xae8e('0x33')],qs[_0xae8e('0x37')](_0x289a5d['query'][_0xae8e('0x37')]));_0x4bfab6[_0xae8e('0x36')]=_0x4bfab6[_0xae8e('0x36')]['length']?_0x4bfab6[_0xae8e('0x36')]:_0x10c4f0[_0xae8e('0x33')];_0x4bfab6[_0xae8e('0x3b')]=qs[_0xae8e('0x3c')](_0x289a5d['query'][_0xae8e('0x3c')]);_0x4bfab6[_0xae8e('0x3d')]=qs[_0xae8e('0x3e')](_['pick'](_0x289a5d[_0xae8e('0x34')],_0x10c4f0[_0xae8e('0x3e')]));if(_0x289a5d[_0xae8e('0x34')][_0xae8e('0x3f')]){_0x4bfab6['where']=_[_0xae8e('0x42')](_0x4bfab6[_0xae8e('0x3d')],{'$or':_[_0xae8e('0x2e')](_0x4bfab6[_0xae8e('0x36')],function(_0x1746be){var _0x58f440={};_0x58f440[_0x1746be]={'$like':'%'+_0x289a5d[_0xae8e('0x34')][_0xae8e('0x3f')]+'%'};return _0x58f440;})});}_0x4bfab6=_[_0xae8e('0x42')]({},_0x4bfab6,_0x289a5d['options']);return _0x4f32cd[_0xae8e('0x86')](_0x4bfab6);}})[_0xae8e('0x23')](function(_0x485cc7){if(_0x485cc7){_0x2583e3=_0x485cc7[_0xae8e('0x38')];if(!_0x289a5d[_0xae8e('0x34')]['hasOwnProperty'](_0xae8e('0x3a'))){_0x4bfab6[_0xae8e('0x1c')]=qs['limit'](_0x289a5d[_0xae8e('0x34')][_0xae8e('0x1c')]);_0x4bfab6[_0xae8e('0x1a')]=qs['offset'](_0x289a5d['query'][_0xae8e('0x1a')]);}return _0x4f32cd[_0xae8e('0x86')](_0x4bfab6);}})[_0xae8e('0x23')](function(_0x2ed6ac){if(_0x2ed6ac){return _0x2ed6ac?{'count':_0x2583e3,'rows':_0x2ed6ac}:null;}})['then'](respondWithResult(_0x386aa0,null))['catch'](handleError(_0x386aa0,null));};exports['addBlackLists']=function(_0xfc6ea4,_0x35add2,_0x15e1b3){var _0x4737db,_0x2f210e;return db[_0xae8e('0x2f')][_0xae8e('0x4b')]({'where':{'id':_0xfc6ea4[_0xae8e('0x59')]['id']}})['then'](handleEntityNotFound(_0x35add2,null))[_0xae8e('0x23')](function(_0x4096c9){if(_0x4096c9){_0x2f210e=_0x4096c9;return _0x4096c9[_0xae8e('0x87')](_0xfc6ea4[_0xae8e('0x56')][_0xae8e('0x66')],_[_0xae8e('0x57')](_0xfc6ea4[_0xae8e('0x56')],[_0xae8e('0x66'),'id'])||{});}return null;})['spread'](function(_0x586f74){var _0xcb9b97;_0x4737db=_0x586f74||[];var _0x566d56=[];if(_0x586f74){for(var _0x1220b8=0x0;_0x1220b8<_0x586f74[_0xae8e('0x38')];_0x1220b8+=0x1){var _0x15eea7=_0x586f74[_0x1220b8][_0xae8e('0x25')]({'plain':!![]});_0xcb9b97=squel[_0xae8e('0x6a')]()[_0xae8e('0x6b')]('cm_hopper_black')[_0xae8e('0x80')]([_0xae8e('0x6c'),_0xae8e('0x6e'),'ListId',_0xae8e('0x5c'),_0xae8e('0x54'),_0xae8e('0x55')],squel[_0xae8e('0x78')]()[_0xae8e('0x70')](_0xae8e('0x6c'),_0xae8e('0x6c'))[_0xae8e('0x70')]('id',_0xae8e('0x6e'))[_0xae8e('0x70')](_0x15eea7['CmListId'][_0xae8e('0x71')](),_0xae8e('0x6f'))['field'](_0xfc6ea4[_0xae8e('0x59')]['id'][_0xae8e('0x71')](),'CampaignId')['field']('NOW()',_0xae8e('0x54'))[_0xae8e('0x70')]('NOW()',_0xae8e('0x55'))[_0xae8e('0x7d')](_0xae8e('0x73'))[_0xae8e('0x3d')]('deletedAt\x20IS\x20NULL')[_0xae8e('0x3d')]('ListId\x20=\x20?',_0x15eea7[_0xae8e('0x76')][_0xae8e('0x71')]())[_0xae8e('0x3d')](_0xae8e('0x77')))['toString']();_0x566d56['push'](db['sequelize'][_0xae8e('0x34')](_0xcb9b97));}return BPromise[_0xae8e('0x84')](_0x566d56);}})[_0xae8e('0x23')](function(){return _0x4737db;})[_0xae8e('0x23')](respondWithResult(_0x35add2,null))[_0xae8e('0x47')](handleError(_0x35add2,null));};exports[_0xae8e('0x88')]=function(_0xc7dfe3,_0x5599b2,_0x1489a4){return db[_0xae8e('0x2f')]['find']({'where':{'id':_0xc7dfe3[_0xae8e('0x59')]['id']}})[_0xae8e('0x23')](handleEntityNotFound(_0x5599b2,null))[_0xae8e('0x23')](function(_0x3f5a5f){if(_0x3f5a5f){return _0x3f5a5f[_0xae8e('0x88')](_0xc7dfe3['query'][_0xae8e('0x66')]);}})[_0xae8e('0x23')](function(_0x9f7f66){if(_0x9f7f66){return db[_0xae8e('0x62')][_0xae8e('0x24')]({'where':{'ListId':_0xc7dfe3[_0xae8e('0x34')][_0xae8e('0x66')],'CampaignId':_0xc7dfe3['params']['id']}})[_0xae8e('0x23')](function(){return _0x9f7f66;});}})[_0xae8e('0x23')](respondWithStatusCode(_0x5599b2,null))[_0xae8e('0x47')](handleError(_0x5599b2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 89916f1..3fc802b 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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index e07e5c9..3491506 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 _0x0a34=['model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x5a1522,_0x46e359){var _0x30326c=function(_0x413dbb){while(--_0x413dbb){_0x5a1522['push'](_0x5a1522['shift']());}};_0x30326c(++_0x46e359);}(_0x0a34,0x12a));var _0x40a3=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x0a34[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x40a3('0x0'));var util=require(_0x40a3('0x1'));var moment=require('moment');var BPromise=require(_0x40a3('0x2'));var rs=require(_0x40a3('0x3'));var fs=require('fs');var Redis=require(_0x40a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x40a3('0x5'));var logger=require(_0x40a3('0x6'))(_0x40a3('0x7'));var config=require('../../config/environment');var jayson=require(_0x40a3('0x8'));var client=jayson[_0x40a3('0x9')][_0x40a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x394f67,_0x655437,_0x3bf1de){return new BPromise(function(_0x504f01,_0x288c84){return client[_0x40a3('0xb')](_0x394f67,_0x3bf1de)[_0x40a3('0xc')](function(_0x1459bc){logger[_0x40a3('0xd')](_0x40a3('0xe'),_0x655437,'request\x20sent');logger[_0x40a3('0xf')](_0x40a3('0x10'),_0x655437,_0x40a3('0x11'),JSON['stringify'](_0x1459bc));if(_0x1459bc[_0x40a3('0x12')]){if(_0x1459bc[_0x40a3('0x12')]['code']===0x1f4){logger[_0x40a3('0x12')](_0x40a3('0xe'),_0x655437,_0x1459bc['error'][_0x40a3('0x13')]);return _0x288c84(_0x1459bc[_0x40a3('0x12')]['message']);}logger[_0x40a3('0x12')](_0x40a3('0xe'),_0x655437,_0x1459bc[_0x40a3('0x12')][_0x40a3('0x13')]);return _0x504f01(_0x1459bc['error']['message']);}else{logger['info'](_0x40a3('0xe'),_0x655437,_0x40a3('0x11'));_0x504f01(_0x1459bc[_0x40a3('0x14')]['message']);}})[_0x40a3('0x15')](function(_0x8c3d45){logger['error'](_0x40a3('0xe'),_0x655437,_0x8c3d45);_0x288c84(_0x8c3d45);});});}exports[_0x40a3('0x16')]=function(_0x31aef5){var _0x22f31e=this;return new Promise(function(_0x1c5102,_0x4d037a){return db[_0x40a3('0x17')][_0x40a3('0x18')]({'raw':_0x31aef5[_0x40a3('0x19')]?_0x31aef5[_0x40a3('0x19')][_0x40a3('0x1a')]===undefined?!![]:![]:!![],'where':_0x31aef5[_0x40a3('0x19')]?_0x31aef5[_0x40a3('0x19')][_0x40a3('0x1b')]||null:null,'attributes':_0x31aef5[_0x40a3('0x19')]?_0x31aef5[_0x40a3('0x19')][_0x40a3('0x1c')]||null:null,'limit':_0x31aef5[_0x40a3('0x19')]?_0x31aef5[_0x40a3('0x19')][_0x40a3('0x1d')]||null:null,'include':_0x31aef5[_0x40a3('0x19')]?_0x31aef5[_0x40a3('0x19')]['include']?_[_0x40a3('0x1e')](_0x31aef5[_0x40a3('0x19')][_0x40a3('0x1f')],function(_0x1e11fb){return{'model':db[_0x1e11fb[_0x40a3('0x20')]],'as':_0x1e11fb['as'],'attributes':_0x1e11fb[_0x40a3('0x1c')],'include':_0x1e11fb['include']?_[_0x40a3('0x1e')](_0x1e11fb['include'],function(_0x37321a){return{'model':db[_0x37321a[_0x40a3('0x20')]],'as':_0x37321a['as'],'attributes':_0x37321a['attributes'],'include':_0x37321a[_0x40a3('0x1f')]?_[_0x40a3('0x1e')](_0x37321a[_0x40a3('0x1f')],function(_0x599474){return{'model':db[_0x599474[_0x40a3('0x20')]],'as':_0x599474['as'],'attributes':_0x599474[_0x40a3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x40a3('0xc')](function(_0x4456f1){logger[_0x40a3('0xd')](_0x40a3('0x16'),_0x31aef5);logger[_0x40a3('0xf')](_0x40a3('0x16'),_0x31aef5,JSON['stringify'](_0x4456f1));_0x1c5102(_0x4456f1);})['catch'](function(_0x355a8f){logger['error']('GetCampaign',_0x355a8f[_0x40a3('0x13')],_0x31aef5);_0x4d037a(_0x22f31e[_0x40a3('0x12')](0x1f4,_0x355a8f[_0x40a3('0x13')]));});});}; \ No newline at end of file +var _0xf257=['map','model','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include'];(function(_0x1dc29a,_0x10db83){var _0x547b4f=function(_0x2cd12d){while(--_0x2cd12d){_0x1dc29a['push'](_0x1dc29a['shift']());}};_0x547b4f(++_0x10db83);}(_0xf257,0x82));var _0x7f25=function(_0x378fcb,_0x32e78c){_0x378fcb=_0x378fcb-0x0;var _0x5dfe9b=_0xf257[_0x378fcb];return _0x5dfe9b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f25('0x0'));var BPromise=require(_0x7f25('0x1'));var rs=require(_0x7f25('0x2'));var fs=require('fs');var Redis=require(_0x7f25('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f25('0x4'));var logger=require(_0x7f25('0x5'))(_0x7f25('0x6'));var config=require(_0x7f25('0x7'));var jayson=require(_0x7f25('0x8'));var client=jayson[_0x7f25('0x9')][_0x7f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242a3e,_0x369a09,_0x16e278){return new BPromise(function(_0x31a5d8,_0x1ae607){return client[_0x7f25('0xb')](_0x242a3e,_0x16e278)[_0x7f25('0xc')](function(_0x57ba17){logger[_0x7f25('0xd')](_0x7f25('0xe'),_0x369a09,'request\x20sent');logger['debug'](_0x7f25('0xf'),_0x369a09,'request\x20sent',JSON[_0x7f25('0x10')](_0x57ba17));if(_0x57ba17[_0x7f25('0x11')]){if(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x12')]===0x1f4){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')]['message']);return _0x1ae607(_0x57ba17['error'][_0x7f25('0x13')]);}logger['error'](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);return _0x31a5d8(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x369a09,'request\x20sent');_0x31a5d8(_0x57ba17[_0x7f25('0x14')][_0x7f25('0x13')]);}})[_0x7f25('0x15')](function(_0x167363){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x167363);_0x1ae607(_0x167363);});});}exports[_0x7f25('0x16')]=function(_0x26d4aa){var _0x5e0067=this;return new Promise(function(_0x23f30c,_0x1cd6c1){return db[_0x7f25('0x17')][_0x7f25('0x18')]({'raw':_0x26d4aa[_0x7f25('0x19')]?_0x26d4aa[_0x7f25('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x26d4aa['options']?_0x26d4aa[_0x7f25('0x19')][_0x7f25('0x1a')]||null:null,'attributes':_0x26d4aa[_0x7f25('0x19')]?_0x26d4aa[_0x7f25('0x19')][_0x7f25('0x1b')]||null:null,'limit':_0x26d4aa[_0x7f25('0x19')]?_0x26d4aa[_0x7f25('0x19')][_0x7f25('0x1c')]||null:null,'include':_0x26d4aa[_0x7f25('0x19')]?_0x26d4aa['options'][_0x7f25('0x1d')]?_[_0x7f25('0x1e')](_0x26d4aa[_0x7f25('0x19')][_0x7f25('0x1d')],function(_0x29039a){return{'model':db[_0x29039a['model']],'as':_0x29039a['as'],'attributes':_0x29039a[_0x7f25('0x1b')],'include':_0x29039a[_0x7f25('0x1d')]?_[_0x7f25('0x1e')](_0x29039a['include'],function(_0x17b38c){return{'model':db[_0x17b38c['model']],'as':_0x17b38c['as'],'attributes':_0x17b38c[_0x7f25('0x1b')],'include':_0x17b38c[_0x7f25('0x1d')]?_[_0x7f25('0x1e')](_0x17b38c[_0x7f25('0x1d')],function(_0x382fd4){return{'model':db[_0x382fd4[_0x7f25('0x1f')]],'as':_0x382fd4['as'],'attributes':_0x382fd4[_0x7f25('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7f25('0xc')](function(_0x44116d){logger[_0x7f25('0xd')]('GetCampaign',_0x26d4aa);logger['debug'](_0x7f25('0x16'),_0x26d4aa,JSON[_0x7f25('0x10')](_0x44116d));_0x23f30c(_0x44116d);})['catch'](function(_0xa373ee){logger[_0x7f25('0x11')](_0x7f25('0x16'),_0xa373ee[_0x7f25('0x13')],_0x26d4aa);_0x1cd6c1(_0x5e0067[_0x7f25('0x11')](0x1f4,_0xa373ee[_0x7f25('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 69ee163..62eaf17 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 _0xad9b=['/:id/lists','getLists','getBlackLists','post','create','clone','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','isAuthenticated','/:id','show','/:id/hoppers','get','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xad9b,0x10e));var _0xbad9=function(_0xfc9121,_0x38e193){_0xfc9121=_0xfc9121-0x0;var _0x4e9f47=_0xad9b[_0xfc9121];return _0x4e9f47;};'use strict';var multer=require(_0xbad9('0x0'));var util=require('util');var path=require(_0xbad9('0x1'));var timeout=require(_0xbad9('0x2'));var express=require(_0xbad9('0x3'));var router=express[_0xbad9('0x4')]();var fs_extra=require(_0xbad9('0x5'));var auth=require(_0xbad9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbad9('0x7'));router['get']('/',auth[_0xbad9('0x8')](),controller['index']);router['get'](_0xbad9('0x9'),auth[_0xbad9('0x8')](),controller[_0xbad9('0xa')]);router['get'](_0xbad9('0xb'),auth[_0xbad9('0x8')](),controller['getHoppers']);router[_0xbad9('0xc')](_0xbad9('0xd'),auth[_0xbad9('0x8')](),controller[_0xbad9('0xe')]);router[_0xbad9('0xc')](_0xbad9('0xf'),auth[_0xbad9('0x8')](),controller['getHopperFinals']);router[_0xbad9('0xc')](_0xbad9('0x10'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x11')]);router[_0xbad9('0xc')](_0xbad9('0x12'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x13')]);router[_0xbad9('0xc')]('/:id/blacklists',auth[_0xbad9('0x8')](),controller[_0xbad9('0x14')]);router[_0xbad9('0x15')]('/',auth[_0xbad9('0x8')](),controller[_0xbad9('0x16')]);router[_0xbad9('0x15')]('/:id/clone',auth[_0xbad9('0x8')](),controller[_0xbad9('0x17')]);router[_0xbad9('0x15')](_0xbad9('0x12'),auth['isAuthenticated'](),controller['addLists']);router[_0xbad9('0x15')](_0xbad9('0x18'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x19')]);router[_0xbad9('0x1a')](_0xbad9('0x9'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x1b')]);router[_0xbad9('0x1c')](_0xbad9('0x9'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x1d')]);router[_0xbad9('0x1c')](_0xbad9('0x12'),auth[_0xbad9('0x8')](),controller['removeLists']);router['delete'](_0xbad9('0x18'),auth['isAuthenticated'](),controller[_0xbad9('0x1e')]);module[_0xbad9('0x1f')]=router; \ No newline at end of file +var _0x2b44=['destroy','removeLists','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','/:id'];(function(_0x3075a6,_0x1c0d29){var _0x19e413=function(_0x5a9deb){while(--_0x5a9deb){_0x3075a6['push'](_0x3075a6['shift']());}};_0x19e413(++_0x1c0d29);}(_0x2b44,0x122));var _0x42b4=function(_0x22244c,_0x16e0be){_0x22244c=_0x22244c-0x0;var _0x16e2d5=_0x2b44[_0x22244c];return _0x16e2d5;};'use strict';var multer=require(_0x42b4('0x0'));var util=require(_0x42b4('0x1'));var path=require(_0x42b4('0x2'));var timeout=require(_0x42b4('0x3'));var express=require(_0x42b4('0x4'));var router=express[_0x42b4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x42b4('0x6'));var config=require(_0x42b4('0x7'));var controller=require(_0x42b4('0x8'));router[_0x42b4('0x9')]('/',auth['isAuthenticated'](),controller[_0x42b4('0xa')]);router[_0x42b4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x42b4('0xb')]);router[_0x42b4('0x9')](_0x42b4('0xc'),auth[_0x42b4('0xd')](),controller[_0x42b4('0xe')]);router[_0x42b4('0x9')](_0x42b4('0xf'),auth['isAuthenticated'](),controller[_0x42b4('0x10')]);router[_0x42b4('0x9')](_0x42b4('0x11'),auth['isAuthenticated'](),controller[_0x42b4('0x12')]);router[_0x42b4('0x9')](_0x42b4('0x13'),auth[_0x42b4('0xd')](),controller[_0x42b4('0x14')]);router[_0x42b4('0x9')](_0x42b4('0x15'),auth[_0x42b4('0xd')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0x42b4('0xd')](),controller[_0x42b4('0x16')]);router[_0x42b4('0x17')]('/',auth[_0x42b4('0xd')](),controller[_0x42b4('0x18')]);router['post'](_0x42b4('0x19'),auth['isAuthenticated'](),controller[_0x42b4('0x1a')]);router[_0x42b4('0x17')](_0x42b4('0x15'),auth[_0x42b4('0xd')](),controller[_0x42b4('0x1b')]);router['post'](_0x42b4('0x1c'),auth[_0x42b4('0xd')](),controller[_0x42b4('0x1d')]);router[_0x42b4('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x42b4('0x1f')]);router[_0x42b4('0x20')](_0x42b4('0x21'),auth[_0x42b4('0xd')](),controller[_0x42b4('0x22')]);router[_0x42b4('0x20')](_0x42b4('0x15'),auth[_0x42b4('0xd')](),controller[_0x42b4('0x23')]);router[_0x42b4('0x20')](_0x42b4('0x1c'),auth[_0x42b4('0xd')](),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 595881e..60aacad 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 _0x020e=['TEXT','VIRTUAL','sequelize','exports','STRING'];(function(_0x402b49,_0x3d425d){var _0x2a0a1e=function(_0x51c7fe){while(--_0x51c7fe){_0x402b49['push'](_0x402b49['shift']());}};_0x2a0a1e(++_0x3d425d);}(_0x020e,0xa7));var _0xe020=function(_0x2bf9d6,_0xa78e64){_0x2bf9d6=_0x2bf9d6-0x0;var _0x3ab768=_0x020e[_0x2bf9d6];return _0x3ab768;};'use strict';var Sequelize=require(_0xe020('0x0'));module[_0xe020('0x1')]={'key':{'type':Sequelize[_0xe020('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe020('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xe020('0x2')]},'name':{'type':Sequelize[_0xe020('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0xff67=['getDataValue','key','exports','STRING','TEXT','VIRTUAL'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0xff67,0x86));var _0x7ff6=function(_0x2b9638,_0x37e81f){_0x2b9638=_0x2b9638-0x0;var _0x58b5d2=_0xff67[_0x2b9638];return _0x58b5d2;};'use strict';var Sequelize=require('sequelize');module[_0x7ff6('0x0')]={'key':{'type':Sequelize[_0x7ff6('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x7ff6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7ff6('0x1')]},'name':{'type':Sequelize[_0x7ff6('0x3')],'get':function(){return this[_0x7ff6('0x4')](_0x7ff6('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 8899312..7d6f4ef 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 _0x1a1f=['show','params','rawAttributes','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','name','send','index','map','CannedAnswer','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','rows','catch'];(function(_0x39e177,_0x1f09d9){var _0x441aa0=function(_0x533eef){while(--_0x533eef){_0x39e177['push'](_0x39e177['shift']());}};_0x441aa0(++_0x1f09d9);}(_0x1a1f,0x67));var _0xf1a1=function(_0x5f3f26,_0x262c0d){_0x5f3f26=_0x5f3f26-0x0;var _0x20a741=_0x1a1f[_0x5f3f26];return _0x20a741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1a1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1a1('0x1'));var rp=require(_0xf1a1('0x2'));var moment=require(_0xf1a1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf1a1('0x4'));var util=require(_0xf1a1('0x5'));var path=require(_0xf1a1('0x6'));var sox=require(_0xf1a1('0x7'));var csv=require(_0xf1a1('0x8'));var ejs=require(_0xf1a1('0x9'));var fs=require('fs');var fs_extra=require(_0xf1a1('0xa'));var _=require(_0xf1a1('0xb'));var squel=require('squel');var crypto=require(_0xf1a1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf1a1('0xd'));var toCsv=require(_0xf1a1('0x8'));var querystring=require(_0xf1a1('0xe'));var Papa=require('papaparse');var Redis=require(_0xf1a1('0xf'));var authService=require(_0xf1a1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf1a1('0x11'));var hardwareService=require(_0xf1a1('0x12'));var logger=require(_0xf1a1('0x13'))(_0xf1a1('0x14'));var utils=require('../../config/utils');var config=require(_0xf1a1('0x15'));var licenseUtil=require(_0xf1a1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12d36b,_0x57d9c2){_0x57d9c2=_0x57d9c2||0xcc;return function(_0x59fdcc){if(_0x59fdcc){return _0x12d36b['sendStatus'](_0x57d9c2);}return _0x12d36b['status'](_0x57d9c2)[_0xf1a1('0x17')]();};}function respondWithResult(_0x20cd31,_0x25280a){_0x25280a=_0x25280a||0xc8;return function(_0x2f3671){if(_0x2f3671){return _0x20cd31[_0xf1a1('0x18')](_0x25280a)[_0xf1a1('0x19')](_0x2f3671);}};}function respondWithFilteredResult(_0x1d3b46,_0x457ced){return function(_0xf78b79){if(_0xf78b79){var _0x4f6820=typeof _0x457ced[_0xf1a1('0x1a')]===_0xf1a1('0x1b')&&typeof _0x457ced[_0xf1a1('0x1c')]==='undefined';var _0x57f024=_0xf78b79[_0xf1a1('0x1d')];var _0x201a6f=_0x4f6820?0x0:_0x457ced['offset'];var _0x4fe8e9=_0x4f6820?_0xf78b79[_0xf1a1('0x1d')]:_0x457ced[_0xf1a1('0x1a')]+_0x457ced['limit'];var _0x273f2f;if(_0x4fe8e9>=_0x57f024){_0x4fe8e9=_0x57f024;_0x273f2f=0xc8;}else{_0x273f2f=0xce;}_0x1d3b46['status'](_0x273f2f);return _0x1d3b46[_0xf1a1('0x1e')]('Content-Range',_0x201a6f+'-'+_0x4fe8e9+'/'+_0x57f024)['json'](_0xf78b79);}return null;};}function patchUpdates(_0x4a1989){return function(_0x2d8e5d){try{jsonpatch[_0xf1a1('0x1f')](_0x2d8e5d,_0x4a1989,!![]);}catch(_0x2f4b35){return BPromise[_0xf1a1('0x20')](_0x2f4b35);}return _0x2d8e5d[_0xf1a1('0x21')]();};}function saveUpdates(_0x187dc3,_0x4dbd36){return function(_0x222eb1){if(_0x222eb1){return _0x222eb1[_0xf1a1('0x22')](_0x187dc3)[_0xf1a1('0x23')](function(_0x3be266){return _0x3be266;});}return null;};}function removeEntity(_0x4b3e44,_0x499c9b){return function(_0xf9e90){if(_0xf9e90){return _0xf9e90[_0xf1a1('0x24')]()[_0xf1a1('0x23')](function(){var _0x19a711=_0xf9e90[_0xf1a1('0x25')]({'plain':!![]});var _0x41150c=_0xf1a1('0x26');return db[_0xf1a1('0x27')][_0xf1a1('0x24')]({'where':{'type':_0x41150c,'resourceId':_0x19a711['id']}})[_0xf1a1('0x23')](function(){return _0xf9e90;});})[_0xf1a1('0x23')](function(){_0x4b3e44[_0xf1a1('0x18')](0xcc)[_0xf1a1('0x17')]();});}};}function handleEntityNotFound(_0xff378b,_0x1ce869){return function(_0x7c1911){if(!_0x7c1911){_0xff378b[_0xf1a1('0x28')](0x194);}return _0x7c1911;};}function handleError(_0x2ba274,_0x5ea2d3){_0x5ea2d3=_0x5ea2d3||0x1f4;return function(_0x574fb7){logger[_0xf1a1('0x29')](_0x574fb7['stack']);if(_0x574fb7[_0xf1a1('0x2a')]){delete _0x574fb7[_0xf1a1('0x2a')];}_0x2ba274['status'](_0x5ea2d3)[_0xf1a1('0x2b')](_0x574fb7);};}exports[_0xf1a1('0x2c')]=function(_0x45b8ed,_0x216268){var _0x19c37a={},_0x471de1={},_0x170e4a={'count':0x0,'rows':[]};var _0x59d83e=_[_0xf1a1('0x2d')](db[_0xf1a1('0x2e')]['rawAttributes'],function(_0x4d9dca){return{'name':_0x4d9dca[_0xf1a1('0x2f')],'type':_0x4d9dca['type'][_0xf1a1('0x30')]};});_0x471de1[_0xf1a1('0x31')]=_[_0xf1a1('0x2d')](_0x59d83e,_0xf1a1('0x2a'));_0x471de1['query']=_[_0xf1a1('0x32')](_0x45b8ed[_0xf1a1('0x33')]);_0x471de1[_0xf1a1('0x34')]=_['intersection'](_0x471de1['model'],_0x471de1['query']);_0x19c37a[_0xf1a1('0x35')]=_[_0xf1a1('0x36')](_0x471de1['model'],qs[_0xf1a1('0x37')](_0x45b8ed[_0xf1a1('0x33')][_0xf1a1('0x37')]));_0x19c37a[_0xf1a1('0x35')]=_0x19c37a[_0xf1a1('0x35')][_0xf1a1('0x38')]?_0x19c37a[_0xf1a1('0x35')]:_0x471de1['model'];if(!_0x45b8ed[_0xf1a1('0x33')][_0xf1a1('0x39')](_0xf1a1('0x3a'))){_0x19c37a[_0xf1a1('0x1c')]=qs[_0xf1a1('0x1c')](_0x45b8ed['query']['limit']);_0x19c37a[_0xf1a1('0x1a')]=qs[_0xf1a1('0x1a')](_0x45b8ed['query']['offset']);}_0x19c37a['order']=qs[_0xf1a1('0x3b')](_0x45b8ed['query'][_0xf1a1('0x3b')]);_0x19c37a[_0xf1a1('0x3c')]=qs[_0xf1a1('0x34')](_[_0xf1a1('0x3d')](_0x45b8ed['query'],_0x471de1['filters']),_0x59d83e);if(_0x45b8ed[_0xf1a1('0x33')]['filter']){_0x19c37a[_0xf1a1('0x3c')]=_[_0xf1a1('0x3e')](_0x19c37a['where'],{'$or':[{'key':{'$like':'%'+_0x45b8ed[_0xf1a1('0x33')][_0xf1a1('0x3f')]+'%'}},{'value':{'$like':'%'+_0x45b8ed[_0xf1a1('0x33')]['filter']+'%'}}]});}_0x19c37a=_['merge']({},_0x19c37a,_0x45b8ed[_0xf1a1('0x40')]);var _0x15f269={'where':_0x19c37a['where']};return db[_0xf1a1('0x2e')][_0xf1a1('0x1d')](_0x15f269)[_0xf1a1('0x23')](function(_0x4985ae){_0x170e4a[_0xf1a1('0x1d')]=_0x4985ae;if(_0x45b8ed['query'][_0xf1a1('0x41')]){_0x19c37a[_0xf1a1('0x42')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x19c37a);})['then'](function(_0x3343f8){_0x170e4a[_0xf1a1('0x43')]=_0x3343f8;return _0x170e4a;})[_0xf1a1('0x23')](respondWithFilteredResult(_0x216268,_0x19c37a))[_0xf1a1('0x44')](handleError(_0x216268,null));};exports[_0xf1a1('0x45')]=function(_0x21f263,_0x551b9a){var _0x3172ea={'raw':!![],'where':{'id':_0x21f263[_0xf1a1('0x46')]['id']}},_0x479ae7={};_0x479ae7[_0xf1a1('0x31')]=_['keys'](db['CannedAnswer'][_0xf1a1('0x47')]);_0x479ae7[_0xf1a1('0x33')]=_['keys'](_0x21f263[_0xf1a1('0x33')]);_0x479ae7[_0xf1a1('0x34')]=_[_0xf1a1('0x36')](_0x479ae7[_0xf1a1('0x31')],_0x479ae7[_0xf1a1('0x33')]);_0x3172ea[_0xf1a1('0x35')]=_['intersection'](_0x479ae7[_0xf1a1('0x31')],qs[_0xf1a1('0x37')](_0x21f263['query']['fields']));_0x3172ea['attributes']=_0x3172ea[_0xf1a1('0x35')]['length']?_0x3172ea['attributes']:_0x479ae7[_0xf1a1('0x31')];if(_0x21f263['query'][_0xf1a1('0x41')]){_0x3172ea[_0xf1a1('0x42')]=[{'all':!![]}];}_0x3172ea=_[_0xf1a1('0x3e')]({},_0x3172ea,_0x21f263[_0xf1a1('0x40')]);return db['CannedAnswer']['find'](_0x3172ea)[_0xf1a1('0x23')](handleEntityNotFound(_0x551b9a,null))[_0xf1a1('0x23')](respondWithResult(_0x551b9a,null))[_0xf1a1('0x44')](handleError(_0x551b9a,null));};exports['update']=function(_0x358e5f,_0x26151f){if(_0x358e5f[_0xf1a1('0x48')]['id']){delete _0x358e5f[_0xf1a1('0x48')]['id'];}return db[_0xf1a1('0x2e')][_0xf1a1('0x49')]({'where':{'id':_0x358e5f[_0xf1a1('0x46')]['id']}})[_0xf1a1('0x23')](handleEntityNotFound(_0x26151f,null))[_0xf1a1('0x23')](saveUpdates(_0x358e5f['body'],null))[_0xf1a1('0x23')](respondWithResult(_0x26151f,null))[_0xf1a1('0x44')](handleError(_0x26151f,null));};exports['destroy']=function(_0x12444b,_0x4ed892){return db['CannedAnswer'][_0xf1a1('0x49')]({'where':{'id':_0x12444b[_0xf1a1('0x46')]['id']}})[_0xf1a1('0x23')](handleEntityNotFound(_0x4ed892,null))[_0xf1a1('0x23')](removeEntity(_0x4ed892,null))['catch'](handleError(_0x4ed892,null));};exports[_0xf1a1('0x4a')]=function(_0x5417e5,_0x16e7fe){var _0x3e583d={'key':_0x5417e5[_0xf1a1('0x48')]['key']};if(_0x5417e5['body'][_0xf1a1('0x4b')]){_0x3e583d[_0xf1a1('0x4b')]=_0x5417e5[_0xf1a1('0x48')][_0xf1a1('0x4b')];}else if(_0x5417e5[_0xf1a1('0x48')][_0xf1a1('0x4c')]){_0x3e583d[_0xf1a1('0x4c')]=_0x5417e5[_0xf1a1('0x48')]['SmsAccountId'];}else if(_0x5417e5[_0xf1a1('0x48')][_0xf1a1('0x4d')]){_0x3e583d[_0xf1a1('0x4d')]=_0x5417e5['body'][_0xf1a1('0x4d')];}else if(_0x5417e5['body'][_0xf1a1('0x4e')]){_0x3e583d[_0xf1a1('0x4e')]=_0x5417e5[_0xf1a1('0x48')][_0xf1a1('0x4e')];}return db[_0xf1a1('0x2e')][_0xf1a1('0x49')]({'where':_0x3e583d})['then'](function(_0x3a0698){if(_0x3a0698){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xf1a1('0x2e')][_0xf1a1('0x4a')](_0x5417e5[_0xf1a1('0x48')]);})[_0xf1a1('0x23')](function(_0x1423d5){var _0x413080=_0x5417e5[_0xf1a1('0x4f')][_0xf1a1('0x25')]({'plain':!![]});if(!_0x413080)throw new Error(_0xf1a1('0x50'));if(_0x413080[_0xf1a1('0x51')]===_0xf1a1('0x4f')){var _0x51aa6c=_0x1423d5['get']({'plain':!![]});return db[_0xf1a1('0x52')]['find']({'where':{'name':_0xf1a1('0x26'),'userProfileId':_0x413080[_0xf1a1('0x53')]},'raw':!![]})[_0xf1a1('0x23')](function(_0x1cc2cd){if(_0x1cc2cd&&_0x1cc2cd[_0xf1a1('0x54')]===0x0){return db[_0xf1a1('0x27')][_0xf1a1('0x4a')]({'name':_0x51aa6c[_0xf1a1('0x2a')],'resourceId':_0x51aa6c['id'],'type':_0x1cc2cd[_0xf1a1('0x2a')],'sectionId':_0x1cc2cd['id']},{})[_0xf1a1('0x23')](function(){return _0x1423d5;});}else{return _0x1423d5;}})[_0xf1a1('0x44')](function(_0x171bec){logger[_0xf1a1('0x29')](_0xf1a1('0x55'),_0x171bec);throw _0x171bec;});}return _0x1423d5;})['then'](respondWithResult(_0x16e7fe,0xc9))[_0xf1a1('0x44')](handleError(_0x16e7fe,null));}; \ No newline at end of file +var _0xa0b1=['filters','pick','filter','where','options','CannedAnswer','findAll','rows','catch','params','keys','includeAll','include','merge','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xa0b1,0x128));var _0x1a0b=function(_0x3394a6,_0x7b1ede){_0x3394a6=_0x3394a6-0x0;var _0x4a7909=_0xa0b1[_0x3394a6];return _0x4a7909;};'use strict';var emlformat=require(_0x1a0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a0b('0x2'));var moment=require(_0x1a0b('0x3'));var BPromise=require(_0x1a0b('0x4'));var Mustache=require(_0x1a0b('0x5'));var util=require(_0x1a0b('0x6'));var path=require(_0x1a0b('0x7'));var sox=require('sox');var csv=require(_0x1a0b('0x8'));var ejs=require(_0x1a0b('0x9'));var fs=require('fs');var fs_extra=require(_0x1a0b('0xa'));var _=require(_0x1a0b('0xb'));var squel=require(_0x1a0b('0xc'));var crypto=require(_0x1a0b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1a0b('0xe'));var toCsv=require(_0x1a0b('0x8'));var querystring=require(_0x1a0b('0xf'));var Papa=require(_0x1a0b('0x10'));var Redis=require(_0x1a0b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1a0b('0x12'));var as=require(_0x1a0b('0x13'));var hardwareService=require(_0x1a0b('0x14'));var logger=require(_0x1a0b('0x15'))(_0x1a0b('0x16'));var utils=require(_0x1a0b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1a0b('0x18'));var db=require(_0x1a0b('0x19'))['db'];function respondWithStatusCode(_0x2b1647,_0x3dc34f){_0x3dc34f=_0x3dc34f||0xcc;return function(_0x524fd1){if(_0x524fd1){return _0x2b1647[_0x1a0b('0x1a')](_0x3dc34f);}return _0x2b1647[_0x1a0b('0x1b')](_0x3dc34f)[_0x1a0b('0x1c')]();};}function respondWithResult(_0x2331be,_0x395202){_0x395202=_0x395202||0xc8;return function(_0x58eaa7){if(_0x58eaa7){return _0x2331be[_0x1a0b('0x1b')](_0x395202)[_0x1a0b('0x1d')](_0x58eaa7);}};}function respondWithFilteredResult(_0x144f49,_0x3bffde){return function(_0x5ad3bd){if(_0x5ad3bd){var _0x15c20e=typeof _0x3bffde[_0x1a0b('0x1e')]===_0x1a0b('0x1f')&&typeof _0x3bffde[_0x1a0b('0x20')]==='undefined';var _0x141858=_0x5ad3bd[_0x1a0b('0x21')];var _0x21f019=_0x15c20e?0x0:_0x3bffde[_0x1a0b('0x1e')];var _0x1447e2=_0x15c20e?_0x5ad3bd[_0x1a0b('0x21')]:_0x3bffde['offset']+_0x3bffde[_0x1a0b('0x20')];var _0x31b8a1;if(_0x1447e2>=_0x141858){_0x1447e2=_0x141858;_0x31b8a1=0xc8;}else{_0x31b8a1=0xce;}_0x144f49[_0x1a0b('0x1b')](_0x31b8a1);return _0x144f49['set'](_0x1a0b('0x22'),_0x21f019+'-'+_0x1447e2+'/'+_0x141858)[_0x1a0b('0x1d')](_0x5ad3bd);}return null;};}function patchUpdates(_0x36623b){return function(_0x22c64b){try{jsonpatch[_0x1a0b('0x23')](_0x22c64b,_0x36623b,!![]);}catch(_0x9c0631){return BPromise[_0x1a0b('0x24')](_0x9c0631);}return _0x22c64b['save']();};}function saveUpdates(_0x2ffd8d,_0x1f0e62){return function(_0x2ea48e){if(_0x2ea48e){return _0x2ea48e[_0x1a0b('0x25')](_0x2ffd8d)['then'](function(_0x39ccdb){return _0x39ccdb;});}return null;};}function removeEntity(_0x2d10ce,_0xc53c5c){return function(_0xb1bc82){if(_0xb1bc82){return _0xb1bc82[_0x1a0b('0x26')]()[_0x1a0b('0x27')](function(){var _0x1d535e=_0xb1bc82[_0x1a0b('0x28')]({'plain':!![]});var _0x5cdd89=_0x1a0b('0x29');return db[_0x1a0b('0x2a')][_0x1a0b('0x26')]({'where':{'type':_0x5cdd89,'resourceId':_0x1d535e['id']}})['then'](function(){return _0xb1bc82;});})[_0x1a0b('0x27')](function(){_0x2d10ce['status'](0xcc)[_0x1a0b('0x1c')]();});}};}function handleEntityNotFound(_0x5572f5,_0x18a68d){return function(_0x309b51){if(!_0x309b51){_0x5572f5[_0x1a0b('0x1a')](0x194);}return _0x309b51;};}function handleError(_0x51e90a,_0x12518e){_0x12518e=_0x12518e||0x1f4;return function(_0x5d7d56){logger[_0x1a0b('0x2b')](_0x5d7d56[_0x1a0b('0x2c')]);if(_0x5d7d56[_0x1a0b('0x2d')]){delete _0x5d7d56[_0x1a0b('0x2d')];}_0x51e90a[_0x1a0b('0x1b')](_0x12518e)['send'](_0x5d7d56);};}exports['index']=function(_0x529013,_0x2df315){var _0x3538d0={},_0x4b9644={},_0x22b8db={'count':0x0,'rows':[]};var _0x2e0e91=_[_0x1a0b('0x2e')](db['CannedAnswer'][_0x1a0b('0x2f')],function(_0x62451d){return{'name':_0x62451d[_0x1a0b('0x30')],'type':_0x62451d['type'][_0x1a0b('0x31')]};});_0x4b9644[_0x1a0b('0x32')]=_[_0x1a0b('0x2e')](_0x2e0e91,_0x1a0b('0x2d'));_0x4b9644['query']=_['keys'](_0x529013[_0x1a0b('0x33')]);_0x4b9644['filters']=_[_0x1a0b('0x34')](_0x4b9644[_0x1a0b('0x32')],_0x4b9644[_0x1a0b('0x33')]);_0x3538d0['attributes']=_[_0x1a0b('0x34')](_0x4b9644[_0x1a0b('0x32')],qs[_0x1a0b('0x35')](_0x529013[_0x1a0b('0x33')]['fields']));_0x3538d0[_0x1a0b('0x36')]=_0x3538d0['attributes'][_0x1a0b('0x37')]?_0x3538d0[_0x1a0b('0x36')]:_0x4b9644['model'];if(!_0x529013['query'][_0x1a0b('0x38')](_0x1a0b('0x39'))){_0x3538d0[_0x1a0b('0x20')]=qs['limit'](_0x529013[_0x1a0b('0x33')]['limit']);_0x3538d0[_0x1a0b('0x1e')]=qs[_0x1a0b('0x1e')](_0x529013[_0x1a0b('0x33')][_0x1a0b('0x1e')]);}_0x3538d0[_0x1a0b('0x3a')]=qs['sort'](_0x529013[_0x1a0b('0x33')][_0x1a0b('0x3b')]);_0x3538d0['where']=qs[_0x1a0b('0x3c')](_[_0x1a0b('0x3d')](_0x529013[_0x1a0b('0x33')],_0x4b9644[_0x1a0b('0x3c')]),_0x2e0e91);if(_0x529013[_0x1a0b('0x33')][_0x1a0b('0x3e')]){_0x3538d0['where']=_['merge'](_0x3538d0[_0x1a0b('0x3f')],{'$or':[{'key':{'$like':'%'+_0x529013[_0x1a0b('0x33')][_0x1a0b('0x3e')]+'%'}},{'value':{'$like':'%'+_0x529013[_0x1a0b('0x33')]['filter']+'%'}}]});}_0x3538d0=_['merge']({},_0x3538d0,_0x529013[_0x1a0b('0x40')]);var _0x268c51={'where':_0x3538d0[_0x1a0b('0x3f')]};return db[_0x1a0b('0x41')][_0x1a0b('0x21')](_0x268c51)[_0x1a0b('0x27')](function(_0x4a17b0){_0x22b8db[_0x1a0b('0x21')]=_0x4a17b0;if(_0x529013[_0x1a0b('0x33')]['includeAll']){_0x3538d0['include']=[{'all':!![]}];}return db[_0x1a0b('0x41')][_0x1a0b('0x42')](_0x3538d0);})[_0x1a0b('0x27')](function(_0x163e6b){_0x22b8db[_0x1a0b('0x43')]=_0x163e6b;return _0x22b8db;})[_0x1a0b('0x27')](respondWithFilteredResult(_0x2df315,_0x3538d0))[_0x1a0b('0x44')](handleError(_0x2df315,null));};exports['show']=function(_0x44860a,_0x288174){var _0x1e54dc={'raw':!![],'where':{'id':_0x44860a[_0x1a0b('0x45')]['id']}},_0x23ee18={};_0x23ee18[_0x1a0b('0x32')]=_[_0x1a0b('0x46')](db[_0x1a0b('0x41')]['rawAttributes']);_0x23ee18[_0x1a0b('0x33')]=_['keys'](_0x44860a[_0x1a0b('0x33')]);_0x23ee18['filters']=_[_0x1a0b('0x34')](_0x23ee18[_0x1a0b('0x32')],_0x23ee18[_0x1a0b('0x33')]);_0x1e54dc['attributes']=_[_0x1a0b('0x34')](_0x23ee18[_0x1a0b('0x32')],qs['fields'](_0x44860a[_0x1a0b('0x33')][_0x1a0b('0x35')]));_0x1e54dc[_0x1a0b('0x36')]=_0x1e54dc[_0x1a0b('0x36')][_0x1a0b('0x37')]?_0x1e54dc[_0x1a0b('0x36')]:_0x23ee18[_0x1a0b('0x32')];if(_0x44860a['query'][_0x1a0b('0x47')]){_0x1e54dc[_0x1a0b('0x48')]=[{'all':!![]}];}_0x1e54dc=_[_0x1a0b('0x49')]({},_0x1e54dc,_0x44860a[_0x1a0b('0x40')]);return db['CannedAnswer'][_0x1a0b('0x4a')](_0x1e54dc)[_0x1a0b('0x27')](handleEntityNotFound(_0x288174,null))['then'](respondWithResult(_0x288174,null))[_0x1a0b('0x44')](handleError(_0x288174,null));};exports['update']=function(_0x3a5ff2,_0x5959f5){if(_0x3a5ff2[_0x1a0b('0x4b')]['id']){delete _0x3a5ff2[_0x1a0b('0x4b')]['id'];}return db[_0x1a0b('0x41')][_0x1a0b('0x4a')]({'where':{'id':_0x3a5ff2[_0x1a0b('0x45')]['id']}})[_0x1a0b('0x27')](handleEntityNotFound(_0x5959f5,null))[_0x1a0b('0x27')](saveUpdates(_0x3a5ff2[_0x1a0b('0x4b')],null))[_0x1a0b('0x27')](respondWithResult(_0x5959f5,null))['catch'](handleError(_0x5959f5,null));};exports[_0x1a0b('0x26')]=function(_0x26d3bb,_0x35c92e){return db[_0x1a0b('0x41')][_0x1a0b('0x4a')]({'where':{'id':_0x26d3bb[_0x1a0b('0x45')]['id']}})[_0x1a0b('0x27')](handleEntityNotFound(_0x35c92e,null))[_0x1a0b('0x27')](removeEntity(_0x35c92e,null))[_0x1a0b('0x44')](handleError(_0x35c92e,null));};exports['create']=function(_0x41f977,_0x12f002){var _0x5ad145={'key':_0x41f977['body'][_0x1a0b('0x31')]};if(_0x41f977[_0x1a0b('0x4b')][_0x1a0b('0x4c')]){_0x5ad145[_0x1a0b('0x4c')]=_0x41f977[_0x1a0b('0x4b')]['MailAccountId'];}else if(_0x41f977[_0x1a0b('0x4b')][_0x1a0b('0x4d')]){_0x5ad145[_0x1a0b('0x4d')]=_0x41f977[_0x1a0b('0x4b')][_0x1a0b('0x4d')];}else if(_0x41f977['body'][_0x1a0b('0x4e')]){_0x5ad145['OpenchannelAccountId']=_0x41f977[_0x1a0b('0x4b')]['OpenchannelAccountId'];}else if(_0x41f977['body'][_0x1a0b('0x4f')]){_0x5ad145[_0x1a0b('0x4f')]=_0x41f977['body'][_0x1a0b('0x4f')];}return db[_0x1a0b('0x41')][_0x1a0b('0x4a')]({'where':_0x5ad145})[_0x1a0b('0x27')](function(_0x40ac6c){if(_0x40ac6c){throw new db['Sequelize'][(_0x1a0b('0x50'))](_0x1a0b('0x51'));}return db['CannedAnswer'][_0x1a0b('0x52')](_0x41f977['body']);})[_0x1a0b('0x27')](function(_0x33b2bd){var _0x2e7b88=_0x41f977[_0x1a0b('0x53')]['get']({'plain':!![]});if(!_0x2e7b88)throw new Error(_0x1a0b('0x54'));if(_0x2e7b88[_0x1a0b('0x55')]===_0x1a0b('0x53')){var _0x3ff29e=_0x33b2bd[_0x1a0b('0x28')]({'plain':!![]});return db[_0x1a0b('0x56')][_0x1a0b('0x4a')]({'where':{'name':_0x1a0b('0x29'),'userProfileId':_0x2e7b88[_0x1a0b('0x57')]},'raw':!![]})['then'](function(_0x3fee5a){if(_0x3fee5a&&_0x3fee5a['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a0b('0x52')]({'name':_0x3ff29e['name'],'resourceId':_0x3ff29e['id'],'type':_0x3fee5a[_0x1a0b('0x2d')],'sectionId':_0x3fee5a['id']},{})[_0x1a0b('0x27')](function(){return _0x33b2bd;});}else{return _0x33b2bd;}})['catch'](function(_0x56e434){logger[_0x1a0b('0x2b')](_0x1a0b('0x58'),_0x56e434);throw _0x56e434;});}return _0x33b2bd;})[_0x1a0b('0x27')](respondWithResult(_0x12f002,0xc9))[_0x1a0b('0x44')](handleError(_0x12f002,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 13924b5..5045c27 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 _0x05f8=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util'];(function(_0x303ea4,_0x2acf5d){var _0x217134=function(_0x25ed99){while(--_0x25ed99){_0x303ea4['push'](_0x303ea4['shift']());}};_0x217134(++_0x2acf5d);}(_0x05f8,0x175));var _0x805f=function(_0x2dd8a1,_0x4add9e){_0x2dd8a1=_0x2dd8a1-0x0;var _0x3aeda=_0x05f8[_0x2dd8a1];return _0x3aeda;};'use strict';var _=require(_0x805f('0x0'));var util=require(_0x805f('0x1'));var logger=require(_0x805f('0x2'))('api');var moment=require(_0x805f('0x3'));var BPromise=require(_0x805f('0x4'));var rp=require(_0x805f('0x5'));var fs=require('fs');var path=require(_0x805f('0x6'));var rimraf=require(_0x805f('0x7'));var config=require(_0x805f('0x8'));var attributes=require(_0x805f('0x9'));module[_0x805f('0xa')]=function(_0x3e594c,_0x2f8466){return _0x3e594c[_0x805f('0xb')](_0x805f('0xc'),attributes,{'tableName':_0x805f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x805f('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8d84=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x8d84,0xfe));var _0x48d8=function(_0x35ff48,_0x50592f){_0x35ff48=_0x35ff48-0x0;var _0x2ab29f=_0x8d84[_0x35ff48];return _0x2ab29f;};'use strict';var _=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var logger=require(_0x48d8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x48d8('0x3'));var rp=require(_0x48d8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48d8('0x5'));var config=require(_0x48d8('0x6'));var attributes=require(_0x48d8('0x7'));module[_0x48d8('0x8')]=function(_0x3f1843,_0x8c1e97){return _0x3f1843[_0x48d8('0x9')](_0x48d8('0xa'),attributes,{'tableName':_0x48d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x48d8('0xc'),'collate':_0x48d8('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5ff9fad..aab88ca 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(_0x1766b2,_0x15827c){var _0x1f2955=function(_0x5dc0c2){while(--_0x5dc0c2){_0x1766b2['push'](_0x1766b2['shift']());}};_0x1f2955(++_0x15827c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37350a,_0x400d32){var _0x43312a=function(_0x5173ab){while(--_0x5173ab){_0x37350a['push'](_0x37350a['shift']());}};_0x43312a(++_0x400d32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 be22847..eab4542 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 _0x58c5=['./cannedAnswer.controller','get','isAuthenticated','index','show','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x122520,_0x57ff93){var _0x176d87=function(_0x333edf){while(--_0x333edf){_0x122520['push'](_0x122520['shift']());}};_0x176d87(++_0x57ff93);}(_0x58c5,0x1a9));var _0x558c=function(_0x4fab00,_0x14076a){_0x4fab00=_0x4fab00-0x0;var _0x4f67b2=_0x58c5[_0x4fab00];return _0x4f67b2;};'use strict';var multer=require(_0x558c('0x0'));var util=require(_0x558c('0x1'));var path=require('path');var timeout=require(_0x558c('0x2'));var express=require(_0x558c('0x3'));var router=express[_0x558c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x558c('0x5'));var interaction=require(_0x558c('0x6'));var config=require('../../config/environment');var controller=require(_0x558c('0x7'));router[_0x558c('0x8')]('/',auth[_0x558c('0x9')](),controller[_0x558c('0xa')]);router[_0x558c('0x8')]('/:id',auth[_0x558c('0x9')](),controller[_0x558c('0xb')]);router['post']('/',auth[_0x558c('0x9')](),controller['create']);router[_0x558c('0xc')](_0x558c('0xd'),auth[_0x558c('0x9')](),controller[_0x558c('0xe')]);router['delete'](_0x558c('0xd'),auth[_0x558c('0x9')](),controller[_0x558c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0c56=['fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x25cb0a,_0x549fda){var _0x5483ac=function(_0x32eaa6){while(--_0x32eaa6){_0x25cb0a['push'](_0x25cb0a['shift']());}};_0x5483ac(++_0x549fda);}(_0x0c56,0x12b));var _0x60c5=function(_0x4fa8f2,_0x56d32d){_0x4fa8f2=_0x4fa8f2-0x0;var _0xbf88da=_0x0c56[_0x4fa8f2];return _0xbf88da;};'use strict';var multer=require(_0x60c5('0x0'));var util=require(_0x60c5('0x1'));var path=require('path');var timeout=require(_0x60c5('0x2'));var express=require(_0x60c5('0x3'));var router=express[_0x60c5('0x4')]();var fs_extra=require(_0x60c5('0x5'));var auth=require(_0x60c5('0x6'));var interaction=require(_0x60c5('0x7'));var config=require('../../config/environment');var controller=require(_0x60c5('0x8'));router[_0x60c5('0x9')]('/',auth[_0x60c5('0xa')](),controller[_0x60c5('0xb')]);router['get'](_0x60c5('0xc'),auth[_0x60c5('0xa')](),controller[_0x60c5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x60c5('0xe')]);router[_0x60c5('0xf')](_0x60c5('0xc'),auth[_0x60c5('0xa')](),controller[_0x60c5('0x10')]);router['delete'](_0x60c5('0xc'),auth[_0x60c5('0xa')](),controller[_0x60c5('0x11')]);module[_0x60c5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6277e81..ce9d00e 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 _0x9010=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x9010,0xdf));var _0x0901=function(_0x3daff7,_0x2edcd4){_0x3daff7=_0x3daff7-0x0;var _0x5b4d5b=_0x9010[_0x3daff7];return _0x5b4d5b;};'use strict';var Sequelize=require(_0x0901('0x0'));module[_0x0901('0x1')]={'calldate':{'type':Sequelize[_0x0901('0x2')],'allowNull':![],'defaultValue':_0x0901('0x3')},'clid':{'type':Sequelize[_0x0901('0x4')]},'src':{'type':Sequelize[_0x0901('0x4')]},'dst':{'type':Sequelize[_0x0901('0x4')]},'dcontext':{'type':Sequelize[_0x0901('0x4')]},'channel':{'type':Sequelize[_0x0901('0x4')]},'dstchannel':{'type':Sequelize[_0x0901('0x4')]},'lastapp':{'type':Sequelize[_0x0901('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x0901('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0901('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0901('0x4')]},'amaflags':{'type':Sequelize[_0x0901('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0901('0x4')]},'userfield':{'type':Sequelize[_0x0901('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0901('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x0901('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x0901('0x4')]}}; \ No newline at end of file +var _0xffaa=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x1e3c58,_0x4baead){var _0x2cd780=function(_0x2e4fe1){while(--_0x2e4fe1){_0x1e3c58['push'](_0x1e3c58['shift']());}};_0x2cd780(++_0x4baead);}(_0xffaa,0x130));var _0xaffa=function(_0x36510e,_0x148437){_0x36510e=_0x36510e-0x0;var _0xe732fd=_0xffaa[_0x36510e];return _0xe732fd;};'use strict';var Sequelize=require(_0xaffa('0x0'));module[_0xaffa('0x1')]={'calldate':{'type':Sequelize[_0xaffa('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xaffa('0x3')]},'dst':{'type':Sequelize[_0xaffa('0x3')]},'dcontext':{'type':Sequelize[_0xaffa('0x3')]},'channel':{'type':Sequelize[_0xaffa('0x3')]},'dstchannel':{'type':Sequelize[_0xaffa('0x3')]},'lastapp':{'type':Sequelize[_0xaffa('0x3')]},'lastdata':{'type':Sequelize[_0xaffa('0x3')]},'duration':{'type':Sequelize[_0xaffa('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xaffa('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaffa('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xaffa('0x3')]},'userfield':{'type':Sequelize[_0xaffa('0x3')]},'uniqueid':{'type':Sequelize[_0xaffa('0x3')]},'linkedid':{'type':Sequelize[_0xaffa('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xaffa('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xaffa('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index a50066b..11e9f66 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 _0x5a5a=['options','where','Cdr','includeAll','include','rows','show','keys','catch','create','body','update','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','then','destroy','error','stack','send','index','map','rawAttributes','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','type'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x4f0f6d,_0x28b6f4){_0x4f0f6d=_0x4f0f6d-0x0;var _0x2b2c98=_0x5a5a[_0x4f0f6d];return _0x2b2c98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5a5('0x0'));var zipdir=require(_0xa5a5('0x1'));var jsonpatch=require(_0xa5a5('0x2'));var rp=require(_0xa5a5('0x3'));var moment=require(_0xa5a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5a5('0x5'));var util=require(_0xa5a5('0x6'));var path=require(_0xa5a5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa5a5('0x8'));var fs=require('fs');var fs_extra=require(_0xa5a5('0x9'));var _=require('lodash');var squel=require(_0xa5a5('0xa'));var crypto=require(_0xa5a5('0xb'));var jsforce=require(_0xa5a5('0xc'));var deskjs=require(_0xa5a5('0xd'));var toCsv=require(_0xa5a5('0xe'));var querystring=require('querystring');var Papa=require(_0xa5a5('0xf'));var Redis=require(_0xa5a5('0x10'));var authService=require(_0xa5a5('0x11'));var qs=require(_0xa5a5('0x12'));var as=require(_0xa5a5('0x13'));var hardwareService=require(_0xa5a5('0x14'));var logger=require(_0xa5a5('0x15'))(_0xa5a5('0x16'));var utils=require(_0xa5a5('0x17'));var config=require(_0xa5a5('0x18'));var licenseUtil=require(_0xa5a5('0x19'));var db=require(_0xa5a5('0x1a'))['db'];function respondWithStatusCode(_0x567d9b,_0x245a65){_0x245a65=_0x245a65||0xcc;return function(_0x420b1d){if(_0x420b1d){return _0x567d9b[_0xa5a5('0x1b')](_0x245a65);}return _0x567d9b[_0xa5a5('0x1c')](_0x245a65)[_0xa5a5('0x1d')]();};}function respondWithResult(_0xa81eeb,_0x5d71e4){_0x5d71e4=_0x5d71e4||0xc8;return function(_0x3382c6){if(_0x3382c6){return _0xa81eeb[_0xa5a5('0x1c')](_0x5d71e4)[_0xa5a5('0x1e')](_0x3382c6);}};}function respondWithFilteredResult(_0x15370d,_0x2daae6){return function(_0x38305a){if(_0x38305a){var _0x1464d9=typeof _0x2daae6[_0xa5a5('0x1f')]==='undefined'&&typeof _0x2daae6[_0xa5a5('0x20')]===_0xa5a5('0x21');var _0x4571f5=_0x38305a[_0xa5a5('0x22')];var _0x3c4cae=_0x1464d9?0x0:_0x2daae6[_0xa5a5('0x1f')];var _0x28c89f=_0x1464d9?_0x38305a['count']:_0x2daae6[_0xa5a5('0x1f')]+_0x2daae6[_0xa5a5('0x20')];var _0x21488a;if(_0x28c89f>=_0x4571f5){_0x28c89f=_0x4571f5;_0x21488a=0xc8;}else{_0x21488a=0xce;}_0x15370d[_0xa5a5('0x1c')](_0x21488a);return _0x15370d['set'](_0xa5a5('0x23'),_0x3c4cae+'-'+_0x28c89f+'/'+_0x4571f5)['json'](_0x38305a);}return null;};}function patchUpdates(_0x2554c0){return function(_0x22774d){try{jsonpatch[_0xa5a5('0x24')](_0x22774d,_0x2554c0,!![]);}catch(_0x379f0d){return BPromise['reject'](_0x379f0d);}return _0x22774d['save']();};}function saveUpdates(_0x2001ed,_0x1a258f){return function(_0x417df3){if(_0x417df3){return _0x417df3['update'](_0x2001ed)[_0xa5a5('0x25')](function(_0x4b4613){return _0x4b4613;});}return null;};}function removeEntity(_0x337e52,_0x4996b3){return function(_0x4c0ff2){if(_0x4c0ff2){return _0x4c0ff2[_0xa5a5('0x26')]()[_0xa5a5('0x25')](function(){_0x337e52[_0xa5a5('0x1c')](0xcc)[_0xa5a5('0x1d')]();});}};}function handleEntityNotFound(_0x55ed28,_0x3583b1){return function(_0x54dfdc){if(!_0x54dfdc){_0x55ed28[_0xa5a5('0x1b')](0x194);}return _0x54dfdc;};}function handleError(_0xd37524,_0x516ccf){_0x516ccf=_0x516ccf||0x1f4;return function(_0x5ccc1e){logger[_0xa5a5('0x27')](_0x5ccc1e[_0xa5a5('0x28')]);if(_0x5ccc1e['name']){delete _0x5ccc1e['name'];}_0xd37524[_0xa5a5('0x1c')](_0x516ccf)[_0xa5a5('0x29')](_0x5ccc1e);};}exports[_0xa5a5('0x2a')]=function(_0x4d1201,_0x16fdd4){var _0x3bdd0a={},_0x58dc9e={},_0x122e3f={'count':0x0,'rows':[]};var _0x4d1eef=_[_0xa5a5('0x2b')](db['Cdr'][_0xa5a5('0x2c')],function(_0x190a33){return{'name':_0x190a33['fieldName'],'type':_0x190a33['type']['key']};});_0x58dc9e[_0xa5a5('0x2d')]=_['map'](_0x4d1eef,_0xa5a5('0x2e'));_0x58dc9e[_0xa5a5('0x2f')]=_['keys'](_0x4d1201[_0xa5a5('0x2f')]);_0x58dc9e[_0xa5a5('0x30')]=_['intersection'](_0x58dc9e[_0xa5a5('0x2d')],_0x58dc9e[_0xa5a5('0x2f')]);_0x3bdd0a[_0xa5a5('0x31')]=_[_0xa5a5('0x32')](_0x58dc9e[_0xa5a5('0x2d')],qs[_0xa5a5('0x33')](_0x4d1201[_0xa5a5('0x2f')]['fields']));_0x3bdd0a[_0xa5a5('0x31')]=_0x3bdd0a[_0xa5a5('0x31')][_0xa5a5('0x34')]?_0x3bdd0a[_0xa5a5('0x31')]:_0x58dc9e[_0xa5a5('0x2d')];if(!_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x35')](_0xa5a5('0x36'))){_0x3bdd0a[_0xa5a5('0x20')]=qs[_0xa5a5('0x20')](_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x20')]);_0x3bdd0a[_0xa5a5('0x1f')]=qs[_0xa5a5('0x1f')](_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x1f')]);}_0x3bdd0a[_0xa5a5('0x37')]=qs['sort'](_0x4d1201[_0xa5a5('0x2f')]['sort']);_0x3bdd0a['where']=qs['filters'](_[_0xa5a5('0x38')](_0x4d1201['query'],_0x58dc9e[_0xa5a5('0x30')]),_0x4d1eef);if(_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x39')]){_0x3bdd0a['where']=_[_0xa5a5('0x3a')](_0x3bdd0a['where'],{'$or':_['map'](_0x4d1eef,function(_0x43c2ff){if(_0x43c2ff[_0xa5a5('0x3b')]!=='VIRTUAL'){var _0x421255={};_0x421255[_0x43c2ff['name']]={'$like':'%'+_0x4d1201['query'][_0xa5a5('0x39')]+'%'};return _0x421255;}})});}_0x3bdd0a=_['merge']({},_0x3bdd0a,_0x4d1201[_0xa5a5('0x3c')]);var _0x53fe36={'where':_0x3bdd0a[_0xa5a5('0x3d')]};return db[_0xa5a5('0x3e')][_0xa5a5('0x22')](_0x53fe36)[_0xa5a5('0x25')](function(_0x71fb38){_0x122e3f[_0xa5a5('0x22')]=_0x71fb38;if(_0x4d1201[_0xa5a5('0x2f')][_0xa5a5('0x3f')]){_0x3bdd0a[_0xa5a5('0x40')]=[{'all':!![]}];}return db[_0xa5a5('0x3e')]['findAll'](_0x3bdd0a);})[_0xa5a5('0x25')](function(_0x491532){_0x122e3f[_0xa5a5('0x41')]=_0x491532;return _0x122e3f;})[_0xa5a5('0x25')](respondWithFilteredResult(_0x16fdd4,_0x3bdd0a))['catch'](handleError(_0x16fdd4,null));};exports[_0xa5a5('0x42')]=function(_0x2717b3,_0x2373f4){var _0x3a2e7e={'raw':!![],'where':{'id':_0x2717b3['params']['id']}},_0x4780b9={};_0x4780b9[_0xa5a5('0x2d')]=_[_0xa5a5('0x43')](db['Cdr'][_0xa5a5('0x2c')]);_0x4780b9[_0xa5a5('0x2f')]=_[_0xa5a5('0x43')](_0x2717b3[_0xa5a5('0x2f')]);_0x4780b9[_0xa5a5('0x30')]=_[_0xa5a5('0x32')](_0x4780b9[_0xa5a5('0x2d')],_0x4780b9['query']);_0x3a2e7e[_0xa5a5('0x31')]=_['intersection'](_0x4780b9[_0xa5a5('0x2d')],qs['fields'](_0x2717b3['query'][_0xa5a5('0x33')]));_0x3a2e7e[_0xa5a5('0x31')]=_0x3a2e7e[_0xa5a5('0x31')]['length']?_0x3a2e7e[_0xa5a5('0x31')]:_0x4780b9['model'];if(_0x2717b3['query'][_0xa5a5('0x3f')]){_0x3a2e7e[_0xa5a5('0x40')]=[{'all':!![]}];}_0x3a2e7e=_[_0xa5a5('0x3a')]({},_0x3a2e7e,_0x2717b3['options']);return db[_0xa5a5('0x3e')]['find'](_0x3a2e7e)['then'](handleEntityNotFound(_0x2373f4,null))[_0xa5a5('0x25')](respondWithResult(_0x2373f4,null))[_0xa5a5('0x44')](handleError(_0x2373f4,null));};exports[_0xa5a5('0x45')]=function(_0x25091f,_0x268cfb){return db[_0xa5a5('0x3e')][_0xa5a5('0x45')](_0x25091f[_0xa5a5('0x46')],{})['then'](respondWithResult(_0x268cfb,0xc9))[_0xa5a5('0x44')](handleError(_0x268cfb,null));};exports[_0xa5a5('0x47')]=function(_0x2db032,_0x232bc5){if(_0x2db032[_0xa5a5('0x46')]['id']){delete _0x2db032[_0xa5a5('0x46')]['id'];}return db['Cdr'][_0xa5a5('0x48')]({'where':{'id':_0x2db032[_0xa5a5('0x49')]['id']}})['then'](handleEntityNotFound(_0x232bc5,null))[_0xa5a5('0x25')](saveUpdates(_0x2db032[_0xa5a5('0x46')],null))[_0xa5a5('0x25')](respondWithResult(_0x232bc5,null))['catch'](handleError(_0x232bc5,null));};exports[_0xa5a5('0x26')]=function(_0x337949,_0x6ad8c9){return db[_0xa5a5('0x3e')]['find']({'where':{'id':_0x337949['params']['id']}})[_0xa5a5('0x25')](handleEntityNotFound(_0x6ad8c9,null))[_0xa5a5('0x25')](removeEntity(_0x6ad8c9,null))[_0xa5a5('0x44')](handleError(_0x6ad8c9,null));};exports['describe']=function(_0xe2dd58,_0x12d908){return db[_0xa5a5('0x3e')][_0xa5a5('0x4a')]()[_0xa5a5('0x25')](respondWithResult(_0x12d908,null))[_0xa5a5('0x44')](handleError(_0x12d908,null));}; \ No newline at end of file +var _0x5fd1=['fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','Cdr','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs'];(function(_0x13ee86,_0x501a7f){var _0x377722=function(_0x20ae4b){while(--_0x20ae4b){_0x13ee86['push'](_0x13ee86['shift']());}};_0x377722(++_0x501a7f);}(_0x5fd1,0x155));var _0x15fd=function(_0x2eff2d,_0x54ad03){_0x2eff2d=_0x2eff2d-0x0;var _0x48e190=_0x5fd1[_0x2eff2d];return _0x48e190;};'use strict';var emlformat=require(_0x15fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15fd('0x1'));var jsonpatch=require(_0x15fd('0x2'));var rp=require(_0x15fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15fd('0x4'));var util=require(_0x15fd('0x5'));var path=require(_0x15fd('0x6'));var sox=require('sox');var csv=require(_0x15fd('0x7'));var ejs=require(_0x15fd('0x8'));var fs=require('fs');var fs_extra=require(_0x15fd('0x9'));var _=require(_0x15fd('0xa'));var squel=require(_0x15fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x15fd('0xc'));var deskjs=require(_0x15fd('0xd'));var toCsv=require(_0x15fd('0x7'));var querystring=require('querystring');var Papa=require(_0x15fd('0xe'));var Redis=require('ioredis');var authService=require(_0x15fd('0xf'));var qs=require(_0x15fd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15fd('0x11'));var utils=require(_0x15fd('0x12'));var config=require(_0x15fd('0x13'));var licenseUtil=require(_0x15fd('0x14'));var db=require(_0x15fd('0x15'))['db'];function respondWithStatusCode(_0x2e18ec,_0x346ab1){_0x346ab1=_0x346ab1||0xcc;return function(_0x2660db){if(_0x2660db){return _0x2e18ec[_0x15fd('0x16')](_0x346ab1);}return _0x2e18ec['status'](_0x346ab1)['end']();};}function respondWithResult(_0x5784a3,_0x3fda60){_0x3fda60=_0x3fda60||0xc8;return function(_0x135a15){if(_0x135a15){return _0x5784a3[_0x15fd('0x17')](_0x3fda60)[_0x15fd('0x18')](_0x135a15);}};}function respondWithFilteredResult(_0x44eae6,_0x2ffa03){return function(_0x2c5375){if(_0x2c5375){var _0x44a63a=typeof _0x2ffa03['offset']==='undefined'&&typeof _0x2ffa03[_0x15fd('0x19')]==='undefined';var _0x7afe9c=_0x2c5375['count'];var _0x917fe4=_0x44a63a?0x0:_0x2ffa03[_0x15fd('0x1a')];var _0x855bae=_0x44a63a?_0x2c5375['count']:_0x2ffa03[_0x15fd('0x1a')]+_0x2ffa03[_0x15fd('0x19')];var _0x8b7b9e;if(_0x855bae>=_0x7afe9c){_0x855bae=_0x7afe9c;_0x8b7b9e=0xc8;}else{_0x8b7b9e=0xce;}_0x44eae6[_0x15fd('0x17')](_0x8b7b9e);return _0x44eae6[_0x15fd('0x1b')](_0x15fd('0x1c'),_0x917fe4+'-'+_0x855bae+'/'+_0x7afe9c)[_0x15fd('0x18')](_0x2c5375);}return null;};}function patchUpdates(_0x2f46f1){return function(_0x1b8b9f){try{jsonpatch[_0x15fd('0x1d')](_0x1b8b9f,_0x2f46f1,!![]);}catch(_0x3ff307){return BPromise['reject'](_0x3ff307);}return _0x1b8b9f['save']();};}function saveUpdates(_0x293d7b,_0x36b21e){return function(_0x252a1c){if(_0x252a1c){return _0x252a1c[_0x15fd('0x1e')](_0x293d7b)[_0x15fd('0x1f')](function(_0x11496a){return _0x11496a;});}return null;};}function removeEntity(_0x2073da,_0x50d493){return function(_0x40d43){if(_0x40d43){return _0x40d43[_0x15fd('0x20')]()[_0x15fd('0x1f')](function(){_0x2073da['status'](0xcc)[_0x15fd('0x21')]();});}};}function handleEntityNotFound(_0x49062f,_0x3d1835){return function(_0x1fc24f){if(!_0x1fc24f){_0x49062f[_0x15fd('0x16')](0x194);}return _0x1fc24f;};}function handleError(_0x4c9708,_0x16b87c){_0x16b87c=_0x16b87c||0x1f4;return function(_0x1cbf2c){logger[_0x15fd('0x22')](_0x1cbf2c['stack']);if(_0x1cbf2c[_0x15fd('0x23')]){delete _0x1cbf2c['name'];}_0x4c9708[_0x15fd('0x17')](_0x16b87c)[_0x15fd('0x24')](_0x1cbf2c);};}exports[_0x15fd('0x25')]=function(_0x27d2c4,_0x233ed3){var _0x6c213b={},_0x218034={},_0xe650a3={'count':0x0,'rows':[]};var _0x4590a1=_[_0x15fd('0x26')](db[_0x15fd('0x27')]['rawAttributes'],function(_0x47c22c){return{'name':_0x47c22c[_0x15fd('0x28')],'type':_0x47c22c['type'][_0x15fd('0x29')]};});_0x218034[_0x15fd('0x2a')]=_['map'](_0x4590a1,_0x15fd('0x23'));_0x218034[_0x15fd('0x2b')]=_['keys'](_0x27d2c4[_0x15fd('0x2b')]);_0x218034[_0x15fd('0x2c')]=_[_0x15fd('0x2d')](_0x218034[_0x15fd('0x2a')],_0x218034[_0x15fd('0x2b')]);_0x6c213b[_0x15fd('0x2e')]=_['intersection'](_0x218034[_0x15fd('0x2a')],qs[_0x15fd('0x2f')](_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x2f')]));_0x6c213b['attributes']=_0x6c213b[_0x15fd('0x2e')][_0x15fd('0x30')]?_0x6c213b[_0x15fd('0x2e')]:_0x218034[_0x15fd('0x2a')];if(!_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x31')]('nolimit')){_0x6c213b[_0x15fd('0x19')]=qs[_0x15fd('0x19')](_0x27d2c4['query'][_0x15fd('0x19')]);_0x6c213b[_0x15fd('0x1a')]=qs[_0x15fd('0x1a')](_0x27d2c4['query'][_0x15fd('0x1a')]);}_0x6c213b[_0x15fd('0x32')]=qs[_0x15fd('0x33')](_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x33')]);_0x6c213b[_0x15fd('0x34')]=qs['filters'](_['pick'](_0x27d2c4['query'],_0x218034[_0x15fd('0x2c')]),_0x4590a1);if(_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x35')]){_0x6c213b['where']=_['merge'](_0x6c213b[_0x15fd('0x34')],{'$or':_['map'](_0x4590a1,function(_0x4f1c84){if(_0x4f1c84['type']!==_0x15fd('0x36')){var _0x10702c={};_0x10702c[_0x4f1c84[_0x15fd('0x23')]]={'$like':'%'+_0x27d2c4['query'][_0x15fd('0x35')]+'%'};return _0x10702c;}})});}_0x6c213b=_[_0x15fd('0x37')]({},_0x6c213b,_0x27d2c4[_0x15fd('0x38')]);var _0x5beb6e={'where':_0x6c213b[_0x15fd('0x34')]};return db[_0x15fd('0x27')][_0x15fd('0x39')](_0x5beb6e)[_0x15fd('0x1f')](function(_0x2e8b0a){_0xe650a3[_0x15fd('0x39')]=_0x2e8b0a;if(_0x27d2c4[_0x15fd('0x2b')][_0x15fd('0x3a')]){_0x6c213b[_0x15fd('0x3b')]=[{'all':!![]}];}return db['Cdr'][_0x15fd('0x3c')](_0x6c213b);})[_0x15fd('0x1f')](function(_0x180433){_0xe650a3[_0x15fd('0x3d')]=_0x180433;return _0xe650a3;})[_0x15fd('0x1f')](respondWithFilteredResult(_0x233ed3,_0x6c213b))[_0x15fd('0x3e')](handleError(_0x233ed3,null));};exports[_0x15fd('0x3f')]=function(_0xda4ca2,_0x343ce6){var _0x104eef={'raw':!![],'where':{'id':_0xda4ca2[_0x15fd('0x40')]['id']}},_0x2eb6b6={};_0x2eb6b6[_0x15fd('0x2a')]=_[_0x15fd('0x41')](db[_0x15fd('0x27')]['rawAttributes']);_0x2eb6b6[_0x15fd('0x2b')]=_[_0x15fd('0x41')](_0xda4ca2[_0x15fd('0x2b')]);_0x2eb6b6[_0x15fd('0x2c')]=_[_0x15fd('0x2d')](_0x2eb6b6[_0x15fd('0x2a')],_0x2eb6b6[_0x15fd('0x2b')]);_0x104eef[_0x15fd('0x2e')]=_['intersection'](_0x2eb6b6['model'],qs[_0x15fd('0x2f')](_0xda4ca2['query'][_0x15fd('0x2f')]));_0x104eef[_0x15fd('0x2e')]=_0x104eef['attributes'][_0x15fd('0x30')]?_0x104eef[_0x15fd('0x2e')]:_0x2eb6b6[_0x15fd('0x2a')];if(_0xda4ca2[_0x15fd('0x2b')][_0x15fd('0x3a')]){_0x104eef[_0x15fd('0x3b')]=[{'all':!![]}];}_0x104eef=_['merge']({},_0x104eef,_0xda4ca2[_0x15fd('0x38')]);return db[_0x15fd('0x27')][_0x15fd('0x42')](_0x104eef)[_0x15fd('0x1f')](handleEntityNotFound(_0x343ce6,null))[_0x15fd('0x1f')](respondWithResult(_0x343ce6,null))[_0x15fd('0x3e')](handleError(_0x343ce6,null));};exports[_0x15fd('0x43')]=function(_0xffc5dc,_0x24cb44){return db[_0x15fd('0x27')][_0x15fd('0x43')](_0xffc5dc[_0x15fd('0x44')],{})['then'](respondWithResult(_0x24cb44,0xc9))[_0x15fd('0x3e')](handleError(_0x24cb44,null));};exports['update']=function(_0x284f51,_0x34c250){if(_0x284f51[_0x15fd('0x44')]['id']){delete _0x284f51['body']['id'];}return db[_0x15fd('0x27')][_0x15fd('0x42')]({'where':{'id':_0x284f51[_0x15fd('0x40')]['id']}})[_0x15fd('0x1f')](handleEntityNotFound(_0x34c250,null))['then'](saveUpdates(_0x284f51[_0x15fd('0x44')],null))[_0x15fd('0x1f')](respondWithResult(_0x34c250,null))[_0x15fd('0x3e')](handleError(_0x34c250,null));};exports[_0x15fd('0x20')]=function(_0x4b6827,_0x56c6be){return db[_0x15fd('0x27')]['find']({'where':{'id':_0x4b6827['params']['id']}})['then'](handleEntityNotFound(_0x56c6be,null))[_0x15fd('0x1f')](removeEntity(_0x56c6be,null))[_0x15fd('0x3e')](handleError(_0x56c6be,null));};exports[_0x15fd('0x45')]=function(_0x10cf04,_0x292174){return db[_0x15fd('0x27')]['describe']()[_0x15fd('0x1f')](respondWithResult(_0x292174,null))[_0x15fd('0x3e')](handleError(_0x292174,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b32d40e..3743ec4 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0xb0bd2,_0x2621b8){var _0x1347b2=function(_0x7686a2){while(--_0x7686a2){_0xb0bd2['push'](_0xb0bd2['shift']());}};_0x1347b2(++_0x2621b8);}(_0x7a54,0x106));var _0x47a5=function(_0x2d30e6,_0x2e6584){_0x2d30e6=_0x2d30e6-0x0;var _0x2c1182=_0x7a54[_0x2d30e6];return _0x2c1182;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x7e27c6,_0x16811a){var _0x4efe01=function(_0x466a72){while(--_0x466a72){_0x7e27c6['push'](_0x7e27c6['shift']());}};_0x4efe01(++_0x16811a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 42f771b..f452038 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 _0x25c4=['moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','util'];(function(_0x33f0df,_0x38da56){var _0x5e10ea=function(_0x16cdad){while(--_0x16cdad){_0x33f0df['push'](_0x33f0df['shift']());}};_0x5e10ea(++_0x38da56);}(_0x25c4,0x1c7));var _0x425c=function(_0x5945d3,_0x42c4a1){_0x5945d3=_0x5945d3-0x0;var _0xe3819a=_0x25c4[_0x5945d3];return _0xe3819a;};'use strict';var _=require('lodash');var util=require(_0x425c('0x0'));var moment=require(_0x425c('0x1'));var BPromise=require(_0x425c('0x2'));var rs=require(_0x425c('0x3'));var fs=require('fs');var Redis=require(_0x425c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x425c('0x5'));var config=require('../../config/environment');var jayson=require(_0x425c('0x6'));var client=jayson[_0x425c('0x7')][_0x425c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51bd0f,_0x10afbf,_0x80d41e){return new BPromise(function(_0x254d36,_0x317548){return client[_0x425c('0x9')](_0x51bd0f,_0x80d41e)[_0x425c('0xa')](function(_0x155912){logger[_0x425c('0xb')](_0x425c('0xc'),_0x10afbf,'request\x20sent');logger[_0x425c('0xd')](_0x425c('0xe'),_0x10afbf,'request\x20sent',JSON['stringify'](_0x155912));if(_0x155912[_0x425c('0xf')]){if(_0x155912[_0x425c('0xf')]['code']===0x1f4){logger[_0x425c('0xf')]('Cdr,\x20%s,\x20%s',_0x10afbf,_0x155912['error']['message']);return _0x317548(_0x155912[_0x425c('0xf')]['message']);}logger[_0x425c('0xf')](_0x425c('0xc'),_0x10afbf,_0x155912['error'][_0x425c('0x10')]);return _0x254d36(_0x155912[_0x425c('0xf')][_0x425c('0x10')]);}else{logger[_0x425c('0xb')](_0x425c('0xc'),_0x10afbf,_0x425c('0x11'));_0x254d36(_0x155912[_0x425c('0x12')]['message']);}})['catch'](function(_0x58d52e){logger['error'](_0x425c('0xc'),_0x10afbf,_0x58d52e);_0x317548(_0x58d52e);});});} \ No newline at end of file +var _0x9df4=['jayson/promise','http','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','Cdr,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9df4,0x174));var _0x49df=function(_0x60369b,_0x525315){_0x60369b=_0x60369b-0x0;var _0x3c9e8e=_0x9df4[_0x60369b];return _0x3c9e8e;};'use strict';var _=require(_0x49df('0x0'));var util=require(_0x49df('0x1'));var moment=require(_0x49df('0x2'));var BPromise=require(_0x49df('0x3'));var rs=require(_0x49df('0x4'));var fs=require('fs');var Redis=require(_0x49df('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x49df('0x6'))('rpc');var config=require(_0x49df('0x7'));var jayson=require(_0x49df('0x8'));var client=jayson['client'][_0x49df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f54fc,_0x5b9cba,_0x371b9a){return new BPromise(function(_0x183488,_0x2d6324){return client[_0x49df('0xa')](_0x5f54fc,_0x371b9a)[_0x49df('0xb')](function(_0x1a28d7){logger[_0x49df('0xc')]('Cdr,\x20%s,\x20%s',_0x5b9cba,'request\x20sent');logger[_0x49df('0xd')](_0x49df('0xe'),_0x5b9cba,'request\x20sent',JSON['stringify'](_0x1a28d7));if(_0x1a28d7['error']){if(_0x1a28d7[_0x49df('0xf')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x5b9cba,_0x1a28d7['error'][_0x49df('0x10')]);return _0x2d6324(_0x1a28d7[_0x49df('0xf')][_0x49df('0x10')]);}logger[_0x49df('0xf')]('Cdr,\x20%s,\x20%s',_0x5b9cba,_0x1a28d7[_0x49df('0xf')][_0x49df('0x10')]);return _0x183488(_0x1a28d7[_0x49df('0xf')]['message']);}else{logger[_0x49df('0xc')](_0x49df('0x11'),_0x5b9cba,'request\x20sent');_0x183488(_0x1a28d7[_0x49df('0x12')][_0x49df('0x10')]);}})[_0x49df('0x13')](function(_0x33abd3){logger[_0x49df('0xf')](_0x49df('0x11'),_0x5b9cba,_0x33abd3);_0x2d6324(_0x33abd3);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7126b4a..30697e4 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x530ddb,_0x3008f8){var _0x4fa295=function(_0x552364){while(--_0x552364){_0x530ddb['push'](_0x530ddb['shift']());}};_0x4fa295(++_0x3008f8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index b9e1128..e30946c 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 _0x53c7=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0x53c7,0xf2));var _0x753c=function(_0x39106a,_0x5e6163){_0x39106a=_0x39106a-0x0;var _0x4d828a=_0x53c7[_0x39106a];return _0x4d828a;};'use strict';var Sequelize=require(_0x753c('0x0'));module[_0x753c('0x1')]={'priority':{'type':Sequelize[_0x753c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x753c('0x3')],'allowNull':![],'defaultValue':_0x753c('0x4')},'appdata':{'type':Sequelize[_0x753c('0x5')]()},'description':{'type':Sequelize[_0x753c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9c3f=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x182baf,_0x1375fb){var _0x4d10f1=function(_0x1e0dde){while(--_0x1e0dde){_0x182baf['push'](_0x182baf['shift']());}};_0x4d10f1(++_0x1375fb);}(_0x9c3f,0xbb));var _0xf9c3=function(_0x1b3e4a,_0x4f5a24){_0x1b3e4a=_0x1b3e4a-0x0;var _0x1d0eed=_0x9c3f[_0x1b3e4a];return _0x1d0eed;};'use strict';var Sequelize=require(_0xf9c3('0x0'));module[_0xf9c3('0x1')]={'priority':{'type':Sequelize[_0xf9c3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf9c3('0x3')],'allowNull':![],'defaultValue':_0xf9c3('0x4')},'appdata':{'type':Sequelize[_0xf9c3('0x5')]()},'description':{'type':Sequelize[_0xf9c3('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index eeaf8a8..492e388 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 _0x0aaf=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','params','model','keys','ChatApplication','rawAttributes','query','intersection','fields','length','attributes','includeAll','merge','options','find','catch','body'];(function(_0x16875a,_0x2eca82){var _0x377cab=function(_0x338ee1){while(--_0x338ee1){_0x16875a['push'](_0x16875a['shift']());}};_0x377cab(++_0x2eca82);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x0aaf[_0x5774be];return _0x4914b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0aa('0x0'));var jsonpatch=require(_0xf0aa('0x1'));var rp=require(_0xf0aa('0x2'));var moment=require(_0xf0aa('0x3'));var BPromise=require(_0xf0aa('0x4'));var Mustache=require('mustache');var util=require(_0xf0aa('0x5'));var path=require(_0xf0aa('0x6'));var sox=require('sox');var csv=require(_0xf0aa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0aa('0x8'));var _=require('lodash');var squel=require(_0xf0aa('0x9'));var crypto=require(_0xf0aa('0xa'));var jsforce=require(_0xf0aa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf0aa('0x7'));var querystring=require(_0xf0aa('0xc'));var Papa=require('papaparse');var Redis=require(_0xf0aa('0xd'));var authService=require(_0xf0aa('0xe'));var qs=require(_0xf0aa('0xf'));var as=require(_0xf0aa('0x10'));var hardwareService=require(_0xf0aa('0x11'));var logger=require(_0xf0aa('0x12'))(_0xf0aa('0x13'));var utils=require(_0xf0aa('0x14'));var config=require(_0xf0aa('0x15'));var licenseUtil=require(_0xf0aa('0x16'));var db=require(_0xf0aa('0x17'))['db'];function respondWithStatusCode(_0x40b5be,_0x47961e){_0x47961e=_0x47961e||0xcc;return function(_0x4f8622){if(_0x4f8622){return _0x40b5be[_0xf0aa('0x18')](_0x47961e);}return _0x40b5be[_0xf0aa('0x19')](_0x47961e)['end']();};}function respondWithResult(_0x4dc456,_0x37a6ac){_0x37a6ac=_0x37a6ac||0xc8;return function(_0x51bb2c){if(_0x51bb2c){return _0x4dc456[_0xf0aa('0x19')](_0x37a6ac)['json'](_0x51bb2c);}};}function respondWithFilteredResult(_0x22bb2e,_0x4b6219){return function(_0x3fb1fe){if(_0x3fb1fe){var _0x114c96=typeof _0x4b6219[_0xf0aa('0x1a')]===_0xf0aa('0x1b')&&typeof _0x4b6219[_0xf0aa('0x1c')]===_0xf0aa('0x1b');var _0x34e6f7=_0x3fb1fe[_0xf0aa('0x1d')];var _0x4e3fe6=_0x114c96?0x0:_0x4b6219[_0xf0aa('0x1a')];var _0x30f055=_0x114c96?_0x3fb1fe['count']:_0x4b6219[_0xf0aa('0x1a')]+_0x4b6219[_0xf0aa('0x1c')];var _0x35f407;if(_0x30f055>=_0x34e6f7){_0x30f055=_0x34e6f7;_0x35f407=0xc8;}else{_0x35f407=0xce;}_0x22bb2e[_0xf0aa('0x19')](_0x35f407);return _0x22bb2e[_0xf0aa('0x1e')](_0xf0aa('0x1f'),_0x4e3fe6+'-'+_0x30f055+'/'+_0x34e6f7)['json'](_0x3fb1fe);}return null;};}function patchUpdates(_0x112980){return function(_0x227cba){try{jsonpatch[_0xf0aa('0x20')](_0x227cba,_0x112980,!![]);}catch(_0x388893){return BPromise[_0xf0aa('0x21')](_0x388893);}return _0x227cba[_0xf0aa('0x22')]();};}function saveUpdates(_0x49e9fc,_0x5e2470){return function(_0x4c6f86){if(_0x4c6f86){return _0x4c6f86[_0xf0aa('0x23')](_0x49e9fc)['then'](function(_0xc4e56c){return _0xc4e56c;});}return null;};}function removeEntity(_0x245e0c,_0x40cbbb){return function(_0x2983ee){if(_0x2983ee){return _0x2983ee[_0xf0aa('0x24')]()[_0xf0aa('0x25')](function(){_0x245e0c[_0xf0aa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x169a07,_0x3c21fc){return function(_0x44a7bf){if(!_0x44a7bf){_0x169a07[_0xf0aa('0x18')](0x194);}return _0x44a7bf;};}function handleError(_0x74188d,_0x1dc140){_0x1dc140=_0x1dc140||0x1f4;return function(_0x17b7f6){logger[_0xf0aa('0x26')](_0x17b7f6['stack']);if(_0x17b7f6['name']){delete _0x17b7f6[_0xf0aa('0x27')];}_0x74188d['status'](_0x1dc140)[_0xf0aa('0x28')](_0x17b7f6);};}exports['show']=function(_0x403ac2,_0x381179){var _0x4d2c9b={'raw':!![],'where':{'id':_0x403ac2[_0xf0aa('0x29')]['id']}},_0x56b555={};_0x56b555[_0xf0aa('0x2a')]=_[_0xf0aa('0x2b')](db[_0xf0aa('0x2c')][_0xf0aa('0x2d')]);_0x56b555[_0xf0aa('0x2e')]=_[_0xf0aa('0x2b')](_0x403ac2[_0xf0aa('0x2e')]);_0x56b555['filters']=_[_0xf0aa('0x2f')](_0x56b555[_0xf0aa('0x2a')],_0x56b555['query']);_0x4d2c9b['attributes']=_['intersection'](_0x56b555[_0xf0aa('0x2a')],qs[_0xf0aa('0x30')](_0x403ac2['query'][_0xf0aa('0x30')]));_0x4d2c9b['attributes']=_0x4d2c9b['attributes'][_0xf0aa('0x31')]?_0x4d2c9b[_0xf0aa('0x32')]:_0x56b555['model'];if(_0x403ac2[_0xf0aa('0x2e')][_0xf0aa('0x33')]){_0x4d2c9b['include']=[{'all':!![]}];}_0x4d2c9b=_[_0xf0aa('0x34')]({},_0x4d2c9b,_0x403ac2[_0xf0aa('0x35')]);return db[_0xf0aa('0x2c')][_0xf0aa('0x36')](_0x4d2c9b)[_0xf0aa('0x25')](handleEntityNotFound(_0x381179,null))[_0xf0aa('0x25')](respondWithResult(_0x381179,null))[_0xf0aa('0x37')](handleError(_0x381179,null));};exports['update']=function(_0x1cac5f,_0x5d539b){if(_0x1cac5f[_0xf0aa('0x38')]['id']){delete _0x1cac5f[_0xf0aa('0x38')]['id'];}return db[_0xf0aa('0x2c')][_0xf0aa('0x36')]({'where':{'id':_0x1cac5f['params']['id']}})[_0xf0aa('0x25')](handleEntityNotFound(_0x5d539b,null))['then'](saveUpdates(_0x1cac5f[_0xf0aa('0x38')],null))[_0xf0aa('0x25')](respondWithResult(_0x5d539b,null))[_0xf0aa('0x37')](handleError(_0x5d539b,null));};exports[_0xf0aa('0x24')]=function(_0x113314,_0x80d5cc){return db[_0xf0aa('0x2c')]['find']({'where':{'id':_0x113314[_0xf0aa('0x29')]['id']}})[_0xf0aa('0x25')](handleEntityNotFound(_0x80d5cc,null))[_0xf0aa('0x25')](removeEntity(_0x80d5cc,null))[_0xf0aa('0x37')](handleError(_0x80d5cc,null));}; \ No newline at end of file +var _0x9649=['show','params','model','keys','query','attributes','fields','include','merge','options','find','catch','update','body','ChatApplication','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','then','destroy','error','stack','send'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9649,0x118));var _0x9964=function(_0x4adbbc,_0x2b98ce){_0x4adbbc=_0x4adbbc-0x0;var _0x3b9187=_0x9649[_0x4adbbc];return _0x3b9187;};'use strict';var emlformat=require(_0x9964('0x0'));var rimraf=require(_0x9964('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9964('0x2'));var rp=require(_0x9964('0x3'));var moment=require(_0x9964('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9964('0x5'));var util=require(_0x9964('0x6'));var path=require(_0x9964('0x7'));var sox=require(_0x9964('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9964('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9964('0xa'));var jsforce=require(_0x9964('0xb'));var deskjs=require(_0x9964('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9964('0xd'));var Papa=require(_0x9964('0xe'));var Redis=require(_0x9964('0xf'));var authService=require(_0x9964('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9964('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9964('0x12'))(_0x9964('0x13'));var utils=require('../../config/utils');var config=require(_0x9964('0x14'));var licenseUtil=require(_0x9964('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd6ff,_0x4ef5c5){_0x4ef5c5=_0x4ef5c5||0xcc;return function(_0x1b8afa){if(_0x1b8afa){return _0x2bd6ff[_0x9964('0x16')](_0x4ef5c5);}return _0x2bd6ff[_0x9964('0x17')](_0x4ef5c5)[_0x9964('0x18')]();};}function respondWithResult(_0x22f5ce,_0x360a02){_0x360a02=_0x360a02||0xc8;return function(_0x44ce20){if(_0x44ce20){return _0x22f5ce['status'](_0x360a02)['json'](_0x44ce20);}};}function respondWithFilteredResult(_0x37f137,_0x2be683){return function(_0x561571){if(_0x561571){var _0x416340=typeof _0x2be683[_0x9964('0x19')]===_0x9964('0x1a')&&typeof _0x2be683[_0x9964('0x1b')]===_0x9964('0x1a');var _0x2c12f8=_0x561571['count'];var _0x2a7a61=_0x416340?0x0:_0x2be683[_0x9964('0x19')];var _0x58f157=_0x416340?_0x561571['count']:_0x2be683['offset']+_0x2be683[_0x9964('0x1b')];var _0xc4c0fe;if(_0x58f157>=_0x2c12f8){_0x58f157=_0x2c12f8;_0xc4c0fe=0xc8;}else{_0xc4c0fe=0xce;}_0x37f137[_0x9964('0x17')](_0xc4c0fe);return _0x37f137[_0x9964('0x1c')]('Content-Range',_0x2a7a61+'-'+_0x58f157+'/'+_0x2c12f8)[_0x9964('0x1d')](_0x561571);}return null;};}function patchUpdates(_0x5f2bbd){return function(_0x470a8d){try{jsonpatch[_0x9964('0x1e')](_0x470a8d,_0x5f2bbd,!![]);}catch(_0x209929){return BPromise[_0x9964('0x1f')](_0x209929);}return _0x470a8d[_0x9964('0x20')]();};}function saveUpdates(_0xea9fc2,_0x4053ad){return function(_0x341c56){if(_0x341c56){return _0x341c56['update'](_0xea9fc2)[_0x9964('0x21')](function(_0x3069d7){return _0x3069d7;});}return null;};}function removeEntity(_0x1629f9,_0x30ccf7){return function(_0x5b2689){if(_0x5b2689){return _0x5b2689[_0x9964('0x22')]()[_0x9964('0x21')](function(){_0x1629f9[_0x9964('0x17')](0xcc)[_0x9964('0x18')]();});}};}function handleEntityNotFound(_0x4be822,_0x5d4a5e){return function(_0x3911e0){if(!_0x3911e0){_0x4be822[_0x9964('0x16')](0x194);}return _0x3911e0;};}function handleError(_0x2dafcc,_0x96bee0){_0x96bee0=_0x96bee0||0x1f4;return function(_0xd48c01){logger[_0x9964('0x23')](_0xd48c01[_0x9964('0x24')]);if(_0xd48c01['name']){delete _0xd48c01['name'];}_0x2dafcc[_0x9964('0x17')](_0x96bee0)[_0x9964('0x25')](_0xd48c01);};}exports[_0x9964('0x26')]=function(_0x16ec83,_0x47d0d4){var _0x201656={'raw':!![],'where':{'id':_0x16ec83[_0x9964('0x27')]['id']}},_0x3a59df={};_0x3a59df[_0x9964('0x28')]=_[_0x9964('0x29')](db['ChatApplication']['rawAttributes']);_0x3a59df[_0x9964('0x2a')]=_[_0x9964('0x29')](_0x16ec83['query']);_0x3a59df['filters']=_['intersection'](_0x3a59df[_0x9964('0x28')],_0x3a59df[_0x9964('0x2a')]);_0x201656[_0x9964('0x2b')]=_['intersection'](_0x3a59df[_0x9964('0x28')],qs[_0x9964('0x2c')](_0x16ec83[_0x9964('0x2a')][_0x9964('0x2c')]));_0x201656[_0x9964('0x2b')]=_0x201656[_0x9964('0x2b')]['length']?_0x201656[_0x9964('0x2b')]:_0x3a59df[_0x9964('0x28')];if(_0x16ec83[_0x9964('0x2a')]['includeAll']){_0x201656[_0x9964('0x2d')]=[{'all':!![]}];}_0x201656=_[_0x9964('0x2e')]({},_0x201656,_0x16ec83[_0x9964('0x2f')]);return db['ChatApplication'][_0x9964('0x30')](_0x201656)[_0x9964('0x21')](handleEntityNotFound(_0x47d0d4,null))[_0x9964('0x21')](respondWithResult(_0x47d0d4,null))[_0x9964('0x31')](handleError(_0x47d0d4,null));};exports[_0x9964('0x32')]=function(_0xa1cf0b,_0x113c6b){if(_0xa1cf0b[_0x9964('0x33')]['id']){delete _0xa1cf0b[_0x9964('0x33')]['id'];}return db[_0x9964('0x34')][_0x9964('0x30')]({'where':{'id':_0xa1cf0b[_0x9964('0x27')]['id']}})[_0x9964('0x21')](handleEntityNotFound(_0x113c6b,null))[_0x9964('0x21')](saveUpdates(_0xa1cf0b[_0x9964('0x33')],null))[_0x9964('0x21')](respondWithResult(_0x113c6b,null))[_0x9964('0x31')](handleError(_0x113c6b,null));};exports[_0x9964('0x22')]=function(_0x539d3d,_0xfe79a3){return db['ChatApplication'][_0x9964('0x30')]({'where':{'id':_0x539d3d[_0x9964('0x27')]['id']}})['then'](handleEntityNotFound(_0xfe79a3,null))[_0x9964('0x21')](removeEntity(_0xfe79a3,null))['catch'](handleError(_0xfe79a3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 3161fb4..cd9298b 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 _0xa382=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xa382,0x1cd));var _0x2a38=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa382[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2a38('0x0'))(_0x2a38('0x1'));var moment=require('moment');var BPromise=require(_0x2a38('0x2'));var rp=require(_0x2a38('0x3'));var fs=require('fs');var path=require(_0x2a38('0x4'));var rimraf=require(_0x2a38('0x5'));var config=require(_0x2a38('0x6'));var attributes=require(_0x2a38('0x7'));module[_0x2a38('0x8')]=function(_0x5e13d9,_0x308006){return _0x5e13d9[_0x2a38('0x9')](_0x2a38('0xa'),attributes,{'tableName':_0x2a38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a38('0xc'),'collate':_0x2a38('0xd')});}; \ No newline at end of file +var _0x241d=['chat_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x22c169,_0x3298a6){var _0x30cc6f=function(_0x2cd339){while(--_0x2cd339){_0x22c169['push'](_0x22c169['shift']());}};_0x30cc6f(++_0x3298a6);}(_0x241d,0x64));var _0xd241=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x241d[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0xd241('0x0'));var util=require('util');var logger=require(_0xd241('0x1'))(_0xd241('0x2'));var moment=require(_0xd241('0x3'));var BPromise=require(_0xd241('0x4'));var rp=require(_0xd241('0x5'));var fs=require('fs');var path=require(_0xd241('0x6'));var rimraf=require(_0xd241('0x7'));var config=require(_0xd241('0x8'));var attributes=require(_0xd241('0x9'));module[_0xd241('0xa')]=function(_0x2eb97f,_0x4e6ad3){return _0x2eb97f[_0xd241('0xb')]('ChatApplication',attributes,{'tableName':_0xd241('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd241('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d311b37..d370556 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 _0x3749=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x58ce7f,_0x964681){var _0x21ef99=function(_0x3146eb){while(--_0x3146eb){_0x58ce7f['push'](_0x58ce7f['shift']());}};_0x21ef99(++_0x964681);}(_0x3749,0xf2));var _0x9374=function(_0x58be0a,_0x3472a4){_0x58be0a=_0x58be0a-0x0;var _0x11bfa9=_0x3749[_0x58be0a];return _0x11bfa9;};'use strict';var _=require(_0x9374('0x0'));var util=require('util');var moment=require(_0x9374('0x1'));var BPromise=require(_0x9374('0x2'));var rs=require(_0x9374('0x3'));var fs=require('fs');var Redis=require(_0x9374('0x4'));var db=require(_0x9374('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9374('0x6'))(_0x9374('0x7'));var config=require(_0x9374('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9374('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xff7f80,_0x2f861c,_0xf07c72){return new BPromise(function(_0xd56cca,_0x50951e){return client[_0x9374('0xa')](_0xff7f80,_0xf07c72)['then'](function(_0x221cc1){logger[_0x9374('0xb')](_0x9374('0xc'),_0x2f861c,'request\x20sent');logger[_0x9374('0xd')](_0x9374('0xe'),_0x2f861c,_0x9374('0xf'),JSON[_0x9374('0x10')](_0x221cc1));if(_0x221cc1[_0x9374('0x11')]){if(_0x221cc1['error'][_0x9374('0x12')]===0x1f4){logger[_0x9374('0x11')](_0x9374('0xc'),_0x2f861c,_0x221cc1[_0x9374('0x11')][_0x9374('0x13')]);return _0x50951e(_0x221cc1[_0x9374('0x11')]['message']);}logger[_0x9374('0x11')](_0x9374('0xc'),_0x2f861c,_0x221cc1[_0x9374('0x11')][_0x9374('0x13')]);return _0xd56cca(_0x221cc1[_0x9374('0x11')][_0x9374('0x13')]);}else{logger[_0x9374('0xb')](_0x9374('0xc'),_0x2f861c,_0x9374('0xf'));_0xd56cca(_0x221cc1[_0x9374('0x14')][_0x9374('0x13')]);}})[_0x9374('0x15')](function(_0x1e9235){logger[_0x9374('0x11')](_0x9374('0xc'),_0x2f861c,_0x1e9235);_0x50951e(_0x1e9235);});});} \ No newline at end of file +var _0x7be5=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x284d28,_0x327da6){var _0x440af8=function(_0x4550fe){while(--_0x4550fe){_0x284d28['push'](_0x284d28['shift']());}};_0x440af8(++_0x327da6);}(_0x7be5,0x166));var _0x57be=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7be5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x57be('0x0'));var util=require(_0x57be('0x1'));var moment=require(_0x57be('0x2'));var BPromise=require(_0x57be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57be('0x4'));var db=require(_0x57be('0x5'))['db'];var utils=require(_0x57be('0x6'));var logger=require(_0x57be('0x7'))(_0x57be('0x8'));var config=require(_0x57be('0x9'));var jayson=require(_0x57be('0xa'));var client=jayson[_0x57be('0xb')][_0x57be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45d877,_0x1a798f,_0x2cf4e2){return new BPromise(function(_0x2ba136,_0x255cf3){return client[_0x57be('0xd')](_0x45d877,_0x2cf4e2)[_0x57be('0xe')](function(_0x50d68f){logger[_0x57be('0xf')]('ChatApplication,\x20%s,\x20%s',_0x1a798f,_0x57be('0x10'));logger[_0x57be('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1a798f,_0x57be('0x10'),JSON[_0x57be('0x12')](_0x50d68f));if(_0x50d68f['error']){if(_0x50d68f[_0x57be('0x13')][_0x57be('0x14')]===0x1f4){logger['error'](_0x57be('0x15'),_0x1a798f,_0x50d68f[_0x57be('0x13')][_0x57be('0x16')]);return _0x255cf3(_0x50d68f['error'][_0x57be('0x16')]);}logger[_0x57be('0x13')](_0x57be('0x15'),_0x1a798f,_0x50d68f[_0x57be('0x13')][_0x57be('0x16')]);return _0x2ba136(_0x50d68f[_0x57be('0x13')]['message']);}else{logger[_0x57be('0xf')](_0x57be('0x15'),_0x1a798f,_0x57be('0x10'));_0x2ba136(_0x50d68f['result'][_0x57be('0x16')]);}})[_0x57be('0x17')](function(_0x23614a){logger['error']('ChatApplication,\x20%s,\x20%s',_0x1a798f,_0x23614a);_0x255cf3(_0x23614a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 598f21f..c492f81 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 _0x14dd=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','put','update','delete','destroy','exports'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x14dd,0x165));var _0xd14d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14dd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd14d('0x0'));var util=require(_0xd14d('0x1'));var path=require('path');var timeout=require(_0xd14d('0x2'));var express=require(_0xd14d('0x3'));var router=express[_0xd14d('0x4')]();var fs_extra=require(_0xd14d('0x5'));var auth=require(_0xd14d('0x6'));var interaction=require(_0xd14d('0x7'));var config=require(_0xd14d('0x8'));var controller=require(_0xd14d('0x9'));router['get'](_0xd14d('0xa'),auth[_0xd14d('0xb')](),controller['show']);router[_0xd14d('0xc')](_0xd14d('0xa'),auth[_0xd14d('0xb')](),controller[_0xd14d('0xd')]);router[_0xd14d('0xe')]('/:id',auth[_0xd14d('0xb')](),controller[_0xd14d('0xf')]);module[_0xd14d('0x10')]=router; \ No newline at end of file +var _0x8985=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','put','update','exports','multer','util','connect-timeout'];(function(_0x13107e,_0x35c767){var _0xad7d95=function(_0x330ca8){while(--_0x330ca8){_0x13107e['push'](_0x13107e['shift']());}};_0xad7d95(++_0x35c767);}(_0x8985,0x6d));var _0x5898=function(_0x460133,_0x4cda19){_0x460133=_0x460133-0x0;var _0x523f40=_0x8985[_0x460133];return _0x523f40;};'use strict';var multer=require(_0x5898('0x0'));var util=require(_0x5898('0x1'));var path=require('path');var timeout=require(_0x5898('0x2'));var express=require(_0x5898('0x3'));var router=express[_0x5898('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5898('0x5'));var interaction=require(_0x5898('0x6'));var config=require(_0x5898('0x7'));var controller=require(_0x5898('0x8'));router['get'](_0x5898('0x9'),auth[_0x5898('0xa')](),controller['show']);router[_0x5898('0xb')]('/:id',auth[_0x5898('0xa')](),controller[_0x5898('0xc')]);router['delete'](_0x5898('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x5898('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 0c76ed8..800a574 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 _0x4ba1=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4ba1,0x159));var _0x14ba=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4ba1[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x14ba('0x0'));module[_0x14ba('0x1')]={'name':{'type':Sequelize[_0x14ba('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x14ba('0x2')]},'write':{'type':Sequelize[_0x14ba('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x489e=['sequelize','exports','STRING','BOOLEAN'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x489e,0x184));var _0xe489=function(_0x255493,_0x212e2b){_0x255493=_0x255493-0x0;var _0x564f94=_0x489e[_0x255493];return _0x564f94;};'use strict';var Sequelize=require(_0xe489('0x0'));module[_0xe489('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe489('0x2')]},'write':{'type':Sequelize[_0xe489('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c205cb3..023aa2d 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 _0xc980=['then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatGroup','includeAll','findAll','rows','catch','params','include','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','rawAttributes','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update'];(function(_0x42e3e3,_0x38d01b){var _0x3c14cb=function(_0x5eb64e){while(--_0x5eb64e){_0x42e3e3['push'](_0x42e3e3['shift']());}};_0x3c14cb(++_0x38d01b);}(_0xc980,0x109));var _0x0c98=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0xc980[_0x14d896];return _0x28679a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c98('0x0'));var zipdir=require(_0x0c98('0x1'));var jsonpatch=require(_0x0c98('0x2'));var rp=require(_0x0c98('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0c98('0x4'));var util=require(_0x0c98('0x5'));var path=require(_0x0c98('0x6'));var sox=require(_0x0c98('0x7'));var csv=require('to-csv');var ejs=require(_0x0c98('0x8'));var fs=require('fs');var fs_extra=require(_0x0c98('0x9'));var _=require(_0x0c98('0xa'));var squel=require(_0x0c98('0xb'));var crypto=require('crypto');var jsforce=require(_0x0c98('0xc'));var deskjs=require(_0x0c98('0xd'));var toCsv=require(_0x0c98('0xe'));var querystring=require(_0x0c98('0xf'));var Papa=require('papaparse');var Redis=require(_0x0c98('0x10'));var authService=require(_0x0c98('0x11'));var qs=require(_0x0c98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c98('0x13'));var logger=require(_0x0c98('0x14'))(_0x0c98('0x15'));var utils=require(_0x0c98('0x16'));var config=require(_0x0c98('0x17'));var licenseUtil=require(_0x0c98('0x18'));var db=require(_0x0c98('0x19'))['db'];config[_0x0c98('0x1a')]=_[_0x0c98('0x1b')](config[_0x0c98('0x1a')],{'host':_0x0c98('0x1c'),'port':0x18eb});var socket=require(_0x0c98('0x1d'))(new Redis(config[_0x0c98('0x1a')]));require(_0x0c98('0x1e'))[_0x0c98('0x1f')](socket);function respondWithStatusCode(_0x2d408e,_0x5905ae){_0x5905ae=_0x5905ae||0xcc;return function(_0x59092b){if(_0x59092b){return _0x2d408e[_0x0c98('0x20')](_0x5905ae);}return _0x2d408e[_0x0c98('0x21')](_0x5905ae)[_0x0c98('0x22')]();};}function respondWithResult(_0x5d0221,_0x1149e8){_0x1149e8=_0x1149e8||0xc8;return function(_0x100db7){if(_0x100db7){return _0x5d0221[_0x0c98('0x21')](_0x1149e8)[_0x0c98('0x23')](_0x100db7);}};}function respondWithFilteredResult(_0x1def10,_0x420ad4){return function(_0x4d52f1){if(_0x4d52f1){var _0x5269f3=typeof _0x420ad4[_0x0c98('0x24')]===_0x0c98('0x25')&&typeof _0x420ad4[_0x0c98('0x26')]===_0x0c98('0x25');var _0x40d35d=_0x4d52f1[_0x0c98('0x27')];var _0x4560fe=_0x5269f3?0x0:_0x420ad4[_0x0c98('0x24')];var _0x356c9a=_0x5269f3?_0x4d52f1[_0x0c98('0x27')]:_0x420ad4[_0x0c98('0x24')]+_0x420ad4[_0x0c98('0x26')];var _0x57c632;if(_0x356c9a>=_0x40d35d){_0x356c9a=_0x40d35d;_0x57c632=0xc8;}else{_0x57c632=0xce;}_0x1def10[_0x0c98('0x21')](_0x57c632);return _0x1def10[_0x0c98('0x28')](_0x0c98('0x29'),_0x4560fe+'-'+_0x356c9a+'/'+_0x40d35d)[_0x0c98('0x23')](_0x4d52f1);}return null;};}function patchUpdates(_0x417d3b){return function(_0x42cda1){try{jsonpatch[_0x0c98('0x2a')](_0x42cda1,_0x417d3b,!![]);}catch(_0x4de711){return BPromise['reject'](_0x4de711);}return _0x42cda1['save']();};}function saveUpdates(_0x16f4a7,_0x165e8d){return function(_0x4e4386){if(_0x4e4386){return _0x4e4386[_0x0c98('0x2b')](_0x16f4a7)[_0x0c98('0x2c')](function(_0x3fe22a){return _0x3fe22a;});}return null;};}function removeEntity(_0x53242f,_0x56b422){return function(_0x5b59ea){if(_0x5b59ea){return _0x5b59ea[_0x0c98('0x2d')]()[_0x0c98('0x2c')](function(){_0x53242f[_0x0c98('0x21')](0xcc)[_0x0c98('0x22')]();});}};}function handleEntityNotFound(_0x52405b,_0x3b5585){return function(_0x5649f6){if(!_0x5649f6){_0x52405b[_0x0c98('0x20')](0x194);}return _0x5649f6;};}function handleError(_0x2e6224,_0x8bd2d4){_0x8bd2d4=_0x8bd2d4||0x1f4;return function(_0x3d1af3){logger[_0x0c98('0x2e')](_0x3d1af3[_0x0c98('0x2f')]);if(_0x3d1af3[_0x0c98('0x30')]){delete _0x3d1af3['name'];}_0x2e6224[_0x0c98('0x21')](_0x8bd2d4)[_0x0c98('0x31')](_0x3d1af3);};}exports[_0x0c98('0x32')]=function(_0x2c38ce,_0x57679d){var _0x15c881={},_0x271eb5={},_0x1989e0={'count':0x0,'rows':[]};var _0x2aa146=_[_0x0c98('0x33')](db['ChatGroup']['rawAttributes'],function(_0x53d2f2){return{'name':_0x53d2f2[_0x0c98('0x34')],'type':_0x53d2f2[_0x0c98('0x35')][_0x0c98('0x36')]};});_0x271eb5[_0x0c98('0x37')]=_[_0x0c98('0x33')](_0x2aa146,_0x0c98('0x30'));_0x271eb5[_0x0c98('0x38')]=_[_0x0c98('0x39')](_0x2c38ce[_0x0c98('0x38')]);_0x271eb5[_0x0c98('0x3a')]=_[_0x0c98('0x3b')](_0x271eb5[_0x0c98('0x37')],_0x271eb5[_0x0c98('0x38')]);_0x15c881[_0x0c98('0x3c')]=_[_0x0c98('0x3b')](_0x271eb5[_0x0c98('0x37')],qs[_0x0c98('0x3d')](_0x2c38ce['query'][_0x0c98('0x3d')]));_0x15c881[_0x0c98('0x3c')]=_0x15c881[_0x0c98('0x3c')][_0x0c98('0x3e')]?_0x15c881[_0x0c98('0x3c')]:_0x271eb5['model'];if(!_0x2c38ce[_0x0c98('0x38')]['hasOwnProperty'](_0x0c98('0x3f'))){_0x15c881[_0x0c98('0x26')]=qs[_0x0c98('0x26')](_0x2c38ce[_0x0c98('0x38')][_0x0c98('0x26')]);_0x15c881[_0x0c98('0x24')]=qs[_0x0c98('0x24')](_0x2c38ce[_0x0c98('0x38')]['offset']);}_0x15c881[_0x0c98('0x40')]=qs['sort'](_0x2c38ce[_0x0c98('0x38')][_0x0c98('0x41')]);_0x15c881[_0x0c98('0x42')]=qs[_0x0c98('0x3a')](_[_0x0c98('0x43')](_0x2c38ce['query'],_0x271eb5[_0x0c98('0x3a')]),_0x2aa146);if(_0x2c38ce[_0x0c98('0x38')][_0x0c98('0x44')]){_0x15c881[_0x0c98('0x42')]=_[_0x0c98('0x45')](_0x15c881[_0x0c98('0x42')],{'$or':_[_0x0c98('0x33')](_0x2aa146,function(_0x2c0293){if(_0x2c0293[_0x0c98('0x35')]!==_0x0c98('0x46')){var _0x51fd56={};_0x51fd56[_0x2c0293[_0x0c98('0x30')]]={'$like':'%'+_0x2c38ce[_0x0c98('0x38')]['filter']+'%'};return _0x51fd56;}})});}_0x15c881=_['merge']({},_0x15c881,_0x2c38ce[_0x0c98('0x47')]);var _0x264b3f={'where':_0x15c881[_0x0c98('0x42')]};return db[_0x0c98('0x48')][_0x0c98('0x27')](_0x264b3f)[_0x0c98('0x2c')](function(_0x21ef3e){_0x1989e0['count']=_0x21ef3e;if(_0x2c38ce[_0x0c98('0x38')][_0x0c98('0x49')]){_0x15c881['include']=[{'all':!![]}];}return db['ChatGroup'][_0x0c98('0x4a')](_0x15c881);})[_0x0c98('0x2c')](function(_0x441edb){_0x1989e0[_0x0c98('0x4b')]=_0x441edb;return _0x1989e0;})[_0x0c98('0x2c')](respondWithFilteredResult(_0x57679d,_0x15c881))[_0x0c98('0x4c')](handleError(_0x57679d,null));};exports['show']=function(_0x328ef9,_0xd5b93e){var _0x4eb0ce={'raw':!![],'where':{'id':_0x328ef9[_0x0c98('0x4d')]['id']}},_0x1a6a67={};_0x1a6a67[_0x0c98('0x37')]=_[_0x0c98('0x39')](db[_0x0c98('0x48')]['rawAttributes']);_0x1a6a67[_0x0c98('0x38')]=_[_0x0c98('0x39')](_0x328ef9['query']);_0x1a6a67[_0x0c98('0x3a')]=_['intersection'](_0x1a6a67['model'],_0x1a6a67[_0x0c98('0x38')]);_0x4eb0ce[_0x0c98('0x3c')]=_[_0x0c98('0x3b')](_0x1a6a67['model'],qs[_0x0c98('0x3d')](_0x328ef9[_0x0c98('0x38')]['fields']));_0x4eb0ce[_0x0c98('0x3c')]=_0x4eb0ce['attributes'][_0x0c98('0x3e')]?_0x4eb0ce['attributes']:_0x1a6a67[_0x0c98('0x37')];if(_0x328ef9[_0x0c98('0x38')]['includeAll']){_0x4eb0ce[_0x0c98('0x4e')]=[{'all':!![]}];}_0x4eb0ce=_['merge']({},_0x4eb0ce,_0x328ef9[_0x0c98('0x47')]);return db[_0x0c98('0x48')][_0x0c98('0x4f')](_0x4eb0ce)[_0x0c98('0x2c')](handleEntityNotFound(_0xd5b93e,null))[_0x0c98('0x2c')](respondWithResult(_0xd5b93e,null))['catch'](handleError(_0xd5b93e,null));};exports['create']=function(_0x5f1c96,_0x62b21c){return db[_0x0c98('0x48')][_0x0c98('0x50')](_0x5f1c96[_0x0c98('0x51')],{})['then'](respondWithResult(_0x62b21c,0xc9))[_0x0c98('0x4c')](handleError(_0x62b21c,null));};exports[_0x0c98('0x2b')]=function(_0x25ffba,_0x57fb96){if(_0x25ffba[_0x0c98('0x51')]['id']){delete _0x25ffba[_0x0c98('0x51')]['id'];}return db[_0x0c98('0x48')][_0x0c98('0x4f')]({'where':{'id':_0x25ffba[_0x0c98('0x4d')]['id']}})[_0x0c98('0x2c')](handleEntityNotFound(_0x57fb96,null))[_0x0c98('0x2c')](saveUpdates(_0x25ffba[_0x0c98('0x51')],null))['then'](respondWithResult(_0x57fb96,null))[_0x0c98('0x4c')](handleError(_0x57fb96,null));};exports['destroy']=function(_0x8595c6,_0x267360){return db[_0x0c98('0x48')][_0x0c98('0x4f')]({'where':{'id':_0x8595c6[_0x0c98('0x4d')]['id']}})[_0x0c98('0x2c')](handleEntityNotFound(_0x267360,null))[_0x0c98('0x2c')](removeEntity(_0x267360,null))[_0x0c98('0x4c')](handleError(_0x267360,null));};exports[_0x0c98('0x52')]=function(_0x422deb,_0x3c209a){return db['ChatGroup'][_0x0c98('0x52')]()[_0x0c98('0x2c')](respondWithResult(_0x3c209a,null))[_0x0c98('0x4c')](handleError(_0x3c209a,null));};exports[_0x0c98('0x53')]=function(_0x128a3d,_0x46a991,_0x218970){return db['ChatInternalMessage'][_0x0c98('0x27')]({'where':{'ChatGroupId':_0x128a3d[_0x0c98('0x4d')]['id'],'ToId':_0x128a3d[_0x0c98('0x54')]['id'],'read':![]}})['then'](function(_0x59cfe3){return{'id':_[_0x0c98('0x55')](_0x128a3d['params']['id']),'count':_0x59cfe3};})[_0x0c98('0x2c')](respondWithResult(_0x46a991,null))[_0x0c98('0x4c')](handleError(_0x46a991,null));};exports[_0x0c98('0x56')]=function(_0x51d482,_0x21ec77,_0x34040d){return db['ChatGroup'][_0x0c98('0x4f')]({'where':{'id':_0x51d482[_0x0c98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x21ec77,null))[_0x0c98('0x2c')](function(_0x38be32){if(_0x38be32){return _0x38be32[_0x0c98('0x56')](_0x51d482[_0x0c98('0x51')][_0x0c98('0x57')],_[_0x0c98('0x58')](_0x51d482['body'],[_0x0c98('0x57'),'id'])||{});}})[_0x0c98('0x2c')](respondWithResult(_0x21ec77,null))[_0x0c98('0x4c')](handleError(_0x21ec77,null));};exports[_0x0c98('0x59')]=function(_0x468f74,_0x28b906,_0x3c3652){var _0x30fb81={};var _0x5c530a={};var _0x3c083f;var _0x469a28;return db[_0x0c98('0x48')][_0x0c98('0x5a')]({'where':{'id':_0x468f74[_0x0c98('0x4d')]['id']}})[_0x0c98('0x2c')](handleEntityNotFound(_0x28b906,null))[_0x0c98('0x2c')](function(_0x185a53){if(_0x185a53){_0x3c083f=_0x185a53;_0x5c530a[_0x0c98('0x37')]=_[_0x0c98('0x39')](db[_0x0c98('0x5b')][_0x0c98('0x5c')]);_0x5c530a[_0x0c98('0x38')]=_[_0x0c98('0x39')](_0x468f74[_0x0c98('0x38')]);_0x5c530a['filters']=_[_0x0c98('0x3b')](_0x5c530a[_0x0c98('0x37')],_0x5c530a[_0x0c98('0x38')]);_0x30fb81[_0x0c98('0x3c')]=_['intersection'](_0x5c530a[_0x0c98('0x37')],qs['fields'](_0x468f74[_0x0c98('0x38')][_0x0c98('0x3d')]));_0x30fb81['attributes']=_0x30fb81[_0x0c98('0x3c')][_0x0c98('0x3e')]?_0x30fb81[_0x0c98('0x3c')]:_0x5c530a[_0x0c98('0x37')];_0x30fb81['order']=qs[_0x0c98('0x41')](_0x468f74['query'][_0x0c98('0x41')]);_0x30fb81[_0x0c98('0x42')]=qs[_0x0c98('0x3a')](_['pick'](_0x468f74['query'],_0x5c530a[_0x0c98('0x3a')]));if(_0x468f74[_0x0c98('0x38')][_0x0c98('0x44')]){_0x30fb81[_0x0c98('0x42')]=_['merge'](_0x30fb81[_0x0c98('0x42')],{'$or':_[_0x0c98('0x33')](_0x30fb81[_0x0c98('0x3c')],function(_0x58be26){var _0x5b2148={};_0x5b2148[_0x58be26]={'$like':'%'+_0x468f74['query'][_0x0c98('0x44')]+'%'};return _0x5b2148;})});}_0x30fb81=_['merge']({},_0x30fb81,_0x468f74['options']);return _0x3c083f[_0x0c98('0x59')](_0x30fb81);}})[_0x0c98('0x2c')](function(_0xcc2228){if(_0xcc2228){_0x469a28=_0xcc2228['length'];if(!_0x468f74[_0x0c98('0x38')][_0x0c98('0x5d')](_0x0c98('0x3f'))){_0x30fb81[_0x0c98('0x26')]=qs[_0x0c98('0x26')](_0x468f74[_0x0c98('0x38')][_0x0c98('0x26')]);_0x30fb81[_0x0c98('0x24')]=qs[_0x0c98('0x24')](_0x468f74[_0x0c98('0x38')]['offset']);}return _0x3c083f[_0x0c98('0x59')](_0x30fb81);}})[_0x0c98('0x2c')](function(_0x1961d8){if(_0x1961d8){return _0x1961d8?{'count':_0x469a28,'rows':_0x1961d8}:null;}})[_0x0c98('0x2c')](respondWithResult(_0x28b906,null))['catch'](handleError(_0x28b906,null));};exports[_0x0c98('0x5e')]=function(_0x33d216,_0x531fd0,_0x584fe0){return db[_0x0c98('0x48')]['find']({'where':{'id':_0x33d216['params']['id']}})[_0x0c98('0x2c')](handleEntityNotFound(_0x531fd0,null))[_0x0c98('0x2c')](function(_0x5329ba){if(_0x5329ba){return _0x5329ba[_0x0c98('0x5e')](_0x33d216[_0x0c98('0x38')][_0x0c98('0x57')]);}})[_0x0c98('0x2c')](respondWithStatusCode(_0x531fd0,null))['catch'](handleError(_0x531fd0,null));};exports[_0x0c98('0x5f')]=function(_0x36de61,_0x4507bb,_0x1ff289){if(_0x36de61['body']['id']){delete _0x36de61[_0x0c98('0x51')]['id'];}return db[_0x0c98('0x48')][_0x0c98('0x4f')]({'where':{'id':_0x36de61[_0x0c98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4507bb,null))[_0x0c98('0x2c')](function(_0x312bf5){if(_0x312bf5){_0x36de61['body'][_0x0c98('0x60')]=_0x312bf5['id'];return db[_0x0c98('0x61')][_0x0c98('0x50')](_0x36de61[_0x0c98('0x51')]);}})[_0x0c98('0x2c')](respondWithResult(_0x4507bb,null))[_0x0c98('0x4c')](handleError(_0x4507bb,null));};exports[_0x0c98('0x62')]=function(_0x2c14f9,_0x1953c2,_0x4c6118){var _0x5aca80={};var _0x518833={};var _0x38dd8c;var _0x1af01e;return db['ChatGroup']['findOne']({'where':{'id':_0x2c14f9[_0x0c98('0x4d')]['id']}})[_0x0c98('0x2c')](handleEntityNotFound(_0x1953c2,null))[_0x0c98('0x2c')](function(_0x1da619){if(_0x1da619){_0x38dd8c=_0x1da619;_0x518833['model']=_[_0x0c98('0x39')](db[_0x0c98('0x61')][_0x0c98('0x5c')]);_0x518833[_0x0c98('0x38')]=_[_0x0c98('0x39')](_0x2c14f9[_0x0c98('0x38')]);_0x518833['filters']=_[_0x0c98('0x3b')](_0x518833[_0x0c98('0x37')],_0x518833[_0x0c98('0x38')]);_0x5aca80[_0x0c98('0x3c')]=_[_0x0c98('0x3b')](_0x518833[_0x0c98('0x37')],qs[_0x0c98('0x3d')](_0x2c14f9['query'][_0x0c98('0x3d')]));_0x5aca80[_0x0c98('0x3c')]=_0x5aca80[_0x0c98('0x3c')][_0x0c98('0x3e')]?_0x5aca80['attributes']:_0x518833[_0x0c98('0x37')];_0x5aca80['order']=qs['sort'](_0x2c14f9[_0x0c98('0x38')]['sort']);_0x5aca80[_0x0c98('0x42')]=qs[_0x0c98('0x3a')](_[_0x0c98('0x43')](_0x2c14f9[_0x0c98('0x38')],_0x518833[_0x0c98('0x3a')]));if(_0x2c14f9[_0x0c98('0x38')][_0x0c98('0x44')]){_0x5aca80[_0x0c98('0x42')]=_[_0x0c98('0x45')](_0x5aca80[_0x0c98('0x42')],{'$or':_[_0x0c98('0x33')](_0x5aca80[_0x0c98('0x3c')],function(_0x8b1349){var _0x517ee9={};_0x517ee9[_0x8b1349]={'$like':'%'+_0x2c14f9[_0x0c98('0x38')][_0x0c98('0x44')]+'%'};return _0x517ee9;})});}if(_0x2c14f9[_0x0c98('0x38')]['$gte']){var _0x3e13dc=_0x2c14f9['query'][_0x0c98('0x63')][_0x0c98('0x64')](',');var _0x2de5e8={};_0x2de5e8[_0x3e13dc[0x0]]={'$gte':moment(_0x3e13dc[0x1])[_0x0c98('0x65')](_0x0c98('0x66'))};_0x5aca80[_0x0c98('0x42')]=_[_0x0c98('0x45')](_0x5aca80['where'],_0x2de5e8);}_0x5aca80=_['merge']({},_0x5aca80,_0x2c14f9[_0x0c98('0x47')]);return _0x38dd8c[_0x0c98('0x62')](_0x5aca80);}})[_0x0c98('0x2c')](function(_0x5b3445){if(_0x5b3445){_0x1af01e=_0x5b3445[_0x0c98('0x3e')];if(!_0x2c14f9[_0x0c98('0x38')][_0x0c98('0x5d')](_0x0c98('0x3f'))){_0x5aca80[_0x0c98('0x26')]=qs['limit'](_0x2c14f9['query']['limit']);_0x5aca80['offset']=qs[_0x0c98('0x24')](_0x2c14f9['query'][_0x0c98('0x24')]);}return _0x38dd8c[_0x0c98('0x62')](_0x5aca80);}})['then'](function(_0x3ef2ef){if(_0x3ef2ef){return _0x3ef2ef?{'count':_0x1af01e,'rows':_0x3ef2ef}:null;}})[_0x0c98('0x2c')](respondWithResult(_0x1953c2,null))['catch'](handleError(_0x1953c2,null));}; \ No newline at end of file +var _0x8edf=['defaults','./chatGroup.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','save','update','then','stack','name','send','index','map','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatGroup','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','includeAll','find','create','body','destroy','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x25a0b9,_0x86e28f){var _0x30b9ab=function(_0x883a4){while(--_0x883a4){_0x25a0b9['push'](_0x25a0b9['shift']());}};_0x30b9ab(++_0x86e28f);}(_0x8edf,0xaa));var _0xf8ed=function(_0x30d249,_0xe500b9){_0x30d249=_0x30d249-0x0;var _0xa668f7=_0x8edf[_0x30d249];return _0xa668f7;};'use strict';var emlformat=require(_0xf8ed('0x0'));var rimraf=require(_0xf8ed('0x1'));var zipdir=require(_0xf8ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8ed('0x3'));var moment=require(_0xf8ed('0x4'));var BPromise=require(_0xf8ed('0x5'));var Mustache=require(_0xf8ed('0x6'));var util=require(_0xf8ed('0x7'));var path=require(_0xf8ed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8ed('0x9'));var squel=require(_0xf8ed('0xa'));var crypto=require(_0xf8ed('0xb'));var jsforce=require(_0xf8ed('0xc'));var deskjs=require(_0xf8ed('0xd'));var toCsv=require(_0xf8ed('0xe'));var querystring=require('querystring');var Papa=require(_0xf8ed('0xf'));var Redis=require(_0xf8ed('0x10'));var authService=require(_0xf8ed('0x11'));var qs=require(_0xf8ed('0x12'));var as=require(_0xf8ed('0x13'));var hardwareService=require(_0xf8ed('0x14'));var logger=require(_0xf8ed('0x15'))(_0xf8ed('0x16'));var utils=require(_0xf8ed('0x17'));var config=require(_0xf8ed('0x18'));var licenseUtil=require(_0xf8ed('0x19'));var db=require(_0xf8ed('0x1a'))['db'];config[_0xf8ed('0x1b')]=_[_0xf8ed('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8ed('0x1b')]));require(_0xf8ed('0x1d'))[_0xf8ed('0x1e')](socket);function respondWithStatusCode(_0x2f53e2,_0x4465f7){_0x4465f7=_0x4465f7||0xcc;return function(_0x9fdf6b){if(_0x9fdf6b){return _0x2f53e2[_0xf8ed('0x1f')](_0x4465f7);}return _0x2f53e2['status'](_0x4465f7)[_0xf8ed('0x20')]();};}function respondWithResult(_0x4695a3,_0x54e6c0){_0x54e6c0=_0x54e6c0||0xc8;return function(_0x5cd100){if(_0x5cd100){return _0x4695a3[_0xf8ed('0x21')](_0x54e6c0)['json'](_0x5cd100);}};}function respondWithFilteredResult(_0x16fa5a,_0x1750cb){return function(_0x369698){if(_0x369698){var _0x1eb458=typeof _0x1750cb[_0xf8ed('0x22')]===_0xf8ed('0x23')&&typeof _0x1750cb[_0xf8ed('0x24')]===_0xf8ed('0x23');var _0x3a0b4c=_0x369698['count'];var _0x2cffa3=_0x1eb458?0x0:_0x1750cb[_0xf8ed('0x22')];var _0x52d2f7=_0x1eb458?_0x369698[_0xf8ed('0x25')]:_0x1750cb[_0xf8ed('0x22')]+_0x1750cb[_0xf8ed('0x24')];var _0x263af2;if(_0x52d2f7>=_0x3a0b4c){_0x52d2f7=_0x3a0b4c;_0x263af2=0xc8;}else{_0x263af2=0xce;}_0x16fa5a[_0xf8ed('0x21')](_0x263af2);return _0x16fa5a[_0xf8ed('0x26')](_0xf8ed('0x27'),_0x2cffa3+'-'+_0x52d2f7+'/'+_0x3a0b4c)['json'](_0x369698);}return null;};}function patchUpdates(_0x3b8c44){return function(_0x17554b){try{jsonpatch['apply'](_0x17554b,_0x3b8c44,!![]);}catch(_0x2a3e78){return BPromise['reject'](_0x2a3e78);}return _0x17554b[_0xf8ed('0x28')]();};}function saveUpdates(_0x2db572,_0x451508){return function(_0x56dd52){if(_0x56dd52){return _0x56dd52[_0xf8ed('0x29')](_0x2db572)['then'](function(_0x36bf02){return _0x36bf02;});}return null;};}function removeEntity(_0xaf22ea,_0x28f9a8){return function(_0x5764f6){if(_0x5764f6){return _0x5764f6['destroy']()[_0xf8ed('0x2a')](function(){_0xaf22ea[_0xf8ed('0x21')](0xcc)[_0xf8ed('0x20')]();});}};}function handleEntityNotFound(_0xa00f80,_0x3d1b29){return function(_0x251818){if(!_0x251818){_0xa00f80[_0xf8ed('0x1f')](0x194);}return _0x251818;};}function handleError(_0x53e13b,_0x4a5f48){_0x4a5f48=_0x4a5f48||0x1f4;return function(_0x310f53){logger['error'](_0x310f53[_0xf8ed('0x2b')]);if(_0x310f53[_0xf8ed('0x2c')]){delete _0x310f53['name'];}_0x53e13b[_0xf8ed('0x21')](_0x4a5f48)[_0xf8ed('0x2d')](_0x310f53);};}exports[_0xf8ed('0x2e')]=function(_0x2dddcb,_0x4ba844){var _0x1948ba={},_0x49b00d={},_0x2494da={'count':0x0,'rows':[]};var _0x321789=_[_0xf8ed('0x2f')](db['ChatGroup']['rawAttributes'],function(_0x1619bf){return{'name':_0x1619bf['fieldName'],'type':_0x1619bf['type'][_0xf8ed('0x30')]};});_0x49b00d[_0xf8ed('0x31')]=_[_0xf8ed('0x2f')](_0x321789,_0xf8ed('0x2c'));_0x49b00d[_0xf8ed('0x32')]=_['keys'](_0x2dddcb[_0xf8ed('0x32')]);_0x49b00d[_0xf8ed('0x33')]=_['intersection'](_0x49b00d[_0xf8ed('0x31')],_0x49b00d[_0xf8ed('0x32')]);_0x1948ba[_0xf8ed('0x34')]=_['intersection'](_0x49b00d[_0xf8ed('0x31')],qs[_0xf8ed('0x35')](_0x2dddcb[_0xf8ed('0x32')][_0xf8ed('0x35')]));_0x1948ba[_0xf8ed('0x34')]=_0x1948ba[_0xf8ed('0x34')][_0xf8ed('0x36')]?_0x1948ba[_0xf8ed('0x34')]:_0x49b00d[_0xf8ed('0x31')];if(!_0x2dddcb['query'][_0xf8ed('0x37')]('nolimit')){_0x1948ba[_0xf8ed('0x24')]=qs[_0xf8ed('0x24')](_0x2dddcb[_0xf8ed('0x32')][_0xf8ed('0x24')]);_0x1948ba[_0xf8ed('0x22')]=qs[_0xf8ed('0x22')](_0x2dddcb[_0xf8ed('0x32')][_0xf8ed('0x22')]);}_0x1948ba[_0xf8ed('0x38')]=qs[_0xf8ed('0x39')](_0x2dddcb[_0xf8ed('0x32')]['sort']);_0x1948ba[_0xf8ed('0x3a')]=qs[_0xf8ed('0x33')](_[_0xf8ed('0x3b')](_0x2dddcb[_0xf8ed('0x32')],_0x49b00d[_0xf8ed('0x33')]),_0x321789);if(_0x2dddcb[_0xf8ed('0x32')][_0xf8ed('0x3c')]){_0x1948ba[_0xf8ed('0x3a')]=_[_0xf8ed('0x3d')](_0x1948ba[_0xf8ed('0x3a')],{'$or':_[_0xf8ed('0x2f')](_0x321789,function(_0xb6b855){if(_0xb6b855[_0xf8ed('0x3e')]!==_0xf8ed('0x3f')){var _0x58ba00={};_0x58ba00[_0xb6b855[_0xf8ed('0x2c')]]={'$like':'%'+_0x2dddcb[_0xf8ed('0x32')][_0xf8ed('0x3c')]+'%'};return _0x58ba00;}})});}_0x1948ba=_['merge']({},_0x1948ba,_0x2dddcb[_0xf8ed('0x40')]);var _0x3e518d={'where':_0x1948ba[_0xf8ed('0x3a')]};return db[_0xf8ed('0x41')][_0xf8ed('0x25')](_0x3e518d)[_0xf8ed('0x2a')](function(_0x50cdc9){_0x2494da[_0xf8ed('0x25')]=_0x50cdc9;if(_0x2dddcb['query']['includeAll']){_0x1948ba[_0xf8ed('0x42')]=[{'all':!![]}];}return db[_0xf8ed('0x41')][_0xf8ed('0x43')](_0x1948ba);})[_0xf8ed('0x2a')](function(_0x6bff45){_0x2494da[_0xf8ed('0x44')]=_0x6bff45;return _0x2494da;})[_0xf8ed('0x2a')](respondWithFilteredResult(_0x4ba844,_0x1948ba))[_0xf8ed('0x45')](handleError(_0x4ba844,null));};exports[_0xf8ed('0x46')]=function(_0x3dd71d,_0xc97a6){var _0x2a71c3={'raw':!![],'where':{'id':_0x3dd71d[_0xf8ed('0x47')]['id']}},_0x5e0efe={};_0x5e0efe[_0xf8ed('0x31')]=_[_0xf8ed('0x48')](db['ChatGroup'][_0xf8ed('0x49')]);_0x5e0efe[_0xf8ed('0x32')]=_['keys'](_0x3dd71d[_0xf8ed('0x32')]);_0x5e0efe[_0xf8ed('0x33')]=_[_0xf8ed('0x4a')](_0x5e0efe[_0xf8ed('0x31')],_0x5e0efe['query']);_0x2a71c3[_0xf8ed('0x34')]=_[_0xf8ed('0x4a')](_0x5e0efe[_0xf8ed('0x31')],qs['fields'](_0x3dd71d[_0xf8ed('0x32')][_0xf8ed('0x35')]));_0x2a71c3[_0xf8ed('0x34')]=_0x2a71c3[_0xf8ed('0x34')][_0xf8ed('0x36')]?_0x2a71c3[_0xf8ed('0x34')]:_0x5e0efe[_0xf8ed('0x31')];if(_0x3dd71d[_0xf8ed('0x32')][_0xf8ed('0x4b')]){_0x2a71c3[_0xf8ed('0x42')]=[{'all':!![]}];}_0x2a71c3=_[_0xf8ed('0x3d')]({},_0x2a71c3,_0x3dd71d[_0xf8ed('0x40')]);return db[_0xf8ed('0x41')][_0xf8ed('0x4c')](_0x2a71c3)[_0xf8ed('0x2a')](handleEntityNotFound(_0xc97a6,null))[_0xf8ed('0x2a')](respondWithResult(_0xc97a6,null))[_0xf8ed('0x45')](handleError(_0xc97a6,null));};exports[_0xf8ed('0x4d')]=function(_0x119041,_0x9d59b2){return db[_0xf8ed('0x41')][_0xf8ed('0x4d')](_0x119041[_0xf8ed('0x4e')],{})[_0xf8ed('0x2a')](respondWithResult(_0x9d59b2,0xc9))['catch'](handleError(_0x9d59b2,null));};exports['update']=function(_0x4ab044,_0x1616c6){if(_0x4ab044[_0xf8ed('0x4e')]['id']){delete _0x4ab044['body']['id'];}return db[_0xf8ed('0x41')][_0xf8ed('0x4c')]({'where':{'id':_0x4ab044[_0xf8ed('0x47')]['id']}})[_0xf8ed('0x2a')](handleEntityNotFound(_0x1616c6,null))['then'](saveUpdates(_0x4ab044[_0xf8ed('0x4e')],null))[_0xf8ed('0x2a')](respondWithResult(_0x1616c6,null))[_0xf8ed('0x45')](handleError(_0x1616c6,null));};exports[_0xf8ed('0x4f')]=function(_0x3f662f,_0x352cb2){return db[_0xf8ed('0x41')][_0xf8ed('0x4c')]({'where':{'id':_0x3f662f[_0xf8ed('0x47')]['id']}})[_0xf8ed('0x2a')](handleEntityNotFound(_0x352cb2,null))['then'](removeEntity(_0x352cb2,null))[_0xf8ed('0x45')](handleError(_0x352cb2,null));};exports[_0xf8ed('0x50')]=function(_0x204af2,_0x4ae532){return db[_0xf8ed('0x41')][_0xf8ed('0x50')]()[_0xf8ed('0x2a')](respondWithResult(_0x4ae532,null))['catch'](handleError(_0x4ae532,null));};exports['getUnread']=function(_0x5eef11,_0x258f6f,_0xe68cae){return db[_0xf8ed('0x51')][_0xf8ed('0x25')]({'where':{'ChatGroupId':_0x5eef11[_0xf8ed('0x47')]['id'],'ToId':_0x5eef11[_0xf8ed('0x52')]['id'],'read':![]}})[_0xf8ed('0x2a')](function(_0x5e874c){return{'id':_[_0xf8ed('0x53')](_0x5eef11[_0xf8ed('0x47')]['id']),'count':_0x5e874c};})[_0xf8ed('0x2a')](respondWithResult(_0x258f6f,null))['catch'](handleError(_0x258f6f,null));};exports[_0xf8ed('0x54')]=function(_0x1cb857,_0x1c378d,_0x175b4f){return db[_0xf8ed('0x41')][_0xf8ed('0x4c')]({'where':{'id':_0x1cb857['params']['id']}})[_0xf8ed('0x2a')](handleEntityNotFound(_0x1c378d,null))['then'](function(_0x5bf9ad){if(_0x5bf9ad){return _0x5bf9ad[_0xf8ed('0x54')](_0x1cb857[_0xf8ed('0x4e')][_0xf8ed('0x55')],_[_0xf8ed('0x56')](_0x1cb857[_0xf8ed('0x4e')],[_0xf8ed('0x55'),'id'])||{});}})[_0xf8ed('0x2a')](respondWithResult(_0x1c378d,null))[_0xf8ed('0x45')](handleError(_0x1c378d,null));};exports[_0xf8ed('0x57')]=function(_0x3a2226,_0x5acf0c,_0x4a4bde){var _0x57c2d3={};var _0x1f1fec={};var _0x3e5712;var _0x2edb90;return db['ChatGroup'][_0xf8ed('0x58')]({'where':{'id':_0x3a2226[_0xf8ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x5acf0c,null))[_0xf8ed('0x2a')](function(_0x3b7a14){if(_0x3b7a14){_0x3e5712=_0x3b7a14;_0x1f1fec[_0xf8ed('0x31')]=_[_0xf8ed('0x48')](db[_0xf8ed('0x59')][_0xf8ed('0x49')]);_0x1f1fec[_0xf8ed('0x32')]=_[_0xf8ed('0x48')](_0x3a2226[_0xf8ed('0x32')]);_0x1f1fec[_0xf8ed('0x33')]=_['intersection'](_0x1f1fec[_0xf8ed('0x31')],_0x1f1fec['query']);_0x57c2d3[_0xf8ed('0x34')]=_[_0xf8ed('0x4a')](_0x1f1fec[_0xf8ed('0x31')],qs[_0xf8ed('0x35')](_0x3a2226[_0xf8ed('0x32')][_0xf8ed('0x35')]));_0x57c2d3['attributes']=_0x57c2d3['attributes'][_0xf8ed('0x36')]?_0x57c2d3[_0xf8ed('0x34')]:_0x1f1fec[_0xf8ed('0x31')];_0x57c2d3[_0xf8ed('0x38')]=qs['sort'](_0x3a2226[_0xf8ed('0x32')][_0xf8ed('0x39')]);_0x57c2d3[_0xf8ed('0x3a')]=qs[_0xf8ed('0x33')](_[_0xf8ed('0x3b')](_0x3a2226[_0xf8ed('0x32')],_0x1f1fec[_0xf8ed('0x33')]));if(_0x3a2226[_0xf8ed('0x32')][_0xf8ed('0x3c')]){_0x57c2d3['where']=_[_0xf8ed('0x3d')](_0x57c2d3[_0xf8ed('0x3a')],{'$or':_['map'](_0x57c2d3[_0xf8ed('0x34')],function(_0x4ce8f7){var _0x3862b7={};_0x3862b7[_0x4ce8f7]={'$like':'%'+_0x3a2226[_0xf8ed('0x32')][_0xf8ed('0x3c')]+'%'};return _0x3862b7;})});}_0x57c2d3=_[_0xf8ed('0x3d')]({},_0x57c2d3,_0x3a2226[_0xf8ed('0x40')]);return _0x3e5712[_0xf8ed('0x57')](_0x57c2d3);}})[_0xf8ed('0x2a')](function(_0x33acd2){if(_0x33acd2){_0x2edb90=_0x33acd2['length'];if(!_0x3a2226[_0xf8ed('0x32')][_0xf8ed('0x37')](_0xf8ed('0x5a'))){_0x57c2d3[_0xf8ed('0x24')]=qs['limit'](_0x3a2226[_0xf8ed('0x32')][_0xf8ed('0x24')]);_0x57c2d3[_0xf8ed('0x22')]=qs[_0xf8ed('0x22')](_0x3a2226[_0xf8ed('0x32')][_0xf8ed('0x22')]);}return _0x3e5712[_0xf8ed('0x57')](_0x57c2d3);}})[_0xf8ed('0x2a')](function(_0x5b7c1b){if(_0x5b7c1b){return _0x5b7c1b?{'count':_0x2edb90,'rows':_0x5b7c1b}:null;}})[_0xf8ed('0x2a')](respondWithResult(_0x5acf0c,null))[_0xf8ed('0x45')](handleError(_0x5acf0c,null));};exports[_0xf8ed('0x5b')]=function(_0x283aef,_0x361f5e,_0x2acd95){return db[_0xf8ed('0x41')][_0xf8ed('0x4c')]({'where':{'id':_0x283aef[_0xf8ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x361f5e,null))['then'](function(_0x4f9bf5){if(_0x4f9bf5){return _0x4f9bf5[_0xf8ed('0x5b')](_0x283aef['query'][_0xf8ed('0x55')]);}})['then'](respondWithStatusCode(_0x361f5e,null))[_0xf8ed('0x45')](handleError(_0x361f5e,null));};exports[_0xf8ed('0x5c')]=function(_0x1223c7,_0x3f4d0b,_0x3635c1){if(_0x1223c7['body']['id']){delete _0x1223c7['body']['id'];}return db[_0xf8ed('0x41')][_0xf8ed('0x4c')]({'where':{'id':_0x1223c7['params']['id']}})[_0xf8ed('0x2a')](handleEntityNotFound(_0x3f4d0b,null))[_0xf8ed('0x2a')](function(_0x3b46b2){if(_0x3b46b2){_0x1223c7[_0xf8ed('0x4e')][_0xf8ed('0x5d')]=_0x3b46b2['id'];return db['ChatInternalMessage'][_0xf8ed('0x4d')](_0x1223c7[_0xf8ed('0x4e')]);}})[_0xf8ed('0x2a')](respondWithResult(_0x3f4d0b,null))['catch'](handleError(_0x3f4d0b,null));};exports[_0xf8ed('0x5e')]=function(_0x2bf8a4,_0x5b745b,_0x1a21ae){var _0x2263d2={};var _0x3d5f05={};var _0x4e95fe;var _0x52c32b;return db[_0xf8ed('0x41')][_0xf8ed('0x58')]({'where':{'id':_0x2bf8a4[_0xf8ed('0x47')]['id']}})[_0xf8ed('0x2a')](handleEntityNotFound(_0x5b745b,null))[_0xf8ed('0x2a')](function(_0x1aa304){if(_0x1aa304){_0x4e95fe=_0x1aa304;_0x3d5f05['model']=_['keys'](db[_0xf8ed('0x51')]['rawAttributes']);_0x3d5f05['query']=_[_0xf8ed('0x48')](_0x2bf8a4[_0xf8ed('0x32')]);_0x3d5f05[_0xf8ed('0x33')]=_[_0xf8ed('0x4a')](_0x3d5f05['model'],_0x3d5f05[_0xf8ed('0x32')]);_0x2263d2[_0xf8ed('0x34')]=_['intersection'](_0x3d5f05['model'],qs['fields'](_0x2bf8a4['query'][_0xf8ed('0x35')]));_0x2263d2['attributes']=_0x2263d2[_0xf8ed('0x34')]['length']?_0x2263d2[_0xf8ed('0x34')]:_0x3d5f05[_0xf8ed('0x31')];_0x2263d2[_0xf8ed('0x38')]=qs['sort'](_0x2bf8a4[_0xf8ed('0x32')][_0xf8ed('0x39')]);_0x2263d2[_0xf8ed('0x3a')]=qs[_0xf8ed('0x33')](_[_0xf8ed('0x3b')](_0x2bf8a4[_0xf8ed('0x32')],_0x3d5f05[_0xf8ed('0x33')]));if(_0x2bf8a4['query'][_0xf8ed('0x3c')]){_0x2263d2['where']=_[_0xf8ed('0x3d')](_0x2263d2[_0xf8ed('0x3a')],{'$or':_[_0xf8ed('0x2f')](_0x2263d2[_0xf8ed('0x34')],function(_0x2d67d0){var _0x4034d6={};_0x4034d6[_0x2d67d0]={'$like':'%'+_0x2bf8a4['query']['filter']+'%'};return _0x4034d6;})});}if(_0x2bf8a4[_0xf8ed('0x32')][_0xf8ed('0x5f')]){var _0x41be3a=_0x2bf8a4[_0xf8ed('0x32')]['$gte'][_0xf8ed('0x60')](',');var _0x447397={};_0x447397[_0x41be3a[0x0]]={'$gte':moment(_0x41be3a[0x1])[_0xf8ed('0x61')](_0xf8ed('0x62'))};_0x2263d2[_0xf8ed('0x3a')]=_['merge'](_0x2263d2[_0xf8ed('0x3a')],_0x447397);}_0x2263d2=_[_0xf8ed('0x3d')]({},_0x2263d2,_0x2bf8a4[_0xf8ed('0x40')]);return _0x4e95fe[_0xf8ed('0x5e')](_0x2263d2);}})[_0xf8ed('0x2a')](function(_0x43a796){if(_0x43a796){_0x52c32b=_0x43a796[_0xf8ed('0x36')];if(!_0x2bf8a4[_0xf8ed('0x32')][_0xf8ed('0x37')](_0xf8ed('0x5a'))){_0x2263d2[_0xf8ed('0x24')]=qs[_0xf8ed('0x24')](_0x2bf8a4['query'][_0xf8ed('0x24')]);_0x2263d2[_0xf8ed('0x22')]=qs[_0xf8ed('0x22')](_0x2bf8a4[_0xf8ed('0x32')][_0xf8ed('0x22')]);}return _0x4e95fe[_0xf8ed('0x5e')](_0x2263d2);}})[_0xf8ed('0x2a')](function(_0x12a9ec){if(_0x12a9ec){return _0x12a9ec?{'count':_0x52c32b,'rows':_0x12a9ec}:null;}})['then'](respondWithResult(_0x5b745b,null))['catch'](handleError(_0x5b745b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8520498..ab207bd 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 _0x97b2=['../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','exports','events'];(function(_0x17778f,_0xc39f94){var _0x24c184=function(_0x4e6646){while(--_0x4e6646){_0x17778f['push'](_0x17778f['shift']());}};_0x24c184(++_0xc39f94);}(_0x97b2,0x1b7));var _0x297b=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0x97b2[_0x50fda9];return _0x36b92b;};'use strict';var EventEmitter=require(_0x297b('0x0'));var ChatGroup=require(_0x297b('0x1'))['db'][_0x297b('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x297b('0x3')](0x0);var events={'afterCreate':_0x297b('0x4'),'afterUpdate':_0x297b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x37cce2){return function(_0x171e3f,_0x5bb44a,_0x6f1dc9){ChatGroupEvents[_0x297b('0x6')](_0x37cce2+':'+_0x171e3f['id'],_0x171e3f);ChatGroupEvents['emit'](_0x37cce2,_0x171e3f);_0x6f1dc9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x297b('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x8185=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x8185,0x127));var _0x5818=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8185[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x5818('0x0'));var ChatGroup=require(_0x5818('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5818('0x2')](0x0);var events={'afterCreate':_0x5818('0x3'),'afterUpdate':_0x5818('0x4'),'afterDestroy':'remove'};function emitEvent(_0x59270a){return function(_0x2def2f,_0x45fa9d,_0x3b34d7){ChatGroupEvents[_0x5818('0x5')](_0x59270a+':'+_0x2def2f['id'],_0x2def2f);ChatGroupEvents[_0x5818('0x5')](_0x59270a,_0x2def2f);_0x3b34d7(null);};}for(var e in events){if(events[_0x5818('0x6')](e)){var event=events[e];ChatGroup[_0x5818('0x7')](e,emitEvent(event));}}module[_0x5818('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7a88783..ced4a1e 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 _0xdc25=['rimraf','./chatGroup.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2f4890,_0x5b6afe){var _0x3091c4=function(_0x30e3f1){while(--_0x30e3f1){_0x2f4890['push'](_0x2f4890['shift']());}};_0x3091c4(++_0x5b6afe);}(_0xdc25,0xa4));var _0x5dc2=function(_0x29a89e,_0x47ce46){_0x29a89e=_0x29a89e-0x0;var _0x2246b1=_0xdc25[_0x29a89e];return _0x2246b1;};'use strict';var _=require(_0x5dc2('0x0'));var util=require(_0x5dc2('0x1'));var logger=require(_0x5dc2('0x2'))(_0x5dc2('0x3'));var moment=require('moment');var BPromise=require(_0x5dc2('0x4'));var rp=require(_0x5dc2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5dc2('0x6'));var config=require('../../config/environment');var attributes=require(_0x5dc2('0x7'));module[_0x5dc2('0x8')]=function(_0x45a05b,_0x2cf4dc){return _0x45a05b[_0x5dc2('0x9')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ebd=['moment','path','rimraf','exports','define','chat_groups','lodash','util','api'];(function(_0x1978cf,_0x106e44){var _0x7ec3f5=function(_0x5dbc39){while(--_0x5dbc39){_0x1978cf['push'](_0x1978cf['shift']());}};_0x7ec3f5(++_0x106e44);}(_0x2ebd,0xde));var _0xd2eb=function(_0x5ce528,_0x43f173){_0x5ce528=_0x5ce528-0x0;var _0x138c3b=_0x2ebd[_0x5ce528];return _0x138c3b;};'use strict';var _=require(_0xd2eb('0x0'));var util=require(_0xd2eb('0x1'));var logger=require('../../config/logger')(_0xd2eb('0x2'));var moment=require(_0xd2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2eb('0x4'));var rimraf=require(_0xd2eb('0x5'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xd2eb('0x6')]=function(_0x1d8e1b,_0x1c6857){return _0x1d8e1b[_0xd2eb('0x7')]('ChatGroup',attributes,{'tableName':_0xd2eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 7ef1004..f7ae34f 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 _0x3efa=['client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1e58e0,_0xf3ad3a){var _0x274eea=function(_0x4cbf18){while(--_0x4cbf18){_0x1e58e0['push'](_0x1e58e0['shift']());}};_0x274eea(++_0xf3ad3a);}(_0x3efa,0x147));var _0xa3ef=function(_0x5c8aeb,_0x3ce9a4){_0x5c8aeb=_0x5c8aeb-0x0;var _0x2bf950=_0x3efa[_0x5c8aeb];return _0x2bf950;};'use strict';var _=require('lodash');var util=require(_0xa3ef('0x0'));var moment=require('moment');var BPromise=require(_0xa3ef('0x1'));var rs=require(_0xa3ef('0x2'));var fs=require('fs');var Redis=require(_0xa3ef('0x3'));var db=require(_0xa3ef('0x4'))['db'];var utils=require(_0xa3ef('0x5'));var logger=require(_0xa3ef('0x6'))('rpc');var config=require(_0xa3ef('0x7'));var jayson=require(_0xa3ef('0x8'));var client=jayson[_0xa3ef('0x9')]['http']({'port':0x232a});config[_0xa3ef('0xa')]=_[_0xa3ef('0xb')](config['redis'],{'host':_0xa3ef('0xc'),'port':0x18eb});var socket=require(_0xa3ef('0xd'))(new Redis(config[_0xa3ef('0xa')]));require(_0xa3ef('0xe'))[_0xa3ef('0xf')](socket);function respondWithRpcPromise(_0x24d215,_0xbfbfd1,_0x595d9e){return new BPromise(function(_0x52f6f6,_0x2c71c2){return client[_0xa3ef('0x10')](_0x24d215,_0x595d9e)['then'](function(_0x252764){logger[_0xa3ef('0x11')]('ChatGroup,\x20%s,\x20%s',_0xbfbfd1,_0xa3ef('0x12'));logger[_0xa3ef('0x13')](_0xa3ef('0x14'),_0xbfbfd1,_0xa3ef('0x12'),JSON[_0xa3ef('0x15')](_0x252764));if(_0x252764[_0xa3ef('0x16')]){if(_0x252764['error'][_0xa3ef('0x17')]===0x1f4){logger['error'](_0xa3ef('0x18'),_0xbfbfd1,_0x252764[_0xa3ef('0x16')]['message']);return _0x2c71c2(_0x252764[_0xa3ef('0x16')][_0xa3ef('0x19')]);}logger[_0xa3ef('0x16')](_0xa3ef('0x18'),_0xbfbfd1,_0x252764[_0xa3ef('0x16')]['message']);return _0x52f6f6(_0x252764[_0xa3ef('0x16')][_0xa3ef('0x19')]);}else{logger[_0xa3ef('0x11')](_0xa3ef('0x18'),_0xbfbfd1,_0xa3ef('0x12'));_0x52f6f6(_0x252764[_0xa3ef('0x1a')]['message']);}})[_0xa3ef('0x1b')](function(_0x201937){logger[_0xa3ef('0x16')](_0xa3ef('0x18'),_0xbfbfd1,_0x201937);_0x2c71c2(_0x201937);});});} \ No newline at end of file +var _0x3c7e=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x3c7e,0xdb));var _0xe3c7=function(_0xa2049b,_0x7eeb1e){_0xa2049b=_0xa2049b-0x0;var _0x2fd615=_0x3c7e[_0xa2049b];return _0x2fd615;};'use strict';var _=require('lodash');var util=require(_0xe3c7('0x0'));var moment=require('moment');var BPromise=require(_0xe3c7('0x1'));var rs=require(_0xe3c7('0x2'));var fs=require('fs');var Redis=require(_0xe3c7('0x3'));var db=require(_0xe3c7('0x4'))['db'];var utils=require(_0xe3c7('0x5'));var logger=require(_0xe3c7('0x6'))(_0xe3c7('0x7'));var config=require(_0xe3c7('0x8'));var jayson=require(_0xe3c7('0x9'));var client=jayson[_0xe3c7('0xa')][_0xe3c7('0xb')]({'port':0x232a});config[_0xe3c7('0xc')]=_[_0xe3c7('0xd')](config[_0xe3c7('0xc')],{'host':_0xe3c7('0xe'),'port':0x18eb});var socket=require(_0xe3c7('0xf'))(new Redis(config[_0xe3c7('0xc')]));require(_0xe3c7('0x10'))[_0xe3c7('0x11')](socket);function respondWithRpcPromise(_0x358556,_0x596de9,_0x54a3fb){return new BPromise(function(_0x4fcf72,_0x59becd){return client[_0xe3c7('0x12')](_0x358556,_0x54a3fb)[_0xe3c7('0x13')](function(_0x52cf90){logger['info'](_0xe3c7('0x14'),_0x596de9,_0xe3c7('0x15'));logger[_0xe3c7('0x16')](_0xe3c7('0x17'),_0x596de9,_0xe3c7('0x15'),JSON[_0xe3c7('0x18')](_0x52cf90));if(_0x52cf90[_0xe3c7('0x19')]){if(_0x52cf90['error'][_0xe3c7('0x1a')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x596de9,_0x52cf90[_0xe3c7('0x19')][_0xe3c7('0x1b')]);return _0x59becd(_0x52cf90[_0xe3c7('0x19')]['message']);}logger[_0xe3c7('0x19')]('ChatGroup,\x20%s,\x20%s',_0x596de9,_0x52cf90[_0xe3c7('0x19')][_0xe3c7('0x1b')]);return _0x4fcf72(_0x52cf90[_0xe3c7('0x19')][_0xe3c7('0x1b')]);}else{logger[_0xe3c7('0x1c')](_0xe3c7('0x14'),_0x596de9,'request\x20sent');_0x4fcf72(_0x52cf90[_0xe3c7('0x1d')]['message']);}})[_0xe3c7('0x1e')](function(_0x13f5bc){logger[_0xe3c7('0x19')](_0xe3c7('0x14'),_0x596de9,_0x13f5bc);_0x59becd(_0x13f5bc);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ab61c5d..9817b7a 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 _0xff5b=['./chatGroup.events','remove','update','emit','removeListener','register','length','chatGroup:'];(function(_0x119ecf,_0x3910e0){var _0x59482f=function(_0x4b7c88){while(--_0x4b7c88){_0x119ecf['push'](_0x119ecf['shift']());}};_0x59482f(++_0x3910e0);}(_0xff5b,0xe0));var _0xbff5=function(_0x33f2bf,_0x279402){_0x33f2bf=_0x33f2bf-0x0;var _0x440c71=_0xff5b[_0x33f2bf];return _0x440c71;};'use strict';var ChatGroupEvents=require(_0xbff5('0x0'));var events=['save',_0xbff5('0x1'),_0xbff5('0x2')];function createListener(_0x16d93c,_0xc30d51){return function(_0x352f2c){_0xc30d51[_0xbff5('0x3')](_0x16d93c,_0x352f2c);};}function removeListener(_0x6e7829,_0x19b5cc){return function(){ChatGroupEvents[_0xbff5('0x4')](_0x6e7829,_0x19b5cc);};}exports[_0xbff5('0x5')]=function(_0xa9e6ad){for(var _0x125cf0=0x0,_0x5a829a=events[_0xbff5('0x6')];_0x125cf0<_0x5a829a;_0x125cf0++){var _0x49b335=events[_0x125cf0];var _0x61d13b=createListener(_0xbff5('0x7')+_0x49b335,_0xa9e6ad);ChatGroupEvents['on'](_0x49b335,_0x61d13b);}}; \ No newline at end of file +var _0x244e=['emit','register','length','chatGroup:','./chatGroup.events','remove','update'];(function(_0x16c2e0,_0x3dc335){var _0x49b690=function(_0x5bb015){while(--_0x5bb015){_0x16c2e0['push'](_0x16c2e0['shift']());}};_0x49b690(++_0x3dc335);}(_0x244e,0x19a));var _0xe244=function(_0x5e3c95,_0x380914){_0x5e3c95=_0x5e3c95-0x0;var _0x1692d8=_0x244e[_0x5e3c95];return _0x1692d8;};'use strict';var ChatGroupEvents=require(_0xe244('0x0'));var events=['save',_0xe244('0x1'),_0xe244('0x2')];function createListener(_0x15452d,_0x3ebe61){return function(_0x181f1d){_0x3ebe61[_0xe244('0x3')](_0x15452d,_0x181f1d);};}function removeListener(_0x4968d4,_0x355301){return function(){ChatGroupEvents['removeListener'](_0x4968d4,_0x355301);};}exports[_0xe244('0x4')]=function(_0x19dc91){for(var _0x4c519f=0x0,_0x2a7d57=events[_0xe244('0x5')];_0x4c519f<_0x2a7d57;_0x4c519f++){var _0x46bbf5=events[_0x4c519f];var _0x4ed2c9=createListener(_0xe244('0x6')+_0x46bbf5,_0x19dc91);ChatGroupEvents['on'](_0x46bbf5,_0x4ed2c9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4d181eb..caa4cda 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 _0x2bf8=['../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','getUnread','getMembers','/:id/messages','getMessages','create','/:id/members','post','addMessage','update','destroy','delete','removeMembers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x2bf8,0x13d));var _0x82bf=function(_0x21864a,_0x6919d3){_0x21864a=_0x21864a-0x0;var _0x2e302a=_0x2bf8[_0x21864a];return _0x2e302a;};'use strict';var multer=require(_0x82bf('0x0'));var util=require(_0x82bf('0x1'));var path=require(_0x82bf('0x2'));var timeout=require(_0x82bf('0x3'));var express=require('express');var router=express[_0x82bf('0x4')]();var fs_extra=require(_0x82bf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x82bf('0x6'));var config=require(_0x82bf('0x7'));var controller=require(_0x82bf('0x8'));router[_0x82bf('0x9')]('/',auth[_0x82bf('0xa')](),controller[_0x82bf('0xb')]);router[_0x82bf('0x9')]('/describe',auth[_0x82bf('0xa')](),controller['describe']);router[_0x82bf('0x9')](_0x82bf('0xc'),auth['isAuthenticated'](),controller[_0x82bf('0xd')]);router['get']('/:id/unread',auth['isAuthenticated'](),controller[_0x82bf('0xe')]);router[_0x82bf('0x9')]('/:id/members',auth[_0x82bf('0xa')](),controller[_0x82bf('0xf')]);router[_0x82bf('0x9')](_0x82bf('0x10'),auth[_0x82bf('0xa')](),controller[_0x82bf('0x11')]);router['post']('/',auth[_0x82bf('0xa')](),controller[_0x82bf('0x12')]);router['post'](_0x82bf('0x13'),auth[_0x82bf('0xa')](),controller['addMembers']);router[_0x82bf('0x14')](_0x82bf('0x10'),auth[_0x82bf('0xa')](),controller[_0x82bf('0x15')]);router['put'](_0x82bf('0xc'),auth['isAuthenticated'](),controller[_0x82bf('0x16')]);router['delete']('/:id',auth[_0x82bf('0xa')](),controller[_0x82bf('0x17')]);router[_0x82bf('0x18')]('/:id/members',auth['isAuthenticated'](),controller[_0x82bf('0x19')]);module[_0x82bf('0x1a')]=router; \ No newline at end of file +var _0xb59e=['getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages'];(function(_0x1bbbbb,_0x26bf4b){var _0x2b089d=function(_0x12e092){while(--_0x12e092){_0x1bbbbb['push'](_0x1bbbbb['shift']());}};_0x2b089d(++_0x26bf4b);}(_0xb59e,0x76));var _0xeb59=function(_0x16268a,_0x3cc445){_0x16268a=_0x16268a-0x0;var _0x5b4384=_0xb59e[_0x16268a];return _0x5b4384;};'use strict';var multer=require('multer');var util=require(_0xeb59('0x0'));var path=require(_0xeb59('0x1'));var timeout=require('connect-timeout');var express=require(_0xeb59('0x2'));var router=express[_0xeb59('0x3')]();var fs_extra=require(_0xeb59('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeb59('0x5'));router[_0xeb59('0x6')]('/',auth['isAuthenticated'](),controller[_0xeb59('0x7')]);router['get'](_0xeb59('0x8'),auth[_0xeb59('0x9')](),controller[_0xeb59('0xa')]);router[_0xeb59('0x6')](_0xeb59('0xb'),auth[_0xeb59('0x9')](),controller[_0xeb59('0xc')]);router[_0xeb59('0x6')](_0xeb59('0xd'),auth[_0xeb59('0x9')](),controller[_0xeb59('0xe')]);router[_0xeb59('0x6')](_0xeb59('0xf'),auth[_0xeb59('0x9')](),controller['getMembers']);router['get'](_0xeb59('0x10'),auth[_0xeb59('0x9')](),controller[_0xeb59('0x11')]);router[_0xeb59('0x12')]('/',auth[_0xeb59('0x9')](),controller[_0xeb59('0x13')]);router[_0xeb59('0x12')](_0xeb59('0xf'),auth['isAuthenticated'](),controller[_0xeb59('0x14')]);router[_0xeb59('0x12')](_0xeb59('0x10'),auth['isAuthenticated'](),controller[_0xeb59('0x15')]);router[_0xeb59('0x16')]('/:id',auth[_0xeb59('0x9')](),controller[_0xeb59('0x17')]);router[_0xeb59('0x18')](_0xeb59('0xb'),auth['isAuthenticated'](),controller[_0xeb59('0x19')]);router['delete'](_0xeb59('0xf'),auth[_0xeb59('0x9')](),controller['removeMembers']);module[_0xeb59('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c77bd29..0c89641 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 _0xd547=['DATE','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0xd547,0x1c1));var _0x7d54=function(_0x5c7158,_0x40146f){_0x5c7158=_0x5c7158-0x0;var _0x526bc4=_0xd547[_0x5c7158];return _0x526bc4;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x7d54('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7d54('0x1')]},'ratingType':{'type':Sequelize[_0x7d54('0x2')](_0x7d54('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x7d54('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x7d54('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7d54('0x5')]},'secondDisposition':{'type':Sequelize[_0x7d54('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7d54('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x7d54('0x5')]},'osVersion':{'type':Sequelize[_0x7d54('0x5')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x7d54('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x7d54('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7d54('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x7d54('0x6')]},'lastMsgAt':{'type':Sequelize[_0x7d54('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x7d54('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x7d54('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x7d54('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x8b29=['sequelize','BOOLEAN','INTEGER','thumb','star','TEXT','DATE','STRING','long','out'];(function(_0x2e6bc2,_0x550f2a){var _0x1f3356=function(_0x4953c6){while(--_0x4953c6){_0x2e6bc2['push'](_0x2e6bc2['shift']());}};_0x1f3356(++_0x550f2a);}(_0x8b29,0xbe));var _0x98b2=function(_0x1f9e49,_0x359b05){_0x1f9e49=_0x1f9e49-0x0;var _0x54e24f=_0x8b29[_0x1f9e49];return _0x54e24f;};'use strict';var Sequelize=require(_0x98b2('0x0'));module['exports']={'closed':{'type':Sequelize[_0x98b2('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x98b2('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x98b2('0x3')),'defaultValue':_0x98b2('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x98b2('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x98b2('0x6')]},'disposition':{'type':Sequelize[_0x98b2('0x7')]},'secondDisposition':{'type':Sequelize[_0x98b2('0x7')]},'thirdDisposition':{'type':Sequelize[_0x98b2('0x7')]},'note':{'type':Sequelize[_0x98b2('0x7')]},'browserName':{'type':Sequelize[_0x98b2('0x7')]},'browserVersion':{'type':Sequelize[_0x98b2('0x7')]},'osName':{'type':Sequelize[_0x98b2('0x7')]},'osVersion':{'type':Sequelize[_0x98b2('0x7')]},'deviceModel':{'type':Sequelize[_0x98b2('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x98b2('0x5')]},'customerIp':{'type':Sequelize[_0x98b2('0x7')]},'formData':{'type':Sequelize[_0x98b2('0x5')](_0x98b2('0x8'))},'read1stAt':{'type':Sequelize[_0x98b2('0x6')]},'lastMsgAt':{'type':Sequelize[_0x98b2('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x98b2('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x98b2('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x98b2('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x98b2('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 14bb1c5..1ae157d 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 _0xdd4f=['i.ChatWebsiteId\x20IN\x20?','toString','sequelize','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','includeAll','include','options','create','params','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','basename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','format','%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','service','host','port','secure','authentication','pass','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','omit','nolimit','sort','ChatInteractionId','$gte','getMyMessages','filter','findAll','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','attachments','transcript-%d-%s.zip','lastName','ChatWebsite','Account','get','mkdirSync','Chat','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','existsSync','createReadStream','pipe','createWriteStream','out','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','stack','name','send','render','merge','body','interaction','account','Users','map','fullname','Tags','TagIds','split','forEach','push','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','pick','field','from','tools_tags','select','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','compact','isEmpty','ChatWebsiteId','where','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL'];(function(_0x5bc4f9,_0x3913d8){var _0x3e1065=function(_0x4c711a){while(--_0x4c711a){_0x5bc4f9['push'](_0x5bc4f9['shift']());}};_0x3e1065(++_0x3913d8);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2b5709,_0x383a5d){_0x2b5709=_0x2b5709-0x0;var _0x5282df=_0xdd4f[_0x2b5709];return _0x5282df;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var pdf=require(_0xfdd4('0x10'));var hardwareService=require(_0xfdd4('0x11'));var logger=require(_0xfdd4('0x12'))(_0xfdd4('0x13'));var utils=require(_0xfdd4('0x14'));var config=require(_0xfdd4('0x15'));var licenseUtil=require(_0xfdd4('0x16'));var db=require(_0xfdd4('0x17'))['db'];config[_0xfdd4('0x18')]=_[_0xfdd4('0x19')](config['redis'],{'host':_0xfdd4('0x1a'),'port':0x18eb});var socket=require(_0xfdd4('0x1b'))(new Redis(config[_0xfdd4('0x18')]));require('./chatInteraction.socket')[_0xfdd4('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfdd4('0x1d')][_0xfdd4('0x1e')]({'port':0x232b});var client9004=jayson[_0xfdd4('0x1d')][_0xfdd4('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x37b05f,_0x52cf2c,_0x47ed1d,_0x559c77){return new BPromise(function(_0x3a966d,_0x216c7e){var _0x2eb174=_0x559c77||client;return _0x2eb174[_0xfdd4('0x1f')](_0x37b05f,_0x47ed1d)[_0xfdd4('0x20')](function(_0x33d752){logger[_0xfdd4('0x21')](_0xfdd4('0x22'),_0x52cf2c,_0xfdd4('0x23'));logger['debug'](_0xfdd4('0x24'),_0x52cf2c,_0xfdd4('0x23'),JSON[_0xfdd4('0x25')](_0x33d752));if(_0x33d752[_0xfdd4('0x26')]){if(_0x33d752[_0xfdd4('0x26')][_0xfdd4('0x27')]===0x1f4){logger[_0xfdd4('0x26')](_0xfdd4('0x22'),_0x52cf2c,_0x33d752['error'][_0xfdd4('0x28')]);return _0x216c7e(_0x33d752[_0xfdd4('0x26')][_0xfdd4('0x28')]);}logger[_0xfdd4('0x26')](_0xfdd4('0x22'),_0x52cf2c,_0x33d752[_0xfdd4('0x26')][_0xfdd4('0x28')]);return _0x3a966d(_0x33d752[_0xfdd4('0x26')]['message']);}else{logger[_0xfdd4('0x21')](_0xfdd4('0x22'),_0x52cf2c,_0xfdd4('0x23'));_0x3a966d(_0x33d752['result'][_0xfdd4('0x28')]);}})[_0xfdd4('0x29')](function(_0xf9c346){logger[_0xfdd4('0x26')](_0xfdd4('0x22'),_0x52cf2c,_0xf9c346);_0x216c7e(_0xf9c346);});});}function respondWithStatusCode(_0x4a8790,_0x18bafb){_0x18bafb=_0x18bafb||0xcc;return function(_0x2c88ad){if(_0x2c88ad){return _0x4a8790[_0xfdd4('0x2a')](_0x18bafb);}return _0x4a8790[_0xfdd4('0x2b')](_0x18bafb)[_0xfdd4('0x2c')]();};}function respondWithResult(_0x192471,_0x453a48){_0x453a48=_0x453a48||0xc8;return function(_0x37b7a2){if(_0x37b7a2){return _0x192471['status'](_0x453a48)[_0xfdd4('0x2d')](_0x37b7a2);}};}function respondWithFilteredResult(_0x39981f,_0x385a68){return function(_0xef012e){if(_0xef012e){var _0x2207ae=typeof _0x385a68['offset']===_0xfdd4('0x2e')&&typeof _0x385a68[_0xfdd4('0x2f')]===_0xfdd4('0x2e');var _0x2bb793=_0xef012e[_0xfdd4('0x30')];var _0x4d64ce=_0x2207ae?0x0:_0x385a68[_0xfdd4('0x31')];var _0x315568=_0x2207ae?_0xef012e[_0xfdd4('0x30')]:_0x385a68['offset']+_0x385a68[_0xfdd4('0x2f')];var _0x502776;if(_0x315568>=_0x2bb793){_0x315568=_0x2bb793;_0x502776=0xc8;}else{_0x502776=0xce;}_0x39981f[_0xfdd4('0x2b')](_0x502776);return _0x39981f[_0xfdd4('0x32')]('Content-Range',_0x4d64ce+'-'+_0x315568+'/'+_0x2bb793)['json'](_0xef012e);}return null;};}function patchUpdates(_0x41dae6){return function(_0x289f16){try{jsonpatch['apply'](_0x289f16,_0x41dae6,!![]);}catch(_0x557d7b){return BPromise[_0xfdd4('0x33')](_0x557d7b);}return _0x289f16[_0xfdd4('0x34')]();};}function saveUpdates(_0x39eedb,_0x24b1fa){return function(_0x3247f4){if(_0x3247f4){return _0x3247f4[_0xfdd4('0x35')](_0x39eedb)[_0xfdd4('0x20')](function(_0x4734ed){return _0x4734ed;});}return null;};}function removeEntity(_0x3e6bc5,_0x457ab5){return function(_0x6ffe30){if(_0x6ffe30){return _0x6ffe30[_0xfdd4('0x36')]()[_0xfdd4('0x20')](function(){_0x3e6bc5[_0xfdd4('0x2b')](0xcc)[_0xfdd4('0x2c')]();});}};}function handleEntityNotFound(_0x3f5c5a,_0x261d87){return function(_0x3a0102){if(!_0x3a0102){_0x3f5c5a[_0xfdd4('0x2a')](0x194);}return _0x3a0102;};}function handleError(_0x4037c4,_0xc9549b){_0xc9549b=_0xc9549b||0x1f4;return function(_0x2e4c8c){logger[_0xfdd4('0x26')](_0x2e4c8c[_0xfdd4('0x37')]);if(_0x2e4c8c[_0xfdd4('0x38')]){delete _0x2e4c8c[_0xfdd4('0x38')];}_0x4037c4['status'](_0xc9549b)[_0xfdd4('0x39')](_0x2e4c8c);};}function getMustacheRender(_0x3716da,_0x42dc1a){return Mustache[_0xfdd4('0x3a')](_0x3716da,_[_0xfdd4('0x3b')](_0x42dc1a[_0xfdd4('0x3c')],{'contact':_0x42dc1a['contact'],'message':_0x42dc1a[_0xfdd4('0x28')],'agent':_0x42dc1a['agent'],'interaction':_0x42dc1a[_0xfdd4('0x3d')],'account':_0x42dc1a[_0xfdd4('0x3e')]}))||'';}function getInteractionUsers(_0x6a79eb,_0x13efe8){return new BPromise(function(_0x4cccab,_0x1c6f43){try{if(_0x13efe8[_0x6a79eb['id']]){_0x6a79eb[_0xfdd4('0x3f')]=_[_0xfdd4('0x40')](_0x13efe8[_0x6a79eb['id']],function(_0x2ee857){return{'id':_0x2ee857['id'],'fullname':_0x2ee857[_0xfdd4('0x41')]};});}}catch(_0x7e171){_0x1c6f43(_0x7e171);}_0x4cccab(_0x6a79eb);});}function getInteractionTags(_0x28e5e2,_0x55fcec){return new BPromise(function(_0xe65944,_0x83673d){try{if(_0x28e5e2['TagIds']){_0x28e5e2[_0xfdd4('0x42')]=[];_0x28e5e2[_0xfdd4('0x43')][_0xfdd4('0x44')](',')[_0xfdd4('0x45')](function(_0x5173db){_0x28e5e2[_0xfdd4('0x42')][_0xfdd4('0x46')](_0x55fcec[_0x5173db]);});}delete _0x28e5e2[_0xfdd4('0x43')];}catch(_0x2341e5){_0x83673d(_0x2341e5);}_0xe65944(_0x28e5e2);});}function updateChatInteraction(_0x362c4f,_0x496747,_0x1411e0){return new BPromise(function(_0x23af2a,_0xd3780d){return getInteractionUsers(_0x362c4f,_0x1411e0)[_0xfdd4('0x20')](function(_0x912520){return getInteractionTags(_0x912520,_0x496747);})[_0xfdd4('0x20')](function(_0x3d1051){_0x23af2a(_0x3d1051);})['catch'](function(_0x2dd3fa){_0xd3780d(_0x2dd3fa);});});}exports['index']=function(_0x3a0de9,_0x11f241){var _0x3f7273={},_0x137d41={},_0x5367aa={'count':0x0,'rows':[]};var _0x419578=_[_0xfdd4('0x40')](db['ChatInteraction'][_0xfdd4('0x47')],function(_0xbfaa53){return{'name':_0xbfaa53['fieldName'],'type':_0xbfaa53[_0xfdd4('0x48')]['key']};});_0x137d41['model']=_['map'](_0x419578,_0xfdd4('0x38'));_0x137d41[_0xfdd4('0x49')]=_[_0xfdd4('0x4a')](_0x3a0de9['query']);_0x137d41[_0xfdd4('0x4b')]=_[_0xfdd4('0x4c')](_0x137d41['model'],_0x137d41[_0xfdd4('0x49')]);_0x3f7273[_0xfdd4('0x4d')]=_[_0xfdd4('0x4c')](_0x137d41[_0xfdd4('0x4e')],qs[_0xfdd4('0x4f')](_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x4f')]));_0x3f7273[_0xfdd4('0x4d')]=_0x3f7273[_0xfdd4('0x4d')][_0xfdd4('0x50')]?_0x3f7273[_0xfdd4('0x4d')]:_0x137d41[_0xfdd4('0x4e')];if(!_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x51')]('nolimit')){_0x3f7273['limit']=qs[_0xfdd4('0x2f')](_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x2f')]);_0x3f7273[_0xfdd4('0x31')]=qs['offset'](_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x31')]);}_0x3f7273['order']=qs['sort'](_0x3a0de9['query']['sort']);_0x3f7273['where']=qs[_0xfdd4('0x4b')](_[_0xfdd4('0x52')](_0x3a0de9[_0xfdd4('0x49')],_0x137d41[_0xfdd4('0x4b')]),_0x419578);var _0x35c032=[];var _0x49bc61=squel['select']()[_0xfdd4('0x53')]('id')[_0xfdd4('0x53')](_0xfdd4('0x38'))[_0xfdd4('0x53')]('color')[_0xfdd4('0x54')](_0xfdd4('0x55'));var _0x4addd6=squel[_0xfdd4('0x56')]()[_0xfdd4('0x53')]('u.id')['field'](_0xfdd4('0x57'))[_0xfdd4('0x53')](_0xfdd4('0x58'))[_0xfdd4('0x54')](_0xfdd4('0x59'),'ui')[_0xfdd4('0x5a')](_0xfdd4('0x5b'),'u',_0xfdd4('0x5c'));var _0x5848e1=squel[_0xfdd4('0x56')]()['from']('chat_interactions','i')[_0xfdd4('0x5a')](_0xfdd4('0x5d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xfdd4('0x5e'))[_0xfdd4('0x5a')]('chat_websites','a',_0xfdd4('0x5f'))[_0xfdd4('0x5a')](_0xfdd4('0x60'),'me',_0xfdd4('0x61'))[_0xfdd4('0x5a')]('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xfdd4('0x62'));var _0x14d07e=squel['expr']();var _0x1eee3d=[];var _0x2abe50=squel['expr']();var _0x45dcc8;if(_0x3a0de9[_0xfdd4('0x49')]['search']){_0x45dcc8=as[_0xfdd4('0x63')](_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x64')]);var _0x4a5fe6=_0x45dcc8[_0xfdd4('0x65')];for(var _0x3417dd=0x0;_0x3417dd<_0x45dcc8[_0xfdd4('0x66')][_0xfdd4('0x50')];_0x3417dd++){var _0x5c7be=_0x45dcc8['conditions'][_0x3417dd];var _0x2cc3e2='i';var _0x2ee4b6=_[_0xfdd4('0x67')](_0x419578,[_0xfdd4('0x38'),_0x5c7be[_0xfdd4('0x53')]]);if(!_0x2ee4b6){switch(_0x5c7be[_0xfdd4('0x53')]){case _0xfdd4('0x68'):if(_0x5c7be[_0xfdd4('0x69')]==0x1){_0x5848e1[_0xfdd4('0x6a')]('`'+_0x5c7be['field']+_0xfdd4('0x6b'));}else{_0x5848e1[_0xfdd4('0x6a')]('`'+_0x5c7be[_0xfdd4('0x53')]+_0xfdd4('0x6c'));}break;case _0xfdd4('0x6d'):if(_0x5c7be['operator']===_0xfdd4('0x6e')){if(_0x5c7be[_0xfdd4('0x69')][_0xfdd4('0x44')]('\x20')[_0xfdd4('0x50')]>0x1){_0x14d07e[_0x4a5fe6](_0xfdd4('0x6f'),qs[_0xfdd4('0x70')](_0x5c7be[_0xfdd4('0x69')]),null);}else{var _0x276e9='%'+_0x5c7be[_0xfdd4('0x69')]+'%';_0x14d07e[_0x4a5fe6](_0xfdd4('0x71'),_0x276e9,_0x276e9,_0x276e9);}}else{_0x2ee4b6=_[_0xfdd4('0x67')](_0x419578,[_0xfdd4('0x38'),_0xfdd4('0x72')]);_0x5c7be['field']=_0xfdd4('0x72');_0xa55e0f=as['buildExpression'](_0x2cc3e2,_0x2ee4b6[_0xfdd4('0x48')],_0x5c7be);_0x14d07e[_0x4a5fe6](_0xa55e0f[_0xfdd4('0x73')],_0xa55e0f[_0xfdd4('0x69')][_0xfdd4('0x74')],_0xa55e0f[_0xfdd4('0x69')][_0xfdd4('0x2c')]);}break;case _0xfdd4('0x75'):var _0xb0bb50=_0x5c7be[_0xfdd4('0x69')][_0xfdd4('0x44')](',')[_0xfdd4('0x40')](function(_0x207a4c){return Number(_0x207a4c);});_0xb0bb50['forEach'](function(_0x4bac59){_0x2abe50['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4bac59+',%');});_0x1eee3d=_[_0xfdd4('0x76')](_0x1eee3d,_0xb0bb50);break;case _0xfdd4('0x77'):if(_0x5c7be['operator']===_0xfdd4('0x6e')){_0x14d07e[_0x4a5fe6](_0xfdd4('0x78'),'%'+_0x5c7be[_0xfdd4('0x69')]+'%',null);}else{_0x2ee4b6=_[_0xfdd4('0x67')](_0x419578,[_0xfdd4('0x38'),'UserId']);_0x5c7be[_0xfdd4('0x53')]=_0xfdd4('0x79');_0xa55e0f=as[_0xfdd4('0x7a')](_0x2cc3e2,_0x2ee4b6['type'],_0x5c7be);_0x14d07e[_0x4a5fe6](_0xa55e0f[_0xfdd4('0x73')],_0xa55e0f['value'][_0xfdd4('0x74')],_0xa55e0f[_0xfdd4('0x69')][_0xfdd4('0x2c')]);}break;case _0xfdd4('0x3c'):_0xa55e0f=as['buildExpression']('me',null,_0x5c7be);_0x14d07e[_0x4a5fe6](_0xa55e0f[_0xfdd4('0x73')],_0xa55e0f[_0xfdd4('0x69')]['start'],_0xa55e0f[_0xfdd4('0x69')][_0xfdd4('0x2c')]);break;}}else{var _0xa55e0f=as['buildExpression'](_0x2cc3e2,_0x2ee4b6[_0xfdd4('0x48')],_0x5c7be);_0x14d07e[_0x4a5fe6](_0xa55e0f[_0xfdd4('0x73')],_0xa55e0f[_0xfdd4('0x69')]['start'],_0xa55e0f[_0xfdd4('0x69')][_0xfdd4('0x2c')]);}}}else{var _0x427ded=_(_0x3a0de9[_0xfdd4('0x49')])[_0xfdd4('0x4a')]()[_0xfdd4('0x40')](function(_0x185226){return _['some'](_0x419578,[_0xfdd4('0x38'),_0x185226])?_0x185226:undefined;})[_0xfdd4('0x7b')]()[_0xfdd4('0x69')]();if(!_[_0xfdd4('0x7c')](_0x427ded)){_0x427ded[_0xfdd4('0x45')](function(_0x2cbd27){if(_0x2cbd27===_0xfdd4('0x7d')){_0x5848e1[_0xfdd4('0x7e')]('i.ChatWebsiteId\x20IN\x20?',[][_0xfdd4('0x7f')](_0x3a0de9['query'][_0x2cbd27]));}else if(_0x2cbd27==='createdAt'){var _0x40b2e8=JSON['parse'](_0x3a0de9[_0xfdd4('0x49')][_0x2cbd27])['$gte'];var _0x4576ce=JSON[_0xfdd4('0x80')](_0x3a0de9[_0xfdd4('0x49')][_0x2cbd27])[_0xfdd4('0x81')];_0x5848e1[_0xfdd4('0x7e')](_0xfdd4('0x82'),_0x40b2e8,_0x4576ce);}else{if(_0x3a0de9[_0xfdd4('0x49')][_0x2cbd27]==='null'){_0x5848e1['where']('i.'+_0x2cbd27+_0xfdd4('0x83'));}else{_0x5848e1['where']('i.'+_0x2cbd27+_0xfdd4('0x84'),_0x3a0de9[_0xfdd4('0x49')][_0x2cbd27]);}}});}if(_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x85')]){if(_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x85')]==0x1){_0x5848e1[_0xfdd4('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x5848e1['having'](_0xfdd4('0x86'));}}if(_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x87')]){_0x1eee3d=_[_0xfdd4('0x88')](_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x87')])?_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x87')]:new Array(_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x87')]);_0x1eee3d[_0xfdd4('0x45')](function(_0x32abf5){_0x2abe50['or'](_0xfdd4('0x89'),'%,'+_0x32abf5+',%');});}if(_0x3a0de9['query']['filter']){var _0x3761f2=_0x3a0de9[_0xfdd4('0x49')]['filter']['replace']('\x5c','\x5c\x5c')[_0xfdd4('0x8a')](/'/g,'\x27\x27');if(qs[_0xfdd4('0x8b')](_0x3761f2)){_0x14d07e['or']('i.id\x20LIKE\x20?',_0x3761f2+'%');}else{_0x14d07e['or'](_0xfdd4('0x8c'),qs[_0xfdd4('0x70')](_0x3761f2))['or'](_0xfdd4('0x8d'),_0x3761f2+'%');}}}_0x5848e1[_0xfdd4('0x7e')](_0x14d07e);_0x5848e1[_0xfdd4('0x8e')](_0xfdd4('0x8f'));var _0x5d356c={'type':db[_0xfdd4('0x90')][_0xfdd4('0x91')][_0xfdd4('0x92')],'raw':!![]};var _0x2f8001=_0x5848e1[_0xfdd4('0x93')]();_0x2f8001[_0xfdd4('0x53')](_0xfdd4('0x8f'));_0x2f8001[_0xfdd4('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x3f7273[_0xfdd4('0x94')]){_0x3f7273['order'][_0xfdd4('0x45')](function(_0x1b4f61){var _0x298906=_0x1b4f61[0x0]===_0xfdd4('0x95')?_0x1b4f61[0x0]:'i.'+_0x1b4f61[0x0];_0x5848e1[_0xfdd4('0x94')](_0x298906,_0x1b4f61[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1eee3d)){_0x5848e1[_0xfdd4('0x6a')](_0x2abe50);_0x2f8001['where'](_0xfdd4('0x96'),_0x1eee3d);}BPromise['resolve']()[_0xfdd4('0x20')](function(){if(!_0x45dcc8){if(_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x7d')])return;_0x2f8001[_0xfdd4('0x7e')](_0xfdd4('0x97'));_0x5848e1[_0xfdd4('0x7e')](_0xfdd4('0x97'));return;}if(_0x3a0de9[_0xfdd4('0x98')][_0xfdd4('0x99')]!==_0xfdd4('0x9a'))return;return _0x3a0de9[_0xfdd4('0x98')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xfdd4('0x20')](function(_0x1f9e08){if(_[_0xfdd4('0x7c')](_0x1f9e08)){_0x2f8001[_0xfdd4('0x7e')](_0xfdd4('0x9b'));_0x5848e1[_0xfdd4('0x7e')](_0xfdd4('0x9b'));}else{_0x2f8001[_0xfdd4('0x7e')](_0xfdd4('0x9c'),_['map'](_0x1f9e08,'id'));_0x5848e1['where'](_0xfdd4('0x9c'),_[_0xfdd4('0x40')](_0x1f9e08,'id'));}});})[_0xfdd4('0x20')](function(){if(_0x3a0de9['user'][_0xfdd4('0x99')]===_0xfdd4('0x9a')&&!_0x45dcc8&&!_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x7d')])return[];return db['sequelize']['query'](_0x2f8001[_0xfdd4('0x9d')](),_0x5d356c);})[_0xfdd4('0x20')](function(_0x3b75bf){_0x5367aa['count']=_0x3b75bf[_0xfdd4('0x50')];if(_0x5367aa[_0xfdd4('0x30')]===0x0)return[];return db[_0xfdd4('0x9e')][_0xfdd4('0x49')](_0x49bc61[_0xfdd4('0x9d')](),_0x5d356c)[_0xfdd4('0x20')](function(_0x524a8f){_0x35c032=_['keyBy'](_0x524a8f,'id');_0x5d356c=_[_0xfdd4('0x3b')](_0x5d356c,{'model':db[_0xfdd4('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a0de9[_0xfdd4('0x49')][_0xfdd4('0x4f')]){_0x3f7273[_0xfdd4('0x4d')][_0xfdd4('0x45')](function(_0x46edc9){_0x5848e1[_0xfdd4('0x53')]('i.'+_0x46edc9);});}else{_0x5848e1['field'](_0xfdd4('0xa0'),'unreadMessages');_0x5848e1[_0xfdd4('0x53')](_0xfdd4('0xa1'),'Account.key');_0x5848e1[_0xfdd4('0x53')](_0xfdd4('0xa2'),_0xfdd4('0xa3'));_0x5848e1[_0xfdd4('0x53')](_0xfdd4('0xa4'),_0xfdd4('0x95'));_0x5848e1[_0xfdd4('0x53')](_0xfdd4('0xa5'));_0x5848e1[_0xfdd4('0x53')]('c.firstName',_0xfdd4('0xa6'));_0x5848e1['field'](_0xfdd4('0xa7'),'Contact.lastName');_0x5848e1['field'](_0xfdd4('0xa8'),_0xfdd4('0xa9'));_0x5848e1[_0xfdd4('0x53')](_0xfdd4('0xaa'),_0xfdd4('0xab'));_0x5848e1['field'](_0xfdd4('0xac'),_0xfdd4('0xad'));_0x5848e1[_0xfdd4('0x53')](_0xfdd4('0xae'),_0xfdd4('0xaf'));_0x5848e1[_0xfdd4('0x53')]('o.fullname',_0xfdd4('0xb0'));_0x5848e1[_0xfdd4('0x53')]('o.internal','Owner.internal');_0x5848e1[_0xfdd4('0x53')](_0xfdd4('0xb1'),_0xfdd4('0x43'));}if(_0x3f7273['limit'])_0x5848e1['limit'](_0x3f7273[_0xfdd4('0x2f')]);if(_0x3f7273[_0xfdd4('0x31')])_0x5848e1[_0xfdd4('0x31')](_0x3f7273['offset']);return db['sequelize'][_0xfdd4('0x49')](_0x5848e1[_0xfdd4('0x9d')](),_0x5d356c);})[_0xfdd4('0x20')](function(_0x4bfb31){if(_0x4bfb31[_0xfdd4('0x50')]>0x0)_0x4addd6['where'](_0xfdd4('0xb2'),_[_0xfdd4('0x40')](_0x4bfb31,'id'));return db[_0xfdd4('0x9e')]['query'](_0x4addd6[_0xfdd4('0x9d')](),_0x5d356c)[_0xfdd4('0x20')](function(_0x1efb08){var _0xe3296c=_[_0xfdd4('0xb3')](_0x1efb08,'ChatInteractionId');var _0x19de84=[];_0x4bfb31[_0xfdd4('0x45')](function(_0x133f56){_0x19de84['push'](updateChatInteraction(_0x133f56,_0x35c032,_0xe3296c));});return BPromise[_0xfdd4('0xb4')](_0x19de84);});});})[_0xfdd4('0x20')](function(_0xb9cb69){_0x5367aa[_0xfdd4('0xb5')]=_0xb9cb69;return _0x5367aa;})['then'](respondWithFilteredResult(_0x11f241,_0x3f7273))[_0xfdd4('0x29')](handleError(_0x11f241,null));};exports['show']=function(_0x4f5ca3,_0x528004){var _0x206a59={'raw':![],'where':{'id':_0x4f5ca3['params']['id']}},_0x545475={};_0x545475['model']=_[_0xfdd4('0x4a')](db[_0xfdd4('0x9f')][_0xfdd4('0x47')]);_0x545475[_0xfdd4('0x49')]=_[_0xfdd4('0x4a')](_0x4f5ca3[_0xfdd4('0x49')]);_0x545475[_0xfdd4('0x4b')]=_[_0xfdd4('0x4c')](_0x545475[_0xfdd4('0x4e')],_0x545475[_0xfdd4('0x49')]);_0x206a59[_0xfdd4('0x4d')]=_[_0xfdd4('0x4c')](_0x545475[_0xfdd4('0x4e')],qs[_0xfdd4('0x4f')](_0x4f5ca3[_0xfdd4('0x49')][_0xfdd4('0x4f')]));_0x206a59[_0xfdd4('0x4d')]=_0x206a59[_0xfdd4('0x4d')][_0xfdd4('0x50')]?_0x206a59[_0xfdd4('0x4d')]:_0x545475[_0xfdd4('0x4e')];if(_0x4f5ca3[_0xfdd4('0x49')][_0xfdd4('0xb6')]){_0x206a59[_0xfdd4('0xb7')]=[{'all':!![]}];}_0x206a59=_[_0xfdd4('0x3b')]({},_0x206a59,_0x4f5ca3[_0xfdd4('0xb8')]);return db['ChatInteraction'][_0xfdd4('0x67')](_0x206a59)[_0xfdd4('0x20')](handleEntityNotFound(_0x528004,null))[_0xfdd4('0x20')](respondWithResult(_0x528004,null))[_0xfdd4('0x29')](handleError(_0x528004,null));};exports[_0xfdd4('0xb9')]=function(_0x577bef,_0x3616e3){return db[_0xfdd4('0x9f')][_0xfdd4('0xb9')](_0x577bef[_0xfdd4('0x3c')],{})[_0xfdd4('0x20')](respondWithResult(_0x3616e3,0xc9))[_0xfdd4('0x29')](handleError(_0x3616e3,null));};exports['update']=function(_0x186d86,_0x1a9e62){if(_0x186d86[_0xfdd4('0x3c')]['id']){delete _0x186d86[_0xfdd4('0x3c')]['id'];}return db[_0xfdd4('0x9f')][_0xfdd4('0x67')]({'where':{'id':_0x186d86['params']['id']}})[_0xfdd4('0x20')](handleEntityNotFound(_0x1a9e62,null))[_0xfdd4('0x20')](saveUpdates(_0x186d86[_0xfdd4('0x3c')],null))['then'](respondWithResult(_0x1a9e62,null))[_0xfdd4('0x29')](handleError(_0x1a9e62,null));};exports[_0xfdd4('0x36')]=function(_0x4de363,_0x5159a5){return db[_0xfdd4('0x9f')][_0xfdd4('0x67')]({'where':{'id':_0x4de363[_0xfdd4('0xba')]['id']}})[_0xfdd4('0x20')](handleEntityNotFound(_0x5159a5,null))['then'](removeEntity(_0x5159a5,null))[_0xfdd4('0x29')](handleError(_0x5159a5,null));};exports['describe']=function(_0xc9955e,_0x42204a){return db[_0xfdd4('0x9f')][_0xfdd4('0xbb')]()[_0xfdd4('0x20')](respondWithResult(_0x42204a,null))[_0xfdd4('0x29')](handleError(_0x42204a,null));};exports[_0xfdd4('0xbc')]=function(_0x46e3ad,_0x29fcd4){var _0xe32bfc=_0x46e3ad[_0xfdd4('0xba')]['id'];var _0x5015a1;var _0xca4f26;var _0x42a3dc;return db[_0xfdd4('0x9f')][_0xfdd4('0xbd')]({'where':{'id':_0xe32bfc}})[_0xfdd4('0x20')](function(_0x4512b0){_0x5015a1=_0x4512b0;return db['ChatWebsite'][_0xfdd4('0xbd')]({'where':{'id':_0x4512b0[_0xfdd4('0x7d')]},'attributes':['id',_0xfdd4('0xbe'),_0xfdd4('0xbf'),'vidaooTopic',_0xfdd4('0xc0'),_0xfdd4('0xc1')],'raw':!![]});})['then'](function(_0x2d506e){if(_0x2d506e&&_0x2d506e[_0xfdd4('0xbe')]&&_0x2d506e[_0xfdd4('0xbf')]){_0xca4f26=_0x2d506e;var _0x204975={'interaction':{'id':_0xe32bfc},'agent':{'id':_0x46e3ad[_0xfdd4('0x98')]['id'],'name':_0x46e3ad[_0xfdd4('0x98')][_0xfdd4('0x38')],'fullname':_0x46e3ad[_0xfdd4('0x98')][_0xfdd4('0x41')],'email':_0x46e3ad[_0xfdd4('0x98')][_0xfdd4('0xc2')]},'contact':_0x46e3ad[_0xfdd4('0x3c')][_0xfdd4('0xc3')],'account':_0x46e3ad[_0xfdd4('0x3c')]['account']};var _0x42253b={'rejectUnauthorized':![],'method':_0xfdd4('0xc4'),'url':_0xfdd4('0xc5'),'headers':{'X-APIKEY':_0x2d506e[_0xfdd4('0xbe')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x46e3ad['user'][_0xfdd4('0xc2')]],'buttons':null,'topic':_0xca4f26[_0xfdd4('0xc6')],'note':_['isNull'](_0xca4f26[_0xfdd4('0xc0')])?null:getMustacheRender(_0xca4f26[_0xfdd4('0xc0')],_0x204975),'metadata':null},'redirect':_0xfdd4('0xc7'),'json':!![]};try{if(!_[_0xfdd4('0xc8')](_0xca4f26['vidaooMetadata'])){var _0x227fcf=getMustacheRender(_0xca4f26['vidaooMetadata'],_0x204975);var _0x2aa3d3=JSON[_0xfdd4('0x80')](_0x227fcf);_0x42253b['body'][_0xfdd4('0xc9')]=_0x2aa3d3;}}catch(_0x5e058b){throw new db['Sequelize'][(_0xfdd4('0xca'))](_0xfdd4('0xcb'));}return rp(_0x42253b);}else{throw new db[(_0xfdd4('0x90'))][(_0xfdd4('0xca'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x28df36){_0x42a3dc=_0x28df36;if(_0x42a3dc['id']){var _0x1bb704={'body':_0x42a3dc['join_url'],'ChatWebsiteId':_0xca4f26['id'],'ChatInteractionId':_0x5015a1['id'],'direction':'out','UserId':_0x46e3ad[_0xfdd4('0x98')]['id']};return db[_0xfdd4('0xcc')][_0xfdd4('0xb9')](_0x1bb704,{});}else{throw new db['Sequelize'][(_0xfdd4('0xca'))](_0xfdd4('0xcd'));}})[_0xfdd4('0x20')](function(){return _0x5015a1[_0xfdd4('0xce')]({'vidaooSessionId':_0x42a3dc['id']});})['then'](respondWithResult(_0x29fcd4,null))[_0xfdd4('0x29')](handleError(_0x29fcd4,null));};exports[_0xfdd4('0xcf')]=function(_0x23dd10,_0x23746f){if(_0x23dd10[_0xfdd4('0x3c')]['id']){delete _0x23dd10['body']['id'];}return db[_0xfdd4('0x9f')][_0xfdd4('0x67')]({'where':{'id':_0x23dd10['params']['id']},'include':[{'model':db[_0xfdd4('0xd0')],'as':_0xfdd4('0x6d')}]})[_0xfdd4('0x20')](handleEntityNotFound(_0x23746f,null))[_0xfdd4('0x20')](saveUpdates(_0x23dd10[_0xfdd4('0x3c')],null))[_0xfdd4('0x20')](respondWithResult(_0x23746f,null))[_0xfdd4('0x29')](handleError(_0x23746f,null));};exports[_0xfdd4('0xd1')]=function(_0x3b6cfc,_0x20b6b1,_0x308201){if(_0x3b6cfc[_0xfdd4('0x3c')]['id']){delete _0x3b6cfc[_0xfdd4('0x3c')]['id'];}return db[_0xfdd4('0x9f')][_0xfdd4('0x67')]({'where':{'id':_0x3b6cfc['params']['id']}})['then'](function(_0x44b024){if(!_0x44b024){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xfdd4('0xd1'),0x194,_0xfdd4('0xd2'));_0x20b6b1[_0xfdd4('0x2a')](0x194);}else{if(_0x44b024[_0xfdd4('0x79')]){throw new db[(_0xfdd4('0x90'))][(_0xfdd4('0xca'))](_0xfdd4('0xd3'));}}return _0x44b024;})['then'](function(_0x24e4be){if(_0x24e4be){return _0x24e4be[_0xfdd4('0x35')]({'closed':_0x3b6cfc['body']['closed'],'disposition':_0x3b6cfc['body'][_0xfdd4('0xd4')]})['then'](function(_0x28d8d9){return _0x28d8d9;});}})['then'](function(_0x52ff15){return respondWithRpcPromise(_0xfdd4('0xd5'),_0xfdd4('0xd1'),_0x3b6cfc[_0xfdd4('0x3c')],client9004);})[_0xfdd4('0x20')](respondWithResult(_0x20b6b1,null))[_0xfdd4('0x29')](handleError(_0x20b6b1,null));};exports[_0xfdd4('0xd6')]=function(_0x461070,_0x17f504,_0x156173){_0x461070['body'][_0xfdd4('0x38')]=_0x461070[_0xfdd4('0xd7')]['originalname'];_0x461070[_0xfdd4('0x3c')][_0xfdd4('0xd8')]=_0x461070['file']['filename'];_0x461070['body']['type']=_0x461070[_0xfdd4('0xd7')][_0xfdd4('0xd9')];return db['Attachment'][_0xfdd4('0xb9')](_0x461070['body'])[_0xfdd4('0x20')](respondWithResult(_0x17f504,0xc9))[_0xfdd4('0x29')](handleError(_0x17f504,null));};exports[_0xfdd4('0xda')]=function(_0x2093a5,_0x2c36a3,_0x45fa09){return db[_0xfdd4('0x9f')]['findOne']({'where':{'id':_0x2093a5['params']['id']},'raw':!![]})[_0xfdd4('0x20')](handleEntityNotFound(_0x2c36a3,null))[_0xfdd4('0x20')](function(_0x2b65d7){if(_0x2b65d7){if(_0x2b65d7[_0xfdd4('0xdb')]){return _0x2c36a3[_0xfdd4('0x2b')](0x193)['json']({'status':0x193,'message':_0xfdd4('0xdc')});}return db[_0xfdd4('0xdd')][_0xfdd4('0xbd')]({'where':{'id':_0x2093a5['query']['attachId']},'raw':!![]})[_0xfdd4('0x20')](handleEntityNotFound(_0x2c36a3,null));}})[_0xfdd4('0x20')](function(_0x2f6456){if(_0x2f6456){var _0x1ff8d6=_0x2f6456[_0xfdd4('0xde')]!==null;var _0xa64a3b=path['join'](config['root'],_0xfdd4('0xdf'));if(_0x1ff8d6){_0xa64a3b=path[_0xfdd4('0xe0')](_0xa64a3b,_0xfdd4('0xe1'));}var _0x5a4bd4=path[_0xfdd4('0xe0')](_0xa64a3b,_0x2f6456['basename']);return _0x2c36a3[_0xfdd4('0xe2')](_0x5a4bd4);}})['catch'](handleError(_0x2c36a3,null));};exports[_0xfdd4('0xe3')]=function(_0x12beac,_0x5a78bc){var _0x2d1810=null;var _0x308050=null;var _0x1f1ec8=null;var _0x2e3342=null;if(_0x12beac['body']['id']){delete _0x12beac[_0xfdd4('0x3c')]['id'];}if(_0x12beac[_0xfdd4('0x3c')][_0xfdd4('0xe4')]){_0x2e3342=path[_0xfdd4('0xe0')](config[_0xfdd4('0xe5')],_0xfdd4('0xe6'),util['format'](_0xfdd4('0xe7'),Date['now']()));_0x12beac[_0xfdd4('0x3c')][_0xfdd4('0xe8')]=_0x2e3342;}return db[_0xfdd4('0x9f')][_0xfdd4('0x67')]({'where':{'id':_0x12beac[_0xfdd4('0xba')]['id']},'include':[{'model':db[_0xfdd4('0xcc')],'as':_0xfdd4('0xe9'),'include':[{'model':db[_0xfdd4('0x77')],'as':_0xfdd4('0x77')}]}]})[_0xfdd4('0x20')](handleEntityNotFound(_0x5a78bc,null))[_0xfdd4('0x20')](saveUpdates(_0x12beac[_0xfdd4('0x3c')],null))['then'](function(_0x13df51){if(_0x13df51){_0x2d1810=_0x13df51;return db['ChatWebsite'][_0xfdd4('0x67')]({'where':{'id':_0x2d1810['ChatWebsiteId']}});}})['then'](function(_0x17da2a){if(_0x17da2a){_0x1f1ec8=_0x17da2a;return db[_0xfdd4('0xd0')][_0xfdd4('0x67')]({'where':{'id':_0x2d1810[_0xfdd4('0x72')]}});}})[_0xfdd4('0x20')](function(_0x1cf955){if(_0x1cf955){_0x308050=_0x1cf955;if(_0x2e3342){var _0x2d74d1=null;for(var _0x5c70bf=0x1;_0x5c70bf<_0x2d1810[_0xfdd4('0xe9')][_0xfdd4('0x50')];++_0x5c70bf){_0x2d74d1=_0x2d1810[_0xfdd4('0xe9')][_0x5c70bf];var _0x5a7c66=_0x2d74d1[_0xfdd4('0x79')]?util[_0xfdd4('0xea')](_0xfdd4('0xeb'),_0x1f1ec8[_0xfdd4('0xec')],_0x2d74d1[_0xfdd4('0x79')]):_0xfdd4('0xed');var _0x43c681=_0x12beac[_0xfdd4('0x3c')][_0xfdd4('0xee')]||util[_0xfdd4('0xea')](_0xfdd4('0xeb'),'Visitor',_0x2d74d1['ContactId']);switch(_0x1f1ec8[_0xfdd4('0xef')]){case _0xfdd4('0xf0'):_0x5a7c66=_0x2d74d1[_0xfdd4('0x79')]?util[_0xfdd4('0xea')]('%s%d',_0x1f1ec8[_0xfdd4('0xec')],_0x2d74d1['UserId']):_0xfdd4('0xed');break;case _0xfdd4('0xf1'):_0x5a7c66=_0x2d74d1[_0xfdd4('0x79')]?_0x2d74d1['User'][_0xfdd4('0xf2')]||_0x2d74d1[_0xfdd4('0x77')][_0xfdd4('0x41')]:_0xfdd4('0xed');break;case _0xfdd4('0xf3'):_0x5a7c66=_0x2d74d1[_0xfdd4('0x79')]?_0x2d74d1[_0xfdd4('0x77')][_0xfdd4('0x41')]:_0xfdd4('0xed');break;default:_0x5a7c66=_0x2d74d1[_0xfdd4('0x79')]?util[_0xfdd4('0xea')]('%s%d',_0x1f1ec8[_0xfdd4('0xec')],_0x2d74d1[_0xfdd4('0x79')]):'System';}var _0x3621f3=util[_0xfdd4('0xea')](_0xfdd4('0xf4'),moment(_0x2d74d1[_0xfdd4('0xf5')])['format'](_0xfdd4('0xf6')),_0x2d74d1[_0xfdd4('0xf7')]==='in'?_0x43c681:_0x5a7c66,_0x2d74d1[_0xfdd4('0x3c')]);if(!_0x2d74d1[_0xfdd4('0xf8')]){fs[_0xfdd4('0xf9')](_0x2e3342,_0x3621f3);}}return db[_0xfdd4('0xfa')][_0xfdd4('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0xfdd4('0xfb')],'as':'Smtp','raw':!![]}]});}}})[_0xfdd4('0x20')](function(_0x4c248e){if(_0x4c248e&&_0x4c248e[_0xfdd4('0xfc')]&&_0x12beac['body']){var _0x5e8af7={'tls':{'rejectUnauthorized':![]}};if(_0x4c248e[_0xfdd4('0xfc')][_0xfdd4('0xfd')]){_0x5e8af7[_0xfdd4('0xfd')]=_0x4c248e[_0xfdd4('0xfc')][_0xfdd4('0xfd')];}else{_0x5e8af7[_0xfdd4('0xfe')]=_0x4c248e[_0xfdd4('0xfc')]['host'];_0x5e8af7[_0xfdd4('0xff')]=_0x4c248e[_0xfdd4('0xfc')][_0xfdd4('0xff')];_0x5e8af7[_0xfdd4('0x100')]=_0x4c248e[_0xfdd4('0xfc')][_0xfdd4('0x100')];}if(_0x4c248e[_0xfdd4('0xfc')][_0xfdd4('0x101')]){_0x5e8af7['auth']={'user':_0x4c248e[_0xfdd4('0xfc')][_0xfdd4('0x98')],'pass':_0x4c248e[_0xfdd4('0xfc')][_0xfdd4('0x102')]};}return respondWithRpcPromise(_0xfdd4('0x103'),_0xfdd4('0x104'),{'account':_0x5e8af7,'message':{'from':util[_0xfdd4('0xea')]('\x22%s\x22\x20<%s>',_0x4c248e['name'],_0x4c248e[_0xfdd4('0xc2')]||_0x4c248e[_0xfdd4('0xfc')][_0xfdd4('0x98')]),'to':_0x12beac[_0xfdd4('0x3c')][_0xfdd4('0xe4')],'subject':_0xfdd4('0x105'),'text':util[_0xfdd4('0xea')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x12beac[_0xfdd4('0x3c')][_0xfdd4('0xe4')]),'attachments':[{'path':_0x2e3342}]}})['then'](function(){return _0x2d1810;})['catch'](function(_0x1336e1){console[_0xfdd4('0x26')](_0x1336e1);});}else{return _0x2d1810;}})[_0xfdd4('0x20')](respondWithStatusCode(_0x5a78bc,0xc8))[_0xfdd4('0x29')](handleError(_0x5a78bc,null));};exports[_0xfdd4('0x106')]=function(_0x25656c,_0x5f51e6,_0x4fbd83){return db[_0xfdd4('0xcc')][_0xfdd4('0x67')]({'where':{'id':_0x25656c['params']['id']}})[_0xfdd4('0x20')](handleEntityNotFound(_0x5f51e6,null))['then'](function(_0x13cf75){if(_0x13cf75){return _0x13cf75[_0xfdd4('0x106')](_0x25656c[_0xfdd4('0x3c')][_0xfdd4('0x107')],_[_0xfdd4('0x108')](_0x25656c['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5f51e6,null))[_0xfdd4('0x29')](handleError(_0x5f51e6,null));};exports['getMessages']=function(_0x106064,_0x536c4b,_0x7101d2){var _0x317d77={'raw':![],'where':{}};var _0x599d63={};var _0x529474={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xfdd4('0xbd')]({'where':{'id':_0x106064[_0xfdd4('0xba')]['id']}})[_0xfdd4('0x20')](handleEntityNotFound(_0x536c4b,null))[_0xfdd4('0x20')](function(_0x4c33bc){if(_0x4c33bc){_0x599d63['model']=_[_0xfdd4('0x4a')](db[_0xfdd4('0xcc')][_0xfdd4('0x47')]);_0x599d63[_0xfdd4('0x49')]=_[_0xfdd4('0x4a')](_0x106064[_0xfdd4('0x49')]);_0x599d63['filters']=_[_0xfdd4('0x4c')](_0x599d63[_0xfdd4('0x4e')],_0x599d63['query']);_0x317d77[_0xfdd4('0x4d')]=_['intersection'](_0x599d63[_0xfdd4('0x4e')],qs[_0xfdd4('0x4f')](_0x106064[_0xfdd4('0x49')][_0xfdd4('0x4f')]));_0x317d77[_0xfdd4('0x4d')]=_0x317d77[_0xfdd4('0x4d')][_0xfdd4('0x50')]?_0x317d77[_0xfdd4('0x4d')]:_0x599d63['model'];if(!_0x106064[_0xfdd4('0x49')][_0xfdd4('0x51')](_0xfdd4('0x109'))){_0x317d77[_0xfdd4('0x2f')]=qs['limit'](_0x106064[_0xfdd4('0x49')]['limit']);_0x317d77[_0xfdd4('0x31')]=qs[_0xfdd4('0x31')](_0x106064[_0xfdd4('0x49')]['offset']);}_0x317d77['order']=qs[_0xfdd4('0x10a')](_0x106064[_0xfdd4('0x49')]['sort']);_0x317d77[_0xfdd4('0x7e')]=qs['filters'](_['pick'](_0x106064[_0xfdd4('0x49')],_0x599d63[_0xfdd4('0x4b')]));_0x317d77[_0xfdd4('0x7e')][_0xfdd4('0x10b')]=_0x4c33bc['id'];if(_0x106064['query']['filter']){_0x317d77[_0xfdd4('0x7e')]=_[_0xfdd4('0x3b')](_0x317d77[_0xfdd4('0x7e')],{'$or':_['map'](_0x317d77[_0xfdd4('0x4d')],function(_0x2b1f92){var _0x57c9bb={};_0x57c9bb[_0x2b1f92]={'$like':'%'+_0x106064[_0xfdd4('0x49')]['filter']+'%'};return _0x57c9bb;})});}if(_0x106064[_0xfdd4('0x49')][_0xfdd4('0x10c')]){var _0x4b97fa=_0x106064['query']['$gte']['split'](',');var _0x54fec8={};_0x54fec8[_0x4b97fa[0x0]]={'$gte':moment(_0x4b97fa[0x1])[_0xfdd4('0xea')]('YYYY-MM-DD\x20HH:mm:ss')};_0x317d77[_0xfdd4('0x7e')]=_[_0xfdd4('0x3b')](_0x317d77[_0xfdd4('0x7e')],_0x54fec8);}_0x317d77=_[_0xfdd4('0x3b')]({},_0x317d77,_0x106064[_0xfdd4('0xb8')]);return db['ChatMessage']['count']({'where':_0x317d77[_0xfdd4('0x7e')]})[_0xfdd4('0x20')](function(_0x22c2b9){_0x529474[_0xfdd4('0x30')]=_0x22c2b9;if(_0x106064[_0xfdd4('0x49')][_0xfdd4('0xb6')]){_0x317d77[_0xfdd4('0xb7')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x317d77);})[_0xfdd4('0x20')](function(_0xa129e4){_0x529474[_0xfdd4('0xb5')]=_0xa129e4;return _0x529474;});}})[_0xfdd4('0x20')](respondWithFilteredResult(_0x536c4b,_0x317d77))[_0xfdd4('0x29')](handleError(_0x536c4b,null));};exports[_0xfdd4('0x10d')]=function(_0x18ad0c,_0x5ba916,_0x2d3c9f){var _0x5de8d0={'where':{}},_0x4f2eea={},_0x3341ae={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xfdd4('0xbd')]({'where':{'id':_0x18ad0c[_0xfdd4('0xba')]['id']}})['then'](handleEntityNotFound(_0x5ba916,null))[_0xfdd4('0x20')](function(_0x20c9f6){if(_0x20c9f6){_0x4f2eea[_0xfdd4('0x4e')]=_[_0xfdd4('0x4a')](db[_0xfdd4('0xcc')]['rawAttributes']);_0x4f2eea[_0xfdd4('0x49')]=_[_0xfdd4('0x4a')](_0x18ad0c[_0xfdd4('0x49')]);_0x4f2eea['filters']=_[_0xfdd4('0x4c')](_0x4f2eea[_0xfdd4('0x4e')],_0x4f2eea['query']);_0x5de8d0[_0xfdd4('0x4d')]=_[_0xfdd4('0x4c')](_0x4f2eea[_0xfdd4('0x4e')],qs[_0xfdd4('0x4f')](_0x18ad0c['query']['fields']));_0x5de8d0[_0xfdd4('0x4d')]=_0x5de8d0['attributes'][_0xfdd4('0x50')]?_0x5de8d0[_0xfdd4('0x4d')]:_0x4f2eea[_0xfdd4('0x4e')];if(!_0x18ad0c[_0xfdd4('0x49')][_0xfdd4('0x51')]('nolimit')){_0x5de8d0[_0xfdd4('0x2f')]=qs[_0xfdd4('0x2f')](_0x18ad0c['query'][_0xfdd4('0x2f')]);_0x5de8d0[_0xfdd4('0x31')]=qs[_0xfdd4('0x31')](_0x18ad0c['query'][_0xfdd4('0x31')]);}_0x5de8d0['order']=qs[_0xfdd4('0x10a')](_0x18ad0c['query']['sort']);_0x5de8d0[_0xfdd4('0x7e')]=qs[_0xfdd4('0x4b')](_[_0xfdd4('0x52')](_0x18ad0c[_0xfdd4('0x49')],_0x4f2eea[_0xfdd4('0x4b')]));_0x5de8d0[_0xfdd4('0x7e')]['ChatInteractionId']=_0x20c9f6['id'];if(_0x18ad0c[_0xfdd4('0x49')][_0xfdd4('0x10e')]){_0x5de8d0[_0xfdd4('0x7e')]=_['merge'](_0x5de8d0['where'],{'$or':_[_0xfdd4('0x40')](_0x5de8d0['attributes'],function(_0xa03de8){var _0x141042={};_0x141042[_0xa03de8]={'$like':'%'+_0x18ad0c[_0xfdd4('0x49')]['filter']+'%'};return _0x141042;})});}_0x5de8d0['where'][_0xfdd4('0xf8')]=![];if(_0x18ad0c[_0xfdd4('0x49')]['id']){_0x5de8d0[_0xfdd4('0x7e')]['id']={'$gt':_0x18ad0c[_0xfdd4('0x49')]['id']};}_0x5de8d0=_[_0xfdd4('0x3b')]({},_0x5de8d0,_0x18ad0c[_0xfdd4('0xb8')]);return db[_0xfdd4('0xcc')][_0xfdd4('0x30')]({'where':_0x5de8d0[_0xfdd4('0x7e')]})[_0xfdd4('0x20')](function(_0x21e917){_0x3341ae['count']=_0x21e917;_0x5de8d0[_0xfdd4('0xb7')]=[];if(_0x18ad0c[_0xfdd4('0x49')]['includeAgent']){_0x5de8d0[_0xfdd4('0xb7')][_0xfdd4('0x46')]({'model':db[_0xfdd4('0x77')],'as':_0xfdd4('0x77'),'attributes':['id',_0xfdd4('0x41'),_0xfdd4('0xf2')]});}if(_0x18ad0c[_0xfdd4('0x49')][_0xfdd4('0xb6')]){_0x5de8d0[_0xfdd4('0xb7')]=[{'all':!![]}];}return db[_0xfdd4('0xcc')][_0xfdd4('0x10f')](_0x5de8d0);})[_0xfdd4('0x20')](function(_0x1c18f8){_0x3341ae['rows']=_0x1c18f8;return _0x3341ae;});}})[_0xfdd4('0x20')](respondWithFilteredResult(_0x5ba916,_0x5de8d0))[_0xfdd4('0x29')](handleError(_0x5ba916,null));};exports['addTags']=function(_0x31db99,_0x692aa1,_0x1003d4){return db['ChatInteraction'][_0xfdd4('0x67')]({'where':{'id':_0x31db99[_0xfdd4('0xba')]['id']}})[_0xfdd4('0x20')](handleEntityNotFound(_0x692aa1,null))['then'](function(_0x5b5edb){if(_0x5b5edb){return _0x5b5edb[_0xfdd4('0x110')](_0x31db99[_0xfdd4('0x3c')][_0xfdd4('0x107')],_[_0xfdd4('0x108')](_0x31db99[_0xfdd4('0x3c')],[_0xfdd4('0x107'),'id'])||{})[_0xfdd4('0x111')](function(){return db[_0xfdd4('0x75')][_0xfdd4('0x10f')]({'attributes':['id',_0xfdd4('0x38'),'color'],'where':{'id':_0x31db99['body']['ids']}});})[_0xfdd4('0x20')](function(_0x1a8c71){socket[_0xfdd4('0x112')](_0xfdd4('0x113'),{'id':Number(_0x31db99[_0xfdd4('0xba')]['id']),'tags':_0x1a8c71||[]});return{'id':Number(_0x31db99[_0xfdd4('0xba')]['id']),'tags':_0x1a8c71||[]};});}})[_0xfdd4('0x20')](respondWithResult(_0x692aa1,null))['catch'](handleError(_0x692aa1,null));};exports[_0xfdd4('0x114')]=function(_0x456534,_0x1178b3,_0x272948){return db[_0xfdd4('0x9f')]['find']({'where':{'id':_0x456534[_0xfdd4('0xba')]['id']}})['then'](handleEntityNotFound(_0x1178b3,null))['then'](function(_0x360298){if(_0x360298){return _0x360298['removeTags'](_0x456534['query'][_0xfdd4('0x107')]);}})['then'](respondWithStatusCode(_0x1178b3,null))[_0xfdd4('0x29')](handleError(_0x1178b3,null));};exports[_0xfdd4('0xe2')]=function(_0x39f38f,_0x4a9e25){var _0x535d2b=moment()[_0xfdd4('0x115')]()[_0xfdd4('0x9d')]();var _0x24b726=path[_0xfdd4('0xe0')](config[_0xfdd4('0xe5')],'server','files',_0xfdd4('0x116'));var _0x260fe6=path[_0xfdd4('0xe0')](config[_0xfdd4('0xe5')],_0xfdd4('0x117'),_0xfdd4('0x118'),_0xfdd4('0x119'));var _0x4d52d3=path['join'](_0x24b726,_0x535d2b);var _0x31124f=util['format'](_0xfdd4('0x11a'),_0x39f38f['params']['id'],_0x535d2b);var _0x38e24c=path[_0xfdd4('0xe0')](_0x24b726,_0x31124f);var _0x25f9c9=[];_0x25f9c9[_0xfdd4('0x46')]({'model':db['User'],'as':_0xfdd4('0x77'),'attributes':['id',_0xfdd4('0x41')],'raw':!![]});_0x25f9c9['push']({'model':db[_0xfdd4('0xd0')],'as':'Contact','attributes':['id','firstName',_0xfdd4('0x11b')],'raw':!![]});if(_0x39f38f['query'][_0xfdd4('0x119')]){_0x25f9c9[_0xfdd4('0x46')]({'model':db[_0xfdd4('0xdd')],'as':_0xfdd4('0xdd'),'raw':!![]});}var _0x1a5c91=[{'model':db[_0xfdd4('0xcc')],'as':_0xfdd4('0xe9'),'attributes':['id','body',_0xfdd4('0xf5'),_0xfdd4('0xf7'),'secret','read'],'include':_0x25f9c9}];_0x1a5c91[_0xfdd4('0x46')]({'model':db[_0xfdd4('0x11c')],'as':_0xfdd4('0x11d'),'attributes':['id','name']});_0x1a5c91[_0xfdd4('0x46')]({'model':db[_0xfdd4('0x77')],'as':'Owner','attributes':['id','fullname']});return db[_0xfdd4('0x9f')]['find']({'where':{'id':_0x39f38f['params']['id']},'include':_0x1a5c91})[_0xfdd4('0x20')](handleEntityNotFound(_0x4a9e25,null))[_0xfdd4('0x20')](function(_0xbde236){if(_0xbde236){var _0x2de8b3=_0xbde236[_0xfdd4('0x11e')]({'plain':!![]});fs[_0xfdd4('0x11f')](_0x4d52d3);var _0x1563a5={'channel':_0xfdd4('0x120'),'account':_0x2de8b3[_0xfdd4('0x11d')][_0xfdd4('0x38')],'agent':_0x2de8b3[_0xfdd4('0x121')]?_0x2de8b3[_0xfdd4('0x121')]['fullname']:_0xfdd4('0x122'),'createdAt':moment(_0x2de8b3[_0xfdd4('0xf5')])[_0xfdd4('0xea')](_0xfdd4('0x123'))[_0xfdd4('0x9d')](),'closedAt':_0x2de8b3['closed']?moment(_0x2de8b3[_0xfdd4('0x124')])[_0xfdd4('0xea')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfdd4('0x9d')]():'','disposition':_0x2de8b3['disposition'],'chatInfo':{'browser':_0x2de8b3[_0xfdd4('0x125')],'os':_0x2de8b3[_0xfdd4('0x126')],'referer':_0x2de8b3[_0xfdd4('0x127')],'customerIp':_0x2de8b3['customerIp'],'customerPort':_0x2de8b3[_0xfdd4('0x128')]?_0x2de8b3[_0xfdd4('0x128')]:_0xfdd4('0x122')},'messages':_(_0x2de8b3[_0xfdd4('0xe9')])['tail']()[_0xfdd4('0x10e')]({'secret':![]})[_0xfdd4('0x40')](function(_0x46e0e2){if(_0x46e0e2['Attachment']){var _0x306fc1=path[_0xfdd4('0xe0')](_0x260fe6,_0x46e0e2['Attachment'][_0xfdd4('0xd8')]);if(fs[_0xfdd4('0x129')](_0x306fc1)){fs[_0xfdd4('0x12a')](_0x306fc1)[_0xfdd4('0x12b')](fs[_0xfdd4('0x12c')](path['join'](_0x4d52d3,_0x46e0e2[_0xfdd4('0xdd')][_0xfdd4('0xd8')])));}}return{'date':moment(_0x46e0e2['createdAt'])[_0xfdd4('0xea')](_0xfdd4('0x123'))[_0xfdd4('0x9d')](),'sender':_0x46e0e2[_0xfdd4('0xf7')]===_0xfdd4('0x12d')?_0x46e0e2[_0xfdd4('0x77')]?_0x46e0e2[_0xfdd4('0x77')][_0xfdd4('0x41')]:'System':_0x46e0e2['Contact'][_0xfdd4('0x12e')]+(_0x46e0e2['Contact']['lastName']?'\x20'+_0x46e0e2[_0xfdd4('0x6d')]['lastName']:''),'body':_0x46e0e2[_0xfdd4('0xdd')]?_0x46e0e2[_0xfdd4('0xdd')]['basename']:_0x46e0e2[_0xfdd4('0x3c')],'direction':_0x46e0e2[_0xfdd4('0xf7')]===_0xfdd4('0x12d')?'A':'C','secret':_0x46e0e2[_0xfdd4('0xf8')],'read':_0x46e0e2[_0xfdd4('0x85')],'attachment':_0x46e0e2['Attachment']};})[_0xfdd4('0x69')]()};return ejs[_0xfdd4('0x12f')](path[_0xfdd4('0xe0')](config[_0xfdd4('0xe5')],_0xfdd4('0x117'),_0xfdd4('0x130'),_0xfdd4('0x131')),{'interaction':_0x1563a5})[_0xfdd4('0x20')](function(_0x5ac931){var _0x2b8e2b=path['join'](_0x4d52d3,_0xfdd4('0x132')+_0x2de8b3['id']+'-'+_0x535d2b+_0xfdd4('0x133'));var _0x4d5a93={'path':_0x2b8e2b,'channel':'Chat','interactionId':_0x2de8b3['id']};return pdf['createPdfFromHTML'](_0x5ac931,_0x4d5a93);})[_0xfdd4('0x20')](function(){return new BPromise(function(_0x4a323c,_0x384933){zipdir(_0x4d52d3,{'saveTo':_0x38e24c},function(_0x13a826,_0x4ce772){if(_0x13a826)return _0x384933(_0x13a826);return _0x4a323c(_0x4ce772);});})['then'](function(){return new BPromise(function(_0x199881,_0x1fa795){rimraf(_0x4d52d3,function(_0x453527){if(_0x453527)_0x1fa795(_0x453527);return _0x199881();});});})[_0xfdd4('0x20')](function(){return _0x4a9e25[_0xfdd4('0xe2')](_0x38e24c,_0x31124f,function(_0x4fa06b){if(_0x4fa06b){console['log'](_0xfdd4('0x134'),_0x4fa06b);}else{fs['unlinkSync'](_0x38e24c);}});});});}else{return _0x4a9e25[_0xfdd4('0x2a')](0xc8);}})[_0xfdd4('0x29')](handleError(_0x4a9e25,null));}; \ No newline at end of file +var _0xd943=['Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','mkdirSync','Chat','disposition','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','server','views','downloadInteraction.ejs','transcript-','log','err','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','Content-Range','reject','save','update','destroy','stack','name','send','render','body','contact','agent','account','map','fullname','TagIds','Tags','split','forEach','index','ChatInteraction','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','field','from','tools_tags','select','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','`\x20=\x200','having','Contact','operator','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','count','sequelize','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','params','rawAttributes','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','json','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','Messages','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','authentication','auth','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript'];(function(_0x59b058,_0x5f4c38){var _0x5cb986=function(_0x54ee4c){while(--_0x54ee4c){_0x59b058['push'](_0x59b058['shift']());}};_0x5cb986(++_0x5f4c38);}(_0xd943,0x15d));var _0x3d94=function(_0x2c98ed,_0x42db72){_0x2c98ed=_0x2c98ed-0x0;var _0x4b5cf7=_0xd943[_0x2c98ed];return _0x4b5cf7;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x3d94('0x10'));var hardwareService=require(_0x3d94('0x11'));var logger=require('../../config/logger')(_0x3d94('0x12'));var utils=require(_0x3d94('0x13'));var config=require(_0x3d94('0x14'));var licenseUtil=require(_0x3d94('0x15'));var db=require(_0x3d94('0x16'))['db'];config['redis']=_[_0x3d94('0x17')](config[_0x3d94('0x18')],{'host':_0x3d94('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d94('0x18')]));require(_0x3d94('0x1a'))[_0x3d94('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x1c')][_0x3d94('0x1d')]({'port':0x232b});var client9004=jayson[_0x3d94('0x1c')][_0x3d94('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xaf939a,_0xd8efaa,_0x31c6e8,_0x9893cb){return new BPromise(function(_0x540658,_0x22676a){var _0x1a9315=_0x9893cb||client;return _0x1a9315[_0x3d94('0x1e')](_0xaf939a,_0x31c6e8)[_0x3d94('0x1f')](function(_0x4afc92){logger[_0x3d94('0x20')](_0x3d94('0x21'),_0xd8efaa,'request\x20sent');logger[_0x3d94('0x22')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xd8efaa,_0x3d94('0x23'),JSON[_0x3d94('0x24')](_0x4afc92));if(_0x4afc92[_0x3d94('0x25')]){if(_0x4afc92[_0x3d94('0x25')][_0x3d94('0x26')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xd8efaa,_0x4afc92[_0x3d94('0x25')][_0x3d94('0x27')]);return _0x22676a(_0x4afc92[_0x3d94('0x25')]['message']);}logger[_0x3d94('0x25')](_0x3d94('0x21'),_0xd8efaa,_0x4afc92[_0x3d94('0x25')][_0x3d94('0x27')]);return _0x540658(_0x4afc92[_0x3d94('0x25')][_0x3d94('0x27')]);}else{logger[_0x3d94('0x20')](_0x3d94('0x21'),_0xd8efaa,_0x3d94('0x23'));_0x540658(_0x4afc92[_0x3d94('0x28')][_0x3d94('0x27')]);}})[_0x3d94('0x29')](function(_0x292976){logger[_0x3d94('0x25')](_0x3d94('0x21'),_0xd8efaa,_0x292976);_0x22676a(_0x292976);});});}function respondWithStatusCode(_0x5b3b31,_0x123183){_0x123183=_0x123183||0xcc;return function(_0x558fd2){if(_0x558fd2){return _0x5b3b31[_0x3d94('0x2a')](_0x123183);}return _0x5b3b31[_0x3d94('0x2b')](_0x123183)[_0x3d94('0x2c')]();};}function respondWithResult(_0x439173,_0x13254f){_0x13254f=_0x13254f||0xc8;return function(_0x82b568){if(_0x82b568){return _0x439173[_0x3d94('0x2b')](_0x13254f)['json'](_0x82b568);}};}function respondWithFilteredResult(_0x584c4a,_0x362642){return function(_0x4813e1){if(_0x4813e1){var _0x4dd410=typeof _0x362642[_0x3d94('0x2d')]==='undefined'&&typeof _0x362642[_0x3d94('0x2e')]===_0x3d94('0x2f');var _0x32403a=_0x4813e1['count'];var _0x2a07b4=_0x4dd410?0x0:_0x362642['offset'];var _0x3d4994=_0x4dd410?_0x4813e1['count']:_0x362642[_0x3d94('0x2d')]+_0x362642[_0x3d94('0x2e')];var _0x29b1ff;if(_0x3d4994>=_0x32403a){_0x3d4994=_0x32403a;_0x29b1ff=0xc8;}else{_0x29b1ff=0xce;}_0x584c4a[_0x3d94('0x2b')](_0x29b1ff);return _0x584c4a['set'](_0x3d94('0x30'),_0x2a07b4+'-'+_0x3d4994+'/'+_0x32403a)['json'](_0x4813e1);}return null;};}function patchUpdates(_0x1f9559){return function(_0xd294fd){try{jsonpatch['apply'](_0xd294fd,_0x1f9559,!![]);}catch(_0x5288da){return BPromise[_0x3d94('0x31')](_0x5288da);}return _0xd294fd[_0x3d94('0x32')]();};}function saveUpdates(_0x273337,_0x5cdb2e){return function(_0x1e6dbc){if(_0x1e6dbc){return _0x1e6dbc[_0x3d94('0x33')](_0x273337)['then'](function(_0x242500){return _0x242500;});}return null;};}function removeEntity(_0x23f3fe,_0x35947b){return function(_0xbda334){if(_0xbda334){return _0xbda334[_0x3d94('0x34')]()['then'](function(){_0x23f3fe[_0x3d94('0x2b')](0xcc)[_0x3d94('0x2c')]();});}};}function handleEntityNotFound(_0x41579e,_0x52bdb9){return function(_0xb493f1){if(!_0xb493f1){_0x41579e[_0x3d94('0x2a')](0x194);}return _0xb493f1;};}function handleError(_0x546658,_0x555ec5){_0x555ec5=_0x555ec5||0x1f4;return function(_0xfe58eb){logger[_0x3d94('0x25')](_0xfe58eb[_0x3d94('0x35')]);if(_0xfe58eb[_0x3d94('0x36')]){delete _0xfe58eb[_0x3d94('0x36')];}_0x546658[_0x3d94('0x2b')](_0x555ec5)[_0x3d94('0x37')](_0xfe58eb);};}function getMustacheRender(_0x12c01a,_0x2e7b97){return Mustache[_0x3d94('0x38')](_0x12c01a,_['merge'](_0x2e7b97[_0x3d94('0x39')],{'contact':_0x2e7b97[_0x3d94('0x3a')],'message':_0x2e7b97[_0x3d94('0x27')],'agent':_0x2e7b97[_0x3d94('0x3b')],'interaction':_0x2e7b97['interaction'],'account':_0x2e7b97[_0x3d94('0x3c')]}))||'';}function getInteractionUsers(_0x2bf3b2,_0x35e0e6){return new BPromise(function(_0x29eaa4,_0x22b7d2){try{if(_0x35e0e6[_0x2bf3b2['id']]){_0x2bf3b2['Users']=_[_0x3d94('0x3d')](_0x35e0e6[_0x2bf3b2['id']],function(_0x462ab6){return{'id':_0x462ab6['id'],'fullname':_0x462ab6[_0x3d94('0x3e')]};});}}catch(_0x485066){_0x22b7d2(_0x485066);}_0x29eaa4(_0x2bf3b2);});}function getInteractionTags(_0x4eee4d,_0x4d8a8f){return new BPromise(function(_0x47905e,_0x3b3550){try{if(_0x4eee4d[_0x3d94('0x3f')]){_0x4eee4d[_0x3d94('0x40')]=[];_0x4eee4d[_0x3d94('0x3f')][_0x3d94('0x41')](',')[_0x3d94('0x42')](function(_0x3a3898){_0x4eee4d['Tags']['push'](_0x4d8a8f[_0x3a3898]);});}delete _0x4eee4d[_0x3d94('0x3f')];}catch(_0x3ced26){_0x3b3550(_0x3ced26);}_0x47905e(_0x4eee4d);});}function updateChatInteraction(_0x512cef,_0x2d0aa2,_0x4af4b6){return new BPromise(function(_0x1361fb,_0x411b5b){return getInteractionUsers(_0x512cef,_0x4af4b6)[_0x3d94('0x1f')](function(_0xacfc44){return getInteractionTags(_0xacfc44,_0x2d0aa2);})[_0x3d94('0x1f')](function(_0x5a9263){_0x1361fb(_0x5a9263);})[_0x3d94('0x29')](function(_0x168771){_0x411b5b(_0x168771);});});}exports[_0x3d94('0x43')]=function(_0x5d5c66,_0x2910ea){var _0x555366={},_0x4bad90={},_0x3f4b32={'count':0x0,'rows':[]};var _0x402132=_[_0x3d94('0x3d')](db[_0x3d94('0x44')]['rawAttributes'],function(_0x323d58){return{'name':_0x323d58['fieldName'],'type':_0x323d58[_0x3d94('0x45')][_0x3d94('0x46')]};});_0x4bad90[_0x3d94('0x47')]=_[_0x3d94('0x3d')](_0x402132,_0x3d94('0x36'));_0x4bad90[_0x3d94('0x48')]=_[_0x3d94('0x49')](_0x5d5c66['query']);_0x4bad90[_0x3d94('0x4a')]=_[_0x3d94('0x4b')](_0x4bad90['model'],_0x4bad90['query']);_0x555366[_0x3d94('0x4c')]=_[_0x3d94('0x4b')](_0x4bad90['model'],qs[_0x3d94('0x4d')](_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x4d')]));_0x555366[_0x3d94('0x4c')]=_0x555366[_0x3d94('0x4c')][_0x3d94('0x4e')]?_0x555366[_0x3d94('0x4c')]:_0x4bad90[_0x3d94('0x47')];if(!_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x4f')](_0x3d94('0x50'))){_0x555366[_0x3d94('0x2e')]=qs[_0x3d94('0x2e')](_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x2e')]);_0x555366['offset']=qs[_0x3d94('0x2d')](_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x2d')]);}_0x555366[_0x3d94('0x51')]=qs[_0x3d94('0x52')](_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x52')]);_0x555366[_0x3d94('0x53')]=qs[_0x3d94('0x4a')](_['pick'](_0x5d5c66[_0x3d94('0x48')],_0x4bad90['filters']),_0x402132);var _0x174eb3=[];var _0x3a7eb0=squel['select']()[_0x3d94('0x54')]('id')['field']('name')[_0x3d94('0x54')]('color')[_0x3d94('0x55')](_0x3d94('0x56'));var _0x5b6061=squel[_0x3d94('0x57')]()['field']('u.id')[_0x3d94('0x54')](_0x3d94('0x58'))[_0x3d94('0x54')](_0x3d94('0x59'))[_0x3d94('0x55')](_0x3d94('0x5a'),'ui')[_0x3d94('0x5b')](_0x3d94('0x5c'),'u',_0x3d94('0x5d'));var _0x584e1d=squel[_0x3d94('0x57')]()[_0x3d94('0x55')](_0x3d94('0x5e'),'i')[_0x3d94('0x5b')](_0x3d94('0x5f'),'c',_0x3d94('0x60'))[_0x3d94('0x5b')](_0x3d94('0x5c'),'o',_0x3d94('0x61'))[_0x3d94('0x5b')](_0x3d94('0x62'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x3d94('0x5b')]('chat_messages','me',_0x3d94('0x63'))[_0x3d94('0x5b')](_0x3d94('0x64'),'it',_0x3d94('0x65'))[_0x3d94('0x5b')](_0x3d94('0x56'),'t',_0x3d94('0x66'));var _0x169aa1=squel[_0x3d94('0x67')]();var _0x5da38c=[];var _0x519ada=squel[_0x3d94('0x67')]();var _0x4bd97c;if(_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x68')]){_0x4bd97c=as['parseSearch'](_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x68')]);var _0x3cb8f4=_0x4bd97c[_0x3d94('0x69')];for(var _0xcefff5=0x0;_0xcefff5<_0x4bd97c[_0x3d94('0x6a')][_0x3d94('0x4e')];_0xcefff5++){var _0x4b023e=_0x4bd97c[_0x3d94('0x6a')][_0xcefff5];var _0x351ea6='i';var _0x368581=_['find'](_0x402132,[_0x3d94('0x36'),_0x4b023e[_0x3d94('0x54')]]);if(!_0x368581){switch(_0x4b023e[_0x3d94('0x54')]){case _0x3d94('0x6b'):if(_0x4b023e['value']==0x1){_0x584e1d['having']('`'+_0x4b023e[_0x3d94('0x54')]+_0x3d94('0x6c'));}else{_0x584e1d[_0x3d94('0x6d')]('`'+_0x4b023e[_0x3d94('0x54')]+'`\x20>\x200');}break;case _0x3d94('0x6e'):if(_0x4b023e[_0x3d94('0x6f')]==='$substring'){if(_0x4b023e[_0x3d94('0x70')][_0x3d94('0x41')]('\x20')[_0x3d94('0x4e')]>0x1){_0x169aa1[_0x3cb8f4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3d94('0x71')](_0x4b023e[_0x3d94('0x70')]),null);}else{var _0x585531='%'+_0x4b023e['value']+'%';_0x169aa1[_0x3cb8f4](_0x3d94('0x72'),_0x585531,_0x585531,_0x585531);}}else{_0x368581=_[_0x3d94('0x73')](_0x402132,['name','ContactId']);_0x4b023e['field']=_0x3d94('0x74');_0x55084e=as[_0x3d94('0x75')](_0x351ea6,_0x368581[_0x3d94('0x45')],_0x4b023e);_0x169aa1[_0x3cb8f4](_0x55084e[_0x3d94('0x76')],_0x55084e[_0x3d94('0x70')]['start'],_0x55084e[_0x3d94('0x70')][_0x3d94('0x2c')]);}break;case _0x3d94('0x77'):var _0x1e8e3d=_0x4b023e[_0x3d94('0x70')][_0x3d94('0x41')](',')['map'](function(_0x30673a){return Number(_0x30673a);});_0x1e8e3d['forEach'](function(_0x1f3551){_0x519ada['or'](_0x3d94('0x78'),'%,'+_0x1f3551+',%');});_0x5da38c=_[_0x3d94('0x79')](_0x5da38c,_0x1e8e3d);break;case _0x3d94('0x7a'):if(_0x4b023e[_0x3d94('0x6f')]===_0x3d94('0x7b')){_0x169aa1[_0x3cb8f4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4b023e['value']+'%',null);}else{_0x368581=_[_0x3d94('0x73')](_0x402132,['name','UserId']);_0x4b023e['field']=_0x3d94('0x7c');_0x55084e=as[_0x3d94('0x75')](_0x351ea6,_0x368581[_0x3d94('0x45')],_0x4b023e);_0x169aa1[_0x3cb8f4](_0x55084e[_0x3d94('0x76')],_0x55084e[_0x3d94('0x70')][_0x3d94('0x7d')],_0x55084e[_0x3d94('0x70')][_0x3d94('0x2c')]);}break;case'body':_0x55084e=as[_0x3d94('0x75')]('me',null,_0x4b023e);_0x169aa1[_0x3cb8f4](_0x55084e['text'],_0x55084e[_0x3d94('0x70')][_0x3d94('0x7d')],_0x55084e[_0x3d94('0x70')]['end']);break;}}else{var _0x55084e=as['buildExpression'](_0x351ea6,_0x368581[_0x3d94('0x45')],_0x4b023e);_0x169aa1[_0x3cb8f4](_0x55084e[_0x3d94('0x76')],_0x55084e[_0x3d94('0x70')][_0x3d94('0x7d')],_0x55084e[_0x3d94('0x70')]['end']);}}}else{var _0x5b7316=_(_0x5d5c66[_0x3d94('0x48')])[_0x3d94('0x49')]()[_0x3d94('0x3d')](function(_0x57a4df){return _[_0x3d94('0x7e')](_0x402132,['name',_0x57a4df])?_0x57a4df:undefined;})[_0x3d94('0x7f')]()[_0x3d94('0x70')]();if(!_[_0x3d94('0x80')](_0x5b7316)){_0x5b7316[_0x3d94('0x42')](function(_0x3b42c8){if(_0x3b42c8===_0x3d94('0x81')){_0x584e1d[_0x3d94('0x53')](_0x3d94('0x82'),[][_0x3d94('0x83')](_0x5d5c66[_0x3d94('0x48')][_0x3b42c8]));}else if(_0x3b42c8===_0x3d94('0x84')){var _0xe6cfd1=JSON[_0x3d94('0x85')](_0x5d5c66['query'][_0x3b42c8])[_0x3d94('0x86')];var _0x2819e2=JSON[_0x3d94('0x85')](_0x5d5c66[_0x3d94('0x48')][_0x3b42c8])['$lte'];_0x584e1d[_0x3d94('0x53')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xe6cfd1,_0x2819e2);}else{if(_0x5d5c66['query'][_0x3b42c8]===_0x3d94('0x87')){_0x584e1d['where']('i.'+_0x3b42c8+_0x3d94('0x88'));}else{_0x584e1d[_0x3d94('0x53')]('i.'+_0x3b42c8+'\x20=\x20?',_0x5d5c66[_0x3d94('0x48')][_0x3b42c8]);}}});}if(_0x5d5c66['query'][_0x3d94('0x89')]){if(_0x5d5c66[_0x3d94('0x48')]['read']==0x1){_0x584e1d['having']('`unreadMessages`\x20=\x200');}else{_0x584e1d[_0x3d94('0x6d')]('`unreadMessages`\x20>\x200');}}if(_0x5d5c66['query'][_0x3d94('0x8a')]){_0x5da38c=_[_0x3d94('0x8b')](_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x8a')])?_0x5d5c66['query'][_0x3d94('0x8a')]:new Array(_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x8a')]);_0x5da38c[_0x3d94('0x42')](function(_0x38b411){_0x519ada['or'](_0x3d94('0x78'),'%,'+_0x38b411+',%');});}if(_0x5d5c66['query'][_0x3d94('0x8c')]){var _0x6cfc19=_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x8c')][_0x3d94('0x8d')]('\x5c','\x5c\x5c')[_0x3d94('0x8d')](/'/g,'\x27\x27');if(qs[_0x3d94('0x8e')](_0x6cfc19)){_0x169aa1['or'](_0x3d94('0x8f'),_0x6cfc19+'%');}else{_0x169aa1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x6cfc19))['or'](_0x3d94('0x90'),_0x6cfc19+'%');}}}_0x584e1d[_0x3d94('0x53')](_0x169aa1);_0x584e1d[_0x3d94('0x91')]('i.id');var _0x43a00e={'type':db[_0x3d94('0x92')][_0x3d94('0x93')][_0x3d94('0x94')],'raw':!![]};var _0x860ee5=_0x584e1d['clone']();_0x860ee5['field'](_0x3d94('0x95'));_0x860ee5[_0x3d94('0x54')](_0x3d94('0x96'),_0x3d94('0x6b'));if(_0x555366[_0x3d94('0x51')]){_0x555366[_0x3d94('0x51')][_0x3d94('0x42')](function(_0x3bcc86){var _0x462e88=_0x3bcc86[0x0]===_0x3d94('0x97')?_0x3bcc86[0x0]:'i.'+_0x3bcc86[0x0];_0x584e1d[_0x3d94('0x51')](_0x462e88,_0x3bcc86[0x1]===_0x3d94('0x98')?![]:!![]);});}if(!_[_0x3d94('0x80')](_0x5da38c)){_0x584e1d['having'](_0x519ada);_0x860ee5[_0x3d94('0x53')](_0x3d94('0x99'),_0x5da38c);}BPromise['resolve']()['then'](function(){if(!_0x4bd97c){if(_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x81')])return;_0x860ee5[_0x3d94('0x53')](_0x3d94('0x9a'));_0x584e1d['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x5d5c66[_0x3d94('0x9b')][_0x3d94('0x9c')]!==_0x3d94('0x3b'))return;return _0x5d5c66[_0x3d94('0x9b')][_0x3d94('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x38975f){if(_['isEmpty'](_0x38975f)){_0x860ee5[_0x3d94('0x53')](_0x3d94('0x9e'));_0x584e1d[_0x3d94('0x53')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x860ee5[_0x3d94('0x53')](_0x3d94('0x82'),_['map'](_0x38975f,'id'));_0x584e1d[_0x3d94('0x53')]('i.ChatWebsiteId\x20IN\x20?',_[_0x3d94('0x3d')](_0x38975f,'id'));}});})[_0x3d94('0x1f')](function(){if(_0x5d5c66[_0x3d94('0x9b')]['role']===_0x3d94('0x3b')&&!_0x4bd97c&&!_0x5d5c66[_0x3d94('0x48')][_0x3d94('0x81')])return[];return db['sequelize'][_0x3d94('0x48')](_0x860ee5[_0x3d94('0x9f')](),_0x43a00e);})[_0x3d94('0x1f')](function(_0x1f0f6f){_0x3f4b32[_0x3d94('0xa0')]=_0x1f0f6f[_0x3d94('0x4e')];if(_0x3f4b32[_0x3d94('0xa0')]===0x0)return[];return db[_0x3d94('0xa1')]['query'](_0x3a7eb0[_0x3d94('0x9f')](),_0x43a00e)[_0x3d94('0x1f')](function(_0x227d15){_0x174eb3=_[_0x3d94('0xa2')](_0x227d15,'id');_0x43a00e=_[_0x3d94('0xa3')](_0x43a00e,{'model':db[_0x3d94('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d5c66['query'][_0x3d94('0x4d')]){_0x555366[_0x3d94('0x4c')][_0x3d94('0x42')](function(_0x59b62b){_0x584e1d[_0x3d94('0x54')]('i.'+_0x59b62b);});}else{_0x584e1d['field'](_0x3d94('0x96'),_0x3d94('0x6b'));_0x584e1d['field'](_0x3d94('0xa4'),_0x3d94('0xa5'));_0x584e1d['field']('a.mandatoryDisposition',_0x3d94('0xa6'));_0x584e1d[_0x3d94('0x54')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x584e1d['field'](_0x3d94('0xa7'));_0x584e1d[_0x3d94('0x54')](_0x3d94('0xa8'),_0x3d94('0xa9'));_0x584e1d[_0x3d94('0x54')]('c.lastName',_0x3d94('0xaa'));_0x584e1d[_0x3d94('0x54')](_0x3d94('0xab'),'Contact.email');_0x584e1d[_0x3d94('0x54')]('c.phone',_0x3d94('0xac'));_0x584e1d[_0x3d94('0x54')](_0x3d94('0xad'),_0x3d94('0xae'));_0x584e1d[_0x3d94('0x54')]('c.fax','Contact.fax');_0x584e1d[_0x3d94('0x54')](_0x3d94('0xaf'),'Owner.fullname');_0x584e1d[_0x3d94('0x54')]('o.internal',_0x3d94('0xb0'));_0x584e1d[_0x3d94('0x54')](_0x3d94('0xb1'),'TagIds');}if(_0x555366[_0x3d94('0x2e')])_0x584e1d['limit'](_0x555366[_0x3d94('0x2e')]);if(_0x555366[_0x3d94('0x2d')])_0x584e1d[_0x3d94('0x2d')](_0x555366[_0x3d94('0x2d')]);return db['sequelize']['query'](_0x584e1d[_0x3d94('0x9f')](),_0x43a00e);})[_0x3d94('0x1f')](function(_0x1c2092){if(_0x1c2092[_0x3d94('0x4e')]>0x0)_0x5b6061['where'](_0x3d94('0xb2'),_['map'](_0x1c2092,'id'));return db['sequelize']['query'](_0x5b6061[_0x3d94('0x9f')](),_0x43a00e)[_0x3d94('0x1f')](function(_0x3706ea){var _0xcd36ab=_[_0x3d94('0xb3')](_0x3706ea,_0x3d94('0xb4'));var _0x33af12=[];_0x1c2092[_0x3d94('0x42')](function(_0x2e2f9f){_0x33af12[_0x3d94('0xb5')](updateChatInteraction(_0x2e2f9f,_0x174eb3,_0xcd36ab));});return BPromise[_0x3d94('0xb6')](_0x33af12);});});})[_0x3d94('0x1f')](function(_0x42c91f){_0x3f4b32[_0x3d94('0xb7')]=_0x42c91f;return _0x3f4b32;})[_0x3d94('0x1f')](respondWithFilteredResult(_0x2910ea,_0x555366))['catch'](handleError(_0x2910ea,null));};exports['show']=function(_0x14ec29,_0x3ff668){var _0x1837c9={'raw':![],'where':{'id':_0x14ec29[_0x3d94('0xb8')]['id']}},_0x41251d={};_0x41251d[_0x3d94('0x47')]=_[_0x3d94('0x49')](db['ChatInteraction'][_0x3d94('0xb9')]);_0x41251d[_0x3d94('0x48')]=_[_0x3d94('0x49')](_0x14ec29[_0x3d94('0x48')]);_0x41251d[_0x3d94('0x4a')]=_[_0x3d94('0x4b')](_0x41251d['model'],_0x41251d['query']);_0x1837c9[_0x3d94('0x4c')]=_['intersection'](_0x41251d[_0x3d94('0x47')],qs[_0x3d94('0x4d')](_0x14ec29[_0x3d94('0x48')][_0x3d94('0x4d')]));_0x1837c9[_0x3d94('0x4c')]=_0x1837c9[_0x3d94('0x4c')][_0x3d94('0x4e')]?_0x1837c9[_0x3d94('0x4c')]:_0x41251d['model'];if(_0x14ec29[_0x3d94('0x48')][_0x3d94('0xba')]){_0x1837c9[_0x3d94('0xbb')]=[{'all':!![]}];}_0x1837c9=_[_0x3d94('0xa3')]({},_0x1837c9,_0x14ec29[_0x3d94('0xbc')]);return db[_0x3d94('0x44')][_0x3d94('0x73')](_0x1837c9)[_0x3d94('0x1f')](handleEntityNotFound(_0x3ff668,null))[_0x3d94('0x1f')](respondWithResult(_0x3ff668,null))[_0x3d94('0x29')](handleError(_0x3ff668,null));};exports[_0x3d94('0xbd')]=function(_0x26c8ef,_0x17b789){return db[_0x3d94('0x44')][_0x3d94('0xbd')](_0x26c8ef[_0x3d94('0x39')],{})[_0x3d94('0x1f')](respondWithResult(_0x17b789,0xc9))[_0x3d94('0x29')](handleError(_0x17b789,null));};exports[_0x3d94('0x33')]=function(_0xe5f109,_0xb55889){if(_0xe5f109['body']['id']){delete _0xe5f109[_0x3d94('0x39')]['id'];}return db[_0x3d94('0x44')][_0x3d94('0x73')]({'where':{'id':_0xe5f109[_0x3d94('0xb8')]['id']}})[_0x3d94('0x1f')](handleEntityNotFound(_0xb55889,null))[_0x3d94('0x1f')](saveUpdates(_0xe5f109['body'],null))[_0x3d94('0x1f')](respondWithResult(_0xb55889,null))[_0x3d94('0x29')](handleError(_0xb55889,null));};exports[_0x3d94('0x34')]=function(_0x3242ea,_0x17a478){return db[_0x3d94('0x44')]['find']({'where':{'id':_0x3242ea[_0x3d94('0xb8')]['id']}})[_0x3d94('0x1f')](handleEntityNotFound(_0x17a478,null))['then'](removeEntity(_0x17a478,null))['catch'](handleError(_0x17a478,null));};exports['describe']=function(_0x3e1139,_0x77b79d){return db[_0x3d94('0x44')][_0x3d94('0xbe')]()[_0x3d94('0x1f')](respondWithResult(_0x77b79d,null))['catch'](handleError(_0x77b79d,null));};exports[_0x3d94('0xbf')]=function(_0x36499a,_0xd8488f){var _0x669d83=_0x36499a[_0x3d94('0xb8')]['id'];var _0x2c004f;var _0x5d10af;var _0x167d4c;return db['ChatInteraction'][_0x3d94('0xc0')]({'where':{'id':_0x669d83}})[_0x3d94('0x1f')](function(_0x34e156){_0x2c004f=_0x34e156;return db[_0x3d94('0xc1')]['findOne']({'where':{'id':_0x34e156[_0x3d94('0x81')]},'attributes':['id',_0x3d94('0xc2'),_0x3d94('0xc3'),_0x3d94('0xc4'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x3d94('0x1f')](function(_0x24d10c){if(_0x24d10c&&_0x24d10c[_0x3d94('0xc2')]&&_0x24d10c['vidaooEscalation']){_0x5d10af=_0x24d10c;var _0x2fac35={'interaction':{'id':_0x669d83},'agent':{'id':_0x36499a['user']['id'],'name':_0x36499a['user'][_0x3d94('0x36')],'fullname':_0x36499a[_0x3d94('0x9b')]['fullname'],'email':_0x36499a[_0x3d94('0x9b')][_0x3d94('0xc5')]},'contact':_0x36499a[_0x3d94('0x39')]['contact'],'account':_0x36499a[_0x3d94('0x39')][_0x3d94('0x3c')]};var _0x579998={'rejectUnauthorized':![],'method':'POST','url':_0x3d94('0xc6'),'headers':{'X-APIKEY':_0x24d10c[_0x3d94('0xc2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x36499a[_0x3d94('0x9b')][_0x3d94('0xc5')]],'buttons':null,'topic':_0x5d10af[_0x3d94('0xc4')],'note':_[_0x3d94('0xc7')](_0x5d10af['vidaooNote'])?null:getMustacheRender(_0x5d10af['vidaooNote'],_0x2fac35),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x5d10af[_0x3d94('0xc8')])){var _0x3950d1=getMustacheRender(_0x5d10af[_0x3d94('0xc8')],_0x2fac35);var _0x1073d3=JSON[_0x3d94('0x85')](_0x3950d1);_0x579998[_0x3d94('0x39')][_0x3d94('0xc9')]=_0x1073d3;}}catch(_0x23c9d4){throw new db[(_0x3d94('0x92'))][(_0x3d94('0xca'))](_0x3d94('0xcb'));}return rp(_0x579998);}else{throw new db['Sequelize'][(_0x3d94('0xca'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x3d94('0x1f')](function(_0x149fab){_0x167d4c=_0x149fab;if(_0x167d4c['id']){var _0x15cda1={'body':_0x167d4c[_0x3d94('0xcc')],'ChatWebsiteId':_0x5d10af['id'],'ChatInteractionId':_0x2c004f['id'],'direction':_0x3d94('0xcd'),'UserId':_0x36499a[_0x3d94('0x9b')]['id']};return db[_0x3d94('0xce')][_0x3d94('0xbd')](_0x15cda1,{});}else{throw new db['Sequelize'][(_0x3d94('0xca'))](_0x3d94('0xcf'));}})[_0x3d94('0x1f')](function(){return _0x2c004f[_0x3d94('0xd0')]({'vidaooSessionId':_0x167d4c['id']});})[_0x3d94('0x1f')](respondWithResult(_0xd8488f,null))[_0x3d94('0x29')](handleError(_0xd8488f,null));};exports[_0x3d94('0xd1')]=function(_0x1b7ad4,_0x483e7a){if(_0x1b7ad4[_0x3d94('0x39')]['id']){delete _0x1b7ad4[_0x3d94('0x39')]['id'];}return db[_0x3d94('0x44')][_0x3d94('0x73')]({'where':{'id':_0x1b7ad4[_0x3d94('0xb8')]['id']},'include':[{'model':db[_0x3d94('0xd2')],'as':_0x3d94('0x6e')}]})[_0x3d94('0x1f')](handleEntityNotFound(_0x483e7a,null))['then'](saveUpdates(_0x1b7ad4[_0x3d94('0x39')],null))[_0x3d94('0x1f')](respondWithResult(_0x483e7a,null))['catch'](handleError(_0x483e7a,null));};exports[_0x3d94('0xd3')]=function(_0x11378e,_0x24e1c8,_0xaedee0){if(_0x11378e[_0x3d94('0x39')]['id']){delete _0x11378e[_0x3d94('0x39')]['id'];}return db[_0x3d94('0x44')][_0x3d94('0x73')]({'where':{'id':_0x11378e[_0x3d94('0xb8')]['id']}})[_0x3d94('0x1f')](function(_0xf982a2){if(!_0xf982a2){logger[_0x3d94('0x25')](_0x3d94('0xd4'),_0x3d94('0xd3'),0x194,_0x3d94('0xd5'));_0x24e1c8[_0x3d94('0x2a')](0x194);}else{if(_0xf982a2[_0x3d94('0x7c')]){throw new db[(_0x3d94('0x92'))][(_0x3d94('0xca'))](_0x3d94('0xd6'));}}return _0xf982a2;})[_0x3d94('0x1f')](function(_0x4353ca){if(_0x4353ca){return _0x4353ca[_0x3d94('0x33')]({'closed':_0x11378e[_0x3d94('0x39')][_0x3d94('0xd7')],'disposition':_0x11378e['body']['disposition']})[_0x3d94('0x1f')](function(_0x54f366){return _0x54f366;});}})['then'](function(_0x199fa0){return respondWithRpcPromise(_0x3d94('0xd8'),_0x3d94('0xd3'),_0x11378e[_0x3d94('0x39')],client9004);})[_0x3d94('0x1f')](respondWithResult(_0x24e1c8,null))['catch'](handleError(_0x24e1c8,null));};exports[_0x3d94('0xd9')]=function(_0x5c0138,_0x41fd2c,_0x3b5b04){_0x5c0138[_0x3d94('0x39')][_0x3d94('0x36')]=_0x5c0138[_0x3d94('0xda')][_0x3d94('0xdb')];_0x5c0138[_0x3d94('0x39')][_0x3d94('0xdc')]=_0x5c0138[_0x3d94('0xda')][_0x3d94('0xdd')];_0x5c0138[_0x3d94('0x39')][_0x3d94('0x45')]=_0x5c0138[_0x3d94('0xda')][_0x3d94('0xde')];return db[_0x3d94('0xdf')]['create'](_0x5c0138['body'])['then'](respondWithResult(_0x41fd2c,0xc9))[_0x3d94('0x29')](handleError(_0x41fd2c,null));};exports[_0x3d94('0xe0')]=function(_0x59118c,_0x2105c2,_0x380071){return db['ChatInteraction'][_0x3d94('0xc0')]({'where':{'id':_0x59118c[_0x3d94('0xb8')]['id']},'raw':!![]})[_0x3d94('0x1f')](handleEntityNotFound(_0x2105c2,null))[_0x3d94('0x1f')](function(_0x3d96c5){if(_0x3d96c5){if(_0x3d96c5['closed']){return _0x2105c2[_0x3d94('0x2b')](0x193)[_0x3d94('0xe1')]({'status':0x193,'message':_0x3d94('0xe2')});}return db[_0x3d94('0xdf')][_0x3d94('0xc0')]({'where':{'id':_0x59118c[_0x3d94('0x48')][_0x3d94('0xe3')]},'raw':!![]})[_0x3d94('0x1f')](handleEntityNotFound(_0x2105c2,null));}})[_0x3d94('0x1f')](function(_0x4d54e7){if(_0x4d54e7){var _0x26bf00=_0x4d54e7[_0x3d94('0xe4')]!==null;var _0x23bf47=path[_0x3d94('0xe5')](config[_0x3d94('0xe6')],_0x3d94('0xe7'));if(_0x26bf00){_0x23bf47=path['join'](_0x23bf47,'offline-chat/');}var _0x336a7d=path[_0x3d94('0xe5')](_0x23bf47,_0x4d54e7['basename']);return _0x2105c2[_0x3d94('0xe8')](_0x336a7d);}})[_0x3d94('0x29')](handleError(_0x2105c2,null));};exports[_0x3d94('0xe9')]=function(_0x37680e,_0x397e85){var _0x5c192c=null;var _0x180595=null;var _0x4a7185=null;var _0x3b0395=null;if(_0x37680e['body']['id']){delete _0x37680e['body']['id'];}if(_0x37680e[_0x3d94('0x39')][_0x3d94('0xea')]){_0x3b0395=path[_0x3d94('0xe5')](config[_0x3d94('0xe6')],_0x3d94('0xeb'),util['format'](_0x3d94('0xec'),Date['now']()));_0x37680e['body']['pathTranscript']=_0x3b0395;}return db[_0x3d94('0x44')]['find']({'where':{'id':_0x37680e[_0x3d94('0xb8')]['id']},'include':[{'model':db[_0x3d94('0xce')],'as':_0x3d94('0xed'),'include':[{'model':db[_0x3d94('0x7a')],'as':_0x3d94('0x7a')}]}]})['then'](handleEntityNotFound(_0x397e85,null))[_0x3d94('0x1f')](saveUpdates(_0x37680e[_0x3d94('0x39')],null))[_0x3d94('0x1f')](function(_0x283758){if(_0x283758){_0x5c192c=_0x283758;return db[_0x3d94('0xc1')][_0x3d94('0x73')]({'where':{'id':_0x5c192c['ChatWebsiteId']}});}})[_0x3d94('0x1f')](function(_0x593683){if(_0x593683){_0x4a7185=_0x593683;return db['CmContact'][_0x3d94('0x73')]({'where':{'id':_0x5c192c['ContactId']}});}})[_0x3d94('0x1f')](function(_0xc61003){if(_0xc61003){_0x180595=_0xc61003;if(_0x3b0395){var _0x40b159=null;for(var _0x5262af=0x1;_0x5262af<_0x5c192c['Messages'][_0x3d94('0x4e')];++_0x5262af){_0x40b159=_0x5c192c['Messages'][_0x5262af];var _0x289577=_0x40b159[_0x3d94('0x7c')]?util['format'](_0x3d94('0xee'),_0x4a7185[_0x3d94('0xef')],_0x40b159[_0x3d94('0x7c')]):_0x3d94('0xf0');var _0x4282b3=_0x37680e[_0x3d94('0x39')][_0x3d94('0xf1')]||util[_0x3d94('0xf2')](_0x3d94('0xee'),_0x3d94('0xf3'),_0x40b159[_0x3d94('0x74')]);switch(_0x4a7185[_0x3d94('0xf4')]){case _0x3d94('0xf5'):_0x289577=_0x40b159[_0x3d94('0x7c')]?util[_0x3d94('0xf2')](_0x3d94('0xee'),_0x4a7185[_0x3d94('0xef')],_0x40b159['UserId']):_0x3d94('0xf0');break;case _0x3d94('0xf6'):_0x289577=_0x40b159[_0x3d94('0x7c')]?_0x40b159[_0x3d94('0x7a')][_0x3d94('0xf7')]||_0x40b159[_0x3d94('0x7a')][_0x3d94('0x3e')]:'System';break;case'agent_fullname':_0x289577=_0x40b159['UserId']?_0x40b159[_0x3d94('0x7a')][_0x3d94('0x3e')]:'System';break;default:_0x289577=_0x40b159['UserId']?util[_0x3d94('0xf2')](_0x3d94('0xee'),_0x4a7185[_0x3d94('0xef')],_0x40b159[_0x3d94('0x7c')]):'System';}var _0x5ac9db=util['format'](_0x3d94('0xf8'),moment(_0x40b159['createdAt'])['format'](_0x3d94('0xf9')),_0x40b159[_0x3d94('0xfa')]==='in'?_0x4282b3:_0x289577,_0x40b159[_0x3d94('0x39')]);if(!_0x40b159[_0x3d94('0xfb')]){fs[_0x3d94('0xfc')](_0x3b0395,_0x5ac9db);}}return db[_0x3d94('0xfd')][_0x3d94('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x3d94('0x1f')](function(_0x29a79a){if(_0x29a79a&&_0x29a79a[_0x3d94('0xfe')]&&_0x37680e[_0x3d94('0x39')]){var _0x1be31a={'tls':{'rejectUnauthorized':![]}};if(_0x29a79a[_0x3d94('0xfe')][_0x3d94('0xff')]){_0x1be31a['service']=_0x29a79a[_0x3d94('0xfe')]['service'];}else{_0x1be31a['host']=_0x29a79a['Smtp'][_0x3d94('0x100')];_0x1be31a[_0x3d94('0x101')]=_0x29a79a[_0x3d94('0xfe')][_0x3d94('0x101')];_0x1be31a['secure']=_0x29a79a[_0x3d94('0xfe')]['secure'];}if(_0x29a79a[_0x3d94('0xfe')][_0x3d94('0x102')]){_0x1be31a[_0x3d94('0x103')]={'user':_0x29a79a['Smtp'][_0x3d94('0x9b')],'pass':_0x29a79a[_0x3d94('0xfe')]['pass']};}return respondWithRpcPromise('SendMail',_0x3d94('0x104'),{'account':_0x1be31a,'message':{'from':util[_0x3d94('0xf2')](_0x3d94('0x105'),_0x29a79a[_0x3d94('0x36')],_0x29a79a['email']||_0x29a79a['Smtp']['user']),'to':_0x37680e[_0x3d94('0x39')][_0x3d94('0xea')],'subject':_0x3d94('0x106'),'text':util[_0x3d94('0xf2')](_0x3d94('0x107'),_0x37680e[_0x3d94('0x39')][_0x3d94('0xea')]),'attachments':[{'path':_0x3b0395}]}})['then'](function(){return _0x5c192c;})['catch'](function(_0xcd4f10){console[_0x3d94('0x25')](_0xcd4f10);});}else{return _0x5c192c;}})[_0x3d94('0x1f')](respondWithStatusCode(_0x397e85,0xc8))[_0x3d94('0x29')](handleError(_0x397e85,null));};exports[_0x3d94('0x108')]=function(_0x4d9b7a,_0x4514fa,_0x29fd6b){return db[_0x3d94('0xce')][_0x3d94('0x73')]({'where':{'id':_0x4d9b7a[_0x3d94('0xb8')]['id']}})[_0x3d94('0x1f')](handleEntityNotFound(_0x4514fa,null))['then'](function(_0xaa7525){if(_0xaa7525){return _0xaa7525[_0x3d94('0x108')](_0x4d9b7a['body'][_0x3d94('0x109')],_[_0x3d94('0x10a')](_0x4d9b7a['body'],[_0x3d94('0x109'),'id'])||{});}})['then'](respondWithResult(_0x4514fa,null))[_0x3d94('0x29')](handleError(_0x4514fa,null));};exports[_0x3d94('0x10b')]=function(_0xabb45a,_0x381b5a,_0x5e935e){var _0x317583={'raw':![],'where':{}};var _0x4733ad={};var _0x5e7388={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0xabb45a[_0x3d94('0xb8')]['id']}})[_0x3d94('0x1f')](handleEntityNotFound(_0x381b5a,null))[_0x3d94('0x1f')](function(_0x5e3823){if(_0x5e3823){_0x4733ad[_0x3d94('0x47')]=_[_0x3d94('0x49')](db['ChatMessage'][_0x3d94('0xb9')]);_0x4733ad[_0x3d94('0x48')]=_[_0x3d94('0x49')](_0xabb45a[_0x3d94('0x48')]);_0x4733ad[_0x3d94('0x4a')]=_[_0x3d94('0x4b')](_0x4733ad[_0x3d94('0x47')],_0x4733ad[_0x3d94('0x48')]);_0x317583[_0x3d94('0x4c')]=_[_0x3d94('0x4b')](_0x4733ad[_0x3d94('0x47')],qs[_0x3d94('0x4d')](_0xabb45a[_0x3d94('0x48')][_0x3d94('0x4d')]));_0x317583[_0x3d94('0x4c')]=_0x317583[_0x3d94('0x4c')][_0x3d94('0x4e')]?_0x317583['attributes']:_0x4733ad['model'];if(!_0xabb45a[_0x3d94('0x48')][_0x3d94('0x4f')](_0x3d94('0x50'))){_0x317583['limit']=qs['limit'](_0xabb45a[_0x3d94('0x48')][_0x3d94('0x2e')]);_0x317583[_0x3d94('0x2d')]=qs['offset'](_0xabb45a[_0x3d94('0x48')][_0x3d94('0x2d')]);}_0x317583[_0x3d94('0x51')]=qs[_0x3d94('0x52')](_0xabb45a['query'][_0x3d94('0x52')]);_0x317583[_0x3d94('0x53')]=qs[_0x3d94('0x4a')](_[_0x3d94('0x10c')](_0xabb45a[_0x3d94('0x48')],_0x4733ad[_0x3d94('0x4a')]));_0x317583['where'][_0x3d94('0xb4')]=_0x5e3823['id'];if(_0xabb45a[_0x3d94('0x48')][_0x3d94('0x8c')]){_0x317583['where']=_[_0x3d94('0xa3')](_0x317583[_0x3d94('0x53')],{'$or':_[_0x3d94('0x3d')](_0x317583[_0x3d94('0x4c')],function(_0x4bd3fd){var _0x4279a6={};_0x4279a6[_0x4bd3fd]={'$like':'%'+_0xabb45a[_0x3d94('0x48')]['filter']+'%'};return _0x4279a6;})});}if(_0xabb45a[_0x3d94('0x48')][_0x3d94('0x86')]){var _0x32f992=_0xabb45a['query'][_0x3d94('0x86')]['split'](',');var _0x4ae7d9={};_0x4ae7d9[_0x32f992[0x0]]={'$gte':moment(_0x32f992[0x1])[_0x3d94('0xf2')](_0x3d94('0x10d'))};_0x317583['where']=_['merge'](_0x317583[_0x3d94('0x53')],_0x4ae7d9);}_0x317583=_['merge']({},_0x317583,_0xabb45a[_0x3d94('0xbc')]);return db[_0x3d94('0xce')][_0x3d94('0xa0')]({'where':_0x317583[_0x3d94('0x53')]})[_0x3d94('0x1f')](function(_0x249f16){_0x5e7388[_0x3d94('0xa0')]=_0x249f16;if(_0xabb45a[_0x3d94('0x48')][_0x3d94('0xba')]){_0x317583['include']=[{'all':!![]}];}return db[_0x3d94('0xce')][_0x3d94('0x10e')](_0x317583);})['then'](function(_0x3e6878){_0x5e7388['rows']=_0x3e6878;return _0x5e7388;});}})[_0x3d94('0x1f')](respondWithFilteredResult(_0x381b5a,_0x317583))[_0x3d94('0x29')](handleError(_0x381b5a,null));};exports['getMyMessages']=function(_0x1e3d22,_0x562c3f,_0x5ebe77){var _0xf8f4e7={'where':{}},_0x3fd9a9={},_0x1606b6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x3d94('0xc0')]({'where':{'id':_0x1e3d22[_0x3d94('0xb8')]['id']}})[_0x3d94('0x1f')](handleEntityNotFound(_0x562c3f,null))[_0x3d94('0x1f')](function(_0x4c76f3){if(_0x4c76f3){_0x3fd9a9[_0x3d94('0x47')]=_[_0x3d94('0x49')](db[_0x3d94('0xce')][_0x3d94('0xb9')]);_0x3fd9a9[_0x3d94('0x48')]=_['keys'](_0x1e3d22['query']);_0x3fd9a9['filters']=_[_0x3d94('0x4b')](_0x3fd9a9[_0x3d94('0x47')],_0x3fd9a9[_0x3d94('0x48')]);_0xf8f4e7['attributes']=_[_0x3d94('0x4b')](_0x3fd9a9[_0x3d94('0x47')],qs['fields'](_0x1e3d22[_0x3d94('0x48')][_0x3d94('0x4d')]));_0xf8f4e7[_0x3d94('0x4c')]=_0xf8f4e7[_0x3d94('0x4c')][_0x3d94('0x4e')]?_0xf8f4e7[_0x3d94('0x4c')]:_0x3fd9a9['model'];if(!_0x1e3d22['query'][_0x3d94('0x4f')](_0x3d94('0x50'))){_0xf8f4e7['limit']=qs[_0x3d94('0x2e')](_0x1e3d22[_0x3d94('0x48')][_0x3d94('0x2e')]);_0xf8f4e7[_0x3d94('0x2d')]=qs[_0x3d94('0x2d')](_0x1e3d22[_0x3d94('0x48')]['offset']);}_0xf8f4e7[_0x3d94('0x51')]=qs[_0x3d94('0x52')](_0x1e3d22[_0x3d94('0x48')][_0x3d94('0x52')]);_0xf8f4e7['where']=qs[_0x3d94('0x4a')](_[_0x3d94('0x10c')](_0x1e3d22['query'],_0x3fd9a9[_0x3d94('0x4a')]));_0xf8f4e7[_0x3d94('0x53')][_0x3d94('0xb4')]=_0x4c76f3['id'];if(_0x1e3d22[_0x3d94('0x48')][_0x3d94('0x8c')]){_0xf8f4e7[_0x3d94('0x53')]=_[_0x3d94('0xa3')](_0xf8f4e7[_0x3d94('0x53')],{'$or':_[_0x3d94('0x3d')](_0xf8f4e7[_0x3d94('0x4c')],function(_0x5829be){var _0x56894f={};_0x56894f[_0x5829be]={'$like':'%'+_0x1e3d22[_0x3d94('0x48')][_0x3d94('0x8c')]+'%'};return _0x56894f;})});}_0xf8f4e7[_0x3d94('0x53')][_0x3d94('0xfb')]=![];if(_0x1e3d22['query']['id']){_0xf8f4e7[_0x3d94('0x53')]['id']={'$gt':_0x1e3d22[_0x3d94('0x48')]['id']};}_0xf8f4e7=_[_0x3d94('0xa3')]({},_0xf8f4e7,_0x1e3d22['options']);return db[_0x3d94('0xce')][_0x3d94('0xa0')]({'where':_0xf8f4e7[_0x3d94('0x53')]})[_0x3d94('0x1f')](function(_0x289380){_0x1606b6[_0x3d94('0xa0')]=_0x289380;_0xf8f4e7[_0x3d94('0xbb')]=[];if(_0x1e3d22['query'][_0x3d94('0x10f')]){_0xf8f4e7['include'][_0x3d94('0xb5')]({'model':db['User'],'as':_0x3d94('0x7a'),'attributes':['id',_0x3d94('0x3e'),'alias']});}if(_0x1e3d22[_0x3d94('0x48')]['includeAll']){_0xf8f4e7[_0x3d94('0xbb')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xf8f4e7);})[_0x3d94('0x1f')](function(_0x436e01){_0x1606b6[_0x3d94('0xb7')]=_0x436e01;return _0x1606b6;});}})[_0x3d94('0x1f')](respondWithFilteredResult(_0x562c3f,_0xf8f4e7))[_0x3d94('0x29')](handleError(_0x562c3f,null));};exports[_0x3d94('0x110')]=function(_0xfb94d4,_0x1ef614,_0x137d04){return db[_0x3d94('0x44')][_0x3d94('0x73')]({'where':{'id':_0xfb94d4[_0x3d94('0xb8')]['id']}})['then'](handleEntityNotFound(_0x1ef614,null))[_0x3d94('0x1f')](function(_0x28aad1){if(_0x28aad1){return _0x28aad1[_0x3d94('0x111')](_0xfb94d4[_0x3d94('0x39')]['ids'],_['omit'](_0xfb94d4[_0x3d94('0x39')],[_0x3d94('0x109'),'id'])||{})[_0x3d94('0x112')](function(){return db[_0x3d94('0x77')][_0x3d94('0x10e')]({'attributes':['id','name','color'],'where':{'id':_0xfb94d4[_0x3d94('0x39')]['ids']}});})[_0x3d94('0x1f')](function(_0xc1537){socket[_0x3d94('0x113')](_0x3d94('0x114'),{'id':Number(_0xfb94d4[_0x3d94('0xb8')]['id']),'tags':_0xc1537||[]});return{'id':Number(_0xfb94d4[_0x3d94('0xb8')]['id']),'tags':_0xc1537||[]};});}})['then'](respondWithResult(_0x1ef614,null))[_0x3d94('0x29')](handleError(_0x1ef614,null));};exports[_0x3d94('0x115')]=function(_0x4aa6e6,_0x18f2db,_0x16082f){return db[_0x3d94('0x44')][_0x3d94('0x73')]({'where':{'id':_0x4aa6e6['params']['id']}})['then'](handleEntityNotFound(_0x18f2db,null))[_0x3d94('0x1f')](function(_0x1e480b){if(_0x1e480b){return _0x1e480b[_0x3d94('0x115')](_0x4aa6e6[_0x3d94('0x48')][_0x3d94('0x109')]);}})[_0x3d94('0x1f')](respondWithStatusCode(_0x18f2db,null))[_0x3d94('0x29')](handleError(_0x18f2db,null));};exports[_0x3d94('0xe8')]=function(_0x4147d5,_0x54d72a){var _0x31ec36=moment()[_0x3d94('0x116')]()['toString']();var _0x4897f6=path[_0x3d94('0xe5')](config['root'],'server',_0x3d94('0x117'),_0x3d94('0x118'));var _0x17f392=path[_0x3d94('0xe5')](config[_0x3d94('0xe6')],'server',_0x3d94('0x117'),_0x3d94('0x119'));var _0xceded9=path[_0x3d94('0xe5')](_0x4897f6,_0x31ec36);var _0x77078d=util[_0x3d94('0xf2')](_0x3d94('0x11a'),_0x4147d5[_0x3d94('0xb8')]['id'],_0x31ec36);var _0x27008c=path[_0x3d94('0xe5')](_0x4897f6,_0x77078d);var _0x464735=[];_0x464735[_0x3d94('0xb5')]({'model':db[_0x3d94('0x7a')],'as':'User','attributes':['id',_0x3d94('0x3e')],'raw':!![]});_0x464735[_0x3d94('0xb5')]({'model':db[_0x3d94('0xd2')],'as':'Contact','attributes':['id',_0x3d94('0x11b'),_0x3d94('0x11c')],'raw':!![]});if(_0x4147d5[_0x3d94('0x48')][_0x3d94('0x119')]){_0x464735[_0x3d94('0xb5')]({'model':db[_0x3d94('0xdf')],'as':_0x3d94('0xdf'),'raw':!![]});}var _0x554203=[{'model':db[_0x3d94('0xce')],'as':_0x3d94('0xed'),'attributes':['id',_0x3d94('0x39'),_0x3d94('0x84'),_0x3d94('0xfa'),_0x3d94('0xfb'),'read'],'include':_0x464735}];_0x554203['push']({'model':db[_0x3d94('0xc1')],'as':_0x3d94('0x11d'),'attributes':['id',_0x3d94('0x36')]});_0x554203[_0x3d94('0xb5')]({'model':db['User'],'as':_0x3d94('0x11e'),'attributes':['id','fullname']});return db[_0x3d94('0x44')][_0x3d94('0x73')]({'where':{'id':_0x4147d5['params']['id']},'include':_0x554203})['then'](handleEntityNotFound(_0x54d72a,null))['then'](function(_0x1da500){if(_0x1da500){var _0x2eb637=_0x1da500['get']({'plain':!![]});fs[_0x3d94('0x11f')](_0xceded9);var _0x4f572c={'channel':_0x3d94('0x120'),'account':_0x2eb637[_0x3d94('0x11d')][_0x3d94('0x36')],'agent':_0x2eb637[_0x3d94('0x11e')]?_0x2eb637[_0x3d94('0x11e')][_0x3d94('0x3e')]:'N.A.','createdAt':moment(_0x2eb637['createdAt'])[_0x3d94('0xf2')](_0x3d94('0x10d'))[_0x3d94('0x9f')](),'closedAt':_0x2eb637[_0x3d94('0xd7')]?moment(_0x2eb637['closedAt'])[_0x3d94('0xf2')](_0x3d94('0x10d'))[_0x3d94('0x9f')]():'','disposition':_0x2eb637[_0x3d94('0x121')],'chatInfo':{'browser':_0x2eb637[_0x3d94('0x122')],'os':_0x2eb637[_0x3d94('0x123')],'referer':_0x2eb637[_0x3d94('0x124')],'customerIp':_0x2eb637[_0x3d94('0x125')],'customerPort':_0x2eb637['customerPort']?_0x2eb637[_0x3d94('0x126')]:'N.A.'},'messages':_(_0x2eb637['Messages'])[_0x3d94('0x127')]()[_0x3d94('0x8c')]({'secret':![]})[_0x3d94('0x3d')](function(_0x10fdf2){if(_0x10fdf2[_0x3d94('0xdf')]){var _0x70202c=path[_0x3d94('0xe5')](_0x17f392,_0x10fdf2[_0x3d94('0xdf')]['basename']);if(fs[_0x3d94('0x128')](_0x70202c)){fs['createReadStream'](_0x70202c)[_0x3d94('0x129')](fs[_0x3d94('0x12a')](path[_0x3d94('0xe5')](_0xceded9,_0x10fdf2[_0x3d94('0xdf')][_0x3d94('0xdc')])));}}return{'date':moment(_0x10fdf2[_0x3d94('0x84')])['format'](_0x3d94('0x10d'))[_0x3d94('0x9f')](),'sender':_0x10fdf2[_0x3d94('0xfa')]===_0x3d94('0xcd')?_0x10fdf2['User']?_0x10fdf2['User'][_0x3d94('0x3e')]:_0x3d94('0xf0'):_0x10fdf2[_0x3d94('0x6e')][_0x3d94('0x11b')]+(_0x10fdf2[_0x3d94('0x6e')]['lastName']?'\x20'+_0x10fdf2[_0x3d94('0x6e')][_0x3d94('0x11c')]:''),'body':_0x10fdf2[_0x3d94('0xdf')]?_0x10fdf2[_0x3d94('0xdf')]['basename']:_0x10fdf2[_0x3d94('0x39')],'direction':_0x10fdf2['direction']===_0x3d94('0xcd')?'A':'C','secret':_0x10fdf2[_0x3d94('0xfb')],'read':_0x10fdf2['read'],'attachment':_0x10fdf2[_0x3d94('0xdf')]};})[_0x3d94('0x70')]()};return ejs[_0x3d94('0x12b')](path[_0x3d94('0xe5')](config[_0x3d94('0xe6')],_0x3d94('0x12c'),_0x3d94('0x12d'),_0x3d94('0x12e')),{'interaction':_0x4f572c})[_0x3d94('0x1f')](function(_0x244770){var _0x4e0383=path['join'](_0xceded9,_0x3d94('0x12f')+_0x2eb637['id']+'-'+_0x31ec36+'.pdf');var _0x57a739={'path':_0x4e0383,'channel':_0x3d94('0x120'),'interactionId':_0x2eb637['id']};return pdf['createPdfFromHTML'](_0x244770,_0x57a739);})[_0x3d94('0x1f')](function(){return new BPromise(function(_0x46ddad,_0x3063e9){zipdir(_0xceded9,{'saveTo':_0x27008c},function(_0x36c9be,_0x316c31){if(_0x36c9be)return _0x3063e9(_0x36c9be);return _0x46ddad(_0x316c31);});})['then'](function(){return new BPromise(function(_0x4e42e3,_0xeee55f){rimraf(_0xceded9,function(_0x2be870){if(_0x2be870)_0xeee55f(_0x2be870);return _0x4e42e3();});});})[_0x3d94('0x1f')](function(){return _0x54d72a['download'](_0x27008c,_0x77078d,function(_0x3330df){if(_0x3330df){console[_0x3d94('0x130')](_0x3d94('0x131'),_0x3330df);}else{fs['unlinkSync'](_0x27008c);}});});});}else{return _0x54d72a[_0x3d94('0x2a')](0xc8);}})[_0x3d94('0x29')](handleError(_0x54d72a,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 3df42d0..a91e6cf 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 _0xb334=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook'];(function(_0x15aa8b,_0x1e02b2){var _0x24dd4b=function(_0x14e6ad){while(--_0x14e6ad){_0x15aa8b['push'](_0x15aa8b['shift']());}};_0x24dd4b(++_0x1e02b2);}(_0xb334,0x133));var _0x4b33=function(_0x34b111,_0x48e210){_0x34b111=_0x34b111-0x0;var _0x483852=_0xb334[_0x34b111];return _0x483852;};'use strict';var EventEmitter=require(_0x4b33('0x0'));var ChatInteraction=require(_0x4b33('0x1'))['db'][_0x4b33('0x2')];var ChatMessage=require(_0x4b33('0x1'))['db'][_0x4b33('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b33('0x4'),'afterDestroy':_0x4b33('0x5')};function emitEvent(_0x3ce16a){return function(_0x2de3f1,_0x10afb0,_0x45ff5a){_0x2de3f1['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0xfa8610){_0x2de3f1[_0x4b33('0x6')](_0x4b33('0x7'),_0xfa8610[_0x4b33('0x8')](function(_0x3bc37f){return{'id':_0x3bc37f['id']};}));return ChatMessage[_0x4b33('0x9')]({'where':{'ChatInteractionId':_0x2de3f1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4b33('0xa')](function(_0x4e966c){_0x2de3f1[_0x4b33('0x6')]('unreadMessages',_0x4e966c[_0x4b33('0xb')]);ChatInteractionEvents[_0x4b33('0xc')](_0x3ce16a+':'+_0x2de3f1['id'],_0x2de3f1);ChatInteractionEvents['emit'](_0x3ce16a,_0x2de3f1);_0x45ff5a(null);})[_0x4b33('0xd')](_0x45ff5a(null));};}for(var e in events){if(events[_0x4b33('0xe')](e)){var event=events[e];ChatInteraction[_0x4b33('0xf')](e,emitEvent(event));}}module[_0x4b33('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xe222=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x28030b,_0x52dbcf){var _0x17582c=function(_0x2a17de){while(--_0x2a17de){_0x28030b['push'](_0x28030b['shift']());}};_0x17582c(++_0x52dbcf);}(_0xe222,0x10e));var _0x2e22=function(_0x38de33,_0x4361bb){_0x38de33=_0x38de33-0x0;var _0x40f16d=_0xe222[_0x38de33];return _0x40f16d;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x2e22('0x0'))['db'][_0x2e22('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x2e22('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2e22('0x3')](0x0);var events={'afterCreate':_0x2e22('0x4'),'afterUpdate':_0x2e22('0x5'),'afterDestroy':_0x2e22('0x6')};function emitEvent(_0x1df2f8){return function(_0x59343a,_0xb040e3,_0x1f6436){_0x59343a[_0x2e22('0x7')]({'attributes':['id'],'raw':!![]})[_0x2e22('0x8')](function(_0x185689){_0x59343a[_0x2e22('0x9')](_0x2e22('0xa'),_0x185689['map'](function(_0xfa1f10){return{'id':_0xfa1f10['id']};}));return ChatMessage[_0x2e22('0xb')]({'where':{'ChatInteractionId':_0x59343a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x13545f){_0x59343a[_0x2e22('0x9')](_0x2e22('0xc'),_0x13545f['length']);ChatInteractionEvents[_0x2e22('0xd')](_0x1df2f8+':'+_0x59343a['id'],_0x59343a);ChatInteractionEvents[_0x2e22('0xd')](_0x1df2f8,_0x59343a);_0x1f6436(null);})[_0x2e22('0xe')](_0x1f6436(null));};}for(var e in events){if(events[_0x2e22('0xf')](e)){var event=events[e];ChatInteraction[_0x2e22('0x10')](e,emitEvent(event));}}module[_0x2e22('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index fec19f0..f018562 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 _0x0d59=['utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0d59,0x199));var _0x90d5=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x0d59[_0x2118ad];return _0x4b5715;};'use strict';var _=require('lodash');var util=require(_0x90d5('0x0'));var logger=require(_0x90d5('0x1'))(_0x90d5('0x2'));var moment=require('moment');var BPromise=require(_0x90d5('0x3'));var rp=require(_0x90d5('0x4'));var fs=require('fs');var path=require(_0x90d5('0x5'));var rimraf=require(_0x90d5('0x6'));var config=require(_0x90d5('0x7'));var attributes=require(_0x90d5('0x8'));module[_0x90d5('0x9')]=function(_0x434da5,_0x50e4bc){return _0x434da5[_0x90d5('0xa')](_0x90d5('0xb'),attributes,{'tableName':_0x90d5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46b766,_0x63dfb6,_0x8c94fb){if(_0x46b766[_0x90d5('0xd')](_0x90d5('0xe'))){_0x46b766['closedAt']=moment()[_0x90d5('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x8c94fb(null,_0x46b766);}},'charset':_0x90d5('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2f10=['./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','../../config/environment'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0x2f10,0x107));var _0x02f1=function(_0x3cddb2,_0x3b43f7){_0x3cddb2=_0x3cddb2-0x0;var _0x3ade7d=_0x2f10[_0x3cddb2];return _0x3ade7d;};'use strict';var _=require(_0x02f1('0x0'));var util=require(_0x02f1('0x1'));var logger=require('../../config/logger')(_0x02f1('0x2'));var moment=require(_0x02f1('0x3'));var BPromise=require(_0x02f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02f1('0x5'));var rimraf=require('rimraf');var config=require(_0x02f1('0x6'));var attributes=require(_0x02f1('0x7'));module[_0x02f1('0x8')]=function(_0xfddf8e,_0x23f202){return _0xfddf8e[_0x02f1('0x9')](_0x02f1('0xa'),attributes,{'tableName':_0x02f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4529b0,_0x176448,_0x3d7399){if(_0x4529b0[_0x02f1('0xc')](_0x02f1('0xd'))){_0x4529b0[_0x02f1('0xe')]=moment()[_0x02f1('0xf')](_0x02f1('0x10'));}_0x3d7399(null,_0x4529b0);}},'charset':'utf8mb4','collate':_0x02f1('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ed5cbd8..e994314 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 _0x40d6=['../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','AddTagsToChatInteraction','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x474036,_0x5710d9){var _0x3f9a71=function(_0x4e4d7e){while(--_0x4e4d7e){_0x474036['push'](_0x474036['shift']());}};_0x3f9a71(++_0x5710d9);}(_0x40d6,0x100));var _0x640d=function(_0x2dd355,_0x47b7c4){_0x2dd355=_0x2dd355-0x0;var _0x15b4e2=_0x40d6[_0x2dd355];return _0x15b4e2;};'use strict';var _=require('lodash');var util=require(_0x640d('0x0'));var moment=require(_0x640d('0x1'));var BPromise=require(_0x640d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x640d('0x3'));var db=require(_0x640d('0x4'))['db'];var utils=require(_0x640d('0x5'));var logger=require(_0x640d('0x6'))(_0x640d('0x7'));var config=require(_0x640d('0x8'));var jayson=require(_0x640d('0x9'));var client=jayson['client'][_0x640d('0xa')]({'port':0x232a});config[_0x640d('0xb')]=_['defaults'](config[_0x640d('0xb')],{'host':_0x640d('0xc'),'port':0x18eb});var socket=require(_0x640d('0xd'))(new Redis(config[_0x640d('0xb')]));require(_0x640d('0xe'))[_0x640d('0xf')](socket);function respondWithRpcPromise(_0x263fdd,_0x2c009f,_0x2525e8){return new BPromise(function(_0xd57c93,_0x38b774){return client[_0x640d('0x10')](_0x263fdd,_0x2525e8)[_0x640d('0x11')](function(_0x3c9785){logger[_0x640d('0x12')](_0x640d('0x13'),_0x2c009f,'request\x20sent');logger[_0x640d('0x14')](_0x640d('0x15'),_0x2c009f,_0x640d('0x16'),JSON[_0x640d('0x17')](_0x3c9785));if(_0x3c9785[_0x640d('0x18')]){if(_0x3c9785[_0x640d('0x18')][_0x640d('0x19')]===0x1f4){logger[_0x640d('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x2c009f,_0x3c9785[_0x640d('0x18')][_0x640d('0x1a')]);return _0x38b774(_0x3c9785[_0x640d('0x18')]['message']);}logger[_0x640d('0x18')](_0x640d('0x13'),_0x2c009f,_0x3c9785['error'][_0x640d('0x1a')]);return _0xd57c93(_0x3c9785['error'][_0x640d('0x1a')]);}else{logger['info'](_0x640d('0x13'),_0x2c009f,_0x640d('0x16'));_0xd57c93(_0x3c9785[_0x640d('0x1b')][_0x640d('0x1a')]);}})[_0x640d('0x1c')](function(_0x316815){logger[_0x640d('0x18')](_0x640d('0x13'),_0x2c009f,_0x316815);_0x38b774(_0x316815);});});}exports[_0x640d('0x1d')]=function(_0x5891df){var _0x4ee370=this;return new Promise(function(_0x589546,_0x2bdf19){return db[_0x640d('0x1e')][_0x640d('0x1f')](_0x5891df[_0x640d('0x20')],{'raw':_0x5891df[_0x640d('0x21')]?_0x5891df[_0x640d('0x21')][_0x640d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5891df[_0x640d('0x21')]?_0x5891df[_0x640d('0x21')]['where']||null:null,'attributes':_0x5891df[_0x640d('0x21')]?_0x5891df[_0x640d('0x21')][_0x640d('0x23')]||null:null,'limit':_0x5891df[_0x640d('0x21')]?_0x5891df['options'][_0x640d('0x24')]||null:null})['then'](function(_0x322049){logger[_0x640d('0x12')](_0x640d('0x1d'),_0x5891df);logger[_0x640d('0x14')](_0x640d('0x1d'),_0x5891df,JSON['stringify'](_0x322049));_0x589546(_0x322049);})[_0x640d('0x1c')](function(_0x4f34bb){logger['error'](_0x640d('0x1d'),_0x4f34bb[_0x640d('0x1a')],_0x5891df);_0x2bdf19(_0x4ee370['error'](0x1f4,_0x4f34bb[_0x640d('0x1a')]));});});};exports[_0x640d('0x25')]=function(_0x450248){return new Promise(function(_0x3c9443,_0x12fa55){return db[_0x640d('0x1e')][_0x640d('0x26')]({'where':_0x450248[_0x640d('0x21')]?_0x450248[_0x640d('0x21')]['where']||null:null})[_0x640d('0x11')](function(_0x20cd4b){if(_0x20cd4b){return _0x20cd4b[_0x640d('0x27')](_0x450248[_0x640d('0x20')]['ids'],_[_0x640d('0x28')](_0x450248[_0x640d('0x20')],[_0x640d('0x29'),'id'])||{});}})[_0x640d('0x2a')](function(_0x49182b){logger['info'](_0x640d('0x2b'),_0x450248);logger[_0x640d('0x14')](_0x640d('0x2b'),_0x450248,JSON[_0x640d('0x17')](_0x49182b));_0x3c9443(_0x49182b);})['catch'](function(_0x26d891){logger[_0x640d('0x18')]('AddTags',_0x26d891['message'],_0x450248);_0x12fa55(_this[_0x640d('0x18')](0x1f4,_0x26d891[_0x640d('0x1a')]));});});}; \ No newline at end of file +var _0x8623=['AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit'];(function(_0x5773e7,_0x435e69){var _0x5e6621=function(_0x112829){while(--_0x112829){_0x5773e7['push'](_0x5773e7['shift']());}};_0x5e6621(++_0x435e69);}(_0x8623,0x1e7));var _0x3862=function(_0x47b4ff,_0x5b68fd){_0x47b4ff=_0x47b4ff-0x0;var _0x2e6bd4=_0x8623[_0x47b4ff];return _0x2e6bd4;};'use strict';var _=require(_0x3862('0x0'));var util=require(_0x3862('0x1'));var moment=require(_0x3862('0x2'));var BPromise=require(_0x3862('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3862('0x4'));var db=require(_0x3862('0x5'))['db'];var utils=require(_0x3862('0x6'));var logger=require(_0x3862('0x7'))(_0x3862('0x8'));var config=require(_0x3862('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3862('0xa')]['http']({'port':0x232a});config[_0x3862('0xb')]=_[_0x3862('0xc')](config[_0x3862('0xb')],{'host':_0x3862('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3862('0xb')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x39efde,_0x26f064,_0x2d76c5){return new BPromise(function(_0xb301f6,_0x1ddb87){return client['request'](_0x39efde,_0x2d76c5)[_0x3862('0xe')](function(_0x3acefd){logger[_0x3862('0xf')](_0x3862('0x10'),_0x26f064,'request\x20sent');logger[_0x3862('0x11')](_0x3862('0x12'),_0x26f064,'request\x20sent',JSON[_0x3862('0x13')](_0x3acefd));if(_0x3acefd[_0x3862('0x14')]){if(_0x3acefd[_0x3862('0x14')][_0x3862('0x15')]===0x1f4){logger['error'](_0x3862('0x10'),_0x26f064,_0x3acefd['error'][_0x3862('0x16')]);return _0x1ddb87(_0x3acefd[_0x3862('0x14')][_0x3862('0x16')]);}logger['error'](_0x3862('0x10'),_0x26f064,_0x3acefd[_0x3862('0x14')]['message']);return _0xb301f6(_0x3acefd['error'][_0x3862('0x16')]);}else{logger[_0x3862('0xf')](_0x3862('0x10'),_0x26f064,_0x3862('0x17'));_0xb301f6(_0x3acefd[_0x3862('0x18')][_0x3862('0x16')]);}})['catch'](function(_0x3c31d8){logger[_0x3862('0x14')](_0x3862('0x10'),_0x26f064,_0x3c31d8);_0x1ddb87(_0x3c31d8);});});}exports[_0x3862('0x19')]=function(_0x33a62d){var _0x2f90ae=this;return new Promise(function(_0x387c2b,_0x501b75){return db[_0x3862('0x1a')][_0x3862('0x1b')](_0x33a62d[_0x3862('0x1c')],{'raw':_0x33a62d[_0x3862('0x1d')]?_0x33a62d[_0x3862('0x1d')][_0x3862('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33a62d[_0x3862('0x1d')]?_0x33a62d[_0x3862('0x1d')][_0x3862('0x1f')]||null:null,'attributes':_0x33a62d[_0x3862('0x1d')]?_0x33a62d[_0x3862('0x1d')]['attributes']||null:null,'limit':_0x33a62d['options']?_0x33a62d[_0x3862('0x1d')][_0x3862('0x20')]||null:null})[_0x3862('0xe')](function(_0x25d2bd){logger[_0x3862('0xf')]('UpdateChatInteraction',_0x33a62d);logger['debug'](_0x3862('0x19'),_0x33a62d,JSON[_0x3862('0x13')](_0x25d2bd));_0x387c2b(_0x25d2bd);})['catch'](function(_0x283e34){logger['error']('UpdateChatInteraction',_0x283e34[_0x3862('0x16')],_0x33a62d);_0x501b75(_0x2f90ae['error'](0x1f4,_0x283e34['message']));});});};exports[_0x3862('0x21')]=function(_0x867813){return new Promise(function(_0x560964,_0x2084e0){return db['ChatInteraction']['find']({'where':_0x867813[_0x3862('0x1d')]?_0x867813['options'][_0x3862('0x1f')]||null:null})[_0x3862('0xe')](function(_0x3f82e6){if(_0x3f82e6){return _0x3f82e6[_0x3862('0x22')](_0x867813[_0x3862('0x1c')][_0x3862('0x23')],_[_0x3862('0x24')](_0x867813[_0x3862('0x1c')],[_0x3862('0x23'),'id'])||{});}})[_0x3862('0x25')](function(_0x23f0e5){logger['info'](_0x3862('0x26'),_0x867813);logger[_0x3862('0x11')](_0x3862('0x26'),_0x867813,JSON[_0x3862('0x13')](_0x23f0e5));_0x560964(_0x23f0e5);})[_0x3862('0x27')](function(_0x4deef3){logger[_0x3862('0x14')](_0x3862('0x26'),_0x4deef3[_0x3862('0x16')],_0x867813);_0x2084e0(_this['error'](0x1f4,_0x4deef3[_0x3862('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f340ae1..fc325f5 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 _0x2a06=['removeListener','length','chatInteraction:','remove','update','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2a06,0x87));var _0x62a0=function(_0x2a7831,_0x282a0d){_0x2a7831=_0x2a7831-0x0;var _0x3822f7=_0x2a06[_0x2a7831];return _0x3822f7;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x62a0('0x0'),_0x62a0('0x1')];function createListener(_0x1053be,_0x385838){return function(_0x1ea375){_0x385838[_0x62a0('0x2')](_0x1053be,_0x1ea375);};}function removeListener(_0x4677db,_0xf48ecf){return function(){ChatInteractionEvents[_0x62a0('0x3')](_0x4677db,_0xf48ecf);};}exports['register']=function(_0x3a1cd2){for(var _0x5f42c2=0x0,_0x49366d=events[_0x62a0('0x4')];_0x5f42c2<_0x49366d;_0x5f42c2++){var _0x4c5ee9=events[_0x5f42c2];var _0x1f1de1=createListener(_0x62a0('0x5')+_0x4c5ee9,_0x3a1cd2);ChatInteractionEvents['on'](_0x4c5ee9,_0x1f1de1);}}; \ No newline at end of file +var _0x5b7f=['emit','removeListener','register','length','./chatInteraction.events','save','remove','update'];(function(_0x23c152,_0x156378){var _0x426f2e=function(_0x51ee0d){while(--_0x51ee0d){_0x23c152['push'](_0x23c152['shift']());}};_0x426f2e(++_0x156378);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x5f0c02,_0xabb6e6){_0x5f0c02=_0x5f0c02-0x0;var _0x112d1c=_0x5b7f[_0x5f0c02];return _0x112d1c;};'use strict';var ChatInteractionEvents=require(_0xf5b7('0x0'));var events=[_0xf5b7('0x1'),_0xf5b7('0x2'),_0xf5b7('0x3')];function createListener(_0x3c760b,_0x1efe58){return function(_0x3bb362){_0x1efe58[_0xf5b7('0x4')](_0x3c760b,_0x3bb362);};}function removeListener(_0x2c5439,_0x2dfb67){return function(){ChatInteractionEvents[_0xf5b7('0x5')](_0x2c5439,_0x2dfb67);};}exports[_0xf5b7('0x6')]=function(_0x1e67ac){for(var _0x984337=0x0,_0x1d7c78=events[_0xf5b7('0x7')];_0x984337<_0x1d7c78;_0x984337++){var _0x3711ec=events[_0x984337];var _0x426253=createListener('chatInteraction:'+_0x3711ec,_0x1e67ac);ChatInteractionEvents['on'](_0x3711ec,_0x426253);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 9b7cebc..bf6a49c 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 _0x8f62=['post','create','/:id/vidaoo','diskStorage','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','update','put','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/my_messages','getMyMessages','/:id/download'];(function(_0x28d1b4,_0x32048a){var _0x287f4c=function(_0x3b0d01){while(--_0x3b0d01){_0x28d1b4['push'](_0x28d1b4['shift']());}};_0x287f4c(++_0x32048a);}(_0x8f62,0x101));var _0x28f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f62[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x28f6('0x0'));var path=require('path');var timeout=require(_0x28f6('0x1'));var express=require(_0x28f6('0x2'));var router=express[_0x28f6('0x3')]();var fs_extra=require(_0x28f6('0x4'));var auth=require(_0x28f6('0x5'));var interaction=require(_0x28f6('0x6'));var config=require(_0x28f6('0x7'));var controller=require(_0x28f6('0x8'));router[_0x28f6('0x9')]('/',auth[_0x28f6('0xa')](),controller[_0x28f6('0xb')]);router[_0x28f6('0x9')](_0x28f6('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x28f6('0x9')](_0x28f6('0xd'),auth[_0x28f6('0xe')](),controller[_0x28f6('0xf')]);router[_0x28f6('0x9')]('/:id/attachment_download',auth[_0x28f6('0xe')](),controller['attachmentDownload']);router[_0x28f6('0x9')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x28f6('0x9')](_0x28f6('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x28f6('0x11')]);router[_0x28f6('0x9')](_0x28f6('0x12'),auth[_0x28f6('0xa')](),controller['download']);router[_0x28f6('0x13')]('/',auth['isAuthenticated'](),controller[_0x28f6('0x14')]);router[_0x28f6('0x13')](_0x28f6('0x15'),auth[_0x28f6('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x28f6('0x16')]({'destination':function(_0x37e3e5,_0x454261,_0x224323){_0x224323(null,path['join'](config['root'],_0x28f6('0x17')));},'filename':function(_0x3df583,_0x305d35,_0x196478){_0x196478(null,util[_0x28f6('0x18')](_0x28f6('0x19'),Date[_0x28f6('0x1a')](),_0x305d35[_0x28f6('0x1b')][_0x28f6('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x28f6('0x13')](_0x28f6('0x1d'),upload[_0x28f6('0x1e')]('file'),controller[_0x28f6('0x1f')]);router[_0x28f6('0x13')](_0x28f6('0x20'),auth[_0x28f6('0xe')](),controller[_0x28f6('0x21')]);router[_0x28f6('0x13')](_0x28f6('0x22'),auth[_0x28f6('0xa')](),interaction[_0x28f6('0x23')](_0x28f6('0x24'),_0x28f6('0x25')),controller['addTags']);router['put'](_0x28f6('0xd'),auth[_0x28f6('0xa')](),interaction[_0x28f6('0x23')](_0x28f6('0x24'),'chatinteraction:update'),controller[_0x28f6('0x26')]);router[_0x28f6('0x27')]('/:id/custom_update',controller['customUpdate']);router[_0x28f6('0x27')](_0x28f6('0x28'),auth[_0x28f6('0xe')](),controller[_0x28f6('0x29')]);router[_0x28f6('0x27')]('/:id/close',controller[_0x28f6('0x2a')]);router[_0x28f6('0x2b')](_0x28f6('0xd'),auth[_0x28f6('0xa')](),interaction[_0x28f6('0x23')]('chat',_0x28f6('0x2c')),controller[_0x28f6('0x2d')]);router[_0x28f6('0x2b')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x5361=['/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','root','%s-%s','now','originalname','single','attachmentUpload','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','/:id/abandon','abandon','delete','chatinteraction:destroy','/:id/tags','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','index','/describe','isAuthenticated','describe','get','/:id','isChatInteractionAuthorized','show'];(function(_0x304bd5,_0xea943d){var _0x2bcd87=function(_0x53d3c5){while(--_0x53d3c5){_0x304bd5['push'](_0x304bd5['shift']());}};_0x2bcd87(++_0xea943d);}(_0x5361,0x162));var _0x1536=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5361[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1536('0x0'));var util=require('util');var path=require(_0x1536('0x1'));var timeout=require(_0x1536('0x2'));var express=require(_0x1536('0x3'));var router=express[_0x1536('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1536('0x5'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1536('0x6')]);router['get'](_0x1536('0x7'),auth[_0x1536('0x8')](),controller[_0x1536('0x9')]);router[_0x1536('0xa')](_0x1536('0xb'),auth[_0x1536('0xc')](),controller[_0x1536('0xd')]);router['get'](_0x1536('0xe'),auth[_0x1536('0xc')](),controller[_0x1536('0xf')]);router[_0x1536('0xa')](_0x1536('0x10'),auth[_0x1536('0x8')](),controller[_0x1536('0x11')]);router['get'](_0x1536('0x12'),auth[_0x1536('0xc')](),controller['getMyMessages']);router[_0x1536('0xa')](_0x1536('0x13'),auth[_0x1536('0x8')](),controller[_0x1536('0x14')]);router[_0x1536('0x15')]('/',auth[_0x1536('0x8')](),controller[_0x1536('0x16')]);router[_0x1536('0x15')]('/:id/vidaoo',auth[_0x1536('0x8')](),controller[_0x1536('0x17')]);var upload=multer({'storage':multer[_0x1536('0x18')]({'destination':function(_0x165a45,_0x43d70c,_0x2ff5a7){_0x2ff5a7(null,path[_0x1536('0x19')](config[_0x1536('0x1a')],'server/files/attachments/'));},'filename':function(_0x3fd565,_0x217497,_0x1899cf){_0x1899cf(null,util['format'](_0x1536('0x1b'),Date[_0x1536('0x1c')](),_0x217497[_0x1536('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1536('0x15')]('/:id/attachment_upload',upload[_0x1536('0x1e')]('file'),controller[_0x1536('0x1f')]);router[_0x1536('0x15')](_0x1536('0x10'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x1536('0x15')]('/:id/tags',auth[_0x1536('0x8')](),interaction[_0x1536('0x20')](_0x1536('0x21'),_0x1536('0x22')),controller[_0x1536('0x23')]);router['put'](_0x1536('0xb'),auth[_0x1536('0x8')](),interaction['tracked'](_0x1536('0x21'),_0x1536('0x24')),controller[_0x1536('0x25')]);router[_0x1536('0x26')](_0x1536('0x27'),controller['customUpdate']);router['put'](_0x1536('0x28'),auth[_0x1536('0xc')](),controller[_0x1536('0x29')]);router[_0x1536('0x26')]('/:id/close',controller['close']);router[_0x1536('0x2a')](_0x1536('0xb'),auth[_0x1536('0x8')](),interaction[_0x1536('0x20')]('chat',_0x1536('0x2b')),controller['destroy']);router[_0x1536('0x2a')](_0x1536('0x2c'),auth[_0x1536('0x8')](),controller['removeTags']);module[_0x1536('0x2d')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d630e42..a92bee6 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 _0x1de4=['INTEGER','sequelize','exports','BOOLEAN'];(function(_0x72e04a,_0x398f0b){var _0x4e8acf=function(_0x56ea91){while(--_0x56ea91){_0x72e04a['push'](_0x72e04a['shift']());}};_0x4e8acf(++_0x398f0b);}(_0x1de4,0xe5));var _0x41de=function(_0x4005ae,_0x5aae9c){_0x4005ae=_0x4005ae-0x0;var _0x38aa59=_0x1de4[_0x4005ae];return _0x38aa59;};'use strict';var Sequelize=require(_0x41de('0x0'));module[_0x41de('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x41de('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x41de('0x3')]}}; \ No newline at end of file +var _0x9b27=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b27,0x7b));var _0x79b2=function(_0x20e40d,_0x2a9f0f){_0x20e40d=_0x20e40d-0x0;var _0x558350=_0x9b27[_0x20e40d];return _0x558350;};'use strict';var Sequelize=require(_0x79b2('0x0'));module[_0x79b2('0x1')]={'body':{'type':Sequelize[_0x79b2('0x2')](_0x79b2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x79b2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x79b2('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ed6ae7a..5419388 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 _0x6e00=['fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','json','offset','undefined','limit','count','status','Content-Range','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','create','body','find','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','User','agent','fullname','role','userpic','online','allowmessenger','showWebBar','-online','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','filter','FromId','ToId','read','-createdAt','eml-format','zip-dir'];(function(_0x5ecbbc,_0x2541f5){var _0x219a19=function(_0x49d792){while(--_0x49d792){_0x5ecbbc['push'](_0x5ecbbc['shift']());}};_0x219a19(++_0x2541f5);}(_0x6e00,0x66));var _0x06e0=function(_0x49f444,_0xfcf462){_0x49f444=_0x49f444-0x0;var _0x3ee407=_0x6e00[_0x49f444];return _0x3ee407;};'use strict';var emlformat=require(_0x06e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06e0('0x1'));var jsonpatch=require(_0x06e0('0x2'));var rp=require(_0x06e0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x06e0('0x4'));var path=require(_0x06e0('0x5'));var sox=require('sox');var csv=require(_0x06e0('0x6'));var ejs=require(_0x06e0('0x7'));var fs=require('fs');var fs_extra=require(_0x06e0('0x8'));var _=require(_0x06e0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x06e0('0xa'));var deskjs=require(_0x06e0('0xb'));var toCsv=require(_0x06e0('0x6'));var querystring=require('querystring');var Papa=require(_0x06e0('0xc'));var Redis=require(_0x06e0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x06e0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06e0('0xf'));var logger=require(_0x06e0('0x10'))(_0x06e0('0x11'));var utils=require(_0x06e0('0x12'));var config=require(_0x06e0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x06e0('0x14'))['db'];config[_0x06e0('0x15')]=_[_0x06e0('0x16')](config[_0x06e0('0x15')],{'host':_0x06e0('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x06e0('0x15')]));require(_0x06e0('0x18'))[_0x06e0('0x19')](socket);function respondWithStatusCode(_0x32762e,_0x2e1c23){_0x2e1c23=_0x2e1c23||0xcc;return function(_0x432229){if(_0x432229){return _0x32762e['sendStatus'](_0x2e1c23);}return _0x32762e['status'](_0x2e1c23)['end']();};}function respondWithResult(_0x2ed074,_0x22886e){_0x22886e=_0x22886e||0xc8;return function(_0x816ead){if(_0x816ead){return _0x2ed074['status'](_0x22886e)[_0x06e0('0x1a')](_0x816ead);}};}function respondWithFilteredResult(_0x4f39e2,_0xd6674b){return function(_0x57f4ca){if(_0x57f4ca){var _0x21b132=typeof _0xd6674b[_0x06e0('0x1b')]===_0x06e0('0x1c')&&typeof _0xd6674b[_0x06e0('0x1d')]==='undefined';var _0xcdece2=_0x57f4ca[_0x06e0('0x1e')];var _0xe7e733=_0x21b132?0x0:_0xd6674b[_0x06e0('0x1b')];var _0x1c34e9=_0x21b132?_0x57f4ca[_0x06e0('0x1e')]:_0xd6674b['offset']+_0xd6674b[_0x06e0('0x1d')];var _0x117ead;if(_0x1c34e9>=_0xcdece2){_0x1c34e9=_0xcdece2;_0x117ead=0xc8;}else{_0x117ead=0xce;}_0x4f39e2[_0x06e0('0x1f')](_0x117ead);return _0x4f39e2['set'](_0x06e0('0x20'),_0xe7e733+'-'+_0x1c34e9+'/'+_0xcdece2)[_0x06e0('0x1a')](_0x57f4ca);}return null;};}function patchUpdates(_0x3bc6bc){return function(_0x16e2fc){try{jsonpatch['apply'](_0x16e2fc,_0x3bc6bc,!![]);}catch(_0xb4aee9){return BPromise[_0x06e0('0x21')](_0xb4aee9);}return _0x16e2fc[_0x06e0('0x22')]();};}function saveUpdates(_0x15db6d,_0x494e65){return function(_0x4862fe){if(_0x4862fe){return _0x4862fe['update'](_0x15db6d)[_0x06e0('0x23')](function(_0xf286ea){return _0xf286ea;});}return null;};}function removeEntity(_0x1bf7cb,_0x562162){return function(_0xd0ddce){if(_0xd0ddce){return _0xd0ddce[_0x06e0('0x24')]()[_0x06e0('0x23')](function(){_0x1bf7cb[_0x06e0('0x1f')](0xcc)[_0x06e0('0x25')]();});}};}function handleEntityNotFound(_0x2c5ded,_0x582df2){return function(_0x1e051b){if(!_0x1e051b){_0x2c5ded[_0x06e0('0x26')](0x194);}return _0x1e051b;};}function handleError(_0x27b4a9,_0x5d91b1){_0x5d91b1=_0x5d91b1||0x1f4;return function(_0xabb351){logger[_0x06e0('0x27')](_0xabb351[_0x06e0('0x28')]);if(_0xabb351[_0x06e0('0x29')]){delete _0xabb351[_0x06e0('0x29')];}_0x27b4a9[_0x06e0('0x1f')](_0x5d91b1)[_0x06e0('0x2a')](_0xabb351);};}exports[_0x06e0('0x2b')]=function(_0xac2bf1,_0x1bb020){var _0x46a4bf={},_0x180d56={},_0x5d7deb={'count':0x0,'rows':[]};var _0x16df0b=_['map'](db[_0x06e0('0x2c')][_0x06e0('0x2d')],function(_0x43a0a0){return{'name':_0x43a0a0[_0x06e0('0x2e')],'type':_0x43a0a0['type'][_0x06e0('0x2f')]};});_0x180d56[_0x06e0('0x30')]=_[_0x06e0('0x31')](_0x16df0b,_0x06e0('0x29'));_0x180d56[_0x06e0('0x32')]=_[_0x06e0('0x33')](_0xac2bf1[_0x06e0('0x32')]);_0x180d56['filters']=_[_0x06e0('0x34')](_0x180d56[_0x06e0('0x30')],_0x180d56[_0x06e0('0x32')]);_0x46a4bf[_0x06e0('0x35')]=_[_0x06e0('0x34')](_0x180d56[_0x06e0('0x30')],qs[_0x06e0('0x36')](_0xac2bf1[_0x06e0('0x32')]['fields']));_0x46a4bf['attributes']=_0x46a4bf['attributes'][_0x06e0('0x37')]?_0x46a4bf[_0x06e0('0x35')]:_0x180d56[_0x06e0('0x30')];if(!_0xac2bf1[_0x06e0('0x32')][_0x06e0('0x38')]('nolimit')){_0x46a4bf[_0x06e0('0x1d')]=qs[_0x06e0('0x1d')](_0xac2bf1[_0x06e0('0x32')][_0x06e0('0x1d')]);_0x46a4bf[_0x06e0('0x1b')]=qs[_0x06e0('0x1b')](_0xac2bf1['query'][_0x06e0('0x1b')]);}_0x46a4bf[_0x06e0('0x39')]=qs[_0x06e0('0x3a')](_0xac2bf1[_0x06e0('0x32')][_0x06e0('0x3a')]);_0x46a4bf[_0x06e0('0x3b')]=qs['filters'](_[_0x06e0('0x3c')](_0xac2bf1[_0x06e0('0x32')],_0x180d56['filters']),_0x16df0b);if(_0xac2bf1['query']['filter']){_0x46a4bf[_0x06e0('0x3b')]=_['merge'](_0x46a4bf[_0x06e0('0x3b')],{'$or':_[_0x06e0('0x31')](_0x16df0b,function(_0x27ddcb){if(_0x27ddcb[_0x06e0('0x3d')]!==_0x06e0('0x3e')){var _0x976ec8={};_0x976ec8[_0x27ddcb[_0x06e0('0x29')]]={'$like':'%'+_0xac2bf1[_0x06e0('0x32')]['filter']+'%'};return _0x976ec8;}})});}_0x46a4bf=_[_0x06e0('0x3f')]({},_0x46a4bf,_0xac2bf1[_0x06e0('0x40')]);var _0x1b3145={'where':_0x46a4bf[_0x06e0('0x3b')]};return db[_0x06e0('0x2c')][_0x06e0('0x1e')](_0x1b3145)['then'](function(_0x4bbd16){_0x5d7deb[_0x06e0('0x1e')]=_0x4bbd16;if(_0xac2bf1[_0x06e0('0x32')][_0x06e0('0x41')]){_0x46a4bf[_0x06e0('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x06e0('0x43')](_0x46a4bf);})['then'](function(_0x394d4f){_0x5d7deb[_0x06e0('0x44')]=_0x394d4f;return _0x5d7deb;})[_0x06e0('0x23')](respondWithFilteredResult(_0x1bb020,_0x46a4bf))['catch'](handleError(_0x1bb020,null));};exports['show']=function(_0x566ddc,_0x31b1a5){var _0x154bbc={'raw':!![],'where':{'id':_0x566ddc['params']['id']}},_0x5514f8={};_0x5514f8[_0x06e0('0x30')]=_[_0x06e0('0x33')](db[_0x06e0('0x2c')][_0x06e0('0x2d')]);_0x5514f8['query']=_[_0x06e0('0x33')](_0x566ddc[_0x06e0('0x32')]);_0x5514f8['filters']=_['intersection'](_0x5514f8[_0x06e0('0x30')],_0x5514f8['query']);_0x154bbc['attributes']=_['intersection'](_0x5514f8[_0x06e0('0x30')],qs[_0x06e0('0x36')](_0x566ddc[_0x06e0('0x32')]['fields']));_0x154bbc[_0x06e0('0x35')]=_0x154bbc['attributes']['length']?_0x154bbc['attributes']:_0x5514f8[_0x06e0('0x30')];if(_0x566ddc[_0x06e0('0x32')][_0x06e0('0x41')]){_0x154bbc[_0x06e0('0x42')]=[{'all':!![]}];}_0x154bbc=_[_0x06e0('0x3f')]({},_0x154bbc,_0x566ddc[_0x06e0('0x40')]);return db['ChatInternalMessage']['find'](_0x154bbc)[_0x06e0('0x23')](handleEntityNotFound(_0x31b1a5,null))[_0x06e0('0x23')](respondWithResult(_0x31b1a5,null))[_0x06e0('0x45')](handleError(_0x31b1a5,null));};exports[_0x06e0('0x46')]=function(_0x24668d,_0x2701de){return db[_0x06e0('0x2c')]['create'](_0x24668d[_0x06e0('0x47')],{})[_0x06e0('0x23')](respondWithResult(_0x2701de,0xc9))[_0x06e0('0x45')](handleError(_0x2701de,null));};exports['update']=function(_0x362084,_0x59dd00){if(_0x362084[_0x06e0('0x47')]['id']){delete _0x362084[_0x06e0('0x47')]['id'];}return db[_0x06e0('0x2c')][_0x06e0('0x48')]({'where':{'id':_0x362084[_0x06e0('0x49')]['id']}})[_0x06e0('0x23')](handleEntityNotFound(_0x59dd00,null))[_0x06e0('0x23')](saveUpdates(_0x362084['body'],null))[_0x06e0('0x23')](respondWithResult(_0x59dd00,null))[_0x06e0('0x45')](handleError(_0x59dd00,null));};exports[_0x06e0('0x24')]=function(_0x37e507,_0x28afcf){return db[_0x06e0('0x2c')][_0x06e0('0x48')]({'where':{'id':_0x37e507[_0x06e0('0x49')]['id']}})[_0x06e0('0x23')](handleEntityNotFound(_0x28afcf,null))['then'](removeEntity(_0x28afcf,null))[_0x06e0('0x45')](handleError(_0x28afcf,null));};exports[_0x06e0('0x4a')]=function(_0x4ebafc,_0x31c001){return db[_0x06e0('0x2c')]['describe']()['then'](respondWithResult(_0x31c001,null))[_0x06e0('0x45')](handleError(_0x31c001,null));};function wrapUser(_0xa0d13){return function(_0x322f9e){var _0x610c06=_0xa0d13[_0x06e0('0x4b')]({'plain':!![]});_0x610c06[_0x06e0('0x4c')]=[];if(_0x322f9e){_0x610c06[_0x06e0('0x4d')]=_0x322f9e[_0x06e0('0x4e')];_0x610c06[_0x06e0('0x4f')]=_0x322f9e;}else{_0x610c06[_0x06e0('0x4d')]=moment(0x0)[_0x06e0('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x610c06['lastMessage']={};}return _0x610c06;};}exports['getUsers']=function(_0x30e5ea,_0x10445b,_0x22f869){var _0x10478d=[];return db[_0x06e0('0x51')][_0x06e0('0x43')]({'where':{'role':[_0x06e0('0x52'),'admin','user']},'attributes':['id',_0x06e0('0x53'),_0x06e0('0x29'),_0x06e0('0x54'),_0x06e0('0x55'),'internal',_0x06e0('0x56'),'lastLoginAt',_0x06e0('0x57'),_0x06e0('0x58')],'order':qs[_0x06e0('0x3a')](_0x06e0('0x59')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x06e0('0x29'),_0x06e0('0x3d')],'through':{'attributes':[]}}]})[_0x06e0('0x23')](function(_0x170ec6){if(_0x170ec6){var _0x3d73ad=_0x30e5ea[_0x06e0('0x5a')][_0x06e0('0x4b')]({'plain':!![]});if(!_0x3d73ad)throw new Error(_0x06e0('0x5b'));if(_0x3d73ad[_0x06e0('0x54')]===_0x06e0('0x5a')){return db['UserProfileSection']['find']({'where':{'name':_0x06e0('0x5c'),'userProfileId':_0x3d73ad[_0x06e0('0x5d')]},'raw':!![]})['then'](function(_0x4dcb32){if(_0x4dcb32){if(_0x4dcb32[_0x06e0('0x5e')]===0x0){return db[_0x06e0('0x5f')][_0x06e0('0x43')]({'where':{'sectionId':_0x4dcb32['id']},'raw':!![]})[_0x06e0('0x23')](function(_0x488bc4){var _0x596ead=[];if(_[_0x06e0('0x60')](_0x488bc4)){_0x596ead=_['filter'](_0x170ec6,function(_0x2f8de2){if(_0x2f8de2[_0x06e0('0x54')]!==_0x06e0('0x52')){return _0x2f8de2;}});return _0x596ead;}else{for(var _0x5dd466=0x0;_0x5dd466<_0x170ec6[_0x06e0('0x37')];_0x5dd466++){var _0x35ae12=_0x170ec6[_0x5dd466];if(_0x35ae12[_0x06e0('0x54')]===_0x06e0('0x52')){var _0x125325=_[_0x06e0('0x48')](_0x488bc4,function(_0x47b8bd){return _0x47b8bd[_0x06e0('0x61')]===_0x35ae12['id'];});if(_0x125325)_0x596ead[_0x06e0('0x62')](_0x35ae12);}else{_0x596ead[_0x06e0('0x62')](_0x35ae12);}}return _0x596ead;}});}else{return _0x170ec6;}}else{var _0x259030=_[_0x06e0('0x63')](_0x170ec6,function(_0x3c613f){if(_0x3c613f[_0x06e0('0x54')]!=='agent'){return _0x3c613f;}});return _0x259030;}});}else{return _0x170ec6;}}})[_0x06e0('0x23')](function(_0x32a01b){var _0xda5d03=[];if(_0x32a01b){_0x10478d=_0x32a01b;for(var _0x1451d8=0x0;_0x1451d8<_0x32a01b[_0x06e0('0x37')];_0x1451d8+=0x1){_0x10478d[_0x1451d8][_0x06e0('0x4c')]=[];_0xda5d03[_0x06e0('0x62')](db['ChatInternalMessage'][_0x06e0('0x48')]({'where':{'FromId':[_0x30e5ea[_0x06e0('0x5a')]['id'],_0x32a01b[_0x1451d8]['id']],'ToId':[_0x30e5ea[_0x06e0('0x5a')]['id'],_0x32a01b[_0x1451d8]['id']],'ChatGroupId':null},'attributes':['id',_0x06e0('0x4e'),_0x06e0('0x64'),_0x06e0('0x65'),_0x06e0('0x66'),_0x06e0('0x47')],'order':qs[_0x06e0('0x3a')](_0x06e0('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x32a01b[_0x1451d8])));}return BPromise['all'](_0xda5d03);}return[];})[_0x06e0('0x23')](function(_0x6299f4){return{'rows':_0x6299f4,'count':_0x6299f4[_0x06e0('0x37')]};})['then'](respondWithResult(_0x10445b,null))[_0x06e0('0x45')](handleError(_0x10445b,null));}; \ No newline at end of file +var _0xe382=['../../config/license/util','../../mysqldb','redis','localhost','register','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','update','destroy','then','sendStatus','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','messages','createdAt','FromId','ToId','read','-createdAt','all','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xe382,0xc4));var _0x2e38=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe382[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2e38('0x0'));var jsonpatch=require(_0x2e38('0x1'));var rp=require(_0x2e38('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2e38('0x3'));var util=require(_0x2e38('0x4'));var path=require(_0x2e38('0x5'));var sox=require(_0x2e38('0x6'));var csv=require(_0x2e38('0x7'));var ejs=require(_0x2e38('0x8'));var fs=require('fs');var fs_extra=require(_0x2e38('0x9'));var _=require(_0x2e38('0xa'));var squel=require(_0x2e38('0xb'));var crypto=require(_0x2e38('0xc'));var jsforce=require(_0x2e38('0xd'));var deskjs=require(_0x2e38('0xe'));var toCsv=require(_0x2e38('0x7'));var querystring=require(_0x2e38('0xf'));var Papa=require(_0x2e38('0x10'));var Redis=require(_0x2e38('0x11'));var authService=require(_0x2e38('0x12'));var qs=require(_0x2e38('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e38('0x14'));var logger=require(_0x2e38('0x15'))(_0x2e38('0x16'));var utils=require(_0x2e38('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2e38('0x18'));var db=require(_0x2e38('0x19'))['db'];config[_0x2e38('0x1a')]=_['defaults'](config[_0x2e38('0x1a')],{'host':_0x2e38('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e38('0x1a')]));require('./chatInternalMessage.socket')[_0x2e38('0x1c')](socket);function respondWithStatusCode(_0x5a7b05,_0x58ea9f){_0x58ea9f=_0x58ea9f||0xcc;return function(_0xf6ca34){if(_0xf6ca34){return _0x5a7b05['sendStatus'](_0x58ea9f);}return _0x5a7b05[_0x2e38('0x1d')](_0x58ea9f)[_0x2e38('0x1e')]();};}function respondWithResult(_0x7fab37,_0x44119c){_0x44119c=_0x44119c||0xc8;return function(_0x2ef2e4){if(_0x2ef2e4){return _0x7fab37['status'](_0x44119c)[_0x2e38('0x1f')](_0x2ef2e4);}};}function respondWithFilteredResult(_0x1d3c4c,_0x10b206){return function(_0x4c827f){if(_0x4c827f){var _0x3427d6=typeof _0x10b206['offset']===_0x2e38('0x20')&&typeof _0x10b206['limit']===_0x2e38('0x20');var _0x2cdc70=_0x4c827f['count'];var _0x554978=_0x3427d6?0x0:_0x10b206[_0x2e38('0x21')];var _0x563e8a=_0x3427d6?_0x4c827f[_0x2e38('0x22')]:_0x10b206['offset']+_0x10b206[_0x2e38('0x23')];var _0x187802;if(_0x563e8a>=_0x2cdc70){_0x563e8a=_0x2cdc70;_0x187802=0xc8;}else{_0x187802=0xce;}_0x1d3c4c[_0x2e38('0x1d')](_0x187802);return _0x1d3c4c[_0x2e38('0x24')](_0x2e38('0x25'),_0x554978+'-'+_0x563e8a+'/'+_0x2cdc70)[_0x2e38('0x1f')](_0x4c827f);}return null;};}function patchUpdates(_0xe72668){return function(_0x444052){try{jsonpatch['apply'](_0x444052,_0xe72668,!![]);}catch(_0x33674c){return BPromise[_0x2e38('0x26')](_0x33674c);}return _0x444052['save']();};}function saveUpdates(_0x10e0a0,_0x4ec0e7){return function(_0x29f3bb){if(_0x29f3bb){return _0x29f3bb[_0x2e38('0x27')](_0x10e0a0)['then'](function(_0x43b1fb){return _0x43b1fb;});}return null;};}function removeEntity(_0x2bdc0c,_0x1e0767){return function(_0x5ac312){if(_0x5ac312){return _0x5ac312[_0x2e38('0x28')]()[_0x2e38('0x29')](function(){_0x2bdc0c[_0x2e38('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4089,_0x323cdd){return function(_0x540ba2){if(!_0x540ba2){_0x5a4089[_0x2e38('0x2a')](0x194);}return _0x540ba2;};}function handleError(_0x58edfe,_0x5a2c78){_0x5a2c78=_0x5a2c78||0x1f4;return function(_0x39894e){logger['error'](_0x39894e['stack']);if(_0x39894e[_0x2e38('0x2b')]){delete _0x39894e[_0x2e38('0x2b')];}_0x58edfe[_0x2e38('0x1d')](_0x5a2c78)[_0x2e38('0x2c')](_0x39894e);};}exports[_0x2e38('0x2d')]=function(_0x1c8a70,_0x342038){var _0x32d678={},_0x28d96d={},_0x496c9c={'count':0x0,'rows':[]};var _0x472a22=_['map'](db[_0x2e38('0x2e')][_0x2e38('0x2f')],function(_0xc465b8){return{'name':_0xc465b8[_0x2e38('0x30')],'type':_0xc465b8[_0x2e38('0x31')][_0x2e38('0x32')]};});_0x28d96d[_0x2e38('0x33')]=_[_0x2e38('0x34')](_0x472a22,_0x2e38('0x2b'));_0x28d96d['query']=_['keys'](_0x1c8a70['query']);_0x28d96d[_0x2e38('0x35')]=_[_0x2e38('0x36')](_0x28d96d[_0x2e38('0x33')],_0x28d96d['query']);_0x32d678['attributes']=_[_0x2e38('0x36')](_0x28d96d['model'],qs[_0x2e38('0x37')](_0x1c8a70['query'][_0x2e38('0x37')]));_0x32d678[_0x2e38('0x38')]=_0x32d678[_0x2e38('0x38')][_0x2e38('0x39')]?_0x32d678['attributes']:_0x28d96d[_0x2e38('0x33')];if(!_0x1c8a70[_0x2e38('0x3a')][_0x2e38('0x3b')](_0x2e38('0x3c'))){_0x32d678[_0x2e38('0x23')]=qs[_0x2e38('0x23')](_0x1c8a70[_0x2e38('0x3a')][_0x2e38('0x23')]);_0x32d678['offset']=qs[_0x2e38('0x21')](_0x1c8a70[_0x2e38('0x3a')][_0x2e38('0x21')]);}_0x32d678['order']=qs[_0x2e38('0x3d')](_0x1c8a70[_0x2e38('0x3a')][_0x2e38('0x3d')]);_0x32d678[_0x2e38('0x3e')]=qs['filters'](_[_0x2e38('0x3f')](_0x1c8a70[_0x2e38('0x3a')],_0x28d96d[_0x2e38('0x35')]),_0x472a22);if(_0x1c8a70[_0x2e38('0x3a')][_0x2e38('0x40')]){_0x32d678[_0x2e38('0x3e')]=_[_0x2e38('0x41')](_0x32d678[_0x2e38('0x3e')],{'$or':_[_0x2e38('0x34')](_0x472a22,function(_0x274f6f){if(_0x274f6f[_0x2e38('0x31')]!==_0x2e38('0x42')){var _0x2a405b={};_0x2a405b[_0x274f6f[_0x2e38('0x2b')]]={'$like':'%'+_0x1c8a70[_0x2e38('0x3a')]['filter']+'%'};return _0x2a405b;}})});}_0x32d678=_['merge']({},_0x32d678,_0x1c8a70[_0x2e38('0x43')]);var _0x11b953={'where':_0x32d678['where']};return db[_0x2e38('0x2e')][_0x2e38('0x22')](_0x11b953)[_0x2e38('0x29')](function(_0x14d728){_0x496c9c[_0x2e38('0x22')]=_0x14d728;if(_0x1c8a70[_0x2e38('0x3a')][_0x2e38('0x44')]){_0x32d678[_0x2e38('0x45')]=[{'all':!![]}];}return db[_0x2e38('0x2e')][_0x2e38('0x46')](_0x32d678);})[_0x2e38('0x29')](function(_0x546c5f){_0x496c9c[_0x2e38('0x47')]=_0x546c5f;return _0x496c9c;})[_0x2e38('0x29')](respondWithFilteredResult(_0x342038,_0x32d678))[_0x2e38('0x48')](handleError(_0x342038,null));};exports[_0x2e38('0x49')]=function(_0x4617a2,_0x541297){var _0x31d4e1={'raw':!![],'where':{'id':_0x4617a2['params']['id']}},_0x5b00f1={};_0x5b00f1[_0x2e38('0x33')]=_[_0x2e38('0x4a')](db[_0x2e38('0x2e')]['rawAttributes']);_0x5b00f1[_0x2e38('0x3a')]=_[_0x2e38('0x4a')](_0x4617a2[_0x2e38('0x3a')]);_0x5b00f1[_0x2e38('0x35')]=_['intersection'](_0x5b00f1[_0x2e38('0x33')],_0x5b00f1[_0x2e38('0x3a')]);_0x31d4e1[_0x2e38('0x38')]=_[_0x2e38('0x36')](_0x5b00f1[_0x2e38('0x33')],qs['fields'](_0x4617a2[_0x2e38('0x3a')][_0x2e38('0x37')]));_0x31d4e1[_0x2e38('0x38')]=_0x31d4e1[_0x2e38('0x38')][_0x2e38('0x39')]?_0x31d4e1['attributes']:_0x5b00f1[_0x2e38('0x33')];if(_0x4617a2[_0x2e38('0x3a')][_0x2e38('0x44')]){_0x31d4e1[_0x2e38('0x45')]=[{'all':!![]}];}_0x31d4e1=_[_0x2e38('0x41')]({},_0x31d4e1,_0x4617a2[_0x2e38('0x43')]);return db['ChatInternalMessage']['find'](_0x31d4e1)[_0x2e38('0x29')](handleEntityNotFound(_0x541297,null))['then'](respondWithResult(_0x541297,null))[_0x2e38('0x48')](handleError(_0x541297,null));};exports[_0x2e38('0x4b')]=function(_0x218138,_0x8df1b6){return db[_0x2e38('0x2e')][_0x2e38('0x4b')](_0x218138[_0x2e38('0x4c')],{})[_0x2e38('0x29')](respondWithResult(_0x8df1b6,0xc9))[_0x2e38('0x48')](handleError(_0x8df1b6,null));};exports[_0x2e38('0x27')]=function(_0x2c841a,_0x307f18){if(_0x2c841a[_0x2e38('0x4c')]['id']){delete _0x2c841a[_0x2e38('0x4c')]['id'];}return db[_0x2e38('0x2e')][_0x2e38('0x4d')]({'where':{'id':_0x2c841a[_0x2e38('0x4e')]['id']}})[_0x2e38('0x29')](handleEntityNotFound(_0x307f18,null))[_0x2e38('0x29')](saveUpdates(_0x2c841a[_0x2e38('0x4c')],null))[_0x2e38('0x29')](respondWithResult(_0x307f18,null))[_0x2e38('0x48')](handleError(_0x307f18,null));};exports[_0x2e38('0x28')]=function(_0x378340,_0x15be55){return db[_0x2e38('0x2e')][_0x2e38('0x4d')]({'where':{'id':_0x378340['params']['id']}})[_0x2e38('0x29')](handleEntityNotFound(_0x15be55,null))['then'](removeEntity(_0x15be55,null))[_0x2e38('0x48')](handleError(_0x15be55,null));};exports['describe']=function(_0x20e03e,_0x5724e0){return db[_0x2e38('0x2e')]['describe']()[_0x2e38('0x29')](respondWithResult(_0x5724e0,null))[_0x2e38('0x48')](handleError(_0x5724e0,null));};function wrapUser(_0xb7acc9){return function(_0xd4082a){var _0x174812=_0xb7acc9['get']({'plain':!![]});_0x174812['messages']=[];if(_0xd4082a){_0x174812[_0x2e38('0x4f')]=_0xd4082a['createdAt'];_0x174812['lastMessage']=_0xd4082a;}else{_0x174812[_0x2e38('0x4f')]=moment(0x0)['format'](_0x2e38('0x50'));_0x174812['lastMessage']={};}return _0x174812;};}exports[_0x2e38('0x51')]=function(_0x4f66ae,_0x2fbf48,_0xd405c2){var _0x29935b=[];return db['User'][_0x2e38('0x46')]({'where':{'role':[_0x2e38('0x52'),_0x2e38('0x53'),_0x2e38('0x54')]},'attributes':['id',_0x2e38('0x55'),_0x2e38('0x2b'),_0x2e38('0x56'),_0x2e38('0x57'),_0x2e38('0x58'),_0x2e38('0x59'),'lastLoginAt',_0x2e38('0x5a'),_0x2e38('0x5b')],'order':qs[_0x2e38('0x3d')](_0x2e38('0x5c')),'include':[{'model':db[_0x2e38('0x5d')],'as':_0x2e38('0x5e'),'attributes':['id',_0x2e38('0x2b'),_0x2e38('0x31')],'through':{'attributes':[]}}]})[_0x2e38('0x29')](function(_0x904954){if(_0x904954){var _0x23ee28=_0x4f66ae[_0x2e38('0x54')]['get']({'plain':!![]});if(!_0x23ee28)throw new Error(_0x2e38('0x5f'));if(_0x23ee28[_0x2e38('0x56')]===_0x2e38('0x54')){return db[_0x2e38('0x60')]['find']({'where':{'name':_0x2e38('0x61'),'userProfileId':_0x23ee28[_0x2e38('0x62')]},'raw':!![]})[_0x2e38('0x29')](function(_0x331c95){if(_0x331c95){if(_0x331c95[_0x2e38('0x63')]===0x0){return db['UserProfileResource'][_0x2e38('0x46')]({'where':{'sectionId':_0x331c95['id']},'raw':!![]})['then'](function(_0xb372ed){var _0x29b443=[];if(_[_0x2e38('0x64')](_0xb372ed)){_0x29b443=_['filter'](_0x904954,function(_0x396cd0){if(_0x396cd0[_0x2e38('0x56')]!==_0x2e38('0x52')){return _0x396cd0;}});return _0x29b443;}else{for(var _0x9fa9fd=0x0;_0x9fa9fd<_0x904954[_0x2e38('0x39')];_0x9fa9fd++){var _0x28b2ef=_0x904954[_0x9fa9fd];if(_0x28b2ef[_0x2e38('0x56')]===_0x2e38('0x52')){var _0x225e2d=_[_0x2e38('0x4d')](_0xb372ed,function(_0x45953b){return _0x45953b[_0x2e38('0x65')]===_0x28b2ef['id'];});if(_0x225e2d)_0x29b443[_0x2e38('0x66')](_0x28b2ef);}else{_0x29b443[_0x2e38('0x66')](_0x28b2ef);}}return _0x29b443;}});}else{return _0x904954;}}else{var _0x3a4889=_['filter'](_0x904954,function(_0x1d1a8b){if(_0x1d1a8b[_0x2e38('0x56')]!==_0x2e38('0x52')){return _0x1d1a8b;}});return _0x3a4889;}});}else{return _0x904954;}}})[_0x2e38('0x29')](function(_0x47fe9c){var _0x1c4406=[];if(_0x47fe9c){_0x29935b=_0x47fe9c;for(var _0x10644b=0x0;_0x10644b<_0x47fe9c['length'];_0x10644b+=0x1){_0x29935b[_0x10644b][_0x2e38('0x67')]=[];_0x1c4406[_0x2e38('0x66')](db[_0x2e38('0x2e')]['find']({'where':{'FromId':[_0x4f66ae[_0x2e38('0x54')]['id'],_0x47fe9c[_0x10644b]['id']],'ToId':[_0x4f66ae['user']['id'],_0x47fe9c[_0x10644b]['id']],'ChatGroupId':null},'attributes':['id',_0x2e38('0x68'),_0x2e38('0x69'),_0x2e38('0x6a'),_0x2e38('0x6b'),_0x2e38('0x4c')],'order':qs[_0x2e38('0x3d')](_0x2e38('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x47fe9c[_0x10644b])));}return BPromise[_0x2e38('0x6d')](_0x1c4406);}return[];})[_0x2e38('0x29')](function(_0x1b0129){return{'rows':_0x1b0129,'count':_0x1b0129[_0x2e38('0x39')]};})[_0x2e38('0x29')](respondWithResult(_0x2fbf48,null))[_0x2e38('0x48')](handleError(_0x2fbf48,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d11e986..07f96ea 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 _0x6ea0=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x396b44,_0x53777a){var _0x170b96=function(_0x17e8eb){while(--_0x17e8eb){_0x396b44['push'](_0x396b44['shift']());}};_0x170b96(++_0x53777a);}(_0x6ea0,0x15a));var _0x06ea=function(_0x2be5b0,_0x4ac547){_0x2be5b0=_0x2be5b0-0x0;var _0x2a16f1=_0x6ea0[_0x2be5b0];return _0x2a16f1;};'use strict';var EventEmitter=require(_0x06ea('0x0'));var ChatInternalMessage=require(_0x06ea('0x1'))['db'][_0x06ea('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x06ea('0x3')](0x0);var events={'afterCreate':_0x06ea('0x4'),'afterUpdate':'update','afterDestroy':_0x06ea('0x5')};function emitEvent(_0x56b5c0){return function(_0x1ac9a3,_0x47e590,_0x53362d){ChatInternalMessageEvents[_0x06ea('0x6')](_0x56b5c0+':'+_0x1ac9a3['id'],_0x1ac9a3);ChatInternalMessageEvents[_0x06ea('0x6')](_0x56b5c0,_0x1ac9a3);_0x53362d(null);};}for(var e in events){if(events[_0x06ea('0x7')](e)){var event=events[e];ChatInternalMessage[_0x06ea('0x8')](e,emitEvent(event));}}module[_0x06ea('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x8a8a=['ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2af20f,_0x5564d6){var _0x281721=function(_0x5b05ca){while(--_0x5b05ca){_0x2af20f['push'](_0x2af20f['shift']());}};_0x281721(++_0x5564d6);}(_0x8a8a,0x1f2));var _0xa8a8=function(_0x56deee,_0x121efd){_0x56deee=_0x56deee-0x0;var _0x1a52fc=_0x8a8a[_0x56deee];return _0x1a52fc;};'use strict';var EventEmitter=require(_0xa8a8('0x0'));var ChatInternalMessage=require(_0xa8a8('0x1'))['db'][_0xa8a8('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa8a8('0x3')](0x0);var events={'afterCreate':_0xa8a8('0x4'),'afterUpdate':'update','afterDestroy':_0xa8a8('0x5')};function emitEvent(_0x4257eb){return function(_0x576d56,_0x26a9b8,_0x3e4ecf){ChatInternalMessageEvents[_0xa8a8('0x6')](_0x4257eb+':'+_0x576d56['id'],_0x576d56);ChatInternalMessageEvents[_0xa8a8('0x6')](_0x4257eb,_0x576d56);_0x3e4ecf(null);};}for(var e in events){if(events[_0xa8a8('0x7')](e)){var event=events[e];ChatInternalMessage[_0xa8a8('0x8')](e,emitEvent(event));}}module[_0xa8a8('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d73a8de..01998eb 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 _0x90c9=['../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0x90c9,0xac));var _0x990c=function(_0x1df803,_0x25192d){_0x1df803=_0x1df803-0x0;var _0x20ef12=_0x90c9[_0x1df803];return _0x20ef12;};'use strict';var _=require(_0x990c('0x0'));var util=require(_0x990c('0x1'));var logger=require('../../config/logger')(_0x990c('0x2'));var moment=require(_0x990c('0x3'));var BPromise=require(_0x990c('0x4'));var rp=require(_0x990c('0x5'));var fs=require('fs');var path=require(_0x990c('0x6'));var rimraf=require(_0x990c('0x7'));var config=require(_0x990c('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0x990c('0x9')]=function(_0x54d885,_0x41093d){return _0x54d885[_0x990c('0xa')](_0x990c('0xb'),attributes,{'tableName':_0x990c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x990c('0xd'),'collate':_0x990c('0xe')});}; \ No newline at end of file +var _0x653a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4269e2,_0x343092){var _0x29641d=function(_0x4036e5){while(--_0x4036e5){_0x4269e2['push'](_0x4269e2['shift']());}};_0x29641d(++_0x343092);}(_0x653a,0x133));var _0xa653=function(_0xf0f9ae,_0x3b02ef){_0xf0f9ae=_0xf0f9ae-0x0;var _0x46b898=_0x653a[_0xf0f9ae];return _0x46b898;};'use strict';var _=require(_0xa653('0x0'));var util=require(_0xa653('0x1'));var logger=require('../../config/logger')(_0xa653('0x2'));var moment=require(_0xa653('0x3'));var BPromise=require(_0xa653('0x4'));var rp=require(_0xa653('0x5'));var fs=require('fs');var path=require(_0xa653('0x6'));var rimraf=require(_0xa653('0x7'));var config=require(_0xa653('0x8'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x50b405,_0x52778d){return _0x50b405[_0xa653('0x9')](_0xa653('0xa'),attributes,{'tableName':_0xa653('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa653('0xc'),'collate':_0xa653('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3d91ec2..10faebc 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 _0x71e2=['client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x40579e,_0x1f4bcc){var _0x406aee=function(_0x149f47){while(--_0x149f47){_0x40579e['push'](_0x40579e['shift']());}};_0x406aee(++_0x1f4bcc);}(_0x71e2,0x1c0));var _0x271e=function(_0x345545,_0x56db52){_0x345545=_0x345545-0x0;var _0x1d24de=_0x71e2[_0x345545];return _0x1d24de;};'use strict';var _=require('lodash');var util=require(_0x271e('0x0'));var moment=require('moment');var BPromise=require(_0x271e('0x1'));var rs=require(_0x271e('0x2'));var fs=require('fs');var Redis=require(_0x271e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x271e('0x4'));var logger=require('../../config/logger')(_0x271e('0x5'));var config=require(_0x271e('0x6'));var jayson=require(_0x271e('0x7'));var client=jayson[_0x271e('0x8')][_0x271e('0x9')]({'port':0x232a});config['redis']=_[_0x271e('0xa')](config[_0x271e('0xb')],{'host':_0x271e('0xc'),'port':0x18eb});var socket=require(_0x271e('0xd'))(new Redis(config[_0x271e('0xb')]));require('./chatInternalMessage.socket')[_0x271e('0xe')](socket);function respondWithRpcPromise(_0x36488f,_0x417cfc,_0x3f2653){return new BPromise(function(_0x369975,_0x22393a){return client[_0x271e('0xf')](_0x36488f,_0x3f2653)[_0x271e('0x10')](function(_0x3bfc74){logger['info'](_0x271e('0x11'),_0x417cfc,_0x271e('0x12'));logger['debug'](_0x271e('0x13'),_0x417cfc,_0x271e('0x12'),JSON[_0x271e('0x14')](_0x3bfc74));if(_0x3bfc74['error']){if(_0x3bfc74['error']['code']===0x1f4){logger[_0x271e('0x15')](_0x271e('0x11'),_0x417cfc,_0x3bfc74['error'][_0x271e('0x16')]);return _0x22393a(_0x3bfc74[_0x271e('0x15')][_0x271e('0x16')]);}logger[_0x271e('0x15')](_0x271e('0x11'),_0x417cfc,_0x3bfc74[_0x271e('0x15')][_0x271e('0x16')]);return _0x369975(_0x3bfc74[_0x271e('0x15')]['message']);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x417cfc,_0x271e('0x12'));_0x369975(_0x3bfc74[_0x271e('0x17')][_0x271e('0x16')]);}})['catch'](function(_0x33c985){logger[_0x271e('0x15')](_0x271e('0x11'),_0x417cfc,_0x33c985);_0x22393a(_0x33c985);});});} \ No newline at end of file +var _0x03cf=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../config/utils'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x03cf,0x64));var _0xf03c=function(_0x383ca6,_0x39dc19){_0x383ca6=_0x383ca6-0x0;var _0x7e0082=_0x03cf[_0x383ca6];return _0x7e0082;};'use strict';var _=require('lodash');var util=require(_0xf03c('0x0'));var moment=require(_0xf03c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf03c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf03c('0x3'));var logger=require('../../config/logger')(_0xf03c('0x4'));var config=require(_0xf03c('0x5'));var jayson=require(_0xf03c('0x6'));var client=jayson['client'][_0xf03c('0x7')]({'port':0x232a});config[_0xf03c('0x8')]=_[_0xf03c('0x9')](config[_0xf03c('0x8')],{'host':_0xf03c('0xa'),'port':0x18eb});var socket=require(_0xf03c('0xb'))(new Redis(config['redis']));require(_0xf03c('0xc'))[_0xf03c('0xd')](socket);function respondWithRpcPromise(_0x1713d6,_0x17ff63,_0x15d5c6){return new BPromise(function(_0x36c6c3,_0xa50ef){return client[_0xf03c('0xe')](_0x1713d6,_0x15d5c6)[_0xf03c('0xf')](function(_0x30e960){logger[_0xf03c('0x10')](_0xf03c('0x11'),_0x17ff63,_0xf03c('0x12'));logger['debug'](_0xf03c('0x13'),_0x17ff63,_0xf03c('0x12'),JSON[_0xf03c('0x14')](_0x30e960));if(_0x30e960[_0xf03c('0x15')]){if(_0x30e960['error'][_0xf03c('0x16')]===0x1f4){logger[_0xf03c('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x17ff63,_0x30e960[_0xf03c('0x15')][_0xf03c('0x17')]);return _0xa50ef(_0x30e960[_0xf03c('0x15')]['message']);}logger[_0xf03c('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x17ff63,_0x30e960[_0xf03c('0x15')][_0xf03c('0x17')]);return _0x36c6c3(_0x30e960['error']['message']);}else{logger['info'](_0xf03c('0x11'),_0x17ff63,_0xf03c('0x12'));_0x36c6c3(_0x30e960[_0xf03c('0x18')]['message']);}})[_0xf03c('0x19')](function(_0x3eb515){logger[_0xf03c('0x15')](_0xf03c('0x11'),_0x17ff63,_0x3eb515);_0xa50ef(_0x3eb515);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d19228c..c33fd1b 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 _0x6046=['./chatInternalMessage.events','remove','update','emit','register','length','chatInternalMessage:'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x6046,0x85));var _0x6604=function(_0x332140,_0x5ce7ef){_0x332140=_0x332140-0x0;var _0x50768c=_0x6046[_0x332140];return _0x50768c;};'use strict';var ChatInternalMessageEvents=require(_0x6604('0x0'));var events=['save',_0x6604('0x1'),_0x6604('0x2')];function createListener(_0x401af7,_0xe8f637){return function(_0x3e760e){_0xe8f637[_0x6604('0x3')](_0x401af7,_0x3e760e);};}function removeListener(_0x1e565c,_0x4d3036){return function(){ChatInternalMessageEvents['removeListener'](_0x1e565c,_0x4d3036);};}exports[_0x6604('0x4')]=function(_0x1342a9){for(var _0x15dbec=0x0,_0x289de4=events[_0x6604('0x5')];_0x15dbec<_0x289de4;_0x15dbec++){var _0x429141=events[_0x15dbec];var _0x32abd6=createListener(_0x6604('0x6')+_0x429141,_0x1342a9);ChatInternalMessageEvents['on'](_0x429141,_0x32abd6);}}; \ No newline at end of file +var _0x2c9d=['./chatInternalMessage.events','remove','emit','removeListener','length','chatInternalMessage:'];(function(_0x467b25,_0x14a29a){var _0x2ad500=function(_0x301649){while(--_0x301649){_0x467b25['push'](_0x467b25['shift']());}};_0x2ad500(++_0x14a29a);}(_0x2c9d,0x90));var _0xd2c9=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x2c9d[_0x2df507];return _0x1f7167;};'use strict';var ChatInternalMessageEvents=require(_0xd2c9('0x0'));var events=['save',_0xd2c9('0x1'),'update'];function createListener(_0x2b1376,_0x4a80c5){return function(_0x265d23){_0x4a80c5[_0xd2c9('0x2')](_0x2b1376,_0x265d23);};}function removeListener(_0x1a1cdb,_0x4ca468){return function(){ChatInternalMessageEvents[_0xd2c9('0x3')](_0x1a1cdb,_0x4ca468);};}exports['register']=function(_0x4ac6c2){for(var _0x81ff9b=0x0,_0x244c12=events[_0xd2c9('0x4')];_0x81ff9b<_0x244c12;_0x81ff9b++){var _0x44188c=events[_0x81ff9b];var _0x21fadd=createListener(_0xd2c9('0x5')+_0x44188c,_0x4ac6c2);ChatInternalMessageEvents['on'](_0x44188c,_0x21fadd);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 746ce18..e82116d 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 _0xff86=['../../config/environment','get','isAuthenticated','index','/describe','getUsers','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xff86,0x173));var _0x6ff8=function(_0x6c9577,_0x3942ad){_0x6c9577=_0x6c9577-0x0;var _0x2e397f=_0xff86[_0x6c9577];return _0x2e397f;};'use strict';var multer=require(_0x6ff8('0x0'));var util=require(_0x6ff8('0x1'));var path=require(_0x6ff8('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ff8('0x3'));var router=express[_0x6ff8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ff8('0x5'));var interaction=require(_0x6ff8('0x6'));var config=require(_0x6ff8('0x7'));var controller=require('./chatInternalMessage.controller');router[_0x6ff8('0x8')]('/',auth[_0x6ff8('0x9')](),controller[_0x6ff8('0xa')]);router['get'](_0x6ff8('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/users',auth[_0x6ff8('0x9')](),controller[_0x6ff8('0xc')]);router[_0x6ff8('0x8')]('/:id',auth[_0x6ff8('0x9')](),controller[_0x6ff8('0xd')]);router[_0x6ff8('0xe')]('/',auth[_0x6ff8('0x9')](),controller[_0x6ff8('0xf')]);router[_0x6ff8('0x10')](_0x6ff8('0x11'),controller[_0x6ff8('0x12')]);router[_0x6ff8('0x13')](_0x6ff8('0x11'),auth['isAuthenticated'](),controller[_0x6ff8('0x14')]);module['exports']=router; \ No newline at end of file +var _0x50ec=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','getUsers','/:id','show','create','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x50ec,0x189));var _0xc50e=function(_0x2615e6,_0x3ef965){_0x2615e6=_0x2615e6-0x0;var _0x315886=_0x50ec[_0x2615e6];return _0x315886;};'use strict';var multer=require('multer');var util=require(_0xc50e('0x0'));var path=require('path');var timeout=require(_0xc50e('0x1'));var express=require(_0xc50e('0x2'));var router=express[_0xc50e('0x3')]();var fs_extra=require(_0xc50e('0x4'));var auth=require(_0xc50e('0x5'));var interaction=require(_0xc50e('0x6'));var config=require(_0xc50e('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xc50e('0x8')]('/',auth[_0xc50e('0x9')](),controller[_0xc50e('0xa')]);router[_0xc50e('0x8')]('/describe',auth[_0xc50e('0x9')](),controller[_0xc50e('0xb')]);router[_0xc50e('0x8')]('/users',auth['isAuthenticated'](),controller[_0xc50e('0xc')]);router[_0xc50e('0x8')](_0xc50e('0xd'),auth[_0xc50e('0x9')](),controller[_0xc50e('0xe')]);router['post']('/',auth[_0xc50e('0x9')](),controller[_0xc50e('0xf')]);router['put'](_0xc50e('0xd'),controller['update']);router[_0xc50e('0x10')](_0xc50e('0xd'),auth[_0xc50e('0x9')](),controller[_0xc50e('0x11')]);module[_0xc50e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 78ba780..d282516 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 _0x93e9=['BOOLEAN','ENUM','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x43d08c,_0x1c6410){var _0x206279=function(_0x58a1c8){while(--_0x58a1c8){_0x43d08c['push'](_0x43d08c['shift']());}};_0x206279(++_0x1c6410);}(_0x93e9,0xcc));var _0x993e=function(_0x503350,_0x3fbbb8){_0x503350=_0x503350-0x0;var _0x49e615=_0x93e9[_0x503350];return _0x49e615;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'body':{'type':Sequelize[_0x993e('0x2')](_0x993e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x993e('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x993e('0x6')]},'providerName':{'type':Sequelize[_0x993e('0x7')]},'providerResponse':{'type':Sequelize[_0x993e('0x2')]}}; \ No newline at end of file +var _0x235b=['out','STRING','TEXT','sequelize','medium','BOOLEAN','ENUM'];(function(_0x3c3e48,_0x51d19f){var _0x1982eb=function(_0x4b1b45){while(--_0x4b1b45){_0x3c3e48['push'](_0x3c3e48['shift']());}};_0x1982eb(++_0x51d19f);}(_0x235b,0x1ed));var _0xb235=function(_0xd5e4d4,_0x50c61a){_0xd5e4d4=_0xd5e4d4-0x0;var _0x35181=_0x235b[_0xd5e4d4];return _0x35181;};'use strict';var Sequelize=require(_0xb235('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xb235('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xb235('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb235('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb235('0x3')]('in',_0xb235('0x4')),'defaultValue':_0xb235('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb235('0x5')]},'providerResponse':{'type':Sequelize[_0xb235('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 1e5173f..db0f6f1 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 _0x8398=['options','ChatMessage','rows','show','params','includeAll','find','create','body','describe','../../config/logger','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','formData','null','rejectMessage','Sequelize','interface','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','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','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8398,0xb5));var _0x8839=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x8398[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0x8839('0x0'));var rimraf=require(_0x8839('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8839('0x2'));var rp=require(_0x8839('0x3'));var moment=require(_0x8839('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8839('0x5'));var util=require(_0x8839('0x6'));var path=require(_0x8839('0x7'));var sox=require(_0x8839('0x8'));var csv=require(_0x8839('0x9'));var ejs=require(_0x8839('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8839('0xb'));var squel=require('squel');var crypto=require(_0x8839('0xc'));var jsforce=require(_0x8839('0xd'));var deskjs=require(_0x8839('0xe'));var toCsv=require(_0x8839('0x9'));var querystring=require(_0x8839('0xf'));var Papa=require(_0x8839('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8839('0x11'));var as=require(_0x8839('0x12'));var hardwareService=require(_0x8839('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8839('0x14'));var config=require(_0x8839('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8839('0x16')](config[_0x8839('0x17')],{'host':_0x8839('0x18'),'port':0x18eb});var socket=require(_0x8839('0x19'))(new Redis(config[_0x8839('0x17')]));require(_0x8839('0x1a'))[_0x8839('0x1b')](socket);var jayson=require(_0x8839('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8839('0x1d')][_0x8839('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x117568,_0x98d944,_0x408240,_0xfc0954){return new BPromise(function(_0x4e4e25,_0x17976c){var _0x47501b=_0xfc0954||client;return _0x47501b['request'](_0x117568,_0x408240)[_0x8839('0x1f')](function(_0xc9e7b4){logger[_0x8839('0x20')](_0x8839('0x21'),_0x98d944,_0x8839('0x22'));logger[_0x8839('0x23')](_0x8839('0x24'),_0x98d944,_0x8839('0x22'),JSON[_0x8839('0x25')](_0xc9e7b4));if(_0xc9e7b4['error']){if(_0xc9e7b4[_0x8839('0x26')][_0x8839('0x27')]===0x1f4){logger[_0x8839('0x26')](_0x8839('0x21'),_0x98d944,_0xc9e7b4[_0x8839('0x26')][_0x8839('0x28')]);return _0x17976c(_0xc9e7b4['error'][_0x8839('0x28')]);}logger[_0x8839('0x26')]('ChatMessage,\x20%s,\x20%s',_0x98d944,_0xc9e7b4['error']['message']);return _0x4e4e25(_0xc9e7b4['error'][_0x8839('0x28')]);}else{logger[_0x8839('0x20')](_0x8839('0x21'),_0x98d944,_0x8839('0x22'));_0x4e4e25(_0xc9e7b4['result'][_0x8839('0x28')]);}})[_0x8839('0x29')](function(_0x417377){logger[_0x8839('0x26')](_0x8839('0x21'),_0x98d944,_0x417377);_0x17976c(_0x417377);});});}function respondWithStatusCode(_0x28ede0,_0x144455){_0x144455=_0x144455||0xcc;return function(_0x152295){if(_0x152295){return _0x28ede0[_0x8839('0x2a')](_0x144455);}return _0x28ede0[_0x8839('0x2b')](_0x144455)[_0x8839('0x2c')]();};}function respondWithResult(_0x857ad5,_0x58c299){_0x58c299=_0x58c299||0xc8;return function(_0x1cead3){if(_0x1cead3){return _0x857ad5[_0x8839('0x2b')](_0x58c299)[_0x8839('0x2d')](_0x1cead3);}};}function respondWithFilteredResult(_0x4126ff,_0x520efa){return function(_0x2ea645){if(_0x2ea645){var _0x16c200=typeof _0x520efa[_0x8839('0x2e')]===_0x8839('0x2f')&&typeof _0x520efa[_0x8839('0x30')]===_0x8839('0x2f');var _0x4243d8=_0x2ea645['count'];var _0x5a845b=_0x16c200?0x0:_0x520efa[_0x8839('0x2e')];var _0x264013=_0x16c200?_0x2ea645[_0x8839('0x31')]:_0x520efa[_0x8839('0x2e')]+_0x520efa['limit'];var _0x3399e4;if(_0x264013>=_0x4243d8){_0x264013=_0x4243d8;_0x3399e4=0xc8;}else{_0x3399e4=0xce;}_0x4126ff[_0x8839('0x2b')](_0x3399e4);return _0x4126ff['set'](_0x8839('0x32'),_0x5a845b+'-'+_0x264013+'/'+_0x4243d8)[_0x8839('0x2d')](_0x2ea645);}return null;};}function patchUpdates(_0xdd08cf){return function(_0x238649){try{jsonpatch[_0x8839('0x33')](_0x238649,_0xdd08cf,!![]);}catch(_0x49f92b){return BPromise[_0x8839('0x34')](_0x49f92b);}return _0x238649[_0x8839('0x35')]();};}function saveUpdates(_0xe4a902,_0x3242ed){return function(_0x39f904){if(_0x39f904){return _0x39f904[_0x8839('0x36')](_0xe4a902)['then'](function(_0x204d80){return _0x204d80;});}return null;};}function removeEntity(_0x415997,_0xfff4e2){return function(_0xb00e5e){if(_0xb00e5e){return _0xb00e5e[_0x8839('0x37')]()[_0x8839('0x1f')](function(){_0x415997[_0x8839('0x2b')](0xcc)[_0x8839('0x2c')]();});}};}function handleEntityNotFound(_0x1acf8d,_0x227d33){return function(_0x13d560){if(!_0x13d560){_0x1acf8d[_0x8839('0x2a')](0x194);}return _0x13d560;};}function handleError(_0x403bcf,_0x32ea5a){_0x32ea5a=_0x32ea5a||0x1f4;return function(_0x506864){logger[_0x8839('0x26')](_0x506864['stack']);if(_0x506864[_0x8839('0x38')]){delete _0x506864[_0x8839('0x38')];}_0x403bcf[_0x8839('0x2b')](_0x32ea5a)['send'](_0x506864);};}exports[_0x8839('0x39')]=function(_0x453266,_0x47f40d){var _0x3f49ea={},_0x1524f8={},_0x53814a={'count':0x0,'rows':[]};var _0x3826c3=_[_0x8839('0x3a')](db['ChatMessage'][_0x8839('0x3b')],function(_0x9c2029){return{'name':_0x9c2029['fieldName'],'type':_0x9c2029[_0x8839('0x3c')][_0x8839('0x3d')]};});_0x1524f8[_0x8839('0x3e')]=_[_0x8839('0x3a')](_0x3826c3,_0x8839('0x38'));_0x1524f8[_0x8839('0x3f')]=_[_0x8839('0x40')](_0x453266[_0x8839('0x3f')]);_0x1524f8['filters']=_['intersection'](_0x1524f8['model'],_0x1524f8[_0x8839('0x3f')]);_0x3f49ea[_0x8839('0x41')]=_[_0x8839('0x42')](_0x1524f8['model'],qs['fields'](_0x453266[_0x8839('0x3f')][_0x8839('0x43')]));_0x3f49ea['attributes']=_0x3f49ea[_0x8839('0x41')][_0x8839('0x44')]?_0x3f49ea[_0x8839('0x41')]:_0x1524f8[_0x8839('0x3e')];if(!_0x453266[_0x8839('0x3f')][_0x8839('0x45')](_0x8839('0x46'))){_0x3f49ea['limit']=qs[_0x8839('0x30')](_0x453266[_0x8839('0x3f')][_0x8839('0x30')]);_0x3f49ea['offset']=qs['offset'](_0x453266[_0x8839('0x3f')]['offset']);}_0x3f49ea[_0x8839('0x47')]=qs['sort'](_0x453266[_0x8839('0x3f')][_0x8839('0x48')]);_0x3f49ea[_0x8839('0x49')]=qs[_0x8839('0x4a')](_[_0x8839('0x4b')](_0x453266[_0x8839('0x3f')],_0x1524f8[_0x8839('0x4a')]),_0x3826c3);if(_0x453266[_0x8839('0x3f')][_0x8839('0x4c')]){_0x3f49ea[_0x8839('0x49')]=_[_0x8839('0x4d')](_0x3f49ea[_0x8839('0x49')],{'$or':_[_0x8839('0x3a')](_0x3826c3,function(_0x2eff03){if(_0x2eff03[_0x8839('0x3c')]!==_0x8839('0x4e')){var _0x584564={};_0x584564[_0x2eff03[_0x8839('0x38')]]={'$like':'%'+_0x453266[_0x8839('0x3f')][_0x8839('0x4c')]+'%'};return _0x584564;}})});}_0x3f49ea=_['merge']({},_0x3f49ea,_0x453266[_0x8839('0x4f')]);var _0x2770be={'where':_0x3f49ea[_0x8839('0x49')]};return db[_0x8839('0x50')][_0x8839('0x31')](_0x2770be)['then'](function(_0x322b77){_0x53814a[_0x8839('0x31')]=_0x322b77;if(_0x453266['query']['includeAll']){_0x3f49ea['include']=[{'all':!![]}];}return db[_0x8839('0x50')]['findAll'](_0x3f49ea);})['then'](function(_0x1f9562){_0x53814a[_0x8839('0x51')]=_0x1f9562;return _0x53814a;})[_0x8839('0x1f')](respondWithFilteredResult(_0x47f40d,_0x3f49ea))[_0x8839('0x29')](handleError(_0x47f40d,null));};exports[_0x8839('0x52')]=function(_0x23ab16,_0x53af23){var _0x1c2f97={'raw':!![],'where':{'id':_0x23ab16[_0x8839('0x53')]['id']}},_0x878f3c={};_0x878f3c['model']=_[_0x8839('0x40')](db['ChatMessage'][_0x8839('0x3b')]);_0x878f3c['query']=_['keys'](_0x23ab16[_0x8839('0x3f')]);_0x878f3c[_0x8839('0x4a')]=_[_0x8839('0x42')](_0x878f3c[_0x8839('0x3e')],_0x878f3c['query']);_0x1c2f97[_0x8839('0x41')]=_[_0x8839('0x42')](_0x878f3c[_0x8839('0x3e')],qs[_0x8839('0x43')](_0x23ab16[_0x8839('0x3f')][_0x8839('0x43')]));_0x1c2f97[_0x8839('0x41')]=_0x1c2f97[_0x8839('0x41')][_0x8839('0x44')]?_0x1c2f97['attributes']:_0x878f3c[_0x8839('0x3e')];if(_0x23ab16[_0x8839('0x3f')][_0x8839('0x54')]){_0x1c2f97['include']=[{'all':!![]}];}_0x1c2f97=_[_0x8839('0x4d')]({},_0x1c2f97,_0x23ab16[_0x8839('0x4f')]);return db[_0x8839('0x50')][_0x8839('0x55')](_0x1c2f97)[_0x8839('0x1f')](handleEntityNotFound(_0x53af23,null))[_0x8839('0x1f')](respondWithResult(_0x53af23,null))['catch'](handleError(_0x53af23,null));};exports['create']=function(_0x32f83e,_0x12c5fc){return db[_0x8839('0x50')][_0x8839('0x56')](_0x32f83e[_0x8839('0x57')],{})[_0x8839('0x1f')](respondWithResult(_0x12c5fc,0xc9))['catch'](handleError(_0x12c5fc,null));};exports[_0x8839('0x36')]=function(_0x38ad55,_0x4c7dbd){if(_0x38ad55[_0x8839('0x57')]['id']){delete _0x38ad55['body']['id'];}return db['ChatMessage'][_0x8839('0x55')]({'where':{'id':_0x38ad55[_0x8839('0x53')]['id']}})[_0x8839('0x1f')](handleEntityNotFound(_0x4c7dbd,null))[_0x8839('0x1f')](saveUpdates(_0x38ad55[_0x8839('0x57')],null))[_0x8839('0x1f')](respondWithResult(_0x4c7dbd,null))[_0x8839('0x29')](handleError(_0x4c7dbd,null));};exports[_0x8839('0x37')]=function(_0x182c5b,_0x1f376e){return db[_0x8839('0x50')][_0x8839('0x55')]({'where':{'id':_0x182c5b[_0x8839('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f376e,null))['then'](removeEntity(_0x1f376e,null))[_0x8839('0x29')](handleError(_0x1f376e,null));};exports[_0x8839('0x58')]=function(_0x5d3b44,_0x5cb9e1){return db[_0x8839('0x50')]['describe']()[_0x8839('0x1f')](respondWithResult(_0x5cb9e1,null))['catch'](handleError(_0x5cb9e1,null));};var interaction_log=require(_0x8839('0x59'))(_0x8839('0x5a'));exports['accept']=function(_0x1b13f8,_0x2d2154,_0x23e7f4){var _0x3038eb={'agent':{},'channel':_0x8839('0x5b')};if(_0x1b13f8[_0x8839('0x57')]['id']){delete _0x1b13f8['body']['id'];}_0x1b13f8[_0x8839('0x57')]['read']=!![];_0x1b13f8[_0x8839('0x57')][_0x8839('0x5c')]=moment()[_0x8839('0x5d')](_0x8839('0x5e'));_0x1b13f8['body'][_0x8839('0x5f')]=_0x1b13f8[_0x8839('0x57')]['UserId']||_0x1b13f8[_0x8839('0x60')]['id'];_0x3038eb[_0x8839('0x61')]['id']=_0x1b13f8['body']['UserId'];return db['ChatMessage'][_0x8839('0x55')]({'where':{'id':_0x1b13f8[_0x8839('0x53')]['id'],'UserId':null}})[_0x8839('0x1f')](handleEntityNotFound(_0x2d2154,null))[_0x8839('0x1f')](saveUpdates(_0x1b13f8[_0x8839('0x57')],null))[_0x8839('0x1f')](function(_0x5064a8){if(_0x5064a8){_0x3038eb[_0x8839('0x28')]=_0x5064a8['get']({'plain':!![]});return db[_0x8839('0x62')][_0x8839('0x55')]({'where':{'id':_0x5064a8[_0x8839('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2d2154,null))[_0x8839('0x1f')](function(_0x3f8460){if(_0x3f8460){return _0x3f8460[_0x8839('0x36')]({'UserId':_0x1b13f8[_0x8839('0x57')]['UserId'],'read1stAt':_[_0x8839('0x64')](_0x3f8460[_0x8839('0x65')])?moment()[_0x8839('0x5d')](_0x8839('0x5e')):undefined});}return null;})[_0x8839('0x1f')](function(_0x1fe42b){if(_0x1fe42b){_0x3038eb[_0x8839('0x66')]=_0x1fe42b[_0x8839('0x67')]({'plain':!![]});interaction_log[_0x8839('0x20')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b13f8[_0x8839('0x60')]['id'],_0x1b13f8[_0x8839('0x60')][_0x8839('0x38')],_0x1b13f8['user'][_0x8839('0x68')],_0x3038eb[_0x8839('0x66')]['id'],_0x1b13f8[_0x8839('0x57')]?JSON[_0x8839('0x25')](_0x1b13f8[_0x8839('0x57')]):'null');return respondWithRpcPromise(_0x8839('0x69'),_0x8839('0x6a'),_0x3038eb);}return null;})['then'](function(_0x4ca5bd){var _0x34b504=_0x8839('0x6b')+_0x4ca5bd[_0x8839('0x28')][_0x8839('0x6c')];return db[_0x8839('0x6d')][_0x8839('0x3f')](_0x34b504,{'type':db['Sequelize'][_0x8839('0x6e')][_0x8839('0x6f')],'raw':!![]})[_0x8839('0x1f')](function(_0x347b8f){return _0x347b8f;});})[_0x8839('0x1f')](function(_0x4d63dc){if(_0x4d63dc){_0x3038eb[_0x8839('0x28')][_0x8839('0x70')]=_0x4d63dc[0x0];if(!_0x1b13f8['body'][_0x8839('0x5f')])return;return db[_0x8839('0x71')][_0x8839('0x55')]({'where':{'id':_0x1b13f8[_0x8839('0x57')]['UserId'],'role':_0x8839('0x61')},'attributes':['id','name','fullname',_0x8839('0x72'),_0x8839('0x73')],'raw':!![]});}return null;})[_0x8839('0x1f')](function(_0x4ec116){if(!_0x4ec116)return null;_0x3038eb[_0x8839('0x28')][_0x8839('0x61')]=_0x4ec116;return _0x3038eb;})[_0x8839('0x1f')](function(_0x196b9d){if(_0x196b9d){if(_0x1b13f8['body'][_0x8839('0x74')]){_0x3038eb['message']['interface']=util[_0x8839('0x5d')](_0x8839('0x75'),_0x1b13f8[_0x8839('0x60')][_0x8839('0x38')]);_0x3038eb[_0x8839('0x28')][_0x8839('0x76')]=_0x3038eb[_0x8839('0x76')];_0x3038eb[_0x8839('0x28')][_0x8839('0x77')]=_0x3038eb['channel'];_0x3038eb[_0x8839('0x28')][_0x8839('0x78')]=_0x8839('0x79');return respondWithRpcPromise('EventManager',_0x8839('0x7a'),{'event':_0x8839('0x7b'),'message':_[_0x8839('0x4d')](_0x3038eb[_0x8839('0x28')],JSON['parse'](_0x3038eb[_0x8839('0x66')][_0x8839('0x7c')]))},client9002)[_0x8839('0x1f')](function(){return _0x3038eb;});}return _0x3038eb;}return null;})['then'](respondWithResult(_0x2d2154,null))[_0x8839('0x29')](handleError(_0x2d2154,null));};var interaction_log=require('../../config/logger')(_0x8839('0x5a'));exports[_0x8839('0x34')]=function(_0x535248,_0x5aec92,_0x536e63){var _0x5ce994={'agent':{},'channel':_0x8839('0x5b')};if(_0x535248[_0x8839('0x57')]['id']){delete _0x535248['body']['id'];}_0x535248[_0x8839('0x57')][_0x8839('0x5f')]=_0x535248['body']['UserId']||_0x535248[_0x8839('0x60')]['id'];_0x5ce994[_0x8839('0x61')]['id']=_0x535248['body']['UserId'];return db['ChatMessage'][_0x8839('0x55')]({'where':{'id':_0x535248['params']['id'],'UserId':null}})[_0x8839('0x1f')](handleEntityNotFound(_0x5aec92,null))[_0x8839('0x1f')](function(_0x22349b){if(_0x22349b){_0x5ce994[_0x8839('0x28')]=_0x22349b[_0x8839('0x67')]({'plain':!![]});return db[_0x8839('0x62')][_0x8839('0x55')]({'where':{'id':_0x22349b[_0x8839('0x63')]}});}return null;})[_0x8839('0x1f')](handleEntityNotFound(_0x5aec92,null))[_0x8839('0x1f')](function(_0x6d6260){if(_0x6d6260){_0x5ce994['interaction']=_0x6d6260[_0x8839('0x67')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x535248[_0x8839('0x60')]['id'],_0x535248['user'][_0x8839('0x38')],_0x535248['user'][_0x8839('0x68')],_0x5ce994['interaction']['id'],_0x535248['body']?JSON[_0x8839('0x25')](_0x535248[_0x8839('0x57')]):_0x8839('0x7d'));return respondWithRpcPromise('RejectMessage',_0x8839('0x7e'),_0x5ce994);}return null;})[_0x8839('0x1f')](function(_0x590c0c){var _0x31c0f2=_0x8839('0x6b')+_0x590c0c[_0x8839('0x28')]['ContactId'];return db['sequelize'][_0x8839('0x3f')](_0x31c0f2,{'type':db[_0x8839('0x7f')][_0x8839('0x6e')][_0x8839('0x6f')],'raw':!![]})[_0x8839('0x1f')](function(_0x13a66d){return _0x13a66d;});})['then'](function(_0x1d8d7d){if(_0x1d8d7d){_0x5ce994[_0x8839('0x28')][_0x8839('0x70')]=_0x1d8d7d[0x0];if(!_0x535248[_0x8839('0x57')][_0x8839('0x5f')])return;return db[_0x8839('0x71')][_0x8839('0x55')]({'where':{'id':_0x535248[_0x8839('0x57')]['UserId'],'role':_0x8839('0x61')},'attributes':['id','name','fullname',_0x8839('0x72'),_0x8839('0x73')],'raw':!![]});}return null;})[_0x8839('0x1f')](function(_0x461fba){if(!_0x461fba)return null;_0x5ce994[_0x8839('0x28')][_0x8839('0x61')]=_0x461fba;return _0x5ce994;})[_0x8839('0x1f')](function(_0x71bae9){if(_0x71bae9){_0x71bae9[_0x8839('0x28')][_0x8839('0x80')]=util['format'](_0x8839('0x75'),_0x535248['user'][_0x8839('0x38')]);_0x71bae9[_0x8839('0x28')][_0x8839('0x76')]=_0x5ce994['channel'];_0x71bae9['message'][_0x8839('0x77')]=_0x5ce994[_0x8839('0x76')];_0x71bae9[_0x8839('0x28')][_0x8839('0x78')]=_0x8839('0x34');respondWithRpcPromise(_0x8839('0x7a'),_0x8839('0x7a'),{'event':_0x8839('0x81'),'message':_[_0x8839('0x4d')](_0x5ce994[_0x8839('0x28')],JSON['parse'](_0x5ce994[_0x8839('0x66')][_0x8839('0x7c')]))},client9002);return _0x5ce994;}return null;})['then'](respondWithResult(_0x5aec92,null))[_0x8839('0x29')](handleError(_0x5aec92,null));}; \ No newline at end of file +var _0x363c=['role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','name','send','index','map','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','ChatMessage','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','find','body','describe','../../config/logger','chat-interactions','accept','chat','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x363c,0x1a0));var _0xc363=function(_0x4a23ca,_0x47836b){_0x4a23ca=_0x4a23ca-0x0;var _0x39f446=_0x363c[_0x4a23ca];return _0x39f446;};'use strict';var emlformat=require(_0xc363('0x0'));var rimraf=require(_0xc363('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc363('0x2'));var rp=require(_0xc363('0x3'));var moment=require(_0xc363('0x4'));var BPromise=require(_0xc363('0x5'));var Mustache=require(_0xc363('0x6'));var util=require(_0xc363('0x7'));var path=require('path');var sox=require(_0xc363('0x8'));var csv=require(_0xc363('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc363('0xa'));var _=require(_0xc363('0xb'));var squel=require(_0xc363('0xc'));var crypto=require(_0xc363('0xd'));var jsforce=require(_0xc363('0xe'));var deskjs=require(_0xc363('0xf'));var toCsv=require(_0xc363('0x9'));var querystring=require('querystring');var Papa=require(_0xc363('0x10'));var Redis=require(_0xc363('0x11'));var authService=require(_0xc363('0x12'));var qs=require(_0xc363('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc363('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc363('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc363('0x16')]=_[_0xc363('0x17')](config[_0xc363('0x16')],{'host':_0xc363('0x18'),'port':0x18eb});var socket=require(_0xc363('0x19'))(new Redis(config[_0xc363('0x16')]));require('./chatMessage.socket')[_0xc363('0x1a')](socket);var jayson=require(_0xc363('0x1b'));var client=jayson[_0xc363('0x1c')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4346fd,_0x1a7d32,_0x1d6895,_0x3e33b8){return new BPromise(function(_0xd41e6f,_0x1d976b){var _0x382ea=_0x3e33b8||client;return _0x382ea['request'](_0x4346fd,_0x1d6895)['then'](function(_0x556bcf){logger[_0xc363('0x1d')](_0xc363('0x1e'),_0x1a7d32,'request\x20sent');logger['debug'](_0xc363('0x1f'),_0x1a7d32,_0xc363('0x20'),JSON[_0xc363('0x21')](_0x556bcf));if(_0x556bcf['error']){if(_0x556bcf['error'][_0xc363('0x22')]===0x1f4){logger['error'](_0xc363('0x1e'),_0x1a7d32,_0x556bcf['error']['message']);return _0x1d976b(_0x556bcf[_0xc363('0x23')]['message']);}logger[_0xc363('0x23')](_0xc363('0x1e'),_0x1a7d32,_0x556bcf[_0xc363('0x23')]['message']);return _0xd41e6f(_0x556bcf[_0xc363('0x23')][_0xc363('0x24')]);}else{logger[_0xc363('0x1d')](_0xc363('0x1e'),_0x1a7d32,'request\x20sent');_0xd41e6f(_0x556bcf[_0xc363('0x25')][_0xc363('0x24')]);}})[_0xc363('0x26')](function(_0x58fd82){logger[_0xc363('0x23')](_0xc363('0x1e'),_0x1a7d32,_0x58fd82);_0x1d976b(_0x58fd82);});});}function respondWithStatusCode(_0x5f15f8,_0xecb301){_0xecb301=_0xecb301||0xcc;return function(_0x22ee06){if(_0x22ee06){return _0x5f15f8[_0xc363('0x27')](_0xecb301);}return _0x5f15f8[_0xc363('0x28')](_0xecb301)[_0xc363('0x29')]();};}function respondWithResult(_0x21e95e,_0x118500){_0x118500=_0x118500||0xc8;return function(_0x376f46){if(_0x376f46){return _0x21e95e[_0xc363('0x28')](_0x118500)[_0xc363('0x2a')](_0x376f46);}};}function respondWithFilteredResult(_0x3d1358,_0x27803c){return function(_0x22f4ec){if(_0x22f4ec){var _0x19570b=typeof _0x27803c[_0xc363('0x2b')]===_0xc363('0x2c')&&typeof _0x27803c[_0xc363('0x2d')]===_0xc363('0x2c');var _0xb1edf9=_0x22f4ec[_0xc363('0x2e')];var _0x17cd50=_0x19570b?0x0:_0x27803c['offset'];var _0x474b49=_0x19570b?_0x22f4ec[_0xc363('0x2e')]:_0x27803c[_0xc363('0x2b')]+_0x27803c[_0xc363('0x2d')];var _0x922c42;if(_0x474b49>=_0xb1edf9){_0x474b49=_0xb1edf9;_0x922c42=0xc8;}else{_0x922c42=0xce;}_0x3d1358[_0xc363('0x28')](_0x922c42);return _0x3d1358[_0xc363('0x2f')]('Content-Range',_0x17cd50+'-'+_0x474b49+'/'+_0xb1edf9)['json'](_0x22f4ec);}return null;};}function patchUpdates(_0x2736a5){return function(_0x12e5c0){try{jsonpatch[_0xc363('0x30')](_0x12e5c0,_0x2736a5,!![]);}catch(_0x146968){return BPromise[_0xc363('0x31')](_0x146968);}return _0x12e5c0[_0xc363('0x32')]();};}function saveUpdates(_0xe269c6,_0xdaa9b8){return function(_0x1e6b2f){if(_0x1e6b2f){return _0x1e6b2f[_0xc363('0x33')](_0xe269c6)['then'](function(_0x124765){return _0x124765;});}return null;};}function removeEntity(_0x577feb,_0x1d1772){return function(_0x11a1a7){if(_0x11a1a7){return _0x11a1a7[_0xc363('0x34')]()[_0xc363('0x35')](function(){_0x577feb[_0xc363('0x28')](0xcc)[_0xc363('0x29')]();});}};}function handleEntityNotFound(_0x405162,_0x1a88a8){return function(_0x4eecdc){if(!_0x4eecdc){_0x405162['sendStatus'](0x194);}return _0x4eecdc;};}function handleError(_0x3d08b9,_0x5229dd){_0x5229dd=_0x5229dd||0x1f4;return function(_0x48219e){logger[_0xc363('0x23')](_0x48219e['stack']);if(_0x48219e[_0xc363('0x36')]){delete _0x48219e[_0xc363('0x36')];}_0x3d08b9[_0xc363('0x28')](_0x5229dd)[_0xc363('0x37')](_0x48219e);};}exports[_0xc363('0x38')]=function(_0x267ec9,_0x1171ca){var _0x4663b7={},_0x12b8ea={},_0x4e47ff={'count':0x0,'rows':[]};var _0x3eae6a=_[_0xc363('0x39')](db['ChatMessage']['rawAttributes'],function(_0x16b172){return{'name':_0x16b172['fieldName'],'type':_0x16b172['type'][_0xc363('0x3a')]};});_0x12b8ea[_0xc363('0x3b')]=_[_0xc363('0x39')](_0x3eae6a,_0xc363('0x36'));_0x12b8ea['query']=_['keys'](_0x267ec9[_0xc363('0x3c')]);_0x12b8ea[_0xc363('0x3d')]=_[_0xc363('0x3e')](_0x12b8ea['model'],_0x12b8ea[_0xc363('0x3c')]);_0x4663b7[_0xc363('0x3f')]=_[_0xc363('0x3e')](_0x12b8ea['model'],qs[_0xc363('0x40')](_0x267ec9[_0xc363('0x3c')][_0xc363('0x40')]));_0x4663b7[_0xc363('0x3f')]=_0x4663b7[_0xc363('0x3f')]['length']?_0x4663b7['attributes']:_0x12b8ea[_0xc363('0x3b')];if(!_0x267ec9['query'][_0xc363('0x41')](_0xc363('0x42'))){_0x4663b7['limit']=qs[_0xc363('0x2d')](_0x267ec9[_0xc363('0x3c')][_0xc363('0x2d')]);_0x4663b7[_0xc363('0x2b')]=qs['offset'](_0x267ec9[_0xc363('0x3c')][_0xc363('0x2b')]);}_0x4663b7[_0xc363('0x43')]=qs[_0xc363('0x44')](_0x267ec9[_0xc363('0x3c')][_0xc363('0x44')]);_0x4663b7[_0xc363('0x45')]=qs[_0xc363('0x3d')](_[_0xc363('0x46')](_0x267ec9[_0xc363('0x3c')],_0x12b8ea[_0xc363('0x3d')]),_0x3eae6a);if(_0x267ec9[_0xc363('0x3c')]['filter']){_0x4663b7['where']=_[_0xc363('0x47')](_0x4663b7[_0xc363('0x45')],{'$or':_['map'](_0x3eae6a,function(_0x18ba8c){if(_0x18ba8c[_0xc363('0x48')]!==_0xc363('0x49')){var _0x2495be={};_0x2495be[_0x18ba8c['name']]={'$like':'%'+_0x267ec9[_0xc363('0x3c')][_0xc363('0x4a')]+'%'};return _0x2495be;}})});}_0x4663b7=_[_0xc363('0x47')]({},_0x4663b7,_0x267ec9[_0xc363('0x4b')]);var _0x4eee70={'where':_0x4663b7['where']};return db[_0xc363('0x4c')]['count'](_0x4eee70)[_0xc363('0x35')](function(_0x351738){_0x4e47ff[_0xc363('0x2e')]=_0x351738;if(_0x267ec9[_0xc363('0x3c')][_0xc363('0x4d')]){_0x4663b7[_0xc363('0x4e')]=[{'all':!![]}];}return db[_0xc363('0x4c')][_0xc363('0x4f')](_0x4663b7);})['then'](function(_0x5056fb){_0x4e47ff[_0xc363('0x50')]=_0x5056fb;return _0x4e47ff;})['then'](respondWithFilteredResult(_0x1171ca,_0x4663b7))[_0xc363('0x26')](handleError(_0x1171ca,null));};exports[_0xc363('0x51')]=function(_0x437f5e,_0x1aa0bd){var _0x1e665d={'raw':!![],'where':{'id':_0x437f5e[_0xc363('0x52')]['id']}},_0x3c73bf={};_0x3c73bf['model']=_[_0xc363('0x53')](db[_0xc363('0x4c')][_0xc363('0x54')]);_0x3c73bf[_0xc363('0x3c')]=_[_0xc363('0x53')](_0x437f5e[_0xc363('0x3c')]);_0x3c73bf[_0xc363('0x3d')]=_['intersection'](_0x3c73bf[_0xc363('0x3b')],_0x3c73bf[_0xc363('0x3c')]);_0x1e665d[_0xc363('0x3f')]=_[_0xc363('0x3e')](_0x3c73bf[_0xc363('0x3b')],qs['fields'](_0x437f5e[_0xc363('0x3c')][_0xc363('0x40')]));_0x1e665d[_0xc363('0x3f')]=_0x1e665d[_0xc363('0x3f')][_0xc363('0x55')]?_0x1e665d[_0xc363('0x3f')]:_0x3c73bf[_0xc363('0x3b')];if(_0x437f5e[_0xc363('0x3c')][_0xc363('0x4d')]){_0x1e665d[_0xc363('0x4e')]=[{'all':!![]}];}_0x1e665d=_[_0xc363('0x47')]({},_0x1e665d,_0x437f5e['options']);return db[_0xc363('0x4c')][_0xc363('0x56')](_0x1e665d)[_0xc363('0x35')](handleEntityNotFound(_0x1aa0bd,null))[_0xc363('0x35')](respondWithResult(_0x1aa0bd,null))['catch'](handleError(_0x1aa0bd,null));};exports['create']=function(_0x5548f1,_0x9ded8a){return db[_0xc363('0x4c')]['create'](_0x5548f1['body'],{})[_0xc363('0x35')](respondWithResult(_0x9ded8a,0xc9))['catch'](handleError(_0x9ded8a,null));};exports[_0xc363('0x33')]=function(_0x4d382b,_0x152ab2){if(_0x4d382b[_0xc363('0x57')]['id']){delete _0x4d382b[_0xc363('0x57')]['id'];}return db[_0xc363('0x4c')][_0xc363('0x56')]({'where':{'id':_0x4d382b['params']['id']}})[_0xc363('0x35')](handleEntityNotFound(_0x152ab2,null))[_0xc363('0x35')](saveUpdates(_0x4d382b[_0xc363('0x57')],null))[_0xc363('0x35')](respondWithResult(_0x152ab2,null))[_0xc363('0x26')](handleError(_0x152ab2,null));};exports[_0xc363('0x34')]=function(_0x3be9a5,_0x2edaf9){return db[_0xc363('0x4c')][_0xc363('0x56')]({'where':{'id':_0x3be9a5['params']['id']}})[_0xc363('0x35')](handleEntityNotFound(_0x2edaf9,null))[_0xc363('0x35')](removeEntity(_0x2edaf9,null))['catch'](handleError(_0x2edaf9,null));};exports[_0xc363('0x58')]=function(_0x3ac9d6,_0x1560b0){return db[_0xc363('0x4c')][_0xc363('0x58')]()[_0xc363('0x35')](respondWithResult(_0x1560b0,null))[_0xc363('0x26')](handleError(_0x1560b0,null));};var interaction_log=require(_0xc363('0x59'))(_0xc363('0x5a'));exports[_0xc363('0x5b')]=function(_0x4844a3,_0xb39bdf,_0x5b300d){var _0x36a7e4={'agent':{},'channel':_0xc363('0x5c')};if(_0x4844a3['body']['id']){delete _0x4844a3[_0xc363('0x57')]['id'];}_0x4844a3[_0xc363('0x57')]['read']=!![];_0x4844a3['body']['readAt']=moment()[_0xc363('0x5d')](_0xc363('0x5e'));_0x4844a3[_0xc363('0x57')][_0xc363('0x5f')]=_0x4844a3['body'][_0xc363('0x5f')]||_0x4844a3[_0xc363('0x60')]['id'];_0x36a7e4[_0xc363('0x61')]['id']=_0x4844a3['body']['UserId'];return db[_0xc363('0x4c')][_0xc363('0x56')]({'where':{'id':_0x4844a3[_0xc363('0x52')]['id'],'UserId':null}})[_0xc363('0x35')](handleEntityNotFound(_0xb39bdf,null))[_0xc363('0x35')](saveUpdates(_0x4844a3[_0xc363('0x57')],null))[_0xc363('0x35')](function(_0x48db71){if(_0x48db71){_0x36a7e4[_0xc363('0x24')]=_0x48db71[_0xc363('0x62')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x48db71[_0xc363('0x63')]}});}return null;})[_0xc363('0x35')](handleEntityNotFound(_0xb39bdf,null))[_0xc363('0x35')](function(_0xd01717){if(_0xd01717){return _0xd01717[_0xc363('0x33')]({'UserId':_0x4844a3['body'][_0xc363('0x5f')],'read1stAt':_[_0xc363('0x64')](_0xd01717[_0xc363('0x65')])?moment()[_0xc363('0x5d')](_0xc363('0x5e')):undefined});}return null;})[_0xc363('0x35')](function(_0x2da7a1){if(_0x2da7a1){_0x36a7e4[_0xc363('0x66')]=_0x2da7a1[_0xc363('0x62')]({'plain':!![]});interaction_log[_0xc363('0x1d')](_0xc363('0x67'),_0x4844a3[_0xc363('0x60')]['id'],_0x4844a3['user'][_0xc363('0x36')],_0x4844a3['user'][_0xc363('0x68')],_0x36a7e4[_0xc363('0x66')]['id'],_0x4844a3[_0xc363('0x57')]?JSON[_0xc363('0x21')](_0x4844a3[_0xc363('0x57')]):'null');return respondWithRpcPromise(_0xc363('0x69'),'acceptMessage',_0x36a7e4);}return null;})['then'](function(_0x37f876){var _0x46e6fe=_0xc363('0x6a')+_0x37f876[_0xc363('0x24')][_0xc363('0x6b')];return db[_0xc363('0x6c')]['query'](_0x46e6fe,{'type':db[_0xc363('0x6d')][_0xc363('0x6e')][_0xc363('0x6f')],'raw':!![]})[_0xc363('0x35')](function(_0x3d6ec9){return _0x3d6ec9;});})[_0xc363('0x35')](function(_0x36d3e7){if(_0x36d3e7){_0x36a7e4[_0xc363('0x24')][_0xc363('0x70')]=_0x36d3e7[0x0];if(!_0x4844a3['body'][_0xc363('0x5f')])return;return db[_0xc363('0x71')][_0xc363('0x56')]({'where':{'id':_0x4844a3['body'][_0xc363('0x5f')],'role':'agent'},'attributes':['id',_0xc363('0x36'),_0xc363('0x72'),_0xc363('0x73'),_0xc363('0x74')],'raw':!![]});}return null;})['then'](function(_0x515198){if(!_0x515198)return null;_0x36a7e4['message']['agent']=_0x515198;return _0x36a7e4;})[_0xc363('0x35')](function(_0x3b78e7){if(_0x3b78e7){if(_0x4844a3[_0xc363('0x57')][_0xc363('0x75')]){_0x36a7e4['message'][_0xc363('0x76')]=util['format'](_0xc363('0x77'),_0x4844a3['user'][_0xc363('0x36')]);_0x36a7e4[_0xc363('0x24')]['channel']=_0x36a7e4[_0xc363('0x78')];_0x36a7e4[_0xc363('0x24')][_0xc363('0x79')]=_0x36a7e4[_0xc363('0x78')];_0x36a7e4[_0xc363('0x24')][_0xc363('0x7a')]=_0xc363('0x5b');return respondWithRpcPromise(_0xc363('0x7b'),_0xc363('0x7b'),{'event':_0xc363('0x7c'),'message':_[_0xc363('0x47')](_0x36a7e4[_0xc363('0x24')],JSON['parse'](_0x36a7e4['interaction'][_0xc363('0x7d')]))},client9002)['then'](function(){return _0x36a7e4;});}return _0x36a7e4;}return null;})['then'](respondWithResult(_0xb39bdf,null))[_0xc363('0x26')](handleError(_0xb39bdf,null));};var interaction_log=require(_0xc363('0x59'))('chat-interactions');exports[_0xc363('0x31')]=function(_0x128fcb,_0x583f59,_0xacef53){var _0x225e4e={'agent':{},'channel':_0xc363('0x5c')};if(_0x128fcb['body']['id']){delete _0x128fcb[_0xc363('0x57')]['id'];}_0x128fcb[_0xc363('0x57')][_0xc363('0x5f')]=_0x128fcb[_0xc363('0x57')][_0xc363('0x5f')]||_0x128fcb['user']['id'];_0x225e4e[_0xc363('0x61')]['id']=_0x128fcb[_0xc363('0x57')][_0xc363('0x5f')];return db[_0xc363('0x4c')][_0xc363('0x56')]({'where':{'id':_0x128fcb[_0xc363('0x52')]['id'],'UserId':null}})[_0xc363('0x35')](handleEntityNotFound(_0x583f59,null))['then'](function(_0x147133){if(_0x147133){_0x225e4e['message']=_0x147133['get']({'plain':!![]});return db['ChatInteraction'][_0xc363('0x56')]({'where':{'id':_0x147133[_0xc363('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x583f59,null))[_0xc363('0x35')](function(_0x5b86ab){if(_0x5b86ab){_0x225e4e[_0xc363('0x66')]=_0x5b86ab['get']({'plain':!![]});interaction_log[_0xc363('0x1d')](_0xc363('0x7e'),_0x128fcb['user']['id'],_0x128fcb['user']['name'],_0x128fcb[_0xc363('0x60')][_0xc363('0x68')],_0x225e4e[_0xc363('0x66')]['id'],_0x128fcb[_0xc363('0x57')]?JSON[_0xc363('0x21')](_0x128fcb['body']):_0xc363('0x7f'));return respondWithRpcPromise('RejectMessage',_0xc363('0x80'),_0x225e4e);}return null;})[_0xc363('0x35')](function(_0x546227){var _0x31354f=_0xc363('0x6a')+_0x546227['message']['ContactId'];return db[_0xc363('0x6c')][_0xc363('0x3c')](_0x31354f,{'type':db[_0xc363('0x6d')][_0xc363('0x6e')][_0xc363('0x6f')],'raw':!![]})[_0xc363('0x35')](function(_0x1e6c15){return _0x1e6c15;});})['then'](function(_0x2fd8dc){if(_0x2fd8dc){_0x225e4e[_0xc363('0x24')][_0xc363('0x70')]=_0x2fd8dc[0x0];if(!_0x128fcb['body'][_0xc363('0x5f')])return;return db['User'][_0xc363('0x56')]({'where':{'id':_0x128fcb['body']['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0xc363('0x73'),_0xc363('0x74')],'raw':!![]});}return null;})['then'](function(_0x25973d){if(!_0x25973d)return null;_0x225e4e['message']['agent']=_0x25973d;return _0x225e4e;})[_0xc363('0x35')](function(_0x2a6b0a){if(_0x2a6b0a){_0x2a6b0a[_0xc363('0x24')][_0xc363('0x76')]=util['format'](_0xc363('0x77'),_0x128fcb[_0xc363('0x60')]['name']);_0x2a6b0a[_0xc363('0x24')][_0xc363('0x78')]=_0x225e4e[_0xc363('0x78')];_0x2a6b0a['message']['motionChannel']=_0x225e4e[_0xc363('0x78')];_0x2a6b0a[_0xc363('0x24')][_0xc363('0x7a')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xc363('0x81'),'message':_[_0xc363('0x47')](_0x225e4e[_0xc363('0x24')],JSON['parse'](_0x225e4e[_0xc363('0x66')][_0xc363('0x7d')]))},client9002);return _0x225e4e;}return null;})[_0xc363('0x35')](respondWithResult(_0x583f59,null))[_0xc363('0x26')](handleError(_0x583f59,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index acc7038..7ab13a9 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 _0xb369=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2bc16a,_0x308cda){var _0x2b82dc=function(_0x75a795){while(--_0x75a795){_0x2bc16a['push'](_0x2bc16a['shift']());}};_0x2b82dc(++_0x308cda);}(_0xb369,0x168));var _0x9b36=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb369[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x9b36('0x0'));var ChatMessage=require(_0x9b36('0x1'))['db'][_0x9b36('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9b36('0x3')](0x0);var events={'afterCreate':_0x9b36('0x4'),'afterUpdate':_0x9b36('0x5'),'afterDestroy':_0x9b36('0x6')};function emitEvent(_0x239a7d){return function(_0xb2f3da,_0xef50f5,_0x5d67db){ChatMessageEvents[_0x9b36('0x7')](_0x239a7d+':'+_0xb2f3da['id'],_0xb2f3da);ChatMessageEvents['emit'](_0x239a7d,_0xb2f3da);_0x5d67db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x9b36('0x8')](e,emitEvent(event));}}module[_0x9b36('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x2ced=['../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4376db,_0x597fb9){var _0x3b522b=function(_0x299f4b){while(--_0x299f4b){_0x4376db['push'](_0x4376db['shift']());}};_0x3b522b(++_0x597fb9);}(_0x2ced,0x1ef));var _0xd2ce=function(_0x555678,_0x19c01d){_0x555678=_0x555678-0x0;var _0x59444b=_0x2ced[_0x555678];return _0x59444b;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xd2ce('0x0'))['db'][_0xd2ce('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd2ce('0x2')](0x0);var events={'afterCreate':_0xd2ce('0x3'),'afterUpdate':_0xd2ce('0x4'),'afterDestroy':'remove'};function emitEvent(_0x217cc7){return function(_0x7fb897,_0x466aad,_0x256174){ChatMessageEvents[_0xd2ce('0x5')](_0x217cc7+':'+_0x7fb897['id'],_0x7fb897);ChatMessageEvents[_0xd2ce('0x5')](_0x217cc7,_0x7fb897);_0x256174(null);};}for(var e in events){if(events[_0xd2ce('0x6')](e)){var event=events[e];ChatMessage[_0xd2ce('0x7')](e,emitEvent(event));}}module[_0xd2ce('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1446bac..e848882 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 _0x6a26=['moment','bluebird','path','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','lodash','util','../../config/logger'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x6a26,0x14f));var _0x66a2=function(_0x2f3864,_0x1e15c0){_0x2f3864=_0x2f3864-0x0;var _0x309073=_0x6a26[_0x2f3864];return _0x309073;};'use strict';var _=require(_0x66a2('0x0'));var util=require(_0x66a2('0x1'));var logger=require(_0x66a2('0x2'))('api');var moment=require(_0x66a2('0x3'));var BPromise=require(_0x66a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66a2('0x5'));var rimraf=require('rimraf');var config=require(_0x66a2('0x6'));var attributes=require(_0x66a2('0x7'));module['exports']=function(_0x1264ad,_0x57ebc9){return _0x1264ad[_0x66a2('0x8')](_0x66a2('0x9'),attributes,{'tableName':_0x66a2('0xa'),'paranoid':![],'indexes':[{'name':_0x66a2('0xb'),'fields':[_0x66a2('0xc')],'type':_0x66a2('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x454719,_0x1fe7cf,_0x49993d){var _0x556366=_0x1264ad['models'];var _0x39c68c=_0x454719[_0x66a2('0xe')]({'plain':!![]});if(_0x39c68c[_0x66a2('0xf')]['toLowerCase']()==='in'||_0x39c68c['direction'][_0x66a2('0x10')]()==='out'&&!_0x39c68c[_0x66a2('0x11')]&&!_[_0x66a2('0x12')](_0x39c68c[_0x66a2('0x13')])){_0x556366[_0x66a2('0x14')][_0x66a2('0x15')]({'where':{'id':_0x39c68c[_0x66a2('0x16')]}})[_0x66a2('0x17')](function(_0x2669af){if(_0x2669af){_0x2669af['update']({'lastMsgAt':_0x39c68c[_0x66a2('0x18')],'lastMsgDirection':_0x39c68c[_0x66a2('0xf')][_0x66a2('0x10')]()});}})[_0x66a2('0x19')](function(_0x4e7977){console['error'](_0x4e7977);});}_0x49993d();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3819=['then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','ChatInteractionId'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x3819,0x83));var _0x9381=function(_0xd50738,_0x2f195e){_0xd50738=_0xd50738-0x0;var _0x162f8f=_0x3819[_0xd50738];return _0x162f8f;};'use strict';var _=require('lodash');var util=require(_0x9381('0x0'));var logger=require('../../config/logger')(_0x9381('0x1'));var moment=require(_0x9381('0x2'));var BPromise=require(_0x9381('0x3'));var rp=require(_0x9381('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9381('0x5'));var attributes=require(_0x9381('0x6'));module[_0x9381('0x7')]=function(_0x1d0cf5,_0x52577f){return _0x1d0cf5['define'](_0x9381('0x8'),attributes,{'tableName':_0x9381('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x9381('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x79065c,_0x4c0c31,_0x302fa7){var _0x2357d6=_0x1d0cf5[_0x9381('0xb')];var _0x50b0c3=_0x79065c['get']({'plain':!![]});if(_0x50b0c3[_0x9381('0xc')][_0x9381('0xd')]()==='in'||_0x50b0c3['direction'][_0x9381('0xd')]()==='out'&&!_0x50b0c3[_0x9381('0xe')]&&!_[_0x9381('0xf')](_0x50b0c3['UserId'])){_0x2357d6[_0x9381('0x10')][_0x9381('0x11')]({'where':{'id':_0x50b0c3[_0x9381('0x12')]}})[_0x9381('0x13')](function(_0x52826a){if(_0x52826a){_0x52826a['update']({'lastMsgAt':_0x50b0c3[_0x9381('0x14')],'lastMsgDirection':_0x50b0c3[_0x9381('0xc')][_0x9381('0xd')]()});}})[_0x9381('0x15')](function(_0xc44fb8){console[_0x9381('0x16')](_0xc44fb8);});}_0x302fa7();}},'charset':_0x9381('0x17'),'collate':_0x9381('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f4f996f..1eb99c6 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 _0x0686=['localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x123578,_0x3203ef){var _0x5d1bde=function(_0x5dc668){while(--_0x5dc668){_0x123578['push'](_0x123578['shift']());}};_0x5d1bde(++_0x3203ef);}(_0x0686,0x123));var _0x6068=function(_0x201fcc,_0x103048){_0x201fcc=_0x201fcc-0x0;var _0x23c66d=_0x0686[_0x201fcc];return _0x23c66d;};'use strict';var _=require(_0x6068('0x0'));var util=require(_0x6068('0x1'));var moment=require(_0x6068('0x2'));var BPromise=require(_0x6068('0x3'));var rs=require(_0x6068('0x4'));var fs=require('fs');var Redis=require(_0x6068('0x5'));var db=require(_0x6068('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6068('0x7'))(_0x6068('0x8'));var config=require(_0x6068('0x9'));var jayson=require(_0x6068('0xa'));var client=jayson[_0x6068('0xb')][_0x6068('0xc')]({'port':0x232a});config[_0x6068('0xd')]=_[_0x6068('0xe')](config[_0x6068('0xd')],{'host':_0x6068('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6068('0xd')]));require(_0x6068('0x10'))[_0x6068('0x11')](socket);function respondWithRpcPromise(_0x18a7d0,_0x29d37b,_0x3d27cf){return new BPromise(function(_0xbb38d9,_0x52e03f){return client[_0x6068('0x12')](_0x18a7d0,_0x3d27cf)[_0x6068('0x13')](function(_0x20453d){logger[_0x6068('0x14')](_0x6068('0x15'),_0x29d37b,'request\x20sent');logger[_0x6068('0x16')](_0x6068('0x17'),_0x29d37b,'request\x20sent',JSON[_0x6068('0x18')](_0x20453d));if(_0x20453d[_0x6068('0x19')]){if(_0x20453d[_0x6068('0x19')][_0x6068('0x1a')]===0x1f4){logger[_0x6068('0x19')](_0x6068('0x15'),_0x29d37b,_0x20453d[_0x6068('0x19')][_0x6068('0x1b')]);return _0x52e03f(_0x20453d[_0x6068('0x19')]['message']);}logger[_0x6068('0x19')](_0x6068('0x15'),_0x29d37b,_0x20453d['error'][_0x6068('0x1b')]);return _0xbb38d9(_0x20453d[_0x6068('0x19')][_0x6068('0x1b')]);}else{logger[_0x6068('0x14')]('ChatMessage,\x20%s,\x20%s',_0x29d37b,'request\x20sent');_0xbb38d9(_0x20453d[_0x6068('0x1c')][_0x6068('0x1b')]);}})[_0x6068('0x1d')](function(_0xf66d6e){logger['error']('ChatMessage,\x20%s,\x20%s',_0x29d37b,_0xf66d6e);_0x52e03f(_0xf66d6e);});});}exports[_0x6068('0x1e')]=function(_0x391994){var _0x28a383=this;return new Promise(function(_0x4fb041,_0x247c2d){return db[_0x6068('0x1f')][_0x6068('0x20')](_0x391994['body'],{'raw':_0x391994['options']?_0x391994['options'][_0x6068('0x21')]===undefined?!![]:![]:!![]})[_0x6068('0x13')](function(_0x1b4f91){logger[_0x6068('0x14')](_0x6068('0x1e'),_0x391994);logger[_0x6068('0x16')](_0x6068('0x1e'),_0x391994,JSON[_0x6068('0x18')](_0x1b4f91));_0x4fb041(_0x1b4f91);})['catch'](function(_0x251a76){logger[_0x6068('0x19')]('CreateChatMessage',_0x251a76[_0x6068('0x1b')],_0x391994);_0x247c2d(_0x28a383[_0x6068('0x19')](0x1f4,_0x251a76[_0x6068('0x1b')]));});});}; \ No newline at end of file +var _0xafea=['info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','defaults','localhost','redis','./chatMessage.socket','request'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xafea,0x1e0));var _0xaafe=function(_0x553c38,_0x5f53f4){_0x553c38=_0x553c38-0x0;var _0x5d8038=_0xafea[_0x553c38];return _0x5d8038;};'use strict';var _=require('lodash');var util=require(_0xaafe('0x0'));var moment=require(_0xaafe('0x1'));var BPromise=require(_0xaafe('0x2'));var rs=require(_0xaafe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaafe('0x4'))['db'];var utils=require(_0xaafe('0x5'));var logger=require('../../config/logger')(_0xaafe('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaafe('0x7')]['http']({'port':0x232a});config['redis']=_[_0xaafe('0x8')](config['redis'],{'host':_0xaafe('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaafe('0xa')]));require(_0xaafe('0xb'))['register'](socket);function respondWithRpcPromise(_0x576b51,_0x3b0750,_0x497a78){return new BPromise(function(_0x3529cc,_0x1cf969){return client[_0xaafe('0xc')](_0x576b51,_0x497a78)['then'](function(_0x35d921){logger[_0xaafe('0xd')](_0xaafe('0xe'),_0x3b0750,_0xaafe('0xf'));logger[_0xaafe('0x10')](_0xaafe('0x11'),_0x3b0750,'request\x20sent',JSON[_0xaafe('0x12')](_0x35d921));if(_0x35d921[_0xaafe('0x13')]){if(_0x35d921[_0xaafe('0x13')]['code']===0x1f4){logger[_0xaafe('0x13')](_0xaafe('0xe'),_0x3b0750,_0x35d921[_0xaafe('0x13')][_0xaafe('0x14')]);return _0x1cf969(_0x35d921[_0xaafe('0x13')][_0xaafe('0x14')]);}logger[_0xaafe('0x13')](_0xaafe('0xe'),_0x3b0750,_0x35d921[_0xaafe('0x13')][_0xaafe('0x14')]);return _0x3529cc(_0x35d921[_0xaafe('0x13')]['message']);}else{logger[_0xaafe('0xd')]('ChatMessage,\x20%s,\x20%s',_0x3b0750,'request\x20sent');_0x3529cc(_0x35d921['result'][_0xaafe('0x14')]);}})[_0xaafe('0x15')](function(_0x58961f){logger[_0xaafe('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3b0750,_0x58961f);_0x1cf969(_0x58961f);});});}exports[_0xaafe('0x16')]=function(_0x43a6ea){var _0x226ef9=this;return new Promise(function(_0x4840c9,_0x506881){return db[_0xaafe('0x17')][_0xaafe('0x18')](_0x43a6ea[_0xaafe('0x19')],{'raw':_0x43a6ea['options']?_0x43a6ea[_0xaafe('0x1a')][_0xaafe('0x1b')]===undefined?!![]:![]:!![]})[_0xaafe('0x1c')](function(_0x3ce964){logger[_0xaafe('0xd')](_0xaafe('0x16'),_0x43a6ea);logger[_0xaafe('0x10')](_0xaafe('0x16'),_0x43a6ea,JSON[_0xaafe('0x12')](_0x3ce964));_0x4840c9(_0x3ce964);})[_0xaafe('0x15')](function(_0x48baf2){logger[_0xaafe('0x13')](_0xaafe('0x16'),_0x48baf2['message'],_0x43a6ea);_0x506881(_0x226ef9[_0xaafe('0x13')](0x1f4,_0x48baf2[_0xaafe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8cd90c4..201ab52 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 _0x6c7b=['register','chatMessage:','./chatMessage.events','emit','removeListener'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x3ff06f,_0x591b14){_0x3ff06f=_0x3ff06f-0x0;var _0x152633=_0x6c7b[_0x3ff06f];return _0x152633;};'use strict';var ChatMessageEvents=require(_0xb6c7('0x0'));var events=['save','remove','update'];function createListener(_0x3f3910,_0x5528b3){return function(_0x2b678a){_0x5528b3[_0xb6c7('0x1')](_0x3f3910,_0x2b678a);};}function removeListener(_0x35674b,_0x5857e0){return function(){ChatMessageEvents[_0xb6c7('0x2')](_0x35674b,_0x5857e0);};}exports[_0xb6c7('0x3')]=function(_0xfe3eb9){for(var _0x219abc=0x0,_0xb889c3=events['length'];_0x219abc<_0xb889c3;_0x219abc++){var _0x12e97e=events[_0x219abc];var _0x41a5a5=createListener(_0xb6c7('0x4')+_0x12e97e,_0xfe3eb9);ChatMessageEvents['on'](_0x12e97e,_0x41a5a5);}}; \ No newline at end of file +var _0x0fda=['register','length','./chatMessage.events','remove','update','emit'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x92972,_0x2206b2){_0x92972=_0x92972-0x0;var _0x28a061=_0x0fda[_0x92972];return _0x28a061;};'use strict';var ChatMessageEvents=require(_0xa0fd('0x0'));var events=['save',_0xa0fd('0x1'),_0xa0fd('0x2')];function createListener(_0x314a1a,_0x2f71f3){return function(_0x426242){_0x2f71f3[_0xa0fd('0x3')](_0x314a1a,_0x426242);};}function removeListener(_0x13c734,_0x574fca){return function(){ChatMessageEvents['removeListener'](_0x13c734,_0x574fca);};}exports[_0xa0fd('0x4')]=function(_0x4aec58){for(var _0x49b3c1=0x0,_0x868183=events[_0xa0fd('0x5')];_0x49b3c1<_0x868183;_0x49b3c1++){var _0x1aab41=events[_0x49b3c1];var _0x248cca=createListener('chatMessage:'+_0x1aab41,_0x4aec58);ChatMessageEvents['on'](_0x1aab41,_0x248cca);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c72a796..8b8af03 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 _0x5fe3=['update','accept','put','/:id/reject','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','./chatMessage.controller','get','index','isAuthenticated','describe','show','post','tracked','chat','create','/:id'];(function(_0x463a6e,_0x1b47b5){var _0x51d8c6=function(_0x21f507){while(--_0x21f507){_0x463a6e['push'](_0x463a6e['shift']());}};_0x51d8c6(++_0x1b47b5);}(_0x5fe3,0x18d));var _0x35fe=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0x5fe3[_0x5a1cc9];return _0x471761;};'use strict';var multer=require(_0x35fe('0x0'));var util=require('util');var path=require(_0x35fe('0x1'));var timeout=require(_0x35fe('0x2'));var express=require(_0x35fe('0x3'));var router=express[_0x35fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x35fe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x35fe('0x6'));router[_0x35fe('0x7')]('/',auth['isAuthenticated'](),controller[_0x35fe('0x8')]);router[_0x35fe('0x7')]('/describe',auth[_0x35fe('0x9')](),controller[_0x35fe('0xa')]);router[_0x35fe('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x35fe('0xb')]);router[_0x35fe('0xc')]('/',auth['isAuthenticated'](),interaction[_0x35fe('0xd')](_0x35fe('0xe'),'chatmessage:create'),controller[_0x35fe('0xf')]);router['put'](_0x35fe('0x10'),controller[_0x35fe('0x11')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x35fe('0x12')]);router[_0x35fe('0x13')](_0x35fe('0x14'),auth[_0x35fe('0x9')](),controller['reject']);router[_0x35fe('0x15')](_0x35fe('0x10'),auth['isAuthenticated'](),controller[_0x35fe('0x16')]);module['exports']=router; \ No newline at end of file +var _0xdb41=['accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0xdb41,0x1e1));var _0x1db4=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0xdb41[_0x5b26cb];return _0x563d12;};'use strict';var multer=require('multer');var util=require(_0x1db4('0x0'));var path=require(_0x1db4('0x1'));var timeout=require(_0x1db4('0x2'));var express=require(_0x1db4('0x3'));var router=express['Router']();var fs_extra=require(_0x1db4('0x4'));var auth=require(_0x1db4('0x5'));var interaction=require(_0x1db4('0x6'));var config=require(_0x1db4('0x7'));var controller=require(_0x1db4('0x8'));router[_0x1db4('0x9')]('/',auth[_0x1db4('0xa')](),controller[_0x1db4('0xb')]);router['get'](_0x1db4('0xc'),auth['isAuthenticated'](),controller[_0x1db4('0xd')]);router[_0x1db4('0x9')](_0x1db4('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x1db4('0xf')]('/',auth[_0x1db4('0xa')](),interaction[_0x1db4('0x10')](_0x1db4('0x11'),_0x1db4('0x12')),controller[_0x1db4('0x13')]);router[_0x1db4('0x14')](_0x1db4('0xe'),controller[_0x1db4('0x15')]);router[_0x1db4('0x14')](_0x1db4('0x16'),auth['isAuthenticated'](),controller[_0x1db4('0x17')]);router[_0x1db4('0x14')](_0x1db4('0x18'),auth[_0x1db4('0xa')](),controller['reject']);router[_0x1db4('0x19')](_0x1db4('0xe'),auth[_0x1db4('0xa')](),controller[_0x1db4('0x1a')]);module[_0x1db4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b5ca77a..065e853 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 _0x6c27=['exports','TEXT','medium','sequelize'];(function(_0x1ce8c3,_0x85454b){var _0x85b036=function(_0x385a19){while(--_0x385a19){_0x1ce8c3['push'](_0x1ce8c3['shift']());}};_0x85b036(++_0x85454b);}(_0x6c27,0x19b));var _0x76c2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6c27[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x76c2('0x0'));module[_0x76c2('0x1')]={'body':{'type':Sequelize[_0x76c2('0x2')](_0x76c2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x9c9a=['exports','medium'];(function(_0x2e1578,_0x102dbb){var _0x371a8e=function(_0x4ac106){while(--_0x4ac106){_0x2e1578['push'](_0x2e1578['shift']());}};_0x371a8e(++_0x102dbb);}(_0x9c9a,0xfa));var _0xa9c9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9c9a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xa9c9('0x0')]={'body':{'type':Sequelize['TEXT'](_0xa9c9('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 f62fed9..f7a1129 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(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x7a54,0x106));var _0x47a5=function(_0x49aa0c,_0x193ac8){_0x49aa0c=_0x49aa0c-0x0;var _0x3cb64a=_0x7a54[_0x49aa0c];return _0x3cb64a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x31c469,_0x391c91){var _0x3a2ac2=function(_0x5ee2bf){while(--_0x5ee2bf){_0x31c469['push'](_0x31c469['shift']());}};_0x3a2ac2(++_0x391c91);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6875c82..34c23bf 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 _0x2804=['../../config/environment','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f65ee,_0x3b15c8){var _0x2f9c47=function(_0x1b7d24){while(--_0x1b7d24){_0x3f65ee['push'](_0x3f65ee['shift']());}};_0x2f9c47(++_0x3b15c8);}(_0x2804,0x1cc));var _0x4280=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2804[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4280('0x0'));var util=require(_0x4280('0x1'));var logger=require(_0x4280('0x2'))(_0x4280('0x3'));var moment=require(_0x4280('0x4'));var BPromise=require(_0x4280('0x5'));var rp=require(_0x4280('0x6'));var fs=require('fs');var path=require(_0x4280('0x7'));var rimraf=require('rimraf');var config=require(_0x4280('0x8'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x8a9941,_0x28083c){return _0x8a9941['define'](_0x4280('0x9'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4280('0xa'),'collate':_0x4280('0xb')});}; \ No newline at end of file +var _0x386a=['../../config/logger','api','bluebird','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x386a,0x1de));var _0xa386=function(_0x5ac24a,_0x135289){_0x5ac24a=_0x5ac24a-0x0;var _0x4e3896=_0x386a[_0x5ac24a];return _0x4e3896;};'use strict';var _=require(_0xa386('0x0'));var util=require(_0xa386('0x1'));var logger=require(_0xa386('0x2'))(_0xa386('0x3'));var moment=require('moment');var BPromise=require(_0xa386('0x4'));var rp=require(_0xa386('0x5'));var fs=require('fs');var path=require(_0xa386('0x6'));var rimraf=require(_0xa386('0x7'));var config=require('../../config/environment');var attributes=require(_0xa386('0x8'));module[_0xa386('0x9')]=function(_0x40c728,_0x4bdd33){return _0x40c728[_0xa386('0xa')](_0xa386('0xb'),attributes,{'tableName':_0xa386('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa386('0xd'),'collate':_0xa386('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 5969aed..a5bd49b 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 _0xab3d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x13cd20,_0x1d9211){var _0x22b6de=function(_0x4b574f){while(--_0x4b574f){_0x13cd20['push'](_0x13cd20['shift']());}};_0x22b6de(++_0x1d9211);}(_0xab3d,0x82));var _0xdab3=function(_0xd18e83,_0x54afac){_0xd18e83=_0xd18e83-0x0;var _0x40b79f=_0xab3d[_0xd18e83];return _0x40b79f;};'use strict';var _=require(_0xdab3('0x0'));var util=require(_0xdab3('0x1'));var moment=require('moment');var BPromise=require(_0xdab3('0x2'));var rs=require(_0xdab3('0x3'));var fs=require('fs');var Redis=require(_0xdab3('0x4'));var db=require(_0xdab3('0x5'))['db'];var utils=require(_0xdab3('0x6'));var logger=require(_0xdab3('0x7'))(_0xdab3('0x8'));var config=require(_0xdab3('0x9'));var jayson=require(_0xdab3('0xa'));var client=jayson[_0xdab3('0xb')][_0xdab3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b77c0,_0x1079f0,_0x2e2fd7){return new BPromise(function(_0xa13e33,_0x594d3a){return client[_0xdab3('0xd')](_0x5b77c0,_0x2e2fd7)[_0xdab3('0xe')](function(_0x3f3b4e){logger[_0xdab3('0xf')](_0xdab3('0x10'),_0x1079f0,'request\x20sent');logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1079f0,_0xdab3('0x11'),JSON[_0xdab3('0x12')](_0x3f3b4e));if(_0x3f3b4e[_0xdab3('0x13')]){if(_0x3f3b4e[_0xdab3('0x13')][_0xdab3('0x14')]===0x1f4){logger[_0xdab3('0x13')](_0xdab3('0x10'),_0x1079f0,_0x3f3b4e[_0xdab3('0x13')][_0xdab3('0x15')]);return _0x594d3a(_0x3f3b4e[_0xdab3('0x13')]['message']);}logger['error'](_0xdab3('0x10'),_0x1079f0,_0x3f3b4e[_0xdab3('0x13')]['message']);return _0xa13e33(_0x3f3b4e[_0xdab3('0x13')]['message']);}else{logger[_0xdab3('0xf')](_0xdab3('0x10'),_0x1079f0,_0xdab3('0x11'));_0xa13e33(_0x3f3b4e[_0xdab3('0x16')]['message']);}})['catch'](function(_0x2dc8a4){logger['error'](_0xdab3('0x10'),_0x1079f0,_0x2dc8a4);_0x594d3a(_0x2dc8a4);});});} \ No newline at end of file +var _0x597b=['result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x597b,0xc7));var _0xb597=function(_0x1909a3,_0x106e97){_0x1909a3=_0x1909a3-0x0;var _0xab8ee8=_0x597b[_0x1909a3];return _0xab8ee8;};'use strict';var _=require('lodash');var util=require(_0xb597('0x0'));var moment=require(_0xb597('0x1'));var BPromise=require(_0xb597('0x2'));var rs=require(_0xb597('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb597('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb597('0x5'))(_0xb597('0x6'));var config=require(_0xb597('0x7'));var jayson=require(_0xb597('0x8'));var client=jayson[_0xb597('0x9')][_0xb597('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bbc48,_0x29ea54,_0x2a3d88){return new BPromise(function(_0x17310d,_0x5b5f33){return client[_0xb597('0xb')](_0x4bbc48,_0x2a3d88)[_0xb597('0xc')](function(_0x2b70cf){logger[_0xb597('0xd')](_0xb597('0xe'),_0x29ea54,'request\x20sent');logger[_0xb597('0xf')](_0xb597('0x10'),_0x29ea54,_0xb597('0x11'),JSON['stringify'](_0x2b70cf));if(_0x2b70cf[_0xb597('0x12')]){if(_0x2b70cf[_0xb597('0x12')][_0xb597('0x13')]===0x1f4){logger[_0xb597('0x12')](_0xb597('0xe'),_0x29ea54,_0x2b70cf['error']['message']);return _0x5b5f33(_0x2b70cf['error']['message']);}logger['error'](_0xb597('0xe'),_0x29ea54,_0x2b70cf[_0xb597('0x12')][_0xb597('0x14')]);return _0x17310d(_0x2b70cf[_0xb597('0x12')]['message']);}else{logger[_0xb597('0xd')](_0xb597('0xe'),_0x29ea54,_0xb597('0x11'));_0x17310d(_0x2b70cf[_0xb597('0x15')][_0xb597('0x14')]);}})['catch'](function(_0x3da474){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x29ea54,_0x3da474);_0x5b5f33(_0x3da474);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c2f86b8..e4329da 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 _0x5862=['../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','describe','get','show','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x30abd5,_0xd71245){var _0xad301=function(_0x4311a0){while(--_0x4311a0){_0x30abd5['push'](_0x30abd5['shift']());}};_0xad301(++_0xd71245);}(_0x5862,0x161));var _0x2586=function(_0x58389d,_0x3137df){_0x58389d=_0x58389d-0x0;var _0x2be20a=_0x5862[_0x58389d];return _0x2be20a;};'use strict';var multer=require(_0x2586('0x0'));var util=require(_0x2586('0x1'));var path=require(_0x2586('0x2'));var timeout=require('connect-timeout');var express=require(_0x2586('0x3'));var router=express[_0x2586('0x4')]();var fs_extra=require(_0x2586('0x5'));var auth=require(_0x2586('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2586('0x7'));var controller=require(_0x2586('0x8'));router['get']('/',auth[_0x2586('0x9')](),controller[_0x2586('0xa')]);router['get']('/describe',auth[_0x2586('0x9')](),controller[_0x2586('0xb')]);router[_0x2586('0xc')]('/:id',auth[_0x2586('0x9')](),controller[_0x2586('0xd')]);router[_0x2586('0xe')]('/',auth[_0x2586('0x9')](),controller[_0x2586('0xf')]);router['put'](_0x2586('0x10'),auth[_0x2586('0x9')](),controller['update']);router[_0x2586('0x11')](_0x2586('0x10'),auth['isAuthenticated'](),controller[_0x2586('0x12')]);module[_0x2586('0x13')]=router; \ No newline at end of file +var _0x0dcd=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','describe','/:id','show','post','isAuthenticated','put','update'];(function(_0x4ad2f9,_0x51909b){var _0x2584bd=function(_0x22d7a3){while(--_0x22d7a3){_0x4ad2f9['push'](_0x4ad2f9['shift']());}};_0x2584bd(++_0x51909b);}(_0x0dcd,0xdb));var _0xd0dc=function(_0x4a0e2e,_0x34c3d0){_0x4a0e2e=_0x4a0e2e-0x0;var _0x26ed6c=_0x0dcd[_0x4a0e2e];return _0x26ed6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd0dc('0x0'));var timeout=require(_0xd0dc('0x1'));var express=require(_0xd0dc('0x2'));var router=express[_0xd0dc('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd0dc('0x4'));var config=require(_0xd0dc('0x5'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd0dc('0x6')]);router[_0xd0dc('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd0dc('0x8')]);router[_0xd0dc('0x7')](_0xd0dc('0x9'),auth['isAuthenticated'](),controller[_0xd0dc('0xa')]);router[_0xd0dc('0xb')]('/',auth[_0xd0dc('0xc')](),controller['create']);router[_0xd0dc('0xd')]('/:id',auth[_0xd0dc('0xc')](),controller[_0xd0dc('0xe')]);router[_0xd0dc('0xf')](_0xd0dc('0x9'),auth[_0xd0dc('0xc')](),controller[_0xd0dc('0x10')]);module[_0xd0dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4339d93..06efdcf 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 _0x7569=['INTEGER','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7569,0x121));var _0x9756=function(_0x31878c,_0x590aff){_0x31878c=_0x31878c-0x0;var _0x24ef2b=_0x7569[_0x31878c];return _0x24ef2b;};'use strict';var Sequelize=require('sequelize');module[_0x9756('0x0')]={'name':{'type':Sequelize[_0x9756('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9756('0x2')](_0x9756('0x3'),_0x9756('0x4')),'defaultValue':_0x9756('0x3')},'selector':{'type':Sequelize[_0x9756('0x1')]},'timeout':{'type':Sequelize[_0x9756('0x5')]}}; \ No newline at end of file +var _0x94d5=['INTEGER','exports','STRING','timeout','mouseOver'];(function(_0x1d4923,_0x4e222f){var _0x14ea9a=function(_0x54e138){while(--_0x54e138){_0x1d4923['push'](_0x1d4923['shift']());}};_0x14ea9a(++_0x4e222f);}(_0x94d5,0x1d2));var _0x594d=function(_0x3ddffc,_0x2ffe2c){_0x3ddffc=_0x3ddffc-0x0;var _0x462170=_0x94d5[_0x3ddffc];return _0x462170;};'use strict';var Sequelize=require('sequelize');module[_0x594d('0x0')]={'name':{'type':Sequelize[_0x594d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x594d('0x2')),'defaultValue':_0x594d('0x3')},'selector':{'type':Sequelize[_0x594d('0x1')]},'timeout':{'type':Sequelize[_0x594d('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 4f88715..e76f147 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 _0x323b=['crypto','jsforce','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','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','ChatProactiveAction','catch','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x323b,0x1ad));var _0xb323=function(_0x223de8,_0x159864){_0x223de8=_0x223de8-0x0;var _0x5eb782=_0x323b[_0x223de8];return _0x5eb782;};'use strict';var emlformat=require(_0xb323('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb323('0x1'));var jsonpatch=require(_0xb323('0x2'));var rp=require(_0xb323('0x3'));var moment=require('moment');var BPromise=require(_0xb323('0x4'));var Mustache=require(_0xb323('0x5'));var util=require(_0xb323('0x6'));var path=require(_0xb323('0x7'));var sox=require(_0xb323('0x8'));var csv=require(_0xb323('0x9'));var ejs=require(_0xb323('0xa'));var fs=require('fs');var fs_extra=require(_0xb323('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb323('0xc'));var jsforce=require(_0xb323('0xd'));var deskjs=require(_0xb323('0xe'));var toCsv=require(_0xb323('0x9'));var querystring=require('querystring');var Papa=require(_0xb323('0xf'));var Redis=require(_0xb323('0x10'));var authService=require(_0xb323('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb323('0x12'));var hardwareService=require(_0xb323('0x13'));var logger=require(_0xb323('0x14'))(_0xb323('0x15'));var utils=require(_0xb323('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb323('0x17'));var db=require(_0xb323('0x18'))['db'];function respondWithStatusCode(_0x4c1bf1,_0x2f03f0){_0x2f03f0=_0x2f03f0||0xcc;return function(_0x524bf7){if(_0x524bf7){return _0x4c1bf1[_0xb323('0x19')](_0x2f03f0);}return _0x4c1bf1[_0xb323('0x1a')](_0x2f03f0)[_0xb323('0x1b')]();};}function respondWithResult(_0x51117c,_0x3a4c5f){_0x3a4c5f=_0x3a4c5f||0xc8;return function(_0x18c341){if(_0x18c341){return _0x51117c[_0xb323('0x1a')](_0x3a4c5f)[_0xb323('0x1c')](_0x18c341);}};}function respondWithFilteredResult(_0x41a47d,_0x57e9a0){return function(_0xb56df2){if(_0xb56df2){var _0xb3dd4=typeof _0x57e9a0[_0xb323('0x1d')]===_0xb323('0x1e')&&typeof _0x57e9a0['limit']===_0xb323('0x1e');var _0x3bc40f=_0xb56df2['count'];var _0x16d415=_0xb3dd4?0x0:_0x57e9a0[_0xb323('0x1d')];var _0x42a063=_0xb3dd4?_0xb56df2[_0xb323('0x1f')]:_0x57e9a0[_0xb323('0x1d')]+_0x57e9a0['limit'];var _0x3efcf7;if(_0x42a063>=_0x3bc40f){_0x42a063=_0x3bc40f;_0x3efcf7=0xc8;}else{_0x3efcf7=0xce;}_0x41a47d[_0xb323('0x1a')](_0x3efcf7);return _0x41a47d[_0xb323('0x20')]('Content-Range',_0x16d415+'-'+_0x42a063+'/'+_0x3bc40f)[_0xb323('0x1c')](_0xb56df2);}return null;};}function patchUpdates(_0x5d5f32){return function(_0x2fc9a5){try{jsonpatch[_0xb323('0x21')](_0x2fc9a5,_0x5d5f32,!![]);}catch(_0x7357b5){return BPromise[_0xb323('0x22')](_0x7357b5);}return _0x2fc9a5[_0xb323('0x23')]();};}function saveUpdates(_0x4afcd0,_0x5318a2){return function(_0x16b127){if(_0x16b127){return _0x16b127[_0xb323('0x24')](_0x4afcd0)[_0xb323('0x25')](function(_0x5e1d88){return _0x5e1d88;});}return null;};}function removeEntity(_0x25ab3c,_0x14b549){return function(_0x2b5ea2){if(_0x2b5ea2){return _0x2b5ea2[_0xb323('0x26')]()[_0xb323('0x25')](function(){_0x25ab3c['status'](0xcc)[_0xb323('0x1b')]();});}};}function handleEntityNotFound(_0x5ea703,_0x361d76){return function(_0x1aa17d){if(!_0x1aa17d){_0x5ea703['sendStatus'](0x194);}return _0x1aa17d;};}function handleError(_0x486a86,_0x5b44be){_0x5b44be=_0x5b44be||0x1f4;return function(_0x444c1d){logger[_0xb323('0x27')](_0x444c1d[_0xb323('0x28')]);if(_0x444c1d[_0xb323('0x29')]){delete _0x444c1d[_0xb323('0x29')];}_0x486a86[_0xb323('0x1a')](_0x5b44be)[_0xb323('0x2a')](_0x444c1d);};}exports[_0xb323('0x2b')]=function(_0x428c5a,_0x305563){var _0x38a533={'raw':!![],'where':{'id':_0x428c5a['params']['id']}},_0x45bd66={};_0x45bd66['model']=_[_0xb323('0x2c')](db['ChatProactiveAction'][_0xb323('0x2d')]);_0x45bd66[_0xb323('0x2e')]=_['keys'](_0x428c5a[_0xb323('0x2e')]);_0x45bd66[_0xb323('0x2f')]=_['intersection'](_0x45bd66[_0xb323('0x30')],_0x45bd66['query']);_0x38a533[_0xb323('0x31')]=_[_0xb323('0x32')](_0x45bd66[_0xb323('0x30')],qs[_0xb323('0x33')](_0x428c5a[_0xb323('0x2e')][_0xb323('0x33')]));_0x38a533[_0xb323('0x31')]=_0x38a533[_0xb323('0x31')][_0xb323('0x34')]?_0x38a533['attributes']:_0x45bd66['model'];if(_0x428c5a[_0xb323('0x2e')][_0xb323('0x35')]){_0x38a533[_0xb323('0x36')]=[{'all':!![]}];}_0x38a533=_[_0xb323('0x37')]({},_0x38a533,_0x428c5a[_0xb323('0x38')]);return db[_0xb323('0x39')]['find'](_0x38a533)['then'](handleEntityNotFound(_0x305563,null))[_0xb323('0x25')](respondWithResult(_0x305563,null))[_0xb323('0x3a')](handleError(_0x305563,null));};exports[_0xb323('0x3b')]=function(_0x4668c9,_0x31e9ac){return db[_0xb323('0x39')]['create'](_0x4668c9[_0xb323('0x3c')],{})['then'](respondWithResult(_0x31e9ac,0xc9))[_0xb323('0x3a')](handleError(_0x31e9ac,null));};exports[_0xb323('0x24')]=function(_0x301c70,_0x1b8616){if(_0x301c70[_0xb323('0x3c')]['id']){delete _0x301c70[_0xb323('0x3c')]['id'];}return db[_0xb323('0x39')][_0xb323('0x3d')]({'where':{'id':_0x301c70[_0xb323('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1b8616,null))[_0xb323('0x25')](saveUpdates(_0x301c70[_0xb323('0x3c')],null))[_0xb323('0x25')](respondWithResult(_0x1b8616,null))[_0xb323('0x3a')](handleError(_0x1b8616,null));};exports['destroy']=function(_0x187805,_0x5cb95e){return db[_0xb323('0x39')]['find']({'where':{'id':_0x187805['params']['id']}})[_0xb323('0x25')](handleEntityNotFound(_0x5cb95e,null))['then'](removeEntity(_0x5cb95e,null))[_0xb323('0x3a')](handleError(_0x5cb95e,null));}; \ No newline at end of file +var _0xc18a=['rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','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/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','show','params','model','keys','ChatProactiveAction'];(function(_0xfc8faf,_0x86244a){var _0x48c40b=function(_0x107c22){while(--_0x107c22){_0xfc8faf['push'](_0xfc8faf['shift']());}};_0x48c40b(++_0x86244a);}(_0xc18a,0x1cf));var _0xac18=function(_0x4568d1,_0xfcd25a){_0x4568d1=_0x4568d1-0x0;var _0x2e9cf5=_0xc18a[_0x4568d1];return _0x2e9cf5;};'use strict';var emlformat=require(_0xac18('0x0'));var rimraf=require(_0xac18('0x1'));var zipdir=require(_0xac18('0x2'));var jsonpatch=require(_0xac18('0x3'));var rp=require('request-promise');var moment=require(_0xac18('0x4'));var BPromise=require(_0xac18('0x5'));var Mustache=require(_0xac18('0x6'));var util=require(_0xac18('0x7'));var path=require(_0xac18('0x8'));var sox=require(_0xac18('0x9'));var csv=require(_0xac18('0xa'));var ejs=require(_0xac18('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac18('0xc'));var squel=require(_0xac18('0xd'));var crypto=require(_0xac18('0xe'));var jsforce=require(_0xac18('0xf'));var deskjs=require(_0xac18('0x10'));var toCsv=require(_0xac18('0xa'));var querystring=require(_0xac18('0x11'));var Papa=require(_0xac18('0x12'));var Redis=require(_0xac18('0x13'));var authService=require(_0xac18('0x14'));var qs=require(_0xac18('0x15'));var as=require(_0xac18('0x16'));var hardwareService=require(_0xac18('0x17'));var logger=require(_0xac18('0x18'))('api');var utils=require(_0xac18('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xac18('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567d8d,_0x215482){_0x215482=_0x215482||0xcc;return function(_0x53b975){if(_0x53b975){return _0x567d8d['sendStatus'](_0x215482);}return _0x567d8d[_0xac18('0x1b')](_0x215482)[_0xac18('0x1c')]();};}function respondWithResult(_0x4a7219,_0x1e6150){_0x1e6150=_0x1e6150||0xc8;return function(_0x33eb5a){if(_0x33eb5a){return _0x4a7219['status'](_0x1e6150)[_0xac18('0x1d')](_0x33eb5a);}};}function respondWithFilteredResult(_0x518187,_0x362b31){return function(_0x550438){if(_0x550438){var _0x4a747c=typeof _0x362b31[_0xac18('0x1e')]===_0xac18('0x1f')&&typeof _0x362b31['limit']==='undefined';var _0x436009=_0x550438[_0xac18('0x20')];var _0x506819=_0x4a747c?0x0:_0x362b31[_0xac18('0x1e')];var _0x98b7d3=_0x4a747c?_0x550438[_0xac18('0x20')]:_0x362b31[_0xac18('0x1e')]+_0x362b31[_0xac18('0x21')];var _0x3666d0;if(_0x98b7d3>=_0x436009){_0x98b7d3=_0x436009;_0x3666d0=0xc8;}else{_0x3666d0=0xce;}_0x518187[_0xac18('0x1b')](_0x3666d0);return _0x518187['set'](_0xac18('0x22'),_0x506819+'-'+_0x98b7d3+'/'+_0x436009)[_0xac18('0x1d')](_0x550438);}return null;};}function patchUpdates(_0x3f6498){return function(_0xbcd5fd){try{jsonpatch[_0xac18('0x23')](_0xbcd5fd,_0x3f6498,!![]);}catch(_0x4a55c0){return BPromise[_0xac18('0x24')](_0x4a55c0);}return _0xbcd5fd[_0xac18('0x25')]();};}function saveUpdates(_0x3924a7,_0x147a03){return function(_0x4f2f18){if(_0x4f2f18){return _0x4f2f18[_0xac18('0x26')](_0x3924a7)[_0xac18('0x27')](function(_0x2c10f3){return _0x2c10f3;});}return null;};}function removeEntity(_0x2c5b19,_0x20d639){return function(_0x204a05){if(_0x204a05){return _0x204a05['destroy']()[_0xac18('0x27')](function(){_0x2c5b19[_0xac18('0x1b')](0xcc)[_0xac18('0x1c')]();});}};}function handleEntityNotFound(_0x53fd81,_0x2d2f69){return function(_0x302b23){if(!_0x302b23){_0x53fd81[_0xac18('0x28')](0x194);}return _0x302b23;};}function handleError(_0x39086e,_0x3e3202){_0x3e3202=_0x3e3202||0x1f4;return function(_0x1aae67){logger[_0xac18('0x29')](_0x1aae67[_0xac18('0x2a')]);if(_0x1aae67['name']){delete _0x1aae67[_0xac18('0x2b')];}_0x39086e[_0xac18('0x1b')](_0x3e3202)['send'](_0x1aae67);};}exports[_0xac18('0x2c')]=function(_0x65f692,_0x14d74a){var _0x2d1492={'raw':!![],'where':{'id':_0x65f692[_0xac18('0x2d')]['id']}},_0xb710bb={};_0xb710bb[_0xac18('0x2e')]=_[_0xac18('0x2f')](db[_0xac18('0x30')][_0xac18('0x31')]);_0xb710bb[_0xac18('0x32')]=_['keys'](_0x65f692['query']);_0xb710bb[_0xac18('0x33')]=_[_0xac18('0x34')](_0xb710bb[_0xac18('0x2e')],_0xb710bb['query']);_0x2d1492[_0xac18('0x35')]=_[_0xac18('0x34')](_0xb710bb[_0xac18('0x2e')],qs[_0xac18('0x36')](_0x65f692[_0xac18('0x32')]['fields']));_0x2d1492[_0xac18('0x35')]=_0x2d1492[_0xac18('0x35')]['length']?_0x2d1492[_0xac18('0x35')]:_0xb710bb[_0xac18('0x2e')];if(_0x65f692['query'][_0xac18('0x37')]){_0x2d1492[_0xac18('0x38')]=[{'all':!![]}];}_0x2d1492=_[_0xac18('0x39')]({},_0x2d1492,_0x65f692[_0xac18('0x3a')]);return db[_0xac18('0x30')][_0xac18('0x3b')](_0x2d1492)[_0xac18('0x27')](handleEntityNotFound(_0x14d74a,null))[_0xac18('0x27')](respondWithResult(_0x14d74a,null))[_0xac18('0x3c')](handleError(_0x14d74a,null));};exports['create']=function(_0x38b847,_0x3c318c){return db[_0xac18('0x30')][_0xac18('0x3d')](_0x38b847[_0xac18('0x3e')],{})[_0xac18('0x27')](respondWithResult(_0x3c318c,0xc9))[_0xac18('0x3c')](handleError(_0x3c318c,null));};exports[_0xac18('0x26')]=function(_0x2404de,_0x678f26){if(_0x2404de['body']['id']){delete _0x2404de['body']['id'];}return db[_0xac18('0x30')][_0xac18('0x3b')]({'where':{'id':_0x2404de['params']['id']}})[_0xac18('0x27')](handleEntityNotFound(_0x678f26,null))['then'](saveUpdates(_0x2404de[_0xac18('0x3e')],null))['then'](respondWithResult(_0x678f26,null))[_0xac18('0x3c')](handleError(_0x678f26,null));};exports[_0xac18('0x3f')]=function(_0x5d1721,_0x4ed58d){return db['ChatProactiveAction']['find']({'where':{'id':_0x5d1721['params']['id']}})[_0xac18('0x27')](handleEntityNotFound(_0x4ed58d,null))['then'](removeEntity(_0x4ed58d,null))[_0xac18('0x3c')](handleError(_0x4ed58d,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7676af1..b69c28d 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 _0xd280=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','chat_proactive_actions'];(function(_0xa223dc,_0x3df032){var _0x58200b=function(_0x5e8541){while(--_0x5e8541){_0xa223dc['push'](_0xa223dc['shift']());}};_0x58200b(++_0x3df032);}(_0xd280,0xb0));var _0x0d28=function(_0x5ee98a,_0x5a0da5){_0x5ee98a=_0x5ee98a-0x0;var _0x4c5050=_0xd280[_0x5ee98a];return _0x4c5050;};'use strict';var _=require(_0x0d28('0x0'));var util=require(_0x0d28('0x1'));var logger=require(_0x0d28('0x2'))('api');var moment=require(_0x0d28('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d28('0x4'));var fs=require('fs');var path=require(_0x0d28('0x5'));var rimraf=require(_0x0d28('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d28('0x7'));module[_0x0d28('0x8')]=function(_0x42b434,_0x4fbc3c){return _0x42b434[_0x0d28('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x0d28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1180=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x3cc68e,_0x5a4b48){var _0x46e345=function(_0x335150){while(--_0x335150){_0x3cc68e['push'](_0x3cc68e['shift']());}};_0x46e345(++_0x5a4b48);}(_0x1180,0xce));var _0x0118=function(_0x35548f,_0x4ad849){_0x35548f=_0x35548f-0x0;var _0x10b877=_0x1180[_0x35548f];return _0x10b877;};'use strict';var _=require(_0x0118('0x0'));var util=require(_0x0118('0x1'));var logger=require(_0x0118('0x2'))(_0x0118('0x3'));var moment=require(_0x0118('0x4'));var BPromise=require(_0x0118('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0118('0x6'));var config=require(_0x0118('0x7'));var attributes=require(_0x0118('0x8'));module[_0x0118('0x9')]=function(_0x1eb888,_0x97cf21){return _0x1eb888['define'](_0x0118('0xa'),attributes,{'tableName':_0x0118('0xb'),'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 b001a2f..ad66a8f 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 _0x8119=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x4e1bf8,_0x4bbcec){var _0x5e0146=function(_0x194ad8){while(--_0x194ad8){_0x4e1bf8['push'](_0x4e1bf8['shift']());}};_0x5e0146(++_0x4bbcec);}(_0x8119,0x126));var _0x9811=function(_0x261adc,_0x591b26){_0x261adc=_0x261adc-0x0;var _0x482218=_0x8119[_0x261adc];return _0x482218;};'use strict';var _=require(_0x9811('0x0'));var util=require(_0x9811('0x1'));var moment=require(_0x9811('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9811('0x3'));var db=require(_0x9811('0x4'))['db'];var utils=require(_0x9811('0x5'));var logger=require(_0x9811('0x6'))(_0x9811('0x7'));var config=require(_0x9811('0x8'));var jayson=require(_0x9811('0x9'));var client=jayson[_0x9811('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x92a712,_0x1f76f9,_0x32fd4b){return new BPromise(function(_0x18fde9,_0x19e9ab){return client[_0x9811('0xb')](_0x92a712,_0x32fd4b)['then'](function(_0x32c757){logger[_0x9811('0xc')](_0x9811('0xd'),_0x1f76f9,_0x9811('0xe'));logger[_0x9811('0xf')](_0x9811('0x10'),_0x1f76f9,_0x9811('0xe'),JSON[_0x9811('0x11')](_0x32c757));if(_0x32c757[_0x9811('0x12')]){if(_0x32c757[_0x9811('0x12')]['code']===0x1f4){logger[_0x9811('0x12')](_0x9811('0xd'),_0x1f76f9,_0x32c757[_0x9811('0x12')][_0x9811('0x13')]);return _0x19e9ab(_0x32c757[_0x9811('0x12')][_0x9811('0x13')]);}logger[_0x9811('0x12')](_0x9811('0xd'),_0x1f76f9,_0x32c757['error'][_0x9811('0x13')]);return _0x18fde9(_0x32c757['error']['message']);}else{logger[_0x9811('0xc')](_0x9811('0xd'),_0x1f76f9,'request\x20sent');_0x18fde9(_0x32c757[_0x9811('0x14')][_0x9811('0x13')]);}})['catch'](function(_0x283573){logger[_0x9811('0x12')](_0x9811('0xd'),_0x1f76f9,_0x283573);_0x19e9ab(_0x283573);});});} \ No newline at end of file +var _0xd3e8=['rpc','../../config/environment','jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','bluebird','../../config/utils','../../config/logger'];(function(_0xf177dd,_0x51fc3d){var _0x3a6a54=function(_0x15b7c5){while(--_0x15b7c5){_0xf177dd['push'](_0xf177dd['shift']());}};_0x3a6a54(++_0x51fc3d);}(_0xd3e8,0x95));var _0x8d3e=function(_0x10f154,_0x12cf31){_0x10f154=_0x10f154-0x0;var _0xa58978=_0xd3e8[_0x10f154];return _0xa58978;};'use strict';var _=require(_0x8d3e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8d3e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8d3e('0x2'));var logger=require(_0x8d3e('0x3'))(_0x8d3e('0x4'));var config=require(_0x8d3e('0x5'));var jayson=require(_0x8d3e('0x6'));var client=jayson['client'][_0x8d3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x152da3,_0xd212b1,_0x210b12){return new BPromise(function(_0x3dc26d,_0x165fef){return client['request'](_0x152da3,_0x210b12)[_0x8d3e('0x8')](function(_0x537691){logger[_0x8d3e('0x9')](_0x8d3e('0xa'),_0xd212b1,'request\x20sent');logger['debug'](_0x8d3e('0xb'),_0xd212b1,'request\x20sent',JSON['stringify'](_0x537691));if(_0x537691[_0x8d3e('0xc')]){if(_0x537691[_0x8d3e('0xc')][_0x8d3e('0xd')]===0x1f4){logger[_0x8d3e('0xc')](_0x8d3e('0xa'),_0xd212b1,_0x537691[_0x8d3e('0xc')]['message']);return _0x165fef(_0x537691[_0x8d3e('0xc')][_0x8d3e('0xe')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xd212b1,_0x537691[_0x8d3e('0xc')][_0x8d3e('0xe')]);return _0x3dc26d(_0x537691[_0x8d3e('0xc')][_0x8d3e('0xe')]);}else{logger['info'](_0x8d3e('0xa'),_0xd212b1,_0x8d3e('0xf'));_0x3dc26d(_0x537691[_0x8d3e('0x10')]['message']);}})['catch'](function(_0x117100){logger[_0x8d3e('0xc')](_0x8d3e('0xa'),_0xd212b1,_0x117100);_0x165fef(_0x117100);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c0ad4c9..3231e4c 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 _0x98a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x98a8,0x12c));var _0x898a=function(_0x275f4b,_0x2064e5){_0x275f4b=_0x275f4b-0x0;var _0x4ba50d=_0x98a8[_0x275f4b];return _0x4ba50d;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')](_0x898a('0xb'),auth['isAuthenticated'](),controller[_0x898a('0xc')]);router['post']('/',auth[_0x898a('0xd')](),controller['create']);router[_0x898a('0xe')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xb'),auth[_0x898a('0xd')](),controller[_0x898a('0x11')]);module[_0x898a('0x12')]=router; \ No newline at end of file +var _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x7da7,0x10d));var _0x77da=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x7da7[_0x21353c];return _0xa99120;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index cda1d5a..dca0c43 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 _0x4f29=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x2d9d5f,_0x5a672a){var _0x58f10f=function(_0x5e4dd8){while(--_0x5e4dd8){_0x2d9d5f['push'](_0x2d9d5f['shift']());}};_0x58f10f(++_0x5a672a);}(_0x4f29,0xa6));var _0x94f2=function(_0x4e6846,_0x29ca95){_0x4e6846=_0x4e6846-0x0;var _0x112645=_0x4f29[_0x4e6846];return _0x112645;};'use strict';var Sequelize=require(_0x94f2('0x0'));module['exports']={'name':{'type':Sequelize[_0x94f2('0x1')],'unique':_0x94f2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x94f2('0x1')]},'timeout':{'type':Sequelize[_0x94f2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x94f2('0x4'),_0x94f2('0x5'),_0x94f2('0x6'))}}; \ No newline at end of file +var _0x7187=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x505642,_0xdbee26){var _0x541223=function(_0x3d06dd){while(--_0x3d06dd){_0x505642['push'](_0x505642['shift']());}};_0x541223(++_0xdbee26);}(_0x7187,0x88));var _0x7718=function(_0x5a3a55,_0x11e0ce){_0x5a3a55=_0x5a3a55-0x0;var _0x1ce4da=_0x7187[_0x5a3a55];return _0x1ce4da;};'use strict';var Sequelize=require(_0x7718('0x0'));module[_0x7718('0x1')]={'name':{'type':Sequelize[_0x7718('0x2')],'unique':_0x7718('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7718('0x2')]},'timeout':{'type':Sequelize[_0x7718('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7718('0x5')](_0x7718('0x6'),_0x7718('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 06cd7a4..eb0388e 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 _0x4d64=['length','options','create','body','user','role','ChatQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','nolimit','ChatQueueId','UserChatQueue','User','findAndCountAll','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','removeTeams','ids','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','userChatQueue:remove','addAgents','spread','userChatQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','get','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','type','query','filters','attributes','intersection','fields','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','keys'];(function(_0x415a7d,_0x3e9ed8){var _0x1a5de4=function(_0xc27a3c){while(--_0xc27a3c){_0x415a7d['push'](_0x415a7d['shift']());}};_0x1a5de4(++_0x3e9ed8);}(_0x4d64,0xd4));var _0x44d6=function(_0x53ab1d,_0x5d283b){_0x53ab1d=_0x53ab1d-0x0;var _0x363b70=_0x4d64[_0x53ab1d];return _0x363b70;};'use strict';var emlformat=require(_0x44d6('0x0'));var rimraf=require(_0x44d6('0x1'));var zipdir=require(_0x44d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44d6('0x3'));var moment=require(_0x44d6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x44d6('0x5'));var path=require(_0x44d6('0x6'));var sox=require(_0x44d6('0x7'));var csv=require(_0x44d6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44d6('0x9'));var squel=require('squel');var crypto=require(_0x44d6('0xa'));var jsforce=require(_0x44d6('0xb'));var deskjs=require(_0x44d6('0xc'));var toCsv=require(_0x44d6('0x8'));var querystring=require(_0x44d6('0xd'));var Papa=require(_0x44d6('0xe'));var Redis=require(_0x44d6('0xf'));var authService=require(_0x44d6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x44d6('0x11'));var hardwareService=require(_0x44d6('0x12'));var logger=require(_0x44d6('0x13'))(_0x44d6('0x14'));var utils=require(_0x44d6('0x15'));var config=require(_0x44d6('0x16'));var licenseUtil=require(_0x44d6('0x17'));var db=require(_0x44d6('0x18'))['db'];config[_0x44d6('0x19')]=_[_0x44d6('0x1a')](config[_0x44d6('0x19')],{'host':_0x44d6('0x1b'),'port':0x18eb});var socket=require(_0x44d6('0x1c'))(new Redis(config[_0x44d6('0x19')]));require(_0x44d6('0x1d'))[_0x44d6('0x1e')](socket);var jayson=require(_0x44d6('0x1f'));var client=jayson[_0x44d6('0x20')][_0x44d6('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2c1fdd,_0x503965,_0x20ec84,_0x564cbe){return new BPromise(function(_0x2ff0c5,_0xd5f353){var _0x5e4e6=_0x564cbe||client;return _0x5e4e6['request'](_0x2c1fdd,_0x20ec84)[_0x44d6('0x22')](function(_0x4a42ae){logger[_0x44d6('0x23')](_0x44d6('0x24'),_0x503965,_0x44d6('0x25'));logger['debug'](_0x44d6('0x26'),_0x503965,_0x44d6('0x25'),JSON[_0x44d6('0x27')](_0x4a42ae));if(_0x4a42ae[_0x44d6('0x28')]){if(_0x4a42ae['error']['code']===0x1f4){logger[_0x44d6('0x28')](_0x44d6('0x24'),_0x503965,_0x4a42ae['error']['message']);return _0xd5f353(_0x4a42ae['error'][_0x44d6('0x29')]);}logger[_0x44d6('0x28')]('ChatQueue,\x20%s,\x20%s',_0x503965,_0x4a42ae['error'][_0x44d6('0x29')]);return _0x2ff0c5(_0x4a42ae[_0x44d6('0x28')][_0x44d6('0x29')]);}else{logger[_0x44d6('0x23')]('ChatQueue,\x20%s,\x20%s',_0x503965,_0x44d6('0x25'));_0x2ff0c5(_0x4a42ae[_0x44d6('0x2a')][_0x44d6('0x29')]);}})[_0x44d6('0x2b')](function(_0x1b83cf){logger[_0x44d6('0x28')](_0x44d6('0x24'),_0x503965,_0x1b83cf);_0xd5f353(_0x1b83cf);});});}function respondWithStatusCode(_0x5bcb65,_0x18952f){_0x18952f=_0x18952f||0xcc;return function(_0x7c46a1){if(_0x7c46a1){return _0x5bcb65[_0x44d6('0x2c')](_0x18952f);}return _0x5bcb65['status'](_0x18952f)['end']();};}function respondWithResult(_0x49a09c,_0x42587c){_0x42587c=_0x42587c||0xc8;return function(_0x242bf8){if(_0x242bf8){return _0x49a09c[_0x44d6('0x2d')](_0x42587c)[_0x44d6('0x2e')](_0x242bf8);}};}function respondWithFilteredResult(_0x2c4ec8,_0x3eb924){return function(_0x29b999){if(_0x29b999){var _0x292563=typeof _0x3eb924[_0x44d6('0x2f')]===_0x44d6('0x30')&&typeof _0x3eb924[_0x44d6('0x31')]===_0x44d6('0x30');var _0x588bd8=_0x29b999['count'];var _0x5a8dc5=_0x292563?0x0:_0x3eb924['offset'];var _0x33b8c4=_0x292563?_0x29b999[_0x44d6('0x32')]:_0x3eb924[_0x44d6('0x2f')]+_0x3eb924[_0x44d6('0x31')];var _0x4f731f;if(_0x33b8c4>=_0x588bd8){_0x33b8c4=_0x588bd8;_0x4f731f=0xc8;}else{_0x4f731f=0xce;}_0x2c4ec8[_0x44d6('0x2d')](_0x4f731f);return _0x2c4ec8[_0x44d6('0x33')](_0x44d6('0x34'),_0x5a8dc5+'-'+_0x33b8c4+'/'+_0x588bd8)[_0x44d6('0x2e')](_0x29b999);}return null;};}function patchUpdates(_0x5f43cc){return function(_0x60b1ef){try{jsonpatch[_0x44d6('0x35')](_0x60b1ef,_0x5f43cc,!![]);}catch(_0x4664ea){return BPromise['reject'](_0x4664ea);}return _0x60b1ef[_0x44d6('0x36')]();};}function saveUpdates(_0x3a28b3,_0x340de4){return function(_0x4d9344){if(_0x4d9344){return _0x4d9344['update'](_0x3a28b3)['then'](function(_0x30a395){return _0x30a395;});}return null;};}function removeEntity(_0x5647a9,_0xa0edf2){return function(_0x17c8c1){if(_0x17c8c1){return _0x17c8c1[_0x44d6('0x37')]()[_0x44d6('0x22')](function(){var _0x2765e8=_0x17c8c1[_0x44d6('0x38')]({'plain':!![]});var _0x31348e='ChatQueues';return db[_0x44d6('0x39')][_0x44d6('0x37')]({'where':{'type':_0x31348e,'resourceId':_0x2765e8['id']}})[_0x44d6('0x22')](function(){return _0x17c8c1;});})[_0x44d6('0x22')](function(){_0x5647a9[_0x44d6('0x2d')](0xcc)[_0x44d6('0x3a')]();});}};}function handleEntityNotFound(_0x3bcbf3,_0x1c1c98){return function(_0x4d0aae){if(!_0x4d0aae){_0x3bcbf3['sendStatus'](0x194);}return _0x4d0aae;};}function handleError(_0x533981,_0x1365a4){_0x1365a4=_0x1365a4||0x1f4;return function(_0x4d33de){logger['error'](_0x4d33de[_0x44d6('0x3b')]);if(_0x4d33de[_0x44d6('0x3c')]){delete _0x4d33de[_0x44d6('0x3c')];}_0x533981['status'](_0x1365a4)[_0x44d6('0x3d')](_0x4d33de);};}exports[_0x44d6('0x3e')]=function(_0x2e6050,_0x1865e1){var _0x4f474d={},_0x3e718b={},_0x1c63c0={'count':0x0,'rows':[]};var _0x1a2828=_[_0x44d6('0x3f')](db[_0x44d6('0x40')][_0x44d6('0x41')],function(_0x456aa7){return{'name':_0x456aa7['fieldName'],'type':_0x456aa7[_0x44d6('0x42')]['key']};});_0x3e718b['model']=_[_0x44d6('0x3f')](_0x1a2828,_0x44d6('0x3c'));_0x3e718b[_0x44d6('0x43')]=_['keys'](_0x2e6050['query']);_0x3e718b[_0x44d6('0x44')]=_['intersection'](_0x3e718b['model'],_0x3e718b['query']);_0x4f474d[_0x44d6('0x45')]=_[_0x44d6('0x46')](_0x3e718b['model'],qs[_0x44d6('0x47')](_0x2e6050[_0x44d6('0x43')][_0x44d6('0x47')]));_0x4f474d[_0x44d6('0x45')]=_0x4f474d[_0x44d6('0x45')]['length']?_0x4f474d['attributes']:_0x3e718b[_0x44d6('0x48')];if(!_0x2e6050[_0x44d6('0x43')][_0x44d6('0x49')]('nolimit')){_0x4f474d[_0x44d6('0x31')]=qs['limit'](_0x2e6050[_0x44d6('0x43')][_0x44d6('0x31')]);_0x4f474d[_0x44d6('0x2f')]=qs[_0x44d6('0x2f')](_0x2e6050[_0x44d6('0x43')][_0x44d6('0x2f')]);}_0x4f474d[_0x44d6('0x4a')]=qs['sort'](_0x2e6050[_0x44d6('0x43')][_0x44d6('0x4b')]);_0x4f474d[_0x44d6('0x4c')]=qs[_0x44d6('0x44')](_[_0x44d6('0x4d')](_0x2e6050['query'],_0x3e718b[_0x44d6('0x44')]),_0x1a2828);if(_0x2e6050[_0x44d6('0x43')][_0x44d6('0x4e')]){_0x4f474d['where']=_[_0x44d6('0x4f')](_0x4f474d[_0x44d6('0x4c')],{'$or':_[_0x44d6('0x3f')](_0x1a2828,function(_0x4687c9){if(_0x4687c9[_0x44d6('0x42')]!==_0x44d6('0x50')){var _0x1895c7={};_0x1895c7[_0x4687c9[_0x44d6('0x3c')]]={'$like':'%'+_0x2e6050['query']['filter']+'%'};return _0x1895c7;}})});}_0x4f474d=_[_0x44d6('0x4f')]({},_0x4f474d,_0x2e6050['options']);var _0xd95e32={'where':_0x4f474d[_0x44d6('0x4c')]};return db[_0x44d6('0x40')][_0x44d6('0x32')](_0xd95e32)[_0x44d6('0x22')](function(_0x7f1fa3){_0x1c63c0[_0x44d6('0x32')]=_0x7f1fa3;if(_0x2e6050[_0x44d6('0x43')][_0x44d6('0x51')]){_0x4f474d[_0x44d6('0x52')]=[{'all':!![]}];}return db[_0x44d6('0x40')][_0x44d6('0x53')](_0x4f474d);})[_0x44d6('0x22')](function(_0x452f61){_0x1c63c0['rows']=_0x452f61;return _0x1c63c0;})['then'](respondWithFilteredResult(_0x1865e1,_0x4f474d))[_0x44d6('0x2b')](handleError(_0x1865e1,null));};exports[_0x44d6('0x54')]=function(_0x2bdd3c,_0x1dc6ad){var _0x59d260={'raw':!![],'where':{'id':_0x2bdd3c['params']['id']}},_0x16e450={};_0x16e450[_0x44d6('0x48')]=_[_0x44d6('0x55')](db['ChatQueue'][_0x44d6('0x41')]);_0x16e450[_0x44d6('0x43')]=_['keys'](_0x2bdd3c[_0x44d6('0x43')]);_0x16e450['filters']=_[_0x44d6('0x46')](_0x16e450[_0x44d6('0x48')],_0x16e450[_0x44d6('0x43')]);_0x59d260[_0x44d6('0x45')]=_[_0x44d6('0x46')](_0x16e450[_0x44d6('0x48')],qs['fields'](_0x2bdd3c[_0x44d6('0x43')]['fields']));_0x59d260['attributes']=_0x59d260[_0x44d6('0x45')][_0x44d6('0x56')]?_0x59d260[_0x44d6('0x45')]:_0x16e450[_0x44d6('0x48')];if(_0x2bdd3c[_0x44d6('0x43')][_0x44d6('0x51')]){_0x59d260['include']=[{'all':!![]}];}_0x59d260=_[_0x44d6('0x4f')]({},_0x59d260,_0x2bdd3c[_0x44d6('0x57')]);return db[_0x44d6('0x40')]['find'](_0x59d260)[_0x44d6('0x22')](handleEntityNotFound(_0x1dc6ad,null))['then'](respondWithResult(_0x1dc6ad,null))[_0x44d6('0x2b')](handleError(_0x1dc6ad,null));};exports[_0x44d6('0x58')]=function(_0x11db46,_0x587de3){return db[_0x44d6('0x40')]['create'](_0x11db46[_0x44d6('0x59')],{})[_0x44d6('0x22')](function(_0xa8e92d){var _0xe4d420=_0x11db46[_0x44d6('0x5a')][_0x44d6('0x38')]({'plain':!![]});if(!_0xe4d420)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe4d420[_0x44d6('0x5b')]===_0x44d6('0x5a')){var _0x279e6b=_0xa8e92d[_0x44d6('0x38')]({'plain':!![]});var _0x3eaba4=_0x44d6('0x5c');return db['UserProfileSection'][_0x44d6('0x5d')]({'where':{'name':_0x3eaba4,'userProfileId':_0xe4d420[_0x44d6('0x5e')]},'raw':!![]})['then'](function(_0x148cd2){if(_0x148cd2&&_0x148cd2[_0x44d6('0x5f')]===0x0){return db[_0x44d6('0x39')]['create']({'name':_0x279e6b[_0x44d6('0x3c')],'resourceId':_0x279e6b['id'],'type':_0x148cd2[_0x44d6('0x3c')],'sectionId':_0x148cd2['id']},{})[_0x44d6('0x22')](function(){return _0xa8e92d;});}else{return _0xa8e92d;}})[_0x44d6('0x2b')](function(_0x18951a){logger[_0x44d6('0x28')](_0x44d6('0x60'),_0x18951a);throw _0x18951a;});}return _0xa8e92d;})[_0x44d6('0x22')](respondWithResult(_0x587de3,0xc9))[_0x44d6('0x2b')](handleError(_0x587de3,null));};exports[_0x44d6('0x61')]=function(_0x4d6f66,_0xe18a7a){if(_0x4d6f66[_0x44d6('0x59')]['id']){delete _0x4d6f66[_0x44d6('0x59')]['id'];}return db[_0x44d6('0x40')]['find']({'where':{'id':_0x4d6f66[_0x44d6('0x62')]['id']}})['then'](handleEntityNotFound(_0xe18a7a,null))[_0x44d6('0x22')](saveUpdates(_0x4d6f66[_0x44d6('0x59')],null))[_0x44d6('0x22')](respondWithResult(_0xe18a7a,null))['catch'](handleError(_0xe18a7a,null));};exports[_0x44d6('0x37')]=function(_0x521dd0,_0x29e37d){return db['ChatQueue'][_0x44d6('0x5d')]({'where':{'id':_0x521dd0['params']['id']}})[_0x44d6('0x22')](handleEntityNotFound(_0x29e37d,null))['then'](removeEntity(_0x29e37d,null))['catch'](handleError(_0x29e37d,null));};exports[_0x44d6('0x63')]=function(_0x108085,_0x42aa81){return db[_0x44d6('0x40')][_0x44d6('0x63')]()[_0x44d6('0x22')](respondWithResult(_0x42aa81,null))['catch'](handleError(_0x42aa81,null));};exports[_0x44d6('0x64')]=function(_0x38f355,_0x5d4faf,_0x11ceb7){var _0x3a46fb={'raw':!![],'where':{}},_0x2f9331={},_0x496a39;return db[_0x44d6('0x40')][_0x44d6('0x65')]({'where':{'id':_0x38f355['params']['id']}})[_0x44d6('0x22')](handleEntityNotFound(_0x5d4faf,null))['then'](function(_0x1d65a5){if(_0x1d65a5){_0x496a39=_0x1d65a5['get']({'plain':!![]});_0x2f9331[_0x44d6('0x48')]=_[_0x44d6('0x55')](db['UserChatQueue']['rawAttributes']);_0x2f9331[_0x44d6('0x43')]=_[_0x44d6('0x55')](_0x38f355['query']);_0x2f9331[_0x44d6('0x44')]=_['intersection'](_0x2f9331[_0x44d6('0x48')],_0x2f9331['query']);_0x3a46fb[_0x44d6('0x45')]=_['intersection'](_0x2f9331['model'],qs[_0x44d6('0x47')](_0x38f355['query']['fields']));_0x3a46fb[_0x44d6('0x45')]=_0x3a46fb[_0x44d6('0x45')][_0x44d6('0x56')]?_0x3a46fb['attributes']:_0x2f9331[_0x44d6('0x48')];if(!_0x38f355['query']['hasOwnProperty'](_0x44d6('0x66'))){_0x3a46fb[_0x44d6('0x31')]=qs[_0x44d6('0x31')](_0x38f355[_0x44d6('0x43')][_0x44d6('0x31')]);_0x3a46fb[_0x44d6('0x2f')]=qs['offset'](_0x38f355['query'][_0x44d6('0x2f')]);}_0x3a46fb[_0x44d6('0x4a')]=qs['sort'](_0x38f355[_0x44d6('0x43')][_0x44d6('0x4b')]);_0x3a46fb['where']=qs['filters'](_[_0x44d6('0x4d')](_0x38f355[_0x44d6('0x43')],_0x2f9331[_0x44d6('0x44')]));_0x3a46fb[_0x44d6('0x4c')][_0x44d6('0x67')]=_0x1d65a5['id'];if(_0x38f355['query'][_0x44d6('0x4e')]){_0x3a46fb[_0x44d6('0x4c')]=_[_0x44d6('0x4f')](_0x3a46fb[_0x44d6('0x4c')],{'$or':_[_0x44d6('0x3f')](_0x3a46fb[_0x44d6('0x45')],function(_0x189dd0){var _0x32804f={};_0x32804f[_0x189dd0]={'$like':'%'+_0x38f355[_0x44d6('0x43')][_0x44d6('0x4e')]+'%'};return _0x32804f;})});}_0x3a46fb=_[_0x44d6('0x4f')]({},_0x3a46fb,_0x38f355[_0x44d6('0x57')]);return db[_0x44d6('0x68')][_0x44d6('0x53')](_0x3a46fb);}})['then'](function(_0x5c1af7){if(_0x5c1af7){return db[_0x44d6('0x69')][_0x44d6('0x6a')]({'where':{'id':_['map'](_0x5c1af7,'UserId'),'role':'agent'},'attributes':['id','name',_0x44d6('0x6b'),_0x44d6('0x6c'),_0x44d6('0x6d')]});}})[_0x44d6('0x22')](function(_0x367740){if(_0x367740){return{'count':_0x367740[_0x44d6('0x32')],'rows':_[_0x44d6('0x3f')](_0x367740[_0x44d6('0x6e')],function(_0x365de5){return{'membername':_0x365de5['name'],'UserId':_0x365de5['id'],'queue_name':_0x496a39['name'],'ChatQueueId':_0x496a39['id'],'interface':util[_0x44d6('0x6f')](_0x44d6('0x70'),_0x44d6('0x71'),_0x365de5[_0x44d6('0x3c')]),'penalty':0x0,'paused':_0x365de5['chatPause'],'createdAt':_0x365de5['createdAt'],'updatedAt':_0x365de5[_0x44d6('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x44d6('0x22')](respondWithFilteredResult(_0x5d4faf,_0x3a46fb))[_0x44d6('0x2b')](handleError(_0x5d4faf,null));};exports[_0x44d6('0x72')]=function(_0x24f41b,_0x363076,_0x164725){var _0x119f96={};var _0x6f2368={};var _0x449d3b;var _0x5c9c0f;return db[_0x44d6('0x40')][_0x44d6('0x65')]({'where':{'id':_0x24f41b[_0x44d6('0x62')]['id']}})['then'](handleEntityNotFound(_0x363076,null))[_0x44d6('0x22')](function(_0x1d728c){if(_0x1d728c){_0x449d3b=_0x1d728c;_0x6f2368['model']=_['keys'](db[_0x44d6('0x73')][_0x44d6('0x41')]);_0x6f2368['query']=_[_0x44d6('0x55')](_0x24f41b[_0x44d6('0x43')]);_0x6f2368[_0x44d6('0x44')]=_[_0x44d6('0x46')](_0x6f2368[_0x44d6('0x48')],_0x6f2368[_0x44d6('0x43')]);_0x119f96[_0x44d6('0x45')]=_[_0x44d6('0x46')](_0x6f2368[_0x44d6('0x48')],qs[_0x44d6('0x47')](_0x24f41b[_0x44d6('0x43')][_0x44d6('0x47')]));_0x119f96['attributes']=_0x119f96['attributes'][_0x44d6('0x56')]?_0x119f96[_0x44d6('0x45')]:_0x6f2368[_0x44d6('0x48')];_0x119f96[_0x44d6('0x4a')]=qs[_0x44d6('0x4b')](_0x24f41b['query'][_0x44d6('0x4b')]);_0x119f96[_0x44d6('0x4c')]=qs['filters'](_[_0x44d6('0x4d')](_0x24f41b[_0x44d6('0x43')],_0x6f2368[_0x44d6('0x44')]));if(_0x24f41b[_0x44d6('0x43')]['filter']){_0x119f96[_0x44d6('0x4c')]=_[_0x44d6('0x4f')](_0x119f96[_0x44d6('0x4c')],{'$or':_[_0x44d6('0x3f')](_0x119f96[_0x44d6('0x45')],function(_0x40d9b2){var _0x3fa3d3={};_0x3fa3d3[_0x40d9b2]={'$like':'%'+_0x24f41b[_0x44d6('0x43')][_0x44d6('0x4e')]+'%'};return _0x3fa3d3;})});}_0x119f96=_[_0x44d6('0x4f')]({},_0x119f96,_0x24f41b[_0x44d6('0x57')]);return _0x449d3b[_0x44d6('0x72')](_0x119f96);}})[_0x44d6('0x22')](function(_0x1a527a){if(_0x1a527a){_0x5c9c0f=_0x1a527a['length'];if(!_0x24f41b[_0x44d6('0x43')]['hasOwnProperty'](_0x44d6('0x66'))){_0x119f96[_0x44d6('0x31')]=qs[_0x44d6('0x31')](_0x24f41b[_0x44d6('0x43')][_0x44d6('0x31')]);_0x119f96[_0x44d6('0x2f')]=qs[_0x44d6('0x2f')](_0x24f41b[_0x44d6('0x43')][_0x44d6('0x2f')]);}return _0x449d3b[_0x44d6('0x72')](_0x119f96);}})[_0x44d6('0x22')](function(_0x49b3ef){if(_0x49b3ef){return _0x49b3ef?{'count':_0x5c9c0f,'rows':_0x49b3ef}:null;}})['then'](respondWithResult(_0x363076,null))['catch'](handleError(_0x363076,null));};exports[_0x44d6('0x74')]=function(_0x2f8757,_0x566001,_0x2a7ce5){var _0xee28d6=_0x2f8757[_0x44d6('0x59')]['ids'];return db[_0x44d6('0x73')][_0x44d6('0x53')]({'where':{'id':_0xee28d6},'attributes':['id'],'include':[{'model':db[_0x44d6('0x69')],'as':_0x44d6('0x75'),'attributes':['id',_0x44d6('0x3c'),_0x44d6('0x76'),'voicePause',_0x44d6('0x77')],'raw':!![]}]})[_0x44d6('0x22')](function(_0x35bb63){if(_0x35bb63){var _0x2e2ba5=_[_0x44d6('0x78')](_0x35bb63,function(_0x4cfc74){var _0x9a3f56=_0x4cfc74['get']({'plain':!![]});return _0x9a3f56[_0x44d6('0x75')];});return db[_0x44d6('0x40')][_0x44d6('0x5d')]({'where':{'id':_0x2f8757[_0x44d6('0x62')]['id']}})['then'](function(_0x2e2c41){return db[_0x44d6('0x79')][_0x44d6('0x7a')](function(_0x21a3b2){return _0x2e2c41[_0x44d6('0x74')](_0xee28d6,{'transaction':_0x21a3b2})[_0x44d6('0x22')](function(){return BPromise[_0x44d6('0x7b')](_0x2e2ba5,function(_0x46313f){return db[_0x44d6('0x68')]['findOrCreate']({'where':{'UserId':_0x46313f['id'],'ChatQueueId':_0x2f8757[_0x44d6('0x62')]['id']},'transaction':_0x21a3b2});});})['then'](function(){_0x2e2ba5[_0x44d6('0x7c')](function(_0x29ebb1){socket[_0x44d6('0x7d')]('userChatQueue:save',{'UserId':_0x29ebb1['id'],'ChatQueueId':_0x2e2c41['id']});});});});});}})[_0x44d6('0x22')](respondWithStatusCode(_0x566001,null))['catch'](handleError(_0x566001,null));};exports[_0x44d6('0x7e')]=function(_0xe9fcb3,_0x3bc220,_0x3721f8){return db[_0x44d6('0x73')][_0x44d6('0x53')]({'where':{'id':_0xe9fcb3[_0x44d6('0x43')][_0x44d6('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x44d6('0x69')],'as':_0x44d6('0x75'),'attributes':['id'],'raw':!![]}]})[_0x44d6('0x22')](handleEntityNotFound(_0x3bc220,null))[_0x44d6('0x22')](function(_0x2d31e){var _0x15e92a=_['map'](_0x2d31e,'id');var _0xd78ce4=[];var _0x252588=[];var _0x32f86d=squel['select']();_0x32f86d[_0x44d6('0x80')]('tq.TeamId')['from'](_0x44d6('0x81'),'tq')[_0x44d6('0x82')](_0x44d6('0x83'),'ut',_0x44d6('0x84'))[_0x44d6('0x4c')]('ChatQueueId\x20=\x20?',_0xe9fcb3[_0x44d6('0x62')]['id']);for(var _0x4a834c=0x0;_0x4a834c<_0x2d31e['length'];_0x4a834c+=0x1){let _0x1d6d1f=_0x2d31e[_0x4a834c];for(var _0x53354b=0x0;_0x53354b<_0x1d6d1f[_0x44d6('0x75')]['length'];_0x53354b+=0x1){let _0x547b0e=_0x1d6d1f[_0x44d6('0x75')][_0x53354b];var _0x5d84bd=_0x32f86d['clone']();_0x5d84bd[_0x44d6('0x4c')](_0x44d6('0x85'),_0x547b0e['id']);_0x252588['push'](db[_0x44d6('0x79')]['query'](_0x5d84bd[_0x44d6('0x86')](),{'type':db[_0x44d6('0x79')][_0x44d6('0x87')][_0x44d6('0x88')]})[_0x44d6('0x22')](function(_0x18d571){if(_0x18d571[_0x44d6('0x56')]===0x1){return _0x547b0e['id'];}else{var _0x361e28=_[_0x44d6('0x89')](_[_0x44d6('0x3f')](_0x18d571,'TeamId'),function(_0x1f19e9){return _[_0x44d6('0x8a')](_0x15e92a,_0x1f19e9);});if(_0x361e28){return _0x547b0e['id'];}}}));}}return BPromise['all'](_0x252588)[_0x44d6('0x22')](function(_0xb81ecc){_0xd78ce4=_(_0xd78ce4)[_0x44d6('0x8b')](_0xb81ecc)[_0x44d6('0x8c')]()[_0x44d6('0x8d')]();return db['ChatQueue'][_0x44d6('0x5d')]({'where':{'id':_0xe9fcb3['params']['id']}})[_0x44d6('0x22')](function(_0xa70bce){return db['sequelize'][_0x44d6('0x7a')](function(_0xc35cf7){return _0xa70bce[_0x44d6('0x7e')](_0xe9fcb3['query'][_0x44d6('0x7f')],{'transaction':_0xc35cf7})[_0x44d6('0x22')](function(){if(!_[_0x44d6('0x8e')](_0xd78ce4)){return _0xa70bce['removeAgents'](_0xd78ce4,{'transaction':_0xc35cf7});}})['then'](function(){_0xd78ce4[_0x44d6('0x7c')](function(_0x3f925e){socket['emit'](_0x44d6('0x8f'),{'UserId':_0x3f925e,'ChatQueueId':_0xa70bce['id']});});});});});});})[_0x44d6('0x22')](respondWithStatusCode(_0x3bc220,null))[_0x44d6('0x2b')](handleError(_0x3bc220,null));};exports[_0x44d6('0x90')]=function(_0x490670,_0x42802f,_0x5a2222){return db[_0x44d6('0x40')][_0x44d6('0x5d')]({'where':{'id':_0x490670[_0x44d6('0x62')]['id']}})[_0x44d6('0x22')](handleEntityNotFound(_0x42802f,null))[_0x44d6('0x22')](function(_0x1fb7dc){if(_0x1fb7dc){return _0x1fb7dc[_0x44d6('0x90')](_0x490670[_0x44d6('0x59')][_0x44d6('0x7f')],_['omit'](_0x490670[_0x44d6('0x59')],[_0x44d6('0x7f'),'id'])||{})[_0x44d6('0x91')](function(_0x49bd84){for(var _0x342dae=0x0;_0x342dae<_0x490670[_0x44d6('0x59')][_0x44d6('0x7f')][_0x44d6('0x56')];_0x342dae+=0x1){socket['emit'](_0x44d6('0x92'),{'UserId':Number(_0x490670[_0x44d6('0x59')]['ids'][_0x342dae]),'ChatQueueId':Number(_0x490670[_0x44d6('0x62')]['id'])});}return _0x49bd84;});}})['then'](respondWithResult(_0x42802f,null))[_0x44d6('0x2b')](handleError(_0x42802f,null));};exports[_0x44d6('0x93')]=function(_0x4f9c2f,_0x1e8e11,_0x1d8e4f){return db[_0x44d6('0x40')]['find']({'where':{'id':_0x4f9c2f['params']['id']}})['then'](handleEntityNotFound(_0x1e8e11,null))[_0x44d6('0x22')](function(_0x136334){if(_0x136334){return _0x136334[_0x44d6('0x93')](_0x4f9c2f['query'][_0x44d6('0x7f')])[_0x44d6('0x22')](function(){if(_['isArray'](_0x4f9c2f['query'][_0x44d6('0x7f')])){for(var _0x2dc32a=0x0;_0x2dc32a<_0x4f9c2f[_0x44d6('0x43')][_0x44d6('0x7f')][_0x44d6('0x56')];_0x2dc32a+=0x1){socket['emit'](_0x44d6('0x8f'),{'UserId':Number(_0x4f9c2f[_0x44d6('0x43')][_0x44d6('0x7f')][_0x2dc32a]),'ChatQueueId':Number(_0x4f9c2f[_0x44d6('0x62')]['id'])});}}else{socket[_0x44d6('0x7d')](_0x44d6('0x8f'),{'UserId':Number(_0x4f9c2f['query'][_0x44d6('0x7f')]),'ChatQueueId':Number(_0x4f9c2f[_0x44d6('0x62')]['id'])});}});}})[_0x44d6('0x22')](respondWithStatusCode(_0x1e8e11,null))[_0x44d6('0x2b')](handleError(_0x1e8e11,null));};exports[_0x44d6('0x94')]=function(_0x3bd9e4,_0x3718f0,_0xffd40){var _0x2b2e1b={};var _0x4cab6f={};var _0x5a4d96;var _0x3df6f0;return db['ChatQueue'][_0x44d6('0x65')]({'where':{'id':_0x3bd9e4['params']['id']}})[_0x44d6('0x22')](handleEntityNotFound(_0x3718f0,null))[_0x44d6('0x22')](function(_0x41761c){if(_0x41761c){_0x5a4d96=_0x41761c;_0x4cab6f['model']=_[_0x44d6('0x55')](db[_0x44d6('0x69')][_0x44d6('0x41')]);_0x4cab6f[_0x44d6('0x43')]=_[_0x44d6('0x55')](_0x3bd9e4[_0x44d6('0x43')]);_0x4cab6f[_0x44d6('0x44')]=_['intersection'](_0x4cab6f[_0x44d6('0x48')],_0x4cab6f[_0x44d6('0x43')]);_0x2b2e1b['attributes']=_['intersection'](_0x4cab6f[_0x44d6('0x48')],qs[_0x44d6('0x47')](_0x3bd9e4[_0x44d6('0x43')][_0x44d6('0x47')]));_0x2b2e1b[_0x44d6('0x45')]=_0x2b2e1b[_0x44d6('0x45')][_0x44d6('0x56')]?_0x2b2e1b['attributes']:_0x4cab6f[_0x44d6('0x48')];_0x2b2e1b[_0x44d6('0x4a')]=qs[_0x44d6('0x4b')](_0x3bd9e4['query'][_0x44d6('0x4b')]);_0x2b2e1b['where']=qs['filters'](_[_0x44d6('0x4d')](_0x3bd9e4[_0x44d6('0x43')],_0x4cab6f['filters']));if(_0x3bd9e4[_0x44d6('0x43')]['filter']){_0x2b2e1b[_0x44d6('0x4c')]=_[_0x44d6('0x4f')](_0x2b2e1b[_0x44d6('0x4c')],{'$or':_['map'](_0x2b2e1b['attributes'],function(_0x1d1ba9){var _0x5df80b={};_0x5df80b[_0x1d1ba9]={'$like':'%'+_0x3bd9e4[_0x44d6('0x43')]['filter']+'%'};return _0x5df80b;})});}_0x2b2e1b=_[_0x44d6('0x4f')]({},_0x2b2e1b,_0x3bd9e4[_0x44d6('0x57')]);return _0x5a4d96[_0x44d6('0x94')](_0x2b2e1b);}})[_0x44d6('0x22')](function(_0x4459b8){if(_0x4459b8){_0x3df6f0=_0x4459b8['length'];if(!_0x3bd9e4[_0x44d6('0x43')]['hasOwnProperty'](_0x44d6('0x66'))){_0x2b2e1b['limit']=qs[_0x44d6('0x31')](_0x3bd9e4[_0x44d6('0x43')]['limit']);_0x2b2e1b[_0x44d6('0x2f')]=qs[_0x44d6('0x2f')](_0x3bd9e4[_0x44d6('0x43')][_0x44d6('0x2f')]);}return _0x5a4d96[_0x44d6('0x94')](_0x2b2e1b);}})[_0x44d6('0x22')](function(_0x175a48){if(_0x175a48){return _0x175a48?{'count':_0x3df6f0,'rows':_0x175a48}:null;}})[_0x44d6('0x22')](respondWithResult(_0x3718f0,null))[_0x44d6('0x2b')](handleError(_0x3718f0,null));}; \ No newline at end of file +var _0x4c35=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','request','ChatQueue,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','nolimit','order','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','voicePause','Agents','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Team','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','all','union','compact','value','sequelize','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c35,0x86));var _0x54c3=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0x4c35[_0x7185f7];return _0x182e45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54c3('0x1'));var rp=require('request-promise');var moment=require(_0x54c3('0x2'));var BPromise=require(_0x54c3('0x3'));var Mustache=require(_0x54c3('0x4'));var util=require(_0x54c3('0x5'));var path=require(_0x54c3('0x6'));var sox=require(_0x54c3('0x7'));var csv=require(_0x54c3('0x8'));var ejs=require(_0x54c3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54c3('0xa'));var squel=require('squel');var crypto=require(_0x54c3('0xb'));var jsforce=require(_0x54c3('0xc'));var deskjs=require(_0x54c3('0xd'));var toCsv=require(_0x54c3('0x8'));var querystring=require(_0x54c3('0xe'));var Papa=require('papaparse');var Redis=require(_0x54c3('0xf'));var authService=require(_0x54c3('0x10'));var qs=require(_0x54c3('0x11'));var as=require(_0x54c3('0x12'));var hardwareService=require(_0x54c3('0x13'));var logger=require(_0x54c3('0x14'))(_0x54c3('0x15'));var utils=require('../../config/utils');var config=require(_0x54c3('0x16'));var licenseUtil=require(_0x54c3('0x17'));var db=require(_0x54c3('0x18'))['db'];config[_0x54c3('0x19')]=_[_0x54c3('0x1a')](config[_0x54c3('0x19')],{'host':_0x54c3('0x1b'),'port':0x18eb});var socket=require(_0x54c3('0x1c'))(new Redis(config[_0x54c3('0x19')]));require(_0x54c3('0x1d'))['register'](socket);var jayson=require(_0x54c3('0x1e'));var client=jayson[_0x54c3('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183454,_0x3a1334,_0xf5d99f,_0x17ec0b){return new BPromise(function(_0x1b1bc0,_0x2e4833){var _0x1ee2c6=_0x17ec0b||client;return _0x1ee2c6[_0x54c3('0x20')](_0x183454,_0xf5d99f)['then'](function(_0x2b8e07){logger['info'](_0x54c3('0x21'),_0x3a1334,'request\x20sent');logger[_0x54c3('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3a1334,'request\x20sent',JSON[_0x54c3('0x23')](_0x2b8e07));if(_0x2b8e07[_0x54c3('0x24')]){if(_0x2b8e07['error'][_0x54c3('0x25')]===0x1f4){logger[_0x54c3('0x24')](_0x54c3('0x21'),_0x3a1334,_0x2b8e07[_0x54c3('0x24')]['message']);return _0x2e4833(_0x2b8e07['error'][_0x54c3('0x26')]);}logger['error'](_0x54c3('0x21'),_0x3a1334,_0x2b8e07[_0x54c3('0x24')][_0x54c3('0x26')]);return _0x1b1bc0(_0x2b8e07[_0x54c3('0x24')][_0x54c3('0x26')]);}else{logger[_0x54c3('0x27')](_0x54c3('0x21'),_0x3a1334,_0x54c3('0x28'));_0x1b1bc0(_0x2b8e07[_0x54c3('0x29')][_0x54c3('0x26')]);}})[_0x54c3('0x2a')](function(_0x2a556e){logger[_0x54c3('0x24')](_0x54c3('0x21'),_0x3a1334,_0x2a556e);_0x2e4833(_0x2a556e);});});}function respondWithStatusCode(_0x4918e9,_0x3f43c2){_0x3f43c2=_0x3f43c2||0xcc;return function(_0x128eb6){if(_0x128eb6){return _0x4918e9[_0x54c3('0x2b')](_0x3f43c2);}return _0x4918e9[_0x54c3('0x2c')](_0x3f43c2)[_0x54c3('0x2d')]();};}function respondWithResult(_0x217226,_0x2bbec9){_0x2bbec9=_0x2bbec9||0xc8;return function(_0x188993){if(_0x188993){return _0x217226[_0x54c3('0x2c')](_0x2bbec9)[_0x54c3('0x2e')](_0x188993);}};}function respondWithFilteredResult(_0x16b310,_0xfa7714){return function(_0x3cecc4){if(_0x3cecc4){var _0x6c24e7=typeof _0xfa7714[_0x54c3('0x2f')]===_0x54c3('0x30')&&typeof _0xfa7714[_0x54c3('0x31')]===_0x54c3('0x30');var _0x371e04=_0x3cecc4[_0x54c3('0x32')];var _0x2f4252=_0x6c24e7?0x0:_0xfa7714['offset'];var _0x51bffb=_0x6c24e7?_0x3cecc4[_0x54c3('0x32')]:_0xfa7714['offset']+_0xfa7714[_0x54c3('0x31')];var _0x4febda;if(_0x51bffb>=_0x371e04){_0x51bffb=_0x371e04;_0x4febda=0xc8;}else{_0x4febda=0xce;}_0x16b310[_0x54c3('0x2c')](_0x4febda);return _0x16b310['set'](_0x54c3('0x33'),_0x2f4252+'-'+_0x51bffb+'/'+_0x371e04)[_0x54c3('0x2e')](_0x3cecc4);}return null;};}function patchUpdates(_0x343e2d){return function(_0x1fc2aa){try{jsonpatch['apply'](_0x1fc2aa,_0x343e2d,!![]);}catch(_0x5e7855){return BPromise[_0x54c3('0x34')](_0x5e7855);}return _0x1fc2aa[_0x54c3('0x35')]();};}function saveUpdates(_0x31b918,_0x2605f6){return function(_0x1e05f7){if(_0x1e05f7){return _0x1e05f7[_0x54c3('0x36')](_0x31b918)[_0x54c3('0x37')](function(_0x3c05e6){return _0x3c05e6;});}return null;};}function removeEntity(_0x52d548,_0x420b18){return function(_0x17a716){if(_0x17a716){return _0x17a716[_0x54c3('0x38')]()[_0x54c3('0x37')](function(){var _0x38be6d=_0x17a716[_0x54c3('0x39')]({'plain':!![]});var _0x4f382b=_0x54c3('0x3a');return db[_0x54c3('0x3b')][_0x54c3('0x38')]({'where':{'type':_0x4f382b,'resourceId':_0x38be6d['id']}})['then'](function(){return _0x17a716;});})[_0x54c3('0x37')](function(){_0x52d548['status'](0xcc)[_0x54c3('0x2d')]();});}};}function handleEntityNotFound(_0x4b5999,_0x3329f9){return function(_0x14555d){if(!_0x14555d){_0x4b5999[_0x54c3('0x2b')](0x194);}return _0x14555d;};}function handleError(_0x3e95db,_0x24e965){_0x24e965=_0x24e965||0x1f4;return function(_0x2dc5f8){logger[_0x54c3('0x24')](_0x2dc5f8[_0x54c3('0x3c')]);if(_0x2dc5f8['name']){delete _0x2dc5f8[_0x54c3('0x3d')];}_0x3e95db[_0x54c3('0x2c')](_0x24e965)[_0x54c3('0x3e')](_0x2dc5f8);};}exports[_0x54c3('0x3f')]=function(_0x12dd6a,_0x376d03){var _0x41b9e2={},_0x29d1c4={},_0x2b441e={'count':0x0,'rows':[]};var _0x477be8=_['map'](db[_0x54c3('0x40')][_0x54c3('0x41')],function(_0x348709){return{'name':_0x348709[_0x54c3('0x42')],'type':_0x348709[_0x54c3('0x43')][_0x54c3('0x44')]};});_0x29d1c4[_0x54c3('0x45')]=_[_0x54c3('0x46')](_0x477be8,_0x54c3('0x3d'));_0x29d1c4['query']=_['keys'](_0x12dd6a['query']);_0x29d1c4[_0x54c3('0x47')]=_[_0x54c3('0x48')](_0x29d1c4['model'],_0x29d1c4[_0x54c3('0x49')]);_0x41b9e2[_0x54c3('0x4a')]=_['intersection'](_0x29d1c4[_0x54c3('0x45')],qs[_0x54c3('0x4b')](_0x12dd6a['query'][_0x54c3('0x4b')]));_0x41b9e2[_0x54c3('0x4a')]=_0x41b9e2[_0x54c3('0x4a')][_0x54c3('0x4c')]?_0x41b9e2[_0x54c3('0x4a')]:_0x29d1c4['model'];if(!_0x12dd6a[_0x54c3('0x49')][_0x54c3('0x4d')]('nolimit')){_0x41b9e2['limit']=qs[_0x54c3('0x31')](_0x12dd6a[_0x54c3('0x49')]['limit']);_0x41b9e2[_0x54c3('0x2f')]=qs[_0x54c3('0x2f')](_0x12dd6a[_0x54c3('0x49')][_0x54c3('0x2f')]);}_0x41b9e2['order']=qs[_0x54c3('0x4e')](_0x12dd6a['query'][_0x54c3('0x4e')]);_0x41b9e2[_0x54c3('0x4f')]=qs[_0x54c3('0x47')](_[_0x54c3('0x50')](_0x12dd6a[_0x54c3('0x49')],_0x29d1c4[_0x54c3('0x47')]),_0x477be8);if(_0x12dd6a['query'][_0x54c3('0x51')]){_0x41b9e2['where']=_[_0x54c3('0x52')](_0x41b9e2[_0x54c3('0x4f')],{'$or':_['map'](_0x477be8,function(_0x13331c){if(_0x13331c[_0x54c3('0x43')]!==_0x54c3('0x53')){var _0x37078b={};_0x37078b[_0x13331c[_0x54c3('0x3d')]]={'$like':'%'+_0x12dd6a[_0x54c3('0x49')][_0x54c3('0x51')]+'%'};return _0x37078b;}})});}_0x41b9e2=_[_0x54c3('0x52')]({},_0x41b9e2,_0x12dd6a[_0x54c3('0x54')]);var _0x183878={'where':_0x41b9e2[_0x54c3('0x4f')]};return db['ChatQueue'][_0x54c3('0x32')](_0x183878)[_0x54c3('0x37')](function(_0x5172c8){_0x2b441e[_0x54c3('0x32')]=_0x5172c8;if(_0x12dd6a[_0x54c3('0x49')]['includeAll']){_0x41b9e2['include']=[{'all':!![]}];}return db[_0x54c3('0x40')][_0x54c3('0x55')](_0x41b9e2);})[_0x54c3('0x37')](function(_0x2517b9){_0x2b441e[_0x54c3('0x56')]=_0x2517b9;return _0x2b441e;})[_0x54c3('0x37')](respondWithFilteredResult(_0x376d03,_0x41b9e2))[_0x54c3('0x2a')](handleError(_0x376d03,null));};exports[_0x54c3('0x57')]=function(_0x2f2793,_0x4e84d0){var _0x128618={'raw':!![],'where':{'id':_0x2f2793[_0x54c3('0x58')]['id']}},_0x4ffbc1={};_0x4ffbc1['model']=_['keys'](db['ChatQueue'][_0x54c3('0x41')]);_0x4ffbc1['query']=_[_0x54c3('0x59')](_0x2f2793[_0x54c3('0x49')]);_0x4ffbc1[_0x54c3('0x47')]=_[_0x54c3('0x48')](_0x4ffbc1[_0x54c3('0x45')],_0x4ffbc1[_0x54c3('0x49')]);_0x128618[_0x54c3('0x4a')]=_[_0x54c3('0x48')](_0x4ffbc1[_0x54c3('0x45')],qs['fields'](_0x2f2793[_0x54c3('0x49')][_0x54c3('0x4b')]));_0x128618[_0x54c3('0x4a')]=_0x128618[_0x54c3('0x4a')][_0x54c3('0x4c')]?_0x128618['attributes']:_0x4ffbc1[_0x54c3('0x45')];if(_0x2f2793['query']['includeAll']){_0x128618[_0x54c3('0x5a')]=[{'all':!![]}];}_0x128618=_[_0x54c3('0x52')]({},_0x128618,_0x2f2793[_0x54c3('0x54')]);return db[_0x54c3('0x40')][_0x54c3('0x5b')](_0x128618)[_0x54c3('0x37')](handleEntityNotFound(_0x4e84d0,null))[_0x54c3('0x37')](respondWithResult(_0x4e84d0,null))[_0x54c3('0x2a')](handleError(_0x4e84d0,null));};exports[_0x54c3('0x5c')]=function(_0x471505,_0x273475){return db['ChatQueue'][_0x54c3('0x5c')](_0x471505[_0x54c3('0x5d')],{})[_0x54c3('0x37')](function(_0x20459a){var _0x45e7e8=_0x471505['user'][_0x54c3('0x39')]({'plain':!![]});if(!_0x45e7e8)throw new Error(_0x54c3('0x5e'));if(_0x45e7e8['role']===_0x54c3('0x5f')){var _0x4396ed=_0x20459a[_0x54c3('0x39')]({'plain':!![]});var _0x3cb2e0=_0x54c3('0x3a');return db[_0x54c3('0x60')][_0x54c3('0x5b')]({'where':{'name':_0x3cb2e0,'userProfileId':_0x45e7e8['userProfileId']},'raw':!![]})['then'](function(_0x42e58c){if(_0x42e58c&&_0x42e58c[_0x54c3('0x61')]===0x0){return db[_0x54c3('0x3b')]['create']({'name':_0x4396ed[_0x54c3('0x3d')],'resourceId':_0x4396ed['id'],'type':_0x42e58c['name'],'sectionId':_0x42e58c['id']},{})[_0x54c3('0x37')](function(){return _0x20459a;});}else{return _0x20459a;}})[_0x54c3('0x2a')](function(_0x310818){logger['error'](_0x54c3('0x62'),_0x310818);throw _0x310818;});}return _0x20459a;})['then'](respondWithResult(_0x273475,0xc9))[_0x54c3('0x2a')](handleError(_0x273475,null));};exports['update']=function(_0x50146e,_0x32b5d3){if(_0x50146e[_0x54c3('0x5d')]['id']){delete _0x50146e['body']['id'];}return db[_0x54c3('0x40')][_0x54c3('0x5b')]({'where':{'id':_0x50146e[_0x54c3('0x58')]['id']}})[_0x54c3('0x37')](handleEntityNotFound(_0x32b5d3,null))[_0x54c3('0x37')](saveUpdates(_0x50146e['body'],null))[_0x54c3('0x37')](respondWithResult(_0x32b5d3,null))[_0x54c3('0x2a')](handleError(_0x32b5d3,null));};exports[_0x54c3('0x38')]=function(_0x357723,_0x25a40e){return db['ChatQueue'][_0x54c3('0x5b')]({'where':{'id':_0x357723[_0x54c3('0x58')]['id']}})[_0x54c3('0x37')](handleEntityNotFound(_0x25a40e,null))[_0x54c3('0x37')](removeEntity(_0x25a40e,null))['catch'](handleError(_0x25a40e,null));};exports['describe']=function(_0x62100e,_0x288bf5){return db[_0x54c3('0x40')][_0x54c3('0x63')]()[_0x54c3('0x37')](respondWithResult(_0x288bf5,null))[_0x54c3('0x2a')](handleError(_0x288bf5,null));};exports[_0x54c3('0x64')]=function(_0x330d92,_0x9f247a,_0x39b564){var _0x583ae1={'raw':!![],'where':{}},_0xcee158={},_0x57f5ff;return db['ChatQueue'][_0x54c3('0x65')]({'where':{'id':_0x330d92[_0x54c3('0x58')]['id']}})[_0x54c3('0x37')](handleEntityNotFound(_0x9f247a,null))['then'](function(_0x5cccdf){if(_0x5cccdf){_0x57f5ff=_0x5cccdf['get']({'plain':!![]});_0xcee158[_0x54c3('0x45')]=_[_0x54c3('0x59')](db[_0x54c3('0x66')][_0x54c3('0x41')]);_0xcee158[_0x54c3('0x49')]=_['keys'](_0x330d92[_0x54c3('0x49')]);_0xcee158[_0x54c3('0x47')]=_[_0x54c3('0x48')](_0xcee158[_0x54c3('0x45')],_0xcee158[_0x54c3('0x49')]);_0x583ae1[_0x54c3('0x4a')]=_[_0x54c3('0x48')](_0xcee158[_0x54c3('0x45')],qs['fields'](_0x330d92['query'][_0x54c3('0x4b')]));_0x583ae1['attributes']=_0x583ae1[_0x54c3('0x4a')][_0x54c3('0x4c')]?_0x583ae1[_0x54c3('0x4a')]:_0xcee158[_0x54c3('0x45')];if(!_0x330d92['query'][_0x54c3('0x4d')](_0x54c3('0x67'))){_0x583ae1[_0x54c3('0x31')]=qs[_0x54c3('0x31')](_0x330d92['query'][_0x54c3('0x31')]);_0x583ae1[_0x54c3('0x2f')]=qs[_0x54c3('0x2f')](_0x330d92[_0x54c3('0x49')][_0x54c3('0x2f')]);}_0x583ae1[_0x54c3('0x68')]=qs[_0x54c3('0x4e')](_0x330d92['query'][_0x54c3('0x4e')]);_0x583ae1[_0x54c3('0x4f')]=qs['filters'](_[_0x54c3('0x50')](_0x330d92[_0x54c3('0x49')],_0xcee158[_0x54c3('0x47')]));_0x583ae1[_0x54c3('0x4f')][_0x54c3('0x69')]=_0x5cccdf['id'];if(_0x330d92[_0x54c3('0x49')][_0x54c3('0x51')]){_0x583ae1['where']=_[_0x54c3('0x52')](_0x583ae1[_0x54c3('0x4f')],{'$or':_[_0x54c3('0x46')](_0x583ae1[_0x54c3('0x4a')],function(_0xc1632a){var _0x4b2fb6={};_0x4b2fb6[_0xc1632a]={'$like':'%'+_0x330d92[_0x54c3('0x49')][_0x54c3('0x51')]+'%'};return _0x4b2fb6;})});}_0x583ae1=_['merge']({},_0x583ae1,_0x330d92[_0x54c3('0x54')]);return db['UserChatQueue']['findAll'](_0x583ae1);}})[_0x54c3('0x37')](function(_0x3756ce){if(_0x3756ce){return db[_0x54c3('0x6a')][_0x54c3('0x6b')]({'where':{'id':_[_0x54c3('0x46')](_0x3756ce,'UserId'),'role':_0x54c3('0x6c')},'attributes':['id',_0x54c3('0x3d'),_0x54c3('0x6d'),_0x54c3('0x6e'),_0x54c3('0x6f')]});}})[_0x54c3('0x37')](function(_0x1a365a){if(_0x1a365a){return{'count':_0x1a365a[_0x54c3('0x32')],'rows':_['map'](_0x1a365a['rows'],function(_0xef1026){return{'membername':_0xef1026[_0x54c3('0x3d')],'UserId':_0xef1026['id'],'queue_name':_0x57f5ff[_0x54c3('0x3d')],'ChatQueueId':_0x57f5ff['id'],'interface':util[_0x54c3('0x70')]('%s/%s',_0x54c3('0x71'),_0xef1026[_0x54c3('0x3d')]),'penalty':0x0,'paused':_0xef1026['chatPause'],'createdAt':_0xef1026[_0x54c3('0x6f')],'updatedAt':_0xef1026[_0x54c3('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x9f247a,_0x583ae1))[_0x54c3('0x2a')](handleError(_0x9f247a,null));};exports[_0x54c3('0x72')]=function(_0x58c9e8,_0x2b837a,_0x312f18){var _0x3bc8e3={};var _0x583e63={};var _0x118aa0;var _0x7f8a5c;return db[_0x54c3('0x40')]['findOne']({'where':{'id':_0x58c9e8[_0x54c3('0x58')]['id']}})[_0x54c3('0x37')](handleEntityNotFound(_0x2b837a,null))['then'](function(_0x4f00cc){if(_0x4f00cc){_0x118aa0=_0x4f00cc;_0x583e63[_0x54c3('0x45')]=_[_0x54c3('0x59')](db['Team']['rawAttributes']);_0x583e63['query']=_[_0x54c3('0x59')](_0x58c9e8[_0x54c3('0x49')]);_0x583e63[_0x54c3('0x47')]=_['intersection'](_0x583e63[_0x54c3('0x45')],_0x583e63[_0x54c3('0x49')]);_0x3bc8e3[_0x54c3('0x4a')]=_[_0x54c3('0x48')](_0x583e63[_0x54c3('0x45')],qs['fields'](_0x58c9e8[_0x54c3('0x49')]['fields']));_0x3bc8e3[_0x54c3('0x4a')]=_0x3bc8e3['attributes']['length']?_0x3bc8e3['attributes']:_0x583e63[_0x54c3('0x45')];_0x3bc8e3[_0x54c3('0x68')]=qs[_0x54c3('0x4e')](_0x58c9e8[_0x54c3('0x49')][_0x54c3('0x4e')]);_0x3bc8e3[_0x54c3('0x4f')]=qs[_0x54c3('0x47')](_['pick'](_0x58c9e8[_0x54c3('0x49')],_0x583e63[_0x54c3('0x47')]));if(_0x58c9e8[_0x54c3('0x49')][_0x54c3('0x51')]){_0x3bc8e3[_0x54c3('0x4f')]=_[_0x54c3('0x52')](_0x3bc8e3[_0x54c3('0x4f')],{'$or':_[_0x54c3('0x46')](_0x3bc8e3['attributes'],function(_0x5bb20e){var _0x734cb7={};_0x734cb7[_0x5bb20e]={'$like':'%'+_0x58c9e8[_0x54c3('0x49')][_0x54c3('0x51')]+'%'};return _0x734cb7;})});}_0x3bc8e3=_['merge']({},_0x3bc8e3,_0x58c9e8[_0x54c3('0x54')]);return _0x118aa0[_0x54c3('0x72')](_0x3bc8e3);}})[_0x54c3('0x37')](function(_0xf75424){if(_0xf75424){_0x7f8a5c=_0xf75424[_0x54c3('0x4c')];if(!_0x58c9e8[_0x54c3('0x49')][_0x54c3('0x4d')](_0x54c3('0x67'))){_0x3bc8e3[_0x54c3('0x31')]=qs[_0x54c3('0x31')](_0x58c9e8[_0x54c3('0x49')][_0x54c3('0x31')]);_0x3bc8e3[_0x54c3('0x2f')]=qs[_0x54c3('0x2f')](_0x58c9e8['query'][_0x54c3('0x2f')]);}return _0x118aa0['getTeams'](_0x3bc8e3);}})[_0x54c3('0x37')](function(_0x4785b6){if(_0x4785b6){return _0x4785b6?{'count':_0x7f8a5c,'rows':_0x4785b6}:null;}})['then'](respondWithResult(_0x2b837a,null))[_0x54c3('0x2a')](handleError(_0x2b837a,null));};exports[_0x54c3('0x73')]=function(_0x54e2c9,_0x39b8cb,_0x38e22c){var _0x57ae8c=_0x54e2c9[_0x54c3('0x5d')][_0x54c3('0x74')];return db['Team']['findAll']({'where':{'id':_0x57ae8c},'attributes':['id'],'include':[{'model':db[_0x54c3('0x6a')],'as':'Agents','attributes':['id',_0x54c3('0x3d'),'online',_0x54c3('0x75'),'interface'],'raw':!![]}]})['then'](function(_0xf241b2){if(_0xf241b2){var _0x4df675=_['flatMap'](_0xf241b2,function(_0x637366){var _0x4a3670=_0x637366['get']({'plain':!![]});return _0x4a3670[_0x54c3('0x76')];});return db['ChatQueue'][_0x54c3('0x5b')]({'where':{'id':_0x54e2c9['params']['id']}})[_0x54c3('0x37')](function(_0x1ad25c){return db['sequelize'][_0x54c3('0x77')](function(_0x5d4dee){return _0x1ad25c[_0x54c3('0x73')](_0x57ae8c,{'transaction':_0x5d4dee})[_0x54c3('0x37')](function(){return BPromise[_0x54c3('0x78')](_0x4df675,function(_0x2015bd){return db[_0x54c3('0x66')][_0x54c3('0x79')]({'where':{'UserId':_0x2015bd['id'],'ChatQueueId':_0x54e2c9[_0x54c3('0x58')]['id']},'transaction':_0x5d4dee});});})['then'](function(){_0x4df675[_0x54c3('0x7a')](function(_0x559448){socket[_0x54c3('0x7b')](_0x54c3('0x7c'),{'UserId':_0x559448['id'],'ChatQueueId':_0x1ad25c['id']});});});});});}})['then'](respondWithStatusCode(_0x39b8cb,null))['catch'](handleError(_0x39b8cb,null));};exports[_0x54c3('0x7d')]=function(_0x18f309,_0x51d8dd,_0x246ed7){return db[_0x54c3('0x7e')][_0x54c3('0x55')]({'where':{'id':_0x18f309['query'][_0x54c3('0x74')]},'attributes':['id'],'include':[{'model':db[_0x54c3('0x6a')],'as':_0x54c3('0x76'),'attributes':['id'],'raw':!![]}]})[_0x54c3('0x37')](handleEntityNotFound(_0x51d8dd,null))[_0x54c3('0x37')](function(_0x2e795f){var _0x196bef=_['map'](_0x2e795f,'id');var _0x565f18=[];var _0x562cc0=[];var _0x2de9d6=squel[_0x54c3('0x7f')]();_0x2de9d6[_0x54c3('0x80')](_0x54c3('0x81'))[_0x54c3('0x82')]('team_has_chat_queues','tq')['join'](_0x54c3('0x83'),'ut',_0x54c3('0x84'))[_0x54c3('0x4f')](_0x54c3('0x85'),_0x18f309['params']['id']);for(var _0x52c6ec=0x0;_0x52c6ec<_0x2e795f[_0x54c3('0x4c')];_0x52c6ec+=0x1){let _0xf741=_0x2e795f[_0x52c6ec];for(var _0x1360ea=0x0;_0x1360ea<_0xf741['Agents'][_0x54c3('0x4c')];_0x1360ea+=0x1){let _0x3281a2=_0xf741[_0x54c3('0x76')][_0x1360ea];var _0x24460e=_0x2de9d6[_0x54c3('0x86')]();_0x24460e['where'](_0x54c3('0x87'),_0x3281a2['id']);_0x562cc0['push'](db['sequelize']['query'](_0x24460e[_0x54c3('0x88')](),{'type':db['sequelize'][_0x54c3('0x89')]['SELECT']})[_0x54c3('0x37')](function(_0x4df5fd){if(_0x4df5fd['length']===0x1){return _0x3281a2['id'];}else{var _0x28eee9=_['every'](_[_0x54c3('0x46')](_0x4df5fd,_0x54c3('0x8a')),function(_0x4d231c){return _['includes'](_0x196bef,_0x4d231c);});if(_0x28eee9){return _0x3281a2['id'];}}}));}}return BPromise[_0x54c3('0x8b')](_0x562cc0)[_0x54c3('0x37')](function(_0x3b2a3b){_0x565f18=_(_0x565f18)[_0x54c3('0x8c')](_0x3b2a3b)[_0x54c3('0x8d')]()[_0x54c3('0x8e')]();return db[_0x54c3('0x40')][_0x54c3('0x5b')]({'where':{'id':_0x18f309[_0x54c3('0x58')]['id']}})[_0x54c3('0x37')](function(_0xd0858a){return db[_0x54c3('0x8f')][_0x54c3('0x77')](function(_0x1e8149){return _0xd0858a[_0x54c3('0x7d')](_0x18f309['query'][_0x54c3('0x74')],{'transaction':_0x1e8149})[_0x54c3('0x37')](function(){if(!_[_0x54c3('0x90')](_0x565f18)){return _0xd0858a[_0x54c3('0x91')](_0x565f18,{'transaction':_0x1e8149});}})[_0x54c3('0x37')](function(){_0x565f18[_0x54c3('0x7a')](function(_0x64c5dc){socket[_0x54c3('0x7b')](_0x54c3('0x92'),{'UserId':_0x64c5dc,'ChatQueueId':_0xd0858a['id']});});});});});});})[_0x54c3('0x37')](respondWithStatusCode(_0x51d8dd,null))[_0x54c3('0x2a')](handleError(_0x51d8dd,null));};exports[_0x54c3('0x93')]=function(_0x569bda,_0x21a0ad,_0x5aec34){return db[_0x54c3('0x40')][_0x54c3('0x5b')]({'where':{'id':_0x569bda[_0x54c3('0x58')]['id']}})['then'](handleEntityNotFound(_0x21a0ad,null))[_0x54c3('0x37')](function(_0x514949){if(_0x514949){return _0x514949[_0x54c3('0x93')](_0x569bda[_0x54c3('0x5d')][_0x54c3('0x74')],_[_0x54c3('0x94')](_0x569bda[_0x54c3('0x5d')],['ids','id'])||{})[_0x54c3('0x95')](function(_0x290987){for(var _0x301548=0x0;_0x301548<_0x569bda[_0x54c3('0x5d')][_0x54c3('0x74')][_0x54c3('0x4c')];_0x301548+=0x1){socket[_0x54c3('0x7b')](_0x54c3('0x7c'),{'UserId':Number(_0x569bda[_0x54c3('0x5d')]['ids'][_0x301548]),'ChatQueueId':Number(_0x569bda['params']['id'])});}return _0x290987;});}})[_0x54c3('0x37')](respondWithResult(_0x21a0ad,null))[_0x54c3('0x2a')](handleError(_0x21a0ad,null));};exports['removeAgents']=function(_0x34d33c,_0x18296a,_0x21149f){return db[_0x54c3('0x40')][_0x54c3('0x5b')]({'where':{'id':_0x34d33c[_0x54c3('0x58')]['id']}})['then'](handleEntityNotFound(_0x18296a,null))[_0x54c3('0x37')](function(_0x29f9fe){if(_0x29f9fe){return _0x29f9fe['removeAgents'](_0x34d33c[_0x54c3('0x49')][_0x54c3('0x74')])[_0x54c3('0x37')](function(){if(_['isArray'](_0x34d33c[_0x54c3('0x49')]['ids'])){for(var _0x54690c=0x0;_0x54690c<_0x34d33c[_0x54c3('0x49')][_0x54c3('0x74')][_0x54c3('0x4c')];_0x54690c+=0x1){socket['emit'](_0x54c3('0x92'),{'UserId':Number(_0x34d33c[_0x54c3('0x49')][_0x54c3('0x74')][_0x54690c]),'ChatQueueId':Number(_0x34d33c[_0x54c3('0x58')]['id'])});}}else{socket[_0x54c3('0x7b')]('userChatQueue:remove',{'UserId':Number(_0x34d33c[_0x54c3('0x49')]['ids']),'ChatQueueId':Number(_0x34d33c['params']['id'])});}});}})[_0x54c3('0x37')](respondWithStatusCode(_0x18296a,null))[_0x54c3('0x2a')](handleError(_0x18296a,null));};exports[_0x54c3('0x96')]=function(_0x1e26a6,_0xabd60d,_0x5a86cf){var _0xeadb86={};var _0x5e1564={};var _0x597daf;var _0x4c0c60;return db[_0x54c3('0x40')][_0x54c3('0x65')]({'where':{'id':_0x1e26a6[_0x54c3('0x58')]['id']}})[_0x54c3('0x37')](handleEntityNotFound(_0xabd60d,null))[_0x54c3('0x37')](function(_0xfd694){if(_0xfd694){_0x597daf=_0xfd694;_0x5e1564[_0x54c3('0x45')]=_['keys'](db[_0x54c3('0x6a')][_0x54c3('0x41')]);_0x5e1564['query']=_[_0x54c3('0x59')](_0x1e26a6[_0x54c3('0x49')]);_0x5e1564[_0x54c3('0x47')]=_[_0x54c3('0x48')](_0x5e1564[_0x54c3('0x45')],_0x5e1564['query']);_0xeadb86['attributes']=_[_0x54c3('0x48')](_0x5e1564[_0x54c3('0x45')],qs[_0x54c3('0x4b')](_0x1e26a6['query'][_0x54c3('0x4b')]));_0xeadb86[_0x54c3('0x4a')]=_0xeadb86[_0x54c3('0x4a')]['length']?_0xeadb86[_0x54c3('0x4a')]:_0x5e1564[_0x54c3('0x45')];_0xeadb86[_0x54c3('0x68')]=qs[_0x54c3('0x4e')](_0x1e26a6[_0x54c3('0x49')][_0x54c3('0x4e')]);_0xeadb86[_0x54c3('0x4f')]=qs[_0x54c3('0x47')](_[_0x54c3('0x50')](_0x1e26a6[_0x54c3('0x49')],_0x5e1564['filters']));if(_0x1e26a6[_0x54c3('0x49')][_0x54c3('0x51')]){_0xeadb86['where']=_[_0x54c3('0x52')](_0xeadb86['where'],{'$or':_[_0x54c3('0x46')](_0xeadb86[_0x54c3('0x4a')],function(_0x256354){var _0x5231c3={};_0x5231c3[_0x256354]={'$like':'%'+_0x1e26a6[_0x54c3('0x49')][_0x54c3('0x51')]+'%'};return _0x5231c3;})});}_0xeadb86=_[_0x54c3('0x52')]({},_0xeadb86,_0x1e26a6[_0x54c3('0x54')]);return _0x597daf[_0x54c3('0x96')](_0xeadb86);}})[_0x54c3('0x37')](function(_0x4e8422){if(_0x4e8422){_0x4c0c60=_0x4e8422[_0x54c3('0x4c')];if(!_0x1e26a6[_0x54c3('0x49')][_0x54c3('0x4d')](_0x54c3('0x67'))){_0xeadb86[_0x54c3('0x31')]=qs[_0x54c3('0x31')](_0x1e26a6['query'][_0x54c3('0x31')]);_0xeadb86['offset']=qs[_0x54c3('0x2f')](_0x1e26a6[_0x54c3('0x49')]['offset']);}return _0x597daf[_0x54c3('0x96')](_0xeadb86);}})[_0x54c3('0x37')](function(_0x3ab4c2){if(_0x3ab4c2){return _0x3ab4c2?{'count':_0x4c0c60,'rows':_0x3ab4c2}:null;}})[_0x54c3('0x37')](respondWithResult(_0xabd60d,null))['catch'](handleError(_0xabd60d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 2c48a6f..8c19dda 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 _0x67e4=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','emit'];(function(_0x3b7847,_0xfefc56){var _0x2060ce=function(_0x25c37e){while(--_0x25c37e){_0x3b7847['push'](_0x3b7847['shift']());}};_0x2060ce(++_0xfefc56);}(_0x67e4,0x161));var _0x467e=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x67e4[_0x28e2cd];return _0x11fd46;};'use strict';var EventEmitter=require(_0x467e('0x0'));var ChatQueue=require(_0x467e('0x1'))['db'][_0x467e('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x467e('0x3')](0x0);var events={'afterCreate':_0x467e('0x4'),'afterUpdate':_0x467e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5d616b){return function(_0x4f7c4b,_0x391d73,_0x5c7a38){ChatQueueEvents[_0x467e('0x6')](_0x5d616b+':'+_0x4f7c4b['id'],_0x4f7c4b);ChatQueueEvents[_0x467e('0x6')](_0x5d616b,_0x4f7c4b);_0x5c7a38(null);};}for(var e in events){if(events[_0x467e('0x7')](e)){var event=events[e];ChatQueue[_0x467e('0x8')](e,emitEvent(event));}}module[_0x467e('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x7d70=['save','remove','emit','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x45bbe9,_0x5e1882){var _0x38d715=function(_0x32e2be){while(--_0x32e2be){_0x45bbe9['push'](_0x45bbe9['shift']());}};_0x38d715(++_0x5e1882);}(_0x7d70,0x12e));var _0x07d7=function(_0x27de9e,_0x43861a){_0x27de9e=_0x27de9e-0x0;var _0x53be65=_0x7d70[_0x27de9e];return _0x53be65;};'use strict';var EventEmitter=require(_0x07d7('0x0'));var ChatQueue=require(_0x07d7('0x1'))['db'][_0x07d7('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x07d7('0x3')](0x0);var events={'afterCreate':_0x07d7('0x4'),'afterUpdate':'update','afterDestroy':_0x07d7('0x5')};function emitEvent(_0x1a1312){return function(_0x26f91c,_0x5ae830,_0x44e7ce){ChatQueueEvents[_0x07d7('0x6')](_0x1a1312+':'+_0x26f91c['id'],_0x26f91c);ChatQueueEvents[_0x07d7('0x6')](_0x1a1312,_0x26f91c);_0x44e7ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x07d7('0x7')](e,emitEvent(event));}}module[_0x07d7('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index b67647d..0899439 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 _0xbd81=['../../config/environment','./chatQueue.attributes','exports','define','chat_queues','util','api','moment','bluebird','request-promise'];(function(_0x327ae5,_0x4268e0){var _0x402ec4=function(_0x39de4b){while(--_0x39de4b){_0x327ae5['push'](_0x327ae5['shift']());}};_0x402ec4(++_0x4268e0);}(_0xbd81,0xf5));var _0x1bd8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xbd81[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0x1bd8('0x0'));var logger=require('../../config/logger')(_0x1bd8('0x1'));var moment=require(_0x1bd8('0x2'));var BPromise=require(_0x1bd8('0x3'));var rp=require(_0x1bd8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1bd8('0x5'));var attributes=require(_0x1bd8('0x6'));module[_0x1bd8('0x7')]=function(_0x47ceb3,_0x2fe613){return _0x47ceb3[_0x1bd8('0x8')]('ChatQueue',attributes,{'tableName':_0x1bd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x558f=['util','../../config/logger','api','moment','request-promise','path','rimraf','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash'];(function(_0x1eb8ab,_0x17d3d0){var _0x353c9b=function(_0x3b69b0){while(--_0x3b69b0){_0x1eb8ab['push'](_0x1eb8ab['shift']());}};_0x353c9b(++_0x17d3d0);}(_0x558f,0xcb));var _0xf558=function(_0x4fdc01,_0x4101ea){_0x4fdc01=_0x4fdc01-0x0;var _0x5bb876=_0x558f[_0x4fdc01];return _0x5bb876;};'use strict';var _=require(_0xf558('0x0'));var util=require(_0xf558('0x1'));var logger=require(_0xf558('0x2'))(_0xf558('0x3'));var moment=require(_0xf558('0x4'));var BPromise=require('bluebird');var rp=require(_0xf558('0x5'));var fs=require('fs');var path=require(_0xf558('0x6'));var rimraf=require(_0xf558('0x7'));var config=require('../../config/environment');var attributes=require(_0xf558('0x8'));module[_0xf558('0x9')]=function(_0x5c294b,_0x5771a3){return _0x5c294b['define'](_0xf558('0xa'),attributes,{'tableName':_0xf558('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 78f4ffc..f4f8800 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 _0x8383=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','options','where','attributes','include','map','model','GetChatQueue','raw','ShowChatQueue','lodash','bluebird','randomstring','ioredis'];(function(_0x2d1022,_0x292ba7){var _0x35dc62=function(_0x3ef12a){while(--_0x3ef12a){_0x2d1022['push'](_0x2d1022['shift']());}};_0x35dc62(++_0x292ba7);}(_0x8383,0x98));var _0x3838=function(_0x3f5a54,_0x121e75){_0x3f5a54=_0x3f5a54-0x0;var _0x331ec9=_0x8383[_0x3f5a54];return _0x331ec9;};'use strict';var _=require(_0x3838('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3838('0x1'));var rs=require(_0x3838('0x2'));var fs=require('fs');var Redis=require(_0x3838('0x3'));var db=require(_0x3838('0x4'))['db'];var utils=require(_0x3838('0x5'));var logger=require(_0x3838('0x6'))(_0x3838('0x7'));var config=require(_0x3838('0x8'));var jayson=require(_0x3838('0x9'));var client=jayson[_0x3838('0xa')]['http']({'port':0x232a});config[_0x3838('0xb')]=_[_0x3838('0xc')](config['redis'],{'host':_0x3838('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3838('0xb')]));require(_0x3838('0xe'))[_0x3838('0xf')](socket);function respondWithRpcPromise(_0x550a5c,_0x2af70d,_0xeccb09){return new BPromise(function(_0x15c28a,_0x545100){return client[_0x3838('0x10')](_0x550a5c,_0xeccb09)[_0x3838('0x11')](function(_0x9161a2){logger[_0x3838('0x12')]('ChatQueue,\x20%s,\x20%s',_0x2af70d,_0x3838('0x13'));logger[_0x3838('0x14')](_0x3838('0x15'),_0x2af70d,'request\x20sent',JSON[_0x3838('0x16')](_0x9161a2));if(_0x9161a2['error']){if(_0x9161a2[_0x3838('0x17')][_0x3838('0x18')]===0x1f4){logger[_0x3838('0x17')](_0x3838('0x19'),_0x2af70d,_0x9161a2[_0x3838('0x17')]['message']);return _0x545100(_0x9161a2[_0x3838('0x17')][_0x3838('0x1a')]);}logger[_0x3838('0x17')](_0x3838('0x19'),_0x2af70d,_0x9161a2[_0x3838('0x17')]['message']);return _0x15c28a(_0x9161a2[_0x3838('0x17')][_0x3838('0x1a')]);}else{logger[_0x3838('0x12')]('ChatQueue,\x20%s,\x20%s',_0x2af70d,_0x3838('0x13'));_0x15c28a(_0x9161a2[_0x3838('0x1b')]['message']);}})[_0x3838('0x1c')](function(_0x2fe3c8){logger['error'](_0x3838('0x19'),_0x2af70d,_0x2fe3c8);_0x545100(_0x2fe3c8);});});}exports['GetChatQueue']=function(_0x26580){var _0x37f607=this;return new Promise(function(_0x1ae6c9,_0x2f9965){return db[_0x3838('0x1d')]['findAll']({'raw':_0x26580['options']?_0x26580[_0x3838('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x26580[_0x3838('0x1e')]?_0x26580[_0x3838('0x1e')][_0x3838('0x1f')]||null:null,'attributes':_0x26580[_0x3838('0x1e')]?_0x26580[_0x3838('0x1e')][_0x3838('0x20')]||null:null,'limit':_0x26580[_0x3838('0x1e')]?_0x26580[_0x3838('0x1e')]['limit']||null:null,'include':_0x26580[_0x3838('0x1e')]?_0x26580['options'][_0x3838('0x21')]?_[_0x3838('0x22')](_0x26580['options'][_0x3838('0x21')],function(_0x265099){return{'model':db[_0x265099['model']],'as':_0x265099['as'],'attributes':_0x265099[_0x3838('0x20')],'include':_0x265099[_0x3838('0x21')]?_['map'](_0x265099[_0x3838('0x21')],function(_0x4c1efb){return{'model':db[_0x4c1efb[_0x3838('0x23')]],'as':_0x4c1efb['as'],'attributes':_0x4c1efb['attributes'],'include':_0x4c1efb['include']?_[_0x3838('0x22')](_0x4c1efb[_0x3838('0x21')],function(_0x41bb45){return{'model':db[_0x41bb45[_0x3838('0x23')]],'as':_0x41bb45['as'],'attributes':_0x41bb45[_0x3838('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1baf56){logger[_0x3838('0x12')](_0x3838('0x24'),_0x26580);logger['debug'](_0x3838('0x24'),_0x26580,JSON['stringify'](_0x1baf56));_0x1ae6c9(_0x1baf56);})[_0x3838('0x1c')](function(_0x4b1a0c){logger[_0x3838('0x17')](_0x3838('0x24'),_0x4b1a0c['message'],_0x26580);_0x2f9965(_0x37f607[_0x3838('0x17')](0x1f4,_0x4b1a0c['message']));});});};exports['ShowChatQueue']=function(_0x19ec76){var _0x25b81c=this;return new Promise(function(_0x5c74ac,_0x5b594d){return db[_0x3838('0x1d')]['find']({'raw':_0x19ec76[_0x3838('0x1e')]?_0x19ec76[_0x3838('0x1e')][_0x3838('0x25')]===undefined?!![]:![]:!![],'where':_0x19ec76[_0x3838('0x1e')]?_0x19ec76[_0x3838('0x1e')][_0x3838('0x1f')]||null:null,'attributes':_0x19ec76['options']?_0x19ec76[_0x3838('0x1e')][_0x3838('0x20')]||null:null,'include':_0x19ec76[_0x3838('0x1e')]?_0x19ec76[_0x3838('0x1e')][_0x3838('0x21')]?_[_0x3838('0x22')](_0x19ec76[_0x3838('0x1e')][_0x3838('0x21')],function(_0x368298){return{'model':db[_0x368298[_0x3838('0x23')]],'as':_0x368298['as'],'attributes':_0x368298[_0x3838('0x20')],'include':_0x368298['include']?_[_0x3838('0x22')](_0x368298[_0x3838('0x21')],function(_0x3518c9){return{'model':db[_0x3518c9[_0x3838('0x23')]],'as':_0x3518c9['as'],'attributes':_0x3518c9['attributes'],'include':_0x3518c9[_0x3838('0x21')]?_[_0x3838('0x22')](_0x3518c9[_0x3838('0x21')],function(_0x1f4331){return{'model':db[_0x1f4331['model']],'as':_0x1f4331['as'],'attributes':_0x1f4331[_0x3838('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3838('0x11')](function(_0x1c752e){logger[_0x3838('0x12')]('ShowChatQueue',_0x19ec76);logger[_0x3838('0x14')](_0x3838('0x26'),_0x19ec76,JSON[_0x3838('0x16')](_0x1c752e));_0x5c74ac(_0x1c752e);})['catch'](function(_0x5b3383){logger[_0x3838('0x17')](_0x3838('0x26'),_0x5b3383[_0x3838('0x1a')],_0x19ec76);_0x5b594d(_0x25b81c[_0x3838('0x17')](0x1f4,_0x5b3383[_0x3838('0x1a')]));});});}; \ No newline at end of file +var _0x13cc=['options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','debug','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','findAll'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0x13cc,0x161));var _0xc13c=function(_0x296c1a,_0xa87d73){_0x296c1a=_0x296c1a-0x0;var _0x273bf6=_0x13cc[_0x296c1a];return _0x273bf6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc13c('0x0'));var BPromise=require(_0xc13c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc13c('0x2'));var db=require(_0xc13c('0x3'))['db'];var utils=require(_0xc13c('0x4'));var logger=require(_0xc13c('0x5'))(_0xc13c('0x6'));var config=require(_0xc13c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc13c('0x8')]['http']({'port':0x232a});config[_0xc13c('0x9')]=_[_0xc13c('0xa')](config[_0xc13c('0x9')],{'host':_0xc13c('0xb'),'port':0x18eb});var socket=require(_0xc13c('0xc'))(new Redis(config[_0xc13c('0x9')]));require(_0xc13c('0xd'))['register'](socket);function respondWithRpcPromise(_0x494d38,_0x514064,_0x294739){return new BPromise(function(_0x201daf,_0x3a895e){return client[_0xc13c('0xe')](_0x494d38,_0x294739)[_0xc13c('0xf')](function(_0x4d16f7){logger[_0xc13c('0x10')]('ChatQueue,\x20%s,\x20%s',_0x514064,_0xc13c('0x11'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x514064,_0xc13c('0x11'),JSON[_0xc13c('0x12')](_0x4d16f7));if(_0x4d16f7[_0xc13c('0x13')]){if(_0x4d16f7[_0xc13c('0x13')][_0xc13c('0x14')]===0x1f4){logger[_0xc13c('0x13')](_0xc13c('0x15'),_0x514064,_0x4d16f7[_0xc13c('0x13')][_0xc13c('0x16')]);return _0x3a895e(_0x4d16f7[_0xc13c('0x13')]['message']);}logger[_0xc13c('0x13')](_0xc13c('0x15'),_0x514064,_0x4d16f7[_0xc13c('0x13')]['message']);return _0x201daf(_0x4d16f7[_0xc13c('0x13')][_0xc13c('0x16')]);}else{logger[_0xc13c('0x10')](_0xc13c('0x15'),_0x514064,_0xc13c('0x11'));_0x201daf(_0x4d16f7[_0xc13c('0x17')][_0xc13c('0x16')]);}})[_0xc13c('0x18')](function(_0x535808){logger[_0xc13c('0x13')](_0xc13c('0x15'),_0x514064,_0x535808);_0x3a895e(_0x535808);});});}exports[_0xc13c('0x19')]=function(_0x59f32c){var _0x455bda=this;return new Promise(function(_0xe1deaf,_0x52bc34){return db['ChatQueue'][_0xc13c('0x1a')]({'raw':_0x59f32c[_0xc13c('0x1b')]?_0x59f32c['options'][_0xc13c('0x1c')]===undefined?!![]:![]:!![],'where':_0x59f32c[_0xc13c('0x1b')]?_0x59f32c[_0xc13c('0x1b')][_0xc13c('0x1d')]||null:null,'attributes':_0x59f32c['options']?_0x59f32c['options'][_0xc13c('0x1e')]||null:null,'limit':_0x59f32c[_0xc13c('0x1b')]?_0x59f32c[_0xc13c('0x1b')][_0xc13c('0x1f')]||null:null,'include':_0x59f32c[_0xc13c('0x1b')]?_0x59f32c[_0xc13c('0x1b')][_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x59f32c[_0xc13c('0x1b')]['include'],function(_0x4abf16){return{'model':db[_0x4abf16[_0xc13c('0x22')]],'as':_0x4abf16['as'],'attributes':_0x4abf16[_0xc13c('0x1e')],'include':_0x4abf16[_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x4abf16[_0xc13c('0x20')],function(_0x2a1b98){return{'model':db[_0x2a1b98[_0xc13c('0x22')]],'as':_0x2a1b98['as'],'attributes':_0x2a1b98[_0xc13c('0x1e')],'include':_0x2a1b98[_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x2a1b98[_0xc13c('0x20')],function(_0x1b005a){return{'model':db[_0x1b005a['model']],'as':_0x1b005a['as'],'attributes':_0x1b005a[_0xc13c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc13c('0xf')](function(_0x1997f3){logger[_0xc13c('0x10')](_0xc13c('0x19'),_0x59f32c);logger['debug'](_0xc13c('0x19'),_0x59f32c,JSON[_0xc13c('0x12')](_0x1997f3));_0xe1deaf(_0x1997f3);})[_0xc13c('0x18')](function(_0x5b0c18){logger[_0xc13c('0x13')]('GetChatQueue',_0x5b0c18['message'],_0x59f32c);_0x52bc34(_0x455bda[_0xc13c('0x13')](0x1f4,_0x5b0c18[_0xc13c('0x16')]));});});};exports[_0xc13c('0x23')]=function(_0x153f04){var _0x544448=this;return new Promise(function(_0x1a44c4,_0x3958ec){return db['ChatQueue'][_0xc13c('0x24')]({'raw':_0x153f04[_0xc13c('0x1b')]?_0x153f04[_0xc13c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x153f04[_0xc13c('0x1b')]?_0x153f04[_0xc13c('0x1b')][_0xc13c('0x1d')]||null:null,'attributes':_0x153f04['options']?_0x153f04[_0xc13c('0x1b')][_0xc13c('0x1e')]||null:null,'include':_0x153f04['options']?_0x153f04[_0xc13c('0x1b')][_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x153f04[_0xc13c('0x1b')][_0xc13c('0x20')],function(_0x3552b1){return{'model':db[_0x3552b1[_0xc13c('0x22')]],'as':_0x3552b1['as'],'attributes':_0x3552b1[_0xc13c('0x1e')],'include':_0x3552b1[_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x3552b1[_0xc13c('0x20')],function(_0x54a9ed){return{'model':db[_0x54a9ed[_0xc13c('0x22')]],'as':_0x54a9ed['as'],'attributes':_0x54a9ed[_0xc13c('0x1e')],'include':_0x54a9ed[_0xc13c('0x20')]?_[_0xc13c('0x21')](_0x54a9ed['include'],function(_0x11f9b9){return{'model':db[_0x11f9b9[_0xc13c('0x22')]],'as':_0x11f9b9['as'],'attributes':_0x11f9b9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bb516){logger['info'](_0xc13c('0x23'),_0x153f04);logger[_0xc13c('0x25')]('ShowChatQueue',_0x153f04,JSON[_0xc13c('0x12')](_0x4bb516));_0x1a44c4(_0x4bb516);})[_0xc13c('0x18')](function(_0xf35739){logger[_0xc13c('0x13')]('ShowChatQueue',_0xf35739['message'],_0x153f04);_0x3958ec(_0x544448[_0xc13c('0x13')](0x1f4,_0xf35739['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index e187c1d..b39e2d0 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 _0x8ce3=['emit','removeListener','length','./chatQueue.events','save','update'];(function(_0x1a09c1,_0x3704ec){var _0x209647=function(_0x850dbb){while(--_0x850dbb){_0x1a09c1['push'](_0x1a09c1['shift']());}};_0x209647(++_0x3704ec);}(_0x8ce3,0xc3));var _0x38ce=function(_0x893787,_0x2ecfe4){_0x893787=_0x893787-0x0;var _0x4d2cb0=_0x8ce3[_0x893787];return _0x4d2cb0;};'use strict';var ChatQueueEvents=require(_0x38ce('0x0'));var events=[_0x38ce('0x1'),'remove',_0x38ce('0x2')];function createListener(_0x2b99b0,_0xee1d0e){return function(_0x26ec48){_0xee1d0e[_0x38ce('0x3')](_0x2b99b0,_0x26ec48);};}function removeListener(_0x17b96d,_0x1efae3){return function(){ChatQueueEvents[_0x38ce('0x4')](_0x17b96d,_0x1efae3);};}exports['register']=function(_0x372f86){for(var _0xb24f4c=0x0,_0x58074c=events[_0x38ce('0x5')];_0xb24f4c<_0x58074c;_0xb24f4c++){var _0xbe7332=events[_0xb24f4c];var _0x3f8011=createListener('chatQueue:'+_0xbe7332,_0x372f86);ChatQueueEvents['on'](_0xbe7332,_0x3f8011);}}; \ No newline at end of file +var _0x9b67=['register','length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x34f19f,_0x41209e){var _0x304ec8=function(_0x4fb45e){while(--_0x4fb45e){_0x34f19f['push'](_0x34f19f['shift']());}};_0x304ec8(++_0x41209e);}(_0x9b67,0xf6));var _0x79b6=function(_0x7f69d7,_0x1b57f1){_0x7f69d7=_0x7f69d7-0x0;var _0x5c8667=_0x9b67[_0x7f69d7];return _0x5c8667;};'use strict';var ChatQueueEvents=require(_0x79b6('0x0'));var events=[_0x79b6('0x1'),_0x79b6('0x2'),_0x79b6('0x3')];function createListener(_0x29728d,_0x5523a1){return function(_0x3ba25a){_0x5523a1[_0x79b6('0x4')](_0x29728d,_0x3ba25a);};}function removeListener(_0x5297d0,_0x4e8794){return function(){ChatQueueEvents[_0x79b6('0x5')](_0x5297d0,_0x4e8794);};}exports[_0x79b6('0x6')]=function(_0x258103){for(var _0xec367e=0x0,_0xfa6a05=events[_0x79b6('0x7')];_0xec367e<_0xfa6a05;_0xec367e++){var _0x34adbe=events[_0xec367e];var _0x58ae2d=createListener(_0x79b6('0x8')+_0x34adbe,_0x258103);ChatQueueEvents['on'](_0x34adbe,_0x58ae2d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 54b4244..211484c 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x5fc3[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1f9c4b,_0x3cad26){var _0xf2c727=function(_0x6bd900){while(--_0x6bd900){_0x1f9c4b['push'](_0x1f9c4b['shift']());}};_0xf2c727(++_0x3cad26);}(_0x7217,0x19e));var _0x7721=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7217[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 731947b..4e93913 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 _0xd043=['exports','STRING','DATE','moment','sequelize'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xd043,0x143));var _0x3d04=function(_0x32b248,_0x4e4850){_0x32b248=_0x32b248-0x0;var _0x1634c4=_0xd043[_0x32b248];return _0x1634c4;};'use strict';var moment=require(_0x3d04('0x0'));var Sequelize=require(_0x3d04('0x1'));module[_0x3d04('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3d04('0x3')]},'joinAt':{'type':Sequelize[_0x3d04('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3d04('0x4')]},'exitAt':{'type':Sequelize[_0x3d04('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca60=['exports','STRING','DATE','moment'];(function(_0x31fcfc,_0x1a1cfc){var _0x535b8d=function(_0x557443){while(--_0x557443){_0x31fcfc['push'](_0x31fcfc['shift']());}};_0x535b8d(++_0x1a1cfc);}(_0xca60,0xef));var _0x0ca6=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0xca60[_0x3a7db0];return _0x17cbba;};'use strict';var moment=require(_0x0ca6('0x0'));var Sequelize=require('sequelize');module[_0x0ca6('0x1')]={'uniqueid':{'type':Sequelize[_0x0ca6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0ca6('0x2')]},'joinAt':{'type':Sequelize[_0x0ca6('0x3')]},'leaveAt':{'type':Sequelize[_0x0ca6('0x3')]},'acceptAt':{'type':Sequelize[_0x0ca6('0x3')]},'exitAt':{'type':Sequelize[_0x0ca6('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index fb537f2..11ea10a 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 _0x39e6=['params','keys','find','create','update','body','destroy','describe','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','then','sendStatus','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','catch','show'];(function(_0x248020,_0x225812){var _0x4a25c4=function(_0x31a7a7){while(--_0x31a7a7){_0x248020['push'](_0x248020['shift']());}};_0x4a25c4(++_0x225812);}(_0x39e6,0x9e));var _0x639e=function(_0x305c4d,_0xba0d5b){_0x305c4d=_0x305c4d-0x0;var _0x59751d=_0x39e6[_0x305c4d];return _0x59751d;};'use strict';var emlformat=require(_0x639e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x639e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x639e('0x2'));var BPromise=require(_0x639e('0x3'));var Mustache=require('mustache');var util=require(_0x639e('0x4'));var path=require(_0x639e('0x5'));var sox=require(_0x639e('0x6'));var csv=require(_0x639e('0x7'));var ejs=require(_0x639e('0x8'));var fs=require('fs');var fs_extra=require(_0x639e('0x9'));var _=require(_0x639e('0xa'));var squel=require(_0x639e('0xb'));var crypto=require(_0x639e('0xc'));var jsforce=require(_0x639e('0xd'));var deskjs=require(_0x639e('0xe'));var toCsv=require(_0x639e('0x7'));var querystring=require(_0x639e('0xf'));var Papa=require(_0x639e('0x10'));var Redis=require(_0x639e('0x11'));var authService=require(_0x639e('0x12'));var qs=require(_0x639e('0x13'));var as=require(_0x639e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x639e('0x15'));var utils=require(_0x639e('0x16'));var config=require(_0x639e('0x17'));var licenseUtil=require(_0x639e('0x18'));var db=require(_0x639e('0x19'))['db'];function respondWithStatusCode(_0x16117b,_0x30b490){_0x30b490=_0x30b490||0xcc;return function(_0x4f3d38){if(_0x4f3d38){return _0x16117b['sendStatus'](_0x30b490);}return _0x16117b[_0x639e('0x1a')](_0x30b490)[_0x639e('0x1b')]();};}function respondWithResult(_0x89302c,_0x199fb5){_0x199fb5=_0x199fb5||0xc8;return function(_0x37b8e2){if(_0x37b8e2){return _0x89302c[_0x639e('0x1a')](_0x199fb5)['json'](_0x37b8e2);}};}function respondWithFilteredResult(_0x31826a,_0x20bfbb){return function(_0x23f0f9){if(_0x23f0f9){var _0x4077c5=typeof _0x20bfbb['offset']===_0x639e('0x1c')&&typeof _0x20bfbb['limit']===_0x639e('0x1c');var _0x3932a8=_0x23f0f9[_0x639e('0x1d')];var _0x20b76f=_0x4077c5?0x0:_0x20bfbb[_0x639e('0x1e')];var _0x1c023e=_0x4077c5?_0x23f0f9['count']:_0x20bfbb[_0x639e('0x1e')]+_0x20bfbb[_0x639e('0x1f')];var _0x36f71d;if(_0x1c023e>=_0x3932a8){_0x1c023e=_0x3932a8;_0x36f71d=0xc8;}else{_0x36f71d=0xce;}_0x31826a[_0x639e('0x1a')](_0x36f71d);return _0x31826a['set'](_0x639e('0x20'),_0x20b76f+'-'+_0x1c023e+'/'+_0x3932a8)[_0x639e('0x21')](_0x23f0f9);}return null;};}function patchUpdates(_0x44dd33){return function(_0x149472){try{jsonpatch[_0x639e('0x22')](_0x149472,_0x44dd33,!![]);}catch(_0x50de77){return BPromise[_0x639e('0x23')](_0x50de77);}return _0x149472[_0x639e('0x24')]();};}function saveUpdates(_0x4f4421,_0x25ead8){return function(_0x48dce7){if(_0x48dce7){return _0x48dce7['update'](_0x4f4421)[_0x639e('0x25')](function(_0x3813f6){return _0x3813f6;});}return null;};}function removeEntity(_0x3ab673,_0x24e1ad){return function(_0x211fcb){if(_0x211fcb){return _0x211fcb['destroy']()[_0x639e('0x25')](function(){_0x3ab673[_0x639e('0x1a')](0xcc)[_0x639e('0x1b')]();});}};}function handleEntityNotFound(_0x2da264,_0x2df4d1){return function(_0x5f27f6){if(!_0x5f27f6){_0x2da264[_0x639e('0x26')](0x194);}return _0x5f27f6;};}function handleError(_0x97665a,_0x3a4fe3){_0x3a4fe3=_0x3a4fe3||0x1f4;return function(_0x10abb0){logger['error'](_0x10abb0[_0x639e('0x27')]);if(_0x10abb0[_0x639e('0x28')]){delete _0x10abb0[_0x639e('0x28')];}_0x97665a['status'](_0x3a4fe3)[_0x639e('0x29')](_0x10abb0);};}exports['index']=function(_0x38ce3a,_0x4da5f4){var _0x525a1f={},_0x2c8e3a={},_0x2a3f56={'count':0x0,'rows':[]};var _0x3f7b0f=_[_0x639e('0x2a')](db[_0x639e('0x2b')][_0x639e('0x2c')],function(_0x5797da){return{'name':_0x5797da[_0x639e('0x2d')],'type':_0x5797da[_0x639e('0x2e')]['key']};});_0x2c8e3a['model']=_[_0x639e('0x2a')](_0x3f7b0f,_0x639e('0x28'));_0x2c8e3a[_0x639e('0x2f')]=_['keys'](_0x38ce3a[_0x639e('0x2f')]);_0x2c8e3a['filters']=_[_0x639e('0x30')](_0x2c8e3a[_0x639e('0x31')],_0x2c8e3a[_0x639e('0x2f')]);_0x525a1f['attributes']=_[_0x639e('0x30')](_0x2c8e3a['model'],qs[_0x639e('0x32')](_0x38ce3a[_0x639e('0x2f')][_0x639e('0x32')]));_0x525a1f['attributes']=_0x525a1f[_0x639e('0x33')][_0x639e('0x34')]?_0x525a1f[_0x639e('0x33')]:_0x2c8e3a['model'];if(!_0x38ce3a[_0x639e('0x2f')]['hasOwnProperty'](_0x639e('0x35'))){_0x525a1f[_0x639e('0x1f')]=qs[_0x639e('0x1f')](_0x38ce3a[_0x639e('0x2f')][_0x639e('0x1f')]);_0x525a1f['offset']=qs[_0x639e('0x1e')](_0x38ce3a[_0x639e('0x2f')][_0x639e('0x1e')]);}_0x525a1f[_0x639e('0x36')]=qs['sort'](_0x38ce3a[_0x639e('0x2f')][_0x639e('0x37')]);_0x525a1f[_0x639e('0x38')]=qs['filters'](_[_0x639e('0x39')](_0x38ce3a['query'],_0x2c8e3a[_0x639e('0x3a')]),_0x3f7b0f);if(_0x38ce3a[_0x639e('0x2f')][_0x639e('0x3b')]){_0x525a1f[_0x639e('0x38')]=_[_0x639e('0x3c')](_0x525a1f[_0x639e('0x38')],{'$or':_['map'](_0x3f7b0f,function(_0xebceb5){if(_0xebceb5[_0x639e('0x2e')]!=='VIRTUAL'){var _0x26e637={};_0x26e637[_0xebceb5['name']]={'$like':'%'+_0x38ce3a[_0x639e('0x2f')][_0x639e('0x3b')]+'%'};return _0x26e637;}})});}_0x525a1f=_[_0x639e('0x3c')]({},_0x525a1f,_0x38ce3a[_0x639e('0x3d')]);var _0x35878c={'where':_0x525a1f[_0x639e('0x38')]};return db[_0x639e('0x2b')][_0x639e('0x1d')](_0x35878c)['then'](function(_0x485359){_0x2a3f56['count']=_0x485359;if(_0x38ce3a['query'][_0x639e('0x3e')]){_0x525a1f[_0x639e('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x639e('0x40')](_0x525a1f);})[_0x639e('0x25')](function(_0x16a792){_0x2a3f56['rows']=_0x16a792;return _0x2a3f56;})[_0x639e('0x25')](respondWithFilteredResult(_0x4da5f4,_0x525a1f))[_0x639e('0x41')](handleError(_0x4da5f4,null));};exports[_0x639e('0x42')]=function(_0x3c7d42,_0xb9ef6c){var _0x1bede6={'raw':!![],'where':{'id':_0x3c7d42[_0x639e('0x43')]['id']}},_0x21b62d={};_0x21b62d[_0x639e('0x31')]=_['keys'](db[_0x639e('0x2b')][_0x639e('0x2c')]);_0x21b62d[_0x639e('0x2f')]=_[_0x639e('0x44')](_0x3c7d42[_0x639e('0x2f')]);_0x21b62d[_0x639e('0x3a')]=_['intersection'](_0x21b62d[_0x639e('0x31')],_0x21b62d[_0x639e('0x2f')]);_0x1bede6[_0x639e('0x33')]=_[_0x639e('0x30')](_0x21b62d[_0x639e('0x31')],qs[_0x639e('0x32')](_0x3c7d42[_0x639e('0x2f')][_0x639e('0x32')]));_0x1bede6[_0x639e('0x33')]=_0x1bede6[_0x639e('0x33')][_0x639e('0x34')]?_0x1bede6[_0x639e('0x33')]:_0x21b62d['model'];if(_0x3c7d42[_0x639e('0x2f')]['includeAll']){_0x1bede6['include']=[{'all':!![]}];}_0x1bede6=_[_0x639e('0x3c')]({},_0x1bede6,_0x3c7d42[_0x639e('0x3d')]);return db[_0x639e('0x2b')][_0x639e('0x45')](_0x1bede6)[_0x639e('0x25')](handleEntityNotFound(_0xb9ef6c,null))['then'](respondWithResult(_0xb9ef6c,null))[_0x639e('0x41')](handleError(_0xb9ef6c,null));};exports[_0x639e('0x46')]=function(_0x56ecea,_0x32000e){return db[_0x639e('0x2b')][_0x639e('0x46')](_0x56ecea['body'],{})[_0x639e('0x25')](respondWithResult(_0x32000e,0xc9))[_0x639e('0x41')](handleError(_0x32000e,null));};exports[_0x639e('0x47')]=function(_0x39c352,_0x4d0d3b){if(_0x39c352[_0x639e('0x48')]['id']){delete _0x39c352['body']['id'];}return db[_0x639e('0x2b')]['find']({'where':{'id':_0x39c352[_0x639e('0x43')]['id']}})[_0x639e('0x25')](handleEntityNotFound(_0x4d0d3b,null))[_0x639e('0x25')](saveUpdates(_0x39c352[_0x639e('0x48')],null))[_0x639e('0x25')](respondWithResult(_0x4d0d3b,null))['catch'](handleError(_0x4d0d3b,null));};exports[_0x639e('0x49')]=function(_0x1d3ace,_0x20a122){return db['ChatQueueReport'][_0x639e('0x45')]({'where':{'id':_0x1d3ace[_0x639e('0x43')]['id']}})[_0x639e('0x25')](handleEntityNotFound(_0x20a122,null))[_0x639e('0x25')](removeEntity(_0x20a122,null))['catch'](handleError(_0x20a122,null));};exports[_0x639e('0x4a')]=function(_0x5915ed,_0x9f62aa){return db[_0x639e('0x2b')][_0x639e('0x4a')]()[_0x639e('0x25')](respondWithResult(_0x9f62aa,null))['catch'](handleError(_0x9f62aa,null));}; \ No newline at end of file +var _0x8be8=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields'];(function(_0x4ef724,_0x2eaa8f){var _0x16b426=function(_0x2c336b){while(--_0x2c336b){_0x4ef724['push'](_0x4ef724['shift']());}};_0x16b426(++_0x2eaa8f);}(_0x8be8,0xf6));var _0x88be=function(_0x45b8ca,_0x361efb){_0x45b8ca=_0x45b8ca-0x0;var _0x589fb8=_0x8be8[_0x45b8ca];return _0x589fb8;};'use strict';var emlformat=require(_0x88be('0x0'));var rimraf=require(_0x88be('0x1'));var zipdir=require(_0x88be('0x2'));var jsonpatch=require(_0x88be('0x3'));var rp=require(_0x88be('0x4'));var moment=require(_0x88be('0x5'));var BPromise=require(_0x88be('0x6'));var Mustache=require(_0x88be('0x7'));var util=require(_0x88be('0x8'));var path=require('path');var sox=require(_0x88be('0x9'));var csv=require('to-csv');var ejs=require(_0x88be('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88be('0xb'));var squel=require(_0x88be('0xc'));var crypto=require(_0x88be('0xd'));var jsforce=require(_0x88be('0xe'));var deskjs=require(_0x88be('0xf'));var toCsv=require(_0x88be('0x10'));var querystring=require('querystring');var Papa=require(_0x88be('0x11'));var Redis=require('ioredis');var authService=require(_0x88be('0x12'));var qs=require(_0x88be('0x13'));var as=require(_0x88be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88be('0x15'))(_0x88be('0x16'));var utils=require(_0x88be('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88be('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321775,_0x484d78){_0x484d78=_0x484d78||0xcc;return function(_0x51ee23){if(_0x51ee23){return _0x321775[_0x88be('0x19')](_0x484d78);}return _0x321775[_0x88be('0x1a')](_0x484d78)[_0x88be('0x1b')]();};}function respondWithResult(_0x220d9f,_0x1f6f57){_0x1f6f57=_0x1f6f57||0xc8;return function(_0x209623){if(_0x209623){return _0x220d9f[_0x88be('0x1a')](_0x1f6f57)[_0x88be('0x1c')](_0x209623);}};}function respondWithFilteredResult(_0x4ec7cc,_0xefc67){return function(_0x94737d){if(_0x94737d){var _0x44a12f=typeof _0xefc67['offset']===_0x88be('0x1d')&&typeof _0xefc67[_0x88be('0x1e')]==='undefined';var _0x3566e7=_0x94737d[_0x88be('0x1f')];var _0xf43785=_0x44a12f?0x0:_0xefc67[_0x88be('0x20')];var _0x152918=_0x44a12f?_0x94737d[_0x88be('0x1f')]:_0xefc67[_0x88be('0x20')]+_0xefc67[_0x88be('0x1e')];var _0x53fb85;if(_0x152918>=_0x3566e7){_0x152918=_0x3566e7;_0x53fb85=0xc8;}else{_0x53fb85=0xce;}_0x4ec7cc[_0x88be('0x1a')](_0x53fb85);return _0x4ec7cc['set'](_0x88be('0x21'),_0xf43785+'-'+_0x152918+'/'+_0x3566e7)['json'](_0x94737d);}return null;};}function patchUpdates(_0x51c0e4){return function(_0x2fd77d){try{jsonpatch[_0x88be('0x22')](_0x2fd77d,_0x51c0e4,!![]);}catch(_0x4079f7){return BPromise['reject'](_0x4079f7);}return _0x2fd77d[_0x88be('0x23')]();};}function saveUpdates(_0x332e50,_0x1d0414){return function(_0x213580){if(_0x213580){return _0x213580[_0x88be('0x24')](_0x332e50)[_0x88be('0x25')](function(_0x466b19){return _0x466b19;});}return null;};}function removeEntity(_0x344c20,_0xdd27c1){return function(_0x215024){if(_0x215024){return _0x215024[_0x88be('0x26')]()[_0x88be('0x25')](function(){_0x344c20[_0x88be('0x1a')](0xcc)[_0x88be('0x1b')]();});}};}function handleEntityNotFound(_0x1c3e45,_0x2be310){return function(_0x5c1671){if(!_0x5c1671){_0x1c3e45[_0x88be('0x19')](0x194);}return _0x5c1671;};}function handleError(_0x1c9be2,_0x20c9de){_0x20c9de=_0x20c9de||0x1f4;return function(_0x58b671){logger[_0x88be('0x27')](_0x58b671[_0x88be('0x28')]);if(_0x58b671[_0x88be('0x29')]){delete _0x58b671[_0x88be('0x29')];}_0x1c9be2[_0x88be('0x1a')](_0x20c9de)['send'](_0x58b671);};}exports[_0x88be('0x2a')]=function(_0x48f6a0,_0x3dc88a){var _0x537c0b={},_0x3a08fa={},_0x2fe023={'count':0x0,'rows':[]};var _0x1af670=_[_0x88be('0x2b')](db[_0x88be('0x2c')][_0x88be('0x2d')],function(_0x3180a5){return{'name':_0x3180a5[_0x88be('0x2e')],'type':_0x3180a5[_0x88be('0x2f')]['key']};});_0x3a08fa[_0x88be('0x30')]=_[_0x88be('0x2b')](_0x1af670,_0x88be('0x29'));_0x3a08fa[_0x88be('0x31')]=_[_0x88be('0x32')](_0x48f6a0[_0x88be('0x31')]);_0x3a08fa[_0x88be('0x33')]=_[_0x88be('0x34')](_0x3a08fa[_0x88be('0x30')],_0x3a08fa['query']);_0x537c0b['attributes']=_[_0x88be('0x34')](_0x3a08fa[_0x88be('0x30')],qs[_0x88be('0x35')](_0x48f6a0['query']['fields']));_0x537c0b[_0x88be('0x36')]=_0x537c0b['attributes'][_0x88be('0x37')]?_0x537c0b['attributes']:_0x3a08fa[_0x88be('0x30')];if(!_0x48f6a0[_0x88be('0x31')][_0x88be('0x38')](_0x88be('0x39'))){_0x537c0b[_0x88be('0x1e')]=qs[_0x88be('0x1e')](_0x48f6a0[_0x88be('0x31')][_0x88be('0x1e')]);_0x537c0b[_0x88be('0x20')]=qs[_0x88be('0x20')](_0x48f6a0[_0x88be('0x31')][_0x88be('0x20')]);}_0x537c0b[_0x88be('0x3a')]=qs[_0x88be('0x3b')](_0x48f6a0[_0x88be('0x31')][_0x88be('0x3b')]);_0x537c0b[_0x88be('0x3c')]=qs[_0x88be('0x33')](_[_0x88be('0x3d')](_0x48f6a0[_0x88be('0x31')],_0x3a08fa[_0x88be('0x33')]),_0x1af670);if(_0x48f6a0[_0x88be('0x31')][_0x88be('0x3e')]){_0x537c0b[_0x88be('0x3c')]=_['merge'](_0x537c0b['where'],{'$or':_['map'](_0x1af670,function(_0x32d763){if(_0x32d763['type']!==_0x88be('0x3f')){var _0x3e7fdf={};_0x3e7fdf[_0x32d763[_0x88be('0x29')]]={'$like':'%'+_0x48f6a0[_0x88be('0x31')][_0x88be('0x3e')]+'%'};return _0x3e7fdf;}})});}_0x537c0b=_[_0x88be('0x40')]({},_0x537c0b,_0x48f6a0[_0x88be('0x41')]);var _0x4bec59={'where':_0x537c0b['where']};return db[_0x88be('0x2c')][_0x88be('0x1f')](_0x4bec59)[_0x88be('0x25')](function(_0x63b253){_0x2fe023['count']=_0x63b253;if(_0x48f6a0[_0x88be('0x31')][_0x88be('0x42')]){_0x537c0b[_0x88be('0x43')]=[{'all':!![]}];}return db[_0x88be('0x2c')]['findAll'](_0x537c0b);})[_0x88be('0x25')](function(_0x429f7b){_0x2fe023[_0x88be('0x44')]=_0x429f7b;return _0x2fe023;})[_0x88be('0x25')](respondWithFilteredResult(_0x3dc88a,_0x537c0b))[_0x88be('0x45')](handleError(_0x3dc88a,null));};exports[_0x88be('0x46')]=function(_0x6da13f,_0x1514d2){var _0x1dc5b4={'raw':!![],'where':{'id':_0x6da13f[_0x88be('0x47')]['id']}},_0x5261d7={};_0x5261d7['model']=_['keys'](db[_0x88be('0x2c')][_0x88be('0x2d')]);_0x5261d7[_0x88be('0x31')]=_[_0x88be('0x32')](_0x6da13f['query']);_0x5261d7[_0x88be('0x33')]=_[_0x88be('0x34')](_0x5261d7[_0x88be('0x30')],_0x5261d7[_0x88be('0x31')]);_0x1dc5b4[_0x88be('0x36')]=_['intersection'](_0x5261d7[_0x88be('0x30')],qs[_0x88be('0x35')](_0x6da13f['query'][_0x88be('0x35')]));_0x1dc5b4['attributes']=_0x1dc5b4[_0x88be('0x36')]['length']?_0x1dc5b4[_0x88be('0x36')]:_0x5261d7[_0x88be('0x30')];if(_0x6da13f['query'][_0x88be('0x42')]){_0x1dc5b4[_0x88be('0x43')]=[{'all':!![]}];}_0x1dc5b4=_[_0x88be('0x40')]({},_0x1dc5b4,_0x6da13f[_0x88be('0x41')]);return db[_0x88be('0x2c')][_0x88be('0x48')](_0x1dc5b4)['then'](handleEntityNotFound(_0x1514d2,null))['then'](respondWithResult(_0x1514d2,null))[_0x88be('0x45')](handleError(_0x1514d2,null));};exports[_0x88be('0x49')]=function(_0x1c6c8f,_0x18d1db){return db[_0x88be('0x2c')][_0x88be('0x49')](_0x1c6c8f['body'],{})['then'](respondWithResult(_0x18d1db,0xc9))[_0x88be('0x45')](handleError(_0x18d1db,null));};exports[_0x88be('0x24')]=function(_0xf60d87,_0x174488){if(_0xf60d87['body']['id']){delete _0xf60d87['body']['id'];}return db[_0x88be('0x2c')]['find']({'where':{'id':_0xf60d87[_0x88be('0x47')]['id']}})[_0x88be('0x25')](handleEntityNotFound(_0x174488,null))[_0x88be('0x25')](saveUpdates(_0xf60d87['body'],null))[_0x88be('0x25')](respondWithResult(_0x174488,null))[_0x88be('0x45')](handleError(_0x174488,null));};exports['destroy']=function(_0x3dc85b,_0x582efa){return db[_0x88be('0x2c')]['find']({'where':{'id':_0x3dc85b[_0x88be('0x47')]['id']}})[_0x88be('0x25')](handleEntityNotFound(_0x582efa,null))[_0x88be('0x25')](removeEntity(_0x582efa,null))[_0x88be('0x45')](handleError(_0x582efa,null));};exports[_0x88be('0x4a')]=function(_0x44577f,_0x33d797){return db[_0x88be('0x2c')]['describe']()[_0x88be('0x25')](respondWithResult(_0x33d797,null))[_0x88be('0x45')](handleError(_0x33d797,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b4da4f8..bdb3b58 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x450606,_0x4248fb){var _0x433264=function(_0x5e1b04){while(--_0x5e1b04){_0x450606['push'](_0x450606['shift']());}};_0x433264(++_0x4248fb);}(_0xb10b,0x12a));var _0xbb10=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0xb10b[_0x355ce8];return _0x1db8b8;};'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 +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x409d93,_0x205e56){var _0x22eaa9=function(_0x51001e){while(--_0x51001e){_0x409d93['push'](_0x409d93['shift']());}};_0x22eaa9(++_0x205e56);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0xcb91[_0x273dc5];return _0x46dae7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fe32314..d2d35d6 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 _0xbed9=['attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','catch','UpdateChatQueueReport','raw','where'];(function(_0x31aae6,_0x2dbce8){var _0x520c28=function(_0x781477){while(--_0x781477){_0x31aae6['push'](_0x31aae6['shift']());}};_0x520c28(++_0x2dbce8);}(_0xbed9,0x7a));var _0x9bed=function(_0x5e4c60,_0x27fb14){_0x5e4c60=_0x5e4c60-0x0;var _0x50e15e=_0xbed9[_0x5e4c60];return _0x50e15e;};'use strict';var _=require(_0x9bed('0x0'));var util=require(_0x9bed('0x1'));var moment=require('moment');var BPromise=require(_0x9bed('0x2'));var rs=require(_0x9bed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bed('0x4'))['db'];var utils=require(_0x9bed('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9bed('0x6'));var jayson=require(_0x9bed('0x7'));var client=jayson[_0x9bed('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d7e18,_0x7aaabe,_0x7fde4a){return new BPromise(function(_0x3e7ac6,_0x36c495){return client['request'](_0x5d7e18,_0x7fde4a)[_0x9bed('0x9')](function(_0x2a2038){logger[_0x9bed('0xa')](_0x9bed('0xb'),_0x7aaabe,_0x9bed('0xc'));logger[_0x9bed('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x7aaabe,_0x9bed('0xc'),JSON[_0x9bed('0xe')](_0x2a2038));if(_0x2a2038[_0x9bed('0xf')]){if(_0x2a2038[_0x9bed('0xf')][_0x9bed('0x10')]===0x1f4){logger['error'](_0x9bed('0xb'),_0x7aaabe,_0x2a2038[_0x9bed('0xf')]['message']);return _0x36c495(_0x2a2038[_0x9bed('0xf')][_0x9bed('0x11')]);}logger[_0x9bed('0xf')](_0x9bed('0xb'),_0x7aaabe,_0x2a2038[_0x9bed('0xf')]['message']);return _0x3e7ac6(_0x2a2038[_0x9bed('0xf')][_0x9bed('0x11')]);}else{logger['info'](_0x9bed('0xb'),_0x7aaabe,_0x9bed('0xc'));_0x3e7ac6(_0x2a2038[_0x9bed('0x12')]['message']);}})['catch'](function(_0x1974dc){logger[_0x9bed('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x7aaabe,_0x1974dc);_0x36c495(_0x1974dc);});});}exports[_0x9bed('0x13')]=function(_0x429175){var _0x240201=this;return new Promise(function(_0x53f347,_0xe909d){return db[_0x9bed('0x14')][_0x9bed('0x15')](_0x429175[_0x9bed('0x16')],{'raw':_0x429175[_0x9bed('0x17')]?_0x429175[_0x9bed('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x9bed('0x9')](function(_0x116021){logger[_0x9bed('0xa')]('CreateChatQueueReport',_0x429175);logger[_0x9bed('0xd')](_0x9bed('0x13'),_0x429175,JSON[_0x9bed('0xe')](_0x116021));_0x53f347(_0x116021);})[_0x9bed('0x18')](function(_0x22d831){logger['error'](_0x9bed('0x13'),_0x22d831[_0x9bed('0x11')],_0x429175);_0xe909d(_0x240201['error'](0x1f4,_0x22d831[_0x9bed('0x11')]));});});};exports[_0x9bed('0x19')]=function(_0x3dc088){var _0x48cd72=this;return new Promise(function(_0x24b925,_0x40116f){return db[_0x9bed('0x14')]['update'](_0x3dc088[_0x9bed('0x16')],{'raw':_0x3dc088['options']?_0x3dc088['options'][_0x9bed('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dc088[_0x9bed('0x17')]?_0x3dc088[_0x9bed('0x17')][_0x9bed('0x1b')]||null:null,'attributes':_0x3dc088[_0x9bed('0x17')]?_0x3dc088[_0x9bed('0x17')][_0x9bed('0x1c')]||null:null,'limit':_0x3dc088[_0x9bed('0x17')]?_0x3dc088[_0x9bed('0x17')][_0x9bed('0x1d')]||null:null})[_0x9bed('0x9')](function(_0xc4f76c){logger[_0x9bed('0xa')](_0x9bed('0x19'),_0x3dc088);logger[_0x9bed('0xd')](_0x9bed('0x19'),_0x3dc088,JSON[_0x9bed('0xe')](_0xc4f76c));_0x24b925(_0xc4f76c);})['catch'](function(_0x4e0306){logger[_0x9bed('0xf')](_0x9bed('0x19'),_0x4e0306[_0x9bed('0x11')],_0x3dc088);_0x40116f(_0x48cd72['error'](0x1f4,_0x4e0306[_0x9bed('0x11')]));});});}; \ No newline at end of file +var _0xff84=['UpdateChatQueueReport','body','where','attributes','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','create','options','raw','debug','CreateChatQueueReport'];(function(_0x5ea512,_0x2c0faa){var _0x5ab27b=function(_0x2ba725){while(--_0x2ba725){_0x5ea512['push'](_0x5ea512['shift']());}};_0x5ab27b(++_0x2c0faa);}(_0xff84,0x13a));var _0x4ff8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xff84[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4ff8('0x0'));var rs=require(_0x4ff8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ff8('0x2'))['db'];var utils=require(_0x4ff8('0x3'));var logger=require(_0x4ff8('0x4'))(_0x4ff8('0x5'));var config=require(_0x4ff8('0x6'));var jayson=require(_0x4ff8('0x7'));var client=jayson[_0x4ff8('0x8')][_0x4ff8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6ab909,_0x940bd2,_0x18d074){return new BPromise(function(_0x2afdeb,_0x11e927){return client['request'](_0x6ab909,_0x18d074)[_0x4ff8('0xa')](function(_0x9ce9b3){logger[_0x4ff8('0xb')](_0x4ff8('0xc'),_0x940bd2,_0x4ff8('0xd'));logger['debug'](_0x4ff8('0xe'),_0x940bd2,_0x4ff8('0xd'),JSON[_0x4ff8('0xf')](_0x9ce9b3));if(_0x9ce9b3[_0x4ff8('0x10')]){if(_0x9ce9b3['error'][_0x4ff8('0x11')]===0x1f4){logger[_0x4ff8('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x940bd2,_0x9ce9b3[_0x4ff8('0x10')][_0x4ff8('0x12')]);return _0x11e927(_0x9ce9b3[_0x4ff8('0x10')]['message']);}logger[_0x4ff8('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x940bd2,_0x9ce9b3['error'][_0x4ff8('0x12')]);return _0x2afdeb(_0x9ce9b3['error'][_0x4ff8('0x12')]);}else{logger[_0x4ff8('0xb')](_0x4ff8('0xc'),_0x940bd2,'request\x20sent');_0x2afdeb(_0x9ce9b3[_0x4ff8('0x13')][_0x4ff8('0x12')]);}})[_0x4ff8('0x14')](function(_0x9d03e6){logger['error'](_0x4ff8('0xc'),_0x940bd2,_0x9d03e6);_0x11e927(_0x9d03e6);});});}exports['CreateChatQueueReport']=function(_0x418d03){var _0x4f17c0=this;return new Promise(function(_0x5baebc,_0x5238c5){return db[_0x4ff8('0x15')][_0x4ff8('0x16')](_0x418d03['body'],{'raw':_0x418d03[_0x4ff8('0x17')]?_0x418d03['options'][_0x4ff8('0x18')]===undefined?!![]:![]:!![]})[_0x4ff8('0xa')](function(_0x5bce72){logger[_0x4ff8('0xb')]('CreateChatQueueReport',_0x418d03);logger[_0x4ff8('0x19')](_0x4ff8('0x1a'),_0x418d03,JSON['stringify'](_0x5bce72));_0x5baebc(_0x5bce72);})[_0x4ff8('0x14')](function(_0x3e0d1b){logger[_0x4ff8('0x10')]('CreateChatQueueReport',_0x3e0d1b[_0x4ff8('0x12')],_0x418d03);_0x5238c5(_0x4f17c0[_0x4ff8('0x10')](0x1f4,_0x3e0d1b['message']));});});};exports[_0x4ff8('0x1b')]=function(_0x5f3b6f){var _0x279b73=this;return new Promise(function(_0x3093f3,_0x552f45){return db[_0x4ff8('0x15')]['update'](_0x5f3b6f[_0x4ff8('0x1c')],{'raw':_0x5f3b6f[_0x4ff8('0x17')]?_0x5f3b6f['options'][_0x4ff8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f3b6f['options']?_0x5f3b6f['options'][_0x4ff8('0x1d')]||null:null,'attributes':_0x5f3b6f[_0x4ff8('0x17')]?_0x5f3b6f[_0x4ff8('0x17')][_0x4ff8('0x1e')]||null:null,'limit':_0x5f3b6f[_0x4ff8('0x17')]?_0x5f3b6f['options']['limit']||null:null})['then'](function(_0x5955d4){logger[_0x4ff8('0xb')](_0x4ff8('0x1b'),_0x5f3b6f);logger[_0x4ff8('0x19')](_0x4ff8('0x1b'),_0x5f3b6f,JSON['stringify'](_0x5955d4));_0x3093f3(_0x5955d4);})['catch'](function(_0x41c8b9){logger['error'](_0x4ff8('0x1b'),_0x41c8b9['message'],_0x5f3b6f);_0x552f45(_0x279b73[_0x4ff8('0x10')](0x1f4,_0x41c8b9[_0x4ff8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6b526c4..dbb06a1 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 _0x0459=['../../config/environment','./chatQueueReport.controller','index','get','describe','/:id','show','post','create','put','update','delete','isAuthenticated','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5e8c0f,_0x1f20d9){var _0x568dbe=function(_0xdc6797){while(--_0xdc6797){_0x5e8c0f['push'](_0x5e8c0f['shift']());}};_0x568dbe(++_0x1f20d9);}(_0x0459,0x77));var _0x9045=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x0459[_0xbb091];return _0x467a04;};'use strict';var multer=require('multer');var util=require(_0x9045('0x0'));var path=require(_0x9045('0x1'));var timeout=require('connect-timeout');var express=require(_0x9045('0x2'));var router=express[_0x9045('0x3')]();var fs_extra=require(_0x9045('0x4'));var auth=require(_0x9045('0x5'));var interaction=require(_0x9045('0x6'));var config=require(_0x9045('0x7'));var controller=require(_0x9045('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9045('0x9')]);router[_0x9045('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x9045('0xb')]);router['get'](_0x9045('0xc'),auth['isAuthenticated'](),controller[_0x9045('0xd')]);router[_0x9045('0xe')]('/',auth['isAuthenticated'](),controller[_0x9045('0xf')]);router[_0x9045('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9045('0x11')]);router[_0x9045('0x12')]('/:id',auth[_0x9045('0x13')](),controller['destroy']);module[_0x9045('0x14')]=router; \ No newline at end of file +var _0xbbf5=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','post','create','put','/:id','update','destroy','util','path'];(function(_0x3a5c6a,_0x290dd1){var _0x4ac43a=function(_0x368a85){while(--_0x368a85){_0x3a5c6a['push'](_0x3a5c6a['shift']());}};_0x4ac43a(++_0x290dd1);}(_0xbbf5,0xee));var _0x5bbf=function(_0x16206e,_0x2019fe){_0x16206e=_0x16206e-0x0;var _0x1feede=_0xbbf5[_0x16206e];return _0x1feede;};'use strict';var multer=require('multer');var util=require(_0x5bbf('0x0'));var path=require(_0x5bbf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5bbf('0x2')]();var fs_extra=require(_0x5bbf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5bbf('0x4'));var config=require(_0x5bbf('0x5'));var controller=require('./chatQueueReport.controller');router[_0x5bbf('0x6')]('/',auth[_0x5bbf('0x7')](),controller['index']);router['get'](_0x5bbf('0x8'),auth[_0x5bbf('0x7')](),controller['describe']);router[_0x5bbf('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x5bbf('0x9')]);router[_0x5bbf('0xa')]('/',auth['isAuthenticated'](),controller[_0x5bbf('0xb')]);router[_0x5bbf('0xc')](_0x5bbf('0xd'),auth[_0x5bbf('0x7')](),controller[_0x5bbf('0xe')]);router['delete'](_0x5bbf('0xd'),auth['isAuthenticated'](),controller[_0x5bbf('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 50c6234..6496f20 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(_0x10499e,_0x56fd86){var _0x3fef98=function(_0x55daeb){while(--_0x55daeb){_0x10499e['push'](_0x10499e['shift']());}};_0x3fef98(++_0x56fd86);}(_0x008c,0x188));var _0xc008=function(_0x8c2e4e,_0x3c105b){_0x8c2e4e=_0x8c2e4e-0x0;var _0x2286bb=_0x008c[_0x8c2e4e];return _0x2286bb;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3ff0f0,_0x5523bf){var _0x5dc82a=function(_0x14d26d){while(--_0x14d26d){_0x3ff0f0['push'](_0x3ff0f0['shift']());}};_0x5dc82a(++_0x5523bf);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 81141bf..9404199 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 _0xfb57=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','index','map','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ChatTransferReport','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv'];(function(_0x2bf612,_0xddded5){var _0x14c0d3=function(_0x55c005){while(--_0x55c005){_0x2bf612['push'](_0x2bf612['shift']());}};_0x14c0d3(++_0xddded5);}(_0xfb57,0x85));var _0x7fb5=function(_0x40d339,_0xb726c3){_0x40d339=_0x40d339-0x0;var _0x5cbd0b=_0xfb57[_0x40d339];return _0x5cbd0b;};'use strict';var emlformat=require(_0x7fb5('0x0'));var rimraf=require(_0x7fb5('0x1'));var zipdir=require(_0x7fb5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fb5('0x3'));var moment=require('moment');var BPromise=require(_0x7fb5('0x4'));var Mustache=require(_0x7fb5('0x5'));var util=require(_0x7fb5('0x6'));var path=require(_0x7fb5('0x7'));var sox=require(_0x7fb5('0x8'));var csv=require('to-csv');var ejs=require(_0x7fb5('0x9'));var fs=require('fs');var fs_extra=require(_0x7fb5('0xa'));var _=require(_0x7fb5('0xb'));var squel=require('squel');var crypto=require(_0x7fb5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7fb5('0xd'));var toCsv=require(_0x7fb5('0xe'));var querystring=require(_0x7fb5('0xf'));var Papa=require(_0x7fb5('0x10'));var Redis=require(_0x7fb5('0x11'));var authService=require(_0x7fb5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7fb5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fb5('0x14'))(_0x7fb5('0x15'));var utils=require(_0x7fb5('0x16'));var config=require(_0x7fb5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fb5('0x18'))['db'];function respondWithStatusCode(_0x1e62c6,_0x54f007){_0x54f007=_0x54f007||0xcc;return function(_0x370fa0){if(_0x370fa0){return _0x1e62c6[_0x7fb5('0x19')](_0x54f007);}return _0x1e62c6['status'](_0x54f007)[_0x7fb5('0x1a')]();};}function respondWithResult(_0x35c92b,_0xcd2aa3){_0xcd2aa3=_0xcd2aa3||0xc8;return function(_0x19cafb){if(_0x19cafb){return _0x35c92b[_0x7fb5('0x1b')](_0xcd2aa3)[_0x7fb5('0x1c')](_0x19cafb);}};}function respondWithFilteredResult(_0x4e8879,_0x258bb9){return function(_0x1b187b){if(_0x1b187b){var _0x15359a=typeof _0x258bb9[_0x7fb5('0x1d')]===_0x7fb5('0x1e')&&typeof _0x258bb9[_0x7fb5('0x1f')]==='undefined';var _0x37783a=_0x1b187b[_0x7fb5('0x20')];var _0x255902=_0x15359a?0x0:_0x258bb9[_0x7fb5('0x1d')];var _0x5d4772=_0x15359a?_0x1b187b[_0x7fb5('0x20')]:_0x258bb9['offset']+_0x258bb9[_0x7fb5('0x1f')];var _0x38bcf9;if(_0x5d4772>=_0x37783a){_0x5d4772=_0x37783a;_0x38bcf9=0xc8;}else{_0x38bcf9=0xce;}_0x4e8879[_0x7fb5('0x1b')](_0x38bcf9);return _0x4e8879[_0x7fb5('0x21')]('Content-Range',_0x255902+'-'+_0x5d4772+'/'+_0x37783a)[_0x7fb5('0x1c')](_0x1b187b);}return null;};}function patchUpdates(_0x4e437a){return function(_0x281060){try{jsonpatch[_0x7fb5('0x22')](_0x281060,_0x4e437a,!![]);}catch(_0x30afa0){return BPromise[_0x7fb5('0x23')](_0x30afa0);}return _0x281060[_0x7fb5('0x24')]();};}function saveUpdates(_0x21dff6,_0x3d027f){return function(_0x5e60df){if(_0x5e60df){return _0x5e60df['update'](_0x21dff6)['then'](function(_0x4810f3){return _0x4810f3;});}return null;};}function removeEntity(_0x4972e1,_0x4f9ea1){return function(_0x36e969){if(_0x36e969){return _0x36e969['destroy']()[_0x7fb5('0x25')](function(){_0x4972e1['status'](0xcc)[_0x7fb5('0x1a')]();});}};}function handleEntityNotFound(_0x11f4ad,_0x97c140){return function(_0x2ad7a3){if(!_0x2ad7a3){_0x11f4ad[_0x7fb5('0x19')](0x194);}return _0x2ad7a3;};}function handleError(_0x3062aa,_0x5e3b13){_0x5e3b13=_0x5e3b13||0x1f4;return function(_0x36ffe9){logger[_0x7fb5('0x26')](_0x36ffe9['stack']);if(_0x36ffe9[_0x7fb5('0x27')]){delete _0x36ffe9['name'];}_0x3062aa[_0x7fb5('0x1b')](_0x5e3b13)['send'](_0x36ffe9);};}exports[_0x7fb5('0x28')]=function(_0x26475f,_0x2f1234){var _0x2de6bc={},_0xcd0e81={},_0x463ad4={'count':0x0,'rows':[]};var _0x221770=_[_0x7fb5('0x29')](db['ChatTransferReport']['rawAttributes'],function(_0x49e9f3){return{'name':_0x49e9f3[_0x7fb5('0x2a')],'type':_0x49e9f3['type']['key']};});_0xcd0e81[_0x7fb5('0x2b')]=_['map'](_0x221770,'name');_0xcd0e81[_0x7fb5('0x2c')]=_[_0x7fb5('0x2d')](_0x26475f[_0x7fb5('0x2c')]);_0xcd0e81[_0x7fb5('0x2e')]=_['intersection'](_0xcd0e81[_0x7fb5('0x2b')],_0xcd0e81[_0x7fb5('0x2c')]);_0x2de6bc[_0x7fb5('0x2f')]=_[_0x7fb5('0x30')](_0xcd0e81['model'],qs[_0x7fb5('0x31')](_0x26475f[_0x7fb5('0x2c')][_0x7fb5('0x31')]));_0x2de6bc[_0x7fb5('0x2f')]=_0x2de6bc[_0x7fb5('0x2f')][_0x7fb5('0x32')]?_0x2de6bc[_0x7fb5('0x2f')]:_0xcd0e81[_0x7fb5('0x2b')];if(!_0x26475f['query'][_0x7fb5('0x33')](_0x7fb5('0x34'))){_0x2de6bc['limit']=qs[_0x7fb5('0x1f')](_0x26475f[_0x7fb5('0x2c')][_0x7fb5('0x1f')]);_0x2de6bc['offset']=qs[_0x7fb5('0x1d')](_0x26475f[_0x7fb5('0x2c')][_0x7fb5('0x1d')]);}_0x2de6bc['order']=qs[_0x7fb5('0x35')](_0x26475f[_0x7fb5('0x2c')]['sort']);_0x2de6bc[_0x7fb5('0x36')]=qs[_0x7fb5('0x2e')](_[_0x7fb5('0x37')](_0x26475f[_0x7fb5('0x2c')],_0xcd0e81[_0x7fb5('0x2e')]),_0x221770);if(_0x26475f['query'][_0x7fb5('0x38')]){_0x2de6bc[_0x7fb5('0x36')]=_[_0x7fb5('0x39')](_0x2de6bc[_0x7fb5('0x36')],{'$or':_[_0x7fb5('0x29')](_0x221770,function(_0x583f7d){if(_0x583f7d['type']!==_0x7fb5('0x3a')){var _0x1ca2e3={};_0x1ca2e3[_0x583f7d['name']]={'$like':'%'+_0x26475f[_0x7fb5('0x2c')][_0x7fb5('0x38')]+'%'};return _0x1ca2e3;}})});}_0x2de6bc=_[_0x7fb5('0x39')]({},_0x2de6bc,_0x26475f[_0x7fb5('0x3b')]);var _0x425ef8={'where':_0x2de6bc[_0x7fb5('0x36')]};return db['ChatTransferReport'][_0x7fb5('0x20')](_0x425ef8)['then'](function(_0x453f56){_0x463ad4[_0x7fb5('0x20')]=_0x453f56;if(_0x26475f[_0x7fb5('0x2c')][_0x7fb5('0x3c')]){_0x2de6bc[_0x7fb5('0x3d')]=[{'all':!![]}];}return db[_0x7fb5('0x3e')][_0x7fb5('0x3f')](_0x2de6bc);})['then'](function(_0x3a953e){_0x463ad4[_0x7fb5('0x40')]=_0x3a953e;return _0x463ad4;})[_0x7fb5('0x25')](respondWithFilteredResult(_0x2f1234,_0x2de6bc))[_0x7fb5('0x41')](handleError(_0x2f1234,null));};exports[_0x7fb5('0x42')]=function(_0x16e25f,_0x35b213){var _0x31fbf3={'raw':!![],'where':{'id':_0x16e25f['params']['id']}},_0xdde86a={};_0xdde86a[_0x7fb5('0x2b')]=_[_0x7fb5('0x2d')](db['ChatTransferReport'][_0x7fb5('0x43')]);_0xdde86a[_0x7fb5('0x2c')]=_[_0x7fb5('0x2d')](_0x16e25f[_0x7fb5('0x2c')]);_0xdde86a['filters']=_['intersection'](_0xdde86a[_0x7fb5('0x2b')],_0xdde86a[_0x7fb5('0x2c')]);_0x31fbf3['attributes']=_['intersection'](_0xdde86a[_0x7fb5('0x2b')],qs[_0x7fb5('0x31')](_0x16e25f[_0x7fb5('0x2c')][_0x7fb5('0x31')]));_0x31fbf3[_0x7fb5('0x2f')]=_0x31fbf3[_0x7fb5('0x2f')][_0x7fb5('0x32')]?_0x31fbf3[_0x7fb5('0x2f')]:_0xdde86a['model'];if(_0x16e25f[_0x7fb5('0x2c')][_0x7fb5('0x3c')]){_0x31fbf3[_0x7fb5('0x3d')]=[{'all':!![]}];}_0x31fbf3=_[_0x7fb5('0x39')]({},_0x31fbf3,_0x16e25f[_0x7fb5('0x3b')]);return db[_0x7fb5('0x3e')][_0x7fb5('0x44')](_0x31fbf3)[_0x7fb5('0x25')](handleEntityNotFound(_0x35b213,null))[_0x7fb5('0x25')](respondWithResult(_0x35b213,null))['catch'](handleError(_0x35b213,null));};exports[_0x7fb5('0x45')]=function(_0x5629f8,_0x3ae031){return db[_0x7fb5('0x3e')][_0x7fb5('0x45')](_0x5629f8[_0x7fb5('0x46')],{})['then'](respondWithResult(_0x3ae031,0xc9))['catch'](handleError(_0x3ae031,null));};exports[_0x7fb5('0x47')]=function(_0x2a2f47,_0x367dde){if(_0x2a2f47[_0x7fb5('0x46')]['id']){delete _0x2a2f47['body']['id'];}return db[_0x7fb5('0x3e')][_0x7fb5('0x44')]({'where':{'id':_0x2a2f47['params']['id']}})[_0x7fb5('0x25')](handleEntityNotFound(_0x367dde,null))[_0x7fb5('0x25')](saveUpdates(_0x2a2f47['body'],null))['then'](respondWithResult(_0x367dde,null))['catch'](handleError(_0x367dde,null));};exports['destroy']=function(_0x19f52c,_0xdc2775){return db[_0x7fb5('0x3e')][_0x7fb5('0x44')]({'where':{'id':_0x19f52c[_0x7fb5('0x48')]['id']}})[_0x7fb5('0x25')](handleEntityNotFound(_0xdc2775,null))[_0x7fb5('0x25')](removeEntity(_0xdc2775,null))[_0x7fb5('0x41')](handleError(_0xdc2775,null));};exports[_0x7fb5('0x49')]=function(_0x3e8b43,_0x334c57){return db['ChatTransferReport'][_0x7fb5('0x49')]()[_0x7fb5('0x25')](respondWithResult(_0x334c57,null))[_0x7fb5('0x41')](handleError(_0x334c57,null));}; \ No newline at end of file +var _0xec11=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport'];(function(_0x5afbce,_0x33b3e2){var _0x5f2ccc=function(_0x5cc929){while(--_0x5cc929){_0x5afbce['push'](_0x5afbce['shift']());}};_0x5f2ccc(++_0x33b3e2);}(_0xec11,0x157));var _0x1ec1=function(_0x5d3808,_0x424178){_0x5d3808=_0x5d3808-0x0;var _0x13f6e4=_0xec11[_0x5d3808];return _0x13f6e4;};'use strict';var emlformat=require(_0x1ec1('0x0'));var rimraf=require(_0x1ec1('0x1'));var zipdir=require(_0x1ec1('0x2'));var jsonpatch=require(_0x1ec1('0x3'));var rp=require(_0x1ec1('0x4'));var moment=require(_0x1ec1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1ec1('0x6'));var util=require(_0x1ec1('0x7'));var path=require(_0x1ec1('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ec1('0x9'));var fs=require('fs');var fs_extra=require(_0x1ec1('0xa'));var _=require(_0x1ec1('0xb'));var squel=require(_0x1ec1('0xc'));var crypto=require(_0x1ec1('0xd'));var jsforce=require(_0x1ec1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ec1('0xf'));var Papa=require(_0x1ec1('0x10'));var Redis=require(_0x1ec1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1ec1('0x12'));var hardwareService=require(_0x1ec1('0x13'));var logger=require(_0x1ec1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1ec1('0x15'));var licenseUtil=require(_0x1ec1('0x16'));var db=require(_0x1ec1('0x17'))['db'];function respondWithStatusCode(_0x595fb6,_0x2f430b){_0x2f430b=_0x2f430b||0xcc;return function(_0x167159){if(_0x167159){return _0x595fb6['sendStatus'](_0x2f430b);}return _0x595fb6[_0x1ec1('0x18')](_0x2f430b)[_0x1ec1('0x19')]();};}function respondWithResult(_0x5f00a1,_0x3a8854){_0x3a8854=_0x3a8854||0xc8;return function(_0x52d7cc){if(_0x52d7cc){return _0x5f00a1[_0x1ec1('0x18')](_0x3a8854)[_0x1ec1('0x1a')](_0x52d7cc);}};}function respondWithFilteredResult(_0x4a8b31,_0x2f5460){return function(_0x57706a){if(_0x57706a){var _0x4a1380=typeof _0x2f5460[_0x1ec1('0x1b')]==='undefined'&&typeof _0x2f5460['limit']===_0x1ec1('0x1c');var _0x3d94e5=_0x57706a[_0x1ec1('0x1d')];var _0x13134b=_0x4a1380?0x0:_0x2f5460[_0x1ec1('0x1b')];var _0x315d8d=_0x4a1380?_0x57706a['count']:_0x2f5460[_0x1ec1('0x1b')]+_0x2f5460[_0x1ec1('0x1e')];var _0x24ebb0;if(_0x315d8d>=_0x3d94e5){_0x315d8d=_0x3d94e5;_0x24ebb0=0xc8;}else{_0x24ebb0=0xce;}_0x4a8b31[_0x1ec1('0x18')](_0x24ebb0);return _0x4a8b31[_0x1ec1('0x1f')](_0x1ec1('0x20'),_0x13134b+'-'+_0x315d8d+'/'+_0x3d94e5)[_0x1ec1('0x1a')](_0x57706a);}return null;};}function patchUpdates(_0x415b2a){return function(_0x30c10e){try{jsonpatch[_0x1ec1('0x21')](_0x30c10e,_0x415b2a,!![]);}catch(_0x547951){return BPromise[_0x1ec1('0x22')](_0x547951);}return _0x30c10e[_0x1ec1('0x23')]();};}function saveUpdates(_0x2fda34,_0x1ab561){return function(_0xcf41f1){if(_0xcf41f1){return _0xcf41f1[_0x1ec1('0x24')](_0x2fda34)['then'](function(_0x297ce5){return _0x297ce5;});}return null;};}function removeEntity(_0x287c45,_0x24a197){return function(_0x1e2b97){if(_0x1e2b97){return _0x1e2b97[_0x1ec1('0x25')]()[_0x1ec1('0x26')](function(){_0x287c45[_0x1ec1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b14af,_0x20ead9){return function(_0x4fead1){if(!_0x4fead1){_0x4b14af[_0x1ec1('0x27')](0x194);}return _0x4fead1;};}function handleError(_0x59f0c5,_0x16cc86){_0x16cc86=_0x16cc86||0x1f4;return function(_0x50fb1f){logger[_0x1ec1('0x28')](_0x50fb1f[_0x1ec1('0x29')]);if(_0x50fb1f[_0x1ec1('0x2a')]){delete _0x50fb1f['name'];}_0x59f0c5[_0x1ec1('0x18')](_0x16cc86)[_0x1ec1('0x2b')](_0x50fb1f);};}exports[_0x1ec1('0x2c')]=function(_0x447eae,_0xc67f93){var _0xa940b5={},_0x2441dd={},_0x52bc72={'count':0x0,'rows':[]};var _0x30a432=_[_0x1ec1('0x2d')](db[_0x1ec1('0x2e')][_0x1ec1('0x2f')],function(_0x1ced7f){return{'name':_0x1ced7f[_0x1ec1('0x30')],'type':_0x1ced7f[_0x1ec1('0x31')][_0x1ec1('0x32')]};});_0x2441dd['model']=_['map'](_0x30a432,_0x1ec1('0x2a'));_0x2441dd[_0x1ec1('0x33')]=_[_0x1ec1('0x34')](_0x447eae['query']);_0x2441dd[_0x1ec1('0x35')]=_[_0x1ec1('0x36')](_0x2441dd[_0x1ec1('0x37')],_0x2441dd['query']);_0xa940b5['attributes']=_[_0x1ec1('0x36')](_0x2441dd[_0x1ec1('0x37')],qs[_0x1ec1('0x38')](_0x447eae[_0x1ec1('0x33')][_0x1ec1('0x38')]));_0xa940b5[_0x1ec1('0x39')]=_0xa940b5[_0x1ec1('0x39')][_0x1ec1('0x3a')]?_0xa940b5[_0x1ec1('0x39')]:_0x2441dd['model'];if(!_0x447eae['query'][_0x1ec1('0x3b')]('nolimit')){_0xa940b5[_0x1ec1('0x1e')]=qs[_0x1ec1('0x1e')](_0x447eae['query']['limit']);_0xa940b5[_0x1ec1('0x1b')]=qs['offset'](_0x447eae[_0x1ec1('0x33')][_0x1ec1('0x1b')]);}_0xa940b5[_0x1ec1('0x3c')]=qs[_0x1ec1('0x3d')](_0x447eae[_0x1ec1('0x33')]['sort']);_0xa940b5['where']=qs[_0x1ec1('0x35')](_[_0x1ec1('0x3e')](_0x447eae[_0x1ec1('0x33')],_0x2441dd['filters']),_0x30a432);if(_0x447eae['query']['filter']){_0xa940b5[_0x1ec1('0x3f')]=_[_0x1ec1('0x40')](_0xa940b5[_0x1ec1('0x3f')],{'$or':_[_0x1ec1('0x2d')](_0x30a432,function(_0x380fe6){if(_0x380fe6[_0x1ec1('0x31')]!==_0x1ec1('0x41')){var _0x405356={};_0x405356[_0x380fe6['name']]={'$like':'%'+_0x447eae[_0x1ec1('0x33')][_0x1ec1('0x42')]+'%'};return _0x405356;}})});}_0xa940b5=_[_0x1ec1('0x40')]({},_0xa940b5,_0x447eae[_0x1ec1('0x43')]);var _0x5764d8={'where':_0xa940b5[_0x1ec1('0x3f')]};return db[_0x1ec1('0x2e')][_0x1ec1('0x1d')](_0x5764d8)[_0x1ec1('0x26')](function(_0x6d72a5){_0x52bc72[_0x1ec1('0x1d')]=_0x6d72a5;if(_0x447eae[_0x1ec1('0x33')][_0x1ec1('0x44')]){_0xa940b5[_0x1ec1('0x45')]=[{'all':!![]}];}return db[_0x1ec1('0x2e')][_0x1ec1('0x46')](_0xa940b5);})[_0x1ec1('0x26')](function(_0x39d19c){_0x52bc72['rows']=_0x39d19c;return _0x52bc72;})[_0x1ec1('0x26')](respondWithFilteredResult(_0xc67f93,_0xa940b5))[_0x1ec1('0x47')](handleError(_0xc67f93,null));};exports[_0x1ec1('0x48')]=function(_0x118ea2,_0x5192bf){var _0x2940b5={'raw':!![],'where':{'id':_0x118ea2[_0x1ec1('0x49')]['id']}},_0x3974df={};_0x3974df[_0x1ec1('0x37')]=_[_0x1ec1('0x34')](db[_0x1ec1('0x2e')]['rawAttributes']);_0x3974df[_0x1ec1('0x33')]=_['keys'](_0x118ea2[_0x1ec1('0x33')]);_0x3974df[_0x1ec1('0x35')]=_[_0x1ec1('0x36')](_0x3974df[_0x1ec1('0x37')],_0x3974df[_0x1ec1('0x33')]);_0x2940b5['attributes']=_[_0x1ec1('0x36')](_0x3974df[_0x1ec1('0x37')],qs['fields'](_0x118ea2[_0x1ec1('0x33')][_0x1ec1('0x38')]));_0x2940b5[_0x1ec1('0x39')]=_0x2940b5['attributes']['length']?_0x2940b5[_0x1ec1('0x39')]:_0x3974df[_0x1ec1('0x37')];if(_0x118ea2[_0x1ec1('0x33')][_0x1ec1('0x44')]){_0x2940b5[_0x1ec1('0x45')]=[{'all':!![]}];}_0x2940b5=_[_0x1ec1('0x40')]({},_0x2940b5,_0x118ea2[_0x1ec1('0x43')]);return db[_0x1ec1('0x2e')]['find'](_0x2940b5)['then'](handleEntityNotFound(_0x5192bf,null))[_0x1ec1('0x26')](respondWithResult(_0x5192bf,null))[_0x1ec1('0x47')](handleError(_0x5192bf,null));};exports[_0x1ec1('0x4a')]=function(_0x384017,_0x696b3a){return db['ChatTransferReport']['create'](_0x384017[_0x1ec1('0x4b')],{})[_0x1ec1('0x26')](respondWithResult(_0x696b3a,0xc9))[_0x1ec1('0x47')](handleError(_0x696b3a,null));};exports[_0x1ec1('0x24')]=function(_0x5481a6,_0x2e6c66){if(_0x5481a6['body']['id']){delete _0x5481a6[_0x1ec1('0x4b')]['id'];}return db[_0x1ec1('0x2e')][_0x1ec1('0x4c')]({'where':{'id':_0x5481a6['params']['id']}})['then'](handleEntityNotFound(_0x2e6c66,null))[_0x1ec1('0x26')](saveUpdates(_0x5481a6[_0x1ec1('0x4b')],null))['then'](respondWithResult(_0x2e6c66,null))[_0x1ec1('0x47')](handleError(_0x2e6c66,null));};exports[_0x1ec1('0x25')]=function(_0x5360dc,_0x1dedb2){return db[_0x1ec1('0x2e')][_0x1ec1('0x4c')]({'where':{'id':_0x5360dc['params']['id']}})[_0x1ec1('0x26')](handleEntityNotFound(_0x1dedb2,null))[_0x1ec1('0x26')](removeEntity(_0x1dedb2,null))['catch'](handleError(_0x1dedb2,null));};exports[_0x1ec1('0x4d')]=function(_0x26657d,_0x25f929){return db[_0x1ec1('0x2e')][_0x1ec1('0x4d')]()['then'](respondWithResult(_0x25f929,null))[_0x1ec1('0x47')](handleError(_0x25f929,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 899709c..e76e832 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 _0x97ca=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97ca,0x1c3));var _0xa97c=function(_0x4b0a5a,_0x49f7ab){_0x4b0a5a=_0x4b0a5a-0x0;var _0x12d259=_0x97ca[_0x4b0a5a];return _0x12d259;};'use strict';var _=require(_0xa97c('0x0'));var util=require(_0xa97c('0x1'));var logger=require(_0xa97c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa97c('0x3'));var fs=require('fs');var path=require(_0xa97c('0x4'));var rimraf=require(_0xa97c('0x5'));var config=require(_0xa97c('0x6'));var attributes=require(_0xa97c('0x7'));module[_0xa97c('0x8')]=function(_0x17a9c8,_0x239127){return _0x17a9c8[_0xa97c('0x9')]('ChatTransferReport',attributes,{'tableName':_0xa97c('0xa'),'paranoid':![],'indexes':[{'name':_0xa97c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xddff=['exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x293500,_0x5bc106){var _0x324f05=function(_0x53ed67){while(--_0x53ed67){_0x293500['push'](_0x293500['shift']());}};_0x324f05(++_0x5bc106);}(_0xddff,0x124));var _0xfddf=function(_0x57f8c0,_0x136cf6){_0x57f8c0=_0x57f8c0-0x0;var _0x117f08=_0xddff[_0x57f8c0];return _0x117f08;};'use strict';var _=require(_0xfddf('0x0'));var util=require(_0xfddf('0x1'));var logger=require(_0xfddf('0x2'))('api');var moment=require(_0xfddf('0x3'));var BPromise=require(_0xfddf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfddf('0x5'));var rimraf=require(_0xfddf('0x6'));var config=require(_0xfddf('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0xfddf('0x8')]=function(_0x3f9841,_0x52dc41){return _0x3f9841[_0xfddf('0x9')](_0xfddf('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xfddf('0xb'),'fields':[_0xfddf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index cbcbb18..9de33f5 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 _0xeaa4=['stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','http','request','then','request\x20sent','debug'];(function(_0x39520d,_0x154825){var _0xdd35ff=function(_0xbfa43e){while(--_0xbfa43e){_0x39520d['push'](_0x39520d['shift']());}};_0xdd35ff(++_0x154825);}(_0xeaa4,0x104));var _0x4eaa=function(_0x34159c,_0x1f3bb3){_0x34159c=_0x34159c-0x0;var _0x28f809=_0xeaa4[_0x34159c];return _0x28f809;};'use strict';var _=require(_0x4eaa('0x0'));var util=require(_0x4eaa('0x1'));var moment=require(_0x4eaa('0x2'));var BPromise=require(_0x4eaa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4eaa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eaa('0x5'))(_0x4eaa('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4eaa('0x7')][_0x4eaa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b55d,_0x50fa95,_0x21dec0){return new BPromise(function(_0x3e60e9,_0x53cc38){return client[_0x4eaa('0x9')](_0x29b55d,_0x21dec0)[_0x4eaa('0xa')](function(_0x142a79){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x50fa95,_0x4eaa('0xb'));logger[_0x4eaa('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x50fa95,_0x4eaa('0xb'),JSON[_0x4eaa('0xd')](_0x142a79));if(_0x142a79[_0x4eaa('0xe')]){if(_0x142a79[_0x4eaa('0xe')][_0x4eaa('0xf')]===0x1f4){logger[_0x4eaa('0xe')](_0x4eaa('0x10'),_0x50fa95,_0x142a79[_0x4eaa('0xe')][_0x4eaa('0x11')]);return _0x53cc38(_0x142a79[_0x4eaa('0xe')][_0x4eaa('0x11')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x50fa95,_0x142a79[_0x4eaa('0xe')][_0x4eaa('0x11')]);return _0x3e60e9(_0x142a79[_0x4eaa('0xe')]['message']);}else{logger[_0x4eaa('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x50fa95,_0x4eaa('0xb'));_0x3e60e9(_0x142a79[_0x4eaa('0x13')][_0x4eaa('0x11')]);}})[_0x4eaa('0x14')](function(_0x1cbf51){logger[_0x4eaa('0xe')](_0x4eaa('0x10'),_0x50fa95,_0x1cbf51);_0x53cc38(_0x1cbf51);});});} \ No newline at end of file +var _0xb101=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','stringify','error','message','ChatTransferReport,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis'];(function(_0xfac4f8,_0x16f091){var _0x4c2a2e=function(_0x44bb18){while(--_0x44bb18){_0xfac4f8['push'](_0xfac4f8['shift']());}};_0x4c2a2e(++_0x16f091);}(_0xb101,0x188));var _0x1b10=function(_0x195054,_0x38c4ba){_0x195054=_0x195054-0x0;var _0x65352f=_0xb101[_0x195054];return _0x65352f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1b10('0x0'));var BPromise=require(_0x1b10('0x1'));var rs=require(_0x1b10('0x2'));var fs=require('fs');var Redis=require(_0x1b10('0x3'));var db=require(_0x1b10('0x4'))['db'];var utils=require(_0x1b10('0x5'));var logger=require('../../config/logger')(_0x1b10('0x6'));var config=require(_0x1b10('0x7'));var jayson=require(_0x1b10('0x8'));var client=jayson['client'][_0x1b10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59b560,_0xfb586b,_0x48f6ef){return new BPromise(function(_0x2c0131,_0x4df364){return client[_0x1b10('0xa')](_0x59b560,_0x48f6ef)[_0x1b10('0xb')](function(_0x2b6336){logger[_0x1b10('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0xfb586b,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xfb586b,'request\x20sent',JSON[_0x1b10('0xd')](_0x2b6336));if(_0x2b6336[_0x1b10('0xe')]){if(_0x2b6336[_0x1b10('0xe')]['code']===0x1f4){logger[_0x1b10('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0xfb586b,_0x2b6336[_0x1b10('0xe')][_0x1b10('0xf')]);return _0x4df364(_0x2b6336['error']['message']);}logger[_0x1b10('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0xfb586b,_0x2b6336[_0x1b10('0xe')][_0x1b10('0xf')]);return _0x2c0131(_0x2b6336['error'][_0x1b10('0xf')]);}else{logger[_0x1b10('0xc')](_0x1b10('0x10'),_0xfb586b,'request\x20sent');_0x2c0131(_0x2b6336[_0x1b10('0x11')][_0x1b10('0xf')]);}})['catch'](function(_0x6dcbfa){logger['error'](_0x1b10('0x10'),_0xfb586b,_0x6dcbfa);_0x4df364(_0x6dcbfa);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 8bca68b..26009cb 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 _0x374b=['/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x374b,0x84));var _0xb374=function(_0x417c5b,_0x98b8ba){_0x417c5b=_0x417c5b-0x0;var _0x54e241=_0x374b[_0x417c5b];return _0x54e241;};'use strict';var multer=require(_0xb374('0x0'));var util=require(_0xb374('0x1'));var path=require(_0xb374('0x2'));var timeout=require(_0xb374('0x3'));var express=require(_0xb374('0x4'));var router=express[_0xb374('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb374('0x6'));var config=require('../../config/environment');var controller=require(_0xb374('0x7'));router[_0xb374('0x8')]('/',auth[_0xb374('0x9')](),controller['index']);router[_0xb374('0x8')](_0xb374('0xa'),auth[_0xb374('0x9')](),controller[_0xb374('0xb')]);router[_0xb374('0x8')](_0xb374('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb374('0xd')]('/',auth['isAuthenticated'](),controller[_0xb374('0xe')]);router[_0xb374('0xf')](_0xb374('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb374('0x10')](_0xb374('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb374('0x11')]=router; \ No newline at end of file +var _0xaaa1=['index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x41dec5,_0x32ac03){var _0x249717=function(_0x500f98){while(--_0x500f98){_0x41dec5['push'](_0x41dec5['shift']());}};_0x249717(++_0x32ac03);}(_0xaaa1,0x13f));var _0x1aaa=function(_0x317c5c,_0x5d2952){_0x317c5c=_0x317c5c-0x0;var _0x504506=_0xaaa1[_0x317c5c];return _0x504506;};'use strict';var multer=require(_0x1aaa('0x0'));var util=require(_0x1aaa('0x1'));var path=require(_0x1aaa('0x2'));var timeout=require('connect-timeout');var express=require(_0x1aaa('0x3'));var router=express[_0x1aaa('0x4')]();var fs_extra=require(_0x1aaa('0x5'));var auth=require(_0x1aaa('0x6'));var interaction=require(_0x1aaa('0x7'));var config=require(_0x1aaa('0x8'));var controller=require(_0x1aaa('0x9'));router[_0x1aaa('0xa')]('/',auth['isAuthenticated'](),controller[_0x1aaa('0xb')]);router['get'](_0x1aaa('0xc'),auth[_0x1aaa('0xd')](),controller[_0x1aaa('0xe')]);router[_0x1aaa('0xa')]('/:id',auth[_0x1aaa('0xd')](),controller[_0x1aaa('0xf')]);router[_0x1aaa('0x10')]('/',auth[_0x1aaa('0xd')](),controller[_0x1aaa('0x11')]);router[_0x1aaa('0x12')](_0x1aaa('0x13'),auth[_0x1aaa('0xd')](),controller[_0x1aaa('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1aaa('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 8a53a65..904861a 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 _0xb2e2=['mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','Feedback','star','stringify','input','name','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x30f3df,_0x214d7c){var _0x1c3aa2=function(_0x1fbbfc){while(--_0x1fbbfc){_0x30f3df['push'](_0x30f3df['shift']());}};_0x1c3aa2(++_0x214d7c);}(_0xb2e2,0x1a2));var _0x2b2e=function(_0x426e21,_0x5e7983){_0x426e21=_0x426e21-0x0;var _0x319df9=_0xb2e2[_0x426e21];return _0x319df9;};'use strict';var Sequelize=require(_0x2b2e('0x0'));var rs=require(_0x2b2e('0x1'));module[_0x2b2e('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x2b2e('0x3')],'allowNull':![],'unique':_0x2b2e('0x4')},'description':{'type':Sequelize[_0x2b2e('0x3')]},'mapKey':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x5')},'mapKeyOffline':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x5')},'key':{'type':Sequelize[_0x2b2e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2b2e('0x3')],'allowNull':![],'defaultValue':_0x2b2e('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2b2e('0x3')],'allowNull':![],'defaultValue':_0x2b2e('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x2b2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2b2e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2b2e('0x3')]},'animation':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2b2e('0x9')](_0x2b2e('0xa'),'squared'),'defaultValue':_0x2b2e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x2b2e('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x2b2e('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x2b2e('0xd')},'header_offline':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0xe')},'download_transcript':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2b2e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2b2e('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x2b2e('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x12')},'closingMessage':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0xd')},'skipMessageButton':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x13')},'conditionAgreement':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x14')},'ratingType':{'type':Sequelize[_0x2b2e('0x9')](_0x2b2e('0x15'),'thumb'),'defaultValue':_0x2b2e('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x2b2e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2b2e('0xf')],'defaultValue':function(){return JSON[_0x2b2e('0x16')]({'items':[{'type':_0x2b2e('0x17'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x2b2e('0x18'),'helpText':''}},{'type':'input','props':{'title':_0x2b2e('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x2b2e('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2b2e('0x19')]('onlineForm')?JSON[_0x2b2e('0x1a')](this[_0x2b2e('0x19')](_0x2b2e('0x1b'))):{};},'set':function(_0x36c0c9){return this[_0x2b2e('0x1c')](_0x2b2e('0x1b'),JSON[_0x2b2e('0x16')](_0x36c0c9));}},'offlineForm':{'type':Sequelize[_0x2b2e('0xf')],'defaultValue':function(){return JSON[_0x2b2e('0x16')]({'items':[{'type':_0x2b2e('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2b2e('0x5'),'type':_0x2b2e('0x5')},'variable':null},{'type':_0x2b2e('0x1d'),'config':{'placeholder':_0x2b2e('0x1e')},'props':{'title':_0x2b2e('0x1e'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x2b2e('0x1f'))?JSON[_0x2b2e('0x1a')](this[_0x2b2e('0x19')](_0x2b2e('0x1f'))):{};},'set':function(_0x44c5e7){return this[_0x2b2e('0x1c')](_0x2b2e('0x1f'),JSON[_0x2b2e('0x16')](_0x44c5e7));}},'token':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':function(){return rs[_0x2b2e('0x20')]();}},'autoclose':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2b2e('0x3')]},'forwardOffline':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2b2e('0x3')]},'waitingTitle':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x21')},'offlineMessageSubject':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x22')},'offlineMessageBody':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x24')},'skipUnmanaged':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x13')},'sendUnmanaged':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2b2e('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2b2e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2b2e('0xf')],'defaultValue':function(){return _0x2b2e('0x25');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2b2e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':_0x2b2e('0x27')},'verticalAlignment':{'type':Sequelize[_0x2b2e('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x2b2e('0x3')]},'customerAvatar':{'type':Sequelize[_0x2b2e('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2b2e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2b2e('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2b2e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2b2e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x2b2e('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2b2e('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x377cd5){if(!_0x377cd5)this[_0x2b2e('0x1c')](_0x2b2e('0x2a'),null);this['setDataValue'](_0x2b2e('0x2b'),_0x377cd5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2b2e('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2b2e('0x2c')},'vidaooNote':{'type':Sequelize[_0x2b2e('0x3')],'defaultValue':function(){return _0x2b2e('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x2b2e('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2b2e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2b2e('0xf')]}}; \ No newline at end of file +var _0x1b2c=['sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Skip','Feedback','star','thumb','TEXT','stringify','name','input','onlineForm','parse','getDataValue','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}'];(function(_0x19e00b,_0x16400c){var _0x533ce0=function(_0x2e2b22){while(--_0x2e2b22){_0x19e00b['push'](_0x19e00b['shift']());}};_0x533ce0(++_0x16400c);}(_0x1b2c,0x190));var _0xc1b2=function(_0x19085d,_0x5d8bc0){_0x19085d=_0x19085d-0x0;var _0xdb3f69=_0x1b2c[_0x19085d];return _0xdb3f69;};'use strict';var Sequelize=require(_0xc1b2('0x0'));var rs=require(_0xc1b2('0x1'));module[_0xc1b2('0x2')]={'name':{'type':Sequelize[_0xc1b2('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xc1b2('0x3')],'allowNull':![],'unique':_0xc1b2('0x4')},'description':{'type':Sequelize[_0xc1b2('0x3')]},'mapKey':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x5')},'mapKeyOffline':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xc1b2('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xc1b2('0x6')},'customerAlias':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc1b2('0x3')],'allowNull':![],'defaultValue':_0xc1b2('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc1b2('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc1b2('0x3')],'allowNull':![],'defaultValue':_0xc1b2('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc1b2('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc1b2('0x3')]},'animation':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc1b2('0xb')](_0xc1b2('0xc'),_0xc1b2('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xc1b2('0xe')},'start_chat_button':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0xf')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xc1b2('0x10')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xc1b2('0x11')},'download_transcript':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xc1b2('0x12')},'defaultWhiteLabel':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x15')},'placeholderMessage':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xc1b2('0x10')},'skipMessageButton':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x16')},'conditionAgreement':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x17')},'ratingType':{'type':Sequelize[_0xc1b2('0xb')](_0xc1b2('0x18'),_0xc1b2('0x19')),'defaultValue':_0xc1b2('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xc1b2('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc1b2('0x1a')],'defaultValue':function(){return JSON[_0xc1b2('0x1b')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xc1b2('0x1c'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xc1b2('0x1d'),'props':{'title':_0xc1b2('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xc1b2('0x5'),'type':_0xc1b2('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xc1b2('0x1e'))?JSON[_0xc1b2('0x1f')](this[_0xc1b2('0x20')](_0xc1b2('0x1e'))):{};},'set':function(_0x210781){return this[_0xc1b2('0x21')]('onlineForm',JSON[_0xc1b2('0x1b')](_0x210781));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xc1b2('0x1b')]({'items':[{'type':_0xc1b2('0x1d'),'props':{'title':_0xc1b2('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xc1b2('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xc1b2('0x22'),'helpText':_0xc1b2('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xc1b2('0x20')](_0xc1b2('0x24'))?JSON[_0xc1b2('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x295f68){return this[_0xc1b2('0x21')](_0xc1b2('0x24'),JSON['stringify'](_0x295f68));}},'token':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':function(){return rs[_0xc1b2('0x25')]();}},'autoclose':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc1b2('0x3')]},'forwardOffline':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc1b2('0x3')]},'waitingTitle':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x26')},'waitingMessage':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x29')},'skipUnmanaged':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xc1b2('0x10')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc1b2('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc1b2('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc1b2('0x1a')],'defaultValue':function(){return _0xc1b2('0x2a');}},'notificationSound':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1b2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xc1b2('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':_0xc1b2('0x2c')},'defaultTitle':{'type':Sequelize[_0xc1b2('0x3')]},'customerAvatar':{'type':Sequelize[_0xc1b2('0x1a')]},'showCustomerAvatar':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc1b2('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc1b2('0x3')],'allowNull':![],'defaultValue':_0xc1b2('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc1b2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc1b2('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xc1b2('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x198ab9){if(!_0x198ab9)this[_0xc1b2('0x21')](_0xc1b2('0x2e'),null);this[_0xc1b2('0x21')](_0xc1b2('0x2f'),_0x198ab9);}},'vidaooEscalation':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc1b2('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc1b2('0x30')},'vidaooNote':{'type':Sequelize[_0xc1b2('0x3')],'defaultValue':function(){return _0xc1b2('0x31');}},'vidaooMetadata':{'type':Sequelize[_0xc1b2('0x1a')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xc1b2('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc1b2('0x1a')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4e9dd8d..be38569 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 _0x5725=['no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','email','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','chatLicenseExceeded','push','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','remoteAddress','referer','replace','render','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','create','body','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ChatWebsiteId','Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','getLicense','custom','existsSync','server/files/images/logos/','download','isNil','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize'];(function(_0x9c32df,_0x533254){var _0x4edcc2=function(_0x53fc0a){while(--_0x53fc0a){_0x9c32df['push'](_0x9c32df['shift']());}};_0x4edcc2(++_0x533254);}(_0x5725,0x1d9));var _0x5572=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5725[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x5572('0x0'));var rimraf=require(_0x5572('0x1'));var zipdir=require(_0x5572('0x2'));var jsonpatch=require(_0x5572('0x3'));var rp=require('request-promise');var moment=require(_0x5572('0x4'));var BPromise=require(_0x5572('0x5'));var Mustache=require('mustache');var util=require(_0x5572('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5572('0x7'));var ejs=require(_0x5572('0x8'));var fs=require('fs');var fs_extra=require(_0x5572('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5572('0xa'));var deskjs=require(_0x5572('0xb'));var toCsv=require(_0x5572('0x7'));var querystring=require(_0x5572('0xc'));var Papa=require(_0x5572('0xd'));var Redis=require(_0x5572('0xe'));var authService=require(_0x5572('0xf'));var qs=require(_0x5572('0x10'));var as=require(_0x5572('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5572('0x12'))(_0x5572('0x13'));var utils=require(_0x5572('0x14'));var config=require(_0x5572('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5572('0x16')]=_[_0x5572('0x17')](config[_0x5572('0x16')],{'host':_0x5572('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5572('0x16')]));require(_0x5572('0x19'))['register'](socket);var jayson=require(_0x5572('0x1a'));var client=jayson[_0x5572('0x1b')][_0x5572('0x1c')]({'port':0x232c});var client9002=jayson[_0x5572('0x1b')][_0x5572('0x1c')]({'port':0x232a});var client9003=jayson[_0x5572('0x1b')][_0x5572('0x1c')]({'port':0x232b});var client9001=jayson[_0x5572('0x1b')]['http']({'port':0x2329});function respondWithRpcPromise(_0x153fc0,_0x465835,_0x1756bd,_0x417245){return new BPromise(function(_0x5c5686,_0x21e3c2){var _0x4cebbb=_0x417245||client;return _0x4cebbb['request'](_0x153fc0,_0x1756bd)['then'](function(_0x5c7465){logger[_0x5572('0x1d')](_0x5572('0x1e'),_0x465835,_0x5572('0x1f'));logger[_0x5572('0x20')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x465835,_0x5572('0x1f'),JSON[_0x5572('0x21')](_0x5c7465));if(_0x5c7465['error']){if(_0x5c7465['error'][_0x5572('0x22')]===0x1f4){logger[_0x5572('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x465835,_0x5c7465[_0x5572('0x23')]['message']);return _0x21e3c2(_0x5c7465[_0x5572('0x23')][_0x5572('0x24')]);}logger['error'](_0x5572('0x1e'),_0x465835,_0x5c7465['error'][_0x5572('0x24')]);return _0x5c5686(_0x5c7465[_0x5572('0x23')][_0x5572('0x24')]);}else{logger[_0x5572('0x1d')](_0x5572('0x1e'),_0x465835,_0x5572('0x1f'));_0x5c5686(_0x5c7465[_0x5572('0x25')][_0x5572('0x24')]);}})[_0x5572('0x26')](function(_0x492f76){logger[_0x5572('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x465835,_0x492f76);_0x21e3c2(_0x492f76);});});}function respondWithStatusCode(_0x205dea,_0x459a47){_0x459a47=_0x459a47||0xcc;return function(_0xfd264e){if(_0xfd264e){return _0x205dea['sendStatus'](_0x459a47);}return _0x205dea[_0x5572('0x27')](_0x459a47)[_0x5572('0x28')]();};}function respondWithResult(_0x1ad7ae,_0x5ded01){_0x5ded01=_0x5ded01||0xc8;return function(_0x441f8){if(_0x441f8){return _0x1ad7ae[_0x5572('0x27')](_0x5ded01)[_0x5572('0x29')](_0x441f8);}};}function respondWithFilteredResult(_0x1464c0,_0xdf0aa7){return function(_0x3e1e3f){if(_0x3e1e3f){var _0x3a57b3=typeof _0xdf0aa7[_0x5572('0x2a')]===_0x5572('0x2b')&&typeof _0xdf0aa7[_0x5572('0x2c')]===_0x5572('0x2b');var _0x255a65=_0x3e1e3f[_0x5572('0x2d')];var _0x21da23=_0x3a57b3?0x0:_0xdf0aa7[_0x5572('0x2a')];var _0x3fc4ce=_0x3a57b3?_0x3e1e3f[_0x5572('0x2d')]:_0xdf0aa7[_0x5572('0x2a')]+_0xdf0aa7[_0x5572('0x2c')];var _0x268d90;if(_0x3fc4ce>=_0x255a65){_0x3fc4ce=_0x255a65;_0x268d90=0xc8;}else{_0x268d90=0xce;}_0x1464c0['status'](_0x268d90);return _0x1464c0[_0x5572('0x2e')](_0x5572('0x2f'),_0x21da23+'-'+_0x3fc4ce+'/'+_0x255a65)[_0x5572('0x29')](_0x3e1e3f);}return null;};}function patchUpdates(_0xe4f55d){return function(_0x196ac1){try{jsonpatch[_0x5572('0x30')](_0x196ac1,_0xe4f55d,!![]);}catch(_0x259a8f){return BPromise['reject'](_0x259a8f);}return _0x196ac1['save']();};}function saveUpdates(_0x2d8a28,_0x5620c8){return function(_0x2df5aa){if(_0x2df5aa){return _0x2df5aa[_0x5572('0x31')](_0x2d8a28)[_0x5572('0x32')](function(_0x24cbbb){return _0x24cbbb;});}return null;};}function removeEntity(_0x56794b,_0x1af010){return function(_0x392856){if(_0x392856){return _0x392856[_0x5572('0x33')]()[_0x5572('0x32')](function(){var _0x553ece=_0x392856[_0x5572('0x34')]({'plain':!![]});var _0x577a4e=_0x5572('0x35');return db[_0x5572('0x36')][_0x5572('0x33')]({'where':{'type':_0x577a4e,'resourceId':_0x553ece['id']}})[_0x5572('0x32')](function(){return _0x392856;});})[_0x5572('0x32')](function(){_0x56794b[_0x5572('0x27')](0xcc)[_0x5572('0x28')]();});}};}function handleEntityNotFound(_0x4c3836,_0x292729){return function(_0x51398c){if(!_0x51398c){_0x4c3836[_0x5572('0x37')](0x194);}return _0x51398c;};}function handleError(_0x4930e9,_0x1d02d7){_0x1d02d7=_0x1d02d7||0x1f4;return function(_0x4486fd){logger[_0x5572('0x23')](_0x4486fd[_0x5572('0x38')]);if(_0x4486fd[_0x5572('0x39')]){delete _0x4486fd[_0x5572('0x39')];}_0x4930e9[_0x5572('0x27')](_0x1d02d7)[_0x5572('0x3a')](_0x4486fd);};}exports[_0x5572('0x3b')]=function(_0x3fb75c,_0x39cd8f){var _0x58670d={'include':[{'model':db[_0x5572('0x3c')],'as':_0x5572('0x3d')}]},_0x5d35b8={},_0x4e5c16={'count':0x0,'rows':[]};var _0x4ebb49=_[_0x5572('0x3e')](db[_0x5572('0x3f')][_0x5572('0x40')],function(_0x4cb732){return{'name':_0x4cb732[_0x5572('0x41')],'type':_0x4cb732['type'][_0x5572('0x42')]};});_0x5d35b8[_0x5572('0x43')]=_[_0x5572('0x3e')](_0x4ebb49,_0x5572('0x39'));_0x5d35b8[_0x5572('0x44')]=_['keys'](_0x3fb75c[_0x5572('0x44')]);_0x5d35b8[_0x5572('0x45')]=_[_0x5572('0x46')](_0x5d35b8['model'],_0x5d35b8[_0x5572('0x44')]);_0x58670d['attributes']=_[_0x5572('0x46')](_0x5d35b8[_0x5572('0x43')],qs[_0x5572('0x47')](_0x3fb75c[_0x5572('0x44')]['fields']));_0x58670d[_0x5572('0x48')]=_0x58670d[_0x5572('0x48')][_0x5572('0x49')]?_0x58670d[_0x5572('0x48')]:_0x5d35b8['model'];if(!_0x3fb75c[_0x5572('0x44')][_0x5572('0x4a')](_0x5572('0x4b'))){_0x58670d[_0x5572('0x2c')]=qs[_0x5572('0x2c')](_0x3fb75c[_0x5572('0x44')]['limit']);_0x58670d[_0x5572('0x2a')]=qs[_0x5572('0x2a')](_0x3fb75c[_0x5572('0x44')][_0x5572('0x2a')]);}_0x58670d[_0x5572('0x4c')]=qs[_0x5572('0x4d')](_0x3fb75c[_0x5572('0x44')][_0x5572('0x4d')]);_0x58670d[_0x5572('0x4e')]=qs[_0x5572('0x45')](_['pick'](_0x3fb75c[_0x5572('0x44')],_0x5d35b8[_0x5572('0x45')]),_0x4ebb49);if(_0x3fb75c[_0x5572('0x44')][_0x5572('0x4f')]){_0x58670d[_0x5572('0x4e')]=_[_0x5572('0x50')](_0x58670d[_0x5572('0x4e')],{'$or':_[_0x5572('0x3e')](_0x4ebb49,function(_0x16e80a){if(_0x16e80a[_0x5572('0x51')]!==_0x5572('0x52')){var _0x75f4a5={};_0x75f4a5[_0x16e80a['name']]={'$like':'%'+_0x3fb75c[_0x5572('0x44')][_0x5572('0x4f')]+'%'};return _0x75f4a5;}})});}_0x58670d=_[_0x5572('0x50')]({},_0x58670d,_0x3fb75c[_0x5572('0x53')]);var _0x3e938e={'where':_0x58670d[_0x5572('0x4e')]};return db[_0x5572('0x3f')][_0x5572('0x2d')](_0x3e938e)[_0x5572('0x32')](function(_0x487468){_0x4e5c16['count']=_0x487468;if(_0x3fb75c['query'][_0x5572('0x54')]){_0x58670d[_0x5572('0x55')]=[{'all':!![]}];}return db[_0x5572('0x3f')][_0x5572('0x56')](_0x58670d);})[_0x5572('0x32')](function(_0x234f2b){_0x4e5c16[_0x5572('0x57')]=_0x234f2b;return _0x4e5c16;})[_0x5572('0x32')](respondWithFilteredResult(_0x39cd8f,_0x58670d))[_0x5572('0x26')](handleError(_0x39cd8f,null));};exports[_0x5572('0x58')]=function(_0x4fe60a,_0x41fec1){var _0x595319={'raw':![],'where':{'id':_0x4fe60a['params']['id']},'include':[{'model':db[_0x5572('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4df5db={};_0x4df5db[_0x5572('0x43')]=_[_0x5572('0x59')](db[_0x5572('0x3f')][_0x5572('0x40')]);_0x4df5db['query']=_[_0x5572('0x59')](_0x4fe60a['query']);_0x4df5db[_0x5572('0x45')]=_[_0x5572('0x46')](_0x4df5db[_0x5572('0x43')],_0x4df5db['query']);_0x595319[_0x5572('0x48')]=_[_0x5572('0x46')](_0x4df5db[_0x5572('0x43')],qs['fields'](_0x4fe60a['query'][_0x5572('0x47')]));_0x595319['attributes']=_0x595319[_0x5572('0x48')][_0x5572('0x49')]?_0x595319[_0x5572('0x48')]:_0x4df5db[_0x5572('0x43')];if(_0x4fe60a[_0x5572('0x44')][_0x5572('0x54')]){_0x595319['include']=[{'all':!![]}];}_0x595319=_[_0x5572('0x50')]({},_0x595319,_0x4fe60a[_0x5572('0x53')]);return db[_0x5572('0x3f')]['find'](_0x595319)['then'](handleEntityNotFound(_0x41fec1,null))['then'](respondWithResult(_0x41fec1,null))['catch'](handleError(_0x41fec1,null));};exports[_0x5572('0x5a')]=function(_0x2e796c,_0x809c66){return db[_0x5572('0x3f')]['create'](_0x2e796c[_0x5572('0x5b')],{})[_0x5572('0x32')](function(_0x5e3372){var _0x5c29be=_0x2e796c[_0x5572('0x5c')][_0x5572('0x34')]({'plain':!![]});if(!_0x5c29be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c29be['role']===_0x5572('0x5c')){var _0x2dce01=_0x5e3372[_0x5572('0x34')]({'plain':!![]});var _0x37cb74='ChatWebsites';return db[_0x5572('0x5d')][_0x5572('0x5e')]({'where':{'name':_0x37cb74,'userProfileId':_0x5c29be['userProfileId']},'raw':!![]})[_0x5572('0x32')](function(_0x285c70){if(_0x285c70&&_0x285c70['autoAssociation']===0x0){return db[_0x5572('0x36')][_0x5572('0x5a')]({'name':_0x2dce01['name'],'resourceId':_0x2dce01['id'],'type':_0x285c70[_0x5572('0x39')],'sectionId':_0x285c70['id']},{})[_0x5572('0x32')](function(){return _0x5e3372;});}else{return _0x5e3372;}})[_0x5572('0x26')](function(_0x29f01d){logger[_0x5572('0x23')](_0x5572('0x5f'),_0x29f01d);throw _0x29f01d;});}return _0x5e3372;})[_0x5572('0x32')](respondWithResult(_0x809c66,0xc9))[_0x5572('0x26')](handleError(_0x809c66,null));};exports[_0x5572('0x31')]=function(_0x50451f,_0x441539){if(_0x50451f['body']['id']){delete _0x50451f[_0x5572('0x5b')]['id'];}return db[_0x5572('0x3f')][_0x5572('0x5e')]({'where':{'id':_0x50451f['params']['id']},'include':[{'model':db['Pause'],'as':_0x5572('0x3d')}]})[_0x5572('0x32')](handleEntityNotFound(_0x441539,null))[_0x5572('0x32')](saveUpdates(_0x50451f['body'],null))['then'](respondWithResult(_0x441539,null))[_0x5572('0x26')](handleError(_0x441539,null));};exports[_0x5572('0x33')]=function(_0x12be74,_0xde28c3){return db[_0x5572('0x3f')][_0x5572('0x5e')]({'where':{'id':_0x12be74[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0xde28c3,null))['then'](removeEntity(_0xde28c3,null))[_0x5572('0x26')](handleError(_0xde28c3,null));};exports[_0x5572('0x61')]=function(_0x1216d7,_0x49768d){return db[_0x5572('0x3f')][_0x5572('0x61')]()[_0x5572('0x32')](respondWithResult(_0x49768d,null))[_0x5572('0x26')](handleError(_0x49768d,null));};exports['addDisposition']=function(_0x5ae321,_0x3f7a21,_0x264ab2){if(_0x5ae321[_0x5572('0x5b')]['id']){delete _0x5ae321[_0x5572('0x5b')]['id'];}return db[_0x5572('0x3f')][_0x5572('0x5e')]({'where':{'id':_0x5ae321[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x3f7a21,null))[_0x5572('0x32')](function(_0x23784f){if(_0x23784f){_0x5ae321[_0x5572('0x5b')][_0x5572('0x62')]=_0x23784f['id'];return db[_0x5572('0x63')][_0x5572('0x5a')](_0x5ae321[_0x5572('0x5b')]);}})[_0x5572('0x32')](respondWithResult(_0x3f7a21,null))[_0x5572('0x26')](handleError(_0x3f7a21,null));};exports['getDispositions']=function(_0x2150b7,_0x486d85,_0x483364){var _0x3454e8={'raw':![],'where':{}};var _0x5d8064={};var _0x100995={'count':0x0,'rows':[]};return db[_0x5572('0x3f')]['findOne']({'where':{'id':_0x2150b7[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x486d85,null))[_0x5572('0x32')](function(_0x500d18){if(_0x500d18){_0x5d8064[_0x5572('0x43')]=_[_0x5572('0x59')](db[_0x5572('0x63')][_0x5572('0x40')]);_0x5d8064[_0x5572('0x44')]=_[_0x5572('0x59')](_0x2150b7['query']);_0x5d8064[_0x5572('0x45')]=_[_0x5572('0x46')](_0x5d8064[_0x5572('0x43')],_0x5d8064[_0x5572('0x44')]);_0x3454e8[_0x5572('0x48')]=_[_0x5572('0x46')](_0x5d8064['model'],qs[_0x5572('0x47')](_0x2150b7[_0x5572('0x44')]['fields']));_0x3454e8[_0x5572('0x48')]=_0x3454e8['attributes'][_0x5572('0x49')]?_0x3454e8['attributes']:_0x5d8064[_0x5572('0x43')];if(!_0x2150b7[_0x5572('0x44')][_0x5572('0x4a')]('nolimit')){_0x3454e8['limit']=qs[_0x5572('0x2c')](_0x2150b7['query'][_0x5572('0x2c')]);_0x3454e8[_0x5572('0x2a')]=qs[_0x5572('0x2a')](_0x2150b7[_0x5572('0x44')][_0x5572('0x2a')]);}_0x3454e8[_0x5572('0x4c')]=qs['sort'](_0x2150b7[_0x5572('0x44')]['sort']);_0x3454e8[_0x5572('0x4e')]=qs['filters'](_[_0x5572('0x64')](_0x2150b7['query'],_0x5d8064[_0x5572('0x45')]));_0x3454e8[_0x5572('0x4e')][_0x5572('0x62')]=_0x500d18['id'];if(_0x2150b7[_0x5572('0x44')][_0x5572('0x4f')]){_0x3454e8[_0x5572('0x4e')]=_['merge'](_0x3454e8['where'],{'$or':_[_0x5572('0x3e')](_0x3454e8[_0x5572('0x48')],function(_0x4298a6){var _0x3fa18b={};_0x3fa18b[_0x4298a6]={'$like':'%'+_0x2150b7[_0x5572('0x44')][_0x5572('0x4f')]+'%'};return _0x3fa18b;})});}_0x3454e8=_['merge']({},_0x3454e8,_0x2150b7[_0x5572('0x53')]);return db['Disposition'][_0x5572('0x2d')]({'where':_0x3454e8[_0x5572('0x4e')]})[_0x5572('0x32')](function(_0x25332e){_0x100995[_0x5572('0x2d')]=_0x25332e;if(_0x2150b7[_0x5572('0x44')]['includeAll']){_0x3454e8[_0x5572('0x55')]=[{'all':!![]}];}return db[_0x5572('0x63')][_0x5572('0x56')](_0x3454e8);})['then'](function(_0xe84beb){_0x100995[_0x5572('0x57')]=_0xe84beb;return _0x100995;});}})[_0x5572('0x32')](respondWithFilteredResult(_0x486d85,_0x3454e8))[_0x5572('0x26')](handleError(_0x486d85,null));};exports[_0x5572('0x65')]=function(_0x301c8d,_0x1a8fb5,_0x3ad785){return db[_0x5572('0x3f')][_0x5572('0x5e')]({'where':{'id':_0x301c8d['params']['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x1a8fb5,null))[_0x5572('0x32')](function(_0x2852b0){if(_0x2852b0){return _0x2852b0[_0x5572('0x65')](_0x301c8d[_0x5572('0x44')][_0x5572('0x66')]);}})[_0x5572('0x32')](respondWithStatusCode(_0x1a8fb5,null))[_0x5572('0x26')](handleError(_0x1a8fb5,null));};exports[_0x5572('0x67')]=function(_0x611e01,_0x20e9d8,_0x6f5a5c){if(_0x611e01[_0x5572('0x5b')]['id']){delete _0x611e01[_0x5572('0x5b')]['id'];}return db[_0x5572('0x3f')][_0x5572('0x5e')]({'where':{'id':_0x611e01[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x20e9d8,null))[_0x5572('0x32')](function(_0xdff796){if(_0xdff796){_0x611e01[_0x5572('0x5b')][_0x5572('0x62')]=_0xdff796['id'];return db[_0x5572('0x68')]['create'](_0x611e01[_0x5572('0x5b')]);}})[_0x5572('0x32')](respondWithResult(_0x20e9d8,null))[_0x5572('0x26')](handleError(_0x20e9d8,null));};exports[_0x5572('0x69')]=function(_0x18e1d4,_0x2f8ace,_0x41e1fa){var _0x5e41f2={'raw':![],'where':{}};var _0x2b76cd={};var _0x469b35={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x5572('0x6a')]({'where':{'id':_0x18e1d4[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x2f8ace,null))[_0x5572('0x32')](function(_0x9ce452){if(_0x9ce452){_0x2b76cd[_0x5572('0x43')]=_[_0x5572('0x59')](db[_0x5572('0x68')][_0x5572('0x40')]);_0x2b76cd[_0x5572('0x44')]=_['keys'](_0x18e1d4['query']);_0x2b76cd[_0x5572('0x45')]=_[_0x5572('0x46')](_0x2b76cd[_0x5572('0x43')],_0x2b76cd['query']);_0x5e41f2['attributes']=_[_0x5572('0x46')](_0x2b76cd[_0x5572('0x43')],qs[_0x5572('0x47')](_0x18e1d4[_0x5572('0x44')]['fields']));_0x5e41f2[_0x5572('0x48')]=_0x5e41f2['attributes']['length']?_0x5e41f2['attributes']:_0x2b76cd[_0x5572('0x43')];if(!_0x18e1d4['query'][_0x5572('0x4a')]('nolimit')){_0x5e41f2['limit']=qs[_0x5572('0x2c')](_0x18e1d4['query'][_0x5572('0x2c')]);_0x5e41f2['offset']=qs['offset'](_0x18e1d4['query'][_0x5572('0x2a')]);}_0x5e41f2[_0x5572('0x4c')]=qs[_0x5572('0x4d')](_0x18e1d4[_0x5572('0x44')][_0x5572('0x4d')]);_0x5e41f2[_0x5572('0x4e')]=qs[_0x5572('0x45')](_[_0x5572('0x64')](_0x18e1d4[_0x5572('0x44')],_0x2b76cd['filters']));_0x5e41f2[_0x5572('0x4e')][_0x5572('0x62')]=_0x9ce452['id'];if(_0x18e1d4[_0x5572('0x44')][_0x5572('0x4f')]){_0x5e41f2[_0x5572('0x4e')]=_[_0x5572('0x50')](_0x5e41f2[_0x5572('0x4e')],{'$or':_[_0x5572('0x3e')](_0x5e41f2[_0x5572('0x48')],function(_0x2e8e4f){var _0x3bb7e0={};_0x3bb7e0[_0x2e8e4f]={'$like':'%'+_0x18e1d4[_0x5572('0x44')][_0x5572('0x4f')]+'%'};return _0x3bb7e0;})});}_0x5e41f2=_[_0x5572('0x50')]({},_0x5e41f2,_0x18e1d4[_0x5572('0x53')]);return db[_0x5572('0x68')][_0x5572('0x2d')]({'where':_0x5e41f2[_0x5572('0x4e')]})['then'](function(_0x554add){_0x469b35[_0x5572('0x2d')]=_0x554add;if(_0x18e1d4['query'][_0x5572('0x54')]){_0x5e41f2[_0x5572('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5e41f2);})[_0x5572('0x32')](function(_0x4c961b){_0x469b35['rows']=_0x4c961b;return _0x469b35;});}})[_0x5572('0x32')](respondWithFilteredResult(_0x2f8ace,_0x5e41f2))[_0x5572('0x26')](handleError(_0x2f8ace,null));};exports[_0x5572('0x6b')]=function(_0x50e8f6,_0x5a8f04,_0x579c49){return db['ChatWebsite']['find']({'where':{'id':_0x50e8f6[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x5a8f04,null))[_0x5572('0x32')](function(_0x27ce53){if(_0x27ce53){return _0x27ce53['removeAnswers'](_0x50e8f6[_0x5572('0x44')][_0x5572('0x66')]);}})[_0x5572('0x32')](respondWithStatusCode(_0x5a8f04,null))[_0x5572('0x26')](handleError(_0x5a8f04,null));};exports[_0x5572('0x6c')]=function(_0x35b84a,_0x2dca00,_0x5b19bc){_0x35b84a[_0x5572('0x5b')][_0x5572('0x6d')]=_0x35b84a[_0x5572('0x6e')][_0x5572('0x6f')];return db[_0x5572('0x3f')]['find']({'where':{'id':_0x35b84a[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x2dca00,null))['then'](saveUpdates(_0x35b84a[_0x5572('0x5b')],null))[_0x5572('0x32')](respondWithResult(_0x2dca00,null))[_0x5572('0x26')](handleError(_0x2dca00,null));};exports[_0x5572('0x70')]=function(_0x4c6614,_0xfebe28,_0x4ac77c){_0x4c6614[_0x5572('0x5b')]['agentAvatar']=_0x4c6614[_0x5572('0x6e')][_0x5572('0x6f')];return db[_0x5572('0x3f')]['find']({'where':{'id':_0x4c6614[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0xfebe28,null))[_0x5572('0x32')](saveUpdates(_0x4c6614[_0x5572('0x5b')],null))[_0x5572('0x32')](respondWithResult(_0xfebe28,null))[_0x5572('0x26')](handleError(_0xfebe28,null));};exports[_0x5572('0x71')]=function(_0x741a16,_0x42b0b8,_0x4cb6c9){_0x741a16['body']['customerAvatar']=_0x741a16['file']['filename'];return db[_0x5572('0x3f')][_0x5572('0x5e')]({'where':{'id':_0x741a16[_0x5572('0x60')]['id']}})['then'](handleEntityNotFound(_0x42b0b8,null))[_0x5572('0x32')](saveUpdates(_0x741a16['body'],null))[_0x5572('0x32')](respondWithResult(_0x42b0b8,null))[_0x5572('0x26')](handleError(_0x42b0b8,null));};exports[_0x5572('0x72')]=function(_0x28e85c,_0xd86b02,_0x4feb50){_0x28e85c[_0x5572('0x5b')][_0x5572('0x73')]=_0x28e85c[_0x5572('0x6e')][_0x5572('0x6f')];return db[_0x5572('0x3f')]['find']({'where':{'id':_0x28e85c[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0xd86b02,null))['then'](saveUpdates(_0x28e85c[_0x5572('0x5b')],null))[_0x5572('0x32')](respondWithResult(_0xd86b02,null))[_0x5572('0x26')](handleError(_0xd86b02,null));};exports[_0x5572('0x74')]=function(_0x3f63c2,_0x1470ad,_0x35ecf5){var _0x4c72c8=path[_0x5572('0x75')](config[_0x5572('0x76')],'server/files/images/logos/default_logo.svg');var _0x308884={'where':{'id':_0x3f63c2[_0x5572('0x60')]['id']},'attributes':['id',_0x5572('0x6d')],'raw':!![]};var _0x26909d=![];return require('../../config/license/util')[_0x5572('0x77')]()[_0x5572('0x32')](function(_0x3e57dc){if(_0x3e57dc){_0x26909d=_0x3e57dc[_0x5572('0x78')];}})[_0x5572('0x32')](function(){return db['ChatWebsite'][_0x5572('0x5e')](_0x308884);})[_0x5572('0x32')](handleEntityNotFound(_0x1470ad,null))[_0x5572('0x32')](function(_0x496a61){if(_0x496a61){if(!_['isNil'](_0x496a61[_0x5572('0x6d')])){if(fs[_0x5572('0x79')](path[_0x5572('0x75')](config[_0x5572('0x76')],_0x5572('0x7a'),_0x496a61[_0x5572('0x6d')]))&&_0x26909d){_0x4c72c8=path['join'](config[_0x5572('0x76')],_0x5572('0x7a'),_0x496a61[_0x5572('0x6d')]);}}return _0x1470ad[_0x5572('0x7b')](_0x4c72c8);}})[_0x5572('0x26')](handleError(_0x1470ad,null));};exports['getAvatar']=function(_0x333164,_0x537dc0,_0x5d738c){var _0x37db52=path[_0x5572('0x75')](config[_0x5572('0x76')],'server/files/images/avatars/default_avatar.png');var _0x4c73cd={'where':{'id':_0x333164[_0x5572('0x60')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x4c73cd)['then'](handleEntityNotFound(_0x537dc0,null))['then'](function(_0xc66569){if(_0xc66569){if(!_[_0x5572('0x7c')](_0xc66569[_0x5572('0x7d')])){if(fs[_0x5572('0x79')](path[_0x5572('0x75')](config['root'],_0x5572('0x7e'),_0xc66569[_0x5572('0x7d')]))){_0x37db52=path[_0x5572('0x75')](config[_0x5572('0x76')],_0x5572('0x7e'),_0xc66569[_0x5572('0x7d')]);}}return _0x537dc0['download'](_0x37db52);}})[_0x5572('0x26')](handleError(_0x537dc0,null));};exports[_0x5572('0x7f')]=function(_0x225afe,_0x1268fe,_0x4f6671){var _0x52c7d7=path[_0x5572('0x75')](config[_0x5572('0x76')],_0x5572('0x80'));var _0x20f5c2={'where':{'id':_0x225afe[_0x5572('0x60')]['id']},'attributes':['id',_0x5572('0x81'),_0x5572('0x82')],'raw':!![]};return db[_0x5572('0x3f')][_0x5572('0x5e')](_0x20f5c2)['then'](handleEntityNotFound(_0x1268fe,null))[_0x5572('0x32')](function(_0x4d2a74){if(_0x4d2a74){if(!_[_0x5572('0x7c')](_0x4d2a74[_0x5572('0x81')])){if(fs[_0x5572('0x79')](path['join'](config[_0x5572('0x76')],'server/files/images/avatars/',_0x4d2a74[_0x5572('0x81')]))&&_0x4d2a74[_0x5572('0x82')]){_0x52c7d7=path[_0x5572('0x75')](config['root'],_0x5572('0x7e'),_0x4d2a74[_0x5572('0x81')]);}}return _0x1268fe[_0x5572('0x7b')](_0x52c7d7);}})[_0x5572('0x26')](handleError(_0x1268fe,null));};exports['getSystemAvatar']=function(_0x3cc987,_0x47320b,_0x14519b){var _0x32dd48=path[_0x5572('0x75')](config[_0x5572('0x76')],'server/files/images/avatars/system_avatar.png');var _0x29e60b={'where':{'id':_0x3cc987['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x5572('0x3f')][_0x5572('0x5e')](_0x29e60b)[_0x5572('0x32')](handleEntityNotFound(_0x47320b,null))['then'](function(_0x248057){if(_0x248057){if(!_[_0x5572('0x7c')](_0x248057['systemAvatar'])){if(fs[_0x5572('0x79')](path[_0x5572('0x75')](config['root'],_0x5572('0x7e'),_0x248057['systemAvatar']))){_0x32dd48=path['join'](config[_0x5572('0x76')],_0x5572('0x7e'),_0x248057[_0x5572('0x73')]);}}return _0x47320b[_0x5572('0x7b')](_0x32dd48);}})[_0x5572('0x26')](handleError(_0x47320b,null));};exports[_0x5572('0x83')]=function(_0x2377fa,_0x58d342,_0x5827c8){var _0xfb35fe=require(_0x5572('0x84'));var _0x2ead53=new _0xfb35fe();var _0x20aee5=_0x2ead53[_0x5572('0x85')](_0x2377fa[_0x5572('0x86')]['user-agent'])[_0x5572('0x87')]();var _0x17b40a={'body':_0x2377fa[_0x5572('0x5b')],'channel':_0x5572('0x88')};var _0xe96a7f=[];var _0x4e726d=[];var _0x251b75={};var _0x5a49d8=![];return db[_0x5572('0x89')][_0x5572('0x61')]()[_0x5572('0x32')](function(_0x2d29e8){if(!_0x2d29e8){throw new db[(_0x5572('0x8a'))]['ValidationError'](_0x5572('0x8b'));}_0xe96a7f=_[_0x5572('0x8c')](_['keys'](_0x2d29e8),[_0x5572('0x8d'),_0x5572('0x8e')]);_0x4e726d=_[_0x5572('0x8c')](_[_0x5572('0x59')](_0x2d29e8),[_0x5572('0x8d'),_0x5572('0x8e'),_0x5572('0x8f'),_0x5572('0x90')]);if(_0x2377fa['body']['id']){delete _0x2377fa[_0x5572('0x5b')]['id'];}if(_[_0x5572('0x7c')](_0x2377fa[_0x5572('0x5b')][_0x5572('0x91')])){throw new db[(_0x5572('0x8a'))][(_0x5572('0x92'))](_0x5572('0x93'));}if(_[_0x5572('0x7c')](_0x2377fa['body'][_0x5572('0x5b')])||_0x2377fa[_0x5572('0x5b')][_0x5572('0x5b')]===''){throw new db[(_0x5572('0x8a'))][(_0x5572('0x92'))](_0x5572('0x94'));}if(_[_0x5572('0x7c')](_0x2377fa['body'][_0x5572('0x95')])){throw new db[(_0x5572('0x8a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e726d);}if(!_[_0x5572('0x96')](_0x4e726d,_0x2377fa[_0x5572('0x5b')][_0x5572('0x95')])){throw new db[(_0x5572('0x8a'))]['ValidationError'](_0x5572('0x97')+_0x4e726d);}_0x251b75[_0x2377fa[_0x5572('0x5b')]['mapKey']]=_0x2377fa[_0x5572('0x5b')][_0x5572('0x91')];})[_0x5572('0x32')](function(){return db['ChatWebsite'][_0x5572('0x5e')]({'where':{'id':_0x2377fa[_0x5572('0x60')]['id']},'include':[{'model':db[_0x5572('0x98')],'as':_0x5572('0x99'),'include':[{'model':db[_0x5572('0x89')],'as':_0x5572('0x9a'),'where':_0x251b75,'limit':0x1,'order':[[_0x5572('0x8e'),_0x5572('0x9b')]]}]},{'model':db[_0x5572('0x9c')],'as':_0x5572('0x9d')}]});})[_0x5572('0x32')](handleEntityNotFound(_0x58d342,null))[_0x5572('0x32')](function(_0x275123){if(_0x275123&&_0x275123[_0x5572('0x99')]){_0x17b40a[_0x5572('0x9e')]=_0x275123;_0x17b40a[_0x5572('0x9f')]=_0x275123[_0x5572('0x9d')];_0x17b40a[_0x5572('0xa0')]=_0x275123[_0x5572('0x99')];_0x17b40a['applications']=_[_0x5572('0xa1')](_0x17b40a[_0x5572('0x9f')],[_0x5572('0xa2')],[_0x5572('0xa3')]);if(_0x17b40a['account'][_0x5572('0x9d')]){delete _0x17b40a['account'][_0x5572('0x9d')];}if(_0x17b40a[_0x5572('0x9e')][_0x5572('0x99')]&&_0x17b40a['account'][_0x5572('0x99')]['Contacts'][_0x5572('0x49')]){return _0x17b40a[_0x5572('0x9e')][_0x5572('0x99')][_0x5572('0x9a')][0x0];}var _0x395e22=_[_0x5572('0x17')](_0x2377fa[_0x5572('0x5b')],{'firstName':_0x2377fa['body']['from'],'ListId':_0x275123[_0x5572('0x90')]});_0x395e22[_0x2377fa['body']['mapKey']]=_0x2377fa[_0x5572('0x5b')][_0x5572('0x91')];return db[_0x5572('0x89')][_0x5572('0x5a')](_0x395e22,{'fields':_0xe96a7f,'raw':!![]});}})[_0x5572('0x32')](handleEntityNotFound(_0x58d342,null))[_0x5572('0x32')](function(_0x1cf92){_0x17b40a[_0x5572('0xa4')]=_0x1cf92;var _0x5c6d29=_0x2377fa[_0x5572('0x5b')][_0x5572('0xa5')];if(_0x2377fa[_0x5572('0x86')][_0x5572('0xa6')]){_0x5c6d29=_0x2377fa[_0x5572('0x86')]['cf-connecting-ip'];}else if(_0x2377fa[_0x5572('0x86')]['x-forwarded-for']){_0x5c6d29=_[_0x5572('0xa7')](_0x2377fa[_0x5572('0x86')][_0x5572('0xa8')][_0x5572('0xa9')](','));}if(_0x1cf92){var _0x4f154f={'ContactId':_0x1cf92['id'],'ChatWebsiteId':_0x2377fa['params']['id'],'from':(_0x1cf92[_0x5572('0xaa')]||'')+'\x20'+(_0x1cf92[_0x5572('0xab')]||''),'customerIp':_0x5c6d29,'customerPort':_0x2377fa[_0x5572('0x86')][_0x5572('0xac')]?_0x2377fa[_0x5572('0x86')][_0x5572('0xac')]:null,'referer':_0x2377fa[_0x5572('0x5b')]['referer'],'browserName':_0x20aee5[_0x5572('0xad')][_0x5572('0x39')]&&_0x20aee5['browser'][_0x5572('0xae')]?util[_0x5572('0xaf')]('%s\x20%s',_0x20aee5[_0x5572('0xad')]['name'],_0x20aee5[_0x5572('0xad')][_0x5572('0xae')]):_0x5572('0xb0'),'browserVersion':_0x20aee5[_0x5572('0xad')][_0x5572('0xae')]||_0x5572('0xb0'),'osName':util[_0x5572('0xaf')](_0x5572('0xb1'),_0x20aee5['os'][_0x5572('0x39')],_0x20aee5['os'][_0x5572('0xae')]),'osVersion':_0x20aee5['os'][_0x5572('0xae')],'deviceModel':_0x20aee5[_0x5572('0xb2')][_0x5572('0x43')]&&_0x20aee5['device'][_0x5572('0xb3')]?util[_0x5572('0xaf')]('%s\x20%s\x20%s',_0x20aee5[_0x5572('0xb2')][_0x5572('0x43')],_0x20aee5[_0x5572('0xb2')][_0x5572('0xb3')],_0x20aee5[_0x5572('0xb2')][_0x5572('0x51')]):null,'deviceVendor':_0x20aee5[_0x5572('0xb2')][_0x5572('0xb3')],'deviceType':_0x20aee5['device']['type'],'formData':JSON['stringify'](_0x2377fa[_0x5572('0x5b')])};var _0x76451a={'ChatWebsiteId':_0x2377fa[_0x5572('0x60')]['id'],'closed':![]};if(_0x2377fa[_0x5572('0x5b')][_0x5572('0xb4')]){_0x76451a[_0x5572('0xb4')]=_0x2377fa[_0x5572('0x5b')][_0x5572('0xb4')];return db[_0x5572('0xb5')]['find']({'where':_0x76451a})[_0x5572('0x32')](function(_0x280ada){if(_0x280ada){return[_0x280ada,![]];}_0x4f154f[_0x5572('0xb4')]=_0x2377fa[_0x5572('0x5b')][_0x5572('0xb4')];_0x4f154f[_0x5572('0xb6')]=_0x2377fa[_0x5572('0x5b')][_0x5572('0xb6')];return db['ChatInteraction'][_0x5572('0x5a')](_0x4f154f)[_0x5572('0x32')](function(_0xc94f74){return[_0xc94f74,!![]];});});}_0x76451a['ContactId']=_0x1cf92['id'];if(_0x2377fa[_0x5572('0x5b')][_0x5572('0xb7')]&&_0x2377fa[_0x5572('0x5b')][_0x5572('0xb7')]['id']){_0x76451a['id']=_0x2377fa[_0x5572('0x5b')][_0x5572('0xb7')]['id'];return db[_0x5572('0xb5')][_0x5572('0x5e')]({'where':_0x76451a})['then'](function(_0x1f240e){if(_0x1f240e){return[_0x1f240e,![]];}return db[_0x5572('0xb5')][_0x5572('0x5a')](_0x4f154f)[_0x5572('0x32')](function(_0x3b988c){return[_0x3b988c,!![]];});});}return db[_0x5572('0xb5')][_0x5572('0x5a')](_0x4f154f)[_0x5572('0x32')](function(_0x3a0326){return[_0x3a0326,!![]];});}})[_0x5572('0xb8')](function(_0x55a208,_0xfa92d8){if(_0x55a208){_0x5a49d8=_0xfa92d8;if(!_0xfa92d8){var _0x28773d={'from':(_0x17b40a[_0x5572('0xa4')]['firstName']||'')+'\x20'+(_0x17b40a[_0x5572('0xa4')][_0x5572('0xab')]||'')};if(_0x2377fa[_0x5572('0x5b')][_0x5572('0xb4')]&&_0x2377fa['body'][_0x5572('0xb9')]&&_0x2377fa[_0x5572('0x5b')]['threadId']!=_0x2377fa[_0x5572('0x5b')][_0x5572('0xb9')]){_0x28773d['threadId']=_0x2377fa[_0x5572('0x5b')][_0x5572('0xb9')];}return _0x55a208['update'](_0x28773d);}else{return _0x55a208;}}})[_0x5572('0x32')](function(_0x58390c){_0x17b40a['interaction']=_0x58390c[_0x5572('0x34')]({'plain':!![]});_0x17b40a[_0x5572('0xb7')][_0x5572('0xba')]=_0x5a49d8;if(_0x17b40a[_0x5572('0xb7')][_0x5572('0xba')]){if(_0x17b40a[_0x5572('0x9e')][_0x5572('0xbb')]){_0x17b40a['applications']['push']({'id':0x0,'priority':_0x17b40a['applications'][_0x5572('0x49')]+0x1,'app':_0x5572('0xbc'),'appdata':_0x5572('0xbd'),'interval':_0x5572('0xbe')});}}return db[_0x5572('0xbf')]['create']({'body':_0x2377fa[_0x5572('0x5b')][_0x5572('0x5b')],'ChatWebsiteId':_0x2377fa[_0x5572('0x60')]['id'],'ChatInteractionId':_0x58390c['id'],'direction':'in','ContactId':_0x17b40a['contact']['id'],'AttachmentId':_0x2377fa[_0x5572('0x5b')][_0x5572('0xc0')]});})[_0x5572('0x32')](function(_0x4b3907){_0x17b40a[_0x5572('0x24')]=_0x4b3907;if(_0x17b40a[_0x5572('0xb7')][_0x5572('0xc1')]){return db[_0x5572('0xc2')][_0x5572('0x5e')]({'attributes':['id',_0x5572('0x39')],'where':{'id':_0x17b40a[_0x5572('0xb7')]['UserId']}})[_0x5572('0x32')](function(_0x5ecc63){if(_0x5ecc63){_0x17b40a['applications'][_0x5572('0xc3')]({'id':0x0,'priority':0x0,'app':_0x5572('0xc4'),'appdata':_0x5ecc63[_0x5572('0x39')]+','+(_0x17b40a[_0x5572('0x9e')][_0x5572('0xc5')]||0xa),'interval':_0x5572('0xbe')});_0x17b40a['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x5572('0xc6'),_0x17b40a);});}return respondWithRpcPromise(_0x5572('0xc7'),_0x5572('0xc6'),_0x17b40a);})[_0x5572('0x32')](function(_0x4298c7){respondWithRpcPromise(_0x5572('0xc8'),_0x5572('0xc8'),{'event':'notify','message':_0x4298c7},client9002);return _0x4298c7;})['then'](respondWithResult(_0x58d342,null))[_0x5572('0x26')](handleError(_0x58d342,null));};exports[_0x5572('0xc9')]=function(_0x17b1b5,_0xb8b669,_0x514ba9){var _0x385518,_0x70acbb,_0x5b9e6f;var _0x195df8=[];var _0x4480d0=[];var _0x7d4daa={};var _0x3fca9d=_0x17b1b5[_0x5572('0xca')]||[];var _0x42d216=[];var _0x3a0b2f;return db[_0x5572('0x89')][_0x5572('0x61')]()['then'](function(_0x2712bb){if(!_0x2712bb){throw new db['Sequelize'][(_0x5572('0x92'))](_0x5572('0x8b'));}_0x4480d0=_[_0x5572('0x8c')](_[_0x5572('0x59')](_0x2712bb),[_0x5572('0x8d'),'updatedAt']);_0x195df8=_['difference'](_[_0x5572('0x59')](_0x2712bb),['createdAt',_0x5572('0x8e'),_0x5572('0x8f'),_0x5572('0x90')]);if(_0x17b1b5[_0x5572('0x5b')]['id']){delete _0x17b1b5['body']['id'];}if(_[_0x5572('0x7c')](_0x17b1b5[_0x5572('0x5b')]['from'])){throw _0xb8b669[_0x5572('0x27')](0x1f4)[_0x5572('0x3a')](new db[(_0x5572('0x8a'))][(_0x5572('0x92'))](_0x5572('0x93')));}if(_[_0x5572('0x7c')](_0x17b1b5[_0x5572('0x5b')][_0x5572('0x5b')])||_0x17b1b5[_0x5572('0x5b')][_0x5572('0x5b')]===''){throw _0xb8b669[_0x5572('0x27')](0x1f4)['send'](new db[(_0x5572('0x8a'))][(_0x5572('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x5572('0x7c')](_0x17b1b5[_0x5572('0x5b')][_0x5572('0xcb')])){throw _0xb8b669[_0x5572('0x27')](0x1f4)[_0x5572('0x3a')](new db[(_0x5572('0x8a'))][(_0x5572('0x92'))](_0x5572('0xcc')+_0x195df8));}if(!_[_0x5572('0x96')](_0x195df8,_0x17b1b5[_0x5572('0x5b')][_0x5572('0xcb')])){throw _0xb8b669[_0x5572('0x27')](0x1f4)[_0x5572('0x3a')](new db['Sequelize'][(_0x5572('0x92'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x195df8));}_0x7d4daa[_0x17b1b5[_0x5572('0x5b')][_0x5572('0xcb')]]=_0x17b1b5[_0x5572('0x5b')]['from'];})[_0x5572('0x32')](function(){return db[_0x5572('0x3f')][_0x5572('0x5e')]({'where':{'id':_0x17b1b5[_0x5572('0x60')]['id']},'include':[{'model':db[_0x5572('0x98')],'as':_0x5572('0x99')},{'model':db['MailAccount'],'as':_0x5572('0xcd')}]});})['then'](handleEntityNotFound(_0xb8b669,null))[_0x5572('0x32')](function(_0x20fff7){if(_0x20fff7&&_0x20fff7[_0x5572('0x99')]){_0x70acbb=_0x20fff7;var _0x3e2b4b=_['defaults'](_0x17b1b5[_0x5572('0x5b')],{'firstName':_0x17b1b5[_0x5572('0x5b')][_0x5572('0x91')],'phone':_0x17b1b5[_0x5572('0x5b')][_0x5572('0x91')],'ListId':_0x20fff7['ListId']});_0x3e2b4b[_0x17b1b5['body'][_0x5572('0xcb')]]=_0x17b1b5['body']['from'];return db['CmContact'][_0x5572('0xce')]({'where':_0x7d4daa,'defaults':_0x3e2b4b});}})[_0x5572('0xb8')](function(_0xb5f79e){if(_0xb5f79e){_0x5b9e6f=_0xb5f79e;var _0x581434=fs[_0x5572('0xcf')](path['join'](config[_0x5572('0x76')],'server/files/templates/chatOfflineMessage.ejs'),_0x5572('0xd0'));var _0x27899d=ejs['render'](_0x581434,{'body':_[_0x5572('0xd1')](_0x17b1b5[_0x5572('0x5b')][_0x5572('0x5b')]),'bodyTitle':_0x70acbb[_0x5572('0xd2')]});return db[_0x5572('0xd3')]['create']({'body':_0x27899d,'ContactId':_0xb5f79e['id'],'ChatWebsiteId':_0x70acbb['id']});}})[_0x5572('0x32')](function(_0x8cdf03){_0x3a0b2f=_0x8cdf03;if(_0x3fca9d[_0x5572('0x49')]){var _0x418771=_0x3fca9d['map'](function(_0x2a2dbf){return{'name':_0x2a2dbf[_0x5572('0xd4')],'basename':_0x2a2dbf['filename'],'type':_0x2a2dbf[_0x5572('0xd5')],'ChatOfflineMessageId':_0x8cdf03['id']};});_0x42d216=_0x418771[_0x5572('0x3e')](_0xa0a90=>{var _0x5e1f98={'filename':_0xa0a90[_0x5572('0x39')],'path':path[_0x5572('0x75')](config[_0x5572('0x76')],_0x5572('0xd6'),_0x5572('0xca'),_0x5572('0xd7'),'offline-chat',_0xa0a90[_0x5572('0xd8')])};return _0x5e1f98;});if(!_0x70acbb[_0x5572('0xd9')]){return db[_0x5572('0xda')]['transaction'](function(_0x4a7b4e){return db[_0x5572('0xdb')][_0x5572('0xdc')](_0x418771,{'transaction':_0x4a7b4e});});}}})['then'](function(){if(_0x3a0b2f){_0x385518=_0x3a0b2f;return db[_0x5572('0xcd')][_0x5572('0x6a')]({'where':{'active':!![]},'include':[{'model':db[_0x5572('0xdd')],'as':_0x5572('0xde'),'raw':!![]}]});}})[_0x5572('0x32')](function(_0x1c8e5f){if(_0x1c8e5f&&_0x1c8e5f[_0x5572('0xde')]&&_0x70acbb[_0x5572('0xdf')]&&_0x70acbb[_0x5572('0xe0')]){var _0x228d89={'tls':{'rejectUnauthorized':![]}};if(_0x1c8e5f['Smtp'][_0x5572('0xe1')]){_0x228d89['service']=_0x1c8e5f[_0x5572('0xde')][_0x5572('0xe1')];}else{_0x228d89[_0x5572('0xe2')]=_0x1c8e5f[_0x5572('0xde')][_0x5572('0xe2')];_0x228d89[_0x5572('0xe3')]=_0x1c8e5f[_0x5572('0xde')]['port'];_0x228d89[_0x5572('0xe4')]=_0x1c8e5f[_0x5572('0xde')][_0x5572('0xe4')];}if(_0x1c8e5f['Smtp'][_0x5572('0xe5')]){_0x228d89[_0x5572('0xe6')]={'user':_0x1c8e5f[_0x5572('0xde')][_0x5572('0x5c')],'pass':_0x1c8e5f[_0x5572('0xde')][_0x5572('0xe7')]};}return respondWithRpcPromise(_0x5572('0xe8'),_0x5572('0xe9'),{'account':_0x228d89,'message':{'from':util[_0x5572('0xaf')](_0x5572('0xea'),_0x1c8e5f[_0x5572('0x39')],_0x1c8e5f['email']||_0x1c8e5f[_0x5572('0xde')][_0x5572('0x5c')]),'to':_0x70acbb['forwardOfflineAddress'],'subject':_0x70acbb[_0x5572('0xeb')],'html':_0x385518[_0x5572('0x5b')],'attachments':_0x42d216}},client9003)[_0x5572('0x32')](function(){return _0x385518;})['catch'](function(_0x4237aa){console[_0x5572('0x23')](_0x4237aa);});}})[_0x5572('0x32')](function(){if(_0x70acbb&&_0x70acbb['openNewInteraction']&&_0x70acbb[_0x5572('0xec')]){var _0x2fed1d=[];if(_0x3fca9d[_0x5572('0x49')]){_0x2fed1d=_0x3fca9d[_0x5572('0x3e')](function(_0x4e1188){return{'name':_0x4e1188['originalname'],'basename':_0x4e1188[_0x5572('0x6f')],'type':_0x4e1188[_0x5572('0xd5')],'ChatOfflineMessageId':_0x3a0b2f['id']};});}var _0xc861b9;if(!_['isNil'](_0x70acbb[_0x5572('0xed')])){var _0x49aa81=_[_0x5572('0x3e')](_0x17b1b5['body'],function(_0x293abb){return _0x293abb;});var _0x5ef3cd=_['toPairsIn'](_0x49aa81)[0x0];var _0x4e1c5b=_['mapValues'](_0x5ef3cd,function(_0x30f799){return _0x30f799;});_0xc861b9=_0x4e1c5b[0x1][_0x70acbb[_0x5572('0xed')]];}var _0x3a3aae={'from':_0x5b9e6f[_0x5572('0xee')],'firstName':_0x5b9e6f[_0x5572('0xaa')],'lastName':_0x5b9e6f[_0x5572('0xab')],'mapKey':_0x5572('0xee'),'message':{'from':_0x5b9e6f[_0x5572('0xee')],'to':_0x70acbb['MailAccount'][_0x5572('0xee')],'cc':'','subject':_[_0x5572('0x7c')](_0xc861b9)?_0x70acbb[_0x5572('0xeb')]:_0xc861b9,'messageId':'','sentAt':new Date(),'attach':_0x2fed1d[_0x5572('0x49')],'attachments':_0x2fed1d,'originChannel':_0x5572('0xef'),'ChatWebsiteId':_0x70acbb['id'],'ChatOfflineMessageId':_0x385518['id'],'originTo':_0x70acbb['MailAccount']['email']},'body':_0x385518[_0x5572('0x5b')]};var _0x1bf3bc={'account':{'id':_0x70acbb[_0x5572('0xec')]},'body':_0x3a3aae,'log':_0x5572('0xf0')};return respondWithRpcPromise(_0x5572('0xf0'),_0x5572('0xf1'),_0x1bf3bc,client9001)[_0x5572('0x32')](function(){return _0x385518;})[_0x5572('0x26')](function(_0xb5141d){console[_0x5572('0x23')](_0xb5141d);});}return;})[_0x5572('0x32')](function(){if(_0x385518){return _0x385518;}})[_0x5572('0x32')](respondWithResult(_0xb8b669,null))[_0x5572('0x26')](function(_0x2f93be){console[_0x5572('0x23')](_0x5572('0x26'),_0x2f93be);for(var _0x165015 of _0x3fca9d){var _0x4f5b97=path[_0x5572('0x75')](config[_0x5572('0x76')],_0x5572('0xd6'),_0x5572('0xca'),_0x5572('0xd7'),_0x5572('0xf2'),_0x165015[_0x5572('0x6f')]);fs_extra[_0x5572('0xf3')](_0x4f5b97)['catch'](function(_0x5abd7c){console[_0x5572('0x23')](_0x5572('0xf4'),_0x4f5b97,_0x5abd7c);});}});};exports[_0x5572('0xf5')]=function(_0x2f13e2,_0x2507f8,_0x3781db){return db[_0x5572('0xb5')][_0x5572('0x5e')]({'where':{'id':_0x2f13e2['params']['id']}})['then'](handleEntityNotFound(_0x2507f8,null))[_0x5572('0x32')](function(_0x11b8b9){if(_0x11b8b9){return _0x11b8b9[_0x5572('0xf5')](_0x2f13e2[_0x5572('0x5b')][_0x5572('0x66')],_[_0x5572('0xf6')](_0x2f13e2[_0x5572('0x5b')],[_0x5572('0x66'),'id'])||{});}})[_0x5572('0x32')](respondWithResult(_0x2507f8,null))['catch'](handleError(_0x2507f8,null));};exports[_0x5572('0xf7')]=function(_0x20e285,_0x2ce143,_0x394cfd){var _0x269b34={'raw':![],'where':{}};var _0x3aa32b={};var _0x288a65={'count':0x0,'rows':[]};return db[_0x5572('0x3f')][_0x5572('0x6a')]({'where':{'id':_0x20e285[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x2ce143,null))[_0x5572('0x32')](function(_0x1f2c14){if(_0x1f2c14){_0x3aa32b[_0x5572('0x43')]=_[_0x5572('0x59')](db[_0x5572('0xb5')]['rawAttributes']);_0x3aa32b[_0x5572('0x44')]=_[_0x5572('0x59')](_0x20e285[_0x5572('0x44')]);_0x3aa32b[_0x5572('0x45')]=_['intersection'](_0x3aa32b['model'],_0x3aa32b[_0x5572('0x44')]);_0x269b34[_0x5572('0x48')]=_[_0x5572('0x46')](_0x3aa32b[_0x5572('0x43')],qs[_0x5572('0x47')](_0x20e285['query'][_0x5572('0x47')]));_0x269b34[_0x5572('0x48')]=_0x269b34[_0x5572('0x48')][_0x5572('0x49')]?_0x269b34['attributes']:_0x3aa32b['model'];if(!_0x20e285[_0x5572('0x44')]['hasOwnProperty'](_0x5572('0x4b'))){_0x269b34['limit']=qs['limit'](_0x20e285[_0x5572('0x44')][_0x5572('0x2c')]);_0x269b34['offset']=qs[_0x5572('0x2a')](_0x20e285[_0x5572('0x44')][_0x5572('0x2a')]);}_0x269b34[_0x5572('0x4c')]=qs[_0x5572('0x4d')](_0x20e285[_0x5572('0x44')][_0x5572('0x4d')]);_0x269b34['where']=qs[_0x5572('0x45')](_[_0x5572('0x64')](_0x20e285['query'],_0x3aa32b[_0x5572('0x45')]));_0x269b34[_0x5572('0x4e')][_0x5572('0x62')]=_0x1f2c14['id'];if(_0x20e285[_0x5572('0x44')][_0x5572('0x4f')]){_0x269b34[_0x5572('0x4e')]=_[_0x5572('0x50')](_0x269b34[_0x5572('0x4e')],{'$or':_[_0x5572('0x3e')](_0x269b34[_0x5572('0x48')],function(_0x2389e8){var _0x3ecd80={};_0x3ecd80[_0x2389e8]={'$like':'%'+_0x20e285[_0x5572('0x44')][_0x5572('0x4f')]+'%'};return _0x3ecd80;})});}_0x269b34=_[_0x5572('0x50')]({},_0x269b34,_0x20e285[_0x5572('0x53')]);return db[_0x5572('0xb5')][_0x5572('0x2d')]({'where':_0x269b34[_0x5572('0x4e')]})[_0x5572('0x32')](function(_0x4f18eb){_0x288a65[_0x5572('0x2d')]=_0x4f18eb;if(_0x20e285[_0x5572('0x44')]['includeAll']){_0x269b34['include']=[{'model':db[_0x5572('0x89')],'as':'Contact','required':![]},{'model':db[_0x5572('0xc2')],'as':_0x5572('0xf8'),'attributes':['name','fullname',_0x5572('0xf9')],'required':![]},{'model':db[_0x5572('0xfa')],'as':_0x5572('0xfb'),'attributes':['id',_0x5572('0x39'),_0x5572('0xfc')],'where':_0x20e285['query'][_0x5572('0xfd')]?{'id':_0x20e285[_0x5572('0x44')][_0x5572('0xfd')]}:undefined,'required':_0x20e285[_0x5572('0x44')][_0x5572('0xfd')]?!![]:![]}];}return db[_0x5572('0xb5')][_0x5572('0x56')](_0x269b34);})[_0x5572('0x32')](function(_0x5ad745){_0x288a65['rows']=_0x5ad745;return _0x288a65;});}})[_0x5572('0x32')](respondWithFilteredResult(_0x2ce143,_0x269b34))[_0x5572('0x26')](handleError(_0x2ce143,null));};function iftimePromise(_0x5b840e,_0x3105bd){return respondWithRpcPromise('Command',_0x5572('0xfe'),{'command':_0x3105bd[_0x5572('0xff')]?util[_0x5572('0xaf')](_0x5572('0x100'),_0x5b840e['interval'],_0x3105bd[_0x5572('0xff')]):util[_0x5572('0xaf')](_0x5572('0x101'),_0x5b840e['interval'])},client9002)[_0x5572('0x32')](function(_0x5c02a2){var _0x523b71=_0x5c02a2&&_0x5c02a2['indexOf'](_0x5572('0x102'))>=0x0?!![]:![];logger[_0x5572('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3105bd['id'],_0x5b840e['id'],_0x5b840e['interval'],_0x523b71?_0x5572('0x103'):'OFFLINE',_0x3105bd[_0x5572('0xff')]?_0x3105bd['timezone']:_0x5572('0x104'));return _0x523b71;})[_0x5572('0x26')](function(_0x39f992){logger[_0x5572('0x23')](_0x5572('0x105'),_0x3105bd['id'],_0x5b840e['id'],_0x5b840e[_0x5572('0x106')],util[_0x5572('0x107')](_0x39f992,{'showHidden':![],'depth':null}),_0x3105bd[_0x5572('0xff')]?_0x3105bd[_0x5572('0xff')]:_0x5572('0x104'));return![];});}exports[_0x5572('0xfe')]=function(_0x4a1d3f,_0x11b926,_0x1138b6){var _0x49bd89=0x0;var _0x174fe1=0x0;var _0x77817c=![];var _0x489b6e;var _0x527ea7;return db['ChatWebsite']['find']({'where':{'id':_0x4a1d3f[_0x5572('0x60')]['id']},'include':[{'model':db[_0x5572('0x108')],'as':_0x5572('0x108'),'include':[{'model':db[_0x5572('0x108')],'as':_0x5572('0x109'),'attributes':['id',_0x5572('0x106')],'raw':!![]}]}]})[_0x5572('0x32')](handleEntityNotFound(_0x11b926,null))['then'](function(_0x32d8f1){if(_0x32d8f1){_0x489b6e=_0x32d8f1;return _0x32d8f1[_0x5572('0x10a')]({'raw':!![]});}})[_0x5572('0x32')](function(_0x2a02ec){if(_0x489b6e){if(_0x2a02ec){_0x527ea7=_0x2a02ec;}}return require(_0x5572('0x10b'))[_0x5572('0x77')]();})['then'](function(_0x264749){if(_0x264749){_0x174fe1=_0x264749[_0x5572('0x10c')];_0x77817c=_0x264749[_0x5572('0x78')];}})['then'](function(){return db[_0x5572('0xb5')][_0x5572('0x2d')]({'where':{'closed':![]}});})['then'](function(_0xda97cc){_0x49bd89=_0xda97cc;if(_0x174fe1&&_0xda97cc>_0x174fe1){return db[_0x5572('0x10d')]['findOne']({'where':{'id':0x1}})[_0x5572('0x32')](function(_0x2f455f){if(_0x2f455f){_0x2f455f['increment'](_0x5572('0x10e'));}});}})[_0x5572('0x32')](function(){if(_0x489b6e['Interval']&&_0x489b6e[_0x5572('0x108')][_0x5572('0x109')]){var _0x5cf603=[];for(var _0xa7dc6c=0x0;_0xa7dc6c<_0x489b6e[_0x5572('0x108')][_0x5572('0x109')][_0x5572('0x49')];_0xa7dc6c++){var _0x2f0dc7=_0x489b6e[_0x5572('0x108')][_0x5572('0x109')][_0xa7dc6c][_0x5572('0x34')]({'plain':!![]});_0x5cf603[_0x5572('0x10f')](iftimePromise(_0x2f0dc7,_0x489b6e));}return BPromise[_0x5572('0x110')](_0x5cf603)[_0x5572('0x32')](function(_0x7b9c31){return _[_0x5572('0x111')](_0x7b9c31);});}else{return!![];}})[_0x5572('0x32')](function(_0x257795){var _0x2e02f3=fs[_0x5572('0xcf')](path[_0x5572('0x75')](config['root'],_0x5572('0x112')),_0x5572('0xd0'));var _0x5d27a4={'remote':_0x489b6e[_0x5572('0x113')],'query':querystring['stringify'](_[_0x5572('0x50')](_0x489b6e[_0x5572('0x34')]({'plain':!![]}),{'customerIp':_0x4a1d3f[_0x5572('0x86')][_0x5572('0xa8')]||_0x4a1d3f['headers'][_0x5572('0x114')]||_0x4a1d3f['connection'][_0x5572('0x115')]||_0x4a1d3f['ip'],'referer':_0x4a1d3f[_0x5572('0x86')][_0x5572('0x116')],'openedInteractions':_0x49bd89,'maxInteractions':_0x174fe1,'virtual':_0x77817c['virtual'],'online':_0x257795,'custom':_0x77817c}))[_0x5572('0x117')](/'/g,'\x5c\x27')};_0x11b926[_0x5572('0x3a')](ejs[_0x5572('0x118')](Mustache[_0x5572('0x118')](_0x2e02f3,_0x5d27a4),{'proactiveActions':_0x527ea7,'alignment':_0x489b6e[_0x5572('0x119')],'verticalAlignment':_0x489b6e[_0x5572('0x11a')],'div_color':_0x489b6e[_0x5572('0xfc')],'text_color':_0x489b6e[_0x5572('0x11b')],'button_color':_0x489b6e[_0x5572('0x11c')],'background_color':_0x489b6e[_0x5572('0x11d')]}));})[_0x5572('0x26')](handleError(_0x11b926,null));};exports[_0x5572('0x11e')]=function(_0x111538,_0x20b2e7,_0x246a0a){return db[_0x5572('0x3f')][_0x5572('0x6a')]({'where':{'id':_0x111538['params']['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x20b2e7,null))['then'](function(_0x35b1ad){if(_0x35b1ad){return db[_0x5572('0xda')][_0x5572('0x11f')](function(_0x401c9a){return db['ChatApplication'][_0x5572('0x33')]({'where':{'ChatWebsiteId':_0x111538['params']['id']},'transaction':_0x401c9a})[_0x5572('0x32')](function(_0x1f6196){var _0x1b6be0=_[_0x5572('0x3e')](_0x111538['body'],function(_0x3f55af){_0x3f55af[_0x5572('0x62')]=_0x111538[_0x5572('0x60')]['id'];return _0x3f55af;});return db['ChatApplication'][_0x5572('0xdc')](_0x1b6be0,{'transaction':_0x401c9a});});})[_0x5572('0x32')](function(){return db['ChatApplication'][_0x5572('0x120')]({'where':{'ChatWebsiteId':_0x111538[_0x5572('0x60')]['id']},'order':_0x5572('0xa2')});});}})[_0x5572('0x32')](respondWithResult(_0x20b2e7,null))['catch'](handleError(_0x20b2e7,null));};exports['getApplications']=function(_0x50feda,_0xb28511,_0x4f85e9){var _0x38dcaf={};var _0x2746f7={};var _0x165e18;var _0x39e8c2;return db[_0x5572('0x3f')][_0x5572('0x6a')]({'where':{'id':_0x50feda['params']['id']}})[_0x5572('0x32')](handleEntityNotFound(_0xb28511,null))[_0x5572('0x32')](function(_0x503c7e){if(_0x503c7e){_0x165e18=_0x503c7e;_0x2746f7[_0x5572('0x43')]=_[_0x5572('0x59')](db[_0x5572('0x9c')]['rawAttributes']);_0x2746f7['query']=_[_0x5572('0x59')](_0x50feda[_0x5572('0x44')]);_0x2746f7['filters']=_['intersection'](_0x2746f7[_0x5572('0x43')],_0x2746f7[_0x5572('0x44')]);_0x38dcaf[_0x5572('0x48')]=_[_0x5572('0x46')](_0x2746f7[_0x5572('0x43')],qs[_0x5572('0x47')](_0x50feda[_0x5572('0x44')][_0x5572('0x47')]));_0x38dcaf['attributes']=_0x38dcaf['attributes'][_0x5572('0x49')]?_0x38dcaf[_0x5572('0x48')]:_0x2746f7[_0x5572('0x43')];_0x38dcaf[_0x5572('0x4c')]=qs[_0x5572('0x4d')](_0x50feda[_0x5572('0x44')][_0x5572('0x4d')]);_0x38dcaf[_0x5572('0x4e')]=qs['filters'](_['pick'](_0x50feda['query'],_0x2746f7[_0x5572('0x45')]));if(_0x50feda[_0x5572('0x44')][_0x5572('0x4f')]){_0x38dcaf[_0x5572('0x4e')]=_[_0x5572('0x50')](_0x38dcaf['where'],{'$or':_['map'](_0x38dcaf['attributes'],function(_0x3cc96d){var _0x12031={};_0x12031[_0x3cc96d]={'$like':'%'+_0x50feda[_0x5572('0x44')][_0x5572('0x4f')]+'%'};return _0x12031;})});}_0x38dcaf=_[_0x5572('0x50')]({},_0x38dcaf,_0x50feda['options']);return _0x165e18['getApplications'](_0x38dcaf);}})['then'](function(_0x165f28){if(_0x165f28){_0x39e8c2=_0x165f28['length'];if(!_0x50feda[_0x5572('0x44')]['hasOwnProperty']('nolimit')){_0x38dcaf[_0x5572('0x2c')]=qs[_0x5572('0x2c')](_0x50feda['query'][_0x5572('0x2c')]);_0x38dcaf[_0x5572('0x2a')]=qs[_0x5572('0x2a')](_0x50feda['query']['offset']);}return _0x165e18[_0x5572('0x121')](_0x38dcaf);}})[_0x5572('0x32')](function(_0x2cc4b8){if(_0x2cc4b8){return _0x2cc4b8?{'count':_0x39e8c2,'rows':_0x2cc4b8}:null;}})[_0x5572('0x32')](respondWithResult(_0xb28511,null))[_0x5572('0x26')](handleError(_0xb28511,null));};exports[_0x5572('0x122')]=function(_0x535999,_0x29da52,_0x4e22f4){return db[_0x5572('0x123')]['find']({'where':{'id':_0x535999[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x29da52,null))[_0x5572('0x32')](function(_0x1c3186){if(_0x1c3186){return _0x1c3186[_0x5572('0x122')](_0x535999[_0x5572('0x5b')][_0x5572('0x66')],_[_0x5572('0xf6')](_0x535999[_0x5572('0x5b')],[_0x5572('0x66'),'id'])||{});}})[_0x5572('0x32')](respondWithResult(_0x29da52,null))[_0x5572('0x26')](handleError(_0x29da52,null));};exports[_0x5572('0x10a')]=function(_0x74e540,_0x37df3a,_0x236cb5){var _0x5adfe1={};var _0x4284ba={};var _0x150768;var _0x1a7900;return db[_0x5572('0x3f')]['findOne']({'where':{'id':_0x74e540[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x37df3a,null))[_0x5572('0x32')](function(_0x2c47a7){if(_0x2c47a7){_0x150768=_0x2c47a7;_0x4284ba[_0x5572('0x43')]=_[_0x5572('0x59')](db['ChatProactiveAction'][_0x5572('0x40')]);_0x4284ba['query']=_['keys'](_0x74e540[_0x5572('0x44')]);_0x4284ba['filters']=_[_0x5572('0x46')](_0x4284ba[_0x5572('0x43')],_0x4284ba[_0x5572('0x44')]);_0x5adfe1[_0x5572('0x48')]=_[_0x5572('0x46')](_0x4284ba['model'],qs['fields'](_0x74e540['query'][_0x5572('0x47')]));_0x5adfe1[_0x5572('0x48')]=_0x5adfe1[_0x5572('0x48')][_0x5572('0x49')]?_0x5adfe1[_0x5572('0x48')]:_0x4284ba['model'];_0x5adfe1['order']=qs[_0x5572('0x4d')](_0x74e540[_0x5572('0x44')][_0x5572('0x4d')]);_0x5adfe1['where']=qs[_0x5572('0x45')](_[_0x5572('0x64')](_0x74e540[_0x5572('0x44')],_0x4284ba['filters']));if(_0x74e540[_0x5572('0x44')][_0x5572('0x4f')]){_0x5adfe1[_0x5572('0x4e')]=_[_0x5572('0x50')](_0x5adfe1[_0x5572('0x4e')],{'$or':_[_0x5572('0x3e')](_0x5adfe1[_0x5572('0x48')],function(_0x256966){var _0x2046cc={};_0x2046cc[_0x256966]={'$like':'%'+_0x74e540[_0x5572('0x44')]['filter']+'%'};return _0x2046cc;})});}_0x5adfe1=_[_0x5572('0x50')]({},_0x5adfe1,_0x74e540[_0x5572('0x53')]);return _0x150768['getProactiveActions'](_0x5adfe1);}})['then'](function(_0x407c13){if(_0x407c13){_0x1a7900=_0x407c13[_0x5572('0x49')];if(!_0x74e540[_0x5572('0x44')][_0x5572('0x4a')](_0x5572('0x4b'))){_0x5adfe1['limit']=qs['limit'](_0x74e540[_0x5572('0x44')]['limit']);_0x5adfe1[_0x5572('0x2a')]=qs[_0x5572('0x2a')](_0x74e540['query'][_0x5572('0x2a')]);}return _0x150768[_0x5572('0x10a')](_0x5adfe1);}})[_0x5572('0x32')](function(_0x5ae781){if(_0x5ae781){return _0x5ae781?{'count':_0x1a7900,'rows':_0x5ae781}:null;}})[_0x5572('0x32')](respondWithResult(_0x37df3a,null))[_0x5572('0x26')](handleError(_0x37df3a,null));};exports[_0x5572('0x124')]=function(_0x436276,_0x509cf3,_0xc71fe1){var _0x543072=_0x436276['query'][_0x5572('0x125')]===_0x5572('0x126')?_0x5572('0x127'):'onlineForm';return db['ChatWebsite'][_0x5572('0x5e')]({'attributes':['id',_0x543072],'where':{'id':_0x436276[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x509cf3,null))[_0x5572('0x32')](function(_0x218602){if(_0x218602){var _0x4e1c62=_0x218602[_0x543072];var _0x9d58bb=_0x4e1c62&&_0x4e1c62[_0x5572('0x128')]?_0x4e1c62[_0x5572('0x128')]:[];_0x509cf3[_0x5572('0x3a')]({'fromKey':_[_0x5572('0x7c')](_0x4e1c62[_0x5572('0x129')])?undefined:_0x4e1c62['fromKey'],'count':_0x9d58bb['length'],'rows':_0x9d58bb});}})[_0x5572('0x26')](handleError(_0x509cf3,null));};exports[_0x5572('0x12a')]=function(_0x4cf87a,_0x20605d,_0x8eb893){var _0x5256df={'raw':![],'where':{}};var _0x29ce9f={};var _0x100729={'count':0x0,'rows':[]};return db[_0x5572('0x3f')][_0x5572('0x6a')]({'where':{'id':_0x4cf87a[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x20605d,null))[_0x5572('0x32')](function(_0x34a35a){if(_0x34a35a){_0x29ce9f['model']=_['keys'](db[_0x5572('0xd3')][_0x5572('0x40')]);_0x29ce9f['query']=_[_0x5572('0x59')](_0x4cf87a['query']);_0x29ce9f[_0x5572('0x45')]=_[_0x5572('0x46')](_0x29ce9f[_0x5572('0x43')],_0x29ce9f[_0x5572('0x44')]);_0x5256df[_0x5572('0x48')]=_[_0x5572('0x46')](_0x29ce9f[_0x5572('0x43')],qs[_0x5572('0x47')](_0x4cf87a[_0x5572('0x44')][_0x5572('0x47')]));_0x5256df[_0x5572('0x48')]=_0x5256df['attributes'][_0x5572('0x49')]?_0x5256df[_0x5572('0x48')]:_0x29ce9f['model'];if(!_0x4cf87a[_0x5572('0x44')]['hasOwnProperty']('nolimit')){_0x5256df[_0x5572('0x2c')]=qs[_0x5572('0x2c')](_0x4cf87a[_0x5572('0x44')][_0x5572('0x2c')]);_0x5256df[_0x5572('0x2a')]=qs[_0x5572('0x2a')](_0x4cf87a['query'][_0x5572('0x2a')]);}_0x5256df[_0x5572('0x4c')]=qs[_0x5572('0x4d')](_0x4cf87a[_0x5572('0x44')][_0x5572('0x4d')]);_0x5256df[_0x5572('0x4e')]=qs[_0x5572('0x45')](_['pick'](_0x4cf87a['query'],_0x29ce9f[_0x5572('0x45')]));_0x5256df[_0x5572('0x4e')]['ChatWebsiteId']=_0x34a35a['id'];if(_0x4cf87a[_0x5572('0x44')][_0x5572('0x4f')]){_0x5256df[_0x5572('0x4e')]=_[_0x5572('0x50')](_0x5256df['where'],{'$or':_[_0x5572('0x3e')](_0x5256df[_0x5572('0x48')],function(_0x432e44){var _0x33dea2={};_0x33dea2[_0x432e44]={'$like':'%'+_0x4cf87a[_0x5572('0x44')][_0x5572('0x4f')]+'%'};return _0x33dea2;})});}_0x5256df=_[_0x5572('0x50')]({},_0x5256df,_0x4cf87a['options']);return db['ChatOfflineMessage'][_0x5572('0x2d')]({'where':_0x5256df['where']})[_0x5572('0x32')](function(_0x2d249c){_0x100729[_0x5572('0x2d')]=_0x2d249c;if(_0x4cf87a[_0x5572('0x44')][_0x5572('0x54')]){_0x5256df['include']=[{'all':!![]}];}else{_0x5256df['include']=[{'model':db[_0x5572('0x89')],'as':_0x5572('0x12b'),'required':![]},{'model':db[_0x5572('0xdb')],'as':'Attachments','required':![]}];}return db[_0x5572('0xd3')][_0x5572('0x56')](_0x5256df);})[_0x5572('0x32')](function(_0x14abfc){_0x100729[_0x5572('0x57')]=_0x14abfc;return _0x100729;});}})[_0x5572('0x32')](respondWithFilteredResult(_0x20605d,_0x5256df))['catch'](handleError(_0x20605d,null));};exports[_0x5572('0x12c')]=function(_0x305106,_0x4c8d26,_0x11aed8){return db[_0x5572('0x3f')][_0x5572('0x5e')]({'where':{'id':_0x305106['params']['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x4c8d26,null))[_0x5572('0x32')](function(_0x1eee02){if(_0x1eee02){return _0x1eee02[_0x5572('0x12c')](_0x305106[_0x5572('0x5b')][_0x5572('0x66')],_[_0x5572('0xf6')](_0x305106[_0x5572('0x5b')],[_0x5572('0x66'),'id'])||{})[_0x5572('0xb8')](function(_0x4bdd50){for(var _0x5c5875=0x0;_0x5c5875<_0x305106[_0x5572('0x5b')][_0x5572('0x66')]['length'];_0x5c5875+=0x1){socket[_0x5572('0x12d')](_0x5572('0x12e'),{'UserId':Number(_0x305106['body'][_0x5572('0x66')][_0x5c5875]),'ChatWebsiteId':Number(_0x305106[_0x5572('0x60')]['id'])});}return _0x4bdd50;});}})[_0x5572('0x32')](respondWithResult(_0x4c8d26,null))['catch'](handleError(_0x4c8d26,null));};exports[_0x5572('0x12f')]=function(_0x3c53e8,_0x3f1683,_0xc72fe8){return db[_0x5572('0x3f')]['find']({'where':{'id':_0x3c53e8['params']['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x3f1683,null))[_0x5572('0x32')](function(_0x357357){if(_0x357357){return _0x357357['removeAgents'](_0x3c53e8[_0x5572('0x44')]['ids'])['then'](function(){if(_['isArray'](_0x3c53e8['query']['ids'])){for(var _0x4369da=0x0;_0x4369da<_0x3c53e8[_0x5572('0x44')][_0x5572('0x66')][_0x5572('0x49')];_0x4369da+=0x1){socket[_0x5572('0x12d')]('userChatWebsite:remove',{'UserId':Number(_0x3c53e8['query'][_0x5572('0x66')][_0x4369da]),'ChatWebsiteId':Number(_0x3c53e8[_0x5572('0x60')]['id'])});}}else{socket['emit'](_0x5572('0x130'),{'UserId':Number(_0x3c53e8[_0x5572('0x44')][_0x5572('0x66')]),'ChatWebsiteId':Number(_0x3c53e8[_0x5572('0x60')]['id'])});}});}})[_0x5572('0x32')](respondWithStatusCode(_0x3f1683,null))[_0x5572('0x26')](handleError(_0x3f1683,null));};exports['getAgents']=function(_0x568f0c,_0x185939,_0x548e36){var _0xd6814b={};var _0xd7d7aa={};var _0x25fd17;var _0x4d39d6;return db[_0x5572('0x3f')][_0x5572('0x6a')]({'where':{'id':_0x568f0c[_0x5572('0x60')]['id']}})[_0x5572('0x32')](handleEntityNotFound(_0x185939,null))[_0x5572('0x32')](function(_0x134d69){if(_0x134d69){_0x25fd17=_0x134d69;_0xd7d7aa[_0x5572('0x43')]=_[_0x5572('0x59')](db['User'][_0x5572('0x40')]);_0xd7d7aa[_0x5572('0x44')]=_['keys'](_0x568f0c['query']);_0xd7d7aa[_0x5572('0x45')]=_['intersection'](_0xd7d7aa[_0x5572('0x43')],_0xd7d7aa['query']);_0xd6814b[_0x5572('0x48')]=_[_0x5572('0x46')](_0xd7d7aa[_0x5572('0x43')],qs[_0x5572('0x47')](_0x568f0c[_0x5572('0x44')][_0x5572('0x47')]));_0xd6814b[_0x5572('0x48')]=_0xd6814b[_0x5572('0x48')]['length']?_0xd6814b[_0x5572('0x48')]:_0xd7d7aa[_0x5572('0x43')];_0xd6814b[_0x5572('0x4c')]=qs[_0x5572('0x4d')](_0x568f0c[_0x5572('0x44')][_0x5572('0x4d')]);_0xd6814b['where']=qs[_0x5572('0x45')](_[_0x5572('0x64')](_0x568f0c[_0x5572('0x44')],_0xd7d7aa['filters']));if(_0x568f0c[_0x5572('0x44')][_0x5572('0x4f')]){_0xd6814b['where']=_['merge'](_0xd6814b['where'],{'$or':_[_0x5572('0x3e')](_0xd6814b[_0x5572('0x48')],function(_0x400ae1){var _0x4e6c28={};_0x4e6c28[_0x400ae1]={'$like':'%'+_0x568f0c[_0x5572('0x44')][_0x5572('0x4f')]+'%'};return _0x4e6c28;})});}_0xd6814b=_[_0x5572('0x50')]({},_0xd6814b,_0x568f0c[_0x5572('0x53')]);return _0x25fd17[_0x5572('0x131')](_0xd6814b);}})[_0x5572('0x32')](function(_0x589b41){if(_0x589b41){_0x4d39d6=_0x589b41[_0x5572('0x49')];if(!_0x568f0c['query'][_0x5572('0x4a')](_0x5572('0x4b'))){_0xd6814b[_0x5572('0x2c')]=qs[_0x5572('0x2c')](_0x568f0c[_0x5572('0x44')][_0x5572('0x2c')]);_0xd6814b[_0x5572('0x2a')]=qs['offset'](_0x568f0c[_0x5572('0x44')][_0x5572('0x2a')]);}return _0x25fd17[_0x5572('0x131')](_0xd6814b);}})[_0x5572('0x32')](function(_0x1ebafe){if(_0x1ebafe){return _0x1ebafe?{'count':_0x4d39d6,'rows':_0x1ebafe}:null;}})[_0x5572('0x32')](respondWithResult(_0x185939,null))['catch'](handleError(_0x185939,null));}; \ No newline at end of file +var _0x6e9f=['referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList','MailAccount','readFileSync','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','internal','Tag','Tags','tag','Command','iftime\x20%s,%s','timezone','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','virtual','License','increment','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','connection','remoteAddress','replace','alignment','textColor','color_button','addApplications','transaction','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','ChatWebsites','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ChatWebsite','findAll','rows','show','params','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','addDisposition','Disposition','findOne','includeAll','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','addAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','getLicense','isNil','existsSync','join','server/files/images/logos/','getAvatar','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','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','List','DESC','ChatApplication','Applications','applications','orderBy','priority','asc','account','Contacts','ListId','contact','x-forwarded-for','split','firstName','lastName','x-real-port'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6e9f,0x1ac));var _0xf6e9=function(_0x9d520b,_0x5dc955){_0x9d520b=_0x9d520b-0x0;var _0x119126=_0x6e9f[_0x9d520b];return _0x119126;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6e9('0x0'));var zipdir=require(_0xf6e9('0x1'));var jsonpatch=require(_0xf6e9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6e9('0x3'));var Mustache=require(_0xf6e9('0x4'));var util=require(_0xf6e9('0x5'));var path=require('path');var sox=require(_0xf6e9('0x6'));var csv=require('to-csv');var ejs=require(_0xf6e9('0x7'));var fs=require('fs');var fs_extra=require(_0xf6e9('0x8'));var _=require(_0xf6e9('0x9'));var squel=require('squel');var crypto=require(_0xf6e9('0xa'));var jsforce=require(_0xf6e9('0xb'));var deskjs=require(_0xf6e9('0xc'));var toCsv=require(_0xf6e9('0xd'));var querystring=require(_0xf6e9('0xe'));var Papa=require(_0xf6e9('0xf'));var Redis=require(_0xf6e9('0x10'));var authService=require(_0xf6e9('0x11'));var qs=require(_0xf6e9('0x12'));var as=require(_0xf6e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf6e9('0x14'));var utils=require(_0xf6e9('0x15'));var config=require(_0xf6e9('0x16'));var licenseUtil=require(_0xf6e9('0x17'));var db=require(_0xf6e9('0x18'))['db'];config[_0xf6e9('0x19')]=_[_0xf6e9('0x1a')](config['redis'],{'host':_0xf6e9('0x1b'),'port':0x18eb});var socket=require(_0xf6e9('0x1c'))(new Redis(config[_0xf6e9('0x19')]));require('./chatWebsite.socket')[_0xf6e9('0x1d')](socket);var jayson=require(_0xf6e9('0x1e'));var client=jayson[_0xf6e9('0x1f')][_0xf6e9('0x20')]({'port':0x232c});var client9002=jayson[_0xf6e9('0x1f')][_0xf6e9('0x20')]({'port':0x232a});var client9003=jayson[_0xf6e9('0x1f')][_0xf6e9('0x20')]({'port':0x232b});var client9001=jayson[_0xf6e9('0x1f')][_0xf6e9('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x3cc5f2,_0xfa63db,_0x47d9d1,_0x550db6){return new BPromise(function(_0x863c76,_0xe11c0){var _0x12ae70=_0x550db6||client;return _0x12ae70[_0xf6e9('0x21')](_0x3cc5f2,_0x47d9d1)[_0xf6e9('0x22')](function(_0x33fc4b){logger[_0xf6e9('0x23')](_0xf6e9('0x24'),_0xfa63db,'request\x20sent');logger['debug'](_0xf6e9('0x25'),_0xfa63db,_0xf6e9('0x26'),JSON[_0xf6e9('0x27')](_0x33fc4b));if(_0x33fc4b[_0xf6e9('0x28')]){if(_0x33fc4b['error'][_0xf6e9('0x29')]===0x1f4){logger[_0xf6e9('0x28')](_0xf6e9('0x24'),_0xfa63db,_0x33fc4b[_0xf6e9('0x28')][_0xf6e9('0x2a')]);return _0xe11c0(_0x33fc4b['error'][_0xf6e9('0x2a')]);}logger[_0xf6e9('0x28')](_0xf6e9('0x24'),_0xfa63db,_0x33fc4b['error'][_0xf6e9('0x2a')]);return _0x863c76(_0x33fc4b[_0xf6e9('0x28')]['message']);}else{logger[_0xf6e9('0x23')]('ChatWebsite,\x20%s,\x20%s',_0xfa63db,_0xf6e9('0x26'));_0x863c76(_0x33fc4b['result'][_0xf6e9('0x2a')]);}})[_0xf6e9('0x2b')](function(_0x15b95f){logger['error'](_0xf6e9('0x24'),_0xfa63db,_0x15b95f);_0xe11c0(_0x15b95f);});});}function respondWithStatusCode(_0x2c41d1,_0x548008){_0x548008=_0x548008||0xcc;return function(_0xb10a27){if(_0xb10a27){return _0x2c41d1[_0xf6e9('0x2c')](_0x548008);}return _0x2c41d1['status'](_0x548008)[_0xf6e9('0x2d')]();};}function respondWithResult(_0x3c46df,_0x21e7a0){_0x21e7a0=_0x21e7a0||0xc8;return function(_0x45992a){if(_0x45992a){return _0x3c46df[_0xf6e9('0x2e')](_0x21e7a0)['json'](_0x45992a);}};}function respondWithFilteredResult(_0x233eb4,_0x33a4e5){return function(_0x5d61ca){if(_0x5d61ca){var _0x1c1baa=typeof _0x33a4e5[_0xf6e9('0x2f')]===_0xf6e9('0x30')&&typeof _0x33a4e5[_0xf6e9('0x31')]===_0xf6e9('0x30');var _0x228fd4=_0x5d61ca[_0xf6e9('0x32')];var _0x2fa96d=_0x1c1baa?0x0:_0x33a4e5[_0xf6e9('0x2f')];var _0x3a4ae0=_0x1c1baa?_0x5d61ca[_0xf6e9('0x32')]:_0x33a4e5['offset']+_0x33a4e5['limit'];var _0x4681dd;if(_0x3a4ae0>=_0x228fd4){_0x3a4ae0=_0x228fd4;_0x4681dd=0xc8;}else{_0x4681dd=0xce;}_0x233eb4[_0xf6e9('0x2e')](_0x4681dd);return _0x233eb4[_0xf6e9('0x33')](_0xf6e9('0x34'),_0x2fa96d+'-'+_0x3a4ae0+'/'+_0x228fd4)['json'](_0x5d61ca);}return null;};}function patchUpdates(_0x477d87){return function(_0x391ce7){try{jsonpatch[_0xf6e9('0x35')](_0x391ce7,_0x477d87,!![]);}catch(_0x4891b1){return BPromise['reject'](_0x4891b1);}return _0x391ce7['save']();};}function saveUpdates(_0x59e917,_0x28450a){return function(_0x34851f){if(_0x34851f){return _0x34851f[_0xf6e9('0x36')](_0x59e917)[_0xf6e9('0x22')](function(_0x370ad2){return _0x370ad2;});}return null;};}function removeEntity(_0x3564e8,_0x3bc73d){return function(_0xb61f30){if(_0xb61f30){return _0xb61f30[_0xf6e9('0x37')]()[_0xf6e9('0x22')](function(){var _0x25c6cb=_0xb61f30[_0xf6e9('0x38')]({'plain':!![]});var _0xd47a0e=_0xf6e9('0x39');return db[_0xf6e9('0x3a')][_0xf6e9('0x37')]({'where':{'type':_0xd47a0e,'resourceId':_0x25c6cb['id']}})['then'](function(){return _0xb61f30;});})[_0xf6e9('0x22')](function(){_0x3564e8[_0xf6e9('0x2e')](0xcc)[_0xf6e9('0x2d')]();});}};}function handleEntityNotFound(_0x5ea49b,_0x2aac78){return function(_0x1e2791){if(!_0x1e2791){_0x5ea49b[_0xf6e9('0x2c')](0x194);}return _0x1e2791;};}function handleError(_0x56b950,_0xe06593){_0xe06593=_0xe06593||0x1f4;return function(_0x891fdf){logger[_0xf6e9('0x28')](_0x891fdf[_0xf6e9('0x3b')]);if(_0x891fdf['name']){delete _0x891fdf['name'];}_0x56b950[_0xf6e9('0x2e')](_0xe06593)[_0xf6e9('0x3c')](_0x891fdf);};}exports[_0xf6e9('0x3d')]=function(_0x53c109,_0xdf5475){var _0x1547ab={'include':[{'model':db[_0xf6e9('0x3e')],'as':_0xf6e9('0x3f')}]},_0x373377={},_0x1d61ec={'count':0x0,'rows':[]};var _0xc1509b=_[_0xf6e9('0x40')](db['ChatWebsite'][_0xf6e9('0x41')],function(_0x4fbeb6){return{'name':_0x4fbeb6['fieldName'],'type':_0x4fbeb6[_0xf6e9('0x42')][_0xf6e9('0x43')]};});_0x373377['model']=_[_0xf6e9('0x40')](_0xc1509b,_0xf6e9('0x44'));_0x373377[_0xf6e9('0x45')]=_[_0xf6e9('0x46')](_0x53c109['query']);_0x373377[_0xf6e9('0x47')]=_[_0xf6e9('0x48')](_0x373377[_0xf6e9('0x49')],_0x373377[_0xf6e9('0x45')]);_0x1547ab[_0xf6e9('0x4a')]=_[_0xf6e9('0x48')](_0x373377['model'],qs[_0xf6e9('0x4b')](_0x53c109[_0xf6e9('0x45')][_0xf6e9('0x4b')]));_0x1547ab[_0xf6e9('0x4a')]=_0x1547ab['attributes'][_0xf6e9('0x4c')]?_0x1547ab[_0xf6e9('0x4a')]:_0x373377[_0xf6e9('0x49')];if(!_0x53c109[_0xf6e9('0x45')][_0xf6e9('0x4d')](_0xf6e9('0x4e'))){_0x1547ab[_0xf6e9('0x31')]=qs[_0xf6e9('0x31')](_0x53c109[_0xf6e9('0x45')][_0xf6e9('0x31')]);_0x1547ab[_0xf6e9('0x2f')]=qs[_0xf6e9('0x2f')](_0x53c109[_0xf6e9('0x45')][_0xf6e9('0x2f')]);}_0x1547ab[_0xf6e9('0x4f')]=qs[_0xf6e9('0x50')](_0x53c109[_0xf6e9('0x45')][_0xf6e9('0x50')]);_0x1547ab[_0xf6e9('0x51')]=qs[_0xf6e9('0x47')](_[_0xf6e9('0x52')](_0x53c109[_0xf6e9('0x45')],_0x373377[_0xf6e9('0x47')]),_0xc1509b);if(_0x53c109[_0xf6e9('0x45')][_0xf6e9('0x53')]){_0x1547ab[_0xf6e9('0x51')]=_['merge'](_0x1547ab[_0xf6e9('0x51')],{'$or':_[_0xf6e9('0x40')](_0xc1509b,function(_0x1d3067){if(_0x1d3067[_0xf6e9('0x42')]!==_0xf6e9('0x54')){var _0x565389={};_0x565389[_0x1d3067[_0xf6e9('0x44')]]={'$like':'%'+_0x53c109['query'][_0xf6e9('0x53')]+'%'};return _0x565389;}})});}_0x1547ab=_['merge']({},_0x1547ab,_0x53c109[_0xf6e9('0x55')]);var _0x306b94={'where':_0x1547ab[_0xf6e9('0x51')]};return db['ChatWebsite'][_0xf6e9('0x32')](_0x306b94)[_0xf6e9('0x22')](function(_0x8e38ec){_0x1d61ec['count']=_0x8e38ec;if(_0x53c109[_0xf6e9('0x45')]['includeAll']){_0x1547ab['include']=[{'all':!![]}];}return db[_0xf6e9('0x56')][_0xf6e9('0x57')](_0x1547ab);})['then'](function(_0x18e45e){_0x1d61ec[_0xf6e9('0x58')]=_0x18e45e;return _0x1d61ec;})[_0xf6e9('0x22')](respondWithFilteredResult(_0xdf5475,_0x1547ab))[_0xf6e9('0x2b')](handleError(_0xdf5475,null));};exports[_0xf6e9('0x59')]=function(_0xe92d20,_0x36d417){var _0x4d63a0={'raw':![],'where':{'id':_0xe92d20[_0xf6e9('0x5a')]['id']},'include':[{'model':db[_0xf6e9('0x3e')],'as':_0xf6e9('0x3f')}]},_0x1782e6={};_0x1782e6[_0xf6e9('0x49')]=_[_0xf6e9('0x46')](db[_0xf6e9('0x56')]['rawAttributes']);_0x1782e6[_0xf6e9('0x45')]=_[_0xf6e9('0x46')](_0xe92d20[_0xf6e9('0x45')]);_0x1782e6[_0xf6e9('0x47')]=_['intersection'](_0x1782e6[_0xf6e9('0x49')],_0x1782e6[_0xf6e9('0x45')]);_0x4d63a0[_0xf6e9('0x4a')]=_[_0xf6e9('0x48')](_0x1782e6[_0xf6e9('0x49')],qs[_0xf6e9('0x4b')](_0xe92d20[_0xf6e9('0x45')][_0xf6e9('0x4b')]));_0x4d63a0[_0xf6e9('0x4a')]=_0x4d63a0[_0xf6e9('0x4a')]['length']?_0x4d63a0[_0xf6e9('0x4a')]:_0x1782e6[_0xf6e9('0x49')];if(_0xe92d20[_0xf6e9('0x45')]['includeAll']){_0x4d63a0[_0xf6e9('0x5b')]=[{'all':!![]}];}_0x4d63a0=_[_0xf6e9('0x5c')]({},_0x4d63a0,_0xe92d20['options']);return db['ChatWebsite'][_0xf6e9('0x5d')](_0x4d63a0)[_0xf6e9('0x22')](handleEntityNotFound(_0x36d417,null))[_0xf6e9('0x22')](respondWithResult(_0x36d417,null))[_0xf6e9('0x2b')](handleError(_0x36d417,null));};exports[_0xf6e9('0x5e')]=function(_0xfd7321,_0x44bee3){return db[_0xf6e9('0x56')][_0xf6e9('0x5e')](_0xfd7321[_0xf6e9('0x5f')],{})['then'](function(_0x2d5ec5){var _0x297c07=_0xfd7321[_0xf6e9('0x60')][_0xf6e9('0x38')]({'plain':!![]});if(!_0x297c07)throw new Error(_0xf6e9('0x61'));if(_0x297c07[_0xf6e9('0x62')]===_0xf6e9('0x60')){var _0x5ddc3c=_0x2d5ec5[_0xf6e9('0x38')]({'plain':!![]});var _0x371764='ChatWebsites';return db[_0xf6e9('0x63')]['find']({'where':{'name':_0x371764,'userProfileId':_0x297c07['userProfileId']},'raw':!![]})['then'](function(_0xe83822){if(_0xe83822&&_0xe83822[_0xf6e9('0x64')]===0x0){return db[_0xf6e9('0x3a')][_0xf6e9('0x5e')]({'name':_0x5ddc3c[_0xf6e9('0x44')],'resourceId':_0x5ddc3c['id'],'type':_0xe83822[_0xf6e9('0x44')],'sectionId':_0xe83822['id']},{})['then'](function(){return _0x2d5ec5;});}else{return _0x2d5ec5;}})[_0xf6e9('0x2b')](function(_0x2db5f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2db5f4);throw _0x2db5f4;});}return _0x2d5ec5;})[_0xf6e9('0x22')](respondWithResult(_0x44bee3,0xc9))[_0xf6e9('0x2b')](handleError(_0x44bee3,null));};exports[_0xf6e9('0x36')]=function(_0x40745d,_0xaf8706){if(_0x40745d[_0xf6e9('0x5f')]['id']){delete _0x40745d[_0xf6e9('0x5f')]['id'];}return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0x40745d[_0xf6e9('0x5a')]['id']},'include':[{'model':db[_0xf6e9('0x3e')],'as':_0xf6e9('0x3f')}]})['then'](handleEntityNotFound(_0xaf8706,null))[_0xf6e9('0x22')](saveUpdates(_0x40745d['body'],null))[_0xf6e9('0x22')](respondWithResult(_0xaf8706,null))[_0xf6e9('0x2b')](handleError(_0xaf8706,null));};exports[_0xf6e9('0x37')]=function(_0x57583b,_0x354509){return db['ChatWebsite'][_0xf6e9('0x5d')]({'where':{'id':_0x57583b['params']['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x354509,null))[_0xf6e9('0x22')](removeEntity(_0x354509,null))[_0xf6e9('0x2b')](handleError(_0x354509,null));};exports[_0xf6e9('0x65')]=function(_0x5e67f3,_0xebd1ea){return db[_0xf6e9('0x56')][_0xf6e9('0x65')]()[_0xf6e9('0x22')](respondWithResult(_0xebd1ea,null))[_0xf6e9('0x2b')](handleError(_0xebd1ea,null));};exports[_0xf6e9('0x66')]=function(_0x529591,_0x44728b,_0x4c6638){if(_0x529591[_0xf6e9('0x5f')]['id']){delete _0x529591['body']['id'];}return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0x529591['params']['id']}})['then'](handleEntityNotFound(_0x44728b,null))['then'](function(_0xe4b85f){if(_0xe4b85f){_0x529591[_0xf6e9('0x5f')]['ChatWebsiteId']=_0xe4b85f['id'];return db[_0xf6e9('0x67')][_0xf6e9('0x5e')](_0x529591[_0xf6e9('0x5f')]);}})[_0xf6e9('0x22')](respondWithResult(_0x44728b,null))[_0xf6e9('0x2b')](handleError(_0x44728b,null));};exports['getDispositions']=function(_0x40ab4d,_0x142cce,_0x143bdc){var _0xbd2f8f={'raw':![],'where':{}};var _0x4bfa25={};var _0x1a9afa={'count':0x0,'rows':[]};return db[_0xf6e9('0x56')][_0xf6e9('0x68')]({'where':{'id':_0x40ab4d[_0xf6e9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x142cce,null))[_0xf6e9('0x22')](function(_0x4a7342){if(_0x4a7342){_0x4bfa25[_0xf6e9('0x49')]=_[_0xf6e9('0x46')](db['Disposition']['rawAttributes']);_0x4bfa25[_0xf6e9('0x45')]=_[_0xf6e9('0x46')](_0x40ab4d[_0xf6e9('0x45')]);_0x4bfa25[_0xf6e9('0x47')]=_[_0xf6e9('0x48')](_0x4bfa25[_0xf6e9('0x49')],_0x4bfa25[_0xf6e9('0x45')]);_0xbd2f8f[_0xf6e9('0x4a')]=_['intersection'](_0x4bfa25[_0xf6e9('0x49')],qs[_0xf6e9('0x4b')](_0x40ab4d[_0xf6e9('0x45')]['fields']));_0xbd2f8f[_0xf6e9('0x4a')]=_0xbd2f8f['attributes'][_0xf6e9('0x4c')]?_0xbd2f8f['attributes']:_0x4bfa25[_0xf6e9('0x49')];if(!_0x40ab4d[_0xf6e9('0x45')][_0xf6e9('0x4d')](_0xf6e9('0x4e'))){_0xbd2f8f['limit']=qs[_0xf6e9('0x31')](_0x40ab4d['query'][_0xf6e9('0x31')]);_0xbd2f8f[_0xf6e9('0x2f')]=qs[_0xf6e9('0x2f')](_0x40ab4d[_0xf6e9('0x45')][_0xf6e9('0x2f')]);}_0xbd2f8f[_0xf6e9('0x4f')]=qs[_0xf6e9('0x50')](_0x40ab4d[_0xf6e9('0x45')]['sort']);_0xbd2f8f[_0xf6e9('0x51')]=qs[_0xf6e9('0x47')](_['pick'](_0x40ab4d['query'],_0x4bfa25[_0xf6e9('0x47')]));_0xbd2f8f[_0xf6e9('0x51')]['ChatWebsiteId']=_0x4a7342['id'];if(_0x40ab4d[_0xf6e9('0x45')][_0xf6e9('0x53')]){_0xbd2f8f[_0xf6e9('0x51')]=_[_0xf6e9('0x5c')](_0xbd2f8f[_0xf6e9('0x51')],{'$or':_[_0xf6e9('0x40')](_0xbd2f8f[_0xf6e9('0x4a')],function(_0xbf2451){var _0x22e692={};_0x22e692[_0xbf2451]={'$like':'%'+_0x40ab4d[_0xf6e9('0x45')]['filter']+'%'};return _0x22e692;})});}_0xbd2f8f=_[_0xf6e9('0x5c')]({},_0xbd2f8f,_0x40ab4d['options']);return db['Disposition']['count']({'where':_0xbd2f8f[_0xf6e9('0x51')]})[_0xf6e9('0x22')](function(_0x4aea88){_0x1a9afa[_0xf6e9('0x32')]=_0x4aea88;if(_0x40ab4d[_0xf6e9('0x45')][_0xf6e9('0x69')]){_0xbd2f8f[_0xf6e9('0x5b')]=[{'all':!![]}];}return db[_0xf6e9('0x67')][_0xf6e9('0x57')](_0xbd2f8f);})[_0xf6e9('0x22')](function(_0x3098ad){_0x1a9afa[_0xf6e9('0x58')]=_0x3098ad;return _0x1a9afa;});}})['then'](respondWithFilteredResult(_0x142cce,_0xbd2f8f))['catch'](handleError(_0x142cce,null));};exports[_0xf6e9('0x6a')]=function(_0x3a764f,_0x327c13,_0x4edc21){return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0x3a764f['params']['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x327c13,null))[_0xf6e9('0x22')](function(_0x3f9adb){if(_0x3f9adb){return _0x3f9adb['removeDispositions'](_0x3a764f[_0xf6e9('0x45')][_0xf6e9('0x6b')]);}})[_0xf6e9('0x22')](respondWithStatusCode(_0x327c13,null))['catch'](handleError(_0x327c13,null));};exports[_0xf6e9('0x6c')]=function(_0x476545,_0x33382b,_0x2f9054){if(_0x476545[_0xf6e9('0x5f')]['id']){delete _0x476545[_0xf6e9('0x5f')]['id'];}return db['ChatWebsite'][_0xf6e9('0x5d')]({'where':{'id':_0x476545['params']['id']}})['then'](handleEntityNotFound(_0x33382b,null))[_0xf6e9('0x22')](function(_0x28e99e){if(_0x28e99e){_0x476545['body'][_0xf6e9('0x6d')]=_0x28e99e['id'];return db[_0xf6e9('0x6e')][_0xf6e9('0x5e')](_0x476545['body']);}})[_0xf6e9('0x22')](respondWithResult(_0x33382b,null))['catch'](handleError(_0x33382b,null));};exports[_0xf6e9('0x6f')]=function(_0x195ccb,_0xf7e828,_0x811de){var _0x1ab528={'raw':![],'where':{}};var _0x1e7477={};var _0xb26a12={'count':0x0,'rows':[]};return db[_0xf6e9('0x56')][_0xf6e9('0x68')]({'where':{'id':_0x195ccb['params']['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0xf7e828,null))[_0xf6e9('0x22')](function(_0x3936a5){if(_0x3936a5){_0x1e7477[_0xf6e9('0x49')]=_[_0xf6e9('0x46')](db[_0xf6e9('0x6e')][_0xf6e9('0x41')]);_0x1e7477[_0xf6e9('0x45')]=_[_0xf6e9('0x46')](_0x195ccb['query']);_0x1e7477['filters']=_[_0xf6e9('0x48')](_0x1e7477[_0xf6e9('0x49')],_0x1e7477[_0xf6e9('0x45')]);_0x1ab528[_0xf6e9('0x4a')]=_['intersection'](_0x1e7477['model'],qs['fields'](_0x195ccb[_0xf6e9('0x45')]['fields']));_0x1ab528[_0xf6e9('0x4a')]=_0x1ab528[_0xf6e9('0x4a')]['length']?_0x1ab528['attributes']:_0x1e7477['model'];if(!_0x195ccb[_0xf6e9('0x45')][_0xf6e9('0x4d')]('nolimit')){_0x1ab528[_0xf6e9('0x31')]=qs[_0xf6e9('0x31')](_0x195ccb['query'][_0xf6e9('0x31')]);_0x1ab528[_0xf6e9('0x2f')]=qs[_0xf6e9('0x2f')](_0x195ccb[_0xf6e9('0x45')][_0xf6e9('0x2f')]);}_0x1ab528['order']=qs['sort'](_0x195ccb[_0xf6e9('0x45')]['sort']);_0x1ab528[_0xf6e9('0x51')]=qs['filters'](_[_0xf6e9('0x52')](_0x195ccb[_0xf6e9('0x45')],_0x1e7477[_0xf6e9('0x47')]));_0x1ab528[_0xf6e9('0x51')][_0xf6e9('0x6d')]=_0x3936a5['id'];if(_0x195ccb['query'][_0xf6e9('0x53')]){_0x1ab528[_0xf6e9('0x51')]=_[_0xf6e9('0x5c')](_0x1ab528['where'],{'$or':_[_0xf6e9('0x40')](_0x1ab528[_0xf6e9('0x4a')],function(_0x2266d6){var _0x526db7={};_0x526db7[_0x2266d6]={'$like':'%'+_0x195ccb[_0xf6e9('0x45')][_0xf6e9('0x53')]+'%'};return _0x526db7;})});}_0x1ab528=_[_0xf6e9('0x5c')]({},_0x1ab528,_0x195ccb[_0xf6e9('0x55')]);return db['CannedAnswer'][_0xf6e9('0x32')]({'where':_0x1ab528[_0xf6e9('0x51')]})[_0xf6e9('0x22')](function(_0x17a27c){_0xb26a12['count']=_0x17a27c;if(_0x195ccb[_0xf6e9('0x45')][_0xf6e9('0x69')]){_0x1ab528['include']=[{'all':!![]}];}return db[_0xf6e9('0x6e')][_0xf6e9('0x57')](_0x1ab528);})['then'](function(_0x404af1){_0xb26a12['rows']=_0x404af1;return _0xb26a12;});}})[_0xf6e9('0x22')](respondWithFilteredResult(_0xf7e828,_0x1ab528))[_0xf6e9('0x2b')](handleError(_0xf7e828,null));};exports[_0xf6e9('0x70')]=function(_0x2f932d,_0x2537a0,_0x3b8ede){return db['ChatWebsite']['find']({'where':{'id':_0x2f932d['params']['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x2537a0,null))[_0xf6e9('0x22')](function(_0x5c4d12){if(_0x5c4d12){return _0x5c4d12['removeAnswers'](_0x2f932d[_0xf6e9('0x45')]['ids']);}})[_0xf6e9('0x22')](respondWithStatusCode(_0x2537a0,null))['catch'](handleError(_0x2537a0,null));};exports['addLogo']=function(_0x2273fd,_0x313baa,_0x11e215){_0x2273fd['body'][_0xf6e9('0x71')]=_0x2273fd[_0xf6e9('0x72')][_0xf6e9('0x73')];return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0x2273fd[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x313baa,null))[_0xf6e9('0x22')](saveUpdates(_0x2273fd[_0xf6e9('0x5f')],null))['then'](respondWithResult(_0x313baa,null))[_0xf6e9('0x2b')](handleError(_0x313baa,null));};exports[_0xf6e9('0x74')]=function(_0x4b7caf,_0x1ed17a,_0x1b9920){_0x4b7caf['body']['agentAvatar']=_0x4b7caf['file'][_0xf6e9('0x73')];return db[_0xf6e9('0x56')]['find']({'where':{'id':_0x4b7caf[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x1ed17a,null))[_0xf6e9('0x22')](saveUpdates(_0x4b7caf[_0xf6e9('0x5f')],null))[_0xf6e9('0x22')](respondWithResult(_0x1ed17a,null))[_0xf6e9('0x2b')](handleError(_0x1ed17a,null));};exports[_0xf6e9('0x75')]=function(_0x5d84b9,_0xaaf96b,_0x573126){_0x5d84b9['body']['customerAvatar']=_0x5d84b9[_0xf6e9('0x72')][_0xf6e9('0x73')];return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0x5d84b9[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0xaaf96b,null))[_0xf6e9('0x22')](saveUpdates(_0x5d84b9[_0xf6e9('0x5f')],null))[_0xf6e9('0x22')](respondWithResult(_0xaaf96b,null))[_0xf6e9('0x2b')](handleError(_0xaaf96b,null));};exports[_0xf6e9('0x76')]=function(_0x21f24a,_0x1f65b2,_0x423886){_0x21f24a['body'][_0xf6e9('0x77')]=_0x21f24a[_0xf6e9('0x72')][_0xf6e9('0x73')];return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0x21f24a['params']['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x1f65b2,null))[_0xf6e9('0x22')](saveUpdates(_0x21f24a[_0xf6e9('0x5f')],null))['then'](respondWithResult(_0x1f65b2,null))[_0xf6e9('0x2b')](handleError(_0x1f65b2,null));};exports[_0xf6e9('0x78')]=function(_0x3e836b,_0x3816c7,_0x1551bb){var _0x128519=path['join'](config[_0xf6e9('0x79')],'server/files/images/logos/default_logo.svg');var _0x312906={'where':{'id':_0x3e836b[_0xf6e9('0x5a')]['id']},'attributes':['id',_0xf6e9('0x71')],'raw':!![]};var _0x35d754=![];return require(_0xf6e9('0x17'))[_0xf6e9('0x7a')]()[_0xf6e9('0x22')](function(_0xf1c9f0){if(_0xf1c9f0){_0x35d754=_0xf1c9f0['custom'];}})['then'](function(){return db['ChatWebsite'][_0xf6e9('0x5d')](_0x312906);})['then'](handleEntityNotFound(_0x3816c7,null))[_0xf6e9('0x22')](function(_0x23c54f){if(_0x23c54f){if(!_[_0xf6e9('0x7b')](_0x23c54f[_0xf6e9('0x71')])){if(fs[_0xf6e9('0x7c')](path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],_0xf6e9('0x7e'),_0x23c54f[_0xf6e9('0x71')]))&&_0x35d754){_0x128519=path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],_0xf6e9('0x7e'),_0x23c54f[_0xf6e9('0x71')]);}}return _0x3816c7['download'](_0x128519);}})['catch'](handleError(_0x3816c7,null));};exports[_0xf6e9('0x7f')]=function(_0x255e3c,_0xf4dfc4,_0x373de4){var _0x7f2d57=path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],'server/files/images/avatars/default_avatar.png');var _0x3cefe2={'where':{'id':_0x255e3c[_0xf6e9('0x5a')]['id']},'attributes':['id',_0xf6e9('0x80')],'raw':!![]};return db[_0xf6e9('0x56')][_0xf6e9('0x5d')](_0x3cefe2)[_0xf6e9('0x22')](handleEntityNotFound(_0xf4dfc4,null))['then'](function(_0x5ce1f9){if(_0x5ce1f9){if(!_['isNil'](_0x5ce1f9[_0xf6e9('0x80')])){if(fs[_0xf6e9('0x7c')](path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],_0xf6e9('0x81'),_0x5ce1f9[_0xf6e9('0x80')]))){_0x7f2d57=path[_0xf6e9('0x7d')](config['root'],_0xf6e9('0x81'),_0x5ce1f9[_0xf6e9('0x80')]);}}return _0xf4dfc4[_0xf6e9('0x82')](_0x7f2d57);}})[_0xf6e9('0x2b')](handleError(_0xf4dfc4,null));};exports[_0xf6e9('0x83')]=function(_0x24201c,_0x486d02,_0x22b9e8){var _0x2556d5=path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],_0xf6e9('0x84'));var _0x4ffd6c={'where':{'id':_0x24201c['params']['id']},'attributes':['id',_0xf6e9('0x85'),_0xf6e9('0x86')],'raw':!![]};return db[_0xf6e9('0x56')][_0xf6e9('0x5d')](_0x4ffd6c)[_0xf6e9('0x22')](handleEntityNotFound(_0x486d02,null))[_0xf6e9('0x22')](function(_0x309d93){if(_0x309d93){if(!_[_0xf6e9('0x7b')](_0x309d93[_0xf6e9('0x85')])){if(fs[_0xf6e9('0x7c')](path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],_0xf6e9('0x81'),_0x309d93['customerAvatar']))&&_0x309d93[_0xf6e9('0x86')]){_0x2556d5=path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],_0xf6e9('0x81'),_0x309d93[_0xf6e9('0x85')]);}}return _0x486d02[_0xf6e9('0x82')](_0x2556d5);}})[_0xf6e9('0x2b')](handleError(_0x486d02,null));};exports[_0xf6e9('0x87')]=function(_0x26755d,_0x1879e4,_0x4ad31c){var _0x426552=path['join'](config['root'],_0xf6e9('0x88'));var _0x2fa784={'where':{'id':_0x26755d[_0xf6e9('0x5a')]['id']},'attributes':['id',_0xf6e9('0x77')],'raw':!![]};return db[_0xf6e9('0x56')]['find'](_0x2fa784)[_0xf6e9('0x22')](handleEntityNotFound(_0x1879e4,null))[_0xf6e9('0x22')](function(_0x1c6800){if(_0x1c6800){if(!_[_0xf6e9('0x7b')](_0x1c6800[_0xf6e9('0x77')])){if(fs[_0xf6e9('0x7c')](path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],_0xf6e9('0x81'),_0x1c6800[_0xf6e9('0x77')]))){_0x426552=path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],'server/files/images/avatars/',_0x1c6800[_0xf6e9('0x77')]);}}return _0x1879e4[_0xf6e9('0x82')](_0x426552);}})[_0xf6e9('0x2b')](handleError(_0x1879e4,null));};exports[_0xf6e9('0x89')]=function(_0xb83a6d,_0x93b38d,_0xbedbf4){var _0x50f448=require('user-agent-parser');var _0x49d2d0=new _0x50f448();var _0x1330cc=_0x49d2d0[_0xf6e9('0x8a')](_0xb83a6d[_0xf6e9('0x8b')][_0xf6e9('0x8c')])[_0xf6e9('0x8d')]();var _0x589832={'body':_0xb83a6d[_0xf6e9('0x5f')],'channel':_0xf6e9('0x8e')};var _0x19570d=[];var _0x1abdf2=[];var _0x51a9c7={};var _0x40c027=![];return db[_0xf6e9('0x8f')]['describe']()[_0xf6e9('0x22')](function(_0x5c9f82){if(!_0x5c9f82){throw new db[(_0xf6e9('0x90'))][(_0xf6e9('0x91'))](_0xf6e9('0x92'));}_0x19570d=_[_0xf6e9('0x93')](_[_0xf6e9('0x46')](_0x5c9f82),[_0xf6e9('0x94'),_0xf6e9('0x95')]);_0x1abdf2=_['difference'](_['keys'](_0x5c9f82),[_0xf6e9('0x94'),'updatedAt',_0xf6e9('0x96'),'ListId']);if(_0xb83a6d[_0xf6e9('0x5f')]['id']){delete _0xb83a6d[_0xf6e9('0x5f')]['id'];}if(_[_0xf6e9('0x7b')](_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0x97')])){throw new db[(_0xf6e9('0x90'))][(_0xf6e9('0x91'))](_0xf6e9('0x98'));}if(_[_0xf6e9('0x7b')](_0xb83a6d['body'][_0xf6e9('0x5f')])||_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0x5f')]===''){throw new db['Sequelize'][(_0xf6e9('0x91'))](_0xf6e9('0x99'));}if(_[_0xf6e9('0x7b')](_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0x9a')])){throw new db['Sequelize'][(_0xf6e9('0x91'))](_0xf6e9('0x9b')+_0x1abdf2);}if(!_['includes'](_0x1abdf2,_0xb83a6d[_0xf6e9('0x5f')]['mapKey'])){throw new db[(_0xf6e9('0x90'))][(_0xf6e9('0x91'))](_0xf6e9('0x9c')+_0x1abdf2);}_0x51a9c7[_0xb83a6d['body'][_0xf6e9('0x9a')]]=_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0x97')];})[_0xf6e9('0x22')](function(){return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0xb83a6d[_0xf6e9('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xf6e9('0x9d'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x51a9c7,'limit':0x1,'order':[['updatedAt',_0xf6e9('0x9e')]]}]},{'model':db[_0xf6e9('0x9f')],'as':_0xf6e9('0xa0')}]});})[_0xf6e9('0x22')](handleEntityNotFound(_0x93b38d,null))[_0xf6e9('0x22')](function(_0x51204c){if(_0x51204c&&_0x51204c[_0xf6e9('0x9d')]){_0x589832['account']=_0x51204c;_0x589832[_0xf6e9('0xa1')]=_0x51204c[_0xf6e9('0xa0')];_0x589832['list']=_0x51204c[_0xf6e9('0x9d')];_0x589832[_0xf6e9('0xa1')]=_[_0xf6e9('0xa2')](_0x589832[_0xf6e9('0xa1')],[_0xf6e9('0xa3')],[_0xf6e9('0xa4')]);if(_0x589832[_0xf6e9('0xa5')][_0xf6e9('0xa0')]){delete _0x589832[_0xf6e9('0xa5')][_0xf6e9('0xa0')];}if(_0x589832['account'][_0xf6e9('0x9d')]&&_0x589832[_0xf6e9('0xa5')]['List']['Contacts'][_0xf6e9('0x4c')]){return _0x589832[_0xf6e9('0xa5')]['List'][_0xf6e9('0xa6')][0x0];}var _0x3a720f=_[_0xf6e9('0x1a')](_0xb83a6d[_0xf6e9('0x5f')],{'firstName':_0xb83a6d[_0xf6e9('0x5f')]['from'],'ListId':_0x51204c[_0xf6e9('0xa7')]});_0x3a720f[_0xb83a6d[_0xf6e9('0x5f')]['mapKey']]=_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0x97')];return db[_0xf6e9('0x8f')][_0xf6e9('0x5e')](_0x3a720f,{'fields':_0x19570d,'raw':!![]});}})[_0xf6e9('0x22')](handleEntityNotFound(_0x93b38d,null))[_0xf6e9('0x22')](function(_0x13c448){_0x589832[_0xf6e9('0xa8')]=_0x13c448;var _0x3b4736=_0xb83a6d['body']['customerIp'];if(_0xb83a6d[_0xf6e9('0x8b')]['cf-connecting-ip']){_0x3b4736=_0xb83a6d[_0xf6e9('0x8b')]['cf-connecting-ip'];}else if(_0xb83a6d[_0xf6e9('0x8b')][_0xf6e9('0xa9')]){_0x3b4736=_['first'](_0xb83a6d[_0xf6e9('0x8b')][_0xf6e9('0xa9')][_0xf6e9('0xaa')](','));}if(_0x13c448){var _0x2e9f75={'ContactId':_0x13c448['id'],'ChatWebsiteId':_0xb83a6d['params']['id'],'from':(_0x13c448[_0xf6e9('0xab')]||'')+'\x20'+(_0x13c448[_0xf6e9('0xac')]||''),'customerIp':_0x3b4736,'customerPort':_0xb83a6d[_0xf6e9('0x8b')]['x-real-port']?_0xb83a6d[_0xf6e9('0x8b')][_0xf6e9('0xad')]:null,'referer':_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xae')],'browserName':_0x1330cc['browser'][_0xf6e9('0x44')]&&_0x1330cc[_0xf6e9('0xaf')]['version']?util[_0xf6e9('0xb0')](_0xf6e9('0xb1'),_0x1330cc['browser'][_0xf6e9('0x44')],_0x1330cc['browser'][_0xf6e9('0xb2')]):_0xf6e9('0xb3'),'browserVersion':_0x1330cc[_0xf6e9('0xaf')][_0xf6e9('0xb2')]||_0xf6e9('0xb3'),'osName':util[_0xf6e9('0xb0')]('%s\x20%s',_0x1330cc['os'][_0xf6e9('0x44')],_0x1330cc['os'][_0xf6e9('0xb2')]),'osVersion':_0x1330cc['os'][_0xf6e9('0xb2')],'deviceModel':_0x1330cc[_0xf6e9('0xb4')][_0xf6e9('0x49')]&&_0x1330cc[_0xf6e9('0xb4')][_0xf6e9('0xb5')]?util[_0xf6e9('0xb0')](_0xf6e9('0xb6'),_0x1330cc[_0xf6e9('0xb4')][_0xf6e9('0x49')],_0x1330cc[_0xf6e9('0xb4')][_0xf6e9('0xb5')],_0x1330cc[_0xf6e9('0xb4')]['type']):null,'deviceVendor':_0x1330cc[_0xf6e9('0xb4')]['vendor'],'deviceType':_0x1330cc[_0xf6e9('0xb4')][_0xf6e9('0x42')],'formData':JSON[_0xf6e9('0x27')](_0xb83a6d[_0xf6e9('0x5f')])};var _0x3b85a9={'ChatWebsiteId':_0xb83a6d[_0xf6e9('0x5a')]['id'],'closed':![]};if(_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xb7')]){_0x3b85a9[_0xf6e9('0xb7')]=_0xb83a6d[_0xf6e9('0x5f')]['threadId'];return db[_0xf6e9('0xb8')][_0xf6e9('0x5d')]({'where':_0x3b85a9})['then'](function(_0x5b9673){if(_0x5b9673){return[_0x5b9673,![]];}_0x2e9f75[_0xf6e9('0xb7')]=_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xb7')];_0x2e9f75[_0xf6e9('0xb9')]=_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xb9')];return db[_0xf6e9('0xb8')][_0xf6e9('0x5e')](_0x2e9f75)[_0xf6e9('0x22')](function(_0x8a9509){return[_0x8a9509,!![]];});});}_0x3b85a9[_0xf6e9('0xba')]=_0x13c448['id'];if(_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xbb')]&&_0xb83a6d['body'][_0xf6e9('0xbb')]['id']){_0x3b85a9['id']=_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xbb')]['id'];return db[_0xf6e9('0xb8')][_0xf6e9('0x5d')]({'where':_0x3b85a9})[_0xf6e9('0x22')](function(_0x465e4a){if(_0x465e4a){return[_0x465e4a,![]];}return db[_0xf6e9('0xb8')][_0xf6e9('0x5e')](_0x2e9f75)[_0xf6e9('0x22')](function(_0x330939){return[_0x330939,!![]];});});}return db[_0xf6e9('0xb8')][_0xf6e9('0x5e')](_0x2e9f75)['then'](function(_0x510583){return[_0x510583,!![]];});}})[_0xf6e9('0xbc')](function(_0x15c5f5,_0x49099f){if(_0x15c5f5){_0x40c027=_0x49099f;if(!_0x49099f){var _0x22a404={'from':(_0x589832['contact'][_0xf6e9('0xab')]||'')+'\x20'+(_0x589832[_0xf6e9('0xa8')][_0xf6e9('0xac')]||'')};if(_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xb7')]&&_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xbd')]&&_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xb7')]!=_0xb83a6d['body'][_0xf6e9('0xbd')]){_0x22a404[_0xf6e9('0xb7')]=_0xb83a6d[_0xf6e9('0x5f')][_0xf6e9('0xbd')];}return _0x15c5f5[_0xf6e9('0x36')](_0x22a404);}else{return _0x15c5f5;}}})[_0xf6e9('0x22')](function(_0x83498a){_0x589832[_0xf6e9('0xbb')]=_0x83498a[_0xf6e9('0x38')]({'plain':!![]});_0x589832['interaction'][_0xf6e9('0xbe')]=_0x40c027;if(_0x589832[_0xf6e9('0xbb')][_0xf6e9('0xbe')]){if(_0x589832[_0xf6e9('0xa5')]['autoclose']){_0x589832[_0xf6e9('0xa1')][_0xf6e9('0xbf')]({'id':0x0,'priority':_0x589832[_0xf6e9('0xa1')][_0xf6e9('0x4c')]+0x1,'app':_0xf6e9('0xc0'),'appdata':_0xf6e9('0xc1'),'interval':_0xf6e9('0xc2')});}}return db[_0xf6e9('0xc3')][_0xf6e9('0x5e')]({'body':_0xb83a6d[_0xf6e9('0x5f')]['body'],'ChatWebsiteId':_0xb83a6d[_0xf6e9('0x5a')]['id'],'ChatInteractionId':_0x83498a['id'],'direction':'in','ContactId':_0x589832[_0xf6e9('0xa8')]['id'],'AttachmentId':_0xb83a6d[_0xf6e9('0x5f')]['AttachmentId']});})[_0xf6e9('0x22')](function(_0x5a739b){_0x589832[_0xf6e9('0x2a')]=_0x5a739b;if(_0x589832[_0xf6e9('0xbb')][_0xf6e9('0xc4')]){return db[_0xf6e9('0xc5')]['find']({'attributes':['id','name'],'where':{'id':_0x589832[_0xf6e9('0xbb')][_0xf6e9('0xc4')]}})[_0xf6e9('0x22')](function(_0x405c51){if(_0x405c51){_0x589832[_0xf6e9('0xa1')][_0xf6e9('0xc6')]({'id':0x0,'priority':0x0,'app':_0xf6e9('0xc7'),'appdata':_0x405c51[_0xf6e9('0x44')]+','+(_0x589832[_0xf6e9('0xa5')][_0xf6e9('0xc8')]||0xa),'interval':_0xf6e9('0xc2')});_0x589832[_0xf6e9('0xc9')]=!![];}return respondWithRpcPromise(_0xf6e9('0xca'),_0xf6e9('0xcb'),_0x589832);});}return respondWithRpcPromise(_0xf6e9('0xca'),_0xf6e9('0xcb'),_0x589832);})[_0xf6e9('0x22')](function(_0x2436f6){respondWithRpcPromise(_0xf6e9('0xcc'),_0xf6e9('0xcc'),{'event':'notify','message':_0x2436f6},client9002);return _0x2436f6;})[_0xf6e9('0x22')](respondWithResult(_0x93b38d,null))[_0xf6e9('0x2b')](handleError(_0x93b38d,null));};exports['offline']=function(_0x7bc5d7,_0x3b77d5,_0x10e804){var _0x51770a,_0xbd592c,_0x4e5285;var _0x533d64=[];var _0x126c69=[];var _0x4b5c59={};var _0x3ce98b=_0x7bc5d7[_0xf6e9('0xcd')]||[];var _0x276654=[];var _0x54f87c;return db[_0xf6e9('0x8f')][_0xf6e9('0x65')]()[_0xf6e9('0x22')](function(_0x23ddde){if(!_0x23ddde){throw new db['Sequelize'][(_0xf6e9('0x91'))]('no\x20available\x20attributes');}_0x126c69=_['difference'](_['keys'](_0x23ddde),['createdAt','updatedAt']);_0x533d64=_['difference'](_[_0xf6e9('0x46')](_0x23ddde),[_0xf6e9('0x94'),_0xf6e9('0x95'),_0xf6e9('0x96'),_0xf6e9('0xa7')]);if(_0x7bc5d7[_0xf6e9('0x5f')]['id']){delete _0x7bc5d7[_0xf6e9('0x5f')]['id'];}if(_[_0xf6e9('0x7b')](_0x7bc5d7[_0xf6e9('0x5f')][_0xf6e9('0x97')])){throw _0x3b77d5[_0xf6e9('0x2e')](0x1f4)[_0xf6e9('0x3c')](new db[(_0xf6e9('0x90'))]['ValidationError'](_0xf6e9('0x98')));}if(_[_0xf6e9('0x7b')](_0x7bc5d7[_0xf6e9('0x5f')]['body'])||_0x7bc5d7[_0xf6e9('0x5f')][_0xf6e9('0x5f')]===''){throw _0x3b77d5[_0xf6e9('0x2e')](0x1f4)[_0xf6e9('0x3c')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xf6e9('0x7b')](_0x7bc5d7['body']['mapKeyOffline'])){throw _0x3b77d5[_0xf6e9('0x2e')](0x1f4)[_0xf6e9('0x3c')](new db[(_0xf6e9('0x90'))]['ValidationError'](_0xf6e9('0xce')+_0x533d64));}if(!_['includes'](_0x533d64,_0x7bc5d7['body'][_0xf6e9('0xcf')])){throw _0x3b77d5[_0xf6e9('0x2e')](0x1f4)['send'](new db['Sequelize'][(_0xf6e9('0x91'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x533d64));}_0x4b5c59[_0x7bc5d7[_0xf6e9('0x5f')][_0xf6e9('0xcf')]]=_0x7bc5d7[_0xf6e9('0x5f')]['from'];})[_0xf6e9('0x22')](function(){return db[_0xf6e9('0x56')]['find']({'where':{'id':_0x7bc5d7[_0xf6e9('0x5a')]['id']},'include':[{'model':db[_0xf6e9('0xd0')],'as':_0xf6e9('0x9d')},{'model':db[_0xf6e9('0xd1')],'as':_0xf6e9('0xd1')}]});})[_0xf6e9('0x22')](handleEntityNotFound(_0x3b77d5,null))[_0xf6e9('0x22')](function(_0x45ad55){if(_0x45ad55&&_0x45ad55[_0xf6e9('0x9d')]){_0xbd592c=_0x45ad55;var _0x40c26f=_[_0xf6e9('0x1a')](_0x7bc5d7['body'],{'firstName':_0x7bc5d7['body'][_0xf6e9('0x97')],'phone':_0x7bc5d7[_0xf6e9('0x5f')][_0xf6e9('0x97')],'ListId':_0x45ad55[_0xf6e9('0xa7')]});_0x40c26f[_0x7bc5d7['body'][_0xf6e9('0xcf')]]=_0x7bc5d7['body'][_0xf6e9('0x97')];return db[_0xf6e9('0x8f')]['findOrCreate']({'where':_0x4b5c59,'defaults':_0x40c26f});}})[_0xf6e9('0xbc')](function(_0x563e18){if(_0x563e18){_0x4e5285=_0x563e18;var _0x1c592d=fs[_0xf6e9('0xd2')](path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x18ddba=ejs[_0xf6e9('0xd3')](_0x1c592d,{'body':_[_0xf6e9('0xd4')](_0x7bc5d7[_0xf6e9('0x5f')][_0xf6e9('0x5f')]),'bodyTitle':_0xbd592c[_0xf6e9('0xd5')]});return db[_0xf6e9('0xd6')][_0xf6e9('0x5e')]({'body':_0x18ddba,'ContactId':_0x563e18['id'],'ChatWebsiteId':_0xbd592c['id']});}})[_0xf6e9('0x22')](function(_0x6c6df4){_0x54f87c=_0x6c6df4;if(_0x3ce98b[_0xf6e9('0x4c')]){var _0x11609c=_0x3ce98b[_0xf6e9('0x40')](function(_0x42ced5){return{'name':_0x42ced5[_0xf6e9('0xd7')],'basename':_0x42ced5['filename'],'type':_0x42ced5[_0xf6e9('0xd8')],'ChatOfflineMessageId':_0x6c6df4['id']};});_0x276654=_0x11609c['map'](_0x3f27b2=>{var _0x4750e9={'filename':_0x3f27b2[_0xf6e9('0x44')],'path':path['join'](config['root'],_0xf6e9('0xd9'),_0xf6e9('0xcd'),_0xf6e9('0xda'),_0xf6e9('0xdb'),_0x3f27b2[_0xf6e9('0xdc')])};return _0x4750e9;});if(!_0xbd592c[_0xf6e9('0xdd')]){return db[_0xf6e9('0xde')]['transaction'](function(_0x422322){return db['Attachment']['bulkCreate'](_0x11609c,{'transaction':_0x422322});});}}})['then'](function(){if(_0x54f87c){_0x51770a=_0x54f87c;return db[_0xf6e9('0xd1')][_0xf6e9('0x68')]({'where':{'active':!![]},'include':[{'model':db[_0xf6e9('0xdf')],'as':_0xf6e9('0xe0'),'raw':!![]}]});}})['then'](function(_0x138b35){if(_0x138b35&&_0x138b35[_0xf6e9('0xe0')]&&_0xbd592c['forwardOffline']&&_0xbd592c[_0xf6e9('0xe1')]){var _0x1c344d={'tls':{'rejectUnauthorized':![]}};if(_0x138b35['Smtp'][_0xf6e9('0xe2')]){_0x1c344d[_0xf6e9('0xe2')]=_0x138b35['Smtp'][_0xf6e9('0xe2')];}else{_0x1c344d['host']=_0x138b35[_0xf6e9('0xe0')]['host'];_0x1c344d[_0xf6e9('0xe3')]=_0x138b35['Smtp'][_0xf6e9('0xe3')];_0x1c344d[_0xf6e9('0xe4')]=_0x138b35[_0xf6e9('0xe0')][_0xf6e9('0xe4')];}if(_0x138b35[_0xf6e9('0xe0')][_0xf6e9('0xe5')]){_0x1c344d[_0xf6e9('0xe6')]={'user':_0x138b35[_0xf6e9('0xe0')]['user'],'pass':_0x138b35['Smtp'][_0xf6e9('0xe7')]};}return respondWithRpcPromise('SendMail',_0xf6e9('0xe8'),{'account':_0x1c344d,'message':{'from':util['format'](_0xf6e9('0xe9'),_0x138b35[_0xf6e9('0x44')],_0x138b35['email']||_0x138b35[_0xf6e9('0xe0')]['user']),'to':_0xbd592c[_0xf6e9('0xe1')],'subject':_0xbd592c[_0xf6e9('0xea')],'html':_0x51770a['body'],'attachments':_0x276654}},client9003)['then'](function(){return _0x51770a;})['catch'](function(_0x2fdf50){console['error'](_0x2fdf50);});}})[_0xf6e9('0x22')](function(){if(_0xbd592c&&_0xbd592c[_0xf6e9('0xdd')]&&_0xbd592c[_0xf6e9('0xeb')]){var _0x1f552c=[];if(_0x3ce98b['length']){_0x1f552c=_0x3ce98b[_0xf6e9('0x40')](function(_0x1ada23){return{'name':_0x1ada23['originalname'],'basename':_0x1ada23[_0xf6e9('0x73')],'type':_0x1ada23[_0xf6e9('0xd8')],'ChatOfflineMessageId':_0x54f87c['id']};});}var _0x3c8e72;if(!_[_0xf6e9('0x7b')](_0xbd592c[_0xf6e9('0xec')])){var _0x166f86=_[_0xf6e9('0x40')](_0x7bc5d7[_0xf6e9('0x5f')],function(_0x5672e3){return _0x5672e3;});var _0x3a2d03=_[_0xf6e9('0xed')](_0x166f86)[0x0];var _0x1ea261=_[_0xf6e9('0xee')](_0x3a2d03,function(_0x267946){return _0x267946;});_0x3c8e72=_0x1ea261[0x1][_0xbd592c[_0xf6e9('0xec')]];}var _0x284fbd={'from':_0x4e5285[_0xf6e9('0xef')],'firstName':_0x4e5285['firstName'],'lastName':_0x4e5285[_0xf6e9('0xac')],'mapKey':'email','message':{'from':_0x4e5285[_0xf6e9('0xef')],'to':_0xbd592c[_0xf6e9('0xd1')]['email'],'cc':'','subject':_[_0xf6e9('0x7b')](_0x3c8e72)?_0xbd592c[_0xf6e9('0xea')]:_0x3c8e72,'messageId':'','sentAt':new Date(),'attach':_0x1f552c['length'],'attachments':_0x1f552c,'originChannel':_0xf6e9('0xf0'),'ChatWebsiteId':_0xbd592c['id'],'ChatOfflineMessageId':_0x51770a['id'],'originTo':_0xbd592c[_0xf6e9('0xd1')][_0xf6e9('0xef')]},'body':_0x51770a[_0xf6e9('0x5f')]};var _0x2144a9={'account':{'id':_0xbd592c[_0xf6e9('0xeb')]},'body':_0x284fbd,'log':_0xf6e9('0xf1')};return respondWithRpcPromise(_0xf6e9('0xf1'),_0xf6e9('0xf2'),_0x2144a9,client9001)[_0xf6e9('0x22')](function(){return _0x51770a;})['catch'](function(_0x188663){console['error'](_0x188663);});}return;})[_0xf6e9('0x22')](function(){if(_0x51770a){return _0x51770a;}})[_0xf6e9('0x22')](respondWithResult(_0x3b77d5,null))[_0xf6e9('0x2b')](function(_0x3e1db3){console[_0xf6e9('0x28')](_0xf6e9('0x2b'),_0x3e1db3);for(var _0x4bec47 of _0x3ce98b){var _0x207632=path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],'server',_0xf6e9('0xcd'),'attachments','offline-chat',_0x4bec47['filename']);fs_extra['remove'](_0x207632)[_0xf6e9('0x2b')](function(_0x35ab66){console[_0xf6e9('0x28')](_0xf6e9('0xf3'),_0x207632,_0x35ab66);});}});};exports[_0xf6e9('0xf4')]=function(_0x297eee,_0x50e7b5,_0x111ecb){return db[_0xf6e9('0xb8')]['find']({'where':{'id':_0x297eee['params']['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x50e7b5,null))[_0xf6e9('0x22')](function(_0xe386b){if(_0xe386b){return _0xe386b[_0xf6e9('0xf4')](_0x297eee[_0xf6e9('0x5f')][_0xf6e9('0x6b')],_[_0xf6e9('0xf5')](_0x297eee['body'],['ids','id'])||{});}})[_0xf6e9('0x22')](respondWithResult(_0x50e7b5,null))[_0xf6e9('0x2b')](handleError(_0x50e7b5,null));};exports[_0xf6e9('0xf6')]=function(_0x329e8c,_0x1b91ea,_0xb27843){var _0x4ee38b={'raw':![],'where':{}};var _0x2eb405={};var _0x19661b={'count':0x0,'rows':[]};return db[_0xf6e9('0x56')][_0xf6e9('0x68')]({'where':{'id':_0x329e8c[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x1b91ea,null))['then'](function(_0x39809a){if(_0x39809a){_0x2eb405[_0xf6e9('0x49')]=_['keys'](db[_0xf6e9('0xb8')][_0xf6e9('0x41')]);_0x2eb405[_0xf6e9('0x45')]=_[_0xf6e9('0x46')](_0x329e8c[_0xf6e9('0x45')]);_0x2eb405[_0xf6e9('0x47')]=_['intersection'](_0x2eb405['model'],_0x2eb405['query']);_0x4ee38b[_0xf6e9('0x4a')]=_[_0xf6e9('0x48')](_0x2eb405[_0xf6e9('0x49')],qs['fields'](_0x329e8c['query'][_0xf6e9('0x4b')]));_0x4ee38b[_0xf6e9('0x4a')]=_0x4ee38b[_0xf6e9('0x4a')][_0xf6e9('0x4c')]?_0x4ee38b[_0xf6e9('0x4a')]:_0x2eb405[_0xf6e9('0x49')];if(!_0x329e8c[_0xf6e9('0x45')][_0xf6e9('0x4d')](_0xf6e9('0x4e'))){_0x4ee38b['limit']=qs[_0xf6e9('0x31')](_0x329e8c[_0xf6e9('0x45')][_0xf6e9('0x31')]);_0x4ee38b['offset']=qs[_0xf6e9('0x2f')](_0x329e8c[_0xf6e9('0x45')][_0xf6e9('0x2f')]);}_0x4ee38b[_0xf6e9('0x4f')]=qs['sort'](_0x329e8c[_0xf6e9('0x45')][_0xf6e9('0x50')]);_0x4ee38b['where']=qs[_0xf6e9('0x47')](_[_0xf6e9('0x52')](_0x329e8c[_0xf6e9('0x45')],_0x2eb405[_0xf6e9('0x47')]));_0x4ee38b[_0xf6e9('0x51')]['ChatWebsiteId']=_0x39809a['id'];if(_0x329e8c[_0xf6e9('0x45')][_0xf6e9('0x53')]){_0x4ee38b[_0xf6e9('0x51')]=_[_0xf6e9('0x5c')](_0x4ee38b['where'],{'$or':_[_0xf6e9('0x40')](_0x4ee38b[_0xf6e9('0x4a')],function(_0x2f3870){var _0x1c6130={};_0x1c6130[_0x2f3870]={'$like':'%'+_0x329e8c[_0xf6e9('0x45')][_0xf6e9('0x53')]+'%'};return _0x1c6130;})});}_0x4ee38b=_[_0xf6e9('0x5c')]({},_0x4ee38b,_0x329e8c[_0xf6e9('0x55')]);return db[_0xf6e9('0xb8')]['count']({'where':_0x4ee38b[_0xf6e9('0x51')]})[_0xf6e9('0x22')](function(_0x4993e8){_0x19661b[_0xf6e9('0x32')]=_0x4993e8;if(_0x329e8c[_0xf6e9('0x45')]['includeAll']){_0x4ee38b[_0xf6e9('0x5b')]=[{'model':db[_0xf6e9('0x8f')],'as':_0xf6e9('0xf7'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xf6e9('0x44'),'fullname',_0xf6e9('0xf8')],'required':![]},{'model':db[_0xf6e9('0xf9')],'as':_0xf6e9('0xfa'),'attributes':['id','name','color'],'where':_0x329e8c[_0xf6e9('0x45')]['tag']?{'id':_0x329e8c[_0xf6e9('0x45')][_0xf6e9('0xfb')]}:undefined,'required':_0x329e8c[_0xf6e9('0x45')][_0xf6e9('0xfb')]?!![]:![]}];}return db[_0xf6e9('0xb8')][_0xf6e9('0x57')](_0x4ee38b);})['then'](function(_0x1fbb14){_0x19661b[_0xf6e9('0x58')]=_0x1fbb14;return _0x19661b;});}})[_0xf6e9('0x22')](respondWithFilteredResult(_0x1b91ea,_0x4ee38b))[_0xf6e9('0x2b')](handleError(_0x1b91ea,null));};function iftimePromise(_0x4c7f0e,_0x25610c){return respondWithRpcPromise(_0xf6e9('0xfc'),'getSnippet',{'command':_0x25610c['timezone']?util[_0xf6e9('0xb0')](_0xf6e9('0xfd'),_0x4c7f0e['interval'],_0x25610c[_0xf6e9('0xfe')]):util[_0xf6e9('0xb0')]('iftime\x20%s',_0x4c7f0e[_0xf6e9('0xff')])},client9002)[_0xf6e9('0x22')](function(_0x386748){var _0x3a2621=_0x386748&&_0x386748['indexOf'](_0xf6e9('0x100'))>=0x0?!![]:![];logger[_0xf6e9('0x23')](_0xf6e9('0x101'),_0x25610c['id'],_0x4c7f0e['id'],_0x4c7f0e[_0xf6e9('0xff')],_0x3a2621?_0xf6e9('0x102'):_0xf6e9('0x103'),_0x25610c['timezone']?_0x25610c[_0xf6e9('0xfe')]:'No\x20timezone');return _0x3a2621;})[_0xf6e9('0x2b')](function(_0x273bce){logger[_0xf6e9('0x28')](_0xf6e9('0x101'),_0x25610c['id'],_0x4c7f0e['id'],_0x4c7f0e['interval'],util[_0xf6e9('0x104')](_0x273bce,{'showHidden':![],'depth':null}),_0x25610c[_0xf6e9('0xfe')]?_0x25610c[_0xf6e9('0xfe')]:_0xf6e9('0x105'));return![];});}exports[_0xf6e9('0x106')]=function(_0x243feb,_0x3f6bf7,_0x5a7060){var _0x4fe6e8=0x0;var _0x3acee6=0x0;var _0x2b54ea=![];var _0x3bd6bc;var _0x503330;return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0x243feb[_0xf6e9('0x5a')]['id']},'include':[{'model':db[_0xf6e9('0x107')],'as':'Interval','include':[{'model':db[_0xf6e9('0x107')],'as':_0xf6e9('0x108'),'attributes':['id',_0xf6e9('0xff')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3f6bf7,null))[_0xf6e9('0x22')](function(_0x3f341e){if(_0x3f341e){_0x3bd6bc=_0x3f341e;return _0x3f341e[_0xf6e9('0x109')]({'raw':!![]});}})[_0xf6e9('0x22')](function(_0x3ad84a){if(_0x3bd6bc){if(_0x3ad84a){_0x503330=_0x3ad84a;}}return require('../../config/license/util')[_0xf6e9('0x7a')]();})['then'](function(_0x4f812a){if(_0x4f812a){_0x3acee6=_0x4f812a[_0xf6e9('0x10a')];_0x2b54ea=_0x4f812a['custom'];}})[_0xf6e9('0x22')](function(){return db[_0xf6e9('0xb8')][_0xf6e9('0x32')]({'where':{'closed':![]}});})['then'](function(_0x53374f){_0x4fe6e8=_0x53374f;if(_0x3acee6&&_0x53374f>_0x3acee6){return db[_0xf6e9('0x10b')][_0xf6e9('0x68')]({'where':{'id':0x1}})[_0xf6e9('0x22')](function(_0xfcad4a){if(_0xfcad4a){_0xfcad4a[_0xf6e9('0x10c')]('chatLicenseExceeded');}});}})[_0xf6e9('0x22')](function(){if(_0x3bd6bc[_0xf6e9('0x107')]&&_0x3bd6bc['Interval'][_0xf6e9('0x108')]){var _0x579b45=[];for(var _0x5aab7d=0x0;_0x5aab7d<_0x3bd6bc[_0xf6e9('0x107')][_0xf6e9('0x108')][_0xf6e9('0x4c')];_0x5aab7d++){var _0x4afc43=_0x3bd6bc[_0xf6e9('0x107')][_0xf6e9('0x108')][_0x5aab7d][_0xf6e9('0x38')]({'plain':!![]});_0x579b45['push'](iftimePromise(_0x4afc43,_0x3bd6bc));}return BPromise['all'](_0x579b45)[_0xf6e9('0x22')](function(_0x3c9dd1){return _['some'](_0x3c9dd1);});}else{return!![];}})[_0xf6e9('0x22')](function(_0x2672f0){var _0x1951cf=fs[_0xf6e9('0xd2')](path[_0xf6e9('0x7d')](config[_0xf6e9('0x79')],_0xf6e9('0x10d')),_0xf6e9('0x10e'));var _0x121a5a={'remote':_0x3bd6bc[_0xf6e9('0x10f')],'query':querystring['stringify'](_['merge'](_0x3bd6bc[_0xf6e9('0x38')]({'plain':!![]}),{'customerIp':_0x243feb[_0xf6e9('0x8b')][_0xf6e9('0xa9')]||_0x243feb['headers'][_0xf6e9('0x110')]||_0x243feb[_0xf6e9('0x111')][_0xf6e9('0x112')]||_0x243feb['ip'],'referer':_0x243feb[_0xf6e9('0x8b')][_0xf6e9('0xae')],'openedInteractions':_0x4fe6e8,'maxInteractions':_0x3acee6,'virtual':_0x2b54ea[_0xf6e9('0x10a')],'online':_0x2672f0,'custom':_0x2b54ea}))[_0xf6e9('0x113')](/'/g,'\x5c\x27')};_0x3f6bf7[_0xf6e9('0x3c')](ejs[_0xf6e9('0xd3')](Mustache[_0xf6e9('0xd3')](_0x1951cf,_0x121a5a),{'proactiveActions':_0x503330,'alignment':_0x3bd6bc[_0xf6e9('0x114')],'verticalAlignment':_0x3bd6bc['verticalAlignment'],'div_color':_0x3bd6bc['color'],'text_color':_0x3bd6bc[_0xf6e9('0x115')],'button_color':_0x3bd6bc[_0xf6e9('0x116')],'background_color':_0x3bd6bc['backgroundColor']}));})[_0xf6e9('0x2b')](handleError(_0x3f6bf7,null));};exports[_0xf6e9('0x117')]=function(_0x1f668b,_0x2c2a34,_0x11d665){return db[_0xf6e9('0x56')][_0xf6e9('0x68')]({'where':{'id':_0x1f668b['params']['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x2c2a34,null))[_0xf6e9('0x22')](function(_0x51bcfd){if(_0x51bcfd){return db[_0xf6e9('0xde')][_0xf6e9('0x118')](function(_0x2c1d54){return db['ChatApplication'][_0xf6e9('0x37')]({'where':{'ChatWebsiteId':_0x1f668b['params']['id']},'transaction':_0x2c1d54})[_0xf6e9('0x22')](function(_0x53bd22){var _0x19b486=_['map'](_0x1f668b['body'],function(_0x46f51c){_0x46f51c['ChatWebsiteId']=_0x1f668b[_0xf6e9('0x5a')]['id'];return _0x46f51c;});return db[_0xf6e9('0x9f')][_0xf6e9('0x119')](_0x19b486,{'transaction':_0x2c1d54});});})[_0xf6e9('0x22')](function(){return db[_0xf6e9('0x9f')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1f668b[_0xf6e9('0x5a')]['id']},'order':_0xf6e9('0xa3')});});}})[_0xf6e9('0x22')](respondWithResult(_0x2c2a34,null))[_0xf6e9('0x2b')](handleError(_0x2c2a34,null));};exports[_0xf6e9('0x11a')]=function(_0x189e1a,_0x2f7925,_0x45b455){var _0x4bb45d={};var _0x2aa387={};var _0xaab1d8;var _0x302214;return db[_0xf6e9('0x56')][_0xf6e9('0x68')]({'where':{'id':_0x189e1a[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x2f7925,null))[_0xf6e9('0x22')](function(_0x15d1b7){if(_0x15d1b7){_0xaab1d8=_0x15d1b7;_0x2aa387[_0xf6e9('0x49')]=_[_0xf6e9('0x46')](db[_0xf6e9('0x9f')][_0xf6e9('0x41')]);_0x2aa387[_0xf6e9('0x45')]=_[_0xf6e9('0x46')](_0x189e1a[_0xf6e9('0x45')]);_0x2aa387['filters']=_[_0xf6e9('0x48')](_0x2aa387[_0xf6e9('0x49')],_0x2aa387[_0xf6e9('0x45')]);_0x4bb45d[_0xf6e9('0x4a')]=_[_0xf6e9('0x48')](_0x2aa387[_0xf6e9('0x49')],qs['fields'](_0x189e1a[_0xf6e9('0x45')]['fields']));_0x4bb45d[_0xf6e9('0x4a')]=_0x4bb45d[_0xf6e9('0x4a')][_0xf6e9('0x4c')]?_0x4bb45d[_0xf6e9('0x4a')]:_0x2aa387[_0xf6e9('0x49')];_0x4bb45d[_0xf6e9('0x4f')]=qs[_0xf6e9('0x50')](_0x189e1a[_0xf6e9('0x45')][_0xf6e9('0x50')]);_0x4bb45d[_0xf6e9('0x51')]=qs['filters'](_[_0xf6e9('0x52')](_0x189e1a[_0xf6e9('0x45')],_0x2aa387[_0xf6e9('0x47')]));if(_0x189e1a[_0xf6e9('0x45')][_0xf6e9('0x53')]){_0x4bb45d[_0xf6e9('0x51')]=_[_0xf6e9('0x5c')](_0x4bb45d[_0xf6e9('0x51')],{'$or':_[_0xf6e9('0x40')](_0x4bb45d[_0xf6e9('0x4a')],function(_0x490730){var _0xea9909={};_0xea9909[_0x490730]={'$like':'%'+_0x189e1a[_0xf6e9('0x45')][_0xf6e9('0x53')]+'%'};return _0xea9909;})});}_0x4bb45d=_[_0xf6e9('0x5c')]({},_0x4bb45d,_0x189e1a[_0xf6e9('0x55')]);return _0xaab1d8['getApplications'](_0x4bb45d);}})[_0xf6e9('0x22')](function(_0x43e60a){if(_0x43e60a){_0x302214=_0x43e60a['length'];if(!_0x189e1a[_0xf6e9('0x45')]['hasOwnProperty'](_0xf6e9('0x4e'))){_0x4bb45d[_0xf6e9('0x31')]=qs[_0xf6e9('0x31')](_0x189e1a[_0xf6e9('0x45')][_0xf6e9('0x31')]);_0x4bb45d[_0xf6e9('0x2f')]=qs['offset'](_0x189e1a[_0xf6e9('0x45')][_0xf6e9('0x2f')]);}return _0xaab1d8[_0xf6e9('0x11a')](_0x4bb45d);}})[_0xf6e9('0x22')](function(_0x358caf){if(_0x358caf){return _0x358caf?{'count':_0x302214,'rows':_0x358caf}:null;}})[_0xf6e9('0x22')](respondWithResult(_0x2f7925,null))['catch'](handleError(_0x2f7925,null));};exports[_0xf6e9('0x11b')]=function(_0x449f4c,_0x3b00cd,_0x332fd0){return db[_0xf6e9('0x11c')][_0xf6e9('0x5d')]({'where':{'id':_0x449f4c[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x3b00cd,null))[_0xf6e9('0x22')](function(_0x40e196){if(_0x40e196){return _0x40e196['addProactiveActions'](_0x449f4c[_0xf6e9('0x5f')][_0xf6e9('0x6b')],_[_0xf6e9('0xf5')](_0x449f4c[_0xf6e9('0x5f')],[_0xf6e9('0x6b'),'id'])||{});}})[_0xf6e9('0x22')](respondWithResult(_0x3b00cd,null))[_0xf6e9('0x2b')](handleError(_0x3b00cd,null));};exports['getProactiveActions']=function(_0x545542,_0x303007,_0x1334a4){var _0x4232f9={};var _0x17fc8f={};var _0x55b461;var _0x335005;return db[_0xf6e9('0x56')]['findOne']({'where':{'id':_0x545542[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x303007,null))[_0xf6e9('0x22')](function(_0x572783){if(_0x572783){_0x55b461=_0x572783;_0x17fc8f[_0xf6e9('0x49')]=_[_0xf6e9('0x46')](db[_0xf6e9('0x11d')][_0xf6e9('0x41')]);_0x17fc8f['query']=_[_0xf6e9('0x46')](_0x545542[_0xf6e9('0x45')]);_0x17fc8f[_0xf6e9('0x47')]=_[_0xf6e9('0x48')](_0x17fc8f[_0xf6e9('0x49')],_0x17fc8f[_0xf6e9('0x45')]);_0x4232f9['attributes']=_['intersection'](_0x17fc8f['model'],qs['fields'](_0x545542[_0xf6e9('0x45')][_0xf6e9('0x4b')]));_0x4232f9[_0xf6e9('0x4a')]=_0x4232f9['attributes'][_0xf6e9('0x4c')]?_0x4232f9[_0xf6e9('0x4a')]:_0x17fc8f[_0xf6e9('0x49')];_0x4232f9['order']=qs[_0xf6e9('0x50')](_0x545542[_0xf6e9('0x45')][_0xf6e9('0x50')]);_0x4232f9[_0xf6e9('0x51')]=qs[_0xf6e9('0x47')](_[_0xf6e9('0x52')](_0x545542[_0xf6e9('0x45')],_0x17fc8f[_0xf6e9('0x47')]));if(_0x545542[_0xf6e9('0x45')]['filter']){_0x4232f9[_0xf6e9('0x51')]=_[_0xf6e9('0x5c')](_0x4232f9['where'],{'$or':_['map'](_0x4232f9[_0xf6e9('0x4a')],function(_0x39c0e4){var _0x5f20ff={};_0x5f20ff[_0x39c0e4]={'$like':'%'+_0x545542[_0xf6e9('0x45')][_0xf6e9('0x53')]+'%'};return _0x5f20ff;})});}_0x4232f9=_[_0xf6e9('0x5c')]({},_0x4232f9,_0x545542[_0xf6e9('0x55')]);return _0x55b461['getProactiveActions'](_0x4232f9);}})['then'](function(_0x1c20be){if(_0x1c20be){_0x335005=_0x1c20be[_0xf6e9('0x4c')];if(!_0x545542[_0xf6e9('0x45')][_0xf6e9('0x4d')](_0xf6e9('0x4e'))){_0x4232f9[_0xf6e9('0x31')]=qs[_0xf6e9('0x31')](_0x545542[_0xf6e9('0x45')][_0xf6e9('0x31')]);_0x4232f9[_0xf6e9('0x2f')]=qs[_0xf6e9('0x2f')](_0x545542['query']['offset']);}return _0x55b461[_0xf6e9('0x109')](_0x4232f9);}})[_0xf6e9('0x22')](function(_0x27afd1){if(_0x27afd1){return _0x27afd1?{'count':_0x335005,'rows':_0x27afd1}:null;}})[_0xf6e9('0x22')](respondWithResult(_0x303007,null))[_0xf6e9('0x2b')](handleError(_0x303007,null));};exports[_0xf6e9('0x11e')]=function(_0x100edb,_0x337e37,_0x28a1a7){var _0x57d9e4=_0x100edb[_0xf6e9('0x45')]['online']===_0xf6e9('0x11f')?'offlineForm':_0xf6e9('0x120');return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'attributes':['id',_0x57d9e4],'where':{'id':_0x100edb[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x337e37,null))[_0xf6e9('0x22')](function(_0x2971e0){if(_0x2971e0){var _0xb56642=_0x2971e0[_0x57d9e4];var _0x2e03af=_0xb56642&&_0xb56642[_0xf6e9('0x121')]?_0xb56642[_0xf6e9('0x121')]:[];_0x337e37[_0xf6e9('0x3c')]({'fromKey':_[_0xf6e9('0x7b')](_0xb56642[_0xf6e9('0x122')])?undefined:_0xb56642[_0xf6e9('0x122')],'count':_0x2e03af[_0xf6e9('0x4c')],'rows':_0x2e03af});}})[_0xf6e9('0x2b')](handleError(_0x337e37,null));};exports[_0xf6e9('0x123')]=function(_0x3d1940,_0x343e35,_0x448032){var _0x4f496d={'raw':![],'where':{}};var _0x46c6ee={};var _0x21be4d={'count':0x0,'rows':[]};return db[_0xf6e9('0x56')][_0xf6e9('0x68')]({'where':{'id':_0x3d1940[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x343e35,null))[_0xf6e9('0x22')](function(_0x290252){if(_0x290252){_0x46c6ee[_0xf6e9('0x49')]=_[_0xf6e9('0x46')](db['ChatOfflineMessage'][_0xf6e9('0x41')]);_0x46c6ee['query']=_[_0xf6e9('0x46')](_0x3d1940[_0xf6e9('0x45')]);_0x46c6ee['filters']=_[_0xf6e9('0x48')](_0x46c6ee['model'],_0x46c6ee[_0xf6e9('0x45')]);_0x4f496d['attributes']=_[_0xf6e9('0x48')](_0x46c6ee['model'],qs['fields'](_0x3d1940[_0xf6e9('0x45')][_0xf6e9('0x4b')]));_0x4f496d[_0xf6e9('0x4a')]=_0x4f496d[_0xf6e9('0x4a')][_0xf6e9('0x4c')]?_0x4f496d['attributes']:_0x46c6ee['model'];if(!_0x3d1940[_0xf6e9('0x45')][_0xf6e9('0x4d')]('nolimit')){_0x4f496d['limit']=qs['limit'](_0x3d1940['query'][_0xf6e9('0x31')]);_0x4f496d[_0xf6e9('0x2f')]=qs[_0xf6e9('0x2f')](_0x3d1940[_0xf6e9('0x45')]['offset']);}_0x4f496d[_0xf6e9('0x4f')]=qs[_0xf6e9('0x50')](_0x3d1940[_0xf6e9('0x45')]['sort']);_0x4f496d[_0xf6e9('0x51')]=qs[_0xf6e9('0x47')](_[_0xf6e9('0x52')](_0x3d1940['query'],_0x46c6ee[_0xf6e9('0x47')]));_0x4f496d[_0xf6e9('0x51')][_0xf6e9('0x6d')]=_0x290252['id'];if(_0x3d1940['query'][_0xf6e9('0x53')]){_0x4f496d[_0xf6e9('0x51')]=_['merge'](_0x4f496d['where'],{'$or':_[_0xf6e9('0x40')](_0x4f496d[_0xf6e9('0x4a')],function(_0x3f3556){var _0x5226f5={};_0x5226f5[_0x3f3556]={'$like':'%'+_0x3d1940[_0xf6e9('0x45')][_0xf6e9('0x53')]+'%'};return _0x5226f5;})});}_0x4f496d=_['merge']({},_0x4f496d,_0x3d1940[_0xf6e9('0x55')]);return db[_0xf6e9('0xd6')][_0xf6e9('0x32')]({'where':_0x4f496d['where']})[_0xf6e9('0x22')](function(_0x57c768){_0x21be4d[_0xf6e9('0x32')]=_0x57c768;if(_0x3d1940['query']['includeAll']){_0x4f496d[_0xf6e9('0x5b')]=[{'all':!![]}];}else{_0x4f496d[_0xf6e9('0x5b')]=[{'model':db[_0xf6e9('0x8f')],'as':'Contact','required':![]},{'model':db[_0xf6e9('0x124')],'as':_0xf6e9('0x125'),'required':![]}];}return db[_0xf6e9('0xd6')][_0xf6e9('0x57')](_0x4f496d);})[_0xf6e9('0x22')](function(_0x2d017c){_0x21be4d[_0xf6e9('0x58')]=_0x2d017c;return _0x21be4d;});}})['then'](respondWithFilteredResult(_0x343e35,_0x4f496d))[_0xf6e9('0x2b')](handleError(_0x343e35,null));};exports[_0xf6e9('0x126')]=function(_0xb2125a,_0x29d620,_0x3c2114){return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0xb2125a[_0xf6e9('0x5a')]['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x29d620,null))[_0xf6e9('0x22')](function(_0x3ac055){if(_0x3ac055){return _0x3ac055[_0xf6e9('0x126')](_0xb2125a[_0xf6e9('0x5f')][_0xf6e9('0x6b')],_[_0xf6e9('0xf5')](_0xb2125a[_0xf6e9('0x5f')],[_0xf6e9('0x6b'),'id'])||{})[_0xf6e9('0xbc')](function(_0x5ebfc3){for(var _0x265e42=0x0;_0x265e42<_0xb2125a[_0xf6e9('0x5f')][_0xf6e9('0x6b')][_0xf6e9('0x4c')];_0x265e42+=0x1){socket['emit'](_0xf6e9('0x127'),{'UserId':Number(_0xb2125a[_0xf6e9('0x5f')][_0xf6e9('0x6b')][_0x265e42]),'ChatWebsiteId':Number(_0xb2125a['params']['id'])});}return _0x5ebfc3;});}})[_0xf6e9('0x22')](respondWithResult(_0x29d620,null))[_0xf6e9('0x2b')](handleError(_0x29d620,null));};exports[_0xf6e9('0x128')]=function(_0xc3548c,_0x5680dd,_0x5e154b){return db[_0xf6e9('0x56')][_0xf6e9('0x5d')]({'where':{'id':_0xc3548c['params']['id']}})[_0xf6e9('0x22')](handleEntityNotFound(_0x5680dd,null))[_0xf6e9('0x22')](function(_0x1da778){if(_0x1da778){return _0x1da778[_0xf6e9('0x128')](_0xc3548c[_0xf6e9('0x45')][_0xf6e9('0x6b')])['then'](function(){if(_[_0xf6e9('0x129')](_0xc3548c['query'][_0xf6e9('0x6b')])){for(var _0x4a8b92=0x0;_0x4a8b92<_0xc3548c[_0xf6e9('0x45')]['ids'][_0xf6e9('0x4c')];_0x4a8b92+=0x1){socket[_0xf6e9('0x12a')](_0xf6e9('0x12b'),{'UserId':Number(_0xc3548c[_0xf6e9('0x45')][_0xf6e9('0x6b')][_0x4a8b92]),'ChatWebsiteId':Number(_0xc3548c[_0xf6e9('0x5a')]['id'])});}}else{socket[_0xf6e9('0x12a')](_0xf6e9('0x12b'),{'UserId':Number(_0xc3548c['query']['ids']),'ChatWebsiteId':Number(_0xc3548c[_0xf6e9('0x5a')]['id'])});}});}})[_0xf6e9('0x22')](respondWithStatusCode(_0x5680dd,null))[_0xf6e9('0x2b')](handleError(_0x5680dd,null));};exports[_0xf6e9('0x12c')]=function(_0x4a3d6d,_0x5531ce,_0x2849d5){var _0x5afad7={};var _0x892cca={};var _0x117820;var _0x3c78d9;return db[_0xf6e9('0x56')][_0xf6e9('0x68')]({'where':{'id':_0x4a3d6d[_0xf6e9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5531ce,null))[_0xf6e9('0x22')](function(_0x2881b2){if(_0x2881b2){_0x117820=_0x2881b2;_0x892cca[_0xf6e9('0x49')]=_['keys'](db[_0xf6e9('0xc5')][_0xf6e9('0x41')]);_0x892cca['query']=_[_0xf6e9('0x46')](_0x4a3d6d['query']);_0x892cca[_0xf6e9('0x47')]=_[_0xf6e9('0x48')](_0x892cca['model'],_0x892cca['query']);_0x5afad7[_0xf6e9('0x4a')]=_[_0xf6e9('0x48')](_0x892cca[_0xf6e9('0x49')],qs['fields'](_0x4a3d6d['query'][_0xf6e9('0x4b')]));_0x5afad7[_0xf6e9('0x4a')]=_0x5afad7['attributes'][_0xf6e9('0x4c')]?_0x5afad7[_0xf6e9('0x4a')]:_0x892cca['model'];_0x5afad7['order']=qs[_0xf6e9('0x50')](_0x4a3d6d['query'][_0xf6e9('0x50')]);_0x5afad7[_0xf6e9('0x51')]=qs['filters'](_[_0xf6e9('0x52')](_0x4a3d6d[_0xf6e9('0x45')],_0x892cca['filters']));if(_0x4a3d6d[_0xf6e9('0x45')][_0xf6e9('0x53')]){_0x5afad7[_0xf6e9('0x51')]=_[_0xf6e9('0x5c')](_0x5afad7[_0xf6e9('0x51')],{'$or':_[_0xf6e9('0x40')](_0x5afad7['attributes'],function(_0x5c3c6a){var _0x427d09={};_0x427d09[_0x5c3c6a]={'$like':'%'+_0x4a3d6d[_0xf6e9('0x45')][_0xf6e9('0x53')]+'%'};return _0x427d09;})});}_0x5afad7=_['merge']({},_0x5afad7,_0x4a3d6d[_0xf6e9('0x55')]);return _0x117820[_0xf6e9('0x12c')](_0x5afad7);}})['then'](function(_0xba0834){if(_0xba0834){_0x3c78d9=_0xba0834[_0xf6e9('0x4c')];if(!_0x4a3d6d['query']['hasOwnProperty'](_0xf6e9('0x4e'))){_0x5afad7[_0xf6e9('0x31')]=qs[_0xf6e9('0x31')](_0x4a3d6d[_0xf6e9('0x45')][_0xf6e9('0x31')]);_0x5afad7[_0xf6e9('0x2f')]=qs[_0xf6e9('0x2f')](_0x4a3d6d['query'][_0xf6e9('0x2f')]);}return _0x117820[_0xf6e9('0x12c')](_0x5afad7);}})['then'](function(_0x1d252a){if(_0x1d252a){return _0x1d252a?{'count':_0x3c78d9,'rows':_0x1d252a}:null;}})[_0xf6e9('0x22')](respondWithResult(_0x5531ce,null))[_0xf6e9('0x2b')](handleError(_0x5531ce,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 08c1ca0..a700267 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 _0x202c=['save','update','emit','hasOwnProperty','exports','events','setMaxListeners'];(function(_0x692282,_0x279660){var _0x172aa8=function(_0x5bd982){while(--_0x5bd982){_0x692282['push'](_0x692282['shift']());}};_0x172aa8(++_0x279660);}(_0x202c,0x178));var _0xc202=function(_0x3536d1,_0x555abb){_0x3536d1=_0x3536d1-0x0;var _0x27ba9d=_0x202c[_0x3536d1];return _0x27ba9d;};'use strict';var EventEmitter=require(_0xc202('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc202('0x1')](0x0);var events={'afterCreate':_0xc202('0x2'),'afterUpdate':_0xc202('0x3'),'afterDestroy':'remove'};function emitEvent(_0x215161){return function(_0x155c3b,_0x1763f5,_0x1a75ed){ChatWebsiteEvents['emit'](_0x215161+':'+_0x155c3b['id'],_0x155c3b);ChatWebsiteEvents[_0xc202('0x4')](_0x215161,_0x155c3b);_0x1a75ed(null);};}for(var e in events){if(events[_0xc202('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xc202('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x3a0f=['exports','ChatWebsite','update','remove','emit','hook'];(function(_0x14f9b1,_0x48441c){var _0x14c44d=function(_0x4e2033){while(--_0x4e2033){_0x14f9b1['push'](_0x14f9b1['shift']());}};_0x14c44d(++_0x48441c);}(_0x3a0f,0x145));var _0xf3a0=function(_0x1185fb,_0x37613d){_0x1185fb=_0x1185fb-0x0;var _0x478556=_0x3a0f[_0x1185fb];return _0x478556;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0xf3a0('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf3a0('0x1'),'afterDestroy':_0xf3a0('0x2')};function emitEvent(_0x154115){return function(_0x31a1b4,_0x3d0886,_0xa3ed18){ChatWebsiteEvents[_0xf3a0('0x3')](_0x154115+':'+_0x31a1b4['id'],_0x31a1b4);ChatWebsiteEvents[_0xf3a0('0x3')](_0x154115,_0x31a1b4);_0xa3ed18(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xf3a0('0x4')](e,emitEvent(event));}}module[_0xf3a0('0x5')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 21ddb47..907b420 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 _0x1207=['exports','define','ChatWebsite','chat_websites','util','../../config/logger','bluebird','path','../../config/environment','./chatWebsite.attributes'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x1207,0x194));var _0x7120=function(_0x2bd08d,_0x322a50){_0x2bd08d=_0x2bd08d-0x0;var _0x1d2e2d=_0x1207[_0x2bd08d];return _0x1d2e2d;};'use strict';var _=require('lodash');var util=require(_0x7120('0x0'));var logger=require(_0x7120('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7120('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7120('0x3'));var rimraf=require('rimraf');var config=require(_0x7120('0x4'));var attributes=require(_0x7120('0x5'));module[_0x7120('0x6')]=function(_0x47d139,_0x494a81){return _0x47d139[_0x7120('0x7')](_0x7120('0x8'),attributes,{'tableName':_0x7120('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x036c=['bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','chat_websites','lodash','../../config/logger','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x036c,0x189));var _0xc036=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x036c[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xc036('0x0'));var util=require('util');var logger=require(_0xc036('0x1'))('api');var moment=require(_0xc036('0x2'));var BPromise=require(_0xc036('0x3'));var rp=require(_0xc036('0x4'));var fs=require('fs');var path=require(_0xc036('0x5'));var rimraf=require(_0xc036('0x6'));var config=require(_0xc036('0x7'));var attributes=require(_0xc036('0x8'));module[_0xc036('0x9')]=function(_0x36fa5b,_0xb8f234){return _0x36fa5b['define']('ChatWebsite',attributes,{'tableName':_0xc036('0xa'),'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 6fc4146..413ba06 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 _0x5812=['register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket'];(function(_0x531034,_0x13c1ec){var _0x225fcd=function(_0x591026){while(--_0x591026){_0x531034['push'](_0x531034['shift']());}};_0x225fcd(++_0x13c1ec);}(_0x5812,0xa6));var _0x2581=function(_0x3d5a85,_0xe82e44){_0x3d5a85=_0x3d5a85-0x0;var _0x403a6f=_0x5812[_0x3d5a85];return _0x403a6f;};'use strict';var _=require('lodash');var util=require(_0x2581('0x0'));var moment=require(_0x2581('0x1'));var BPromise=require(_0x2581('0x2'));var rs=require(_0x2581('0x3'));var fs=require('fs');var Redis=require(_0x2581('0x4'));var db=require(_0x2581('0x5'))['db'];var utils=require(_0x2581('0x6'));var logger=require(_0x2581('0x7'))('rpc');var config=require(_0x2581('0x8'));var jayson=require(_0x2581('0x9'));var client=jayson[_0x2581('0xa')][_0x2581('0xb')]({'port':0x232a});config[_0x2581('0xc')]=_[_0x2581('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2581('0xe'))(new Redis(config[_0x2581('0xc')]));require(_0x2581('0xf'))[_0x2581('0x10')](socket);function respondWithRpcPromise(_0x46e983,_0x42a388,_0x127264){return new BPromise(function(_0x59fc92,_0x442838){return client[_0x2581('0x11')](_0x46e983,_0x127264)['then'](function(_0x5c1781){logger['info'](_0x2581('0x12'),_0x42a388,_0x2581('0x13'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x42a388,_0x2581('0x13'),JSON[_0x2581('0x14')](_0x5c1781));if(_0x5c1781[_0x2581('0x15')]){if(_0x5c1781['error'][_0x2581('0x16')]===0x1f4){logger[_0x2581('0x15')](_0x2581('0x12'),_0x42a388,_0x5c1781['error'][_0x2581('0x17')]);return _0x442838(_0x5c1781[_0x2581('0x15')][_0x2581('0x17')]);}logger[_0x2581('0x15')](_0x2581('0x12'),_0x42a388,_0x5c1781[_0x2581('0x15')][_0x2581('0x17')]);return _0x59fc92(_0x5c1781[_0x2581('0x15')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x42a388,_0x2581('0x13'));_0x59fc92(_0x5c1781[_0x2581('0x18')][_0x2581('0x17')]);}})[_0x2581('0x19')](function(_0x51771e){logger[_0x2581('0x15')](_0x2581('0x12'),_0x42a388,_0x51771e);_0x442838(_0x51771e);});});} \ No newline at end of file +var _0x5d9c=['message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error'];(function(_0xe51964,_0x433b90){var _0x2c2366=function(_0x1bc95c){while(--_0x1bc95c){_0xe51964['push'](_0xe51964['shift']());}};_0x2c2366(++_0x433b90);}(_0x5d9c,0xa5));var _0xc5d9=function(_0x2387ac,_0x45fcfc){_0x2387ac=_0x2387ac-0x0;var _0xb56c58=_0x5d9c[_0x2387ac];return _0xb56c58;};'use strict';var _=require(_0xc5d9('0x0'));var util=require(_0xc5d9('0x1'));var moment=require('moment');var BPromise=require(_0xc5d9('0x2'));var rs=require(_0xc5d9('0x3'));var fs=require('fs');var Redis=require(_0xc5d9('0x4'));var db=require(_0xc5d9('0x5'))['db'];var utils=require(_0xc5d9('0x6'));var logger=require(_0xc5d9('0x7'))(_0xc5d9('0x8'));var config=require('../../config/environment');var jayson=require(_0xc5d9('0x9'));var client=jayson[_0xc5d9('0xa')][_0xc5d9('0xb')]({'port':0x232a});config[_0xc5d9('0xc')]=_[_0xc5d9('0xd')](config[_0xc5d9('0xc')],{'host':_0xc5d9('0xe'),'port':0x18eb});var socket=require(_0xc5d9('0xf'))(new Redis(config[_0xc5d9('0xc')]));require(_0xc5d9('0x10'))[_0xc5d9('0x11')](socket);function respondWithRpcPromise(_0x5745fc,_0x20ff22,_0x5df21f){return new BPromise(function(_0x42921a,_0x38d146){return client[_0xc5d9('0x12')](_0x5745fc,_0x5df21f)[_0xc5d9('0x13')](function(_0x37954a){logger['info'](_0xc5d9('0x14'),_0x20ff22,_0xc5d9('0x15'));logger['debug'](_0xc5d9('0x16'),_0x20ff22,'request\x20sent',JSON['stringify'](_0x37954a));if(_0x37954a[_0xc5d9('0x17')]){if(_0x37954a[_0xc5d9('0x17')]['code']===0x1f4){logger['error'](_0xc5d9('0x14'),_0x20ff22,_0x37954a[_0xc5d9('0x17')]['message']);return _0x38d146(_0x37954a[_0xc5d9('0x17')][_0xc5d9('0x18')]);}logger[_0xc5d9('0x17')](_0xc5d9('0x14'),_0x20ff22,_0x37954a[_0xc5d9('0x17')][_0xc5d9('0x18')]);return _0x42921a(_0x37954a[_0xc5d9('0x17')]['message']);}else{logger[_0xc5d9('0x19')](_0xc5d9('0x14'),_0x20ff22,'request\x20sent');_0x42921a(_0x37954a[_0xc5d9('0x1a')]['message']);}})['catch'](function(_0x18947b){logger[_0xc5d9('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x20ff22,_0x18947b);_0x38d146(_0x18947b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 3f7a339..e0175b9 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 _0x9129=['save','update','register','length','./chatWebsite.events'];(function(_0x57a0df,_0x2959d0){var _0x1e3442=function(_0x4ba681){while(--_0x4ba681){_0x57a0df['push'](_0x57a0df['shift']());}};_0x1e3442(++_0x2959d0);}(_0x9129,0x1da));var _0x9912=function(_0x251421,_0x34bf49){_0x251421=_0x251421-0x0;var _0xe9bbff=_0x9129[_0x251421];return _0xe9bbff;};'use strict';var ChatWebsiteEvents=require(_0x9912('0x0'));var events=[_0x9912('0x1'),'remove',_0x9912('0x2')];function createListener(_0x4966e8,_0x4a8017){return function(_0x5b1d99){_0x4a8017['emit'](_0x4966e8,_0x5b1d99);};}function removeListener(_0x20daed,_0xfe1023){return function(){ChatWebsiteEvents['removeListener'](_0x20daed,_0xfe1023);};}exports[_0x9912('0x3')]=function(_0x20c6bc){for(var _0x2cdda7=0x0,_0x5ce271=events[_0x9912('0x4')];_0x2cdda7<_0x5ce271;_0x2cdda7++){var _0x2afe9b=events[_0x2cdda7];var _0x2cd20a=createListener('chatWebsite:'+_0x2afe9b,_0x20c6bc);ChatWebsiteEvents['on'](_0x2afe9b,_0x2cd20a);}}; \ No newline at end of file +var _0xecce=['remove','emit','removeListener','chatWebsite:'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xecce,0x1a4));var _0xeecc=function(_0x51b255,_0x2a91cf){_0x51b255=_0x51b255-0x0;var _0x43bd02=_0xecce[_0x51b255];return _0x43bd02;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xeecc('0x0'),'update'];function createListener(_0x53402b,_0xd2e85b){return function(_0x56908c){_0xd2e85b[_0xeecc('0x1')](_0x53402b,_0x56908c);};}function removeListener(_0x1d3ee2,_0x361a85){return function(){ChatWebsiteEvents[_0xeecc('0x2')](_0x1d3ee2,_0x361a85);};}exports['register']=function(_0x2aa21f){for(var _0x562083=0x0,_0x167e84=events['length'];_0x562083<_0x167e84;_0x562083++){var _0x3c60f0=events[_0x562083];var _0xf86cae=createListener(_0xeecc('0x3')+_0x3c60f0,_0x2aa21f);ChatWebsiteEvents['on'](_0x3c60f0,_0xf86cae);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index f41e1e8..0174234 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 _0xa7cd=['addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','single','file','addLogo','server/files/images/avatars/','%s-%s','now','originalname','addAvatar','addCustomerAvatar','/:id/notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa7cd,0x182));var _0xda7c=function(_0x5f5b7a,_0x563e61){_0x5f5b7a=_0x5f5b7a-0x0;var _0x7d276d=_0xa7cd[_0x5f5b7a];return _0x7d276d;};'use strict';var multer=require('multer');var util=require(_0xda7c('0x0'));var path=require(_0xda7c('0x1'));var timeout=require('connect-timeout');var express=require(_0xda7c('0x2'));var router=express[_0xda7c('0x3')]();var fs_extra=require(_0xda7c('0x4'));var auth=require(_0xda7c('0x5'));var interaction=require(_0xda7c('0x6'));var config=require(_0xda7c('0x7'));var controller=require(_0xda7c('0x8'));router['get']('/',auth[_0xda7c('0x9')](),controller[_0xda7c('0xa')]);router[_0xda7c('0xb')](_0xda7c('0xc'),auth[_0xda7c('0x9')](),controller[_0xda7c('0xd')]);router[_0xda7c('0xb')](_0xda7c('0xe'),auth['isAuthenticated'](),controller[_0xda7c('0xf')]);router[_0xda7c('0xb')](_0xda7c('0x10'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x11')]);router['get'](_0xda7c('0x12'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x13')]);router['get'](_0xda7c('0x14'),controller[_0xda7c('0x15')]);router[_0xda7c('0xb')](_0xda7c('0x16'),controller[_0xda7c('0x17')]);router['get'](_0xda7c('0x18'),controller[_0xda7c('0x19')]);router[_0xda7c('0xb')](_0xda7c('0x1a'),controller[_0xda7c('0x1b')]);router['get'](_0xda7c('0x1c'),auth[_0xda7c('0x9')](),controller['getInteractions']);router['get'](_0xda7c('0x1d'),controller['getSnippet']);router['get']('/:id/applications',auth[_0xda7c('0x9')](),controller[_0xda7c('0x1e')]);router[_0xda7c('0xb')](_0xda7c('0x1f'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x20')]);router['get'](_0xda7c('0x21'),controller['getFields']);router[_0xda7c('0xb')]('/:id/offline_messages',auth[_0xda7c('0x9')](),controller[_0xda7c('0x22')]);router['get'](_0xda7c('0x23'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x24')]);router[_0xda7c('0x25')]('/',auth[_0xda7c('0x9')](),controller[_0xda7c('0x26')]);router['post'](_0xda7c('0x10'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x27')]);router[_0xda7c('0x25')](_0xda7c('0x12'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x28')]);var upload=multer({'storage':multer[_0xda7c('0x29')]({'destination':function(_0x3f3491,_0x94df04,_0x3a0850){_0x3a0850(null,path[_0xda7c('0x2a')](config[_0xda7c('0x2b')],_0xda7c('0x2c')));},'filename':function(_0x23f74e,_0xa3e5f3,_0x275d07){_0x275d07(null,util[_0xda7c('0x2d')]('%s-%s',Date['now'](),_0xa3e5f3['originalname']));}})});router[_0xda7c('0x25')]('/:id/logo',upload[_0xda7c('0x2e')](_0xda7c('0x2f')),controller[_0xda7c('0x30')]);var upload=multer({'storage':multer[_0xda7c('0x29')]({'destination':function(_0x31f4a3,_0x2df24d,_0x445409){_0x445409(null,path['join'](config[_0xda7c('0x2b')],_0xda7c('0x31')));},'filename':function(_0x344a5b,_0x1b5cc7,_0x42ba09){_0x42ba09(null,util[_0xda7c('0x2d')](_0xda7c('0x32'),Date[_0xda7c('0x33')](),_0x1b5cc7[_0xda7c('0x34')]));}})});router[_0xda7c('0x25')](_0xda7c('0x16'),upload[_0xda7c('0x2e')](_0xda7c('0x2f')),controller[_0xda7c('0x35')]);var upload=multer({'storage':multer[_0xda7c('0x29')]({'destination':function(_0x5e2aa3,_0x59eba3,_0x346e1d){_0x346e1d(null,path[_0xda7c('0x2a')](config['root'],_0xda7c('0x31')));},'filename':function(_0x178a64,_0x2f0762,_0x8d1939){_0x8d1939(null,util['format']('%s-%s',Date[_0xda7c('0x33')](),_0x2f0762['originalname']));}})});router[_0xda7c('0x25')](_0xda7c('0x18'),upload[_0xda7c('0x2e')](_0xda7c('0x2f')),controller[_0xda7c('0x36')]);var upload=multer({'storage':multer[_0xda7c('0x29')]({'destination':function(_0x48a3c9,_0xd13526,_0x29c5f1){_0x29c5f1(null,path[_0xda7c('0x2a')](config[_0xda7c('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x5531af,_0x5afa28,_0x54aa53){_0x54aa53(null,util[_0xda7c('0x2d')](_0xda7c('0x32'),Date['now'](),_0x5afa28['originalname']));}})});router[_0xda7c('0x25')](_0xda7c('0x1a'),upload[_0xda7c('0x2e')](_0xda7c('0x2f')),controller['addSystemAvatar']);router[_0xda7c('0x25')](_0xda7c('0x37'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3b943c,_0x430513,_0x261450){const _0x325ff2=path[_0xda7c('0x2a')](config[_0xda7c('0x2b')],_0xda7c('0x38'),_0xda7c('0x39'),'offline-chat');fs_extra[_0xda7c('0x3a')](_0x325ff2,function(){_0x261450(null,_0x325ff2);});},'filename':function(_0x21e6ec,_0x331ba7,_0x3dcc44){const _0x88c13b=_0x331ba7[_0xda7c('0x34')][_0xda7c('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x21fd8c=path[_0xda7c('0x3c')](_0x88c13b);const _0x51802c=Date[_0xda7c('0x33')]()+'-'+_0x88c13b[_0xda7c('0x3b')](_0x21fd8c,'')+_0x21fd8c;_0x3dcc44(null,_0x51802c);}})});router[_0xda7c('0x25')](_0xda7c('0x3d'),offlineUploadMulter[_0xda7c('0x3e')](),controller[_0xda7c('0x3f')]);router['post'](_0xda7c('0x1c'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x40')]);router['post'](_0xda7c('0x41'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x42')]);router[_0xda7c('0x25')](_0xda7c('0x1f'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x43')]);router[_0xda7c('0x25')](_0xda7c('0x23'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x44')]);router['put']('/:id',auth[_0xda7c('0x9')](),controller[_0xda7c('0x45')]);router[_0xda7c('0x46')](_0xda7c('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xda7c('0x10'),auth['isAuthenticated'](),controller[_0xda7c('0x47')]);router[_0xda7c('0x46')](_0xda7c('0x12'),auth['isAuthenticated'](),controller[_0xda7c('0x48')]);router[_0xda7c('0x46')](_0xda7c('0x23'),auth[_0xda7c('0x9')](),controller[_0xda7c('0x49')]);module[_0xda7c('0x4a')]=router; \ No newline at end of file +var _0xca82=['originalname','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/applications','addAgents','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','/describe','isAuthenticated','describe','/:id','show','get','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','create','addDisposition','post','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','single','file','join'];(function(_0x1b7e02,_0x18b016){var _0x1150a4=function(_0x2b3171){while(--_0x2b3171){_0x1b7e02['push'](_0x1b7e02['shift']());}};_0x1150a4(++_0x18b016);}(_0xca82,0x187));var _0x2ca8=function(_0x3640e2,_0x562103){_0x3640e2=_0x3640e2-0x0;var _0x277415=_0xca82[_0x3640e2];return _0x277415;};'use strict';var multer=require(_0x2ca8('0x0'));var util=require(_0x2ca8('0x1'));var path=require('path');var timeout=require(_0x2ca8('0x2'));var express=require(_0x2ca8('0x3'));var router=express[_0x2ca8('0x4')]();var fs_extra=require(_0x2ca8('0x5'));var auth=require(_0x2ca8('0x6'));var interaction=require(_0x2ca8('0x7'));var config=require('../../config/environment');var controller=require(_0x2ca8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2ca8('0x9'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0xb')]);router['get'](_0x2ca8('0xc'),auth['isAuthenticated'](),controller[_0x2ca8('0xd')]);router[_0x2ca8('0xe')](_0x2ca8('0xf'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x10')]);router[_0x2ca8('0xe')]('/:id/canned_answers',auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x11')]);router[_0x2ca8('0xe')](_0x2ca8('0x12'),controller[_0x2ca8('0x13')]);router[_0x2ca8('0xe')](_0x2ca8('0x14'),controller[_0x2ca8('0x15')]);router['get'](_0x2ca8('0x16'),controller['getCustomerAvatar']);router['get'](_0x2ca8('0x17'),controller[_0x2ca8('0x18')]);router['get']('/:id/interactions',auth[_0x2ca8('0xa')](),controller['getInteractions']);router[_0x2ca8('0xe')](_0x2ca8('0x19'),controller[_0x2ca8('0x1a')]);router[_0x2ca8('0xe')]('/:id/applications',auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x1b')]);router[_0x2ca8('0xe')](_0x2ca8('0x1c'),auth['isAuthenticated'](),controller[_0x2ca8('0x1d')]);router[_0x2ca8('0xe')](_0x2ca8('0x1e'),controller['getFields']);router[_0x2ca8('0xe')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x2ca8('0x1f')]);router[_0x2ca8('0xe')](_0x2ca8('0x20'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x21')]);router['post']('/',auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x22')]);router['post'](_0x2ca8('0xf'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x23')]);router[_0x2ca8('0x24')]('/:id/canned_answers',auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x25')]);var upload=multer({'storage':multer[_0x2ca8('0x26')]({'destination':function(_0xc932be,_0x37993b,_0x704f92){_0x704f92(null,path['join'](config[_0x2ca8('0x27')],_0x2ca8('0x28')));},'filename':function(_0x5f3c95,_0x5a7a2e,_0xc10569){_0xc10569(null,util[_0x2ca8('0x29')](_0x2ca8('0x2a'),Date[_0x2ca8('0x2b')](),_0x5a7a2e['originalname']));}})});router[_0x2ca8('0x24')](_0x2ca8('0x12'),upload[_0x2ca8('0x2c')](_0x2ca8('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x2ca8('0x26')]({'destination':function(_0xf86f7a,_0x52aa01,_0x29ecd1){_0x29ecd1(null,path[_0x2ca8('0x2e')](config[_0x2ca8('0x27')],'server/files/images/avatars/'));},'filename':function(_0x5669d4,_0x4a9c29,_0x346579){_0x346579(null,util[_0x2ca8('0x29')](_0x2ca8('0x2a'),Date['now'](),_0x4a9c29[_0x2ca8('0x2f')]));}})});router[_0x2ca8('0x24')](_0x2ca8('0x14'),upload[_0x2ca8('0x2c')](_0x2ca8('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x2ca8('0x26')]({'destination':function(_0x379b33,_0x3361eb,_0x45ffd7){_0x45ffd7(null,path[_0x2ca8('0x2e')](config[_0x2ca8('0x27')],_0x2ca8('0x30')));},'filename':function(_0x5467b7,_0x1a8ad5,_0x40633e){_0x40633e(null,util[_0x2ca8('0x29')](_0x2ca8('0x2a'),Date[_0x2ca8('0x2b')](),_0x1a8ad5[_0x2ca8('0x2f')]));}})});router[_0x2ca8('0x24')](_0x2ca8('0x16'),upload[_0x2ca8('0x2c')](_0x2ca8('0x2d')),controller[_0x2ca8('0x31')]);var upload=multer({'storage':multer[_0x2ca8('0x26')]({'destination':function(_0x3b0cb2,_0x1be8bd,_0x36a791){_0x36a791(null,path['join'](config[_0x2ca8('0x27')],_0x2ca8('0x30')));},'filename':function(_0x817005,_0x41804e,_0x8bc892){_0x8bc892(null,util[_0x2ca8('0x29')](_0x2ca8('0x2a'),Date[_0x2ca8('0x2b')](),_0x41804e[_0x2ca8('0x2f')]));}})});router[_0x2ca8('0x24')](_0x2ca8('0x17'),upload[_0x2ca8('0x2c')](_0x2ca8('0x2d')),controller[_0x2ca8('0x32')]);router[_0x2ca8('0x24')](_0x2ca8('0x33'),controller[_0x2ca8('0x34')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x30255a,_0x20d4c5,_0x4d707f){const _0x4aa8fd=path['join'](config['root'],_0x2ca8('0x35'),'attachments',_0x2ca8('0x36'));fs_extra['ensureDir'](_0x4aa8fd,function(){_0x4d707f(null,_0x4aa8fd);});},'filename':function(_0x51412e,_0x1f68cb,_0xa998bc){const _0x283c12=_0x1f68cb['originalname'][_0x2ca8('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x271d88=path[_0x2ca8('0x38')](_0x283c12);const _0x3a6e8f=Date[_0x2ca8('0x2b')]()+'-'+_0x283c12[_0x2ca8('0x37')](_0x271d88,'')+_0x271d88;_0xa998bc(null,_0x3a6e8f);}})});router[_0x2ca8('0x24')](_0x2ca8('0x39'),offlineUploadMulter[_0x2ca8('0x3a')](),controller[_0x2ca8('0x3b')]);router[_0x2ca8('0x24')](_0x2ca8('0x3c'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x3d')]);router[_0x2ca8('0x24')](_0x2ca8('0x3e'),auth[_0x2ca8('0xa')](),controller['addApplications']);router['post'](_0x2ca8('0x1c'),auth[_0x2ca8('0xa')](),controller['addProactiveActions']);router[_0x2ca8('0x24')](_0x2ca8('0x20'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x3f')]);router[_0x2ca8('0x40')]('/:id',auth['isAuthenticated'](),controller[_0x2ca8('0x41')]);router[_0x2ca8('0x42')](_0x2ca8('0xc'),auth['isAuthenticated'](),controller[_0x2ca8('0x43')]);router['delete'](_0x2ca8('0xf'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x44')]);router['delete'](_0x2ca8('0x45'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x46')]);router[_0x2ca8('0x42')](_0x2ca8('0x20'),auth[_0x2ca8('0xa')](),controller[_0x2ca8('0x47')]);module[_0x2ca8('0x48')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7981896..5aa27e3 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 _0x5a9e=['exports','STRING','Google'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0x5a9e[_0x52a6e3];return _0x8910d0;};'use strict';var Sequelize=require('sequelize');module[_0xe5a9('0x0')]={'name':{'type':Sequelize[_0xe5a9('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0xe5a9('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe5a9('0x1')]},'data2':{'type':Sequelize[_0xe5a9('0x1')]}}; \ No newline at end of file +var _0x34f2=['ENUM','AmazonAWS','Google','STRING','sequelize','exports'];(function(_0x5f0b46,_0x1e9de1){var _0x53f7d4=function(_0x30fbc4){while(--_0x30fbc4){_0x5f0b46['push'](_0x5f0b46['shift']());}};_0x53f7d4(++_0x1e9de1);}(_0x34f2,0x15a));var _0x234f=function(_0x3f5e9a,_0x5bb5f1){_0x3f5e9a=_0x3f5e9a-0x0;var _0x30b558=_0x34f2[_0x3f5e9a];return _0x30b558;};'use strict';var Sequelize=require(_0x234f('0x0'));module[_0x234f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x234f('0x2')](_0x234f('0x3'),_0x234f('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x234f('0x5')]},'data2':{'type':Sequelize[_0x234f('0x5')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index f22c97b..3800f34 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 _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x2676cf,_0x509894){var _0x5263b6=function(_0x1a516b){while(--_0x1a516b){_0x2676cf['push'](_0x2676cf['shift']());}};_0x5263b6(++_0x509894);}(_0x0b0e,0x187));var _0xe0b0=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x0b0e[_0x422ac3];return _0x53c0d4;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0xfe990b,_0x20bd5a){var _0x489968=function(_0x4d19ec){while(--_0x4d19ec){_0xfe990b['push'](_0xfe990b['shift']());}};_0x489968(++_0x20bd5a);}(_0x7a54,0x106));var _0x47a5=function(_0x37b089,_0x54ecc7){_0x37b089=_0x37b089-0x0;var _0x2eab80=_0x7a54[_0x37b089];return _0x2eab80;};'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['CloudProvider'][_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['CloudProvider']['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['CloudProvider']['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('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index c143c38..35cb88f 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 _0x4270=['bluebird','path','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','api'];(function(_0x4a7480,_0x3cd95b){var _0x25775a=function(_0x22bd81){while(--_0x22bd81){_0x4a7480['push'](_0x4a7480['shift']());}};_0x25775a(++_0x3cd95b);}(_0x4270,0x166));var _0x0427=function(_0xaf9bda,_0x2dc0f9){_0xaf9bda=_0xaf9bda-0x0;var _0x505e48=_0x4270[_0xaf9bda];return _0x505e48;};'use strict';var _=require(_0x0427('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0427('0x1'));var moment=require('moment');var BPromise=require(_0x0427('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0427('0x3'));var rimraf=require('rimraf');var config=require(_0x0427('0x4'));var attributes=require(_0x0427('0x5'));module[_0x0427('0x6')]=function(_0xfd5a1c,_0x543681){return _0xfd5a1c[_0x0427('0x7')](_0x0427('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x510f=['define','CloudProvider','cloud_providers','util','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x510f,0x1a0));var _0xf510=function(_0x3fc59a,_0x5c0c1d){_0x3fc59a=_0x3fc59a-0x0;var _0x2af724=_0x510f[_0x3fc59a];return _0x2af724;};'use strict';var _=require('lodash');var util=require(_0xf510('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf510('0x1'));var BPromise=require(_0xf510('0x2'));var rp=require(_0xf510('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x53bf8a,_0x1fce43){return _0x53bf8a[_0xf510('0x4')](_0xf510('0x5'),attributes,{'tableName':_0xf510('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index fcafc00..29036b9 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 _0x781d=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x5ee908,_0x1ee8ac){var _0x899c41=function(_0x26bf11){while(--_0x26bf11){_0x5ee908['push'](_0x5ee908['shift']());}};_0x899c41(++_0x1ee8ac);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('CloudProvider,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});} \ No newline at end of file +var _0x1f81=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x1f81,0xab));var _0x11f8=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x1f81[_0x40be86];return _0xda3c3b;};'use strict';var _=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var moment=require('moment');var BPromise=require(_0x11f8('0x2'));var rs=require(_0x11f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11f8('0x4'))['db'];var utils=require(_0x11f8('0x5'));var logger=require(_0x11f8('0x6'))(_0x11f8('0x7'));var config=require(_0x11f8('0x8'));var jayson=require(_0x11f8('0x9'));var client=jayson[_0x11f8('0xa')][_0x11f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd0cf,_0x1d899d,_0x8009d7){return new BPromise(function(_0x1cecbe,_0x1bc74d){return client[_0x11f8('0xc')](_0x4fd0cf,_0x8009d7)[_0x11f8('0xd')](function(_0x5ec20c){logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));logger[_0x11f8('0x11')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1d899d,_0x11f8('0x10'),JSON[_0x11f8('0x12')](_0x5ec20c));if(_0x5ec20c[_0x11f8('0x13')]){if(_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x14')]===0x1f4){logger[_0x11f8('0x13')]('CloudProvider,\x20%s,\x20%s',_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1bc74d(_0x5ec20c[_0x11f8('0x13')]['message']);}logger[_0x11f8('0x13')](_0x11f8('0xf'),_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1cecbe(_0x5ec20c['error'][_0x11f8('0x15')]);}else{logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));_0x1cecbe(_0x5ec20c[_0x11f8('0x16')]['message']);}})[_0x11f8('0x17')](function(_0x3e7fb3){logger['error'](_0x11f8('0xf'),_0x1d899d,_0x3e7fb3);_0x1bc74d(_0x3e7fb3);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e58c2e0..e327cd1 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 _0x4b02=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','update','delete','destroy','util','path','express','Router','fs-extra'];(function(_0x689740,_0x15278f){var _0x413ae1=function(_0x2582e5){while(--_0x2582e5){_0x689740['push'](_0x689740['shift']());}};_0x413ae1(++_0x15278f);}(_0x4b02,0xcd));var _0x24b0=function(_0x518c05,_0x705614){_0x518c05=_0x518c05-0x0;var _0x5adb6e=_0x4b02[_0x518c05];return _0x5adb6e;};'use strict';var multer=require('multer');var util=require(_0x24b0('0x0'));var path=require(_0x24b0('0x1'));var timeout=require('connect-timeout');var express=require(_0x24b0('0x2'));var router=express[_0x24b0('0x3')]();var fs_extra=require(_0x24b0('0x4'));var auth=require(_0x24b0('0x5'));var interaction=require(_0x24b0('0x6'));var config=require(_0x24b0('0x7'));var controller=require(_0x24b0('0x8'));router[_0x24b0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x24b0('0x9')]('/:id',auth[_0x24b0('0xa')](),controller['show']);router['post']('/',auth[_0x24b0('0xa')](),controller['create']);router['put']('/:id',auth[_0x24b0('0xa')](),controller[_0x24b0('0xb')]);router[_0x24b0('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x24b0('0xd')]);module['exports']=router; \ No newline at end of file +var _0x8b52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x541b39,_0x1ac387){var _0x31aec8=function(_0x13f4ea){while(--_0x13f4ea){_0x541b39['push'](_0x541b39['shift']());}};_0x31aec8(++_0x1ac387);}(_0x8b52,0x151));var _0x28b5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8b52[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x28b5('0x0'));var util=require(_0x28b5('0x1'));var path=require(_0x28b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x28b5('0x3'));var router=express[_0x28b5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x28b5('0x5'));var interaction=require(_0x28b5('0x6'));var config=require(_0x28b5('0x7'));var controller=require(_0x28b5('0x8'));router[_0x28b5('0x9')]('/',auth[_0x28b5('0xa')](),controller[_0x28b5('0xb')]);router[_0x28b5('0x9')](_0x28b5('0xc'),auth['isAuthenticated'](),controller[_0x28b5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x28b5('0xe')]);router[_0x28b5('0xf')]('/:id',auth[_0x28b5('0xa')](),controller[_0x28b5('0x10')]);router['delete'](_0x28b5('0xc'),auth[_0x28b5('0xa')](),controller[_0x28b5('0x11')]);module[_0x28b5('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 2eab3da..3abf093 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 _0x54a9=['sequelize','STRING'];(function(_0x3bddde,_0x1409a1){var _0x2f5d10=function(_0x2a0035){while(--_0x2a0035){_0x3bddde['push'](_0x3bddde['shift']());}};_0x2f5d10(++_0x1409a1);}(_0x54a9,0x186));var _0x954a=function(_0x940cb7,_0x25ab25){_0x940cb7=_0x940cb7-0x0;var _0x20ff52=_0x54a9[_0x940cb7];return _0x20ff52;};'use strict';var Sequelize=require(_0x954a('0x0'));module['exports']={'name':{'type':Sequelize[_0x954a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x954a('0x1')]},'companyId':{'type':Sequelize[_0x954a('0x1')]},'website':{'type':Sequelize[_0x954a('0x1')]},'phone':{'type':Sequelize[_0x954a('0x1')]},'fax':{'type':Sequelize[_0x954a('0x1')]},'type':{'type':Sequelize[_0x954a('0x1')]},'street':{'type':Sequelize[_0x954a('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x954a('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x954a('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x954a('0x1')]},'sStreet':{'type':Sequelize[_0x954a('0x1')]},'sPostalCode':{'type':Sequelize[_0x954a('0x1')]},'sCity':{'type':Sequelize[_0x954a('0x1')]},'sCountry':{'type':Sequelize[_0x954a('0x1')]},'description':{'type':Sequelize[_0x954a('0x1')]}}; \ No newline at end of file +var _0x9df1=['name','sequelize','exports','STRING'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x9df1,0xcd));var _0x19df=function(_0x30e278,_0x30caeb){_0x30e278=_0x30e278-0x0;var _0xd74914=_0x9df1[_0x30e278];return _0xd74914;};'use strict';var Sequelize=require(_0x19df('0x0'));module[_0x19df('0x1')]={'name':{'type':Sequelize[_0x19df('0x2')],'unique':_0x19df('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x19df('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x19df('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x19df('0x2')]},'street':{'type':Sequelize[_0x19df('0x2')]},'postalCode':{'type':Sequelize[_0x19df('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x19df('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x19df('0x2')]},'sStreet':{'type':Sequelize[_0x19df('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x19df('0x2')]},'sCountry':{'type':Sequelize['STRING']},'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 5a5bcc8..4ec1082 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 _0xbbbb=['send','CmCompany','query','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','map','options','include','findAll','rows','catch','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','params','describe','addContacts','CmContact','ids','omit','getContacts','findOne','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','stack','name'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xbbbb,0x128));var _0xbbbb=function(_0x405235,_0xc9d51b){_0x405235=_0x405235-0x0;var _0x4c271f=_0xbbbb[_0x405235];return _0x4c271f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbbb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbbb('0x1'));var rp=require(_0xbbbb('0x2'));var moment=require(_0xbbbb('0x3'));var BPromise=require(_0xbbbb('0x4'));var Mustache=require(_0xbbbb('0x5'));var util=require(_0xbbbb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbbbb('0x7'));var ejs=require(_0xbbbb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbbbb('0x9'));var crypto=require(_0xbbbb('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbbbb('0xb'));var toCsv=require(_0xbbbb('0x7'));var querystring=require(_0xbbbb('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbbbb('0xd'));var as=require(_0xbbbb('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbbb('0xf'))('api');var utils=require(_0xbbbb('0x10'));var config=require(_0xbbbb('0x11'));var licenseUtil=require(_0xbbbb('0x12'));var db=require(_0xbbbb('0x13'))['db'];function respondWithStatusCode(_0x444731,_0x1b57ab){_0x1b57ab=_0x1b57ab||0xcc;return function(_0x807208){if(_0x807208){return _0x444731[_0xbbbb('0x14')](_0x1b57ab);}return _0x444731[_0xbbbb('0x15')](_0x1b57ab)[_0xbbbb('0x16')]();};}function respondWithResult(_0x4ab5f6,_0x1b5480){_0x1b5480=_0x1b5480||0xc8;return function(_0x5b2b92){if(_0x5b2b92){return _0x4ab5f6[_0xbbbb('0x15')](_0x1b5480)[_0xbbbb('0x17')](_0x5b2b92);}};}function respondWithFilteredResult(_0x3964a3,_0x5d1fb0){return function(_0xf80a94){if(_0xf80a94){var _0x389515=typeof _0x5d1fb0[_0xbbbb('0x18')]===_0xbbbb('0x19')&&typeof _0x5d1fb0['limit']===_0xbbbb('0x19');var _0x24613d=_0xf80a94[_0xbbbb('0x1a')];var _0x2e59e6=_0x389515?0x0:_0x5d1fb0['offset'];var _0x5bfcf8=_0x389515?_0xf80a94[_0xbbbb('0x1a')]:_0x5d1fb0[_0xbbbb('0x18')]+_0x5d1fb0['limit'];var _0x434918;if(_0x5bfcf8>=_0x24613d){_0x5bfcf8=_0x24613d;_0x434918=0xc8;}else{_0x434918=0xce;}_0x3964a3[_0xbbbb('0x15')](_0x434918);return _0x3964a3[_0xbbbb('0x1b')](_0xbbbb('0x1c'),_0x2e59e6+'-'+_0x5bfcf8+'/'+_0x24613d)[_0xbbbb('0x17')](_0xf80a94);}return null;};}function patchUpdates(_0x1bbf39){return function(_0x1bd676){try{jsonpatch[_0xbbbb('0x1d')](_0x1bd676,_0x1bbf39,!![]);}catch(_0x1e1f5c){return BPromise[_0xbbbb('0x1e')](_0x1e1f5c);}return _0x1bd676[_0xbbbb('0x1f')]();};}function saveUpdates(_0x7401a2,_0x2e5784){return function(_0x2943c8){if(_0x2943c8){return _0x2943c8[_0xbbbb('0x20')](_0x7401a2)['then'](function(_0x15128a){return _0x15128a;});}return null;};}function removeEntity(_0x36231b,_0x2c8e7e){return function(_0x41596c){if(_0x41596c){return _0x41596c[_0xbbbb('0x21')]()[_0xbbbb('0x22')](function(){var _0x5b8dd5=_0x41596c[_0xbbbb('0x23')]({'plain':!![]});var _0x5caf6d=_0xbbbb('0x24');return db[_0xbbbb('0x25')][_0xbbbb('0x21')]({'where':{'type':_0x5caf6d,'resourceId':_0x5b8dd5['id']}})['then'](function(){return _0x41596c;});})[_0xbbbb('0x22')](function(){_0x36231b[_0xbbbb('0x15')](0xcc)[_0xbbbb('0x16')]();});}};}function handleEntityNotFound(_0xef89f6,_0x1525e7){return function(_0x25b3ed){if(!_0x25b3ed){_0xef89f6[_0xbbbb('0x14')](0x194);}return _0x25b3ed;};}function handleError(_0x230885,_0x3e0101){_0x3e0101=_0x3e0101||0x1f4;return function(_0x5b33f2){logger['error'](_0x5b33f2[_0xbbbb('0x26')]);if(_0x5b33f2[_0xbbbb('0x27')]){delete _0x5b33f2['name'];}_0x230885[_0xbbbb('0x15')](_0x3e0101)[_0xbbbb('0x28')](_0x5b33f2);};}exports['index']=function(_0xb0ee89,_0x49607f){var _0x2117a5={},_0x334a55={},_0x553a00={'count':0x0,'rows':[]};return db[_0xbbbb('0x29')]['describe']()[_0xbbbb('0x22')](function(_0x437cc1){_0x334a55['model']=_['keys'](_0x437cc1);_0x334a55[_0xbbbb('0x2a')]=_['keys'](_0xb0ee89[_0xbbbb('0x2a')]);_0x334a55['filters']=_[_0xbbbb('0x2b')](_0x334a55[_0xbbbb('0x2c')],_0x334a55['query']);_0x2117a5[_0xbbbb('0x2d')]=_[_0xbbbb('0x2b')](_0x334a55[_0xbbbb('0x2c')],qs[_0xbbbb('0x2e')](_0xb0ee89['query'][_0xbbbb('0x2e')]));_0x2117a5[_0xbbbb('0x2d')]=_0x2117a5['attributes'][_0xbbbb('0x2f')]?_0x2117a5['attributes']:_0x334a55['model'];if(!_0xb0ee89[_0xbbbb('0x2a')][_0xbbbb('0x30')]('nolimit')){_0x2117a5[_0xbbbb('0x31')]=qs[_0xbbbb('0x31')](_0xb0ee89['query'][_0xbbbb('0x31')]);_0x2117a5['offset']=qs[_0xbbbb('0x18')](_0xb0ee89[_0xbbbb('0x2a')][_0xbbbb('0x18')]);}_0x2117a5[_0xbbbb('0x32')]=qs[_0xbbbb('0x33')](_0xb0ee89[_0xbbbb('0x2a')][_0xbbbb('0x33')]);_0x2117a5[_0xbbbb('0x34')]=qs[_0xbbbb('0x35')](_[_0xbbbb('0x36')](_0xb0ee89[_0xbbbb('0x2a')],_0x334a55[_0xbbbb('0x35')]),_0x437cc1);if(_0xb0ee89[_0xbbbb('0x2a')][_0xbbbb('0x37')]){_0x2117a5['where']=_[_0xbbbb('0x38')](_0x2117a5[_0xbbbb('0x34')],{'$or':_[_0xbbbb('0x39')](_0x2117a5[_0xbbbb('0x2d')],function(_0x299618){var _0x3e59e0={};_0x3e59e0[_0x299618]={'$like':'%'+_0xb0ee89['query']['filter']+'%'};return _0x3e59e0;})});}_0x2117a5=_[_0xbbbb('0x38')]({},_0x2117a5,_0xb0ee89[_0xbbbb('0x3a')]);var _0x23d0b5={'where':_0x2117a5[_0xbbbb('0x34')]};return db[_0xbbbb('0x29')]['count'](_0x23d0b5)['then'](function(_0x34126b){_0x553a00[_0xbbbb('0x1a')]=_0x34126b;if(_0xb0ee89['query']['includeAll']){_0x2117a5[_0xbbbb('0x3b')]=[{'all':!![]}];}return db[_0xbbbb('0x29')][_0xbbbb('0x3c')](_0x2117a5);})[_0xbbbb('0x22')](function(_0xac095e){_0x553a00[_0xbbbb('0x3d')]=_0xac095e;return _0x553a00;})[_0xbbbb('0x22')](respondWithFilteredResult(_0x49607f,_0x2117a5))[_0xbbbb('0x3e')](handleError(_0x49607f,null));})[_0xbbbb('0x3e')](handleError(_0x49607f,null));};exports['show']=function(_0x3e3f72,_0x25dc1f){var _0x59f5d5={'raw':![],'where':{'id':_0x3e3f72['params']['id']}},_0x53efbb={};_0x53efbb[_0xbbbb('0x2c')]=_[_0xbbbb('0x3f')](db[_0xbbbb('0x29')][_0xbbbb('0x40')]);_0x53efbb['query']=_[_0xbbbb('0x3f')](_0x3e3f72[_0xbbbb('0x2a')]);_0x53efbb[_0xbbbb('0x35')]=_[_0xbbbb('0x2b')](_0x53efbb['model'],_0x53efbb['query']);_0x59f5d5[_0xbbbb('0x2d')]=_[_0xbbbb('0x2b')](_0x53efbb[_0xbbbb('0x2c')],qs[_0xbbbb('0x2e')](_0x3e3f72[_0xbbbb('0x2a')][_0xbbbb('0x2e')]));_0x59f5d5[_0xbbbb('0x2d')]=_0x59f5d5[_0xbbbb('0x2d')][_0xbbbb('0x2f')]?_0x59f5d5[_0xbbbb('0x2d')]:_0x53efbb[_0xbbbb('0x2c')];if(_0x3e3f72[_0xbbbb('0x2a')]['includeAll']){_0x59f5d5[_0xbbbb('0x3b')]=[{'all':!![]}];}_0x59f5d5=_['merge']({},_0x59f5d5,_0x3e3f72[_0xbbbb('0x3a')]);return db[_0xbbbb('0x29')][_0xbbbb('0x41')](_0x59f5d5)[_0xbbbb('0x22')](handleEntityNotFound(_0x25dc1f,null))[_0xbbbb('0x22')](respondWithResult(_0x25dc1f,null))[_0xbbbb('0x3e')](handleError(_0x25dc1f,null));};exports[_0xbbbb('0x42')]=function(_0x5613a8,_0x27a2cb){return db[_0xbbbb('0x29')]['create'](_0x5613a8[_0xbbbb('0x43')],{})[_0xbbbb('0x22')](function(_0x175ae0){var _0x1809bf=_0x5613a8[_0xbbbb('0x44')][_0xbbbb('0x23')]({'plain':!![]});if(!_0x1809bf)throw new Error(_0xbbbb('0x45'));if(_0x1809bf[_0xbbbb('0x46')]===_0xbbbb('0x44')){var _0x388f40=_0x175ae0[_0xbbbb('0x23')]({'plain':!![]});var _0x5d13e8=_0xbbbb('0x24');return db[_0xbbbb('0x47')][_0xbbbb('0x41')]({'where':{'name':_0x5d13e8,'userProfileId':_0x1809bf[_0xbbbb('0x48')]},'raw':!![]})['then'](function(_0x2de578){if(_0x2de578&&_0x2de578[_0xbbbb('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x388f40['name'],'resourceId':_0x388f40['id'],'type':_0x2de578[_0xbbbb('0x27')],'sectionId':_0x2de578['id']},{})['then'](function(){return _0x175ae0;});}else{return _0x175ae0;}})[_0xbbbb('0x3e')](function(_0x39614c){logger[_0xbbbb('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39614c);throw _0x39614c;});}return _0x175ae0;})[_0xbbbb('0x22')](respondWithResult(_0x27a2cb,0xc9))['catch'](handleError(_0x27a2cb,null));};exports[_0xbbbb('0x20')]=function(_0x4fa3a5,_0x1dbdc6){if(_0x4fa3a5[_0xbbbb('0x43')]['id']){delete _0x4fa3a5['body']['id'];}return db[_0xbbbb('0x29')][_0xbbbb('0x41')]({'where':{'id':_0x4fa3a5[_0xbbbb('0x4b')]['id']}})[_0xbbbb('0x22')](handleEntityNotFound(_0x1dbdc6,null))['then'](saveUpdates(_0x4fa3a5[_0xbbbb('0x43')],null))['then'](respondWithResult(_0x1dbdc6,null))[_0xbbbb('0x3e')](handleError(_0x1dbdc6,null));};exports[_0xbbbb('0x21')]=function(_0x4d7aa9,_0x281f1e){return db[_0xbbbb('0x29')]['find']({'where':{'id':_0x4d7aa9[_0xbbbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x281f1e,null))[_0xbbbb('0x22')](removeEntity(_0x281f1e,null))['catch'](handleError(_0x281f1e,null));};exports[_0xbbbb('0x4c')]=function(_0x2e9881,_0x2dd412){return db['CmCompany'][_0xbbbb('0x4c')]()[_0xbbbb('0x22')](respondWithResult(_0x2dd412,null))[_0xbbbb('0x3e')](handleError(_0x2dd412,null));};exports[_0xbbbb('0x4d')]=function(_0x240b21,_0x570ff3,_0x2a3ccd){return db[_0xbbbb('0x4e')][_0xbbbb('0x41')]({'where':{'id':_0x240b21[_0xbbbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x570ff3,null))[_0xbbbb('0x22')](function(_0x956e01){if(_0x956e01){return _0x956e01[_0xbbbb('0x4d')](_0x240b21[_0xbbbb('0x43')][_0xbbbb('0x4f')],_[_0xbbbb('0x50')](_0x240b21[_0xbbbb('0x43')],[_0xbbbb('0x4f'),'id'])||{});}})[_0xbbbb('0x22')](respondWithResult(_0x570ff3,null))[_0xbbbb('0x3e')](handleError(_0x570ff3,null));};exports[_0xbbbb('0x51')]=function(_0x1b6ded,_0x3fa9d4,_0x1a8956){var _0x2fa4c0={};var _0x1e95f2={};var _0xb90ffd;var _0x24811a;return db[_0xbbbb('0x29')][_0xbbbb('0x52')]({'where':{'id':_0x1b6ded[_0xbbbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3fa9d4,null))[_0xbbbb('0x22')](function(_0x4459af){if(_0x4459af){_0xb90ffd=_0x4459af;_0x1e95f2['model']=_[_0xbbbb('0x3f')](db['CmContact'][_0xbbbb('0x40')]);_0x1e95f2[_0xbbbb('0x2a')]=_[_0xbbbb('0x3f')](_0x1b6ded[_0xbbbb('0x2a')]);_0x1e95f2[_0xbbbb('0x35')]=_[_0xbbbb('0x2b')](_0x1e95f2[_0xbbbb('0x2c')],_0x1e95f2[_0xbbbb('0x2a')]);_0x2fa4c0[_0xbbbb('0x2d')]=_[_0xbbbb('0x2b')](_0x1e95f2[_0xbbbb('0x2c')],qs[_0xbbbb('0x2e')](_0x1b6ded[_0xbbbb('0x2a')]['fields']));_0x2fa4c0[_0xbbbb('0x2d')]=_0x2fa4c0[_0xbbbb('0x2d')][_0xbbbb('0x2f')]?_0x2fa4c0['attributes']:_0x1e95f2[_0xbbbb('0x2c')];_0x2fa4c0[_0xbbbb('0x32')]=qs[_0xbbbb('0x33')](_0x1b6ded[_0xbbbb('0x2a')]['sort']);_0x2fa4c0['where']=qs[_0xbbbb('0x35')](_['pick'](_0x1b6ded[_0xbbbb('0x2a')],_0x1e95f2['filters']));if(_0x1b6ded[_0xbbbb('0x2a')][_0xbbbb('0x37')]){_0x2fa4c0['where']=_[_0xbbbb('0x38')](_0x2fa4c0[_0xbbbb('0x34')],{'$or':_['map'](_0x2fa4c0[_0xbbbb('0x2d')],function(_0x1cd0b9){var _0x2d7d1c={};_0x2d7d1c[_0x1cd0b9]={'$like':'%'+_0x1b6ded[_0xbbbb('0x2a')][_0xbbbb('0x37')]+'%'};return _0x2d7d1c;})});}_0x2fa4c0=_['merge']({},_0x2fa4c0,_0x1b6ded[_0xbbbb('0x3a')]);return _0xb90ffd[_0xbbbb('0x51')](_0x2fa4c0);}})[_0xbbbb('0x22')](function(_0x2c2bbc){if(_0x2c2bbc){_0x24811a=_0x2c2bbc['length'];if(!_0x1b6ded[_0xbbbb('0x2a')]['hasOwnProperty'](_0xbbbb('0x53'))){_0x2fa4c0[_0xbbbb('0x31')]=qs[_0xbbbb('0x31')](_0x1b6ded[_0xbbbb('0x2a')][_0xbbbb('0x31')]);_0x2fa4c0[_0xbbbb('0x18')]=qs[_0xbbbb('0x18')](_0x1b6ded[_0xbbbb('0x2a')][_0xbbbb('0x18')]);}return _0xb90ffd['getContacts'](_0x2fa4c0);}})[_0xbbbb('0x22')](function(_0x2899d9){if(_0x2899d9){return _0x2899d9?{'count':_0x24811a,'rows':_0x2899d9}:null;}})[_0xbbbb('0x22')](respondWithResult(_0x3fa9d4,null))[_0xbbbb('0x3e')](handleError(_0x3fa9d4,null));}; \ No newline at end of file +var _0x8391=['find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','UserProfileResource','sendStatus','error','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','map','filter','includeAll','findAll','rows','catch','rawAttributes','include','merge','options'];(function(_0xcadb58,_0x1e17d){var _0xf8c6c3=function(_0x12cdf5){while(--_0x12cdf5){_0xcadb58['push'](_0xcadb58['shift']());}};_0xf8c6c3(++_0x1e17d);}(_0x8391,0x1cd));var _0x1839=function(_0x15ae07,_0x3a6b7d){_0x15ae07=_0x15ae07-0x0;var _0x4585dc=_0x8391[_0x15ae07];return _0x4585dc;};'use strict';var emlformat=require(_0x1839('0x0'));var rimraf=require(_0x1839('0x1'));var zipdir=require(_0x1839('0x2'));var jsonpatch=require(_0x1839('0x3'));var rp=require(_0x1839('0x4'));var moment=require('moment');var BPromise=require(_0x1839('0x5'));var Mustache=require(_0x1839('0x6'));var util=require(_0x1839('0x7'));var path=require(_0x1839('0x8'));var sox=require('sox');var csv=require(_0x1839('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1839('0xa'));var _=require(_0x1839('0xb'));var squel=require(_0x1839('0xc'));var crypto=require(_0x1839('0xd'));var jsforce=require(_0x1839('0xe'));var deskjs=require(_0x1839('0xf'));var toCsv=require(_0x1839('0x9'));var querystring=require(_0x1839('0x10'));var Papa=require(_0x1839('0x11'));var Redis=require(_0x1839('0x12'));var authService=require(_0x1839('0x13'));var qs=require(_0x1839('0x14'));var as=require(_0x1839('0x15'));var hardwareService=require(_0x1839('0x16'));var logger=require(_0x1839('0x17'))(_0x1839('0x18'));var utils=require(_0x1839('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1839('0x1a'));var db=require(_0x1839('0x1b'))['db'];function respondWithStatusCode(_0x26677d,_0x813900){_0x813900=_0x813900||0xcc;return function(_0x2fb190){if(_0x2fb190){return _0x26677d['sendStatus'](_0x813900);}return _0x26677d[_0x1839('0x1c')](_0x813900)[_0x1839('0x1d')]();};}function respondWithResult(_0x1f168a,_0x4264a7){_0x4264a7=_0x4264a7||0xc8;return function(_0x4f47e4){if(_0x4f47e4){return _0x1f168a[_0x1839('0x1c')](_0x4264a7)[_0x1839('0x1e')](_0x4f47e4);}};}function respondWithFilteredResult(_0x126b16,_0x5f21b5){return function(_0x955771){if(_0x955771){var _0x3818c5=typeof _0x5f21b5[_0x1839('0x1f')]==='undefined'&&typeof _0x5f21b5[_0x1839('0x20')]===_0x1839('0x21');var _0x2b4ed7=_0x955771[_0x1839('0x22')];var _0x92994f=_0x3818c5?0x0:_0x5f21b5[_0x1839('0x1f')];var _0x27156d=_0x3818c5?_0x955771[_0x1839('0x22')]:_0x5f21b5['offset']+_0x5f21b5['limit'];var _0x563fb6;if(_0x27156d>=_0x2b4ed7){_0x27156d=_0x2b4ed7;_0x563fb6=0xc8;}else{_0x563fb6=0xce;}_0x126b16[_0x1839('0x1c')](_0x563fb6);return _0x126b16[_0x1839('0x23')]('Content-Range',_0x92994f+'-'+_0x27156d+'/'+_0x2b4ed7)[_0x1839('0x1e')](_0x955771);}return null;};}function patchUpdates(_0x32df50){return function(_0x45abdd){try{jsonpatch['apply'](_0x45abdd,_0x32df50,!![]);}catch(_0x21cd25){return BPromise[_0x1839('0x24')](_0x21cd25);}return _0x45abdd[_0x1839('0x25')]();};}function saveUpdates(_0x10e97b,_0x10e455){return function(_0x2d5246){if(_0x2d5246){return _0x2d5246[_0x1839('0x26')](_0x10e97b)['then'](function(_0x255ed0){return _0x255ed0;});}return null;};}function removeEntity(_0x1ae6a8,_0x1e5d4e){return function(_0x4957e2){if(_0x4957e2){return _0x4957e2[_0x1839('0x27')]()[_0x1839('0x28')](function(){var _0x764b85=_0x4957e2['get']({'plain':!![]});var _0xf963ce='Companies';return db[_0x1839('0x29')]['destroy']({'where':{'type':_0xf963ce,'resourceId':_0x764b85['id']}})[_0x1839('0x28')](function(){return _0x4957e2;});})['then'](function(){_0x1ae6a8[_0x1839('0x1c')](0xcc)[_0x1839('0x1d')]();});}};}function handleEntityNotFound(_0x680add,_0x134108){return function(_0x1f22ff){if(!_0x1f22ff){_0x680add[_0x1839('0x2a')](0x194);}return _0x1f22ff;};}function handleError(_0x232e18,_0x418a37){_0x418a37=_0x418a37||0x1f4;return function(_0x353a65){logger[_0x1839('0x2b')](_0x353a65['stack']);if(_0x353a65[_0x1839('0x2c')]){delete _0x353a65[_0x1839('0x2c')];}_0x232e18[_0x1839('0x1c')](_0x418a37)[_0x1839('0x2d')](_0x353a65);};}exports[_0x1839('0x2e')]=function(_0x3ad143,_0x59fc8f){var _0x1ce220={},_0x23fd57={},_0xb5e09f={'count':0x0,'rows':[]};return db[_0x1839('0x2f')][_0x1839('0x30')]()[_0x1839('0x28')](function(_0x4db2b7){_0x23fd57[_0x1839('0x31')]=_[_0x1839('0x32')](_0x4db2b7);_0x23fd57['query']=_[_0x1839('0x32')](_0x3ad143[_0x1839('0x33')]);_0x23fd57['filters']=_[_0x1839('0x34')](_0x23fd57[_0x1839('0x31')],_0x23fd57[_0x1839('0x33')]);_0x1ce220[_0x1839('0x35')]=_[_0x1839('0x34')](_0x23fd57[_0x1839('0x31')],qs[_0x1839('0x36')](_0x3ad143[_0x1839('0x33')][_0x1839('0x36')]));_0x1ce220[_0x1839('0x35')]=_0x1ce220[_0x1839('0x35')][_0x1839('0x37')]?_0x1ce220[_0x1839('0x35')]:_0x23fd57[_0x1839('0x31')];if(!_0x3ad143[_0x1839('0x33')][_0x1839('0x38')](_0x1839('0x39'))){_0x1ce220['limit']=qs[_0x1839('0x20')](_0x3ad143[_0x1839('0x33')][_0x1839('0x20')]);_0x1ce220['offset']=qs[_0x1839('0x1f')](_0x3ad143[_0x1839('0x33')][_0x1839('0x1f')]);}_0x1ce220[_0x1839('0x3a')]=qs[_0x1839('0x3b')](_0x3ad143[_0x1839('0x33')][_0x1839('0x3b')]);_0x1ce220['where']=qs[_0x1839('0x3c')](_[_0x1839('0x3d')](_0x3ad143['query'],_0x23fd57['filters']),_0x4db2b7);if(_0x3ad143['query']['filter']){_0x1ce220[_0x1839('0x3e')]=_['merge'](_0x1ce220['where'],{'$or':_[_0x1839('0x3f')](_0x1ce220[_0x1839('0x35')],function(_0x44e607){var _0x586b47={};_0x586b47[_0x44e607]={'$like':'%'+_0x3ad143['query'][_0x1839('0x40')]+'%'};return _0x586b47;})});}_0x1ce220=_['merge']({},_0x1ce220,_0x3ad143['options']);var _0x4d4b19={'where':_0x1ce220[_0x1839('0x3e')]};return db[_0x1839('0x2f')][_0x1839('0x22')](_0x4d4b19)[_0x1839('0x28')](function(_0x4680f7){_0xb5e09f['count']=_0x4680f7;if(_0x3ad143[_0x1839('0x33')][_0x1839('0x41')]){_0x1ce220['include']=[{'all':!![]}];}return db[_0x1839('0x2f')][_0x1839('0x42')](_0x1ce220);})[_0x1839('0x28')](function(_0x5d1897){_0xb5e09f[_0x1839('0x43')]=_0x5d1897;return _0xb5e09f;})[_0x1839('0x28')](respondWithFilteredResult(_0x59fc8f,_0x1ce220))[_0x1839('0x44')](handleError(_0x59fc8f,null));})[_0x1839('0x44')](handleError(_0x59fc8f,null));};exports['show']=function(_0x32684d,_0x3a8cad){var _0x46baa8={'raw':![],'where':{'id':_0x32684d['params']['id']}},_0x22ee96={};_0x22ee96['model']=_[_0x1839('0x32')](db[_0x1839('0x2f')][_0x1839('0x45')]);_0x22ee96['query']=_[_0x1839('0x32')](_0x32684d[_0x1839('0x33')]);_0x22ee96[_0x1839('0x3c')]=_[_0x1839('0x34')](_0x22ee96[_0x1839('0x31')],_0x22ee96['query']);_0x46baa8[_0x1839('0x35')]=_[_0x1839('0x34')](_0x22ee96[_0x1839('0x31')],qs[_0x1839('0x36')](_0x32684d['query']['fields']));_0x46baa8['attributes']=_0x46baa8[_0x1839('0x35')][_0x1839('0x37')]?_0x46baa8[_0x1839('0x35')]:_0x22ee96[_0x1839('0x31')];if(_0x32684d[_0x1839('0x33')]['includeAll']){_0x46baa8[_0x1839('0x46')]=[{'all':!![]}];}_0x46baa8=_[_0x1839('0x47')]({},_0x46baa8,_0x32684d[_0x1839('0x48')]);return db[_0x1839('0x2f')][_0x1839('0x49')](_0x46baa8)[_0x1839('0x28')](handleEntityNotFound(_0x3a8cad,null))['then'](respondWithResult(_0x3a8cad,null))['catch'](handleError(_0x3a8cad,null));};exports[_0x1839('0x4a')]=function(_0x2cd7ca,_0x25a592){return db[_0x1839('0x2f')][_0x1839('0x4a')](_0x2cd7ca[_0x1839('0x4b')],{})['then'](function(_0x18c680){var _0x56214d=_0x2cd7ca[_0x1839('0x4c')][_0x1839('0x4d')]({'plain':!![]});if(!_0x56214d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56214d[_0x1839('0x4e')]===_0x1839('0x4c')){var _0x42c3c6=_0x18c680[_0x1839('0x4d')]({'plain':!![]});var _0x257df8='Companies';return db[_0x1839('0x4f')][_0x1839('0x49')]({'where':{'name':_0x257df8,'userProfileId':_0x56214d[_0x1839('0x50')]},'raw':!![]})[_0x1839('0x28')](function(_0x33bd96){if(_0x33bd96&&_0x33bd96[_0x1839('0x51')]===0x0){return db[_0x1839('0x29')][_0x1839('0x4a')]({'name':_0x42c3c6[_0x1839('0x2c')],'resourceId':_0x42c3c6['id'],'type':_0x33bd96[_0x1839('0x2c')],'sectionId':_0x33bd96['id']},{})[_0x1839('0x28')](function(){return _0x18c680;});}else{return _0x18c680;}})[_0x1839('0x44')](function(_0x4c0a1d){logger[_0x1839('0x2b')](_0x1839('0x52'),_0x4c0a1d);throw _0x4c0a1d;});}return _0x18c680;})[_0x1839('0x28')](respondWithResult(_0x25a592,0xc9))['catch'](handleError(_0x25a592,null));};exports[_0x1839('0x26')]=function(_0x5abac1,_0x1a886c){if(_0x5abac1[_0x1839('0x4b')]['id']){delete _0x5abac1[_0x1839('0x4b')]['id'];}return db[_0x1839('0x2f')][_0x1839('0x49')]({'where':{'id':_0x5abac1[_0x1839('0x53')]['id']}})[_0x1839('0x28')](handleEntityNotFound(_0x1a886c,null))[_0x1839('0x28')](saveUpdates(_0x5abac1['body'],null))[_0x1839('0x28')](respondWithResult(_0x1a886c,null))[_0x1839('0x44')](handleError(_0x1a886c,null));};exports[_0x1839('0x27')]=function(_0x39a137,_0x567a33){return db[_0x1839('0x2f')][_0x1839('0x49')]({'where':{'id':_0x39a137['params']['id']}})[_0x1839('0x28')](handleEntityNotFound(_0x567a33,null))[_0x1839('0x28')](removeEntity(_0x567a33,null))['catch'](handleError(_0x567a33,null));};exports[_0x1839('0x30')]=function(_0x368295,_0x5f7c8d){return db['CmCompany'][_0x1839('0x30')]()['then'](respondWithResult(_0x5f7c8d,null))['catch'](handleError(_0x5f7c8d,null));};exports[_0x1839('0x54')]=function(_0x37431c,_0x16afc5,_0x418ea0){return db[_0x1839('0x55')]['find']({'where':{'id':_0x37431c['params']['id']}})[_0x1839('0x28')](handleEntityNotFound(_0x16afc5,null))[_0x1839('0x28')](function(_0x1c9a07){if(_0x1c9a07){return _0x1c9a07['addContacts'](_0x37431c[_0x1839('0x4b')][_0x1839('0x56')],_[_0x1839('0x57')](_0x37431c[_0x1839('0x4b')],[_0x1839('0x56'),'id'])||{});}})[_0x1839('0x28')](respondWithResult(_0x16afc5,null))[_0x1839('0x44')](handleError(_0x16afc5,null));};exports[_0x1839('0x58')]=function(_0x2ece61,_0x270501,_0x1680b9){var _0x526fb5={};var _0x1c124e={};var _0x33d939;var _0x1cda21;return db[_0x1839('0x2f')]['findOne']({'where':{'id':_0x2ece61['params']['id']}})['then'](handleEntityNotFound(_0x270501,null))[_0x1839('0x28')](function(_0x33fdfd){if(_0x33fdfd){_0x33d939=_0x33fdfd;_0x1c124e['model']=_[_0x1839('0x32')](db[_0x1839('0x55')][_0x1839('0x45')]);_0x1c124e['query']=_[_0x1839('0x32')](_0x2ece61['query']);_0x1c124e[_0x1839('0x3c')]=_['intersection'](_0x1c124e[_0x1839('0x31')],_0x1c124e[_0x1839('0x33')]);_0x526fb5['attributes']=_[_0x1839('0x34')](_0x1c124e['model'],qs['fields'](_0x2ece61['query'][_0x1839('0x36')]));_0x526fb5['attributes']=_0x526fb5[_0x1839('0x35')][_0x1839('0x37')]?_0x526fb5[_0x1839('0x35')]:_0x1c124e['model'];_0x526fb5[_0x1839('0x3a')]=qs['sort'](_0x2ece61[_0x1839('0x33')][_0x1839('0x3b')]);_0x526fb5[_0x1839('0x3e')]=qs[_0x1839('0x3c')](_['pick'](_0x2ece61[_0x1839('0x33')],_0x1c124e[_0x1839('0x3c')]));if(_0x2ece61[_0x1839('0x33')]['filter']){_0x526fb5[_0x1839('0x3e')]=_[_0x1839('0x47')](_0x526fb5[_0x1839('0x3e')],{'$or':_[_0x1839('0x3f')](_0x526fb5[_0x1839('0x35')],function(_0x30e29b){var _0x33f5a5={};_0x33f5a5[_0x30e29b]={'$like':'%'+_0x2ece61[_0x1839('0x33')]['filter']+'%'};return _0x33f5a5;})});}_0x526fb5=_[_0x1839('0x47')]({},_0x526fb5,_0x2ece61[_0x1839('0x48')]);return _0x33d939[_0x1839('0x58')](_0x526fb5);}})[_0x1839('0x28')](function(_0xfe9122){if(_0xfe9122){_0x1cda21=_0xfe9122[_0x1839('0x37')];if(!_0x2ece61['query'][_0x1839('0x38')]('nolimit')){_0x526fb5[_0x1839('0x20')]=qs['limit'](_0x2ece61[_0x1839('0x33')][_0x1839('0x20')]);_0x526fb5[_0x1839('0x1f')]=qs[_0x1839('0x1f')](_0x2ece61['query'][_0x1839('0x1f')]);}return _0x33d939[_0x1839('0x58')](_0x526fb5);}})[_0x1839('0x28')](function(_0x119b22){if(_0x119b22){return _0x119b22?{'count':_0x1cda21,'rows':_0x119b22}:null;}})[_0x1839('0x28')](respondWithResult(_0x270501,null))['catch'](handleError(_0x270501,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 08fecf6..76b58f2 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 _0xbb6e=['define','CmCompany','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb6e,0x1c4));var _0xebb6=function(_0x2a2b22,_0x3fa62c){_0x2a2b22=_0x2a2b22-0x0;var _0x710fd9=_0xbb6e[_0x2a2b22];return _0x710fd9;};'use strict';var _=require(_0xebb6('0x0'));var util=require(_0xebb6('0x1'));var logger=require(_0xebb6('0x2'))('api');var moment=require(_0xebb6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xebb6('0x4'));var rimraf=require(_0xebb6('0x5'));var config=require(_0xebb6('0x6'));var attributes=require(_0xebb6('0x7'));module['exports']=function(_0x52771e,_0x24fbc4){return _0x52771e[_0xebb6('0x8')](_0xebb6('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x394a=['../../config/environment','exports','define','CmCompany','util','api','bluebird','path','rimraf'];(function(_0x12cae1,_0x71e0d2){var _0x726f43=function(_0x2e71e0){while(--_0x2e71e0){_0x12cae1['push'](_0x12cae1['shift']());}};_0x726f43(++_0x71e0d2);}(_0x394a,0x1f3));var _0xa394=function(_0x26f145,_0xfe0e1d){_0x26f145=_0x26f145-0x0;var _0x2b55f0=_0x394a[_0x26f145];return _0x2b55f0;};'use strict';var _=require('lodash');var util=require(_0xa394('0x0'));var logger=require('../../config/logger')(_0xa394('0x1'));var moment=require('moment');var BPromise=require(_0xa394('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa394('0x3'));var rimraf=require(_0xa394('0x4'));var config=require(_0xa394('0x5'));var attributes=require('./cmCompany.attributes');module[_0xa394('0x6')]=function(_0x210a0b,_0x11f468){return _0x210a0b[_0xa394('0x7')](_0xa394('0x8'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 9fe8a2a..e540b6a 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 _0x24a6=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x22b201,_0x1df7ec){var _0x445393=function(_0x2148ef){while(--_0x2148ef){_0x22b201['push'](_0x22b201['shift']());}};_0x445393(++_0x1df7ec);}(_0x24a6,0x1d4));var _0x624a=function(_0x478fe2,_0x368eee){_0x478fe2=_0x478fe2-0x0;var _0x2f2f46=_0x24a6[_0x478fe2];return _0x2f2f46;};'use strict';var _=require(_0x624a('0x0'));var util=require(_0x624a('0x1'));var moment=require(_0x624a('0x2'));var BPromise=require(_0x624a('0x3'));var rs=require(_0x624a('0x4'));var fs=require('fs');var Redis=require(_0x624a('0x5'));var db=require(_0x624a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x624a('0x7'))('rpc');var config=require(_0x624a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x624a('0x9')][_0x624a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e3327,_0x1bae1a,_0x2f959d){return new BPromise(function(_0x19b6e6,_0x2196a6){return client[_0x624a('0xb')](_0x3e3327,_0x2f959d)[_0x624a('0xc')](function(_0x50f16b){logger[_0x624a('0xd')](_0x624a('0xe'),_0x1bae1a,_0x624a('0xf'));logger[_0x624a('0x10')](_0x624a('0x11'),_0x1bae1a,_0x624a('0xf'),JSON[_0x624a('0x12')](_0x50f16b));if(_0x50f16b[_0x624a('0x13')]){if(_0x50f16b['error']['code']===0x1f4){logger[_0x624a('0x13')](_0x624a('0xe'),_0x1bae1a,_0x50f16b['error'][_0x624a('0x14')]);return _0x2196a6(_0x50f16b[_0x624a('0x13')][_0x624a('0x14')]);}logger['error'](_0x624a('0xe'),_0x1bae1a,_0x50f16b['error'][_0x624a('0x14')]);return _0x19b6e6(_0x50f16b[_0x624a('0x13')][_0x624a('0x14')]);}else{logger[_0x624a('0xd')]('CmCompany,\x20%s,\x20%s',_0x1bae1a,'request\x20sent');_0x19b6e6(_0x50f16b['result'][_0x624a('0x14')]);}})[_0x624a('0x15')](function(_0x197306){logger[_0x624a('0x13')]('CmCompany,\x20%s,\x20%s',_0x1bae1a,_0x197306);_0x2196a6(_0x197306);});});} \ No newline at end of file +var _0xe1dc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5c814d,_0x4d81c7){var _0x89b71=function(_0x1068a4){while(--_0x1068a4){_0x5c814d['push'](_0x5c814d['shift']());}};_0x89b71(++_0x4d81c7);}(_0xe1dc,0xcb));var _0xce1d=function(_0x11b43d,_0x3f1aa5){_0x11b43d=_0x11b43d-0x0;var _0x14a908=_0xe1dc[_0x11b43d];return _0x14a908;};'use strict';var _=require(_0xce1d('0x0'));var util=require(_0xce1d('0x1'));var moment=require(_0xce1d('0x2'));var BPromise=require(_0xce1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce1d('0x4'));var db=require(_0xce1d('0x5'))['db'];var utils=require(_0xce1d('0x6'));var logger=require(_0xce1d('0x7'))(_0xce1d('0x8'));var config=require('../../config/environment');var jayson=require(_0xce1d('0x9'));var client=jayson['client'][_0xce1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x565e69,_0x5e539e,_0x55a626){return new BPromise(function(_0x2f6404,_0x30c554){return client['request'](_0x565e69,_0x55a626)[_0xce1d('0xb')](function(_0x57e3ad){logger[_0xce1d('0xc')](_0xce1d('0xd'),_0x5e539e,_0xce1d('0xe'));logger[_0xce1d('0xf')](_0xce1d('0x10'),_0x5e539e,_0xce1d('0xe'),JSON[_0xce1d('0x11')](_0x57e3ad));if(_0x57e3ad[_0xce1d('0x12')]){if(_0x57e3ad[_0xce1d('0x12')][_0xce1d('0x13')]===0x1f4){logger[_0xce1d('0x12')](_0xce1d('0xd'),_0x5e539e,_0x57e3ad['error'][_0xce1d('0x14')]);return _0x30c554(_0x57e3ad[_0xce1d('0x12')][_0xce1d('0x14')]);}logger[_0xce1d('0x12')](_0xce1d('0xd'),_0x5e539e,_0x57e3ad[_0xce1d('0x12')]['message']);return _0x2f6404(_0x57e3ad[_0xce1d('0x12')][_0xce1d('0x14')]);}else{logger['info'](_0xce1d('0xd'),_0x5e539e,'request\x20sent');_0x2f6404(_0x57e3ad[_0xce1d('0x15')][_0xce1d('0x14')]);}})[_0xce1d('0x16')](function(_0x417121){logger[_0xce1d('0x12')]('CmCompany,\x20%s,\x20%s',_0x5e539e,_0x417121);_0x30c554(_0x417121);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 33ae52d..c6a1df0 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 _0xd477=['put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','create','post','addContacts'];(function(_0x433dc0,_0x122ca6){var _0x3ced3c=function(_0x302318){while(--_0x302318){_0x433dc0['push'](_0x433dc0['shift']());}};_0x3ced3c(++_0x122ca6);}(_0xd477,0xdf));var _0x7d47=function(_0x45aca3,_0x2dc880){_0x45aca3=_0x45aca3-0x0;var _0x540d06=_0xd477[_0x45aca3];return _0x540d06;};'use strict';var multer=require(_0x7d47('0x0'));var util=require(_0x7d47('0x1'));var path=require(_0x7d47('0x2'));var timeout=require(_0x7d47('0x3'));var express=require(_0x7d47('0x4'));var router=express['Router']();var fs_extra=require(_0x7d47('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7d47('0x6'));var config=require(_0x7d47('0x7'));var controller=require('./cmCompany.controller');router[_0x7d47('0x8')]('/',auth[_0x7d47('0x9')](),controller[_0x7d47('0xa')]);router[_0x7d47('0x8')](_0x7d47('0xb'),auth[_0x7d47('0x9')](),controller[_0x7d47('0xc')]);router['get'](_0x7d47('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7d47('0x8')](_0x7d47('0xe'),auth[_0x7d47('0x9')](),controller[_0x7d47('0xf')]);router['post']('/',auth[_0x7d47('0x9')](),controller[_0x7d47('0x10')]);router[_0x7d47('0x11')](_0x7d47('0xe'),auth['isAuthenticated'](),controller[_0x7d47('0x12')]);router[_0x7d47('0x13')](_0x7d47('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x7d47('0x9')](),controller[_0x7d47('0x14')]);module[_0x7d47('0x15')]=router; \ No newline at end of file +var _0xf12d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','put','destroy','exports'];(function(_0x7ab3f9,_0x4aa58b){var _0x502b8f=function(_0x29f065){while(--_0x29f065){_0x7ab3f9['push'](_0x7ab3f9['shift']());}};_0x502b8f(++_0x4aa58b);}(_0xf12d,0xcc));var _0xdf12=function(_0x4681ae,_0x52791a){_0x4681ae=_0x4681ae-0x0;var _0x5b0ce6=_0xf12d[_0x4681ae];return _0x5b0ce6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdf12('0x0'));var express=require(_0xdf12('0x1'));var router=express[_0xdf12('0x2')]();var fs_extra=require(_0xdf12('0x3'));var auth=require(_0xdf12('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdf12('0x5'));router[_0xdf12('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdf12('0x6')]('/describe',auth[_0xdf12('0x7')](),controller[_0xdf12('0x8')]);router['get'](_0xdf12('0x9'),auth[_0xdf12('0x7')](),controller['show']);router[_0xdf12('0x6')](_0xdf12('0xa'),auth[_0xdf12('0x7')](),controller[_0xdf12('0xb')]);router[_0xdf12('0xc')]('/',auth['isAuthenticated'](),controller[_0xdf12('0xd')]);router['post']('/:id/contacts',auth[_0xdf12('0x7')](),controller['addContacts']);router[_0xdf12('0xe')](_0xdf12('0x9'),auth[_0xdf12('0x7')](),controller['update']);router['delete'](_0xdf12('0x9'),auth['isAuthenticated'](),controller[_0xdf12('0xf')]);module[_0xdf12('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5a80dbd..fdd89d8 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 _0xdf04=['INTEGER','UNSIGNED','NOW','lodash','sequelize','STRING','TEXT'];(function(_0x595d29,_0x3cab2a){var _0x254cdf=function(_0x2f3b9c){while(--_0x2f3b9c){_0x595d29['push'](_0x595d29['shift']());}};_0x254cdf(++_0x3cab2a);}(_0xdf04,0x8f));var _0x4df0=function(_0x544715,_0xc2d150){_0x544715=_0x544715-0x0;var _0x371fbb=_0xdf04[_0x544715];return _0x371fbb;};'use strict';var _=require(_0x4df0('0x0'));var Sequelize=require(_0x4df0('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x4df0('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x4df0('0x2')]},'city':{'type':Sequelize[_0x4df0('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x4df0('0x2')]},'description':{'type':Sequelize[_0x4df0('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x4df0('0x2')]},'fax':{'type':Sequelize[_0x4df0('0x2')]},'email':{'type':Sequelize[_0x4df0('0x2')]},'url':{'type':Sequelize[_0x4df0('0x2')]},'facebook':{'type':Sequelize[_0x4df0('0x2')]},'fb_data':{'type':Sequelize[_0x4df0('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x4df0('0x2')]},'teams':{'type':Sequelize[_0x4df0('0x2')]},'viber':{'type':Sequelize[_0x4df0('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x4df0('0x2')]},'telegram':{'type':Sequelize[_0x4df0('0x2')]},'UserId':{'type':Sequelize[_0x4df0('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4df0('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x4df0('0x6')]}}; \ No newline at end of file +var _0x210f=['UNSIGNED','NOW','exports','STRING','INTEGER'];(function(_0x9db9e,_0x4a52b0){var _0x12af4a=function(_0x17e8e4){while(--_0x17e8e4){_0x9db9e['push'](_0x9db9e['shift']());}};_0x12af4a(++_0x4a52b0);}(_0x210f,0x17e));var _0xf210=function(_0x4a38f7,_0x42419){_0x4a38f7=_0x4a38f7-0x0;var _0x1b3108=_0x210f[_0x4a38f7];return _0x1b3108;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xf210('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xf210('0x1')]},'street':{'type':Sequelize[_0xf210('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf210('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xf210('0x1')]},'mobile':{'type':Sequelize[_0xf210('0x1')]},'fax':{'type':Sequelize[_0xf210('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xf210('0x1')]},'facebook':{'type':Sequelize[_0xf210('0x1')]},'fb_data':{'type':Sequelize[_0xf210('0x1')]},'twitter':{'type':Sequelize[_0xf210('0x1')]},'skype':{'type':Sequelize[_0xf210('0x1')]},'teams':{'type':Sequelize[_0xf210('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xf210('0x1')]},'wechat':{'type':Sequelize[_0xf210('0x1')]},'telegram':{'type':Sequelize[_0xf210('0x1')]},'UserId':{'type':Sequelize[_0xf210('0x2')]},'priority':{'type':Sequelize[_0xf210('0x2')](0x2)[_0xf210('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xf210('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 2f45479..36eab8a 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 _0xb162=['c.mobile','c.fax','c.email','c.ListId','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','CmContact','tags','columnName','displayName','analytics','findAll','alias','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','show','params','cf_%d','$and','omit','format','table','setFields','toParam','text','phone','rawAttributes','options','getTags','setTags','ids','getHoppers','includeAll','ContactId','include','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','0777','child_process','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','parse','meta','No\x20phone\x20column\x20specified','binding','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','startCase','Website','Account','closed','secondDisposition','key','browserName','customerIp','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','externalUrl','Interaction','Owner','flatten','sortBy','reverse','slice','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','offset','undefined','limit','count','Content-Range','json','update','then','destroy','status','sendStatus','error','stack','name','index','describe','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','fieldType','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','field','color','tools_tags','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','split','forEach','union','uc.UserId\x20=\x20?','dateOfBirth','DATE','buildExpression','start','end','map','filter','isNil','Contact','isEmpty','c.ListId\x20IN\x20?','concat','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','c.id','Sequelize','SELECT','clone','having','t.id\x20IN\x20?','resolve','role','agent','some','User','getLists','c.ListId\x20IS\x20NULL','user','ListId','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone'];(function(_0x2c9c1a,_0x2192c1){var _0x5c25a2=function(_0xe1e6cc){while(--_0xe1e6cc){_0x2c9c1a['push'](_0x2c9c1a['shift']());}};_0x5c25a2(++_0x2192c1);}(_0xb162,0x1a8));var _0x2b16=function(_0x38819a,_0x316ca7){_0x38819a=_0x38819a-0x0;var _0x880444=_0xb162[_0x38819a];return _0x880444;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2b16('0x0'));var path=require(_0x2b16('0x1'));var fs=require('fs');var _=require(_0x2b16('0x2'));var squel=require(_0x2b16('0x3'));var Papa=require('papaparse');var Redis=require(_0x2b16('0x4'));var qs=require(_0x2b16('0x5'));var as=require(_0x2b16('0x6'));var logger=require('../../config/logger')(_0x2b16('0x7'));var config=require('../../config/environment');var db=require(_0x2b16('0x8'))['db'];config[_0x2b16('0x9')]=_['defaults'](config[_0x2b16('0x9')],{'host':_0x2b16('0xa'),'port':0x18eb});var socket=require(_0x2b16('0xb'))(new Redis(config[_0x2b16('0x9')]));require(_0x2b16('0xc'))[_0x2b16('0xd')](socket);function respondWithResult(_0x47c0b3,_0x414aad){_0x414aad=_0x414aad||0xc8;return function(_0x15f486){if(_0x15f486){return _0x47c0b3['status'](_0x414aad)['json'](_0x15f486);}};}function respondWithFilteredResult(_0x558d60,_0x3daa87){return function(_0x1b6803){if(_0x1b6803){var _0x3d0088=typeof _0x3daa87[_0x2b16('0xe')]===_0x2b16('0xf')&&typeof _0x3daa87[_0x2b16('0x10')]===_0x2b16('0xf');var _0x29bb48=_0x1b6803['count'];var _0x1fc82c=_0x3d0088?0x0:_0x3daa87[_0x2b16('0xe')];var _0x30edfd=_0x3d0088?_0x1b6803[_0x2b16('0x11')]:_0x3daa87['offset']+_0x3daa87[_0x2b16('0x10')];var _0x2efe46;if(_0x30edfd>=_0x29bb48){_0x30edfd=_0x29bb48;_0x2efe46=0xc8;}else{_0x2efe46=0xce;}_0x558d60['status'](_0x2efe46);return _0x558d60['set'](_0x2b16('0x12'),_0x1fc82c+'-'+_0x30edfd+'/'+_0x29bb48)[_0x2b16('0x13')](_0x1b6803);}return null;};}function saveUpdates(_0x2feca4){return function(_0x2f8204){if(_0x2f8204){return _0x2f8204[_0x2b16('0x14')](_0x2feca4)[_0x2b16('0x15')](function(_0x22ba26){return _0x22ba26;});}return null;};}function removeEntity(_0x523c87){return function(_0x535b1a){if(_0x535b1a){return _0x535b1a[_0x2b16('0x16')]()['then'](function(){_0x523c87[_0x2b16('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9625){return function(_0x142216){if(!_0x142216){_0x5e9625[_0x2b16('0x18')](0x194);}return _0x142216;};}function handleError(_0x4b9a64,_0x45e13f){_0x45e13f=_0x45e13f||0x1f4;return function(_0x544c41){logger[_0x2b16('0x19')](_0x544c41[_0x2b16('0x1a')]);if(_0x544c41['name']){delete _0x544c41[_0x2b16('0x1b')];}_0x4b9a64['status'](_0x45e13f)['send'](_0x544c41);};}exports[_0x2b16('0x1c')]=function(_0x21f551,_0x603910){var _0x3387df={},_0xa0aeef={},_0x1e6731={'count':0x0,'rows':[]};return db['CmContact'][_0x2b16('0x1d')]()[_0x2b16('0x15')](function(_0xad6543){var _0x32b091=[];for(var _0x58880b=0x0;_0x58880b0x1){_0xb62fa9['or'](_0x2b16('0x5c'),qs[_0x2b16('0x5d')](_0x5a0be3),null);}else{if(qs['isNumeric'](_0x5a0be3)){_0xb62fa9['or'](_0x2b16('0x5e'),_0x5a0be3+'%');_0xb62fa9['or'](_0x2b16('0x5f'),_0x5a0be3+'%');_0xb62fa9['or']('c.mobile\x20LIKE\x20?',_0x5a0be3+'%');_0xb62fa9['or'](_0x2b16('0x60'),_0x5a0be3+'%');}else if(qs[_0x2b16('0x61')](_0x5a0be3)){_0xb62fa9['or'](_0x2b16('0x62'),_0x5a0be3+'%');}else{_0xb62fa9['or']('c.firstName\x20LIKE\x20?','%'+_0x5a0be3+'%');_0xb62fa9['or']('c.lastName\x20LIKE\x20?','%'+_0x5a0be3+'%');_0xb62fa9['or']('c.email\x20LIKE\x20?','%'+_0x5a0be3+'%');}}}}_0x1a375e[_0x2b16('0x33')](_0xb62fa9);_0x1a375e[_0x2b16('0x63')](_0x2b16('0x64'));var _0xcd9de4={'type':db[_0x2b16('0x65')]['QueryTypes'][_0x2b16('0x66')],'raw':!![]};var _0xae016a=_0x1a375e[_0x2b16('0x67')]()['field']('c.id');if(_0x3387df[_0x2b16('0x31')]){_0x3387df['order'][_0x2b16('0x49')](function(_0x36e125){_0x1a375e['order']('c.'+_0x36e125[0x0],_0x36e125[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2b16('0x55')](_0x1f1e25)){_0x1a375e[_0x2b16('0x68')](_0x3660f4);_0xae016a['where'](_0x2b16('0x69'),_0x1f1e25);}BPromise[_0x2b16('0x6a')]()[_0x2b16('0x15')](function(){if(!_0x3ad4d5)return;if(_0x21f551['user'][_0x2b16('0x6b')]!==_0x2b16('0x6c'))return;if(!_[_0x2b16('0x6d')](_0x3ad4d5[_0x2b16('0x44')],[_0x2b16('0x35'),_0x2b16('0x6e')])){return _0x21f551['user'][_0x2b16('0x6f')]({'attributes':['id'],'raw':!![]})[_0x2b16('0x15')](function(_0xd944ca){if(_['isEmpty'](_0xd944ca)){_0xae016a[_0x2b16('0x33')]('c.ListId\x20IS\x20NULL');_0x1a375e[_0x2b16('0x33')](_0x2b16('0x70'));}else{_0xae016a[_0x2b16('0x33')](_0x2b16('0x56'),_[_0x2b16('0x51')](_0xd944ca,'id'));_0x1a375e[_0x2b16('0x33')]('c.ListId\x20IN\x20?',_[_0x2b16('0x51')](_0xd944ca,'id'));}});}})[_0x2b16('0x15')](function(){if(_0x21f551[_0x2b16('0x71')][_0x2b16('0x6b')]===_0x2b16('0x6c')&&!_0x3ad4d5&&!_0x21f551[_0x2b16('0x2a')][_0x2b16('0x72')])return[];return db[_0x2b16('0x73')]['query'](_0xae016a[_0x2b16('0x74')](),_0xcd9de4);})[_0x2b16('0x15')](function(_0x35eef4){_0x1e6731[_0x2b16('0x11')]=_0x35eef4['length'];if(_0x1e6731['count']===0x0)return[];return db[_0x2b16('0x73')][_0x2b16('0x2a')](_0x174019[_0x2b16('0x74')](),_0xcd9de4)[_0x2b16('0x15')](function(_0x5707b3){_0xdb8495=_[_0x2b16('0x75')](_0x5707b3,'id');_0xcd9de4=_[_0x2b16('0x76')](_0xcd9de4,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21f551[_0x2b16('0x2a')]['fields']){_0x3387df[_0x2b16('0x2e')][_0x2b16('0x49')](function(_0x33668f){_0x1a375e['field']('c.'+_0x33668f);});}else{_0x1a375e[_0x2b16('0x35')](_0x2b16('0x64'));_0x1a375e['field'](_0x2b16('0x77'));_0x1a375e[_0x2b16('0x35')](_0x2b16('0x78'));_0x1a375e['field'](_0x2b16('0x79'));_0x1a375e[_0x2b16('0x35')](_0x2b16('0x7a'));_0x1a375e[_0x2b16('0x35')](_0x2b16('0x7b'));_0x1a375e[_0x2b16('0x35')](_0x2b16('0x7c'));_0x1a375e[_0x2b16('0x35')](_0x2b16('0x7d'));_0x1a375e[_0x2b16('0x35')]('c.createdAt');_0x1a375e[_0x2b16('0x35')](_0x2b16('0x7e'));_0x1a375e[_0x2b16('0x35')](_0x2b16('0x7f'));_0x1a375e[_0x2b16('0x35')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3387df[_0x2b16('0x10')])_0x1a375e[_0x2b16('0x10')](_0x3387df[_0x2b16('0x10')]);if(_0x3387df['offset'])_0x1a375e[_0x2b16('0xe')](_0x3387df[_0x2b16('0xe')]);return db[_0x2b16('0x73')][_0x2b16('0x2a')](_0x1a375e[_0x2b16('0x74')](),_0xcd9de4);});})[_0x2b16('0x15')](function(_0x293506){_0x293506[_0x2b16('0x49')](function(_0x3d2dc5){if(_0x3d2dc5[_0x2b16('0x80')]){_0x3d2dc5[_0x2b16('0x81')]=[];_0x3d2dc5[_0x2b16('0x80')][_0x2b16('0x48')](',')[_0x2b16('0x49')](function(_0x48fd49){_0x3d2dc5['Tags'][_0x2b16('0x21')](_0xdb8495[_0x48fd49]);});}delete _0x3d2dc5['TagIds'];});_0x1e6731[_0x2b16('0x82')]=_0x293506;return _0x1e6731;})[_0x2b16('0x15')](respondWithFilteredResult(_0x603910,_0x3387df));})[_0x2b16('0x83')](handleError(_0x603910,null));};exports[_0x2b16('0x16')]=function(_0x58385d,_0x5f57f2){return db[_0x2b16('0x84')][_0x2b16('0x45')]({'where':{'id':_0x58385d['params']['id']}})['then'](handleEntityNotFound(_0x5f57f2,null))[_0x2b16('0x15')](removeEntity(_0x5f57f2,null))[_0x2b16('0x83')](handleError(_0x5f57f2,null));};exports[_0x2b16('0x1d')]=function(_0x35f338,_0x79dae8){return db[_0x2b16('0x84')][_0x2b16('0x1d')]()[_0x2b16('0x15')](function(_0x295313){delete _0x295313[_0x2b16('0x85')];for(var _0x527eb6=0x0;_0x527eb6=_0x1f775a){_0x29f895=_0x1f775a;_0x3cf2a8=0xc8;}else{_0x3cf2a8=0xce;}_0x11e111[_0x68d7('0x12')](_0x3cf2a8);return _0x11e111[_0x68d7('0x17')](_0x68d7('0x18'),_0x287267+'-'+_0x29f895+'/'+_0x1f775a)[_0x68d7('0x13')](_0x3230b0);}return null;};}function saveUpdates(_0x4a6b4c){return function(_0xf9975b){if(_0xf9975b){return _0xf9975b['update'](_0x4a6b4c)[_0x68d7('0x19')](function(_0x170be1){return _0x170be1;});}return null;};}function removeEntity(_0x202aea){return function(_0x3ae0f4){if(_0x3ae0f4){return _0x3ae0f4['destroy']()[_0x68d7('0x19')](function(){_0x202aea['status'](0xcc)[_0x68d7('0x1a')]();});}};}function handleEntityNotFound(_0x2b13d9){return function(_0x353fa4){if(!_0x353fa4){_0x2b13d9[_0x68d7('0x1b')](0x194);}return _0x353fa4;};}function handleError(_0x4049a0,_0xccb0fc){_0xccb0fc=_0xccb0fc||0x1f4;return function(_0x4293b3){logger[_0x68d7('0x1c')](_0x4293b3[_0x68d7('0x1d')]);if(_0x4293b3[_0x68d7('0x1e')]){delete _0x4293b3['name'];}_0x4049a0['status'](_0xccb0fc)['send'](_0x4293b3);};}exports[_0x68d7('0x1f')]=function(_0xd60fd4,_0x584b4e){var _0x18c497={},_0x451a13={},_0x14220c={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0x68d7('0x19')](function(_0x47fe08){var _0x24e23b=[];for(var _0x5971b6=0x0;_0x5971b60x1){_0x1f528['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2e49b8),null);}else{if(qs[_0x68d7('0x5a')](_0x2e49b8)){_0x1f528['or'](_0x68d7('0x5b'),_0x2e49b8+'%');_0x1f528['or']('c.phone\x20LIKE\x20?',_0x2e49b8+'%');_0x1f528['or'](_0x68d7('0x5c'),_0x2e49b8+'%');_0x1f528['or'](_0x68d7('0x5d'),_0x2e49b8+'%');}else if(qs[_0x68d7('0x5e')](_0x2e49b8)){_0x1f528['or'](_0x68d7('0x5f'),_0x2e49b8+'%');}else{_0x1f528['or'](_0x68d7('0x60'),'%'+_0x2e49b8+'%');_0x1f528['or']('c.lastName\x20LIKE\x20?','%'+_0x2e49b8+'%');_0x1f528['or'](_0x68d7('0x5f'),'%'+_0x2e49b8+'%');}}}}_0x1cdb4c[_0x68d7('0x39')](_0x1f528);_0x1cdb4c[_0x68d7('0x61')](_0x68d7('0x62'));var _0x1b229b={'type':db[_0x68d7('0x63')][_0x68d7('0x64')]['SELECT'],'raw':!![]};var _0xaa6b55=_0x1cdb4c['clone']()[_0x68d7('0x31')](_0x68d7('0x62'));if(_0x18c497[_0x68d7('0x65')]){_0x18c497[_0x68d7('0x65')][_0x68d7('0x51')](function(_0x1fec6c){_0x1cdb4c[_0x68d7('0x65')]('c.'+_0x1fec6c[0x0],_0x1fec6c[0x1]===_0x68d7('0x66')?![]:!![]);});}if(!_[_0x68d7('0x50')](_0x1eff8c)){_0x1cdb4c['having'](_0x45e5fa);_0xaa6b55[_0x68d7('0x39')](_0x68d7('0x67'),_0x1eff8c);}BPromise[_0x68d7('0x68')]()[_0x68d7('0x19')](function(){if(!_0x3dc67a)return;if(_0xd60fd4['user'][_0x68d7('0x69')]!==_0x68d7('0x6a'))return;if(!_['some'](_0x3dc67a[_0x68d7('0x3e')],[_0x68d7('0x31'),'User'])){return _0xd60fd4['user'][_0x68d7('0x6b')]({'attributes':['id'],'raw':!![]})[_0x68d7('0x19')](function(_0x47f4c0){if(_['isEmpty'](_0x47f4c0)){_0xaa6b55[_0x68d7('0x39')]('c.ListId\x20IS\x20NULL');_0x1cdb4c[_0x68d7('0x39')](_0x68d7('0x6c'));}else{_0xaa6b55[_0x68d7('0x39')](_0x68d7('0x53'),_[_0x68d7('0x42')](_0x47f4c0,'id'));_0x1cdb4c['where'](_0x68d7('0x53'),_[_0x68d7('0x42')](_0x47f4c0,'id'));}});}})[_0x68d7('0x19')](function(){if(_0xd60fd4['user'][_0x68d7('0x69')]==='agent'&&!_0x3dc67a&&!_0xd60fd4[_0x68d7('0x29')][_0x68d7('0x52')])return[];return db[_0x68d7('0x6d')][_0x68d7('0x29')](_0xaa6b55[_0x68d7('0x6e')](),_0x1b229b);})[_0x68d7('0x19')](function(_0x5323a1){_0x14220c['count']=_0x5323a1[_0x68d7('0x21')];if(_0x14220c[_0x68d7('0x15')]===0x0)return[];return db[_0x68d7('0x6d')][_0x68d7('0x29')](_0x24f74d[_0x68d7('0x6e')](),_0x1b229b)[_0x68d7('0x19')](function(_0xa1241e){_0x2d4ec7=_[_0x68d7('0x6f')](_0xa1241e,'id');_0x1b229b=_[_0x68d7('0x70')](_0x1b229b,{'model':db[_0x68d7('0x71')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd60fd4[_0x68d7('0x29')][_0x68d7('0x2c')]){_0x18c497[_0x68d7('0x2b')][_0x68d7('0x51')](function(_0x3009a9){_0x1cdb4c[_0x68d7('0x31')]('c.'+_0x3009a9);});}else{_0x1cdb4c[_0x68d7('0x31')]('c.id');_0x1cdb4c[_0x68d7('0x31')]('c.firstName');_0x1cdb4c[_0x68d7('0x31')]('c.lastName');_0x1cdb4c['field'](_0x68d7('0x72'));_0x1cdb4c[_0x68d7('0x31')](_0x68d7('0x73'));_0x1cdb4c['field'](_0x68d7('0x74'));_0x1cdb4c[_0x68d7('0x31')](_0x68d7('0x75'));_0x1cdb4c[_0x68d7('0x31')](_0x68d7('0x76'));_0x1cdb4c['field'](_0x68d7('0x77'));_0x1cdb4c[_0x68d7('0x31')]('c.deletedAt');_0x1cdb4c[_0x68d7('0x31')]('c.CompanyId');_0x1cdb4c[_0x68d7('0x31')](_0x68d7('0x78'),_0x68d7('0x79'));}if(_0x18c497['limit'])_0x1cdb4c['limit'](_0x18c497[_0x68d7('0x2d')]);if(_0x18c497[_0x68d7('0x16')])_0x1cdb4c[_0x68d7('0x16')](_0x18c497[_0x68d7('0x16')]);return db[_0x68d7('0x6d')][_0x68d7('0x29')](_0x1cdb4c['toString'](),_0x1b229b);});})[_0x68d7('0x19')](function(_0x1b1b34){_0x1b1b34[_0x68d7('0x51')](function(_0x5555e7){if(_0x5555e7[_0x68d7('0x79')]){_0x5555e7['Tags']=[];_0x5555e7[_0x68d7('0x79')]['split'](',')['forEach'](function(_0x56aefe){_0x5555e7[_0x68d7('0x7a')]['push'](_0x2d4ec7[_0x56aefe]);});}delete _0x5555e7[_0x68d7('0x79')];});_0x14220c['rows']=_0x1b1b34;return _0x14220c;})[_0x68d7('0x19')](respondWithFilteredResult(_0x584b4e,_0x18c497));})[_0x68d7('0x7b')](handleError(_0x584b4e,null));};exports[_0x68d7('0x7c')]=function(_0x31f298,_0x29cff7){return db[_0x68d7('0x71')][_0x68d7('0x3f')]({'where':{'id':_0x31f298[_0x68d7('0x7d')]['id']}})['then'](handleEntityNotFound(_0x29cff7,null))[_0x68d7('0x19')](removeEntity(_0x29cff7,null))[_0x68d7('0x7b')](handleError(_0x29cff7,null));};exports[_0x68d7('0x7e')]=function(_0x6ba78a,_0xce0e99){return db[_0x68d7('0x71')]['describe']()[_0x68d7('0x19')](function(_0x5946bf){delete _0x5946bf[_0x68d7('0x7f')];for(var _0x341c59=0x0;_0x341c59{}\s\\|]/g,'-');_0x2222b2(null,util[_0xaa01('0x1d')]('%s-%s%s',path[_0xaa01('0x1e')](_0xc26a41[_0xaa01('0x1b')],path[_0xaa01('0x1f')](_0xc26a41[_0xaa01('0x1b')])),Date[_0xaa01('0x20')](),path[_0xaa01('0x1f')](_0xc26a41['originalname'])));}})});router[_0xaa01('0x15')]('/csv',upload[_0xaa01('0x21')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0xaa01('0x19')]({'destination':function(_0x4105f8,_0x485367,_0x2ee5f1){_0x2ee5f1(null,path[_0xaa01('0x22')](config[_0xaa01('0x23')],_0xaa01('0x1a')));},'filename':function(_0x21ae00,_0x210690,_0x4945a0){_0x210690[_0xaa01('0x1b')]=_0x210690['originalname'][_0xaa01('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4945a0(null,util[_0xaa01('0x1d')](_0xaa01('0x24'),path[_0xaa01('0x1e')](_0x210690[_0xaa01('0x1b')],path[_0xaa01('0x1f')](_0x210690[_0xaa01('0x1b')])),Date[_0xaa01('0x20')](),path[_0xaa01('0x1f')](_0x210690['originalname'])));}})});router[_0xaa01('0x15')](_0xaa01('0x25'),upload[_0xaa01('0x21')](_0xaa01('0x26')),controller[_0xaa01('0x27')]);router['post'](_0xaa01('0x28'),auth[_0xaa01('0x7')](),controller[_0xaa01('0x29')]);router[_0xaa01('0x2a')](_0xaa01('0xb'),auth[_0xaa01('0x7')](),controller[_0xaa01('0x2b')]);router[_0xaa01('0x2c')](_0xaa01('0xb'),auth[_0xaa01('0x7')](),controller[_0xaa01('0x2d')]);module['exports']=router; \ No newline at end of file +var _0xbeda=['import','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getTags','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','/merge','merge','create','/create_many','bulkCreate','post','/:id/tags','root','originalname','replace','format','extname','now','single','uploadCsv','diskStorage','join','%s-%s%s','basename','/upload','file','/upload/:id'];(function(_0x2437e5,_0xf4e3d4){var _0x210fa4=function(_0x232ed1){while(--_0x232ed1){_0x2437e5['push'](_0x2437e5['shift']());}};_0x210fa4(++_0xf4e3d4);}(_0xbeda,0x109));var _0xabed=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0xbeda[_0x4404ff];return _0x5e7b19;};'use strict';var multer=require(_0xabed('0x0'));var util=require(_0xabed('0x1'));var path=require(_0xabed('0x2'));var timeout=require(_0xabed('0x3'));var express=require('express');var router=express[_0xabed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xabed('0x5'));var interaction=require(_0xabed('0x6'));var config=require(_0xabed('0x7'));var controller=require(_0xabed('0x8'));router[_0xabed('0x9')]('/',auth[_0xabed('0xa')](),controller[_0xabed('0xb')]);router['get'](_0xabed('0xc'),auth[_0xabed('0xa')](),controller[_0xabed('0xd')]);router['get'](_0xabed('0xe'),auth[_0xabed('0xa')](),controller[_0xabed('0xf')]);router[_0xabed('0x9')]('/:id/tags',auth[_0xabed('0xa')](),controller[_0xabed('0x10')]);router[_0xabed('0x9')]('/:id/hoppers',auth[_0xabed('0xa')](),controller['getHoppers']);router[_0xabed('0x9')](_0xabed('0x11'),auth[_0xabed('0xa')](),controller[_0xabed('0x12')]);router[_0xabed('0x9')](_0xabed('0x13'),auth[_0xabed('0xa')](),controller[_0xabed('0x14')]);router[_0xabed('0x9')](_0xabed('0x15'),auth[_0xabed('0xa')](),controller[_0xabed('0x16')]);router[_0xabed('0x9')](_0xabed('0x17'),auth[_0xabed('0xa')](),controller[_0xabed('0x18')]);router['post'](_0xabed('0x19'),auth[_0xabed('0xa')](),controller[_0xabed('0x1a')]);router['post']('/',auth['isAuthenticated'](),controller[_0xabed('0x1b')]);router['post'](_0xabed('0x1c'),auth['isAuthenticated'](),controller[_0xabed('0x1d')]);router[_0xabed('0x1e')](_0xabed('0x1f'),auth[_0xabed('0xa')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x11b235,_0x27b4e2,_0x40dfa2){_0x40dfa2(null,path['join'](config[_0xabed('0x20')],'server/files/tmp'));},'filename':function(_0x19d80b,_0x2f8426,_0x316390){_0x2f8426[_0xabed('0x21')]=_0x2f8426[_0xabed('0x21')][_0xabed('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x316390(null,util[_0xabed('0x23')]('%s-%s%s',path['basename'](_0x2f8426[_0xabed('0x21')],path[_0xabed('0x24')](_0x2f8426[_0xabed('0x21')])),Date[_0xabed('0x25')](),path[_0xabed('0x24')](_0x2f8426['originalname'])));}})});router[_0xabed('0x1e')]('/csv',upload[_0xabed('0x26')]('file'),controller[_0xabed('0x27')]);var upload=multer({'storage':multer[_0xabed('0x28')]({'destination':function(_0x2d0630,_0x545eac,_0x3b14ab){_0x3b14ab(null,path[_0xabed('0x29')](config[_0xabed('0x20')],'server/files/tmp'));},'filename':function(_0x1c9f4f,_0x4995ee,_0x259acf){_0x4995ee[_0xabed('0x21')]=_0x4995ee['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x259acf(null,util['format'](_0xabed('0x2a'),path[_0xabed('0x2b')](_0x4995ee[_0xabed('0x21')],path[_0xabed('0x24')](_0x4995ee['originalname'])),Date[_0xabed('0x25')](),path[_0xabed('0x24')](_0x4995ee['originalname'])));}})});router[_0xabed('0x1e')](_0xabed('0x2c'),upload[_0xabed('0x26')](_0xabed('0x2d')),controller['upload']);router[_0xabed('0x1e')](_0xabed('0x2e'),auth['isAuthenticated'](),controller[_0xabed('0x2f')]);router[_0xabed('0x30')](_0xabed('0xe'),auth['isAuthenticated'](),controller[_0xabed('0x31')]);router['delete'](_0xabed('0xe'),auth[_0xabed('0xa')](),controller[_0xabed('0x32')]);module[_0xabed('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index bec54e7..f81df03 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 _0xb088=['name','STRING','TEXT','long','type','select','values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','getDataValue','setDataValue'];(function(_0x363653,_0x46d818){var _0x2dda6d=function(_0x524826){while(--_0x524826){_0x363653['push'](_0x363653['shift']());}};_0x2dda6d(++_0x46d818);}(_0xb088,0x1ab));var _0x8b08=function(_0x40036f,_0x16b8db){_0x40036f=_0x40036f-0x0;var _0xb105a2=_0xb088[_0x40036f];return _0xb105a2;};'use strict';var Sequelize=require(_0x8b08('0x0'));var _=require(_0x8b08('0x1'));module['exports']={'name':{'type':Sequelize[_0x8b08('0x2')],'get':function(_0x3e7645){return this[_0x8b08('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x21b04c){this[_0x8b08('0x4')]('alias',_0x21b04c?_0x21b04c:this[_0x8b08('0x3')](_0x8b08('0x5')));}},'type':{'type':Sequelize[_0x8b08('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x8b08('0x7')](_0x8b08('0x8')),'get':function(){if(this[_0x8b08('0x3')](_0x8b08('0x9'))===_0x8b08('0xa')){return JSON['parse'](this[_0x8b08('0x3')](_0x8b08('0xb')));}else{return this[_0x8b08('0x3')](_0x8b08('0xb'));}},'set':function(_0x864846){if(Array['isArray'](_0x864846)){this[_0x8b08('0x4')](_0x8b08('0xb'),JSON[_0x8b08('0xc')](_0x864846));}else{this['setDataValue'](_0x8b08('0xb'),_0x864846);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8b08('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8b08('0xe')](_0x8b08('0xf'))}}; \ No newline at end of file +var _0x86d3=['parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','lodash','exports','getDataValue','alias','name','STRING','TEXT','long','type'];(function(_0x28157b,_0x1e6283){var _0x2805e0=function(_0xd207d6){while(--_0xd207d6){_0x28157b['push'](_0x28157b['shift']());}};_0x2805e0(++_0x1e6283);}(_0x86d3,0x127));var _0x386d=function(_0x1fb977,_0x1efdea){_0x1fb977=_0x1fb977-0x0;var _0x37fb64=_0x86d3[_0x1fb977];return _0x37fb64;};'use strict';var Sequelize=require('sequelize');var _=require(_0x386d('0x0'));module[_0x386d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x215df6){return this[_0x386d('0x2')](_0x386d('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x256227){this['setDataValue']('alias',_0x256227?_0x256227:this[_0x386d('0x2')](_0x386d('0x4')));}},'type':{'type':Sequelize[_0x386d('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x386d('0x6')](_0x386d('0x7')),'get':function(){if(this[_0x386d('0x2')](_0x386d('0x8'))==='select'){return JSON[_0x386d('0x9')](this[_0x386d('0x2')](_0x386d('0xa')));}else{return this[_0x386d('0x2')]('values');}},'set':function(_0x254d47){if(Array[_0x386d('0xb')](_0x254d47)){this[_0x386d('0xc')](_0x386d('0xa'),JSON[_0x386d('0xd')](_0x254d47));}else{this[_0x386d('0xc')](_0x386d('0xa'),_0x254d47);}}},'required':{'type':Sequelize[_0x386d('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x386d('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x386d('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index e9536f9..cf62418 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 _0x6426=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','save','update','then','destroy','stack','name','send','index','CmCustomField','fieldName','key','model','differenceBy','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','rows','rawAttributes','find','body','params','catch','create','sequelize','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format'];(function(_0x4459df,_0x536b55){var _0xb7e0f2=function(_0x22a489){while(--_0x22a489){_0x4459df['push'](_0x4459df['shift']());}};_0xb7e0f2(++_0x536b55);}(_0x6426,0x15b));var _0x6642=function(_0x4e0196,_0x282485){_0x4e0196=_0x4e0196-0x0;var _0x105849=_0x6426[_0x4e0196];return _0x105849;};'use strict';var emlformat=require(_0x6642('0x0'));var rimraf=require(_0x6642('0x1'));var zipdir=require(_0x6642('0x2'));var jsonpatch=require(_0x6642('0x3'));var rp=require(_0x6642('0x4'));var moment=require('moment');var BPromise=require(_0x6642('0x5'));var Mustache=require(_0x6642('0x6'));var util=require('util');var path=require(_0x6642('0x7'));var sox=require(_0x6642('0x8'));var csv=require(_0x6642('0x9'));var ejs=require(_0x6642('0xa'));var fs=require('fs');var fs_extra=require(_0x6642('0xb'));var _=require(_0x6642('0xc'));var squel=require('squel');var crypto=require(_0x6642('0xd'));var jsforce=require(_0x6642('0xe'));var deskjs=require(_0x6642('0xf'));var toCsv=require(_0x6642('0x9'));var querystring=require(_0x6642('0x10'));var Papa=require(_0x6642('0x11'));var Redis=require(_0x6642('0x12'));var authService=require(_0x6642('0x13'));var qs=require(_0x6642('0x14'));var as=require(_0x6642('0x15'));var hardwareService=require(_0x6642('0x16'));var logger=require(_0x6642('0x17'))(_0x6642('0x18'));var utils=require('../../config/utils');var config=require(_0x6642('0x19'));var licenseUtil=require(_0x6642('0x1a'));var db=require(_0x6642('0x1b'))['db'];function respondWithStatusCode(_0x48e8e5,_0x5e4eb1){_0x5e4eb1=_0x5e4eb1||0xcc;return function(_0x36b925){if(_0x36b925){return _0x48e8e5[_0x6642('0x1c')](_0x5e4eb1);}return _0x48e8e5[_0x6642('0x1d')](_0x5e4eb1)[_0x6642('0x1e')]();};}function respondWithResult(_0xbefb67,_0x422f49){_0x422f49=_0x422f49||0xc8;return function(_0x5cd4fb){if(_0x5cd4fb){return _0xbefb67[_0x6642('0x1d')](_0x422f49)[_0x6642('0x1f')](_0x5cd4fb);}};}function respondWithFilteredResult(_0x40421f,_0x7371df){return function(_0x76ea55){if(_0x76ea55){var _0x4679e1=typeof _0x7371df['offset']===_0x6642('0x20')&&typeof _0x7371df[_0x6642('0x21')]===_0x6642('0x20');var _0x3a99cc=_0x76ea55['count'];var _0x440df7=_0x4679e1?0x0:_0x7371df['offset'];var _0x102379=_0x4679e1?_0x76ea55[_0x6642('0x22')]:_0x7371df[_0x6642('0x23')]+_0x7371df[_0x6642('0x21')];var _0x582276;if(_0x102379>=_0x3a99cc){_0x102379=_0x3a99cc;_0x582276=0xc8;}else{_0x582276=0xce;}_0x40421f[_0x6642('0x1d')](_0x582276);return _0x40421f['set']('Content-Range',_0x440df7+'-'+_0x102379+'/'+_0x3a99cc)[_0x6642('0x1f')](_0x76ea55);}return null;};}function patchUpdates(_0x49198c){return function(_0x5d3b71){try{jsonpatch['apply'](_0x5d3b71,_0x49198c,!![]);}catch(_0x543078){return BPromise['reject'](_0x543078);}return _0x5d3b71[_0x6642('0x24')]();};}function saveUpdates(_0x9a77c4,_0x475587){return function(_0x265455){if(_0x265455){return _0x265455[_0x6642('0x25')](_0x9a77c4)[_0x6642('0x26')](function(_0x4f3a45){return _0x4f3a45;});}return null;};}function removeEntity(_0x1b2a71,_0x2d8587){return function(_0x163fb1){if(_0x163fb1){return _0x163fb1[_0x6642('0x27')]()[_0x6642('0x26')](function(){_0x1b2a71[_0x6642('0x1d')](0xcc)[_0x6642('0x1e')]();});}};}function handleEntityNotFound(_0x56298a,_0x2fc6d5){return function(_0xd129fd){if(!_0xd129fd){_0x56298a[_0x6642('0x1c')](0x194);}return _0xd129fd;};}function handleError(_0x3a70b6,_0x5f4366){_0x5f4366=_0x5f4366||0x1f4;return function(_0x3b6976){logger['error'](_0x3b6976[_0x6642('0x28')]);if(_0x3b6976['name']){delete _0x3b6976[_0x6642('0x29')];}_0x3a70b6[_0x6642('0x1d')](_0x5f4366)[_0x6642('0x2a')](_0x3b6976);};}exports[_0x6642('0x2b')]=function(_0x54406c,_0x31b623){var _0x54e237={},_0x21f773={},_0x152674={'count':0x0,'rows':[]};var _0xe9a5f8=_['map'](db[_0x6642('0x2c')]['rawAttributes'],function(_0x4995f4){return{'name':_0x4995f4[_0x6642('0x2d')],'type':_0x4995f4['type'][_0x6642('0x2e')]};});_0x21f773[_0x6642('0x2f')]=_[_0x6642('0x30')](_[_0x6642('0x31')](_0xe9a5f8,_0x6642('0x29')),[_0x6642('0x29')]);_0x21f773[_0x6642('0x32')]=_[_0x6642('0x33')](_0x54406c[_0x6642('0x32')]);_0x21f773[_0x6642('0x34')]=_['intersection'](_0x21f773[_0x6642('0x2f')],_0x21f773[_0x6642('0x32')]);_0x54e237[_0x6642('0x35')]=_[_0x6642('0x36')](_0x21f773[_0x6642('0x2f')],qs[_0x6642('0x37')](_0x54406c[_0x6642('0x32')][_0x6642('0x37')]));_0x54e237[_0x6642('0x35')]=_0x54e237[_0x6642('0x35')][_0x6642('0x38')]?_0x54e237[_0x6642('0x35')]:_0x21f773[_0x6642('0x2f')];if(!_0x54406c[_0x6642('0x32')][_0x6642('0x39')]('nolimit')){_0x54e237[_0x6642('0x21')]=qs[_0x6642('0x21')](_0x54406c[_0x6642('0x32')]['limit']);_0x54e237[_0x6642('0x23')]=qs[_0x6642('0x23')](_0x54406c['query'][_0x6642('0x23')]);}_0x54e237[_0x6642('0x3a')]=qs['sort'](_0x54406c[_0x6642('0x32')][_0x6642('0x3b')]);_0x54e237[_0x6642('0x3c')]=qs[_0x6642('0x34')](_[_0x6642('0x3d')](_0x54406c['query'],_0x21f773['filters']),_0xe9a5f8);if(_0x54406c[_0x6642('0x32')]['filter']){_0x54e237[_0x6642('0x3c')]=_['merge'](_0x54e237[_0x6642('0x3c')],{'$or':_['map'](_0xe9a5f8,function(_0x129eff){if(_0x129eff['type']!=='VIRTUAL'){var _0x44da7e={};_0x44da7e[_0x129eff['name']]={'$like':'%'+_0x54406c[_0x6642('0x32')]['filter']+'%'};return _0x44da7e;}})});}_0x54e237=_[_0x6642('0x3e')]({},_0x54e237,_0x54406c[_0x6642('0x3f')]);var _0x108eb7={'where':_0x54e237[_0x6642('0x3c')]};return db[_0x6642('0x2c')]['count'](_0x108eb7)[_0x6642('0x26')](function(_0x41e95b){_0x152674[_0x6642('0x22')]=_0x41e95b;if(_0x54406c[_0x6642('0x32')][_0x6642('0x40')]){_0x54e237['include']=[{'all':!![]}];}return db[_0x6642('0x2c')]['findAll'](_0x54e237);})[_0x6642('0x26')](function(_0x3957b2){_0x152674[_0x6642('0x41')]=_0x3957b2;return _0x152674;})[_0x6642('0x26')](respondWithFilteredResult(_0x31b623,_0x54e237))['catch'](handleError(_0x31b623,null));};exports['show']=function(_0x2e8753,_0x278776){var _0x59c99f={'raw':!![],'where':{'id':_0x2e8753['params']['id']}},_0x297c5d={};_0x297c5d[_0x6642('0x2f')]=_[_0x6642('0x33')](db['CmCustomField'][_0x6642('0x42')]);_0x297c5d[_0x6642('0x32')]=_[_0x6642('0x33')](_0x2e8753[_0x6642('0x32')]);_0x297c5d[_0x6642('0x34')]=_['intersection'](_0x297c5d[_0x6642('0x2f')],_0x297c5d[_0x6642('0x32')]);_0x59c99f[_0x6642('0x35')]=_[_0x6642('0x36')](_0x297c5d[_0x6642('0x2f')],qs[_0x6642('0x37')](_0x2e8753['query'][_0x6642('0x37')]));_0x59c99f[_0x6642('0x35')]=_0x59c99f[_0x6642('0x35')]['length']?_0x59c99f[_0x6642('0x35')]:_0x297c5d[_0x6642('0x2f')];if(_0x2e8753[_0x6642('0x32')][_0x6642('0x40')]){_0x59c99f['include']=[{'all':!![]}];}_0x59c99f=_['merge']({},_0x59c99f,_0x2e8753['options']);return db[_0x6642('0x2c')][_0x6642('0x43')](_0x59c99f)[_0x6642('0x26')](handleEntityNotFound(_0x278776,null))['then'](respondWithResult(_0x278776,null))['catch'](handleError(_0x278776,null));};exports['update']=function(_0x2704be,_0x506383){if(_0x2704be[_0x6642('0x44')]['id']){delete _0x2704be['body']['id'];}return db['CmCustomField'][_0x6642('0x43')]({'where':{'id':_0x2704be[_0x6642('0x45')]['id']}})[_0x6642('0x26')](handleEntityNotFound(_0x506383,null))[_0x6642('0x26')](saveUpdates(_0x2704be[_0x6642('0x44')],null))[_0x6642('0x26')](respondWithResult(_0x506383,null))['catch'](handleError(_0x506383,null));};exports[_0x6642('0x27')]=function(_0x43777c,_0xa66d28){return db['CmCustomField'][_0x6642('0x43')]({'where':{'id':_0x43777c[_0x6642('0x45')]['id']}})[_0x6642('0x26')](handleEntityNotFound(_0xa66d28,null))[_0x6642('0x26')](removeEntity(_0xa66d28,null))[_0x6642('0x46')](handleError(_0xa66d28,null));};exports[_0x6642('0x47')]=function(_0x598451,_0x50f3){var _0x19fee0;return db[_0x6642('0x48')]['transaction'](function(_0x288e40){return db[_0x6642('0x2c')][_0x6642('0x47')](_0x598451[_0x6642('0x44')],{'transaction':_0x288e40})[_0x6642('0x26')](function(_0x27ac0a){_0x19fee0=_0x27ac0a;var _0x153362={'type':db[_0x6642('0x49')][_0x6642('0x4a')],'transaction':_0x288e40};switch(_0x598451[_0x6642('0x44')][_0x6642('0x4b')]){case _0x6642('0x4c'):_0x153362[_0x6642('0x4b')]=db[_0x6642('0x49')][_0x6642('0x4a')];break;case _0x6642('0x4d'):_0x153362[_0x6642('0x4b')]=db[_0x6642('0x49')][_0x6642('0x4e')];break;case _0x6642('0x4f'):_0x153362[_0x6642('0x4b')]=db[_0x6642('0x49')][_0x6642('0x50')];_0x153362[_0x6642('0x51')]=![];break;default:}return db['sequelize'][_0x6642('0x52')][_0x6642('0x53')](_0x6642('0x54'),util[_0x6642('0x55')](_0x6642('0x56'),_0x19fee0['id']),_0x153362);})[_0x6642('0x26')](function(){return _0x19fee0;});})[_0x6642('0x26')](respondWithResult(_0x50f3,0xc9))[_0x6642('0x46')](handleError(_0x50f3,null));}; \ No newline at end of file +var _0x76f0=['filter','VIRTUAL','merge','includeAll','include','findAll','show','params','keys','options','find','catch','update','body','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','cf_%d','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x76f0,0xc8));var _0x076f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x76f0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x076f('0x0'));var rp=require('request-promise');var moment=require(_0x076f('0x1'));var BPromise=require(_0x076f('0x2'));var Mustache=require(_0x076f('0x3'));var util=require(_0x076f('0x4'));var path=require(_0x076f('0x5'));var sox=require(_0x076f('0x6'));var csv=require(_0x076f('0x7'));var ejs=require(_0x076f('0x8'));var fs=require('fs');var fs_extra=require(_0x076f('0x9'));var _=require(_0x076f('0xa'));var squel=require(_0x076f('0xb'));var crypto=require(_0x076f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x076f('0x7'));var querystring=require('querystring');var Papa=require(_0x076f('0xd'));var Redis=require(_0x076f('0xe'));var authService=require(_0x076f('0xf'));var qs=require(_0x076f('0x10'));var as=require(_0x076f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x076f('0x12'));var config=require(_0x076f('0x13'));var licenseUtil=require(_0x076f('0x14'));var db=require(_0x076f('0x15'))['db'];function respondWithStatusCode(_0x28408a,_0x3f4037){_0x3f4037=_0x3f4037||0xcc;return function(_0x37e303){if(_0x37e303){return _0x28408a[_0x076f('0x16')](_0x3f4037);}return _0x28408a[_0x076f('0x17')](_0x3f4037)[_0x076f('0x18')]();};}function respondWithResult(_0x154081,_0x2735eb){_0x2735eb=_0x2735eb||0xc8;return function(_0x1c7f03){if(_0x1c7f03){return _0x154081['status'](_0x2735eb)[_0x076f('0x19')](_0x1c7f03);}};}function respondWithFilteredResult(_0x2f226a,_0x2938d7){return function(_0x3c2da5){if(_0x3c2da5){var _0x2a4251=typeof _0x2938d7['offset']===_0x076f('0x1a')&&typeof _0x2938d7['limit']===_0x076f('0x1a');var _0x3f145b=_0x3c2da5[_0x076f('0x1b')];var _0x199b62=_0x2a4251?0x0:_0x2938d7[_0x076f('0x1c')];var _0x5187df=_0x2a4251?_0x3c2da5[_0x076f('0x1b')]:_0x2938d7[_0x076f('0x1c')]+_0x2938d7[_0x076f('0x1d')];var _0x54aa92;if(_0x5187df>=_0x3f145b){_0x5187df=_0x3f145b;_0x54aa92=0xc8;}else{_0x54aa92=0xce;}_0x2f226a[_0x076f('0x17')](_0x54aa92);return _0x2f226a[_0x076f('0x1e')](_0x076f('0x1f'),_0x199b62+'-'+_0x5187df+'/'+_0x3f145b)['json'](_0x3c2da5);}return null;};}function patchUpdates(_0x4f08ec){return function(_0x6bb3e1){try{jsonpatch[_0x076f('0x20')](_0x6bb3e1,_0x4f08ec,!![]);}catch(_0x4d1f4b){return BPromise['reject'](_0x4d1f4b);}return _0x6bb3e1[_0x076f('0x21')]();};}function saveUpdates(_0x4ace4d,_0x3ea0ac){return function(_0x4c6c4f){if(_0x4c6c4f){return _0x4c6c4f['update'](_0x4ace4d)['then'](function(_0x4deccc){return _0x4deccc;});}return null;};}function removeEntity(_0x2a743e,_0x535ae8){return function(_0x45d80f){if(_0x45d80f){return _0x45d80f[_0x076f('0x22')]()[_0x076f('0x23')](function(){_0x2a743e[_0x076f('0x17')](0xcc)[_0x076f('0x18')]();});}};}function handleEntityNotFound(_0x11631a,_0x34168c){return function(_0x1d707a){if(!_0x1d707a){_0x11631a[_0x076f('0x16')](0x194);}return _0x1d707a;};}function handleError(_0x4ad1ff,_0x14c246){_0x14c246=_0x14c246||0x1f4;return function(_0x326afe){logger[_0x076f('0x24')](_0x326afe[_0x076f('0x25')]);if(_0x326afe[_0x076f('0x26')]){delete _0x326afe['name'];}_0x4ad1ff[_0x076f('0x17')](_0x14c246)[_0x076f('0x27')](_0x326afe);};}exports[_0x076f('0x28')]=function(_0x3bf853,_0x371b0f){var _0x2bc77d={},_0x846a55={},_0x1421cc={'count':0x0,'rows':[]};var _0x454da5=_[_0x076f('0x29')](db[_0x076f('0x2a')][_0x076f('0x2b')],function(_0x1d0a56){return{'name':_0x1d0a56[_0x076f('0x2c')],'type':_0x1d0a56[_0x076f('0x2d')][_0x076f('0x2e')]};});_0x846a55['model']=_[_0x076f('0x2f')](_[_0x076f('0x29')](_0x454da5,_0x076f('0x26')),['name']);_0x846a55[_0x076f('0x30')]=_['keys'](_0x3bf853[_0x076f('0x30')]);_0x846a55[_0x076f('0x31')]=_[_0x076f('0x32')](_0x846a55['model'],_0x846a55['query']);_0x2bc77d[_0x076f('0x33')]=_['intersection'](_0x846a55['model'],qs['fields'](_0x3bf853[_0x076f('0x30')][_0x076f('0x34')]));_0x2bc77d['attributes']=_0x2bc77d['attributes'][_0x076f('0x35')]?_0x2bc77d[_0x076f('0x33')]:_0x846a55[_0x076f('0x36')];if(!_0x3bf853[_0x076f('0x30')][_0x076f('0x37')](_0x076f('0x38'))){_0x2bc77d[_0x076f('0x1d')]=qs[_0x076f('0x1d')](_0x3bf853[_0x076f('0x30')]['limit']);_0x2bc77d['offset']=qs[_0x076f('0x1c')](_0x3bf853[_0x076f('0x30')][_0x076f('0x1c')]);}_0x2bc77d[_0x076f('0x39')]=qs[_0x076f('0x3a')](_0x3bf853[_0x076f('0x30')][_0x076f('0x3a')]);_0x2bc77d[_0x076f('0x3b')]=qs[_0x076f('0x31')](_[_0x076f('0x3c')](_0x3bf853[_0x076f('0x30')],_0x846a55['filters']),_0x454da5);if(_0x3bf853[_0x076f('0x30')][_0x076f('0x3d')]){_0x2bc77d[_0x076f('0x3b')]=_['merge'](_0x2bc77d[_0x076f('0x3b')],{'$or':_['map'](_0x454da5,function(_0x22272a){if(_0x22272a[_0x076f('0x2d')]!==_0x076f('0x3e')){var _0x59d160={};_0x59d160[_0x22272a[_0x076f('0x26')]]={'$like':'%'+_0x3bf853[_0x076f('0x30')]['filter']+'%'};return _0x59d160;}})});}_0x2bc77d=_[_0x076f('0x3f')]({},_0x2bc77d,_0x3bf853['options']);var _0xcad9db={'where':_0x2bc77d['where']};return db[_0x076f('0x2a')][_0x076f('0x1b')](_0xcad9db)['then'](function(_0x3c850d){_0x1421cc['count']=_0x3c850d;if(_0x3bf853[_0x076f('0x30')][_0x076f('0x40')]){_0x2bc77d[_0x076f('0x41')]=[{'all':!![]}];}return db[_0x076f('0x2a')][_0x076f('0x42')](_0x2bc77d);})['then'](function(_0x3cf620){_0x1421cc['rows']=_0x3cf620;return _0x1421cc;})[_0x076f('0x23')](respondWithFilteredResult(_0x371b0f,_0x2bc77d))['catch'](handleError(_0x371b0f,null));};exports[_0x076f('0x43')]=function(_0x5d442a,_0x31a451){var _0x4c42b1={'raw':!![],'where':{'id':_0x5d442a[_0x076f('0x44')]['id']}},_0x4001ba={};_0x4001ba['model']=_[_0x076f('0x45')](db[_0x076f('0x2a')][_0x076f('0x2b')]);_0x4001ba[_0x076f('0x30')]=_[_0x076f('0x45')](_0x5d442a[_0x076f('0x30')]);_0x4001ba[_0x076f('0x31')]=_['intersection'](_0x4001ba['model'],_0x4001ba['query']);_0x4c42b1[_0x076f('0x33')]=_[_0x076f('0x32')](_0x4001ba[_0x076f('0x36')],qs[_0x076f('0x34')](_0x5d442a[_0x076f('0x30')][_0x076f('0x34')]));_0x4c42b1[_0x076f('0x33')]=_0x4c42b1[_0x076f('0x33')][_0x076f('0x35')]?_0x4c42b1[_0x076f('0x33')]:_0x4001ba['model'];if(_0x5d442a['query'][_0x076f('0x40')]){_0x4c42b1['include']=[{'all':!![]}];}_0x4c42b1=_[_0x076f('0x3f')]({},_0x4c42b1,_0x5d442a[_0x076f('0x46')]);return db[_0x076f('0x2a')][_0x076f('0x47')](_0x4c42b1)[_0x076f('0x23')](handleEntityNotFound(_0x31a451,null))[_0x076f('0x23')](respondWithResult(_0x31a451,null))[_0x076f('0x48')](handleError(_0x31a451,null));};exports[_0x076f('0x49')]=function(_0x33026d,_0x3d0548){if(_0x33026d[_0x076f('0x4a')]['id']){delete _0x33026d[_0x076f('0x4a')]['id'];}return db[_0x076f('0x2a')][_0x076f('0x47')]({'where':{'id':_0x33026d[_0x076f('0x44')]['id']}})[_0x076f('0x23')](handleEntityNotFound(_0x3d0548,null))[_0x076f('0x23')](saveUpdates(_0x33026d[_0x076f('0x4a')],null))[_0x076f('0x23')](respondWithResult(_0x3d0548,null))[_0x076f('0x48')](handleError(_0x3d0548,null));};exports[_0x076f('0x22')]=function(_0x5daee3,_0x55da9f){return db[_0x076f('0x2a')][_0x076f('0x47')]({'where':{'id':_0x5daee3['params']['id']}})[_0x076f('0x23')](handleEntityNotFound(_0x55da9f,null))[_0x076f('0x23')](removeEntity(_0x55da9f,null))[_0x076f('0x48')](handleError(_0x55da9f,null));};exports['create']=function(_0x58a875,_0xe5cd8){var _0x11d855;return db[_0x076f('0x4b')][_0x076f('0x4c')](function(_0x468233){return db['CmCustomField'][_0x076f('0x4d')](_0x58a875[_0x076f('0x4a')],{'transaction':_0x468233})['then'](function(_0xefd9e2){_0x11d855=_0xefd9e2;var _0x3a0a3e={'type':db[_0x076f('0x4e')][_0x076f('0x4f')],'transaction':_0x468233};switch(_0x58a875[_0x076f('0x4a')][_0x076f('0x2d')]){case _0x076f('0x50'):_0x3a0a3e['type']=db[_0x076f('0x4e')][_0x076f('0x4f')];break;case _0x076f('0x51'):_0x3a0a3e[_0x076f('0x2d')]=db[_0x076f('0x4e')][_0x076f('0x52')];break;case _0x076f('0x53'):_0x3a0a3e[_0x076f('0x2d')]=db[_0x076f('0x4e')][_0x076f('0x54')];_0x3a0a3e['defaultValue']=![];break;default:}return db[_0x076f('0x4b')][_0x076f('0x55')]['addColumn']('cm_contacts',util['format'](_0x076f('0x56'),_0x11d855['id']),_0x3a0a3e);})[_0x076f('0x23')](function(){return _0x11d855;});})['then'](respondWithResult(_0xe5cd8,0xc9))[_0x076f('0x48')](handleError(_0xe5cd8,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1c552ac..f89f973 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 _0xa998=['bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','util','../../config/logger','api'];(function(_0x3e8b1e,_0x19cc76){var _0x227a7c=function(_0x4a9820){while(--_0x4a9820){_0x3e8b1e['push'](_0x3e8b1e['shift']());}};_0x227a7c(++_0x19cc76);}(_0xa998,0x1c0));var _0x8a99=function(_0x4fa8a8,_0xe8d21a){_0x4fa8a8=_0x4fa8a8-0x0;var _0xa39439=_0xa998[_0x4fa8a8];return _0xa39439;};'use strict';var _=require('lodash');var util=require(_0x8a99('0x0'));var logger=require(_0x8a99('0x1'))(_0x8a99('0x2'));var moment=require('moment');var BPromise=require(_0x8a99('0x3'));var rp=require(_0x8a99('0x4'));var fs=require('fs');var path=require(_0x8a99('0x5'));var rimraf=require('rimraf');var config=require(_0x8a99('0x6'));var attributes=require(_0x8a99('0x7'));module[_0x8a99('0x8')]=function(_0x176f53,_0x306295){return _0x176f53[_0x8a99('0x9')](_0x8a99('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a24=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_custom_fields','lodash','util'];(function(_0x1ef613,_0x30b47c){var _0x509890=function(_0x40f9d0){while(--_0x40f9d0){_0x1ef613['push'](_0x1ef613['shift']());}};_0x509890(++_0x30b47c);}(_0x7a24,0x196));var _0x47a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a24[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x47a2('0x0'));var util=require(_0x47a2('0x1'));var logger=require(_0x47a2('0x2'))(_0x47a2('0x3'));var moment=require('moment');var BPromise=require(_0x47a2('0x4'));var rp=require(_0x47a2('0x5'));var fs=require('fs');var path=require(_0x47a2('0x6'));var rimraf=require(_0x47a2('0x7'));var config=require(_0x47a2('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x47a2('0x9')]=function(_0x2fc2fb,_0x394b19){return _0x2fc2fb[_0x47a2('0xa')]('CmCustomField',attributes,{'tableName':_0x47a2('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 85bb24d..928ef83 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 _0xbcff=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','catch'];(function(_0x4d6167,_0x3c654c){var _0x126167=function(_0x4a3bb7){while(--_0x4a3bb7){_0x4d6167['push'](_0x4d6167['shift']());}};_0x126167(++_0x3c654c);}(_0xbcff,0x108));var _0xfbcf=function(_0x445f88,_0x1ccdce){_0x445f88=_0x445f88-0x0;var _0x36fb7e=_0xbcff[_0x445f88];return _0x36fb7e;};'use strict';var _=require(_0xfbcf('0x0'));var util=require('util');var moment=require(_0xfbcf('0x1'));var BPromise=require(_0xfbcf('0x2'));var rs=require(_0xfbcf('0x3'));var fs=require('fs');var Redis=require(_0xfbcf('0x4'));var db=require(_0xfbcf('0x5'))['db'];var utils=require(_0xfbcf('0x6'));var logger=require('../../config/logger')(_0xfbcf('0x7'));var config=require(_0xfbcf('0x8'));var jayson=require(_0xfbcf('0x9'));var client=jayson[_0xfbcf('0xa')][_0xfbcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57d1de,_0x2a6e1a,_0x3d039a){return new BPromise(function(_0x30e622,_0x6e1d86){return client['request'](_0x57d1de,_0x3d039a)[_0xfbcf('0xc')](function(_0x38a6f9){logger['info']('CmCustomField,\x20%s,\x20%s',_0x2a6e1a,_0xfbcf('0xd'));logger[_0xfbcf('0xe')](_0xfbcf('0xf'),_0x2a6e1a,_0xfbcf('0xd'),JSON[_0xfbcf('0x10')](_0x38a6f9));if(_0x38a6f9[_0xfbcf('0x11')]){if(_0x38a6f9['error'][_0xfbcf('0x12')]===0x1f4){logger[_0xfbcf('0x11')](_0xfbcf('0x13'),_0x2a6e1a,_0x38a6f9[_0xfbcf('0x11')][_0xfbcf('0x14')]);return _0x6e1d86(_0x38a6f9[_0xfbcf('0x11')][_0xfbcf('0x14')]);}logger[_0xfbcf('0x11')](_0xfbcf('0x13'),_0x2a6e1a,_0x38a6f9[_0xfbcf('0x11')][_0xfbcf('0x14')]);return _0x30e622(_0x38a6f9[_0xfbcf('0x11')][_0xfbcf('0x14')]);}else{logger[_0xfbcf('0x15')](_0xfbcf('0x13'),_0x2a6e1a,_0xfbcf('0xd'));_0x30e622(_0x38a6f9[_0xfbcf('0x16')][_0xfbcf('0x14')]);}})[_0xfbcf('0x17')](function(_0x565003){logger[_0xfbcf('0x11')](_0xfbcf('0x13'),_0x2a6e1a,_0x565003);_0x6e1d86(_0x565003);});});} \ No newline at end of file +var _0xff29=['request\x20sent','debug','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCustomField,\x20%s,\x20%s'];(function(_0x1cc9e7,_0x2cdcd4){var _0x25c4de=function(_0x2227b6){while(--_0x2227b6){_0x1cc9e7['push'](_0x1cc9e7['shift']());}};_0x25c4de(++_0x2cdcd4);}(_0xff29,0x1c0));var _0x9ff2=function(_0x4f73dc,_0xaad6f8){_0x4f73dc=_0x4f73dc-0x0;var _0x1dcc25=_0xff29[_0x4f73dc];return _0x1dcc25;};'use strict';var _=require(_0x9ff2('0x0'));var util=require(_0x9ff2('0x1'));var moment=require('moment');var BPromise=require(_0x9ff2('0x2'));var rs=require(_0x9ff2('0x3'));var fs=require('fs');var Redis=require(_0x9ff2('0x4'));var db=require(_0x9ff2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ff2('0x6'))(_0x9ff2('0x7'));var config=require(_0x9ff2('0x8'));var jayson=require(_0x9ff2('0x9'));var client=jayson[_0x9ff2('0xa')][_0x9ff2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x363345,_0x1312a2,_0x24dbdd){return new BPromise(function(_0x436d9d,_0x57d5ee){return client[_0x9ff2('0xc')](_0x363345,_0x24dbdd)['then'](function(_0x293552){logger['info'](_0x9ff2('0xd'),_0x1312a2,_0x9ff2('0xe'));logger[_0x9ff2('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1312a2,_0x9ff2('0xe'),JSON[_0x9ff2('0x10')](_0x293552));if(_0x293552[_0x9ff2('0x11')]){if(_0x293552[_0x9ff2('0x11')]['code']===0x1f4){logger['error'](_0x9ff2('0xd'),_0x1312a2,_0x293552[_0x9ff2('0x11')][_0x9ff2('0x12')]);return _0x57d5ee(_0x293552[_0x9ff2('0x11')][_0x9ff2('0x12')]);}logger[_0x9ff2('0x11')]('CmCustomField,\x20%s,\x20%s',_0x1312a2,_0x293552[_0x9ff2('0x11')][_0x9ff2('0x12')]);return _0x436d9d(_0x293552[_0x9ff2('0x11')][_0x9ff2('0x12')]);}else{logger[_0x9ff2('0x13')](_0x9ff2('0xd'),_0x1312a2,_0x9ff2('0xe'));_0x436d9d(_0x293552['result'][_0x9ff2('0x12')]);}})[_0x9ff2('0x14')](function(_0x41142e){logger['error']('CmCustomField,\x20%s,\x20%s',_0x1312a2,_0x41142e);_0x57d5ee(_0x41142e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2340233..a432a99 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 _0x7d9f=['./cmCustomField.controller','index','get','isAuthenticated','show','put','/:id','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x230f58,_0x1f8377){var _0x3fdd2c=function(_0x4fb155){while(--_0x4fb155){_0x230f58['push'](_0x230f58['shift']());}};_0x3fdd2c(++_0x1f8377);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x38136b,_0x35c34e){_0x38136b=_0x38136b-0x0;var _0x3b10b9=_0x7d9f[_0x38136b];return _0x3b10b9;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/:id',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['post']('/',auth[_0xf7d9('0xc')](),controller['create']);router[_0xf7d9('0xe')](_0xf7d9('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf7d9('0x10')](_0xf7d9('0xf'),auth[_0xf7d9('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd1bd=['get','index','/:id','post','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x2ed740,_0x5d5927){var _0x40a100=function(_0x2b4f02){while(--_0x2b4f02){_0x2ed740['push'](_0x2ed740['shift']());}};_0x40a100(++_0x5d5927);}(_0xd1bd,0x8a));var _0xdd1b=function(_0x4c93d4,_0x5a17bd){_0x4c93d4=_0x4c93d4-0x0;var _0x29caca=_0xd1bd[_0x4c93d4];return _0x29caca;};'use strict';var multer=require(_0xdd1b('0x0'));var util=require('util');var path=require(_0xdd1b('0x1'));var timeout=require(_0xdd1b('0x2'));var express=require('express');var router=express[_0xdd1b('0x3')]();var fs_extra=require(_0xdd1b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdd1b('0x5'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0xdd1b('0x6')]('/',auth['isAuthenticated'](),controller[_0xdd1b('0x7')]);router[_0xdd1b('0x6')](_0xdd1b('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xdd1b('0x9')]('/',auth[_0xdd1b('0xa')](),controller['create']);router[_0xdd1b('0xb')]('/:id',auth[_0xdd1b('0xa')](),controller[_0xdd1b('0xc')]);router[_0xdd1b('0xd')]('/:id',auth[_0xdd1b('0xa')](),controller[_0xdd1b('0xe')]);module[_0xdd1b('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index fd12f6d..d7ab5d4 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 _0x775a=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','format'];(function(_0x1fcd31,_0x1d1e30){var _0x50757b=function(_0x14346f){while(--_0x14346f){_0x1fcd31['push'](_0x1fcd31['shift']());}};_0x50757b(++_0x1d1e30);}(_0x775a,0x68));var _0xa775=function(_0x36a4ab,_0xf246eb){_0x36a4ab=_0x36a4ab-0x0;var _0x1adbd0=_0x775a[_0x36a4ab];return _0x1adbd0;};'use strict';var moment=require(_0xa775('0x0'));var Sequelize=require(_0xa775('0x1'));module[_0xa775('0x2')]={'phone':{'type':Sequelize[_0xa775('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xa775('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xa775('0x5')](_0xa775('0x6'))},'countbusyretry':{'type':Sequelize[_0xa775('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa775('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa775('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa775('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa775('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xa775('0x7')](0x2)[_0xa775('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa775('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa775('0x7')],'unique':_0xa775('0x9')},'ListId':{'type':Sequelize[_0xa775('0x7')],'unique':_0xa775('0x9')},'UserId':{'type':Sequelize[_0xa775('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xa775('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xa775('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xa775('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa775('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa775('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa775('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf250=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','format','INTEGER','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf250,0xb5));var _0x0f25=function(_0x4ded50,_0x4a6af3){_0x4ded50=_0x4ded50-0x0;var _0xa92135=_0xf250[_0x4ded50];return _0xa92135;};'use strict';var moment=require(_0x0f25('0x0'));var Sequelize=require(_0x0f25('0x1'));module[_0x0f25('0x2')]={'phone':{'type':Sequelize[_0x0f25('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x0f25('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x0f25('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0f25('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0f25('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0f25('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0f25('0x7')]},'priority':{'type':Sequelize[_0x0f25('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0f25('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x0f25('0x8')},'UserId':{'type':Sequelize[_0x0f25('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x0f25('0x6')],'unique':_0x0f25('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x0f25('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0f25('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0f25('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0f25('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index b4cd1ff..1acac92 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 _0x5f09=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$or','$gt','$lt','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','VoiceQueueId','CampaignId','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','ASC','findOne','scheduledat','UPDATE','CmCompany','Company','CmList','VoiceQueue','Queue','dialActive','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','rimraf','zip-dir','request-promise','util','path','sox'];(function(_0x59ab86,_0x5a5765){var _0x26ac1d=function(_0x5aa5d9){while(--_0x5aa5d9){_0x59ab86['push'](_0x59ab86['shift']());}};_0x26ac1d(++_0x5a5765);}(_0x5f09,0x8b));var _0x95f0=function(_0x173bcd,_0x4e7741){_0x173bcd=_0x173bcd-0x0;var _0x369667=_0x5f09[_0x173bcd];return _0x369667;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95f0('0x0'));var zipdir=require(_0x95f0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95f0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x95f0('0x3'));var path=require(_0x95f0('0x4'));var sox=require(_0x95f0('0x5'));var csv=require(_0x95f0('0x6'));var ejs=require(_0x95f0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95f0('0x8'));var squel=require(_0x95f0('0x9'));var crypto=require(_0x95f0('0xa'));var jsforce=require(_0x95f0('0xb'));var deskjs=require(_0x95f0('0xc'));var toCsv=require(_0x95f0('0x6'));var querystring=require(_0x95f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x95f0('0xe'));var authService=require(_0x95f0('0xf'));var qs=require(_0x95f0('0x10'));var as=require(_0x95f0('0x11'));var hardwareService=require(_0x95f0('0x12'));var logger=require(_0x95f0('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x95f0('0x14'));var db=require(_0x95f0('0x15'))['db'];function respondWithStatusCode(_0x31ebc2,_0x1d3c87){_0x1d3c87=_0x1d3c87||0xcc;return function(_0x67c763){if(_0x67c763){return _0x31ebc2['sendStatus'](_0x1d3c87);}return _0x31ebc2[_0x95f0('0x16')](_0x1d3c87)[_0x95f0('0x17')]();};}function respondWithResult(_0x4ee7ef,_0x33549c){_0x33549c=_0x33549c||0xc8;return function(_0x3d2d8a){if(_0x3d2d8a){return _0x4ee7ef[_0x95f0('0x16')](_0x33549c)[_0x95f0('0x18')](_0x3d2d8a);}};}function respondWithFilteredResult(_0x46ae55,_0x5ce762){return function(_0xc70ff0){if(_0xc70ff0){var _0x41db80=typeof _0x5ce762[_0x95f0('0x19')]==='undefined'&&typeof _0x5ce762['limit']==='undefined';var _0x3c24df=_0xc70ff0['count'];var _0x4f74bd=_0x41db80?0x0:_0x5ce762[_0x95f0('0x19')];var _0x3fc42c=_0x41db80?_0xc70ff0[_0x95f0('0x1a')]:_0x5ce762[_0x95f0('0x19')]+_0x5ce762[_0x95f0('0x1b')];var _0x306f7c;if(_0x3fc42c>=_0x3c24df){_0x3fc42c=_0x3c24df;_0x306f7c=0xc8;}else{_0x306f7c=0xce;}_0x46ae55['status'](_0x306f7c);return _0x46ae55[_0x95f0('0x1c')]('Content-Range',_0x4f74bd+'-'+_0x3fc42c+'/'+_0x3c24df)['json'](_0xc70ff0);}return null;};}function patchUpdates(_0x501046){return function(_0x25dc13){try{jsonpatch[_0x95f0('0x1d')](_0x25dc13,_0x501046,!![]);}catch(_0x21ef4a){return BPromise[_0x95f0('0x1e')](_0x21ef4a);}return _0x25dc13[_0x95f0('0x1f')]();};}function saveUpdates(_0x455a7b,_0xdb3c2){return function(_0x5c4503){if(_0x5c4503){return _0x5c4503[_0x95f0('0x20')](_0x455a7b)['then'](function(_0x564437){return _0x564437;});}return null;};}function removeEntity(_0x337457,_0x2c3a48){return function(_0x74ed06){if(_0x74ed06){return _0x74ed06[_0x95f0('0x21')]()[_0x95f0('0x22')](function(){_0x337457['status'](0xcc)[_0x95f0('0x17')]();});}};}function handleEntityNotFound(_0x1af97c,_0x1eb70f){return function(_0x168aef){if(!_0x168aef){_0x1af97c[_0x95f0('0x23')](0x194);}return _0x168aef;};}function handleError(_0x2b36a1,_0x3423c4){_0x3423c4=_0x3423c4||0x1f4;return function(_0x36f3c7){logger[_0x95f0('0x24')](_0x36f3c7[_0x95f0('0x25')]);if(_0x36f3c7[_0x95f0('0x26')]){delete _0x36f3c7['name'];}_0x2b36a1[_0x95f0('0x16')](_0x3423c4)[_0x95f0('0x27')](_0x36f3c7);};}exports[_0x95f0('0x28')]=function(_0x56dc15,_0x3667b7){var _0x1b9fc3={},_0x23e254={},_0xc11e4={'count':0x0,'rows':[]};var _0x3f1c94=_[_0x95f0('0x29')](db[_0x95f0('0x2a')][_0x95f0('0x2b')],function(_0x3b7a8b){return{'name':_0x3b7a8b[_0x95f0('0x2c')],'type':_0x3b7a8b[_0x95f0('0x2d')]['key']};});_0x23e254[_0x95f0('0x2e')]=_[_0x95f0('0x29')](_0x3f1c94,_0x95f0('0x26'));_0x23e254[_0x95f0('0x2f')]=_[_0x95f0('0x30')](_0x56dc15['query']);_0x23e254[_0x95f0('0x31')]=_[_0x95f0('0x32')](_0x23e254[_0x95f0('0x2e')],_0x23e254[_0x95f0('0x2f')]);_0x23e254[_0x95f0('0x31')]=_[_0x95f0('0x33')](_0x23e254[_0x95f0('0x31')],['$and',_0x95f0('0x34'),_0x95f0('0x35'),'$gte',_0x95f0('0x36'),'$lte',_0x95f0('0x37'),_0x95f0('0x38'),_0x95f0('0x39'),'$between',_0x95f0('0x3a'),_0x95f0('0x3b'),_0x95f0('0x3c'),_0x95f0('0x3d'),_0x95f0('0x3e'),'$iLike',_0x95f0('0x3f'),'$like',_0x95f0('0x40'),'$contains',_0x95f0('0x41'),_0x95f0('0x42')]);_0x1b9fc3[_0x95f0('0x43')]=_['intersection'](_0x23e254[_0x95f0('0x2e')],qs[_0x95f0('0x44')](_0x56dc15[_0x95f0('0x2f')]['fields']));_0x1b9fc3[_0x95f0('0x43')]=_0x1b9fc3['attributes'][_0x95f0('0x45')]?_0x1b9fc3[_0x95f0('0x43')]:_0x23e254['model'];if(!_0x56dc15[_0x95f0('0x2f')][_0x95f0('0x46')](_0x95f0('0x47'))){_0x1b9fc3['limit']=qs['limit'](_0x56dc15['query'][_0x95f0('0x1b')]);_0x1b9fc3['offset']=qs[_0x95f0('0x19')](_0x56dc15[_0x95f0('0x2f')]['offset']);}_0x1b9fc3[_0x95f0('0x48')]=qs[_0x95f0('0x49')](_0x56dc15[_0x95f0('0x2f')][_0x95f0('0x49')]);_0x1b9fc3['where']=qs['filters'](_[_0x95f0('0x4a')](_0x56dc15[_0x95f0('0x2f')],_0x23e254['filters']),_0x3f1c94);if(_0x56dc15[_0x95f0('0x2f')][_0x95f0('0x4b')]){_0x1b9fc3[_0x95f0('0x4c')]=_[_0x95f0('0x4d')](_0x1b9fc3[_0x95f0('0x4c')],{'$or':_['map'](_0x3f1c94,function(_0x39d45b){if(_0x39d45b[_0x95f0('0x2d')]!==_0x95f0('0x4e')){var _0x2a961b={};_0x2a961b[_0x39d45b['name']]={'$like':'%'+_0x56dc15[_0x95f0('0x2f')][_0x95f0('0x4b')]+'%'};return _0x2a961b;}})});}_0x1b9fc3=_[_0x95f0('0x4d')]({},_0x1b9fc3,_0x56dc15[_0x95f0('0x4f')]);var _0x5aba34={'where':_0x1b9fc3[_0x95f0('0x4c')]};return db[_0x95f0('0x2a')][_0x95f0('0x1a')](_0x5aba34)['then'](function(_0x47bd45){_0xc11e4[_0x95f0('0x1a')]=_0x47bd45;if(_0x56dc15[_0x95f0('0x2f')][_0x95f0('0x50')]){_0x1b9fc3[_0x95f0('0x51')]=[{'all':!![]}];}return db['CmHopper'][_0x95f0('0x52')](_0x1b9fc3);})[_0x95f0('0x22')](function(_0x302db2){_0xc11e4[_0x95f0('0x53')]=_0x302db2;return _0xc11e4;})[_0x95f0('0x22')](respondWithFilteredResult(_0x3667b7,_0x1b9fc3))[_0x95f0('0x54')](handleError(_0x3667b7,null));};exports['show']=function(_0x2d69b0,_0x2e5197){var _0x361fed={'raw':!![],'where':{'id':_0x2d69b0['params']['id']}},_0x2ab105={};_0x2ab105[_0x95f0('0x2e')]=_[_0x95f0('0x30')](db[_0x95f0('0x2a')][_0x95f0('0x2b')]);_0x2ab105[_0x95f0('0x2f')]=_['keys'](_0x2d69b0[_0x95f0('0x2f')]);_0x2ab105[_0x95f0('0x31')]=_[_0x95f0('0x32')](_0x2ab105['model'],_0x2ab105[_0x95f0('0x2f')]);_0x361fed['attributes']=_['intersection'](_0x2ab105[_0x95f0('0x2e')],qs['fields'](_0x2d69b0[_0x95f0('0x2f')][_0x95f0('0x44')]));_0x361fed[_0x95f0('0x43')]=_0x361fed[_0x95f0('0x43')][_0x95f0('0x45')]?_0x361fed[_0x95f0('0x43')]:_0x2ab105[_0x95f0('0x2e')];if(_0x2d69b0[_0x95f0('0x2f')][_0x95f0('0x50')]){_0x361fed[_0x95f0('0x51')]=[{'all':!![]}];}_0x361fed=_[_0x95f0('0x4d')]({},_0x361fed,_0x2d69b0[_0x95f0('0x4f')]);return db[_0x95f0('0x2a')][_0x95f0('0x55')](_0x361fed)[_0x95f0('0x22')](handleEntityNotFound(_0x2e5197,null))[_0x95f0('0x22')](respondWithResult(_0x2e5197,null))['catch'](handleError(_0x2e5197,null));};exports[_0x95f0('0x56')]=function(_0x312bc5,_0x17aaa4){return db[_0x95f0('0x2a')][_0x95f0('0x56')](_0x312bc5[_0x95f0('0x57')],{})[_0x95f0('0x22')](respondWithResult(_0x17aaa4,0xc9))['catch'](handleError(_0x17aaa4,null));};exports[_0x95f0('0x20')]=function(_0x48efbf,_0x203995){if(_0x48efbf[_0x95f0('0x57')]['id']){delete _0x48efbf[_0x95f0('0x57')]['id'];}return db[_0x95f0('0x2a')][_0x95f0('0x55')]({'where':{'id':_0x48efbf[_0x95f0('0x58')]['id']}})[_0x95f0('0x22')](handleEntityNotFound(_0x203995,null))[_0x95f0('0x22')](saveUpdates(_0x48efbf[_0x95f0('0x57')],null))['then'](respondWithResult(_0x203995,null))[_0x95f0('0x54')](handleError(_0x203995,null));};exports[_0x95f0('0x59')]=function(_0x2895dc,_0x5af1f3){return db[_0x95f0('0x2a')][_0x95f0('0x59')]()[_0x95f0('0x22')](respondWithResult(_0x5af1f3,null))['catch'](handleError(_0x5af1f3,null));};exports[_0x95f0('0x21')]=function(_0x2c6908,_0x5abee6){var _0x57ebef;return db[_0x95f0('0x2a')][_0x95f0('0x55')]({'where':{'id':_0x2c6908[_0x95f0('0x58')]['id']}})[_0x95f0('0x22')](handleEntityNotFound(_0x5abee6,null))[_0x95f0('0x22')](function(_0x7eb226){if(_0x7eb226){return _0x7eb226[_0x95f0('0x21')]()['then'](function(_0x187848){return _0x187848;});}})[_0x95f0('0x22')](function(_0x2bdb0e){_0x57ebef=_0x2bdb0e;if(_0x2bdb0e){if(_0x2bdb0e[_0x95f0('0x5a')]||_0x2bdb0e[_0x95f0('0x5b')]){return db[_0x2bdb0e['VoiceQueueId']?'VoiceQueue':_0x95f0('0x5c')]['find']({'where':{'id':_0x2bdb0e[_0x95f0('0x5a')]?_0x2bdb0e[_0x95f0('0x5a')]:_0x2bdb0e[_0x95f0('0x5b')]},'attributes':['id',_0x95f0('0x26')],'raw':!![]});}}})['then'](function(_0x2233d5){var _0x4295dc={};if(_0x2233d5){_[_0x95f0('0x4d')](_0x4295dc,_['omit'](_0x57ebef[_0x95f0('0x5d')],[_0x95f0('0x5e'),_0x95f0('0x5f'),'id']));_0x4295dc[_0x95f0('0x60')]=0x15;_0x4295dc[_0x95f0('0x61')]=_0x95f0('0x62');_0x4295dc['campaign']=_0x2233d5['name'];_0x4295dc[_0x95f0('0x63')]=_0x2c6908[_0x95f0('0x64')][_0x95f0('0x26')];_0x4295dc[_0x95f0('0x65')]=_0x2c6908['user']['id'];_0x4295dc[_0x95f0('0x62')]=!![];_0x4295dc[_0x95f0('0x66')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4295dc['calleridnum']=_0x57ebef['phone'];_0x4295dc[_0x95f0('0x67')]=_0x57ebef[_0x95f0('0x5a')]?_0x95f0('0x68'):_0x95f0('0x69');return db[_0x95f0('0x6a')][_0x95f0('0x55')]({'where':{'id':_0x4295dc[_0x95f0('0x6b')]},'attributes':[_0x95f0('0x6c'),_0x95f0('0x6d')]})[_0x95f0('0x22')](function(_0xa2fd72){if(!_[_0x95f0('0x6e')](_0x5abee6)&&!_['isNil'](_0xa2fd72[_0x95f0('0x6c')])){_0x4295dc[_0x95f0('0x6f')]=_0xa2fd72['firstName'];if(!_['isNil'](_0xa2fd72[_0x95f0('0x6d')])){_0x4295dc[_0x95f0('0x6f')]+='\x20'+_0xa2fd72[_0x95f0('0x6d')];}}})['finally'](function(){return db[_0x95f0('0x70')][_0x95f0('0x56')](_0x4295dc);});}})[_0x95f0('0x22')](function(){return _0x5abee6[_0x95f0('0x16')](0xcc)['end']();})[_0x95f0('0x54')](handleError(_0x5abee6,null));};exports[_0x95f0('0x71')]=function(_0x38c17f,_0x5989af,_0x32f087){var _0x36fb4e=[];return db[_0x95f0('0x6a')][_0x95f0('0x59')]()['then'](function(_0x21c347){_0x36fb4e=_[_0x95f0('0x30')](_0x21c347);return _0x38c17f['user'][_0x95f0('0x72')]({'where':{'type':_0x95f0('0x73'),'dialActive':!![],'dialMethod':_0x95f0('0x74')},'attributes':['id','dialOrderByScheduledAt',_0x95f0('0x75')],'raw':!![]});})[_0x95f0('0x22')](function(_0x425c62){if(_0x425c62&&_0x425c62[_0x95f0('0x45')]){return db[_0x95f0('0x76')][_0x95f0('0x77')](function(_0x383a9d){var _0x1a33e9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x95f0('0x78')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x95f0('0x29')](_0x425c62,'id')},'$or':[{'UserId':null},{'UserId':_0x38c17f['user']['id']}]};var _0x227900={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x425c62)[_0x95f0('0x4b')](['dialPreviewAutoRecallMe',0x0])[_0x95f0('0x29')]('id')[_0x95f0('0x79')]()},'$or':[{'UserId':null},{'UserId':_0x38c17f[_0x95f0('0x64')]['id']}]};var _0x5a9baa={'$or':[_0x1a33e9,_0x227900]};var _0x5110bf=[];if(_0x38c17f[_0x95f0('0x57')][_0x95f0('0x7a')]&&_0x38c17f['body']['direction']===_0x95f0('0x7b')){if(!_[_0x95f0('0x7c')](_0x38c17f[_0x95f0('0x57')][_0x95f0('0x7d')])){_0x5a9baa['id']={'$in':_0x38c17f[_0x95f0('0x57')]['hopperIds']};}_0x5110bf=[[_0x95f0('0x7e'),'ASC'],['scheduledAt',_0x425c62[0x0]['dialOrderByScheduledAt']==='ASC'?_0x95f0('0x7f'):'ASC'],db['sequelize']['literal'](_0x95f0('0x80')),['id','DESC']];}else{if(!_[_0x95f0('0x7c')](_0x38c17f[_0x95f0('0x57')]['hopperIds'])){_0x5a9baa['id']={'$notIn':_0x38c17f['body']['hopperIds']};}_0x5110bf=[[_0x95f0('0x7e'),_0x95f0('0x7f')],[_0x95f0('0x81'),_0x425c62[0x0]['dialOrderByScheduledAt']],db[_0x95f0('0x76')][_0x95f0('0x82')](_0x95f0('0x83')),['id',_0x95f0('0x84')]];}return db[_0x95f0('0x2a')][_0x95f0('0x85')]({'attributes':['id',_0x95f0('0x86'),'recallme'],'where':_0x5a9baa,'order':_0x5110bf,'transaction':_0x383a9d,'lock':_0x383a9d['LOCK'][_0x95f0('0x87')],'include':[{'model':db[_0x95f0('0x6a')],'as':'Contact','attributes':_0x36fb4e,'include':[{'model':db[_0x95f0('0x88')],'as':_0x95f0('0x89'),'attributes':['id','name']}]},{'model':db[_0x95f0('0x8a')],'as':'List','attributes':['id',_0x95f0('0x26')]},{'model':db[_0x95f0('0x8b')],'as':_0x95f0('0x8c'),'attributes':['id',_0x95f0('0x26'),_0x95f0('0x8d')]}]})[_0x95f0('0x22')](function(_0xb504aa){if(_0xb504aa){return _0xb504aa[_0x95f0('0x20')]({'UserId':_0x38c17f[_0x95f0('0x64')]['id']},{'transaction':_0x383a9d});}});});}})['then'](handleEntityNotFound(_0x5989af,null))[_0x95f0('0x22')](respondWithResult(_0x5989af,null))['catch'](handleError(_0x5989af,null));};exports[_0x95f0('0x8e')]=function(_0x17b497,_0xe70481,_0x44a8c3){return _0x17b497[_0x95f0('0x64')][_0x95f0('0x72')]({'where':{'type':_0x95f0('0x73'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x95f0('0x22')](function(_0x38c052){if(_0x38c052&&_0x38c052[_0x95f0('0x45')]){return db[_0x95f0('0x2a')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x95f0('0x78')](_0x95f0('0x8f'))},'VoiceQueueId':{'$in':_[_0x95f0('0x29')](_0x38c052,'id')},'$or':[{'UserId':null},{'UserId':_0x17b497['user']['id']}]}});}return 0x0;})[_0x95f0('0x22')](function(_0x427f9c){if(!_[_0x95f0('0x6e')](_0x427f9c)&&_[_0x95f0('0x90')](_0x427f9c)){return _0xe70481[_0x95f0('0x16')](0xc8)[_0x95f0('0x18')]({'contacts':_0x427f9c});}else{logger[_0x95f0('0x24')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x95f0('0x8e'),0x194,'entity\x20not\x20found');_0xe70481[_0x95f0('0x23')](0x194);}})[_0x95f0('0x54')](handleError(_0xe70481,null));}; \ No newline at end of file +var _0x1df5=['send','index','map','CmHopper','rawAttributes','type','key','model','name','query','keys','filters','$and','$gt','$lte','$ne','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','UPDATE','CmCompany','CmList','getOpenContacts','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1df5,0xfd));var _0x51df=function(_0x532300,_0x1bd669){_0x532300=_0x532300-0x0;var _0x5c8f52=_0x1df5[_0x532300];return _0x5c8f52;};'use strict';var emlformat=require(_0x51df('0x0'));var rimraf=require(_0x51df('0x1'));var zipdir=require(_0x51df('0x2'));var jsonpatch=require(_0x51df('0x3'));var rp=require(_0x51df('0x4'));var moment=require('moment');var BPromise=require(_0x51df('0x5'));var Mustache=require(_0x51df('0x6'));var util=require(_0x51df('0x7'));var path=require(_0x51df('0x8'));var sox=require(_0x51df('0x9'));var csv=require(_0x51df('0xa'));var ejs=require(_0x51df('0xb'));var fs=require('fs');var fs_extra=require(_0x51df('0xc'));var _=require('lodash');var squel=require(_0x51df('0xd'));var crypto=require('crypto');var jsforce=require(_0x51df('0xe'));var deskjs=require(_0x51df('0xf'));var toCsv=require(_0x51df('0xa'));var querystring=require(_0x51df('0x10'));var Papa=require(_0x51df('0x11'));var Redis=require(_0x51df('0x12'));var authService=require(_0x51df('0x13'));var qs=require(_0x51df('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51df('0x15'));var logger=require(_0x51df('0x16'))(_0x51df('0x17'));var utils=require(_0x51df('0x18'));var config=require(_0x51df('0x19'));var licenseUtil=require(_0x51df('0x1a'));var db=require(_0x51df('0x1b'))['db'];function respondWithStatusCode(_0x27eb0a,_0x4177cb){_0x4177cb=_0x4177cb||0xcc;return function(_0x312850){if(_0x312850){return _0x27eb0a[_0x51df('0x1c')](_0x4177cb);}return _0x27eb0a[_0x51df('0x1d')](_0x4177cb)[_0x51df('0x1e')]();};}function respondWithResult(_0x41da67,_0x4a1f){_0x4a1f=_0x4a1f||0xc8;return function(_0x4ae823){if(_0x4ae823){return _0x41da67[_0x51df('0x1d')](_0x4a1f)[_0x51df('0x1f')](_0x4ae823);}};}function respondWithFilteredResult(_0x53e65a,_0x1edb49){return function(_0x354cb2){if(_0x354cb2){var _0x37ca13=typeof _0x1edb49['offset']===_0x51df('0x20')&&typeof _0x1edb49[_0x51df('0x21')]===_0x51df('0x20');var _0x2a1158=_0x354cb2['count'];var _0x1bdba3=_0x37ca13?0x0:_0x1edb49[_0x51df('0x22')];var _0x5cd515=_0x37ca13?_0x354cb2['count']:_0x1edb49[_0x51df('0x22')]+_0x1edb49['limit'];var _0x392505;if(_0x5cd515>=_0x2a1158){_0x5cd515=_0x2a1158;_0x392505=0xc8;}else{_0x392505=0xce;}_0x53e65a[_0x51df('0x1d')](_0x392505);return _0x53e65a[_0x51df('0x23')](_0x51df('0x24'),_0x1bdba3+'-'+_0x5cd515+'/'+_0x2a1158)['json'](_0x354cb2);}return null;};}function patchUpdates(_0xfba51f){return function(_0xdf7fa4){try{jsonpatch['apply'](_0xdf7fa4,_0xfba51f,!![]);}catch(_0x354cd2){return BPromise['reject'](_0x354cd2);}return _0xdf7fa4[_0x51df('0x25')]();};}function saveUpdates(_0x4bc3bd,_0x5c4877){return function(_0x102498){if(_0x102498){return _0x102498[_0x51df('0x26')](_0x4bc3bd)[_0x51df('0x27')](function(_0x2a8321){return _0x2a8321;});}return null;};}function removeEntity(_0x42ceac,_0x105475){return function(_0x1e1c9d){if(_0x1e1c9d){return _0x1e1c9d[_0x51df('0x28')]()[_0x51df('0x27')](function(){_0x42ceac[_0x51df('0x1d')](0xcc)[_0x51df('0x1e')]();});}};}function handleEntityNotFound(_0x17e807,_0x1dae49){return function(_0x33e275){if(!_0x33e275){_0x17e807[_0x51df('0x1c')](0x194);}return _0x33e275;};}function handleError(_0x1df442,_0x1ee6e2){_0x1ee6e2=_0x1ee6e2||0x1f4;return function(_0x417942){logger[_0x51df('0x29')](_0x417942[_0x51df('0x2a')]);if(_0x417942['name']){delete _0x417942['name'];}_0x1df442[_0x51df('0x1d')](_0x1ee6e2)[_0x51df('0x2b')](_0x417942);};}exports[_0x51df('0x2c')]=function(_0x12b16a,_0x221fd4){var _0x5c4e62={},_0x4bf243={},_0x42f85c={'count':0x0,'rows':[]};var _0x35e7da=_[_0x51df('0x2d')](db[_0x51df('0x2e')][_0x51df('0x2f')],function(_0x1637ab){return{'name':_0x1637ab['fieldName'],'type':_0x1637ab[_0x51df('0x30')][_0x51df('0x31')]};});_0x4bf243[_0x51df('0x32')]=_[_0x51df('0x2d')](_0x35e7da,_0x51df('0x33'));_0x4bf243[_0x51df('0x34')]=_[_0x51df('0x35')](_0x12b16a[_0x51df('0x34')]);_0x4bf243[_0x51df('0x36')]=_['intersection'](_0x4bf243[_0x51df('0x32')],_0x4bf243[_0x51df('0x34')]);_0x4bf243[_0x51df('0x36')]=_['concat'](_0x4bf243[_0x51df('0x36')],[_0x51df('0x37'),'$or',_0x51df('0x38'),'$gte','$lt',_0x51df('0x39'),_0x51df('0x3a'),'$eq',_0x51df('0x3b'),_0x51df('0x3c'),_0x51df('0x3d'),'$in',_0x51df('0x3e'),_0x51df('0x3f'),_0x51df('0x40'),_0x51df('0x41'),_0x51df('0x42'),_0x51df('0x3f'),_0x51df('0x43'),_0x51df('0x44'),_0x51df('0x45'),'$any']);_0x5c4e62[_0x51df('0x46')]=_[_0x51df('0x47')](_0x4bf243['model'],qs[_0x51df('0x48')](_0x12b16a['query']['fields']));_0x5c4e62[_0x51df('0x46')]=_0x5c4e62[_0x51df('0x46')][_0x51df('0x49')]?_0x5c4e62[_0x51df('0x46')]:_0x4bf243[_0x51df('0x32')];if(!_0x12b16a[_0x51df('0x34')][_0x51df('0x4a')](_0x51df('0x4b'))){_0x5c4e62[_0x51df('0x21')]=qs[_0x51df('0x21')](_0x12b16a[_0x51df('0x34')][_0x51df('0x21')]);_0x5c4e62[_0x51df('0x22')]=qs[_0x51df('0x22')](_0x12b16a[_0x51df('0x34')][_0x51df('0x22')]);}_0x5c4e62[_0x51df('0x4c')]=qs[_0x51df('0x4d')](_0x12b16a[_0x51df('0x34')]['sort']);_0x5c4e62[_0x51df('0x4e')]=qs[_0x51df('0x36')](_[_0x51df('0x4f')](_0x12b16a[_0x51df('0x34')],_0x4bf243['filters']),_0x35e7da);if(_0x12b16a[_0x51df('0x34')]['filter']){_0x5c4e62['where']=_['merge'](_0x5c4e62[_0x51df('0x4e')],{'$or':_[_0x51df('0x2d')](_0x35e7da,function(_0x15b215){if(_0x15b215[_0x51df('0x30')]!==_0x51df('0x50')){var _0x1fe5e7={};_0x1fe5e7[_0x15b215[_0x51df('0x33')]]={'$like':'%'+_0x12b16a[_0x51df('0x34')][_0x51df('0x51')]+'%'};return _0x1fe5e7;}})});}_0x5c4e62=_[_0x51df('0x52')]({},_0x5c4e62,_0x12b16a[_0x51df('0x53')]);var _0x41401d={'where':_0x5c4e62[_0x51df('0x4e')]};return db[_0x51df('0x2e')][_0x51df('0x54')](_0x41401d)[_0x51df('0x27')](function(_0x341d60){_0x42f85c[_0x51df('0x54')]=_0x341d60;if(_0x12b16a[_0x51df('0x34')][_0x51df('0x55')]){_0x5c4e62[_0x51df('0x56')]=[{'all':!![]}];}return db[_0x51df('0x2e')][_0x51df('0x57')](_0x5c4e62);})['then'](function(_0x45886a){_0x42f85c[_0x51df('0x58')]=_0x45886a;return _0x42f85c;})[_0x51df('0x27')](respondWithFilteredResult(_0x221fd4,_0x5c4e62))[_0x51df('0x59')](handleError(_0x221fd4,null));};exports['show']=function(_0x299270,_0x14a787){var _0x448f6d={'raw':!![],'where':{'id':_0x299270[_0x51df('0x5a')]['id']}},_0x2ace7d={};_0x2ace7d[_0x51df('0x32')]=_[_0x51df('0x35')](db['CmHopper'][_0x51df('0x2f')]);_0x2ace7d[_0x51df('0x34')]=_[_0x51df('0x35')](_0x299270[_0x51df('0x34')]);_0x2ace7d['filters']=_['intersection'](_0x2ace7d[_0x51df('0x32')],_0x2ace7d[_0x51df('0x34')]);_0x448f6d[_0x51df('0x46')]=_[_0x51df('0x47')](_0x2ace7d[_0x51df('0x32')],qs[_0x51df('0x48')](_0x299270[_0x51df('0x34')][_0x51df('0x48')]));_0x448f6d['attributes']=_0x448f6d[_0x51df('0x46')]['length']?_0x448f6d[_0x51df('0x46')]:_0x2ace7d[_0x51df('0x32')];if(_0x299270[_0x51df('0x34')]['includeAll']){_0x448f6d['include']=[{'all':!![]}];}_0x448f6d=_[_0x51df('0x52')]({},_0x448f6d,_0x299270[_0x51df('0x53')]);return db[_0x51df('0x2e')][_0x51df('0x5b')](_0x448f6d)['then'](handleEntityNotFound(_0x14a787,null))['then'](respondWithResult(_0x14a787,null))[_0x51df('0x59')](handleError(_0x14a787,null));};exports[_0x51df('0x5c')]=function(_0x19bebe,_0x492eb0){return db['CmHopper'][_0x51df('0x5c')](_0x19bebe[_0x51df('0x5d')],{})['then'](respondWithResult(_0x492eb0,0xc9))[_0x51df('0x59')](handleError(_0x492eb0,null));};exports['update']=function(_0x4501cf,_0x533d2c){if(_0x4501cf['body']['id']){delete _0x4501cf[_0x51df('0x5d')]['id'];}return db[_0x51df('0x2e')][_0x51df('0x5b')]({'where':{'id':_0x4501cf[_0x51df('0x5a')]['id']}})[_0x51df('0x27')](handleEntityNotFound(_0x533d2c,null))[_0x51df('0x27')](saveUpdates(_0x4501cf[_0x51df('0x5d')],null))[_0x51df('0x27')](respondWithResult(_0x533d2c,null))[_0x51df('0x59')](handleError(_0x533d2c,null));};exports[_0x51df('0x5e')]=function(_0x9959cc,_0x24a27c){return db['CmHopper'][_0x51df('0x5e')]()[_0x51df('0x27')](respondWithResult(_0x24a27c,null))[_0x51df('0x59')](handleError(_0x24a27c,null));};exports['destroy']=function(_0x5f2373,_0x170c14){var _0x52369f;return db[_0x51df('0x2e')][_0x51df('0x5b')]({'where':{'id':_0x5f2373[_0x51df('0x5a')]['id']}})[_0x51df('0x27')](handleEntityNotFound(_0x170c14,null))[_0x51df('0x27')](function(_0x3bace2){if(_0x3bace2){return _0x3bace2[_0x51df('0x28')]()[_0x51df('0x27')](function(_0x5ef9fc){return _0x5ef9fc;});}})[_0x51df('0x27')](function(_0x45c03d){_0x52369f=_0x45c03d;if(_0x45c03d){if(_0x45c03d[_0x51df('0x5f')]||_0x45c03d[_0x51df('0x60')]){return db[_0x45c03d[_0x51df('0x5f')]?_0x51df('0x61'):_0x51df('0x62')][_0x51df('0x5b')]({'where':{'id':_0x45c03d[_0x51df('0x5f')]?_0x45c03d['VoiceQueueId']:_0x45c03d['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x51df('0x27')](function(_0x396de6){var _0x19d5dc={};if(_0x396de6){_[_0x51df('0x52')](_0x19d5dc,_[_0x51df('0x63')](_0x52369f[_0x51df('0x64')],[_0x51df('0x65'),_0x51df('0x66'),'id']));_0x19d5dc[_0x51df('0x67')]=0x15;_0x19d5dc[_0x51df('0x68')]='deleted';_0x19d5dc[_0x51df('0x69')]=_0x396de6[_0x51df('0x33')];_0x19d5dc[_0x51df('0x6a')]=_0x5f2373['user'][_0x51df('0x33')];_0x19d5dc['UserId']=_0x5f2373[_0x51df('0x6b')]['id'];_0x19d5dc['deleted']=!![];_0x19d5dc[_0x51df('0x6c')]=moment()[_0x51df('0x6d')](_0x51df('0x6e'));_0x19d5dc['calleridnum']=_0x52369f[_0x51df('0x6f')];_0x19d5dc['campaigntype']=_0x52369f[_0x51df('0x5f')]?_0x51df('0x70'):_0x51df('0x71');return db[_0x51df('0x72')][_0x51df('0x5b')]({'where':{'id':_0x19d5dc[_0x51df('0x73')]},'attributes':[_0x51df('0x74'),'lastName']})[_0x51df('0x27')](function(_0x3d7e1d){if(!_[_0x51df('0x75')](_0x170c14)&&!_[_0x51df('0x75')](_0x3d7e1d['firstName'])){_0x19d5dc[_0x51df('0x76')]=_0x3d7e1d['firstName'];if(!_['isNil'](_0x3d7e1d[_0x51df('0x77')])){_0x19d5dc[_0x51df('0x76')]+='\x20'+_0x3d7e1d[_0x51df('0x77')];}}})[_0x51df('0x78')](function(){return db[_0x51df('0x79')][_0x51df('0x5c')](_0x19d5dc);});}})['then'](function(){return _0x170c14[_0x51df('0x1d')](0xcc)[_0x51df('0x1e')]();})['catch'](handleError(_0x170c14,null));};exports[_0x51df('0x7a')]=function(_0x31989c,_0x2c1310,_0x49b970){var _0x320793=[];return db[_0x51df('0x72')][_0x51df('0x5e')]()[_0x51df('0x27')](function(_0xbb8b29){_0x320793=_[_0x51df('0x35')](_0xbb8b29);return _0x31989c['user'][_0x51df('0x7b')]({'where':{'type':_0x51df('0x7c'),'dialActive':!![],'dialMethod':_0x51df('0x7d')},'attributes':['id',_0x51df('0x7e'),_0x51df('0x7f')],'raw':!![]});})[_0x51df('0x27')](function(_0x1989d2){if(_0x1989d2&&_0x1989d2[_0x51df('0x49')]){return db[_0x51df('0x80')][_0x51df('0x81')](function(_0x34d916){var _0x492fe0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x51df('0x6d')](_0x51df('0x6e'))},'VoiceQueueId':{'$in':_[_0x51df('0x2d')](_0x1989d2,'id')},'$or':[{'UserId':null},{'UserId':_0x31989c[_0x51df('0x6b')]['id']}]};var _0x564652={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1989d2)['filter']([_0x51df('0x7f'),0x0])[_0x51df('0x2d')]('id')[_0x51df('0x82')]()},'$or':[{'UserId':null},{'UserId':_0x31989c[_0x51df('0x6b')]['id']}]};var _0x27c30f={'$or':[_0x492fe0,_0x564652]};var _0x21a9dd=[];if(_0x31989c['body'][_0x51df('0x83')]&&_0x31989c[_0x51df('0x5d')][_0x51df('0x83')]===_0x51df('0x84')){if(!_['isEmpty'](_0x31989c[_0x51df('0x5d')][_0x51df('0x85')])){_0x27c30f['id']={'$in':_0x31989c[_0x51df('0x5d')][_0x51df('0x85')]};}_0x21a9dd=[[_0x51df('0x86'),_0x51df('0x87')],['scheduledAt',_0x1989d2[0x0][_0x51df('0x7e')]===_0x51df('0x87')?_0x51df('0x88'):_0x51df('0x87')],db[_0x51df('0x80')][_0x51df('0x89')](_0x51df('0x8a')),['id','DESC']];}else{if(!_[_0x51df('0x8b')](_0x31989c[_0x51df('0x5d')]['hopperIds'])){_0x27c30f['id']={'$notIn':_0x31989c['body'][_0x51df('0x85')]};}_0x21a9dd=[['priority',_0x51df('0x88')],[_0x51df('0x8c'),_0x1989d2[0x0][_0x51df('0x7e')]],db['sequelize'][_0x51df('0x89')](_0x51df('0x8d')),['id',_0x51df('0x87')]];}return db[_0x51df('0x2e')]['findOne']({'attributes':['id','scheduledat',_0x51df('0x8e')],'where':_0x27c30f,'order':_0x21a9dd,'transaction':_0x34d916,'lock':_0x34d916['LOCK'][_0x51df('0x8f')],'include':[{'model':db[_0x51df('0x72')],'as':'Contact','attributes':_0x320793,'include':[{'model':db[_0x51df('0x90')],'as':'Company','attributes':['id',_0x51df('0x33')]}]},{'model':db[_0x51df('0x91')],'as':'List','attributes':['id',_0x51df('0x33')]},{'model':db[_0x51df('0x61')],'as':'Queue','attributes':['id',_0x51df('0x33'),'dialActive']}]})[_0x51df('0x27')](function(_0x3243b9){if(_0x3243b9){return _0x3243b9[_0x51df('0x26')]({'UserId':_0x31989c[_0x51df('0x6b')]['id']},{'transaction':_0x34d916});}});});}})[_0x51df('0x27')](handleEntityNotFound(_0x2c1310,null))['then'](respondWithResult(_0x2c1310,null))[_0x51df('0x59')](handleError(_0x2c1310,null));};exports[_0x51df('0x92')]=function(_0x2ad014,_0x5630a2,_0xa8cbfe){return _0x2ad014[_0x51df('0x6b')][_0x51df('0x7b')]({'where':{'type':_0x51df('0x7c'),'dialActive':!![],'dialMethod':_0x51df('0x7d')},'attributes':['id'],'raw':!![]})[_0x51df('0x27')](function(_0x55df76){if(_0x55df76&&_0x55df76[_0x51df('0x49')]){return db[_0x51df('0x2e')][_0x51df('0x54')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x51df('0x2d')](_0x55df76,'id')},'$or':[{'UserId':null},{'UserId':_0x2ad014['user']['id']}]}});}return 0x0;})[_0x51df('0x27')](function(_0x451089){if(!_[_0x51df('0x75')](_0x451089)&&_['isNumber'](_0x451089)){return _0x5630a2[_0x51df('0x1d')](0xc8)[_0x51df('0x1f')]({'contacts':_0x451089});}else{logger[_0x51df('0x29')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x51df('0x93'));_0x5630a2[_0x51df('0x1c')](0x194);}})[_0x51df('0x59')](handleError(_0x5630a2,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 7f80c18..d2caa27 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 _0xd8fb=['util','../../config/logger','api','path','rimraf','./cmHopper.attributes','exports','CmHopper','scheduledat','priority','lodash'];(function(_0x30ba9d,_0x3be245){var _0x5829a9=function(_0x560218){while(--_0x560218){_0x30ba9d['push'](_0x30ba9d['shift']());}};_0x5829a9(++_0x3be245);}(_0xd8fb,0x99));var _0xbd8f=function(_0x598743,_0x4da1d0){_0x598743=_0x598743-0x0;var _0x1955b0=_0xd8fb[_0x598743];return _0x1955b0;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xbd8f('0xa'),'fields':[_0xbd8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4931e1,_0x89e35d){_0x4931e1=_0x4931e1-0x0;var _0x49fb59=_0xc6ac[_0x4931e1];return _0x49fb59;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 9134e06..a1392ce 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 _0xb2bf=['update','DestroyCmHopper','destroy','GetContactDialer','CmContact','findAll','order','UPDATE','Contact','keys','User','name','voicePause','length','UserId','includes','all','debug','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','transaction','LOCK','push','describe','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopper,\x20%s,\x20%s','GetCmHopper','CmHopper','options','attributes','limit','include','map','model','catch','raw','where','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper'];(function(_0x3c6812,_0x1f6a10){var _0x460350=function(_0x236743){while(--_0x236743){_0x3c6812['push'](_0x3c6812['shift']());}};_0x460350(++_0x1f6a10);}(_0xb2bf,0xf4));var _0xfb2b=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xb2bf[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require(_0xfb2b('0x0'));var util=require(_0xfb2b('0x1'));var moment=require(_0xfb2b('0x2'));var BPromise=require(_0xfb2b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb2b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb2b('0x5'))(_0xfb2b('0x6'));var config=require('../../config/environment');var jayson=require(_0xfb2b('0x7'));var client=jayson[_0xfb2b('0x8')][_0xfb2b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e0797,_0x43cbd7,_0x48b664){return new BPromise(function(_0x3887af,_0x18c0a2){return client[_0xfb2b('0xa')](_0x1e0797,_0x48b664)[_0xfb2b('0xb')](function(_0x424da6){logger[_0xfb2b('0xc')]('CmHopper,\x20%s,\x20%s',_0x43cbd7,_0xfb2b('0xd'));logger['debug'](_0xfb2b('0xe'),_0x43cbd7,_0xfb2b('0xd'),JSON[_0xfb2b('0xf')](_0x424da6));if(_0x424da6[_0xfb2b('0x10')]){if(_0x424da6[_0xfb2b('0x10')][_0xfb2b('0x11')]===0x1f4){logger[_0xfb2b('0x10')]('CmHopper,\x20%s,\x20%s',_0x43cbd7,_0x424da6[_0xfb2b('0x10')][_0xfb2b('0x12')]);return _0x18c0a2(_0x424da6['error'][_0xfb2b('0x12')]);}logger[_0xfb2b('0x10')](_0xfb2b('0x13'),_0x43cbd7,_0x424da6[_0xfb2b('0x10')][_0xfb2b('0x12')]);return _0x3887af(_0x424da6[_0xfb2b('0x10')][_0xfb2b('0x12')]);}else{logger['info'](_0xfb2b('0x13'),_0x43cbd7,_0xfb2b('0xd'));_0x3887af(_0x424da6['result'][_0xfb2b('0x12')]);}})['catch'](function(_0x1beb87){logger[_0xfb2b('0x10')](_0xfb2b('0x13'),_0x43cbd7,_0x1beb87);_0x18c0a2(_0x1beb87);});});}exports[_0xfb2b('0x14')]=function(_0x50972b){var _0x3b5cbd=this;return new Promise(function(_0xd7675f,_0x1a5124){return db[_0xfb2b('0x15')]['findAll']({'raw':_0x50972b[_0xfb2b('0x16')]?_0x50972b['options']['raw']===undefined?!![]:![]:!![],'where':_0x50972b[_0xfb2b('0x16')]?_0x50972b[_0xfb2b('0x16')]['where']||null:null,'attributes':_0x50972b[_0xfb2b('0x16')]?_0x50972b[_0xfb2b('0x16')][_0xfb2b('0x17')]||null:null,'limit':_0x50972b[_0xfb2b('0x16')]?_0x50972b['options'][_0xfb2b('0x18')]||null:null,'include':_0x50972b[_0xfb2b('0x16')]?_0x50972b[_0xfb2b('0x16')][_0xfb2b('0x19')]?_[_0xfb2b('0x1a')](_0x50972b[_0xfb2b('0x16')]['include'],function(_0x39a107){return{'model':db[_0x39a107[_0xfb2b('0x1b')]],'as':_0x39a107['as'],'attributes':_0x39a107['attributes'],'include':_0x39a107[_0xfb2b('0x19')]?_[_0xfb2b('0x1a')](_0x39a107['include'],function(_0x49fab){return{'model':db[_0x49fab[_0xfb2b('0x1b')]],'as':_0x49fab['as'],'attributes':_0x49fab['attributes'],'include':_0x49fab[_0xfb2b('0x19')]?_[_0xfb2b('0x1a')](_0x49fab['include'],function(_0xb774c8){return{'model':db[_0xb774c8[_0xfb2b('0x1b')]],'as':_0xb774c8['as'],'attributes':_0xb774c8[_0xfb2b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfb2b('0xb')](function(_0x30a561){logger[_0xfb2b('0xc')](_0xfb2b('0x14'),_0x50972b);logger['debug'](_0xfb2b('0x14'),_0x50972b,JSON['stringify'](_0x30a561));_0xd7675f(_0x30a561);})[_0xfb2b('0x1c')](function(_0x43203f){logger[_0xfb2b('0x10')](_0xfb2b('0x14'),_0x43203f[_0xfb2b('0x12')],_0x50972b);_0x1a5124(_0x3b5cbd[_0xfb2b('0x10')](0x1f4,_0x43203f['message']));});});};exports['ShowCmHopper']=function(_0x2c20c8){var _0x4563b8=this;return new Promise(function(_0xb51728,_0x582925){return db['CmHopper']['find']({'raw':_0x2c20c8[_0xfb2b('0x16')]?_0x2c20c8[_0xfb2b('0x16')][_0xfb2b('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c20c8[_0xfb2b('0x16')]?_0x2c20c8[_0xfb2b('0x16')][_0xfb2b('0x1e')]||null:null,'attributes':_0x2c20c8[_0xfb2b('0x16')]?_0x2c20c8[_0xfb2b('0x16')][_0xfb2b('0x17')]||null:null,'include':_0x2c20c8[_0xfb2b('0x16')]?_0x2c20c8[_0xfb2b('0x16')][_0xfb2b('0x19')]?_['map'](_0x2c20c8[_0xfb2b('0x16')][_0xfb2b('0x19')],function(_0x47d9ec){return{'model':db[_0x47d9ec[_0xfb2b('0x1b')]],'as':_0x47d9ec['as'],'attributes':_0x47d9ec['attributes'],'include':_0x47d9ec[_0xfb2b('0x19')]?_[_0xfb2b('0x1a')](_0x47d9ec[_0xfb2b('0x19')],function(_0x41039d){return{'model':db[_0x41039d[_0xfb2b('0x1b')]],'as':_0x41039d['as'],'attributes':_0x41039d['attributes'],'include':_0x41039d[_0xfb2b('0x19')]?_[_0xfb2b('0x1a')](_0x41039d[_0xfb2b('0x19')],function(_0xbe1802){return{'model':db[_0xbe1802[_0xfb2b('0x1b')]],'as':_0xbe1802['as'],'attributes':_0xbe1802[_0xfb2b('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfb2b('0xb')](function(_0x240db4){logger[_0xfb2b('0xc')]('ShowCmHopper',_0x2c20c8);logger['debug'](_0xfb2b('0x1f'),_0x2c20c8,JSON['stringify'](_0x240db4));_0xb51728(_0x240db4);})[_0xfb2b('0x1c')](function(_0x52d47c){logger['error'](_0xfb2b('0x1f'),_0x52d47c[_0xfb2b('0x12')],_0x2c20c8);_0x582925(_0x4563b8[_0xfb2b('0x10')](0x1f4,_0x52d47c[_0xfb2b('0x12')]));});});};exports[_0xfb2b('0x20')]=function(_0x136360){var _0x43e3f7=this;return new Promise(function(_0xfe1c3a,_0x4b3979){return db[_0xfb2b('0x15')][_0xfb2b('0x21')](_0x136360[_0xfb2b('0x22')],{'raw':_0x136360[_0xfb2b('0x16')]?_0x136360[_0xfb2b('0x16')][_0xfb2b('0x1d')]===undefined?!![]:![]:!![]})[_0xfb2b('0xb')](function(_0x2bc811){logger[_0xfb2b('0xc')](_0xfb2b('0x20'),_0x136360);logger['debug'](_0xfb2b('0x20'),_0x136360,JSON['stringify'](_0x2bc811));_0xfe1c3a(_0x2bc811);})[_0xfb2b('0x1c')](function(_0x2a2167){logger['error']('CreateCmHopper',_0x2a2167[_0xfb2b('0x12')],_0x136360);_0x4b3979(_0x43e3f7['error'](0x1f4,_0x2a2167[_0xfb2b('0x12')]));});});};exports[_0xfb2b('0x23')]=function(_0x1bac63){var _0x2aeece=this;return new Promise(function(_0x21e068,_0x5b028e){return db[_0xfb2b('0x15')][_0xfb2b('0x24')](_0x1bac63[_0xfb2b('0x22')],{'raw':_0x1bac63[_0xfb2b('0x16')]?_0x1bac63['options'][_0xfb2b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bac63[_0xfb2b('0x16')]?_0x1bac63[_0xfb2b('0x16')]['where']||null:null,'attributes':_0x1bac63['options']?_0x1bac63['options'][_0xfb2b('0x17')]||null:null,'limit':_0x1bac63[_0xfb2b('0x16')]?_0x1bac63[_0xfb2b('0x16')][_0xfb2b('0x18')]||null:null})[_0xfb2b('0xb')](function(_0x450947){logger[_0xfb2b('0xc')](_0xfb2b('0x23'),_0x1bac63);logger['debug'](_0xfb2b('0x23'),_0x1bac63,JSON['stringify'](_0x450947));_0x21e068(_0x450947);})[_0xfb2b('0x1c')](function(_0x2ea1b8){logger[_0xfb2b('0x10')](_0xfb2b('0x23'),_0x2ea1b8[_0xfb2b('0x12')],_0x1bac63);_0x5b028e(_0x2aeece[_0xfb2b('0x10')](0x1f4,_0x2ea1b8[_0xfb2b('0x12')]));});});};exports[_0xfb2b('0x25')]=function(_0x5d0100){var _0x152ac2=this;return new Promise(function(_0x1778ac,_0x4523cd){return db['CmHopper'][_0xfb2b('0x26')]({'where':_0x5d0100[_0xfb2b('0x16')]?_0x5d0100['options'][_0xfb2b('0x1e')]||null:null})['then'](function(_0x2461df){logger[_0xfb2b('0xc')](_0xfb2b('0x25'),_0x5d0100);logger['debug'](_0xfb2b('0x25'),_0x5d0100,JSON[_0xfb2b('0xf')](_0x2461df));_0x1778ac(_0x2461df);})[_0xfb2b('0x1c')](function(_0x1d793d){logger[_0xfb2b('0x10')](_0xfb2b('0x25'),_0x1d793d[_0xfb2b('0x12')],_0x5d0100);_0x4523cd(_0x152ac2[_0xfb2b('0x10')](0x1f4,_0x1d793d[_0xfb2b('0x12')]));});});};exports[_0xfb2b('0x27')]=function(_0x1a6668){var _0x274dca=this;return new Promise(function(_0x2d7bb6,_0x597889){return db[_0xfb2b('0x28')]['describe']()[_0xfb2b('0xb')](function(_0x36b4f2){return db['sequelize']['transaction'](function(_0x444e2f){return db['CmHopper'][_0xfb2b('0x29')]({'where':_0x1a6668[_0xfb2b('0x16')]?_0x1a6668['options'][_0xfb2b('0x1e')]||null:null,'attributes':_0x1a6668[_0xfb2b('0x16')]?_0x1a6668[_0xfb2b('0x16')][_0xfb2b('0x17')]||null:null,'limit':_0x1a6668['options']?_0x1a6668[_0xfb2b('0x16')][_0xfb2b('0x18')]||null:null,'order':_0x1a6668['options']?_0x1a6668['options'][_0xfb2b('0x2a')]||null:null,'transaction':_0x444e2f,'lock':_0x444e2f['LOCK'][_0xfb2b('0x2b')],'include':[{'model':db[_0xfb2b('0x28')],'as':_0xfb2b('0x2c'),'attributes':_[_0xfb2b('0x2d')](_0x36b4f2)},{'model':db[_0xfb2b('0x2e')],'as':'Agent','attributes':['id',_0xfb2b('0x2f'),_0xfb2b('0x30')]}]})[_0xfb2b('0xb')](function(_0x535d54){var _0x2e4fac=[];var _0x11d622=[];for(var _0x48faba=0x0;_0x48faba<_0x535d54[_0xfb2b('0x31')];_0x48faba+=0x1){var _0x55f2c1=_0x535d54[_0x48faba][_0xfb2b('0x32')];if(_0x55f2c1===null){_0x2e4fac['push'](_0x535d54[_0x48faba][_0xfb2b('0x24')](_0x1a6668[_0xfb2b('0x22')],{'transaction':_0x444e2f}));}else if(!_0x11d622[_0xfb2b('0x33')](_0x55f2c1)){_0x11d622['push'](_0x55f2c1);_0x2e4fac['push'](_0x535d54[_0x48faba][_0xfb2b('0x24')](_0x1a6668[_0xfb2b('0x22')],{'transaction':_0x444e2f}));}}return BPromise[_0xfb2b('0x34')](_0x2e4fac);});})['then'](function(_0x244ea6){logger[_0xfb2b('0xc')](_0xfb2b('0x27'),_0x1a6668);logger[_0xfb2b('0x35')]('GetContactDialer',_0x1a6668,JSON['stringify'](_0x244ea6));_0x2d7bb6(_0x244ea6);})[_0xfb2b('0x1c')](function(_0x3bd442){logger['error'](_0xfb2b('0x27'),_0x3bd442[_0xfb2b('0x12')],_0x1a6668);_0x597889(_0x274dca['error'](0x1f4,_0x3bd442[_0xfb2b('0x12')]));});});});};exports[_0xfb2b('0x36')]=function(_0x61300f){var _0x13b454=this;return new Promise(function(_0x230c26,_0x30a862){return db[_0xfb2b('0x37')]['transaction'](function(_0x190774){return db[_0xfb2b('0x38')][_0xfb2b('0x21')](_0x61300f[_0xfb2b('0x22')],{'raw':_0x61300f[_0xfb2b('0x16')]?_0x61300f['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x190774})[_0xfb2b('0xb')](function(){return db['CmHopper']['destroy']({'where':_0x61300f['options']?_0x61300f[_0xfb2b('0x16')][_0xfb2b('0x1e')]||null:null,'transaction':_0x190774});});})[_0xfb2b('0xb')](function(_0x532897){logger['info'](_0xfb2b('0x36'),_0x61300f);logger[_0xfb2b('0x35')]('MoveContactManagedDialer',_0x61300f,JSON[_0xfb2b('0xf')](_0x532897));_0x230c26(_0x532897);})[_0xfb2b('0x1c')](function(_0x373e23){logger[_0xfb2b('0x10')](_0xfb2b('0x36'),_0x373e23['message'],_0x61300f);_0x30a862(_0x13b454[_0xfb2b('0x10')](0x1f4,_0x373e23['message']));});});};exports[_0xfb2b('0x39')]=function(_0x4679c3){var _0x2af049=this;return new Promise(function(_0x3c9617,_0x3f973e){return db[_0xfb2b('0x15')][_0xfb2b('0x29')]({'raw':_0x4679c3[_0xfb2b('0x16')]?_0x4679c3[_0xfb2b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4679c3[_0xfb2b('0x16')]?_0x4679c3[_0xfb2b('0x16')][_0xfb2b('0x1e')]||null:null,'attributes':[[db[_0xfb2b('0x37')]['fn'](_0xfb2b('0x3a'),db[_0xfb2b('0x37')]['fn']('IF',db[_0xfb2b('0x37')]['literal'](_0xfb2b('0x3b')+util['format'](_0xfb2b('0x3c'),moment()[_0xfb2b('0x3d')](_0xfb2b('0x3e')))+_0xfb2b('0x3f')))),_0xfb2b('0x40')]]})['then'](function(_0x323b80){logger[_0xfb2b('0xc')]('CountReScheduled',_0x4679c3);logger[_0xfb2b('0x35')](_0xfb2b('0x39'),_0x4679c3,JSON[_0xfb2b('0xf')](_0x323b80));_0x3c9617(_0x323b80);})['catch'](function(_0x55c68e){logger[_0xfb2b('0x10')](_0xfb2b('0x39'),_0x55c68e['message'],_0x4679c3);_0x3f973e(_0x2af049[_0xfb2b('0x10')](0x1f4,_0x55c68e['message']));});});};exports[_0xfb2b('0x41')]=function(_0x35c66c){var _0x212deb=this;return new Promise(function(_0x40fe78,_0x1603d4){return db[_0xfb2b('0x28')]['describe']()[_0xfb2b('0xb')](function(_0x54d548){return db[_0xfb2b('0x37')][_0xfb2b('0x42')](function(_0x5d99a1){return db['CmHopper'][_0xfb2b('0x29')]({'where':_0x35c66c['options']?_0x35c66c[_0xfb2b('0x16')][_0xfb2b('0x1e')]||null:null,'attributes':_0x35c66c[_0xfb2b('0x16')]?_0x35c66c[_0xfb2b('0x16')][_0xfb2b('0x17')]||null:null,'limit':0x1,'order':_0x35c66c[_0xfb2b('0x16')]?_0x35c66c[_0xfb2b('0x16')][_0xfb2b('0x2a')]||null:null,'group':db[_0xfb2b('0x15')][_0xfb2b('0x32')],'transaction':_0x5d99a1,'lock':_0x5d99a1[_0xfb2b('0x43')][_0xfb2b('0x2b')],'include':_0x35c66c[_0xfb2b('0x16')]?_0x35c66c['options'][_0xfb2b('0x19')]?_['map'](_0x35c66c[_0xfb2b('0x16')][_0xfb2b('0x19')],function(_0x28f887){return{'model':db[_0x28f887[_0xfb2b('0x1b')]],'as':_0x28f887['as'],'attributes':_0x28f887['attributes'],'include':_0x28f887['include']?_['map'](_0x28f887[_0xfb2b('0x19')],function(_0x48b280){return{'model':db[_0x48b280[_0xfb2b('0x1b')]],'as':_0x48b280['as'],'attributes':_0x48b280[_0xfb2b('0x17')],'include':_0x48b280[_0xfb2b('0x19')]?_[_0xfb2b('0x1a')](_0x48b280[_0xfb2b('0x19')],function(_0x35ea13){return{'model':db[_0x35ea13[_0xfb2b('0x1b')]],'as':_0x35ea13['as'],'attributes':_0x35ea13['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb2b('0xb')](function(_0x2263d1){var _0x1c658e=[];for(var _0x4daa1f=0x0;_0x4daa1f<_0x2263d1[_0xfb2b('0x31')];_0x4daa1f+=0x1){_0x1c658e[_0xfb2b('0x44')](_0x2263d1[_0x4daa1f][_0xfb2b('0x24')](_0x35c66c[_0xfb2b('0x22')],{'transaction':_0x5d99a1}));}return BPromise[_0xfb2b('0x34')](_0x1c658e);});})[_0xfb2b('0xb')](function(_0x32faf2){logger[_0xfb2b('0xc')](_0xfb2b('0x41'),_0x35c66c);logger[_0xfb2b('0x35')](_0xfb2b('0x41'),_0x35c66c,JSON[_0xfb2b('0xf')](_0x32faf2));_0x40fe78(_0x32faf2);})['catch'](function(_0x2be098){logger[_0xfb2b('0x10')](_0xfb2b('0x41'),_0x2be098[_0xfb2b('0x12')],_0x35c66c);_0x1603d4(_0x212deb[_0xfb2b('0x10')](0x1f4,_0x2be098['message']));});});});};exports['GetCmHopperPreview']=function(_0x2944c8){var _0x335bcb=this;return new Promise(function(_0x43797d,_0x3e961d){db[_0xfb2b('0x28')][_0xfb2b('0x45')]()[_0xfb2b('0xb')](function(_0x9de902){return db[_0xfb2b('0x15')][_0xfb2b('0x29')]({'raw':_0x2944c8['options']?_0x2944c8['options']['raw']===undefined?!![]:![]:!![],'where':_0x2944c8[_0xfb2b('0x16')]?_0x2944c8[_0xfb2b('0x16')][_0xfb2b('0x1e')]||null:null,'attributes':_0x2944c8['options']?_0x2944c8[_0xfb2b('0x16')][_0xfb2b('0x17')]||null:null,'limit':_0x2944c8['options']?_0x2944c8[_0xfb2b('0x16')][_0xfb2b('0x18')]||null:null,'include':_0x2944c8[_0xfb2b('0x16')]?_0x2944c8[_0xfb2b('0x16')][_0xfb2b('0x19')]?_[_0xfb2b('0x1a')](_0x2944c8['options'][_0xfb2b('0x19')],function(_0x2f7ee6){return{'model':db[_0x2f7ee6[_0xfb2b('0x1b')]],'as':_0x2f7ee6['as'],'attributes':_0x2f7ee6['as']===_0xfb2b('0x2c')?_['keys'](_0x9de902):_0x2f7ee6[_0xfb2b('0x17')],'include':_0x2f7ee6[_0xfb2b('0x19')]?_[_0xfb2b('0x1a')](_0x2f7ee6[_0xfb2b('0x19')],function(_0x583f3a){return{'model':db[_0x583f3a[_0xfb2b('0x1b')]],'as':_0x583f3a['as'],'attributes':_0x583f3a['attributes'],'include':_0x583f3a['include']?_[_0xfb2b('0x1a')](_0x583f3a[_0xfb2b('0x19')],function(_0x1797db){return{'model':db[_0x1797db[_0xfb2b('0x1b')]],'as':_0x1797db['as'],'attributes':_0x1797db['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb2b('0xb')](function(_0x192625){logger['info'](_0xfb2b('0x14'),_0x2944c8);logger[_0xfb2b('0x35')](_0xfb2b('0x14'),_0x2944c8,JSON[_0xfb2b('0xf')](_0x192625));_0x43797d(_0x192625);})[_0xfb2b('0x1c')](function(_0x1bff67){logger[_0xfb2b('0x10')](_0xfb2b('0x14'),_0x1bff67[_0xfb2b('0x12')],_0x2944c8);_0x3e961d(_0x335bcb[_0xfb2b('0x10')](0x1f4,_0x1bff67[_0xfb2b('0x12')]));});});});}; \ No newline at end of file +var _0xd76e=['User','name','voicePause','includes','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','UserId','length','all','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','findAll','options','where','attributes','limit','include','model','GetCmHopper','stringify','catch','ShowCmHopper','find','raw','map','CreateCmHopper','CmHopper','create','body','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys'];(function(_0x249069,_0xad6400){var _0x5372e5=function(_0x3d283f){while(--_0x3d283f){_0x249069['push'](_0x249069['shift']());}};_0x5372e5(++_0xad6400);}(_0xd76e,0xac));var _0xed76=function(_0x12157c,_0x1c9dd2){_0x12157c=_0x12157c-0x0;var _0x2947a0=_0xd76e[_0x12157c];return _0x2947a0;};'use strict';var _=require(_0xed76('0x0'));var util=require(_0xed76('0x1'));var moment=require(_0xed76('0x2'));var BPromise=require(_0xed76('0x3'));var rs=require(_0xed76('0x4'));var fs=require('fs');var Redis=require(_0xed76('0x5'));var db=require(_0xed76('0x6'))['db'];var utils=require(_0xed76('0x7'));var logger=require(_0xed76('0x8'))(_0xed76('0x9'));var config=require(_0xed76('0xa'));var jayson=require(_0xed76('0xb'));var client=jayson[_0xed76('0xc')][_0xed76('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x397a14,_0x21aac4,_0x251baf){return new BPromise(function(_0x1c949f,_0x591952){return client['request'](_0x397a14,_0x251baf)[_0xed76('0xe')](function(_0x330a45){logger[_0xed76('0xf')](_0xed76('0x10'),_0x21aac4,_0xed76('0x11'));logger[_0xed76('0x12')](_0xed76('0x13'),_0x21aac4,_0xed76('0x11'),JSON['stringify'](_0x330a45));if(_0x330a45[_0xed76('0x14')]){if(_0x330a45['error'][_0xed76('0x15')]===0x1f4){logger[_0xed76('0x14')](_0xed76('0x10'),_0x21aac4,_0x330a45['error'][_0xed76('0x16')]);return _0x591952(_0x330a45['error']['message']);}logger[_0xed76('0x14')](_0xed76('0x10'),_0x21aac4,_0x330a45[_0xed76('0x14')][_0xed76('0x16')]);return _0x1c949f(_0x330a45[_0xed76('0x14')]['message']);}else{logger['info'](_0xed76('0x10'),_0x21aac4,_0xed76('0x11'));_0x1c949f(_0x330a45[_0xed76('0x17')][_0xed76('0x16')]);}})['catch'](function(_0x59bd4b){logger[_0xed76('0x14')](_0xed76('0x10'),_0x21aac4,_0x59bd4b);_0x591952(_0x59bd4b);});});}exports['GetCmHopper']=function(_0x1bdc5d){var _0x555dbf=this;return new Promise(function(_0x1e91de,_0x1853fd){return db['CmHopper'][_0xed76('0x18')]({'raw':_0x1bdc5d[_0xed76('0x19')]?_0x1bdc5d[_0xed76('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1bdc5d['options']?_0x1bdc5d[_0xed76('0x19')][_0xed76('0x1a')]||null:null,'attributes':_0x1bdc5d[_0xed76('0x19')]?_0x1bdc5d[_0xed76('0x19')][_0xed76('0x1b')]||null:null,'limit':_0x1bdc5d['options']?_0x1bdc5d[_0xed76('0x19')][_0xed76('0x1c')]||null:null,'include':_0x1bdc5d[_0xed76('0x19')]?_0x1bdc5d[_0xed76('0x19')][_0xed76('0x1d')]?_['map'](_0x1bdc5d[_0xed76('0x19')][_0xed76('0x1d')],function(_0x1f791c){return{'model':db[_0x1f791c[_0xed76('0x1e')]],'as':_0x1f791c['as'],'attributes':_0x1f791c['attributes'],'include':_0x1f791c[_0xed76('0x1d')]?_['map'](_0x1f791c[_0xed76('0x1d')],function(_0x53e6d6){return{'model':db[_0x53e6d6[_0xed76('0x1e')]],'as':_0x53e6d6['as'],'attributes':_0x53e6d6[_0xed76('0x1b')],'include':_0x53e6d6['include']?_['map'](_0x53e6d6[_0xed76('0x1d')],function(_0x45ffe9){return{'model':db[_0x45ffe9[_0xed76('0x1e')]],'as':_0x45ffe9['as'],'attributes':_0x45ffe9['attributes']};}):[]};}):[]};}):[]:[]})[_0xed76('0xe')](function(_0x492441){logger[_0xed76('0xf')](_0xed76('0x1f'),_0x1bdc5d);logger['debug'](_0xed76('0x1f'),_0x1bdc5d,JSON[_0xed76('0x20')](_0x492441));_0x1e91de(_0x492441);})[_0xed76('0x21')](function(_0x453bef){logger[_0xed76('0x14')]('GetCmHopper',_0x453bef['message'],_0x1bdc5d);_0x1853fd(_0x555dbf[_0xed76('0x14')](0x1f4,_0x453bef[_0xed76('0x16')]));});});};exports[_0xed76('0x22')]=function(_0x50f04e){var _0x1a71d1=this;return new Promise(function(_0x3ecddd,_0x59140e){return db['CmHopper'][_0xed76('0x23')]({'raw':_0x50f04e[_0xed76('0x19')]?_0x50f04e[_0xed76('0x19')][_0xed76('0x24')]===undefined?!![]:![]:!![],'where':_0x50f04e[_0xed76('0x19')]?_0x50f04e['options']['where']||null:null,'attributes':_0x50f04e[_0xed76('0x19')]?_0x50f04e['options'][_0xed76('0x1b')]||null:null,'include':_0x50f04e['options']?_0x50f04e[_0xed76('0x19')][_0xed76('0x1d')]?_['map'](_0x50f04e[_0xed76('0x19')]['include'],function(_0x2cb82e){return{'model':db[_0x2cb82e[_0xed76('0x1e')]],'as':_0x2cb82e['as'],'attributes':_0x2cb82e[_0xed76('0x1b')],'include':_0x2cb82e[_0xed76('0x1d')]?_[_0xed76('0x25')](_0x2cb82e[_0xed76('0x1d')],function(_0x3931b8){return{'model':db[_0x3931b8[_0xed76('0x1e')]],'as':_0x3931b8['as'],'attributes':_0x3931b8[_0xed76('0x1b')],'include':_0x3931b8['include']?_[_0xed76('0x25')](_0x3931b8[_0xed76('0x1d')],function(_0x5ebd29){return{'model':db[_0x5ebd29[_0xed76('0x1e')]],'as':_0x5ebd29['as'],'attributes':_0x5ebd29[_0xed76('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xed76('0xe')](function(_0x29dd0f){logger[_0xed76('0xf')]('ShowCmHopper',_0x50f04e);logger[_0xed76('0x12')](_0xed76('0x22'),_0x50f04e,JSON[_0xed76('0x20')](_0x29dd0f));_0x3ecddd(_0x29dd0f);})['catch'](function(_0x2d7c98){logger[_0xed76('0x14')](_0xed76('0x22'),_0x2d7c98[_0xed76('0x16')],_0x50f04e);_0x59140e(_0x1a71d1[_0xed76('0x14')](0x1f4,_0x2d7c98[_0xed76('0x16')]));});});};exports[_0xed76('0x26')]=function(_0x4de1a8){var _0x46119e=this;return new Promise(function(_0x18ae60,_0x93d409){return db[_0xed76('0x27')][_0xed76('0x28')](_0x4de1a8[_0xed76('0x29')],{'raw':_0x4de1a8[_0xed76('0x19')]?_0x4de1a8[_0xed76('0x19')][_0xed76('0x24')]===undefined?!![]:![]:!![]})[_0xed76('0xe')](function(_0x2e8bca){logger['info'](_0xed76('0x26'),_0x4de1a8);logger[_0xed76('0x12')](_0xed76('0x26'),_0x4de1a8,JSON[_0xed76('0x20')](_0x2e8bca));_0x18ae60(_0x2e8bca);})[_0xed76('0x21')](function(_0xe21442){logger[_0xed76('0x14')]('CreateCmHopper',_0xe21442['message'],_0x4de1a8);_0x93d409(_0x46119e[_0xed76('0x14')](0x1f4,_0xe21442[_0xed76('0x16')]));});});};exports['UpdateCmHopper']=function(_0x453219){var _0x3335dc=this;return new Promise(function(_0x48d072,_0x2c29e5){return db[_0xed76('0x27')][_0xed76('0x2a')](_0x453219[_0xed76('0x29')],{'raw':_0x453219[_0xed76('0x19')]?_0x453219[_0xed76('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453219[_0xed76('0x19')]?_0x453219[_0xed76('0x19')][_0xed76('0x1a')]||null:null,'attributes':_0x453219[_0xed76('0x19')]?_0x453219[_0xed76('0x19')]['attributes']||null:null,'limit':_0x453219[_0xed76('0x19')]?_0x453219[_0xed76('0x19')][_0xed76('0x1c')]||null:null})[_0xed76('0xe')](function(_0x2e0374){logger[_0xed76('0xf')](_0xed76('0x2b'),_0x453219);logger[_0xed76('0x12')](_0xed76('0x2b'),_0x453219,JSON[_0xed76('0x20')](_0x2e0374));_0x48d072(_0x2e0374);})[_0xed76('0x21')](function(_0x36bb2d){logger[_0xed76('0x14')](_0xed76('0x2b'),_0x36bb2d[_0xed76('0x16')],_0x453219);_0x2c29e5(_0x3335dc[_0xed76('0x14')](0x1f4,_0x36bb2d[_0xed76('0x16')]));});});};exports[_0xed76('0x2c')]=function(_0x15c61e){var _0x305bca=this;return new Promise(function(_0x4cafa7,_0x367e24){return db[_0xed76('0x27')][_0xed76('0x2d')]({'where':_0x15c61e['options']?_0x15c61e[_0xed76('0x19')][_0xed76('0x1a')]||null:null})['then'](function(_0x4a0f85){logger[_0xed76('0xf')](_0xed76('0x2c'),_0x15c61e);logger[_0xed76('0x12')]('DestroyCmHopper',_0x15c61e,JSON[_0xed76('0x20')](_0x4a0f85));_0x4cafa7(_0x4a0f85);})['catch'](function(_0x35d0ff){logger[_0xed76('0x14')](_0xed76('0x2c'),_0x35d0ff[_0xed76('0x16')],_0x15c61e);_0x367e24(_0x305bca['error'](0x1f4,_0x35d0ff[_0xed76('0x16')]));});});};exports[_0xed76('0x2e')]=function(_0x32ee44){var _0x16fbae=this;return new Promise(function(_0x3009d3,_0xb2c335){return db[_0xed76('0x2f')][_0xed76('0x30')]()['then'](function(_0x327acd){return db[_0xed76('0x31')][_0xed76('0x32')](function(_0x5a4932){return db[_0xed76('0x27')][_0xed76('0x18')]({'where':_0x32ee44[_0xed76('0x19')]?_0x32ee44[_0xed76('0x19')][_0xed76('0x1a')]||null:null,'attributes':_0x32ee44[_0xed76('0x19')]?_0x32ee44[_0xed76('0x19')][_0xed76('0x1b')]||null:null,'limit':_0x32ee44[_0xed76('0x19')]?_0x32ee44[_0xed76('0x19')][_0xed76('0x1c')]||null:null,'order':_0x32ee44[_0xed76('0x19')]?_0x32ee44[_0xed76('0x19')][_0xed76('0x33')]||null:null,'transaction':_0x5a4932,'lock':_0x5a4932[_0xed76('0x34')][_0xed76('0x35')],'include':[{'model':db['CmContact'],'as':_0xed76('0x36'),'attributes':_[_0xed76('0x37')](_0x327acd)},{'model':db[_0xed76('0x38')],'as':'Agent','attributes':['id',_0xed76('0x39'),_0xed76('0x3a')]}]})[_0xed76('0xe')](function(_0x43fc59){var _0x417771=[];var _0x14744=[];for(var _0x54ff24=0x0;_0x54ff24<_0x43fc59['length'];_0x54ff24+=0x1){var _0x4db66b=_0x43fc59[_0x54ff24]['UserId'];if(_0x4db66b===null){_0x417771['push'](_0x43fc59[_0x54ff24][_0xed76('0x2a')](_0x32ee44[_0xed76('0x29')],{'transaction':_0x5a4932}));}else if(!_0x14744[_0xed76('0x3b')](_0x4db66b)){_0x14744[_0xed76('0x3c')](_0x4db66b);_0x417771[_0xed76('0x3c')](_0x43fc59[_0x54ff24][_0xed76('0x2a')](_0x32ee44[_0xed76('0x29')],{'transaction':_0x5a4932}));}}return BPromise['all'](_0x417771);});})[_0xed76('0xe')](function(_0x413faf){logger['info'](_0xed76('0x2e'),_0x32ee44);logger[_0xed76('0x12')](_0xed76('0x2e'),_0x32ee44,JSON[_0xed76('0x20')](_0x413faf));_0x3009d3(_0x413faf);})[_0xed76('0x21')](function(_0x2b4870){logger[_0xed76('0x14')]('GetContactDialer',_0x2b4870['message'],_0x32ee44);_0xb2c335(_0x16fbae[_0xed76('0x14')](0x1f4,_0x2b4870[_0xed76('0x16')]));});});});};exports['MoveContactManagedDialer']=function(_0xff90a0){var _0x4a8547=this;return new Promise(function(_0x3cb1c7,_0x22655b){return db[_0xed76('0x31')][_0xed76('0x32')](function(_0x37c0f5){return db[_0xed76('0x3d')]['create'](_0xff90a0[_0xed76('0x29')],{'raw':_0xff90a0[_0xed76('0x19')]?_0xff90a0[_0xed76('0x19')][_0xed76('0x24')]===undefined?!![]:![]:!![],'transaction':_0x37c0f5})['then'](function(){return db[_0xed76('0x27')][_0xed76('0x2d')]({'where':_0xff90a0['options']?_0xff90a0[_0xed76('0x19')]['where']||null:null,'transaction':_0x37c0f5});});})[_0xed76('0xe')](function(_0x547504){logger[_0xed76('0xf')]('MoveContactManagedDialer',_0xff90a0);logger[_0xed76('0x12')](_0xed76('0x3e'),_0xff90a0,JSON[_0xed76('0x20')](_0x547504));_0x3cb1c7(_0x547504);})[_0xed76('0x21')](function(_0x53e8fb){logger[_0xed76('0x14')](_0xed76('0x3e'),_0x53e8fb[_0xed76('0x16')],_0xff90a0);_0x22655b(_0x4a8547['error'](0x1f4,_0x53e8fb[_0xed76('0x16')]));});});};exports[_0xed76('0x3f')]=function(_0x4be70f){var _0xcd75d1=this;return new Promise(function(_0x3bbb4d,_0x1c818d){return db[_0xed76('0x27')][_0xed76('0x18')]({'raw':_0x4be70f['options']?_0x4be70f['options'][_0xed76('0x24')]===undefined?!![]:![]:!![],'where':_0x4be70f[_0xed76('0x19')]?_0x4be70f[_0xed76('0x19')]['where']||null:null,'attributes':[[db[_0xed76('0x31')]['fn'](_0xed76('0x40'),db['sequelize']['fn']('IF',db[_0xed76('0x31')][_0xed76('0x41')](_0xed76('0x42')+util[_0xed76('0x43')](_0xed76('0x44'),moment()[_0xed76('0x43')](_0xed76('0x45')))+'\x20,\x201,\x20null'))),_0xed76('0x46')]]})[_0xed76('0xe')](function(_0x46ec5e){logger[_0xed76('0xf')](_0xed76('0x3f'),_0x4be70f);logger[_0xed76('0x12')](_0xed76('0x3f'),_0x4be70f,JSON[_0xed76('0x20')](_0x46ec5e));_0x3bbb4d(_0x46ec5e);})[_0xed76('0x21')](function(_0x418a51){logger[_0xed76('0x14')](_0xed76('0x3f'),_0x418a51[_0xed76('0x16')],_0x4be70f);_0x1c818d(_0xcd75d1[_0xed76('0x14')](0x1f4,_0x418a51[_0xed76('0x16')]));});});};exports['GetContactRecallMe']=function(_0x2a4d6a){var _0x347884=this;return new Promise(function(_0x1b7163,_0x469ea7){return db[_0xed76('0x2f')][_0xed76('0x30')]()[_0xed76('0xe')](function(_0x3f1c36){return db['sequelize'][_0xed76('0x32')](function(_0x47db85){return db[_0xed76('0x27')][_0xed76('0x18')]({'where':_0x2a4d6a[_0xed76('0x19')]?_0x2a4d6a[_0xed76('0x19')][_0xed76('0x1a')]||null:null,'attributes':_0x2a4d6a[_0xed76('0x19')]?_0x2a4d6a[_0xed76('0x19')][_0xed76('0x1b')]||null:null,'limit':0x1,'order':_0x2a4d6a[_0xed76('0x19')]?_0x2a4d6a['options'][_0xed76('0x33')]||null:null,'group':db[_0xed76('0x27')][_0xed76('0x47')],'transaction':_0x47db85,'lock':_0x47db85[_0xed76('0x34')][_0xed76('0x35')],'include':_0x2a4d6a['options']?_0x2a4d6a[_0xed76('0x19')][_0xed76('0x1d')]?_[_0xed76('0x25')](_0x2a4d6a[_0xed76('0x19')][_0xed76('0x1d')],function(_0x363357){return{'model':db[_0x363357['model']],'as':_0x363357['as'],'attributes':_0x363357[_0xed76('0x1b')],'include':_0x363357['include']?_[_0xed76('0x25')](_0x363357[_0xed76('0x1d')],function(_0x515755){return{'model':db[_0x515755[_0xed76('0x1e')]],'as':_0x515755['as'],'attributes':_0x515755[_0xed76('0x1b')],'include':_0x515755['include']?_[_0xed76('0x25')](_0x515755[_0xed76('0x1d')],function(_0x40ebf1){return{'model':db[_0x40ebf1['model']],'as':_0x40ebf1['as'],'attributes':_0x40ebf1[_0xed76('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xed76('0xe')](function(_0x4f82a6){var _0x178ea1=[];for(var _0x37be2f=0x0;_0x37be2f<_0x4f82a6[_0xed76('0x48')];_0x37be2f+=0x1){_0x178ea1[_0xed76('0x3c')](_0x4f82a6[_0x37be2f][_0xed76('0x2a')](_0x2a4d6a['body'],{'transaction':_0x47db85}));}return BPromise[_0xed76('0x49')](_0x178ea1);});})['then'](function(_0x557bfd){logger[_0xed76('0xf')](_0xed76('0x4a'),_0x2a4d6a);logger[_0xed76('0x12')]('GetContactRecallMe',_0x2a4d6a,JSON[_0xed76('0x20')](_0x557bfd));_0x1b7163(_0x557bfd);})[_0xed76('0x21')](function(_0x31b5c5){logger[_0xed76('0x14')](_0xed76('0x4a'),_0x31b5c5[_0xed76('0x16')],_0x2a4d6a);_0x469ea7(_0x347884[_0xed76('0x14')](0x1f4,_0x31b5c5[_0xed76('0x16')]));});});});};exports[_0xed76('0x4b')]=function(_0x1a90c7){var _0x22bbfd=this;return new Promise(function(_0x390b8d,_0x424b36){db[_0xed76('0x2f')]['describe']()[_0xed76('0xe')](function(_0x4bea25){return db[_0xed76('0x27')][_0xed76('0x18')]({'raw':_0x1a90c7['options']?_0x1a90c7[_0xed76('0x19')][_0xed76('0x24')]===undefined?!![]:![]:!![],'where':_0x1a90c7['options']?_0x1a90c7[_0xed76('0x19')][_0xed76('0x1a')]||null:null,'attributes':_0x1a90c7[_0xed76('0x19')]?_0x1a90c7[_0xed76('0x19')][_0xed76('0x1b')]||null:null,'limit':_0x1a90c7['options']?_0x1a90c7[_0xed76('0x19')]['limit']||null:null,'include':_0x1a90c7['options']?_0x1a90c7[_0xed76('0x19')]['include']?_['map'](_0x1a90c7[_0xed76('0x19')][_0xed76('0x1d')],function(_0x1cfac2){return{'model':db[_0x1cfac2[_0xed76('0x1e')]],'as':_0x1cfac2['as'],'attributes':_0x1cfac2['as']===_0xed76('0x36')?_[_0xed76('0x37')](_0x4bea25):_0x1cfac2[_0xed76('0x1b')],'include':_0x1cfac2[_0xed76('0x1d')]?_[_0xed76('0x25')](_0x1cfac2[_0xed76('0x1d')],function(_0x3d1945){return{'model':db[_0x3d1945[_0xed76('0x1e')]],'as':_0x3d1945['as'],'attributes':_0x3d1945['attributes'],'include':_0x3d1945['include']?_['map'](_0x3d1945[_0xed76('0x1d')],function(_0x16bddd){return{'model':db[_0x16bddd[_0xed76('0x1e')]],'as':_0x16bddd['as'],'attributes':_0x16bddd[_0xed76('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xed76('0xe')](function(_0x5d5b7f){logger[_0xed76('0xf')]('GetCmHopper',_0x1a90c7);logger[_0xed76('0x12')](_0xed76('0x1f'),_0x1a90c7,JSON[_0xed76('0x20')](_0x5d5b7f));_0x390b8d(_0x5d5b7f);})['catch'](function(_0x5a2b99){logger['error'](_0xed76('0x1f'),_0x5a2b99[_0xed76('0x16')],_0x1a90c7);_0x424b36(_0x22bbfd[_0xed76('0x14')](0x1f4,_0x5a2b99[_0xed76('0x16')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a79c500..c456239 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 _0x5855=['/preview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','/describe','isAuthenticated','/opencontacts','getOpenContacts','/:id','show','post','create'];(function(_0x501d19,_0x528c4d){var _0x321784=function(_0x3088fe){while(--_0x3088fe){_0x501d19['push'](_0x501d19['shift']());}};_0x321784(++_0x528c4d);}(_0x5855,0x164));var _0x5585=function(_0x380d16,_0xdf0d31){_0x380d16=_0x380d16-0x0;var _0x5d5253=_0x5855[_0x380d16];return _0x5d5253;};'use strict';var multer=require(_0x5585('0x0'));var util=require(_0x5585('0x1'));var path=require(_0x5585('0x2'));var timeout=require(_0x5585('0x3'));var express=require('express');var router=express[_0x5585('0x4')]();var fs_extra=require(_0x5585('0x5'));var auth=require(_0x5585('0x6'));var interaction=require(_0x5585('0x7'));var config=require(_0x5585('0x8'));var controller=require(_0x5585('0x9'));router[_0x5585('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5585('0xb'),auth[_0x5585('0xc')](),controller['describe']);router[_0x5585('0xa')](_0x5585('0xd'),auth[_0x5585('0xc')](),controller[_0x5585('0xe')]);router[_0x5585('0xa')](_0x5585('0xf'),auth[_0x5585('0xc')](),controller[_0x5585('0x10')]);router[_0x5585('0x11')]('/',auth[_0x5585('0xc')](),controller[_0x5585('0x12')]);router['post'](_0x5585('0x13'),auth['isAuthenticated'](),controller['getPreview']);router[_0x5585('0x14')](_0x5585('0xf'),auth[_0x5585('0xc')](),controller[_0x5585('0x15')]);router[_0x5585('0x16')](_0x5585('0xf'),auth[_0x5585('0xc')](),controller[_0x5585('0x17')]);module[_0x5585('0x18')]=router; \ No newline at end of file +var _0xa8c3=['../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','show','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ac5e1,_0x43a483){var _0x3ae80e=function(_0x234518){while(--_0x234518){_0x1ac5e1['push'](_0x1ac5e1['shift']());}};_0x3ae80e(++_0x43a483);}(_0xa8c3,0x1ad));var _0x3a8c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa8c3[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x3a8c('0x0'));var util=require(_0x3a8c('0x1'));var path=require(_0x3a8c('0x2'));var timeout=require(_0x3a8c('0x3'));var express=require(_0x3a8c('0x4'));var router=express[_0x3a8c('0x5')]();var fs_extra=require(_0x3a8c('0x6'));var auth=require(_0x3a8c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3a8c('0x8'));var controller=require(_0x3a8c('0x9'));router[_0x3a8c('0xa')]('/',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0xc')]);router[_0x3a8c('0xa')]('/describe',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0xd')]);router[_0x3a8c('0xa')](_0x3a8c('0xe'),auth[_0x3a8c('0xb')](),controller[_0x3a8c('0xf')]);router[_0x3a8c('0xa')]('/:id',auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x10')]);router['post']('/',auth[_0x3a8c('0xb')](),controller['create']);router[_0x3a8c('0x11')]('/preview',auth[_0x3a8c('0xb')](),controller['getPreview']);router[_0x3a8c('0x12')](_0x3a8c('0x13'),auth[_0x3a8c('0xb')](),controller[_0x3a8c('0x14')]);router['delete'](_0x3a8c('0x13'),auth['isAuthenticated'](),controller[_0x3a8c('0x15')]);module[_0x3a8c('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c2096c2..7673c12 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 _0xb715=['contactListQueue','sequelize','STRING','INTEGER'];(function(_0x425bcc,_0x330e60){var _0x87e194=function(_0x2b622a){while(--_0x2b622a){_0x425bcc['push'](_0x425bcc['shift']());}};_0x87e194(++_0x330e60);}(_0xb715,0x16d));var _0x5b71=function(_0x322de4,_0x4d2615){_0x322de4=_0x322de4-0x0;var _0x2a9dfe=_0xb715[_0x322de4];return _0x2a9dfe;};'use strict';var moment=require('moment');var Sequelize=require(_0x5b71('0x0'));module['exports']={'phone':{'type':Sequelize[_0x5b71('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5b71('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x5b71('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x5b71('0x2')],'unique':_0x5b71('0x3')}}; \ No newline at end of file +var _0x943a=['moment','STRING','INTEGER','contactListQueue'];(function(_0x382f6d,_0x7e176){var _0x3392d3=function(_0x3892ab){while(--_0x3892ab){_0x382f6d['push'](_0x382f6d['shift']());}};_0x3392d3(++_0x7e176);}(_0x943a,0xfc));var _0xa943=function(_0x2c5a7e,_0x51120b){_0x2c5a7e=_0x2c5a7e-0x0;var _0x379f64=_0x943a[_0x2c5a7e];return _0x379f64;};'use strict';var moment=require(_0xa943('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xa943('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa943('0x2')],'unique':_0xa943('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xa943('0x2')],'unique':_0xa943('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7f0fa0a..7c587db 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 _0x1929=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','save','then','destroy','sendStatus','error','index','map','CmHopperBlack','type','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1be790,_0x112549){var _0x7668c8=function(_0x47a470){while(--_0x47a470){_0x1be790['push'](_0x1be790['shift']());}};_0x7668c8(++_0x112549);}(_0x1929,0x77));var _0x9192=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x1929[_0x1e6db3];return _0x1de886;};'use strict';var emlformat=require(_0x9192('0x0'));var rimraf=require(_0x9192('0x1'));var zipdir=require(_0x9192('0x2'));var jsonpatch=require(_0x9192('0x3'));var rp=require(_0x9192('0x4'));var moment=require('moment');var BPromise=require(_0x9192('0x5'));var Mustache=require(_0x9192('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9192('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9192('0x8'));var _=require(_0x9192('0x9'));var squel=require('squel');var crypto=require(_0x9192('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9192('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9192('0xc'));var Papa=require(_0x9192('0xd'));var Redis=require('ioredis');var authService=require(_0x9192('0xe'));var qs=require(_0x9192('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9192('0x10'));var logger=require(_0x9192('0x11'))(_0x9192('0x12'));var utils=require(_0x9192('0x13'));var config=require(_0x9192('0x14'));var licenseUtil=require(_0x9192('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b7cb4,_0x98069d){_0x98069d=_0x98069d||0xcc;return function(_0x237641){if(_0x237641){return _0x5b7cb4['sendStatus'](_0x98069d);}return _0x5b7cb4[_0x9192('0x16')](_0x98069d)[_0x9192('0x17')]();};}function respondWithResult(_0x89a744,_0xa48ed2){_0xa48ed2=_0xa48ed2||0xc8;return function(_0x1127ec){if(_0x1127ec){return _0x89a744[_0x9192('0x16')](_0xa48ed2)['json'](_0x1127ec);}};}function respondWithFilteredResult(_0x1398a6,_0x4b2e12){return function(_0x4a2837){if(_0x4a2837){var _0x229370=typeof _0x4b2e12['offset']===_0x9192('0x18')&&typeof _0x4b2e12[_0x9192('0x19')]===_0x9192('0x18');var _0x112f0a=_0x4a2837['count'];var _0x163e82=_0x229370?0x0:_0x4b2e12[_0x9192('0x1a')];var _0x3160b6=_0x229370?_0x4a2837[_0x9192('0x1b')]:_0x4b2e12[_0x9192('0x1a')]+_0x4b2e12['limit'];var _0x262972;if(_0x3160b6>=_0x112f0a){_0x3160b6=_0x112f0a;_0x262972=0xc8;}else{_0x262972=0xce;}_0x1398a6[_0x9192('0x16')](_0x262972);return _0x1398a6[_0x9192('0x1c')](_0x9192('0x1d'),_0x163e82+'-'+_0x3160b6+'/'+_0x112f0a)[_0x9192('0x1e')](_0x4a2837);}return null;};}function patchUpdates(_0x5181ca){return function(_0x1bfb04){try{jsonpatch[_0x9192('0x1f')](_0x1bfb04,_0x5181ca,!![]);}catch(_0xa59ef7){return BPromise['reject'](_0xa59ef7);}return _0x1bfb04[_0x9192('0x20')]();};}function saveUpdates(_0x50ff70,_0x393cf7){return function(_0x4edb08){if(_0x4edb08){return _0x4edb08['update'](_0x50ff70)[_0x9192('0x21')](function(_0x37f940){return _0x37f940;});}return null;};}function removeEntity(_0x2cc8b9,_0x43549c){return function(_0x553baa){if(_0x553baa){return _0x553baa[_0x9192('0x22')]()['then'](function(){_0x2cc8b9[_0x9192('0x16')](0xcc)[_0x9192('0x17')]();});}};}function handleEntityNotFound(_0x4cb167,_0x136e32){return function(_0x14650f){if(!_0x14650f){_0x4cb167[_0x9192('0x23')](0x194);}return _0x14650f;};}function handleError(_0x4d4bb1,_0x430ece){_0x430ece=_0x430ece||0x1f4;return function(_0x550d91){logger[_0x9192('0x24')](_0x550d91['stack']);if(_0x550d91['name']){delete _0x550d91['name'];}_0x4d4bb1[_0x9192('0x16')](_0x430ece)['send'](_0x550d91);};}exports[_0x9192('0x25')]=function(_0x199914,_0x11bfa3){var _0x416c45={},_0x311a2a={},_0x8f1f4c={'count':0x0,'rows':[]};var _0x5299a9=_[_0x9192('0x26')](db[_0x9192('0x27')]['rawAttributes'],function(_0x5ea172){return{'name':_0x5ea172['fieldName'],'type':_0x5ea172[_0x9192('0x28')]['key']};});_0x311a2a[_0x9192('0x29')]=_[_0x9192('0x26')](_0x5299a9,_0x9192('0x2a'));_0x311a2a[_0x9192('0x2b')]=_[_0x9192('0x2c')](_0x199914[_0x9192('0x2b')]);_0x311a2a[_0x9192('0x2d')]=_[_0x9192('0x2e')](_0x311a2a[_0x9192('0x29')],_0x311a2a['query']);_0x416c45[_0x9192('0x2f')]=_['intersection'](_0x311a2a[_0x9192('0x29')],qs['fields'](_0x199914[_0x9192('0x2b')][_0x9192('0x30')]));_0x416c45[_0x9192('0x2f')]=_0x416c45[_0x9192('0x2f')]['length']?_0x416c45[_0x9192('0x2f')]:_0x311a2a[_0x9192('0x29')];if(!_0x199914['query'][_0x9192('0x31')](_0x9192('0x32'))){_0x416c45[_0x9192('0x19')]=qs[_0x9192('0x19')](_0x199914[_0x9192('0x2b')]['limit']);_0x416c45[_0x9192('0x1a')]=qs[_0x9192('0x1a')](_0x199914['query'][_0x9192('0x1a')]);}_0x416c45['order']=qs[_0x9192('0x33')](_0x199914['query']['sort']);_0x416c45['where']=qs['filters'](_['pick'](_0x199914[_0x9192('0x2b')],_0x311a2a[_0x9192('0x2d')]),_0x5299a9);if(_0x199914[_0x9192('0x2b')][_0x9192('0x34')]){_0x416c45[_0x9192('0x35')]=_['merge'](_0x416c45['where'],{'$or':_[_0x9192('0x26')](_0x5299a9,function(_0x2413b5){if(_0x2413b5[_0x9192('0x28')]!==_0x9192('0x36')){var _0xd8ec7a={};_0xd8ec7a[_0x2413b5[_0x9192('0x2a')]]={'$like':'%'+_0x199914[_0x9192('0x2b')]['filter']+'%'};return _0xd8ec7a;}})});}_0x416c45=_[_0x9192('0x37')]({},_0x416c45,_0x199914[_0x9192('0x38')]);var _0x34f6f0={'where':_0x416c45[_0x9192('0x35')]};return db['CmHopperBlack'][_0x9192('0x1b')](_0x34f6f0)[_0x9192('0x21')](function(_0xa663a8){_0x8f1f4c['count']=_0xa663a8;if(_0x199914[_0x9192('0x2b')][_0x9192('0x39')]){_0x416c45[_0x9192('0x3a')]=[{'all':!![]}];}return db[_0x9192('0x27')][_0x9192('0x3b')](_0x416c45);})[_0x9192('0x21')](function(_0x774b6b){_0x8f1f4c[_0x9192('0x3c')]=_0x774b6b;return _0x8f1f4c;})[_0x9192('0x21')](respondWithFilteredResult(_0x11bfa3,_0x416c45))[_0x9192('0x3d')](handleError(_0x11bfa3,null));};exports['show']=function(_0x24baf0,_0x41132f){var _0x54dc8d={'raw':!![],'where':{'id':_0x24baf0[_0x9192('0x3e')]['id']}},_0x257d07={};_0x257d07['model']=_[_0x9192('0x2c')](db['CmHopperBlack'][_0x9192('0x3f')]);_0x257d07[_0x9192('0x2b')]=_[_0x9192('0x2c')](_0x24baf0['query']);_0x257d07[_0x9192('0x2d')]=_['intersection'](_0x257d07['model'],_0x257d07[_0x9192('0x2b')]);_0x54dc8d[_0x9192('0x2f')]=_[_0x9192('0x2e')](_0x257d07['model'],qs[_0x9192('0x30')](_0x24baf0[_0x9192('0x2b')]['fields']));_0x54dc8d[_0x9192('0x2f')]=_0x54dc8d['attributes']['length']?_0x54dc8d[_0x9192('0x2f')]:_0x257d07[_0x9192('0x29')];if(_0x24baf0[_0x9192('0x2b')]['includeAll']){_0x54dc8d[_0x9192('0x3a')]=[{'all':!![]}];}_0x54dc8d=_[_0x9192('0x37')]({},_0x54dc8d,_0x24baf0[_0x9192('0x38')]);return db[_0x9192('0x27')][_0x9192('0x40')](_0x54dc8d)[_0x9192('0x21')](handleEntityNotFound(_0x41132f,null))[_0x9192('0x21')](respondWithResult(_0x41132f,null))[_0x9192('0x3d')](handleError(_0x41132f,null));};exports[_0x9192('0x41')]=function(_0x4349c2,_0x585a20){if(_0x4349c2[_0x9192('0x42')]['id']){delete _0x4349c2[_0x9192('0x42')]['id'];}return db[_0x9192('0x27')][_0x9192('0x40')]({'where':{'id':_0x4349c2[_0x9192('0x3e')]['id']}})[_0x9192('0x21')](handleEntityNotFound(_0x585a20,null))[_0x9192('0x21')](saveUpdates(_0x4349c2[_0x9192('0x42')],null))[_0x9192('0x21')](respondWithResult(_0x585a20,null))[_0x9192('0x3d')](handleError(_0x585a20,null));};exports[_0x9192('0x22')]=function(_0x13e4cd,_0x1cfd2c){return db[_0x9192('0x27')][_0x9192('0x40')]({'where':{'id':_0x13e4cd[_0x9192('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1cfd2c,null))['then'](removeEntity(_0x1cfd2c,null))['catch'](handleError(_0x1cfd2c,null));};exports[_0x9192('0x43')]=function(_0x583c79,_0x14babf){return db[_0x9192('0x27')]['describe']()[_0x9192('0x21')](respondWithResult(_0x14babf,null))[_0x9192('0x3d')](handleError(_0x14babf,null));}; \ No newline at end of file +var _0x963e=['undefined','limit','count','set','apply','reject','save','then','destroy','error','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','CmHopperBlack','includeAll','rows','catch','show','params','body','find','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset'];(function(_0xbbe5c8,_0x1d1a27){var _0x54c261=function(_0x99bedc){while(--_0x99bedc){_0xbbe5c8['push'](_0xbbe5c8['shift']());}};_0x54c261(++_0x1d1a27);}(_0x963e,0xad));var _0xe963=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x963e[_0x5a7f64];return _0x3d30f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe963('0x0'));var jsonpatch=require(_0xe963('0x1'));var rp=require('request-promise');var moment=require(_0xe963('0x2'));var BPromise=require(_0xe963('0x3'));var Mustache=require(_0xe963('0x4'));var util=require('util');var path=require(_0xe963('0x5'));var sox=require(_0xe963('0x6'));var csv=require('to-csv');var ejs=require(_0xe963('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe963('0x8'));var crypto=require(_0xe963('0x9'));var jsforce=require(_0xe963('0xa'));var deskjs=require(_0xe963('0xb'));var toCsv=require(_0xe963('0xc'));var querystring=require('querystring');var Papa=require(_0xe963('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe963('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe963('0xf'));var logger=require(_0xe963('0x10'))(_0xe963('0x11'));var utils=require(_0xe963('0x12'));var config=require(_0xe963('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29cbf4,_0x4b4738){_0x4b4738=_0x4b4738||0xcc;return function(_0x14e9bf){if(_0x14e9bf){return _0x29cbf4[_0xe963('0x14')](_0x4b4738);}return _0x29cbf4[_0xe963('0x15')](_0x4b4738)[_0xe963('0x16')]();};}function respondWithResult(_0x1a282b,_0x18bdb){_0x18bdb=_0x18bdb||0xc8;return function(_0x49e7df){if(_0x49e7df){return _0x1a282b['status'](_0x18bdb)[_0xe963('0x17')](_0x49e7df);}};}function respondWithFilteredResult(_0x4eb700,_0x257843){return function(_0x8d147f){if(_0x8d147f){var _0x3bf916=typeof _0x257843[_0xe963('0x18')]===_0xe963('0x19')&&typeof _0x257843[_0xe963('0x1a')]===_0xe963('0x19');var _0x270450=_0x8d147f[_0xe963('0x1b')];var _0x2b368c=_0x3bf916?0x0:_0x257843[_0xe963('0x18')];var _0xc68a9f=_0x3bf916?_0x8d147f[_0xe963('0x1b')]:_0x257843[_0xe963('0x18')]+_0x257843[_0xe963('0x1a')];var _0x519f9f;if(_0xc68a9f>=_0x270450){_0xc68a9f=_0x270450;_0x519f9f=0xc8;}else{_0x519f9f=0xce;}_0x4eb700[_0xe963('0x15')](_0x519f9f);return _0x4eb700[_0xe963('0x1c')]('Content-Range',_0x2b368c+'-'+_0xc68a9f+'/'+_0x270450)[_0xe963('0x17')](_0x8d147f);}return null;};}function patchUpdates(_0x38c66c){return function(_0x2e2ae4){try{jsonpatch[_0xe963('0x1d')](_0x2e2ae4,_0x38c66c,!![]);}catch(_0x1e7c33){return BPromise[_0xe963('0x1e')](_0x1e7c33);}return _0x2e2ae4[_0xe963('0x1f')]();};}function saveUpdates(_0x1438cf,_0xcfac5){return function(_0x3ecf3c){if(_0x3ecf3c){return _0x3ecf3c['update'](_0x1438cf)[_0xe963('0x20')](function(_0x5a0b06){return _0x5a0b06;});}return null;};}function removeEntity(_0x33397f,_0x329341){return function(_0x381940){if(_0x381940){return _0x381940[_0xe963('0x21')]()[_0xe963('0x20')](function(){_0x33397f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x140918,_0x5e1c69){return function(_0x38de38){if(!_0x38de38){_0x140918['sendStatus'](0x194);}return _0x38de38;};}function handleError(_0xd363d2,_0xc98863){_0xc98863=_0xc98863||0x1f4;return function(_0x547cfa){logger[_0xe963('0x22')](_0x547cfa['stack']);if(_0x547cfa['name']){delete _0x547cfa[_0xe963('0x23')];}_0xd363d2[_0xe963('0x15')](_0xc98863)['send'](_0x547cfa);};}exports[_0xe963('0x24')]=function(_0xf5f869,_0x820999){var _0x156078={},_0x21d1e7={},_0x234d40={'count':0x0,'rows':[]};var _0x426ace=_[_0xe963('0x25')](db['CmHopperBlack'][_0xe963('0x26')],function(_0x46897f){return{'name':_0x46897f[_0xe963('0x27')],'type':_0x46897f['type']['key']};});_0x21d1e7[_0xe963('0x28')]=_[_0xe963('0x25')](_0x426ace,_0xe963('0x23'));_0x21d1e7[_0xe963('0x29')]=_[_0xe963('0x2a')](_0xf5f869[_0xe963('0x29')]);_0x21d1e7[_0xe963('0x2b')]=_[_0xe963('0x2c')](_0x21d1e7[_0xe963('0x28')],_0x21d1e7[_0xe963('0x29')]);_0x156078['attributes']=_[_0xe963('0x2c')](_0x21d1e7[_0xe963('0x28')],qs['fields'](_0xf5f869[_0xe963('0x29')][_0xe963('0x2d')]));_0x156078[_0xe963('0x2e')]=_0x156078[_0xe963('0x2e')][_0xe963('0x2f')]?_0x156078[_0xe963('0x2e')]:_0x21d1e7['model'];if(!_0xf5f869['query'][_0xe963('0x30')]('nolimit')){_0x156078['limit']=qs[_0xe963('0x1a')](_0xf5f869[_0xe963('0x29')][_0xe963('0x1a')]);_0x156078['offset']=qs['offset'](_0xf5f869[_0xe963('0x29')][_0xe963('0x18')]);}_0x156078[_0xe963('0x31')]=qs[_0xe963('0x32')](_0xf5f869['query'][_0xe963('0x32')]);_0x156078[_0xe963('0x33')]=qs['filters'](_[_0xe963('0x34')](_0xf5f869[_0xe963('0x29')],_0x21d1e7[_0xe963('0x2b')]),_0x426ace);if(_0xf5f869[_0xe963('0x29')][_0xe963('0x35')]){_0x156078[_0xe963('0x33')]=_[_0xe963('0x36')](_0x156078['where'],{'$or':_[_0xe963('0x25')](_0x426ace,function(_0x14ac65){if(_0x14ac65[_0xe963('0x37')]!=='VIRTUAL'){var _0x47e0bf={};_0x47e0bf[_0x14ac65[_0xe963('0x23')]]={'$like':'%'+_0xf5f869[_0xe963('0x29')][_0xe963('0x35')]+'%'};return _0x47e0bf;}})});}_0x156078=_[_0xe963('0x36')]({},_0x156078,_0xf5f869[_0xe963('0x38')]);var _0x19d0df={'where':_0x156078[_0xe963('0x33')]};return db[_0xe963('0x39')][_0xe963('0x1b')](_0x19d0df)[_0xe963('0x20')](function(_0x11eeb9){_0x234d40[_0xe963('0x1b')]=_0x11eeb9;if(_0xf5f869['query'][_0xe963('0x3a')]){_0x156078['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x156078);})[_0xe963('0x20')](function(_0x227d32){_0x234d40[_0xe963('0x3b')]=_0x227d32;return _0x234d40;})[_0xe963('0x20')](respondWithFilteredResult(_0x820999,_0x156078))[_0xe963('0x3c')](handleError(_0x820999,null));};exports[_0xe963('0x3d')]=function(_0x101335,_0x3f1ab1){var _0x4f7e2b={'raw':!![],'where':{'id':_0x101335[_0xe963('0x3e')]['id']}},_0x4f4b11={};_0x4f4b11['model']=_[_0xe963('0x2a')](db[_0xe963('0x39')]['rawAttributes']);_0x4f4b11[_0xe963('0x29')]=_[_0xe963('0x2a')](_0x101335[_0xe963('0x29')]);_0x4f4b11[_0xe963('0x2b')]=_[_0xe963('0x2c')](_0x4f4b11[_0xe963('0x28')],_0x4f4b11[_0xe963('0x29')]);_0x4f7e2b['attributes']=_[_0xe963('0x2c')](_0x4f4b11[_0xe963('0x28')],qs[_0xe963('0x2d')](_0x101335['query'][_0xe963('0x2d')]));_0x4f7e2b['attributes']=_0x4f7e2b[_0xe963('0x2e')][_0xe963('0x2f')]?_0x4f7e2b[_0xe963('0x2e')]:_0x4f4b11['model'];if(_0x101335[_0xe963('0x29')][_0xe963('0x3a')]){_0x4f7e2b['include']=[{'all':!![]}];}_0x4f7e2b=_[_0xe963('0x36')]({},_0x4f7e2b,_0x101335[_0xe963('0x38')]);return db[_0xe963('0x39')]['find'](_0x4f7e2b)[_0xe963('0x20')](handleEntityNotFound(_0x3f1ab1,null))['then'](respondWithResult(_0x3f1ab1,null))[_0xe963('0x3c')](handleError(_0x3f1ab1,null));};exports['update']=function(_0x42a825,_0x345302){if(_0x42a825[_0xe963('0x3f')]['id']){delete _0x42a825[_0xe963('0x3f')]['id'];}return db[_0xe963('0x39')][_0xe963('0x40')]({'where':{'id':_0x42a825[_0xe963('0x3e')]['id']}})[_0xe963('0x20')](handleEntityNotFound(_0x345302,null))['then'](saveUpdates(_0x42a825['body'],null))[_0xe963('0x20')](respondWithResult(_0x345302,null))[_0xe963('0x3c')](handleError(_0x345302,null));};exports[_0xe963('0x21')]=function(_0x58cdb6,_0x3376e6){return db[_0xe963('0x39')][_0xe963('0x40')]({'where':{'id':_0x58cdb6[_0xe963('0x3e')]['id']}})[_0xe963('0x20')](handleEntityNotFound(_0x3376e6,null))[_0xe963('0x20')](removeEntity(_0x3376e6,null))[_0xe963('0x3c')](handleError(_0x3376e6,null));};exports['describe']=function(_0x38243d,_0x34065e){return db[_0xe963('0x39')][_0xe963('0x41')]()[_0xe963('0x20')](respondWithResult(_0x34065e,null))[_0xe963('0x3c')](handleError(_0x34065e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 04cc754..7a56e18 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 _0x1e93=['bluebird','path','rimraf','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment'];(function(_0x379715,_0x1b331b){var _0x318ecb=function(_0x11e196){while(--_0x11e196){_0x379715['push'](_0x379715['shift']());}};_0x318ecb(++_0x1b331b);}(_0x1e93,0x17d));var _0x31e9=function(_0x552aea,_0xaf2a74){_0x552aea=_0x552aea-0x0;var _0x232f12=_0x1e93[_0x552aea];return _0x232f12;};'use strict';var _=require(_0x31e9('0x0'));var util=require(_0x31e9('0x1'));var logger=require(_0x31e9('0x2'))('api');var moment=require(_0x31e9('0x3'));var BPromise=require(_0x31e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31e9('0x5'));var rimraf=require(_0x31e9('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x31e9('0x7')]=function(_0x364257,_0x42ffb4){return _0x364257[_0x31e9('0x8')](_0x31e9('0x9'),attributes,{'tableName':_0x31e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc743=['request-promise','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird'];(function(_0x3c37c9,_0x2e6c3a){var _0x51e91d=function(_0x49c46a){while(--_0x49c46a){_0x3c37c9['push'](_0x3c37c9['shift']());}};_0x51e91d(++_0x2e6c3a);}(_0xc743,0xeb));var _0x3c74=function(_0x5325b3,_0x5b3ad7){_0x5325b3=_0x5325b3-0x0;var _0x3cbb29=_0xc743[_0x5325b3];return _0x3cbb29;};'use strict';var _=require(_0x3c74('0x0'));var util=require(_0x3c74('0x1'));var logger=require('../../config/logger')(_0x3c74('0x2'));var moment=require(_0x3c74('0x3'));var BPromise=require(_0x3c74('0x4'));var rp=require(_0x3c74('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c74('0x6'));var config=require(_0x3c74('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x3c74('0x8')]=function(_0x77724b,_0x22f8c9){return _0x77724b[_0x3c74('0x9')](_0x3c74('0xa'),attributes,{'tableName':_0x3c74('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 10f1aeb..63a192d 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 _0xeae7=['code','message','GetCmHopperBlack','options','where','attributes','limit','include','map','model','catch','CmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3773c2,_0x389a06){var _0x52fea4=function(_0x23a8a5){while(--_0x23a8a5){_0x3773c2['push'](_0x3773c2['shift']());}};_0x52fea4(++_0x389a06);}(_0xeae7,0xcf));var _0x7eae=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0xeae7[_0x338f73];return _0x163fdf;};'use strict';var _=require(_0x7eae('0x0'));var util=require(_0x7eae('0x1'));var moment=require(_0x7eae('0x2'));var BPromise=require(_0x7eae('0x3'));var rs=require(_0x7eae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7eae('0x5'));var logger=require(_0x7eae('0x6'))(_0x7eae('0x7'));var config=require(_0x7eae('0x8'));var jayson=require(_0x7eae('0x9'));var client=jayson[_0x7eae('0xa')][_0x7eae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf951e4,_0x511779,_0xfda21a){return new BPromise(function(_0x597529,_0x5325b0){return client[_0x7eae('0xc')](_0xf951e4,_0xfda21a)[_0x7eae('0xd')](function(_0x3a3f13){logger[_0x7eae('0xe')](_0x7eae('0xf'),_0x511779,_0x7eae('0x10'));logger[_0x7eae('0x11')](_0x7eae('0x12'),_0x511779,_0x7eae('0x10'),JSON[_0x7eae('0x13')](_0x3a3f13));if(_0x3a3f13[_0x7eae('0x14')]){if(_0x3a3f13[_0x7eae('0x14')][_0x7eae('0x15')]===0x1f4){logger[_0x7eae('0x14')](_0x7eae('0xf'),_0x511779,_0x3a3f13[_0x7eae('0x14')][_0x7eae('0x16')]);return _0x5325b0(_0x3a3f13['error'][_0x7eae('0x16')]);}logger[_0x7eae('0x14')](_0x7eae('0xf'),_0x511779,_0x3a3f13['error']['message']);return _0x597529(_0x3a3f13[_0x7eae('0x14')][_0x7eae('0x16')]);}else{logger[_0x7eae('0xe')](_0x7eae('0xf'),_0x511779,_0x7eae('0x10'));_0x597529(_0x3a3f13['result'][_0x7eae('0x16')]);}})['catch'](function(_0x4b7618){logger[_0x7eae('0x14')](_0x7eae('0xf'),_0x511779,_0x4b7618);_0x5325b0(_0x4b7618);});});}exports[_0x7eae('0x17')]=function(_0x443173){var _0x33fdd5=this;return new Promise(function(_0x34133c,_0x5c56a2){return db['CmHopperBlack']['findAll']({'raw':_0x443173[_0x7eae('0x18')]?_0x443173[_0x7eae('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x443173[_0x7eae('0x18')]?_0x443173[_0x7eae('0x18')][_0x7eae('0x19')]||null:null,'attributes':_0x443173[_0x7eae('0x18')]?_0x443173[_0x7eae('0x18')][_0x7eae('0x1a')]||null:null,'limit':_0x443173[_0x7eae('0x18')]?_0x443173[_0x7eae('0x18')][_0x7eae('0x1b')]||null:null,'include':_0x443173['options']?_0x443173[_0x7eae('0x18')][_0x7eae('0x1c')]?_[_0x7eae('0x1d')](_0x443173['options']['include'],function(_0x2bb5be){return{'model':db[_0x2bb5be[_0x7eae('0x1e')]],'as':_0x2bb5be['as'],'attributes':_0x2bb5be['attributes'],'include':_0x2bb5be['include']?_[_0x7eae('0x1d')](_0x2bb5be[_0x7eae('0x1c')],function(_0x585596){return{'model':db[_0x585596[_0x7eae('0x1e')]],'as':_0x585596['as'],'attributes':_0x585596['attributes'],'include':_0x585596[_0x7eae('0x1c')]?_[_0x7eae('0x1d')](_0x585596[_0x7eae('0x1c')],function(_0x40e5e3){return{'model':db[_0x40e5e3['model']],'as':_0x40e5e3['as'],'attributes':_0x40e5e3[_0x7eae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7eae('0xd')](function(_0x462340){logger[_0x7eae('0xe')](_0x7eae('0x17'),_0x443173);logger['debug'](_0x7eae('0x17'),_0x443173,JSON['stringify'](_0x462340));_0x34133c(_0x462340);})[_0x7eae('0x1f')](function(_0x3a9330){logger['error']('GetCmHopperBlack',_0x3a9330[_0x7eae('0x16')],_0x443173);_0x5c56a2(_0x33fdd5['error'](0x1f4,_0x3a9330[_0x7eae('0x16')]));});});};exports['UpdateCmHopperBlack']=function(_0x47d24c){var _0x36607f=this;return new Promise(function(_0x4e9699,_0x41ed75){return db[_0x7eae('0x20')][_0x7eae('0x21')](_0x47d24c[_0x7eae('0x22')],{'raw':_0x47d24c['options']?_0x47d24c[_0x7eae('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d24c[_0x7eae('0x18')]?_0x47d24c['options']['where']||null:null,'attributes':_0x47d24c[_0x7eae('0x18')]?_0x47d24c[_0x7eae('0x18')][_0x7eae('0x1a')]||null:null,'limit':_0x47d24c['options']?_0x47d24c[_0x7eae('0x18')]['limit']||null:null})[_0x7eae('0xd')](function(_0x42863e){logger[_0x7eae('0xe')]('UpdateCmHopperBlack',_0x47d24c);logger[_0x7eae('0x11')](_0x7eae('0x23'),_0x47d24c,JSON[_0x7eae('0x13')](_0x42863e));_0x4e9699(_0x42863e);})['catch'](function(_0x1ceecd){logger[_0x7eae('0x14')](_0x7eae('0x23'),_0x1ceecd[_0x7eae('0x16')],_0x47d24c);_0x41ed75(_0x36607f[_0x7eae('0x14')](0x1f4,_0x1ceecd[_0x7eae('0x16')]));});});};exports[_0x7eae('0x24')]=function(_0x4c037e){var _0x1b7ffc=this;return new Promise(function(_0x3c9a66,_0xd19876){return db[_0x7eae('0x20')][_0x7eae('0x25')]({'where':_0x4c037e['options']?_0x4c037e[_0x7eae('0x18')][_0x7eae('0x19')]||null:null})[_0x7eae('0xd')](function(_0x97d582){logger[_0x7eae('0xe')](_0x7eae('0x24'),_0x4c037e);logger[_0x7eae('0x11')]('DestroyCmHopperBlack',_0x4c037e,JSON['stringify'](_0x97d582));_0x3c9a66(_0x97d582);})[_0x7eae('0x1f')](function(_0x2f2172){logger[_0x7eae('0x14')](_0x7eae('0x24'),_0x2f2172[_0x7eae('0x16')],_0x4c037e);_0xd19876(_0x1b7ffc['error'](0x1f4,_0x2f2172[_0x7eae('0x16')]));});});}; \ No newline at end of file +var _0x2820=['ioredis','../../config/logger','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','map','include','model','update','body','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','util','bluebird','randomstring'];(function(_0x5aa28c,_0x505a05){var _0x23345b=function(_0x59735a){while(--_0x59735a){_0x5aa28c['push'](_0x5aa28c['shift']());}};_0x23345b(++_0x505a05);}(_0x2820,0x81));var _0x0282=function(_0x4e8eb0,_0xd2889d){_0x4e8eb0=_0x4e8eb0-0x0;var _0x5e586d=_0x2820[_0x4e8eb0];return _0x5e586d;};'use strict';var _=require('lodash');var util=require(_0x0282('0x0'));var moment=require('moment');var BPromise=require(_0x0282('0x1'));var rs=require(_0x0282('0x2'));var fs=require('fs');var Redis=require(_0x0282('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0282('0x4'))('rpc');var config=require(_0x0282('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0282('0x6')][_0x0282('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c0d45,_0x2e16c4,_0xdddfb5){return new BPromise(function(_0x15c62f,_0x4aa68d){return client[_0x0282('0x8')](_0x3c0d45,_0xdddfb5)[_0x0282('0x9')](function(_0x38138a){logger[_0x0282('0xa')](_0x0282('0xb'),_0x2e16c4,_0x0282('0xc'));logger[_0x0282('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2e16c4,_0x0282('0xc'),JSON[_0x0282('0xe')](_0x38138a));if(_0x38138a[_0x0282('0xf')]){if(_0x38138a[_0x0282('0xf')][_0x0282('0x10')]===0x1f4){logger['error'](_0x0282('0xb'),_0x2e16c4,_0x38138a[_0x0282('0xf')]['message']);return _0x4aa68d(_0x38138a[_0x0282('0xf')][_0x0282('0x11')]);}logger[_0x0282('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x2e16c4,_0x38138a[_0x0282('0xf')][_0x0282('0x11')]);return _0x15c62f(_0x38138a[_0x0282('0xf')][_0x0282('0x11')]);}else{logger[_0x0282('0xa')](_0x0282('0xb'),_0x2e16c4,_0x0282('0xc'));_0x15c62f(_0x38138a[_0x0282('0x12')]['message']);}})[_0x0282('0x13')](function(_0x2c82b2){logger[_0x0282('0xf')](_0x0282('0xb'),_0x2e16c4,_0x2c82b2);_0x4aa68d(_0x2c82b2);});});}exports[_0x0282('0x14')]=function(_0x28fd04){var _0x4b21a6=this;return new Promise(function(_0x32a287,_0x4ea9d3){return db[_0x0282('0x15')]['findAll']({'raw':_0x28fd04[_0x0282('0x16')]?_0x28fd04[_0x0282('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x28fd04['options']?_0x28fd04['options'][_0x0282('0x17')]||null:null,'attributes':_0x28fd04[_0x0282('0x16')]?_0x28fd04[_0x0282('0x16')][_0x0282('0x18')]||null:null,'limit':_0x28fd04['options']?_0x28fd04[_0x0282('0x16')]['limit']||null:null,'include':_0x28fd04['options']?_0x28fd04[_0x0282('0x16')]['include']?_[_0x0282('0x19')](_0x28fd04[_0x0282('0x16')][_0x0282('0x1a')],function(_0x4d0471){return{'model':db[_0x4d0471[_0x0282('0x1b')]],'as':_0x4d0471['as'],'attributes':_0x4d0471[_0x0282('0x18')],'include':_0x4d0471[_0x0282('0x1a')]?_[_0x0282('0x19')](_0x4d0471[_0x0282('0x1a')],function(_0x43ea87){return{'model':db[_0x43ea87['model']],'as':_0x43ea87['as'],'attributes':_0x43ea87[_0x0282('0x18')],'include':_0x43ea87['include']?_['map'](_0x43ea87[_0x0282('0x1a')],function(_0x12094c){return{'model':db[_0x12094c[_0x0282('0x1b')]],'as':_0x12094c['as'],'attributes':_0x12094c[_0x0282('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0282('0x9')](function(_0x5d4f93){logger['info']('GetCmHopperBlack',_0x28fd04);logger[_0x0282('0xd')]('GetCmHopperBlack',_0x28fd04,JSON[_0x0282('0xe')](_0x5d4f93));_0x32a287(_0x5d4f93);})['catch'](function(_0xe998a7){logger[_0x0282('0xf')]('GetCmHopperBlack',_0xe998a7[_0x0282('0x11')],_0x28fd04);_0x4ea9d3(_0x4b21a6[_0x0282('0xf')](0x1f4,_0xe998a7[_0x0282('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x1f4b90){var _0x4e35fe=this;return new Promise(function(_0x56e0a4,_0x2f2ba7){return db[_0x0282('0x15')][_0x0282('0x1c')](_0x1f4b90[_0x0282('0x1d')],{'raw':_0x1f4b90['options']?_0x1f4b90[_0x0282('0x16')][_0x0282('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f4b90[_0x0282('0x16')]?_0x1f4b90[_0x0282('0x16')][_0x0282('0x17')]||null:null,'attributes':_0x1f4b90[_0x0282('0x16')]?_0x1f4b90[_0x0282('0x16')][_0x0282('0x18')]||null:null,'limit':_0x1f4b90[_0x0282('0x16')]?_0x1f4b90[_0x0282('0x16')]['limit']||null:null})[_0x0282('0x9')](function(_0x35be84){logger['info'](_0x0282('0x1f'),_0x1f4b90);logger[_0x0282('0xd')](_0x0282('0x1f'),_0x1f4b90,JSON[_0x0282('0xe')](_0x35be84));_0x56e0a4(_0x35be84);})[_0x0282('0x13')](function(_0x56e64d){logger[_0x0282('0xf')](_0x0282('0x1f'),_0x56e64d['message'],_0x1f4b90);_0x2f2ba7(_0x4e35fe['error'](0x1f4,_0x56e64d[_0x0282('0x11')]));});});};exports[_0x0282('0x20')]=function(_0x3cb33d){var _0x1c30e9=this;return new Promise(function(_0x51ab8a,_0x1baef8){return db[_0x0282('0x15')]['destroy']({'where':_0x3cb33d[_0x0282('0x16')]?_0x3cb33d[_0x0282('0x16')]['where']||null:null})[_0x0282('0x9')](function(_0x4fa1b0){logger[_0x0282('0xa')](_0x0282('0x20'),_0x3cb33d);logger[_0x0282('0xd')]('DestroyCmHopperBlack',_0x3cb33d,JSON['stringify'](_0x4fa1b0));_0x51ab8a(_0x4fa1b0);})[_0x0282('0x13')](function(_0x3196e9){logger['error']('DestroyCmHopperBlack',_0x3196e9[_0x0282('0x11')],_0x3cb33d);_0x1baef8(_0x1c30e9[_0x0282('0xf')](0x1f4,_0x3196e9[_0x0282('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index faeed3f..32f0f57 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 _0x3c6c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','put','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x25e922,_0x43635e){var _0x1251e9=function(_0x2cd63b){while(--_0x2cd63b){_0x25e922['push'](_0x25e922['shift']());}};_0x1251e9(++_0x43635e);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x446717,_0x4f7fb7){_0x446717=_0x446717-0x0;var _0x4068b1=_0x3c6c[_0x446717];return _0x4068b1;};'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('./cmHopperBlack.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')](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xe')]);router['delete'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1967=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3bf107,_0x53295e){var _0x5d09eb=function(_0x589c88){while(--_0x589c88){_0x3bf107['push'](_0x3bf107['shift']());}};_0x5d09eb(++_0x53295e);}(_0x1967,0x173));var _0x7196=function(_0x14b341,_0x191d53){_0x14b341=_0x14b341-0x0;var _0x388b8d=_0x1967[_0x14b341];return _0x388b8d;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')](_0x7196('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x7196('0x12')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x13')]);module[_0x7196('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d0a0db6..abea192 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 _0xc16f=['sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x6f858b,_0x3c0c0a){var _0x4e3327=function(_0x4917bf){while(--_0x4917bf){_0x6f858b['push'](_0x6f858b['shift']());}};_0x4e3327(++_0x3c0c0a);}(_0xc16f,0x15c));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc16('0x0'));var moment=require(_0xfc16('0x1'));module[_0xfc16('0x2')]={'state':{'type':Sequelize[_0xfc16('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xfc16('0x4')]},'scheduledat':{'type':Sequelize[_0xfc16('0x5')]},'countbusyretry':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfc16('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xfc16('0x4')]},'calleridnum':{'type':Sequelize[_0xfc16('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xfc16('0x5')]},'answertime':{'type':Sequelize[_0xfc16('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xfc16('0x5')]},'ringtime':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc16('0x4')]},'campaign':{'type':Sequelize[_0xfc16('0x4')]},'campaigntype':{'type':Sequelize[_0xfc16('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xfc16('0x4')]},'disposition':{'type':Sequelize[_0xfc16('0x4')]},'secondDisposition':{'type':Sequelize[_0xfc16('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xfc16('0x5')],'set':function(_0x13a752){var _0x259457=this[_0xfc16('0x6')]('endtime');if(_0x259457&&_0x13a752){this['setDataValue'](_0xfc16('0x7'),moment(_0x13a752)[_0xfc16('0x8')](moment(_0x259457),_0xfc16('0x9')));}return this['setDataValue'](_0xfc16('0xa'),_0x13a752);}},'amd':{'type':Sequelize[_0xfc16('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfc16('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfc16('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xfc16('0x5')]},'callback':{'type':Sequelize[_0xfc16('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfc16('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfc16('0x5')]},'deleted':{'type':Sequelize[_0xfc16('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfc16('0x5')]},'recallme':{'type':Sequelize[_0xfc16('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfc16('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfc16('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ba1=['BOOLEAN','sequelize','exports','INTEGER','DATE','STRING','endtime','diff','seconds','dispositionat'];(function(_0x2f0431,_0x188307){var _0x23a38c=function(_0x47553c){while(--_0x47553c){_0x2f0431['push'](_0x2f0431['shift']());}};_0x23a38c(++_0x188307);}(_0x8ba1,0x1c3));var _0x18ba=function(_0xdd057b,_0x3be045){_0xdd057b=_0xdd057b-0x0;var _0xc61cd7=_0x8ba1[_0xdd057b];return _0xc61cd7;};'use strict';var Sequelize=require(_0x18ba('0x0'));var moment=require('moment');module[_0x18ba('0x1')]={'state':{'type':Sequelize[_0x18ba('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x18ba('0x3')]},'countbusyretry':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x18ba('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x18ba('0x4')]},'originatecalleridname':{'type':Sequelize[_0x18ba('0x4')]},'calleridnum':{'type':Sequelize[_0x18ba('0x4')]},'calleridname':{'type':Sequelize[_0x18ba('0x4')]},'starttime':{'type':Sequelize[_0x18ba('0x3')]},'responsetime':{'type':Sequelize[_0x18ba('0x3')]},'answertime':{'type':Sequelize[_0x18ba('0x3')]},'droptime':{'type':Sequelize[_0x18ba('0x3')]},'endtime':{'type':Sequelize[_0x18ba('0x3')]},'ringtime':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x18ba('0x4')]},'campaign':{'type':Sequelize[_0x18ba('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x18ba('0x4')]},'reason':{'type':Sequelize[_0x18ba('0x4')]},'disposition':{'type':Sequelize[_0x18ba('0x4')]},'secondDisposition':{'type':Sequelize[_0x18ba('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x18ba('0x3')],'set':function(_0x639775){var _0x58530b=this['getDataValue'](_0x18ba('0x5'));if(_0x58530b&&_0x639775){this['setDataValue']('followuptime',moment(_0x639775)[_0x18ba('0x6')](moment(_0x58530b),_0x18ba('0x7')));}return this['setDataValue'](_0x18ba('0x8'),_0x639775);}},'amd':{'type':Sequelize[_0x18ba('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x18ba('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x18ba('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x18ba('0x3')]},'callback':{'type':Sequelize[_0x18ba('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x18ba('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x18ba('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x18ba('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x18ba('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 368a20d..cc41264 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 _0xd8fb=['updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','toString','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','options','find','describe','body','uniqueid','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt'];(function(_0x398da8,_0x56ce90){var _0x2ca568=function(_0x5bd1a7){while(--_0x5bd1a7){_0x398da8['push'](_0x398da8['shift']());}};_0x2ca568(++_0x56ce90);}(_0xd8fb,0x99));var _0xbd8f=function(_0x55334e,_0x3c03d7){_0x55334e=_0x55334e-0x0;var _0x2565ef=_0xd8fb[_0x55334e];return _0x2565ef;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=typeof _0xa57e91[_0xbd8f('0x18')]===_0xbd8f('0x19')&&typeof _0xa57e91['limit']===_0xbd8f('0x19');var _0xf5e7a=_0x10d72e['count'];var _0x4435b9=_0x4da96f?0x0:_0xa57e91[_0xbd8f('0x18')];var _0x47d317=_0x4da96f?_0x10d72e['count']:_0xa57e91[_0xbd8f('0x18')]+_0xa57e91['limit'];var _0x5705c5;if(_0x47d317>=_0xf5e7a){_0x47d317=_0xf5e7a;_0x5705c5=0xc8;}else{_0x5705c5=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5705c5);return _0x829fb2['set'](_0xbd8f('0x1a'),_0x4435b9+'-'+_0x47d317+'/'+_0xf5e7a)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0xb47c8e){return function(_0x897f25){try{jsonpatch[_0xbd8f('0x1b')](_0x897f25,_0xb47c8e,!![]);}catch(_0x20cab7){return BPromise[_0xbd8f('0x1c')](_0x20cab7);}return _0x897f25[_0xbd8f('0x1d')]();};}function saveUpdates(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x1e')](_0x2fbe3b)[_0xbd8f('0x1f')](function(_0x15c4a9){return _0x15c4a9;});}return null;};}function removeEntity(_0x320ede,_0xd11ae){return function(_0x395b1b){if(_0x395b1b){return _0x395b1b['destroy']()[_0xbd8f('0x1f')](function(){_0x320ede[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x2f3df7,_0xa88414){return function(_0x2257fd){if(!_0x2257fd){_0x2f3df7[_0xbd8f('0x14')](0x194);}return _0x2257fd;};}function handleError(_0x264e62,_0x4ea554){_0x4ea554=_0x4ea554||0x1f4;return function(_0x40cb43){logger[_0xbd8f('0x20')](_0x40cb43['stack']);if(_0x40cb43[_0xbd8f('0x21')]){delete _0x40cb43['name'];}_0x264e62[_0xbd8f('0x15')](_0x4ea554)[_0xbd8f('0x22')](_0x40cb43);};}exports[_0xbd8f('0x23')]=function(_0x202126,_0x2aefa2){var _0x247b07={},_0x4c4431={},_0x166de7={'count':0x0,'rows':[]};var _0x14f3cb=_[_0xbd8f('0x24')](db[_0xbd8f('0x25')][_0xbd8f('0x26')],function(_0x2ac26f){return{'name':_0x2ac26f[_0xbd8f('0x27')],'type':_0x2ac26f['type'][_0xbd8f('0x28')]};});_0x4c4431[_0xbd8f('0x29')]=_[_0xbd8f('0x24')](_0x14f3cb,_0xbd8f('0x21'));_0x4c4431['query']=_['keys'](_0x202126[_0xbd8f('0x2a')]);_0x4c4431[_0xbd8f('0x2b')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],_0x4c4431['query']);_0x247b07[_0xbd8f('0x2d')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x202126[_0xbd8f('0x2a')]['fields']));_0x247b07[_0xbd8f('0x2d')]=_0x247b07[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x247b07[_0xbd8f('0x2d')]:_0x4c4431[_0xbd8f('0x29')];if(!_0x202126['query'][_0xbd8f('0x30')]('nolimit')){_0x247b07[_0xbd8f('0x31')]=qs[_0xbd8f('0x31')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x31')]);_0x247b07[_0xbd8f('0x18')]=qs[_0xbd8f('0x18')](_0x202126['query']['offset']);}_0x247b07['order']=qs[_0xbd8f('0x32')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x32')]);_0x247b07[_0xbd8f('0x33')]=qs[_0xbd8f('0x2b')](_[_0xbd8f('0x34')](_0x202126[_0xbd8f('0x2a')],_0x4c4431[_0xbd8f('0x2b')]),_0x14f3cb);if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]){_0x247b07[_0xbd8f('0x33')]=_[_0xbd8f('0x36')](_0x247b07[_0xbd8f('0x33')],{'$or':_[_0xbd8f('0x24')](_0x14f3cb,function(_0x391d45){if(_0x391d45['type']!==_0xbd8f('0x37')){var _0x4181e0={};_0x4181e0[_0x391d45['name']]={'$like':'%'+_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]+'%'};return _0x4181e0;}})});}_0x247b07=_[_0xbd8f('0x36')]({},_0x247b07,_0x202126['options']);var _0x21da54={'where':_0x247b07['where']};return db[_0xbd8f('0x25')][_0xbd8f('0x38')](_0x21da54)[_0xbd8f('0x1f')](function(_0x4f2ebc){_0x166de7[_0xbd8f('0x38')]=_0x4f2ebc;if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x247b07['include']=[{'all':!![]}];}return db[_0xbd8f('0x25')][_0xbd8f('0x3a')](_0x247b07);})[_0xbd8f('0x1f')](function(_0x351027){_0x166de7[_0xbd8f('0x3b')]=_0x351027;return _0x166de7;})[_0xbd8f('0x1f')](respondWithFilteredResult(_0x2aefa2,_0x247b07))[_0xbd8f('0x3c')](handleError(_0x2aefa2,null));};exports[_0xbd8f('0x3d')]=function(_0x14b768,_0x5e1e77){var _0x52c62b={'raw':!![],'where':{'id':_0x14b768[_0xbd8f('0x3e')]['id']}},_0x2907a3={};_0x2907a3[_0xbd8f('0x29')]=_[_0xbd8f('0x3f')](db['CmHopperFinal'][_0xbd8f('0x26')]);_0x2907a3[_0xbd8f('0x2a')]=_[_0xbd8f('0x3f')](_0x14b768[_0xbd8f('0x2a')]);_0x2907a3[_0xbd8f('0x2b')]=_['intersection'](_0x2907a3['model'],_0x2907a3[_0xbd8f('0x2a')]);_0x52c62b['attributes']=_[_0xbd8f('0x2c')](_0x2907a3[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x2e')]));_0x52c62b[_0xbd8f('0x2d')]=_0x52c62b[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x52c62b['attributes']:_0x2907a3[_0xbd8f('0x29')];if(_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x52c62b[_0xbd8f('0x40')]=[{'all':!![]}];}_0x52c62b=_[_0xbd8f('0x36')]({},_0x52c62b,_0x14b768[_0xbd8f('0x41')]);return db[_0xbd8f('0x25')][_0xbd8f('0x42')](_0x52c62b)['then'](handleEntityNotFound(_0x5e1e77,null))[_0xbd8f('0x1f')](respondWithResult(_0x5e1e77,null))[_0xbd8f('0x3c')](handleError(_0x5e1e77,null));};exports[_0xbd8f('0x43')]=function(_0x1f12dd,_0x2fdbd0){return db[_0xbd8f('0x25')][_0xbd8f('0x43')]()[_0xbd8f('0x1f')](respondWithResult(_0x2fdbd0,null))[_0xbd8f('0x3c')](handleError(_0x2fdbd0,null));};exports[_0xbd8f('0x1e')]=function(_0x406741,_0x255c59){if(_0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')]){delete _0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')];}return db[_0xbd8f('0x25')][_0xbd8f('0x42')]({'where':{'uniqueid':_0x406741[_0xbd8f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x255c59,null))[_0xbd8f('0x1f')](saveUpdates(_0x406741[_0xbd8f('0x44')],null))[_0xbd8f('0x1f')](respondWithResult(_0x255c59,null))[_0xbd8f('0x3c')](handleError(_0x255c59,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x1b38ad,_0x5a33c5,_0x9bfe93){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'VoiceQueueId':_0x1b38ad[_0xbd8f('0x3e')]['id']},'attributes':[[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')]('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),_0xbd8f('0x51')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),'reCallContacts'],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x5a33c5,null))[_0xbd8f('0x1f')](respondWithResult(_0x5a33c5,null))[_0xbd8f('0x3c')](handleError(_0x5a33c5,null));};exports[_0xbd8f('0x54')]=function(_0x93452d,_0x4a86a9,_0x5ea275){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'CampaignId':_0x93452d[_0xbd8f('0x3e')]['id']},'attributes':[[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),'abandonedContacts'],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),_0xbd8f('0x55')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x56')))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x4a86a9,null))[_0xbd8f('0x1f')](respondWithResult(_0x4a86a9,null))[_0xbd8f('0x3c')](handleError(_0x4a86a9,null));};exports[_0xbd8f('0x57')]=function(_0x5a8c8f,_0x5c04d9,_0x2407e7){return db[_0xbd8f('0x58')][_0xbd8f('0x42')]({'where':{'id':_0x5a8c8f[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x5c04d9,null))['then'](function(_0x200718){var _0x27ec14;if(_0x200718){_0x27ec14=squel[_0xbd8f('0x59')]()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x61'),_0xbd8f('0x62'),_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x66'),_0xbd8f('0x5d'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),'ListId')['field'](_0xbd8f('0x69'),_0xbd8f('0x61'))['field'](_0xbd8f('0x6a'),'createdAt')[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')]('cm_hopper_final')[_0xbd8f('0x33')](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x5a8c8f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x5d'))[_0xbd8f('0x6b')]('cm_hopper')[_0xbd8f('0x33')]('VoiceQueueId\x20=\x20?',_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()[_0xbd8f('0x65')](_0xbd8f('0x71'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))['where'](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')]('state\x20=\x204'))['group'](_0xbd8f('0x5f')))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x27ec14);}return[];})[_0xbd8f('0x1f')](respondWithResult(_0x5c04d9,null))['catch'](handleError(_0x5c04d9,null));};exports[_0xbd8f('0x74')]=function(_0x13314f,_0x328bd6,_0x11a05a){return db[_0xbd8f('0x75')]['find']({'where':{'id':_0x13314f['params']['id']}})['then'](handleEntityNotFound(_0x328bd6,null))[_0xbd8f('0x1f')](function(_0x5df0e1){var _0x535869;if(_0x5df0e1){_0x535869=squel['insert']()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x76'),'createdAt',_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')]('ANY_VALUE(calleridnum)',_0xbd8f('0x5d'))[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),_0xbd8f('0x60'))['field'](_0xbd8f('0x77'),_0xbd8f('0x76'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x62'))['field'](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))[_0xbd8f('0x33')]('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x13314f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xbd8f('0x64')]()['field']('phone')['from'](_0xbd8f('0x5b'))[_0xbd8f('0x33')](_0xbd8f('0x78'),_0x13314f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()['field'](_0xbd8f('0x71'))['from'](_0xbd8f('0x72'))['where']('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x79')))[_0xbd8f('0x7a')]('ContactId'))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x535869);}return[];})['then'](respondWithResult(_0x328bd6,null))[_0xbd8f('0x3c')](handleError(_0x328bd6,null));};exports[_0xbd8f('0x7b')]=function(_0x38d1a6,_0x31b92c,_0x11fb11){return db[_0xbd8f('0x7c')][_0xbd8f('0x7d')]({'where':{'VoiceQueueId':_0x38d1a6[_0xbd8f('0x44')][_0xbd8f('0x61')],'CampaignId':_0x38d1a6[_0xbd8f('0x44')]['CampaignId'],'ContactId':_0x38d1a6['body']['ContactId']}})['then'](handleEntityNotFound(_0x31b92c,null))[_0xbd8f('0x1f')](function(_0x3ff503){if(_0x3ff503){return _0x3ff503;}return null;})['then'](respondWithResult(_0x31b92c,null))['catch'](handleError(_0x31b92c,null));}; \ No newline at end of file +var _0x524e=['destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','then','includeAll','include','findAll','rows','catch','show','length','find','describe','body','uniqueid','params','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`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=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','group','Campaign','ContactId','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','CmHopper','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x524e,0x15e));var _0xe524=function(_0x1c3dfa,_0x28c734){_0x1c3dfa=_0x1c3dfa-0x0;var _0x4f811b=_0x524e[_0x1c3dfa];return _0x4f811b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['CmHopperFinal'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['describe']()[_0xe524('0x3f')](respondWithResult(_0x33b1c8,null))['catch'](handleError(_0x33b1c8,null));};exports['update']=function(_0x24f313,_0x59fe6b){if(_0x24f313[_0xe524('0x49')][_0xe524('0x4a')]){delete _0x24f313['body'][_0xe524('0x4a')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x24f313[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x59fe6b,null))[_0xe524('0x3f')](saveUpdates(_0x24f313['body'],null))['then'](respondWithResult(_0x59fe6b,null))['catch'](handleError(_0x59fe6b,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x4f7a64,_0x5477ca,_0x45f504){return db[_0xe524('0x3e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x4f7a64[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x4e')))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x51')))),_0xe524('0x52')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),_0xe524('0x54')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x59')))),'reCallContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xe524('0x3f')](handleEntityNotFound(_0x5477ca,null))['then'](respondWithResult(_0x5477ca,null))[_0xe524('0x44')](handleError(_0x5477ca,null));};exports[_0xe524('0x5a')]=function(_0x3f4201,_0x287ab8,_0x2b2a0e){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x3f4201[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),'busyContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x5b')))),_0xe524('0x5c')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x59')))),_0xe524('0x5d')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x5e')))),_0xe524('0x5f')]]})[_0xe524('0x3f')](handleEntityNotFound(_0x287ab8,null))['then'](respondWithResult(_0x287ab8,null))[_0xe524('0x44')](handleError(_0x287ab8,null));};exports[_0xe524('0x60')]=function(_0x43d125,_0x13905f,_0x4514d4){return db['VoiceQueue'][_0xe524('0x47')]({'where':{'id':_0x43d125[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x13905f,null))[_0xe524('0x3f')](function(_0x109da1){var _0x57b6bb;if(_0x109da1){_0x57b6bb=squel[_0xe524('0x61')]()[_0xe524('0x62')](_0xe524('0x63'))[_0xe524('0x64')]([_0xe524('0x65'),_0xe524('0x66'),'ContactId',_0xe524('0x67'),_0xe524('0x68'),_0xe524('0x69'),'updatedAt'],squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('ANY_VALUE(calleridnum)',_0xe524('0x65'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))[_0xe524('0x6b')](_0xe524('0x6d'),'ContactId')[_0xe524('0x6b')](_0xe524('0x6e'),_0xe524('0x67'))[_0xe524('0x6b')](_0xe524('0x6f'),_0xe524('0x68'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x69'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x70'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x20?',_0x43d125[_0xe524('0x49')][_0xe524('0x74')]['toString']())['where'](_0xe524('0x75'))['where'](_0xe524('0x76'),squel['select']()[_0xe524('0x6b')](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))['where']('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where'](_0xe524('0x76'),squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('calleridnum')[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')](_0xe524('0x77'),_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())['where']('state\x20=\x204'))[_0xe524('0x78')]('ContactId'))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0x57b6bb);}return[];})['then'](respondWithResult(_0x13905f,null))[_0xe524('0x44')](handleError(_0x13905f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1681c5,_0x41e693,_0xfc62e5){return db[_0xe524('0x79')][_0xe524('0x47')]({'where':{'id':_0x1681c5[_0xe524('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41e693,null))[_0xe524('0x3f')](function(_0x35d0f4){var _0xa8334;if(_0x35d0f4){_0xa8334=squel['insert']()[_0xe524('0x62')](_0xe524('0x63'))['fromQuery']([_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x7a'),_0xe524('0x67'),'CampaignId',_0xe524('0x69'),_0xe524('0x70')],squel[_0xe524('0x6a')]()['field'](_0xe524('0x7b'),'phone')[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))['field'](_0xe524('0x6d'),_0xe524('0x7a'))[_0xe524('0x6b')]('ANY_VALUE(ListId)','ListId')[_0xe524('0x6b')]('ANY_VALUE(CampaignId)',_0xe524('0x7c'))['field'](_0xe524('0x6c'),_0xe524('0x69'))['field'](_0xe524('0x6c'),_0xe524('0x70'))['from']('cm_hopper_final')[_0xe524('0x38')](_0xe524('0x7d'),_0x1681c5[_0xe524('0x4b')]['id']['toString']())[_0xe524('0x38')](_0xe524('0x7e'),_0x1681c5[_0xe524('0x49')][_0xe524('0x74')][_0xe524('0x73')]())[_0xe524('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xe524('0x38')](_0xe524('0x76'),squel['select']()['field'](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xe524('0x6a')]()[_0xe524('0x6b')](_0xe524('0x7f'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5['params']['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x204'))['group'](_0xe524('0x7a')))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0xa8334);}return[];})[_0xe524('0x3f')](respondWithResult(_0x41e693,null))[_0xe524('0x44')](handleError(_0x41e693,null));};exports['checkContactHopper']=function(_0x555801,_0x3e8668,_0x390093){return db[_0xe524('0x80')][_0xe524('0x81')]({'where':{'VoiceQueueId':_0x555801[_0xe524('0x49')][_0xe524('0x68')],'CampaignId':_0x555801[_0xe524('0x49')][_0xe524('0x7c')],'ContactId':_0x555801['body'][_0xe524('0x7a')]}})[_0xe524('0x3f')](handleEntityNotFound(_0x3e8668,null))[_0xe524('0x3f')](function(_0x5242b7){if(_0x5242b7){return _0x5242b7;}return null;})['then'](respondWithResult(_0x3e8668,null))[_0xe524('0x44')](handleError(_0x3e8668,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index fd278c1..5431c5b 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 _0x1b40=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x39cf72,_0x155c8b){var _0x1b302d=function(_0x1ff7d6){while(--_0x1ff7d6){_0x39cf72['push'](_0x39cf72['shift']());}};_0x1b302d(++_0x155c8b);}(_0x1b40,0x1a1));var _0x01b4=function(_0x263204,_0x19286b){_0x263204=_0x263204-0x0;var _0xed3987=_0x1b40[_0x263204];return _0xed3987;};'use strict';var _=require(_0x01b4('0x0'));var util=require(_0x01b4('0x1'));var logger=require(_0x01b4('0x2'))('api');var moment=require(_0x01b4('0x3'));var BPromise=require(_0x01b4('0x4'));var rp=require(_0x01b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01b4('0x6'));var config=require(_0x01b4('0x7'));var attributes=require(_0x01b4('0x8'));module[_0x01b4('0x9')]=function(_0x2f1476,_0x22afec){return _0x2f1476[_0x01b4('0xa')](_0x01b4('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x01b4('0xc'),'fields':[_0x01b4('0xc')]},{'name':_0x01b4('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f74=['util','../../config/logger','moment','bluebird','path','rimraf','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x4e413f,_0x266ab4){var _0x2eca8a=function(_0x36dc7e){while(--_0x36dc7e){_0x4e413f['push'](_0x4e413f['shift']());}};_0x2eca8a(++_0x266ab4);}(_0x2f74,0x137));var _0x42f7=function(_0x1009c6,_0x548277){_0x1009c6=_0x1009c6-0x0;var _0x40dc08=_0x2f74[_0x1009c6];return _0x40dc08;};'use strict';var _=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var logger=require(_0x42f7('0x2'))('api');var moment=require(_0x42f7('0x3'));var BPromise=require(_0x42f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42f7('0x5'));var rimraf=require(_0x42f7('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x42f7('0x7')]=function(_0x4820bf,_0x4e28fb){return _0x4820bf[_0x42f7('0x8')](_0x42f7('0x9'),attributes,{'tableName':_0x42f7('0xa'),'paranoid':![],'indexes':[{'name':_0x42f7('0xb'),'fields':['calleridnum']},{'name':_0x42f7('0xc'),'fields':[_0x42f7('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 f6867e6..c96c638 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2e698c,_0xc7c9a3){var _0x2cc540=function(_0x13576c){while(--_0x13576c){_0x2e698c['push'](_0x2e698c['shift']());}};_0x2cc540(++_0xc7c9a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f7cc0,_0xa7ddc9){_0x2f7cc0=_0x2f7cc0-0x0;var _0x42ac73=_0xb10b[_0x2f7cc0];return _0x42ac73;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x1567ec,_0x58a791){var _0x1a5734=function(_0x289fd0){while(--_0x289fd0){_0x1567ec['push'](_0x1567ec['shift']());}};_0x1a5734(++_0x58a791);}(_0x7a54,0x106));var _0x47a5=function(_0x40b259,_0x43682a){_0x40b259=_0x40b259-0x0;var _0x8c386d=_0x7a54[_0x40b259];return _0x8c386d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 9cac404..a50ccd1 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 _0x7df3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','put','exports','multer','util','connect-timeout','express','Router'];(function(_0x1bae3e,_0x12950c){var _0x170b37=function(_0x26fce4){while(--_0x26fce4){_0x1bae3e['push'](_0x1bae3e['shift']());}};_0x170b37(++_0x12950c);}(_0x7df3,0x109));var _0x37df=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7df3[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var path=require('path');var timeout=require(_0x37df('0x2'));var express=require(_0x37df('0x3'));var router=express[_0x37df('0x4')]();var fs_extra=require(_0x37df('0x5'));var auth=require(_0x37df('0x6'));var interaction=require(_0x37df('0x7'));var config=require(_0x37df('0x8'));var controller=require(_0x37df('0x9'));router[_0x37df('0xa')]('/',auth['isAuthenticated'](),controller[_0x37df('0xb')]);router[_0x37df('0xa')](_0x37df('0xc'),auth['isAuthenticated'](),controller[_0x37df('0xd')]);router[_0x37df('0xa')](_0x37df('0xe'),auth[_0x37df('0xf')](),controller[_0x37df('0x10')]);router['get'](_0x37df('0x11'),auth[_0x37df('0xf')](),controller[_0x37df('0x12')]);router[_0x37df('0xa')](_0x37df('0x13'),auth[_0x37df('0xf')](),controller[_0x37df('0x14')]);router[_0x37df('0x15')]('/voice/queue/moveContacts/:id',auth[_0x37df('0xf')](),controller[_0x37df('0x16')]);router[_0x37df('0x15')](_0x37df('0x17'),auth[_0x37df('0xf')](),controller[_0x37df('0x18')]);router[_0x37df('0x15')]('/checkContactHopper',auth[_0x37df('0xf')](),controller['checkContactHopper']);router[_0x37df('0x19')]('/:id',auth[_0x37df('0xf')](),controller['update']);module[_0x37df('0x1a')]=router; \ No newline at end of file +var _0x851f=['path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x851f,0x185));var _0xf851=function(_0x1ca4cc,_0x402c23){_0x1ca4cc=_0x1ca4cc-0x0;var _0x108010=_0x851f[_0x1ca4cc];return _0x108010;};'use strict';var multer=require(_0xf851('0x0'));var util=require(_0xf851('0x1'));var path=require(_0xf851('0x2'));var timeout=require('connect-timeout');var express=require(_0xf851('0x3'));var router=express[_0xf851('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf851('0x5'));var interaction=require(_0xf851('0x6'));var config=require('../../config/environment');var controller=require(_0xf851('0x7'));router['get']('/',auth[_0xf851('0x8')](),controller[_0xf851('0x9')]);router[_0xf851('0xa')](_0xf851('0xb'),auth[_0xf851('0x8')](),controller[_0xf851('0xc')]);router[_0xf851('0xa')]('/:id',auth[_0xf851('0x8')](),controller['show']);router[_0xf851('0xa')](_0xf851('0xd'),auth[_0xf851('0x8')](),controller[_0xf851('0xe')]);router[_0xf851('0xa')]('/campaign/countAttributes/:id',auth[_0xf851('0x8')](),controller[_0xf851('0xf')]);router[_0xf851('0x10')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xf851('0x10')](_0xf851('0x11'),auth[_0xf851('0x8')](),controller[_0xf851('0x12')]);router[_0xf851('0x10')](_0xf851('0x13'),auth[_0xf851('0x8')](),controller[_0xf851('0x14')]);router[_0xf851('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf851('0x16')]);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 80615ca..ecc39c1 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 _0xdd30=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0xcbdb1d,_0x3f9a8d){var _0x1f602a=function(_0x3330e2){while(--_0x3330e2){_0xcbdb1d['push'](_0xcbdb1d['shift']());}};_0x1f602a(++_0x3f9a8d);}(_0xdd30,0xec));var _0x0dd3=function(_0x251de5,_0x42556f){_0x251de5=_0x251de5-0x0;var _0x14a647=_0xdd30[_0x251de5];return _0x14a647;};'use strict';var Sequelize=require(_0x0dd3('0x0'));module[_0x0dd3('0x1')]={'state':{'type':Sequelize[_0x0dd3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0dd3('0x3')]},'scheduledat':{'type':Sequelize[_0x0dd3('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x0dd3('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0dd3('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0dd3('0x3')]},'starttime':{'type':Sequelize[_0x0dd3('0x4')]},'responsetime':{'type':Sequelize[_0x0dd3('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0dd3('0x4')]},'endtime':{'type':Sequelize[_0x0dd3('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0dd3('0x3')]},'campaign':{'type':Sequelize[_0x0dd3('0x3')]},'campaigntype':{'type':Sequelize[_0x0dd3('0x3')]},'membername':{'type':Sequelize[_0x0dd3('0x3')]},'reason':{'type':Sequelize[_0x0dd3('0x3')]},'amd':{'type':Sequelize[_0x0dd3('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x0dd3('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0dd3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0dd3('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0dd3('0x4')]},'edited':{'type':Sequelize[_0x0dd3('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0dd3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb55=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x2f7420,_0x38d966){var _0x552391=function(_0x545247){while(--_0x545247){_0x2f7420['push'](_0x2f7420['shift']());}};_0x552391(++_0x38d966);}(_0xcb55,0x185));var _0x5cb5=function(_0x9b2f3a,_0x59d180){_0x9b2f3a=_0x9b2f3a-0x0;var _0x3a555f=_0xcb55[_0x9b2f3a];return _0x3a555f;};'use strict';var Sequelize=require(_0x5cb5('0x0'));module[_0x5cb5('0x1')]={'state':{'type':Sequelize[_0x5cb5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5cb5('0x3')]},'scheduledat':{'type':Sequelize[_0x5cb5('0x4')]},'countbusyretry':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5cb5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5cb5('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5cb5('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5cb5('0x4')]},'droptime':{'type':Sequelize[_0x5cb5('0x4')]},'endtime':{'type':Sequelize[_0x5cb5('0x4')]},'ringtime':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x5cb5('0x3')]},'campaigntype':{'type':Sequelize[_0x5cb5('0x3')]},'membername':{'type':Sequelize[_0x5cb5('0x3')]},'reason':{'type':Sequelize[_0x5cb5('0x3')]},'amd':{'type':Sequelize[_0x5cb5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5cb5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5cb5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5cb5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5cb5('0x4')]},'recallme':{'type':Sequelize[_0x5cb5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5cb5('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5cb5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c714574..f1510d4 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 _0xe30d=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','status','end','sendStatus','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2277c9,_0x543db7){var _0x101f35=function(_0xddcd38){while(--_0xddcd38){_0x2277c9['push'](_0x2277c9['shift']());}};_0x101f35(++_0x543db7);}(_0xe30d,0x122));var _0xde30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe30d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xde30('0x0'));var rimraf=require(_0xde30('0x1'));var zipdir=require(_0xde30('0x2'));var jsonpatch=require(_0xde30('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde30('0x4'));var Mustache=require(_0xde30('0x5'));var util=require(_0xde30('0x6'));var path=require(_0xde30('0x7'));var sox=require(_0xde30('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde30('0x9'));var squel=require(_0xde30('0xa'));var crypto=require(_0xde30('0xb'));var jsforce=require(_0xde30('0xc'));var deskjs=require(_0xde30('0xd'));var toCsv=require(_0xde30('0xe'));var querystring=require(_0xde30('0xf'));var Papa=require(_0xde30('0x10'));var Redis=require(_0xde30('0x11'));var authService=require(_0xde30('0x12'));var qs=require(_0xde30('0x13'));var as=require(_0xde30('0x14'));var hardwareService=require(_0xde30('0x15'));var logger=require(_0xde30('0x16'))(_0xde30('0x17'));var utils=require(_0xde30('0x18'));var config=require(_0xde30('0x19'));var licenseUtil=require(_0xde30('0x1a'));var db=require(_0xde30('0x1b'))['db'];function respondWithStatusCode(_0x26784c,_0x1b32b1){_0x1b32b1=_0x1b32b1||0xcc;return function(_0x4d1055){if(_0x4d1055){return _0x26784c['sendStatus'](_0x1b32b1);}return _0x26784c['status'](_0x1b32b1)['end']();};}function respondWithResult(_0x32ca65,_0x2fbac5){_0x2fbac5=_0x2fbac5||0xc8;return function(_0x3aa3bc){if(_0x3aa3bc){return _0x32ca65['status'](_0x2fbac5)[_0xde30('0x1c')](_0x3aa3bc);}};}function respondWithFilteredResult(_0x5f08d3,_0x294562){return function(_0x346f16){if(_0x346f16){var _0x540d77=typeof _0x294562[_0xde30('0x1d')]===_0xde30('0x1e')&&typeof _0x294562[_0xde30('0x1f')]===_0xde30('0x1e');var _0x5685cf=_0x346f16[_0xde30('0x20')];var _0x364f12=_0x540d77?0x0:_0x294562[_0xde30('0x1d')];var _0x101aa5=_0x540d77?_0x346f16['count']:_0x294562[_0xde30('0x1d')]+_0x294562[_0xde30('0x1f')];var _0x36a485;if(_0x101aa5>=_0x5685cf){_0x101aa5=_0x5685cf;_0x36a485=0xc8;}else{_0x36a485=0xce;}_0x5f08d3['status'](_0x36a485);return _0x5f08d3[_0xde30('0x21')](_0xde30('0x22'),_0x364f12+'-'+_0x101aa5+'/'+_0x5685cf)[_0xde30('0x1c')](_0x346f16);}return null;};}function patchUpdates(_0x55bf8f){return function(_0x93e69a){try{jsonpatch['apply'](_0x93e69a,_0x55bf8f,!![]);}catch(_0x47fb8b){return BPromise['reject'](_0x47fb8b);}return _0x93e69a[_0xde30('0x23')]();};}function saveUpdates(_0x4fee51,_0x3179eb){return function(_0x277f4d){if(_0x277f4d){return _0x277f4d['update'](_0x4fee51)[_0xde30('0x24')](function(_0x5456a0){return _0x5456a0;});}return null;};}function removeEntity(_0x20e1f9,_0x4d0921){return function(_0x1c6946){if(_0x1c6946){return _0x1c6946[_0xde30('0x25')]()[_0xde30('0x24')](function(){_0x20e1f9[_0xde30('0x26')](0xcc)[_0xde30('0x27')]();});}};}function handleEntityNotFound(_0x311787,_0x445605){return function(_0x44120a){if(!_0x44120a){_0x311787[_0xde30('0x28')](0x194);}return _0x44120a;};}function handleError(_0x592b3c,_0x3bd38a){_0x3bd38a=_0x3bd38a||0x1f4;return function(_0x3da592){logger['error'](_0x3da592[_0xde30('0x29')]);if(_0x3da592[_0xde30('0x2a')]){delete _0x3da592[_0xde30('0x2a')];}_0x592b3c[_0xde30('0x26')](_0x3bd38a)[_0xde30('0x2b')](_0x3da592);};}exports[_0xde30('0x2c')]=function(_0x593d12,_0x920cd9){var _0x389830={},_0x50790f={},_0x5c6768={'count':0x0,'rows':[]};var _0x4ad9b0=_[_0xde30('0x2d')](db[_0xde30('0x2e')][_0xde30('0x2f')],function(_0x5ae39a){return{'name':_0x5ae39a[_0xde30('0x30')],'type':_0x5ae39a[_0xde30('0x31')][_0xde30('0x32')]};});_0x50790f[_0xde30('0x33')]=_[_0xde30('0x2d')](_0x4ad9b0,'name');_0x50790f[_0xde30('0x34')]=_[_0xde30('0x35')](_0x593d12['query']);_0x50790f[_0xde30('0x36')]=_['intersection'](_0x50790f[_0xde30('0x33')],_0x50790f[_0xde30('0x34')]);_0x389830[_0xde30('0x37')]=_[_0xde30('0x38')](_0x50790f['model'],qs[_0xde30('0x39')](_0x593d12[_0xde30('0x34')][_0xde30('0x39')]));_0x389830[_0xde30('0x37')]=_0x389830[_0xde30('0x37')][_0xde30('0x3a')]?_0x389830[_0xde30('0x37')]:_0x50790f[_0xde30('0x33')];if(!_0x593d12[_0xde30('0x34')][_0xde30('0x3b')](_0xde30('0x3c'))){_0x389830[_0xde30('0x1f')]=qs[_0xde30('0x1f')](_0x593d12[_0xde30('0x34')][_0xde30('0x1f')]);_0x389830[_0xde30('0x1d')]=qs[_0xde30('0x1d')](_0x593d12['query'][_0xde30('0x1d')]);}_0x389830[_0xde30('0x3d')]=qs[_0xde30('0x3e')](_0x593d12['query'][_0xde30('0x3e')]);_0x389830[_0xde30('0x3f')]=qs[_0xde30('0x36')](_[_0xde30('0x40')](_0x593d12[_0xde30('0x34')],_0x50790f[_0xde30('0x36')]),_0x4ad9b0);if(_0x593d12[_0xde30('0x34')]['filter']){_0x389830[_0xde30('0x3f')]=_[_0xde30('0x41')](_0x389830[_0xde30('0x3f')],{'$or':_[_0xde30('0x2d')](_0x4ad9b0,function(_0x2f1904){if(_0x2f1904[_0xde30('0x31')]!==_0xde30('0x42')){var _0x1e001a={};_0x1e001a[_0x2f1904[_0xde30('0x2a')]]={'$like':'%'+_0x593d12[_0xde30('0x34')]['filter']+'%'};return _0x1e001a;}})});}_0x389830=_[_0xde30('0x41')]({},_0x389830,_0x593d12['options']);var _0x4fd7d6={'where':_0x389830['where']};return db[_0xde30('0x2e')][_0xde30('0x20')](_0x4fd7d6)['then'](function(_0x2e5000){_0x5c6768[_0xde30('0x20')]=_0x2e5000;if(_0x593d12[_0xde30('0x34')][_0xde30('0x43')]){_0x389830[_0xde30('0x44')]=[{'all':!![]}];}return db[_0xde30('0x2e')][_0xde30('0x45')](_0x389830);})['then'](function(_0x2d4b6d){_0x5c6768[_0xde30('0x46')]=_0x2d4b6d;return _0x5c6768;})['then'](respondWithFilteredResult(_0x920cd9,_0x389830))[_0xde30('0x47')](handleError(_0x920cd9,null));};exports[_0xde30('0x48')]=function(_0x1647dc,_0x233da5){var _0x3ba20a={'raw':!![],'where':{'id':_0x1647dc['params']['id']}},_0x43335f={};_0x43335f[_0xde30('0x33')]=_['keys'](db[_0xde30('0x2e')][_0xde30('0x2f')]);_0x43335f[_0xde30('0x34')]=_[_0xde30('0x35')](_0x1647dc['query']);_0x43335f[_0xde30('0x36')]=_[_0xde30('0x38')](_0x43335f['model'],_0x43335f[_0xde30('0x34')]);_0x3ba20a[_0xde30('0x37')]=_['intersection'](_0x43335f['model'],qs[_0xde30('0x39')](_0x1647dc[_0xde30('0x34')][_0xde30('0x39')]));_0x3ba20a[_0xde30('0x37')]=_0x3ba20a[_0xde30('0x37')]['length']?_0x3ba20a[_0xde30('0x37')]:_0x43335f[_0xde30('0x33')];if(_0x1647dc['query'][_0xde30('0x43')]){_0x3ba20a[_0xde30('0x44')]=[{'all':!![]}];}_0x3ba20a=_['merge']({},_0x3ba20a,_0x1647dc['options']);return db[_0xde30('0x2e')][_0xde30('0x49')](_0x3ba20a)['then'](handleEntityNotFound(_0x233da5,null))[_0xde30('0x24')](respondWithResult(_0x233da5,null))[_0xde30('0x47')](handleError(_0x233da5,null));};exports[_0xde30('0x4a')]=function(_0x225786,_0x1f54d8){return db['CmHopperHistory'][_0xde30('0x4a')](_0x225786['body'],{})[_0xde30('0x24')](respondWithResult(_0x1f54d8,0xc9))[_0xde30('0x47')](handleError(_0x1f54d8,null));};exports['describe']=function(_0xfc9c6,_0x277ea9){return db[_0xde30('0x2e')][_0xde30('0x4b')]()[_0xde30('0x24')](respondWithResult(_0x277ea9,null))[_0xde30('0x47')](handleError(_0x277ea9,null));};exports['update']=function(_0x4beb1c,_0x40318f){if(_0x4beb1c[_0xde30('0x4c')][_0xde30('0x4d')]){delete _0x4beb1c[_0xde30('0x4c')][_0xde30('0x4d')];}return db[_0xde30('0x2e')][_0xde30('0x49')]({'where':{'uniqueid':_0x4beb1c['params']['id']}})[_0xde30('0x24')](handleEntityNotFound(_0x40318f,null))[_0xde30('0x24')](saveUpdates(_0x4beb1c['body'],null))['then'](respondWithResult(_0x40318f,null))['catch'](handleError(_0x40318f,null));}; \ No newline at end of file +var _0xca51=['rows','catch','params','length','includeAll','include','create','body','describe','uniqueid','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','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','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmHopperHistory','findAll'];(function(_0x22889a,_0x4b75f7){var _0x763d34=function(_0x2040e5){while(--_0x2040e5){_0x22889a['push'](_0x22889a['shift']());}};_0x763d34(++_0x4b75f7);}(_0xca51,0x187));var _0x1ca5=function(_0x290978,_0x142464){_0x290978=_0x290978-0x0;var _0x42dc65=_0xca51[_0x290978];return _0x42dc65;};'use strict';var emlformat=require(_0x1ca5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ca5('0x1'));var jsonpatch=require(_0x1ca5('0x2'));var rp=require(_0x1ca5('0x3'));var moment=require(_0x1ca5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ca5('0x5'));var util=require(_0x1ca5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1ca5('0x7'));var ejs=require(_0x1ca5('0x8'));var fs=require('fs');var fs_extra=require(_0x1ca5('0x9'));var _=require(_0x1ca5('0xa'));var squel=require(_0x1ca5('0xb'));var crypto=require(_0x1ca5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1ca5('0x7'));var querystring=require('querystring');var Papa=require(_0x1ca5('0xd'));var Redis=require(_0x1ca5('0xe'));var authService=require(_0x1ca5('0xf'));var qs=require(_0x1ca5('0x10'));var as=require(_0x1ca5('0x11'));var hardwareService=require(_0x1ca5('0x12'));var logger=require(_0x1ca5('0x13'))('api');var utils=require(_0x1ca5('0x14'));var config=require(_0x1ca5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ca5('0x16'))['db'];function respondWithStatusCode(_0x21429e,_0x18ad4c){_0x18ad4c=_0x18ad4c||0xcc;return function(_0x115501){if(_0x115501){return _0x21429e[_0x1ca5('0x17')](_0x18ad4c);}return _0x21429e[_0x1ca5('0x18')](_0x18ad4c)[_0x1ca5('0x19')]();};}function respondWithResult(_0x5b0ec8,_0x5bc984){_0x5bc984=_0x5bc984||0xc8;return function(_0x20637d){if(_0x20637d){return _0x5b0ec8[_0x1ca5('0x18')](_0x5bc984)[_0x1ca5('0x1a')](_0x20637d);}};}function respondWithFilteredResult(_0x358ab8,_0x5491ef){return function(_0x10205d){if(_0x10205d){var _0x1234bf=typeof _0x5491ef[_0x1ca5('0x1b')]===_0x1ca5('0x1c')&&typeof _0x5491ef[_0x1ca5('0x1d')]===_0x1ca5('0x1c');var _0x37a21c=_0x10205d[_0x1ca5('0x1e')];var _0x3a3fcd=_0x1234bf?0x0:_0x5491ef[_0x1ca5('0x1b')];var _0x4fe76a=_0x1234bf?_0x10205d[_0x1ca5('0x1e')]:_0x5491ef[_0x1ca5('0x1b')]+_0x5491ef[_0x1ca5('0x1d')];var _0x18f142;if(_0x4fe76a>=_0x37a21c){_0x4fe76a=_0x37a21c;_0x18f142=0xc8;}else{_0x18f142=0xce;}_0x358ab8[_0x1ca5('0x18')](_0x18f142);return _0x358ab8[_0x1ca5('0x1f')](_0x1ca5('0x20'),_0x3a3fcd+'-'+_0x4fe76a+'/'+_0x37a21c)['json'](_0x10205d);}return null;};}function patchUpdates(_0x59e6c3){return function(_0x5ee582){try{jsonpatch[_0x1ca5('0x21')](_0x5ee582,_0x59e6c3,!![]);}catch(_0x5dbc12){return BPromise['reject'](_0x5dbc12);}return _0x5ee582[_0x1ca5('0x22')]();};}function saveUpdates(_0x4c6456,_0x4f3cc6){return function(_0x5e5136){if(_0x5e5136){return _0x5e5136[_0x1ca5('0x23')](_0x4c6456)[_0x1ca5('0x24')](function(_0x2aecb9){return _0x2aecb9;});}return null;};}function removeEntity(_0x5aec3a,_0x200fa0){return function(_0x19a1f0){if(_0x19a1f0){return _0x19a1f0[_0x1ca5('0x25')]()[_0x1ca5('0x24')](function(){_0x5aec3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31da58,_0x5e5667){return function(_0x3f9f22){if(!_0x3f9f22){_0x31da58[_0x1ca5('0x17')](0x194);}return _0x3f9f22;};}function handleError(_0x297a21,_0x9733cd){_0x9733cd=_0x9733cd||0x1f4;return function(_0x3ab75a){logger[_0x1ca5('0x26')](_0x3ab75a[_0x1ca5('0x27')]);if(_0x3ab75a[_0x1ca5('0x28')]){delete _0x3ab75a[_0x1ca5('0x28')];}_0x297a21[_0x1ca5('0x18')](_0x9733cd)[_0x1ca5('0x29')](_0x3ab75a);};}exports[_0x1ca5('0x2a')]=function(_0x1c3a1f,_0x5104f2){var _0x100847={},_0x3dcab1={},_0x1c52ad={'count':0x0,'rows':[]};var _0x23ebb4=_[_0x1ca5('0x2b')](db['CmHopperHistory'][_0x1ca5('0x2c')],function(_0x416f6d){return{'name':_0x416f6d['fieldName'],'type':_0x416f6d[_0x1ca5('0x2d')][_0x1ca5('0x2e')]};});_0x3dcab1[_0x1ca5('0x2f')]=_[_0x1ca5('0x2b')](_0x23ebb4,'name');_0x3dcab1[_0x1ca5('0x30')]=_[_0x1ca5('0x31')](_0x1c3a1f[_0x1ca5('0x30')]);_0x3dcab1[_0x1ca5('0x32')]=_['intersection'](_0x3dcab1['model'],_0x3dcab1[_0x1ca5('0x30')]);_0x100847[_0x1ca5('0x33')]=_[_0x1ca5('0x34')](_0x3dcab1[_0x1ca5('0x2f')],qs[_0x1ca5('0x35')](_0x1c3a1f['query']['fields']));_0x100847[_0x1ca5('0x33')]=_0x100847['attributes']['length']?_0x100847[_0x1ca5('0x33')]:_0x3dcab1['model'];if(!_0x1c3a1f[_0x1ca5('0x30')][_0x1ca5('0x36')](_0x1ca5('0x37'))){_0x100847[_0x1ca5('0x1d')]=qs['limit'](_0x1c3a1f[_0x1ca5('0x30')][_0x1ca5('0x1d')]);_0x100847['offset']=qs['offset'](_0x1c3a1f[_0x1ca5('0x30')][_0x1ca5('0x1b')]);}_0x100847[_0x1ca5('0x38')]=qs[_0x1ca5('0x39')](_0x1c3a1f['query']['sort']);_0x100847[_0x1ca5('0x3a')]=qs['filters'](_[_0x1ca5('0x3b')](_0x1c3a1f['query'],_0x3dcab1['filters']),_0x23ebb4);if(_0x1c3a1f['query'][_0x1ca5('0x3c')]){_0x100847[_0x1ca5('0x3a')]=_['merge'](_0x100847[_0x1ca5('0x3a')],{'$or':_[_0x1ca5('0x2b')](_0x23ebb4,function(_0x2d3918){if(_0x2d3918[_0x1ca5('0x2d')]!=='VIRTUAL'){var _0x3df02e={};_0x3df02e[_0x2d3918['name']]={'$like':'%'+_0x1c3a1f[_0x1ca5('0x30')][_0x1ca5('0x3c')]+'%'};return _0x3df02e;}})});}_0x100847=_[_0x1ca5('0x3d')]({},_0x100847,_0x1c3a1f[_0x1ca5('0x3e')]);var _0x3ac5bd={'where':_0x100847[_0x1ca5('0x3a')]};return db[_0x1ca5('0x3f')][_0x1ca5('0x1e')](_0x3ac5bd)[_0x1ca5('0x24')](function(_0x383668){_0x1c52ad['count']=_0x383668;if(_0x1c3a1f[_0x1ca5('0x30')]['includeAll']){_0x100847['include']=[{'all':!![]}];}return db[_0x1ca5('0x3f')][_0x1ca5('0x40')](_0x100847);})[_0x1ca5('0x24')](function(_0x2cc83c){_0x1c52ad[_0x1ca5('0x41')]=_0x2cc83c;return _0x1c52ad;})['then'](respondWithFilteredResult(_0x5104f2,_0x100847))[_0x1ca5('0x42')](handleError(_0x5104f2,null));};exports['show']=function(_0x43f4fa,_0x4acfd9){var _0x423267={'raw':!![],'where':{'id':_0x43f4fa[_0x1ca5('0x43')]['id']}},_0x1f2df8={};_0x1f2df8[_0x1ca5('0x2f')]=_[_0x1ca5('0x31')](db['CmHopperHistory'][_0x1ca5('0x2c')]);_0x1f2df8[_0x1ca5('0x30')]=_[_0x1ca5('0x31')](_0x43f4fa['query']);_0x1f2df8[_0x1ca5('0x32')]=_[_0x1ca5('0x34')](_0x1f2df8[_0x1ca5('0x2f')],_0x1f2df8['query']);_0x423267['attributes']=_[_0x1ca5('0x34')](_0x1f2df8[_0x1ca5('0x2f')],qs[_0x1ca5('0x35')](_0x43f4fa[_0x1ca5('0x30')]['fields']));_0x423267[_0x1ca5('0x33')]=_0x423267[_0x1ca5('0x33')][_0x1ca5('0x44')]?_0x423267[_0x1ca5('0x33')]:_0x1f2df8['model'];if(_0x43f4fa[_0x1ca5('0x30')][_0x1ca5('0x45')]){_0x423267[_0x1ca5('0x46')]=[{'all':!![]}];}_0x423267=_['merge']({},_0x423267,_0x43f4fa[_0x1ca5('0x3e')]);return db[_0x1ca5('0x3f')]['find'](_0x423267)[_0x1ca5('0x24')](handleEntityNotFound(_0x4acfd9,null))[_0x1ca5('0x24')](respondWithResult(_0x4acfd9,null))[_0x1ca5('0x42')](handleError(_0x4acfd9,null));};exports[_0x1ca5('0x47')]=function(_0x4e9643,_0x335573){return db[_0x1ca5('0x3f')][_0x1ca5('0x47')](_0x4e9643[_0x1ca5('0x48')],{})['then'](respondWithResult(_0x335573,0xc9))['catch'](handleError(_0x335573,null));};exports['describe']=function(_0x8db3e9,_0x258ba6){return db['CmHopperHistory'][_0x1ca5('0x49')]()[_0x1ca5('0x24')](respondWithResult(_0x258ba6,null))[_0x1ca5('0x42')](handleError(_0x258ba6,null));};exports['update']=function(_0x1e0b37,_0x192fae){if(_0x1e0b37[_0x1ca5('0x48')][_0x1ca5('0x4a')]){delete _0x1e0b37[_0x1ca5('0x48')][_0x1ca5('0x4a')];}return db[_0x1ca5('0x3f')][_0x1ca5('0x4b')]({'where':{'uniqueid':_0x1e0b37[_0x1ca5('0x43')]['id']}})[_0x1ca5('0x24')](handleEntityNotFound(_0x192fae,null))[_0x1ca5('0x24')](saveUpdates(_0x1e0b37[_0x1ca5('0x48')],null))[_0x1ca5('0x24')](respondWithResult(_0x192fae,null))[_0x1ca5('0x42')](handleError(_0x192fae,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 33ed393..e722fec 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 _0x1399=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','endtime','uniqueid'];(function(_0x2f4832,_0x240732){var _0x573447=function(_0x1760bd){while(--_0x1760bd){_0x2f4832['push'](_0x2f4832['shift']());}};_0x573447(++_0x240732);}(_0x1399,0x16c));var _0x9139=function(_0x522302,_0x6cf3d1){_0x522302=_0x522302-0x0;var _0x1248b7=_0x1399[_0x522302];return _0x1248b7;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var logger=require('../../config/logger')(_0x9139('0x2'));var moment=require('moment');var BPromise=require(_0x9139('0x3'));var rp=require(_0x9139('0x4'));var fs=require('fs');var path=require(_0x9139('0x5'));var rimraf=require(_0x9139('0x6'));var config=require(_0x9139('0x7'));var attributes=require(_0x9139('0x8'));module['exports']=function(_0x54af2d,_0x8f086b){return _0x54af2d[_0x9139('0x9')](_0x9139('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x9139('0xb'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x9139('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ebd=['rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x46cd34,_0x104b47){var _0x5bf2d4=function(_0x4d7b52){while(--_0x4d7b52){_0x46cd34['push'](_0x46cd34['shift']());}};_0x5bf2d4(++_0x104b47);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0x2ebd[_0x29975a];return _0x41bcac;};'use strict';var _=require(_0xd2eb('0x0'));var util=require(_0xd2eb('0x1'));var logger=require(_0xd2eb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd2eb('0x3'));var rp=require(_0xd2eb('0x4'));var fs=require('fs');var path=require(_0xd2eb('0x5'));var rimraf=require(_0xd2eb('0x6'));var config=require(_0xd2eb('0x7'));var attributes=require(_0xd2eb('0x8'));module['exports']=function(_0x553617,_0x2c08e5){return _0x553617[_0xd2eb('0x9')](_0xd2eb('0xa'),attributes,{'tableName':_0xd2eb('0xb'),'paranoid':![],'indexes':[{'name':_0xd2eb('0xc'),'fields':['endtime']},{'name':_0xd2eb('0xd'),'fields':[_0xd2eb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index cce7065..e402851 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 _0x9086=['stringify','catch','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateCmHopperHistory','CmHopperHistory','create','options','then'];(function(_0x1ee70f,_0xf7286c){var _0x3b442b=function(_0x3ee49c){while(--_0x3ee49c){_0x1ee70f['push'](_0x1ee70f['shift']());}};_0x3b442b(++_0xf7286c);}(_0x9086,0x10b));var _0x6908=function(_0x4f959b,_0x2c0712){_0x4f959b=_0x4f959b-0x0;var _0x263ddb=_0x9086[_0x4f959b];return _0x263ddb;};'use strict';var _=require(_0x6908('0x0'));var util=require(_0x6908('0x1'));var moment=require('moment');var BPromise=require(_0x6908('0x2'));var rs=require(_0x6908('0x3'));var fs=require('fs');var Redis=require(_0x6908('0x4'));var db=require(_0x6908('0x5'))['db'];var utils=require(_0x6908('0x6'));var logger=require(_0x6908('0x7'))('rpc');var config=require(_0x6908('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6908('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8ff0,_0xd81571,_0x2049a1){return new BPromise(function(_0x2ce577,_0x56df93){return client[_0x6908('0xa')](_0x4e8ff0,_0x2049a1)['then'](function(_0x1efa71){logger['info'](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));logger[_0x6908('0xd')](_0x6908('0xe'),_0xd81571,_0x6908('0xc'),JSON['stringify'](_0x1efa71));if(_0x1efa71[_0x6908('0xf')]){if(_0x1efa71[_0x6908('0xf')][_0x6908('0x10')]===0x1f4){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);return _0x56df93(_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);}logger['error'](_0x6908('0xb'),_0xd81571,_0x1efa71['error'][_0x6908('0x11')]);return _0x2ce577(_0x1efa71[_0x6908('0xf')]['message']);}else{logger[_0x6908('0x12')](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));_0x2ce577(_0x1efa71[_0x6908('0x13')][_0x6908('0x11')]);}})['catch'](function(_0x538ad1){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x538ad1);_0x56df93(_0x538ad1);});});}exports[_0x6908('0x14')]=function(_0x4e8ea3){var _0x3418ee=this;return new Promise(function(_0x5e8253,_0x3b175d){return db[_0x6908('0x15')][_0x6908('0x16')](_0x4e8ea3['body'],{'raw':_0x4e8ea3[_0x6908('0x17')]?_0x4e8ea3[_0x6908('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x6908('0x18')](function(_0x458be9){logger[_0x6908('0x12')](_0x6908('0x14'),_0x4e8ea3);logger[_0x6908('0xd')](_0x6908('0x14'),_0x4e8ea3,JSON[_0x6908('0x19')](_0x458be9));_0x5e8253(_0x458be9);})[_0x6908('0x1a')](function(_0x10fd5a){logger[_0x6908('0xf')](_0x6908('0x14'),_0x10fd5a[_0x6908('0x11')],_0x4e8ea3);_0x3b175d(_0x3418ee[_0x6908('0xf')](0x1f4,_0x10fd5a[_0x6908('0x11')]));});});};exports[_0x6908('0x1b')]=function(_0x2eb759){var _0x142306=this;return new Promise(function(_0x276f09,_0x367979){return db['CmHopperHistory'][_0x6908('0x1c')]({'raw':_0x2eb759[_0x6908('0x17')]?_0x2eb759['options'][_0x6908('0x1d')]===undefined?!![]:![]:!![],'where':_0x2eb759['options']?_0x2eb759['options'][_0x6908('0x1e')]||null:null,'attributes':[[db[_0x6908('0x1f')]['fn'](_0x6908('0x20'),db[_0x6908('0x1f')][_0x6908('0x21')]('id')),_0x6908('0x22')],[db[_0x6908('0x1f')]['fn'](_0x6908('0x20'),db[_0x6908('0x1f')]['fn']('IF',db['sequelize'][_0x6908('0x23')](_0x6908('0x24')))),_0x6908('0x25')],[db[_0x6908('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x26')))),_0x6908('0x27')],[db[_0x6908('0x1f')]['fn'](_0x6908('0x20'),db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x28')))),_0x6908('0x29')],[db[_0x6908('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x2a')))),_0x6908('0x2b')],[db[_0x6908('0x1f')]['fn']('AVG',db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x6908('0x2c')]]})[_0x6908('0x18')](function(_0x52aee1){logger[_0x6908('0x12')]('AvgHandleTime',_0x2eb759);logger[_0x6908('0xd')]('AvgHandleTime',_0x2eb759,JSON[_0x6908('0x19')](_0x52aee1));_0x276f09(_0x52aee1);})['catch'](function(_0x28cb93){logger[_0x6908('0xf')](_0x6908('0x1b'),_0x28cb93[_0x6908('0x11')],_0x2eb759);_0x367979(_0x142306[_0x6908('0xf')](0x1f4,_0x28cb93[_0x6908('0x11')]));});});};exports[_0x6908('0x2d')]=function(_0x1def4d){var _0x305b9d=this;return new Promise(function(_0x102e0d,_0x553426){return db[_0x6908('0x15')][_0x6908('0x1c')]({'raw':_0x1def4d[_0x6908('0x17')]?_0x1def4d[_0x6908('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1def4d['options']?_0x1def4d[_0x6908('0x17')][_0x6908('0x1e')]||null:null,'attributes':[[_0x6908('0x2e'),_0x6908('0x2f')],[db['sequelize']['fn'](_0x6908('0x20'),db['sequelize']['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x30')))),_0x6908('0x31')],[db[_0x6908('0x1f')]['fn']('COUNT',db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x32')))),_0x6908('0x33')],[db[_0x6908('0x1f')]['fn']('COUNT',db[_0x6908('0x1f')]['fn']('IF',db['sequelize'][_0x6908('0x23')](_0x6908('0x24')))),_0x6908('0x34')],[db[_0x6908('0x1f')]['fn'](_0x6908('0x20'),db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x35')))),_0x6908('0x36')],[db[_0x6908('0x1f')]['fn'](_0x6908('0x20'),db['sequelize']['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0x6908('0x20'),db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x37')))),_0x6908('0x38')],[db[_0x6908('0x1f')]['fn'](_0x6908('0x20'),db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6908('0x39')],[db[_0x6908('0x1f')]['fn']('COUNT',db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x3a')))),_0x6908('0x3b')],[db[_0x6908('0x1f')]['fn'](_0x6908('0x20'),db[_0x6908('0x1f')]['fn']('IF',db['sequelize'][_0x6908('0x23')](_0x6908('0x3c')))),_0x6908('0x3d')],[db['sequelize']['fn'](_0x6908('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x6908('0x3e')))),_0x6908('0x3f')],[db[_0x6908('0x1f')]['fn']('COUNT',db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x40')))),_0x6908('0x41')],[db[_0x6908('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x42')))),_0x6908('0x43')],[db[_0x6908('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')]('`state`\x20=\x2020,\x201,\x20null'))),_0x6908('0x41')],[db['sequelize']['fn'](_0x6908('0x20'),db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')]['literal'](_0x6908('0x44')))),_0x6908('0x45')]],'group':[_0x6908('0x2e')]})[_0x6908('0x18')](function(_0x32debc){logger['info'](_0x6908('0x2d'),_0x1def4d);logger[_0x6908('0xd')](_0x6908('0x2d'),_0x1def4d,JSON[_0x6908('0x19')](_0x32debc));_0x102e0d(_0x32debc);})[_0x6908('0x1a')](function(_0x10e1e3){logger['error'](_0x6908('0x2d'),_0x10e1e3[_0x6908('0x11')],_0x1def4d);_0x553426(_0x305b9d[_0x6908('0xf')](0x1f4,_0x10e1e3[_0x6908('0x11')]));});});};exports[_0x6908('0x46')]=function(_0x46848e){var _0xcf8ae4=this;return new Promise(function(_0x5994bf,_0x548bf0){return db[_0x6908('0x15')]['findAll']({'raw':_0x46848e[_0x6908('0x17')]?_0x46848e['options'][_0x6908('0x1d')]===undefined?!![]:![]:!![],'where':_0x46848e['options']?_0x46848e[_0x6908('0x17')]['where']||null:null,'attributes':[[_0x6908('0x2e'),'name'],[db[_0x6908('0x1f')]['fn']('COUNT',db['sequelize'][_0x6908('0x21')]('id')),_0x6908('0x47')],[db[_0x6908('0x1f')]['fn'](_0x6908('0x20'),db[_0x6908('0x1f')]['fn']('IF',db[_0x6908('0x1f')][_0x6908('0x23')](_0x6908('0x24')))),_0x6908('0x48')]],'group':[_0x6908('0x2e')]})[_0x6908('0x18')](function(_0x52c5ec){logger[_0x6908('0x12')](_0x6908('0x46'),_0x46848e);logger[_0x6908('0xd')]('GetCampaignHopperHistory',_0x46848e,JSON[_0x6908('0x19')](_0x52c5ec));_0x5994bf(_0x52c5ec);})[_0x6908('0x1a')](function(_0x437a7b){logger[_0x6908('0xf')](_0x6908('0x46'),_0x437a7b[_0x6908('0x11')],_0x46848e);_0x548bf0(_0xcf8ae4[_0x6908('0xf')](0x1f4,_0x437a7b[_0x6908('0x11')]));});});}; \ No newline at end of file +var _0x7985=['AvgHandleTime','sequelize','COUNT','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','catch','GetVoiceQueueHopperHistory','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`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','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body','options','raw'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7985,0x1de));var _0x5798=function(_0x4dd524,_0x2247e5){_0x4dd524=_0x4dd524-0x0;var _0x482629=_0x7985[_0x4dd524];return _0x482629;};'use strict';var _=require(_0x5798('0x0'));var util=require('util');var moment=require(_0x5798('0x1'));var BPromise=require(_0x5798('0x2'));var rs=require(_0x5798('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5798('0x4'));var logger=require(_0x5798('0x5'))(_0x5798('0x6'));var config=require('../../config/environment');var jayson=require(_0x5798('0x7'));var client=jayson[_0x5798('0x8')][_0x5798('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b18ae,_0xc5e33e,_0x5f2e1f){return new BPromise(function(_0x440294,_0x1b69d9){return client[_0x5798('0xa')](_0x5b18ae,_0x5f2e1f)[_0x5798('0xb')](function(_0x200c58){logger[_0x5798('0xc')](_0x5798('0xd'),_0xc5e33e,_0x5798('0xe'));logger['debug'](_0x5798('0xf'),_0xc5e33e,_0x5798('0xe'),JSON[_0x5798('0x10')](_0x200c58));if(_0x200c58[_0x5798('0x11')]){if(_0x200c58[_0x5798('0x11')][_0x5798('0x12')]===0x1f4){logger[_0x5798('0x11')](_0x5798('0xd'),_0xc5e33e,_0x200c58[_0x5798('0x11')]['message']);return _0x1b69d9(_0x200c58[_0x5798('0x11')]['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xc5e33e,_0x200c58[_0x5798('0x11')][_0x5798('0x13')]);return _0x440294(_0x200c58[_0x5798('0x11')][_0x5798('0x13')]);}else{logger[_0x5798('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0xc5e33e,'request\x20sent');_0x440294(_0x200c58[_0x5798('0x14')]['message']);}})['catch'](function(_0x48c290){logger['error'](_0x5798('0xd'),_0xc5e33e,_0x48c290);_0x1b69d9(_0x48c290);});});}exports[_0x5798('0x15')]=function(_0xb9c076){var _0x272005=this;return new Promise(function(_0x26871f,_0x399bf6){return db[_0x5798('0x16')]['create'](_0xb9c076[_0x5798('0x17')],{'raw':_0xb9c076[_0x5798('0x18')]?_0xb9c076[_0x5798('0x18')][_0x5798('0x19')]===undefined?!![]:![]:!![]})[_0x5798('0xb')](function(_0x4dd1e2){logger[_0x5798('0xc')]('CreateCmHopperHistory',_0xb9c076);logger['debug'](_0x5798('0x15'),_0xb9c076,JSON[_0x5798('0x10')](_0x4dd1e2));_0x26871f(_0x4dd1e2);})['catch'](function(_0x4bd972){logger[_0x5798('0x11')](_0x5798('0x15'),_0x4bd972['message'],_0xb9c076);_0x399bf6(_0x272005['error'](0x1f4,_0x4bd972[_0x5798('0x13')]));});});};exports[_0x5798('0x1a')]=function(_0x5c296f){var _0x13dce5=this;return new Promise(function(_0x1096a0,_0x1867d6){return db[_0x5798('0x16')]['findAll']({'raw':_0x5c296f[_0x5798('0x18')]?_0x5c296f[_0x5798('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5c296f['options']?_0x5c296f[_0x5798('0x18')]['where']||null:null,'attributes':[[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['col']('id')),_0x5798('0x1d')],[db[_0x5798('0x1b')]['fn']('COUNT',db[_0x5798('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x5798('0x1e')))),_0x5798('0x1f')],[db['sequelize']['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0x5798('0x21')],[db['sequelize']['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')](_0x5798('0x22')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x5798('0x1b')]['fn']('AVG',db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')]['literal'](_0x5798('0x23')))),_0x5798('0x24')],[db['sequelize']['fn'](_0x5798('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x5798('0x20')](_0x5798('0x26')))),_0x5798('0x27')]]})['then'](function(_0x5b4379){logger[_0x5798('0xc')]('AvgHandleTime',_0x5c296f);logger[_0x5798('0x28')]('AvgHandleTime',_0x5c296f,JSON['stringify'](_0x5b4379));_0x1096a0(_0x5b4379);})[_0x5798('0x29')](function(_0x5eee64){logger[_0x5798('0x11')]('AvgHandleTime',_0x5eee64[_0x5798('0x13')],_0x5c296f);_0x1867d6(_0x13dce5[_0x5798('0x11')](0x1f4,_0x5eee64[_0x5798('0x13')]));});});};exports[_0x5798('0x2a')]=function(_0x4f5895){var _0x3518fe=this;return new Promise(function(_0x48eae3,_0x534333){return db['CmHopperHistory'][_0x5798('0x2b')]({'raw':_0x4f5895['options']?_0x4f5895[_0x5798('0x18')][_0x5798('0x19')]===undefined?!![]:![]:!![],'where':_0x4f5895[_0x5798('0x18')]?_0x4f5895[_0x5798('0x18')][_0x5798('0x2c')]||null:null,'attributes':[[_0x5798('0x2d'),_0x5798('0x2e')],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db['sequelize']['fn']('IF',db[_0x5798('0x1b')]['literal'](_0x5798('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')]('`state`\x20=\x203,\x201,\x20null'))),_0x5798('0x30')],[db['sequelize']['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')]['literal'](_0x5798('0x1e')))),_0x5798('0x31')],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')]['literal'](_0x5798('0x32')))),_0x5798('0x33')],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')]['literal'](_0x5798('0x34')))),'outboundCongestionCallsDay'],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db['sequelize'][_0x5798('0x20')](_0x5798('0x35')))),_0x5798('0x36')],[db['sequelize']['fn']('COUNT',db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')](_0x5798('0x37')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db['sequelize'][_0x5798('0x20')](_0x5798('0x38')))),_0x5798('0x39')],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')](_0x5798('0x3a')))),_0x5798('0x3b')],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')]['literal'](_0x5798('0x3c')))),_0x5798('0x3d')],[db[_0x5798('0x1b')]['fn']('COUNT',db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')]['literal'](_0x5798('0x3e')))),'outboundRejectCallsDay'],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')](_0x5798('0x3f')))),_0x5798('0x40')],[db['sequelize']['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')](_0x5798('0x41')))),_0x5798('0x42')],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')](_0x5798('0x43')))),_0x5798('0x44')]],'group':['campaign']})[_0x5798('0xb')](function(_0x9dd130){logger[_0x5798('0xc')]('GetVoiceQueueHopperHistory',_0x4f5895);logger[_0x5798('0x28')]('GetVoiceQueueHopperHistory',_0x4f5895,JSON['stringify'](_0x9dd130));_0x48eae3(_0x9dd130);})[_0x5798('0x29')](function(_0x406468){logger[_0x5798('0x11')](_0x5798('0x2a'),_0x406468[_0x5798('0x13')],_0x4f5895);_0x534333(_0x3518fe[_0x5798('0x11')](0x1f4,_0x406468[_0x5798('0x13')]));});});};exports[_0x5798('0x45')]=function(_0x660076){var _0x1da114=this;return new Promise(function(_0x276713,_0x10bdcc){return db[_0x5798('0x16')][_0x5798('0x2b')]({'raw':_0x660076['options']?_0x660076[_0x5798('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x660076[_0x5798('0x18')]?_0x660076['options'][_0x5798('0x2c')]||null:null,'attributes':[[_0x5798('0x2d'),'name'],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')][_0x5798('0x46')]('id')),'ivrTotalCallsDays'],[db[_0x5798('0x1b')]['fn'](_0x5798('0x1c'),db[_0x5798('0x1b')]['fn']('IF',db[_0x5798('0x1b')][_0x5798('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x5798('0x47')]],'group':[_0x5798('0x2d')]})[_0x5798('0xb')](function(_0x49b469){logger[_0x5798('0xc')](_0x5798('0x45'),_0x660076);logger[_0x5798('0x28')]('GetCampaignHopperHistory',_0x660076,JSON[_0x5798('0x10')](_0x49b469));_0x276713(_0x49b469);})[_0x5798('0x29')](function(_0x28ec83){logger['error']('GetCampaignHopperHistory',_0x28ec83[_0x5798('0x13')],_0x660076);_0x10bdcc(_0x1da114[_0x5798('0x11')](0x1f4,_0x28ec83['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 885d74e..733a21a 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 _0xd858=['../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd858,0x1b2));var _0x8d85=function(_0xf89c61,_0x783f7f){_0xf89c61=_0xf89c61-0x0;var _0x9c3817=_0xd858[_0xf89c61];return _0x9c3817;};'use strict';var multer=require('multer');var util=require(_0x8d85('0x0'));var path=require(_0x8d85('0x1'));var timeout=require(_0x8d85('0x2'));var express=require(_0x8d85('0x3'));var router=express[_0x8d85('0x4')]();var fs_extra=require(_0x8d85('0x5'));var auth=require(_0x8d85('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8d85('0x7'));var controller=require(_0x8d85('0x8'));router[_0x8d85('0x9')]('/',auth[_0x8d85('0xa')](),controller[_0x8d85('0xb')]);router['get'](_0x8d85('0xc'),auth[_0x8d85('0xa')](),controller[_0x8d85('0xd')]);router[_0x8d85('0x9')](_0x8d85('0xe'),auth[_0x8d85('0xa')](),controller[_0x8d85('0xf')]);router['post']('/',auth[_0x8d85('0xa')](),controller[_0x8d85('0x10')]);router[_0x8d85('0x11')](_0x8d85('0xe'),auth['isAuthenticated'](),controller[_0x8d85('0x12')]);module[_0x8d85('0x13')]=router; \ No newline at end of file +var _0x1591=['post','put','/:id','exports','path','express','Router','fs-extra','../../components/auth/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','show'];(function(_0x45aac6,_0x13dafe){var _0x535760=function(_0x3dfb4d){while(--_0x3dfb4d){_0x45aac6['push'](_0x45aac6['shift']());}};_0x535760(++_0x13dafe);}(_0x1591,0x1b7));var _0x1159=function(_0x38223f,_0x3a0dfc){_0x38223f=_0x38223f-0x0;var _0x3e3fab=_0x1591[_0x38223f];return _0x3e3fab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1159('0x0'));var timeout=require('connect-timeout');var express=require(_0x1159('0x1'));var router=express[_0x1159('0x2')]();var fs_extra=require(_0x1159('0x3'));var auth=require(_0x1159('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1159('0x5'));router[_0x1159('0x6')]('/',auth[_0x1159('0x7')](),controller[_0x1159('0x8')]);router['get'](_0x1159('0x9'),auth[_0x1159('0x7')](),controller['describe']);router[_0x1159('0x6')]('/:id',auth[_0x1159('0x7')](),controller[_0x1159('0xa')]);router[_0x1159('0xb')]('/',auth[_0x1159('0x7')](),controller['create']);router[_0x1159('0xc')](_0x1159('0xd'),auth[_0x1159('0x7')](),controller['update']);module[_0x1159('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a67b5bf..7af73f2 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 _0xefbf=['STRING','sequelize','exports'];(function(_0x38ef4f,_0x501433){var _0x208c39=function(_0xd2d365){while(--_0xd2d365){_0x38ef4f['push'](_0x38ef4f['shift']());}};_0x208c39(++_0x501433);}(_0xefbf,0xa3));var _0xfefb=function(_0x5de349,_0xe42887){_0x5de349=_0x5de349-0x0;var _0x5982a7=_0xefbf[_0x5de349];return _0x5982a7;};'use strict';var Sequelize=require(_0xfefb('0x0'));module[_0xfefb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xfefb('0x2')]}}; \ No newline at end of file +var _0x9649=['exports','STRING','name','sequelize'];(function(_0x3543e7,_0x501fcf){var _0x42df23=function(_0x467049){while(--_0x467049){_0x3543e7['push'](_0x3543e7['shift']());}};_0x42df23(++_0x501fcf);}(_0x9649,0x19f));var _0x9964=function(_0x46716f,_0x52d842){_0x46716f=_0x46716f-0x0;var _0x5c811e=_0x9649[_0x46716f];return _0x5c811e;};'use strict';var Sequelize=require(_0x9964('0x0'));module[_0x9964('0x1')]={'name':{'type':Sequelize[_0x9964('0x2')],'unique':_0x9964('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x9964('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 39d0b4f..5ce44c7 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 _0xe06b=['BOOLEAN','defaultValue','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','ids','spread','userCmList:save','removeAgents','userCmList:remove','emit','getAgents','User','rimraf','request-promise','moment','bluebird','mustache','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','get','Lists','stack','name','send','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ListId','Disposition','getDispositions','findOne','removeDispositions','addContacts','CmContact','tags','isArray','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','format','cf_%d','raw','getContactsCsv','concat','CustomFields','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','TEXT','text','number','INTEGER','switch','Sequelize'];(function(_0x4ca2a8,_0x1015ab){var _0x4622fd=function(_0x53b979){while(--_0x53b979){_0x4ca2a8['push'](_0x4ca2a8['shift']());}};_0x4622fd(++_0x1015ab);}(_0xe06b,0xa2));var _0xbe06=function(_0x4525b4,_0x50ed20){_0x4525b4=_0x4525b4-0x0;var _0x599373=_0xe06b[_0x4525b4];return _0x599373;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe06('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe06('0x1'));var moment=require(_0xbe06('0x2'));var BPromise=require(_0xbe06('0x3'));var Mustache=require(_0xbe06('0x4'));var util=require('util');var path=require(_0xbe06('0x5'));var sox=require(_0xbe06('0x6'));var csv=require(_0xbe06('0x7'));var ejs=require(_0xbe06('0x8'));var fs=require('fs');var fs_extra=require(_0xbe06('0x9'));var _=require(_0xbe06('0xa'));var squel=require(_0xbe06('0xb'));var crypto=require(_0xbe06('0xc'));var jsforce=require(_0xbe06('0xd'));var deskjs=require(_0xbe06('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbe06('0xf'));var Redis=require('ioredis');var authService=require(_0xbe06('0x10'));var qs=require(_0xbe06('0x11'));var as=require(_0xbe06('0x12'));var hardwareService=require(_0xbe06('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbe06('0x14'));var config=require(_0xbe06('0x15'));var licenseUtil=require(_0xbe06('0x16'));var db=require(_0xbe06('0x17'))['db'];config[_0xbe06('0x18')]=_['defaults'](config[_0xbe06('0x18')],{'host':_0xbe06('0x19'),'port':0x18eb});var socket=require(_0xbe06('0x1a'))(new Redis(config[_0xbe06('0x18')]));require('./cmList.socket')[_0xbe06('0x1b')](socket);function respondWithStatusCode(_0x179541,_0x3bf0e6){_0x3bf0e6=_0x3bf0e6||0xcc;return function(_0x3a4d88){if(_0x3a4d88){return _0x179541[_0xbe06('0x1c')](_0x3bf0e6);}return _0x179541[_0xbe06('0x1d')](_0x3bf0e6)[_0xbe06('0x1e')]();};}function respondWithResult(_0x2631fa,_0x4357fb){_0x4357fb=_0x4357fb||0xc8;return function(_0x5c3b2c){if(_0x5c3b2c){return _0x2631fa[_0xbe06('0x1d')](_0x4357fb)['json'](_0x5c3b2c);}};}function respondWithFilteredResult(_0x3df90a,_0xed8562){return function(_0x24768f){if(_0x24768f){var _0xdaa494=typeof _0xed8562[_0xbe06('0x1f')]==='undefined'&&typeof _0xed8562[_0xbe06('0x20')]===_0xbe06('0x21');var _0x6dde79=_0x24768f[_0xbe06('0x22')];var _0x267cb1=_0xdaa494?0x0:_0xed8562[_0xbe06('0x1f')];var _0x11b80d=_0xdaa494?_0x24768f['count']:_0xed8562['offset']+_0xed8562[_0xbe06('0x20')];var _0x597363;if(_0x11b80d>=_0x6dde79){_0x11b80d=_0x6dde79;_0x597363=0xc8;}else{_0x597363=0xce;}_0x3df90a[_0xbe06('0x1d')](_0x597363);return _0x3df90a[_0xbe06('0x23')](_0xbe06('0x24'),_0x267cb1+'-'+_0x11b80d+'/'+_0x6dde79)[_0xbe06('0x25')](_0x24768f);}return null;};}function patchUpdates(_0x28f785){return function(_0x1b3e0a){try{jsonpatch[_0xbe06('0x26')](_0x1b3e0a,_0x28f785,!![]);}catch(_0x2db942){return BPromise['reject'](_0x2db942);}return _0x1b3e0a[_0xbe06('0x27')]();};}function saveUpdates(_0x573b41,_0x5d5ca0){return function(_0x2ec4bc){if(_0x2ec4bc){return _0x2ec4bc['update'](_0x573b41)[_0xbe06('0x28')](function(_0x581657){return _0x581657;});}return null;};}function removeEntity(_0x1cabfc,_0x360f6b){return function(_0x55631f){if(_0x55631f){return _0x55631f[_0xbe06('0x29')]()['then'](function(){var _0x2e4bb0=_0x55631f[_0xbe06('0x2a')]({'plain':!![]});var _0x12cf62=_0xbe06('0x2b');return db['UserProfileResource'][_0xbe06('0x29')]({'where':{'type':_0x12cf62,'resourceId':_0x2e4bb0['id']}})['then'](function(){return _0x55631f;});})[_0xbe06('0x28')](function(){_0x1cabfc[_0xbe06('0x1d')](0xcc)[_0xbe06('0x1e')]();});}};}function handleEntityNotFound(_0x30f294,_0x4ea757){return function(_0x5bf4fa){if(!_0x5bf4fa){_0x30f294[_0xbe06('0x1c')](0x194);}return _0x5bf4fa;};}function handleError(_0x4ff258,_0x80f1ce){_0x80f1ce=_0x80f1ce||0x1f4;return function(_0x302758){logger['error'](_0x302758[_0xbe06('0x2c')]);if(_0x302758[_0xbe06('0x2d')]){delete _0x302758[_0xbe06('0x2d')];}_0x4ff258[_0xbe06('0x1d')](_0x80f1ce)[_0xbe06('0x2e')](_0x302758);};}exports['index']=function(_0x101f7d,_0xdd4f3a){var _0x11b76e={},_0x3adeee={},_0x111411={'count':0x0,'rows':[]};var _0x738d36=_[_0xbe06('0x2f')](db[_0xbe06('0x30')][_0xbe06('0x31')],function(_0x3babba){return{'name':_0x3babba[_0xbe06('0x32')],'type':_0x3babba[_0xbe06('0x33')][_0xbe06('0x34')]};});_0x3adeee[_0xbe06('0x35')]=_[_0xbe06('0x2f')](_0x738d36,_0xbe06('0x2d'));_0x3adeee[_0xbe06('0x36')]=_[_0xbe06('0x37')](_0x101f7d[_0xbe06('0x36')]);_0x3adeee['filters']=_['intersection'](_0x3adeee[_0xbe06('0x35')],_0x3adeee[_0xbe06('0x36')]);_0x11b76e[_0xbe06('0x38')]=_[_0xbe06('0x39')](_0x3adeee[_0xbe06('0x35')],qs[_0xbe06('0x3a')](_0x101f7d[_0xbe06('0x36')][_0xbe06('0x3a')]));_0x11b76e[_0xbe06('0x38')]=_0x11b76e[_0xbe06('0x38')][_0xbe06('0x3b')]?_0x11b76e[_0xbe06('0x38')]:_0x3adeee[_0xbe06('0x35')];if(!_0x101f7d[_0xbe06('0x36')][_0xbe06('0x3c')](_0xbe06('0x3d'))){_0x11b76e[_0xbe06('0x20')]=qs[_0xbe06('0x20')](_0x101f7d[_0xbe06('0x36')][_0xbe06('0x20')]);_0x11b76e[_0xbe06('0x1f')]=qs[_0xbe06('0x1f')](_0x101f7d[_0xbe06('0x36')][_0xbe06('0x1f')]);}_0x11b76e[_0xbe06('0x3e')]=qs[_0xbe06('0x3f')](_0x101f7d[_0xbe06('0x36')][_0xbe06('0x3f')]);_0x11b76e[_0xbe06('0x40')]=qs[_0xbe06('0x41')](_[_0xbe06('0x42')](_0x101f7d[_0xbe06('0x36')],_0x3adeee[_0xbe06('0x41')]),_0x738d36);if(_0x101f7d[_0xbe06('0x36')][_0xbe06('0x43')]){_0x11b76e['where']=_[_0xbe06('0x44')](_0x11b76e['where'],{'$or':_[_0xbe06('0x2f')](_0x738d36,function(_0x4623b5){if(_0x4623b5[_0xbe06('0x33')]!==_0xbe06('0x45')){var _0x2419c1={};_0x2419c1[_0x4623b5[_0xbe06('0x2d')]]={'$like':'%'+_0x101f7d[_0xbe06('0x36')][_0xbe06('0x43')]+'%'};return _0x2419c1;}})});}_0x11b76e=_['merge']({},_0x11b76e,_0x101f7d[_0xbe06('0x46')]);var _0x3881a6={'where':_0x11b76e[_0xbe06('0x40')]};return db[_0xbe06('0x30')][_0xbe06('0x22')](_0x3881a6)['then'](function(_0xb82360){_0x111411['count']=_0xb82360;if(_0x101f7d[_0xbe06('0x36')][_0xbe06('0x47')]){_0x11b76e[_0xbe06('0x48')]=[{'all':!![]}];}return db[_0xbe06('0x30')][_0xbe06('0x49')](_0x11b76e);})['then'](function(_0x307f6d){_0x111411[_0xbe06('0x4a')]=_0x307f6d;return _0x111411;})[_0xbe06('0x28')](respondWithFilteredResult(_0xdd4f3a,_0x11b76e))[_0xbe06('0x4b')](handleError(_0xdd4f3a,null));};exports['show']=function(_0x1a865b,_0x3678c1){var _0x33ab69={'raw':![],'where':{'id':_0x1a865b['params']['id']}},_0xf53004={};_0xf53004[_0xbe06('0x35')]=_[_0xbe06('0x37')](db[_0xbe06('0x30')][_0xbe06('0x31')]);_0xf53004['query']=_[_0xbe06('0x37')](_0x1a865b[_0xbe06('0x36')]);_0xf53004[_0xbe06('0x41')]=_[_0xbe06('0x39')](_0xf53004[_0xbe06('0x35')],_0xf53004[_0xbe06('0x36')]);_0x33ab69[_0xbe06('0x38')]=_[_0xbe06('0x39')](_0xf53004[_0xbe06('0x35')],qs[_0xbe06('0x3a')](_0x1a865b['query'][_0xbe06('0x3a')]));_0x33ab69[_0xbe06('0x38')]=_0x33ab69[_0xbe06('0x38')][_0xbe06('0x3b')]?_0x33ab69[_0xbe06('0x38')]:_0xf53004[_0xbe06('0x35')];if(_0x1a865b[_0xbe06('0x36')][_0xbe06('0x47')]){_0x33ab69['include']=[{'all':!![]}];}_0x33ab69=_[_0xbe06('0x44')]({},_0x33ab69,_0x1a865b[_0xbe06('0x46')]);return db[_0xbe06('0x30')][_0xbe06('0x4c')](_0x33ab69)['then'](handleEntityNotFound(_0x3678c1,null))['then'](respondWithResult(_0x3678c1,null))[_0xbe06('0x4b')](handleError(_0x3678c1,null));};exports['create']=function(_0x5bcc92,_0x53bb9d){return db[_0xbe06('0x30')][_0xbe06('0x4d')](_0x5bcc92[_0xbe06('0x4e')],{})[_0xbe06('0x28')](function(_0x106f84){var _0x495311=_0x5bcc92[_0xbe06('0x4f')][_0xbe06('0x2a')]({'plain':!![]});if(!_0x495311)throw new Error(_0xbe06('0x50'));if(_0x495311[_0xbe06('0x51')]===_0xbe06('0x4f')){var _0x53e3db=_0x106f84['get']({'plain':!![]});var _0x1326a1=_0xbe06('0x2b');return db[_0xbe06('0x52')]['find']({'where':{'name':_0x1326a1,'userProfileId':_0x495311[_0xbe06('0x53')]},'raw':!![]})[_0xbe06('0x28')](function(_0x21e129){if(_0x21e129&&_0x21e129['autoAssociation']===0x0){return db[_0xbe06('0x54')][_0xbe06('0x4d')]({'name':_0x53e3db[_0xbe06('0x2d')],'resourceId':_0x53e3db['id'],'type':_0x21e129[_0xbe06('0x2d')],'sectionId':_0x21e129['id']},{})['then'](function(){return _0x106f84;});}else{return _0x106f84;}})['catch'](function(_0x305ead){logger[_0xbe06('0x55')](_0xbe06('0x56'),_0x305ead);throw _0x305ead;});}return _0x106f84;})[_0xbe06('0x28')](respondWithResult(_0x53bb9d,0xc9))[_0xbe06('0x4b')](handleError(_0x53bb9d,null));};exports[_0xbe06('0x57')]=function(_0x17ddcf,_0x5d0a39){if(_0x17ddcf['body']['id']){delete _0x17ddcf[_0xbe06('0x4e')]['id'];}return db[_0xbe06('0x30')]['find']({'where':{'id':_0x17ddcf['params']['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x5d0a39,null))['then'](saveUpdates(_0x17ddcf['body'],null))[_0xbe06('0x28')](respondWithResult(_0x5d0a39,null))[_0xbe06('0x4b')](handleError(_0x5d0a39,null));};exports['destroy']=function(_0x1ddf67,_0x4dc6ef){return db[_0xbe06('0x30')][_0xbe06('0x4c')]({'where':{'id':_0x1ddf67[_0xbe06('0x58')]['id']}})['then'](handleEntityNotFound(_0x4dc6ef,null))['then'](removeEntity(_0x4dc6ef,null))[_0xbe06('0x4b')](handleError(_0x4dc6ef,null));};exports[_0xbe06('0x59')]=function(_0xcf736c,_0x29238e){return db[_0xbe06('0x30')]['describe']()[_0xbe06('0x28')](respondWithResult(_0x29238e,null))[_0xbe06('0x4b')](handleError(_0x29238e,null));};exports['addDisposition']=function(_0x35034f,_0x53c29f,_0x447f30){if(_0x35034f[_0xbe06('0x4e')]['id']){delete _0x35034f[_0xbe06('0x4e')]['id'];}return db[_0xbe06('0x30')][_0xbe06('0x4c')]({'where':{'id':_0x35034f[_0xbe06('0x58')]['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x53c29f,null))['then'](function(_0x3a3e4d){if(_0x3a3e4d){_0x35034f['body'][_0xbe06('0x5a')]=_0x3a3e4d['id'];return db[_0xbe06('0x5b')][_0xbe06('0x4d')](_0x35034f[_0xbe06('0x4e')]);}})['then'](respondWithResult(_0x53c29f,null))[_0xbe06('0x4b')](handleError(_0x53c29f,null));};exports[_0xbe06('0x5c')]=function(_0x2857ab,_0x120e96,_0x1ead6c){var _0x303c1f={'raw':![],'where':{}};var _0x2be83e={};var _0x2be549={'count':0x0,'rows':[]};return db[_0xbe06('0x30')][_0xbe06('0x5d')]({'where':{'id':_0x2857ab['params']['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x120e96,null))[_0xbe06('0x28')](function(_0xa8bbe){if(_0xa8bbe){_0x2be83e[_0xbe06('0x35')]=_[_0xbe06('0x37')](db['Disposition'][_0xbe06('0x31')]);_0x2be83e[_0xbe06('0x36')]=_[_0xbe06('0x37')](_0x2857ab[_0xbe06('0x36')]);_0x2be83e[_0xbe06('0x41')]=_[_0xbe06('0x39')](_0x2be83e[_0xbe06('0x35')],_0x2be83e['query']);_0x303c1f[_0xbe06('0x38')]=_[_0xbe06('0x39')](_0x2be83e[_0xbe06('0x35')],qs[_0xbe06('0x3a')](_0x2857ab[_0xbe06('0x36')][_0xbe06('0x3a')]));_0x303c1f[_0xbe06('0x38')]=_0x303c1f[_0xbe06('0x38')]['length']?_0x303c1f[_0xbe06('0x38')]:_0x2be83e[_0xbe06('0x35')];if(!_0x2857ab[_0xbe06('0x36')][_0xbe06('0x3c')]('nolimit')){_0x303c1f[_0xbe06('0x20')]=qs[_0xbe06('0x20')](_0x2857ab[_0xbe06('0x36')][_0xbe06('0x20')]);_0x303c1f['offset']=qs['offset'](_0x2857ab[_0xbe06('0x36')][_0xbe06('0x1f')]);}_0x303c1f[_0xbe06('0x3e')]=qs['sort'](_0x2857ab['query']['sort']);_0x303c1f['where']=qs['filters'](_['pick'](_0x2857ab['query'],_0x2be83e[_0xbe06('0x41')]));_0x303c1f[_0xbe06('0x40')][_0xbe06('0x5a')]=_0xa8bbe['id'];if(_0x2857ab[_0xbe06('0x36')][_0xbe06('0x43')]){_0x303c1f[_0xbe06('0x40')]=_[_0xbe06('0x44')](_0x303c1f[_0xbe06('0x40')],{'$or':_[_0xbe06('0x2f')](_0x303c1f[_0xbe06('0x38')],function(_0x5c14a4){var _0x2cd4a={};_0x2cd4a[_0x5c14a4]={'$like':'%'+_0x2857ab[_0xbe06('0x36')][_0xbe06('0x43')]+'%'};return _0x2cd4a;})});}_0x303c1f=_['merge']({},_0x303c1f,_0x2857ab[_0xbe06('0x46')]);return db['Disposition']['count']({'where':_0x303c1f['where']})[_0xbe06('0x28')](function(_0x55c921){_0x2be549['count']=_0x55c921;if(_0x2857ab['query'][_0xbe06('0x47')]){_0x303c1f[_0xbe06('0x48')]=[{'all':!![]}];}return db[_0xbe06('0x5b')]['findAll'](_0x303c1f);})['then'](function(_0x328284){_0x2be549['rows']=_0x328284;return _0x2be549;});}})[_0xbe06('0x28')](respondWithFilteredResult(_0x120e96,_0x303c1f))[_0xbe06('0x4b')](handleError(_0x120e96,null));};exports[_0xbe06('0x5e')]=function(_0x5e28d5,_0x49cfa2,_0xe32382){return db[_0xbe06('0x30')][_0xbe06('0x4c')]({'where':{'id':_0x5e28d5[_0xbe06('0x58')]['id']}})['then'](handleEntityNotFound(_0x49cfa2,null))['then'](function(_0x4d1b27){if(_0x4d1b27){return _0x4d1b27[_0xbe06('0x5e')](_0x5e28d5[_0xbe06('0x36')]['ids']);}})[_0xbe06('0x28')](respondWithStatusCode(_0x49cfa2,null))[_0xbe06('0x4b')](handleError(_0x49cfa2,null));};exports[_0xbe06('0x5f')]=function(_0x47d26d,_0x15c01b,_0x45482e){return db['CmList'][_0xbe06('0x4c')]({'where':{'id':_0x47d26d[_0xbe06('0x58')]['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x15c01b,null))[_0xbe06('0x28')](function(_0x33c114){if(_0x33c114){var _0x2e4da5=[];var _0x3fe43a={'success':[],'errors':[]};return db[_0xbe06('0x60')][_0xbe06('0x59')]()['then'](function(_0x5dba47){if(_0x47d26d['body'][_0xbe06('0x61')]&&_[_0xbe06('0x62')](_0x47d26d[_0xbe06('0x4e')][_0xbe06('0x61')])){if(_0x47d26d[_0xbe06('0x4e')][_0xbe06('0x61')]['length']){_0x47d26d[_0xbe06('0x4e')]['tags']=_0x47d26d['body']['tags']['join'](';')+';';}else{_0x47d26d['body']['tags']=null;}}else{_0x47d26d[_0xbe06('0x4e')][_0xbe06('0x61')]=null;}if(_0x47d26d[_0xbe06('0x4e')]&&_[_0xbe06('0x62')](_0x47d26d[_0xbe06('0x4e')])){for(var _0x2a61e8=0x0;_0x2a61e8<_0x47d26d[_0xbe06('0x4e')][_0xbe06('0x3b')];_0x2a61e8+=0x1){_0x47d26d[_0xbe06('0x4e')][_0x2a61e8][_0xbe06('0x5a')]=_0x47d26d[_0xbe06('0x58')]['id'];_0x2e4da5[_0xbe06('0x63')](_0x47d26d['body'][_0x2a61e8]);}return BPromise[_0xbe06('0x64')](_0x2e4da5,function(_0x245fcd){return db['CmContact'][_0xbe06('0x4d')](_[_0xbe06('0x65')](_0x245fcd,['ids','id'])||{},{'fields':_[_0xbe06('0x37')](_0x5dba47),'raw':!![]})['then'](function(_0x75f697){_0x3fe43a['success'][_0xbe06('0x63')](_0x75f697[_0xbe06('0x66')]);})['catch'](function(_0x395783){_0x3fe43a[_0xbe06('0x67')]['push']({'data':_0x245fcd,'error':_0x395783[_0xbe06('0x68')]});});})['then'](function(_0x4d1b64){return _0x3fe43a;})[_0xbe06('0x4b')](function(_0x28aeaa){return _0x28aeaa;});}else{_0x15c01b[_0xbe06('0x1d')](0x190)[_0xbe06('0x25')]({'message':_0xbe06('0x69')});}});}})['then'](respondWithResult(_0x15c01b,null))['catch'](handleError(_0x15c01b,null));};exports[_0xbe06('0x6a')]=function(_0x243cf1,_0x4cded0,_0x24b015){var _0x58ec6e;return db[_0xbe06('0x30')][_0xbe06('0x4c')]({'where':{'id':_0x243cf1[_0xbe06('0x58')]['id']},'include':[{'model':db[_0xbe06('0x6b')],'as':'CustomFields'}]})[_0xbe06('0x28')](handleEntityNotFound(_0x4cded0,null))['then'](function(_0x309aec){if(_0x309aec){_0x58ec6e=_0x309aec;return db[_0xbe06('0x60')][_0xbe06('0x31')];}})[_0xbe06('0x28')](function(_0x43eb04){if(_0x43eb04){var _0x4f644d={};var _0x52c86c={};_0x52c86c['model']=_['concat'](_[_0xbe06('0x37')](_0x43eb04),_['map'](_0x58ec6e['CustomFields'],function(_0x1725ca){return util[_0xbe06('0x6c')](_0xbe06('0x6d'),_0x1725ca['id']);}));_0x52c86c[_0xbe06('0x36')]=_[_0xbe06('0x37')](_0x243cf1['query']);_0x52c86c[_0xbe06('0x41')]=_['intersection'](_0x52c86c[_0xbe06('0x35')],_0x52c86c[_0xbe06('0x36')]);_0x4f644d[_0xbe06('0x38')]=_['intersection'](_0x52c86c[_0xbe06('0x35')],qs[_0xbe06('0x3a')](_0x243cf1['query'][_0xbe06('0x3a')]));_0x4f644d[_0xbe06('0x38')]=_0x4f644d[_0xbe06('0x38')][_0xbe06('0x3b')]?_0x4f644d[_0xbe06('0x38')]:_0x52c86c[_0xbe06('0x35')];if(!_0x243cf1[_0xbe06('0x36')][_0xbe06('0x3c')](_0xbe06('0x3d'))){_0x4f644d['limit']=qs[_0xbe06('0x20')](_0x243cf1[_0xbe06('0x36')]['limit']);_0x4f644d[_0xbe06('0x1f')]=qs[_0xbe06('0x1f')](_0x243cf1[_0xbe06('0x36')][_0xbe06('0x1f')]);}_0x4f644d[_0xbe06('0x3e')]=qs['sort'](_0x243cf1['query'][_0xbe06('0x3f')]);_0x4f644d[_0xbe06('0x40')]=qs[_0xbe06('0x41')](_[_0xbe06('0x42')](_0x243cf1[_0xbe06('0x36')],_0x52c86c[_0xbe06('0x41')]));_0x4f644d[_0xbe06('0x6e')]=!![];if(_0x243cf1[_0xbe06('0x36')]['filter']){_0x4f644d['where']=_['merge'](_0x4f644d[_0xbe06('0x40')],{'$or':_[_0xbe06('0x2f')](_0x4f644d[_0xbe06('0x38')],function(_0x3dfec2){var _0x58e230={};_0x58e230[_0x3dfec2]={'$like':'%'+_0x243cf1[_0xbe06('0x36')]['filter']+'%'};return _0x58e230;})});}_0x4f644d=_[_0xbe06('0x44')]({},_0x4f644d,_0x243cf1[_0xbe06('0x46')]);return _0x58ec6e['getContacts'](_0x4f644d);}})[_0xbe06('0x28')](respondWithResult(_0x4cded0,null))[_0xbe06('0x4b')](handleError(_0x4cded0,null));};exports[_0xbe06('0x6f')]=function(_0x12e8e5,_0x3c4776,_0xb33635){var _0x51c271;return db[_0xbe06('0x30')][_0xbe06('0x4c')]({'where':{'id':_0x12e8e5[_0xbe06('0x58')]['id']},'include':[{'model':db[_0xbe06('0x6b')],'as':'CustomFields'}]})[_0xbe06('0x28')](handleEntityNotFound(_0x3c4776,null))['then'](function(_0x57ff46){if(_0x57ff46){_0x51c271=_0x57ff46;return db[_0xbe06('0x60')][_0xbe06('0x31')];}})[_0xbe06('0x28')](function(_0x31a8dc){if(_0x31a8dc){var _0x587401={};var _0x331a9a={};_0x331a9a[_0xbe06('0x35')]=_[_0xbe06('0x70')](_[_0xbe06('0x37')](_0x31a8dc),_[_0xbe06('0x2f')](_0x51c271[_0xbe06('0x71')],function(_0x5e0da2){return util[_0xbe06('0x6c')](_0xbe06('0x6d'),_0x5e0da2['id']);}));_0x331a9a[_0xbe06('0x36')]=_['keys'](_0x12e8e5[_0xbe06('0x36')]);_0x331a9a[_0xbe06('0x41')]=_[_0xbe06('0x39')](_0x331a9a[_0xbe06('0x35')],_0x331a9a[_0xbe06('0x36')]);_0x587401['attributes']=_[_0xbe06('0x39')](_0x331a9a[_0xbe06('0x35')],qs[_0xbe06('0x3a')](_0x12e8e5[_0xbe06('0x36')]['fields']));_0x587401[_0xbe06('0x38')]=_0x587401['attributes'][_0xbe06('0x3b')]?_0x587401[_0xbe06('0x38')]:_0x331a9a[_0xbe06('0x35')];if(!_0x12e8e5['query'][_0xbe06('0x3c')]('nolimit')){_0x587401[_0xbe06('0x20')]=qs[_0xbe06('0x20')](_0x12e8e5['query']['limit']);_0x587401['offset']=qs[_0xbe06('0x1f')](_0x12e8e5[_0xbe06('0x36')]['offset']);}_0x587401[_0xbe06('0x3e')]=qs[_0xbe06('0x3f')](_0x12e8e5['query'][_0xbe06('0x3f')]);_0x587401['where']=qs[_0xbe06('0x41')](_[_0xbe06('0x42')](_0x12e8e5[_0xbe06('0x36')],_0x331a9a[_0xbe06('0x41')]));_0x587401[_0xbe06('0x6e')]=!![];if(_0x12e8e5[_0xbe06('0x36')][_0xbe06('0x43')]){_0x587401[_0xbe06('0x40')]=_[_0xbe06('0x44')](_0x587401[_0xbe06('0x40')],{'$or':_[_0xbe06('0x2f')](_0x587401['attributes'],function(_0xd82990){var _0x1b36a8={};_0x1b36a8[_0xd82990]={'$like':'%'+_0x12e8e5['query'][_0xbe06('0x43')]+'%'};return _0x1b36a8;})});}_0x587401=_[_0xbe06('0x44')]({},_0x587401,_0x12e8e5[_0xbe06('0x46')]);return _0x51c271[_0xbe06('0x6a')](_0x587401);}})[_0xbe06('0x28')](function(_0x28bdb6){if(!_[_0xbe06('0x72')](_0x28bdb6)){var _0x2ea4f4=toCsv(_0x28bdb6);var _0x4f3356=Date[_0xbe06('0x73')]();fs[_0xbe06('0x74')](util[_0xbe06('0x6c')](_0xbe06('0x75'),_0x51c271['id'],_0x4f3356),_0x2ea4f4);_0x3c4776['setHeader'](_0xbe06('0x76'),_0xbe06('0x77')+util[_0xbe06('0x6c')](_0xbe06('0x78'),_0x51c271['id'],_0x4f3356));_0x3c4776['setHeader'](_0xbe06('0x79'),'text/csv');return _0x3c4776[_0xbe06('0x7a')](util[_0xbe06('0x6c')](_0xbe06('0x75'),_0x51c271['id'],_0x4f3356));}else{return _0x3c4776[_0xbe06('0x1c')](0xcc);}})[_0xbe06('0x4b')](handleError(_0x3c4776,null));};exports[_0xbe06('0x7b')]=function(_0x1e39c1,_0x5701b0,_0xbc05e3){var _0x56a965;delete _0x1e39c1['body']['id'];return db[_0xbe06('0x30')][_0xbe06('0x5d')]({'where':{'id':_0x1e39c1[_0xbe06('0x58')]['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x5701b0,null))[_0xbe06('0x28')](function(_0x26e2fd){if(_0x26e2fd){return db[_0xbe06('0x7c')][_0xbe06('0x7d')](function(_0x2921b9){return db[_0xbe06('0x6b')][_0xbe06('0x4d')](_0x1e39c1[_0xbe06('0x4e')],{'transaction':_0x2921b9})['then'](function(_0x441c66){_0x56a965=_0x441c66;return _0x26e2fd['addCustomFields'](_0x441c66,{'transaction':_0x2921b9});})[_0xbe06('0x28')](function(){var _0x43696b={'type':db['Sequelize'][_0xbe06('0x7e')],'transaction':_0x2921b9};switch(_0x1e39c1['body'][_0xbe06('0x33')]){case _0xbe06('0x7f'):_0x43696b[_0xbe06('0x33')]=db['Sequelize'][_0xbe06('0x7e')];break;case _0xbe06('0x80'):_0x43696b[_0xbe06('0x33')]=db['Sequelize'][_0xbe06('0x81')];break;case _0xbe06('0x82'):_0x43696b[_0xbe06('0x33')]=db[_0xbe06('0x83')][_0xbe06('0x84')];_0x43696b[_0xbe06('0x85')]=![];break;default:}return db[_0xbe06('0x7c')]['queryInterface'][_0xbe06('0x86')]('cm_contacts',util[_0xbe06('0x6c')](_0xbe06('0x87'),_0x56a965['id']),_0x43696b);})[_0xbe06('0x28')](function(){return _0x56a965;});});}})[_0xbe06('0x28')](respondWithResult(_0x5701b0,null))['catch'](handleError(_0x5701b0,null));};exports[_0xbe06('0x88')]=function(_0x2d1481,_0x1776a4,_0x44a046){var _0x357de6={};var _0x587c7e={};var _0x36250a;var _0x7f0b88;return db[_0xbe06('0x30')][_0xbe06('0x5d')]({'where':{'id':_0x2d1481['params']['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x1776a4,null))[_0xbe06('0x28')](function(_0x232bda){if(_0x232bda){_0x36250a=_0x232bda;_0x587c7e[_0xbe06('0x35')]=_[_0xbe06('0x37')](db[_0xbe06('0x6b')][_0xbe06('0x31')]);_0x587c7e['query']=_[_0xbe06('0x37')](_0x2d1481['query']);_0x587c7e[_0xbe06('0x41')]=_[_0xbe06('0x39')](_0x587c7e[_0xbe06('0x35')],_0x587c7e[_0xbe06('0x36')]);_0x357de6[_0xbe06('0x38')]=_['intersection'](_0x587c7e[_0xbe06('0x35')],qs['fields'](_0x2d1481[_0xbe06('0x36')][_0xbe06('0x3a')]));_0x357de6[_0xbe06('0x38')]=_0x357de6['attributes'][_0xbe06('0x3b')]?_0x357de6['attributes']:_0x587c7e[_0xbe06('0x35')];_0x357de6[_0xbe06('0x3e')]=qs[_0xbe06('0x3f')](_0x2d1481[_0xbe06('0x36')][_0xbe06('0x3f')]);_0x357de6[_0xbe06('0x40')]=qs['filters'](_[_0xbe06('0x42')](_0x2d1481[_0xbe06('0x36')],_0x587c7e['filters']));_0x357de6['where']=_['merge'](_0x357de6[_0xbe06('0x40')],{'$or':[{'ListId':_0x232bda['id']},{'ListId':null}]});if(_0x2d1481[_0xbe06('0x36')][_0xbe06('0x43')]){_0x357de6[_0xbe06('0x40')]=_[_0xbe06('0x44')](_0x357de6['where'],{'$or':_['map'](_0x357de6[_0xbe06('0x38')],function(_0x2548b2){var _0x28c26d={};_0x28c26d[_0x2548b2]={'$like':'%'+_0x2d1481[_0xbe06('0x36')][_0xbe06('0x43')]+'%'};return _0x28c26d;})});}_0x357de6=_[_0xbe06('0x44')]({},_0x357de6,_0x2d1481[_0xbe06('0x46')]);return db['CmCustomField'][_0xbe06('0x89')](_0x357de6);}})[_0xbe06('0x28')](respondWithResult(_0x1776a4,null))[_0xbe06('0x4b')](handleError(_0x1776a4,null));};exports['addAgents']=function(_0xbe941,_0x44fa14,_0x180bd9){return db['CmList'][_0xbe06('0x4c')]({'where':{'id':_0xbe941[_0xbe06('0x58')]['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x44fa14,null))['then'](function(_0x528f06){if(_0x528f06){return _0x528f06[_0xbe06('0x8a')](_0xbe941[_0xbe06('0x4e')][_0xbe06('0x8b')],_[_0xbe06('0x65')](_0xbe941[_0xbe06('0x4e')],[_0xbe06('0x8b'),'id'])||{})[_0xbe06('0x8c')](function(_0xdbae01){for(var _0x5a1100=0x0;_0x5a1100<_0xbe941[_0xbe06('0x4e')][_0xbe06('0x8b')][_0xbe06('0x3b')];_0x5a1100+=0x1){socket['emit'](_0xbe06('0x8d'),{'UserId':Number(_0xbe941['body'][_0xbe06('0x8b')][_0x5a1100]),'CmListId':Number(_0xbe941['params']['id'])});}return _0xdbae01;});}})['then'](respondWithResult(_0x44fa14,null))[_0xbe06('0x4b')](handleError(_0x44fa14,null));};exports['removeAgents']=function(_0x7d5fab,_0x2faac4,_0x349d9b){return db['CmList']['find']({'where':{'id':_0x7d5fab['params']['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x2faac4,null))[_0xbe06('0x28')](function(_0x50fc7c){if(_0x50fc7c){return _0x50fc7c[_0xbe06('0x8e')](_0x7d5fab[_0xbe06('0x36')][_0xbe06('0x8b')])[_0xbe06('0x28')](function(){if(_[_0xbe06('0x62')](_0x7d5fab[_0xbe06('0x36')][_0xbe06('0x8b')])){for(var _0x5c8996=0x0;_0x5c8996<_0x7d5fab[_0xbe06('0x36')]['ids']['length'];_0x5c8996+=0x1){socket['emit'](_0xbe06('0x8f'),{'UserId':Number(_0x7d5fab['query'][_0xbe06('0x8b')][_0x5c8996]),'CmListId':Number(_0x7d5fab[_0xbe06('0x58')]['id'])});}}else{socket[_0xbe06('0x90')](_0xbe06('0x8f'),{'UserId':Number(_0x7d5fab[_0xbe06('0x36')][_0xbe06('0x8b')]),'CmListId':Number(_0x7d5fab[_0xbe06('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x2faac4,null))[_0xbe06('0x4b')](handleError(_0x2faac4,null));};exports[_0xbe06('0x91')]=function(_0x57d94a,_0x427eb5,_0x5275c3){var _0x4dfb26={};var _0x4a9ffc={};var _0x8c52;var _0x4e39a8;return db[_0xbe06('0x30')][_0xbe06('0x5d')]({'where':{'id':_0x57d94a['params']['id']}})[_0xbe06('0x28')](handleEntityNotFound(_0x427eb5,null))[_0xbe06('0x28')](function(_0x5af304){if(_0x5af304){_0x8c52=_0x5af304;_0x4a9ffc['model']=_[_0xbe06('0x37')](db[_0xbe06('0x92')][_0xbe06('0x31')]);_0x4a9ffc[_0xbe06('0x36')]=_['keys'](_0x57d94a[_0xbe06('0x36')]);_0x4a9ffc['filters']=_[_0xbe06('0x39')](_0x4a9ffc[_0xbe06('0x35')],_0x4a9ffc[_0xbe06('0x36')]);_0x4dfb26['attributes']=_[_0xbe06('0x39')](_0x4a9ffc[_0xbe06('0x35')],qs[_0xbe06('0x3a')](_0x57d94a[_0xbe06('0x36')][_0xbe06('0x3a')]));_0x4dfb26[_0xbe06('0x38')]=_0x4dfb26[_0xbe06('0x38')][_0xbe06('0x3b')]?_0x4dfb26[_0xbe06('0x38')]:_0x4a9ffc['model'];_0x4dfb26[_0xbe06('0x3e')]=qs['sort'](_0x57d94a[_0xbe06('0x36')][_0xbe06('0x3f')]);_0x4dfb26[_0xbe06('0x40')]=qs[_0xbe06('0x41')](_[_0xbe06('0x42')](_0x57d94a[_0xbe06('0x36')],_0x4a9ffc['filters']));if(_0x57d94a[_0xbe06('0x36')][_0xbe06('0x43')]){_0x4dfb26[_0xbe06('0x40')]=_[_0xbe06('0x44')](_0x4dfb26[_0xbe06('0x40')],{'$or':_['map'](_0x4dfb26[_0xbe06('0x38')],function(_0x1272a5){var _0x1a270e={};_0x1a270e[_0x1272a5]={'$like':'%'+_0x57d94a[_0xbe06('0x36')]['filter']+'%'};return _0x1a270e;})});}_0x4dfb26=_[_0xbe06('0x44')]({},_0x4dfb26,_0x57d94a[_0xbe06('0x46')]);return _0x8c52[_0xbe06('0x91')](_0x4dfb26);}})[_0xbe06('0x28')](function(_0x425b21){if(_0x425b21){_0x4e39a8=_0x425b21[_0xbe06('0x3b')];if(!_0x57d94a[_0xbe06('0x36')][_0xbe06('0x3c')](_0xbe06('0x3d'))){_0x4dfb26['limit']=qs[_0xbe06('0x20')](_0x57d94a[_0xbe06('0x36')][_0xbe06('0x20')]);_0x4dfb26[_0xbe06('0x1f')]=qs[_0xbe06('0x1f')](_0x57d94a['query'][_0xbe06('0x1f')]);}return _0x8c52[_0xbe06('0x91')](_0x4dfb26);}})[_0xbe06('0x28')](function(_0x4b8c83){if(_0x4b8c83){return _0x4b8c83?{'count':_0x4e39a8,'rows':_0x4b8c83}:null;}})[_0xbe06('0x28')](respondWithResult(_0x427eb5,null))[_0xbe06('0x4b')](handleError(_0x427eb5,null));}; \ No newline at end of file +var _0x7b38=['merge','type','options','includeAll','include','findAll','rows','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','getDispositions','findOne','Disposition','hasOwnProperty','ListId','removeDispositions','addContacts','tags','isArray','join','push','each','CmContact','omit','ids','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','cf_%d','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','Content-type','addCustomField','transaction','addCustomFields','Sequelize','number','INTEGER','switch','defaultValue','sequelize','cf_%s','getCustomFields','findAndCountAll','spread','userCmList:save','userCmList:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','Lists','then','stack','name','send','index','map','CmList','rawAttributes','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where'];(function(_0x5d80df,_0x4c8443){var _0x329b21=function(_0x3b805a){while(--_0x3b805a){_0x5d80df['push'](_0x5d80df['shift']());}};_0x329b21(++_0x4c8443);}(_0x7b38,0x167));var _0x87b3=function(_0x46aada,_0x3136ea){_0x46aada=_0x46aada-0x0;var _0x48641b=_0x7b38[_0x46aada];return _0x48641b;};'use strict';var emlformat=require(_0x87b3('0x0'));var rimraf=require(_0x87b3('0x1'));var zipdir=require(_0x87b3('0x2'));var jsonpatch=require(_0x87b3('0x3'));var rp=require('request-promise');var moment=require(_0x87b3('0x4'));var BPromise=require(_0x87b3('0x5'));var Mustache=require(_0x87b3('0x6'));var util=require(_0x87b3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x87b3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87b3('0x9'));var _=require(_0x87b3('0xa'));var squel=require(_0x87b3('0xb'));var crypto=require(_0x87b3('0xc'));var jsforce=require(_0x87b3('0xd'));var deskjs=require(_0x87b3('0xe'));var toCsv=require(_0x87b3('0x8'));var querystring=require(_0x87b3('0xf'));var Papa=require('papaparse');var Redis=require(_0x87b3('0x10'));var authService=require(_0x87b3('0x11'));var qs=require(_0x87b3('0x12'));var as=require(_0x87b3('0x13'));var hardwareService=require(_0x87b3('0x14'));var logger=require(_0x87b3('0x15'))(_0x87b3('0x16'));var utils=require(_0x87b3('0x17'));var config=require(_0x87b3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x87b3('0x19'))['db'];config[_0x87b3('0x1a')]=_[_0x87b3('0x1b')](config[_0x87b3('0x1a')],{'host':_0x87b3('0x1c'),'port':0x18eb});var socket=require(_0x87b3('0x1d'))(new Redis(config[_0x87b3('0x1a')]));require(_0x87b3('0x1e'))[_0x87b3('0x1f')](socket);function respondWithStatusCode(_0x2175c5,_0xaab5d6){_0xaab5d6=_0xaab5d6||0xcc;return function(_0x5b9ff8){if(_0x5b9ff8){return _0x2175c5[_0x87b3('0x20')](_0xaab5d6);}return _0x2175c5['status'](_0xaab5d6)[_0x87b3('0x21')]();};}function respondWithResult(_0x1e7ffa,_0x58b648){_0x58b648=_0x58b648||0xc8;return function(_0x34265b){if(_0x34265b){return _0x1e7ffa[_0x87b3('0x22')](_0x58b648)[_0x87b3('0x23')](_0x34265b);}};}function respondWithFilteredResult(_0x1f4db4,_0x6a5ee1){return function(_0x22f00b){if(_0x22f00b){var _0x2e902f=typeof _0x6a5ee1[_0x87b3('0x24')]===_0x87b3('0x25')&&typeof _0x6a5ee1[_0x87b3('0x26')]==='undefined';var _0x2d53ff=_0x22f00b[_0x87b3('0x27')];var _0x154cc8=_0x2e902f?0x0:_0x6a5ee1[_0x87b3('0x24')];var _0x454466=_0x2e902f?_0x22f00b[_0x87b3('0x27')]:_0x6a5ee1['offset']+_0x6a5ee1[_0x87b3('0x26')];var _0x503c83;if(_0x454466>=_0x2d53ff){_0x454466=_0x2d53ff;_0x503c83=0xc8;}else{_0x503c83=0xce;}_0x1f4db4['status'](_0x503c83);return _0x1f4db4[_0x87b3('0x28')](_0x87b3('0x29'),_0x154cc8+'-'+_0x454466+'/'+_0x2d53ff)[_0x87b3('0x23')](_0x22f00b);}return null;};}function patchUpdates(_0x26f845){return function(_0xbd0e7f){try{jsonpatch[_0x87b3('0x2a')](_0xbd0e7f,_0x26f845,!![]);}catch(_0x17e936){return BPromise['reject'](_0x17e936);}return _0xbd0e7f[_0x87b3('0x2b')]();};}function saveUpdates(_0x3415fe,_0x2c2521){return function(_0x3b2000){if(_0x3b2000){return _0x3b2000[_0x87b3('0x2c')](_0x3415fe)['then'](function(_0x4beed8){return _0x4beed8;});}return null;};}function removeEntity(_0x2f525b,_0x2b3f7c){return function(_0x49af85){if(_0x49af85){return _0x49af85[_0x87b3('0x2d')]()['then'](function(){var _0x2ebab3=_0x49af85[_0x87b3('0x2e')]({'plain':!![]});var _0xb07ae1=_0x87b3('0x2f');return db['UserProfileResource'][_0x87b3('0x2d')]({'where':{'type':_0xb07ae1,'resourceId':_0x2ebab3['id']}})['then'](function(){return _0x49af85;});})[_0x87b3('0x30')](function(){_0x2f525b[_0x87b3('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b7dfd,_0x213922){return function(_0x21afd9){if(!_0x21afd9){_0x3b7dfd[_0x87b3('0x20')](0x194);}return _0x21afd9;};}function handleError(_0x327c4d,_0x1cdfd6){_0x1cdfd6=_0x1cdfd6||0x1f4;return function(_0x3369e4){logger['error'](_0x3369e4[_0x87b3('0x31')]);if(_0x3369e4[_0x87b3('0x32')]){delete _0x3369e4[_0x87b3('0x32')];}_0x327c4d[_0x87b3('0x22')](_0x1cdfd6)[_0x87b3('0x33')](_0x3369e4);};}exports[_0x87b3('0x34')]=function(_0x392ed6,_0xe1e07e){var _0x33590d={},_0x41297f={},_0x3e5ee1={'count':0x0,'rows':[]};var _0xf50f40=_[_0x87b3('0x35')](db[_0x87b3('0x36')][_0x87b3('0x37')],function(_0x273ce9){return{'name':_0x273ce9['fieldName'],'type':_0x273ce9['type'][_0x87b3('0x38')]};});_0x41297f[_0x87b3('0x39')]=_[_0x87b3('0x35')](_0xf50f40,_0x87b3('0x32'));_0x41297f[_0x87b3('0x3a')]=_['keys'](_0x392ed6[_0x87b3('0x3a')]);_0x41297f['filters']=_[_0x87b3('0x3b')](_0x41297f[_0x87b3('0x39')],_0x41297f[_0x87b3('0x3a')]);_0x33590d['attributes']=_['intersection'](_0x41297f['model'],qs[_0x87b3('0x3c')](_0x392ed6[_0x87b3('0x3a')]['fields']));_0x33590d['attributes']=_0x33590d[_0x87b3('0x3d')][_0x87b3('0x3e')]?_0x33590d[_0x87b3('0x3d')]:_0x41297f[_0x87b3('0x39')];if(!_0x392ed6[_0x87b3('0x3a')]['hasOwnProperty'](_0x87b3('0x3f'))){_0x33590d['limit']=qs[_0x87b3('0x26')](_0x392ed6[_0x87b3('0x3a')][_0x87b3('0x26')]);_0x33590d[_0x87b3('0x24')]=qs[_0x87b3('0x24')](_0x392ed6[_0x87b3('0x3a')]['offset']);}_0x33590d[_0x87b3('0x40')]=qs[_0x87b3('0x41')](_0x392ed6['query'][_0x87b3('0x41')]);_0x33590d['where']=qs[_0x87b3('0x42')](_[_0x87b3('0x43')](_0x392ed6['query'],_0x41297f[_0x87b3('0x42')]),_0xf50f40);if(_0x392ed6['query'][_0x87b3('0x44')]){_0x33590d[_0x87b3('0x45')]=_[_0x87b3('0x46')](_0x33590d[_0x87b3('0x45')],{'$or':_[_0x87b3('0x35')](_0xf50f40,function(_0x1063e1){if(_0x1063e1[_0x87b3('0x47')]!=='VIRTUAL'){var _0x129e7a={};_0x129e7a[_0x1063e1[_0x87b3('0x32')]]={'$like':'%'+_0x392ed6[_0x87b3('0x3a')][_0x87b3('0x44')]+'%'};return _0x129e7a;}})});}_0x33590d=_[_0x87b3('0x46')]({},_0x33590d,_0x392ed6[_0x87b3('0x48')]);var _0x5b25d3={'where':_0x33590d[_0x87b3('0x45')]};return db[_0x87b3('0x36')][_0x87b3('0x27')](_0x5b25d3)[_0x87b3('0x30')](function(_0x407553){_0x3e5ee1[_0x87b3('0x27')]=_0x407553;if(_0x392ed6[_0x87b3('0x3a')][_0x87b3('0x49')]){_0x33590d[_0x87b3('0x4a')]=[{'all':!![]}];}return db[_0x87b3('0x36')][_0x87b3('0x4b')](_0x33590d);})[_0x87b3('0x30')](function(_0x2a196c){_0x3e5ee1[_0x87b3('0x4c')]=_0x2a196c;return _0x3e5ee1;})['then'](respondWithFilteredResult(_0xe1e07e,_0x33590d))['catch'](handleError(_0xe1e07e,null));};exports['show']=function(_0x526e8d,_0x1703ba){var _0x1e1925={'raw':![],'where':{'id':_0x526e8d[_0x87b3('0x4d')]['id']}},_0x3dd550={};_0x3dd550[_0x87b3('0x39')]=_[_0x87b3('0x4e')](db[_0x87b3('0x36')][_0x87b3('0x37')]);_0x3dd550[_0x87b3('0x3a')]=_[_0x87b3('0x4e')](_0x526e8d[_0x87b3('0x3a')]);_0x3dd550[_0x87b3('0x42')]=_[_0x87b3('0x3b')](_0x3dd550[_0x87b3('0x39')],_0x3dd550[_0x87b3('0x3a')]);_0x1e1925['attributes']=_['intersection'](_0x3dd550[_0x87b3('0x39')],qs[_0x87b3('0x3c')](_0x526e8d[_0x87b3('0x3a')][_0x87b3('0x3c')]));_0x1e1925[_0x87b3('0x3d')]=_0x1e1925[_0x87b3('0x3d')][_0x87b3('0x3e')]?_0x1e1925[_0x87b3('0x3d')]:_0x3dd550['model'];if(_0x526e8d['query']['includeAll']){_0x1e1925['include']=[{'all':!![]}];}_0x1e1925=_[_0x87b3('0x46')]({},_0x1e1925,_0x526e8d[_0x87b3('0x48')]);return db[_0x87b3('0x36')][_0x87b3('0x4f')](_0x1e1925)[_0x87b3('0x30')](handleEntityNotFound(_0x1703ba,null))[_0x87b3('0x30')](respondWithResult(_0x1703ba,null))[_0x87b3('0x50')](handleError(_0x1703ba,null));};exports[_0x87b3('0x51')]=function(_0x54e9ad,_0x2a235e){return db[_0x87b3('0x36')][_0x87b3('0x51')](_0x54e9ad['body'],{})[_0x87b3('0x30')](function(_0x4c95da){var _0x551a18=_0x54e9ad[_0x87b3('0x52')][_0x87b3('0x2e')]({'plain':!![]});if(!_0x551a18)throw new Error(_0x87b3('0x53'));if(_0x551a18[_0x87b3('0x54')]===_0x87b3('0x52')){var _0x2cc8b2=_0x4c95da['get']({'plain':!![]});var _0x5a1dc0=_0x87b3('0x2f');return db[_0x87b3('0x55')][_0x87b3('0x4f')]({'where':{'name':_0x5a1dc0,'userProfileId':_0x551a18[_0x87b3('0x56')]},'raw':!![]})[_0x87b3('0x30')](function(_0x4ad6e3){if(_0x4ad6e3&&_0x4ad6e3[_0x87b3('0x57')]===0x0){return db[_0x87b3('0x58')][_0x87b3('0x51')]({'name':_0x2cc8b2[_0x87b3('0x32')],'resourceId':_0x2cc8b2['id'],'type':_0x4ad6e3['name'],'sectionId':_0x4ad6e3['id']},{})[_0x87b3('0x30')](function(){return _0x4c95da;});}else{return _0x4c95da;}})[_0x87b3('0x50')](function(_0x5e5ca5){logger['error'](_0x87b3('0x59'),_0x5e5ca5);throw _0x5e5ca5;});}return _0x4c95da;})[_0x87b3('0x30')](respondWithResult(_0x2a235e,0xc9))[_0x87b3('0x50')](handleError(_0x2a235e,null));};exports['update']=function(_0x3788c1,_0x3db83b){if(_0x3788c1[_0x87b3('0x5a')]['id']){delete _0x3788c1[_0x87b3('0x5a')]['id'];}return db[_0x87b3('0x36')][_0x87b3('0x4f')]({'where':{'id':_0x3788c1[_0x87b3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3db83b,null))['then'](saveUpdates(_0x3788c1[_0x87b3('0x5a')],null))[_0x87b3('0x30')](respondWithResult(_0x3db83b,null))[_0x87b3('0x50')](handleError(_0x3db83b,null));};exports['destroy']=function(_0x17e072,_0x553387){return db['CmList'][_0x87b3('0x4f')]({'where':{'id':_0x17e072[_0x87b3('0x4d')]['id']}})[_0x87b3('0x30')](handleEntityNotFound(_0x553387,null))[_0x87b3('0x30')](removeEntity(_0x553387,null))['catch'](handleError(_0x553387,null));};exports['describe']=function(_0x5f3d59,_0x5981e9){return db[_0x87b3('0x36')][_0x87b3('0x5b')]()['then'](respondWithResult(_0x5981e9,null))['catch'](handleError(_0x5981e9,null));};exports[_0x87b3('0x5c')]=function(_0x4a6883,_0x10d294,_0x51f103){if(_0x4a6883[_0x87b3('0x5a')]['id']){delete _0x4a6883[_0x87b3('0x5a')]['id'];}return db['CmList']['find']({'where':{'id':_0x4a6883[_0x87b3('0x4d')]['id']}})[_0x87b3('0x30')](handleEntityNotFound(_0x10d294,null))[_0x87b3('0x30')](function(_0x450f7d){if(_0x450f7d){_0x4a6883[_0x87b3('0x5a')]['ListId']=_0x450f7d['id'];return db['Disposition'][_0x87b3('0x51')](_0x4a6883[_0x87b3('0x5a')]);}})[_0x87b3('0x30')](respondWithResult(_0x10d294,null))['catch'](handleError(_0x10d294,null));};exports[_0x87b3('0x5d')]=function(_0x36f8f4,_0x557226,_0x53357d){var _0x1f52c5={'raw':![],'where':{}};var _0x47d0db={};var _0x8e535a={'count':0x0,'rows':[]};return db['CmList'][_0x87b3('0x5e')]({'where':{'id':_0x36f8f4[_0x87b3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x557226,null))[_0x87b3('0x30')](function(_0xed56ce){if(_0xed56ce){_0x47d0db[_0x87b3('0x39')]=_[_0x87b3('0x4e')](db[_0x87b3('0x5f')][_0x87b3('0x37')]);_0x47d0db[_0x87b3('0x3a')]=_[_0x87b3('0x4e')](_0x36f8f4[_0x87b3('0x3a')]);_0x47d0db[_0x87b3('0x42')]=_['intersection'](_0x47d0db['model'],_0x47d0db[_0x87b3('0x3a')]);_0x1f52c5[_0x87b3('0x3d')]=_[_0x87b3('0x3b')](_0x47d0db[_0x87b3('0x39')],qs['fields'](_0x36f8f4[_0x87b3('0x3a')][_0x87b3('0x3c')]));_0x1f52c5[_0x87b3('0x3d')]=_0x1f52c5[_0x87b3('0x3d')]['length']?_0x1f52c5[_0x87b3('0x3d')]:_0x47d0db[_0x87b3('0x39')];if(!_0x36f8f4[_0x87b3('0x3a')][_0x87b3('0x60')]('nolimit')){_0x1f52c5['limit']=qs['limit'](_0x36f8f4['query'][_0x87b3('0x26')]);_0x1f52c5['offset']=qs[_0x87b3('0x24')](_0x36f8f4[_0x87b3('0x3a')][_0x87b3('0x24')]);}_0x1f52c5['order']=qs['sort'](_0x36f8f4[_0x87b3('0x3a')]['sort']);_0x1f52c5[_0x87b3('0x45')]=qs['filters'](_['pick'](_0x36f8f4['query'],_0x47d0db[_0x87b3('0x42')]));_0x1f52c5[_0x87b3('0x45')][_0x87b3('0x61')]=_0xed56ce['id'];if(_0x36f8f4[_0x87b3('0x3a')][_0x87b3('0x44')]){_0x1f52c5['where']=_[_0x87b3('0x46')](_0x1f52c5[_0x87b3('0x45')],{'$or':_['map'](_0x1f52c5['attributes'],function(_0x533f1c){var _0xa7c282={};_0xa7c282[_0x533f1c]={'$like':'%'+_0x36f8f4['query'][_0x87b3('0x44')]+'%'};return _0xa7c282;})});}_0x1f52c5=_[_0x87b3('0x46')]({},_0x1f52c5,_0x36f8f4[_0x87b3('0x48')]);return db[_0x87b3('0x5f')][_0x87b3('0x27')]({'where':_0x1f52c5['where']})[_0x87b3('0x30')](function(_0x3da91a){_0x8e535a[_0x87b3('0x27')]=_0x3da91a;if(_0x36f8f4[_0x87b3('0x3a')][_0x87b3('0x49')]){_0x1f52c5['include']=[{'all':!![]}];}return db[_0x87b3('0x5f')]['findAll'](_0x1f52c5);})['then'](function(_0x5b17c1){_0x8e535a[_0x87b3('0x4c')]=_0x5b17c1;return _0x8e535a;});}})[_0x87b3('0x30')](respondWithFilteredResult(_0x557226,_0x1f52c5))[_0x87b3('0x50')](handleError(_0x557226,null));};exports[_0x87b3('0x62')]=function(_0x726de,_0x1df9b4,_0x1c71ea){return db[_0x87b3('0x36')][_0x87b3('0x4f')]({'where':{'id':_0x726de['params']['id']}})[_0x87b3('0x30')](handleEntityNotFound(_0x1df9b4,null))[_0x87b3('0x30')](function(_0x5b892c){if(_0x5b892c){return _0x5b892c['removeDispositions'](_0x726de[_0x87b3('0x3a')]['ids']);}})[_0x87b3('0x30')](respondWithStatusCode(_0x1df9b4,null))['catch'](handleError(_0x1df9b4,null));};exports[_0x87b3('0x63')]=function(_0x2b24d2,_0x2c7ed8,_0x38cb05){return db[_0x87b3('0x36')][_0x87b3('0x4f')]({'where':{'id':_0x2b24d2[_0x87b3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c7ed8,null))['then'](function(_0x2f5b5a){if(_0x2f5b5a){var _0x37dcc3=[];var _0x40791b={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x5242a9){if(_0x2b24d2[_0x87b3('0x5a')][_0x87b3('0x64')]&&_[_0x87b3('0x65')](_0x2b24d2[_0x87b3('0x5a')][_0x87b3('0x64')])){if(_0x2b24d2[_0x87b3('0x5a')][_0x87b3('0x64')]['length']){_0x2b24d2['body'][_0x87b3('0x64')]=_0x2b24d2[_0x87b3('0x5a')][_0x87b3('0x64')][_0x87b3('0x66')](';')+';';}else{_0x2b24d2[_0x87b3('0x5a')]['tags']=null;}}else{_0x2b24d2[_0x87b3('0x5a')]['tags']=null;}if(_0x2b24d2[_0x87b3('0x5a')]&&_[_0x87b3('0x65')](_0x2b24d2[_0x87b3('0x5a')])){for(var _0x45609e=0x0;_0x45609e<_0x2b24d2[_0x87b3('0x5a')][_0x87b3('0x3e')];_0x45609e+=0x1){_0x2b24d2[_0x87b3('0x5a')][_0x45609e][_0x87b3('0x61')]=_0x2b24d2[_0x87b3('0x4d')]['id'];_0x37dcc3[_0x87b3('0x67')](_0x2b24d2[_0x87b3('0x5a')][_0x45609e]);}return BPromise[_0x87b3('0x68')](_0x37dcc3,function(_0x7bdb8b){return db[_0x87b3('0x69')][_0x87b3('0x51')](_[_0x87b3('0x6a')](_0x7bdb8b,[_0x87b3('0x6b'),'id'])||{},{'fields':_['keys'](_0x5242a9),'raw':!![]})['then'](function(_0x51cd7f){_0x40791b[_0x87b3('0x6c')][_0x87b3('0x67')](_0x51cd7f['dataValues']);})['catch'](function(_0x52a7eb){_0x40791b[_0x87b3('0x6d')][_0x87b3('0x67')]({'data':_0x7bdb8b,'error':_0x52a7eb[_0x87b3('0x6e')]});});})[_0x87b3('0x30')](function(_0x318bb0){return _0x40791b;})[_0x87b3('0x50')](function(_0x222cf9){return _0x222cf9;});}else{_0x2c7ed8[_0x87b3('0x22')](0x190)['json']({'message':_0x87b3('0x6f')});}});}})[_0x87b3('0x30')](respondWithResult(_0x2c7ed8,null))[_0x87b3('0x50')](handleError(_0x2c7ed8,null));};exports[_0x87b3('0x70')]=function(_0x2578f6,_0x3c8ef1,_0x3ca040){var _0x2ebe1c;return db[_0x87b3('0x36')][_0x87b3('0x4f')]({'where':{'id':_0x2578f6[_0x87b3('0x4d')]['id']},'include':[{'model':db[_0x87b3('0x71')],'as':_0x87b3('0x72')}]})[_0x87b3('0x30')](handleEntityNotFound(_0x3c8ef1,null))[_0x87b3('0x30')](function(_0x211206){if(_0x211206){_0x2ebe1c=_0x211206;return db[_0x87b3('0x69')][_0x87b3('0x37')];}})[_0x87b3('0x30')](function(_0x503adb){if(_0x503adb){var _0x247d0d={};var _0x21d9bf={};_0x21d9bf[_0x87b3('0x39')]=_[_0x87b3('0x73')](_[_0x87b3('0x4e')](_0x503adb),_[_0x87b3('0x35')](_0x2ebe1c[_0x87b3('0x72')],function(_0x57ad60){return util[_0x87b3('0x74')]('cf_%d',_0x57ad60['id']);}));_0x21d9bf[_0x87b3('0x3a')]=_['keys'](_0x2578f6[_0x87b3('0x3a')]);_0x21d9bf[_0x87b3('0x42')]=_[_0x87b3('0x3b')](_0x21d9bf[_0x87b3('0x39')],_0x21d9bf[_0x87b3('0x3a')]);_0x247d0d[_0x87b3('0x3d')]=_[_0x87b3('0x3b')](_0x21d9bf[_0x87b3('0x39')],qs[_0x87b3('0x3c')](_0x2578f6[_0x87b3('0x3a')]['fields']));_0x247d0d[_0x87b3('0x3d')]=_0x247d0d[_0x87b3('0x3d')][_0x87b3('0x3e')]?_0x247d0d[_0x87b3('0x3d')]:_0x21d9bf[_0x87b3('0x39')];if(!_0x2578f6['query'][_0x87b3('0x60')](_0x87b3('0x3f'))){_0x247d0d[_0x87b3('0x26')]=qs['limit'](_0x2578f6[_0x87b3('0x3a')]['limit']);_0x247d0d['offset']=qs[_0x87b3('0x24')](_0x2578f6[_0x87b3('0x3a')][_0x87b3('0x24')]);}_0x247d0d[_0x87b3('0x40')]=qs[_0x87b3('0x41')](_0x2578f6['query'][_0x87b3('0x41')]);_0x247d0d[_0x87b3('0x45')]=qs[_0x87b3('0x42')](_['pick'](_0x2578f6[_0x87b3('0x3a')],_0x21d9bf[_0x87b3('0x42')]));_0x247d0d[_0x87b3('0x75')]=!![];if(_0x2578f6[_0x87b3('0x3a')][_0x87b3('0x44')]){_0x247d0d['where']=_[_0x87b3('0x46')](_0x247d0d[_0x87b3('0x45')],{'$or':_[_0x87b3('0x35')](_0x247d0d[_0x87b3('0x3d')],function(_0x1d35fd){var _0x45cf33={};_0x45cf33[_0x1d35fd]={'$like':'%'+_0x2578f6['query']['filter']+'%'};return _0x45cf33;})});}_0x247d0d=_[_0x87b3('0x46')]({},_0x247d0d,_0x2578f6['options']);return _0x2ebe1c[_0x87b3('0x70')](_0x247d0d);}})['then'](respondWithResult(_0x3c8ef1,null))[_0x87b3('0x50')](handleError(_0x3c8ef1,null));};exports[_0x87b3('0x76')]=function(_0x23478c,_0x44111a,_0x123397){var _0x18134a;return db[_0x87b3('0x36')][_0x87b3('0x4f')]({'where':{'id':_0x23478c[_0x87b3('0x4d')]['id']},'include':[{'model':db[_0x87b3('0x71')],'as':'CustomFields'}]})[_0x87b3('0x30')](handleEntityNotFound(_0x44111a,null))[_0x87b3('0x30')](function(_0x534c4a){if(_0x534c4a){_0x18134a=_0x534c4a;return db[_0x87b3('0x69')]['rawAttributes'];}})[_0x87b3('0x30')](function(_0x11ab8f){if(_0x11ab8f){var _0x3c3eea={};var _0x37b409={};_0x37b409[_0x87b3('0x39')]=_['concat'](_['keys'](_0x11ab8f),_[_0x87b3('0x35')](_0x18134a[_0x87b3('0x72')],function(_0x446576){return util['format'](_0x87b3('0x77'),_0x446576['id']);}));_0x37b409[_0x87b3('0x3a')]=_[_0x87b3('0x4e')](_0x23478c[_0x87b3('0x3a')]);_0x37b409[_0x87b3('0x42')]=_[_0x87b3('0x3b')](_0x37b409[_0x87b3('0x39')],_0x37b409[_0x87b3('0x3a')]);_0x3c3eea[_0x87b3('0x3d')]=_[_0x87b3('0x3b')](_0x37b409[_0x87b3('0x39')],qs[_0x87b3('0x3c')](_0x23478c[_0x87b3('0x3a')][_0x87b3('0x3c')]));_0x3c3eea[_0x87b3('0x3d')]=_0x3c3eea[_0x87b3('0x3d')][_0x87b3('0x3e')]?_0x3c3eea[_0x87b3('0x3d')]:_0x37b409[_0x87b3('0x39')];if(!_0x23478c['query']['hasOwnProperty'](_0x87b3('0x3f'))){_0x3c3eea['limit']=qs[_0x87b3('0x26')](_0x23478c[_0x87b3('0x3a')]['limit']);_0x3c3eea['offset']=qs[_0x87b3('0x24')](_0x23478c[_0x87b3('0x3a')]['offset']);}_0x3c3eea[_0x87b3('0x40')]=qs[_0x87b3('0x41')](_0x23478c['query'][_0x87b3('0x41')]);_0x3c3eea[_0x87b3('0x45')]=qs[_0x87b3('0x42')](_[_0x87b3('0x43')](_0x23478c[_0x87b3('0x3a')],_0x37b409[_0x87b3('0x42')]));_0x3c3eea['raw']=!![];if(_0x23478c['query'][_0x87b3('0x44')]){_0x3c3eea[_0x87b3('0x45')]=_['merge'](_0x3c3eea['where'],{'$or':_['map'](_0x3c3eea['attributes'],function(_0x46a94e){var _0x24c152={};_0x24c152[_0x46a94e]={'$like':'%'+_0x23478c['query'][_0x87b3('0x44')]+'%'};return _0x24c152;})});}_0x3c3eea=_[_0x87b3('0x46')]({},_0x3c3eea,_0x23478c[_0x87b3('0x48')]);return _0x18134a[_0x87b3('0x70')](_0x3c3eea);}})[_0x87b3('0x30')](function(_0x16b1e5){if(!_['isEmpty'](_0x16b1e5)){var _0x13f0f6=toCsv(_0x16b1e5);var _0x4e21aa=Date[_0x87b3('0x78')]();fs[_0x87b3('0x79')](util['format'](_0x87b3('0x7a'),_0x18134a['id'],_0x4e21aa),_0x13f0f6);_0x44111a[_0x87b3('0x7b')]('Content-disposition',_0x87b3('0x7c')+util[_0x87b3('0x74')]('list_%d_%s.csv',_0x18134a['id'],_0x4e21aa));_0x44111a['setHeader'](_0x87b3('0x7d'),'text/csv');return _0x44111a['download'](util[_0x87b3('0x74')](_0x87b3('0x7a'),_0x18134a['id'],_0x4e21aa));}else{return _0x44111a['sendStatus'](0xcc);}})[_0x87b3('0x50')](handleError(_0x44111a,null));};exports[_0x87b3('0x7e')]=function(_0xe5cd0e,_0x2f4d09,_0x4904a8){var _0x1fc1e6;delete _0xe5cd0e['body']['id'];return db['CmList'][_0x87b3('0x5e')]({'where':{'id':_0xe5cd0e[_0x87b3('0x4d')]['id']}})[_0x87b3('0x30')](handleEntityNotFound(_0x2f4d09,null))['then'](function(_0x2cbb7b){if(_0x2cbb7b){return db['sequelize'][_0x87b3('0x7f')](function(_0xecb443){return db[_0x87b3('0x71')][_0x87b3('0x51')](_0xe5cd0e[_0x87b3('0x5a')],{'transaction':_0xecb443})[_0x87b3('0x30')](function(_0x1875dc){_0x1fc1e6=_0x1875dc;return _0x2cbb7b[_0x87b3('0x80')](_0x1875dc,{'transaction':_0xecb443});})[_0x87b3('0x30')](function(){var _0x5da86f={'type':db[_0x87b3('0x81')]['TEXT'],'transaction':_0xecb443};switch(_0xe5cd0e[_0x87b3('0x5a')][_0x87b3('0x47')]){case'text':_0x5da86f['type']=db[_0x87b3('0x81')]['TEXT'];break;case _0x87b3('0x82'):_0x5da86f[_0x87b3('0x47')]=db[_0x87b3('0x81')][_0x87b3('0x83')];break;case _0x87b3('0x84'):_0x5da86f[_0x87b3('0x47')]=db[_0x87b3('0x81')]['BOOLEAN'];_0x5da86f[_0x87b3('0x85')]=![];break;default:}return db[_0x87b3('0x86')]['queryInterface']['addColumn']('cm_contacts',util[_0x87b3('0x74')](_0x87b3('0x87'),_0x1fc1e6['id']),_0x5da86f);})[_0x87b3('0x30')](function(){return _0x1fc1e6;});});}})[_0x87b3('0x30')](respondWithResult(_0x2f4d09,null))[_0x87b3('0x50')](handleError(_0x2f4d09,null));};exports[_0x87b3('0x88')]=function(_0x346c9a,_0x13b48b,_0x3b1f11){var _0x58cb24={};var _0x2ded69={};var _0x27a517;var _0x388884;return db[_0x87b3('0x36')][_0x87b3('0x5e')]({'where':{'id':_0x346c9a['params']['id']}})[_0x87b3('0x30')](handleEntityNotFound(_0x13b48b,null))['then'](function(_0x2690d5){if(_0x2690d5){_0x27a517=_0x2690d5;_0x2ded69[_0x87b3('0x39')]=_[_0x87b3('0x4e')](db[_0x87b3('0x71')][_0x87b3('0x37')]);_0x2ded69['query']=_['keys'](_0x346c9a[_0x87b3('0x3a')]);_0x2ded69[_0x87b3('0x42')]=_[_0x87b3('0x3b')](_0x2ded69[_0x87b3('0x39')],_0x2ded69['query']);_0x58cb24['attributes']=_[_0x87b3('0x3b')](_0x2ded69[_0x87b3('0x39')],qs[_0x87b3('0x3c')](_0x346c9a[_0x87b3('0x3a')][_0x87b3('0x3c')]));_0x58cb24['attributes']=_0x58cb24[_0x87b3('0x3d')][_0x87b3('0x3e')]?_0x58cb24[_0x87b3('0x3d')]:_0x2ded69['model'];_0x58cb24[_0x87b3('0x40')]=qs[_0x87b3('0x41')](_0x346c9a[_0x87b3('0x3a')][_0x87b3('0x41')]);_0x58cb24[_0x87b3('0x45')]=qs[_0x87b3('0x42')](_[_0x87b3('0x43')](_0x346c9a[_0x87b3('0x3a')],_0x2ded69[_0x87b3('0x42')]));_0x58cb24[_0x87b3('0x45')]=_['merge'](_0x58cb24['where'],{'$or':[{'ListId':_0x2690d5['id']},{'ListId':null}]});if(_0x346c9a[_0x87b3('0x3a')][_0x87b3('0x44')]){_0x58cb24[_0x87b3('0x45')]=_[_0x87b3('0x46')](_0x58cb24[_0x87b3('0x45')],{'$or':_[_0x87b3('0x35')](_0x58cb24[_0x87b3('0x3d')],function(_0x3f26bb){var _0x1249ba={};_0x1249ba[_0x3f26bb]={'$like':'%'+_0x346c9a[_0x87b3('0x3a')][_0x87b3('0x44')]+'%'};return _0x1249ba;})});}_0x58cb24=_[_0x87b3('0x46')]({},_0x58cb24,_0x346c9a[_0x87b3('0x48')]);return db[_0x87b3('0x71')][_0x87b3('0x89')](_0x58cb24);}})['then'](respondWithResult(_0x13b48b,null))[_0x87b3('0x50')](handleError(_0x13b48b,null));};exports['addAgents']=function(_0x289272,_0x18d5f4,_0x1c38a8){return db[_0x87b3('0x36')][_0x87b3('0x4f')]({'where':{'id':_0x289272[_0x87b3('0x4d')]['id']}})[_0x87b3('0x30')](handleEntityNotFound(_0x18d5f4,null))[_0x87b3('0x30')](function(_0x23fdea){if(_0x23fdea){return _0x23fdea['addAgents'](_0x289272[_0x87b3('0x5a')][_0x87b3('0x6b')],_[_0x87b3('0x6a')](_0x289272[_0x87b3('0x5a')],[_0x87b3('0x6b'),'id'])||{})[_0x87b3('0x8a')](function(_0x29e27b){for(var _0xd250a1=0x0;_0xd250a1<_0x289272['body'][_0x87b3('0x6b')]['length'];_0xd250a1+=0x1){socket['emit'](_0x87b3('0x8b'),{'UserId':Number(_0x289272[_0x87b3('0x5a')][_0x87b3('0x6b')][_0xd250a1]),'CmListId':Number(_0x289272[_0x87b3('0x4d')]['id'])});}return _0x29e27b;});}})['then'](respondWithResult(_0x18d5f4,null))[_0x87b3('0x50')](handleError(_0x18d5f4,null));};exports['removeAgents']=function(_0x46a863,_0x2fe8fb,_0xdb2071){return db['CmList'][_0x87b3('0x4f')]({'where':{'id':_0x46a863[_0x87b3('0x4d')]['id']}})[_0x87b3('0x30')](handleEntityNotFound(_0x2fe8fb,null))['then'](function(_0x586595){if(_0x586595){return _0x586595['removeAgents'](_0x46a863[_0x87b3('0x3a')][_0x87b3('0x6b')])[_0x87b3('0x30')](function(){if(_[_0x87b3('0x65')](_0x46a863[_0x87b3('0x3a')][_0x87b3('0x6b')])){for(var _0x51e78f=0x0;_0x51e78f<_0x46a863[_0x87b3('0x3a')][_0x87b3('0x6b')][_0x87b3('0x3e')];_0x51e78f+=0x1){socket['emit'](_0x87b3('0x8c'),{'UserId':Number(_0x46a863['query'][_0x87b3('0x6b')][_0x51e78f]),'CmListId':Number(_0x46a863[_0x87b3('0x4d')]['id'])});}}else{socket[_0x87b3('0x8d')]('userCmList:remove',{'UserId':Number(_0x46a863[_0x87b3('0x3a')][_0x87b3('0x6b')]),'CmListId':Number(_0x46a863[_0x87b3('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fe8fb,null))[_0x87b3('0x50')](handleError(_0x2fe8fb,null));};exports[_0x87b3('0x8e')]=function(_0x2525a5,_0x27deb4,_0x4f0df3){var _0x592dff={};var _0x3edc92={};var _0x5ef575;var _0x4c006d;return db[_0x87b3('0x36')][_0x87b3('0x5e')]({'where':{'id':_0x2525a5[_0x87b3('0x4d')]['id']}})[_0x87b3('0x30')](handleEntityNotFound(_0x27deb4,null))['then'](function(_0x3cf213){if(_0x3cf213){_0x5ef575=_0x3cf213;_0x3edc92[_0x87b3('0x39')]=_[_0x87b3('0x4e')](db['User']['rawAttributes']);_0x3edc92['query']=_[_0x87b3('0x4e')](_0x2525a5['query']);_0x3edc92[_0x87b3('0x42')]=_[_0x87b3('0x3b')](_0x3edc92[_0x87b3('0x39')],_0x3edc92[_0x87b3('0x3a')]);_0x592dff[_0x87b3('0x3d')]=_[_0x87b3('0x3b')](_0x3edc92[_0x87b3('0x39')],qs[_0x87b3('0x3c')](_0x2525a5[_0x87b3('0x3a')][_0x87b3('0x3c')]));_0x592dff[_0x87b3('0x3d')]=_0x592dff[_0x87b3('0x3d')]['length']?_0x592dff['attributes']:_0x3edc92['model'];_0x592dff[_0x87b3('0x40')]=qs['sort'](_0x2525a5[_0x87b3('0x3a')]['sort']);_0x592dff[_0x87b3('0x45')]=qs['filters'](_[_0x87b3('0x43')](_0x2525a5[_0x87b3('0x3a')],_0x3edc92[_0x87b3('0x42')]));if(_0x2525a5['query'][_0x87b3('0x44')]){_0x592dff[_0x87b3('0x45')]=_[_0x87b3('0x46')](_0x592dff[_0x87b3('0x45')],{'$or':_['map'](_0x592dff[_0x87b3('0x3d')],function(_0x106f9e){var _0x33c10e={};_0x33c10e[_0x106f9e]={'$like':'%'+_0x2525a5[_0x87b3('0x3a')][_0x87b3('0x44')]+'%'};return _0x33c10e;})});}_0x592dff=_[_0x87b3('0x46')]({},_0x592dff,_0x2525a5['options']);return _0x5ef575['getAgents'](_0x592dff);}})['then'](function(_0x4fa5ec){if(_0x4fa5ec){_0x4c006d=_0x4fa5ec['length'];if(!_0x2525a5[_0x87b3('0x3a')][_0x87b3('0x60')]('nolimit')){_0x592dff['limit']=qs[_0x87b3('0x26')](_0x2525a5['query']['limit']);_0x592dff[_0x87b3('0x24')]=qs[_0x87b3('0x24')](_0x2525a5[_0x87b3('0x3a')]['offset']);}return _0x5ef575[_0x87b3('0x8e')](_0x592dff);}})[_0x87b3('0x30')](function(_0x3453cf){if(_0x3453cf){return _0x3453cf?{'count':_0x4c006d,'rows':_0x3453cf}:null;}})[_0x87b3('0x30')](respondWithResult(_0x27deb4,null))[_0x87b3('0x50')](handleError(_0x27deb4,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f1cd6f3..76f21b8 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x145eb2,_0x396cab){var _0x447d25=function(_0x432b6b){while(--_0x432b6b){_0x145eb2['push'](_0x145eb2['shift']());}};_0x447d25(++_0x396cab);}(_0x7217,0x19e));var _0x7721=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7217[_0x92c450];return _0x2a9599;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x5fc3[_0x1db831];return _0x39ba56;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 4bead56..4d0b935 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 _0xf4eb=['./cmList.attributes','exports','define','cm_lists','lodash','bluebird','rimraf','../../config/environment'];(function(_0x469f02,_0x880250){var _0x1a2a30=function(_0x514b5e){while(--_0x514b5e){_0x469f02['push'](_0x469f02['shift']());}};_0x1a2a30(++_0x880250);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3ff58d,_0x22466c){_0x3ff58d=_0x3ff58d-0x0;var _0x16e2c2=_0xf4eb[_0x3ff58d];return _0x16e2c2;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('CmList',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4522=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api','moment','request-promise'];(function(_0x2bf031,_0x2e84d8){var _0x215504=function(_0x29a760){while(--_0x29a760){_0x2bf031['push'](_0x2bf031['shift']());}};_0x215504(++_0x2e84d8);}(_0x4522,0x1a0));var _0x2452=function(_0x163a8b,_0x2892bd){_0x163a8b=_0x163a8b-0x0;var _0x561894=_0x4522[_0x163a8b];return _0x561894;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var fs=require('fs');var path=require(_0x2452('0x4'));var rimraf=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var attributes=require(_0x2452('0x7'));module[_0x2452('0x8')]=function(_0x15fc69,_0x226578){return _0x15fc69[_0x2452('0x9')](_0x2452('0xa'),attributes,{'tableName':_0x2452('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 3f2b96d..3958d36 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 _0x1394=['client','http','redis','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x16cbb5,_0xff68e6){var _0x518e40=function(_0x3c9d3f){while(--_0x3c9d3f){_0x16cbb5['push'](_0x16cbb5['shift']());}};_0x518e40(++_0xff68e6);}(_0x1394,0x18a));var _0x4139=function(_0x157d92,_0x22ccf6){_0x157d92=_0x157d92-0x0;var _0x4d3385=_0x1394[_0x157d92];return _0x4d3385;};'use strict';var _=require(_0x4139('0x0'));var util=require(_0x4139('0x1'));var moment=require(_0x4139('0x2'));var BPromise=require(_0x4139('0x3'));var rs=require(_0x4139('0x4'));var fs=require('fs');var Redis=require(_0x4139('0x5'));var db=require(_0x4139('0x6'))['db'];var utils=require(_0x4139('0x7'));var logger=require(_0x4139('0x8'))(_0x4139('0x9'));var config=require('../../config/environment');var jayson=require(_0x4139('0xa'));var client=jayson[_0x4139('0xb')][_0x4139('0xc')]({'port':0x232a});config[_0x4139('0xd')]=_['defaults'](config[_0x4139('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4139('0xe'))(new Redis(config['redis']));require('./cmList.socket')[_0x4139('0xf')](socket);function respondWithRpcPromise(_0x4fb75b,_0x865f49,_0x582426){return new BPromise(function(_0x3ac25b,_0x20f157){return client[_0x4139('0x10')](_0x4fb75b,_0x582426)[_0x4139('0x11')](function(_0x229dfa){logger[_0x4139('0x12')](_0x4139('0x13'),_0x865f49,_0x4139('0x14'));logger['debug'](_0x4139('0x15'),_0x865f49,_0x4139('0x14'),JSON[_0x4139('0x16')](_0x229dfa));if(_0x229dfa[_0x4139('0x17')]){if(_0x229dfa[_0x4139('0x17')][_0x4139('0x18')]===0x1f4){logger['error'](_0x4139('0x13'),_0x865f49,_0x229dfa[_0x4139('0x17')][_0x4139('0x19')]);return _0x20f157(_0x229dfa[_0x4139('0x17')][_0x4139('0x19')]);}logger[_0x4139('0x17')](_0x4139('0x13'),_0x865f49,_0x229dfa['error']['message']);return _0x3ac25b(_0x229dfa[_0x4139('0x17')][_0x4139('0x19')]);}else{logger[_0x4139('0x12')](_0x4139('0x13'),_0x865f49,'request\x20sent');_0x3ac25b(_0x229dfa[_0x4139('0x1a')]['message']);}})['catch'](function(_0x951eb2){logger['error'](_0x4139('0x13'),_0x865f49,_0x951eb2);_0x20f157(_0x951eb2);});});} \ No newline at end of file +var _0x26c1=['result','catch','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x395717,_0x49100d){var _0x377855=function(_0x3b30f2){while(--_0x3b30f2){_0x395717['push'](_0x395717['shift']());}};_0x377855(++_0x49100d);}(_0x26c1,0x15b));var _0x126c=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x26c1[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x126c('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x126c('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x126c('0x2'))(_0x126c('0x3'));var config=require(_0x126c('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x126c('0x5')]({'port':0x232a});config[_0x126c('0x6')]=_['defaults'](config[_0x126c('0x6')],{'host':_0x126c('0x7'),'port':0x18eb});var socket=require(_0x126c('0x8'))(new Redis(config[_0x126c('0x6')]));require(_0x126c('0x9'))[_0x126c('0xa')](socket);function respondWithRpcPromise(_0xc6aaf6,_0x51f800,_0x47847a){return new BPromise(function(_0x43a7bf,_0x224225){return client[_0x126c('0xb')](_0xc6aaf6,_0x47847a)[_0x126c('0xc')](function(_0x4426f4){logger[_0x126c('0xd')](_0x126c('0xe'),_0x51f800,'request\x20sent');logger[_0x126c('0xf')]('CmList,\x20%s,\x20%s,\x20%s',_0x51f800,_0x126c('0x10'),JSON[_0x126c('0x11')](_0x4426f4));if(_0x4426f4[_0x126c('0x12')]){if(_0x4426f4[_0x126c('0x12')][_0x126c('0x13')]===0x1f4){logger[_0x126c('0x12')](_0x126c('0xe'),_0x51f800,_0x4426f4[_0x126c('0x12')]['message']);return _0x224225(_0x4426f4[_0x126c('0x12')][_0x126c('0x14')]);}logger[_0x126c('0x12')](_0x126c('0xe'),_0x51f800,_0x4426f4[_0x126c('0x12')][_0x126c('0x14')]);return _0x43a7bf(_0x4426f4[_0x126c('0x12')][_0x126c('0x14')]);}else{logger[_0x126c('0xd')](_0x126c('0xe'),_0x51f800,_0x126c('0x10'));_0x43a7bf(_0x4426f4[_0x126c('0x15')][_0x126c('0x14')]);}})[_0x126c('0x16')](function(_0x3076c0){logger['error'](_0x126c('0xe'),_0x51f800,_0x3076c0);_0x224225(_0x3076c0);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 54e00a1..863f774 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 _0xa060=['register','length','cmList:','./cmList.events','save','removeListener'];(function(_0x1753e0,_0x32ccd4){var _0xc9f908=function(_0x342122){while(--_0x342122){_0x1753e0['push'](_0x1753e0['shift']());}};_0xc9f908(++_0x32ccd4);}(_0xa060,0x1c5));var _0x0a06=function(_0x7a6c79,_0x4b2aad){_0x7a6c79=_0x7a6c79-0x0;var _0x53b8e2=_0xa060[_0x7a6c79];return _0x53b8e2;};'use strict';var CmListEvents=require(_0x0a06('0x0'));var events=[_0x0a06('0x1'),'remove','update'];function createListener(_0x123404,_0x3f654b){return function(_0x2d9e8d){_0x3f654b['emit'](_0x123404,_0x2d9e8d);};}function removeListener(_0x3b1bad,_0x13bfc5){return function(){CmListEvents[_0x0a06('0x2')](_0x3b1bad,_0x13bfc5);};}exports[_0x0a06('0x3')]=function(_0x3ad109){for(var _0x4774b9=0x0,_0x696256=events[_0x0a06('0x4')];_0x4774b9<_0x696256;_0x4774b9++){var _0x164973=events[_0x4774b9];var _0x934b9d=createListener(_0x0a06('0x5')+_0x164973,_0x3ad109);CmListEvents['on'](_0x164973,_0x934b9d);}}; \ No newline at end of file +var _0x1e72=['cmList:','save','emit','register','length'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x1e72,0x182));var _0x21e7=function(_0x11eea8,_0x5f2166){_0x11eea8=_0x11eea8-0x0;var _0x2e431e=_0x1e72[_0x11eea8];return _0x2e431e;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x21e7('0x0'),'remove','update'];function createListener(_0x4e3917,_0x505c6c){return function(_0x2a9b2f){_0x505c6c[_0x21e7('0x1')](_0x4e3917,_0x2a9b2f);};}function removeListener(_0x3f8056,_0x40ac25){return function(){CmListEvents['removeListener'](_0x3f8056,_0x40ac25);};}exports[_0x21e7('0x2')]=function(_0x3df0da){for(var _0x320561=0x0,_0x4fb0fc=events[_0x21e7('0x3')];_0x320561<_0x4fb0fc;_0x320561++){var _0x44697e=events[_0x320561];var _0x257d6f=createListener(_0x21e7('0x4')+_0x44697e,_0x3df0da);CmListEvents['on'](_0x44697e,_0x257d6f);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fadeccc..8fd3d37 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 _0x7521=['../../config/environment','./cmList.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addCustomField','addAgents','update','delete','destroy','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4091ed,_0x57f0fa){var _0x4bfa33=function(_0x380717){while(--_0x380717){_0x4091ed['push'](_0x4091ed['shift']());}};_0x4bfa33(++_0x57f0fa);}(_0x7521,0x8c));var _0x1752=function(_0x2a3d15,_0x39be06){_0x2a3d15=_0x2a3d15-0x0;var _0x45f2b9=_0x7521[_0x2a3d15];return _0x45f2b9;};'use strict';var multer=require(_0x1752('0x0'));var util=require(_0x1752('0x1'));var path=require(_0x1752('0x2'));var timeout=require(_0x1752('0x3'));var express=require(_0x1752('0x4'));var router=express[_0x1752('0x5')]();var fs_extra=require(_0x1752('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1752('0x7'));var config=require(_0x1752('0x8'));var controller=require(_0x1752('0x9'));router[_0x1752('0xa')]('/',auth['isAuthenticated'](),controller[_0x1752('0xb')]);router[_0x1752('0xa')](_0x1752('0xc'),auth['isAuthenticated'](),controller[_0x1752('0xd')]);router[_0x1752('0xa')](_0x1752('0xe'),auth[_0x1752('0xf')](),controller[_0x1752('0x10')]);router[_0x1752('0xa')](_0x1752('0x11'),auth['isAuthenticated'](),controller[_0x1752('0x12')]);router[_0x1752('0xa')](_0x1752('0x13'),auth[_0x1752('0xf')](),controller[_0x1752('0x14')]);router[_0x1752('0xa')](_0x1752('0x15'),auth[_0x1752('0xf')](),controller[_0x1752('0x16')]);router[_0x1752('0xa')](_0x1752('0x17'),auth[_0x1752('0xf')](),controller[_0x1752('0x18')]);router[_0x1752('0xa')]('/:id/users',auth[_0x1752('0xf')](),controller[_0x1752('0x19')]);router[_0x1752('0x1a')]('/',auth[_0x1752('0xf')](),controller[_0x1752('0x1b')]);router[_0x1752('0x1a')]('/:id/dispositions',auth[_0x1752('0xf')](),controller[_0x1752('0x1c')]);router[_0x1752('0x1a')](_0x1752('0x13'),auth[_0x1752('0xf')](),controller['addContacts']);router['post']('/:id/fields',auth[_0x1752('0xf')](),controller[_0x1752('0x1d')]);router[_0x1752('0x1a')]('/:id/users',auth[_0x1752('0xf')](),controller[_0x1752('0x1e')]);router['put'](_0x1752('0xe'),auth[_0x1752('0xf')](),controller[_0x1752('0x1f')]);router[_0x1752('0x20')](_0x1752('0xe'),auth[_0x1752('0xf')](),controller[_0x1752('0x21')]);router[_0x1752('0x20')](_0x1752('0x11'),auth[_0x1752('0xf')](),controller['removeDispositions']);router['delete'](_0x1752('0x22'),auth[_0x1752('0xf')](),controller[_0x1752('0x23')]);module[_0x1752('0x24')]=router; \ No newline at end of file +var _0x3fdd=['put','delete','removeDispositions','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents'];(function(_0x460358,_0x354877){var _0xdfdfa8=function(_0x4cc317){while(--_0x4cc317){_0x460358['push'](_0x460358['shift']());}};_0xdfdfa8(++_0x354877);}(_0x3fdd,0x158));var _0xd3fd=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x3fdd[_0x3e0b8f];return _0x22f742;};'use strict';var multer=require('multer');var util=require(_0xd3fd('0x0'));var path=require(_0xd3fd('0x1'));var timeout=require(_0xd3fd('0x2'));var express=require('express');var router=express[_0xd3fd('0x3')]();var fs_extra=require(_0xd3fd('0x4'));var auth=require(_0xd3fd('0x5'));var interaction=require(_0xd3fd('0x6'));var config=require(_0xd3fd('0x7'));var controller=require(_0xd3fd('0x8'));router[_0xd3fd('0x9')]('/',auth[_0xd3fd('0xa')](),controller[_0xd3fd('0xb')]);router[_0xd3fd('0x9')](_0xd3fd('0xc'),auth['isAuthenticated'](),controller[_0xd3fd('0xd')]);router[_0xd3fd('0x9')](_0xd3fd('0xe'),auth[_0xd3fd('0xa')](),controller[_0xd3fd('0xf')]);router[_0xd3fd('0x9')](_0xd3fd('0x10'),auth[_0xd3fd('0xa')](),controller[_0xd3fd('0x11')]);router[_0xd3fd('0x9')](_0xd3fd('0x12'),auth[_0xd3fd('0xa')](),controller['getContacts']);router[_0xd3fd('0x9')](_0xd3fd('0x13'),auth[_0xd3fd('0xa')](),controller[_0xd3fd('0x14')]);router[_0xd3fd('0x9')]('/:id/fields',auth[_0xd3fd('0xa')](),controller[_0xd3fd('0x15')]);router['get'](_0xd3fd('0x16'),auth[_0xd3fd('0xa')](),controller['getAgents']);router[_0xd3fd('0x17')]('/',auth[_0xd3fd('0xa')](),controller[_0xd3fd('0x18')]);router[_0xd3fd('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd3fd('0x19')]);router['post'](_0xd3fd('0x12'),auth[_0xd3fd('0xa')](),controller[_0xd3fd('0x1a')]);router[_0xd3fd('0x17')](_0xd3fd('0x1b'),auth[_0xd3fd('0xa')](),controller[_0xd3fd('0x1c')]);router[_0xd3fd('0x17')]('/:id/users',auth[_0xd3fd('0xa')](),controller[_0xd3fd('0x1d')]);router[_0xd3fd('0x1e')](_0xd3fd('0xe'),auth[_0xd3fd('0xa')](),controller['update']);router['delete'](_0xd3fd('0xe'),auth[_0xd3fd('0xa')](),controller['destroy']);router[_0xd3fd('0x1f')](_0xd3fd('0x10'),auth[_0xd3fd('0xa')](),controller[_0xd3fd('0x20')]);router[_0xd3fd('0x1f')](_0xd3fd('0x16'),auth[_0xd3fd('0xa')](),controller['removeAgents']);module[_0xd3fd('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 bbedce9..9974be6 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 _0x0315=['STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x5aa79e,_0x192d49){var _0x9790f7=function(_0x42f20c){while(--_0x42f20c){_0x5aa79e['push'](_0x5aa79e['shift']());}};_0x9790f7(++_0x192d49);}(_0x0315,0x1a5));var _0x5031=function(_0xeb54bb,_0x2d8002){_0xeb54bb=_0xeb54bb-0x0;var _0x4d430f=_0x0315[_0xeb54bb];return _0x4d430f;};'use strict';var Sequelize=require(_0x5031('0x0'));module[_0x5031('0x1')]={'name':{'type':Sequelize[_0x5031('0x2')],'get':function(_0x4eb04c){return this[_0x5031('0x3')]('field');}},'field':{'type':Sequelize[_0x5031('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x5031('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x5031('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xaa36=['exports','getDataValue','field','STRING','sequelize'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xaa36,0x194));var _0x6aa3=function(_0x4a22df,_0x2b7698){_0x4a22df=_0x4a22df-0x0;var _0x25b34f=_0xaa36[_0x4a22df];return _0x25b34f;};'use strict';var Sequelize=require(_0x6aa3('0x0'));module[_0x6aa3('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x210e68){return this[_0x6aa3('0x2')](_0x6aa3('0x3'));}},'field':{'type':Sequelize[_0x6aa3('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x6aa3('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x6aa3('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 5603a8b..df8e1cd 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(_0x5084d7,_0x4960fa){var _0x1d5b4c=function(_0x565ab7){while(--_0x565ab7){_0x5084d7['push'](_0x5084d7['shift']());}};_0x1d5b4c(++_0x4960fa);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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(_0x43ea44,_0xadf459){var _0x35f6d4=function(_0x59a287){while(--_0x59a287){_0x43ea44['push'](_0x43ea44['shift']());}};_0x35f6d4(++_0xadf459);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index e3060a6..9ce81c0 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 _0xd0d5=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./condition.attributes','define','tools_conditions','lodash','util'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xd0d5,0x1a2));var _0x5d0d=function(_0x341562,_0x30546d){_0x341562=_0x341562-0x0;var _0x473280=_0xd0d5[_0x341562];return _0x473280;};'use strict';var _=require(_0x5d0d('0x0'));var util=require(_0x5d0d('0x1'));var logger=require(_0x5d0d('0x2'))('api');var moment=require(_0x5d0d('0x3'));var BPromise=require(_0x5d0d('0x4'));var rp=require(_0x5d0d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5d0d('0x6'));var attributes=require(_0x5d0d('0x7'));module['exports']=function(_0x5ad866,_0x4d17c7){return _0x5ad866[_0x5d0d('0x8')]('Condition',attributes,{'tableName':_0x5d0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x243b=['lodash','moment','bluebird','rimraf','./condition.attributes','exports','Condition','tools_conditions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x243b,0x188));var _0xb243=function(_0xdcd9a9,_0x56e3cc){_0xdcd9a9=_0xdcd9a9-0x0;var _0x3f7378=_0x243b[_0xdcd9a9];return _0x3f7378;};'use strict';var _=require(_0xb243('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb243('0x1'));var BPromise=require(_0xb243('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb243('0x3'));var config=require('../../config/environment');var attributes=require(_0xb243('0x4'));module[_0xb243('0x5')]=function(_0x53a182,_0x57f1a9){return _0x53a182['define'](_0xb243('0x6'),attributes,{'tableName':_0xb243('0x7'),'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 6087557..fd1f579 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 _0x1c87=['rpc','../../config/environment','client','http','then','Condition,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1c87,0x110));var _0x71c8=function(_0x2d7e63,_0xa99b70){_0x2d7e63=_0x2d7e63-0x0;var _0x193be8=_0x1c87[_0x2d7e63];return _0x193be8;};'use strict';var _=require(_0x71c8('0x0'));var util=require(_0x71c8('0x1'));var moment=require(_0x71c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x71c8('0x3'));var fs=require('fs');var Redis=require(_0x71c8('0x4'));var db=require(_0x71c8('0x5'))['db'];var utils=require(_0x71c8('0x6'));var logger=require(_0x71c8('0x7'))(_0x71c8('0x8'));var config=require(_0x71c8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x71c8('0xa')][_0x71c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf7c83d,_0x8dfb65,_0x4698d0){return new BPromise(function(_0x26477f,_0x4283f6){return client['request'](_0xf7c83d,_0x4698d0)[_0x71c8('0xc')](function(_0x383c9f){logger['info'](_0x71c8('0xd'),_0x8dfb65,_0x71c8('0xe'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x8dfb65,_0x71c8('0xe'),JSON['stringify'](_0x383c9f));if(_0x383c9f['error']){if(_0x383c9f[_0x71c8('0xf')][_0x71c8('0x10')]===0x1f4){logger[_0x71c8('0xf')](_0x71c8('0xd'),_0x8dfb65,_0x383c9f['error'][_0x71c8('0x11')]);return _0x4283f6(_0x383c9f[_0x71c8('0xf')][_0x71c8('0x11')]);}logger['error'](_0x71c8('0xd'),_0x8dfb65,_0x383c9f['error'][_0x71c8('0x11')]);return _0x26477f(_0x383c9f[_0x71c8('0xf')][_0x71c8('0x11')]);}else{logger['info'](_0x71c8('0xd'),_0x8dfb65,_0x71c8('0xe'));_0x26477f(_0x383c9f[_0x71c8('0x12')][_0x71c8('0x11')]);}})[_0x71c8('0x13')](function(_0x4234f3){logger[_0x71c8('0xf')](_0x71c8('0xd'),_0x8dfb65,_0x4234f3);_0x4283f6(_0x4234f3);});});} \ No newline at end of file +var _0xbdcf=['http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0xbdcf,0x116));var _0xfbdc=function(_0x456770,_0x597caa){_0x456770=_0x456770-0x0;var _0x1d4cc7=_0xbdcf[_0x456770];return _0x1d4cc7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbdc('0x0'));var BPromise=require(_0xfbdc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbdc('0x2'));var db=require(_0xfbdc('0x3'))['db'];var utils=require(_0xfbdc('0x4'));var logger=require(_0xfbdc('0x5'))(_0xfbdc('0x6'));var config=require(_0xfbdc('0x7'));var jayson=require(_0xfbdc('0x8'));var client=jayson[_0xfbdc('0x9')][_0xfbdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a2e67,_0x4ccc1a,_0x31ff9c){return new BPromise(function(_0x37ed0a,_0x3d6134){return client[_0xfbdc('0xb')](_0x5a2e67,_0x31ff9c)[_0xfbdc('0xc')](function(_0x4e25e1){logger['info'](_0xfbdc('0xd'),_0x4ccc1a,_0xfbdc('0xe'));logger[_0xfbdc('0xf')](_0xfbdc('0x10'),_0x4ccc1a,'request\x20sent',JSON[_0xfbdc('0x11')](_0x4e25e1));if(_0x4e25e1[_0xfbdc('0x12')]){if(_0x4e25e1[_0xfbdc('0x12')][_0xfbdc('0x13')]===0x1f4){logger[_0xfbdc('0x12')]('Condition,\x20%s,\x20%s',_0x4ccc1a,_0x4e25e1[_0xfbdc('0x12')][_0xfbdc('0x14')]);return _0x3d6134(_0x4e25e1[_0xfbdc('0x12')][_0xfbdc('0x14')]);}logger[_0xfbdc('0x12')](_0xfbdc('0xd'),_0x4ccc1a,_0x4e25e1[_0xfbdc('0x12')][_0xfbdc('0x14')]);return _0x37ed0a(_0x4e25e1['error'][_0xfbdc('0x14')]);}else{logger[_0xfbdc('0x15')](_0xfbdc('0xd'),_0x4ccc1a,'request\x20sent');_0x37ed0a(_0x4e25e1[_0xfbdc('0x16')][_0xfbdc('0x14')]);}})[_0xfbdc('0x17')](function(_0x402cb1){logger[_0xfbdc('0x12')](_0xfbdc('0xd'),_0x4ccc1a,_0x402cb1);_0x3d6134(_0x402cb1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index f660ca9..fa14ccf 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 _0x7fcf=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x248ccc,_0x218ef3){var _0x535509=function(_0x5b7eab){while(--_0x5b7eab){_0x248ccc['push'](_0x248ccc['shift']());}};_0x535509(++_0x218ef3);}(_0x7fcf,0x1af));var _0xf7fc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7fcf[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xf7fc('0x0'));var util=require(_0xf7fc('0x1'));var path=require(_0xf7fc('0x2'));var timeout=require(_0xf7fc('0x3'));var express=require('express');var router=express[_0xf7fc('0x4')]();var fs_extra=require(_0xf7fc('0x5'));var auth=require(_0xf7fc('0x6'));var interaction=require(_0xf7fc('0x7'));var config=require(_0xf7fc('0x8'));var controller=require(_0xf7fc('0x9'));router[_0xf7fc('0xa')](_0xf7fc('0xb'),auth[_0xf7fc('0xc')](),controller[_0xf7fc('0xd')]);router[_0xf7fc('0xe')](_0xf7fc('0xb'),auth[_0xf7fc('0xc')](),controller[_0xf7fc('0xf')]);module[_0xf7fc('0x10')]=router; \ No newline at end of file +var _0x20ae=['../../config/environment','put','update','delete','/:id','isAuthenticated','exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x8212b9,_0x4b8686){var _0x10184c=function(_0x43292c){while(--_0x43292c){_0x8212b9['push'](_0x8212b9['shift']());}};_0x10184c(++_0x4b8686);}(_0x20ae,0xbb));var _0xe20a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x20ae[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xe20a('0x0'));var util=require('util');var path=require(_0xe20a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe20a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe20a('0x3'));var interaction=require(_0xe20a('0x4'));var config=require(_0xe20a('0x5'));var controller=require('./condition.controller');router[_0xe20a('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe20a('0x7')]);router[_0xe20a('0x8')](_0xe20a('0x9'),auth[_0xe20a('0xa')](),controller['destroy']);module[_0xe20a('0xb')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a991104..23d27bc 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 _0xd8b0=['exports','sequelize'];(function(_0x492b54,_0x4bf46a){var _0x210357=function(_0x5759d6){while(--_0x5759d6){_0x492b54['push'](_0x492b54['shift']());}};_0x210357(++_0x4bf46a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3d9da9,_0x4e48b0){var _0xf50cfc=function(_0x9d6cd6){while(--_0x9d6cd6){_0x3d9da9['push'](_0x3d9da9['shift']());}};_0xf50cfc(++_0x4e48b0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b48dce7..6a0721a 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 _0x13fd=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','findAll','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','options','createdAt','omit','body','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','pick','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','lodash','crypto','to-csv','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','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','index','map','Dashboard','rawAttributes'];(function(_0x4c4974,_0x10f946){var _0x13b70d=function(_0x402252){while(--_0x402252){_0x4c4974['push'](_0x4c4974['shift']());}};_0x13b70d(++_0x10f946);}(_0x13fd,0x1b8));var _0xd13f=function(_0x406ec7,_0x5e6a65){_0x406ec7=_0x406ec7-0x0;var _0x188897=_0x13fd[_0x406ec7];return _0x188897;};'use strict';var emlformat=require(_0xd13f('0x0'));var rimraf=require(_0xd13f('0x1'));var zipdir=require(_0xd13f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd13f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd13f('0x4'));var util=require(_0xd13f('0x5'));var path=require(_0xd13f('0x6'));var sox=require(_0xd13f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd13f('0x8'));var squel=require('squel');var crypto=require(_0xd13f('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd13f('0xa'));var querystring=require(_0xd13f('0xb'));var Papa=require(_0xd13f('0xc'));var Redis=require(_0xd13f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd13f('0xe'));var as=require(_0xd13f('0xf'));var hardwareService=require(_0xd13f('0x10'));var logger=require(_0xd13f('0x11'))(_0xd13f('0x12'));var utils=require(_0xd13f('0x13'));var config=require(_0xd13f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd13f('0x15'))['db'];config[_0xd13f('0x16')]=_[_0xd13f('0x17')](config['redis'],{'host':_0xd13f('0x18'),'port':0x18eb});var socket=require(_0xd13f('0x19'))(new Redis(config[_0xd13f('0x16')]));require('./dashboard.socket')[_0xd13f('0x1a')](socket);function respondWithStatusCode(_0x3fe00d,_0x827e78){_0x827e78=_0x827e78||0xcc;return function(_0x79755e){if(_0x79755e){return _0x3fe00d['sendStatus'](_0x827e78);}return _0x3fe00d[_0xd13f('0x1b')](_0x827e78)[_0xd13f('0x1c')]();};}function respondWithResult(_0x1e4944,_0x23fe22){_0x23fe22=_0x23fe22||0xc8;return function(_0x428d45){if(_0x428d45){return _0x1e4944['status'](_0x23fe22)[_0xd13f('0x1d')](_0x428d45);}};}function respondWithFilteredResult(_0x2c5497,_0xb08b38){return function(_0x426e83){if(_0x426e83){var _0x3b10d9=typeof _0xb08b38['offset']===_0xd13f('0x1e')&&typeof _0xb08b38[_0xd13f('0x1f')]===_0xd13f('0x1e');var _0x31d8e1=_0x426e83[_0xd13f('0x20')];var _0x29ecc0=_0x3b10d9?0x0:_0xb08b38[_0xd13f('0x21')];var _0x42d82b=_0x3b10d9?_0x426e83[_0xd13f('0x20')]:_0xb08b38[_0xd13f('0x21')]+_0xb08b38[_0xd13f('0x1f')];var _0x5113d6;if(_0x42d82b>=_0x31d8e1){_0x42d82b=_0x31d8e1;_0x5113d6=0xc8;}else{_0x5113d6=0xce;}_0x2c5497[_0xd13f('0x1b')](_0x5113d6);return _0x2c5497[_0xd13f('0x22')](_0xd13f('0x23'),_0x29ecc0+'-'+_0x42d82b+'/'+_0x31d8e1)[_0xd13f('0x1d')](_0x426e83);}return null;};}function patchUpdates(_0x262644){return function(_0x465b3f){try{jsonpatch[_0xd13f('0x24')](_0x465b3f,_0x262644,!![]);}catch(_0x238a7c){return BPromise[_0xd13f('0x25')](_0x238a7c);}return _0x465b3f[_0xd13f('0x26')]();};}function saveUpdates(_0x618dbe,_0xc2c98b){return function(_0xf44a1f){if(_0xf44a1f){return _0xf44a1f['update'](_0x618dbe)[_0xd13f('0x27')](function(_0x3a3562){return _0x3a3562;});}return null;};}function removeEntity(_0x5098af,_0x3fca3d){return function(_0xbc34ba){if(_0xbc34ba){return _0xbc34ba[_0xd13f('0x28')]()[_0xd13f('0x27')](function(){var _0xf1b5b6=_0xbc34ba[_0xd13f('0x29')]({'plain':!![]});var _0x43d5ba=_0xd13f('0x2a');return db[_0xd13f('0x2b')]['destroy']({'where':{'type':_0x43d5ba,'resourceId':_0xf1b5b6['id']}})[_0xd13f('0x27')](function(){return _0xbc34ba;});})[_0xd13f('0x27')](function(){_0x5098af['status'](0xcc)[_0xd13f('0x1c')]();});}};}function handleEntityNotFound(_0x3e5aa1,_0x301593){return function(_0x5149ac){if(!_0x5149ac){_0x3e5aa1[_0xd13f('0x2c')](0x194);}return _0x5149ac;};}function handleError(_0x21de68,_0x406256){_0x406256=_0x406256||0x1f4;return function(_0x3bf192){logger[_0xd13f('0x2d')](_0x3bf192[_0xd13f('0x2e')]);if(_0x3bf192[_0xd13f('0x2f')]){delete _0x3bf192[_0xd13f('0x2f')];}_0x21de68['status'](_0x406256)['send'](_0x3bf192);};}exports[_0xd13f('0x30')]=function(_0x3c88f7,_0x1bc357){var _0xccd44d={},_0x106b0e={},_0x35fb9c={'count':0x0,'rows':[]};var _0x438ed2=_[_0xd13f('0x31')](db[_0xd13f('0x32')][_0xd13f('0x33')],function(_0xef9b49){return{'name':_0xef9b49[_0xd13f('0x34')],'type':_0xef9b49['type'][_0xd13f('0x35')]};});_0x106b0e[_0xd13f('0x36')]=_[_0xd13f('0x31')](_0x438ed2,_0xd13f('0x2f'));_0x106b0e[_0xd13f('0x37')]=_[_0xd13f('0x38')](_0x3c88f7['query']);_0x106b0e[_0xd13f('0x39')]=_[_0xd13f('0x3a')](_0x106b0e['model'],_0x106b0e[_0xd13f('0x37')]);_0xccd44d[_0xd13f('0x3b')]=_[_0xd13f('0x3a')](_0x106b0e[_0xd13f('0x36')],qs[_0xd13f('0x3c')](_0x3c88f7[_0xd13f('0x37')][_0xd13f('0x3c')]));_0xccd44d['attributes']=_0xccd44d[_0xd13f('0x3b')][_0xd13f('0x3d')]?_0xccd44d[_0xd13f('0x3b')]:_0x106b0e['model'];if(!_0x3c88f7[_0xd13f('0x37')][_0xd13f('0x3e')](_0xd13f('0x3f'))){_0xccd44d[_0xd13f('0x1f')]=qs[_0xd13f('0x1f')](_0x3c88f7[_0xd13f('0x37')]['limit']);_0xccd44d[_0xd13f('0x21')]=qs[_0xd13f('0x21')](_0x3c88f7[_0xd13f('0x37')][_0xd13f('0x21')]);}_0xccd44d[_0xd13f('0x40')]=qs[_0xd13f('0x41')](_0x3c88f7[_0xd13f('0x37')][_0xd13f('0x41')]);_0xccd44d[_0xd13f('0x42')]=qs['filters'](_['pick'](_0x3c88f7[_0xd13f('0x37')],_0x106b0e['filters']),_0x438ed2);if(_0x3c88f7[_0xd13f('0x37')][_0xd13f('0x43')]){_0xccd44d['where']=_['merge'](_0xccd44d['where'],{'$or':_[_0xd13f('0x31')](_0x438ed2,function(_0x16e122){if(_0x16e122[_0xd13f('0x44')]!==_0xd13f('0x45')){var _0x56aaea={};_0x56aaea[_0x16e122[_0xd13f('0x2f')]]={'$like':'%'+_0x3c88f7[_0xd13f('0x37')][_0xd13f('0x43')]+'%'};return _0x56aaea;}})});}_0xccd44d=_[_0xd13f('0x46')]({},_0xccd44d,_0x3c88f7['options']);var _0x3b8847={'where':_0xccd44d[_0xd13f('0x42')]};return db[_0xd13f('0x32')][_0xd13f('0x20')](_0x3b8847)[_0xd13f('0x27')](function(_0x2548fb){_0x35fb9c['count']=_0x2548fb;if(_0x3c88f7[_0xd13f('0x37')][_0xd13f('0x47')]){_0xccd44d[_0xd13f('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0xd13f('0x49')](_0xccd44d);})[_0xd13f('0x27')](function(_0x5d6002){_0x35fb9c[_0xd13f('0x4a')]=_0x5d6002;return _0x35fb9c;})[_0xd13f('0x27')](respondWithFilteredResult(_0x1bc357,_0xccd44d))[_0xd13f('0x4b')](handleError(_0x1bc357,null));};exports[_0xd13f('0x4c')]=function(_0x5adad1,_0x346468){var _0x477692={'raw':![],'where':{'id':_0x5adad1[_0xd13f('0x4d')]['id']}},_0xa13df2={};_0xa13df2[_0xd13f('0x36')]=_[_0xd13f('0x38')](db[_0xd13f('0x32')][_0xd13f('0x33')]);_0xa13df2[_0xd13f('0x37')]=_[_0xd13f('0x38')](_0x5adad1[_0xd13f('0x37')]);_0xa13df2[_0xd13f('0x39')]=_[_0xd13f('0x3a')](_0xa13df2[_0xd13f('0x36')],_0xa13df2[_0xd13f('0x37')]);_0x477692[_0xd13f('0x3b')]=_[_0xd13f('0x3a')](_0xa13df2[_0xd13f('0x36')],qs[_0xd13f('0x3c')](_0x5adad1[_0xd13f('0x37')][_0xd13f('0x3c')]));_0x477692[_0xd13f('0x3b')]=_0x477692[_0xd13f('0x3b')]['length']?_0x477692[_0xd13f('0x3b')]:_0xa13df2[_0xd13f('0x36')];if(_0x5adad1['query'][_0xd13f('0x47')]){_0x477692[_0xd13f('0x48')]=[{'all':!![]}];}_0x477692=_[_0xd13f('0x46')]({},_0x477692,_0x5adad1['options']);return db[_0xd13f('0x32')][_0xd13f('0x4e')](_0x477692)[_0xd13f('0x27')](handleEntityNotFound(_0x346468,null))[_0xd13f('0x27')](respondWithResult(_0x346468,null))['catch'](handleError(_0x346468,null));};exports[_0xd13f('0x4f')]=function(_0x5c3988,_0x13818d){return db[_0xd13f('0x32')]['create'](_0x5c3988['body'],{})[_0xd13f('0x27')](function(_0x5c1850){var _0x2a5337=_0x5c3988[_0xd13f('0x50')]['get']({'plain':!![]});if(!_0x2a5337)throw new Error(_0xd13f('0x51'));if(_0x2a5337[_0xd13f('0x52')]===_0xd13f('0x50')){var _0x5e9dbf=_0x5c1850['get']({'plain':!![]});var _0xbc2e3e='CustomDashboards';return db[_0xd13f('0x53')][_0xd13f('0x4e')]({'where':{'name':_0xbc2e3e,'userProfileId':_0x2a5337[_0xd13f('0x54')]},'raw':!![]})['then'](function(_0x113789){if(_0x113789&&_0x113789[_0xd13f('0x55')]===0x0){return db[_0xd13f('0x2b')][_0xd13f('0x4f')]({'name':_0x5e9dbf['name'],'resourceId':_0x5e9dbf['id'],'type':_0x113789[_0xd13f('0x2f')],'sectionId':_0x113789['id']},{})[_0xd13f('0x27')](function(){return _0x5c1850;});}else{return _0x5c1850;}})[_0xd13f('0x4b')](function(_0x4655b7){logger[_0xd13f('0x2d')](_0xd13f('0x56'),_0x4655b7);throw _0x4655b7;});}return _0x5c1850;})[_0xd13f('0x27')](respondWithResult(_0x13818d,0xc9))[_0xd13f('0x4b')](handleError(_0x13818d,null));};exports[_0xd13f('0x57')]=function(_0x49ef58,_0x850de8){var _0x148d4a={'where':{'id':_0x49ef58[_0xd13f('0x4d')]['id']}},_0x3a13cf={};_0x3a13cf[_0xd13f('0x36')]=_[_0xd13f('0x38')](db[_0xd13f('0x32')]['rawAttributes']);_0x148d4a[_0xd13f('0x3b')]=_[_0xd13f('0x3a')](_0x3a13cf[_0xd13f('0x36')],qs[_0xd13f('0x3c')](_0x49ef58['query'][_0xd13f('0x3c')]));_0x148d4a['attributes']=_0x148d4a[_0xd13f('0x3b')][_0xd13f('0x3d')]?_0x148d4a[_0xd13f('0x3b')]:_0x3a13cf[_0xd13f('0x36')];if(_0x49ef58[_0xd13f('0x37')]['includeAll']){_0x148d4a[_0xd13f('0x48')]=[{'all':!![]}];}_0x148d4a=_[_0xd13f('0x46')]({},_0x148d4a,_0x49ef58[_0xd13f('0x58')]);return db['Dashboard']['find'](_0x148d4a)[_0xd13f('0x27')](handleEntityNotFound(_0x850de8,null))[_0xd13f('0x27')](function(_0x1920cb){if(_0x1920cb){var _0x17d5f1=_0x1920cb[_0xd13f('0x29')]({'plain':!![]});_0x17d5f1=qs['omit'](_0x17d5f1,['id',_0xd13f('0x59'),'updatedAt']);_0x49ef58['body']=_[_0xd13f('0x5a')](_0x49ef58[_0xd13f('0x5b')],['id','createdAt',_0xd13f('0x5c')]);return db[_0xd13f('0x32')]['create'](_[_0xd13f('0x46')](_0x17d5f1,_0x49ef58[_0xd13f('0x5b')]),{'include':_0x49ef58[_0xd13f('0x37')][_0xd13f('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3813){var _0x4d63bc=_0x49ef58[_0xd13f('0x50')][_0xd13f('0x29')]({'plain':!![]});if(!_0x4d63bc)throw new Error(_0xd13f('0x51'));if(_0x4d63bc[_0xd13f('0x52')]===_0xd13f('0x50')){var _0xc5c77c=_0x3b3813[_0xd13f('0x29')]({'plain':!![]});var _0x365595=_0xd13f('0x2a');return db[_0xd13f('0x53')]['find']({'where':{'name':_0x365595,'userProfileId':_0x4d63bc[_0xd13f('0x54')]},'raw':!![]})[_0xd13f('0x27')](function(_0x112646){if(_0x112646&&_0x112646['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xc5c77c[_0xd13f('0x2f')],'resourceId':_0xc5c77c['id'],'type':_0x112646[_0xd13f('0x2f')],'sectionId':_0x112646['id']},{})[_0xd13f('0x27')](function(){return _0x3b3813;});}else{return _0x3b3813;}})[_0xd13f('0x4b')](function(_0x13001e){logger[_0xd13f('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13001e);throw _0x13001e;});}return _0x3b3813;});}})[_0xd13f('0x27')](respondWithResult(_0x850de8,0xc9))[_0xd13f('0x4b')](handleError(_0x850de8,null));};exports['update']=function(_0xea02ec,_0x153756){if(_0xea02ec['body']['id']){delete _0xea02ec[_0xd13f('0x5b')]['id'];}return db[_0xd13f('0x32')][_0xd13f('0x4e')]({'where':{'id':_0xea02ec[_0xd13f('0x4d')]['id']}})[_0xd13f('0x27')](handleEntityNotFound(_0x153756,null))[_0xd13f('0x27')](saveUpdates(_0xea02ec[_0xd13f('0x5b')],null))['then'](respondWithResult(_0x153756,null))[_0xd13f('0x4b')](handleError(_0x153756,null));};exports[_0xd13f('0x28')]=function(_0x324981,_0x3b0a4d){return db[_0xd13f('0x32')][_0xd13f('0x4e')]({'where':{'id':_0x324981[_0xd13f('0x4d')]['id']}})[_0xd13f('0x27')](handleEntityNotFound(_0x3b0a4d,null))[_0xd13f('0x27')](removeEntity(_0x3b0a4d,null))[_0xd13f('0x4b')](handleError(_0x3b0a4d,null));};function widgetAttributes(_0x5ea296){try{switch(_0x5ea296[_0xd13f('0x44')]){case _0xd13f('0x5d'):return[{'name':_0xd13f('0x5e'),'value':_0x5ea296['attrUrl']||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296['attrs'][0x0]?_0x5ea296[_0xd13f('0x5f')][0x0][_0xd13f('0x60')]:undefined)||_0xd13f('0x61')}];case _0xd13f('0x62'):return[{'name':_0xd13f('0x63'),'value':_0x5ea296[_0xd13f('0x63')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x0]?_0x5ea296[_0xd13f('0x5f')][0x0][_0xd13f('0x60')]:undefined)||''}];case _0xd13f('0x64'):return[{'name':_0xd13f('0x65'),'value':_0x5ea296[_0xd13f('0x65')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x0]?_0x5ea296[_0xd13f('0x5f')][0x0][_0xd13f('0x60')]:undefined)||_0xd13f('0x66')},{'name':_0xd13f('0x67'),'value':_0x5ea296[_0xd13f('0x67')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x1]?_0x5ea296[_0xd13f('0x5f')][0x1][_0xd13f('0x60')]:undefined)||_0xd13f('0x68')},{'name':_0xd13f('0x69'),'value':_0x5ea296[_0xd13f('0x69')]||(_0x5ea296['attrs']&&_0x5ea296[_0xd13f('0x5f')][0x2]?_0x5ea296[_0xd13f('0x5f')][0x2][_0xd13f('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0xd13f('0x6a'),'value':_0x5ea296[_0xd13f('0x6a')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x0]?_0x5ea296[_0xd13f('0x5f')][0x0][_0xd13f('0x60')]:undefined)||_0xd13f('0x6b')},{'name':_0xd13f('0x6c'),'value':_0x5ea296[_0xd13f('0x6c')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296['attrs'][0x1]?_0x5ea296[_0xd13f('0x5f')][0x1][_0xd13f('0x60')]:undefined)||[]},{'name':_0xd13f('0x69'),'value':_0x5ea296[_0xd13f('0x69')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x2]?_0x5ea296[_0xd13f('0x5f')][0x2][_0xd13f('0x60')]:undefined)||0x14}];case _0xd13f('0x6d'):case _0xd13f('0x6e'):return[{'name':_0xd13f('0x6f'),'value':_0x5ea296[_0xd13f('0x6f')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x0]?_0x5ea296[_0xd13f('0x5f')][0x0]['value']:undefined)||_0xd13f('0x6b')},{'name':_0xd13f('0x70'),'value':_0x5ea296['attrSerie2']||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296['attrs'][0x1]?_0x5ea296[_0xd13f('0x5f')][0x1][_0xd13f('0x60')]:undefined)||null},{'name':_0xd13f('0x71'),'value':_0x5ea296[_0xd13f('0x71')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296['attrs'][0x2]?_0x5ea296[_0xd13f('0x5f')][0x2][_0xd13f('0x60')]:undefined)||null},{'name':_0xd13f('0x6c'),'value':_0x5ea296[_0xd13f('0x6c')]||(_0x5ea296['attrs']&&_0x5ea296[_0xd13f('0x5f')][0x3]?_0x5ea296[_0xd13f('0x5f')][0x3]['value']:undefined)||[]}];case _0xd13f('0x72'):return[{'name':_0xd13f('0x73'),'type':_0x5ea296['reportType']||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x0]?_0x5ea296[_0xd13f('0x5f')][0x0][_0xd13f('0x44')]:undefined)||null,'value':_0x5ea296[_0xd13f('0x73')]||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x0]?_0x5ea296[_0xd13f('0x5f')][0x0][_0xd13f('0x60')]:undefined)||null},{'name':_0xd13f('0x74'),'value':_0x5ea296['attrRefresh']||(_0x5ea296[_0xd13f('0x5f')]&&_0x5ea296[_0xd13f('0x5f')][0x1]?_0x5ea296[_0xd13f('0x5f')][0x1][_0xd13f('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x4c0127){logger[_0xd13f('0x2d')](_0xd13f('0x75'),JSON[_0xd13f('0x76')](_0x4c0127));return[];}}exports[_0xd13f('0x77')]=function(_0x239ce5,_0x1de271,_0x2e58ff){if(_0x239ce5['body']['id']){delete _0x239ce5[_0xd13f('0x5b')]['id'];}return db[_0xd13f('0x32')][_0xd13f('0x4e')]({'where':{'id':_0x239ce5[_0xd13f('0x4d')]['id']}})[_0xd13f('0x27')](handleEntityNotFound(_0x1de271,null))[_0xd13f('0x27')](function(_0x940f7d){if(_0x940f7d){_0x239ce5[_0xd13f('0x5b')]['DashboardId']=_0x940f7d['id'];_0x239ce5[_0xd13f('0x5b')][_0xd13f('0x5f')]=widgetAttributes(_0x239ce5[_0xd13f('0x5b')]);return db[_0xd13f('0x78')][_0xd13f('0x4f')](_0x239ce5[_0xd13f('0x5b')]);}})[_0xd13f('0x27')](respondWithResult(_0x1de271,null))[_0xd13f('0x4b')](handleError(_0x1de271,null));};exports[_0xd13f('0x79')]=function(_0x588d71,_0x59c365,_0x331595){var _0x1a76c6={};var _0x480801={};var _0xc68bd4;var _0x57547b;return db[_0xd13f('0x32')]['findOne']({'where':{'id':_0x588d71[_0xd13f('0x4d')]['id']}})[_0xd13f('0x27')](handleEntityNotFound(_0x59c365,null))['then'](function(_0x4bc762){if(_0x4bc762){_0xc68bd4=_0x4bc762;_0x480801['model']=_[_0xd13f('0x38')](db[_0xd13f('0x78')]['rawAttributes']);_0x480801['query']=_['keys'](_0x588d71[_0xd13f('0x37')]);_0x480801[_0xd13f('0x39')]=_[_0xd13f('0x3a')](_0x480801['model'],_0x480801[_0xd13f('0x37')]);_0x1a76c6['attributes']=_[_0xd13f('0x3a')](_0x480801[_0xd13f('0x36')],qs['fields'](_0x588d71[_0xd13f('0x37')][_0xd13f('0x3c')]));_0x1a76c6['attributes']=_0x1a76c6['attributes']['length']?_0x1a76c6[_0xd13f('0x3b')]:_0x480801[_0xd13f('0x36')];_0x1a76c6[_0xd13f('0x40')]=qs[_0xd13f('0x41')](_0x588d71[_0xd13f('0x37')][_0xd13f('0x41')]);_0x1a76c6[_0xd13f('0x42')]=qs[_0xd13f('0x39')](_[_0xd13f('0x7a')](_0x588d71['query'],_0x480801[_0xd13f('0x39')]));if(_0x588d71[_0xd13f('0x37')][_0xd13f('0x43')]){_0x1a76c6[_0xd13f('0x42')]=_['merge'](_0x1a76c6[_0xd13f('0x42')],{'$or':_[_0xd13f('0x31')](_0x1a76c6[_0xd13f('0x3b')],function(_0x58a65e){var _0x403bdd={};_0x403bdd[_0x58a65e]={'$like':'%'+_0x588d71[_0xd13f('0x37')][_0xd13f('0x43')]+'%'};return _0x403bdd;})});}_0x1a76c6=_['merge']({},_0x1a76c6,_0x588d71[_0xd13f('0x58')]);return _0xc68bd4['getItems'](_0x1a76c6);}})[_0xd13f('0x27')](function(_0x55e94b){if(_0x55e94b){_0x57547b=_0x55e94b[_0xd13f('0x3d')];if(!_0x588d71[_0xd13f('0x37')][_0xd13f('0x3e')](_0xd13f('0x3f'))){_0x1a76c6['limit']=qs[_0xd13f('0x1f')](_0x588d71[_0xd13f('0x37')][_0xd13f('0x1f')]);_0x1a76c6['offset']=qs[_0xd13f('0x21')](_0x588d71[_0xd13f('0x37')][_0xd13f('0x21')]);}return _0xc68bd4[_0xd13f('0x79')](_0x1a76c6);}})[_0xd13f('0x27')](function(_0x19f4ad){if(_0x19f4ad){return _0x19f4ad?{'count':_0x57547b,'rows':_0x19f4ad}:null;}})[_0xd13f('0x27')](respondWithResult(_0x59c365,null))[_0xd13f('0x4b')](handleError(_0x59c365,null));}; \ No newline at end of file +var _0xe3ac=['type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','Dashboard','includeAll','findAll','rows','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','include','createdAt','updatedAt','body','autoAssociation','attrUrl','attrs','https://','custom','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','end','stack','name','index','map'];(function(_0x2f6c6d,_0xc0c45){var _0x4712fe=function(_0x452504){while(--_0x452504){_0x2f6c6d['push'](_0x2f6c6d['shift']());}};_0x4712fe(++_0xc0c45);}(_0xe3ac,0x1a1));var _0xce3a=function(_0x213213,_0x337d60){_0x213213=_0x213213-0x0;var _0x204b9b=_0xe3ac[_0x213213];return _0x204b9b;};'use strict';var emlformat=require(_0xce3a('0x0'));var rimraf=require(_0xce3a('0x1'));var zipdir=require(_0xce3a('0x2'));var jsonpatch=require(_0xce3a('0x3'));var rp=require(_0xce3a('0x4'));var moment=require('moment');var BPromise=require(_0xce3a('0x5'));var Mustache=require(_0xce3a('0x6'));var util=require('util');var path=require(_0xce3a('0x7'));var sox=require(_0xce3a('0x8'));var csv=require(_0xce3a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce3a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xce3a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xce3a('0xc'));var toCsv=require(_0xce3a('0x9'));var querystring=require(_0xce3a('0xd'));var Papa=require(_0xce3a('0xe'));var Redis=require(_0xce3a('0xf'));var authService=require(_0xce3a('0x10'));var qs=require(_0xce3a('0x11'));var as=require(_0xce3a('0x12'));var hardwareService=require(_0xce3a('0x13'));var logger=require(_0xce3a('0x14'))(_0xce3a('0x15'));var utils=require('../../config/utils');var config=require(_0xce3a('0x16'));var licenseUtil=require(_0xce3a('0x17'));var db=require(_0xce3a('0x18'))['db'];config[_0xce3a('0x19')]=_['defaults'](config[_0xce3a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xce3a('0x1a'))(new Redis(config[_0xce3a('0x19')]));require('./dashboard.socket')[_0xce3a('0x1b')](socket);function respondWithStatusCode(_0xc31222,_0x509a74){_0x509a74=_0x509a74||0xcc;return function(_0x31347c){if(_0x31347c){return _0xc31222['sendStatus'](_0x509a74);}return _0xc31222[_0xce3a('0x1c')](_0x509a74)['end']();};}function respondWithResult(_0x5666a0,_0x37c4b1){_0x37c4b1=_0x37c4b1||0xc8;return function(_0x5a410f){if(_0x5a410f){return _0x5666a0['status'](_0x37c4b1)[_0xce3a('0x1d')](_0x5a410f);}};}function respondWithFilteredResult(_0x14e4bf,_0xb14734){return function(_0x1f4f1c){if(_0x1f4f1c){var _0x19266f=typeof _0xb14734[_0xce3a('0x1e')]==='undefined'&&typeof _0xb14734[_0xce3a('0x1f')]==='undefined';var _0xeb064d=_0x1f4f1c[_0xce3a('0x20')];var _0x32fb5f=_0x19266f?0x0:_0xb14734[_0xce3a('0x1e')];var _0x4005d4=_0x19266f?_0x1f4f1c[_0xce3a('0x20')]:_0xb14734[_0xce3a('0x1e')]+_0xb14734[_0xce3a('0x1f')];var _0x552b7c;if(_0x4005d4>=_0xeb064d){_0x4005d4=_0xeb064d;_0x552b7c=0xc8;}else{_0x552b7c=0xce;}_0x14e4bf[_0xce3a('0x1c')](_0x552b7c);return _0x14e4bf[_0xce3a('0x21')](_0xce3a('0x22'),_0x32fb5f+'-'+_0x4005d4+'/'+_0xeb064d)[_0xce3a('0x1d')](_0x1f4f1c);}return null;};}function patchUpdates(_0x595f4a){return function(_0x22577d){try{jsonpatch[_0xce3a('0x23')](_0x22577d,_0x595f4a,!![]);}catch(_0x206b66){return BPromise[_0xce3a('0x24')](_0x206b66);}return _0x22577d[_0xce3a('0x25')]();};}function saveUpdates(_0x3a81c9,_0x50f3d3){return function(_0x479ed3){if(_0x479ed3){return _0x479ed3[_0xce3a('0x26')](_0x3a81c9)[_0xce3a('0x27')](function(_0x5b542f){return _0x5b542f;});}return null;};}function removeEntity(_0x3ce148,_0xc7978c){return function(_0x440e31){if(_0x440e31){return _0x440e31[_0xce3a('0x28')]()[_0xce3a('0x27')](function(){var _0x1ccc43=_0x440e31[_0xce3a('0x29')]({'plain':!![]});var _0x4b6d63='CustomDashboards';return db['UserProfileResource'][_0xce3a('0x28')]({'where':{'type':_0x4b6d63,'resourceId':_0x1ccc43['id']}})[_0xce3a('0x27')](function(){return _0x440e31;});})[_0xce3a('0x27')](function(){_0x3ce148['status'](0xcc)[_0xce3a('0x2a')]();});}};}function handleEntityNotFound(_0x37dc43,_0x3f6e16){return function(_0x508bc0){if(!_0x508bc0){_0x37dc43['sendStatus'](0x194);}return _0x508bc0;};}function handleError(_0x516abb,_0x1a88aa){_0x1a88aa=_0x1a88aa||0x1f4;return function(_0x152027){logger['error'](_0x152027[_0xce3a('0x2b')]);if(_0x152027[_0xce3a('0x2c')]){delete _0x152027['name'];}_0x516abb[_0xce3a('0x1c')](_0x1a88aa)['send'](_0x152027);};}exports[_0xce3a('0x2d')]=function(_0x2b0a73,_0xbf02e2){var _0x3386c4={},_0x4052cc={},_0x493c18={'count':0x0,'rows':[]};var _0x569f7e=_[_0xce3a('0x2e')](db['Dashboard']['rawAttributes'],function(_0x440d79){return{'name':_0x440d79['fieldName'],'type':_0x440d79[_0xce3a('0x2f')]['key']};});_0x4052cc[_0xce3a('0x30')]=_[_0xce3a('0x2e')](_0x569f7e,'name');_0x4052cc[_0xce3a('0x31')]=_[_0xce3a('0x32')](_0x2b0a73[_0xce3a('0x31')]);_0x4052cc[_0xce3a('0x33')]=_[_0xce3a('0x34')](_0x4052cc[_0xce3a('0x30')],_0x4052cc[_0xce3a('0x31')]);_0x3386c4[_0xce3a('0x35')]=_[_0xce3a('0x34')](_0x4052cc[_0xce3a('0x30')],qs['fields'](_0x2b0a73[_0xce3a('0x31')]['fields']));_0x3386c4['attributes']=_0x3386c4['attributes'][_0xce3a('0x36')]?_0x3386c4['attributes']:_0x4052cc['model'];if(!_0x2b0a73[_0xce3a('0x31')][_0xce3a('0x37')]('nolimit')){_0x3386c4[_0xce3a('0x1f')]=qs[_0xce3a('0x1f')](_0x2b0a73[_0xce3a('0x31')][_0xce3a('0x1f')]);_0x3386c4['offset']=qs[_0xce3a('0x1e')](_0x2b0a73['query'][_0xce3a('0x1e')]);}_0x3386c4[_0xce3a('0x38')]=qs['sort'](_0x2b0a73[_0xce3a('0x31')]['sort']);_0x3386c4[_0xce3a('0x39')]=qs[_0xce3a('0x33')](_[_0xce3a('0x3a')](_0x2b0a73[_0xce3a('0x31')],_0x4052cc[_0xce3a('0x33')]),_0x569f7e);if(_0x2b0a73[_0xce3a('0x31')][_0xce3a('0x3b')]){_0x3386c4[_0xce3a('0x39')]=_['merge'](_0x3386c4[_0xce3a('0x39')],{'$or':_['map'](_0x569f7e,function(_0x4940bd){if(_0x4940bd['type']!==_0xce3a('0x3c')){var _0x40deee={};_0x40deee[_0x4940bd[_0xce3a('0x2c')]]={'$like':'%'+_0x2b0a73[_0xce3a('0x31')][_0xce3a('0x3b')]+'%'};return _0x40deee;}})});}_0x3386c4=_[_0xce3a('0x3d')]({},_0x3386c4,_0x2b0a73[_0xce3a('0x3e')]);var _0x25ca39={'where':_0x3386c4[_0xce3a('0x39')]};return db[_0xce3a('0x3f')][_0xce3a('0x20')](_0x25ca39)[_0xce3a('0x27')](function(_0x1018f5){_0x493c18[_0xce3a('0x20')]=_0x1018f5;if(_0x2b0a73[_0xce3a('0x31')][_0xce3a('0x40')]){_0x3386c4['include']=[{'all':!![]}];}return db[_0xce3a('0x3f')][_0xce3a('0x41')](_0x3386c4);})[_0xce3a('0x27')](function(_0x1e83b2){_0x493c18[_0xce3a('0x42')]=_0x1e83b2;return _0x493c18;})['then'](respondWithFilteredResult(_0xbf02e2,_0x3386c4))['catch'](handleError(_0xbf02e2,null));};exports['show']=function(_0x21793b,_0x12e21b){var _0x3f0e36={'raw':![],'where':{'id':_0x21793b['params']['id']}},_0x2fefb4={};_0x2fefb4['model']=_[_0xce3a('0x32')](db['Dashboard'][_0xce3a('0x43')]);_0x2fefb4['query']=_[_0xce3a('0x32')](_0x21793b[_0xce3a('0x31')]);_0x2fefb4[_0xce3a('0x33')]=_[_0xce3a('0x34')](_0x2fefb4['model'],_0x2fefb4[_0xce3a('0x31')]);_0x3f0e36['attributes']=_[_0xce3a('0x34')](_0x2fefb4[_0xce3a('0x30')],qs[_0xce3a('0x44')](_0x21793b[_0xce3a('0x31')][_0xce3a('0x44')]));_0x3f0e36['attributes']=_0x3f0e36[_0xce3a('0x35')][_0xce3a('0x36')]?_0x3f0e36[_0xce3a('0x35')]:_0x2fefb4[_0xce3a('0x30')];if(_0x21793b['query'][_0xce3a('0x40')]){_0x3f0e36['include']=[{'all':!![]}];}_0x3f0e36=_['merge']({},_0x3f0e36,_0x21793b[_0xce3a('0x3e')]);return db[_0xce3a('0x3f')][_0xce3a('0x45')](_0x3f0e36)[_0xce3a('0x27')](handleEntityNotFound(_0x12e21b,null))[_0xce3a('0x27')](respondWithResult(_0x12e21b,null))['catch'](handleError(_0x12e21b,null));};exports[_0xce3a('0x46')]=function(_0x4849cb,_0x56a475){return db['Dashboard']['create'](_0x4849cb['body'],{})[_0xce3a('0x27')](function(_0xc35096){var _0x208148=_0x4849cb[_0xce3a('0x47')][_0xce3a('0x29')]({'plain':!![]});if(!_0x208148)throw new Error(_0xce3a('0x48'));if(_0x208148['role']===_0xce3a('0x47')){var _0x6a4662=_0xc35096[_0xce3a('0x29')]({'plain':!![]});var _0x44a576=_0xce3a('0x49');return db[_0xce3a('0x4a')][_0xce3a('0x45')]({'where':{'name':_0x44a576,'userProfileId':_0x208148[_0xce3a('0x4b')]},'raw':!![]})[_0xce3a('0x27')](function(_0x155d81){if(_0x155d81&&_0x155d81['autoAssociation']===0x0){return db[_0xce3a('0x4c')]['create']({'name':_0x6a4662[_0xce3a('0x2c')],'resourceId':_0x6a4662['id'],'type':_0x155d81[_0xce3a('0x2c')],'sectionId':_0x155d81['id']},{})[_0xce3a('0x27')](function(){return _0xc35096;});}else{return _0xc35096;}})['catch'](function(_0x1eab36){logger[_0xce3a('0x4d')](_0xce3a('0x4e'),_0x1eab36);throw _0x1eab36;});}return _0xc35096;})[_0xce3a('0x27')](respondWithResult(_0x56a475,0xc9))[_0xce3a('0x4f')](handleError(_0x56a475,null));};exports['clone']=function(_0x255438,_0x5ebad1){var _0x2b09d8={'where':{'id':_0x255438[_0xce3a('0x50')]['id']}},_0x4fd133={};_0x4fd133[_0xce3a('0x30')]=_[_0xce3a('0x32')](db['Dashboard']['rawAttributes']);_0x2b09d8[_0xce3a('0x35')]=_[_0xce3a('0x34')](_0x4fd133[_0xce3a('0x30')],qs[_0xce3a('0x44')](_0x255438['query'][_0xce3a('0x44')]));_0x2b09d8['attributes']=_0x2b09d8['attributes']['length']?_0x2b09d8['attributes']:_0x4fd133['model'];if(_0x255438[_0xce3a('0x31')][_0xce3a('0x40')]){_0x2b09d8[_0xce3a('0x51')]=[{'all':!![]}];}_0x2b09d8=_[_0xce3a('0x3d')]({},_0x2b09d8,_0x255438[_0xce3a('0x3e')]);return db[_0xce3a('0x3f')]['find'](_0x2b09d8)[_0xce3a('0x27')](handleEntityNotFound(_0x5ebad1,null))[_0xce3a('0x27')](function(_0x2d55fa){if(_0x2d55fa){var _0x35a60b=_0x2d55fa['get']({'plain':!![]});_0x35a60b=qs['omit'](_0x35a60b,['id',_0xce3a('0x52'),_0xce3a('0x53')]);_0x255438[_0xce3a('0x54')]=_['omit'](_0x255438[_0xce3a('0x54')],['id',_0xce3a('0x52'),'updatedAt']);return db[_0xce3a('0x3f')][_0xce3a('0x46')](_['merge'](_0x35a60b,_0x255438[_0xce3a('0x54')]),{'include':_0x255438['query'][_0xce3a('0x40')]?[{'all':!![]}]:undefined})[_0xce3a('0x27')](function(_0x515802){var _0x1ef9cb=_0x255438[_0xce3a('0x47')][_0xce3a('0x29')]({'plain':!![]});if(!_0x1ef9cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ef9cb['role']==='user'){var _0x5240ad=_0x515802['get']({'plain':!![]});var _0x1f38f8=_0xce3a('0x49');return db[_0xce3a('0x4a')][_0xce3a('0x45')]({'where':{'name':_0x1f38f8,'userProfileId':_0x1ef9cb[_0xce3a('0x4b')]},'raw':!![]})[_0xce3a('0x27')](function(_0x5ebdfc){if(_0x5ebdfc&&_0x5ebdfc[_0xce3a('0x55')]===0x0){return db[_0xce3a('0x4c')][_0xce3a('0x46')]({'name':_0x5240ad[_0xce3a('0x2c')],'resourceId':_0x5240ad['id'],'type':_0x5ebdfc['name'],'sectionId':_0x5ebdfc['id']},{})[_0xce3a('0x27')](function(){return _0x515802;});}else{return _0x515802;}})[_0xce3a('0x4f')](function(_0x264fef){logger[_0xce3a('0x4d')](_0xce3a('0x4e'),_0x264fef);throw _0x264fef;});}return _0x515802;});}})[_0xce3a('0x27')](respondWithResult(_0x5ebad1,0xc9))[_0xce3a('0x4f')](handleError(_0x5ebad1,null));};exports[_0xce3a('0x26')]=function(_0xa27fc0,_0xdb4e67){if(_0xa27fc0[_0xce3a('0x54')]['id']){delete _0xa27fc0['body']['id'];}return db['Dashboard'][_0xce3a('0x45')]({'where':{'id':_0xa27fc0[_0xce3a('0x50')]['id']}})[_0xce3a('0x27')](handleEntityNotFound(_0xdb4e67,null))[_0xce3a('0x27')](saveUpdates(_0xa27fc0[_0xce3a('0x54')],null))[_0xce3a('0x27')](respondWithResult(_0xdb4e67,null))['catch'](handleError(_0xdb4e67,null));};exports[_0xce3a('0x28')]=function(_0x5163ac,_0x2539d1){return db[_0xce3a('0x3f')][_0xce3a('0x45')]({'where':{'id':_0x5163ac[_0xce3a('0x50')]['id']}})[_0xce3a('0x27')](handleEntityNotFound(_0x2539d1,null))[_0xce3a('0x27')](removeEntity(_0x2539d1,null))['catch'](handleError(_0x2539d1,null));};function widgetAttributes(_0x4c5a7f){try{switch(_0x4c5a7f[_0xce3a('0x2f')]){case'iframe':return[{'name':_0xce3a('0x56'),'value':_0x4c5a7f[_0xce3a('0x56')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x0]?_0x4c5a7f[_0xce3a('0x57')][0x0]['value']:undefined)||_0xce3a('0x58')}];case _0xce3a('0x59'):return[{'name':'attrPath','value':_0x4c5a7f['attrPath']||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x0]?_0x4c5a7f[_0xce3a('0x57')][0x0][_0xce3a('0x5a')]:undefined)||''}];case'clock':return[{'name':_0xce3a('0x5b'),'value':_0x4c5a7f[_0xce3a('0x5b')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x0]?_0x4c5a7f[_0xce3a('0x57')][0x0][_0xce3a('0x5a')]:undefined)||_0xce3a('0x5c')},{'name':_0xce3a('0x5d'),'value':_0x4c5a7f[_0xce3a('0x5d')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x1]?_0x4c5a7f[_0xce3a('0x57')][0x1][_0xce3a('0x5a')]:undefined)||_0xce3a('0x5e')},{'name':'attrFontSize','value':_0x4c5a7f[_0xce3a('0x5f')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x2]?_0x4c5a7f[_0xce3a('0x57')][0x2]['value']:undefined)||0xc}];case _0xce3a('0x60'):return[{'name':'attrMetric','value':_0x4c5a7f['attrMetric']||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f['attrs'][0x0]?_0x4c5a7f[_0xce3a('0x57')][0x0][_0xce3a('0x5a')]:undefined)||_0xce3a('0x61')},{'name':_0xce3a('0x62'),'value':_0x4c5a7f[_0xce3a('0x62')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x1]?_0x4c5a7f[_0xce3a('0x57')][0x1][_0xce3a('0x5a')]:undefined)||[]},{'name':_0xce3a('0x5f'),'value':_0x4c5a7f[_0xce3a('0x5f')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x2]?_0x4c5a7f['attrs'][0x2]['value']:undefined)||0x14}];case _0xce3a('0x63'):case _0xce3a('0x64'):return[{'name':'attrSerie1','value':_0x4c5a7f[_0xce3a('0x65')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x0]?_0x4c5a7f[_0xce3a('0x57')][0x0][_0xce3a('0x5a')]:undefined)||_0xce3a('0x61')},{'name':'attrSerie2','value':_0x4c5a7f[_0xce3a('0x66')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x1]?_0x4c5a7f['attrs'][0x1][_0xce3a('0x5a')]:undefined)||null},{'name':_0xce3a('0x67'),'value':_0x4c5a7f[_0xce3a('0x67')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x2]?_0x4c5a7f[_0xce3a('0x57')][0x2][_0xce3a('0x5a')]:undefined)||null},{'name':_0xce3a('0x62'),'value':_0x4c5a7f[_0xce3a('0x62')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x3]?_0x4c5a7f[_0xce3a('0x57')][0x3][_0xce3a('0x5a')]:undefined)||[]}];case _0xce3a('0x68'):return[{'name':_0xce3a('0x69'),'type':_0x4c5a7f[_0xce3a('0x6a')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f['attrs'][0x0]?_0x4c5a7f[_0xce3a('0x57')][0x0][_0xce3a('0x2f')]:undefined)||null,'value':_0x4c5a7f['attrReport']||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f[_0xce3a('0x57')][0x0]?_0x4c5a7f['attrs'][0x0][_0xce3a('0x5a')]:undefined)||null},{'name':_0xce3a('0x6b'),'value':_0x4c5a7f[_0xce3a('0x6b')]||(_0x4c5a7f[_0xce3a('0x57')]&&_0x4c5a7f['attrs'][0x1]?_0x4c5a7f[_0xce3a('0x57')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4d281a){logger[_0xce3a('0x4d')](_0xce3a('0x6c'),JSON[_0xce3a('0x6d')](_0x4d281a));return[];}}exports[_0xce3a('0x6e')]=function(_0x53c857,_0x704b91,_0x295385){if(_0x53c857[_0xce3a('0x54')]['id']){delete _0x53c857[_0xce3a('0x54')]['id'];}return db[_0xce3a('0x3f')]['find']({'where':{'id':_0x53c857[_0xce3a('0x50')]['id']}})[_0xce3a('0x27')](handleEntityNotFound(_0x704b91,null))['then'](function(_0x2108c4){if(_0x2108c4){_0x53c857[_0xce3a('0x54')][_0xce3a('0x6f')]=_0x2108c4['id'];_0x53c857['body'][_0xce3a('0x57')]=widgetAttributes(_0x53c857[_0xce3a('0x54')]);return db[_0xce3a('0x70')]['create'](_0x53c857[_0xce3a('0x54')]);}})[_0xce3a('0x27')](respondWithResult(_0x704b91,null))['catch'](handleError(_0x704b91,null));};exports[_0xce3a('0x71')]=function(_0x4bd7ef,_0x4c2ec0,_0x1ccdf6){var _0x2bdd11={};var _0x5bb51e={};var _0x4a66e1;var _0x18d9e4;return db['Dashboard'][_0xce3a('0x72')]({'where':{'id':_0x4bd7ef['params']['id']}})[_0xce3a('0x27')](handleEntityNotFound(_0x4c2ec0,null))['then'](function(_0x19001a){if(_0x19001a){_0x4a66e1=_0x19001a;_0x5bb51e[_0xce3a('0x30')]=_[_0xce3a('0x32')](db[_0xce3a('0x70')][_0xce3a('0x43')]);_0x5bb51e['query']=_[_0xce3a('0x32')](_0x4bd7ef[_0xce3a('0x31')]);_0x5bb51e[_0xce3a('0x33')]=_[_0xce3a('0x34')](_0x5bb51e[_0xce3a('0x30')],_0x5bb51e[_0xce3a('0x31')]);_0x2bdd11[_0xce3a('0x35')]=_[_0xce3a('0x34')](_0x5bb51e[_0xce3a('0x30')],qs[_0xce3a('0x44')](_0x4bd7ef[_0xce3a('0x31')][_0xce3a('0x44')]));_0x2bdd11[_0xce3a('0x35')]=_0x2bdd11[_0xce3a('0x35')][_0xce3a('0x36')]?_0x2bdd11[_0xce3a('0x35')]:_0x5bb51e[_0xce3a('0x30')];_0x2bdd11[_0xce3a('0x38')]=qs['sort'](_0x4bd7ef[_0xce3a('0x31')][_0xce3a('0x73')]);_0x2bdd11[_0xce3a('0x39')]=qs[_0xce3a('0x33')](_['pick'](_0x4bd7ef[_0xce3a('0x31')],_0x5bb51e[_0xce3a('0x33')]));if(_0x4bd7ef['query']['filter']){_0x2bdd11[_0xce3a('0x39')]=_[_0xce3a('0x3d')](_0x2bdd11[_0xce3a('0x39')],{'$or':_[_0xce3a('0x2e')](_0x2bdd11[_0xce3a('0x35')],function(_0x3b8565){var _0xde948f={};_0xde948f[_0x3b8565]={'$like':'%'+_0x4bd7ef[_0xce3a('0x31')][_0xce3a('0x3b')]+'%'};return _0xde948f;})});}_0x2bdd11=_['merge']({},_0x2bdd11,_0x4bd7ef[_0xce3a('0x3e')]);return _0x4a66e1[_0xce3a('0x71')](_0x2bdd11);}})[_0xce3a('0x27')](function(_0x2baf09){if(_0x2baf09){_0x18d9e4=_0x2baf09['length'];if(!_0x4bd7ef[_0xce3a('0x31')][_0xce3a('0x37')]('nolimit')){_0x2bdd11['limit']=qs[_0xce3a('0x1f')](_0x4bd7ef[_0xce3a('0x31')][_0xce3a('0x1f')]);_0x2bdd11[_0xce3a('0x1e')]=qs[_0xce3a('0x1e')](_0x4bd7ef['query'][_0xce3a('0x1e')]);}return _0x4a66e1[_0xce3a('0x71')](_0x2bdd11);}})['then'](function(_0x5a0782){if(_0x5a0782){return _0x5a0782?{'count':_0x18d9e4,'rows':_0x5a0782}:null;}})[_0xce3a('0x27')](respondWithResult(_0x4c2ec0,null))[_0xce3a('0x4f')](handleError(_0x4c2ec0,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7a4fec7..b633975 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 _0xfff8=['hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','remove','emit'];(function(_0x58653d,_0x5535d2){var _0x3e05f2=function(_0x55412c){while(--_0x55412c){_0x58653d['push'](_0x58653d['shift']());}};_0x3e05f2(++_0x5535d2);}(_0xfff8,0xe2));var _0x8fff=function(_0x16e843,_0xb84837){_0x16e843=_0x16e843-0x0;var _0x3ea528=_0xfff8[_0x16e843];return _0x3ea528;};'use strict';var EventEmitter=require(_0x8fff('0x0'));var Dashboard=require(_0x8fff('0x1'))['db'][_0x8fff('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8fff('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8fff('0x4')};function emitEvent(_0x5e2ecd){return function(_0x416a92,_0x140b74,_0x4bb981){DashboardEvents['emit'](_0x5e2ecd+':'+_0x416a92['id'],_0x416a92);DashboardEvents[_0x8fff('0x5')](_0x5e2ecd,_0x416a92);_0x4bb981(null);};}for(var e in events){if(events[_0x8fff('0x6')](e)){var event=events[e];Dashboard[_0x8fff('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x2d4c=['emit','exports','events','../../mysqldb','Dashboard','setMaxListeners','update','remove'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x2d4c,0x92));var _0xc2d4=function(_0xfdd18a,_0x40fcae){_0xfdd18a=_0xfdd18a-0x0;var _0x5c0391=_0x2d4c[_0xfdd18a];return _0x5c0391;};'use strict';var EventEmitter=require(_0xc2d4('0x0'));var Dashboard=require(_0xc2d4('0x1'))['db'][_0xc2d4('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc2d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc2d4('0x4'),'afterDestroy':_0xc2d4('0x5')};function emitEvent(_0x28b977){return function(_0x164020,_0x189848,_0x36c568){DashboardEvents[_0xc2d4('0x6')](_0x28b977+':'+_0x164020['id'],_0x164020);DashboardEvents[_0xc2d4('0x6')](_0x28b977,_0x164020);_0x36c568(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xc2d4('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 8308e74..af02e45 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 _0xe0e9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe0e9,0x6e));var _0x9e0e=function(_0x41f91a,_0x1f2f2d){_0x41f91a=_0x41f91a-0x0;var _0x4680f1=_0xe0e9[_0x41f91a];return _0x4680f1;};'use strict';var _=require(_0x9e0e('0x0'));var util=require(_0x9e0e('0x1'));var logger=require(_0x9e0e('0x2'))(_0x9e0e('0x3'));var moment=require(_0x9e0e('0x4'));var BPromise=require(_0x9e0e('0x5'));var rp=require(_0x9e0e('0x6'));var fs=require('fs');var path=require(_0x9e0e('0x7'));var rimraf=require(_0x9e0e('0x8'));var config=require(_0x9e0e('0x9'));var attributes=require(_0x9e0e('0xa'));module['exports']=function(_0x50b22a,_0x678474){return _0x50b22a[_0x9e0e('0xb')](_0x9e0e('0xc'),attributes,{'tableName':_0x9e0e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9aab=['exports','define','Dashboard','dashboards','lodash','../../config/logger','moment','bluebird','path','rimraf','./dashboard.attributes'];(function(_0x17be0b,_0x54178d){var _0xb26b1=function(_0x368339){while(--_0x368339){_0x17be0b['push'](_0x17be0b['shift']());}};_0xb26b1(++_0x54178d);}(_0x9aab,0x1c7));var _0xb9aa=function(_0x2cd923,_0x25055e){_0x2cd923=_0x2cd923-0x0;var _0x5234b7=_0x9aab[_0x2cd923];return _0x5234b7;};'use strict';var _=require(_0xb9aa('0x0'));var util=require('util');var logger=require(_0xb9aa('0x1'))('api');var moment=require(_0xb9aa('0x2'));var BPromise=require(_0xb9aa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9aa('0x4'));var rimraf=require(_0xb9aa('0x5'));var config=require('../../config/environment');var attributes=require(_0xb9aa('0x6'));module[_0xb9aa('0x7')]=function(_0x29ba0e,_0x69b236){return _0x29ba0e[_0xb9aa('0x8')](_0xb9aa('0x9'),attributes,{'tableName':_0xb9aa('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 909c45f..47af3cd 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 _0x5b13=['client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x3c4a72,_0x41b889){var _0x34a7c3=function(_0x570da3){while(--_0x570da3){_0x3c4a72['push'](_0x3c4a72['shift']());}};_0x34a7c3(++_0x41b889);}(_0x5b13,0x164));var _0x35b1=function(_0x20bc1a,_0x5eb4da){_0x20bc1a=_0x20bc1a-0x0;var _0xb21beb=_0x5b13[_0x20bc1a];return _0xb21beb;};'use strict';var _=require(_0x35b1('0x0'));var util=require(_0x35b1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35b1('0x2'));var fs=require('fs');var Redis=require(_0x35b1('0x3'));var db=require(_0x35b1('0x4'))['db'];var utils=require(_0x35b1('0x5'));var logger=require('../../config/logger')(_0x35b1('0x6'));var config=require('../../config/environment');var jayson=require(_0x35b1('0x7'));var client=jayson[_0x35b1('0x8')][_0x35b1('0x9')]({'port':0x232a});config[_0x35b1('0xa')]=_[_0x35b1('0xb')](config['redis'],{'host':_0x35b1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35b1('0xa')]));require(_0x35b1('0xd'))[_0x35b1('0xe')](socket);function respondWithRpcPromise(_0x568a60,_0x24c868,_0x415b72){return new BPromise(function(_0x2f4d9a,_0x306961){return client[_0x35b1('0xf')](_0x568a60,_0x415b72)[_0x35b1('0x10')](function(_0x46c797){logger[_0x35b1('0x11')]('Dashboard,\x20%s,\x20%s',_0x24c868,_0x35b1('0x12'));logger[_0x35b1('0x13')](_0x35b1('0x14'),_0x24c868,_0x35b1('0x12'),JSON[_0x35b1('0x15')](_0x46c797));if(_0x46c797[_0x35b1('0x16')]){if(_0x46c797[_0x35b1('0x16')][_0x35b1('0x17')]===0x1f4){logger[_0x35b1('0x16')](_0x35b1('0x18'),_0x24c868,_0x46c797[_0x35b1('0x16')][_0x35b1('0x19')]);return _0x306961(_0x46c797[_0x35b1('0x16')][_0x35b1('0x19')]);}logger['error'](_0x35b1('0x18'),_0x24c868,_0x46c797[_0x35b1('0x16')][_0x35b1('0x19')]);return _0x2f4d9a(_0x46c797['error'][_0x35b1('0x19')]);}else{logger[_0x35b1('0x11')](_0x35b1('0x18'),_0x24c868,_0x35b1('0x12'));_0x2f4d9a(_0x46c797[_0x35b1('0x1a')][_0x35b1('0x19')]);}})[_0x35b1('0x1b')](function(_0x3fc20d){logger[_0x35b1('0x16')](_0x35b1('0x18'),_0x24c868,_0x3fc20d);_0x306961(_0x3fc20d);});});} \ No newline at end of file +var _0x661c=['result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x21da0f,_0x34a74e){var _0x2fd6c5=function(_0x5a5a5c){while(--_0x5a5a5c){_0x21da0f['push'](_0x21da0f['shift']());}};_0x2fd6c5(++_0x34a74e);}(_0x661c,0x122));var _0xc661=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x661c[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xc661('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc661('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc661('0x2'));var db=require(_0xc661('0x3'))['db'];var utils=require(_0xc661('0x4'));var logger=require(_0xc661('0x5'))(_0xc661('0x6'));var config=require(_0xc661('0x7'));var jayson=require(_0xc661('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc661('0x9')]=_['defaults'](config[_0xc661('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc661('0xa'))(new Redis(config['redis']));require(_0xc661('0xb'))[_0xc661('0xc')](socket);function respondWithRpcPromise(_0x126428,_0x32cbeb,_0x45ce36){return new BPromise(function(_0xee23b2,_0x56bd30){return client[_0xc661('0xd')](_0x126428,_0x45ce36)['then'](function(_0x19aa3f){logger[_0xc661('0xe')](_0xc661('0xf'),_0x32cbeb,_0xc661('0x10'));logger['debug'](_0xc661('0x11'),_0x32cbeb,_0xc661('0x10'),JSON[_0xc661('0x12')](_0x19aa3f));if(_0x19aa3f[_0xc661('0x13')]){if(_0x19aa3f['error'][_0xc661('0x14')]===0x1f4){logger[_0xc661('0x13')]('Dashboard,\x20%s,\x20%s',_0x32cbeb,_0x19aa3f[_0xc661('0x13')]['message']);return _0x56bd30(_0x19aa3f['error'][_0xc661('0x15')]);}logger[_0xc661('0x13')]('Dashboard,\x20%s,\x20%s',_0x32cbeb,_0x19aa3f['error'][_0xc661('0x15')]);return _0xee23b2(_0x19aa3f['error']['message']);}else{logger[_0xc661('0xe')]('Dashboard,\x20%s,\x20%s',_0x32cbeb,_0xc661('0x10'));_0xee23b2(_0x19aa3f[_0xc661('0x16')][_0xc661('0x15')]);}})[_0xc661('0x17')](function(_0x2da016){logger[_0xc661('0x13')]('Dashboard,\x20%s,\x20%s',_0x32cbeb,_0x2da016);_0x56bd30(_0x2da016);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8300a31..6a5a865 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 _0x4fda=['save','remove','update','emit','removeListener','register','dashboard:','./dashboard.events'];(function(_0x331d55,_0x1b4e52){var _0x4b094f=function(_0x56cfa9){while(--_0x56cfa9){_0x331d55['push'](_0x331d55['shift']());}};_0x4b094f(++_0x1b4e52);}(_0x4fda,0x7f));var _0xa4fd=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x4fda[_0x32b542];return _0x554d54;};'use strict';var DashboardEvents=require(_0xa4fd('0x0'));var events=[_0xa4fd('0x1'),_0xa4fd('0x2'),_0xa4fd('0x3')];function createListener(_0x427e87,_0x2397f2){return function(_0x50aa16){_0x2397f2[_0xa4fd('0x4')](_0x427e87,_0x50aa16);};}function removeListener(_0x305f5d,_0x49ca8b){return function(){DashboardEvents[_0xa4fd('0x5')](_0x305f5d,_0x49ca8b);};}exports[_0xa4fd('0x6')]=function(_0x208286){for(var _0xa50304=0x0,_0x5a3d5d=events['length'];_0xa50304<_0x5a3d5d;_0xa50304++){var _0x10a2e4=events[_0xa50304];var _0x378d0e=createListener(_0xa4fd('0x7')+_0x10a2e4,_0x208286);DashboardEvents['on'](_0x10a2e4,_0x378d0e);}}; \ No newline at end of file +var _0x8e70=['./dashboard.events','save','remove','update','emit','register','length','dashboard:'];(function(_0x5b3b1e,_0x1ae26c){var _0x51399d=function(_0xeb7a36){while(--_0xeb7a36){_0x5b3b1e['push'](_0x5b3b1e['shift']());}};_0x51399d(++_0x1ae26c);}(_0x8e70,0xa0));var _0x08e7=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x8e70[_0x7e2eb0];return _0xd92de4;};'use strict';var DashboardEvents=require(_0x08e7('0x0'));var events=[_0x08e7('0x1'),_0x08e7('0x2'),_0x08e7('0x3')];function createListener(_0x36031a,_0x5be33b){return function(_0x1a4674){_0x5be33b[_0x08e7('0x4')](_0x36031a,_0x1a4674);};}function removeListener(_0x1f4614,_0x541be7){return function(){DashboardEvents['removeListener'](_0x1f4614,_0x541be7);};}exports[_0x08e7('0x5')]=function(_0x1add2d){for(var _0x29a030=0x0,_0xd74f0e=events[_0x08e7('0x6')];_0x29a030<_0xd74f0e;_0x29a030++){var _0x5c765d=events[_0x29a030];var _0x52e8fe=createListener(_0x08e7('0x7')+_0x5c765d,_0x1add2d);DashboardEvents['on'](_0x5c765d,_0x52e8fe);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 62e2f5d..e291b14 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 _0x448f=['put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem'];(function(_0x4601f3,_0x4d2401){var _0x2afb49=function(_0x297f98){while(--_0x297f98){_0x4601f3['push'](_0x4601f3['shift']());}};_0x2afb49(++_0x4d2401);}(_0x448f,0x1a2));var _0xf448=function(_0xd7d552,_0x47bf11){_0xd7d552=_0xd7d552-0x0;var _0x3a5ca4=_0x448f[_0xd7d552];return _0x3a5ca4;};'use strict';var multer=require(_0xf448('0x0'));var util=require(_0xf448('0x1'));var path=require(_0xf448('0x2'));var timeout=require(_0xf448('0x3'));var express=require('express');var router=express[_0xf448('0x4')]();var fs_extra=require(_0xf448('0x5'));var auth=require(_0xf448('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf448('0x7'));var controller=require(_0xf448('0x8'));router[_0xf448('0x9')]('/',auth[_0xf448('0xa')](),controller['index']);router[_0xf448('0x9')](_0xf448('0xb'),auth['isAuthenticated'](),controller[_0xf448('0xc')]);router[_0xf448('0x9')](_0xf448('0xd'),auth['isAuthenticated'](),controller[_0xf448('0xe')]);router[_0xf448('0xf')]('/',auth[_0xf448('0xa')](),controller['create']);router['post'](_0xf448('0x10'),auth[_0xf448('0xa')](),controller[_0xf448('0x11')]);router['post'](_0xf448('0xd'),auth['isAuthenticated'](),controller[_0xf448('0x12')]);router[_0xf448('0x13')](_0xf448('0xb'),auth[_0xf448('0xa')](),controller[_0xf448('0x14')]);router[_0xf448('0x15')](_0xf448('0xb'),auth[_0xf448('0xa')](),controller['destroy']);module[_0xf448('0x16')]=router; \ No newline at end of file +var _0x024d=['getItems','post','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items'];(function(_0x186d2a,_0x50faa7){var _0x549015=function(_0x34ec94){while(--_0x34ec94){_0x186d2a['push'](_0x186d2a['shift']());}};_0x549015(++_0x50faa7);}(_0x024d,0xd6));var _0xd024=function(_0x3d5cbe,_0x170be1){_0x3d5cbe=_0x3d5cbe-0x0;var _0x27c791=_0x024d[_0x3d5cbe];return _0x27c791;};'use strict';var multer=require(_0xd024('0x0'));var util=require(_0xd024('0x1'));var path=require(_0xd024('0x2'));var timeout=require(_0xd024('0x3'));var express=require(_0xd024('0x4'));var router=express[_0xd024('0x5')]();var fs_extra=require(_0xd024('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd024('0x7'));var config=require(_0xd024('0x8'));var controller=require(_0xd024('0x9'));router[_0xd024('0xa')]('/',auth[_0xd024('0xb')](),controller[_0xd024('0xc')]);router[_0xd024('0xa')](_0xd024('0xd'),auth[_0xd024('0xb')](),controller[_0xd024('0xe')]);router[_0xd024('0xa')](_0xd024('0xf'),auth[_0xd024('0xb')](),controller[_0xd024('0x10')]);router[_0xd024('0x11')]('/',auth[_0xd024('0xb')](),controller['create']);router[_0xd024('0x11')]('/:id/clone',auth[_0xd024('0xb')](),controller[_0xd024('0x12')]);router[_0xd024('0x11')](_0xd024('0xf'),auth[_0xd024('0xb')](),controller['addItem']);router[_0xd024('0x13')](_0xd024('0xd'),auth[_0xd024('0xb')](),controller['update']);router[_0xd024('0x14')](_0xd024('0xd'),auth[_0xd024('0xb')](),controller[_0xd024('0x15')]);module[_0xd024('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6a22270..0944db9 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 _0xba34=['attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','parse','getDataValue'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0xba34,0x119));var _0x4ba3=function(_0x469193,_0x2c7252){_0x469193=_0x469193-0x0;var _0x3f22ce=_0xba34[_0x469193];return _0x3f22ce;};'use strict';var Sequelize=require(_0x4ba3('0x0'));var squel=require(_0x4ba3('0x1'));var _=require(_0x4ba3('0x2'));module[_0x4ba3('0x3')]={'title':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x4ba3('0x5')](this[_0x4ba3('0x6')](_0x4ba3('0x7')));}catch(_0x1011ec){return[];}},'set':function(_0x3590a1){try{this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON['stringify'](_0x3590a1));}catch(_0x6254fb){this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON[_0x4ba3('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4ba3('0xa')]},'col':{'type':Sequelize[_0x4ba3('0xa')]},'background':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':_0x4ba3('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4ba3('0x4')]},'titleFontSize':{'type':Sequelize[_0x4ba3('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x814b=['lodash','exports','STRING','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel'];(function(_0x5d39b8,_0x281b5f){var _0x4a7d88=function(_0x3a03b4){while(--_0x3a03b4){_0x5d39b8['push'](_0x5d39b8['shift']());}};_0x4a7d88(++_0x281b5f);}(_0x814b,0x1a2));var _0xb814=function(_0x474c66,_0xbce925){_0x474c66=_0x474c66-0x0;var _0xcbd9bf=_0x814b[_0x474c66];return _0xcbd9bf;};'use strict';var Sequelize=require(_0xb814('0x0'));var squel=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));module[_0xb814('0x3')]={'title':{'type':Sequelize[_0xb814('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xb814('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xb814('0x5')),'get':function(){try{return JSON[_0xb814('0x6')](this[_0xb814('0x7')](_0xb814('0x8')));}catch(_0x44931c){return[];}},'set':function(_0x322a70){try{this['setDataValue'](_0xb814('0x8'),JSON[_0xb814('0x9')](_0x322a70));}catch(_0x5c8539){this[_0xb814('0xa')](_0xb814('0x8'),JSON[_0xb814('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb814('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb814('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb814('0xb')]},'col':{'type':Sequelize[_0xb814('0xb')]},'background':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'defaultValue':_0xb814('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'defaultValue':_0xb814('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xb814('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 4bd1460..a89a3ca 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 _0xd88b=['../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','then','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment'];(function(_0x57f5e3,_0x1cd5fa){var _0x949c61=function(_0x3a4a1b){while(--_0x3a4a1b){_0x57f5e3['push'](_0x57f5e3['shift']());}};_0x949c61(++_0x1cd5fa);}(_0xd88b,0xa7));var _0xbd88=function(_0x557b37,_0x532ba8){_0x557b37=_0x557b37-0x0;var _0x5184dc=_0xd88b[_0x557b37];return _0x5184dc;};'use strict';var emlformat=require(_0xbd88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd88('0x1'));var jsonpatch=require(_0xbd88('0x2'));var rp=require(_0xbd88('0x3'));var moment=require(_0xbd88('0x4'));var BPromise=require(_0xbd88('0x5'));var Mustache=require(_0xbd88('0x6'));var util=require(_0xbd88('0x7'));var path=require(_0xbd88('0x8'));var sox=require(_0xbd88('0x9'));var csv=require(_0xbd88('0xa'));var ejs=require(_0xbd88('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd88('0xc'));var squel=require('squel');var crypto=require(_0xbd88('0xd'));var jsforce=require(_0xbd88('0xe'));var deskjs=require(_0xbd88('0xf'));var toCsv=require(_0xbd88('0xa'));var querystring=require(_0xbd88('0x10'));var Papa=require(_0xbd88('0x11'));var Redis=require(_0xbd88('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbd88('0x13'));var as=require(_0xbd88('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd88('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbd88('0x16'));var licenseUtil=require(_0xbd88('0x17'));var db=require(_0xbd88('0x18'))['db'];config['redis']=_[_0xbd88('0x19')](config[_0xbd88('0x1a')],{'host':_0xbd88('0x1b'),'port':0x18eb});var socket=require(_0xbd88('0x1c'))(new Redis(config[_0xbd88('0x1a')]));require(_0xbd88('0x1d'))[_0xbd88('0x1e')](socket);function respondWithStatusCode(_0x5bf7f5,_0x2b405e){_0x2b405e=_0x2b405e||0xcc;return function(_0x4ccfe3){if(_0x4ccfe3){return _0x5bf7f5[_0xbd88('0x1f')](_0x2b405e);}return _0x5bf7f5[_0xbd88('0x20')](_0x2b405e)[_0xbd88('0x21')]();};}function respondWithResult(_0x420d47,_0xc6115b){_0xc6115b=_0xc6115b||0xc8;return function(_0x4ac9ea){if(_0x4ac9ea){return _0x420d47[_0xbd88('0x20')](_0xc6115b)[_0xbd88('0x22')](_0x4ac9ea);}};}function respondWithFilteredResult(_0x38fcda,_0x3b0e0c){return function(_0x22ff08){if(_0x22ff08){var _0x1333cb=typeof _0x3b0e0c[_0xbd88('0x23')]===_0xbd88('0x24')&&typeof _0x3b0e0c['limit']===_0xbd88('0x24');var _0x2593bb=_0x22ff08[_0xbd88('0x25')];var _0x29fd71=_0x1333cb?0x0:_0x3b0e0c[_0xbd88('0x23')];var _0x1ad22b=_0x1333cb?_0x22ff08['count']:_0x3b0e0c[_0xbd88('0x23')]+_0x3b0e0c[_0xbd88('0x26')];var _0x384070;if(_0x1ad22b>=_0x2593bb){_0x1ad22b=_0x2593bb;_0x384070=0xc8;}else{_0x384070=0xce;}_0x38fcda[_0xbd88('0x20')](_0x384070);return _0x38fcda['set'](_0xbd88('0x27'),_0x29fd71+'-'+_0x1ad22b+'/'+_0x2593bb)[_0xbd88('0x22')](_0x22ff08);}return null;};}function patchUpdates(_0x5bbe20){return function(_0x2bc983){try{jsonpatch['apply'](_0x2bc983,_0x5bbe20,!![]);}catch(_0x20c3aa){return BPromise[_0xbd88('0x28')](_0x20c3aa);}return _0x2bc983[_0xbd88('0x29')]();};}function saveUpdates(_0x3df1bf,_0x1cc979){return function(_0x50294e){if(_0x50294e){return _0x50294e[_0xbd88('0x2a')](_0x3df1bf)['then'](function(_0x4e59c9){return _0x4e59c9;});}return null;};}function removeEntity(_0x507bec,_0x49451d){return function(_0xc25c18){if(_0xc25c18){return _0xc25c18[_0xbd88('0x2b')]()['then'](function(){_0x507bec[_0xbd88('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x314b19,_0x1c85d0){return function(_0x5eec0f){if(!_0x5eec0f){_0x314b19[_0xbd88('0x1f')](0x194);}return _0x5eec0f;};}function handleError(_0x2059e2,_0x3e19c9){_0x3e19c9=_0x3e19c9||0x1f4;return function(_0x2f8f3a){logger[_0xbd88('0x2c')](_0x2f8f3a['stack']);if(_0x2f8f3a[_0xbd88('0x2d')]){delete _0x2f8f3a[_0xbd88('0x2d')];}_0x2059e2[_0xbd88('0x20')](_0x3e19c9)[_0xbd88('0x2e')](_0x2f8f3a);};}exports[_0xbd88('0x2f')]=function(_0x24cee3,_0xcfdf93){var _0x1023de={'raw':![],'where':{'id':_0x24cee3[_0xbd88('0x30')]['id']}},_0x8d3771={};_0x8d3771[_0xbd88('0x31')]=_[_0xbd88('0x32')](db[_0xbd88('0x33')][_0xbd88('0x34')]);_0x8d3771[_0xbd88('0x35')]=_[_0xbd88('0x32')](_0x24cee3['query']);_0x8d3771[_0xbd88('0x36')]=_[_0xbd88('0x37')](_0x8d3771[_0xbd88('0x31')],_0x8d3771[_0xbd88('0x35')]);_0x1023de[_0xbd88('0x38')]=_['intersection'](_0x8d3771[_0xbd88('0x31')],qs[_0xbd88('0x39')](_0x24cee3[_0xbd88('0x35')][_0xbd88('0x39')]));_0x1023de[_0xbd88('0x38')]=_0x1023de[_0xbd88('0x38')][_0xbd88('0x3a')]?_0x1023de[_0xbd88('0x38')]:_0x8d3771[_0xbd88('0x31')];if(_0x24cee3[_0xbd88('0x35')]['includeAll']){_0x1023de[_0xbd88('0x3b')]=[{'all':!![]}];}_0x1023de=_[_0xbd88('0x3c')]({},_0x1023de,_0x24cee3[_0xbd88('0x3d')]);return db[_0xbd88('0x33')][_0xbd88('0x3e')](_0x1023de)[_0xbd88('0x3f')](handleEntityNotFound(_0xcfdf93,null))[_0xbd88('0x3f')](respondWithResult(_0xcfdf93,null))[_0xbd88('0x40')](handleError(_0xcfdf93,null));};exports[_0xbd88('0x2b')]=function(_0x30300f,_0x12da95){return db[_0xbd88('0x33')]['find']({'where':{'id':_0x30300f['params']['id']}})['then'](handleEntityNotFound(_0x12da95,null))[_0xbd88('0x3f')](removeEntity(_0x12da95,null))['catch'](handleError(_0x12da95,null));};function widgetAttributes(_0x295b22){try{switch(_0x295b22[_0xbd88('0x41')]){case _0xbd88('0x42'):return[{'name':_0xbd88('0x43'),'value':_0x295b22[_0xbd88('0x43')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x0]?_0x295b22[_0xbd88('0x44')][0x0][_0xbd88('0x45')]:undefined)||_0xbd88('0x46')}];case _0xbd88('0x47'):return[{'name':_0xbd88('0x48'),'value':_0x295b22[_0xbd88('0x48')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22['attrs'][0x0]?_0x295b22['attrs'][0x0]['value']:undefined)||''}];case _0xbd88('0x49'):return[{'name':_0xbd88('0x4a'),'value':_0x295b22[_0xbd88('0x4a')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x0]?_0x295b22['attrs'][0x0]['value']:undefined)||_0xbd88('0x4b')},{'name':_0xbd88('0x4c'),'value':_0x295b22[_0xbd88('0x4c')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x1]?_0x295b22[_0xbd88('0x44')][0x1][_0xbd88('0x45')]:undefined)||_0xbd88('0x4d')},{'name':_0xbd88('0x4e'),'value':_0x295b22[_0xbd88('0x4e')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x2]?_0x295b22[_0xbd88('0x44')][0x2][_0xbd88('0x45')]:undefined)||0xc}];case'counter':return[{'name':_0xbd88('0x4f'),'value':_0x295b22[_0xbd88('0x4f')]||(_0x295b22['attrs']&&_0x295b22['attrs'][0x0]?_0x295b22[_0xbd88('0x44')][0x0][_0xbd88('0x45')]:undefined)||_0xbd88('0x50')},{'name':'attrVoiceQueues','value':_0x295b22[_0xbd88('0x51')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x1]?_0x295b22['attrs'][0x1][_0xbd88('0x45')]:undefined)||[]},{'name':_0xbd88('0x4e'),'value':_0x295b22[_0xbd88('0x4e')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x2]?_0x295b22[_0xbd88('0x44')][0x2][_0xbd88('0x45')]:undefined)||0x14}];case _0xbd88('0x52'):case _0xbd88('0x53'):return[{'name':_0xbd88('0x54'),'value':_0x295b22[_0xbd88('0x54')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x0]?_0x295b22['attrs'][0x0]['value']:undefined)||_0xbd88('0x50')},{'name':'attrSerie2','value':_0x295b22[_0xbd88('0x55')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x1]?_0x295b22[_0xbd88('0x44')][0x1][_0xbd88('0x45')]:undefined)||null},{'name':_0xbd88('0x56'),'value':_0x295b22[_0xbd88('0x56')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x2]?_0x295b22[_0xbd88('0x44')][0x2][_0xbd88('0x45')]:undefined)||null},{'name':_0xbd88('0x51'),'value':_0x295b22['attrVoiceQueues']||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x3]?_0x295b22['attrs'][0x3][_0xbd88('0x45')]:undefined)||[]}];case _0xbd88('0x57'):return[{'name':_0xbd88('0x58'),'type':_0x295b22[_0xbd88('0x59')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22['attrs'][0x0]?_0x295b22[_0xbd88('0x44')][0x0][_0xbd88('0x41')]:undefined)||null,'value':_0x295b22['attrReport']||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x0]?_0x295b22['attrs'][0x0][_0xbd88('0x45')]:undefined)||null},{'name':_0xbd88('0x5a'),'value':_0x295b22[_0xbd88('0x5a')]||(_0x295b22[_0xbd88('0x44')]&&_0x295b22[_0xbd88('0x44')][0x1]?_0x295b22[_0xbd88('0x44')][0x1][_0xbd88('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x4b7443){logger[_0xbd88('0x2c')](_0xbd88('0x5b'),JSON[_0xbd88('0x5c')](_0x4b7443));return[];}}exports[_0xbd88('0x5d')]=function(_0x33b09b,_0x55cd30){if(_0x33b09b[_0xbd88('0x5e')]){_0x33b09b[_0xbd88('0x5e')][_0xbd88('0x44')]=widgetAttributes(_0x33b09b[_0xbd88('0x5e')]);}return db[_0xbd88('0x33')][_0xbd88('0x5d')](_0x33b09b[_0xbd88('0x5e')],{})[_0xbd88('0x3f')](respondWithResult(_0x55cd30,0xc9))[_0xbd88('0x40')](handleError(_0x55cd30,null));};exports[_0xbd88('0x2a')]=function(_0xf9508,_0x59247a){if(_0xf9508[_0xbd88('0x5e')]['id']){delete _0xf9508[_0xbd88('0x5e')]['id'];}_0xf9508[_0xbd88('0x5e')][_0xbd88('0x44')]=widgetAttributes(_0xf9508[_0xbd88('0x5e')]);return db['DashboardItem'][_0xbd88('0x3e')]({'where':{'id':_0xf9508[_0xbd88('0x30')]['id']}})[_0xbd88('0x3f')](handleEntityNotFound(_0x59247a,null))[_0xbd88('0x3f')](saveUpdates(_0xf9508[_0xbd88('0x5e')],null))['then'](respondWithResult(_0x59247a,null))['catch'](handleError(_0x59247a,null));}; \ No newline at end of file +var _0x23fd=['multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x23fd,0x16d));var _0xd23f=function(_0x37239d,_0x5a63a9){_0x37239d=_0x37239d-0x0;var _0x3a3ce3=_0x23fd[_0x37239d];return _0x3a3ce3;};'use strict';var emlformat=require(_0xd23f('0x0'));var rimraf=require(_0xd23f('0x1'));var zipdir=require(_0xd23f('0x2'));var jsonpatch=require(_0xd23f('0x3'));var rp=require(_0xd23f('0x4'));var moment=require(_0xd23f('0x5'));var BPromise=require(_0xd23f('0x6'));var Mustache=require(_0xd23f('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd23f('0x8'));var csv=require(_0xd23f('0x9'));var ejs=require(_0xd23f('0xa'));var fs=require('fs');var fs_extra=require(_0xd23f('0xb'));var _=require(_0xd23f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd23f('0xd'));var deskjs=require(_0xd23f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd23f('0xf'));var authService=require(_0xd23f('0x10'));var qs=require(_0xd23f('0x11'));var as=require(_0xd23f('0x12'));var hardwareService=require(_0xd23f('0x13'));var logger=require(_0xd23f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd23f('0x15'));var licenseUtil=require(_0xd23f('0x16'));var db=require(_0xd23f('0x17'))['db'];config[_0xd23f('0x18')]=_[_0xd23f('0x19')](config[_0xd23f('0x18')],{'host':_0xd23f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd23f('0x1b'))[_0xd23f('0x1c')](socket);function respondWithStatusCode(_0x2d45c1,_0x3bb648){_0x3bb648=_0x3bb648||0xcc;return function(_0x5432e5){if(_0x5432e5){return _0x2d45c1[_0xd23f('0x1d')](_0x3bb648);}return _0x2d45c1[_0xd23f('0x1e')](_0x3bb648)[_0xd23f('0x1f')]();};}function respondWithResult(_0x1f513c,_0x10459d){_0x10459d=_0x10459d||0xc8;return function(_0x209df0){if(_0x209df0){return _0x1f513c['status'](_0x10459d)[_0xd23f('0x20')](_0x209df0);}};}function respondWithFilteredResult(_0x310219,_0x2a42a1){return function(_0x1aba09){if(_0x1aba09){var _0x3cd9d4=typeof _0x2a42a1[_0xd23f('0x21')]===_0xd23f('0x22')&&typeof _0x2a42a1[_0xd23f('0x23')]===_0xd23f('0x22');var _0x37bece=_0x1aba09[_0xd23f('0x24')];var _0x58bffa=_0x3cd9d4?0x0:_0x2a42a1[_0xd23f('0x21')];var _0x4a0c4d=_0x3cd9d4?_0x1aba09[_0xd23f('0x24')]:_0x2a42a1[_0xd23f('0x21')]+_0x2a42a1[_0xd23f('0x23')];var _0x5c9798;if(_0x4a0c4d>=_0x37bece){_0x4a0c4d=_0x37bece;_0x5c9798=0xc8;}else{_0x5c9798=0xce;}_0x310219[_0xd23f('0x1e')](_0x5c9798);return _0x310219[_0xd23f('0x25')](_0xd23f('0x26'),_0x58bffa+'-'+_0x4a0c4d+'/'+_0x37bece)['json'](_0x1aba09);}return null;};}function patchUpdates(_0x522bca){return function(_0x4401fa){try{jsonpatch['apply'](_0x4401fa,_0x522bca,!![]);}catch(_0x4d5244){return BPromise[_0xd23f('0x27')](_0x4d5244);}return _0x4401fa['save']();};}function saveUpdates(_0x1c454a,_0x231850){return function(_0x270c11){if(_0x270c11){return _0x270c11['update'](_0x1c454a)[_0xd23f('0x28')](function(_0x3585bc){return _0x3585bc;});}return null;};}function removeEntity(_0x1f442f,_0x268703){return function(_0x358d6f){if(_0x358d6f){return _0x358d6f['destroy']()[_0xd23f('0x28')](function(){_0x1f442f['status'](0xcc)[_0xd23f('0x1f')]();});}};}function handleEntityNotFound(_0x1cb1ee,_0xce9d36){return function(_0x4dfad2){if(!_0x4dfad2){_0x1cb1ee[_0xd23f('0x1d')](0x194);}return _0x4dfad2;};}function handleError(_0x461ea1,_0x2b20aa){_0x2b20aa=_0x2b20aa||0x1f4;return function(_0x26703f){logger[_0xd23f('0x29')](_0x26703f[_0xd23f('0x2a')]);if(_0x26703f[_0xd23f('0x2b')]){delete _0x26703f[_0xd23f('0x2b')];}_0x461ea1[_0xd23f('0x1e')](_0x2b20aa)['send'](_0x26703f);};}exports[_0xd23f('0x2c')]=function(_0x16978d,_0x54a216){var _0x4c0f05={'raw':![],'where':{'id':_0x16978d[_0xd23f('0x2d')]['id']}},_0x5569f9={};_0x5569f9[_0xd23f('0x2e')]=_[_0xd23f('0x2f')](db[_0xd23f('0x30')][_0xd23f('0x31')]);_0x5569f9['query']=_['keys'](_0x16978d[_0xd23f('0x32')]);_0x5569f9[_0xd23f('0x33')]=_[_0xd23f('0x34')](_0x5569f9['model'],_0x5569f9[_0xd23f('0x32')]);_0x4c0f05['attributes']=_[_0xd23f('0x34')](_0x5569f9[_0xd23f('0x2e')],qs['fields'](_0x16978d[_0xd23f('0x32')][_0xd23f('0x35')]));_0x4c0f05['attributes']=_0x4c0f05[_0xd23f('0x36')][_0xd23f('0x37')]?_0x4c0f05[_0xd23f('0x36')]:_0x5569f9[_0xd23f('0x2e')];if(_0x16978d['query'][_0xd23f('0x38')]){_0x4c0f05[_0xd23f('0x39')]=[{'all':!![]}];}_0x4c0f05=_[_0xd23f('0x3a')]({},_0x4c0f05,_0x16978d['options']);return db[_0xd23f('0x30')][_0xd23f('0x3b')](_0x4c0f05)[_0xd23f('0x28')](handleEntityNotFound(_0x54a216,null))[_0xd23f('0x28')](respondWithResult(_0x54a216,null))[_0xd23f('0x3c')](handleError(_0x54a216,null));};exports['destroy']=function(_0x3821ef,_0x328da1){return db[_0xd23f('0x30')][_0xd23f('0x3b')]({'where':{'id':_0x3821ef[_0xd23f('0x2d')]['id']}})[_0xd23f('0x28')](handleEntityNotFound(_0x328da1,null))['then'](removeEntity(_0x328da1,null))['catch'](handleError(_0x328da1,null));};function widgetAttributes(_0x203eef){try{switch(_0x203eef[_0xd23f('0x3d')]){case'iframe':return[{'name':'attrUrl','value':_0x203eef[_0xd23f('0x3e')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef['attrs'][0x0]?_0x203eef['attrs'][0x0][_0xd23f('0x40')]:undefined)||'https://'}];case _0xd23f('0x41'):return[{'name':_0xd23f('0x42'),'value':_0x203eef[_0xd23f('0x42')]||(_0x203eef['attrs']&&_0x203eef['attrs'][0x0]?_0x203eef['attrs'][0x0]['value']:undefined)||''}];case _0xd23f('0x43'):return[{'name':_0xd23f('0x44'),'value':_0x203eef[_0xd23f('0x44')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x0]?_0x203eef[_0xd23f('0x3f')][0x0][_0xd23f('0x40')]:undefined)||_0xd23f('0x45')},{'name':_0xd23f('0x46'),'value':_0x203eef[_0xd23f('0x46')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x1]?_0x203eef['attrs'][0x1][_0xd23f('0x40')]:undefined)||_0xd23f('0x47')},{'name':_0xd23f('0x48'),'value':_0x203eef['attrFontSize']||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef['attrs'][0x2]?_0x203eef['attrs'][0x2][_0xd23f('0x40')]:undefined)||0xc}];case'counter':return[{'name':_0xd23f('0x49'),'value':_0x203eef['attrMetric']||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x0]?_0x203eef[_0xd23f('0x3f')][0x0]['value']:undefined)||'total'},{'name':_0xd23f('0x4a'),'value':_0x203eef[_0xd23f('0x4a')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x1]?_0x203eef['attrs'][0x1][_0xd23f('0x40')]:undefined)||[]},{'name':'attrFontSize','value':_0x203eef['attrFontSize']||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x2]?_0x203eef[_0xd23f('0x3f')][0x2][_0xd23f('0x40')]:undefined)||0x14}];case _0xd23f('0x4b'):case _0xd23f('0x4c'):return[{'name':_0xd23f('0x4d'),'value':_0x203eef['attrSerie1']||(_0x203eef['attrs']&&_0x203eef[_0xd23f('0x3f')][0x0]?_0x203eef[_0xd23f('0x3f')][0x0]['value']:undefined)||_0xd23f('0x4e')},{'name':_0xd23f('0x4f'),'value':_0x203eef[_0xd23f('0x4f')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x1]?_0x203eef[_0xd23f('0x3f')][0x1][_0xd23f('0x40')]:undefined)||null},{'name':_0xd23f('0x50'),'value':_0x203eef[_0xd23f('0x50')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x2]?_0x203eef[_0xd23f('0x3f')][0x2][_0xd23f('0x40')]:undefined)||null},{'name':_0xd23f('0x4a'),'value':_0x203eef[_0xd23f('0x4a')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x3]?_0x203eef[_0xd23f('0x3f')][0x3][_0xd23f('0x40')]:undefined)||[]}];case _0xd23f('0x51'):return[{'name':_0xd23f('0x52'),'type':_0x203eef[_0xd23f('0x53')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x0]?_0x203eef['attrs'][0x0][_0xd23f('0x3d')]:undefined)||null,'value':_0x203eef['attrReport']||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x0]?_0x203eef[_0xd23f('0x3f')][0x0][_0xd23f('0x40')]:undefined)||null},{'name':_0xd23f('0x54'),'value':_0x203eef[_0xd23f('0x54')]||(_0x203eef[_0xd23f('0x3f')]&&_0x203eef[_0xd23f('0x3f')][0x1]?_0x203eef['attrs'][0x1][_0xd23f('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x392332){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x392332));return[];}}exports[_0xd23f('0x55')]=function(_0x4ea4e0,_0x42acb1){if(_0x4ea4e0[_0xd23f('0x56')]){_0x4ea4e0[_0xd23f('0x56')]['attrs']=widgetAttributes(_0x4ea4e0[_0xd23f('0x56')]);}return db[_0xd23f('0x30')][_0xd23f('0x55')](_0x4ea4e0[_0xd23f('0x56')],{})['then'](respondWithResult(_0x42acb1,0xc9))['catch'](handleError(_0x42acb1,null));};exports[_0xd23f('0x57')]=function(_0xc2991e,_0x51e636){if(_0xc2991e['body']['id']){delete _0xc2991e['body']['id'];}_0xc2991e[_0xd23f('0x56')][_0xd23f('0x3f')]=widgetAttributes(_0xc2991e[_0xd23f('0x56')]);return db[_0xd23f('0x30')][_0xd23f('0x3b')]({'where':{'id':_0xc2991e['params']['id']}})[_0xd23f('0x28')](handleEntityNotFound(_0x51e636,null))[_0xd23f('0x28')](saveUpdates(_0xc2991e[_0xd23f('0x56')],null))[_0xd23f('0x28')](respondWithResult(_0x51e636,null))['catch'](handleError(_0x51e636,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d4da47c..ee5ae22 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 _0xb311=['DashboardItem','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x50d8eb,_0x921ba9){var _0x1d7b40=function(_0x5b4781){while(--_0x5b4781){_0x50d8eb['push'](_0x50d8eb['shift']());}};_0x1d7b40(++_0x921ba9);}(_0xb311,0x167));var _0x1b31=function(_0x50ece8,_0x55a922){_0x50ece8=_0x50ece8-0x0;var _0x2efec3=_0xb311[_0x50ece8];return _0x2efec3;};'use strict';var EventEmitter=require(_0x1b31('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x1b31('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1b31('0x2')](0x0);var events={'afterCreate':_0x1b31('0x3'),'afterUpdate':_0x1b31('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8612f7){return function(_0x5d91fe,_0x3ba6bb,_0x2d828f){DashboardItemEvents[_0x1b31('0x5')](_0x8612f7+':'+_0x5d91fe['id'],_0x5d91fe);DashboardItemEvents['emit'](_0x8612f7,_0x5d91fe);_0x2d828f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x1b31('0x6')](e,emitEvent(event));}}module[_0x1b31('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xeba8=['remove','emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save'];(function(_0x5e3c73,_0x1f6546){var _0x149bec=function(_0x398f81){while(--_0x398f81){_0x5e3c73['push'](_0x5e3c73['shift']());}};_0x149bec(++_0x1f6546);}(_0xeba8,0x194));var _0x8eba=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xeba8[_0xd1c39b];return _0x58f5bc;};'use strict';var EventEmitter=require(_0x8eba('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x8eba('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8eba('0x2')](0x0);var events={'afterCreate':_0x8eba('0x3'),'afterUpdate':'update','afterDestroy':_0x8eba('0x4')};function emitEvent(_0xf00349){return function(_0x52446a,_0x35c5b3,_0xd9ec3b){DashboardItemEvents[_0x8eba('0x5')](_0xf00349+':'+_0x52446a['id'],_0x52446a);DashboardItemEvents[_0x8eba('0x5')](_0xf00349,_0x52446a);_0xd9ec3b(null);};}for(var e in events){if(events[_0x8eba('0x6')](e)){var event=events[e];DashboardItem[_0x8eba('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 350ff40..73831a1 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 _0x2036=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items'];(function(_0x197a02,_0x5078a9){var _0x350947=function(_0x50e2dd){while(--_0x50e2dd){_0x197a02['push'](_0x197a02['shift']());}};_0x350947(++_0x5078a9);}(_0x2036,0x11e));var _0x6203=function(_0x48b98c,_0x3d7049){_0x48b98c=_0x48b98c-0x0;var _0x382e97=_0x2036[_0x48b98c];return _0x382e97;};'use strict';var _=require(_0x6203('0x0'));var util=require('util');var logger=require(_0x6203('0x1'))(_0x6203('0x2'));var moment=require(_0x6203('0x3'));var BPromise=require(_0x6203('0x4'));var rp=require(_0x6203('0x5'));var fs=require('fs');var path=require(_0x6203('0x6'));var rimraf=require(_0x6203('0x7'));var config=require(_0x6203('0x8'));var attributes=require(_0x6203('0x9'));module[_0x6203('0xa')]=function(_0x25e4f6,_0x44aa30){return _0x25e4f6[_0x6203('0xb')]('DashboardItem',attributes,{'tableName':_0x6203('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cde=['rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1e2cdc,_0x4689bd){var _0x4d9905=function(_0x17abf2){while(--_0x17abf2){_0x1e2cdc['push'](_0x1e2cdc['shift']());}};_0x4d9905(++_0x4689bd);}(_0x1cde,0x1e7));var _0xe1cd=function(_0x8fc6e3,_0x5dae60){_0x8fc6e3=_0x8fc6e3-0x0;var _0x284415=_0x1cde[_0x8fc6e3];return _0x284415;};'use strict';var _=require(_0xe1cd('0x0'));var util=require(_0xe1cd('0x1'));var logger=require(_0xe1cd('0x2'))('api');var moment=require(_0xe1cd('0x3'));var BPromise=require(_0xe1cd('0x4'));var rp=require(_0xe1cd('0x5'));var fs=require('fs');var path=require(_0xe1cd('0x6'));var rimraf=require(_0xe1cd('0x7'));var config=require(_0xe1cd('0x8'));var attributes=require(_0xe1cd('0x9'));module[_0xe1cd('0xa')]=function(_0x31d63c,_0x558587){return _0x31d63c['define'](_0xe1cd('0xb'),attributes,{'tableName':_0xe1cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index bff425b..87e0c8b 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 _0x647f=['error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x647f,0x1ec));var _0xf647=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x647f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf647('0x0'));var util=require('util');var moment=require(_0xf647('0x1'));var BPromise=require(_0xf647('0x2'));var rs=require(_0xf647('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf647('0x4'))['db'];var utils=require(_0xf647('0x5'));var logger=require(_0xf647('0x6'))('rpc');var config=require(_0xf647('0x7'));var jayson=require(_0xf647('0x8'));var client=jayson[_0xf647('0x9')][_0xf647('0xa')]({'port':0x232a});config[_0xf647('0xb')]=_['defaults'](config[_0xf647('0xb')],{'host':_0xf647('0xc'),'port':0x18eb});var socket=require(_0xf647('0xd'))(new Redis(config['redis']));require(_0xf647('0xe'))['register'](socket);function respondWithRpcPromise(_0x32abec,_0x2770bd,_0x47dcd3){return new BPromise(function(_0x4d6894,_0x3eb475){return client['request'](_0x32abec,_0x47dcd3)[_0xf647('0xf')](function(_0x5f327c){logger[_0xf647('0x10')]('DashboardItem,\x20%s,\x20%s',_0x2770bd,_0xf647('0x11'));logger[_0xf647('0x12')](_0xf647('0x13'),_0x2770bd,_0xf647('0x11'),JSON[_0xf647('0x14')](_0x5f327c));if(_0x5f327c[_0xf647('0x15')]){if(_0x5f327c[_0xf647('0x15')][_0xf647('0x16')]===0x1f4){logger[_0xf647('0x15')]('DashboardItem,\x20%s,\x20%s',_0x2770bd,_0x5f327c[_0xf647('0x15')]['message']);return _0x3eb475(_0x5f327c[_0xf647('0x15')]['message']);}logger['error'](_0xf647('0x17'),_0x2770bd,_0x5f327c[_0xf647('0x15')][_0xf647('0x18')]);return _0x4d6894(_0x5f327c[_0xf647('0x15')][_0xf647('0x18')]);}else{logger[_0xf647('0x10')]('DashboardItem,\x20%s,\x20%s',_0x2770bd,_0xf647('0x11'));_0x4d6894(_0x5f327c[_0xf647('0x19')][_0xf647('0x18')]);}})[_0xf647('0x1a')](function(_0x4feed4){logger[_0xf647('0x15')](_0xf647('0x17'),_0x2770bd,_0x4feed4);_0x3eb475(_0x4feed4);});});} \ No newline at end of file +var _0x8d2c=['DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x669f13,_0xf46f13){var _0x2d0477=function(_0x40908b){while(--_0x40908b){_0x669f13['push'](_0x669f13['shift']());}};_0x2d0477(++_0xf46f13);}(_0x8d2c,0x1a6));var _0xc8d2=function(_0x501723,_0x3fa959){_0x501723=_0x501723-0x0;var _0x4c95e3=_0x8d2c[_0x501723];return _0x4c95e3;};'use strict';var _=require('lodash');var util=require(_0xc8d2('0x0'));var moment=require(_0xc8d2('0x1'));var BPromise=require(_0xc8d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8d2('0x3'));var db=require(_0xc8d2('0x4'))['db'];var utils=require(_0xc8d2('0x5'));var logger=require(_0xc8d2('0x6'))(_0xc8d2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc8d2('0x8'));var client=jayson['client'][_0xc8d2('0x9')]({'port':0x232a});config[_0xc8d2('0xa')]=_['defaults'](config[_0xc8d2('0xa')],{'host':_0xc8d2('0xb'),'port':0x18eb});var socket=require(_0xc8d2('0xc'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xc8d2('0xd')](socket);function respondWithRpcPromise(_0x348051,_0x30dd8,_0x26028c){return new BPromise(function(_0xc8ee9f,_0x4b89e4){return client[_0xc8d2('0xe')](_0x348051,_0x26028c)[_0xc8d2('0xf')](function(_0x3923ac){logger[_0xc8d2('0x10')](_0xc8d2('0x11'),_0x30dd8,_0xc8d2('0x12'));logger[_0xc8d2('0x13')](_0xc8d2('0x14'),_0x30dd8,_0xc8d2('0x12'),JSON['stringify'](_0x3923ac));if(_0x3923ac[_0xc8d2('0x15')]){if(_0x3923ac[_0xc8d2('0x15')][_0xc8d2('0x16')]===0x1f4){logger[_0xc8d2('0x15')](_0xc8d2('0x11'),_0x30dd8,_0x3923ac[_0xc8d2('0x15')][_0xc8d2('0x17')]);return _0x4b89e4(_0x3923ac[_0xc8d2('0x15')][_0xc8d2('0x17')]);}logger[_0xc8d2('0x15')](_0xc8d2('0x11'),_0x30dd8,_0x3923ac['error'][_0xc8d2('0x17')]);return _0xc8ee9f(_0x3923ac[_0xc8d2('0x15')]['message']);}else{logger['info'](_0xc8d2('0x11'),_0x30dd8,'request\x20sent');_0xc8ee9f(_0x3923ac[_0xc8d2('0x18')][_0xc8d2('0x17')]);}})[_0xc8d2('0x19')](function(_0x2ae001){logger['error'](_0xc8d2('0x11'),_0x30dd8,_0x2ae001);_0x4b89e4(_0x2ae001);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 79c04aa..c46a4ac 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 _0xf44d=['./dashboardItem.events','save','remove','update','emit','register','length','dashboardItem:'];(function(_0x87ab58,_0x5c76ee){var _0x45586b=function(_0x33651f){while(--_0x33651f){_0x87ab58['push'](_0x87ab58['shift']());}};_0x45586b(++_0x5c76ee);}(_0xf44d,0xc8));var _0xdf44=function(_0x43f48e,_0x3c3965){_0x43f48e=_0x43f48e-0x0;var _0x187733=_0xf44d[_0x43f48e];return _0x187733;};'use strict';var DashboardItemEvents=require(_0xdf44('0x0'));var events=[_0xdf44('0x1'),_0xdf44('0x2'),_0xdf44('0x3')];function createListener(_0x37baf3,_0x525924){return function(_0x5792e9){_0x525924[_0xdf44('0x4')](_0x37baf3,_0x5792e9);};}function removeListener(_0x1fe9a7,_0x5e5502){return function(){DashboardItemEvents['removeListener'](_0x1fe9a7,_0x5e5502);};}exports[_0xdf44('0x5')]=function(_0xdfe7f6){for(var _0x18d4b2=0x0,_0x4b8339=events[_0xdf44('0x6')];_0x18d4b2<_0x4b8339;_0x18d4b2++){var _0xf2faaa=events[_0x18d4b2];var _0x4d024b=createListener(_0xdf44('0x7')+_0xf2faaa,_0xdfe7f6);DashboardItemEvents['on'](_0xf2faaa,_0x4d024b);}}; \ No newline at end of file +var _0x3110=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x50506e,_0x3ab243){var _0x92a67a=function(_0x53af20){while(--_0x53af20){_0x50506e['push'](_0x50506e['shift']());}};_0x92a67a(++_0x3ab243);}(_0x3110,0x135));var _0x0311=function(_0x1a5bbf,_0x3c4c72){_0x1a5bbf=_0x1a5bbf-0x0;var _0xb6a9ff=_0x3110[_0x1a5bbf];return _0xb6a9ff;};'use strict';var DashboardItemEvents=require(_0x0311('0x0'));var events=[_0x0311('0x1'),_0x0311('0x2'),_0x0311('0x3')];function createListener(_0x18bee9,_0x1e6b56){return function(_0x515992){_0x1e6b56[_0x0311('0x4')](_0x18bee9,_0x515992);};}function removeListener(_0x3bdb7e,_0x85a4bd){return function(){DashboardItemEvents[_0x0311('0x5')](_0x3bdb7e,_0x85a4bd);};}exports[_0x0311('0x6')]=function(_0x4b99f4){for(var _0x480a1d=0x0,_0x5e3401=events[_0x0311('0x7')];_0x480a1d<_0x5e3401;_0x480a1d++){var _0x3800ca=events[_0x480a1d];var _0x18bde6=createListener(_0x0311('0x8')+_0x3800ca,_0x4b99f4);DashboardItemEvents['on'](_0x3800ca,_0x18bde6);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 6f30343..69114d7 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 _0xb8e9=['express','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xb8e9,0xb2));var _0x9b8e=function(_0x4239c8,_0x2c0c6e){_0x4239c8=_0x4239c8-0x0;var _0x40323b=_0xb8e9[_0x4239c8];return _0x40323b;};'use strict';var multer=require(_0x9b8e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b8e('0x1'));var express=require(_0x9b8e('0x2'));var router=express['Router']();var fs_extra=require(_0x9b8e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9b8e('0x4'));var config=require(_0x9b8e('0x5'));var controller=require('./dashboardItem.controller');router[_0x9b8e('0x6')](_0x9b8e('0x7'),auth[_0x9b8e('0x8')](),controller[_0x9b8e('0x9')]);router['post']('/',auth[_0x9b8e('0x8')](),controller[_0x9b8e('0xa')]);router['put']('/:id',auth[_0x9b8e('0x8')](),controller[_0x9b8e('0xb')]);router[_0x9b8e('0xc')](_0x9b8e('0x7'),auth['isAuthenticated'](),controller[_0x9b8e('0xd')]);module[_0x9b8e('0xe')]=router; \ No newline at end of file +var _0xd9d3=['update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x4fa738,_0x2a491c){var _0x55bf55=function(_0x185d53){while(--_0x185d53){_0x4fa738['push'](_0x4fa738['shift']());}};_0x55bf55(++_0x2a491c);}(_0xd9d3,0xfb));var _0x3d9d=function(_0x49026b,_0x5b2911){_0x49026b=_0x49026b-0x0;var _0x2456a2=_0xd9d3[_0x49026b];return _0x2456a2;};'use strict';var multer=require(_0x3d9d('0x0'));var util=require(_0x3d9d('0x1'));var path=require(_0x3d9d('0x2'));var timeout=require(_0x3d9d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d9d('0x4'));var auth=require(_0x3d9d('0x5'));var interaction=require(_0x3d9d('0x6'));var config=require(_0x3d9d('0x7'));var controller=require(_0x3d9d('0x8'));router[_0x3d9d('0x9')](_0x3d9d('0xa'),auth[_0x3d9d('0xb')](),controller[_0x3d9d('0xc')]);router[_0x3d9d('0xd')]('/',auth[_0x3d9d('0xb')](),controller[_0x3d9d('0xe')]);router['put'](_0x3d9d('0xa'),auth[_0x3d9d('0xb')](),controller[_0x3d9d('0xf')]);router[_0x3d9d('0x10')]('/:id',auth[_0x3d9d('0xb')](),controller[_0x3d9d('0x11')]);module[_0x3d9d('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 2a49c06..94cf9c9 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 _0x01be=['ENUM','first','second','sequelize','exports','STRING'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x01be,0x117));var _0xe01b=function(_0xa45b56,_0x5c3026){_0xa45b56=_0xa45b56-0x0;var _0x57b820=_0x01be[_0xa45b56];return _0x57b820;};'use strict';var Sequelize=require(_0xe01b('0x0'));module[_0xe01b('0x1')]={'name':{'type':Sequelize[_0xe01b('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xe01b('0x3')](_0xe01b('0x4'),_0xe01b('0x5'),'third'),'allowNull':![],'defaultValue':_0xe01b('0x4')},'description':{'type':Sequelize[_0xe01b('0x2')]}}; \ No newline at end of file +var _0x59aa=['exports','STRING','first','third'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x59aa,0x168));var _0xa59a=function(_0x483227,_0x3bc79){_0x483227=_0x483227-0x0;var _0x350cae=_0x59aa[_0x483227];return _0x350cae;};'use strict';var Sequelize=require('sequelize');module[_0xa59a('0x0')]={'name':{'type':Sequelize[_0xa59a('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xa59a('0x2'),'second',_0xa59a('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xa59a('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1cf8b31..e6c6369 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 _0xef9e=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','Disposition','fields','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xef9e,0x1ef));var _0xeef9=function(_0x5c8b19,_0x47d79a){_0x5c8b19=_0x5c8b19-0x0;var _0x2ff0cd=_0xef9e[_0x5c8b19];return _0x2ff0cd;};'use strict';var emlformat=require(_0xeef9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeef9('0x1'));var jsonpatch=require(_0xeef9('0x2'));var rp=require(_0xeef9('0x3'));var moment=require(_0xeef9('0x4'));var BPromise=require(_0xeef9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeef9('0x6'));var sox=require(_0xeef9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeef9('0x8'));var _=require(_0xeef9('0x9'));var squel=require(_0xeef9('0xa'));var crypto=require('crypto');var jsforce=require(_0xeef9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xeef9('0xc'));var querystring=require(_0xeef9('0xd'));var Papa=require(_0xeef9('0xe'));var Redis=require(_0xeef9('0xf'));var authService=require(_0xeef9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeef9('0x11'));var hardwareService=require(_0xeef9('0x12'));var logger=require(_0xeef9('0x13'))(_0xeef9('0x14'));var utils=require(_0xeef9('0x15'));var config=require(_0xeef9('0x16'));var licenseUtil=require(_0xeef9('0x17'));var db=require(_0xeef9('0x18'))['db'];function respondWithStatusCode(_0x5aceb1,_0x4a2e48){_0x4a2e48=_0x4a2e48||0xcc;return function(_0x1fbd25){if(_0x1fbd25){return _0x5aceb1[_0xeef9('0x19')](_0x4a2e48);}return _0x5aceb1[_0xeef9('0x1a')](_0x4a2e48)[_0xeef9('0x1b')]();};}function respondWithResult(_0x511899,_0x3ea6ab){_0x3ea6ab=_0x3ea6ab||0xc8;return function(_0x43c208){if(_0x43c208){return _0x511899[_0xeef9('0x1a')](_0x3ea6ab)[_0xeef9('0x1c')](_0x43c208);}};}function respondWithFilteredResult(_0x2c1ad5,_0x191c11){return function(_0x5492f5){if(_0x5492f5){var _0x112657=typeof _0x191c11[_0xeef9('0x1d')]===_0xeef9('0x1e')&&typeof _0x191c11[_0xeef9('0x1f')]==='undefined';var _0x40458b=_0x5492f5[_0xeef9('0x20')];var _0x5eaab0=_0x112657?0x0:_0x191c11['offset'];var _0x3176ef=_0x112657?_0x5492f5[_0xeef9('0x20')]:_0x191c11[_0xeef9('0x1d')]+_0x191c11['limit'];var _0x385f37;if(_0x3176ef>=_0x40458b){_0x3176ef=_0x40458b;_0x385f37=0xc8;}else{_0x385f37=0xce;}_0x2c1ad5['status'](_0x385f37);return _0x2c1ad5[_0xeef9('0x21')](_0xeef9('0x22'),_0x5eaab0+'-'+_0x3176ef+'/'+_0x40458b)[_0xeef9('0x1c')](_0x5492f5);}return null;};}function patchUpdates(_0x4b1085){return function(_0x546fe5){try{jsonpatch['apply'](_0x546fe5,_0x4b1085,!![]);}catch(_0x5893bc){return BPromise['reject'](_0x5893bc);}return _0x546fe5[_0xeef9('0x23')]();};}function saveUpdates(_0x44c935,_0x2ac7e0){return function(_0x3e93a2){if(_0x3e93a2){return _0x3e93a2['update'](_0x44c935)[_0xeef9('0x24')](function(_0x488fc5){return _0x488fc5;});}return null;};}function removeEntity(_0x5c325f,_0x31190f){return function(_0x365466){if(_0x365466){return _0x365466[_0xeef9('0x25')]()[_0xeef9('0x24')](function(){var _0x4bb01a=_0x365466['get']({'plain':!![]});var _0x59cbc0=_0xeef9('0x26');return db[_0xeef9('0x27')][_0xeef9('0x25')]({'where':{'type':_0x59cbc0,'resourceId':_0x4bb01a['id']}})[_0xeef9('0x24')](function(){return _0x365466;});})[_0xeef9('0x24')](function(){_0x5c325f['status'](0xcc)[_0xeef9('0x1b')]();});}};}function handleEntityNotFound(_0x2a9a37,_0x186286){return function(_0x3d164c){if(!_0x3d164c){_0x2a9a37[_0xeef9('0x19')](0x194);}return _0x3d164c;};}function handleError(_0x4a611c,_0x2b9774){_0x2b9774=_0x2b9774||0x1f4;return function(_0x31f504){logger[_0xeef9('0x28')](_0x31f504[_0xeef9('0x29')]);if(_0x31f504['name']){delete _0x31f504[_0xeef9('0x2a')];}_0x4a611c['status'](_0x2b9774)[_0xeef9('0x2b')](_0x31f504);};}exports['index']=function(_0x1d76f8,_0x229a14){var _0x3a4666={},_0x2e5294={},_0x176671={'count':0x0,'rows':[]};var _0x37c7f3=_[_0xeef9('0x2c')](db['Disposition'][_0xeef9('0x2d')],function(_0x32b207){return{'name':_0x32b207[_0xeef9('0x2e')],'type':_0x32b207['type'][_0xeef9('0x2f')]};});_0x2e5294[_0xeef9('0x30')]=_[_0xeef9('0x2c')](_0x37c7f3,'name');_0x2e5294['query']=_[_0xeef9('0x31')](_0x1d76f8[_0xeef9('0x32')]);_0x2e5294[_0xeef9('0x33')]=_[_0xeef9('0x34')](_0x2e5294[_0xeef9('0x30')],_0x2e5294['query']);_0x3a4666[_0xeef9('0x35')]=_['intersection'](_0x2e5294['model'],qs['fields'](_0x1d76f8['query']['fields']));_0x3a4666[_0xeef9('0x35')]=_0x3a4666[_0xeef9('0x35')]['length']?_0x3a4666['attributes']:_0x2e5294[_0xeef9('0x30')];if(!_0x1d76f8['query'][_0xeef9('0x36')](_0xeef9('0x37'))){_0x3a4666['limit']=qs[_0xeef9('0x1f')](_0x1d76f8[_0xeef9('0x32')][_0xeef9('0x1f')]);_0x3a4666[_0xeef9('0x1d')]=qs[_0xeef9('0x1d')](_0x1d76f8[_0xeef9('0x32')][_0xeef9('0x1d')]);}_0x3a4666['order']=qs[_0xeef9('0x38')](_0x1d76f8[_0xeef9('0x32')][_0xeef9('0x38')]);_0x3a4666[_0xeef9('0x39')]=qs[_0xeef9('0x33')](_['pick'](_0x1d76f8[_0xeef9('0x32')],_0x2e5294[_0xeef9('0x33')]),_0x37c7f3);if(_0x1d76f8[_0xeef9('0x32')][_0xeef9('0x3a')]){_0x3a4666[_0xeef9('0x39')]=_[_0xeef9('0x3b')](_0x3a4666[_0xeef9('0x39')],{'$or':_[_0xeef9('0x2c')](_0x37c7f3,function(_0x54ba58){if(_0x54ba58['type']!==_0xeef9('0x3c')){var _0x23e116={};_0x23e116[_0x54ba58[_0xeef9('0x2a')]]={'$like':'%'+_0x1d76f8[_0xeef9('0x32')][_0xeef9('0x3a')]+'%'};return _0x23e116;}})});}_0x3a4666=_[_0xeef9('0x3b')]({},_0x3a4666,_0x1d76f8[_0xeef9('0x3d')]);var _0x317619={'where':_0x3a4666[_0xeef9('0x39')]};return db['Disposition'][_0xeef9('0x20')](_0x317619)['then'](function(_0x5c512f){_0x176671[_0xeef9('0x20')]=_0x5c512f;if(_0x1d76f8[_0xeef9('0x32')][_0xeef9('0x3e')]){_0x3a4666[_0xeef9('0x3f')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3a4666);})[_0xeef9('0x24')](function(_0x2b4ea6){_0x176671[_0xeef9('0x40')]=_0x2b4ea6;return _0x176671;})[_0xeef9('0x24')](respondWithFilteredResult(_0x229a14,_0x3a4666))['catch'](handleError(_0x229a14,null));};exports[_0xeef9('0x41')]=function(_0x37e62d,_0x4e798d){var _0x269495={'raw':!![],'where':{'id':_0x37e62d[_0xeef9('0x42')]['id']}},_0x47de65={};_0x47de65['model']=_['keys'](db[_0xeef9('0x43')][_0xeef9('0x2d')]);_0x47de65[_0xeef9('0x32')]=_[_0xeef9('0x31')](_0x37e62d[_0xeef9('0x32')]);_0x47de65[_0xeef9('0x33')]=_[_0xeef9('0x34')](_0x47de65['model'],_0x47de65[_0xeef9('0x32')]);_0x269495[_0xeef9('0x35')]=_['intersection'](_0x47de65[_0xeef9('0x30')],qs[_0xeef9('0x44')](_0x37e62d['query']['fields']));_0x269495[_0xeef9('0x35')]=_0x269495[_0xeef9('0x35')][_0xeef9('0x45')]?_0x269495[_0xeef9('0x35')]:_0x47de65[_0xeef9('0x30')];if(_0x37e62d[_0xeef9('0x32')][_0xeef9('0x3e')]){_0x269495['include']=[{'all':!![]}];}_0x269495=_[_0xeef9('0x3b')]({},_0x269495,_0x37e62d[_0xeef9('0x3d')]);return db[_0xeef9('0x43')][_0xeef9('0x46')](_0x269495)[_0xeef9('0x24')](handleEntityNotFound(_0x4e798d,null))[_0xeef9('0x24')](respondWithResult(_0x4e798d,null))[_0xeef9('0x47')](handleError(_0x4e798d,null));};exports[_0xeef9('0x48')]=function(_0x224711,_0x307b6a){return db['Disposition'][_0xeef9('0x48')](_0x224711[_0xeef9('0x49')],{})['then'](function(_0x393754){var _0x40e482=_0x224711[_0xeef9('0x4a')][_0xeef9('0x4b')]({'plain':!![]});if(!_0x40e482)throw new Error(_0xeef9('0x4c'));if(_0x40e482[_0xeef9('0x4d')]===_0xeef9('0x4a')){var _0x5bbb03=_0x393754[_0xeef9('0x4b')]({'plain':!![]});var _0x5b6589=_0xeef9('0x26');return db[_0xeef9('0x4e')][_0xeef9('0x46')]({'where':{'name':_0x5b6589,'userProfileId':_0x40e482[_0xeef9('0x4f')]},'raw':!![]})[_0xeef9('0x24')](function(_0x4ec5cc){if(_0x4ec5cc&&_0x4ec5cc['autoAssociation']===0x0){return db['UserProfileResource'][_0xeef9('0x48')]({'name':_0x5bbb03[_0xeef9('0x2a')],'resourceId':_0x5bbb03['id'],'type':_0x4ec5cc[_0xeef9('0x2a')],'sectionId':_0x4ec5cc['id']},{})[_0xeef9('0x24')](function(){return _0x393754;});}else{return _0x393754;}})[_0xeef9('0x47')](function(_0x1cbc0c){logger['error'](_0xeef9('0x50'),_0x1cbc0c);throw _0x1cbc0c;});}return _0x393754;})[_0xeef9('0x24')](respondWithResult(_0x307b6a,0xc9))[_0xeef9('0x47')](handleError(_0x307b6a,null));};exports[_0xeef9('0x51')]=function(_0x387ddb,_0xc982ce){if(_0x387ddb[_0xeef9('0x49')]['id']){delete _0x387ddb[_0xeef9('0x49')]['id'];}return db[_0xeef9('0x43')][_0xeef9('0x46')]({'where':{'id':_0x387ddb[_0xeef9('0x42')]['id']}})[_0xeef9('0x24')](handleEntityNotFound(_0xc982ce,null))[_0xeef9('0x24')](saveUpdates(_0x387ddb['body'],null))[_0xeef9('0x24')](respondWithResult(_0xc982ce,null))[_0xeef9('0x47')](handleError(_0xc982ce,null));};exports[_0xeef9('0x25')]=function(_0x25890a,_0x19c1dd){return db[_0xeef9('0x43')][_0xeef9('0x46')]({'where':{'id':_0x25890a[_0xeef9('0x42')]['id']}})[_0xeef9('0x24')](handleEntityNotFound(_0x19c1dd,null))[_0xeef9('0x24')](removeEntity(_0x19c1dd,null))[_0xeef9('0x47')](handleError(_0x19c1dd,null));}; \ No newline at end of file +var _0x8e08=['pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Dispositions','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','index','Disposition','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8e08,0xf9));var _0x88e0=function(_0x53cba0,_0x391fba){_0x53cba0=_0x53cba0-0x0;var _0x5a0c5d=_0x8e08[_0x53cba0];return _0x5a0c5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88e0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88e0('0x1'));var rp=require(_0x88e0('0x2'));var moment=require(_0x88e0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x88e0('0x4'));var util=require(_0x88e0('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x88e0('0x6'));var fs=require('fs');var fs_extra=require(_0x88e0('0x7'));var _=require(_0x88e0('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x88e0('0x9'));var deskjs=require(_0x88e0('0xa'));var toCsv=require(_0x88e0('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x88e0('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x88e0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88e0('0xe'))('api');var utils=require(_0x88e0('0xf'));var config=require(_0x88e0('0x10'));var licenseUtil=require(_0x88e0('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x480d36,_0xcd31dd){_0xcd31dd=_0xcd31dd||0xcc;return function(_0x5104ba){if(_0x5104ba){return _0x480d36[_0x88e0('0x12')](_0xcd31dd);}return _0x480d36[_0x88e0('0x13')](_0xcd31dd)[_0x88e0('0x14')]();};}function respondWithResult(_0x29cb6d,_0x368e64){_0x368e64=_0x368e64||0xc8;return function(_0x313f22){if(_0x313f22){return _0x29cb6d[_0x88e0('0x13')](_0x368e64)[_0x88e0('0x15')](_0x313f22);}};}function respondWithFilteredResult(_0x3439a8,_0x413135){return function(_0x739ed2){if(_0x739ed2){var _0x463d75=typeof _0x413135[_0x88e0('0x16')]===_0x88e0('0x17')&&typeof _0x413135['limit']===_0x88e0('0x17');var _0x6b5dc6=_0x739ed2[_0x88e0('0x18')];var _0x53d48e=_0x463d75?0x0:_0x413135[_0x88e0('0x16')];var _0x482da5=_0x463d75?_0x739ed2[_0x88e0('0x18')]:_0x413135[_0x88e0('0x16')]+_0x413135[_0x88e0('0x19')];var _0x1caa9b;if(_0x482da5>=_0x6b5dc6){_0x482da5=_0x6b5dc6;_0x1caa9b=0xc8;}else{_0x1caa9b=0xce;}_0x3439a8['status'](_0x1caa9b);return _0x3439a8['set'](_0x88e0('0x1a'),_0x53d48e+'-'+_0x482da5+'/'+_0x6b5dc6)[_0x88e0('0x15')](_0x739ed2);}return null;};}function patchUpdates(_0x234327){return function(_0xeb4600){try{jsonpatch[_0x88e0('0x1b')](_0xeb4600,_0x234327,!![]);}catch(_0x1d970b){return BPromise[_0x88e0('0x1c')](_0x1d970b);}return _0xeb4600[_0x88e0('0x1d')]();};}function saveUpdates(_0x53cafd,_0x442376){return function(_0x37d117){if(_0x37d117){return _0x37d117[_0x88e0('0x1e')](_0x53cafd)['then'](function(_0x1a5e0e){return _0x1a5e0e;});}return null;};}function removeEntity(_0x3f2726,_0x350c4c){return function(_0x22c818){if(_0x22c818){return _0x22c818[_0x88e0('0x1f')]()[_0x88e0('0x20')](function(){var _0x1e3a10=_0x22c818['get']({'plain':!![]});var _0x5551c1='Dispositions';return db[_0x88e0('0x21')][_0x88e0('0x1f')]({'where':{'type':_0x5551c1,'resourceId':_0x1e3a10['id']}})[_0x88e0('0x20')](function(){return _0x22c818;});})['then'](function(){_0x3f2726[_0x88e0('0x13')](0xcc)[_0x88e0('0x14')]();});}};}function handleEntityNotFound(_0xde6196,_0x302bf1){return function(_0x246ed5){if(!_0x246ed5){_0xde6196[_0x88e0('0x12')](0x194);}return _0x246ed5;};}function handleError(_0x279087,_0x553136){_0x553136=_0x553136||0x1f4;return function(_0x2759e5){logger[_0x88e0('0x22')](_0x2759e5[_0x88e0('0x23')]);if(_0x2759e5[_0x88e0('0x24')]){delete _0x2759e5[_0x88e0('0x24')];}_0x279087[_0x88e0('0x13')](_0x553136)['send'](_0x2759e5);};}exports[_0x88e0('0x25')]=function(_0x185b27,_0x53d993){var _0x8b8e88={},_0x195c86={},_0x12ecab={'count':0x0,'rows':[]};var _0x27b5c3=_['map'](db[_0x88e0('0x26')][_0x88e0('0x27')],function(_0x4ba3d2){return{'name':_0x4ba3d2[_0x88e0('0x28')],'type':_0x4ba3d2[_0x88e0('0x29')][_0x88e0('0x2a')]};});_0x195c86['model']=_[_0x88e0('0x2b')](_0x27b5c3,_0x88e0('0x24'));_0x195c86[_0x88e0('0x2c')]=_[_0x88e0('0x2d')](_0x185b27[_0x88e0('0x2c')]);_0x195c86[_0x88e0('0x2e')]=_[_0x88e0('0x2f')](_0x195c86[_0x88e0('0x30')],_0x195c86[_0x88e0('0x2c')]);_0x8b8e88[_0x88e0('0x31')]=_['intersection'](_0x195c86['model'],qs['fields'](_0x185b27['query']['fields']));_0x8b8e88[_0x88e0('0x31')]=_0x8b8e88[_0x88e0('0x31')][_0x88e0('0x32')]?_0x8b8e88[_0x88e0('0x31')]:_0x195c86[_0x88e0('0x30')];if(!_0x185b27['query']['hasOwnProperty'](_0x88e0('0x33'))){_0x8b8e88[_0x88e0('0x19')]=qs[_0x88e0('0x19')](_0x185b27[_0x88e0('0x2c')][_0x88e0('0x19')]);_0x8b8e88['offset']=qs['offset'](_0x185b27[_0x88e0('0x2c')][_0x88e0('0x16')]);}_0x8b8e88[_0x88e0('0x34')]=qs[_0x88e0('0x35')](_0x185b27[_0x88e0('0x2c')]['sort']);_0x8b8e88[_0x88e0('0x36')]=qs['filters'](_[_0x88e0('0x37')](_0x185b27[_0x88e0('0x2c')],_0x195c86['filters']),_0x27b5c3);if(_0x185b27[_0x88e0('0x2c')][_0x88e0('0x38')]){_0x8b8e88['where']=_[_0x88e0('0x39')](_0x8b8e88['where'],{'$or':_['map'](_0x27b5c3,function(_0x5c4c00){if(_0x5c4c00[_0x88e0('0x29')]!==_0x88e0('0x3a')){var _0x1a15cd={};_0x1a15cd[_0x5c4c00[_0x88e0('0x24')]]={'$like':'%'+_0x185b27['query']['filter']+'%'};return _0x1a15cd;}})});}_0x8b8e88=_[_0x88e0('0x39')]({},_0x8b8e88,_0x185b27[_0x88e0('0x3b')]);var _0x48ff28={'where':_0x8b8e88[_0x88e0('0x36')]};return db['Disposition'][_0x88e0('0x18')](_0x48ff28)[_0x88e0('0x20')](function(_0x4eeba1){_0x12ecab['count']=_0x4eeba1;if(_0x185b27[_0x88e0('0x2c')][_0x88e0('0x3c')]){_0x8b8e88[_0x88e0('0x3d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x8b8e88);})[_0x88e0('0x20')](function(_0x4d3aa4){_0x12ecab[_0x88e0('0x3e')]=_0x4d3aa4;return _0x12ecab;})['then'](respondWithFilteredResult(_0x53d993,_0x8b8e88))[_0x88e0('0x3f')](handleError(_0x53d993,null));};exports[_0x88e0('0x40')]=function(_0x422bcf,_0x605dbf){var _0x15d5eb={'raw':!![],'where':{'id':_0x422bcf[_0x88e0('0x41')]['id']}},_0x5868b6={};_0x5868b6['model']=_['keys'](db['Disposition'][_0x88e0('0x27')]);_0x5868b6['query']=_[_0x88e0('0x2d')](_0x422bcf[_0x88e0('0x2c')]);_0x5868b6[_0x88e0('0x2e')]=_[_0x88e0('0x2f')](_0x5868b6[_0x88e0('0x30')],_0x5868b6[_0x88e0('0x2c')]);_0x15d5eb[_0x88e0('0x31')]=_['intersection'](_0x5868b6['model'],qs[_0x88e0('0x42')](_0x422bcf[_0x88e0('0x2c')][_0x88e0('0x42')]));_0x15d5eb[_0x88e0('0x31')]=_0x15d5eb['attributes'][_0x88e0('0x32')]?_0x15d5eb['attributes']:_0x5868b6['model'];if(_0x422bcf['query'][_0x88e0('0x3c')]){_0x15d5eb[_0x88e0('0x3d')]=[{'all':!![]}];}_0x15d5eb=_[_0x88e0('0x39')]({},_0x15d5eb,_0x422bcf[_0x88e0('0x3b')]);return db[_0x88e0('0x26')]['find'](_0x15d5eb)['then'](handleEntityNotFound(_0x605dbf,null))[_0x88e0('0x20')](respondWithResult(_0x605dbf,null))[_0x88e0('0x3f')](handleError(_0x605dbf,null));};exports[_0x88e0('0x43')]=function(_0x5b8ab2,_0x404106){return db[_0x88e0('0x26')][_0x88e0('0x43')](_0x5b8ab2[_0x88e0('0x44')],{})['then'](function(_0x1d65d6){var _0x39b347=_0x5b8ab2[_0x88e0('0x45')]['get']({'plain':!![]});if(!_0x39b347)throw new Error(_0x88e0('0x46'));if(_0x39b347[_0x88e0('0x47')]==='user'){var _0x57d19e=_0x1d65d6[_0x88e0('0x48')]({'plain':!![]});var _0x11717b=_0x88e0('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x11717b,'userProfileId':_0x39b347[_0x88e0('0x4a')]},'raw':!![]})[_0x88e0('0x20')](function(_0x593b9e){if(_0x593b9e&&_0x593b9e['autoAssociation']===0x0){return db[_0x88e0('0x21')][_0x88e0('0x43')]({'name':_0x57d19e[_0x88e0('0x24')],'resourceId':_0x57d19e['id'],'type':_0x593b9e['name'],'sectionId':_0x593b9e['id']},{})[_0x88e0('0x20')](function(){return _0x1d65d6;});}else{return _0x1d65d6;}})[_0x88e0('0x3f')](function(_0x46a2b5){logger[_0x88e0('0x22')](_0x88e0('0x4b'),_0x46a2b5);throw _0x46a2b5;});}return _0x1d65d6;})[_0x88e0('0x20')](respondWithResult(_0x404106,0xc9))['catch'](handleError(_0x404106,null));};exports['update']=function(_0x464c4f,_0x42aecd){if(_0x464c4f[_0x88e0('0x44')]['id']){delete _0x464c4f['body']['id'];}return db[_0x88e0('0x26')]['find']({'where':{'id':_0x464c4f[_0x88e0('0x41')]['id']}})[_0x88e0('0x20')](handleEntityNotFound(_0x42aecd,null))['then'](saveUpdates(_0x464c4f['body'],null))[_0x88e0('0x20')](respondWithResult(_0x42aecd,null))[_0x88e0('0x3f')](handleError(_0x42aecd,null));};exports[_0x88e0('0x1f')]=function(_0x41ba1e,_0x51101b){return db[_0x88e0('0x26')]['find']({'where':{'id':_0x41ba1e[_0x88e0('0x41')]['id']}})[_0x88e0('0x20')](handleEntityNotFound(_0x51101b,null))[_0x88e0('0x20')](removeEntity(_0x51101b,null))[_0x88e0('0x3f')](handleError(_0x51101b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 8cc8d54..03e84a9 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 _0xb862=['name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','api','moment','bluebird','./disposition.attributes','exports','define','Disposition','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x17afbd,_0x45af18){var _0xb2735d=function(_0x5df1cc){while(--_0x5df1cc){_0x17afbd['push'](_0x17afbd['shift']());}};_0xb2735d(++_0x45af18);}(_0xb862,0xb7));var _0x2b86=function(_0xe9e94e,_0xc323a4){_0xe9e94e=_0xe9e94e-0x0;var _0x57d03a=_0xb862[_0xe9e94e];return _0x57d03a;};'use strict';var _=require(_0x2b86('0x0'));var util=require(_0x2b86('0x1'));var logger=require('../../config/logger')(_0x2b86('0x2'));var moment=require(_0x2b86('0x3'));var BPromise=require(_0x2b86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b86('0x5'));module[_0x2b86('0x6')]=function(_0x49d5ac,_0x1a7ae8){return _0x49d5ac[_0x2b86('0x7')](_0x2b86('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x2b86('0x9'),'fields':[_0x2b86('0xa'),'ListId']},{'unique':!![],'name':_0x2b86('0xb'),'fields':[_0x2b86('0xa'),_0x2b86('0xc')]},{'unique':!![],'name':_0x2b86('0xd'),'fields':[_0x2b86('0xa'),_0x2b86('0xe')]},{'unique':!![],'name':_0x2b86('0xf'),'fields':[_0x2b86('0xa'),_0x2b86('0x10')]},{'unique':!![],'name':'name_fax','fields':[_0x2b86('0xa'),'FaxAccountId']},{'unique':!![],'name':_0x2b86('0x11'),'fields':['name',_0x2b86('0x12')]},{'unique':!![],'name':_0x2b86('0x13'),'fields':[_0x2b86('0xa'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fd8=['name_voice','name_chat','ChatWebsiteId','name_mail','name','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./disposition.attributes','Disposition'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x8fd8,0x1c4));var _0x88fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fd8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x88fd('0x0'));var util=require(_0x88fd('0x1'));var logger=require(_0x88fd('0x2'))(_0x88fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x88fd('0x4'));var fs=require('fs');var path=require(_0x88fd('0x5'));var rimraf=require(_0x88fd('0x6'));var config=require(_0x88fd('0x7'));var attributes=require(_0x88fd('0x8'));module['exports']=function(_0x5d240d,_0x2908ad){return _0x5d240d['define'](_0x88fd('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x88fd('0xa'),'fields':['name','ListId']},{'unique':!![],'name':_0x88fd('0xb'),'fields':['name',_0x88fd('0xc')]},{'unique':!![],'name':_0x88fd('0xd'),'fields':[_0x88fd('0xe'),_0x88fd('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x88fd('0xe'),_0x88fd('0x10')]},{'unique':!![],'name':_0x88fd('0x11'),'fields':['name',_0x88fd('0x12')]},{'unique':!![],'name':_0x88fd('0x13'),'fields':[_0x88fd('0xe'),_0x88fd('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x88fd('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e010ad9..9e6e215 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(_0x7d78b5,_0x185734){var _0xb85869=function(_0x35cdcf){while(--_0x35cdcf){_0x7d78b5['push'](_0x7d78b5['shift']());}};_0xb85869(++_0x185734);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x29dbf1,_0x4fabff){var _0x4c6043=function(_0x1a75e0){while(--_0x1a75e0){_0x29dbf1['push'](_0x29dbf1['shift']());}};_0x4c6043(++_0x4fabff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 7cee1fa..3d16d6d 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 _0x0350=['post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','show'];(function(_0x246faf,_0x12f669){var _0x52cd05=function(_0x2fd103){while(--_0x2fd103){_0x246faf['push'](_0x246faf['shift']());}};_0x52cd05(++_0x12f669);}(_0x0350,0xc4));var _0x0035=function(_0x295037,_0x5ca69d){_0x295037=_0x295037-0x0;var _0x4ceaa9=_0x0350[_0x295037];return _0x4ceaa9;};'use strict';var multer=require(_0x0035('0x0'));var util=require(_0x0035('0x1'));var path=require(_0x0035('0x2'));var timeout=require(_0x0035('0x3'));var express=require(_0x0035('0x4'));var router=express['Router']();var fs_extra=require(_0x0035('0x5'));var auth=require(_0x0035('0x6'));var interaction=require(_0x0035('0x7'));var config=require(_0x0035('0x8'));var controller=require(_0x0035('0x9'));router['get']('/',auth[_0x0035('0xa')](),controller[_0x0035('0xb')]);router[_0x0035('0xc')]('/:id',auth[_0x0035('0xa')](),controller[_0x0035('0xd')]);router[_0x0035('0xe')]('/',auth[_0x0035('0xa')](),controller[_0x0035('0xf')]);router[_0x0035('0x10')](_0x0035('0x11'),auth[_0x0035('0xa')](),controller[_0x0035('0x12')]);router[_0x0035('0x13')](_0x0035('0x11'),auth[_0x0035('0xa')](),controller['destroy']);module[_0x0035('0x14')]=router; \ No newline at end of file +var _0x3424=['isAuthenticated','/:id','show','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x33e925,_0x59457d){var _0x28c7e2=function(_0x3cb52d){while(--_0x3cb52d){_0x33e925['push'](_0x33e925['shift']());}};_0x28c7e2(++_0x59457d);}(_0x3424,0x1d2));var _0x4342=function(_0x56c342,_0x313cc8){_0x56c342=_0x56c342-0x0;var _0x22b241=_0x3424[_0x56c342];return _0x22b241;};'use strict';var multer=require(_0x4342('0x0'));var util=require(_0x4342('0x1'));var path=require(_0x4342('0x2'));var timeout=require(_0x4342('0x3'));var express=require(_0x4342('0x4'));var router=express[_0x4342('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4342('0x6'));var interaction=require(_0x4342('0x7'));var config=require(_0x4342('0x8'));var controller=require('./disposition.controller');router[_0x4342('0x9')]('/',auth[_0x4342('0xa')](),controller['index']);router['get'](_0x4342('0xb'),auth['isAuthenticated'](),controller[_0x4342('0xc')]);router['post']('/',auth[_0x4342('0xa')](),controller[_0x4342('0xd')]);router[_0x4342('0xe')](_0x4342('0xb'),auth[_0x4342('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4342('0xf')]);module[_0x4342('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 5c0dc2c..8970e4a 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 _0xddef=['14400','7200','DADHI','SIP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xddef,0xb4));var _0xfdde=function(_0x52f427,_0x46e88e){_0x52f427=_0x52f427-0x0;var _0x2bea3e=_0xddef[_0x52f427];return _0x2bea3e;};'use strict';var Sequelize=require('sequelize');module[_0xfdde('0x0')]={'name':{'type':Sequelize[_0xfdde('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfdde('0x1')]},'ecm':{'type':Sequelize[_0xfdde('0x2')](_0xfdde('0x3'),'no'),'defaultValue':_0xfdde('0x3')},'headerinfo':{'type':Sequelize[_0xfdde('0x1')],'defaultValue':_0xfdde('0x4')},'localstationid':{'type':Sequelize[_0xfdde('0x1')],'unique':_0xfdde('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xfdde('0x6'),_0xfdde('0x7'),'7200',_0xfdde('0x8'),_0xfdde('0x9'),_0xfdde('0xa')),'defaultValue':_0xfdde('0x7')},'maxrate':{'type':Sequelize[_0xfdde('0x2')](_0xfdde('0x6'),'4800',_0xfdde('0xb'),'9600',_0xfdde('0x9'),_0xfdde('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xfdde('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xfdde('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xfdde('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfdde('0x2')]('SIP','IAX',_0xfdde('0xc'),'KHOMP'),'defaultValue':_0xfdde('0xd')},'key':{'type':Sequelize[_0xfdde('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfdde('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfdde('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfdde('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfdde('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfdde('0x10')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfdde('0x11'),'set':function(_0x37b7f1){if(!_0x37b7f1)this[_0xfdde('0x12')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x37b7f1);}}}; \ No newline at end of file +var _0x2d4d=['STRING','ENUM','yes','localstationid','2400','7200','9600','12000','14400','4800','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0x2d4d,0x1ed));var _0xd2d4=function(_0x3a205e,_0x9cc94e){_0x3a205e=_0x3a205e-0x0;var _0x3437ba=_0x2d4d[_0x3a205e];return _0x3437ba;};'use strict';var Sequelize=require(_0xd2d4('0x0'));module['exports']={'name':{'type':Sequelize[_0xd2d4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd2d4('0x1')]},'ecm':{'type':Sequelize[_0xd2d4('0x2')](_0xd2d4('0x3'),'no'),'defaultValue':_0xd2d4('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xd2d4('0x1')],'unique':_0xd2d4('0x4')},'minrate':{'type':Sequelize['ENUM'](_0xd2d4('0x5'),'4800',_0xd2d4('0x6'),_0xd2d4('0x7'),_0xd2d4('0x8'),_0xd2d4('0x9')),'defaultValue':_0xd2d4('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0xd2d4('0x5'),_0xd2d4('0xa'),_0xd2d4('0x6'),_0xd2d4('0x7'),_0xd2d4('0x8'),_0xd2d4('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xd2d4('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xd2d4('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd2d4('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd2d4('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xd2d4('0xc'),'IAX',_0xd2d4('0xd'),_0xd2d4('0xe')),'defaultValue':_0xd2d4('0xc')},'key':{'type':Sequelize[_0xd2d4('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd2d4('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd2d4('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd2d4('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd2d4('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd2d4('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd2d4('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd2d4('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd2d4('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xd2d4('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xd2d4('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a256e){if(!_0x2a256e)this[_0xd2d4('0x12')]('mandatoryDispositionPauseId',null);this[_0xd2d4('0x12')]('mandatoryDisposition',_0x2a256e);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index f27809e..3e2a6d7 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 _0x84d3=['mandatoryDispositionPause','keys','FaxAccount','rawAttributes','fields','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','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','omit','key','createdAt','findById','getMessages','$gte','format','FaxMessage','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','ListId','Send\x20Fax\x20failed','filename','Messages','ContactId','dataValues','SendFax','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxAccount.socket','client','http','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','map','type','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params'];(function(_0x56f4ba,_0x85e116){var _0x557179=function(_0x39cc8b){while(--_0x39cc8b){_0x56f4ba['push'](_0x56f4ba['shift']());}};_0x557179(++_0x85e116);}(_0x84d3,0x1ee));var _0x384d=function(_0x6d4831,_0x334108){_0x6d4831=_0x6d4831-0x0;var _0x28f8f8=_0x84d3[_0x6d4831];return _0x28f8f8;};'use strict';var emlformat=require(_0x384d('0x0'));var rimraf=require(_0x384d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x384d('0x2'));var rp=require(_0x384d('0x3'));var moment=require(_0x384d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x384d('0x5'));var ejs=require(_0x384d('0x6'));var fs=require('fs');var fs_extra=require(_0x384d('0x7'));var _=require(_0x384d('0x8'));var squel=require(_0x384d('0x9'));var crypto=require('crypto');var jsforce=require(_0x384d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x384d('0x5'));var querystring=require(_0x384d('0xb'));var Papa=require(_0x384d('0xc'));var Redis=require(_0x384d('0xd'));var authService=require(_0x384d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x384d('0xf'));var hardwareService=require(_0x384d('0x10'));var logger=require(_0x384d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x384d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x384d('0x13'))['db'];config['redis']=_[_0x384d('0x14')](config[_0x384d('0x15')],{'host':_0x384d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x384d('0x15')]));require(_0x384d('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x384d('0x18')][_0x384d('0x19')]({'port':0x232c});var client9002=jayson[_0x384d('0x18')][_0x384d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4eba7f,_0x4be26e,_0x4c8244,_0x45a6bb){return new BPromise(function(_0x409cb2,_0xe4c24f){var _0x3d56f6=_0x45a6bb||client;return _0x3d56f6[_0x384d('0x1a')](_0x4eba7f,_0x4c8244)[_0x384d('0x1b')](function(_0x267dde){logger['info'](_0x384d('0x1c'),_0x4be26e,'request\x20sent');logger[_0x384d('0x1d')](_0x384d('0x1e'),_0x4be26e,_0x384d('0x1f'),JSON[_0x384d('0x20')](_0x267dde));if(_0x267dde[_0x384d('0x21')]){if(_0x267dde['error']['code']===0x1f4){logger[_0x384d('0x21')](_0x384d('0x1c'),_0x4be26e,_0x267dde['error'][_0x384d('0x22')]);return _0xe4c24f(_0x267dde[_0x384d('0x21')][_0x384d('0x22')]);}logger[_0x384d('0x21')](_0x384d('0x1c'),_0x4be26e,_0x267dde[_0x384d('0x21')][_0x384d('0x22')]);return _0x409cb2(_0x267dde[_0x384d('0x21')][_0x384d('0x22')]);}else{logger[_0x384d('0x23')](_0x384d('0x1c'),_0x4be26e,_0x384d('0x1f'));_0x409cb2(_0x267dde[_0x384d('0x24')][_0x384d('0x22')]);}})[_0x384d('0x25')](function(_0x386813){logger[_0x384d('0x21')](_0x384d('0x1c'),_0x4be26e,_0x386813);_0xe4c24f(_0x386813);});});}function respondWithStatusCode(_0x4d681f,_0x387af1){_0x387af1=_0x387af1||0xcc;return function(_0xb3d3f7){if(_0xb3d3f7){return _0x4d681f['sendStatus'](_0x387af1);}return _0x4d681f[_0x384d('0x26')](_0x387af1)[_0x384d('0x27')]();};}function respondWithResult(_0x1e35f5,_0x4a0c90){_0x4a0c90=_0x4a0c90||0xc8;return function(_0x517956){if(_0x517956){return _0x1e35f5[_0x384d('0x26')](_0x4a0c90)['json'](_0x517956);}};}function respondWithFilteredResult(_0xa63978,_0x2346b0){return function(_0x484e3f){if(_0x484e3f){var _0x598fa5=typeof _0x2346b0['offset']==='undefined'&&typeof _0x2346b0['limit']===_0x384d('0x28');var _0x419194=_0x484e3f[_0x384d('0x29')];var _0x236d22=_0x598fa5?0x0:_0x2346b0[_0x384d('0x2a')];var _0x5060d1=_0x598fa5?_0x484e3f[_0x384d('0x29')]:_0x2346b0['offset']+_0x2346b0[_0x384d('0x2b')];var _0x29d2cf;if(_0x5060d1>=_0x419194){_0x5060d1=_0x419194;_0x29d2cf=0xc8;}else{_0x29d2cf=0xce;}_0xa63978[_0x384d('0x26')](_0x29d2cf);return _0xa63978[_0x384d('0x2c')](_0x384d('0x2d'),_0x236d22+'-'+_0x5060d1+'/'+_0x419194)[_0x384d('0x2e')](_0x484e3f);}return null;};}function patchUpdates(_0x5ab20a){return function(_0x446e10){try{jsonpatch['apply'](_0x446e10,_0x5ab20a,!![]);}catch(_0x262cde){return BPromise[_0x384d('0x2f')](_0x262cde);}return _0x446e10[_0x384d('0x30')]();};}function saveUpdates(_0x32cb8d,_0x520a95){return function(_0x5d69c8){if(_0x5d69c8){return _0x5d69c8[_0x384d('0x31')](_0x32cb8d)['then'](function(_0xff749b){return _0xff749b;});}return null;};}function removeEntity(_0x235105,_0x944c58){return function(_0x1c73f5){if(_0x1c73f5){return _0x1c73f5[_0x384d('0x32')]()['then'](function(){var _0x200d4f=_0x1c73f5['get']({'plain':!![]});var _0x39edc7=_0x384d('0x33');return db[_0x384d('0x34')][_0x384d('0x32')]({'where':{'type':_0x39edc7,'resourceId':_0x200d4f['id']}})[_0x384d('0x1b')](function(){return _0x1c73f5;});})['then'](function(){_0x235105[_0x384d('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fcf1,_0x972b22){return function(_0x87c63b){if(!_0x87c63b){_0x56fcf1[_0x384d('0x35')](0x194);}return _0x87c63b;};}function handleError(_0x1df882,_0x1b5215){_0x1b5215=_0x1b5215||0x1f4;return function(_0x21869e){logger['error'](_0x21869e[_0x384d('0x36')]);if(_0x21869e[_0x384d('0x37')]){delete _0x21869e[_0x384d('0x37')];}_0x1df882[_0x384d('0x26')](_0x1b5215)[_0x384d('0x38')](_0x21869e);};}exports[_0x384d('0x39')]=function(_0x3c6063,_0x558716){var _0x2a6114={'include':[{'model':db[_0x384d('0x3a')],'as':'mandatoryDispositionPause'}]},_0x4e33c0={},_0x55fa47={'count':0x0,'rows':[]};var _0x28517c=_[_0x384d('0x3b')](db['FaxAccount']['rawAttributes'],function(_0x3b70f9){return{'name':_0x3b70f9['fieldName'],'type':_0x3b70f9[_0x384d('0x3c')]['key']};});_0x4e33c0[_0x384d('0x3d')]=_[_0x384d('0x3b')](_0x28517c,_0x384d('0x37'));_0x4e33c0[_0x384d('0x3e')]=_['keys'](_0x3c6063[_0x384d('0x3e')]);_0x4e33c0['filters']=_[_0x384d('0x3f')](_0x4e33c0['model'],_0x4e33c0['query']);_0x2a6114[_0x384d('0x40')]=_[_0x384d('0x3f')](_0x4e33c0['model'],qs['fields'](_0x3c6063['query']['fields']));_0x2a6114[_0x384d('0x40')]=_0x2a6114[_0x384d('0x40')][_0x384d('0x41')]?_0x2a6114[_0x384d('0x40')]:_0x4e33c0[_0x384d('0x3d')];if(!_0x3c6063[_0x384d('0x3e')][_0x384d('0x42')](_0x384d('0x43'))){_0x2a6114['limit']=qs['limit'](_0x3c6063[_0x384d('0x3e')][_0x384d('0x2b')]);_0x2a6114['offset']=qs[_0x384d('0x2a')](_0x3c6063['query'][_0x384d('0x2a')]);}_0x2a6114[_0x384d('0x44')]=qs[_0x384d('0x45')](_0x3c6063[_0x384d('0x3e')]['sort']);_0x2a6114[_0x384d('0x46')]=qs[_0x384d('0x47')](_[_0x384d('0x48')](_0x3c6063[_0x384d('0x3e')],_0x4e33c0[_0x384d('0x47')]),_0x28517c);if(_0x3c6063['query']['filter']){_0x2a6114['where']=_[_0x384d('0x49')](_0x2a6114['where'],{'$or':_[_0x384d('0x3b')](_0x28517c,function(_0x59c575){if(_0x59c575[_0x384d('0x3c')]!==_0x384d('0x4a')){var _0x46b0a3={};_0x46b0a3[_0x59c575['name']]={'$like':'%'+_0x3c6063[_0x384d('0x3e')][_0x384d('0x4b')]+'%'};return _0x46b0a3;}})});}_0x2a6114=_[_0x384d('0x49')]({},_0x2a6114,_0x3c6063[_0x384d('0x4c')]);var _0x2ebdf3={'where':_0x2a6114[_0x384d('0x46')]};return db['FaxAccount']['count'](_0x2ebdf3)[_0x384d('0x1b')](function(_0x13af3c){_0x55fa47[_0x384d('0x29')]=_0x13af3c;if(_0x3c6063[_0x384d('0x3e')][_0x384d('0x4d')]){_0x2a6114[_0x384d('0x4e')]=[{'all':!![]}];}return db['FaxAccount'][_0x384d('0x4f')](_0x2a6114);})['then'](function(_0x10bf46){_0x55fa47[_0x384d('0x50')]=_0x10bf46;return _0x55fa47;})['then'](respondWithFilteredResult(_0x558716,_0x2a6114))[_0x384d('0x25')](handleError(_0x558716,null));};exports['show']=function(_0x427468,_0x555596){var _0x9e0073={'raw':![],'where':{'id':_0x427468[_0x384d('0x51')]['id']},'include':[{'model':db[_0x384d('0x3a')],'as':_0x384d('0x52')}]},_0x57c3a2={};_0x57c3a2[_0x384d('0x3d')]=_[_0x384d('0x53')](db[_0x384d('0x54')][_0x384d('0x55')]);_0x57c3a2[_0x384d('0x3e')]=_[_0x384d('0x53')](_0x427468[_0x384d('0x3e')]);_0x57c3a2[_0x384d('0x47')]=_['intersection'](_0x57c3a2[_0x384d('0x3d')],_0x57c3a2[_0x384d('0x3e')]);_0x9e0073['attributes']=_[_0x384d('0x3f')](_0x57c3a2[_0x384d('0x3d')],qs[_0x384d('0x56')](_0x427468['query'][_0x384d('0x56')]));_0x9e0073[_0x384d('0x40')]=_0x9e0073[_0x384d('0x40')][_0x384d('0x41')]?_0x9e0073['attributes']:_0x57c3a2['model'];if(_0x427468[_0x384d('0x3e')][_0x384d('0x4d')]){_0x9e0073[_0x384d('0x4e')]=[{'all':!![]}];}_0x9e0073=_[_0x384d('0x49')]({},_0x9e0073,_0x427468[_0x384d('0x4c')]);return db[_0x384d('0x54')][_0x384d('0x57')](_0x9e0073)[_0x384d('0x1b')](handleEntityNotFound(_0x555596,null))[_0x384d('0x1b')](respondWithResult(_0x555596,null))['catch'](handleError(_0x555596,null));};exports[_0x384d('0x58')]=function(_0x2e017d,_0x25236c){return db[_0x384d('0x54')][_0x384d('0x58')](_0x2e017d[_0x384d('0x59')],{})[_0x384d('0x1b')](function(_0x457bc6){var _0x237a80=_0x2e017d[_0x384d('0x5a')][_0x384d('0x5b')]({'plain':!![]});if(!_0x237a80)throw new Error(_0x384d('0x5c'));if(_0x237a80[_0x384d('0x5d')]===_0x384d('0x5a')){var _0x8e29a3=_0x457bc6[_0x384d('0x5b')]({'plain':!![]});var _0x4d8b5b=_0x384d('0x33');return db[_0x384d('0x5e')][_0x384d('0x57')]({'where':{'name':_0x4d8b5b,'userProfileId':_0x237a80[_0x384d('0x5f')]},'raw':!![]})[_0x384d('0x1b')](function(_0x57d9c5){if(_0x57d9c5&&_0x57d9c5[_0x384d('0x60')]===0x0){return db[_0x384d('0x34')]['create']({'name':_0x8e29a3[_0x384d('0x37')],'resourceId':_0x8e29a3['id'],'type':_0x57d9c5['name'],'sectionId':_0x57d9c5['id']},{})[_0x384d('0x1b')](function(){return _0x457bc6;});}else{return _0x457bc6;}})[_0x384d('0x25')](function(_0x1c4cac){logger[_0x384d('0x21')](_0x384d('0x61'),_0x1c4cac);throw _0x1c4cac;});}return _0x457bc6;})[_0x384d('0x1b')](respondWithResult(_0x25236c,0xc9))[_0x384d('0x25')](handleError(_0x25236c,null));};exports['update']=function(_0x16ea58,_0x30b4ad){if(_0x16ea58[_0x384d('0x59')]['id']){delete _0x16ea58[_0x384d('0x59')]['id'];}return db[_0x384d('0x54')][_0x384d('0x57')]({'where':{'id':_0x16ea58['params']['id']},'include':[{'model':db[_0x384d('0x3a')],'as':_0x384d('0x52')}]})['then'](handleEntityNotFound(_0x30b4ad,null))['then'](saveUpdates(_0x16ea58[_0x384d('0x59')],null))[_0x384d('0x1b')](respondWithResult(_0x30b4ad,null))[_0x384d('0x25')](handleError(_0x30b4ad,null));};exports[_0x384d('0x32')]=function(_0x12308c,_0x47a477){return db[_0x384d('0x54')][_0x384d('0x57')]({'where':{'id':_0x12308c[_0x384d('0x51')]['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x47a477,null))[_0x384d('0x1b')](removeEntity(_0x47a477,null))[_0x384d('0x25')](handleError(_0x47a477,null));};exports[_0x384d('0x62')]=function(_0x3b4d58,_0x4ddb71){return db[_0x384d('0x54')][_0x384d('0x62')]()[_0x384d('0x1b')](respondWithResult(_0x4ddb71,null))['catch'](handleError(_0x4ddb71,null));};exports[_0x384d('0x63')]=function(_0x34690c,_0x7c01c2,_0x318a72){if(_0x34690c[_0x384d('0x59')]['id']){delete _0x34690c['body']['id'];}return db['FaxAccount'][_0x384d('0x57')]({'where':{'id':_0x34690c['params']['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x7c01c2,null))['then'](function(_0x437e46){if(_0x437e46){_0x34690c[_0x384d('0x59')][_0x384d('0x64')]=_0x437e46['id'];return db[_0x384d('0x65')][_0x384d('0x58')](_0x34690c[_0x384d('0x59')]);}})[_0x384d('0x1b')](respondWithResult(_0x7c01c2,null))[_0x384d('0x25')](handleError(_0x7c01c2,null));};exports[_0x384d('0x66')]=function(_0x5192fb,_0x5cbc44,_0x2b1d5a){var _0xbccbc7={'raw':![],'where':{}};var _0x3cc4ec={};var _0x46e286={'count':0x0,'rows':[]};return db[_0x384d('0x54')][_0x384d('0x67')]({'where':{'id':_0x5192fb['params']['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x5cbc44,null))[_0x384d('0x1b')](function(_0x15b64d){if(_0x15b64d){_0x3cc4ec[_0x384d('0x3d')]=_[_0x384d('0x53')](db[_0x384d('0x65')][_0x384d('0x55')]);_0x3cc4ec['query']=_[_0x384d('0x53')](_0x5192fb[_0x384d('0x3e')]);_0x3cc4ec[_0x384d('0x47')]=_['intersection'](_0x3cc4ec[_0x384d('0x3d')],_0x3cc4ec[_0x384d('0x3e')]);_0xbccbc7[_0x384d('0x40')]=_[_0x384d('0x3f')](_0x3cc4ec['model'],qs['fields'](_0x5192fb['query']['fields']));_0xbccbc7[_0x384d('0x40')]=_0xbccbc7['attributes'][_0x384d('0x41')]?_0xbccbc7['attributes']:_0x3cc4ec[_0x384d('0x3d')];if(!_0x5192fb[_0x384d('0x3e')][_0x384d('0x42')]('nolimit')){_0xbccbc7[_0x384d('0x2b')]=qs[_0x384d('0x2b')](_0x5192fb['query'][_0x384d('0x2b')]);_0xbccbc7[_0x384d('0x2a')]=qs[_0x384d('0x2a')](_0x5192fb[_0x384d('0x3e')][_0x384d('0x2a')]);}_0xbccbc7['order']=qs['sort'](_0x5192fb[_0x384d('0x3e')][_0x384d('0x45')]);_0xbccbc7[_0x384d('0x46')]=qs['filters'](_['pick'](_0x5192fb[_0x384d('0x3e')],_0x3cc4ec[_0x384d('0x47')]));_0xbccbc7[_0x384d('0x46')][_0x384d('0x64')]=_0x15b64d['id'];if(_0x5192fb[_0x384d('0x3e')]['filter']){_0xbccbc7[_0x384d('0x46')]=_['merge'](_0xbccbc7[_0x384d('0x46')],{'$or':_['map'](_0xbccbc7[_0x384d('0x40')],function(_0x2582dd){var _0x3ad5f8={};_0x3ad5f8[_0x2582dd]={'$like':'%'+_0x5192fb['query']['filter']+'%'};return _0x3ad5f8;})});}_0xbccbc7=_['merge']({},_0xbccbc7,_0x5192fb[_0x384d('0x4c')]);return db[_0x384d('0x65')][_0x384d('0x29')]({'where':_0xbccbc7[_0x384d('0x46')]})['then'](function(_0x2fbb72){_0x46e286[_0x384d('0x29')]=_0x2fbb72;if(_0x5192fb[_0x384d('0x3e')][_0x384d('0x4d')]){_0xbccbc7[_0x384d('0x4e')]=[{'all':!![]}];}return db[_0x384d('0x65')][_0x384d('0x4f')](_0xbccbc7);})[_0x384d('0x1b')](function(_0x81c7e2){_0x46e286[_0x384d('0x50')]=_0x81c7e2;return _0x46e286;});}})[_0x384d('0x1b')](respondWithFilteredResult(_0x5cbc44,_0xbccbc7))[_0x384d('0x25')](handleError(_0x5cbc44,null));};exports[_0x384d('0x68')]=function(_0x24abab,_0x1cf5a2,_0x306e27){return db[_0x384d('0x54')]['find']({'where':{'id':_0x24abab[_0x384d('0x51')]['id']}})['then'](handleEntityNotFound(_0x1cf5a2,null))[_0x384d('0x1b')](function(_0x534ed4){if(_0x534ed4){return _0x534ed4[_0x384d('0x68')](_0x24abab[_0x384d('0x3e')][_0x384d('0x69')]);}})[_0x384d('0x1b')](respondWithStatusCode(_0x1cf5a2,null))[_0x384d('0x25')](handleError(_0x1cf5a2,null));};exports[_0x384d('0x6a')]=function(_0x4d7d0e,_0x465ec8,_0x523f7d){if(_0x4d7d0e[_0x384d('0x59')]['id']){delete _0x4d7d0e['body']['id'];}return db['FaxAccount'][_0x384d('0x57')]({'where':{'id':_0x4d7d0e['params']['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x465ec8,null))[_0x384d('0x1b')](function(_0x51c94b){if(_0x51c94b){_0x4d7d0e[_0x384d('0x59')]['FaxAccountId']=_0x51c94b['id'];return db[_0x384d('0x6b')][_0x384d('0x58')](_0x4d7d0e[_0x384d('0x59')]);}})['then'](respondWithResult(_0x465ec8,null))[_0x384d('0x25')](handleError(_0x465ec8,null));};exports[_0x384d('0x6c')]=function(_0x127f58,_0x1c62ef,_0xd47683){var _0x4a3122={'raw':![],'where':{}};var _0x377704={};var _0x1b5a48={'count':0x0,'rows':[]};return db[_0x384d('0x54')][_0x384d('0x67')]({'where':{'id':_0x127f58[_0x384d('0x51')]['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x1c62ef,null))[_0x384d('0x1b')](function(_0x13ed44){if(_0x13ed44){_0x377704[_0x384d('0x3d')]=_['keys'](db['CannedAnswer'][_0x384d('0x55')]);_0x377704['query']=_['keys'](_0x127f58[_0x384d('0x3e')]);_0x377704[_0x384d('0x47')]=_['intersection'](_0x377704['model'],_0x377704[_0x384d('0x3e')]);_0x4a3122[_0x384d('0x40')]=_[_0x384d('0x3f')](_0x377704['model'],qs[_0x384d('0x56')](_0x127f58[_0x384d('0x3e')][_0x384d('0x56')]));_0x4a3122['attributes']=_0x4a3122['attributes']['length']?_0x4a3122['attributes']:_0x377704[_0x384d('0x3d')];if(!_0x127f58[_0x384d('0x3e')][_0x384d('0x42')](_0x384d('0x43'))){_0x4a3122[_0x384d('0x2b')]=qs['limit'](_0x127f58[_0x384d('0x3e')]['limit']);_0x4a3122[_0x384d('0x2a')]=qs['offset'](_0x127f58[_0x384d('0x3e')][_0x384d('0x2a')]);}_0x4a3122['order']=qs[_0x384d('0x45')](_0x127f58[_0x384d('0x3e')]['sort']);_0x4a3122[_0x384d('0x46')]=qs['filters'](_[_0x384d('0x48')](_0x127f58[_0x384d('0x3e')],_0x377704['filters']));_0x4a3122[_0x384d('0x46')][_0x384d('0x64')]=_0x13ed44['id'];if(_0x127f58[_0x384d('0x3e')]['filter']){_0x4a3122[_0x384d('0x46')]=_[_0x384d('0x49')](_0x4a3122[_0x384d('0x46')],{'$or':_[_0x384d('0x3b')](_0x4a3122[_0x384d('0x40')],function(_0x3b2f72){var _0x22d36b={};_0x22d36b[_0x3b2f72]={'$like':'%'+_0x127f58[_0x384d('0x3e')][_0x384d('0x4b')]+'%'};return _0x22d36b;})});}_0x4a3122=_['merge']({},_0x4a3122,_0x127f58[_0x384d('0x4c')]);return db[_0x384d('0x6b')][_0x384d('0x29')]({'where':_0x4a3122[_0x384d('0x46')]})[_0x384d('0x1b')](function(_0x14a8ca){_0x1b5a48['count']=_0x14a8ca;if(_0x127f58[_0x384d('0x3e')][_0x384d('0x4d')]){_0x4a3122[_0x384d('0x4e')]=[{'all':!![]}];}return db[_0x384d('0x6b')]['findAll'](_0x4a3122);})[_0x384d('0x1b')](function(_0x5b3475){_0x1b5a48['rows']=_0x5b3475;return _0x1b5a48;});}})[_0x384d('0x1b')](respondWithFilteredResult(_0x1c62ef,_0x4a3122))['catch'](handleError(_0x1c62ef,null));};exports[_0x384d('0x6d')]=function(_0x22cb9e,_0x54dc14,_0x545d84){return db[_0x384d('0x54')][_0x384d('0x57')]({'where':{'id':_0x22cb9e[_0x384d('0x51')]['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x54dc14,null))['then'](function(_0xa0bce5){if(_0xa0bce5){return _0xa0bce5[_0x384d('0x6d')](_0x22cb9e['query'][_0x384d('0x69')]);}})[_0x384d('0x1b')](respondWithStatusCode(_0x54dc14,null))[_0x384d('0x25')](handleError(_0x54dc14,null));};exports[_0x384d('0x6e')]=function(_0x512bca,_0x2e2d54,_0x5945a8){return db[_0x384d('0x6f')][_0x384d('0x57')]({'where':{'id':_0x512bca['params']['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x2e2d54,null))[_0x384d('0x1b')](function(_0x287117){if(_0x287117){return _0x287117[_0x384d('0x6e')](_0x512bca[_0x384d('0x59')][_0x384d('0x69')],_['omit'](_0x512bca[_0x384d('0x59')],[_0x384d('0x69'),'id'])||{});}})[_0x384d('0x1b')](respondWithResult(_0x2e2d54,null))['catch'](handleError(_0x2e2d54,null));};exports['getInteractions']=function(_0x54fe6b,_0x131841,_0x4cf808){var _0x405f52={'raw':![],'where':{}};var _0x42b4f5={};var _0x280ba3={'count':0x0,'rows':[]};return db['FaxAccount'][_0x384d('0x67')]({'where':{'id':_0x54fe6b['params']['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x131841,null))[_0x384d('0x1b')](function(_0x5115e6){if(_0x5115e6){_0x42b4f5['model']=_[_0x384d('0x53')](db[_0x384d('0x6f')][_0x384d('0x55')]);_0x42b4f5[_0x384d('0x3e')]=_[_0x384d('0x53')](_0x54fe6b['query']);_0x42b4f5['filters']=_[_0x384d('0x3f')](_0x42b4f5[_0x384d('0x3d')],_0x42b4f5['query']);_0x405f52[_0x384d('0x40')]=_['intersection'](_0x42b4f5[_0x384d('0x3d')],qs[_0x384d('0x56')](_0x54fe6b[_0x384d('0x3e')][_0x384d('0x56')]));_0x405f52['attributes']=_0x405f52[_0x384d('0x40')]['length']?_0x405f52[_0x384d('0x40')]:_0x42b4f5[_0x384d('0x3d')];if(!_0x54fe6b['query'][_0x384d('0x42')]('nolimit')){_0x405f52['limit']=qs[_0x384d('0x2b')](_0x54fe6b[_0x384d('0x3e')][_0x384d('0x2b')]);_0x405f52[_0x384d('0x2a')]=qs[_0x384d('0x2a')](_0x54fe6b[_0x384d('0x3e')][_0x384d('0x2a')]);}_0x405f52[_0x384d('0x44')]=qs[_0x384d('0x45')](_0x54fe6b[_0x384d('0x3e')]['sort']);_0x405f52[_0x384d('0x46')]=qs[_0x384d('0x47')](_['pick'](_0x54fe6b[_0x384d('0x3e')],_0x42b4f5[_0x384d('0x47')]));_0x405f52['where'][_0x384d('0x64')]=_0x5115e6['id'];if(_0x54fe6b['query'][_0x384d('0x4b')]){_0x405f52[_0x384d('0x46')]=_[_0x384d('0x49')](_0x405f52['where'],{'$or':_[_0x384d('0x3b')](_0x405f52[_0x384d('0x40')],function(_0x3d7d8d){var _0x200edf={};_0x200edf[_0x3d7d8d]={'$like':'%'+_0x54fe6b[_0x384d('0x3e')][_0x384d('0x4b')]+'%'};return _0x200edf;})});}_0x405f52=_[_0x384d('0x49')]({},_0x405f52,_0x54fe6b['options']);return db['FaxInteraction'][_0x384d('0x29')]({'where':_0x405f52[_0x384d('0x46')]})[_0x384d('0x1b')](function(_0x144b7f){_0x280ba3[_0x384d('0x29')]=_0x144b7f;if(_0x54fe6b[_0x384d('0x3e')][_0x384d('0x4d')]){_0x405f52[_0x384d('0x4e')]=[{'model':db[_0x384d('0x70')],'as':_0x384d('0x71'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x384d('0x37'),_0x384d('0x72'),_0x384d('0x73')],'required':![]},{'model':db[_0x384d('0x74')],'as':_0x384d('0x75'),'attributes':['id',_0x384d('0x37'),_0x384d('0x76')],'where':_0x54fe6b[_0x384d('0x3e')]['tag']?{'id':_0x54fe6b[_0x384d('0x3e')][_0x384d('0x77')]}:undefined,'required':_0x54fe6b[_0x384d('0x3e')][_0x384d('0x77')]?!![]:![]}];}return db[_0x384d('0x6f')][_0x384d('0x4f')](_0x405f52);})[_0x384d('0x1b')](function(_0x59c26e){_0x280ba3[_0x384d('0x50')]=_0x59c26e;return _0x280ba3;});}})[_0x384d('0x1b')](respondWithFilteredResult(_0x131841,_0x405f52))['catch'](handleError(_0x131841,null));};exports[_0x384d('0x78')]=function(_0x15da1c,_0x3558d4,_0x4dfa04){return db[_0x384d('0x54')][_0x384d('0x67')]({'where':{'id':_0x15da1c[_0x384d('0x51')]['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x3558d4,null))[_0x384d('0x1b')](function(_0x5ac590){if(_0x5ac590){return db[_0x384d('0x79')][_0x384d('0x7a')](function(_0x541698){return db[_0x384d('0x7b')][_0x384d('0x32')]({'where':{'FaxAccountId':_0x15da1c['params']['id']},'transaction':_0x541698})[_0x384d('0x1b')](function(_0x58d714){var _0xd72682=_[_0x384d('0x3b')](_0x15da1c[_0x384d('0x59')],function(_0x5c9674){_0x5c9674[_0x384d('0x64')]=_0x15da1c[_0x384d('0x51')]['id'];return _0x5c9674;});return db[_0x384d('0x7b')]['bulkCreate'](_0xd72682,{'transaction':_0x541698});});})['then'](function(){return db[_0x384d('0x7b')][_0x384d('0x7c')]({'where':{'FaxAccountId':_0x15da1c[_0x384d('0x51')]['id']},'order':_0x384d('0x7d')});});}})[_0x384d('0x1b')](respondWithResult(_0x3558d4,null))[_0x384d('0x25')](handleError(_0x3558d4,null));};exports['getApplications']=function(_0x178902,_0x1c8acc,_0x2da05a){var _0x1797d1={};var _0xeb04b5={};var _0x474050;var _0xc57f21;return db[_0x384d('0x54')][_0x384d('0x67')]({'where':{'id':_0x178902[_0x384d('0x51')]['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x1c8acc,null))[_0x384d('0x1b')](function(_0x1faf88){if(_0x1faf88){_0x474050=_0x1faf88;_0xeb04b5[_0x384d('0x3d')]=_[_0x384d('0x53')](db[_0x384d('0x7b')][_0x384d('0x55')]);_0xeb04b5[_0x384d('0x3e')]=_['keys'](_0x178902['query']);_0xeb04b5[_0x384d('0x47')]=_['intersection'](_0xeb04b5['model'],_0xeb04b5['query']);_0x1797d1[_0x384d('0x40')]=_[_0x384d('0x3f')](_0xeb04b5['model'],qs[_0x384d('0x56')](_0x178902[_0x384d('0x3e')][_0x384d('0x56')]));_0x1797d1[_0x384d('0x40')]=_0x1797d1['attributes'][_0x384d('0x41')]?_0x1797d1[_0x384d('0x40')]:_0xeb04b5[_0x384d('0x3d')];_0x1797d1[_0x384d('0x44')]=qs['sort'](_0x178902[_0x384d('0x3e')][_0x384d('0x45')]);_0x1797d1[_0x384d('0x46')]=qs[_0x384d('0x47')](_['pick'](_0x178902[_0x384d('0x3e')],_0xeb04b5['filters']));if(_0x178902[_0x384d('0x3e')][_0x384d('0x4b')]){_0x1797d1[_0x384d('0x46')]=_[_0x384d('0x49')](_0x1797d1[_0x384d('0x46')],{'$or':_[_0x384d('0x3b')](_0x1797d1[_0x384d('0x40')],function(_0x54dbd6){var _0x5ce0ff={};_0x5ce0ff[_0x54dbd6]={'$like':'%'+_0x178902[_0x384d('0x3e')][_0x384d('0x4b')]+'%'};return _0x5ce0ff;})});}_0x1797d1=_['merge']({},_0x1797d1,_0x178902[_0x384d('0x4c')]);return _0x474050[_0x384d('0x7e')](_0x1797d1);}})[_0x384d('0x1b')](function(_0x705fb6){if(_0x705fb6){_0xc57f21=_0x705fb6['length'];if(!_0x178902['query'][_0x384d('0x42')]('nolimit')){_0x1797d1[_0x384d('0x2b')]=qs[_0x384d('0x2b')](_0x178902[_0x384d('0x3e')][_0x384d('0x2b')]);_0x1797d1['offset']=qs[_0x384d('0x2a')](_0x178902['query'][_0x384d('0x2a')]);}return _0x474050['getApplications'](_0x1797d1);}})[_0x384d('0x1b')](function(_0x386be1){if(_0x386be1){return _0x386be1?{'count':_0xc57f21,'rows':_0x386be1}:null;}})[_0x384d('0x1b')](respondWithResult(_0x1c8acc,null))['catch'](handleError(_0x1c8acc,null));};function Extension(_0x34fc6b,_0x2d6e01,_0x272f41,_0x100611){this[_0x384d('0x7f')]=_0x384d('0x80');this[_0x384d('0x81')]=_0x34fc6b[_0x384d('0x82')];this['app']=_0x100611;this[_0x384d('0x3c')]='system';this[_0x384d('0x83')]=_0x384d('0x84');this[_0x384d('0x64')]=_0x34fc6b['id'];this['priority']=_0x2d6e01;this[_0x384d('0x85')]=_0x272f41;}function createExtensionsReciveFax(_0x3ecf98){var _0x271b27=0x1;var _0x25c696=[];_0x25c696[_0x384d('0x86')](new Extension(_0x3ecf98,_0x271b27,'',_0x384d('0x87')));_0x271b27+=0x1;_0x25c696[_0x384d('0x86')](new Extension(_0x3ecf98,_0x271b27,_0x384d('0x88'),_0x384d('0x89')));_0x271b27+=0x1;for(var _0x2ec68b in _0x3ecf98){if(_0x3ecf98[_0x384d('0x42')](_0x2ec68b)&&(_0x2ec68b==='ecm'||_0x2ec68b==='localstationid'||_0x2ec68b===_0x384d('0x8a')||_0x2ec68b===_0x384d('0x8b')||_0x2ec68b===_0x384d('0x8c')||_0x2ec68b===_0x384d('0x8d')||_0x2ec68b===_0x384d('0x8e')||_0x2ec68b===_0x384d('0x8f')||_0x2ec68b===_0x384d('0x90'))){_0x25c696[_0x384d('0x86')](new Extension(_0x3ecf98,_0x271b27,'FAXOPT('+_0x2ec68b+')='+_0x3ecf98[_0x2ec68b],_0x384d('0x89')));_0x271b27+=0x1;}}_0x25c696['push'](new Extension(_0x3ecf98,_0x271b27,'6',_0x384d('0x91')));_0x271b27+=0x1;_0x25c696[_0x384d('0x86')](new Extension(_0x3ecf98,_0x271b27,_0x384d('0x92'),_0x384d('0x93')));_0x271b27=0x0;return _0x25c696;}exports[_0x384d('0x94')]=function(_0x471869,_0x4b82ac,_0xeca8b9){var _0x412803;return db[_0x384d('0x79')]['transaction'](function(_0x4f095b){return db[_0x384d('0x54')]['create'](_0x471869[_0x384d('0x59')],{'transaction':_0x4f095b})['then'](function(_0x53a761){_0x412803=_0x53a761['get']({'plain':!![]});return db[_0x384d('0x95')][_0x384d('0x96')](createExtensionsReciveFax(_0x412803),{'transaction':_0x4f095b});});})[_0x384d('0x1b')](function(){return _0x412803;})['then'](respondWithResult(_0x4b82ac,null))[_0x384d('0x25')](handleError(_0x4b82ac,null));};exports[_0x384d('0x97')]=function(_0x34d5a6,_0x155ced,_0x2a6df9){var _0xe53b02;return db['sequelize']['transaction'](function(_0x1286f1){return db['FaxAccount'][_0x384d('0x31')](_0x34d5a6[_0x384d('0x59')],{'where':{'id':_0x34d5a6[_0x384d('0x59')]['id']},'transaction':_0x1286f1})['then'](function(_0x5c44d8){return db[_0x384d('0x95')][_0x384d('0x32')]({'where':{'FaxAccountId':_0x34d5a6[_0x384d('0x59')]['id']},'transaction':_0x1286f1})[_0x384d('0x1b')](function(_0x56041f){return db[_0x384d('0x95')][_0x384d('0x96')](createExtensionsReciveFax(_[_0x384d('0x98')](_0x34d5a6[_0x384d('0x59')],['tech',_0x384d('0x99'),_0x384d('0x9a'),'updatedAt','TrunkId','ListId'])),{'transaction':_0x1286f1});});});})['then'](function(){return db[_0x384d('0x54')][_0x384d('0x9b')](_0x34d5a6[_0x384d('0x59')]['id']);})['then'](respondWithResult(_0x155ced,null))[_0x384d('0x25')](handleError(_0x155ced,null));};exports[_0x384d('0x9c')]=function(_0x5d021,_0x391aa7,_0x4d9737){var _0x2b5a05={'raw':!![],'where':{}};var _0x474902={};var _0x2fc37a={'count':0x0,'rows':[]};return db[_0x384d('0x54')][_0x384d('0x67')]({'where':{'id':_0x5d021['params']['id']}})['then'](handleEntityNotFound(_0x391aa7,null))[_0x384d('0x1b')](function(_0x3fbf7e){if(_0x3fbf7e){_0x474902[_0x384d('0x3d')]=_[_0x384d('0x53')](db['FaxMessage'][_0x384d('0x55')]);_0x474902['query']=_[_0x384d('0x53')](_0x5d021['query']);_0x474902[_0x384d('0x47')]=_['intersection'](_0x474902[_0x384d('0x3d')],_0x474902['query']);_0x2b5a05[_0x384d('0x40')]=_[_0x384d('0x3f')](_0x474902[_0x384d('0x3d')],qs[_0x384d('0x56')](_0x5d021[_0x384d('0x3e')][_0x384d('0x56')]));_0x2b5a05[_0x384d('0x40')]=_0x2b5a05[_0x384d('0x40')][_0x384d('0x41')]?_0x2b5a05['attributes']:_0x474902[_0x384d('0x3d')];if(!_0x5d021[_0x384d('0x3e')][_0x384d('0x42')]('nolimit')){_0x2b5a05[_0x384d('0x2b')]=qs[_0x384d('0x2b')](_0x5d021[_0x384d('0x3e')][_0x384d('0x2b')]);_0x2b5a05['offset']=qs[_0x384d('0x2a')](_0x5d021[_0x384d('0x3e')][_0x384d('0x2a')]);}_0x2b5a05[_0x384d('0x44')]=qs[_0x384d('0x45')](_0x5d021[_0x384d('0x3e')][_0x384d('0x45')]);_0x2b5a05['where']=qs[_0x384d('0x47')](_[_0x384d('0x48')](_0x5d021[_0x384d('0x3e')],_0x474902[_0x384d('0x47')]));_0x2b5a05[_0x384d('0x46')]['FaxAccountId']=_0x3fbf7e['id'];if(_0x5d021[_0x384d('0x3e')][_0x384d('0x4b')]){_0x2b5a05[_0x384d('0x46')]=_['merge'](_0x2b5a05[_0x384d('0x46')],{'$or':_['map'](_0x2b5a05[_0x384d('0x40')],function(_0x31d942){var _0x1c7ccf={};_0x1c7ccf[_0x31d942]={'$like':'%'+_0x5d021[_0x384d('0x3e')][_0x384d('0x4b')]+'%'};return _0x1c7ccf;})});}if(_0x5d021['query']['$gte']){var _0x2abf5e=_0x5d021[_0x384d('0x3e')][_0x384d('0x9d')]['split'](',');var _0x5de646={};_0x5de646[_0x2abf5e[0x0]]={'$gte':moment(_0x2abf5e[0x1])[_0x384d('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2b5a05[_0x384d('0x46')]=_[_0x384d('0x49')](_0x2b5a05[_0x384d('0x46')],_0x5de646);}_0x2b5a05=_[_0x384d('0x49')]({},_0x2b5a05,_0x5d021[_0x384d('0x4c')]);return db[_0x384d('0x9f')]['count']({'where':_0x2b5a05['where']})[_0x384d('0x1b')](function(_0x53ec00){_0x2fc37a['count']=_0x53ec00;if(_0x5d021['query'][_0x384d('0x4d')]){_0x2b5a05['include']=[{'all':!![]}];}return db[_0x384d('0x9f')][_0x384d('0x4f')](_0x2b5a05);})[_0x384d('0x1b')](function(_0x119d71){_0x2fc37a[_0x384d('0x50')]=_0x119d71;return _0x2fc37a;});}})[_0x384d('0x1b')](respondWithFilteredResult(_0x391aa7,_0x2b5a05))['catch'](handleError(_0x391aa7,null));};exports['send']=function(_0x215ccd,_0x4f7538,_0x49e75f){var _0x1352a3,_0x9ab063={},_0x5cc4ed;if(_0x215ccd['body']['to']){_0x5cc4ed=_0x215ccd[_0x384d('0x59')]['to'][0x0];}return db[_0x384d('0x54')]['find']({'where':{'id':_0x215ccd[_0x384d('0x51')]['id']},'include':[{'model':db[_0x384d('0xa0')],'as':_0x384d('0xa1'),'include':[{'model':db[_0x384d('0x70')],'as':_0x384d('0xa2'),'where':{'fax':_0x5cc4ed},'limit':0x1,'order':[[_0x384d('0xa3'),_0x384d('0xa4')]]}]}]})['then'](handleEntityNotFound(_0x4f7538,null))[_0x384d('0x1b')](function(_0x2b07c1){_0x1352a3=_0x2b07c1;if(_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')]&&_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')][_0x384d('0x41')]){for(var _0x5c31ad=0x0;_0x5c31ad<_0x215ccd['body']['attachments'][_0x384d('0x41')];_0x5c31ad+=0x1){_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')][_0x5c31ad]={'filename':_0x215ccd[_0x384d('0x59')]['attachments'][_0x5c31ad][_0x384d('0x37')],'id':_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')][_0x5c31ad]['id'],'path':path[_0x384d('0xa6')](config[_0x384d('0xa7')],_0x384d('0xa8'),_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')][_0x5c31ad][_0x384d('0xa9')])};}}return respondWithRpcPromise(_0x384d('0xaa'),_0x384d('0xaa'),{'FaxAccountId':_[_0x384d('0xab')](_0x215ccd[_0x384d('0x51')]['id'])?undefined:_0x215ccd[_0x384d('0x51')]['id'],'path':_[_0x384d('0xab')](_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')][0x0][_0x384d('0xac')])?undefined:_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')][0x0][_0x384d('0xac')],'fax':_[_0x384d('0xab')](_0x215ccd[_0x384d('0x59')]['to'][0x0])?undefined:_0x215ccd[_0x384d('0x59')]['to'][0x0]},client9002);})[_0x384d('0x1b')](function(){if(_0x1352a3){if(_['isNil'](_0x215ccd['body'][_0x384d('0xad')])){_0x215ccd[_0x384d('0x59')][_0x384d('0xad')]=util[_0x384d('0x9e')](_0x384d('0xae'),_0x1352a3[_0x384d('0x37')],_0x1352a3[_0x384d('0xaf')]);}if(_0x1352a3[_0x384d('0xa1')]){if(_0x1352a3[_0x384d('0xa1')]['Contacts'][_0x384d('0x41')]){return _0x1352a3[_0x384d('0xa1')][_0x384d('0xa2')][0x0];}else{return db[_0x384d('0x70')][_0x384d('0x58')](_['defaults'](_0x215ccd[_0x384d('0x59')],{'firstName':_0x215ccd['body']['to'][0x0],'phone':_0x215ccd[_0x384d('0x59')]['to'][0x0],'fax':_0x215ccd[_0x384d('0x59')]['to'][0x0],'ListId':_0x1352a3[_0x384d('0xb0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x384d('0xb1'));}})[_0x384d('0x1b')](function(_0xedc181){if(_0xedc181){return db[_0x384d('0x6f')][_0x384d('0x57')]({'where':{'ContactId':_0xedc181['id'],'closed':![],'FaxAccountId':_0x1352a3['id']}})[_0x384d('0x1b')](function(_0x37a59a){if(_0x37a59a){return[_0x37a59a,![]];}return db[_0x384d('0x6f')][_0x384d('0x58')]({'UserId':_0x215ccd[_0x384d('0x5a')]['id'],'ContactId':_0xedc181['id'],'FaxAccountId':_0x1352a3['id'],'fax':_0x215ccd['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x384d('0x49')](_0x215ccd[_0x384d('0x59')],{'read':![],'body':_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')][0x0][_0x384d('0xb2')],'FaxAccountId':_0x1352a3['id'],'UserId':_0x215ccd[_0x384d('0x5a')]['id'],'ContactId':_0xedc181['id'],'AttachmentId':_0x215ccd['body'][_0x384d('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x384d('0x9f')],'as':_0x384d('0xb3')}]})[_0x384d('0x1b')](function(_0x4f9994){return[_0x4f9994,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x259580,_0x48206f){if(_0x48206f){return _0x259580;}return db[_0x384d('0x9f')]['create']({'direction':'out','read':![],'body':_0x215ccd['body']['attachments'][0x0][_0x384d('0xb2')],'FaxAccountId':_0x1352a3['id'],'FaxInteractionId':_0x259580['id'],'UserId':_0x215ccd['user']['id'],'ContactId':_0x259580[_0x384d('0xb4')],'AttachmentId':_0x215ccd[_0x384d('0x59')][_0x384d('0xa5')][0x0]['id']})['then'](function(_0x469435){_0x259580[_0x384d('0xb5')][_0x384d('0xb3')]=[];_0x259580[_0x384d('0xb5')][_0x384d('0xb3')][_0x384d('0x86')](_0x469435[_0x384d('0xb5')]);return _0x259580;});})[_0x384d('0x1b')](function(_0x59794f){respondWithRpcPromise(_0x384d('0xb6'),_0x384d('0xb6'),{'FaxAccountId':_[_0x384d('0xab')](_0x215ccd['params']['id'])?undefined:_0x215ccd['params']['id'],'path':_[_0x384d('0xab')](_0x215ccd[_0x384d('0x59')]['attachments'][0x0][_0x384d('0xac')])?undefined:_0x215ccd['body']['attachments'][0x0][_0x384d('0xac')],'fax':_[_0x384d('0xab')](_0x215ccd[_0x384d('0x59')]['to'][0x0])?undefined:_0x215ccd[_0x384d('0x59')]['to'][0x0],'AttachmentId':_0x215ccd['body'][_0x384d('0xa5')][0x0]['id']},client9002)['then'](function(_0x959da0){logger[_0x384d('0x23')]('SendFaxRpc,\x20%s',_0x959da0);})[_0x384d('0x25')](function(_0xa7add2){logger[_0x384d('0x23')]('SendFaxRpc,\x20%s',_0xa7add2);});return _0x59794f;})['then'](respondWithResult(_0x4f7538,null))[_0x384d('0x25')](handleError(_0x4f7538,null));};exports[_0x384d('0xb7')]=function(_0x31c3a9,_0x20b9ea,_0x15bf12){return db[_0x384d('0x54')]['find']({'where':{'id':_0x31c3a9['params']['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x20b9ea,null))[_0x384d('0x1b')](function(_0x27e067){if(_0x27e067){return _0x27e067['addAgents'](_0x31c3a9[_0x384d('0x59')][_0x384d('0x69')],_['omit'](_0x31c3a9[_0x384d('0x59')],[_0x384d('0x69'),'id'])||{})[_0x384d('0xb8')](function(_0x23ed9a){for(var _0x2d5e8f=0x0;_0x2d5e8f<_0x31c3a9['body'][_0x384d('0x69')][_0x384d('0x41')];_0x2d5e8f+=0x1){socket[_0x384d('0xb9')](_0x384d('0xba'),{'UserId':Number(_0x31c3a9[_0x384d('0x59')][_0x384d('0x69')][_0x2d5e8f]),'FaxAccountId':Number(_0x31c3a9[_0x384d('0x51')]['id'])});}return _0x23ed9a;});}})[_0x384d('0x1b')](respondWithResult(_0x20b9ea,null))['catch'](handleError(_0x20b9ea,null));};exports[_0x384d('0xbb')]=function(_0x3208a1,_0x3f761f,_0x587e11){return db[_0x384d('0x54')][_0x384d('0x57')]({'where':{'id':_0x3208a1['params']['id']}})[_0x384d('0x1b')](handleEntityNotFound(_0x3f761f,null))[_0x384d('0x1b')](function(_0x3c7f04){if(_0x3c7f04){return _0x3c7f04[_0x384d('0xbb')](_0x3208a1[_0x384d('0x3e')]['ids'])[_0x384d('0x1b')](function(){if(_[_0x384d('0xbc')](_0x3208a1[_0x384d('0x3e')]['ids'])){for(var _0x1bd843=0x0;_0x1bd843<_0x3208a1[_0x384d('0x3e')][_0x384d('0x69')][_0x384d('0x41')];_0x1bd843+=0x1){socket[_0x384d('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x3208a1[_0x384d('0x3e')][_0x384d('0x69')][_0x1bd843]),'FaxAccountId':Number(_0x3208a1[_0x384d('0x51')]['id'])});}}else{socket[_0x384d('0xb9')](_0x384d('0xbd'),{'UserId':Number(_0x3208a1['query'][_0x384d('0x69')]),'FaxAccountId':Number(_0x3208a1['params']['id'])});}});}})[_0x384d('0x1b')](respondWithStatusCode(_0x3f761f,null))['catch'](handleError(_0x3f761f,null));};exports['getAgents']=function(_0x14dd82,_0x13e4f3,_0xd78159){var _0x29b337={};var _0x4ea7bf={};var _0x350aa6;var _0x10ee41;return db['FaxAccount']['findOne']({'where':{'id':_0x14dd82[_0x384d('0x51')]['id']}})['then'](handleEntityNotFound(_0x13e4f3,null))[_0x384d('0x1b')](function(_0x3eceb8){if(_0x3eceb8){_0x350aa6=_0x3eceb8;_0x4ea7bf['model']=_['keys'](db[_0x384d('0xbe')][_0x384d('0x55')]);_0x4ea7bf[_0x384d('0x3e')]=_['keys'](_0x14dd82['query']);_0x4ea7bf['filters']=_['intersection'](_0x4ea7bf['model'],_0x4ea7bf['query']);_0x29b337[_0x384d('0x40')]=_[_0x384d('0x3f')](_0x4ea7bf[_0x384d('0x3d')],qs[_0x384d('0x56')](_0x14dd82['query'][_0x384d('0x56')]));_0x29b337[_0x384d('0x40')]=_0x29b337[_0x384d('0x40')][_0x384d('0x41')]?_0x29b337[_0x384d('0x40')]:_0x4ea7bf[_0x384d('0x3d')];_0x29b337['order']=qs[_0x384d('0x45')](_0x14dd82[_0x384d('0x3e')][_0x384d('0x45')]);_0x29b337[_0x384d('0x46')]=qs[_0x384d('0x47')](_['pick'](_0x14dd82[_0x384d('0x3e')],_0x4ea7bf[_0x384d('0x47')]));if(_0x14dd82[_0x384d('0x3e')][_0x384d('0x4b')]){_0x29b337[_0x384d('0x46')]=_[_0x384d('0x49')](_0x29b337['where'],{'$or':_[_0x384d('0x3b')](_0x29b337[_0x384d('0x40')],function(_0x5b66d4){var _0x2b7433={};_0x2b7433[_0x5b66d4]={'$like':'%'+_0x14dd82['query']['filter']+'%'};return _0x2b7433;})});}_0x29b337=_[_0x384d('0x49')]({},_0x29b337,_0x14dd82['options']);return _0x350aa6[_0x384d('0xbf')](_0x29b337);}})[_0x384d('0x1b')](function(_0x3ac017){if(_0x3ac017){_0x10ee41=_0x3ac017[_0x384d('0x41')];if(!_0x14dd82[_0x384d('0x3e')][_0x384d('0x42')]('nolimit')){_0x29b337[_0x384d('0x2b')]=qs['limit'](_0x14dd82[_0x384d('0x3e')][_0x384d('0x2b')]);_0x29b337[_0x384d('0x2a')]=qs[_0x384d('0x2a')](_0x14dd82['query'][_0x384d('0x2a')]);}return _0x350aa6[_0x384d('0xbf')](_0x29b337);}})['then'](function(_0x4ae836){if(_0x4ae836){return _0x4ae836?{'count':_0x10ee41,'rows':_0x4ae836}:null;}})[_0x384d('0x1b')](respondWithResult(_0x13e4f3,null))[_0x384d('0x25')](handleError(_0x13e4f3,null));}; \ No newline at end of file +var _0xd9e8=['sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','priority','push','Set','ecm','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','/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','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','SendFax','SendFaxRpc,\x20%s','addAgents','omit','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','ids','getInteractions','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','addApplications'];(function(_0x1b6328,_0x523313){var _0x18b5df=function(_0x437a9f){while(--_0x437a9f){_0x1b6328['push'](_0x1b6328['shift']());}};_0x18b5df(++_0x523313);}(_0xd9e8,0x104));var _0x8d9e=function(_0x74fae0,_0x4f9ac4){_0x74fae0=_0x74fae0-0x0;var _0x237f92=_0xd9e8[_0x74fae0];return _0x237f92;};'use strict';var emlformat=require(_0x8d9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d9e('0x1'));var jsonpatch=require(_0x8d9e('0x2'));var rp=require(_0x8d9e('0x3'));var moment=require(_0x8d9e('0x4'));var BPromise=require(_0x8d9e('0x5'));var Mustache=require(_0x8d9e('0x6'));var util=require(_0x8d9e('0x7'));var path=require(_0x8d9e('0x8'));var sox=require(_0x8d9e('0x9'));var csv=require(_0x8d9e('0xa'));var ejs=require(_0x8d9e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d9e('0xc'));var squel=require(_0x8d9e('0xd'));var crypto=require(_0x8d9e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8d9e('0xf'));var toCsv=require(_0x8d9e('0xa'));var querystring=require(_0x8d9e('0x10'));var Papa=require(_0x8d9e('0x11'));var Redis=require(_0x8d9e('0x12'));var authService=require(_0x8d9e('0x13'));var qs=require(_0x8d9e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d9e('0x15'));var logger=require(_0x8d9e('0x16'))('api');var utils=require(_0x8d9e('0x17'));var config=require(_0x8d9e('0x18'));var licenseUtil=require(_0x8d9e('0x19'));var db=require('../../mysqldb')['db'];config[_0x8d9e('0x1a')]=_[_0x8d9e('0x1b')](config[_0x8d9e('0x1a')],{'host':_0x8d9e('0x1c'),'port':0x18eb});var socket=require(_0x8d9e('0x1d'))(new Redis(config[_0x8d9e('0x1a')]));require('./faxAccount.socket')[_0x8d9e('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8d9e('0x1f')][_0x8d9e('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x218575,_0x1353d1,_0x3a1bbe,_0x259a9a){return new BPromise(function(_0x38c3d1,_0x1ce23f){var _0x123dbb=_0x259a9a||client;return _0x123dbb[_0x8d9e('0x21')](_0x218575,_0x3a1bbe)[_0x8d9e('0x22')](function(_0x2f9bae){logger[_0x8d9e('0x23')](_0x8d9e('0x24'),_0x1353d1,_0x8d9e('0x25'));logger[_0x8d9e('0x26')](_0x8d9e('0x27'),_0x1353d1,_0x8d9e('0x25'),JSON['stringify'](_0x2f9bae));if(_0x2f9bae['error']){if(_0x2f9bae[_0x8d9e('0x28')]['code']===0x1f4){logger[_0x8d9e('0x28')](_0x8d9e('0x24'),_0x1353d1,_0x2f9bae['error'][_0x8d9e('0x29')]);return _0x1ce23f(_0x2f9bae[_0x8d9e('0x28')]['message']);}logger['error'](_0x8d9e('0x24'),_0x1353d1,_0x2f9bae['error'][_0x8d9e('0x29')]);return _0x38c3d1(_0x2f9bae[_0x8d9e('0x28')][_0x8d9e('0x29')]);}else{logger[_0x8d9e('0x23')](_0x8d9e('0x24'),_0x1353d1,_0x8d9e('0x25'));_0x38c3d1(_0x2f9bae['result'][_0x8d9e('0x29')]);}})[_0x8d9e('0x2a')](function(_0x30dd2d){logger[_0x8d9e('0x28')]('FaxAccount,\x20%s,\x20%s',_0x1353d1,_0x30dd2d);_0x1ce23f(_0x30dd2d);});});}function respondWithStatusCode(_0x4cba9d,_0xe8cc4c){_0xe8cc4c=_0xe8cc4c||0xcc;return function(_0xc1f965){if(_0xc1f965){return _0x4cba9d[_0x8d9e('0x2b')](_0xe8cc4c);}return _0x4cba9d[_0x8d9e('0x2c')](_0xe8cc4c)[_0x8d9e('0x2d')]();};}function respondWithResult(_0x370117,_0x12385f){_0x12385f=_0x12385f||0xc8;return function(_0x224720){if(_0x224720){return _0x370117[_0x8d9e('0x2c')](_0x12385f)[_0x8d9e('0x2e')](_0x224720);}};}function respondWithFilteredResult(_0xecf00f,_0x5f0c17){return function(_0x2613e9){if(_0x2613e9){var _0x404012=typeof _0x5f0c17['offset']===_0x8d9e('0x2f')&&typeof _0x5f0c17[_0x8d9e('0x30')]===_0x8d9e('0x2f');var _0x234873=_0x2613e9[_0x8d9e('0x31')];var _0x1d7877=_0x404012?0x0:_0x5f0c17[_0x8d9e('0x32')];var _0x434afb=_0x404012?_0x2613e9[_0x8d9e('0x31')]:_0x5f0c17[_0x8d9e('0x32')]+_0x5f0c17['limit'];var _0x1a7ac9;if(_0x434afb>=_0x234873){_0x434afb=_0x234873;_0x1a7ac9=0xc8;}else{_0x1a7ac9=0xce;}_0xecf00f[_0x8d9e('0x2c')](_0x1a7ac9);return _0xecf00f[_0x8d9e('0x33')](_0x8d9e('0x34'),_0x1d7877+'-'+_0x434afb+'/'+_0x234873)['json'](_0x2613e9);}return null;};}function patchUpdates(_0xee4dab){return function(_0x58f08){try{jsonpatch[_0x8d9e('0x35')](_0x58f08,_0xee4dab,!![]);}catch(_0x197e59){return BPromise[_0x8d9e('0x36')](_0x197e59);}return _0x58f08[_0x8d9e('0x37')]();};}function saveUpdates(_0x544597,_0x249b18){return function(_0x1bc459){if(_0x1bc459){return _0x1bc459['update'](_0x544597)['then'](function(_0x9e140f){return _0x9e140f;});}return null;};}function removeEntity(_0x4eddbe,_0xa9e35b){return function(_0x26d6f5){if(_0x26d6f5){return _0x26d6f5[_0x8d9e('0x38')]()['then'](function(){var _0x364ed0=_0x26d6f5[_0x8d9e('0x39')]({'plain':!![]});var _0x541d70='FaxAccounts';return db[_0x8d9e('0x3a')][_0x8d9e('0x38')]({'where':{'type':_0x541d70,'resourceId':_0x364ed0['id']}})[_0x8d9e('0x22')](function(){return _0x26d6f5;});})[_0x8d9e('0x22')](function(){_0x4eddbe[_0x8d9e('0x2c')](0xcc)[_0x8d9e('0x2d')]();});}};}function handleEntityNotFound(_0x2ed27c,_0x307b34){return function(_0x38ddb4){if(!_0x38ddb4){_0x2ed27c['sendStatus'](0x194);}return _0x38ddb4;};}function handleError(_0x367b6e,_0x522403){_0x522403=_0x522403||0x1f4;return function(_0x1599e5){logger['error'](_0x1599e5[_0x8d9e('0x3b')]);if(_0x1599e5[_0x8d9e('0x3c')]){delete _0x1599e5[_0x8d9e('0x3c')];}_0x367b6e['status'](_0x522403)['send'](_0x1599e5);};}exports['index']=function(_0x39caf4,_0x68d8ef){var _0x33807b={'include':[{'model':db[_0x8d9e('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1e9ba1={},_0x3bfd68={'count':0x0,'rows':[]};var _0x165095=_[_0x8d9e('0x3e')](db[_0x8d9e('0x3f')][_0x8d9e('0x40')],function(_0x144f16){return{'name':_0x144f16[_0x8d9e('0x41')],'type':_0x144f16[_0x8d9e('0x42')][_0x8d9e('0x43')]};});_0x1e9ba1[_0x8d9e('0x44')]=_['map'](_0x165095,'name');_0x1e9ba1['query']=_[_0x8d9e('0x45')](_0x39caf4[_0x8d9e('0x46')]);_0x1e9ba1[_0x8d9e('0x47')]=_[_0x8d9e('0x48')](_0x1e9ba1[_0x8d9e('0x44')],_0x1e9ba1['query']);_0x33807b['attributes']=_['intersection'](_0x1e9ba1[_0x8d9e('0x44')],qs[_0x8d9e('0x49')](_0x39caf4['query'][_0x8d9e('0x49')]));_0x33807b['attributes']=_0x33807b[_0x8d9e('0x4a')][_0x8d9e('0x4b')]?_0x33807b[_0x8d9e('0x4a')]:_0x1e9ba1['model'];if(!_0x39caf4[_0x8d9e('0x46')][_0x8d9e('0x4c')](_0x8d9e('0x4d'))){_0x33807b[_0x8d9e('0x30')]=qs[_0x8d9e('0x30')](_0x39caf4[_0x8d9e('0x46')][_0x8d9e('0x30')]);_0x33807b[_0x8d9e('0x32')]=qs[_0x8d9e('0x32')](_0x39caf4[_0x8d9e('0x46')][_0x8d9e('0x32')]);}_0x33807b[_0x8d9e('0x4e')]=qs[_0x8d9e('0x4f')](_0x39caf4['query'][_0x8d9e('0x4f')]);_0x33807b[_0x8d9e('0x50')]=qs['filters'](_[_0x8d9e('0x51')](_0x39caf4['query'],_0x1e9ba1['filters']),_0x165095);if(_0x39caf4[_0x8d9e('0x46')][_0x8d9e('0x52')]){_0x33807b['where']=_[_0x8d9e('0x53')](_0x33807b[_0x8d9e('0x50')],{'$or':_[_0x8d9e('0x3e')](_0x165095,function(_0xb0a8be){if(_0xb0a8be['type']!==_0x8d9e('0x54')){var _0x2fff83={};_0x2fff83[_0xb0a8be[_0x8d9e('0x3c')]]={'$like':'%'+_0x39caf4[_0x8d9e('0x46')][_0x8d9e('0x52')]+'%'};return _0x2fff83;}})});}_0x33807b=_['merge']({},_0x33807b,_0x39caf4[_0x8d9e('0x55')]);var _0x4df1c4={'where':_0x33807b[_0x8d9e('0x50')]};return db[_0x8d9e('0x3f')][_0x8d9e('0x31')](_0x4df1c4)[_0x8d9e('0x22')](function(_0x485ed2){_0x3bfd68[_0x8d9e('0x31')]=_0x485ed2;if(_0x39caf4[_0x8d9e('0x46')][_0x8d9e('0x56')]){_0x33807b[_0x8d9e('0x57')]=[{'all':!![]}];}return db[_0x8d9e('0x3f')][_0x8d9e('0x58')](_0x33807b);})[_0x8d9e('0x22')](function(_0x5b9ee5){_0x3bfd68[_0x8d9e('0x59')]=_0x5b9ee5;return _0x3bfd68;})[_0x8d9e('0x22')](respondWithFilteredResult(_0x68d8ef,_0x33807b))['catch'](handleError(_0x68d8ef,null));};exports['show']=function(_0x101c51,_0x40d2b3){var _0x5256cc={'raw':![],'where':{'id':_0x101c51[_0x8d9e('0x5a')]['id']},'include':[{'model':db[_0x8d9e('0x3d')],'as':_0x8d9e('0x5b')}]},_0x320fa0={};_0x320fa0['model']=_[_0x8d9e('0x45')](db[_0x8d9e('0x3f')][_0x8d9e('0x40')]);_0x320fa0[_0x8d9e('0x46')]=_[_0x8d9e('0x45')](_0x101c51[_0x8d9e('0x46')]);_0x320fa0['filters']=_[_0x8d9e('0x48')](_0x320fa0['model'],_0x320fa0['query']);_0x5256cc[_0x8d9e('0x4a')]=_[_0x8d9e('0x48')](_0x320fa0[_0x8d9e('0x44')],qs[_0x8d9e('0x49')](_0x101c51['query'][_0x8d9e('0x49')]));_0x5256cc[_0x8d9e('0x4a')]=_0x5256cc[_0x8d9e('0x4a')]['length']?_0x5256cc[_0x8d9e('0x4a')]:_0x320fa0[_0x8d9e('0x44')];if(_0x101c51[_0x8d9e('0x46')][_0x8d9e('0x56')]){_0x5256cc[_0x8d9e('0x57')]=[{'all':!![]}];}_0x5256cc=_[_0x8d9e('0x53')]({},_0x5256cc,_0x101c51[_0x8d9e('0x55')]);return db[_0x8d9e('0x3f')][_0x8d9e('0x5c')](_0x5256cc)['then'](handleEntityNotFound(_0x40d2b3,null))[_0x8d9e('0x22')](respondWithResult(_0x40d2b3,null))[_0x8d9e('0x2a')](handleError(_0x40d2b3,null));};exports['create']=function(_0x6cbb90,_0x2cfea4){return db[_0x8d9e('0x3f')][_0x8d9e('0x5d')](_0x6cbb90[_0x8d9e('0x5e')],{})[_0x8d9e('0x22')](function(_0x39a054){var _0x5b0273=_0x6cbb90[_0x8d9e('0x5f')][_0x8d9e('0x39')]({'plain':!![]});if(!_0x5b0273)throw new Error(_0x8d9e('0x60'));if(_0x5b0273[_0x8d9e('0x61')]==='user'){var _0x5d9655=_0x39a054[_0x8d9e('0x39')]({'plain':!![]});var _0x1656db=_0x8d9e('0x62');return db['UserProfileSection'][_0x8d9e('0x5c')]({'where':{'name':_0x1656db,'userProfileId':_0x5b0273[_0x8d9e('0x63')]},'raw':!![]})[_0x8d9e('0x22')](function(_0x176417){if(_0x176417&&_0x176417[_0x8d9e('0x64')]===0x0){return db[_0x8d9e('0x3a')][_0x8d9e('0x5d')]({'name':_0x5d9655[_0x8d9e('0x3c')],'resourceId':_0x5d9655['id'],'type':_0x176417[_0x8d9e('0x3c')],'sectionId':_0x176417['id']},{})[_0x8d9e('0x22')](function(){return _0x39a054;});}else{return _0x39a054;}})[_0x8d9e('0x2a')](function(_0x2f68b4){logger[_0x8d9e('0x28')](_0x8d9e('0x65'),_0x2f68b4);throw _0x2f68b4;});}return _0x39a054;})[_0x8d9e('0x22')](respondWithResult(_0x2cfea4,0xc9))[_0x8d9e('0x2a')](handleError(_0x2cfea4,null));};exports[_0x8d9e('0x66')]=function(_0x225f67,_0x4e7e3f){if(_0x225f67[_0x8d9e('0x5e')]['id']){delete _0x225f67[_0x8d9e('0x5e')]['id'];}return db[_0x8d9e('0x3f')][_0x8d9e('0x5c')]({'where':{'id':_0x225f67['params']['id']},'include':[{'model':db['Pause'],'as':_0x8d9e('0x5b')}]})[_0x8d9e('0x22')](handleEntityNotFound(_0x4e7e3f,null))['then'](saveUpdates(_0x225f67[_0x8d9e('0x5e')],null))[_0x8d9e('0x22')](respondWithResult(_0x4e7e3f,null))[_0x8d9e('0x2a')](handleError(_0x4e7e3f,null));};exports[_0x8d9e('0x38')]=function(_0x1a17b7,_0x4a3195){return db['FaxAccount'][_0x8d9e('0x5c')]({'where':{'id':_0x1a17b7[_0x8d9e('0x5a')]['id']}})[_0x8d9e('0x22')](handleEntityNotFound(_0x4a3195,null))[_0x8d9e('0x22')](removeEntity(_0x4a3195,null))['catch'](handleError(_0x4a3195,null));};exports[_0x8d9e('0x67')]=function(_0xadf20b,_0x2fd8e0){return db['FaxAccount'][_0x8d9e('0x67')]()['then'](respondWithResult(_0x2fd8e0,null))[_0x8d9e('0x2a')](handleError(_0x2fd8e0,null));};exports['addDisposition']=function(_0x1b8a02,_0x5af423,_0x4817cf){if(_0x1b8a02['body']['id']){delete _0x1b8a02['body']['id'];}return db['FaxAccount'][_0x8d9e('0x5c')]({'where':{'id':_0x1b8a02[_0x8d9e('0x5a')]['id']}})[_0x8d9e('0x22')](handleEntityNotFound(_0x5af423,null))[_0x8d9e('0x22')](function(_0xd91417){if(_0xd91417){_0x1b8a02[_0x8d9e('0x5e')][_0x8d9e('0x68')]=_0xd91417['id'];return db[_0x8d9e('0x69')][_0x8d9e('0x5d')](_0x1b8a02[_0x8d9e('0x5e')]);}})[_0x8d9e('0x22')](respondWithResult(_0x5af423,null))[_0x8d9e('0x2a')](handleError(_0x5af423,null));};exports[_0x8d9e('0x6a')]=function(_0x2b30bc,_0x1c1f23,_0x4ae358){var _0x15cb4={'raw':![],'where':{}};var _0x1f753c={};var _0x453a4a={'count':0x0,'rows':[]};return db[_0x8d9e('0x3f')][_0x8d9e('0x6b')]({'where':{'id':_0x2b30bc[_0x8d9e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1c1f23,null))[_0x8d9e('0x22')](function(_0x4d20ae){if(_0x4d20ae){_0x1f753c['model']=_[_0x8d9e('0x45')](db[_0x8d9e('0x69')][_0x8d9e('0x40')]);_0x1f753c[_0x8d9e('0x46')]=_[_0x8d9e('0x45')](_0x2b30bc[_0x8d9e('0x46')]);_0x1f753c[_0x8d9e('0x47')]=_[_0x8d9e('0x48')](_0x1f753c[_0x8d9e('0x44')],_0x1f753c[_0x8d9e('0x46')]);_0x15cb4[_0x8d9e('0x4a')]=_[_0x8d9e('0x48')](_0x1f753c['model'],qs[_0x8d9e('0x49')](_0x2b30bc[_0x8d9e('0x46')]['fields']));_0x15cb4[_0x8d9e('0x4a')]=_0x15cb4[_0x8d9e('0x4a')][_0x8d9e('0x4b')]?_0x15cb4[_0x8d9e('0x4a')]:_0x1f753c[_0x8d9e('0x44')];if(!_0x2b30bc[_0x8d9e('0x46')]['hasOwnProperty'](_0x8d9e('0x4d'))){_0x15cb4[_0x8d9e('0x30')]=qs[_0x8d9e('0x30')](_0x2b30bc[_0x8d9e('0x46')][_0x8d9e('0x30')]);_0x15cb4[_0x8d9e('0x32')]=qs['offset'](_0x2b30bc[_0x8d9e('0x46')][_0x8d9e('0x32')]);}_0x15cb4[_0x8d9e('0x4e')]=qs[_0x8d9e('0x4f')](_0x2b30bc['query'][_0x8d9e('0x4f')]);_0x15cb4[_0x8d9e('0x50')]=qs[_0x8d9e('0x47')](_[_0x8d9e('0x51')](_0x2b30bc[_0x8d9e('0x46')],_0x1f753c[_0x8d9e('0x47')]));_0x15cb4['where'][_0x8d9e('0x68')]=_0x4d20ae['id'];if(_0x2b30bc[_0x8d9e('0x46')][_0x8d9e('0x52')]){_0x15cb4[_0x8d9e('0x50')]=_[_0x8d9e('0x53')](_0x15cb4['where'],{'$or':_[_0x8d9e('0x3e')](_0x15cb4[_0x8d9e('0x4a')],function(_0x155639){var _0x4160be={};_0x4160be[_0x155639]={'$like':'%'+_0x2b30bc[_0x8d9e('0x46')][_0x8d9e('0x52')]+'%'};return _0x4160be;})});}_0x15cb4=_[_0x8d9e('0x53')]({},_0x15cb4,_0x2b30bc[_0x8d9e('0x55')]);return db[_0x8d9e('0x69')][_0x8d9e('0x31')]({'where':_0x15cb4[_0x8d9e('0x50')]})['then'](function(_0x556013){_0x453a4a[_0x8d9e('0x31')]=_0x556013;if(_0x2b30bc[_0x8d9e('0x46')][_0x8d9e('0x56')]){_0x15cb4[_0x8d9e('0x57')]=[{'all':!![]}];}return db[_0x8d9e('0x69')][_0x8d9e('0x58')](_0x15cb4);})['then'](function(_0x45483b){_0x453a4a[_0x8d9e('0x59')]=_0x45483b;return _0x453a4a;});}})[_0x8d9e('0x22')](respondWithFilteredResult(_0x1c1f23,_0x15cb4))[_0x8d9e('0x2a')](handleError(_0x1c1f23,null));};exports[_0x8d9e('0x6c')]=function(_0x4c7adf,_0xfa8806,_0x3472a8){return db[_0x8d9e('0x3f')]['find']({'where':{'id':_0x4c7adf['params']['id']}})[_0x8d9e('0x22')](handleEntityNotFound(_0xfa8806,null))[_0x8d9e('0x22')](function(_0x497aae){if(_0x497aae){return _0x497aae[_0x8d9e('0x6c')](_0x4c7adf['query']['ids']);}})[_0x8d9e('0x22')](respondWithStatusCode(_0xfa8806,null))[_0x8d9e('0x2a')](handleError(_0xfa8806,null));};exports[_0x8d9e('0x6d')]=function(_0x4c1074,_0x1cc4e4,_0xdcb9a3){if(_0x4c1074[_0x8d9e('0x5e')]['id']){delete _0x4c1074[_0x8d9e('0x5e')]['id'];}return db[_0x8d9e('0x3f')][_0x8d9e('0x5c')]({'where':{'id':_0x4c1074[_0x8d9e('0x5a')]['id']}})[_0x8d9e('0x22')](handleEntityNotFound(_0x1cc4e4,null))[_0x8d9e('0x22')](function(_0x1f5b31){if(_0x1f5b31){_0x4c1074['body'][_0x8d9e('0x68')]=_0x1f5b31['id'];return db[_0x8d9e('0x6e')][_0x8d9e('0x5d')](_0x4c1074[_0x8d9e('0x5e')]);}})[_0x8d9e('0x22')](respondWithResult(_0x1cc4e4,null))[_0x8d9e('0x2a')](handleError(_0x1cc4e4,null));};exports[_0x8d9e('0x6f')]=function(_0x3b4a27,_0x1921f2,_0x29ee1e){var _0x13200f={'raw':![],'where':{}};var _0x5a4c05={};var _0x2f133a={'count':0x0,'rows':[]};return db[_0x8d9e('0x3f')]['findOne']({'where':{'id':_0x3b4a27[_0x8d9e('0x5a')]['id']}})[_0x8d9e('0x22')](handleEntityNotFound(_0x1921f2,null))[_0x8d9e('0x22')](function(_0x57e16d){if(_0x57e16d){_0x5a4c05[_0x8d9e('0x44')]=_['keys'](db[_0x8d9e('0x6e')][_0x8d9e('0x40')]);_0x5a4c05[_0x8d9e('0x46')]=_[_0x8d9e('0x45')](_0x3b4a27[_0x8d9e('0x46')]);_0x5a4c05[_0x8d9e('0x47')]=_[_0x8d9e('0x48')](_0x5a4c05['model'],_0x5a4c05[_0x8d9e('0x46')]);_0x13200f[_0x8d9e('0x4a')]=_[_0x8d9e('0x48')](_0x5a4c05['model'],qs[_0x8d9e('0x49')](_0x3b4a27[_0x8d9e('0x46')]['fields']));_0x13200f[_0x8d9e('0x4a')]=_0x13200f[_0x8d9e('0x4a')]['length']?_0x13200f[_0x8d9e('0x4a')]:_0x5a4c05['model'];if(!_0x3b4a27[_0x8d9e('0x46')][_0x8d9e('0x4c')](_0x8d9e('0x4d'))){_0x13200f['limit']=qs[_0x8d9e('0x30')](_0x3b4a27[_0x8d9e('0x46')][_0x8d9e('0x30')]);_0x13200f[_0x8d9e('0x32')]=qs[_0x8d9e('0x32')](_0x3b4a27['query'][_0x8d9e('0x32')]);}_0x13200f[_0x8d9e('0x4e')]=qs['sort'](_0x3b4a27[_0x8d9e('0x46')][_0x8d9e('0x4f')]);_0x13200f[_0x8d9e('0x50')]=qs[_0x8d9e('0x47')](_[_0x8d9e('0x51')](_0x3b4a27[_0x8d9e('0x46')],_0x5a4c05[_0x8d9e('0x47')]));_0x13200f[_0x8d9e('0x50')][_0x8d9e('0x68')]=_0x57e16d['id'];if(_0x3b4a27['query'][_0x8d9e('0x52')]){_0x13200f['where']=_[_0x8d9e('0x53')](_0x13200f[_0x8d9e('0x50')],{'$or':_[_0x8d9e('0x3e')](_0x13200f[_0x8d9e('0x4a')],function(_0x1afb95){var _0x104d4f={};_0x104d4f[_0x1afb95]={'$like':'%'+_0x3b4a27['query'][_0x8d9e('0x52')]+'%'};return _0x104d4f;})});}_0x13200f=_[_0x8d9e('0x53')]({},_0x13200f,_0x3b4a27[_0x8d9e('0x55')]);return db[_0x8d9e('0x6e')][_0x8d9e('0x31')]({'where':_0x13200f['where']})[_0x8d9e('0x22')](function(_0xa8e7f1){_0x2f133a[_0x8d9e('0x31')]=_0xa8e7f1;if(_0x3b4a27['query'][_0x8d9e('0x56')]){_0x13200f[_0x8d9e('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8d9e('0x58')](_0x13200f);})[_0x8d9e('0x22')](function(_0x6a3d37){_0x2f133a[_0x8d9e('0x59')]=_0x6a3d37;return _0x2f133a;});}})[_0x8d9e('0x22')](respondWithFilteredResult(_0x1921f2,_0x13200f))['catch'](handleError(_0x1921f2,null));};exports['removeAnswers']=function(_0x397554,_0x55bb4c,_0x3dfeb7){return db[_0x8d9e('0x3f')][_0x8d9e('0x5c')]({'where':{'id':_0x397554[_0x8d9e('0x5a')]['id']}})[_0x8d9e('0x22')](handleEntityNotFound(_0x55bb4c,null))[_0x8d9e('0x22')](function(_0x1c2b2d){if(_0x1c2b2d){return _0x1c2b2d[_0x8d9e('0x70')](_0x397554[_0x8d9e('0x46')]['ids']);}})[_0x8d9e('0x22')](respondWithStatusCode(_0x55bb4c,null))['catch'](handleError(_0x55bb4c,null));};exports[_0x8d9e('0x71')]=function(_0x3d3ebe,_0x1e533b,_0x41b95f){return db[_0x8d9e('0x72')][_0x8d9e('0x5c')]({'where':{'id':_0x3d3ebe['params']['id']}})[_0x8d9e('0x22')](handleEntityNotFound(_0x1e533b,null))[_0x8d9e('0x22')](function(_0x4ee842){if(_0x4ee842){return _0x4ee842[_0x8d9e('0x71')](_0x3d3ebe['body'][_0x8d9e('0x73')],_['omit'](_0x3d3ebe['body'],[_0x8d9e('0x73'),'id'])||{});}})[_0x8d9e('0x22')](respondWithResult(_0x1e533b,null))[_0x8d9e('0x2a')](handleError(_0x1e533b,null));};exports[_0x8d9e('0x74')]=function(_0x1c79b4,_0xe4a40f,_0x54cc0f){var _0x3c84ce={'raw':![],'where':{}};var _0x1a5fc4={};var _0x106b27={'count':0x0,'rows':[]};return db[_0x8d9e('0x3f')]['findOne']({'where':{'id':_0x1c79b4[_0x8d9e('0x5a')]['id']}})['then'](handleEntityNotFound(_0xe4a40f,null))['then'](function(_0xd66b80){if(_0xd66b80){_0x1a5fc4[_0x8d9e('0x44')]=_[_0x8d9e('0x45')](db[_0x8d9e('0x72')][_0x8d9e('0x40')]);_0x1a5fc4[_0x8d9e('0x46')]=_[_0x8d9e('0x45')](_0x1c79b4[_0x8d9e('0x46')]);_0x1a5fc4[_0x8d9e('0x47')]=_[_0x8d9e('0x48')](_0x1a5fc4[_0x8d9e('0x44')],_0x1a5fc4[_0x8d9e('0x46')]);_0x3c84ce[_0x8d9e('0x4a')]=_[_0x8d9e('0x48')](_0x1a5fc4[_0x8d9e('0x44')],qs['fields'](_0x1c79b4[_0x8d9e('0x46')][_0x8d9e('0x49')]));_0x3c84ce[_0x8d9e('0x4a')]=_0x3c84ce[_0x8d9e('0x4a')][_0x8d9e('0x4b')]?_0x3c84ce['attributes']:_0x1a5fc4[_0x8d9e('0x44')];if(!_0x1c79b4[_0x8d9e('0x46')][_0x8d9e('0x4c')](_0x8d9e('0x4d'))){_0x3c84ce[_0x8d9e('0x30')]=qs[_0x8d9e('0x30')](_0x1c79b4[_0x8d9e('0x46')][_0x8d9e('0x30')]);_0x3c84ce['offset']=qs[_0x8d9e('0x32')](_0x1c79b4[_0x8d9e('0x46')][_0x8d9e('0x32')]);}_0x3c84ce[_0x8d9e('0x4e')]=qs[_0x8d9e('0x4f')](_0x1c79b4[_0x8d9e('0x46')][_0x8d9e('0x4f')]);_0x3c84ce[_0x8d9e('0x50')]=qs[_0x8d9e('0x47')](_[_0x8d9e('0x51')](_0x1c79b4['query'],_0x1a5fc4[_0x8d9e('0x47')]));_0x3c84ce['where'][_0x8d9e('0x68')]=_0xd66b80['id'];if(_0x1c79b4['query'][_0x8d9e('0x52')]){_0x3c84ce['where']=_['merge'](_0x3c84ce[_0x8d9e('0x50')],{'$or':_[_0x8d9e('0x3e')](_0x3c84ce[_0x8d9e('0x4a')],function(_0x3191c5){var _0x48f289={};_0x48f289[_0x3191c5]={'$like':'%'+_0x1c79b4[_0x8d9e('0x46')][_0x8d9e('0x52')]+'%'};return _0x48f289;})});}_0x3c84ce=_[_0x8d9e('0x53')]({},_0x3c84ce,_0x1c79b4[_0x8d9e('0x55')]);return db[_0x8d9e('0x72')]['count']({'where':_0x3c84ce['where']})[_0x8d9e('0x22')](function(_0x3c6a40){_0x106b27[_0x8d9e('0x31')]=_0x3c6a40;if(_0x1c79b4[_0x8d9e('0x46')][_0x8d9e('0x56')]){_0x3c84ce['include']=[{'model':db[_0x8d9e('0x75')],'as':_0x8d9e('0x76'),'required':![]},{'model':db['User'],'as':_0x8d9e('0x77'),'attributes':[_0x8d9e('0x3c'),'fullname',_0x8d9e('0x78')],'required':![]},{'model':db[_0x8d9e('0x79')],'as':_0x8d9e('0x7a'),'attributes':['id','name',_0x8d9e('0x7b')],'where':_0x1c79b4['query']['tag']?{'id':_0x1c79b4[_0x8d9e('0x46')][_0x8d9e('0x7c')]}:undefined,'required':_0x1c79b4[_0x8d9e('0x46')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x8d9e('0x58')](_0x3c84ce);})[_0x8d9e('0x22')](function(_0x55d170){_0x106b27['rows']=_0x55d170;return _0x106b27;});}})[_0x8d9e('0x22')](respondWithFilteredResult(_0xe4a40f,_0x3c84ce))[_0x8d9e('0x2a')](handleError(_0xe4a40f,null));};exports[_0x8d9e('0x7d')]=function(_0x439b63,_0x476995,_0x49bdd1){return db[_0x8d9e('0x3f')][_0x8d9e('0x6b')]({'where':{'id':_0x439b63[_0x8d9e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x476995,null))[_0x8d9e('0x22')](function(_0x19c1cd){if(_0x19c1cd){return db[_0x8d9e('0x7e')][_0x8d9e('0x7f')](function(_0x12c8ff){return db[_0x8d9e('0x80')]['destroy']({'where':{'FaxAccountId':_0x439b63['params']['id']},'transaction':_0x12c8ff})[_0x8d9e('0x22')](function(_0x11b6cf){var _0x156ed7=_[_0x8d9e('0x3e')](_0x439b63[_0x8d9e('0x5e')],function(_0x349e7e){_0x349e7e[_0x8d9e('0x68')]=_0x439b63[_0x8d9e('0x5a')]['id'];return _0x349e7e;});return db[_0x8d9e('0x80')][_0x8d9e('0x81')](_0x156ed7,{'transaction':_0x12c8ff});});})['then'](function(){return db[_0x8d9e('0x80')][_0x8d9e('0x82')]({'where':{'FaxAccountId':_0x439b63['params']['id']},'order':'priority'});});}})[_0x8d9e('0x22')](respondWithResult(_0x476995,null))[_0x8d9e('0x2a')](handleError(_0x476995,null));};exports[_0x8d9e('0x83')]=function(_0x10ee1b,_0x5bc59e,_0x2e5678){var _0x3ebd6a={};var _0x33d4e8={};var _0x545f6e;var _0x33aa3;return db[_0x8d9e('0x3f')][_0x8d9e('0x6b')]({'where':{'id':_0x10ee1b['params']['id']}})['then'](handleEntityNotFound(_0x5bc59e,null))[_0x8d9e('0x22')](function(_0x55f78b){if(_0x55f78b){_0x545f6e=_0x55f78b;_0x33d4e8['model']=_[_0x8d9e('0x45')](db[_0x8d9e('0x80')][_0x8d9e('0x40')]);_0x33d4e8[_0x8d9e('0x46')]=_[_0x8d9e('0x45')](_0x10ee1b['query']);_0x33d4e8[_0x8d9e('0x47')]=_['intersection'](_0x33d4e8['model'],_0x33d4e8[_0x8d9e('0x46')]);_0x3ebd6a['attributes']=_[_0x8d9e('0x48')](_0x33d4e8['model'],qs[_0x8d9e('0x49')](_0x10ee1b[_0x8d9e('0x46')][_0x8d9e('0x49')]));_0x3ebd6a['attributes']=_0x3ebd6a[_0x8d9e('0x4a')]['length']?_0x3ebd6a[_0x8d9e('0x4a')]:_0x33d4e8[_0x8d9e('0x44')];_0x3ebd6a[_0x8d9e('0x4e')]=qs[_0x8d9e('0x4f')](_0x10ee1b[_0x8d9e('0x46')][_0x8d9e('0x4f')]);_0x3ebd6a['where']=qs['filters'](_[_0x8d9e('0x51')](_0x10ee1b[_0x8d9e('0x46')],_0x33d4e8[_0x8d9e('0x47')]));if(_0x10ee1b['query'][_0x8d9e('0x52')]){_0x3ebd6a[_0x8d9e('0x50')]=_[_0x8d9e('0x53')](_0x3ebd6a[_0x8d9e('0x50')],{'$or':_['map'](_0x3ebd6a['attributes'],function(_0x35f8a6){var _0x11c398={};_0x11c398[_0x35f8a6]={'$like':'%'+_0x10ee1b[_0x8d9e('0x46')]['filter']+'%'};return _0x11c398;})});}_0x3ebd6a=_[_0x8d9e('0x53')]({},_0x3ebd6a,_0x10ee1b[_0x8d9e('0x55')]);return _0x545f6e['getApplications'](_0x3ebd6a);}})[_0x8d9e('0x22')](function(_0x2ce8a1){if(_0x2ce8a1){_0x33aa3=_0x2ce8a1[_0x8d9e('0x4b')];if(!_0x10ee1b[_0x8d9e('0x46')][_0x8d9e('0x4c')](_0x8d9e('0x4d'))){_0x3ebd6a['limit']=qs[_0x8d9e('0x30')](_0x10ee1b[_0x8d9e('0x46')][_0x8d9e('0x30')]);_0x3ebd6a['offset']=qs[_0x8d9e('0x32')](_0x10ee1b[_0x8d9e('0x46')][_0x8d9e('0x32')]);}return _0x545f6e[_0x8d9e('0x83')](_0x3ebd6a);}})['then'](function(_0x50d16d){if(_0x50d16d){return _0x50d16d?{'count':_0x33aa3,'rows':_0x50d16d}:null;}})[_0x8d9e('0x22')](respondWithResult(_0x5bc59e,null))[_0x8d9e('0x2a')](handleError(_0x5bc59e,null));};function Extension(_0x8734be,_0x1c50a8,_0x36a23b,_0x3d14e9){this[_0x8d9e('0x84')]=_0x8d9e('0x85');this[_0x8d9e('0x86')]=_0x8734be['localstationid'];this[_0x8d9e('0x87')]=_0x3d14e9;this[_0x8d9e('0x42')]=_0x8d9e('0x88');this[_0x8d9e('0x89')]=_0x8d9e('0x8a');this[_0x8d9e('0x68')]=_0x8734be['id'];this[_0x8d9e('0x8b')]=_0x1c50a8;this['appdata']=_0x36a23b;}function createExtensionsReciveFax(_0x499788){var _0x45d47a=0x1;var _0x2f690f=[];_0x2f690f[_0x8d9e('0x8c')](new Extension(_0x499788,_0x45d47a,'','Answer'));_0x45d47a+=0x1;_0x2f690f['push'](new Extension(_0x499788,_0x45d47a,'CDR(type)=inbound-fax',_0x8d9e('0x8d')));_0x45d47a+=0x1;for(var _0x47402a in _0x499788){if(_0x499788['hasOwnProperty'](_0x47402a)&&(_0x47402a===_0x8d9e('0x8e')||_0x47402a==='localstationid'||_0x47402a==='gateway'||_0x47402a==='faxdetect'||_0x47402a===_0x8d9e('0x8f')||_0x47402a===_0x8d9e('0x90')||_0x47402a===_0x8d9e('0x91')||_0x47402a==='modem'||_0x47402a===_0x8d9e('0x92'))){_0x2f690f[_0x8d9e('0x8c')](new Extension(_0x499788,_0x45d47a,_0x8d9e('0x93')+_0x47402a+')='+_0x499788[_0x47402a],_0x8d9e('0x8d')));_0x45d47a+=0x1;}}_0x2f690f['push'](new Extension(_0x499788,_0x45d47a,'6','Wait'));_0x45d47a+=0x1;_0x2f690f[_0x8d9e('0x8c')](new Extension(_0x499788,_0x45d47a,_0x8d9e('0x94'),_0x8d9e('0x95')));_0x45d47a=0x0;return _0x2f690f;}exports['addAccountApplications']=function(_0xe2acbe,_0x283477,_0x28b456){var _0x4fc0f2;return db[_0x8d9e('0x7e')][_0x8d9e('0x7f')](function(_0x110def){return db['FaxAccount'][_0x8d9e('0x5d')](_0xe2acbe[_0x8d9e('0x5e')],{'transaction':_0x110def})['then'](function(_0x279dc5){_0x4fc0f2=_0x279dc5[_0x8d9e('0x39')]({'plain':!![]});return db[_0x8d9e('0x96')][_0x8d9e('0x81')](createExtensionsReciveFax(_0x4fc0f2),{'transaction':_0x110def});});})[_0x8d9e('0x22')](function(){return _0x4fc0f2;})['then'](respondWithResult(_0x283477,null))[_0x8d9e('0x2a')](handleError(_0x283477,null));};exports[_0x8d9e('0x97')]=function(_0x88258,_0x5e252d,_0x36e173){var _0x157a9f;return db[_0x8d9e('0x7e')]['transaction'](function(_0x2cf182){return db['FaxAccount'][_0x8d9e('0x66')](_0x88258['body'],{'where':{'id':_0x88258[_0x8d9e('0x5e')]['id']},'transaction':_0x2cf182})[_0x8d9e('0x22')](function(_0x4fb9de){return db[_0x8d9e('0x96')]['destroy']({'where':{'FaxAccountId':_0x88258[_0x8d9e('0x5e')]['id']},'transaction':_0x2cf182})[_0x8d9e('0x22')](function(_0x5d0075){return db[_0x8d9e('0x96')][_0x8d9e('0x81')](createExtensionsReciveFax(_['omit'](_0x88258[_0x8d9e('0x5e')],[_0x8d9e('0x98'),'key',_0x8d9e('0x99'),'updatedAt',_0x8d9e('0x9a'),'ListId'])),{'transaction':_0x2cf182});});});})['then'](function(){return db['FaxAccount'][_0x8d9e('0x9b')](_0x88258['body']['id']);})[_0x8d9e('0x22')](respondWithResult(_0x5e252d,null))[_0x8d9e('0x2a')](handleError(_0x5e252d,null));};exports[_0x8d9e('0x9c')]=function(_0x3ed0f6,_0x50e59e,_0x4e1d2f){var _0x2dbf98={'raw':!![],'where':{}};var _0x740d1a={};var _0x5c001c={'count':0x0,'rows':[]};return db[_0x8d9e('0x3f')][_0x8d9e('0x6b')]({'where':{'id':_0x3ed0f6[_0x8d9e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x50e59e,null))[_0x8d9e('0x22')](function(_0x4f048b){if(_0x4f048b){_0x740d1a[_0x8d9e('0x44')]=_[_0x8d9e('0x45')](db[_0x8d9e('0x9d')][_0x8d9e('0x40')]);_0x740d1a[_0x8d9e('0x46')]=_['keys'](_0x3ed0f6[_0x8d9e('0x46')]);_0x740d1a[_0x8d9e('0x47')]=_['intersection'](_0x740d1a[_0x8d9e('0x44')],_0x740d1a[_0x8d9e('0x46')]);_0x2dbf98[_0x8d9e('0x4a')]=_[_0x8d9e('0x48')](_0x740d1a['model'],qs[_0x8d9e('0x49')](_0x3ed0f6[_0x8d9e('0x46')][_0x8d9e('0x49')]));_0x2dbf98[_0x8d9e('0x4a')]=_0x2dbf98[_0x8d9e('0x4a')]['length']?_0x2dbf98['attributes']:_0x740d1a['model'];if(!_0x3ed0f6[_0x8d9e('0x46')]['hasOwnProperty'](_0x8d9e('0x4d'))){_0x2dbf98[_0x8d9e('0x30')]=qs[_0x8d9e('0x30')](_0x3ed0f6['query'][_0x8d9e('0x30')]);_0x2dbf98[_0x8d9e('0x32')]=qs['offset'](_0x3ed0f6['query'][_0x8d9e('0x32')]);}_0x2dbf98['order']=qs[_0x8d9e('0x4f')](_0x3ed0f6[_0x8d9e('0x46')][_0x8d9e('0x4f')]);_0x2dbf98[_0x8d9e('0x50')]=qs[_0x8d9e('0x47')](_[_0x8d9e('0x51')](_0x3ed0f6[_0x8d9e('0x46')],_0x740d1a[_0x8d9e('0x47')]));_0x2dbf98[_0x8d9e('0x50')]['FaxAccountId']=_0x4f048b['id'];if(_0x3ed0f6[_0x8d9e('0x46')][_0x8d9e('0x52')]){_0x2dbf98[_0x8d9e('0x50')]=_[_0x8d9e('0x53')](_0x2dbf98[_0x8d9e('0x50')],{'$or':_[_0x8d9e('0x3e')](_0x2dbf98[_0x8d9e('0x4a')],function(_0x37bb3d){var _0x2018bb={};_0x2018bb[_0x37bb3d]={'$like':'%'+_0x3ed0f6[_0x8d9e('0x46')][_0x8d9e('0x52')]+'%'};return _0x2018bb;})});}if(_0x3ed0f6[_0x8d9e('0x46')][_0x8d9e('0x9e')]){var _0x4ae654=_0x3ed0f6[_0x8d9e('0x46')]['$gte'][_0x8d9e('0x9f')](',');var _0x279df8={};_0x279df8[_0x4ae654[0x0]]={'$gte':moment(_0x4ae654[0x1])[_0x8d9e('0xa0')](_0x8d9e('0xa1'))};_0x2dbf98['where']=_['merge'](_0x2dbf98[_0x8d9e('0x50')],_0x279df8);}_0x2dbf98=_['merge']({},_0x2dbf98,_0x3ed0f6[_0x8d9e('0x55')]);return db['FaxMessage']['count']({'where':_0x2dbf98[_0x8d9e('0x50')]})[_0x8d9e('0x22')](function(_0x140f45){_0x5c001c[_0x8d9e('0x31')]=_0x140f45;if(_0x3ed0f6[_0x8d9e('0x46')]['includeAll']){_0x2dbf98[_0x8d9e('0x57')]=[{'all':!![]}];}return db[_0x8d9e('0x9d')]['findAll'](_0x2dbf98);})[_0x8d9e('0x22')](function(_0xbc919e){_0x5c001c[_0x8d9e('0x59')]=_0xbc919e;return _0x5c001c;});}})[_0x8d9e('0x22')](respondWithFilteredResult(_0x50e59e,_0x2dbf98))['catch'](handleError(_0x50e59e,null));};exports[_0x8d9e('0xa2')]=function(_0x3b82e0,_0x1a8835,_0xe2038e){var _0x2b7741,_0x3127c2={},_0x199775;if(_0x3b82e0['body']['to']){_0x199775=_0x3b82e0['body']['to'][0x0];}return db['FaxAccount'][_0x8d9e('0x5c')]({'where':{'id':_0x3b82e0['params']['id']},'include':[{'model':db[_0x8d9e('0xa3')],'as':_0x8d9e('0xa4'),'include':[{'model':db[_0x8d9e('0x75')],'as':_0x8d9e('0xa5'),'where':{'fax':_0x199775},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x8d9e('0x22')](handleEntityNotFound(_0x1a8835,null))[_0x8d9e('0x22')](function(_0xb87bed){_0x2b7741=_0xb87bed;if(_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xa6')]&&_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xa6')][_0x8d9e('0x4b')]){for(var _0x43ccd8=0x0;_0x43ccd8<_0x3b82e0['body'][_0x8d9e('0xa6')][_0x8d9e('0x4b')];_0x43ccd8+=0x1){_0x3b82e0['body'][_0x8d9e('0xa6')][_0x43ccd8]={'filename':_0x3b82e0['body'][_0x8d9e('0xa6')][_0x43ccd8][_0x8d9e('0x3c')],'id':_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xa6')][_0x43ccd8]['id'],'path':path['join'](config[_0x8d9e('0xa7')],_0x8d9e('0xa8'),_0x3b82e0[_0x8d9e('0x5e')]['attachments'][_0x43ccd8][_0x8d9e('0xa9')])};}}return respondWithRpcPromise(_0x8d9e('0xaa'),_0x8d9e('0xaa'),{'FaxAccountId':_[_0x8d9e('0xab')](_0x3b82e0['params']['id'])?undefined:_0x3b82e0['params']['id'],'path':_[_0x8d9e('0xab')](_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xa6')][0x0][_0x8d9e('0x8')])?undefined:_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xa6')][0x0][_0x8d9e('0x8')],'fax':_[_0x8d9e('0xab')](_0x3b82e0[_0x8d9e('0x5e')]['to'][0x0])?undefined:_0x3b82e0['body']['to'][0x0]},client9002);})[_0x8d9e('0x22')](function(){if(_0x2b7741){if(_[_0x8d9e('0xab')](_0x3b82e0[_0x8d9e('0x5e')]['from'])){_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xac')]=util[_0x8d9e('0xa0')](_0x8d9e('0xad'),_0x2b7741[_0x8d9e('0x3c')],_0x2b7741[_0x8d9e('0xae')]);}if(_0x2b7741[_0x8d9e('0xa4')]){if(_0x2b7741[_0x8d9e('0xa4')][_0x8d9e('0xa5')][_0x8d9e('0x4b')]){return _0x2b7741[_0x8d9e('0xa4')][_0x8d9e('0xa5')][0x0];}else{return db[_0x8d9e('0x75')][_0x8d9e('0x5d')](_[_0x8d9e('0x1b')](_0x3b82e0[_0x8d9e('0x5e')],{'firstName':_0x3b82e0[_0x8d9e('0x5e')]['to'][0x0],'phone':_0x3b82e0[_0x8d9e('0x5e')]['to'][0x0],'fax':_0x3b82e0['body']['to'][0x0],'ListId':_0x2b7741[_0x8d9e('0xaf')]}));}}else{throw new Error(_0x8d9e('0xb0'));}}else{throw new Error(_0x8d9e('0xb1'));}})[_0x8d9e('0x22')](function(_0x191624){if(_0x191624){return db['FaxInteraction'][_0x8d9e('0x5c')]({'where':{'ContactId':_0x191624['id'],'closed':![],'FaxAccountId':_0x2b7741['id']}})[_0x8d9e('0x22')](function(_0x28d8f4){if(_0x28d8f4){return[_0x28d8f4,![]];}return db[_0x8d9e('0x72')]['create']({'UserId':_0x3b82e0[_0x8d9e('0x5f')]['id'],'ContactId':_0x191624['id'],'FaxAccountId':_0x2b7741['id'],'fax':_0x3b82e0[_0x8d9e('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x8d9e('0x53')](_0x3b82e0['body'],{'read':![],'body':_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xa6')][0x0]['filename'],'FaxAccountId':_0x2b7741['id'],'UserId':_0x3b82e0['user']['id'],'ContactId':_0x191624['id'],'AttachmentId':_0x3b82e0['body'][_0x8d9e('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x8d9e('0xb2')}]})[_0x8d9e('0x22')](function(_0x18a703){return[_0x18a703,!![]];});});}else{throw new Error(_0x8d9e('0xb3'));}})[_0x8d9e('0xb4')](function(_0x70f96f,_0x1b7b4d){if(_0x1b7b4d){return _0x70f96f;}return db['FaxMessage'][_0x8d9e('0x5d')]({'direction':_0x8d9e('0xb5'),'read':![],'body':_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xa6')][0x0][_0x8d9e('0xb6')],'FaxAccountId':_0x2b7741['id'],'FaxInteractionId':_0x70f96f['id'],'UserId':_0x3b82e0[_0x8d9e('0x5f')]['id'],'ContactId':_0x70f96f['ContactId'],'AttachmentId':_0x3b82e0['body'][_0x8d9e('0xa6')][0x0]['id']})[_0x8d9e('0x22')](function(_0x26e2cc){_0x70f96f['dataValues']['Messages']=[];_0x70f96f['dataValues']['Messages'][_0x8d9e('0x8c')](_0x26e2cc['dataValues']);return _0x70f96f;});})[_0x8d9e('0x22')](function(_0x4b655a){respondWithRpcPromise(_0x8d9e('0xb7'),_0x8d9e('0xb7'),{'FaxAccountId':_['isNil'](_0x3b82e0[_0x8d9e('0x5a')]['id'])?undefined:_0x3b82e0[_0x8d9e('0x5a')]['id'],'path':_['isNil'](_0x3b82e0['body'][_0x8d9e('0xa6')][0x0][_0x8d9e('0x8')])?undefined:_0x3b82e0[_0x8d9e('0x5e')][_0x8d9e('0xa6')][0x0][_0x8d9e('0x8')],'fax':_[_0x8d9e('0xab')](_0x3b82e0['body']['to'][0x0])?undefined:_0x3b82e0[_0x8d9e('0x5e')]['to'][0x0],'AttachmentId':_0x3b82e0[_0x8d9e('0x5e')]['attachments'][0x0]['id']},client9002)['then'](function(_0x10becc){logger[_0x8d9e('0x23')]('SendFaxRpc,\x20%s',_0x10becc);})[_0x8d9e('0x2a')](function(_0x4d9373){logger[_0x8d9e('0x23')](_0x8d9e('0xb8'),_0x4d9373);});return _0x4b655a;})[_0x8d9e('0x22')](respondWithResult(_0x1a8835,null))[_0x8d9e('0x2a')](handleError(_0x1a8835,null));};exports[_0x8d9e('0xb9')]=function(_0x47584f,_0x366b48,_0x1a4257){return db[_0x8d9e('0x3f')][_0x8d9e('0x5c')]({'where':{'id':_0x47584f[_0x8d9e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x366b48,null))[_0x8d9e('0x22')](function(_0x1ae35d){if(_0x1ae35d){return _0x1ae35d['addAgents'](_0x47584f['body']['ids'],_[_0x8d9e('0xba')](_0x47584f['body'],['ids','id'])||{})[_0x8d9e('0xb4')](function(_0x14133e){for(var _0x15ee85=0x0;_0x15ee85<_0x47584f['body'][_0x8d9e('0x73')][_0x8d9e('0x4b')];_0x15ee85+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x47584f[_0x8d9e('0x5e')]['ids'][_0x15ee85]),'FaxAccountId':Number(_0x47584f[_0x8d9e('0x5a')]['id'])});}return _0x14133e;});}})[_0x8d9e('0x22')](respondWithResult(_0x366b48,null))[_0x8d9e('0x2a')](handleError(_0x366b48,null));};exports['removeAgents']=function(_0x1346b0,_0x4fba99,_0x1aef79){return db[_0x8d9e('0x3f')][_0x8d9e('0x5c')]({'where':{'id':_0x1346b0[_0x8d9e('0x5a')]['id']}})[_0x8d9e('0x22')](handleEntityNotFound(_0x4fba99,null))[_0x8d9e('0x22')](function(_0x45848a){if(_0x45848a){return _0x45848a[_0x8d9e('0xbb')](_0x1346b0[_0x8d9e('0x46')][_0x8d9e('0x73')])[_0x8d9e('0x22')](function(){if(_[_0x8d9e('0xbc')](_0x1346b0[_0x8d9e('0x46')][_0x8d9e('0x73')])){for(var _0x449134=0x0;_0x449134<_0x1346b0[_0x8d9e('0x46')]['ids']['length'];_0x449134+=0x1){socket['emit'](_0x8d9e('0xbd'),{'UserId':Number(_0x1346b0[_0x8d9e('0x46')]['ids'][_0x449134]),'FaxAccountId':Number(_0x1346b0[_0x8d9e('0x5a')]['id'])});}}else{socket[_0x8d9e('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x1346b0[_0x8d9e('0x46')]['ids']),'FaxAccountId':Number(_0x1346b0[_0x8d9e('0x5a')]['id'])});}});}})[_0x8d9e('0x22')](respondWithStatusCode(_0x4fba99,null))['catch'](handleError(_0x4fba99,null));};exports[_0x8d9e('0xbf')]=function(_0x8d82e2,_0x4fa8b6,_0x4e23bb){var _0x5ae76c={};var _0x2c9750={};var _0x1ecf2e;var _0xa51b14;return db[_0x8d9e('0x3f')][_0x8d9e('0x6b')]({'where':{'id':_0x8d82e2[_0x8d9e('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4fa8b6,null))[_0x8d9e('0x22')](function(_0x3e16d5){if(_0x3e16d5){_0x1ecf2e=_0x3e16d5;_0x2c9750[_0x8d9e('0x44')]=_[_0x8d9e('0x45')](db[_0x8d9e('0xc0')]['rawAttributes']);_0x2c9750[_0x8d9e('0x46')]=_[_0x8d9e('0x45')](_0x8d82e2[_0x8d9e('0x46')]);_0x2c9750[_0x8d9e('0x47')]=_[_0x8d9e('0x48')](_0x2c9750[_0x8d9e('0x44')],_0x2c9750[_0x8d9e('0x46')]);_0x5ae76c[_0x8d9e('0x4a')]=_['intersection'](_0x2c9750[_0x8d9e('0x44')],qs['fields'](_0x8d82e2['query']['fields']));_0x5ae76c['attributes']=_0x5ae76c['attributes'][_0x8d9e('0x4b')]?_0x5ae76c['attributes']:_0x2c9750[_0x8d9e('0x44')];_0x5ae76c[_0x8d9e('0x4e')]=qs['sort'](_0x8d82e2[_0x8d9e('0x46')][_0x8d9e('0x4f')]);_0x5ae76c[_0x8d9e('0x50')]=qs[_0x8d9e('0x47')](_[_0x8d9e('0x51')](_0x8d82e2['query'],_0x2c9750[_0x8d9e('0x47')]));if(_0x8d82e2[_0x8d9e('0x46')]['filter']){_0x5ae76c['where']=_[_0x8d9e('0x53')](_0x5ae76c[_0x8d9e('0x50')],{'$or':_[_0x8d9e('0x3e')](_0x5ae76c[_0x8d9e('0x4a')],function(_0x58fac2){var _0x28f089={};_0x28f089[_0x58fac2]={'$like':'%'+_0x8d82e2['query'][_0x8d9e('0x52')]+'%'};return _0x28f089;})});}_0x5ae76c=_[_0x8d9e('0x53')]({},_0x5ae76c,_0x8d82e2[_0x8d9e('0x55')]);return _0x1ecf2e['getAgents'](_0x5ae76c);}})[_0x8d9e('0x22')](function(_0x56dd44){if(_0x56dd44){_0xa51b14=_0x56dd44[_0x8d9e('0x4b')];if(!_0x8d82e2[_0x8d9e('0x46')][_0x8d9e('0x4c')](_0x8d9e('0x4d'))){_0x5ae76c[_0x8d9e('0x30')]=qs[_0x8d9e('0x30')](_0x8d82e2['query'][_0x8d9e('0x30')]);_0x5ae76c[_0x8d9e('0x32')]=qs[_0x8d9e('0x32')](_0x8d82e2[_0x8d9e('0x46')][_0x8d9e('0x32')]);}return _0x1ecf2e[_0x8d9e('0xbf')](_0x5ae76c);}})[_0x8d9e('0x22')](function(_0x4499dc){if(_0x4499dc){return _0x4499dc?{'count':_0xa51b14,'rows':_0x4499dc}:null;}})[_0x8d9e('0x22')](respondWithResult(_0x4fa8b6,null))[_0x8d9e('0x2a')](handleError(_0x4fa8b6,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 70c211c..d52a6db 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 _0x28a5=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x297269,_0x568256){var _0x4ba584=function(_0x5869df){while(--_0x5869df){_0x297269['push'](_0x297269['shift']());}};_0x4ba584(++_0x568256);}(_0x28a5,0x6d));var _0x528a=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x28a5[_0x5ad220];return _0xdec77d;};'use strict';var EventEmitter=require(_0x528a('0x0'));var FaxAccount=require(_0x528a('0x1'))['db'][_0x528a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x528a('0x3')](0x0);var events={'afterCreate':_0x528a('0x4'),'afterUpdate':_0x528a('0x5'),'afterDestroy':_0x528a('0x6')};function emitEvent(_0x15c544){return function(_0x5f70a8,_0x516b3a,_0x581453){FaxAccountEvents[_0x528a('0x7')](_0x15c544+':'+_0x5f70a8['id'],_0x5f70a8);FaxAccountEvents[_0x528a('0x7')](_0x15c544,_0x5f70a8);_0x581453(null);};}for(var e in events){if(events[_0x528a('0x8')](e)){var event=events[e];FaxAccount[_0x528a('0x9')](e,emitEvent(event));}}module[_0x528a('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0xf3eb=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x37dd9d,_0x317c54){var _0x33ec83=function(_0x243af0){while(--_0x243af0){_0x37dd9d['push'](_0x37dd9d['shift']());}};_0x33ec83(++_0x317c54);}(_0xf3eb,0x1af));var _0xbf3e=function(_0x10e49a,_0xc57397){_0x10e49a=_0x10e49a-0x0;var _0xe0f195=_0xf3eb[_0x10e49a];return _0xe0f195;};'use strict';var EventEmitter=require(_0xbf3e('0x0'));var FaxAccount=require(_0xbf3e('0x1'))['db'][_0xbf3e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xbf3e('0x3')](0x0);var events={'afterCreate':_0xbf3e('0x4'),'afterUpdate':_0xbf3e('0x5'),'afterDestroy':_0xbf3e('0x6')};function emitEvent(_0x3005c7){return function(_0x26f321,_0x4f95e7,_0x595d65){FaxAccountEvents[_0xbf3e('0x7')](_0x3005c7+':'+_0x26f321['id'],_0x26f321);FaxAccountEvents['emit'](_0x3005c7,_0x26f321);_0x595d65(null);};}for(var e in events){if(events[_0xbf3e('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xbf3e('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 5a22372..e15821b 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 _0x5248=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash'];(function(_0x4888bb,_0x54b5d5){var _0x5d6703=function(_0x53bb05){while(--_0x53bb05){_0x4888bb['push'](_0x4888bb['shift']());}};_0x5d6703(++_0x54b5d5);}(_0x5248,0x1b1));var _0x8524=function(_0x6aadc1,_0x408f63){_0x6aadc1=_0x6aadc1-0x0;var _0x1fc1d9=_0x5248[_0x6aadc1];return _0x1fc1d9;};'use strict';var _=require(_0x8524('0x0'));var util=require(_0x8524('0x1'));var logger=require(_0x8524('0x2'))(_0x8524('0x3'));var moment=require(_0x8524('0x4'));var BPromise=require(_0x8524('0x5'));var rp=require(_0x8524('0x6'));var fs=require('fs');var path=require(_0x8524('0x7'));var rimraf=require(_0x8524('0x8'));var config=require(_0x8524('0x9'));var attributes=require(_0x8524('0xa'));module[_0x8524('0xb')]=function(_0x4a7dab,_0x3e098f){return _0x4a7dab[_0x8524('0xc')]('FaxAccount',attributes,{'tableName':_0x8524('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc939=['FaxAccount','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x322177,_0x4a29c4){var _0x357c57=function(_0x5114c9){while(--_0x5114c9){_0x322177['push'](_0x322177['shift']());}};_0x357c57(++_0x4a29c4);}(_0xc939,0x12d));var _0x9c93=function(_0x4860a2,_0x27aa4d){_0x4860a2=_0x4860a2-0x0;var _0xefc798=_0xc939[_0x4860a2];return _0xefc798;};'use strict';var _=require(_0x9c93('0x0'));var util=require(_0x9c93('0x1'));var logger=require(_0x9c93('0x2'))('api');var moment=require(_0x9c93('0x3'));var BPromise=require(_0x9c93('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c93('0x5'));var config=require(_0x9c93('0x6'));var attributes=require('./faxAccount.attributes');module[_0x9c93('0x7')]=function(_0x5c12ab,_0x1102c3){return _0x5c12ab[_0x9c93('0x8')](_0x9c93('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 32d86bc..b6952f6 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 _0x8ad9=['DESC','FaxApplication','Applications','get','account','applications','list','orderBy','priority','asc','length','create','FaxInteraction','spread','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','name','unshift','agent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','register','request','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','findAll','raw','options','where','attributes','include','map','model','then','NotifyFaxAccount','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','body','isNil','from','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','FaxAccount','CmList','List','CmContact','Contacts'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8ad9,0x6c));var _0x98ad=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x8ad9[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x98ad('0x0'));var util=require(_0x98ad('0x1'));var moment=require(_0x98ad('0x2'));var BPromise=require('bluebird');var rs=require(_0x98ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98ad('0x4'))['db'];var utils=require(_0x98ad('0x5'));var logger=require(_0x98ad('0x6'))(_0x98ad('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ad('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x98ad('0x9')]=_[_0x98ad('0xa')](config[_0x98ad('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x98ad('0xb'))(new Redis(config[_0x98ad('0x9')]));require('./faxAccount.socket')[_0x98ad('0xc')](socket);function respondWithRpcPromise(_0x4f9f34,_0x50a4dd,_0x1353ad){return new BPromise(function(_0xe1b24,_0x43780d){return client[_0x98ad('0xd')](_0x4f9f34,_0x1353ad)['then'](function(_0x37c723){logger[_0x98ad('0xe')]('FaxAccount,\x20%s,\x20%s',_0x50a4dd,'request\x20sent');logger[_0x98ad('0xf')](_0x98ad('0x10'),_0x50a4dd,_0x98ad('0x11'),JSON[_0x98ad('0x12')](_0x37c723));if(_0x37c723[_0x98ad('0x13')]){if(_0x37c723[_0x98ad('0x13')][_0x98ad('0x14')]===0x1f4){logger[_0x98ad('0x13')](_0x98ad('0x15'),_0x50a4dd,_0x37c723[_0x98ad('0x13')][_0x98ad('0x16')]);return _0x43780d(_0x37c723[_0x98ad('0x13')]['message']);}logger[_0x98ad('0x13')](_0x98ad('0x15'),_0x50a4dd,_0x37c723[_0x98ad('0x13')][_0x98ad('0x16')]);return _0xe1b24(_0x37c723[_0x98ad('0x13')]['message']);}else{logger[_0x98ad('0xe')](_0x98ad('0x15'),_0x50a4dd,_0x98ad('0x11'));_0xe1b24(_0x37c723['result']['message']);}})[_0x98ad('0x17')](function(_0x5a4bd8){logger[_0x98ad('0x13')]('FaxAccount,\x20%s,\x20%s',_0x50a4dd,_0x5a4bd8);_0x43780d(_0x5a4bd8);});});}exports[_0x98ad('0x18')]=function(_0x89cad4){var _0x9bc78e=this;return new Promise(function(_0x253330,_0x2ad6c1){return db['FaxAccount'][_0x98ad('0x19')]({'raw':_0x89cad4['options']?_0x89cad4['options'][_0x98ad('0x1a')]===undefined?!![]:![]:!![],'where':_0x89cad4[_0x98ad('0x1b')]?_0x89cad4[_0x98ad('0x1b')][_0x98ad('0x1c')]||null:null,'attributes':_0x89cad4[_0x98ad('0x1b')]?_0x89cad4[_0x98ad('0x1b')][_0x98ad('0x1d')]||null:null,'limit':_0x89cad4[_0x98ad('0x1b')]?_0x89cad4[_0x98ad('0x1b')]['limit']||null:null,'include':_0x89cad4[_0x98ad('0x1b')]?_0x89cad4[_0x98ad('0x1b')][_0x98ad('0x1e')]?_[_0x98ad('0x1f')](_0x89cad4[_0x98ad('0x1b')][_0x98ad('0x1e')],function(_0x108f89){return{'model':db[_0x108f89[_0x98ad('0x20')]],'as':_0x108f89['as'],'attributes':_0x108f89[_0x98ad('0x1d')],'include':_0x108f89[_0x98ad('0x1e')]?_[_0x98ad('0x1f')](_0x108f89[_0x98ad('0x1e')],function(_0x5bebfb){return{'model':db[_0x5bebfb[_0x98ad('0x20')]],'as':_0x5bebfb['as'],'attributes':_0x5bebfb[_0x98ad('0x1d')],'include':_0x5bebfb['include']?_[_0x98ad('0x1f')](_0x5bebfb[_0x98ad('0x1e')],function(_0x6bab5a){return{'model':db[_0x6bab5a[_0x98ad('0x20')]],'as':_0x6bab5a['as'],'attributes':_0x6bab5a[_0x98ad('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x98ad('0x21')](function(_0x180240){logger[_0x98ad('0xe')](_0x98ad('0x18'),_0x89cad4);logger[_0x98ad('0xf')]('GetFaxAccount',_0x89cad4,JSON['stringify'](_0x180240));_0x253330(_0x180240);})[_0x98ad('0x17')](function(_0x1c9cb5){logger['error'](_0x98ad('0x18'),_0x1c9cb5[_0x98ad('0x16')],_0x89cad4);_0x2ad6c1(_0x9bc78e['error'](0x1f4,_0x1c9cb5[_0x98ad('0x16')]));});});};exports[_0x98ad('0x22')]=function(_0x3490d7,_0x2d232c,_0x198480){var _0x31b7d8=this;return new Promise(function(_0x46bcb5,_0x2cd062){var _0x3d0784={'body':_0x3490d7['body'],'channel':_0x98ad('0x23')};var _0x4260c7=[];var _0x5c228f=[];var _0x500c71={};return db['CmContact'][_0x98ad('0x24')]()[_0x98ad('0x21')](function(_0x2e3a8c){if(!_0x2e3a8c){throw new db[(_0x98ad('0x25'))][(_0x98ad('0x26'))](_0x98ad('0x27'));}_0x4260c7=_['difference'](_['keys'](_0x2e3a8c),['createdAt',_0x98ad('0x28')]);_0x5c228f=_[_0x98ad('0x29')](_['keys'](_0x2e3a8c),[_0x98ad('0x2a'),'updatedAt','CompanyId','ListId']);if(_0x3490d7[_0x98ad('0x2b')]['id']){delete _0x3490d7[_0x98ad('0x2b')]['id'];}if(_[_0x98ad('0x2c')](_0x3490d7[_0x98ad('0x2b')][_0x98ad('0x2d')])){throw new db['Sequelize']['ValidationError'](_0x98ad('0x2e'));}if(_['isNil'](_0x3490d7[_0x98ad('0x2b')][_0x98ad('0x2b')])||_0x3490d7[_0x98ad('0x2b')][_0x98ad('0x2b')]===''){throw new db['Sequelize']['ValidationError'](_0x98ad('0x2f'));}if(_[_0x98ad('0x2c')](_0x3490d7[_0x98ad('0x2b')][_0x98ad('0x30')])){throw new db[(_0x98ad('0x25'))][(_0x98ad('0x26'))](_0x98ad('0x31')+_0x5c228f);}if(!_['includes'](_0x5c228f,_0x3490d7['body'][_0x98ad('0x30')])){throw new db[(_0x98ad('0x25'))]['ValidationError'](_0x98ad('0x32')+_0x5c228f);}_0x500c71[_0x3490d7[_0x98ad('0x2b')][_0x98ad('0x30')]]=_0x3490d7['body'][_0x98ad('0x2d')];})['then'](function(){return db[_0x98ad('0x33')]['find']({'where':{'id':_0x3490d7['account']['id']},'include':[{'model':db[_0x98ad('0x34')],'as':_0x98ad('0x35'),'include':[{'model':db[_0x98ad('0x36')],'as':_0x98ad('0x37'),'where':_0x500c71,'limit':0x1,'order':[[_0x98ad('0x28'),_0x98ad('0x38')]]}]},{'model':db[_0x98ad('0x39')],'as':_0x98ad('0x3a')}]});})['then'](function(_0x380085){if(_0x380085&&_0x380085[_0x98ad('0x35')]){var _0x4b9b6f=_0x380085[_0x98ad('0x3b')]({'plain':!![]});_0x3d0784[_0x98ad('0x3c')]=_0x4b9b6f;_0x3d0784[_0x98ad('0x3d')]=_0x4b9b6f[_0x98ad('0x3a')];_0x3d0784[_0x98ad('0x3e')]=_0x4b9b6f[_0x98ad('0x35')];_0x3d0784['applications']=_[_0x98ad('0x3f')](_0x3d0784[_0x98ad('0x3d')],[_0x98ad('0x40')],[_0x98ad('0x41')]);if(_0x3d0784['account']['Applications']){delete _0x3d0784[_0x98ad('0x3c')][_0x98ad('0x3a')];}if(_0x3d0784[_0x98ad('0x3c')][_0x98ad('0x35')]&&_0x3d0784[_0x98ad('0x3c')][_0x98ad('0x35')]['Contacts'][_0x98ad('0x42')]){return _0x3d0784['account'][_0x98ad('0x35')][_0x98ad('0x37')][0x0];}var _0x4bc9b8=_[_0x98ad('0xa')](_0x3490d7['body'],{'firstName':_0x3490d7[_0x98ad('0x2b')][_0x98ad('0x2d')],'ListId':_0x4b9b6f['ListId']});_0x4bc9b8[_0x3490d7[_0x98ad('0x2b')]['mapKey']]=_0x3490d7[_0x98ad('0x2b')][_0x98ad('0x2d')];return db[_0x98ad('0x36')][_0x98ad('0x43')](_0x4bc9b8,{'fields':_0x4260c7,'raw':!![]});}})[_0x98ad('0x21')](function(_0x191e14){_0x3d0784['contact']=_0x191e14;if(_0x191e14){var _0x551143={'ContactId':_0x191e14['id'],'FaxAccountId':_0x3490d7[_0x98ad('0x3c')]['id'],'fax':_0x191e14[_0x98ad('0x23')]};return db[_0x98ad('0x44')]['find']({'where':{'ContactId':_0x191e14['id'],'closed':![],'FaxAccountId':_0x3490d7[_0x98ad('0x3c')]['id']}})[_0x98ad('0x21')](function(_0x57a812){if(_0x57a812){return[_0x57a812,![]];}return db[_0x98ad('0x44')][_0x98ad('0x43')](_0x551143)[_0x98ad('0x21')](function(_0x56f4c3){return[_0x56f4c3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x98ad('0x45')](function(_0x4fbaff,_0x4981b3){var _0x374834=_0x4fbaff['get']({'plain':!![]});if(_0x4981b3){if(_0x3d0784['account']['autoclose']){_0x3d0784[_0x98ad('0x3d')]['push']({'id':0x0,'priority':_0x3d0784['applications']['length']+0x1,'app':'close','appdata':_0x98ad('0x46'),'interval':'*,*,*,*'});}_0x374834[_0x98ad('0x47')]=!![];}else{_0x374834[_0x98ad('0x47')]=![];}_0x3d0784[_0x98ad('0x48')]=_0x374834;return db[_0x98ad('0x49')]['create']({'body':_0x3490d7['body'][_0x98ad('0x2b')],'FaxAccountId':_0x3490d7['account']['id'],'FaxInteractionId':_0x4fbaff['id'],'direction':'in','ContactId':_0x4fbaff['ContactId'],'AttachmentId':_0x3490d7['body'][_0x98ad('0x4a')]});})['then'](function(_0x425efd){_0x3d0784[_0x98ad('0x16')]=_0x425efd;if(_0x3d0784[_0x98ad('0x48')][_0x98ad('0x4b')]){return db['User']['find']({'attributes':['id',_0x98ad('0x4c')],'where':{'id':_0x3d0784['interaction'][_0x98ad('0x4b')]}})[_0x98ad('0x21')](function(_0x674e91){if(_0x674e91){_0x3d0784[_0x98ad('0x3d')][_0x98ad('0x4d')]({'id':0x0,'priority':0x0,'app':_0x98ad('0x4e'),'appdata':_0x674e91[_0x98ad('0x4c')]+','+(_0x3d0784[_0x98ad('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0x98ad('0x4f')});}return respondWithRpcPromise(_0x98ad('0x50'),_0x98ad('0x51'),_0x3d0784);});}return respondWithRpcPromise(_0x98ad('0x50'),_0x98ad('0x51'),_0x3d0784);})[_0x98ad('0x21')](function(_0x3b73e2){_0x46bcb5(_0x3b73e2);})[_0x98ad('0x17')](function(_0x2704c8){_0x2cd062(_0x31b7d8[_0x98ad('0x13')](0x1f4,_0x2704c8[_0x98ad('0x16')]));});});}; \ No newline at end of file +var _0x40d1=['account','applications','list','orderBy','priority','Contacts','length','ListId','fax','create','spread','get','autoclose','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','DESC','FaxApplication','Applications'];(function(_0x321206,_0x22269d){var _0xb3746b=function(_0x56b796){while(--_0x56b796){_0x321206['push'](_0x321206['shift']());}};_0xb3746b(++_0x22269d);}(_0x40d1,0x123));var _0x140d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x40d1[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x140d('0x0'));var util=require('util');var moment=require(_0x140d('0x1'));var BPromise=require(_0x140d('0x2'));var rs=require(_0x140d('0x3'));var fs=require('fs');var Redis=require(_0x140d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x140d('0x5'));var logger=require('../../config/logger')(_0x140d('0x6'));var config=require(_0x140d('0x7'));var jayson=require(_0x140d('0x8'));var client=jayson[_0x140d('0x9')]['http']({'port':0x232c});config[_0x140d('0xa')]=_[_0x140d('0xb')](config[_0x140d('0xa')],{'host':_0x140d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x140d('0xa')]));require(_0x140d('0xd'))[_0x140d('0xe')](socket);function respondWithRpcPromise(_0x58936d,_0x13b24e,_0x251030){return new BPromise(function(_0x3d8978,_0xe899c3){return client['request'](_0x58936d,_0x251030)['then'](function(_0x1291fc){logger[_0x140d('0xf')](_0x140d('0x10'),_0x13b24e,_0x140d('0x11'));logger[_0x140d('0x12')](_0x140d('0x13'),_0x13b24e,_0x140d('0x11'),JSON[_0x140d('0x14')](_0x1291fc));if(_0x1291fc[_0x140d('0x15')]){if(_0x1291fc[_0x140d('0x15')][_0x140d('0x16')]===0x1f4){logger[_0x140d('0x15')](_0x140d('0x10'),_0x13b24e,_0x1291fc['error'][_0x140d('0x17')]);return _0xe899c3(_0x1291fc['error'][_0x140d('0x17')]);}logger['error'](_0x140d('0x10'),_0x13b24e,_0x1291fc[_0x140d('0x15')][_0x140d('0x17')]);return _0x3d8978(_0x1291fc['error']['message']);}else{logger['info'](_0x140d('0x10'),_0x13b24e,_0x140d('0x11'));_0x3d8978(_0x1291fc[_0x140d('0x18')][_0x140d('0x17')]);}})[_0x140d('0x19')](function(_0x311d17){logger[_0x140d('0x15')](_0x140d('0x10'),_0x13b24e,_0x311d17);_0xe899c3(_0x311d17);});});}exports['GetFaxAccount']=function(_0x59de2a){var _0x2d35fc=this;return new Promise(function(_0x437b64,_0x5327cb){return db[_0x140d('0x1a')][_0x140d('0x1b')]({'raw':_0x59de2a[_0x140d('0x1c')]?_0x59de2a[_0x140d('0x1c')][_0x140d('0x1d')]===undefined?!![]:![]:!![],'where':_0x59de2a['options']?_0x59de2a[_0x140d('0x1c')][_0x140d('0x1e')]||null:null,'attributes':_0x59de2a['options']?_0x59de2a[_0x140d('0x1c')][_0x140d('0x1f')]||null:null,'limit':_0x59de2a[_0x140d('0x1c')]?_0x59de2a[_0x140d('0x1c')][_0x140d('0x20')]||null:null,'include':_0x59de2a[_0x140d('0x1c')]?_0x59de2a[_0x140d('0x1c')][_0x140d('0x21')]?_[_0x140d('0x22')](_0x59de2a['options'][_0x140d('0x21')],function(_0x5852f6){return{'model':db[_0x5852f6['model']],'as':_0x5852f6['as'],'attributes':_0x5852f6[_0x140d('0x1f')],'include':_0x5852f6[_0x140d('0x21')]?_[_0x140d('0x22')](_0x5852f6[_0x140d('0x21')],function(_0x3e972e){return{'model':db[_0x3e972e[_0x140d('0x23')]],'as':_0x3e972e['as'],'attributes':_0x3e972e[_0x140d('0x1f')],'include':_0x3e972e[_0x140d('0x21')]?_[_0x140d('0x22')](_0x3e972e[_0x140d('0x21')],function(_0x252696){return{'model':db[_0x252696['model']],'as':_0x252696['as'],'attributes':_0x252696[_0x140d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x140d('0x24')](function(_0x239748){logger[_0x140d('0xf')]('GetFaxAccount',_0x59de2a);logger[_0x140d('0x12')](_0x140d('0x25'),_0x59de2a,JSON[_0x140d('0x14')](_0x239748));_0x437b64(_0x239748);})[_0x140d('0x19')](function(_0x1f480e){logger[_0x140d('0x15')](_0x140d('0x25'),_0x1f480e['message'],_0x59de2a);_0x5327cb(_0x2d35fc[_0x140d('0x15')](0x1f4,_0x1f480e[_0x140d('0x17')]));});});};exports[_0x140d('0x26')]=function(_0x3e061f,_0x5658a1,_0xd53980){var _0x10d38c=this;return new Promise(function(_0x423080,_0x5b01a2){var _0x102e72={'body':_0x3e061f[_0x140d('0x27')],'channel':'fax'};var _0x477813=[];var _0x40436b=[];var _0x6d42f9={};return db[_0x140d('0x28')][_0x140d('0x29')]()[_0x140d('0x24')](function(_0x42323e){if(!_0x42323e){throw new db[(_0x140d('0x2a'))][(_0x140d('0x2b'))](_0x140d('0x2c'));}_0x477813=_[_0x140d('0x2d')](_[_0x140d('0x2e')](_0x42323e),[_0x140d('0x2f'),_0x140d('0x30')]);_0x40436b=_[_0x140d('0x2d')](_[_0x140d('0x2e')](_0x42323e),[_0x140d('0x2f'),_0x140d('0x30'),'CompanyId','ListId']);if(_0x3e061f[_0x140d('0x27')]['id']){delete _0x3e061f[_0x140d('0x27')]['id'];}if(_[_0x140d('0x31')](_0x3e061f['body'][_0x140d('0x32')])){throw new db[(_0x140d('0x2a'))][(_0x140d('0x2b'))]('from\x20is\x20mandatory');}if(_[_0x140d('0x31')](_0x3e061f[_0x140d('0x27')]['body'])||_0x3e061f[_0x140d('0x27')]['body']===''){throw new db[(_0x140d('0x2a'))]['ValidationError'](_0x140d('0x33'));}if(_[_0x140d('0x31')](_0x3e061f[_0x140d('0x27')][_0x140d('0x34')])){throw new db[(_0x140d('0x2a'))][(_0x140d('0x2b'))](_0x140d('0x35')+_0x40436b);}if(!_[_0x140d('0x36')](_0x40436b,_0x3e061f[_0x140d('0x27')][_0x140d('0x34')])){throw new db[(_0x140d('0x2a'))][(_0x140d('0x2b'))](_0x140d('0x37')+_0x40436b);}_0x6d42f9[_0x3e061f[_0x140d('0x27')][_0x140d('0x34')]]=_0x3e061f[_0x140d('0x27')][_0x140d('0x32')];})['then'](function(){return db['FaxAccount'][_0x140d('0x38')]({'where':{'id':_0x3e061f['account']['id']},'include':[{'model':db['CmList'],'as':_0x140d('0x39'),'include':[{'model':db[_0x140d('0x28')],'as':'Contacts','where':_0x6d42f9,'limit':0x1,'order':[[_0x140d('0x30'),_0x140d('0x3a')]]}]},{'model':db[_0x140d('0x3b')],'as':_0x140d('0x3c')}]});})[_0x140d('0x24')](function(_0x264e0f){if(_0x264e0f&&_0x264e0f[_0x140d('0x39')]){var _0x224516=_0x264e0f['get']({'plain':!![]});_0x102e72[_0x140d('0x3d')]=_0x224516;_0x102e72[_0x140d('0x3e')]=_0x224516[_0x140d('0x3c')];_0x102e72[_0x140d('0x3f')]=_0x224516['List'];_0x102e72[_0x140d('0x3e')]=_[_0x140d('0x40')](_0x102e72[_0x140d('0x3e')],[_0x140d('0x41')],['asc']);if(_0x102e72[_0x140d('0x3d')]['Applications']){delete _0x102e72['account'][_0x140d('0x3c')];}if(_0x102e72['account'][_0x140d('0x39')]&&_0x102e72['account']['List'][_0x140d('0x42')][_0x140d('0x43')]){return _0x102e72[_0x140d('0x3d')][_0x140d('0x39')]['Contacts'][0x0];}var _0xf25bc2=_[_0x140d('0xb')](_0x3e061f[_0x140d('0x27')],{'firstName':_0x3e061f[_0x140d('0x27')][_0x140d('0x32')],'ListId':_0x224516[_0x140d('0x44')]});_0xf25bc2[_0x3e061f[_0x140d('0x27')][_0x140d('0x34')]]=_0x3e061f[_0x140d('0x27')]['from'];return db[_0x140d('0x28')]['create'](_0xf25bc2,{'fields':_0x477813,'raw':!![]});}})[_0x140d('0x24')](function(_0x84dc2c){_0x102e72['contact']=_0x84dc2c;if(_0x84dc2c){var _0x26ad44={'ContactId':_0x84dc2c['id'],'FaxAccountId':_0x3e061f['account']['id'],'fax':_0x84dc2c[_0x140d('0x45')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x84dc2c['id'],'closed':![],'FaxAccountId':_0x3e061f[_0x140d('0x3d')]['id']}})[_0x140d('0x24')](function(_0x1b172){if(_0x1b172){return[_0x1b172,![]];}return db['FaxInteraction'][_0x140d('0x46')](_0x26ad44)[_0x140d('0x24')](function(_0x38eae9){return[_0x38eae9,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x140d('0x47')](function(_0x3091f6,_0x1017c9){var _0x5dad3a=_0x3091f6[_0x140d('0x48')]({'plain':!![]});if(_0x1017c9){if(_0x102e72[_0x140d('0x3d')][_0x140d('0x49')]){_0x102e72[_0x140d('0x3e')]['push']({'id':0x0,'priority':_0x102e72[_0x140d('0x3e')][_0x140d('0x43')]+0x1,'app':'close','appdata':_0x140d('0x4a'),'interval':_0x140d('0x4b')});}_0x5dad3a[_0x140d('0x4c')]=!![];}else{_0x5dad3a['created']=![];}_0x102e72[_0x140d('0x4d')]=_0x5dad3a;return db[_0x140d('0x4e')]['create']({'body':_0x3e061f[_0x140d('0x27')]['body'],'FaxAccountId':_0x3e061f[_0x140d('0x3d')]['id'],'FaxInteractionId':_0x3091f6['id'],'direction':'in','ContactId':_0x3091f6['ContactId'],'AttachmentId':_0x3e061f['body'][_0x140d('0x4f')]});})[_0x140d('0x24')](function(_0x52b06a){_0x102e72[_0x140d('0x17')]=_0x52b06a;if(_0x102e72[_0x140d('0x4d')]['UserId']){return db[_0x140d('0x50')][_0x140d('0x38')]({'attributes':['id','name'],'where':{'id':_0x102e72[_0x140d('0x4d')][_0x140d('0x51')]}})[_0x140d('0x24')](function(_0x1cbd49){if(_0x1cbd49){_0x102e72[_0x140d('0x3e')][_0x140d('0x52')]({'id':0x0,'priority':0x0,'app':_0x140d('0x53'),'appdata':_0x1cbd49[_0x140d('0x54')]+','+(_0x102e72[_0x140d('0x3d')][_0x140d('0x55')]||0xa),'interval':_0x140d('0x4b')});}return respondWithRpcPromise(_0x140d('0x56'),_0x140d('0x57'),_0x102e72);});}return respondWithRpcPromise(_0x140d('0x56'),_0x140d('0x57'),_0x102e72);})['then'](function(_0x428b19){_0x423080(_0x428b19);})['catch'](function(_0x428fb5){_0x5b01a2(_0x10d38c['error'](0x1f4,_0x428fb5[_0x140d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 71ac2ea..3f7eecd 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 _0x2c6e=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x31708e,_0x5ec61b){var _0x150e9c=function(_0x2782c8){while(--_0x2782c8){_0x31708e['push'](_0x31708e['shift']());}};_0x150e9c(++_0x5ec61b);}(_0x2c6e,0xd1));var _0xe2c6=function(_0x15146a,_0xd2098f){_0x15146a=_0x15146a-0x0;var _0xb334a5=_0x2c6e[_0x15146a];return _0xb334a5;};'use strict';var FaxAccountEvents=require(_0xe2c6('0x0'));var events=[_0xe2c6('0x1'),_0xe2c6('0x2'),_0xe2c6('0x3')];function createListener(_0x402aaa,_0xfd2423){return function(_0x4e121f){_0xfd2423[_0xe2c6('0x4')](_0x402aaa,_0x4e121f);};}function removeListener(_0x4b9a00,_0x54ba44){return function(){FaxAccountEvents[_0xe2c6('0x5')](_0x4b9a00,_0x54ba44);};}exports[_0xe2c6('0x6')]=function(_0x41d4bf){for(var _0x3501e3=0x0,_0x30620b=events['length'];_0x3501e3<_0x30620b;_0x3501e3++){var _0x5c811e=events[_0x3501e3];var _0x4495dc=createListener(_0xe2c6('0x7')+_0x5c811e,_0x41d4bf);FaxAccountEvents['on'](_0x5c811e,_0x4495dc);}}; \ No newline at end of file +var _0xef01=['removeListener','register','length','faxAccount:','./faxAccount.events','save','update','emit'];(function(_0x194144,_0x54cdf3){var _0x5bbf1c=function(_0x1090ff){while(--_0x1090ff){_0x194144['push'](_0x194144['shift']());}};_0x5bbf1c(++_0x54cdf3);}(_0xef01,0x1cc));var _0x1ef0=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xef01[_0x4ae6ef];return _0x3cbb4e;};'use strict';var FaxAccountEvents=require(_0x1ef0('0x0'));var events=[_0x1ef0('0x1'),'remove',_0x1ef0('0x2')];function createListener(_0x49c3ac,_0x1b9be3){return function(_0x368e89){_0x1b9be3[_0x1ef0('0x3')](_0x49c3ac,_0x368e89);};}function removeListener(_0x469311,_0x2b7c6c){return function(){FaxAccountEvents[_0x1ef0('0x4')](_0x469311,_0x2b7c6c);};}exports[_0x1ef0('0x5')]=function(_0x5df2e2){for(var _0x2312a3=0x0,_0xecbbde=events[_0x1ef0('0x6')];_0x2312a3<_0xecbbde;_0x2312a3++){var _0x5a25e6=events[_0x2312a3];var _0x3799f9=createListener(_0x1ef0('0x7')+_0x5a25e6,_0x5df2e2);FaxAccountEvents['on'](_0x5a25e6,_0x3799f9);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f3d14b7..8f1ccc5 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x487ee3,_0x4322ab){var _0x2eb2b1=function(_0x3fc424){while(--_0x3fc424){_0x487ee3['push'](_0x487ee3['shift']());}};_0x2eb2b1(++_0x4322ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xad35fd,_0xee91b3){var _0x188450=function(_0x570f6a){while(--_0x570f6a){_0xad35fd['push'](_0xad35fd['shift']());}};_0x188450(++_0xee91b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 1ed7976..600e1ae 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 _0x6cd5=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x12934a,_0x3ce21d){var _0x8ad4f9=function(_0x53eb6e){while(--_0x53eb6e){_0x12934a['push'](_0x12934a['shift']());}};_0x8ad4f9(++_0x3ce21d);}(_0x6cd5,0x1f1));var _0x56cd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6cd5[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x56cd('0x0'));module[_0x56cd('0x1')]={'priority':{'type':Sequelize[_0x56cd('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x56cd('0x3')},'appdata':{'type':Sequelize[_0x56cd('0x4')]()},'description':{'type':Sequelize[_0x56cd('0x5')]},'interval':{'type':Sequelize[_0x56cd('0x5')],'defaultValue':_0x56cd('0x6')}}; \ No newline at end of file +var _0x14ca=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1e7f4d,_0x20acaa){var _0x5f0fd9=function(_0x4dbbf4){while(--_0x4dbbf4){_0x1e7f4d['push'](_0x1e7f4d['shift']());}};_0x5f0fd9(++_0x20acaa);}(_0x14ca,0x68));var _0xa14c=function(_0x43d887,_0x56462c){_0x43d887=_0x43d887-0x0;var _0x5bbfb7=_0x14ca[_0x43d887];return _0x5bbfb7;};'use strict';var Sequelize=require(_0xa14c('0x0'));module[_0xa14c('0x1')]={'priority':{'type':Sequelize[_0xa14c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa14c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa14c('0x4')]()},'description':{'type':Sequelize[_0xa14c('0x3')]},'interval':{'type':Sequelize[_0xa14c('0x3')],'defaultValue':_0xa14c('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6adf6a5..4bf3e72 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 _0x68a8=['where','filters','pick','filter','VIRTUAL','FaxApplication','includeAll','include','findAll','catch','show','params','merge','options','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1dd2cc,_0x36ddfe){var _0x305d8e=function(_0x27df09){while(--_0x27df09){_0x1dd2cc['push'](_0x1dd2cc['shift']());}};_0x305d8e(++_0x36ddfe);}(_0x68a8,0x18d));var _0x868a=function(_0x55b10f,_0x216487){_0x55b10f=_0x55b10f-0x0;var _0x1727a3=_0x68a8[_0x55b10f];return _0x1727a3;};'use strict';var emlformat=require(_0x868a('0x0'));var rimraf=require(_0x868a('0x1'));var zipdir=require(_0x868a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x868a('0x3'));var BPromise=require(_0x868a('0x4'));var Mustache=require(_0x868a('0x5'));var util=require(_0x868a('0x6'));var path=require('path');var sox=require(_0x868a('0x7'));var csv=require(_0x868a('0x8'));var ejs=require(_0x868a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x868a('0xa'));var squel=require(_0x868a('0xb'));var crypto=require(_0x868a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x868a('0xd'));var toCsv=require(_0x868a('0x8'));var querystring=require(_0x868a('0xe'));var Papa=require(_0x868a('0xf'));var Redis=require(_0x868a('0x10'));var authService=require(_0x868a('0x11'));var qs=require(_0x868a('0x12'));var as=require(_0x868a('0x13'));var hardwareService=require(_0x868a('0x14'));var logger=require(_0x868a('0x15'))(_0x868a('0x16'));var utils=require(_0x868a('0x17'));var config=require(_0x868a('0x18'));var licenseUtil=require(_0x868a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1db661,_0x5c2bde){_0x5c2bde=_0x5c2bde||0xcc;return function(_0x4bbb2f){if(_0x4bbb2f){return _0x1db661[_0x868a('0x1a')](_0x5c2bde);}return _0x1db661['status'](_0x5c2bde)['end']();};}function respondWithResult(_0x1b83e8,_0x7303f3){_0x7303f3=_0x7303f3||0xc8;return function(_0x4bd20b){if(_0x4bd20b){return _0x1b83e8[_0x868a('0x1b')](_0x7303f3)[_0x868a('0x1c')](_0x4bd20b);}};}function respondWithFilteredResult(_0x5b1f06,_0x13afbd){return function(_0x426167){if(_0x426167){var _0x55dfad=typeof _0x13afbd[_0x868a('0x1d')]===_0x868a('0x1e')&&typeof _0x13afbd[_0x868a('0x1f')]===_0x868a('0x1e');var _0x251713=_0x426167[_0x868a('0x20')];var _0x3a54ff=_0x55dfad?0x0:_0x13afbd[_0x868a('0x1d')];var _0x4c15a5=_0x55dfad?_0x426167[_0x868a('0x20')]:_0x13afbd['offset']+_0x13afbd['limit'];var _0x2d9106;if(_0x4c15a5>=_0x251713){_0x4c15a5=_0x251713;_0x2d9106=0xc8;}else{_0x2d9106=0xce;}_0x5b1f06[_0x868a('0x1b')](_0x2d9106);return _0x5b1f06[_0x868a('0x21')]('Content-Range',_0x3a54ff+'-'+_0x4c15a5+'/'+_0x251713)['json'](_0x426167);}return null;};}function patchUpdates(_0x4279f8){return function(_0x4f86d3){try{jsonpatch[_0x868a('0x22')](_0x4f86d3,_0x4279f8,!![]);}catch(_0x56796a){return BPromise[_0x868a('0x23')](_0x56796a);}return _0x4f86d3['save']();};}function saveUpdates(_0x965a5,_0x4cbb5e){return function(_0xf50e15){if(_0xf50e15){return _0xf50e15['update'](_0x965a5)[_0x868a('0x24')](function(_0x1ecc78){return _0x1ecc78;});}return null;};}function removeEntity(_0x26a1e9,_0x4a8802){return function(_0x531e1a){if(_0x531e1a){return _0x531e1a[_0x868a('0x25')]()[_0x868a('0x24')](function(){_0x26a1e9[_0x868a('0x1b')](0xcc)[_0x868a('0x26')]();});}};}function handleEntityNotFound(_0x4d244f,_0xf9d63){return function(_0x91a9ad){if(!_0x91a9ad){_0x4d244f[_0x868a('0x1a')](0x194);}return _0x91a9ad;};}function handleError(_0x44ff16,_0x40ccb6){_0x40ccb6=_0x40ccb6||0x1f4;return function(_0x56267a){logger['error'](_0x56267a[_0x868a('0x27')]);if(_0x56267a[_0x868a('0x28')]){delete _0x56267a[_0x868a('0x28')];}_0x44ff16[_0x868a('0x1b')](_0x40ccb6)[_0x868a('0x29')](_0x56267a);};}exports[_0x868a('0x2a')]=function(_0x42ae9e,_0x253135){var _0x4cca34={},_0x4a982d={},_0x1a1c49={'count':0x0,'rows':[]};var _0x5a237c=_['map'](db['FaxApplication'][_0x868a('0x2b')],function(_0x15daf9){return{'name':_0x15daf9[_0x868a('0x2c')],'type':_0x15daf9[_0x868a('0x2d')][_0x868a('0x2e')]};});_0x4a982d[_0x868a('0x2f')]=_[_0x868a('0x30')](_0x5a237c,'name');_0x4a982d[_0x868a('0x31')]=_[_0x868a('0x32')](_0x42ae9e[_0x868a('0x31')]);_0x4a982d['filters']=_[_0x868a('0x33')](_0x4a982d[_0x868a('0x2f')],_0x4a982d['query']);_0x4cca34['attributes']=_['intersection'](_0x4a982d[_0x868a('0x2f')],qs[_0x868a('0x34')](_0x42ae9e['query'][_0x868a('0x34')]));_0x4cca34[_0x868a('0x35')]=_0x4cca34['attributes'][_0x868a('0x36')]?_0x4cca34[_0x868a('0x35')]:_0x4a982d['model'];if(!_0x42ae9e[_0x868a('0x31')][_0x868a('0x37')](_0x868a('0x38'))){_0x4cca34[_0x868a('0x1f')]=qs[_0x868a('0x1f')](_0x42ae9e['query']['limit']);_0x4cca34[_0x868a('0x1d')]=qs[_0x868a('0x1d')](_0x42ae9e[_0x868a('0x31')][_0x868a('0x1d')]);}_0x4cca34[_0x868a('0x39')]=qs['sort'](_0x42ae9e[_0x868a('0x31')][_0x868a('0x3a')]);_0x4cca34[_0x868a('0x3b')]=qs[_0x868a('0x3c')](_[_0x868a('0x3d')](_0x42ae9e[_0x868a('0x31')],_0x4a982d['filters']),_0x5a237c);if(_0x42ae9e[_0x868a('0x31')][_0x868a('0x3e')]){_0x4cca34['where']=_['merge'](_0x4cca34[_0x868a('0x3b')],{'$or':_['map'](_0x5a237c,function(_0x11f4c5){if(_0x11f4c5['type']!==_0x868a('0x3f')){var _0x275d51={};_0x275d51[_0x11f4c5['name']]={'$like':'%'+_0x42ae9e[_0x868a('0x31')]['filter']+'%'};return _0x275d51;}})});}_0x4cca34=_['merge']({},_0x4cca34,_0x42ae9e['options']);var _0x4f2686={'where':_0x4cca34[_0x868a('0x3b')]};return db[_0x868a('0x40')][_0x868a('0x20')](_0x4f2686)[_0x868a('0x24')](function(_0x22366b){_0x1a1c49[_0x868a('0x20')]=_0x22366b;if(_0x42ae9e[_0x868a('0x31')][_0x868a('0x41')]){_0x4cca34[_0x868a('0x42')]=[{'all':!![]}];}return db[_0x868a('0x40')][_0x868a('0x43')](_0x4cca34);})[_0x868a('0x24')](function(_0xc0cd43){_0x1a1c49['rows']=_0xc0cd43;return _0x1a1c49;})[_0x868a('0x24')](respondWithFilteredResult(_0x253135,_0x4cca34))[_0x868a('0x44')](handleError(_0x253135,null));};exports[_0x868a('0x45')]=function(_0x2723f1,_0x464999){var _0x1bd245={'raw':!![],'where':{'id':_0x2723f1[_0x868a('0x46')]['id']}},_0x134bd7={};_0x134bd7[_0x868a('0x2f')]=_['keys'](db[_0x868a('0x40')][_0x868a('0x2b')]);_0x134bd7[_0x868a('0x31')]=_[_0x868a('0x32')](_0x2723f1[_0x868a('0x31')]);_0x134bd7[_0x868a('0x3c')]=_[_0x868a('0x33')](_0x134bd7[_0x868a('0x2f')],_0x134bd7['query']);_0x1bd245['attributes']=_[_0x868a('0x33')](_0x134bd7[_0x868a('0x2f')],qs[_0x868a('0x34')](_0x2723f1[_0x868a('0x31')][_0x868a('0x34')]));_0x1bd245[_0x868a('0x35')]=_0x1bd245['attributes'][_0x868a('0x36')]?_0x1bd245[_0x868a('0x35')]:_0x134bd7[_0x868a('0x2f')];if(_0x2723f1['query'][_0x868a('0x41')]){_0x1bd245[_0x868a('0x42')]=[{'all':!![]}];}_0x1bd245=_[_0x868a('0x47')]({},_0x1bd245,_0x2723f1[_0x868a('0x48')]);return db[_0x868a('0x40')][_0x868a('0x49')](_0x1bd245)[_0x868a('0x24')](handleEntityNotFound(_0x464999,null))['then'](respondWithResult(_0x464999,null))[_0x868a('0x44')](handleError(_0x464999,null));};exports[_0x868a('0x4a')]=function(_0x1de27c,_0x494c0e){return db[_0x868a('0x40')][_0x868a('0x4a')](_0x1de27c['body'],{})['then'](respondWithResult(_0x494c0e,0xc9))[_0x868a('0x44')](handleError(_0x494c0e,null));};exports['update']=function(_0x3ef4a9,_0x16c711){if(_0x3ef4a9[_0x868a('0x4b')]['id']){delete _0x3ef4a9[_0x868a('0x4b')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x3ef4a9[_0x868a('0x46')]['id']}})['then'](handleEntityNotFound(_0x16c711,null))[_0x868a('0x24')](saveUpdates(_0x3ef4a9[_0x868a('0x4b')],null))['then'](respondWithResult(_0x16c711,null))[_0x868a('0x44')](handleError(_0x16c711,null));};exports[_0x868a('0x25')]=function(_0x3c273d,_0x106a8c){return db['FaxApplication'][_0x868a('0x49')]({'where':{'id':_0x3c273d['params']['id']}})[_0x868a('0x24')](handleEntityNotFound(_0x106a8c,null))['then'](removeEntity(_0x106a8c,null))['catch'](handleError(_0x106a8c,null));}; \ No newline at end of file +var _0x60af=['includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','map','FaxApplication','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type'];(function(_0x593af2,_0x382c41){var _0xa2a9bf=function(_0x5a8a0b){while(--_0x5a8a0b){_0x593af2['push'](_0x593af2['shift']());}};_0xa2a9bf(++_0x382c41);}(_0x60af,0x17c));var _0xf60a=function(_0x11ba32,_0x5a7ba6){_0x11ba32=_0x11ba32-0x0;var _0x296558=_0x60af[_0x11ba32];return _0x296558;};'use strict';var emlformat=require(_0xf60a('0x0'));var rimraf=require(_0xf60a('0x1'));var zipdir=require(_0xf60a('0x2'));var jsonpatch=require(_0xf60a('0x3'));var rp=require(_0xf60a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf60a('0x5'));var util=require('util');var path=require(_0xf60a('0x6'));var sox=require(_0xf60a('0x7'));var csv=require(_0xf60a('0x8'));var ejs=require(_0xf60a('0x9'));var fs=require('fs');var fs_extra=require(_0xf60a('0xa'));var _=require(_0xf60a('0xb'));var squel=require(_0xf60a('0xc'));var crypto=require(_0xf60a('0xd'));var jsforce=require(_0xf60a('0xe'));var deskjs=require(_0xf60a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf60a('0x10'));var Redis=require(_0xf60a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf60a('0x12'));var as=require(_0xf60a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf60a('0x14'))(_0xf60a('0x15'));var utils=require(_0xf60a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf60a('0x17'));var db=require(_0xf60a('0x18'))['db'];function respondWithStatusCode(_0x5ee02a,_0x222b69){_0x222b69=_0x222b69||0xcc;return function(_0x340c70){if(_0x340c70){return _0x5ee02a[_0xf60a('0x19')](_0x222b69);}return _0x5ee02a[_0xf60a('0x1a')](_0x222b69)[_0xf60a('0x1b')]();};}function respondWithResult(_0x56ac87,_0x3658b1){_0x3658b1=_0x3658b1||0xc8;return function(_0x11c91d){if(_0x11c91d){return _0x56ac87[_0xf60a('0x1a')](_0x3658b1)[_0xf60a('0x1c')](_0x11c91d);}};}function respondWithFilteredResult(_0x43e073,_0xd3fa91){return function(_0x3bda3a){if(_0x3bda3a){var _0x1668cd=typeof _0xd3fa91[_0xf60a('0x1d')]===_0xf60a('0x1e')&&typeof _0xd3fa91[_0xf60a('0x1f')]==='undefined';var _0x392780=_0x3bda3a['count'];var _0x1eb5cb=_0x1668cd?0x0:_0xd3fa91['offset'];var _0x598584=_0x1668cd?_0x3bda3a[_0xf60a('0x20')]:_0xd3fa91[_0xf60a('0x1d')]+_0xd3fa91[_0xf60a('0x1f')];var _0x390203;if(_0x598584>=_0x392780){_0x598584=_0x392780;_0x390203=0xc8;}else{_0x390203=0xce;}_0x43e073[_0xf60a('0x1a')](_0x390203);return _0x43e073['set'](_0xf60a('0x21'),_0x1eb5cb+'-'+_0x598584+'/'+_0x392780)['json'](_0x3bda3a);}return null;};}function patchUpdates(_0x43da05){return function(_0x551f0d){try{jsonpatch[_0xf60a('0x22')](_0x551f0d,_0x43da05,!![]);}catch(_0x4c2b64){return BPromise[_0xf60a('0x23')](_0x4c2b64);}return _0x551f0d[_0xf60a('0x24')]();};}function saveUpdates(_0x45f1ca,_0x343d7c){return function(_0x362aee){if(_0x362aee){return _0x362aee[_0xf60a('0x25')](_0x45f1ca)['then'](function(_0xc6a413){return _0xc6a413;});}return null;};}function removeEntity(_0x538cfa,_0x1acafb){return function(_0x16eacd){if(_0x16eacd){return _0x16eacd[_0xf60a('0x26')]()[_0xf60a('0x27')](function(){_0x538cfa[_0xf60a('0x1a')](0xcc)[_0xf60a('0x1b')]();});}};}function handleEntityNotFound(_0x433e3b,_0x5053b1){return function(_0x4916a4){if(!_0x4916a4){_0x433e3b['sendStatus'](0x194);}return _0x4916a4;};}function handleError(_0x4ee134,_0x2aa76e){_0x2aa76e=_0x2aa76e||0x1f4;return function(_0x789323){logger['error'](_0x789323[_0xf60a('0x28')]);if(_0x789323[_0xf60a('0x29')]){delete _0x789323[_0xf60a('0x29')];}_0x4ee134[_0xf60a('0x1a')](_0x2aa76e)['send'](_0x789323);};}exports[_0xf60a('0x2a')]=function(_0x35c739,_0x5010dd){var _0x396263={},_0x8e4dec={},_0x33810f={'count':0x0,'rows':[]};var _0x3ea35a=_[_0xf60a('0x2b')](db[_0xf60a('0x2c')][_0xf60a('0x2d')],function(_0x1c40b4){return{'name':_0x1c40b4['fieldName'],'type':_0x1c40b4['type'][_0xf60a('0x2e')]};});_0x8e4dec[_0xf60a('0x2f')]=_['map'](_0x3ea35a,_0xf60a('0x29'));_0x8e4dec[_0xf60a('0x30')]=_[_0xf60a('0x31')](_0x35c739['query']);_0x8e4dec[_0xf60a('0x32')]=_['intersection'](_0x8e4dec[_0xf60a('0x2f')],_0x8e4dec[_0xf60a('0x30')]);_0x396263[_0xf60a('0x33')]=_[_0xf60a('0x34')](_0x8e4dec[_0xf60a('0x2f')],qs['fields'](_0x35c739[_0xf60a('0x30')][_0xf60a('0x35')]));_0x396263[_0xf60a('0x33')]=_0x396263['attributes'][_0xf60a('0x36')]?_0x396263['attributes']:_0x8e4dec[_0xf60a('0x2f')];if(!_0x35c739[_0xf60a('0x30')][_0xf60a('0x37')](_0xf60a('0x38'))){_0x396263[_0xf60a('0x1f')]=qs['limit'](_0x35c739['query'][_0xf60a('0x1f')]);_0x396263[_0xf60a('0x1d')]=qs['offset'](_0x35c739[_0xf60a('0x30')][_0xf60a('0x1d')]);}_0x396263[_0xf60a('0x39')]=qs[_0xf60a('0x3a')](_0x35c739[_0xf60a('0x30')]['sort']);_0x396263['where']=qs[_0xf60a('0x32')](_[_0xf60a('0x3b')](_0x35c739[_0xf60a('0x30')],_0x8e4dec[_0xf60a('0x32')]),_0x3ea35a);if(_0x35c739[_0xf60a('0x30')][_0xf60a('0x3c')]){_0x396263[_0xf60a('0x3d')]=_[_0xf60a('0x3e')](_0x396263[_0xf60a('0x3d')],{'$or':_['map'](_0x3ea35a,function(_0x26511c){if(_0x26511c[_0xf60a('0x3f')]!=='VIRTUAL'){var _0x3901dd={};_0x3901dd[_0x26511c[_0xf60a('0x29')]]={'$like':'%'+_0x35c739[_0xf60a('0x30')][_0xf60a('0x3c')]+'%'};return _0x3901dd;}})});}_0x396263=_[_0xf60a('0x3e')]({},_0x396263,_0x35c739['options']);var _0x59addd={'where':_0x396263[_0xf60a('0x3d')]};return db[_0xf60a('0x2c')][_0xf60a('0x20')](_0x59addd)[_0xf60a('0x27')](function(_0x1f38a5){_0x33810f['count']=_0x1f38a5;if(_0x35c739[_0xf60a('0x30')][_0xf60a('0x40')]){_0x396263[_0xf60a('0x41')]=[{'all':!![]}];}return db[_0xf60a('0x2c')][_0xf60a('0x42')](_0x396263);})[_0xf60a('0x27')](function(_0x55a8ad){_0x33810f['rows']=_0x55a8ad;return _0x33810f;})['then'](respondWithFilteredResult(_0x5010dd,_0x396263))[_0xf60a('0x43')](handleError(_0x5010dd,null));};exports[_0xf60a('0x44')]=function(_0x41f91a,_0x1d3710){var _0x52d98a={'raw':!![],'where':{'id':_0x41f91a[_0xf60a('0x45')]['id']}},_0x1bdf60={};_0x1bdf60[_0xf60a('0x2f')]=_['keys'](db[_0xf60a('0x2c')][_0xf60a('0x2d')]);_0x1bdf60['query']=_[_0xf60a('0x31')](_0x41f91a['query']);_0x1bdf60['filters']=_[_0xf60a('0x34')](_0x1bdf60['model'],_0x1bdf60[_0xf60a('0x30')]);_0x52d98a[_0xf60a('0x33')]=_[_0xf60a('0x34')](_0x1bdf60[_0xf60a('0x2f')],qs[_0xf60a('0x35')](_0x41f91a['query'][_0xf60a('0x35')]));_0x52d98a[_0xf60a('0x33')]=_0x52d98a[_0xf60a('0x33')][_0xf60a('0x36')]?_0x52d98a[_0xf60a('0x33')]:_0x1bdf60[_0xf60a('0x2f')];if(_0x41f91a['query'][_0xf60a('0x40')]){_0x52d98a[_0xf60a('0x41')]=[{'all':!![]}];}_0x52d98a=_[_0xf60a('0x3e')]({},_0x52d98a,_0x41f91a[_0xf60a('0x46')]);return db['FaxApplication'][_0xf60a('0x47')](_0x52d98a)[_0xf60a('0x27')](handleEntityNotFound(_0x1d3710,null))[_0xf60a('0x27')](respondWithResult(_0x1d3710,null))[_0xf60a('0x43')](handleError(_0x1d3710,null));};exports[_0xf60a('0x48')]=function(_0x1e5017,_0x91b912){return db[_0xf60a('0x2c')][_0xf60a('0x48')](_0x1e5017[_0xf60a('0x49')],{})[_0xf60a('0x27')](respondWithResult(_0x91b912,0xc9))['catch'](handleError(_0x91b912,null));};exports['update']=function(_0x5115f5,_0x5e0f06){if(_0x5115f5[_0xf60a('0x49')]['id']){delete _0x5115f5[_0xf60a('0x49')]['id'];}return db[_0xf60a('0x2c')]['find']({'where':{'id':_0x5115f5[_0xf60a('0x45')]['id']}})[_0xf60a('0x27')](handleEntityNotFound(_0x5e0f06,null))['then'](saveUpdates(_0x5115f5['body'],null))[_0xf60a('0x27')](respondWithResult(_0x5e0f06,null))[_0xf60a('0x43')](handleError(_0x5e0f06,null));};exports['destroy']=function(_0x12746a,_0x5c796e){return db['FaxApplication']['find']({'where':{'id':_0x12746a[_0xf60a('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c796e,null))[_0xf60a('0x27')](removeEntity(_0x5c796e,null))[_0xf60a('0x43')](handleError(_0x5c796e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 66aee06..abe7d28 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 _0x5f7c=['utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','FaxApplication','utf8mb4'];(function(_0x2643b1,_0x210c28){var _0xda76fa=function(_0x5c88e2){while(--_0x5c88e2){_0x2643b1['push'](_0x2643b1['shift']());}};_0xda76fa(++_0x210c28);}(_0x5f7c,0x14b));var _0xc5f7=function(_0x59d803,_0x37c890){_0x59d803=_0x59d803-0x0;var _0x134562=_0x5f7c[_0x59d803];return _0x134562;};'use strict';var _=require('lodash');var util=require(_0xc5f7('0x0'));var logger=require('../../config/logger')(_0xc5f7('0x1'));var moment=require(_0xc5f7('0x2'));var BPromise=require(_0xc5f7('0x3'));var rp=require(_0xc5f7('0x4'));var fs=require('fs');var path=require(_0xc5f7('0x5'));var rimraf=require(_0xc5f7('0x6'));var config=require('../../config/environment');var attributes=require(_0xc5f7('0x7'));module['exports']=function(_0x55bebb,_0x907f04){return _0x55bebb['define'](_0xc5f7('0x8'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc5f7('0x9'),'collate':_0xc5f7('0xa')});}; \ No newline at end of file +var _0xc879=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x5e8965,_0x744744){var _0x5efd03=function(_0xc82aa1){while(--_0xc82aa1){_0x5e8965['push'](_0x5e8965['shift']());}};_0x5efd03(++_0x744744);}(_0xc879,0xa2));var _0x9c87=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc879[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9c87('0x0'));var logger=require(_0x9c87('0x1'))(_0x9c87('0x2'));var moment=require(_0x9c87('0x3'));var BPromise=require(_0x9c87('0x4'));var rp=require(_0x9c87('0x5'));var fs=require('fs');var path=require(_0x9c87('0x6'));var rimraf=require(_0x9c87('0x7'));var config=require(_0x9c87('0x8'));var attributes=require('./faxApplication.attributes');module[_0x9c87('0x9')]=function(_0x52871d,_0x1ecd75){return _0x52871d[_0x9c87('0xa')](_0x9c87('0xb'),attributes,{'tableName':_0x9c87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9c87('0xd'),'collate':_0x9c87('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 3c3c77e..0259dd6 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 _0xf2ad=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xf2ad,0x1f2));var _0xdf2a=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xf2ad[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0xdf2a('0x0'));var util=require('util');var moment=require(_0xdf2a('0x1'));var BPromise=require(_0xdf2a('0x2'));var rs=require(_0xdf2a('0x3'));var fs=require('fs');var Redis=require(_0xdf2a('0x4'));var db=require(_0xdf2a('0x5'))['db'];var utils=require(_0xdf2a('0x6'));var logger=require(_0xdf2a('0x7'))(_0xdf2a('0x8'));var config=require(_0xdf2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdf2a('0xa')][_0xdf2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x116daa,_0x2ee072,_0x4969b2){return new BPromise(function(_0x4bf949,_0x5b24fc){return client[_0xdf2a('0xc')](_0x116daa,_0x4969b2)[_0xdf2a('0xd')](function(_0x34803f){logger[_0xdf2a('0xe')](_0xdf2a('0xf'),_0x2ee072,_0xdf2a('0x10'));logger[_0xdf2a('0x11')](_0xdf2a('0x12'),_0x2ee072,_0xdf2a('0x10'),JSON[_0xdf2a('0x13')](_0x34803f));if(_0x34803f[_0xdf2a('0x14')]){if(_0x34803f[_0xdf2a('0x14')][_0xdf2a('0x15')]===0x1f4){logger['error'](_0xdf2a('0xf'),_0x2ee072,_0x34803f[_0xdf2a('0x14')][_0xdf2a('0x16')]);return _0x5b24fc(_0x34803f[_0xdf2a('0x14')][_0xdf2a('0x16')]);}logger['error'](_0xdf2a('0xf'),_0x2ee072,_0x34803f[_0xdf2a('0x14')]['message']);return _0x4bf949(_0x34803f[_0xdf2a('0x14')][_0xdf2a('0x16')]);}else{logger[_0xdf2a('0xe')](_0xdf2a('0xf'),_0x2ee072,_0xdf2a('0x10'));_0x4bf949(_0x34803f[_0xdf2a('0x17')][_0xdf2a('0x16')]);}})[_0xdf2a('0x18')](function(_0x9cfc36){logger[_0xdf2a('0x14')](_0xdf2a('0xf'),_0x2ee072,_0x9cfc36);_0x5b24fc(_0x9cfc36);});});}exports[_0xdf2a('0x19')]=function(_0x565062){var _0x851dbc=this;return new Promise(function(_0x3b5e4a,_0xe568a4){return db[_0xdf2a('0x1a')][_0xdf2a('0x1b')](_0x565062['body'],{'raw':_0x565062[_0xdf2a('0x1c')]?_0x565062[_0xdf2a('0x1c')][_0xdf2a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565062[_0xdf2a('0x1c')]?_0x565062[_0xdf2a('0x1c')][_0xdf2a('0x1e')]||null:null,'attributes':_0x565062['options']?_0x565062[_0xdf2a('0x1c')]['attributes']||null:null,'limit':_0x565062['options']?_0x565062[_0xdf2a('0x1c')][_0xdf2a('0x1f')]||null:null})[_0xdf2a('0xd')](function(_0x5d120e){logger[_0xdf2a('0xe')](_0xdf2a('0x19'),_0x565062);logger[_0xdf2a('0x11')](_0xdf2a('0x19'),_0x565062,JSON['stringify'](_0x5d120e));_0x3b5e4a(_0x5d120e);})[_0xdf2a('0x18')](function(_0x5f38d8){logger[_0xdf2a('0x14')](_0xdf2a('0x19'),_0x5f38d8[_0xdf2a('0x16')],_0x565062);_0xe568a4(_0x851dbc[_0xdf2a('0x14')](0x1f4,_0x5f38d8[_0xdf2a('0x16')]));});});}; \ No newline at end of file +var _0x06da=['randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','attributes','then','moment'];(function(_0x1e40df,_0x18b1a5){var _0x4bfb7b=function(_0x3d5ca4){while(--_0x3d5ca4){_0x1e40df['push'](_0x1e40df['shift']());}};_0x4bfb7b(++_0x18b1a5);}(_0x06da,0x8f));var _0xa06d=function(_0x19a5ae,_0x43123e){_0x19a5ae=_0x19a5ae-0x0;var _0x2dc32a=_0x06da[_0x19a5ae];return _0x2dc32a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa06d('0x0'));var BPromise=require('bluebird');var rs=require(_0xa06d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa06d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa06d('0x3'))('rpc');var config=require(_0xa06d('0x4'));var jayson=require(_0xa06d('0x5'));var client=jayson[_0xa06d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3abe3f,_0x33f7b8,_0x21f2d4){return new BPromise(function(_0x25d5cb,_0x1b2f60){return client[_0xa06d('0x7')](_0x3abe3f,_0x21f2d4)['then'](function(_0x23149b){logger[_0xa06d('0x8')]('FaxApplication,\x20%s,\x20%s',_0x33f7b8,_0xa06d('0x9'));logger[_0xa06d('0xa')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x33f7b8,_0xa06d('0x9'),JSON[_0xa06d('0xb')](_0x23149b));if(_0x23149b[_0xa06d('0xc')]){if(_0x23149b[_0xa06d('0xc')]['code']===0x1f4){logger[_0xa06d('0xc')](_0xa06d('0xd'),_0x33f7b8,_0x23149b[_0xa06d('0xc')][_0xa06d('0xe')]);return _0x1b2f60(_0x23149b[_0xa06d('0xc')]['message']);}logger[_0xa06d('0xc')]('FaxApplication,\x20%s,\x20%s',_0x33f7b8,_0x23149b[_0xa06d('0xc')][_0xa06d('0xe')]);return _0x25d5cb(_0x23149b[_0xa06d('0xc')][_0xa06d('0xe')]);}else{logger[_0xa06d('0x8')](_0xa06d('0xd'),_0x33f7b8,_0xa06d('0x9'));_0x25d5cb(_0x23149b[_0xa06d('0xf')][_0xa06d('0xe')]);}})[_0xa06d('0x10')](function(_0xee559e){logger['error'](_0xa06d('0xd'),_0x33f7b8,_0xee559e);_0x1b2f60(_0xee559e);});});}exports[_0xa06d('0x11')]=function(_0x1cdc8d){var _0x2424de=this;return new Promise(function(_0x5c9738,_0xc78abc){return db[_0xa06d('0x12')][_0xa06d('0x13')](_0x1cdc8d[_0xa06d('0x14')],{'raw':_0x1cdc8d[_0xa06d('0x15')]?_0x1cdc8d[_0xa06d('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cdc8d[_0xa06d('0x15')]?_0x1cdc8d['options']['where']||null:null,'attributes':_0x1cdc8d[_0xa06d('0x15')]?_0x1cdc8d['options'][_0xa06d('0x16')]||null:null,'limit':_0x1cdc8d[_0xa06d('0x15')]?_0x1cdc8d[_0xa06d('0x15')]['limit']||null:null})[_0xa06d('0x17')](function(_0x22e57d){logger[_0xa06d('0x8')](_0xa06d('0x11'),_0x1cdc8d);logger['debug']('UpdateFaxApplication',_0x1cdc8d,JSON[_0xa06d('0xb')](_0x22e57d));_0x5c9738(_0x22e57d);})[_0xa06d('0x10')](function(_0x15c669){logger[_0xa06d('0xc')](_0xa06d('0x11'),_0x15c669['message'],_0x1cdc8d);_0xc78abc(_0x2424de[_0xa06d('0xc')](0x1f4,_0x15c669[_0xa06d('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1421e95..362c708 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 _0x1eba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0xc492a3,_0x2b42ee){var _0x414593=function(_0x4489ad){while(--_0x4489ad){_0xc492a3['push'](_0xc492a3['shift']());}};_0x414593(++_0x2b42ee);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x1eba[_0x590b63];return _0x3c9380;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0xf')]);router['put'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router['delete'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x11')]);module[_0xa1eb('0x12')]=router; \ No newline at end of file +var _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1871f4,_0x2659db){var _0x36f5cb=function(_0x4d946f){while(--_0x4d946f){_0x1871f4['push'](_0x1871f4['shift']());}};_0x36f5cb(++_0x2659db);}(_0xb62e,0x1de));var _0xeb62=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb62e[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e251710..028d947 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 _0xbe0f=['ENUM','out','sequelize','DATE','STRING'];(function(_0x4e26d7,_0x4fa8ca){var _0x2a12df=function(_0x1119e9){while(--_0x1119e9){_0x4e26d7['push'](_0x4e26d7['shift']());}};_0x2a12df(++_0x4fa8ca);}(_0xbe0f,0x17e));var _0xfbe0=function(_0x11345e,_0x4e243a){_0x11345e=_0x11345e-0x0;var _0x40ac8c=_0xbe0f[_0x11345e];return _0x40ac8c;};'use strict';var Sequelize=require(_0xfbe0('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfbe0('0x1')]},'disposition':{'type':Sequelize[_0xfbe0('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfbe0('0x2')]},'read1stAt':{'type':Sequelize[_0xfbe0('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xfbe0('0x3')]('in',_0xfbe0('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfbe0('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xfbe0('0x3')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb43c=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x2ba477,_0x2bc734){var _0x8429f=function(_0x209aa2){while(--_0x209aa2){_0x2ba477['push'](_0x2ba477['shift']());}};_0x8429f(++_0x2bc734);}(_0xb43c,0x191));var _0xcb43=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb43c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xcb43('0x0'));module[_0xcb43('0x1')]={'closed':{'type':Sequelize[_0xcb43('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb43('0x3')]},'disposition':{'type':Sequelize[_0xcb43('0x4')]},'secondDisposition':{'type':Sequelize[_0xcb43('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcb43('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xcb43('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcb43('0x5')]('in',_0xcb43('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 308a090..e2794e1 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 _0x804c=['`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','compact','isEmpty','FaxAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','FaxInteraction','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','catch','show','params','includeAll','options','create','body','describe','addMessage','omit','getMessages','findOne','FaxMessage','format','include','findAll','addTags','spread','faxInteractionTags:save','removeTags','ids','download','root','server','files','tmp','join','push','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','status','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','end','sendStatus','name','send','Users','map','fullname','TagIds','Tags','split','forEach','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','users','o.id\x20=\x20i.UserId','fax_accounts','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having'];(function(_0x47402f,_0x450e6c){var _0x2daf70=function(_0x1e51ca){while(--_0x1e51ca){_0x47402f['push'](_0x47402f['shift']());}};_0x2daf70(++_0x450e6c);}(_0x804c,0x71));var _0xc804=function(_0x5f5d15,_0xa77655){_0x5f5d15=_0x5f5d15-0x0;var _0x51e714=_0x804c[_0x5f5d15];return _0x51e714;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc804('0x0'));var zipdir=require(_0xc804('0x1'));var jsonpatch=require(_0xc804('0x2'));var rp=require(_0xc804('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc804('0x4'));var util=require(_0xc804('0x5'));var path=require(_0xc804('0x6'));var sox=require('sox');var csv=require(_0xc804('0x7'));var ejs=require(_0xc804('0x8'));var fs=require('fs');var fs_extra=require(_0xc804('0x9'));var _=require(_0xc804('0xa'));var squel=require('squel');var crypto=require(_0xc804('0xb'));var jsforce=require(_0xc804('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc804('0xd'));var Redis=require(_0xc804('0xe'));var authService=require(_0xc804('0xf'));var qs=require(_0xc804('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc804('0x11'));var logger=require(_0xc804('0x12'))(_0xc804('0x13'));var utils=require(_0xc804('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc804('0x15'));var db=require(_0xc804('0x16'))['db'];config[_0xc804('0x17')]=_[_0xc804('0x18')](config[_0xc804('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0xc804('0x19')](socket);function respondWithStatusCode(_0x27e9d9,_0x24b8de){_0x24b8de=_0x24b8de||0xcc;return function(_0x3e0347){if(_0x3e0347){return _0x27e9d9['sendStatus'](_0x24b8de);}return _0x27e9d9[_0xc804('0x1a')](_0x24b8de)['end']();};}function respondWithResult(_0x4375d1,_0x28a2cb){_0x28a2cb=_0x28a2cb||0xc8;return function(_0x22d985){if(_0x22d985){return _0x4375d1[_0xc804('0x1a')](_0x28a2cb)['json'](_0x22d985);}};}function respondWithFilteredResult(_0x1209a0,_0x142b0d){return function(_0x619a83){if(_0x619a83){var _0x3fdb77=typeof _0x142b0d[_0xc804('0x1b')]===_0xc804('0x1c')&&typeof _0x142b0d['limit']===_0xc804('0x1c');var _0x283e40=_0x619a83[_0xc804('0x1d')];var _0x279eb8=_0x3fdb77?0x0:_0x142b0d[_0xc804('0x1b')];var _0x432e90=_0x3fdb77?_0x619a83[_0xc804('0x1d')]:_0x142b0d[_0xc804('0x1b')]+_0x142b0d['limit'];var _0xea510f;if(_0x432e90>=_0x283e40){_0x432e90=_0x283e40;_0xea510f=0xc8;}else{_0xea510f=0xce;}_0x1209a0['status'](_0xea510f);return _0x1209a0[_0xc804('0x1e')](_0xc804('0x1f'),_0x279eb8+'-'+_0x432e90+'/'+_0x283e40)['json'](_0x619a83);}return null;};}function patchUpdates(_0x314a52){return function(_0x1fb664){try{jsonpatch[_0xc804('0x20')](_0x1fb664,_0x314a52,!![]);}catch(_0x5f5ca9){return BPromise[_0xc804('0x21')](_0x5f5ca9);}return _0x1fb664['save']();};}function saveUpdates(_0x748d35,_0x12ba3b){return function(_0x469990){if(_0x469990){return _0x469990['update'](_0x748d35)[_0xc804('0x22')](function(_0x5c5613){return _0x5c5613;});}return null;};}function removeEntity(_0x1765cd,_0x4d544e){return function(_0x105025){if(_0x105025){return _0x105025[_0xc804('0x23')]()[_0xc804('0x22')](function(){_0x1765cd['status'](0xcc)[_0xc804('0x24')]();});}};}function handleEntityNotFound(_0x1fc260,_0x23f8ac){return function(_0x52cc1b){if(!_0x52cc1b){_0x1fc260[_0xc804('0x25')](0x194);}return _0x52cc1b;};}function handleError(_0x1fda5f,_0x48f564){_0x48f564=_0x48f564||0x1f4;return function(_0x38fc53){logger['error'](_0x38fc53['stack']);if(_0x38fc53[_0xc804('0x26')]){delete _0x38fc53[_0xc804('0x26')];}_0x1fda5f[_0xc804('0x1a')](_0x48f564)[_0xc804('0x27')](_0x38fc53);};}function getInteractionUsers(_0x1eed09,_0x4470d8){return new BPromise(function(_0x3bf4f6,_0x131236){try{if(_0x4470d8[_0x1eed09['id']]){_0x1eed09[_0xc804('0x28')]=_[_0xc804('0x29')](_0x4470d8[_0x1eed09['id']],function(_0x5b6200){return{'id':_0x5b6200['id'],'fullname':_0x5b6200[_0xc804('0x2a')]};});}}catch(_0x2cabeb){_0x131236(_0x2cabeb);}_0x3bf4f6(_0x1eed09);});}function getInteractionTags(_0x1e4019,_0x9b3e47){return new BPromise(function(_0x5e9743,_0x339ecd){try{if(_0x1e4019[_0xc804('0x2b')]){_0x1e4019[_0xc804('0x2c')]=[];_0x1e4019[_0xc804('0x2b')][_0xc804('0x2d')](',')[_0xc804('0x2e')](function(_0x2535f4){_0x1e4019[_0xc804('0x2c')]['push'](_0x9b3e47[_0x2535f4]);});}delete _0x1e4019[_0xc804('0x2b')];}catch(_0x3744c7){_0x339ecd(_0x3744c7);}_0x5e9743(_0x1e4019);});}function updateFaxInteraction(_0x3f178b,_0x509c96,_0x2db394){return new BPromise(function(_0x1decea,_0x3ede81){return getInteractionUsers(_0x3f178b,_0x2db394)[_0xc804('0x22')](function(_0x1b8805){return getInteractionTags(_0x1b8805,_0x509c96);})['then'](function(_0x25069b){_0x1decea(_0x25069b);})['catch'](function(_0x18c96c){_0x3ede81(_0x18c96c);});});}exports[_0xc804('0x2f')]=function(_0x327fad,_0x9f26be){var _0x20d210={},_0x759728={},_0x3ce8df={'count':0x0,'rows':[]};var _0x124955=_[_0xc804('0x29')](db['FaxInteraction'][_0xc804('0x30')],function(_0x43b427){return{'name':_0x43b427[_0xc804('0x31')],'type':_0x43b427[_0xc804('0x32')][_0xc804('0x33')]};});_0x759728[_0xc804('0x34')]=_['map'](_0x124955,_0xc804('0x26'));_0x759728[_0xc804('0x35')]=_[_0xc804('0x36')](_0x327fad['query']);_0x759728[_0xc804('0x37')]=_[_0xc804('0x38')](_0x759728[_0xc804('0x34')],_0x759728[_0xc804('0x35')]);_0x20d210[_0xc804('0x39')]=_['intersection'](_0x759728[_0xc804('0x34')],qs[_0xc804('0x3a')](_0x327fad[_0xc804('0x35')]['fields']));_0x20d210[_0xc804('0x39')]=_0x20d210[_0xc804('0x39')]['length']?_0x20d210[_0xc804('0x39')]:_0x759728[_0xc804('0x34')];if(!_0x327fad[_0xc804('0x35')][_0xc804('0x3b')](_0xc804('0x3c'))){_0x20d210[_0xc804('0x3d')]=qs[_0xc804('0x3d')](_0x327fad[_0xc804('0x35')][_0xc804('0x3d')]);_0x20d210[_0xc804('0x1b')]=qs[_0xc804('0x1b')](_0x327fad[_0xc804('0x35')]['offset']);}_0x20d210[_0xc804('0x3e')]=qs[_0xc804('0x3f')](_0x327fad[_0xc804('0x35')]['sort']);_0x20d210[_0xc804('0x40')]=qs[_0xc804('0x37')](_[_0xc804('0x41')](_0x327fad[_0xc804('0x35')],_0x759728[_0xc804('0x37')]),_0x124955);var _0x316eb6=[];var _0x3f880b=squel[_0xc804('0x42')]()[_0xc804('0x43')]('id')[_0xc804('0x43')](_0xc804('0x26'))[_0xc804('0x43')]('color')[_0xc804('0x44')](_0xc804('0x45'));var _0x1fc587=squel[_0xc804('0x42')]()[_0xc804('0x43')](_0xc804('0x46'))[_0xc804('0x43')](_0xc804('0x47'))['field'](_0xc804('0x48'))[_0xc804('0x44')](_0xc804('0x49'),'ui')[_0xc804('0x4a')]('users','u',_0xc804('0x4b'));var _0x2b8cc=squel[_0xc804('0x42')]()[_0xc804('0x44')]('fax_interactions','i')['left_join'](_0xc804('0x4c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc804('0x4a')](_0xc804('0x4d'),'o',_0xc804('0x4e'))[_0xc804('0x4a')](_0xc804('0x4f'),'a','a.id\x20=\x20i.FaxAccountId')[_0xc804('0x4a')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0xc804('0x4a')](_0xc804('0x50'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xc804('0x4a')](_0xc804('0x45'),'t',_0xc804('0x51'));var _0x1e2308=squel[_0xc804('0x52')]();var _0x5c09fa=[];var _0x4bc5a4=squel[_0xc804('0x52')]();var _0x423db5;if(_0x327fad[_0xc804('0x35')][_0xc804('0x53')]){_0x423db5=as[_0xc804('0x54')](_0x327fad[_0xc804('0x35')][_0xc804('0x53')]);var _0x3b0507=_0x423db5[_0xc804('0x55')];for(var _0x339cc7=0x0;_0x339cc7<_0x423db5[_0xc804('0x56')][_0xc804('0x57')];_0x339cc7++){var _0x5a777b=_0x423db5['conditions'][_0x339cc7];var _0x266e40='i';var _0x346152=_[_0xc804('0x58')](_0x124955,['name',_0x5a777b[_0xc804('0x43')]]);if(!_0x346152){switch(_0x5a777b[_0xc804('0x43')]){case _0xc804('0x59'):if(_0x5a777b[_0xc804('0x5a')]==0x1){_0x2b8cc[_0xc804('0x5b')]('`'+_0x5a777b[_0xc804('0x43')]+_0xc804('0x5c'));}else{_0x2b8cc[_0xc804('0x5b')]('`'+_0x5a777b[_0xc804('0x43')]+_0xc804('0x5d'));}break;case _0xc804('0x5e'):if(_0x5a777b[_0xc804('0x5f')]===_0xc804('0x60')){if(_0x5a777b['value']['split']('\x20')[_0xc804('0x57')]>0x1){_0x1e2308[_0x3b0507](_0xc804('0x61'),qs[_0xc804('0x62')](_0x5a777b[_0xc804('0x5a')]),null);}else{var _0x12f148='%'+_0x5a777b[_0xc804('0x5a')]+'%';_0x1e2308[_0x3b0507](_0xc804('0x63'),_0x12f148,_0x12f148,_0x12f148);}}else{_0x346152=_['find'](_0x124955,[_0xc804('0x26'),_0xc804('0x64')]);_0x5a777b[_0xc804('0x43')]=_0xc804('0x64');_0x470960=as[_0xc804('0x65')](_0x266e40,_0x346152[_0xc804('0x32')],_0x5a777b);_0x1e2308[_0x3b0507](_0x470960[_0xc804('0x66')],_0x470960['value'][_0xc804('0x67')],_0x470960[_0xc804('0x5a')][_0xc804('0x24')]);}break;case _0xc804('0x68'):var _0x46dbb0=_0x5a777b['value'][_0xc804('0x2d')](',')[_0xc804('0x29')](function(_0x3d6be8){return Number(_0x3d6be8);});_0x46dbb0[_0xc804('0x2e')](function(_0x1bc93a){_0x4bc5a4['or'](_0xc804('0x69'),'%,'+_0x1bc93a+',%');});_0x5c09fa=_['union'](_0x5c09fa,_0x46dbb0);break;case'User':if(_0x5a777b[_0xc804('0x5f')]===_0xc804('0x60')){_0x1e2308[_0x3b0507](_0xc804('0x6a'),'%'+_0x5a777b[_0xc804('0x5a')]+'%',null);}else{_0x346152=_['find'](_0x124955,[_0xc804('0x26'),'UserId']);_0x5a777b[_0xc804('0x43')]=_0xc804('0x6b');_0x470960=as[_0xc804('0x65')](_0x266e40,_0x346152[_0xc804('0x32')],_0x5a777b);_0x1e2308[_0x3b0507](_0x470960[_0xc804('0x66')],_0x470960[_0xc804('0x5a')][_0xc804('0x67')],_0x470960['value'][_0xc804('0x24')]);}break;case'body':_0x470960=as[_0xc804('0x65')]('me',null,_0x5a777b);_0x1e2308[_0x3b0507](_0x470960[_0xc804('0x66')],_0x470960['value'][_0xc804('0x67')],_0x470960[_0xc804('0x5a')]['end']);break;}}else{var _0x470960=as[_0xc804('0x65')](_0x266e40,_0x346152['type'],_0x5a777b);_0x1e2308[_0x3b0507](_0x470960[_0xc804('0x66')],_0x470960[_0xc804('0x5a')]['start'],_0x470960[_0xc804('0x5a')][_0xc804('0x24')]);}}}else{var _0x4edd01=_(_0x327fad[_0xc804('0x35')])['keys']()[_0xc804('0x29')](function(_0x150c8a){return _['some'](_0x124955,[_0xc804('0x26'),_0x150c8a])?_0x150c8a:undefined;})[_0xc804('0x6c')]()[_0xc804('0x5a')]();if(!_[_0xc804('0x6d')](_0x4edd01)){_0x4edd01['forEach'](function(_0x53ac40){if(_0x53ac40===_0xc804('0x6e')){_0x2b8cc[_0xc804('0x40')]('i.FaxAccountId\x20IN\x20?',[][_0xc804('0x6f')](_0x327fad[_0xc804('0x35')][_0x53ac40]));}else if(_0x53ac40===_0xc804('0x70')){var _0x31e7ad=JSON[_0xc804('0x71')](_0x327fad[_0xc804('0x35')][_0x53ac40])[_0xc804('0x72')];var _0x312176=JSON[_0xc804('0x71')](_0x327fad[_0xc804('0x35')][_0x53ac40])[_0xc804('0x73')];_0x2b8cc[_0xc804('0x40')](_0xc804('0x74'),_0x31e7ad,_0x312176);}else{if(_0x327fad[_0xc804('0x35')][_0x53ac40]===_0xc804('0x75')){_0x2b8cc[_0xc804('0x40')]('i.'+_0x53ac40+'\x20IS\x20NULL');}else{_0x2b8cc['where']('i.'+_0x53ac40+'\x20=\x20?',_0x327fad[_0xc804('0x35')][_0x53ac40]);}}});}if(_0x327fad[_0xc804('0x35')][_0xc804('0x76')]){if(_0x327fad[_0xc804('0x35')]['read']==0x1){_0x2b8cc[_0xc804('0x5b')](_0xc804('0x77'));}else{_0x2b8cc[_0xc804('0x5b')](_0xc804('0x78'));}}if(_0x327fad[_0xc804('0x35')][_0xc804('0x79')]){_0x5c09fa=_['isArray'](_0x327fad[_0xc804('0x35')][_0xc804('0x79')])?_0x327fad['query'][_0xc804('0x79')]:new Array(_0x327fad[_0xc804('0x35')][_0xc804('0x79')]);_0x5c09fa[_0xc804('0x2e')](function(_0x541f7e){_0x4bc5a4['or'](_0xc804('0x69'),'%,'+_0x541f7e+',%');});}if(_0x327fad[_0xc804('0x35')][_0xc804('0x7a')]){var _0x243fea=_0x327fad['query'][_0xc804('0x7a')][_0xc804('0x7b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc804('0x7c')](_0x243fea)){_0x1e2308['or'](_0xc804('0x7d'),_0x243fea+'%')['or']('i.fax\x20LIKE\x20?',_0x243fea+'%');}_0x1e2308['or'](_0xc804('0x7e'),_0x243fea+'%');}}_0x2b8cc[_0xc804('0x40')](_0x1e2308);_0x2b8cc['group'](_0xc804('0x7f'));var _0x9e8e52={'type':db[_0xc804('0x80')][_0xc804('0x81')][_0xc804('0x82')],'raw':!![]};var _0x33722f=_0x2b8cc[_0xc804('0x83')]();_0x33722f[_0xc804('0x43')](_0xc804('0x7f'));_0x33722f[_0xc804('0x43')](_0xc804('0x84'),_0xc804('0x59'));if(_0x20d210[_0xc804('0x3e')]){_0x20d210[_0xc804('0x3e')][_0xc804('0x2e')](function(_0x5acdf7){var _0x2c789a=_0x5acdf7[0x0]===_0xc804('0x85')?_0x5acdf7[0x0]:'i.'+_0x5acdf7[0x0];_0x2b8cc['order'](_0x2c789a,_0x5acdf7[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc804('0x6d')](_0x5c09fa)){_0x2b8cc[_0xc804('0x5b')](_0x4bc5a4);_0x33722f[_0xc804('0x40')]('t.id\x20IN\x20?',_0x5c09fa);}BPromise[_0xc804('0x86')]()[_0xc804('0x22')](function(){if(!_0x423db5){if(_0x327fad[_0xc804('0x35')][_0xc804('0x6e')])return;_0x33722f[_0xc804('0x40')](_0xc804('0x87'));_0x2b8cc[_0xc804('0x40')](_0xc804('0x87'));return;}if(_0x327fad[_0xc804('0x88')][_0xc804('0x89')]!==_0xc804('0x8a'))return;return _0x327fad[_0xc804('0x88')][_0xc804('0x8b')]({'attributes':['id'],'raw':!![]})[_0xc804('0x22')](function(_0x108b0e){if(_[_0xc804('0x6d')](_0x108b0e)){_0x33722f[_0xc804('0x40')](_0xc804('0x8c'));_0x2b8cc[_0xc804('0x40')](_0xc804('0x8c'));}else{_0x33722f['where'](_0xc804('0x8d'),_['map'](_0x108b0e,'id'));_0x2b8cc[_0xc804('0x40')](_0xc804('0x8d'),_['map'](_0x108b0e,'id'));}});})['then'](function(){if(_0x327fad[_0xc804('0x88')][_0xc804('0x89')]===_0xc804('0x8a')&&!_0x423db5&&!_0x327fad[_0xc804('0x35')][_0xc804('0x6e')])return[];return db[_0xc804('0x8e')]['query'](_0x33722f[_0xc804('0x8f')](),_0x9e8e52);})[_0xc804('0x22')](function(_0x3a5cbe){_0x3ce8df['count']=_0x3a5cbe[_0xc804('0x57')];if(_0x3ce8df[_0xc804('0x1d')]===0x0)return[];return db['sequelize'][_0xc804('0x35')](_0x3f880b[_0xc804('0x8f')](),_0x9e8e52)['then'](function(_0x2e2828){_0x316eb6=_[_0xc804('0x90')](_0x2e2828,'id');_0x9e8e52=_[_0xc804('0x91')](_0x9e8e52,{'model':db[_0xc804('0x92')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x327fad[_0xc804('0x35')][_0xc804('0x3a')]){_0x20d210[_0xc804('0x39')][_0xc804('0x2e')](function(_0x5bd862){_0x2b8cc[_0xc804('0x43')]('i.'+_0x5bd862);});}else{_0x2b8cc[_0xc804('0x43')](_0xc804('0x84'),_0xc804('0x59'));_0x2b8cc[_0xc804('0x43')]('a.key','Account.key');_0x2b8cc[_0xc804('0x43')](_0xc804('0x93'),_0xc804('0x94'));_0x2b8cc[_0xc804('0x43')]('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',_0xc804('0x85'));_0x2b8cc[_0xc804('0x43')](_0xc804('0x95'));_0x2b8cc[_0xc804('0x43')](_0xc804('0x96'),'Contact.firstName');_0x2b8cc[_0xc804('0x43')]('c.lastName',_0xc804('0x97'));_0x2b8cc[_0xc804('0x43')]('c.email',_0xc804('0x98'));_0x2b8cc[_0xc804('0x43')](_0xc804('0x99'),_0xc804('0x9a'));_0x2b8cc[_0xc804('0x43')](_0xc804('0x9b'),_0xc804('0x9c'));_0x2b8cc[_0xc804('0x43')]('c.fax',_0xc804('0x9d'));_0x2b8cc[_0xc804('0x43')](_0xc804('0x9e'),_0xc804('0x9f'));_0x2b8cc[_0xc804('0x43')](_0xc804('0xa0'),_0xc804('0xa1'));_0x2b8cc['field'](_0xc804('0xa2'),'TagIds');}if(_0x20d210['limit'])_0x2b8cc[_0xc804('0x3d')](_0x20d210[_0xc804('0x3d')]);if(_0x20d210['offset'])_0x2b8cc['offset'](_0x20d210[_0xc804('0x1b')]);return db['sequelize']['query'](_0x2b8cc[_0xc804('0x8f')](),_0x9e8e52);})['then'](function(_0x1ca1af){if(_0x1ca1af[_0xc804('0x57')]>0x0)_0x1fc587[_0xc804('0x40')](_0xc804('0xa3'),_[_0xc804('0x29')](_0x1ca1af,'id'));return db['sequelize'][_0xc804('0x35')](_0x1fc587[_0xc804('0x8f')](),_0x9e8e52)[_0xc804('0x22')](function(_0x1f590b){var _0x5eab88=_[_0xc804('0xa4')](_0x1f590b,_0xc804('0xa5'));var _0xd9d892=[];_0x1ca1af[_0xc804('0x2e')](function(_0x1d2418){_0xd9d892['push'](updateFaxInteraction(_0x1d2418,_0x316eb6,_0x5eab88));});return BPromise['all'](_0xd9d892);});});})[_0xc804('0x22')](function(_0x544d8f){_0x3ce8df[_0xc804('0xa6')]=_0x544d8f;return _0x3ce8df;})[_0xc804('0x22')](respondWithFilteredResult(_0x9f26be,_0x20d210))[_0xc804('0xa7')](handleError(_0x9f26be,null));};exports[_0xc804('0xa8')]=function(_0x51e555,_0x20cdff){var _0x189abf={'raw':![],'where':{'id':_0x51e555[_0xc804('0xa9')]['id']}},_0xaa7ad0={};_0xaa7ad0['model']=_[_0xc804('0x36')](db['FaxInteraction']['rawAttributes']);_0xaa7ad0[_0xc804('0x35')]=_[_0xc804('0x36')](_0x51e555[_0xc804('0x35')]);_0xaa7ad0[_0xc804('0x37')]=_[_0xc804('0x38')](_0xaa7ad0[_0xc804('0x34')],_0xaa7ad0[_0xc804('0x35')]);_0x189abf['attributes']=_['intersection'](_0xaa7ad0['model'],qs[_0xc804('0x3a')](_0x51e555[_0xc804('0x35')][_0xc804('0x3a')]));_0x189abf['attributes']=_0x189abf[_0xc804('0x39')][_0xc804('0x57')]?_0x189abf[_0xc804('0x39')]:_0xaa7ad0[_0xc804('0x34')];if(_0x51e555[_0xc804('0x35')][_0xc804('0xaa')]){_0x189abf['include']=[{'all':!![]}];}_0x189abf=_[_0xc804('0x91')]({},_0x189abf,_0x51e555[_0xc804('0xab')]);return db['FaxInteraction']['find'](_0x189abf)[_0xc804('0x22')](handleEntityNotFound(_0x20cdff,null))[_0xc804('0x22')](respondWithResult(_0x20cdff,null))[_0xc804('0xa7')](handleError(_0x20cdff,null));};exports[_0xc804('0xac')]=function(_0x5dac04,_0x467ca1){return db['FaxInteraction'][_0xc804('0xac')](_0x5dac04[_0xc804('0xad')],{})[_0xc804('0x22')](respondWithResult(_0x467ca1,0xc9))[_0xc804('0xa7')](handleError(_0x467ca1,null));};exports['update']=function(_0x424993,_0x1594b3){if(_0x424993['body']['id']){delete _0x424993['body']['id'];}return db[_0xc804('0x92')][_0xc804('0x58')]({'where':{'id':_0x424993['params']['id']}})[_0xc804('0x22')](handleEntityNotFound(_0x1594b3,null))[_0xc804('0x22')](saveUpdates(_0x424993[_0xc804('0xad')],null))[_0xc804('0x22')](respondWithResult(_0x1594b3,null))[_0xc804('0xa7')](handleError(_0x1594b3,null));};exports['destroy']=function(_0x1f60d6,_0x5be862){return db['FaxInteraction'][_0xc804('0x58')]({'where':{'id':_0x1f60d6[_0xc804('0xa9')]['id']}})[_0xc804('0x22')](handleEntityNotFound(_0x5be862,null))[_0xc804('0x22')](removeEntity(_0x5be862,null))[_0xc804('0xa7')](handleError(_0x5be862,null));};exports[_0xc804('0xae')]=function(_0x413b85,_0xa528ba){return db['FaxInteraction'][_0xc804('0xae')]()[_0xc804('0x22')](respondWithResult(_0xa528ba,null))['catch'](handleError(_0xa528ba,null));};exports[_0xc804('0xaf')]=function(_0x58be9d,_0x36b5ef,_0x2e1bad){return db['FaxMessage'][_0xc804('0x58')]({'where':{'id':_0x58be9d[_0xc804('0xa9')]['id']}})['then'](handleEntityNotFound(_0x36b5ef,null))[_0xc804('0x22')](function(_0x398f4f){if(_0x398f4f){return _0x398f4f['addMessage'](_0x58be9d['body']['ids'],_[_0xc804('0xb0')](_0x58be9d[_0xc804('0xad')],['ids','id'])||{});}})[_0xc804('0x22')](respondWithResult(_0x36b5ef,null))[_0xc804('0xa7')](handleError(_0x36b5ef,null));};exports[_0xc804('0xb1')]=function(_0x3b0d52,_0x1896ec,_0x5f3c49){var _0x5521cd={'raw':![],'where':{}};var _0x5d22ae={};var _0x258b6e={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xc804('0xb2')]({'where':{'id':_0x3b0d52[_0xc804('0xa9')]['id']}})[_0xc804('0x22')](handleEntityNotFound(_0x1896ec,null))[_0xc804('0x22')](function(_0xe815c9){if(_0xe815c9){_0x5d22ae[_0xc804('0x34')]=_['keys'](db[_0xc804('0xb3')][_0xc804('0x30')]);_0x5d22ae[_0xc804('0x35')]=_[_0xc804('0x36')](_0x3b0d52['query']);_0x5d22ae[_0xc804('0x37')]=_[_0xc804('0x38')](_0x5d22ae[_0xc804('0x34')],_0x5d22ae[_0xc804('0x35')]);_0x5521cd['attributes']=_[_0xc804('0x38')](_0x5d22ae[_0xc804('0x34')],qs[_0xc804('0x3a')](_0x3b0d52[_0xc804('0x35')]['fields']));_0x5521cd[_0xc804('0x39')]=_0x5521cd[_0xc804('0x39')][_0xc804('0x57')]?_0x5521cd[_0xc804('0x39')]:_0x5d22ae['model'];if(!_0x3b0d52['query'][_0xc804('0x3b')](_0xc804('0x3c'))){_0x5521cd[_0xc804('0x3d')]=qs['limit'](_0x3b0d52[_0xc804('0x35')][_0xc804('0x3d')]);_0x5521cd['offset']=qs[_0xc804('0x1b')](_0x3b0d52[_0xc804('0x35')][_0xc804('0x1b')]);}_0x5521cd[_0xc804('0x3e')]=qs['sort'](_0x3b0d52[_0xc804('0x35')]['sort']);_0x5521cd[_0xc804('0x40')]=qs[_0xc804('0x37')](_[_0xc804('0x41')](_0x3b0d52[_0xc804('0x35')],_0x5d22ae[_0xc804('0x37')]));_0x5521cd[_0xc804('0x40')][_0xc804('0xa5')]=_0xe815c9['id'];if(_0x3b0d52['query'][_0xc804('0x7a')]){_0x5521cd[_0xc804('0x40')]=_['merge'](_0x5521cd[_0xc804('0x40')],{'$or':_[_0xc804('0x29')](_0x5521cd['attributes'],function(_0x4a4e5c){var _0x31e26f={};_0x31e26f[_0x4a4e5c]={'$like':'%'+_0x3b0d52[_0xc804('0x35')][_0xc804('0x7a')]+'%'};return _0x31e26f;})});}if(_0x3b0d52[_0xc804('0x35')]['$gte']){var _0x378184=_0x3b0d52[_0xc804('0x35')][_0xc804('0x72')]['split'](',');var _0x19fca8={};_0x19fca8[_0x378184[0x0]]={'$gte':moment(_0x378184[0x1])[_0xc804('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5521cd[_0xc804('0x40')]=_['merge'](_0x5521cd[_0xc804('0x40')],_0x19fca8);}_0x5521cd=_[_0xc804('0x91')]({},_0x5521cd,_0x3b0d52[_0xc804('0xab')]);return db[_0xc804('0xb3')]['count']({'where':_0x5521cd['where']})[_0xc804('0x22')](function(_0x4b4f1d){_0x258b6e[_0xc804('0x1d')]=_0x4b4f1d;if(_0x3b0d52['query'][_0xc804('0xaa')]){_0x5521cd[_0xc804('0xb5')]=[{'all':!![]}];}return db['FaxMessage'][_0xc804('0xb6')](_0x5521cd);})['then'](function(_0x2afe01){_0x258b6e['rows']=_0x2afe01;return _0x258b6e;});}})[_0xc804('0x22')](respondWithFilteredResult(_0x1896ec,_0x5521cd))[_0xc804('0xa7')](handleError(_0x1896ec,null));};exports[_0xc804('0xb7')]=function(_0x1398e4,_0x13e946,_0x2c56a1){return db['FaxInteraction']['find']({'where':{'id':_0x1398e4['params']['id']}})[_0xc804('0x22')](handleEntityNotFound(_0x13e946,null))[_0xc804('0x22')](function(_0x23d757){if(_0x23d757){return _0x23d757['setTags'](_0x1398e4[_0xc804('0xad')]['ids'],_[_0xc804('0xb0')](_0x1398e4[_0xc804('0xad')],['ids','id'])||{})[_0xc804('0xb8')](function(){return db[_0xc804('0x68')]['findAll']({'attributes':['id',_0xc804('0x26'),'color'],'where':{'id':_0x1398e4[_0xc804('0xad')]['ids']}});})[_0xc804('0x22')](function(_0x34a1f3){socket['emit'](_0xc804('0xb9'),{'id':Number(_0x1398e4['params']['id']),'tags':_0x34a1f3||[]});return{'id':Number(_0x1398e4[_0xc804('0xa9')]['id']),'tags':_0x34a1f3||[]};});}})[_0xc804('0x22')](respondWithResult(_0x13e946,null))[_0xc804('0xa7')](handleError(_0x13e946,null));};exports['removeTags']=function(_0xd40d4,_0x3f7859,_0x134fbc){return db[_0xc804('0x92')][_0xc804('0x58')]({'where':{'id':_0xd40d4[_0xc804('0xa9')]['id']}})[_0xc804('0x22')](handleEntityNotFound(_0x3f7859,null))[_0xc804('0x22')](function(_0x5c6c36){if(_0x5c6c36){return _0x5c6c36[_0xc804('0xba')](_0xd40d4[_0xc804('0x35')][_0xc804('0xbb')]);}})[_0xc804('0x22')](respondWithStatusCode(_0x3f7859,null))[_0xc804('0xa7')](handleError(_0x3f7859,null));};exports[_0xc804('0xbc')]=function(_0x37c099,_0x1cc371){var _0x4cc5c5=moment()['unix']()[_0xc804('0x8f')]();var _0x1e41ac=path['join'](config[_0xc804('0xbd')],_0xc804('0xbe'),_0xc804('0xbf'),_0xc804('0xc0'));var _0x34141e=path['join'](config[_0xc804('0xbd')],_0xc804('0xbe'),_0xc804('0xbf'),'attachments');var _0x591b48=path[_0xc804('0xc1')](_0x1e41ac,_0x4cc5c5);var _0x242528=util[_0xc804('0xb4')]('transcript-%d-%s.zip',_0x37c099[_0xc804('0xa9')]['id'],_0x4cc5c5);var _0x42c84d=path[_0xc804('0xc1')](_0x1e41ac,_0x242528);var _0x2e4a7f=[];_0x2e4a7f[_0xc804('0xc2')]({'model':db[_0xc804('0xc3')],'as':_0xc804('0xc3'),'raw':!![]});var _0x173796=[{'model':db['FaxMessage'],'as':_0xc804('0xc4'),'attributes':['id',_0xc804('0xad'),_0xc804('0x70')],'include':_0x2e4a7f}];return db[_0xc804('0x92')][_0xc804('0x58')]({'where':{'id':_0x37c099[_0xc804('0xa9')]['id']},'include':_0x173796})[_0xc804('0x22')](handleEntityNotFound(_0x1cc371,null))['then'](function(_0x50680b){if(_0x50680b&&_0x50680b[_0xc804('0xc4')]){var _0x98aaef=_0x50680b[_0xc804('0xc5')]({'plain':!![]});fs[_0xc804('0xc6')](_0x591b48);for(var _0x297534=0x0;_0x297534<_0x98aaef[_0xc804('0xc4')][_0xc804('0x57')];_0x297534++){var _0x2591b2=_0x98aaef[_0xc804('0xc4')][_0x297534][_0xc804('0xc3')];if(_0x2591b2){var _0x4ae14d=path[_0xc804('0xc1')](_0x34141e,_0x2591b2[_0xc804('0xc7')]);if(fs['existsSync'](_0x4ae14d)){fs[_0xc804('0xc8')](_0x4ae14d)[_0xc804('0xc9')](fs[_0xc804('0xca')](path[_0xc804('0xc1')](_0x591b48,_0x2591b2[_0xc804('0xc7')])));}}}return BPromise['resolve']()[_0xc804('0x22')](function(){return new BPromise(function(_0x99d3fa,_0x25182b){zipdir(_0x591b48,{'saveTo':_0x42c84d},function(_0x144652,_0x4a0c08){if(_0x144652)return _0x25182b(_0x144652);return _0x99d3fa(_0x4a0c08);});})[_0xc804('0x22')](function(){return new BPromise(function(_0x49b7b4,_0x1f2f3b){rimraf(_0x591b48,function(_0x535e18){if(_0x535e18)_0x1f2f3b(_0x535e18);return _0x49b7b4();});});})['then'](function(){return _0x1cc371[_0xc804('0xbc')](_0x42c84d,_0x242528,function(_0x4319b0){if(_0x4319b0){console['log'](_0xc804('0xcb'),_0x4319b0);}else{fs[_0xc804('0xcc')](_0x42c84d);}});});});}else{return _0x1cc371['sendStatus'](0xc8);}})['catch'](handleError(_0x1cc371,null));}; \ No newline at end of file +var _0x8276=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','u.id\x20=\x20ui.UserId','fax_interactions','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','isEmpty','FaxAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','role','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','push','all','rows','catch','params','includeAll','options','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','merge','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','removeTags','download','unix','server','files','join','root','format','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8276,0x19c));var _0x6827=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8276[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6827('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6827('0x1'));var moment=require(_0x6827('0x2'));var BPromise=require(_0x6827('0x3'));var Mustache=require('mustache');var util=require(_0x6827('0x4'));var path=require(_0x6827('0x5'));var sox=require(_0x6827('0x6'));var csv=require(_0x6827('0x7'));var ejs=require(_0x6827('0x8'));var fs=require('fs');var fs_extra=require(_0x6827('0x9'));var _=require(_0x6827('0xa'));var squel=require(_0x6827('0xb'));var crypto=require(_0x6827('0xc'));var jsforce=require(_0x6827('0xd'));var deskjs=require(_0x6827('0xe'));var toCsv=require(_0x6827('0x7'));var querystring=require(_0x6827('0xf'));var Papa=require('papaparse');var Redis=require(_0x6827('0x10'));var authService=require(_0x6827('0x11'));var qs=require(_0x6827('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6827('0x13'));var logger=require('../../config/logger')(_0x6827('0x14'));var utils=require(_0x6827('0x15'));var config=require(_0x6827('0x16'));var licenseUtil=require(_0x6827('0x17'));var db=require(_0x6827('0x18'))['db'];config[_0x6827('0x19')]=_[_0x6827('0x1a')](config[_0x6827('0x19')],{'host':_0x6827('0x1b'),'port':0x18eb});var socket=require(_0x6827('0x1c'))(new Redis(config[_0x6827('0x19')]));require('./faxInteraction.socket')[_0x6827('0x1d')](socket);function respondWithStatusCode(_0x4dcfd1,_0x57683d){_0x57683d=_0x57683d||0xcc;return function(_0x4aaf35){if(_0x4aaf35){return _0x4dcfd1[_0x6827('0x1e')](_0x57683d);}return _0x4dcfd1[_0x6827('0x1f')](_0x57683d)[_0x6827('0x20')]();};}function respondWithResult(_0x11633b,_0x5442c6){_0x5442c6=_0x5442c6||0xc8;return function(_0x1e77a6){if(_0x1e77a6){return _0x11633b[_0x6827('0x1f')](_0x5442c6)[_0x6827('0x21')](_0x1e77a6);}};}function respondWithFilteredResult(_0xa4c2be,_0x2e026c){return function(_0x15bcd1){if(_0x15bcd1){var _0x3fc657=typeof _0x2e026c['offset']===_0x6827('0x22')&&typeof _0x2e026c['limit']===_0x6827('0x22');var _0x7f01a1=_0x15bcd1[_0x6827('0x23')];var _0x315d62=_0x3fc657?0x0:_0x2e026c[_0x6827('0x24')];var _0x31b757=_0x3fc657?_0x15bcd1[_0x6827('0x23')]:_0x2e026c[_0x6827('0x24')]+_0x2e026c[_0x6827('0x25')];var _0x55ffd3;if(_0x31b757>=_0x7f01a1){_0x31b757=_0x7f01a1;_0x55ffd3=0xc8;}else{_0x55ffd3=0xce;}_0xa4c2be[_0x6827('0x1f')](_0x55ffd3);return _0xa4c2be[_0x6827('0x26')](_0x6827('0x27'),_0x315d62+'-'+_0x31b757+'/'+_0x7f01a1)[_0x6827('0x21')](_0x15bcd1);}return null;};}function patchUpdates(_0x1d4617){return function(_0x347a8a){try{jsonpatch[_0x6827('0x28')](_0x347a8a,_0x1d4617,!![]);}catch(_0x58f3ba){return BPromise[_0x6827('0x29')](_0x58f3ba);}return _0x347a8a[_0x6827('0x2a')]();};}function saveUpdates(_0x3efd4f,_0x145270){return function(_0x5bfd26){if(_0x5bfd26){return _0x5bfd26[_0x6827('0x2b')](_0x3efd4f)[_0x6827('0x2c')](function(_0x16f935){return _0x16f935;});}return null;};}function removeEntity(_0xeddf23,_0x1a4895){return function(_0x344f73){if(_0x344f73){return _0x344f73['destroy']()['then'](function(){_0xeddf23[_0x6827('0x1f')](0xcc)[_0x6827('0x20')]();});}};}function handleEntityNotFound(_0x5dc6cf,_0x23dbf9){return function(_0x2c481e){if(!_0x2c481e){_0x5dc6cf['sendStatus'](0x194);}return _0x2c481e;};}function handleError(_0xcd4001,_0xb83c2e){_0xb83c2e=_0xb83c2e||0x1f4;return function(_0x7ba86e){logger[_0x6827('0x2d')](_0x7ba86e[_0x6827('0x2e')]);if(_0x7ba86e[_0x6827('0x2f')]){delete _0x7ba86e['name'];}_0xcd4001[_0x6827('0x1f')](_0xb83c2e)[_0x6827('0x30')](_0x7ba86e);};}function getInteractionUsers(_0x59142d,_0x5ca5ca){return new BPromise(function(_0x46e045,_0x37f642){try{if(_0x5ca5ca[_0x59142d['id']]){_0x59142d[_0x6827('0x31')]=_['map'](_0x5ca5ca[_0x59142d['id']],function(_0x1f1e39){return{'id':_0x1f1e39['id'],'fullname':_0x1f1e39[_0x6827('0x32')]};});}}catch(_0x3442ab){_0x37f642(_0x3442ab);}_0x46e045(_0x59142d);});}function getInteractionTags(_0x187c9d,_0x573674){return new BPromise(function(_0x1f974e,_0x4c9ebe){try{if(_0x187c9d[_0x6827('0x33')]){_0x187c9d[_0x6827('0x34')]=[];_0x187c9d[_0x6827('0x33')]['split'](',')[_0x6827('0x35')](function(_0x2b8f58){_0x187c9d[_0x6827('0x34')]['push'](_0x573674[_0x2b8f58]);});}delete _0x187c9d[_0x6827('0x33')];}catch(_0x483d71){_0x4c9ebe(_0x483d71);}_0x1f974e(_0x187c9d);});}function updateFaxInteraction(_0x346f6e,_0x3b8f95,_0x4faa83){return new BPromise(function(_0x4d9f61,_0x1ab240){return getInteractionUsers(_0x346f6e,_0x4faa83)[_0x6827('0x2c')](function(_0x1537fb){return getInteractionTags(_0x1537fb,_0x3b8f95);})[_0x6827('0x2c')](function(_0x1df58a){_0x4d9f61(_0x1df58a);})['catch'](function(_0x3d47f9){_0x1ab240(_0x3d47f9);});});}exports[_0x6827('0x36')]=function(_0x18b27b,_0x23adff){var _0x422d0c={},_0x595220={},_0x1cc322={'count':0x0,'rows':[]};var _0x2cd1b7=_[_0x6827('0x37')](db[_0x6827('0x38')][_0x6827('0x39')],function(_0x179e7c){return{'name':_0x179e7c[_0x6827('0x3a')],'type':_0x179e7c[_0x6827('0x3b')][_0x6827('0x3c')]};});_0x595220[_0x6827('0x3d')]=_[_0x6827('0x37')](_0x2cd1b7,_0x6827('0x2f'));_0x595220[_0x6827('0x3e')]=_[_0x6827('0x3f')](_0x18b27b[_0x6827('0x3e')]);_0x595220[_0x6827('0x40')]=_[_0x6827('0x41')](_0x595220[_0x6827('0x3d')],_0x595220[_0x6827('0x3e')]);_0x422d0c['attributes']=_['intersection'](_0x595220[_0x6827('0x3d')],qs[_0x6827('0x42')](_0x18b27b['query']['fields']));_0x422d0c[_0x6827('0x43')]=_0x422d0c[_0x6827('0x43')][_0x6827('0x44')]?_0x422d0c[_0x6827('0x43')]:_0x595220[_0x6827('0x3d')];if(!_0x18b27b[_0x6827('0x3e')]['hasOwnProperty'](_0x6827('0x45'))){_0x422d0c['limit']=qs[_0x6827('0x25')](_0x18b27b['query'][_0x6827('0x25')]);_0x422d0c[_0x6827('0x24')]=qs[_0x6827('0x24')](_0x18b27b[_0x6827('0x3e')]['offset']);}_0x422d0c['order']=qs['sort'](_0x18b27b[_0x6827('0x3e')][_0x6827('0x46')]);_0x422d0c[_0x6827('0x47')]=qs['filters'](_[_0x6827('0x48')](_0x18b27b[_0x6827('0x3e')],_0x595220['filters']),_0x2cd1b7);var _0x172f35=[];var _0x341017=squel[_0x6827('0x49')]()[_0x6827('0x4a')]('id')[_0x6827('0x4a')](_0x6827('0x2f'))[_0x6827('0x4a')](_0x6827('0x4b'))[_0x6827('0x4c')](_0x6827('0x4d'));var _0x6fab36=squel['select']()[_0x6827('0x4a')](_0x6827('0x4e'))[_0x6827('0x4a')](_0x6827('0x4f'))[_0x6827('0x4a')](_0x6827('0x50'))[_0x6827('0x4c')]('user_has_fax_interactions','ui')[_0x6827('0x51')]('users','u',_0x6827('0x52'));var _0x2ee900=squel[_0x6827('0x49')]()[_0x6827('0x4c')](_0x6827('0x53'),'i')[_0x6827('0x51')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6827('0x51')](_0x6827('0x54'),'o',_0x6827('0x55'))[_0x6827('0x51')]('fax_accounts','a',_0x6827('0x56'))[_0x6827('0x51')]('fax_messages','me',_0x6827('0x57'))[_0x6827('0x51')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x6827('0x51')]('tools_tags','t',_0x6827('0x58'));var _0x53065e=squel[_0x6827('0x59')]();var _0x53c15f=[];var _0x32a5ec=squel[_0x6827('0x59')]();var _0x1e4309;if(_0x18b27b[_0x6827('0x3e')][_0x6827('0x5a')]){_0x1e4309=as['parseSearch'](_0x18b27b[_0x6827('0x3e')][_0x6827('0x5a')]);var _0x2a47e4=_0x1e4309[_0x6827('0x5b')];for(var _0x573a1f=0x0;_0x573a1f<_0x1e4309['conditions']['length'];_0x573a1f++){var _0x322daf=_0x1e4309[_0x6827('0x5c')][_0x573a1f];var _0x16f56a='i';var _0x4d6831=_[_0x6827('0x5d')](_0x2cd1b7,['name',_0x322daf[_0x6827('0x4a')]]);if(!_0x4d6831){switch(_0x322daf[_0x6827('0x4a')]){case'unreadMessages':if(_0x322daf['value']==0x1){_0x2ee900[_0x6827('0x5e')]('`'+_0x322daf[_0x6827('0x4a')]+_0x6827('0x5f'));}else{_0x2ee900[_0x6827('0x5e')]('`'+_0x322daf[_0x6827('0x4a')]+_0x6827('0x60'));}break;case _0x6827('0x61'):if(_0x322daf[_0x6827('0x62')]===_0x6827('0x63')){if(_0x322daf['value'][_0x6827('0x64')]('\x20')[_0x6827('0x44')]>0x1){_0x53065e[_0x2a47e4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6827('0x65')](_0x322daf[_0x6827('0x66')]),null);}else{var _0x432e47='%'+_0x322daf[_0x6827('0x66')]+'%';_0x53065e[_0x2a47e4](_0x6827('0x67'),_0x432e47,_0x432e47,_0x432e47);}}else{_0x4d6831=_[_0x6827('0x5d')](_0x2cd1b7,[_0x6827('0x2f'),_0x6827('0x68')]);_0x322daf[_0x6827('0x4a')]=_0x6827('0x68');_0xcfae0c=as[_0x6827('0x69')](_0x16f56a,_0x4d6831[_0x6827('0x3b')],_0x322daf);_0x53065e[_0x2a47e4](_0xcfae0c['text'],_0xcfae0c['value'][_0x6827('0x6a')],_0xcfae0c['value']['end']);}break;case _0x6827('0x6b'):var _0x2117cd=_0x322daf['value'][_0x6827('0x64')](',')[_0x6827('0x37')](function(_0x28c02a){return Number(_0x28c02a);});_0x2117cd[_0x6827('0x35')](function(_0x28971a){_0x32a5ec['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28971a+',%');});_0x53c15f=_['union'](_0x53c15f,_0x2117cd);break;case _0x6827('0x6c'):if(_0x322daf[_0x6827('0x62')]===_0x6827('0x63')){_0x53065e[_0x2a47e4](_0x6827('0x6d'),'%'+_0x322daf['value']+'%',null);}else{_0x4d6831=_['find'](_0x2cd1b7,['name','UserId']);_0x322daf['field']='UserId';_0xcfae0c=as['buildExpression'](_0x16f56a,_0x4d6831[_0x6827('0x3b')],_0x322daf);_0x53065e[_0x2a47e4](_0xcfae0c[_0x6827('0x6e')],_0xcfae0c[_0x6827('0x66')]['start'],_0xcfae0c[_0x6827('0x66')][_0x6827('0x20')]);}break;case _0x6827('0x6f'):_0xcfae0c=as['buildExpression']('me',null,_0x322daf);_0x53065e[_0x2a47e4](_0xcfae0c[_0x6827('0x6e')],_0xcfae0c['value'][_0x6827('0x6a')],_0xcfae0c[_0x6827('0x66')][_0x6827('0x20')]);break;}}else{var _0xcfae0c=as['buildExpression'](_0x16f56a,_0x4d6831[_0x6827('0x3b')],_0x322daf);_0x53065e[_0x2a47e4](_0xcfae0c['text'],_0xcfae0c[_0x6827('0x66')][_0x6827('0x6a')],_0xcfae0c[_0x6827('0x66')][_0x6827('0x20')]);}}}else{var _0x14e6b6=_(_0x18b27b[_0x6827('0x3e')])[_0x6827('0x3f')]()[_0x6827('0x37')](function(_0x3682a6){return _['some'](_0x2cd1b7,['name',_0x3682a6])?_0x3682a6:undefined;})['compact']()[_0x6827('0x66')]();if(!_[_0x6827('0x70')](_0x14e6b6)){_0x14e6b6[_0x6827('0x35')](function(_0x4e27cd){if(_0x4e27cd===_0x6827('0x71')){_0x2ee900[_0x6827('0x47')]('i.FaxAccountId\x20IN\x20?',[][_0x6827('0x72')](_0x18b27b[_0x6827('0x3e')][_0x4e27cd]));}else if(_0x4e27cd==='createdAt'){var _0x418c01=JSON[_0x6827('0x73')](_0x18b27b[_0x6827('0x3e')][_0x4e27cd])[_0x6827('0x74')];var _0x2dbb5a=JSON[_0x6827('0x73')](_0x18b27b['query'][_0x4e27cd])[_0x6827('0x75')];_0x2ee900[_0x6827('0x47')](_0x6827('0x76'),_0x418c01,_0x2dbb5a);}else{if(_0x18b27b[_0x6827('0x3e')][_0x4e27cd]===_0x6827('0x77')){_0x2ee900[_0x6827('0x47')]('i.'+_0x4e27cd+_0x6827('0x78'));}else{_0x2ee900[_0x6827('0x47')]('i.'+_0x4e27cd+_0x6827('0x79'),_0x18b27b[_0x6827('0x3e')][_0x4e27cd]);}}});}if(_0x18b27b[_0x6827('0x3e')]['read']){if(_0x18b27b[_0x6827('0x3e')][_0x6827('0x7a')]==0x1){_0x2ee900['having'](_0x6827('0x7b'));}else{_0x2ee900['having'](_0x6827('0x7c'));}}if(_0x18b27b['query'][_0x6827('0x7d')]){_0x53c15f=_[_0x6827('0x7e')](_0x18b27b['query'][_0x6827('0x7d')])?_0x18b27b[_0x6827('0x3e')][_0x6827('0x7d')]:new Array(_0x18b27b[_0x6827('0x3e')][_0x6827('0x7d')]);_0x53c15f[_0x6827('0x35')](function(_0xce0956){_0x32a5ec['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xce0956+',%');});}if(_0x18b27b['query']['filter']){var _0x2b8332=_0x18b27b[_0x6827('0x3e')][_0x6827('0x7f')][_0x6827('0x80')]('\x5c','\x5c\x5c')[_0x6827('0x80')](/'/g,'\x27\x27');if(qs[_0x6827('0x81')](_0x2b8332)){_0x53065e['or'](_0x6827('0x82'),_0x2b8332+'%')['or'](_0x6827('0x83'),_0x2b8332+'%');}_0x53065e['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2b8332+'%');}}_0x2ee900[_0x6827('0x47')](_0x53065e);_0x2ee900[_0x6827('0x84')](_0x6827('0x85'));var _0x13ccbe={'type':db[_0x6827('0x86')][_0x6827('0x87')]['SELECT'],'raw':!![]};var _0x5529c3=_0x2ee900[_0x6827('0x88')]();_0x5529c3[_0x6827('0x4a')](_0x6827('0x85'));_0x5529c3[_0x6827('0x4a')](_0x6827('0x89'),_0x6827('0x8a'));if(_0x422d0c[_0x6827('0x8b')]){_0x422d0c[_0x6827('0x8b')]['forEach'](function(_0xe2b105){var _0x1db8d0=_0xe2b105[0x0]==='contactName'?_0xe2b105[0x0]:'i.'+_0xe2b105[0x0];_0x2ee900[_0x6827('0x8b')](_0x1db8d0,_0xe2b105[0x1]===_0x6827('0x8c')?![]:!![]);});}if(!_[_0x6827('0x70')](_0x53c15f)){_0x2ee900[_0x6827('0x5e')](_0x32a5ec);_0x5529c3[_0x6827('0x47')](_0x6827('0x8d'),_0x53c15f);}BPromise[_0x6827('0x8e')]()[_0x6827('0x2c')](function(){if(!_0x1e4309){if(_0x18b27b[_0x6827('0x3e')][_0x6827('0x71')])return;_0x5529c3[_0x6827('0x47')](_0x6827('0x8f'));_0x2ee900['where'](_0x6827('0x8f'));return;}if(_0x18b27b[_0x6827('0x90')]['role']!==_0x6827('0x91'))return;return _0x18b27b[_0x6827('0x90')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x6827('0x2c')](function(_0x56e060){if(_[_0x6827('0x70')](_0x56e060)){_0x5529c3['where']('i.FaxAccountId\x20IS\x20NULL');_0x2ee900[_0x6827('0x47')](_0x6827('0x92'));}else{_0x5529c3['where'](_0x6827('0x93'),_['map'](_0x56e060,'id'));_0x2ee900[_0x6827('0x47')](_0x6827('0x93'),_[_0x6827('0x37')](_0x56e060,'id'));}});})['then'](function(){if(_0x18b27b[_0x6827('0x90')][_0x6827('0x94')]===_0x6827('0x91')&&!_0x1e4309&&!_0x18b27b[_0x6827('0x3e')][_0x6827('0x71')])return[];return db[_0x6827('0x95')][_0x6827('0x3e')](_0x5529c3[_0x6827('0x96')](),_0x13ccbe);})['then'](function(_0x4af1c0){_0x1cc322[_0x6827('0x23')]=_0x4af1c0['length'];if(_0x1cc322[_0x6827('0x23')]===0x0)return[];return db['sequelize'][_0x6827('0x3e')](_0x341017[_0x6827('0x96')](),_0x13ccbe)[_0x6827('0x2c')](function(_0x3f2e9b){_0x172f35=_[_0x6827('0x97')](_0x3f2e9b,'id');_0x13ccbe=_['merge'](_0x13ccbe,{'model':db[_0x6827('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18b27b[_0x6827('0x3e')][_0x6827('0x42')]){_0x422d0c[_0x6827('0x43')][_0x6827('0x35')](function(_0x24b53d){_0x2ee900['field']('i.'+_0x24b53d);});}else{_0x2ee900['field'](_0x6827('0x89'),_0x6827('0x8a'));_0x2ee900['field'](_0x6827('0x98'),_0x6827('0x99'));_0x2ee900['field']('a.mandatoryDisposition',_0x6827('0x9a'));_0x2ee900['field'](_0x6827('0x9b'),_0x6827('0x9c'));_0x2ee900[_0x6827('0x4a')]('i.*');_0x2ee900['field'](_0x6827('0x9d'),'Contact.firstName');_0x2ee900['field'](_0x6827('0x9e'),_0x6827('0x9f'));_0x2ee900['field'](_0x6827('0xa0'),_0x6827('0xa1'));_0x2ee900[_0x6827('0x4a')](_0x6827('0xa2'),'Contact.phone');_0x2ee900[_0x6827('0x4a')]('c.mobile',_0x6827('0xa3'));_0x2ee900['field'](_0x6827('0xa4'),_0x6827('0xa5'));_0x2ee900[_0x6827('0x4a')](_0x6827('0xa6'),_0x6827('0xa7'));_0x2ee900[_0x6827('0x4a')](_0x6827('0xa8'),_0x6827('0xa9'));_0x2ee900[_0x6827('0x4a')](_0x6827('0xaa'),_0x6827('0x33'));}if(_0x422d0c[_0x6827('0x25')])_0x2ee900[_0x6827('0x25')](_0x422d0c[_0x6827('0x25')]);if(_0x422d0c[_0x6827('0x24')])_0x2ee900[_0x6827('0x24')](_0x422d0c[_0x6827('0x24')]);return db['sequelize'][_0x6827('0x3e')](_0x2ee900[_0x6827('0x96')](),_0x13ccbe);})[_0x6827('0x2c')](function(_0x11c3fb){if(_0x11c3fb[_0x6827('0x44')]>0x0)_0x6fab36[_0x6827('0x47')](_0x6827('0xab'),_[_0x6827('0x37')](_0x11c3fb,'id'));return db[_0x6827('0x95')][_0x6827('0x3e')](_0x6fab36[_0x6827('0x96')](),_0x13ccbe)[_0x6827('0x2c')](function(_0x25ee84){var _0x36bad0=_['groupBy'](_0x25ee84,_0x6827('0xac'));var _0x9715fc=[];_0x11c3fb[_0x6827('0x35')](function(_0x4b4a0b){_0x9715fc[_0x6827('0xad')](updateFaxInteraction(_0x4b4a0b,_0x172f35,_0x36bad0));});return BPromise[_0x6827('0xae')](_0x9715fc);});});})['then'](function(_0x4d4061){_0x1cc322[_0x6827('0xaf')]=_0x4d4061;return _0x1cc322;})[_0x6827('0x2c')](respondWithFilteredResult(_0x23adff,_0x422d0c))[_0x6827('0xb0')](handleError(_0x23adff,null));};exports['show']=function(_0xbaa772,_0x1d559a){var _0x332530={'raw':![],'where':{'id':_0xbaa772[_0x6827('0xb1')]['id']}},_0x5a4354={};_0x5a4354['model']=_[_0x6827('0x3f')](db[_0x6827('0x38')][_0x6827('0x39')]);_0x5a4354[_0x6827('0x3e')]=_['keys'](_0xbaa772[_0x6827('0x3e')]);_0x5a4354[_0x6827('0x40')]=_[_0x6827('0x41')](_0x5a4354[_0x6827('0x3d')],_0x5a4354[_0x6827('0x3e')]);_0x332530[_0x6827('0x43')]=_['intersection'](_0x5a4354[_0x6827('0x3d')],qs[_0x6827('0x42')](_0xbaa772[_0x6827('0x3e')][_0x6827('0x42')]));_0x332530[_0x6827('0x43')]=_0x332530['attributes'][_0x6827('0x44')]?_0x332530[_0x6827('0x43')]:_0x5a4354[_0x6827('0x3d')];if(_0xbaa772[_0x6827('0x3e')][_0x6827('0xb2')]){_0x332530['include']=[{'all':!![]}];}_0x332530=_['merge']({},_0x332530,_0xbaa772[_0x6827('0xb3')]);return db[_0x6827('0x38')][_0x6827('0x5d')](_0x332530)[_0x6827('0x2c')](handleEntityNotFound(_0x1d559a,null))[_0x6827('0x2c')](respondWithResult(_0x1d559a,null))[_0x6827('0xb0')](handleError(_0x1d559a,null));};exports['create']=function(_0x31479a,_0x4d198d){return db[_0x6827('0x38')]['create'](_0x31479a['body'],{})[_0x6827('0x2c')](respondWithResult(_0x4d198d,0xc9))[_0x6827('0xb0')](handleError(_0x4d198d,null));};exports['update']=function(_0x2022b1,_0x4cbf39){if(_0x2022b1[_0x6827('0x6f')]['id']){delete _0x2022b1[_0x6827('0x6f')]['id'];}return db['FaxInteraction'][_0x6827('0x5d')]({'where':{'id':_0x2022b1[_0x6827('0xb1')]['id']}})[_0x6827('0x2c')](handleEntityNotFound(_0x4cbf39,null))['then'](saveUpdates(_0x2022b1[_0x6827('0x6f')],null))[_0x6827('0x2c')](respondWithResult(_0x4cbf39,null))[_0x6827('0xb0')](handleError(_0x4cbf39,null));};exports[_0x6827('0xb4')]=function(_0x13b021,_0x18acb6){return db['FaxInteraction'][_0x6827('0x5d')]({'where':{'id':_0x13b021[_0x6827('0xb1')]['id']}})[_0x6827('0x2c')](handleEntityNotFound(_0x18acb6,null))[_0x6827('0x2c')](removeEntity(_0x18acb6,null))[_0x6827('0xb0')](handleError(_0x18acb6,null));};exports[_0x6827('0xb5')]=function(_0x34841c,_0x256151){return db[_0x6827('0x38')][_0x6827('0xb5')]()[_0x6827('0x2c')](respondWithResult(_0x256151,null))[_0x6827('0xb0')](handleError(_0x256151,null));};exports[_0x6827('0xb6')]=function(_0x5cfd31,_0x29d365,_0x5a7955){return db[_0x6827('0xb7')][_0x6827('0x5d')]({'where':{'id':_0x5cfd31[_0x6827('0xb1')]['id']}})['then'](handleEntityNotFound(_0x29d365,null))[_0x6827('0x2c')](function(_0x63aeb9){if(_0x63aeb9){return _0x63aeb9['addMessage'](_0x5cfd31['body'][_0x6827('0xb8')],_[_0x6827('0xb9')](_0x5cfd31['body'],['ids','id'])||{});}})[_0x6827('0x2c')](respondWithResult(_0x29d365,null))['catch'](handleError(_0x29d365,null));};exports[_0x6827('0xba')]=function(_0x106e48,_0x21786e,_0x235722){var _0x18d88c={'raw':![],'where':{}};var _0x31f7f4={};var _0x2aae2d={'count':0x0,'rows':[]};return db[_0x6827('0x38')][_0x6827('0xbb')]({'where':{'id':_0x106e48['params']['id']}})[_0x6827('0x2c')](handleEntityNotFound(_0x21786e,null))['then'](function(_0x2ca9c1){if(_0x2ca9c1){_0x31f7f4[_0x6827('0x3d')]=_[_0x6827('0x3f')](db[_0x6827('0xb7')][_0x6827('0x39')]);_0x31f7f4[_0x6827('0x3e')]=_['keys'](_0x106e48[_0x6827('0x3e')]);_0x31f7f4[_0x6827('0x40')]=_[_0x6827('0x41')](_0x31f7f4[_0x6827('0x3d')],_0x31f7f4[_0x6827('0x3e')]);_0x18d88c['attributes']=_['intersection'](_0x31f7f4[_0x6827('0x3d')],qs['fields'](_0x106e48['query']['fields']));_0x18d88c[_0x6827('0x43')]=_0x18d88c['attributes'][_0x6827('0x44')]?_0x18d88c[_0x6827('0x43')]:_0x31f7f4[_0x6827('0x3d')];if(!_0x106e48[_0x6827('0x3e')][_0x6827('0xbc')](_0x6827('0x45'))){_0x18d88c[_0x6827('0x25')]=qs[_0x6827('0x25')](_0x106e48[_0x6827('0x3e')][_0x6827('0x25')]);_0x18d88c[_0x6827('0x24')]=qs[_0x6827('0x24')](_0x106e48['query'][_0x6827('0x24')]);}_0x18d88c[_0x6827('0x8b')]=qs['sort'](_0x106e48['query'][_0x6827('0x46')]);_0x18d88c[_0x6827('0x47')]=qs[_0x6827('0x40')](_[_0x6827('0x48')](_0x106e48[_0x6827('0x3e')],_0x31f7f4[_0x6827('0x40')]));_0x18d88c[_0x6827('0x47')]['FaxInteractionId']=_0x2ca9c1['id'];if(_0x106e48[_0x6827('0x3e')][_0x6827('0x7f')]){_0x18d88c[_0x6827('0x47')]=_[_0x6827('0xbd')](_0x18d88c['where'],{'$or':_[_0x6827('0x37')](_0x18d88c[_0x6827('0x43')],function(_0xdb1d0){var _0x1bc3ef={};_0x1bc3ef[_0xdb1d0]={'$like':'%'+_0x106e48['query'][_0x6827('0x7f')]+'%'};return _0x1bc3ef;})});}if(_0x106e48[_0x6827('0x3e')][_0x6827('0x74')]){var _0x2a5457=_0x106e48['query'][_0x6827('0x74')]['split'](',');var _0x3bf6c9={};_0x3bf6c9[_0x2a5457[0x0]]={'$gte':moment(_0x2a5457[0x1])['format'](_0x6827('0xbe'))};_0x18d88c['where']=_[_0x6827('0xbd')](_0x18d88c[_0x6827('0x47')],_0x3bf6c9);}_0x18d88c=_['merge']({},_0x18d88c,_0x106e48[_0x6827('0xb3')]);return db[_0x6827('0xb7')]['count']({'where':_0x18d88c[_0x6827('0x47')]})[_0x6827('0x2c')](function(_0x56508f){_0x2aae2d[_0x6827('0x23')]=_0x56508f;if(_0x106e48[_0x6827('0x3e')][_0x6827('0xb2')]){_0x18d88c[_0x6827('0xbf')]=[{'all':!![]}];}return db[_0x6827('0xb7')][_0x6827('0xc0')](_0x18d88c);})['then'](function(_0x388e71){_0x2aae2d[_0x6827('0xaf')]=_0x388e71;return _0x2aae2d;});}})[_0x6827('0x2c')](respondWithFilteredResult(_0x21786e,_0x18d88c))[_0x6827('0xb0')](handleError(_0x21786e,null));};exports[_0x6827('0xc1')]=function(_0x5047d5,_0x2ec290,_0x34de49){return db['FaxInteraction'][_0x6827('0x5d')]({'where':{'id':_0x5047d5[_0x6827('0xb1')]['id']}})[_0x6827('0x2c')](handleEntityNotFound(_0x2ec290,null))[_0x6827('0x2c')](function(_0xedcdfa){if(_0xedcdfa){return _0xedcdfa[_0x6827('0xc2')](_0x5047d5[_0x6827('0x6f')]['ids'],_[_0x6827('0xb9')](_0x5047d5['body'],['ids','id'])||{})[_0x6827('0xc3')](function(){return db['Tag'][_0x6827('0xc0')]({'attributes':['id',_0x6827('0x2f'),_0x6827('0x4b')],'where':{'id':_0x5047d5[_0x6827('0x6f')][_0x6827('0xb8')]}});})['then'](function(_0x17bc73){socket[_0x6827('0xc4')]('faxInteractionTags:save',{'id':Number(_0x5047d5[_0x6827('0xb1')]['id']),'tags':_0x17bc73||[]});return{'id':Number(_0x5047d5[_0x6827('0xb1')]['id']),'tags':_0x17bc73||[]};});}})[_0x6827('0x2c')](respondWithResult(_0x2ec290,null))[_0x6827('0xb0')](handleError(_0x2ec290,null));};exports[_0x6827('0xc5')]=function(_0x1887bc,_0x2ac671,_0x97e555){return db[_0x6827('0x38')][_0x6827('0x5d')]({'where':{'id':_0x1887bc[_0x6827('0xb1')]['id']}})[_0x6827('0x2c')](handleEntityNotFound(_0x2ac671,null))[_0x6827('0x2c')](function(_0x5b7031){if(_0x5b7031){return _0x5b7031['removeTags'](_0x1887bc['query'][_0x6827('0xb8')]);}})[_0x6827('0x2c')](respondWithStatusCode(_0x2ac671,null))['catch'](handleError(_0x2ac671,null));};exports[_0x6827('0xc6')]=function(_0x58067b,_0x9f33b2){var _0x5d456b=moment()[_0x6827('0xc7')]()['toString']();var _0x2edce8=path['join'](config['root'],_0x6827('0xc8'),_0x6827('0xc9'),'tmp');var _0x300e2a=path[_0x6827('0xca')](config[_0x6827('0xcb')],'server',_0x6827('0xc9'),'attachments');var _0x2e4dd2=path['join'](_0x2edce8,_0x5d456b);var _0x56cab9=util[_0x6827('0xcc')]('transcript-%d-%s.zip',_0x58067b['params']['id'],_0x5d456b);var _0x118d0e=path[_0x6827('0xca')](_0x2edce8,_0x56cab9);var _0x4d0200=[];_0x4d0200[_0x6827('0xad')]({'model':db[_0x6827('0xcd')],'as':'Attachment','raw':!![]});var _0x317ef8=[{'model':db['FaxMessage'],'as':_0x6827('0xce'),'attributes':['id',_0x6827('0x6f'),_0x6827('0xcf')],'include':_0x4d0200}];return db[_0x6827('0x38')][_0x6827('0x5d')]({'where':{'id':_0x58067b[_0x6827('0xb1')]['id']},'include':_0x317ef8})['then'](handleEntityNotFound(_0x9f33b2,null))['then'](function(_0xe137){if(_0xe137&&_0xe137[_0x6827('0xce')]){var _0x41a3cd=_0xe137[_0x6827('0xd0')]({'plain':!![]});fs[_0x6827('0xd1')](_0x2e4dd2);for(var _0x520222=0x0;_0x520222<_0x41a3cd[_0x6827('0xce')]['length'];_0x520222++){var _0x489fa2=_0x41a3cd[_0x6827('0xce')][_0x520222][_0x6827('0xcd')];if(_0x489fa2){var _0x45c822=path[_0x6827('0xca')](_0x300e2a,_0x489fa2[_0x6827('0xd2')]);if(fs[_0x6827('0xd3')](_0x45c822)){fs['createReadStream'](_0x45c822)[_0x6827('0xd4')](fs[_0x6827('0xd5')](path[_0x6827('0xca')](_0x2e4dd2,_0x489fa2[_0x6827('0xd2')])));}}}return BPromise[_0x6827('0x8e')]()[_0x6827('0x2c')](function(){return new BPromise(function(_0x57d155,_0xb2f18){zipdir(_0x2e4dd2,{'saveTo':_0x118d0e},function(_0x5ba605,_0x2f0a75){if(_0x5ba605)return _0xb2f18(_0x5ba605);return _0x57d155(_0x2f0a75);});})[_0x6827('0x2c')](function(){return new BPromise(function(_0x7d7e91,_0x2b7f27){rimraf(_0x2e4dd2,function(_0x4b46ea){if(_0x4b46ea)_0x2b7f27(_0x4b46ea);return _0x7d7e91();});});})[_0x6827('0x2c')](function(){return _0x9f33b2['download'](_0x118d0e,_0x56cab9,function(_0x1b418a){if(_0x1b418a){console[_0x6827('0xd6')](_0x6827('0xd7'),_0x1b418a);}else{fs[_0x6827('0xd8')](_0x118d0e);}});});});}else{return _0x9f33b2[_0x6827('0x1e')](0xc8);}})[_0x6827('0xb0')](handleError(_0x9f33b2,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index de42fe0..df013f1 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 _0x2ae7=['then','setDataValue','Users','map','findAll','unreadMessages','emit','hook','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers'];(function(_0x386185,_0xc5a719){var _0x2bf6da=function(_0x122e04){while(--_0x122e04){_0x386185['push'](_0x386185['shift']());}};_0x2bf6da(++_0xc5a719);}(_0x2ae7,0xbc));var _0x72ae=function(_0x14f22c,_0x541368){_0x14f22c=_0x14f22c-0x0;var _0x2f0312=_0x2ae7[_0x14f22c];return _0x2f0312;};'use strict';var EventEmitter=require(_0x72ae('0x0'));var FaxInteraction=require(_0x72ae('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x72ae('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x72ae('0x2')](0x0);var events={'afterCreate':_0x72ae('0x3'),'afterUpdate':_0x72ae('0x4'),'afterDestroy':_0x72ae('0x5')};function emitEvent(_0x21719e){return function(_0x108978,_0x419283,_0x170b4d){_0x108978[_0x72ae('0x6')]({'attributes':['id'],'raw':!![]})[_0x72ae('0x7')](function(_0x2ec452){_0x108978[_0x72ae('0x8')](_0x72ae('0x9'),_0x2ec452[_0x72ae('0xa')](function(_0x586014){return{'id':_0x586014['id']};}));return FaxMessage[_0x72ae('0xb')]({'where':{'FaxInteractionId':_0x108978['id'],'direction':'in','read':![]},'raw':!![]});})[_0x72ae('0x7')](function(_0x2cae91){_0x108978['setDataValue'](_0x72ae('0xc'),_0x2cae91['length']);FaxInteractionEvents[_0x72ae('0xd')](_0x21719e+':'+_0x108978['id'],_0x108978);FaxInteractionEvents[_0x72ae('0xd')](_0x21719e,_0x108978);_0x170b4d(null);})['catch'](_0x170b4d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x72ae('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x769f=['hook','exports','../../mysqldb','FaxInteraction','FaxMessage','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x57d56c,_0x4dd016){var _0x5845ec=function(_0x162ff0){while(--_0x162ff0){_0x57d56c['push'](_0x57d56c['shift']());}};_0x5845ec(++_0x4dd016);}(_0x769f,0x19a));var _0xf769=function(_0x240069,_0x2f7ccc){_0x240069=_0x240069-0x0;var _0x1ff577=_0x769f[_0x240069];return _0x1ff577;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xf769('0x0'))['db'][_0xf769('0x1')];var FaxMessage=require(_0xf769('0x0'))['db'][_0xf769('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf769('0x3'),'afterDestroy':_0xf769('0x4')};function emitEvent(_0x515afc){return function(_0x442950,_0xd92cd2,_0x45c3cf){_0x442950['getUsers']({'attributes':['id'],'raw':!![]})[_0xf769('0x5')](function(_0x429677){_0x442950['setDataValue'](_0xf769('0x6'),_0x429677[_0xf769('0x7')](function(_0x36e29c){return{'id':_0x36e29c['id']};}));return FaxMessage[_0xf769('0x8')]({'where':{'FaxInteractionId':_0x442950['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf769('0x5')](function(_0x196335){_0x442950[_0xf769('0x9')](_0xf769('0xa'),_0x196335[_0xf769('0xb')]);FaxInteractionEvents['emit'](_0x515afc+':'+_0x442950['id'],_0x442950);FaxInteractionEvents[_0xf769('0xc')](_0x515afc,_0x442950);_0x45c3cf(null);})[_0xf769('0xd')](_0x45c3cf(null));};}for(var e in events){if(events[_0xf769('0xe')](e)){var event=events[e];FaxInteraction[_0xf769('0xf')](e,emitEvent(event));}}module[_0xf769('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index e30482c..44ae94c 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 _0xc1af=['FaxInteraction','changed','closed','closedAt','format','lodash','api','./faxInteraction.attributes','exports','define'];(function(_0xa66538,_0x2218c4){var _0x5244be=function(_0x9f824b){while(--_0x9f824b){_0xa66538['push'](_0xa66538['shift']());}};_0x5244be(++_0x2218c4);}(_0xc1af,0x181));var _0xfc1a=function(_0xf9d405,_0x15a9b3){_0xf9d405=_0xf9d405-0x0;var _0xa9df59=_0xc1af[_0xf9d405];return _0xa9df59;};'use strict';var _=require(_0xfc1a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfc1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfc1a('0x2'));module[_0xfc1a('0x3')]=function(_0x4d7fd7,_0x325c54){return _0x4d7fd7[_0xfc1a('0x4')](_0xfc1a('0x5'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f524c,_0x5bdc24,_0x3b7905){if(_0x4f524c[_0xfc1a('0x6')](_0xfc1a('0x7'))){_0x4f524c[_0xfc1a('0x8')]=moment()[_0xfc1a('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3b7905(null,_0x4f524c);}}});}; \ No newline at end of file +var _0x1c01=['api','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','format','lodash','util','../../config/logger'];(function(_0x393438,_0x4883a6){var _0x2a0986=function(_0x15a93b){while(--_0x15a93b){_0x393438['push'](_0x393438['shift']());}};_0x2a0986(++_0x4883a6);}(_0x1c01,0x190));var _0x11c0=function(_0x2da036,_0x152925){_0x2da036=_0x2da036-0x0;var _0x41e84c=_0x1c01[_0x2da036];return _0x41e84c;};'use strict';var _=require(_0x11c0('0x0'));var util=require(_0x11c0('0x1'));var logger=require(_0x11c0('0x2'))(_0x11c0('0x3'));var moment=require('moment');var BPromise=require(_0x11c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11c0('0x5'));var config=require(_0x11c0('0x6'));var attributes=require(_0x11c0('0x7'));module[_0x11c0('0x8')]=function(_0x38c591,_0x5190a4){return _0x38c591[_0x11c0('0x9')]('FaxInteraction',attributes,{'tableName':_0x11c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x558a37,_0x127b2f,_0x5e7e01){if(_0x558a37[_0x11c0('0xb')]('closed')){_0x558a37['closedAt']=moment()[_0x11c0('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5e7e01(null,_0x558a37);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9213354..971acc3 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 _0xd8e4=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','request\x20sent','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','addTags','ids','omit','spread','AddTags','util','moment'];(function(_0x5d89bd,_0x197698){var _0x6eefc5=function(_0x354558){while(--_0x354558){_0x5d89bd['push'](_0x5d89bd['shift']());}};_0x6eefc5(++_0x197698);}(_0xd8e4,0xfa));var _0x4d8e=function(_0x3cb2b7,_0x2338b6){_0x3cb2b7=_0x3cb2b7-0x0;var _0xac954a=_0xd8e4[_0x3cb2b7];return _0xac954a;};'use strict';var _=require('lodash');var util=require(_0x4d8e('0x0'));var moment=require(_0x4d8e('0x1'));var BPromise=require(_0x4d8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d8e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d8e('0x4'));var logger=require(_0x4d8e('0x5'))(_0x4d8e('0x6'));var config=require(_0x4d8e('0x7'));var jayson=require(_0x4d8e('0x8'));var client=jayson[_0x4d8e('0x9')][_0x4d8e('0xa')]({'port':0x232a});config['redis']=_[_0x4d8e('0xb')](config[_0x4d8e('0xc')],{'host':_0x4d8e('0xd'),'port':0x18eb});var socket=require(_0x4d8e('0xe'))(new Redis(config['redis']));require(_0x4d8e('0xf'))[_0x4d8e('0x10')](socket);function respondWithRpcPromise(_0x431612,_0xc360a5,_0x27a8e0){return new BPromise(function(_0x4dda9c,_0x20993b){return client[_0x4d8e('0x11')](_0x431612,_0x27a8e0)[_0x4d8e('0x12')](function(_0x50421d){logger[_0x4d8e('0x13')]('FaxInteraction,\x20%s,\x20%s',_0xc360a5,'request\x20sent');logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xc360a5,'request\x20sent',JSON[_0x4d8e('0x14')](_0x50421d));if(_0x50421d[_0x4d8e('0x15')]){if(_0x50421d['error'][_0x4d8e('0x16')]===0x1f4){logger[_0x4d8e('0x15')](_0x4d8e('0x17'),_0xc360a5,_0x50421d[_0x4d8e('0x15')][_0x4d8e('0x18')]);return _0x20993b(_0x50421d['error']['message']);}logger[_0x4d8e('0x15')](_0x4d8e('0x17'),_0xc360a5,_0x50421d[_0x4d8e('0x15')][_0x4d8e('0x18')]);return _0x4dda9c(_0x50421d[_0x4d8e('0x15')][_0x4d8e('0x18')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0xc360a5,_0x4d8e('0x19'));_0x4dda9c(_0x50421d['result'][_0x4d8e('0x18')]);}})[_0x4d8e('0x1a')](function(_0x31650a){logger[_0x4d8e('0x15')](_0x4d8e('0x17'),_0xc360a5,_0x31650a);_0x20993b(_0x31650a);});});}exports[_0x4d8e('0x1b')]=function(_0x4015bb){var _0x400f42=this;return new Promise(function(_0x5f29df,_0x19ddfa){return db[_0x4d8e('0x1c')]['update'](_0x4015bb[_0x4d8e('0x1d')],{'raw':_0x4015bb[_0x4d8e('0x1e')]?_0x4015bb[_0x4d8e('0x1e')][_0x4d8e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4015bb[_0x4d8e('0x1e')]?_0x4015bb['options'][_0x4d8e('0x20')]||null:null,'attributes':_0x4015bb[_0x4d8e('0x1e')]?_0x4015bb[_0x4d8e('0x1e')][_0x4d8e('0x21')]||null:null,'limit':_0x4015bb[_0x4d8e('0x1e')]?_0x4015bb[_0x4d8e('0x1e')][_0x4d8e('0x22')]||null:null})['then'](function(_0x5b3e22){logger[_0x4d8e('0x13')](_0x4d8e('0x1b'),_0x4015bb);logger[_0x4d8e('0x23')](_0x4d8e('0x1b'),_0x4015bb,JSON['stringify'](_0x5b3e22));_0x5f29df(_0x5b3e22);})[_0x4d8e('0x1a')](function(_0x866e70){logger[_0x4d8e('0x15')](_0x4d8e('0x1b'),_0x866e70['message'],_0x4015bb);_0x19ddfa(_0x400f42[_0x4d8e('0x15')](0x1f4,_0x866e70[_0x4d8e('0x18')]));});});};exports[_0x4d8e('0x24')]=function(_0x1b0346){return new Promise(function(_0x53c019,_0x11a808){return db[_0x4d8e('0x1c')]['find']({'where':_0x1b0346[_0x4d8e('0x1e')]?_0x1b0346[_0x4d8e('0x1e')][_0x4d8e('0x20')]||null:null})['then'](function(_0x1f93cb){if(_0x1f93cb){return _0x1f93cb[_0x4d8e('0x25')](_0x1b0346[_0x4d8e('0x1d')][_0x4d8e('0x26')],_[_0x4d8e('0x27')](_0x1b0346[_0x4d8e('0x1d')],[_0x4d8e('0x26'),'id'])||{});}})[_0x4d8e('0x28')](function(_0x441b65){logger[_0x4d8e('0x13')](_0x4d8e('0x29'),_0x1b0346);logger['debug'](_0x4d8e('0x29'),_0x1b0346,JSON[_0x4d8e('0x14')](_0x441b65));_0x53c019(_0x441b65);})[_0x4d8e('0x1a')](function(_0x212112){logger[_0x4d8e('0x15')](_0x4d8e('0x29'),_0x212112[_0x4d8e('0x18')],_0x1b0346);_0x11a808(_this['error'](0x1f4,_0x212112['message']));});});}; \ No newline at end of file +var _0x29a1=['stringify','error','message','info','catch','FaxInteraction','update','body','options','raw','where','limit','debug','UpdateFaxInteraction','AddTagsToFaxInteraction','find','ids','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2d60bb,_0x4228ea){var _0x1e7b8e=function(_0x1a8ff8){while(--_0x1a8ff8){_0x2d60bb['push'](_0x2d60bb['shift']());}};_0x1e7b8e(++_0x4228ea);}(_0x29a1,0x124));var _0x129a=function(_0x1bb37b,_0x3a0b2e){_0x1bb37b=_0x1bb37b-0x0;var _0x4bf524=_0x29a1[_0x1bb37b];return _0x4bf524;};'use strict';var _=require('lodash');var util=require(_0x129a('0x0'));var moment=require(_0x129a('0x1'));var BPromise=require(_0x129a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x129a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x129a('0x4'));var logger=require(_0x129a('0x5'))(_0x129a('0x6'));var config=require(_0x129a('0x7'));var jayson=require(_0x129a('0x8'));var client=jayson[_0x129a('0x9')]['http']({'port':0x232a});config[_0x129a('0xa')]=_[_0x129a('0xb')](config['redis'],{'host':_0x129a('0xc'),'port':0x18eb});var socket=require(_0x129a('0xd'))(new Redis(config['redis']));require(_0x129a('0xe'))['register'](socket);function respondWithRpcPromise(_0xb489c5,_0x10fc46,_0x40cf93){return new BPromise(function(_0x44e8b6,_0x59d7aa){return client[_0x129a('0xf')](_0xb489c5,_0x40cf93)[_0x129a('0x10')](function(_0x469652){logger['info'](_0x129a('0x11'),_0x10fc46,_0x129a('0x12'));logger['debug'](_0x129a('0x13'),_0x10fc46,'request\x20sent',JSON[_0x129a('0x14')](_0x469652));if(_0x469652[_0x129a('0x15')]){if(_0x469652['error']['code']===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x10fc46,_0x469652['error'][_0x129a('0x16')]);return _0x59d7aa(_0x469652['error']['message']);}logger[_0x129a('0x15')](_0x129a('0x11'),_0x10fc46,_0x469652[_0x129a('0x15')]['message']);return _0x44e8b6(_0x469652[_0x129a('0x15')][_0x129a('0x16')]);}else{logger[_0x129a('0x17')](_0x129a('0x11'),_0x10fc46,_0x129a('0x12'));_0x44e8b6(_0x469652['result'][_0x129a('0x16')]);}})[_0x129a('0x18')](function(_0x55d3eb){logger[_0x129a('0x15')](_0x129a('0x11'),_0x10fc46,_0x55d3eb);_0x59d7aa(_0x55d3eb);});});}exports['UpdateFaxInteraction']=function(_0x27f0d0){var _0x287794=this;return new Promise(function(_0x17ce45,_0x53ebad){return db[_0x129a('0x19')][_0x129a('0x1a')](_0x27f0d0[_0x129a('0x1b')],{'raw':_0x27f0d0[_0x129a('0x1c')]?_0x27f0d0[_0x129a('0x1c')][_0x129a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f0d0[_0x129a('0x1c')]?_0x27f0d0[_0x129a('0x1c')][_0x129a('0x1e')]||null:null,'attributes':_0x27f0d0[_0x129a('0x1c')]?_0x27f0d0[_0x129a('0x1c')]['attributes']||null:null,'limit':_0x27f0d0[_0x129a('0x1c')]?_0x27f0d0[_0x129a('0x1c')][_0x129a('0x1f')]||null:null})[_0x129a('0x10')](function(_0x40fb08){logger['info']('UpdateFaxInteraction',_0x27f0d0);logger[_0x129a('0x20')](_0x129a('0x21'),_0x27f0d0,JSON[_0x129a('0x14')](_0x40fb08));_0x17ce45(_0x40fb08);})[_0x129a('0x18')](function(_0x400c4d){logger[_0x129a('0x15')](_0x129a('0x21'),_0x400c4d['message'],_0x27f0d0);_0x53ebad(_0x287794[_0x129a('0x15')](0x1f4,_0x400c4d[_0x129a('0x16')]));});});};exports[_0x129a('0x22')]=function(_0x4f8c60){return new Promise(function(_0xb47227,_0x1f42b3){return db[_0x129a('0x19')][_0x129a('0x23')]({'where':_0x4f8c60[_0x129a('0x1c')]?_0x4f8c60[_0x129a('0x1c')][_0x129a('0x1e')]||null:null})[_0x129a('0x10')](function(_0x42e74c){if(_0x42e74c){return _0x42e74c['addTags'](_0x4f8c60[_0x129a('0x1b')][_0x129a('0x24')],_['omit'](_0x4f8c60['body'],[_0x129a('0x24'),'id'])||{});}})[_0x129a('0x25')](function(_0x42feb4){logger[_0x129a('0x17')](_0x129a('0x26'),_0x4f8c60);logger['debug'](_0x129a('0x26'),_0x4f8c60,JSON[_0x129a('0x14')](_0x42feb4));_0xb47227(_0x42feb4);})['catch'](function(_0x21bb84){logger[_0x129a('0x15')](_0x129a('0x26'),_0x21bb84['message'],_0x4f8c60);_0x1f42b3(_this['error'](0x1f4,_0x21bb84[_0x129a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6099b9b..a7e0771 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 _0x469f=['faxInteraction:','./faxInteraction.events','save','remove','update','register'];(function(_0x26f61b,_0x528f6a){var _0x30b294=function(_0x36514a){while(--_0x36514a){_0x26f61b['push'](_0x26f61b['shift']());}};_0x30b294(++_0x528f6a);}(_0x469f,0x12d));var _0xf469=function(_0x5c9291,_0x3bd434){_0x5c9291=_0x5c9291-0x0;var _0x2c0404=_0x469f[_0x5c9291];return _0x2c0404;};'use strict';var FaxInteractionEvents=require(_0xf469('0x0'));var events=[_0xf469('0x1'),_0xf469('0x2'),_0xf469('0x3')];function createListener(_0x461c41,_0x59bfbd){return function(_0x58eb8a){_0x59bfbd['emit'](_0x461c41,_0x58eb8a);};}function removeListener(_0x24d2ff,_0x281744){return function(){FaxInteractionEvents['removeListener'](_0x24d2ff,_0x281744);};}exports[_0xf469('0x4')]=function(_0x55eb78){for(var _0x1f4f9c=0x0,_0x4dbdd5=events['length'];_0x1f4f9c<_0x4dbdd5;_0x1f4f9c++){var _0x1ebf83=events[_0x1f4f9c];var _0x19a941=createListener(_0xf469('0x5')+_0x1ebf83,_0x55eb78);FaxInteractionEvents['on'](_0x1ebf83,_0x19a941);}}; \ No newline at end of file +var _0xe60a=['remove','emit','removeListener','length','./faxInteraction.events','save'];(function(_0x3a1433,_0x47d601){var _0x4fb3b3=function(_0x6b5200){while(--_0x6b5200){_0x3a1433['push'](_0x3a1433['shift']());}};_0x4fb3b3(++_0x47d601);}(_0xe60a,0x166));var _0xae60=function(_0x4e252b,_0x5d5a41){_0x4e252b=_0x4e252b-0x0;var _0x4f4940=_0xe60a[_0x4e252b];return _0x4f4940;};'use strict';var FaxInteractionEvents=require(_0xae60('0x0'));var events=[_0xae60('0x1'),_0xae60('0x2'),'update'];function createListener(_0x2a1a9b,_0x234e49){return function(_0x17df7d){_0x234e49[_0xae60('0x3')](_0x2a1a9b,_0x17df7d);};}function removeListener(_0x29e28b,_0x1c1d53){return function(){FaxInteractionEvents[_0xae60('0x4')](_0x29e28b,_0x1c1d53);};}exports['register']=function(_0x1435ff){for(var _0x16b2ba=0x0,_0x446858=events[_0xae60('0x5')];_0x16b2ba<_0x446858;_0x16b2ba++){var _0x22bd5c=events[_0x16b2ba];var _0x5e135a=createListener('faxInteraction:'+_0x22bd5c,_0x1435ff);FaxInteractionEvents['on'](_0x22bd5c,_0x5e135a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index a9cd2b4..e5dcae2 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 _0xbb08=['download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xbb08,0xd0));var _0x8bb0=function(_0x13d24a,_0x2ebe78){_0x13d24a=_0x13d24a-0x0;var _0x5100d6=_0xbb08[_0x13d24a];return _0x5100d6;};'use strict';var multer=require(_0x8bb0('0x0'));var util=require('util');var path=require(_0x8bb0('0x1'));var timeout=require(_0x8bb0('0x2'));var express=require('express');var router=express[_0x8bb0('0x3')]();var fs_extra=require(_0x8bb0('0x4'));var auth=require(_0x8bb0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8bb0('0x6'));var controller=require(_0x8bb0('0x7'));router['get']('/',auth[_0x8bb0('0x8')](),controller['index']);router[_0x8bb0('0x9')](_0x8bb0('0xa'),auth[_0x8bb0('0x8')](),controller[_0x8bb0('0xb')]);router[_0x8bb0('0x9')](_0x8bb0('0xc'),auth[_0x8bb0('0x8')](),controller[_0x8bb0('0xd')]);router[_0x8bb0('0x9')](_0x8bb0('0xe'),auth[_0x8bb0('0x8')](),controller[_0x8bb0('0xf')]);router[_0x8bb0('0x9')]('/:id/download',auth[_0x8bb0('0x8')](),controller[_0x8bb0('0x10')]);router['post']('/',auth[_0x8bb0('0x8')](),controller[_0x8bb0('0x11')]);router[_0x8bb0('0x12')](_0x8bb0('0xe'),auth[_0x8bb0('0x8')](),controller[_0x8bb0('0x13')]);router[_0x8bb0('0x12')](_0x8bb0('0x14'),auth[_0x8bb0('0x8')](),interaction[_0x8bb0('0x15')](_0x8bb0('0x16'),_0x8bb0('0x17')),controller[_0x8bb0('0x18')]);router[_0x8bb0('0x19')](_0x8bb0('0xc'),auth[_0x8bb0('0x8')](),interaction['tracked']('fax',_0x8bb0('0x1a')),controller[_0x8bb0('0x1b')]);router[_0x8bb0('0x1c')](_0x8bb0('0xc'),auth[_0x8bb0('0x8')](),interaction[_0x8bb0('0x15')](_0x8bb0('0x16'),_0x8bb0('0x1d')),controller['destroy']);router[_0x8bb0('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8bb0('0x1e')]);module[_0x8bb0('0x1f')]=router; \ No newline at end of file +var _0x3e03=['describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','put','faxinteraction:update','update','delete','fax','faxinteraction:destroy','destroy','removeTags','exports','multer','util','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x4221d8,_0x341fe7){var _0x626640=function(_0x2ca98e){while(--_0x2ca98e){_0x4221d8['push'](_0x4221d8['shift']());}};_0x626640(++_0x341fe7);}(_0x3e03,0xc2));var _0x33e0=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x3e03[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0x33e0('0x0'));var util=require(_0x33e0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x33e0('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x33e0('0x3'));var controller=require(_0x33e0('0x4'));router[_0x33e0('0x5')]('/',auth[_0x33e0('0x6')](),controller[_0x33e0('0x7')]);router['get'](_0x33e0('0x8'),auth['isAuthenticated'](),controller[_0x33e0('0x9')]);router[_0x33e0('0x5')](_0x33e0('0xa'),auth[_0x33e0('0x6')](),controller[_0x33e0('0xb')]);router[_0x33e0('0x5')](_0x33e0('0xc'),auth[_0x33e0('0x6')](),controller[_0x33e0('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x33e0('0xe')]('/',auth[_0x33e0('0x6')](),controller[_0x33e0('0xf')]);router['post'](_0x33e0('0xc'),auth['isAuthenticated'](),controller[_0x33e0('0x10')]);router[_0x33e0('0xe')](_0x33e0('0x11'),auth[_0x33e0('0x6')](),interaction[_0x33e0('0x12')]('fax',_0x33e0('0x13')),controller['addTags']);router[_0x33e0('0x14')](_0x33e0('0xa'),auth['isAuthenticated'](),interaction[_0x33e0('0x12')]('fax',_0x33e0('0x15')),controller[_0x33e0('0x16')]);router[_0x33e0('0x17')](_0x33e0('0xa'),auth[_0x33e0('0x6')](),interaction[_0x33e0('0x12')](_0x33e0('0x18'),_0x33e0('0x19')),controller[_0x33e0('0x1a')]);router[_0x33e0('0x17')](_0x33e0('0x11'),auth[_0x33e0('0x6')](),controller[_0x33e0('0x1b')]);module[_0x33e0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7329c32..864c070 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 _0xecd5=['ENUM','out','exports','TEXT','medium'];(function(_0x1a8b4c,_0x208280){var _0x120322=function(_0x523234){while(--_0x523234){_0x1a8b4c['push'](_0x1a8b4c['shift']());}};_0x120322(++_0x208280);}(_0xecd5,0x110));var _0x5ecd=function(_0x33deab,_0x19af91){_0x33deab=_0x33deab-0x0;var _0x5a9e14=_0xecd5[_0x33deab];return _0x5a9e14;};'use strict';var Sequelize=require('sequelize');module[_0x5ecd('0x0')]={'body':{'type':Sequelize[_0x5ecd('0x1')](_0x5ecd('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5ecd('0x3')]('in',_0x5ecd('0x4')),'defaultValue':_0x5ecd('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5ecd('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xe2cc=['sequelize','exports','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x527852,_0x43efba){var _0x584d6f=function(_0x137c8b){while(--_0x137c8b){_0x527852['push'](_0x527852['shift']());}};_0x584d6f(++_0x43efba);}(_0xe2cc,0x69));var _0xce2c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe2cc[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xce2c('0x0'));module[_0xce2c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xce2c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xce2c('0x3')]('in',_0xce2c('0x4')),'defaultValue':_0xce2c('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xce2c('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xce2c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 08cf417..e1bce90 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 _0xf67c=['Content-Range','apply','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','find','describe','fax-interactions','fax','read','readAt','format','UserId','agent','get','FaxInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','event','accept','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','Sequelize','User','SIP/%s','motionChannel','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','sendStatus','end','status','json','undefined','limit','count','offset','set'];(function(_0x1eb6f5,_0x53144c){var _0x50c06d=function(_0x166fcd){while(--_0x166fcd){_0x1eb6f5['push'](_0x1eb6f5['shift']());}};_0x50c06d(++_0x53144c);}(_0xf67c,0x17b));var _0xcf67=function(_0x4c5d7e,_0x30195){_0x4c5d7e=_0x4c5d7e-0x0;var _0x2e3337=_0xf67c[_0x4c5d7e];return _0x2e3337;};'use strict';var emlformat=require(_0xcf67('0x0'));var rimraf=require(_0xcf67('0x1'));var zipdir=require(_0xcf67('0x2'));var jsonpatch=require(_0xcf67('0x3'));var rp=require(_0xcf67('0x4'));var moment=require(_0xcf67('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcf67('0x6'));var util=require(_0xcf67('0x7'));var path=require(_0xcf67('0x8'));var sox=require('sox');var csv=require(_0xcf67('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf67('0xa'));var _=require(_0xcf67('0xb'));var squel=require('squel');var crypto=require(_0xcf67('0xc'));var jsforce=require(_0xcf67('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcf67('0x9'));var querystring=require(_0xcf67('0xe'));var Papa=require(_0xcf67('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcf67('0x10'));var as=require(_0xcf67('0x11'));var hardwareService=require(_0xcf67('0x12'));var logger=require(_0xcf67('0x13'))(_0xcf67('0x14'));var utils=require(_0xcf67('0x15'));var config=require(_0xcf67('0x16'));var licenseUtil=require(_0xcf67('0x17'));var db=require('../../mysqldb')['db'];config[_0xcf67('0x18')]=_[_0xcf67('0x19')](config[_0xcf67('0x18')],{'host':_0xcf67('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf67('0x18')]));require(_0xcf67('0x1b'))[_0xcf67('0x1c')](socket);var jayson=require(_0xcf67('0x1d'));var client=jayson[_0xcf67('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0xcf67('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xce9eef,_0x156651,_0x5d1453,_0x230f01){return new BPromise(function(_0x2b9566,_0x5c3d83){var _0x94d2c4=_0x230f01||client;return _0x94d2c4[_0xcf67('0x20')](_0xce9eef,_0x5d1453)[_0xcf67('0x21')](function(_0x542d99){logger['info'](_0xcf67('0x22'),_0x156651,_0xcf67('0x23'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x156651,_0xcf67('0x23'),JSON[_0xcf67('0x24')](_0x542d99));if(_0x542d99[_0xcf67('0x25')]){if(_0x542d99['error']['code']===0x1f4){logger[_0xcf67('0x25')](_0xcf67('0x22'),_0x156651,_0x542d99[_0xcf67('0x25')][_0xcf67('0x26')]);return _0x5c3d83(_0x542d99[_0xcf67('0x25')][_0xcf67('0x26')]);}logger[_0xcf67('0x25')](_0xcf67('0x22'),_0x156651,_0x542d99[_0xcf67('0x25')][_0xcf67('0x26')]);return _0x2b9566(_0x542d99[_0xcf67('0x25')][_0xcf67('0x26')]);}else{logger[_0xcf67('0x27')](_0xcf67('0x22'),_0x156651,_0xcf67('0x23'));_0x2b9566(_0x542d99['result'][_0xcf67('0x26')]);}})[_0xcf67('0x28')](function(_0x3fea9a){logger[_0xcf67('0x25')]('FaxMessage,\x20%s,\x20%s',_0x156651,_0x3fea9a);_0x5c3d83(_0x3fea9a);});});}function respondWithStatusCode(_0x878735,_0xffd07f){_0xffd07f=_0xffd07f||0xcc;return function(_0x74c260){if(_0x74c260){return _0x878735[_0xcf67('0x29')](_0xffd07f);}return _0x878735['status'](_0xffd07f)[_0xcf67('0x2a')]();};}function respondWithResult(_0x57b09b,_0x1907aa){_0x1907aa=_0x1907aa||0xc8;return function(_0x45006a){if(_0x45006a){return _0x57b09b[_0xcf67('0x2b')](_0x1907aa)[_0xcf67('0x2c')](_0x45006a);}};}function respondWithFilteredResult(_0x3aeb0f,_0x14f7cb){return function(_0x4235d5){if(_0x4235d5){var _0x4c0fc3=typeof _0x14f7cb['offset']===_0xcf67('0x2d')&&typeof _0x14f7cb[_0xcf67('0x2e')]===_0xcf67('0x2d');var _0x5f1510=_0x4235d5[_0xcf67('0x2f')];var _0x20897d=_0x4c0fc3?0x0:_0x14f7cb[_0xcf67('0x30')];var _0x31ac05=_0x4c0fc3?_0x4235d5[_0xcf67('0x2f')]:_0x14f7cb[_0xcf67('0x30')]+_0x14f7cb['limit'];var _0x14759d;if(_0x31ac05>=_0x5f1510){_0x31ac05=_0x5f1510;_0x14759d=0xc8;}else{_0x14759d=0xce;}_0x3aeb0f[_0xcf67('0x2b')](_0x14759d);return _0x3aeb0f[_0xcf67('0x31')](_0xcf67('0x32'),_0x20897d+'-'+_0x31ac05+'/'+_0x5f1510)['json'](_0x4235d5);}return null;};}function patchUpdates(_0x2c3e91){return function(_0x4ce1f2){try{jsonpatch[_0xcf67('0x33')](_0x4ce1f2,_0x2c3e91,!![]);}catch(_0x532ed7){return BPromise['reject'](_0x532ed7);}return _0x4ce1f2[_0xcf67('0x34')]();};}function saveUpdates(_0x56fa32,_0x8838e7){return function(_0x305be9){if(_0x305be9){return _0x305be9[_0xcf67('0x35')](_0x56fa32)[_0xcf67('0x21')](function(_0x2f07c2){return _0x2f07c2;});}return null;};}function removeEntity(_0x472cbb,_0x5df94a){return function(_0x37df8d){if(_0x37df8d){return _0x37df8d[_0xcf67('0x36')]()[_0xcf67('0x21')](function(){_0x472cbb[_0xcf67('0x2b')](0xcc)[_0xcf67('0x2a')]();});}};}function handleEntityNotFound(_0x595417,_0x27a07b){return function(_0x579493){if(!_0x579493){_0x595417[_0xcf67('0x29')](0x194);}return _0x579493;};}function handleError(_0xb71f4d,_0x4eef70){_0x4eef70=_0x4eef70||0x1f4;return function(_0x2f33d6){logger['error'](_0x2f33d6[_0xcf67('0x37')]);if(_0x2f33d6[_0xcf67('0x38')]){delete _0x2f33d6[_0xcf67('0x38')];}_0xb71f4d['status'](_0x4eef70)[_0xcf67('0x39')](_0x2f33d6);};}exports[_0xcf67('0x3a')]=function(_0x23ecee,_0x416ca4){var _0x165cfd={},_0x589feb={},_0x15ff95={'count':0x0,'rows':[]};var _0x410fca=_[_0xcf67('0x3b')](db[_0xcf67('0x3c')][_0xcf67('0x3d')],function(_0x5da173){return{'name':_0x5da173[_0xcf67('0x3e')],'type':_0x5da173['type']['key']};});_0x589feb[_0xcf67('0x3f')]=_[_0xcf67('0x3b')](_0x410fca,_0xcf67('0x38'));_0x589feb[_0xcf67('0x40')]=_[_0xcf67('0x41')](_0x23ecee['query']);_0x589feb['filters']=_['intersection'](_0x589feb['model'],_0x589feb[_0xcf67('0x40')]);_0x165cfd['attributes']=_[_0xcf67('0x42')](_0x589feb[_0xcf67('0x3f')],qs[_0xcf67('0x43')](_0x23ecee['query']['fields']));_0x165cfd[_0xcf67('0x44')]=_0x165cfd[_0xcf67('0x44')][_0xcf67('0x45')]?_0x165cfd[_0xcf67('0x44')]:_0x589feb['model'];if(!_0x23ecee[_0xcf67('0x40')][_0xcf67('0x46')]('nolimit')){_0x165cfd[_0xcf67('0x2e')]=qs[_0xcf67('0x2e')](_0x23ecee[_0xcf67('0x40')][_0xcf67('0x2e')]);_0x165cfd[_0xcf67('0x30')]=qs[_0xcf67('0x30')](_0x23ecee[_0xcf67('0x40')]['offset']);}_0x165cfd[_0xcf67('0x47')]=qs['sort'](_0x23ecee[_0xcf67('0x40')][_0xcf67('0x48')]);_0x165cfd[_0xcf67('0x49')]=qs[_0xcf67('0x4a')](_[_0xcf67('0x4b')](_0x23ecee[_0xcf67('0x40')],_0x589feb['filters']),_0x410fca);if(_0x23ecee[_0xcf67('0x40')][_0xcf67('0x4c')]){_0x165cfd[_0xcf67('0x49')]=_[_0xcf67('0x4d')](_0x165cfd[_0xcf67('0x49')],{'$or':_[_0xcf67('0x3b')](_0x410fca,function(_0x2adb32){if(_0x2adb32[_0xcf67('0x4e')]!==_0xcf67('0x4f')){var _0x2d0101={};_0x2d0101[_0x2adb32['name']]={'$like':'%'+_0x23ecee[_0xcf67('0x40')][_0xcf67('0x4c')]+'%'};return _0x2d0101;}})});}_0x165cfd=_[_0xcf67('0x4d')]({},_0x165cfd,_0x23ecee[_0xcf67('0x50')]);var _0x585194={'where':_0x165cfd[_0xcf67('0x49')]};return db[_0xcf67('0x3c')][_0xcf67('0x2f')](_0x585194)['then'](function(_0x247e18){_0x15ff95[_0xcf67('0x2f')]=_0x247e18;if(_0x23ecee[_0xcf67('0x40')][_0xcf67('0x51')]){_0x165cfd[_0xcf67('0x52')]=[{'all':!![]}];}return db[_0xcf67('0x3c')][_0xcf67('0x53')](_0x165cfd);})[_0xcf67('0x21')](function(_0x325d48){_0x15ff95[_0xcf67('0x54')]=_0x325d48;return _0x15ff95;})[_0xcf67('0x21')](respondWithFilteredResult(_0x416ca4,_0x165cfd))['catch'](handleError(_0x416ca4,null));};exports[_0xcf67('0x55')]=function(_0x36b499,_0x29f24c){var _0xe74155={'raw':!![],'where':{'id':_0x36b499[_0xcf67('0x56')]['id']}},_0x2ac5f5={};_0x2ac5f5[_0xcf67('0x3f')]=_[_0xcf67('0x41')](db[_0xcf67('0x3c')]['rawAttributes']);_0x2ac5f5[_0xcf67('0x40')]=_[_0xcf67('0x41')](_0x36b499['query']);_0x2ac5f5[_0xcf67('0x4a')]=_[_0xcf67('0x42')](_0x2ac5f5['model'],_0x2ac5f5[_0xcf67('0x40')]);_0xe74155['attributes']=_[_0xcf67('0x42')](_0x2ac5f5[_0xcf67('0x3f')],qs[_0xcf67('0x43')](_0x36b499['query'][_0xcf67('0x43')]));_0xe74155[_0xcf67('0x44')]=_0xe74155['attributes'][_0xcf67('0x45')]?_0xe74155[_0xcf67('0x44')]:_0x2ac5f5['model'];if(_0x36b499['query'][_0xcf67('0x51')]){_0xe74155[_0xcf67('0x52')]=[{'all':!![]}];}_0xe74155=_[_0xcf67('0x4d')]({},_0xe74155,_0x36b499[_0xcf67('0x50')]);return db['FaxMessage']['find'](_0xe74155)[_0xcf67('0x21')](handleEntityNotFound(_0x29f24c,null))[_0xcf67('0x21')](respondWithResult(_0x29f24c,null))[_0xcf67('0x28')](handleError(_0x29f24c,null));};exports[_0xcf67('0x35')]=function(_0x4f5e96,_0x32325b){if(_0x4f5e96[_0xcf67('0x57')]['id']){delete _0x4f5e96[_0xcf67('0x57')]['id'];}return db[_0xcf67('0x3c')]['find']({'where':{'id':_0x4f5e96[_0xcf67('0x56')]['id']}})[_0xcf67('0x21')](handleEntityNotFound(_0x32325b,null))[_0xcf67('0x21')](saveUpdates(_0x4f5e96['body'],null))['then'](respondWithResult(_0x32325b,null))[_0xcf67('0x28')](handleError(_0x32325b,null));};exports[_0xcf67('0x36')]=function(_0x4944e2,_0x3d2cea){return db[_0xcf67('0x3c')][_0xcf67('0x58')]({'where':{'id':_0x4944e2[_0xcf67('0x56')]['id']}})[_0xcf67('0x21')](handleEntityNotFound(_0x3d2cea,null))['then'](removeEntity(_0x3d2cea,null))[_0xcf67('0x28')](handleError(_0x3d2cea,null));};exports[_0xcf67('0x59')]=function(_0x43186f,_0x3f4a9a){return db['FaxMessage']['describe']()[_0xcf67('0x21')](respondWithResult(_0x3f4a9a,null))[_0xcf67('0x28')](handleError(_0x3f4a9a,null));};var interaction_log=require(_0xcf67('0x13'))(_0xcf67('0x5a'));exports['accept']=function(_0xfc0f5,_0x3cf9f8,_0x4664f2){var _0x1cfc77={'agent':{},'channel':_0xcf67('0x5b')};if(_0xfc0f5[_0xcf67('0x57')]['id']){delete _0xfc0f5[_0xcf67('0x57')]['id'];}_0xfc0f5[_0xcf67('0x57')][_0xcf67('0x5c')]=!![];_0xfc0f5[_0xcf67('0x57')][_0xcf67('0x5d')]=moment()[_0xcf67('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0xfc0f5[_0xcf67('0x57')][_0xcf67('0x5f')]=_0xfc0f5[_0xcf67('0x57')][_0xcf67('0x5f')]||_0xfc0f5['user']['id'];_0x1cfc77[_0xcf67('0x60')]['id']=_0xfc0f5[_0xcf67('0x57')][_0xcf67('0x5f')];return db[_0xcf67('0x3c')][_0xcf67('0x58')]({'where':{'id':_0xfc0f5['params']['id'],'UserId':null}})[_0xcf67('0x21')](handleEntityNotFound(_0x3cf9f8,null))[_0xcf67('0x21')](saveUpdates(_0xfc0f5[_0xcf67('0x57')],null))[_0xcf67('0x21')](function(_0x5dd7e1){if(_0x5dd7e1){_0x1cfc77[_0xcf67('0x26')]=_0x5dd7e1[_0xcf67('0x61')]({'plain':!![]});return db[_0xcf67('0x62')]['find']({'where':{'id':_0x5dd7e1['FaxInteractionId']}});}return null;})[_0xcf67('0x21')](handleEntityNotFound(_0x3cf9f8,null))[_0xcf67('0x21')](function(_0x13c14f){if(_0x13c14f){return _0x13c14f[_0xcf67('0x35')]({'UserId':_0xfc0f5[_0xcf67('0x57')]['UserId'],'read1stAt':_[_0xcf67('0x63')](_0x13c14f[_0xcf67('0x64')])?moment()[_0xcf67('0x5e')](_0xcf67('0x65')):undefined});}return null;})['then'](function(_0x3cfd4c){if(_0x3cfd4c){_0x1cfc77[_0xcf67('0x66')]=_0x3cfd4c[_0xcf67('0x61')]({'plain':!![]});interaction_log[_0xcf67('0x27')](_0xcf67('0x67'),_0xfc0f5[_0xcf67('0x68')]['id'],_0xfc0f5['user'][_0xcf67('0x38')],_0xfc0f5[_0xcf67('0x68')][_0xcf67('0x69')],_0x1cfc77[_0xcf67('0x66')]['id'],_0xfc0f5[_0xcf67('0x57')]?JSON[_0xcf67('0x24')](_0xfc0f5[_0xcf67('0x57')]):_0xcf67('0x6a'));return respondWithRpcPromise(_0xcf67('0x6b'),'acceptMessage',_0x1cfc77);}return null;})['then'](function(_0x25c18a){var _0x510b67=_0xcf67('0x6c')+_0x25c18a[_0xcf67('0x26')][_0xcf67('0x6d')];return db[_0xcf67('0x6e')][_0xcf67('0x40')](_0x510b67,{'type':db['Sequelize'][_0xcf67('0x6f')][_0xcf67('0x70')],'raw':!![]})[_0xcf67('0x21')](function(_0x532eb2){return _0x532eb2;});})[_0xcf67('0x21')](function(_0x53b4b1){if(_0x53b4b1){_0x1cfc77['message'][_0xcf67('0x71')]=_0x53b4b1[0x0];if(!_0xfc0f5[_0xcf67('0x57')][_0xcf67('0x5f')])return;return db['User'][_0xcf67('0x58')]({'where':{'id':_0xfc0f5[_0xcf67('0x57')][_0xcf67('0x5f')],'role':_0xcf67('0x60')},'attributes':['id',_0xcf67('0x38'),_0xcf67('0x72'),_0xcf67('0x73'),_0xcf67('0x74')],'raw':!![]});}return null;})[_0xcf67('0x21')](function(_0x9791c8){if(!_0x9791c8)return null;_0x1cfc77['message']['agent']=_0x9791c8;return _0x1cfc77;})[_0xcf67('0x21')](function(_0x2cf36f){if(_0x2cf36f){if(_0xfc0f5[_0xcf67('0x57')][_0xcf67('0x75')]){_0x1cfc77[_0xcf67('0x26')][_0xcf67('0x76')]=util[_0xcf67('0x5e')]('SIP/%s',_0xfc0f5[_0xcf67('0x68')]['name']);_0x1cfc77[_0xcf67('0x26')][_0xcf67('0x77')]=_0x1cfc77[_0xcf67('0x77')];_0x1cfc77[_0xcf67('0x26')]['motionChannel']=_0x1cfc77['channel'];_0x1cfc77[_0xcf67('0x26')][_0xcf67('0x78')]=_0xcf67('0x79');return respondWithRpcPromise(_0xcf67('0x7a'),_0xcf67('0x7a'),{'event':_0xcf67('0x7b'),'message':_0x1cfc77[_0xcf67('0x26')]},client9002)[_0xcf67('0x21')](function(){return _0x1cfc77;});}return _0x1cfc77;}return null;})['then'](respondWithResult(_0x3cf9f8,null))['catch'](handleError(_0x3cf9f8,null));};var interaction_log=require('../../config/logger')(_0xcf67('0x5a'));exports['reject']=function(_0x8a84ec,_0x17a935,_0x4f141f){var _0x4a8469={'agent':{},'channel':_0xcf67('0x5b')};if(_0x8a84ec[_0xcf67('0x57')]['id']){delete _0x8a84ec[_0xcf67('0x57')]['id'];}_0x8a84ec[_0xcf67('0x57')][_0xcf67('0x5f')]=_0x8a84ec['body'][_0xcf67('0x5f')]||_0x8a84ec[_0xcf67('0x68')]['id'];_0x4a8469[_0xcf67('0x60')]['id']=_0x8a84ec[_0xcf67('0x57')][_0xcf67('0x5f')];return db[_0xcf67('0x3c')][_0xcf67('0x58')]({'where':{'id':_0x8a84ec[_0xcf67('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x17a935,null))['then'](function(_0x507d9c){if(_0x507d9c){_0x4a8469[_0xcf67('0x26')]=_0x507d9c[_0xcf67('0x61')]({'plain':!![]});return db[_0xcf67('0x62')][_0xcf67('0x58')]({'where':{'id':_0x507d9c[_0xcf67('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x17a935,null))['then'](function(_0x504cb9){if(_0x504cb9){_0x4a8469[_0xcf67('0x66')]=_0x504cb9[_0xcf67('0x61')]({'plain':!![]});interaction_log['info'](_0xcf67('0x7d'),_0x8a84ec['user']['id'],_0x8a84ec[_0xcf67('0x68')]['name'],_0x8a84ec[_0xcf67('0x68')][_0xcf67('0x69')],_0x4a8469['interaction']['id'],_0x8a84ec['body']?JSON[_0xcf67('0x24')](_0x8a84ec['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4a8469);}return null;})[_0xcf67('0x21')](function(_0x3438d8){var _0x1c2929=_0xcf67('0x6c')+_0x3438d8[_0xcf67('0x26')][_0xcf67('0x6d')];return db[_0xcf67('0x6e')][_0xcf67('0x40')](_0x1c2929,{'type':db[_0xcf67('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})[_0xcf67('0x21')](function(_0xf74c09){return _0xf74c09;});})[_0xcf67('0x21')](function(_0x6d8648){if(_0x6d8648){_0x4a8469[_0xcf67('0x26')][_0xcf67('0x71')]=_0x6d8648[0x0];if(!_0x8a84ec[_0xcf67('0x57')][_0xcf67('0x5f')])return;return db[_0xcf67('0x7f')][_0xcf67('0x58')]({'where':{'id':_0x8a84ec['body'][_0xcf67('0x5f')],'role':_0xcf67('0x60')},'attributes':['id','name','fullname',_0xcf67('0x73'),_0xcf67('0x74')],'raw':!![]});}return null;})[_0xcf67('0x21')](function(_0x3e8659){if(!_0x3e8659)return null;_0x4a8469[_0xcf67('0x26')][_0xcf67('0x60')]=_0x3e8659;return _0x4a8469;})['then'](function(_0x220d9e){if(_0x220d9e){_0x220d9e[_0xcf67('0x26')][_0xcf67('0x76')]=util[_0xcf67('0x5e')](_0xcf67('0x80'),_0x8a84ec[_0xcf67('0x68')][_0xcf67('0x38')]);_0x220d9e[_0xcf67('0x26')][_0xcf67('0x77')]=_0x4a8469[_0xcf67('0x77')];_0x220d9e[_0xcf67('0x26')][_0xcf67('0x81')]=_0x4a8469[_0xcf67('0x77')];_0x220d9e[_0xcf67('0x26')][_0xcf67('0x78')]='reject';respondWithRpcPromise(_0xcf67('0x7a'),_0xcf67('0x7a'),{'event':_0xcf67('0x82'),'message':_0x220d9e[_0xcf67('0x26')]},client9002);return _0x4a8469;}return null;})[_0xcf67('0x21')](respondWithResult(_0x17a935,null))[_0xcf67('0x28')](handleError(_0x17a935,null));};exports['create']=function(_0x990a1d,_0x1c97de){var _0x4f5e17;return db[_0xcf67('0x3c')][_0xcf67('0x83')](_0x990a1d[_0xcf67('0x57')],{})[_0xcf67('0x21')](function(_0x496c75){_0x4f5e17=_0x496c75;return db['CmContact'][_0xcf67('0x84')]({'where':{'id':_0x4f5e17[_0xcf67('0x6d')]}});})[_0xcf67('0x21')](function(_0x304653){if(_[_0xcf67('0x63')](_0x304653)){return;}else{_0x4f5e17['fax']=_0x304653[_0xcf67('0x5b')];return db[_0xcf67('0x85')][_0xcf67('0x84')]({'where':{'id':_0x4f5e17[_0xcf67('0x86')]}});}})[_0xcf67('0x21')](function(_0x40ef70){return respondWithRpcPromise(_0xcf67('0x87'),_0xcf67('0x87'),{'FaxAccountId':_[_0xcf67('0x63')](_0x990a1d[_0xcf67('0x57')])?undefined:_0x990a1d[_0xcf67('0x57')][_0xcf67('0x88')],'path':_['isNil'](_0x40ef70)?undefined:util[_0xcf67('0x5e')](_0xcf67('0x89'),_0x40ef70[_0xcf67('0x8a')]),'fax':_[_0xcf67('0x63')](_0x4f5e17['fax'])?undefined:_0x4f5e17[_0xcf67('0x5b')],'AttachmentId':_0x4f5e17[_0xcf67('0x86')]},client9002);})[_0xcf67('0x21')](respondWithResult(_0x1c97de,0xc9))[_0xcf67('0x28')](handleError(_0x1c97de,null));};exports[_0xcf67('0x8b')]=function(_0x24578e,_0x206477){var _0x54e5a2=path[_0xcf67('0x8c')](config[_0xcf67('0x8d')],_0xcf67('0x8e'),'files','attachments');return db['FaxMessage'][_0xcf67('0x58')]({'where':{'id':_0x24578e[_0xcf67('0x56')]['id']},'include':[{'model':db[_0xcf67('0x85')],'as':'Attachment'}]})[_0xcf67('0x21')](handleEntityNotFound(_0x206477,null))[_0xcf67('0x21')](function(_0x5c2b22){if(_0x5c2b22){return _0x206477['download'](path[_0xcf67('0x8c')](_0x54e5a2,_0x5c2b22[_0xcf67('0x85')][_0xcf67('0x8a')]));}})['catch'](handleError(_0x206477,null));}; \ No newline at end of file +var _0x77fc=['client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','undefined','offset','count','limit','status','set','Content-Range','apply','save','update','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','include','findAll','show','params','includeAll','find','body','describe','fax','readAt','format','user','UserId','get','FaxInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','AcceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','agent','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','User','internal','create','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','root','files','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77fc,0xfb));var _0xc77f=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x77fc[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0xc77f('0x0'));var rimraf=require(_0xc77f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc77f('0x2'));var rp=require('request-promise');var moment=require(_0xc77f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc77f('0x4'));var util=require(_0xc77f('0x5'));var path=require(_0xc77f('0x6'));var sox=require(_0xc77f('0x7'));var csv=require(_0xc77f('0x8'));var ejs=require(_0xc77f('0x9'));var fs=require('fs');var fs_extra=require(_0xc77f('0xa'));var _=require(_0xc77f('0xb'));var squel=require(_0xc77f('0xc'));var crypto=require('crypto');var jsforce=require(_0xc77f('0xd'));var deskjs=require(_0xc77f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc77f('0xf'));var Redis=require(_0xc77f('0x10'));var authService=require(_0xc77f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc77f('0x12'));var hardwareService=require(_0xc77f('0x13'));var logger=require(_0xc77f('0x14'))('api');var utils=require(_0xc77f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc77f('0x16'));var db=require(_0xc77f('0x17'))['db'];config[_0xc77f('0x18')]=_[_0xc77f('0x19')](config[_0xc77f('0x18')],{'host':_0xc77f('0x1a'),'port':0x18eb});var socket=require(_0xc77f('0x1b'))(new Redis(config[_0xc77f('0x18')]));require(_0xc77f('0x1c'))[_0xc77f('0x1d')](socket);var jayson=require(_0xc77f('0x1e'));var client=jayson[_0xc77f('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0xc77f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x508c4d,_0x4520c0,_0x4f973e,_0x1bf47d){return new BPromise(function(_0x1cdff7,_0x22db5c){var _0xf91e65=_0x1bf47d||client;return _0xf91e65['request'](_0x508c4d,_0x4f973e)[_0xc77f('0x21')](function(_0x5cc53f){logger[_0xc77f('0x22')](_0xc77f('0x23'),_0x4520c0,_0xc77f('0x24'));logger[_0xc77f('0x25')](_0xc77f('0x26'),_0x4520c0,_0xc77f('0x24'),JSON[_0xc77f('0x27')](_0x5cc53f));if(_0x5cc53f[_0xc77f('0x28')]){if(_0x5cc53f[_0xc77f('0x28')]['code']===0x1f4){logger[_0xc77f('0x28')]('FaxMessage,\x20%s,\x20%s',_0x4520c0,_0x5cc53f[_0xc77f('0x28')][_0xc77f('0x29')]);return _0x22db5c(_0x5cc53f['error'][_0xc77f('0x29')]);}logger[_0xc77f('0x28')](_0xc77f('0x23'),_0x4520c0,_0x5cc53f['error']['message']);return _0x1cdff7(_0x5cc53f[_0xc77f('0x28')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x4520c0,_0xc77f('0x24'));_0x1cdff7(_0x5cc53f[_0xc77f('0x2a')][_0xc77f('0x29')]);}})[_0xc77f('0x2b')](function(_0x453c4b){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4520c0,_0x453c4b);_0x22db5c(_0x453c4b);});});}function respondWithStatusCode(_0x35e253,_0x2750ea){_0x2750ea=_0x2750ea||0xcc;return function(_0xa3cc1b){if(_0xa3cc1b){return _0x35e253[_0xc77f('0x2c')](_0x2750ea);}return _0x35e253['status'](_0x2750ea)[_0xc77f('0x2d')]();};}function respondWithResult(_0x4cd1b7,_0x3cc933){_0x3cc933=_0x3cc933||0xc8;return function(_0x46c7ea){if(_0x46c7ea){return _0x4cd1b7['status'](_0x3cc933)[_0xc77f('0x2e')](_0x46c7ea);}};}function respondWithFilteredResult(_0x2c7216,_0x1813b5){return function(_0x18d420){if(_0x18d420){var _0x2265f6=typeof _0x1813b5['offset']===_0xc77f('0x2f')&&typeof _0x1813b5['limit']==='undefined';var _0x1cb7aa=_0x18d420['count'];var _0x55e826=_0x2265f6?0x0:_0x1813b5[_0xc77f('0x30')];var _0x57f0b9=_0x2265f6?_0x18d420[_0xc77f('0x31')]:_0x1813b5[_0xc77f('0x30')]+_0x1813b5[_0xc77f('0x32')];var _0x4077d9;if(_0x57f0b9>=_0x1cb7aa){_0x57f0b9=_0x1cb7aa;_0x4077d9=0xc8;}else{_0x4077d9=0xce;}_0x2c7216[_0xc77f('0x33')](_0x4077d9);return _0x2c7216[_0xc77f('0x34')](_0xc77f('0x35'),_0x55e826+'-'+_0x57f0b9+'/'+_0x1cb7aa)[_0xc77f('0x2e')](_0x18d420);}return null;};}function patchUpdates(_0x3c7c20){return function(_0x470c79){try{jsonpatch[_0xc77f('0x36')](_0x470c79,_0x3c7c20,!![]);}catch(_0x286755){return BPromise['reject'](_0x286755);}return _0x470c79[_0xc77f('0x37')]();};}function saveUpdates(_0x25d7bc,_0x5a36ae){return function(_0x192c32){if(_0x192c32){return _0x192c32[_0xc77f('0x38')](_0x25d7bc)[_0xc77f('0x21')](function(_0x37830d){return _0x37830d;});}return null;};}function removeEntity(_0x2f8f93,_0x43b269){return function(_0x4e0b78){if(_0x4e0b78){return _0x4e0b78[_0xc77f('0x39')]()[_0xc77f('0x21')](function(){_0x2f8f93[_0xc77f('0x33')](0xcc)[_0xc77f('0x2d')]();});}};}function handleEntityNotFound(_0x227d76,_0x36da8f){return function(_0x28e855){if(!_0x28e855){_0x227d76[_0xc77f('0x2c')](0x194);}return _0x28e855;};}function handleError(_0x130a25,_0x10d2c7){_0x10d2c7=_0x10d2c7||0x1f4;return function(_0x32fa47){logger[_0xc77f('0x28')](_0x32fa47[_0xc77f('0x3a')]);if(_0x32fa47[_0xc77f('0x3b')]){delete _0x32fa47[_0xc77f('0x3b')];}_0x130a25['status'](_0x10d2c7)['send'](_0x32fa47);};}exports[_0xc77f('0x3c')]=function(_0x1d89ac,_0x398221){var _0x17f948={},_0x2fd740={},_0x5b70a5={'count':0x0,'rows':[]};var _0x557255=_[_0xc77f('0x3d')](db[_0xc77f('0x3e')][_0xc77f('0x3f')],function(_0x4c46d7){return{'name':_0x4c46d7[_0xc77f('0x40')],'type':_0x4c46d7['type'][_0xc77f('0x41')]};});_0x2fd740[_0xc77f('0x42')]=_['map'](_0x557255,_0xc77f('0x3b'));_0x2fd740['query']=_[_0xc77f('0x43')](_0x1d89ac[_0xc77f('0x44')]);_0x2fd740['filters']=_[_0xc77f('0x45')](_0x2fd740['model'],_0x2fd740[_0xc77f('0x44')]);_0x17f948[_0xc77f('0x46')]=_['intersection'](_0x2fd740['model'],qs[_0xc77f('0x47')](_0x1d89ac[_0xc77f('0x44')]['fields']));_0x17f948[_0xc77f('0x46')]=_0x17f948['attributes'][_0xc77f('0x48')]?_0x17f948[_0xc77f('0x46')]:_0x2fd740[_0xc77f('0x42')];if(!_0x1d89ac[_0xc77f('0x44')][_0xc77f('0x49')](_0xc77f('0x4a'))){_0x17f948[_0xc77f('0x32')]=qs[_0xc77f('0x32')](_0x1d89ac[_0xc77f('0x44')][_0xc77f('0x32')]);_0x17f948[_0xc77f('0x30')]=qs['offset'](_0x1d89ac['query']['offset']);}_0x17f948[_0xc77f('0x4b')]=qs[_0xc77f('0x4c')](_0x1d89ac[_0xc77f('0x44')][_0xc77f('0x4c')]);_0x17f948[_0xc77f('0x4d')]=qs[_0xc77f('0x4e')](_[_0xc77f('0x4f')](_0x1d89ac['query'],_0x2fd740[_0xc77f('0x4e')]),_0x557255);if(_0x1d89ac[_0xc77f('0x44')][_0xc77f('0x50')]){_0x17f948['where']=_[_0xc77f('0x51')](_0x17f948[_0xc77f('0x4d')],{'$or':_[_0xc77f('0x3d')](_0x557255,function(_0x134201){if(_0x134201[_0xc77f('0x52')]!=='VIRTUAL'){var _0x241a8e={};_0x241a8e[_0x134201[_0xc77f('0x3b')]]={'$like':'%'+_0x1d89ac[_0xc77f('0x44')][_0xc77f('0x50')]+'%'};return _0x241a8e;}})});}_0x17f948=_['merge']({},_0x17f948,_0x1d89ac[_0xc77f('0x53')]);var _0x1fc477={'where':_0x17f948[_0xc77f('0x4d')]};return db[_0xc77f('0x3e')]['count'](_0x1fc477)[_0xc77f('0x21')](function(_0x544085){_0x5b70a5[_0xc77f('0x31')]=_0x544085;if(_0x1d89ac[_0xc77f('0x44')]['includeAll']){_0x17f948[_0xc77f('0x54')]=[{'all':!![]}];}return db[_0xc77f('0x3e')][_0xc77f('0x55')](_0x17f948);})[_0xc77f('0x21')](function(_0xd1f706){_0x5b70a5['rows']=_0xd1f706;return _0x5b70a5;})[_0xc77f('0x21')](respondWithFilteredResult(_0x398221,_0x17f948))['catch'](handleError(_0x398221,null));};exports[_0xc77f('0x56')]=function(_0x30e779,_0x34a12b){var _0x1f25b4={'raw':!![],'where':{'id':_0x30e779[_0xc77f('0x57')]['id']}},_0x3b296f={};_0x3b296f[_0xc77f('0x42')]=_[_0xc77f('0x43')](db[_0xc77f('0x3e')][_0xc77f('0x3f')]);_0x3b296f[_0xc77f('0x44')]=_[_0xc77f('0x43')](_0x30e779[_0xc77f('0x44')]);_0x3b296f[_0xc77f('0x4e')]=_[_0xc77f('0x45')](_0x3b296f[_0xc77f('0x42')],_0x3b296f[_0xc77f('0x44')]);_0x1f25b4[_0xc77f('0x46')]=_[_0xc77f('0x45')](_0x3b296f[_0xc77f('0x42')],qs['fields'](_0x30e779[_0xc77f('0x44')]['fields']));_0x1f25b4[_0xc77f('0x46')]=_0x1f25b4[_0xc77f('0x46')][_0xc77f('0x48')]?_0x1f25b4[_0xc77f('0x46')]:_0x3b296f[_0xc77f('0x42')];if(_0x30e779['query'][_0xc77f('0x58')]){_0x1f25b4['include']=[{'all':!![]}];}_0x1f25b4=_[_0xc77f('0x51')]({},_0x1f25b4,_0x30e779['options']);return db[_0xc77f('0x3e')][_0xc77f('0x59')](_0x1f25b4)['then'](handleEntityNotFound(_0x34a12b,null))[_0xc77f('0x21')](respondWithResult(_0x34a12b,null))['catch'](handleError(_0x34a12b,null));};exports['update']=function(_0x20e490,_0x17d292){if(_0x20e490[_0xc77f('0x5a')]['id']){delete _0x20e490['body']['id'];}return db[_0xc77f('0x3e')][_0xc77f('0x59')]({'where':{'id':_0x20e490[_0xc77f('0x57')]['id']}})[_0xc77f('0x21')](handleEntityNotFound(_0x17d292,null))[_0xc77f('0x21')](saveUpdates(_0x20e490[_0xc77f('0x5a')],null))[_0xc77f('0x21')](respondWithResult(_0x17d292,null))['catch'](handleError(_0x17d292,null));};exports['destroy']=function(_0x5a1a7a,_0x2d6481){return db[_0xc77f('0x3e')][_0xc77f('0x59')]({'where':{'id':_0x5a1a7a[_0xc77f('0x57')]['id']}})[_0xc77f('0x21')](handleEntityNotFound(_0x2d6481,null))[_0xc77f('0x21')](removeEntity(_0x2d6481,null))['catch'](handleError(_0x2d6481,null));};exports[_0xc77f('0x5b')]=function(_0x1ed60d,_0xf99c72){return db[_0xc77f('0x3e')][_0xc77f('0x5b')]()[_0xc77f('0x21')](respondWithResult(_0xf99c72,null))['catch'](handleError(_0xf99c72,null));};var interaction_log=require(_0xc77f('0x14'))('fax-interactions');exports['accept']=function(_0x11e5ca,_0x4bc14a,_0x35fd28){var _0x45ff75={'agent':{},'channel':_0xc77f('0x5c')};if(_0x11e5ca[_0xc77f('0x5a')]['id']){delete _0x11e5ca[_0xc77f('0x5a')]['id'];}_0x11e5ca[_0xc77f('0x5a')]['read']=!![];_0x11e5ca[_0xc77f('0x5a')][_0xc77f('0x5d')]=moment()[_0xc77f('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x11e5ca[_0xc77f('0x5a')]['UserId']=_0x11e5ca[_0xc77f('0x5a')]['UserId']||_0x11e5ca[_0xc77f('0x5f')]['id'];_0x45ff75['agent']['id']=_0x11e5ca[_0xc77f('0x5a')][_0xc77f('0x60')];return db['FaxMessage'][_0xc77f('0x59')]({'where':{'id':_0x11e5ca[_0xc77f('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4bc14a,null))[_0xc77f('0x21')](saveUpdates(_0x11e5ca['body'],null))[_0xc77f('0x21')](function(_0x1e9799){if(_0x1e9799){_0x45ff75[_0xc77f('0x29')]=_0x1e9799[_0xc77f('0x61')]({'plain':!![]});return db[_0xc77f('0x62')][_0xc77f('0x59')]({'where':{'id':_0x1e9799['FaxInteractionId']}});}return null;})[_0xc77f('0x21')](handleEntityNotFound(_0x4bc14a,null))[_0xc77f('0x21')](function(_0x626331){if(_0x626331){return _0x626331[_0xc77f('0x38')]({'UserId':_0x11e5ca[_0xc77f('0x5a')][_0xc77f('0x60')],'read1stAt':_[_0xc77f('0x63')](_0x626331[_0xc77f('0x64')])?moment()[_0xc77f('0x5e')](_0xc77f('0x65')):undefined});}return null;})[_0xc77f('0x21')](function(_0x2f092c){if(_0x2f092c){_0x45ff75['interaction']=_0x2f092c['get']({'plain':!![]});interaction_log[_0xc77f('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11e5ca[_0xc77f('0x5f')]['id'],_0x11e5ca[_0xc77f('0x5f')][_0xc77f('0x3b')],_0x11e5ca[_0xc77f('0x5f')][_0xc77f('0x66')],_0x45ff75['interaction']['id'],_0x11e5ca[_0xc77f('0x5a')]?JSON[_0xc77f('0x27')](_0x11e5ca[_0xc77f('0x5a')]):'null');return respondWithRpcPromise(_0xc77f('0x67'),'acceptMessage',_0x45ff75);}return null;})[_0xc77f('0x21')](function(_0x263a3b){var _0x4189db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x263a3b[_0xc77f('0x29')][_0xc77f('0x68')];return db['sequelize']['query'](_0x4189db,{'type':db[_0xc77f('0x69')][_0xc77f('0x6a')][_0xc77f('0x6b')],'raw':!![]})['then'](function(_0x5562da){return _0x5562da;});})[_0xc77f('0x21')](function(_0x2a02a5){if(_0x2a02a5){_0x45ff75[_0xc77f('0x29')][_0xc77f('0x6c')]=_0x2a02a5[0x0];if(!_0x11e5ca['body']['UserId'])return;return db['User'][_0xc77f('0x59')]({'where':{'id':_0x11e5ca[_0xc77f('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0xc77f('0x3b'),_0xc77f('0x6d'),_0xc77f('0x6e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x45d62d){if(!_0x45d62d)return null;_0x45ff75[_0xc77f('0x29')][_0xc77f('0x6f')]=_0x45d62d;return _0x45ff75;})['then'](function(_0x22c5db){if(_0x22c5db){if(_0x11e5ca[_0xc77f('0x5a')][_0xc77f('0x70')]){_0x45ff75[_0xc77f('0x29')]['interface']=util[_0xc77f('0x5e')](_0xc77f('0x71'),_0x11e5ca[_0xc77f('0x5f')][_0xc77f('0x3b')]);_0x45ff75[_0xc77f('0x29')][_0xc77f('0x72')]=_0x45ff75[_0xc77f('0x72')];_0x45ff75[_0xc77f('0x29')][_0xc77f('0x73')]=_0x45ff75['channel'];_0x45ff75[_0xc77f('0x29')][_0xc77f('0x74')]=_0xc77f('0x75');return respondWithRpcPromise(_0xc77f('0x76'),_0xc77f('0x76'),{'event':_0xc77f('0x77'),'message':_0x45ff75[_0xc77f('0x29')]},client9002)[_0xc77f('0x21')](function(){return _0x45ff75;});}return _0x45ff75;}return null;})[_0xc77f('0x21')](respondWithResult(_0x4bc14a,null))[_0xc77f('0x2b')](handleError(_0x4bc14a,null));};var interaction_log=require(_0xc77f('0x14'))('fax-interactions');exports[_0xc77f('0x78')]=function(_0x41c309,_0x29d019,_0x127e65){var _0x5d894c={'agent':{},'channel':_0xc77f('0x5c')};if(_0x41c309[_0xc77f('0x5a')]['id']){delete _0x41c309['body']['id'];}_0x41c309[_0xc77f('0x5a')][_0xc77f('0x60')]=_0x41c309['body'][_0xc77f('0x60')]||_0x41c309[_0xc77f('0x5f')]['id'];_0x5d894c[_0xc77f('0x6f')]['id']=_0x41c309[_0xc77f('0x5a')][_0xc77f('0x60')];return db['FaxMessage'][_0xc77f('0x59')]({'where':{'id':_0x41c309[_0xc77f('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x29d019,null))['then'](function(_0x37ad12){if(_0x37ad12){_0x5d894c[_0xc77f('0x29')]=_0x37ad12[_0xc77f('0x61')]({'plain':!![]});return db[_0xc77f('0x62')]['find']({'where':{'id':_0x37ad12['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x29d019,null))[_0xc77f('0x21')](function(_0x4d11d7){if(_0x4d11d7){_0x5d894c[_0xc77f('0x79')]=_0x4d11d7[_0xc77f('0x61')]({'plain':!![]});interaction_log[_0xc77f('0x22')](_0xc77f('0x7a'),_0x41c309[_0xc77f('0x5f')]['id'],_0x41c309[_0xc77f('0x5f')][_0xc77f('0x3b')],_0x41c309['user'][_0xc77f('0x66')],_0x5d894c['interaction']['id'],_0x41c309[_0xc77f('0x5a')]?JSON[_0xc77f('0x27')](_0x41c309[_0xc77f('0x5a')]):_0xc77f('0x7b'));return respondWithRpcPromise(_0xc77f('0x7c'),_0xc77f('0x7d'),_0x5d894c);}return null;})[_0xc77f('0x21')](function(_0x254fef){var _0x317a1a=_0xc77f('0x7e')+_0x254fef[_0xc77f('0x29')][_0xc77f('0x68')];return db[_0xc77f('0x7f')]['query'](_0x317a1a,{'type':db[_0xc77f('0x69')][_0xc77f('0x6a')][_0xc77f('0x6b')],'raw':!![]})[_0xc77f('0x21')](function(_0x58608e){return _0x58608e;});})[_0xc77f('0x21')](function(_0xcbaaba){if(_0xcbaaba){_0x5d894c[_0xc77f('0x29')][_0xc77f('0x6c')]=_0xcbaaba[0x0];if(!_0x41c309[_0xc77f('0x5a')][_0xc77f('0x60')])return;return db[_0xc77f('0x80')][_0xc77f('0x59')]({'where':{'id':_0x41c309['body'][_0xc77f('0x60')],'role':_0xc77f('0x6f')},'attributes':['id',_0xc77f('0x3b'),'fullname',_0xc77f('0x6e'),_0xc77f('0x81')],'raw':!![]});}return null;})[_0xc77f('0x21')](function(_0x19a75a){if(!_0x19a75a)return null;_0x5d894c[_0xc77f('0x29')]['agent']=_0x19a75a;return _0x5d894c;})[_0xc77f('0x21')](function(_0x58a610){if(_0x58a610){_0x58a610[_0xc77f('0x29')]['interface']=util[_0xc77f('0x5e')](_0xc77f('0x71'),_0x41c309[_0xc77f('0x5f')]['name']);_0x58a610[_0xc77f('0x29')]['channel']=_0x5d894c[_0xc77f('0x72')];_0x58a610['message']['motionChannel']=_0x5d894c[_0xc77f('0x72')];_0x58a610[_0xc77f('0x29')][_0xc77f('0x74')]=_0xc77f('0x78');respondWithRpcPromise(_0xc77f('0x76'),_0xc77f('0x76'),{'event':'rejectmessage','message':_0x58a610[_0xc77f('0x29')]},client9002);return _0x5d894c;}return null;})[_0xc77f('0x21')](respondWithResult(_0x29d019,null))[_0xc77f('0x2b')](handleError(_0x29d019,null));};exports[_0xc77f('0x82')]=function(_0x23ec43,_0xb4bf0d){var _0xd5f77b;return db[_0xc77f('0x3e')]['create'](_0x23ec43[_0xc77f('0x5a')],{})[_0xc77f('0x21')](function(_0x360e04){_0xd5f77b=_0x360e04;return db[_0xc77f('0x83')][_0xc77f('0x84')]({'where':{'id':_0xd5f77b[_0xc77f('0x68')]}});})[_0xc77f('0x21')](function(_0x398024){if(_[_0xc77f('0x63')](_0x398024)){return;}else{_0xd5f77b['fax']=_0x398024['fax'];return db[_0xc77f('0x85')]['findOne']({'where':{'id':_0xd5f77b[_0xc77f('0x86')]}});}})[_0xc77f('0x21')](function(_0x2f10d8){return respondWithRpcPromise('SendFax',_0xc77f('0x87'),{'FaxAccountId':_[_0xc77f('0x63')](_0x23ec43[_0xc77f('0x5a')])?undefined:_0x23ec43['body']['FaxAccountId'],'path':_[_0xc77f('0x63')](_0x2f10d8)?undefined:util[_0xc77f('0x5e')](_0xc77f('0x88'),_0x2f10d8[_0xc77f('0x89')]),'fax':_[_0xc77f('0x63')](_0xd5f77b['fax'])?undefined:_0xd5f77b[_0xc77f('0x5c')],'AttachmentId':_0xd5f77b[_0xc77f('0x86')]},client9002);})[_0xc77f('0x21')](respondWithResult(_0xb4bf0d,0xc9))[_0xc77f('0x2b')](handleError(_0xb4bf0d,null));};exports[_0xc77f('0x8a')]=function(_0x257cfd,_0x47e5db){var _0x4758a1=path['join'](config[_0xc77f('0x8b')],'server',_0xc77f('0x8c'),'attachments');return db[_0xc77f('0x3e')][_0xc77f('0x59')]({'where':{'id':_0x257cfd[_0xc77f('0x57')]['id']},'include':[{'model':db[_0xc77f('0x85')],'as':_0xc77f('0x85')}]})[_0xc77f('0x21')](handleEntityNotFound(_0x47e5db,null))[_0xc77f('0x21')](function(_0x1ad6b3){if(_0x1ad6b3){return _0x47e5db['download'](path['join'](_0x4758a1,_0x1ad6b3[_0xc77f('0x85')][_0xc77f('0x89')]));}})[_0xc77f('0x2b')](handleError(_0x47e5db,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a931887..90df3d6 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 _0xe14a=['emit','hasOwnProperty','hook','exports','update','remove'];(function(_0x7a4c3c,_0x5cc32d){var _0x2bd897=function(_0x76c09a){while(--_0x76c09a){_0x7a4c3c['push'](_0x7a4c3c['shift']());}};_0x2bd897(++_0x5cc32d);}(_0xe14a,0x94));var _0xae14=function(_0x25c8bf,_0x117d95){_0x25c8bf=_0x25c8bf-0x0;var _0x2abac9=_0xe14a[_0x25c8bf];return _0x2abac9;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xae14('0x0'),'afterDestroy':_0xae14('0x1')};function emitEvent(_0x5cdfa7){return function(_0x16bd5f,_0x2736f8,_0x2ec016){FaxMessageEvents[_0xae14('0x2')](_0x5cdfa7+':'+_0x16bd5f['id'],_0x16bd5f);FaxMessageEvents[_0xae14('0x2')](_0x5cdfa7,_0x16bd5f);_0x2ec016(null);};}for(var e in events){if(events[_0xae14('0x3')](e)){var event=events[e];FaxMessage[_0xae14('0x4')](e,emitEvent(event));}}module[_0xae14('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0xe056=['hook','exports','FaxMessage','setMaxListeners','save','remove','hasOwnProperty'];(function(_0x4e9b0e,_0x1805e5){var _0x5250ad=function(_0x5df2bc){while(--_0x5df2bc){_0x4e9b0e['push'](_0x4e9b0e['shift']());}};_0x5250ad(++_0x1805e5);}(_0xe056,0xdb));var _0x6e05=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xe056[_0x20589d];return _0x422de9;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x6e05('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6e05('0x1')](0x0);var events={'afterCreate':_0x6e05('0x2'),'afterUpdate':'update','afterDestroy':_0x6e05('0x3')};function emitEvent(_0x518934){return function(_0x13ea30,_0x1bec29,_0x5205e6){FaxMessageEvents['emit'](_0x518934+':'+_0x13ea30['id'],_0x13ea30);FaxMessageEvents['emit'](_0x518934,_0x13ea30);_0x5205e6(null);};}for(var e in events){if(events[_0x6e05('0x4')](e)){var event=events[e];FaxMessage[_0x6e05('0x5')](e,emitEvent(event));}}module[_0x6e05('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 129887d..d31dfe8 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 _0x83cc=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','catch','utf8mb4'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x83cc,0x12a));var _0xc83c=function(_0x455893,_0x909838){_0x455893=_0x455893-0x0;var _0x3851e8=_0x83cc[_0x455893];return _0x3851e8;};'use strict';var _=require(_0xc83c('0x0'));var util=require(_0xc83c('0x1'));var logger=require('../../config/logger')(_0xc83c('0x2'));var moment=require(_0xc83c('0x3'));var BPromise=require(_0xc83c('0x4'));var rp=require(_0xc83c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc83c('0x6'));var config=require(_0xc83c('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x44ea8c,_0x8c8fbb){return _0x44ea8c[_0xc83c('0x8')](_0xc83c('0x9'),attributes,{'tableName':_0xc83c('0xa'),'paranoid':![],'indexes':[{'name':_0xc83c('0xb'),'fields':['body'],'type':_0xc83c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x208f61,_0x246ad9,_0x477d4e){var _0x1b489a=_0x44ea8c[_0xc83c('0xd')];var _0x1b6b3f=_0x208f61[_0xc83c('0xe')]({'plain':!![]});if(_0x1b6b3f[_0xc83c('0xf')]['toLowerCase']()==='in'||_0x1b6b3f['direction'][_0xc83c('0x10')]()===_0xc83c('0x11')&&!_0x1b6b3f[_0xc83c('0x12')]&&!_[_0xc83c('0x13')](_0x1b6b3f[_0xc83c('0x14')])){_0x1b489a[_0xc83c('0x15')][_0xc83c('0x16')]({'where':{'id':_0x1b6b3f[_0xc83c('0x17')]}})['then'](function(_0x4c22ac){if(_0x4c22ac){_0x4c22ac['update']({'lastMsgAt':_0x1b6b3f['createdAt'],'lastMsgDirection':_0x1b6b3f[_0xc83c('0xf')][_0xc83c('0x10')]()});}})[_0xc83c('0x18')](function(_0x4b8287){console['error'](_0x4b8287);});}_0x477d4e();}},'charset':_0xc83c('0x19'),'collate':_0xc83c('0x1a')});}; \ No newline at end of file +var _0x1b79=['path','rimraf','../../config/environment','exports','define','FaxMessage','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','update','createdAt','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise'];(function(_0x21bb01,_0x4988f2){var _0x4a8035=function(_0x1a91f9){while(--_0x1a91f9){_0x21bb01['push'](_0x21bb01['shift']());}};_0x4a8035(++_0x4988f2);}(_0x1b79,0xd4));var _0x91b7=function(_0x187a1c,_0x26dac9){_0x187a1c=_0x187a1c-0x0;var _0x29dd3b=_0x1b79[_0x187a1c];return _0x29dd3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x91b7('0x0'))(_0x91b7('0x1'));var moment=require(_0x91b7('0x2'));var BPromise=require('bluebird');var rp=require(_0x91b7('0x3'));var fs=require('fs');var path=require(_0x91b7('0x4'));var rimraf=require(_0x91b7('0x5'));var config=require(_0x91b7('0x6'));var attributes=require('./faxMessage.attributes');module[_0x91b7('0x7')]=function(_0x7b79d8,_0x527ab1){return _0x7b79d8[_0x91b7('0x8')](_0x91b7('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8c02af,_0x54e726,_0x4d775c){var _0x4b45ab=_0x7b79d8[_0x91b7('0xa')];var _0x1879e3=_0x8c02af[_0x91b7('0xb')]({'plain':!![]});if(_0x1879e3[_0x91b7('0xc')][_0x91b7('0xd')]()==='in'||_0x1879e3[_0x91b7('0xc')][_0x91b7('0xd')]()===_0x91b7('0xe')&&!_0x1879e3[_0x91b7('0xf')]&&!_[_0x91b7('0x10')](_0x1879e3[_0x91b7('0x11')])){_0x4b45ab[_0x91b7('0x12')][_0x91b7('0x13')]({'where':{'id':_0x1879e3['FaxInteractionId']}})['then'](function(_0x5b6d0d){if(_0x5b6d0d){_0x5b6d0d[_0x91b7('0x14')]({'lastMsgAt':_0x1879e3[_0x91b7('0x15')],'lastMsgDirection':_0x1879e3[_0x91b7('0xc')]['toLowerCase']()});}})['catch'](function(_0x1afff5){console['error'](_0x1afff5);});}_0x4d775c();}},'charset':_0x91b7('0x16'),'collate':_0x91b7('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 82b9cf1..36caaf0 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 _0xedd9=['create','body','raw','CreateFaxMessage','catch','FaxMessage','update','options','where','attributes','limit','UpdateFaxMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x22ca3b,_0x54d6ee){var _0x40cf81=function(_0x5a072e){while(--_0x5a072e){_0x22ca3b['push'](_0x22ca3b['shift']());}};_0x40cf81(++_0x54d6ee);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f77f0,_0x1d5022){_0x3f77f0=_0x3f77f0-0x0;var _0x514414=_0xedd9[_0x3f77f0];return _0x514414;};'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});config['redis']=_[_0x9edd('0xc')](config['redis'],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x10'))['register'](socket);function respondWithRpcPromise(_0x494a24,_0x5d2f90,_0x2076fc){return new BPromise(function(_0x138767,_0x523026){return client[_0x9edd('0x11')](_0x494a24,_0x2076fc)[_0x9edd('0x12')](function(_0x5b6c00){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x5d2f90,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x5b6c00));if(_0x5b6c00[_0x9edd('0x19')]){if(_0x5b6c00['error'][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')](_0x9edd('0x14'),_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x523026(_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);}logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x138767(_0x5b6c00[_0x9edd('0x19')]['message']);}else{logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));_0x138767(_0x5b6c00['result'][_0x9edd('0x1b')]);}})['catch'](function(_0x2cdcef){logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x2cdcef);_0x523026(_0x2cdcef);});});}exports['CreateFaxMessage']=function(_0x45c3ab){var _0x50338f=this;return new Promise(function(_0x27a95a,_0x54a03f){return db['FaxMessage'][_0x9edd('0x1c')](_0x45c3ab[_0x9edd('0x1d')],{'raw':_0x45c3ab['options']?_0x45c3ab['options'][_0x9edd('0x1e')]===undefined?!![]:![]:!![]})[_0x9edd('0x12')](function(_0x477878){logger['info'](_0x9edd('0x1f'),_0x45c3ab);logger[_0x9edd('0x16')](_0x9edd('0x1f'),_0x45c3ab,JSON[_0x9edd('0x18')](_0x477878));_0x27a95a(_0x477878);})[_0x9edd('0x20')](function(_0x4c75d2){logger[_0x9edd('0x19')](_0x9edd('0x1f'),_0x4c75d2[_0x9edd('0x1b')],_0x45c3ab);_0x54a03f(_0x50338f[_0x9edd('0x19')](0x1f4,_0x4c75d2[_0x9edd('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x4b3d1b){var _0x3276ee=this;return new Promise(function(_0xfeca7b,_0x8d67aa){return db[_0x9edd('0x21')][_0x9edd('0x22')](_0x4b3d1b['body'],{'raw':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b['options'][_0x9edd('0x24')]||null:null,'attributes':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x25')]||null:null,'limit':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x26')]||null:null})[_0x9edd('0x12')](function(_0x12c1bc){logger[_0x9edd('0x13')](_0x9edd('0x27'),_0x4b3d1b);logger[_0x9edd('0x16')](_0x9edd('0x27'),_0x4b3d1b,JSON[_0x9edd('0x18')](_0x12c1bc));_0xfeca7b(_0x12c1bc);})[_0x9edd('0x20')](function(_0x4fd03f){logger[_0x9edd('0x19')](_0x9edd('0x27'),_0x4fd03f[_0x9edd('0x1b')],_0x4b3d1b);_0x8d67aa(_0x3276ee[_0x9edd('0x19')](0x1f4,_0x4fd03f['message']));});});}; \ No newline at end of file +var _0xe5b3=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','then','info'];(function(_0x224fdf,_0xac4c2c){var _0x452a7d=function(_0x538223){while(--_0x538223){_0x224fdf['push'](_0x224fdf['shift']());}};_0x452a7d(++_0xac4c2c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x44b7bb,_0x460592){_0x44b7bb=_0x44b7bb-0x0;var _0x370e81=_0xe5b3[_0x44b7bb];return _0x370e81;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});config[_0x3e5b('0xc')]=_['defaults'](config[_0x3e5b('0xc')],{'host':_0x3e5b('0xd'),'port':0x18eb});var socket=require(_0x3e5b('0xe'))(new Redis(config[_0x3e5b('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1fef54,_0x3d3b6e,_0x22fc1a){return new BPromise(function(_0x17dee7,_0xeeaabc){return client['request'](_0x1fef54,_0x22fc1a)[_0x3e5b('0xf')](function(_0x52efbd){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,_0x3e5b('0x12'));logger[_0x3e5b('0x13')](_0x3e5b('0x14'),_0x3d3b6e,_0x3e5b('0x12'),JSON[_0x3e5b('0x15')](_0x52efbd));if(_0x52efbd['error']){if(_0x52efbd[_0x3e5b('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd[_0x3e5b('0x16')][_0x3e5b('0x17')]);return _0xeeaabc(_0x52efbd[_0x3e5b('0x16')]['message']);}logger[_0x3e5b('0x16')]('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd['error'][_0x3e5b('0x17')]);return _0x17dee7(_0x52efbd[_0x3e5b('0x16')]['message']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,'request\x20sent');_0x17dee7(_0x52efbd[_0x3e5b('0x18')][_0x3e5b('0x17')]);}})['catch'](function(_0x4b189d){logger[_0x3e5b('0x16')](_0x3e5b('0x11'),_0x3d3b6e,_0x4b189d);_0xeeaabc(_0x4b189d);});});}exports[_0x3e5b('0x19')]=function(_0xff4aba){var _0x24de5b=this;return new Promise(function(_0x1564b5,_0x447d36){return db[_0x3e5b('0x1a')][_0x3e5b('0x1b')](_0xff4aba[_0x3e5b('0x1c')],{'raw':_0xff4aba[_0x3e5b('0x1d')]?_0xff4aba[_0x3e5b('0x1d')][_0x3e5b('0x1e')]===undefined?!![]:![]:!![]})[_0x3e5b('0xf')](function(_0x5b46d4){logger[_0x3e5b('0x10')](_0x3e5b('0x19'),_0xff4aba);logger[_0x3e5b('0x13')](_0x3e5b('0x19'),_0xff4aba,JSON['stringify'](_0x5b46d4));_0x1564b5(_0x5b46d4);})[_0x3e5b('0x1f')](function(_0x5b33bb){logger[_0x3e5b('0x16')](_0x3e5b('0x19'),_0x5b33bb['message'],_0xff4aba);_0x447d36(_0x24de5b[_0x3e5b('0x16')](0x1f4,_0x5b33bb[_0x3e5b('0x17')]));});});};exports[_0x3e5b('0x20')]=function(_0x3c8965){var _0x3bb749=this;return new Promise(function(_0x26c7f2,_0x160e87){return db[_0x3e5b('0x1a')]['update'](_0x3c8965[_0x3e5b('0x1c')],{'raw':_0x3c8965['options']?_0x3c8965[_0x3e5b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x21')]||null:null,'attributes':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x22')]||null:null,'limit':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x23')]||null:null})[_0x3e5b('0xf')](function(_0x1e1565){logger['info'](_0x3e5b('0x20'),_0x3c8965);logger[_0x3e5b('0x13')](_0x3e5b('0x20'),_0x3c8965,JSON[_0x3e5b('0x15')](_0x1e1565));_0x26c7f2(_0x1e1565);})[_0x3e5b('0x1f')](function(_0x31e9f9){logger[_0x3e5b('0x16')]('UpdateFaxMessage',_0x31e9f9[_0x3e5b('0x17')],_0x3c8965);_0x160e87(_0x3bb749['error'](0x1f4,_0x31e9f9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ac70a4b..cb3a6ea 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 _0xd350=['remove','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x5b0d6a,_0x42c4d9){var _0x57d965=function(_0x5b78ac){while(--_0x5b78ac){_0x5b0d6a['push'](_0x5b0d6a['shift']());}};_0x57d965(++_0x42c4d9);}(_0xd350,0xca));var _0x0d35=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xd350[_0x2d2258];return _0x18e155;};'use strict';var FaxMessageEvents=require(_0x0d35('0x0'));var events=['save',_0x0d35('0x1'),'update'];function createListener(_0x44def7,_0x219b30){return function(_0xbf42b1){_0x219b30[_0x0d35('0x2')](_0x44def7,_0xbf42b1);};}function removeListener(_0x4fc099,_0x319607){return function(){FaxMessageEvents[_0x0d35('0x3')](_0x4fc099,_0x319607);};}exports[_0x0d35('0x4')]=function(_0x4c7d70){for(var _0x212a13=0x0,_0x2132d5=events[_0x0d35('0x5')];_0x212a13<_0x2132d5;_0x212a13++){var _0x20ce21=events[_0x212a13];var _0xb7a50c=createListener(_0x0d35('0x6')+_0x20ce21,_0x4c7d70);FaxMessageEvents['on'](_0x20ce21,_0xb7a50c);}}; \ No newline at end of file +var _0x2c6b=['remove','update','emit','removeListener','faxMessage:','./faxMessage.events'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x2c6b,0xd7));var _0xb2c6=function(_0x11a238,_0x1c48fa){_0x11a238=_0x11a238-0x0;var _0x517b53=_0x2c6b[_0x11a238];return _0x517b53;};'use strict';var FaxMessageEvents=require(_0xb2c6('0x0'));var events=['save',_0xb2c6('0x1'),_0xb2c6('0x2')];function createListener(_0x3538ec,_0xe86eff){return function(_0x26b7ce){_0xe86eff[_0xb2c6('0x3')](_0x3538ec,_0x26b7ce);};}function removeListener(_0x43aef3,_0x459fa0){return function(){FaxMessageEvents[_0xb2c6('0x4')](_0x43aef3,_0x459fa0);};}exports['register']=function(_0x4f7fff){for(var _0x24e120=0x0,_0x530726=events['length'];_0x24e120<_0x530726;_0x24e120++){var _0x57f5c2=events[_0x24e120];var _0x40d706=createListener(_0xb2c6('0x5')+_0x57f5c2,_0x4f7fff);FaxMessageEvents['on'](_0x57f5c2,_0x40d706);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 98da527..d047f8d 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 _0xf290=['/:id','show','/:id/download','download','post','fax','create','put','update','accept','/:id/reject','reject','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x299125,_0x30e141){var _0x58ee45=function(_0x48f733){while(--_0x48f733){_0x299125['push'](_0x299125['shift']());}};_0x58ee45(++_0x30e141);}(_0xf290,0xde));var _0x0f29=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0xf290[_0x31b5b2];return _0x364f13;};'use strict';var multer=require('multer');var util=require(_0x0f29('0x0'));var path=require('path');var timeout=require(_0x0f29('0x1'));var express=require('express');var router=express[_0x0f29('0x2')]();var fs_extra=require(_0x0f29('0x3'));var auth=require(_0x0f29('0x4'));var interaction=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var controller=require('./faxMessage.controller');router[_0x0f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f29('0x8')]);router[_0x0f29('0x7')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xb')]);router[_0x0f29('0x7')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xd')]);router[_0x0f29('0x7')](_0x0f29('0xe'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xf')]);router[_0x0f29('0x10')]('/',auth[_0x0f29('0xa')](),interaction['tracked'](_0x0f29('0x11'),'faxmessage:create'),controller[_0x0f29('0x12')]);router[_0x0f29('0x13')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x14')]);router[_0x0f29('0x13')]('/:id/accept',auth[_0x0f29('0xa')](),controller[_0x0f29('0x15')]);router[_0x0f29('0x13')](_0x0f29('0x16'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x17')]);router[_0x0f29('0x18')](_0x0f29('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0f29('0x19')]=router; \ No newline at end of file +var _0xd64b=['tracked','fax','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','/:id/download','post'];(function(_0x30446d,_0x434abc){var _0x19a343=function(_0x4195a1){while(--_0x4195a1){_0x30446d['push'](_0x30446d['shift']());}};_0x19a343(++_0x434abc);}(_0xd64b,0xc1));var _0xbd64=function(_0x1a72e1,_0x1ffbea){_0x1a72e1=_0x1a72e1-0x0;var _0x3c980c=_0xd64b[_0x1a72e1];return _0x3c980c;};'use strict';var multer=require(_0xbd64('0x0'));var util=require('util');var path=require(_0xbd64('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd64('0x2'));var router=express[_0xbd64('0x3')]();var fs_extra=require(_0xbd64('0x4'));var auth=require(_0xbd64('0x5'));var interaction=require(_0xbd64('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd64('0x7')]);router[_0xbd64('0x8')](_0xbd64('0x9'),auth[_0xbd64('0xa')](),controller[_0xbd64('0xb')]);router[_0xbd64('0x8')](_0xbd64('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbd64('0x8')](_0xbd64('0xd'),auth[_0xbd64('0xa')](),controller['download']);router[_0xbd64('0xe')]('/',auth[_0xbd64('0xa')](),interaction[_0xbd64('0xf')](_0xbd64('0x10'),'faxmessage:create'),controller[_0xbd64('0x11')]);router['put'](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0x12')]);router[_0xbd64('0x13')](_0xbd64('0x14'),auth[_0xbd64('0xa')](),controller[_0xbd64('0x15')]);router[_0xbd64('0x13')](_0xbd64('0x16'),auth['isAuthenticated'](),controller[_0xbd64('0x17')]);router[_0xbd64('0x18')](_0xbd64('0xc'),auth[_0xbd64('0xa')](),controller[_0xbd64('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 6c06788..9120bfc 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 _0xc23e=['STRING','name','INTEGER','ENUM','beepall','roundrobin','exports'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xc23e,0x68));var _0xec23=function(_0x63a76c,_0x1f998c){_0x63a76c=_0x63a76c-0x0;var _0x57d3eb=_0xc23e[_0x63a76c];return _0x57d3eb;};'use strict';var Sequelize=require('sequelize');module[_0xec23('0x0')]={'name':{'type':Sequelize[_0xec23('0x1')],'unique':_0xec23('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xec23('0x1')]},'timeout':{'type':Sequelize[_0xec23('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xec23('0x4')]('rrmemory',_0xec23('0x5'),_0xec23('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ad2=['name','INTEGER','beepall','sequelize','exports','STRING'];(function(_0x30a84b,_0x4edbef){var _0x47aaec=function(_0x36a47e){while(--_0x36a47e){_0x30a84b['push'](_0x30a84b['shift']());}};_0x47aaec(++_0x4edbef);}(_0x6ad2,0x159));var _0x26ad=function(_0x547bb6,_0x2d6f27){_0x547bb6=_0x547bb6-0x0;var _0x1a9154=_0x6ad2[_0x547bb6];return _0x1a9154;};'use strict';var Sequelize=require(_0x26ad('0x0'));module[_0x26ad('0x1')]={'name':{'type':Sequelize[_0x26ad('0x2')],'unique':_0x26ad('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x26ad('0x2')]},'timeout':{'type':Sequelize[_0x26ad('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x26ad('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x26ad('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index f01b44d..becf55e 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 _0xf630=['squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','update','destroy','get','FaxQueues','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','FaxQueue','includeAll','include','findAll','rows','catch','show','params','keys','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','getMembers','order','pick','FaxQueueId','UserFaxQueue','User','UserId','createdAt','format','%s/%s','SIP','faxPause','updatedAt','getTeams','findOne','Team','addTeams','ids','online','interface','flatMap','Agents','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','includes','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x556005,_0x3105bd){var _0x113def=function(_0x551537){while(--_0x551537){_0x556005['push'](_0x556005['shift']());}};_0x113def(++_0x3105bd);}(_0xf630,0x19d));var _0x0f63=function(_0x2abe6c,_0xf74f56){_0x2abe6c=_0x2abe6c-0x0;var _0x4a7db1=_0xf630[_0x2abe6c];return _0x4a7db1;};'use strict';var emlformat=require(_0x0f63('0x0'));var rimraf=require(_0x0f63('0x1'));var zipdir=require(_0x0f63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f63('0x3'));var moment=require(_0x0f63('0x4'));var BPromise=require(_0x0f63('0x5'));var Mustache=require(_0x0f63('0x6'));var util=require('util');var path=require(_0x0f63('0x7'));var sox=require(_0x0f63('0x8'));var csv=require('to-csv');var ejs=require(_0x0f63('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0f63('0xa'));var crypto=require(_0x0f63('0xb'));var jsforce=require(_0x0f63('0xc'));var deskjs=require(_0x0f63('0xd'));var toCsv=require(_0x0f63('0xe'));var querystring=require('querystring');var Papa=require(_0x0f63('0xf'));var Redis=require(_0x0f63('0x10'));var authService=require(_0x0f63('0x11'));var qs=require(_0x0f63('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f63('0x13'));var logger=require(_0x0f63('0x14'))(_0x0f63('0x15'));var utils=require('../../config/utils');var config=require(_0x0f63('0x16'));var licenseUtil=require(_0x0f63('0x17'));var db=require(_0x0f63('0x18'))['db'];config[_0x0f63('0x19')]=_['defaults'](config['redis'],{'host':_0x0f63('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f63('0x19')]));require(_0x0f63('0x1b'))[_0x0f63('0x1c')](socket);function respondWithStatusCode(_0x3fe954,_0x4c09dd){_0x4c09dd=_0x4c09dd||0xcc;return function(_0x1050de){if(_0x1050de){return _0x3fe954[_0x0f63('0x1d')](_0x4c09dd);}return _0x3fe954[_0x0f63('0x1e')](_0x4c09dd)[_0x0f63('0x1f')]();};}function respondWithResult(_0x1475c2,_0x2379cc){_0x2379cc=_0x2379cc||0xc8;return function(_0x563b84){if(_0x563b84){return _0x1475c2[_0x0f63('0x1e')](_0x2379cc)['json'](_0x563b84);}};}function respondWithFilteredResult(_0x567319,_0x2ad82d){return function(_0x1d75ac){if(_0x1d75ac){var _0x57dbc8=typeof _0x2ad82d[_0x0f63('0x20')]===_0x0f63('0x21')&&typeof _0x2ad82d['limit']===_0x0f63('0x21');var _0x2515e2=_0x1d75ac[_0x0f63('0x22')];var _0x5f1eae=_0x57dbc8?0x0:_0x2ad82d[_0x0f63('0x20')];var _0x2ad1a1=_0x57dbc8?_0x1d75ac[_0x0f63('0x22')]:_0x2ad82d[_0x0f63('0x20')]+_0x2ad82d[_0x0f63('0x23')];var _0x14f6ec;if(_0x2ad1a1>=_0x2515e2){_0x2ad1a1=_0x2515e2;_0x14f6ec=0xc8;}else{_0x14f6ec=0xce;}_0x567319['status'](_0x14f6ec);return _0x567319['set'](_0x0f63('0x24'),_0x5f1eae+'-'+_0x2ad1a1+'/'+_0x2515e2)[_0x0f63('0x25')](_0x1d75ac);}return null;};}function patchUpdates(_0x3b0632){return function(_0x1037bf){try{jsonpatch['apply'](_0x1037bf,_0x3b0632,!![]);}catch(_0x1de58a){return BPromise[_0x0f63('0x26')](_0x1de58a);}return _0x1037bf[_0x0f63('0x27')]();};}function saveUpdates(_0x50bff2,_0x429d4d){return function(_0xbf5604){if(_0xbf5604){return _0xbf5604[_0x0f63('0x28')](_0x50bff2)['then'](function(_0xf98bad){return _0xf98bad;});}return null;};}function removeEntity(_0x4b682a,_0x25fd95){return function(_0x1b2559){if(_0x1b2559){return _0x1b2559[_0x0f63('0x29')]()['then'](function(){var _0x11cf0b=_0x1b2559[_0x0f63('0x2a')]({'plain':!![]});var _0x399305=_0x0f63('0x2b');return db[_0x0f63('0x2c')]['destroy']({'where':{'type':_0x399305,'resourceId':_0x11cf0b['id']}})[_0x0f63('0x2d')](function(){return _0x1b2559;});})['then'](function(){_0x4b682a['status'](0xcc)[_0x0f63('0x1f')]();});}};}function handleEntityNotFound(_0x43abf5,_0x4f16c7){return function(_0x262302){if(!_0x262302){_0x43abf5[_0x0f63('0x1d')](0x194);}return _0x262302;};}function handleError(_0x22ee8e,_0x32cb84){_0x32cb84=_0x32cb84||0x1f4;return function(_0x2b002d){logger[_0x0f63('0x2e')](_0x2b002d[_0x0f63('0x2f')]);if(_0x2b002d[_0x0f63('0x30')]){delete _0x2b002d[_0x0f63('0x30')];}_0x22ee8e['status'](_0x32cb84)[_0x0f63('0x31')](_0x2b002d);};}exports[_0x0f63('0x32')]=function(_0x1d5d38,_0x3590c5){var _0xee8f1a={},_0x2671f4={},_0xf3d608={'count':0x0,'rows':[]};var _0x12f9a6=_[_0x0f63('0x33')](db['FaxQueue'][_0x0f63('0x34')],function(_0x166e2e){return{'name':_0x166e2e['fieldName'],'type':_0x166e2e[_0x0f63('0x35')][_0x0f63('0x36')]};});_0x2671f4[_0x0f63('0x37')]=_[_0x0f63('0x33')](_0x12f9a6,_0x0f63('0x30'));_0x2671f4[_0x0f63('0x38')]=_['keys'](_0x1d5d38[_0x0f63('0x38')]);_0x2671f4[_0x0f63('0x39')]=_[_0x0f63('0x3a')](_0x2671f4[_0x0f63('0x37')],_0x2671f4[_0x0f63('0x38')]);_0xee8f1a[_0x0f63('0x3b')]=_[_0x0f63('0x3a')](_0x2671f4[_0x0f63('0x37')],qs[_0x0f63('0x3c')](_0x1d5d38[_0x0f63('0x38')][_0x0f63('0x3c')]));_0xee8f1a[_0x0f63('0x3b')]=_0xee8f1a['attributes'][_0x0f63('0x3d')]?_0xee8f1a[_0x0f63('0x3b')]:_0x2671f4[_0x0f63('0x37')];if(!_0x1d5d38[_0x0f63('0x38')][_0x0f63('0x3e')](_0x0f63('0x3f'))){_0xee8f1a[_0x0f63('0x23')]=qs['limit'](_0x1d5d38[_0x0f63('0x38')][_0x0f63('0x23')]);_0xee8f1a[_0x0f63('0x20')]=qs['offset'](_0x1d5d38[_0x0f63('0x38')][_0x0f63('0x20')]);}_0xee8f1a['order']=qs[_0x0f63('0x40')](_0x1d5d38[_0x0f63('0x38')]['sort']);_0xee8f1a[_0x0f63('0x41')]=qs['filters'](_['pick'](_0x1d5d38[_0x0f63('0x38')],_0x2671f4[_0x0f63('0x39')]),_0x12f9a6);if(_0x1d5d38[_0x0f63('0x38')]['filter']){_0xee8f1a['where']=_[_0x0f63('0x42')](_0xee8f1a[_0x0f63('0x41')],{'$or':_[_0x0f63('0x33')](_0x12f9a6,function(_0x38a587){if(_0x38a587[_0x0f63('0x35')]!==_0x0f63('0x43')){var _0xb9e945={};_0xb9e945[_0x38a587['name']]={'$like':'%'+_0x1d5d38['query'][_0x0f63('0x44')]+'%'};return _0xb9e945;}})});}_0xee8f1a=_[_0x0f63('0x42')]({},_0xee8f1a,_0x1d5d38[_0x0f63('0x45')]);var _0x123564={'where':_0xee8f1a[_0x0f63('0x41')]};return db[_0x0f63('0x46')][_0x0f63('0x22')](_0x123564)[_0x0f63('0x2d')](function(_0x9a8dbf){_0xf3d608[_0x0f63('0x22')]=_0x9a8dbf;if(_0x1d5d38[_0x0f63('0x38')][_0x0f63('0x47')]){_0xee8f1a[_0x0f63('0x48')]=[{'all':!![]}];}return db[_0x0f63('0x46')][_0x0f63('0x49')](_0xee8f1a);})[_0x0f63('0x2d')](function(_0x467c75){_0xf3d608[_0x0f63('0x4a')]=_0x467c75;return _0xf3d608;})[_0x0f63('0x2d')](respondWithFilteredResult(_0x3590c5,_0xee8f1a))[_0x0f63('0x4b')](handleError(_0x3590c5,null));};exports[_0x0f63('0x4c')]=function(_0x40c1f1,_0x4e3062){var _0x3e14a1={'raw':!![],'where':{'id':_0x40c1f1[_0x0f63('0x4d')]['id']}},_0xa7dc35={};_0xa7dc35[_0x0f63('0x37')]=_[_0x0f63('0x4e')](db['FaxQueue'][_0x0f63('0x34')]);_0xa7dc35[_0x0f63('0x38')]=_[_0x0f63('0x4e')](_0x40c1f1[_0x0f63('0x38')]);_0xa7dc35[_0x0f63('0x39')]=_[_0x0f63('0x3a')](_0xa7dc35[_0x0f63('0x37')],_0xa7dc35[_0x0f63('0x38')]);_0x3e14a1[_0x0f63('0x3b')]=_['intersection'](_0xa7dc35['model'],qs[_0x0f63('0x3c')](_0x40c1f1[_0x0f63('0x38')][_0x0f63('0x3c')]));_0x3e14a1[_0x0f63('0x3b')]=_0x3e14a1[_0x0f63('0x3b')][_0x0f63('0x3d')]?_0x3e14a1[_0x0f63('0x3b')]:_0xa7dc35[_0x0f63('0x37')];if(_0x40c1f1[_0x0f63('0x38')]['includeAll']){_0x3e14a1[_0x0f63('0x48')]=[{'all':!![]}];}_0x3e14a1=_['merge']({},_0x3e14a1,_0x40c1f1['options']);return db[_0x0f63('0x46')][_0x0f63('0x4f')](_0x3e14a1)['then'](handleEntityNotFound(_0x4e3062,null))[_0x0f63('0x2d')](respondWithResult(_0x4e3062,null))[_0x0f63('0x4b')](handleError(_0x4e3062,null));};exports[_0x0f63('0x50')]=function(_0x13a2ef,_0x590c71){return db[_0x0f63('0x46')][_0x0f63('0x50')](_0x13a2ef[_0x0f63('0x51')],{})[_0x0f63('0x2d')](function(_0x1112e8){var _0x43e2aa=_0x13a2ef[_0x0f63('0x52')][_0x0f63('0x2a')]({'plain':!![]});if(!_0x43e2aa)throw new Error(_0x0f63('0x53'));if(_0x43e2aa[_0x0f63('0x54')]===_0x0f63('0x52')){var _0x41984b=_0x1112e8[_0x0f63('0x2a')]({'plain':!![]});var _0x2245ba=_0x0f63('0x2b');return db[_0x0f63('0x55')]['find']({'where':{'name':_0x2245ba,'userProfileId':_0x43e2aa[_0x0f63('0x56')]},'raw':!![]})[_0x0f63('0x2d')](function(_0x182843){if(_0x182843&&_0x182843[_0x0f63('0x57')]===0x0){return db[_0x0f63('0x2c')][_0x0f63('0x50')]({'name':_0x41984b[_0x0f63('0x30')],'resourceId':_0x41984b['id'],'type':_0x182843['name'],'sectionId':_0x182843['id']},{})[_0x0f63('0x2d')](function(){return _0x1112e8;});}else{return _0x1112e8;}})['catch'](function(_0x2e5524){logger[_0x0f63('0x2e')](_0x0f63('0x58'),_0x2e5524);throw _0x2e5524;});}return _0x1112e8;})[_0x0f63('0x2d')](respondWithResult(_0x590c71,0xc9))[_0x0f63('0x4b')](handleError(_0x590c71,null));};exports[_0x0f63('0x28')]=function(_0x25dfee,_0x4f6129){if(_0x25dfee[_0x0f63('0x51')]['id']){delete _0x25dfee['body']['id'];}return db['FaxQueue'][_0x0f63('0x4f')]({'where':{'id':_0x25dfee[_0x0f63('0x4d')]['id']}})[_0x0f63('0x2d')](handleEntityNotFound(_0x4f6129,null))[_0x0f63('0x2d')](saveUpdates(_0x25dfee[_0x0f63('0x51')],null))[_0x0f63('0x2d')](respondWithResult(_0x4f6129,null))[_0x0f63('0x4b')](handleError(_0x4f6129,null));};exports['destroy']=function(_0x2e690b,_0x1f21b6){return db[_0x0f63('0x46')][_0x0f63('0x4f')]({'where':{'id':_0x2e690b[_0x0f63('0x4d')]['id']}})[_0x0f63('0x2d')](handleEntityNotFound(_0x1f21b6,null))[_0x0f63('0x2d')](removeEntity(_0x1f21b6,null))[_0x0f63('0x4b')](handleError(_0x1f21b6,null));};exports['describe']=function(_0xed1d9,_0x26ee32){return db['FaxQueue']['describe']()[_0x0f63('0x2d')](respondWithResult(_0x26ee32,null))[_0x0f63('0x4b')](handleError(_0x26ee32,null));};exports[_0x0f63('0x59')]=function(_0x44564d,_0x7f77af,_0x4982b9){var _0x42e8a9={'raw':!![],'where':{}},_0xa3ec9a={},_0x26e66b;return db['FaxQueue']['findOne']({'where':{'id':_0x44564d['params']['id']}})[_0x0f63('0x2d')](handleEntityNotFound(_0x7f77af,null))['then'](function(_0x292a11){if(_0x292a11){_0x26e66b=_0x292a11['get']({'plain':!![]});_0xa3ec9a[_0x0f63('0x37')]=_['keys'](db['UserFaxQueue'][_0x0f63('0x34')]);_0xa3ec9a[_0x0f63('0x38')]=_[_0x0f63('0x4e')](_0x44564d[_0x0f63('0x38')]);_0xa3ec9a[_0x0f63('0x39')]=_[_0x0f63('0x3a')](_0xa3ec9a['model'],_0xa3ec9a[_0x0f63('0x38')]);_0x42e8a9[_0x0f63('0x3b')]=_[_0x0f63('0x3a')](_0xa3ec9a['model'],qs['fields'](_0x44564d[_0x0f63('0x38')][_0x0f63('0x3c')]));_0x42e8a9[_0x0f63('0x3b')]=_0x42e8a9[_0x0f63('0x3b')]['length']?_0x42e8a9['attributes']:_0xa3ec9a[_0x0f63('0x37')];if(!_0x44564d[_0x0f63('0x38')]['hasOwnProperty'](_0x0f63('0x3f'))){_0x42e8a9[_0x0f63('0x23')]=qs[_0x0f63('0x23')](_0x44564d[_0x0f63('0x38')][_0x0f63('0x23')]);_0x42e8a9[_0x0f63('0x20')]=qs[_0x0f63('0x20')](_0x44564d['query'][_0x0f63('0x20')]);}_0x42e8a9[_0x0f63('0x5a')]=qs['sort'](_0x44564d['query']['sort']);_0x42e8a9['where']=qs['filters'](_[_0x0f63('0x5b')](_0x44564d[_0x0f63('0x38')],_0xa3ec9a[_0x0f63('0x39')]));_0x42e8a9[_0x0f63('0x41')][_0x0f63('0x5c')]=_0x292a11['id'];if(_0x44564d[_0x0f63('0x38')]['filter']){_0x42e8a9[_0x0f63('0x41')]=_[_0x0f63('0x42')](_0x42e8a9[_0x0f63('0x41')],{'$or':_[_0x0f63('0x33')](_0x42e8a9[_0x0f63('0x3b')],function(_0x3dca84){var _0x565a15={};_0x565a15[_0x3dca84]={'$like':'%'+_0x44564d[_0x0f63('0x38')]['filter']+'%'};return _0x565a15;})});}_0x42e8a9=_['merge']({},_0x42e8a9,_0x44564d[_0x0f63('0x45')]);return db[_0x0f63('0x5d')][_0x0f63('0x49')](_0x42e8a9);}})['then'](function(_0x5bc664){if(_0x5bc664){return db[_0x0f63('0x5e')]['findAndCountAll']({'where':{'id':_[_0x0f63('0x33')](_0x5bc664,_0x0f63('0x5f')),'role':'agent'},'attributes':['id',_0x0f63('0x30'),'faxPause','updatedAt',_0x0f63('0x60')]});}})['then'](function(_0x45b3e9){if(_0x45b3e9){return{'count':_0x45b3e9[_0x0f63('0x22')],'rows':_['map'](_0x45b3e9[_0x0f63('0x4a')],function(_0x3ffd93){return{'membername':_0x3ffd93['name'],'UserId':_0x3ffd93['id'],'queue_name':_0x26e66b[_0x0f63('0x30')],'FaxQueueId':_0x26e66b['id'],'interface':util[_0x0f63('0x61')](_0x0f63('0x62'),_0x0f63('0x63'),_0x3ffd93[_0x0f63('0x30')]),'penalty':0x0,'paused':_0x3ffd93[_0x0f63('0x64')],'createdAt':_0x3ffd93['createdAt'],'updatedAt':_0x3ffd93[_0x0f63('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0f63('0x2d')](respondWithFilteredResult(_0x7f77af,_0x42e8a9))[_0x0f63('0x4b')](handleError(_0x7f77af,null));};exports[_0x0f63('0x66')]=function(_0x18ab91,_0x1fab67,_0x510c74){var _0x3fab78={};var _0x3becd4={};var _0x5ef158;var _0x4da90;return db['FaxQueue'][_0x0f63('0x67')]({'where':{'id':_0x18ab91['params']['id']}})[_0x0f63('0x2d')](handleEntityNotFound(_0x1fab67,null))[_0x0f63('0x2d')](function(_0x55a357){if(_0x55a357){_0x5ef158=_0x55a357;_0x3becd4[_0x0f63('0x37')]=_[_0x0f63('0x4e')](db[_0x0f63('0x68')][_0x0f63('0x34')]);_0x3becd4[_0x0f63('0x38')]=_[_0x0f63('0x4e')](_0x18ab91[_0x0f63('0x38')]);_0x3becd4['filters']=_[_0x0f63('0x3a')](_0x3becd4[_0x0f63('0x37')],_0x3becd4[_0x0f63('0x38')]);_0x3fab78['attributes']=_['intersection'](_0x3becd4[_0x0f63('0x37')],qs[_0x0f63('0x3c')](_0x18ab91[_0x0f63('0x38')][_0x0f63('0x3c')]));_0x3fab78[_0x0f63('0x3b')]=_0x3fab78[_0x0f63('0x3b')][_0x0f63('0x3d')]?_0x3fab78[_0x0f63('0x3b')]:_0x3becd4[_0x0f63('0x37')];_0x3fab78[_0x0f63('0x5a')]=qs[_0x0f63('0x40')](_0x18ab91[_0x0f63('0x38')][_0x0f63('0x40')]);_0x3fab78['where']=qs['filters'](_['pick'](_0x18ab91[_0x0f63('0x38')],_0x3becd4['filters']));if(_0x18ab91[_0x0f63('0x38')][_0x0f63('0x44')]){_0x3fab78['where']=_[_0x0f63('0x42')](_0x3fab78['where'],{'$or':_[_0x0f63('0x33')](_0x3fab78[_0x0f63('0x3b')],function(_0x5e17d8){var _0x481f74={};_0x481f74[_0x5e17d8]={'$like':'%'+_0x18ab91[_0x0f63('0x38')][_0x0f63('0x44')]+'%'};return _0x481f74;})});}_0x3fab78=_[_0x0f63('0x42')]({},_0x3fab78,_0x18ab91['options']);return _0x5ef158[_0x0f63('0x66')](_0x3fab78);}})[_0x0f63('0x2d')](function(_0x315a12){if(_0x315a12){_0x4da90=_0x315a12[_0x0f63('0x3d')];if(!_0x18ab91[_0x0f63('0x38')]['hasOwnProperty'](_0x0f63('0x3f'))){_0x3fab78[_0x0f63('0x23')]=qs['limit'](_0x18ab91[_0x0f63('0x38')]['limit']);_0x3fab78[_0x0f63('0x20')]=qs[_0x0f63('0x20')](_0x18ab91[_0x0f63('0x38')][_0x0f63('0x20')]);}return _0x5ef158[_0x0f63('0x66')](_0x3fab78);}})['then'](function(_0xb0e212){if(_0xb0e212){return _0xb0e212?{'count':_0x4da90,'rows':_0xb0e212}:null;}})[_0x0f63('0x2d')](respondWithResult(_0x1fab67,null))[_0x0f63('0x4b')](handleError(_0x1fab67,null));};exports[_0x0f63('0x69')]=function(_0x4d945a,_0x319b0e,_0x1e808d){var _0x4d0299=_0x4d945a[_0x0f63('0x51')][_0x0f63('0x6a')];return db[_0x0f63('0x68')][_0x0f63('0x49')]({'where':{'id':_0x4d0299},'attributes':['id'],'include':[{'model':db[_0x0f63('0x5e')],'as':'Agents','attributes':['id',_0x0f63('0x30'),_0x0f63('0x6b'),'voicePause',_0x0f63('0x6c')],'raw':!![]}]})[_0x0f63('0x2d')](function(_0x45f3ed){if(_0x45f3ed){var _0x5b6ed9=_[_0x0f63('0x6d')](_0x45f3ed,function(_0x52fd72){var _0x567df5=_0x52fd72['get']({'plain':!![]});return _0x567df5[_0x0f63('0x6e')];});return db[_0x0f63('0x46')][_0x0f63('0x4f')]({'where':{'id':_0x4d945a[_0x0f63('0x4d')]['id']}})[_0x0f63('0x2d')](function(_0x160e32){return db['sequelize'][_0x0f63('0x6f')](function(_0x1a1142){return _0x160e32[_0x0f63('0x69')](_0x4d0299,{'transaction':_0x1a1142})[_0x0f63('0x2d')](function(){return BPromise['each'](_0x5b6ed9,function(_0x2467b1){return db[_0x0f63('0x5d')][_0x0f63('0x70')]({'where':{'UserId':_0x2467b1['id'],'FaxQueueId':_0x4d945a[_0x0f63('0x4d')]['id']},'transaction':_0x1a1142});});})[_0x0f63('0x2d')](function(){_0x5b6ed9[_0x0f63('0x71')](function(_0x262c20){socket[_0x0f63('0x72')](_0x0f63('0x73'),{'UserId':_0x262c20['id'],'FaxQueueId':_0x160e32['id']});});});});});}})['then'](respondWithStatusCode(_0x319b0e,null))[_0x0f63('0x4b')](handleError(_0x319b0e,null));};exports[_0x0f63('0x74')]=function(_0x6234a7,_0xe706d5,_0x1e1a4f){return db[_0x0f63('0x68')][_0x0f63('0x49')]({'where':{'id':_0x6234a7[_0x0f63('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0f63('0x5e')],'as':_0x0f63('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x0f63('0x2d')](handleEntityNotFound(_0xe706d5,null))[_0x0f63('0x2d')](function(_0x4ffe6a){var _0x44fdd7=_[_0x0f63('0x33')](_0x4ffe6a,'id');var _0x333fe6=[];var _0x5e97ee=[];var _0x295a98=squel[_0x0f63('0x75')]();_0x295a98[_0x0f63('0x76')](_0x0f63('0x77'))['from'](_0x0f63('0x78'),'tq')['join'](_0x0f63('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x0f63('0x7a'),_0x6234a7[_0x0f63('0x4d')]['id']);for(var _0x34e914=0x0;_0x34e914<_0x4ffe6a['length'];_0x34e914+=0x1){let _0xad7b06=_0x4ffe6a[_0x34e914];for(var _0x2129a2=0x0;_0x2129a2<_0xad7b06[_0x0f63('0x6e')][_0x0f63('0x3d')];_0x2129a2+=0x1){let _0x1df2e4=_0xad7b06['Agents'][_0x2129a2];var _0x3e5caf=_0x295a98[_0x0f63('0x7b')]();_0x3e5caf['where'](_0x0f63('0x7c'),_0x1df2e4['id']);_0x5e97ee[_0x0f63('0x7d')](db[_0x0f63('0x7e')][_0x0f63('0x38')](_0x3e5caf['toString'](),{'type':db[_0x0f63('0x7e')]['QueryTypes'][_0x0f63('0x7f')]})[_0x0f63('0x2d')](function(_0x1b9f74){if(_0x1b9f74[_0x0f63('0x3d')]===0x1){return _0x1df2e4['id'];}else{var _0x32bcdf=_[_0x0f63('0x80')](_[_0x0f63('0x33')](_0x1b9f74,'TeamId'),function(_0x29cfb6){return _[_0x0f63('0x81')](_0x44fdd7,_0x29cfb6);});if(_0x32bcdf){return _0x1df2e4['id'];}}}));}}return BPromise[_0x0f63('0x82')](_0x5e97ee)[_0x0f63('0x2d')](function(_0x467b75){_0x333fe6=_(_0x333fe6)[_0x0f63('0x83')](_0x467b75)['compact']()[_0x0f63('0x84')]();return db['FaxQueue']['find']({'where':{'id':_0x6234a7['params']['id']}})[_0x0f63('0x2d')](function(_0x7965f9){return db[_0x0f63('0x7e')][_0x0f63('0x6f')](function(_0x25bee3){return _0x7965f9['removeTeams'](_0x6234a7[_0x0f63('0x38')]['ids'],{'transaction':_0x25bee3})[_0x0f63('0x2d')](function(){if(!_[_0x0f63('0x85')](_0x333fe6)){return _0x7965f9[_0x0f63('0x86')](_0x333fe6,{'transaction':_0x25bee3});}})[_0x0f63('0x2d')](function(){_0x333fe6[_0x0f63('0x71')](function(_0x206dcd){socket['emit'](_0x0f63('0x87'),{'UserId':_0x206dcd,'FaxQueueId':_0x7965f9['id']});});});});});});})[_0x0f63('0x2d')](respondWithStatusCode(_0xe706d5,null))[_0x0f63('0x4b')](handleError(_0xe706d5,null));};exports[_0x0f63('0x88')]=function(_0x564905,_0x44335b,_0x191484){return db[_0x0f63('0x46')][_0x0f63('0x4f')]({'where':{'id':_0x564905['params']['id']}})[_0x0f63('0x2d')](handleEntityNotFound(_0x44335b,null))['then'](function(_0x399fc9){if(_0x399fc9){return _0x399fc9['addAgents'](_0x564905[_0x0f63('0x51')][_0x0f63('0x6a')],_[_0x0f63('0x89')](_0x564905[_0x0f63('0x51')],[_0x0f63('0x6a'),'id'])||{})[_0x0f63('0x8a')](function(_0x4e5b3b){for(var _0x63ac08=0x0;_0x63ac08<_0x564905['body'][_0x0f63('0x6a')][_0x0f63('0x3d')];_0x63ac08+=0x1){socket[_0x0f63('0x72')](_0x0f63('0x73'),{'UserId':Number(_0x564905[_0x0f63('0x51')]['ids'][_0x63ac08]),'FaxQueueId':Number(_0x564905[_0x0f63('0x4d')]['id'])});}return _0x4e5b3b;});}})[_0x0f63('0x2d')](respondWithResult(_0x44335b,null))['catch'](handleError(_0x44335b,null));};exports[_0x0f63('0x86')]=function(_0x5de398,_0x32bc9c,_0x1ca113){return db[_0x0f63('0x46')][_0x0f63('0x4f')]({'where':{'id':_0x5de398[_0x0f63('0x4d')]['id']}})[_0x0f63('0x2d')](handleEntityNotFound(_0x32bc9c,null))[_0x0f63('0x2d')](function(_0x2d45ae){if(_0x2d45ae){return _0x2d45ae[_0x0f63('0x86')](_0x5de398[_0x0f63('0x38')][_0x0f63('0x6a')])['then'](function(){if(_[_0x0f63('0x8b')](_0x5de398['query'][_0x0f63('0x6a')])){for(var _0x1b8ded=0x0;_0x1b8ded<_0x5de398['query'][_0x0f63('0x6a')]['length'];_0x1b8ded+=0x1){socket[_0x0f63('0x72')](_0x0f63('0x87'),{'UserId':Number(_0x5de398['query'][_0x0f63('0x6a')][_0x1b8ded]),'FaxQueueId':Number(_0x5de398['params']['id'])});}}else{socket[_0x0f63('0x72')](_0x0f63('0x87'),{'UserId':Number(_0x5de398['query']['ids']),'FaxQueueId':Number(_0x5de398[_0x0f63('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x32bc9c,null))[_0x0f63('0x4b')](handleError(_0x32bc9c,null));};exports[_0x0f63('0x8c')]=function(_0x34d83b,_0x38bbe1,_0x590c44){var _0x5af548={};var _0x29cd7b={};var _0x24a0c6;var _0x198f54;return db[_0x0f63('0x46')][_0x0f63('0x67')]({'where':{'id':_0x34d83b['params']['id']}})[_0x0f63('0x2d')](handleEntityNotFound(_0x38bbe1,null))['then'](function(_0x48633f){if(_0x48633f){_0x24a0c6=_0x48633f;_0x29cd7b[_0x0f63('0x37')]=_[_0x0f63('0x4e')](db[_0x0f63('0x5e')][_0x0f63('0x34')]);_0x29cd7b[_0x0f63('0x38')]=_[_0x0f63('0x4e')](_0x34d83b[_0x0f63('0x38')]);_0x29cd7b[_0x0f63('0x39')]=_['intersection'](_0x29cd7b[_0x0f63('0x37')],_0x29cd7b[_0x0f63('0x38')]);_0x5af548[_0x0f63('0x3b')]=_[_0x0f63('0x3a')](_0x29cd7b[_0x0f63('0x37')],qs[_0x0f63('0x3c')](_0x34d83b[_0x0f63('0x38')]['fields']));_0x5af548[_0x0f63('0x3b')]=_0x5af548[_0x0f63('0x3b')][_0x0f63('0x3d')]?_0x5af548[_0x0f63('0x3b')]:_0x29cd7b['model'];_0x5af548[_0x0f63('0x5a')]=qs[_0x0f63('0x40')](_0x34d83b['query']['sort']);_0x5af548['where']=qs[_0x0f63('0x39')](_[_0x0f63('0x5b')](_0x34d83b[_0x0f63('0x38')],_0x29cd7b[_0x0f63('0x39')]));if(_0x34d83b[_0x0f63('0x38')]['filter']){_0x5af548[_0x0f63('0x41')]=_[_0x0f63('0x42')](_0x5af548[_0x0f63('0x41')],{'$or':_[_0x0f63('0x33')](_0x5af548[_0x0f63('0x3b')],function(_0x1cc8c6){var _0x5c58ba={};_0x5c58ba[_0x1cc8c6]={'$like':'%'+_0x34d83b[_0x0f63('0x38')]['filter']+'%'};return _0x5c58ba;})});}_0x5af548=_[_0x0f63('0x42')]({},_0x5af548,_0x34d83b[_0x0f63('0x45')]);return _0x24a0c6[_0x0f63('0x8c')](_0x5af548);}})[_0x0f63('0x2d')](function(_0x3a14b5){if(_0x3a14b5){_0x198f54=_0x3a14b5[_0x0f63('0x3d')];if(!_0x34d83b[_0x0f63('0x38')][_0x0f63('0x3e')](_0x0f63('0x3f'))){_0x5af548[_0x0f63('0x23')]=qs['limit'](_0x34d83b[_0x0f63('0x38')][_0x0f63('0x23')]);_0x5af548['offset']=qs[_0x0f63('0x20')](_0x34d83b[_0x0f63('0x38')][_0x0f63('0x20')]);}return _0x24a0c6['getAgents'](_0x5af548);}})[_0x0f63('0x2d')](function(_0x4d96e6){if(_0x4d96e6){return _0x4d96e6?{'count':_0x198f54,'rows':_0x4d96e6}:null;}})['then'](respondWithResult(_0x38bbe1,null))[_0x0f63('0x4b')](handleError(_0x38bbe1,null));}; \ No newline at end of file +var _0xcfe2=['reject','then','destroy','FaxQueues','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserFaxQueue','hasOwnProperty','order','pick','FaxQueueId','findAll','User','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','transaction','each','findOrCreate','emit','userFaxQueue:save','select','field','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','includes','union','compact','value','removeTeams','isEmpty','userFaxQueue:remove','addAgents','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply'];(function(_0x24cf7a,_0x290e32){var _0x3ba898=function(_0x2bf482){while(--_0x2bf482){_0x24cf7a['push'](_0x24cf7a['shift']());}};_0x3ba898(++_0x290e32);}(_0xcfe2,0x66));var _0x2cfe=function(_0x38cf70,_0x1c4cc4){_0x38cf70=_0x38cf70-0x0;var _0x3bb2e5=_0xcfe2[_0x38cf70];return _0x3bb2e5;};'use strict';var emlformat=require(_0x2cfe('0x0'));var rimraf=require(_0x2cfe('0x1'));var zipdir=require(_0x2cfe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cfe('0x3'));var moment=require(_0x2cfe('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2cfe('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2cfe('0x6'));var ejs=require(_0x2cfe('0x7'));var fs=require('fs');var fs_extra=require(_0x2cfe('0x8'));var _=require('lodash');var squel=require(_0x2cfe('0x9'));var crypto=require(_0x2cfe('0xa'));var jsforce=require(_0x2cfe('0xb'));var deskjs=require(_0x2cfe('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2cfe('0xd'));var authService=require(_0x2cfe('0xe'));var qs=require(_0x2cfe('0xf'));var as=require(_0x2cfe('0x10'));var hardwareService=require(_0x2cfe('0x11'));var logger=require(_0x2cfe('0x12'))('api');var utils=require(_0x2cfe('0x13'));var config=require(_0x2cfe('0x14'));var licenseUtil=require(_0x2cfe('0x15'));var db=require(_0x2cfe('0x16'))['db'];config[_0x2cfe('0x17')]=_[_0x2cfe('0x18')](config[_0x2cfe('0x17')],{'host':_0x2cfe('0x19'),'port':0x18eb});var socket=require(_0x2cfe('0x1a'))(new Redis(config['redis']));require(_0x2cfe('0x1b'))[_0x2cfe('0x1c')](socket);function respondWithStatusCode(_0x166942,_0x1f084c){_0x1f084c=_0x1f084c||0xcc;return function(_0x2e3dc8){if(_0x2e3dc8){return _0x166942[_0x2cfe('0x1d')](_0x1f084c);}return _0x166942[_0x2cfe('0x1e')](_0x1f084c)[_0x2cfe('0x1f')]();};}function respondWithResult(_0x3b288b,_0x1032d3){_0x1032d3=_0x1032d3||0xc8;return function(_0x3a090a){if(_0x3a090a){return _0x3b288b[_0x2cfe('0x1e')](_0x1032d3)[_0x2cfe('0x20')](_0x3a090a);}};}function respondWithFilteredResult(_0xc996db,_0x20ea02){return function(_0x2386c7){if(_0x2386c7){var _0x5e01ec=typeof _0x20ea02['offset']==='undefined'&&typeof _0x20ea02[_0x2cfe('0x21')]===_0x2cfe('0x22');var _0x4bb176=_0x2386c7['count'];var _0x45bf64=_0x5e01ec?0x0:_0x20ea02[_0x2cfe('0x23')];var _0x1e76c8=_0x5e01ec?_0x2386c7[_0x2cfe('0x24')]:_0x20ea02[_0x2cfe('0x23')]+_0x20ea02[_0x2cfe('0x21')];var _0x58a469;if(_0x1e76c8>=_0x4bb176){_0x1e76c8=_0x4bb176;_0x58a469=0xc8;}else{_0x58a469=0xce;}_0xc996db['status'](_0x58a469);return _0xc996db['set'](_0x2cfe('0x25'),_0x45bf64+'-'+_0x1e76c8+'/'+_0x4bb176)[_0x2cfe('0x20')](_0x2386c7);}return null;};}function patchUpdates(_0x4cf98f){return function(_0x4007de){try{jsonpatch[_0x2cfe('0x26')](_0x4007de,_0x4cf98f,!![]);}catch(_0x41e0fc){return BPromise[_0x2cfe('0x27')](_0x41e0fc);}return _0x4007de['save']();};}function saveUpdates(_0xb2e140,_0x5042e0){return function(_0xc2a635){if(_0xc2a635){return _0xc2a635['update'](_0xb2e140)[_0x2cfe('0x28')](function(_0x5af5d7){return _0x5af5d7;});}return null;};}function removeEntity(_0x43042a,_0x3f8314){return function(_0x14bede){if(_0x14bede){return _0x14bede[_0x2cfe('0x29')]()['then'](function(){var _0x7db89b=_0x14bede['get']({'plain':!![]});var _0x57efa5=_0x2cfe('0x2a');return db['UserProfileResource'][_0x2cfe('0x29')]({'where':{'type':_0x57efa5,'resourceId':_0x7db89b['id']}})[_0x2cfe('0x28')](function(){return _0x14bede;});})[_0x2cfe('0x28')](function(){_0x43042a[_0x2cfe('0x1e')](0xcc)[_0x2cfe('0x1f')]();});}};}function handleEntityNotFound(_0x465301,_0x5854bd){return function(_0x3468f6){if(!_0x3468f6){_0x465301[_0x2cfe('0x1d')](0x194);}return _0x3468f6;};}function handleError(_0x26d95b,_0x3756ed){_0x3756ed=_0x3756ed||0x1f4;return function(_0x4323cf){logger[_0x2cfe('0x2b')](_0x4323cf[_0x2cfe('0x2c')]);if(_0x4323cf['name']){delete _0x4323cf[_0x2cfe('0x2d')];}_0x26d95b['status'](_0x3756ed)[_0x2cfe('0x2e')](_0x4323cf);};}exports[_0x2cfe('0x2f')]=function(_0x5276ca,_0x20a08b){var _0x47e73d={},_0x5b723a={},_0x35b027={'count':0x0,'rows':[]};var _0x38b85d=_[_0x2cfe('0x30')](db[_0x2cfe('0x31')][_0x2cfe('0x32')],function(_0x41dd8f){return{'name':_0x41dd8f[_0x2cfe('0x33')],'type':_0x41dd8f[_0x2cfe('0x34')][_0x2cfe('0x35')]};});_0x5b723a[_0x2cfe('0x36')]=_['map'](_0x38b85d,_0x2cfe('0x2d'));_0x5b723a['query']=_[_0x2cfe('0x37')](_0x5276ca[_0x2cfe('0x38')]);_0x5b723a[_0x2cfe('0x39')]=_[_0x2cfe('0x3a')](_0x5b723a[_0x2cfe('0x36')],_0x5b723a[_0x2cfe('0x38')]);_0x47e73d[_0x2cfe('0x3b')]=_[_0x2cfe('0x3a')](_0x5b723a['model'],qs[_0x2cfe('0x3c')](_0x5276ca[_0x2cfe('0x38')][_0x2cfe('0x3c')]));_0x47e73d[_0x2cfe('0x3b')]=_0x47e73d[_0x2cfe('0x3b')]['length']?_0x47e73d['attributes']:_0x5b723a[_0x2cfe('0x36')];if(!_0x5276ca[_0x2cfe('0x38')]['hasOwnProperty'](_0x2cfe('0x3d'))){_0x47e73d[_0x2cfe('0x21')]=qs[_0x2cfe('0x21')](_0x5276ca['query'][_0x2cfe('0x21')]);_0x47e73d[_0x2cfe('0x23')]=qs['offset'](_0x5276ca[_0x2cfe('0x38')][_0x2cfe('0x23')]);}_0x47e73d['order']=qs[_0x2cfe('0x3e')](_0x5276ca[_0x2cfe('0x38')][_0x2cfe('0x3e')]);_0x47e73d['where']=qs['filters'](_['pick'](_0x5276ca[_0x2cfe('0x38')],_0x5b723a[_0x2cfe('0x39')]),_0x38b85d);if(_0x5276ca[_0x2cfe('0x38')][_0x2cfe('0x3f')]){_0x47e73d['where']=_[_0x2cfe('0x40')](_0x47e73d[_0x2cfe('0x41')],{'$or':_['map'](_0x38b85d,function(_0x47d468){if(_0x47d468[_0x2cfe('0x34')]!==_0x2cfe('0x42')){var _0x34da77={};_0x34da77[_0x47d468[_0x2cfe('0x2d')]]={'$like':'%'+_0x5276ca[_0x2cfe('0x38')][_0x2cfe('0x3f')]+'%'};return _0x34da77;}})});}_0x47e73d=_[_0x2cfe('0x40')]({},_0x47e73d,_0x5276ca[_0x2cfe('0x43')]);var _0x36c019={'where':_0x47e73d[_0x2cfe('0x41')]};return db['FaxQueue'][_0x2cfe('0x24')](_0x36c019)['then'](function(_0x3787a8){_0x35b027[_0x2cfe('0x24')]=_0x3787a8;if(_0x5276ca[_0x2cfe('0x38')][_0x2cfe('0x44')]){_0x47e73d[_0x2cfe('0x45')]=[{'all':!![]}];}return db[_0x2cfe('0x31')]['findAll'](_0x47e73d);})['then'](function(_0x5379e6){_0x35b027[_0x2cfe('0x46')]=_0x5379e6;return _0x35b027;})[_0x2cfe('0x28')](respondWithFilteredResult(_0x20a08b,_0x47e73d))[_0x2cfe('0x47')](handleError(_0x20a08b,null));};exports[_0x2cfe('0x48')]=function(_0x332603,_0x416fcc){var _0x2f3d78={'raw':!![],'where':{'id':_0x332603[_0x2cfe('0x49')]['id']}},_0x25c38f={};_0x25c38f[_0x2cfe('0x36')]=_[_0x2cfe('0x37')](db[_0x2cfe('0x31')]['rawAttributes']);_0x25c38f['query']=_[_0x2cfe('0x37')](_0x332603[_0x2cfe('0x38')]);_0x25c38f[_0x2cfe('0x39')]=_['intersection'](_0x25c38f[_0x2cfe('0x36')],_0x25c38f['query']);_0x2f3d78['attributes']=_[_0x2cfe('0x3a')](_0x25c38f['model'],qs[_0x2cfe('0x3c')](_0x332603['query'][_0x2cfe('0x3c')]));_0x2f3d78[_0x2cfe('0x3b')]=_0x2f3d78[_0x2cfe('0x3b')][_0x2cfe('0x4a')]?_0x2f3d78['attributes']:_0x25c38f['model'];if(_0x332603[_0x2cfe('0x38')][_0x2cfe('0x44')]){_0x2f3d78['include']=[{'all':!![]}];}_0x2f3d78=_[_0x2cfe('0x40')]({},_0x2f3d78,_0x332603[_0x2cfe('0x43')]);return db['FaxQueue'][_0x2cfe('0x4b')](_0x2f3d78)['then'](handleEntityNotFound(_0x416fcc,null))[_0x2cfe('0x28')](respondWithResult(_0x416fcc,null))['catch'](handleError(_0x416fcc,null));};exports[_0x2cfe('0x4c')]=function(_0x2474cb,_0x8c1a55){return db[_0x2cfe('0x31')][_0x2cfe('0x4c')](_0x2474cb[_0x2cfe('0x4d')],{})['then'](function(_0xa24962){var _0x3a0818=_0x2474cb[_0x2cfe('0x4e')][_0x2cfe('0x4f')]({'plain':!![]});if(!_0x3a0818)throw new Error(_0x2cfe('0x50'));if(_0x3a0818[_0x2cfe('0x51')]==='user'){var _0x53be4b=_0xa24962[_0x2cfe('0x4f')]({'plain':!![]});var _0x32c24b=_0x2cfe('0x2a');return db[_0x2cfe('0x52')][_0x2cfe('0x4b')]({'where':{'name':_0x32c24b,'userProfileId':_0x3a0818[_0x2cfe('0x53')]},'raw':!![]})[_0x2cfe('0x28')](function(_0x23a159){if(_0x23a159&&_0x23a159[_0x2cfe('0x54')]===0x0){return db[_0x2cfe('0x55')][_0x2cfe('0x4c')]({'name':_0x53be4b[_0x2cfe('0x2d')],'resourceId':_0x53be4b['id'],'type':_0x23a159['name'],'sectionId':_0x23a159['id']},{})[_0x2cfe('0x28')](function(){return _0xa24962;});}else{return _0xa24962;}})[_0x2cfe('0x47')](function(_0x319184){logger[_0x2cfe('0x2b')](_0x2cfe('0x56'),_0x319184);throw _0x319184;});}return _0xa24962;})['then'](respondWithResult(_0x8c1a55,0xc9))[_0x2cfe('0x47')](handleError(_0x8c1a55,null));};exports[_0x2cfe('0x57')]=function(_0x4ac101,_0x1d9a45){if(_0x4ac101[_0x2cfe('0x4d')]['id']){delete _0x4ac101['body']['id'];}return db[_0x2cfe('0x31')][_0x2cfe('0x4b')]({'where':{'id':_0x4ac101[_0x2cfe('0x49')]['id']}})[_0x2cfe('0x28')](handleEntityNotFound(_0x1d9a45,null))[_0x2cfe('0x28')](saveUpdates(_0x4ac101[_0x2cfe('0x4d')],null))['then'](respondWithResult(_0x1d9a45,null))[_0x2cfe('0x47')](handleError(_0x1d9a45,null));};exports['destroy']=function(_0x27115f,_0x15db19){return db[_0x2cfe('0x31')]['find']({'where':{'id':_0x27115f['params']['id']}})[_0x2cfe('0x28')](handleEntityNotFound(_0x15db19,null))['then'](removeEntity(_0x15db19,null))[_0x2cfe('0x47')](handleError(_0x15db19,null));};exports[_0x2cfe('0x58')]=function(_0xb11672,_0x5c781e){return db[_0x2cfe('0x31')][_0x2cfe('0x58')]()['then'](respondWithResult(_0x5c781e,null))[_0x2cfe('0x47')](handleError(_0x5c781e,null));};exports['getMembers']=function(_0x4e81e4,_0x4c3f45,_0x28c3e9){var _0x55e0df={'raw':!![],'where':{}},_0x3aceb8={},_0x357aca;return db[_0x2cfe('0x31')][_0x2cfe('0x59')]({'where':{'id':_0x4e81e4[_0x2cfe('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c3f45,null))[_0x2cfe('0x28')](function(_0x179362){if(_0x179362){_0x357aca=_0x179362['get']({'plain':!![]});_0x3aceb8['model']=_['keys'](db[_0x2cfe('0x5a')]['rawAttributes']);_0x3aceb8['query']=_[_0x2cfe('0x37')](_0x4e81e4['query']);_0x3aceb8[_0x2cfe('0x39')]=_[_0x2cfe('0x3a')](_0x3aceb8[_0x2cfe('0x36')],_0x3aceb8[_0x2cfe('0x38')]);_0x55e0df[_0x2cfe('0x3b')]=_[_0x2cfe('0x3a')](_0x3aceb8[_0x2cfe('0x36')],qs[_0x2cfe('0x3c')](_0x4e81e4[_0x2cfe('0x38')]['fields']));_0x55e0df['attributes']=_0x55e0df[_0x2cfe('0x3b')][_0x2cfe('0x4a')]?_0x55e0df[_0x2cfe('0x3b')]:_0x3aceb8[_0x2cfe('0x36')];if(!_0x4e81e4[_0x2cfe('0x38')][_0x2cfe('0x5b')]('nolimit')){_0x55e0df[_0x2cfe('0x21')]=qs[_0x2cfe('0x21')](_0x4e81e4[_0x2cfe('0x38')]['limit']);_0x55e0df[_0x2cfe('0x23')]=qs[_0x2cfe('0x23')](_0x4e81e4[_0x2cfe('0x38')][_0x2cfe('0x23')]);}_0x55e0df[_0x2cfe('0x5c')]=qs['sort'](_0x4e81e4[_0x2cfe('0x38')][_0x2cfe('0x3e')]);_0x55e0df[_0x2cfe('0x41')]=qs[_0x2cfe('0x39')](_[_0x2cfe('0x5d')](_0x4e81e4[_0x2cfe('0x38')],_0x3aceb8[_0x2cfe('0x39')]));_0x55e0df[_0x2cfe('0x41')][_0x2cfe('0x5e')]=_0x179362['id'];if(_0x4e81e4[_0x2cfe('0x38')][_0x2cfe('0x3f')]){_0x55e0df[_0x2cfe('0x41')]=_[_0x2cfe('0x40')](_0x55e0df[_0x2cfe('0x41')],{'$or':_[_0x2cfe('0x30')](_0x55e0df[_0x2cfe('0x3b')],function(_0x403645){var _0x594001={};_0x594001[_0x403645]={'$like':'%'+_0x4e81e4[_0x2cfe('0x38')][_0x2cfe('0x3f')]+'%'};return _0x594001;})});}_0x55e0df=_[_0x2cfe('0x40')]({},_0x55e0df,_0x4e81e4[_0x2cfe('0x43')]);return db[_0x2cfe('0x5a')][_0x2cfe('0x5f')](_0x55e0df);}})[_0x2cfe('0x28')](function(_0xe521d6){if(_0xe521d6){return db[_0x2cfe('0x60')]['findAndCountAll']({'where':{'id':_[_0x2cfe('0x30')](_0xe521d6,_0x2cfe('0x61')),'role':_0x2cfe('0x62')},'attributes':['id',_0x2cfe('0x2d'),_0x2cfe('0x63'),_0x2cfe('0x64'),_0x2cfe('0x65')]});}})[_0x2cfe('0x28')](function(_0x2a3499){if(_0x2a3499){return{'count':_0x2a3499[_0x2cfe('0x24')],'rows':_['map'](_0x2a3499[_0x2cfe('0x46')],function(_0x4278f4){return{'membername':_0x4278f4['name'],'UserId':_0x4278f4['id'],'queue_name':_0x357aca[_0x2cfe('0x2d')],'FaxQueueId':_0x357aca['id'],'interface':util[_0x2cfe('0x66')]('%s/%s',_0x2cfe('0x67'),_0x4278f4['name']),'penalty':0x0,'paused':_0x4278f4[_0x2cfe('0x63')],'createdAt':_0x4278f4[_0x2cfe('0x65')],'updatedAt':_0x4278f4[_0x2cfe('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4c3f45,_0x55e0df))[_0x2cfe('0x47')](handleError(_0x4c3f45,null));};exports[_0x2cfe('0x68')]=function(_0x2d3824,_0x3cbecc,_0x18e0b6){var _0x13bfa9={};var _0x32a211={};var _0x245ca0;var _0x29bf77;return db[_0x2cfe('0x31')][_0x2cfe('0x59')]({'where':{'id':_0x2d3824[_0x2cfe('0x49')]['id']}})[_0x2cfe('0x28')](handleEntityNotFound(_0x3cbecc,null))[_0x2cfe('0x28')](function(_0xaffce5){if(_0xaffce5){_0x245ca0=_0xaffce5;_0x32a211[_0x2cfe('0x36')]=_[_0x2cfe('0x37')](db[_0x2cfe('0x69')][_0x2cfe('0x32')]);_0x32a211['query']=_[_0x2cfe('0x37')](_0x2d3824[_0x2cfe('0x38')]);_0x32a211[_0x2cfe('0x39')]=_[_0x2cfe('0x3a')](_0x32a211['model'],_0x32a211['query']);_0x13bfa9[_0x2cfe('0x3b')]=_['intersection'](_0x32a211[_0x2cfe('0x36')],qs[_0x2cfe('0x3c')](_0x2d3824[_0x2cfe('0x38')][_0x2cfe('0x3c')]));_0x13bfa9[_0x2cfe('0x3b')]=_0x13bfa9['attributes'][_0x2cfe('0x4a')]?_0x13bfa9[_0x2cfe('0x3b')]:_0x32a211[_0x2cfe('0x36')];_0x13bfa9[_0x2cfe('0x5c')]=qs[_0x2cfe('0x3e')](_0x2d3824[_0x2cfe('0x38')][_0x2cfe('0x3e')]);_0x13bfa9[_0x2cfe('0x41')]=qs['filters'](_['pick'](_0x2d3824['query'],_0x32a211[_0x2cfe('0x39')]));if(_0x2d3824[_0x2cfe('0x38')][_0x2cfe('0x3f')]){_0x13bfa9[_0x2cfe('0x41')]=_['merge'](_0x13bfa9[_0x2cfe('0x41')],{'$or':_[_0x2cfe('0x30')](_0x13bfa9[_0x2cfe('0x3b')],function(_0x2f348a){var _0xf63d66={};_0xf63d66[_0x2f348a]={'$like':'%'+_0x2d3824[_0x2cfe('0x38')][_0x2cfe('0x3f')]+'%'};return _0xf63d66;})});}_0x13bfa9=_[_0x2cfe('0x40')]({},_0x13bfa9,_0x2d3824[_0x2cfe('0x43')]);return _0x245ca0['getTeams'](_0x13bfa9);}})[_0x2cfe('0x28')](function(_0x2b14d1){if(_0x2b14d1){_0x29bf77=_0x2b14d1['length'];if(!_0x2d3824[_0x2cfe('0x38')][_0x2cfe('0x5b')](_0x2cfe('0x3d'))){_0x13bfa9[_0x2cfe('0x21')]=qs[_0x2cfe('0x21')](_0x2d3824['query']['limit']);_0x13bfa9[_0x2cfe('0x23')]=qs[_0x2cfe('0x23')](_0x2d3824[_0x2cfe('0x38')]['offset']);}return _0x245ca0[_0x2cfe('0x68')](_0x13bfa9);}})['then'](function(_0x5eff62){if(_0x5eff62){return _0x5eff62?{'count':_0x29bf77,'rows':_0x5eff62}:null;}})['then'](respondWithResult(_0x3cbecc,null))[_0x2cfe('0x47')](handleError(_0x3cbecc,null));};exports[_0x2cfe('0x6a')]=function(_0x9fc44e,_0x28d642,_0x5cf56b){var _0x208198=_0x9fc44e['body'][_0x2cfe('0x6b')];return db[_0x2cfe('0x69')][_0x2cfe('0x5f')]({'where':{'id':_0x208198},'attributes':['id'],'include':[{'model':db[_0x2cfe('0x60')],'as':'Agents','attributes':['id',_0x2cfe('0x2d'),_0x2cfe('0x6c'),'voicePause',_0x2cfe('0x6d')],'raw':!![]}]})[_0x2cfe('0x28')](function(_0x5302ff){if(_0x5302ff){var _0x3519ba=_[_0x2cfe('0x6e')](_0x5302ff,function(_0x888eb9){var _0x1199fa=_0x888eb9['get']({'plain':!![]});return _0x1199fa[_0x2cfe('0x6f')];});return db[_0x2cfe('0x31')]['find']({'where':{'id':_0x9fc44e['params']['id']}})['then'](function(_0xb39396){return db['sequelize'][_0x2cfe('0x70')](function(_0x3494cc){return _0xb39396[_0x2cfe('0x6a')](_0x208198,{'transaction':_0x3494cc})['then'](function(){return BPromise[_0x2cfe('0x71')](_0x3519ba,function(_0x35edc4){return db[_0x2cfe('0x5a')][_0x2cfe('0x72')]({'where':{'UserId':_0x35edc4['id'],'FaxQueueId':_0x9fc44e[_0x2cfe('0x49')]['id']},'transaction':_0x3494cc});});})[_0x2cfe('0x28')](function(){_0x3519ba['forEach'](function(_0x2085c3){socket[_0x2cfe('0x73')](_0x2cfe('0x74'),{'UserId':_0x2085c3['id'],'FaxQueueId':_0xb39396['id']});});});});});}})[_0x2cfe('0x28')](respondWithStatusCode(_0x28d642,null))['catch'](handleError(_0x28d642,null));};exports['removeTeams']=function(_0x7e0b7,_0x524212,_0x403749){return db['Team'][_0x2cfe('0x5f')]({'where':{'id':_0x7e0b7[_0x2cfe('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2cfe('0x60')],'as':_0x2cfe('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x2cfe('0x28')](handleEntityNotFound(_0x524212,null))['then'](function(_0x2a9372){var _0x470981=_['map'](_0x2a9372,'id');var _0x3ad53b=[];var _0x43f37b=[];var _0x318e33=squel[_0x2cfe('0x75')]();_0x318e33[_0x2cfe('0x76')]('tq.TeamId')[_0x2cfe('0x77')](_0x2cfe('0x78'),'tq')[_0x2cfe('0x79')]('user_has_teams','ut',_0x2cfe('0x7a'))[_0x2cfe('0x41')](_0x2cfe('0x7b'),_0x7e0b7[_0x2cfe('0x49')]['id']);for(var _0x20036a=0x0;_0x20036a<_0x2a9372[_0x2cfe('0x4a')];_0x20036a+=0x1){let _0x35745a=_0x2a9372[_0x20036a];for(var _0x4ebb48=0x0;_0x4ebb48<_0x35745a[_0x2cfe('0x6f')]['length'];_0x4ebb48+=0x1){let _0x15effc=_0x35745a[_0x2cfe('0x6f')][_0x4ebb48];var _0x13a53d=_0x318e33[_0x2cfe('0x7c')]();_0x13a53d[_0x2cfe('0x41')](_0x2cfe('0x7d'),_0x15effc['id']);_0x43f37b['push'](db[_0x2cfe('0x7e')][_0x2cfe('0x38')](_0x13a53d['toString'](),{'type':db[_0x2cfe('0x7e')][_0x2cfe('0x7f')][_0x2cfe('0x80')]})[_0x2cfe('0x28')](function(_0x1d8c58){if(_0x1d8c58['length']===0x1){return _0x15effc['id'];}else{var _0x568837=_[_0x2cfe('0x81')](_[_0x2cfe('0x30')](_0x1d8c58,'TeamId'),function(_0x4dd52c){return _[_0x2cfe('0x82')](_0x470981,_0x4dd52c);});if(_0x568837){return _0x15effc['id'];}}}));}}return BPromise['all'](_0x43f37b)['then'](function(_0x558b22){_0x3ad53b=_(_0x3ad53b)[_0x2cfe('0x83')](_0x558b22)[_0x2cfe('0x84')]()[_0x2cfe('0x85')]();return db['FaxQueue'][_0x2cfe('0x4b')]({'where':{'id':_0x7e0b7[_0x2cfe('0x49')]['id']}})['then'](function(_0x420eca){return db[_0x2cfe('0x7e')][_0x2cfe('0x70')](function(_0x2be632){return _0x420eca[_0x2cfe('0x86')](_0x7e0b7[_0x2cfe('0x38')][_0x2cfe('0x6b')],{'transaction':_0x2be632})[_0x2cfe('0x28')](function(){if(!_[_0x2cfe('0x87')](_0x3ad53b)){return _0x420eca['removeAgents'](_0x3ad53b,{'transaction':_0x2be632});}})[_0x2cfe('0x28')](function(){_0x3ad53b['forEach'](function(_0x389cc6){socket[_0x2cfe('0x73')](_0x2cfe('0x88'),{'UserId':_0x389cc6,'FaxQueueId':_0x420eca['id']});});});});});});})[_0x2cfe('0x28')](respondWithStatusCode(_0x524212,null))[_0x2cfe('0x47')](handleError(_0x524212,null));};exports[_0x2cfe('0x89')]=function(_0xbb4067,_0x1feaa9,_0x281869){return db['FaxQueue'][_0x2cfe('0x4b')]({'where':{'id':_0xbb4067[_0x2cfe('0x49')]['id']}})[_0x2cfe('0x28')](handleEntityNotFound(_0x1feaa9,null))[_0x2cfe('0x28')](function(_0x5bda1d){if(_0x5bda1d){return _0x5bda1d['addAgents'](_0xbb4067[_0x2cfe('0x4d')][_0x2cfe('0x6b')],_['omit'](_0xbb4067[_0x2cfe('0x4d')],[_0x2cfe('0x6b'),'id'])||{})['spread'](function(_0x43271f){for(var _0x447130=0x0;_0x447130<_0xbb4067['body'][_0x2cfe('0x6b')][_0x2cfe('0x4a')];_0x447130+=0x1){socket['emit'](_0x2cfe('0x74'),{'UserId':Number(_0xbb4067[_0x2cfe('0x4d')][_0x2cfe('0x6b')][_0x447130]),'FaxQueueId':Number(_0xbb4067[_0x2cfe('0x49')]['id'])});}return _0x43271f;});}})[_0x2cfe('0x28')](respondWithResult(_0x1feaa9,null))[_0x2cfe('0x47')](handleError(_0x1feaa9,null));};exports[_0x2cfe('0x8a')]=function(_0x54ae0e,_0x59e7ce,_0x3dda9e){return db[_0x2cfe('0x31')]['find']({'where':{'id':_0x54ae0e[_0x2cfe('0x49')]['id']}})[_0x2cfe('0x28')](handleEntityNotFound(_0x59e7ce,null))[_0x2cfe('0x28')](function(_0x46f86e){if(_0x46f86e){return _0x46f86e[_0x2cfe('0x8a')](_0x54ae0e[_0x2cfe('0x38')]['ids'])['then'](function(){if(_[_0x2cfe('0x8b')](_0x54ae0e[_0x2cfe('0x38')]['ids'])){for(var _0x5d8418=0x0;_0x5d8418<_0x54ae0e[_0x2cfe('0x38')][_0x2cfe('0x6b')][_0x2cfe('0x4a')];_0x5d8418+=0x1){socket[_0x2cfe('0x73')](_0x2cfe('0x88'),{'UserId':Number(_0x54ae0e[_0x2cfe('0x38')][_0x2cfe('0x6b')][_0x5d8418]),'FaxQueueId':Number(_0x54ae0e['params']['id'])});}}else{socket['emit'](_0x2cfe('0x88'),{'UserId':Number(_0x54ae0e['query'][_0x2cfe('0x6b')]),'FaxQueueId':Number(_0x54ae0e[_0x2cfe('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x59e7ce,null))[_0x2cfe('0x47')](handleError(_0x59e7ce,null));};exports[_0x2cfe('0x8c')]=function(_0x3ebbf8,_0x22ddb1,_0x2051ae){var _0x2ea794={};var _0x5960db={};var _0x3fa961;var _0x5e71ae;return db[_0x2cfe('0x31')][_0x2cfe('0x59')]({'where':{'id':_0x3ebbf8[_0x2cfe('0x49')]['id']}})['then'](handleEntityNotFound(_0x22ddb1,null))[_0x2cfe('0x28')](function(_0x59fa16){if(_0x59fa16){_0x3fa961=_0x59fa16;_0x5960db[_0x2cfe('0x36')]=_[_0x2cfe('0x37')](db[_0x2cfe('0x60')][_0x2cfe('0x32')]);_0x5960db[_0x2cfe('0x38')]=_['keys'](_0x3ebbf8[_0x2cfe('0x38')]);_0x5960db[_0x2cfe('0x39')]=_['intersection'](_0x5960db[_0x2cfe('0x36')],_0x5960db[_0x2cfe('0x38')]);_0x2ea794['attributes']=_[_0x2cfe('0x3a')](_0x5960db[_0x2cfe('0x36')],qs[_0x2cfe('0x3c')](_0x3ebbf8['query'][_0x2cfe('0x3c')]));_0x2ea794[_0x2cfe('0x3b')]=_0x2ea794[_0x2cfe('0x3b')][_0x2cfe('0x4a')]?_0x2ea794[_0x2cfe('0x3b')]:_0x5960db[_0x2cfe('0x36')];_0x2ea794['order']=qs[_0x2cfe('0x3e')](_0x3ebbf8['query']['sort']);_0x2ea794[_0x2cfe('0x41')]=qs['filters'](_[_0x2cfe('0x5d')](_0x3ebbf8[_0x2cfe('0x38')],_0x5960db[_0x2cfe('0x39')]));if(_0x3ebbf8[_0x2cfe('0x38')][_0x2cfe('0x3f')]){_0x2ea794[_0x2cfe('0x41')]=_[_0x2cfe('0x40')](_0x2ea794['where'],{'$or':_[_0x2cfe('0x30')](_0x2ea794[_0x2cfe('0x3b')],function(_0x457d39){var _0x366c57={};_0x366c57[_0x457d39]={'$like':'%'+_0x3ebbf8[_0x2cfe('0x38')]['filter']+'%'};return _0x366c57;})});}_0x2ea794=_[_0x2cfe('0x40')]({},_0x2ea794,_0x3ebbf8[_0x2cfe('0x43')]);return _0x3fa961[_0x2cfe('0x8c')](_0x2ea794);}})[_0x2cfe('0x28')](function(_0x37615c){if(_0x37615c){_0x5e71ae=_0x37615c[_0x2cfe('0x4a')];if(!_0x3ebbf8[_0x2cfe('0x38')][_0x2cfe('0x5b')](_0x2cfe('0x3d'))){_0x2ea794[_0x2cfe('0x21')]=qs[_0x2cfe('0x21')](_0x3ebbf8[_0x2cfe('0x38')][_0x2cfe('0x21')]);_0x2ea794[_0x2cfe('0x23')]=qs[_0x2cfe('0x23')](_0x3ebbf8[_0x2cfe('0x38')][_0x2cfe('0x23')]);}return _0x3fa961[_0x2cfe('0x8c')](_0x2ea794);}})[_0x2cfe('0x28')](function(_0x6342b9){if(_0x6342b9){return _0x6342b9?{'count':_0x5e71ae,'rows':_0x6342b9}:null;}})[_0x2cfe('0x28')](respondWithResult(_0x22ddb1,null))[_0x2cfe('0x47')](handleError(_0x22ddb1,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 53870e5..d437725 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 _0x40df=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x40df,0xd7));var _0xf40d=function(_0x5c5a02,_0x3d7b77){_0x5c5a02=_0x5c5a02-0x0;var _0x3f82de=_0x40df[_0x5c5a02];return _0x3f82de;};'use strict';var EventEmitter=require(_0xf40d('0x0'));var FaxQueue=require(_0xf40d('0x1'))['db'][_0xf40d('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf40d('0x3')](0x0);var events={'afterCreate':_0xf40d('0x4'),'afterUpdate':_0xf40d('0x5'),'afterDestroy':_0xf40d('0x6')};function emitEvent(_0x349917){return function(_0x2b4e15,_0x5df351,_0x260e45){FaxQueueEvents['emit'](_0x349917+':'+_0x2b4e15['id'],_0x2b4e15);FaxQueueEvents[_0xf40d('0x7')](_0x349917,_0x2b4e15);_0x260e45(null);};}for(var e in events){if(events[_0xf40d('0x8')](e)){var event=events[e];FaxQueue[_0xf40d('0x9')](e,emitEvent(event));}}module[_0xf40d('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0xa680=['emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3c4eba,_0x435bda){var _0x4f03ee=function(_0x4a637e){while(--_0x4a637e){_0x3c4eba['push'](_0x3c4eba['shift']());}};_0x4f03ee(++_0x435bda);}(_0xa680,0x12f));var _0x0a68=function(_0x2e9333,_0x105c29){_0x2e9333=_0x2e9333-0x0;var _0x214a6f=_0xa680[_0x2e9333];return _0x214a6f;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x0a68('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0a68('0x1')](0x0);var events={'afterCreate':_0x0a68('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x9f7f21){return function(_0xe5aa11,_0x6f13f7,_0xdb9b63){FaxQueueEvents[_0x0a68('0x3')](_0x9f7f21+':'+_0xe5aa11['id'],_0xe5aa11);FaxQueueEvents[_0x0a68('0x3')](_0x9f7f21,_0xe5aa11);_0xdb9b63(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x0a68('0x4')](e,emitEvent(event));}}module[_0x0a68('0x5')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 456f7dd..35ba420 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 _0x136b=['lodash','../../config/logger','moment','bluebird','../../config/environment','./faxQueue.attributes','exports','define'];(function(_0x5ee6f3,_0x4cf046){var _0xa0a711=function(_0x52553f){while(--_0x52553f){_0x5ee6f3['push'](_0x5ee6f3['shift']());}};_0xa0a711(++_0x4cf046);}(_0x136b,0x110));var _0xb136=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x136b[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0xb136('0x0'));var util=require('util');var logger=require(_0xb136('0x1'))('api');var moment=require(_0xb136('0x2'));var BPromise=require(_0xb136('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb136('0x4'));var attributes=require(_0xb136('0x5'));module[_0xb136('0x6')]=function(_0x626076,_0x2d8e8b){return _0x626076[_0xb136('0x7')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x168e=['exports','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x98ee5b,_0x5d5749){var _0x202e40=function(_0x517762){while(--_0x517762){_0x98ee5b['push'](_0x98ee5b['shift']());}};_0x202e40(++_0x5d5749);}(_0x168e,0x85));var _0xe168=function(_0x2c3e7d,_0x5cb6bd){_0x2c3e7d=_0x2c3e7d-0x0;var _0x51f283=_0x168e[_0x2c3e7d];return _0x51f283;};'use strict';var _=require(_0xe168('0x0'));var util=require(_0xe168('0x1'));var logger=require(_0xe168('0x2'))('api');var moment=require(_0xe168('0x3'));var BPromise=require(_0xe168('0x4'));var rp=require(_0xe168('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe168('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xe168('0x7')]=function(_0x352f8f,_0x698704){return _0x352f8f['define'](_0xe168('0x8'),attributes,{'tableName':_0xe168('0x9'),'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 70705e1..324684a 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 _0x2e2e=['lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','request','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','ShowFaxQueue','FaxQueue','find'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0x2e2e,0x111));var _0xe2e2=function(_0x3c8e33,_0x2f4ef9){_0x3c8e33=_0x3c8e33-0x0;var _0x224cf4=_0x2e2e[_0x3c8e33];return _0x224cf4;};'use strict';var _=require(_0xe2e2('0x0'));var util=require(_0xe2e2('0x1'));var moment=require('moment');var BPromise=require(_0xe2e2('0x2'));var rs=require(_0xe2e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe2e2('0x4'));var logger=require(_0xe2e2('0x5'))(_0xe2e2('0x6'));var config=require(_0xe2e2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe2e2('0x8')][_0xe2e2('0x9')]({'port':0x232a});config[_0xe2e2('0xa')]=_['defaults'](config[_0xe2e2('0xa')],{'host':_0xe2e2('0xb'),'port':0x18eb});var socket=require(_0xe2e2('0xc'))(new Redis(config[_0xe2e2('0xa')]));require(_0xe2e2('0xd'))['register'](socket);function respondWithRpcPromise(_0x2c8b7c,_0x20470d,_0x2e4900){return new BPromise(function(_0xa86e6,_0x462d18){return client[_0xe2e2('0xe')](_0x2c8b7c,_0x2e4900)['then'](function(_0x463491){logger['info'](_0xe2e2('0xf'),_0x20470d,_0xe2e2('0x10'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x20470d,_0xe2e2('0x10'),JSON[_0xe2e2('0x11')](_0x463491));if(_0x463491[_0xe2e2('0x12')]){if(_0x463491[_0xe2e2('0x12')][_0xe2e2('0x13')]===0x1f4){logger[_0xe2e2('0x12')]('FaxQueue,\x20%s,\x20%s',_0x20470d,_0x463491[_0xe2e2('0x12')][_0xe2e2('0x14')]);return _0x462d18(_0x463491[_0xe2e2('0x12')][_0xe2e2('0x14')]);}logger[_0xe2e2('0x12')]('FaxQueue,\x20%s,\x20%s',_0x20470d,_0x463491[_0xe2e2('0x12')][_0xe2e2('0x14')]);return _0xa86e6(_0x463491[_0xe2e2('0x12')][_0xe2e2('0x14')]);}else{logger[_0xe2e2('0x15')](_0xe2e2('0xf'),_0x20470d,_0xe2e2('0x10'));_0xa86e6(_0x463491[_0xe2e2('0x16')][_0xe2e2('0x14')]);}})[_0xe2e2('0x17')](function(_0x1d7ba8){logger[_0xe2e2('0x12')]('FaxQueue,\x20%s,\x20%s',_0x20470d,_0x1d7ba8);_0x462d18(_0x1d7ba8);});});}exports[_0xe2e2('0x18')]=function(_0x40a365){var _0x12b86c=this;return new Promise(function(_0x215c93,_0x21f0d9){return db['FaxQueue'][_0xe2e2('0x19')]({'raw':_0x40a365[_0xe2e2('0x1a')]?_0x40a365['options'][_0xe2e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x40a365[_0xe2e2('0x1a')]?_0x40a365[_0xe2e2('0x1a')][_0xe2e2('0x1c')]||null:null,'attributes':_0x40a365[_0xe2e2('0x1a')]?_0x40a365[_0xe2e2('0x1a')][_0xe2e2('0x1d')]||null:null,'limit':_0x40a365[_0xe2e2('0x1a')]?_0x40a365[_0xe2e2('0x1a')][_0xe2e2('0x1e')]||null:null,'include':_0x40a365['options']?_0x40a365[_0xe2e2('0x1a')]['include']?_[_0xe2e2('0x1f')](_0x40a365[_0xe2e2('0x1a')][_0xe2e2('0x20')],function(_0x3faddf){return{'model':db[_0x3faddf[_0xe2e2('0x21')]],'as':_0x3faddf['as'],'attributes':_0x3faddf['attributes'],'include':_0x3faddf[_0xe2e2('0x20')]?_[_0xe2e2('0x1f')](_0x3faddf[_0xe2e2('0x20')],function(_0x9dc717){return{'model':db[_0x9dc717[_0xe2e2('0x21')]],'as':_0x9dc717['as'],'attributes':_0x9dc717['attributes'],'include':_0x9dc717['include']?_[_0xe2e2('0x1f')](_0x9dc717['include'],function(_0x152a86){return{'model':db[_0x152a86['model']],'as':_0x152a86['as'],'attributes':_0x152a86[_0xe2e2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe2e2('0x22')](function(_0x49fea8){logger[_0xe2e2('0x15')]('GetFaxQueue',_0x40a365);logger[_0xe2e2('0x23')](_0xe2e2('0x18'),_0x40a365,JSON[_0xe2e2('0x11')](_0x49fea8));_0x215c93(_0x49fea8);})[_0xe2e2('0x17')](function(_0x30b331){logger[_0xe2e2('0x12')]('GetFaxQueue',_0x30b331['message'],_0x40a365);_0x21f0d9(_0x12b86c['error'](0x1f4,_0x30b331['message']));});});};exports[_0xe2e2('0x24')]=function(_0x37579c){var _0x445d10=this;return new Promise(function(_0x44cea9,_0x137cb1){return db[_0xe2e2('0x25')][_0xe2e2('0x26')]({'raw':_0x37579c[_0xe2e2('0x1a')]?_0x37579c[_0xe2e2('0x1a')][_0xe2e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x37579c[_0xe2e2('0x1a')]?_0x37579c['options'][_0xe2e2('0x1c')]||null:null,'attributes':_0x37579c[_0xe2e2('0x1a')]?_0x37579c[_0xe2e2('0x1a')][_0xe2e2('0x1d')]||null:null,'include':_0x37579c['options']?_0x37579c['options'][_0xe2e2('0x20')]?_[_0xe2e2('0x1f')](_0x37579c['options']['include'],function(_0x21f3c3){return{'model':db[_0x21f3c3[_0xe2e2('0x21')]],'as':_0x21f3c3['as'],'attributes':_0x21f3c3[_0xe2e2('0x1d')],'include':_0x21f3c3[_0xe2e2('0x20')]?_[_0xe2e2('0x1f')](_0x21f3c3[_0xe2e2('0x20')],function(_0x134231){return{'model':db[_0x134231['model']],'as':_0x134231['as'],'attributes':_0x134231[_0xe2e2('0x1d')],'include':_0x134231[_0xe2e2('0x20')]?_[_0xe2e2('0x1f')](_0x134231[_0xe2e2('0x20')],function(_0x1514d5){return{'model':db[_0x1514d5[_0xe2e2('0x21')]],'as':_0x1514d5['as'],'attributes':_0x1514d5['attributes']};}):[]};}):[]};}):[]:[]})[_0xe2e2('0x22')](function(_0x159d8e){logger[_0xe2e2('0x15')]('ShowFaxQueue',_0x37579c);logger[_0xe2e2('0x23')](_0xe2e2('0x24'),_0x37579c,JSON[_0xe2e2('0x11')](_0x159d8e));_0x44cea9(_0x159d8e);})[_0xe2e2('0x17')](function(_0x5b7161){logger[_0xe2e2('0x12')](_0xe2e2('0x24'),_0x5b7161['message'],_0x37579c);_0x137cb1(_0x445d10['error'](0x1f4,_0x5b7161[_0xe2e2('0x14')]));});});}; \ No newline at end of file +var _0xe730=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','limit','include','map','model','attributes','ShowFaxQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe730,0xbc));var _0x0e73=function(_0x58375b,_0x14059a){_0x58375b=_0x58375b-0x0;var _0x12ddb1=_0xe730[_0x58375b];return _0x12ddb1;};'use strict';var _=require(_0x0e73('0x0'));var util=require(_0x0e73('0x1'));var moment=require('moment');var BPromise=require(_0x0e73('0x2'));var rs=require(_0x0e73('0x3'));var fs=require('fs');var Redis=require(_0x0e73('0x4'));var db=require(_0x0e73('0x5'))['db'];var utils=require(_0x0e73('0x6'));var logger=require(_0x0e73('0x7'))(_0x0e73('0x8'));var config=require(_0x0e73('0x9'));var jayson=require(_0x0e73('0xa'));var client=jayson[_0x0e73('0xb')][_0x0e73('0xc')]({'port':0x232a});config['redis']=_[_0x0e73('0xd')](config[_0x0e73('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e73('0xf'))(new Redis(config[_0x0e73('0xe')]));require(_0x0e73('0x10'))[_0x0e73('0x11')](socket);function respondWithRpcPromise(_0x4432a5,_0x5edc1b,_0x5cb3b4){return new BPromise(function(_0x560523,_0x330df1){return client[_0x0e73('0x12')](_0x4432a5,_0x5cb3b4)[_0x0e73('0x13')](function(_0x5883eb){logger[_0x0e73('0x14')]('FaxQueue,\x20%s,\x20%s',_0x5edc1b,_0x0e73('0x15'));logger[_0x0e73('0x16')](_0x0e73('0x17'),_0x5edc1b,_0x0e73('0x15'),JSON[_0x0e73('0x18')](_0x5883eb));if(_0x5883eb[_0x0e73('0x19')]){if(_0x5883eb[_0x0e73('0x19')][_0x0e73('0x1a')]===0x1f4){logger[_0x0e73('0x19')](_0x0e73('0x1b'),_0x5edc1b,_0x5883eb[_0x0e73('0x19')][_0x0e73('0x1c')]);return _0x330df1(_0x5883eb[_0x0e73('0x19')][_0x0e73('0x1c')]);}logger['error'](_0x0e73('0x1b'),_0x5edc1b,_0x5883eb[_0x0e73('0x19')][_0x0e73('0x1c')]);return _0x560523(_0x5883eb[_0x0e73('0x19')][_0x0e73('0x1c')]);}else{logger[_0x0e73('0x14')](_0x0e73('0x1b'),_0x5edc1b,_0x0e73('0x15'));_0x560523(_0x5883eb[_0x0e73('0x1d')][_0x0e73('0x1c')]);}})[_0x0e73('0x1e')](function(_0x351d46){logger[_0x0e73('0x19')](_0x0e73('0x1b'),_0x5edc1b,_0x351d46);_0x330df1(_0x351d46);});});}exports[_0x0e73('0x1f')]=function(_0x1490c4){var _0x5334fa=this;return new Promise(function(_0x22f95f,_0x1e3bb0){return db[_0x0e73('0x20')]['findAll']({'raw':_0x1490c4[_0x0e73('0x21')]?_0x1490c4['options'][_0x0e73('0x22')]===undefined?!![]:![]:!![],'where':_0x1490c4[_0x0e73('0x21')]?_0x1490c4['options'][_0x0e73('0x23')]||null:null,'attributes':_0x1490c4[_0x0e73('0x21')]?_0x1490c4[_0x0e73('0x21')]['attributes']||null:null,'limit':_0x1490c4[_0x0e73('0x21')]?_0x1490c4[_0x0e73('0x21')][_0x0e73('0x24')]||null:null,'include':_0x1490c4['options']?_0x1490c4['options'][_0x0e73('0x25')]?_[_0x0e73('0x26')](_0x1490c4['options']['include'],function(_0x17be8a){return{'model':db[_0x17be8a[_0x0e73('0x27')]],'as':_0x17be8a['as'],'attributes':_0x17be8a[_0x0e73('0x28')],'include':_0x17be8a[_0x0e73('0x25')]?_['map'](_0x17be8a['include'],function(_0x398ccf){return{'model':db[_0x398ccf[_0x0e73('0x27')]],'as':_0x398ccf['as'],'attributes':_0x398ccf[_0x0e73('0x28')],'include':_0x398ccf[_0x0e73('0x25')]?_[_0x0e73('0x26')](_0x398ccf[_0x0e73('0x25')],function(_0x4fb39d){return{'model':db[_0x4fb39d[_0x0e73('0x27')]],'as':_0x4fb39d['as'],'attributes':_0x4fb39d[_0x0e73('0x28')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59ed14){logger[_0x0e73('0x14')](_0x0e73('0x1f'),_0x1490c4);logger[_0x0e73('0x16')](_0x0e73('0x1f'),_0x1490c4,JSON[_0x0e73('0x18')](_0x59ed14));_0x22f95f(_0x59ed14);})[_0x0e73('0x1e')](function(_0x322ae5){logger[_0x0e73('0x19')](_0x0e73('0x1f'),_0x322ae5[_0x0e73('0x1c')],_0x1490c4);_0x1e3bb0(_0x5334fa['error'](0x1f4,_0x322ae5[_0x0e73('0x1c')]));});});};exports[_0x0e73('0x29')]=function(_0x84c1af){var _0x1b68a0=this;return new Promise(function(_0x4f45d0,_0x355d32){return db[_0x0e73('0x20')]['find']({'raw':_0x84c1af['options']?_0x84c1af[_0x0e73('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x84c1af['options']?_0x84c1af[_0x0e73('0x21')][_0x0e73('0x23')]||null:null,'attributes':_0x84c1af[_0x0e73('0x21')]?_0x84c1af[_0x0e73('0x21')][_0x0e73('0x28')]||null:null,'include':_0x84c1af['options']?_0x84c1af[_0x0e73('0x21')][_0x0e73('0x25')]?_['map'](_0x84c1af[_0x0e73('0x21')][_0x0e73('0x25')],function(_0x450488){return{'model':db[_0x450488[_0x0e73('0x27')]],'as':_0x450488['as'],'attributes':_0x450488[_0x0e73('0x28')],'include':_0x450488[_0x0e73('0x25')]?_[_0x0e73('0x26')](_0x450488[_0x0e73('0x25')],function(_0x386ed3){return{'model':db[_0x386ed3[_0x0e73('0x27')]],'as':_0x386ed3['as'],'attributes':_0x386ed3[_0x0e73('0x28')],'include':_0x386ed3[_0x0e73('0x25')]?_[_0x0e73('0x26')](_0x386ed3[_0x0e73('0x25')],function(_0x2065fc){return{'model':db[_0x2065fc[_0x0e73('0x27')]],'as':_0x2065fc['as'],'attributes':_0x2065fc['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e73('0x13')](function(_0x3312ce){logger[_0x0e73('0x14')](_0x0e73('0x29'),_0x84c1af);logger['debug']('ShowFaxQueue',_0x84c1af,JSON[_0x0e73('0x18')](_0x3312ce));_0x4f45d0(_0x3312ce);})[_0x0e73('0x1e')](function(_0x45c98d){logger[_0x0e73('0x19')](_0x0e73('0x29'),_0x45c98d[_0x0e73('0x1c')],_0x84c1af);_0x355d32(_0x1b68a0[_0x0e73('0x19')](0x1f4,_0x45c98d[_0x0e73('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3667ad0..723002d 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 _0x9ed1=['update','removeListener','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ed1,0x107));var _0x19ed=function(_0x1320cc,_0x4b9f55){_0x1320cc=_0x1320cc-0x0;var _0x3f0130=_0x9ed1[_0x1320cc];return _0x3f0130;};'use strict';var FaxQueueEvents=require(_0x19ed('0x0'));var events=[_0x19ed('0x1'),_0x19ed('0x2'),_0x19ed('0x3')];function createListener(_0x43bff6,_0x5c8ddb){return function(_0xd3e1d3){_0x5c8ddb['emit'](_0x43bff6,_0xd3e1d3);};}function removeListener(_0x303c79,_0x5cc356){return function(){FaxQueueEvents[_0x19ed('0x4')](_0x303c79,_0x5cc356);};}exports['register']=function(_0x112ddb){for(var _0x13c2db=0x0,_0x282d63=events[_0x19ed('0x5')];_0x13c2db<_0x282d63;_0x13c2db++){var _0x27c09b=events[_0x13c2db];var _0x30aea7=createListener(_0x19ed('0x6')+_0x27c09b,_0x112ddb);FaxQueueEvents['on'](_0x27c09b,_0x30aea7);}}; \ No newline at end of file +var _0x55e2=['./faxQueue.events','save','remove','register','length','faxQueue:'];(function(_0x560585,_0x9d921){var _0x3dfee5=function(_0x448f61){while(--_0x448f61){_0x560585['push'](_0x560585['shift']());}};_0x3dfee5(++_0x9d921);}(_0x55e2,0xd8));var _0x255e=function(_0x5ae2b8,_0x2207f4){_0x5ae2b8=_0x5ae2b8-0x0;var _0x31972d=_0x55e2[_0x5ae2b8];return _0x31972d;};'use strict';var FaxQueueEvents=require(_0x255e('0x0'));var events=[_0x255e('0x1'),_0x255e('0x2'),'update'];function createListener(_0x49c9d3,_0x6ae6b4){return function(_0x4387ff){_0x6ae6b4['emit'](_0x49c9d3,_0x4387ff);};}function removeListener(_0x3cc5df,_0x4b4799){return function(){FaxQueueEvents['removeListener'](_0x3cc5df,_0x4b4799);};}exports[_0x255e('0x3')]=function(_0x198fef){for(var _0x3cde29=0x0,_0x51cef7=events[_0x255e('0x4')];_0x3cde29<_0x51cef7;_0x3cde29++){var _0x169d4e=events[_0x3cde29];var _0x155199=createListener(_0x255e('0x5')+_0x169d4e,_0x198fef);FaxQueueEvents['on'](_0x169d4e,_0x155199);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4048e28..cb59959 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 _0x1623=['delete','destroy','removeAgents','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x2b0efa,_0x14e09c){_0x2b0efa=_0x2b0efa-0x0;var _0x5c4322=_0x1623[_0x2b0efa];return _0x5c4322;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xb')]('/:id/members',auth['isAuthenticated'](),controller[_0x3162('0xe')]);router[_0x3162('0xb')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0xb')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);router['post']('/',auth[_0x3162('0x7')](),controller['create']);router[_0x3162('0x13')](_0x3162('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x3162('0x13')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller['addAgents']);router[_0x3162('0x14')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller['update']);router[_0x3162('0x15')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x16')]);router[_0x3162('0x15')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller['removeTeams']);router[_0x3162('0x15')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6050=['describe','get','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6050,0x196));var _0x0605=function(_0x3f3bb0,_0x2199f1){_0x3f3bb0=_0x3f3bb0-0x0;var _0x153558=_0x6050[_0x3f3bb0];return _0x153558;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0605('0x6'));var interaction=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var controller=require('./faxQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0xe')]);router['get'](_0x0605('0xf'),auth[_0x0605('0xd')](),controller[_0x0605('0x10')]);router[_0x0605('0xb')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x12')]);router[_0x0605('0xb')](_0x0605('0x13'),auth[_0x0605('0xd')](),controller[_0x0605('0x14')]);router[_0x0605('0x15')]('/',auth[_0x0605('0xd')](),controller[_0x0605('0x16')]);router[_0x0605('0x15')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x17')]);router[_0x0605('0x15')]('/:id/users',auth[_0x0605('0xd')](),controller[_0x0605('0x18')]);router[_0x0605('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0605('0x1a')]);router[_0x0605('0x1b')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0x1c')]);router[_0x0605('0x1b')](_0x0605('0x11'),auth[_0x0605('0xd')](),controller[_0x0605('0x1d')]);router[_0x0605('0x1b')](_0x0605('0x13'),auth[_0x0605('0xd')](),controller[_0x0605('0x1e')]);module[_0x0605('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c90fed6..db85505 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 _0x11b2=['STRING','DATE','moment','exports'];(function(_0x4a09a8,_0x4ed12d){var _0x7d30a9=function(_0x459184){while(--_0x459184){_0x4a09a8['push'](_0x4a09a8['shift']());}};_0x7d30a9(++_0x4ed12d);}(_0x11b2,0xd2));var _0x211b=function(_0x2f2dfd,_0x413038){_0x2f2dfd=_0x2f2dfd-0x0;var _0x39e565=_0x11b2[_0x2f2dfd];return _0x39e565;};'use strict';var moment=require(_0x211b('0x0'));var Sequelize=require('sequelize');module[_0x211b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x211b('0x2')]},'joinAt':{'type':Sequelize[_0x211b('0x3')]},'leaveAt':{'type':Sequelize[_0x211b('0x3')]},'acceptAt':{'type':Sequelize[_0x211b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x211b('0x2')]}}; \ No newline at end of file +var _0xa8bc=['STRING','DATE','moment','sequelize'];(function(_0xcf835,_0x25c2c4){var _0x3422bf=function(_0x4024cf){while(--_0x4024cf){_0xcf835['push'](_0xcf835['shift']());}};_0x3422bf(++_0x25c2c4);}(_0xa8bc,0x15a));var _0xca8b=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0xa8bc[_0xec034];return _0x2c5a19;};'use strict';var moment=require(_0xca8b('0x0'));var Sequelize=require(_0xca8b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xca8b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xca8b('0x2')]},'joinAt':{'type':Sequelize[_0xca8b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xca8b('0x3')]},'exitAt':{'type':Sequelize[_0xca8b('0x3')]},'reason':{'type':Sequelize[_0xca8b('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 1acc8c5..de5e2d6 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 _0x8a55=['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','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4c5721,_0x15233c){var _0x4b84d0=function(_0x1a74a4){while(--_0x1a74a4){_0x4c5721['push'](_0x4c5721['shift']());}};_0x4b84d0(++_0x15233c);}(_0x8a55,0x185));var _0x58a5=function(_0x8dc22b,_0x11a59d){_0x8dc22b=_0x8dc22b-0x0;var _0x4ee728=_0x8a55[_0x8dc22b];return _0x4ee728;};'use strict';var emlformat=require(_0x58a5('0x0'));var rimraf=require(_0x58a5('0x1'));var zipdir=require(_0x58a5('0x2'));var jsonpatch=require(_0x58a5('0x3'));var rp=require(_0x58a5('0x4'));var moment=require(_0x58a5('0x5'));var BPromise=require(_0x58a5('0x6'));var Mustache=require(_0x58a5('0x7'));var util=require('util');var path=require(_0x58a5('0x8'));var sox=require(_0x58a5('0x9'));var csv=require(_0x58a5('0xa'));var ejs=require(_0x58a5('0xb'));var fs=require('fs');var fs_extra=require(_0x58a5('0xc'));var _=require(_0x58a5('0xd'));var squel=require(_0x58a5('0xe'));var crypto=require(_0x58a5('0xf'));var jsforce=require(_0x58a5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x58a5('0xa'));var querystring=require(_0x58a5('0x11'));var Papa=require(_0x58a5('0x12'));var Redis=require(_0x58a5('0x13'));var authService=require(_0x58a5('0x14'));var qs=require(_0x58a5('0x15'));var as=require(_0x58a5('0x16'));var hardwareService=require(_0x58a5('0x17'));var logger=require(_0x58a5('0x18'))(_0x58a5('0x19'));var utils=require(_0x58a5('0x1a'));var config=require(_0x58a5('0x1b'));var licenseUtil=require(_0x58a5('0x1c'));var db=require(_0x58a5('0x1d'))['db'];function respondWithStatusCode(_0x560e8b,_0x23cd4a){_0x23cd4a=_0x23cd4a||0xcc;return function(_0x3ed0df){if(_0x3ed0df){return _0x560e8b[_0x58a5('0x1e')](_0x23cd4a);}return _0x560e8b[_0x58a5('0x1f')](_0x23cd4a)[_0x58a5('0x20')]();};}function respondWithResult(_0x4ca59c,_0x504295){_0x504295=_0x504295||0xc8;return function(_0x3ae4e5){if(_0x3ae4e5){return _0x4ca59c[_0x58a5('0x1f')](_0x504295)[_0x58a5('0x21')](_0x3ae4e5);}};}function respondWithFilteredResult(_0x18bb0f,_0x12de1f){return function(_0x598b0f){if(_0x598b0f){var _0x9577d5=typeof _0x12de1f[_0x58a5('0x22')]==='undefined'&&typeof _0x12de1f[_0x58a5('0x23')]===_0x58a5('0x24');var _0x5ac651=_0x598b0f[_0x58a5('0x25')];var _0x32203a=_0x9577d5?0x0:_0x12de1f['offset'];var _0x5dfadd=_0x9577d5?_0x598b0f[_0x58a5('0x25')]:_0x12de1f['offset']+_0x12de1f['limit'];var _0x530621;if(_0x5dfadd>=_0x5ac651){_0x5dfadd=_0x5ac651;_0x530621=0xc8;}else{_0x530621=0xce;}_0x18bb0f[_0x58a5('0x1f')](_0x530621);return _0x18bb0f[_0x58a5('0x26')]('Content-Range',_0x32203a+'-'+_0x5dfadd+'/'+_0x5ac651)[_0x58a5('0x21')](_0x598b0f);}return null;};}function patchUpdates(_0x8860d7){return function(_0x43e0fc){try{jsonpatch['apply'](_0x43e0fc,_0x8860d7,!![]);}catch(_0x75a981){return BPromise[_0x58a5('0x27')](_0x75a981);}return _0x43e0fc[_0x58a5('0x28')]();};}function saveUpdates(_0x5ccf19,_0x4b0df7){return function(_0x5aecca){if(_0x5aecca){return _0x5aecca[_0x58a5('0x29')](_0x5ccf19)[_0x58a5('0x2a')](function(_0x20df22){return _0x20df22;});}return null;};}function removeEntity(_0x5d9be2,_0x543c49){return function(_0x2da18b){if(_0x2da18b){return _0x2da18b[_0x58a5('0x2b')]()[_0x58a5('0x2a')](function(){_0x5d9be2[_0x58a5('0x1f')](0xcc)[_0x58a5('0x20')]();});}};}function handleEntityNotFound(_0x26d2e6,_0x3a2e8c){return function(_0x56f0a4){if(!_0x56f0a4){_0x26d2e6[_0x58a5('0x1e')](0x194);}return _0x56f0a4;};}function handleError(_0x4ab677,_0x15b1b5){_0x15b1b5=_0x15b1b5||0x1f4;return function(_0x2a884d){logger['error'](_0x2a884d[_0x58a5('0x2c')]);if(_0x2a884d[_0x58a5('0x2d')]){delete _0x2a884d['name'];}_0x4ab677[_0x58a5('0x1f')](_0x15b1b5)[_0x58a5('0x2e')](_0x2a884d);};}exports[_0x58a5('0x2f')]=function(_0x4bbf76,_0x34bd7a){var _0x2aa897={},_0x3d8968={},_0x3fbcd9={'count':0x0,'rows':[]};var _0x25bb2a=_['map'](db[_0x58a5('0x30')][_0x58a5('0x31')],function(_0x11efc4){return{'name':_0x11efc4[_0x58a5('0x32')],'type':_0x11efc4[_0x58a5('0x33')][_0x58a5('0x34')]};});_0x3d8968['model']=_[_0x58a5('0x35')](_0x25bb2a,_0x58a5('0x2d'));_0x3d8968[_0x58a5('0x36')]=_[_0x58a5('0x37')](_0x4bbf76[_0x58a5('0x36')]);_0x3d8968[_0x58a5('0x38')]=_[_0x58a5('0x39')](_0x3d8968[_0x58a5('0x3a')],_0x3d8968[_0x58a5('0x36')]);_0x2aa897[_0x58a5('0x3b')]=_[_0x58a5('0x39')](_0x3d8968['model'],qs[_0x58a5('0x3c')](_0x4bbf76[_0x58a5('0x36')]['fields']));_0x2aa897[_0x58a5('0x3b')]=_0x2aa897[_0x58a5('0x3b')]['length']?_0x2aa897['attributes']:_0x3d8968['model'];if(!_0x4bbf76['query'][_0x58a5('0x3d')](_0x58a5('0x3e'))){_0x2aa897['limit']=qs[_0x58a5('0x23')](_0x4bbf76['query'][_0x58a5('0x23')]);_0x2aa897['offset']=qs[_0x58a5('0x22')](_0x4bbf76[_0x58a5('0x36')][_0x58a5('0x22')]);}_0x2aa897[_0x58a5('0x3f')]=qs[_0x58a5('0x40')](_0x4bbf76['query'][_0x58a5('0x40')]);_0x2aa897['where']=qs['filters'](_[_0x58a5('0x41')](_0x4bbf76[_0x58a5('0x36')],_0x3d8968[_0x58a5('0x38')]),_0x25bb2a);if(_0x4bbf76[_0x58a5('0x36')][_0x58a5('0x42')]){_0x2aa897[_0x58a5('0x43')]=_[_0x58a5('0x44')](_0x2aa897[_0x58a5('0x43')],{'$or':_[_0x58a5('0x35')](_0x25bb2a,function(_0x3cbdea){if(_0x3cbdea[_0x58a5('0x33')]!=='VIRTUAL'){var _0x135915={};_0x135915[_0x3cbdea['name']]={'$like':'%'+_0x4bbf76[_0x58a5('0x36')]['filter']+'%'};return _0x135915;}})});}_0x2aa897=_[_0x58a5('0x44')]({},_0x2aa897,_0x4bbf76[_0x58a5('0x45')]);var _0x3246f7={'where':_0x2aa897[_0x58a5('0x43')]};return db[_0x58a5('0x30')][_0x58a5('0x25')](_0x3246f7)[_0x58a5('0x2a')](function(_0x5aac10){_0x3fbcd9[_0x58a5('0x25')]=_0x5aac10;if(_0x4bbf76['query'][_0x58a5('0x46')]){_0x2aa897[_0x58a5('0x47')]=[{'all':!![]}];}return db[_0x58a5('0x30')][_0x58a5('0x48')](_0x2aa897);})['then'](function(_0x515bb7){_0x3fbcd9[_0x58a5('0x49')]=_0x515bb7;return _0x3fbcd9;})[_0x58a5('0x2a')](respondWithFilteredResult(_0x34bd7a,_0x2aa897))[_0x58a5('0x4a')](handleError(_0x34bd7a,null));};exports['show']=function(_0x4ba45c,_0x4b62f5){var _0xe8ec6={'raw':!![],'where':{'id':_0x4ba45c['params']['id']}},_0x1eeec1={};_0x1eeec1[_0x58a5('0x3a')]=_[_0x58a5('0x37')](db[_0x58a5('0x30')][_0x58a5('0x31')]);_0x1eeec1[_0x58a5('0x36')]=_[_0x58a5('0x37')](_0x4ba45c[_0x58a5('0x36')]);_0x1eeec1[_0x58a5('0x38')]=_[_0x58a5('0x39')](_0x1eeec1['model'],_0x1eeec1[_0x58a5('0x36')]);_0xe8ec6[_0x58a5('0x3b')]=_[_0x58a5('0x39')](_0x1eeec1['model'],qs[_0x58a5('0x3c')](_0x4ba45c[_0x58a5('0x36')][_0x58a5('0x3c')]));_0xe8ec6[_0x58a5('0x3b')]=_0xe8ec6[_0x58a5('0x3b')][_0x58a5('0x4b')]?_0xe8ec6['attributes']:_0x1eeec1[_0x58a5('0x3a')];if(_0x4ba45c[_0x58a5('0x36')][_0x58a5('0x46')]){_0xe8ec6[_0x58a5('0x47')]=[{'all':!![]}];}_0xe8ec6=_[_0x58a5('0x44')]({},_0xe8ec6,_0x4ba45c[_0x58a5('0x45')]);return db[_0x58a5('0x30')][_0x58a5('0x4c')](_0xe8ec6)[_0x58a5('0x2a')](handleEntityNotFound(_0x4b62f5,null))[_0x58a5('0x2a')](respondWithResult(_0x4b62f5,null))[_0x58a5('0x4a')](handleError(_0x4b62f5,null));};exports[_0x58a5('0x4d')]=function(_0x35c827,_0x598219){return db[_0x58a5('0x30')][_0x58a5('0x4d')](_0x35c827[_0x58a5('0x4e')],{})['then'](respondWithResult(_0x598219,0xc9))[_0x58a5('0x4a')](handleError(_0x598219,null));};exports[_0x58a5('0x29')]=function(_0x296c0d,_0x381426){if(_0x296c0d[_0x58a5('0x4e')]['id']){delete _0x296c0d[_0x58a5('0x4e')]['id'];}return db['FaxQueueReport'][_0x58a5('0x4c')]({'where':{'id':_0x296c0d[_0x58a5('0x4f')]['id']}})[_0x58a5('0x2a')](handleEntityNotFound(_0x381426,null))[_0x58a5('0x2a')](saveUpdates(_0x296c0d[_0x58a5('0x4e')],null))[_0x58a5('0x2a')](respondWithResult(_0x381426,null))[_0x58a5('0x4a')](handleError(_0x381426,null));};exports['destroy']=function(_0x1df5ca,_0x4bb401){return db[_0x58a5('0x30')][_0x58a5('0x4c')]({'where':{'id':_0x1df5ca[_0x58a5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4bb401,null))[_0x58a5('0x2a')](removeEntity(_0x4bb401,null))['catch'](handleError(_0x4bb401,null));};exports[_0x58a5('0x50')]=function(_0x305545,_0x4f785e){return db['FaxQueueReport'][_0x58a5('0x50')]()[_0x58a5('0x2a')](respondWithResult(_0x4f785e,null))['catch'](handleError(_0x4f785e,null));}; \ No newline at end of file +var _0x5088=['intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','map','FaxQueueReport','key','keys','query','filters'];(function(_0x538493,_0x3c5710){var _0x44563f=function(_0x23c54e){while(--_0x23c54e){_0x538493['push'](_0x538493['shift']());}};_0x44563f(++_0x3c5710);}(_0x5088,0xa9));var _0x8508=function(_0x500211,_0x1a0367){_0x500211=_0x500211-0x0;var _0x48f4e0=_0x5088[_0x500211];return _0x48f4e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8508('0x0'));var zipdir=require(_0x8508('0x1'));var jsonpatch=require(_0x8508('0x2'));var rp=require(_0x8508('0x3'));var moment=require('moment');var BPromise=require(_0x8508('0x4'));var Mustache=require(_0x8508('0x5'));var util=require(_0x8508('0x6'));var path=require(_0x8508('0x7'));var sox=require('sox');var csv=require(_0x8508('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8508('0x9'));var _=require(_0x8508('0xa'));var squel=require('squel');var crypto=require(_0x8508('0xb'));var jsforce=require(_0x8508('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8508('0x8'));var querystring=require(_0x8508('0xd'));var Papa=require(_0x8508('0xe'));var Redis=require(_0x8508('0xf'));var authService=require(_0x8508('0x10'));var qs=require(_0x8508('0x11'));var as=require(_0x8508('0x12'));var hardwareService=require(_0x8508('0x13'));var logger=require(_0x8508('0x14'))('api');var utils=require(_0x8508('0x15'));var config=require(_0x8508('0x16'));var licenseUtil=require(_0x8508('0x17'));var db=require(_0x8508('0x18'))['db'];function respondWithStatusCode(_0x184f08,_0x129d4c){_0x129d4c=_0x129d4c||0xcc;return function(_0x2a6969){if(_0x2a6969){return _0x184f08['sendStatus'](_0x129d4c);}return _0x184f08[_0x8508('0x19')](_0x129d4c)[_0x8508('0x1a')]();};}function respondWithResult(_0x1d64a7,_0x431b14){_0x431b14=_0x431b14||0xc8;return function(_0x4c4bf9){if(_0x4c4bf9){return _0x1d64a7[_0x8508('0x19')](_0x431b14)[_0x8508('0x1b')](_0x4c4bf9);}};}function respondWithFilteredResult(_0x5b1b8d,_0x34da29){return function(_0x4f81c7){if(_0x4f81c7){var _0xe8daa7=typeof _0x34da29[_0x8508('0x1c')]===_0x8508('0x1d')&&typeof _0x34da29[_0x8508('0x1e')]===_0x8508('0x1d');var _0x5668d3=_0x4f81c7[_0x8508('0x1f')];var _0x12a592=_0xe8daa7?0x0:_0x34da29['offset'];var _0x53621f=_0xe8daa7?_0x4f81c7[_0x8508('0x1f')]:_0x34da29['offset']+_0x34da29[_0x8508('0x1e')];var _0x3a8832;if(_0x53621f>=_0x5668d3){_0x53621f=_0x5668d3;_0x3a8832=0xc8;}else{_0x3a8832=0xce;}_0x5b1b8d[_0x8508('0x19')](_0x3a8832);return _0x5b1b8d['set'](_0x8508('0x20'),_0x12a592+'-'+_0x53621f+'/'+_0x5668d3)[_0x8508('0x1b')](_0x4f81c7);}return null;};}function patchUpdates(_0x245f8c){return function(_0x1da402){try{jsonpatch[_0x8508('0x21')](_0x1da402,_0x245f8c,!![]);}catch(_0x2d041e){return BPromise[_0x8508('0x22')](_0x2d041e);}return _0x1da402[_0x8508('0x23')]();};}function saveUpdates(_0x266b93,_0x34ee74){return function(_0x455594){if(_0x455594){return _0x455594['update'](_0x266b93)[_0x8508('0x24')](function(_0x1fb31e){return _0x1fb31e;});}return null;};}function removeEntity(_0x43fa1b,_0x5874b2){return function(_0x1efffd){if(_0x1efffd){return _0x1efffd[_0x8508('0x25')]()[_0x8508('0x24')](function(){_0x43fa1b['status'](0xcc)[_0x8508('0x1a')]();});}};}function handleEntityNotFound(_0x133d37,_0x373c86){return function(_0x2ccf2d){if(!_0x2ccf2d){_0x133d37['sendStatus'](0x194);}return _0x2ccf2d;};}function handleError(_0x500849,_0x3dcdff){_0x3dcdff=_0x3dcdff||0x1f4;return function(_0x4d872c){logger[_0x8508('0x26')](_0x4d872c['stack']);if(_0x4d872c[_0x8508('0x27')]){delete _0x4d872c[_0x8508('0x27')];}_0x500849[_0x8508('0x19')](_0x3dcdff)[_0x8508('0x28')](_0x4d872c);};}exports['index']=function(_0x2a99e0,_0x3d0d71){var _0x473363={},_0x4e51db={},_0x68f48c={'count':0x0,'rows':[]};var _0x4f9cbf=_[_0x8508('0x29')](db[_0x8508('0x2a')]['rawAttributes'],function(_0x307a8a){return{'name':_0x307a8a['fieldName'],'type':_0x307a8a['type'][_0x8508('0x2b')]};});_0x4e51db['model']=_[_0x8508('0x29')](_0x4f9cbf,_0x8508('0x27'));_0x4e51db['query']=_[_0x8508('0x2c')](_0x2a99e0[_0x8508('0x2d')]);_0x4e51db[_0x8508('0x2e')]=_[_0x8508('0x2f')](_0x4e51db[_0x8508('0x30')],_0x4e51db['query']);_0x473363[_0x8508('0x31')]=_[_0x8508('0x2f')](_0x4e51db[_0x8508('0x30')],qs['fields'](_0x2a99e0[_0x8508('0x2d')][_0x8508('0x32')]));_0x473363[_0x8508('0x31')]=_0x473363[_0x8508('0x31')]['length']?_0x473363['attributes']:_0x4e51db[_0x8508('0x30')];if(!_0x2a99e0[_0x8508('0x2d')][_0x8508('0x33')]('nolimit')){_0x473363[_0x8508('0x1e')]=qs[_0x8508('0x1e')](_0x2a99e0[_0x8508('0x2d')]['limit']);_0x473363['offset']=qs[_0x8508('0x1c')](_0x2a99e0['query']['offset']);}_0x473363[_0x8508('0x34')]=qs[_0x8508('0x35')](_0x2a99e0[_0x8508('0x2d')][_0x8508('0x35')]);_0x473363[_0x8508('0x36')]=qs['filters'](_[_0x8508('0x37')](_0x2a99e0['query'],_0x4e51db['filters']),_0x4f9cbf);if(_0x2a99e0[_0x8508('0x2d')][_0x8508('0x38')]){_0x473363[_0x8508('0x36')]=_[_0x8508('0x39')](_0x473363[_0x8508('0x36')],{'$or':_[_0x8508('0x29')](_0x4f9cbf,function(_0x58de84){if(_0x58de84['type']!==_0x8508('0x3a')){var _0x4a16dd={};_0x4a16dd[_0x58de84[_0x8508('0x27')]]={'$like':'%'+_0x2a99e0[_0x8508('0x2d')][_0x8508('0x38')]+'%'};return _0x4a16dd;}})});}_0x473363=_[_0x8508('0x39')]({},_0x473363,_0x2a99e0[_0x8508('0x3b')]);var _0x12a899={'where':_0x473363[_0x8508('0x36')]};return db[_0x8508('0x2a')][_0x8508('0x1f')](_0x12a899)[_0x8508('0x24')](function(_0x366750){_0x68f48c[_0x8508('0x1f')]=_0x366750;if(_0x2a99e0[_0x8508('0x2d')][_0x8508('0x3c')]){_0x473363[_0x8508('0x3d')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x8508('0x3e')](_0x473363);})[_0x8508('0x24')](function(_0x2e7b12){_0x68f48c[_0x8508('0x3f')]=_0x2e7b12;return _0x68f48c;})['then'](respondWithFilteredResult(_0x3d0d71,_0x473363))['catch'](handleError(_0x3d0d71,null));};exports[_0x8508('0x40')]=function(_0x2352fc,_0x1b8fe7){var _0x491559={'raw':!![],'where':{'id':_0x2352fc[_0x8508('0x41')]['id']}},_0x48adef={};_0x48adef[_0x8508('0x30')]=_[_0x8508('0x2c')](db['FaxQueueReport']['rawAttributes']);_0x48adef[_0x8508('0x2d')]=_[_0x8508('0x2c')](_0x2352fc[_0x8508('0x2d')]);_0x48adef['filters']=_[_0x8508('0x2f')](_0x48adef[_0x8508('0x30')],_0x48adef[_0x8508('0x2d')]);_0x491559[_0x8508('0x31')]=_[_0x8508('0x2f')](_0x48adef[_0x8508('0x30')],qs[_0x8508('0x32')](_0x2352fc['query'][_0x8508('0x32')]));_0x491559[_0x8508('0x31')]=_0x491559['attributes'][_0x8508('0x42')]?_0x491559['attributes']:_0x48adef[_0x8508('0x30')];if(_0x2352fc[_0x8508('0x2d')][_0x8508('0x3c')]){_0x491559[_0x8508('0x3d')]=[{'all':!![]}];}_0x491559=_[_0x8508('0x39')]({},_0x491559,_0x2352fc[_0x8508('0x3b')]);return db[_0x8508('0x2a')][_0x8508('0x43')](_0x491559)['then'](handleEntityNotFound(_0x1b8fe7,null))[_0x8508('0x24')](respondWithResult(_0x1b8fe7,null))[_0x8508('0x44')](handleError(_0x1b8fe7,null));};exports[_0x8508('0x45')]=function(_0x4787f6,_0x3a1907){return db['FaxQueueReport'][_0x8508('0x45')](_0x4787f6[_0x8508('0x46')],{})[_0x8508('0x24')](respondWithResult(_0x3a1907,0xc9))[_0x8508('0x44')](handleError(_0x3a1907,null));};exports['update']=function(_0x4e4d38,_0x2a8094){if(_0x4e4d38[_0x8508('0x46')]['id']){delete _0x4e4d38[_0x8508('0x46')]['id'];}return db['FaxQueueReport'][_0x8508('0x43')]({'where':{'id':_0x4e4d38[_0x8508('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a8094,null))[_0x8508('0x24')](saveUpdates(_0x4e4d38['body'],null))[_0x8508('0x24')](respondWithResult(_0x2a8094,null))[_0x8508('0x44')](handleError(_0x2a8094,null));};exports[_0x8508('0x25')]=function(_0x1dd21f,_0x2bbbd8){return db['FaxQueueReport'][_0x8508('0x43')]({'where':{'id':_0x1dd21f[_0x8508('0x41')]['id']}})[_0x8508('0x24')](handleEntityNotFound(_0x2bbbd8,null))[_0x8508('0x24')](removeEntity(_0x2bbbd8,null))[_0x8508('0x44')](handleError(_0x2bbbd8,null));};exports[_0x8508('0x47')]=function(_0x5dc061,_0x3597b6){return db[_0x8508('0x2a')][_0x8508('0x47')]()[_0x8508('0x24')](respondWithResult(_0x3597b6,null))['catch'](handleError(_0x3597b6,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ff54b97..0d8ae12 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x5dc4d5,_0x21e28a){var _0xc77b1b=function(_0x21ae7b){while(--_0x21ae7b){_0x5dc4d5['push'](_0x5dc4d5['shift']());}};_0xc77b1b(++_0x21e28a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xbf6f32,_0x3d793a){_0xbf6f32=_0xbf6f32-0x0;var _0x1d3ecc=_0x7fbe[_0xbf6f32];return _0x1d3ecc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0xf9c3d3,_0x11f06b){var _0xb90bdd=function(_0x5526ba){while(--_0x5526ba){_0xf9c3d3['push'](_0xf9c3d3['shift']());}};_0xb90bdd(++_0x11f06b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4045ff,_0x46cbcd){_0x4045ff=_0x4045ff-0x0;var _0x5797ac=_0x7fbe[_0x4045ff];return _0x5797ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 00d99e5..dd87bfc 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 _0x4252=['message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug','UpdateFaxQueueReport','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0x4252,0x71));var _0x2425=function(_0x2bc9d7,_0xc560c2){_0x2bc9d7=_0x2bc9d7-0x0;var _0x50dc44=_0x4252[_0x2bc9d7];return _0x50dc44;};'use strict';var _=require(_0x2425('0x0'));var util=require('util');var moment=require(_0x2425('0x1'));var BPromise=require('bluebird');var rs=require(_0x2425('0x2'));var fs=require('fs');var Redis=require(_0x2425('0x3'));var db=require(_0x2425('0x4'))['db'];var utils=require(_0x2425('0x5'));var logger=require(_0x2425('0x6'))(_0x2425('0x7'));var config=require(_0x2425('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2425('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56221f,_0x1853e0,_0x30e5e3){return new BPromise(function(_0x429596,_0x39b872){return client[_0x2425('0xa')](_0x56221f,_0x30e5e3)[_0x2425('0xb')](function(_0x16c54f){logger[_0x2425('0xc')](_0x2425('0xd'),_0x1853e0,_0x2425('0xe'));logger['debug'](_0x2425('0xf'),_0x1853e0,_0x2425('0xe'),JSON[_0x2425('0x10')](_0x16c54f));if(_0x16c54f[_0x2425('0x11')]){if(_0x16c54f[_0x2425('0x11')][_0x2425('0x12')]===0x1f4){logger[_0x2425('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x1853e0,_0x16c54f[_0x2425('0x11')]['message']);return _0x39b872(_0x16c54f[_0x2425('0x11')][_0x2425('0x13')]);}logger[_0x2425('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x1853e0,_0x16c54f[_0x2425('0x11')]['message']);return _0x429596(_0x16c54f[_0x2425('0x11')][_0x2425('0x13')]);}else{logger[_0x2425('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x1853e0,_0x2425('0xe'));_0x429596(_0x16c54f[_0x2425('0x14')][_0x2425('0x13')]);}})[_0x2425('0x15')](function(_0x47834f){logger['error'](_0x2425('0xd'),_0x1853e0,_0x47834f);_0x39b872(_0x47834f);});});}exports[_0x2425('0x16')]=function(_0x2e8844){var _0x34a58b=this;return new Promise(function(_0x4000ab,_0x492e3a){return db[_0x2425('0x17')][_0x2425('0x18')](_0x2e8844[_0x2425('0x19')],{'raw':_0x2e8844['options']?_0x2e8844[_0x2425('0x1a')][_0x2425('0x1b')]===undefined?!![]:![]:!![]})[_0x2425('0xb')](function(_0x3eae6b){logger[_0x2425('0xc')](_0x2425('0x16'),_0x2e8844);logger[_0x2425('0x1c')](_0x2425('0x16'),_0x2e8844,JSON['stringify'](_0x3eae6b));_0x4000ab(_0x3eae6b);})[_0x2425('0x15')](function(_0x2139dc){logger[_0x2425('0x11')](_0x2425('0x16'),_0x2139dc['message'],_0x2e8844);_0x492e3a(_0x34a58b[_0x2425('0x11')](0x1f4,_0x2139dc[_0x2425('0x13')]));});});};exports[_0x2425('0x1d')]=function(_0x50cbe5){var _0x407e8b=this;return new Promise(function(_0x2e8aeb,_0x473f03){return db['FaxQueueReport']['update'](_0x50cbe5['body'],{'raw':_0x50cbe5[_0x2425('0x1a')]?_0x50cbe5[_0x2425('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50cbe5[_0x2425('0x1a')]?_0x50cbe5['options'][_0x2425('0x1e')]||null:null,'attributes':_0x50cbe5[_0x2425('0x1a')]?_0x50cbe5[_0x2425('0x1a')][_0x2425('0x1f')]||null:null,'limit':_0x50cbe5[_0x2425('0x1a')]?_0x50cbe5['options'][_0x2425('0x20')]||null:null})[_0x2425('0xb')](function(_0x313c20){logger[_0x2425('0xc')]('UpdateFaxQueueReport',_0x50cbe5);logger['debug']('UpdateFaxQueueReport',_0x50cbe5,JSON[_0x2425('0x10')](_0x313c20));_0x2e8aeb(_0x313c20);})[_0x2425('0x15')](function(_0x4364db){logger['error']('UpdateFaxQueueReport',_0x4364db[_0x2425('0x13')],_0x50cbe5);_0x473f03(_0x407e8b[_0x2425('0x11')](0x1f4,_0x4364db[_0x2425('0x13')]));});});}; \ No newline at end of file +var _0x6343=['request\x20sent','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','FaxQueueReport','create','body','options','then','CreateFaxQueueReport','debug','stringify','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x1bc76e,_0x3c2452){var _0x549281=function(_0x1b2f6f){while(--_0x1b2f6f){_0x1bc76e['push'](_0x1bc76e['shift']());}};_0x549281(++_0x3c2452);}(_0x6343,0x1db));var _0x3634=function(_0x91461d,_0x4ad392){_0x91461d=_0x91461d-0x0;var _0x4df48e=_0x6343[_0x91461d];return _0x4df48e;};'use strict';var _=require(_0x3634('0x0'));var util=require(_0x3634('0x1'));var moment=require(_0x3634('0x2'));var BPromise=require(_0x3634('0x3'));var rs=require(_0x3634('0x4'));var fs=require('fs');var Redis=require(_0x3634('0x5'));var db=require(_0x3634('0x6'))['db'];var utils=require(_0x3634('0x7'));var logger=require(_0x3634('0x8'))(_0x3634('0x9'));var config=require('../../config/environment');var jayson=require(_0x3634('0xa'));var client=jayson[_0x3634('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2877da,_0x63aedc,_0x51f7f5){return new BPromise(function(_0x3b5a5c,_0x5b4965){return client[_0x3634('0xc')](_0x2877da,_0x51f7f5)['then'](function(_0x261e0e){logger[_0x3634('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x63aedc,'request\x20sent');logger['debug'](_0x3634('0xe'),_0x63aedc,_0x3634('0xf'),JSON['stringify'](_0x261e0e));if(_0x261e0e[_0x3634('0x10')]){if(_0x261e0e[_0x3634('0x10')]['code']===0x1f4){logger[_0x3634('0x10')](_0x3634('0x11'),_0x63aedc,_0x261e0e[_0x3634('0x10')][_0x3634('0x12')]);return _0x5b4965(_0x261e0e['error'][_0x3634('0x12')]);}logger[_0x3634('0x10')](_0x3634('0x11'),_0x63aedc,_0x261e0e[_0x3634('0x10')][_0x3634('0x12')]);return _0x3b5a5c(_0x261e0e[_0x3634('0x10')][_0x3634('0x12')]);}else{logger[_0x3634('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x63aedc,'request\x20sent');_0x3b5a5c(_0x261e0e[_0x3634('0x13')]['message']);}})[_0x3634('0x14')](function(_0x28c419){logger[_0x3634('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x63aedc,_0x28c419);_0x5b4965(_0x28c419);});});}exports['CreateFaxQueueReport']=function(_0x13b140){var _0x1f6680=this;return new Promise(function(_0x1989fd,_0x3d67ca){return db[_0x3634('0x15')][_0x3634('0x16')](_0x13b140[_0x3634('0x17')],{'raw':_0x13b140[_0x3634('0x18')]?_0x13b140[_0x3634('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3634('0x19')](function(_0x689ce6){logger['info'](_0x3634('0x1a'),_0x13b140);logger[_0x3634('0x1b')]('CreateFaxQueueReport',_0x13b140,JSON[_0x3634('0x1c')](_0x689ce6));_0x1989fd(_0x689ce6);})[_0x3634('0x14')](function(_0x1f2b1c){logger[_0x3634('0x10')](_0x3634('0x1a'),_0x1f2b1c[_0x3634('0x12')],_0x13b140);_0x3d67ca(_0x1f6680['error'](0x1f4,_0x1f2b1c[_0x3634('0x12')]));});});};exports[_0x3634('0x1d')]=function(_0x53bf1b){var _0x4ac218=this;return new Promise(function(_0x2901d7,_0x4ed2df){return db['FaxQueueReport'][_0x3634('0x1e')](_0x53bf1b[_0x3634('0x17')],{'raw':_0x53bf1b[_0x3634('0x18')]?_0x53bf1b[_0x3634('0x18')][_0x3634('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53bf1b[_0x3634('0x18')]?_0x53bf1b[_0x3634('0x18')][_0x3634('0x20')]||null:null,'attributes':_0x53bf1b[_0x3634('0x18')]?_0x53bf1b[_0x3634('0x18')][_0x3634('0x21')]||null:null,'limit':_0x53bf1b[_0x3634('0x18')]?_0x53bf1b[_0x3634('0x18')][_0x3634('0x22')]||null:null})[_0x3634('0x19')](function(_0x47fa96){logger[_0x3634('0xd')](_0x3634('0x1d'),_0x53bf1b);logger['debug'](_0x3634('0x1d'),_0x53bf1b,JSON[_0x3634('0x1c')](_0x47fa96));_0x2901d7(_0x47fa96);})['catch'](function(_0x491989){logger['error'](_0x3634('0x1d'),_0x491989['message'],_0x53bf1b);_0x4ed2df(_0x4ac218['error'](0x1f4,_0x491989[_0x3634('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 9671f5f..fa823af 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 _0xbc47=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xbc47,0x1db));var _0x7bc4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xbc47[_0x23e7c1];return _0x1add43;};'use strict';var multer=require('multer');var util=require(_0x7bc4('0x0'));var path=require(_0x7bc4('0x1'));var timeout=require(_0x7bc4('0x2'));var express=require('express');var router=express[_0x7bc4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7bc4('0x4'));var interaction=require(_0x7bc4('0x5'));var config=require(_0x7bc4('0x6'));var controller=require(_0x7bc4('0x7'));router[_0x7bc4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bc4('0x8')]('/describe',auth[_0x7bc4('0x9')](),controller[_0x7bc4('0xa')]);router[_0x7bc4('0x8')](_0x7bc4('0xb'),auth[_0x7bc4('0x9')](),controller[_0x7bc4('0xc')]);router['post']('/',auth[_0x7bc4('0x9')](),controller[_0x7bc4('0xd')]);router[_0x7bc4('0xe')](_0x7bc4('0xb'),auth[_0x7bc4('0x9')](),controller[_0x7bc4('0xf')]);router[_0x7bc4('0x10')](_0x7bc4('0xb'),auth[_0x7bc4('0x9')](),controller[_0x7bc4('0x11')]);module[_0x7bc4('0x12')]=router; \ No newline at end of file +var _0x6c0c=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','delete','destroy'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0x6c0c,0x1a5));var _0xc6c0=function(_0xa6b443,_0x3fd555){_0xa6b443=_0xa6b443-0x0;var _0x13bb8a=_0x6c0c[_0xa6b443];return _0x13bb8a;};'use strict';var multer=require('multer');var util=require(_0xc6c0('0x0'));var path=require(_0xc6c0('0x1'));var timeout=require('connect-timeout');var express=require(_0xc6c0('0x2'));var router=express[_0xc6c0('0x3')]();var fs_extra=require(_0xc6c0('0x4'));var auth=require(_0xc6c0('0x5'));var interaction=require(_0xc6c0('0x6'));var config=require(_0xc6c0('0x7'));var controller=require('./faxQueueReport.controller');router[_0xc6c0('0x8')]('/',auth['isAuthenticated'](),controller[_0xc6c0('0x9')]);router[_0xc6c0('0x8')](_0xc6c0('0xa'),auth[_0xc6c0('0xb')](),controller[_0xc6c0('0xc')]);router[_0xc6c0('0x8')](_0xc6c0('0xd'),auth[_0xc6c0('0xb')](),controller[_0xc6c0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc6c0('0xf')]);router[_0xc6c0('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc6c0('0x11')]('/:id',auth[_0xc6c0('0xb')](),controller[_0xc6c0('0x12')]);module[_0xc6c0('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4c20b3f..e7787b5 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x169c01,_0x59f28d){var _0x2c3be4=function(_0x14032f){while(--_0x14032f){_0x169c01['push'](_0x169c01['shift']());}};_0x2c3be4(++_0x59f28d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3ebaa4,_0x2e8ec9){_0x3ebaa4=_0x3ebaa4-0x0;var _0x1d65fc=_0xb43b[_0x3ebaa4];return _0x1d65fc;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 843293a..3baf133 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 _0x52db=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body','update','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','sendStatus','error','name','index','map','FaxTransferReport','fieldName','type','key','query','keys'];(function(_0x966ae8,_0x4770cc){var _0x573e66=function(_0x6f9d71){while(--_0x6f9d71){_0x966ae8['push'](_0x966ae8['shift']());}};_0x573e66(++_0x4770cc);}(_0x52db,0xa7));var _0xb52d=function(_0x593338,_0x2cd36a){_0x593338=_0x593338-0x0;var _0x12e53c=_0x52db[_0x593338];return _0x12e53c;};'use strict';var emlformat=require(_0xb52d('0x0'));var rimraf=require(_0xb52d('0x1'));var zipdir=require(_0xb52d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb52d('0x3'));var moment=require(_0xb52d('0x4'));var BPromise=require(_0xb52d('0x5'));var Mustache=require(_0xb52d('0x6'));var util=require('util');var path=require(_0xb52d('0x7'));var sox=require(_0xb52d('0x8'));var csv=require(_0xb52d('0x9'));var ejs=require(_0xb52d('0xa'));var fs=require('fs');var fs_extra=require(_0xb52d('0xb'));var _=require('lodash');var squel=require(_0xb52d('0xc'));var crypto=require(_0xb52d('0xd'));var jsforce=require(_0xb52d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb52d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');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('../../config/license/hardware');var logger=require(_0xb52d('0xf'))(_0xb52d('0x10'));var utils=require('../../config/utils');var config=require(_0xb52d('0x11'));var licenseUtil=require(_0xb52d('0x12'));var db=require(_0xb52d('0x13'))['db'];function respondWithStatusCode(_0x54209e,_0x2e3b58){_0x2e3b58=_0x2e3b58||0xcc;return function(_0x43d31b){if(_0x43d31b){return _0x54209e['sendStatus'](_0x2e3b58);}return _0x54209e[_0xb52d('0x14')](_0x2e3b58)[_0xb52d('0x15')]();};}function respondWithResult(_0x5b05a7,_0x508a70){_0x508a70=_0x508a70||0xc8;return function(_0x5d728e){if(_0x5d728e){return _0x5b05a7[_0xb52d('0x14')](_0x508a70)[_0xb52d('0x16')](_0x5d728e);}};}function respondWithFilteredResult(_0x58bb1e,_0x29a58c){return function(_0x365bf8){if(_0x365bf8){var _0x22e5bb=typeof _0x29a58c[_0xb52d('0x17')]===_0xb52d('0x18')&&typeof _0x29a58c[_0xb52d('0x19')]===_0xb52d('0x18');var _0x1493d3=_0x365bf8[_0xb52d('0x1a')];var _0xa6241d=_0x22e5bb?0x0:_0x29a58c[_0xb52d('0x17')];var _0x36324a=_0x22e5bb?_0x365bf8[_0xb52d('0x1a')]:_0x29a58c[_0xb52d('0x17')]+_0x29a58c['limit'];var _0x490d60;if(_0x36324a>=_0x1493d3){_0x36324a=_0x1493d3;_0x490d60=0xc8;}else{_0x490d60=0xce;}_0x58bb1e[_0xb52d('0x14')](_0x490d60);return _0x58bb1e['set'](_0xb52d('0x1b'),_0xa6241d+'-'+_0x36324a+'/'+_0x1493d3)[_0xb52d('0x16')](_0x365bf8);}return null;};}function patchUpdates(_0x25d20f){return function(_0xa19c54){try{jsonpatch['apply'](_0xa19c54,_0x25d20f,!![]);}catch(_0x54c1d3){return BPromise[_0xb52d('0x1c')](_0x54c1d3);}return _0xa19c54[_0xb52d('0x1d')]();};}function saveUpdates(_0x306397,_0x21f234){return function(_0x575c16){if(_0x575c16){return _0x575c16['update'](_0x306397)[_0xb52d('0x1e')](function(_0x4575bd){return _0x4575bd;});}return null;};}function removeEntity(_0x5653d1,_0x3a245e){return function(_0x295f9f){if(_0x295f9f){return _0x295f9f[_0xb52d('0x1f')]()[_0xb52d('0x1e')](function(){_0x5653d1[_0xb52d('0x14')](0xcc)[_0xb52d('0x15')]();});}};}function handleEntityNotFound(_0x1a77b8,_0x4aad6b){return function(_0x514904){if(!_0x514904){_0x1a77b8[_0xb52d('0x20')](0x194);}return _0x514904;};}function handleError(_0x548267,_0x143768){_0x143768=_0x143768||0x1f4;return function(_0x774f19){logger[_0xb52d('0x21')](_0x774f19['stack']);if(_0x774f19[_0xb52d('0x22')]){delete _0x774f19['name'];}_0x548267[_0xb52d('0x14')](_0x143768)['send'](_0x774f19);};}exports[_0xb52d('0x23')]=function(_0x18bd44,_0x410482){var _0x34d62f={},_0x558c95={},_0x3011e5={'count':0x0,'rows':[]};var _0x481076=_[_0xb52d('0x24')](db[_0xb52d('0x25')]['rawAttributes'],function(_0x4db25a){return{'name':_0x4db25a[_0xb52d('0x26')],'type':_0x4db25a[_0xb52d('0x27')][_0xb52d('0x28')]};});_0x558c95['model']=_[_0xb52d('0x24')](_0x481076,_0xb52d('0x22'));_0x558c95[_0xb52d('0x29')]=_[_0xb52d('0x2a')](_0x18bd44[_0xb52d('0x29')]);_0x558c95[_0xb52d('0x2b')]=_[_0xb52d('0x2c')](_0x558c95[_0xb52d('0x2d')],_0x558c95[_0xb52d('0x29')]);_0x34d62f['attributes']=_[_0xb52d('0x2c')](_0x558c95[_0xb52d('0x2d')],qs[_0xb52d('0x2e')](_0x18bd44[_0xb52d('0x29')][_0xb52d('0x2e')]));_0x34d62f[_0xb52d('0x2f')]=_0x34d62f['attributes'][_0xb52d('0x30')]?_0x34d62f['attributes']:_0x558c95[_0xb52d('0x2d')];if(!_0x18bd44[_0xb52d('0x29')][_0xb52d('0x31')](_0xb52d('0x32'))){_0x34d62f[_0xb52d('0x19')]=qs[_0xb52d('0x19')](_0x18bd44['query']['limit']);_0x34d62f[_0xb52d('0x17')]=qs['offset'](_0x18bd44[_0xb52d('0x29')][_0xb52d('0x17')]);}_0x34d62f['order']=qs[_0xb52d('0x33')](_0x18bd44['query']['sort']);_0x34d62f[_0xb52d('0x34')]=qs[_0xb52d('0x2b')](_[_0xb52d('0x35')](_0x18bd44[_0xb52d('0x29')],_0x558c95[_0xb52d('0x2b')]),_0x481076);if(_0x18bd44[_0xb52d('0x29')][_0xb52d('0x36')]){_0x34d62f[_0xb52d('0x34')]=_[_0xb52d('0x37')](_0x34d62f[_0xb52d('0x34')],{'$or':_[_0xb52d('0x24')](_0x481076,function(_0x1d251a){if(_0x1d251a[_0xb52d('0x27')]!==_0xb52d('0x38')){var _0x218cfa={};_0x218cfa[_0x1d251a[_0xb52d('0x22')]]={'$like':'%'+_0x18bd44[_0xb52d('0x29')]['filter']+'%'};return _0x218cfa;}})});}_0x34d62f=_[_0xb52d('0x37')]({},_0x34d62f,_0x18bd44[_0xb52d('0x39')]);var _0x2ee6f9={'where':_0x34d62f['where']};return db[_0xb52d('0x25')]['count'](_0x2ee6f9)[_0xb52d('0x1e')](function(_0x19c637){_0x3011e5[_0xb52d('0x1a')]=_0x19c637;if(_0x18bd44[_0xb52d('0x29')]['includeAll']){_0x34d62f[_0xb52d('0x3a')]=[{'all':!![]}];}return db[_0xb52d('0x25')][_0xb52d('0x3b')](_0x34d62f);})[_0xb52d('0x1e')](function(_0xc56d9c){_0x3011e5[_0xb52d('0x3c')]=_0xc56d9c;return _0x3011e5;})['then'](respondWithFilteredResult(_0x410482,_0x34d62f))[_0xb52d('0x3d')](handleError(_0x410482,null));};exports[_0xb52d('0x3e')]=function(_0xaf6522,_0x9ae54a){var _0x43303d={'raw':!![],'where':{'id':_0xaf6522['params']['id']}},_0x1f976a={};_0x1f976a[_0xb52d('0x2d')]=_[_0xb52d('0x2a')](db[_0xb52d('0x25')][_0xb52d('0x3f')]);_0x1f976a[_0xb52d('0x29')]=_[_0xb52d('0x2a')](_0xaf6522[_0xb52d('0x29')]);_0x1f976a[_0xb52d('0x2b')]=_[_0xb52d('0x2c')](_0x1f976a[_0xb52d('0x2d')],_0x1f976a[_0xb52d('0x29')]);_0x43303d[_0xb52d('0x2f')]=_['intersection'](_0x1f976a[_0xb52d('0x2d')],qs['fields'](_0xaf6522[_0xb52d('0x29')][_0xb52d('0x2e')]));_0x43303d[_0xb52d('0x2f')]=_0x43303d['attributes'][_0xb52d('0x30')]?_0x43303d['attributes']:_0x1f976a[_0xb52d('0x2d')];if(_0xaf6522[_0xb52d('0x29')][_0xb52d('0x40')]){_0x43303d[_0xb52d('0x3a')]=[{'all':!![]}];}_0x43303d=_[_0xb52d('0x37')]({},_0x43303d,_0xaf6522[_0xb52d('0x39')]);return db[_0xb52d('0x25')]['find'](_0x43303d)[_0xb52d('0x1e')](handleEntityNotFound(_0x9ae54a,null))['then'](respondWithResult(_0x9ae54a,null))[_0xb52d('0x3d')](handleError(_0x9ae54a,null));};exports[_0xb52d('0x41')]=function(_0x5b30db,_0xbf93f9){return db[_0xb52d('0x25')][_0xb52d('0x41')](_0x5b30db[_0xb52d('0x42')],{})[_0xb52d('0x1e')](respondWithResult(_0xbf93f9,0xc9))['catch'](handleError(_0xbf93f9,null));};exports[_0xb52d('0x43')]=function(_0x3020fb,_0x493f72){if(_0x3020fb[_0xb52d('0x42')]['id']){delete _0x3020fb[_0xb52d('0x42')]['id'];}return db[_0xb52d('0x25')][_0xb52d('0x44')]({'where':{'id':_0x3020fb[_0xb52d('0x45')]['id']}})[_0xb52d('0x1e')](handleEntityNotFound(_0x493f72,null))[_0xb52d('0x1e')](saveUpdates(_0x3020fb[_0xb52d('0x42')],null))[_0xb52d('0x1e')](respondWithResult(_0x493f72,null))[_0xb52d('0x3d')](handleError(_0x493f72,null));};exports['destroy']=function(_0x388be8,_0x2750b0){return db[_0xb52d('0x25')][_0xb52d('0x44')]({'where':{'id':_0x388be8[_0xb52d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2750b0,null))['then'](removeEntity(_0x2750b0,null))['catch'](handleError(_0x2750b0,null));};exports['describe']=function(_0x1257cb,_0x51fd1c){return db[_0xb52d('0x25')]['describe']()['then'](respondWithResult(_0x51fd1c,null))['catch'](handleError(_0x51fd1c,null));}; \ No newline at end of file +var _0x09f1=['save','update','then','destroy','error','stack','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x1ad508,_0x24c73b){var _0x272102=function(_0x34919d){while(--_0x34919d){_0x1ad508['push'](_0x1ad508['shift']());}};_0x272102(++_0x24c73b);}(_0x09f1,0x10b));var _0x109f=function(_0x5d917a,_0x3d115a){_0x5d917a=_0x5d917a-0x0;var _0x1d236d=_0x09f1[_0x5d917a];return _0x1d236d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x109f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x109f('0x1'));var rp=require(_0x109f('0x2'));var moment=require(_0x109f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x109f('0x4'));var util=require(_0x109f('0x5'));var path=require(_0x109f('0x6'));var sox=require(_0x109f('0x7'));var csv=require(_0x109f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x109f('0x9'));var _=require('lodash');var squel=require(_0x109f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x109f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x109f('0xc'));var Papa=require('papaparse');var Redis=require(_0x109f('0xd'));var authService=require(_0x109f('0xe'));var qs=require(_0x109f('0xf'));var as=require(_0x109f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x109f('0x11'))('api');var utils=require(_0x109f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x109f('0x13'));var db=require(_0x109f('0x14'))['db'];function respondWithStatusCode(_0x547dce,_0x3964ca){_0x3964ca=_0x3964ca||0xcc;return function(_0xf273cc){if(_0xf273cc){return _0x547dce[_0x109f('0x15')](_0x3964ca);}return _0x547dce['status'](_0x3964ca)[_0x109f('0x16')]();};}function respondWithResult(_0x297872,_0x1baf49){_0x1baf49=_0x1baf49||0xc8;return function(_0x4c1663){if(_0x4c1663){return _0x297872[_0x109f('0x17')](_0x1baf49)[_0x109f('0x18')](_0x4c1663);}};}function respondWithFilteredResult(_0x2a27af,_0x5568b6){return function(_0x5fd6ba){if(_0x5fd6ba){var _0x490267=typeof _0x5568b6[_0x109f('0x19')]===_0x109f('0x1a')&&typeof _0x5568b6[_0x109f('0x1b')]===_0x109f('0x1a');var _0x1d8661=_0x5fd6ba[_0x109f('0x1c')];var _0x244f4d=_0x490267?0x0:_0x5568b6['offset'];var _0x3a4819=_0x490267?_0x5fd6ba[_0x109f('0x1c')]:_0x5568b6[_0x109f('0x19')]+_0x5568b6['limit'];var _0x44a8de;if(_0x3a4819>=_0x1d8661){_0x3a4819=_0x1d8661;_0x44a8de=0xc8;}else{_0x44a8de=0xce;}_0x2a27af[_0x109f('0x17')](_0x44a8de);return _0x2a27af[_0x109f('0x1d')](_0x109f('0x1e'),_0x244f4d+'-'+_0x3a4819+'/'+_0x1d8661)['json'](_0x5fd6ba);}return null;};}function patchUpdates(_0x4edfde){return function(_0x474338){try{jsonpatch[_0x109f('0x1f')](_0x474338,_0x4edfde,!![]);}catch(_0xdc2818){return BPromise[_0x109f('0x20')](_0xdc2818);}return _0x474338[_0x109f('0x21')]();};}function saveUpdates(_0x230764,_0x267bb4){return function(_0x11c8cd){if(_0x11c8cd){return _0x11c8cd[_0x109f('0x22')](_0x230764)[_0x109f('0x23')](function(_0x217b0e){return _0x217b0e;});}return null;};}function removeEntity(_0x44c190,_0x1fc9e0){return function(_0x2cf910){if(_0x2cf910){return _0x2cf910[_0x109f('0x24')]()[_0x109f('0x23')](function(){_0x44c190['status'](0xcc)[_0x109f('0x16')]();});}};}function handleEntityNotFound(_0x5e0862,_0x3ad353){return function(_0xc5279e){if(!_0xc5279e){_0x5e0862[_0x109f('0x15')](0x194);}return _0xc5279e;};}function handleError(_0x532972,_0x7fa005){_0x7fa005=_0x7fa005||0x1f4;return function(_0x46ff8c){logger[_0x109f('0x25')](_0x46ff8c[_0x109f('0x26')]);if(_0x46ff8c['name']){delete _0x46ff8c['name'];}_0x532972[_0x109f('0x17')](_0x7fa005)[_0x109f('0x27')](_0x46ff8c);};}exports[_0x109f('0x28')]=function(_0x488a6a,_0x4e9342){var _0x1a7410={},_0x10e1bc={},_0x228df9={'count':0x0,'rows':[]};var _0x131242=_['map'](db[_0x109f('0x29')][_0x109f('0x2a')],function(_0x58953b){return{'name':_0x58953b[_0x109f('0x2b')],'type':_0x58953b[_0x109f('0x2c')][_0x109f('0x2d')]};});_0x10e1bc[_0x109f('0x2e')]=_[_0x109f('0x2f')](_0x131242,_0x109f('0x30'));_0x10e1bc[_0x109f('0x31')]=_['keys'](_0x488a6a['query']);_0x10e1bc['filters']=_[_0x109f('0x32')](_0x10e1bc[_0x109f('0x2e')],_0x10e1bc[_0x109f('0x31')]);_0x1a7410[_0x109f('0x33')]=_[_0x109f('0x32')](_0x10e1bc['model'],qs[_0x109f('0x34')](_0x488a6a['query']['fields']));_0x1a7410['attributes']=_0x1a7410['attributes']['length']?_0x1a7410[_0x109f('0x33')]:_0x10e1bc['model'];if(!_0x488a6a[_0x109f('0x31')][_0x109f('0x35')](_0x109f('0x36'))){_0x1a7410[_0x109f('0x1b')]=qs['limit'](_0x488a6a[_0x109f('0x31')][_0x109f('0x1b')]);_0x1a7410[_0x109f('0x19')]=qs[_0x109f('0x19')](_0x488a6a[_0x109f('0x31')][_0x109f('0x19')]);}_0x1a7410[_0x109f('0x37')]=qs[_0x109f('0x38')](_0x488a6a[_0x109f('0x31')][_0x109f('0x38')]);_0x1a7410[_0x109f('0x39')]=qs[_0x109f('0x3a')](_['pick'](_0x488a6a['query'],_0x10e1bc[_0x109f('0x3a')]),_0x131242);if(_0x488a6a['query'][_0x109f('0x3b')]){_0x1a7410[_0x109f('0x39')]=_[_0x109f('0x3c')](_0x1a7410[_0x109f('0x39')],{'$or':_[_0x109f('0x2f')](_0x131242,function(_0x5935c0){if(_0x5935c0[_0x109f('0x2c')]!=='VIRTUAL'){var _0x287cee={};_0x287cee[_0x5935c0[_0x109f('0x30')]]={'$like':'%'+_0x488a6a[_0x109f('0x31')]['filter']+'%'};return _0x287cee;}})});}_0x1a7410=_['merge']({},_0x1a7410,_0x488a6a[_0x109f('0x3d')]);var _0x34e9ec={'where':_0x1a7410['where']};return db[_0x109f('0x29')]['count'](_0x34e9ec)[_0x109f('0x23')](function(_0x37c49f){_0x228df9['count']=_0x37c49f;if(_0x488a6a[_0x109f('0x31')][_0x109f('0x3e')]){_0x1a7410[_0x109f('0x3f')]=[{'all':!![]}];}return db[_0x109f('0x29')][_0x109f('0x40')](_0x1a7410);})[_0x109f('0x23')](function(_0x395b0e){_0x228df9[_0x109f('0x41')]=_0x395b0e;return _0x228df9;})[_0x109f('0x23')](respondWithFilteredResult(_0x4e9342,_0x1a7410))[_0x109f('0x42')](handleError(_0x4e9342,null));};exports[_0x109f('0x43')]=function(_0x3613b7,_0x56f2d4){var _0x1fa782={'raw':!![],'where':{'id':_0x3613b7[_0x109f('0x44')]['id']}},_0xff1087={};_0xff1087[_0x109f('0x2e')]=_[_0x109f('0x45')](db['FaxTransferReport'][_0x109f('0x2a')]);_0xff1087[_0x109f('0x31')]=_[_0x109f('0x45')](_0x3613b7['query']);_0xff1087[_0x109f('0x3a')]=_[_0x109f('0x32')](_0xff1087['model'],_0xff1087[_0x109f('0x31')]);_0x1fa782[_0x109f('0x33')]=_['intersection'](_0xff1087[_0x109f('0x2e')],qs[_0x109f('0x34')](_0x3613b7[_0x109f('0x31')][_0x109f('0x34')]));_0x1fa782[_0x109f('0x33')]=_0x1fa782[_0x109f('0x33')][_0x109f('0x46')]?_0x1fa782[_0x109f('0x33')]:_0xff1087[_0x109f('0x2e')];if(_0x3613b7[_0x109f('0x31')][_0x109f('0x3e')]){_0x1fa782[_0x109f('0x3f')]=[{'all':!![]}];}_0x1fa782=_['merge']({},_0x1fa782,_0x3613b7['options']);return db[_0x109f('0x29')][_0x109f('0x47')](_0x1fa782)['then'](handleEntityNotFound(_0x56f2d4,null))[_0x109f('0x23')](respondWithResult(_0x56f2d4,null))[_0x109f('0x42')](handleError(_0x56f2d4,null));};exports['create']=function(_0x349176,_0x4c815d){return db[_0x109f('0x29')][_0x109f('0x48')](_0x349176['body'],{})[_0x109f('0x23')](respondWithResult(_0x4c815d,0xc9))['catch'](handleError(_0x4c815d,null));};exports[_0x109f('0x22')]=function(_0x3654f2,_0x9284e1){if(_0x3654f2[_0x109f('0x49')]['id']){delete _0x3654f2[_0x109f('0x49')]['id'];}return db['FaxTransferReport'][_0x109f('0x47')]({'where':{'id':_0x3654f2['params']['id']}})[_0x109f('0x23')](handleEntityNotFound(_0x9284e1,null))[_0x109f('0x23')](saveUpdates(_0x3654f2[_0x109f('0x49')],null))[_0x109f('0x23')](respondWithResult(_0x9284e1,null))['catch'](handleError(_0x9284e1,null));};exports[_0x109f('0x24')]=function(_0x250df0,_0x40e22e){return db['FaxTransferReport'][_0x109f('0x47')]({'where':{'id':_0x250df0[_0x109f('0x44')]['id']}})[_0x109f('0x23')](handleEntityNotFound(_0x40e22e,null))['then'](removeEntity(_0x40e22e,null))[_0x109f('0x42')](handleError(_0x40e22e,null));};exports['describe']=function(_0x25934b,_0x375ba5){return db['FaxTransferReport'][_0x109f('0x4a')]()[_0x109f('0x23')](respondWithResult(_0x375ba5,null))['catch'](handleError(_0x375ba5,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 184e26b..3ccec55 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 _0xebfc=['report_fax_transfer','uniqueid','lodash','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x29313a,_0x295ab8){var _0x2f0678=function(_0x52fe14){while(--_0x52fe14){_0x29313a['push'](_0x29313a['shift']());}};_0x2f0678(++_0x295ab8);}(_0xebfc,0x12b));var _0xcebf=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xebfc[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xcebf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcebf('0x1'));var BPromise=require(_0xcebf('0x2'));var rp=require(_0xcebf('0x3'));var fs=require('fs');var path=require(_0xcebf('0x4'));var rimraf=require('rimraf');var config=require(_0xcebf('0x5'));var attributes=require(_0xcebf('0x6'));module['exports']=function(_0x182e4a,_0x47a925){return _0x182e4a[_0xcebf('0x7')](_0xcebf('0x8'),attributes,{'tableName':_0xcebf('0x9'),'paranoid':![],'indexes':[{'name':_0xcebf('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x251e=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','request-promise','path','../../config/environment','./faxTransferReport.attributes'];(function(_0x2f122b,_0x1daa2c){var _0x54c1a8=function(_0x379456){while(--_0x379456){_0x2f122b['push'](_0x2f122b['shift']());}};_0x54c1a8(++_0x1daa2c);}(_0x251e,0x102));var _0xe251=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x251e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe251('0x0'));var logger=require(_0xe251('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe251('0x2'));var fs=require('fs');var path=require(_0xe251('0x3'));var rimraf=require('rimraf');var config=require(_0xe251('0x4'));var attributes=require(_0xe251('0x5'));module[_0xe251('0x6')]=function(_0xd86854,_0x34cb58){return _0xd86854[_0xe251('0x7')](_0xe251('0x8'),attributes,{'tableName':_0xe251('0x9'),'paranoid':![],'indexes':[{'name':_0xe251('0xa'),'fields':[_0xe251('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5a00fad..2417a28 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 _0x8b23=['jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x41caf4,_0x33eacb){var _0x2034ca=function(_0x4c75e0){while(--_0x4c75e0){_0x41caf4['push'](_0x41caf4['shift']());}};_0x2034ca(++_0x33eacb);}(_0x8b23,0xb6));var _0x38b2=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x8b23[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x38b2('0x0'));var util=require(_0x38b2('0x1'));var moment=require(_0x38b2('0x2'));var BPromise=require(_0x38b2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38b2('0x4'));var db=require(_0x38b2('0x5'))['db'];var utils=require(_0x38b2('0x6'));var logger=require(_0x38b2('0x7'))(_0x38b2('0x8'));var config=require(_0x38b2('0x9'));var jayson=require(_0x38b2('0xa'));var client=jayson[_0x38b2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c1155,_0x31d72f,_0x1c1f5a){return new BPromise(function(_0x1d76dc,_0x1b4106){return client[_0x38b2('0xc')](_0x2c1155,_0x1c1f5a)[_0x38b2('0xd')](function(_0x54e6ab){logger['info'](_0x38b2('0xe'),_0x31d72f,_0x38b2('0xf'));logger[_0x38b2('0x10')](_0x38b2('0x11'),_0x31d72f,'request\x20sent',JSON[_0x38b2('0x12')](_0x54e6ab));if(_0x54e6ab[_0x38b2('0x13')]){if(_0x54e6ab[_0x38b2('0x13')]['code']===0x1f4){logger[_0x38b2('0x13')](_0x38b2('0xe'),_0x31d72f,_0x54e6ab[_0x38b2('0x13')][_0x38b2('0x14')]);return _0x1b4106(_0x54e6ab['error'][_0x38b2('0x14')]);}logger[_0x38b2('0x13')](_0x38b2('0xe'),_0x31d72f,_0x54e6ab[_0x38b2('0x13')][_0x38b2('0x14')]);return _0x1d76dc(_0x54e6ab['error'][_0x38b2('0x14')]);}else{logger[_0x38b2('0x15')](_0x38b2('0xe'),_0x31d72f,'request\x20sent');_0x1d76dc(_0x54e6ab[_0x38b2('0x16')][_0x38b2('0x14')]);}})[_0x38b2('0x17')](function(_0x1ec268){logger['error'](_0x38b2('0xe'),_0x31d72f,_0x1ec268);_0x1b4106(_0x1ec268);});});} \ No newline at end of file +var _0x02d5=['../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x548789,_0x9aff00){var _0x473ed1=function(_0x52be1a){while(--_0x52be1a){_0x548789['push'](_0x548789['shift']());}};_0x473ed1(++_0x9aff00);}(_0x02d5,0x94));var _0x502d=function(_0x2c78df,_0x20abba){_0x2c78df=_0x2c78df-0x0;var _0x50912=_0x02d5[_0x2c78df];return _0x50912;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x502d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x502d('0x1'));var db=require(_0x502d('0x2'))['db'];var utils=require(_0x502d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x502d('0x4'));var jayson=require(_0x502d('0x5'));var client=jayson[_0x502d('0x6')][_0x502d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f63c2,_0x446aed,_0x4b480f){return new BPromise(function(_0x578f2e,_0x316cf5){return client[_0x502d('0x8')](_0x5f63c2,_0x4b480f)[_0x502d('0x9')](function(_0x25ec81){logger[_0x502d('0xa')](_0x502d('0xb'),_0x446aed,_0x502d('0xc'));logger[_0x502d('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x446aed,_0x502d('0xc'),JSON[_0x502d('0xe')](_0x25ec81));if(_0x25ec81[_0x502d('0xf')]){if(_0x25ec81[_0x502d('0xf')][_0x502d('0x10')]===0x1f4){logger[_0x502d('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x446aed,_0x25ec81[_0x502d('0xf')][_0x502d('0x11')]);return _0x316cf5(_0x25ec81[_0x502d('0xf')][_0x502d('0x11')]);}logger['error'](_0x502d('0xb'),_0x446aed,_0x25ec81[_0x502d('0xf')][_0x502d('0x11')]);return _0x578f2e(_0x25ec81[_0x502d('0xf')]['message']);}else{logger[_0x502d('0xa')](_0x502d('0xb'),_0x446aed,_0x502d('0xc'));_0x578f2e(_0x25ec81[_0x502d('0x12')][_0x502d('0x11')]);}})['catch'](function(_0x39bdba){logger[_0x502d('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x446aed,_0x39bdba);_0x316cf5(_0x39bdba);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index f514ce4..d185953 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 _0xa4d5=['describe','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x5d95ca,_0x1e29b1){var _0x1df452=function(_0x2aa1d8){while(--_0x2aa1d8){_0x5d95ca['push'](_0x5d95ca['shift']());}};_0x1df452(++_0x1e29b1);}(_0xa4d5,0x79));var _0x5a4d=function(_0xabe65e,_0x455177){_0xabe65e=_0xabe65e-0x0;var _0x3da843=_0xa4d5[_0xabe65e];return _0x3da843;};'use strict';var multer=require(_0x5a4d('0x0'));var util=require(_0x5a4d('0x1'));var path=require(_0x5a4d('0x2'));var timeout=require(_0x5a4d('0x3'));var express=require(_0x5a4d('0x4'));var router=express['Router']();var fs_extra=require(_0x5a4d('0x5'));var auth=require(_0x5a4d('0x6'));var interaction=require(_0x5a4d('0x7'));var config=require('../../config/environment');var controller=require(_0x5a4d('0x8'));router[_0x5a4d('0x9')]('/',auth[_0x5a4d('0xa')](),controller[_0x5a4d('0xb')]);router[_0x5a4d('0x9')]('/describe',auth[_0x5a4d('0xa')](),controller[_0x5a4d('0xc')]);router['get'](_0x5a4d('0xd'),auth[_0x5a4d('0xa')](),controller[_0x5a4d('0xe')]);router[_0x5a4d('0xf')]('/',auth[_0x5a4d('0xa')](),controller[_0x5a4d('0x10')]);router['put'](_0x5a4d('0xd'),auth[_0x5a4d('0xa')](),controller[_0x5a4d('0x11')]);router[_0x5a4d('0x12')](_0x5a4d('0xd'),auth[_0x5a4d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2721=['show','post','create','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x29ee54,_0x4aa62f){var _0x522678=function(_0x215826){while(--_0x215826){_0x29ee54['push'](_0x29ee54['shift']());}};_0x522678(++_0x4aa62f);}(_0x2721,0x171));var _0x1272=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x2721[_0x39e283];return _0x7de89f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1272('0x0'));var express=require(_0x1272('0x1'));var router=express[_0x1272('0x2')]();var fs_extra=require(_0x1272('0x3'));var auth=require(_0x1272('0x4'));var interaction=require(_0x1272('0x5'));var config=require(_0x1272('0x6'));var controller=require(_0x1272('0x7'));router[_0x1272('0x8')]('/',auth[_0x1272('0x9')](),controller['index']);router[_0x1272('0x8')](_0x1272('0xa'),auth[_0x1272('0x9')](),controller['describe']);router[_0x1272('0x8')]('/:id',auth[_0x1272('0x9')](),controller[_0x1272('0xb')]);router[_0x1272('0xc')]('/',auth[_0x1272('0x9')](),controller[_0x1272('0xd')]);router[_0x1272('0xe')](_0x1272('0xf'),auth[_0x1272('0x9')](),controller[_0x1272('0x10')]);router[_0x1272('0x11')](_0x1272('0xf'),auth[_0x1272('0x9')](),controller[_0x1272('0x12')]);module[_0x1272('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index cbeedbd..aefa29e 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 _0x79af=['delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x79af,0x162));var _0xf79a=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x79af[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require(_0xf79a('0x0'));var util=require('util');var path=require(_0xf79a('0x1'));var timeout=require('connect-timeout');var express=require(_0xf79a('0x2'));var router=express[_0xf79a('0x3')]();var fs_extra=require(_0xf79a('0x4'));var auth=require(_0xf79a('0x5'));var interaction=require(_0xf79a('0x6'));var config=require(_0xf79a('0x7'));var controller=require('./intDeskAccount.controller');router[_0xf79a('0x8')]('/',auth[_0xf79a('0x9')](),controller['index']);router[_0xf79a('0x8')](_0xf79a('0xa'),auth[_0xf79a('0x9')](),controller[_0xf79a('0xb')]);router['get'](_0xf79a('0xc'),auth['isAuthenticated'](),controller[_0xf79a('0xd')]);router[_0xf79a('0x8')]('/:id/fields',auth[_0xf79a('0x9')](),controller[_0xf79a('0xe')]);router[_0xf79a('0xf')]('/',auth[_0xf79a('0x9')](),controller[_0xf79a('0x10')]);router[_0xf79a('0xf')](_0xf79a('0xc'),auth[_0xf79a('0x9')](),controller[_0xf79a('0x11')]);router[_0xf79a('0x12')]('/:id',auth[_0xf79a('0x9')](),controller[_0xf79a('0x13')]);router[_0xf79a('0x14')](_0xf79a('0xa'),auth[_0xf79a('0x9')](),controller['destroy']);module[_0xf79a('0x15')]=router; \ No newline at end of file +var _0x893e=['/:id/configurations','get','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','/:id','show'];(function(_0x226f63,_0x5c348d){var _0x411da7=function(_0x61919c){while(--_0x61919c){_0x226f63['push'](_0x226f63['shift']());}};_0x411da7(++_0x5c348d);}(_0x893e,0x8f));var _0xe893=function(_0x399fcb,_0x302cad){_0x399fcb=_0x399fcb-0x0;var _0x4d5f0f=_0x893e[_0x399fcb];return _0x4d5f0f;};'use strict';var multer=require(_0xe893('0x0'));var util=require(_0xe893('0x1'));var path=require(_0xe893('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe893('0x3'));var interaction=require(_0xe893('0x4'));var config=require(_0xe893('0x5'));var controller=require(_0xe893('0x6'));router['get']('/',auth[_0xe893('0x7')](),controller[_0xe893('0x8')]);router['get'](_0xe893('0x9'),auth['isAuthenticated'](),controller[_0xe893('0xa')]);router['get'](_0xe893('0xb'),auth[_0xe893('0x7')](),controller['getConfigurations']);router[_0xe893('0xc')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe893('0xd')]);router[_0xe893('0xe')]('/',auth[_0xe893('0x7')](),controller[_0xe893('0xf')]);router[_0xe893('0xe')](_0xe893('0xb'),auth[_0xe893('0x7')](),controller[_0xe893('0x10')]);router[_0xe893('0x11')](_0xe893('0x9'),auth['isAuthenticated'](),controller[_0xe893('0x12')]);router[_0xe893('0x13')](_0xe893('0x9'),auth[_0xe893('0x7')](),controller[_0xe893('0x14')]);module[_0xe893('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index c43d16b..4690236 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 _0xf967=['integrationTab','sequelize','exports','STRING','basic','ENUM'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xf967,0xc7));var _0x7f96=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf967[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7f96('0x0'));module[_0x7f96('0x1')]={'name':{'type':Sequelize[_0x7f96('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7f96('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x7f96('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x7f96('0x2')]},'consumerKey':{'type':Sequelize[_0x7f96('0x2')]},'consumerSecret':{'type':Sequelize[_0x7f96('0x2')]},'token':{'type':Sequelize[_0x7f96('0x2')]},'tokenSecret':{'type':Sequelize[_0x7f96('0x2')]},'serverUrl':{'type':Sequelize[_0x7f96('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7f96('0x4')]('integrationTab','newTab'),'defaultValue':_0x7f96('0x5')}}; \ No newline at end of file +var _0xf43e=['newTab','STRING','ENUM','basic','integrationTab'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf43e,0x11e));var _0xef43=function(_0x2b3c4b,_0x39f890){_0x2b3c4b=_0x2b3c4b-0x0;var _0x406119=_0xf43e[_0x2b3c4b];return _0x406119;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef43('0x0')]},'username':{'type':Sequelize[_0xef43('0x0')]},'remoteUri':{'type':Sequelize[_0xef43('0x0')]},'authType':{'type':Sequelize[_0xef43('0x1')]('basic'),'defaultValue':_0xef43('0x2')},'password':{'type':Sequelize[_0xef43('0x0')]},'consumerKey':{'type':Sequelize[_0xef43('0x0')]},'consumerSecret':{'type':Sequelize[_0xef43('0x0')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xef43('0x3'),_0xef43('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 720ca38..96cdd97 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 _0xb766=['path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','map','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','rows','show','params','keys','length','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','getDescriptions','channel','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0xb766,0x150));var _0x6b76=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xb766[_0x2f2360];return _0x1cc8d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b76('0x0'));var zipdir=require(_0x6b76('0x1'));var jsonpatch=require(_0x6b76('0x2'));var rp=require(_0x6b76('0x3'));var moment=require(_0x6b76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6b76('0x5'));var util=require('util');var path=require(_0x6b76('0x6'));var sox=require(_0x6b76('0x7'));var csv=require(_0x6b76('0x8'));var ejs=require(_0x6b76('0x9'));var fs=require('fs');var fs_extra=require(_0x6b76('0xa'));var _=require('lodash');var squel=require(_0x6b76('0xb'));var crypto=require(_0x6b76('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b76('0xd'));var Papa=require(_0x6b76('0xe'));var Redis=require('ioredis');var authService=require(_0x6b76('0xf'));var qs=require(_0x6b76('0x10'));var as=require(_0x6b76('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6b76('0x12'));var utils=require(_0x6b76('0x13'));var config=require(_0x6b76('0x14'));var licenseUtil=require(_0x6b76('0x15'));var db=require(_0x6b76('0x16'))['db'];var integrations=require(_0x6b76('0x17'));function respondWithStatusCode(_0x4e65de,_0xd04330){_0xd04330=_0xd04330||0xcc;return function(_0x2a0e7c){if(_0x2a0e7c){return _0x4e65de[_0x6b76('0x18')](_0xd04330);}return _0x4e65de[_0x6b76('0x19')](_0xd04330)[_0x6b76('0x1a')]();};}function respondWithResult(_0x39f8bb,_0x5df590){_0x5df590=_0x5df590||0xc8;return function(_0x2207c9){if(_0x2207c9){return _0x39f8bb[_0x6b76('0x19')](_0x5df590)['json'](_0x2207c9);}};}function respondWithFilteredResult(_0x36f193,_0x50d935){return function(_0xf16d46){if(_0xf16d46){var _0x3e6c93=typeof _0x50d935[_0x6b76('0x1b')]===_0x6b76('0x1c')&&typeof _0x50d935[_0x6b76('0x1d')]===_0x6b76('0x1c');var _0x4435f3=_0xf16d46[_0x6b76('0x1e')];var _0x57b9f5=_0x3e6c93?0x0:_0x50d935[_0x6b76('0x1b')];var _0x40f3ee=_0x3e6c93?_0xf16d46['count']:_0x50d935[_0x6b76('0x1b')]+_0x50d935[_0x6b76('0x1d')];var _0x19eaf8;if(_0x40f3ee>=_0x4435f3){_0x40f3ee=_0x4435f3;_0x19eaf8=0xc8;}else{_0x19eaf8=0xce;}_0x36f193[_0x6b76('0x19')](_0x19eaf8);return _0x36f193[_0x6b76('0x1f')]('Content-Range',_0x57b9f5+'-'+_0x40f3ee+'/'+_0x4435f3)[_0x6b76('0x20')](_0xf16d46);}return null;};}function patchUpdates(_0x36a4cb){return function(_0x7e2689){try{jsonpatch[_0x6b76('0x21')](_0x7e2689,_0x36a4cb,!![]);}catch(_0x5ec35e){return BPromise[_0x6b76('0x22')](_0x5ec35e);}return _0x7e2689['save']();};}function saveUpdates(_0x220f89,_0x31e79d){return function(_0x8e8a80){if(_0x8e8a80){return _0x8e8a80[_0x6b76('0x23')](_0x220f89)[_0x6b76('0x24')](function(_0x3709c3){return _0x3709c3;});}return null;};}function removeEntity(_0x148e03,_0x4a9670){return function(_0x4a1a56){if(_0x4a1a56){return _0x4a1a56[_0x6b76('0x25')]()[_0x6b76('0x24')](function(){_0x148e03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44315a,_0xa869f5){return function(_0x4eed34){if(!_0x4eed34){_0x44315a[_0x6b76('0x18')](0x194);}return _0x4eed34;};}function handleError(_0x234d49,_0x4d91f0){_0x4d91f0=_0x4d91f0||0x1f4;return function(_0x759261){logger[_0x6b76('0x26')](_0x759261[_0x6b76('0x27')]);if(_0x759261[_0x6b76('0x28')]){delete _0x759261[_0x6b76('0x28')];}_0x234d49[_0x6b76('0x19')](_0x4d91f0)[_0x6b76('0x29')](_0x759261);};}exports[_0x6b76('0x2a')]=function(_0x2d31a7,_0x1fd491){var _0x4f11e0={},_0x12f758={},_0x54eb65={'count':0x0,'rows':[]};var _0x47d750=_['map'](db[_0x6b76('0x2b')][_0x6b76('0x2c')],function(_0x1f9c02){return{'name':_0x1f9c02[_0x6b76('0x2d')],'type':_0x1f9c02[_0x6b76('0x2e')][_0x6b76('0x2f')]};});_0x12f758['model']=_[_0x6b76('0x30')](_0x47d750,_0x6b76('0x28'));_0x12f758['query']=_['keys'](_0x2d31a7['query']);_0x12f758[_0x6b76('0x31')]=_[_0x6b76('0x32')](_0x12f758[_0x6b76('0x33')],_0x12f758[_0x6b76('0x34')]);_0x4f11e0[_0x6b76('0x35')]=_[_0x6b76('0x32')](_0x12f758[_0x6b76('0x33')],qs[_0x6b76('0x36')](_0x2d31a7['query'][_0x6b76('0x36')]));_0x4f11e0[_0x6b76('0x35')]=_0x4f11e0[_0x6b76('0x35')]['length']?_0x4f11e0[_0x6b76('0x35')]:_0x12f758[_0x6b76('0x33')];if(!_0x2d31a7[_0x6b76('0x34')][_0x6b76('0x37')](_0x6b76('0x38'))){_0x4f11e0['limit']=qs[_0x6b76('0x1d')](_0x2d31a7[_0x6b76('0x34')][_0x6b76('0x1d')]);_0x4f11e0[_0x6b76('0x1b')]=qs[_0x6b76('0x1b')](_0x2d31a7[_0x6b76('0x34')][_0x6b76('0x1b')]);}_0x4f11e0[_0x6b76('0x39')]=qs[_0x6b76('0x3a')](_0x2d31a7[_0x6b76('0x34')][_0x6b76('0x3a')]);_0x4f11e0['where']=qs[_0x6b76('0x31')](_[_0x6b76('0x3b')](_0x2d31a7[_0x6b76('0x34')],_0x12f758[_0x6b76('0x31')]),_0x47d750);if(_0x2d31a7[_0x6b76('0x34')][_0x6b76('0x3c')]){_0x4f11e0['where']=_[_0x6b76('0x3d')](_0x4f11e0[_0x6b76('0x3e')],{'$or':_['map'](_0x47d750,function(_0x27b904){if(_0x27b904[_0x6b76('0x2e')]!=='VIRTUAL'){var _0x2fff91={};_0x2fff91[_0x27b904[_0x6b76('0x28')]]={'$like':'%'+_0x2d31a7[_0x6b76('0x34')][_0x6b76('0x3c')]+'%'};return _0x2fff91;}})});}_0x4f11e0=_[_0x6b76('0x3d')]({},_0x4f11e0,_0x2d31a7[_0x6b76('0x3f')]);var _0x367dd8={'where':_0x4f11e0[_0x6b76('0x3e')]};return db['DeskAccount'][_0x6b76('0x1e')](_0x367dd8)[_0x6b76('0x24')](function(_0x4ef18a){_0x54eb65[_0x6b76('0x1e')]=_0x4ef18a;if(_0x2d31a7['query'][_0x6b76('0x40')]){_0x4f11e0[_0x6b76('0x41')]=[{'all':!![]}];}return db[_0x6b76('0x2b')]['findAll'](_0x4f11e0);})['then'](function(_0x1b4617){_0x54eb65[_0x6b76('0x42')]=_0x1b4617;return _0x54eb65;})[_0x6b76('0x24')](respondWithFilteredResult(_0x1fd491,_0x4f11e0))['catch'](handleError(_0x1fd491,null));};exports[_0x6b76('0x43')]=function(_0x38e906,_0x1ce243){var _0x265b3a={'raw':![],'where':{'id':_0x38e906[_0x6b76('0x44')]['id']}},_0x2d97fe={};_0x2d97fe[_0x6b76('0x33')]=_[_0x6b76('0x45')](db[_0x6b76('0x2b')]['rawAttributes']);_0x2d97fe[_0x6b76('0x34')]=_[_0x6b76('0x45')](_0x38e906[_0x6b76('0x34')]);_0x2d97fe['filters']=_[_0x6b76('0x32')](_0x2d97fe['model'],_0x2d97fe['query']);_0x265b3a['attributes']=_[_0x6b76('0x32')](_0x2d97fe[_0x6b76('0x33')],qs[_0x6b76('0x36')](_0x38e906['query'][_0x6b76('0x36')]));_0x265b3a['attributes']=_0x265b3a[_0x6b76('0x35')][_0x6b76('0x46')]?_0x265b3a['attributes']:_0x2d97fe[_0x6b76('0x33')];if(_0x38e906[_0x6b76('0x34')]['includeAll']){_0x265b3a[_0x6b76('0x41')]=[{'all':!![]}];}_0x265b3a=_[_0x6b76('0x3d')]({},_0x265b3a,_0x38e906[_0x6b76('0x3f')]);return db[_0x6b76('0x2b')][_0x6b76('0x47')](_0x265b3a)[_0x6b76('0x24')](handleEntityNotFound(_0x1ce243,null))[_0x6b76('0x24')](respondWithResult(_0x1ce243,null))[_0x6b76('0x48')](handleError(_0x1ce243,null));};exports[_0x6b76('0x49')]=function(_0x96c0aa,_0x14787e){return db[_0x6b76('0x2b')][_0x6b76('0x49')](_0x96c0aa[_0x6b76('0x4a')],{})['then'](respondWithResult(_0x14787e,0xc9))[_0x6b76('0x48')](handleError(_0x14787e,null));};exports['update']=function(_0x312a0c,_0x286555){if(_0x312a0c[_0x6b76('0x4a')]['id']){delete _0x312a0c[_0x6b76('0x4a')]['id'];}return db['DeskAccount'][_0x6b76('0x47')]({'where':{'id':_0x312a0c['params']['id']}})[_0x6b76('0x24')](handleEntityNotFound(_0x286555,null))[_0x6b76('0x24')](saveUpdates(_0x312a0c[_0x6b76('0x4a')],null))[_0x6b76('0x24')](respondWithResult(_0x286555,null))[_0x6b76('0x48')](handleError(_0x286555,null));};exports[_0x6b76('0x25')]=function(_0x317621,_0x57afb5){return db[_0x6b76('0x2b')]['find']({'where':{'id':_0x317621[_0x6b76('0x44')]['id']}})['then'](handleEntityNotFound(_0x57afb5,null))['then'](removeEntity(_0x57afb5,null))[_0x6b76('0x48')](handleError(_0x57afb5,null));};exports[_0x6b76('0x4b')]=function(_0x18245b,_0x5b20e9,_0x4a22a6){var _0x287009={};var _0x2608df={};var _0x3e5b61;var _0x906fac;return db['DeskAccount'][_0x6b76('0x4c')]({'where':{'id':_0x18245b['params']['id']}})[_0x6b76('0x24')](handleEntityNotFound(_0x5b20e9,null))[_0x6b76('0x24')](function(_0x56a908){if(_0x56a908){_0x3e5b61=_0x56a908;_0x2608df[_0x6b76('0x33')]=_['keys'](db[_0x6b76('0x4d')][_0x6b76('0x2c')]);_0x2608df[_0x6b76('0x34')]=_[_0x6b76('0x45')](_0x18245b[_0x6b76('0x34')]);_0x2608df[_0x6b76('0x31')]=_['intersection'](_0x2608df[_0x6b76('0x33')],_0x2608df[_0x6b76('0x34')]);_0x287009[_0x6b76('0x35')]=_[_0x6b76('0x32')](_0x2608df[_0x6b76('0x33')],qs['fields'](_0x18245b[_0x6b76('0x34')][_0x6b76('0x36')]));_0x287009[_0x6b76('0x35')]=_0x287009[_0x6b76('0x35')]['length']?_0x287009[_0x6b76('0x35')]:_0x2608df[_0x6b76('0x33')];_0x287009[_0x6b76('0x39')]=qs[_0x6b76('0x3a')](_0x18245b['query'][_0x6b76('0x3a')]);_0x287009[_0x6b76('0x3e')]=qs[_0x6b76('0x31')](_[_0x6b76('0x3b')](_0x18245b[_0x6b76('0x34')],_0x2608df[_0x6b76('0x31')]));if(_0x18245b[_0x6b76('0x34')][_0x6b76('0x3c')]){_0x287009[_0x6b76('0x3e')]=_[_0x6b76('0x3d')](_0x287009[_0x6b76('0x3e')],{'$or':_[_0x6b76('0x30')](_0x287009[_0x6b76('0x35')],function(_0x250550){var _0x5bb22b={};_0x5bb22b[_0x250550]={'$like':'%'+_0x18245b[_0x6b76('0x34')][_0x6b76('0x3c')]+'%'};return _0x5bb22b;})});}_0x287009=_[_0x6b76('0x3d')]({},_0x287009,_0x18245b['options']);return _0x3e5b61[_0x6b76('0x4b')](_0x287009);}})['then'](function(_0x3bf69d){if(_0x3bf69d){_0x906fac=_0x3bf69d[_0x6b76('0x46')];if(!_0x18245b[_0x6b76('0x34')][_0x6b76('0x37')](_0x6b76('0x38'))){_0x287009[_0x6b76('0x1d')]=qs['limit'](_0x18245b['query'][_0x6b76('0x1d')]);_0x287009['offset']=qs[_0x6b76('0x1b')](_0x18245b['query'][_0x6b76('0x1b')]);}return _0x3e5b61['getConfigurations'](_0x287009);}})['then'](function(_0x3493c8){if(_0x3493c8){return _0x3493c8?{'count':_0x906fac,'rows':_0x3493c8}:null;}})[_0x6b76('0x24')](respondWithResult(_0x5b20e9,null))[_0x6b76('0x48')](handleError(_0x5b20e9,null));};exports[_0x6b76('0x4e')]=function(_0x40be2d,_0x28ffcc,_0x1b76f4){if(_0x40be2d[_0x6b76('0x4a')]['id']){delete _0x40be2d[_0x6b76('0x4a')]['id'];}return db[_0x6b76('0x2b')][_0x6b76('0x4c')]({'where':{'id':_0x40be2d[_0x6b76('0x44')]['id']}})['then'](handleEntityNotFound(_0x28ffcc,null))[_0x6b76('0x24')](function(_0x43f320){if(_0x43f320){_0x40be2d[_0x6b76('0x4a')]['AccountId']=_0x43f320['id'];_0x40be2d[_0x6b76('0x4a')][_0x6b76('0x4f')]=integrations[_0x6b76('0x50')](_0x40be2d['body']['channel'],_0x40be2d[_0x6b76('0x4a')][_0x6b76('0x2e')]);_0x40be2d['body']['Descriptions']=integrations[_0x6b76('0x51')](_0x40be2d['body'][_0x6b76('0x52')],_0x40be2d[_0x6b76('0x4a')][_0x6b76('0x2e')]);return db[_0x6b76('0x4d')][_0x6b76('0x49')](_0x40be2d[_0x6b76('0x4a')],{'include':[{'model':db[_0x6b76('0x53')],'as':_0x6b76('0x4f')},{'model':db[_0x6b76('0x53')],'as':'Descriptions'}]});}return null;})[_0x6b76('0x24')](respondWithResult(_0x28ffcc,null))[_0x6b76('0x48')](handleError(_0x28ffcc,null));};exports[_0x6b76('0x54')]=function(_0x1fb20f,_0x361a28,_0x29e72a){var _0x2c8396=[{'name':_0x6b76('0x55'),'label':_0x6b76('0x55'),'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 _0x40cca8='';return db[_0x6b76('0x2b')][_0x6b76('0x4c')]({'where':{'id':_0x1fb20f['params']['id']},'attributes':['id','remoteUri',_0x6b76('0x56'),_0x6b76('0x57'),_0x6b76('0x58'),_0x6b76('0x59'),_0x6b76('0x5a'),_0x6b76('0x5b'),_0x6b76('0x5c')]})[_0x6b76('0x24')](handleEntityNotFound(_0x361a28,null))[_0x6b76('0x24')](function(_0x5b20f1){if(_0x5b20f1){_0x40cca8=_0x5b20f1[_0x6b76('0x5d')];var _0x5d42c8=_0x40cca8[_0x6b76('0x5e')](-0x1);if(_0x5d42c8==='/'){_0x40cca8=_0x40cca8['substring'](0x0,_0x40cca8[_0x6b76('0x5f')](_0x5d42c8));}var _0x564efd={'method':_0x6b76('0x60'),'uri':util[_0x6b76('0x61')](_0x6b76('0x62'),_0x40cca8),'headers':{'Content-Type':'application/json','Accept':_0x6b76('0x63')},'json':!![]};if(_0x5b20f1[_0x6b76('0x56')]===_0x6b76('0x64')){_0x564efd['headers'][_0x6b76('0x65')]=util[_0x6b76('0x61')](_0x6b76('0x66'),new Buffer(util[_0x6b76('0x61')]('%s:%s',_0x5b20f1[_0x6b76('0x57')],_0x5b20f1['password']))['toString'](_0x6b76('0x67')));}return rp(_0x564efd)[_0x6b76('0x24')](function(_0x171838){return _0x2c8396[_0x6b76('0x68')](_[_0x6b76('0x30')](_0x171838[_0x6b76('0x69')][_0x6b76('0x6a')],function(_0x48f71a){return{'id':_0x48f71a[_0x6b76('0x28')],'name':_0x48f71a[_0x6b76('0x28')],'type':_0x48f71a[_0x6b76('0x2e')],'active':_0x48f71a[_0x6b76('0x6b')],'label':_0x48f71a[_0x6b76('0x6c')],'custom':!![]};}));});}})[_0x6b76('0x24')](function(_0x163a40){return{'count':_0x163a40['length'],'rows':_0x163a40};})[_0x6b76('0x24')](respondWithResult(_0x361a28,null))[_0x6b76('0x48')](function(_0x5afbb0){var _0x66252=_0x1fb20f[_0x6b76('0x34')][_0x6b76('0x6d')]?0x1f4:_0x5afbb0[_0x6b76('0x6e')]||0x1f4;logger[_0x6b76('0x26')](_0x6b76('0x6f'),_0x6b76('0x54'),_0x66252,JSON[_0x6b76('0x70')](_0x5afbb0));delete _0x5afbb0['name'];if(_0x66252===0x191){_0x66252=0x190;}_0x361a28['status'](_0x66252)[_0x6b76('0x29')](_0x1fb20f[_0x6b76('0x34')][_0x6b76('0x6d')]?{'message':_0x6b76('0x71'),'statusCode':_0x5afbb0[_0x6b76('0x6e')]}:_0x5afbb0);});}; \ No newline at end of file +var _0x5fe3=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','DeskAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','order','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra'];(function(_0x3a8ff1,_0x2b6227){var _0x47ffa7=function(_0x3ba48f){while(--_0x3ba48f){_0x3a8ff1['push'](_0x3a8ff1['shift']());}};_0x47ffa7(++_0x2b6227);}(_0x5fe3,0x6b));var _0x35fe=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x5fe3[_0x297eea];return _0x1c42d2;};'use strict';var emlformat=require(_0x35fe('0x0'));var rimraf=require(_0x35fe('0x1'));var zipdir=require(_0x35fe('0x2'));var jsonpatch=require(_0x35fe('0x3'));var rp=require(_0x35fe('0x4'));var moment=require(_0x35fe('0x5'));var BPromise=require(_0x35fe('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x35fe('0x7'));var sox=require(_0x35fe('0x8'));var csv=require(_0x35fe('0x9'));var ejs=require(_0x35fe('0xa'));var fs=require('fs');var fs_extra=require(_0x35fe('0xb'));var _=require(_0x35fe('0xc'));var squel=require(_0x35fe('0xd'));var crypto=require('crypto');var jsforce=require(_0x35fe('0xe'));var deskjs=require(_0x35fe('0xf'));var toCsv=require(_0x35fe('0x9'));var querystring=require(_0x35fe('0x10'));var Papa=require(_0x35fe('0x11'));var Redis=require(_0x35fe('0x12'));var authService=require(_0x35fe('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x35fe('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fe('0x15'))('api');var utils=require(_0x35fe('0x16'));var config=require(_0x35fe('0x17'));var licenseUtil=require(_0x35fe('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x35fe('0x19'));function respondWithStatusCode(_0x288e76,_0x33bcf7){_0x33bcf7=_0x33bcf7||0xcc;return function(_0x2939f3){if(_0x2939f3){return _0x288e76[_0x35fe('0x1a')](_0x33bcf7);}return _0x288e76['status'](_0x33bcf7)[_0x35fe('0x1b')]();};}function respondWithResult(_0x5081aa,_0x3c3ef5){_0x3c3ef5=_0x3c3ef5||0xc8;return function(_0x574e4e){if(_0x574e4e){return _0x5081aa['status'](_0x3c3ef5)[_0x35fe('0x1c')](_0x574e4e);}};}function respondWithFilteredResult(_0x40a274,_0x11b684){return function(_0x3afc1c){if(_0x3afc1c){var _0x23dffb=typeof _0x11b684[_0x35fe('0x1d')]===_0x35fe('0x1e')&&typeof _0x11b684[_0x35fe('0x1f')]===_0x35fe('0x1e');var _0x3613b5=_0x3afc1c['count'];var _0xaa4a93=_0x23dffb?0x0:_0x11b684['offset'];var _0x281bf2=_0x23dffb?_0x3afc1c[_0x35fe('0x20')]:_0x11b684[_0x35fe('0x1d')]+_0x11b684[_0x35fe('0x1f')];var _0x142cee;if(_0x281bf2>=_0x3613b5){_0x281bf2=_0x3613b5;_0x142cee=0xc8;}else{_0x142cee=0xce;}_0x40a274[_0x35fe('0x21')](_0x142cee);return _0x40a274['set'](_0x35fe('0x22'),_0xaa4a93+'-'+_0x281bf2+'/'+_0x3613b5)[_0x35fe('0x1c')](_0x3afc1c);}return null;};}function patchUpdates(_0x528e7c){return function(_0x23ffde){try{jsonpatch[_0x35fe('0x23')](_0x23ffde,_0x528e7c,!![]);}catch(_0x42c2f7){return BPromise[_0x35fe('0x24')](_0x42c2f7);}return _0x23ffde[_0x35fe('0x25')]();};}function saveUpdates(_0x5e9ea4,_0x13163b){return function(_0x45090b){if(_0x45090b){return _0x45090b[_0x35fe('0x26')](_0x5e9ea4)[_0x35fe('0x27')](function(_0x7dcac7){return _0x7dcac7;});}return null;};}function removeEntity(_0x3fea25,_0xd14275){return function(_0x1c2abc){if(_0x1c2abc){return _0x1c2abc[_0x35fe('0x28')]()[_0x35fe('0x27')](function(){_0x3fea25[_0x35fe('0x21')](0xcc)[_0x35fe('0x1b')]();});}};}function handleEntityNotFound(_0x288666,_0x159dc7){return function(_0x263485){if(!_0x263485){_0x288666[_0x35fe('0x1a')](0x194);}return _0x263485;};}function handleError(_0x58a6d7,_0xb6818b){_0xb6818b=_0xb6818b||0x1f4;return function(_0x532f1a){logger[_0x35fe('0x29')](_0x532f1a[_0x35fe('0x2a')]);if(_0x532f1a[_0x35fe('0x2b')]){delete _0x532f1a[_0x35fe('0x2b')];}_0x58a6d7[_0x35fe('0x21')](_0xb6818b)['send'](_0x532f1a);};}exports[_0x35fe('0x2c')]=function(_0x1663fa,_0x378b17){var _0x3a8ad1={},_0x260719={},_0x1fecb4={'count':0x0,'rows':[]};var _0x2c67b3=_['map'](db[_0x35fe('0x2d')][_0x35fe('0x2e')],function(_0x8fc274){return{'name':_0x8fc274['fieldName'],'type':_0x8fc274[_0x35fe('0x2f')][_0x35fe('0x30')]};});_0x260719[_0x35fe('0x31')]=_['map'](_0x2c67b3,_0x35fe('0x2b'));_0x260719['query']=_[_0x35fe('0x32')](_0x1663fa[_0x35fe('0x33')]);_0x260719[_0x35fe('0x34')]=_[_0x35fe('0x35')](_0x260719['model'],_0x260719['query']);_0x3a8ad1[_0x35fe('0x36')]=_[_0x35fe('0x35')](_0x260719[_0x35fe('0x31')],qs[_0x35fe('0x37')](_0x1663fa['query']['fields']));_0x3a8ad1[_0x35fe('0x36')]=_0x3a8ad1['attributes'][_0x35fe('0x38')]?_0x3a8ad1[_0x35fe('0x36')]:_0x260719[_0x35fe('0x31')];if(!_0x1663fa['query']['hasOwnProperty'](_0x35fe('0x39'))){_0x3a8ad1[_0x35fe('0x1f')]=qs[_0x35fe('0x1f')](_0x1663fa[_0x35fe('0x33')][_0x35fe('0x1f')]);_0x3a8ad1[_0x35fe('0x1d')]=qs[_0x35fe('0x1d')](_0x1663fa[_0x35fe('0x33')]['offset']);}_0x3a8ad1['order']=qs[_0x35fe('0x3a')](_0x1663fa[_0x35fe('0x33')][_0x35fe('0x3a')]);_0x3a8ad1[_0x35fe('0x3b')]=qs[_0x35fe('0x34')](_['pick'](_0x1663fa['query'],_0x260719[_0x35fe('0x34')]),_0x2c67b3);if(_0x1663fa[_0x35fe('0x33')]['filter']){_0x3a8ad1[_0x35fe('0x3b')]=_[_0x35fe('0x3c')](_0x3a8ad1[_0x35fe('0x3b')],{'$or':_[_0x35fe('0x3d')](_0x2c67b3,function(_0x4ea821){if(_0x4ea821[_0x35fe('0x2f')]!==_0x35fe('0x3e')){var _0x18653c={};_0x18653c[_0x4ea821[_0x35fe('0x2b')]]={'$like':'%'+_0x1663fa[_0x35fe('0x33')][_0x35fe('0x3f')]+'%'};return _0x18653c;}})});}_0x3a8ad1=_[_0x35fe('0x3c')]({},_0x3a8ad1,_0x1663fa[_0x35fe('0x40')]);var _0x5763e={'where':_0x3a8ad1[_0x35fe('0x3b')]};return db[_0x35fe('0x2d')][_0x35fe('0x20')](_0x5763e)[_0x35fe('0x27')](function(_0x66a542){_0x1fecb4[_0x35fe('0x20')]=_0x66a542;if(_0x1663fa[_0x35fe('0x33')][_0x35fe('0x41')]){_0x3a8ad1['include']=[{'all':!![]}];}return db[_0x35fe('0x2d')][_0x35fe('0x42')](_0x3a8ad1);})[_0x35fe('0x27')](function(_0x183b3b){_0x1fecb4[_0x35fe('0x43')]=_0x183b3b;return _0x1fecb4;})['then'](respondWithFilteredResult(_0x378b17,_0x3a8ad1))[_0x35fe('0x44')](handleError(_0x378b17,null));};exports[_0x35fe('0x45')]=function(_0x17c84f,_0x40c9e2){var _0x7a7080={'raw':![],'where':{'id':_0x17c84f[_0x35fe('0x46')]['id']}},_0x17946c={};_0x17946c[_0x35fe('0x31')]=_[_0x35fe('0x32')](db['DeskAccount']['rawAttributes']);_0x17946c[_0x35fe('0x33')]=_[_0x35fe('0x32')](_0x17c84f[_0x35fe('0x33')]);_0x17946c[_0x35fe('0x34')]=_['intersection'](_0x17946c['model'],_0x17946c[_0x35fe('0x33')]);_0x7a7080[_0x35fe('0x36')]=_['intersection'](_0x17946c[_0x35fe('0x31')],qs['fields'](_0x17c84f[_0x35fe('0x33')][_0x35fe('0x37')]));_0x7a7080['attributes']=_0x7a7080[_0x35fe('0x36')][_0x35fe('0x38')]?_0x7a7080['attributes']:_0x17946c[_0x35fe('0x31')];if(_0x17c84f['query'][_0x35fe('0x41')]){_0x7a7080['include']=[{'all':!![]}];}_0x7a7080=_[_0x35fe('0x3c')]({},_0x7a7080,_0x17c84f[_0x35fe('0x40')]);return db[_0x35fe('0x2d')][_0x35fe('0x47')](_0x7a7080)['then'](handleEntityNotFound(_0x40c9e2,null))[_0x35fe('0x27')](respondWithResult(_0x40c9e2,null))[_0x35fe('0x44')](handleError(_0x40c9e2,null));};exports[_0x35fe('0x48')]=function(_0x4e2908,_0x1315e0){return db[_0x35fe('0x2d')]['create'](_0x4e2908[_0x35fe('0x49')],{})[_0x35fe('0x27')](respondWithResult(_0x1315e0,0xc9))['catch'](handleError(_0x1315e0,null));};exports['update']=function(_0x8906ab,_0x2f5404){if(_0x8906ab['body']['id']){delete _0x8906ab[_0x35fe('0x49')]['id'];}return db[_0x35fe('0x2d')][_0x35fe('0x47')]({'where':{'id':_0x8906ab['params']['id']}})[_0x35fe('0x27')](handleEntityNotFound(_0x2f5404,null))['then'](saveUpdates(_0x8906ab[_0x35fe('0x49')],null))[_0x35fe('0x27')](respondWithResult(_0x2f5404,null))['catch'](handleError(_0x2f5404,null));};exports[_0x35fe('0x28')]=function(_0x39fed7,_0x3ed4bb){return db[_0x35fe('0x2d')][_0x35fe('0x47')]({'where':{'id':_0x39fed7['params']['id']}})[_0x35fe('0x27')](handleEntityNotFound(_0x3ed4bb,null))[_0x35fe('0x27')](removeEntity(_0x3ed4bb,null))[_0x35fe('0x44')](handleError(_0x3ed4bb,null));};exports[_0x35fe('0x4a')]=function(_0x3a1bfb,_0x3298ff,_0x2c43a8){var _0x9776a7={};var _0x19c580={};var _0x312340;var _0x301991;return db['DeskAccount'][_0x35fe('0x4b')]({'where':{'id':_0x3a1bfb['params']['id']}})['then'](handleEntityNotFound(_0x3298ff,null))[_0x35fe('0x27')](function(_0x41c10b){if(_0x41c10b){_0x312340=_0x41c10b;_0x19c580[_0x35fe('0x31')]=_[_0x35fe('0x32')](db[_0x35fe('0x4c')][_0x35fe('0x2e')]);_0x19c580[_0x35fe('0x33')]=_[_0x35fe('0x32')](_0x3a1bfb['query']);_0x19c580['filters']=_[_0x35fe('0x35')](_0x19c580[_0x35fe('0x31')],_0x19c580[_0x35fe('0x33')]);_0x9776a7[_0x35fe('0x36')]=_[_0x35fe('0x35')](_0x19c580[_0x35fe('0x31')],qs[_0x35fe('0x37')](_0x3a1bfb[_0x35fe('0x33')][_0x35fe('0x37')]));_0x9776a7['attributes']=_0x9776a7[_0x35fe('0x36')]['length']?_0x9776a7[_0x35fe('0x36')]:_0x19c580[_0x35fe('0x31')];_0x9776a7[_0x35fe('0x4d')]=qs['sort'](_0x3a1bfb[_0x35fe('0x33')][_0x35fe('0x3a')]);_0x9776a7[_0x35fe('0x3b')]=qs[_0x35fe('0x34')](_[_0x35fe('0x4e')](_0x3a1bfb[_0x35fe('0x33')],_0x19c580['filters']));if(_0x3a1bfb['query']['filter']){_0x9776a7['where']=_[_0x35fe('0x3c')](_0x9776a7[_0x35fe('0x3b')],{'$or':_['map'](_0x9776a7[_0x35fe('0x36')],function(_0xaa92ee){var _0x3fe59a={};_0x3fe59a[_0xaa92ee]={'$like':'%'+_0x3a1bfb[_0x35fe('0x33')]['filter']+'%'};return _0x3fe59a;})});}_0x9776a7=_[_0x35fe('0x3c')]({},_0x9776a7,_0x3a1bfb[_0x35fe('0x40')]);return _0x312340['getConfigurations'](_0x9776a7);}})[_0x35fe('0x27')](function(_0xdd5f86){if(_0xdd5f86){_0x301991=_0xdd5f86[_0x35fe('0x38')];if(!_0x3a1bfb[_0x35fe('0x33')][_0x35fe('0x4f')]('nolimit')){_0x9776a7['limit']=qs['limit'](_0x3a1bfb[_0x35fe('0x33')][_0x35fe('0x1f')]);_0x9776a7[_0x35fe('0x1d')]=qs['offset'](_0x3a1bfb[_0x35fe('0x33')]['offset']);}return _0x312340['getConfigurations'](_0x9776a7);}})[_0x35fe('0x27')](function(_0x420ca6){if(_0x420ca6){return _0x420ca6?{'count':_0x301991,'rows':_0x420ca6}:null;}})[_0x35fe('0x27')](respondWithResult(_0x3298ff,null))['catch'](handleError(_0x3298ff,null));};exports[_0x35fe('0x50')]=function(_0x20c7bc,_0x1226a7,_0x5d0356){if(_0x20c7bc[_0x35fe('0x49')]['id']){delete _0x20c7bc[_0x35fe('0x49')]['id'];}return db[_0x35fe('0x2d')][_0x35fe('0x4b')]({'where':{'id':_0x20c7bc[_0x35fe('0x46')]['id']}})[_0x35fe('0x27')](handleEntityNotFound(_0x1226a7,null))[_0x35fe('0x27')](function(_0x466f18){if(_0x466f18){_0x20c7bc['body'][_0x35fe('0x51')]=_0x466f18['id'];_0x20c7bc[_0x35fe('0x49')][_0x35fe('0x52')]=integrations[_0x35fe('0x53')](_0x20c7bc[_0x35fe('0x49')][_0x35fe('0x54')],_0x20c7bc[_0x35fe('0x49')][_0x35fe('0x2f')]);_0x20c7bc[_0x35fe('0x49')][_0x35fe('0x55')]=integrations[_0x35fe('0x56')](_0x20c7bc['body']['channel'],_0x20c7bc['body'][_0x35fe('0x2f')]);return db[_0x35fe('0x4c')][_0x35fe('0x48')](_0x20c7bc[_0x35fe('0x49')],{'include':[{'model':db['DeskField'],'as':_0x35fe('0x52')},{'model':db[_0x35fe('0x57')],'as':_0x35fe('0x55')}]});}return null;})['then'](respondWithResult(_0x1226a7,null))[_0x35fe('0x44')](handleError(_0x1226a7,null));};exports[_0x35fe('0x58')]=function(_0x4bbe71,_0x4748a0,_0x3ae70b){var _0x233113=[{'name':'priority','label':_0x35fe('0x59'),'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 _0x2f05d6='';return db['DeskAccount'][_0x35fe('0x4b')]({'where':{'id':_0x4bbe71['params']['id']},'attributes':['id',_0x35fe('0x5a'),_0x35fe('0x5b'),_0x35fe('0x5c'),'password',_0x35fe('0x5d'),_0x35fe('0x5e'),_0x35fe('0x5f'),_0x35fe('0x60')]})[_0x35fe('0x27')](handleEntityNotFound(_0x4748a0,null))['then'](function(_0x87143e){if(_0x87143e){_0x2f05d6=_0x87143e[_0x35fe('0x5a')];var _0x42062d=_0x2f05d6[_0x35fe('0x61')](-0x1);if(_0x42062d==='/'){_0x2f05d6=_0x2f05d6[_0x35fe('0x62')](0x0,_0x2f05d6[_0x35fe('0x63')](_0x42062d));}var _0x373136={'method':'GET','uri':util[_0x35fe('0x64')](_0x35fe('0x65'),_0x2f05d6),'headers':{'Content-Type':_0x35fe('0x66'),'Accept':'application/json'},'json':!![]};if(_0x87143e[_0x35fe('0x5b')]===_0x35fe('0x67')){_0x373136[_0x35fe('0x68')][_0x35fe('0x69')]=util[_0x35fe('0x64')](_0x35fe('0x6a'),new Buffer(util[_0x35fe('0x64')]('%s:%s',_0x87143e[_0x35fe('0x5c')],_0x87143e['password']))[_0x35fe('0x6b')](_0x35fe('0x6c')));}return rp(_0x373136)[_0x35fe('0x27')](function(_0x3adc9){return _0x233113[_0x35fe('0x6d')](_[_0x35fe('0x3d')](_0x3adc9[_0x35fe('0x6e')][_0x35fe('0x6f')],function(_0x16477a){return{'id':_0x16477a[_0x35fe('0x2b')],'name':_0x16477a[_0x35fe('0x2b')],'type':_0x16477a['type'],'active':_0x16477a['active'],'label':_0x16477a[_0x35fe('0x70')],'custom':!![]};}));});}})[_0x35fe('0x27')](function(_0x2185d9){return{'count':_0x2185d9[_0x35fe('0x38')],'rows':_0x2185d9};})[_0x35fe('0x27')](respondWithResult(_0x4748a0,null))[_0x35fe('0x44')](function(_0x5831a4){var _0x5969f4=_0x4bbe71[_0x35fe('0x33')]['test']?0x1f4:_0x5831a4[_0x35fe('0x71')]||0x1f4;logger[_0x35fe('0x29')](_0x35fe('0x72'),'getFields',_0x5969f4,JSON[_0x35fe('0x73')](_0x5831a4));delete _0x5831a4[_0x35fe('0x2b')];if(_0x5969f4===0x191){_0x5969f4=0x190;}_0x4748a0[_0x35fe('0x21')](_0x5969f4)[_0x35fe('0x74')](_0x4bbe71[_0x35fe('0x33')][_0x35fe('0x75')]?{'message':_0x35fe('0x76'),'statusCode':_0x5831a4['statusCode']}:_0x5831a4);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d3aa388..1d4eb64 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 _0xe125=['define','int_desk_accounts','lodash','util','api','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x20d435,_0x1c5415){var _0x54288d=function(_0x49c5ad){while(--_0x49c5ad){_0x20d435['push'](_0x20d435['shift']());}};_0x54288d(++_0x1c5415);}(_0xe125,0xaa));var _0x5e12=function(_0x434fbe,_0x2047fe){_0x434fbe=_0x434fbe-0x0;var _0x4cb0dc=_0xe125[_0x434fbe];return _0x4cb0dc;};'use strict';var _=require(_0x5e12('0x0'));var util=require(_0x5e12('0x1'));var logger=require('../../config/logger')(_0x5e12('0x2'));var moment=require('moment');var BPromise=require(_0x5e12('0x3'));var rp=require(_0x5e12('0x4'));var fs=require('fs');var path=require(_0x5e12('0x5'));var rimraf=require('rimraf');var config=require(_0x5e12('0x6'));var attributes=require(_0x5e12('0x7'));var integrations=require(_0x5e12('0x8'));module[_0x5e12('0x9')]=function(_0x1fe597,_0x33de3d){return _0x1fe597[_0x5e12('0xa')]('DeskAccount',attributes,{'tableName':_0x5e12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe50c=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDeskAccount.attributes','define'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xe50c,0x122));var _0xce50=function(_0x5c6c28,_0x2fd353){_0x5c6c28=_0x5c6c28-0x0;var _0x3c1d0a=_0xe50c[_0x5c6c28];return _0x3c1d0a;};'use strict';var _=require(_0xce50('0x0'));var util=require(_0xce50('0x1'));var logger=require(_0xce50('0x2'))(_0xce50('0x3'));var moment=require(_0xce50('0x4'));var BPromise=require(_0xce50('0x5'));var rp=require(_0xce50('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce50('0x7'));var config=require('../../config/environment');var attributes=require(_0xce50('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5c33af,_0x5a92a3){return _0x5c33af[_0xce50('0x9')](_0xce50('0xa'),attributes,{'tableName':_0xce50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 3e4480c..d4ce2ee 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 _0x67b8=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','where','limit','include','model','attributes','stringify','ShowDeskAccount','DeskAccount','map','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x27da95,_0x257b26){var _0x695e0c=function(_0x3c5f05){while(--_0x3c5f05){_0x27da95['push'](_0x27da95['shift']());}};_0x695e0c(++_0x257b26);}(_0x67b8,0x19f));var _0x867b=function(_0x43d952,_0x453ec9){_0x43d952=_0x43d952-0x0;var _0x1c53b5=_0x67b8[_0x43d952];return _0x1c53b5;};'use strict';var _=require('lodash');var util=require(_0x867b('0x0'));var moment=require(_0x867b('0x1'));var BPromise=require(_0x867b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x867b('0x3'))['db'];var utils=require(_0x867b('0x4'));var logger=require(_0x867b('0x5'))(_0x867b('0x6'));var config=require('../../config/environment');var jayson=require(_0x867b('0x7'));var client=jayson[_0x867b('0x8')][_0x867b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3411fe,_0x1d8e39,_0x1bafb4){return new BPromise(function(_0x4a4400,_0x468883){return client[_0x867b('0xa')](_0x3411fe,_0x1bafb4)[_0x867b('0xb')](function(_0x390e34){logger[_0x867b('0xc')](_0x867b('0xd'),_0x1d8e39,_0x867b('0xe'));logger[_0x867b('0xf')](_0x867b('0x10'),_0x1d8e39,_0x867b('0xe'),JSON['stringify'](_0x390e34));if(_0x390e34['error']){if(_0x390e34[_0x867b('0x11')][_0x867b('0x12')]===0x1f4){logger[_0x867b('0x11')](_0x867b('0xd'),_0x1d8e39,_0x390e34['error'][_0x867b('0x13')]);return _0x468883(_0x390e34[_0x867b('0x11')][_0x867b('0x13')]);}logger[_0x867b('0x11')](_0x867b('0xd'),_0x1d8e39,_0x390e34[_0x867b('0x11')][_0x867b('0x13')]);return _0x4a4400(_0x390e34[_0x867b('0x11')][_0x867b('0x13')]);}else{logger['info'](_0x867b('0xd'),_0x1d8e39,_0x867b('0xe'));_0x4a4400(_0x390e34[_0x867b('0x14')][_0x867b('0x13')]);}})[_0x867b('0x15')](function(_0x42cd69){logger[_0x867b('0x11')]('DeskAccount,\x20%s,\x20%s',_0x1d8e39,_0x42cd69);_0x468883(_0x42cd69);});});}exports[_0x867b('0x16')]=function(_0xe2f818){var _0x49df77=this;return new Promise(function(_0x44c4cb,_0x2a827a){return db['DeskAccount'][_0x867b('0x17')]({'raw':_0xe2f818[_0x867b('0x18')]?_0xe2f818[_0x867b('0x18')][_0x867b('0x19')]===undefined?!![]:![]:!![],'where':_0xe2f818[_0x867b('0x18')]?_0xe2f818[_0x867b('0x18')][_0x867b('0x1a')]||null:null,'attributes':_0xe2f818[_0x867b('0x18')]?_0xe2f818[_0x867b('0x18')]['attributes']||null:null,'limit':_0xe2f818[_0x867b('0x18')]?_0xe2f818[_0x867b('0x18')][_0x867b('0x1b')]||null:null,'include':_0xe2f818[_0x867b('0x18')]?_0xe2f818[_0x867b('0x18')][_0x867b('0x1c')]?_['map'](_0xe2f818[_0x867b('0x18')][_0x867b('0x1c')],function(_0x257ffb){return{'model':db[_0x257ffb[_0x867b('0x1d')]],'as':_0x257ffb['as'],'attributes':_0x257ffb[_0x867b('0x1e')],'include':_0x257ffb[_0x867b('0x1c')]?_['map'](_0x257ffb['include'],function(_0x36a8ec){return{'model':db[_0x36a8ec[_0x867b('0x1d')]],'as':_0x36a8ec['as'],'attributes':_0x36a8ec[_0x867b('0x1e')],'include':_0x36a8ec[_0x867b('0x1c')]?_['map'](_0x36a8ec[_0x867b('0x1c')],function(_0x94891b){return{'model':db[_0x94891b[_0x867b('0x1d')]],'as':_0x94891b['as'],'attributes':_0x94891b[_0x867b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x867b('0xb')](function(_0x49842a){logger[_0x867b('0xc')](_0x867b('0x16'),_0xe2f818);logger[_0x867b('0xf')](_0x867b('0x16'),_0xe2f818,JSON[_0x867b('0x1f')](_0x49842a));_0x44c4cb(_0x49842a);})[_0x867b('0x15')](function(_0x2e05c1){logger[_0x867b('0x11')]('GetDeskAccount',_0x2e05c1[_0x867b('0x13')],_0xe2f818);_0x2a827a(_0x49df77[_0x867b('0x11')](0x1f4,_0x2e05c1[_0x867b('0x13')]));});});};exports[_0x867b('0x20')]=function(_0x2a4d1d){var _0x57d993=this;return new Promise(function(_0x53f3c8,_0x300977){return db[_0x867b('0x21')]['find']({'raw':_0x2a4d1d[_0x867b('0x18')]?_0x2a4d1d[_0x867b('0x18')][_0x867b('0x19')]===undefined?!![]:![]:!![],'where':_0x2a4d1d['options']?_0x2a4d1d[_0x867b('0x18')][_0x867b('0x1a')]||null:null,'attributes':_0x2a4d1d[_0x867b('0x18')]?_0x2a4d1d['options'][_0x867b('0x1e')]||null:null,'include':_0x2a4d1d[_0x867b('0x18')]?_0x2a4d1d[_0x867b('0x18')]['include']?_[_0x867b('0x22')](_0x2a4d1d['options'][_0x867b('0x1c')],function(_0x1574e6){return{'model':db[_0x1574e6[_0x867b('0x1d')]],'as':_0x1574e6['as'],'attributes':_0x1574e6[_0x867b('0x1e')],'include':_0x1574e6['include']?_[_0x867b('0x22')](_0x1574e6[_0x867b('0x1c')],function(_0x4a2d9c){return{'model':db[_0x4a2d9c[_0x867b('0x1d')]],'as':_0x4a2d9c['as'],'attributes':_0x4a2d9c[_0x867b('0x1e')],'include':_0x4a2d9c[_0x867b('0x1c')]?_[_0x867b('0x22')](_0x4a2d9c['include'],function(_0x5da124){return{'model':db[_0x5da124['model']],'as':_0x5da124['as'],'attributes':_0x5da124[_0x867b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x867b('0xb')](function(_0x486ecf){logger[_0x867b('0xc')](_0x867b('0x20'),_0x2a4d1d);logger['debug'](_0x867b('0x20'),_0x2a4d1d,JSON[_0x867b('0x1f')](_0x486ecf));_0x53f3c8(_0x486ecf);})[_0x867b('0x15')](function(_0x49e115){logger['error'](_0x867b('0x20'),_0x49e115[_0x867b('0x13')],_0x2a4d1d);_0x300977(_0x57d993[_0x867b('0x11')](0x1f4,_0x49e115[_0x867b('0x13')]));});});}; \ No newline at end of file +var _0x3f3c=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowDeskAccount'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3f3c,0x6f));var _0xc3f3=function(_0x3349bb,_0x371922){_0x3349bb=_0x3349bb-0x0;var _0x38f653=_0x3f3c[_0x3349bb];return _0x38f653;};'use strict';var _=require(_0xc3f3('0x0'));var util=require(_0xc3f3('0x1'));var moment=require(_0xc3f3('0x2'));var BPromise=require(_0xc3f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3f3('0x4'));var db=require(_0xc3f3('0x5'))['db'];var utils=require(_0xc3f3('0x6'));var logger=require(_0xc3f3('0x7'))(_0xc3f3('0x8'));var config=require(_0xc3f3('0x9'));var jayson=require(_0xc3f3('0xa'));var client=jayson[_0xc3f3('0xb')][_0xc3f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a3681,_0x337337,_0xd709b8){return new BPromise(function(_0x3f103b,_0x5be3fc){return client[_0xc3f3('0xd')](_0x1a3681,_0xd709b8)['then'](function(_0x1e45c9){logger[_0xc3f3('0xe')](_0xc3f3('0xf'),_0x337337,_0xc3f3('0x10'));logger[_0xc3f3('0x11')](_0xc3f3('0x12'),_0x337337,_0xc3f3('0x10'),JSON[_0xc3f3('0x13')](_0x1e45c9));if(_0x1e45c9[_0xc3f3('0x14')]){if(_0x1e45c9[_0xc3f3('0x14')][_0xc3f3('0x15')]===0x1f4){logger['error'](_0xc3f3('0xf'),_0x337337,_0x1e45c9[_0xc3f3('0x14')][_0xc3f3('0x16')]);return _0x5be3fc(_0x1e45c9['error']['message']);}logger[_0xc3f3('0x14')](_0xc3f3('0xf'),_0x337337,_0x1e45c9[_0xc3f3('0x14')][_0xc3f3('0x16')]);return _0x3f103b(_0x1e45c9[_0xc3f3('0x14')][_0xc3f3('0x16')]);}else{logger[_0xc3f3('0xe')]('DeskAccount,\x20%s,\x20%s',_0x337337,_0xc3f3('0x10'));_0x3f103b(_0x1e45c9[_0xc3f3('0x17')][_0xc3f3('0x16')]);}})['catch'](function(_0x1481e3){logger[_0xc3f3('0x14')](_0xc3f3('0xf'),_0x337337,_0x1481e3);_0x5be3fc(_0x1481e3);});});}exports[_0xc3f3('0x18')]=function(_0x368520){var _0x187ff0=this;return new Promise(function(_0x154df4,_0xcd33e){return db[_0xc3f3('0x19')][_0xc3f3('0x1a')]({'raw':_0x368520[_0xc3f3('0x1b')]?_0x368520[_0xc3f3('0x1b')][_0xc3f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x368520[_0xc3f3('0x1b')]?_0x368520[_0xc3f3('0x1b')]['where']||null:null,'attributes':_0x368520['options']?_0x368520[_0xc3f3('0x1b')][_0xc3f3('0x1d')]||null:null,'limit':_0x368520[_0xc3f3('0x1b')]?_0x368520[_0xc3f3('0x1b')][_0xc3f3('0x1e')]||null:null,'include':_0x368520['options']?_0x368520['options'][_0xc3f3('0x1f')]?_[_0xc3f3('0x20')](_0x368520[_0xc3f3('0x1b')][_0xc3f3('0x1f')],function(_0xc60372){return{'model':db[_0xc60372['model']],'as':_0xc60372['as'],'attributes':_0xc60372['attributes'],'include':_0xc60372[_0xc3f3('0x1f')]?_[_0xc3f3('0x20')](_0xc60372['include'],function(_0x3637f9){return{'model':db[_0x3637f9[_0xc3f3('0x21')]],'as':_0x3637f9['as'],'attributes':_0x3637f9[_0xc3f3('0x1d')],'include':_0x3637f9[_0xc3f3('0x1f')]?_[_0xc3f3('0x20')](_0x3637f9[_0xc3f3('0x1f')],function(_0x56ba94){return{'model':db[_0x56ba94[_0xc3f3('0x21')]],'as':_0x56ba94['as'],'attributes':_0x56ba94[_0xc3f3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x266242){logger['info'](_0xc3f3('0x18'),_0x368520);logger[_0xc3f3('0x11')]('GetDeskAccount',_0x368520,JSON[_0xc3f3('0x13')](_0x266242));_0x154df4(_0x266242);})['catch'](function(_0x54e4ac){logger[_0xc3f3('0x14')](_0xc3f3('0x18'),_0x54e4ac[_0xc3f3('0x16')],_0x368520);_0xcd33e(_0x187ff0[_0xc3f3('0x14')](0x1f4,_0x54e4ac['message']));});});};exports['ShowDeskAccount']=function(_0x1b8ef6){var _0x324a1c=this;return new Promise(function(_0x48afac,_0x121370){return db[_0xc3f3('0x19')][_0xc3f3('0x22')]({'raw':_0x1b8ef6[_0xc3f3('0x1b')]?_0x1b8ef6[_0xc3f3('0x1b')][_0xc3f3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b8ef6['options']?_0x1b8ef6[_0xc3f3('0x1b')][_0xc3f3('0x23')]||null:null,'attributes':_0x1b8ef6[_0xc3f3('0x1b')]?_0x1b8ef6[_0xc3f3('0x1b')]['attributes']||null:null,'include':_0x1b8ef6[_0xc3f3('0x1b')]?_0x1b8ef6['options']['include']?_[_0xc3f3('0x20')](_0x1b8ef6[_0xc3f3('0x1b')]['include'],function(_0x4f126c){return{'model':db[_0x4f126c['model']],'as':_0x4f126c['as'],'attributes':_0x4f126c[_0xc3f3('0x1d')],'include':_0x4f126c['include']?_[_0xc3f3('0x20')](_0x4f126c[_0xc3f3('0x1f')],function(_0x51368e){return{'model':db[_0x51368e[_0xc3f3('0x21')]],'as':_0x51368e['as'],'attributes':_0x51368e[_0xc3f3('0x1d')],'include':_0x51368e['include']?_[_0xc3f3('0x20')](_0x51368e[_0xc3f3('0x1f')],function(_0x51208a){return{'model':db[_0x51208a['model']],'as':_0x51208a['as'],'attributes':_0x51208a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x220819){logger[_0xc3f3('0xe')](_0xc3f3('0x24'),_0x1b8ef6);logger[_0xc3f3('0x11')](_0xc3f3('0x24'),_0x1b8ef6,JSON[_0xc3f3('0x13')](_0x220819));_0x48afac(_0x220819);})['catch'](function(_0x4d4233){logger['error'](_0xc3f3('0x24'),_0x4d4233['message'],_0x1b8ef6);_0x121370(_0x324a1c[_0xc3f3('0x14')](0x1f4,_0x4d4233['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d8b839a..2b920a5 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3e74,0x175));var _0x43e7=function(_0x21624f,_0x237448){_0x21624f=_0x21624f-0x0;var _0x5290aa=_0x3e74[_0x21624f];return _0x5290aa;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ee338,_0x3ad974){var _0x3402f3=function(_0x4e3e1e){while(--_0x4e3e1e){_0x4ee338['push'](_0x4ee338['shift']());}};_0x3402f3(++_0x3ad974);}(_0x008c,0x188));var _0xc008=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x008c[_0x561f25];return _0x150e4c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 10e49f1..5583d26 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 _0x1d0f=['sequelize','STRING'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x1d0f,0x144));var _0xf1d0=function(_0x9fd48b,_0x33b908){_0x9fd48b=_0x9fd48b-0x0;var _0x4f637b=_0x1d0f[_0x9fd48b];return _0x4f637b;};'use strict';var Sequelize=require(_0xf1d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xf1d0('0x1')]},'description':{'type':Sequelize[_0xf1d0('0x1')]}}; \ No newline at end of file +var _0x7b6c=['exports','STRING','sequelize'];(function(_0x15987a,_0x1afa5a){var _0x2f0656=function(_0x48f008){while(--_0x48f008){_0x15987a['push'](_0x15987a['shift']());}};_0x2f0656(++_0x1afa5a);}(_0x7b6c,0x95));var _0xc7b6=function(_0x49afee,_0x31dea5){_0x49afee=_0x49afee-0x0;var _0x4690d5=_0x7b6c[_0x49afee];return _0x4690d5;};'use strict';var Sequelize=require(_0xc7b6('0x0'));module[_0xc7b6('0x1')]={'name':{'type':Sequelize[_0xc7b6('0x2')]},'description':{'type':Sequelize[_0xc7b6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 24545b6..4aac6d9 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 _0x09ce=['catch','show','params','find','create','body','update','DeskField','filter','getFields','hasOwnProperty','findOne','getSubjects','getDescriptions','getTags','setTags','ids','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','apply','reject','save','then','destroy','sendStatus','error','stack','name','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll'];(function(_0x297d26,_0x181c70){var _0x386f9f=function(_0xd5114){while(--_0xd5114){_0x297d26['push'](_0x297d26['shift']());}};_0x386f9f(++_0x181c70);}(_0x09ce,0x101));var _0xe09c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x09ce[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe09c('0x0'));var rp=require(_0xe09c('0x1'));var moment=require(_0xe09c('0x2'));var BPromise=require(_0xe09c('0x3'));var Mustache=require(_0xe09c('0x4'));var util=require(_0xe09c('0x5'));var path=require(_0xe09c('0x6'));var sox=require('sox');var csv=require(_0xe09c('0x7'));var ejs=require(_0xe09c('0x8'));var fs=require('fs');var fs_extra=require(_0xe09c('0x9'));var _=require('lodash');var squel=require(_0xe09c('0xa'));var crypto=require('crypto');var jsforce=require(_0xe09c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe09c('0x7'));var querystring=require(_0xe09c('0xc'));var Papa=require(_0xe09c('0xd'));var Redis=require(_0xe09c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe09c('0xf'));var hardwareService=require(_0xe09c('0x10'));var logger=require(_0xe09c('0x11'))(_0xe09c('0x12'));var utils=require(_0xe09c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe09c('0x14'));var db=require(_0xe09c('0x15'))['db'];function respondWithStatusCode(_0x4237a9,_0x44517a){_0x44517a=_0x44517a||0xcc;return function(_0x19f5ce){if(_0x19f5ce){return _0x4237a9['sendStatus'](_0x44517a);}return _0x4237a9[_0xe09c('0x16')](_0x44517a)[_0xe09c('0x17')]();};}function respondWithResult(_0x2c4847,_0x1d45bf){_0x1d45bf=_0x1d45bf||0xc8;return function(_0x5d72cc){if(_0x5d72cc){return _0x2c4847[_0xe09c('0x16')](_0x1d45bf)[_0xe09c('0x18')](_0x5d72cc);}};}function respondWithFilteredResult(_0x4ec2d3,_0x2ffe12){return function(_0x2cdb62){if(_0x2cdb62){var _0x238a90=typeof _0x2ffe12['offset']===_0xe09c('0x19')&&typeof _0x2ffe12[_0xe09c('0x1a')]==='undefined';var _0x3d3b26=_0x2cdb62['count'];var _0xdfa451=_0x238a90?0x0:_0x2ffe12[_0xe09c('0x1b')];var _0x59ae11=_0x238a90?_0x2cdb62['count']:_0x2ffe12[_0xe09c('0x1b')]+_0x2ffe12['limit'];var _0x3e9431;if(_0x59ae11>=_0x3d3b26){_0x59ae11=_0x3d3b26;_0x3e9431=0xc8;}else{_0x3e9431=0xce;}_0x4ec2d3[_0xe09c('0x16')](_0x3e9431);return _0x4ec2d3['set']('Content-Range',_0xdfa451+'-'+_0x59ae11+'/'+_0x3d3b26)[_0xe09c('0x18')](_0x2cdb62);}return null;};}function patchUpdates(_0x578792){return function(_0x5183b8){try{jsonpatch[_0xe09c('0x1c')](_0x5183b8,_0x578792,!![]);}catch(_0x3cfec3){return BPromise[_0xe09c('0x1d')](_0x3cfec3);}return _0x5183b8[_0xe09c('0x1e')]();};}function saveUpdates(_0x33f7b2,_0x57d607){return function(_0x27b238){if(_0x27b238){return _0x27b238['update'](_0x33f7b2)[_0xe09c('0x1f')](function(_0x55ecc2){return _0x55ecc2;});}return null;};}function removeEntity(_0x20a36d,_0x566252){return function(_0x53a41c){if(_0x53a41c){return _0x53a41c[_0xe09c('0x20')]()[_0xe09c('0x1f')](function(){_0x20a36d['status'](0xcc)[_0xe09c('0x17')]();});}};}function handleEntityNotFound(_0x91a91e,_0x2f14ec){return function(_0x1867df){if(!_0x1867df){_0x91a91e[_0xe09c('0x21')](0x194);}return _0x1867df;};}function handleError(_0x588e95,_0x8008dd){_0x8008dd=_0x8008dd||0x1f4;return function(_0x5d7b78){logger[_0xe09c('0x22')](_0x5d7b78[_0xe09c('0x23')]);if(_0x5d7b78[_0xe09c('0x24')]){delete _0x5d7b78[_0xe09c('0x24')];}_0x588e95['status'](_0x8008dd)['send'](_0x5d7b78);};}exports['index']=function(_0x37b759,_0x441637){var _0x9bb376={},_0x54fb0d={},_0x5cb13d={'count':0x0,'rows':[]};var _0x2ec5f0=_['map'](db[_0xe09c('0x25')][_0xe09c('0x26')],function(_0x107950){return{'name':_0x107950[_0xe09c('0x27')],'type':_0x107950[_0xe09c('0x28')][_0xe09c('0x29')]};});_0x54fb0d[_0xe09c('0x2a')]=_[_0xe09c('0x2b')](_0x2ec5f0,_0xe09c('0x24'));_0x54fb0d[_0xe09c('0x2c')]=_[_0xe09c('0x2d')](_0x37b759[_0xe09c('0x2c')]);_0x54fb0d['filters']=_[_0xe09c('0x2e')](_0x54fb0d[_0xe09c('0x2a')],_0x54fb0d[_0xe09c('0x2c')]);_0x9bb376[_0xe09c('0x2f')]=_['intersection'](_0x54fb0d[_0xe09c('0x2a')],qs[_0xe09c('0x30')](_0x37b759[_0xe09c('0x2c')][_0xe09c('0x30')]));_0x9bb376[_0xe09c('0x2f')]=_0x9bb376[_0xe09c('0x2f')][_0xe09c('0x31')]?_0x9bb376[_0xe09c('0x2f')]:_0x54fb0d['model'];if(!_0x37b759[_0xe09c('0x2c')]['hasOwnProperty'](_0xe09c('0x32'))){_0x9bb376[_0xe09c('0x1a')]=qs[_0xe09c('0x1a')](_0x37b759[_0xe09c('0x2c')][_0xe09c('0x1a')]);_0x9bb376[_0xe09c('0x1b')]=qs[_0xe09c('0x1b')](_0x37b759[_0xe09c('0x2c')][_0xe09c('0x1b')]);}_0x9bb376[_0xe09c('0x33')]=qs['sort'](_0x37b759[_0xe09c('0x2c')][_0xe09c('0x34')]);_0x9bb376[_0xe09c('0x35')]=qs[_0xe09c('0x36')](_[_0xe09c('0x37')](_0x37b759[_0xe09c('0x2c')],_0x54fb0d[_0xe09c('0x36')]),_0x2ec5f0);if(_0x37b759[_0xe09c('0x2c')]['filter']){_0x9bb376[_0xe09c('0x35')]=_[_0xe09c('0x38')](_0x9bb376[_0xe09c('0x35')],{'$or':_[_0xe09c('0x2b')](_0x2ec5f0,function(_0x1a83ba){if(_0x1a83ba[_0xe09c('0x28')]!==_0xe09c('0x39')){var _0x20954e={};_0x20954e[_0x1a83ba[_0xe09c('0x24')]]={'$like':'%'+_0x37b759[_0xe09c('0x2c')]['filter']+'%'};return _0x20954e;}})});}_0x9bb376=_['merge']({},_0x9bb376,_0x37b759[_0xe09c('0x3a')]);var _0x29f43f={'where':_0x9bb376[_0xe09c('0x35')]};return db[_0xe09c('0x25')][_0xe09c('0x3b')](_0x29f43f)[_0xe09c('0x1f')](function(_0x4e329f){_0x5cb13d[_0xe09c('0x3b')]=_0x4e329f;if(_0x37b759['query'][_0xe09c('0x3c')]){_0x9bb376[_0xe09c('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xe09c('0x3e')](_0x9bb376);})[_0xe09c('0x1f')](function(_0x2b7ec5){_0x5cb13d['rows']=_0x2b7ec5;return _0x5cb13d;})[_0xe09c('0x1f')](respondWithFilteredResult(_0x441637,_0x9bb376))[_0xe09c('0x3f')](handleError(_0x441637,null));};exports[_0xe09c('0x40')]=function(_0xc7a3af,_0x1dfc9e){var _0x5c485f={'raw':![],'where':{'id':_0xc7a3af[_0xe09c('0x41')]['id']}},_0x24a204={};_0x24a204[_0xe09c('0x2a')]=_[_0xe09c('0x2d')](db[_0xe09c('0x25')][_0xe09c('0x26')]);_0x24a204[_0xe09c('0x2c')]=_[_0xe09c('0x2d')](_0xc7a3af[_0xe09c('0x2c')]);_0x24a204['filters']=_[_0xe09c('0x2e')](_0x24a204[_0xe09c('0x2a')],_0x24a204[_0xe09c('0x2c')]);_0x5c485f[_0xe09c('0x2f')]=_[_0xe09c('0x2e')](_0x24a204['model'],qs[_0xe09c('0x30')](_0xc7a3af['query']['fields']));_0x5c485f[_0xe09c('0x2f')]=_0x5c485f[_0xe09c('0x2f')][_0xe09c('0x31')]?_0x5c485f[_0xe09c('0x2f')]:_0x24a204[_0xe09c('0x2a')];if(_0xc7a3af[_0xe09c('0x2c')][_0xe09c('0x3c')]){_0x5c485f[_0xe09c('0x3d')]=[{'all':!![]}];}_0x5c485f=_['merge']({},_0x5c485f,_0xc7a3af[_0xe09c('0x3a')]);return db[_0xe09c('0x25')][_0xe09c('0x42')](_0x5c485f)[_0xe09c('0x1f')](handleEntityNotFound(_0x1dfc9e,null))['then'](respondWithResult(_0x1dfc9e,null))[_0xe09c('0x3f')](handleError(_0x1dfc9e,null));};exports[_0xe09c('0x43')]=function(_0x1075f4,_0x42ff47){return db[_0xe09c('0x25')][_0xe09c('0x43')](_0x1075f4[_0xe09c('0x44')],{})['then'](respondWithResult(_0x42ff47,0xc9))[_0xe09c('0x3f')](handleError(_0x42ff47,null));};exports[_0xe09c('0x45')]=function(_0x43d62d,_0x139c56){if(_0x43d62d[_0xe09c('0x44')]['id']){delete _0x43d62d[_0xe09c('0x44')]['id'];}return db[_0xe09c('0x25')][_0xe09c('0x42')]({'where':{'id':_0x43d62d[_0xe09c('0x41')]['id']}})['then'](handleEntityNotFound(_0x139c56,null))['then'](saveUpdates(_0x43d62d[_0xe09c('0x44')],null))[_0xe09c('0x1f')](respondWithResult(_0x139c56,null))['catch'](handleError(_0x139c56,null));};exports[_0xe09c('0x20')]=function(_0x3d547a,_0x56840d){return db[_0xe09c('0x25')][_0xe09c('0x42')]({'where':{'id':_0x3d547a[_0xe09c('0x41')]['id']}})[_0xe09c('0x1f')](handleEntityNotFound(_0x56840d,null))[_0xe09c('0x1f')](removeEntity(_0x56840d,null))[_0xe09c('0x3f')](handleError(_0x56840d,null));};exports['getFields']=function(_0xb32326,_0x36ec30,_0x4474d2){var _0x5434dd={};var _0x26dbdd={};var _0xa9ac0c;var _0x3f9806;return db[_0xe09c('0x25')]['findOne']({'where':{'id':_0xb32326['params']['id']}})['then'](handleEntityNotFound(_0x36ec30,null))[_0xe09c('0x1f')](function(_0x59fc44){if(_0x59fc44){_0xa9ac0c=_0x59fc44;_0x26dbdd['model']=_['keys'](db[_0xe09c('0x46')][_0xe09c('0x26')]);_0x26dbdd[_0xe09c('0x2c')]=_['keys'](_0xb32326[_0xe09c('0x2c')]);_0x26dbdd[_0xe09c('0x36')]=_[_0xe09c('0x2e')](_0x26dbdd[_0xe09c('0x2a')],_0x26dbdd['query']);_0x5434dd[_0xe09c('0x2f')]=_[_0xe09c('0x2e')](_0x26dbdd['model'],qs[_0xe09c('0x30')](_0xb32326[_0xe09c('0x2c')][_0xe09c('0x30')]));_0x5434dd[_0xe09c('0x2f')]=_0x5434dd[_0xe09c('0x2f')][_0xe09c('0x31')]?_0x5434dd[_0xe09c('0x2f')]:_0x26dbdd[_0xe09c('0x2a')];_0x5434dd[_0xe09c('0x33')]=qs[_0xe09c('0x34')](_0xb32326['query'][_0xe09c('0x34')]);_0x5434dd[_0xe09c('0x35')]=qs[_0xe09c('0x36')](_[_0xe09c('0x37')](_0xb32326['query'],_0x26dbdd[_0xe09c('0x36')]));if(_0xb32326[_0xe09c('0x2c')][_0xe09c('0x47')]){_0x5434dd[_0xe09c('0x35')]=_['merge'](_0x5434dd['where'],{'$or':_['map'](_0x5434dd['attributes'],function(_0x21313b){var _0xae8b70={};_0xae8b70[_0x21313b]={'$like':'%'+_0xb32326[_0xe09c('0x2c')][_0xe09c('0x47')]+'%'};return _0xae8b70;})});}_0x5434dd=_['merge']({},_0x5434dd,_0xb32326[_0xe09c('0x3a')]);return _0xa9ac0c[_0xe09c('0x48')](_0x5434dd);}})[_0xe09c('0x1f')](function(_0x485710){if(_0x485710){_0x3f9806=_0x485710[_0xe09c('0x31')];if(!_0xb32326[_0xe09c('0x2c')][_0xe09c('0x49')](_0xe09c('0x32'))){_0x5434dd[_0xe09c('0x1a')]=qs[_0xe09c('0x1a')](_0xb32326['query'][_0xe09c('0x1a')]);_0x5434dd[_0xe09c('0x1b')]=qs[_0xe09c('0x1b')](_0xb32326[_0xe09c('0x2c')]['offset']);}return _0xa9ac0c[_0xe09c('0x48')](_0x5434dd);}})[_0xe09c('0x1f')](function(_0x1bbc39){if(_0x1bbc39){return _0x1bbc39?{'count':_0x3f9806,'rows':_0x1bbc39}:null;}})[_0xe09c('0x1f')](respondWithResult(_0x36ec30,null))[_0xe09c('0x3f')](handleError(_0x36ec30,null));};exports['getSubjects']=function(_0x572793,_0xa599a6,_0x47670b){var _0x1ce340={};var _0x59608e={};var _0x130aab;var _0x2684fe;return db[_0xe09c('0x25')][_0xe09c('0x4a')]({'where':{'id':_0x572793['params']['id']}})[_0xe09c('0x1f')](handleEntityNotFound(_0xa599a6,null))[_0xe09c('0x1f')](function(_0x313842){if(_0x313842){_0x130aab=_0x313842;_0x59608e[_0xe09c('0x2a')]=_[_0xe09c('0x2d')](db[_0xe09c('0x46')][_0xe09c('0x26')]);_0x59608e[_0xe09c('0x2c')]=_['keys'](_0x572793[_0xe09c('0x2c')]);_0x59608e[_0xe09c('0x36')]=_[_0xe09c('0x2e')](_0x59608e['model'],_0x59608e[_0xe09c('0x2c')]);_0x1ce340[_0xe09c('0x2f')]=_[_0xe09c('0x2e')](_0x59608e['model'],qs['fields'](_0x572793[_0xe09c('0x2c')][_0xe09c('0x30')]));_0x1ce340['attributes']=_0x1ce340['attributes'][_0xe09c('0x31')]?_0x1ce340[_0xe09c('0x2f')]:_0x59608e[_0xe09c('0x2a')];_0x1ce340[_0xe09c('0x33')]=qs[_0xe09c('0x34')](_0x572793['query'][_0xe09c('0x34')]);_0x1ce340[_0xe09c('0x35')]=qs[_0xe09c('0x36')](_[_0xe09c('0x37')](_0x572793[_0xe09c('0x2c')],_0x59608e[_0xe09c('0x36')]));if(_0x572793[_0xe09c('0x2c')][_0xe09c('0x47')]){_0x1ce340[_0xe09c('0x35')]=_['merge'](_0x1ce340[_0xe09c('0x35')],{'$or':_[_0xe09c('0x2b')](_0x1ce340['attributes'],function(_0x3aec64){var _0x3fe72d={};_0x3fe72d[_0x3aec64]={'$like':'%'+_0x572793[_0xe09c('0x2c')]['filter']+'%'};return _0x3fe72d;})});}_0x1ce340=_[_0xe09c('0x38')]({},_0x1ce340,_0x572793[_0xe09c('0x3a')]);return _0x130aab[_0xe09c('0x4b')](_0x1ce340);}})[_0xe09c('0x1f')](function(_0x3942f3){if(_0x3942f3){_0x2684fe=_0x3942f3[_0xe09c('0x31')];if(!_0x572793[_0xe09c('0x2c')][_0xe09c('0x49')](_0xe09c('0x32'))){_0x1ce340[_0xe09c('0x1a')]=qs[_0xe09c('0x1a')](_0x572793[_0xe09c('0x2c')][_0xe09c('0x1a')]);_0x1ce340['offset']=qs[_0xe09c('0x1b')](_0x572793[_0xe09c('0x2c')][_0xe09c('0x1b')]);}return _0x130aab['getSubjects'](_0x1ce340);}})['then'](function(_0x1e8b0f){if(_0x1e8b0f){return _0x1e8b0f?{'count':_0x2684fe,'rows':_0x1e8b0f}:null;}})[_0xe09c('0x1f')](respondWithResult(_0xa599a6,null))[_0xe09c('0x3f')](handleError(_0xa599a6,null));};exports[_0xe09c('0x4c')]=function(_0x3e39c7,_0xbcd6a9,_0x285047){var _0x1e63d3={};var _0x5e97d5={};var _0x58869d;var _0xa8042b;return db['DeskConfiguration'][_0xe09c('0x4a')]({'where':{'id':_0x3e39c7[_0xe09c('0x41')]['id']}})[_0xe09c('0x1f')](handleEntityNotFound(_0xbcd6a9,null))[_0xe09c('0x1f')](function(_0x4bec9c){if(_0x4bec9c){_0x58869d=_0x4bec9c;_0x5e97d5[_0xe09c('0x2a')]=_[_0xe09c('0x2d')](db['DeskField'][_0xe09c('0x26')]);_0x5e97d5['query']=_[_0xe09c('0x2d')](_0x3e39c7[_0xe09c('0x2c')]);_0x5e97d5[_0xe09c('0x36')]=_['intersection'](_0x5e97d5[_0xe09c('0x2a')],_0x5e97d5[_0xe09c('0x2c')]);_0x1e63d3['attributes']=_[_0xe09c('0x2e')](_0x5e97d5['model'],qs[_0xe09c('0x30')](_0x3e39c7[_0xe09c('0x2c')][_0xe09c('0x30')]));_0x1e63d3['attributes']=_0x1e63d3[_0xe09c('0x2f')][_0xe09c('0x31')]?_0x1e63d3['attributes']:_0x5e97d5[_0xe09c('0x2a')];_0x1e63d3[_0xe09c('0x33')]=qs[_0xe09c('0x34')](_0x3e39c7[_0xe09c('0x2c')][_0xe09c('0x34')]);_0x1e63d3[_0xe09c('0x35')]=qs[_0xe09c('0x36')](_[_0xe09c('0x37')](_0x3e39c7[_0xe09c('0x2c')],_0x5e97d5[_0xe09c('0x36')]));if(_0x3e39c7['query'][_0xe09c('0x47')]){_0x1e63d3['where']=_[_0xe09c('0x38')](_0x1e63d3['where'],{'$or':_[_0xe09c('0x2b')](_0x1e63d3[_0xe09c('0x2f')],function(_0x19bf69){var _0x100e60={};_0x100e60[_0x19bf69]={'$like':'%'+_0x3e39c7['query'][_0xe09c('0x47')]+'%'};return _0x100e60;})});}_0x1e63d3=_[_0xe09c('0x38')]({},_0x1e63d3,_0x3e39c7[_0xe09c('0x3a')]);return _0x58869d[_0xe09c('0x4c')](_0x1e63d3);}})[_0xe09c('0x1f')](function(_0x35923d){if(_0x35923d){_0xa8042b=_0x35923d[_0xe09c('0x31')];if(!_0x3e39c7[_0xe09c('0x2c')][_0xe09c('0x49')](_0xe09c('0x32'))){_0x1e63d3[_0xe09c('0x1a')]=qs['limit'](_0x3e39c7[_0xe09c('0x2c')][_0xe09c('0x1a')]);_0x1e63d3[_0xe09c('0x1b')]=qs['offset'](_0x3e39c7[_0xe09c('0x2c')][_0xe09c('0x1b')]);}return _0x58869d[_0xe09c('0x4c')](_0x1e63d3);}})[_0xe09c('0x1f')](function(_0x3d5ee1){if(_0x3d5ee1){return _0x3d5ee1?{'count':_0xa8042b,'rows':_0x3d5ee1}:null;}})[_0xe09c('0x1f')](respondWithResult(_0xbcd6a9,null))[_0xe09c('0x3f')](handleError(_0xbcd6a9,null));};exports[_0xe09c('0x4d')]=function(_0x9b44f9,_0x3603fe,_0x2ab91d){var _0x3d7bb9={};var _0x3723cd={};var _0x4a6d26;var _0x190c9b;return db[_0xe09c('0x25')][_0xe09c('0x4a')]({'where':{'id':_0x9b44f9['params']['id']}})[_0xe09c('0x1f')](handleEntityNotFound(_0x3603fe,null))['then'](function(_0x3e419b){if(_0x3e419b){_0x4a6d26=_0x3e419b;_0x3723cd['model']=_[_0xe09c('0x2d')](db['Tag']['rawAttributes']);_0x3723cd[_0xe09c('0x2c')]=_[_0xe09c('0x2d')](_0x9b44f9['query']);_0x3723cd['filters']=_[_0xe09c('0x2e')](_0x3723cd['model'],_0x3723cd[_0xe09c('0x2c')]);_0x3d7bb9[_0xe09c('0x2f')]=_[_0xe09c('0x2e')](_0x3723cd['model'],qs[_0xe09c('0x30')](_0x9b44f9[_0xe09c('0x2c')]['fields']));_0x3d7bb9['attributes']=_0x3d7bb9['attributes']['length']?_0x3d7bb9[_0xe09c('0x2f')]:_0x3723cd['model'];_0x3d7bb9[_0xe09c('0x33')]=qs[_0xe09c('0x34')](_0x9b44f9['query']['sort']);_0x3d7bb9[_0xe09c('0x35')]=qs[_0xe09c('0x36')](_[_0xe09c('0x37')](_0x9b44f9[_0xe09c('0x2c')],_0x3723cd['filters']));if(_0x9b44f9[_0xe09c('0x2c')][_0xe09c('0x47')]){_0x3d7bb9['where']=_['merge'](_0x3d7bb9[_0xe09c('0x35')],{'$or':_['map'](_0x3d7bb9[_0xe09c('0x2f')],function(_0x10591d){var _0x3fcc3c={};_0x3fcc3c[_0x10591d]={'$like':'%'+_0x9b44f9[_0xe09c('0x2c')][_0xe09c('0x47')]+'%'};return _0x3fcc3c;})});}_0x3d7bb9=_[_0xe09c('0x38')]({},_0x3d7bb9,_0x9b44f9[_0xe09c('0x3a')]);return _0x4a6d26[_0xe09c('0x4d')](_0x3d7bb9);}})[_0xe09c('0x1f')](function(_0x2578ce){if(_0x2578ce){_0x190c9b=_0x2578ce[_0xe09c('0x31')];if(!_0x9b44f9[_0xe09c('0x2c')][_0xe09c('0x49')](_0xe09c('0x32'))){_0x3d7bb9['limit']=qs[_0xe09c('0x1a')](_0x9b44f9[_0xe09c('0x2c')]['limit']);_0x3d7bb9[_0xe09c('0x1b')]=qs[_0xe09c('0x1b')](_0x9b44f9['query'][_0xe09c('0x1b')]);}return _0x4a6d26[_0xe09c('0x4d')](_0x3d7bb9);}})[_0xe09c('0x1f')](function(_0x3cbccb){if(_0x3cbccb){return _0x3cbccb?{'count':_0x190c9b,'rows':_0x3cbccb}:null;}})[_0xe09c('0x1f')](respondWithResult(_0x3603fe,null))[_0xe09c('0x3f')](handleError(_0x3603fe,null));};exports[_0xe09c('0x4e')]=function(_0x1b1835,_0x11ad74,_0x3ae0c6){if(_0x1b1835[_0xe09c('0x44')]['id']){delete _0x1b1835['body']['id'];}return db[_0xe09c('0x25')]['findOne']({'where':{'id':_0x1b1835[_0xe09c('0x41')]['id']}})[_0xe09c('0x1f')](handleEntityNotFound(_0x11ad74,null))[_0xe09c('0x1f')](function(_0x1e283d){if(_0x1e283d){return _0x1e283d[_0xe09c('0x4e')](_0x1b1835[_0xe09c('0x44')][_0xe09c('0x4f')]||[]);}return null;})[_0xe09c('0x1f')](respondWithResult(_0x11ad74,null))['catch'](handleError(_0x11ad74,null));}; \ No newline at end of file +var _0x526d=['set','apply','reject','save','update','then','end','error','stack','name','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','fields','includeAll','find','create','body','destroy','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status'];(function(_0x4da438,_0x274ea2){var _0x414986=function(_0xf5ed3e){while(--_0xf5ed3e){_0x4da438['push'](_0x4da438['shift']());}};_0x414986(++_0x274ea2);}(_0x526d,0xe2));var _0xd526=function(_0xa355ee,_0x4b6360){_0xa355ee=_0xa355ee-0x0;var _0x44307e=_0x526d[_0xa355ee];return _0x44307e;};'use strict';var emlformat=require(_0xd526('0x0'));var rimraf=require(_0xd526('0x1'));var zipdir=require(_0xd526('0x2'));var jsonpatch=require(_0xd526('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd526('0x4'));var Mustache=require(_0xd526('0x5'));var util=require('util');var path=require(_0xd526('0x6'));var sox=require(_0xd526('0x7'));var csv=require(_0xd526('0x8'));var ejs=require(_0xd526('0x9'));var fs=require('fs');var fs_extra=require(_0xd526('0xa'));var _=require(_0xd526('0xb'));var squel=require(_0xd526('0xc'));var crypto=require(_0xd526('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd526('0x8'));var querystring=require(_0xd526('0xe'));var Papa=require(_0xd526('0xf'));var Redis=require(_0xd526('0x10'));var authService=require(_0xd526('0x11'));var qs=require(_0xd526('0x12'));var as=require(_0xd526('0x13'));var hardwareService=require(_0xd526('0x14'));var logger=require('../../config/logger')(_0xd526('0x15'));var utils=require('../../config/utils');var config=require(_0xd526('0x16'));var licenseUtil=require(_0xd526('0x17'));var db=require(_0xd526('0x18'))['db'];function respondWithStatusCode(_0x1bd1ab,_0x22ed32){_0x22ed32=_0x22ed32||0xcc;return function(_0x5934a5){if(_0x5934a5){return _0x1bd1ab[_0xd526('0x19')](_0x22ed32);}return _0x1bd1ab['status'](_0x22ed32)['end']();};}function respondWithResult(_0x2eefab,_0x3d2b51){_0x3d2b51=_0x3d2b51||0xc8;return function(_0x5769a0){if(_0x5769a0){return _0x2eefab['status'](_0x3d2b51)[_0xd526('0x1a')](_0x5769a0);}};}function respondWithFilteredResult(_0x375acf,_0x567a47){return function(_0x535d56){if(_0x535d56){var _0x1d5e9c=typeof _0x567a47[_0xd526('0x1b')]===_0xd526('0x1c')&&typeof _0x567a47[_0xd526('0x1d')]===_0xd526('0x1c');var _0x2b9648=_0x535d56[_0xd526('0x1e')];var _0x30b656=_0x1d5e9c?0x0:_0x567a47[_0xd526('0x1b')];var _0x365d87=_0x1d5e9c?_0x535d56[_0xd526('0x1e')]:_0x567a47[_0xd526('0x1b')]+_0x567a47[_0xd526('0x1d')];var _0x10ddf2;if(_0x365d87>=_0x2b9648){_0x365d87=_0x2b9648;_0x10ddf2=0xc8;}else{_0x10ddf2=0xce;}_0x375acf[_0xd526('0x1f')](_0x10ddf2);return _0x375acf[_0xd526('0x20')]('Content-Range',_0x30b656+'-'+_0x365d87+'/'+_0x2b9648)[_0xd526('0x1a')](_0x535d56);}return null;};}function patchUpdates(_0xa2d64c){return function(_0x3d8aa3){try{jsonpatch[_0xd526('0x21')](_0x3d8aa3,_0xa2d64c,!![]);}catch(_0x87c9e1){return BPromise[_0xd526('0x22')](_0x87c9e1);}return _0x3d8aa3[_0xd526('0x23')]();};}function saveUpdates(_0x5646fd,_0x4b8981){return function(_0x3e6f4b){if(_0x3e6f4b){return _0x3e6f4b[_0xd526('0x24')](_0x5646fd)[_0xd526('0x25')](function(_0x4aa425){return _0x4aa425;});}return null;};}function removeEntity(_0x19116b,_0x411f2e){return function(_0x398006){if(_0x398006){return _0x398006['destroy']()[_0xd526('0x25')](function(){_0x19116b[_0xd526('0x1f')](0xcc)[_0xd526('0x26')]();});}};}function handleEntityNotFound(_0x18308a,_0x4b25f0){return function(_0xd47e35){if(!_0xd47e35){_0x18308a[_0xd526('0x19')](0x194);}return _0xd47e35;};}function handleError(_0x344c77,_0x46e295){_0x46e295=_0x46e295||0x1f4;return function(_0x5c55ce){logger[_0xd526('0x27')](_0x5c55ce[_0xd526('0x28')]);if(_0x5c55ce['name']){delete _0x5c55ce[_0xd526('0x29')];}_0x344c77['status'](_0x46e295)['send'](_0x5c55ce);};}exports[_0xd526('0x2a')]=function(_0x184230,_0x2642b1){var _0x33672c={},_0x3aab5c={},_0x10fb03={'count':0x0,'rows':[]};var _0x19b15b=_['map'](db[_0xd526('0x2b')][_0xd526('0x2c')],function(_0xdacdf2){return{'name':_0xdacdf2[_0xd526('0x2d')],'type':_0xdacdf2[_0xd526('0x2e')][_0xd526('0x2f')]};});_0x3aab5c[_0xd526('0x30')]=_[_0xd526('0x31')](_0x19b15b,'name');_0x3aab5c['query']=_[_0xd526('0x32')](_0x184230[_0xd526('0x33')]);_0x3aab5c[_0xd526('0x34')]=_['intersection'](_0x3aab5c['model'],_0x3aab5c[_0xd526('0x33')]);_0x33672c[_0xd526('0x35')]=_['intersection'](_0x3aab5c[_0xd526('0x30')],qs['fields'](_0x184230[_0xd526('0x33')]['fields']));_0x33672c['attributes']=_0x33672c[_0xd526('0x35')][_0xd526('0x36')]?_0x33672c[_0xd526('0x35')]:_0x3aab5c[_0xd526('0x30')];if(!_0x184230[_0xd526('0x33')][_0xd526('0x37')](_0xd526('0x38'))){_0x33672c[_0xd526('0x1d')]=qs['limit'](_0x184230[_0xd526('0x33')][_0xd526('0x1d')]);_0x33672c['offset']=qs['offset'](_0x184230[_0xd526('0x33')][_0xd526('0x1b')]);}_0x33672c['order']=qs['sort'](_0x184230[_0xd526('0x33')][_0xd526('0x39')]);_0x33672c['where']=qs[_0xd526('0x34')](_[_0xd526('0x3a')](_0x184230['query'],_0x3aab5c[_0xd526('0x34')]),_0x19b15b);if(_0x184230[_0xd526('0x33')][_0xd526('0x3b')]){_0x33672c[_0xd526('0x3c')]=_[_0xd526('0x3d')](_0x33672c[_0xd526('0x3c')],{'$or':_[_0xd526('0x31')](_0x19b15b,function(_0x41d1d2){if(_0x41d1d2[_0xd526('0x2e')]!==_0xd526('0x3e')){var _0xfcf0d2={};_0xfcf0d2[_0x41d1d2['name']]={'$like':'%'+_0x184230[_0xd526('0x33')][_0xd526('0x3b')]+'%'};return _0xfcf0d2;}})});}_0x33672c=_[_0xd526('0x3d')]({},_0x33672c,_0x184230[_0xd526('0x3f')]);var _0x2f3b7b={'where':_0x33672c[_0xd526('0x3c')]};return db['DeskConfiguration'][_0xd526('0x1e')](_0x2f3b7b)[_0xd526('0x25')](function(_0x256442){_0x10fb03[_0xd526('0x1e')]=_0x256442;if(_0x184230[_0xd526('0x33')]['includeAll']){_0x33672c[_0xd526('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xd526('0x41')](_0x33672c);})['then'](function(_0x3d8871){_0x10fb03[_0xd526('0x42')]=_0x3d8871;return _0x10fb03;})['then'](respondWithFilteredResult(_0x2642b1,_0x33672c))[_0xd526('0x43')](handleError(_0x2642b1,null));};exports[_0xd526('0x44')]=function(_0x336e67,_0x1160a6){var _0x28df24={'raw':![],'where':{'id':_0x336e67[_0xd526('0x45')]['id']}},_0x1d350f={};_0x1d350f[_0xd526('0x30')]=_[_0xd526('0x32')](db[_0xd526('0x2b')][_0xd526('0x2c')]);_0x1d350f[_0xd526('0x33')]=_[_0xd526('0x32')](_0x336e67[_0xd526('0x33')]);_0x1d350f[_0xd526('0x34')]=_[_0xd526('0x46')](_0x1d350f[_0xd526('0x30')],_0x1d350f[_0xd526('0x33')]);_0x28df24[_0xd526('0x35')]=_[_0xd526('0x46')](_0x1d350f[_0xd526('0x30')],qs[_0xd526('0x47')](_0x336e67['query'][_0xd526('0x47')]));_0x28df24[_0xd526('0x35')]=_0x28df24[_0xd526('0x35')][_0xd526('0x36')]?_0x28df24[_0xd526('0x35')]:_0x1d350f['model'];if(_0x336e67[_0xd526('0x33')][_0xd526('0x48')]){_0x28df24['include']=[{'all':!![]}];}_0x28df24=_[_0xd526('0x3d')]({},_0x28df24,_0x336e67['options']);return db['DeskConfiguration'][_0xd526('0x49')](_0x28df24)[_0xd526('0x25')](handleEntityNotFound(_0x1160a6,null))[_0xd526('0x25')](respondWithResult(_0x1160a6,null))[_0xd526('0x43')](handleError(_0x1160a6,null));};exports['create']=function(_0x3671d0,_0x290f19){return db[_0xd526('0x2b')][_0xd526('0x4a')](_0x3671d0[_0xd526('0x4b')],{})[_0xd526('0x25')](respondWithResult(_0x290f19,0xc9))[_0xd526('0x43')](handleError(_0x290f19,null));};exports[_0xd526('0x24')]=function(_0x4a4e30,_0x5905f0){if(_0x4a4e30[_0xd526('0x4b')]['id']){delete _0x4a4e30[_0xd526('0x4b')]['id'];}return db[_0xd526('0x2b')][_0xd526('0x49')]({'where':{'id':_0x4a4e30[_0xd526('0x45')]['id']}})[_0xd526('0x25')](handleEntityNotFound(_0x5905f0,null))[_0xd526('0x25')](saveUpdates(_0x4a4e30[_0xd526('0x4b')],null))[_0xd526('0x25')](respondWithResult(_0x5905f0,null))[_0xd526('0x43')](handleError(_0x5905f0,null));};exports[_0xd526('0x4c')]=function(_0xf60420,_0x5930a5){return db['DeskConfiguration'][_0xd526('0x49')]({'where':{'id':_0xf60420[_0xd526('0x45')]['id']}})[_0xd526('0x25')](handleEntityNotFound(_0x5930a5,null))[_0xd526('0x25')](removeEntity(_0x5930a5,null))['catch'](handleError(_0x5930a5,null));};exports[_0xd526('0x4d')]=function(_0x25b02d,_0x257fde,_0x1f6d15){var _0x46d3be={};var _0x25727f={};var _0x3ef07a;var _0x42a243;return db[_0xd526('0x2b')][_0xd526('0x4e')]({'where':{'id':_0x25b02d[_0xd526('0x45')]['id']}})[_0xd526('0x25')](handleEntityNotFound(_0x257fde,null))[_0xd526('0x25')](function(_0x5a3efc){if(_0x5a3efc){_0x3ef07a=_0x5a3efc;_0x25727f[_0xd526('0x30')]=_['keys'](db[_0xd526('0x4f')][_0xd526('0x2c')]);_0x25727f['query']=_[_0xd526('0x32')](_0x25b02d[_0xd526('0x33')]);_0x25727f[_0xd526('0x34')]=_[_0xd526('0x46')](_0x25727f[_0xd526('0x30')],_0x25727f[_0xd526('0x33')]);_0x46d3be[_0xd526('0x35')]=_[_0xd526('0x46')](_0x25727f[_0xd526('0x30')],qs[_0xd526('0x47')](_0x25b02d[_0xd526('0x33')][_0xd526('0x47')]));_0x46d3be[_0xd526('0x35')]=_0x46d3be['attributes'][_0xd526('0x36')]?_0x46d3be['attributes']:_0x25727f[_0xd526('0x30')];_0x46d3be[_0xd526('0x50')]=qs[_0xd526('0x39')](_0x25b02d[_0xd526('0x33')][_0xd526('0x39')]);_0x46d3be[_0xd526('0x3c')]=qs[_0xd526('0x34')](_['pick'](_0x25b02d['query'],_0x25727f[_0xd526('0x34')]));if(_0x25b02d[_0xd526('0x33')][_0xd526('0x3b')]){_0x46d3be['where']=_[_0xd526('0x3d')](_0x46d3be[_0xd526('0x3c')],{'$or':_['map'](_0x46d3be[_0xd526('0x35')],function(_0x5beea6){var _0x533541={};_0x533541[_0x5beea6]={'$like':'%'+_0x25b02d[_0xd526('0x33')][_0xd526('0x3b')]+'%'};return _0x533541;})});}_0x46d3be=_[_0xd526('0x3d')]({},_0x46d3be,_0x25b02d[_0xd526('0x3f')]);return _0x3ef07a[_0xd526('0x4d')](_0x46d3be);}})['then'](function(_0x2b780d){if(_0x2b780d){_0x42a243=_0x2b780d['length'];if(!_0x25b02d[_0xd526('0x33')][_0xd526('0x37')](_0xd526('0x38'))){_0x46d3be['limit']=qs[_0xd526('0x1d')](_0x25b02d[_0xd526('0x33')]['limit']);_0x46d3be['offset']=qs[_0xd526('0x1b')](_0x25b02d['query']['offset']);}return _0x3ef07a[_0xd526('0x4d')](_0x46d3be);}})[_0xd526('0x25')](function(_0xc1bbb1){if(_0xc1bbb1){return _0xc1bbb1?{'count':_0x42a243,'rows':_0xc1bbb1}:null;}})[_0xd526('0x25')](respondWithResult(_0x257fde,null))[_0xd526('0x43')](handleError(_0x257fde,null));};exports['getSubjects']=function(_0x3b2f40,_0x49f07d,_0x204d46){var _0x202c8f={};var _0x350a16={};var _0xdeec0d;var _0x2176ba;return db[_0xd526('0x2b')][_0xd526('0x4e')]({'where':{'id':_0x3b2f40[_0xd526('0x45')]['id']}})[_0xd526('0x25')](handleEntityNotFound(_0x49f07d,null))[_0xd526('0x25')](function(_0x42cf05){if(_0x42cf05){_0xdeec0d=_0x42cf05;_0x350a16[_0xd526('0x30')]=_[_0xd526('0x32')](db[_0xd526('0x4f')][_0xd526('0x2c')]);_0x350a16['query']=_[_0xd526('0x32')](_0x3b2f40[_0xd526('0x33')]);_0x350a16[_0xd526('0x34')]=_[_0xd526('0x46')](_0x350a16[_0xd526('0x30')],_0x350a16['query']);_0x202c8f['attributes']=_[_0xd526('0x46')](_0x350a16[_0xd526('0x30')],qs['fields'](_0x3b2f40[_0xd526('0x33')][_0xd526('0x47')]));_0x202c8f['attributes']=_0x202c8f[_0xd526('0x35')]['length']?_0x202c8f[_0xd526('0x35')]:_0x350a16[_0xd526('0x30')];_0x202c8f[_0xd526('0x50')]=qs[_0xd526('0x39')](_0x3b2f40[_0xd526('0x33')][_0xd526('0x39')]);_0x202c8f['where']=qs['filters'](_['pick'](_0x3b2f40[_0xd526('0x33')],_0x350a16['filters']));if(_0x3b2f40[_0xd526('0x33')][_0xd526('0x3b')]){_0x202c8f[_0xd526('0x3c')]=_[_0xd526('0x3d')](_0x202c8f['where'],{'$or':_[_0xd526('0x31')](_0x202c8f[_0xd526('0x35')],function(_0x5d02ee){var _0x28633b={};_0x28633b[_0x5d02ee]={'$like':'%'+_0x3b2f40['query']['filter']+'%'};return _0x28633b;})});}_0x202c8f=_[_0xd526('0x3d')]({},_0x202c8f,_0x3b2f40[_0xd526('0x3f')]);return _0xdeec0d['getSubjects'](_0x202c8f);}})[_0xd526('0x25')](function(_0xaf9a27){if(_0xaf9a27){_0x2176ba=_0xaf9a27[_0xd526('0x36')];if(!_0x3b2f40[_0xd526('0x33')][_0xd526('0x37')](_0xd526('0x38'))){_0x202c8f['limit']=qs['limit'](_0x3b2f40[_0xd526('0x33')][_0xd526('0x1d')]);_0x202c8f['offset']=qs[_0xd526('0x1b')](_0x3b2f40[_0xd526('0x33')][_0xd526('0x1b')]);}return _0xdeec0d[_0xd526('0x51')](_0x202c8f);}})['then'](function(_0x429150){if(_0x429150){return _0x429150?{'count':_0x2176ba,'rows':_0x429150}:null;}})[_0xd526('0x25')](respondWithResult(_0x49f07d,null))[_0xd526('0x43')](handleError(_0x49f07d,null));};exports[_0xd526('0x52')]=function(_0x5991fe,_0x109fb9,_0x420c76){var _0x376f69={};var _0x4e37ed={};var _0x41d085;var _0x24bd39;return db[_0xd526('0x2b')][_0xd526('0x4e')]({'where':{'id':_0x5991fe[_0xd526('0x45')]['id']}})[_0xd526('0x25')](handleEntityNotFound(_0x109fb9,null))[_0xd526('0x25')](function(_0x513489){if(_0x513489){_0x41d085=_0x513489;_0x4e37ed[_0xd526('0x30')]=_['keys'](db[_0xd526('0x4f')][_0xd526('0x2c')]);_0x4e37ed[_0xd526('0x33')]=_[_0xd526('0x32')](_0x5991fe[_0xd526('0x33')]);_0x4e37ed['filters']=_[_0xd526('0x46')](_0x4e37ed[_0xd526('0x30')],_0x4e37ed['query']);_0x376f69[_0xd526('0x35')]=_['intersection'](_0x4e37ed[_0xd526('0x30')],qs[_0xd526('0x47')](_0x5991fe['query'][_0xd526('0x47')]));_0x376f69[_0xd526('0x35')]=_0x376f69[_0xd526('0x35')][_0xd526('0x36')]?_0x376f69[_0xd526('0x35')]:_0x4e37ed[_0xd526('0x30')];_0x376f69[_0xd526('0x50')]=qs[_0xd526('0x39')](_0x5991fe[_0xd526('0x33')]['sort']);_0x376f69[_0xd526('0x3c')]=qs[_0xd526('0x34')](_[_0xd526('0x3a')](_0x5991fe[_0xd526('0x33')],_0x4e37ed[_0xd526('0x34')]));if(_0x5991fe[_0xd526('0x33')][_0xd526('0x3b')]){_0x376f69[_0xd526('0x3c')]=_[_0xd526('0x3d')](_0x376f69['where'],{'$or':_[_0xd526('0x31')](_0x376f69['attributes'],function(_0x5c9326){var _0x58808d={};_0x58808d[_0x5c9326]={'$like':'%'+_0x5991fe['query'][_0xd526('0x3b')]+'%'};return _0x58808d;})});}_0x376f69=_[_0xd526('0x3d')]({},_0x376f69,_0x5991fe[_0xd526('0x3f')]);return _0x41d085['getDescriptions'](_0x376f69);}})[_0xd526('0x25')](function(_0x4041b1){if(_0x4041b1){_0x24bd39=_0x4041b1[_0xd526('0x36')];if(!_0x5991fe[_0xd526('0x33')][_0xd526('0x37')](_0xd526('0x38'))){_0x376f69[_0xd526('0x1d')]=qs['limit'](_0x5991fe['query'][_0xd526('0x1d')]);_0x376f69[_0xd526('0x1b')]=qs[_0xd526('0x1b')](_0x5991fe[_0xd526('0x33')][_0xd526('0x1b')]);}return _0x41d085['getDescriptions'](_0x376f69);}})[_0xd526('0x25')](function(_0x502f10){if(_0x502f10){return _0x502f10?{'count':_0x24bd39,'rows':_0x502f10}:null;}})[_0xd526('0x25')](respondWithResult(_0x109fb9,null))[_0xd526('0x43')](handleError(_0x109fb9,null));};exports[_0xd526('0x53')]=function(_0x502ceb,_0x5dcfb0,_0x326c48){var _0x5d4c49={};var _0x1fe3bf={};var _0x1d0b89;var _0x4bc0de;return db[_0xd526('0x2b')][_0xd526('0x4e')]({'where':{'id':_0x502ceb[_0xd526('0x45')]['id']}})[_0xd526('0x25')](handleEntityNotFound(_0x5dcfb0,null))[_0xd526('0x25')](function(_0x23839b){if(_0x23839b){_0x1d0b89=_0x23839b;_0x1fe3bf[_0xd526('0x30')]=_[_0xd526('0x32')](db[_0xd526('0x54')]['rawAttributes']);_0x1fe3bf['query']=_[_0xd526('0x32')](_0x502ceb[_0xd526('0x33')]);_0x1fe3bf['filters']=_[_0xd526('0x46')](_0x1fe3bf[_0xd526('0x30')],_0x1fe3bf[_0xd526('0x33')]);_0x5d4c49[_0xd526('0x35')]=_[_0xd526('0x46')](_0x1fe3bf[_0xd526('0x30')],qs[_0xd526('0x47')](_0x502ceb[_0xd526('0x33')][_0xd526('0x47')]));_0x5d4c49[_0xd526('0x35')]=_0x5d4c49['attributes'][_0xd526('0x36')]?_0x5d4c49[_0xd526('0x35')]:_0x1fe3bf[_0xd526('0x30')];_0x5d4c49[_0xd526('0x50')]=qs[_0xd526('0x39')](_0x502ceb[_0xd526('0x33')][_0xd526('0x39')]);_0x5d4c49[_0xd526('0x3c')]=qs[_0xd526('0x34')](_['pick'](_0x502ceb[_0xd526('0x33')],_0x1fe3bf['filters']));if(_0x502ceb[_0xd526('0x33')][_0xd526('0x3b')]){_0x5d4c49[_0xd526('0x3c')]=_[_0xd526('0x3d')](_0x5d4c49[_0xd526('0x3c')],{'$or':_[_0xd526('0x31')](_0x5d4c49[_0xd526('0x35')],function(_0x2249ed){var _0x3e0079={};_0x3e0079[_0x2249ed]={'$like':'%'+_0x502ceb[_0xd526('0x33')][_0xd526('0x3b')]+'%'};return _0x3e0079;})});}_0x5d4c49=_[_0xd526('0x3d')]({},_0x5d4c49,_0x502ceb[_0xd526('0x3f')]);return _0x1d0b89[_0xd526('0x53')](_0x5d4c49);}})['then'](function(_0x5ae9c3){if(_0x5ae9c3){_0x4bc0de=_0x5ae9c3[_0xd526('0x36')];if(!_0x502ceb[_0xd526('0x33')][_0xd526('0x37')](_0xd526('0x38'))){_0x5d4c49[_0xd526('0x1d')]=qs['limit'](_0x502ceb[_0xd526('0x33')][_0xd526('0x1d')]);_0x5d4c49['offset']=qs['offset'](_0x502ceb[_0xd526('0x33')][_0xd526('0x1b')]);}return _0x1d0b89[_0xd526('0x53')](_0x5d4c49);}})[_0xd526('0x25')](function(_0x232147){if(_0x232147){return _0x232147?{'count':_0x4bc0de,'rows':_0x232147}:null;}})['then'](respondWithResult(_0x5dcfb0,null))[_0xd526('0x43')](handleError(_0x5dcfb0,null));};exports[_0xd526('0x55')]=function(_0x5930a4,_0x4165c0,_0x922152){if(_0x5930a4[_0xd526('0x4b')]['id']){delete _0x5930a4[_0xd526('0x4b')]['id'];}return db['DeskConfiguration'][_0xd526('0x4e')]({'where':{'id':_0x5930a4[_0xd526('0x45')]['id']}})[_0xd526('0x25')](handleEntityNotFound(_0x4165c0,null))[_0xd526('0x25')](function(_0x7ddf08){if(_0x7ddf08){return _0x7ddf08[_0xd526('0x55')](_0x5930a4[_0xd526('0x4b')]['ids']||[]);}return null;})[_0xd526('0x25')](respondWithResult(_0x4165c0,null))[_0xd526('0x43')](handleError(_0x4165c0,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 620bd5c..02d0863 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 _0x4ee7=['int_desk_configurations','lodash','api','moment','bluebird','request-promise','../../config/environment','define','DeskConfiguration'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4ee7,0x9a));var _0x74ee=function(_0x26c797,_0xea70d0){_0x26c797=_0x26c797-0x0;var _0x1b879d=_0x4ee7[_0x26c797];return _0x1b879d;};'use strict';var _=require(_0x74ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x74ee('0x1'));var moment=require(_0x74ee('0x2'));var BPromise=require(_0x74ee('0x3'));var rp=require(_0x74ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x74ee('0x5'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x88195d,_0x32b2ab){return _0x88195d[_0x74ee('0x6')](_0x74ee('0x7'),attributes,{'tableName':_0x74ee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x766f=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x299d43,_0x4ebe75){var _0x2173b6=function(_0x588394){while(--_0x588394){_0x299d43['push'](_0x299d43['shift']());}};_0x2173b6(++_0x4ebe75);}(_0x766f,0xe9));var _0xf766=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x766f[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xf766('0x0'));var util=require(_0xf766('0x1'));var logger=require(_0xf766('0x2'))(_0xf766('0x3'));var moment=require(_0xf766('0x4'));var BPromise=require('bluebird');var rp=require(_0xf766('0x5'));var fs=require('fs');var path=require(_0xf766('0x6'));var rimraf=require(_0xf766('0x7'));var config=require(_0xf766('0x8'));var attributes=require(_0xf766('0x9'));module[_0xf766('0xa')]=function(_0x2920ac,_0x4a9221){return _0x2920ac[_0xf766('0xb')](_0xf766('0xc'),attributes,{'tableName':_0xf766('0xd'),'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 c8561c0..a8f1af4 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 _0x3bf0=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x40e095,_0x4565be){var _0x120268=function(_0x3f5096){while(--_0x3f5096){_0x40e095['push'](_0x40e095['shift']());}};_0x120268(++_0x4565be);}(_0x3bf0,0x83));var _0x03bf=function(_0x29ef12,_0x5d9cd9){_0x29ef12=_0x29ef12-0x0;var _0x49199e=_0x3bf0[_0x29ef12];return _0x49199e;};'use strict';var _=require(_0x03bf('0x0'));var util=require(_0x03bf('0x1'));var moment=require(_0x03bf('0x2'));var BPromise=require(_0x03bf('0x3'));var rs=require(_0x03bf('0x4'));var fs=require('fs');var Redis=require(_0x03bf('0x5'));var db=require(_0x03bf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x03bf('0x7'))(_0x03bf('0x8'));var config=require(_0x03bf('0x9'));var jayson=require(_0x03bf('0xa'));var client=jayson[_0x03bf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c37c7,_0xf513cf,_0x537662){return new BPromise(function(_0x1ae46b,_0x143717){return client[_0x03bf('0xc')](_0x2c37c7,_0x537662)['then'](function(_0x126981){logger[_0x03bf('0xd')](_0x03bf('0xe'),_0xf513cf,_0x03bf('0xf'));logger[_0x03bf('0x10')](_0x03bf('0x11'),_0xf513cf,_0x03bf('0xf'),JSON[_0x03bf('0x12')](_0x126981));if(_0x126981[_0x03bf('0x13')]){if(_0x126981[_0x03bf('0x13')][_0x03bf('0x14')]===0x1f4){logger[_0x03bf('0x13')](_0x03bf('0xe'),_0xf513cf,_0x126981[_0x03bf('0x13')][_0x03bf('0x15')]);return _0x143717(_0x126981[_0x03bf('0x13')][_0x03bf('0x15')]);}logger[_0x03bf('0x13')](_0x03bf('0xe'),_0xf513cf,_0x126981[_0x03bf('0x13')]['message']);return _0x1ae46b(_0x126981['error'][_0x03bf('0x15')]);}else{logger[_0x03bf('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0xf513cf,_0x03bf('0xf'));_0x1ae46b(_0x126981[_0x03bf('0x16')][_0x03bf('0x15')]);}})[_0x03bf('0x17')](function(_0x46bc4f){logger[_0x03bf('0x13')](_0x03bf('0xe'),_0xf513cf,_0x46bc4f);_0x143717(_0x46bc4f);});});} \ No newline at end of file +var _0x4c99=['debug','stringify','error','code','message','result','lodash','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x32bd44,_0x50ef4b){var _0xbc51fb=function(_0x241b86){while(--_0x241b86){_0x32bd44['push'](_0x32bd44['shift']());}};_0xbc51fb(++_0x50ef4b);}(_0x4c99,0x1ec));var _0x94c9=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x4c99[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x94c9('0x0'));var util=require('util');var moment=require(_0x94c9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94c9('0x2'))['db'];var utils=require(_0x94c9('0x3'));var logger=require('../../config/logger')(_0x94c9('0x4'));var config=require(_0x94c9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x94c9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebd2b,_0x49b85b,_0x23d961){return new BPromise(function(_0x4403ba,_0x3a1743){return client[_0x94c9('0x7')](_0x4ebd2b,_0x23d961)[_0x94c9('0x8')](function(_0x1c0983){logger[_0x94c9('0x9')](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));logger[_0x94c9('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x49b85b,_0x94c9('0xb'),JSON[_0x94c9('0xd')](_0x1c0983));if(_0x1c0983[_0x94c9('0xe')]){if(_0x1c0983['error'][_0x94c9('0xf')]===0x1f4){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);return _0x3a1743(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}logger[_0x94c9('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x49b85b,_0x1c0983['error']['message']);return _0x4403ba(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}else{logger['info'](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));_0x4403ba(_0x1c0983[_0x94c9('0x11')]['message']);}})['catch'](function(_0x447937){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x447937);_0x3a1743(_0x447937);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9e70012..d901367 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 _0x404d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','show','post','put','/:id','isAuthenticated','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x404d,0x1e9));var _0xd404=function(_0x134936,_0x2d8cb9){_0x134936=_0x134936-0x0;var _0x36e8c1=_0x404d[_0x134936];return _0x36e8c1;};'use strict';var multer=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var path=require(_0xd404('0x2'));var timeout=require(_0xd404('0x3'));var express=require(_0xd404('0x4'));var router=express[_0xd404('0x5')]();var fs_extra=require(_0xd404('0x6'));var auth=require(_0xd404('0x7'));var interaction=require(_0xd404('0x8'));var config=require('../../config/environment');var controller=require(_0xd404('0x9'));router[_0xd404('0xa')]('/',auth['isAuthenticated'](),controller[_0xd404('0xb')]);router[_0xd404('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd404('0xc')]);router[_0xd404('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd404('0xe')](_0xd404('0xf'),auth[_0xd404('0x10')](),controller[_0xd404('0x11')]);router['delete']('/:id',auth[_0xd404('0x10')](),controller[_0xd404('0x12')]);module['exports']=router; \ No newline at end of file +var _0x29b1=['show','post','put','update','destroy','util','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x29b1,0xbb));var _0x129b=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x29b1[_0x1abb09];return _0xea1c07;};'use strict';var multer=require('multer');var util=require(_0x129b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x129b('0x1')]();var fs_extra=require(_0x129b('0x2'));var auth=require(_0x129b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x129b('0x4'));var controller=require(_0x129b('0x5'));router[_0x129b('0x6')]('/',auth[_0x129b('0x7')](),controller['index']);router[_0x129b('0x6')](_0x129b('0x8'),auth[_0x129b('0x7')](),controller[_0x129b('0x9')]);router[_0x129b('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x129b('0xb')](_0x129b('0x8'),auth['isAuthenticated'](),controller[_0x129b('0xc')]);router['delete'](_0x129b('0x8'),auth['isAuthenticated'](),controller[_0x129b('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 86abb98..16c381b 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 _0x90ae=['picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x4f750b,_0x4e3e43){var _0x918b39=function(_0x106d8f){while(--_0x106d8f){_0x4f750b['push'](_0x4f750b['shift']());}};_0x918b39(++_0x4e3e43);}(_0x90ae,0xca));var _0xe90a=function(_0x57c17a,_0x32e378){_0x57c17a=_0x57c17a-0x0;var _0x391b0b=_0x90ae[_0x57c17a];return _0x391b0b;};'use strict';var Sequelize=require('sequelize');module[_0xe90a('0x0')]={'type':{'type':Sequelize[_0xe90a('0x1')](_0xe90a('0x2'),'variable',_0xe90a('0x3'),_0xe90a('0x4'),_0xe90a('0x5')),'defaultValue':_0xe90a('0x2')},'content':{'type':Sequelize[_0xe90a('0x6')]},'key':{'type':Sequelize[_0xe90a('0x6')]},'keyType':{'type':Sequelize[_0xe90a('0x1')]('string',_0xe90a('0x7'),_0xe90a('0x3'))},'keyContent':{'type':Sequelize[_0xe90a('0x6')]},'idField':{'type':Sequelize[_0xe90a('0x6')]},'nameField':{'type':Sequelize[_0xe90a('0x6')]},'customField':{'type':Sequelize[_0xe90a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe90a('0x6')]}}; \ No newline at end of file +var _0x7c11=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x732e09,_0x4bd3f9){var _0x14c534=function(_0x25c636){while(--_0x25c636){_0x732e09['push'](_0x732e09['shift']());}};_0x14c534(++_0x4bd3f9);}(_0x7c11,0x101));var _0x17c1=function(_0xf8fec7,_0x4f8e96){_0xf8fec7=_0xf8fec7-0x0;var _0x18800a=_0x7c11[_0xf8fec7];return _0x18800a;};'use strict';var Sequelize=require(_0x17c1('0x0'));module[_0x17c1('0x1')]={'type':{'type':Sequelize[_0x17c1('0x2')](_0x17c1('0x3'),_0x17c1('0x4'),_0x17c1('0x5'),_0x17c1('0x6'),_0x17c1('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x17c1('0x8')]},'key':{'type':Sequelize[_0x17c1('0x8')]},'keyType':{'type':Sequelize[_0x17c1('0x2')]('string',_0x17c1('0x4'),_0x17c1('0x5'))},'keyContent':{'type':Sequelize[_0x17c1('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x17c1('0x8')]},'customField':{'type':Sequelize[_0x17c1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x17c1('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b548fe1..3feed4d 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 _0x1cb9=['name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack'];(function(_0x58eb93,_0x5c6368){var _0x3e6837=function(_0x2ffb89){while(--_0x2ffb89){_0x58eb93['push'](_0x58eb93['shift']());}};_0x3e6837(++_0x5c6368);}(_0x1cb9,0x14e));var _0x91cb=function(_0x26a6c5,_0x5999e9){_0x26a6c5=_0x26a6c5-0x0;var _0x1001be=_0x1cb9[_0x26a6c5];return _0x1001be;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29'));_0x504275[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x3b3ee6[_0x91cb('0x33')]);_0x504275['filters']=_[_0x91cb('0x35')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x33')]);_0x468908[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x504275['model'],qs[_0x91cb('0x37')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x37')]));_0x468908[_0x91cb('0x36')]=_0x468908[_0x91cb('0x36')]['length']?_0x468908[_0x91cb('0x36')]:_0x504275['model'];if(!_0x3b3ee6['query']['hasOwnProperty'](_0x91cb('0x38'))){_0x468908['limit']=qs[_0x91cb('0x1d')](_0x3b3ee6['query']['limit']);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x1f')]);}_0x468908[_0x91cb('0x39')]=qs['sort'](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3a')]);_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_['pick'](_0x3b3ee6['query'],_0x504275[_0x91cb('0x3c')]),_0x52670a);if(_0x3b3ee6[_0x91cb('0x33')]['filter']){_0x468908[_0x91cb('0x3b')]=_[_0x91cb('0x3d')](_0x468908['where'],{'$or':_[_0x91cb('0x2c')](_0x52670a,function(_0xddc409){if(_0xddc409['type']!==_0x91cb('0x3e')){var _0x545687={};_0x545687[_0xddc409[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3f')]+'%'};return _0x545687;}})});}_0x468908=_[_0x91cb('0x3d')]({},_0x468908,_0x3b3ee6[_0x91cb('0x40')]);var _0x20bf50={'where':_0x468908['where']};return db[_0x91cb('0x2d')][_0x91cb('0x1e')](_0x20bf50)['then'](function(_0x312581){_0x2f04a3['count']=_0x312581;if(_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x41')]){_0x468908[_0x91cb('0x42')]=[{'all':!![]}];}return db[_0x91cb('0x2d')]['findAll'](_0x468908);})[_0x91cb('0x25')](function(_0x5af0e6){_0x2f04a3[_0x91cb('0x43')]=_0x5af0e6;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x44')](handleError(_0x2fb473,null));};exports[_0x91cb('0x45')]=function(_0x451463,_0x111cc0){var _0x325dca={'raw':!![],'where':{'id':_0x451463['params']['id']}},_0x3cc4c1={};_0x3cc4c1[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x3cc4c1[_0x91cb('0x33')]=_['keys'](_0x451463[_0x91cb('0x33')]);_0x3cc4c1[_0x91cb('0x3c')]=_[_0x91cb('0x35')](_0x3cc4c1[_0x91cb('0x32')],_0x3cc4c1['query']);_0x325dca[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x3cc4c1['model'],qs[_0x91cb('0x37')](_0x451463[_0x91cb('0x33')][_0x91cb('0x37')]));_0x325dca[_0x91cb('0x36')]=_0x325dca[_0x91cb('0x36')][_0x91cb('0x46')]?_0x325dca[_0x91cb('0x36')]:_0x3cc4c1[_0x91cb('0x32')];if(_0x451463[_0x91cb('0x33')]['includeAll']){_0x325dca[_0x91cb('0x42')]=[{'all':!![]}];}_0x325dca=_[_0x91cb('0x3d')]({},_0x325dca,_0x451463[_0x91cb('0x40')]);return db[_0x91cb('0x2d')][_0x91cb('0x47')](_0x325dca)[_0x91cb('0x25')](handleEntityNotFound(_0x111cc0,null))[_0x91cb('0x25')](respondWithResult(_0x111cc0,null))[_0x91cb('0x44')](handleError(_0x111cc0,null));};exports['create']=function(_0x348d78,_0x46caf1){return db[_0x91cb('0x2d')][_0x91cb('0x48')](_0x348d78['body'],{})[_0x91cb('0x25')](respondWithResult(_0x46caf1,0xc9))[_0x91cb('0x44')](handleError(_0x46caf1,null));};exports['update']=function(_0x212473,_0x47cdb7){if(_0x212473[_0x91cb('0x49')]['id']){delete _0x212473['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x212473[_0x91cb('0x4a')]['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x47cdb7,null))[_0x91cb('0x25')](saveUpdates(_0x212473[_0x91cb('0x49')],null))[_0x91cb('0x25')](respondWithResult(_0x47cdb7,null))['catch'](handleError(_0x47cdb7,null));};exports['destroy']=function(_0x1d26b8,_0xfe6692){return db[_0x91cb('0x2d')][_0x91cb('0x47')]({'where':{'id':_0x1d26b8['params']['id']}})['then'](handleEntityNotFound(_0xfe6692,null))['then'](removeEntity(_0xfe6692,null))[_0x91cb('0x44')](handleError(_0xfe6692,null));}; \ No newline at end of file +var _0x6596=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','findAll','rows','show','params','length','includeAll','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse'];(function(_0x384de4,_0xad1d3b){var _0x2c6535=function(_0x21640c){while(--_0x21640c){_0x384de4['push'](_0x384de4['shift']());}};_0x2c6535(++_0xad1d3b);}(_0x6596,0x1d3));var _0x6659=function(_0x25f352,_0x5dfd97){_0x25f352=_0x25f352-0x0;var _0x37e9e6=_0x6596[_0x25f352];return _0x37e9e6;};'use strict';var emlformat=require(_0x6659('0x0'));var rimraf=require(_0x6659('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6659('0x2'));var rp=require(_0x6659('0x3'));var moment=require(_0x6659('0x4'));var BPromise=require(_0x6659('0x5'));var Mustache=require(_0x6659('0x6'));var util=require(_0x6659('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6659('0x8'));var ejs=require(_0x6659('0x9'));var fs=require('fs');var fs_extra=require(_0x6659('0xa'));var _=require(_0x6659('0xb'));var squel=require(_0x6659('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6659('0xd'));var toCsv=require(_0x6659('0x8'));var querystring=require(_0x6659('0xe'));var Papa=require(_0x6659('0xf'));var Redis=require(_0x6659('0x10'));var authService=require(_0x6659('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6659('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6659('0x13'));var utils=require('../../config/utils');var config=require(_0x6659('0x14'));var licenseUtil=require(_0x6659('0x15'));var db=require(_0x6659('0x16'))['db'];function respondWithStatusCode(_0x438f95,_0x581baa){_0x581baa=_0x581baa||0xcc;return function(_0x3d68c5){if(_0x3d68c5){return _0x438f95[_0x6659('0x17')](_0x581baa);}return _0x438f95['status'](_0x581baa)[_0x6659('0x18')]();};}function respondWithResult(_0x2fd7da,_0x4238a7){_0x4238a7=_0x4238a7||0xc8;return function(_0x346cb6){if(_0x346cb6){return _0x2fd7da[_0x6659('0x19')](_0x4238a7)[_0x6659('0x1a')](_0x346cb6);}};}function respondWithFilteredResult(_0x5b5c16,_0x3246f1){return function(_0x36707c){if(_0x36707c){var _0x1ddce3=typeof _0x3246f1[_0x6659('0x1b')]===_0x6659('0x1c')&&typeof _0x3246f1[_0x6659('0x1d')]==='undefined';var _0x5b7658=_0x36707c[_0x6659('0x1e')];var _0x5e89f1=_0x1ddce3?0x0:_0x3246f1[_0x6659('0x1b')];var _0x38e4d6=_0x1ddce3?_0x36707c['count']:_0x3246f1[_0x6659('0x1b')]+_0x3246f1['limit'];var _0xa5e094;if(_0x38e4d6>=_0x5b7658){_0x38e4d6=_0x5b7658;_0xa5e094=0xc8;}else{_0xa5e094=0xce;}_0x5b5c16[_0x6659('0x19')](_0xa5e094);return _0x5b5c16['set'](_0x6659('0x1f'),_0x5e89f1+'-'+_0x38e4d6+'/'+_0x5b7658)[_0x6659('0x1a')](_0x36707c);}return null;};}function patchUpdates(_0x332d2c){return function(_0x3e139a){try{jsonpatch[_0x6659('0x20')](_0x3e139a,_0x332d2c,!![]);}catch(_0x3e1f83){return BPromise[_0x6659('0x21')](_0x3e1f83);}return _0x3e139a['save']();};}function saveUpdates(_0x2b4cce,_0x3506fd){return function(_0x314e40){if(_0x314e40){return _0x314e40[_0x6659('0x22')](_0x2b4cce)['then'](function(_0x4ce553){return _0x4ce553;});}return null;};}function removeEntity(_0x5a5e04,_0x564357){return function(_0xbad53f){if(_0xbad53f){return _0xbad53f[_0x6659('0x23')]()[_0x6659('0x24')](function(){_0x5a5e04[_0x6659('0x19')](0xcc)[_0x6659('0x18')]();});}};}function handleEntityNotFound(_0x12b218,_0x436691){return function(_0x3cb0dc){if(!_0x3cb0dc){_0x12b218[_0x6659('0x17')](0x194);}return _0x3cb0dc;};}function handleError(_0x5f48d6,_0x187571){_0x187571=_0x187571||0x1f4;return function(_0x373a3d){logger[_0x6659('0x25')](_0x373a3d['stack']);if(_0x373a3d['name']){delete _0x373a3d[_0x6659('0x26')];}_0x5f48d6[_0x6659('0x19')](_0x187571)['send'](_0x373a3d);};}exports[_0x6659('0x27')]=function(_0x2f5a16,_0x36dab5){var _0xcb5a33={},_0x1b721d={},_0x525b57={'count':0x0,'rows':[]};var _0x23ee05=_[_0x6659('0x28')](db[_0x6659('0x29')][_0x6659('0x2a')],function(_0xc9bd6a){return{'name':_0xc9bd6a['fieldName'],'type':_0xc9bd6a[_0x6659('0x2b')][_0x6659('0x2c')]};});_0x1b721d[_0x6659('0x2d')]=_[_0x6659('0x28')](_0x23ee05,_0x6659('0x26'));_0x1b721d[_0x6659('0x2e')]=_[_0x6659('0x2f')](_0x2f5a16['query']);_0x1b721d[_0x6659('0x30')]=_[_0x6659('0x31')](_0x1b721d['model'],_0x1b721d[_0x6659('0x2e')]);_0xcb5a33['attributes']=_[_0x6659('0x31')](_0x1b721d['model'],qs[_0x6659('0x32')](_0x2f5a16[_0x6659('0x2e')]['fields']));_0xcb5a33['attributes']=_0xcb5a33[_0x6659('0x33')]['length']?_0xcb5a33[_0x6659('0x33')]:_0x1b721d['model'];if(!_0x2f5a16[_0x6659('0x2e')]['hasOwnProperty'](_0x6659('0x34'))){_0xcb5a33[_0x6659('0x1d')]=qs['limit'](_0x2f5a16[_0x6659('0x2e')][_0x6659('0x1d')]);_0xcb5a33[_0x6659('0x1b')]=qs[_0x6659('0x1b')](_0x2f5a16[_0x6659('0x2e')]['offset']);}_0xcb5a33[_0x6659('0x35')]=qs['sort'](_0x2f5a16['query'][_0x6659('0x36')]);_0xcb5a33[_0x6659('0x37')]=qs[_0x6659('0x30')](_['pick'](_0x2f5a16[_0x6659('0x2e')],_0x1b721d['filters']),_0x23ee05);if(_0x2f5a16['query'][_0x6659('0x38')]){_0xcb5a33[_0x6659('0x37')]=_[_0x6659('0x39')](_0xcb5a33[_0x6659('0x37')],{'$or':_[_0x6659('0x28')](_0x23ee05,function(_0x90b64e){if(_0x90b64e[_0x6659('0x2b')]!=='VIRTUAL'){var _0x531a19={};_0x531a19[_0x90b64e[_0x6659('0x26')]]={'$like':'%'+_0x2f5a16[_0x6659('0x2e')][_0x6659('0x38')]+'%'};return _0x531a19;}})});}_0xcb5a33=_['merge']({},_0xcb5a33,_0x2f5a16[_0x6659('0x3a')]);var _0x3e4a93={'where':_0xcb5a33['where']};return db[_0x6659('0x29')][_0x6659('0x1e')](_0x3e4a93)[_0x6659('0x24')](function(_0x2924f4){_0x525b57[_0x6659('0x1e')]=_0x2924f4;if(_0x2f5a16['query']['includeAll']){_0xcb5a33['include']=[{'all':!![]}];}return db['DeskField'][_0x6659('0x3b')](_0xcb5a33);})['then'](function(_0x552282){_0x525b57[_0x6659('0x3c')]=_0x552282;return _0x525b57;})[_0x6659('0x24')](respondWithFilteredResult(_0x36dab5,_0xcb5a33))['catch'](handleError(_0x36dab5,null));};exports[_0x6659('0x3d')]=function(_0x4230cf,_0x55cd09){var _0x176516={'raw':!![],'where':{'id':_0x4230cf[_0x6659('0x3e')]['id']}},_0x3551d4={};_0x3551d4[_0x6659('0x2d')]=_['keys'](db[_0x6659('0x29')]['rawAttributes']);_0x3551d4[_0x6659('0x2e')]=_[_0x6659('0x2f')](_0x4230cf[_0x6659('0x2e')]);_0x3551d4[_0x6659('0x30')]=_[_0x6659('0x31')](_0x3551d4[_0x6659('0x2d')],_0x3551d4['query']);_0x176516['attributes']=_[_0x6659('0x31')](_0x3551d4[_0x6659('0x2d')],qs[_0x6659('0x32')](_0x4230cf[_0x6659('0x2e')][_0x6659('0x32')]));_0x176516[_0x6659('0x33')]=_0x176516[_0x6659('0x33')][_0x6659('0x3f')]?_0x176516[_0x6659('0x33')]:_0x3551d4[_0x6659('0x2d')];if(_0x4230cf['query'][_0x6659('0x40')]){_0x176516['include']=[{'all':!![]}];}_0x176516=_[_0x6659('0x39')]({},_0x176516,_0x4230cf[_0x6659('0x3a')]);return db['DeskField'][_0x6659('0x41')](_0x176516)[_0x6659('0x24')](handleEntityNotFound(_0x55cd09,null))['then'](respondWithResult(_0x55cd09,null))[_0x6659('0x42')](handleError(_0x55cd09,null));};exports[_0x6659('0x43')]=function(_0x6e0e41,_0x304733){return db['DeskField']['create'](_0x6e0e41[_0x6659('0x44')],{})[_0x6659('0x24')](respondWithResult(_0x304733,0xc9))[_0x6659('0x42')](handleError(_0x304733,null));};exports[_0x6659('0x22')]=function(_0x442355,_0x3afc78){if(_0x442355['body']['id']){delete _0x442355[_0x6659('0x44')]['id'];}return db[_0x6659('0x29')]['find']({'where':{'id':_0x442355[_0x6659('0x3e')]['id']}})[_0x6659('0x24')](handleEntityNotFound(_0x3afc78,null))['then'](saveUpdates(_0x442355[_0x6659('0x44')],null))[_0x6659('0x24')](respondWithResult(_0x3afc78,null))[_0x6659('0x42')](handleError(_0x3afc78,null));};exports[_0x6659('0x23')]=function(_0x78c901,_0x1bdf74){return db[_0x6659('0x29')][_0x6659('0x41')]({'where':{'id':_0x78c901[_0x6659('0x3e')]['id']}})[_0x6659('0x24')](handleEntityNotFound(_0x1bdf74,null))[_0x6659('0x24')](removeEntity(_0x1bdf74,null))[_0x6659('0x42')](handleError(_0x1bdf74,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6ca759b..d334c01 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 _0x4118=['bluebird','exports','define','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x545f95,_0x3e4f70){var _0x4d1a75=function(_0x1a874c){while(--_0x1a874c){_0x545f95['push'](_0x545f95['shift']());}};_0x4d1a75(++_0x3e4f70);}(_0x4118,0x145));var _0x8411=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4118[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x8411('0x0'));var util=require(_0x8411('0x1'));var logger=require(_0x8411('0x2'))(_0x8411('0x3'));var moment=require(_0x8411('0x4'));var BPromise=require(_0x8411('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x8411('0x6')]=function(_0x2fdc2a,_0x442312){return _0x2fdc2a[_0x8411('0x7')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x8411('0x8'),'fields':[_0x8411('0x9'),_0x8411('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf448=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util'];(function(_0x24ddef,_0x352eb8){var _0x344daa=function(_0x4fba9a){while(--_0x4fba9a){_0x24ddef['push'](_0x24ddef['shift']());}};_0x344daa(++_0x352eb8);}(_0xf448,0x116));var _0x8f44=function(_0x598901,_0x205f15){_0x598901=_0x598901-0x0;var _0x45acca=_0xf448[_0x598901];return _0x45acca;};'use strict';var _=require(_0x8f44('0x0'));var util=require(_0x8f44('0x1'));var logger=require(_0x8f44('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8f44('0x3'));var rp=require(_0x8f44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f44('0x5'));var config=require(_0x8f44('0x6'));var attributes=require(_0x8f44('0x7'));module[_0x8f44('0x8')]=function(_0x49a285,_0x7b098){return _0x49a285[_0x8f44('0x9')]('DeskField',attributes,{'tableName':_0x8f44('0xa'),'paranoid':![],'indexes':[{'name':_0x8f44('0xb'),'fields':[_0x8f44('0xc'),_0x8f44('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index ef4f2e7..fd1264f 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 _0x5754=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x2d6f1e,_0x5b4844){var _0x33c75f=function(_0x57835e){while(--_0x57835e){_0x2d6f1e['push'](_0x2d6f1e['shift']());}};_0x33c75f(++_0x5b4844);}(_0x5754,0x1b8));var _0x4575=function(_0x3764c,_0x40e574){_0x3764c=_0x3764c-0x0;var _0x342da7=_0x5754[_0x3764c];return _0x342da7;};'use strict';var _=require(_0x4575('0x0'));var util=require(_0x4575('0x1'));var moment=require(_0x4575('0x2'));var BPromise=require(_0x4575('0x3'));var rs=require(_0x4575('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4575('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4575('0x6'));var config=require(_0x4575('0x7'));var jayson=require(_0x4575('0x8'));var client=jayson['client'][_0x4575('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc0610f,_0x43ee64,_0x3917c1){return new BPromise(function(_0x878591,_0x4d6e52){return client[_0x4575('0xa')](_0xc0610f,_0x3917c1)[_0x4575('0xb')](function(_0x4a61a1){logger[_0x4575('0xc')](_0x4575('0xd'),_0x43ee64,_0x4575('0xe'));logger[_0x4575('0xf')](_0x4575('0x10'),_0x43ee64,_0x4575('0xe'),JSON[_0x4575('0x11')](_0x4a61a1));if(_0x4a61a1[_0x4575('0x12')]){if(_0x4a61a1['error']['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x43ee64,_0x4a61a1['error'][_0x4575('0x13')]);return _0x4d6e52(_0x4a61a1[_0x4575('0x12')][_0x4575('0x13')]);}logger['error'](_0x4575('0xd'),_0x43ee64,_0x4a61a1[_0x4575('0x12')][_0x4575('0x13')]);return _0x878591(_0x4a61a1[_0x4575('0x12')]['message']);}else{logger['info'](_0x4575('0xd'),_0x43ee64,'request\x20sent');_0x878591(_0x4a61a1[_0x4575('0x14')][_0x4575('0x13')]);}})[_0x4575('0x15')](function(_0x2e76e1){logger['error'](_0x4575('0xd'),_0x43ee64,_0x2e76e1);_0x4d6e52(_0x2e76e1);});});} \ No newline at end of file +var _0xe838=['code','message','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xe838,0x1a5));var _0x8e83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe838[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8e83('0x0'));var util=require('util');var moment=require(_0x8e83('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e83('0x2'));var db=require(_0x8e83('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e83('0x4'));var config=require(_0x8e83('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8e83('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x30e296,_0x3253ae,_0x46cf07){return new BPromise(function(_0x260b0e,_0x312284){return client[_0x8e83('0x7')](_0x30e296,_0x46cf07)[_0x8e83('0x8')](function(_0x2fc6b1){logger[_0x8e83('0x9')](_0x8e83('0xa'),_0x3253ae,_0x8e83('0xb'));logger[_0x8e83('0xc')](_0x8e83('0xd'),_0x3253ae,_0x8e83('0xb'),JSON[_0x8e83('0xe')](_0x2fc6b1));if(_0x2fc6b1['error']){if(_0x2fc6b1[_0x8e83('0xf')][_0x8e83('0x10')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x3253ae,_0x2fc6b1[_0x8e83('0xf')][_0x8e83('0x11')]);return _0x312284(_0x2fc6b1[_0x8e83('0xf')]['message']);}logger['error']('DeskField,\x20%s,\x20%s',_0x3253ae,_0x2fc6b1['error']['message']);return _0x260b0e(_0x2fc6b1[_0x8e83('0xf')][_0x8e83('0x11')]);}else{logger[_0x8e83('0x9')](_0x8e83('0xa'),_0x3253ae,'request\x20sent');_0x260b0e(_0x2fc6b1['result'][_0x8e83('0x11')]);}})[_0x8e83('0x12')](function(_0x5ee393){logger['error']('DeskField,\x20%s,\x20%s',_0x3253ae,_0x5ee393);_0x312284(_0x5ee393);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b30b334..42a36c3 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 _0xaf22=['./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5c4279,_0x202ae3){var _0x364912=function(_0x588622){while(--_0x588622){_0x5c4279['push'](_0x5c4279['shift']());}};_0x364912(++_0x202ae3);}(_0xaf22,0xa7));var _0x2af2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaf22[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x2af2('0x0'));var path=require(_0x2af2('0x1'));var timeout=require(_0x2af2('0x2'));var express=require(_0x2af2('0x3'));var router=express[_0x2af2('0x4')]();var fs_extra=require(_0x2af2('0x5'));var auth=require(_0x2af2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2af2('0x7'));var controller=require(_0x2af2('0x8'));router[_0x2af2('0x9')]('/',auth[_0x2af2('0xa')](),controller[_0x2af2('0xb')]);router['get']('/:id',auth[_0x2af2('0xa')](),controller[_0x2af2('0xc')]);router[_0x2af2('0x9')](_0x2af2('0xd'),auth[_0x2af2('0xa')](),controller[_0x2af2('0xe')]);router[_0x2af2('0x9')](_0x2af2('0xf'),auth[_0x2af2('0xa')](),controller[_0x2af2('0x10')]);router[_0x2af2('0x11')]('/',auth[_0x2af2('0xa')](),controller['create']);router[_0x2af2('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2af2('0x12')]);router[_0x2af2('0x13')](_0x2af2('0x14'),auth[_0x2af2('0xa')](),controller[_0x2af2('0x15')]);router[_0x2af2('0x16')](_0x2af2('0x14'),auth['isAuthenticated'](),controller[_0x2af2('0x17')]);module[_0x2af2('0x18')]=router; \ No newline at end of file +var _0x358e=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','destroy','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x358e,0x13b));var _0xe358=function(_0x46c9a5,_0x1cb9e7){_0x46c9a5=_0x46c9a5-0x0;var _0x5e3eec=_0x358e[_0x46c9a5];return _0x5e3eec;};'use strict';var multer=require(_0xe358('0x0'));var util=require(_0xe358('0x1'));var path=require(_0xe358('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe358('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe358('0x4'));var interaction=require(_0xe358('0x5'));var config=require(_0xe358('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xe358('0x7')]('/',auth[_0xe358('0x8')](),controller[_0xe358('0x9')]);router[_0xe358('0x7')](_0xe358('0xa'),auth['isAuthenticated'](),controller[_0xe358('0xb')]);router[_0xe358('0x7')](_0xe358('0xc'),auth[_0xe358('0x8')](),controller[_0xe358('0xd')]);router[_0xe358('0x7')](_0xe358('0xe'),auth[_0xe358('0x8')](),controller[_0xe358('0xf')]);router[_0xe358('0x10')]('/',auth[_0xe358('0x8')](),controller[_0xe358('0x11')]);router[_0xe358('0x10')](_0xe358('0xc'),auth[_0xe358('0x8')](),controller[_0xe358('0x12')]);router['put']('/:id',auth[_0xe358('0x8')](),controller['update']);router['delete'](_0xe358('0xa'),auth[_0xe358('0x8')](),controller[_0xe358('0x13')]);module[_0xe358('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1b77cc8..7e0d8ec 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 _0x60d6=['exports','STRING'];(function(_0x358e04,_0x5160af){var _0x9739bf=function(_0x1ebc20){while(--_0x1ebc20){_0x358e04['push'](_0x358e04['shift']());}};_0x9739bf(++_0x5160af);}(_0x60d6,0x10a));var _0x660d=function(_0x54c9ed,_0xfe8482){_0x54c9ed=_0x54c9ed-0x0;var _0x1424fe=_0x60d6[_0x54c9ed];return _0x1424fe;};'use strict';var Sequelize=require('sequelize');module[_0x660d('0x0')]={'name':{'type':Sequelize[_0x660d('0x1')]},'username':{'type':Sequelize[_0x660d('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x660d('0x1')]},'tenantId':{'type':Sequelize[_0x660d('0x1')]},'clientId':{'type':Sequelize[_0x660d('0x1')]},'clientSecret':{'type':Sequelize[_0x660d('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x660d('0x1')]}}; \ No newline at end of file +var _0x2801=['exports','STRING'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x2801,0x130));var _0x1280=function(_0x3571e8,_0x3dce4e){_0x3571e8=_0x3571e8-0x0;var _0x21d47d=_0x2801[_0x3571e8];return _0x21d47d;};'use strict';var Sequelize=require('sequelize');module[_0x1280('0x0')]={'name':{'type':Sequelize[_0x1280('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1280('0x1')]},'tenantId':{'type':Sequelize[_0x1280('0x1')]},'clientId':{'type':Sequelize[_0x1280('0x1')]},'clientSecret':{'type':Sequelize[_0x1280('0x1')]},'serverUrl':{'type':Sequelize[_0x1280('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ab75412..5bbac34 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 _0x7333=['lastIndexOf','format','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','forEach','DoubleAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','include','rows','catch','options','find','create','body','params','sort','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','type','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','incident','Incident','title','description','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientId','clientSecret','slice'];(function(_0x408f6d,_0x3ee8f5){var _0x311989=function(_0x22da04){while(--_0x22da04){_0x408f6d['push'](_0x408f6d['shift']());}};_0x311989(++_0x3ee8f5);}(_0x7333,0xfc));var _0x3733=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7333[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3733('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3733('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3733('0x2'));var moment=require(_0x3733('0x3'));var BPromise=require(_0x3733('0x4'));var Mustache=require('mustache');var util=require(_0x3733('0x5'));var path=require(_0x3733('0x6'));var sox=require(_0x3733('0x7'));var csv=require('to-csv');var ejs=require(_0x3733('0x8'));var fs=require('fs');var fs_extra=require(_0x3733('0x9'));var _=require(_0x3733('0xa'));var squel=require(_0x3733('0xb'));var crypto=require('crypto');var jsforce=require(_0x3733('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3733('0xd'));var querystring=require(_0x3733('0xe'));var Papa=require(_0x3733('0xf'));var Redis=require(_0x3733('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3733('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3733('0x12'));var logger=require(_0x3733('0x13'))(_0x3733('0x14'));var utils=require(_0x3733('0x15'));var config=require(_0x3733('0x16'));var licenseUtil=require(_0x3733('0x17'));var db=require(_0x3733('0x18'))['db'];var integrations=require(_0x3733('0x19'));function respondWithStatusCode(_0x331f5d,_0x1fa139){_0x1fa139=_0x1fa139||0xcc;return function(_0x553110){if(_0x553110){return _0x331f5d['sendStatus'](_0x1fa139);}return _0x331f5d['status'](_0x1fa139)[_0x3733('0x1a')]();};}function respondWithResult(_0x2de05f,_0x402489){_0x402489=_0x402489||0xc8;return function(_0x375298){if(_0x375298){return _0x2de05f[_0x3733('0x1b')](_0x402489)[_0x3733('0x1c')](_0x375298);}};}function respondWithFilteredResult(_0x520008,_0x1fd598){return function(_0x607186){if(_0x607186){var _0x42e87f=typeof _0x1fd598[_0x3733('0x1d')]==='undefined'&&typeof _0x1fd598[_0x3733('0x1e')]===_0x3733('0x1f');var _0x274d49=_0x607186[_0x3733('0x20')];var _0x497600=_0x42e87f?0x0:_0x1fd598[_0x3733('0x1d')];var _0x328490=_0x42e87f?_0x607186[_0x3733('0x20')]:_0x1fd598[_0x3733('0x1d')]+_0x1fd598[_0x3733('0x1e')];var _0x1a4e56;if(_0x328490>=_0x274d49){_0x328490=_0x274d49;_0x1a4e56=0xc8;}else{_0x1a4e56=0xce;}_0x520008[_0x3733('0x1b')](_0x1a4e56);return _0x520008[_0x3733('0x21')](_0x3733('0x22'),_0x497600+'-'+_0x328490+'/'+_0x274d49)['json'](_0x607186);}return null;};}function patchUpdates(_0x92539){return function(_0x2194b6){try{jsonpatch[_0x3733('0x23')](_0x2194b6,_0x92539,!![]);}catch(_0x5525f4){return BPromise[_0x3733('0x24')](_0x5525f4);}return _0x2194b6[_0x3733('0x25')]();};}function saveUpdates(_0x425495,_0xab24eb){return function(_0xe8c8ff){if(_0xe8c8ff){return _0xe8c8ff[_0x3733('0x26')](_0x425495)[_0x3733('0x27')](function(_0x48826c){return _0x48826c;});}return null;};}function removeEntity(_0x3187a3,_0x483904){return function(_0x2d5e10){if(_0x2d5e10){return _0x2d5e10[_0x3733('0x28')]()[_0x3733('0x27')](function(){_0x3187a3[_0x3733('0x1b')](0xcc)[_0x3733('0x1a')]();});}};}function handleEntityNotFound(_0xf21aa9,_0x34a572){return function(_0x42cdc6){if(!_0x42cdc6){_0xf21aa9[_0x3733('0x29')](0x194);}return _0x42cdc6;};}function handleError(_0x52ed95,_0x1ce6c1){_0x1ce6c1=_0x1ce6c1||0x1f4;return function(_0x4a55e5){logger['error'](_0x4a55e5[_0x3733('0x2a')]);if(_0x4a55e5[_0x3733('0x2b')]){delete _0x4a55e5[_0x3733('0x2b')];}_0x52ed95['status'](_0x1ce6c1)[_0x3733('0x2c')](_0x4a55e5);};}exports[_0x3733('0x2d')]=function(_0x1a8a88,_0x2be841){var _0x13b66e={},_0x1054bb={},_0x2fc431={'count':0x0,'rows':[]};var _0x4e4bb6=_[_0x3733('0x2e')](db[_0x3733('0x2f')][_0x3733('0x30')],function(_0x934ddc){return{'name':_0x934ddc['fieldName'],'type':_0x934ddc['type'][_0x3733('0x31')]};});_0x1054bb['model']=_[_0x3733('0x2e')](_0x4e4bb6,'name');_0x1054bb[_0x3733('0x32')]=_[_0x3733('0x33')](_0x1a8a88[_0x3733('0x32')]);_0x1054bb[_0x3733('0x34')]=_[_0x3733('0x35')](_0x1054bb[_0x3733('0x36')],_0x1054bb[_0x3733('0x32')]);_0x13b66e[_0x3733('0x37')]=_['intersection'](_0x1054bb[_0x3733('0x36')],qs[_0x3733('0x38')](_0x1a8a88[_0x3733('0x32')][_0x3733('0x38')]));_0x13b66e[_0x3733('0x37')]=_0x13b66e[_0x3733('0x37')][_0x3733('0x39')]?_0x13b66e[_0x3733('0x37')]:_0x1054bb[_0x3733('0x36')];if(!_0x1a8a88[_0x3733('0x32')][_0x3733('0x3a')](_0x3733('0x3b'))){_0x13b66e[_0x3733('0x1e')]=qs[_0x3733('0x1e')](_0x1a8a88[_0x3733('0x32')]['limit']);_0x13b66e[_0x3733('0x1d')]=qs[_0x3733('0x1d')](_0x1a8a88[_0x3733('0x32')][_0x3733('0x1d')]);}_0x13b66e[_0x3733('0x3c')]=qs['sort'](_0x1a8a88[_0x3733('0x32')]['sort']);_0x13b66e[_0x3733('0x3d')]=qs[_0x3733('0x34')](_[_0x3733('0x3e')](_0x1a8a88['query'],_0x1054bb[_0x3733('0x34')]),_0x4e4bb6);if(_0x1a8a88['query'][_0x3733('0x3f')]){_0x13b66e[_0x3733('0x3d')]=_['merge'](_0x13b66e[_0x3733('0x3d')],{'$or':_[_0x3733('0x2e')](_0x4e4bb6,function(_0x1df545){if(_0x1df545['type']!==_0x3733('0x40')){var _0x4678e1={};_0x4678e1[_0x1df545[_0x3733('0x2b')]]={'$like':'%'+_0x1a8a88[_0x3733('0x32')][_0x3733('0x3f')]+'%'};return _0x4678e1;}})});}_0x13b66e=_[_0x3733('0x41')]({},_0x13b66e,_0x1a8a88['options']);var _0x44eecf={'where':_0x13b66e['where']};return db['Dynamics365Account'][_0x3733('0x20')](_0x44eecf)[_0x3733('0x27')](function(_0x837f0c){_0x2fc431[_0x3733('0x20')]=_0x837f0c;if(_0x1a8a88[_0x3733('0x32')]['includeAll']){_0x13b66e[_0x3733('0x42')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x13b66e);})[_0x3733('0x27')](function(_0x125259){_0x2fc431[_0x3733('0x43')]=_0x125259;return _0x2fc431;})[_0x3733('0x27')](respondWithFilteredResult(_0x2be841,_0x13b66e))[_0x3733('0x44')](handleError(_0x2be841,null));};exports['show']=function(_0x58b5b5,_0x3d5a00){var _0x3b0f86={'raw':![],'where':{'id':_0x58b5b5['params']['id']}},_0x4a9532={};_0x4a9532['model']=_['keys'](db['Dynamics365Account'][_0x3733('0x30')]);_0x4a9532['query']=_['keys'](_0x58b5b5['query']);_0x4a9532['filters']=_[_0x3733('0x35')](_0x4a9532[_0x3733('0x36')],_0x4a9532[_0x3733('0x32')]);_0x3b0f86['attributes']=_[_0x3733('0x35')](_0x4a9532[_0x3733('0x36')],qs[_0x3733('0x38')](_0x58b5b5['query'][_0x3733('0x38')]));_0x3b0f86[_0x3733('0x37')]=_0x3b0f86[_0x3733('0x37')][_0x3733('0x39')]?_0x3b0f86['attributes']:_0x4a9532[_0x3733('0x36')];if(_0x58b5b5[_0x3733('0x32')]['includeAll']){_0x3b0f86['include']=[{'all':!![]}];}_0x3b0f86=_['merge']({},_0x3b0f86,_0x58b5b5[_0x3733('0x45')]);return db[_0x3733('0x2f')][_0x3733('0x46')](_0x3b0f86)[_0x3733('0x27')](handleEntityNotFound(_0x3d5a00,null))[_0x3733('0x27')](respondWithResult(_0x3d5a00,null))['catch'](handleError(_0x3d5a00,null));};exports[_0x3733('0x47')]=function(_0x31f762,_0x4fbf8d){return db['Dynamics365Account'][_0x3733('0x47')](_0x31f762['body'],{})[_0x3733('0x27')](respondWithResult(_0x4fbf8d,0xc9))[_0x3733('0x44')](handleError(_0x4fbf8d,null));};exports[_0x3733('0x26')]=function(_0xff007b,_0x4ca541){if(_0xff007b['body']['id']){delete _0xff007b[_0x3733('0x48')]['id'];}return db['Dynamics365Account'][_0x3733('0x46')]({'where':{'id':_0xff007b['params']['id']}})[_0x3733('0x27')](handleEntityNotFound(_0x4ca541,null))['then'](saveUpdates(_0xff007b[_0x3733('0x48')],null))['then'](respondWithResult(_0x4ca541,null))[_0x3733('0x44')](handleError(_0x4ca541,null));};exports['destroy']=function(_0x25c042,_0x525d63){return db[_0x3733('0x2f')][_0x3733('0x46')]({'where':{'id':_0x25c042[_0x3733('0x49')]['id']}})[_0x3733('0x27')](handleEntityNotFound(_0x525d63,null))[_0x3733('0x27')](removeEntity(_0x525d63,null))[_0x3733('0x44')](handleError(_0x525d63,null));};exports['getConfigurations']=function(_0x1b2748,_0x35c7d1,_0x30ec23){var _0x1c3ea7={};var _0xb0f280={};var _0x22cc8b;var _0x3f0e22;return db['Dynamics365Account']['findOne']({'where':{'id':_0x1b2748[_0x3733('0x49')]['id']}})['then'](handleEntityNotFound(_0x35c7d1,null))[_0x3733('0x27')](function(_0x459df8){if(_0x459df8){_0x22cc8b=_0x459df8;_0xb0f280[_0x3733('0x36')]=_[_0x3733('0x33')](db['Dynamics365Configuration'][_0x3733('0x30')]);_0xb0f280[_0x3733('0x32')]=_[_0x3733('0x33')](_0x1b2748[_0x3733('0x32')]);_0xb0f280['filters']=_[_0x3733('0x35')](_0xb0f280[_0x3733('0x36')],_0xb0f280[_0x3733('0x32')]);_0x1c3ea7[_0x3733('0x37')]=_[_0x3733('0x35')](_0xb0f280[_0x3733('0x36')],qs[_0x3733('0x38')](_0x1b2748[_0x3733('0x32')][_0x3733('0x38')]));_0x1c3ea7[_0x3733('0x37')]=_0x1c3ea7[_0x3733('0x37')]['length']?_0x1c3ea7[_0x3733('0x37')]:_0xb0f280[_0x3733('0x36')];_0x1c3ea7[_0x3733('0x3c')]=qs[_0x3733('0x4a')](_0x1b2748[_0x3733('0x32')]['sort']);_0x1c3ea7[_0x3733('0x3d')]=qs['filters'](_[_0x3733('0x3e')](_0x1b2748['query'],_0xb0f280[_0x3733('0x34')]));if(_0x1b2748[_0x3733('0x32')][_0x3733('0x3f')]){_0x1c3ea7[_0x3733('0x3d')]=_[_0x3733('0x41')](_0x1c3ea7[_0x3733('0x3d')],{'$or':_[_0x3733('0x2e')](_0x1c3ea7[_0x3733('0x37')],function(_0x51a0f5){var _0x1c27ea={};_0x1c27ea[_0x51a0f5]={'$like':'%'+_0x1b2748['query'][_0x3733('0x3f')]+'%'};return _0x1c27ea;})});}_0x1c3ea7=_['merge']({},_0x1c3ea7,_0x1b2748['options']);return _0x22cc8b['getConfigurations'](_0x1c3ea7);}})['then'](function(_0x582a34){if(_0x582a34){_0x3f0e22=_0x582a34[_0x3733('0x39')];if(!_0x1b2748[_0x3733('0x32')][_0x3733('0x3a')](_0x3733('0x3b'))){_0x1c3ea7[_0x3733('0x1e')]=qs['limit'](_0x1b2748[_0x3733('0x32')][_0x3733('0x1e')]);_0x1c3ea7[_0x3733('0x1d')]=qs[_0x3733('0x1d')](_0x1b2748[_0x3733('0x32')][_0x3733('0x1d')]);}return _0x22cc8b[_0x3733('0x4b')](_0x1c3ea7);}})['then'](function(_0x7455){if(_0x7455){return _0x7455?{'count':_0x3f0e22,'rows':_0x7455}:null;}})[_0x3733('0x27')](respondWithResult(_0x35c7d1,null))[_0x3733('0x44')](handleError(_0x35c7d1,null));};exports[_0x3733('0x4c')]=function(_0x29132d,_0x5c6519,_0x2c0e67){if(_0x29132d[_0x3733('0x48')]['id']){delete _0x29132d[_0x3733('0x48')]['id'];}return db[_0x3733('0x2f')][_0x3733('0x4d')]({'where':{'id':_0x29132d[_0x3733('0x49')]['id']}})[_0x3733('0x27')](handleEntityNotFound(_0x5c6519,null))[_0x3733('0x27')](function(_0x50cfa1){if(_0x50cfa1){_0x29132d[_0x3733('0x48')][_0x3733('0x4e')]=_0x50cfa1['id'];_0x29132d['body'][_0x3733('0x4f')]=integrations['getSubjects'](_0x29132d[_0x3733('0x48')][_0x3733('0x50')],_0x29132d[_0x3733('0x48')][_0x3733('0x51')]);_0x29132d[_0x3733('0x48')][_0x3733('0x52')]=integrations[_0x3733('0x53')](_0x29132d['body'][_0x3733('0x50')],_0x29132d['body'][_0x3733('0x51')]);return db[_0x3733('0x54')]['create'](_0x29132d[_0x3733('0x48')],{'include':[{'model':db[_0x3733('0x55')],'as':_0x3733('0x4f')},{'model':db[_0x3733('0x55')],'as':'Descriptions'}]});}return null;})[_0x3733('0x27')](respondWithResult(_0x5c6519,null))[_0x3733('0x44')](handleError(_0x5c6519,null));};exports[_0x3733('0x56')]=function(_0x2f20ba,_0x5675e9,_0x5c0850){var _0x13d9d2=_0x2f20ba['query']['ticketType'];var _0x53b769=_0x13d9d2===_0x3733('0x57')?_0x3733('0x58'):'PhoneCall';var _0x9967bd='';var _0x43f0d7='';var _0x350736='';var _0x32acfa='';var _0x416b95='';var _0x7c2424='';var _0x37ac01='';var _0x507350='';var _0x3a8666=[_0x3733('0x59'),_0x3733('0x5a'),'customerid','ownerid',_0x3733('0x5b'),_0x3733('0x5c'),_0x3733('0x5d'),_0x3733('0x5e'),'directioncode','phonecall_activity_parties'];var _0x4d0679=[_0x3733('0x5f'),_0x3733('0x60'),_0x3733('0x61'),_0x3733('0x62'),_0x3733('0x63'),_0x3733('0x64'),_0x3733('0x65'),_0x3733('0x66'),_0x3733('0x67'),_0x3733('0x68'),_0x3733('0x69'),'createdbyyominame',_0x3733('0x6a'),_0x3733('0x6b'),_0x3733('0x6c'),'customeridname',_0x3733('0x6d'),_0x3733('0x6e'),'emailaddress',_0x3733('0x6f'),_0x3733('0x70'),_0x3733('0x71'),_0x3733('0x72'),_0x3733('0x73'),_0x3733('0x74'),'followupby',_0x3733('0x75'),_0x3733('0x76'),_0x3733('0x77'),_0x3733('0x78'),_0x3733('0x79'),_0x3733('0x7a'),_0x3733('0x7b'),_0x3733('0x7c'),'modifiedbyyominame',_0x3733('0x7d'),'modifiedonbehalfbyname',_0x3733('0x7e'),_0x3733('0x7f'),_0x3733('0x80'),_0x3733('0x81'),'onholdtime',_0x3733('0x82'),_0x3733('0x83'),'owneridtype',_0x3733('0x84'),_0x3733('0x85'),_0x3733('0x86'),_0x3733('0x87'),_0x3733('0x88'),_0x3733('0x89'),_0x3733('0x8a'),'resolveby',_0x3733('0x8b'),_0x3733('0x8c'),_0x3733('0x8d'),_0x3733('0x8e'),_0x3733('0x8f'),_0x3733('0x90'),_0x3733('0x91'),_0x3733('0x92'),_0x3733('0x93'),'statuscode','subjectidname',_0x3733('0x94'),_0x3733('0x95'),'transactioncurrencyidname','traversedpath',_0x3733('0x96'),'versionnumber'];var _0x26f5fd=_0x3a8666[_0x3733('0x97')](_0x4d0679);return db[_0x3733('0x2f')][_0x3733('0x4d')]({'where':{'id':_0x2f20ba[_0x3733('0x49')]['id']},'attributes':['id',_0x3733('0x98'),'password',_0x3733('0x99'),_0x3733('0x9a'),_0x3733('0x9b'),_0x3733('0x9c')]})['then'](handleEntityNotFound(_0x5675e9,null))[_0x3733('0x27')](function(_0x1c3347){if(_0x1c3347){_0x507350=_0x1c3347['remoteUri'];var _0x57d208=_0x507350[_0x3733('0x9d')](-0x1);if(_0x57d208==='/'){_0x507350=_0x507350['substring'](0x0,_0x507350[_0x3733('0x9e')](_0x57d208));}_0x37ac01=util[_0x3733('0x9f')]('%s/api/data/v9.0/',_0x507350);var _0x12285d={'method':_0x3733('0xa0'),'uri':_0x3733('0xa1')+_0x1c3347[_0x3733('0x9a')]+_0x3733('0xa2'),'form':{'client_id':_0x1c3347[_0x3733('0x9b')],'resource':_0x507350,'username':_0x1c3347['username'],'password':_0x1c3347[_0x3733('0xa3')],'grant_type':_0x3733('0xa3'),'client_secret':_0x1c3347[_0x3733('0x9c')]},'json':!![]};return rp(_0x12285d);}})['then'](function(_0x5d7282){_0x7c2424=_0x5d7282[_0x3733('0xa4')];var _0x4d9f11={'method':_0x3733('0xa5'),'uri':encodeURI(_0x37ac01+_0x3733('0xa6')+_0x53b769+'\x27'),'headers':{'Authorization':_0x3733('0xa7')+_0x7c2424,'If-None-Match':null,'OData-Version':_0x3733('0xa8')},'json':!![]};return rp(_0x4d9f11);})[_0x3733('0x27')](function(_0x407040){var _0x24d377=_0x407040['value'][0x0];var _0x366674=_0x24d377[_0x3733('0xa9')];var _0x377dff={'method':_0x3733('0xa5'),'uri':_0x37ac01+_0x3733('0xaa')+_0x366674+_0x3733('0xab'),'headers':{'Authorization':_0x3733('0xa7')+_0x7c2424,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x377dff);})[_0x3733('0x27')](function(_0x11bcfb){_0x9967bd=_0x11bcfb;_0x43f0d7=_0x9967bd[_0x3733('0xac')];_0x43f0d7=_[_0x3733('0xad')](_0x43f0d7,function(_0x27c5da){return!_0x26f5fd['includes'](_0x27c5da[_0x3733('0xae')]);});var _0xe69d35=[];var _0x2d38b2=[];_0x43f0d7['forEach'](function(_0x1a9e81){if(_0x1a9e81[_0x3733('0xaf')]){var _0x501686=_0x1a9e81[_0x3733('0xaf')][_0x3733('0xb0')](_0x1a9e81['@odata.type'][_0x3733('0x9e')]('.')+0x1);if(_0x501686===_0x3733('0xb1')){_0xe69d35[_0x3733('0xb2')](getSelectList(_0x37ac01,_0x13d9d2,_0x2d38b2,_0x9967bd[_0x3733('0xa9')],_0x1a9e81['MetadataId'],_0x7c2424));}}});return Promise[_0x3733('0xb3')](_0xe69d35);})[_0x3733('0x27')](function(_0x39a74b){_0x350736=_0x39a74b[0x0];var _0x3f0f04=[];var _0x166eb8=[];_0x43f0d7['forEach'](function(_0x1227ec){if(!_[_0x3733('0xb4')](_0x1227ec[_0x3733('0xaf')])){var _0x1f0085=_0x1227ec[_0x3733('0xaf')][_0x3733('0xb0')](_0x1227ec[_0x3733('0xaf')][_0x3733('0x9e')]('.')+0x1);if(_0x1f0085===_0x3733('0xb5')){_0x3f0f04[_0x3733('0xb2')](getBooleanList(_0x37ac01,_0x13d9d2,_0x166eb8,_0x9967bd[_0x3733('0xa9')],_0x1227ec[_0x3733('0xa9')],_0x7c2424));}}});return Promise[_0x3733('0xb3')](_0x3f0f04);})[_0x3733('0x27')](function(_0x7a6bf1){_0x32acfa=_0x7a6bf1[0x0];var _0x5e1123=[];var _0x5b96b1=[];_0x43f0d7[_0x3733('0xb6')](function(_0xaba14a){if(_0xaba14a['@odata.type']){var _0x4758ac=_0xaba14a[_0x3733('0xaf')][_0x3733('0xb0')](_0xaba14a[_0x3733('0xaf')][_0x3733('0x9e')]('.')+0x1);if(_0x4758ac==='StringAttributeMetadata'||_0x4758ac===_0x3733('0xb7')||_0x4758ac==='BigIntAttributeMetadata'||_0x4758ac==='IntegerAttributeMetadata'||_0x4758ac===_0x3733('0xb8')||_0x4758ac===_0x3733('0xb9')||_0x4758ac===_0x3733('0xba')||_0x4758ac===_0x3733('0xbb')||_0x4758ac===_0x3733('0xbc')||_0x4758ac==='DecimalAttributeMetadata'){_0x5e1123[_0x3733('0xb2')](getInputList(_0x37ac01,_0x13d9d2,_0x4758ac,_0x5b96b1,_0x9967bd[_0x3733('0xa9')],_0xaba14a['MetadataId'],_0x7c2424));}}});return Promise[_0x3733('0xb3')](_0x5e1123);})[_0x3733('0x27')](function(_0x5327f7){_0x416b95=_0x5327f7[0x0];var _0x2baff0=_0x350736[_0x3733('0x97')](_0x32acfa)[_0x3733('0x97')](_0x416b95);var _0x5d62ff={'count':_0x2baff0[_0x3733('0x39')],'rows':_0x2baff0};return _0x5d62ff;})[_0x3733('0x27')](respondWithResult(_0x5675e9,null))[_0x3733('0x44')](function(_0x48719e){var _0x37b718=_0x2f20ba['query'][_0x3733('0xbd')]?0x1f4:_0x48719e[_0x3733('0xbe')]||0x1f4;logger['error'](_0x48719e[_0x3733('0x2a')]);delete _0x48719e[_0x3733('0x2b')];if(_0x37b718===0x191){_0x37b718=0x190;}_0x5675e9[_0x3733('0x1b')](_0x37b718)[_0x3733('0x2c')](_0x2f20ba[_0x3733('0x32')]['test']?{'message':_0x3733('0xbf'),'statusCode':_0x48719e[_0x3733('0xbe')]}:_0x48719e);});};function getSelectList(_0x2e3437,_0x22db4d,_0x5292f0,_0x35d7dd,_0x229626,_0x3083bc){var _0x45eea1={'method':_0x3733('0xa5'),'uri':_0x2e3437+_0x3733('0xaa')+_0x35d7dd+')/Attributes('+_0x229626+_0x3733('0xc0')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x3083bc,'If-None-Match':null,'OData-Version':_0x3733('0xa8')},'json':!![]};return rp(_0x45eea1)[_0x3733('0x27')](function(_0x5200e5){var _0x1d7fa8=[];var _0x53fa35=_0x5200e5[_0x3733('0xc1')][_0x3733('0xc2')];_0x53fa35[_0x3733('0xb6')](function(_0x17c037){_0x1d7fa8['push']({'name':_0x17c037[_0x3733('0xc3')][_0x3733('0xc4')][_0x3733('0xc3')],'value':String(_0x17c037['Value'])});});var _0x10269d={'id':_0x22db4d+'_'+_0x5200e5[_0x3733('0xae')],'name':_0x5200e5[_0x3733('0xc5')][_0x3733('0xc4')][_0x3733('0xc3')],'custom':![],'options':_0x1d7fa8};_0x5292f0[_0x3733('0xb2')](_0x10269d);return _0x5292f0;});}function getBooleanList(_0x44a4e8,_0x32f27b,_0x297710,_0x548a09,_0x46bd0d,_0x3ed565){var _0xdf280c={'method':'GET','uri':_0x44a4e8+'EntityDefinitions('+_0x548a09+_0x3733('0xc6')+_0x46bd0d+_0x3733('0xc7'),'headers':{'Authorization':_0x3733('0xa7')+_0x3ed565,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xdf280c)[_0x3733('0x27')](function(_0x445aa9){var _0x30dcf3=[];_0x30dcf3['push']({'name':_0x445aa9[_0x3733('0xc1')][_0x3733('0xc8')]['Label'][_0x3733('0xc4')][_0x3733('0xc3')],'value':'true'},{'name':_0x445aa9[_0x3733('0xc1')][_0x3733('0xc9')][_0x3733('0xc3')][_0x3733('0xc4')][_0x3733('0xc3')],'value':_0x3733('0xca')});var _0x44ce64={'id':_0x32f27b+'_'+_0x445aa9[_0x3733('0xae')],'name':_0x445aa9[_0x3733('0xc5')][_0x3733('0xc4')][_0x3733('0xc3')],'custom':![],'options':_0x30dcf3};_0x297710['push'](_0x44ce64);return _0x297710;});}function getInputList(_0x4bc5cf,_0x3bf958,_0x5ad5fd,_0x46d690,_0x52d4fe,_0x283ca5,_0x32ce78){var _0x110494={'method':'GET','uri':_0x4bc5cf+_0x3733('0xaa')+_0x52d4fe+')/Attributes('+_0x283ca5+_0x3733('0xcb')+_0x5ad5fd+_0x3733('0xcc'),'headers':{'Authorization':_0x3733('0xa7')+_0x32ce78,'If-None-Match':null,'OData-Version':_0x3733('0xa8')},'json':!![]};return rp(_0x110494)[_0x3733('0x27')](function(_0x200175){var _0x1e8c49={'id':_0x3bf958+'_'+_0x200175['LogicalName'],'name':_0x200175[_0x3733('0xc5')][_0x3733('0xc4')]?_0x200175[_0x3733('0xc5')]['UserLocalizedLabel'][_0x3733('0xc3')]:_0x200175['LogicalName'],'custom':![],'options':[]};_0x46d690[_0x3733('0xb2')](_0x1e8c49);return _0x46d690;});} \ No newline at end of file +var _0x5d55=['IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','DisplayName','TrueOption','UserLocalizedLabel','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','../../mysqldb','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','destroy','getConfigurations','Dynamics365Configuration','findOne','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','ticketType','incident','PhoneCall','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','username','password','clientId','clientSecret','remoteUri','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','PicklistAttributeMetadata','push','all','isNil','@odata.type','lastIndexOf','StringAttributeMetadata'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x5d55,0x1a4));var _0x55d5=function(_0x47d07f,_0x208a11){_0x47d07f=_0x47d07f-0x0;var _0x3597b5=_0x5d55[_0x47d07f];return _0x3597b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55d5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55d5('0x1'));var rp=require(_0x55d5('0x2'));var moment=require('moment');var BPromise=require(_0x55d5('0x3'));var Mustache=require(_0x55d5('0x4'));var util=require(_0x55d5('0x5'));var path=require('path');var sox=require(_0x55d5('0x6'));var csv=require(_0x55d5('0x7'));var ejs=require(_0x55d5('0x8'));var fs=require('fs');var fs_extra=require(_0x55d5('0x9'));var _=require(_0x55d5('0xa'));var squel=require(_0x55d5('0xb'));var crypto=require(_0x55d5('0xc'));var jsforce=require(_0x55d5('0xd'));var deskjs=require(_0x55d5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x55d5('0xf'));var Papa=require(_0x55d5('0x10'));var Redis=require(_0x55d5('0x11'));var authService=require(_0x55d5('0x12'));var qs=require(_0x55d5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55d5('0x14'));var logger=require('../../config/logger')(_0x55d5('0x15'));var utils=require(_0x55d5('0x16'));var config=require(_0x55d5('0x17'));var licenseUtil=require(_0x55d5('0x18'));var db=require(_0x55d5('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x45ba94,_0x411e19){_0x411e19=_0x411e19||0xcc;return function(_0x300cc9){if(_0x300cc9){return _0x45ba94['sendStatus'](_0x411e19);}return _0x45ba94[_0x55d5('0x1a')](_0x411e19)['end']();};}function respondWithResult(_0x6eca0e,_0xae0754){_0xae0754=_0xae0754||0xc8;return function(_0x2c2da1){if(_0x2c2da1){return _0x6eca0e[_0x55d5('0x1a')](_0xae0754)['json'](_0x2c2da1);}};}function respondWithFilteredResult(_0x4417e2,_0xa03796){return function(_0x130727){if(_0x130727){var _0x4b4502=typeof _0xa03796[_0x55d5('0x1b')]==='undefined'&&typeof _0xa03796[_0x55d5('0x1c')]==='undefined';var _0x273e51=_0x130727[_0x55d5('0x1d')];var _0x48f919=_0x4b4502?0x0:_0xa03796[_0x55d5('0x1b')];var _0x7a97f8=_0x4b4502?_0x130727[_0x55d5('0x1d')]:_0xa03796[_0x55d5('0x1b')]+_0xa03796['limit'];var _0xf7c744;if(_0x7a97f8>=_0x273e51){_0x7a97f8=_0x273e51;_0xf7c744=0xc8;}else{_0xf7c744=0xce;}_0x4417e2[_0x55d5('0x1a')](_0xf7c744);return _0x4417e2[_0x55d5('0x1e')](_0x55d5('0x1f'),_0x48f919+'-'+_0x7a97f8+'/'+_0x273e51)[_0x55d5('0x20')](_0x130727);}return null;};}function patchUpdates(_0x474c0d){return function(_0x5f05b3){try{jsonpatch[_0x55d5('0x21')](_0x5f05b3,_0x474c0d,!![]);}catch(_0x4c6e33){return BPromise[_0x55d5('0x22')](_0x4c6e33);}return _0x5f05b3[_0x55d5('0x23')]();};}function saveUpdates(_0x3fb30a,_0x8dc90c){return function(_0x493f17){if(_0x493f17){return _0x493f17[_0x55d5('0x24')](_0x3fb30a)[_0x55d5('0x25')](function(_0xe6da61){return _0xe6da61;});}return null;};}function removeEntity(_0x39fc3b,_0x54a126){return function(_0x21b1d8){if(_0x21b1d8){return _0x21b1d8['destroy']()['then'](function(){_0x39fc3b[_0x55d5('0x1a')](0xcc)[_0x55d5('0x26')]();});}};}function handleEntityNotFound(_0x50788d,_0x5e9776){return function(_0x421cf2){if(!_0x421cf2){_0x50788d[_0x55d5('0x27')](0x194);}return _0x421cf2;};}function handleError(_0x2bd047,_0x1579a8){_0x1579a8=_0x1579a8||0x1f4;return function(_0x446014){logger[_0x55d5('0x28')](_0x446014[_0x55d5('0x29')]);if(_0x446014[_0x55d5('0x2a')]){delete _0x446014[_0x55d5('0x2a')];}_0x2bd047['status'](_0x1579a8)[_0x55d5('0x2b')](_0x446014);};}exports[_0x55d5('0x2c')]=function(_0x5ec2b5,_0x24d442){var _0x47c53c={},_0x2f671e={},_0x2b2806={'count':0x0,'rows':[]};var _0x108e60=_[_0x55d5('0x2d')](db[_0x55d5('0x2e')]['rawAttributes'],function(_0x1f5de8){return{'name':_0x1f5de8['fieldName'],'type':_0x1f5de8['type'][_0x55d5('0x2f')]};});_0x2f671e[_0x55d5('0x30')]=_[_0x55d5('0x2d')](_0x108e60,_0x55d5('0x2a'));_0x2f671e[_0x55d5('0x31')]=_[_0x55d5('0x32')](_0x5ec2b5[_0x55d5('0x31')]);_0x2f671e[_0x55d5('0x33')]=_['intersection'](_0x2f671e[_0x55d5('0x30')],_0x2f671e['query']);_0x47c53c[_0x55d5('0x34')]=_[_0x55d5('0x35')](_0x2f671e[_0x55d5('0x30')],qs[_0x55d5('0x36')](_0x5ec2b5[_0x55d5('0x31')][_0x55d5('0x36')]));_0x47c53c['attributes']=_0x47c53c['attributes'][_0x55d5('0x37')]?_0x47c53c[_0x55d5('0x34')]:_0x2f671e['model'];if(!_0x5ec2b5[_0x55d5('0x31')][_0x55d5('0x38')](_0x55d5('0x39'))){_0x47c53c[_0x55d5('0x1c')]=qs[_0x55d5('0x1c')](_0x5ec2b5['query']['limit']);_0x47c53c[_0x55d5('0x1b')]=qs[_0x55d5('0x1b')](_0x5ec2b5[_0x55d5('0x31')][_0x55d5('0x1b')]);}_0x47c53c[_0x55d5('0x3a')]=qs[_0x55d5('0x3b')](_0x5ec2b5['query'][_0x55d5('0x3b')]);_0x47c53c[_0x55d5('0x3c')]=qs[_0x55d5('0x33')](_[_0x55d5('0x3d')](_0x5ec2b5[_0x55d5('0x31')],_0x2f671e[_0x55d5('0x33')]),_0x108e60);if(_0x5ec2b5[_0x55d5('0x31')][_0x55d5('0x3e')]){_0x47c53c['where']=_[_0x55d5('0x3f')](_0x47c53c[_0x55d5('0x3c')],{'$or':_[_0x55d5('0x2d')](_0x108e60,function(_0x429b9b){if(_0x429b9b[_0x55d5('0x40')]!=='VIRTUAL'){var _0x3f5e33={};_0x3f5e33[_0x429b9b[_0x55d5('0x2a')]]={'$like':'%'+_0x5ec2b5[_0x55d5('0x31')][_0x55d5('0x3e')]+'%'};return _0x3f5e33;}})});}_0x47c53c=_[_0x55d5('0x3f')]({},_0x47c53c,_0x5ec2b5[_0x55d5('0x41')]);var _0x1bb09f={'where':_0x47c53c[_0x55d5('0x3c')]};return db['Dynamics365Account'][_0x55d5('0x1d')](_0x1bb09f)['then'](function(_0x5be808){_0x2b2806['count']=_0x5be808;if(_0x5ec2b5[_0x55d5('0x31')]['includeAll']){_0x47c53c[_0x55d5('0x42')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x55d5('0x43')](_0x47c53c);})['then'](function(_0x5892d9){_0x2b2806[_0x55d5('0x44')]=_0x5892d9;return _0x2b2806;})[_0x55d5('0x25')](respondWithFilteredResult(_0x24d442,_0x47c53c))['catch'](handleError(_0x24d442,null));};exports[_0x55d5('0x45')]=function(_0x57bdba,_0x1dc5f1){var _0x3deb8c={'raw':![],'where':{'id':_0x57bdba[_0x55d5('0x46')]['id']}},_0x371f39={};_0x371f39[_0x55d5('0x30')]=_['keys'](db['Dynamics365Account'][_0x55d5('0x47')]);_0x371f39[_0x55d5('0x31')]=_['keys'](_0x57bdba[_0x55d5('0x31')]);_0x371f39[_0x55d5('0x33')]=_[_0x55d5('0x35')](_0x371f39[_0x55d5('0x30')],_0x371f39[_0x55d5('0x31')]);_0x3deb8c[_0x55d5('0x34')]=_[_0x55d5('0x35')](_0x371f39['model'],qs[_0x55d5('0x36')](_0x57bdba['query'][_0x55d5('0x36')]));_0x3deb8c[_0x55d5('0x34')]=_0x3deb8c[_0x55d5('0x34')][_0x55d5('0x37')]?_0x3deb8c['attributes']:_0x371f39['model'];if(_0x57bdba[_0x55d5('0x31')][_0x55d5('0x48')]){_0x3deb8c[_0x55d5('0x42')]=[{'all':!![]}];}_0x3deb8c=_[_0x55d5('0x3f')]({},_0x3deb8c,_0x57bdba[_0x55d5('0x41')]);return db[_0x55d5('0x2e')][_0x55d5('0x49')](_0x3deb8c)[_0x55d5('0x25')](handleEntityNotFound(_0x1dc5f1,null))['then'](respondWithResult(_0x1dc5f1,null))[_0x55d5('0x4a')](handleError(_0x1dc5f1,null));};exports[_0x55d5('0x4b')]=function(_0x12097a,_0x2f2644){return db['Dynamics365Account']['create'](_0x12097a['body'],{})[_0x55d5('0x25')](respondWithResult(_0x2f2644,0xc9))['catch'](handleError(_0x2f2644,null));};exports['update']=function(_0x178fb1,_0x572b3a){if(_0x178fb1[_0x55d5('0x4c')]['id']){delete _0x178fb1[_0x55d5('0x4c')]['id'];}return db[_0x55d5('0x2e')][_0x55d5('0x49')]({'where':{'id':_0x178fb1[_0x55d5('0x46')]['id']}})[_0x55d5('0x25')](handleEntityNotFound(_0x572b3a,null))[_0x55d5('0x25')](saveUpdates(_0x178fb1['body'],null))[_0x55d5('0x25')](respondWithResult(_0x572b3a,null))['catch'](handleError(_0x572b3a,null));};exports[_0x55d5('0x4d')]=function(_0x42dbc7,_0x3e6f59){return db[_0x55d5('0x2e')][_0x55d5('0x49')]({'where':{'id':_0x42dbc7[_0x55d5('0x46')]['id']}})[_0x55d5('0x25')](handleEntityNotFound(_0x3e6f59,null))[_0x55d5('0x25')](removeEntity(_0x3e6f59,null))[_0x55d5('0x4a')](handleError(_0x3e6f59,null));};exports[_0x55d5('0x4e')]=function(_0x583604,_0xc6f47,_0xcaa992){var _0x4f659c={};var _0x2401b6={};var _0x2aee63;var _0x3b064b;return db[_0x55d5('0x2e')]['findOne']({'where':{'id':_0x583604[_0x55d5('0x46')]['id']}})[_0x55d5('0x25')](handleEntityNotFound(_0xc6f47,null))[_0x55d5('0x25')](function(_0x1779a2){if(_0x1779a2){_0x2aee63=_0x1779a2;_0x2401b6[_0x55d5('0x30')]=_[_0x55d5('0x32')](db[_0x55d5('0x4f')][_0x55d5('0x47')]);_0x2401b6[_0x55d5('0x31')]=_[_0x55d5('0x32')](_0x583604[_0x55d5('0x31')]);_0x2401b6[_0x55d5('0x33')]=_['intersection'](_0x2401b6[_0x55d5('0x30')],_0x2401b6[_0x55d5('0x31')]);_0x4f659c[_0x55d5('0x34')]=_[_0x55d5('0x35')](_0x2401b6[_0x55d5('0x30')],qs[_0x55d5('0x36')](_0x583604[_0x55d5('0x31')]['fields']));_0x4f659c[_0x55d5('0x34')]=_0x4f659c[_0x55d5('0x34')][_0x55d5('0x37')]?_0x4f659c[_0x55d5('0x34')]:_0x2401b6[_0x55d5('0x30')];_0x4f659c[_0x55d5('0x3a')]=qs[_0x55d5('0x3b')](_0x583604[_0x55d5('0x31')]['sort']);_0x4f659c[_0x55d5('0x3c')]=qs['filters'](_[_0x55d5('0x3d')](_0x583604[_0x55d5('0x31')],_0x2401b6['filters']));if(_0x583604['query'][_0x55d5('0x3e')]){_0x4f659c[_0x55d5('0x3c')]=_[_0x55d5('0x3f')](_0x4f659c[_0x55d5('0x3c')],{'$or':_[_0x55d5('0x2d')](_0x4f659c[_0x55d5('0x34')],function(_0x7dd830){var _0xda0702={};_0xda0702[_0x7dd830]={'$like':'%'+_0x583604[_0x55d5('0x31')][_0x55d5('0x3e')]+'%'};return _0xda0702;})});}_0x4f659c=_['merge']({},_0x4f659c,_0x583604[_0x55d5('0x41')]);return _0x2aee63['getConfigurations'](_0x4f659c);}})[_0x55d5('0x25')](function(_0x50f3c8){if(_0x50f3c8){_0x3b064b=_0x50f3c8[_0x55d5('0x37')];if(!_0x583604[_0x55d5('0x31')]['hasOwnProperty']('nolimit')){_0x4f659c[_0x55d5('0x1c')]=qs[_0x55d5('0x1c')](_0x583604[_0x55d5('0x31')][_0x55d5('0x1c')]);_0x4f659c[_0x55d5('0x1b')]=qs[_0x55d5('0x1b')](_0x583604['query'][_0x55d5('0x1b')]);}return _0x2aee63[_0x55d5('0x4e')](_0x4f659c);}})[_0x55d5('0x25')](function(_0x153773){if(_0x153773){return _0x153773?{'count':_0x3b064b,'rows':_0x153773}:null;}})[_0x55d5('0x25')](respondWithResult(_0xc6f47,null))['catch'](handleError(_0xc6f47,null));};exports['addConfiguration']=function(_0x44466f,_0x41ee49,_0x3f12f3){if(_0x44466f[_0x55d5('0x4c')]['id']){delete _0x44466f[_0x55d5('0x4c')]['id'];}return db[_0x55d5('0x2e')][_0x55d5('0x50')]({'where':{'id':_0x44466f[_0x55d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x41ee49,null))[_0x55d5('0x25')](function(_0x2ada4c){if(_0x2ada4c){_0x44466f[_0x55d5('0x4c')]['AccountId']=_0x2ada4c['id'];_0x44466f[_0x55d5('0x4c')][_0x55d5('0x51')]=integrations[_0x55d5('0x52')](_0x44466f[_0x55d5('0x4c')][_0x55d5('0x53')],_0x44466f[_0x55d5('0x4c')][_0x55d5('0x40')]);_0x44466f[_0x55d5('0x4c')]['Descriptions']=integrations[_0x55d5('0x54')](_0x44466f[_0x55d5('0x4c')][_0x55d5('0x53')],_0x44466f['body'][_0x55d5('0x40')]);return db['Dynamics365Configuration']['create'](_0x44466f['body'],{'include':[{'model':db[_0x55d5('0x55')],'as':_0x55d5('0x51')},{'model':db[_0x55d5('0x55')],'as':_0x55d5('0x56')}]});}return null;})[_0x55d5('0x25')](respondWithResult(_0x41ee49,null))[_0x55d5('0x4a')](handleError(_0x41ee49,null));};exports['getFields']=function(_0x2f5669,_0x166f8c,_0x21e2bc){var _0x4882a6=_0x2f5669[_0x55d5('0x31')][_0x55d5('0x57')];var _0x2bfdce=_0x4882a6===_0x55d5('0x58')?'Incident':_0x55d5('0x59');var _0x47887f='';var _0x2da6c5='';var _0x10d5d3='';var _0x117736='';var _0x11cb2a='';var _0x5e049e='';var _0x1e6189='';var _0x4cd5d7='';var _0x1ca7f7=['title','description','customerid',_0x55d5('0x5a'),_0x55d5('0x5b'),_0x55d5('0x5c'),_0x55d5('0x5d'),_0x55d5('0x5e'),_0x55d5('0x5f'),_0x55d5('0x60')];var _0x171443=['accountidname',_0x55d5('0x61'),_0x55d5('0x62'),_0x55d5('0x63'),_0x55d5('0x64'),_0x55d5('0x65'),_0x55d5('0x66'),_0x55d5('0x67'),_0x55d5('0x68'),_0x55d5('0x69'),_0x55d5('0x6a'),_0x55d5('0x6b'),_0x55d5('0x6c'),'createdonbehalfbyname',_0x55d5('0x6d'),_0x55d5('0x6e'),_0x55d5('0x6f'),_0x55d5('0x70'),_0x55d5('0x71'),_0x55d5('0x72'),'entityimage_timestamp','entityimage_url',_0x55d5('0x73'),_0x55d5('0x74'),'firstresponsebykpiidname',_0x55d5('0x75'),_0x55d5('0x76'),_0x55d5('0x77'),_0x55d5('0x78'),'lastonholdtime','masteridname',_0x55d5('0x79'),_0x55d5('0x7a'),_0x55d5('0x7b'),_0x55d5('0x7c'),_0x55d5('0x7d'),_0x55d5('0x7e'),'modifiedonbehalfbyyominame',_0x55d5('0x7f'),_0x55d5('0x80'),_0x55d5('0x81'),_0x55d5('0x82'),_0x55d5('0x83'),_0x55d5('0x84'),_0x55d5('0x85'),_0x55d5('0x86'),'parentcaseidname',_0x55d5('0x87'),_0x55d5('0x88'),_0x55d5('0x89'),_0x55d5('0x8a'),_0x55d5('0x8b'),_0x55d5('0x8c'),'resolvebykpiidname',_0x55d5('0x8d'),_0x55d5('0x8e'),_0x55d5('0x8f'),'sentimentvalue',_0x55d5('0x90'),'slaname',_0x55d5('0x91'),'statecode',_0x55d5('0x92'),_0x55d5('0x93'),_0x55d5('0x94'),_0x55d5('0x95'),_0x55d5('0x96'),'traversedpath',_0x55d5('0x97'),'versionnumber'];var _0x106c28=_0x1ca7f7[_0x55d5('0x98')](_0x171443);return db['Dynamics365Account'][_0x55d5('0x50')]({'where':{'id':_0x2f5669[_0x55d5('0x46')]['id']},'attributes':['id',_0x55d5('0x99'),_0x55d5('0x9a'),'remoteUri','tenantId',_0x55d5('0x9b'),_0x55d5('0x9c')]})['then'](handleEntityNotFound(_0x166f8c,null))['then'](function(_0x223fd0){if(_0x223fd0){_0x4cd5d7=_0x223fd0[_0x55d5('0x9d')];var _0x3b451d=_0x4cd5d7['slice'](-0x1);if(_0x3b451d==='/'){_0x4cd5d7=_0x4cd5d7[_0x55d5('0x9e')](0x0,_0x4cd5d7['lastIndexOf'](_0x3b451d));}_0x1e6189=util[_0x55d5('0x9f')](_0x55d5('0xa0'),_0x4cd5d7);var _0x5d151f={'method':_0x55d5('0xa1'),'uri':_0x55d5('0xa2')+_0x223fd0[_0x55d5('0xa3')]+_0x55d5('0xa4'),'form':{'client_id':_0x223fd0[_0x55d5('0x9b')],'resource':_0x4cd5d7,'username':_0x223fd0[_0x55d5('0x99')],'password':_0x223fd0[_0x55d5('0x9a')],'grant_type':'password','client_secret':_0x223fd0['clientSecret']},'json':!![]};return rp(_0x5d151f);}})[_0x55d5('0x25')](function(_0x36c7e2){_0x5e049e=_0x36c7e2['access_token'];var _0x4b5b54={'method':_0x55d5('0xa5'),'uri':encodeURI(_0x1e6189+_0x55d5('0xa6')+_0x2bfdce+'\x27'),'headers':{'Authorization':_0x55d5('0xa7')+_0x5e049e,'If-None-Match':null,'OData-Version':_0x55d5('0xa8')},'json':!![]};return rp(_0x4b5b54);})[_0x55d5('0x25')](function(_0x5c28d5){var _0x23058d=_0x5c28d5['value'][0x0];var _0x332c3f=_0x23058d[_0x55d5('0xa9')];var _0x2b0ee8={'method':'GET','uri':_0x1e6189+_0x55d5('0xaa')+_0x332c3f+_0x55d5('0xab'),'headers':{'Authorization':_0x55d5('0xa7')+_0x5e049e,'If-None-Match':null,'OData-Version':_0x55d5('0xa8')},'json':!![]};return rp(_0x2b0ee8);})[_0x55d5('0x25')](function(_0x216c12){_0x47887f=_0x216c12;_0x2da6c5=_0x47887f[_0x55d5('0xac')];_0x2da6c5=_['remove'](_0x2da6c5,function(_0xbef20){return!_0x106c28[_0x55d5('0xad')](_0xbef20[_0x55d5('0xae')]);});var _0x4a69eb=[];var _0xd375ef=[];_0x2da6c5[_0x55d5('0xaf')](function(_0x5aa965){if(_0x5aa965['@odata.type']){var _0x33db13=_0x5aa965['@odata.type']['substring'](_0x5aa965['@odata.type']['lastIndexOf']('.')+0x1);if(_0x33db13===_0x55d5('0xb0')){_0x4a69eb[_0x55d5('0xb1')](getSelectList(_0x1e6189,_0x4882a6,_0xd375ef,_0x47887f[_0x55d5('0xa9')],_0x5aa965[_0x55d5('0xa9')],_0x5e049e));}}});return Promise[_0x55d5('0xb2')](_0x4a69eb);})[_0x55d5('0x25')](function(_0x54e047){_0x10d5d3=_0x54e047[0x0];var _0x2fbc32=[];var _0x1e2684=[];_0x2da6c5[_0x55d5('0xaf')](function(_0x152604){if(!_[_0x55d5('0xb3')](_0x152604[_0x55d5('0xb4')])){var _0x16c402=_0x152604[_0x55d5('0xb4')]['substring'](_0x152604[_0x55d5('0xb4')]['lastIndexOf']('.')+0x1);if(_0x16c402==='BooleanAttributeMetadata'){_0x2fbc32[_0x55d5('0xb1')](getBooleanList(_0x1e6189,_0x4882a6,_0x1e2684,_0x47887f[_0x55d5('0xa9')],_0x152604[_0x55d5('0xa9')],_0x5e049e));}}});return Promise[_0x55d5('0xb2')](_0x2fbc32);})[_0x55d5('0x25')](function(_0x133c09){_0x117736=_0x133c09[0x0];var _0x478687=[];var _0x543712=[];_0x2da6c5[_0x55d5('0xaf')](function(_0x4170ba){if(_0x4170ba[_0x55d5('0xb4')]){var _0x3ea07f=_0x4170ba[_0x55d5('0xb4')][_0x55d5('0x9e')](_0x4170ba[_0x55d5('0xb4')][_0x55d5('0xb5')]('.')+0x1);if(_0x3ea07f===_0x55d5('0xb6')||_0x3ea07f==='DoubleAttributeMetadata'||_0x3ea07f==='BigIntAttributeMetadata'||_0x3ea07f===_0x55d5('0xb7')||_0x3ea07f==='MemoAttributeMetadata'||_0x3ea07f==='DateTimeAttributeMetadata'||_0x3ea07f===_0x55d5('0xb8')||_0x3ea07f===_0x55d5('0xb9')||_0x3ea07f===_0x55d5('0xba')||_0x3ea07f===_0x55d5('0xbb')){_0x478687['push'](getInputList(_0x1e6189,_0x4882a6,_0x3ea07f,_0x543712,_0x47887f[_0x55d5('0xa9')],_0x4170ba[_0x55d5('0xa9')],_0x5e049e));}}});return Promise[_0x55d5('0xb2')](_0x478687);})[_0x55d5('0x25')](function(_0x116816){_0x11cb2a=_0x116816[0x0];var _0x354140=_0x10d5d3[_0x55d5('0x98')](_0x117736)['concat'](_0x11cb2a);var _0x5cd05a={'count':_0x354140[_0x55d5('0x37')],'rows':_0x354140};return _0x5cd05a;})['then'](respondWithResult(_0x166f8c,null))[_0x55d5('0x4a')](function(_0x3367da){var _0x3c0970=_0x2f5669[_0x55d5('0x31')][_0x55d5('0xbc')]?0x1f4:_0x3367da[_0x55d5('0xbd')]||0x1f4;logger[_0x55d5('0x28')](_0x3367da[_0x55d5('0x29')]);delete _0x3367da[_0x55d5('0x2a')];if(_0x3c0970===0x191){_0x3c0970=0x190;}_0x166f8c[_0x55d5('0x1a')](_0x3c0970)[_0x55d5('0x2b')](_0x2f5669['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x3367da[_0x55d5('0xbd')]}:_0x3367da);});};function getSelectList(_0x102e04,_0x93b229,_0x409eb5,_0x50f368,_0x13fc11,_0x10d9a5){var _0x452258={'method':_0x55d5('0xa5'),'uri':_0x102e04+_0x55d5('0xaa')+_0x50f368+_0x55d5('0xbe')+_0x13fc11+_0x55d5('0xbf')+_0x55d5('0xc0'),'headers':{'Authorization':'Bearer\x20'+_0x10d9a5,'If-None-Match':null,'OData-Version':_0x55d5('0xa8')},'json':!![]};return rp(_0x452258)[_0x55d5('0x25')](function(_0xe7847a){var _0xc69c5a=[];var _0x2fc6d6=_0xe7847a[_0x55d5('0xc1')]['Options'];_0x2fc6d6[_0x55d5('0xaf')](function(_0x1055a7){_0xc69c5a[_0x55d5('0xb1')]({'name':_0x1055a7[_0x55d5('0xc2')]['UserLocalizedLabel'][_0x55d5('0xc2')],'value':String(_0x1055a7['Value'])});});var _0x18fe7e={'id':_0x93b229+'_'+_0xe7847a[_0x55d5('0xae')],'name':_0xe7847a[_0x55d5('0xc3')]['UserLocalizedLabel'][_0x55d5('0xc2')],'custom':![],'options':_0xc69c5a};_0x409eb5[_0x55d5('0xb1')](_0x18fe7e);return _0x409eb5;});}function getBooleanList(_0x391f93,_0x1d105c,_0x5e923e,_0x310b7e,_0x317c8d,_0x27f389){var _0x117a76={'method':_0x55d5('0xa5'),'uri':_0x391f93+_0x55d5('0xaa')+_0x310b7e+_0x55d5('0xbe')+_0x317c8d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x55d5('0xa7')+_0x27f389,'If-None-Match':null,'OData-Version':_0x55d5('0xa8')},'json':!![]};return rp(_0x117a76)[_0x55d5('0x25')](function(_0x18eeac){var _0x4c5694=[];_0x4c5694[_0x55d5('0xb1')]({'name':_0x18eeac[_0x55d5('0xc1')][_0x55d5('0xc4')][_0x55d5('0xc2')][_0x55d5('0xc5')][_0x55d5('0xc2')],'value':'true'},{'name':_0x18eeac[_0x55d5('0xc1')][_0x55d5('0xc6')][_0x55d5('0xc2')][_0x55d5('0xc5')]['Label'],'value':'false'});var _0x32c2b6={'id':_0x1d105c+'_'+_0x18eeac[_0x55d5('0xae')],'name':_0x18eeac[_0x55d5('0xc3')]['UserLocalizedLabel'][_0x55d5('0xc2')],'custom':![],'options':_0x4c5694};_0x5e923e[_0x55d5('0xb1')](_0x32c2b6);return _0x5e923e;});}function getInputList(_0x4f86cf,_0xcb975b,_0x2d8f45,_0x511774,_0x5e8531,_0x5b27e7,_0x61ae1b){var _0x46742b={'method':_0x55d5('0xa5'),'uri':_0x4f86cf+_0x55d5('0xaa')+_0x5e8531+')/Attributes('+_0x5b27e7+_0x55d5('0xc7')+_0x2d8f45+_0x55d5('0xc8'),'headers':{'Authorization':_0x55d5('0xa7')+_0x61ae1b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x46742b)['then'](function(_0x66ba2){var _0x1633dc={'id':_0xcb975b+'_'+_0x66ba2[_0x55d5('0xae')],'name':_0x66ba2[_0x55d5('0xc3')][_0x55d5('0xc5')]?_0x66ba2['DisplayName'][_0x55d5('0xc5')][_0x55d5('0xc2')]:_0x66ba2['LogicalName'],'custom':![],'options':[]};_0x511774[_0x55d5('0xb1')](_0x1633dc);return _0x511774;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 9a646e9..7dafebf 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 8f71fd2..6a1e1e0 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 _0xc471=['find','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','ShowDynamics365Account'];(function(_0x47025c,_0x13c90b){var _0x3bf8b0=function(_0x490cc0){while(--_0x490cc0){_0x47025c['push'](_0x47025c['shift']());}};_0x3bf8b0(++_0x13c90b);}(_0xc471,0x8d));var _0x1c47=function(_0x5d7aa9,_0x41b23c){_0x5d7aa9=_0x5d7aa9-0x0;var _0x1b2e93=_0xc471[_0x5d7aa9];return _0x1b2e93;};'use strict';var _=require(_0x1c47('0x0'));var util=require(_0x1c47('0x1'));var moment=require(_0x1c47('0x2'));var BPromise=require(_0x1c47('0x3'));var rs=require(_0x1c47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1c47('0x5'));var logger=require('../../config/logger')(_0x1c47('0x6'));var config=require(_0x1c47('0x7'));var jayson=require(_0x1c47('0x8'));var client=jayson['client'][_0x1c47('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f3552,_0x36eb31,_0x5a7cb6){return new BPromise(function(_0x391c6d,_0x317a92){return client[_0x1c47('0xa')](_0x1f3552,_0x5a7cb6)[_0x1c47('0xb')](function(_0x59fc45){logger[_0x1c47('0xc')](_0x1c47('0xd'),_0x36eb31,_0x1c47('0xe'));logger[_0x1c47('0xf')](_0x1c47('0x10'),_0x36eb31,'request\x20sent',JSON[_0x1c47('0x11')](_0x59fc45));if(_0x59fc45[_0x1c47('0x12')]){if(_0x59fc45[_0x1c47('0x12')][_0x1c47('0x13')]===0x1f4){logger[_0x1c47('0x12')](_0x1c47('0xd'),_0x36eb31,_0x59fc45[_0x1c47('0x12')][_0x1c47('0x14')]);return _0x317a92(_0x59fc45['error'][_0x1c47('0x14')]);}logger[_0x1c47('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x36eb31,_0x59fc45['error'][_0x1c47('0x14')]);return _0x391c6d(_0x59fc45['error']['message']);}else{logger['info'](_0x1c47('0xd'),_0x36eb31,_0x1c47('0xe'));_0x391c6d(_0x59fc45[_0x1c47('0x15')][_0x1c47('0x14')]);}})[_0x1c47('0x16')](function(_0xaca367){logger['error'](_0x1c47('0xd'),_0x36eb31,_0xaca367);_0x317a92(_0xaca367);});});}exports[_0x1c47('0x17')]=function(_0x43938c){var _0x4f1865=this;return new Promise(function(_0x67973c,_0x4592f7){return db[_0x1c47('0x18')][_0x1c47('0x19')]({'raw':_0x43938c[_0x1c47('0x1a')]?_0x43938c[_0x1c47('0x1a')][_0x1c47('0x1b')]===undefined?!![]:![]:!![],'where':_0x43938c[_0x1c47('0x1a')]?_0x43938c['options'][_0x1c47('0x1c')]||null:null,'attributes':_0x43938c['options']?_0x43938c[_0x1c47('0x1a')][_0x1c47('0x1d')]||null:null,'limit':_0x43938c[_0x1c47('0x1a')]?_0x43938c[_0x1c47('0x1a')]['limit']||null:null,'include':_0x43938c[_0x1c47('0x1a')]?_0x43938c[_0x1c47('0x1a')][_0x1c47('0x1e')]?_[_0x1c47('0x1f')](_0x43938c[_0x1c47('0x1a')][_0x1c47('0x1e')],function(_0xc2c61){return{'model':db[_0xc2c61[_0x1c47('0x20')]],'as':_0xc2c61['as'],'attributes':_0xc2c61[_0x1c47('0x1d')],'include':_0xc2c61[_0x1c47('0x1e')]?_[_0x1c47('0x1f')](_0xc2c61['include'],function(_0x5916f2){return{'model':db[_0x5916f2['model']],'as':_0x5916f2['as'],'attributes':_0x5916f2[_0x1c47('0x1d')],'include':_0x5916f2[_0x1c47('0x1e')]?_[_0x1c47('0x1f')](_0x5916f2[_0x1c47('0x1e')],function(_0x939ecf){return{'model':db[_0x939ecf[_0x1c47('0x20')]],'as':_0x939ecf['as'],'attributes':_0x939ecf['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c47('0xb')](function(_0x491b63){logger[_0x1c47('0xc')](_0x1c47('0x17'),_0x43938c);logger[_0x1c47('0xf')](_0x1c47('0x17'),_0x43938c,JSON['stringify'](_0x491b63));_0x67973c(_0x491b63);})[_0x1c47('0x16')](function(_0x79a6fc){logger[_0x1c47('0x12')](_0x1c47('0x17'),_0x79a6fc[_0x1c47('0x14')],_0x43938c);_0x4592f7(_0x4f1865[_0x1c47('0x12')](0x1f4,_0x79a6fc[_0x1c47('0x14')]));});});};exports[_0x1c47('0x21')]=function(_0x1ee9db){var _0x389da7=this;return new Promise(function(_0x57f52a,_0x5acc80){return db[_0x1c47('0x18')][_0x1c47('0x22')]({'raw':_0x1ee9db[_0x1c47('0x1a')]?_0x1ee9db['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ee9db[_0x1c47('0x1a')]?_0x1ee9db['options']['where']||null:null,'attributes':_0x1ee9db['options']?_0x1ee9db[_0x1c47('0x1a')][_0x1c47('0x1d')]||null:null,'include':_0x1ee9db[_0x1c47('0x1a')]?_0x1ee9db[_0x1c47('0x1a')][_0x1c47('0x1e')]?_[_0x1c47('0x1f')](_0x1ee9db[_0x1c47('0x1a')][_0x1c47('0x1e')],function(_0x29f340){return{'model':db[_0x29f340[_0x1c47('0x20')]],'as':_0x29f340['as'],'attributes':_0x29f340['attributes'],'include':_0x29f340[_0x1c47('0x1e')]?_[_0x1c47('0x1f')](_0x29f340['include'],function(_0x19462b){return{'model':db[_0x19462b[_0x1c47('0x20')]],'as':_0x19462b['as'],'attributes':_0x19462b[_0x1c47('0x1d')],'include':_0x19462b[_0x1c47('0x1e')]?_['map'](_0x19462b[_0x1c47('0x1e')],function(_0x5d9c0b){return{'model':db[_0x5d9c0b[_0x1c47('0x20')]],'as':_0x5d9c0b['as'],'attributes':_0x5d9c0b[_0x1c47('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1c47('0xb')](function(_0x29b0e6){logger[_0x1c47('0xc')](_0x1c47('0x21'),_0x1ee9db);logger['debug']('ShowDynamics365Account',_0x1ee9db,JSON[_0x1c47('0x11')](_0x29b0e6));_0x57f52a(_0x29b0e6);})[_0x1c47('0x16')](function(_0x32e9df){logger['error'](_0x1c47('0x21'),_0x32e9df[_0x1c47('0x14')],_0x1ee9db);_0x5acc80(_0x389da7[_0x1c47('0x12')](0x1f4,_0x32e9df[_0x1c47('0x14')]));});});}; \ No newline at end of file +var _0xde1d=['GetDynamics365Account','Dynamics365Account','options','raw','where','limit','map','include','model','attributes','info','ShowDynamics365Account','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x23cd34,_0xe7e8f7){var _0x1e1e48=function(_0x820992){while(--_0x820992){_0x23cd34['push'](_0x23cd34['shift']());}};_0x1e1e48(++_0xe7e8f7);}(_0xde1d,0x109));var _0xdde1=function(_0x538967,_0x464c86){_0x538967=_0x538967-0x0;var _0x30bc9b=_0xde1d[_0x538967];return _0x30bc9b;};'use strict';var _=require('lodash');var util=require(_0xdde1('0x0'));var moment=require(_0xdde1('0x1'));var BPromise=require(_0xdde1('0x2'));var rs=require(_0xdde1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdde1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdde1('0x5'))(_0xdde1('0x6'));var config=require(_0xdde1('0x7'));var jayson=require(_0xdde1('0x8'));var client=jayson[_0xdde1('0x9')][_0xdde1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x570329,_0x88bff4,_0x38cb0b){return new BPromise(function(_0x47c5a7,_0x250661){return client[_0xdde1('0xb')](_0x570329,_0x38cb0b)[_0xdde1('0xc')](function(_0x8d634d){logger['info'](_0xdde1('0xd'),_0x88bff4,_0xdde1('0xe'));logger[_0xdde1('0xf')](_0xdde1('0x10'),_0x88bff4,_0xdde1('0xe'),JSON[_0xdde1('0x11')](_0x8d634d));if(_0x8d634d['error']){if(_0x8d634d['error'][_0xdde1('0x12')]===0x1f4){logger[_0xdde1('0x13')](_0xdde1('0xd'),_0x88bff4,_0x8d634d[_0xdde1('0x13')]['message']);return _0x250661(_0x8d634d['error'][_0xdde1('0x14')]);}logger[_0xdde1('0x13')](_0xdde1('0xd'),_0x88bff4,_0x8d634d['error'][_0xdde1('0x14')]);return _0x47c5a7(_0x8d634d[_0xdde1('0x13')][_0xdde1('0x14')]);}else{logger['info'](_0xdde1('0xd'),_0x88bff4,_0xdde1('0xe'));_0x47c5a7(_0x8d634d[_0xdde1('0x15')][_0xdde1('0x14')]);}})[_0xdde1('0x16')](function(_0x5ed661){logger[_0xdde1('0x13')](_0xdde1('0xd'),_0x88bff4,_0x5ed661);_0x250661(_0x5ed661);});});}exports[_0xdde1('0x17')]=function(_0x5db5be){var _0x4a3d5b=this;return new Promise(function(_0x88b9aa,_0x4d76bf){return db[_0xdde1('0x18')]['findAll']({'raw':_0x5db5be[_0xdde1('0x19')]?_0x5db5be[_0xdde1('0x19')][_0xdde1('0x1a')]===undefined?!![]:![]:!![],'where':_0x5db5be[_0xdde1('0x19')]?_0x5db5be[_0xdde1('0x19')][_0xdde1('0x1b')]||null:null,'attributes':_0x5db5be[_0xdde1('0x19')]?_0x5db5be[_0xdde1('0x19')]['attributes']||null:null,'limit':_0x5db5be[_0xdde1('0x19')]?_0x5db5be[_0xdde1('0x19')][_0xdde1('0x1c')]||null:null,'include':_0x5db5be[_0xdde1('0x19')]?_0x5db5be['options']['include']?_[_0xdde1('0x1d')](_0x5db5be[_0xdde1('0x19')][_0xdde1('0x1e')],function(_0x2db20d){return{'model':db[_0x2db20d[_0xdde1('0x1f')]],'as':_0x2db20d['as'],'attributes':_0x2db20d['attributes'],'include':_0x2db20d[_0xdde1('0x1e')]?_[_0xdde1('0x1d')](_0x2db20d[_0xdde1('0x1e')],function(_0x372ce7){return{'model':db[_0x372ce7['model']],'as':_0x372ce7['as'],'attributes':_0x372ce7[_0xdde1('0x20')],'include':_0x372ce7[_0xdde1('0x1e')]?_[_0xdde1('0x1d')](_0x372ce7['include'],function(_0x29b1a1){return{'model':db[_0x29b1a1[_0xdde1('0x1f')]],'as':_0x29b1a1['as'],'attributes':_0x29b1a1[_0xdde1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdde1('0xc')](function(_0x223f28){logger[_0xdde1('0x21')](_0xdde1('0x17'),_0x5db5be);logger[_0xdde1('0xf')](_0xdde1('0x17'),_0x5db5be,JSON['stringify'](_0x223f28));_0x88b9aa(_0x223f28);})[_0xdde1('0x16')](function(_0x56340a){logger['error']('GetDynamics365Account',_0x56340a[_0xdde1('0x14')],_0x5db5be);_0x4d76bf(_0x4a3d5b[_0xdde1('0x13')](0x1f4,_0x56340a['message']));});});};exports[_0xdde1('0x22')]=function(_0x1917c0){var _0x4c3ead=this;return new Promise(function(_0x1c5e37,_0x416f56){return db[_0xdde1('0x18')][_0xdde1('0x23')]({'raw':_0x1917c0[_0xdde1('0x19')]?_0x1917c0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1917c0[_0xdde1('0x19')]?_0x1917c0['options'][_0xdde1('0x1b')]||null:null,'attributes':_0x1917c0[_0xdde1('0x19')]?_0x1917c0[_0xdde1('0x19')]['attributes']||null:null,'include':_0x1917c0[_0xdde1('0x19')]?_0x1917c0['options'][_0xdde1('0x1e')]?_[_0xdde1('0x1d')](_0x1917c0[_0xdde1('0x19')][_0xdde1('0x1e')],function(_0x462195){return{'model':db[_0x462195[_0xdde1('0x1f')]],'as':_0x462195['as'],'attributes':_0x462195[_0xdde1('0x20')],'include':_0x462195[_0xdde1('0x1e')]?_[_0xdde1('0x1d')](_0x462195[_0xdde1('0x1e')],function(_0x4f3e89){return{'model':db[_0x4f3e89['model']],'as':_0x4f3e89['as'],'attributes':_0x4f3e89[_0xdde1('0x20')],'include':_0x4f3e89['include']?_[_0xdde1('0x1d')](_0x4f3e89[_0xdde1('0x1e')],function(_0x56de8b){return{'model':db[_0x56de8b[_0xdde1('0x1f')]],'as':_0x56de8b['as'],'attributes':_0x56de8b[_0xdde1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdde1('0xc')](function(_0x540afd){logger[_0xdde1('0x21')](_0xdde1('0x22'),_0x1917c0);logger['debug'](_0xdde1('0x22'),_0x1917c0,JSON[_0xdde1('0x11')](_0x540afd));_0x1c5e37(_0x540afd);})[_0xdde1('0x16')](function(_0x58a452){logger['error'](_0xdde1('0x22'),_0x58a452[_0xdde1('0x14')],_0x1917c0);_0x416f56(_0x4c3ead['error'](0x1f4,_0x58a452[_0xdde1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index edfd11f..a2c17a5 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 _0xa775=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','/:id','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x37fcda,_0x2f5aa1){var _0xf5ed91=function(_0x3c3241){while(--_0x3c3241){_0x37fcda['push'](_0x37fcda['shift']());}};_0xf5ed91(++_0x2f5aa1);}(_0xa775,0xf6));var _0x5a77=function(_0x11cb67,_0x4fc6e8){_0x11cb67=_0x11cb67-0x0;var _0x2c7e80=_0xa775[_0x11cb67];return _0x2c7e80;};'use strict';var multer=require(_0x5a77('0x0'));var util=require('util');var path=require(_0x5a77('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a77('0x2')]();var fs_extra=require(_0x5a77('0x3'));var auth=require(_0x5a77('0x4'));var interaction=require(_0x5a77('0x5'));var config=require('../../config/environment');var controller=require(_0x5a77('0x6'));router[_0x5a77('0x7')]('/',auth[_0x5a77('0x8')](),controller[_0x5a77('0x9')]);router[_0x5a77('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x5a77('0xa'),auth[_0x5a77('0x8')](),controller[_0x5a77('0xb')]);router[_0x5a77('0x7')](_0x5a77('0xc'),auth[_0x5a77('0x8')](),controller['getSubjects']);router[_0x5a77('0x7')](_0x5a77('0xd'),auth['isAuthenticated'](),controller[_0x5a77('0xe')]);router['post']('/',auth[_0x5a77('0x8')](),controller[_0x5a77('0xf')]);router[_0x5a77('0x10')](_0x5a77('0x11'),auth[_0x5a77('0x8')](),controller[_0x5a77('0x12')]);router['delete'](_0x5a77('0x11'),auth[_0x5a77('0x8')](),controller[_0x5a77('0x13')]);module[_0x5a77('0x14')]=router; \ No newline at end of file +var _0x8c2d=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x4e1119,_0x32dc78){var _0x35f53d=function(_0x2bbfe0){while(--_0x2bbfe0){_0x4e1119['push'](_0x4e1119['shift']());}};_0x35f53d(++_0x32dc78);}(_0x8c2d,0x1cb));var _0xd8c2=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x8c2d[_0x1e4150];return _0x1ce3ee;};'use strict';var multer=require(_0xd8c2('0x0'));var util=require(_0xd8c2('0x1'));var path=require(_0xd8c2('0x2'));var timeout=require(_0xd8c2('0x3'));var express=require(_0xd8c2('0x4'));var router=express[_0xd8c2('0x5')]();var fs_extra=require(_0xd8c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8c2('0x7'));var config=require('../../config/environment');var controller=require(_0xd8c2('0x8'));router['get']('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xa')]);router['get'](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0xc')]);router[_0xd8c2('0xd')]('/:id/fields',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd8c2('0xf')]);router[_0xd8c2('0xd')](_0xd8c2('0x10'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x11')]);router[_0xd8c2('0x12')]('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x13')]);router[_0xd8c2('0x14')](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0x15')]);router[_0xd8c2('0x16')](_0xd8c2('0xb'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x17')]);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 8421174..28bb6fe 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 _0x975b=['STRING','ENUM','incident','sequelize'];(function(_0x79f41a,_0x1162a7){var _0x4523e9=function(_0x585a1b){while(--_0x585a1b){_0x79f41a['push'](_0x79f41a['shift']());}};_0x4523e9(++_0x1162a7);}(_0x975b,0x1bf));var _0xb975=function(_0x3df11a,_0x9777b9){_0x3df11a=_0x3df11a-0x0;var _0x1017aa=_0x975b[_0x3df11a];return _0x1017aa;};'use strict';var Sequelize=require(_0xb975('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb975('0x1')]},'ticketType':{'type':Sequelize[_0xb975('0x2')](_0xb975('0x3'),'phonecall'),'defaultValue':_0xb975('0x3')}}; \ No newline at end of file +var _0x30de=['incident','sequelize','exports','STRING','ENUM','phonecall'];(function(_0x301f45,_0x19841d){var _0x4fd7da=function(_0x4ac0d4){while(--_0x4ac0d4){_0x301f45['push'](_0x301f45['shift']());}};_0x4fd7da(++_0x19841d);}(_0x30de,0x1bd));var _0xe30d=function(_0x182e57,_0x2911e1){_0x182e57=_0x182e57-0x0;var _0x4f331b=_0x30de[_0x182e57];return _0x4f331b;};'use strict';var Sequelize=require(_0xe30d('0x0'));module[_0xe30d('0x1')]={'name':{'type':Sequelize[_0xe30d('0x2')]},'description':{'type':Sequelize[_0xe30d('0x2')]},'ticketType':{'type':Sequelize[_0xe30d('0x3')]('incident',_0xe30d('0x4')),'defaultValue':_0xe30d('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 179cdc7..c2e9564 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 _0xa41c=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','Dynamics365Configuration','include','findAll','then','rows','catch','show','params','keys','length','options','find','create','body','getFields','findOne','Dynamics365Field','sort','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv'];(function(_0x5896f1,_0x179ced){var _0xaa16d7=function(_0x319906){while(--_0x319906){_0x5896f1['push'](_0x5896f1['shift']());}};_0xaa16d7(++_0x179ced);}(_0xa41c,0x178));var _0xca41=function(_0x515a8f,_0x5e8c5e){_0x515a8f=_0x515a8f-0x0;var _0x35da8b=_0xa41c[_0x515a8f];return _0x35da8b;};'use strict';var emlformat=require(_0xca41('0x0'));var rimraf=require(_0xca41('0x1'));var zipdir=require(_0xca41('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca41('0x3'));var moment=require('moment');var BPromise=require(_0xca41('0x4'));var Mustache=require(_0xca41('0x5'));var util=require('util');var path=require(_0xca41('0x6'));var sox=require(_0xca41('0x7'));var csv=require('to-csv');var ejs=require(_0xca41('0x8'));var fs=require('fs');var fs_extra=require(_0xca41('0x9'));var _=require(_0xca41('0xa'));var squel=require(_0xca41('0xb'));var crypto=require(_0xca41('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xca41('0xd'));var querystring=require(_0xca41('0xe'));var Papa=require(_0xca41('0xf'));var Redis=require('ioredis');var authService=require(_0xca41('0x10'));var qs=require(_0xca41('0x11'));var as=require(_0xca41('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xca41('0x13'));var utils=require(_0xca41('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xca41('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7fcf7a,_0xc19e26){_0xc19e26=_0xc19e26||0xcc;return function(_0x3b7e80){if(_0x3b7e80){return _0x7fcf7a[_0xca41('0x16')](_0xc19e26);}return _0x7fcf7a[_0xca41('0x17')](_0xc19e26)['end']();};}function respondWithResult(_0x401279,_0x44ad96){_0x44ad96=_0x44ad96||0xc8;return function(_0x5c1f2c){if(_0x5c1f2c){return _0x401279['status'](_0x44ad96)[_0xca41('0x18')](_0x5c1f2c);}};}function respondWithFilteredResult(_0x4c3f2,_0x53a649){return function(_0x1cfc27){if(_0x1cfc27){var _0x3eaa05=typeof _0x53a649[_0xca41('0x19')]===_0xca41('0x1a')&&typeof _0x53a649[_0xca41('0x1b')]===_0xca41('0x1a');var _0x413b48=_0x1cfc27[_0xca41('0x1c')];var _0x1cad1e=_0x3eaa05?0x0:_0x53a649[_0xca41('0x19')];var _0x34cc91=_0x3eaa05?_0x1cfc27[_0xca41('0x1c')]:_0x53a649[_0xca41('0x19')]+_0x53a649[_0xca41('0x1b')];var _0x5da210;if(_0x34cc91>=_0x413b48){_0x34cc91=_0x413b48;_0x5da210=0xc8;}else{_0x5da210=0xce;}_0x4c3f2[_0xca41('0x17')](_0x5da210);return _0x4c3f2[_0xca41('0x1d')]('Content-Range',_0x1cad1e+'-'+_0x34cc91+'/'+_0x413b48)[_0xca41('0x18')](_0x1cfc27);}return null;};}function patchUpdates(_0x5b5e27){return function(_0x11e930){try{jsonpatch[_0xca41('0x1e')](_0x11e930,_0x5b5e27,!![]);}catch(_0x5169b5){return BPromise[_0xca41('0x1f')](_0x5169b5);}return _0x11e930[_0xca41('0x20')]();};}function saveUpdates(_0x4a6a6c,_0x1a7803){return function(_0x3bac4e){if(_0x3bac4e){return _0x3bac4e[_0xca41('0x21')](_0x4a6a6c)['then'](function(_0xf2a221){return _0xf2a221;});}return null;};}function removeEntity(_0x3fe748,_0x4ca763){return function(_0x1bb48c){if(_0x1bb48c){return _0x1bb48c[_0xca41('0x22')]()['then'](function(){_0x3fe748['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x261b16,_0x16913f){return function(_0x3c580f){if(!_0x3c580f){_0x261b16['sendStatus'](0x194);}return _0x3c580f;};}function handleError(_0x4f2787,_0x4c71f7){_0x4c71f7=_0x4c71f7||0x1f4;return function(_0x511799){logger[_0xca41('0x23')](_0x511799[_0xca41('0x24')]);if(_0x511799[_0xca41('0x25')]){delete _0x511799[_0xca41('0x25')];}_0x4f2787[_0xca41('0x17')](_0x4c71f7)['send'](_0x511799);};}exports[_0xca41('0x26')]=function(_0x24e14e,_0x15fdab){var _0x5a2af5={},_0x276ef9={},_0x3adc27={'count':0x0,'rows':[]};var _0x98b430=_['map'](db['Dynamics365Configuration'][_0xca41('0x27')],function(_0x363642){return{'name':_0x363642[_0xca41('0x28')],'type':_0x363642[_0xca41('0x29')][_0xca41('0x2a')]};});_0x276ef9['model']=_[_0xca41('0x2b')](_0x98b430,_0xca41('0x25'));_0x276ef9[_0xca41('0x2c')]=_['keys'](_0x24e14e['query']);_0x276ef9[_0xca41('0x2d')]=_[_0xca41('0x2e')](_0x276ef9['model'],_0x276ef9[_0xca41('0x2c')]);_0x5a2af5[_0xca41('0x2f')]=_[_0xca41('0x2e')](_0x276ef9[_0xca41('0x30')],qs[_0xca41('0x31')](_0x24e14e['query'][_0xca41('0x31')]));_0x5a2af5['attributes']=_0x5a2af5['attributes']['length']?_0x5a2af5[_0xca41('0x2f')]:_0x276ef9['model'];if(!_0x24e14e[_0xca41('0x2c')][_0xca41('0x32')]('nolimit')){_0x5a2af5[_0xca41('0x1b')]=qs[_0xca41('0x1b')](_0x24e14e[_0xca41('0x2c')][_0xca41('0x1b')]);_0x5a2af5['offset']=qs[_0xca41('0x19')](_0x24e14e[_0xca41('0x2c')][_0xca41('0x19')]);}_0x5a2af5[_0xca41('0x33')]=qs['sort'](_0x24e14e['query']['sort']);_0x5a2af5[_0xca41('0x34')]=qs[_0xca41('0x2d')](_[_0xca41('0x35')](_0x24e14e['query'],_0x276ef9[_0xca41('0x2d')]),_0x98b430);if(_0x24e14e[_0xca41('0x2c')][_0xca41('0x36')]){_0x5a2af5[_0xca41('0x34')]=_['merge'](_0x5a2af5[_0xca41('0x34')],{'$or':_[_0xca41('0x2b')](_0x98b430,function(_0x286098){if(_0x286098['type']!==_0xca41('0x37')){var _0x54550a={};_0x54550a[_0x286098[_0xca41('0x25')]]={'$like':'%'+_0x24e14e[_0xca41('0x2c')][_0xca41('0x36')]+'%'};return _0x54550a;}})});}_0x5a2af5=_[_0xca41('0x38')]({},_0x5a2af5,_0x24e14e['options']);var _0x16d7ee={'where':_0x5a2af5['where']};return db[_0xca41('0x39')][_0xca41('0x1c')](_0x16d7ee)['then'](function(_0xf7a7f9){_0x3adc27[_0xca41('0x1c')]=_0xf7a7f9;if(_0x24e14e[_0xca41('0x2c')]['includeAll']){_0x5a2af5[_0xca41('0x3a')]=[{'all':!![]}];}return db[_0xca41('0x39')][_0xca41('0x3b')](_0x5a2af5);})[_0xca41('0x3c')](function(_0x5ed92f){_0x3adc27[_0xca41('0x3d')]=_0x5ed92f;return _0x3adc27;})['then'](respondWithFilteredResult(_0x15fdab,_0x5a2af5))[_0xca41('0x3e')](handleError(_0x15fdab,null));};exports[_0xca41('0x3f')]=function(_0x427f54,_0x45d6e6){var _0x3094b5={'raw':![],'where':{'id':_0x427f54[_0xca41('0x40')]['id']}},_0x238e2e={};_0x238e2e[_0xca41('0x30')]=_[_0xca41('0x41')](db['Dynamics365Configuration'][_0xca41('0x27')]);_0x238e2e[_0xca41('0x2c')]=_['keys'](_0x427f54['query']);_0x238e2e[_0xca41('0x2d')]=_[_0xca41('0x2e')](_0x238e2e[_0xca41('0x30')],_0x238e2e['query']);_0x3094b5[_0xca41('0x2f')]=_[_0xca41('0x2e')](_0x238e2e[_0xca41('0x30')],qs['fields'](_0x427f54[_0xca41('0x2c')][_0xca41('0x31')]));_0x3094b5['attributes']=_0x3094b5[_0xca41('0x2f')][_0xca41('0x42')]?_0x3094b5[_0xca41('0x2f')]:_0x238e2e[_0xca41('0x30')];if(_0x427f54[_0xca41('0x2c')]['includeAll']){_0x3094b5['include']=[{'all':!![]}];}_0x3094b5=_[_0xca41('0x38')]({},_0x3094b5,_0x427f54[_0xca41('0x43')]);return db[_0xca41('0x39')][_0xca41('0x44')](_0x3094b5)[_0xca41('0x3c')](handleEntityNotFound(_0x45d6e6,null))[_0xca41('0x3c')](respondWithResult(_0x45d6e6,null))[_0xca41('0x3e')](handleError(_0x45d6e6,null));};exports[_0xca41('0x45')]=function(_0x1ce4a5,_0x20486f){return db[_0xca41('0x39')][_0xca41('0x45')](_0x1ce4a5[_0xca41('0x46')],{})[_0xca41('0x3c')](respondWithResult(_0x20486f,0xc9))['catch'](handleError(_0x20486f,null));};exports[_0xca41('0x21')]=function(_0x88e7fe,_0x3b78a4){if(_0x88e7fe['body']['id']){delete _0x88e7fe[_0xca41('0x46')]['id'];}return db[_0xca41('0x39')][_0xca41('0x44')]({'where':{'id':_0x88e7fe[_0xca41('0x40')]['id']}})[_0xca41('0x3c')](handleEntityNotFound(_0x3b78a4,null))[_0xca41('0x3c')](saveUpdates(_0x88e7fe[_0xca41('0x46')],null))[_0xca41('0x3c')](respondWithResult(_0x3b78a4,null))[_0xca41('0x3e')](handleError(_0x3b78a4,null));};exports[_0xca41('0x22')]=function(_0x1ade50,_0x4e5ebd){return db[_0xca41('0x39')]['find']({'where':{'id':_0x1ade50[_0xca41('0x40')]['id']}})[_0xca41('0x3c')](handleEntityNotFound(_0x4e5ebd,null))['then'](removeEntity(_0x4e5ebd,null))[_0xca41('0x3e')](handleError(_0x4e5ebd,null));};exports[_0xca41('0x47')]=function(_0x30af54,_0x57b8db,_0x23fb6c){var _0x475d45={};var _0xa4050e={};var _0x25767b;var _0x24f6cf;return db['Dynamics365Configuration'][_0xca41('0x48')]({'where':{'id':_0x30af54[_0xca41('0x40')]['id']}})[_0xca41('0x3c')](handleEntityNotFound(_0x57b8db,null))[_0xca41('0x3c')](function(_0x12019a){if(_0x12019a){_0x25767b=_0x12019a;_0xa4050e['model']=_[_0xca41('0x41')](db[_0xca41('0x49')][_0xca41('0x27')]);_0xa4050e[_0xca41('0x2c')]=_[_0xca41('0x41')](_0x30af54['query']);_0xa4050e[_0xca41('0x2d')]=_[_0xca41('0x2e')](_0xa4050e[_0xca41('0x30')],_0xa4050e['query']);_0x475d45['attributes']=_[_0xca41('0x2e')](_0xa4050e[_0xca41('0x30')],qs[_0xca41('0x31')](_0x30af54[_0xca41('0x2c')][_0xca41('0x31')]));_0x475d45['attributes']=_0x475d45[_0xca41('0x2f')][_0xca41('0x42')]?_0x475d45[_0xca41('0x2f')]:_0xa4050e[_0xca41('0x30')];_0x475d45[_0xca41('0x33')]=qs[_0xca41('0x4a')](_0x30af54['query'][_0xca41('0x4a')]);_0x475d45[_0xca41('0x34')]=qs[_0xca41('0x2d')](_[_0xca41('0x35')](_0x30af54[_0xca41('0x2c')],_0xa4050e['filters']));if(_0x30af54[_0xca41('0x2c')][_0xca41('0x36')]){_0x475d45[_0xca41('0x34')]=_[_0xca41('0x38')](_0x475d45[_0xca41('0x34')],{'$or':_[_0xca41('0x2b')](_0x475d45['attributes'],function(_0x496384){var _0x353a59={};_0x353a59[_0x496384]={'$like':'%'+_0x30af54[_0xca41('0x2c')][_0xca41('0x36')]+'%'};return _0x353a59;})});}_0x475d45=_['merge']({},_0x475d45,_0x30af54['options']);return _0x25767b[_0xca41('0x47')](_0x475d45);}})['then'](function(_0x14c189){if(_0x14c189){_0x24f6cf=_0x14c189['length'];if(!_0x30af54[_0xca41('0x2c')]['hasOwnProperty'](_0xca41('0x4b'))){_0x475d45['limit']=qs[_0xca41('0x1b')](_0x30af54[_0xca41('0x2c')]['limit']);_0x475d45['offset']=qs['offset'](_0x30af54[_0xca41('0x2c')]['offset']);}return _0x25767b[_0xca41('0x47')](_0x475d45);}})[_0xca41('0x3c')](function(_0x7986dd){if(_0x7986dd){return _0x7986dd?{'count':_0x24f6cf,'rows':_0x7986dd}:null;}})[_0xca41('0x3c')](respondWithResult(_0x57b8db,null))[_0xca41('0x3e')](handleError(_0x57b8db,null));};exports['getSubjects']=function(_0x442fd5,_0x513660,_0x430965){var _0x333b5c={};var _0x92a28a={};var _0x4e1e04;var _0x5c8711;return db['Dynamics365Configuration'][_0xca41('0x48')]({'where':{'id':_0x442fd5['params']['id']}})[_0xca41('0x3c')](handleEntityNotFound(_0x513660,null))[_0xca41('0x3c')](function(_0x45993d){if(_0x45993d){_0x4e1e04=_0x45993d;_0x92a28a[_0xca41('0x30')]=_[_0xca41('0x41')](db[_0xca41('0x49')]['rawAttributes']);_0x92a28a[_0xca41('0x2c')]=_[_0xca41('0x41')](_0x442fd5[_0xca41('0x2c')]);_0x92a28a[_0xca41('0x2d')]=_[_0xca41('0x2e')](_0x92a28a[_0xca41('0x30')],_0x92a28a[_0xca41('0x2c')]);_0x333b5c[_0xca41('0x2f')]=_[_0xca41('0x2e')](_0x92a28a[_0xca41('0x30')],qs[_0xca41('0x31')](_0x442fd5[_0xca41('0x2c')]['fields']));_0x333b5c[_0xca41('0x2f')]=_0x333b5c[_0xca41('0x2f')][_0xca41('0x42')]?_0x333b5c['attributes']:_0x92a28a[_0xca41('0x30')];_0x333b5c[_0xca41('0x33')]=qs[_0xca41('0x4a')](_0x442fd5[_0xca41('0x2c')]['sort']);_0x333b5c[_0xca41('0x34')]=qs[_0xca41('0x2d')](_['pick'](_0x442fd5[_0xca41('0x2c')],_0x92a28a[_0xca41('0x2d')]));if(_0x442fd5[_0xca41('0x2c')][_0xca41('0x36')]){_0x333b5c[_0xca41('0x34')]=_[_0xca41('0x38')](_0x333b5c[_0xca41('0x34')],{'$or':_[_0xca41('0x2b')](_0x333b5c[_0xca41('0x2f')],function(_0x5ae08b){var _0x492a03={};_0x492a03[_0x5ae08b]={'$like':'%'+_0x442fd5[_0xca41('0x2c')][_0xca41('0x36')]+'%'};return _0x492a03;})});}_0x333b5c=_['merge']({},_0x333b5c,_0x442fd5[_0xca41('0x43')]);return _0x4e1e04['getSubjects'](_0x333b5c);}})['then'](function(_0x5c3cc6){if(_0x5c3cc6){_0x5c8711=_0x5c3cc6[_0xca41('0x42')];if(!_0x442fd5['query'][_0xca41('0x32')]('nolimit')){_0x333b5c[_0xca41('0x1b')]=qs[_0xca41('0x1b')](_0x442fd5['query'][_0xca41('0x1b')]);_0x333b5c['offset']=qs[_0xca41('0x19')](_0x442fd5[_0xca41('0x2c')][_0xca41('0x19')]);}return _0x4e1e04[_0xca41('0x4c')](_0x333b5c);}})[_0xca41('0x3c')](function(_0x17ebb9){if(_0x17ebb9){return _0x17ebb9?{'count':_0x5c8711,'rows':_0x17ebb9}:null;}})[_0xca41('0x3c')](respondWithResult(_0x513660,null))['catch'](handleError(_0x513660,null));};exports[_0xca41('0x4d')]=function(_0xe58549,_0x126ebd,_0x579286){var _0x22eeb0={};var _0x10af7d={};var _0x42ccd4;var _0x5a66bd;return db[_0xca41('0x39')][_0xca41('0x48')]({'where':{'id':_0xe58549[_0xca41('0x40')]['id']}})['then'](handleEntityNotFound(_0x126ebd,null))[_0xca41('0x3c')](function(_0x51671a){if(_0x51671a){_0x42ccd4=_0x51671a;_0x10af7d[_0xca41('0x30')]=_[_0xca41('0x41')](db['Dynamics365Field'][_0xca41('0x27')]);_0x10af7d[_0xca41('0x2c')]=_[_0xca41('0x41')](_0xe58549[_0xca41('0x2c')]);_0x10af7d[_0xca41('0x2d')]=_['intersection'](_0x10af7d['model'],_0x10af7d['query']);_0x22eeb0[_0xca41('0x2f')]=_[_0xca41('0x2e')](_0x10af7d[_0xca41('0x30')],qs['fields'](_0xe58549[_0xca41('0x2c')][_0xca41('0x31')]));_0x22eeb0['attributes']=_0x22eeb0[_0xca41('0x2f')][_0xca41('0x42')]?_0x22eeb0[_0xca41('0x2f')]:_0x10af7d['model'];_0x22eeb0[_0xca41('0x33')]=qs[_0xca41('0x4a')](_0xe58549[_0xca41('0x2c')]['sort']);_0x22eeb0[_0xca41('0x34')]=qs[_0xca41('0x2d')](_[_0xca41('0x35')](_0xe58549['query'],_0x10af7d[_0xca41('0x2d')]));if(_0xe58549[_0xca41('0x2c')][_0xca41('0x36')]){_0x22eeb0[_0xca41('0x34')]=_[_0xca41('0x38')](_0x22eeb0['where'],{'$or':_[_0xca41('0x2b')](_0x22eeb0['attributes'],function(_0x32033d){var _0x46d740={};_0x46d740[_0x32033d]={'$like':'%'+_0xe58549['query'][_0xca41('0x36')]+'%'};return _0x46d740;})});}_0x22eeb0=_[_0xca41('0x38')]({},_0x22eeb0,_0xe58549[_0xca41('0x43')]);return _0x42ccd4['getDescriptions'](_0x22eeb0);}})[_0xca41('0x3c')](function(_0x51e348){if(_0x51e348){_0x5a66bd=_0x51e348[_0xca41('0x42')];if(!_0xe58549['query'][_0xca41('0x32')](_0xca41('0x4b'))){_0x22eeb0[_0xca41('0x1b')]=qs['limit'](_0xe58549[_0xca41('0x2c')][_0xca41('0x1b')]);_0x22eeb0['offset']=qs[_0xca41('0x19')](_0xe58549[_0xca41('0x2c')]['offset']);}return _0x42ccd4['getDescriptions'](_0x22eeb0);}})[_0xca41('0x3c')](function(_0x347f7e){if(_0x347f7e){return _0x347f7e?{'count':_0x5a66bd,'rows':_0x347f7e}:null;}})[_0xca41('0x3c')](respondWithResult(_0x126ebd,null))[_0xca41('0x3e')](handleError(_0x126ebd,null));}; \ No newline at end of file +var _0xc9e0=['attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','length','include','find','create','body','params','getFields','findOne','Dynamics365Field','rawAttributes','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','type','model','keys','query','intersection','fields'];(function(_0x4d36a4,_0x303dd0){var _0x8d4548=function(_0x295887){while(--_0x295887){_0x4d36a4['push'](_0x4d36a4['shift']());}};_0x8d4548(++_0x303dd0);}(_0xc9e0,0xb4));var _0x0c9e=function(_0x41245d,_0x4fbee2){_0x41245d=_0x41245d-0x0;var _0x3e6f5c=_0xc9e0[_0x41245d];return _0x3e6f5c;};'use strict';var emlformat=require(_0x0c9e('0x0'));var rimraf=require(_0x0c9e('0x1'));var zipdir=require(_0x0c9e('0x2'));var jsonpatch=require(_0x0c9e('0x3'));var rp=require('request-promise');var moment=require(_0x0c9e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0c9e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0c9e('0x6'));var crypto=require(_0x0c9e('0x7'));var jsforce=require(_0x0c9e('0x8'));var deskjs=require(_0x0c9e('0x9'));var toCsv=require(_0x0c9e('0xa'));var querystring=require(_0x0c9e('0xb'));var Papa=require('papaparse');var Redis=require(_0x0c9e('0xc'));var authService=require(_0x0c9e('0xd'));var qs=require(_0x0c9e('0xe'));var as=require(_0x0c9e('0xf'));var hardwareService=require(_0x0c9e('0x10'));var logger=require(_0x0c9e('0x11'))(_0x0c9e('0x12'));var utils=require(_0x0c9e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0c9e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23374c,_0x7118ca){_0x7118ca=_0x7118ca||0xcc;return function(_0x330929){if(_0x330929){return _0x23374c[_0x0c9e('0x15')](_0x7118ca);}return _0x23374c[_0x0c9e('0x16')](_0x7118ca)[_0x0c9e('0x17')]();};}function respondWithResult(_0x3fa2e4,_0x2fbf5c){_0x2fbf5c=_0x2fbf5c||0xc8;return function(_0x479c7a){if(_0x479c7a){return _0x3fa2e4['status'](_0x2fbf5c)[_0x0c9e('0x18')](_0x479c7a);}};}function respondWithFilteredResult(_0x87630f,_0x330fe2){return function(_0x50c67a){if(_0x50c67a){var _0x4ee66e=typeof _0x330fe2['offset']===_0x0c9e('0x19')&&typeof _0x330fe2[_0x0c9e('0x1a')]===_0x0c9e('0x19');var _0x12abbf=_0x50c67a[_0x0c9e('0x1b')];var _0x227207=_0x4ee66e?0x0:_0x330fe2[_0x0c9e('0x1c')];var _0x5810bf=_0x4ee66e?_0x50c67a[_0x0c9e('0x1b')]:_0x330fe2[_0x0c9e('0x1c')]+_0x330fe2[_0x0c9e('0x1a')];var _0x5ba8da;if(_0x5810bf>=_0x12abbf){_0x5810bf=_0x12abbf;_0x5ba8da=0xc8;}else{_0x5ba8da=0xce;}_0x87630f[_0x0c9e('0x16')](_0x5ba8da);return _0x87630f[_0x0c9e('0x1d')](_0x0c9e('0x1e'),_0x227207+'-'+_0x5810bf+'/'+_0x12abbf)[_0x0c9e('0x18')](_0x50c67a);}return null;};}function patchUpdates(_0x111b83){return function(_0x127abb){try{jsonpatch[_0x0c9e('0x1f')](_0x127abb,_0x111b83,!![]);}catch(_0x69560f){return BPromise['reject'](_0x69560f);}return _0x127abb[_0x0c9e('0x20')]();};}function saveUpdates(_0x5037a7,_0x2abc4e){return function(_0x362190){if(_0x362190){return _0x362190[_0x0c9e('0x21')](_0x5037a7)[_0x0c9e('0x22')](function(_0x1708ed){return _0x1708ed;});}return null;};}function removeEntity(_0x8f0b59,_0x5e7f0a){return function(_0x185e70){if(_0x185e70){return _0x185e70[_0x0c9e('0x23')]()[_0x0c9e('0x22')](function(){_0x8f0b59[_0x0c9e('0x16')](0xcc)[_0x0c9e('0x17')]();});}};}function handleEntityNotFound(_0x5dd55d,_0x17ad4b){return function(_0x3256d4){if(!_0x3256d4){_0x5dd55d[_0x0c9e('0x15')](0x194);}return _0x3256d4;};}function handleError(_0x1a05c1,_0xbd4234){_0xbd4234=_0xbd4234||0x1f4;return function(_0x41ec38){logger[_0x0c9e('0x24')](_0x41ec38['stack']);if(_0x41ec38[_0x0c9e('0x25')]){delete _0x41ec38[_0x0c9e('0x25')];}_0x1a05c1[_0x0c9e('0x16')](_0xbd4234)[_0x0c9e('0x26')](_0x41ec38);};}exports[_0x0c9e('0x27')]=function(_0x26ea2f,_0x54f591){var _0xe60912={},_0x49ec8a={},_0x217f23={'count':0x0,'rows':[]};var _0x599f2f=_[_0x0c9e('0x28')](db[_0x0c9e('0x29')]['rawAttributes'],function(_0x1cf11f){return{'name':_0x1cf11f['fieldName'],'type':_0x1cf11f[_0x0c9e('0x2a')]['key']};});_0x49ec8a[_0x0c9e('0x2b')]=_[_0x0c9e('0x28')](_0x599f2f,_0x0c9e('0x25'));_0x49ec8a['query']=_[_0x0c9e('0x2c')](_0x26ea2f[_0x0c9e('0x2d')]);_0x49ec8a['filters']=_['intersection'](_0x49ec8a['model'],_0x49ec8a['query']);_0xe60912['attributes']=_[_0x0c9e('0x2e')](_0x49ec8a[_0x0c9e('0x2b')],qs[_0x0c9e('0x2f')](_0x26ea2f[_0x0c9e('0x2d')][_0x0c9e('0x2f')]));_0xe60912[_0x0c9e('0x30')]=_0xe60912['attributes']['length']?_0xe60912[_0x0c9e('0x30')]:_0x49ec8a[_0x0c9e('0x2b')];if(!_0x26ea2f[_0x0c9e('0x2d')][_0x0c9e('0x31')]('nolimit')){_0xe60912[_0x0c9e('0x1a')]=qs[_0x0c9e('0x1a')](_0x26ea2f[_0x0c9e('0x2d')][_0x0c9e('0x1a')]);_0xe60912['offset']=qs[_0x0c9e('0x1c')](_0x26ea2f[_0x0c9e('0x2d')][_0x0c9e('0x1c')]);}_0xe60912[_0x0c9e('0x32')]=qs[_0x0c9e('0x33')](_0x26ea2f['query'][_0x0c9e('0x33')]);_0xe60912[_0x0c9e('0x34')]=qs[_0x0c9e('0x35')](_[_0x0c9e('0x36')](_0x26ea2f[_0x0c9e('0x2d')],_0x49ec8a[_0x0c9e('0x35')]),_0x599f2f);if(_0x26ea2f[_0x0c9e('0x2d')][_0x0c9e('0x37')]){_0xe60912['where']=_['merge'](_0xe60912[_0x0c9e('0x34')],{'$or':_[_0x0c9e('0x28')](_0x599f2f,function(_0x410775){if(_0x410775['type']!==_0x0c9e('0x38')){var _0x338c1b={};_0x338c1b[_0x410775[_0x0c9e('0x25')]]={'$like':'%'+_0x26ea2f[_0x0c9e('0x2d')]['filter']+'%'};return _0x338c1b;}})});}_0xe60912=_[_0x0c9e('0x39')]({},_0xe60912,_0x26ea2f[_0x0c9e('0x3a')]);var _0x2d1c00={'where':_0xe60912[_0x0c9e('0x34')]};return db['Dynamics365Configuration'][_0x0c9e('0x1b')](_0x2d1c00)['then'](function(_0x3a7e86){_0x217f23[_0x0c9e('0x1b')]=_0x3a7e86;if(_0x26ea2f['query'][_0x0c9e('0x3b')]){_0xe60912['include']=[{'all':!![]}];}return db[_0x0c9e('0x29')][_0x0c9e('0x3c')](_0xe60912);})['then'](function(_0x52d81c){_0x217f23[_0x0c9e('0x3d')]=_0x52d81c;return _0x217f23;})[_0x0c9e('0x22')](respondWithFilteredResult(_0x54f591,_0xe60912))[_0x0c9e('0x3e')](handleError(_0x54f591,null));};exports['show']=function(_0x398473,_0x2ec8ba){var _0x54c00c={'raw':![],'where':{'id':_0x398473['params']['id']}},_0x449f34={};_0x449f34[_0x0c9e('0x2b')]=_[_0x0c9e('0x2c')](db[_0x0c9e('0x29')]['rawAttributes']);_0x449f34[_0x0c9e('0x2d')]=_[_0x0c9e('0x2c')](_0x398473[_0x0c9e('0x2d')]);_0x449f34['filters']=_[_0x0c9e('0x2e')](_0x449f34[_0x0c9e('0x2b')],_0x449f34[_0x0c9e('0x2d')]);_0x54c00c[_0x0c9e('0x30')]=_[_0x0c9e('0x2e')](_0x449f34['model'],qs[_0x0c9e('0x2f')](_0x398473[_0x0c9e('0x2d')]['fields']));_0x54c00c['attributes']=_0x54c00c[_0x0c9e('0x30')][_0x0c9e('0x3f')]?_0x54c00c[_0x0c9e('0x30')]:_0x449f34['model'];if(_0x398473[_0x0c9e('0x2d')][_0x0c9e('0x3b')]){_0x54c00c[_0x0c9e('0x40')]=[{'all':!![]}];}_0x54c00c=_[_0x0c9e('0x39')]({},_0x54c00c,_0x398473[_0x0c9e('0x3a')]);return db[_0x0c9e('0x29')][_0x0c9e('0x41')](_0x54c00c)[_0x0c9e('0x22')](handleEntityNotFound(_0x2ec8ba,null))[_0x0c9e('0x22')](respondWithResult(_0x2ec8ba,null))[_0x0c9e('0x3e')](handleError(_0x2ec8ba,null));};exports['create']=function(_0x4b2894,_0x4becfc){return db[_0x0c9e('0x29')][_0x0c9e('0x42')](_0x4b2894[_0x0c9e('0x43')],{})[_0x0c9e('0x22')](respondWithResult(_0x4becfc,0xc9))[_0x0c9e('0x3e')](handleError(_0x4becfc,null));};exports[_0x0c9e('0x21')]=function(_0x2e9b8c,_0x3861d9){if(_0x2e9b8c[_0x0c9e('0x43')]['id']){delete _0x2e9b8c['body']['id'];}return db[_0x0c9e('0x29')][_0x0c9e('0x41')]({'where':{'id':_0x2e9b8c[_0x0c9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3861d9,null))['then'](saveUpdates(_0x2e9b8c[_0x0c9e('0x43')],null))[_0x0c9e('0x22')](respondWithResult(_0x3861d9,null))[_0x0c9e('0x3e')](handleError(_0x3861d9,null));};exports['destroy']=function(_0x237148,_0x47d161){return db[_0x0c9e('0x29')]['find']({'where':{'id':_0x237148['params']['id']}})[_0x0c9e('0x22')](handleEntityNotFound(_0x47d161,null))['then'](removeEntity(_0x47d161,null))['catch'](handleError(_0x47d161,null));};exports[_0x0c9e('0x45')]=function(_0x3397e1,_0x3ab6df,_0x130b35){var _0x4ce55b={};var _0xc83305={};var _0x10994e;var _0x23caee;return db[_0x0c9e('0x29')][_0x0c9e('0x46')]({'where':{'id':_0x3397e1['params']['id']}})['then'](handleEntityNotFound(_0x3ab6df,null))[_0x0c9e('0x22')](function(_0x1386bd){if(_0x1386bd){_0x10994e=_0x1386bd;_0xc83305['model']=_[_0x0c9e('0x2c')](db[_0x0c9e('0x47')][_0x0c9e('0x48')]);_0xc83305[_0x0c9e('0x2d')]=_[_0x0c9e('0x2c')](_0x3397e1['query']);_0xc83305['filters']=_[_0x0c9e('0x2e')](_0xc83305['model'],_0xc83305[_0x0c9e('0x2d')]);_0x4ce55b[_0x0c9e('0x30')]=_[_0x0c9e('0x2e')](_0xc83305[_0x0c9e('0x2b')],qs[_0x0c9e('0x2f')](_0x3397e1['query'][_0x0c9e('0x2f')]));_0x4ce55b[_0x0c9e('0x30')]=_0x4ce55b[_0x0c9e('0x30')][_0x0c9e('0x3f')]?_0x4ce55b['attributes']:_0xc83305[_0x0c9e('0x2b')];_0x4ce55b[_0x0c9e('0x32')]=qs[_0x0c9e('0x33')](_0x3397e1[_0x0c9e('0x2d')][_0x0c9e('0x33')]);_0x4ce55b['where']=qs[_0x0c9e('0x35')](_[_0x0c9e('0x36')](_0x3397e1[_0x0c9e('0x2d')],_0xc83305[_0x0c9e('0x35')]));if(_0x3397e1[_0x0c9e('0x2d')]['filter']){_0x4ce55b[_0x0c9e('0x34')]=_[_0x0c9e('0x39')](_0x4ce55b[_0x0c9e('0x34')],{'$or':_[_0x0c9e('0x28')](_0x4ce55b[_0x0c9e('0x30')],function(_0x1a7bea){var _0x28064c={};_0x28064c[_0x1a7bea]={'$like':'%'+_0x3397e1['query'][_0x0c9e('0x37')]+'%'};return _0x28064c;})});}_0x4ce55b=_[_0x0c9e('0x39')]({},_0x4ce55b,_0x3397e1[_0x0c9e('0x3a')]);return _0x10994e[_0x0c9e('0x45')](_0x4ce55b);}})[_0x0c9e('0x22')](function(_0x54888d){if(_0x54888d){_0x23caee=_0x54888d[_0x0c9e('0x3f')];if(!_0x3397e1[_0x0c9e('0x2d')][_0x0c9e('0x31')](_0x0c9e('0x49'))){_0x4ce55b[_0x0c9e('0x1a')]=qs['limit'](_0x3397e1[_0x0c9e('0x2d')]['limit']);_0x4ce55b[_0x0c9e('0x1c')]=qs['offset'](_0x3397e1['query'][_0x0c9e('0x1c')]);}return _0x10994e[_0x0c9e('0x45')](_0x4ce55b);}})[_0x0c9e('0x22')](function(_0x1f011c){if(_0x1f011c){return _0x1f011c?{'count':_0x23caee,'rows':_0x1f011c}:null;}})[_0x0c9e('0x22')](respondWithResult(_0x3ab6df,null))['catch'](handleError(_0x3ab6df,null));};exports[_0x0c9e('0x4a')]=function(_0x11cd07,_0xc4c579,_0x33af7b){var _0x5f2eff={};var _0x263454={};var _0x19d7c9;var _0x4c5fe0;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x11cd07[_0x0c9e('0x44')]['id']}})[_0x0c9e('0x22')](handleEntityNotFound(_0xc4c579,null))[_0x0c9e('0x22')](function(_0x3f1a21){if(_0x3f1a21){_0x19d7c9=_0x3f1a21;_0x263454[_0x0c9e('0x2b')]=_[_0x0c9e('0x2c')](db['Dynamics365Field'][_0x0c9e('0x48')]);_0x263454[_0x0c9e('0x2d')]=_[_0x0c9e('0x2c')](_0x11cd07[_0x0c9e('0x2d')]);_0x263454['filters']=_[_0x0c9e('0x2e')](_0x263454[_0x0c9e('0x2b')],_0x263454['query']);_0x5f2eff[_0x0c9e('0x30')]=_[_0x0c9e('0x2e')](_0x263454['model'],qs[_0x0c9e('0x2f')](_0x11cd07[_0x0c9e('0x2d')][_0x0c9e('0x2f')]));_0x5f2eff[_0x0c9e('0x30')]=_0x5f2eff[_0x0c9e('0x30')][_0x0c9e('0x3f')]?_0x5f2eff[_0x0c9e('0x30')]:_0x263454[_0x0c9e('0x2b')];_0x5f2eff[_0x0c9e('0x32')]=qs['sort'](_0x11cd07['query'][_0x0c9e('0x33')]);_0x5f2eff[_0x0c9e('0x34')]=qs[_0x0c9e('0x35')](_[_0x0c9e('0x36')](_0x11cd07[_0x0c9e('0x2d')],_0x263454[_0x0c9e('0x35')]));if(_0x11cd07[_0x0c9e('0x2d')][_0x0c9e('0x37')]){_0x5f2eff[_0x0c9e('0x34')]=_[_0x0c9e('0x39')](_0x5f2eff['where'],{'$or':_[_0x0c9e('0x28')](_0x5f2eff[_0x0c9e('0x30')],function(_0x46dd73){var _0xe2b479={};_0xe2b479[_0x46dd73]={'$like':'%'+_0x11cd07[_0x0c9e('0x2d')][_0x0c9e('0x37')]+'%'};return _0xe2b479;})});}_0x5f2eff=_[_0x0c9e('0x39')]({},_0x5f2eff,_0x11cd07['options']);return _0x19d7c9['getSubjects'](_0x5f2eff);}})[_0x0c9e('0x22')](function(_0x230f11){if(_0x230f11){_0x4c5fe0=_0x230f11[_0x0c9e('0x3f')];if(!_0x11cd07[_0x0c9e('0x2d')]['hasOwnProperty']('nolimit')){_0x5f2eff[_0x0c9e('0x1a')]=qs['limit'](_0x11cd07[_0x0c9e('0x2d')][_0x0c9e('0x1a')]);_0x5f2eff[_0x0c9e('0x1c')]=qs[_0x0c9e('0x1c')](_0x11cd07['query'][_0x0c9e('0x1c')]);}return _0x19d7c9[_0x0c9e('0x4a')](_0x5f2eff);}})[_0x0c9e('0x22')](function(_0x1765ad){if(_0x1765ad){return _0x1765ad?{'count':_0x4c5fe0,'rows':_0x1765ad}:null;}})[_0x0c9e('0x22')](respondWithResult(_0xc4c579,null))[_0x0c9e('0x3e')](handleError(_0xc4c579,null));};exports[_0x0c9e('0x4b')]=function(_0x5371be,_0x510ac6,_0x52e2cb){var _0x2d4a18={};var _0x293faf={};var _0x1bb558;var _0x43a0b8;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5371be[_0x0c9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x510ac6,null))['then'](function(_0x53d17d){if(_0x53d17d){_0x1bb558=_0x53d17d;_0x293faf[_0x0c9e('0x2b')]=_[_0x0c9e('0x2c')](db[_0x0c9e('0x47')][_0x0c9e('0x48')]);_0x293faf['query']=_[_0x0c9e('0x2c')](_0x5371be['query']);_0x293faf[_0x0c9e('0x35')]=_[_0x0c9e('0x2e')](_0x293faf[_0x0c9e('0x2b')],_0x293faf[_0x0c9e('0x2d')]);_0x2d4a18['attributes']=_['intersection'](_0x293faf[_0x0c9e('0x2b')],qs[_0x0c9e('0x2f')](_0x5371be['query'][_0x0c9e('0x2f')]));_0x2d4a18['attributes']=_0x2d4a18['attributes']['length']?_0x2d4a18['attributes']:_0x293faf[_0x0c9e('0x2b')];_0x2d4a18[_0x0c9e('0x32')]=qs[_0x0c9e('0x33')](_0x5371be['query'][_0x0c9e('0x33')]);_0x2d4a18[_0x0c9e('0x34')]=qs[_0x0c9e('0x35')](_[_0x0c9e('0x36')](_0x5371be[_0x0c9e('0x2d')],_0x293faf[_0x0c9e('0x35')]));if(_0x5371be[_0x0c9e('0x2d')]['filter']){_0x2d4a18[_0x0c9e('0x34')]=_[_0x0c9e('0x39')](_0x2d4a18[_0x0c9e('0x34')],{'$or':_['map'](_0x2d4a18[_0x0c9e('0x30')],function(_0x550093){var _0x20c9e8={};_0x20c9e8[_0x550093]={'$like':'%'+_0x5371be[_0x0c9e('0x2d')][_0x0c9e('0x37')]+'%'};return _0x20c9e8;})});}_0x2d4a18=_['merge']({},_0x2d4a18,_0x5371be[_0x0c9e('0x3a')]);return _0x1bb558['getDescriptions'](_0x2d4a18);}})[_0x0c9e('0x22')](function(_0x124636){if(_0x124636){_0x43a0b8=_0x124636[_0x0c9e('0x3f')];if(!_0x5371be[_0x0c9e('0x2d')][_0x0c9e('0x31')](_0x0c9e('0x49'))){_0x2d4a18['limit']=qs[_0x0c9e('0x1a')](_0x5371be[_0x0c9e('0x2d')]['limit']);_0x2d4a18[_0x0c9e('0x1c')]=qs['offset'](_0x5371be[_0x0c9e('0x2d')][_0x0c9e('0x1c')]);}return _0x1bb558[_0x0c9e('0x4b')](_0x2d4a18);}})[_0x0c9e('0x22')](function(_0x92a2d1){if(_0x92a2d1){return _0x92a2d1?{'count':_0x43a0b8,'rows':_0x92a2d1}:null;}})['then'](respondWithResult(_0x510ac6,null))[_0x0c9e('0x3e')](handleError(_0x510ac6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1c14339..a37f9e0 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 _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x4b84[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x177c40,_0x5e69ed){var _0x539cdc=function(_0x203d5a){while(--_0x203d5a){_0x177c40['push'](_0x177c40['shift']());}};_0x539cdc(++_0x5e69ed);}(_0xbec5,0xe5));var _0x5bec=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0xbec5[_0xc0638b];return _0xd57dfa;};'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 26b6699..27e409e 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 _0xe291=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x306174,_0x1230dd){var _0x5e6671=function(_0x26ff5d){while(--_0x26ff5d){_0x306174['push'](_0x306174['shift']());}};_0x5e6671(++_0x1230dd);}(_0xe291,0x173));var _0x1e29=function(_0x2941ec,_0x34c4fa){_0x2941ec=_0x2941ec-0x0;var _0x3e90ea=_0xe291[_0x2941ec];return _0x3e90ea;};'use strict';var _=require(_0x1e29('0x0'));var util=require(_0x1e29('0x1'));var moment=require(_0x1e29('0x2'));var BPromise=require(_0x1e29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e29('0x4'));var db=require(_0x1e29('0x5'))['db'];var utils=require(_0x1e29('0x6'));var logger=require(_0x1e29('0x7'))(_0x1e29('0x8'));var config=require(_0x1e29('0x9'));var jayson=require(_0x1e29('0xa'));var client=jayson[_0x1e29('0xb')][_0x1e29('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x110fb8,_0x1fb9e5,_0x2cd6af){return new BPromise(function(_0x12e76c,_0x70ba40){return client['request'](_0x110fb8,_0x2cd6af)['then'](function(_0x1fe2f8){logger[_0x1e29('0xd')](_0x1e29('0xe'),_0x1fb9e5,_0x1e29('0xf'));logger[_0x1e29('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1fb9e5,_0x1e29('0xf'),JSON[_0x1e29('0x11')](_0x1fe2f8));if(_0x1fe2f8[_0x1e29('0x12')]){if(_0x1fe2f8[_0x1e29('0x12')][_0x1e29('0x13')]===0x1f4){logger[_0x1e29('0x12')](_0x1e29('0xe'),_0x1fb9e5,_0x1fe2f8[_0x1e29('0x12')]['message']);return _0x70ba40(_0x1fe2f8[_0x1e29('0x12')]['message']);}logger[_0x1e29('0x12')](_0x1e29('0xe'),_0x1fb9e5,_0x1fe2f8['error'][_0x1e29('0x14')]);return _0x12e76c(_0x1fe2f8['error'][_0x1e29('0x14')]);}else{logger[_0x1e29('0xd')](_0x1e29('0xe'),_0x1fb9e5,_0x1e29('0xf'));_0x12e76c(_0x1fe2f8[_0x1e29('0x15')][_0x1e29('0x14')]);}})[_0x1e29('0x16')](function(_0x3ce939){logger['error'](_0x1e29('0xe'),_0x1fb9e5,_0x3ce939);_0x70ba40(_0x3ce939);});});} \ No newline at end of file +var _0xb332=['../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x23b47c,_0xf16eff){var _0x471210=function(_0x5a077f){while(--_0x5a077f){_0x23b47c['push'](_0x23b47c['shift']());}};_0x471210(++_0xf16eff);}(_0xb332,0x175));var _0x2b33=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0xb332[_0xb725be];return _0x2f2424;};'use strict';var _=require(_0x2b33('0x0'));var util=require(_0x2b33('0x1'));var moment=require(_0x2b33('0x2'));var BPromise=require(_0x2b33('0x3'));var rs=require(_0x2b33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b33('0x5'))(_0x2b33('0x6'));var config=require(_0x2b33('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2b33('0x8')][_0x2b33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4252b,_0x2bf209,_0x354888){return new BPromise(function(_0x2ef697,_0x22fd60){return client['request'](_0x4252b,_0x354888)[_0x2b33('0xa')](function(_0x474662){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2bf209,_0x2b33('0xb'));logger[_0x2b33('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2bf209,'request\x20sent',JSON[_0x2b33('0xd')](_0x474662));if(_0x474662[_0x2b33('0xe')]){if(_0x474662[_0x2b33('0xe')][_0x2b33('0xf')]===0x1f4){logger[_0x2b33('0xe')](_0x2b33('0x10'),_0x2bf209,_0x474662[_0x2b33('0xe')]['message']);return _0x22fd60(_0x474662[_0x2b33('0xe')]['message']);}logger[_0x2b33('0xe')](_0x2b33('0x10'),_0x2bf209,_0x474662[_0x2b33('0xe')]['message']);return _0x2ef697(_0x474662[_0x2b33('0xe')][_0x2b33('0x11')]);}else{logger[_0x2b33('0x12')](_0x2b33('0x10'),_0x2bf209,_0x2b33('0xb'));_0x2ef697(_0x474662[_0x2b33('0x13')]['message']);}})[_0x2b33('0x14')](function(_0x863515){logger[_0x2b33('0xe')](_0x2b33('0x10'),_0x2bf209,_0x863515);_0x22fd60(_0x863515);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3da2acc..afad36a 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 _0x398d=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xcb1295,_0x4c8234){var _0x2c5255=function(_0x4831e7){while(--_0x4831e7){_0xcb1295['push'](_0xcb1295['shift']());}};_0x2c5255(++_0x4c8234);}(_0x398d,0x68));var _0xd398=function(_0x51eb74,_0x58f887){_0x51eb74=_0x51eb74-0x0;var _0x43afe1=_0x398d[_0x51eb74];return _0x43afe1;};'use strict';var multer=require(_0xd398('0x0'));var util=require(_0xd398('0x1'));var path=require(_0xd398('0x2'));var timeout=require(_0xd398('0x3'));var express=require(_0xd398('0x4'));var router=express[_0xd398('0x5')]();var fs_extra=require(_0xd398('0x6'));var auth=require(_0xd398('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd398('0x8'));var controller=require(_0xd398('0x9'));router[_0xd398('0xa')]('/',auth[_0xd398('0xb')](),controller[_0xd398('0xc')]);router[_0xd398('0xa')](_0xd398('0xd'),auth['isAuthenticated'](),controller[_0xd398('0xe')]);router[_0xd398('0xf')]('/',auth[_0xd398('0xb')](),controller['create']);router[_0xd398('0x10')](_0xd398('0xd'),auth['isAuthenticated'](),controller[_0xd398('0x11')]);router[_0xd398('0x12')](_0xd398('0xd'),auth[_0xd398('0xb')](),controller[_0xd398('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2e9f=['multer','util','express','Router','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports'];(function(_0x3dd67e,_0x170306){var _0x5a1757=function(_0x6d6140){while(--_0x6d6140){_0x3dd67e['push'](_0x3dd67e['shift']());}};_0x5a1757(++_0x170306);}(_0x2e9f,0x18c));var _0xf2e9=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x2e9f[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xf2e9('0x0'));var util=require(_0xf2e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf2e9('0x2'));var router=express[_0xf2e9('0x3')]();var fs_extra=require(_0xf2e9('0x4'));var auth=require(_0xf2e9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2e9('0x6'));router[_0xf2e9('0x7')]('/',auth['isAuthenticated'](),controller[_0xf2e9('0x8')]);router[_0xf2e9('0x7')](_0xf2e9('0x9'),auth[_0xf2e9('0xa')](),controller[_0xf2e9('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf2e9('0xc')]);router[_0xf2e9('0xd')]('/:id',auth[_0xf2e9('0xa')](),controller[_0xf2e9('0xe')]);router[_0xf2e9('0xf')](_0xf2e9('0x9'),auth[_0xf2e9('0xa')](),controller[_0xf2e9('0x10')]);module[_0xf2e9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 0174217..069e4e7 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 _0x1ed6=['string','variable','BOOLEAN','sequelize','ENUM','customVariable','keyValue','STRING'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x1ed6,0x163));var _0x61ed=function(_0x198830,_0x41d589){_0x198830=_0x198830-0x0;var _0x2e66cc=_0x1ed6[_0x198830];return _0x2e66cc;};'use strict';var Sequelize=require(_0x61ed('0x0'));module['exports']={'type':{'type':Sequelize[_0x61ed('0x1')]('string','variable',_0x61ed('0x2'),_0x61ed('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x61ed('0x4')]},'keyType':{'type':Sequelize[_0x61ed('0x1')](_0x61ed('0x5'),_0x61ed('0x6'),_0x61ed('0x2'))},'keyContent':{'type':Sequelize[_0x61ed('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x61ed('0x4')]},'customField':{'type':Sequelize[_0x61ed('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0006=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0x0006,0x6f));var _0x6000=function(_0x4a0677,_0x4416ca){_0x4a0677=_0x4a0677-0x0;var _0x423552=_0x0006[_0x4a0677];return _0x423552;};'use strict';var Sequelize=require(_0x6000('0x0'));module[_0x6000('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6000('0x2'),_0x6000('0x3'),_0x6000('0x4'),_0x6000('0x5'),_0x6000('0x6')),'defaultValue':_0x6000('0x2')},'content':{'type':Sequelize[_0x6000('0x7')]},'key':{'type':Sequelize[_0x6000('0x7')]},'keyType':{'type':Sequelize[_0x6000('0x8')](_0x6000('0x2'),_0x6000('0x3'),_0x6000('0x4'))},'keyContent':{'type':Sequelize[_0x6000('0x7')]},'idField':{'type':Sequelize[_0x6000('0x7')]},'nameField':{'type':Sequelize[_0x6000('0x7')]},'customField':{'type':Sequelize[_0x6000('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6000('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2b6aa1f..22e84d6 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 _0xfb83=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','name','send','index','map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','show','rawAttributes','options','catch','create','body','find','params','destroy'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfb83,0x124));var _0x3fb8=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0xfb83[_0x329437];return _0x3789d9;};'use strict';var emlformat=require(_0x3fb8('0x0'));var rimraf=require(_0x3fb8('0x1'));var zipdir=require(_0x3fb8('0x2'));var jsonpatch=require(_0x3fb8('0x3'));var rp=require(_0x3fb8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3fb8('0x5'));var util=require(_0x3fb8('0x6'));var path=require(_0x3fb8('0x7'));var sox=require(_0x3fb8('0x8'));var csv=require(_0x3fb8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fb8('0xa'));var squel=require(_0x3fb8('0xb'));var crypto=require(_0x3fb8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fb8('0xd'));var toCsv=require(_0x3fb8('0x9'));var querystring=require(_0x3fb8('0xe'));var Papa=require('papaparse');var Redis=require(_0x3fb8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3fb8('0x10'));var as=require(_0x3fb8('0x11'));var hardwareService=require(_0x3fb8('0x12'));var logger=require(_0x3fb8('0x13'))(_0x3fb8('0x14'));var utils=require(_0x3fb8('0x15'));var config=require(_0x3fb8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fb8('0x17'))['db'];function respondWithStatusCode(_0x33f72d,_0x447727){_0x447727=_0x447727||0xcc;return function(_0x1f38ba){if(_0x1f38ba){return _0x33f72d['sendStatus'](_0x447727);}return _0x33f72d[_0x3fb8('0x18')](_0x447727)[_0x3fb8('0x19')]();};}function respondWithResult(_0x4e7e89,_0x5ac8){_0x5ac8=_0x5ac8||0xc8;return function(_0x790740){if(_0x790740){return _0x4e7e89[_0x3fb8('0x18')](_0x5ac8)['json'](_0x790740);}};}function respondWithFilteredResult(_0x3eed79,_0x573951){return function(_0x41baf2){if(_0x41baf2){var _0x5a3374=typeof _0x573951[_0x3fb8('0x1a')]===_0x3fb8('0x1b')&&typeof _0x573951[_0x3fb8('0x1c')]===_0x3fb8('0x1b');var _0x2d6bbb=_0x41baf2['count'];var _0x333ed5=_0x5a3374?0x0:_0x573951['offset'];var _0x373d38=_0x5a3374?_0x41baf2[_0x3fb8('0x1d')]:_0x573951[_0x3fb8('0x1a')]+_0x573951['limit'];var _0x389cc5;if(_0x373d38>=_0x2d6bbb){_0x373d38=_0x2d6bbb;_0x389cc5=0xc8;}else{_0x389cc5=0xce;}_0x3eed79[_0x3fb8('0x18')](_0x389cc5);return _0x3eed79[_0x3fb8('0x1e')](_0x3fb8('0x1f'),_0x333ed5+'-'+_0x373d38+'/'+_0x2d6bbb)[_0x3fb8('0x20')](_0x41baf2);}return null;};}function patchUpdates(_0x5b4869){return function(_0x48250){try{jsonpatch[_0x3fb8('0x21')](_0x48250,_0x5b4869,!![]);}catch(_0x1ecf7f){return BPromise[_0x3fb8('0x22')](_0x1ecf7f);}return _0x48250[_0x3fb8('0x23')]();};}function saveUpdates(_0x12b207,_0x36e62a){return function(_0x5649e2){if(_0x5649e2){return _0x5649e2[_0x3fb8('0x24')](_0x12b207)[_0x3fb8('0x25')](function(_0x3a1d44){return _0x3a1d44;});}return null;};}function removeEntity(_0x131c85,_0x2ee4b7){return function(_0x4ca39e){if(_0x4ca39e){return _0x4ca39e['destroy']()[_0x3fb8('0x25')](function(){_0x131c85[_0x3fb8('0x18')](0xcc)[_0x3fb8('0x19')]();});}};}function handleEntityNotFound(_0x241f14,_0x42e368){return function(_0x55d949){if(!_0x55d949){_0x241f14['sendStatus'](0x194);}return _0x55d949;};}function handleError(_0x39b5cc,_0x57905a){_0x57905a=_0x57905a||0x1f4;return function(_0x33fe12){logger['error'](_0x33fe12['stack']);if(_0x33fe12[_0x3fb8('0x26')]){delete _0x33fe12['name'];}_0x39b5cc[_0x3fb8('0x18')](_0x57905a)[_0x3fb8('0x27')](_0x33fe12);};}exports[_0x3fb8('0x28')]=function(_0x12202d,_0x584c5c){var _0x5b6d63={},_0x2dc1cc={},_0x2904f9={'count':0x0,'rows':[]};var _0x5ba5c1=_[_0x3fb8('0x29')](db[_0x3fb8('0x2a')]['rawAttributes'],function(_0x2f7219){return{'name':_0x2f7219[_0x3fb8('0x2b')],'type':_0x2f7219[_0x3fb8('0x2c')][_0x3fb8('0x2d')]};});_0x2dc1cc[_0x3fb8('0x2e')]=_[_0x3fb8('0x29')](_0x5ba5c1,'name');_0x2dc1cc[_0x3fb8('0x2f')]=_[_0x3fb8('0x30')](_0x12202d[_0x3fb8('0x2f')]);_0x2dc1cc[_0x3fb8('0x31')]=_[_0x3fb8('0x32')](_0x2dc1cc[_0x3fb8('0x2e')],_0x2dc1cc[_0x3fb8('0x2f')]);_0x5b6d63[_0x3fb8('0x33')]=_[_0x3fb8('0x32')](_0x2dc1cc['model'],qs[_0x3fb8('0x34')](_0x12202d[_0x3fb8('0x2f')][_0x3fb8('0x34')]));_0x5b6d63[_0x3fb8('0x33')]=_0x5b6d63[_0x3fb8('0x33')]['length']?_0x5b6d63[_0x3fb8('0x33')]:_0x2dc1cc['model'];if(!_0x12202d[_0x3fb8('0x2f')][_0x3fb8('0x35')]('nolimit')){_0x5b6d63[_0x3fb8('0x1c')]=qs[_0x3fb8('0x1c')](_0x12202d[_0x3fb8('0x2f')][_0x3fb8('0x1c')]);_0x5b6d63[_0x3fb8('0x1a')]=qs[_0x3fb8('0x1a')](_0x12202d[_0x3fb8('0x2f')]['offset']);}_0x5b6d63[_0x3fb8('0x36')]=qs[_0x3fb8('0x37')](_0x12202d[_0x3fb8('0x2f')]['sort']);_0x5b6d63['where']=qs['filters'](_[_0x3fb8('0x38')](_0x12202d[_0x3fb8('0x2f')],_0x2dc1cc[_0x3fb8('0x31')]),_0x5ba5c1);if(_0x12202d[_0x3fb8('0x2f')][_0x3fb8('0x39')]){_0x5b6d63['where']=_[_0x3fb8('0x3a')](_0x5b6d63[_0x3fb8('0x3b')],{'$or':_[_0x3fb8('0x29')](_0x5ba5c1,function(_0x199724){if(_0x199724['type']!==_0x3fb8('0x3c')){var _0x43424e={};_0x43424e[_0x199724[_0x3fb8('0x26')]]={'$like':'%'+_0x12202d[_0x3fb8('0x2f')][_0x3fb8('0x39')]+'%'};return _0x43424e;}})});}_0x5b6d63=_[_0x3fb8('0x3a')]({},_0x5b6d63,_0x12202d['options']);var _0x3b39f0={'where':_0x5b6d63['where']};return db[_0x3fb8('0x2a')][_0x3fb8('0x1d')](_0x3b39f0)[_0x3fb8('0x25')](function(_0x4d9516){_0x2904f9[_0x3fb8('0x1d')]=_0x4d9516;if(_0x12202d[_0x3fb8('0x2f')][_0x3fb8('0x3d')]){_0x5b6d63[_0x3fb8('0x3e')]=[{'all':!![]}];}return db[_0x3fb8('0x2a')][_0x3fb8('0x3f')](_0x5b6d63);})[_0x3fb8('0x25')](function(_0x428155){_0x2904f9['rows']=_0x428155;return _0x2904f9;})[_0x3fb8('0x25')](respondWithFilteredResult(_0x584c5c,_0x5b6d63))['catch'](handleError(_0x584c5c,null));};exports[_0x3fb8('0x40')]=function(_0x20b323,_0x3a65ac){var _0x254a99={'raw':!![],'where':{'id':_0x20b323['params']['id']}},_0x51d53c={};_0x51d53c[_0x3fb8('0x2e')]=_['keys'](db[_0x3fb8('0x2a')][_0x3fb8('0x41')]);_0x51d53c[_0x3fb8('0x2f')]=_[_0x3fb8('0x30')](_0x20b323[_0x3fb8('0x2f')]);_0x51d53c[_0x3fb8('0x31')]=_[_0x3fb8('0x32')](_0x51d53c['model'],_0x51d53c[_0x3fb8('0x2f')]);_0x254a99[_0x3fb8('0x33')]=_[_0x3fb8('0x32')](_0x51d53c[_0x3fb8('0x2e')],qs[_0x3fb8('0x34')](_0x20b323[_0x3fb8('0x2f')][_0x3fb8('0x34')]));_0x254a99[_0x3fb8('0x33')]=_0x254a99[_0x3fb8('0x33')]['length']?_0x254a99[_0x3fb8('0x33')]:_0x51d53c[_0x3fb8('0x2e')];if(_0x20b323[_0x3fb8('0x2f')][_0x3fb8('0x3d')]){_0x254a99[_0x3fb8('0x3e')]=[{'all':!![]}];}_0x254a99=_[_0x3fb8('0x3a')]({},_0x254a99,_0x20b323[_0x3fb8('0x42')]);return db['Dynamics365Field']['find'](_0x254a99)['then'](handleEntityNotFound(_0x3a65ac,null))[_0x3fb8('0x25')](respondWithResult(_0x3a65ac,null))[_0x3fb8('0x43')](handleError(_0x3a65ac,null));};exports[_0x3fb8('0x44')]=function(_0x1e6d72,_0x208923){return db[_0x3fb8('0x2a')][_0x3fb8('0x44')](_0x1e6d72[_0x3fb8('0x45')],{})[_0x3fb8('0x25')](respondWithResult(_0x208923,0xc9))[_0x3fb8('0x43')](handleError(_0x208923,null));};exports['update']=function(_0x1ac0b3,_0x5c2c49){if(_0x1ac0b3[_0x3fb8('0x45')]['id']){delete _0x1ac0b3[_0x3fb8('0x45')]['id'];}return db[_0x3fb8('0x2a')][_0x3fb8('0x46')]({'where':{'id':_0x1ac0b3[_0x3fb8('0x47')]['id']}})[_0x3fb8('0x25')](handleEntityNotFound(_0x5c2c49,null))[_0x3fb8('0x25')](saveUpdates(_0x1ac0b3[_0x3fb8('0x45')],null))[_0x3fb8('0x25')](respondWithResult(_0x5c2c49,null))[_0x3fb8('0x43')](handleError(_0x5c2c49,null));};exports[_0x3fb8('0x48')]=function(_0x485be1,_0x28b23c){return db['Dynamics365Field'][_0x3fb8('0x46')]({'where':{'id':_0x485be1[_0x3fb8('0x47')]['id']}})['then'](handleEntityNotFound(_0x28b23c,null))[_0x3fb8('0x25')](removeEntity(_0x28b23c,null))['catch'](handleError(_0x28b23c,null));}; \ No newline at end of file +var _0x39a9=['pick','filter','map','VIRTUAL','options','include','findAll','catch','length','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5bc2d2,_0x47e74a){var _0x4c718f=function(_0x335a2e){while(--_0x335a2e){_0x5bc2d2['push'](_0x5bc2d2['shift']());}};_0x4c718f(++_0x47e74a);}(_0x39a9,0x194));var _0x939a=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x39a9[_0x15ca1a];return _0x507626;};'use strict';var emlformat=require(_0x939a('0x0'));var rimraf=require(_0x939a('0x1'));var zipdir=require(_0x939a('0x2'));var jsonpatch=require(_0x939a('0x3'));var rp=require(_0x939a('0x4'));var moment=require(_0x939a('0x5'));var BPromise=require(_0x939a('0x6'));var Mustache=require(_0x939a('0x7'));var util=require(_0x939a('0x8'));var path=require('path');var sox=require(_0x939a('0x9'));var csv=require('to-csv');var ejs=require(_0x939a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x939a('0xb'));var squel=require(_0x939a('0xc'));var crypto=require(_0x939a('0xd'));var jsforce=require(_0x939a('0xe'));var deskjs=require(_0x939a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x939a('0x10'));var Papa=require(_0x939a('0x11'));var Redis=require(_0x939a('0x12'));var authService=require(_0x939a('0x13'));var qs=require(_0x939a('0x14'));var as=require(_0x939a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x939a('0x16'))(_0x939a('0x17'));var utils=require(_0x939a('0x18'));var config=require(_0x939a('0x19'));var licenseUtil=require(_0x939a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16f815,_0xd3b27e){_0xd3b27e=_0xd3b27e||0xcc;return function(_0x55d324){if(_0x55d324){return _0x16f815[_0x939a('0x1b')](_0xd3b27e);}return _0x16f815['status'](_0xd3b27e)['end']();};}function respondWithResult(_0x37d19c,_0x4c8813){_0x4c8813=_0x4c8813||0xc8;return function(_0x18c8bb){if(_0x18c8bb){return _0x37d19c[_0x939a('0x1c')](_0x4c8813)[_0x939a('0x1d')](_0x18c8bb);}};}function respondWithFilteredResult(_0x3621c9,_0x26eac7){return function(_0x3f0c32){if(_0x3f0c32){var _0x222d47=typeof _0x26eac7[_0x939a('0x1e')]==='undefined'&&typeof _0x26eac7[_0x939a('0x1f')]===_0x939a('0x20');var _0x29a3ef=_0x3f0c32[_0x939a('0x21')];var _0x45f134=_0x222d47?0x0:_0x26eac7[_0x939a('0x1e')];var _0x524da5=_0x222d47?_0x3f0c32['count']:_0x26eac7[_0x939a('0x1e')]+_0x26eac7['limit'];var _0x195099;if(_0x524da5>=_0x29a3ef){_0x524da5=_0x29a3ef;_0x195099=0xc8;}else{_0x195099=0xce;}_0x3621c9[_0x939a('0x1c')](_0x195099);return _0x3621c9[_0x939a('0x22')](_0x939a('0x23'),_0x45f134+'-'+_0x524da5+'/'+_0x29a3ef)[_0x939a('0x1d')](_0x3f0c32);}return null;};}function patchUpdates(_0x5f2537){return function(_0x4ee504){try{jsonpatch[_0x939a('0x24')](_0x4ee504,_0x5f2537,!![]);}catch(_0x316488){return BPromise[_0x939a('0x25')](_0x316488);}return _0x4ee504[_0x939a('0x26')]();};}function saveUpdates(_0xe5fcc0,_0x4531bf){return function(_0x48a839){if(_0x48a839){return _0x48a839[_0x939a('0x27')](_0xe5fcc0)[_0x939a('0x28')](function(_0x506ab3){return _0x506ab3;});}return null;};}function removeEntity(_0x5652c5,_0x516c40){return function(_0x28ed1f){if(_0x28ed1f){return _0x28ed1f[_0x939a('0x29')]()[_0x939a('0x28')](function(){_0x5652c5[_0x939a('0x1c')](0xcc)[_0x939a('0x2a')]();});}};}function handleEntityNotFound(_0x1193f6,_0xa6f6d1){return function(_0x52e14a){if(!_0x52e14a){_0x1193f6[_0x939a('0x1b')](0x194);}return _0x52e14a;};}function handleError(_0x354074,_0x33d58c){_0x33d58c=_0x33d58c||0x1f4;return function(_0x3c2288){logger[_0x939a('0x2b')](_0x3c2288[_0x939a('0x2c')]);if(_0x3c2288[_0x939a('0x2d')]){delete _0x3c2288[_0x939a('0x2d')];}_0x354074[_0x939a('0x1c')](_0x33d58c)[_0x939a('0x2e')](_0x3c2288);};}exports[_0x939a('0x2f')]=function(_0x183d6f,_0x22cbcb){var _0x5f2b13={},_0x5eeda2={},_0x48bf69={'count':0x0,'rows':[]};var _0x59794b=_['map'](db[_0x939a('0x30')][_0x939a('0x31')],function(_0x534813){return{'name':_0x534813[_0x939a('0x32')],'type':_0x534813[_0x939a('0x33')]['key']};});_0x5eeda2[_0x939a('0x34')]=_['map'](_0x59794b,_0x939a('0x2d'));_0x5eeda2[_0x939a('0x35')]=_[_0x939a('0x36')](_0x183d6f['query']);_0x5eeda2[_0x939a('0x37')]=_['intersection'](_0x5eeda2[_0x939a('0x34')],_0x5eeda2[_0x939a('0x35')]);_0x5f2b13[_0x939a('0x38')]=_[_0x939a('0x39')](_0x5eeda2[_0x939a('0x34')],qs[_0x939a('0x3a')](_0x183d6f[_0x939a('0x35')][_0x939a('0x3a')]));_0x5f2b13['attributes']=_0x5f2b13[_0x939a('0x38')]['length']?_0x5f2b13[_0x939a('0x38')]:_0x5eeda2['model'];if(!_0x183d6f[_0x939a('0x35')][_0x939a('0x3b')](_0x939a('0x3c'))){_0x5f2b13['limit']=qs['limit'](_0x183d6f['query']['limit']);_0x5f2b13[_0x939a('0x1e')]=qs[_0x939a('0x1e')](_0x183d6f['query']['offset']);}_0x5f2b13[_0x939a('0x3d')]=qs['sort'](_0x183d6f[_0x939a('0x35')][_0x939a('0x3e')]);_0x5f2b13[_0x939a('0x3f')]=qs[_0x939a('0x37')](_[_0x939a('0x40')](_0x183d6f[_0x939a('0x35')],_0x5eeda2[_0x939a('0x37')]),_0x59794b);if(_0x183d6f['query'][_0x939a('0x41')]){_0x5f2b13[_0x939a('0x3f')]=_['merge'](_0x5f2b13['where'],{'$or':_[_0x939a('0x42')](_0x59794b,function(_0x54629a){if(_0x54629a[_0x939a('0x33')]!==_0x939a('0x43')){var _0x143ea1={};_0x143ea1[_0x54629a['name']]={'$like':'%'+_0x183d6f[_0x939a('0x35')][_0x939a('0x41')]+'%'};return _0x143ea1;}})});}_0x5f2b13=_['merge']({},_0x5f2b13,_0x183d6f[_0x939a('0x44')]);var _0x57ea4a={'where':_0x5f2b13[_0x939a('0x3f')]};return db['Dynamics365Field'][_0x939a('0x21')](_0x57ea4a)[_0x939a('0x28')](function(_0x2ac624){_0x48bf69[_0x939a('0x21')]=_0x2ac624;if(_0x183d6f[_0x939a('0x35')]['includeAll']){_0x5f2b13[_0x939a('0x45')]=[{'all':!![]}];}return db[_0x939a('0x30')][_0x939a('0x46')](_0x5f2b13);})[_0x939a('0x28')](function(_0x63b7c8){_0x48bf69['rows']=_0x63b7c8;return _0x48bf69;})['then'](respondWithFilteredResult(_0x22cbcb,_0x5f2b13))[_0x939a('0x47')](handleError(_0x22cbcb,null));};exports['show']=function(_0x26e8be,_0x31e297){var _0x2bd39e={'raw':!![],'where':{'id':_0x26e8be['params']['id']}},_0x2d7401={};_0x2d7401[_0x939a('0x34')]=_[_0x939a('0x36')](db[_0x939a('0x30')]['rawAttributes']);_0x2d7401['query']=_[_0x939a('0x36')](_0x26e8be['query']);_0x2d7401[_0x939a('0x37')]=_[_0x939a('0x39')](_0x2d7401[_0x939a('0x34')],_0x2d7401[_0x939a('0x35')]);_0x2bd39e[_0x939a('0x38')]=_[_0x939a('0x39')](_0x2d7401[_0x939a('0x34')],qs['fields'](_0x26e8be['query']['fields']));_0x2bd39e[_0x939a('0x38')]=_0x2bd39e[_0x939a('0x38')][_0x939a('0x48')]?_0x2bd39e['attributes']:_0x2d7401[_0x939a('0x34')];if(_0x26e8be[_0x939a('0x35')][_0x939a('0x49')]){_0x2bd39e['include']=[{'all':!![]}];}_0x2bd39e=_['merge']({},_0x2bd39e,_0x26e8be[_0x939a('0x44')]);return db['Dynamics365Field'][_0x939a('0x4a')](_0x2bd39e)[_0x939a('0x28')](handleEntityNotFound(_0x31e297,null))[_0x939a('0x28')](respondWithResult(_0x31e297,null))[_0x939a('0x47')](handleError(_0x31e297,null));};exports[_0x939a('0x4b')]=function(_0x1764e7,_0x5e3be2){return db[_0x939a('0x30')][_0x939a('0x4b')](_0x1764e7['body'],{})['then'](respondWithResult(_0x5e3be2,0xc9))[_0x939a('0x47')](handleError(_0x5e3be2,null));};exports[_0x939a('0x27')]=function(_0x18d8f9,_0x580d07){if(_0x18d8f9[_0x939a('0x4c')]['id']){delete _0x18d8f9[_0x939a('0x4c')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x18d8f9[_0x939a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x580d07,null))[_0x939a('0x28')](saveUpdates(_0x18d8f9[_0x939a('0x4c')],null))[_0x939a('0x28')](respondWithResult(_0x580d07,null))['catch'](handleError(_0x580d07,null));};exports[_0x939a('0x29')]=function(_0x35b631,_0x25d692){return db[_0x939a('0x30')][_0x939a('0x4a')]({'where':{'id':_0x35b631[_0x939a('0x4d')]['id']}})[_0x939a('0x28')](handleEntityNotFound(_0x25d692,null))[_0x939a('0x28')](removeEntity(_0x25d692,null))[_0x939a('0x47')](handleError(_0x25d692,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 52a8c5b..1991bd2 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 _0x9776=['lodash','util','../../config/logger','api','moment','request-promise','path','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9776,0x1a4));var _0x6977=function(_0x189166,_0x50aa2a){_0x189166=_0x189166-0x0;var _0xc06e59=_0x9776[_0x189166];return _0xc06e59;};'use strict';var _=require(_0x6977('0x0'));var util=require(_0x6977('0x1'));var logger=require(_0x6977('0x2'))(_0x6977('0x3'));var moment=require(_0x6977('0x4'));var BPromise=require('bluebird');var rp=require(_0x6977('0x5'));var fs=require('fs');var path=require(_0x6977('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6977('0x7'));module[_0x6977('0x8')]=function(_0x1af21a,_0x10b69d){return _0x1af21a[_0x6977('0x9')](_0x6977('0xa'),attributes,{'tableName':_0x6977('0xb'),'paranoid':![],'indexes':[{'name':_0x6977('0xc'),'fields':[_0x6977('0xd'),_0x6977('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4469=['Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intDynamics365Field.attributes','exports','define'];(function(_0x5be652,_0x129d44){var _0x3c89da=function(_0x2f01ac){while(--_0x2f01ac){_0x5be652['push'](_0x5be652['shift']());}};_0x3c89da(++_0x129d44);}(_0x4469,0x1f3));var _0x9446=function(_0x185d60,_0x458afc){_0x185d60=_0x185d60-0x0;var _0x1b90c8=_0x4469[_0x185d60];return _0x1b90c8;};'use strict';var _=require(_0x9446('0x0'));var util=require(_0x9446('0x1'));var logger=require(_0x9446('0x2'))(_0x9446('0x3'));var moment=require(_0x9446('0x4'));var BPromise=require(_0x9446('0x5'));var rp=require(_0x9446('0x6'));var fs=require('fs');var path=require(_0x9446('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9446('0x8'));module[_0x9446('0x9')]=function(_0x3d7e96,_0xafd63b){return _0x3d7e96[_0x9446('0xa')](_0x9446('0xb'),attributes,{'tableName':_0x9446('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x9446('0xd'),_0x9446('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 9da0b2e..8f35dbe 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 _0x3568=['code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x3568,0xf4));var _0x8356=function(_0x202313,_0x3cebb5){_0x202313=_0x202313-0x0;var _0x4142af=_0x3568[_0x202313];return _0x4142af;};'use strict';var _=require(_0x8356('0x0'));var util=require(_0x8356('0x1'));var moment=require(_0x8356('0x2'));var BPromise=require(_0x8356('0x3'));var rs=require(_0x8356('0x4'));var fs=require('fs');var Redis=require(_0x8356('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8356('0x6'));var logger=require(_0x8356('0x7'))(_0x8356('0x8'));var config=require(_0x8356('0x9'));var jayson=require(_0x8356('0xa'));var client=jayson[_0x8356('0xb')][_0x8356('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5409a0,_0x27f2dc,_0x39c6d0){return new BPromise(function(_0xf731de,_0x24f120){return client['request'](_0x5409a0,_0x39c6d0)[_0x8356('0xd')](function(_0xb408e7){logger[_0x8356('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x27f2dc,_0x8356('0xf'));logger[_0x8356('0x10')](_0x8356('0x11'),_0x27f2dc,_0x8356('0xf'),JSON[_0x8356('0x12')](_0xb408e7));if(_0xb408e7[_0x8356('0x13')]){if(_0xb408e7[_0x8356('0x13')][_0x8356('0x14')]===0x1f4){logger[_0x8356('0x13')](_0x8356('0x15'),_0x27f2dc,_0xb408e7[_0x8356('0x13')][_0x8356('0x16')]);return _0x24f120(_0xb408e7['error'][_0x8356('0x16')]);}logger[_0x8356('0x13')](_0x8356('0x15'),_0x27f2dc,_0xb408e7['error'][_0x8356('0x16')]);return _0xf731de(_0xb408e7['error']['message']);}else{logger['info'](_0x8356('0x15'),_0x27f2dc,_0x8356('0xf'));_0xf731de(_0xb408e7[_0x8356('0x17')][_0x8356('0x16')]);}})['catch'](function(_0x15b8e6){logger[_0x8356('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x27f2dc,_0x15b8e6);_0x24f120(_0x15b8e6);});});} \ No newline at end of file +var _0x3871=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','debug','stringify','error','message','catch','lodash'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x3871,0x13a));var _0x1387=function(_0x305d70,_0x285fd2){_0x305d70=_0x305d70-0x0;var _0x41f586=_0x3871[_0x305d70];return _0x41f586;};'use strict';var _=require(_0x1387('0x0'));var util=require(_0x1387('0x1'));var moment=require(_0x1387('0x2'));var BPromise=require(_0x1387('0x3'));var rs=require(_0x1387('0x4'));var fs=require('fs');var Redis=require(_0x1387('0x5'));var db=require(_0x1387('0x6'))['db'];var utils=require(_0x1387('0x7'));var logger=require(_0x1387('0x8'))('rpc');var config=require(_0x1387('0x9'));var jayson=require(_0x1387('0xa'));var client=jayson[_0x1387('0xb')][_0x1387('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x182434,_0x2807a6,_0x4171d3){return new BPromise(function(_0x2cb9f2,_0x3a3f6d){return client[_0x1387('0xd')](_0x182434,_0x4171d3)['then'](function(_0x4e60ef){logger[_0x1387('0xe')](_0x1387('0xf'),_0x2807a6,'request\x20sent');logger[_0x1387('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2807a6,'request\x20sent',JSON[_0x1387('0x11')](_0x4e60ef));if(_0x4e60ef[_0x1387('0x12')]){if(_0x4e60ef[_0x1387('0x12')]['code']===0x1f4){logger['error'](_0x1387('0xf'),_0x2807a6,_0x4e60ef[_0x1387('0x12')][_0x1387('0x13')]);return _0x3a3f6d(_0x4e60ef[_0x1387('0x12')][_0x1387('0x13')]);}logger[_0x1387('0x12')](_0x1387('0xf'),_0x2807a6,_0x4e60ef[_0x1387('0x12')][_0x1387('0x13')]);return _0x2cb9f2(_0x4e60ef[_0x1387('0x12')]['message']);}else{logger[_0x1387('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x2807a6,'request\x20sent');_0x2cb9f2(_0x4e60ef['result'][_0x1387('0x13')]);}})[_0x1387('0x14')](function(_0x1584e8){logger[_0x1387('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x2807a6,_0x1584e8);_0x3a3f6d(_0x1584e8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 0e9f52d..525c883 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 _0x450d=['fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x450d,0x1b2));var _0xd450=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x450d[_0x45b034];return _0x509cb0;};'use strict';var multer=require(_0xd450('0x0'));var util=require(_0xd450('0x1'));var path=require('path');var timeout=require(_0xd450('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd450('0x3'));var auth=require(_0xd450('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd450('0x5'));var controller=require(_0xd450('0x6'));router[_0xd450('0x7')]('/',auth[_0xd450('0x8')](),controller[_0xd450('0x9')]);router[_0xd450('0x7')](_0xd450('0xa'),auth[_0xd450('0x8')](),controller[_0xd450('0xb')]);router[_0xd450('0x7')](_0xd450('0xc'),auth[_0xd450('0x8')](),controller[_0xd450('0xd')]);router[_0xd450('0x7')](_0xd450('0xe'),auth[_0xd450('0x8')](),controller[_0xd450('0xf')]);router[_0xd450('0x10')]('/',auth['isAuthenticated'](),controller[_0xd450('0x11')]);router[_0xd450('0x10')](_0xd450('0xc'),auth[_0xd450('0x8')](),controller[_0xd450('0x12')]);router[_0xd450('0x13')](_0xd450('0xa'),auth[_0xd450('0x8')](),controller[_0xd450('0x14')]);router[_0xd450('0x15')](_0xd450('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd450('0x16')]=router; \ No newline at end of file +var _0x0aaf=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0aaf,0xa1));var _0xf0aa=function(_0x147003,_0x36e2e3){_0x147003=_0x147003-0x0;var _0x5167b2=_0x0aaf[_0x147003];return _0x5167b2;};'use strict';var multer=require(_0xf0aa('0x0'));var util=require('util');var path=require(_0xf0aa('0x1'));var timeout=require(_0xf0aa('0x2'));var express=require(_0xf0aa('0x3'));var router=express[_0xf0aa('0x4')]();var fs_extra=require(_0xf0aa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0aa('0x6'));var config=require(_0xf0aa('0x7'));var controller=require(_0xf0aa('0x8'));router[_0xf0aa('0x9')]('/',auth['isAuthenticated'](),controller[_0xf0aa('0xa')]);router[_0xf0aa('0x9')](_0xf0aa('0xb'),auth[_0xf0aa('0xc')](),controller[_0xf0aa('0xd')]);router['get'](_0xf0aa('0xe'),auth[_0xf0aa('0xc')](),controller[_0xf0aa('0xf')]);router['get'](_0xf0aa('0x10'),auth['isAuthenticated'](),controller[_0xf0aa('0x11')]);router[_0xf0aa('0x12')]('/',auth[_0xf0aa('0xc')](),controller[_0xf0aa('0x13')]);router['post'](_0xf0aa('0xe'),auth[_0xf0aa('0xc')](),controller['addConfiguration']);router[_0xf0aa('0x14')](_0xf0aa('0xb'),auth[_0xf0aa('0xc')](),controller[_0xf0aa('0x15')]);router[_0xf0aa('0x16')](_0xf0aa('0xb'),auth[_0xf0aa('0xc')](),controller[_0xf0aa('0x17')]);module[_0xf0aa('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 014465e..dc39c42 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 _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x20c3b4,_0x2fbfa9){var _0x595c49=function(_0x245cfb){while(--_0x245cfb){_0x20c3b4['push'](_0x20c3b4['shift']());}};_0x595c49(++_0x2fbfa9);}(_0x7916,0x128));var _0x6791=function(_0x47a6f3,_0x2c8947){_0x47a6f3=_0x47a6f3-0x0;var _0xef2dd2=_0x7916[_0x47a6f3];return _0xef2dd2;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2da6=['username','sequelize','exports','STRING'];(function(_0x4c4949,_0x5f2cee){var _0x52bf3c=function(_0x47894d){while(--_0x47894d){_0x4c4949['push'](_0x4c4949['shift']());}};_0x52bf3c(++_0x5f2cee);}(_0x2da6,0x1dd));var _0x62da=function(_0x115081,_0x2932b4){_0x115081=_0x115081-0x0;var _0x5e9950=_0x2da6[_0x115081];return _0x5e9950;};'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/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 016e452..f5a59a7 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 _0x876b=['default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','Subjects','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s:X','toString','base64','subject','agent','priority','source','ticket_type','group','company','remove','includes'];(function(_0x2d9905,_0x1a63d1){var _0x4a5c0d=function(_0xf4247f){while(--_0xf4247f){_0x2d9905['push'](_0x2d9905['shift']());}};_0x4a5c0d(++_0x1a63d1);}(_0x876b,0x1ba));var _0xb876=function(_0x5e9d34,_0x1500e3){_0x5e9d34=_0x5e9d34-0x0;var _0x1c3f99=_0x876b[_0x5e9d34];return _0x1c3f99;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb876('0x0'));var jsonpatch=require(_0xb876('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb876('0x2'));var Mustache=require(_0xb876('0x3'));var util=require('util');var path=require(_0xb876('0x4'));var sox=require(_0xb876('0x5'));var csv=require(_0xb876('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb876('0x7'));var _=require(_0xb876('0x8'));var squel=require('squel');var crypto=require(_0xb876('0x9'));var jsforce=require(_0xb876('0xa'));var deskjs=require(_0xb876('0xb'));var toCsv=require(_0xb876('0x6'));var querystring=require('querystring');var Papa=require(_0xb876('0xc'));var Redis=require('ioredis');var authService=require(_0xb876('0xd'));var qs=require(_0xb876('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb876('0xf'));var utils=require('../../config/utils');var config=require(_0xb876('0x10'));var licenseUtil=require(_0xb876('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb876('0x12'));function respondWithStatusCode(_0x19fb7e,_0x2c2a0f){_0x2c2a0f=_0x2c2a0f||0xcc;return function(_0x3312f9){if(_0x3312f9){return _0x19fb7e[_0xb876('0x13')](_0x2c2a0f);}return _0x19fb7e[_0xb876('0x14')](_0x2c2a0f)[_0xb876('0x15')]();};}function respondWithResult(_0x31a5fa,_0x248165){_0x248165=_0x248165||0xc8;return function(_0x274b44){if(_0x274b44){return _0x31a5fa[_0xb876('0x14')](_0x248165)[_0xb876('0x16')](_0x274b44);}};}function respondWithFilteredResult(_0x497380,_0x33f264){return function(_0x6bf9ad){if(_0x6bf9ad){var _0x3f7ae4=typeof _0x33f264[_0xb876('0x17')]===_0xb876('0x18')&&typeof _0x33f264[_0xb876('0x19')]==='undefined';var _0x3a7a29=_0x6bf9ad[_0xb876('0x1a')];var _0x4e2048=_0x3f7ae4?0x0:_0x33f264['offset'];var _0x1e3561=_0x3f7ae4?_0x6bf9ad[_0xb876('0x1a')]:_0x33f264[_0xb876('0x17')]+_0x33f264['limit'];var _0x31ae28;if(_0x1e3561>=_0x3a7a29){_0x1e3561=_0x3a7a29;_0x31ae28=0xc8;}else{_0x31ae28=0xce;}_0x497380[_0xb876('0x14')](_0x31ae28);return _0x497380[_0xb876('0x1b')](_0xb876('0x1c'),_0x4e2048+'-'+_0x1e3561+'/'+_0x3a7a29)[_0xb876('0x16')](_0x6bf9ad);}return null;};}function patchUpdates(_0x4f9b80){return function(_0x5722b2){try{jsonpatch['apply'](_0x5722b2,_0x4f9b80,!![]);}catch(_0x75031a){return BPromise[_0xb876('0x1d')](_0x75031a);}return _0x5722b2[_0xb876('0x1e')]();};}function saveUpdates(_0x115f17,_0x5d775c){return function(_0x394009){if(_0x394009){return _0x394009[_0xb876('0x1f')](_0x115f17)[_0xb876('0x20')](function(_0x359b44){return _0x359b44;});}return null;};}function removeEntity(_0xe939c2,_0x351dc3){return function(_0x183e7e){if(_0x183e7e){return _0x183e7e[_0xb876('0x21')]()[_0xb876('0x20')](function(){_0xe939c2[_0xb876('0x14')](0xcc)[_0xb876('0x15')]();});}};}function handleEntityNotFound(_0x2f41ce,_0x30a7f8){return function(_0x208291){if(!_0x208291){_0x2f41ce[_0xb876('0x13')](0x194);}return _0x208291;};}function handleError(_0x22d680,_0x213c8a){_0x213c8a=_0x213c8a||0x1f4;return function(_0x5a29f4){logger[_0xb876('0x22')](_0x5a29f4[_0xb876('0x23')]);if(_0x5a29f4[_0xb876('0x24')]){delete _0x5a29f4['name'];}_0x22d680[_0xb876('0x14')](_0x213c8a)[_0xb876('0x25')](_0x5a29f4);};}exports[_0xb876('0x26')]=function(_0x5a4ade,_0x20bd3b){var _0x45a8a5={},_0x5d88ac={},_0x2ad621={'count':0x0,'rows':[]};var _0x51f2c6=_[_0xb876('0x27')](db[_0xb876('0x28')][_0xb876('0x29')],function(_0x285995){return{'name':_0x285995['fieldName'],'type':_0x285995[_0xb876('0x2a')][_0xb876('0x2b')]};});_0x5d88ac[_0xb876('0x2c')]=_[_0xb876('0x27')](_0x51f2c6,_0xb876('0x24'));_0x5d88ac[_0xb876('0x2d')]=_[_0xb876('0x2e')](_0x5a4ade['query']);_0x5d88ac[_0xb876('0x2f')]=_[_0xb876('0x30')](_0x5d88ac[_0xb876('0x2c')],_0x5d88ac['query']);_0x45a8a5['attributes']=_[_0xb876('0x30')](_0x5d88ac[_0xb876('0x2c')],qs[_0xb876('0x31')](_0x5a4ade['query'][_0xb876('0x31')]));_0x45a8a5['attributes']=_0x45a8a5[_0xb876('0x32')][_0xb876('0x33')]?_0x45a8a5[_0xb876('0x32')]:_0x5d88ac['model'];if(!_0x5a4ade[_0xb876('0x2d')][_0xb876('0x34')](_0xb876('0x35'))){_0x45a8a5[_0xb876('0x19')]=qs[_0xb876('0x19')](_0x5a4ade[_0xb876('0x2d')][_0xb876('0x19')]);_0x45a8a5[_0xb876('0x17')]=qs['offset'](_0x5a4ade['query'][_0xb876('0x17')]);}_0x45a8a5[_0xb876('0x36')]=qs[_0xb876('0x37')](_0x5a4ade[_0xb876('0x2d')]['sort']);_0x45a8a5[_0xb876('0x38')]=qs[_0xb876('0x2f')](_[_0xb876('0x39')](_0x5a4ade[_0xb876('0x2d')],_0x5d88ac[_0xb876('0x2f')]),_0x51f2c6);if(_0x5a4ade[_0xb876('0x2d')][_0xb876('0x3a')]){_0x45a8a5[_0xb876('0x38')]=_['merge'](_0x45a8a5[_0xb876('0x38')],{'$or':_['map'](_0x51f2c6,function(_0x2fcc23){if(_0x2fcc23[_0xb876('0x2a')]!=='VIRTUAL'){var _0x505096={};_0x505096[_0x2fcc23[_0xb876('0x24')]]={'$like':'%'+_0x5a4ade['query'][_0xb876('0x3a')]+'%'};return _0x505096;}})});}_0x45a8a5=_[_0xb876('0x3b')]({},_0x45a8a5,_0x5a4ade[_0xb876('0x3c')]);var _0x233bdf={'where':_0x45a8a5[_0xb876('0x38')]};return db[_0xb876('0x28')][_0xb876('0x1a')](_0x233bdf)[_0xb876('0x20')](function(_0xcc3725){_0x2ad621[_0xb876('0x1a')]=_0xcc3725;if(_0x5a4ade[_0xb876('0x2d')]['includeAll']){_0x45a8a5[_0xb876('0x3d')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xb876('0x3e')](_0x45a8a5);})['then'](function(_0x18ba26){_0x2ad621[_0xb876('0x3f')]=_0x18ba26;return _0x2ad621;})[_0xb876('0x20')](respondWithFilteredResult(_0x20bd3b,_0x45a8a5))[_0xb876('0x40')](handleError(_0x20bd3b,null));};exports[_0xb876('0x41')]=function(_0x1610af,_0xde62be){var _0x10018e={'raw':![],'where':{'id':_0x1610af[_0xb876('0x42')]['id']}},_0x3cce14={};_0x3cce14[_0xb876('0x2c')]=_['keys'](db[_0xb876('0x28')][_0xb876('0x29')]);_0x3cce14[_0xb876('0x2d')]=_['keys'](_0x1610af[_0xb876('0x2d')]);_0x3cce14['filters']=_[_0xb876('0x30')](_0x3cce14[_0xb876('0x2c')],_0x3cce14[_0xb876('0x2d')]);_0x10018e['attributes']=_[_0xb876('0x30')](_0x3cce14['model'],qs[_0xb876('0x31')](_0x1610af['query']['fields']));_0x10018e[_0xb876('0x32')]=_0x10018e[_0xb876('0x32')]['length']?_0x10018e[_0xb876('0x32')]:_0x3cce14[_0xb876('0x2c')];if(_0x1610af[_0xb876('0x2d')]['includeAll']){_0x10018e[_0xb876('0x3d')]=[{'all':!![]}];}_0x10018e=_[_0xb876('0x3b')]({},_0x10018e,_0x1610af[_0xb876('0x3c')]);return db['FreshdeskAccount'][_0xb876('0x43')](_0x10018e)['then'](handleEntityNotFound(_0xde62be,null))[_0xb876('0x20')](respondWithResult(_0xde62be,null))[_0xb876('0x40')](handleError(_0xde62be,null));};exports['create']=function(_0x2ffbdc,_0x328069){return db[_0xb876('0x28')][_0xb876('0x44')](_0x2ffbdc[_0xb876('0x45')],{})[_0xb876('0x20')](respondWithResult(_0x328069,0xc9))[_0xb876('0x40')](handleError(_0x328069,null));};exports[_0xb876('0x1f')]=function(_0xa4b1af,_0x17cb1c){if(_0xa4b1af[_0xb876('0x45')]['id']){delete _0xa4b1af[_0xb876('0x45')]['id'];}return db[_0xb876('0x28')]['find']({'where':{'id':_0xa4b1af['params']['id']}})['then'](handleEntityNotFound(_0x17cb1c,null))[_0xb876('0x20')](saveUpdates(_0xa4b1af[_0xb876('0x45')],null))[_0xb876('0x20')](respondWithResult(_0x17cb1c,null))[_0xb876('0x40')](handleError(_0x17cb1c,null));};exports[_0xb876('0x21')]=function(_0x25562c,_0x2dc5c8){return db[_0xb876('0x28')]['find']({'where':{'id':_0x25562c[_0xb876('0x42')]['id']}})[_0xb876('0x20')](handleEntityNotFound(_0x2dc5c8,null))[_0xb876('0x20')](removeEntity(_0x2dc5c8,null))[_0xb876('0x40')](handleError(_0x2dc5c8,null));};exports['getConfigurations']=function(_0x30f200,_0x2e4eb5,_0x3239da){var _0x2b5adb={};var _0x208aa1={};var _0x6f0e92;var _0x4e683d;return db['FreshdeskAccount'][_0xb876('0x46')]({'where':{'id':_0x30f200[_0xb876('0x42')]['id']}})[_0xb876('0x20')](handleEntityNotFound(_0x2e4eb5,null))[_0xb876('0x20')](function(_0x4449c7){if(_0x4449c7){_0x6f0e92=_0x4449c7;_0x208aa1['model']=_[_0xb876('0x2e')](db[_0xb876('0x47')][_0xb876('0x29')]);_0x208aa1[_0xb876('0x2d')]=_[_0xb876('0x2e')](_0x30f200[_0xb876('0x2d')]);_0x208aa1['filters']=_[_0xb876('0x30')](_0x208aa1[_0xb876('0x2c')],_0x208aa1[_0xb876('0x2d')]);_0x2b5adb[_0xb876('0x32')]=_[_0xb876('0x30')](_0x208aa1[_0xb876('0x2c')],qs[_0xb876('0x31')](_0x30f200[_0xb876('0x2d')][_0xb876('0x31')]));_0x2b5adb[_0xb876('0x32')]=_0x2b5adb[_0xb876('0x32')][_0xb876('0x33')]?_0x2b5adb[_0xb876('0x32')]:_0x208aa1['model'];_0x2b5adb[_0xb876('0x36')]=qs[_0xb876('0x37')](_0x30f200[_0xb876('0x2d')]['sort']);_0x2b5adb[_0xb876('0x38')]=qs['filters'](_[_0xb876('0x39')](_0x30f200[_0xb876('0x2d')],_0x208aa1[_0xb876('0x2f')]));if(_0x30f200[_0xb876('0x2d')][_0xb876('0x3a')]){_0x2b5adb[_0xb876('0x38')]=_[_0xb876('0x3b')](_0x2b5adb[_0xb876('0x38')],{'$or':_[_0xb876('0x27')](_0x2b5adb[_0xb876('0x32')],function(_0x542bb8){var _0x79af43={};_0x79af43[_0x542bb8]={'$like':'%'+_0x30f200[_0xb876('0x2d')]['filter']+'%'};return _0x79af43;})});}_0x2b5adb=_['merge']({},_0x2b5adb,_0x30f200[_0xb876('0x3c')]);return _0x6f0e92['getConfigurations'](_0x2b5adb);}})[_0xb876('0x20')](function(_0x46d588){if(_0x46d588){_0x4e683d=_0x46d588[_0xb876('0x33')];if(!_0x30f200[_0xb876('0x2d')][_0xb876('0x34')]('nolimit')){_0x2b5adb['limit']=qs[_0xb876('0x19')](_0x30f200['query']['limit']);_0x2b5adb[_0xb876('0x17')]=qs[_0xb876('0x17')](_0x30f200[_0xb876('0x2d')][_0xb876('0x17')]);}return _0x6f0e92[_0xb876('0x48')](_0x2b5adb);}})[_0xb876('0x20')](function(_0xeebd1f){if(_0xeebd1f){return _0xeebd1f?{'count':_0x4e683d,'rows':_0xeebd1f}:null;}})[_0xb876('0x20')](respondWithResult(_0x2e4eb5,null))['catch'](handleError(_0x2e4eb5,null));};exports['addConfiguration']=function(_0x325ba9,_0x3f0c7a,_0x50db61){if(_0x325ba9['body']['id']){delete _0x325ba9[_0xb876('0x45')]['id'];}return db[_0xb876('0x28')][_0xb876('0x46')]({'where':{'id':_0x325ba9['params']['id']}})[_0xb876('0x20')](handleEntityNotFound(_0x3f0c7a,null))['then'](function(_0x43e878){if(_0x43e878){_0x325ba9[_0xb876('0x45')][_0xb876('0x49')]=_0x43e878['id'];_0x325ba9[_0xb876('0x45')]['Subjects']=integrations[_0xb876('0x4a')](_0x325ba9['body']['channel'],_0x325ba9[_0xb876('0x45')][_0xb876('0x2a')]);_0x325ba9[_0xb876('0x45')][_0xb876('0x4b')]=integrations[_0xb876('0x4c')](_0x325ba9[_0xb876('0x45')][_0xb876('0x4d')],_0x325ba9['body']['type']);return db[_0xb876('0x47')][_0xb876('0x44')](_0x325ba9[_0xb876('0x45')],{'include':[{'model':db[_0xb876('0x4e')],'as':_0xb876('0x4f')},{'model':db[_0xb876('0x4e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3f0c7a,null))[_0xb876('0x40')](handleError(_0x3f0c7a,null));};exports['getFields']=function(_0x484fbd,_0x5a38c6,_0x1c1516){var _0x4f446a='';return db[_0xb876('0x28')][_0xb876('0x46')]({'where':{'id':_0x484fbd[_0xb876('0x42')]['id']},'attributes':['id',_0xb876('0x50'),_0xb876('0x51')]})[_0xb876('0x20')](handleEntityNotFound(_0x5a38c6,null))[_0xb876('0x20')](function(_0x46f664){if(_0x46f664){_0x4f446a=_0x46f664['remoteUri'];var _0x329123=_0x4f446a[_0xb876('0x52')](-0x1);if(_0x329123==='/'){_0x4f446a=_0x4f446a['substring'](0x0,_0x4f446a[_0xb876('0x53')](_0x329123));}return rp({'method':_0xb876('0x54'),'uri':util[_0xb876('0x55')]('%s/%s',_0x4f446a,'api/v2/ticket_fields'),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xb876('0x55')](_0xb876('0x56'),_0x46f664['apiKey']))[_0xb876('0x57')](_0xb876('0x58')))},'json':!![]});}})[_0xb876('0x20')](function(_0x49dc45){if(_0x49dc45){var _0x568b5d=['requester',_0xb876('0x59'),_0xb876('0x5a'),'description','status',_0xb876('0x5b'),'group',_0xb876('0x5c'),_0xb876('0x5d'),_0xb876('0x5e'),_0xb876('0x5f')];_[_0xb876('0x60')](_0x49dc45,function(_0x25fc6a){return _0x568b5d[_0xb876('0x61')](_0x25fc6a[_0xb876('0x24')])||!_0x25fc6a[_0xb876('0x62')]&&_0x25fc6a['type']!==_0xb876('0x63')&&_0x25fc6a[_0xb876('0x2a')]!=='custom_dropdown';});return{'count':_0x49dc45['length'],'rows':_[_0xb876('0x27')](_0x49dc45,function(_0x4b0ff9){return{'id':_0x4b0ff9['name'],'name':_0x4b0ff9[_0xb876('0x64')],'custom':!_0x4b0ff9[_0xb876('0x62')],'options':_0x4b0ff9[_0xb876('0x65')]?_[_0xb876('0x27')](_0x4b0ff9[_0xb876('0x65')],function(_0x36b1ef){return{'name':_[_0xb876('0x66')](_0x36b1ef),'value':_0x36b1ef};}):[]};})};}})[_0xb876('0x20')](respondWithResult(_0x5a38c6,null))[_0xb876('0x40')](function(_0x4d7848){var _0x10cf6d=_0x484fbd[_0xb876('0x2d')][_0xb876('0x67')]?0x1f4:_0x4d7848[_0xb876('0x68')]||0x1f4;logger[_0xb876('0x22')](_0xb876('0x69'),_0xb876('0x6a'),_0x10cf6d,JSON['stringify'](_0x4d7848));delete _0x4d7848[_0xb876('0x24')];if(_0x10cf6d===0x191){_0x10cf6d=0x190;}_0x5a38c6[_0xb876('0x14')](_0x10cf6d)[_0xb876('0x25')](_0x484fbd[_0xb876('0x2d')]['test']?{'message':_0xb876('0x6b'),'statusCode':_0x4d7848[_0xb876('0x68')]}:_0x4d7848);});}; \ No newline at end of file +var _0x3c2c=['group','source','ticket_type','company','remove','includes','default','custom_dropdown','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','query','keys','attributes','model','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','intersection','fields','include','find','create','body','update','destroy','FreshdeskConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','%s:X','apiKey','toString','base64','requester','subject','agent','description'];(function(_0x1bfdea,_0x1afe11){var _0x5eb627=function(_0x142dce){while(--_0x142dce){_0x1bfdea['push'](_0x1bfdea['shift']());}};_0x5eb627(++_0x1afe11);}(_0x3c2c,0x160));var _0xc3c2=function(_0xfc3f8d,_0x6618c6){_0xfc3f8d=_0xfc3f8d-0x0;var _0x5cfc6f=_0x3c2c[_0xfc3f8d];return _0x5cfc6f;};'use strict';var emlformat=require(_0xc3c2('0x0'));var rimraf=require(_0xc3c2('0x1'));var zipdir=require(_0xc3c2('0x2'));var jsonpatch=require(_0xc3c2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3c2('0x4'));var Mustache=require(_0xc3c2('0x5'));var util=require(_0xc3c2('0x6'));var path=require(_0xc3c2('0x7'));var sox=require('sox');var csv=require(_0xc3c2('0x8'));var ejs=require(_0xc3c2('0x9'));var fs=require('fs');var fs_extra=require(_0xc3c2('0xa'));var _=require(_0xc3c2('0xb'));var squel=require(_0xc3c2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3c2('0x8'));var querystring=require(_0xc3c2('0xd'));var Papa=require('papaparse');var Redis=require(_0xc3c2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc3c2('0xf'));var hardwareService=require(_0xc3c2('0x10'));var logger=require(_0xc3c2('0x11'))('api');var utils=require(_0xc3c2('0x12'));var config=require(_0xc3c2('0x13'));var licenseUtil=require(_0xc3c2('0x14'));var db=require(_0xc3c2('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3920e7,_0x1befad){_0x1befad=_0x1befad||0xcc;return function(_0x515bbc){if(_0x515bbc){return _0x3920e7[_0xc3c2('0x16')](_0x1befad);}return _0x3920e7['status'](_0x1befad)[_0xc3c2('0x17')]();};}function respondWithResult(_0x4d7d11,_0x154071){_0x154071=_0x154071||0xc8;return function(_0x4a5c39){if(_0x4a5c39){return _0x4d7d11[_0xc3c2('0x18')](_0x154071)[_0xc3c2('0x19')](_0x4a5c39);}};}function respondWithFilteredResult(_0x56bc61,_0x1c2987){return function(_0x36f10f){if(_0x36f10f){var _0x3eb9f5=typeof _0x1c2987[_0xc3c2('0x1a')]===_0xc3c2('0x1b')&&typeof _0x1c2987[_0xc3c2('0x1c')]==='undefined';var _0x57fe9d=_0x36f10f['count'];var _0x2770f7=_0x3eb9f5?0x0:_0x1c2987[_0xc3c2('0x1a')];var _0x2b8c31=_0x3eb9f5?_0x36f10f[_0xc3c2('0x1d')]:_0x1c2987[_0xc3c2('0x1a')]+_0x1c2987['limit'];var _0x533a3d;if(_0x2b8c31>=_0x57fe9d){_0x2b8c31=_0x57fe9d;_0x533a3d=0xc8;}else{_0x533a3d=0xce;}_0x56bc61[_0xc3c2('0x18')](_0x533a3d);return _0x56bc61[_0xc3c2('0x1e')](_0xc3c2('0x1f'),_0x2770f7+'-'+_0x2b8c31+'/'+_0x57fe9d)['json'](_0x36f10f);}return null;};}function patchUpdates(_0x42feba){return function(_0x48bb27){try{jsonpatch[_0xc3c2('0x20')](_0x48bb27,_0x42feba,!![]);}catch(_0x1d317a){return BPromise[_0xc3c2('0x21')](_0x1d317a);}return _0x48bb27['save']();};}function saveUpdates(_0x2ca609,_0x340c75){return function(_0x1b44c4){if(_0x1b44c4){return _0x1b44c4['update'](_0x2ca609)[_0xc3c2('0x22')](function(_0x3287a3){return _0x3287a3;});}return null;};}function removeEntity(_0x6ad7af,_0x5d7789){return function(_0x2133bc){if(_0x2133bc){return _0x2133bc['destroy']()[_0xc3c2('0x22')](function(){_0x6ad7af[_0xc3c2('0x18')](0xcc)[_0xc3c2('0x17')]();});}};}function handleEntityNotFound(_0x38d0b9,_0x15f5f9){return function(_0x2f7a0b){if(!_0x2f7a0b){_0x38d0b9[_0xc3c2('0x16')](0x194);}return _0x2f7a0b;};}function handleError(_0x4b6504,_0x48fa15){_0x48fa15=_0x48fa15||0x1f4;return function(_0x58fd7a){logger[_0xc3c2('0x23')](_0x58fd7a[_0xc3c2('0x24')]);if(_0x58fd7a[_0xc3c2('0x25')]){delete _0x58fd7a['name'];}_0x4b6504[_0xc3c2('0x18')](_0x48fa15)[_0xc3c2('0x26')](_0x58fd7a);};}exports[_0xc3c2('0x27')]=function(_0x2bc3b7,_0x7686ac){var _0x166f8e={},_0x1b9e5e={},_0x246ea8={'count':0x0,'rows':[]};var _0x5bd00d=_[_0xc3c2('0x28')](db[_0xc3c2('0x29')][_0xc3c2('0x2a')],function(_0x3aebab){return{'name':_0x3aebab[_0xc3c2('0x2b')],'type':_0x3aebab[_0xc3c2('0x2c')]['key']};});_0x1b9e5e['model']=_[_0xc3c2('0x28')](_0x5bd00d,'name');_0x1b9e5e[_0xc3c2('0x2d')]=_[_0xc3c2('0x2e')](_0x2bc3b7[_0xc3c2('0x2d')]);_0x1b9e5e['filters']=_['intersection'](_0x1b9e5e['model'],_0x1b9e5e['query']);_0x166f8e[_0xc3c2('0x2f')]=_['intersection'](_0x1b9e5e[_0xc3c2('0x30')],qs['fields'](_0x2bc3b7[_0xc3c2('0x2d')]['fields']));_0x166f8e['attributes']=_0x166f8e[_0xc3c2('0x2f')][_0xc3c2('0x31')]?_0x166f8e[_0xc3c2('0x2f')]:_0x1b9e5e[_0xc3c2('0x30')];if(!_0x2bc3b7[_0xc3c2('0x2d')][_0xc3c2('0x32')](_0xc3c2('0x33'))){_0x166f8e[_0xc3c2('0x1c')]=qs[_0xc3c2('0x1c')](_0x2bc3b7['query']['limit']);_0x166f8e[_0xc3c2('0x1a')]=qs[_0xc3c2('0x1a')](_0x2bc3b7[_0xc3c2('0x2d')][_0xc3c2('0x1a')]);}_0x166f8e[_0xc3c2('0x34')]=qs[_0xc3c2('0x35')](_0x2bc3b7['query'][_0xc3c2('0x35')]);_0x166f8e['where']=qs[_0xc3c2('0x36')](_[_0xc3c2('0x37')](_0x2bc3b7['query'],_0x1b9e5e[_0xc3c2('0x36')]),_0x5bd00d);if(_0x2bc3b7[_0xc3c2('0x2d')]['filter']){_0x166f8e[_0xc3c2('0x38')]=_[_0xc3c2('0x39')](_0x166f8e[_0xc3c2('0x38')],{'$or':_[_0xc3c2('0x28')](_0x5bd00d,function(_0x1a2f48){if(_0x1a2f48[_0xc3c2('0x2c')]!==_0xc3c2('0x3a')){var _0x3f4fd0={};_0x3f4fd0[_0x1a2f48['name']]={'$like':'%'+_0x2bc3b7[_0xc3c2('0x2d')][_0xc3c2('0x3b')]+'%'};return _0x3f4fd0;}})});}_0x166f8e=_[_0xc3c2('0x39')]({},_0x166f8e,_0x2bc3b7[_0xc3c2('0x3c')]);var _0x311c10={'where':_0x166f8e[_0xc3c2('0x38')]};return db[_0xc3c2('0x29')][_0xc3c2('0x1d')](_0x311c10)[_0xc3c2('0x22')](function(_0x3a1d74){_0x246ea8['count']=_0x3a1d74;if(_0x2bc3b7[_0xc3c2('0x2d')][_0xc3c2('0x3d')]){_0x166f8e['include']=[{'all':!![]}];}return db[_0xc3c2('0x29')][_0xc3c2('0x3e')](_0x166f8e);})['then'](function(_0x34354c){_0x246ea8['rows']=_0x34354c;return _0x246ea8;})[_0xc3c2('0x22')](respondWithFilteredResult(_0x7686ac,_0x166f8e))[_0xc3c2('0x3f')](handleError(_0x7686ac,null));};exports[_0xc3c2('0x40')]=function(_0x30217b,_0x15680d){var _0x2ef1db={'raw':![],'where':{'id':_0x30217b[_0xc3c2('0x41')]['id']}},_0x24d9fc={};_0x24d9fc['model']=_[_0xc3c2('0x2e')](db[_0xc3c2('0x29')][_0xc3c2('0x2a')]);_0x24d9fc[_0xc3c2('0x2d')]=_['keys'](_0x30217b['query']);_0x24d9fc['filters']=_[_0xc3c2('0x42')](_0x24d9fc[_0xc3c2('0x30')],_0x24d9fc['query']);_0x2ef1db[_0xc3c2('0x2f')]=_['intersection'](_0x24d9fc[_0xc3c2('0x30')],qs['fields'](_0x30217b[_0xc3c2('0x2d')][_0xc3c2('0x43')]));_0x2ef1db[_0xc3c2('0x2f')]=_0x2ef1db[_0xc3c2('0x2f')][_0xc3c2('0x31')]?_0x2ef1db['attributes']:_0x24d9fc['model'];if(_0x30217b[_0xc3c2('0x2d')][_0xc3c2('0x3d')]){_0x2ef1db[_0xc3c2('0x44')]=[{'all':!![]}];}_0x2ef1db=_[_0xc3c2('0x39')]({},_0x2ef1db,_0x30217b[_0xc3c2('0x3c')]);return db[_0xc3c2('0x29')][_0xc3c2('0x45')](_0x2ef1db)[_0xc3c2('0x22')](handleEntityNotFound(_0x15680d,null))[_0xc3c2('0x22')](respondWithResult(_0x15680d,null))[_0xc3c2('0x3f')](handleError(_0x15680d,null));};exports[_0xc3c2('0x46')]=function(_0x287fe6,_0x3592f0){return db[_0xc3c2('0x29')]['create'](_0x287fe6[_0xc3c2('0x47')],{})[_0xc3c2('0x22')](respondWithResult(_0x3592f0,0xc9))[_0xc3c2('0x3f')](handleError(_0x3592f0,null));};exports[_0xc3c2('0x48')]=function(_0x2321a3,_0x21f50f){if(_0x2321a3[_0xc3c2('0x47')]['id']){delete _0x2321a3[_0xc3c2('0x47')]['id'];}return db[_0xc3c2('0x29')][_0xc3c2('0x45')]({'where':{'id':_0x2321a3[_0xc3c2('0x41')]['id']}})[_0xc3c2('0x22')](handleEntityNotFound(_0x21f50f,null))['then'](saveUpdates(_0x2321a3[_0xc3c2('0x47')],null))['then'](respondWithResult(_0x21f50f,null))[_0xc3c2('0x3f')](handleError(_0x21f50f,null));};exports[_0xc3c2('0x49')]=function(_0x22f607,_0x1d0e9f){return db[_0xc3c2('0x29')]['find']({'where':{'id':_0x22f607[_0xc3c2('0x41')]['id']}})[_0xc3c2('0x22')](handleEntityNotFound(_0x1d0e9f,null))[_0xc3c2('0x22')](removeEntity(_0x1d0e9f,null))[_0xc3c2('0x3f')](handleError(_0x1d0e9f,null));};exports['getConfigurations']=function(_0x16b204,_0x53b8bc,_0x19714d){var _0x3c2bf2={};var _0x1dcfe9={};var _0x148c9e;var _0x27235b;return db[_0xc3c2('0x29')]['findOne']({'where':{'id':_0x16b204[_0xc3c2('0x41')]['id']}})[_0xc3c2('0x22')](handleEntityNotFound(_0x53b8bc,null))[_0xc3c2('0x22')](function(_0x2aa1e8){if(_0x2aa1e8){_0x148c9e=_0x2aa1e8;_0x1dcfe9[_0xc3c2('0x30')]=_[_0xc3c2('0x2e')](db[_0xc3c2('0x4a')][_0xc3c2('0x2a')]);_0x1dcfe9[_0xc3c2('0x2d')]=_[_0xc3c2('0x2e')](_0x16b204[_0xc3c2('0x2d')]);_0x1dcfe9[_0xc3c2('0x36')]=_[_0xc3c2('0x42')](_0x1dcfe9[_0xc3c2('0x30')],_0x1dcfe9['query']);_0x3c2bf2[_0xc3c2('0x2f')]=_['intersection'](_0x1dcfe9[_0xc3c2('0x30')],qs['fields'](_0x16b204[_0xc3c2('0x2d')][_0xc3c2('0x43')]));_0x3c2bf2[_0xc3c2('0x2f')]=_0x3c2bf2['attributes'][_0xc3c2('0x31')]?_0x3c2bf2[_0xc3c2('0x2f')]:_0x1dcfe9[_0xc3c2('0x30')];_0x3c2bf2[_0xc3c2('0x34')]=qs[_0xc3c2('0x35')](_0x16b204[_0xc3c2('0x2d')][_0xc3c2('0x35')]);_0x3c2bf2['where']=qs[_0xc3c2('0x36')](_[_0xc3c2('0x37')](_0x16b204[_0xc3c2('0x2d')],_0x1dcfe9[_0xc3c2('0x36')]));if(_0x16b204[_0xc3c2('0x2d')][_0xc3c2('0x3b')]){_0x3c2bf2[_0xc3c2('0x38')]=_[_0xc3c2('0x39')](_0x3c2bf2[_0xc3c2('0x38')],{'$or':_['map'](_0x3c2bf2[_0xc3c2('0x2f')],function(_0x16956e){var _0x470a28={};_0x470a28[_0x16956e]={'$like':'%'+_0x16b204[_0xc3c2('0x2d')][_0xc3c2('0x3b')]+'%'};return _0x470a28;})});}_0x3c2bf2=_[_0xc3c2('0x39')]({},_0x3c2bf2,_0x16b204[_0xc3c2('0x3c')]);return _0x148c9e[_0xc3c2('0x4b')](_0x3c2bf2);}})[_0xc3c2('0x22')](function(_0x5c3bf0){if(_0x5c3bf0){_0x27235b=_0x5c3bf0['length'];if(!_0x16b204[_0xc3c2('0x2d')][_0xc3c2('0x32')](_0xc3c2('0x33'))){_0x3c2bf2['limit']=qs[_0xc3c2('0x1c')](_0x16b204[_0xc3c2('0x2d')][_0xc3c2('0x1c')]);_0x3c2bf2[_0xc3c2('0x1a')]=qs[_0xc3c2('0x1a')](_0x16b204[_0xc3c2('0x2d')][_0xc3c2('0x1a')]);}return _0x148c9e[_0xc3c2('0x4b')](_0x3c2bf2);}})[_0xc3c2('0x22')](function(_0x17cb5d){if(_0x17cb5d){return _0x17cb5d?{'count':_0x27235b,'rows':_0x17cb5d}:null;}})[_0xc3c2('0x22')](respondWithResult(_0x53b8bc,null))[_0xc3c2('0x3f')](handleError(_0x53b8bc,null));};exports[_0xc3c2('0x4c')]=function(_0x320203,_0x2684db,_0x3aaa9d){if(_0x320203['body']['id']){delete _0x320203[_0xc3c2('0x47')]['id'];}return db[_0xc3c2('0x29')][_0xc3c2('0x4d')]({'where':{'id':_0x320203[_0xc3c2('0x41')]['id']}})[_0xc3c2('0x22')](handleEntityNotFound(_0x2684db,null))['then'](function(_0x2e7dee){if(_0x2e7dee){_0x320203[_0xc3c2('0x47')][_0xc3c2('0x4e')]=_0x2e7dee['id'];_0x320203[_0xc3c2('0x47')][_0xc3c2('0x4f')]=integrations[_0xc3c2('0x50')](_0x320203['body'][_0xc3c2('0x51')],_0x320203['body'][_0xc3c2('0x2c')]);_0x320203[_0xc3c2('0x47')][_0xc3c2('0x52')]=integrations['getDescriptions'](_0x320203[_0xc3c2('0x47')][_0xc3c2('0x51')],_0x320203['body'][_0xc3c2('0x2c')]);return db[_0xc3c2('0x4a')][_0xc3c2('0x46')](_0x320203[_0xc3c2('0x47')],{'include':[{'model':db[_0xc3c2('0x53')],'as':_0xc3c2('0x4f')},{'model':db[_0xc3c2('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2684db,null))[_0xc3c2('0x3f')](handleError(_0x2684db,null));};exports[_0xc3c2('0x54')]=function(_0x36eef2,_0x2cc71c,_0x554baa){var _0x5371dc='';return db[_0xc3c2('0x29')][_0xc3c2('0x4d')]({'where':{'id':_0x36eef2[_0xc3c2('0x41')]['id']},'attributes':['id',_0xc3c2('0x55'),'apiKey']})[_0xc3c2('0x22')](handleEntityNotFound(_0x2cc71c,null))[_0xc3c2('0x22')](function(_0x24d1d8){if(_0x24d1d8){_0x5371dc=_0x24d1d8[_0xc3c2('0x55')];var _0x1324a6=_0x5371dc[_0xc3c2('0x56')](-0x1);if(_0x1324a6==='/'){_0x5371dc=_0x5371dc[_0xc3c2('0x57')](0x0,_0x5371dc[_0xc3c2('0x58')](_0x1324a6));}return rp({'method':_0xc3c2('0x59'),'uri':util[_0xc3c2('0x5a')](_0xc3c2('0x5b'),_0x5371dc,'api/v2/ticket_fields'),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xc3c2('0x5a')](_0xc3c2('0x5c'),_0x24d1d8[_0xc3c2('0x5d')]))[_0xc3c2('0x5e')](_0xc3c2('0x5f')))},'json':!![]});}})['then'](function(_0x10d3db){if(_0x10d3db){var _0x3f2bb7=[_0xc3c2('0x60'),_0xc3c2('0x61'),_0xc3c2('0x62'),_0xc3c2('0x63'),_0xc3c2('0x18'),'priority',_0xc3c2('0x64'),_0xc3c2('0x65'),_0xc3c2('0x66'),_0xc3c2('0x64'),_0xc3c2('0x67')];_[_0xc3c2('0x68')](_0x10d3db,function(_0x50e4e7){return _0x3f2bb7[_0xc3c2('0x69')](_0x50e4e7[_0xc3c2('0x25')])||!_0x50e4e7[_0xc3c2('0x6a')]&&_0x50e4e7[_0xc3c2('0x2c')]!=='custom_text'&&_0x50e4e7['type']!==_0xc3c2('0x6b');});return{'count':_0x10d3db['length'],'rows':_[_0xc3c2('0x28')](_0x10d3db,function(_0x366d15){return{'id':_0x366d15[_0xc3c2('0x25')],'name':_0x366d15['label'],'custom':!_0x366d15[_0xc3c2('0x6a')],'options':_0x366d15[_0xc3c2('0x6c')]?_[_0xc3c2('0x28')](_0x366d15[_0xc3c2('0x6c')],function(_0x44501f){return{'name':_['capitalize'](_0x44501f),'value':_0x44501f};}):[]};})};}})[_0xc3c2('0x22')](respondWithResult(_0x2cc71c,null))[_0xc3c2('0x3f')](function(_0x32650a){var _0x34d990=_0x36eef2[_0xc3c2('0x2d')][_0xc3c2('0x6d')]?0x1f4:_0x32650a[_0xc3c2('0x6e')]||0x1f4;logger[_0xc3c2('0x23')](_0xc3c2('0x6f'),_0xc3c2('0x54'),_0x34d990,JSON[_0xc3c2('0x70')](_0x32650a));delete _0x32650a['name'];if(_0x34d990===0x191){_0x34d990=0x190;}_0x2cc71c['status'](_0x34d990)[_0xc3c2('0x26')](_0x36eef2[_0xc3c2('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x32650a['statusCode']}:_0x32650a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index bec0469..8d137d1 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 _0x0471=['moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x1465d0,_0x1d3161){var _0x525a0f=function(_0x8b63f2){while(--_0x8b63f2){_0x1465d0['push'](_0x1465d0['shift']());}};_0x525a0f(++_0x1d3161);}(_0x0471,0x15a));var _0x1047=function(_0x4d8e83,_0x466624){_0x4d8e83=_0x4d8e83-0x0;var _0x408c91=_0x0471[_0x4d8e83];return _0x408c91;};'use strict';var _=require(_0x1047('0x0'));var util=require(_0x1047('0x1'));var logger=require(_0x1047('0x2'))(_0x1047('0x3'));var moment=require(_0x1047('0x4'));var BPromise=require(_0x1047('0x5'));var rp=require(_0x1047('0x6'));var fs=require('fs');var path=require(_0x1047('0x7'));var rimraf=require(_0x1047('0x8'));var config=require('../../config/environment');var attributes=require(_0x1047('0x9'));var integrations=require(_0x1047('0xa'));module[_0x1047('0xb')]=function(_0x54aff8,_0x16dee9){return _0x54aff8['define'](_0x1047('0xc'),attributes,{'tableName':_0x1047('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc13c=['../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc13c,0x1e0));var _0xcc13=function(_0x210561,_0x3c1c59){_0x210561=_0x210561-0x0;var _0x435afc=_0xc13c[_0x210561];return _0x435afc;};'use strict';var _=require(_0xcc13('0x0'));var util=require('util');var logger=require(_0xcc13('0x1'))(_0xcc13('0x2'));var moment=require(_0xcc13('0x3'));var BPromise=require(_0xcc13('0x4'));var rp=require(_0xcc13('0x5'));var fs=require('fs');var path=require(_0xcc13('0x6'));var rimraf=require(_0xcc13('0x7'));var config=require(_0xcc13('0x8'));var attributes=require(_0xcc13('0x9'));var integrations=require(_0xcc13('0xa'));module[_0xcc13('0xb')]=function(_0x3effd4,_0x3b664d){return _0x3effd4[_0xcc13('0xc')](_0xcc13('0xd'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 0be6a32..364948c 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 _0x5704=['model','map','GetFreshdeskAccount','catch','ShowFreshdeskAccount','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','FreshdeskAccount','findAll','options','raw','attributes','limit','include'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x5704,0x1e3));var _0x4570=function(_0x4f1071,_0x344c47){_0x4f1071=_0x4f1071-0x0;var _0x1fb4dd=_0x5704[_0x4f1071];return _0x1fb4dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4570('0x0'));var BPromise=require(_0x4570('0x1'));var rs=require(_0x4570('0x2'));var fs=require('fs');var Redis=require(_0x4570('0x3'));var db=require(_0x4570('0x4'))['db'];var utils=require(_0x4570('0x5'));var logger=require(_0x4570('0x6'))(_0x4570('0x7'));var config=require(_0x4570('0x8'));var jayson=require(_0x4570('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24bbe2,_0x39f107,_0x1e97c9){return new BPromise(function(_0x3ad974,_0x2ac130){return client[_0x4570('0xa')](_0x24bbe2,_0x1e97c9)[_0x4570('0xb')](function(_0x3648aa){logger[_0x4570('0xc')](_0x4570('0xd'),_0x39f107,_0x4570('0xe'));logger[_0x4570('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x39f107,_0x4570('0xe'),JSON[_0x4570('0x10')](_0x3648aa));if(_0x3648aa['error']){if(_0x3648aa[_0x4570('0x11')]['code']===0x1f4){logger['error'](_0x4570('0xd'),_0x39f107,_0x3648aa[_0x4570('0x11')][_0x4570('0x12')]);return _0x2ac130(_0x3648aa['error'][_0x4570('0x12')]);}logger[_0x4570('0x11')](_0x4570('0xd'),_0x39f107,_0x3648aa[_0x4570('0x11')][_0x4570('0x12')]);return _0x3ad974(_0x3648aa['error'][_0x4570('0x12')]);}else{logger[_0x4570('0xc')](_0x4570('0xd'),_0x39f107,_0x4570('0xe'));_0x3ad974(_0x3648aa[_0x4570('0x13')][_0x4570('0x12')]);}})['catch'](function(_0x3da18d){logger[_0x4570('0x11')](_0x4570('0xd'),_0x39f107,_0x3da18d);_0x2ac130(_0x3da18d);});});}exports['GetFreshdeskAccount']=function(_0x9fcbb1){var _0x129b6e=this;return new Promise(function(_0x8af8ad,_0x1c0500){return db[_0x4570('0x14')][_0x4570('0x15')]({'raw':_0x9fcbb1['options']?_0x9fcbb1[_0x4570('0x16')][_0x4570('0x17')]===undefined?!![]:![]:!![],'where':_0x9fcbb1['options']?_0x9fcbb1[_0x4570('0x16')]['where']||null:null,'attributes':_0x9fcbb1[_0x4570('0x16')]?_0x9fcbb1[_0x4570('0x16')][_0x4570('0x18')]||null:null,'limit':_0x9fcbb1[_0x4570('0x16')]?_0x9fcbb1[_0x4570('0x16')][_0x4570('0x19')]||null:null,'include':_0x9fcbb1[_0x4570('0x16')]?_0x9fcbb1[_0x4570('0x16')][_0x4570('0x1a')]?_['map'](_0x9fcbb1[_0x4570('0x16')][_0x4570('0x1a')],function(_0x22cb8b){return{'model':db[_0x22cb8b[_0x4570('0x1b')]],'as':_0x22cb8b['as'],'attributes':_0x22cb8b[_0x4570('0x18')],'include':_0x22cb8b[_0x4570('0x1a')]?_['map'](_0x22cb8b['include'],function(_0x45ad8e){return{'model':db[_0x45ad8e['model']],'as':_0x45ad8e['as'],'attributes':_0x45ad8e[_0x4570('0x18')],'include':_0x45ad8e[_0x4570('0x1a')]?_[_0x4570('0x1c')](_0x45ad8e[_0x4570('0x1a')],function(_0x5ca4a1){return{'model':db[_0x5ca4a1[_0x4570('0x1b')]],'as':_0x5ca4a1['as'],'attributes':_0x5ca4a1[_0x4570('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4570('0xb')](function(_0x334cda){logger[_0x4570('0xc')](_0x4570('0x1d'),_0x9fcbb1);logger['debug'](_0x4570('0x1d'),_0x9fcbb1,JSON[_0x4570('0x10')](_0x334cda));_0x8af8ad(_0x334cda);})[_0x4570('0x1e')](function(_0x7297c6){logger[_0x4570('0x11')](_0x4570('0x1d'),_0x7297c6[_0x4570('0x12')],_0x9fcbb1);_0x1c0500(_0x129b6e[_0x4570('0x11')](0x1f4,_0x7297c6['message']));});});};exports[_0x4570('0x1f')]=function(_0x319627){var _0xc15df5=this;return new Promise(function(_0x8369d,_0x2780c1){return db['FreshdeskAccount'][_0x4570('0x20')]({'raw':_0x319627['options']?_0x319627[_0x4570('0x16')][_0x4570('0x17')]===undefined?!![]:![]:!![],'where':_0x319627[_0x4570('0x16')]?_0x319627[_0x4570('0x16')][_0x4570('0x21')]||null:null,'attributes':_0x319627[_0x4570('0x16')]?_0x319627['options']['attributes']||null:null,'include':_0x319627['options']?_0x319627[_0x4570('0x16')][_0x4570('0x1a')]?_[_0x4570('0x1c')](_0x319627['options'][_0x4570('0x1a')],function(_0x39781a){return{'model':db[_0x39781a[_0x4570('0x1b')]],'as':_0x39781a['as'],'attributes':_0x39781a[_0x4570('0x18')],'include':_0x39781a['include']?_[_0x4570('0x1c')](_0x39781a[_0x4570('0x1a')],function(_0x5f3367){return{'model':db[_0x5f3367['model']],'as':_0x5f3367['as'],'attributes':_0x5f3367[_0x4570('0x18')],'include':_0x5f3367[_0x4570('0x1a')]?_[_0x4570('0x1c')](_0x5f3367[_0x4570('0x1a')],function(_0x2f51e8){return{'model':db[_0x2f51e8[_0x4570('0x1b')]],'as':_0x2f51e8['as'],'attributes':_0x2f51e8[_0x4570('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4570('0xb')](function(_0x570ff4){logger['info'](_0x4570('0x1f'),_0x319627);logger[_0x4570('0xf')](_0x4570('0x1f'),_0x319627,JSON['stringify'](_0x570ff4));_0x8369d(_0x570ff4);})[_0x4570('0x1e')](function(_0x5549f1){logger[_0x4570('0x11')](_0x4570('0x1f'),_0x5549f1[_0x4570('0x12')],_0x319627);_0x2780c1(_0xc15df5[_0x4570('0x11')](0x1f4,_0x5549f1[_0x4570('0x12')]));});});}; \ No newline at end of file +var _0x5b9c=['message','result','catch','GetFreshdeskAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b9c,0x1a6));var _0xc5b9=function(_0x48783b,_0x2cfe53){_0x48783b=_0x48783b-0x0;var _0x1436d5=_0x5b9c[_0x48783b];return _0x1436d5;};'use strict';var _=require(_0xc5b9('0x0'));var util=require(_0xc5b9('0x1'));var moment=require(_0xc5b9('0x2'));var BPromise=require(_0xc5b9('0x3'));var rs=require(_0xc5b9('0x4'));var fs=require('fs');var Redis=require(_0xc5b9('0x5'));var db=require(_0xc5b9('0x6'))['db'];var utils=require(_0xc5b9('0x7'));var logger=require('../../config/logger')(_0xc5b9('0x8'));var config=require(_0xc5b9('0x9'));var jayson=require(_0xc5b9('0xa'));var client=jayson[_0xc5b9('0xb')][_0xc5b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x258c2d,_0xf835ee,_0x35a3a2){return new BPromise(function(_0x13dc3,_0x40b1fb){return client[_0xc5b9('0xd')](_0x258c2d,_0x35a3a2)[_0xc5b9('0xe')](function(_0x4026f6){logger[_0xc5b9('0xf')](_0xc5b9('0x10'),_0xf835ee,'request\x20sent');logger[_0xc5b9('0x11')](_0xc5b9('0x12'),_0xf835ee,_0xc5b9('0x13'),JSON[_0xc5b9('0x14')](_0x4026f6));if(_0x4026f6[_0xc5b9('0x15')]){if(_0x4026f6[_0xc5b9('0x15')]['code']===0x1f4){logger[_0xc5b9('0x15')](_0xc5b9('0x10'),_0xf835ee,_0x4026f6[_0xc5b9('0x15')][_0xc5b9('0x16')]);return _0x40b1fb(_0x4026f6['error']['message']);}logger[_0xc5b9('0x15')](_0xc5b9('0x10'),_0xf835ee,_0x4026f6[_0xc5b9('0x15')]['message']);return _0x13dc3(_0x4026f6['error'][_0xc5b9('0x16')]);}else{logger[_0xc5b9('0xf')](_0xc5b9('0x10'),_0xf835ee,_0xc5b9('0x13'));_0x13dc3(_0x4026f6[_0xc5b9('0x17')]['message']);}})[_0xc5b9('0x18')](function(_0x313931){logger[_0xc5b9('0x15')](_0xc5b9('0x10'),_0xf835ee,_0x313931);_0x40b1fb(_0x313931);});});}exports[_0xc5b9('0x19')]=function(_0x4f2c5e){var _0x280e7e=this;return new Promise(function(_0xe05539,_0x4bedbe){return db['FreshdeskAccount']['findAll']({'raw':_0x4f2c5e[_0xc5b9('0x1a')]?_0x4f2c5e[_0xc5b9('0x1a')][_0xc5b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f2c5e[_0xc5b9('0x1a')]?_0x4f2c5e[_0xc5b9('0x1a')][_0xc5b9('0x1c')]||null:null,'attributes':_0x4f2c5e[_0xc5b9('0x1a')]?_0x4f2c5e[_0xc5b9('0x1a')][_0xc5b9('0x1d')]||null:null,'limit':_0x4f2c5e[_0xc5b9('0x1a')]?_0x4f2c5e[_0xc5b9('0x1a')][_0xc5b9('0x1e')]||null:null,'include':_0x4f2c5e[_0xc5b9('0x1a')]?_0x4f2c5e[_0xc5b9('0x1a')][_0xc5b9('0x1f')]?_[_0xc5b9('0x20')](_0x4f2c5e[_0xc5b9('0x1a')][_0xc5b9('0x1f')],function(_0x258327){return{'model':db[_0x258327[_0xc5b9('0x21')]],'as':_0x258327['as'],'attributes':_0x258327['attributes'],'include':_0x258327['include']?_[_0xc5b9('0x20')](_0x258327[_0xc5b9('0x1f')],function(_0x199635){return{'model':db[_0x199635[_0xc5b9('0x21')]],'as':_0x199635['as'],'attributes':_0x199635['attributes'],'include':_0x199635[_0xc5b9('0x1f')]?_['map'](_0x199635[_0xc5b9('0x1f')],function(_0x417d6a){return{'model':db[_0x417d6a[_0xc5b9('0x21')]],'as':_0x417d6a['as'],'attributes':_0x417d6a[_0xc5b9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc5b9('0xe')](function(_0x58d438){logger[_0xc5b9('0xf')]('GetFreshdeskAccount',_0x4f2c5e);logger[_0xc5b9('0x11')](_0xc5b9('0x19'),_0x4f2c5e,JSON[_0xc5b9('0x14')](_0x58d438));_0xe05539(_0x58d438);})[_0xc5b9('0x18')](function(_0xf4717b){logger[_0xc5b9('0x15')](_0xc5b9('0x19'),_0xf4717b['message'],_0x4f2c5e);_0x4bedbe(_0x280e7e[_0xc5b9('0x15')](0x1f4,_0xf4717b[_0xc5b9('0x16')]));});});};exports[_0xc5b9('0x22')]=function(_0x2c854c){var _0x15d672=this;return new Promise(function(_0x386fdf,_0x40fbc9){return db[_0xc5b9('0x23')][_0xc5b9('0x24')]({'raw':_0x2c854c[_0xc5b9('0x1a')]?_0x2c854c['options'][_0xc5b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c854c[_0xc5b9('0x1a')]?_0x2c854c[_0xc5b9('0x1a')][_0xc5b9('0x1c')]||null:null,'attributes':_0x2c854c[_0xc5b9('0x1a')]?_0x2c854c[_0xc5b9('0x1a')][_0xc5b9('0x1d')]||null:null,'include':_0x2c854c[_0xc5b9('0x1a')]?_0x2c854c[_0xc5b9('0x1a')][_0xc5b9('0x1f')]?_[_0xc5b9('0x20')](_0x2c854c['options']['include'],function(_0x132802){return{'model':db[_0x132802[_0xc5b9('0x21')]],'as':_0x132802['as'],'attributes':_0x132802[_0xc5b9('0x1d')],'include':_0x132802[_0xc5b9('0x1f')]?_['map'](_0x132802[_0xc5b9('0x1f')],function(_0x27b5d3){return{'model':db[_0x27b5d3[_0xc5b9('0x21')]],'as':_0x27b5d3['as'],'attributes':_0x27b5d3[_0xc5b9('0x1d')],'include':_0x27b5d3[_0xc5b9('0x1f')]?_['map'](_0x27b5d3[_0xc5b9('0x1f')],function(_0x36c568){return{'model':db[_0x36c568[_0xc5b9('0x21')]],'as':_0x36c568['as'],'attributes':_0x36c568['attributes']};}):[]};}):[]};}):[]:[]})[_0xc5b9('0xe')](function(_0x22c14d){logger[_0xc5b9('0xf')]('ShowFreshdeskAccount',_0x2c854c);logger[_0xc5b9('0x11')](_0xc5b9('0x22'),_0x2c854c,JSON[_0xc5b9('0x14')](_0x22c14d));_0x386fdf(_0x22c14d);})[_0xc5b9('0x18')](function(_0xcb1f77){logger[_0xc5b9('0x15')]('ShowFreshdeskAccount',_0xcb1f77['message'],_0x2c854c);_0x40fbc9(_0x15d672[_0xc5b9('0x15')](0x1f4,_0xcb1f77[_0xc5b9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 470671b..3fc9cc2 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 _0xb254=['get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','put','update','/:id','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','show'];(function(_0x4f42ea,_0x383f3d){var _0x59a4c3=function(_0x3303bb){while(--_0x3303bb){_0x4f42ea['push'](_0x4f42ea['shift']());}};_0x59a4c3(++_0x383f3d);}(_0xb254,0x165));var _0x4b25=function(_0x509b26,_0x1bcdff){_0x509b26=_0x509b26-0x0;var _0x2531a6=_0xb254[_0x509b26];return _0x2531a6;};'use strict';var multer=require('multer');var util=require(_0x4b25('0x0'));var path=require(_0x4b25('0x1'));var timeout=require(_0x4b25('0x2'));var express=require(_0x4b25('0x3'));var router=express[_0x4b25('0x4')]();var fs_extra=require(_0x4b25('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b25('0x6'));var controller=require(_0x4b25('0x7'));router['get']('/',auth[_0x4b25('0x8')](),controller[_0x4b25('0x9')]);router['get']('/:id',auth[_0x4b25('0x8')](),controller[_0x4b25('0xa')]);router[_0x4b25('0xb')](_0x4b25('0xc'),auth[_0x4b25('0x8')](),controller[_0x4b25('0xd')]);router[_0x4b25('0xb')](_0x4b25('0xe'),auth[_0x4b25('0x8')](),controller[_0x4b25('0xf')]);router[_0x4b25('0xb')]('/:id/descriptions',auth[_0x4b25('0x8')](),controller[_0x4b25('0x10')]);router['get'](_0x4b25('0x11'),auth['isAuthenticated'](),controller['getTags']);router[_0x4b25('0x12')]('/',auth[_0x4b25('0x8')](),controller[_0x4b25('0x13')]);router[_0x4b25('0x12')]('/:id/tags',auth[_0x4b25('0x8')](),controller['setTags']);router[_0x4b25('0x14')]('/:id',auth[_0x4b25('0x8')](),controller[_0x4b25('0x15')]);router['delete'](_0x4b25('0x16'),auth[_0x4b25('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2034=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id/fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2034,0xf7));var _0x4203=function(_0x3a697e,_0x34f5ba){_0x3a697e=_0x3a697e-0x0;var _0x31d6cd=_0x2034[_0x3a697e];return _0x31d6cd;};'use strict';var multer=require(_0x4203('0x0'));var util=require(_0x4203('0x1'));var path=require(_0x4203('0x2'));var timeout=require(_0x4203('0x3'));var express=require(_0x4203('0x4'));var router=express[_0x4203('0x5')]();var fs_extra=require(_0x4203('0x6'));var auth=require(_0x4203('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4203('0x8'));var controller=require(_0x4203('0x9'));router[_0x4203('0xa')]('/',auth[_0x4203('0xb')](),controller[_0x4203('0xc')]);router[_0x4203('0xa')]('/:id',auth[_0x4203('0xb')](),controller['show']);router[_0x4203('0xa')](_0x4203('0xd'),auth[_0x4203('0xb')](),controller[_0x4203('0xe')]);router[_0x4203('0xa')](_0x4203('0xf'),auth[_0x4203('0xb')](),controller[_0x4203('0x10')]);router[_0x4203('0xa')](_0x4203('0x11'),auth[_0x4203('0xb')](),controller[_0x4203('0x12')]);router[_0x4203('0xa')](_0x4203('0x13'),auth['isAuthenticated'](),controller['getTags']);router[_0x4203('0x14')]('/',auth[_0x4203('0xb')](),controller[_0x4203('0x15')]);router[_0x4203('0x14')](_0x4203('0x13'),auth['isAuthenticated'](),controller[_0x4203('0x16')]);router[_0x4203('0x17')](_0x4203('0x18'),auth[_0x4203('0xb')](),controller[_0x4203('0x19')]);router[_0x4203('0x1a')](_0x4203('0x18'),auth['isAuthenticated'](),controller[_0x4203('0x1b')]);module[_0x4203('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2670404..db2fb60 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 _0x44b6=['exports','STRING','sequelize'];(function(_0x4bed26,_0x4ec710){var _0x48d4a9=function(_0x438ed2){while(--_0x438ed2){_0x4bed26['push'](_0x4bed26['shift']());}};_0x48d4a9(++_0x4ec710);}(_0x44b6,0xa7));var _0x644b=function(_0x404991,_0x5a9865){_0x404991=_0x404991-0x0;var _0x429b45=_0x44b6[_0x404991];return _0x429b45;};'use strict';var Sequelize=require(_0x644b('0x0'));module[_0x644b('0x1')]={'name':{'type':Sequelize[_0x644b('0x2')]},'description':{'type':Sequelize[_0x644b('0x2')]}}; \ No newline at end of file +var _0x6da6=['STRING'];(function(_0x496212,_0x5c73b1){var _0xb988eb=function(_0xbf0f4b){while(--_0xbf0f4b){_0x496212['push'](_0x496212['shift']());}};_0xb988eb(++_0x5c73b1);}(_0x6da6,0x1b8));var _0x66da=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0x6da6[_0x219fa0];return _0xc603fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x66da('0x0')]},'description':{'type':Sequelize[_0x66da('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 6c97c8a..d8fa551 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 _0x5b91=['setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','sort','filter','where','merge','VIRTUAL','include','rows','catch','show','params','keys','length','includeAll','options','find','create','body','findOne','FreshdeskField','order','pick','getFields','getSubjects','getDescriptions','Tag','getTags','hasOwnProperty'];(function(_0x5e7703,_0x2085fa){var _0x8764cc=function(_0x5efac3){while(--_0x5efac3){_0x5e7703['push'](_0x5e7703['shift']());}};_0x8764cc(++_0x2085fa);}(_0x5b91,0xae));var _0x15b9=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x5b91[_0x14363e];return _0x17c56d;};'use strict';var emlformat=require(_0x15b9('0x0'));var rimraf=require(_0x15b9('0x1'));var zipdir=require(_0x15b9('0x2'));var jsonpatch=require(_0x15b9('0x3'));var rp=require(_0x15b9('0x4'));var moment=require(_0x15b9('0x5'));var BPromise=require(_0x15b9('0x6'));var Mustache=require(_0x15b9('0x7'));var util=require(_0x15b9('0x8'));var path=require('path');var sox=require(_0x15b9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15b9('0xa'));var squel=require(_0x15b9('0xb'));var crypto=require(_0x15b9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x15b9('0xd'));var toCsv=require(_0x15b9('0xe'));var querystring=require(_0x15b9('0xf'));var Papa=require(_0x15b9('0x10'));var Redis=require(_0x15b9('0x11'));var authService=require(_0x15b9('0x12'));var qs=require(_0x15b9('0x13'));var as=require(_0x15b9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15b9('0x15'));var utils=require(_0x15b9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x15b9('0x17'));var db=require(_0x15b9('0x18'))['db'];function respondWithStatusCode(_0x2ea818,_0x2e3f40){_0x2e3f40=_0x2e3f40||0xcc;return function(_0x2ed238){if(_0x2ed238){return _0x2ea818['sendStatus'](_0x2e3f40);}return _0x2ea818[_0x15b9('0x19')](_0x2e3f40)[_0x15b9('0x1a')]();};}function respondWithResult(_0x2a169c,_0x31e552){_0x31e552=_0x31e552||0xc8;return function(_0x179588){if(_0x179588){return _0x2a169c[_0x15b9('0x19')](_0x31e552)[_0x15b9('0x1b')](_0x179588);}};}function respondWithFilteredResult(_0x523098,_0x5e7350){return function(_0x11c735){if(_0x11c735){var _0x3a442b=typeof _0x5e7350[_0x15b9('0x1c')]===_0x15b9('0x1d')&&typeof _0x5e7350[_0x15b9('0x1e')]===_0x15b9('0x1d');var _0x254808=_0x11c735[_0x15b9('0x1f')];var _0x1f1ee1=_0x3a442b?0x0:_0x5e7350[_0x15b9('0x1c')];var _0x54acae=_0x3a442b?_0x11c735[_0x15b9('0x1f')]:_0x5e7350['offset']+_0x5e7350[_0x15b9('0x1e')];var _0x3a0506;if(_0x54acae>=_0x254808){_0x54acae=_0x254808;_0x3a0506=0xc8;}else{_0x3a0506=0xce;}_0x523098[_0x15b9('0x19')](_0x3a0506);return _0x523098[_0x15b9('0x20')]('Content-Range',_0x1f1ee1+'-'+_0x54acae+'/'+_0x254808)[_0x15b9('0x1b')](_0x11c735);}return null;};}function patchUpdates(_0x5a3fe0){return function(_0x220a40){try{jsonpatch[_0x15b9('0x21')](_0x220a40,_0x5a3fe0,!![]);}catch(_0x340a03){return BPromise[_0x15b9('0x22')](_0x340a03);}return _0x220a40[_0x15b9('0x23')]();};}function saveUpdates(_0x205463,_0x57a1ae){return function(_0x22032d){if(_0x22032d){return _0x22032d[_0x15b9('0x24')](_0x205463)[_0x15b9('0x25')](function(_0x3073bf){return _0x3073bf;});}return null;};}function removeEntity(_0x2da2b3,_0x492bba){return function(_0x265885){if(_0x265885){return _0x265885[_0x15b9('0x26')]()[_0x15b9('0x25')](function(){_0x2da2b3[_0x15b9('0x19')](0xcc)[_0x15b9('0x1a')]();});}};}function handleEntityNotFound(_0x495202,_0x5fd55d){return function(_0x3a688c){if(!_0x3a688c){_0x495202[_0x15b9('0x27')](0x194);}return _0x3a688c;};}function handleError(_0xe3c269,_0xe18e86){_0xe18e86=_0xe18e86||0x1f4;return function(_0xc289c1){logger[_0x15b9('0x28')](_0xc289c1[_0x15b9('0x29')]);if(_0xc289c1['name']){delete _0xc289c1[_0x15b9('0x2a')];}_0xe3c269[_0x15b9('0x19')](_0xe18e86)[_0x15b9('0x2b')](_0xc289c1);};}exports[_0x15b9('0x2c')]=function(_0x518a67,_0x493c84){var _0x3c2b0b={},_0x20d415={},_0xe04b6f={'count':0x0,'rows':[]};var _0x5992de=_['map'](db[_0x15b9('0x2d')][_0x15b9('0x2e')],function(_0x5a8cc3){return{'name':_0x5a8cc3['fieldName'],'type':_0x5a8cc3[_0x15b9('0x2f')][_0x15b9('0x30')]};});_0x20d415[_0x15b9('0x31')]=_[_0x15b9('0x32')](_0x5992de,'name');_0x20d415[_0x15b9('0x33')]=_['keys'](_0x518a67['query']);_0x20d415[_0x15b9('0x34')]=_[_0x15b9('0x35')](_0x20d415['model'],_0x20d415[_0x15b9('0x33')]);_0x3c2b0b['attributes']=_[_0x15b9('0x35')](_0x20d415[_0x15b9('0x31')],qs[_0x15b9('0x36')](_0x518a67[_0x15b9('0x33')][_0x15b9('0x36')]));_0x3c2b0b[_0x15b9('0x37')]=_0x3c2b0b[_0x15b9('0x37')]['length']?_0x3c2b0b[_0x15b9('0x37')]:_0x20d415[_0x15b9('0x31')];if(!_0x518a67['query']['hasOwnProperty'](_0x15b9('0x38'))){_0x3c2b0b[_0x15b9('0x1e')]=qs['limit'](_0x518a67[_0x15b9('0x33')]['limit']);_0x3c2b0b[_0x15b9('0x1c')]=qs['offset'](_0x518a67[_0x15b9('0x33')][_0x15b9('0x1c')]);}_0x3c2b0b['order']=qs[_0x15b9('0x39')](_0x518a67[_0x15b9('0x33')]['sort']);_0x3c2b0b['where']=qs[_0x15b9('0x34')](_['pick'](_0x518a67['query'],_0x20d415[_0x15b9('0x34')]),_0x5992de);if(_0x518a67[_0x15b9('0x33')][_0x15b9('0x3a')]){_0x3c2b0b[_0x15b9('0x3b')]=_[_0x15b9('0x3c')](_0x3c2b0b[_0x15b9('0x3b')],{'$or':_[_0x15b9('0x32')](_0x5992de,function(_0x321522){if(_0x321522['type']!==_0x15b9('0x3d')){var _0x1a775f={};_0x1a775f[_0x321522['name']]={'$like':'%'+_0x518a67[_0x15b9('0x33')][_0x15b9('0x3a')]+'%'};return _0x1a775f;}})});}_0x3c2b0b=_[_0x15b9('0x3c')]({},_0x3c2b0b,_0x518a67['options']);var _0x4dbb58={'where':_0x3c2b0b[_0x15b9('0x3b')]};return db['FreshdeskConfiguration']['count'](_0x4dbb58)[_0x15b9('0x25')](function(_0x49e9c6){_0xe04b6f[_0x15b9('0x1f')]=_0x49e9c6;if(_0x518a67[_0x15b9('0x33')]['includeAll']){_0x3c2b0b[_0x15b9('0x3e')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x3c2b0b);})[_0x15b9('0x25')](function(_0x4cce8c){_0xe04b6f[_0x15b9('0x3f')]=_0x4cce8c;return _0xe04b6f;})[_0x15b9('0x25')](respondWithFilteredResult(_0x493c84,_0x3c2b0b))[_0x15b9('0x40')](handleError(_0x493c84,null));};exports[_0x15b9('0x41')]=function(_0x3add6d,_0x175d3f){var _0xf60a51={'raw':![],'where':{'id':_0x3add6d[_0x15b9('0x42')]['id']}},_0x238364={};_0x238364[_0x15b9('0x31')]=_['keys'](db['FreshdeskConfiguration'][_0x15b9('0x2e')]);_0x238364[_0x15b9('0x33')]=_[_0x15b9('0x43')](_0x3add6d['query']);_0x238364[_0x15b9('0x34')]=_[_0x15b9('0x35')](_0x238364['model'],_0x238364[_0x15b9('0x33')]);_0xf60a51['attributes']=_[_0x15b9('0x35')](_0x238364[_0x15b9('0x31')],qs['fields'](_0x3add6d[_0x15b9('0x33')][_0x15b9('0x36')]));_0xf60a51[_0x15b9('0x37')]=_0xf60a51[_0x15b9('0x37')][_0x15b9('0x44')]?_0xf60a51['attributes']:_0x238364[_0x15b9('0x31')];if(_0x3add6d['query'][_0x15b9('0x45')]){_0xf60a51[_0x15b9('0x3e')]=[{'all':!![]}];}_0xf60a51=_['merge']({},_0xf60a51,_0x3add6d[_0x15b9('0x46')]);return db[_0x15b9('0x2d')][_0x15b9('0x47')](_0xf60a51)[_0x15b9('0x25')](handleEntityNotFound(_0x175d3f,null))['then'](respondWithResult(_0x175d3f,null))[_0x15b9('0x40')](handleError(_0x175d3f,null));};exports[_0x15b9('0x48')]=function(_0x1e28ef,_0x430625){return db[_0x15b9('0x2d')][_0x15b9('0x48')](_0x1e28ef[_0x15b9('0x49')],{})[_0x15b9('0x25')](respondWithResult(_0x430625,0xc9))['catch'](handleError(_0x430625,null));};exports[_0x15b9('0x24')]=function(_0x4e747d,_0x921386){if(_0x4e747d[_0x15b9('0x49')]['id']){delete _0x4e747d[_0x15b9('0x49')]['id'];}return db[_0x15b9('0x2d')][_0x15b9('0x47')]({'where':{'id':_0x4e747d[_0x15b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x921386,null))[_0x15b9('0x25')](saveUpdates(_0x4e747d['body'],null))[_0x15b9('0x25')](respondWithResult(_0x921386,null))[_0x15b9('0x40')](handleError(_0x921386,null));};exports[_0x15b9('0x26')]=function(_0x3dfce3,_0x499150){return db[_0x15b9('0x2d')][_0x15b9('0x47')]({'where':{'id':_0x3dfce3[_0x15b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x499150,null))[_0x15b9('0x25')](removeEntity(_0x499150,null))[_0x15b9('0x40')](handleError(_0x499150,null));};exports['getFields']=function(_0x2427e4,_0x43ea85,_0x27afbc){var _0x5c12c9={};var _0x58fc13={};var _0xb2e9a6;var _0x3fd670;return db[_0x15b9('0x2d')][_0x15b9('0x4a')]({'where':{'id':_0x2427e4[_0x15b9('0x42')]['id']}})[_0x15b9('0x25')](handleEntityNotFound(_0x43ea85,null))[_0x15b9('0x25')](function(_0x4d71ec){if(_0x4d71ec){_0xb2e9a6=_0x4d71ec;_0x58fc13[_0x15b9('0x31')]=_['keys'](db[_0x15b9('0x4b')][_0x15b9('0x2e')]);_0x58fc13[_0x15b9('0x33')]=_[_0x15b9('0x43')](_0x2427e4[_0x15b9('0x33')]);_0x58fc13[_0x15b9('0x34')]=_[_0x15b9('0x35')](_0x58fc13[_0x15b9('0x31')],_0x58fc13[_0x15b9('0x33')]);_0x5c12c9['attributes']=_[_0x15b9('0x35')](_0x58fc13[_0x15b9('0x31')],qs[_0x15b9('0x36')](_0x2427e4[_0x15b9('0x33')][_0x15b9('0x36')]));_0x5c12c9['attributes']=_0x5c12c9[_0x15b9('0x37')]['length']?_0x5c12c9[_0x15b9('0x37')]:_0x58fc13[_0x15b9('0x31')];_0x5c12c9[_0x15b9('0x4c')]=qs[_0x15b9('0x39')](_0x2427e4[_0x15b9('0x33')][_0x15b9('0x39')]);_0x5c12c9[_0x15b9('0x3b')]=qs['filters'](_[_0x15b9('0x4d')](_0x2427e4[_0x15b9('0x33')],_0x58fc13[_0x15b9('0x34')]));if(_0x2427e4[_0x15b9('0x33')][_0x15b9('0x3a')]){_0x5c12c9['where']=_[_0x15b9('0x3c')](_0x5c12c9[_0x15b9('0x3b')],{'$or':_[_0x15b9('0x32')](_0x5c12c9[_0x15b9('0x37')],function(_0x3ecace){var _0x49b036={};_0x49b036[_0x3ecace]={'$like':'%'+_0x2427e4[_0x15b9('0x33')][_0x15b9('0x3a')]+'%'};return _0x49b036;})});}_0x5c12c9=_[_0x15b9('0x3c')]({},_0x5c12c9,_0x2427e4['options']);return _0xb2e9a6['getFields'](_0x5c12c9);}})['then'](function(_0x1dad16){if(_0x1dad16){_0x3fd670=_0x1dad16[_0x15b9('0x44')];if(!_0x2427e4[_0x15b9('0x33')]['hasOwnProperty'](_0x15b9('0x38'))){_0x5c12c9[_0x15b9('0x1e')]=qs['limit'](_0x2427e4[_0x15b9('0x33')]['limit']);_0x5c12c9[_0x15b9('0x1c')]=qs['offset'](_0x2427e4[_0x15b9('0x33')][_0x15b9('0x1c')]);}return _0xb2e9a6[_0x15b9('0x4e')](_0x5c12c9);}})[_0x15b9('0x25')](function(_0x455827){if(_0x455827){return _0x455827?{'count':_0x3fd670,'rows':_0x455827}:null;}})[_0x15b9('0x25')](respondWithResult(_0x43ea85,null))[_0x15b9('0x40')](handleError(_0x43ea85,null));};exports[_0x15b9('0x4f')]=function(_0x51ee95,_0x4bbdc6,_0x1fa7a3){var _0x29a803={};var _0x1df131={};var _0x306427;var _0x5ce457;return db[_0x15b9('0x2d')][_0x15b9('0x4a')]({'where':{'id':_0x51ee95[_0x15b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x4bbdc6,null))[_0x15b9('0x25')](function(_0x52e482){if(_0x52e482){_0x306427=_0x52e482;_0x1df131['model']=_[_0x15b9('0x43')](db[_0x15b9('0x4b')][_0x15b9('0x2e')]);_0x1df131[_0x15b9('0x33')]=_[_0x15b9('0x43')](_0x51ee95[_0x15b9('0x33')]);_0x1df131[_0x15b9('0x34')]=_[_0x15b9('0x35')](_0x1df131[_0x15b9('0x31')],_0x1df131['query']);_0x29a803[_0x15b9('0x37')]=_[_0x15b9('0x35')](_0x1df131[_0x15b9('0x31')],qs[_0x15b9('0x36')](_0x51ee95[_0x15b9('0x33')][_0x15b9('0x36')]));_0x29a803['attributes']=_0x29a803[_0x15b9('0x37')][_0x15b9('0x44')]?_0x29a803[_0x15b9('0x37')]:_0x1df131[_0x15b9('0x31')];_0x29a803[_0x15b9('0x4c')]=qs['sort'](_0x51ee95[_0x15b9('0x33')][_0x15b9('0x39')]);_0x29a803[_0x15b9('0x3b')]=qs[_0x15b9('0x34')](_[_0x15b9('0x4d')](_0x51ee95[_0x15b9('0x33')],_0x1df131[_0x15b9('0x34')]));if(_0x51ee95[_0x15b9('0x33')][_0x15b9('0x3a')]){_0x29a803[_0x15b9('0x3b')]=_['merge'](_0x29a803[_0x15b9('0x3b')],{'$or':_[_0x15b9('0x32')](_0x29a803[_0x15b9('0x37')],function(_0x3b628c){var _0x48640e={};_0x48640e[_0x3b628c]={'$like':'%'+_0x51ee95[_0x15b9('0x33')][_0x15b9('0x3a')]+'%'};return _0x48640e;})});}_0x29a803=_[_0x15b9('0x3c')]({},_0x29a803,_0x51ee95[_0x15b9('0x46')]);return _0x306427[_0x15b9('0x4f')](_0x29a803);}})['then'](function(_0x4e1c7c){if(_0x4e1c7c){_0x5ce457=_0x4e1c7c[_0x15b9('0x44')];if(!_0x51ee95[_0x15b9('0x33')]['hasOwnProperty']('nolimit')){_0x29a803[_0x15b9('0x1e')]=qs[_0x15b9('0x1e')](_0x51ee95[_0x15b9('0x33')][_0x15b9('0x1e')]);_0x29a803[_0x15b9('0x1c')]=qs['offset'](_0x51ee95['query']['offset']);}return _0x306427[_0x15b9('0x4f')](_0x29a803);}})[_0x15b9('0x25')](function(_0x2c564e){if(_0x2c564e){return _0x2c564e?{'count':_0x5ce457,'rows':_0x2c564e}:null;}})[_0x15b9('0x25')](respondWithResult(_0x4bbdc6,null))[_0x15b9('0x40')](handleError(_0x4bbdc6,null));};exports['getDescriptions']=function(_0x58cb2b,_0x54058d,_0x1ff659){var _0x3addb8={};var _0x1f0dc4={};var _0x1e6973;var _0xb8ae84;return db[_0x15b9('0x2d')][_0x15b9('0x4a')]({'where':{'id':_0x58cb2b[_0x15b9('0x42')]['id']}})[_0x15b9('0x25')](handleEntityNotFound(_0x54058d,null))[_0x15b9('0x25')](function(_0x16247a){if(_0x16247a){_0x1e6973=_0x16247a;_0x1f0dc4[_0x15b9('0x31')]=_[_0x15b9('0x43')](db[_0x15b9('0x4b')][_0x15b9('0x2e')]);_0x1f0dc4[_0x15b9('0x33')]=_[_0x15b9('0x43')](_0x58cb2b['query']);_0x1f0dc4[_0x15b9('0x34')]=_['intersection'](_0x1f0dc4['model'],_0x1f0dc4[_0x15b9('0x33')]);_0x3addb8[_0x15b9('0x37')]=_[_0x15b9('0x35')](_0x1f0dc4['model'],qs['fields'](_0x58cb2b[_0x15b9('0x33')][_0x15b9('0x36')]));_0x3addb8['attributes']=_0x3addb8[_0x15b9('0x37')]['length']?_0x3addb8[_0x15b9('0x37')]:_0x1f0dc4[_0x15b9('0x31')];_0x3addb8[_0x15b9('0x4c')]=qs[_0x15b9('0x39')](_0x58cb2b[_0x15b9('0x33')][_0x15b9('0x39')]);_0x3addb8[_0x15b9('0x3b')]=qs[_0x15b9('0x34')](_['pick'](_0x58cb2b[_0x15b9('0x33')],_0x1f0dc4['filters']));if(_0x58cb2b[_0x15b9('0x33')]['filter']){_0x3addb8['where']=_[_0x15b9('0x3c')](_0x3addb8['where'],{'$or':_['map'](_0x3addb8['attributes'],function(_0x1fc991){var _0x2cd2cf={};_0x2cd2cf[_0x1fc991]={'$like':'%'+_0x58cb2b['query'][_0x15b9('0x3a')]+'%'};return _0x2cd2cf;})});}_0x3addb8=_['merge']({},_0x3addb8,_0x58cb2b['options']);return _0x1e6973['getDescriptions'](_0x3addb8);}})[_0x15b9('0x25')](function(_0x3f35ab){if(_0x3f35ab){_0xb8ae84=_0x3f35ab[_0x15b9('0x44')];if(!_0x58cb2b[_0x15b9('0x33')]['hasOwnProperty']('nolimit')){_0x3addb8[_0x15b9('0x1e')]=qs['limit'](_0x58cb2b[_0x15b9('0x33')][_0x15b9('0x1e')]);_0x3addb8[_0x15b9('0x1c')]=qs[_0x15b9('0x1c')](_0x58cb2b['query'][_0x15b9('0x1c')]);}return _0x1e6973[_0x15b9('0x50')](_0x3addb8);}})[_0x15b9('0x25')](function(_0xc1b0a5){if(_0xc1b0a5){return _0xc1b0a5?{'count':_0xb8ae84,'rows':_0xc1b0a5}:null;}})[_0x15b9('0x25')](respondWithResult(_0x54058d,null))[_0x15b9('0x40')](handleError(_0x54058d,null));};exports['getTags']=function(_0x3af26,_0x17cf95,_0x4bbba2){var _0x19be59={};var _0x2d3241={};var _0x1561ba;var _0x544181;return db[_0x15b9('0x2d')]['findOne']({'where':{'id':_0x3af26[_0x15b9('0x42')]['id']}})[_0x15b9('0x25')](handleEntityNotFound(_0x17cf95,null))[_0x15b9('0x25')](function(_0x1b794f){if(_0x1b794f){_0x1561ba=_0x1b794f;_0x2d3241[_0x15b9('0x31')]=_[_0x15b9('0x43')](db[_0x15b9('0x51')][_0x15b9('0x2e')]);_0x2d3241['query']=_['keys'](_0x3af26['query']);_0x2d3241[_0x15b9('0x34')]=_['intersection'](_0x2d3241[_0x15b9('0x31')],_0x2d3241[_0x15b9('0x33')]);_0x19be59[_0x15b9('0x37')]=_[_0x15b9('0x35')](_0x2d3241[_0x15b9('0x31')],qs[_0x15b9('0x36')](_0x3af26[_0x15b9('0x33')]['fields']));_0x19be59[_0x15b9('0x37')]=_0x19be59[_0x15b9('0x37')][_0x15b9('0x44')]?_0x19be59[_0x15b9('0x37')]:_0x2d3241[_0x15b9('0x31')];_0x19be59['order']=qs[_0x15b9('0x39')](_0x3af26[_0x15b9('0x33')][_0x15b9('0x39')]);_0x19be59[_0x15b9('0x3b')]=qs[_0x15b9('0x34')](_[_0x15b9('0x4d')](_0x3af26[_0x15b9('0x33')],_0x2d3241[_0x15b9('0x34')]));if(_0x3af26[_0x15b9('0x33')][_0x15b9('0x3a')]){_0x19be59['where']=_['merge'](_0x19be59[_0x15b9('0x3b')],{'$or':_[_0x15b9('0x32')](_0x19be59[_0x15b9('0x37')],function(_0x43bdfd){var _0x18bfd1={};_0x18bfd1[_0x43bdfd]={'$like':'%'+_0x3af26['query'][_0x15b9('0x3a')]+'%'};return _0x18bfd1;})});}_0x19be59=_[_0x15b9('0x3c')]({},_0x19be59,_0x3af26[_0x15b9('0x46')]);return _0x1561ba[_0x15b9('0x52')](_0x19be59);}})['then'](function(_0x633a0d){if(_0x633a0d){_0x544181=_0x633a0d[_0x15b9('0x44')];if(!_0x3af26[_0x15b9('0x33')][_0x15b9('0x53')]('nolimit')){_0x19be59[_0x15b9('0x1e')]=qs[_0x15b9('0x1e')](_0x3af26[_0x15b9('0x33')][_0x15b9('0x1e')]);_0x19be59['offset']=qs[_0x15b9('0x1c')](_0x3af26['query']['offset']);}return _0x1561ba['getTags'](_0x19be59);}})['then'](function(_0x3ce407){if(_0x3ce407){return _0x3ce407?{'count':_0x544181,'rows':_0x3ce407}:null;}})['then'](respondWithResult(_0x17cf95,null))[_0x15b9('0x40')](handleError(_0x17cf95,null));};exports['setTags']=function(_0x10eb5f,_0x11ab8e,_0xb3bd60){if(_0x10eb5f[_0x15b9('0x49')]['id']){delete _0x10eb5f[_0x15b9('0x49')]['id'];}return db[_0x15b9('0x2d')][_0x15b9('0x4a')]({'where':{'id':_0x10eb5f['params']['id']}})[_0x15b9('0x25')](handleEntityNotFound(_0x11ab8e,null))[_0x15b9('0x25')](function(_0x416d78){if(_0x416d78){return _0x416d78[_0x15b9('0x54')](_0x10eb5f['body'][_0x15b9('0x55')]||[]);}return null;})['then'](respondWithResult(_0x11ab8e,null))[_0x15b9('0x40')](handleError(_0x11ab8e,null));}; \ No newline at end of file +var _0x05bc=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','FreshdeskConfiguration','catch','show','include','find','create','body','params','pick','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x3a456e,_0x41611a){var _0x45ba81=function(_0x45fded){while(--_0x45fded){_0x3a456e['push'](_0x3a456e['shift']());}};_0x45ba81(++_0x41611a);}(_0x05bc,0x14f));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc05b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc05b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc05b('0x2'));var moment=require(_0xc05b('0x3'));var BPromise=require(_0xc05b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc05b('0x5'));var csv=require(_0xc05b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc05b('0x7'));var _=require(_0xc05b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc05b('0x9'));var toCsv=require(_0xc05b('0x6'));var querystring=require('querystring');var Papa=require(_0xc05b('0xa'));var Redis=require(_0xc05b('0xb'));var authService=require(_0xc05b('0xc'));var qs=require(_0xc05b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc05b('0xe'));var logger=require(_0xc05b('0xf'))(_0xc05b('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x373951,_0xdb9692){_0xdb9692=_0xdb9692||0xcc;return function(_0x76ef61){if(_0x76ef61){return _0x373951[_0xc05b('0x11')](_0xdb9692);}return _0x373951[_0xc05b('0x12')](_0xdb9692)[_0xc05b('0x13')]();};}function respondWithResult(_0x47cf57,_0x16f1fd){_0x16f1fd=_0x16f1fd||0xc8;return function(_0x2cceea){if(_0x2cceea){return _0x47cf57[_0xc05b('0x12')](_0x16f1fd)['json'](_0x2cceea);}};}function respondWithFilteredResult(_0x3a6adb,_0x379650){return function(_0x5b555b){if(_0x5b555b){var _0x673067=typeof _0x379650[_0xc05b('0x14')]===_0xc05b('0x15')&&typeof _0x379650[_0xc05b('0x16')]===_0xc05b('0x15');var _0x422f6c=_0x5b555b[_0xc05b('0x17')];var _0x53a7e7=_0x673067?0x0:_0x379650[_0xc05b('0x14')];var _0x14e697=_0x673067?_0x5b555b[_0xc05b('0x17')]:_0x379650[_0xc05b('0x14')]+_0x379650['limit'];var _0x9ebad1;if(_0x14e697>=_0x422f6c){_0x14e697=_0x422f6c;_0x9ebad1=0xc8;}else{_0x9ebad1=0xce;}_0x3a6adb[_0xc05b('0x12')](_0x9ebad1);return _0x3a6adb[_0xc05b('0x18')](_0xc05b('0x19'),_0x53a7e7+'-'+_0x14e697+'/'+_0x422f6c)[_0xc05b('0x1a')](_0x5b555b);}return null;};}function patchUpdates(_0x49842f){return function(_0x2e066b){try{jsonpatch[_0xc05b('0x1b')](_0x2e066b,_0x49842f,!![]);}catch(_0x59a730){return BPromise['reject'](_0x59a730);}return _0x2e066b[_0xc05b('0x1c')]();};}function saveUpdates(_0x218d48,_0x46c695){return function(_0x148f40){if(_0x148f40){return _0x148f40[_0xc05b('0x1d')](_0x218d48)[_0xc05b('0x1e')](function(_0x7548e4){return _0x7548e4;});}return null;};}function removeEntity(_0x43f8a6,_0x48e448){return function(_0x50ac3f){if(_0x50ac3f){return _0x50ac3f[_0xc05b('0x1f')]()[_0xc05b('0x1e')](function(){_0x43f8a6[_0xc05b('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ac34,_0x115744){return function(_0x12b56f){if(!_0x12b56f){_0x10ac34[_0xc05b('0x11')](0x194);}return _0x12b56f;};}function handleError(_0x5e06cd,_0x33cc15){_0x33cc15=_0x33cc15||0x1f4;return function(_0x5e5487){logger[_0xc05b('0x20')](_0x5e5487[_0xc05b('0x21')]);if(_0x5e5487['name']){delete _0x5e5487[_0xc05b('0x22')];}_0x5e06cd[_0xc05b('0x12')](_0x33cc15)[_0xc05b('0x23')](_0x5e5487);};}exports[_0xc05b('0x24')]=function(_0x5dfb16,_0x1150b5){var _0x4c3403={},_0x39fbc5={},_0x23f3c6={'count':0x0,'rows':[]};var _0x3a9570=_[_0xc05b('0x25')](db['FreshdeskConfiguration'][_0xc05b('0x26')],function(_0x5402a0){return{'name':_0x5402a0[_0xc05b('0x27')],'type':_0x5402a0[_0xc05b('0x28')][_0xc05b('0x29')]};});_0x39fbc5[_0xc05b('0x2a')]=_[_0xc05b('0x25')](_0x3a9570,_0xc05b('0x22'));_0x39fbc5[_0xc05b('0x2b')]=_[_0xc05b('0x2c')](_0x5dfb16[_0xc05b('0x2b')]);_0x39fbc5[_0xc05b('0x2d')]=_[_0xc05b('0x2e')](_0x39fbc5[_0xc05b('0x2a')],_0x39fbc5[_0xc05b('0x2b')]);_0x4c3403[_0xc05b('0x2f')]=_[_0xc05b('0x2e')](_0x39fbc5[_0xc05b('0x2a')],qs[_0xc05b('0x30')](_0x5dfb16[_0xc05b('0x2b')][_0xc05b('0x30')]));_0x4c3403[_0xc05b('0x2f')]=_0x4c3403[_0xc05b('0x2f')][_0xc05b('0x31')]?_0x4c3403[_0xc05b('0x2f')]:_0x39fbc5['model'];if(!_0x5dfb16[_0xc05b('0x2b')][_0xc05b('0x32')](_0xc05b('0x33'))){_0x4c3403[_0xc05b('0x16')]=qs['limit'](_0x5dfb16[_0xc05b('0x2b')]['limit']);_0x4c3403[_0xc05b('0x14')]=qs[_0xc05b('0x14')](_0x5dfb16[_0xc05b('0x2b')][_0xc05b('0x14')]);}_0x4c3403[_0xc05b('0x34')]=qs['sort'](_0x5dfb16['query'][_0xc05b('0x35')]);_0x4c3403[_0xc05b('0x36')]=qs[_0xc05b('0x2d')](_['pick'](_0x5dfb16['query'],_0x39fbc5[_0xc05b('0x2d')]),_0x3a9570);if(_0x5dfb16[_0xc05b('0x2b')][_0xc05b('0x37')]){_0x4c3403[_0xc05b('0x36')]=_[_0xc05b('0x38')](_0x4c3403['where'],{'$or':_[_0xc05b('0x25')](_0x3a9570,function(_0xa5bb47){if(_0xa5bb47[_0xc05b('0x28')]!==_0xc05b('0x39')){var _0x2ab20e={};_0x2ab20e[_0xa5bb47[_0xc05b('0x22')]]={'$like':'%'+_0x5dfb16['query'][_0xc05b('0x37')]+'%'};return _0x2ab20e;}})});}_0x4c3403=_[_0xc05b('0x38')]({},_0x4c3403,_0x5dfb16[_0xc05b('0x3a')]);var _0x19ef0d={'where':_0x4c3403[_0xc05b('0x36')]};return db['FreshdeskConfiguration'][_0xc05b('0x17')](_0x19ef0d)[_0xc05b('0x1e')](function(_0x4acc9d){_0x23f3c6[_0xc05b('0x17')]=_0x4acc9d;if(_0x5dfb16[_0xc05b('0x2b')][_0xc05b('0x3b')]){_0x4c3403['include']=[{'all':!![]}];}return db[_0xc05b('0x3c')]['findAll'](_0x4c3403);})[_0xc05b('0x1e')](function(_0x141ac3){_0x23f3c6['rows']=_0x141ac3;return _0x23f3c6;})['then'](respondWithFilteredResult(_0x1150b5,_0x4c3403))[_0xc05b('0x3d')](handleError(_0x1150b5,null));};exports[_0xc05b('0x3e')]=function(_0x5743b4,_0x3feb5f){var _0x557012={'raw':![],'where':{'id':_0x5743b4['params']['id']}},_0x3e8187={};_0x3e8187['model']=_[_0xc05b('0x2c')](db[_0xc05b('0x3c')][_0xc05b('0x26')]);_0x3e8187['query']=_[_0xc05b('0x2c')](_0x5743b4['query']);_0x3e8187['filters']=_[_0xc05b('0x2e')](_0x3e8187[_0xc05b('0x2a')],_0x3e8187[_0xc05b('0x2b')]);_0x557012[_0xc05b('0x2f')]=_[_0xc05b('0x2e')](_0x3e8187['model'],qs[_0xc05b('0x30')](_0x5743b4[_0xc05b('0x2b')]['fields']));_0x557012[_0xc05b('0x2f')]=_0x557012[_0xc05b('0x2f')][_0xc05b('0x31')]?_0x557012[_0xc05b('0x2f')]:_0x3e8187[_0xc05b('0x2a')];if(_0x5743b4[_0xc05b('0x2b')][_0xc05b('0x3b')]){_0x557012[_0xc05b('0x3f')]=[{'all':!![]}];}_0x557012=_[_0xc05b('0x38')]({},_0x557012,_0x5743b4['options']);return db[_0xc05b('0x3c')][_0xc05b('0x40')](_0x557012)[_0xc05b('0x1e')](handleEntityNotFound(_0x3feb5f,null))[_0xc05b('0x1e')](respondWithResult(_0x3feb5f,null))[_0xc05b('0x3d')](handleError(_0x3feb5f,null));};exports[_0xc05b('0x41')]=function(_0x1a3c7b,_0x601bdb){return db['FreshdeskConfiguration'][_0xc05b('0x41')](_0x1a3c7b[_0xc05b('0x42')],{})[_0xc05b('0x1e')](respondWithResult(_0x601bdb,0xc9))['catch'](handleError(_0x601bdb,null));};exports[_0xc05b('0x1d')]=function(_0x53ae92,_0x5438c0){if(_0x53ae92[_0xc05b('0x42')]['id']){delete _0x53ae92[_0xc05b('0x42')]['id'];}return db[_0xc05b('0x3c')][_0xc05b('0x40')]({'where':{'id':_0x53ae92[_0xc05b('0x43')]['id']}})['then'](handleEntityNotFound(_0x5438c0,null))[_0xc05b('0x1e')](saveUpdates(_0x53ae92['body'],null))[_0xc05b('0x1e')](respondWithResult(_0x5438c0,null))[_0xc05b('0x3d')](handleError(_0x5438c0,null));};exports[_0xc05b('0x1f')]=function(_0x6c3e6a,_0x44a82d){return db[_0xc05b('0x3c')]['find']({'where':{'id':_0x6c3e6a['params']['id']}})[_0xc05b('0x1e')](handleEntityNotFound(_0x44a82d,null))[_0xc05b('0x1e')](removeEntity(_0x44a82d,null))[_0xc05b('0x3d')](handleError(_0x44a82d,null));};exports['getFields']=function(_0x2bce02,_0x371c76,_0x309ddc){var _0xe1611d={};var _0x4ffce8={};var _0x5da899;var _0x45d1cf;return db[_0xc05b('0x3c')]['findOne']({'where':{'id':_0x2bce02['params']['id']}})[_0xc05b('0x1e')](handleEntityNotFound(_0x371c76,null))[_0xc05b('0x1e')](function(_0x3c3ecf){if(_0x3c3ecf){_0x5da899=_0x3c3ecf;_0x4ffce8[_0xc05b('0x2a')]=_[_0xc05b('0x2c')](db['FreshdeskField'][_0xc05b('0x26')]);_0x4ffce8[_0xc05b('0x2b')]=_[_0xc05b('0x2c')](_0x2bce02[_0xc05b('0x2b')]);_0x4ffce8[_0xc05b('0x2d')]=_[_0xc05b('0x2e')](_0x4ffce8[_0xc05b('0x2a')],_0x4ffce8[_0xc05b('0x2b')]);_0xe1611d[_0xc05b('0x2f')]=_[_0xc05b('0x2e')](_0x4ffce8['model'],qs[_0xc05b('0x30')](_0x2bce02[_0xc05b('0x2b')]['fields']));_0xe1611d[_0xc05b('0x2f')]=_0xe1611d[_0xc05b('0x2f')]['length']?_0xe1611d['attributes']:_0x4ffce8[_0xc05b('0x2a')];_0xe1611d[_0xc05b('0x34')]=qs[_0xc05b('0x35')](_0x2bce02[_0xc05b('0x2b')]['sort']);_0xe1611d['where']=qs[_0xc05b('0x2d')](_[_0xc05b('0x44')](_0x2bce02[_0xc05b('0x2b')],_0x4ffce8[_0xc05b('0x2d')]));if(_0x2bce02['query'][_0xc05b('0x37')]){_0xe1611d[_0xc05b('0x36')]=_[_0xc05b('0x38')](_0xe1611d[_0xc05b('0x36')],{'$or':_[_0xc05b('0x25')](_0xe1611d['attributes'],function(_0x137e18){var _0x1a8973={};_0x1a8973[_0x137e18]={'$like':'%'+_0x2bce02[_0xc05b('0x2b')][_0xc05b('0x37')]+'%'};return _0x1a8973;})});}_0xe1611d=_[_0xc05b('0x38')]({},_0xe1611d,_0x2bce02[_0xc05b('0x3a')]);return _0x5da899[_0xc05b('0x45')](_0xe1611d);}})['then'](function(_0x466508){if(_0x466508){_0x45d1cf=_0x466508[_0xc05b('0x31')];if(!_0x2bce02[_0xc05b('0x2b')][_0xc05b('0x32')]('nolimit')){_0xe1611d[_0xc05b('0x16')]=qs[_0xc05b('0x16')](_0x2bce02[_0xc05b('0x2b')][_0xc05b('0x16')]);_0xe1611d[_0xc05b('0x14')]=qs['offset'](_0x2bce02['query'][_0xc05b('0x14')]);}return _0x5da899[_0xc05b('0x45')](_0xe1611d);}})[_0xc05b('0x1e')](function(_0x4b5a34){if(_0x4b5a34){return _0x4b5a34?{'count':_0x45d1cf,'rows':_0x4b5a34}:null;}})[_0xc05b('0x1e')](respondWithResult(_0x371c76,null))[_0xc05b('0x3d')](handleError(_0x371c76,null));};exports[_0xc05b('0x46')]=function(_0x3d4ab9,_0x54bf0f,_0x99893c){var _0xfe6c55={};var _0x3acf94={};var _0x13c092;var _0x2dab9b;return db[_0xc05b('0x3c')][_0xc05b('0x47')]({'where':{'id':_0x3d4ab9[_0xc05b('0x43')]['id']}})[_0xc05b('0x1e')](handleEntityNotFound(_0x54bf0f,null))['then'](function(_0x691648){if(_0x691648){_0x13c092=_0x691648;_0x3acf94['model']=_[_0xc05b('0x2c')](db['FreshdeskField'][_0xc05b('0x26')]);_0x3acf94[_0xc05b('0x2b')]=_[_0xc05b('0x2c')](_0x3d4ab9[_0xc05b('0x2b')]);_0x3acf94['filters']=_[_0xc05b('0x2e')](_0x3acf94[_0xc05b('0x2a')],_0x3acf94['query']);_0xfe6c55['attributes']=_['intersection'](_0x3acf94[_0xc05b('0x2a')],qs[_0xc05b('0x30')](_0x3d4ab9['query'][_0xc05b('0x30')]));_0xfe6c55['attributes']=_0xfe6c55[_0xc05b('0x2f')][_0xc05b('0x31')]?_0xfe6c55['attributes']:_0x3acf94[_0xc05b('0x2a')];_0xfe6c55['order']=qs['sort'](_0x3d4ab9[_0xc05b('0x2b')][_0xc05b('0x35')]);_0xfe6c55['where']=qs[_0xc05b('0x2d')](_[_0xc05b('0x44')](_0x3d4ab9[_0xc05b('0x2b')],_0x3acf94[_0xc05b('0x2d')]));if(_0x3d4ab9['query'][_0xc05b('0x37')]){_0xfe6c55[_0xc05b('0x36')]=_[_0xc05b('0x38')](_0xfe6c55[_0xc05b('0x36')],{'$or':_['map'](_0xfe6c55[_0xc05b('0x2f')],function(_0x192cfc){var _0x369449={};_0x369449[_0x192cfc]={'$like':'%'+_0x3d4ab9[_0xc05b('0x2b')][_0xc05b('0x37')]+'%'};return _0x369449;})});}_0xfe6c55=_[_0xc05b('0x38')]({},_0xfe6c55,_0x3d4ab9['options']);return _0x13c092['getSubjects'](_0xfe6c55);}})[_0xc05b('0x1e')](function(_0x18d545){if(_0x18d545){_0x2dab9b=_0x18d545['length'];if(!_0x3d4ab9[_0xc05b('0x2b')]['hasOwnProperty'](_0xc05b('0x33'))){_0xfe6c55[_0xc05b('0x16')]=qs[_0xc05b('0x16')](_0x3d4ab9['query'][_0xc05b('0x16')]);_0xfe6c55[_0xc05b('0x14')]=qs[_0xc05b('0x14')](_0x3d4ab9['query'][_0xc05b('0x14')]);}return _0x13c092[_0xc05b('0x46')](_0xfe6c55);}})[_0xc05b('0x1e')](function(_0xc00b12){if(_0xc00b12){return _0xc00b12?{'count':_0x2dab9b,'rows':_0xc00b12}:null;}})[_0xc05b('0x1e')](respondWithResult(_0x54bf0f,null))[_0xc05b('0x3d')](handleError(_0x54bf0f,null));};exports[_0xc05b('0x48')]=function(_0x685fe2,_0x12c9f2,_0x38fa2f){var _0x3cbca2={};var _0x32a44b={};var _0x295697;var _0x27b542;return db[_0xc05b('0x3c')][_0xc05b('0x47')]({'where':{'id':_0x685fe2[_0xc05b('0x43')]['id']}})['then'](handleEntityNotFound(_0x12c9f2,null))[_0xc05b('0x1e')](function(_0x541aee){if(_0x541aee){_0x295697=_0x541aee;_0x32a44b[_0xc05b('0x2a')]=_[_0xc05b('0x2c')](db['FreshdeskField']['rawAttributes']);_0x32a44b[_0xc05b('0x2b')]=_[_0xc05b('0x2c')](_0x685fe2[_0xc05b('0x2b')]);_0x32a44b['filters']=_[_0xc05b('0x2e')](_0x32a44b[_0xc05b('0x2a')],_0x32a44b[_0xc05b('0x2b')]);_0x3cbca2['attributes']=_[_0xc05b('0x2e')](_0x32a44b[_0xc05b('0x2a')],qs[_0xc05b('0x30')](_0x685fe2[_0xc05b('0x2b')][_0xc05b('0x30')]));_0x3cbca2[_0xc05b('0x2f')]=_0x3cbca2[_0xc05b('0x2f')][_0xc05b('0x31')]?_0x3cbca2[_0xc05b('0x2f')]:_0x32a44b[_0xc05b('0x2a')];_0x3cbca2[_0xc05b('0x34')]=qs[_0xc05b('0x35')](_0x685fe2[_0xc05b('0x2b')][_0xc05b('0x35')]);_0x3cbca2[_0xc05b('0x36')]=qs[_0xc05b('0x2d')](_[_0xc05b('0x44')](_0x685fe2[_0xc05b('0x2b')],_0x32a44b[_0xc05b('0x2d')]));if(_0x685fe2[_0xc05b('0x2b')][_0xc05b('0x37')]){_0x3cbca2[_0xc05b('0x36')]=_['merge'](_0x3cbca2['where'],{'$or':_[_0xc05b('0x25')](_0x3cbca2[_0xc05b('0x2f')],function(_0x50f558){var _0x9c7d08={};_0x9c7d08[_0x50f558]={'$like':'%'+_0x685fe2[_0xc05b('0x2b')][_0xc05b('0x37')]+'%'};return _0x9c7d08;})});}_0x3cbca2=_['merge']({},_0x3cbca2,_0x685fe2[_0xc05b('0x3a')]);return _0x295697[_0xc05b('0x48')](_0x3cbca2);}})[_0xc05b('0x1e')](function(_0x27d3d1){if(_0x27d3d1){_0x27b542=_0x27d3d1[_0xc05b('0x31')];if(!_0x685fe2[_0xc05b('0x2b')][_0xc05b('0x32')](_0xc05b('0x33'))){_0x3cbca2['limit']=qs[_0xc05b('0x16')](_0x685fe2[_0xc05b('0x2b')][_0xc05b('0x16')]);_0x3cbca2[_0xc05b('0x14')]=qs[_0xc05b('0x14')](_0x685fe2['query'][_0xc05b('0x14')]);}return _0x295697[_0xc05b('0x48')](_0x3cbca2);}})[_0xc05b('0x1e')](function(_0x381958){if(_0x381958){return _0x381958?{'count':_0x27b542,'rows':_0x381958}:null;}})[_0xc05b('0x1e')](respondWithResult(_0x12c9f2,null))[_0xc05b('0x3d')](handleError(_0x12c9f2,null));};exports[_0xc05b('0x49')]=function(_0x5862c4,_0x518389,_0x2cc52a){var _0x247666={};var _0x16dc8d={};var _0x4c63d6;var _0x116712;return db[_0xc05b('0x3c')][_0xc05b('0x47')]({'where':{'id':_0x5862c4[_0xc05b('0x43')]['id']}})[_0xc05b('0x1e')](handleEntityNotFound(_0x518389,null))[_0xc05b('0x1e')](function(_0x38430c){if(_0x38430c){_0x4c63d6=_0x38430c;_0x16dc8d[_0xc05b('0x2a')]=_[_0xc05b('0x2c')](db['Tag'][_0xc05b('0x26')]);_0x16dc8d[_0xc05b('0x2b')]=_[_0xc05b('0x2c')](_0x5862c4[_0xc05b('0x2b')]);_0x16dc8d['filters']=_[_0xc05b('0x2e')](_0x16dc8d[_0xc05b('0x2a')],_0x16dc8d[_0xc05b('0x2b')]);_0x247666['attributes']=_[_0xc05b('0x2e')](_0x16dc8d[_0xc05b('0x2a')],qs[_0xc05b('0x30')](_0x5862c4[_0xc05b('0x2b')][_0xc05b('0x30')]));_0x247666['attributes']=_0x247666['attributes'][_0xc05b('0x31')]?_0x247666[_0xc05b('0x2f')]:_0x16dc8d[_0xc05b('0x2a')];_0x247666[_0xc05b('0x34')]=qs[_0xc05b('0x35')](_0x5862c4['query'][_0xc05b('0x35')]);_0x247666[_0xc05b('0x36')]=qs['filters'](_[_0xc05b('0x44')](_0x5862c4[_0xc05b('0x2b')],_0x16dc8d['filters']));if(_0x5862c4[_0xc05b('0x2b')][_0xc05b('0x37')]){_0x247666[_0xc05b('0x36')]=_[_0xc05b('0x38')](_0x247666['where'],{'$or':_[_0xc05b('0x25')](_0x247666[_0xc05b('0x2f')],function(_0x221aad){var _0x4445c2={};_0x4445c2[_0x221aad]={'$like':'%'+_0x5862c4[_0xc05b('0x2b')]['filter']+'%'};return _0x4445c2;})});}_0x247666=_[_0xc05b('0x38')]({},_0x247666,_0x5862c4[_0xc05b('0x3a')]);return _0x4c63d6['getTags'](_0x247666);}})[_0xc05b('0x1e')](function(_0x3d5c47){if(_0x3d5c47){_0x116712=_0x3d5c47[_0xc05b('0x31')];if(!_0x5862c4['query'][_0xc05b('0x32')](_0xc05b('0x33'))){_0x247666['limit']=qs[_0xc05b('0x16')](_0x5862c4[_0xc05b('0x2b')][_0xc05b('0x16')]);_0x247666[_0xc05b('0x14')]=qs['offset'](_0x5862c4[_0xc05b('0x2b')][_0xc05b('0x14')]);}return _0x4c63d6[_0xc05b('0x49')](_0x247666);}})[_0xc05b('0x1e')](function(_0x5da0ba){if(_0x5da0ba){return _0x5da0ba?{'count':_0x116712,'rows':_0x5da0ba}:null;}})[_0xc05b('0x1e')](respondWithResult(_0x518389,null))[_0xc05b('0x3d')](handleError(_0x518389,null));};exports[_0xc05b('0x4a')]=function(_0x237b69,_0x18963f,_0xc3b42){if(_0x237b69[_0xc05b('0x42')]['id']){delete _0x237b69[_0xc05b('0x42')]['id'];}return db[_0xc05b('0x3c')][_0xc05b('0x47')]({'where':{'id':_0x237b69[_0xc05b('0x43')]['id']}})[_0xc05b('0x1e')](handleEntityNotFound(_0x18963f,null))['then'](function(_0x4ded09){if(_0x4ded09){return _0x4ded09['setTags'](_0x237b69['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x18963f,null))[_0xc05b('0x3d')](handleError(_0x18963f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2555273..c122331 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 _0x0510=['moment','request-promise','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api'];(function(_0x1bdd43,_0x19e62f){var _0x2e9430=function(_0x2842b7){while(--_0x2842b7){_0x1bdd43['push'](_0x1bdd43['shift']());}};_0x2e9430(++_0x19e62f);}(_0x0510,0x166));var _0x0051=function(_0x2af451,_0xe0c698){_0x2af451=_0x2af451-0x0;var _0x50cc7a=_0x0510[_0x2af451];return _0x50cc7a;};'use strict';var _=require(_0x0051('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0051('0x1'));var moment=require(_0x0051('0x2'));var BPromise=require('bluebird');var rp=require(_0x0051('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0051('0x4'));var config=require('../../config/environment');var attributes=require(_0x0051('0x5'));module['exports']=function(_0x360c78,_0x42d243){return _0x360c78[_0x0051('0x6')](_0x0051('0x7'),attributes,{'tableName':_0x0051('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fe=['api','bluebird','path','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','../../config/logger'];(function(_0x189862,_0x183fee){var _0x537724=function(_0x1531fe){while(--_0x1531fe){_0x189862['push'](_0x189862['shift']());}};_0x537724(++_0x183fee);}(_0x22fe,0x187));var _0xe22f=function(_0x5a679e,_0x5a5acc){_0x5a679e=_0x5a679e-0x0;var _0x2705a1=_0x22fe[_0x5a679e];return _0x2705a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe22f('0x0'))(_0xe22f('0x1'));var moment=require('moment');var BPromise=require(_0xe22f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe22f('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe22f('0x4'));module[_0xe22f('0x5')]=function(_0x5c357d,_0x2d42b2){return _0x5c357d[_0xe22f('0x6')](_0xe22f('0x7'),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 66e5b82..14789ff 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 _0x021d=['info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x572c21,_0x48194e){var _0x4cf3ae=function(_0x50bb08){while(--_0x50bb08){_0x572c21['push'](_0x572c21['shift']());}};_0x4cf3ae(++_0x48194e);}(_0x021d,0x168));var _0xd021=function(_0x5150b6,_0x298ff1){_0x5150b6=_0x5150b6-0x0;var _0x2969a8=_0x021d[_0x5150b6];return _0x2969a8;};'use strict';var _=require(_0xd021('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd021('0x1'));var rs=require(_0xd021('0x2'));var fs=require('fs');var Redis=require(_0xd021('0x3'));var db=require(_0xd021('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd021('0x5'))(_0xd021('0x6'));var config=require(_0xd021('0x7'));var jayson=require(_0xd021('0x8'));var client=jayson['client'][_0xd021('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fabbe,_0xfd6f6b,_0x5ef04a){return new BPromise(function(_0x1423ec,_0x13db8a){return client['request'](_0x1fabbe,_0x5ef04a)[_0xd021('0xa')](function(_0xb7af60){logger['info'](_0xd021('0xb'),_0xfd6f6b,_0xd021('0xc'));logger['debug'](_0xd021('0xd'),_0xfd6f6b,_0xd021('0xc'),JSON[_0xd021('0xe')](_0xb7af60));if(_0xb7af60[_0xd021('0xf')]){if(_0xb7af60[_0xd021('0xf')][_0xd021('0x10')]===0x1f4){logger['error'](_0xd021('0xb'),_0xfd6f6b,_0xb7af60[_0xd021('0xf')]['message']);return _0x13db8a(_0xb7af60['error'][_0xd021('0x11')]);}logger[_0xd021('0xf')](_0xd021('0xb'),_0xfd6f6b,_0xb7af60[_0xd021('0xf')]['message']);return _0x1423ec(_0xb7af60[_0xd021('0xf')][_0xd021('0x11')]);}else{logger[_0xd021('0x12')](_0xd021('0xb'),_0xfd6f6b,_0xd021('0xc'));_0x1423ec(_0xb7af60[_0xd021('0x13')]['message']);}})[_0xd021('0x14')](function(_0xdba36e){logger[_0xd021('0xf')](_0xd021('0xb'),_0xfd6f6b,_0xdba36e);_0x13db8a(_0xdba36e);});});} \ No newline at end of file +var _0x8bcc=['rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f0c77,_0x41f99a){var _0x5e78a5=function(_0x516f00){while(--_0x516f00){_0x3f0c77['push'](_0x3f0c77['shift']());}};_0x5e78a5(++_0x41f99a);}(_0x8bcc,0x1f3));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc8bc('0x0'));var BPromise=require(_0xc8bc('0x1'));var rs=require(_0xc8bc('0x2'));var fs=require('fs');var Redis=require(_0xc8bc('0x3'));var db=require(_0xc8bc('0x4'))['db'];var utils=require(_0xc8bc('0x5'));var logger=require(_0xc8bc('0x6'))(_0xc8bc('0x7'));var config=require(_0xc8bc('0x8'));var jayson=require(_0xc8bc('0x9'));var client=jayson['client'][_0xc8bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d1ec6,_0x2e0667,_0x2f0e3c){return new BPromise(function(_0x59b74a,_0x1e2b1b){return client[_0xc8bc('0xb')](_0x3d1ec6,_0x2f0e3c)[_0xc8bc('0xc')](function(_0x4c1c42){logger[_0xc8bc('0xd')](_0xc8bc('0xe'),_0x2e0667,'request\x20sent');logger[_0xc8bc('0xf')](_0xc8bc('0x10'),_0x2e0667,'request\x20sent',JSON[_0xc8bc('0x11')](_0x4c1c42));if(_0x4c1c42[_0xc8bc('0x12')]){if(_0x4c1c42[_0xc8bc('0x12')][_0xc8bc('0x13')]===0x1f4){logger[_0xc8bc('0x12')](_0xc8bc('0xe'),_0x2e0667,_0x4c1c42[_0xc8bc('0x12')]['message']);return _0x1e2b1b(_0x4c1c42['error'][_0xc8bc('0x14')]);}logger[_0xc8bc('0x12')](_0xc8bc('0xe'),_0x2e0667,_0x4c1c42[_0xc8bc('0x12')]['message']);return _0x59b74a(_0x4c1c42[_0xc8bc('0x12')]['message']);}else{logger[_0xc8bc('0xd')](_0xc8bc('0xe'),_0x2e0667,'request\x20sent');_0x59b74a(_0x4c1c42[_0xc8bc('0x15')][_0xc8bc('0x14')]);}})['catch'](function(_0x214f9b){logger[_0xc8bc('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2e0667,_0x214f9b);_0x1e2b1b(_0x214f9b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 1a3b10f..57938ef 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 _0xf951=['fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','put','update','delete','destroy','util','connect-timeout','Router'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xf951,0xb1));var _0x1f95=function(_0x358e3b,_0x72233f){_0x358e3b=_0x358e3b-0x0;var _0x4906c0=_0xf951[_0x358e3b];return _0x4906c0;};'use strict';var multer=require('multer');var util=require(_0x1f95('0x0'));var path=require('path');var timeout=require(_0x1f95('0x1'));var express=require('express');var router=express[_0x1f95('0x2')]();var fs_extra=require(_0x1f95('0x3'));var auth=require(_0x1f95('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f95('0x5'));var controller=require(_0x1f95('0x6'));router[_0x1f95('0x7')]('/',auth['isAuthenticated'](),controller[_0x1f95('0x8')]);router[_0x1f95('0x7')](_0x1f95('0x9'),auth[_0x1f95('0xa')](),controller['show']);router['post']('/',auth[_0x1f95('0xa')](),controller['create']);router[_0x1f95('0xb')](_0x1f95('0x9'),auth[_0x1f95('0xa')](),controller[_0x1f95('0xc')]);router[_0x1f95('0xd')]('/:id',auth[_0x1f95('0xa')](),controller[_0x1f95('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9c1e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x52d422,_0x2d1008){var _0xaa93f9=function(_0x38a7ec){while(--_0x38a7ec){_0x52d422['push'](_0x52d422['shift']());}};_0xaa93f9(++_0x2d1008);}(_0x9c1e,0x1e4));var _0xe9c1=function(_0x32ccd6,_0x18ecc7){_0x32ccd6=_0x32ccd6-0x0;var _0x3425b6=_0x9c1e[_0x32ccd6];return _0x3425b6;};'use strict';var multer=require(_0xe9c1('0x0'));var util=require(_0xe9c1('0x1'));var path=require('path');var timeout=require(_0xe9c1('0x2'));var express=require(_0xe9c1('0x3'));var router=express[_0xe9c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe9c1('0x5'));var interaction=require(_0xe9c1('0x6'));var config=require(_0xe9c1('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xe9c1('0x8')]('/',auth[_0xe9c1('0x9')](),controller[_0xe9c1('0xa')]);router[_0xe9c1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe9c1('0xb')]);router['post']('/',auth[_0xe9c1('0x9')](),controller[_0xe9c1('0xc')]);router[_0xe9c1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe9c1('0xe')]);router[_0xe9c1('0xf')]('/:id',auth[_0xe9c1('0x9')](),controller[_0xe9c1('0x10')]);module[_0xe9c1('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 580e6f0..6e41ad0 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 _0x4a8c=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','sequelize','exports'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0x4a8c,0x1e4));var _0xc4a8=function(_0x459731,_0x3efcde){_0x459731=_0x459731-0x0;var _0x23c908=_0x4a8c[_0x459731];return _0x23c908;};'use strict';var Sequelize=require(_0xc4a8('0x0'));module[_0xc4a8('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc4a8('0x2'),_0xc4a8('0x3'),_0xc4a8('0x4'),_0xc4a8('0x5'),_0xc4a8('0x6')),'defaultValue':_0xc4a8('0x2')},'content':{'type':Sequelize[_0xc4a8('0x7')]},'key':{'type':Sequelize[_0xc4a8('0x7')]},'keyType':{'type':Sequelize[_0xc4a8('0x8')](_0xc4a8('0x2'),_0xc4a8('0x3'),_0xc4a8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc4a8('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4a8('0x7')]}}; \ No newline at end of file +var _0x4d3e=['picklist','STRING','variable','exports','ENUM','string','customVariable','keyValue'];(function(_0x584162,_0x5d010b){var _0x141caf=function(_0x20fc3c){while(--_0x20fc3c){_0x584162['push'](_0x584162['shift']());}};_0x141caf(++_0x5d010b);}(_0x4d3e,0x1cb));var _0xe4d3=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x4d3e[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0xe4d3('0x0')]={'type':{'type':Sequelize[_0xe4d3('0x1')](_0xe4d3('0x2'),'variable',_0xe4d3('0x3'),_0xe4d3('0x4'),_0xe4d3('0x5')),'defaultValue':_0xe4d3('0x2')},'content':{'type':Sequelize[_0xe4d3('0x6')]},'key':{'type':Sequelize[_0xe4d3('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xe4d3('0x2'),_0xe4d3('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 44b3129..d2e939e 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 _0xe605=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2cc2a2,_0x6f44f){var _0x4251bb=function(_0x36fbd7){while(--_0x36fbd7){_0x2cc2a2['push'](_0x2cc2a2['shift']());}};_0x4251bb(++_0x6f44f);}(_0xe605,0x92));var _0x5e60=function(_0x13858f,_0x357de7){_0x13858f=_0x13858f-0x0;var _0x383671=_0xe605[_0x13858f];return _0x383671;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2a499e[_0x5e60('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cb62,_0x56e3a5){return function(_0x2d8aac){if(!_0x2d8aac){_0x45cb62[_0x5e60('0x19')](0x194);}return _0x2d8aac;};}function handleError(_0x4a0dbc,_0x3bedea){_0x3bedea=_0x3bedea||0x1f4;return function(_0x5712f7){logger[_0x5e60('0x28')](_0x5712f7[_0x5e60('0x29')]);if(_0x5712f7['name']){delete _0x5712f7[_0x5e60('0x2a')];}_0x4a0dbc[_0x5e60('0x1a')](_0x3bedea)['send'](_0x5712f7);};}exports[_0x5e60('0x2b')]=function(_0xac9c7a,_0x52c97c){var _0x5431a8={},_0x52f668={},_0xf25956={'count':0x0,'rows':[]};var _0x235cc7=_[_0x5e60('0x2c')](db[_0x5e60('0x2d')][_0x5e60('0x2e')],function(_0x558197){return{'name':_0x558197[_0x5e60('0x2f')],'type':_0x558197[_0x5e60('0x30')]['key']};});_0x52f668[_0x5e60('0x31')]=_['map'](_0x235cc7,'name');_0x52f668[_0x5e60('0x32')]=_[_0x5e60('0x33')](_0xac9c7a[_0x5e60('0x32')]);_0x52f668[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],_0x52f668[_0x5e60('0x32')]);_0x5431a8[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],qs['fields'](_0xac9c7a[_0x5e60('0x32')]['fields']));_0x5431a8['attributes']=_0x5431a8[_0x5e60('0x36')][_0x5e60('0x37')]?_0x5431a8['attributes']:_0x52f668[_0x5e60('0x31')];if(!_0xac9c7a['query'][_0x5e60('0x38')](_0x5e60('0x39'))){_0x5431a8[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x1e')]);_0x5431a8[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0xac9c7a['query'][_0x5e60('0x1d')]);}_0x5431a8[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3b')]);_0x5431a8[_0x5e60('0x3c')]=qs[_0x5e60('0x34')](_['pick'](_0xac9c7a[_0x5e60('0x32')],_0x52f668[_0x5e60('0x34')]),_0x235cc7);if(_0xac9c7a['query']['filter']){_0x5431a8[_0x5e60('0x3c')]=_[_0x5e60('0x3d')](_0x5431a8[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2c')](_0x235cc7,function(_0x31b900){if(_0x31b900['type']!==_0x5e60('0x3e')){var _0x413bf0={};_0x413bf0[_0x31b900[_0x5e60('0x2a')]]={'$like':'%'+_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3f')]+'%'};return _0x413bf0;}})});}_0x5431a8=_[_0x5e60('0x3d')]({},_0x5431a8,_0xac9c7a[_0x5e60('0x40')]);var _0x54022a={'where':_0x5431a8[_0x5e60('0x3c')]};return db[_0x5e60('0x2d')]['count'](_0x54022a)['then'](function(_0x47a6df){_0xf25956[_0x5e60('0x20')]=_0x47a6df;if(_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x41')]){_0x5431a8[_0x5e60('0x42')]=[{'all':!![]}];}return db['FreshdeskField'][_0x5e60('0x43')](_0x5431a8);})[_0x5e60('0x26')](function(_0x4b6192){_0xf25956['rows']=_0x4b6192;return _0xf25956;})[_0x5e60('0x26')](respondWithFilteredResult(_0x52c97c,_0x5431a8))[_0x5e60('0x44')](handleError(_0x52c97c,null));};exports[_0x5e60('0x45')]=function(_0x38ff1d,_0x39ab09){var _0x3899ae={'raw':!![],'where':{'id':_0x38ff1d[_0x5e60('0x46')]['id']}},_0x2522d2={};_0x2522d2[_0x5e60('0x31')]=_['keys'](db[_0x5e60('0x2d')][_0x5e60('0x2e')]);_0x2522d2['query']=_[_0x5e60('0x33')](_0x38ff1d[_0x5e60('0x32')]);_0x2522d2[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],_0x2522d2['query']);_0x3899ae[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],qs[_0x5e60('0x47')](_0x38ff1d['query']['fields']));_0x3899ae['attributes']=_0x3899ae[_0x5e60('0x36')][_0x5e60('0x37')]?_0x3899ae[_0x5e60('0x36')]:_0x2522d2[_0x5e60('0x31')];if(_0x38ff1d[_0x5e60('0x32')][_0x5e60('0x41')]){_0x3899ae['include']=[{'all':!![]}];}_0x3899ae=_[_0x5e60('0x3d')]({},_0x3899ae,_0x38ff1d[_0x5e60('0x40')]);return db[_0x5e60('0x2d')][_0x5e60('0x48')](_0x3899ae)[_0x5e60('0x26')](handleEntityNotFound(_0x39ab09,null))[_0x5e60('0x26')](respondWithResult(_0x39ab09,null))[_0x5e60('0x44')](handleError(_0x39ab09,null));};exports['create']=function(_0x24c757,_0x3ed45d){return db[_0x5e60('0x2d')][_0x5e60('0x49')](_0x24c757[_0x5e60('0x4a')],{})[_0x5e60('0x26')](respondWithResult(_0x3ed45d,0xc9))[_0x5e60('0x44')](handleError(_0x3ed45d,null));};exports[_0x5e60('0x25')]=function(_0x1518bd,_0x350d6d){if(_0x1518bd[_0x5e60('0x4a')]['id']){delete _0x1518bd[_0x5e60('0x4a')]['id'];}return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x1518bd[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x350d6d,null))[_0x5e60('0x26')](saveUpdates(_0x1518bd[_0x5e60('0x4a')],null))['then'](respondWithResult(_0x350d6d,null))['catch'](handleError(_0x350d6d,null));};exports[_0x5e60('0x27')]=function(_0x4d3588,_0x3525d){return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x4d3588[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x3525d,null))[_0x5e60('0x26')](removeEntity(_0x3525d,null))['catch'](handleError(_0x3525d,null));}; \ No newline at end of file +var _0x54f3=['show','params','keys','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','stack','name','send','map','FreshdeskField','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x4c9f7f,_0x191da9){var _0x1a3fea=function(_0x18d70d){while(--_0x18d70d){_0x4c9f7f['push'](_0x4c9f7f['shift']());}};_0x1a3fea(++_0x191da9);}(_0x54f3,0x120));var _0x354f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x54f3[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x354f('0x0'));var zipdir=require(_0x354f('0x1'));var jsonpatch=require(_0x354f('0x2'));var rp=require(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354f('0x8'));var _=require('lodash');var squel=require(_0x354f('0x9'));var crypto=require(_0x354f('0xa'));var jsforce=require(_0x354f('0xb'));var deskjs=require(_0x354f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x354f('0xd'));var Papa=require('papaparse');var Redis=require(_0x354f('0xe'));var authService=require(_0x354f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x354f('0x10'));var logger=require(_0x354f('0x11'))('api');var utils=require(_0x354f('0x12'));var config=require(_0x354f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x354f('0x14'))['db'];function respondWithStatusCode(_0x824bf4,_0x13d871){_0x13d871=_0x13d871||0xcc;return function(_0x97c0da){if(_0x97c0da){return _0x824bf4[_0x354f('0x15')](_0x13d871);}return _0x824bf4[_0x354f('0x16')](_0x13d871)[_0x354f('0x17')]();};}function respondWithResult(_0x4ff8e7,_0xf2e013){_0xf2e013=_0xf2e013||0xc8;return function(_0x4b811d){if(_0x4b811d){return _0x4ff8e7[_0x354f('0x16')](_0xf2e013)['json'](_0x4b811d);}};}function respondWithFilteredResult(_0x103388,_0x234484){return function(_0x18cf66){if(_0x18cf66){var _0x4cc0e9=typeof _0x234484['offset']===_0x354f('0x18')&&typeof _0x234484[_0x354f('0x19')]===_0x354f('0x18');var _0x2ef866=_0x18cf66[_0x354f('0x1a')];var _0x36402d=_0x4cc0e9?0x0:_0x234484[_0x354f('0x1b')];var _0x598777=_0x4cc0e9?_0x18cf66[_0x354f('0x1a')]:_0x234484[_0x354f('0x1b')]+_0x234484[_0x354f('0x19')];var _0x4b87dd;if(_0x598777>=_0x2ef866){_0x598777=_0x2ef866;_0x4b87dd=0xc8;}else{_0x4b87dd=0xce;}_0x103388[_0x354f('0x16')](_0x4b87dd);return _0x103388['set'](_0x354f('0x1c'),_0x36402d+'-'+_0x598777+'/'+_0x2ef866)[_0x354f('0x1d')](_0x18cf66);}return null;};}function patchUpdates(_0x5e930c){return function(_0x14c4be){try{jsonpatch[_0x354f('0x1e')](_0x14c4be,_0x5e930c,!![]);}catch(_0x4ef4f1){return BPromise['reject'](_0x4ef4f1);}return _0x14c4be[_0x354f('0x1f')]();};}function saveUpdates(_0x574753,_0x52e7cb){return function(_0xa6050f){if(_0xa6050f){return _0xa6050f[_0x354f('0x20')](_0x574753)[_0x354f('0x21')](function(_0x2f4277){return _0x2f4277;});}return null;};}function removeEntity(_0xc0d4ca,_0x158117){return function(_0x273603){if(_0x273603){return _0x273603['destroy']()[_0x354f('0x21')](function(){_0xc0d4ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22594b,_0x4c9b18){return function(_0x4b1820){if(!_0x4b1820){_0x22594b[_0x354f('0x15')](0x194);}return _0x4b1820;};}function handleError(_0x4e2ad6,_0x3f0bfe){_0x3f0bfe=_0x3f0bfe||0x1f4;return function(_0x393622){logger['error'](_0x393622[_0x354f('0x22')]);if(_0x393622[_0x354f('0x23')]){delete _0x393622[_0x354f('0x23')];}_0x4e2ad6['status'](_0x3f0bfe)[_0x354f('0x24')](_0x393622);};}exports['index']=function(_0x227d9b,_0x26373d){var _0x16a376={},_0x2816cf={},_0x596b48={'count':0x0,'rows':[]};var _0x21c121=_[_0x354f('0x25')](db[_0x354f('0x26')][_0x354f('0x27')],function(_0x223464){return{'name':_0x223464['fieldName'],'type':_0x223464['type'][_0x354f('0x28')]};});_0x2816cf[_0x354f('0x29')]=_[_0x354f('0x25')](_0x21c121,_0x354f('0x23'));_0x2816cf['query']=_['keys'](_0x227d9b[_0x354f('0x2a')]);_0x2816cf[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],_0x2816cf['query']);_0x16a376[_0x354f('0x2d')]=_[_0x354f('0x2c')](_0x2816cf[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x227d9b['query']['fields']));_0x16a376[_0x354f('0x2d')]=_0x16a376[_0x354f('0x2d')][_0x354f('0x2f')]?_0x16a376[_0x354f('0x2d')]:_0x2816cf[_0x354f('0x29')];if(!_0x227d9b[_0x354f('0x2a')][_0x354f('0x30')](_0x354f('0x31'))){_0x16a376[_0x354f('0x19')]=qs[_0x354f('0x19')](_0x227d9b[_0x354f('0x2a')]['limit']);_0x16a376[_0x354f('0x1b')]=qs['offset'](_0x227d9b[_0x354f('0x2a')][_0x354f('0x1b')]);}_0x16a376[_0x354f('0x32')]=qs[_0x354f('0x33')](_0x227d9b[_0x354f('0x2a')][_0x354f('0x33')]);_0x16a376['where']=qs[_0x354f('0x2b')](_[_0x354f('0x34')](_0x227d9b['query'],_0x2816cf[_0x354f('0x2b')]),_0x21c121);if(_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]){_0x16a376['where']=_[_0x354f('0x36')](_0x16a376[_0x354f('0x37')],{'$or':_[_0x354f('0x25')](_0x21c121,function(_0x389f82){if(_0x389f82['type']!==_0x354f('0x38')){var _0x4db9a4={};_0x4db9a4[_0x389f82[_0x354f('0x23')]]={'$like':'%'+_0x227d9b[_0x354f('0x2a')][_0x354f('0x35')]+'%'};return _0x4db9a4;}})});}_0x16a376=_[_0x354f('0x36')]({},_0x16a376,_0x227d9b[_0x354f('0x39')]);var _0x589c69={'where':_0x16a376['where']};return db[_0x354f('0x26')][_0x354f('0x1a')](_0x589c69)[_0x354f('0x21')](function(_0x327fb2){_0x596b48[_0x354f('0x1a')]=_0x327fb2;if(_0x227d9b[_0x354f('0x2a')]['includeAll']){_0x16a376[_0x354f('0x3a')]=[{'all':!![]}];}return db[_0x354f('0x26')][_0x354f('0x3b')](_0x16a376);})[_0x354f('0x21')](function(_0x512592){_0x596b48[_0x354f('0x3c')]=_0x512592;return _0x596b48;})[_0x354f('0x21')](respondWithFilteredResult(_0x26373d,_0x16a376))[_0x354f('0x3d')](handleError(_0x26373d,null));};exports[_0x354f('0x3e')]=function(_0x1da53d,_0x344666){var _0x5f33b2={'raw':!![],'where':{'id':_0x1da53d[_0x354f('0x3f')]['id']}},_0x66b4cc={};_0x66b4cc[_0x354f('0x29')]=_['keys'](db['FreshdeskField'][_0x354f('0x27')]);_0x66b4cc[_0x354f('0x2a')]=_[_0x354f('0x40')](_0x1da53d[_0x354f('0x2a')]);_0x66b4cc[_0x354f('0x2b')]=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],_0x66b4cc[_0x354f('0x2a')]);_0x5f33b2['attributes']=_[_0x354f('0x2c')](_0x66b4cc[_0x354f('0x29')],qs[_0x354f('0x2e')](_0x1da53d[_0x354f('0x2a')][_0x354f('0x2e')]));_0x5f33b2[_0x354f('0x2d')]=_0x5f33b2[_0x354f('0x2d')][_0x354f('0x2f')]?_0x5f33b2[_0x354f('0x2d')]:_0x66b4cc['model'];if(_0x1da53d[_0x354f('0x2a')][_0x354f('0x41')]){_0x5f33b2['include']=[{'all':!![]}];}_0x5f33b2=_['merge']({},_0x5f33b2,_0x1da53d[_0x354f('0x39')]);return db[_0x354f('0x26')][_0x354f('0x42')](_0x5f33b2)[_0x354f('0x21')](handleEntityNotFound(_0x344666,null))[_0x354f('0x21')](respondWithResult(_0x344666,null))[_0x354f('0x3d')](handleError(_0x344666,null));};exports['create']=function(_0x558332,_0x178313){return db[_0x354f('0x26')][_0x354f('0x43')](_0x558332[_0x354f('0x44')],{})[_0x354f('0x21')](respondWithResult(_0x178313,0xc9))[_0x354f('0x3d')](handleError(_0x178313,null));};exports['update']=function(_0x55f2c9,_0x6b7a2c){if(_0x55f2c9['body']['id']){delete _0x55f2c9[_0x354f('0x44')]['id'];}return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0x55f2c9['params']['id']}})['then'](handleEntityNotFound(_0x6b7a2c,null))[_0x354f('0x21')](saveUpdates(_0x55f2c9[_0x354f('0x44')],null))['then'](respondWithResult(_0x6b7a2c,null))[_0x354f('0x3d')](handleError(_0x6b7a2c,null));};exports[_0x354f('0x45')]=function(_0xf71a4f,_0x2dd012){return db[_0x354f('0x26')][_0x354f('0x42')]({'where':{'id':_0xf71a4f[_0x354f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2dd012,null))[_0x354f('0x21')](removeEntity(_0x2dd012,null))[_0x354f('0x3d')](handleError(_0x2dd012,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 64868b8..ac4f2b8 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 _0xa68b=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x334090,_0x58ce69){var _0x329e43=function(_0x48ff26){while(--_0x48ff26){_0x334090['push'](_0x334090['shift']());}};_0x329e43(++_0x58ce69);}(_0xa68b,0xf6));var _0xba68=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0xa68b[_0x21090b];return _0x3c68d7;};'use strict';var _=require('lodash');var util=require(_0xba68('0x0'));var logger=require(_0xba68('0x1'))(_0xba68('0x2'));var moment=require(_0xba68('0x3'));var BPromise=require(_0xba68('0x4'));var rp=require(_0xba68('0x5'));var fs=require('fs');var path=require(_0xba68('0x6'));var rimraf=require('rimraf');var config=require(_0xba68('0x7'));var attributes=require(_0xba68('0x8'));module[_0xba68('0x9')]=function(_0x1091db,_0x384c96){return _0x1091db[_0xba68('0xa')](_0xba68('0xb'),attributes,{'tableName':_0xba68('0xc'),'paranoid':![],'indexes':[{'name':_0xba68('0xd'),'fields':[_0xba68('0xe'),_0xba68('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57ae=['api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0x57ae,0xb4));var _0xe57a=function(_0x349dee,_0x4916bd){_0x349dee=_0x349dee-0x0;var _0x1dfdeb=_0x57ae[_0x349dee];return _0x1dfdeb;};'use strict';var _=require('lodash');var util=require(_0xe57a('0x0'));var logger=require(_0xe57a('0x1'))(_0xe57a('0x2'));var moment=require(_0xe57a('0x3'));var BPromise=require(_0xe57a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe57a('0x5'));var rimraf=require(_0xe57a('0x6'));var config=require(_0xe57a('0x7'));var attributes=require(_0xe57a('0x8'));module['exports']=function(_0x2a0596,_0x2c870b){return _0x2a0596['define']('FreshdeskField',attributes,{'tableName':_0xe57a('0x9'),'paranoid':![],'indexes':[{'name':_0xe57a('0xa'),'fields':[_0xe57a('0xb'),_0xe57a('0xc')],'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 5d8998d..cbe64a1 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 _0x646e=['moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x567530,_0x24e025){var _0x24b9cd=function(_0x1204c8){while(--_0x1204c8){_0x567530['push'](_0x567530['shift']());}};_0x24b9cd(++_0x24e025);}(_0x646e,0x140));var _0xe646=function(_0x52aafc,_0x348b8a){_0x52aafc=_0x52aafc-0x0;var _0x4f7957=_0x646e[_0x52aafc];return _0x4f7957;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe646('0x0'));var BPromise=require('bluebird');var rs=require(_0xe646('0x1'));var fs=require('fs');var Redis=require(_0xe646('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe646('0x3'));var logger=require('../../config/logger')(_0xe646('0x4'));var config=require(_0xe646('0x5'));var jayson=require(_0xe646('0x6'));var client=jayson[_0xe646('0x7')][_0xe646('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3226,_0x128bdf,_0x589a38){return new BPromise(function(_0x39986e,_0x15019e){return client[_0xe646('0x9')](_0x2f3226,_0x589a38)[_0xe646('0xa')](function(_0x1614ce){logger[_0xe646('0xb')](_0xe646('0xc'),_0x128bdf,_0xe646('0xd'));logger[_0xe646('0xe')](_0xe646('0xf'),_0x128bdf,_0xe646('0xd'),JSON['stringify'](_0x1614ce));if(_0x1614ce[_0xe646('0x10')]){if(_0x1614ce[_0xe646('0x10')]['code']===0x1f4){logger[_0xe646('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x128bdf,_0x1614ce[_0xe646('0x10')][_0xe646('0x11')]);return _0x15019e(_0x1614ce[_0xe646('0x10')][_0xe646('0x11')]);}logger[_0xe646('0x10')](_0xe646('0xc'),_0x128bdf,_0x1614ce[_0xe646('0x10')][_0xe646('0x11')]);return _0x39986e(_0x1614ce['error'][_0xe646('0x11')]);}else{logger[_0xe646('0xb')](_0xe646('0xc'),_0x128bdf,'request\x20sent');_0x39986e(_0x1614ce[_0xe646('0x12')]['message']);}})[_0xe646('0x13')](function(_0x588bfd){logger[_0xe646('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x128bdf,_0x588bfd);_0x15019e(_0x588bfd);});});} \ No newline at end of file +var _0x5e0f=['info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x2fe5a6,_0xc8dee0){var _0x3506eb=function(_0x361f3c){while(--_0x361f3c){_0x2fe5a6['push'](_0x2fe5a6['shift']());}};_0x3506eb(++_0xc8dee0);}(_0x5e0f,0x99));var _0xf5e0=function(_0xc06fc3,_0x31b690){_0xc06fc3=_0xc06fc3-0x0;var _0x5e81e1=_0x5e0f[_0xc06fc3];return _0x5e81e1;};'use strict';var _=require(_0xf5e0('0x0'));var util=require('util');var moment=require(_0xf5e0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5e0('0x2'));var db=require(_0xf5e0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5e0('0x4'))(_0xf5e0('0x5'));var config=require('../../config/environment');var jayson=require(_0xf5e0('0x6'));var client=jayson['client'][_0xf5e0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4153ac,_0x4e7b90,_0x4bd7d5){return new BPromise(function(_0x47385d,_0x4efd00){return client['request'](_0x4153ac,_0x4bd7d5)[_0xf5e0('0x8')](function(_0x4fdaec){logger[_0xf5e0('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x4e7b90,_0xf5e0('0xa'));logger[_0xf5e0('0xb')](_0xf5e0('0xc'),_0x4e7b90,_0xf5e0('0xa'),JSON[_0xf5e0('0xd')](_0x4fdaec));if(_0x4fdaec[_0xf5e0('0xe')]){if(_0x4fdaec[_0xf5e0('0xe')][_0xf5e0('0xf')]===0x1f4){logger[_0xf5e0('0xe')](_0xf5e0('0x10'),_0x4e7b90,_0x4fdaec[_0xf5e0('0xe')]['message']);return _0x4efd00(_0x4fdaec[_0xf5e0('0xe')][_0xf5e0('0x11')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x4e7b90,_0x4fdaec[_0xf5e0('0xe')]['message']);return _0x47385d(_0x4fdaec[_0xf5e0('0xe')][_0xf5e0('0x11')]);}else{logger[_0xf5e0('0x9')](_0xf5e0('0x10'),_0x4e7b90,_0xf5e0('0xa'));_0x47385d(_0x4fdaec['result'][_0xf5e0('0x11')]);}})['catch'](function(_0x3bfbd6){logger[_0xf5e0('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x4e7b90,_0x3bfbd6);_0x4efd00(_0x3bfbd6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 6bfc6f7..a1a1fa1 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 _0xde2c=['getFields','post','/:id/configurations','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x573870,_0xd7e372){var _0x2ebf01=function(_0x106d1d){while(--_0x106d1d){_0x573870['push'](_0x573870['shift']());}};_0x2ebf01(++_0xd7e372);}(_0xde2c,0x7f));var _0xcde2=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xde2c[_0x11ce46];return _0x368a1e;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['get']('/:id/configurations',auth[_0xcde2('0xb')](),controller[_0xcde2('0xf')]);router['get'](_0xcde2('0x10'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcde2('0x12')](_0xcde2('0x13'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x14')]);router[_0xcde2('0x15')](_0xcde2('0xd'),auth['isAuthenticated'](),controller[_0xcde2('0x16')]);router['delete'](_0xcde2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xcde2('0x17')]=router; \ No newline at end of file +var _0xf4eb=['getFields','create','put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x484712,_0x1b6538){var _0x39f7b6=function(_0x4362b5){while(--_0x4362b5){_0x484712['push'](_0x484712['shift']());}};_0x39f7b6(++_0x1b6538);}(_0xf4eb,0xec));var _0xbf4e=function(_0x28eee3,_0x81f208){_0x28eee3=_0x28eee3-0x0;var _0x1ad0d1=_0xf4eb[_0x28eee3];return _0x1ad0d1;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xc')]);router['post'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['addConfiguration']);router[_0xbf4e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0x10'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x11')]);module[_0xbf4e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 150cb23..6d1ed4f 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 _0x3d04=['STRING','username','sequelize','exports'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x43d0('0x0'));module[_0x43d0('0x1')]={'name':{'type':Sequelize[_0x43d0('0x2')]},'description':{'type':Sequelize[_0x43d0('0x2')]},'username':{'type':Sequelize[_0x43d0('0x2')],'unique':_0x43d0('0x3')},'apiKey':{'type':Sequelize[_0x43d0('0x2')]},'remoteUri':{'type':Sequelize[_0x43d0('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x43d0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb44a=['STRING'];(function(_0x459335,_0x2e95dd){var _0x50f00b=function(_0x5ccdaf){while(--_0x5ccdaf){_0x459335['push'](_0x459335['shift']());}};_0x50f00b(++_0x2e95dd);}(_0xb44a,0x1c2));var _0xab44=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0xb44a[_0xe4bb3d];return _0xd9e51;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xab44('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xab44('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xab44('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xab44('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 0df815e..7cf061f 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 _0xbb7e=['lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','send','map','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','then','catch','show','params','FreshsalesAccount','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra'];(function(_0x146653,_0xccf82b){var _0x1172b6=function(_0x1bcedd){while(--_0x1bcedd){_0x146653['push'](_0x146653['shift']());}};_0x1172b6(++_0xccf82b);}(_0xbb7e,0x11c));var _0xebb7=function(_0x57d0e6,_0x5b92b1){_0x57d0e6=_0x57d0e6-0x0;var _0x929925=_0xbb7e[_0x57d0e6];return _0x929925;};'use strict';var emlformat=require(_0xebb7('0x0'));var rimraf=require(_0xebb7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebb7('0x2'));var rp=require(_0xebb7('0x3'));var moment=require(_0xebb7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xebb7('0x5'));var util=require(_0xebb7('0x6'));var path=require('path');var sox=require(_0xebb7('0x7'));var csv=require(_0xebb7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xebb7('0x9'));var _=require(_0xebb7('0xa'));var squel=require(_0xebb7('0xb'));var crypto=require('crypto');var jsforce=require(_0xebb7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xebb7('0xd'));var Redis=require('ioredis');var authService=require(_0xebb7('0xe'));var qs=require(_0xebb7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xebb7('0x10'))(_0xebb7('0x11'));var utils=require(_0xebb7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xebb7('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xebb7('0x14'));function respondWithStatusCode(_0x545821,_0x2b2033){_0x2b2033=_0x2b2033||0xcc;return function(_0x397fee){if(_0x397fee){return _0x545821[_0xebb7('0x15')](_0x2b2033);}return _0x545821[_0xebb7('0x16')](_0x2b2033)[_0xebb7('0x17')]();};}function respondWithResult(_0x3c6250,_0x34b62c){_0x34b62c=_0x34b62c||0xc8;return function(_0x4d9356){if(_0x4d9356){return _0x3c6250[_0xebb7('0x16')](_0x34b62c)[_0xebb7('0x18')](_0x4d9356);}};}function respondWithFilteredResult(_0xb16ee4,_0x1ad47a){return function(_0x1e149e){if(_0x1e149e){var _0x419ce8=typeof _0x1ad47a[_0xebb7('0x19')]===_0xebb7('0x1a')&&typeof _0x1ad47a[_0xebb7('0x1b')]==='undefined';var _0x1b5300=_0x1e149e['count'];var _0x1652fc=_0x419ce8?0x0:_0x1ad47a[_0xebb7('0x19')];var _0x304ef7=_0x419ce8?_0x1e149e[_0xebb7('0x1c')]:_0x1ad47a[_0xebb7('0x19')]+_0x1ad47a[_0xebb7('0x1b')];var _0x326936;if(_0x304ef7>=_0x1b5300){_0x304ef7=_0x1b5300;_0x326936=0xc8;}else{_0x326936=0xce;}_0xb16ee4[_0xebb7('0x16')](_0x326936);return _0xb16ee4[_0xebb7('0x1d')]('Content-Range',_0x1652fc+'-'+_0x304ef7+'/'+_0x1b5300)['json'](_0x1e149e);}return null;};}function patchUpdates(_0x2a85ad){return function(_0xe93f50){try{jsonpatch[_0xebb7('0x1e')](_0xe93f50,_0x2a85ad,!![]);}catch(_0x406482){return BPromise[_0xebb7('0x1f')](_0x406482);}return _0xe93f50[_0xebb7('0x20')]();};}function saveUpdates(_0x5d4434,_0x188856){return function(_0x3a6f27){if(_0x3a6f27){return _0x3a6f27[_0xebb7('0x21')](_0x5d4434)['then'](function(_0x6b944e){return _0x6b944e;});}return null;};}function removeEntity(_0x2a16ec,_0x249cd7){return function(_0x38c5f2){if(_0x38c5f2){return _0x38c5f2[_0xebb7('0x22')]()['then'](function(){_0x2a16ec['status'](0xcc)[_0xebb7('0x17')]();});}};}function handleEntityNotFound(_0x8a29a6,_0x2e56e4){return function(_0x1ffc80){if(!_0x1ffc80){_0x8a29a6[_0xebb7('0x15')](0x194);}return _0x1ffc80;};}function handleError(_0x17ddbb,_0x29028a){_0x29028a=_0x29028a||0x1f4;return function(_0x1b50e5){logger[_0xebb7('0x23')](_0x1b50e5[_0xebb7('0x24')]);if(_0x1b50e5['name']){delete _0x1b50e5[_0xebb7('0x25')];}_0x17ddbb[_0xebb7('0x16')](_0x29028a)[_0xebb7('0x26')](_0x1b50e5);};}exports['index']=function(_0x91e3a2,_0x3580d0){var _0x3a0b24={},_0xbea2fe={},_0x5db7e8={'count':0x0,'rows':[]};var _0x351131=_[_0xebb7('0x27')](db['FreshsalesAccount']['rawAttributes'],function(_0x25920e){return{'name':_0x25920e['fieldName'],'type':_0x25920e['type'][_0xebb7('0x28')]};});_0xbea2fe[_0xebb7('0x29')]=_[_0xebb7('0x27')](_0x351131,'name');_0xbea2fe['query']=_[_0xebb7('0x2a')](_0x91e3a2[_0xebb7('0x2b')]);_0xbea2fe[_0xebb7('0x2c')]=_[_0xebb7('0x2d')](_0xbea2fe[_0xebb7('0x29')],_0xbea2fe[_0xebb7('0x2b')]);_0x3a0b24['attributes']=_[_0xebb7('0x2d')](_0xbea2fe[_0xebb7('0x29')],qs[_0xebb7('0x2e')](_0x91e3a2[_0xebb7('0x2b')]['fields']));_0x3a0b24[_0xebb7('0x2f')]=_0x3a0b24[_0xebb7('0x2f')][_0xebb7('0x30')]?_0x3a0b24[_0xebb7('0x2f')]:_0xbea2fe['model'];if(!_0x91e3a2[_0xebb7('0x2b')][_0xebb7('0x31')]('nolimit')){_0x3a0b24[_0xebb7('0x1b')]=qs[_0xebb7('0x1b')](_0x91e3a2[_0xebb7('0x2b')][_0xebb7('0x1b')]);_0x3a0b24['offset']=qs['offset'](_0x91e3a2[_0xebb7('0x2b')][_0xebb7('0x19')]);}_0x3a0b24[_0xebb7('0x32')]=qs['sort'](_0x91e3a2[_0xebb7('0x2b')]['sort']);_0x3a0b24[_0xebb7('0x33')]=qs[_0xebb7('0x2c')](_[_0xebb7('0x34')](_0x91e3a2[_0xebb7('0x2b')],_0xbea2fe['filters']),_0x351131);if(_0x91e3a2[_0xebb7('0x2b')]['filter']){_0x3a0b24[_0xebb7('0x33')]=_[_0xebb7('0x35')](_0x3a0b24[_0xebb7('0x33')],{'$or':_['map'](_0x351131,function(_0x5c8766){if(_0x5c8766[_0xebb7('0x36')]!==_0xebb7('0x37')){var _0x4ccf64={};_0x4ccf64[_0x5c8766[_0xebb7('0x25')]]={'$like':'%'+_0x91e3a2['query'][_0xebb7('0x38')]+'%'};return _0x4ccf64;}})});}_0x3a0b24=_['merge']({},_0x3a0b24,_0x91e3a2[_0xebb7('0x39')]);var _0x1f7b87={'where':_0x3a0b24['where']};return db['FreshsalesAccount'][_0xebb7('0x1c')](_0x1f7b87)['then'](function(_0x12cbf4){_0x5db7e8[_0xebb7('0x1c')]=_0x12cbf4;if(_0x91e3a2[_0xebb7('0x2b')][_0xebb7('0x3a')]){_0x3a0b24[_0xebb7('0x3b')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x3a0b24);})['then'](function(_0xc8c6d3){_0x5db7e8[_0xebb7('0x3c')]=_0xc8c6d3;return _0x5db7e8;})[_0xebb7('0x3d')](respondWithFilteredResult(_0x3580d0,_0x3a0b24))[_0xebb7('0x3e')](handleError(_0x3580d0,null));};exports[_0xebb7('0x3f')]=function(_0x1306ac,_0x589796){var _0x2b6fb5={'raw':![],'where':{'id':_0x1306ac[_0xebb7('0x40')]['id']}},_0xd6a91={};_0xd6a91[_0xebb7('0x29')]=_[_0xebb7('0x2a')](db['FreshsalesAccount']['rawAttributes']);_0xd6a91['query']=_[_0xebb7('0x2a')](_0x1306ac[_0xebb7('0x2b')]);_0xd6a91[_0xebb7('0x2c')]=_[_0xebb7('0x2d')](_0xd6a91[_0xebb7('0x29')],_0xd6a91[_0xebb7('0x2b')]);_0x2b6fb5[_0xebb7('0x2f')]=_[_0xebb7('0x2d')](_0xd6a91[_0xebb7('0x29')],qs['fields'](_0x1306ac[_0xebb7('0x2b')][_0xebb7('0x2e')]));_0x2b6fb5[_0xebb7('0x2f')]=_0x2b6fb5[_0xebb7('0x2f')][_0xebb7('0x30')]?_0x2b6fb5[_0xebb7('0x2f')]:_0xd6a91['model'];if(_0x1306ac[_0xebb7('0x2b')]['includeAll']){_0x2b6fb5[_0xebb7('0x3b')]=[{'all':!![]}];}_0x2b6fb5=_['merge']({},_0x2b6fb5,_0x1306ac[_0xebb7('0x39')]);return db[_0xebb7('0x41')][_0xebb7('0x42')](_0x2b6fb5)[_0xebb7('0x3d')](handleEntityNotFound(_0x589796,null))[_0xebb7('0x3d')](respondWithResult(_0x589796,null))[_0xebb7('0x3e')](handleError(_0x589796,null));};exports[_0xebb7('0x43')]=function(_0x41f0da,_0x4fed14){return db[_0xebb7('0x41')][_0xebb7('0x43')](_0x41f0da[_0xebb7('0x44')],{})['then'](respondWithResult(_0x4fed14,0xc9))[_0xebb7('0x3e')](handleError(_0x4fed14,null));};exports[_0xebb7('0x21')]=function(_0xd6d5bf,_0x21f58d){if(_0xd6d5bf[_0xebb7('0x44')]['id']){delete _0xd6d5bf['body']['id'];}return db[_0xebb7('0x41')][_0xebb7('0x42')]({'where':{'id':_0xd6d5bf[_0xebb7('0x40')]['id']}})[_0xebb7('0x3d')](handleEntityNotFound(_0x21f58d,null))[_0xebb7('0x3d')](saveUpdates(_0xd6d5bf['body'],null))[_0xebb7('0x3d')](respondWithResult(_0x21f58d,null))[_0xebb7('0x3e')](handleError(_0x21f58d,null));};exports['destroy']=function(_0x5088b8,_0x515bee){return db[_0xebb7('0x41')][_0xebb7('0x42')]({'where':{'id':_0x5088b8['params']['id']}})[_0xebb7('0x3d')](handleEntityNotFound(_0x515bee,null))[_0xebb7('0x3d')](removeEntity(_0x515bee,null))[_0xebb7('0x3e')](handleError(_0x515bee,null));};exports[_0xebb7('0x45')]=function(_0x40648e,_0x162921,_0x2a939c){var _0x2394c8={};var _0x36401a={};var _0x4aae6c;var _0x477603;return db[_0xebb7('0x41')][_0xebb7('0x46')]({'where':{'id':_0x40648e[_0xebb7('0x40')]['id']}})[_0xebb7('0x3d')](handleEntityNotFound(_0x162921,null))[_0xebb7('0x3d')](function(_0x292616){if(_0x292616){_0x4aae6c=_0x292616;_0x36401a[_0xebb7('0x29')]=_['keys'](db[_0xebb7('0x47')]['rawAttributes']);_0x36401a[_0xebb7('0x2b')]=_[_0xebb7('0x2a')](_0x40648e[_0xebb7('0x2b')]);_0x36401a['filters']=_[_0xebb7('0x2d')](_0x36401a[_0xebb7('0x29')],_0x36401a[_0xebb7('0x2b')]);_0x2394c8['attributes']=_[_0xebb7('0x2d')](_0x36401a['model'],qs[_0xebb7('0x2e')](_0x40648e[_0xebb7('0x2b')][_0xebb7('0x2e')]));_0x2394c8[_0xebb7('0x2f')]=_0x2394c8[_0xebb7('0x2f')][_0xebb7('0x30')]?_0x2394c8[_0xebb7('0x2f')]:_0x36401a[_0xebb7('0x29')];_0x2394c8[_0xebb7('0x32')]=qs[_0xebb7('0x48')](_0x40648e[_0xebb7('0x2b')][_0xebb7('0x48')]);_0x2394c8['where']=qs[_0xebb7('0x2c')](_['pick'](_0x40648e['query'],_0x36401a[_0xebb7('0x2c')]));if(_0x40648e[_0xebb7('0x2b')][_0xebb7('0x38')]){_0x2394c8[_0xebb7('0x33')]=_['merge'](_0x2394c8[_0xebb7('0x33')],{'$or':_[_0xebb7('0x27')](_0x2394c8[_0xebb7('0x2f')],function(_0x2b3aae){var _0x2e5442={};_0x2e5442[_0x2b3aae]={'$like':'%'+_0x40648e[_0xebb7('0x2b')][_0xebb7('0x38')]+'%'};return _0x2e5442;})});}_0x2394c8=_[_0xebb7('0x35')]({},_0x2394c8,_0x40648e['options']);return _0x4aae6c[_0xebb7('0x45')](_0x2394c8);}})[_0xebb7('0x3d')](function(_0x19c776){if(_0x19c776){_0x477603=_0x19c776[_0xebb7('0x30')];if(!_0x40648e[_0xebb7('0x2b')]['hasOwnProperty'](_0xebb7('0x49'))){_0x2394c8[_0xebb7('0x1b')]=qs[_0xebb7('0x1b')](_0x40648e[_0xebb7('0x2b')][_0xebb7('0x1b')]);_0x2394c8['offset']=qs[_0xebb7('0x19')](_0x40648e[_0xebb7('0x2b')][_0xebb7('0x19')]);}return _0x4aae6c[_0xebb7('0x45')](_0x2394c8);}})['then'](function(_0x2aded4){if(_0x2aded4){return _0x2aded4?{'count':_0x477603,'rows':_0x2aded4}:null;}})['then'](respondWithResult(_0x162921,null))[_0xebb7('0x3e')](handleError(_0x162921,null));};exports[_0xebb7('0x4a')]=function(_0x2f812b,_0x1a2415,_0x398204){if(_0x2f812b[_0xebb7('0x44')]['id']){delete _0x2f812b[_0xebb7('0x44')]['id'];}return db[_0xebb7('0x41')][_0xebb7('0x46')]({'where':{'id':_0x2f812b[_0xebb7('0x40')]['id']}})[_0xebb7('0x3d')](handleEntityNotFound(_0x1a2415,null))[_0xebb7('0x3d')](function(_0x3de13d){if(_0x3de13d){_0x2f812b[_0xebb7('0x44')][_0xebb7('0x4b')]=_0x3de13d['id'];_0x2f812b[_0xebb7('0x44')][_0xebb7('0x4c')]=integrations[_0xebb7('0x4d')](_0x2f812b[_0xebb7('0x44')][_0xebb7('0x4e')],_0x2f812b[_0xebb7('0x44')][_0xebb7('0x36')]);_0x2f812b[_0xebb7('0x44')]['Descriptions']=integrations[_0xebb7('0x4f')](_0x2f812b[_0xebb7('0x44')][_0xebb7('0x4e')],_0x2f812b[_0xebb7('0x44')]['type']);return db[_0xebb7('0x47')][_0xebb7('0x43')](_0x2f812b[_0xebb7('0x44')],{'include':[{'model':db[_0xebb7('0x50')],'as':_0xebb7('0x4c')},{'model':db[_0xebb7('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1a2415,null))[_0xebb7('0x3e')](handleError(_0x1a2415,null));};exports[_0xebb7('0x51')]=function(_0x1b1d23,_0x1e0c5b,_0x2cfcfa){var _0x312168='';var _0x3c6d12='';return db[_0xebb7('0x41')][_0xebb7('0x46')]({'where':{'id':_0x1b1d23[_0xebb7('0x40')]['id']},'attributes':['id',_0xebb7('0x52'),_0xebb7('0x53'),'apiKey']})[_0xebb7('0x3d')](handleEntityNotFound(_0x1e0c5b,null))[_0xebb7('0x3d')](function(_0x237046){if(_0x237046){_0x3c6d12=_0x237046[_0xebb7('0x52')];_0x312168=_0x237046[_0xebb7('0x53')];var _0xf7aa3c=_0x237046[_0xebb7('0x53')]['slice'](-0x1);if(_0xf7aa3c==='/'){_0x312168=_0x312168[_0xebb7('0x54')](0x0,_0x312168[_0xebb7('0x55')](_0xf7aa3c));}return rp({'method':_0xebb7('0x56'),'uri':util[_0xebb7('0x57')](_0xebb7('0x58'),_0x312168,_0xebb7('0x59')),'headers':{'Authorization':_0xebb7('0x5a')+_0x237046['apiKey']},'json':!![]});}})['then'](function(_0x140399){if(_0x140399){var _0xf2ba57=_0x140399[_0xebb7('0x5b')];var _0x24b371=![];var _0x133686=null;for(_0x133686=0x0;_0x133686<_0xf2ba57[_0xebb7('0x30')];_0x133686++){if(_0xf2ba57[_0x133686][_0xebb7('0x5c')]===_0x3c6d12){_0x24b371=!![];}}if(_0x24b371){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xebb7('0x5d')});}}})[_0xebb7('0x3d')](respondWithResult(_0x1e0c5b,null))[_0xebb7('0x3e')](function(_0x1f8245){var _0x432259=_0x1b1d23['query']['test']?0x1f4:_0x1f8245[_0xebb7('0x5e')]||0x1f4;logger[_0xebb7('0x23')](_0xebb7('0x5f'),_0xebb7('0x51'),_0x432259,JSON[_0xebb7('0x60')](_0x1f8245));delete _0x1f8245[_0xebb7('0x25')];if(_0x432259===0x191){_0x432259=0x190;}_0x1e0c5b[_0xebb7('0x16')](_0x432259)['send'](_0x1b1d23[_0xebb7('0x2b')][_0xebb7('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0x1f8245['statusCode']}:_0x1f8245);});}; \ No newline at end of file +var _0x90bd=['filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','FreshsalesConfiguration','order','nolimit','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x90bd,0x1db));var _0xd90b=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x90bd[_0x231b2e];return _0x3feb2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd90b('0x0'));var zipdir=require(_0xd90b('0x1'));var jsonpatch=require(_0xd90b('0x2'));var rp=require(_0xd90b('0x3'));var moment=require(_0xd90b('0x4'));var BPromise=require(_0xd90b('0x5'));var Mustache=require('mustache');var util=require(_0xd90b('0x6'));var path=require(_0xd90b('0x7'));var sox=require('sox');var csv=require(_0xd90b('0x8'));var ejs=require(_0xd90b('0x9'));var fs=require('fs');var fs_extra=require(_0xd90b('0xa'));var _=require(_0xd90b('0xb'));var squel=require(_0xd90b('0xc'));var crypto=require(_0xd90b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd90b('0xe'));var toCsv=require(_0xd90b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd90b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd90b('0x10'));var as=require(_0xd90b('0x11'));var hardwareService=require(_0xd90b('0x12'));var logger=require(_0xd90b('0x13'))(_0xd90b('0x14'));var utils=require(_0xd90b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd90b('0x16'))['db'];var integrations=require(_0xd90b('0x17'));function respondWithStatusCode(_0x4ee6d3,_0x523061){_0x523061=_0x523061||0xcc;return function(_0x3a7321){if(_0x3a7321){return _0x4ee6d3[_0xd90b('0x18')](_0x523061);}return _0x4ee6d3['status'](_0x523061)['end']();};}function respondWithResult(_0x1c99bb,_0x48dc6c){_0x48dc6c=_0x48dc6c||0xc8;return function(_0xe621c0){if(_0xe621c0){return _0x1c99bb['status'](_0x48dc6c)[_0xd90b('0x19')](_0xe621c0);}};}function respondWithFilteredResult(_0x30d09a,_0xdcb648){return function(_0x550d4d){if(_0x550d4d){var _0x2e5fb7=typeof _0xdcb648['offset']===_0xd90b('0x1a')&&typeof _0xdcb648[_0xd90b('0x1b')]===_0xd90b('0x1a');var _0x21d458=_0x550d4d[_0xd90b('0x1c')];var _0x23a251=_0x2e5fb7?0x0:_0xdcb648[_0xd90b('0x1d')];var _0x2f3013=_0x2e5fb7?_0x550d4d[_0xd90b('0x1c')]:_0xdcb648['offset']+_0xdcb648[_0xd90b('0x1b')];var _0x15b845;if(_0x2f3013>=_0x21d458){_0x2f3013=_0x21d458;_0x15b845=0xc8;}else{_0x15b845=0xce;}_0x30d09a[_0xd90b('0x1e')](_0x15b845);return _0x30d09a[_0xd90b('0x1f')](_0xd90b('0x20'),_0x23a251+'-'+_0x2f3013+'/'+_0x21d458)[_0xd90b('0x19')](_0x550d4d);}return null;};}function patchUpdates(_0x5673a1){return function(_0x556255){try{jsonpatch[_0xd90b('0x21')](_0x556255,_0x5673a1,!![]);}catch(_0x358ad8){return BPromise[_0xd90b('0x22')](_0x358ad8);}return _0x556255['save']();};}function saveUpdates(_0x4a3d28,_0x4a2b98){return function(_0x5df486){if(_0x5df486){return _0x5df486[_0xd90b('0x23')](_0x4a3d28)[_0xd90b('0x24')](function(_0x24c913){return _0x24c913;});}return null;};}function removeEntity(_0x4aa3c1,_0x56e28a){return function(_0x22aae8){if(_0x22aae8){return _0x22aae8[_0xd90b('0x25')]()[_0xd90b('0x24')](function(){_0x4aa3c1[_0xd90b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e85d,_0x651be8){return function(_0xbbe504){if(!_0xbbe504){_0x31e85d[_0xd90b('0x18')](0x194);}return _0xbbe504;};}function handleError(_0x3c5ea1,_0x47dc35){_0x47dc35=_0x47dc35||0x1f4;return function(_0x36f856){logger[_0xd90b('0x26')](_0x36f856[_0xd90b('0x27')]);if(_0x36f856[_0xd90b('0x28')]){delete _0x36f856[_0xd90b('0x28')];}_0x3c5ea1[_0xd90b('0x1e')](_0x47dc35)[_0xd90b('0x29')](_0x36f856);};}exports['index']=function(_0x836c44,_0x484d23){var _0x90ba6d={},_0x3fa877={},_0x232888={'count':0x0,'rows':[]};var _0x555adc=_['map'](db[_0xd90b('0x2a')][_0xd90b('0x2b')],function(_0x4ad67c){return{'name':_0x4ad67c[_0xd90b('0x2c')],'type':_0x4ad67c[_0xd90b('0x2d')][_0xd90b('0x2e')]};});_0x3fa877[_0xd90b('0x2f')]=_['map'](_0x555adc,'name');_0x3fa877[_0xd90b('0x30')]=_[_0xd90b('0x31')](_0x836c44[_0xd90b('0x30')]);_0x3fa877[_0xd90b('0x32')]=_[_0xd90b('0x33')](_0x3fa877['model'],_0x3fa877[_0xd90b('0x30')]);_0x90ba6d[_0xd90b('0x34')]=_[_0xd90b('0x33')](_0x3fa877[_0xd90b('0x2f')],qs[_0xd90b('0x35')](_0x836c44['query']['fields']));_0x90ba6d[_0xd90b('0x34')]=_0x90ba6d[_0xd90b('0x34')][_0xd90b('0x36')]?_0x90ba6d[_0xd90b('0x34')]:_0x3fa877[_0xd90b('0x2f')];if(!_0x836c44[_0xd90b('0x30')][_0xd90b('0x37')]('nolimit')){_0x90ba6d['limit']=qs[_0xd90b('0x1b')](_0x836c44['query'][_0xd90b('0x1b')]);_0x90ba6d[_0xd90b('0x1d')]=qs[_0xd90b('0x1d')](_0x836c44[_0xd90b('0x30')][_0xd90b('0x1d')]);}_0x90ba6d['order']=qs[_0xd90b('0x38')](_0x836c44[_0xd90b('0x30')][_0xd90b('0x38')]);_0x90ba6d[_0xd90b('0x39')]=qs['filters'](_[_0xd90b('0x3a')](_0x836c44[_0xd90b('0x30')],_0x3fa877[_0xd90b('0x32')]),_0x555adc);if(_0x836c44[_0xd90b('0x30')]['filter']){_0x90ba6d[_0xd90b('0x39')]=_[_0xd90b('0x3b')](_0x90ba6d[_0xd90b('0x39')],{'$or':_[_0xd90b('0x3c')](_0x555adc,function(_0x2bcd86){if(_0x2bcd86[_0xd90b('0x2d')]!==_0xd90b('0x3d')){var _0x5167d7={};_0x5167d7[_0x2bcd86['name']]={'$like':'%'+_0x836c44[_0xd90b('0x30')][_0xd90b('0x3e')]+'%'};return _0x5167d7;}})});}_0x90ba6d=_[_0xd90b('0x3b')]({},_0x90ba6d,_0x836c44[_0xd90b('0x3f')]);var _0x5d25f0={'where':_0x90ba6d[_0xd90b('0x39')]};return db[_0xd90b('0x2a')]['count'](_0x5d25f0)['then'](function(_0x2dd0a7){_0x232888[_0xd90b('0x1c')]=_0x2dd0a7;if(_0x836c44[_0xd90b('0x30')][_0xd90b('0x40')]){_0x90ba6d[_0xd90b('0x41')]=[{'all':!![]}];}return db[_0xd90b('0x2a')][_0xd90b('0x42')](_0x90ba6d);})['then'](function(_0x1bb092){_0x232888[_0xd90b('0x43')]=_0x1bb092;return _0x232888;})[_0xd90b('0x24')](respondWithFilteredResult(_0x484d23,_0x90ba6d))[_0xd90b('0x44')](handleError(_0x484d23,null));};exports[_0xd90b('0x45')]=function(_0x5d86c4,_0x2c23b5){var _0x2bbc3e={'raw':![],'where':{'id':_0x5d86c4[_0xd90b('0x46')]['id']}},_0x50c185={};_0x50c185['model']=_[_0xd90b('0x31')](db[_0xd90b('0x2a')]['rawAttributes']);_0x50c185[_0xd90b('0x30')]=_[_0xd90b('0x31')](_0x5d86c4[_0xd90b('0x30')]);_0x50c185[_0xd90b('0x32')]=_[_0xd90b('0x33')](_0x50c185['model'],_0x50c185[_0xd90b('0x30')]);_0x2bbc3e['attributes']=_['intersection'](_0x50c185['model'],qs['fields'](_0x5d86c4[_0xd90b('0x30')]['fields']));_0x2bbc3e['attributes']=_0x2bbc3e[_0xd90b('0x34')][_0xd90b('0x36')]?_0x2bbc3e[_0xd90b('0x34')]:_0x50c185[_0xd90b('0x2f')];if(_0x5d86c4[_0xd90b('0x30')][_0xd90b('0x40')]){_0x2bbc3e[_0xd90b('0x41')]=[{'all':!![]}];}_0x2bbc3e=_['merge']({},_0x2bbc3e,_0x5d86c4[_0xd90b('0x3f')]);return db[_0xd90b('0x2a')][_0xd90b('0x47')](_0x2bbc3e)[_0xd90b('0x24')](handleEntityNotFound(_0x2c23b5,null))['then'](respondWithResult(_0x2c23b5,null))[_0xd90b('0x44')](handleError(_0x2c23b5,null));};exports[_0xd90b('0x48')]=function(_0x1788e5,_0x59a00f){return db['FreshsalesAccount'][_0xd90b('0x48')](_0x1788e5['body'],{})[_0xd90b('0x24')](respondWithResult(_0x59a00f,0xc9))['catch'](handleError(_0x59a00f,null));};exports['update']=function(_0x2da0f0,_0x3b3b85){if(_0x2da0f0[_0xd90b('0x49')]['id']){delete _0x2da0f0[_0xd90b('0x49')]['id'];}return db['FreshsalesAccount'][_0xd90b('0x47')]({'where':{'id':_0x2da0f0[_0xd90b('0x46')]['id']}})[_0xd90b('0x24')](handleEntityNotFound(_0x3b3b85,null))[_0xd90b('0x24')](saveUpdates(_0x2da0f0[_0xd90b('0x49')],null))[_0xd90b('0x24')](respondWithResult(_0x3b3b85,null))[_0xd90b('0x44')](handleError(_0x3b3b85,null));};exports[_0xd90b('0x25')]=function(_0x323498,_0x3a418a){return db[_0xd90b('0x2a')][_0xd90b('0x47')]({'where':{'id':_0x323498[_0xd90b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a418a,null))[_0xd90b('0x24')](removeEntity(_0x3a418a,null))[_0xd90b('0x44')](handleError(_0x3a418a,null));};exports[_0xd90b('0x4a')]=function(_0x5f2660,_0x2ffabf,_0x364e65){var _0x50c4c2={};var _0x2dbfff={};var _0xb6e539;var _0x1f6346;return db[_0xd90b('0x2a')]['findOne']({'where':{'id':_0x5f2660[_0xd90b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ffabf,null))[_0xd90b('0x24')](function(_0x127a32){if(_0x127a32){_0xb6e539=_0x127a32;_0x2dbfff[_0xd90b('0x2f')]=_[_0xd90b('0x31')](db[_0xd90b('0x4b')]['rawAttributes']);_0x2dbfff[_0xd90b('0x30')]=_[_0xd90b('0x31')](_0x5f2660[_0xd90b('0x30')]);_0x2dbfff['filters']=_[_0xd90b('0x33')](_0x2dbfff[_0xd90b('0x2f')],_0x2dbfff['query']);_0x50c4c2[_0xd90b('0x34')]=_[_0xd90b('0x33')](_0x2dbfff[_0xd90b('0x2f')],qs['fields'](_0x5f2660[_0xd90b('0x30')][_0xd90b('0x35')]));_0x50c4c2[_0xd90b('0x34')]=_0x50c4c2[_0xd90b('0x34')][_0xd90b('0x36')]?_0x50c4c2[_0xd90b('0x34')]:_0x2dbfff['model'];_0x50c4c2[_0xd90b('0x4c')]=qs[_0xd90b('0x38')](_0x5f2660[_0xd90b('0x30')][_0xd90b('0x38')]);_0x50c4c2[_0xd90b('0x39')]=qs[_0xd90b('0x32')](_[_0xd90b('0x3a')](_0x5f2660[_0xd90b('0x30')],_0x2dbfff[_0xd90b('0x32')]));if(_0x5f2660[_0xd90b('0x30')][_0xd90b('0x3e')]){_0x50c4c2[_0xd90b('0x39')]=_[_0xd90b('0x3b')](_0x50c4c2[_0xd90b('0x39')],{'$or':_[_0xd90b('0x3c')](_0x50c4c2[_0xd90b('0x34')],function(_0x4ef262){var _0x2b5b6d={};_0x2b5b6d[_0x4ef262]={'$like':'%'+_0x5f2660[_0xd90b('0x30')][_0xd90b('0x3e')]+'%'};return _0x2b5b6d;})});}_0x50c4c2=_[_0xd90b('0x3b')]({},_0x50c4c2,_0x5f2660[_0xd90b('0x3f')]);return _0xb6e539['getConfigurations'](_0x50c4c2);}})[_0xd90b('0x24')](function(_0x2483df){if(_0x2483df){_0x1f6346=_0x2483df[_0xd90b('0x36')];if(!_0x5f2660['query'][_0xd90b('0x37')](_0xd90b('0x4d'))){_0x50c4c2['limit']=qs[_0xd90b('0x1b')](_0x5f2660[_0xd90b('0x30')][_0xd90b('0x1b')]);_0x50c4c2[_0xd90b('0x1d')]=qs[_0xd90b('0x1d')](_0x5f2660[_0xd90b('0x30')][_0xd90b('0x1d')]);}return _0xb6e539[_0xd90b('0x4a')](_0x50c4c2);}})[_0xd90b('0x24')](function(_0x496ed8){if(_0x496ed8){return _0x496ed8?{'count':_0x1f6346,'rows':_0x496ed8}:null;}})['then'](respondWithResult(_0x2ffabf,null))[_0xd90b('0x44')](handleError(_0x2ffabf,null));};exports[_0xd90b('0x4e')]=function(_0x430036,_0x4404d2,_0x93db12){if(_0x430036['body']['id']){delete _0x430036[_0xd90b('0x49')]['id'];}return db[_0xd90b('0x2a')][_0xd90b('0x4f')]({'where':{'id':_0x430036['params']['id']}})['then'](handleEntityNotFound(_0x4404d2,null))['then'](function(_0x112505){if(_0x112505){_0x430036[_0xd90b('0x49')]['AccountId']=_0x112505['id'];_0x430036[_0xd90b('0x49')][_0xd90b('0x50')]=integrations[_0xd90b('0x51')](_0x430036['body']['channel'],_0x430036[_0xd90b('0x49')][_0xd90b('0x2d')]);_0x430036['body'][_0xd90b('0x52')]=integrations[_0xd90b('0x53')](_0x430036[_0xd90b('0x49')][_0xd90b('0x54')],_0x430036[_0xd90b('0x49')][_0xd90b('0x2d')]);return db[_0xd90b('0x4b')][_0xd90b('0x48')](_0x430036[_0xd90b('0x49')],{'include':[{'model':db[_0xd90b('0x55')],'as':'Subjects'},{'model':db[_0xd90b('0x55')],'as':_0xd90b('0x52')}]});}return null;})[_0xd90b('0x24')](respondWithResult(_0x4404d2,null))[_0xd90b('0x44')](handleError(_0x4404d2,null));};exports[_0xd90b('0x56')]=function(_0xb5596f,_0x42197e,_0x36a804){var _0x5ab668='';var _0x66697d='';return db[_0xd90b('0x2a')][_0xd90b('0x4f')]({'where':{'id':_0xb5596f['params']['id']},'attributes':['id',_0xd90b('0x57'),'remoteUri',_0xd90b('0x58')]})[_0xd90b('0x24')](handleEntityNotFound(_0x42197e,null))[_0xd90b('0x24')](function(_0xb78266){if(_0xb78266){_0x66697d=_0xb78266[_0xd90b('0x57')];_0x5ab668=_0xb78266[_0xd90b('0x59')];var _0x19dcfa=_0xb78266[_0xd90b('0x59')][_0xd90b('0x5a')](-0x1);if(_0x19dcfa==='/'){_0x5ab668=_0x5ab668[_0xd90b('0x5b')](0x0,_0x5ab668[_0xd90b('0x5c')](_0x19dcfa));}return rp({'method':_0xd90b('0x5d'),'uri':util[_0xd90b('0x5e')](_0xd90b('0x5f'),_0x5ab668,_0xd90b('0x60')),'headers':{'Authorization':_0xd90b('0x61')+_0xb78266['apiKey']},'json':!![]});}})[_0xd90b('0x24')](function(_0x30cbf7){if(_0x30cbf7){var _0x48c5cc=_0x30cbf7[_0xd90b('0x62')];var _0x2a5739=![];var _0x1ba8aa=null;for(_0x1ba8aa=0x0;_0x1ba8aa<_0x48c5cc[_0xd90b('0x36')];_0x1ba8aa++){if(_0x48c5cc[_0x1ba8aa][_0xd90b('0x63')]===_0x66697d){_0x2a5739=!![];}}if(_0x2a5739){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xd90b('0x24')](respondWithResult(_0x42197e,null))[_0xd90b('0x44')](function(_0x1b17b){var _0x3c7654=_0xb5596f[_0xd90b('0x30')][_0xd90b('0x64')]?0x1f4:_0x1b17b[_0xd90b('0x65')]||0x1f4;logger[_0xd90b('0x26')](_0xd90b('0x66'),_0xd90b('0x56'),_0x3c7654,JSON[_0xd90b('0x67')](_0x1b17b));delete _0x1b17b['name'];if(_0x3c7654===0x191){_0x3c7654=0x190;}_0x42197e['status'](_0x3c7654)[_0xd90b('0x29')](_0xb5596f[_0xd90b('0x30')]['test']?{'message':_0xd90b('0x68'),'statusCode':_0x1b17b[_0xd90b('0x65')]}:_0x1b17b);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index af17d5d..0d84800 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 _0x0120=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b2dae,_0x2dc1de){var _0xb24b63=function(_0x3557ff){while(--_0x3557ff){_0x2b2dae['push'](_0x2b2dae['shift']());}};_0xb24b63(++_0x2dc1de);}(_0x0120,0x6f));var _0x0012=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0120[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));var integrations=require(_0x0012('0xb'));module['exports']=function(_0x4b396c,_0x59980a){return _0x4b396c[_0x0012('0xc')](_0x0012('0xd'),attributes,{'tableName':_0x0012('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0adf=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x5806a2,_0x55dbf0){var _0x2057fe=function(_0xdac334){while(--_0xdac334){_0x5806a2['push'](_0x5806a2['shift']());}};_0x2057fe(++_0x55dbf0);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x24a1f3,_0x3268ec){_0x24a1f3=_0x24a1f3-0x0;var _0x428b65=_0x0adf[_0x24a1f3];return _0x428b65;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf0ad('0xa')]=function(_0x53221f,_0x2eca0e){return _0x53221f[_0xf0ad('0xb')](_0xf0ad('0xc'),attributes,{'tableName':_0xf0ad('0xd'),'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 8b2077f..311a6e3 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 _0x9536=['code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9536,0x179));var _0x6953=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0x9536[_0x13594e];return _0x1a4f42;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')]({'raw':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1b')]===undefined?!![]:![]:!![],'where':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1c')]||null:null,'attributes':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1d')]||null:null,'limit':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1e')]||null:null,'include':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')],function(_0x2a7f6a){return{'model':db[_0x2a7f6a['model']],'as':_0x2a7f6a['as'],'attributes':_0x2a7f6a['attributes'],'include':_0x2a7f6a['include']?_[_0x6953('0x20')](_0x2a7f6a[_0x6953('0x1f')],function(_0x550be4){return{'model':db[_0x550be4[_0x6953('0x21')]],'as':_0x550be4['as'],'attributes':_0x550be4['attributes'],'include':_0x550be4[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x550be4[_0x6953('0x1f')],function(_0x2cc01e){return{'model':db[_0x2cc01e[_0x6953('0x21')]],'as':_0x2cc01e['as'],'attributes':_0x2cc01e[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd890){logger[_0x6953('0x15')]('GetFreshsalesAccount',_0x2da771);logger[_0x6953('0xf')]('GetFreshsalesAccount',_0x2da771,JSON[_0x6953('0x11')](_0x3dd890));_0x10858a(_0x3dd890);})[_0x6953('0x16')](function(_0x426c7c){logger['error'](_0x6953('0x17'),_0x426c7c[_0x6953('0x14')],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x426c7c['message']));});});};exports[_0x6953('0x22')]=function(_0x132a71){var _0x481c6a=this;return new Promise(function(_0x4d856d,_0xd80e42){return db[_0x6953('0x18')][_0x6953('0x23')]({'raw':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x132a71[_0x6953('0x1a')]?_0x132a71['options'][_0x6953('0x1c')]||null:null,'attributes':_0x132a71[_0x6953('0x1a')]?_0x132a71['options']['attributes']||null:null,'include':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x132a71[_0x6953('0x1a')]['include'],function(_0x4e95f1){return{'model':db[_0x4e95f1['model']],'as':_0x4e95f1['as'],'attributes':_0x4e95f1['attributes'],'include':_0x4e95f1[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x4e95f1[_0x6953('0x1f')],function(_0x11f316){return{'model':db[_0x11f316[_0x6953('0x21')]],'as':_0x11f316['as'],'attributes':_0x11f316[_0x6953('0x1d')],'include':_0x11f316['include']?_[_0x6953('0x20')](_0x11f316['include'],function(_0x199c67){return{'model':db[_0x199c67['model']],'as':_0x199c67['as'],'attributes':_0x199c67[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6953('0xc')](function(_0xd81149){logger[_0x6953('0x15')]('ShowFreshsalesAccount',_0x132a71);logger[_0x6953('0xf')](_0x6953('0x22'),_0x132a71,JSON[_0x6953('0x11')](_0xd81149));_0x4d856d(_0xd81149);})[_0x6953('0x16')](function(_0x40b6ea){logger[_0x6953('0x12')](_0x6953('0x22'),_0x40b6ea[_0x6953('0x14')],_0x132a71);_0xd80e42(_0x481c6a[_0x6953('0x12')](0x1f4,_0x40b6ea[_0x6953('0x14')]));});});}; \ No newline at end of file +var _0x7bd0=['limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FreshsalesAccount','findAll','options','raw','where','attributes'];(function(_0x41dabb,_0x5afa1a){var _0x1c78bb=function(_0x5b3f21){while(--_0x5b3f21){_0x41dabb['push'](_0x41dabb['shift']());}};_0x1c78bb(++_0x5afa1a);}(_0x7bd0,0x111));var _0x07bd=function(_0xf363f0,_0x3b5eeb){_0xf363f0=_0xf363f0-0x0;var _0x55a386=_0x7bd0[_0xf363f0];return _0x55a386;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['GetFreshsalesAccount']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')]({'raw':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1d')]||null:null,'attributes':_0x3f9f0b['options']?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null,'include':_0x3f9f0b['options']?_0x3f9f0b['options'][_0x07bd('0x20')]?_['map'](_0x3f9f0b[_0x07bd('0x1b')]['include'],function(_0x50bd12){return{'model':db[_0x50bd12[_0x07bd('0x21')]],'as':_0x50bd12['as'],'attributes':_0x50bd12[_0x07bd('0x1e')],'include':_0x50bd12[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x50bd12[_0x07bd('0x20')],function(_0x43cbc8){return{'model':db[_0x43cbc8['model']],'as':_0x43cbc8['as'],'attributes':_0x43cbc8[_0x07bd('0x1e')],'include':_0x43cbc8[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x43cbc8[_0x07bd('0x20')],function(_0x12ce26){return{'model':db[_0x12ce26[_0x07bd('0x21')]],'as':_0x12ce26['as'],'attributes':_0x12ce26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5184dc){logger[_0x07bd('0x17')](_0x07bd('0x23'),_0x3f9f0b);logger[_0x07bd('0x11')]('GetFreshsalesAccount',_0x3f9f0b,JSON[_0x07bd('0x13')](_0x5184dc));_0x4948f4(_0x5184dc);})[_0x07bd('0x18')](function(_0x253dc0){logger[_0x07bd('0x14')](_0x07bd('0x23'),_0x253dc0[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0x253dc0[_0x07bd('0x16')]));});});};exports[_0x07bd('0x24')]=function(_0x4182b9){var _0x321200=this;return new Promise(function(_0x1b6cc,_0x314bda){return db[_0x07bd('0x19')][_0x07bd('0x25')]({'raw':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')]['where']||null:null,'attributes':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'include':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x20')],function(_0x5f29c5){return{'model':db[_0x5f29c5[_0x07bd('0x21')]],'as':_0x5f29c5['as'],'attributes':_0x5f29c5[_0x07bd('0x1e')],'include':_0x5f29c5[_0x07bd('0x20')]?_['map'](_0x5f29c5[_0x07bd('0x20')],function(_0x31c381){return{'model':db[_0x31c381['model']],'as':_0x31c381['as'],'attributes':_0x31c381[_0x07bd('0x1e')],'include':_0x31c381[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x31c381[_0x07bd('0x20')],function(_0x5cde8d){return{'model':db[_0x5cde8d['model']],'as':_0x5cde8d['as'],'attributes':_0x5cde8d[_0x07bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2878){logger[_0x07bd('0x17')](_0x07bd('0x24'),_0x4182b9);logger[_0x07bd('0x11')](_0x07bd('0x24'),_0x4182b9,JSON[_0x07bd('0x13')](_0x3c2878));_0x1b6cc(_0x3c2878);})[_0x07bd('0x18')](function(_0x333ac2){logger[_0x07bd('0x14')](_0x07bd('0x24'),_0x333ac2[_0x07bd('0x16')],_0x4182b9);_0x314bda(_0x321200[_0x07bd('0x14')](0x1f4,_0x333ac2[_0x07bd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 492508f..f5b9cc7 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 _0xc48c=['../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','update','destroy','exports','multer','util','express','Router','../../components/interaction/service'];(function(_0x421a5f,_0x68095a){var _0x4325ee=function(_0x5af8a3){while(--_0x5af8a3){_0x421a5f['push'](_0x421a5f['shift']());}};_0x4325ee(++_0x68095a);}(_0xc48c,0x1df));var _0xcc48=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc48c[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xcc48('0x0'));var util=require(_0xcc48('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc48('0x2'));var router=express[_0xcc48('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcc48('0x4'));var config=require(_0xcc48('0x5'));var controller=require(_0xcc48('0x6'));router['get']('/',auth[_0xcc48('0x7')](),controller[_0xcc48('0x8')]);router['get'](_0xcc48('0x9'),auth['isAuthenticated'](),controller[_0xcc48('0xa')]);router[_0xcc48('0xb')](_0xcc48('0xc'),auth[_0xcc48('0x7')](),controller[_0xcc48('0xd')]);router[_0xcc48('0xb')]('/:id/descriptions',auth[_0xcc48('0x7')](),controller[_0xcc48('0xe')]);router['get'](_0xcc48('0xf'),auth[_0xcc48('0x7')](),controller[_0xcc48('0x10')]);router[_0xcc48('0x11')]('/',auth[_0xcc48('0x7')](),controller[_0xcc48('0x12')]);router['put'](_0xcc48('0x9'),auth['isAuthenticated'](),controller[_0xcc48('0x13')]);router['delete'](_0xcc48('0x9'),auth[_0xcc48('0x7')](),controller[_0xcc48('0x14')]);module[_0xcc48('0x15')]=router; \ No newline at end of file +var _0x9a25=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post','put','update','delete','destroy','exports','util'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x9a25,0x1a1));var _0x59a2=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9a25[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x59a2('0x0'));var path=require(_0x59a2('0x1'));var timeout=require(_0x59a2('0x2'));var express=require(_0x59a2('0x3'));var router=express['Router']();var fs_extra=require(_0x59a2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x59a2('0x5'));var config=require(_0x59a2('0x6'));var controller=require(_0x59a2('0x7'));router[_0x59a2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x59a2('0x8')](_0x59a2('0x9'),auth[_0x59a2('0xa')](),controller[_0x59a2('0xb')]);router[_0x59a2('0x8')](_0x59a2('0xc'),auth[_0x59a2('0xa')](),controller[_0x59a2('0xd')]);router[_0x59a2('0x8')]('/:id/descriptions',auth[_0x59a2('0xa')](),controller[_0x59a2('0xe')]);router[_0x59a2('0x8')](_0x59a2('0xf'),auth[_0x59a2('0xa')](),controller['getFields']);router[_0x59a2('0x10')]('/',auth[_0x59a2('0xa')](),controller['create']);router[_0x59a2('0x11')]('/:id',auth[_0x59a2('0xa')](),controller[_0x59a2('0x12')]);router[_0x59a2('0x13')]('/:id',auth[_0x59a2('0xa')](),controller[_0x59a2('0x14')]);module[_0x59a2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 8b65655..884b301 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 _0x1704=['STRING','exports'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x1704,0x101));var _0x4170=function(_0x5704b3,_0x328796){_0x5704b3=_0x5704b3-0x0;var _0x2998bc=_0x1704[_0x5704b3];return _0x2998bc;};'use strict';var Sequelize=require('sequelize');module[_0x4170('0x0')]={'name':{'type':Sequelize[_0x4170('0x1')]},'description':{'type':Sequelize[_0x4170('0x1')]}}; \ No newline at end of file +var _0xd3a9=['STRING','sequelize'];(function(_0x4ecfff,_0x468d60){var _0x347743=function(_0x3f6872){while(--_0x3f6872){_0x4ecfff['push'](_0x4ecfff['shift']());}};_0x347743(++_0x468d60);}(_0xd3a9,0x107));var _0x9d3a=function(_0x575946,_0x1bb20e){_0x575946=_0x575946-0x0;var _0x277443=_0xd3a9[_0x575946];return _0x277443;};'use strict';var Sequelize=require(_0x9d3a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9d3a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index e4b563c..dc5fd38 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 _0xa2a2=['filters','model','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','catch','show','params','keys','includeAll','find','create','body','destroy','findOne','FreshsalesField','order','hasOwnProperty','getSubjects','getDescriptions','getFields','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa2a2,0x71));var _0x2a2a=function(_0x4de2f3,_0x5b34e7){_0x4de2f3=_0x4de2f3-0x0;var _0x9fb40=_0xa2a2[_0x4de2f3];return _0x9fb40;};'use strict';var emlformat=require(_0x2a2a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2a2a('0x1'));var moment=require(_0x2a2a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2a2a('0x3'));var util=require('util');var path=require(_0x2a2a('0x4'));var sox=require(_0x2a2a('0x5'));var csv=require(_0x2a2a('0x6'));var ejs=require(_0x2a2a('0x7'));var fs=require('fs');var fs_extra=require(_0x2a2a('0x8'));var _=require('lodash');var squel=require(_0x2a2a('0x9'));var crypto=require(_0x2a2a('0xa'));var jsforce=require(_0x2a2a('0xb'));var deskjs=require(_0x2a2a('0xc'));var toCsv=require(_0x2a2a('0x6'));var querystring=require(_0x2a2a('0xd'));var Papa=require(_0x2a2a('0xe'));var Redis=require(_0x2a2a('0xf'));var authService=require(_0x2a2a('0x10'));var qs=require(_0x2a2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a2a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2a2a('0x13'));var config=require(_0x2a2a('0x14'));var licenseUtil=require(_0x2a2a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265f40,_0x213662){_0x213662=_0x213662||0xcc;return function(_0x348650){if(_0x348650){return _0x265f40[_0x2a2a('0x16')](_0x213662);}return _0x265f40[_0x2a2a('0x17')](_0x213662)[_0x2a2a('0x18')]();};}function respondWithResult(_0x1d2230,_0x49a870){_0x49a870=_0x49a870||0xc8;return function(_0x355c71){if(_0x355c71){return _0x1d2230[_0x2a2a('0x17')](_0x49a870)[_0x2a2a('0x19')](_0x355c71);}};}function respondWithFilteredResult(_0x4a0830,_0x36d8ef){return function(_0x8327b9){if(_0x8327b9){var _0x5a6b37=typeof _0x36d8ef[_0x2a2a('0x1a')]===_0x2a2a('0x1b')&&typeof _0x36d8ef[_0x2a2a('0x1c')]===_0x2a2a('0x1b');var _0x1f2463=_0x8327b9[_0x2a2a('0x1d')];var _0x4bc079=_0x5a6b37?0x0:_0x36d8ef[_0x2a2a('0x1a')];var _0x3d2b88=_0x5a6b37?_0x8327b9[_0x2a2a('0x1d')]:_0x36d8ef[_0x2a2a('0x1a')]+_0x36d8ef[_0x2a2a('0x1c')];var _0x446909;if(_0x3d2b88>=_0x1f2463){_0x3d2b88=_0x1f2463;_0x446909=0xc8;}else{_0x446909=0xce;}_0x4a0830[_0x2a2a('0x17')](_0x446909);return _0x4a0830[_0x2a2a('0x1e')](_0x2a2a('0x1f'),_0x4bc079+'-'+_0x3d2b88+'/'+_0x1f2463)[_0x2a2a('0x19')](_0x8327b9);}return null;};}function patchUpdates(_0x13ebb8){return function(_0x4c512b){try{jsonpatch[_0x2a2a('0x20')](_0x4c512b,_0x13ebb8,!![]);}catch(_0x3d1822){return BPromise[_0x2a2a('0x21')](_0x3d1822);}return _0x4c512b[_0x2a2a('0x22')]();};}function saveUpdates(_0x4fbfa7,_0x4cb216){return function(_0x4844ae){if(_0x4844ae){return _0x4844ae[_0x2a2a('0x23')](_0x4fbfa7)['then'](function(_0x7f6a90){return _0x7f6a90;});}return null;};}function removeEntity(_0x33d6c0,_0x2f63a5){return function(_0x54ddf0){if(_0x54ddf0){return _0x54ddf0['destroy']()['then'](function(){_0x33d6c0[_0x2a2a('0x17')](0xcc)[_0x2a2a('0x18')]();});}};}function handleEntityNotFound(_0x20200a,_0x49f181){return function(_0x18431f){if(!_0x18431f){_0x20200a[_0x2a2a('0x16')](0x194);}return _0x18431f;};}function handleError(_0x3e142f,_0x49a346){_0x49a346=_0x49a346||0x1f4;return function(_0xd0f984){logger['error'](_0xd0f984[_0x2a2a('0x24')]);if(_0xd0f984[_0x2a2a('0x25')]){delete _0xd0f984[_0x2a2a('0x25')];}_0x3e142f[_0x2a2a('0x17')](_0x49a346)['send'](_0xd0f984);};}exports[_0x2a2a('0x26')]=function(_0x8a8b08,_0x4c8e8b){var _0x59147c={},_0x2cd006={},_0xe174b8={'count':0x0,'rows':[]};var _0xb5493=_[_0x2a2a('0x27')](db[_0x2a2a('0x28')][_0x2a2a('0x29')],function(_0x3b5e7e){return{'name':_0x3b5e7e[_0x2a2a('0x2a')],'type':_0x3b5e7e[_0x2a2a('0x2b')][_0x2a2a('0x2c')]};});_0x2cd006['model']=_[_0x2a2a('0x27')](_0xb5493,_0x2a2a('0x25'));_0x2cd006['query']=_['keys'](_0x8a8b08['query']);_0x2cd006[_0x2a2a('0x2d')]=_['intersection'](_0x2cd006[_0x2a2a('0x2e')],_0x2cd006[_0x2a2a('0x2f')]);_0x59147c[_0x2a2a('0x30')]=_[_0x2a2a('0x31')](_0x2cd006[_0x2a2a('0x2e')],qs[_0x2a2a('0x32')](_0x8a8b08[_0x2a2a('0x2f')]['fields']));_0x59147c[_0x2a2a('0x30')]=_0x59147c[_0x2a2a('0x30')][_0x2a2a('0x33')]?_0x59147c['attributes']:_0x2cd006[_0x2a2a('0x2e')];if(!_0x8a8b08[_0x2a2a('0x2f')]['hasOwnProperty'](_0x2a2a('0x34'))){_0x59147c['limit']=qs[_0x2a2a('0x1c')](_0x8a8b08[_0x2a2a('0x2f')]['limit']);_0x59147c[_0x2a2a('0x1a')]=qs[_0x2a2a('0x1a')](_0x8a8b08[_0x2a2a('0x2f')][_0x2a2a('0x1a')]);}_0x59147c['order']=qs[_0x2a2a('0x35')](_0x8a8b08['query'][_0x2a2a('0x35')]);_0x59147c[_0x2a2a('0x36')]=qs[_0x2a2a('0x2d')](_[_0x2a2a('0x37')](_0x8a8b08[_0x2a2a('0x2f')],_0x2cd006[_0x2a2a('0x2d')]),_0xb5493);if(_0x8a8b08['query'][_0x2a2a('0x38')]){_0x59147c['where']=_[_0x2a2a('0x39')](_0x59147c[_0x2a2a('0x36')],{'$or':_[_0x2a2a('0x27')](_0xb5493,function(_0x30b4d8){if(_0x30b4d8[_0x2a2a('0x2b')]!==_0x2a2a('0x3a')){var _0x554d58={};_0x554d58[_0x30b4d8[_0x2a2a('0x25')]]={'$like':'%'+_0x8a8b08[_0x2a2a('0x2f')]['filter']+'%'};return _0x554d58;}})});}_0x59147c=_[_0x2a2a('0x39')]({},_0x59147c,_0x8a8b08[_0x2a2a('0x3b')]);var _0x34b768={'where':_0x59147c[_0x2a2a('0x36')]};return db[_0x2a2a('0x28')]['count'](_0x34b768)[_0x2a2a('0x3c')](function(_0x29574c){_0xe174b8[_0x2a2a('0x1d')]=_0x29574c;if(_0x8a8b08[_0x2a2a('0x2f')]['includeAll']){_0x59147c[_0x2a2a('0x3d')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x2a2a('0x3e')](_0x59147c);})['then'](function(_0x358578){_0xe174b8['rows']=_0x358578;return _0xe174b8;})[_0x2a2a('0x3c')](respondWithFilteredResult(_0x4c8e8b,_0x59147c))[_0x2a2a('0x3f')](handleError(_0x4c8e8b,null));};exports[_0x2a2a('0x40')]=function(_0xc338d7,_0x205cb8){var _0x54cef4={'raw':![],'where':{'id':_0xc338d7[_0x2a2a('0x41')]['id']}},_0x7fdf8d={};_0x7fdf8d['model']=_[_0x2a2a('0x42')](db['FreshsalesConfiguration']['rawAttributes']);_0x7fdf8d[_0x2a2a('0x2f')]=_[_0x2a2a('0x42')](_0xc338d7[_0x2a2a('0x2f')]);_0x7fdf8d[_0x2a2a('0x2d')]=_[_0x2a2a('0x31')](_0x7fdf8d['model'],_0x7fdf8d['query']);_0x54cef4[_0x2a2a('0x30')]=_[_0x2a2a('0x31')](_0x7fdf8d['model'],qs[_0x2a2a('0x32')](_0xc338d7[_0x2a2a('0x2f')][_0x2a2a('0x32')]));_0x54cef4['attributes']=_0x54cef4[_0x2a2a('0x30')]['length']?_0x54cef4[_0x2a2a('0x30')]:_0x7fdf8d[_0x2a2a('0x2e')];if(_0xc338d7[_0x2a2a('0x2f')][_0x2a2a('0x43')]){_0x54cef4['include']=[{'all':!![]}];}_0x54cef4=_[_0x2a2a('0x39')]({},_0x54cef4,_0xc338d7['options']);return db[_0x2a2a('0x28')][_0x2a2a('0x44')](_0x54cef4)[_0x2a2a('0x3c')](handleEntityNotFound(_0x205cb8,null))['then'](respondWithResult(_0x205cb8,null))[_0x2a2a('0x3f')](handleError(_0x205cb8,null));};exports[_0x2a2a('0x45')]=function(_0x3fecab,_0x6be3ed){return db[_0x2a2a('0x28')][_0x2a2a('0x45')](_0x3fecab[_0x2a2a('0x46')],{})[_0x2a2a('0x3c')](respondWithResult(_0x6be3ed,0xc9))[_0x2a2a('0x3f')](handleError(_0x6be3ed,null));};exports['update']=function(_0x3e5519,_0x55c4d0){if(_0x3e5519[_0x2a2a('0x46')]['id']){delete _0x3e5519[_0x2a2a('0x46')]['id'];}return db[_0x2a2a('0x28')]['find']({'where':{'id':_0x3e5519[_0x2a2a('0x41')]['id']}})[_0x2a2a('0x3c')](handleEntityNotFound(_0x55c4d0,null))[_0x2a2a('0x3c')](saveUpdates(_0x3e5519[_0x2a2a('0x46')],null))[_0x2a2a('0x3c')](respondWithResult(_0x55c4d0,null))['catch'](handleError(_0x55c4d0,null));};exports[_0x2a2a('0x47')]=function(_0x107ee5,_0x212f23){return db[_0x2a2a('0x28')][_0x2a2a('0x44')]({'where':{'id':_0x107ee5[_0x2a2a('0x41')]['id']}})[_0x2a2a('0x3c')](handleEntityNotFound(_0x212f23,null))[_0x2a2a('0x3c')](removeEntity(_0x212f23,null))['catch'](handleError(_0x212f23,null));};exports['getSubjects']=function(_0x44954a,_0x37b88b,_0x4d4dc3){var _0x2f4406={};var _0x15f5f0={};var _0x3f8eef;var _0x39ddb7;return db[_0x2a2a('0x28')][_0x2a2a('0x48')]({'where':{'id':_0x44954a[_0x2a2a('0x41')]['id']}})[_0x2a2a('0x3c')](handleEntityNotFound(_0x37b88b,null))[_0x2a2a('0x3c')](function(_0xf4fe93){if(_0xf4fe93){_0x3f8eef=_0xf4fe93;_0x15f5f0[_0x2a2a('0x2e')]=_[_0x2a2a('0x42')](db[_0x2a2a('0x49')]['rawAttributes']);_0x15f5f0[_0x2a2a('0x2f')]=_[_0x2a2a('0x42')](_0x44954a[_0x2a2a('0x2f')]);_0x15f5f0['filters']=_[_0x2a2a('0x31')](_0x15f5f0[_0x2a2a('0x2e')],_0x15f5f0[_0x2a2a('0x2f')]);_0x2f4406[_0x2a2a('0x30')]=_[_0x2a2a('0x31')](_0x15f5f0[_0x2a2a('0x2e')],qs[_0x2a2a('0x32')](_0x44954a[_0x2a2a('0x2f')][_0x2a2a('0x32')]));_0x2f4406[_0x2a2a('0x30')]=_0x2f4406[_0x2a2a('0x30')][_0x2a2a('0x33')]?_0x2f4406[_0x2a2a('0x30')]:_0x15f5f0[_0x2a2a('0x2e')];_0x2f4406[_0x2a2a('0x4a')]=qs['sort'](_0x44954a[_0x2a2a('0x2f')][_0x2a2a('0x35')]);_0x2f4406[_0x2a2a('0x36')]=qs[_0x2a2a('0x2d')](_[_0x2a2a('0x37')](_0x44954a['query'],_0x15f5f0[_0x2a2a('0x2d')]));if(_0x44954a[_0x2a2a('0x2f')][_0x2a2a('0x38')]){_0x2f4406[_0x2a2a('0x36')]=_['merge'](_0x2f4406[_0x2a2a('0x36')],{'$or':_[_0x2a2a('0x27')](_0x2f4406['attributes'],function(_0x3ac266){var _0xc2b5dd={};_0xc2b5dd[_0x3ac266]={'$like':'%'+_0x44954a[_0x2a2a('0x2f')][_0x2a2a('0x38')]+'%'};return _0xc2b5dd;})});}_0x2f4406=_['merge']({},_0x2f4406,_0x44954a[_0x2a2a('0x3b')]);return _0x3f8eef['getSubjects'](_0x2f4406);}})[_0x2a2a('0x3c')](function(_0x16691d){if(_0x16691d){_0x39ddb7=_0x16691d[_0x2a2a('0x33')];if(!_0x44954a['query'][_0x2a2a('0x4b')](_0x2a2a('0x34'))){_0x2f4406[_0x2a2a('0x1c')]=qs[_0x2a2a('0x1c')](_0x44954a['query'][_0x2a2a('0x1c')]);_0x2f4406['offset']=qs[_0x2a2a('0x1a')](_0x44954a[_0x2a2a('0x2f')][_0x2a2a('0x1a')]);}return _0x3f8eef[_0x2a2a('0x4c')](_0x2f4406);}})[_0x2a2a('0x3c')](function(_0x513817){if(_0x513817){return _0x513817?{'count':_0x39ddb7,'rows':_0x513817}:null;}})[_0x2a2a('0x3c')](respondWithResult(_0x37b88b,null))[_0x2a2a('0x3f')](handleError(_0x37b88b,null));};exports[_0x2a2a('0x4d')]=function(_0xa9d3d4,_0x20d203,_0x1cc0aa){var _0x4c9527={};var _0x1b95dc={};var _0x253e51;var _0x164195;return db[_0x2a2a('0x28')][_0x2a2a('0x48')]({'where':{'id':_0xa9d3d4[_0x2a2a('0x41')]['id']}})[_0x2a2a('0x3c')](handleEntityNotFound(_0x20d203,null))[_0x2a2a('0x3c')](function(_0x34a07d){if(_0x34a07d){_0x253e51=_0x34a07d;_0x1b95dc['model']=_[_0x2a2a('0x42')](db[_0x2a2a('0x49')][_0x2a2a('0x29')]);_0x1b95dc[_0x2a2a('0x2f')]=_['keys'](_0xa9d3d4[_0x2a2a('0x2f')]);_0x1b95dc[_0x2a2a('0x2d')]=_[_0x2a2a('0x31')](_0x1b95dc[_0x2a2a('0x2e')],_0x1b95dc[_0x2a2a('0x2f')]);_0x4c9527[_0x2a2a('0x30')]=_[_0x2a2a('0x31')](_0x1b95dc[_0x2a2a('0x2e')],qs[_0x2a2a('0x32')](_0xa9d3d4['query']['fields']));_0x4c9527[_0x2a2a('0x30')]=_0x4c9527[_0x2a2a('0x30')][_0x2a2a('0x33')]?_0x4c9527[_0x2a2a('0x30')]:_0x1b95dc[_0x2a2a('0x2e')];_0x4c9527[_0x2a2a('0x4a')]=qs[_0x2a2a('0x35')](_0xa9d3d4[_0x2a2a('0x2f')][_0x2a2a('0x35')]);_0x4c9527[_0x2a2a('0x36')]=qs['filters'](_[_0x2a2a('0x37')](_0xa9d3d4['query'],_0x1b95dc[_0x2a2a('0x2d')]));if(_0xa9d3d4[_0x2a2a('0x2f')][_0x2a2a('0x38')]){_0x4c9527[_0x2a2a('0x36')]=_[_0x2a2a('0x39')](_0x4c9527[_0x2a2a('0x36')],{'$or':_[_0x2a2a('0x27')](_0x4c9527[_0x2a2a('0x30')],function(_0x890fb1){var _0xac42ce={};_0xac42ce[_0x890fb1]={'$like':'%'+_0xa9d3d4[_0x2a2a('0x2f')]['filter']+'%'};return _0xac42ce;})});}_0x4c9527=_['merge']({},_0x4c9527,_0xa9d3d4[_0x2a2a('0x3b')]);return _0x253e51['getDescriptions'](_0x4c9527);}})[_0x2a2a('0x3c')](function(_0x3b817b){if(_0x3b817b){_0x164195=_0x3b817b[_0x2a2a('0x33')];if(!_0xa9d3d4[_0x2a2a('0x2f')][_0x2a2a('0x4b')]('nolimit')){_0x4c9527['limit']=qs[_0x2a2a('0x1c')](_0xa9d3d4[_0x2a2a('0x2f')][_0x2a2a('0x1c')]);_0x4c9527[_0x2a2a('0x1a')]=qs[_0x2a2a('0x1a')](_0xa9d3d4['query'][_0x2a2a('0x1a')]);}return _0x253e51[_0x2a2a('0x4d')](_0x4c9527);}})[_0x2a2a('0x3c')](function(_0x70b0a2){if(_0x70b0a2){return _0x70b0a2?{'count':_0x164195,'rows':_0x70b0a2}:null;}})['then'](respondWithResult(_0x20d203,null))[_0x2a2a('0x3f')](handleError(_0x20d203,null));};exports[_0x2a2a('0x4e')]=function(_0x235719,_0xa840e6,_0x3b70e3){var _0x4dacde={};var _0x30c443={};var _0x53590b;var _0x20c8b5;return db[_0x2a2a('0x28')][_0x2a2a('0x48')]({'where':{'id':_0x235719[_0x2a2a('0x41')]['id']}})['then'](handleEntityNotFound(_0xa840e6,null))[_0x2a2a('0x3c')](function(_0x2d5e19){if(_0x2d5e19){_0x53590b=_0x2d5e19;_0x30c443[_0x2a2a('0x2e')]=_[_0x2a2a('0x42')](db[_0x2a2a('0x49')][_0x2a2a('0x29')]);_0x30c443['query']=_[_0x2a2a('0x42')](_0x235719[_0x2a2a('0x2f')]);_0x30c443['filters']=_[_0x2a2a('0x31')](_0x30c443[_0x2a2a('0x2e')],_0x30c443['query']);_0x4dacde[_0x2a2a('0x30')]=_['intersection'](_0x30c443[_0x2a2a('0x2e')],qs['fields'](_0x235719[_0x2a2a('0x2f')]['fields']));_0x4dacde[_0x2a2a('0x30')]=_0x4dacde[_0x2a2a('0x30')][_0x2a2a('0x33')]?_0x4dacde[_0x2a2a('0x30')]:_0x30c443['model'];_0x4dacde[_0x2a2a('0x4a')]=qs[_0x2a2a('0x35')](_0x235719[_0x2a2a('0x2f')]['sort']);_0x4dacde[_0x2a2a('0x36')]=qs['filters'](_[_0x2a2a('0x37')](_0x235719[_0x2a2a('0x2f')],_0x30c443[_0x2a2a('0x2d')]));if(_0x235719['query']['filter']){_0x4dacde['where']=_[_0x2a2a('0x39')](_0x4dacde[_0x2a2a('0x36')],{'$or':_[_0x2a2a('0x27')](_0x4dacde[_0x2a2a('0x30')],function(_0x58c445){var _0x3d0dff={};_0x3d0dff[_0x58c445]={'$like':'%'+_0x235719[_0x2a2a('0x2f')][_0x2a2a('0x38')]+'%'};return _0x3d0dff;})});}_0x4dacde=_[_0x2a2a('0x39')]({},_0x4dacde,_0x235719[_0x2a2a('0x3b')]);return _0x53590b['getFields'](_0x4dacde);}})[_0x2a2a('0x3c')](function(_0x468836){if(_0x468836){_0x20c8b5=_0x468836['length'];if(!_0x235719[_0x2a2a('0x2f')][_0x2a2a('0x4b')](_0x2a2a('0x34'))){_0x4dacde[_0x2a2a('0x1c')]=qs[_0x2a2a('0x1c')](_0x235719[_0x2a2a('0x2f')][_0x2a2a('0x1c')]);_0x4dacde[_0x2a2a('0x1a')]=qs[_0x2a2a('0x1a')](_0x235719['query'][_0x2a2a('0x1a')]);}return _0x53590b[_0x2a2a('0x4e')](_0x4dacde);}})[_0x2a2a('0x3c')](function(_0x4467cc){if(_0x4467cc){return _0x4467cc?{'count':_0x20c8b5,'rows':_0x4467cc}:null;}})[_0x2a2a('0x3c')](respondWithResult(_0xa840e6,null))['catch'](handleError(_0xa840e6,null));}; \ No newline at end of file +var _0x0c8b=['include','findAll','rows','catch','show','FreshsalesConfiguration','length','find','create','body','params','destroy','getSubjects','findOne','FreshsalesField','order','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','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','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x2ee5f2,_0x2a1ad8){var _0x44138d=function(_0x2b1453){while(--_0x2b1453){_0x2ee5f2['push'](_0x2ee5f2['shift']());}};_0x44138d(++_0x2a1ad8);}(_0x0c8b,0x65));var _0xb0c8=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x0c8b[_0x7275e9];return _0x17b99d;};'use strict';var emlformat=require(_0xb0c8('0x0'));var rimraf=require(_0xb0c8('0x1'));var zipdir=require(_0xb0c8('0x2'));var jsonpatch=require(_0xb0c8('0x3'));var rp=require(_0xb0c8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb0c8('0x5'));var util=require(_0xb0c8('0x6'));var path=require('path');var sox=require(_0xb0c8('0x7'));var csv=require(_0xb0c8('0x8'));var ejs=require(_0xb0c8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0c8('0xa'));var squel=require('squel');var crypto=require(_0xb0c8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb0c8('0xc'));var toCsv=require(_0xb0c8('0x8'));var querystring=require(_0xb0c8('0xd'));var Papa=require(_0xb0c8('0xe'));var Redis=require(_0xb0c8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb0c8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0c8('0x11'));var logger=require(_0xb0c8('0x12'))(_0xb0c8('0x13'));var utils=require(_0xb0c8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb0c8('0x15'));var db=require(_0xb0c8('0x16'))['db'];function respondWithStatusCode(_0x1be979,_0x4409c2){_0x4409c2=_0x4409c2||0xcc;return function(_0x304365){if(_0x304365){return _0x1be979[_0xb0c8('0x17')](_0x4409c2);}return _0x1be979[_0xb0c8('0x18')](_0x4409c2)[_0xb0c8('0x19')]();};}function respondWithResult(_0x44dd32,_0x45bfda){_0x45bfda=_0x45bfda||0xc8;return function(_0x2f4eda){if(_0x2f4eda){return _0x44dd32[_0xb0c8('0x18')](_0x45bfda)[_0xb0c8('0x1a')](_0x2f4eda);}};}function respondWithFilteredResult(_0x5c6bb5,_0x201c99){return function(_0x12eecf){if(_0x12eecf){var _0x331744=typeof _0x201c99[_0xb0c8('0x1b')]===_0xb0c8('0x1c')&&typeof _0x201c99[_0xb0c8('0x1d')]==='undefined';var _0x40540b=_0x12eecf[_0xb0c8('0x1e')];var _0x26f3de=_0x331744?0x0:_0x201c99[_0xb0c8('0x1b')];var _0x422f1e=_0x331744?_0x12eecf[_0xb0c8('0x1e')]:_0x201c99[_0xb0c8('0x1b')]+_0x201c99['limit'];var _0x3b7678;if(_0x422f1e>=_0x40540b){_0x422f1e=_0x40540b;_0x3b7678=0xc8;}else{_0x3b7678=0xce;}_0x5c6bb5['status'](_0x3b7678);return _0x5c6bb5[_0xb0c8('0x1f')](_0xb0c8('0x20'),_0x26f3de+'-'+_0x422f1e+'/'+_0x40540b)[_0xb0c8('0x1a')](_0x12eecf);}return null;};}function patchUpdates(_0x22dad7){return function(_0x3e6e76){try{jsonpatch[_0xb0c8('0x21')](_0x3e6e76,_0x22dad7,!![]);}catch(_0x55a70f){return BPromise[_0xb0c8('0x22')](_0x55a70f);}return _0x3e6e76[_0xb0c8('0x23')]();};}function saveUpdates(_0x482d72,_0x54e7a5){return function(_0x377cf4){if(_0x377cf4){return _0x377cf4[_0xb0c8('0x24')](_0x482d72)[_0xb0c8('0x25')](function(_0x2248f3){return _0x2248f3;});}return null;};}function removeEntity(_0x528281,_0x15070b){return function(_0x338c51){if(_0x338c51){return _0x338c51['destroy']()['then'](function(){_0x528281[_0xb0c8('0x18')](0xcc)[_0xb0c8('0x19')]();});}};}function handleEntityNotFound(_0x3e007d,_0x1af079){return function(_0x53f5d1){if(!_0x53f5d1){_0x3e007d[_0xb0c8('0x17')](0x194);}return _0x53f5d1;};}function handleError(_0x24f2fa,_0x1d7800){_0x1d7800=_0x1d7800||0x1f4;return function(_0x3f5e6f){logger[_0xb0c8('0x26')](_0x3f5e6f[_0xb0c8('0x27')]);if(_0x3f5e6f[_0xb0c8('0x28')]){delete _0x3f5e6f[_0xb0c8('0x28')];}_0x24f2fa[_0xb0c8('0x18')](_0x1d7800)[_0xb0c8('0x29')](_0x3f5e6f);};}exports[_0xb0c8('0x2a')]=function(_0x9c4832,_0x2ec27f){var _0xc884b4={},_0x2b5a05={},_0x445357={'count':0x0,'rows':[]};var _0x39beae=_[_0xb0c8('0x2b')](db['FreshsalesConfiguration'][_0xb0c8('0x2c')],function(_0x41754d){return{'name':_0x41754d[_0xb0c8('0x2d')],'type':_0x41754d[_0xb0c8('0x2e')][_0xb0c8('0x2f')]};});_0x2b5a05[_0xb0c8('0x30')]=_[_0xb0c8('0x2b')](_0x39beae,'name');_0x2b5a05[_0xb0c8('0x31')]=_[_0xb0c8('0x32')](_0x9c4832[_0xb0c8('0x31')]);_0x2b5a05[_0xb0c8('0x33')]=_[_0xb0c8('0x34')](_0x2b5a05[_0xb0c8('0x30')],_0x2b5a05[_0xb0c8('0x31')]);_0xc884b4[_0xb0c8('0x35')]=_[_0xb0c8('0x34')](_0x2b5a05['model'],qs[_0xb0c8('0x36')](_0x9c4832[_0xb0c8('0x31')][_0xb0c8('0x36')]));_0xc884b4['attributes']=_0xc884b4[_0xb0c8('0x35')]['length']?_0xc884b4['attributes']:_0x2b5a05['model'];if(!_0x9c4832[_0xb0c8('0x31')][_0xb0c8('0x37')](_0xb0c8('0x38'))){_0xc884b4[_0xb0c8('0x1d')]=qs[_0xb0c8('0x1d')](_0x9c4832[_0xb0c8('0x31')][_0xb0c8('0x1d')]);_0xc884b4[_0xb0c8('0x1b')]=qs[_0xb0c8('0x1b')](_0x9c4832[_0xb0c8('0x31')]['offset']);}_0xc884b4['order']=qs[_0xb0c8('0x39')](_0x9c4832[_0xb0c8('0x31')][_0xb0c8('0x39')]);_0xc884b4[_0xb0c8('0x3a')]=qs[_0xb0c8('0x33')](_[_0xb0c8('0x3b')](_0x9c4832[_0xb0c8('0x31')],_0x2b5a05[_0xb0c8('0x33')]),_0x39beae);if(_0x9c4832[_0xb0c8('0x31')][_0xb0c8('0x3c')]){_0xc884b4[_0xb0c8('0x3a')]=_[_0xb0c8('0x3d')](_0xc884b4[_0xb0c8('0x3a')],{'$or':_[_0xb0c8('0x2b')](_0x39beae,function(_0x4b2388){if(_0x4b2388[_0xb0c8('0x2e')]!==_0xb0c8('0x3e')){var _0x29db74={};_0x29db74[_0x4b2388[_0xb0c8('0x28')]]={'$like':'%'+_0x9c4832[_0xb0c8('0x31')][_0xb0c8('0x3c')]+'%'};return _0x29db74;}})});}_0xc884b4=_[_0xb0c8('0x3d')]({},_0xc884b4,_0x9c4832[_0xb0c8('0x3f')]);var _0x1c44ed={'where':_0xc884b4['where']};return db['FreshsalesConfiguration'][_0xb0c8('0x1e')](_0x1c44ed)[_0xb0c8('0x25')](function(_0x4016ca){_0x445357[_0xb0c8('0x1e')]=_0x4016ca;if(_0x9c4832['query'][_0xb0c8('0x40')]){_0xc884b4[_0xb0c8('0x41')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xb0c8('0x42')](_0xc884b4);})[_0xb0c8('0x25')](function(_0x35e807){_0x445357[_0xb0c8('0x43')]=_0x35e807;return _0x445357;})[_0xb0c8('0x25')](respondWithFilteredResult(_0x2ec27f,_0xc884b4))[_0xb0c8('0x44')](handleError(_0x2ec27f,null));};exports[_0xb0c8('0x45')]=function(_0x2b16b2,_0x221e08){var _0x45591f={'raw':![],'where':{'id':_0x2b16b2['params']['id']}},_0x2a0779={};_0x2a0779[_0xb0c8('0x30')]=_['keys'](db[_0xb0c8('0x46')][_0xb0c8('0x2c')]);_0x2a0779[_0xb0c8('0x31')]=_[_0xb0c8('0x32')](_0x2b16b2[_0xb0c8('0x31')]);_0x2a0779[_0xb0c8('0x33')]=_[_0xb0c8('0x34')](_0x2a0779['model'],_0x2a0779[_0xb0c8('0x31')]);_0x45591f[_0xb0c8('0x35')]=_[_0xb0c8('0x34')](_0x2a0779['model'],qs['fields'](_0x2b16b2[_0xb0c8('0x31')][_0xb0c8('0x36')]));_0x45591f['attributes']=_0x45591f[_0xb0c8('0x35')][_0xb0c8('0x47')]?_0x45591f[_0xb0c8('0x35')]:_0x2a0779['model'];if(_0x2b16b2[_0xb0c8('0x31')][_0xb0c8('0x40')]){_0x45591f[_0xb0c8('0x41')]=[{'all':!![]}];}_0x45591f=_[_0xb0c8('0x3d')]({},_0x45591f,_0x2b16b2[_0xb0c8('0x3f')]);return db[_0xb0c8('0x46')][_0xb0c8('0x48')](_0x45591f)['then'](handleEntityNotFound(_0x221e08,null))[_0xb0c8('0x25')](respondWithResult(_0x221e08,null))['catch'](handleError(_0x221e08,null));};exports['create']=function(_0xc777c9,_0x1cf0c2){return db[_0xb0c8('0x46')][_0xb0c8('0x49')](_0xc777c9[_0xb0c8('0x4a')],{})[_0xb0c8('0x25')](respondWithResult(_0x1cf0c2,0xc9))[_0xb0c8('0x44')](handleError(_0x1cf0c2,null));};exports['update']=function(_0x40cc8f,_0x4ddd7){if(_0x40cc8f['body']['id']){delete _0x40cc8f[_0xb0c8('0x4a')]['id'];}return db[_0xb0c8('0x46')]['find']({'where':{'id':_0x40cc8f[_0xb0c8('0x4b')]['id']}})[_0xb0c8('0x25')](handleEntityNotFound(_0x4ddd7,null))[_0xb0c8('0x25')](saveUpdates(_0x40cc8f['body'],null))['then'](respondWithResult(_0x4ddd7,null))[_0xb0c8('0x44')](handleError(_0x4ddd7,null));};exports[_0xb0c8('0x4c')]=function(_0x3952da,_0x2d201f){return db['FreshsalesConfiguration'][_0xb0c8('0x48')]({'where':{'id':_0x3952da[_0xb0c8('0x4b')]['id']}})[_0xb0c8('0x25')](handleEntityNotFound(_0x2d201f,null))[_0xb0c8('0x25')](removeEntity(_0x2d201f,null))[_0xb0c8('0x44')](handleError(_0x2d201f,null));};exports[_0xb0c8('0x4d')]=function(_0x265951,_0xd46e0,_0x592222){var _0x5c4c03={};var _0x56ef46={};var _0x404ac2;var _0x57493c;return db[_0xb0c8('0x46')][_0xb0c8('0x4e')]({'where':{'id':_0x265951[_0xb0c8('0x4b')]['id']}})[_0xb0c8('0x25')](handleEntityNotFound(_0xd46e0,null))[_0xb0c8('0x25')](function(_0x2f4fa0){if(_0x2f4fa0){_0x404ac2=_0x2f4fa0;_0x56ef46[_0xb0c8('0x30')]=_['keys'](db[_0xb0c8('0x4f')]['rawAttributes']);_0x56ef46[_0xb0c8('0x31')]=_[_0xb0c8('0x32')](_0x265951[_0xb0c8('0x31')]);_0x56ef46[_0xb0c8('0x33')]=_['intersection'](_0x56ef46[_0xb0c8('0x30')],_0x56ef46[_0xb0c8('0x31')]);_0x5c4c03[_0xb0c8('0x35')]=_[_0xb0c8('0x34')](_0x56ef46[_0xb0c8('0x30')],qs[_0xb0c8('0x36')](_0x265951[_0xb0c8('0x31')][_0xb0c8('0x36')]));_0x5c4c03['attributes']=_0x5c4c03[_0xb0c8('0x35')][_0xb0c8('0x47')]?_0x5c4c03[_0xb0c8('0x35')]:_0x56ef46['model'];_0x5c4c03[_0xb0c8('0x50')]=qs[_0xb0c8('0x39')](_0x265951[_0xb0c8('0x31')][_0xb0c8('0x39')]);_0x5c4c03[_0xb0c8('0x3a')]=qs[_0xb0c8('0x33')](_[_0xb0c8('0x3b')](_0x265951[_0xb0c8('0x31')],_0x56ef46['filters']));if(_0x265951[_0xb0c8('0x31')]['filter']){_0x5c4c03[_0xb0c8('0x3a')]=_[_0xb0c8('0x3d')](_0x5c4c03[_0xb0c8('0x3a')],{'$or':_[_0xb0c8('0x2b')](_0x5c4c03[_0xb0c8('0x35')],function(_0x4923af){var _0x1a2069={};_0x1a2069[_0x4923af]={'$like':'%'+_0x265951[_0xb0c8('0x31')][_0xb0c8('0x3c')]+'%'};return _0x1a2069;})});}_0x5c4c03=_[_0xb0c8('0x3d')]({},_0x5c4c03,_0x265951[_0xb0c8('0x3f')]);return _0x404ac2[_0xb0c8('0x4d')](_0x5c4c03);}})[_0xb0c8('0x25')](function(_0x34c30c){if(_0x34c30c){_0x57493c=_0x34c30c['length'];if(!_0x265951['query']['hasOwnProperty'](_0xb0c8('0x38'))){_0x5c4c03[_0xb0c8('0x1d')]=qs['limit'](_0x265951[_0xb0c8('0x31')][_0xb0c8('0x1d')]);_0x5c4c03[_0xb0c8('0x1b')]=qs[_0xb0c8('0x1b')](_0x265951[_0xb0c8('0x31')][_0xb0c8('0x1b')]);}return _0x404ac2[_0xb0c8('0x4d')](_0x5c4c03);}})[_0xb0c8('0x25')](function(_0x36477b){if(_0x36477b){return _0x36477b?{'count':_0x57493c,'rows':_0x36477b}:null;}})[_0xb0c8('0x25')](respondWithResult(_0xd46e0,null))[_0xb0c8('0x44')](handleError(_0xd46e0,null));};exports[_0xb0c8('0x51')]=function(_0x7c06d4,_0x19fdf2,_0x146b6b){var _0x13d595={};var _0x53b0d1={};var _0x1bfad7;var _0x39662f;return db[_0xb0c8('0x46')][_0xb0c8('0x4e')]({'where':{'id':_0x7c06d4[_0xb0c8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19fdf2,null))['then'](function(_0x48b2db){if(_0x48b2db){_0x1bfad7=_0x48b2db;_0x53b0d1[_0xb0c8('0x30')]=_[_0xb0c8('0x32')](db[_0xb0c8('0x4f')][_0xb0c8('0x2c')]);_0x53b0d1['query']=_[_0xb0c8('0x32')](_0x7c06d4[_0xb0c8('0x31')]);_0x53b0d1[_0xb0c8('0x33')]=_['intersection'](_0x53b0d1[_0xb0c8('0x30')],_0x53b0d1[_0xb0c8('0x31')]);_0x13d595[_0xb0c8('0x35')]=_[_0xb0c8('0x34')](_0x53b0d1[_0xb0c8('0x30')],qs[_0xb0c8('0x36')](_0x7c06d4[_0xb0c8('0x31')]['fields']));_0x13d595[_0xb0c8('0x35')]=_0x13d595['attributes'][_0xb0c8('0x47')]?_0x13d595[_0xb0c8('0x35')]:_0x53b0d1[_0xb0c8('0x30')];_0x13d595[_0xb0c8('0x50')]=qs['sort'](_0x7c06d4[_0xb0c8('0x31')][_0xb0c8('0x39')]);_0x13d595[_0xb0c8('0x3a')]=qs['filters'](_[_0xb0c8('0x3b')](_0x7c06d4['query'],_0x53b0d1['filters']));if(_0x7c06d4['query'][_0xb0c8('0x3c')]){_0x13d595[_0xb0c8('0x3a')]=_['merge'](_0x13d595[_0xb0c8('0x3a')],{'$or':_['map'](_0x13d595[_0xb0c8('0x35')],function(_0x2fbef0){var _0x30a040={};_0x30a040[_0x2fbef0]={'$like':'%'+_0x7c06d4[_0xb0c8('0x31')]['filter']+'%'};return _0x30a040;})});}_0x13d595=_[_0xb0c8('0x3d')]({},_0x13d595,_0x7c06d4[_0xb0c8('0x3f')]);return _0x1bfad7[_0xb0c8('0x51')](_0x13d595);}})['then'](function(_0x278308){if(_0x278308){_0x39662f=_0x278308[_0xb0c8('0x47')];if(!_0x7c06d4['query'][_0xb0c8('0x37')](_0xb0c8('0x38'))){_0x13d595[_0xb0c8('0x1d')]=qs[_0xb0c8('0x1d')](_0x7c06d4[_0xb0c8('0x31')][_0xb0c8('0x1d')]);_0x13d595[_0xb0c8('0x1b')]=qs['offset'](_0x7c06d4[_0xb0c8('0x31')][_0xb0c8('0x1b')]);}return _0x1bfad7[_0xb0c8('0x51')](_0x13d595);}})[_0xb0c8('0x25')](function(_0x3f948e){if(_0x3f948e){return _0x3f948e?{'count':_0x39662f,'rows':_0x3f948e}:null;}})[_0xb0c8('0x25')](respondWithResult(_0x19fdf2,null))[_0xb0c8('0x44')](handleError(_0x19fdf2,null));};exports['getFields']=function(_0xaa0f08,_0x3ab97c,_0x37bb7d){var _0x42b35c={};var _0x28e7d6={};var _0x54ebab;var _0x58f6a0;return db[_0xb0c8('0x46')][_0xb0c8('0x4e')]({'where':{'id':_0xaa0f08[_0xb0c8('0x4b')]['id']}})[_0xb0c8('0x25')](handleEntityNotFound(_0x3ab97c,null))['then'](function(_0x2adb97){if(_0x2adb97){_0x54ebab=_0x2adb97;_0x28e7d6['model']=_[_0xb0c8('0x32')](db[_0xb0c8('0x4f')]['rawAttributes']);_0x28e7d6[_0xb0c8('0x31')]=_['keys'](_0xaa0f08[_0xb0c8('0x31')]);_0x28e7d6[_0xb0c8('0x33')]=_[_0xb0c8('0x34')](_0x28e7d6[_0xb0c8('0x30')],_0x28e7d6[_0xb0c8('0x31')]);_0x42b35c[_0xb0c8('0x35')]=_[_0xb0c8('0x34')](_0x28e7d6[_0xb0c8('0x30')],qs[_0xb0c8('0x36')](_0xaa0f08[_0xb0c8('0x31')]['fields']));_0x42b35c[_0xb0c8('0x35')]=_0x42b35c[_0xb0c8('0x35')]['length']?_0x42b35c[_0xb0c8('0x35')]:_0x28e7d6['model'];_0x42b35c[_0xb0c8('0x50')]=qs[_0xb0c8('0x39')](_0xaa0f08[_0xb0c8('0x31')][_0xb0c8('0x39')]);_0x42b35c[_0xb0c8('0x3a')]=qs[_0xb0c8('0x33')](_[_0xb0c8('0x3b')](_0xaa0f08[_0xb0c8('0x31')],_0x28e7d6[_0xb0c8('0x33')]));if(_0xaa0f08[_0xb0c8('0x31')]['filter']){_0x42b35c[_0xb0c8('0x3a')]=_[_0xb0c8('0x3d')](_0x42b35c[_0xb0c8('0x3a')],{'$or':_['map'](_0x42b35c[_0xb0c8('0x35')],function(_0x20dfa4){var _0x5ab5c1={};_0x5ab5c1[_0x20dfa4]={'$like':'%'+_0xaa0f08['query']['filter']+'%'};return _0x5ab5c1;})});}_0x42b35c=_[_0xb0c8('0x3d')]({},_0x42b35c,_0xaa0f08[_0xb0c8('0x3f')]);return _0x54ebab[_0xb0c8('0x52')](_0x42b35c);}})[_0xb0c8('0x25')](function(_0x5b0b51){if(_0x5b0b51){_0x58f6a0=_0x5b0b51[_0xb0c8('0x47')];if(!_0xaa0f08[_0xb0c8('0x31')][_0xb0c8('0x37')](_0xb0c8('0x38'))){_0x42b35c[_0xb0c8('0x1d')]=qs[_0xb0c8('0x1d')](_0xaa0f08[_0xb0c8('0x31')][_0xb0c8('0x1d')]);_0x42b35c[_0xb0c8('0x1b')]=qs[_0xb0c8('0x1b')](_0xaa0f08[_0xb0c8('0x31')][_0xb0c8('0x1b')]);}return _0x54ebab[_0xb0c8('0x52')](_0x42b35c);}})['then'](function(_0x434012){if(_0x434012){return _0x434012?{'count':_0x58f6a0,'rows':_0x434012}:null;}})[_0xb0c8('0x25')](respondWithResult(_0x3ab97c,null))[_0xb0c8('0x44')](handleError(_0x3ab97c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4c6d51b..742debf 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 _0x6050=['request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','lodash','util','../../config/logger','moment'];(function(_0x172079,_0x44ffd1){var _0x348ba5=function(_0x3298af){while(--_0x3298af){_0x172079['push'](_0x172079['shift']());}};_0x348ba5(++_0x44ffd1);}(_0x6050,0x92));var _0x0605=function(_0x20b0fb,_0x1a5ae0){_0x20b0fb=_0x20b0fb-0x0;var _0x1e86eb=_0x6050[_0x20b0fb];return _0x1e86eb;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))('api');var moment=require(_0x0605('0x3'));var BPromise=require('bluebird');var rp=require(_0x0605('0x4'));var fs=require('fs');var path=require(_0x0605('0x5'));var rimraf=require('rimraf');var config=require(_0x0605('0x6'));var attributes=require(_0x0605('0x7'));module[_0x0605('0x8')]=function(_0x486b86,_0x4217fe){return _0x486b86['define'](_0x0605('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9318=['define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9318,0x10a));var _0x8931=function(_0x317cc5,_0x3b6179){_0x317cc5=_0x317cc5-0x0;var _0x44fe81=_0x9318[_0x317cc5];return _0x44fe81;};'use strict';var _=require(_0x8931('0x0'));var util=require(_0x8931('0x1'));var logger=require(_0x8931('0x2'))(_0x8931('0x3'));var moment=require(_0x8931('0x4'));var BPromise=require(_0x8931('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8931('0x6'));var rimraf=require(_0x8931('0x7'));var config=require(_0x8931('0x8'));var attributes=require(_0x8931('0x9'));module['exports']=function(_0x3967f3,_0x3c89d9){return _0x3967f3[_0x8931('0xa')](_0x8931('0xb'),attributes,{'tableName':'int_freshsales_configurations','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 a652167..fd46cc7 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 _0xb0db=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info'];(function(_0x38e558,_0x2937e9){var _0x2b1048=function(_0x5f23cd){while(--_0x5f23cd){_0x38e558['push'](_0x38e558['shift']());}};_0x2b1048(++_0x2937e9);}(_0xb0db,0x130));var _0xbb0d=function(_0x69728d,_0x1c6516){_0x69728d=_0x69728d-0x0;var _0xb4d43d=_0xb0db[_0x69728d];return _0xb4d43d;};'use strict';var _=require(_0xbb0d('0x0'));var util=require(_0xbb0d('0x1'));var moment=require('moment');var BPromise=require(_0xbb0d('0x2'));var rs=require(_0xbb0d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbb0d('0x4'));var logger=require(_0xbb0d('0x5'))(_0xbb0d('0x6'));var config=require(_0xbb0d('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x341c8e,_0xdb45ed,_0x30da44){return new BPromise(function(_0x72d8df,_0x125472){return client[_0xbb0d('0x8')](_0x341c8e,_0x30da44)[_0xbb0d('0x9')](function(_0x2793eb){logger[_0xbb0d('0xa')](_0xbb0d('0xb'),_0xdb45ed,_0xbb0d('0xc'));logger[_0xbb0d('0xd')](_0xbb0d('0xe'),_0xdb45ed,'request\x20sent',JSON[_0xbb0d('0xf')](_0x2793eb));if(_0x2793eb['error']){if(_0x2793eb[_0xbb0d('0x10')][_0xbb0d('0x11')]===0x1f4){logger[_0xbb0d('0x10')](_0xbb0d('0xb'),_0xdb45ed,_0x2793eb[_0xbb0d('0x10')][_0xbb0d('0x12')]);return _0x125472(_0x2793eb[_0xbb0d('0x10')]['message']);}logger[_0xbb0d('0x10')](_0xbb0d('0xb'),_0xdb45ed,_0x2793eb['error'][_0xbb0d('0x12')]);return _0x72d8df(_0x2793eb[_0xbb0d('0x10')][_0xbb0d('0x12')]);}else{logger[_0xbb0d('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xdb45ed,_0xbb0d('0xc'));_0x72d8df(_0x2793eb[_0xbb0d('0x13')][_0xbb0d('0x12')]);}})[_0xbb0d('0x14')](function(_0x1cd6bf){logger[_0xbb0d('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xdb45ed,_0x1cd6bf);_0x125472(_0x1cd6bf);});});} \ No newline at end of file +var _0x57ed=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x9aeecc,_0x1b9c0d){var _0x551061=function(_0x7a72f7){while(--_0x7a72f7){_0x9aeecc['push'](_0x9aeecc['shift']());}};_0x551061(++_0x1b9c0d);}(_0x57ed,0x1a4));var _0xd57e=function(_0x3c31f9,_0x5914f1){_0x3c31f9=_0x3c31f9-0x0;var _0x45b251=_0x57ed[_0x3c31f9];return _0x45b251;};'use strict';var _=require(_0xd57e('0x0'));var util=require('util');var moment=require(_0xd57e('0x1'));var BPromise=require(_0xd57e('0x2'));var rs=require(_0xd57e('0x3'));var fs=require('fs');var Redis=require(_0xd57e('0x4'));var db=require(_0xd57e('0x5'))['db'];var utils=require(_0xd57e('0x6'));var logger=require(_0xd57e('0x7'))('rpc');var config=require(_0xd57e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd57e('0x9')][_0xd57e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1621cc,_0x164e8d,_0x298647){return new BPromise(function(_0x3928c0,_0x2835cb){return client['request'](_0x1621cc,_0x298647)[_0xd57e('0xb')](function(_0x1d48bd){logger[_0xd57e('0xc')](_0xd57e('0xd'),_0x164e8d,_0xd57e('0xe'));logger[_0xd57e('0xf')](_0xd57e('0x10'),_0x164e8d,_0xd57e('0xe'),JSON[_0xd57e('0x11')](_0x1d48bd));if(_0x1d48bd[_0xd57e('0x12')]){if(_0x1d48bd[_0xd57e('0x12')]['code']===0x1f4){logger[_0xd57e('0x12')](_0xd57e('0xd'),_0x164e8d,_0x1d48bd[_0xd57e('0x12')][_0xd57e('0x13')]);return _0x2835cb(_0x1d48bd[_0xd57e('0x12')][_0xd57e('0x13')]);}logger[_0xd57e('0x12')](_0xd57e('0xd'),_0x164e8d,_0x1d48bd[_0xd57e('0x12')][_0xd57e('0x13')]);return _0x3928c0(_0x1d48bd['error'][_0xd57e('0x13')]);}else{logger[_0xd57e('0xc')](_0xd57e('0xd'),_0x164e8d,'request\x20sent');_0x3928c0(_0x1d48bd[_0xd57e('0x14')][_0xd57e('0x13')]);}})[_0xd57e('0x15')](function(_0x333a1c){logger[_0xd57e('0x12')](_0xd57e('0xd'),_0x164e8d,_0x333a1c);_0x2835cb(_0x333a1c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 67335b7..3a43f14 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 _0xc68d=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','show','post','put','/:id','update','destroy','exports'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0xc68d,0x17a));var _0xdc68=function(_0x438ea9,_0x347c77){_0x438ea9=_0x438ea9-0x0;var _0x2493fb=_0xc68d[_0x438ea9];return _0x2493fb;};'use strict';var multer=require('multer');var util=require(_0xdc68('0x0'));var path=require(_0xdc68('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdc68('0x2')]();var fs_extra=require(_0xdc68('0x3'));var auth=require(_0xdc68('0x4'));var interaction=require(_0xdc68('0x5'));var config=require(_0xdc68('0x6'));var controller=require(_0xdc68('0x7'));router['get']('/',auth[_0xdc68('0x8')](),controller[_0xdc68('0x9')]);router[_0xdc68('0xa')]('/:id',auth[_0xdc68('0x8')](),controller[_0xdc68('0xb')]);router[_0xdc68('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdc68('0xd')](_0xdc68('0xe'),auth[_0xdc68('0x8')](),controller[_0xdc68('0xf')]);router['delete'](_0xdc68('0xe'),auth[_0xdc68('0x8')](),controller[_0xdc68('0x10')]);module[_0xdc68('0x11')]=router; \ No newline at end of file +var _0x0c6d=['index','get','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated'];(function(_0x4a4743,_0x48fb20){var _0x547c20=function(_0x22db4d){while(--_0x22db4d){_0x4a4743['push'](_0x4a4743['shift']());}};_0x547c20(++_0x48fb20);}(_0x0c6d,0xf7));var _0xd0c6=function(_0xd6a4a6,_0x45fcd3){_0xd6a4a6=_0xd6a4a6-0x0;var _0x4d6605=_0x0c6d[_0xd6a4a6];return _0x4d6605;};'use strict';var multer=require('multer');var util=require(_0xd0c6('0x0'));var path=require(_0xd0c6('0x1'));var timeout=require(_0xd0c6('0x2'));var express=require(_0xd0c6('0x3'));var router=express[_0xd0c6('0x4')]();var fs_extra=require(_0xd0c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0c6('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xd0c6('0x7')](),controller[_0xd0c6('0x8')]);router[_0xd0c6('0x9')]('/:id',auth[_0xd0c6('0x7')](),controller['show']);router[_0xd0c6('0xa')]('/',auth[_0xd0c6('0x7')](),controller[_0xd0c6('0xb')]);router[_0xd0c6('0xc')](_0xd0c6('0xd'),auth[_0xd0c6('0x7')](),controller[_0xd0c6('0xe')]);router[_0xd0c6('0xf')](_0xd0c6('0xd'),auth['isAuthenticated'](),controller[_0xd0c6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index d39e84c..a702ff4 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 _0x3a40=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x287475,_0x390e94){var _0xf020e2=function(_0x475a0e){while(--_0x475a0e){_0x287475['push'](_0x287475['shift']());}};_0xf020e2(++_0x390e94);}(_0x3a40,0x72));var _0x03a4=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x3a40[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0x03a4('0x0'));module[_0x03a4('0x1')]={'type':{'type':Sequelize[_0x03a4('0x2')](_0x03a4('0x3'),_0x03a4('0x4'),'customVariable',_0x03a4('0x5'),_0x03a4('0x6')),'defaultValue':_0x03a4('0x3')},'content':{'type':Sequelize[_0x03a4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x03a4('0x2')](_0x03a4('0x3'),_0x03a4('0x4'),_0x03a4('0x8'))},'keyContent':{'type':Sequelize[_0x03a4('0x7')]},'idField':{'type':Sequelize[_0x03a4('0x7')]},'nameField':{'type':Sequelize[_0x03a4('0x7')]},'customField':{'type':Sequelize[_0x03a4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x87c2=['exports','ENUM','variable','customVariable','picklist','string','STRING','sequelize'];(function(_0x137314,_0x3e7e37){var _0x2847d0=function(_0x13e670){while(--_0x13e670){_0x137314['push'](_0x137314['shift']());}};_0x2847d0(++_0x3e7e37);}(_0x87c2,0xd7));var _0x287c=function(_0xf9e7f6,_0x3687b4){_0xf9e7f6=_0xf9e7f6-0x0;var _0xe6f6c=_0x87c2[_0xf9e7f6];return _0xe6f6c;};'use strict';var Sequelize=require(_0x287c('0x0'));module[_0x287c('0x1')]={'type':{'type':Sequelize[_0x287c('0x2')]('string',_0x287c('0x3'),_0x287c('0x4'),'keyValue',_0x287c('0x5')),'defaultValue':_0x287c('0x6')},'content':{'type':Sequelize[_0x287c('0x7')]},'key':{'type':Sequelize[_0x287c('0x7')]},'keyType':{'type':Sequelize[_0x287c('0x2')](_0x287c('0x6'),_0x287c('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x287c('0x7')]},'nameField':{'type':Sequelize[_0x287c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x287c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index b7c772d..c54d2aa 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 _0x4b04=['intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','merge','find','catch','create','body','eml-format','rimraf','zip-dir','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','set','Content-Range','reject','save','update','then','end','error','stack','name','map','FreshsalesField','rawAttributes','fieldName','key','model','query','filters'];(function(_0x42beee,_0x2b1a9a){var _0x4811a3=function(_0x4e3d36){while(--_0x4e3d36){_0x42beee['push'](_0x42beee['shift']());}};_0x4811a3(++_0x2b1a9a);}(_0x4b04,0x17c));var _0x44b0=function(_0x74c04f,_0x48a73a){_0x74c04f=_0x74c04f-0x0;var _0x276c31=_0x4b04[_0x74c04f];return _0x276c31;};'use strict';var emlformat=require(_0x44b0('0x0'));var rimraf=require(_0x44b0('0x1'));var zipdir=require(_0x44b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b0('0x3'));var util=require('util');var path=require('path');var sox=require(_0x44b0('0x4'));var csv=require(_0x44b0('0x5'));var ejs=require(_0x44b0('0x6'));var fs=require('fs');var fs_extra=require(_0x44b0('0x7'));var _=require('lodash');var squel=require(_0x44b0('0x8'));var crypto=require(_0x44b0('0x9'));var jsforce=require(_0x44b0('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b0('0xb'));var Papa=require(_0x44b0('0xc'));var Redis=require(_0x44b0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x44b0('0xe'));var as=require(_0x44b0('0xf'));var hardwareService=require(_0x44b0('0x10'));var logger=require(_0x44b0('0x11'))(_0x44b0('0x12'));var utils=require(_0x44b0('0x13'));var config=require(_0x44b0('0x14'));var licenseUtil=require(_0x44b0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31f68a,_0x3bc753){_0x3bc753=_0x3bc753||0xcc;return function(_0x22e7e3){if(_0x22e7e3){return _0x31f68a[_0x44b0('0x16')](_0x3bc753);}return _0x31f68a[_0x44b0('0x17')](_0x3bc753)['end']();};}function respondWithResult(_0x41c2c9,_0x34ad18){_0x34ad18=_0x34ad18||0xc8;return function(_0x17e965){if(_0x17e965){return _0x41c2c9['status'](_0x34ad18)[_0x44b0('0x18')](_0x17e965);}};}function respondWithFilteredResult(_0x29c5d9,_0x3d1d4c){return function(_0x4e47ce){if(_0x4e47ce){var _0x3f2dc4=typeof _0x3d1d4c['offset']==='undefined'&&typeof _0x3d1d4c[_0x44b0('0x19')]===_0x44b0('0x1a');var _0x2ecb1d=_0x4e47ce[_0x44b0('0x1b')];var _0x53ab4a=_0x3f2dc4?0x0:_0x3d1d4c['offset'];var _0x223f47=_0x3f2dc4?_0x4e47ce['count']:_0x3d1d4c['offset']+_0x3d1d4c[_0x44b0('0x19')];var _0x41a7bf;if(_0x223f47>=_0x2ecb1d){_0x223f47=_0x2ecb1d;_0x41a7bf=0xc8;}else{_0x41a7bf=0xce;}_0x29c5d9[_0x44b0('0x17')](_0x41a7bf);return _0x29c5d9[_0x44b0('0x1c')](_0x44b0('0x1d'),_0x53ab4a+'-'+_0x223f47+'/'+_0x2ecb1d)[_0x44b0('0x18')](_0x4e47ce);}return null;};}function patchUpdates(_0x2b35ed){return function(_0x3b6c15){try{jsonpatch['apply'](_0x3b6c15,_0x2b35ed,!![]);}catch(_0x93d954){return BPromise[_0x44b0('0x1e')](_0x93d954);}return _0x3b6c15[_0x44b0('0x1f')]();};}function saveUpdates(_0x70d1a,_0x2b0125){return function(_0x4d8943){if(_0x4d8943){return _0x4d8943[_0x44b0('0x20')](_0x70d1a)[_0x44b0('0x21')](function(_0x15be93){return _0x15be93;});}return null;};}function removeEntity(_0x5244e1,_0x13448f){return function(_0x2602c8){if(_0x2602c8){return _0x2602c8['destroy']()[_0x44b0('0x21')](function(){_0x5244e1[_0x44b0('0x17')](0xcc)[_0x44b0('0x22')]();});}};}function handleEntityNotFound(_0x591203,_0xa44b12){return function(_0x4d3a8e){if(!_0x4d3a8e){_0x591203[_0x44b0('0x16')](0x194);}return _0x4d3a8e;};}function handleError(_0x418aec,_0x4dbcea){_0x4dbcea=_0x4dbcea||0x1f4;return function(_0x52ae6b){logger[_0x44b0('0x23')](_0x52ae6b[_0x44b0('0x24')]);if(_0x52ae6b[_0x44b0('0x25')]){delete _0x52ae6b[_0x44b0('0x25')];}_0x418aec[_0x44b0('0x17')](_0x4dbcea)['send'](_0x52ae6b);};}exports['index']=function(_0x160f7a,_0x5872e3){var _0x571ed6={},_0x59733a={},_0x467106={'count':0x0,'rows':[]};var _0x187eee=_[_0x44b0('0x26')](db[_0x44b0('0x27')][_0x44b0('0x28')],function(_0x6bf30c){return{'name':_0x6bf30c[_0x44b0('0x29')],'type':_0x6bf30c['type'][_0x44b0('0x2a')]};});_0x59733a[_0x44b0('0x2b')]=_[_0x44b0('0x26')](_0x187eee,_0x44b0('0x25'));_0x59733a['query']=_['keys'](_0x160f7a[_0x44b0('0x2c')]);_0x59733a[_0x44b0('0x2d')]=_[_0x44b0('0x2e')](_0x59733a[_0x44b0('0x2b')],_0x59733a[_0x44b0('0x2c')]);_0x571ed6['attributes']=_[_0x44b0('0x2e')](_0x59733a[_0x44b0('0x2b')],qs[_0x44b0('0x2f')](_0x160f7a[_0x44b0('0x2c')][_0x44b0('0x2f')]));_0x571ed6[_0x44b0('0x30')]=_0x571ed6[_0x44b0('0x30')][_0x44b0('0x31')]?_0x571ed6[_0x44b0('0x30')]:_0x59733a['model'];if(!_0x160f7a[_0x44b0('0x2c')][_0x44b0('0x32')](_0x44b0('0x33'))){_0x571ed6[_0x44b0('0x19')]=qs[_0x44b0('0x19')](_0x160f7a['query'][_0x44b0('0x19')]);_0x571ed6[_0x44b0('0x34')]=qs[_0x44b0('0x34')](_0x160f7a['query'][_0x44b0('0x34')]);}_0x571ed6[_0x44b0('0x35')]=qs['sort'](_0x160f7a[_0x44b0('0x2c')]['sort']);_0x571ed6[_0x44b0('0x36')]=qs['filters'](_[_0x44b0('0x37')](_0x160f7a[_0x44b0('0x2c')],_0x59733a[_0x44b0('0x2d')]),_0x187eee);if(_0x160f7a[_0x44b0('0x2c')][_0x44b0('0x38')]){_0x571ed6[_0x44b0('0x36')]=_['merge'](_0x571ed6[_0x44b0('0x36')],{'$or':_['map'](_0x187eee,function(_0x2a6a3c){if(_0x2a6a3c['type']!==_0x44b0('0x39')){var _0x320d46={};_0x320d46[_0x2a6a3c['name']]={'$like':'%'+_0x160f7a[_0x44b0('0x2c')][_0x44b0('0x38')]+'%'};return _0x320d46;}})});}_0x571ed6=_['merge']({},_0x571ed6,_0x160f7a[_0x44b0('0x3a')]);var _0x2697db={'where':_0x571ed6[_0x44b0('0x36')]};return db[_0x44b0('0x27')][_0x44b0('0x1b')](_0x2697db)[_0x44b0('0x21')](function(_0x29eb28){_0x467106[_0x44b0('0x1b')]=_0x29eb28;if(_0x160f7a[_0x44b0('0x2c')][_0x44b0('0x3b')]){_0x571ed6[_0x44b0('0x3c')]=[{'all':!![]}];}return db[_0x44b0('0x27')][_0x44b0('0x3d')](_0x571ed6);})[_0x44b0('0x21')](function(_0x7dc7c7){_0x467106[_0x44b0('0x3e')]=_0x7dc7c7;return _0x467106;})[_0x44b0('0x21')](respondWithFilteredResult(_0x5872e3,_0x571ed6))['catch'](handleError(_0x5872e3,null));};exports[_0x44b0('0x3f')]=function(_0x3e26ed,_0x5ba110){var _0x15387a={'raw':!![],'where':{'id':_0x3e26ed[_0x44b0('0x40')]['id']}},_0x163e97={};_0x163e97[_0x44b0('0x2b')]=_[_0x44b0('0x41')](db[_0x44b0('0x27')][_0x44b0('0x28')]);_0x163e97[_0x44b0('0x2c')]=_[_0x44b0('0x41')](_0x3e26ed[_0x44b0('0x2c')]);_0x163e97[_0x44b0('0x2d')]=_[_0x44b0('0x2e')](_0x163e97[_0x44b0('0x2b')],_0x163e97[_0x44b0('0x2c')]);_0x15387a[_0x44b0('0x30')]=_[_0x44b0('0x2e')](_0x163e97['model'],qs[_0x44b0('0x2f')](_0x3e26ed[_0x44b0('0x2c')]['fields']));_0x15387a[_0x44b0('0x30')]=_0x15387a[_0x44b0('0x30')][_0x44b0('0x31')]?_0x15387a[_0x44b0('0x30')]:_0x163e97['model'];if(_0x3e26ed[_0x44b0('0x2c')]['includeAll']){_0x15387a[_0x44b0('0x3c')]=[{'all':!![]}];}_0x15387a=_[_0x44b0('0x42')]({},_0x15387a,_0x3e26ed[_0x44b0('0x3a')]);return db[_0x44b0('0x27')][_0x44b0('0x43')](_0x15387a)[_0x44b0('0x21')](handleEntityNotFound(_0x5ba110,null))[_0x44b0('0x21')](respondWithResult(_0x5ba110,null))[_0x44b0('0x44')](handleError(_0x5ba110,null));};exports[_0x44b0('0x45')]=function(_0x304edc,_0x53866a){return db[_0x44b0('0x27')][_0x44b0('0x45')](_0x304edc[_0x44b0('0x46')],{})[_0x44b0('0x21')](respondWithResult(_0x53866a,0xc9))[_0x44b0('0x44')](handleError(_0x53866a,null));};exports['update']=function(_0x539d15,_0x3e505b){if(_0x539d15[_0x44b0('0x46')]['id']){delete _0x539d15['body']['id'];}return db['FreshsalesField'][_0x44b0('0x43')]({'where':{'id':_0x539d15[_0x44b0('0x40')]['id']}})[_0x44b0('0x21')](handleEntityNotFound(_0x3e505b,null))['then'](saveUpdates(_0x539d15['body'],null))[_0x44b0('0x21')](respondWithResult(_0x3e505b,null))[_0x44b0('0x44')](handleError(_0x3e505b,null));};exports['destroy']=function(_0x21d8bd,_0x1306cb){return db[_0x44b0('0x27')][_0x44b0('0x43')]({'where':{'id':_0x21d8bd[_0x44b0('0x40')]['id']}})[_0x44b0('0x21')](handleEntityNotFound(_0x1306cb,null))[_0x44b0('0x21')](removeEntity(_0x1306cb,null))[_0x44b0('0x44')](handleError(_0x1306cb,null));}; \ No newline at end of file +var _0x6e5d=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs'];(function(_0x5e5bb3,_0xd7b3b0){var _0x3fe176=function(_0x2f0ec1){while(--_0x2f0ec1){_0x5e5bb3['push'](_0x5e5bb3['shift']());}};_0x3fe176(++_0xd7b3b0);}(_0x6e5d,0x11f));var _0xd6e5=function(_0x3df21c,_0x4092b6){_0x3df21c=_0x3df21c-0x0;var _0x5b48d3=_0x6e5d[_0x3df21c];return _0x5b48d3;};'use strict';var emlformat=require(_0xd6e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd6e5('0x1'));var jsonpatch=require(_0xd6e5('0x2'));var rp=require(_0xd6e5('0x3'));var moment=require(_0xd6e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6e5('0x5'));var util=require('util');var path=require(_0xd6e5('0x6'));var sox=require(_0xd6e5('0x7'));var csv=require('to-csv');var ejs=require(_0xd6e5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6e5('0x9'));var squel=require('squel');var crypto=require(_0xd6e5('0xa'));var jsforce=require(_0xd6e5('0xb'));var deskjs=require(_0xd6e5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd6e5('0xd'));var Papa=require(_0xd6e5('0xe'));var Redis=require(_0xd6e5('0xf'));var authService=require(_0xd6e5('0x10'));var qs=require(_0xd6e5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6e5('0x12'));var logger=require(_0xd6e5('0x13'))(_0xd6e5('0x14'));var utils=require('../../config/utils');var config=require(_0xd6e5('0x15'));var licenseUtil=require(_0xd6e5('0x16'));var db=require(_0xd6e5('0x17'))['db'];function respondWithStatusCode(_0xe86ec6,_0x534cdb){_0x534cdb=_0x534cdb||0xcc;return function(_0x4a6064){if(_0x4a6064){return _0xe86ec6[_0xd6e5('0x18')](_0x534cdb);}return _0xe86ec6[_0xd6e5('0x19')](_0x534cdb)[_0xd6e5('0x1a')]();};}function respondWithResult(_0x8f30d5,_0x49c39d){_0x49c39d=_0x49c39d||0xc8;return function(_0xf66f){if(_0xf66f){return _0x8f30d5[_0xd6e5('0x19')](_0x49c39d)[_0xd6e5('0x1b')](_0xf66f);}};}function respondWithFilteredResult(_0x596703,_0x4c4c30){return function(_0x1bbf16){if(_0x1bbf16){var _0x23daf2=typeof _0x4c4c30[_0xd6e5('0x1c')]===_0xd6e5('0x1d')&&typeof _0x4c4c30[_0xd6e5('0x1e')]===_0xd6e5('0x1d');var _0x1af868=_0x1bbf16['count'];var _0x1c4bff=_0x23daf2?0x0:_0x4c4c30[_0xd6e5('0x1c')];var _0x4ef8fc=_0x23daf2?_0x1bbf16[_0xd6e5('0x1f')]:_0x4c4c30['offset']+_0x4c4c30['limit'];var _0x398ca7;if(_0x4ef8fc>=_0x1af868){_0x4ef8fc=_0x1af868;_0x398ca7=0xc8;}else{_0x398ca7=0xce;}_0x596703[_0xd6e5('0x19')](_0x398ca7);return _0x596703[_0xd6e5('0x20')]('Content-Range',_0x1c4bff+'-'+_0x4ef8fc+'/'+_0x1af868)['json'](_0x1bbf16);}return null;};}function patchUpdates(_0x5e34db){return function(_0x4d2b36){try{jsonpatch['apply'](_0x4d2b36,_0x5e34db,!![]);}catch(_0x48ab41){return BPromise[_0xd6e5('0x21')](_0x48ab41);}return _0x4d2b36['save']();};}function saveUpdates(_0x4156ae,_0x355986){return function(_0x49d407){if(_0x49d407){return _0x49d407['update'](_0x4156ae)[_0xd6e5('0x22')](function(_0x18c8e4){return _0x18c8e4;});}return null;};}function removeEntity(_0x45fed9,_0x3e1833){return function(_0x4687e7){if(_0x4687e7){return _0x4687e7[_0xd6e5('0x23')]()[_0xd6e5('0x22')](function(){_0x45fed9[_0xd6e5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d06c1,_0x2eefe6){return function(_0x473b66){if(!_0x473b66){_0x9d06c1[_0xd6e5('0x18')](0x194);}return _0x473b66;};}function handleError(_0x5148de,_0x4ccdd2){_0x4ccdd2=_0x4ccdd2||0x1f4;return function(_0x15cc51){logger[_0xd6e5('0x24')](_0x15cc51[_0xd6e5('0x25')]);if(_0x15cc51['name']){delete _0x15cc51[_0xd6e5('0x26')];}_0x5148de['status'](_0x4ccdd2)['send'](_0x15cc51);};}exports[_0xd6e5('0x27')]=function(_0x2b35ca,_0x3d8ad2){var _0x4023c0={},_0x1ab78f={},_0x1e64aa={'count':0x0,'rows':[]};var _0x4cacd8=_[_0xd6e5('0x28')](db[_0xd6e5('0x29')][_0xd6e5('0x2a')],function(_0xe0673c){return{'name':_0xe0673c['fieldName'],'type':_0xe0673c[_0xd6e5('0x2b')][_0xd6e5('0x2c')]};});_0x1ab78f[_0xd6e5('0x2d')]=_[_0xd6e5('0x28')](_0x4cacd8,_0xd6e5('0x26'));_0x1ab78f[_0xd6e5('0x2e')]=_[_0xd6e5('0x2f')](_0x2b35ca[_0xd6e5('0x2e')]);_0x1ab78f[_0xd6e5('0x30')]=_[_0xd6e5('0x31')](_0x1ab78f[_0xd6e5('0x2d')],_0x1ab78f[_0xd6e5('0x2e')]);_0x4023c0['attributes']=_['intersection'](_0x1ab78f[_0xd6e5('0x2d')],qs[_0xd6e5('0x32')](_0x2b35ca['query']['fields']));_0x4023c0[_0xd6e5('0x33')]=_0x4023c0['attributes']['length']?_0x4023c0['attributes']:_0x1ab78f[_0xd6e5('0x2d')];if(!_0x2b35ca[_0xd6e5('0x2e')][_0xd6e5('0x34')](_0xd6e5('0x35'))){_0x4023c0[_0xd6e5('0x1e')]=qs[_0xd6e5('0x1e')](_0x2b35ca[_0xd6e5('0x2e')]['limit']);_0x4023c0[_0xd6e5('0x1c')]=qs['offset'](_0x2b35ca[_0xd6e5('0x2e')][_0xd6e5('0x1c')]);}_0x4023c0[_0xd6e5('0x36')]=qs[_0xd6e5('0x37')](_0x2b35ca[_0xd6e5('0x2e')]['sort']);_0x4023c0['where']=qs[_0xd6e5('0x30')](_[_0xd6e5('0x38')](_0x2b35ca['query'],_0x1ab78f[_0xd6e5('0x30')]),_0x4cacd8);if(_0x2b35ca[_0xd6e5('0x2e')][_0xd6e5('0x39')]){_0x4023c0['where']=_[_0xd6e5('0x3a')](_0x4023c0[_0xd6e5('0x3b')],{'$or':_[_0xd6e5('0x28')](_0x4cacd8,function(_0x403e00){if(_0x403e00[_0xd6e5('0x2b')]!==_0xd6e5('0x3c')){var _0x42234a={};_0x42234a[_0x403e00[_0xd6e5('0x26')]]={'$like':'%'+_0x2b35ca[_0xd6e5('0x2e')][_0xd6e5('0x39')]+'%'};return _0x42234a;}})});}_0x4023c0=_['merge']({},_0x4023c0,_0x2b35ca[_0xd6e5('0x3d')]);var _0x1fc6d5={'where':_0x4023c0[_0xd6e5('0x3b')]};return db[_0xd6e5('0x29')]['count'](_0x1fc6d5)['then'](function(_0x5b3937){_0x1e64aa[_0xd6e5('0x1f')]=_0x5b3937;if(_0x2b35ca['query'][_0xd6e5('0x3e')]){_0x4023c0['include']=[{'all':!![]}];}return db[_0xd6e5('0x29')][_0xd6e5('0x3f')](_0x4023c0);})[_0xd6e5('0x22')](function(_0x374d32){_0x1e64aa[_0xd6e5('0x40')]=_0x374d32;return _0x1e64aa;})[_0xd6e5('0x22')](respondWithFilteredResult(_0x3d8ad2,_0x4023c0))[_0xd6e5('0x41')](handleError(_0x3d8ad2,null));};exports[_0xd6e5('0x42')]=function(_0x12e2db,_0x222034){var _0x37ecad={'raw':!![],'where':{'id':_0x12e2db[_0xd6e5('0x43')]['id']}},_0x1364d7={};_0x1364d7[_0xd6e5('0x2d')]=_[_0xd6e5('0x2f')](db[_0xd6e5('0x29')][_0xd6e5('0x2a')]);_0x1364d7[_0xd6e5('0x2e')]=_[_0xd6e5('0x2f')](_0x12e2db[_0xd6e5('0x2e')]);_0x1364d7[_0xd6e5('0x30')]=_[_0xd6e5('0x31')](_0x1364d7[_0xd6e5('0x2d')],_0x1364d7['query']);_0x37ecad['attributes']=_['intersection'](_0x1364d7[_0xd6e5('0x2d')],qs[_0xd6e5('0x32')](_0x12e2db[_0xd6e5('0x2e')][_0xd6e5('0x32')]));_0x37ecad[_0xd6e5('0x33')]=_0x37ecad[_0xd6e5('0x33')][_0xd6e5('0x44')]?_0x37ecad[_0xd6e5('0x33')]:_0x1364d7[_0xd6e5('0x2d')];if(_0x12e2db[_0xd6e5('0x2e')][_0xd6e5('0x3e')]){_0x37ecad[_0xd6e5('0x45')]=[{'all':!![]}];}_0x37ecad=_['merge']({},_0x37ecad,_0x12e2db['options']);return db[_0xd6e5('0x29')][_0xd6e5('0x46')](_0x37ecad)['then'](handleEntityNotFound(_0x222034,null))[_0xd6e5('0x22')](respondWithResult(_0x222034,null))[_0xd6e5('0x41')](handleError(_0x222034,null));};exports[_0xd6e5('0x47')]=function(_0x48eb28,_0x1d1ccc){return db[_0xd6e5('0x29')][_0xd6e5('0x47')](_0x48eb28[_0xd6e5('0x48')],{})['then'](respondWithResult(_0x1d1ccc,0xc9))[_0xd6e5('0x41')](handleError(_0x1d1ccc,null));};exports[_0xd6e5('0x49')]=function(_0x2da070,_0x4e67bd){if(_0x2da070[_0xd6e5('0x48')]['id']){delete _0x2da070[_0xd6e5('0x48')]['id'];}return db[_0xd6e5('0x29')][_0xd6e5('0x46')]({'where':{'id':_0x2da070[_0xd6e5('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e67bd,null))[_0xd6e5('0x22')](saveUpdates(_0x2da070[_0xd6e5('0x48')],null))[_0xd6e5('0x22')](respondWithResult(_0x4e67bd,null))[_0xd6e5('0x41')](handleError(_0x4e67bd,null));};exports[_0xd6e5('0x23')]=function(_0x255822,_0x42b187){return db['FreshsalesField'][_0xd6e5('0x46')]({'where':{'id':_0x255822[_0xd6e5('0x43')]['id']}})['then'](handleEntityNotFound(_0x42b187,null))[_0xd6e5('0x22')](removeEntity(_0x42b187,null))['catch'](handleError(_0x42b187,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d769d9e..e20b9fc 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 _0xd5f9=['rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0xccc0d4,_0x2f6bf7){_0xccc0d4=_0xccc0d4-0x0;var _0x27a653=_0xd5f9[_0xccc0d4];return _0x27a653;};'use strict';var _=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var logger=require(_0x9d5f('0x2'))(_0x9d5f('0x3'));var moment=require('moment');var BPromise=require(_0x9d5f('0x4'));var rp=require(_0x9d5f('0x5'));var fs=require('fs');var path=require(_0x9d5f('0x6'));var rimraf=require(_0x9d5f('0x7'));var config=require(_0x9d5f('0x8'));var attributes=require(_0x9d5f('0x9'));module['exports']=function(_0x546c04,_0x58edae){return _0x546c04[_0x9d5f('0xa')](_0x9d5f('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x9d5f('0xc'),'fields':[_0x9d5f('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05e3=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3eaacc,_0x159cc6){var _0x3b4871=function(_0x172f5a){while(--_0x172f5a){_0x3eaacc['push'](_0x3eaacc['shift']());}};_0x3b4871(++_0x159cc6);}(_0x05e3,0x86));var _0x305e=function(_0x3cb783,_0x1e70fa){_0x3cb783=_0x3cb783-0x0;var _0x2b4245=_0x05e3[_0x3cb783];return _0x2b4245;};'use strict';var _=require(_0x305e('0x0'));var util=require(_0x305e('0x1'));var logger=require(_0x305e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x305e('0x3'));var rp=require(_0x305e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x305e('0x5'));var config=require(_0x305e('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x305e('0x7')]=function(_0x404744,_0xfadd27){return _0x404744[_0x305e('0x8')](_0x305e('0x9'),attributes,{'tableName':_0x305e('0xa'),'paranoid':![],'indexes':[{'name':_0x305e('0xb'),'fields':[_0x305e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 83fe9e8..9f5f431 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4c3a36,_0xdba60f){var _0x40f945=function(_0x4efdb2){while(--_0x4efdb2){_0x4c3a36['push'](_0x4c3a36['shift']());}};_0x40f945(++_0xdba60f);}(_0x5fab,0x177));var _0xb5fa=function(_0x1fcf36,_0x3f2539){_0x1fcf36=_0x1fcf36-0x0;var _0x44491f=_0x5fab[_0x1fcf36];return _0x44491f;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x38aebc,_0x8bade6){var _0x20b7e0=function(_0x571699){while(--_0x571699){_0x38aebc['push'](_0x38aebc['shift']());}};_0x20b7e0(++_0x8bade6);}(_0x187d,0x93));var _0xd187=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x187d[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index fb31f60..5824505 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(_0x3d320e,_0x2a8827){var _0x28a5d4=function(_0x524540){while(--_0x524540){_0x3d320e['push'](_0x3d320e['shift']());}};_0x28a5d4(++_0x2a8827);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x304b94,_0x5803bc){var _0x19a461=function(_0x361269){while(--_0x361269){_0x304b94['push'](_0x304b94['shift']());}};_0x19a461(++_0x5803bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e5f3864..5c8a29d 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 _0x9d56=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x105681,_0x41961e){var _0xb04295=function(_0x58e67c){while(--_0x58e67c){_0x105681['push'](_0x105681['shift']());}};_0xb04295(++_0x41961e);}(_0x9d56,0x122));var _0x69d5=function(_0x931386,_0x4e49c9){_0x931386=_0x931386-0x0;var _0x1af9e7=_0x9d56[_0x931386];return _0x1af9e7;};'use strict';var Sequelize=require(_0x69d5('0x0'));module[_0x69d5('0x1')]={'name':{'type':Sequelize[_0x69d5('0x2')]},'description':{'type':Sequelize[_0x69d5('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x69d5('0x3')},'remoteUri':{'type':Sequelize[_0x69d5('0x2')]},'password':{'type':Sequelize[_0x69d5('0x2')]},'clientId':{'type':Sequelize[_0x69d5('0x2')]},'clientSecret':{'type':Sequelize[_0x69d5('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x69d5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x69d5('0x4')](_0x69d5('0x5'),_0x69d5('0x6')),'defaultValue':_0x69d5('0x5')}}; \ No newline at end of file +var _0x6d77=['exports','STRING','username','newTab','sequelize'];(function(_0x4f118e,_0x28b3af){var _0x384333=function(_0x4e02e9){while(--_0x4e02e9){_0x4f118e['push'](_0x4f118e['shift']());}};_0x384333(++_0x28b3af);}(_0x6d77,0x13a));var _0x76d7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6d77[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x76d7('0x0'));module[_0x76d7('0x1')]={'name':{'type':Sequelize[_0x76d7('0x2')]},'description':{'type':Sequelize[_0x76d7('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x76d7('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x76d7('0x2')]},'clientId':{'type':Sequelize[_0x76d7('0x2')]},'clientSecret':{'type':Sequelize[_0x76d7('0x2')]},'securityToken':{'type':Sequelize[_0x76d7('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x76d7('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 624fcbd..915630f 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 _0xefb3=['remoteUri','clientId','clientSecret','username','substring','lastIndexOf','Connection','login','password','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','phone','remove','includes','length','label','custom','picklistValues','value','True','true','False','false','test','stringify','statusCode','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceAccount','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','rawAttributes','find','catch','create','body','update','params','SalesforceConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','type','getDescriptions','SalesforceField','getFields','Task'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xefb3,0xa4));var _0x3efb=function(_0x592750,_0x4f4a87){_0x592750=_0x592750-0x0;var _0x140d4f=_0xefb3[_0x592750];return _0x140d4f;};'use strict';var emlformat=require(_0x3efb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3efb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3efb('0x2'));var moment=require('moment');var BPromise=require(_0x3efb('0x3'));var Mustache=require(_0x3efb('0x4'));var util=require(_0x3efb('0x5'));var path=require(_0x3efb('0x6'));var sox=require(_0x3efb('0x7'));var csv=require(_0x3efb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3efb('0x9'));var _=require(_0x3efb('0xa'));var squel=require(_0x3efb('0xb'));var crypto=require(_0x3efb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3efb('0xd'));var toCsv=require(_0x3efb('0x8'));var querystring=require(_0x3efb('0xe'));var Papa=require('papaparse');var Redis=require(_0x3efb('0xf'));var authService=require(_0x3efb('0x10'));var qs=require(_0x3efb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3efb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3efb('0x13'));var config=require(_0x3efb('0x14'));var licenseUtil=require(_0x3efb('0x15'));var db=require(_0x3efb('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x491fce,_0x13b0b2){_0x13b0b2=_0x13b0b2||0xcc;return function(_0x3fc139){if(_0x3fc139){return _0x491fce['sendStatus'](_0x13b0b2);}return _0x491fce[_0x3efb('0x17')](_0x13b0b2)[_0x3efb('0x18')]();};}function respondWithResult(_0x2380c1,_0x521277){_0x521277=_0x521277||0xc8;return function(_0x5d2a7e){if(_0x5d2a7e){return _0x2380c1[_0x3efb('0x17')](_0x521277)[_0x3efb('0x19')](_0x5d2a7e);}};}function respondWithFilteredResult(_0x3a3e6a,_0x5081b1){return function(_0x41abc6){if(_0x41abc6){var _0x38b21b=typeof _0x5081b1[_0x3efb('0x1a')]===_0x3efb('0x1b')&&typeof _0x5081b1[_0x3efb('0x1c')]===_0x3efb('0x1b');var _0x39d82c=_0x41abc6[_0x3efb('0x1d')];var _0x3ea6ba=_0x38b21b?0x0:_0x5081b1[_0x3efb('0x1a')];var _0x2ac9ae=_0x38b21b?_0x41abc6[_0x3efb('0x1d')]:_0x5081b1['offset']+_0x5081b1[_0x3efb('0x1c')];var _0x338479;if(_0x2ac9ae>=_0x39d82c){_0x2ac9ae=_0x39d82c;_0x338479=0xc8;}else{_0x338479=0xce;}_0x3a3e6a[_0x3efb('0x17')](_0x338479);return _0x3a3e6a[_0x3efb('0x1e')]('Content-Range',_0x3ea6ba+'-'+_0x2ac9ae+'/'+_0x39d82c)['json'](_0x41abc6);}return null;};}function patchUpdates(_0x52b1f4){return function(_0x5d79e3){try{jsonpatch['apply'](_0x5d79e3,_0x52b1f4,!![]);}catch(_0x1f462a){return BPromise[_0x3efb('0x1f')](_0x1f462a);}return _0x5d79e3[_0x3efb('0x20')]();};}function saveUpdates(_0x567426,_0xab77e){return function(_0x24aa6a){if(_0x24aa6a){return _0x24aa6a['update'](_0x567426)[_0x3efb('0x21')](function(_0x5213eb){return _0x5213eb;});}return null;};}function removeEntity(_0x5810a0,_0x3a38ae){return function(_0x200b27){if(_0x200b27){return _0x200b27[_0x3efb('0x22')]()[_0x3efb('0x21')](function(){_0x5810a0[_0x3efb('0x17')](0xcc)[_0x3efb('0x18')]();});}};}function handleEntityNotFound(_0x420769,_0x2fb39e){return function(_0x472bfe){if(!_0x472bfe){_0x420769[_0x3efb('0x23')](0x194);}return _0x472bfe;};}function handleError(_0x37ef25,_0x43e85e){_0x43e85e=_0x43e85e||0x1f4;return function(_0x1c8a92){logger[_0x3efb('0x24')](_0x1c8a92[_0x3efb('0x25')]);if(_0x1c8a92[_0x3efb('0x26')]){delete _0x1c8a92['name'];}_0x37ef25['status'](_0x43e85e)[_0x3efb('0x27')](_0x1c8a92);};}exports[_0x3efb('0x28')]=function(_0xe5e05a,_0x148618){var _0x39b7d7={},_0x27eccd={},_0x5bd103={'count':0x0,'rows':[]};var _0x4c604d=_[_0x3efb('0x29')](db[_0x3efb('0x2a')]['rawAttributes'],function(_0x235d61){return{'name':_0x235d61['fieldName'],'type':_0x235d61['type']['key']};});_0x27eccd['model']=_[_0x3efb('0x29')](_0x4c604d,_0x3efb('0x26'));_0x27eccd[_0x3efb('0x2b')]=_['keys'](_0xe5e05a[_0x3efb('0x2b')]);_0x27eccd[_0x3efb('0x2c')]=_[_0x3efb('0x2d')](_0x27eccd['model'],_0x27eccd[_0x3efb('0x2b')]);_0x39b7d7[_0x3efb('0x2e')]=_[_0x3efb('0x2d')](_0x27eccd[_0x3efb('0x2f')],qs[_0x3efb('0x30')](_0xe5e05a[_0x3efb('0x2b')][_0x3efb('0x30')]));_0x39b7d7['attributes']=_0x39b7d7[_0x3efb('0x2e')]['length']?_0x39b7d7['attributes']:_0x27eccd[_0x3efb('0x2f')];if(!_0xe5e05a[_0x3efb('0x2b')][_0x3efb('0x31')](_0x3efb('0x32'))){_0x39b7d7[_0x3efb('0x1c')]=qs['limit'](_0xe5e05a['query'][_0x3efb('0x1c')]);_0x39b7d7['offset']=qs['offset'](_0xe5e05a[_0x3efb('0x2b')]['offset']);}_0x39b7d7[_0x3efb('0x33')]=qs[_0x3efb('0x34')](_0xe5e05a[_0x3efb('0x2b')][_0x3efb('0x34')]);_0x39b7d7[_0x3efb('0x35')]=qs['filters'](_[_0x3efb('0x36')](_0xe5e05a[_0x3efb('0x2b')],_0x27eccd[_0x3efb('0x2c')]),_0x4c604d);if(_0xe5e05a[_0x3efb('0x2b')][_0x3efb('0x37')]){_0x39b7d7[_0x3efb('0x35')]=_[_0x3efb('0x38')](_0x39b7d7[_0x3efb('0x35')],{'$or':_[_0x3efb('0x29')](_0x4c604d,function(_0x9a48fe){if(_0x9a48fe['type']!==_0x3efb('0x39')){var _0x2e49c={};_0x2e49c[_0x9a48fe[_0x3efb('0x26')]]={'$like':'%'+_0xe5e05a[_0x3efb('0x2b')]['filter']+'%'};return _0x2e49c;}})});}_0x39b7d7=_[_0x3efb('0x38')]({},_0x39b7d7,_0xe5e05a[_0x3efb('0x3a')]);var _0x1aeed7={'where':_0x39b7d7[_0x3efb('0x35')]};return db['SalesforceAccount'][_0x3efb('0x1d')](_0x1aeed7)[_0x3efb('0x21')](function(_0x245280){_0x5bd103[_0x3efb('0x1d')]=_0x245280;if(_0xe5e05a[_0x3efb('0x2b')][_0x3efb('0x3b')]){_0x39b7d7[_0x3efb('0x3c')]=[{'all':!![]}];}return db[_0x3efb('0x2a')][_0x3efb('0x3d')](_0x39b7d7);})['then'](function(_0x11f577){_0x5bd103['rows']=_0x11f577;return _0x5bd103;})[_0x3efb('0x21')](respondWithFilteredResult(_0x148618,_0x39b7d7))['catch'](handleError(_0x148618,null));};exports[_0x3efb('0x3e')]=function(_0x6c8283,_0x45d006){var _0x212f72={'raw':![],'where':{'id':_0x6c8283['params']['id']}},_0x5ebb61={};_0x5ebb61[_0x3efb('0x2f')]=_[_0x3efb('0x3f')](db[_0x3efb('0x2a')][_0x3efb('0x40')]);_0x5ebb61['query']=_[_0x3efb('0x3f')](_0x6c8283[_0x3efb('0x2b')]);_0x5ebb61['filters']=_[_0x3efb('0x2d')](_0x5ebb61[_0x3efb('0x2f')],_0x5ebb61[_0x3efb('0x2b')]);_0x212f72[_0x3efb('0x2e')]=_[_0x3efb('0x2d')](_0x5ebb61[_0x3efb('0x2f')],qs[_0x3efb('0x30')](_0x6c8283[_0x3efb('0x2b')][_0x3efb('0x30')]));_0x212f72[_0x3efb('0x2e')]=_0x212f72[_0x3efb('0x2e')]['length']?_0x212f72[_0x3efb('0x2e')]:_0x5ebb61[_0x3efb('0x2f')];if(_0x6c8283['query'][_0x3efb('0x3b')]){_0x212f72[_0x3efb('0x3c')]=[{'all':!![]}];}_0x212f72=_[_0x3efb('0x38')]({},_0x212f72,_0x6c8283['options']);return db[_0x3efb('0x2a')][_0x3efb('0x41')](_0x212f72)[_0x3efb('0x21')](handleEntityNotFound(_0x45d006,null))[_0x3efb('0x21')](respondWithResult(_0x45d006,null))[_0x3efb('0x42')](handleError(_0x45d006,null));};exports['create']=function(_0x2cb5e1,_0x3cf79e){return db['SalesforceAccount'][_0x3efb('0x43')](_0x2cb5e1[_0x3efb('0x44')],{})[_0x3efb('0x21')](respondWithResult(_0x3cf79e,0xc9))[_0x3efb('0x42')](handleError(_0x3cf79e,null));};exports[_0x3efb('0x45')]=function(_0x41fd43,_0x1d4c59){if(_0x41fd43[_0x3efb('0x44')]['id']){delete _0x41fd43['body']['id'];}return db[_0x3efb('0x2a')][_0x3efb('0x41')]({'where':{'id':_0x41fd43['params']['id']}})[_0x3efb('0x21')](handleEntityNotFound(_0x1d4c59,null))[_0x3efb('0x21')](saveUpdates(_0x41fd43[_0x3efb('0x44')],null))[_0x3efb('0x21')](respondWithResult(_0x1d4c59,null))['catch'](handleError(_0x1d4c59,null));};exports[_0x3efb('0x22')]=function(_0x36788c,_0x4654a4){return db[_0x3efb('0x2a')][_0x3efb('0x41')]({'where':{'id':_0x36788c['params']['id']}})['then'](handleEntityNotFound(_0x4654a4,null))[_0x3efb('0x21')](removeEntity(_0x4654a4,null))[_0x3efb('0x42')](handleError(_0x4654a4,null));};exports['getConfigurations']=function(_0x5e5a3b,_0x3d7160,_0x547f37){var _0x5e32fc={};var _0x3f7bca={};var _0x382a9f;var _0x42c4d6;return db['SalesforceAccount']['findOne']({'where':{'id':_0x5e5a3b[_0x3efb('0x46')]['id']}})[_0x3efb('0x21')](handleEntityNotFound(_0x3d7160,null))['then'](function(_0x12d061){if(_0x12d061){_0x382a9f=_0x12d061;_0x3f7bca['model']=_[_0x3efb('0x3f')](db[_0x3efb('0x47')][_0x3efb('0x40')]);_0x3f7bca[_0x3efb('0x2b')]=_[_0x3efb('0x3f')](_0x5e5a3b[_0x3efb('0x2b')]);_0x3f7bca[_0x3efb('0x2c')]=_['intersection'](_0x3f7bca['model'],_0x3f7bca['query']);_0x5e32fc[_0x3efb('0x2e')]=_['intersection'](_0x3f7bca[_0x3efb('0x2f')],qs[_0x3efb('0x30')](_0x5e5a3b[_0x3efb('0x2b')]['fields']));_0x5e32fc[_0x3efb('0x2e')]=_0x5e32fc[_0x3efb('0x2e')]['length']?_0x5e32fc['attributes']:_0x3f7bca[_0x3efb('0x2f')];_0x5e32fc[_0x3efb('0x33')]=qs[_0x3efb('0x34')](_0x5e5a3b[_0x3efb('0x2b')][_0x3efb('0x34')]);_0x5e32fc[_0x3efb('0x35')]=qs[_0x3efb('0x2c')](_[_0x3efb('0x36')](_0x5e5a3b['query'],_0x3f7bca[_0x3efb('0x2c')]));if(_0x5e5a3b['query'][_0x3efb('0x37')]){_0x5e32fc[_0x3efb('0x35')]=_[_0x3efb('0x38')](_0x5e32fc[_0x3efb('0x35')],{'$or':_['map'](_0x5e32fc[_0x3efb('0x2e')],function(_0x32b8c5){var _0x3fdd37={};_0x3fdd37[_0x32b8c5]={'$like':'%'+_0x5e5a3b[_0x3efb('0x2b')][_0x3efb('0x37')]+'%'};return _0x3fdd37;})});}_0x5e32fc=_[_0x3efb('0x38')]({},_0x5e32fc,_0x5e5a3b['options']);return _0x382a9f[_0x3efb('0x48')](_0x5e32fc);}})['then'](function(_0x4b3c95){if(_0x4b3c95){_0x42c4d6=_0x4b3c95['length'];if(!_0x5e5a3b[_0x3efb('0x2b')][_0x3efb('0x31')]('nolimit')){_0x5e32fc[_0x3efb('0x1c')]=qs[_0x3efb('0x1c')](_0x5e5a3b[_0x3efb('0x2b')][_0x3efb('0x1c')]);_0x5e32fc['offset']=qs['offset'](_0x5e5a3b['query'][_0x3efb('0x1a')]);}return _0x382a9f[_0x3efb('0x48')](_0x5e32fc);}})[_0x3efb('0x21')](function(_0x26b6cc){if(_0x26b6cc){return _0x26b6cc?{'count':_0x42c4d6,'rows':_0x26b6cc}:null;}})[_0x3efb('0x21')](respondWithResult(_0x3d7160,null))[_0x3efb('0x42')](handleError(_0x3d7160,null));};exports[_0x3efb('0x49')]=function(_0x3846fb,_0x4bac52,_0x54b0e9){if(_0x3846fb['body']['id']){delete _0x3846fb['body']['id'];}return db['SalesforceAccount'][_0x3efb('0x4a')]({'where':{'id':_0x3846fb['params']['id']}})['then'](handleEntityNotFound(_0x4bac52,null))[_0x3efb('0x21')](function(_0x2d7cea){if(_0x2d7cea){_0x3846fb[_0x3efb('0x44')][_0x3efb('0x4b')]=_0x2d7cea['id'];_0x3846fb[_0x3efb('0x44')][_0x3efb('0x4c')]=integrations[_0x3efb('0x4d')](_0x3846fb[_0x3efb('0x44')][_0x3efb('0x4e')],_0x3846fb[_0x3efb('0x44')][_0x3efb('0x4f')]);_0x3846fb[_0x3efb('0x44')]['Descriptions']=integrations[_0x3efb('0x50')](_0x3846fb[_0x3efb('0x44')][_0x3efb('0x4e')],_0x3846fb[_0x3efb('0x44')][_0x3efb('0x4f')]);return db[_0x3efb('0x47')][_0x3efb('0x43')](_0x3846fb[_0x3efb('0x44')],{'include':[{'model':db['SalesforceField'],'as':_0x3efb('0x4c')},{'model':db[_0x3efb('0x51')],'as':'Descriptions'}]});}return null;})[_0x3efb('0x21')](respondWithResult(_0x4bac52,null))[_0x3efb('0x42')](handleError(_0x4bac52,null));};exports[_0x3efb('0x52')]=function(_0xe383e,_0x460653,_0x4ee4d3){var _0x3fcba3;var _0x5cff0e='';var _0x18aaf8=_0x3efb('0x53');return db['SalesforceAccount'][_0x3efb('0x4a')]({'where':{'id':_0xe383e[_0x3efb('0x46')]['id']},'attributes':['id',_0x3efb('0x54'),_0x3efb('0x55'),_0x3efb('0x56'),_0x3efb('0x57'),'password','securityToken']})[_0x3efb('0x21')](handleEntityNotFound(_0x460653,null))[_0x3efb('0x21')](function(_0x2e6b44){if(_0x2e6b44){_0x5cff0e=_0x2e6b44[_0x3efb('0x54')];var _0x30a266=_0x5cff0e['slice'](-0x1);if(_0x30a266==='/'){_0x5cff0e=_0x5cff0e[_0x3efb('0x58')](0x0,_0x5cff0e[_0x3efb('0x59')](_0x30a266));}_0x3fcba3=new jsforce[(_0x3efb('0x5a'))]({'oauth2':{'loginUrl':_0x5cff0e,'clientId':_0x2e6b44[_0x3efb('0x55')],'clientSecret':_0x2e6b44[_0x3efb('0x56')]}});return _0x3fcba3[_0x3efb('0x5b')](_0x2e6b44[_0x3efb('0x57')],_0x2e6b44[_0x3efb('0x5c')][_0x3efb('0x5d')](_0x2e6b44[_0x3efb('0x5e')]));}})[_0x3efb('0x21')](function(_0x26df3a){if(_0x26df3a){if(!_[_0x3efb('0x5f')](_0xe383e[_0x3efb('0x2b')][_0x3efb('0x60')])){_0x18aaf8=_0xe383e[_0x3efb('0x2b')]['ticketType'];}return _0x3fcba3[_0x3efb('0x61')](_0x18aaf8)[_0x3efb('0x62')]();}})['then'](function(_0x3c7ef){var _0x3e82bf=[_0x3efb('0x63'),_0x3efb('0x64'),_0x3efb('0x65'),_0x3efb('0x66'),_0x3efb('0x67'),_0x3efb('0x68')];var _0x332050=[_0x3efb('0x69'),'int',_0x3efb('0x6a'),_0x3efb('0x6b'),_0x3efb('0x6c'),'textarea',_0x3efb('0x6d')];if(_0x3c7ef){_[_0x3efb('0x6e')](_0x3c7ef[_0x3efb('0x30')],function(_0x38c46d){return _0x3e82bf[_0x3efb('0x6f')](_0x38c46d[_0x3efb('0x26')])||!_0x332050[_0x3efb('0x6f')](_0x38c46d['type']);});return{'count':_0x3c7ef[_0x3efb('0x30')][_0x3efb('0x70')],'rows':_['map'](_0x3c7ef['fields'],function(_0x5cc1f1){return{'id':_0x5cc1f1[_0x3efb('0x26')],'name':_0x5cc1f1[_0x3efb('0x71')],'custom':_0x5cc1f1[_0x3efb('0x72')],'options':_0x5cc1f1[_0x3efb('0x73')][_0x3efb('0x70')]>0x0?_[_0x3efb('0x29')](_0x5cc1f1[_0x3efb('0x73')],function(_0x385ca1){return{'name':_0x385ca1['label'],'value':_0x385ca1[_0x3efb('0x74')]};}):_0x5cc1f1[_0x3efb('0x4f')]==_0x3efb('0x6b')?[{'name':_0x3efb('0x75'),'value':_0x3efb('0x76')},{'name':_0x3efb('0x77'),'value':_0x3efb('0x78')}]:[]};})};}})[_0x3efb('0x21')](respondWithResult(_0x460653,null))[_0x3efb('0x42')](function(_0x3855ae){var _0x1e29cd=_0xe383e[_0x3efb('0x2b')][_0x3efb('0x79')]?0x1f4:_0x3855ae['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x3efb('0x52'),_0x1e29cd,JSON[_0x3efb('0x7a')](_0x3855ae));delete _0x3855ae[_0x3efb('0x26')];if(_0x1e29cd===0x191){_0x1e29cd=0x190;}_0x460653[_0x3efb('0x17')](_0x1e29cd)['send'](_0xe383e[_0x3efb('0x2b')][_0x3efb('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x3855ae[_0x3efb('0x7b')]}:_0x3855ae);});}; \ No newline at end of file +var _0xbc5f=['../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','VIRTUAL','where','include','findAll','catch','show','params','includeAll','options','create','update','body','find','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','remoteUri','slice','substring','Connection','login','concat','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','False','false','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xcee12e,_0x391da2){var _0x568176=function(_0x15cac1){while(--_0x15cac1){_0xcee12e['push'](_0xcee12e['shift']());}};_0x568176(++_0x391da2);}(_0xbc5f,0x1e2));var _0xfbc5=function(_0x1a7985,_0x258bf0){_0x1a7985=_0x1a7985-0x0;var _0x1a1486=_0xbc5f[_0x1a7985];return _0x1a1486;};'use strict';var emlformat=require(_0xfbc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbc5('0x1'));var jsonpatch=require(_0xfbc5('0x2'));var rp=require('request-promise');var moment=require(_0xfbc5('0x3'));var BPromise=require(_0xfbc5('0x4'));var Mustache=require(_0xfbc5('0x5'));var util=require('util');var path=require(_0xfbc5('0x6'));var sox=require(_0xfbc5('0x7'));var csv=require('to-csv');var ejs=require(_0xfbc5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbc5('0x9'));var squel=require(_0xfbc5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfbc5('0xb'));var querystring=require(_0xfbc5('0xc'));var Papa=require(_0xfbc5('0xd'));var Redis=require(_0xfbc5('0xe'));var authService=require(_0xfbc5('0xf'));var qs=require(_0xfbc5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbc5('0x11'));var logger=require(_0xfbc5('0x12'))('api');var utils=require(_0xfbc5('0x13'));var config=require(_0xfbc5('0x14'));var licenseUtil=require(_0xfbc5('0x15'));var db=require(_0xfbc5('0x16'))['db'];var integrations=require(_0xfbc5('0x17'));function respondWithStatusCode(_0x34aa0c,_0x2fcee0){_0x2fcee0=_0x2fcee0||0xcc;return function(_0x25e6a5){if(_0x25e6a5){return _0x34aa0c[_0xfbc5('0x18')](_0x2fcee0);}return _0x34aa0c[_0xfbc5('0x19')](_0x2fcee0)['end']();};}function respondWithResult(_0x23f5bb,_0x31bf5f){_0x31bf5f=_0x31bf5f||0xc8;return function(_0x60a697){if(_0x60a697){return _0x23f5bb[_0xfbc5('0x19')](_0x31bf5f)[_0xfbc5('0x1a')](_0x60a697);}};}function respondWithFilteredResult(_0x2aebc6,_0x29d94e){return function(_0x184642){if(_0x184642){var _0x21ac8b=typeof _0x29d94e[_0xfbc5('0x1b')]===_0xfbc5('0x1c')&&typeof _0x29d94e['limit']==='undefined';var _0x457205=_0x184642[_0xfbc5('0x1d')];var _0x293726=_0x21ac8b?0x0:_0x29d94e[_0xfbc5('0x1b')];var _0x61e2db=_0x21ac8b?_0x184642[_0xfbc5('0x1d')]:_0x29d94e[_0xfbc5('0x1b')]+_0x29d94e['limit'];var _0x4a2893;if(_0x61e2db>=_0x457205){_0x61e2db=_0x457205;_0x4a2893=0xc8;}else{_0x4a2893=0xce;}_0x2aebc6['status'](_0x4a2893);return _0x2aebc6['set']('Content-Range',_0x293726+'-'+_0x61e2db+'/'+_0x457205)[_0xfbc5('0x1a')](_0x184642);}return null;};}function patchUpdates(_0x3fd656){return function(_0x7cb72c){try{jsonpatch[_0xfbc5('0x1e')](_0x7cb72c,_0x3fd656,!![]);}catch(_0x7f5ce1){return BPromise[_0xfbc5('0x1f')](_0x7f5ce1);}return _0x7cb72c[_0xfbc5('0x20')]();};}function saveUpdates(_0x461b83,_0x46eb85){return function(_0x44ff2b){if(_0x44ff2b){return _0x44ff2b['update'](_0x461b83)[_0xfbc5('0x21')](function(_0x3b6396){return _0x3b6396;});}return null;};}function removeEntity(_0x5af53a,_0x115449){return function(_0x22d0ff){if(_0x22d0ff){return _0x22d0ff[_0xfbc5('0x22')]()[_0xfbc5('0x21')](function(){_0x5af53a[_0xfbc5('0x19')](0xcc)[_0xfbc5('0x23')]();});}};}function handleEntityNotFound(_0x45ec1d,_0x3fa8e7){return function(_0x4da0fc){if(!_0x4da0fc){_0x45ec1d[_0xfbc5('0x18')](0x194);}return _0x4da0fc;};}function handleError(_0x5288be,_0x2ada6b){_0x2ada6b=_0x2ada6b||0x1f4;return function(_0x130623){logger[_0xfbc5('0x24')](_0x130623[_0xfbc5('0x25')]);if(_0x130623[_0xfbc5('0x26')]){delete _0x130623[_0xfbc5('0x26')];}_0x5288be[_0xfbc5('0x19')](_0x2ada6b)[_0xfbc5('0x27')](_0x130623);};}exports[_0xfbc5('0x28')]=function(_0x1c9345,_0xfe2a92){var _0x5aaa9b={},_0x5c8868={},_0x437e2d={'count':0x0,'rows':[]};var _0x59949e=_[_0xfbc5('0x29')](db[_0xfbc5('0x2a')][_0xfbc5('0x2b')],function(_0x218834){return{'name':_0x218834[_0xfbc5('0x2c')],'type':_0x218834['type']['key']};});_0x5c8868[_0xfbc5('0x2d')]=_[_0xfbc5('0x29')](_0x59949e,_0xfbc5('0x26'));_0x5c8868['query']=_[_0xfbc5('0x2e')](_0x1c9345[_0xfbc5('0x2f')]);_0x5c8868[_0xfbc5('0x30')]=_[_0xfbc5('0x31')](_0x5c8868['model'],_0x5c8868[_0xfbc5('0x2f')]);_0x5aaa9b[_0xfbc5('0x32')]=_[_0xfbc5('0x31')](_0x5c8868[_0xfbc5('0x2d')],qs[_0xfbc5('0x33')](_0x1c9345[_0xfbc5('0x2f')]['fields']));_0x5aaa9b[_0xfbc5('0x32')]=_0x5aaa9b['attributes'][_0xfbc5('0x34')]?_0x5aaa9b[_0xfbc5('0x32')]:_0x5c8868[_0xfbc5('0x2d')];if(!_0x1c9345[_0xfbc5('0x2f')][_0xfbc5('0x35')]('nolimit')){_0x5aaa9b[_0xfbc5('0x36')]=qs[_0xfbc5('0x36')](_0x1c9345[_0xfbc5('0x2f')]['limit']);_0x5aaa9b[_0xfbc5('0x1b')]=qs['offset'](_0x1c9345[_0xfbc5('0x2f')][_0xfbc5('0x1b')]);}_0x5aaa9b[_0xfbc5('0x37')]=qs[_0xfbc5('0x38')](_0x1c9345[_0xfbc5('0x2f')][_0xfbc5('0x38')]);_0x5aaa9b['where']=qs['filters'](_[_0xfbc5('0x39')](_0x1c9345['query'],_0x5c8868[_0xfbc5('0x30')]),_0x59949e);if(_0x1c9345[_0xfbc5('0x2f')][_0xfbc5('0x3a')]){_0x5aaa9b['where']=_[_0xfbc5('0x3b')](_0x5aaa9b['where'],{'$or':_[_0xfbc5('0x29')](_0x59949e,function(_0x9e657c){if(_0x9e657c['type']!==_0xfbc5('0x3c')){var _0x462c53={};_0x462c53[_0x9e657c['name']]={'$like':'%'+_0x1c9345[_0xfbc5('0x2f')][_0xfbc5('0x3a')]+'%'};return _0x462c53;}})});}_0x5aaa9b=_[_0xfbc5('0x3b')]({},_0x5aaa9b,_0x1c9345['options']);var _0x8e3dc7={'where':_0x5aaa9b[_0xfbc5('0x3d')]};return db[_0xfbc5('0x2a')][_0xfbc5('0x1d')](_0x8e3dc7)[_0xfbc5('0x21')](function(_0x565f97){_0x437e2d[_0xfbc5('0x1d')]=_0x565f97;if(_0x1c9345['query']['includeAll']){_0x5aaa9b[_0xfbc5('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xfbc5('0x3f')](_0x5aaa9b);})['then'](function(_0x15ec1f){_0x437e2d['rows']=_0x15ec1f;return _0x437e2d;})['then'](respondWithFilteredResult(_0xfe2a92,_0x5aaa9b))[_0xfbc5('0x40')](handleError(_0xfe2a92,null));};exports[_0xfbc5('0x41')]=function(_0x2b5a7b,_0x1f9e6d){var _0x4ed12f={'raw':![],'where':{'id':_0x2b5a7b[_0xfbc5('0x42')]['id']}},_0x4c742f={};_0x4c742f[_0xfbc5('0x2d')]=_[_0xfbc5('0x2e')](db['SalesforceAccount'][_0xfbc5('0x2b')]);_0x4c742f['query']=_['keys'](_0x2b5a7b['query']);_0x4c742f[_0xfbc5('0x30')]=_[_0xfbc5('0x31')](_0x4c742f[_0xfbc5('0x2d')],_0x4c742f[_0xfbc5('0x2f')]);_0x4ed12f[_0xfbc5('0x32')]=_['intersection'](_0x4c742f[_0xfbc5('0x2d')],qs[_0xfbc5('0x33')](_0x2b5a7b['query'][_0xfbc5('0x33')]));_0x4ed12f[_0xfbc5('0x32')]=_0x4ed12f['attributes'][_0xfbc5('0x34')]?_0x4ed12f['attributes']:_0x4c742f[_0xfbc5('0x2d')];if(_0x2b5a7b[_0xfbc5('0x2f')][_0xfbc5('0x43')]){_0x4ed12f[_0xfbc5('0x3e')]=[{'all':!![]}];}_0x4ed12f=_[_0xfbc5('0x3b')]({},_0x4ed12f,_0x2b5a7b[_0xfbc5('0x44')]);return db[_0xfbc5('0x2a')]['find'](_0x4ed12f)[_0xfbc5('0x21')](handleEntityNotFound(_0x1f9e6d,null))[_0xfbc5('0x21')](respondWithResult(_0x1f9e6d,null))[_0xfbc5('0x40')](handleError(_0x1f9e6d,null));};exports[_0xfbc5('0x45')]=function(_0x2d73be,_0x4cd744){return db[_0xfbc5('0x2a')][_0xfbc5('0x45')](_0x2d73be['body'],{})['then'](respondWithResult(_0x4cd744,0xc9))[_0xfbc5('0x40')](handleError(_0x4cd744,null));};exports[_0xfbc5('0x46')]=function(_0x18fa59,_0x413c99){if(_0x18fa59[_0xfbc5('0x47')]['id']){delete _0x18fa59[_0xfbc5('0x47')]['id'];}return db[_0xfbc5('0x2a')][_0xfbc5('0x48')]({'where':{'id':_0x18fa59[_0xfbc5('0x42')]['id']}})[_0xfbc5('0x21')](handleEntityNotFound(_0x413c99,null))['then'](saveUpdates(_0x18fa59[_0xfbc5('0x47')],null))[_0xfbc5('0x21')](respondWithResult(_0x413c99,null))[_0xfbc5('0x40')](handleError(_0x413c99,null));};exports[_0xfbc5('0x22')]=function(_0x187a3d,_0x375f34){return db['SalesforceAccount'][_0xfbc5('0x48')]({'where':{'id':_0x187a3d[_0xfbc5('0x42')]['id']}})['then'](handleEntityNotFound(_0x375f34,null))['then'](removeEntity(_0x375f34,null))[_0xfbc5('0x40')](handleError(_0x375f34,null));};exports[_0xfbc5('0x49')]=function(_0x36a028,_0x219e8f,_0x323aa0){var _0x58abb4={};var _0x21303a={};var _0x481fda;var _0x53c84d;return db['SalesforceAccount'][_0xfbc5('0x4a')]({'where':{'id':_0x36a028['params']['id']}})['then'](handleEntityNotFound(_0x219e8f,null))['then'](function(_0x11ed94){if(_0x11ed94){_0x481fda=_0x11ed94;_0x21303a[_0xfbc5('0x2d')]=_[_0xfbc5('0x2e')](db[_0xfbc5('0x4b')]['rawAttributes']);_0x21303a[_0xfbc5('0x2f')]=_[_0xfbc5('0x2e')](_0x36a028['query']);_0x21303a['filters']=_[_0xfbc5('0x31')](_0x21303a['model'],_0x21303a[_0xfbc5('0x2f')]);_0x58abb4['attributes']=_[_0xfbc5('0x31')](_0x21303a[_0xfbc5('0x2d')],qs[_0xfbc5('0x33')](_0x36a028[_0xfbc5('0x2f')]['fields']));_0x58abb4['attributes']=_0x58abb4[_0xfbc5('0x32')][_0xfbc5('0x34')]?_0x58abb4[_0xfbc5('0x32')]:_0x21303a[_0xfbc5('0x2d')];_0x58abb4['order']=qs[_0xfbc5('0x38')](_0x36a028['query'][_0xfbc5('0x38')]);_0x58abb4['where']=qs['filters'](_[_0xfbc5('0x39')](_0x36a028[_0xfbc5('0x2f')],_0x21303a[_0xfbc5('0x30')]));if(_0x36a028[_0xfbc5('0x2f')][_0xfbc5('0x3a')]){_0x58abb4[_0xfbc5('0x3d')]=_[_0xfbc5('0x3b')](_0x58abb4[_0xfbc5('0x3d')],{'$or':_[_0xfbc5('0x29')](_0x58abb4[_0xfbc5('0x32')],function(_0x39d373){var _0x588a32={};_0x588a32[_0x39d373]={'$like':'%'+_0x36a028[_0xfbc5('0x2f')][_0xfbc5('0x3a')]+'%'};return _0x588a32;})});}_0x58abb4=_['merge']({},_0x58abb4,_0x36a028[_0xfbc5('0x44')]);return _0x481fda[_0xfbc5('0x49')](_0x58abb4);}})[_0xfbc5('0x21')](function(_0x38c327){if(_0x38c327){_0x53c84d=_0x38c327[_0xfbc5('0x34')];if(!_0x36a028['query'][_0xfbc5('0x35')](_0xfbc5('0x4c'))){_0x58abb4['limit']=qs['limit'](_0x36a028[_0xfbc5('0x2f')][_0xfbc5('0x36')]);_0x58abb4['offset']=qs[_0xfbc5('0x1b')](_0x36a028[_0xfbc5('0x2f')]['offset']);}return _0x481fda[_0xfbc5('0x49')](_0x58abb4);}})[_0xfbc5('0x21')](function(_0x4a355b){if(_0x4a355b){return _0x4a355b?{'count':_0x53c84d,'rows':_0x4a355b}:null;}})[_0xfbc5('0x21')](respondWithResult(_0x219e8f,null))[_0xfbc5('0x40')](handleError(_0x219e8f,null));};exports[_0xfbc5('0x4d')]=function(_0x15d7ab,_0x4d0c24,_0x5db533){if(_0x15d7ab[_0xfbc5('0x47')]['id']){delete _0x15d7ab[_0xfbc5('0x47')]['id'];}return db[_0xfbc5('0x2a')][_0xfbc5('0x4a')]({'where':{'id':_0x15d7ab[_0xfbc5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d0c24,null))[_0xfbc5('0x21')](function(_0x4f9fa5){if(_0x4f9fa5){_0x15d7ab[_0xfbc5('0x47')][_0xfbc5('0x4e')]=_0x4f9fa5['id'];_0x15d7ab['body'][_0xfbc5('0x4f')]=integrations[_0xfbc5('0x50')](_0x15d7ab['body'][_0xfbc5('0x51')],_0x15d7ab[_0xfbc5('0x47')][_0xfbc5('0x52')]);_0x15d7ab[_0xfbc5('0x47')][_0xfbc5('0x53')]=integrations[_0xfbc5('0x54')](_0x15d7ab[_0xfbc5('0x47')][_0xfbc5('0x51')],_0x15d7ab[_0xfbc5('0x47')]['type']);return db[_0xfbc5('0x4b')][_0xfbc5('0x45')](_0x15d7ab[_0xfbc5('0x47')],{'include':[{'model':db[_0xfbc5('0x55')],'as':_0xfbc5('0x4f')},{'model':db['SalesforceField'],'as':_0xfbc5('0x53')}]});}return null;})[_0xfbc5('0x21')](respondWithResult(_0x4d0c24,null))['catch'](handleError(_0x4d0c24,null));};exports[_0xfbc5('0x56')]=function(_0x4da95b,_0x45b6a1,_0xbe98be){var _0x195ddb;var _0x388c6e='';var _0x23f2f5=_0xfbc5('0x57');return db[_0xfbc5('0x2a')][_0xfbc5('0x4a')]({'where':{'id':_0x4da95b['params']['id']},'attributes':['id','remoteUri',_0xfbc5('0x58'),_0xfbc5('0x59'),_0xfbc5('0x5a'),_0xfbc5('0x5b'),_0xfbc5('0x5c')]})['then'](handleEntityNotFound(_0x45b6a1,null))[_0xfbc5('0x21')](function(_0x1fe32a){if(_0x1fe32a){_0x388c6e=_0x1fe32a[_0xfbc5('0x5d')];var _0x52c287=_0x388c6e[_0xfbc5('0x5e')](-0x1);if(_0x52c287==='/'){_0x388c6e=_0x388c6e[_0xfbc5('0x5f')](0x0,_0x388c6e['lastIndexOf'](_0x52c287));}_0x195ddb=new jsforce[(_0xfbc5('0x60'))]({'oauth2':{'loginUrl':_0x388c6e,'clientId':_0x1fe32a['clientId'],'clientSecret':_0x1fe32a[_0xfbc5('0x59')]}});return _0x195ddb[_0xfbc5('0x61')](_0x1fe32a[_0xfbc5('0x5a')],_0x1fe32a[_0xfbc5('0x5b')][_0xfbc5('0x62')](_0x1fe32a[_0xfbc5('0x5c')]));}})['then'](function(_0x40d80a){if(_0x40d80a){if(!_['isNil'](_0x4da95b['query'][_0xfbc5('0x63')])){_0x23f2f5=_0x4da95b['query'][_0xfbc5('0x63')];}return _0x195ddb[_0xfbc5('0x64')](_0x23f2f5)[_0xfbc5('0x65')]();}})['then'](function(_0x445ab5){var _0x21a907=[_0xfbc5('0x66'),'ActivityDate',_0xfbc5('0x67'),_0xfbc5('0x68'),_0xfbc5('0x69'),_0xfbc5('0x6a')];var _0x46da8b=[_0xfbc5('0x6b'),_0xfbc5('0x6c'),_0xfbc5('0x6d'),'boolean',_0xfbc5('0x6e'),_0xfbc5('0x6f'),_0xfbc5('0x70')];if(_0x445ab5){_[_0xfbc5('0x71')](_0x445ab5[_0xfbc5('0x33')],function(_0x3f03f4){return _0x21a907[_0xfbc5('0x72')](_0x3f03f4[_0xfbc5('0x26')])||!_0x46da8b[_0xfbc5('0x72')](_0x3f03f4['type']);});return{'count':_0x445ab5[_0xfbc5('0x33')][_0xfbc5('0x34')],'rows':_[_0xfbc5('0x29')](_0x445ab5[_0xfbc5('0x33')],function(_0x3ae08e){return{'id':_0x3ae08e[_0xfbc5('0x26')],'name':_0x3ae08e['label'],'custom':_0x3ae08e[_0xfbc5('0x73')],'options':_0x3ae08e['picklistValues']['length']>0x0?_[_0xfbc5('0x29')](_0x3ae08e[_0xfbc5('0x74')],function(_0x4fca6c){return{'name':_0x4fca6c[_0xfbc5('0x75')],'value':_0x4fca6c[_0xfbc5('0x76')]};}):_0x3ae08e[_0xfbc5('0x52')]=='boolean'?[{'name':_0xfbc5('0x77'),'value':'true'},{'name':_0xfbc5('0x78'),'value':_0xfbc5('0x79')}]:[]};})};}})[_0xfbc5('0x21')](respondWithResult(_0x45b6a1,null))[_0xfbc5('0x40')](function(_0x4eddb9){var _0x2c1e9f=_0x4da95b[_0xfbc5('0x2f')][_0xfbc5('0x7a')]?0x1f4:_0x4eddb9[_0xfbc5('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfbc5('0x56'),_0x2c1e9f,JSON[_0xfbc5('0x7c')](_0x4eddb9));delete _0x4eddb9[_0xfbc5('0x26')];if(_0x2c1e9f===0x191){_0x2c1e9f=0x190;}_0x45b6a1[_0xfbc5('0x19')](_0x2c1e9f)[_0xfbc5('0x27')](_0x4da95b[_0xfbc5('0x2f')][_0xfbc5('0x7a')]?{'message':_0xfbc5('0x7d'),'statusCode':_0x4eddb9[_0xfbc5('0x7b')]}:_0x4eddb9);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9f054f6..4a0db7b 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 _0xd19c=['rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd19c,0xd3));var _0xcd19=function(_0x71ef5c,_0x7b5528){_0x71ef5c=_0x71ef5c-0x0;var _0x1d34d0=_0xd19c[_0x71ef5c];return _0x1d34d0;};'use strict';var _=require(_0xcd19('0x0'));var util=require('util');var logger=require(_0xcd19('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcd19('0x2'));var rp=require(_0xcd19('0x3'));var fs=require('fs');var path=require(_0xcd19('0x4'));var rimraf=require(_0xcd19('0x5'));var config=require('../../config/environment');var attributes=require(_0xcd19('0x6'));var integrations=require(_0xcd19('0x7'));module[_0xcd19('0x8')]=function(_0x10a32b,_0x1aa36f){return _0x10a32b[_0xcd19('0x9')](_0xcd19('0xa'),attributes,{'tableName':_0xcd19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e03=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','api','moment'];(function(_0x4b2de5,_0x38e34a){var _0x1043ad=function(_0x23af71){while(--_0x23af71){_0x4b2de5['push'](_0x4b2de5['shift']());}};_0x1043ad(++_0x38e34a);}(_0x2e03,0xa2));var _0x32e0=function(_0xf1a5ba,_0x3e2722){_0xf1a5ba=_0xf1a5ba-0x0;var _0x4c7b1f=_0x2e03[_0xf1a5ba];return _0x4c7b1f;};'use strict';var _=require('lodash');var util=require(_0x32e0('0x0'));var logger=require('../../config/logger')(_0x32e0('0x1'));var moment=require(_0x32e0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32e0('0x3'));var rimraf=require(_0x32e0('0x4'));var config=require(_0x32e0('0x5'));var attributes=require(_0x32e0('0x6'));var integrations=require(_0x32e0('0x7'));module['exports']=function(_0x49dc2e,_0x13c8ff){return _0x49dc2e[_0x32e0('0x8')](_0x32e0('0x9'),attributes,{'tableName':_0x32e0('0xa'),'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 c1c4d83..ac60076 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 _0x1ff8=['jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','findAll','options','where','include','map','model','attributes','stringify','SalesforceAccount','find','ShowSalesforceAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5461de,_0x3e10be){var _0x3e294c=function(_0x479468){while(--_0x479468){_0x5461de['push'](_0x5461de['shift']());}};_0x3e294c(++_0x3e10be);}(_0x1ff8,0xab));var _0x81ff=function(_0x3473a6,_0x3bbf1d){_0x3473a6=_0x3473a6-0x0;var _0x587786=_0x1ff8[_0x3473a6];return _0x587786;};'use strict';var _=require(_0x81ff('0x0'));var util=require(_0x81ff('0x1'));var moment=require(_0x81ff('0x2'));var BPromise=require(_0x81ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81ff('0x4'))['db'];var utils=require(_0x81ff('0x5'));var logger=require(_0x81ff('0x6'))(_0x81ff('0x7'));var config=require(_0x81ff('0x8'));var jayson=require(_0x81ff('0x9'));var client=jayson[_0x81ff('0xa')][_0x81ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a58b3,_0x153eae,_0x170c4b){return new BPromise(function(_0x196db1,_0x12eb41){return client[_0x81ff('0xc')](_0x3a58b3,_0x170c4b)[_0x81ff('0xd')](function(_0x2fea9f){logger[_0x81ff('0xe')](_0x81ff('0xf'),_0x153eae,'request\x20sent');logger[_0x81ff('0x10')](_0x81ff('0x11'),_0x153eae,_0x81ff('0x12'),JSON['stringify'](_0x2fea9f));if(_0x2fea9f[_0x81ff('0x13')]){if(_0x2fea9f[_0x81ff('0x13')][_0x81ff('0x14')]===0x1f4){logger[_0x81ff('0x13')](_0x81ff('0xf'),_0x153eae,_0x2fea9f[_0x81ff('0x13')]['message']);return _0x12eb41(_0x2fea9f['error']['message']);}logger['error'](_0x81ff('0xf'),_0x153eae,_0x2fea9f[_0x81ff('0x13')]['message']);return _0x196db1(_0x2fea9f[_0x81ff('0x13')][_0x81ff('0x15')]);}else{logger['info'](_0x81ff('0xf'),_0x153eae,_0x81ff('0x12'));_0x196db1(_0x2fea9f[_0x81ff('0x16')]['message']);}})[_0x81ff('0x17')](function(_0x52cd83){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x153eae,_0x52cd83);_0x12eb41(_0x52cd83);});});}exports[_0x81ff('0x18')]=function(_0x46fc40){var _0x3adfc9=this;return new Promise(function(_0x577318,_0x3cecbb){return db['SalesforceAccount'][_0x81ff('0x19')]({'raw':_0x46fc40[_0x81ff('0x1a')]?_0x46fc40[_0x81ff('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x46fc40[_0x81ff('0x1a')]?_0x46fc40[_0x81ff('0x1a')][_0x81ff('0x1b')]||null:null,'attributes':_0x46fc40[_0x81ff('0x1a')]?_0x46fc40[_0x81ff('0x1a')]['attributes']||null:null,'limit':_0x46fc40['options']?_0x46fc40[_0x81ff('0x1a')]['limit']||null:null,'include':_0x46fc40[_0x81ff('0x1a')]?_0x46fc40[_0x81ff('0x1a')][_0x81ff('0x1c')]?_[_0x81ff('0x1d')](_0x46fc40[_0x81ff('0x1a')][_0x81ff('0x1c')],function(_0x4f8741){return{'model':db[_0x4f8741[_0x81ff('0x1e')]],'as':_0x4f8741['as'],'attributes':_0x4f8741['attributes'],'include':_0x4f8741[_0x81ff('0x1c')]?_[_0x81ff('0x1d')](_0x4f8741[_0x81ff('0x1c')],function(_0x5e0661){return{'model':db[_0x5e0661[_0x81ff('0x1e')]],'as':_0x5e0661['as'],'attributes':_0x5e0661[_0x81ff('0x1f')],'include':_0x5e0661[_0x81ff('0x1c')]?_[_0x81ff('0x1d')](_0x5e0661[_0x81ff('0x1c')],function(_0x34994b){return{'model':db[_0x34994b[_0x81ff('0x1e')]],'as':_0x34994b['as'],'attributes':_0x34994b[_0x81ff('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x81ff('0xd')](function(_0x354138){logger[_0x81ff('0xe')]('GetSalesforceAccount',_0x46fc40);logger[_0x81ff('0x10')](_0x81ff('0x18'),_0x46fc40,JSON[_0x81ff('0x20')](_0x354138));_0x577318(_0x354138);})['catch'](function(_0x1d076b){logger['error'](_0x81ff('0x18'),_0x1d076b[_0x81ff('0x15')],_0x46fc40);_0x3cecbb(_0x3adfc9['error'](0x1f4,_0x1d076b[_0x81ff('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x181d26){var _0x2b989c=this;return new Promise(function(_0x3abd44,_0x5881a4){return db[_0x81ff('0x21')][_0x81ff('0x22')]({'raw':_0x181d26[_0x81ff('0x1a')]?_0x181d26[_0x81ff('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x181d26['options']?_0x181d26[_0x81ff('0x1a')][_0x81ff('0x1b')]||null:null,'attributes':_0x181d26[_0x81ff('0x1a')]?_0x181d26['options'][_0x81ff('0x1f')]||null:null,'include':_0x181d26['options']?_0x181d26[_0x81ff('0x1a')][_0x81ff('0x1c')]?_[_0x81ff('0x1d')](_0x181d26['options'][_0x81ff('0x1c')],function(_0x4afad3){return{'model':db[_0x4afad3[_0x81ff('0x1e')]],'as':_0x4afad3['as'],'attributes':_0x4afad3[_0x81ff('0x1f')],'include':_0x4afad3[_0x81ff('0x1c')]?_['map'](_0x4afad3[_0x81ff('0x1c')],function(_0x45dfca){return{'model':db[_0x45dfca[_0x81ff('0x1e')]],'as':_0x45dfca['as'],'attributes':_0x45dfca[_0x81ff('0x1f')],'include':_0x45dfca[_0x81ff('0x1c')]?_[_0x81ff('0x1d')](_0x45dfca['include'],function(_0x3848af){return{'model':db[_0x3848af[_0x81ff('0x1e')]],'as':_0x3848af['as'],'attributes':_0x3848af['attributes']};}):[]};}):[]};}):[]:[]})[_0x81ff('0xd')](function(_0x520aa8){logger['info'](_0x81ff('0x23'),_0x181d26);logger[_0x81ff('0x10')](_0x81ff('0x23'),_0x181d26,JSON[_0x81ff('0x20')](_0x520aa8));_0x3abd44(_0x520aa8);})[_0x81ff('0x17')](function(_0x3bac3b){logger[_0x81ff('0x13')]('ShowSalesforceAccount',_0x3bac3b[_0x81ff('0x15')],_0x181d26);_0x5881a4(_0x2b989c[_0x81ff('0x13')](0x1f4,_0x3bac3b['message']));});});}; \ No newline at end of file +var _0x7556=['include','map','model','GetSalesforceAccount','ShowSalesforceAccount','find','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','SalesforceAccount','findAll','options','where','attributes','limit'];(function(_0x30994d,_0x2cc269){var _0x4554df=function(_0x125125){while(--_0x125125){_0x30994d['push'](_0x30994d['shift']());}};_0x4554df(++_0x2cc269);}(_0x7556,0x188));var _0x6755=function(_0x4a5eca,_0x490e50){_0x4a5eca=_0x4a5eca-0x0;var _0x3caf2f=_0x7556[_0x4a5eca];return _0x3caf2f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6755('0x0'));var rs=require(_0x6755('0x1'));var fs=require('fs');var Redis=require(_0x6755('0x2'));var db=require(_0x6755('0x3'))['db'];var utils=require(_0x6755('0x4'));var logger=require(_0x6755('0x5'))('rpc');var config=require(_0x6755('0x6'));var jayson=require(_0x6755('0x7'));var client=jayson[_0x6755('0x8')][_0x6755('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1af35b,_0xf19d89,_0x13a2e0){return new BPromise(function(_0x261e9e,_0x4900cd){return client[_0x6755('0xa')](_0x1af35b,_0x13a2e0)[_0x6755('0xb')](function(_0x32f838){logger[_0x6755('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0xf19d89,_0x6755('0xd'));logger[_0x6755('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xf19d89,'request\x20sent',JSON[_0x6755('0xf')](_0x32f838));if(_0x32f838[_0x6755('0x10')]){if(_0x32f838['error'][_0x6755('0x11')]===0x1f4){logger[_0x6755('0x10')](_0x6755('0x12'),_0xf19d89,_0x32f838[_0x6755('0x10')][_0x6755('0x13')]);return _0x4900cd(_0x32f838['error'][_0x6755('0x13')]);}logger['error'](_0x6755('0x12'),_0xf19d89,_0x32f838[_0x6755('0x10')][_0x6755('0x13')]);return _0x261e9e(_0x32f838[_0x6755('0x10')][_0x6755('0x13')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0xf19d89,_0x6755('0xd'));_0x261e9e(_0x32f838[_0x6755('0x14')][_0x6755('0x13')]);}})[_0x6755('0x15')](function(_0x3b5141){logger[_0x6755('0x10')](_0x6755('0x12'),_0xf19d89,_0x3b5141);_0x4900cd(_0x3b5141);});});}exports['GetSalesforceAccount']=function(_0x2ee4f5){var _0x2cc629=this;return new Promise(function(_0x3d2897,_0x478667){return db[_0x6755('0x16')][_0x6755('0x17')]({'raw':_0x2ee4f5[_0x6755('0x18')]?_0x2ee4f5['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ee4f5[_0x6755('0x18')]?_0x2ee4f5[_0x6755('0x18')][_0x6755('0x19')]||null:null,'attributes':_0x2ee4f5['options']?_0x2ee4f5[_0x6755('0x18')][_0x6755('0x1a')]||null:null,'limit':_0x2ee4f5['options']?_0x2ee4f5[_0x6755('0x18')][_0x6755('0x1b')]||null:null,'include':_0x2ee4f5[_0x6755('0x18')]?_0x2ee4f5[_0x6755('0x18')][_0x6755('0x1c')]?_[_0x6755('0x1d')](_0x2ee4f5[_0x6755('0x18')][_0x6755('0x1c')],function(_0x179135){return{'model':db[_0x179135['model']],'as':_0x179135['as'],'attributes':_0x179135[_0x6755('0x1a')],'include':_0x179135[_0x6755('0x1c')]?_[_0x6755('0x1d')](_0x179135[_0x6755('0x1c')],function(_0x372bac){return{'model':db[_0x372bac[_0x6755('0x1e')]],'as':_0x372bac['as'],'attributes':_0x372bac[_0x6755('0x1a')],'include':_0x372bac[_0x6755('0x1c')]?_[_0x6755('0x1d')](_0x372bac[_0x6755('0x1c')],function(_0x27d866){return{'model':db[_0x27d866[_0x6755('0x1e')]],'as':_0x27d866['as'],'attributes':_0x27d866['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18ece3){logger[_0x6755('0xc')](_0x6755('0x1f'),_0x2ee4f5);logger[_0x6755('0xe')](_0x6755('0x1f'),_0x2ee4f5,JSON[_0x6755('0xf')](_0x18ece3));_0x3d2897(_0x18ece3);})[_0x6755('0x15')](function(_0x41a1b2){logger[_0x6755('0x10')](_0x6755('0x1f'),_0x41a1b2[_0x6755('0x13')],_0x2ee4f5);_0x478667(_0x2cc629[_0x6755('0x10')](0x1f4,_0x41a1b2[_0x6755('0x13')]));});});};exports[_0x6755('0x20')]=function(_0x15b271){var _0x1fea0c=this;return new Promise(function(_0x21db2b,_0x2d997b){return db[_0x6755('0x16')][_0x6755('0x21')]({'raw':_0x15b271['options']?_0x15b271[_0x6755('0x18')][_0x6755('0x22')]===undefined?!![]:![]:!![],'where':_0x15b271['options']?_0x15b271['options']['where']||null:null,'attributes':_0x15b271[_0x6755('0x18')]?_0x15b271[_0x6755('0x18')][_0x6755('0x1a')]||null:null,'include':_0x15b271[_0x6755('0x18')]?_0x15b271[_0x6755('0x18')][_0x6755('0x1c')]?_[_0x6755('0x1d')](_0x15b271[_0x6755('0x18')]['include'],function(_0x40cb22){return{'model':db[_0x40cb22[_0x6755('0x1e')]],'as':_0x40cb22['as'],'attributes':_0x40cb22[_0x6755('0x1a')],'include':_0x40cb22[_0x6755('0x1c')]?_[_0x6755('0x1d')](_0x40cb22['include'],function(_0x2e07ae){return{'model':db[_0x2e07ae[_0x6755('0x1e')]],'as':_0x2e07ae['as'],'attributes':_0x2e07ae[_0x6755('0x1a')],'include':_0x2e07ae[_0x6755('0x1c')]?_[_0x6755('0x1d')](_0x2e07ae[_0x6755('0x1c')],function(_0x47382c){return{'model':db[_0x47382c[_0x6755('0x1e')]],'as':_0x47382c['as'],'attributes':_0x47382c[_0x6755('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6755('0xb')](function(_0x268133){logger[_0x6755('0xc')](_0x6755('0x20'),_0x15b271);logger[_0x6755('0xe')](_0x6755('0x20'),_0x15b271,JSON[_0x6755('0xf')](_0x268133));_0x21db2b(_0x268133);})[_0x6755('0x15')](function(_0x55cd97){logger[_0x6755('0x10')](_0x6755('0x20'),_0x55cd97[_0x6755('0x13')],_0x15b271);_0x2d997b(_0x1fea0c[_0x6755('0x10')](0x1f4,_0x55cd97[_0x6755('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5ebd0c2..bc33bb5 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2a4409,_0x598e45){var _0x11fa80=function(_0x3e5346){while(--_0x3e5346){_0x2a4409['push'](_0x2a4409['shift']());}};_0x11fa80(++_0x598e45);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x30f0f4,_0x34bcc0){var _0xd1c482=function(_0xe24325){while(--_0xe24325){_0x30f0f4['push'](_0x30f0f4['shift']());}};_0xd1c482(++_0x34bcc0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a510b,_0x5db1ec){_0x2a510b=_0x2a510b-0x0;var _0xae024d=_0x5f2f[_0x2a510b];return _0xae024d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 6ad2dbb..0c412cf 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 _0x6a54=['account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task','contact_lead','contact','lead'];(function(_0x4a2540,_0x381967){var _0x26ceda=function(_0x1a0b75){while(--_0x1a0b75){_0x4a2540['push'](_0x4a2540['shift']());}};_0x26ceda(++_0x381967);}(_0x6a54,0x7c));var _0x46a5=function(_0x3f7f15,_0x25a939){_0x3f7f15=_0x3f7f15-0x0;var _0x4d3a36=_0x6a54[_0x3f7f15];return _0x4d3a36;};'use strict';var Sequelize=require(_0x46a5('0x0'));module[_0x46a5('0x1')]={'name':{'type':Sequelize[_0x46a5('0x2')]},'description':{'type':Sequelize[_0x46a5('0x2')]},'ticketType':{'type':Sequelize[_0x46a5('0x3')](_0x46a5('0x4'),'Case'),'defaultValue':_0x46a5('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x46a5('0x5'),_0x46a5('0x6'),_0x46a5('0x7'),_0x46a5('0x8'),_0x46a5('0x9')),'defaultValue':_0x46a5('0x5')},'moduleCreate':{'type':Sequelize[_0x46a5('0x3')](_0x46a5('0xa'),_0x46a5('0x6'),_0x46a5('0x7'),_0x46a5('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x46a5('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x46a5('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x46a5('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x46a5('0x2')]}}; \ No newline at end of file +var _0xfb89=['nothing','STRING','ENUM','Task','Case','contact_lead','contact','lead','account'];(function(_0x145011,_0x3eb4ef){var _0x3cb5af=function(_0x17d2e4){while(--_0x17d2e4){_0x145011['push'](_0x145011['shift']());}};_0x3cb5af(++_0x3eb4ef);}(_0xfb89,0x196));var _0x9fb8=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0xfb89[_0x4191bc];return _0x1ffd4e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9fb8('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9fb8('0x1')](_0x9fb8('0x2'),_0x9fb8('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x9fb8('0x4'),_0x9fb8('0x5'),_0x9fb8('0x6'),'account_contact_lead',_0x9fb8('0x7')),'defaultValue':_0x9fb8('0x4')},'moduleCreate':{'type':Sequelize[_0x9fb8('0x1')](_0x9fb8('0x8'),_0x9fb8('0x5'),'lead',_0x9fb8('0x7')),'defaultValue':_0x9fb8('0x6')},'leadId':{'type':Sequelize[_0x9fb8('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x9fb8('0x0')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x9fb8('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ae564f6..25e5cc6 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 _0x0064=['findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getFields','findOne','SalesforceField','pick','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x4b9d34,_0x515c3a){var _0x2d9598=function(_0x11b740){while(--_0x11b740){_0x4b9d34['push'](_0x4b9d34['shift']());}};_0x2d9598(++_0x515c3a);}(_0x0064,0x68));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4006('0x0'));var zipdir=require(_0x4006('0x1'));var jsonpatch=require(_0x4006('0x2'));var rp=require(_0x4006('0x3'));var moment=require(_0x4006('0x4'));var BPromise=require(_0x4006('0x5'));var Mustache=require('mustache');var util=require(_0x4006('0x6'));var path=require('path');var sox=require(_0x4006('0x7'));var csv=require(_0x4006('0x8'));var ejs=require(_0x4006('0x9'));var fs=require('fs');var fs_extra=require(_0x4006('0xa'));var _=require(_0x4006('0xb'));var squel=require(_0x4006('0xc'));var crypto=require(_0x4006('0xd'));var jsforce=require(_0x4006('0xe'));var deskjs=require(_0x4006('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4006('0x10'));var Redis=require(_0x4006('0x11'));var authService=require(_0x4006('0x12'));var qs=require(_0x4006('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4006('0x14'));var logger=require(_0x4006('0x15'))(_0x4006('0x16'));var utils=require(_0x4006('0x17'));var config=require(_0x4006('0x18'));var licenseUtil=require(_0x4006('0x19'));var db=require(_0x4006('0x1a'))['db'];function respondWithStatusCode(_0x2a3cef,_0x5d8e3e){_0x5d8e3e=_0x5d8e3e||0xcc;return function(_0x16fe72){if(_0x16fe72){return _0x2a3cef['sendStatus'](_0x5d8e3e);}return _0x2a3cef[_0x4006('0x1b')](_0x5d8e3e)[_0x4006('0x1c')]();};}function respondWithResult(_0x3f91db,_0x45ffd0){_0x45ffd0=_0x45ffd0||0xc8;return function(_0x4a63a1){if(_0x4a63a1){return _0x3f91db[_0x4006('0x1b')](_0x45ffd0)[_0x4006('0x1d')](_0x4a63a1);}};}function respondWithFilteredResult(_0x269f3a,_0x363704){return function(_0x127e11){if(_0x127e11){var _0x171fb5=typeof _0x363704[_0x4006('0x1e')]===_0x4006('0x1f')&&typeof _0x363704[_0x4006('0x20')]===_0x4006('0x1f');var _0x44d221=_0x127e11[_0x4006('0x21')];var _0x20f0b3=_0x171fb5?0x0:_0x363704[_0x4006('0x1e')];var _0x5dc85c=_0x171fb5?_0x127e11['count']:_0x363704['offset']+_0x363704[_0x4006('0x20')];var _0x12e89d;if(_0x5dc85c>=_0x44d221){_0x5dc85c=_0x44d221;_0x12e89d=0xc8;}else{_0x12e89d=0xce;}_0x269f3a[_0x4006('0x1b')](_0x12e89d);return _0x269f3a[_0x4006('0x22')](_0x4006('0x23'),_0x20f0b3+'-'+_0x5dc85c+'/'+_0x44d221)[_0x4006('0x1d')](_0x127e11);}return null;};}function patchUpdates(_0x53dfd4){return function(_0x17f583){try{jsonpatch[_0x4006('0x24')](_0x17f583,_0x53dfd4,!![]);}catch(_0xf960db){return BPromise[_0x4006('0x25')](_0xf960db);}return _0x17f583[_0x4006('0x26')]();};}function saveUpdates(_0xc7028d,_0x5019d6){return function(_0xb721d2){if(_0xb721d2){return _0xb721d2[_0x4006('0x27')](_0xc7028d)[_0x4006('0x28')](function(_0x363f7a){return _0x363f7a;});}return null;};}function removeEntity(_0x507d91,_0x32ce8d){return function(_0x3982dc){if(_0x3982dc){return _0x3982dc['destroy']()[_0x4006('0x28')](function(){_0x507d91['status'](0xcc)[_0x4006('0x1c')]();});}};}function handleEntityNotFound(_0x27ce2d,_0x144b7b){return function(_0x595216){if(!_0x595216){_0x27ce2d[_0x4006('0x29')](0x194);}return _0x595216;};}function handleError(_0x31b633,_0x355c78){_0x355c78=_0x355c78||0x1f4;return function(_0x3216da){logger[_0x4006('0x2a')](_0x3216da[_0x4006('0x2b')]);if(_0x3216da[_0x4006('0x2c')]){delete _0x3216da['name'];}_0x31b633[_0x4006('0x1b')](_0x355c78)[_0x4006('0x2d')](_0x3216da);};}exports[_0x4006('0x2e')]=function(_0x5ce70f,_0x2eeb42){var _0x15fb9e={},_0x4d8bf0={},_0x36b034={'count':0x0,'rows':[]};var _0x4d9116=_[_0x4006('0x2f')](db[_0x4006('0x30')]['rawAttributes'],function(_0x1cb319){return{'name':_0x1cb319[_0x4006('0x31')],'type':_0x1cb319[_0x4006('0x32')][_0x4006('0x33')]};});_0x4d8bf0['model']=_[_0x4006('0x2f')](_0x4d9116,_0x4006('0x2c'));_0x4d8bf0[_0x4006('0x34')]=_[_0x4006('0x35')](_0x5ce70f[_0x4006('0x34')]);_0x4d8bf0[_0x4006('0x36')]=_[_0x4006('0x37')](_0x4d8bf0[_0x4006('0x38')],_0x4d8bf0[_0x4006('0x34')]);_0x15fb9e[_0x4006('0x39')]=_[_0x4006('0x37')](_0x4d8bf0['model'],qs['fields'](_0x5ce70f['query'][_0x4006('0x3a')]));_0x15fb9e[_0x4006('0x39')]=_0x15fb9e[_0x4006('0x39')][_0x4006('0x3b')]?_0x15fb9e[_0x4006('0x39')]:_0x4d8bf0[_0x4006('0x38')];if(!_0x5ce70f[_0x4006('0x34')]['hasOwnProperty'](_0x4006('0x3c'))){_0x15fb9e[_0x4006('0x20')]=qs[_0x4006('0x20')](_0x5ce70f[_0x4006('0x34')][_0x4006('0x20')]);_0x15fb9e[_0x4006('0x1e')]=qs['offset'](_0x5ce70f['query'][_0x4006('0x1e')]);}_0x15fb9e[_0x4006('0x3d')]=qs[_0x4006('0x3e')](_0x5ce70f[_0x4006('0x34')]['sort']);_0x15fb9e[_0x4006('0x3f')]=qs[_0x4006('0x36')](_['pick'](_0x5ce70f['query'],_0x4d8bf0[_0x4006('0x36')]),_0x4d9116);if(_0x5ce70f[_0x4006('0x34')][_0x4006('0x40')]){_0x15fb9e[_0x4006('0x3f')]=_[_0x4006('0x41')](_0x15fb9e[_0x4006('0x3f')],{'$or':_[_0x4006('0x2f')](_0x4d9116,function(_0x335f86){if(_0x335f86[_0x4006('0x32')]!==_0x4006('0x42')){var _0x35819={};_0x35819[_0x335f86['name']]={'$like':'%'+_0x5ce70f['query']['filter']+'%'};return _0x35819;}})});}_0x15fb9e=_['merge']({},_0x15fb9e,_0x5ce70f[_0x4006('0x43')]);var _0xca6a05={'where':_0x15fb9e[_0x4006('0x3f')]};return db[_0x4006('0x30')][_0x4006('0x21')](_0xca6a05)[_0x4006('0x28')](function(_0xb9a56d){_0x36b034['count']=_0xb9a56d;if(_0x5ce70f['query'][_0x4006('0x44')]){_0x15fb9e[_0x4006('0x45')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x4006('0x46')](_0x15fb9e);})[_0x4006('0x28')](function(_0x395d98){_0x36b034[_0x4006('0x47')]=_0x395d98;return _0x36b034;})[_0x4006('0x28')](respondWithFilteredResult(_0x2eeb42,_0x15fb9e))[_0x4006('0x48')](handleError(_0x2eeb42,null));};exports[_0x4006('0x49')]=function(_0x302fee,_0x47951b){var _0x47a866={'raw':![],'where':{'id':_0x302fee[_0x4006('0x4a')]['id']}},_0x3ace54={};_0x3ace54[_0x4006('0x38')]=_[_0x4006('0x35')](db[_0x4006('0x30')][_0x4006('0x4b')]);_0x3ace54[_0x4006('0x34')]=_[_0x4006('0x35')](_0x302fee[_0x4006('0x34')]);_0x3ace54[_0x4006('0x36')]=_['intersection'](_0x3ace54[_0x4006('0x38')],_0x3ace54[_0x4006('0x34')]);_0x47a866[_0x4006('0x39')]=_[_0x4006('0x37')](_0x3ace54[_0x4006('0x38')],qs[_0x4006('0x3a')](_0x302fee['query'][_0x4006('0x3a')]));_0x47a866[_0x4006('0x39')]=_0x47a866['attributes']['length']?_0x47a866[_0x4006('0x39')]:_0x3ace54[_0x4006('0x38')];if(_0x302fee[_0x4006('0x34')]['includeAll']){_0x47a866['include']=[{'all':!![]}];}_0x47a866=_[_0x4006('0x41')]({},_0x47a866,_0x302fee[_0x4006('0x43')]);return db[_0x4006('0x30')][_0x4006('0x4c')](_0x47a866)[_0x4006('0x28')](handleEntityNotFound(_0x47951b,null))[_0x4006('0x28')](respondWithResult(_0x47951b,null))[_0x4006('0x48')](handleError(_0x47951b,null));};exports[_0x4006('0x4d')]=function(_0x404d1b,_0x1754de){return db[_0x4006('0x30')][_0x4006('0x4d')](_0x404d1b[_0x4006('0x4e')],{})[_0x4006('0x28')](respondWithResult(_0x1754de,0xc9))['catch'](handleError(_0x1754de,null));};exports[_0x4006('0x27')]=function(_0x8a8a20,_0x4643c4){if(_0x8a8a20['body']['id']){delete _0x8a8a20[_0x4006('0x4e')]['id'];}return db[_0x4006('0x30')][_0x4006('0x4c')]({'where':{'id':_0x8a8a20[_0x4006('0x4a')]['id']}})[_0x4006('0x28')](handleEntityNotFound(_0x4643c4,null))[_0x4006('0x28')](saveUpdates(_0x8a8a20['body'],null))[_0x4006('0x28')](respondWithResult(_0x4643c4,null))[_0x4006('0x48')](handleError(_0x4643c4,null));};exports[_0x4006('0x4f')]=function(_0x3d08b1,_0x2a713a){return db[_0x4006('0x30')][_0x4006('0x4c')]({'where':{'id':_0x3d08b1[_0x4006('0x4a')]['id']}})[_0x4006('0x28')](handleEntityNotFound(_0x2a713a,null))[_0x4006('0x28')](removeEntity(_0x2a713a,null))['catch'](handleError(_0x2a713a,null));};exports[_0x4006('0x50')]=function(_0x595c92,_0x30dac6,_0x67d1ba){var _0x136d17={};var _0x3dfdf5={};var _0x10e901;var _0x943115;return db[_0x4006('0x30')][_0x4006('0x51')]({'where':{'id':_0x595c92[_0x4006('0x4a')]['id']}})[_0x4006('0x28')](handleEntityNotFound(_0x30dac6,null))['then'](function(_0x366629){if(_0x366629){_0x10e901=_0x366629;_0x3dfdf5[_0x4006('0x38')]=_[_0x4006('0x35')](db[_0x4006('0x52')][_0x4006('0x4b')]);_0x3dfdf5['query']=_['keys'](_0x595c92['query']);_0x3dfdf5[_0x4006('0x36')]=_[_0x4006('0x37')](_0x3dfdf5[_0x4006('0x38')],_0x3dfdf5[_0x4006('0x34')]);_0x136d17['attributes']=_[_0x4006('0x37')](_0x3dfdf5['model'],qs[_0x4006('0x3a')](_0x595c92[_0x4006('0x34')][_0x4006('0x3a')]));_0x136d17[_0x4006('0x39')]=_0x136d17[_0x4006('0x39')][_0x4006('0x3b')]?_0x136d17[_0x4006('0x39')]:_0x3dfdf5['model'];_0x136d17[_0x4006('0x3d')]=qs['sort'](_0x595c92['query'][_0x4006('0x3e')]);_0x136d17[_0x4006('0x3f')]=qs[_0x4006('0x36')](_[_0x4006('0x53')](_0x595c92[_0x4006('0x34')],_0x3dfdf5[_0x4006('0x36')]));if(_0x595c92['query']['filter']){_0x136d17['where']=_[_0x4006('0x41')](_0x136d17['where'],{'$or':_[_0x4006('0x2f')](_0x136d17[_0x4006('0x39')],function(_0x492611){var _0x42440b={};_0x42440b[_0x492611]={'$like':'%'+_0x595c92[_0x4006('0x34')][_0x4006('0x40')]+'%'};return _0x42440b;})});}_0x136d17=_[_0x4006('0x41')]({},_0x136d17,_0x595c92[_0x4006('0x43')]);return _0x10e901[_0x4006('0x50')](_0x136d17);}})[_0x4006('0x28')](function(_0x1b5c35){if(_0x1b5c35){_0x943115=_0x1b5c35[_0x4006('0x3b')];if(!_0x595c92[_0x4006('0x34')][_0x4006('0x54')](_0x4006('0x3c'))){_0x136d17[_0x4006('0x20')]=qs[_0x4006('0x20')](_0x595c92[_0x4006('0x34')][_0x4006('0x20')]);_0x136d17[_0x4006('0x1e')]=qs[_0x4006('0x1e')](_0x595c92['query']['offset']);}return _0x10e901['getFields'](_0x136d17);}})[_0x4006('0x28')](function(_0x50793a){if(_0x50793a){return _0x50793a?{'count':_0x943115,'rows':_0x50793a}:null;}})[_0x4006('0x28')](respondWithResult(_0x30dac6,null))['catch'](handleError(_0x30dac6,null));};exports['getSubjects']=function(_0x3b07d2,_0x401f21,_0x494dc6){var _0x48d8ec={};var _0x7b5a9e={};var _0x31f548;var _0x3d66bb;return db[_0x4006('0x30')]['findOne']({'where':{'id':_0x3b07d2[_0x4006('0x4a')]['id']}})[_0x4006('0x28')](handleEntityNotFound(_0x401f21,null))[_0x4006('0x28')](function(_0x2f4507){if(_0x2f4507){_0x31f548=_0x2f4507;_0x7b5a9e[_0x4006('0x38')]=_[_0x4006('0x35')](db[_0x4006('0x52')][_0x4006('0x4b')]);_0x7b5a9e[_0x4006('0x34')]=_['keys'](_0x3b07d2['query']);_0x7b5a9e[_0x4006('0x36')]=_['intersection'](_0x7b5a9e[_0x4006('0x38')],_0x7b5a9e['query']);_0x48d8ec[_0x4006('0x39')]=_[_0x4006('0x37')](_0x7b5a9e[_0x4006('0x38')],qs[_0x4006('0x3a')](_0x3b07d2['query'][_0x4006('0x3a')]));_0x48d8ec[_0x4006('0x39')]=_0x48d8ec[_0x4006('0x39')][_0x4006('0x3b')]?_0x48d8ec[_0x4006('0x39')]:_0x7b5a9e[_0x4006('0x38')];_0x48d8ec[_0x4006('0x3d')]=qs[_0x4006('0x3e')](_0x3b07d2['query'][_0x4006('0x3e')]);_0x48d8ec[_0x4006('0x3f')]=qs[_0x4006('0x36')](_[_0x4006('0x53')](_0x3b07d2['query'],_0x7b5a9e['filters']));if(_0x3b07d2[_0x4006('0x34')]['filter']){_0x48d8ec[_0x4006('0x3f')]=_[_0x4006('0x41')](_0x48d8ec['where'],{'$or':_[_0x4006('0x2f')](_0x48d8ec[_0x4006('0x39')],function(_0x171dde){var _0x5b2645={};_0x5b2645[_0x171dde]={'$like':'%'+_0x3b07d2[_0x4006('0x34')][_0x4006('0x40')]+'%'};return _0x5b2645;})});}_0x48d8ec=_[_0x4006('0x41')]({},_0x48d8ec,_0x3b07d2['options']);return _0x31f548[_0x4006('0x55')](_0x48d8ec);}})[_0x4006('0x28')](function(_0x111285){if(_0x111285){_0x3d66bb=_0x111285[_0x4006('0x3b')];if(!_0x3b07d2[_0x4006('0x34')]['hasOwnProperty'](_0x4006('0x3c'))){_0x48d8ec[_0x4006('0x20')]=qs['limit'](_0x3b07d2[_0x4006('0x34')][_0x4006('0x20')]);_0x48d8ec['offset']=qs[_0x4006('0x1e')](_0x3b07d2[_0x4006('0x34')][_0x4006('0x1e')]);}return _0x31f548[_0x4006('0x55')](_0x48d8ec);}})[_0x4006('0x28')](function(_0x2bd658){if(_0x2bd658){return _0x2bd658?{'count':_0x3d66bb,'rows':_0x2bd658}:null;}})['then'](respondWithResult(_0x401f21,null))['catch'](handleError(_0x401f21,null));};exports['getDescriptions']=function(_0x37b401,_0x7729fd,_0xf99519){var _0x4c9332={};var _0x78e808={};var _0x363960;var _0x4ea50a;return db[_0x4006('0x30')][_0x4006('0x51')]({'where':{'id':_0x37b401[_0x4006('0x4a')]['id']}})[_0x4006('0x28')](handleEntityNotFound(_0x7729fd,null))['then'](function(_0xc88261){if(_0xc88261){_0x363960=_0xc88261;_0x78e808[_0x4006('0x38')]=_[_0x4006('0x35')](db['SalesforceField'][_0x4006('0x4b')]);_0x78e808[_0x4006('0x34')]=_['keys'](_0x37b401[_0x4006('0x34')]);_0x78e808[_0x4006('0x36')]=_['intersection'](_0x78e808['model'],_0x78e808[_0x4006('0x34')]);_0x4c9332[_0x4006('0x39')]=_[_0x4006('0x37')](_0x78e808[_0x4006('0x38')],qs['fields'](_0x37b401[_0x4006('0x34')][_0x4006('0x3a')]));_0x4c9332[_0x4006('0x39')]=_0x4c9332[_0x4006('0x39')][_0x4006('0x3b')]?_0x4c9332['attributes']:_0x78e808[_0x4006('0x38')];_0x4c9332[_0x4006('0x3d')]=qs[_0x4006('0x3e')](_0x37b401[_0x4006('0x34')][_0x4006('0x3e')]);_0x4c9332[_0x4006('0x3f')]=qs['filters'](_[_0x4006('0x53')](_0x37b401[_0x4006('0x34')],_0x78e808[_0x4006('0x36')]));if(_0x37b401['query']['filter']){_0x4c9332[_0x4006('0x3f')]=_[_0x4006('0x41')](_0x4c9332[_0x4006('0x3f')],{'$or':_[_0x4006('0x2f')](_0x4c9332[_0x4006('0x39')],function(_0x501e45){var _0x51a51e={};_0x51a51e[_0x501e45]={'$like':'%'+_0x37b401[_0x4006('0x34')][_0x4006('0x40')]+'%'};return _0x51a51e;})});}_0x4c9332=_[_0x4006('0x41')]({},_0x4c9332,_0x37b401[_0x4006('0x43')]);return _0x363960['getDescriptions'](_0x4c9332);}})['then'](function(_0x4287da){if(_0x4287da){_0x4ea50a=_0x4287da['length'];if(!_0x37b401[_0x4006('0x34')][_0x4006('0x54')]('nolimit')){_0x4c9332[_0x4006('0x20')]=qs[_0x4006('0x20')](_0x37b401[_0x4006('0x34')][_0x4006('0x20')]);_0x4c9332[_0x4006('0x1e')]=qs[_0x4006('0x1e')](_0x37b401[_0x4006('0x34')][_0x4006('0x1e')]);}return _0x363960[_0x4006('0x56')](_0x4c9332);}})['then'](function(_0x25fed9){if(_0x25fed9){return _0x25fed9?{'count':_0x4ea50a,'rows':_0x25fed9}:null;}})[_0x4006('0x28')](respondWithResult(_0x7729fd,null))['catch'](handleError(_0x7729fd,null));}; \ No newline at end of file +var _0x8796=['error','stack','name','send','index','map','rawAttributes','key','keys','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','SalesforceConfiguration','findAll','catch','show','params','intersection','find','create','body','findOne','SalesforceField','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8796,0xcd));var _0x6879=function(_0x24ba0f,_0x3931e6){_0x24ba0f=_0x24ba0f-0x0;var _0x2073a6=_0x8796[_0x24ba0f];return _0x2073a6;};'use strict';var emlformat=require(_0x6879('0x0'));var rimraf=require(_0x6879('0x1'));var zipdir=require(_0x6879('0x2'));var jsonpatch=require(_0x6879('0x3'));var rp=require('request-promise');var moment=require(_0x6879('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6879('0x5'));var path=require(_0x6879('0x6'));var sox=require(_0x6879('0x7'));var csv=require(_0x6879('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6879('0x9'));var _=require(_0x6879('0xa'));var squel=require(_0x6879('0xb'));var crypto=require(_0x6879('0xc'));var jsforce=require(_0x6879('0xd'));var deskjs=require(_0x6879('0xe'));var toCsv=require(_0x6879('0x8'));var querystring=require(_0x6879('0xf'));var Papa=require(_0x6879('0x10'));var Redis=require(_0x6879('0x11'));var authService=require(_0x6879('0x12'));var qs=require(_0x6879('0x13'));var as=require(_0x6879('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6879('0x15'))(_0x6879('0x16'));var utils=require(_0x6879('0x17'));var config=require(_0x6879('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6879('0x19'))['db'];function respondWithStatusCode(_0x318641,_0x194ca6){_0x194ca6=_0x194ca6||0xcc;return function(_0x273efa){if(_0x273efa){return _0x318641[_0x6879('0x1a')](_0x194ca6);}return _0x318641[_0x6879('0x1b')](_0x194ca6)[_0x6879('0x1c')]();};}function respondWithResult(_0x4edb5d,_0x4a8654){_0x4a8654=_0x4a8654||0xc8;return function(_0x119944){if(_0x119944){return _0x4edb5d[_0x6879('0x1b')](_0x4a8654)[_0x6879('0x1d')](_0x119944);}};}function respondWithFilteredResult(_0x3f0461,_0x15dc85){return function(_0x4b2de1){if(_0x4b2de1){var _0x32868=typeof _0x15dc85['offset']===_0x6879('0x1e')&&typeof _0x15dc85[_0x6879('0x1f')]==='undefined';var _0x38b613=_0x4b2de1[_0x6879('0x20')];var _0x381ffd=_0x32868?0x0:_0x15dc85[_0x6879('0x21')];var _0x38fded=_0x32868?_0x4b2de1[_0x6879('0x20')]:_0x15dc85['offset']+_0x15dc85[_0x6879('0x1f')];var _0x1378f0;if(_0x38fded>=_0x38b613){_0x38fded=_0x38b613;_0x1378f0=0xc8;}else{_0x1378f0=0xce;}_0x3f0461[_0x6879('0x1b')](_0x1378f0);return _0x3f0461[_0x6879('0x22')](_0x6879('0x23'),_0x381ffd+'-'+_0x38fded+'/'+_0x38b613)[_0x6879('0x1d')](_0x4b2de1);}return null;};}function patchUpdates(_0x1aa076){return function(_0x3c01c2){try{jsonpatch[_0x6879('0x24')](_0x3c01c2,_0x1aa076,!![]);}catch(_0x40a463){return BPromise[_0x6879('0x25')](_0x40a463);}return _0x3c01c2[_0x6879('0x26')]();};}function saveUpdates(_0x2d00e0,_0x2fdf56){return function(_0x528b0a){if(_0x528b0a){return _0x528b0a['update'](_0x2d00e0)[_0x6879('0x27')](function(_0x4e6409){return _0x4e6409;});}return null;};}function removeEntity(_0x5b7bc2,_0x164470){return function(_0x3c9908){if(_0x3c9908){return _0x3c9908[_0x6879('0x28')]()[_0x6879('0x27')](function(){_0x5b7bc2[_0x6879('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b95b,_0x30d846){return function(_0x246edb){if(!_0x246edb){_0x49b95b[_0x6879('0x1a')](0x194);}return _0x246edb;};}function handleError(_0x32fb96,_0x21cd13){_0x21cd13=_0x21cd13||0x1f4;return function(_0x214b24){logger[_0x6879('0x29')](_0x214b24[_0x6879('0x2a')]);if(_0x214b24[_0x6879('0x2b')]){delete _0x214b24[_0x6879('0x2b')];}_0x32fb96[_0x6879('0x1b')](_0x21cd13)[_0x6879('0x2c')](_0x214b24);};}exports[_0x6879('0x2d')]=function(_0x395070,_0x5184ee){var _0x3dee51={},_0x195c11={},_0x5645e4={'count':0x0,'rows':[]};var _0x269883=_[_0x6879('0x2e')](db['SalesforceConfiguration'][_0x6879('0x2f')],function(_0x26a37a){return{'name':_0x26a37a['fieldName'],'type':_0x26a37a['type'][_0x6879('0x30')]};});_0x195c11['model']=_[_0x6879('0x2e')](_0x269883,_0x6879('0x2b'));_0x195c11['query']=_[_0x6879('0x31')](_0x395070[_0x6879('0x32')]);_0x195c11[_0x6879('0x33')]=_['intersection'](_0x195c11[_0x6879('0x34')],_0x195c11[_0x6879('0x32')]);_0x3dee51[_0x6879('0x35')]=_['intersection'](_0x195c11[_0x6879('0x34')],qs[_0x6879('0x36')](_0x395070[_0x6879('0x32')]['fields']));_0x3dee51[_0x6879('0x35')]=_0x3dee51[_0x6879('0x35')][_0x6879('0x37')]?_0x3dee51[_0x6879('0x35')]:_0x195c11['model'];if(!_0x395070[_0x6879('0x32')]['hasOwnProperty'](_0x6879('0x38'))){_0x3dee51[_0x6879('0x1f')]=qs[_0x6879('0x1f')](_0x395070[_0x6879('0x32')][_0x6879('0x1f')]);_0x3dee51[_0x6879('0x21')]=qs[_0x6879('0x21')](_0x395070[_0x6879('0x32')]['offset']);}_0x3dee51[_0x6879('0x39')]=qs[_0x6879('0x3a')](_0x395070[_0x6879('0x32')][_0x6879('0x3a')]);_0x3dee51[_0x6879('0x3b')]=qs[_0x6879('0x33')](_[_0x6879('0x3c')](_0x395070['query'],_0x195c11[_0x6879('0x33')]),_0x269883);if(_0x395070[_0x6879('0x32')][_0x6879('0x3d')]){_0x3dee51[_0x6879('0x3b')]=_[_0x6879('0x3e')](_0x3dee51[_0x6879('0x3b')],{'$or':_[_0x6879('0x2e')](_0x269883,function(_0x5488aa){if(_0x5488aa[_0x6879('0x3f')]!=='VIRTUAL'){var _0x2e2935={};_0x2e2935[_0x5488aa[_0x6879('0x2b')]]={'$like':'%'+_0x395070[_0x6879('0x32')][_0x6879('0x3d')]+'%'};return _0x2e2935;}})});}_0x3dee51=_[_0x6879('0x3e')]({},_0x3dee51,_0x395070[_0x6879('0x40')]);var _0x376269={'where':_0x3dee51['where']};return db['SalesforceConfiguration'][_0x6879('0x20')](_0x376269)['then'](function(_0x3a154a){_0x5645e4['count']=_0x3a154a;if(_0x395070[_0x6879('0x32')][_0x6879('0x41')]){_0x3dee51[_0x6879('0x42')]=[{'all':!![]}];}return db[_0x6879('0x43')][_0x6879('0x44')](_0x3dee51);})[_0x6879('0x27')](function(_0x3b2246){_0x5645e4['rows']=_0x3b2246;return _0x5645e4;})['then'](respondWithFilteredResult(_0x5184ee,_0x3dee51))[_0x6879('0x45')](handleError(_0x5184ee,null));};exports[_0x6879('0x46')]=function(_0x2ae661,_0xfb8239){var _0x58020e={'raw':![],'where':{'id':_0x2ae661[_0x6879('0x47')]['id']}},_0xe845c3={};_0xe845c3[_0x6879('0x34')]=_[_0x6879('0x31')](db['SalesforceConfiguration'][_0x6879('0x2f')]);_0xe845c3[_0x6879('0x32')]=_[_0x6879('0x31')](_0x2ae661[_0x6879('0x32')]);_0xe845c3[_0x6879('0x33')]=_[_0x6879('0x48')](_0xe845c3[_0x6879('0x34')],_0xe845c3[_0x6879('0x32')]);_0x58020e['attributes']=_[_0x6879('0x48')](_0xe845c3[_0x6879('0x34')],qs[_0x6879('0x36')](_0x2ae661[_0x6879('0x32')]['fields']));_0x58020e[_0x6879('0x35')]=_0x58020e[_0x6879('0x35')][_0x6879('0x37')]?_0x58020e[_0x6879('0x35')]:_0xe845c3[_0x6879('0x34')];if(_0x2ae661[_0x6879('0x32')][_0x6879('0x41')]){_0x58020e[_0x6879('0x42')]=[{'all':!![]}];}_0x58020e=_[_0x6879('0x3e')]({},_0x58020e,_0x2ae661[_0x6879('0x40')]);return db[_0x6879('0x43')][_0x6879('0x49')](_0x58020e)[_0x6879('0x27')](handleEntityNotFound(_0xfb8239,null))[_0x6879('0x27')](respondWithResult(_0xfb8239,null))[_0x6879('0x45')](handleError(_0xfb8239,null));};exports[_0x6879('0x4a')]=function(_0x34f4f9,_0x4aa098){return db[_0x6879('0x43')][_0x6879('0x4a')](_0x34f4f9[_0x6879('0x4b')],{})[_0x6879('0x27')](respondWithResult(_0x4aa098,0xc9))['catch'](handleError(_0x4aa098,null));};exports['update']=function(_0x4cf440,_0x1b3200){if(_0x4cf440[_0x6879('0x4b')]['id']){delete _0x4cf440['body']['id'];}return db[_0x6879('0x43')][_0x6879('0x49')]({'where':{'id':_0x4cf440['params']['id']}})[_0x6879('0x27')](handleEntityNotFound(_0x1b3200,null))['then'](saveUpdates(_0x4cf440[_0x6879('0x4b')],null))[_0x6879('0x27')](respondWithResult(_0x1b3200,null))['catch'](handleError(_0x1b3200,null));};exports[_0x6879('0x28')]=function(_0x3fa6de,_0x1393a6){return db[_0x6879('0x43')][_0x6879('0x49')]({'where':{'id':_0x3fa6de['params']['id']}})[_0x6879('0x27')](handleEntityNotFound(_0x1393a6,null))[_0x6879('0x27')](removeEntity(_0x1393a6,null))['catch'](handleError(_0x1393a6,null));};exports['getFields']=function(_0x2b014c,_0x11485a,_0x37874c){var _0x45f0fe={};var _0x447bd8={};var _0x28fbaa;var _0xd036aa;return db[_0x6879('0x43')][_0x6879('0x4c')]({'where':{'id':_0x2b014c[_0x6879('0x47')]['id']}})['then'](handleEntityNotFound(_0x11485a,null))[_0x6879('0x27')](function(_0x3f8b13){if(_0x3f8b13){_0x28fbaa=_0x3f8b13;_0x447bd8[_0x6879('0x34')]=_[_0x6879('0x31')](db[_0x6879('0x4d')][_0x6879('0x2f')]);_0x447bd8[_0x6879('0x32')]=_['keys'](_0x2b014c['query']);_0x447bd8[_0x6879('0x33')]=_[_0x6879('0x48')](_0x447bd8[_0x6879('0x34')],_0x447bd8[_0x6879('0x32')]);_0x45f0fe['attributes']=_[_0x6879('0x48')](_0x447bd8[_0x6879('0x34')],qs['fields'](_0x2b014c[_0x6879('0x32')][_0x6879('0x36')]));_0x45f0fe[_0x6879('0x35')]=_0x45f0fe[_0x6879('0x35')][_0x6879('0x37')]?_0x45f0fe[_0x6879('0x35')]:_0x447bd8[_0x6879('0x34')];_0x45f0fe[_0x6879('0x39')]=qs[_0x6879('0x3a')](_0x2b014c['query'][_0x6879('0x3a')]);_0x45f0fe[_0x6879('0x3b')]=qs[_0x6879('0x33')](_[_0x6879('0x3c')](_0x2b014c[_0x6879('0x32')],_0x447bd8[_0x6879('0x33')]));if(_0x2b014c[_0x6879('0x32')]['filter']){_0x45f0fe[_0x6879('0x3b')]=_[_0x6879('0x3e')](_0x45f0fe['where'],{'$or':_['map'](_0x45f0fe['attributes'],function(_0x4548e9){var _0x53e5fe={};_0x53e5fe[_0x4548e9]={'$like':'%'+_0x2b014c[_0x6879('0x32')]['filter']+'%'};return _0x53e5fe;})});}_0x45f0fe=_[_0x6879('0x3e')]({},_0x45f0fe,_0x2b014c[_0x6879('0x40')]);return _0x28fbaa[_0x6879('0x4e')](_0x45f0fe);}})[_0x6879('0x27')](function(_0x21fb13){if(_0x21fb13){_0xd036aa=_0x21fb13[_0x6879('0x37')];if(!_0x2b014c['query'][_0x6879('0x4f')](_0x6879('0x38'))){_0x45f0fe['limit']=qs['limit'](_0x2b014c[_0x6879('0x32')][_0x6879('0x1f')]);_0x45f0fe[_0x6879('0x21')]=qs[_0x6879('0x21')](_0x2b014c[_0x6879('0x32')][_0x6879('0x21')]);}return _0x28fbaa[_0x6879('0x4e')](_0x45f0fe);}})[_0x6879('0x27')](function(_0x3cb06b){if(_0x3cb06b){return _0x3cb06b?{'count':_0xd036aa,'rows':_0x3cb06b}:null;}})['then'](respondWithResult(_0x11485a,null))['catch'](handleError(_0x11485a,null));};exports[_0x6879('0x50')]=function(_0x29075d,_0x50cd9d,_0x1dca29){var _0x23e7c8={};var _0x230083={};var _0x5a39d3;var _0x1d0ecd;return db[_0x6879('0x43')][_0x6879('0x4c')]({'where':{'id':_0x29075d['params']['id']}})[_0x6879('0x27')](handleEntityNotFound(_0x50cd9d,null))[_0x6879('0x27')](function(_0x458047){if(_0x458047){_0x5a39d3=_0x458047;_0x230083[_0x6879('0x34')]=_[_0x6879('0x31')](db['SalesforceField'][_0x6879('0x2f')]);_0x230083[_0x6879('0x32')]=_[_0x6879('0x31')](_0x29075d[_0x6879('0x32')]);_0x230083[_0x6879('0x33')]=_['intersection'](_0x230083['model'],_0x230083['query']);_0x23e7c8[_0x6879('0x35')]=_[_0x6879('0x48')](_0x230083[_0x6879('0x34')],qs[_0x6879('0x36')](_0x29075d[_0x6879('0x32')][_0x6879('0x36')]));_0x23e7c8['attributes']=_0x23e7c8[_0x6879('0x35')][_0x6879('0x37')]?_0x23e7c8[_0x6879('0x35')]:_0x230083[_0x6879('0x34')];_0x23e7c8['order']=qs[_0x6879('0x3a')](_0x29075d[_0x6879('0x32')]['sort']);_0x23e7c8[_0x6879('0x3b')]=qs[_0x6879('0x33')](_[_0x6879('0x3c')](_0x29075d[_0x6879('0x32')],_0x230083[_0x6879('0x33')]));if(_0x29075d[_0x6879('0x32')][_0x6879('0x3d')]){_0x23e7c8[_0x6879('0x3b')]=_[_0x6879('0x3e')](_0x23e7c8[_0x6879('0x3b')],{'$or':_[_0x6879('0x2e')](_0x23e7c8[_0x6879('0x35')],function(_0x537b07){var _0x79db3b={};_0x79db3b[_0x537b07]={'$like':'%'+_0x29075d[_0x6879('0x32')][_0x6879('0x3d')]+'%'};return _0x79db3b;})});}_0x23e7c8=_[_0x6879('0x3e')]({},_0x23e7c8,_0x29075d[_0x6879('0x40')]);return _0x5a39d3[_0x6879('0x50')](_0x23e7c8);}})[_0x6879('0x27')](function(_0x4c0247){if(_0x4c0247){_0x1d0ecd=_0x4c0247[_0x6879('0x37')];if(!_0x29075d[_0x6879('0x32')][_0x6879('0x4f')]('nolimit')){_0x23e7c8['limit']=qs[_0x6879('0x1f')](_0x29075d[_0x6879('0x32')][_0x6879('0x1f')]);_0x23e7c8[_0x6879('0x21')]=qs[_0x6879('0x21')](_0x29075d[_0x6879('0x32')][_0x6879('0x21')]);}return _0x5a39d3[_0x6879('0x50')](_0x23e7c8);}})[_0x6879('0x27')](function(_0x12588b){if(_0x12588b){return _0x12588b?{'count':_0x1d0ecd,'rows':_0x12588b}:null;}})[_0x6879('0x27')](respondWithResult(_0x50cd9d,null))[_0x6879('0x45')](handleError(_0x50cd9d,null));};exports['getDescriptions']=function(_0x4ec26a,_0x1264e2,_0x75db05){var _0x4a58f6={};var _0x5be118={};var _0x479be1;var _0xe21e73;return db[_0x6879('0x43')]['findOne']({'where':{'id':_0x4ec26a[_0x6879('0x47')]['id']}})['then'](handleEntityNotFound(_0x1264e2,null))[_0x6879('0x27')](function(_0x49b2d6){if(_0x49b2d6){_0x479be1=_0x49b2d6;_0x5be118[_0x6879('0x34')]=_[_0x6879('0x31')](db[_0x6879('0x4d')][_0x6879('0x2f')]);_0x5be118[_0x6879('0x32')]=_['keys'](_0x4ec26a[_0x6879('0x32')]);_0x5be118[_0x6879('0x33')]=_['intersection'](_0x5be118['model'],_0x5be118[_0x6879('0x32')]);_0x4a58f6[_0x6879('0x35')]=_[_0x6879('0x48')](_0x5be118['model'],qs[_0x6879('0x36')](_0x4ec26a[_0x6879('0x32')][_0x6879('0x36')]));_0x4a58f6[_0x6879('0x35')]=_0x4a58f6['attributes'][_0x6879('0x37')]?_0x4a58f6[_0x6879('0x35')]:_0x5be118['model'];_0x4a58f6[_0x6879('0x39')]=qs[_0x6879('0x3a')](_0x4ec26a['query'][_0x6879('0x3a')]);_0x4a58f6[_0x6879('0x3b')]=qs[_0x6879('0x33')](_[_0x6879('0x3c')](_0x4ec26a[_0x6879('0x32')],_0x5be118['filters']));if(_0x4ec26a['query']['filter']){_0x4a58f6['where']=_['merge'](_0x4a58f6[_0x6879('0x3b')],{'$or':_['map'](_0x4a58f6['attributes'],function(_0x592fbf){var _0x2e162b={};_0x2e162b[_0x592fbf]={'$like':'%'+_0x4ec26a[_0x6879('0x32')][_0x6879('0x3d')]+'%'};return _0x2e162b;})});}_0x4a58f6=_[_0x6879('0x3e')]({},_0x4a58f6,_0x4ec26a[_0x6879('0x40')]);return _0x479be1[_0x6879('0x51')](_0x4a58f6);}})[_0x6879('0x27')](function(_0x53af0c){if(_0x53af0c){_0xe21e73=_0x53af0c['length'];if(!_0x4ec26a[_0x6879('0x32')]['hasOwnProperty'](_0x6879('0x38'))){_0x4a58f6['limit']=qs[_0x6879('0x1f')](_0x4ec26a['query'][_0x6879('0x1f')]);_0x4a58f6[_0x6879('0x21')]=qs['offset'](_0x4ec26a['query'][_0x6879('0x21')]);}return _0x479be1[_0x6879('0x51')](_0x4a58f6);}})[_0x6879('0x27')](function(_0xcc1c1d){if(_0xcc1c1d){return _0xcc1c1d?{'count':_0xe21e73,'rows':_0xcc1c1d}:null;}})['then'](respondWithResult(_0x1264e2,null))[_0x6879('0x45')](handleError(_0x1264e2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 94fc2dc..c5e1eda 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 _0xc7ea=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger'];(function(_0x351bbd,_0x347bc0){var _0x42750b=function(_0x215b0f){while(--_0x215b0f){_0x351bbd['push'](_0x351bbd['shift']());}};_0x42750b(++_0x347bc0);}(_0xc7ea,0x136));var _0xac7e=function(_0x2e51f8,_0x36ba06){_0x2e51f8=_0x2e51f8-0x0;var _0x3e0908=_0xc7ea[_0x2e51f8];return _0x3e0908;};'use strict';var _=require(_0xac7e('0x0'));var util=require('util');var logger=require(_0xac7e('0x1'))(_0xac7e('0x2'));var moment=require('moment');var BPromise=require(_0xac7e('0x3'));var rp=require(_0xac7e('0x4'));var fs=require('fs');var path=require(_0xac7e('0x5'));var rimraf=require(_0xac7e('0x6'));var config=require(_0xac7e('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xac7e('0x8')]=function(_0x588444,_0x4285a1){return _0x588444[_0xac7e('0x9')](_0xac7e('0xa'),attributes,{'tableName':_0xac7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc3e=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x439af6,_0x479095){var _0x259601=function(_0x375ea9){while(--_0x375ea9){_0x439af6['push'](_0x439af6['shift']());}};_0x259601(++_0x479095);}(_0xdc3e,0x94));var _0xedc3=function(_0x3f6f37,_0x299837){_0x3f6f37=_0x3f6f37-0x0;var _0x1587ce=_0xdc3e[_0x3f6f37];return _0x1587ce;};'use strict';var _=require(_0xedc3('0x0'));var util=require(_0xedc3('0x1'));var logger=require(_0xedc3('0x2'))(_0xedc3('0x3'));var moment=require(_0xedc3('0x4'));var BPromise=require(_0xedc3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xedc3('0x6'));var config=require(_0xedc3('0x7'));var attributes=require(_0xedc3('0x8'));module[_0xedc3('0x9')]=function(_0x39468f,_0x130807){return _0x39468f[_0xedc3('0xa')](_0xedc3('0xb'),attributes,{'tableName':_0xedc3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 1bcdbc9..0697ba8 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 _0x7114=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x468347,_0x119e83){var _0x576a84=function(_0x5c631b){while(--_0x5c631b){_0x468347['push'](_0x468347['shift']());}};_0x576a84(++_0x119e83);}(_0x7114,0xe0));var _0x4711=function(_0x4c80fe,_0x575dc3){_0x4c80fe=_0x4c80fe-0x0;var _0x40ed9d=_0x7114[_0x4c80fe];return _0x40ed9d;};'use strict';var _=require(_0x4711('0x0'));var util=require(_0x4711('0x1'));var moment=require(_0x4711('0x2'));var BPromise=require(_0x4711('0x3'));var rs=require(_0x4711('0x4'));var fs=require('fs');var Redis=require(_0x4711('0x5'));var db=require(_0x4711('0x6'))['db'];var utils=require(_0x4711('0x7'));var logger=require('../../config/logger')(_0x4711('0x8'));var config=require('../../config/environment');var jayson=require(_0x4711('0x9'));var client=jayson[_0x4711('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cead4,_0x1d4c18,_0x4591a0){return new BPromise(function(_0xcd6478,_0x4e0371){return client['request'](_0x4cead4,_0x4591a0)[_0x4711('0xb')](function(_0x4ed40f){logger[_0x4711('0xc')](_0x4711('0xd'),_0x1d4c18,_0x4711('0xe'));logger[_0x4711('0xf')](_0x4711('0x10'),_0x1d4c18,'request\x20sent',JSON[_0x4711('0x11')](_0x4ed40f));if(_0x4ed40f[_0x4711('0x12')]){if(_0x4ed40f[_0x4711('0x12')][_0x4711('0x13')]===0x1f4){logger[_0x4711('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1d4c18,_0x4ed40f[_0x4711('0x12')]['message']);return _0x4e0371(_0x4ed40f[_0x4711('0x12')][_0x4711('0x14')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1d4c18,_0x4ed40f['error'][_0x4711('0x14')]);return _0xcd6478(_0x4ed40f['error'][_0x4711('0x14')]);}else{logger['info'](_0x4711('0xd'),_0x1d4c18,'request\x20sent');_0xcd6478(_0x4ed40f[_0x4711('0x15')][_0x4711('0x14')]);}})[_0x4711('0x16')](function(_0x35e1a4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1d4c18,_0x35e1a4);_0x4e0371(_0x35e1a4);});});} \ No newline at end of file +var _0xe609=['rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2223bd,_0x58713e){var _0x32ab5e=function(_0x483126){while(--_0x483126){_0x2223bd['push'](_0x2223bd['shift']());}};_0x32ab5e(++_0x58713e);}(_0xe609,0x143));var _0x9e60=function(_0x3eceb2,_0x509ff8){_0x3eceb2=_0x3eceb2-0x0;var _0x818bc4=_0xe609[_0x3eceb2];return _0x818bc4;};'use strict';var _=require(_0x9e60('0x0'));var util=require(_0x9e60('0x1'));var moment=require(_0x9e60('0x2'));var BPromise=require(_0x9e60('0x3'));var rs=require(_0x9e60('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e60('0x5'))['db'];var utils=require(_0x9e60('0x6'));var logger=require('../../config/logger')(_0x9e60('0x7'));var config=require(_0x9e60('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e60('0x9')][_0x9e60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f2dc0,_0x5f50cd,_0x1c7932){return new BPromise(function(_0x185572,_0x106167){return client[_0x9e60('0xb')](_0x4f2dc0,_0x1c7932)[_0x9e60('0xc')](function(_0x522581){logger[_0x9e60('0xd')](_0x9e60('0xe'),_0x5f50cd,'request\x20sent');logger[_0x9e60('0xf')](_0x9e60('0x10'),_0x5f50cd,_0x9e60('0x11'),JSON[_0x9e60('0x12')](_0x522581));if(_0x522581[_0x9e60('0x13')]){if(_0x522581[_0x9e60('0x13')]['code']===0x1f4){logger['error'](_0x9e60('0xe'),_0x5f50cd,_0x522581[_0x9e60('0x13')]['message']);return _0x106167(_0x522581[_0x9e60('0x13')][_0x9e60('0x14')]);}logger[_0x9e60('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5f50cd,_0x522581[_0x9e60('0x13')][_0x9e60('0x14')]);return _0x185572(_0x522581['error'][_0x9e60('0x14')]);}else{logger[_0x9e60('0xd')](_0x9e60('0xe'),_0x5f50cd,_0x9e60('0x11'));_0x185572(_0x522581[_0x9e60('0x15')][_0x9e60('0x14')]);}})['catch'](function(_0x493820){logger['error'](_0x9e60('0xe'),_0x5f50cd,_0x493820);_0x106167(_0x493820);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 9ab399b..3afc8f1 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 _0x079b=['delete','destroy','multer','path','connect-timeout','Router','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update'];(function(_0x20021a,_0x27dde3){var _0x1498a5=function(_0xb9813a){while(--_0xb9813a){_0x20021a['push'](_0x20021a['shift']());}};_0x1498a5(++_0x27dde3);}(_0x079b,0xf2));var _0xb079=function(_0x5767b2,_0x4da302){_0x5767b2=_0x5767b2-0x0;var _0x5c746a=_0x079b[_0x5767b2];return _0x5c746a;};'use strict';var multer=require(_0xb079('0x0'));var util=require('util');var path=require(_0xb079('0x1'));var timeout=require(_0xb079('0x2'));var express=require('express');var router=express[_0xb079('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb079('0x4'));var controller=require('./intSalesforceField.controller');router[_0xb079('0x5')]('/',auth['isAuthenticated'](),controller[_0xb079('0x6')]);router[_0xb079('0x5')](_0xb079('0x7'),auth[_0xb079('0x8')](),controller[_0xb079('0x9')]);router[_0xb079('0xa')]('/',auth[_0xb079('0x8')](),controller['create']);router[_0xb079('0xb')]('/:id',auth[_0xb079('0x8')](),controller[_0xb079('0xc')]);router[_0xb079('0xd')]('/:id',auth[_0xb079('0x8')](),controller[_0xb079('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3575=['put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4ea8c7,_0x25bb57){var _0x4ec9ac=function(_0x1f01b0){while(--_0x1f01b0){_0x4ea8c7['push'](_0x4ea8c7['shift']());}};_0x4ec9ac(++_0x25bb57);}(_0x3575,0x155));var _0x5357=function(_0x173ddb,_0x1037bd){_0x173ddb=_0x173ddb-0x0;var _0x33ad7c=_0x3575[_0x173ddb];return _0x33ad7c;};'use strict';var multer=require(_0x5357('0x0'));var util=require(_0x5357('0x1'));var path=require(_0x5357('0x2'));var timeout=require('connect-timeout');var express=require(_0x5357('0x3'));var router=express['Router']();var fs_extra=require(_0x5357('0x4'));var auth=require(_0x5357('0x5'));var interaction=require(_0x5357('0x6'));var config=require(_0x5357('0x7'));var controller=require(_0x5357('0x8'));router[_0x5357('0x9')]('/',auth[_0x5357('0xa')](),controller[_0x5357('0xb')]);router[_0x5357('0x9')](_0x5357('0xc'),auth[_0x5357('0xa')](),controller[_0x5357('0xd')]);router[_0x5357('0xe')]('/',auth[_0x5357('0xa')](),controller[_0x5357('0xf')]);router[_0x5357('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5357('0x11')]);router[_0x5357('0x12')]('/:id',auth[_0x5357('0xa')](),controller[_0x5357('0x13')]);module[_0x5357('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e0a18fe..0b5dde0 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 _0xc5c2=['customVariable','picklist','string','STRING','sequelize','ENUM','variable'];(function(_0x1ee66c,_0x2de690){var _0x4ed37f=function(_0x537ba7){while(--_0x537ba7){_0x1ee66c['push'](_0x1ee66c['shift']());}};_0x4ed37f(++_0x2de690);}(_0xc5c2,0x169));var _0x2c5c=function(_0x3980dc,_0x4fcfda){_0x3980dc=_0x3980dc-0x0;var _0x1aca5c=_0xc5c2[_0x3980dc];return _0x1aca5c;};'use strict';var Sequelize=require(_0x2c5c('0x0'));module['exports']={'type':{'type':Sequelize[_0x2c5c('0x1')]('string',_0x2c5c('0x2'),_0x2c5c('0x3'),'keyValue',_0x2c5c('0x4')),'defaultValue':_0x2c5c('0x5')},'content':{'type':Sequelize[_0x2c5c('0x6')]},'key':{'type':Sequelize[_0x2c5c('0x6')]},'keyType':{'type':Sequelize[_0x2c5c('0x1')]('string',_0x2c5c('0x2'),_0x2c5c('0x3'))},'keyContent':{'type':Sequelize[_0x2c5c('0x6')]},'idField':{'type':Sequelize[_0x2c5c('0x6')]},'variableName':{'type':Sequelize[_0x2c5c('0x6')]}}; \ No newline at end of file +var _0xb7ab=['exports','string','variable','customVariable','picklist','STRING','ENUM','sequelize'];(function(_0x2ddc2d,_0x16be24){var _0x17ffcd=function(_0x3ca892){while(--_0x3ca892){_0x2ddc2d['push'](_0x2ddc2d['shift']());}};_0x17ffcd(++_0x16be24);}(_0xb7ab,0x13f));var _0xbb7a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb7ab[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xbb7a('0x0'));module[_0xbb7a('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbb7a('0x2'),_0xbb7a('0x3'),_0xbb7a('0x4'),'keyValue',_0xbb7a('0x5')),'defaultValue':_0xbb7a('0x2')},'content':{'type':Sequelize[_0xbb7a('0x6')]},'key':{'type':Sequelize[_0xbb7a('0x6')]},'keyType':{'type':Sequelize[_0xbb7a('0x7')](_0xbb7a('0x2'),'variable',_0xbb7a('0x4'))},'keyContent':{'type':Sequelize[_0xbb7a('0x6')]},'idField':{'type':Sequelize[_0xbb7a('0x6')]},'variableName':{'type':Sequelize[_0xbb7a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f76d0f6..96bf5e9 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 _0xb248=['sort','pick','filter','where','merge','includeAll','rows','catch','show','params','options','create','body','find','destroy','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SalesforceField','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5d6448,_0x53522f){var _0x58c195=function(_0x200a2f){while(--_0x200a2f){_0x5d6448['push'](_0x5d6448['shift']());}};_0x58c195(++_0x53522f);}(_0xb248,0x1b9));var _0x8b24=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb248[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b24('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b24('0x1'));var moment=require(_0x8b24('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8b24('0x3'));var util=require(_0x8b24('0x4'));var path=require(_0x8b24('0x5'));var sox=require(_0x8b24('0x6'));var csv=require(_0x8b24('0x7'));var ejs=require(_0x8b24('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b24('0x9'));var squel=require(_0x8b24('0xa'));var crypto=require(_0x8b24('0xb'));var jsforce=require(_0x8b24('0xc'));var deskjs=require(_0x8b24('0xd'));var toCsv=require(_0x8b24('0x7'));var querystring=require(_0x8b24('0xe'));var Papa=require(_0x8b24('0xf'));var Redis=require('ioredis');var authService=require(_0x8b24('0x10'));var qs=require(_0x8b24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b24('0x12'));var logger=require(_0x8b24('0x13'))(_0x8b24('0x14'));var utils=require(_0x8b24('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8b24('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x559609,_0x30a717){_0x30a717=_0x30a717||0xcc;return function(_0x307b2b){if(_0x307b2b){return _0x559609[_0x8b24('0x17')](_0x30a717);}return _0x559609[_0x8b24('0x18')](_0x30a717)[_0x8b24('0x19')]();};}function respondWithResult(_0x5e2c45,_0x4c3668){_0x4c3668=_0x4c3668||0xc8;return function(_0x24def3){if(_0x24def3){return _0x5e2c45['status'](_0x4c3668)[_0x8b24('0x1a')](_0x24def3);}};}function respondWithFilteredResult(_0x4474e4,_0x36c5c3){return function(_0x2100a9){if(_0x2100a9){var _0x3e24af=typeof _0x36c5c3['offset']===_0x8b24('0x1b')&&typeof _0x36c5c3[_0x8b24('0x1c')]==='undefined';var _0x3b0acc=_0x2100a9['count'];var _0x1769ea=_0x3e24af?0x0:_0x36c5c3[_0x8b24('0x1d')];var _0x2a89f9=_0x3e24af?_0x2100a9[_0x8b24('0x1e')]:_0x36c5c3[_0x8b24('0x1d')]+_0x36c5c3['limit'];var _0x4301ef;if(_0x2a89f9>=_0x3b0acc){_0x2a89f9=_0x3b0acc;_0x4301ef=0xc8;}else{_0x4301ef=0xce;}_0x4474e4[_0x8b24('0x18')](_0x4301ef);return _0x4474e4[_0x8b24('0x1f')](_0x8b24('0x20'),_0x1769ea+'-'+_0x2a89f9+'/'+_0x3b0acc)[_0x8b24('0x1a')](_0x2100a9);}return null;};}function patchUpdates(_0x1b2933){return function(_0x4f23ab){try{jsonpatch['apply'](_0x4f23ab,_0x1b2933,!![]);}catch(_0x542ed7){return BPromise[_0x8b24('0x21')](_0x542ed7);}return _0x4f23ab[_0x8b24('0x22')]();};}function saveUpdates(_0x591ada,_0x27fdd3){return function(_0x26b867){if(_0x26b867){return _0x26b867[_0x8b24('0x23')](_0x591ada)[_0x8b24('0x24')](function(_0x38bb05){return _0x38bb05;});}return null;};}function removeEntity(_0x524e7e,_0x35f965){return function(_0x286523){if(_0x286523){return _0x286523['destroy']()[_0x8b24('0x24')](function(){_0x524e7e[_0x8b24('0x18')](0xcc)[_0x8b24('0x19')]();});}};}function handleEntityNotFound(_0x10bc19,_0x47049b){return function(_0x5333ad){if(!_0x5333ad){_0x10bc19[_0x8b24('0x17')](0x194);}return _0x5333ad;};}function handleError(_0x5e87d7,_0x121e5c){_0x121e5c=_0x121e5c||0x1f4;return function(_0x40de5a){logger[_0x8b24('0x25')](_0x40de5a[_0x8b24('0x26')]);if(_0x40de5a[_0x8b24('0x27')]){delete _0x40de5a[_0x8b24('0x27')];}_0x5e87d7['status'](_0x121e5c)[_0x8b24('0x28')](_0x40de5a);};}exports[_0x8b24('0x29')]=function(_0x25eb46,_0x29b1c0){var _0x7f851b={},_0x209b4c={},_0xa7aff0={'count':0x0,'rows':[]};var _0x218cc5=_[_0x8b24('0x2a')](db[_0x8b24('0x2b')]['rawAttributes'],function(_0x3f0bc2){return{'name':_0x3f0bc2['fieldName'],'type':_0x3f0bc2[_0x8b24('0x2c')][_0x8b24('0x2d')]};});_0x209b4c[_0x8b24('0x2e')]=_[_0x8b24('0x2a')](_0x218cc5,_0x8b24('0x27'));_0x209b4c[_0x8b24('0x2f')]=_[_0x8b24('0x30')](_0x25eb46[_0x8b24('0x2f')]);_0x209b4c[_0x8b24('0x31')]=_[_0x8b24('0x32')](_0x209b4c[_0x8b24('0x2e')],_0x209b4c[_0x8b24('0x2f')]);_0x7f851b[_0x8b24('0x33')]=_[_0x8b24('0x32')](_0x209b4c[_0x8b24('0x2e')],qs[_0x8b24('0x34')](_0x25eb46['query'][_0x8b24('0x34')]));_0x7f851b[_0x8b24('0x33')]=_0x7f851b['attributes'][_0x8b24('0x35')]?_0x7f851b[_0x8b24('0x33')]:_0x209b4c[_0x8b24('0x2e')];if(!_0x25eb46['query'][_0x8b24('0x36')](_0x8b24('0x37'))){_0x7f851b[_0x8b24('0x1c')]=qs[_0x8b24('0x1c')](_0x25eb46['query'][_0x8b24('0x1c')]);_0x7f851b[_0x8b24('0x1d')]=qs[_0x8b24('0x1d')](_0x25eb46['query']['offset']);}_0x7f851b['order']=qs[_0x8b24('0x38')](_0x25eb46[_0x8b24('0x2f')][_0x8b24('0x38')]);_0x7f851b['where']=qs[_0x8b24('0x31')](_[_0x8b24('0x39')](_0x25eb46[_0x8b24('0x2f')],_0x209b4c[_0x8b24('0x31')]),_0x218cc5);if(_0x25eb46['query'][_0x8b24('0x3a')]){_0x7f851b[_0x8b24('0x3b')]=_[_0x8b24('0x3c')](_0x7f851b[_0x8b24('0x3b')],{'$or':_['map'](_0x218cc5,function(_0x4c280d){if(_0x4c280d[_0x8b24('0x2c')]!=='VIRTUAL'){var _0x6f9398={};_0x6f9398[_0x4c280d[_0x8b24('0x27')]]={'$like':'%'+_0x25eb46[_0x8b24('0x2f')][_0x8b24('0x3a')]+'%'};return _0x6f9398;}})});}_0x7f851b=_[_0x8b24('0x3c')]({},_0x7f851b,_0x25eb46['options']);var _0x3e23b7={'where':_0x7f851b['where']};return db[_0x8b24('0x2b')][_0x8b24('0x1e')](_0x3e23b7)[_0x8b24('0x24')](function(_0x112977){_0xa7aff0[_0x8b24('0x1e')]=_0x112977;if(_0x25eb46[_0x8b24('0x2f')][_0x8b24('0x3d')]){_0x7f851b['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x7f851b);})[_0x8b24('0x24')](function(_0x1f5ba2){_0xa7aff0[_0x8b24('0x3e')]=_0x1f5ba2;return _0xa7aff0;})['then'](respondWithFilteredResult(_0x29b1c0,_0x7f851b))[_0x8b24('0x3f')](handleError(_0x29b1c0,null));};exports[_0x8b24('0x40')]=function(_0x3726dc,_0x5d0e1a){var _0x5f0972={'raw':!![],'where':{'id':_0x3726dc[_0x8b24('0x41')]['id']}},_0x5e0f57={};_0x5e0f57['model']=_[_0x8b24('0x30')](db[_0x8b24('0x2b')]['rawAttributes']);_0x5e0f57[_0x8b24('0x2f')]=_[_0x8b24('0x30')](_0x3726dc['query']);_0x5e0f57[_0x8b24('0x31')]=_[_0x8b24('0x32')](_0x5e0f57[_0x8b24('0x2e')],_0x5e0f57[_0x8b24('0x2f')]);_0x5f0972[_0x8b24('0x33')]=_[_0x8b24('0x32')](_0x5e0f57[_0x8b24('0x2e')],qs['fields'](_0x3726dc[_0x8b24('0x2f')]['fields']));_0x5f0972['attributes']=_0x5f0972[_0x8b24('0x33')][_0x8b24('0x35')]?_0x5f0972[_0x8b24('0x33')]:_0x5e0f57[_0x8b24('0x2e')];if(_0x3726dc[_0x8b24('0x2f')][_0x8b24('0x3d')]){_0x5f0972['include']=[{'all':!![]}];}_0x5f0972=_['merge']({},_0x5f0972,_0x3726dc[_0x8b24('0x42')]);return db['SalesforceField']['find'](_0x5f0972)[_0x8b24('0x24')](handleEntityNotFound(_0x5d0e1a,null))[_0x8b24('0x24')](respondWithResult(_0x5d0e1a,null))['catch'](handleError(_0x5d0e1a,null));};exports[_0x8b24('0x43')]=function(_0x5f4500,_0x4f8a2d){return db[_0x8b24('0x2b')][_0x8b24('0x43')](_0x5f4500['body'],{})['then'](respondWithResult(_0x4f8a2d,0xc9))['catch'](handleError(_0x4f8a2d,null));};exports['update']=function(_0x5af749,_0x18edca){if(_0x5af749['body']['id']){delete _0x5af749[_0x8b24('0x44')]['id'];}return db['SalesforceField'][_0x8b24('0x45')]({'where':{'id':_0x5af749[_0x8b24('0x41')]['id']}})['then'](handleEntityNotFound(_0x18edca,null))[_0x8b24('0x24')](saveUpdates(_0x5af749[_0x8b24('0x44')],null))[_0x8b24('0x24')](respondWithResult(_0x18edca,null))[_0x8b24('0x3f')](handleError(_0x18edca,null));};exports[_0x8b24('0x46')]=function(_0x3362ad,_0x124566){return db[_0x8b24('0x2b')][_0x8b24('0x45')]({'where':{'id':_0x3362ad[_0x8b24('0x41')]['id']}})[_0x8b24('0x24')](handleEntityNotFound(_0x124566,null))['then'](removeEntity(_0x124566,null))[_0x8b24('0x3f')](handleError(_0x124566,null));}; \ No newline at end of file +var _0xa359=['model','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','index','SalesforceField','fieldName','type','key','map','query','keys','filters','intersection'];(function(_0x6e937e,_0x4a4057){var _0x414fbe=function(_0x5c60d2){while(--_0x5c60d2){_0x6e937e['push'](_0x6e937e['shift']());}};_0x414fbe(++_0x4a4057);}(_0xa359,0x19e));var _0x9a35=function(_0x2559fb,_0x3b3d7b){_0x2559fb=_0x2559fb-0x0;var _0x421c0b=_0xa359[_0x2559fb];return _0x421c0b;};'use strict';var emlformat=require(_0x9a35('0x0'));var rimraf=require(_0x9a35('0x1'));var zipdir=require(_0x9a35('0x2'));var jsonpatch=require(_0x9a35('0x3'));var rp=require(_0x9a35('0x4'));var moment=require(_0x9a35('0x5'));var BPromise=require(_0x9a35('0x6'));var Mustache=require(_0x9a35('0x7'));var util=require(_0x9a35('0x8'));var path=require(_0x9a35('0x9'));var sox=require(_0x9a35('0xa'));var csv=require(_0x9a35('0xb'));var ejs=require(_0x9a35('0xc'));var fs=require('fs');var fs_extra=require(_0x9a35('0xd'));var _=require('lodash');var squel=require(_0x9a35('0xe'));var crypto=require('crypto');var jsforce=require(_0x9a35('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9a35('0xb'));var querystring=require(_0x9a35('0x10'));var Papa=require(_0x9a35('0x11'));var Redis=require(_0x9a35('0x12'));var authService=require(_0x9a35('0x13'));var qs=require(_0x9a35('0x14'));var as=require(_0x9a35('0x15'));var hardwareService=require(_0x9a35('0x16'));var logger=require(_0x9a35('0x17'))('api');var utils=require(_0x9a35('0x18'));var config=require(_0x9a35('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a35('0x1a'))['db'];function respondWithStatusCode(_0xe84b94,_0x13ac97){_0x13ac97=_0x13ac97||0xcc;return function(_0x430ae1){if(_0x430ae1){return _0xe84b94[_0x9a35('0x1b')](_0x13ac97);}return _0xe84b94[_0x9a35('0x1c')](_0x13ac97)[_0x9a35('0x1d')]();};}function respondWithResult(_0x251df4,_0x2a248a){_0x2a248a=_0x2a248a||0xc8;return function(_0x1fe0a2){if(_0x1fe0a2){return _0x251df4[_0x9a35('0x1c')](_0x2a248a)[_0x9a35('0x1e')](_0x1fe0a2);}};}function respondWithFilteredResult(_0x2abbe7,_0xf9c8a7){return function(_0x102541){if(_0x102541){var _0x2196f7=typeof _0xf9c8a7[_0x9a35('0x1f')]===_0x9a35('0x20')&&typeof _0xf9c8a7[_0x9a35('0x21')]==='undefined';var _0x41d4ed=_0x102541[_0x9a35('0x22')];var _0x2fb93b=_0x2196f7?0x0:_0xf9c8a7[_0x9a35('0x1f')];var _0x311873=_0x2196f7?_0x102541[_0x9a35('0x22')]:_0xf9c8a7[_0x9a35('0x1f')]+_0xf9c8a7['limit'];var _0x475d32;if(_0x311873>=_0x41d4ed){_0x311873=_0x41d4ed;_0x475d32=0xc8;}else{_0x475d32=0xce;}_0x2abbe7[_0x9a35('0x1c')](_0x475d32);return _0x2abbe7['set'](_0x9a35('0x23'),_0x2fb93b+'-'+_0x311873+'/'+_0x41d4ed)[_0x9a35('0x1e')](_0x102541);}return null;};}function patchUpdates(_0x4daded){return function(_0x325eac){try{jsonpatch['apply'](_0x325eac,_0x4daded,!![]);}catch(_0x3b3835){return BPromise['reject'](_0x3b3835);}return _0x325eac[_0x9a35('0x24')]();};}function saveUpdates(_0x1d855e,_0x3efc24){return function(_0x1b3652){if(_0x1b3652){return _0x1b3652[_0x9a35('0x25')](_0x1d855e)[_0x9a35('0x26')](function(_0x5e1499){return _0x5e1499;});}return null;};}function removeEntity(_0xc1d644,_0x586497){return function(_0x165301){if(_0x165301){return _0x165301[_0x9a35('0x27')]()['then'](function(){_0xc1d644[_0x9a35('0x1c')](0xcc)[_0x9a35('0x1d')]();});}};}function handleEntityNotFound(_0x4bfdb6,_0x2b9401){return function(_0x4b638f){if(!_0x4b638f){_0x4bfdb6[_0x9a35('0x1b')](0x194);}return _0x4b638f;};}function handleError(_0x230c7c,_0x1cdb27){_0x1cdb27=_0x1cdb27||0x1f4;return function(_0x59830d){logger[_0x9a35('0x28')](_0x59830d[_0x9a35('0x29')]);if(_0x59830d[_0x9a35('0x2a')]){delete _0x59830d[_0x9a35('0x2a')];}_0x230c7c[_0x9a35('0x1c')](_0x1cdb27)[_0x9a35('0x2b')](_0x59830d);};}exports[_0x9a35('0x2c')]=function(_0x8fd1d1,_0x240863){var _0x2fe8fb={},_0xe34c76={},_0x1fc2e1={'count':0x0,'rows':[]};var _0x17be16=_['map'](db[_0x9a35('0x2d')]['rawAttributes'],function(_0x5e0ad6){return{'name':_0x5e0ad6[_0x9a35('0x2e')],'type':_0x5e0ad6[_0x9a35('0x2f')][_0x9a35('0x30')]};});_0xe34c76['model']=_[_0x9a35('0x31')](_0x17be16,_0x9a35('0x2a'));_0xe34c76[_0x9a35('0x32')]=_[_0x9a35('0x33')](_0x8fd1d1[_0x9a35('0x32')]);_0xe34c76[_0x9a35('0x34')]=_[_0x9a35('0x35')](_0xe34c76[_0x9a35('0x36')],_0xe34c76['query']);_0x2fe8fb['attributes']=_[_0x9a35('0x35')](_0xe34c76[_0x9a35('0x36')],qs[_0x9a35('0x37')](_0x8fd1d1[_0x9a35('0x32')][_0x9a35('0x37')]));_0x2fe8fb[_0x9a35('0x38')]=_0x2fe8fb[_0x9a35('0x38')]['length']?_0x2fe8fb['attributes']:_0xe34c76[_0x9a35('0x36')];if(!_0x8fd1d1[_0x9a35('0x32')][_0x9a35('0x39')]('nolimit')){_0x2fe8fb[_0x9a35('0x21')]=qs[_0x9a35('0x21')](_0x8fd1d1['query']['limit']);_0x2fe8fb['offset']=qs[_0x9a35('0x1f')](_0x8fd1d1['query'][_0x9a35('0x1f')]);}_0x2fe8fb[_0x9a35('0x3a')]=qs[_0x9a35('0x3b')](_0x8fd1d1[_0x9a35('0x32')]['sort']);_0x2fe8fb['where']=qs[_0x9a35('0x34')](_[_0x9a35('0x3c')](_0x8fd1d1['query'],_0xe34c76['filters']),_0x17be16);if(_0x8fd1d1[_0x9a35('0x32')][_0x9a35('0x3d')]){_0x2fe8fb[_0x9a35('0x3e')]=_['merge'](_0x2fe8fb[_0x9a35('0x3e')],{'$or':_[_0x9a35('0x31')](_0x17be16,function(_0x1dd56a){if(_0x1dd56a[_0x9a35('0x2f')]!==_0x9a35('0x3f')){var _0x21b549={};_0x21b549[_0x1dd56a['name']]={'$like':'%'+_0x8fd1d1[_0x9a35('0x32')][_0x9a35('0x3d')]+'%'};return _0x21b549;}})});}_0x2fe8fb=_[_0x9a35('0x40')]({},_0x2fe8fb,_0x8fd1d1[_0x9a35('0x41')]);var _0x20a1da={'where':_0x2fe8fb['where']};return db[_0x9a35('0x2d')]['count'](_0x20a1da)[_0x9a35('0x26')](function(_0x4fd230){_0x1fc2e1[_0x9a35('0x22')]=_0x4fd230;if(_0x8fd1d1[_0x9a35('0x32')]['includeAll']){_0x2fe8fb[_0x9a35('0x42')]=[{'all':!![]}];}return db[_0x9a35('0x2d')][_0x9a35('0x43')](_0x2fe8fb);})[_0x9a35('0x26')](function(_0x5068c9){_0x1fc2e1[_0x9a35('0x44')]=_0x5068c9;return _0x1fc2e1;})[_0x9a35('0x26')](respondWithFilteredResult(_0x240863,_0x2fe8fb))[_0x9a35('0x45')](handleError(_0x240863,null));};exports[_0x9a35('0x46')]=function(_0x49bd41,_0x346554){var _0x1ee279={'raw':!![],'where':{'id':_0x49bd41[_0x9a35('0x47')]['id']}},_0x42dc3f={};_0x42dc3f['model']=_[_0x9a35('0x33')](db[_0x9a35('0x2d')][_0x9a35('0x48')]);_0x42dc3f['query']=_['keys'](_0x49bd41[_0x9a35('0x32')]);_0x42dc3f[_0x9a35('0x34')]=_[_0x9a35('0x35')](_0x42dc3f[_0x9a35('0x36')],_0x42dc3f['query']);_0x1ee279[_0x9a35('0x38')]=_[_0x9a35('0x35')](_0x42dc3f[_0x9a35('0x36')],qs[_0x9a35('0x37')](_0x49bd41['query']['fields']));_0x1ee279['attributes']=_0x1ee279['attributes'][_0x9a35('0x49')]?_0x1ee279[_0x9a35('0x38')]:_0x42dc3f['model'];if(_0x49bd41['query'][_0x9a35('0x4a')]){_0x1ee279['include']=[{'all':!![]}];}_0x1ee279=_[_0x9a35('0x40')]({},_0x1ee279,_0x49bd41[_0x9a35('0x41')]);return db[_0x9a35('0x2d')][_0x9a35('0x4b')](_0x1ee279)[_0x9a35('0x26')](handleEntityNotFound(_0x346554,null))['then'](respondWithResult(_0x346554,null))[_0x9a35('0x45')](handleError(_0x346554,null));};exports[_0x9a35('0x4c')]=function(_0x2c5e04,_0x3fbc03){return db[_0x9a35('0x2d')]['create'](_0x2c5e04[_0x9a35('0x4d')],{})[_0x9a35('0x26')](respondWithResult(_0x3fbc03,0xc9))['catch'](handleError(_0x3fbc03,null));};exports[_0x9a35('0x25')]=function(_0x58f329,_0x38eed8){if(_0x58f329[_0x9a35('0x4d')]['id']){delete _0x58f329['body']['id'];}return db[_0x9a35('0x2d')][_0x9a35('0x4b')]({'where':{'id':_0x58f329['params']['id']}})[_0x9a35('0x26')](handleEntityNotFound(_0x38eed8,null))['then'](saveUpdates(_0x58f329[_0x9a35('0x4d')],null))['then'](respondWithResult(_0x38eed8,null))[_0x9a35('0x45')](handleError(_0x38eed8,null));};exports['destroy']=function(_0x35fcbc,_0x2c2b60){return db['SalesforceField'][_0x9a35('0x4b')]({'where':{'id':_0x35fcbc[_0x9a35('0x47')]['id']}})[_0x9a35('0x26')](handleEntityNotFound(_0x2c2b60,null))[_0x9a35('0x26')](removeEntity(_0x2c2b60,null))[_0x9a35('0x45')](handleError(_0x2c2b60,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7cf9814..2c8ff4f 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 _0x1a70=['exports','define','SalesforceField','salesforce_unique_index','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1a70,0x9e));var _0x01a7=function(_0x3773ec,_0x41de27){_0x3773ec=_0x3773ec-0x0;var _0xf4adab=_0x1a70[_0x3773ec];return _0xf4adab;};'use strict';var _=require(_0x01a7('0x0'));var util=require(_0x01a7('0x1'));var logger=require(_0x01a7('0x2'))(_0x01a7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01a7('0x4'));var fs=require('fs');var path=require(_0x01a7('0x5'));var rimraf=require(_0x01a7('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x01a7('0x7')]=function(_0x1dbf31,_0xaa2b55){return _0x1dbf31[_0x01a7('0x8')](_0x01a7('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x01a7('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9fd=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x597a47,_0x5d6661){var _0x57227e=function(_0x329089){while(--_0x329089){_0x597a47['push'](_0x597a47['shift']());}};_0x57227e(++_0x5d6661);}(_0xc9fd,0x152));var _0xdc9f=function(_0x5d750d,_0x31c451){_0x5d750d=_0x5d750d-0x0;var _0x289b17=_0xc9fd[_0x5d750d];return _0x289b17;};'use strict';var _=require(_0xdc9f('0x0'));var util=require('util');var logger=require(_0xdc9f('0x1'))(_0xdc9f('0x2'));var moment=require(_0xdc9f('0x3'));var BPromise=require(_0xdc9f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc9f('0x5'));var rimraf=require(_0xdc9f('0x6'));var config=require(_0xdc9f('0x7'));var attributes=require(_0xdc9f('0x8'));module[_0xdc9f('0x9')]=function(_0x39b124,_0x57309a){return _0x39b124[_0xdc9f('0xa')](_0xdc9f('0xb'),attributes,{'tableName':_0xdc9f('0xc'),'paranoid':![],'indexes':[{'name':_0xdc9f('0xd'),'fields':[_0xdc9f('0xe'),_0xdc9f('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 1ae4a79..dee8895 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 _0xb6de=['message','result','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x43bed9,_0x26adca){var _0x27b03d=function(_0x5c47c9){while(--_0x5c47c9){_0x43bed9['push'](_0x43bed9['shift']());}};_0x27b03d(++_0x26adca);}(_0xb6de,0x157));var _0xeb6d=function(_0xc1cb12,_0x14d408){_0xc1cb12=_0xc1cb12-0x0;var _0x3ffe18=_0xb6de[_0xc1cb12];return _0x3ffe18;};'use strict';var _=require('lodash');var util=require(_0xeb6d('0x0'));var moment=require(_0xeb6d('0x1'));var BPromise=require(_0xeb6d('0x2'));var rs=require(_0xeb6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb6d('0x4'))('rpc');var config=require(_0xeb6d('0x5'));var jayson=require(_0xeb6d('0x6'));var client=jayson[_0xeb6d('0x7')][_0xeb6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5662bd,_0x1e82b6,_0x54c9ba){return new BPromise(function(_0x2e32fc,_0x199c4d){return client[_0xeb6d('0x9')](_0x5662bd,_0x54c9ba)['then'](function(_0x48f7ea){logger[_0xeb6d('0xa')](_0xeb6d('0xb'),_0x1e82b6,_0xeb6d('0xc'));logger['debug'](_0xeb6d('0xd'),_0x1e82b6,_0xeb6d('0xc'),JSON[_0xeb6d('0xe')](_0x48f7ea));if(_0x48f7ea[_0xeb6d('0xf')]){if(_0x48f7ea['error'][_0xeb6d('0x10')]===0x1f4){logger['error'](_0xeb6d('0xb'),_0x1e82b6,_0x48f7ea['error']['message']);return _0x199c4d(_0x48f7ea['error'][_0xeb6d('0x11')]);}logger[_0xeb6d('0xf')](_0xeb6d('0xb'),_0x1e82b6,_0x48f7ea[_0xeb6d('0xf')][_0xeb6d('0x11')]);return _0x2e32fc(_0x48f7ea[_0xeb6d('0xf')][_0xeb6d('0x11')]);}else{logger[_0xeb6d('0xa')](_0xeb6d('0xb'),_0x1e82b6,'request\x20sent');_0x2e32fc(_0x48f7ea[_0xeb6d('0x12')][_0xeb6d('0x11')]);}})[_0xeb6d('0x13')](function(_0x4990eb){logger[_0xeb6d('0xf')]('SalesforceField,\x20%s,\x20%s',_0x1e82b6,_0x4990eb);_0x199c4d(_0x4990eb);});});} \ No newline at end of file +var _0x79a7=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','then','info','SalesforceField,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x79a7,0x16e));var _0x779a=function(_0xdc0388,_0x51e2f5){_0xdc0388=_0xdc0388-0x0;var _0x1e976b=_0x79a7[_0xdc0388];return _0x1e976b;};'use strict';var _=require(_0x779a('0x0'));var util=require(_0x779a('0x1'));var moment=require('moment');var BPromise=require(_0x779a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x779a('0x3'));var db=require(_0x779a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x779a('0x5'))(_0x779a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x779a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a970f,_0x151165,_0x499f47){return new BPromise(function(_0x2cce53,_0x5863a5){return client['request'](_0x3a970f,_0x499f47)[_0x779a('0x8')](function(_0x2ea69c){logger[_0x779a('0x9')](_0x779a('0xa'),_0x151165,'request\x20sent');logger[_0x779a('0xb')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x151165,_0x779a('0xc'),JSON[_0x779a('0xd')](_0x2ea69c));if(_0x2ea69c[_0x779a('0xe')]){if(_0x2ea69c[_0x779a('0xe')][_0x779a('0xf')]===0x1f4){logger[_0x779a('0xe')](_0x779a('0xa'),_0x151165,_0x2ea69c[_0x779a('0xe')][_0x779a('0x10')]);return _0x5863a5(_0x2ea69c[_0x779a('0xe')][_0x779a('0x10')]);}logger['error'](_0x779a('0xa'),_0x151165,_0x2ea69c['error']['message']);return _0x2cce53(_0x2ea69c[_0x779a('0xe')][_0x779a('0x10')]);}else{logger[_0x779a('0x9')](_0x779a('0xa'),_0x151165,_0x779a('0xc'));_0x2cce53(_0x2ea69c[_0x779a('0x11')][_0x779a('0x10')]);}})[_0x779a('0x12')](function(_0x4badc6){logger['error'](_0x779a('0xa'),_0x151165,_0x4badc6);_0x5863a5(_0x4badc6);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index c631ab9..53eeef3 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 _0x0f1e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','path'];(function(_0x28cd43,_0x1825b9){var _0x2af7cc=function(_0x1eba73){while(--_0x1eba73){_0x28cd43['push'](_0x28cd43['shift']());}};_0x2af7cc(++_0x1825b9);}(_0x0f1e,0x18e));var _0xe0f1=function(_0x18a8d7,_0x32c46b){_0x18a8d7=_0x18a8d7-0x0;var _0x1c18c3=_0x0f1e[_0x18a8d7];return _0x1c18c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe0f1('0x0'));var timeout=require('connect-timeout');var express=require(_0xe0f1('0x1'));var router=express[_0xe0f1('0x2')]();var fs_extra=require(_0xe0f1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe0f1('0x4'));var config=require(_0xe0f1('0x5'));var controller=require(_0xe0f1('0x6'));router[_0xe0f1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe0f1('0x7')]('/:id',auth[_0xe0f1('0x8')](),controller[_0xe0f1('0x9')]);router['get'](_0xe0f1('0xa'),auth[_0xe0f1('0x8')](),controller[_0xe0f1('0xb')]);router[_0xe0f1('0x7')](_0xe0f1('0xc'),auth[_0xe0f1('0x8')](),controller[_0xe0f1('0xd')]);router[_0xe0f1('0xe')]('/',auth[_0xe0f1('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xe0f1('0xf')]);router[_0xe0f1('0x10')](_0xe0f1('0x11'),auth['isAuthenticated'](),controller[_0xe0f1('0x12')]);router[_0xe0f1('0x13')]('/:id',auth[_0xe0f1('0x8')](),controller[_0xe0f1('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd562=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create'];(function(_0x5742b9,_0x2684ee){var _0x237aa8=function(_0x258dad){while(--_0x258dad){_0x5742b9['push'](_0x5742b9['shift']());}};_0x237aa8(++_0x2684ee);}(_0xd562,0x165));var _0x2d56=function(_0x529965,_0x3a1ed2){_0x529965=_0x529965-0x0;var _0x232533=_0xd562[_0x529965];return _0x232533;};'use strict';var multer=require(_0x2d56('0x0'));var util=require(_0x2d56('0x1'));var path=require('path');var timeout=require(_0x2d56('0x2'));var express=require(_0x2d56('0x3'));var router=express[_0x2d56('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2d56('0x5'));var config=require(_0x2d56('0x6'));var controller=require(_0x2d56('0x7'));router[_0x2d56('0x8')]('/',auth[_0x2d56('0x9')](),controller[_0x2d56('0xa')]);router[_0x2d56('0x8')](_0x2d56('0xb'),auth[_0x2d56('0x9')](),controller[_0x2d56('0xc')]);router[_0x2d56('0x8')](_0x2d56('0xd'),auth[_0x2d56('0x9')](),controller['getConfigurations']);router[_0x2d56('0x8')](_0x2d56('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x2d56('0xf')]('/',auth[_0x2d56('0x9')](),controller[_0x2d56('0x10')]);router['post'](_0x2d56('0xd'),auth[_0x2d56('0x9')](),controller['addConfiguration']);router[_0x2d56('0x11')]('/:id',auth[_0x2d56('0x9')](),controller[_0x2d56('0x12')]);router[_0x2d56('0x13')]('/:id',auth[_0x2d56('0x9')](),controller[_0x2d56('0x14')]);module[_0x2d56('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 331c730..5140322 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 _0x74d5=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1fc27e,_0x52402c){var _0x252a06=function(_0x53fa6f){while(--_0x53fa6f){_0x1fc27e['push'](_0x1fc27e['shift']());}};_0x252a06(++_0x52402c);}(_0x74d5,0x17b));var _0x574d=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0x74d5[_0x57966a];return _0x191765;};'use strict';var Sequelize=require(_0x574d('0x0'));module[_0x574d('0x1')]={'name':{'type':Sequelize[_0x574d('0x2')]},'description':{'type':Sequelize[_0x574d('0x2')]},'username':{'type':Sequelize[_0x574d('0x2')],'unique':_0x574d('0x3')},'password':{'type':Sequelize[_0x574d('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x574d('0x2')],'unique':_0x574d('0x4')},'serverUrl':{'type':Sequelize[_0x574d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb36c=['STRING','username','remoteUri','sequelize','exports'];(function(_0x18cabb,_0x2532aa){var _0x235bc5=function(_0x3c0495){while(--_0x3c0495){_0x18cabb['push'](_0x18cabb['shift']());}};_0x235bc5(++_0x2532aa);}(_0xb36c,0x6c));var _0xcb36=function(_0x5ec15f,_0x5124ac){_0x5ec15f=_0x5ec15f-0x0;var _0x240350=_0xb36c[_0x5ec15f];return _0x240350;};'use strict';var Sequelize=require(_0xcb36('0x0'));module[_0xcb36('0x1')]={'name':{'type':Sequelize[_0xcb36('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xcb36('0x3')},'password':{'type':Sequelize[_0xcb36('0x2')]},'email':{'type':Sequelize[_0xcb36('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcb36('0x4')},'serverUrl':{'type':Sequelize[_0xcb36('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index af7df31..ad34beb 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 _0x127a=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','filters','find','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','calendar_duration','close_notes','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','statusCode','error','stack','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key'];(function(_0x4565eb,_0x167f79){var _0x67832=function(_0x5322ff){while(--_0x5322ff){_0x4565eb['push'](_0x4565eb['shift']());}};_0x67832(++_0x167f79);}(_0x127a,0x140));var _0xa127=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x127a[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa127('0x0'));var zipdir=require(_0xa127('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa127('0x2'));var BPromise=require(_0xa127('0x3'));var Mustache=require(_0xa127('0x4'));var util=require('util');var path=require(_0xa127('0x5'));var sox=require(_0xa127('0x6'));var csv=require('to-csv');var ejs=require(_0xa127('0x7'));var fs=require('fs');var fs_extra=require(_0xa127('0x8'));var _=require(_0xa127('0x9'));var squel=require(_0xa127('0xa'));var crypto=require(_0xa127('0xb'));var jsforce=require(_0xa127('0xc'));var deskjs=require(_0xa127('0xd'));var toCsv=require(_0xa127('0xe'));var querystring=require(_0xa127('0xf'));var Papa=require('papaparse');var Redis=require(_0xa127('0x10'));var authService=require(_0xa127('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa127('0x12'));var hardwareService=require(_0xa127('0x13'));var logger=require('../../config/logger')(_0xa127('0x14'));var utils=require(_0xa127('0x15'));var config=require(_0xa127('0x16'));var licenseUtil=require(_0xa127('0x17'));var db=require(_0xa127('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x170b18,_0x198a84){_0x198a84=_0x198a84||0xcc;return function(_0xfaa25b){if(_0xfaa25b){return _0x170b18['sendStatus'](_0x198a84);}return _0x170b18['status'](_0x198a84)[_0xa127('0x19')]();};}function respondWithResult(_0x492129,_0x168702){_0x168702=_0x168702||0xc8;return function(_0x494066){if(_0x494066){return _0x492129['status'](_0x168702)['json'](_0x494066);}};}function respondWithFilteredResult(_0x18d380,_0x3e3a3d){return function(_0x4535c8){if(_0x4535c8){var _0x4b75ba=typeof _0x3e3a3d['offset']===_0xa127('0x1a')&&typeof _0x3e3a3d[_0xa127('0x1b')]==='undefined';var _0x1b9055=_0x4535c8[_0xa127('0x1c')];var _0x4d6625=_0x4b75ba?0x0:_0x3e3a3d[_0xa127('0x1d')];var _0x1e97c5=_0x4b75ba?_0x4535c8[_0xa127('0x1c')]:_0x3e3a3d[_0xa127('0x1d')]+_0x3e3a3d[_0xa127('0x1b')];var _0x9cffda;if(_0x1e97c5>=_0x1b9055){_0x1e97c5=_0x1b9055;_0x9cffda=0xc8;}else{_0x9cffda=0xce;}_0x18d380[_0xa127('0x1e')](_0x9cffda);return _0x18d380[_0xa127('0x1f')](_0xa127('0x20'),_0x4d6625+'-'+_0x1e97c5+'/'+_0x1b9055)[_0xa127('0x21')](_0x4535c8);}return null;};}function patchUpdates(_0x4e6ae3){return function(_0x45ac37){try{jsonpatch[_0xa127('0x22')](_0x45ac37,_0x4e6ae3,!![]);}catch(_0x5c0d2b){return BPromise['reject'](_0x5c0d2b);}return _0x45ac37[_0xa127('0x23')]();};}function saveUpdates(_0x7ad4,_0xc1e132){return function(_0x20b9d3){if(_0x20b9d3){return _0x20b9d3[_0xa127('0x24')](_0x7ad4)[_0xa127('0x25')](function(_0x285412){return _0x285412;});}return null;};}function removeEntity(_0x3a3246,_0x4d41ea){return function(_0x2aad87){if(_0x2aad87){return _0x2aad87[_0xa127('0x26')]()['then'](function(){_0x3a3246[_0xa127('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22b988,_0x310838){return function(_0xd2f165){if(!_0xd2f165){_0x22b988['sendStatus'](0x194);}return _0xd2f165;};}function handleError(_0x50ed9d,_0x5a051b){_0x5a051b=_0x5a051b||0x1f4;return function(_0x2f54fe){logger['error'](_0x2f54fe['stack']);if(_0x2f54fe[_0xa127('0x27')]){delete _0x2f54fe[_0xa127('0x27')];}_0x50ed9d['status'](_0x5a051b)[_0xa127('0x28')](_0x2f54fe);};}exports[_0xa127('0x29')]=function(_0x5947f6,_0x5764c7){var _0x99a769={},_0x1e2dbb={},_0x1bfef7={'count':0x0,'rows':[]};var _0x5241a2=_[_0xa127('0x2a')](db[_0xa127('0x2b')][_0xa127('0x2c')],function(_0x1f7ada){return{'name':_0x1f7ada[_0xa127('0x2d')],'type':_0x1f7ada[_0xa127('0x2e')][_0xa127('0x2f')]};});_0x1e2dbb[_0xa127('0x30')]=_['map'](_0x5241a2,_0xa127('0x27'));_0x1e2dbb[_0xa127('0x31')]=_[_0xa127('0x32')](_0x5947f6[_0xa127('0x31')]);_0x1e2dbb['filters']=_[_0xa127('0x33')](_0x1e2dbb[_0xa127('0x30')],_0x1e2dbb[_0xa127('0x31')]);_0x99a769['attributes']=_[_0xa127('0x33')](_0x1e2dbb[_0xa127('0x30')],qs['fields'](_0x5947f6[_0xa127('0x31')][_0xa127('0x34')]));_0x99a769[_0xa127('0x35')]=_0x99a769['attributes'][_0xa127('0x36')]?_0x99a769[_0xa127('0x35')]:_0x1e2dbb['model'];if(!_0x5947f6['query'][_0xa127('0x37')](_0xa127('0x38'))){_0x99a769[_0xa127('0x1b')]=qs[_0xa127('0x1b')](_0x5947f6[_0xa127('0x31')][_0xa127('0x1b')]);_0x99a769[_0xa127('0x1d')]=qs['offset'](_0x5947f6[_0xa127('0x31')]['offset']);}_0x99a769[_0xa127('0x39')]=qs[_0xa127('0x3a')](_0x5947f6['query'][_0xa127('0x3a')]);_0x99a769['where']=qs['filters'](_[_0xa127('0x3b')](_0x5947f6[_0xa127('0x31')],_0x1e2dbb['filters']),_0x5241a2);if(_0x5947f6[_0xa127('0x31')][_0xa127('0x3c')]){_0x99a769[_0xa127('0x3d')]=_[_0xa127('0x3e')](_0x99a769[_0xa127('0x3d')],{'$or':_[_0xa127('0x2a')](_0x5241a2,function(_0x4b6a7e){if(_0x4b6a7e[_0xa127('0x2e')]!=='VIRTUAL'){var _0x441881={};_0x441881[_0x4b6a7e['name']]={'$like':'%'+_0x5947f6['query'][_0xa127('0x3c')]+'%'};return _0x441881;}})});}_0x99a769=_['merge']({},_0x99a769,_0x5947f6[_0xa127('0x3f')]);var _0x27a2b9={'where':_0x99a769[_0xa127('0x3d')]};return db[_0xa127('0x2b')]['count'](_0x27a2b9)[_0xa127('0x25')](function(_0x1c3d67){_0x1bfef7[_0xa127('0x1c')]=_0x1c3d67;if(_0x5947f6['query'][_0xa127('0x40')]){_0x99a769[_0xa127('0x41')]=[{'all':!![]}];}return db[_0xa127('0x2b')][_0xa127('0x42')](_0x99a769);})[_0xa127('0x25')](function(_0x5c3ed7){_0x1bfef7['rows']=_0x5c3ed7;return _0x1bfef7;})[_0xa127('0x25')](respondWithFilteredResult(_0x5764c7,_0x99a769))[_0xa127('0x43')](handleError(_0x5764c7,null));};exports[_0xa127('0x44')]=function(_0x4b93a6,_0x5b0754){var _0xf67dd3={'raw':![],'where':{'id':_0x4b93a6[_0xa127('0x45')]['id']}},_0x48b89c={};_0x48b89c['model']=_[_0xa127('0x32')](db[_0xa127('0x2b')][_0xa127('0x2c')]);_0x48b89c[_0xa127('0x31')]=_[_0xa127('0x32')](_0x4b93a6[_0xa127('0x31')]);_0x48b89c[_0xa127('0x46')]=_[_0xa127('0x33')](_0x48b89c[_0xa127('0x30')],_0x48b89c[_0xa127('0x31')]);_0xf67dd3[_0xa127('0x35')]=_[_0xa127('0x33')](_0x48b89c['model'],qs[_0xa127('0x34')](_0x4b93a6[_0xa127('0x31')]['fields']));_0xf67dd3['attributes']=_0xf67dd3[_0xa127('0x35')][_0xa127('0x36')]?_0xf67dd3[_0xa127('0x35')]:_0x48b89c[_0xa127('0x30')];if(_0x4b93a6['query'][_0xa127('0x40')]){_0xf67dd3[_0xa127('0x41')]=[{'all':!![]}];}_0xf67dd3=_['merge']({},_0xf67dd3,_0x4b93a6[_0xa127('0x3f')]);return db[_0xa127('0x2b')][_0xa127('0x47')](_0xf67dd3)[_0xa127('0x25')](handleEntityNotFound(_0x5b0754,null))[_0xa127('0x25')](respondWithResult(_0x5b0754,null))[_0xa127('0x43')](handleError(_0x5b0754,null));};exports[_0xa127('0x48')]=function(_0x1f61af,_0x4b6537){return db[_0xa127('0x2b')][_0xa127('0x48')](_0x1f61af['body'],{})[_0xa127('0x25')](respondWithResult(_0x4b6537,0xc9))['catch'](handleError(_0x4b6537,null));};exports[_0xa127('0x24')]=function(_0x5dc5d5,_0x36a36b){if(_0x5dc5d5[_0xa127('0x49')]['id']){delete _0x5dc5d5[_0xa127('0x49')]['id'];}return db[_0xa127('0x2b')][_0xa127('0x47')]({'where':{'id':_0x5dc5d5['params']['id']}})['then'](handleEntityNotFound(_0x36a36b,null))[_0xa127('0x25')](saveUpdates(_0x5dc5d5[_0xa127('0x49')],null))['then'](respondWithResult(_0x36a36b,null))[_0xa127('0x43')](handleError(_0x36a36b,null));};exports[_0xa127('0x26')]=function(_0x572b03,_0x4a4f43){return db['ServicenowAccount'][_0xa127('0x47')]({'where':{'id':_0x572b03[_0xa127('0x45')]['id']}})[_0xa127('0x25')](handleEntityNotFound(_0x4a4f43,null))[_0xa127('0x25')](removeEntity(_0x4a4f43,null))[_0xa127('0x43')](handleError(_0x4a4f43,null));};exports['getConfigurations']=function(_0x4f8f6d,_0xf5c499,_0x126a9c){var _0x1f429d={};var _0x2207e0={};var _0x7ea9dc;var _0x902751;return db[_0xa127('0x2b')][_0xa127('0x4a')]({'where':{'id':_0x4f8f6d[_0xa127('0x45')]['id']}})[_0xa127('0x25')](handleEntityNotFound(_0xf5c499,null))[_0xa127('0x25')](function(_0x20a81c){if(_0x20a81c){_0x7ea9dc=_0x20a81c;_0x2207e0[_0xa127('0x30')]=_[_0xa127('0x32')](db[_0xa127('0x4b')]['rawAttributes']);_0x2207e0[_0xa127('0x31')]=_['keys'](_0x4f8f6d['query']);_0x2207e0[_0xa127('0x46')]=_['intersection'](_0x2207e0['model'],_0x2207e0['query']);_0x1f429d[_0xa127('0x35')]=_['intersection'](_0x2207e0[_0xa127('0x30')],qs[_0xa127('0x34')](_0x4f8f6d[_0xa127('0x31')][_0xa127('0x34')]));_0x1f429d['attributes']=_0x1f429d['attributes']['length']?_0x1f429d[_0xa127('0x35')]:_0x2207e0[_0xa127('0x30')];_0x1f429d['order']=qs[_0xa127('0x3a')](_0x4f8f6d[_0xa127('0x31')][_0xa127('0x3a')]);_0x1f429d[_0xa127('0x3d')]=qs[_0xa127('0x46')](_['pick'](_0x4f8f6d[_0xa127('0x31')],_0x2207e0[_0xa127('0x46')]));if(_0x4f8f6d[_0xa127('0x31')][_0xa127('0x3c')]){_0x1f429d[_0xa127('0x3d')]=_['merge'](_0x1f429d[_0xa127('0x3d')],{'$or':_['map'](_0x1f429d[_0xa127('0x35')],function(_0x5ef35a){var _0x2dcf0d={};_0x2dcf0d[_0x5ef35a]={'$like':'%'+_0x4f8f6d[_0xa127('0x31')]['filter']+'%'};return _0x2dcf0d;})});}_0x1f429d=_[_0xa127('0x3e')]({},_0x1f429d,_0x4f8f6d['options']);return _0x7ea9dc[_0xa127('0x4c')](_0x1f429d);}})[_0xa127('0x25')](function(_0x31e647){if(_0x31e647){_0x902751=_0x31e647[_0xa127('0x36')];if(!_0x4f8f6d['query'][_0xa127('0x37')]('nolimit')){_0x1f429d[_0xa127('0x1b')]=qs['limit'](_0x4f8f6d[_0xa127('0x31')][_0xa127('0x1b')]);_0x1f429d[_0xa127('0x1d')]=qs[_0xa127('0x1d')](_0x4f8f6d['query'][_0xa127('0x1d')]);}return _0x7ea9dc['getConfigurations'](_0x1f429d);}})[_0xa127('0x25')](function(_0x483bd5){if(_0x483bd5){return _0x483bd5?{'count':_0x902751,'rows':_0x483bd5}:null;}})[_0xa127('0x25')](respondWithResult(_0xf5c499,null))['catch'](handleError(_0xf5c499,null));};exports[_0xa127('0x4d')]=function(_0x5b0e8d,_0x167f19,_0x508189){if(_0x5b0e8d[_0xa127('0x49')]['id']){delete _0x5b0e8d[_0xa127('0x49')]['id'];}return db[_0xa127('0x2b')]['findOne']({'where':{'id':_0x5b0e8d['params']['id']}})[_0xa127('0x25')](handleEntityNotFound(_0x167f19,null))[_0xa127('0x25')](function(_0x3e7cc3){if(_0x3e7cc3){_0x5b0e8d[_0xa127('0x49')][_0xa127('0x4e')]=_0x3e7cc3['id'];_0x5b0e8d[_0xa127('0x49')]['Subjects']=integrations[_0xa127('0x4f')](_0x5b0e8d[_0xa127('0x49')][_0xa127('0x50')],_0x5b0e8d['body'][_0xa127('0x2e')]);_0x5b0e8d[_0xa127('0x49')][_0xa127('0x51')]=integrations['getDescriptions'](_0x5b0e8d['body']['channel'],_0x5b0e8d[_0xa127('0x49')][_0xa127('0x2e')]);return db[_0xa127('0x4b')][_0xa127('0x48')](_0x5b0e8d['body'],{'include':[{'model':db[_0xa127('0x52')],'as':'Subjects'},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x167f19,null))[_0xa127('0x43')](handleError(_0x167f19,null));};exports[_0xa127('0x53')]=function(_0x17bdd2,_0x1e8ca5,_0x4992a0){var _0x4ca75b=[_0xa127('0x54'),_0xa127('0x55'),_0xa127('0x56'),_0xa127('0x57'),_0xa127('0x58'),_0xa127('0x59'),_0xa127('0x5a'),_0xa127('0x5b'),_0xa127('0x5c')];var _0x2dc228=[_0xa127('0x5d'),_0xa127('0x54'),_0xa127('0x5e'),_0xa127('0x5f'),'upon_reject',_0xa127('0x60'),_0xa127('0x61'),_0xa127('0x55'),_0xa127('0x62'),_0xa127('0x63'),'resolved_by',_0xa127('0x64'),_0xa127('0x65'),_0xa127('0x66'),_0xa127('0x67'),_0xa127('0x68'),'state',_0xa127('0x69'),_0xa127('0x56'),'order',_0xa127('0x6a'),'closed_at',_0xa127('0x6b'),'delivery_plan',_0xa127('0x6c'),_0xa127('0x6d'),_0xa127('0x6e'),_0xa127('0x6f'),_0xa127('0x70'),_0xa127('0x71'),_0xa127('0x72'),_0xa127('0x73'),'expected_start',_0xa127('0x74'),_0xa127('0x75'),_0xa127('0x76'),_0xa127('0x77'),_0xa127('0x78'),'resolved_at',_0xa127('0x79'),'approval_set','subcategory','work_notes',_0xa127('0x7a'),_0xa127('0x58'),_0xa127('0x7b'),_0xa127('0x7c'),_0xa127('0x7d'),_0xa127('0x7e'),'business_stc',_0xa127('0x7f'),'description',_0xa127('0x80'),_0xa127('0x59'),'sys_class_name',_0xa127('0x81'),'closed_by','follow_up','parent_incident',_0xa127('0x82'),_0xa127('0x83'),_0xa127('0x84'),'incident_state',_0xa127('0x85'),_0xa127('0x86'),_0xa127('0x87'),_0xa127('0x88'),_0xa127('0x89'),_0xa127('0x8a'),'severity',_0xa127('0x8b'),'sla_due','approval',_0xa127('0x8c'),_0xa127('0x8d'),_0xa127('0x8e'),_0xa127('0x8f'),_0xa127('0x90'),_0xa127('0x91'),_0xa127('0x92'),'correlation_id',_0xa127('0x93'),_0xa127('0x5c')];var _0x105b70='';var _0x38e4b6='';var _0x5f14be=[];var _0x4f7e7f='';var _0x484da7='';var _0x1d4f4a=[];var _0xd221a9='';var _0x5cc0d6='';var _0x392c7b={};var _0x19969f='';return db[_0xa127('0x2b')][_0xa127('0x4a')]({'where':{'id':_0x17bdd2[_0xa127('0x45')]['id']},'attributes':['id',_0xa127('0x94'),_0xa127('0x95'),'email',_0xa127('0x96'),'serverUrl']})[_0xa127('0x25')](handleEntityNotFound(_0x1e8ca5,null))[_0xa127('0x25')](function(_0x40e0ed){if(_0x40e0ed){_0x19969f=_0x40e0ed[_0xa127('0x96')];var _0x776b02=_0x19969f[_0xa127('0x97')](-0x1);if(_0x776b02==='/'){_0x19969f=_0x19969f[_0xa127('0x98')](0x0,_0x19969f[_0xa127('0x99')](_0x776b02));}_0x5cc0d6=util[_0xa127('0x9a')]('%s/api/now/doc/table/schema/',_0x19969f);_0xd221a9=util[_0xa127('0x9a')](_0xa127('0x9b'),_0x19969f);_0x392c7b={'user':_0x40e0ed[_0xa127('0x94')],'pass':_0x40e0ed[_0xa127('0x95')]};var _0x16baf4={'method':_0xa127('0x9c'),'uri':_0x5cc0d6+_0xa127('0x9d'),'auth':_0x392c7b,'json':!![]};return rp(_0x16baf4);}})['then'](function(_0x3f3d3d){if(_0x3f3d3d[_0xa127('0x9e')]['length']>0x0){_0x105b70=_0x3f3d3d['result'];}console[_0xa127('0x9f')](_0xa127('0xa0'),_0x105b70);_0x1d4f4a=[];_0x38e4b6=Object[_0xa127('0xa1')]([],_0x105b70);_[_0xa127('0xa2')](_0x38e4b6,function(_0x5eaaf2){return!_0x4ca75b[_0xa127('0xa3')](_0x5eaaf2['name']);});_0x38e4b6[_0xa127('0xa4')](function(_0x360271){var _0x54c65c=createFieldObject(_0xd221a9,_0x392c7b,_0x360271[_0xa127('0xa5')],_0x360271[_0xa127('0x27')],_0x360271[_0xa127('0xa6')],![]);_0x1d4f4a[_0xa127('0xa7')](_0x54c65c);});return Promise[_0xa127('0xa8')](_0x1d4f4a);})[_0xa127('0x25')](function(_0x25be51){_0x5f14be=_0x25be51;_0x4f7e7f=Object[_0xa127('0xa1')]([],_0x105b70);console[_0xa127('0x9f')](_0xa127('0xa9'),_0x105b70);_[_0xa127('0xa2')](_0x4f7e7f,function(_0xb2fbd0){return _0x2dc228[_0xa127('0xa3')](_0xb2fbd0['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4f7e7f);_0x1d4f4a=[];_0x4f7e7f['forEach'](function(_0x485550){var _0x3ad25d=createFieldObject(_0xd221a9,_0x392c7b,_0x485550[_0xa127('0xa5')],_0x485550[_0xa127('0x27')],_0x485550[_0xa127('0xa6')],!![]);_0x1d4f4a['push'](_0x3ad25d);});return Promise[_0xa127('0xa8')](_0x1d4f4a);})[_0xa127('0x25')](function(_0x1f83b7){_0x484da7=_0x1f83b7;var _0x32a698=_0x5f14be[_0xa127('0xaa')](_0x484da7);return{'count':_0x32a698[_0xa127('0x36')],'rows':_0x32a698};})[_0xa127('0x25')](respondWithResult(_0x1e8ca5,null))[_0xa127('0x43')](function(_0x2db74f){console['log'](_0xa127('0xab')+_0x2db74f);var _0x546bf3=_0x17bdd2['query'][_0xa127('0xac')]?0x1f4:_0x2db74f[_0xa127('0xad')]||0x1f4;logger[_0xa127('0xae')](_0x2db74f[_0xa127('0xaf')]);delete _0x2db74f[_0xa127('0x27')];if(_0x546bf3===0x191){_0x546bf3=0x190;}_0x1e8ca5['status'](_0x546bf3)[_0xa127('0x28')](_0x17bdd2[_0xa127('0x31')][_0xa127('0xac')]?{'message':_0xa127('0xb0'),'statusCode':_0x2db74f[_0xa127('0xad')]}:_0x2db74f);});};function createFieldObject(_0x150f12,_0x32e657,_0x29df85,_0x140beb,_0x28628f,_0x424446){return new Promise(function(_0x3a690f,_0x47462d){var _0x475b75={'id':_0x140beb,'name':_0x28628f,'custom':_0x424446};if(_0x29df85===_0xa127('0xb1')){_0x475b75[_0xa127('0x3f')]=[{'name':_0xa127('0xb2'),'value':'true'},{'name':_0xa127('0xb3'),'value':_0xa127('0xb4')}];_0x3a690f(_0x475b75);}else{var _0x4db966={'method':_0xa127('0x9c'),'uri':_0x150f12+_0xa127('0xb5')+_0x140beb,'auth':_0x32e657,'json':!![]};return rp(_0x4db966)[_0xa127('0x25')](function(_0x2321b5){var _0x496286=[];if(_0x2321b5['result'][_0xa127('0x36')]>0x0){_0x2321b5[_0xa127('0x9e')][_0xa127('0xa4')](function(_0x129eff){if(_0x129eff[_0xa127('0xb6')]===_0xa127('0xb4')){var _0x368a08={'name':_0x129eff[_0xa127('0xa6')],'value':_0x129eff[_0xa127('0xb7')]};_0x496286['push'](_0x368a08);}});}_0x475b75[_0xa127('0x3f')]=_0x496286;if(_0x475b75['options'][_0xa127('0x36')]>0x0){_0x3a690f(_0x475b75);}else{if(_0x424446==![]){_0x3a690f();}else{_0x3a690f(_0x475b75);}}});}});} \ No newline at end of file +var _0xf881=['name','send','index','ServicenowAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','findAll','catch','show','includeAll','include','find','create','body','params','getConfigurations','findOne','keys','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowConfiguration','made_sla','knowledge','subcategory','close_code','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','hold_reason','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','active','priority','sys_domain_path','rfc','time_worked','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','assigned_to','approval','due_date','reopen_count','sys_tags','escalation','location','username','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','fast-json-patch','request-promise','moment','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','error','stack'];(function(_0x3e2e63,_0x21dd75){var _0x499702=function(_0x4a485d){while(--_0x4a485d){_0x3e2e63['push'](_0x3e2e63['shift']());}};_0x499702(++_0x21dd75);}(_0xf881,0x87));var _0x1f88=function(_0x195fa5,_0x2fefc9){_0x195fa5=_0x195fa5-0x0;var _0x3f18ad=_0xf881[_0x195fa5];return _0x3f18ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f88('0x0'));var rp=require(_0x1f88('0x1'));var moment=require(_0x1f88('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1f88('0x3'));var path=require(_0x1f88('0x4'));var sox=require(_0x1f88('0x5'));var csv=require(_0x1f88('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f88('0x7'));var _=require('lodash');var squel=require(_0x1f88('0x8'));var crypto=require(_0x1f88('0x9'));var jsforce=require(_0x1f88('0xa'));var deskjs=require(_0x1f88('0xb'));var toCsv=require(_0x1f88('0x6'));var querystring=require(_0x1f88('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f88('0xd'));var qs=require(_0x1f88('0xe'));var as=require(_0x1f88('0xf'));var hardwareService=require(_0x1f88('0x10'));var logger=require(_0x1f88('0x11'))(_0x1f88('0x12'));var utils=require('../../config/utils');var config=require(_0x1f88('0x13'));var licenseUtil=require(_0x1f88('0x14'));var db=require(_0x1f88('0x15'))['db'];var integrations=require(_0x1f88('0x16'));function respondWithStatusCode(_0x53ab69,_0x35921d){_0x35921d=_0x35921d||0xcc;return function(_0x1b3c4c){if(_0x1b3c4c){return _0x53ab69[_0x1f88('0x17')](_0x35921d);}return _0x53ab69['status'](_0x35921d)[_0x1f88('0x18')]();};}function respondWithResult(_0x334006,_0x310e0b){_0x310e0b=_0x310e0b||0xc8;return function(_0x129793){if(_0x129793){return _0x334006[_0x1f88('0x19')](_0x310e0b)[_0x1f88('0x1a')](_0x129793);}};}function respondWithFilteredResult(_0x2ae0e1,_0x2be7bd){return function(_0x131c5f){if(_0x131c5f){var _0x57c879=typeof _0x2be7bd['offset']===_0x1f88('0x1b')&&typeof _0x2be7bd[_0x1f88('0x1c')]==='undefined';var _0x38369c=_0x131c5f['count'];var _0x41d1fb=_0x57c879?0x0:_0x2be7bd[_0x1f88('0x1d')];var _0x51327e=_0x57c879?_0x131c5f[_0x1f88('0x1e')]:_0x2be7bd[_0x1f88('0x1d')]+_0x2be7bd[_0x1f88('0x1c')];var _0x12ceda;if(_0x51327e>=_0x38369c){_0x51327e=_0x38369c;_0x12ceda=0xc8;}else{_0x12ceda=0xce;}_0x2ae0e1['status'](_0x12ceda);return _0x2ae0e1[_0x1f88('0x1f')](_0x1f88('0x20'),_0x41d1fb+'-'+_0x51327e+'/'+_0x38369c)['json'](_0x131c5f);}return null;};}function patchUpdates(_0x4dcf47){return function(_0xc812f7){try{jsonpatch[_0x1f88('0x21')](_0xc812f7,_0x4dcf47,!![]);}catch(_0x116cf3){return BPromise['reject'](_0x116cf3);}return _0xc812f7[_0x1f88('0x22')]();};}function saveUpdates(_0x13347c,_0x2503e6){return function(_0x4bd1ea){if(_0x4bd1ea){return _0x4bd1ea[_0x1f88('0x23')](_0x13347c)[_0x1f88('0x24')](function(_0x49b59f){return _0x49b59f;});}return null;};}function removeEntity(_0xcd18ff,_0x4427fb){return function(_0x579681){if(_0x579681){return _0x579681['destroy']()[_0x1f88('0x24')](function(){_0xcd18ff[_0x1f88('0x19')](0xcc)[_0x1f88('0x18')]();});}};}function handleEntityNotFound(_0x2c2513,_0x2cc09a){return function(_0x1fd041){if(!_0x1fd041){_0x2c2513[_0x1f88('0x17')](0x194);}return _0x1fd041;};}function handleError(_0x57b97d,_0x34d65e){_0x34d65e=_0x34d65e||0x1f4;return function(_0x1064e7){logger[_0x1f88('0x25')](_0x1064e7[_0x1f88('0x26')]);if(_0x1064e7[_0x1f88('0x27')]){delete _0x1064e7[_0x1f88('0x27')];}_0x57b97d[_0x1f88('0x19')](_0x34d65e)[_0x1f88('0x28')](_0x1064e7);};}exports[_0x1f88('0x29')]=function(_0x5a6b70,_0x213c24){var _0x205e28={},_0xaba7a8={},_0x370aa8={'count':0x0,'rows':[]};var _0x2cb080=_['map'](db[_0x1f88('0x2a')][_0x1f88('0x2b')],function(_0x51115d){return{'name':_0x51115d[_0x1f88('0x2c')],'type':_0x51115d[_0x1f88('0x2d')]['key']};});_0xaba7a8[_0x1f88('0x2e')]=_[_0x1f88('0x2f')](_0x2cb080,'name');_0xaba7a8['query']=_['keys'](_0x5a6b70[_0x1f88('0x30')]);_0xaba7a8[_0x1f88('0x31')]=_[_0x1f88('0x32')](_0xaba7a8[_0x1f88('0x2e')],_0xaba7a8[_0x1f88('0x30')]);_0x205e28[_0x1f88('0x33')]=_['intersection'](_0xaba7a8['model'],qs[_0x1f88('0x34')](_0x5a6b70[_0x1f88('0x30')]['fields']));_0x205e28[_0x1f88('0x33')]=_0x205e28['attributes'][_0x1f88('0x35')]?_0x205e28[_0x1f88('0x33')]:_0xaba7a8['model'];if(!_0x5a6b70[_0x1f88('0x30')][_0x1f88('0x36')](_0x1f88('0x37'))){_0x205e28[_0x1f88('0x1c')]=qs['limit'](_0x5a6b70['query']['limit']);_0x205e28[_0x1f88('0x1d')]=qs['offset'](_0x5a6b70['query']['offset']);}_0x205e28['order']=qs['sort'](_0x5a6b70[_0x1f88('0x30')][_0x1f88('0x38')]);_0x205e28[_0x1f88('0x39')]=qs['filters'](_['pick'](_0x5a6b70[_0x1f88('0x30')],_0xaba7a8[_0x1f88('0x31')]),_0x2cb080);if(_0x5a6b70[_0x1f88('0x30')][_0x1f88('0x3a')]){_0x205e28[_0x1f88('0x39')]=_[_0x1f88('0x3b')](_0x205e28[_0x1f88('0x39')],{'$or':_[_0x1f88('0x2f')](_0x2cb080,function(_0x14018e){if(_0x14018e[_0x1f88('0x2d')]!=='VIRTUAL'){var _0x2f7f11={};_0x2f7f11[_0x14018e[_0x1f88('0x27')]]={'$like':'%'+_0x5a6b70[_0x1f88('0x30')]['filter']+'%'};return _0x2f7f11;}})});}_0x205e28=_[_0x1f88('0x3b')]({},_0x205e28,_0x5a6b70[_0x1f88('0x3c')]);var _0x401f17={'where':_0x205e28['where']};return db['ServicenowAccount']['count'](_0x401f17)[_0x1f88('0x24')](function(_0x341a48){_0x370aa8[_0x1f88('0x1e')]=_0x341a48;if(_0x5a6b70[_0x1f88('0x30')]['includeAll']){_0x205e28['include']=[{'all':!![]}];}return db[_0x1f88('0x2a')][_0x1f88('0x3d')](_0x205e28);})[_0x1f88('0x24')](function(_0x57c82e){_0x370aa8['rows']=_0x57c82e;return _0x370aa8;})['then'](respondWithFilteredResult(_0x213c24,_0x205e28))[_0x1f88('0x3e')](handleError(_0x213c24,null));};exports[_0x1f88('0x3f')]=function(_0x3b5e1b,_0x832fd3){var _0x250932={'raw':![],'where':{'id':_0x3b5e1b['params']['id']}},_0xc9555a={};_0xc9555a['model']=_['keys'](db[_0x1f88('0x2a')][_0x1f88('0x2b')]);_0xc9555a[_0x1f88('0x30')]=_['keys'](_0x3b5e1b[_0x1f88('0x30')]);_0xc9555a[_0x1f88('0x31')]=_[_0x1f88('0x32')](_0xc9555a[_0x1f88('0x2e')],_0xc9555a[_0x1f88('0x30')]);_0x250932[_0x1f88('0x33')]=_[_0x1f88('0x32')](_0xc9555a['model'],qs[_0x1f88('0x34')](_0x3b5e1b[_0x1f88('0x30')]['fields']));_0x250932[_0x1f88('0x33')]=_0x250932[_0x1f88('0x33')][_0x1f88('0x35')]?_0x250932[_0x1f88('0x33')]:_0xc9555a['model'];if(_0x3b5e1b['query'][_0x1f88('0x40')]){_0x250932[_0x1f88('0x41')]=[{'all':!![]}];}_0x250932=_['merge']({},_0x250932,_0x3b5e1b[_0x1f88('0x3c')]);return db['ServicenowAccount'][_0x1f88('0x42')](_0x250932)[_0x1f88('0x24')](handleEntityNotFound(_0x832fd3,null))['then'](respondWithResult(_0x832fd3,null))[_0x1f88('0x3e')](handleError(_0x832fd3,null));};exports[_0x1f88('0x43')]=function(_0x4f146b,_0x3df333){return db[_0x1f88('0x2a')][_0x1f88('0x43')](_0x4f146b['body'],{})['then'](respondWithResult(_0x3df333,0xc9))[_0x1f88('0x3e')](handleError(_0x3df333,null));};exports[_0x1f88('0x23')]=function(_0xbdc526,_0x4f8351){if(_0xbdc526[_0x1f88('0x44')]['id']){delete _0xbdc526[_0x1f88('0x44')]['id'];}return db[_0x1f88('0x2a')][_0x1f88('0x42')]({'where':{'id':_0xbdc526[_0x1f88('0x45')]['id']}})[_0x1f88('0x24')](handleEntityNotFound(_0x4f8351,null))[_0x1f88('0x24')](saveUpdates(_0xbdc526[_0x1f88('0x44')],null))[_0x1f88('0x24')](respondWithResult(_0x4f8351,null))[_0x1f88('0x3e')](handleError(_0x4f8351,null));};exports['destroy']=function(_0x51b140,_0x2f4abb){return db[_0x1f88('0x2a')][_0x1f88('0x42')]({'where':{'id':_0x51b140[_0x1f88('0x45')]['id']}})[_0x1f88('0x24')](handleEntityNotFound(_0x2f4abb,null))[_0x1f88('0x24')](removeEntity(_0x2f4abb,null))[_0x1f88('0x3e')](handleError(_0x2f4abb,null));};exports[_0x1f88('0x46')]=function(_0x171661,_0x3bdabc,_0x47afc6){var _0x4aec80={};var _0x23142d={};var _0x4a7179;var _0x3aee30;return db[_0x1f88('0x2a')][_0x1f88('0x47')]({'where':{'id':_0x171661[_0x1f88('0x45')]['id']}})['then'](handleEntityNotFound(_0x3bdabc,null))['then'](function(_0x3b85a8){if(_0x3b85a8){_0x4a7179=_0x3b85a8;_0x23142d[_0x1f88('0x2e')]=_[_0x1f88('0x48')](db['ServicenowConfiguration'][_0x1f88('0x2b')]);_0x23142d[_0x1f88('0x30')]=_[_0x1f88('0x48')](_0x171661[_0x1f88('0x30')]);_0x23142d[_0x1f88('0x31')]=_['intersection'](_0x23142d['model'],_0x23142d['query']);_0x4aec80['attributes']=_['intersection'](_0x23142d['model'],qs['fields'](_0x171661['query']['fields']));_0x4aec80[_0x1f88('0x33')]=_0x4aec80['attributes'][_0x1f88('0x35')]?_0x4aec80[_0x1f88('0x33')]:_0x23142d[_0x1f88('0x2e')];_0x4aec80[_0x1f88('0x49')]=qs[_0x1f88('0x38')](_0x171661[_0x1f88('0x30')][_0x1f88('0x38')]);_0x4aec80[_0x1f88('0x39')]=qs[_0x1f88('0x31')](_['pick'](_0x171661[_0x1f88('0x30')],_0x23142d[_0x1f88('0x31')]));if(_0x171661[_0x1f88('0x30')]['filter']){_0x4aec80['where']=_[_0x1f88('0x3b')](_0x4aec80[_0x1f88('0x39')],{'$or':_['map'](_0x4aec80['attributes'],function(_0x67e296){var _0x1b03bb={};_0x1b03bb[_0x67e296]={'$like':'%'+_0x171661[_0x1f88('0x30')][_0x1f88('0x3a')]+'%'};return _0x1b03bb;})});}_0x4aec80=_[_0x1f88('0x3b')]({},_0x4aec80,_0x171661[_0x1f88('0x3c')]);return _0x4a7179[_0x1f88('0x46')](_0x4aec80);}})[_0x1f88('0x24')](function(_0x2435a9){if(_0x2435a9){_0x3aee30=_0x2435a9['length'];if(!_0x171661[_0x1f88('0x30')]['hasOwnProperty'](_0x1f88('0x37'))){_0x4aec80[_0x1f88('0x1c')]=qs[_0x1f88('0x1c')](_0x171661['query'][_0x1f88('0x1c')]);_0x4aec80['offset']=qs[_0x1f88('0x1d')](_0x171661[_0x1f88('0x30')][_0x1f88('0x1d')]);}return _0x4a7179[_0x1f88('0x46')](_0x4aec80);}})['then'](function(_0x1a337b){if(_0x1a337b){return _0x1a337b?{'count':_0x3aee30,'rows':_0x1a337b}:null;}})[_0x1f88('0x24')](respondWithResult(_0x3bdabc,null))[_0x1f88('0x3e')](handleError(_0x3bdabc,null));};exports[_0x1f88('0x4a')]=function(_0x1f05da,_0x2a4eda,_0x24e710){if(_0x1f05da[_0x1f88('0x44')]['id']){delete _0x1f05da[_0x1f88('0x44')]['id'];}return db[_0x1f88('0x2a')][_0x1f88('0x47')]({'where':{'id':_0x1f05da['params']['id']}})[_0x1f88('0x24')](handleEntityNotFound(_0x2a4eda,null))[_0x1f88('0x24')](function(_0x10e199){if(_0x10e199){_0x1f05da[_0x1f88('0x44')][_0x1f88('0x4b')]=_0x10e199['id'];_0x1f05da['body'][_0x1f88('0x4c')]=integrations[_0x1f88('0x4d')](_0x1f05da['body']['channel'],_0x1f05da[_0x1f88('0x44')][_0x1f88('0x2d')]);_0x1f05da[_0x1f88('0x44')][_0x1f88('0x4e')]=integrations[_0x1f88('0x4f')](_0x1f05da[_0x1f88('0x44')][_0x1f88('0x50')],_0x1f05da[_0x1f88('0x44')]['type']);return db[_0x1f88('0x51')][_0x1f88('0x43')](_0x1f05da[_0x1f88('0x44')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x1f88('0x4e')}]});}return null;})[_0x1f88('0x24')](respondWithResult(_0x2a4eda,null))[_0x1f88('0x3e')](handleError(_0x2a4eda,null));};exports['getFields']=function(_0x2be040,_0x38a2db,_0x1eb0cb){var _0x42b412=[_0x1f88('0x52'),'hold_reason',_0x1f88('0x53'),_0x1f88('0x54'),_0x1f88('0x55'),_0x1f88('0x56'),'incident_state',_0x1f88('0x57'),_0x1f88('0x58')];var _0x1f1d08=['parent','made_sla',_0x1f88('0x59'),_0x1f88('0x5a'),_0x1f88('0x5b'),_0x1f88('0x5c'),'child_incidents',_0x1f88('0x5d'),'approval_history','number',_0x1f88('0x5e'),'sys_updated_by',_0x1f88('0x5f'),_0x1f88('0x60'),_0x1f88('0x61'),'sys_domain',_0x1f88('0x62'),_0x1f88('0x63'),'knowledge','order',_0x1f88('0x64'),'closed_at',_0x1f88('0x65'),_0x1f88('0x66'),'impact',_0x1f88('0x67'),'work_notes_list','business_service',_0x1f88('0x68'),_0x1f88('0x69'),_0x1f88('0x6a'),_0x1f88('0x6b'),'expected_start','opened_at','business_duration',_0x1f88('0x6c'),_0x1f88('0x6d'),_0x1f88('0x6e'),'resolved_at',_0x1f88('0x6f'),_0x1f88('0x70'),_0x1f88('0x54'),_0x1f88('0x71'),_0x1f88('0x72'),_0x1f88('0x55'),_0x1f88('0x73'),_0x1f88('0x74'),_0x1f88('0x75'),_0x1f88('0x76'),_0x1f88('0x77'),_0x1f88('0x78'),_0x1f88('0x79'),_0x1f88('0x7a'),_0x1f88('0x56'),_0x1f88('0x7b'),'close_notes',_0x1f88('0x7c'),_0x1f88('0x7d'),_0x1f88('0x7e'),_0x1f88('0x7f'),_0x1f88('0x80'),_0x1f88('0x81'),_0x1f88('0x82'),_0x1f88('0x83'),_0x1f88('0x84'),_0x1f88('0x85'),'reassignment_count','activity_due',_0x1f88('0x86'),_0x1f88('0x57'),'comments','sla_due',_0x1f88('0x87'),'comments_and_work_notes',_0x1f88('0x88'),'sys_mod_count',_0x1f88('0x89'),_0x1f88('0x8a'),_0x1f88('0x8b'),'upon_approval','correlation_id',_0x1f88('0x8c'),'category'];var _0x343f28='';var _0x29630c='';var _0x2e8e9e=[];var _0x5d4b17='';var _0x1084bc='';var _0x564202=[];var _0x472f8d='';var _0x18c884='';var _0x2bc116={};var _0x13d529='';return db['ServicenowAccount'][_0x1f88('0x47')]({'where':{'id':_0x2be040[_0x1f88('0x45')]['id']},'attributes':['id',_0x1f88('0x8d'),'password',_0x1f88('0x8e'),_0x1f88('0x8f'),_0x1f88('0x90')]})['then'](handleEntityNotFound(_0x38a2db,null))[_0x1f88('0x24')](function(_0xdc18e6){if(_0xdc18e6){_0x13d529=_0xdc18e6[_0x1f88('0x8f')];var _0x23a301=_0x13d529['slice'](-0x1);if(_0x23a301==='/'){_0x13d529=_0x13d529[_0x1f88('0x91')](0x0,_0x13d529['lastIndexOf'](_0x23a301));}_0x18c884=util[_0x1f88('0x92')](_0x1f88('0x93'),_0x13d529);_0x472f8d=util[_0x1f88('0x92')]('%s/api/now/table/',_0x13d529);_0x2bc116={'user':_0xdc18e6[_0x1f88('0x8d')],'pass':_0xdc18e6[_0x1f88('0x94')]};var _0x1e7c7e={'method':_0x1f88('0x95'),'uri':_0x18c884+_0x1f88('0x96'),'auth':_0x2bc116,'json':!![]};return rp(_0x1e7c7e);}})[_0x1f88('0x24')](function(_0x47d8bf){if(_0x47d8bf['result'][_0x1f88('0x35')]>0x0){_0x343f28=_0x47d8bf[_0x1f88('0x97')];}console[_0x1f88('0x98')](_0x1f88('0x99'),_0x343f28);_0x564202=[];_0x29630c=Object[_0x1f88('0x9a')]([],_0x343f28);_[_0x1f88('0x9b')](_0x29630c,function(_0x1782ff){return!_0x42b412[_0x1f88('0x9c')](_0x1782ff[_0x1f88('0x27')]);});_0x29630c[_0x1f88('0x9d')](function(_0x3c3306){var _0xb2380e=createFieldObject(_0x472f8d,_0x2bc116,_0x3c3306[_0x1f88('0x9e')],_0x3c3306['name'],_0x3c3306[_0x1f88('0x9f')],![]);_0x564202[_0x1f88('0xa0')](_0xb2380e);});return Promise['all'](_0x564202);})[_0x1f88('0x24')](function(_0x49a3ec){_0x2e8e9e=_0x49a3ec;_0x5d4b17=Object[_0x1f88('0x9a')]([],_0x343f28);console[_0x1f88('0x98')](_0x1f88('0xa1'),_0x343f28);_[_0x1f88('0x9b')](_0x5d4b17,function(_0x291b95){return _0x1f1d08['includes'](_0x291b95[_0x1f88('0x27')]);});console[_0x1f88('0x98')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5d4b17);_0x564202=[];_0x5d4b17[_0x1f88('0x9d')](function(_0x2b534d){var _0x567b59=createFieldObject(_0x472f8d,_0x2bc116,_0x2b534d[_0x1f88('0x9e')],_0x2b534d['name'],_0x2b534d[_0x1f88('0x9f')],!![]);_0x564202[_0x1f88('0xa0')](_0x567b59);});return Promise[_0x1f88('0xa2')](_0x564202);})['then'](function(_0xcfe0f4){_0x1084bc=_0xcfe0f4;var _0x5a5499=_0x2e8e9e[_0x1f88('0xa3')](_0x1084bc);return{'count':_0x5a5499[_0x1f88('0x35')],'rows':_0x5a5499};})[_0x1f88('0x24')](respondWithResult(_0x38a2db,null))[_0x1f88('0x3e')](function(_0x458312){console['log'](_0x1f88('0xa4')+_0x458312);var _0x2183e4=_0x2be040[_0x1f88('0x30')][_0x1f88('0xa5')]?0x1f4:_0x458312[_0x1f88('0xa6')]||0x1f4;logger[_0x1f88('0x25')](_0x458312[_0x1f88('0x26')]);delete _0x458312[_0x1f88('0x27')];if(_0x2183e4===0x191){_0x2183e4=0x190;}_0x38a2db[_0x1f88('0x19')](_0x2183e4)[_0x1f88('0x28')](_0x2be040[_0x1f88('0x30')][_0x1f88('0xa5')]?{'message':_0x1f88('0xa7'),'statusCode':_0x458312[_0x1f88('0xa6')]}:_0x458312);});};function createFieldObject(_0x426efe,_0x5be147,_0x35569f,_0x3c8f39,_0x3cf859,_0x30aa92){return new Promise(function(_0x5bf329,_0x11aed6){var _0x433971={'id':_0x3c8f39,'name':_0x3cf859,'custom':_0x30aa92};if(_0x35569f==='boolean'){_0x433971[_0x1f88('0x3c')]=[{'name':_0x1f88('0xa8'),'value':_0x1f88('0xa9')},{'name':'False','value':_0x1f88('0xaa')}];_0x5bf329(_0x433971);}else{var _0x27a42c={'method':_0x1f88('0x95'),'uri':_0x426efe+_0x1f88('0xab')+_0x3c8f39,'auth':_0x5be147,'json':!![]};return rp(_0x27a42c)[_0x1f88('0x24')](function(_0x422b7a){var _0x1225c3=[];if(_0x422b7a[_0x1f88('0x97')]['length']>0x0){_0x422b7a[_0x1f88('0x97')][_0x1f88('0x9d')](function(_0x51a0b2){if(_0x51a0b2[_0x1f88('0xac')]==='false'){var _0x5510e9={'name':_0x51a0b2[_0x1f88('0x9f')],'value':_0x51a0b2[_0x1f88('0xad')]};_0x1225c3[_0x1f88('0xa0')](_0x5510e9);}});}_0x433971[_0x1f88('0x3c')]=_0x1225c3;if(_0x433971[_0x1f88('0x3c')][_0x1f88('0x35')]>0x0){_0x5bf329(_0x433971);}else{if(_0x30aa92==![]){_0x5bf329();}else{_0x5bf329(_0x433971);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 471ec44..dc59f9a 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 _0x1623=['path','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x57cde6,_0x46a4d4){var _0x5359a9=function(_0x4f9d60){while(--_0x4f9d60){_0x57cde6['push'](_0x57cde6['shift']());}};_0x5359a9(++_0x46a4d4);}(_0x1623,0xab));var _0x3162=function(_0x191000,_0x282ac2){_0x191000=_0x191000-0x0;var _0x190430=_0x1623[_0x191000];return _0x190430;};'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'));var integrations=require('../../components/integrations/configuration');module[_0x3162('0x7')]=function(_0x428de6,_0x53260d){return _0x428de6[_0x3162('0x8')](_0x3162('0x9'),attributes,{'tableName':_0x3162('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3828bb,_0x4745db){var _0xf0a36a=function(_0x39f573){while(--_0x39f573){_0x3828bb['push'](_0x3828bb['shift']());}};_0xf0a36a(++_0x4745db);}(_0x687b,0x14a));var _0xb687=function(_0x3ffadf,_0x47c3b1){_0x3ffadf=_0x3ffadf-0x0;var _0x46223d=_0x687b[_0x3ffadf];return _0x46223d;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 9059f5d..8717978 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 _0x8760=['then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowServicenowAccount','find','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x108250,_0x302d48){var _0x4727e5=function(_0x14de47){while(--_0x14de47){_0x108250['push'](_0x108250['shift']());}};_0x4727e5(++_0x302d48);}(_0x8760,0xf7));var _0x0876=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x8760[_0x412e27];return _0x53da42;};'use strict';var _=require(_0x0876('0x0'));var util=require(_0x0876('0x1'));var moment=require(_0x0876('0x2'));var BPromise=require(_0x0876('0x3'));var rs=require(_0x0876('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0876('0x5'))['db'];var utils=require(_0x0876('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0876('0x7'));var jayson=require(_0x0876('0x8'));var client=jayson[_0x0876('0x9')][_0x0876('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a36ad,_0x8f2ded,_0x93b3e0){return new BPromise(function(_0x24bdab,_0x3d5a18){return client[_0x0876('0xb')](_0x4a36ad,_0x93b3e0)[_0x0876('0xc')](function(_0x81ed2d){logger[_0x0876('0xd')](_0x0876('0xe'),_0x8f2ded,_0x0876('0xf'));logger['debug'](_0x0876('0x10'),_0x8f2ded,_0x0876('0xf'),JSON[_0x0876('0x11')](_0x81ed2d));if(_0x81ed2d[_0x0876('0x12')]){if(_0x81ed2d['error'][_0x0876('0x13')]===0x1f4){logger['error'](_0x0876('0xe'),_0x8f2ded,_0x81ed2d[_0x0876('0x12')][_0x0876('0x14')]);return _0x3d5a18(_0x81ed2d[_0x0876('0x12')]['message']);}logger['error'](_0x0876('0xe'),_0x8f2ded,_0x81ed2d[_0x0876('0x12')][_0x0876('0x14')]);return _0x24bdab(_0x81ed2d[_0x0876('0x12')][_0x0876('0x14')]);}else{logger[_0x0876('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x8f2ded,_0x0876('0xf'));_0x24bdab(_0x81ed2d[_0x0876('0x15')][_0x0876('0x14')]);}})[_0x0876('0x16')](function(_0x4fb047){logger[_0x0876('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x8f2ded,_0x4fb047);_0x3d5a18(_0x4fb047);});});}exports[_0x0876('0x17')]=function(_0x4c0ac7){var _0x2efa0a=this;return new Promise(function(_0x11319c,_0x5541f6){return db[_0x0876('0x18')][_0x0876('0x19')]({'raw':_0x4c0ac7[_0x0876('0x1a')]?_0x4c0ac7['options'][_0x0876('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c0ac7['options']?_0x4c0ac7[_0x0876('0x1a')][_0x0876('0x1c')]||null:null,'attributes':_0x4c0ac7[_0x0876('0x1a')]?_0x4c0ac7['options']['attributes']||null:null,'limit':_0x4c0ac7['options']?_0x4c0ac7[_0x0876('0x1a')][_0x0876('0x1d')]||null:null,'include':_0x4c0ac7['options']?_0x4c0ac7[_0x0876('0x1a')][_0x0876('0x1e')]?_[_0x0876('0x1f')](_0x4c0ac7[_0x0876('0x1a')][_0x0876('0x1e')],function(_0x561ae8){return{'model':db[_0x561ae8[_0x0876('0x20')]],'as':_0x561ae8['as'],'attributes':_0x561ae8[_0x0876('0x21')],'include':_0x561ae8[_0x0876('0x1e')]?_[_0x0876('0x1f')](_0x561ae8[_0x0876('0x1e')],function(_0x179884){return{'model':db[_0x179884[_0x0876('0x20')]],'as':_0x179884['as'],'attributes':_0x179884['attributes'],'include':_0x179884[_0x0876('0x1e')]?_[_0x0876('0x1f')](_0x179884['include'],function(_0x51423a){return{'model':db[_0x51423a[_0x0876('0x20')]],'as':_0x51423a['as'],'attributes':_0x51423a[_0x0876('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0876('0xc')](function(_0x32f0ec){logger['info'](_0x0876('0x17'),_0x4c0ac7);logger['debug'](_0x0876('0x17'),_0x4c0ac7,JSON[_0x0876('0x11')](_0x32f0ec));_0x11319c(_0x32f0ec);})[_0x0876('0x16')](function(_0x2ec990){logger['error'](_0x0876('0x17'),_0x2ec990[_0x0876('0x14')],_0x4c0ac7);_0x5541f6(_0x2efa0a[_0x0876('0x12')](0x1f4,_0x2ec990['message']));});});};exports[_0x0876('0x22')]=function(_0x4fc450){var _0x18b1cb=this;return new Promise(function(_0x12838f,_0x15a592){return db[_0x0876('0x18')][_0x0876('0x23')]({'raw':_0x4fc450['options']?_0x4fc450[_0x0876('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4fc450[_0x0876('0x1a')]?_0x4fc450[_0x0876('0x1a')][_0x0876('0x1c')]||null:null,'attributes':_0x4fc450[_0x0876('0x1a')]?_0x4fc450[_0x0876('0x1a')][_0x0876('0x21')]||null:null,'include':_0x4fc450[_0x0876('0x1a')]?_0x4fc450['options'][_0x0876('0x1e')]?_['map'](_0x4fc450[_0x0876('0x1a')][_0x0876('0x1e')],function(_0x369fc3){return{'model':db[_0x369fc3['model']],'as':_0x369fc3['as'],'attributes':_0x369fc3[_0x0876('0x21')],'include':_0x369fc3[_0x0876('0x1e')]?_[_0x0876('0x1f')](_0x369fc3[_0x0876('0x1e')],function(_0x461a8a){return{'model':db[_0x461a8a[_0x0876('0x20')]],'as':_0x461a8a['as'],'attributes':_0x461a8a[_0x0876('0x21')],'include':_0x461a8a[_0x0876('0x1e')]?_['map'](_0x461a8a['include'],function(_0x2f4318){return{'model':db[_0x2f4318[_0x0876('0x20')]],'as':_0x2f4318['as'],'attributes':_0x2f4318['attributes']};}):[]};}):[]};}):[]:[]})[_0x0876('0xc')](function(_0x5e1e2c){logger[_0x0876('0xd')](_0x0876('0x22'),_0x4fc450);logger[_0x0876('0x24')](_0x0876('0x22'),_0x4fc450,JSON[_0x0876('0x11')](_0x5e1e2c));_0x12838f(_0x5e1e2c);})[_0x0876('0x16')](function(_0x1f2155){logger['error']('ShowServicenowAccount',_0x1f2155[_0x0876('0x14')],_0x4fc450);_0x15a592(_0x18b1cb[_0x0876('0x12')](0x1f4,_0x1f2155['message']));});});}; \ No newline at end of file +var _0x379e=['message','result','findAll','options','raw','where','attributes','limit','map','include','model','GetServicenowAccount','catch','ShowServicenowAccount','ServicenowAccount','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1c547b,_0x2e1646){var _0x1e7bb1=function(_0x4a23b3){while(--_0x4a23b3){_0x1c547b['push'](_0x1c547b['shift']());}};_0x1e7bb1(++_0x2e1646);}(_0x379e,0x104));var _0xe379=function(_0x2b710a,_0x29b3eb){_0x2b710a=_0x2b710a-0x0;var _0x4ab4c1=_0x379e[_0x2b710a];return _0x4ab4c1;};'use strict';var _=require(_0xe379('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe379('0x1'));var fs=require('fs');var Redis=require(_0xe379('0x2'));var db=require(_0xe379('0x3'))['db'];var utils=require(_0xe379('0x4'));var logger=require(_0xe379('0x5'))(_0xe379('0x6'));var config=require(_0xe379('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe379('0x8')][_0xe379('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x166621,_0x1b6fed,_0x22cb37){return new BPromise(function(_0x5475e7,_0x10acc9){return client[_0xe379('0xa')](_0x166621,_0x22cb37)[_0xe379('0xb')](function(_0x21ce22){logger[_0xe379('0xc')](_0xe379('0xd'),_0x1b6fed,_0xe379('0xe'));logger[_0xe379('0xf')](_0xe379('0x10'),_0x1b6fed,'request\x20sent',JSON[_0xe379('0x11')](_0x21ce22));if(_0x21ce22[_0xe379('0x12')]){if(_0x21ce22[_0xe379('0x12')][_0xe379('0x13')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x1b6fed,_0x21ce22[_0xe379('0x12')][_0xe379('0x14')]);return _0x10acc9(_0x21ce22[_0xe379('0x12')][_0xe379('0x14')]);}logger[_0xe379('0x12')](_0xe379('0xd'),_0x1b6fed,_0x21ce22[_0xe379('0x12')][_0xe379('0x14')]);return _0x5475e7(_0x21ce22['error'][_0xe379('0x14')]);}else{logger[_0xe379('0xc')](_0xe379('0xd'),_0x1b6fed,_0xe379('0xe'));_0x5475e7(_0x21ce22[_0xe379('0x15')][_0xe379('0x14')]);}})['catch'](function(_0x2615bd){logger['error'](_0xe379('0xd'),_0x1b6fed,_0x2615bd);_0x10acc9(_0x2615bd);});});}exports['GetServicenowAccount']=function(_0x150d92){var _0x1d63ea=this;return new Promise(function(_0xe4f3d1,_0x373f03){return db['ServicenowAccount'][_0xe379('0x16')]({'raw':_0x150d92[_0xe379('0x17')]?_0x150d92[_0xe379('0x17')][_0xe379('0x18')]===undefined?!![]:![]:!![],'where':_0x150d92[_0xe379('0x17')]?_0x150d92['options'][_0xe379('0x19')]||null:null,'attributes':_0x150d92[_0xe379('0x17')]?_0x150d92['options'][_0xe379('0x1a')]||null:null,'limit':_0x150d92[_0xe379('0x17')]?_0x150d92[_0xe379('0x17')][_0xe379('0x1b')]||null:null,'include':_0x150d92[_0xe379('0x17')]?_0x150d92[_0xe379('0x17')]['include']?_[_0xe379('0x1c')](_0x150d92[_0xe379('0x17')][_0xe379('0x1d')],function(_0x48b543){return{'model':db[_0x48b543[_0xe379('0x1e')]],'as':_0x48b543['as'],'attributes':_0x48b543[_0xe379('0x1a')],'include':_0x48b543['include']?_[_0xe379('0x1c')](_0x48b543[_0xe379('0x1d')],function(_0x4da256){return{'model':db[_0x4da256['model']],'as':_0x4da256['as'],'attributes':_0x4da256[_0xe379('0x1a')],'include':_0x4da256[_0xe379('0x1d')]?_[_0xe379('0x1c')](_0x4da256['include'],function(_0x17ba51){return{'model':db[_0x17ba51[_0xe379('0x1e')]],'as':_0x17ba51['as'],'attributes':_0x17ba51[_0xe379('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe379('0xb')](function(_0x4ac753){logger[_0xe379('0xc')](_0xe379('0x1f'),_0x150d92);logger[_0xe379('0xf')]('GetServicenowAccount',_0x150d92,JSON[_0xe379('0x11')](_0x4ac753));_0xe4f3d1(_0x4ac753);})[_0xe379('0x20')](function(_0x5d9ca1){logger[_0xe379('0x12')]('GetServicenowAccount',_0x5d9ca1[_0xe379('0x14')],_0x150d92);_0x373f03(_0x1d63ea['error'](0x1f4,_0x5d9ca1[_0xe379('0x14')]));});});};exports[_0xe379('0x21')]=function(_0x3ca387){var _0x12bd00=this;return new Promise(function(_0x18a25e,_0x14d36b){return db[_0xe379('0x22')]['find']({'raw':_0x3ca387[_0xe379('0x17')]?_0x3ca387[_0xe379('0x17')][_0xe379('0x18')]===undefined?!![]:![]:!![],'where':_0x3ca387['options']?_0x3ca387[_0xe379('0x17')]['where']||null:null,'attributes':_0x3ca387['options']?_0x3ca387[_0xe379('0x17')][_0xe379('0x1a')]||null:null,'include':_0x3ca387[_0xe379('0x17')]?_0x3ca387[_0xe379('0x17')]['include']?_[_0xe379('0x1c')](_0x3ca387[_0xe379('0x17')]['include'],function(_0x361a49){return{'model':db[_0x361a49[_0xe379('0x1e')]],'as':_0x361a49['as'],'attributes':_0x361a49[_0xe379('0x1a')],'include':_0x361a49[_0xe379('0x1d')]?_['map'](_0x361a49[_0xe379('0x1d')],function(_0x5936ec){return{'model':db[_0x5936ec[_0xe379('0x1e')]],'as':_0x5936ec['as'],'attributes':_0x5936ec[_0xe379('0x1a')],'include':_0x5936ec[_0xe379('0x1d')]?_[_0xe379('0x1c')](_0x5936ec[_0xe379('0x1d')],function(_0x54aa53){return{'model':db[_0x54aa53[_0xe379('0x1e')]],'as':_0x54aa53['as'],'attributes':_0x54aa53['attributes']};}):[]};}):[]};}):[]:[]})[_0xe379('0xb')](function(_0x199e28){logger[_0xe379('0xc')]('ShowServicenowAccount',_0x3ca387);logger[_0xe379('0xf')](_0xe379('0x21'),_0x3ca387,JSON[_0xe379('0x11')](_0x199e28));_0x18a25e(_0x199e28);})[_0xe379('0x20')](function(_0x5d93b9){logger[_0xe379('0x12')]('ShowServicenowAccount',_0x5d93b9[_0xe379('0x14')],_0x3ca387);_0x14d36b(_0x12bd00[_0xe379('0x12')](0x1f4,_0x5d93b9[_0xe379('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index f56f064..d16aa2d 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 _0x2ab6=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','show','isAuthenticated','getFields','/:id/subjects','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x76b439,_0xd6b4e2){var _0xe273e3=function(_0x36bd8f){while(--_0x36bd8f){_0x76b439['push'](_0x76b439['shift']());}};_0xe273e3(++_0xd6b4e2);}(_0x2ab6,0x1ca));var _0x62ab=function(_0x28bcff,_0x1baea6){_0x28bcff=_0x28bcff-0x0;var _0x37e212=_0x2ab6[_0x28bcff];return _0x37e212;};'use strict';var multer=require(_0x62ab('0x0'));var util=require(_0x62ab('0x1'));var path=require(_0x62ab('0x2'));var timeout=require(_0x62ab('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x62ab('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x62ab('0x5'));var config=require(_0x62ab('0x6'));var controller=require(_0x62ab('0x7'));router[_0x62ab('0x8')]('/',auth['isAuthenticated'](),controller[_0x62ab('0x9')]);router[_0x62ab('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x62ab('0xa')]);router[_0x62ab('0x8')]('/:id/fields',auth[_0x62ab('0xb')](),controller[_0x62ab('0xc')]);router[_0x62ab('0x8')](_0x62ab('0xd'),auth[_0x62ab('0xb')](),controller['getSubjects']);router[_0x62ab('0x8')]('/:id/descriptions',auth[_0x62ab('0xb')](),controller[_0x62ab('0xe')]);router[_0x62ab('0xf')]('/',auth[_0x62ab('0xb')](),controller[_0x62ab('0x10')]);router[_0x62ab('0x11')](_0x62ab('0x12'),auth[_0x62ab('0xb')](),controller[_0x62ab('0x13')]);router['delete'](_0x62ab('0x12'),auth[_0x62ab('0xb')](),controller[_0x62ab('0x14')]);module[_0x62ab('0x15')]=router; \ No newline at end of file +var _0x75d5=['/:id','destroy','util','express','Router','../../components/auth/service','get','isAuthenticated','show','getFields','/:id/descriptions','getDescriptions','post','create'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x75d5,0xaa));var _0x575d=function(_0x2da071,_0x4a09d7){_0x2da071=_0x2da071-0x0;var _0x106846=_0x75d5[_0x2da071];return _0x106846;};'use strict';var multer=require('multer');var util=require(_0x575d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x575d('0x1'));var router=express[_0x575d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x575d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x575d('0x4')]('/',auth[_0x575d('0x5')](),controller['index']);router[_0x575d('0x4')]('/:id',auth[_0x575d('0x5')](),controller[_0x575d('0x6')]);router[_0x575d('0x4')]('/:id/fields',auth[_0x575d('0x5')](),controller[_0x575d('0x7')]);router[_0x575d('0x4')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x575d('0x4')](_0x575d('0x8'),auth[_0x575d('0x5')](),controller[_0x575d('0x9')]);router[_0x575d('0xa')]('/',auth[_0x575d('0x5')](),controller[_0x575d('0xb')]);router['put'](_0x575d('0xc'),auth[_0x575d('0x5')](),controller['update']);router['delete'](_0x575d('0xc'),auth[_0x575d('0x5')](),controller[_0x575d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 14c0e5b..04b3bf8 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 _0x6082=['exports','STRING','sequelize'];(function(_0x15471a,_0x5490f7){var _0x422fc5=function(_0x463500){while(--_0x463500){_0x15471a['push'](_0x15471a['shift']());}};_0x422fc5(++_0x5490f7);}(_0x6082,0x176));var _0x2608=function(_0x15ca0c,_0x24516e){_0x15ca0c=_0x15ca0c-0x0;var _0x7ec8af=_0x6082[_0x15ca0c];return _0x7ec8af;};'use strict';var Sequelize=require(_0x2608('0x0'));module[_0x2608('0x1')]={'name':{'type':Sequelize[_0x2608('0x2')]},'description':{'type':Sequelize[_0x2608('0x2')]}}; \ No newline at end of file +var _0x42e6=['STRING','exports'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x42e6,0x91));var _0x642e=function(_0x3f1557,_0x53e3f6){_0x3f1557=_0x3f1557-0x0;var _0x545a93=_0x42e6[_0x3f1557];return _0x545a93;};'use strict';var Sequelize=require('sequelize');module[_0x642e('0x0')]={'name':{'type':Sequelize[_0x642e('0x1')]},'description':{'type':Sequelize[_0x642e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 2d80694..858a21a 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 _0xae2d=['moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','end','json','offset','undefined','limit','count','status','set','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','filters','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','intersection','catch','create','body','find','destroy','getFields','findOne','ServicenowField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4d0b28,_0x41f716){var _0x2b401a=function(_0x3e0424){while(--_0x3e0424){_0x4d0b28['push'](_0x4d0b28['shift']());}};_0x2b401a(++_0x41f716);}(_0xae2d,0x1db));var _0xdae2=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xae2d[_0x50a004];return _0x5e9992;};'use strict';var emlformat=require(_0xdae2('0x0'));var rimraf=require(_0xdae2('0x1'));var zipdir=require(_0xdae2('0x2'));var jsonpatch=require(_0xdae2('0x3'));var rp=require(_0xdae2('0x4'));var moment=require(_0xdae2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdae2('0x6'));var path=require(_0xdae2('0x7'));var sox=require(_0xdae2('0x8'));var csv=require('to-csv');var ejs=require(_0xdae2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdae2('0xa'));var squel=require(_0xdae2('0xb'));var crypto=require(_0xdae2('0xc'));var jsforce=require(_0xdae2('0xd'));var deskjs=require(_0xdae2('0xe'));var toCsv=require(_0xdae2('0xf'));var querystring=require(_0xdae2('0x10'));var Papa=require('papaparse');var Redis=require(_0xdae2('0x11'));var authService=require(_0xdae2('0x12'));var qs=require(_0xdae2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdae2('0x14'))('api');var utils=require(_0xdae2('0x15'));var config=require(_0xdae2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fc840,_0x5b3246){_0x5b3246=_0x5b3246||0xcc;return function(_0x3d3382){if(_0x3d3382){return _0x3fc840['sendStatus'](_0x5b3246);}return _0x3fc840['status'](_0x5b3246)[_0xdae2('0x17')]();};}function respondWithResult(_0x24986f,_0xdc1803){_0xdc1803=_0xdc1803||0xc8;return function(_0x5ba366){if(_0x5ba366){return _0x24986f['status'](_0xdc1803)[_0xdae2('0x18')](_0x5ba366);}};}function respondWithFilteredResult(_0xc66545,_0xfa483e){return function(_0x3e6f9e){if(_0x3e6f9e){var _0x7f37f0=typeof _0xfa483e[_0xdae2('0x19')]===_0xdae2('0x1a')&&typeof _0xfa483e[_0xdae2('0x1b')]===_0xdae2('0x1a');var _0x12e620=_0x3e6f9e['count'];var _0x4abd74=_0x7f37f0?0x0:_0xfa483e[_0xdae2('0x19')];var _0x2e9efc=_0x7f37f0?_0x3e6f9e[_0xdae2('0x1c')]:_0xfa483e[_0xdae2('0x19')]+_0xfa483e[_0xdae2('0x1b')];var _0x5126a7;if(_0x2e9efc>=_0x12e620){_0x2e9efc=_0x12e620;_0x5126a7=0xc8;}else{_0x5126a7=0xce;}_0xc66545[_0xdae2('0x1d')](_0x5126a7);return _0xc66545[_0xdae2('0x1e')]('Content-Range',_0x4abd74+'-'+_0x2e9efc+'/'+_0x12e620)[_0xdae2('0x18')](_0x3e6f9e);}return null;};}function patchUpdates(_0xc04e8a){return function(_0x38c86b){try{jsonpatch['apply'](_0x38c86b,_0xc04e8a,!![]);}catch(_0x5ae76c){return BPromise[_0xdae2('0x1f')](_0x5ae76c);}return _0x38c86b[_0xdae2('0x20')]();};}function saveUpdates(_0x6739c2,_0xb89305){return function(_0x2cd749){if(_0x2cd749){return _0x2cd749[_0xdae2('0x21')](_0x6739c2)[_0xdae2('0x22')](function(_0x61ab9b){return _0x61ab9b;});}return null;};}function removeEntity(_0x2e0081,_0x5b04ab){return function(_0x13dc6a){if(_0x13dc6a){return _0x13dc6a['destroy']()[_0xdae2('0x22')](function(){_0x2e0081[_0xdae2('0x1d')](0xcc)[_0xdae2('0x17')]();});}};}function handleEntityNotFound(_0x529776,_0x4d458f){return function(_0x4d6051){if(!_0x4d6051){_0x529776[_0xdae2('0x23')](0x194);}return _0x4d6051;};}function handleError(_0x470852,_0x383b06){_0x383b06=_0x383b06||0x1f4;return function(_0x86f36e){logger[_0xdae2('0x24')](_0x86f36e[_0xdae2('0x25')]);if(_0x86f36e[_0xdae2('0x26')]){delete _0x86f36e[_0xdae2('0x26')];}_0x470852[_0xdae2('0x1d')](_0x383b06)[_0xdae2('0x27')](_0x86f36e);};}exports[_0xdae2('0x28')]=function(_0x1d6cff,_0x3e6957){var _0x1bd8c1={},_0x265dde={},_0xe930a2={'count':0x0,'rows':[]};var _0x550685=_[_0xdae2('0x29')](db[_0xdae2('0x2a')][_0xdae2('0x2b')],function(_0x1ac613){return{'name':_0x1ac613[_0xdae2('0x2c')],'type':_0x1ac613[_0xdae2('0x2d')][_0xdae2('0x2e')]};});_0x265dde['model']=_[_0xdae2('0x29')](_0x550685,_0xdae2('0x26'));_0x265dde[_0xdae2('0x2f')]=_['keys'](_0x1d6cff[_0xdae2('0x2f')]);_0x265dde[_0xdae2('0x30')]=_['intersection'](_0x265dde['model'],_0x265dde[_0xdae2('0x2f')]);_0x1bd8c1[_0xdae2('0x31')]=_['intersection'](_0x265dde[_0xdae2('0x32')],qs[_0xdae2('0x33')](_0x1d6cff[_0xdae2('0x2f')][_0xdae2('0x33')]));_0x1bd8c1['attributes']=_0x1bd8c1[_0xdae2('0x31')][_0xdae2('0x34')]?_0x1bd8c1[_0xdae2('0x31')]:_0x265dde['model'];if(!_0x1d6cff['query'][_0xdae2('0x35')]('nolimit')){_0x1bd8c1[_0xdae2('0x1b')]=qs[_0xdae2('0x1b')](_0x1d6cff[_0xdae2('0x2f')][_0xdae2('0x1b')]);_0x1bd8c1[_0xdae2('0x19')]=qs[_0xdae2('0x19')](_0x1d6cff['query'][_0xdae2('0x19')]);}_0x1bd8c1['order']=qs[_0xdae2('0x36')](_0x1d6cff[_0xdae2('0x2f')][_0xdae2('0x36')]);_0x1bd8c1[_0xdae2('0x37')]=qs[_0xdae2('0x30')](_[_0xdae2('0x38')](_0x1d6cff[_0xdae2('0x2f')],_0x265dde['filters']),_0x550685);if(_0x1d6cff['query'][_0xdae2('0x39')]){_0x1bd8c1[_0xdae2('0x37')]=_[_0xdae2('0x3a')](_0x1bd8c1[_0xdae2('0x37')],{'$or':_[_0xdae2('0x29')](_0x550685,function(_0x196071){if(_0x196071[_0xdae2('0x2d')]!==_0xdae2('0x3b')){var _0x3aefd4={};_0x3aefd4[_0x196071['name']]={'$like':'%'+_0x1d6cff[_0xdae2('0x2f')]['filter']+'%'};return _0x3aefd4;}})});}_0x1bd8c1=_[_0xdae2('0x3a')]({},_0x1bd8c1,_0x1d6cff[_0xdae2('0x3c')]);var _0x43643b={'where':_0x1bd8c1[_0xdae2('0x37')]};return db['ServicenowConfiguration']['count'](_0x43643b)['then'](function(_0x5ea90b){_0xe930a2[_0xdae2('0x1c')]=_0x5ea90b;if(_0x1d6cff[_0xdae2('0x2f')][_0xdae2('0x3d')]){_0x1bd8c1[_0xdae2('0x3e')]=[{'all':!![]}];}return db[_0xdae2('0x2a')][_0xdae2('0x3f')](_0x1bd8c1);})[_0xdae2('0x22')](function(_0x2aca68){_0xe930a2['rows']=_0x2aca68;return _0xe930a2;})[_0xdae2('0x22')](respondWithFilteredResult(_0x3e6957,_0x1bd8c1))['catch'](handleError(_0x3e6957,null));};exports[_0xdae2('0x40')]=function(_0x4eb343,_0x417103){var _0x1965e1={'raw':![],'where':{'id':_0x4eb343[_0xdae2('0x41')]['id']}},_0x114884={};_0x114884['model']=_[_0xdae2('0x42')](db[_0xdae2('0x2a')][_0xdae2('0x2b')]);_0x114884[_0xdae2('0x2f')]=_[_0xdae2('0x42')](_0x4eb343[_0xdae2('0x2f')]);_0x114884[_0xdae2('0x30')]=_[_0xdae2('0x43')](_0x114884[_0xdae2('0x32')],_0x114884[_0xdae2('0x2f')]);_0x1965e1[_0xdae2('0x31')]=_[_0xdae2('0x43')](_0x114884['model'],qs['fields'](_0x4eb343[_0xdae2('0x2f')][_0xdae2('0x33')]));_0x1965e1['attributes']=_0x1965e1['attributes'][_0xdae2('0x34')]?_0x1965e1[_0xdae2('0x31')]:_0x114884['model'];if(_0x4eb343[_0xdae2('0x2f')][_0xdae2('0x3d')]){_0x1965e1['include']=[{'all':!![]}];}_0x1965e1=_[_0xdae2('0x3a')]({},_0x1965e1,_0x4eb343[_0xdae2('0x3c')]);return db[_0xdae2('0x2a')]['find'](_0x1965e1)[_0xdae2('0x22')](handleEntityNotFound(_0x417103,null))['then'](respondWithResult(_0x417103,null))[_0xdae2('0x44')](handleError(_0x417103,null));};exports[_0xdae2('0x45')]=function(_0x473e04,_0x17b82c){return db[_0xdae2('0x2a')]['create'](_0x473e04[_0xdae2('0x46')],{})[_0xdae2('0x22')](respondWithResult(_0x17b82c,0xc9))[_0xdae2('0x44')](handleError(_0x17b82c,null));};exports['update']=function(_0x3c0bd8,_0x4c7632){if(_0x3c0bd8[_0xdae2('0x46')]['id']){delete _0x3c0bd8[_0xdae2('0x46')]['id'];}return db['ServicenowConfiguration'][_0xdae2('0x47')]({'where':{'id':_0x3c0bd8[_0xdae2('0x41')]['id']}})[_0xdae2('0x22')](handleEntityNotFound(_0x4c7632,null))[_0xdae2('0x22')](saveUpdates(_0x3c0bd8[_0xdae2('0x46')],null))[_0xdae2('0x22')](respondWithResult(_0x4c7632,null))[_0xdae2('0x44')](handleError(_0x4c7632,null));};exports[_0xdae2('0x48')]=function(_0x4b8df0,_0x1084a9){return db[_0xdae2('0x2a')][_0xdae2('0x47')]({'where':{'id':_0x4b8df0['params']['id']}})['then'](handleEntityNotFound(_0x1084a9,null))[_0xdae2('0x22')](removeEntity(_0x1084a9,null))[_0xdae2('0x44')](handleError(_0x1084a9,null));};exports[_0xdae2('0x49')]=function(_0x1a7182,_0x4eea8a,_0xed0826){var _0x351eee={};var _0xf90947={};var _0x2bbf17;var _0x4bd191;return db[_0xdae2('0x2a')][_0xdae2('0x4a')]({'where':{'id':_0x1a7182['params']['id']}})['then'](handleEntityNotFound(_0x4eea8a,null))[_0xdae2('0x22')](function(_0x5ef8fa){if(_0x5ef8fa){_0x2bbf17=_0x5ef8fa;_0xf90947['model']=_[_0xdae2('0x42')](db[_0xdae2('0x4b')][_0xdae2('0x2b')]);_0xf90947['query']=_[_0xdae2('0x42')](_0x1a7182[_0xdae2('0x2f')]);_0xf90947[_0xdae2('0x30')]=_['intersection'](_0xf90947[_0xdae2('0x32')],_0xf90947[_0xdae2('0x2f')]);_0x351eee[_0xdae2('0x31')]=_[_0xdae2('0x43')](_0xf90947[_0xdae2('0x32')],qs[_0xdae2('0x33')](_0x1a7182[_0xdae2('0x2f')]['fields']));_0x351eee[_0xdae2('0x31')]=_0x351eee[_0xdae2('0x31')][_0xdae2('0x34')]?_0x351eee[_0xdae2('0x31')]:_0xf90947[_0xdae2('0x32')];_0x351eee[_0xdae2('0x4c')]=qs['sort'](_0x1a7182['query']['sort']);_0x351eee['where']=qs[_0xdae2('0x30')](_[_0xdae2('0x38')](_0x1a7182[_0xdae2('0x2f')],_0xf90947[_0xdae2('0x30')]));if(_0x1a7182['query'][_0xdae2('0x39')]){_0x351eee['where']=_[_0xdae2('0x3a')](_0x351eee['where'],{'$or':_[_0xdae2('0x29')](_0x351eee[_0xdae2('0x31')],function(_0x53cf6c){var _0x1fc2f4={};_0x1fc2f4[_0x53cf6c]={'$like':'%'+_0x1a7182[_0xdae2('0x2f')][_0xdae2('0x39')]+'%'};return _0x1fc2f4;})});}_0x351eee=_[_0xdae2('0x3a')]({},_0x351eee,_0x1a7182['options']);return _0x2bbf17[_0xdae2('0x49')](_0x351eee);}})[_0xdae2('0x22')](function(_0x550c99){if(_0x550c99){_0x4bd191=_0x550c99[_0xdae2('0x34')];if(!_0x1a7182[_0xdae2('0x2f')][_0xdae2('0x35')](_0xdae2('0x4d'))){_0x351eee[_0xdae2('0x1b')]=qs[_0xdae2('0x1b')](_0x1a7182['query'][_0xdae2('0x1b')]);_0x351eee['offset']=qs[_0xdae2('0x19')](_0x1a7182[_0xdae2('0x2f')][_0xdae2('0x19')]);}return _0x2bbf17[_0xdae2('0x49')](_0x351eee);}})[_0xdae2('0x22')](function(_0x221a4b){if(_0x221a4b){return _0x221a4b?{'count':_0x4bd191,'rows':_0x221a4b}:null;}})[_0xdae2('0x22')](respondWithResult(_0x4eea8a,null))[_0xdae2('0x44')](handleError(_0x4eea8a,null));};exports[_0xdae2('0x4e')]=function(_0x54934f,_0x5bdb03,_0x2c6c34){var _0x30159a={};var _0x50a141={};var _0x11e7b0;var _0x369ac7;return db[_0xdae2('0x2a')][_0xdae2('0x4a')]({'where':{'id':_0x54934f[_0xdae2('0x41')]['id']}})[_0xdae2('0x22')](handleEntityNotFound(_0x5bdb03,null))['then'](function(_0x137320){if(_0x137320){_0x11e7b0=_0x137320;_0x50a141['model']=_['keys'](db[_0xdae2('0x4b')][_0xdae2('0x2b')]);_0x50a141['query']=_[_0xdae2('0x42')](_0x54934f['query']);_0x50a141['filters']=_[_0xdae2('0x43')](_0x50a141['model'],_0x50a141['query']);_0x30159a[_0xdae2('0x31')]=_[_0xdae2('0x43')](_0x50a141[_0xdae2('0x32')],qs[_0xdae2('0x33')](_0x54934f[_0xdae2('0x2f')][_0xdae2('0x33')]));_0x30159a[_0xdae2('0x31')]=_0x30159a['attributes'][_0xdae2('0x34')]?_0x30159a[_0xdae2('0x31')]:_0x50a141[_0xdae2('0x32')];_0x30159a[_0xdae2('0x4c')]=qs[_0xdae2('0x36')](_0x54934f[_0xdae2('0x2f')][_0xdae2('0x36')]);_0x30159a[_0xdae2('0x37')]=qs['filters'](_[_0xdae2('0x38')](_0x54934f[_0xdae2('0x2f')],_0x50a141[_0xdae2('0x30')]));if(_0x54934f[_0xdae2('0x2f')]['filter']){_0x30159a[_0xdae2('0x37')]=_[_0xdae2('0x3a')](_0x30159a[_0xdae2('0x37')],{'$or':_['map'](_0x30159a[_0xdae2('0x31')],function(_0x277516){var _0x36754b={};_0x36754b[_0x277516]={'$like':'%'+_0x54934f['query'][_0xdae2('0x39')]+'%'};return _0x36754b;})});}_0x30159a=_[_0xdae2('0x3a')]({},_0x30159a,_0x54934f['options']);return _0x11e7b0['getSubjects'](_0x30159a);}})['then'](function(_0x1a818c){if(_0x1a818c){_0x369ac7=_0x1a818c[_0xdae2('0x34')];if(!_0x54934f[_0xdae2('0x2f')][_0xdae2('0x35')](_0xdae2('0x4d'))){_0x30159a[_0xdae2('0x1b')]=qs[_0xdae2('0x1b')](_0x54934f[_0xdae2('0x2f')]['limit']);_0x30159a[_0xdae2('0x19')]=qs['offset'](_0x54934f[_0xdae2('0x2f')][_0xdae2('0x19')]);}return _0x11e7b0[_0xdae2('0x4e')](_0x30159a);}})[_0xdae2('0x22')](function(_0x5aaf1f){if(_0x5aaf1f){return _0x5aaf1f?{'count':_0x369ac7,'rows':_0x5aaf1f}:null;}})[_0xdae2('0x22')](respondWithResult(_0x5bdb03,null))[_0xdae2('0x44')](handleError(_0x5bdb03,null));};exports[_0xdae2('0x4f')]=function(_0x166014,_0x179156,_0x6777b7){var _0x9c42cd={};var _0x286bb8={};var _0x54d87b;var _0x3f547e;return db[_0xdae2('0x2a')][_0xdae2('0x4a')]({'where':{'id':_0x166014[_0xdae2('0x41')]['id']}})[_0xdae2('0x22')](handleEntityNotFound(_0x179156,null))[_0xdae2('0x22')](function(_0xcab0a4){if(_0xcab0a4){_0x54d87b=_0xcab0a4;_0x286bb8[_0xdae2('0x32')]=_['keys'](db[_0xdae2('0x4b')][_0xdae2('0x2b')]);_0x286bb8['query']=_[_0xdae2('0x42')](_0x166014[_0xdae2('0x2f')]);_0x286bb8[_0xdae2('0x30')]=_['intersection'](_0x286bb8[_0xdae2('0x32')],_0x286bb8['query']);_0x9c42cd[_0xdae2('0x31')]=_[_0xdae2('0x43')](_0x286bb8[_0xdae2('0x32')],qs['fields'](_0x166014[_0xdae2('0x2f')]['fields']));_0x9c42cd[_0xdae2('0x31')]=_0x9c42cd[_0xdae2('0x31')][_0xdae2('0x34')]?_0x9c42cd[_0xdae2('0x31')]:_0x286bb8['model'];_0x9c42cd[_0xdae2('0x4c')]=qs['sort'](_0x166014[_0xdae2('0x2f')][_0xdae2('0x36')]);_0x9c42cd[_0xdae2('0x37')]=qs[_0xdae2('0x30')](_[_0xdae2('0x38')](_0x166014[_0xdae2('0x2f')],_0x286bb8[_0xdae2('0x30')]));if(_0x166014[_0xdae2('0x2f')][_0xdae2('0x39')]){_0x9c42cd[_0xdae2('0x37')]=_[_0xdae2('0x3a')](_0x9c42cd[_0xdae2('0x37')],{'$or':_[_0xdae2('0x29')](_0x9c42cd[_0xdae2('0x31')],function(_0x42a676){var _0x5e8f7a={};_0x5e8f7a[_0x42a676]={'$like':'%'+_0x166014[_0xdae2('0x2f')][_0xdae2('0x39')]+'%'};return _0x5e8f7a;})});}_0x9c42cd=_[_0xdae2('0x3a')]({},_0x9c42cd,_0x166014['options']);return _0x54d87b[_0xdae2('0x4f')](_0x9c42cd);}})[_0xdae2('0x22')](function(_0x402ef5){if(_0x402ef5){_0x3f547e=_0x402ef5['length'];if(!_0x166014['query'][_0xdae2('0x35')](_0xdae2('0x4d'))){_0x9c42cd[_0xdae2('0x1b')]=qs[_0xdae2('0x1b')](_0x166014[_0xdae2('0x2f')][_0xdae2('0x1b')]);_0x9c42cd['offset']=qs[_0xdae2('0x19')](_0x166014[_0xdae2('0x2f')][_0xdae2('0x19')]);}return _0x54d87b[_0xdae2('0x4f')](_0x9c42cd);}})[_0xdae2('0x22')](function(_0x189ede){if(_0x189ede){return _0x189ede?{'count':_0x3f547e,'rows':_0x189ede}:null;}})[_0xdae2('0x22')](respondWithResult(_0x179156,null))[_0xdae2('0x44')](handleError(_0x179156,null));}; \ No newline at end of file +var _0xe320=['ServicenowField','rawAttributes','pick','nolimit','getSubjects','getDescriptions','eml-format','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/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ServicenowConfiguration','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','body','find','params','getFields','findOne'];(function(_0x592f09,_0x42248a){var _0x3eb7ef=function(_0x46230f){while(--_0x46230f){_0x592f09['push'](_0x592f09['shift']());}};_0x3eb7ef(++_0x42248a);}(_0xe320,0x1f2));var _0x0e32=function(_0x1c4cf4,_0x5dd363){_0x1c4cf4=_0x1c4cf4-0x0;var _0x13a8e9=_0xe320[_0x1c4cf4];return _0x13a8e9;};'use strict';var emlformat=require(_0x0e32('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e32('0x1'));var rp=require(_0x0e32('0x2'));var moment=require(_0x0e32('0x3'));var BPromise=require(_0x0e32('0x4'));var Mustache=require(_0x0e32('0x5'));var util=require(_0x0e32('0x6'));var path=require(_0x0e32('0x7'));var sox=require('sox');var csv=require(_0x0e32('0x8'));var ejs=require(_0x0e32('0x9'));var fs=require('fs');var fs_extra=require(_0x0e32('0xa'));var _=require(_0x0e32('0xb'));var squel=require(_0x0e32('0xc'));var crypto=require(_0x0e32('0xd'));var jsforce=require(_0x0e32('0xe'));var deskjs=require(_0x0e32('0xf'));var toCsv=require(_0x0e32('0x8'));var querystring=require(_0x0e32('0x10'));var Papa=require(_0x0e32('0x11'));var Redis=require(_0x0e32('0x12'));var authService=require(_0x0e32('0x13'));var qs=require(_0x0e32('0x14'));var as=require(_0x0e32('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e32('0x16'))(_0x0e32('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0e32('0x18'))['db'];function respondWithStatusCode(_0x3b8484,_0x2f5d91){_0x2f5d91=_0x2f5d91||0xcc;return function(_0x2c7403){if(_0x2c7403){return _0x3b8484[_0x0e32('0x19')](_0x2f5d91);}return _0x3b8484['status'](_0x2f5d91)[_0x0e32('0x1a')]();};}function respondWithResult(_0x18fb56,_0x2598f4){_0x2598f4=_0x2598f4||0xc8;return function(_0x442165){if(_0x442165){return _0x18fb56[_0x0e32('0x1b')](_0x2598f4)[_0x0e32('0x1c')](_0x442165);}};}function respondWithFilteredResult(_0x3d752e,_0x461164){return function(_0x523d0c){if(_0x523d0c){var _0x511419=typeof _0x461164[_0x0e32('0x1d')]===_0x0e32('0x1e')&&typeof _0x461164['limit']==='undefined';var _0x518ffe=_0x523d0c[_0x0e32('0x1f')];var _0x1a59a5=_0x511419?0x0:_0x461164['offset'];var _0x544b4=_0x511419?_0x523d0c[_0x0e32('0x1f')]:_0x461164[_0x0e32('0x1d')]+_0x461164[_0x0e32('0x20')];var _0x4bf0e9;if(_0x544b4>=_0x518ffe){_0x544b4=_0x518ffe;_0x4bf0e9=0xc8;}else{_0x4bf0e9=0xce;}_0x3d752e[_0x0e32('0x1b')](_0x4bf0e9);return _0x3d752e[_0x0e32('0x21')](_0x0e32('0x22'),_0x1a59a5+'-'+_0x544b4+'/'+_0x518ffe)['json'](_0x523d0c);}return null;};}function patchUpdates(_0x2975b1){return function(_0x27273a){try{jsonpatch[_0x0e32('0x23')](_0x27273a,_0x2975b1,!![]);}catch(_0x2f1b9b){return BPromise[_0x0e32('0x24')](_0x2f1b9b);}return _0x27273a[_0x0e32('0x25')]();};}function saveUpdates(_0x429122,_0x188b84){return function(_0x1f14f2){if(_0x1f14f2){return _0x1f14f2[_0x0e32('0x26')](_0x429122)[_0x0e32('0x27')](function(_0x80f88e){return _0x80f88e;});}return null;};}function removeEntity(_0x2f60eb,_0x3d245c){return function(_0x5b7d6b){if(_0x5b7d6b){return _0x5b7d6b[_0x0e32('0x28')]()[_0x0e32('0x27')](function(){_0x2f60eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x395acc,_0xcb2eb3){return function(_0x259890){if(!_0x259890){_0x395acc[_0x0e32('0x19')](0x194);}return _0x259890;};}function handleError(_0x784f52,_0x4ca773){_0x4ca773=_0x4ca773||0x1f4;return function(_0x456e40){logger[_0x0e32('0x29')](_0x456e40[_0x0e32('0x2a')]);if(_0x456e40[_0x0e32('0x2b')]){delete _0x456e40[_0x0e32('0x2b')];}_0x784f52['status'](_0x4ca773)[_0x0e32('0x2c')](_0x456e40);};}exports['index']=function(_0x2b614a,_0x5ec083){var _0x3070f2={},_0x2f562f={},_0x271991={'count':0x0,'rows':[]};var _0x52b3ea=_[_0x0e32('0x2d')](db[_0x0e32('0x2e')]['rawAttributes'],function(_0x3f8e43){return{'name':_0x3f8e43[_0x0e32('0x2f')],'type':_0x3f8e43[_0x0e32('0x30')][_0x0e32('0x31')]};});_0x2f562f['model']=_[_0x0e32('0x2d')](_0x52b3ea,_0x0e32('0x2b'));_0x2f562f[_0x0e32('0x32')]=_[_0x0e32('0x33')](_0x2b614a[_0x0e32('0x32')]);_0x2f562f['filters']=_[_0x0e32('0x34')](_0x2f562f['model'],_0x2f562f['query']);_0x3070f2[_0x0e32('0x35')]=_[_0x0e32('0x34')](_0x2f562f[_0x0e32('0x36')],qs['fields'](_0x2b614a['query'][_0x0e32('0x37')]));_0x3070f2[_0x0e32('0x35')]=_0x3070f2[_0x0e32('0x35')]['length']?_0x3070f2[_0x0e32('0x35')]:_0x2f562f[_0x0e32('0x36')];if(!_0x2b614a[_0x0e32('0x32')][_0x0e32('0x38')]('nolimit')){_0x3070f2[_0x0e32('0x20')]=qs[_0x0e32('0x20')](_0x2b614a[_0x0e32('0x32')][_0x0e32('0x20')]);_0x3070f2['offset']=qs[_0x0e32('0x1d')](_0x2b614a[_0x0e32('0x32')][_0x0e32('0x1d')]);}_0x3070f2[_0x0e32('0x39')]=qs[_0x0e32('0x3a')](_0x2b614a[_0x0e32('0x32')]['sort']);_0x3070f2[_0x0e32('0x3b')]=qs[_0x0e32('0x3c')](_['pick'](_0x2b614a[_0x0e32('0x32')],_0x2f562f[_0x0e32('0x3c')]),_0x52b3ea);if(_0x2b614a['query'][_0x0e32('0x3d')]){_0x3070f2['where']=_[_0x0e32('0x3e')](_0x3070f2[_0x0e32('0x3b')],{'$or':_[_0x0e32('0x2d')](_0x52b3ea,function(_0x182d42){if(_0x182d42['type']!==_0x0e32('0x3f')){var _0x5b1bd8={};_0x5b1bd8[_0x182d42[_0x0e32('0x2b')]]={'$like':'%'+_0x2b614a[_0x0e32('0x32')]['filter']+'%'};return _0x5b1bd8;}})});}_0x3070f2=_[_0x0e32('0x3e')]({},_0x3070f2,_0x2b614a[_0x0e32('0x40')]);var _0x52f1de={'where':_0x3070f2[_0x0e32('0x3b')]};return db[_0x0e32('0x2e')][_0x0e32('0x1f')](_0x52f1de)[_0x0e32('0x27')](function(_0x1c97f2){_0x271991[_0x0e32('0x1f')]=_0x1c97f2;if(_0x2b614a[_0x0e32('0x32')][_0x0e32('0x41')]){_0x3070f2[_0x0e32('0x42')]=[{'all':!![]}];}return db[_0x0e32('0x2e')][_0x0e32('0x43')](_0x3070f2);})[_0x0e32('0x27')](function(_0x1954ab){_0x271991['rows']=_0x1954ab;return _0x271991;})[_0x0e32('0x27')](respondWithFilteredResult(_0x5ec083,_0x3070f2))[_0x0e32('0x44')](handleError(_0x5ec083,null));};exports[_0x0e32('0x45')]=function(_0x3ed48e,_0x42ff5c){var _0x499f51={'raw':![],'where':{'id':_0x3ed48e['params']['id']}},_0x559200={};_0x559200[_0x0e32('0x36')]=_[_0x0e32('0x33')](db[_0x0e32('0x2e')]['rawAttributes']);_0x559200[_0x0e32('0x32')]=_[_0x0e32('0x33')](_0x3ed48e[_0x0e32('0x32')]);_0x559200[_0x0e32('0x3c')]=_['intersection'](_0x559200[_0x0e32('0x36')],_0x559200['query']);_0x499f51['attributes']=_['intersection'](_0x559200[_0x0e32('0x36')],qs[_0x0e32('0x37')](_0x3ed48e[_0x0e32('0x32')]['fields']));_0x499f51[_0x0e32('0x35')]=_0x499f51[_0x0e32('0x35')][_0x0e32('0x46')]?_0x499f51[_0x0e32('0x35')]:_0x559200['model'];if(_0x3ed48e['query'][_0x0e32('0x41')]){_0x499f51['include']=[{'all':!![]}];}_0x499f51=_[_0x0e32('0x3e')]({},_0x499f51,_0x3ed48e[_0x0e32('0x40')]);return db[_0x0e32('0x2e')]['find'](_0x499f51)[_0x0e32('0x27')](handleEntityNotFound(_0x42ff5c,null))[_0x0e32('0x27')](respondWithResult(_0x42ff5c,null))[_0x0e32('0x44')](handleError(_0x42ff5c,null));};exports['create']=function(_0x34e649,_0x322966){return db[_0x0e32('0x2e')]['create'](_0x34e649[_0x0e32('0x47')],{})[_0x0e32('0x27')](respondWithResult(_0x322966,0xc9))[_0x0e32('0x44')](handleError(_0x322966,null));};exports[_0x0e32('0x26')]=function(_0x3d287b,_0x4b4a00){if(_0x3d287b[_0x0e32('0x47')]['id']){delete _0x3d287b[_0x0e32('0x47')]['id'];}return db[_0x0e32('0x2e')][_0x0e32('0x48')]({'where':{'id':_0x3d287b[_0x0e32('0x49')]['id']}})[_0x0e32('0x27')](handleEntityNotFound(_0x4b4a00,null))[_0x0e32('0x27')](saveUpdates(_0x3d287b[_0x0e32('0x47')],null))[_0x0e32('0x27')](respondWithResult(_0x4b4a00,null))[_0x0e32('0x44')](handleError(_0x4b4a00,null));};exports['destroy']=function(_0x3f890b,_0x547b13){return db[_0x0e32('0x2e')][_0x0e32('0x48')]({'where':{'id':_0x3f890b[_0x0e32('0x49')]['id']}})['then'](handleEntityNotFound(_0x547b13,null))[_0x0e32('0x27')](removeEntity(_0x547b13,null))[_0x0e32('0x44')](handleError(_0x547b13,null));};exports[_0x0e32('0x4a')]=function(_0x44b4f5,_0x36e83f,_0xe5736){var _0x1ae31d={};var _0x4a5c66={};var _0x1141fc;var _0x31376f;return db[_0x0e32('0x2e')][_0x0e32('0x4b')]({'where':{'id':_0x44b4f5['params']['id']}})[_0x0e32('0x27')](handleEntityNotFound(_0x36e83f,null))[_0x0e32('0x27')](function(_0x191f0f){if(_0x191f0f){_0x1141fc=_0x191f0f;_0x4a5c66[_0x0e32('0x36')]=_['keys'](db[_0x0e32('0x4c')][_0x0e32('0x4d')]);_0x4a5c66[_0x0e32('0x32')]=_[_0x0e32('0x33')](_0x44b4f5[_0x0e32('0x32')]);_0x4a5c66[_0x0e32('0x3c')]=_[_0x0e32('0x34')](_0x4a5c66[_0x0e32('0x36')],_0x4a5c66[_0x0e32('0x32')]);_0x1ae31d[_0x0e32('0x35')]=_['intersection'](_0x4a5c66[_0x0e32('0x36')],qs[_0x0e32('0x37')](_0x44b4f5[_0x0e32('0x32')][_0x0e32('0x37')]));_0x1ae31d[_0x0e32('0x35')]=_0x1ae31d[_0x0e32('0x35')]['length']?_0x1ae31d[_0x0e32('0x35')]:_0x4a5c66['model'];_0x1ae31d['order']=qs[_0x0e32('0x3a')](_0x44b4f5[_0x0e32('0x32')]['sort']);_0x1ae31d[_0x0e32('0x3b')]=qs[_0x0e32('0x3c')](_[_0x0e32('0x4e')](_0x44b4f5[_0x0e32('0x32')],_0x4a5c66['filters']));if(_0x44b4f5[_0x0e32('0x32')][_0x0e32('0x3d')]){_0x1ae31d[_0x0e32('0x3b')]=_['merge'](_0x1ae31d[_0x0e32('0x3b')],{'$or':_[_0x0e32('0x2d')](_0x1ae31d[_0x0e32('0x35')],function(_0x24f336){var _0x28db02={};_0x28db02[_0x24f336]={'$like':'%'+_0x44b4f5['query'][_0x0e32('0x3d')]+'%'};return _0x28db02;})});}_0x1ae31d=_[_0x0e32('0x3e')]({},_0x1ae31d,_0x44b4f5[_0x0e32('0x40')]);return _0x1141fc[_0x0e32('0x4a')](_0x1ae31d);}})[_0x0e32('0x27')](function(_0x4f8ff3){if(_0x4f8ff3){_0x31376f=_0x4f8ff3[_0x0e32('0x46')];if(!_0x44b4f5[_0x0e32('0x32')][_0x0e32('0x38')]('nolimit')){_0x1ae31d['limit']=qs[_0x0e32('0x20')](_0x44b4f5['query']['limit']);_0x1ae31d['offset']=qs[_0x0e32('0x1d')](_0x44b4f5['query'][_0x0e32('0x1d')]);}return _0x1141fc[_0x0e32('0x4a')](_0x1ae31d);}})['then'](function(_0x3a7f95){if(_0x3a7f95){return _0x3a7f95?{'count':_0x31376f,'rows':_0x3a7f95}:null;}})[_0x0e32('0x27')](respondWithResult(_0x36e83f,null))[_0x0e32('0x44')](handleError(_0x36e83f,null));};exports['getSubjects']=function(_0x583239,_0x416003,_0x35ad1c){var _0x15ad42={};var _0x512464={};var _0x47b697;var _0x268614;return db[_0x0e32('0x2e')]['findOne']({'where':{'id':_0x583239[_0x0e32('0x49')]['id']}})[_0x0e32('0x27')](handleEntityNotFound(_0x416003,null))[_0x0e32('0x27')](function(_0x45587c){if(_0x45587c){_0x47b697=_0x45587c;_0x512464[_0x0e32('0x36')]=_[_0x0e32('0x33')](db['ServicenowField']['rawAttributes']);_0x512464[_0x0e32('0x32')]=_[_0x0e32('0x33')](_0x583239[_0x0e32('0x32')]);_0x512464[_0x0e32('0x3c')]=_[_0x0e32('0x34')](_0x512464[_0x0e32('0x36')],_0x512464['query']);_0x15ad42[_0x0e32('0x35')]=_[_0x0e32('0x34')](_0x512464['model'],qs[_0x0e32('0x37')](_0x583239['query'][_0x0e32('0x37')]));_0x15ad42[_0x0e32('0x35')]=_0x15ad42['attributes'][_0x0e32('0x46')]?_0x15ad42[_0x0e32('0x35')]:_0x512464['model'];_0x15ad42[_0x0e32('0x39')]=qs['sort'](_0x583239['query']['sort']);_0x15ad42[_0x0e32('0x3b')]=qs[_0x0e32('0x3c')](_[_0x0e32('0x4e')](_0x583239[_0x0e32('0x32')],_0x512464['filters']));if(_0x583239['query'][_0x0e32('0x3d')]){_0x15ad42['where']=_['merge'](_0x15ad42[_0x0e32('0x3b')],{'$or':_[_0x0e32('0x2d')](_0x15ad42['attributes'],function(_0xea0f2c){var _0x49e82c={};_0x49e82c[_0xea0f2c]={'$like':'%'+_0x583239[_0x0e32('0x32')][_0x0e32('0x3d')]+'%'};return _0x49e82c;})});}_0x15ad42=_['merge']({},_0x15ad42,_0x583239[_0x0e32('0x40')]);return _0x47b697['getSubjects'](_0x15ad42);}})[_0x0e32('0x27')](function(_0x34051f){if(_0x34051f){_0x268614=_0x34051f['length'];if(!_0x583239[_0x0e32('0x32')][_0x0e32('0x38')](_0x0e32('0x4f'))){_0x15ad42['limit']=qs[_0x0e32('0x20')](_0x583239[_0x0e32('0x32')][_0x0e32('0x20')]);_0x15ad42['offset']=qs['offset'](_0x583239[_0x0e32('0x32')][_0x0e32('0x1d')]);}return _0x47b697[_0x0e32('0x50')](_0x15ad42);}})[_0x0e32('0x27')](function(_0x4e4d3a){if(_0x4e4d3a){return _0x4e4d3a?{'count':_0x268614,'rows':_0x4e4d3a}:null;}})[_0x0e32('0x27')](respondWithResult(_0x416003,null))[_0x0e32('0x44')](handleError(_0x416003,null));};exports[_0x0e32('0x51')]=function(_0x2f7e04,_0x139c35,_0x7943d1){var _0x74917d={};var _0x2f145d={};var _0x490b95;var _0x1d2c9a;return db['ServicenowConfiguration'][_0x0e32('0x4b')]({'where':{'id':_0x2f7e04['params']['id']}})['then'](handleEntityNotFound(_0x139c35,null))[_0x0e32('0x27')](function(_0x2afa65){if(_0x2afa65){_0x490b95=_0x2afa65;_0x2f145d[_0x0e32('0x36')]=_[_0x0e32('0x33')](db[_0x0e32('0x4c')][_0x0e32('0x4d')]);_0x2f145d[_0x0e32('0x32')]=_['keys'](_0x2f7e04[_0x0e32('0x32')]);_0x2f145d[_0x0e32('0x3c')]=_['intersection'](_0x2f145d[_0x0e32('0x36')],_0x2f145d['query']);_0x74917d[_0x0e32('0x35')]=_[_0x0e32('0x34')](_0x2f145d[_0x0e32('0x36')],qs[_0x0e32('0x37')](_0x2f7e04[_0x0e32('0x32')][_0x0e32('0x37')]));_0x74917d['attributes']=_0x74917d[_0x0e32('0x35')][_0x0e32('0x46')]?_0x74917d[_0x0e32('0x35')]:_0x2f145d[_0x0e32('0x36')];_0x74917d[_0x0e32('0x39')]=qs[_0x0e32('0x3a')](_0x2f7e04[_0x0e32('0x32')][_0x0e32('0x3a')]);_0x74917d[_0x0e32('0x3b')]=qs[_0x0e32('0x3c')](_[_0x0e32('0x4e')](_0x2f7e04[_0x0e32('0x32')],_0x2f145d[_0x0e32('0x3c')]));if(_0x2f7e04['query'][_0x0e32('0x3d')]){_0x74917d['where']=_['merge'](_0x74917d[_0x0e32('0x3b')],{'$or':_[_0x0e32('0x2d')](_0x74917d[_0x0e32('0x35')],function(_0x7e291a){var _0x374c39={};_0x374c39[_0x7e291a]={'$like':'%'+_0x2f7e04[_0x0e32('0x32')][_0x0e32('0x3d')]+'%'};return _0x374c39;})});}_0x74917d=_[_0x0e32('0x3e')]({},_0x74917d,_0x2f7e04[_0x0e32('0x40')]);return _0x490b95['getDescriptions'](_0x74917d);}})[_0x0e32('0x27')](function(_0x343fb3){if(_0x343fb3){_0x1d2c9a=_0x343fb3[_0x0e32('0x46')];if(!_0x2f7e04[_0x0e32('0x32')]['hasOwnProperty'](_0x0e32('0x4f'))){_0x74917d['limit']=qs['limit'](_0x2f7e04[_0x0e32('0x32')]['limit']);_0x74917d[_0x0e32('0x1d')]=qs[_0x0e32('0x1d')](_0x2f7e04[_0x0e32('0x32')][_0x0e32('0x1d')]);}return _0x490b95['getDescriptions'](_0x74917d);}})[_0x0e32('0x27')](function(_0x57acb4){if(_0x57acb4){return _0x57acb4?{'count':_0x1d2c9a,'rows':_0x57acb4}:null;}})[_0x0e32('0x27')](respondWithResult(_0x139c35,null))[_0x0e32('0x44')](handleError(_0x139c35,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0308a11..e6c14b6 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 _0xbecf=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x47e56d,_0x52d3bf){var _0x1e22e5=function(_0x1b6057){while(--_0x1b6057){_0x47e56d['push'](_0x47e56d['shift']());}};_0x1e22e5(++_0x52d3bf);}(_0xbecf,0x15c));var _0xfbec=function(_0xdb5be4,_0x2a2df8){_0xdb5be4=_0xdb5be4-0x0;var _0x194cec=_0xbecf[_0xdb5be4];return _0x194cec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfbec('0x0'))(_0xfbec('0x1'));var moment=require(_0xfbec('0x2'));var BPromise=require(_0xfbec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbec('0x4'));var rimraf=require(_0xfbec('0x5'));var config=require(_0xfbec('0x6'));var attributes=require(_0xfbec('0x7'));module[_0xfbec('0x8')]=function(_0x5bd6f1,_0x297f85){return _0x5bd6f1[_0xfbec('0x9')](_0xfbec('0xa'),attributes,{'tableName':_0xfbec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf894=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xf894,0xfd));var _0x4f89=function(_0x2d9a5b,_0x7f31bf){_0x2d9a5b=_0x2d9a5b-0x0;var _0x1adb74=_0xf894[_0x2d9a5b];return _0x1adb74;};'use strict';var _=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var logger=require(_0x4f89('0x2'))(_0x4f89('0x3'));var moment=require(_0x4f89('0x4'));var BPromise=require(_0x4f89('0x5'));var rp=require(_0x4f89('0x6'));var fs=require('fs');var path=require(_0x4f89('0x7'));var rimraf=require(_0x4f89('0x8'));var config=require(_0x4f89('0x9'));var attributes=require(_0x4f89('0xa'));module[_0x4f89('0xb')]=function(_0x8837a0,_0x343593){return _0x8837a0[_0x4f89('0xc')](_0x4f89('0xd'),attributes,{'tableName':_0x4f89('0xe'),'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 d550568..0737abd 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 _0x8c5a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util'];(function(_0x5c7668,_0x3dc6e1){var _0x33ae77=function(_0x6cccfc){while(--_0x6cccfc){_0x5c7668['push'](_0x5c7668['shift']());}};_0x33ae77(++_0x3dc6e1);}(_0x8c5a,0x1b6));var _0xa8c5=function(_0xef57e2,_0x4f9cf3){_0xef57e2=_0xef57e2-0x0;var _0x4352d1=_0x8c5a[_0xef57e2];return _0x4352d1;};'use strict';var _=require(_0xa8c5('0x0'));var util=require(_0xa8c5('0x1'));var moment=require(_0xa8c5('0x2'));var BPromise=require(_0xa8c5('0x3'));var rs=require(_0xa8c5('0x4'));var fs=require('fs');var Redis=require(_0xa8c5('0x5'));var db=require(_0xa8c5('0x6'))['db'];var utils=require(_0xa8c5('0x7'));var logger=require('../../config/logger')(_0xa8c5('0x8'));var config=require(_0xa8c5('0x9'));var jayson=require(_0xa8c5('0xa'));var client=jayson[_0xa8c5('0xb')][_0xa8c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52840e,_0x4adddb,_0x369858){return new BPromise(function(_0x15531e,_0x9ab944){return client['request'](_0x52840e,_0x369858)[_0xa8c5('0xd')](function(_0x14014e){logger['info'](_0xa8c5('0xe'),_0x4adddb,_0xa8c5('0xf'));logger['debug'](_0xa8c5('0x10'),_0x4adddb,_0xa8c5('0xf'),JSON[_0xa8c5('0x11')](_0x14014e));if(_0x14014e[_0xa8c5('0x12')]){if(_0x14014e[_0xa8c5('0x12')]['code']===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4adddb,_0x14014e[_0xa8c5('0x12')][_0xa8c5('0x13')]);return _0x9ab944(_0x14014e[_0xa8c5('0x12')][_0xa8c5('0x13')]);}logger[_0xa8c5('0x12')](_0xa8c5('0xe'),_0x4adddb,_0x14014e[_0xa8c5('0x12')][_0xa8c5('0x13')]);return _0x15531e(_0x14014e['error'][_0xa8c5('0x13')]);}else{logger[_0xa8c5('0x14')](_0xa8c5('0xe'),_0x4adddb,_0xa8c5('0xf'));_0x15531e(_0x14014e[_0xa8c5('0x15')][_0xa8c5('0x13')]);}})['catch'](function(_0xafd0a){logger[_0xa8c5('0x12')](_0xa8c5('0xe'),_0x4adddb,_0xafd0a);_0x9ab944(_0xafd0a);});});} \ No newline at end of file +var _0xd9f2=['then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x504c5d,_0x27a75a){var _0x4d1821=function(_0x558ffe){while(--_0x558ffe){_0x504c5d['push'](_0x504c5d['shift']());}};_0x4d1821(++_0x27a75a);}(_0xd9f2,0x1cd));var _0x2d9f=function(_0x5a7b8a,_0x16beb4){_0x5a7b8a=_0x5a7b8a-0x0;var _0x46ffab=_0xd9f2[_0x5a7b8a];return _0x46ffab;};'use strict';var _=require(_0x2d9f('0x0'));var util=require(_0x2d9f('0x1'));var moment=require(_0x2d9f('0x2'));var BPromise=require(_0x2d9f('0x3'));var rs=require(_0x2d9f('0x4'));var fs=require('fs');var Redis=require(_0x2d9f('0x5'));var db=require(_0x2d9f('0x6'))['db'];var utils=require(_0x2d9f('0x7'));var logger=require(_0x2d9f('0x8'))('rpc');var config=require(_0x2d9f('0x9'));var jayson=require(_0x2d9f('0xa'));var client=jayson[_0x2d9f('0xb')][_0x2d9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x435b94,_0x4fcdd1,_0x171002){return new BPromise(function(_0x233637,_0x20e4da){return client[_0x2d9f('0xd')](_0x435b94,_0x171002)[_0x2d9f('0xe')](function(_0x4596cb){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x4fcdd1,_0x2d9f('0xf'));logger[_0x2d9f('0x10')](_0x2d9f('0x11'),_0x4fcdd1,'request\x20sent',JSON[_0x2d9f('0x12')](_0x4596cb));if(_0x4596cb[_0x2d9f('0x13')]){if(_0x4596cb[_0x2d9f('0x13')][_0x2d9f('0x14')]===0x1f4){logger[_0x2d9f('0x13')](_0x2d9f('0x15'),_0x4fcdd1,_0x4596cb[_0x2d9f('0x13')][_0x2d9f('0x16')]);return _0x20e4da(_0x4596cb['error']['message']);}logger[_0x2d9f('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4fcdd1,_0x4596cb[_0x2d9f('0x13')]['message']);return _0x233637(_0x4596cb['error'][_0x2d9f('0x16')]);}else{logger[_0x2d9f('0x17')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4fcdd1,'request\x20sent');_0x233637(_0x4596cb[_0x2d9f('0x18')]['message']);}})['catch'](function(_0x5c884f){logger[_0x2d9f('0x13')](_0x2d9f('0x15'),_0x4fcdd1,_0x5c884f);_0x20e4da(_0x5c884f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 07904e8..edbff81 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 _0xca4b=['multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x8f141,_0x5b7cbf){var _0x498d0d=function(_0x52551a){while(--_0x52551a){_0x8f141['push'](_0x8f141['shift']());}};_0x498d0d(++_0x5b7cbf);}(_0xca4b,0x1cc));var _0xbca4=function(_0x3d7eee,_0x4acd5f){_0x3d7eee=_0x3d7eee-0x0;var _0x4f37f7=_0xca4b[_0x3d7eee];return _0x4f37f7;};'use strict';var multer=require(_0xbca4('0x0'));var util=require(_0xbca4('0x1'));var path=require('path');var timeout=require(_0xbca4('0x2'));var express=require('express');var router=express[_0xbca4('0x3')]();var fs_extra=require(_0xbca4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbca4('0x5'));var config=require(_0xbca4('0x6'));var controller=require(_0xbca4('0x7'));router[_0xbca4('0x8')]('/',auth[_0xbca4('0x9')](),controller[_0xbca4('0xa')]);router[_0xbca4('0x8')](_0xbca4('0xb'),auth['isAuthenticated'](),controller[_0xbca4('0xc')]);router[_0xbca4('0xd')]('/',auth[_0xbca4('0x9')](),controller[_0xbca4('0xe')]);router[_0xbca4('0xf')](_0xbca4('0xb'),auth['isAuthenticated'](),controller[_0xbca4('0x10')]);router[_0xbca4('0x11')]('/:id',auth[_0xbca4('0x9')](),controller[_0xbca4('0x12')]);module[_0xbca4('0x13')]=router; \ No newline at end of file +var _0x057a=['get','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x057a,0x14b));var _0xa057=function(_0x4e8f12,_0x36ef25){_0x4e8f12=_0x4e8f12-0x0;var _0x1bf373=_0x057a[_0x4e8f12];return _0x1bf373;};'use strict';var multer=require(_0xa057('0x0'));var util=require(_0xa057('0x1'));var path=require(_0xa057('0x2'));var timeout=require(_0xa057('0x3'));var express=require(_0xa057('0x4'));var router=express['Router']();var fs_extra=require(_0xa057('0x5'));var auth=require(_0xa057('0x6'));var interaction=require(_0xa057('0x7'));var config=require(_0xa057('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xa057('0x9')](),controller[_0xa057('0xa')]);router[_0xa057('0xb')](_0xa057('0xc'),auth[_0xa057('0x9')](),controller['show']);router[_0xa057('0xd')]('/',auth[_0xa057('0x9')](),controller[_0xa057('0xe')]);router[_0xa057('0xf')]('/:id',auth[_0xa057('0x9')](),controller[_0xa057('0x10')]);router[_0xa057('0x11')](_0xa057('0xc'),auth[_0xa057('0x9')](),controller['destroy']);module[_0xa057('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 420a2f6..49a5f70 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 _0x2bfd=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bfd,0x124));var _0xd2bf=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x2bfd[_0x507c81];return _0x368a25;};'use strict';var Sequelize=require(_0xd2bf('0x0'));module[_0xd2bf('0x1')]={'type':{'type':Sequelize[_0xd2bf('0x2')](_0xd2bf('0x3'),_0xd2bf('0x4'),'customVariable',_0xd2bf('0x5'),_0xd2bf('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd2bf('0x2')]('string',_0xd2bf('0x4'),_0xd2bf('0x7'))},'keyContent':{'type':Sequelize[_0xd2bf('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd2bf('0x8')]},'customField':{'type':Sequelize[_0xd2bf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd2bf('0x8')]}}; \ No newline at end of file +var _0x93e0=['sequelize','exports','string','customVariable','STRING','ENUM'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x93e0,0x150));var _0x093e=function(_0x54124f,_0x69fbb9){_0x54124f=_0x54124f-0x0;var _0x583af=_0x93e0[_0x54124f];return _0x583af;};'use strict';var Sequelize=require(_0x093e('0x0'));module[_0x093e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x093e('0x2'),'variable',_0x093e('0x3'),'keyValue','picklist'),'defaultValue':_0x093e('0x2')},'content':{'type':Sequelize[_0x093e('0x4')]},'key':{'type':Sequelize[_0x093e('0x4')]},'keyType':{'type':Sequelize[_0x093e('0x5')](_0x093e('0x2'),'variable',_0x093e('0x3'))},'keyContent':{'type':Sequelize[_0x093e('0x4')]},'idField':{'type':Sequelize[_0x093e('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x093e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index bfb15da..07469a9 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 _0xdcdd=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','findAll','show','params','length','includeAll','find','catch','create','body','rimraf'];(function(_0x3c8c50,_0x221422){var _0x387422=function(_0x4db194){while(--_0x4db194){_0x3c8c50['push'](_0x3c8c50['shift']());}};_0x387422(++_0x221422);}(_0xdcdd,0x127));var _0xddcd=function(_0x4e4fd1,_0x21322d){_0x4e4fd1=_0x4e4fd1-0x0;var _0x3f895d=_0xdcdd[_0x4e4fd1];return _0x3f895d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddcd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddcd('0x1'));var rp=require(_0xddcd('0x2'));var moment=require(_0xddcd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xddcd('0x4'));var util=require(_0xddcd('0x5'));var path=require(_0xddcd('0x6'));var sox=require(_0xddcd('0x7'));var csv=require(_0xddcd('0x8'));var ejs=require(_0xddcd('0x9'));var fs=require('fs');var fs_extra=require(_0xddcd('0xa'));var _=require(_0xddcd('0xb'));var squel=require('squel');var crypto=require(_0xddcd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xddcd('0xd'));var toCsv=require(_0xddcd('0x8'));var querystring=require(_0xddcd('0xe'));var Papa=require(_0xddcd('0xf'));var Redis=require(_0xddcd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xddcd('0x11'));var as=require(_0xddcd('0x12'));var hardwareService=require(_0xddcd('0x13'));var logger=require('../../config/logger')(_0xddcd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xddcd('0x15'));var db=require(_0xddcd('0x16'))['db'];function respondWithStatusCode(_0x156cd3,_0x4f4d3f){_0x4f4d3f=_0x4f4d3f||0xcc;return function(_0x37ffd4){if(_0x37ffd4){return _0x156cd3[_0xddcd('0x17')](_0x4f4d3f);}return _0x156cd3[_0xddcd('0x18')](_0x4f4d3f)['end']();};}function respondWithResult(_0x5646e2,_0x1f4f51){_0x1f4f51=_0x1f4f51||0xc8;return function(_0x2ba90a){if(_0x2ba90a){return _0x5646e2[_0xddcd('0x18')](_0x1f4f51)[_0xddcd('0x19')](_0x2ba90a);}};}function respondWithFilteredResult(_0x4f748b,_0x18ee85){return function(_0x252365){if(_0x252365){var _0x54b72f=typeof _0x18ee85[_0xddcd('0x1a')]===_0xddcd('0x1b')&&typeof _0x18ee85[_0xddcd('0x1c')]===_0xddcd('0x1b');var _0xb4eb4=_0x252365['count'];var _0x1189eb=_0x54b72f?0x0:_0x18ee85[_0xddcd('0x1a')];var _0x76445f=_0x54b72f?_0x252365['count']:_0x18ee85[_0xddcd('0x1a')]+_0x18ee85['limit'];var _0x18c0e0;if(_0x76445f>=_0xb4eb4){_0x76445f=_0xb4eb4;_0x18c0e0=0xc8;}else{_0x18c0e0=0xce;}_0x4f748b[_0xddcd('0x18')](_0x18c0e0);return _0x4f748b[_0xddcd('0x1d')](_0xddcd('0x1e'),_0x1189eb+'-'+_0x76445f+'/'+_0xb4eb4)[_0xddcd('0x19')](_0x252365);}return null;};}function patchUpdates(_0x386a9f){return function(_0x1981e5){try{jsonpatch['apply'](_0x1981e5,_0x386a9f,!![]);}catch(_0x5913bb){return BPromise[_0xddcd('0x1f')](_0x5913bb);}return _0x1981e5[_0xddcd('0x20')]();};}function saveUpdates(_0x50fff7,_0x35e4c3){return function(_0x25f8e4){if(_0x25f8e4){return _0x25f8e4[_0xddcd('0x21')](_0x50fff7)[_0xddcd('0x22')](function(_0x36eeae){return _0x36eeae;});}return null;};}function removeEntity(_0x57c448,_0x383d26){return function(_0x477f99){if(_0x477f99){return _0x477f99[_0xddcd('0x23')]()[_0xddcd('0x22')](function(){_0x57c448[_0xddcd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xda6fdc,_0x157808){return function(_0x14500d){if(!_0x14500d){_0xda6fdc[_0xddcd('0x17')](0x194);}return _0x14500d;};}function handleError(_0x2a0027,_0x113081){_0x113081=_0x113081||0x1f4;return function(_0x27d200){logger[_0xddcd('0x24')](_0x27d200[_0xddcd('0x25')]);if(_0x27d200['name']){delete _0x27d200[_0xddcd('0x26')];}_0x2a0027[_0xddcd('0x18')](_0x113081)[_0xddcd('0x27')](_0x27d200);};}exports[_0xddcd('0x28')]=function(_0x479b98,_0x537f57){var _0x57f27e={},_0x2249cf={},_0xf5e3eb={'count':0x0,'rows':[]};var _0x2dc422=_['map'](db[_0xddcd('0x29')][_0xddcd('0x2a')],function(_0x23bdc2){return{'name':_0x23bdc2[_0xddcd('0x2b')],'type':_0x23bdc2['type'][_0xddcd('0x2c')]};});_0x2249cf[_0xddcd('0x2d')]=_[_0xddcd('0x2e')](_0x2dc422,'name');_0x2249cf[_0xddcd('0x2f')]=_[_0xddcd('0x30')](_0x479b98['query']);_0x2249cf['filters']=_[_0xddcd('0x31')](_0x2249cf[_0xddcd('0x2d')],_0x2249cf[_0xddcd('0x2f')]);_0x57f27e[_0xddcd('0x32')]=_[_0xddcd('0x31')](_0x2249cf[_0xddcd('0x2d')],qs[_0xddcd('0x33')](_0x479b98[_0xddcd('0x2f')]['fields']));_0x57f27e['attributes']=_0x57f27e[_0xddcd('0x32')]['length']?_0x57f27e[_0xddcd('0x32')]:_0x2249cf[_0xddcd('0x2d')];if(!_0x479b98[_0xddcd('0x2f')][_0xddcd('0x34')](_0xddcd('0x35'))){_0x57f27e['limit']=qs[_0xddcd('0x1c')](_0x479b98[_0xddcd('0x2f')][_0xddcd('0x1c')]);_0x57f27e['offset']=qs[_0xddcd('0x1a')](_0x479b98[_0xddcd('0x2f')][_0xddcd('0x1a')]);}_0x57f27e[_0xddcd('0x36')]=qs[_0xddcd('0x37')](_0x479b98['query']['sort']);_0x57f27e[_0xddcd('0x38')]=qs[_0xddcd('0x39')](_[_0xddcd('0x3a')](_0x479b98['query'],_0x2249cf['filters']),_0x2dc422);if(_0x479b98[_0xddcd('0x2f')][_0xddcd('0x3b')]){_0x57f27e[_0xddcd('0x38')]=_[_0xddcd('0x3c')](_0x57f27e[_0xddcd('0x38')],{'$or':_[_0xddcd('0x2e')](_0x2dc422,function(_0x109556){if(_0x109556[_0xddcd('0x3d')]!==_0xddcd('0x3e')){var _0x52acdc={};_0x52acdc[_0x109556[_0xddcd('0x26')]]={'$like':'%'+_0x479b98['query'][_0xddcd('0x3b')]+'%'};return _0x52acdc;}})});}_0x57f27e=_['merge']({},_0x57f27e,_0x479b98[_0xddcd('0x3f')]);var _0x1d5804={'where':_0x57f27e[_0xddcd('0x38')]};return db[_0xddcd('0x29')][_0xddcd('0x40')](_0x1d5804)[_0xddcd('0x22')](function(_0x27642b){_0xf5e3eb['count']=_0x27642b;if(_0x479b98[_0xddcd('0x2f')]['includeAll']){_0x57f27e['include']=[{'all':!![]}];}return db['ServicenowField'][_0xddcd('0x41')](_0x57f27e);})[_0xddcd('0x22')](function(_0x1b6415){_0xf5e3eb['rows']=_0x1b6415;return _0xf5e3eb;})[_0xddcd('0x22')](respondWithFilteredResult(_0x537f57,_0x57f27e))['catch'](handleError(_0x537f57,null));};exports[_0xddcd('0x42')]=function(_0x2bf445,_0x3a3d6c){var _0x50f26f={'raw':!![],'where':{'id':_0x2bf445[_0xddcd('0x43')]['id']}},_0x473f02={};_0x473f02['model']=_[_0xddcd('0x30')](db[_0xddcd('0x29')]['rawAttributes']);_0x473f02['query']=_[_0xddcd('0x30')](_0x2bf445[_0xddcd('0x2f')]);_0x473f02['filters']=_['intersection'](_0x473f02['model'],_0x473f02[_0xddcd('0x2f')]);_0x50f26f[_0xddcd('0x32')]=_[_0xddcd('0x31')](_0x473f02['model'],qs[_0xddcd('0x33')](_0x2bf445[_0xddcd('0x2f')][_0xddcd('0x33')]));_0x50f26f['attributes']=_0x50f26f[_0xddcd('0x32')][_0xddcd('0x44')]?_0x50f26f[_0xddcd('0x32')]:_0x473f02[_0xddcd('0x2d')];if(_0x2bf445[_0xddcd('0x2f')][_0xddcd('0x45')]){_0x50f26f['include']=[{'all':!![]}];}_0x50f26f=_['merge']({},_0x50f26f,_0x2bf445[_0xddcd('0x3f')]);return db[_0xddcd('0x29')][_0xddcd('0x46')](_0x50f26f)[_0xddcd('0x22')](handleEntityNotFound(_0x3a3d6c,null))['then'](respondWithResult(_0x3a3d6c,null))[_0xddcd('0x47')](handleError(_0x3a3d6c,null));};exports[_0xddcd('0x48')]=function(_0x378f54,_0x5baff6){return db[_0xddcd('0x29')][_0xddcd('0x48')](_0x378f54[_0xddcd('0x49')],{})[_0xddcd('0x22')](respondWithResult(_0x5baff6,0xc9))['catch'](handleError(_0x5baff6,null));};exports[_0xddcd('0x21')]=function(_0x3aad7a,_0x576e88){if(_0x3aad7a['body']['id']){delete _0x3aad7a['body']['id'];}return db[_0xddcd('0x29')][_0xddcd('0x46')]({'where':{'id':_0x3aad7a['params']['id']}})[_0xddcd('0x22')](handleEntityNotFound(_0x576e88,null))[_0xddcd('0x22')](saveUpdates(_0x3aad7a[_0xddcd('0x49')],null))[_0xddcd('0x22')](respondWithResult(_0x576e88,null))['catch'](handleError(_0x576e88,null));};exports[_0xddcd('0x23')]=function(_0x13d7f5,_0x195a63){return db['ServicenowField'][_0xddcd('0x46')]({'where':{'id':_0x13d7f5[_0xddcd('0x43')]['id']}})[_0xddcd('0x22')](handleEntityNotFound(_0x195a63,null))['then'](removeEntity(_0x195a63,null))[_0xddcd('0x47')](handleError(_0x195a63,null));}; \ No newline at end of file +var _0xe7d0=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','rawAttributes','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','ServicenowField','findAll','rows','show','find','create','body','catch','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x11b4cd,_0x178af0){var _0x280506=function(_0x182e8d){while(--_0x182e8d){_0x11b4cd['push'](_0x11b4cd['shift']());}};_0x280506(++_0x178af0);}(_0xe7d0,0x173));var _0x0e7d=function(_0x1d959e,_0x308b99){_0x1d959e=_0x1d959e-0x0;var _0x20a55d=_0xe7d0[_0x1d959e];return _0x20a55d;};'use strict';var emlformat=require(_0x0e7d('0x0'));var rimraf=require(_0x0e7d('0x1'));var zipdir=require(_0x0e7d('0x2'));var jsonpatch=require(_0x0e7d('0x3'));var rp=require(_0x0e7d('0x4'));var moment=require(_0x0e7d('0x5'));var BPromise=require(_0x0e7d('0x6'));var Mustache=require(_0x0e7d('0x7'));var util=require(_0x0e7d('0x8'));var path=require('path');var sox=require(_0x0e7d('0x9'));var csv=require(_0x0e7d('0xa'));var ejs=require(_0x0e7d('0xb'));var fs=require('fs');var fs_extra=require(_0x0e7d('0xc'));var _=require(_0x0e7d('0xd'));var squel=require(_0x0e7d('0xe'));var crypto=require(_0x0e7d('0xf'));var jsforce=require(_0x0e7d('0x10'));var deskjs=require(_0x0e7d('0x11'));var toCsv=require(_0x0e7d('0xa'));var querystring=require(_0x0e7d('0x12'));var Papa=require(_0x0e7d('0x13'));var Redis=require('ioredis');var authService=require(_0x0e7d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0e7d('0x15'));var hardwareService=require(_0x0e7d('0x16'));var logger=require(_0x0e7d('0x17'))(_0x0e7d('0x18'));var utils=require(_0x0e7d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0e7d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27fc53,_0x20d418){_0x20d418=_0x20d418||0xcc;return function(_0x23fc93){if(_0x23fc93){return _0x27fc53[_0x0e7d('0x1b')](_0x20d418);}return _0x27fc53[_0x0e7d('0x1c')](_0x20d418)[_0x0e7d('0x1d')]();};}function respondWithResult(_0x395f99,_0x1347fc){_0x1347fc=_0x1347fc||0xc8;return function(_0xb94984){if(_0xb94984){return _0x395f99[_0x0e7d('0x1c')](_0x1347fc)[_0x0e7d('0x1e')](_0xb94984);}};}function respondWithFilteredResult(_0x4614b3,_0x46616c){return function(_0x35d6b3){if(_0x35d6b3){var _0x3868db=typeof _0x46616c[_0x0e7d('0x1f')]===_0x0e7d('0x20')&&typeof _0x46616c[_0x0e7d('0x21')]===_0x0e7d('0x20');var _0xa92670=_0x35d6b3['count'];var _0x521b54=_0x3868db?0x0:_0x46616c['offset'];var _0x5103d9=_0x3868db?_0x35d6b3[_0x0e7d('0x22')]:_0x46616c[_0x0e7d('0x1f')]+_0x46616c[_0x0e7d('0x21')];var _0x26fb1a;if(_0x5103d9>=_0xa92670){_0x5103d9=_0xa92670;_0x26fb1a=0xc8;}else{_0x26fb1a=0xce;}_0x4614b3[_0x0e7d('0x1c')](_0x26fb1a);return _0x4614b3[_0x0e7d('0x23')](_0x0e7d('0x24'),_0x521b54+'-'+_0x5103d9+'/'+_0xa92670)[_0x0e7d('0x1e')](_0x35d6b3);}return null;};}function patchUpdates(_0x3d0f3a){return function(_0x185f83){try{jsonpatch['apply'](_0x185f83,_0x3d0f3a,!![]);}catch(_0x108e19){return BPromise[_0x0e7d('0x25')](_0x108e19);}return _0x185f83[_0x0e7d('0x26')]();};}function saveUpdates(_0x53efc5,_0x691d3e){return function(_0xe4fda1){if(_0xe4fda1){return _0xe4fda1[_0x0e7d('0x27')](_0x53efc5)[_0x0e7d('0x28')](function(_0x306eaa){return _0x306eaa;});}return null;};}function removeEntity(_0x47f59f,_0x5ee884){return function(_0x19f1fb){if(_0x19f1fb){return _0x19f1fb['destroy']()[_0x0e7d('0x28')](function(){_0x47f59f[_0x0e7d('0x1c')](0xcc)[_0x0e7d('0x1d')]();});}};}function handleEntityNotFound(_0x45195e,_0x33556a){return function(_0x1a75b6){if(!_0x1a75b6){_0x45195e[_0x0e7d('0x1b')](0x194);}return _0x1a75b6;};}function handleError(_0x9bdfda,_0x21dd25){_0x21dd25=_0x21dd25||0x1f4;return function(_0x13dad1){logger[_0x0e7d('0x29')](_0x13dad1['stack']);if(_0x13dad1['name']){delete _0x13dad1[_0x0e7d('0x2a')];}_0x9bdfda[_0x0e7d('0x1c')](_0x21dd25)[_0x0e7d('0x2b')](_0x13dad1);};}exports['index']=function(_0xb35b3a,_0xb37468){var _0x254ff6={},_0x2598ac={},_0x378887={'count':0x0,'rows':[]};var _0x605dc9=_['map'](db['ServicenowField'][_0x0e7d('0x2c')],function(_0x9e2b1c){return{'name':_0x9e2b1c['fieldName'],'type':_0x9e2b1c[_0x0e7d('0x2d')]['key']};});_0x2598ac['model']=_[_0x0e7d('0x2e')](_0x605dc9,_0x0e7d('0x2a'));_0x2598ac['query']=_[_0x0e7d('0x2f')](_0xb35b3a[_0x0e7d('0x30')]);_0x2598ac[_0x0e7d('0x31')]=_[_0x0e7d('0x32')](_0x2598ac[_0x0e7d('0x33')],_0x2598ac[_0x0e7d('0x30')]);_0x254ff6[_0x0e7d('0x34')]=_['intersection'](_0x2598ac['model'],qs[_0x0e7d('0x35')](_0xb35b3a[_0x0e7d('0x30')][_0x0e7d('0x35')]));_0x254ff6[_0x0e7d('0x34')]=_0x254ff6[_0x0e7d('0x34')][_0x0e7d('0x36')]?_0x254ff6['attributes']:_0x2598ac[_0x0e7d('0x33')];if(!_0xb35b3a[_0x0e7d('0x30')][_0x0e7d('0x37')](_0x0e7d('0x38'))){_0x254ff6[_0x0e7d('0x21')]=qs[_0x0e7d('0x21')](_0xb35b3a[_0x0e7d('0x30')]['limit']);_0x254ff6[_0x0e7d('0x1f')]=qs[_0x0e7d('0x1f')](_0xb35b3a[_0x0e7d('0x30')][_0x0e7d('0x1f')]);}_0x254ff6[_0x0e7d('0x39')]=qs[_0x0e7d('0x3a')](_0xb35b3a[_0x0e7d('0x30')]['sort']);_0x254ff6[_0x0e7d('0x3b')]=qs[_0x0e7d('0x31')](_[_0x0e7d('0x3c')](_0xb35b3a[_0x0e7d('0x30')],_0x2598ac['filters']),_0x605dc9);if(_0xb35b3a[_0x0e7d('0x30')][_0x0e7d('0x3d')]){_0x254ff6[_0x0e7d('0x3b')]=_[_0x0e7d('0x3e')](_0x254ff6['where'],{'$or':_[_0x0e7d('0x2e')](_0x605dc9,function(_0x4c2123){if(_0x4c2123[_0x0e7d('0x2d')]!=='VIRTUAL'){var _0x316223={};_0x316223[_0x4c2123['name']]={'$like':'%'+_0xb35b3a['query'][_0x0e7d('0x3d')]+'%'};return _0x316223;}})});}_0x254ff6=_[_0x0e7d('0x3e')]({},_0x254ff6,_0xb35b3a[_0x0e7d('0x3f')]);var _0x34ac97={'where':_0x254ff6[_0x0e7d('0x3b')]};return db['ServicenowField'][_0x0e7d('0x22')](_0x34ac97)[_0x0e7d('0x28')](function(_0x4c473a){_0x378887[_0x0e7d('0x22')]=_0x4c473a;if(_0xb35b3a[_0x0e7d('0x30')][_0x0e7d('0x40')]){_0x254ff6[_0x0e7d('0x41')]=[{'all':!![]}];}return db[_0x0e7d('0x42')][_0x0e7d('0x43')](_0x254ff6);})[_0x0e7d('0x28')](function(_0x4b21ba){_0x378887[_0x0e7d('0x44')]=_0x4b21ba;return _0x378887;})[_0x0e7d('0x28')](respondWithFilteredResult(_0xb37468,_0x254ff6))['catch'](handleError(_0xb37468,null));};exports[_0x0e7d('0x45')]=function(_0x233bf4,_0x3ddb77){var _0x404ff1={'raw':!![],'where':{'id':_0x233bf4['params']['id']}},_0x581d4f={};_0x581d4f[_0x0e7d('0x33')]=_[_0x0e7d('0x2f')](db['ServicenowField'][_0x0e7d('0x2c')]);_0x581d4f['query']=_[_0x0e7d('0x2f')](_0x233bf4[_0x0e7d('0x30')]);_0x581d4f['filters']=_[_0x0e7d('0x32')](_0x581d4f[_0x0e7d('0x33')],_0x581d4f['query']);_0x404ff1[_0x0e7d('0x34')]=_[_0x0e7d('0x32')](_0x581d4f[_0x0e7d('0x33')],qs[_0x0e7d('0x35')](_0x233bf4[_0x0e7d('0x30')]['fields']));_0x404ff1[_0x0e7d('0x34')]=_0x404ff1[_0x0e7d('0x34')][_0x0e7d('0x36')]?_0x404ff1[_0x0e7d('0x34')]:_0x581d4f[_0x0e7d('0x33')];if(_0x233bf4[_0x0e7d('0x30')][_0x0e7d('0x40')]){_0x404ff1[_0x0e7d('0x41')]=[{'all':!![]}];}_0x404ff1=_[_0x0e7d('0x3e')]({},_0x404ff1,_0x233bf4['options']);return db[_0x0e7d('0x42')][_0x0e7d('0x46')](_0x404ff1)[_0x0e7d('0x28')](handleEntityNotFound(_0x3ddb77,null))[_0x0e7d('0x28')](respondWithResult(_0x3ddb77,null))['catch'](handleError(_0x3ddb77,null));};exports[_0x0e7d('0x47')]=function(_0xff8e0e,_0x2de7fc){return db[_0x0e7d('0x42')][_0x0e7d('0x47')](_0xff8e0e[_0x0e7d('0x48')],{})[_0x0e7d('0x28')](respondWithResult(_0x2de7fc,0xc9))['catch'](handleError(_0x2de7fc,null));};exports[_0x0e7d('0x27')]=function(_0x43244b,_0x3521ed){if(_0x43244b[_0x0e7d('0x48')]['id']){delete _0x43244b[_0x0e7d('0x48')]['id'];}return db[_0x0e7d('0x42')][_0x0e7d('0x46')]({'where':{'id':_0x43244b['params']['id']}})[_0x0e7d('0x28')](handleEntityNotFound(_0x3521ed,null))[_0x0e7d('0x28')](saveUpdates(_0x43244b['body'],null))['then'](respondWithResult(_0x3521ed,null))[_0x0e7d('0x49')](handleError(_0x3521ed,null));};exports[_0x0e7d('0x4a')]=function(_0x185a37,_0x17f032){return db[_0x0e7d('0x42')][_0x0e7d('0x46')]({'where':{'id':_0x185a37[_0x0e7d('0x4b')]['id']}})[_0x0e7d('0x28')](handleEntityNotFound(_0x17f032,null))['then'](removeEntity(_0x17f032,null))[_0x0e7d('0x49')](handleError(_0x17f032,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 1d97386..648e933 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 _0xf5ad=['int_servicenow_fields','servicenow_unique_index','idField','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ServicenowField'];(function(_0xb9da0a,_0xb4a5e4){var _0x5208fa=function(_0x61d308){while(--_0x61d308){_0xb9da0a['push'](_0xb9da0a['shift']());}};_0x5208fa(++_0xb4a5e4);}(_0xf5ad,0x10d));var _0xdf5a=function(_0x44b402,_0xa02a1b){_0x44b402=_0x44b402-0x0;var _0x4d62fd=_0xf5ad[_0x44b402];return _0x4d62fd;};'use strict';var _=require(_0xdf5a('0x0'));var util=require(_0xdf5a('0x1'));var logger=require('../../config/logger')(_0xdf5a('0x2'));var moment=require(_0xdf5a('0x3'));var BPromise=require(_0xdf5a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf5a('0x5'));var rimraf=require(_0xdf5a('0x6'));var config=require(_0xdf5a('0x7'));var attributes=require('./intServicenowField.attributes');module[_0xdf5a('0x8')]=function(_0x362971,_0x55b4a1){return _0x362971[_0xdf5a('0x9')](_0xdf5a('0xa'),attributes,{'tableName':_0xdf5a('0xb'),'paranoid':![],'indexes':[{'name':_0xdf5a('0xc'),'fields':[_0xdf5a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe19f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','idField','FieldId'];(function(_0x30351b,_0x56d9d6){var _0x4d3192=function(_0x577aee){while(--_0x577aee){_0x30351b['push'](_0x30351b['shift']());}};_0x4d3192(++_0x56d9d6);}(_0xe19f,0x138));var _0xfe19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe19f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xfe19('0x0'));var util=require(_0xfe19('0x1'));var logger=require(_0xfe19('0x2'))(_0xfe19('0x3'));var moment=require('moment');var BPromise=require(_0xfe19('0x4'));var rp=require(_0xfe19('0x5'));var fs=require('fs');var path=require(_0xfe19('0x6'));var rimraf=require(_0xfe19('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe19('0x8'));module['exports']=function(_0x2873cf,_0x1a2709){return _0x2873cf['define'](_0xfe19('0x9'),attributes,{'tableName':_0xfe19('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xfe19('0xb'),_0xfe19('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 d12a7ac..ad3023e 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xac4a,0x13f));var _0xaac4=function(_0x415eed,_0x1232de){_0x415eed=_0x415eed-0x0;var _0x1909dc=_0xac4a[_0x415eed];return _0x1909dc;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b74ac,_0x4abb1f){var _0x308f6c=function(_0x5bb974){while(--_0x5bb974){_0x3b74ac['push'](_0x3b74ac['shift']());}};_0x308f6c(++_0x4abb1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b82da7f..f614fd7 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(_0x1e7e19,_0x43a0f2){var _0x340148=function(_0x388a77){while(--_0x388a77){_0x1e7e19['push'](_0x1e7e19['shift']());}};_0x340148(++_0x43a0f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x3b4d2a,_0x4ed2f8){var _0x21d573=function(_0x400b8d){while(--_0x400b8d){_0x3b4d2a['push'](_0x3b4d2a['shift']());}};_0x21d573(++_0x4ed2f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 84f8276..f9aecb4 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(_0x2b932b,_0x27fa9f){var _0x575583=function(_0x29ed7a){while(--_0x29ed7a){_0x2b932b['push'](_0x2b932b['shift']());}};_0x575583(++_0x27fa9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x13d9d3,_0x46550f){var _0x45b89e=function(_0x40b704){while(--_0x40b704){_0x13d9d3['push'](_0x13d9d3['shift']());}};_0x45b89e(++_0x46550f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 cb090b1..f0447d4 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 _0x139a=['channel','Descriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_id','parent_type','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Calls','values','module_fields','remove','includes','endsWith','test','Wrong\x20credentials','statusCode','send','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','stack','name','index','rawAttributes','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmAccount','include','findAll','rows','catch','params','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0x139a,0xfb));var _0xa139=function(_0x5d3918,_0x583545){_0x5d3918=_0x5d3918-0x0;var _0x37b1de=_0x139a[_0x5d3918];return _0x37b1de;};'use strict';var emlformat=require(_0xa139('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa139('0x1'));var jsonpatch=require(_0xa139('0x2'));var rp=require(_0xa139('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa139('0x4'));var util=require(_0xa139('0x5'));var path=require('path');var sox=require(_0xa139('0x6'));var csv=require(_0xa139('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa139('0x8'));var crypto=require(_0xa139('0x9'));var jsforce=require(_0xa139('0xa'));var deskjs=require(_0xa139('0xb'));var toCsv=require(_0xa139('0x7'));var querystring=require(_0xa139('0xc'));var Papa=require(_0xa139('0xd'));var Redis=require(_0xa139('0xe'));var authService=require(_0xa139('0xf'));var qs=require(_0xa139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa139('0x11'));var utils=require(_0xa139('0x12'));var config=require(_0xa139('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa139('0x14'))['db'];var integrations=require(_0xa139('0x15'));function respondWithStatusCode(_0xa62dff,_0x385f9a){_0x385f9a=_0x385f9a||0xcc;return function(_0x120ff8){if(_0x120ff8){return _0xa62dff[_0xa139('0x16')](_0x385f9a);}return _0xa62dff['status'](_0x385f9a)[_0xa139('0x17')]();};}function respondWithResult(_0xf7336c,_0x5913cd){_0x5913cd=_0x5913cd||0xc8;return function(_0x16e368){if(_0x16e368){return _0xf7336c[_0xa139('0x18')](_0x5913cd)[_0xa139('0x19')](_0x16e368);}};}function respondWithFilteredResult(_0x85ad26,_0x1a0044){return function(_0x16d730){if(_0x16d730){var _0x761aa6=typeof _0x1a0044[_0xa139('0x1a')]===_0xa139('0x1b')&&typeof _0x1a0044[_0xa139('0x1c')]==='undefined';var _0xdb3004=_0x16d730[_0xa139('0x1d')];var _0x5c4a2b=_0x761aa6?0x0:_0x1a0044[_0xa139('0x1a')];var _0x26f595=_0x761aa6?_0x16d730['count']:_0x1a0044['offset']+_0x1a0044[_0xa139('0x1c')];var _0x117006;if(_0x26f595>=_0xdb3004){_0x26f595=_0xdb3004;_0x117006=0xc8;}else{_0x117006=0xce;}_0x85ad26[_0xa139('0x18')](_0x117006);return _0x85ad26['set'](_0xa139('0x1e'),_0x5c4a2b+'-'+_0x26f595+'/'+_0xdb3004)[_0xa139('0x19')](_0x16d730);}return null;};}function patchUpdates(_0x180c79){return function(_0x377503){try{jsonpatch[_0xa139('0x1f')](_0x377503,_0x180c79,!![]);}catch(_0x307c68){return BPromise['reject'](_0x307c68);}return _0x377503[_0xa139('0x20')]();};}function saveUpdates(_0x5dd9e6,_0x40c0dd){return function(_0x16a4da){if(_0x16a4da){return _0x16a4da['update'](_0x5dd9e6)[_0xa139('0x21')](function(_0x29cf6a){return _0x29cf6a;});}return null;};}function removeEntity(_0x1f4d79,_0x334181){return function(_0x412742){if(_0x412742){return _0x412742[_0xa139('0x22')]()[_0xa139('0x21')](function(){_0x1f4d79[_0xa139('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbc9b1,_0x210f9a){return function(_0x513b98){if(!_0x513b98){_0xbc9b1['sendStatus'](0x194);}return _0x513b98;};}function handleError(_0x58acde,_0x5aa5c0){_0x5aa5c0=_0x5aa5c0||0x1f4;return function(_0x21e122){logger['error'](_0x21e122[_0xa139('0x23')]);if(_0x21e122[_0xa139('0x24')]){delete _0x21e122[_0xa139('0x24')];}_0x58acde[_0xa139('0x18')](_0x5aa5c0)['send'](_0x21e122);};}exports[_0xa139('0x25')]=function(_0x265a51,_0x113f1e){var _0x28a43c={},_0x307173={},_0x42a28f={'count':0x0,'rows':[]};var _0x5a119d=_['map'](db['SugarcrmAccount'][_0xa139('0x26')],function(_0x1f6e14){return{'name':_0x1f6e14[_0xa139('0x27')],'type':_0x1f6e14[_0xa139('0x28')]['key']};});_0x307173['model']=_[_0xa139('0x29')](_0x5a119d,_0xa139('0x24'));_0x307173['query']=_[_0xa139('0x2a')](_0x265a51[_0xa139('0x2b')]);_0x307173[_0xa139('0x2c')]=_['intersection'](_0x307173[_0xa139('0x2d')],_0x307173[_0xa139('0x2b')]);_0x28a43c['attributes']=_[_0xa139('0x2e')](_0x307173[_0xa139('0x2d')],qs[_0xa139('0x2f')](_0x265a51[_0xa139('0x2b')][_0xa139('0x2f')]));_0x28a43c['attributes']=_0x28a43c[_0xa139('0x30')][_0xa139('0x31')]?_0x28a43c[_0xa139('0x30')]:_0x307173['model'];if(!_0x265a51[_0xa139('0x2b')][_0xa139('0x32')](_0xa139('0x33'))){_0x28a43c['limit']=qs[_0xa139('0x1c')](_0x265a51[_0xa139('0x2b')]['limit']);_0x28a43c['offset']=qs[_0xa139('0x1a')](_0x265a51[_0xa139('0x2b')][_0xa139('0x1a')]);}_0x28a43c['order']=qs[_0xa139('0x34')](_0x265a51[_0xa139('0x2b')]['sort']);_0x28a43c[_0xa139('0x35')]=qs[_0xa139('0x2c')](_[_0xa139('0x36')](_0x265a51[_0xa139('0x2b')],_0x307173[_0xa139('0x2c')]),_0x5a119d);if(_0x265a51[_0xa139('0x2b')]['filter']){_0x28a43c[_0xa139('0x35')]=_[_0xa139('0x37')](_0x28a43c['where'],{'$or':_[_0xa139('0x29')](_0x5a119d,function(_0x3c4b30){if(_0x3c4b30[_0xa139('0x28')]!==_0xa139('0x38')){var _0x1d8393={};_0x1d8393[_0x3c4b30[_0xa139('0x24')]]={'$like':'%'+_0x265a51[_0xa139('0x2b')][_0xa139('0x39')]+'%'};return _0x1d8393;}})});}_0x28a43c=_[_0xa139('0x37')]({},_0x28a43c,_0x265a51[_0xa139('0x3a')]);var _0x52280b={'where':_0x28a43c[_0xa139('0x35')]};return db[_0xa139('0x3b')]['count'](_0x52280b)[_0xa139('0x21')](function(_0x371c32){_0x42a28f['count']=_0x371c32;if(_0x265a51[_0xa139('0x2b')]['includeAll']){_0x28a43c[_0xa139('0x3c')]=[{'all':!![]}];}return db[_0xa139('0x3b')][_0xa139('0x3d')](_0x28a43c);})[_0xa139('0x21')](function(_0x911df){_0x42a28f[_0xa139('0x3e')]=_0x911df;return _0x42a28f;})[_0xa139('0x21')](respondWithFilteredResult(_0x113f1e,_0x28a43c))[_0xa139('0x3f')](handleError(_0x113f1e,null));};exports['show']=function(_0x2156eb,_0x4d65bd){var _0x23d0b7={'raw':![],'where':{'id':_0x2156eb[_0xa139('0x40')]['id']}},_0xe93e82={};_0xe93e82[_0xa139('0x2d')]=_[_0xa139('0x2a')](db[_0xa139('0x3b')][_0xa139('0x26')]);_0xe93e82[_0xa139('0x2b')]=_[_0xa139('0x2a')](_0x2156eb[_0xa139('0x2b')]);_0xe93e82[_0xa139('0x2c')]=_[_0xa139('0x2e')](_0xe93e82[_0xa139('0x2d')],_0xe93e82[_0xa139('0x2b')]);_0x23d0b7['attributes']=_[_0xa139('0x2e')](_0xe93e82[_0xa139('0x2d')],qs['fields'](_0x2156eb['query']['fields']));_0x23d0b7[_0xa139('0x30')]=_0x23d0b7['attributes']['length']?_0x23d0b7['attributes']:_0xe93e82['model'];if(_0x2156eb[_0xa139('0x2b')][_0xa139('0x41')]){_0x23d0b7[_0xa139('0x3c')]=[{'all':!![]}];}_0x23d0b7=_[_0xa139('0x37')]({},_0x23d0b7,_0x2156eb[_0xa139('0x3a')]);return db['SugarcrmAccount'][_0xa139('0x42')](_0x23d0b7)['then'](handleEntityNotFound(_0x4d65bd,null))[_0xa139('0x21')](respondWithResult(_0x4d65bd,null))['catch'](handleError(_0x4d65bd,null));};exports['create']=function(_0x4ddf08,_0x7cf11a){return db['SugarcrmAccount'][_0xa139('0x43')](_0x4ddf08[_0xa139('0x44')],{})[_0xa139('0x21')](respondWithResult(_0x7cf11a,0xc9))[_0xa139('0x3f')](handleError(_0x7cf11a,null));};exports['update']=function(_0x171d2f,_0x3fe612){if(_0x171d2f[_0xa139('0x44')]['id']){delete _0x171d2f[_0xa139('0x44')]['id'];}return db['SugarcrmAccount'][_0xa139('0x42')]({'where':{'id':_0x171d2f[_0xa139('0x40')]['id']}})[_0xa139('0x21')](handleEntityNotFound(_0x3fe612,null))[_0xa139('0x21')](saveUpdates(_0x171d2f[_0xa139('0x44')],null))[_0xa139('0x21')](respondWithResult(_0x3fe612,null))[_0xa139('0x3f')](handleError(_0x3fe612,null));};exports[_0xa139('0x22')]=function(_0x5a67da,_0x14c7dc){return db[_0xa139('0x3b')]['find']({'where':{'id':_0x5a67da[_0xa139('0x40')]['id']}})['then'](handleEntityNotFound(_0x14c7dc,null))[_0xa139('0x21')](removeEntity(_0x14c7dc,null))[_0xa139('0x3f')](handleError(_0x14c7dc,null));};exports[_0xa139('0x45')]=function(_0x2925c8,_0x17066e,_0x37be33){var _0x1678ec={};var _0x12a334={};var _0x48142f;var _0x4cced8;return db['SugarcrmAccount'][_0xa139('0x46')]({'where':{'id':_0x2925c8[_0xa139('0x40')]['id']}})[_0xa139('0x21')](handleEntityNotFound(_0x17066e,null))['then'](function(_0x17e658){if(_0x17e658){_0x48142f=_0x17e658;_0x12a334[_0xa139('0x2d')]=_[_0xa139('0x2a')](db[_0xa139('0x47')][_0xa139('0x26')]);_0x12a334['query']=_['keys'](_0x2925c8[_0xa139('0x2b')]);_0x12a334[_0xa139('0x2c')]=_[_0xa139('0x2e')](_0x12a334['model'],_0x12a334[_0xa139('0x2b')]);_0x1678ec[_0xa139('0x30')]=_[_0xa139('0x2e')](_0x12a334[_0xa139('0x2d')],qs[_0xa139('0x2f')](_0x2925c8[_0xa139('0x2b')][_0xa139('0x2f')]));_0x1678ec[_0xa139('0x30')]=_0x1678ec[_0xa139('0x30')][_0xa139('0x31')]?_0x1678ec[_0xa139('0x30')]:_0x12a334[_0xa139('0x2d')];_0x1678ec[_0xa139('0x48')]=qs[_0xa139('0x34')](_0x2925c8[_0xa139('0x2b')][_0xa139('0x34')]);_0x1678ec[_0xa139('0x35')]=qs['filters'](_[_0xa139('0x36')](_0x2925c8[_0xa139('0x2b')],_0x12a334['filters']));if(_0x2925c8[_0xa139('0x2b')][_0xa139('0x39')]){_0x1678ec[_0xa139('0x35')]=_[_0xa139('0x37')](_0x1678ec['where'],{'$or':_[_0xa139('0x29')](_0x1678ec[_0xa139('0x30')],function(_0x319e78){var _0x4ffb5d={};_0x4ffb5d[_0x319e78]={'$like':'%'+_0x2925c8[_0xa139('0x2b')][_0xa139('0x39')]+'%'};return _0x4ffb5d;})});}_0x1678ec=_[_0xa139('0x37')]({},_0x1678ec,_0x2925c8['options']);return _0x48142f['getConfigurations'](_0x1678ec);}})[_0xa139('0x21')](function(_0x9280b3){if(_0x9280b3){_0x4cced8=_0x9280b3[_0xa139('0x31')];if(!_0x2925c8[_0xa139('0x2b')][_0xa139('0x32')](_0xa139('0x33'))){_0x1678ec[_0xa139('0x1c')]=qs[_0xa139('0x1c')](_0x2925c8[_0xa139('0x2b')]['limit']);_0x1678ec[_0xa139('0x1a')]=qs['offset'](_0x2925c8[_0xa139('0x2b')]['offset']);}return _0x48142f['getConfigurations'](_0x1678ec);}})[_0xa139('0x21')](function(_0x5dd480){if(_0x5dd480){return _0x5dd480?{'count':_0x4cced8,'rows':_0x5dd480}:null;}})['then'](respondWithResult(_0x17066e,null))[_0xa139('0x3f')](handleError(_0x17066e,null));};exports['addConfiguration']=function(_0x4ef3b9,_0x34365e,_0x40b2ad){if(_0x4ef3b9[_0xa139('0x44')]['id']){delete _0x4ef3b9[_0xa139('0x44')]['id'];}return db[_0xa139('0x3b')][_0xa139('0x46')]({'where':{'id':_0x4ef3b9[_0xa139('0x40')]['id']}})[_0xa139('0x21')](handleEntityNotFound(_0x34365e,null))[_0xa139('0x21')](function(_0x283df8){if(_0x283df8){_0x4ef3b9['body']['AccountId']=_0x283df8['id'];_0x4ef3b9['body']['Subjects']=integrations['getSubjects'](_0x4ef3b9['body'][_0xa139('0x49')],_0x4ef3b9[_0xa139('0x44')][_0xa139('0x28')]);_0x4ef3b9[_0xa139('0x44')][_0xa139('0x4a')]=integrations['getDescriptions'](_0x4ef3b9['body'][_0xa139('0x49')],_0x4ef3b9[_0xa139('0x44')][_0xa139('0x28')]);return db[_0xa139('0x47')][_0xa139('0x43')](_0x4ef3b9[_0xa139('0x44')],{'include':[{'model':db[_0xa139('0x4b')],'as':_0xa139('0x4c')},{'model':db[_0xa139('0x4b')],'as':_0xa139('0x4a')}]});}return null;})[_0xa139('0x21')](respondWithResult(_0x34365e,null))['catch'](handleError(_0x34365e,null));};exports[_0xa139('0x4d')]=function(_0xa867b2,_0x4a8377,_0x4b37f2){var _0x2f2313='';var _0xf069b7=['id','name',_0xa139('0x4e'),_0xa139('0x4f'),'description','date_start',_0xa139('0x50'),_0xa139('0x51'),_0xa139('0x52'),_0xa139('0x53'),'parent_name',_0xa139('0x54')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0xa867b2[_0xa139('0x40')]['id']},'attributes':['id',_0xa139('0x55'),'password',_0xa139('0x56')]})[_0xa139('0x21')](handleEntityNotFound(_0x4a8377,null))[_0xa139('0x21')](function(_0x321c63){if(_0x321c63){_0x2f2313=_0x321c63[_0xa139('0x56')];var _0x164679=_0x2f2313[_0xa139('0x57')](-0x1);if(_0x164679==='/'){_0x2f2313=_0x2f2313[_0xa139('0x58')](0x0,_0x2f2313[_0xa139('0x59')](_0x164679));}return rp({'method':_0xa139('0x5a'),'uri':util[_0xa139('0x5b')]('%s%s',_0x2f2313,_0xa139('0x5c')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xa139('0x5d'),'rest_data':JSON[_0xa139('0x5e')]({'user_auth':{'user_name':_0x321c63[_0xa139('0x55')],'password':_0x321c63[_0xa139('0x5f')],'encryption':_0xa139('0x60')},'application':_0xa139('0x61')})}});}})[_0xa139('0x21')](function(_0x451445){if(_0x451445&&_0x451445['name']!=='Invalid\x20Login'&&_0x451445['name']!=='Password\x20Expired'){return rp({'method':_0xa139('0x5a'),'uri':util[_0xa139('0x5b')]('%s%s',_0x2f2313,_0xa139('0x5c')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xa139('0x5d'),'response_type':'JSON','rest_data':JSON[_0xa139('0x5e')]({'session':_0x451445['id'],'module_name':_0xa139('0x62')})}})[_0xa139('0x21')](function(_0x2f35ff){if(_0x2f35ff){var _0x1e3831=_[_0xa139('0x63')](_0x2f35ff[_0xa139('0x64')]);_[_0xa139('0x65')](_0x1e3831,function(_0x450c4a){return _0xf069b7[_0xa139('0x66')](_0x450c4a[_0xa139('0x24')]);});return{'count':_0x1e3831['length'],'rows':_[_0xa139('0x29')](_0x1e3831,function(_0x15d902){return{'id':_0x15d902[_0xa139('0x24')],'name':_0x15d902['label'],'custom':_[_0xa139('0x67')](_0x15d902['name'],'_c')?!![]:![],'options':_0x15d902[_0xa139('0x3a')]?_[_0xa139('0x29')](_[_0xa139('0x63')](_0x15d902[_0xa139('0x3a')]),function(_0x3b92f2){return{'name':_0x3b92f2['value'],'value':_0x3b92f2[_0xa139('0x24')]};}):[]};})};}})[_0xa139('0x21')](respondWithResult(_0x4a8377,null))[_0xa139('0x3f')](function(_0x17846e){var _0x5e7a6f=_0xa867b2[_0xa139('0x2b')][_0xa139('0x68')]?0x1f4:_0x17846e['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5e7a6f,JSON[_0xa139('0x5e')](_0x17846e));delete _0x17846e[_0xa139('0x24')];if(_0x5e7a6f===0x191){_0x5e7a6f=0x190;}_0x4a8377['status'](_0x5e7a6f)['send'](_0xa867b2[_0xa139('0x2b')][_0xa139('0x68')]?{'message':_0xa139('0x69'),'statusCode':_0x17846e[_0xa139('0x6a')]}:_0x17846e);});}else{var _0xac7cd9=0x1f4;_0x4a8377['status'](_0xac7cd9)[_0xa139('0x6b')]({'message':_0xa139('0x69'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xbc8f=['Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','update','then','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','getConfigurations','keys','pick','filter','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','substring','POST','format','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','stringify','Calls','values','module_fields','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0xbc8f,0x154));var _0xfbc8=function(_0x4255b6,_0x31a237){_0x4255b6=_0x4255b6-0x0;var _0x164d54=_0xbc8f[_0x4255b6];return _0x164d54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbc8('0x0'));var zipdir=require(_0xfbc8('0x1'));var jsonpatch=require(_0xfbc8('0x2'));var rp=require('request-promise');var moment=require(_0xfbc8('0x3'));var BPromise=require(_0xfbc8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfbc8('0x5'));var sox=require(_0xfbc8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbc8('0x7'));var _=require('lodash');var squel=require(_0xfbc8('0x8'));var crypto=require('crypto');var jsforce=require(_0xfbc8('0x9'));var deskjs=require(_0xfbc8('0xa'));var toCsv=require(_0xfbc8('0xb'));var querystring=require(_0xfbc8('0xc'));var Papa=require('papaparse');var Redis=require(_0xfbc8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfbc8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfbc8('0xf'));var utils=require(_0xfbc8('0x10'));var config=require(_0xfbc8('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xfbc8('0x12'));function respondWithStatusCode(_0x1e754e,_0x3fff80){_0x3fff80=_0x3fff80||0xcc;return function(_0x138454){if(_0x138454){return _0x1e754e[_0xfbc8('0x13')](_0x3fff80);}return _0x1e754e[_0xfbc8('0x14')](_0x3fff80)[_0xfbc8('0x15')]();};}function respondWithResult(_0x47d3a3,_0xbb1b96){_0xbb1b96=_0xbb1b96||0xc8;return function(_0x54f38f){if(_0x54f38f){return _0x47d3a3[_0xfbc8('0x14')](_0xbb1b96)['json'](_0x54f38f);}};}function respondWithFilteredResult(_0x39cdea,_0x4e4e6e){return function(_0x1ed7fe){if(_0x1ed7fe){var _0x453715=typeof _0x4e4e6e[_0xfbc8('0x16')]===_0xfbc8('0x17')&&typeof _0x4e4e6e['limit']==='undefined';var _0x1a0456=_0x1ed7fe['count'];var _0x2e289e=_0x453715?0x0:_0x4e4e6e[_0xfbc8('0x16')];var _0x4d1042=_0x453715?_0x1ed7fe[_0xfbc8('0x18')]:_0x4e4e6e['offset']+_0x4e4e6e[_0xfbc8('0x19')];var _0x174e4d;if(_0x4d1042>=_0x1a0456){_0x4d1042=_0x1a0456;_0x174e4d=0xc8;}else{_0x174e4d=0xce;}_0x39cdea[_0xfbc8('0x14')](_0x174e4d);return _0x39cdea[_0xfbc8('0x1a')]('Content-Range',_0x2e289e+'-'+_0x4d1042+'/'+_0x1a0456)[_0xfbc8('0x1b')](_0x1ed7fe);}return null;};}function patchUpdates(_0x1ea4ed){return function(_0x23aaeb){try{jsonpatch['apply'](_0x23aaeb,_0x1ea4ed,!![]);}catch(_0x5d5ad3){return BPromise[_0xfbc8('0x1c')](_0x5d5ad3);}return _0x23aaeb['save']();};}function saveUpdates(_0x326902,_0x3d62b2){return function(_0x4ab85b){if(_0x4ab85b){return _0x4ab85b[_0xfbc8('0x1d')](_0x326902)[_0xfbc8('0x1e')](function(_0xd22981){return _0xd22981;});}return null;};}function removeEntity(_0x250552,_0x49ad5f){return function(_0x5c2dd4){if(_0x5c2dd4){return _0x5c2dd4['destroy']()['then'](function(){_0x250552[_0xfbc8('0x14')](0xcc)[_0xfbc8('0x15')]();});}};}function handleEntityNotFound(_0x17af42,_0x22f1ff){return function(_0x3ab600){if(!_0x3ab600){_0x17af42['sendStatus'](0x194);}return _0x3ab600;};}function handleError(_0x188c44,_0x147b01){_0x147b01=_0x147b01||0x1f4;return function(_0x3fcd27){logger[_0xfbc8('0x1f')](_0x3fcd27[_0xfbc8('0x20')]);if(_0x3fcd27[_0xfbc8('0x21')]){delete _0x3fcd27[_0xfbc8('0x21')];}_0x188c44[_0xfbc8('0x14')](_0x147b01)['send'](_0x3fcd27);};}exports[_0xfbc8('0x22')]=function(_0x20d9fd,_0x3c4b93){var _0x5cce41={},_0x5d35cd={},_0x325d71={'count':0x0,'rows':[]};var _0x4ec3f4=_[_0xfbc8('0x23')](db[_0xfbc8('0x24')][_0xfbc8('0x25')],function(_0x3e9c1d){return{'name':_0x3e9c1d[_0xfbc8('0x26')],'type':_0x3e9c1d[_0xfbc8('0x27')]['key']};});_0x5d35cd[_0xfbc8('0x28')]=_[_0xfbc8('0x23')](_0x4ec3f4,_0xfbc8('0x21'));_0x5d35cd[_0xfbc8('0x29')]=_['keys'](_0x20d9fd[_0xfbc8('0x29')]);_0x5d35cd[_0xfbc8('0x2a')]=_[_0xfbc8('0x2b')](_0x5d35cd['model'],_0x5d35cd[_0xfbc8('0x29')]);_0x5cce41[_0xfbc8('0x2c')]=_[_0xfbc8('0x2b')](_0x5d35cd[_0xfbc8('0x28')],qs[_0xfbc8('0x2d')](_0x20d9fd[_0xfbc8('0x29')][_0xfbc8('0x2d')]));_0x5cce41['attributes']=_0x5cce41[_0xfbc8('0x2c')][_0xfbc8('0x2e')]?_0x5cce41[_0xfbc8('0x2c')]:_0x5d35cd[_0xfbc8('0x28')];if(!_0x20d9fd[_0xfbc8('0x29')]['hasOwnProperty'](_0xfbc8('0x2f'))){_0x5cce41[_0xfbc8('0x19')]=qs[_0xfbc8('0x19')](_0x20d9fd[_0xfbc8('0x29')][_0xfbc8('0x19')]);_0x5cce41['offset']=qs[_0xfbc8('0x16')](_0x20d9fd[_0xfbc8('0x29')][_0xfbc8('0x16')]);}_0x5cce41[_0xfbc8('0x30')]=qs[_0xfbc8('0x31')](_0x20d9fd[_0xfbc8('0x29')][_0xfbc8('0x31')]);_0x5cce41['where']=qs[_0xfbc8('0x2a')](_['pick'](_0x20d9fd['query'],_0x5d35cd[_0xfbc8('0x2a')]),_0x4ec3f4);if(_0x20d9fd[_0xfbc8('0x29')]['filter']){_0x5cce41[_0xfbc8('0x32')]=_[_0xfbc8('0x33')](_0x5cce41[_0xfbc8('0x32')],{'$or':_[_0xfbc8('0x23')](_0x4ec3f4,function(_0x2e175f){if(_0x2e175f['type']!=='VIRTUAL'){var _0x5303a3={};_0x5303a3[_0x2e175f[_0xfbc8('0x21')]]={'$like':'%'+_0x20d9fd[_0xfbc8('0x29')]['filter']+'%'};return _0x5303a3;}})});}_0x5cce41=_['merge']({},_0x5cce41,_0x20d9fd[_0xfbc8('0x34')]);var _0x32f02f={'where':_0x5cce41[_0xfbc8('0x32')]};return db['SugarcrmAccount'][_0xfbc8('0x18')](_0x32f02f)[_0xfbc8('0x1e')](function(_0x4d5024){_0x325d71['count']=_0x4d5024;if(_0x20d9fd[_0xfbc8('0x29')][_0xfbc8('0x35')]){_0x5cce41['include']=[{'all':!![]}];}return db[_0xfbc8('0x24')][_0xfbc8('0x36')](_0x5cce41);})['then'](function(_0x315037){_0x325d71[_0xfbc8('0x37')]=_0x315037;return _0x325d71;})[_0xfbc8('0x1e')](respondWithFilteredResult(_0x3c4b93,_0x5cce41))[_0xfbc8('0x38')](handleError(_0x3c4b93,null));};exports[_0xfbc8('0x39')]=function(_0x2920ca,_0x4ed7e5){var _0x287bf2={'raw':![],'where':{'id':_0x2920ca[_0xfbc8('0x3a')]['id']}},_0x5b3985={};_0x5b3985[_0xfbc8('0x28')]=_['keys'](db['SugarcrmAccount'][_0xfbc8('0x25')]);_0x5b3985['query']=_['keys'](_0x2920ca['query']);_0x5b3985['filters']=_[_0xfbc8('0x2b')](_0x5b3985[_0xfbc8('0x28')],_0x5b3985['query']);_0x287bf2[_0xfbc8('0x2c')]=_[_0xfbc8('0x2b')](_0x5b3985[_0xfbc8('0x28')],qs[_0xfbc8('0x2d')](_0x2920ca[_0xfbc8('0x29')]['fields']));_0x287bf2['attributes']=_0x287bf2['attributes'][_0xfbc8('0x2e')]?_0x287bf2['attributes']:_0x5b3985[_0xfbc8('0x28')];if(_0x2920ca[_0xfbc8('0x29')][_0xfbc8('0x35')]){_0x287bf2[_0xfbc8('0x3b')]=[{'all':!![]}];}_0x287bf2=_[_0xfbc8('0x33')]({},_0x287bf2,_0x2920ca[_0xfbc8('0x34')]);return db[_0xfbc8('0x24')][_0xfbc8('0x3c')](_0x287bf2)[_0xfbc8('0x1e')](handleEntityNotFound(_0x4ed7e5,null))[_0xfbc8('0x1e')](respondWithResult(_0x4ed7e5,null))[_0xfbc8('0x38')](handleError(_0x4ed7e5,null));};exports['create']=function(_0x4ab469,_0x50b5be){return db[_0xfbc8('0x24')][_0xfbc8('0x3d')](_0x4ab469[_0xfbc8('0x3e')],{})[_0xfbc8('0x1e')](respondWithResult(_0x50b5be,0xc9))[_0xfbc8('0x38')](handleError(_0x50b5be,null));};exports[_0xfbc8('0x1d')]=function(_0x284ffa,_0x2645b9){if(_0x284ffa[_0xfbc8('0x3e')]['id']){delete _0x284ffa[_0xfbc8('0x3e')]['id'];}return db[_0xfbc8('0x24')]['find']({'where':{'id':_0x284ffa[_0xfbc8('0x3a')]['id']}})[_0xfbc8('0x1e')](handleEntityNotFound(_0x2645b9,null))['then'](saveUpdates(_0x284ffa['body'],null))[_0xfbc8('0x1e')](respondWithResult(_0x2645b9,null))[_0xfbc8('0x38')](handleError(_0x2645b9,null));};exports[_0xfbc8('0x3f')]=function(_0x12c26a,_0x53218e){return db[_0xfbc8('0x24')][_0xfbc8('0x3c')]({'where':{'id':_0x12c26a[_0xfbc8('0x3a')]['id']}})[_0xfbc8('0x1e')](handleEntityNotFound(_0x53218e,null))[_0xfbc8('0x1e')](removeEntity(_0x53218e,null))[_0xfbc8('0x38')](handleError(_0x53218e,null));};exports[_0xfbc8('0x40')]=function(_0x18f985,_0x460761,_0x4f1ca3){var _0x4dcea9={};var _0x3645d1={};var _0x5c6d31;var _0x475975;return db[_0xfbc8('0x24')]['findOne']({'where':{'id':_0x18f985[_0xfbc8('0x3a')]['id']}})[_0xfbc8('0x1e')](handleEntityNotFound(_0x460761,null))['then'](function(_0x4ffbd8){if(_0x4ffbd8){_0x5c6d31=_0x4ffbd8;_0x3645d1[_0xfbc8('0x28')]=_[_0xfbc8('0x41')](db['SugarcrmConfiguration'][_0xfbc8('0x25')]);_0x3645d1[_0xfbc8('0x29')]=_['keys'](_0x18f985[_0xfbc8('0x29')]);_0x3645d1[_0xfbc8('0x2a')]=_[_0xfbc8('0x2b')](_0x3645d1[_0xfbc8('0x28')],_0x3645d1[_0xfbc8('0x29')]);_0x4dcea9['attributes']=_[_0xfbc8('0x2b')](_0x3645d1[_0xfbc8('0x28')],qs[_0xfbc8('0x2d')](_0x18f985[_0xfbc8('0x29')][_0xfbc8('0x2d')]));_0x4dcea9['attributes']=_0x4dcea9[_0xfbc8('0x2c')][_0xfbc8('0x2e')]?_0x4dcea9[_0xfbc8('0x2c')]:_0x3645d1['model'];_0x4dcea9[_0xfbc8('0x30')]=qs[_0xfbc8('0x31')](_0x18f985['query'][_0xfbc8('0x31')]);_0x4dcea9[_0xfbc8('0x32')]=qs[_0xfbc8('0x2a')](_[_0xfbc8('0x42')](_0x18f985['query'],_0x3645d1[_0xfbc8('0x2a')]));if(_0x18f985[_0xfbc8('0x29')][_0xfbc8('0x43')]){_0x4dcea9[_0xfbc8('0x32')]=_['merge'](_0x4dcea9[_0xfbc8('0x32')],{'$or':_[_0xfbc8('0x23')](_0x4dcea9['attributes'],function(_0x5686f0){var _0x46246e={};_0x46246e[_0x5686f0]={'$like':'%'+_0x18f985['query']['filter']+'%'};return _0x46246e;})});}_0x4dcea9=_['merge']({},_0x4dcea9,_0x18f985[_0xfbc8('0x34')]);return _0x5c6d31[_0xfbc8('0x40')](_0x4dcea9);}})[_0xfbc8('0x1e')](function(_0x47f030){if(_0x47f030){_0x475975=_0x47f030[_0xfbc8('0x2e')];if(!_0x18f985[_0xfbc8('0x29')][_0xfbc8('0x44')]('nolimit')){_0x4dcea9[_0xfbc8('0x19')]=qs[_0xfbc8('0x19')](_0x18f985[_0xfbc8('0x29')][_0xfbc8('0x19')]);_0x4dcea9[_0xfbc8('0x16')]=qs[_0xfbc8('0x16')](_0x18f985[_0xfbc8('0x29')][_0xfbc8('0x16')]);}return _0x5c6d31[_0xfbc8('0x40')](_0x4dcea9);}})[_0xfbc8('0x1e')](function(_0x4bdf80){if(_0x4bdf80){return _0x4bdf80?{'count':_0x475975,'rows':_0x4bdf80}:null;}})[_0xfbc8('0x1e')](respondWithResult(_0x460761,null))[_0xfbc8('0x38')](handleError(_0x460761,null));};exports['addConfiguration']=function(_0x32add3,_0x39eafd,_0x5a5e52){if(_0x32add3['body']['id']){delete _0x32add3[_0xfbc8('0x3e')]['id'];}return db[_0xfbc8('0x24')][_0xfbc8('0x45')]({'where':{'id':_0x32add3[_0xfbc8('0x3a')]['id']}})[_0xfbc8('0x1e')](handleEntityNotFound(_0x39eafd,null))['then'](function(_0x459d3f){if(_0x459d3f){_0x32add3[_0xfbc8('0x3e')][_0xfbc8('0x46')]=_0x459d3f['id'];_0x32add3[_0xfbc8('0x3e')][_0xfbc8('0x47')]=integrations[_0xfbc8('0x48')](_0x32add3['body']['channel'],_0x32add3[_0xfbc8('0x3e')][_0xfbc8('0x27')]);_0x32add3[_0xfbc8('0x3e')][_0xfbc8('0x49')]=integrations[_0xfbc8('0x4a')](_0x32add3[_0xfbc8('0x3e')][_0xfbc8('0x4b')],_0x32add3['body']['type']);return db[_0xfbc8('0x4c')][_0xfbc8('0x3d')](_0x32add3['body'],{'include':[{'model':db[_0xfbc8('0x4d')],'as':_0xfbc8('0x47')},{'model':db['SugarcrmField'],'as':_0xfbc8('0x49')}]});}return null;})[_0xfbc8('0x1e')](respondWithResult(_0x39eafd,null))[_0xfbc8('0x38')](handleError(_0x39eafd,null));};exports[_0xfbc8('0x4e')]=function(_0x114325,_0x512a16,_0x39cdbf){var _0x55b6ff='';var _0x53e3a3=['id',_0xfbc8('0x21'),_0xfbc8('0x4f'),_0xfbc8('0x50'),_0xfbc8('0x51'),_0xfbc8('0x52'),'duration_hours',_0xfbc8('0x53'),_0xfbc8('0x54'),_0xfbc8('0x55'),_0xfbc8('0x56'),_0xfbc8('0x57')];return db[_0xfbc8('0x24')][_0xfbc8('0x45')]({'where':{'id':_0x114325[_0xfbc8('0x3a')]['id']},'attributes':['id',_0xfbc8('0x58'),'password',_0xfbc8('0x59')]})[_0xfbc8('0x1e')](handleEntityNotFound(_0x512a16,null))['then'](function(_0x22ba70){if(_0x22ba70){_0x55b6ff=_0x22ba70[_0xfbc8('0x59')];var _0x37c131=_0x55b6ff['slice'](-0x1);if(_0x37c131==='/'){_0x55b6ff=_0x55b6ff[_0xfbc8('0x5a')](0x0,_0x55b6ff['lastIndexOf'](_0x37c131));}return rp({'method':_0xfbc8('0x5b'),'uri':util[_0xfbc8('0x5c')]('%s%s',_0x55b6ff,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xfbc8('0x5d'),'input_type':'JSON','response_type':_0xfbc8('0x5e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x22ba70['username'],'password':_0x22ba70['password'],'encryption':_0xfbc8('0x5f')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xfbc8('0x1e')](function(_0x246569){if(_0x246569&&_0x246569[_0xfbc8('0x21')]!==_0xfbc8('0x60')&&_0x246569[_0xfbc8('0x21')]!==_0xfbc8('0x61')){return rp({'method':_0xfbc8('0x5b'),'uri':util[_0xfbc8('0x5c')]('%s%s',_0x55b6ff,_0xfbc8('0x62')),'json':!![],'form':{'method':_0xfbc8('0x63'),'input_type':_0xfbc8('0x5e'),'response_type':'JSON','rest_data':JSON[_0xfbc8('0x64')]({'session':_0x246569['id'],'module_name':_0xfbc8('0x65')})}})[_0xfbc8('0x1e')](function(_0x18ace1){if(_0x18ace1){var _0xb55a90=_[_0xfbc8('0x66')](_0x18ace1[_0xfbc8('0x67')]);_[_0xfbc8('0x68')](_0xb55a90,function(_0x7366fe){return _0x53e3a3[_0xfbc8('0x69')](_0x7366fe[_0xfbc8('0x21')]);});return{'count':_0xb55a90[_0xfbc8('0x2e')],'rows':_[_0xfbc8('0x23')](_0xb55a90,function(_0x42beb3){return{'id':_0x42beb3[_0xfbc8('0x21')],'name':_0x42beb3[_0xfbc8('0x6a')],'custom':_[_0xfbc8('0x6b')](_0x42beb3['name'],'_c')?!![]:![],'options':_0x42beb3[_0xfbc8('0x34')]?_['map'](_[_0xfbc8('0x66')](_0x42beb3[_0xfbc8('0x34')]),function(_0x2194fa){return{'name':_0x2194fa['value'],'value':_0x2194fa['name']};}):[]};})};}})[_0xfbc8('0x1e')](respondWithResult(_0x512a16,null))[_0xfbc8('0x38')](function(_0x301e53){var _0xfc39b2=_0x114325[_0xfbc8('0x29')][_0xfbc8('0x6c')]?0x1f4:_0x301e53[_0xfbc8('0x6d')]||0x1f4;logger[_0xfbc8('0x1f')](_0xfbc8('0x6e'),'getFields',_0xfc39b2,JSON[_0xfbc8('0x64')](_0x301e53));delete _0x301e53[_0xfbc8('0x21')];if(_0xfc39b2===0x191){_0xfc39b2=0x190;}_0x512a16[_0xfbc8('0x14')](_0xfc39b2)[_0xfbc8('0x6f')](_0x114325[_0xfbc8('0x29')][_0xfbc8('0x6c')]?{'message':_0xfbc8('0x70'),'statusCode':_0x301e53['statusCode']}:_0x301e53);});}else{var _0x18b63b=0x1f4;_0x512a16['status'](_0x18b63b)[_0xfbc8('0x6f')]({'message':_0xfbc8('0x70'),'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 e182af6..5d9e35f 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 _0x6d37=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x20a3e3,_0x59b519){var _0x140f9b=function(_0x414d6f){while(--_0x414d6f){_0x20a3e3['push'](_0x20a3e3['shift']());}};_0x140f9b(++_0x59b519);}(_0x6d37,0x18e));var _0x76d3=function(_0x164dfb,_0x5987e6){_0x164dfb=_0x164dfb-0x0;var _0x55b547=_0x6d37[_0x164dfb];return _0x55b547;};'use strict';var _=require(_0x76d3('0x0'));var util=require(_0x76d3('0x1'));var logger=require(_0x76d3('0x2'))('api');var moment=require(_0x76d3('0x3'));var BPromise=require(_0x76d3('0x4'));var rp=require(_0x76d3('0x5'));var fs=require('fs');var path=require(_0x76d3('0x6'));var rimraf=require(_0x76d3('0x7'));var config=require(_0x76d3('0x8'));var attributes=require(_0x76d3('0x9'));var integrations=require(_0x76d3('0xa'));module['exports']=function(_0x353e82,_0x5501a9){return _0x353e82[_0x76d3('0xb')](_0x76d3('0xc'),attributes,{'tableName':_0x76d3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68df=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x16e9dd,_0x688c6){var _0x3ef25b=function(_0x156b70){while(--_0x156b70){_0x16e9dd['push'](_0x16e9dd['shift']());}};_0x3ef25b(++_0x688c6);}(_0x68df,0xcd));var _0xf68d=function(_0x435117,_0x2b9bad){_0x435117=_0x435117-0x0;var _0x585a63=_0x68df[_0x435117];return _0x585a63;};'use strict';var _=require(_0xf68d('0x0'));var util=require(_0xf68d('0x1'));var logger=require(_0xf68d('0x2'))('api');var moment=require(_0xf68d('0x3'));var BPromise=require(_0xf68d('0x4'));var rp=require(_0xf68d('0x5'));var fs=require('fs');var path=require(_0xf68d('0x6'));var rimraf=require(_0xf68d('0x7'));var config=require(_0xf68d('0x8'));var attributes=require(_0xf68d('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf68d('0xa')]=function(_0x5a9026,_0xee6674){return _0x5a9026['define'](_0xf68d('0xb'),attributes,{'tableName':_0xf68d('0xc'),'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 dbaee81..54bd087 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 _0xfc4d=['request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','model','map','debug','find','then','ShowSugarcrmAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1f7ff8,_0x5c072d){var _0x27c526=function(_0x486f6b){while(--_0x486f6b){_0x1f7ff8['push'](_0x1f7ff8['shift']());}};_0x27c526(++_0x5c072d);}(_0xfc4d,0x15d));var _0xdfc4=function(_0x255036,_0xf94145){_0x255036=_0x255036-0x0;var _0x3c4c56=_0xfc4d[_0x255036];return _0x3c4c56;};'use strict';var _=require(_0xdfc4('0x0'));var util=require('util');var moment=require(_0xdfc4('0x1'));var BPromise=require(_0xdfc4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfc4('0x3'));var db=require(_0xdfc4('0x4'))['db'];var utils=require(_0xdfc4('0x5'));var logger=require(_0xdfc4('0x6'))(_0xdfc4('0x7'));var config=require(_0xdfc4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdfc4('0x9')][_0xdfc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b79b8,_0x36e843,_0x44b613){return new BPromise(function(_0x3cfe79,_0x4d85c1){return client[_0xdfc4('0xb')](_0x3b79b8,_0x44b613)['then'](function(_0x45aa49){logger[_0xdfc4('0xc')](_0xdfc4('0xd'),_0x36e843,_0xdfc4('0xe'));logger['debug'](_0xdfc4('0xf'),_0x36e843,_0xdfc4('0xe'),JSON[_0xdfc4('0x10')](_0x45aa49));if(_0x45aa49[_0xdfc4('0x11')]){if(_0x45aa49[_0xdfc4('0x11')][_0xdfc4('0x12')]===0x1f4){logger[_0xdfc4('0x11')](_0xdfc4('0xd'),_0x36e843,_0x45aa49['error']['message']);return _0x4d85c1(_0x45aa49[_0xdfc4('0x11')][_0xdfc4('0x13')]);}logger[_0xdfc4('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x36e843,_0x45aa49[_0xdfc4('0x11')][_0xdfc4('0x13')]);return _0x3cfe79(_0x45aa49[_0xdfc4('0x11')][_0xdfc4('0x13')]);}else{logger['info'](_0xdfc4('0xd'),_0x36e843,_0xdfc4('0xe'));_0x3cfe79(_0x45aa49[_0xdfc4('0x14')][_0xdfc4('0x13')]);}})[_0xdfc4('0x15')](function(_0x506356){logger[_0xdfc4('0x11')](_0xdfc4('0xd'),_0x36e843,_0x506356);_0x4d85c1(_0x506356);});});}exports[_0xdfc4('0x16')]=function(_0x1fa6e8){var _0x284f5a=this;return new Promise(function(_0x3b64d6,_0xda8d21){return db[_0xdfc4('0x17')][_0xdfc4('0x18')]({'raw':_0x1fa6e8[_0xdfc4('0x19')]?_0x1fa6e8[_0xdfc4('0x19')][_0xdfc4('0x1a')]===undefined?!![]:![]:!![],'where':_0x1fa6e8['options']?_0x1fa6e8[_0xdfc4('0x19')][_0xdfc4('0x1b')]||null:null,'attributes':_0x1fa6e8[_0xdfc4('0x19')]?_0x1fa6e8['options'][_0xdfc4('0x1c')]||null:null,'limit':_0x1fa6e8['options']?_0x1fa6e8[_0xdfc4('0x19')]['limit']||null:null,'include':_0x1fa6e8[_0xdfc4('0x19')]?_0x1fa6e8[_0xdfc4('0x19')][_0xdfc4('0x1d')]?_['map'](_0x1fa6e8[_0xdfc4('0x19')][_0xdfc4('0x1d')],function(_0x24cb5a){return{'model':db[_0x24cb5a[_0xdfc4('0x1e')]],'as':_0x24cb5a['as'],'attributes':_0x24cb5a['attributes'],'include':_0x24cb5a[_0xdfc4('0x1d')]?_[_0xdfc4('0x1f')](_0x24cb5a['include'],function(_0x5b4f08){return{'model':db[_0x5b4f08[_0xdfc4('0x1e')]],'as':_0x5b4f08['as'],'attributes':_0x5b4f08[_0xdfc4('0x1c')],'include':_0x5b4f08[_0xdfc4('0x1d')]?_[_0xdfc4('0x1f')](_0x5b4f08[_0xdfc4('0x1d')],function(_0x447d36){return{'model':db[_0x447d36['model']],'as':_0x447d36['as'],'attributes':_0x447d36[_0xdfc4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57b989){logger[_0xdfc4('0xc')](_0xdfc4('0x16'),_0x1fa6e8);logger[_0xdfc4('0x20')](_0xdfc4('0x16'),_0x1fa6e8,JSON[_0xdfc4('0x10')](_0x57b989));_0x3b64d6(_0x57b989);})[_0xdfc4('0x15')](function(_0x1fa23a){logger[_0xdfc4('0x11')](_0xdfc4('0x16'),_0x1fa23a[_0xdfc4('0x13')],_0x1fa6e8);_0xda8d21(_0x284f5a[_0xdfc4('0x11')](0x1f4,_0x1fa23a[_0xdfc4('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0xaac762){var _0x3c762c=this;return new Promise(function(_0x322420,_0x218ae4){return db[_0xdfc4('0x17')][_0xdfc4('0x21')]({'raw':_0xaac762[_0xdfc4('0x19')]?_0xaac762[_0xdfc4('0x19')][_0xdfc4('0x1a')]===undefined?!![]:![]:!![],'where':_0xaac762[_0xdfc4('0x19')]?_0xaac762[_0xdfc4('0x19')][_0xdfc4('0x1b')]||null:null,'attributes':_0xaac762[_0xdfc4('0x19')]?_0xaac762[_0xdfc4('0x19')]['attributes']||null:null,'include':_0xaac762[_0xdfc4('0x19')]?_0xaac762[_0xdfc4('0x19')]['include']?_[_0xdfc4('0x1f')](_0xaac762[_0xdfc4('0x19')][_0xdfc4('0x1d')],function(_0x3cb0f4){return{'model':db[_0x3cb0f4[_0xdfc4('0x1e')]],'as':_0x3cb0f4['as'],'attributes':_0x3cb0f4[_0xdfc4('0x1c')],'include':_0x3cb0f4['include']?_['map'](_0x3cb0f4[_0xdfc4('0x1d')],function(_0x37cad9){return{'model':db[_0x37cad9[_0xdfc4('0x1e')]],'as':_0x37cad9['as'],'attributes':_0x37cad9[_0xdfc4('0x1c')],'include':_0x37cad9[_0xdfc4('0x1d')]?_[_0xdfc4('0x1f')](_0x37cad9[_0xdfc4('0x1d')],function(_0x23ce65){return{'model':db[_0x23ce65[_0xdfc4('0x1e')]],'as':_0x23ce65['as'],'attributes':_0x23ce65[_0xdfc4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdfc4('0x22')](function(_0x25525a){logger['info'](_0xdfc4('0x23'),_0xaac762);logger[_0xdfc4('0x20')](_0xdfc4('0x23'),_0xaac762,JSON[_0xdfc4('0x10')](_0x25525a));_0x322420(_0x25525a);})[_0xdfc4('0x15')](function(_0x46b83e){logger[_0xdfc4('0x11')]('ShowSugarcrmAccount',_0x46b83e['message'],_0xaac762);_0x218ae4(_0x3c762c[_0xdfc4('0x11')](0x1f4,_0x46b83e[_0xdfc4('0x13')]));});});}; \ No newline at end of file +var _0xa037=['limit','map','model','include','GetSugarcrmAccount','find','raw','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','findAll','options','where','attributes'];(function(_0x435731,_0x2e59d4){var _0xbbb1d4=function(_0x5f5bc4){while(--_0x5f5bc4){_0x435731['push'](_0x435731['shift']());}};_0xbbb1d4(++_0x2e59d4);}(_0xa037,0x68));var _0x7a03=function(_0x50753f,_0x179899){_0x50753f=_0x50753f-0x0;var _0x106e1c=_0xa037[_0x50753f];return _0x106e1c;};'use strict';var _=require(_0x7a03('0x0'));var util=require(_0x7a03('0x1'));var moment=require('moment');var BPromise=require(_0x7a03('0x2'));var rs=require(_0x7a03('0x3'));var fs=require('fs');var Redis=require(_0x7a03('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a03('0x5'));var logger=require('../../config/logger')(_0x7a03('0x6'));var config=require(_0x7a03('0x7'));var jayson=require(_0x7a03('0x8'));var client=jayson[_0x7a03('0x9')][_0x7a03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4990b1,_0x19e550,_0x3ddf7e){return new BPromise(function(_0x51685d,_0x486528){return client['request'](_0x4990b1,_0x3ddf7e)[_0x7a03('0xb')](function(_0xbd048f){logger['info'](_0x7a03('0xc'),_0x19e550,_0x7a03('0xd'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x19e550,_0x7a03('0xd'),JSON[_0x7a03('0xe')](_0xbd048f));if(_0xbd048f['error']){if(_0xbd048f[_0x7a03('0xf')][_0x7a03('0x10')]===0x1f4){logger[_0x7a03('0xf')](_0x7a03('0xc'),_0x19e550,_0xbd048f[_0x7a03('0xf')][_0x7a03('0x11')]);return _0x486528(_0xbd048f[_0x7a03('0xf')][_0x7a03('0x11')]);}logger[_0x7a03('0xf')](_0x7a03('0xc'),_0x19e550,_0xbd048f[_0x7a03('0xf')][_0x7a03('0x11')]);return _0x51685d(_0xbd048f[_0x7a03('0xf')][_0x7a03('0x11')]);}else{logger[_0x7a03('0x12')](_0x7a03('0xc'),_0x19e550,_0x7a03('0xd'));_0x51685d(_0xbd048f['result'][_0x7a03('0x11')]);}})[_0x7a03('0x13')](function(_0x180025){logger[_0x7a03('0xf')](_0x7a03('0xc'),_0x19e550,_0x180025);_0x486528(_0x180025);});});}exports['GetSugarcrmAccount']=function(_0x46f8ea){var _0x23c990=this;return new Promise(function(_0x220f31,_0xc795b1){return db['SugarcrmAccount'][_0x7a03('0x14')]({'raw':_0x46f8ea[_0x7a03('0x15')]?_0x46f8ea['options']['raw']===undefined?!![]:![]:!![],'where':_0x46f8ea['options']?_0x46f8ea['options'][_0x7a03('0x16')]||null:null,'attributes':_0x46f8ea[_0x7a03('0x15')]?_0x46f8ea[_0x7a03('0x15')][_0x7a03('0x17')]||null:null,'limit':_0x46f8ea['options']?_0x46f8ea[_0x7a03('0x15')][_0x7a03('0x18')]||null:null,'include':_0x46f8ea[_0x7a03('0x15')]?_0x46f8ea[_0x7a03('0x15')]['include']?_[_0x7a03('0x19')](_0x46f8ea['options']['include'],function(_0x3555cb){return{'model':db[_0x3555cb[_0x7a03('0x1a')]],'as':_0x3555cb['as'],'attributes':_0x3555cb['attributes'],'include':_0x3555cb[_0x7a03('0x1b')]?_['map'](_0x3555cb[_0x7a03('0x1b')],function(_0x4c0496){return{'model':db[_0x4c0496[_0x7a03('0x1a')]],'as':_0x4c0496['as'],'attributes':_0x4c0496[_0x7a03('0x17')],'include':_0x4c0496[_0x7a03('0x1b')]?_[_0x7a03('0x19')](_0x4c0496[_0x7a03('0x1b')],function(_0x590a4f){return{'model':db[_0x590a4f['model']],'as':_0x590a4f['as'],'attributes':_0x590a4f[_0x7a03('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x453fc0){logger[_0x7a03('0x12')](_0x7a03('0x1c'),_0x46f8ea);logger['debug'](_0x7a03('0x1c'),_0x46f8ea,JSON[_0x7a03('0xe')](_0x453fc0));_0x220f31(_0x453fc0);})[_0x7a03('0x13')](function(_0x3a264a){logger[_0x7a03('0xf')]('GetSugarcrmAccount',_0x3a264a[_0x7a03('0x11')],_0x46f8ea);_0xc795b1(_0x23c990[_0x7a03('0xf')](0x1f4,_0x3a264a[_0x7a03('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0xd931bf){var _0x145b56=this;return new Promise(function(_0xc23983,_0x5c41cc){return db['SugarcrmAccount'][_0x7a03('0x1d')]({'raw':_0xd931bf['options']?_0xd931bf[_0x7a03('0x15')][_0x7a03('0x1e')]===undefined?!![]:![]:!![],'where':_0xd931bf[_0x7a03('0x15')]?_0xd931bf[_0x7a03('0x15')][_0x7a03('0x16')]||null:null,'attributes':_0xd931bf['options']?_0xd931bf['options'][_0x7a03('0x17')]||null:null,'include':_0xd931bf[_0x7a03('0x15')]?_0xd931bf['options'][_0x7a03('0x1b')]?_[_0x7a03('0x19')](_0xd931bf[_0x7a03('0x15')][_0x7a03('0x1b')],function(_0x235e06){return{'model':db[_0x235e06[_0x7a03('0x1a')]],'as':_0x235e06['as'],'attributes':_0x235e06[_0x7a03('0x17')],'include':_0x235e06[_0x7a03('0x1b')]?_[_0x7a03('0x19')](_0x235e06[_0x7a03('0x1b')],function(_0x1caa7e){return{'model':db[_0x1caa7e[_0x7a03('0x1a')]],'as':_0x1caa7e['as'],'attributes':_0x1caa7e[_0x7a03('0x17')],'include':_0x1caa7e[_0x7a03('0x1b')]?_['map'](_0x1caa7e[_0x7a03('0x1b')],function(_0x54a35d){return{'model':db[_0x54a35d[_0x7a03('0x1a')]],'as':_0x54a35d['as'],'attributes':_0x54a35d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a03('0xb')](function(_0xb16623){logger[_0x7a03('0x12')](_0x7a03('0x1f'),_0xd931bf);logger['debug'](_0x7a03('0x1f'),_0xd931bf,JSON[_0x7a03('0xe')](_0xb16623));_0xc23983(_0xb16623);})[_0x7a03('0x13')](function(_0x5ef995){logger['error'](_0x7a03('0x1f'),_0x5ef995[_0x7a03('0x11')],_0xd931bf);_0x5c41cc(_0x145b56[_0x7a03('0xf')](0x1f4,_0x5ef995['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index f31d7c4..594a52a 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 _0x1349=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','multer','util','path','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1349,0x15c));var _0x9134=function(_0x5b756b,_0x385c25){_0x5b756b=_0x5b756b-0x0;var _0x34e6e1=_0x1349[_0x5b756b];return _0x34e6e1;};'use strict';var multer=require(_0x9134('0x0'));var util=require(_0x9134('0x1'));var path=require(_0x9134('0x2'));var timeout=require('connect-timeout');var express=require(_0x9134('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9134('0x4'));var interaction=require(_0x9134('0x5'));var config=require(_0x9134('0x6'));var controller=require(_0x9134('0x7'));router[_0x9134('0x8')]('/',auth[_0x9134('0x9')](),controller[_0x9134('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9134('0x8')](_0x9134('0xb'),auth[_0x9134('0x9')](),controller[_0x9134('0xc')]);router[_0x9134('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x9134('0xd')]);router['get'](_0x9134('0xe'),auth[_0x9134('0x9')](),controller[_0x9134('0xf')]);router['post']('/',auth[_0x9134('0x9')](),controller[_0x9134('0x10')]);router[_0x9134('0x11')](_0x9134('0x12'),auth[_0x9134('0x9')](),controller[_0x9134('0x13')]);router[_0x9134('0x14')](_0x9134('0x12'),auth['isAuthenticated'](),controller[_0x9134('0x15')]);module['exports']=router; \ No newline at end of file +var _0x575b=['post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x1e909b,_0x4fe57f){var _0x50c163=function(_0x117a2f){while(--_0x117a2f){_0x1e909b['push'](_0x1e909b['shift']());}};_0x50c163(++_0x4fe57f);}(_0x575b,0x1a4));var _0xb575=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x575b[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb575('0x0'));var timeout=require(_0xb575('0x1'));var express=require(_0xb575('0x2'));var router=express[_0xb575('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb575('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb575('0x5'));var controller=require(_0xb575('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb575('0x7')]);router[_0xb575('0x8')](_0xb575('0x9'),auth[_0xb575('0xa')](),controller[_0xb575('0xb')]);router['get'](_0xb575('0xc'),auth[_0xb575('0xa')](),controller[_0xb575('0xd')]);router[_0xb575('0x8')](_0xb575('0xe'),auth[_0xb575('0xa')](),controller[_0xb575('0xf')]);router[_0xb575('0x8')]('/:id/descriptions',auth[_0xb575('0xa')](),controller[_0xb575('0x10')]);router[_0xb575('0x11')]('/',auth[_0xb575('0xa')](),controller['create']);router[_0xb575('0x12')](_0xb575('0x9'),auth[_0xb575('0xa')](),controller[_0xb575('0x13')]);router[_0xb575('0x14')](_0xb575('0x9'),auth['isAuthenticated'](),controller[_0xb575('0x15')]);module[_0xb575('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 5ac900a..20806b4 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 _0xf481=['STRING','exports'];(function(_0x5f173c,_0x2765bf){var _0x47b9cc=function(_0x37cb7e){while(--_0x37cb7e){_0x5f173c['push'](_0x5f173c['shift']());}};_0x47b9cc(++_0x2765bf);}(_0xf481,0x125));var _0x1f48=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0xf481[_0x21f931];return _0x3f083c;};'use strict';var Sequelize=require('sequelize');module[_0x1f48('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f48('0x1')]}}; \ No newline at end of file +var _0x8c25=['STRING','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x8c25,0x109));var _0x58c2=function(_0x475b7c,_0x266a0d){_0x475b7c=_0x475b7c-0x0;var _0x21c3f1=_0x8c25[_0x475b7c];return _0x21c3f1;};'use strict';var Sequelize=require(_0x58c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x58c2('0x1')]},'description':{'type':Sequelize[_0x58c2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 45d8fda..b9d09b5 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 _0x2667=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','name','index','SugarcrmConfiguration','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','getFields','findOne','merge','hasOwnProperty','SugarcrmField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x21c64c,_0x30cb9d){var _0x26f85f=function(_0xd82a7){while(--_0xd82a7){_0x21c64c['push'](_0x21c64c['shift']());}};_0x26f85f(++_0x30cb9d);}(_0x2667,0x1c0));var _0x7266=function(_0x53bbd1,_0x567321){_0x53bbd1=_0x53bbd1-0x0;var _0x2b3b71=_0x2667[_0x53bbd1];return _0x2b3b71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7266('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7266('0x1'));var rp=require(_0x7266('0x2'));var moment=require(_0x7266('0x3'));var BPromise=require(_0x7266('0x4'));var Mustache=require(_0x7266('0x5'));var util=require(_0x7266('0x6'));var path=require(_0x7266('0x7'));var sox=require('sox');var csv=require(_0x7266('0x8'));var ejs=require(_0x7266('0x9'));var fs=require('fs');var fs_extra=require(_0x7266('0xa'));var _=require(_0x7266('0xb'));var squel=require(_0x7266('0xc'));var crypto=require(_0x7266('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7266('0xe'));var toCsv=require(_0x7266('0x8'));var querystring=require(_0x7266('0xf'));var Papa=require(_0x7266('0x10'));var Redis=require(_0x7266('0x11'));var authService=require(_0x7266('0x12'));var qs=require(_0x7266('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7266('0x14'))(_0x7266('0x15'));var utils=require('../../config/utils');var config=require(_0x7266('0x16'));var licenseUtil=require(_0x7266('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dd815,_0x2d5544){_0x2d5544=_0x2d5544||0xcc;return function(_0x1dd812){if(_0x1dd812){return _0x4dd815[_0x7266('0x18')](_0x2d5544);}return _0x4dd815[_0x7266('0x19')](_0x2d5544)['end']();};}function respondWithResult(_0x268d94,_0x744630){_0x744630=_0x744630||0xc8;return function(_0x85f1bb){if(_0x85f1bb){return _0x268d94[_0x7266('0x19')](_0x744630)[_0x7266('0x1a')](_0x85f1bb);}};}function respondWithFilteredResult(_0x573a95,_0x26f32e){return function(_0x487a94){if(_0x487a94){var _0x117feb=typeof _0x26f32e[_0x7266('0x1b')]===_0x7266('0x1c')&&typeof _0x26f32e['limit']==='undefined';var _0x8a65e5=_0x487a94[_0x7266('0x1d')];var _0x404640=_0x117feb?0x0:_0x26f32e[_0x7266('0x1b')];var _0x4404a1=_0x117feb?_0x487a94[_0x7266('0x1d')]:_0x26f32e[_0x7266('0x1b')]+_0x26f32e[_0x7266('0x1e')];var _0x4fd0ef;if(_0x4404a1>=_0x8a65e5){_0x4404a1=_0x8a65e5;_0x4fd0ef=0xc8;}else{_0x4fd0ef=0xce;}_0x573a95[_0x7266('0x19')](_0x4fd0ef);return _0x573a95[_0x7266('0x1f')](_0x7266('0x20'),_0x404640+'-'+_0x4404a1+'/'+_0x8a65e5)[_0x7266('0x1a')](_0x487a94);}return null;};}function patchUpdates(_0x7c80c7){return function(_0x5eed94){try{jsonpatch[_0x7266('0x21')](_0x5eed94,_0x7c80c7,!![]);}catch(_0x20b43a){return BPromise['reject'](_0x20b43a);}return _0x5eed94[_0x7266('0x22')]();};}function saveUpdates(_0x1719ba,_0x5513aa){return function(_0x369d3b){if(_0x369d3b){return _0x369d3b[_0x7266('0x23')](_0x1719ba)[_0x7266('0x24')](function(_0x3de575){return _0x3de575;});}return null;};}function removeEntity(_0x113839,_0xd04433){return function(_0x2f63ab){if(_0x2f63ab){return _0x2f63ab[_0x7266('0x25')]()[_0x7266('0x24')](function(){_0x113839[_0x7266('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff215a,_0x3ccb8c){return function(_0x156cf3){if(!_0x156cf3){_0xff215a[_0x7266('0x18')](0x194);}return _0x156cf3;};}function handleError(_0x3a88f6,_0xa63070){_0xa63070=_0xa63070||0x1f4;return function(_0x387184){logger['error'](_0x387184['stack']);if(_0x387184['name']){delete _0x387184[_0x7266('0x26')];}_0x3a88f6[_0x7266('0x19')](_0xa63070)['send'](_0x387184);};}exports[_0x7266('0x27')]=function(_0x1de5b0,_0x1d7775){var _0x5cc96c={},_0x3d2e7b={},_0x430f50={'count':0x0,'rows':[]};var _0x40c97e=_['map'](db[_0x7266('0x28')]['rawAttributes'],function(_0x4daaac){return{'name':_0x4daaac[_0x7266('0x29')],'type':_0x4daaac[_0x7266('0x2a')]['key']};});_0x3d2e7b[_0x7266('0x2b')]=_[_0x7266('0x2c')](_0x40c97e,'name');_0x3d2e7b[_0x7266('0x2d')]=_[_0x7266('0x2e')](_0x1de5b0[_0x7266('0x2d')]);_0x3d2e7b[_0x7266('0x2f')]=_[_0x7266('0x30')](_0x3d2e7b[_0x7266('0x2b')],_0x3d2e7b['query']);_0x5cc96c[_0x7266('0x31')]=_[_0x7266('0x30')](_0x3d2e7b[_0x7266('0x2b')],qs[_0x7266('0x32')](_0x1de5b0[_0x7266('0x2d')][_0x7266('0x32')]));_0x5cc96c[_0x7266('0x31')]=_0x5cc96c[_0x7266('0x31')][_0x7266('0x33')]?_0x5cc96c[_0x7266('0x31')]:_0x3d2e7b['model'];if(!_0x1de5b0[_0x7266('0x2d')]['hasOwnProperty'](_0x7266('0x34'))){_0x5cc96c[_0x7266('0x1e')]=qs['limit'](_0x1de5b0['query'][_0x7266('0x1e')]);_0x5cc96c[_0x7266('0x1b')]=qs['offset'](_0x1de5b0[_0x7266('0x2d')][_0x7266('0x1b')]);}_0x5cc96c[_0x7266('0x35')]=qs[_0x7266('0x36')](_0x1de5b0[_0x7266('0x2d')][_0x7266('0x36')]);_0x5cc96c[_0x7266('0x37')]=qs[_0x7266('0x2f')](_[_0x7266('0x38')](_0x1de5b0[_0x7266('0x2d')],_0x3d2e7b['filters']),_0x40c97e);if(_0x1de5b0[_0x7266('0x2d')][_0x7266('0x39')]){_0x5cc96c[_0x7266('0x37')]=_['merge'](_0x5cc96c[_0x7266('0x37')],{'$or':_[_0x7266('0x2c')](_0x40c97e,function(_0x68de5){if(_0x68de5['type']!==_0x7266('0x3a')){var _0x1e40af={};_0x1e40af[_0x68de5['name']]={'$like':'%'+_0x1de5b0[_0x7266('0x2d')][_0x7266('0x39')]+'%'};return _0x1e40af;}})});}_0x5cc96c=_['merge']({},_0x5cc96c,_0x1de5b0[_0x7266('0x3b')]);var _0x3a8521={'where':_0x5cc96c['where']};return db[_0x7266('0x28')]['count'](_0x3a8521)[_0x7266('0x24')](function(_0x5d1760){_0x430f50[_0x7266('0x1d')]=_0x5d1760;if(_0x1de5b0[_0x7266('0x2d')][_0x7266('0x3c')]){_0x5cc96c[_0x7266('0x3d')]=[{'all':!![]}];}return db[_0x7266('0x28')][_0x7266('0x3e')](_0x5cc96c);})[_0x7266('0x24')](function(_0x54fbb7){_0x430f50[_0x7266('0x3f')]=_0x54fbb7;return _0x430f50;})[_0x7266('0x24')](respondWithFilteredResult(_0x1d7775,_0x5cc96c))[_0x7266('0x40')](handleError(_0x1d7775,null));};exports['show']=function(_0x2de29f,_0x52d71e){var _0x10289d={'raw':![],'where':{'id':_0x2de29f[_0x7266('0x41')]['id']}},_0x2aba03={};_0x2aba03[_0x7266('0x2b')]=_['keys'](db[_0x7266('0x28')][_0x7266('0x42')]);_0x2aba03['query']=_[_0x7266('0x2e')](_0x2de29f[_0x7266('0x2d')]);_0x2aba03[_0x7266('0x2f')]=_[_0x7266('0x30')](_0x2aba03[_0x7266('0x2b')],_0x2aba03['query']);_0x10289d[_0x7266('0x31')]=_[_0x7266('0x30')](_0x2aba03['model'],qs[_0x7266('0x32')](_0x2de29f[_0x7266('0x2d')][_0x7266('0x32')]));_0x10289d[_0x7266('0x31')]=_0x10289d[_0x7266('0x31')]['length']?_0x10289d['attributes']:_0x2aba03[_0x7266('0x2b')];if(_0x2de29f[_0x7266('0x2d')][_0x7266('0x3c')]){_0x10289d[_0x7266('0x3d')]=[{'all':!![]}];}_0x10289d=_['merge']({},_0x10289d,_0x2de29f[_0x7266('0x3b')]);return db['SugarcrmConfiguration'][_0x7266('0x43')](_0x10289d)[_0x7266('0x24')](handleEntityNotFound(_0x52d71e,null))['then'](respondWithResult(_0x52d71e,null))['catch'](handleError(_0x52d71e,null));};exports[_0x7266('0x44')]=function(_0x5aaf67,_0x3800ee){return db[_0x7266('0x28')][_0x7266('0x44')](_0x5aaf67[_0x7266('0x45')],{})[_0x7266('0x24')](respondWithResult(_0x3800ee,0xc9))[_0x7266('0x40')](handleError(_0x3800ee,null));};exports['update']=function(_0x4dafd3,_0x26b020){if(_0x4dafd3[_0x7266('0x45')]['id']){delete _0x4dafd3[_0x7266('0x45')]['id'];}return db[_0x7266('0x28')][_0x7266('0x43')]({'where':{'id':_0x4dafd3[_0x7266('0x41')]['id']}})['then'](handleEntityNotFound(_0x26b020,null))[_0x7266('0x24')](saveUpdates(_0x4dafd3[_0x7266('0x45')],null))[_0x7266('0x24')](respondWithResult(_0x26b020,null))[_0x7266('0x40')](handleError(_0x26b020,null));};exports['destroy']=function(_0x4c38e9,_0x380e79){return db[_0x7266('0x28')][_0x7266('0x43')]({'where':{'id':_0x4c38e9['params']['id']}})[_0x7266('0x24')](handleEntityNotFound(_0x380e79,null))['then'](removeEntity(_0x380e79,null))[_0x7266('0x40')](handleError(_0x380e79,null));};exports[_0x7266('0x46')]=function(_0x417df9,_0x4a0293,_0x3ac504){var _0x534a23={};var _0x570823={};var _0x4b6ac5;var _0x4a6172;return db[_0x7266('0x28')][_0x7266('0x47')]({'where':{'id':_0x417df9[_0x7266('0x41')]['id']}})[_0x7266('0x24')](handleEntityNotFound(_0x4a0293,null))[_0x7266('0x24')](function(_0xf408c6){if(_0xf408c6){_0x4b6ac5=_0xf408c6;_0x570823[_0x7266('0x2b')]=_[_0x7266('0x2e')](db['SugarcrmField'][_0x7266('0x42')]);_0x570823[_0x7266('0x2d')]=_[_0x7266('0x2e')](_0x417df9[_0x7266('0x2d')]);_0x570823['filters']=_[_0x7266('0x30')](_0x570823['model'],_0x570823[_0x7266('0x2d')]);_0x534a23[_0x7266('0x31')]=_[_0x7266('0x30')](_0x570823[_0x7266('0x2b')],qs[_0x7266('0x32')](_0x417df9[_0x7266('0x2d')][_0x7266('0x32')]));_0x534a23['attributes']=_0x534a23['attributes'][_0x7266('0x33')]?_0x534a23[_0x7266('0x31')]:_0x570823['model'];_0x534a23['order']=qs[_0x7266('0x36')](_0x417df9[_0x7266('0x2d')][_0x7266('0x36')]);_0x534a23[_0x7266('0x37')]=qs[_0x7266('0x2f')](_['pick'](_0x417df9[_0x7266('0x2d')],_0x570823[_0x7266('0x2f')]));if(_0x417df9[_0x7266('0x2d')][_0x7266('0x39')]){_0x534a23['where']=_[_0x7266('0x48')](_0x534a23[_0x7266('0x37')],{'$or':_[_0x7266('0x2c')](_0x534a23[_0x7266('0x31')],function(_0x156150){var _0x1da8c2={};_0x1da8c2[_0x156150]={'$like':'%'+_0x417df9['query'][_0x7266('0x39')]+'%'};return _0x1da8c2;})});}_0x534a23=_[_0x7266('0x48')]({},_0x534a23,_0x417df9[_0x7266('0x3b')]);return _0x4b6ac5[_0x7266('0x46')](_0x534a23);}})['then'](function(_0x311173){if(_0x311173){_0x4a6172=_0x311173['length'];if(!_0x417df9[_0x7266('0x2d')][_0x7266('0x49')](_0x7266('0x34'))){_0x534a23[_0x7266('0x1e')]=qs[_0x7266('0x1e')](_0x417df9['query']['limit']);_0x534a23[_0x7266('0x1b')]=qs[_0x7266('0x1b')](_0x417df9[_0x7266('0x2d')][_0x7266('0x1b')]);}return _0x4b6ac5[_0x7266('0x46')](_0x534a23);}})[_0x7266('0x24')](function(_0x389bd4){if(_0x389bd4){return _0x389bd4?{'count':_0x4a6172,'rows':_0x389bd4}:null;}})[_0x7266('0x24')](respondWithResult(_0x4a0293,null))[_0x7266('0x40')](handleError(_0x4a0293,null));};exports['getSubjects']=function(_0x19fa7b,_0x1bb013,_0x1681e8){var _0x151ccd={};var _0x3075ac={};var _0x44a95d;var _0x554b05;return db[_0x7266('0x28')][_0x7266('0x47')]({'where':{'id':_0x19fa7b[_0x7266('0x41')]['id']}})[_0x7266('0x24')](handleEntityNotFound(_0x1bb013,null))[_0x7266('0x24')](function(_0x1b96cf){if(_0x1b96cf){_0x44a95d=_0x1b96cf;_0x3075ac[_0x7266('0x2b')]=_['keys'](db[_0x7266('0x4a')][_0x7266('0x42')]);_0x3075ac['query']=_[_0x7266('0x2e')](_0x19fa7b[_0x7266('0x2d')]);_0x3075ac[_0x7266('0x2f')]=_[_0x7266('0x30')](_0x3075ac[_0x7266('0x2b')],_0x3075ac[_0x7266('0x2d')]);_0x151ccd[_0x7266('0x31')]=_[_0x7266('0x30')](_0x3075ac['model'],qs[_0x7266('0x32')](_0x19fa7b[_0x7266('0x2d')][_0x7266('0x32')]));_0x151ccd[_0x7266('0x31')]=_0x151ccd[_0x7266('0x31')][_0x7266('0x33')]?_0x151ccd['attributes']:_0x3075ac[_0x7266('0x2b')];_0x151ccd[_0x7266('0x35')]=qs[_0x7266('0x36')](_0x19fa7b[_0x7266('0x2d')][_0x7266('0x36')]);_0x151ccd[_0x7266('0x37')]=qs[_0x7266('0x2f')](_[_0x7266('0x38')](_0x19fa7b[_0x7266('0x2d')],_0x3075ac[_0x7266('0x2f')]));if(_0x19fa7b[_0x7266('0x2d')][_0x7266('0x39')]){_0x151ccd[_0x7266('0x37')]=_[_0x7266('0x48')](_0x151ccd['where'],{'$or':_[_0x7266('0x2c')](_0x151ccd[_0x7266('0x31')],function(_0x5edbd4){var _0x28dcc2={};_0x28dcc2[_0x5edbd4]={'$like':'%'+_0x19fa7b[_0x7266('0x2d')][_0x7266('0x39')]+'%'};return _0x28dcc2;})});}_0x151ccd=_[_0x7266('0x48')]({},_0x151ccd,_0x19fa7b[_0x7266('0x3b')]);return _0x44a95d[_0x7266('0x4b')](_0x151ccd);}})['then'](function(_0x1572fb){if(_0x1572fb){_0x554b05=_0x1572fb[_0x7266('0x33')];if(!_0x19fa7b[_0x7266('0x2d')][_0x7266('0x49')]('nolimit')){_0x151ccd['limit']=qs[_0x7266('0x1e')](_0x19fa7b[_0x7266('0x2d')][_0x7266('0x1e')]);_0x151ccd['offset']=qs[_0x7266('0x1b')](_0x19fa7b[_0x7266('0x2d')]['offset']);}return _0x44a95d[_0x7266('0x4b')](_0x151ccd);}})[_0x7266('0x24')](function(_0x3f6894){if(_0x3f6894){return _0x3f6894?{'count':_0x554b05,'rows':_0x3f6894}:null;}})['then'](respondWithResult(_0x1bb013,null))[_0x7266('0x40')](handleError(_0x1bb013,null));};exports[_0x7266('0x4c')]=function(_0xf93fdb,_0x4bbe26,_0x34505a){var _0x59d3a9={};var _0x24711d={};var _0xf14a7c;var _0x1a62a1;return db[_0x7266('0x28')][_0x7266('0x47')]({'where':{'id':_0xf93fdb[_0x7266('0x41')]['id']}})[_0x7266('0x24')](handleEntityNotFound(_0x4bbe26,null))[_0x7266('0x24')](function(_0x108f32){if(_0x108f32){_0xf14a7c=_0x108f32;_0x24711d[_0x7266('0x2b')]=_['keys'](db[_0x7266('0x4a')][_0x7266('0x42')]);_0x24711d['query']=_[_0x7266('0x2e')](_0xf93fdb[_0x7266('0x2d')]);_0x24711d['filters']=_[_0x7266('0x30')](_0x24711d[_0x7266('0x2b')],_0x24711d[_0x7266('0x2d')]);_0x59d3a9[_0x7266('0x31')]=_[_0x7266('0x30')](_0x24711d['model'],qs[_0x7266('0x32')](_0xf93fdb['query']['fields']));_0x59d3a9[_0x7266('0x31')]=_0x59d3a9[_0x7266('0x31')][_0x7266('0x33')]?_0x59d3a9['attributes']:_0x24711d[_0x7266('0x2b')];_0x59d3a9[_0x7266('0x35')]=qs['sort'](_0xf93fdb['query']['sort']);_0x59d3a9[_0x7266('0x37')]=qs[_0x7266('0x2f')](_[_0x7266('0x38')](_0xf93fdb[_0x7266('0x2d')],_0x24711d['filters']));if(_0xf93fdb[_0x7266('0x2d')][_0x7266('0x39')]){_0x59d3a9[_0x7266('0x37')]=_[_0x7266('0x48')](_0x59d3a9[_0x7266('0x37')],{'$or':_[_0x7266('0x2c')](_0x59d3a9['attributes'],function(_0x2e7b57){var _0x26aef5={};_0x26aef5[_0x2e7b57]={'$like':'%'+_0xf93fdb[_0x7266('0x2d')][_0x7266('0x39')]+'%'};return _0x26aef5;})});}_0x59d3a9=_[_0x7266('0x48')]({},_0x59d3a9,_0xf93fdb[_0x7266('0x3b')]);return _0xf14a7c[_0x7266('0x4c')](_0x59d3a9);}})[_0x7266('0x24')](function(_0x147ec5){if(_0x147ec5){_0x1a62a1=_0x147ec5[_0x7266('0x33')];if(!_0xf93fdb[_0x7266('0x2d')][_0x7266('0x49')]('nolimit')){_0x59d3a9[_0x7266('0x1e')]=qs['limit'](_0xf93fdb[_0x7266('0x2d')][_0x7266('0x1e')]);_0x59d3a9['offset']=qs[_0x7266('0x1b')](_0xf93fdb[_0x7266('0x2d')][_0x7266('0x1b')]);}return _0xf14a7c[_0x7266('0x4c')](_0x59d3a9);}})['then'](function(_0x5390ec){if(_0x5390ec){return _0x5390ec?{'count':_0x1a62a1,'rows':_0x5390ec}:null;}})[_0x7266('0x24')](respondWithResult(_0x4bbe26,null))[_0x7266('0x40')](handleError(_0x4bbe26,null));}; \ No newline at end of file +var _0x3941=['includeAll','options','find','create','body','catch','getFields','findOne','SugarcrmField','order','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','SugarcrmConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','VIRTUAL','merge','then','include','findAll','rows','show','params','keys','rawAttributes'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0x3941,0x110));var _0x1394=function(_0x58d3a9,_0x496a02){_0x58d3a9=_0x58d3a9-0x0;var _0x47e042=_0x3941[_0x58d3a9];return _0x47e042;};'use strict';var emlformat=require(_0x1394('0x0'));var rimraf=require(_0x1394('0x1'));var zipdir=require(_0x1394('0x2'));var jsonpatch=require(_0x1394('0x3'));var rp=require(_0x1394('0x4'));var moment=require(_0x1394('0x5'));var BPromise=require(_0x1394('0x6'));var Mustache=require(_0x1394('0x7'));var util=require(_0x1394('0x8'));var path=require('path');var sox=require(_0x1394('0x9'));var csv=require('to-csv');var ejs=require(_0x1394('0xa'));var fs=require('fs');var fs_extra=require(_0x1394('0xb'));var _=require('lodash');var squel=require(_0x1394('0xc'));var crypto=require(_0x1394('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1394('0xe'));var toCsv=require(_0x1394('0xf'));var querystring=require(_0x1394('0x10'));var Papa=require('papaparse');var Redis=require(_0x1394('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1394('0x12'));var as=require(_0x1394('0x13'));var hardwareService=require(_0x1394('0x14'));var logger=require(_0x1394('0x15'))(_0x1394('0x16'));var utils=require(_0x1394('0x17'));var config=require(_0x1394('0x18'));var licenseUtil=require(_0x1394('0x19'));var db=require(_0x1394('0x1a'))['db'];function respondWithStatusCode(_0x53205c,_0x17eb8c){_0x17eb8c=_0x17eb8c||0xcc;return function(_0xb8c48e){if(_0xb8c48e){return _0x53205c[_0x1394('0x1b')](_0x17eb8c);}return _0x53205c[_0x1394('0x1c')](_0x17eb8c)[_0x1394('0x1d')]();};}function respondWithResult(_0x2ac198,_0x1b4f3b){_0x1b4f3b=_0x1b4f3b||0xc8;return function(_0x128f68){if(_0x128f68){return _0x2ac198[_0x1394('0x1c')](_0x1b4f3b)[_0x1394('0x1e')](_0x128f68);}};}function respondWithFilteredResult(_0x4faad7,_0x8b1be6){return function(_0x31e7b1){if(_0x31e7b1){var _0x53324e=typeof _0x8b1be6['offset']===_0x1394('0x1f')&&typeof _0x8b1be6['limit']==='undefined';var _0x303b00=_0x31e7b1[_0x1394('0x20')];var _0x7c3e3d=_0x53324e?0x0:_0x8b1be6[_0x1394('0x21')];var _0x56c840=_0x53324e?_0x31e7b1[_0x1394('0x20')]:_0x8b1be6[_0x1394('0x21')]+_0x8b1be6[_0x1394('0x22')];var _0x2fad43;if(_0x56c840>=_0x303b00){_0x56c840=_0x303b00;_0x2fad43=0xc8;}else{_0x2fad43=0xce;}_0x4faad7[_0x1394('0x1c')](_0x2fad43);return _0x4faad7[_0x1394('0x23')](_0x1394('0x24'),_0x7c3e3d+'-'+_0x56c840+'/'+_0x303b00)[_0x1394('0x1e')](_0x31e7b1);}return null;};}function patchUpdates(_0x58512d){return function(_0x461825){try{jsonpatch[_0x1394('0x25')](_0x461825,_0x58512d,!![]);}catch(_0x2cc26d){return BPromise[_0x1394('0x26')](_0x2cc26d);}return _0x461825[_0x1394('0x27')]();};}function saveUpdates(_0x613208,_0x2af789){return function(_0x55e625){if(_0x55e625){return _0x55e625[_0x1394('0x28')](_0x613208)['then'](function(_0x52f7c0){return _0x52f7c0;});}return null;};}function removeEntity(_0x430468,_0xab0645){return function(_0x27a630){if(_0x27a630){return _0x27a630[_0x1394('0x29')]()['then'](function(){_0x430468['status'](0xcc)[_0x1394('0x1d')]();});}};}function handleEntityNotFound(_0x50a245,_0x2a168a){return function(_0xaad2a9){if(!_0xaad2a9){_0x50a245[_0x1394('0x1b')](0x194);}return _0xaad2a9;};}function handleError(_0x472716,_0xd35e0b){_0xd35e0b=_0xd35e0b||0x1f4;return function(_0x2a6079){logger[_0x1394('0x2a')](_0x2a6079[_0x1394('0x2b')]);if(_0x2a6079[_0x1394('0x2c')]){delete _0x2a6079[_0x1394('0x2c')];}_0x472716[_0x1394('0x1c')](_0xd35e0b)[_0x1394('0x2d')](_0x2a6079);};}exports['index']=function(_0x274766,_0xd5efa1){var _0x50f001={},_0x1dcbc4={},_0x3fe37f={'count':0x0,'rows':[]};var _0x14bb2d=_[_0x1394('0x2e')](db[_0x1394('0x2f')]['rawAttributes'],function(_0x45403b){return{'name':_0x45403b[_0x1394('0x30')],'type':_0x45403b[_0x1394('0x31')][_0x1394('0x32')]};});_0x1dcbc4[_0x1394('0x33')]=_['map'](_0x14bb2d,_0x1394('0x2c'));_0x1dcbc4[_0x1394('0x34')]=_['keys'](_0x274766[_0x1394('0x34')]);_0x1dcbc4[_0x1394('0x35')]=_[_0x1394('0x36')](_0x1dcbc4[_0x1394('0x33')],_0x1dcbc4['query']);_0x50f001[_0x1394('0x37')]=_['intersection'](_0x1dcbc4[_0x1394('0x33')],qs[_0x1394('0x38')](_0x274766['query'][_0x1394('0x38')]));_0x50f001[_0x1394('0x37')]=_0x50f001[_0x1394('0x37')][_0x1394('0x39')]?_0x50f001[_0x1394('0x37')]:_0x1dcbc4['model'];if(!_0x274766[_0x1394('0x34')]['hasOwnProperty'](_0x1394('0x3a'))){_0x50f001[_0x1394('0x22')]=qs['limit'](_0x274766['query'][_0x1394('0x22')]);_0x50f001[_0x1394('0x21')]=qs[_0x1394('0x21')](_0x274766[_0x1394('0x34')][_0x1394('0x21')]);}_0x50f001['order']=qs[_0x1394('0x3b')](_0x274766[_0x1394('0x34')]['sort']);_0x50f001['where']=qs['filters'](_['pick'](_0x274766[_0x1394('0x34')],_0x1dcbc4[_0x1394('0x35')]),_0x14bb2d);if(_0x274766['query'][_0x1394('0x3c')]){_0x50f001[_0x1394('0x3d')]=_['merge'](_0x50f001[_0x1394('0x3d')],{'$or':_['map'](_0x14bb2d,function(_0x523415){if(_0x523415[_0x1394('0x31')]!==_0x1394('0x3e')){var _0x44fb81={};_0x44fb81[_0x523415[_0x1394('0x2c')]]={'$like':'%'+_0x274766[_0x1394('0x34')][_0x1394('0x3c')]+'%'};return _0x44fb81;}})});}_0x50f001=_[_0x1394('0x3f')]({},_0x50f001,_0x274766['options']);var _0x256e84={'where':_0x50f001['where']};return db[_0x1394('0x2f')]['count'](_0x256e84)[_0x1394('0x40')](function(_0x4ee711){_0x3fe37f[_0x1394('0x20')]=_0x4ee711;if(_0x274766[_0x1394('0x34')]['includeAll']){_0x50f001[_0x1394('0x41')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x1394('0x42')](_0x50f001);})['then'](function(_0x1d8a22){_0x3fe37f[_0x1394('0x43')]=_0x1d8a22;return _0x3fe37f;})[_0x1394('0x40')](respondWithFilteredResult(_0xd5efa1,_0x50f001))['catch'](handleError(_0xd5efa1,null));};exports[_0x1394('0x44')]=function(_0x20094d,_0x58476a){var _0x7d04a={'raw':![],'where':{'id':_0x20094d[_0x1394('0x45')]['id']}},_0x412c45={};_0x412c45[_0x1394('0x33')]=_[_0x1394('0x46')](db[_0x1394('0x2f')][_0x1394('0x47')]);_0x412c45[_0x1394('0x34')]=_[_0x1394('0x46')](_0x20094d['query']);_0x412c45[_0x1394('0x35')]=_['intersection'](_0x412c45[_0x1394('0x33')],_0x412c45[_0x1394('0x34')]);_0x7d04a['attributes']=_[_0x1394('0x36')](_0x412c45[_0x1394('0x33')],qs[_0x1394('0x38')](_0x20094d[_0x1394('0x34')][_0x1394('0x38')]));_0x7d04a[_0x1394('0x37')]=_0x7d04a[_0x1394('0x37')][_0x1394('0x39')]?_0x7d04a[_0x1394('0x37')]:_0x412c45[_0x1394('0x33')];if(_0x20094d[_0x1394('0x34')][_0x1394('0x48')]){_0x7d04a[_0x1394('0x41')]=[{'all':!![]}];}_0x7d04a=_['merge']({},_0x7d04a,_0x20094d[_0x1394('0x49')]);return db[_0x1394('0x2f')][_0x1394('0x4a')](_0x7d04a)[_0x1394('0x40')](handleEntityNotFound(_0x58476a,null))[_0x1394('0x40')](respondWithResult(_0x58476a,null))['catch'](handleError(_0x58476a,null));};exports[_0x1394('0x4b')]=function(_0x20a41d,_0x16acf5){return db['SugarcrmConfiguration'][_0x1394('0x4b')](_0x20a41d[_0x1394('0x4c')],{})[_0x1394('0x40')](respondWithResult(_0x16acf5,0xc9))[_0x1394('0x4d')](handleError(_0x16acf5,null));};exports[_0x1394('0x28')]=function(_0x1ae209,_0x5971db){if(_0x1ae209[_0x1394('0x4c')]['id']){delete _0x1ae209['body']['id'];}return db[_0x1394('0x2f')]['find']({'where':{'id':_0x1ae209[_0x1394('0x45')]['id']}})[_0x1394('0x40')](handleEntityNotFound(_0x5971db,null))['then'](saveUpdates(_0x1ae209[_0x1394('0x4c')],null))['then'](respondWithResult(_0x5971db,null))[_0x1394('0x4d')](handleError(_0x5971db,null));};exports[_0x1394('0x29')]=function(_0x3ad02d,_0x10b491){return db[_0x1394('0x2f')][_0x1394('0x4a')]({'where':{'id':_0x3ad02d['params']['id']}})['then'](handleEntityNotFound(_0x10b491,null))[_0x1394('0x40')](removeEntity(_0x10b491,null))['catch'](handleError(_0x10b491,null));};exports[_0x1394('0x4e')]=function(_0x22e568,_0x16f75c,_0x5e08b5){var _0xce27b={};var _0x48c41d={};var _0x3a980d;var _0x1bb662;return db['SugarcrmConfiguration'][_0x1394('0x4f')]({'where':{'id':_0x22e568[_0x1394('0x45')]['id']}})[_0x1394('0x40')](handleEntityNotFound(_0x16f75c,null))[_0x1394('0x40')](function(_0xfd8b0){if(_0xfd8b0){_0x3a980d=_0xfd8b0;_0x48c41d[_0x1394('0x33')]=_[_0x1394('0x46')](db[_0x1394('0x50')][_0x1394('0x47')]);_0x48c41d[_0x1394('0x34')]=_['keys'](_0x22e568['query']);_0x48c41d[_0x1394('0x35')]=_[_0x1394('0x36')](_0x48c41d[_0x1394('0x33')],_0x48c41d[_0x1394('0x34')]);_0xce27b[_0x1394('0x37')]=_['intersection'](_0x48c41d[_0x1394('0x33')],qs[_0x1394('0x38')](_0x22e568[_0x1394('0x34')]['fields']));_0xce27b[_0x1394('0x37')]=_0xce27b[_0x1394('0x37')]['length']?_0xce27b[_0x1394('0x37')]:_0x48c41d[_0x1394('0x33')];_0xce27b[_0x1394('0x51')]=qs['sort'](_0x22e568[_0x1394('0x34')]['sort']);_0xce27b[_0x1394('0x3d')]=qs[_0x1394('0x35')](_[_0x1394('0x52')](_0x22e568[_0x1394('0x34')],_0x48c41d[_0x1394('0x35')]));if(_0x22e568[_0x1394('0x34')][_0x1394('0x3c')]){_0xce27b[_0x1394('0x3d')]=_[_0x1394('0x3f')](_0xce27b['where'],{'$or':_[_0x1394('0x2e')](_0xce27b['attributes'],function(_0x46a43e){var _0x5a3d56={};_0x5a3d56[_0x46a43e]={'$like':'%'+_0x22e568[_0x1394('0x34')][_0x1394('0x3c')]+'%'};return _0x5a3d56;})});}_0xce27b=_[_0x1394('0x3f')]({},_0xce27b,_0x22e568[_0x1394('0x49')]);return _0x3a980d[_0x1394('0x4e')](_0xce27b);}})[_0x1394('0x40')](function(_0x26bcd7){if(_0x26bcd7){_0x1bb662=_0x26bcd7[_0x1394('0x39')];if(!_0x22e568[_0x1394('0x34')][_0x1394('0x53')](_0x1394('0x3a'))){_0xce27b[_0x1394('0x22')]=qs[_0x1394('0x22')](_0x22e568[_0x1394('0x34')][_0x1394('0x22')]);_0xce27b['offset']=qs[_0x1394('0x21')](_0x22e568[_0x1394('0x34')][_0x1394('0x21')]);}return _0x3a980d['getFields'](_0xce27b);}})[_0x1394('0x40')](function(_0x430146){if(_0x430146){return _0x430146?{'count':_0x1bb662,'rows':_0x430146}:null;}})[_0x1394('0x40')](respondWithResult(_0x16f75c,null))[_0x1394('0x4d')](handleError(_0x16f75c,null));};exports[_0x1394('0x54')]=function(_0xe1a0d6,_0x45843a,_0x4a370b){var _0x274d92={};var _0x159e4c={};var _0x2ca828;var _0x17649a;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0xe1a0d6[_0x1394('0x45')]['id']}})[_0x1394('0x40')](handleEntityNotFound(_0x45843a,null))[_0x1394('0x40')](function(_0x541824){if(_0x541824){_0x2ca828=_0x541824;_0x159e4c[_0x1394('0x33')]=_['keys'](db[_0x1394('0x50')]['rawAttributes']);_0x159e4c[_0x1394('0x34')]=_[_0x1394('0x46')](_0xe1a0d6[_0x1394('0x34')]);_0x159e4c['filters']=_[_0x1394('0x36')](_0x159e4c[_0x1394('0x33')],_0x159e4c[_0x1394('0x34')]);_0x274d92[_0x1394('0x37')]=_['intersection'](_0x159e4c[_0x1394('0x33')],qs[_0x1394('0x38')](_0xe1a0d6[_0x1394('0x34')][_0x1394('0x38')]));_0x274d92[_0x1394('0x37')]=_0x274d92[_0x1394('0x37')][_0x1394('0x39')]?_0x274d92[_0x1394('0x37')]:_0x159e4c['model'];_0x274d92[_0x1394('0x51')]=qs[_0x1394('0x3b')](_0xe1a0d6[_0x1394('0x34')][_0x1394('0x3b')]);_0x274d92[_0x1394('0x3d')]=qs['filters'](_['pick'](_0xe1a0d6[_0x1394('0x34')],_0x159e4c[_0x1394('0x35')]));if(_0xe1a0d6['query'][_0x1394('0x3c')]){_0x274d92['where']=_[_0x1394('0x3f')](_0x274d92[_0x1394('0x3d')],{'$or':_[_0x1394('0x2e')](_0x274d92['attributes'],function(_0x344771){var _0x1392d9={};_0x1392d9[_0x344771]={'$like':'%'+_0xe1a0d6[_0x1394('0x34')][_0x1394('0x3c')]+'%'};return _0x1392d9;})});}_0x274d92=_[_0x1394('0x3f')]({},_0x274d92,_0xe1a0d6[_0x1394('0x49')]);return _0x2ca828[_0x1394('0x54')](_0x274d92);}})['then'](function(_0x19501a){if(_0x19501a){_0x17649a=_0x19501a[_0x1394('0x39')];if(!_0xe1a0d6[_0x1394('0x34')][_0x1394('0x53')](_0x1394('0x3a'))){_0x274d92['limit']=qs['limit'](_0xe1a0d6[_0x1394('0x34')]['limit']);_0x274d92['offset']=qs[_0x1394('0x21')](_0xe1a0d6[_0x1394('0x34')][_0x1394('0x21')]);}return _0x2ca828[_0x1394('0x54')](_0x274d92);}})[_0x1394('0x40')](function(_0x36d079){if(_0x36d079){return _0x36d079?{'count':_0x17649a,'rows':_0x36d079}:null;}})[_0x1394('0x40')](respondWithResult(_0x45843a,null))[_0x1394('0x4d')](handleError(_0x45843a,null));};exports['getDescriptions']=function(_0x5bae4d,_0x572b95,_0x2ed622){var _0x744e7e={};var _0x57a487={};var _0x2c615a;var _0x579ae4;return db[_0x1394('0x2f')]['findOne']({'where':{'id':_0x5bae4d[_0x1394('0x45')]['id']}})[_0x1394('0x40')](handleEntityNotFound(_0x572b95,null))[_0x1394('0x40')](function(_0x5c8392){if(_0x5c8392){_0x2c615a=_0x5c8392;_0x57a487[_0x1394('0x33')]=_[_0x1394('0x46')](db[_0x1394('0x50')][_0x1394('0x47')]);_0x57a487[_0x1394('0x34')]=_[_0x1394('0x46')](_0x5bae4d[_0x1394('0x34')]);_0x57a487[_0x1394('0x35')]=_[_0x1394('0x36')](_0x57a487['model'],_0x57a487[_0x1394('0x34')]);_0x744e7e[_0x1394('0x37')]=_[_0x1394('0x36')](_0x57a487[_0x1394('0x33')],qs[_0x1394('0x38')](_0x5bae4d['query'][_0x1394('0x38')]));_0x744e7e['attributes']=_0x744e7e[_0x1394('0x37')][_0x1394('0x39')]?_0x744e7e[_0x1394('0x37')]:_0x57a487['model'];_0x744e7e[_0x1394('0x51')]=qs['sort'](_0x5bae4d[_0x1394('0x34')]['sort']);_0x744e7e[_0x1394('0x3d')]=qs[_0x1394('0x35')](_[_0x1394('0x52')](_0x5bae4d[_0x1394('0x34')],_0x57a487['filters']));if(_0x5bae4d[_0x1394('0x34')][_0x1394('0x3c')]){_0x744e7e['where']=_[_0x1394('0x3f')](_0x744e7e['where'],{'$or':_[_0x1394('0x2e')](_0x744e7e[_0x1394('0x37')],function(_0x383698){var _0x5e4048={};_0x5e4048[_0x383698]={'$like':'%'+_0x5bae4d[_0x1394('0x34')][_0x1394('0x3c')]+'%'};return _0x5e4048;})});}_0x744e7e=_[_0x1394('0x3f')]({},_0x744e7e,_0x5bae4d[_0x1394('0x49')]);return _0x2c615a[_0x1394('0x55')](_0x744e7e);}})[_0x1394('0x40')](function(_0x3b7be6){if(_0x3b7be6){_0x579ae4=_0x3b7be6[_0x1394('0x39')];if(!_0x5bae4d[_0x1394('0x34')][_0x1394('0x53')]('nolimit')){_0x744e7e[_0x1394('0x22')]=qs[_0x1394('0x22')](_0x5bae4d[_0x1394('0x34')][_0x1394('0x22')]);_0x744e7e[_0x1394('0x21')]=qs[_0x1394('0x21')](_0x5bae4d[_0x1394('0x34')]['offset']);}return _0x2c615a[_0x1394('0x55')](_0x744e7e);}})[_0x1394('0x40')](function(_0x20aed5){if(_0x20aed5){return _0x20aed5?{'count':_0x579ae4,'rows':_0x20aed5}:null;}})[_0x1394('0x40')](respondWithResult(_0x572b95,null))['catch'](handleError(_0x572b95,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ced89f1..36baa20 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 _0xbf95=['api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0xbf95,0x1d1));var _0x5bf9=function(_0xa0bf95,_0x397aad){_0xa0bf95=_0xa0bf95-0x0;var _0x43b49b=_0xbf95[_0xa0bf95];return _0x43b49b;};'use strict';var _=require(_0x5bf9('0x0'));var util=require(_0x5bf9('0x1'));var logger=require(_0x5bf9('0x2'))(_0x5bf9('0x3'));var moment=require(_0x5bf9('0x4'));var BPromise=require(_0x5bf9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bf9('0x6'));var rimraf=require(_0x5bf9('0x7'));var config=require(_0x5bf9('0x8'));var attributes=require(_0x5bf9('0x9'));module[_0x5bf9('0xa')]=function(_0x5bf73c,_0x1ccdec){return _0x5bf73c['define']('SugarcrmConfiguration',attributes,{'tableName':_0x5bf9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ecf=['../../config/logger','bluebird','request-promise','path','rimraf','define','SugarcrmConfiguration','int_sugarcrm_configurations','util'];(function(_0x144a98,_0x525ad9){var _0x4a1b6f=function(_0x22b17b){while(--_0x22b17b){_0x144a98['push'](_0x144a98['shift']());}};_0x4a1b6f(++_0x525ad9);}(_0x3ecf,0x86));var _0xf3ec=function(_0x6be7ff,_0x684488){_0x6be7ff=_0x6be7ff-0x0;var _0x143fe7=_0x3ecf[_0x6be7ff];return _0x143fe7;};'use strict';var _=require('lodash');var util=require(_0xf3ec('0x0'));var logger=require(_0xf3ec('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf3ec('0x2'));var rp=require(_0xf3ec('0x3'));var fs=require('fs');var path=require(_0xf3ec('0x4'));var rimraf=require(_0xf3ec('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x5c1928,_0x50d09d){return _0x5c1928[_0xf3ec('0x6')](_0xf3ec('0x7'),attributes,{'tableName':_0xf3ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 51cb4cd..2b147a5 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 _0x0825=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4cc8a4,_0x269151){var _0x52d437=function(_0x52dfbc){while(--_0x52dfbc){_0x4cc8a4['push'](_0x4cc8a4['shift']());}};_0x52d437(++_0x269151);}(_0x0825,0xa0));var _0x5082=function(_0x1c2522,_0x520d4b){_0x1c2522=_0x1c2522-0x0;var _0x1aa98b=_0x0825[_0x1c2522];return _0x1aa98b;};'use strict';var _=require(_0x5082('0x0'));var util=require(_0x5082('0x1'));var moment=require(_0x5082('0x2'));var BPromise=require(_0x5082('0x3'));var rs=require(_0x5082('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5082('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5082('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5082('0x7')][_0x5082('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e76a1,_0x3cf2ed,_0x47e2b4){return new BPromise(function(_0x53ee9f,_0x4aaea9){return client[_0x5082('0x9')](_0x2e76a1,_0x47e2b4)[_0x5082('0xa')](function(_0x11dd6f){logger[_0x5082('0xb')](_0x5082('0xc'),_0x3cf2ed,_0x5082('0xd'));logger[_0x5082('0xe')](_0x5082('0xf'),_0x3cf2ed,_0x5082('0xd'),JSON[_0x5082('0x10')](_0x11dd6f));if(_0x11dd6f[_0x5082('0x11')]){if(_0x11dd6f[_0x5082('0x11')]['code']===0x1f4){logger[_0x5082('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3cf2ed,_0x11dd6f[_0x5082('0x11')][_0x5082('0x12')]);return _0x4aaea9(_0x11dd6f[_0x5082('0x11')]['message']);}logger[_0x5082('0x11')](_0x5082('0xc'),_0x3cf2ed,_0x11dd6f[_0x5082('0x11')][_0x5082('0x12')]);return _0x53ee9f(_0x11dd6f[_0x5082('0x11')]['message']);}else{logger[_0x5082('0xb')](_0x5082('0xc'),_0x3cf2ed,_0x5082('0xd'));_0x53ee9f(_0x11dd6f['result'][_0x5082('0x12')]);}})[_0x5082('0x13')](function(_0x4db879){logger[_0x5082('0x11')](_0x5082('0xc'),_0x3cf2ed,_0x4db879);_0x4aaea9(_0x4db879);});});} \ No newline at end of file +var _0x8fe7=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x8fe7,0x10f));var _0x78fe=function(_0x4b4305,_0xdf579d){_0x4b4305=_0x4b4305-0x0;var _0x2646ad=_0x8fe7[_0x4b4305];return _0x2646ad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78fe('0x0'));var BPromise=require('bluebird');var rs=require(_0x78fe('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78fe('0x2'))['db'];var utils=require(_0x78fe('0x3'));var logger=require(_0x78fe('0x4'))(_0x78fe('0x5'));var config=require(_0x78fe('0x6'));var jayson=require(_0x78fe('0x7'));var client=jayson[_0x78fe('0x8')][_0x78fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43301b,_0xe229f,_0xf64237){return new BPromise(function(_0x6dc4a2,_0x18c6b5){return client[_0x78fe('0xa')](_0x43301b,_0xf64237)[_0x78fe('0xb')](function(_0x2151bb){logger[_0x78fe('0xc')](_0x78fe('0xd'),_0xe229f,_0x78fe('0xe'));logger[_0x78fe('0xf')](_0x78fe('0x10'),_0xe229f,_0x78fe('0xe'),JSON[_0x78fe('0x11')](_0x2151bb));if(_0x2151bb['error']){if(_0x2151bb[_0x78fe('0x12')]['code']===0x1f4){logger[_0x78fe('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xe229f,_0x2151bb[_0x78fe('0x12')][_0x78fe('0x13')]);return _0x18c6b5(_0x2151bb[_0x78fe('0x12')][_0x78fe('0x13')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0xe229f,_0x2151bb[_0x78fe('0x12')][_0x78fe('0x13')]);return _0x6dc4a2(_0x2151bb[_0x78fe('0x12')][_0x78fe('0x13')]);}else{logger['info'](_0x78fe('0xd'),_0xe229f,_0x78fe('0xe'));_0x6dc4a2(_0x2151bb[_0x78fe('0x14')][_0x78fe('0x13')]);}})[_0x78fe('0x15')](function(_0x16280e){logger['error'](_0x78fe('0xd'),_0xe229f,_0x16280e);_0x18c6b5(_0x16280e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 6ba36c8..0435bc3 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 _0x99a4=['../../components/auth/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express'];(function(_0x81e00e,_0x171cd3){var _0x16f7b9=function(_0x22b644){while(--_0x22b644){_0x81e00e['push'](_0x81e00e['shift']());}};_0x16f7b9(++_0x171cd3);}(_0x99a4,0x184));var _0x499a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x99a4[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0x499a('0x0'));var util=require(_0x499a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x499a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x499a('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x499a('0x4'));router[_0x499a('0x5')]('/',auth[_0x499a('0x6')](),controller[_0x499a('0x7')]);router[_0x499a('0x5')](_0x499a('0x8'),auth[_0x499a('0x6')](),controller[_0x499a('0x9')]);router[_0x499a('0xa')]('/',auth[_0x499a('0x6')](),controller[_0x499a('0xb')]);router[_0x499a('0xc')]('/:id',auth[_0x499a('0x6')](),controller[_0x499a('0xd')]);router[_0x499a('0xe')](_0x499a('0x8'),auth[_0x499a('0x6')](),controller[_0x499a('0xf')]);module[_0x499a('0x10')]=router; \ No newline at end of file +var _0xbe1d=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbe1d,0x195));var _0xdbe1=function(_0x3d5e72,_0x3ab167){_0x3d5e72=_0x3d5e72-0x0;var _0x2230e4=_0xbe1d[_0x3d5e72];return _0x2230e4;};'use strict';var multer=require(_0xdbe1('0x0'));var util=require(_0xdbe1('0x1'));var path=require(_0xdbe1('0x2'));var timeout=require(_0xdbe1('0x3'));var express=require(_0xdbe1('0x4'));var router=express[_0xdbe1('0x5')]();var fs_extra=require(_0xdbe1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdbe1('0x7'));var config=require(_0xdbe1('0x8'));var controller=require(_0xdbe1('0x9'));router['get']('/',auth[_0xdbe1('0xa')](),controller[_0xdbe1('0xb')]);router[_0xdbe1('0xc')]('/:id',auth[_0xdbe1('0xa')](),controller[_0xdbe1('0xd')]);router[_0xdbe1('0xe')]('/',auth['isAuthenticated'](),controller[_0xdbe1('0xf')]);router[_0xdbe1('0x10')](_0xdbe1('0x11'),auth[_0xdbe1('0xa')](),controller[_0xdbe1('0x12')]);router[_0xdbe1('0x13')]('/:id',auth[_0xdbe1('0xa')](),controller[_0xdbe1('0x14')]);module[_0xdbe1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1761828..079a2de 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 _0x569a=['string','variable','keyValue','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x1d4682,_0x5682ca){var _0x27e917=function(_0x3f850e){while(--_0x3f850e){_0x1d4682['push'](_0x1d4682['shift']());}};_0x27e917(++_0x5682ca);}(_0x569a,0x155));var _0xa569=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x569a[_0xdd0313];return _0x2bd7e8;};'use strict';var Sequelize=require(_0xa569('0x0'));module[_0xa569('0x1')]={'type':{'type':Sequelize[_0xa569('0x2')](_0xa569('0x3'),_0xa569('0x4'),'customVariable',_0xa569('0x5'),'picklist'),'defaultValue':_0xa569('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa569('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa569('0x3'),_0xa569('0x4'),_0xa569('0x7'))},'keyContent':{'type':Sequelize[_0xa569('0x6')]},'idField':{'type':Sequelize[_0xa569('0x6')]},'nameField':{'type':Sequelize[_0xa569('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa569('0x6')]}}; \ No newline at end of file +var _0x66da=['exports','ENUM','string','keyValue','STRING','variable','BOOLEAN','sequelize'];(function(_0x3728ca,_0x5eb80e){var _0x8deda7=function(_0x36bace){while(--_0x36bace){_0x3728ca['push'](_0x3728ca['shift']());}};_0x8deda7(++_0x5eb80e);}(_0x66da,0x107));var _0xa66d=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x66da[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xa66d('0x0'));module[_0xa66d('0x1')]={'type':{'type':Sequelize[_0xa66d('0x2')](_0xa66d('0x3'),'variable','customVariable',_0xa66d('0x4'),'picklist'),'defaultValue':_0xa66d('0x3')},'content':{'type':Sequelize[_0xa66d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa66d('0x3'),_0xa66d('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa66d('0x5')]},'nameField':{'type':Sequelize[_0xa66d('0x5')]},'customField':{'type':Sequelize[_0xa66d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa66d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 40042e6..14b2ec9 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 _0x119e=['intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','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','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','name','index','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x21a147,_0x49c5a6){var _0x49c650=function(_0x570aad){while(--_0x570aad){_0x21a147['push'](_0x21a147['shift']());}};_0x49c650(++_0x49c5a6);}(_0x119e,0x1cd));var _0xe119=function(_0x495dec,_0x2fb446){_0x495dec=_0x495dec-0x0;var _0x6b2465=_0x119e[_0x495dec];return _0x6b2465;};'use strict';var emlformat=require(_0xe119('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe119('0x1'));var rp=require(_0xe119('0x2'));var moment=require(_0xe119('0x3'));var BPromise=require(_0xe119('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe119('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe119('0x6'));var fs=require('fs');var fs_extra=require(_0xe119('0x7'));var _=require('lodash');var squel=require(_0xe119('0x8'));var crypto=require(_0xe119('0x9'));var jsforce=require(_0xe119('0xa'));var deskjs=require(_0xe119('0xb'));var toCsv=require(_0xe119('0xc'));var querystring=require(_0xe119('0xd'));var Papa=require(_0xe119('0xe'));var Redis=require('ioredis');var authService=require(_0xe119('0xf'));var qs=require(_0xe119('0x10'));var as=require(_0xe119('0x11'));var hardwareService=require(_0xe119('0x12'));var logger=require(_0xe119('0x13'))('api');var utils=require(_0xe119('0x14'));var config=require(_0xe119('0x15'));var licenseUtil=require(_0xe119('0x16'));var db=require(_0xe119('0x17'))['db'];function respondWithStatusCode(_0x5f5208,_0x21df81){_0x21df81=_0x21df81||0xcc;return function(_0x1a1d4d){if(_0x1a1d4d){return _0x5f5208['sendStatus'](_0x21df81);}return _0x5f5208[_0xe119('0x18')](_0x21df81)[_0xe119('0x19')]();};}function respondWithResult(_0x1e9db8,_0x22694e){_0x22694e=_0x22694e||0xc8;return function(_0xe463fb){if(_0xe463fb){return _0x1e9db8[_0xe119('0x18')](_0x22694e)[_0xe119('0x1a')](_0xe463fb);}};}function respondWithFilteredResult(_0x3d956c,_0x2c4c1b){return function(_0x108621){if(_0x108621){var _0x51120e=typeof _0x2c4c1b[_0xe119('0x1b')]===_0xe119('0x1c')&&typeof _0x2c4c1b[_0xe119('0x1d')]===_0xe119('0x1c');var _0x242e88=_0x108621[_0xe119('0x1e')];var _0x37c273=_0x51120e?0x0:_0x2c4c1b[_0xe119('0x1b')];var _0x557504=_0x51120e?_0x108621['count']:_0x2c4c1b[_0xe119('0x1b')]+_0x2c4c1b[_0xe119('0x1d')];var _0x581752;if(_0x557504>=_0x242e88){_0x557504=_0x242e88;_0x581752=0xc8;}else{_0x581752=0xce;}_0x3d956c[_0xe119('0x18')](_0x581752);return _0x3d956c[_0xe119('0x1f')](_0xe119('0x20'),_0x37c273+'-'+_0x557504+'/'+_0x242e88)[_0xe119('0x1a')](_0x108621);}return null;};}function patchUpdates(_0x2dffb9){return function(_0x33f14f){try{jsonpatch['apply'](_0x33f14f,_0x2dffb9,!![]);}catch(_0x4310d0){return BPromise[_0xe119('0x21')](_0x4310d0);}return _0x33f14f[_0xe119('0x22')]();};}function saveUpdates(_0x512839,_0x1cf293){return function(_0x130a64){if(_0x130a64){return _0x130a64[_0xe119('0x23')](_0x512839)['then'](function(_0x2a27f9){return _0x2a27f9;});}return null;};}function removeEntity(_0x55468c,_0x22a1d0){return function(_0x2d7988){if(_0x2d7988){return _0x2d7988[_0xe119('0x24')]()[_0xe119('0x25')](function(){_0x55468c['status'](0xcc)[_0xe119('0x19')]();});}};}function handleEntityNotFound(_0x2fb55b,_0x382949){return function(_0x350504){if(!_0x350504){_0x2fb55b[_0xe119('0x26')](0x194);}return _0x350504;};}function handleError(_0x2c11e7,_0x1209bf){_0x1209bf=_0x1209bf||0x1f4;return function(_0x5eef14){logger[_0xe119('0x27')](_0x5eef14['stack']);if(_0x5eef14[_0xe119('0x28')]){delete _0x5eef14['name'];}_0x2c11e7[_0xe119('0x18')](_0x1209bf)['send'](_0x5eef14);};}exports[_0xe119('0x29')]=function(_0x4f7a5a,_0x3557da){var _0x10e792={},_0x57310b={},_0x5d52ec={'count':0x0,'rows':[]};var _0x328fe1=_['map'](db[_0xe119('0x2a')][_0xe119('0x2b')],function(_0x5c6842){return{'name':_0x5c6842[_0xe119('0x2c')],'type':_0x5c6842[_0xe119('0x2d')]['key']};});_0x57310b[_0xe119('0x2e')]=_['map'](_0x328fe1,_0xe119('0x28'));_0x57310b[_0xe119('0x2f')]=_[_0xe119('0x30')](_0x4f7a5a['query']);_0x57310b[_0xe119('0x31')]=_[_0xe119('0x32')](_0x57310b[_0xe119('0x2e')],_0x57310b[_0xe119('0x2f')]);_0x10e792['attributes']=_['intersection'](_0x57310b['model'],qs[_0xe119('0x33')](_0x4f7a5a['query'][_0xe119('0x33')]));_0x10e792[_0xe119('0x34')]=_0x10e792['attributes'][_0xe119('0x35')]?_0x10e792['attributes']:_0x57310b[_0xe119('0x2e')];if(!_0x4f7a5a[_0xe119('0x2f')]['hasOwnProperty'](_0xe119('0x36'))){_0x10e792[_0xe119('0x1d')]=qs[_0xe119('0x1d')](_0x4f7a5a[_0xe119('0x2f')][_0xe119('0x1d')]);_0x10e792[_0xe119('0x1b')]=qs['offset'](_0x4f7a5a[_0xe119('0x2f')][_0xe119('0x1b')]);}_0x10e792[_0xe119('0x37')]=qs[_0xe119('0x38')](_0x4f7a5a[_0xe119('0x2f')][_0xe119('0x38')]);_0x10e792['where']=qs[_0xe119('0x31')](_[_0xe119('0x39')](_0x4f7a5a['query'],_0x57310b['filters']),_0x328fe1);if(_0x4f7a5a['query'][_0xe119('0x3a')]){_0x10e792[_0xe119('0x3b')]=_[_0xe119('0x3c')](_0x10e792[_0xe119('0x3b')],{'$or':_[_0xe119('0x3d')](_0x328fe1,function(_0x4a45ea){if(_0x4a45ea[_0xe119('0x2d')]!==_0xe119('0x3e')){var _0x27cadc={};_0x27cadc[_0x4a45ea[_0xe119('0x28')]]={'$like':'%'+_0x4f7a5a[_0xe119('0x2f')]['filter']+'%'};return _0x27cadc;}})});}_0x10e792=_[_0xe119('0x3c')]({},_0x10e792,_0x4f7a5a['options']);var _0x4d45a4={'where':_0x10e792[_0xe119('0x3b')]};return db[_0xe119('0x2a')][_0xe119('0x1e')](_0x4d45a4)[_0xe119('0x25')](function(_0x28b4cc){_0x5d52ec['count']=_0x28b4cc;if(_0x4f7a5a[_0xe119('0x2f')]['includeAll']){_0x10e792[_0xe119('0x3f')]=[{'all':!![]}];}return db[_0xe119('0x2a')][_0xe119('0x40')](_0x10e792);})[_0xe119('0x25')](function(_0x1b3823){_0x5d52ec[_0xe119('0x41')]=_0x1b3823;return _0x5d52ec;})[_0xe119('0x25')](respondWithFilteredResult(_0x3557da,_0x10e792))[_0xe119('0x42')](handleError(_0x3557da,null));};exports[_0xe119('0x43')]=function(_0xaa994e,_0x9467c2){var _0x121986={'raw':!![],'where':{'id':_0xaa994e[_0xe119('0x44')]['id']}},_0x1cc66e={};_0x1cc66e[_0xe119('0x2e')]=_['keys'](db['SugarcrmField'][_0xe119('0x2b')]);_0x1cc66e[_0xe119('0x2f')]=_['keys'](_0xaa994e[_0xe119('0x2f')]);_0x1cc66e[_0xe119('0x31')]=_[_0xe119('0x32')](_0x1cc66e['model'],_0x1cc66e[_0xe119('0x2f')]);_0x121986[_0xe119('0x34')]=_[_0xe119('0x32')](_0x1cc66e[_0xe119('0x2e')],qs['fields'](_0xaa994e[_0xe119('0x2f')][_0xe119('0x33')]));_0x121986[_0xe119('0x34')]=_0x121986[_0xe119('0x34')][_0xe119('0x35')]?_0x121986['attributes']:_0x1cc66e[_0xe119('0x2e')];if(_0xaa994e['query']['includeAll']){_0x121986[_0xe119('0x3f')]=[{'all':!![]}];}_0x121986=_[_0xe119('0x3c')]({},_0x121986,_0xaa994e[_0xe119('0x45')]);return db[_0xe119('0x2a')][_0xe119('0x46')](_0x121986)['then'](handleEntityNotFound(_0x9467c2,null))[_0xe119('0x25')](respondWithResult(_0x9467c2,null))['catch'](handleError(_0x9467c2,null));};exports['create']=function(_0x3da0fb,_0x3ecd45){return db[_0xe119('0x2a')][_0xe119('0x47')](_0x3da0fb[_0xe119('0x48')],{})[_0xe119('0x25')](respondWithResult(_0x3ecd45,0xc9))[_0xe119('0x42')](handleError(_0x3ecd45,null));};exports['update']=function(_0x553657,_0x45fe7d){if(_0x553657[_0xe119('0x48')]['id']){delete _0x553657[_0xe119('0x48')]['id'];}return db['SugarcrmField'][_0xe119('0x46')]({'where':{'id':_0x553657[_0xe119('0x44')]['id']}})[_0xe119('0x25')](handleEntityNotFound(_0x45fe7d,null))[_0xe119('0x25')](saveUpdates(_0x553657['body'],null))[_0xe119('0x25')](respondWithResult(_0x45fe7d,null))[_0xe119('0x42')](handleError(_0x45fe7d,null));};exports[_0xe119('0x24')]=function(_0x536fe7,_0x1936ee){return db[_0xe119('0x2a')][_0xe119('0x46')]({'where':{'id':_0x536fe7['params']['id']}})[_0xe119('0x25')](handleEntityNotFound(_0x1936ee,null))[_0xe119('0x25')](removeEntity(_0x1936ee,null))[_0xe119('0x42')](handleError(_0x1936ee,null));}; \ No newline at end of file +var _0xcf75=['index','map','SugarcrmField','fieldName','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','save','update','then','destroy','stack','name','send'];(function(_0x3109f1,_0x31e90d){var _0x1b041b=function(_0x876ac8){while(--_0x876ac8){_0x3109f1['push'](_0x3109f1['shift']());}};_0x1b041b(++_0x31e90d);}(_0xcf75,0x67));var _0x5cf7=function(_0x1edb90,_0x3d97d4){_0x1edb90=_0x1edb90-0x0;var _0x19dd1e=_0xcf75[_0x1edb90];return _0x19dd1e;};'use strict';var emlformat=require(_0x5cf7('0x0'));var rimraf=require(_0x5cf7('0x1'));var zipdir=require(_0x5cf7('0x2'));var jsonpatch=require(_0x5cf7('0x3'));var rp=require('request-promise');var moment=require(_0x5cf7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5cf7('0x5'));var util=require(_0x5cf7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5cf7('0x7'));var ejs=require(_0x5cf7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cf7('0x9'));var squel=require(_0x5cf7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5cf7('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5cf7('0xc'));var Papa=require(_0x5cf7('0xd'));var Redis=require('ioredis');var authService=require(_0x5cf7('0xe'));var qs=require(_0x5cf7('0xf'));var as=require(_0x5cf7('0x10'));var hardwareService=require(_0x5cf7('0x11'));var logger=require(_0x5cf7('0x12'))('api');var utils=require(_0x5cf7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5cf7('0x14'));var db=require(_0x5cf7('0x15'))['db'];function respondWithStatusCode(_0x580348,_0x5f3d21){_0x5f3d21=_0x5f3d21||0xcc;return function(_0x2b9175){if(_0x2b9175){return _0x580348[_0x5cf7('0x16')](_0x5f3d21);}return _0x580348[_0x5cf7('0x17')](_0x5f3d21)[_0x5cf7('0x18')]();};}function respondWithResult(_0x2d4fb4,_0x180866){_0x180866=_0x180866||0xc8;return function(_0x1c5079){if(_0x1c5079){return _0x2d4fb4[_0x5cf7('0x17')](_0x180866)['json'](_0x1c5079);}};}function respondWithFilteredResult(_0x25bc18,_0x4d6687){return function(_0x349f2e){if(_0x349f2e){var _0x52195d=typeof _0x4d6687[_0x5cf7('0x19')]===_0x5cf7('0x1a')&&typeof _0x4d6687[_0x5cf7('0x1b')]==='undefined';var _0x560a29=_0x349f2e[_0x5cf7('0x1c')];var _0x1caa5d=_0x52195d?0x0:_0x4d6687[_0x5cf7('0x19')];var _0x787626=_0x52195d?_0x349f2e[_0x5cf7('0x1c')]:_0x4d6687[_0x5cf7('0x19')]+_0x4d6687[_0x5cf7('0x1b')];var _0x1bf04f;if(_0x787626>=_0x560a29){_0x787626=_0x560a29;_0x1bf04f=0xc8;}else{_0x1bf04f=0xce;}_0x25bc18[_0x5cf7('0x17')](_0x1bf04f);return _0x25bc18['set']('Content-Range',_0x1caa5d+'-'+_0x787626+'/'+_0x560a29)[_0x5cf7('0x1d')](_0x349f2e);}return null;};}function patchUpdates(_0x1c081d){return function(_0x13fbc0){try{jsonpatch['apply'](_0x13fbc0,_0x1c081d,!![]);}catch(_0x487b54){return BPromise['reject'](_0x487b54);}return _0x13fbc0[_0x5cf7('0x1e')]();};}function saveUpdates(_0x3ba0f2,_0x6547fc){return function(_0x4db574){if(_0x4db574){return _0x4db574[_0x5cf7('0x1f')](_0x3ba0f2)[_0x5cf7('0x20')](function(_0x1c210e){return _0x1c210e;});}return null;};}function removeEntity(_0xdd4544,_0x3a1027){return function(_0x4b09ea){if(_0x4b09ea){return _0x4b09ea[_0x5cf7('0x21')]()[_0x5cf7('0x20')](function(){_0xdd4544[_0x5cf7('0x17')](0xcc)[_0x5cf7('0x18')]();});}};}function handleEntityNotFound(_0xed7b31,_0x31a8c6){return function(_0x19edce){if(!_0x19edce){_0xed7b31[_0x5cf7('0x16')](0x194);}return _0x19edce;};}function handleError(_0x1bfb7b,_0x362a21){_0x362a21=_0x362a21||0x1f4;return function(_0x2c6df1){logger['error'](_0x2c6df1[_0x5cf7('0x22')]);if(_0x2c6df1[_0x5cf7('0x23')]){delete _0x2c6df1[_0x5cf7('0x23')];}_0x1bfb7b[_0x5cf7('0x17')](_0x362a21)[_0x5cf7('0x24')](_0x2c6df1);};}exports[_0x5cf7('0x25')]=function(_0x5dc497,_0x377c94){var _0x1ac355={},_0x557f76={},_0xb8f8f1={'count':0x0,'rows':[]};var _0x308fd2=_[_0x5cf7('0x26')](db[_0x5cf7('0x27')]['rawAttributes'],function(_0x4c97bf){return{'name':_0x4c97bf[_0x5cf7('0x28')],'type':_0x4c97bf['type'][_0x5cf7('0x29')]};});_0x557f76[_0x5cf7('0x2a')]=_[_0x5cf7('0x26')](_0x308fd2,_0x5cf7('0x23'));_0x557f76['query']=_[_0x5cf7('0x2b')](_0x5dc497[_0x5cf7('0x2c')]);_0x557f76[_0x5cf7('0x2d')]=_['intersection'](_0x557f76[_0x5cf7('0x2a')],_0x557f76[_0x5cf7('0x2c')]);_0x1ac355['attributes']=_[_0x5cf7('0x2e')](_0x557f76[_0x5cf7('0x2a')],qs[_0x5cf7('0x2f')](_0x5dc497['query'][_0x5cf7('0x2f')]));_0x1ac355['attributes']=_0x1ac355['attributes'][_0x5cf7('0x30')]?_0x1ac355[_0x5cf7('0x31')]:_0x557f76[_0x5cf7('0x2a')];if(!_0x5dc497[_0x5cf7('0x2c')][_0x5cf7('0x32')](_0x5cf7('0x33'))){_0x1ac355[_0x5cf7('0x1b')]=qs[_0x5cf7('0x1b')](_0x5dc497[_0x5cf7('0x2c')][_0x5cf7('0x1b')]);_0x1ac355['offset']=qs[_0x5cf7('0x19')](_0x5dc497[_0x5cf7('0x2c')][_0x5cf7('0x19')]);}_0x1ac355[_0x5cf7('0x34')]=qs[_0x5cf7('0x35')](_0x5dc497['query'][_0x5cf7('0x35')]);_0x1ac355['where']=qs[_0x5cf7('0x2d')](_[_0x5cf7('0x36')](_0x5dc497[_0x5cf7('0x2c')],_0x557f76[_0x5cf7('0x2d')]),_0x308fd2);if(_0x5dc497['query']['filter']){_0x1ac355[_0x5cf7('0x37')]=_[_0x5cf7('0x38')](_0x1ac355[_0x5cf7('0x37')],{'$or':_[_0x5cf7('0x26')](_0x308fd2,function(_0xc3d640){if(_0xc3d640[_0x5cf7('0x39')]!==_0x5cf7('0x3a')){var _0x9a6238={};_0x9a6238[_0xc3d640[_0x5cf7('0x23')]]={'$like':'%'+_0x5dc497['query'][_0x5cf7('0x3b')]+'%'};return _0x9a6238;}})});}_0x1ac355=_['merge']({},_0x1ac355,_0x5dc497[_0x5cf7('0x3c')]);var _0x442210={'where':_0x1ac355[_0x5cf7('0x37')]};return db[_0x5cf7('0x27')][_0x5cf7('0x1c')](_0x442210)[_0x5cf7('0x20')](function(_0x5048c9){_0xb8f8f1[_0x5cf7('0x1c')]=_0x5048c9;if(_0x5dc497[_0x5cf7('0x2c')][_0x5cf7('0x3d')]){_0x1ac355[_0x5cf7('0x3e')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x1ac355);})['then'](function(_0x52fcbb){_0xb8f8f1[_0x5cf7('0x3f')]=_0x52fcbb;return _0xb8f8f1;})[_0x5cf7('0x20')](respondWithFilteredResult(_0x377c94,_0x1ac355))[_0x5cf7('0x40')](handleError(_0x377c94,null));};exports[_0x5cf7('0x41')]=function(_0x129af0,_0x4b3e43){var _0x57455d={'raw':!![],'where':{'id':_0x129af0[_0x5cf7('0x42')]['id']}},_0x1f619a={};_0x1f619a[_0x5cf7('0x2a')]=_[_0x5cf7('0x2b')](db['SugarcrmField'][_0x5cf7('0x43')]);_0x1f619a[_0x5cf7('0x2c')]=_[_0x5cf7('0x2b')](_0x129af0[_0x5cf7('0x2c')]);_0x1f619a['filters']=_['intersection'](_0x1f619a[_0x5cf7('0x2a')],_0x1f619a[_0x5cf7('0x2c')]);_0x57455d[_0x5cf7('0x31')]=_['intersection'](_0x1f619a[_0x5cf7('0x2a')],qs[_0x5cf7('0x2f')](_0x129af0['query']['fields']));_0x57455d[_0x5cf7('0x31')]=_0x57455d[_0x5cf7('0x31')][_0x5cf7('0x30')]?_0x57455d['attributes']:_0x1f619a['model'];if(_0x129af0[_0x5cf7('0x2c')]['includeAll']){_0x57455d[_0x5cf7('0x3e')]=[{'all':!![]}];}_0x57455d=_[_0x5cf7('0x38')]({},_0x57455d,_0x129af0['options']);return db[_0x5cf7('0x27')][_0x5cf7('0x44')](_0x57455d)[_0x5cf7('0x20')](handleEntityNotFound(_0x4b3e43,null))[_0x5cf7('0x20')](respondWithResult(_0x4b3e43,null))[_0x5cf7('0x40')](handleError(_0x4b3e43,null));};exports['create']=function(_0x43afc0,_0x3d0f88){return db[_0x5cf7('0x27')]['create'](_0x43afc0['body'],{})[_0x5cf7('0x20')](respondWithResult(_0x3d0f88,0xc9))[_0x5cf7('0x40')](handleError(_0x3d0f88,null));};exports['update']=function(_0x550b8d,_0x220c83){if(_0x550b8d[_0x5cf7('0x45')]['id']){delete _0x550b8d[_0x5cf7('0x45')]['id'];}return db[_0x5cf7('0x27')]['find']({'where':{'id':_0x550b8d[_0x5cf7('0x42')]['id']}})[_0x5cf7('0x20')](handleEntityNotFound(_0x220c83,null))['then'](saveUpdates(_0x550b8d['body'],null))['then'](respondWithResult(_0x220c83,null))[_0x5cf7('0x40')](handleError(_0x220c83,null));};exports['destroy']=function(_0x5c16a0,_0x4feb8d){return db[_0x5cf7('0x27')][_0x5cf7('0x44')]({'where':{'id':_0x5c16a0[_0x5cf7('0x42')]['id']}})[_0x5cf7('0x20')](handleEntityNotFound(_0x4feb8d,null))[_0x5cf7('0x20')](removeEntity(_0x4feb8d,null))[_0x5cf7('0x40')](handleError(_0x4feb8d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0d7918e..096634c 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 _0x4f50=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x1abeef,_0x3344b9){var _0x5f29c0=function(_0x4d8214){while(--_0x4d8214){_0x1abeef['push'](_0x1abeef['shift']());}};_0x5f29c0(++_0x3344b9);}(_0x4f50,0x12c));var _0x04f5=function(_0x395d59,_0x3aa7d1){_0x395d59=_0x395d59-0x0;var _0x45f776=_0x4f50[_0x395d59];return _0x45f776;};'use strict';var _=require(_0x04f5('0x0'));var util=require(_0x04f5('0x1'));var logger=require(_0x04f5('0x2'))(_0x04f5('0x3'));var moment=require('moment');var BPromise=require(_0x04f5('0x4'));var rp=require(_0x04f5('0x5'));var fs=require('fs');var path=require(_0x04f5('0x6'));var rimraf=require(_0x04f5('0x7'));var config=require(_0x04f5('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x04f5('0x9')]=function(_0x3a6d18,_0x380d45){return _0x3a6d18[_0x04f5('0xa')](_0x04f5('0xb'),attributes,{'tableName':_0x04f5('0xc'),'paranoid':![],'indexes':[{'name':_0x04f5('0xd'),'fields':[_0x04f5('0xe'),_0x04f5('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f59=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','idField','lodash','../../config/logger','api','moment','request-promise'];(function(_0xc5853e,_0x272cee){var _0x352609=function(_0x2bb1c8){while(--_0x2bb1c8){_0xc5853e['push'](_0xc5853e['shift']());}};_0x352609(++_0x272cee);}(_0x9f59,0x1cf));var _0x99f5=function(_0x22824b,_0x2c57bb){_0x22824b=_0x22824b-0x0;var _0x9cf821=_0x9f59[_0x22824b];return _0x9cf821;};'use strict';var _=require(_0x99f5('0x0'));var util=require('util');var logger=require(_0x99f5('0x1'))(_0x99f5('0x2'));var moment=require(_0x99f5('0x3'));var BPromise=require('bluebird');var rp=require(_0x99f5('0x4'));var fs=require('fs');var path=require(_0x99f5('0x5'));var rimraf=require(_0x99f5('0x6'));var config=require(_0x99f5('0x7'));var attributes=require(_0x99f5('0x8'));module[_0x99f5('0x9')]=function(_0x2d53c9,_0x369e35){return _0x2d53c9['define'](_0x99f5('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x99f5('0xb'),'fields':[_0x99f5('0xc'),'FieldId'],'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 6759687..ee6d4b1 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 _0x3541=['SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40f7d6,_0x329c39){var _0xcaf08d=function(_0x32f38f){while(--_0x32f38f){_0x40f7d6['push'](_0x40f7d6['shift']());}};_0xcaf08d(++_0x329c39);}(_0x3541,0xd8));var _0x1354=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x3541[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x1354('0x0'));var util=require(_0x1354('0x1'));var moment=require(_0x1354('0x2'));var BPromise=require(_0x1354('0x3'));var rs=require(_0x1354('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1354('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1354('0x6'))(_0x1354('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1354('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e526b,_0x69ebe7,_0x137abf){return new BPromise(function(_0x5d08f6,_0x4e1faf){return client[_0x1354('0x9')](_0x4e526b,_0x137abf)[_0x1354('0xa')](function(_0x1b76c3){logger[_0x1354('0xb')](_0x1354('0xc'),_0x69ebe7,_0x1354('0xd'));logger[_0x1354('0xe')](_0x1354('0xf'),_0x69ebe7,'request\x20sent',JSON['stringify'](_0x1b76c3));if(_0x1b76c3['error']){if(_0x1b76c3[_0x1354('0x10')][_0x1354('0x11')]===0x1f4){logger[_0x1354('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x69ebe7,_0x1b76c3['error'][_0x1354('0x12')]);return _0x4e1faf(_0x1b76c3[_0x1354('0x10')][_0x1354('0x12')]);}logger[_0x1354('0x10')](_0x1354('0xc'),_0x69ebe7,_0x1b76c3[_0x1354('0x10')]['message']);return _0x5d08f6(_0x1b76c3['error'][_0x1354('0x12')]);}else{logger[_0x1354('0xb')](_0x1354('0xc'),_0x69ebe7,_0x1354('0xd'));_0x5d08f6(_0x1b76c3[_0x1354('0x13')]['message']);}})[_0x1354('0x14')](function(_0x13408f){logger[_0x1354('0x10')](_0x1354('0xc'),_0x69ebe7,_0x13408f);_0x4e1faf(_0x13408f);});});} \ No newline at end of file +var _0x1e1b=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xae7ebf,_0x340293){var _0x45478d=function(_0x13c083){while(--_0x13c083){_0xae7ebf['push'](_0xae7ebf['shift']());}};_0x45478d(++_0x340293);}(_0x1e1b,0xdd));var _0xb1e1=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x1e1b[_0x450bf9];return _0x268350;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb1e1('0x0'));var BPromise=require(_0xb1e1('0x1'));var rs=require(_0xb1e1('0x2'));var fs=require('fs');var Redis=require(_0xb1e1('0x3'));var db=require(_0xb1e1('0x4'))['db'];var utils=require(_0xb1e1('0x5'));var logger=require(_0xb1e1('0x6'))('rpc');var config=require(_0xb1e1('0x7'));var jayson=require(_0xb1e1('0x8'));var client=jayson[_0xb1e1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417b19,_0x1171e1,_0x5d7ed1){return new BPromise(function(_0x14b4b6,_0x214b74){return client[_0xb1e1('0xa')](_0x417b19,_0x5d7ed1)[_0xb1e1('0xb')](function(_0x4b5d97){logger[_0xb1e1('0xc')](_0xb1e1('0xd'),_0x1171e1,_0xb1e1('0xe'));logger[_0xb1e1('0xf')](_0xb1e1('0x10'),_0x1171e1,_0xb1e1('0xe'),JSON['stringify'](_0x4b5d97));if(_0x4b5d97[_0xb1e1('0x11')]){if(_0x4b5d97['error'][_0xb1e1('0x12')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x1171e1,_0x4b5d97['error'][_0xb1e1('0x13')]);return _0x214b74(_0x4b5d97[_0xb1e1('0x11')]['message']);}logger[_0xb1e1('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x1171e1,_0x4b5d97[_0xb1e1('0x11')][_0xb1e1('0x13')]);return _0x14b4b6(_0x4b5d97[_0xb1e1('0x11')][_0xb1e1('0x13')]);}else{logger['info'](_0xb1e1('0xd'),_0x1171e1,_0xb1e1('0xe'));_0x14b4b6(_0x4b5d97['result'][_0xb1e1('0x13')]);}})[_0xb1e1('0x14')](function(_0xdd4dfc){logger[_0xb1e1('0x11')](_0xb1e1('0xd'),_0x1171e1,_0xdd4dfc);_0x214b74(_0xdd4dfc);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 01c6d09..134e143 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 _0x79d3=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','delete','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x79d3,0x15f));var _0x379d=function(_0x49d5a6,_0x3a1f12){_0x49d5a6=_0x49d5a6-0x0;var _0x56d4fa=_0x79d3[_0x49d5a6];return _0x56d4fa;};'use strict';var multer=require(_0x379d('0x0'));var util=require('util');var path=require(_0x379d('0x1'));var timeout=require('connect-timeout');var express=require(_0x379d('0x2'));var router=express[_0x379d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x379d('0x4'));var interaction=require(_0x379d('0x5'));var config=require(_0x379d('0x6'));var controller=require(_0x379d('0x7'));router[_0x379d('0x8')]('/',auth[_0x379d('0x9')](),controller[_0x379d('0xa')]);router['get'](_0x379d('0xb'),auth['isAuthenticated'](),controller[_0x379d('0xc')]);router[_0x379d('0x8')](_0x379d('0xd'),auth['isAuthenticated'](),controller[_0x379d('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x379d('0xf')]);router[_0x379d('0x10')]('/',auth[_0x379d('0x9')](),controller['create']);router[_0x379d('0x10')](_0x379d('0xd'),auth[_0x379d('0x9')](),controller[_0x379d('0x11')]);router['put'](_0x379d('0xb'),auth[_0x379d('0x9')](),controller[_0x379d('0x12')]);router[_0x379d('0x13')](_0x379d('0xb'),auth[_0x379d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9224=['fs-extra','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x19e6ba,_0x210695){var _0x3aecea=function(_0x263ba5){while(--_0x263ba5){_0x19e6ba['push'](_0x19e6ba['shift']());}};_0x3aecea(++_0x210695);}(_0x9224,0xa3));var _0x4922=function(_0xb10358,_0x255326){_0xb10358=_0xb10358-0x0;var _0x23685a=_0x9224[_0xb10358];return _0x23685a;};'use strict';var multer=require('multer');var util=require(_0x4922('0x0'));var path=require(_0x4922('0x1'));var timeout=require(_0x4922('0x2'));var express=require(_0x4922('0x3'));var router=express[_0x4922('0x4')]();var fs_extra=require(_0x4922('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4922('0x6'));router['get']('/',auth[_0x4922('0x7')](),controller[_0x4922('0x8')]);router[_0x4922('0x9')](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0xb')]);router['get'](_0x4922('0xc'),auth[_0x4922('0x7')](),controller['getConfigurations']);router[_0x4922('0x9')](_0x4922('0xd'),auth[_0x4922('0x7')](),controller[_0x4922('0xe')]);router[_0x4922('0xf')]('/',auth[_0x4922('0x7')](),controller[_0x4922('0x10')]);router[_0x4922('0xf')]('/:id/configurations',auth[_0x4922('0x7')](),controller['addConfiguration']);router[_0x4922('0x11')](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0x12')]);router[_0x4922('0x13')]('/:id',auth[_0x4922('0x7')](),controller[_0x4922('0x14')]);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 15c3ed7..ecdf1aa 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 _0xc3dd=['STRING','exports'];(function(_0x378487,_0x1fdc2c){var _0x3bb63b=function(_0x38c2e0){while(--_0x38c2e0){_0x378487['push'](_0x378487['shift']());}};_0x3bb63b(++_0x1fdc2c);}(_0xc3dd,0x99));var _0xdc3d=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xc3dd[_0x31e5cb];return _0x4170df;};'use strict';var Sequelize=require('sequelize');module[_0xdc3d('0x0')]={'name':{'type':Sequelize[_0xdc3d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdc3d('0x1')]},'username':{'type':Sequelize[_0xdc3d('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xdc3d('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xdc3d('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xdc3d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x68eb=['STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68eb,0x13e));var _0xb68e=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x68eb[_0x178856];return _0x3c7fe7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb68e('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xb68e('0x0')]},'username':{'type':Sequelize[_0xb68e('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb68e('0x0')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xb68e('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb68e('0x0')],'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 9187531..7525aa9 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 _0x8d12=['getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','login','result','token','success','describe','sessionName','reference','owner','remove','includes','false','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','error','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','name','index','VtigerAccount','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params','keys','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','addConfiguration','Subjects'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x8d12,0x9e));var _0x28d1=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0x8d12[_0x175e89];return _0x2ed996;};'use strict';var emlformat=require(_0x28d1('0x0'));var rimraf=require(_0x28d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28d1('0x2'));var rp=require(_0x28d1('0x3'));var moment=require('moment');var BPromise=require(_0x28d1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x28d1('0x5'));var sox=require(_0x28d1('0x6'));var csv=require(_0x28d1('0x7'));var ejs=require(_0x28d1('0x8'));var fs=require('fs');var fs_extra=require(_0x28d1('0x9'));var _=require(_0x28d1('0xa'));var squel=require(_0x28d1('0xb'));var crypto=require(_0x28d1('0xc'));var jsforce=require(_0x28d1('0xd'));var deskjs=require(_0x28d1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x28d1('0xf'));var Papa=require(_0x28d1('0x10'));var Redis=require(_0x28d1('0x11'));var authService=require(_0x28d1('0x12'));var qs=require(_0x28d1('0x13'));var as=require(_0x28d1('0x14'));var hardwareService=require(_0x28d1('0x15'));var logger=require(_0x28d1('0x16'))(_0x28d1('0x17'));var utils=require(_0x28d1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x28d1('0x19'));var db=require(_0x28d1('0x1a'))['db'];var integrations=require(_0x28d1('0x1b'));function respondWithStatusCode(_0x26e8c4,_0x505faf){_0x505faf=_0x505faf||0xcc;return function(_0x194b52){if(_0x194b52){return _0x26e8c4[_0x28d1('0x1c')](_0x505faf);}return _0x26e8c4[_0x28d1('0x1d')](_0x505faf)[_0x28d1('0x1e')]();};}function respondWithResult(_0x36da12,_0x2cec48){_0x2cec48=_0x2cec48||0xc8;return function(_0x230ac2){if(_0x230ac2){return _0x36da12[_0x28d1('0x1d')](_0x2cec48)[_0x28d1('0x1f')](_0x230ac2);}};}function respondWithFilteredResult(_0x14de6a,_0x3bf907){return function(_0x57ac96){if(_0x57ac96){var _0x5350ca=typeof _0x3bf907[_0x28d1('0x20')]===_0x28d1('0x21')&&typeof _0x3bf907['limit']==='undefined';var _0x5c2411=_0x57ac96[_0x28d1('0x22')];var _0x79a03f=_0x5350ca?0x0:_0x3bf907['offset'];var _0x5154f9=_0x5350ca?_0x57ac96[_0x28d1('0x22')]:_0x3bf907[_0x28d1('0x20')]+_0x3bf907['limit'];var _0x5deb11;if(_0x5154f9>=_0x5c2411){_0x5154f9=_0x5c2411;_0x5deb11=0xc8;}else{_0x5deb11=0xce;}_0x14de6a[_0x28d1('0x1d')](_0x5deb11);return _0x14de6a['set'](_0x28d1('0x23'),_0x79a03f+'-'+_0x5154f9+'/'+_0x5c2411)[_0x28d1('0x1f')](_0x57ac96);}return null;};}function patchUpdates(_0x454826){return function(_0x15581a){try{jsonpatch[_0x28d1('0x24')](_0x15581a,_0x454826,!![]);}catch(_0x14c389){return BPromise[_0x28d1('0x25')](_0x14c389);}return _0x15581a[_0x28d1('0x26')]();};}function saveUpdates(_0x4579a6,_0x5ad93b){return function(_0x27946f){if(_0x27946f){return _0x27946f[_0x28d1('0x27')](_0x4579a6)[_0x28d1('0x28')](function(_0x4bf0d5){return _0x4bf0d5;});}return null;};}function removeEntity(_0x13e587,_0x17ded3){return function(_0x215c1a){if(_0x215c1a){return _0x215c1a['destroy']()[_0x28d1('0x28')](function(){_0x13e587[_0x28d1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x136adc,_0x25d96c){return function(_0x45b23a){if(!_0x45b23a){_0x136adc[_0x28d1('0x1c')](0x194);}return _0x45b23a;};}function handleError(_0x296011,_0x3f1419){_0x3f1419=_0x3f1419||0x1f4;return function(_0x5042c8){logger['error'](_0x5042c8['stack']);if(_0x5042c8[_0x28d1('0x29')]){delete _0x5042c8['name'];}_0x296011[_0x28d1('0x1d')](_0x3f1419)['send'](_0x5042c8);};}exports[_0x28d1('0x2a')]=function(_0x23c355,_0x221685){var _0x4ca0fd={},_0x5e8964={},_0x346564={'count':0x0,'rows':[]};var _0x48b773=_['map'](db[_0x28d1('0x2b')][_0x28d1('0x2c')],function(_0x3ca9ac){return{'name':_0x3ca9ac[_0x28d1('0x2d')],'type':_0x3ca9ac['type'][_0x28d1('0x2e')]};});_0x5e8964[_0x28d1('0x2f')]=_[_0x28d1('0x30')](_0x48b773,'name');_0x5e8964['query']=_['keys'](_0x23c355[_0x28d1('0x31')]);_0x5e8964['filters']=_[_0x28d1('0x32')](_0x5e8964[_0x28d1('0x2f')],_0x5e8964['query']);_0x4ca0fd[_0x28d1('0x33')]=_[_0x28d1('0x32')](_0x5e8964[_0x28d1('0x2f')],qs['fields'](_0x23c355[_0x28d1('0x31')][_0x28d1('0x34')]));_0x4ca0fd[_0x28d1('0x33')]=_0x4ca0fd['attributes'][_0x28d1('0x35')]?_0x4ca0fd[_0x28d1('0x33')]:_0x5e8964[_0x28d1('0x2f')];if(!_0x23c355[_0x28d1('0x31')]['hasOwnProperty'](_0x28d1('0x36'))){_0x4ca0fd[_0x28d1('0x37')]=qs[_0x28d1('0x37')](_0x23c355[_0x28d1('0x31')][_0x28d1('0x37')]);_0x4ca0fd[_0x28d1('0x20')]=qs[_0x28d1('0x20')](_0x23c355[_0x28d1('0x31')]['offset']);}_0x4ca0fd[_0x28d1('0x38')]=qs[_0x28d1('0x39')](_0x23c355['query']['sort']);_0x4ca0fd[_0x28d1('0x3a')]=qs[_0x28d1('0x3b')](_[_0x28d1('0x3c')](_0x23c355[_0x28d1('0x31')],_0x5e8964[_0x28d1('0x3b')]),_0x48b773);if(_0x23c355['query'][_0x28d1('0x3d')]){_0x4ca0fd['where']=_[_0x28d1('0x3e')](_0x4ca0fd[_0x28d1('0x3a')],{'$or':_[_0x28d1('0x30')](_0x48b773,function(_0x92cb1c){if(_0x92cb1c[_0x28d1('0x3f')]!==_0x28d1('0x40')){var _0x9cdca8={};_0x9cdca8[_0x92cb1c['name']]={'$like':'%'+_0x23c355[_0x28d1('0x31')][_0x28d1('0x3d')]+'%'};return _0x9cdca8;}})});}_0x4ca0fd=_[_0x28d1('0x3e')]({},_0x4ca0fd,_0x23c355[_0x28d1('0x41')]);var _0x27ce8f={'where':_0x4ca0fd[_0x28d1('0x3a')]};return db[_0x28d1('0x2b')][_0x28d1('0x22')](_0x27ce8f)[_0x28d1('0x28')](function(_0x230866){_0x346564[_0x28d1('0x22')]=_0x230866;if(_0x23c355['query'][_0x28d1('0x42')]){_0x4ca0fd['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x4ca0fd);})[_0x28d1('0x28')](function(_0x2d435d){_0x346564[_0x28d1('0x43')]=_0x2d435d;return _0x346564;})[_0x28d1('0x28')](respondWithFilteredResult(_0x221685,_0x4ca0fd))[_0x28d1('0x44')](handleError(_0x221685,null));};exports['show']=function(_0xf25f9a,_0x46f89d){var _0x4f3ae9={'raw':![],'where':{'id':_0xf25f9a[_0x28d1('0x45')]['id']}},_0x107a87={};_0x107a87[_0x28d1('0x2f')]=_[_0x28d1('0x46')](db[_0x28d1('0x2b')][_0x28d1('0x2c')]);_0x107a87['query']=_[_0x28d1('0x46')](_0xf25f9a[_0x28d1('0x31')]);_0x107a87[_0x28d1('0x3b')]=_[_0x28d1('0x32')](_0x107a87[_0x28d1('0x2f')],_0x107a87[_0x28d1('0x31')]);_0x4f3ae9[_0x28d1('0x33')]=_[_0x28d1('0x32')](_0x107a87[_0x28d1('0x2f')],qs[_0x28d1('0x34')](_0xf25f9a[_0x28d1('0x31')][_0x28d1('0x34')]));_0x4f3ae9[_0x28d1('0x33')]=_0x4f3ae9['attributes'][_0x28d1('0x35')]?_0x4f3ae9[_0x28d1('0x33')]:_0x107a87['model'];if(_0xf25f9a[_0x28d1('0x31')][_0x28d1('0x42')]){_0x4f3ae9['include']=[{'all':!![]}];}_0x4f3ae9=_['merge']({},_0x4f3ae9,_0xf25f9a['options']);return db[_0x28d1('0x2b')][_0x28d1('0x47')](_0x4f3ae9)['then'](handleEntityNotFound(_0x46f89d,null))[_0x28d1('0x28')](respondWithResult(_0x46f89d,null))['catch'](handleError(_0x46f89d,null));};exports[_0x28d1('0x48')]=function(_0x4f4538,_0x3cca5b){return db['VtigerAccount'][_0x28d1('0x48')](_0x4f4538[_0x28d1('0x49')],{})['then'](respondWithResult(_0x3cca5b,0xc9))[_0x28d1('0x44')](handleError(_0x3cca5b,null));};exports[_0x28d1('0x27')]=function(_0x4fe9cb,_0x4a8538){if(_0x4fe9cb[_0x28d1('0x49')]['id']){delete _0x4fe9cb['body']['id'];}return db[_0x28d1('0x2b')][_0x28d1('0x47')]({'where':{'id':_0x4fe9cb['params']['id']}})[_0x28d1('0x28')](handleEntityNotFound(_0x4a8538,null))['then'](saveUpdates(_0x4fe9cb['body'],null))['then'](respondWithResult(_0x4a8538,null))[_0x28d1('0x44')](handleError(_0x4a8538,null));};exports[_0x28d1('0x4a')]=function(_0x31b199,_0xd9711e){return db[_0x28d1('0x2b')][_0x28d1('0x47')]({'where':{'id':_0x31b199['params']['id']}})[_0x28d1('0x28')](handleEntityNotFound(_0xd9711e,null))[_0x28d1('0x28')](removeEntity(_0xd9711e,null))[_0x28d1('0x44')](handleError(_0xd9711e,null));};exports[_0x28d1('0x4b')]=function(_0x39a930,_0x38c233,_0x10eed3){var _0x17fc71={};var _0x39f0a2={};var _0x28a94c;var _0x57cedc;return db[_0x28d1('0x2b')][_0x28d1('0x4c')]({'where':{'id':_0x39a930[_0x28d1('0x45')]['id']}})[_0x28d1('0x28')](handleEntityNotFound(_0x38c233,null))[_0x28d1('0x28')](function(_0x53b874){if(_0x53b874){_0x28a94c=_0x53b874;_0x39f0a2[_0x28d1('0x2f')]=_[_0x28d1('0x46')](db[_0x28d1('0x4d')][_0x28d1('0x2c')]);_0x39f0a2['query']=_['keys'](_0x39a930[_0x28d1('0x31')]);_0x39f0a2[_0x28d1('0x3b')]=_[_0x28d1('0x32')](_0x39f0a2[_0x28d1('0x2f')],_0x39f0a2[_0x28d1('0x31')]);_0x17fc71['attributes']=_[_0x28d1('0x32')](_0x39f0a2['model'],qs['fields'](_0x39a930['query']['fields']));_0x17fc71[_0x28d1('0x33')]=_0x17fc71[_0x28d1('0x33')]['length']?_0x17fc71[_0x28d1('0x33')]:_0x39f0a2['model'];_0x17fc71[_0x28d1('0x38')]=qs[_0x28d1('0x39')](_0x39a930[_0x28d1('0x31')]['sort']);_0x17fc71['where']=qs[_0x28d1('0x3b')](_[_0x28d1('0x3c')](_0x39a930[_0x28d1('0x31')],_0x39f0a2['filters']));if(_0x39a930[_0x28d1('0x31')][_0x28d1('0x3d')]){_0x17fc71['where']=_[_0x28d1('0x3e')](_0x17fc71[_0x28d1('0x3a')],{'$or':_[_0x28d1('0x30')](_0x17fc71[_0x28d1('0x33')],function(_0x348506){var _0x67a6fe={};_0x67a6fe[_0x348506]={'$like':'%'+_0x39a930['query']['filter']+'%'};return _0x67a6fe;})});}_0x17fc71=_[_0x28d1('0x3e')]({},_0x17fc71,_0x39a930[_0x28d1('0x41')]);return _0x28a94c['getConfigurations'](_0x17fc71);}})[_0x28d1('0x28')](function(_0x212463){if(_0x212463){_0x57cedc=_0x212463[_0x28d1('0x35')];if(!_0x39a930['query']['hasOwnProperty']('nolimit')){_0x17fc71[_0x28d1('0x37')]=qs[_0x28d1('0x37')](_0x39a930['query'][_0x28d1('0x37')]);_0x17fc71[_0x28d1('0x20')]=qs[_0x28d1('0x20')](_0x39a930['query'][_0x28d1('0x20')]);}return _0x28a94c[_0x28d1('0x4b')](_0x17fc71);}})[_0x28d1('0x28')](function(_0x4e6979){if(_0x4e6979){return _0x4e6979?{'count':_0x57cedc,'rows':_0x4e6979}:null;}})[_0x28d1('0x28')](respondWithResult(_0x38c233,null))[_0x28d1('0x44')](handleError(_0x38c233,null));};exports[_0x28d1('0x4e')]=function(_0x401c79,_0x2447bf,_0x561b1d){if(_0x401c79[_0x28d1('0x49')]['id']){delete _0x401c79[_0x28d1('0x49')]['id'];}return db['VtigerAccount'][_0x28d1('0x4c')]({'where':{'id':_0x401c79[_0x28d1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2447bf,null))['then'](function(_0x5dd8be){if(_0x5dd8be){_0x401c79[_0x28d1('0x49')]['AccountId']=_0x5dd8be['id'];_0x401c79[_0x28d1('0x49')][_0x28d1('0x4f')]=integrations[_0x28d1('0x50')](_0x401c79[_0x28d1('0x49')][_0x28d1('0x51')],_0x401c79[_0x28d1('0x49')][_0x28d1('0x3f')]);_0x401c79[_0x28d1('0x49')][_0x28d1('0x52')]=integrations['getDescriptions'](_0x401c79['body'][_0x28d1('0x51')],_0x401c79['body'][_0x28d1('0x3f')]);return db[_0x28d1('0x4d')][_0x28d1('0x48')](_0x401c79[_0x28d1('0x49')],{'include':[{'model':db['VtigerField'],'as':_0x28d1('0x4f')},{'model':db[_0x28d1('0x53')],'as':_0x28d1('0x52')}]});}return null;})['then'](respondWithResult(_0x2447bf,null))[_0x28d1('0x44')](handleError(_0x2447bf,null));};var md5=require(_0x28d1('0x54'));exports[_0x28d1('0x55')]=function(_0x5ad9d9,_0x53d21d,_0x4babb7){var _0x263f63=null;var _0x539f0f=null;var _0x35fd50=null;var _0x1df612=null;var _0x27bae5='';return db['VtigerAccount'][_0x28d1('0x4c')]({'where':{'id':_0x5ad9d9[_0x28d1('0x45')]['id']},'attributes':['id',_0x28d1('0x29'),_0x28d1('0x56'),'description',_0x28d1('0x57'),_0x28d1('0x58'),'serverUrl',_0x28d1('0x59')]})['then'](handleEntityNotFound(_0x53d21d,null))[_0x28d1('0x28')](function(_0x1d8daa){if(_0x1d8daa){_0x263f63=_0x1d8daa[_0x28d1('0x56')];_0x539f0f=_0x1d8daa[_0x28d1('0x59')];_0x35fd50=_0x1d8daa[_0x28d1('0x57')];_0x27bae5=_0x1d8daa[_0x28d1('0x58')];var _0x37cf52=_0x27bae5['slice'](-0x1);if(_0x37cf52==='/'){_0x27bae5=_0x27bae5[_0x28d1('0x5a')](0x0,_0x27bae5[_0x28d1('0x5b')](_0x37cf52));}_0x1df612=util[_0x28d1('0x5c')](_0x28d1('0x5d'),_0x27bae5);var _0x441e3f={'method':_0x28d1('0x5e'),'uri':_0x1df612,'qs':{'operation':_0x28d1('0x5f'),'username':_0x1d8daa[_0x28d1('0x56')]},'json':!![]};return rp(_0x441e3f);}})[_0x28d1('0x28')](function(_0x2bdc73){if(_0x2bdc73['success']){var _0x361cda={'method':'POST','uri':_0x1df612,'form':{'operation':_0x28d1('0x60'),'username':_0x263f63,'accessKey':md5(_0x2bdc73[_0x28d1('0x61')][_0x28d1('0x62')]+_0x539f0f)},'json':!![]};return rp(_0x361cda);}})[_0x28d1('0x28')](function(_0x3e1743){if(_0x3e1743[_0x28d1('0x63')]){var _0x33a61b={'method':_0x28d1('0x5e'),'uri':_0x1df612,'qs':{'operation':_0x28d1('0x64'),'username':_0x263f63,'sessionName':_0x3e1743[_0x28d1('0x61')][_0x28d1('0x65')],'elementType':_0x35fd50},'json':!![]};return rp(_0x33a61b);}})[_0x28d1('0x28')](function(_0x100a75){if(_0x100a75[_0x28d1('0x63')]){var _0x412fb4=['autogenerated',_0x28d1('0x66'),_0x28d1('0x67')];_[_0x28d1('0x68')](_0x100a75[_0x28d1('0x61')]['fields'],function(_0x4b663a){return _0x412fb4[_0x28d1('0x69')](_0x4b663a[_0x28d1('0x3f')]['name']);});_[_0x28d1('0x68')](_0x100a75[_0x28d1('0x61')][_0x28d1('0x34')],function(_0x52dcba){return _0x52dcba['editable']===_0x28d1('0x6a');});return{'count':_0x100a75['result']['fields'][_0x28d1('0x35')],'rows':_[_0x28d1('0x30')](_0x100a75[_0x28d1('0x61')][_0x28d1('0x34')],function(_0x5a4e33){return{'id':_0x5a4e33[_0x28d1('0x29')],'name':_0x5a4e33['label'],'custom':_['startsWith'](_0x5a4e33[_0x28d1('0x29')],'cf_')?!![]:![],'options':_0x5a4e33[_0x28d1('0x3f')]['name']===_0x28d1('0x6b')&&_0x5a4e33[_0x28d1('0x3f')][_0x28d1('0x6c')]['length']>0x0?_[_0x28d1('0x30')](_0x5a4e33[_0x28d1('0x3f')][_0x28d1('0x6c')],function(_0x369062){return{'name':_0x369062[_0x28d1('0x6d')],'value':_0x369062[_0x28d1('0x6e')]};}):[]};})};}})[_0x28d1('0x28')](respondWithResult(_0x53d21d,null))[_0x28d1('0x44')](function(_0xf9da73){console[_0x28d1('0x6f')](_0x28d1('0x70')+_0xf9da73);var _0x35861d=_0x5ad9d9[_0x28d1('0x31')][_0x28d1('0x71')]?0x1f4:_0xf9da73[_0x28d1('0x72')]||0x1f4;logger[_0x28d1('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0x28d1('0x55'),_0x35861d,JSON[_0x28d1('0x74')](_0xf9da73));delete _0xf9da73[_0x28d1('0x29')];if(_0x35861d===0x191){_0x35861d=0x190;}_0x53d21d[_0x28d1('0x1d')](_0x35861d)[_0x28d1('0x75')](_0x5ad9d9[_0x28d1('0x31')][_0x28d1('0x71')]?{'message':_0x28d1('0x76'),'statusCode':_0xf9da73[_0x28d1('0x72')]}:_0xf9da73);});}; \ No newline at end of file +var _0xab39=['false','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerAccount','includeAll','findAll','params','fields','include','catch','create','body','find','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','POST','token','describe','result','sessionName','success','autogenerated','reference','owner','editable'];(function(_0xf78d3b,_0x5e019d){var _0xe2c368=function(_0x3c553f){while(--_0x3c553f){_0xf78d3b['push'](_0xf78d3b['shift']());}};_0xe2c368(++_0x5e019d);}(_0xab39,0x16f));var _0x9ab3=function(_0x5b31f1,_0x2dcd9d){_0x5b31f1=_0x5b31f1-0x0;var _0x43853b=_0xab39[_0x5b31f1];return _0x43853b;};'use strict';var emlformat=require(_0x9ab3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ab3('0x1'));var jsonpatch=require(_0x9ab3('0x2'));var rp=require('request-promise');var moment=require(_0x9ab3('0x3'));var BPromise=require(_0x9ab3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9ab3('0x5'));var sox=require(_0x9ab3('0x6'));var csv=require(_0x9ab3('0x7'));var ejs=require(_0x9ab3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9ab3('0x9'));var crypto=require(_0x9ab3('0xa'));var jsforce=require(_0x9ab3('0xb'));var deskjs=require(_0x9ab3('0xc'));var toCsv=require(_0x9ab3('0x7'));var querystring=require(_0x9ab3('0xd'));var Papa=require(_0x9ab3('0xe'));var Redis=require(_0x9ab3('0xf'));var authService=require(_0x9ab3('0x10'));var qs=require(_0x9ab3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ab3('0x12'))(_0x9ab3('0x13'));var utils=require(_0x9ab3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ab3('0x15'))['db'];var integrations=require(_0x9ab3('0x16'));function respondWithStatusCode(_0x509cb5,_0xbee52f){_0xbee52f=_0xbee52f||0xcc;return function(_0x13bfad){if(_0x13bfad){return _0x509cb5['sendStatus'](_0xbee52f);}return _0x509cb5[_0x9ab3('0x17')](_0xbee52f)[_0x9ab3('0x18')]();};}function respondWithResult(_0x7bfdb1,_0x3d9f17){_0x3d9f17=_0x3d9f17||0xc8;return function(_0x1e3981){if(_0x1e3981){return _0x7bfdb1[_0x9ab3('0x17')](_0x3d9f17)[_0x9ab3('0x19')](_0x1e3981);}};}function respondWithFilteredResult(_0x5b168b,_0x3d6bdf){return function(_0x333a73){if(_0x333a73){var _0x24580d=typeof _0x3d6bdf[_0x9ab3('0x1a')]==='undefined'&&typeof _0x3d6bdf[_0x9ab3('0x1b')]===_0x9ab3('0x1c');var _0x4b9b1f=_0x333a73[_0x9ab3('0x1d')];var _0x1c6dba=_0x24580d?0x0:_0x3d6bdf[_0x9ab3('0x1a')];var _0x557c2c=_0x24580d?_0x333a73['count']:_0x3d6bdf[_0x9ab3('0x1a')]+_0x3d6bdf[_0x9ab3('0x1b')];var _0xbfeb1b;if(_0x557c2c>=_0x4b9b1f){_0x557c2c=_0x4b9b1f;_0xbfeb1b=0xc8;}else{_0xbfeb1b=0xce;}_0x5b168b['status'](_0xbfeb1b);return _0x5b168b[_0x9ab3('0x1e')](_0x9ab3('0x1f'),_0x1c6dba+'-'+_0x557c2c+'/'+_0x4b9b1f)[_0x9ab3('0x19')](_0x333a73);}return null;};}function patchUpdates(_0x33c89e){return function(_0x136834){try{jsonpatch[_0x9ab3('0x20')](_0x136834,_0x33c89e,!![]);}catch(_0x31f7af){return BPromise['reject'](_0x31f7af);}return _0x136834[_0x9ab3('0x21')]();};}function saveUpdates(_0x182bad,_0x2745e4){return function(_0x4dd831){if(_0x4dd831){return _0x4dd831[_0x9ab3('0x22')](_0x182bad)[_0x9ab3('0x23')](function(_0x54467c){return _0x54467c;});}return null;};}function removeEntity(_0x52d351,_0x5f0b51){return function(_0x201789){if(_0x201789){return _0x201789[_0x9ab3('0x24')]()[_0x9ab3('0x23')](function(){_0x52d351[_0x9ab3('0x17')](0xcc)[_0x9ab3('0x18')]();});}};}function handleEntityNotFound(_0x44c1e6,_0x4cc05a){return function(_0x1523b3){if(!_0x1523b3){_0x44c1e6['sendStatus'](0x194);}return _0x1523b3;};}function handleError(_0x350e0a,_0x20019c){_0x20019c=_0x20019c||0x1f4;return function(_0x4ac6d8){logger[_0x9ab3('0x25')](_0x4ac6d8[_0x9ab3('0x26')]);if(_0x4ac6d8[_0x9ab3('0x27')]){delete _0x4ac6d8[_0x9ab3('0x27')];}_0x350e0a[_0x9ab3('0x17')](_0x20019c)[_0x9ab3('0x28')](_0x4ac6d8);};}exports[_0x9ab3('0x29')]=function(_0x3aa387,_0x562d8b){var _0x3d5091={},_0x3a7db6={},_0x3c8773={'count':0x0,'rows':[]};var _0x47252a=_['map'](db['VtigerAccount'][_0x9ab3('0x2a')],function(_0x227e29){return{'name':_0x227e29[_0x9ab3('0x2b')],'type':_0x227e29[_0x9ab3('0x2c')][_0x9ab3('0x2d')]};});_0x3a7db6[_0x9ab3('0x2e')]=_[_0x9ab3('0x2f')](_0x47252a,_0x9ab3('0x27'));_0x3a7db6[_0x9ab3('0x30')]=_[_0x9ab3('0x31')](_0x3aa387[_0x9ab3('0x30')]);_0x3a7db6[_0x9ab3('0x32')]=_[_0x9ab3('0x33')](_0x3a7db6[_0x9ab3('0x2e')],_0x3a7db6['query']);_0x3d5091[_0x9ab3('0x34')]=_[_0x9ab3('0x33')](_0x3a7db6[_0x9ab3('0x2e')],qs['fields'](_0x3aa387[_0x9ab3('0x30')]['fields']));_0x3d5091['attributes']=_0x3d5091[_0x9ab3('0x34')][_0x9ab3('0x35')]?_0x3d5091[_0x9ab3('0x34')]:_0x3a7db6[_0x9ab3('0x2e')];if(!_0x3aa387[_0x9ab3('0x30')][_0x9ab3('0x36')](_0x9ab3('0x37'))){_0x3d5091[_0x9ab3('0x1b')]=qs[_0x9ab3('0x1b')](_0x3aa387[_0x9ab3('0x30')]['limit']);_0x3d5091[_0x9ab3('0x1a')]=qs[_0x9ab3('0x1a')](_0x3aa387[_0x9ab3('0x30')][_0x9ab3('0x1a')]);}_0x3d5091[_0x9ab3('0x38')]=qs[_0x9ab3('0x39')](_0x3aa387['query'][_0x9ab3('0x39')]);_0x3d5091[_0x9ab3('0x3a')]=qs[_0x9ab3('0x32')](_[_0x9ab3('0x3b')](_0x3aa387[_0x9ab3('0x30')],_0x3a7db6['filters']),_0x47252a);if(_0x3aa387[_0x9ab3('0x30')][_0x9ab3('0x3c')]){_0x3d5091[_0x9ab3('0x3a')]=_[_0x9ab3('0x3d')](_0x3d5091[_0x9ab3('0x3a')],{'$or':_[_0x9ab3('0x2f')](_0x47252a,function(_0x162cb9){if(_0x162cb9[_0x9ab3('0x2c')]!==_0x9ab3('0x3e')){var _0x5e590b={};_0x5e590b[_0x162cb9['name']]={'$like':'%'+_0x3aa387[_0x9ab3('0x30')]['filter']+'%'};return _0x5e590b;}})});}_0x3d5091=_[_0x9ab3('0x3d')]({},_0x3d5091,_0x3aa387[_0x9ab3('0x3f')]);var _0x9bc4b5={'where':_0x3d5091[_0x9ab3('0x3a')]};return db[_0x9ab3('0x40')][_0x9ab3('0x1d')](_0x9bc4b5)[_0x9ab3('0x23')](function(_0x49b1c3){_0x3c8773[_0x9ab3('0x1d')]=_0x49b1c3;if(_0x3aa387[_0x9ab3('0x30')][_0x9ab3('0x41')]){_0x3d5091['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x9ab3('0x42')](_0x3d5091);})[_0x9ab3('0x23')](function(_0x10f1f1){_0x3c8773['rows']=_0x10f1f1;return _0x3c8773;})[_0x9ab3('0x23')](respondWithFilteredResult(_0x562d8b,_0x3d5091))['catch'](handleError(_0x562d8b,null));};exports['show']=function(_0x528002,_0x5595e4){var _0x253e2a={'raw':![],'where':{'id':_0x528002[_0x9ab3('0x43')]['id']}},_0x5d0794={};_0x5d0794[_0x9ab3('0x2e')]=_[_0x9ab3('0x31')](db[_0x9ab3('0x40')]['rawAttributes']);_0x5d0794[_0x9ab3('0x30')]=_[_0x9ab3('0x31')](_0x528002[_0x9ab3('0x30')]);_0x5d0794[_0x9ab3('0x32')]=_[_0x9ab3('0x33')](_0x5d0794[_0x9ab3('0x2e')],_0x5d0794[_0x9ab3('0x30')]);_0x253e2a[_0x9ab3('0x34')]=_['intersection'](_0x5d0794[_0x9ab3('0x2e')],qs[_0x9ab3('0x44')](_0x528002[_0x9ab3('0x30')]['fields']));_0x253e2a['attributes']=_0x253e2a[_0x9ab3('0x34')][_0x9ab3('0x35')]?_0x253e2a['attributes']:_0x5d0794['model'];if(_0x528002[_0x9ab3('0x30')]['includeAll']){_0x253e2a[_0x9ab3('0x45')]=[{'all':!![]}];}_0x253e2a=_[_0x9ab3('0x3d')]({},_0x253e2a,_0x528002[_0x9ab3('0x3f')]);return db[_0x9ab3('0x40')]['find'](_0x253e2a)[_0x9ab3('0x23')](handleEntityNotFound(_0x5595e4,null))[_0x9ab3('0x23')](respondWithResult(_0x5595e4,null))[_0x9ab3('0x46')](handleError(_0x5595e4,null));};exports[_0x9ab3('0x47')]=function(_0x300585,_0x547fd6){return db[_0x9ab3('0x40')]['create'](_0x300585[_0x9ab3('0x48')],{})[_0x9ab3('0x23')](respondWithResult(_0x547fd6,0xc9))[_0x9ab3('0x46')](handleError(_0x547fd6,null));};exports[_0x9ab3('0x22')]=function(_0x723f08,_0x4f6e42){if(_0x723f08[_0x9ab3('0x48')]['id']){delete _0x723f08[_0x9ab3('0x48')]['id'];}return db[_0x9ab3('0x40')][_0x9ab3('0x49')]({'where':{'id':_0x723f08[_0x9ab3('0x43')]['id']}})[_0x9ab3('0x23')](handleEntityNotFound(_0x4f6e42,null))[_0x9ab3('0x23')](saveUpdates(_0x723f08[_0x9ab3('0x48')],null))[_0x9ab3('0x23')](respondWithResult(_0x4f6e42,null))[_0x9ab3('0x46')](handleError(_0x4f6e42,null));};exports[_0x9ab3('0x24')]=function(_0x10698a,_0x36ad40){return db['VtigerAccount'][_0x9ab3('0x49')]({'where':{'id':_0x10698a[_0x9ab3('0x43')]['id']}})[_0x9ab3('0x23')](handleEntityNotFound(_0x36ad40,null))[_0x9ab3('0x23')](removeEntity(_0x36ad40,null))[_0x9ab3('0x46')](handleError(_0x36ad40,null));};exports[_0x9ab3('0x4a')]=function(_0x1e35d1,_0x50a965,_0xf21776){var _0x491682={};var _0xb704b0={};var _0x57b20d;var _0x4f3e39;return db[_0x9ab3('0x40')][_0x9ab3('0x4b')]({'where':{'id':_0x1e35d1[_0x9ab3('0x43')]['id']}})[_0x9ab3('0x23')](handleEntityNotFound(_0x50a965,null))['then'](function(_0x38aa15){if(_0x38aa15){_0x57b20d=_0x38aa15;_0xb704b0[_0x9ab3('0x2e')]=_[_0x9ab3('0x31')](db[_0x9ab3('0x4c')][_0x9ab3('0x2a')]);_0xb704b0[_0x9ab3('0x30')]=_['keys'](_0x1e35d1[_0x9ab3('0x30')]);_0xb704b0[_0x9ab3('0x32')]=_['intersection'](_0xb704b0['model'],_0xb704b0[_0x9ab3('0x30')]);_0x491682[_0x9ab3('0x34')]=_[_0x9ab3('0x33')](_0xb704b0['model'],qs[_0x9ab3('0x44')](_0x1e35d1[_0x9ab3('0x30')][_0x9ab3('0x44')]));_0x491682[_0x9ab3('0x34')]=_0x491682[_0x9ab3('0x34')]['length']?_0x491682['attributes']:_0xb704b0['model'];_0x491682[_0x9ab3('0x38')]=qs['sort'](_0x1e35d1[_0x9ab3('0x30')][_0x9ab3('0x39')]);_0x491682['where']=qs[_0x9ab3('0x32')](_[_0x9ab3('0x3b')](_0x1e35d1[_0x9ab3('0x30')],_0xb704b0['filters']));if(_0x1e35d1[_0x9ab3('0x30')][_0x9ab3('0x3c')]){_0x491682['where']=_['merge'](_0x491682[_0x9ab3('0x3a')],{'$or':_[_0x9ab3('0x2f')](_0x491682[_0x9ab3('0x34')],function(_0x1fde1b){var _0x215f63={};_0x215f63[_0x1fde1b]={'$like':'%'+_0x1e35d1[_0x9ab3('0x30')]['filter']+'%'};return _0x215f63;})});}_0x491682=_[_0x9ab3('0x3d')]({},_0x491682,_0x1e35d1['options']);return _0x57b20d[_0x9ab3('0x4a')](_0x491682);}})['then'](function(_0x261c6e){if(_0x261c6e){_0x4f3e39=_0x261c6e[_0x9ab3('0x35')];if(!_0x1e35d1[_0x9ab3('0x30')][_0x9ab3('0x36')](_0x9ab3('0x37'))){_0x491682[_0x9ab3('0x1b')]=qs['limit'](_0x1e35d1[_0x9ab3('0x30')][_0x9ab3('0x1b')]);_0x491682[_0x9ab3('0x1a')]=qs[_0x9ab3('0x1a')](_0x1e35d1['query'][_0x9ab3('0x1a')]);}return _0x57b20d[_0x9ab3('0x4a')](_0x491682);}})['then'](function(_0x4e90c0){if(_0x4e90c0){return _0x4e90c0?{'count':_0x4f3e39,'rows':_0x4e90c0}:null;}})[_0x9ab3('0x23')](respondWithResult(_0x50a965,null))[_0x9ab3('0x46')](handleError(_0x50a965,null));};exports[_0x9ab3('0x4d')]=function(_0x5cd69b,_0x1847fc,_0x359fba){if(_0x5cd69b['body']['id']){delete _0x5cd69b[_0x9ab3('0x48')]['id'];}return db['VtigerAccount'][_0x9ab3('0x4b')]({'where':{'id':_0x5cd69b[_0x9ab3('0x43')]['id']}})['then'](handleEntityNotFound(_0x1847fc,null))['then'](function(_0x282b84){if(_0x282b84){_0x5cd69b['body'][_0x9ab3('0x4e')]=_0x282b84['id'];_0x5cd69b['body'][_0x9ab3('0x4f')]=integrations[_0x9ab3('0x50')](_0x5cd69b[_0x9ab3('0x48')][_0x9ab3('0x51')],_0x5cd69b['body'][_0x9ab3('0x2c')]);_0x5cd69b[_0x9ab3('0x48')][_0x9ab3('0x52')]=integrations[_0x9ab3('0x53')](_0x5cd69b[_0x9ab3('0x48')][_0x9ab3('0x51')],_0x5cd69b[_0x9ab3('0x48')][_0x9ab3('0x2c')]);return db['VtigerConfiguration'][_0x9ab3('0x47')](_0x5cd69b['body'],{'include':[{'model':db[_0x9ab3('0x54')],'as':_0x9ab3('0x4f')},{'model':db[_0x9ab3('0x54')],'as':_0x9ab3('0x52')}]});}return null;})[_0x9ab3('0x23')](respondWithResult(_0x1847fc,null))[_0x9ab3('0x46')](handleError(_0x1847fc,null));};var md5=require('md5');exports['getFields']=function(_0x21410e,_0x9c19c4,_0x28b297){var _0x17fc05=null;var _0x47bbfc=null;var _0x42155a=null;var _0x31f65c=null;var _0x350eb9='';return db['VtigerAccount'][_0x9ab3('0x4b')]({'where':{'id':_0x21410e[_0x9ab3('0x43')]['id']},'attributes':['id',_0x9ab3('0x27'),_0x9ab3('0x55'),'description',_0x9ab3('0x56'),_0x9ab3('0x57'),_0x9ab3('0x58'),_0x9ab3('0x59')]})[_0x9ab3('0x23')](handleEntityNotFound(_0x9c19c4,null))[_0x9ab3('0x23')](function(_0x290336){if(_0x290336){_0x17fc05=_0x290336[_0x9ab3('0x55')];_0x47bbfc=_0x290336[_0x9ab3('0x59')];_0x42155a=_0x290336[_0x9ab3('0x56')];_0x350eb9=_0x290336[_0x9ab3('0x57')];var _0x3d8c06=_0x350eb9[_0x9ab3('0x5a')](-0x1);if(_0x3d8c06==='/'){_0x350eb9=_0x350eb9[_0x9ab3('0x5b')](0x0,_0x350eb9[_0x9ab3('0x5c')](_0x3d8c06));}_0x31f65c=util['format'](_0x9ab3('0x5d'),_0x350eb9);var _0x3de22b={'method':'GET','uri':_0x31f65c,'qs':{'operation':_0x9ab3('0x5e'),'username':_0x290336[_0x9ab3('0x55')]},'json':!![]};return rp(_0x3de22b);}})['then'](function(_0x36c73d){if(_0x36c73d['success']){var _0x47e40d={'method':_0x9ab3('0x5f'),'uri':_0x31f65c,'form':{'operation':'login','username':_0x17fc05,'accessKey':md5(_0x36c73d['result'][_0x9ab3('0x60')]+_0x47bbfc)},'json':!![]};return rp(_0x47e40d);}})[_0x9ab3('0x23')](function(_0x35122f){if(_0x35122f['success']){var _0x46b5a8={'method':'GET','uri':_0x31f65c,'qs':{'operation':_0x9ab3('0x61'),'username':_0x17fc05,'sessionName':_0x35122f[_0x9ab3('0x62')][_0x9ab3('0x63')],'elementType':_0x42155a},'json':!![]};return rp(_0x46b5a8);}})[_0x9ab3('0x23')](function(_0x150acd){if(_0x150acd[_0x9ab3('0x64')]){var _0x10eb91=[_0x9ab3('0x65'),_0x9ab3('0x66'),_0x9ab3('0x67')];_['remove'](_0x150acd['result'][_0x9ab3('0x44')],function(_0x3bd9b0){return _0x10eb91['includes'](_0x3bd9b0[_0x9ab3('0x2c')][_0x9ab3('0x27')]);});_['remove'](_0x150acd['result'][_0x9ab3('0x44')],function(_0x56d102){return _0x56d102[_0x9ab3('0x68')]===_0x9ab3('0x69');});return{'count':_0x150acd[_0x9ab3('0x62')]['fields'][_0x9ab3('0x35')],'rows':_['map'](_0x150acd[_0x9ab3('0x62')][_0x9ab3('0x44')],function(_0x1b569c){return{'id':_0x1b569c[_0x9ab3('0x27')],'name':_0x1b569c['label'],'custom':_['startsWith'](_0x1b569c[_0x9ab3('0x27')],_0x9ab3('0x6a'))?!![]:![],'options':_0x1b569c[_0x9ab3('0x2c')]['name']===_0x9ab3('0x6b')&&_0x1b569c[_0x9ab3('0x2c')][_0x9ab3('0x6c')][_0x9ab3('0x35')]>0x0?_[_0x9ab3('0x2f')](_0x1b569c['type'][_0x9ab3('0x6c')],function(_0x38c472){return{'name':_0x38c472[_0x9ab3('0x6d')],'value':_0x38c472[_0x9ab3('0x6e')]};}):[]};})};}})[_0x9ab3('0x23')](respondWithResult(_0x9c19c4,null))['catch'](function(_0x5e6663){console[_0x9ab3('0x6f')](_0x9ab3('0x70')+_0x5e6663);var _0x34a28c=_0x21410e[_0x9ab3('0x30')][_0x9ab3('0x71')]?0x1f4:_0x5e6663[_0x9ab3('0x72')]||0x1f4;logger['error'](_0x9ab3('0x73'),_0x9ab3('0x74'),_0x34a28c,JSON['stringify'](_0x5e6663));delete _0x5e6663[_0x9ab3('0x27')];if(_0x34a28c===0x191){_0x34a28c=0x190;}_0x9c19c4[_0x9ab3('0x17')](_0x34a28c)['send'](_0x21410e['query'][_0x9ab3('0x71')]?{'message':_0x9ab3('0x75'),'statusCode':_0x5e6663[_0x9ab3('0x72')]}:_0x5e6663);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5a72fc0..4e5b92c 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 _0x714d=['path','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise'];(function(_0x481370,_0x846228){var _0x785944=function(_0x183323){while(--_0x183323){_0x481370['push'](_0x481370['shift']());}};_0x785944(++_0x846228);}(_0x714d,0x11b));var _0xd714=function(_0x1948c7,_0x1675e1){_0x1948c7=_0x1948c7-0x0;var _0x411e7f=_0x714d[_0x1948c7];return _0x411e7f;};'use strict';var _=require('lodash');var util=require(_0xd714('0x0'));var logger=require(_0xd714('0x1'))(_0xd714('0x2'));var moment=require('moment');var BPromise=require(_0xd714('0x3'));var rp=require(_0xd714('0x4'));var fs=require('fs');var path=require(_0xd714('0x5'));var rimraf=require('rimraf');var config=require(_0xd714('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xd714('0x7'));module[_0xd714('0x8')]=function(_0x185c97,_0x29b357){return _0x185c97[_0xd714('0x9')](_0xd714('0xa'),attributes,{'tableName':_0xd714('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c52=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x1ea5af,_0x1b2eb1){var _0x2b31de=function(_0x4deec5){while(--_0x4deec5){_0x1ea5af['push'](_0x1ea5af['shift']());}};_0x2b31de(++_0x1b2eb1);}(_0x7c52,0x12d));var _0x27c5=function(_0x12d60f,_0x398661){_0x12d60f=_0x12d60f-0x0;var _0x3e4107=_0x7c52[_0x12d60f];return _0x3e4107;};'use strict';var _=require(_0x27c5('0x0'));var util=require(_0x27c5('0x1'));var logger=require(_0x27c5('0x2'))(_0x27c5('0x3'));var moment=require(_0x27c5('0x4'));var BPromise=require(_0x27c5('0x5'));var rp=require(_0x27c5('0x6'));var fs=require('fs');var path=require(_0x27c5('0x7'));var rimraf=require(_0x27c5('0x8'));var config=require(_0x27c5('0x9'));var attributes=require(_0x27c5('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3a1f4f,_0x35e71e){return _0x3a1f4f[_0x27c5('0xb')]('VtigerAccount',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 0ea83bc..63fd3fe 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 _0x04b8=['jayson/promise','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','map','model','include','debug','catch','ShowVtigerAccount','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x137e04,_0x3c0799){var _0x4c6762=function(_0x45f489){while(--_0x45f489){_0x137e04['push'](_0x137e04['shift']());}};_0x4c6762(++_0x3c0799);}(_0x04b8,0x159));var _0x804b=function(_0x47d6b5,_0x1abfb8){_0x47d6b5=_0x47d6b5-0x0;var _0xc7e7f6=_0x04b8[_0x47d6b5];return _0xc7e7f6;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var moment=require('moment');var BPromise=require(_0x804b('0x1'));var rs=require(_0x804b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x804b('0x3'))['db'];var utils=require(_0x804b('0x4'));var logger=require('../../config/logger')(_0x804b('0x5'));var config=require(_0x804b('0x6'));var jayson=require(_0x804b('0x7'));var client=jayson['client'][_0x804b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c5404,_0x476262,_0x50826d){return new BPromise(function(_0x27e950,_0x1071b4){return client['request'](_0x3c5404,_0x50826d)[_0x804b('0x9')](function(_0x336325){logger[_0x804b('0xa')](_0x804b('0xb'),_0x476262,_0x804b('0xc'));logger['debug'](_0x804b('0xd'),_0x476262,_0x804b('0xc'),JSON[_0x804b('0xe')](_0x336325));if(_0x336325[_0x804b('0xf')]){if(_0x336325[_0x804b('0xf')][_0x804b('0x10')]===0x1f4){logger['error'](_0x804b('0xb'),_0x476262,_0x336325['error'][_0x804b('0x11')]);return _0x1071b4(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}logger[_0x804b('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x476262,_0x336325[_0x804b('0xf')][_0x804b('0x11')]);return _0x27e950(_0x336325[_0x804b('0xf')][_0x804b('0x11')]);}else{logger['info'](_0x804b('0xb'),_0x476262,_0x804b('0xc'));_0x27e950(_0x336325['result'][_0x804b('0x11')]);}})['catch'](function(_0x2c90b9){logger[_0x804b('0xf')](_0x804b('0xb'),_0x476262,_0x2c90b9);_0x1071b4(_0x2c90b9);});});}exports[_0x804b('0x12')]=function(_0x3a05c0){var _0x5a0a82=this;return new Promise(function(_0x871d6c,_0x50b4fe){return db[_0x804b('0x13')][_0x804b('0x14')]({'raw':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x16')]||null:null,'attributes':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x17')]||null:null,'limit':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')][_0x804b('0x18')]||null:null,'include':_0x3a05c0[_0x804b('0x15')]?_0x3a05c0[_0x804b('0x15')]['include']?_[_0x804b('0x19')](_0x3a05c0[_0x804b('0x15')]['include'],function(_0x44a921){return{'model':db[_0x44a921[_0x804b('0x1a')]],'as':_0x44a921['as'],'attributes':_0x44a921[_0x804b('0x17')],'include':_0x44a921[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x44a921['include'],function(_0x2de812){return{'model':db[_0x2de812[_0x804b('0x1a')]],'as':_0x2de812['as'],'attributes':_0x2de812['attributes'],'include':_0x2de812[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x2de812[_0x804b('0x1b')],function(_0x27d5ec){return{'model':db[_0x27d5ec[_0x804b('0x1a')]],'as':_0x27d5ec['as'],'attributes':_0x27d5ec['attributes']};}):[]};}):[]};}):[]:[]})[_0x804b('0x9')](function(_0x22f822){logger[_0x804b('0xa')](_0x804b('0x12'),_0x3a05c0);logger[_0x804b('0x1c')]('GetVtigerAccount',_0x3a05c0,JSON[_0x804b('0xe')](_0x22f822));_0x871d6c(_0x22f822);})[_0x804b('0x1d')](function(_0x410871){logger['error'](_0x804b('0x12'),_0x410871[_0x804b('0x11')],_0x3a05c0);_0x50b4fe(_0x5a0a82[_0x804b('0xf')](0x1f4,_0x410871['message']));});});};exports[_0x804b('0x1e')]=function(_0x471c04){var _0x5e8f85=this;return new Promise(function(_0x391376,_0x37dd3e){return db[_0x804b('0x13')][_0x804b('0x1f')]({'raw':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x16')]||null:null,'attributes':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x17')]||null:null,'include':_0x471c04[_0x804b('0x15')]?_0x471c04[_0x804b('0x15')][_0x804b('0x1b')]?_[_0x804b('0x19')](_0x471c04[_0x804b('0x15')][_0x804b('0x1b')],function(_0x34d5d0){return{'model':db[_0x34d5d0[_0x804b('0x1a')]],'as':_0x34d5d0['as'],'attributes':_0x34d5d0[_0x804b('0x17')],'include':_0x34d5d0[_0x804b('0x1b')]?_[_0x804b('0x19')](_0x34d5d0[_0x804b('0x1b')],function(_0xf47023){return{'model':db[_0xf47023[_0x804b('0x1a')]],'as':_0xf47023['as'],'attributes':_0xf47023[_0x804b('0x17')],'include':_0xf47023[_0x804b('0x1b')]?_[_0x804b('0x19')](_0xf47023[_0x804b('0x1b')],function(_0x35150b){return{'model':db[_0x35150b['model']],'as':_0x35150b['as'],'attributes':_0x35150b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3da331){logger[_0x804b('0xa')](_0x804b('0x1e'),_0x471c04);logger['debug']('ShowVtigerAccount',_0x471c04,JSON['stringify'](_0x3da331));_0x391376(_0x3da331);})[_0x804b('0x1d')](function(_0x1aaa47){logger[_0x804b('0xf')](_0x804b('0x1e'),_0x1aaa47[_0x804b('0x11')],_0x471c04);_0x37dd3e(_0x5e8f85[_0x804b('0xf')](0x1f4,_0x1aaa47[_0x804b('0x11')]));});});}; \ No newline at end of file +var _0x91a7=['VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','ShowVtigerAccount','VtigerAccount','find','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0x91a7,0xe7));var _0x791a=function(_0x4cd7f2,_0x5e6d66){_0x4cd7f2=_0x4cd7f2-0x0;var _0x2bcfe5=_0x91a7[_0x4cd7f2];return _0x2bcfe5;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});}exports[_0x791a('0x13')]=function(_0x52941d){var _0x4a84ee=this;return new Promise(function(_0x588d00,_0x40f0d3){return db['VtigerAccount']['findAll']({'raw':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x15')]===undefined?!![]:![]:!![],'where':_0x52941d[_0x791a('0x14')]?_0x52941d['options'][_0x791a('0x16')]||null:null,'attributes':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x17')]||null:null,'limit':_0x52941d['options']?_0x52941d[_0x791a('0x14')][_0x791a('0x18')]||null:null,'include':_0x52941d[_0x791a('0x14')]?_0x52941d[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x52941d[_0x791a('0x14')][_0x791a('0x19')],function(_0x323c6a){return{'model':db[_0x323c6a[_0x791a('0x1b')]],'as':_0x323c6a['as'],'attributes':_0x323c6a[_0x791a('0x17')],'include':_0x323c6a['include']?_[_0x791a('0x1a')](_0x323c6a[_0x791a('0x19')],function(_0x380329){return{'model':db[_0x380329[_0x791a('0x1b')]],'as':_0x380329['as'],'attributes':_0x380329['attributes'],'include':_0x380329[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x380329['include'],function(_0xdfa84f){return{'model':db[_0xdfa84f[_0x791a('0x1b')]],'as':_0xdfa84f['as'],'attributes':_0xdfa84f[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29194d){logger[_0x791a('0xa')](_0x791a('0x13'),_0x52941d);logger[_0x791a('0xc')](_0x791a('0x13'),_0x52941d,JSON[_0x791a('0xd')](_0x29194d));_0x588d00(_0x29194d);})[_0x791a('0x12')](function(_0x889534){logger['error'](_0x791a('0x13'),_0x889534[_0x791a('0x10')],_0x52941d);_0x40f0d3(_0x4a84ee[_0x791a('0xe')](0x1f4,_0x889534['message']));});});};exports[_0x791a('0x1c')]=function(_0x5df656){var _0xc59f5e=this;return new Promise(function(_0x2e4ec8,_0xcde862){return db[_0x791a('0x1d')][_0x791a('0x1e')]({'raw':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x16')]||null:null,'attributes':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')]['attributes']||null:null,'include':_0x5df656[_0x791a('0x14')]?_0x5df656[_0x791a('0x14')][_0x791a('0x19')]?_[_0x791a('0x1a')](_0x5df656[_0x791a('0x14')]['include'],function(_0x305836){return{'model':db[_0x305836[_0x791a('0x1b')]],'as':_0x305836['as'],'attributes':_0x305836[_0x791a('0x17')],'include':_0x305836[_0x791a('0x19')]?_[_0x791a('0x1a')](_0x305836['include'],function(_0xd5609){return{'model':db[_0xd5609['model']],'as':_0xd5609['as'],'attributes':_0xd5609[_0x791a('0x17')],'include':_0xd5609['include']?_['map'](_0xd5609[_0x791a('0x19')],function(_0x404530){return{'model':db[_0x404530[_0x791a('0x1b')]],'as':_0x404530['as'],'attributes':_0x404530[_0x791a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x791a('0x9')](function(_0x3f46be){logger[_0x791a('0xa')]('ShowVtigerAccount',_0x5df656);logger[_0x791a('0xc')]('ShowVtigerAccount',_0x5df656,JSON[_0x791a('0xd')](_0x3f46be));_0x2e4ec8(_0x3f46be);})['catch'](function(_0x25e8cc){logger[_0x791a('0xe')]('ShowVtigerAccount',_0x25e8cc[_0x791a('0x10')],_0x5df656);_0xcde862(_0xc59f5e[_0x791a('0xe')](0x1f4,_0x25e8cc['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 27d5ea7..048359a 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 _0x6152=['get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','getDescriptions','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0x6152,0x15f));var _0x2615=function(_0x5e0c6f,_0x389ac0){_0x5e0c6f=_0x5e0c6f-0x0;var _0x29e491=_0x6152[_0x5e0c6f];return _0x29e491;};'use strict';var multer=require(_0x2615('0x0'));var util=require('util');var path=require(_0x2615('0x1'));var timeout=require(_0x2615('0x2'));var express=require(_0x2615('0x3'));var router=express[_0x2615('0x4')]();var fs_extra=require(_0x2615('0x5'));var auth=require(_0x2615('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2615('0x7'));var controller=require(_0x2615('0x8'));router[_0x2615('0x9')]('/',auth[_0x2615('0xa')](),controller[_0x2615('0xb')]);router[_0x2615('0x9')](_0x2615('0xc'),auth[_0x2615('0xa')](),controller[_0x2615('0xd')]);router[_0x2615('0x9')](_0x2615('0xe'),auth[_0x2615('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x2615('0xa')](),controller[_0x2615('0xf')]);router[_0x2615('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2615('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2615('0x11')](_0x2615('0xc'),auth[_0x2615('0xa')](),controller['update']);router['delete']('/:id',auth[_0x2615('0xa')](),controller[_0x2615('0x12')]);module[_0x2615('0x13')]=router; \ No newline at end of file +var _0xa121=['./intVtigerConfiguration.controller','isAuthenticated','index','show','/:id/fields','getFields','get','/:id/subjects','getSubjects','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa121,0xac));var _0x1a12=function(_0x79a921,_0x1fa8ab){_0x79a921=_0x79a921-0x0;var _0x1c1518=_0xa121[_0x79a921];return _0x1c1518;};'use strict';var multer=require(_0x1a12('0x0'));var util=require(_0x1a12('0x1'));var path=require(_0x1a12('0x2'));var timeout=require(_0x1a12('0x3'));var express=require(_0x1a12('0x4'));var router=express[_0x1a12('0x5')]();var fs_extra=require(_0x1a12('0x6'));var auth=require(_0x1a12('0x7'));var interaction=require(_0x1a12('0x8'));var config=require(_0x1a12('0x9'));var controller=require(_0x1a12('0xa'));router['get']('/',auth[_0x1a12('0xb')](),controller[_0x1a12('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1a12('0xd')]);router['get'](_0x1a12('0xe'),auth[_0x1a12('0xb')](),controller[_0x1a12('0xf')]);router[_0x1a12('0x10')](_0x1a12('0x11'),auth['isAuthenticated'](),controller[_0x1a12('0x12')]);router[_0x1a12('0x10')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x1a12('0x13')]('/',auth[_0x1a12('0xb')](),controller['create']);router[_0x1a12('0x14')](_0x1a12('0x15'),auth[_0x1a12('0xb')](),controller[_0x1a12('0x16')]);router[_0x1a12('0x17')](_0x1a12('0x15'),auth['isAuthenticated'](),controller[_0x1a12('0x18')]);module[_0x1a12('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 048777f..3813aaa 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 _0x1120=['sequelize','exports','STRING'];(function(_0xd2417f,_0x490fb9){var _0x5f172e=function(_0x100c0e){while(--_0x100c0e){_0xd2417f['push'](_0xd2417f['shift']());}};_0x5f172e(++_0x490fb9);}(_0x1120,0x198));var _0x0112=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x1120[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x0112('0x0'));module[_0x0112('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0112('0x2')]}}; \ No newline at end of file +var _0x4f53=['sequelize','exports','STRING'];(function(_0x2e293a,_0x2bccfa){var _0x1524a1=function(_0x5ec7aa){while(--_0x5ec7aa){_0x2e293a['push'](_0x2e293a['shift']());}};_0x1524a1(++_0x2bccfa);}(_0x4f53,0x19b));var _0x34f5=function(_0x5acfd8,_0x27446d){_0x5acfd8=_0x5acfd8-0x0;var _0x3f2a39=_0x4f53[_0x5acfd8];return _0x3f2a39;};'use strict';var Sequelize=require(_0x34f5('0x0'));module[_0x34f5('0x1')]={'name':{'type':Sequelize[_0x34f5('0x2')]},'description':{'type':Sequelize[_0x34f5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4009e93..2f3558c 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 _0xa78e=['squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','sendStatus','error','name','send','index','VtigerConfiguration','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','limit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','length','options','find','create','body','update','params','destroy','getFields','findOne','VtigerField','sort','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x229eec,_0x5e64eb){var _0xb80e68=function(_0x3feb12){while(--_0x3feb12){_0x229eec['push'](_0x229eec['shift']());}};_0xb80e68(++_0x5e64eb);}(_0xa78e,0x1e1));var _0xea78=function(_0x17d24f,_0x37f369){_0x17d24f=_0x17d24f-0x0;var _0x311afa=_0xa78e[_0x17d24f];return _0x311afa;};'use strict';var emlformat=require(_0xea78('0x0'));var rimraf=require(_0xea78('0x1'));var zipdir=require(_0xea78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea78('0x3'));var BPromise=require(_0xea78('0x4'));var Mustache=require(_0xea78('0x5'));var util=require('util');var path=require(_0xea78('0x6'));var sox=require(_0xea78('0x7'));var csv=require(_0xea78('0x8'));var ejs=require(_0xea78('0x9'));var fs=require('fs');var fs_extra=require(_0xea78('0xa'));var _=require('lodash');var squel=require(_0xea78('0xb'));var crypto=require('crypto');var jsforce=require(_0xea78('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xea78('0xd'));var Papa=require(_0xea78('0xe'));var Redis=require(_0xea78('0xf'));var authService=require(_0xea78('0x10'));var qs=require(_0xea78('0x11'));var as=require(_0xea78('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea78('0x13'))('api');var utils=require(_0xea78('0x14'));var config=require(_0xea78('0x15'));var licenseUtil=require(_0xea78('0x16'));var db=require(_0xea78('0x17'))['db'];function respondWithStatusCode(_0x30d805,_0x83e704){_0x83e704=_0x83e704||0xcc;return function(_0x41598f){if(_0x41598f){return _0x30d805['sendStatus'](_0x83e704);}return _0x30d805[_0xea78('0x18')](_0x83e704)[_0xea78('0x19')]();};}function respondWithResult(_0x2e53d6,_0x2bde33){_0x2bde33=_0x2bde33||0xc8;return function(_0x2f51ae){if(_0x2f51ae){return _0x2e53d6[_0xea78('0x18')](_0x2bde33)['json'](_0x2f51ae);}};}function respondWithFilteredResult(_0x18aa3a,_0x15c1c8){return function(_0x457835){if(_0x457835){var _0x3ef2a4=typeof _0x15c1c8['offset']===_0xea78('0x1a')&&typeof _0x15c1c8['limit']==='undefined';var _0x15c7e1=_0x457835[_0xea78('0x1b')];var _0x5d0d10=_0x3ef2a4?0x0:_0x15c1c8[_0xea78('0x1c')];var _0x187dbd=_0x3ef2a4?_0x457835[_0xea78('0x1b')]:_0x15c1c8[_0xea78('0x1c')]+_0x15c1c8['limit'];var _0x26a3e1;if(_0x187dbd>=_0x15c7e1){_0x187dbd=_0x15c7e1;_0x26a3e1=0xc8;}else{_0x26a3e1=0xce;}_0x18aa3a['status'](_0x26a3e1);return _0x18aa3a[_0xea78('0x1d')](_0xea78('0x1e'),_0x5d0d10+'-'+_0x187dbd+'/'+_0x15c7e1)[_0xea78('0x1f')](_0x457835);}return null;};}function patchUpdates(_0x264f21){return function(_0x4b7325){try{jsonpatch[_0xea78('0x20')](_0x4b7325,_0x264f21,!![]);}catch(_0x3bd475){return BPromise[_0xea78('0x21')](_0x3bd475);}return _0x4b7325[_0xea78('0x22')]();};}function saveUpdates(_0x4e6cb6,_0x4f3754){return function(_0xa61bcc){if(_0xa61bcc){return _0xa61bcc['update'](_0x4e6cb6)['then'](function(_0x2d20c3){return _0x2d20c3;});}return null;};}function removeEntity(_0x206b30,_0x3a186f){return function(_0x12f0df){if(_0x12f0df){return _0x12f0df['destroy']()[_0xea78('0x23')](function(){_0x206b30[_0xea78('0x18')](0xcc)[_0xea78('0x19')]();});}};}function handleEntityNotFound(_0x15b3cf,_0x2b930e){return function(_0x428615){if(!_0x428615){_0x15b3cf[_0xea78('0x24')](0x194);}return _0x428615;};}function handleError(_0xf5485e,_0x274afe){_0x274afe=_0x274afe||0x1f4;return function(_0x79adb){logger[_0xea78('0x25')](_0x79adb['stack']);if(_0x79adb[_0xea78('0x26')]){delete _0x79adb[_0xea78('0x26')];}_0xf5485e[_0xea78('0x18')](_0x274afe)[_0xea78('0x27')](_0x79adb);};}exports[_0xea78('0x28')]=function(_0x4fd507,_0x2ea509){var _0x1c5951={},_0x2bf138={},_0x3ee224={'count':0x0,'rows':[]};var _0x33cd72=_['map'](db[_0xea78('0x29')]['rawAttributes'],function(_0x3af49f){return{'name':_0x3af49f[_0xea78('0x2a')],'type':_0x3af49f['type'][_0xea78('0x2b')]};});_0x2bf138[_0xea78('0x2c')]=_[_0xea78('0x2d')](_0x33cd72,_0xea78('0x26'));_0x2bf138[_0xea78('0x2e')]=_[_0xea78('0x2f')](_0x4fd507['query']);_0x2bf138[_0xea78('0x30')]=_[_0xea78('0x31')](_0x2bf138[_0xea78('0x2c')],_0x2bf138['query']);_0x1c5951[_0xea78('0x32')]=_['intersection'](_0x2bf138[_0xea78('0x2c')],qs['fields'](_0x4fd507[_0xea78('0x2e')][_0xea78('0x33')]));_0x1c5951[_0xea78('0x32')]=_0x1c5951[_0xea78('0x32')]['length']?_0x1c5951[_0xea78('0x32')]:_0x2bf138[_0xea78('0x2c')];if(!_0x4fd507[_0xea78('0x2e')]['hasOwnProperty']('nolimit')){_0x1c5951[_0xea78('0x34')]=qs[_0xea78('0x34')](_0x4fd507[_0xea78('0x2e')][_0xea78('0x34')]);_0x1c5951[_0xea78('0x1c')]=qs[_0xea78('0x1c')](_0x4fd507['query'][_0xea78('0x1c')]);}_0x1c5951[_0xea78('0x35')]=qs['sort'](_0x4fd507[_0xea78('0x2e')]['sort']);_0x1c5951[_0xea78('0x36')]=qs[_0xea78('0x30')](_[_0xea78('0x37')](_0x4fd507[_0xea78('0x2e')],_0x2bf138[_0xea78('0x30')]),_0x33cd72);if(_0x4fd507[_0xea78('0x2e')][_0xea78('0x38')]){_0x1c5951[_0xea78('0x36')]=_[_0xea78('0x39')](_0x1c5951['where'],{'$or':_[_0xea78('0x2d')](_0x33cd72,function(_0x23d6ab){if(_0x23d6ab[_0xea78('0x3a')]!==_0xea78('0x3b')){var _0x25bcb9={};_0x25bcb9[_0x23d6ab[_0xea78('0x26')]]={'$like':'%'+_0x4fd507['query'][_0xea78('0x38')]+'%'};return _0x25bcb9;}})});}_0x1c5951=_[_0xea78('0x39')]({},_0x1c5951,_0x4fd507['options']);var _0x32d255={'where':_0x1c5951[_0xea78('0x36')]};return db[_0xea78('0x29')]['count'](_0x32d255)[_0xea78('0x23')](function(_0x58664c){_0x3ee224[_0xea78('0x1b')]=_0x58664c;if(_0x4fd507[_0xea78('0x2e')][_0xea78('0x3c')]){_0x1c5951[_0xea78('0x3d')]=[{'all':!![]}];}return db[_0xea78('0x29')][_0xea78('0x3e')](_0x1c5951);})[_0xea78('0x23')](function(_0x1ac131){_0x3ee224[_0xea78('0x3f')]=_0x1ac131;return _0x3ee224;})[_0xea78('0x23')](respondWithFilteredResult(_0x2ea509,_0x1c5951))[_0xea78('0x40')](handleError(_0x2ea509,null));};exports['show']=function(_0x58f952,_0x5e0dc5){var _0x2dc1ec={'raw':![],'where':{'id':_0x58f952['params']['id']}},_0x31b712={};_0x31b712[_0xea78('0x2c')]=_[_0xea78('0x2f')](db[_0xea78('0x29')][_0xea78('0x41')]);_0x31b712['query']=_[_0xea78('0x2f')](_0x58f952['query']);_0x31b712['filters']=_[_0xea78('0x31')](_0x31b712['model'],_0x31b712['query']);_0x2dc1ec[_0xea78('0x32')]=_[_0xea78('0x31')](_0x31b712[_0xea78('0x2c')],qs['fields'](_0x58f952[_0xea78('0x2e')][_0xea78('0x33')]));_0x2dc1ec[_0xea78('0x32')]=_0x2dc1ec[_0xea78('0x32')][_0xea78('0x42')]?_0x2dc1ec[_0xea78('0x32')]:_0x31b712[_0xea78('0x2c')];if(_0x58f952[_0xea78('0x2e')][_0xea78('0x3c')]){_0x2dc1ec['include']=[{'all':!![]}];}_0x2dc1ec=_[_0xea78('0x39')]({},_0x2dc1ec,_0x58f952[_0xea78('0x43')]);return db['VtigerConfiguration'][_0xea78('0x44')](_0x2dc1ec)['then'](handleEntityNotFound(_0x5e0dc5,null))[_0xea78('0x23')](respondWithResult(_0x5e0dc5,null))['catch'](handleError(_0x5e0dc5,null));};exports[_0xea78('0x45')]=function(_0x18b030,_0x407a46){return db[_0xea78('0x29')][_0xea78('0x45')](_0x18b030[_0xea78('0x46')],{})[_0xea78('0x23')](respondWithResult(_0x407a46,0xc9))[_0xea78('0x40')](handleError(_0x407a46,null));};exports[_0xea78('0x47')]=function(_0x32f41c,_0x456c25){if(_0x32f41c['body']['id']){delete _0x32f41c[_0xea78('0x46')]['id'];}return db[_0xea78('0x29')][_0xea78('0x44')]({'where':{'id':_0x32f41c[_0xea78('0x48')]['id']}})[_0xea78('0x23')](handleEntityNotFound(_0x456c25,null))[_0xea78('0x23')](saveUpdates(_0x32f41c[_0xea78('0x46')],null))['then'](respondWithResult(_0x456c25,null))[_0xea78('0x40')](handleError(_0x456c25,null));};exports[_0xea78('0x49')]=function(_0x567a43,_0x507c39){return db[_0xea78('0x29')][_0xea78('0x44')]({'where':{'id':_0x567a43['params']['id']}})[_0xea78('0x23')](handleEntityNotFound(_0x507c39,null))[_0xea78('0x23')](removeEntity(_0x507c39,null))[_0xea78('0x40')](handleError(_0x507c39,null));};exports[_0xea78('0x4a')]=function(_0x4a10ae,_0x52f297,_0x4511c6){var _0x2fb881={};var _0xf3c2a={};var _0xd9d04d;var _0x5f23d0;return db[_0xea78('0x29')][_0xea78('0x4b')]({'where':{'id':_0x4a10ae[_0xea78('0x48')]['id']}})[_0xea78('0x23')](handleEntityNotFound(_0x52f297,null))[_0xea78('0x23')](function(_0x25da61){if(_0x25da61){_0xd9d04d=_0x25da61;_0xf3c2a[_0xea78('0x2c')]=_[_0xea78('0x2f')](db[_0xea78('0x4c')][_0xea78('0x41')]);_0xf3c2a[_0xea78('0x2e')]=_[_0xea78('0x2f')](_0x4a10ae[_0xea78('0x2e')]);_0xf3c2a[_0xea78('0x30')]=_[_0xea78('0x31')](_0xf3c2a[_0xea78('0x2c')],_0xf3c2a[_0xea78('0x2e')]);_0x2fb881[_0xea78('0x32')]=_[_0xea78('0x31')](_0xf3c2a[_0xea78('0x2c')],qs['fields'](_0x4a10ae[_0xea78('0x2e')][_0xea78('0x33')]));_0x2fb881[_0xea78('0x32')]=_0x2fb881[_0xea78('0x32')][_0xea78('0x42')]?_0x2fb881['attributes']:_0xf3c2a[_0xea78('0x2c')];_0x2fb881[_0xea78('0x35')]=qs[_0xea78('0x4d')](_0x4a10ae[_0xea78('0x2e')]['sort']);_0x2fb881[_0xea78('0x36')]=qs[_0xea78('0x30')](_[_0xea78('0x37')](_0x4a10ae[_0xea78('0x2e')],_0xf3c2a['filters']));if(_0x4a10ae[_0xea78('0x2e')][_0xea78('0x38')]){_0x2fb881['where']=_[_0xea78('0x39')](_0x2fb881['where'],{'$or':_[_0xea78('0x2d')](_0x2fb881['attributes'],function(_0x38f151){var _0x426791={};_0x426791[_0x38f151]={'$like':'%'+_0x4a10ae[_0xea78('0x2e')][_0xea78('0x38')]+'%'};return _0x426791;})});}_0x2fb881=_['merge']({},_0x2fb881,_0x4a10ae[_0xea78('0x43')]);return _0xd9d04d['getFields'](_0x2fb881);}})[_0xea78('0x23')](function(_0x394614){if(_0x394614){_0x5f23d0=_0x394614['length'];if(!_0x4a10ae[_0xea78('0x2e')]['hasOwnProperty'](_0xea78('0x4e'))){_0x2fb881['limit']=qs[_0xea78('0x34')](_0x4a10ae['query'][_0xea78('0x34')]);_0x2fb881[_0xea78('0x1c')]=qs[_0xea78('0x1c')](_0x4a10ae[_0xea78('0x2e')]['offset']);}return _0xd9d04d['getFields'](_0x2fb881);}})[_0xea78('0x23')](function(_0x592407){if(_0x592407){return _0x592407?{'count':_0x5f23d0,'rows':_0x592407}:null;}})[_0xea78('0x23')](respondWithResult(_0x52f297,null))[_0xea78('0x40')](handleError(_0x52f297,null));};exports[_0xea78('0x4f')]=function(_0x20ef9e,_0x154a3b,_0x5e6904){var _0x53813d={};var _0xc12c4a={};var _0x308e46;var _0x337c61;return db[_0xea78('0x29')][_0xea78('0x4b')]({'where':{'id':_0x20ef9e[_0xea78('0x48')]['id']}})[_0xea78('0x23')](handleEntityNotFound(_0x154a3b,null))[_0xea78('0x23')](function(_0x267096){if(_0x267096){_0x308e46=_0x267096;_0xc12c4a[_0xea78('0x2c')]=_['keys'](db[_0xea78('0x4c')][_0xea78('0x41')]);_0xc12c4a[_0xea78('0x2e')]=_[_0xea78('0x2f')](_0x20ef9e[_0xea78('0x2e')]);_0xc12c4a[_0xea78('0x30')]=_[_0xea78('0x31')](_0xc12c4a[_0xea78('0x2c')],_0xc12c4a[_0xea78('0x2e')]);_0x53813d[_0xea78('0x32')]=_[_0xea78('0x31')](_0xc12c4a[_0xea78('0x2c')],qs[_0xea78('0x33')](_0x20ef9e[_0xea78('0x2e')][_0xea78('0x33')]));_0x53813d['attributes']=_0x53813d[_0xea78('0x32')]['length']?_0x53813d[_0xea78('0x32')]:_0xc12c4a[_0xea78('0x2c')];_0x53813d[_0xea78('0x35')]=qs[_0xea78('0x4d')](_0x20ef9e[_0xea78('0x2e')][_0xea78('0x4d')]);_0x53813d[_0xea78('0x36')]=qs['filters'](_[_0xea78('0x37')](_0x20ef9e[_0xea78('0x2e')],_0xc12c4a[_0xea78('0x30')]));if(_0x20ef9e[_0xea78('0x2e')][_0xea78('0x38')]){_0x53813d['where']=_[_0xea78('0x39')](_0x53813d['where'],{'$or':_[_0xea78('0x2d')](_0x53813d[_0xea78('0x32')],function(_0x47a041){var _0x51f7dd={};_0x51f7dd[_0x47a041]={'$like':'%'+_0x20ef9e['query'][_0xea78('0x38')]+'%'};return _0x51f7dd;})});}_0x53813d=_[_0xea78('0x39')]({},_0x53813d,_0x20ef9e[_0xea78('0x43')]);return _0x308e46['getSubjects'](_0x53813d);}})[_0xea78('0x23')](function(_0x5df39b){if(_0x5df39b){_0x337c61=_0x5df39b[_0xea78('0x42')];if(!_0x20ef9e[_0xea78('0x2e')][_0xea78('0x50')](_0xea78('0x4e'))){_0x53813d['limit']=qs[_0xea78('0x34')](_0x20ef9e[_0xea78('0x2e')][_0xea78('0x34')]);_0x53813d[_0xea78('0x1c')]=qs['offset'](_0x20ef9e[_0xea78('0x2e')][_0xea78('0x1c')]);}return _0x308e46[_0xea78('0x4f')](_0x53813d);}})[_0xea78('0x23')](function(_0x2e6031){if(_0x2e6031){return _0x2e6031?{'count':_0x337c61,'rows':_0x2e6031}:null;}})['then'](respondWithResult(_0x154a3b,null))[_0xea78('0x40')](handleError(_0x154a3b,null));};exports[_0xea78('0x51')]=function(_0x88a2f5,_0xf1c9db,_0x480ee9){var _0x16d9d1={};var _0x43997b={};var _0xf32d4;var _0x4ac367;return db[_0xea78('0x29')][_0xea78('0x4b')]({'where':{'id':_0x88a2f5[_0xea78('0x48')]['id']}})[_0xea78('0x23')](handleEntityNotFound(_0xf1c9db,null))['then'](function(_0x3e9ba1){if(_0x3e9ba1){_0xf32d4=_0x3e9ba1;_0x43997b[_0xea78('0x2c')]=_[_0xea78('0x2f')](db[_0xea78('0x4c')]['rawAttributes']);_0x43997b['query']=_[_0xea78('0x2f')](_0x88a2f5['query']);_0x43997b['filters']=_['intersection'](_0x43997b[_0xea78('0x2c')],_0x43997b[_0xea78('0x2e')]);_0x16d9d1[_0xea78('0x32')]=_[_0xea78('0x31')](_0x43997b[_0xea78('0x2c')],qs[_0xea78('0x33')](_0x88a2f5[_0xea78('0x2e')][_0xea78('0x33')]));_0x16d9d1[_0xea78('0x32')]=_0x16d9d1[_0xea78('0x32')][_0xea78('0x42')]?_0x16d9d1['attributes']:_0x43997b[_0xea78('0x2c')];_0x16d9d1[_0xea78('0x35')]=qs[_0xea78('0x4d')](_0x88a2f5[_0xea78('0x2e')][_0xea78('0x4d')]);_0x16d9d1['where']=qs['filters'](_['pick'](_0x88a2f5[_0xea78('0x2e')],_0x43997b[_0xea78('0x30')]));if(_0x88a2f5[_0xea78('0x2e')][_0xea78('0x38')]){_0x16d9d1[_0xea78('0x36')]=_[_0xea78('0x39')](_0x16d9d1[_0xea78('0x36')],{'$or':_[_0xea78('0x2d')](_0x16d9d1['attributes'],function(_0x1f5129){var _0xb3723d={};_0xb3723d[_0x1f5129]={'$like':'%'+_0x88a2f5['query'][_0xea78('0x38')]+'%'};return _0xb3723d;})});}_0x16d9d1=_['merge']({},_0x16d9d1,_0x88a2f5[_0xea78('0x43')]);return _0xf32d4['getDescriptions'](_0x16d9d1);}})[_0xea78('0x23')](function(_0x4bdddf){if(_0x4bdddf){_0x4ac367=_0x4bdddf[_0xea78('0x42')];if(!_0x88a2f5[_0xea78('0x2e')][_0xea78('0x50')](_0xea78('0x4e'))){_0x16d9d1[_0xea78('0x34')]=qs[_0xea78('0x34')](_0x88a2f5[_0xea78('0x2e')][_0xea78('0x34')]);_0x16d9d1[_0xea78('0x1c')]=qs[_0xea78('0x1c')](_0x88a2f5[_0xea78('0x2e')]['offset']);}return _0xf32d4['getDescriptions'](_0x16d9d1);}})[_0xea78('0x23')](function(_0xe89b97){if(_0xe89b97){return _0xe89b97?{'count':_0x4ac367,'rows':_0xe89b97}:null;}})[_0xea78('0x23')](respondWithResult(_0xf1c9db,null))[_0xea78('0x40')](handleError(_0xf1c9db,null));}; \ No newline at end of file +var _0x7747=['stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','findOne','VtigerField','getSubjects','order','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','end','error'];(function(_0x3d19cc,_0x256657){var _0x2d8bcf=function(_0x3c9df0){while(--_0x3c9df0){_0x3d19cc['push'](_0x3d19cc['shift']());}};_0x2d8bcf(++_0x256657);}(_0x7747,0xc5));var _0x7774=function(_0x476464,_0x422a44){_0x476464=_0x476464-0x0;var _0x4cd09b=_0x7747[_0x476464];return _0x4cd09b;};'use strict';var emlformat=require(_0x7774('0x0'));var rimraf=require(_0x7774('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7774('0x2'));var rp=require('request-promise');var moment=require(_0x7774('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7774('0x4'));var util=require(_0x7774('0x5'));var path=require('path');var sox=require(_0x7774('0x6'));var csv=require('to-csv');var ejs=require(_0x7774('0x7'));var fs=require('fs');var fs_extra=require(_0x7774('0x8'));var _=require('lodash');var squel=require(_0x7774('0x9'));var crypto=require('crypto');var jsforce=require(_0x7774('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7774('0xb'));var querystring=require(_0x7774('0xc'));var Papa=require('papaparse');var Redis=require(_0x7774('0xd'));var authService=require(_0x7774('0xe'));var qs=require(_0x7774('0xf'));var as=require(_0x7774('0x10'));var hardwareService=require(_0x7774('0x11'));var logger=require(_0x7774('0x12'))(_0x7774('0x13'));var utils=require(_0x7774('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7774('0x15'));var db=require(_0x7774('0x16'))['db'];function respondWithStatusCode(_0x4be5a8,_0x37d23e){_0x37d23e=_0x37d23e||0xcc;return function(_0x21b2cf){if(_0x21b2cf){return _0x4be5a8[_0x7774('0x17')](_0x37d23e);}return _0x4be5a8[_0x7774('0x18')](_0x37d23e)['end']();};}function respondWithResult(_0x289a25,_0x5ee298){_0x5ee298=_0x5ee298||0xc8;return function(_0x2ed894){if(_0x2ed894){return _0x289a25['status'](_0x5ee298)[_0x7774('0x19')](_0x2ed894);}};}function respondWithFilteredResult(_0x4e1971,_0x116cad){return function(_0x1e4c9f){if(_0x1e4c9f){var _0x2c9dea=typeof _0x116cad[_0x7774('0x1a')]===_0x7774('0x1b')&&typeof _0x116cad[_0x7774('0x1c')]==='undefined';var _0x5e1791=_0x1e4c9f['count'];var _0x1938c1=_0x2c9dea?0x0:_0x116cad[_0x7774('0x1a')];var _0xba08c5=_0x2c9dea?_0x1e4c9f[_0x7774('0x1d')]:_0x116cad[_0x7774('0x1a')]+_0x116cad['limit'];var _0xce7d51;if(_0xba08c5>=_0x5e1791){_0xba08c5=_0x5e1791;_0xce7d51=0xc8;}else{_0xce7d51=0xce;}_0x4e1971[_0x7774('0x18')](_0xce7d51);return _0x4e1971[_0x7774('0x1e')](_0x7774('0x1f'),_0x1938c1+'-'+_0xba08c5+'/'+_0x5e1791)[_0x7774('0x19')](_0x1e4c9f);}return null;};}function patchUpdates(_0x13c50f){return function(_0xad20fe){try{jsonpatch['apply'](_0xad20fe,_0x13c50f,!![]);}catch(_0x4a4700){return BPromise['reject'](_0x4a4700);}return _0xad20fe[_0x7774('0x20')]();};}function saveUpdates(_0xa80a4a,_0x2f0b92){return function(_0x1c96fc){if(_0x1c96fc){return _0x1c96fc['update'](_0xa80a4a)[_0x7774('0x21')](function(_0x146371){return _0x146371;});}return null;};}function removeEntity(_0x256d07,_0x27de44){return function(_0xe88d7){if(_0xe88d7){return _0xe88d7[_0x7774('0x22')]()[_0x7774('0x21')](function(){_0x256d07[_0x7774('0x18')](0xcc)[_0x7774('0x23')]();});}};}function handleEntityNotFound(_0x37f912,_0x53da3f){return function(_0x5a1b06){if(!_0x5a1b06){_0x37f912[_0x7774('0x17')](0x194);}return _0x5a1b06;};}function handleError(_0x56710a,_0x48fbe5){_0x48fbe5=_0x48fbe5||0x1f4;return function(_0x176f51){logger[_0x7774('0x24')](_0x176f51[_0x7774('0x25')]);if(_0x176f51[_0x7774('0x26')]){delete _0x176f51[_0x7774('0x26')];}_0x56710a['status'](_0x48fbe5)['send'](_0x176f51);};}exports[_0x7774('0x27')]=function(_0x3e0aeb,_0x185abf){var _0x379d69={},_0x42acc2={},_0x36f078={'count':0x0,'rows':[]};var _0x5a8af2=_[_0x7774('0x28')](db['VtigerConfiguration'][_0x7774('0x29')],function(_0x22c99a){return{'name':_0x22c99a[_0x7774('0x2a')],'type':_0x22c99a[_0x7774('0x2b')][_0x7774('0x2c')]};});_0x42acc2[_0x7774('0x2d')]=_['map'](_0x5a8af2,_0x7774('0x26'));_0x42acc2['query']=_[_0x7774('0x2e')](_0x3e0aeb['query']);_0x42acc2[_0x7774('0x2f')]=_[_0x7774('0x30')](_0x42acc2[_0x7774('0x2d')],_0x42acc2['query']);_0x379d69[_0x7774('0x31')]=_['intersection'](_0x42acc2[_0x7774('0x2d')],qs[_0x7774('0x32')](_0x3e0aeb[_0x7774('0x33')][_0x7774('0x32')]));_0x379d69[_0x7774('0x31')]=_0x379d69['attributes'][_0x7774('0x34')]?_0x379d69[_0x7774('0x31')]:_0x42acc2[_0x7774('0x2d')];if(!_0x3e0aeb['query'][_0x7774('0x35')](_0x7774('0x36'))){_0x379d69[_0x7774('0x1c')]=qs['limit'](_0x3e0aeb[_0x7774('0x33')][_0x7774('0x1c')]);_0x379d69[_0x7774('0x1a')]=qs[_0x7774('0x1a')](_0x3e0aeb[_0x7774('0x33')][_0x7774('0x1a')]);}_0x379d69['order']=qs[_0x7774('0x37')](_0x3e0aeb[_0x7774('0x33')][_0x7774('0x37')]);_0x379d69[_0x7774('0x38')]=qs[_0x7774('0x2f')](_[_0x7774('0x39')](_0x3e0aeb[_0x7774('0x33')],_0x42acc2['filters']),_0x5a8af2);if(_0x3e0aeb['query'][_0x7774('0x3a')]){_0x379d69[_0x7774('0x38')]=_['merge'](_0x379d69[_0x7774('0x38')],{'$or':_[_0x7774('0x28')](_0x5a8af2,function(_0x2b0ab0){if(_0x2b0ab0[_0x7774('0x2b')]!=='VIRTUAL'){var _0x1e82cb={};_0x1e82cb[_0x2b0ab0['name']]={'$like':'%'+_0x3e0aeb[_0x7774('0x33')][_0x7774('0x3a')]+'%'};return _0x1e82cb;}})});}_0x379d69=_[_0x7774('0x3b')]({},_0x379d69,_0x3e0aeb['options']);var _0x297c6b={'where':_0x379d69['where']};return db[_0x7774('0x3c')][_0x7774('0x1d')](_0x297c6b)['then'](function(_0x2785ff){_0x36f078[_0x7774('0x1d')]=_0x2785ff;if(_0x3e0aeb[_0x7774('0x33')][_0x7774('0x3d')]){_0x379d69[_0x7774('0x3e')]=[{'all':!![]}];}return db[_0x7774('0x3c')][_0x7774('0x3f')](_0x379d69);})['then'](function(_0x5e0f95){_0x36f078[_0x7774('0x40')]=_0x5e0f95;return _0x36f078;})['then'](respondWithFilteredResult(_0x185abf,_0x379d69))[_0x7774('0x41')](handleError(_0x185abf,null));};exports[_0x7774('0x42')]=function(_0x1f6edd,_0x5a1632){var _0x1b9fec={'raw':![],'where':{'id':_0x1f6edd[_0x7774('0x43')]['id']}},_0x7b6333={};_0x7b6333['model']=_[_0x7774('0x2e')](db[_0x7774('0x3c')][_0x7774('0x29')]);_0x7b6333['query']=_[_0x7774('0x2e')](_0x1f6edd[_0x7774('0x33')]);_0x7b6333['filters']=_[_0x7774('0x30')](_0x7b6333['model'],_0x7b6333[_0x7774('0x33')]);_0x1b9fec[_0x7774('0x31')]=_[_0x7774('0x30')](_0x7b6333[_0x7774('0x2d')],qs[_0x7774('0x32')](_0x1f6edd[_0x7774('0x33')][_0x7774('0x32')]));_0x1b9fec['attributes']=_0x1b9fec[_0x7774('0x31')]['length']?_0x1b9fec[_0x7774('0x31')]:_0x7b6333[_0x7774('0x2d')];if(_0x1f6edd[_0x7774('0x33')][_0x7774('0x3d')]){_0x1b9fec[_0x7774('0x3e')]=[{'all':!![]}];}_0x1b9fec=_[_0x7774('0x3b')]({},_0x1b9fec,_0x1f6edd[_0x7774('0x44')]);return db[_0x7774('0x3c')][_0x7774('0x45')](_0x1b9fec)[_0x7774('0x21')](handleEntityNotFound(_0x5a1632,null))[_0x7774('0x21')](respondWithResult(_0x5a1632,null))[_0x7774('0x41')](handleError(_0x5a1632,null));};exports[_0x7774('0x46')]=function(_0x3d432d,_0xf44eb3){return db[_0x7774('0x3c')][_0x7774('0x46')](_0x3d432d[_0x7774('0x47')],{})['then'](respondWithResult(_0xf44eb3,0xc9))[_0x7774('0x41')](handleError(_0xf44eb3,null));};exports[_0x7774('0x48')]=function(_0x257159,_0x51640b){if(_0x257159[_0x7774('0x47')]['id']){delete _0x257159[_0x7774('0x47')]['id'];}return db[_0x7774('0x3c')][_0x7774('0x45')]({'where':{'id':_0x257159['params']['id']}})[_0x7774('0x21')](handleEntityNotFound(_0x51640b,null))[_0x7774('0x21')](saveUpdates(_0x257159[_0x7774('0x47')],null))[_0x7774('0x21')](respondWithResult(_0x51640b,null))[_0x7774('0x41')](handleError(_0x51640b,null));};exports[_0x7774('0x22')]=function(_0xc2743,_0x5005b5){return db[_0x7774('0x3c')][_0x7774('0x45')]({'where':{'id':_0xc2743[_0x7774('0x43')]['id']}})['then'](handleEntityNotFound(_0x5005b5,null))['then'](removeEntity(_0x5005b5,null))['catch'](handleError(_0x5005b5,null));};exports['getFields']=function(_0x59f5c0,_0x487aea,_0x11af46){var _0x3c1bb7={};var _0x2bf987={};var _0x9a7dac;var _0x26ce1c;return db[_0x7774('0x3c')][_0x7774('0x49')]({'where':{'id':_0x59f5c0['params']['id']}})['then'](handleEntityNotFound(_0x487aea,null))['then'](function(_0x7f2437){if(_0x7f2437){_0x9a7dac=_0x7f2437;_0x2bf987[_0x7774('0x2d')]=_[_0x7774('0x2e')](db[_0x7774('0x4a')][_0x7774('0x29')]);_0x2bf987[_0x7774('0x33')]=_['keys'](_0x59f5c0[_0x7774('0x33')]);_0x2bf987[_0x7774('0x2f')]=_[_0x7774('0x30')](_0x2bf987[_0x7774('0x2d')],_0x2bf987[_0x7774('0x33')]);_0x3c1bb7['attributes']=_[_0x7774('0x30')](_0x2bf987[_0x7774('0x2d')],qs[_0x7774('0x32')](_0x59f5c0['query'][_0x7774('0x32')]));_0x3c1bb7['attributes']=_0x3c1bb7[_0x7774('0x31')][_0x7774('0x34')]?_0x3c1bb7[_0x7774('0x31')]:_0x2bf987['model'];_0x3c1bb7['order']=qs['sort'](_0x59f5c0[_0x7774('0x33')][_0x7774('0x37')]);_0x3c1bb7[_0x7774('0x38')]=qs[_0x7774('0x2f')](_[_0x7774('0x39')](_0x59f5c0['query'],_0x2bf987[_0x7774('0x2f')]));if(_0x59f5c0['query'][_0x7774('0x3a')]){_0x3c1bb7[_0x7774('0x38')]=_[_0x7774('0x3b')](_0x3c1bb7[_0x7774('0x38')],{'$or':_['map'](_0x3c1bb7[_0x7774('0x31')],function(_0x416476){var _0x55a6a8={};_0x55a6a8[_0x416476]={'$like':'%'+_0x59f5c0['query'][_0x7774('0x3a')]+'%'};return _0x55a6a8;})});}_0x3c1bb7=_[_0x7774('0x3b')]({},_0x3c1bb7,_0x59f5c0[_0x7774('0x44')]);return _0x9a7dac['getFields'](_0x3c1bb7);}})[_0x7774('0x21')](function(_0x96b365){if(_0x96b365){_0x26ce1c=_0x96b365[_0x7774('0x34')];if(!_0x59f5c0[_0x7774('0x33')][_0x7774('0x35')](_0x7774('0x36'))){_0x3c1bb7[_0x7774('0x1c')]=qs['limit'](_0x59f5c0[_0x7774('0x33')][_0x7774('0x1c')]);_0x3c1bb7[_0x7774('0x1a')]=qs[_0x7774('0x1a')](_0x59f5c0[_0x7774('0x33')]['offset']);}return _0x9a7dac['getFields'](_0x3c1bb7);}})[_0x7774('0x21')](function(_0x4f95a8){if(_0x4f95a8){return _0x4f95a8?{'count':_0x26ce1c,'rows':_0x4f95a8}:null;}})['then'](respondWithResult(_0x487aea,null))['catch'](handleError(_0x487aea,null));};exports[_0x7774('0x4b')]=function(_0xd39b43,_0x2a506d,_0x3c5914){var _0x1ab898={};var _0x2af78a={};var _0x52585a;var _0x3760ad;return db['VtigerConfiguration'][_0x7774('0x49')]({'where':{'id':_0xd39b43[_0x7774('0x43')]['id']}})[_0x7774('0x21')](handleEntityNotFound(_0x2a506d,null))['then'](function(_0x4a6c68){if(_0x4a6c68){_0x52585a=_0x4a6c68;_0x2af78a[_0x7774('0x2d')]=_[_0x7774('0x2e')](db[_0x7774('0x4a')][_0x7774('0x29')]);_0x2af78a[_0x7774('0x33')]=_[_0x7774('0x2e')](_0xd39b43[_0x7774('0x33')]);_0x2af78a[_0x7774('0x2f')]=_[_0x7774('0x30')](_0x2af78a[_0x7774('0x2d')],_0x2af78a['query']);_0x1ab898['attributes']=_['intersection'](_0x2af78a[_0x7774('0x2d')],qs['fields'](_0xd39b43['query'][_0x7774('0x32')]));_0x1ab898[_0x7774('0x31')]=_0x1ab898[_0x7774('0x31')][_0x7774('0x34')]?_0x1ab898[_0x7774('0x31')]:_0x2af78a[_0x7774('0x2d')];_0x1ab898[_0x7774('0x4c')]=qs['sort'](_0xd39b43[_0x7774('0x33')][_0x7774('0x37')]);_0x1ab898[_0x7774('0x38')]=qs[_0x7774('0x2f')](_[_0x7774('0x39')](_0xd39b43[_0x7774('0x33')],_0x2af78a[_0x7774('0x2f')]));if(_0xd39b43[_0x7774('0x33')][_0x7774('0x3a')]){_0x1ab898[_0x7774('0x38')]=_[_0x7774('0x3b')](_0x1ab898[_0x7774('0x38')],{'$or':_[_0x7774('0x28')](_0x1ab898[_0x7774('0x31')],function(_0x5680f0){var _0x41a240={};_0x41a240[_0x5680f0]={'$like':'%'+_0xd39b43[_0x7774('0x33')][_0x7774('0x3a')]+'%'};return _0x41a240;})});}_0x1ab898=_[_0x7774('0x3b')]({},_0x1ab898,_0xd39b43[_0x7774('0x44')]);return _0x52585a[_0x7774('0x4b')](_0x1ab898);}})[_0x7774('0x21')](function(_0x4489e7){if(_0x4489e7){_0x3760ad=_0x4489e7[_0x7774('0x34')];if(!_0xd39b43[_0x7774('0x33')]['hasOwnProperty'](_0x7774('0x36'))){_0x1ab898[_0x7774('0x1c')]=qs[_0x7774('0x1c')](_0xd39b43[_0x7774('0x33')]['limit']);_0x1ab898[_0x7774('0x1a')]=qs[_0x7774('0x1a')](_0xd39b43[_0x7774('0x33')][_0x7774('0x1a')]);}return _0x52585a['getSubjects'](_0x1ab898);}})[_0x7774('0x21')](function(_0x592e4e){if(_0x592e4e){return _0x592e4e?{'count':_0x3760ad,'rows':_0x592e4e}:null;}})['then'](respondWithResult(_0x2a506d,null))[_0x7774('0x41')](handleError(_0x2a506d,null));};exports[_0x7774('0x4d')]=function(_0x5ad115,_0x375c35,_0x1ae0fe){var _0x1bc60e={};var _0xd6cc3a={};var _0x67acaa;var _0x25f521;return db['VtigerConfiguration'][_0x7774('0x49')]({'where':{'id':_0x5ad115[_0x7774('0x43')]['id']}})['then'](handleEntityNotFound(_0x375c35,null))[_0x7774('0x21')](function(_0x51a43d){if(_0x51a43d){_0x67acaa=_0x51a43d;_0xd6cc3a[_0x7774('0x2d')]=_[_0x7774('0x2e')](db['VtigerField']['rawAttributes']);_0xd6cc3a['query']=_['keys'](_0x5ad115['query']);_0xd6cc3a[_0x7774('0x2f')]=_[_0x7774('0x30')](_0xd6cc3a[_0x7774('0x2d')],_0xd6cc3a[_0x7774('0x33')]);_0x1bc60e[_0x7774('0x31')]=_[_0x7774('0x30')](_0xd6cc3a[_0x7774('0x2d')],qs[_0x7774('0x32')](_0x5ad115[_0x7774('0x33')]['fields']));_0x1bc60e[_0x7774('0x31')]=_0x1bc60e['attributes'][_0x7774('0x34')]?_0x1bc60e['attributes']:_0xd6cc3a['model'];_0x1bc60e[_0x7774('0x4c')]=qs[_0x7774('0x37')](_0x5ad115['query'][_0x7774('0x37')]);_0x1bc60e[_0x7774('0x38')]=qs['filters'](_[_0x7774('0x39')](_0x5ad115[_0x7774('0x33')],_0xd6cc3a['filters']));if(_0x5ad115['query'][_0x7774('0x3a')]){_0x1bc60e[_0x7774('0x38')]=_[_0x7774('0x3b')](_0x1bc60e['where'],{'$or':_[_0x7774('0x28')](_0x1bc60e['attributes'],function(_0x5cdf5c){var _0x48aa0f={};_0x48aa0f[_0x5cdf5c]={'$like':'%'+_0x5ad115[_0x7774('0x33')][_0x7774('0x3a')]+'%'};return _0x48aa0f;})});}_0x1bc60e=_[_0x7774('0x3b')]({},_0x1bc60e,_0x5ad115[_0x7774('0x44')]);return _0x67acaa[_0x7774('0x4d')](_0x1bc60e);}})[_0x7774('0x21')](function(_0x136c42){if(_0x136c42){_0x25f521=_0x136c42['length'];if(!_0x5ad115[_0x7774('0x33')]['hasOwnProperty'](_0x7774('0x36'))){_0x1bc60e[_0x7774('0x1c')]=qs[_0x7774('0x1c')](_0x5ad115[_0x7774('0x33')][_0x7774('0x1c')]);_0x1bc60e[_0x7774('0x1a')]=qs[_0x7774('0x1a')](_0x5ad115[_0x7774('0x33')]['offset']);}return _0x67acaa[_0x7774('0x4d')](_0x1bc60e);}})[_0x7774('0x21')](function(_0x3e1877){if(_0x3e1877){return _0x3e1877?{'count':_0x25f521,'rows':_0x3e1877}:null;}})[_0x7774('0x21')](respondWithResult(_0x375c35,null))[_0x7774('0x41')](handleError(_0x375c35,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 73ad0db..3871f5c 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 _0x3b46=['request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','moment','bluebird'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x3b46,0x1a0));var _0x63b4=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x3b46[_0x4dab14];return _0xf41aa;};'use strict';var _=require(_0x63b4('0x0'));var util=require(_0x63b4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x63b4('0x2'));var BPromise=require(_0x63b4('0x3'));var rp=require(_0x63b4('0x4'));var fs=require('fs');var path=require(_0x63b4('0x5'));var rimraf=require(_0x63b4('0x6'));var config=require(_0x63b4('0x7'));var attributes=require(_0x63b4('0x8'));module[_0x63b4('0x9')]=function(_0x28a34b,_0x1d2c2){return _0x28a34b[_0x63b4('0xa')](_0x63b4('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10d8=['int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerConfiguration.attributes','define','VtigerConfiguration'];(function(_0x28b123,_0x318eca){var _0x43cb3b=function(_0x886352){while(--_0x886352){_0x28b123['push'](_0x28b123['shift']());}};_0x43cb3b(++_0x318eca);}(_0x10d8,0x109));var _0x810d=function(_0x9b0ba6,_0x465525){_0x9b0ba6=_0x9b0ba6-0x0;var _0x3c9944=_0x10d8[_0x9b0ba6];return _0x3c9944;};'use strict';var _=require(_0x810d('0x0'));var util=require('util');var logger=require(_0x810d('0x1'))(_0x810d('0x2'));var moment=require(_0x810d('0x3'));var BPromise=require(_0x810d('0x4'));var rp=require(_0x810d('0x5'));var fs=require('fs');var path=require(_0x810d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x810d('0x7'));module['exports']=function(_0x19e330,_0x45ba2e){return _0x19e330[_0x810d('0x8')](_0x810d('0x9'),attributes,{'tableName':_0x810d('0xa'),'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 83028e3..9cf5505 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 _0xbe77=['code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x17c7ab,_0x5a2c89){var _0x291de0=function(_0x56dbfc){while(--_0x56dbfc){_0x17c7ab['push'](_0x17c7ab['shift']());}};_0x291de0(++_0x5a2c89);}(_0xbe77,0x80));var _0x7be7=function(_0x3cf4c8,_0x26e0be){_0x3cf4c8=_0x3cf4c8-0x0;var _0x18a79e=_0xbe77[_0x3cf4c8];return _0x18a79e;};'use strict';var _=require('lodash');var util=require(_0x7be7('0x0'));var moment=require(_0x7be7('0x1'));var BPromise=require('bluebird');var rs=require(_0x7be7('0x2'));var fs=require('fs');var Redis=require(_0x7be7('0x3'));var db=require(_0x7be7('0x4'))['db'];var utils=require(_0x7be7('0x5'));var logger=require(_0x7be7('0x6'))('rpc');var config=require(_0x7be7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7be7('0x8')][_0x7be7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d9c95,_0x30c837,_0x296463){return new BPromise(function(_0x5a96e6,_0x4af8e6){return client[_0x7be7('0xa')](_0x8d9c95,_0x296463)[_0x7be7('0xb')](function(_0x5bdd38){logger[_0x7be7('0xc')](_0x7be7('0xd'),_0x30c837,'request\x20sent');logger[_0x7be7('0xe')](_0x7be7('0xf'),_0x30c837,_0x7be7('0x10'),JSON[_0x7be7('0x11')](_0x5bdd38));if(_0x5bdd38['error']){if(_0x5bdd38[_0x7be7('0x12')][_0x7be7('0x13')]===0x1f4){logger[_0x7be7('0x12')](_0x7be7('0xd'),_0x30c837,_0x5bdd38[_0x7be7('0x12')][_0x7be7('0x14')]);return _0x4af8e6(_0x5bdd38[_0x7be7('0x12')][_0x7be7('0x14')]);}logger[_0x7be7('0x12')](_0x7be7('0xd'),_0x30c837,_0x5bdd38[_0x7be7('0x12')][_0x7be7('0x14')]);return _0x5a96e6(_0x5bdd38[_0x7be7('0x12')][_0x7be7('0x14')]);}else{logger['info'](_0x7be7('0xd'),_0x30c837,'request\x20sent');_0x5a96e6(_0x5bdd38['result'][_0x7be7('0x14')]);}})['catch'](function(_0x17b00f){logger[_0x7be7('0x12')](_0x7be7('0xd'),_0x30c837,_0x17b00f);_0x4af8e6(_0x17b00f);});});} \ No newline at end of file +var _0x4aa3=['request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x1f117c,_0x4d9e48){var _0x2b1ee9=function(_0x52370b){while(--_0x52370b){_0x1f117c['push'](_0x1f117c['shift']());}};_0x2b1ee9(++_0x4d9e48);}(_0x4aa3,0x194));var _0x34aa=function(_0x26f517,_0x481fa7){_0x26f517=_0x26f517-0x0;var _0x5becaa=_0x4aa3[_0x26f517];return _0x5becaa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x34aa('0x0'));var BPromise=require(_0x34aa('0x1'));var rs=require(_0x34aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34aa('0x3'))['db'];var utils=require(_0x34aa('0x4'));var logger=require(_0x34aa('0x5'))(_0x34aa('0x6'));var config=require(_0x34aa('0x7'));var jayson=require(_0x34aa('0x8'));var client=jayson[_0x34aa('0x9')][_0x34aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9d88,_0x2cb4b0,_0x16ebca){return new BPromise(function(_0x5a0386,_0x36a914){return client[_0x34aa('0xb')](_0x4a9d88,_0x16ebca)['then'](function(_0x1b8418){logger[_0x34aa('0xc')](_0x34aa('0xd'),_0x2cb4b0,_0x34aa('0xe'));logger[_0x34aa('0xf')](_0x34aa('0x10'),_0x2cb4b0,_0x34aa('0xe'),JSON[_0x34aa('0x11')](_0x1b8418));if(_0x1b8418[_0x34aa('0x12')]){if(_0x1b8418[_0x34aa('0x12')]['code']===0x1f4){logger['error'](_0x34aa('0xd'),_0x2cb4b0,_0x1b8418[_0x34aa('0x12')][_0x34aa('0x13')]);return _0x36a914(_0x1b8418['error']['message']);}logger[_0x34aa('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x2cb4b0,_0x1b8418[_0x34aa('0x12')][_0x34aa('0x13')]);return _0x5a0386(_0x1b8418[_0x34aa('0x12')][_0x34aa('0x13')]);}else{logger[_0x34aa('0xc')](_0x34aa('0xd'),_0x2cb4b0,_0x34aa('0xe'));_0x5a0386(_0x1b8418[_0x34aa('0x14')][_0x34aa('0x13')]);}})[_0x34aa('0x15')](function(_0x3651c7){logger[_0x34aa('0x12')](_0x34aa('0xd'),_0x2cb4b0,_0x3651c7);_0x36a914(_0x3651c7);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6007d74..b421ec7 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 _0x946f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x946f,0x1e2));var _0xf946=function(_0x2b5ccf,_0x45b1c8){_0x2b5ccf=_0x2b5ccf-0x0;var _0x4b3b60=_0x946f[_0x2b5ccf];return _0x4b3b60;};'use strict';var multer=require(_0xf946('0x0'));var util=require(_0xf946('0x1'));var path=require(_0xf946('0x2'));var timeout=require(_0xf946('0x3'));var express=require(_0xf946('0x4'));var router=express[_0xf946('0x5')]();var fs_extra=require(_0xf946('0x6'));var auth=require(_0xf946('0x7'));var interaction=require(_0xf946('0x8'));var config=require(_0xf946('0x9'));var controller=require(_0xf946('0xa'));router[_0xf946('0xb')]('/',auth[_0xf946('0xc')](),controller[_0xf946('0xd')]);router['get'](_0xf946('0xe'),auth[_0xf946('0xc')](),controller[_0xf946('0xf')]);router[_0xf946('0x10')]('/',auth[_0xf946('0xc')](),controller[_0xf946('0x11')]);router[_0xf946('0x12')](_0xf946('0xe'),auth[_0xf946('0xc')](),controller['update']);router[_0xf946('0x13')](_0xf946('0xe'),auth[_0xf946('0xc')](),controller[_0xf946('0x14')]);module[_0xf946('0x15')]=router; \ No newline at end of file +var _0xb97b=['index','/:id','create','put','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xb97b,0x17c));var _0xbb97=function(_0x3013c4,_0x2d9fb1){_0x3013c4=_0x3013c4-0x0;var _0x18222f=_0xb97b[_0x3013c4];return _0x18222f;};'use strict';var multer=require(_0xbb97('0x0'));var util=require(_0xbb97('0x1'));var path=require(_0xbb97('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb97('0x3'));var router=express['Router']();var fs_extra=require(_0xbb97('0x4'));var auth=require(_0xbb97('0x5'));var interaction=require(_0xbb97('0x6'));var config=require(_0xbb97('0x7'));var controller=require(_0xbb97('0x8'));router[_0xbb97('0x9')]('/',auth[_0xbb97('0xa')](),controller[_0xbb97('0xb')]);router[_0xbb97('0x9')](_0xbb97('0xc'),auth[_0xbb97('0xa')](),controller['show']);router['post']('/',auth[_0xbb97('0xa')](),controller[_0xbb97('0xd')]);router[_0xbb97('0xe')](_0xbb97('0xc'),auth[_0xbb97('0xa')](),controller['update']);router[_0xbb97('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbb97('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 754011b..f6a5cc5 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 _0x54c2=['BOOLEAN','sequelize','exports','ENUM','string','variable','picklist','STRING'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x54c2,0x1a1));var _0x254c=function(_0x126af7,_0x25fa06){_0x126af7=_0x126af7-0x0;var _0x25b500=_0x54c2[_0x126af7];return _0x25b500;};'use strict';var Sequelize=require(_0x254c('0x0'));module[_0x254c('0x1')]={'type':{'type':Sequelize[_0x254c('0x2')](_0x254c('0x3'),_0x254c('0x4'),'customVariable','keyValue',_0x254c('0x5')),'defaultValue':_0x254c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x254c('0x6')]},'keyType':{'type':Sequelize[_0x254c('0x2')]('string',_0x254c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x254c('0x6')]},'idField':{'type':Sequelize[_0x254c('0x6')]},'nameField':{'type':Sequelize[_0x254c('0x6')]},'customField':{'type':Sequelize[_0x254c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x254c('0x6')]}}; \ No newline at end of file +var _0xf62b=['variable','exports','ENUM','customVariable','keyValue','picklist','string','STRING'];(function(_0x47cca4,_0x572ff9){var _0xb67b3d=function(_0x5af401){while(--_0x5af401){_0x47cca4['push'](_0x47cca4['shift']());}};_0xb67b3d(++_0x572ff9);}(_0xf62b,0x1b1));var _0xbf62=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xf62b[_0x541a67];return _0x45da2a;};'use strict';var Sequelize=require('sequelize');module[_0xbf62('0x0')]={'type':{'type':Sequelize[_0xbf62('0x1')]('string','variable',_0xbf62('0x2'),_0xbf62('0x3'),_0xbf62('0x4')),'defaultValue':_0xbf62('0x5')},'content':{'type':Sequelize[_0xbf62('0x6')]},'key':{'type':Sequelize[_0xbf62('0x6')]},'keyType':{'type':Sequelize[_0xbf62('0x1')](_0xbf62('0x5'),_0xbf62('0x7'),_0xbf62('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbf62('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 1141c4a..ab32497 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 _0x8e09=['querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','save','then','destroy','stack','name','index','map','VtigerField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','to-csv'];(function(_0x52a452,_0x157c5d){var _0x33f8fc=function(_0xe79e44){while(--_0xe79e44){_0x52a452['push'](_0x52a452['shift']());}};_0x33f8fc(++_0x157c5d);}(_0x8e09,0xc1));var _0x98e0=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0x8e09[_0x8560d3];return _0x33b1b5;};'use strict';var emlformat=require(_0x98e0('0x0'));var rimraf=require(_0x98e0('0x1'));var zipdir=require(_0x98e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98e0('0x3'));var moment=require(_0x98e0('0x4'));var BPromise=require(_0x98e0('0x5'));var Mustache=require(_0x98e0('0x6'));var util=require(_0x98e0('0x7'));var path=require(_0x98e0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98e0('0x9'));var fs=require('fs');var fs_extra=require(_0x98e0('0xa'));var _=require('lodash');var squel=require(_0x98e0('0xb'));var crypto=require('crypto');var jsforce=require(_0x98e0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x98e0('0xd'));var querystring=require(_0x98e0('0xe'));var Papa=require('papaparse');var Redis=require(_0x98e0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x98e0('0x10'));var hardwareService=require(_0x98e0('0x11'));var logger=require(_0x98e0('0x12'))('api');var utils=require(_0x98e0('0x13'));var config=require(_0x98e0('0x14'));var licenseUtil=require(_0x98e0('0x15'));var db=require(_0x98e0('0x16'))['db'];function respondWithStatusCode(_0x51bab0,_0x3b81e5){_0x3b81e5=_0x3b81e5||0xcc;return function(_0x413b35){if(_0x413b35){return _0x51bab0[_0x98e0('0x17')](_0x3b81e5);}return _0x51bab0[_0x98e0('0x18')](_0x3b81e5)['end']();};}function respondWithResult(_0x443e43,_0x67c735){_0x67c735=_0x67c735||0xc8;return function(_0x40459c){if(_0x40459c){return _0x443e43[_0x98e0('0x18')](_0x67c735)['json'](_0x40459c);}};}function respondWithFilteredResult(_0x40d59b,_0x54ad52){return function(_0x4069be){if(_0x4069be){var _0x5a8dbc=typeof _0x54ad52['offset']===_0x98e0('0x19')&&typeof _0x54ad52[_0x98e0('0x1a')]===_0x98e0('0x19');var _0x32cfe2=_0x4069be[_0x98e0('0x1b')];var _0x7c3d55=_0x5a8dbc?0x0:_0x54ad52[_0x98e0('0x1c')];var _0x3e8b7b=_0x5a8dbc?_0x4069be[_0x98e0('0x1b')]:_0x54ad52[_0x98e0('0x1c')]+_0x54ad52[_0x98e0('0x1a')];var _0x1beca8;if(_0x3e8b7b>=_0x32cfe2){_0x3e8b7b=_0x32cfe2;_0x1beca8=0xc8;}else{_0x1beca8=0xce;}_0x40d59b[_0x98e0('0x18')](_0x1beca8);return _0x40d59b['set'](_0x98e0('0x1d'),_0x7c3d55+'-'+_0x3e8b7b+'/'+_0x32cfe2)[_0x98e0('0x1e')](_0x4069be);}return null;};}function patchUpdates(_0x29fa6f){return function(_0x2bedb6){try{jsonpatch[_0x98e0('0x1f')](_0x2bedb6,_0x29fa6f,!![]);}catch(_0x10ebab){return BPromise['reject'](_0x10ebab);}return _0x2bedb6[_0x98e0('0x20')]();};}function saveUpdates(_0x406e3f,_0x73f654){return function(_0x2a5a13){if(_0x2a5a13){return _0x2a5a13['update'](_0x406e3f)[_0x98e0('0x21')](function(_0x47c7a7){return _0x47c7a7;});}return null;};}function removeEntity(_0x3af57b,_0x114765){return function(_0x5b9811){if(_0x5b9811){return _0x5b9811[_0x98e0('0x22')]()[_0x98e0('0x21')](function(){_0x3af57b[_0x98e0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb6f90a,_0x3bb717){return function(_0x4a8a04){if(!_0x4a8a04){_0xb6f90a[_0x98e0('0x17')](0x194);}return _0x4a8a04;};}function handleError(_0x3b1c6e,_0x18e94f){_0x18e94f=_0x18e94f||0x1f4;return function(_0x59ca0d){logger['error'](_0x59ca0d[_0x98e0('0x23')]);if(_0x59ca0d[_0x98e0('0x24')]){delete _0x59ca0d['name'];}_0x3b1c6e[_0x98e0('0x18')](_0x18e94f)['send'](_0x59ca0d);};}exports[_0x98e0('0x25')]=function(_0x19fc43,_0xdc6cd5){var _0x17f354={},_0x229035={},_0x2d3c5c={'count':0x0,'rows':[]};var _0x5991b4=_[_0x98e0('0x26')](db[_0x98e0('0x27')][_0x98e0('0x28')],function(_0x37c509){return{'name':_0x37c509['fieldName'],'type':_0x37c509[_0x98e0('0x29')][_0x98e0('0x2a')]};});_0x229035[_0x98e0('0x2b')]=_[_0x98e0('0x26')](_0x5991b4,_0x98e0('0x24'));_0x229035[_0x98e0('0x2c')]=_[_0x98e0('0x2d')](_0x19fc43[_0x98e0('0x2c')]);_0x229035[_0x98e0('0x2e')]=_[_0x98e0('0x2f')](_0x229035['model'],_0x229035[_0x98e0('0x2c')]);_0x17f354[_0x98e0('0x30')]=_[_0x98e0('0x2f')](_0x229035[_0x98e0('0x2b')],qs[_0x98e0('0x31')](_0x19fc43['query'][_0x98e0('0x31')]));_0x17f354[_0x98e0('0x30')]=_0x17f354['attributes'][_0x98e0('0x32')]?_0x17f354[_0x98e0('0x30')]:_0x229035[_0x98e0('0x2b')];if(!_0x19fc43[_0x98e0('0x2c')]['hasOwnProperty']('nolimit')){_0x17f354[_0x98e0('0x1a')]=qs['limit'](_0x19fc43['query'][_0x98e0('0x1a')]);_0x17f354['offset']=qs[_0x98e0('0x1c')](_0x19fc43[_0x98e0('0x2c')][_0x98e0('0x1c')]);}_0x17f354[_0x98e0('0x33')]=qs[_0x98e0('0x34')](_0x19fc43[_0x98e0('0x2c')][_0x98e0('0x34')]);_0x17f354[_0x98e0('0x35')]=qs[_0x98e0('0x2e')](_[_0x98e0('0x36')](_0x19fc43[_0x98e0('0x2c')],_0x229035[_0x98e0('0x2e')]),_0x5991b4);if(_0x19fc43[_0x98e0('0x2c')][_0x98e0('0x37')]){_0x17f354[_0x98e0('0x35')]=_[_0x98e0('0x38')](_0x17f354[_0x98e0('0x35')],{'$or':_['map'](_0x5991b4,function(_0x191615){if(_0x191615[_0x98e0('0x29')]!==_0x98e0('0x39')){var _0x5ab782={};_0x5ab782[_0x191615[_0x98e0('0x24')]]={'$like':'%'+_0x19fc43[_0x98e0('0x2c')]['filter']+'%'};return _0x5ab782;}})});}_0x17f354=_[_0x98e0('0x38')]({},_0x17f354,_0x19fc43[_0x98e0('0x3a')]);var _0xe371c2={'where':_0x17f354[_0x98e0('0x35')]};return db[_0x98e0('0x27')]['count'](_0xe371c2)[_0x98e0('0x21')](function(_0x58d348){_0x2d3c5c[_0x98e0('0x1b')]=_0x58d348;if(_0x19fc43[_0x98e0('0x2c')][_0x98e0('0x3b')]){_0x17f354[_0x98e0('0x3c')]=[{'all':!![]}];}return db[_0x98e0('0x27')]['findAll'](_0x17f354);})[_0x98e0('0x21')](function(_0x1cf16f){_0x2d3c5c[_0x98e0('0x3d')]=_0x1cf16f;return _0x2d3c5c;})[_0x98e0('0x21')](respondWithFilteredResult(_0xdc6cd5,_0x17f354))[_0x98e0('0x3e')](handleError(_0xdc6cd5,null));};exports[_0x98e0('0x3f')]=function(_0x242330,_0x4b9bdf){var _0x40cac1={'raw':!![],'where':{'id':_0x242330[_0x98e0('0x40')]['id']}},_0x2fda99={};_0x2fda99[_0x98e0('0x2b')]=_[_0x98e0('0x2d')](db[_0x98e0('0x27')][_0x98e0('0x28')]);_0x2fda99[_0x98e0('0x2c')]=_['keys'](_0x242330['query']);_0x2fda99[_0x98e0('0x2e')]=_['intersection'](_0x2fda99[_0x98e0('0x2b')],_0x2fda99[_0x98e0('0x2c')]);_0x40cac1[_0x98e0('0x30')]=_['intersection'](_0x2fda99[_0x98e0('0x2b')],qs[_0x98e0('0x31')](_0x242330[_0x98e0('0x2c')][_0x98e0('0x31')]));_0x40cac1[_0x98e0('0x30')]=_0x40cac1[_0x98e0('0x30')][_0x98e0('0x32')]?_0x40cac1[_0x98e0('0x30')]:_0x2fda99[_0x98e0('0x2b')];if(_0x242330[_0x98e0('0x2c')]['includeAll']){_0x40cac1[_0x98e0('0x3c')]=[{'all':!![]}];}_0x40cac1=_['merge']({},_0x40cac1,_0x242330[_0x98e0('0x3a')]);return db[_0x98e0('0x27')][_0x98e0('0x41')](_0x40cac1)[_0x98e0('0x21')](handleEntityNotFound(_0x4b9bdf,null))['then'](respondWithResult(_0x4b9bdf,null))[_0x98e0('0x3e')](handleError(_0x4b9bdf,null));};exports['create']=function(_0x2a151d,_0x5d7719){return db['VtigerField'][_0x98e0('0x42')](_0x2a151d['body'],{})[_0x98e0('0x21')](respondWithResult(_0x5d7719,0xc9))[_0x98e0('0x3e')](handleError(_0x5d7719,null));};exports[_0x98e0('0x43')]=function(_0x4eb2c8,_0x197920){if(_0x4eb2c8[_0x98e0('0x44')]['id']){delete _0x4eb2c8['body']['id'];}return db[_0x98e0('0x27')][_0x98e0('0x41')]({'where':{'id':_0x4eb2c8[_0x98e0('0x40')]['id']}})['then'](handleEntityNotFound(_0x197920,null))[_0x98e0('0x21')](saveUpdates(_0x4eb2c8[_0x98e0('0x44')],null))[_0x98e0('0x21')](respondWithResult(_0x197920,null))[_0x98e0('0x3e')](handleError(_0x197920,null));};exports[_0x98e0('0x22')]=function(_0x551c95,_0x11ef0e){return db[_0x98e0('0x27')][_0x98e0('0x41')]({'where':{'id':_0x551c95[_0x98e0('0x40')]['id']}})[_0x98e0('0x21')](handleEntityNotFound(_0x11ef0e,null))[_0x98e0('0x21')](removeEntity(_0x11ef0e,null))[_0x98e0('0x3e')](handleError(_0x11ef0e,null));}; \ No newline at end of file +var _0xf3cd=['include','findAll','rows','show','params','options','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','apply','save','update','then','destroy','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','includeAll'];(function(_0x451730,_0x52bba7){var _0xa1f925=function(_0x4db048){while(--_0x4db048){_0x451730['push'](_0x451730['shift']());}};_0xa1f925(++_0x52bba7);}(_0xf3cd,0x9c));var _0xdf3c=function(_0x5cf1a1,_0x1ab924){_0x5cf1a1=_0x5cf1a1-0x0;var _0x52cbcc=_0xf3cd[_0x5cf1a1];return _0x52cbcc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf3c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf3c('0x1'));var rp=require(_0xdf3c('0x2'));var moment=require(_0xdf3c('0x3'));var BPromise=require(_0xdf3c('0x4'));var Mustache=require(_0xdf3c('0x5'));var util=require(_0xdf3c('0x6'));var path=require(_0xdf3c('0x7'));var sox=require('sox');var csv=require(_0xdf3c('0x8'));var ejs=require(_0xdf3c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdf3c('0xa'));var jsforce=require(_0xdf3c('0xb'));var deskjs=require(_0xdf3c('0xc'));var toCsv=require(_0xdf3c('0x8'));var querystring=require('querystring');var Papa=require(_0xdf3c('0xd'));var Redis=require(_0xdf3c('0xe'));var authService=require(_0xdf3c('0xf'));var qs=require(_0xdf3c('0x10'));var as=require(_0xdf3c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf3c('0x12'))('api');var utils=require(_0xdf3c('0x13'));var config=require(_0xdf3c('0x14'));var licenseUtil=require(_0xdf3c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47d17d,_0x5c8019){_0x5c8019=_0x5c8019||0xcc;return function(_0x40c51f){if(_0x40c51f){return _0x47d17d[_0xdf3c('0x16')](_0x5c8019);}return _0x47d17d[_0xdf3c('0x17')](_0x5c8019)['end']();};}function respondWithResult(_0x17f885,_0x3578c0){_0x3578c0=_0x3578c0||0xc8;return function(_0x450388){if(_0x450388){return _0x17f885[_0xdf3c('0x17')](_0x3578c0)[_0xdf3c('0x18')](_0x450388);}};}function respondWithFilteredResult(_0x26440a,_0x3501bf){return function(_0xc658a7){if(_0xc658a7){var _0x287416=typeof _0x3501bf[_0xdf3c('0x19')]==='undefined'&&typeof _0x3501bf['limit']===_0xdf3c('0x1a');var _0x25727d=_0xc658a7[_0xdf3c('0x1b')];var _0x56ab09=_0x287416?0x0:_0x3501bf[_0xdf3c('0x19')];var _0x32c009=_0x287416?_0xc658a7['count']:_0x3501bf[_0xdf3c('0x19')]+_0x3501bf[_0xdf3c('0x1c')];var _0x319c2f;if(_0x32c009>=_0x25727d){_0x32c009=_0x25727d;_0x319c2f=0xc8;}else{_0x319c2f=0xce;}_0x26440a[_0xdf3c('0x17')](_0x319c2f);return _0x26440a['set']('Content-Range',_0x56ab09+'-'+_0x32c009+'/'+_0x25727d)[_0xdf3c('0x18')](_0xc658a7);}return null;};}function patchUpdates(_0xf61e88){return function(_0x42796b){try{jsonpatch[_0xdf3c('0x1d')](_0x42796b,_0xf61e88,!![]);}catch(_0x2eaab1){return BPromise['reject'](_0x2eaab1);}return _0x42796b[_0xdf3c('0x1e')]();};}function saveUpdates(_0x1121a7,_0x304c8b){return function(_0x442fb4){if(_0x442fb4){return _0x442fb4[_0xdf3c('0x1f')](_0x1121a7)[_0xdf3c('0x20')](function(_0x50d86f){return _0x50d86f;});}return null;};}function removeEntity(_0x661e1,_0x4af335){return function(_0xc67594){if(_0xc67594){return _0xc67594[_0xdf3c('0x21')]()['then'](function(){_0x661e1[_0xdf3c('0x17')](0xcc)[_0xdf3c('0x22')]();});}};}function handleEntityNotFound(_0x543c3b,_0x16fe84){return function(_0x51a265){if(!_0x51a265){_0x543c3b['sendStatus'](0x194);}return _0x51a265;};}function handleError(_0x37fa5b,_0x4f7908){_0x4f7908=_0x4f7908||0x1f4;return function(_0x4c0453){logger[_0xdf3c('0x23')](_0x4c0453[_0xdf3c('0x24')]);if(_0x4c0453[_0xdf3c('0x25')]){delete _0x4c0453[_0xdf3c('0x25')];}_0x37fa5b[_0xdf3c('0x17')](_0x4f7908)[_0xdf3c('0x26')](_0x4c0453);};}exports[_0xdf3c('0x27')]=function(_0x4966a7,_0x13dc05){var _0x4ee339={},_0x3162c5={},_0x405967={'count':0x0,'rows':[]};var _0x258e14=_[_0xdf3c('0x28')](db[_0xdf3c('0x29')][_0xdf3c('0x2a')],function(_0x469a36){return{'name':_0x469a36[_0xdf3c('0x2b')],'type':_0x469a36['type'][_0xdf3c('0x2c')]};});_0x3162c5[_0xdf3c('0x2d')]=_[_0xdf3c('0x28')](_0x258e14,_0xdf3c('0x25'));_0x3162c5['query']=_[_0xdf3c('0x2e')](_0x4966a7[_0xdf3c('0x2f')]);_0x3162c5[_0xdf3c('0x30')]=_['intersection'](_0x3162c5[_0xdf3c('0x2d')],_0x3162c5['query']);_0x4ee339[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x3162c5[_0xdf3c('0x2d')],qs[_0xdf3c('0x33')](_0x4966a7[_0xdf3c('0x2f')]['fields']));_0x4ee339[_0xdf3c('0x31')]=_0x4ee339[_0xdf3c('0x31')][_0xdf3c('0x34')]?_0x4ee339['attributes']:_0x3162c5[_0xdf3c('0x2d')];if(!_0x4966a7['query'][_0xdf3c('0x35')](_0xdf3c('0x36'))){_0x4ee339[_0xdf3c('0x1c')]=qs[_0xdf3c('0x1c')](_0x4966a7[_0xdf3c('0x2f')][_0xdf3c('0x1c')]);_0x4ee339[_0xdf3c('0x19')]=qs[_0xdf3c('0x19')](_0x4966a7[_0xdf3c('0x2f')][_0xdf3c('0x19')]);}_0x4ee339[_0xdf3c('0x37')]=qs[_0xdf3c('0x38')](_0x4966a7[_0xdf3c('0x2f')][_0xdf3c('0x38')]);_0x4ee339[_0xdf3c('0x39')]=qs['filters'](_[_0xdf3c('0x3a')](_0x4966a7[_0xdf3c('0x2f')],_0x3162c5[_0xdf3c('0x30')]),_0x258e14);if(_0x4966a7[_0xdf3c('0x2f')]['filter']){_0x4ee339[_0xdf3c('0x39')]=_['merge'](_0x4ee339[_0xdf3c('0x39')],{'$or':_['map'](_0x258e14,function(_0x369158){if(_0x369158[_0xdf3c('0x3b')]!==_0xdf3c('0x3c')){var _0x4bcb34={};_0x4bcb34[_0x369158['name']]={'$like':'%'+_0x4966a7[_0xdf3c('0x2f')]['filter']+'%'};return _0x4bcb34;}})});}_0x4ee339=_[_0xdf3c('0x3d')]({},_0x4ee339,_0x4966a7['options']);var _0x28f185={'where':_0x4ee339[_0xdf3c('0x39')]};return db[_0xdf3c('0x29')][_0xdf3c('0x1b')](_0x28f185)[_0xdf3c('0x20')](function(_0x482e0a){_0x405967[_0xdf3c('0x1b')]=_0x482e0a;if(_0x4966a7[_0xdf3c('0x2f')][_0xdf3c('0x3e')]){_0x4ee339[_0xdf3c('0x3f')]=[{'all':!![]}];}return db[_0xdf3c('0x29')][_0xdf3c('0x40')](_0x4ee339);})[_0xdf3c('0x20')](function(_0x3bd645){_0x405967[_0xdf3c('0x41')]=_0x3bd645;return _0x405967;})['then'](respondWithFilteredResult(_0x13dc05,_0x4ee339))['catch'](handleError(_0x13dc05,null));};exports[_0xdf3c('0x42')]=function(_0x5b69e3,_0x3dce7c){var _0x2d4c77={'raw':!![],'where':{'id':_0x5b69e3[_0xdf3c('0x43')]['id']}},_0x12eb9b={};_0x12eb9b[_0xdf3c('0x2d')]=_[_0xdf3c('0x2e')](db[_0xdf3c('0x29')][_0xdf3c('0x2a')]);_0x12eb9b[_0xdf3c('0x2f')]=_['keys'](_0x5b69e3[_0xdf3c('0x2f')]);_0x12eb9b['filters']=_[_0xdf3c('0x32')](_0x12eb9b[_0xdf3c('0x2d')],_0x12eb9b[_0xdf3c('0x2f')]);_0x2d4c77[_0xdf3c('0x31')]=_['intersection'](_0x12eb9b[_0xdf3c('0x2d')],qs['fields'](_0x5b69e3[_0xdf3c('0x2f')][_0xdf3c('0x33')]));_0x2d4c77[_0xdf3c('0x31')]=_0x2d4c77[_0xdf3c('0x31')][_0xdf3c('0x34')]?_0x2d4c77[_0xdf3c('0x31')]:_0x12eb9b['model'];if(_0x5b69e3['query'][_0xdf3c('0x3e')]){_0x2d4c77[_0xdf3c('0x3f')]=[{'all':!![]}];}_0x2d4c77=_['merge']({},_0x2d4c77,_0x5b69e3[_0xdf3c('0x44')]);return db['VtigerField'][_0xdf3c('0x45')](_0x2d4c77)['then'](handleEntityNotFound(_0x3dce7c,null))[_0xdf3c('0x20')](respondWithResult(_0x3dce7c,null))[_0xdf3c('0x46')](handleError(_0x3dce7c,null));};exports[_0xdf3c('0x47')]=function(_0xfdc7fe,_0xe79668){return db['VtigerField']['create'](_0xfdc7fe[_0xdf3c('0x48')],{})[_0xdf3c('0x20')](respondWithResult(_0xe79668,0xc9))[_0xdf3c('0x46')](handleError(_0xe79668,null));};exports[_0xdf3c('0x1f')]=function(_0x5d11ee,_0x216bb3){if(_0x5d11ee['body']['id']){delete _0x5d11ee[_0xdf3c('0x48')]['id'];}return db[_0xdf3c('0x29')][_0xdf3c('0x45')]({'where':{'id':_0x5d11ee['params']['id']}})[_0xdf3c('0x20')](handleEntityNotFound(_0x216bb3,null))[_0xdf3c('0x20')](saveUpdates(_0x5d11ee['body'],null))['then'](respondWithResult(_0x216bb3,null))[_0xdf3c('0x46')](handleError(_0x216bb3,null));};exports[_0xdf3c('0x21')]=function(_0x509366,_0x28d995){return db[_0xdf3c('0x29')][_0xdf3c('0x45')]({'where':{'id':_0x509366[_0xdf3c('0x43')]['id']}})['then'](handleEntityNotFound(_0x28d995,null))[_0xdf3c('0x20')](removeEntity(_0x28d995,null))[_0xdf3c('0x46')](handleError(_0x28d995,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d6a147b..1de1fda 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 _0x16f5=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x30f5e3,_0x41d3ba){var _0x22ed90=function(_0x1b2020){while(--_0x1b2020){_0x30f5e3['push'](_0x30f5e3['shift']());}};_0x22ed90(++_0x41d3ba);}(_0x16f5,0x171));var _0x516f=function(_0x4d74a4,_0x58f772){_0x4d74a4=_0x4d74a4-0x0;var _0x3cf6f2=_0x16f5[_0x4d74a4];return _0x3cf6f2;};'use strict';var _=require(_0x516f('0x0'));var util=require(_0x516f('0x1'));var logger=require(_0x516f('0x2'))(_0x516f('0x3'));var moment=require(_0x516f('0x4'));var BPromise=require(_0x516f('0x5'));var rp=require(_0x516f('0x6'));var fs=require('fs');var path=require(_0x516f('0x7'));var rimraf=require(_0x516f('0x8'));var config=require(_0x516f('0x9'));var attributes=require(_0x516f('0xa'));module['exports']=function(_0x456c5b,_0x36fe8f){return _0x456c5b[_0x516f('0xb')](_0x516f('0xc'),attributes,{'tableName':_0x516f('0xd'),'paranoid':![],'indexes':[{'name':_0x516f('0xe'),'fields':['idField',_0x516f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf00=['util','../../config/logger','api','moment','bluebird','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash'];(function(_0x16d903,_0x2e4805){var _0x5c4861=function(_0x24ee56){while(--_0x24ee56){_0x16d903['push'](_0x16d903['shift']());}};_0x5c4861(++_0x2e4805);}(_0xbf00,0x1cd));var _0x0bf0=function(_0x55d408,_0x25416e){_0x55d408=_0x55d408-0x0;var _0x46fec2=_0xbf00[_0x55d408];return _0x46fec2;};'use strict';var _=require(_0x0bf0('0x0'));var util=require(_0x0bf0('0x1'));var logger=require(_0x0bf0('0x2'))(_0x0bf0('0x3'));var moment=require(_0x0bf0('0x4'));var BPromise=require(_0x0bf0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0bf0('0x6'));var attributes=require(_0x0bf0('0x7'));module[_0x0bf0('0x8')]=function(_0x323b25,_0x542e3c){return _0x323b25[_0x0bf0('0x9')](_0x0bf0('0xa'),attributes,{'tableName':_0x0bf0('0xb'),'paranoid':![],'indexes':[{'name':_0x0bf0('0xc'),'fields':[_0x0bf0('0xd'),'FieldId'],'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 870718e..32090d5 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 _0xe655=['jayson/promise','http','request','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5d129f,_0x49f9c3){var _0x328db1=function(_0x5e7f44){while(--_0x5e7f44){_0x5d129f['push'](_0x5d129f['shift']());}};_0x328db1(++_0x49f9c3);}(_0xe655,0x8b));var _0x5e65=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe655[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x5e65('0x0'));var util=require('util');var moment=require(_0x5e65('0x1'));var BPromise=require(_0x5e65('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e65('0x3'));var db=require(_0x5e65('0x4'))['db'];var utils=require(_0x5e65('0x5'));var logger=require(_0x5e65('0x6'))(_0x5e65('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e65('0x8'));var client=jayson['client'][_0x5e65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f7376,_0x30ed8c,_0x1e6d74){return new BPromise(function(_0x53aa06,_0x2bfe25){return client[_0x5e65('0xa')](_0x2f7376,_0x1e6d74)['then'](function(_0xd889a3){logger['info'](_0x5e65('0xb'),_0x30ed8c,'request\x20sent');logger[_0x5e65('0xc')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x30ed8c,_0x5e65('0xd'),JSON[_0x5e65('0xe')](_0xd889a3));if(_0xd889a3[_0x5e65('0xf')]){if(_0xd889a3[_0x5e65('0xf')][_0x5e65('0x10')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x30ed8c,_0xd889a3[_0x5e65('0xf')][_0x5e65('0x11')]);return _0x2bfe25(_0xd889a3['error'][_0x5e65('0x11')]);}logger[_0x5e65('0xf')](_0x5e65('0xb'),_0x30ed8c,_0xd889a3[_0x5e65('0xf')][_0x5e65('0x11')]);return _0x53aa06(_0xd889a3[_0x5e65('0xf')][_0x5e65('0x11')]);}else{logger[_0x5e65('0x12')](_0x5e65('0xb'),_0x30ed8c,_0x5e65('0xd'));_0x53aa06(_0xd889a3[_0x5e65('0x13')][_0x5e65('0x11')]);}})[_0x5e65('0x14')](function(_0x421f98){logger['error']('VtigerField,\x20%s,\x20%s',_0x30ed8c,_0x421f98);_0x2bfe25(_0x421f98);});});} \ No newline at end of file +var _0x7122=['debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x5545e4,_0x2026bf){var _0x2f57ac=function(_0x14004e){while(--_0x14004e){_0x5545e4['push'](_0x5545e4['shift']());}};_0x2f57ac(++_0x2026bf);}(_0x7122,0x1a5));var _0x2712=function(_0x39688d,_0x4d8886){_0x39688d=_0x39688d-0x0;var _0x290979=_0x7122[_0x39688d];return _0x290979;};'use strict';var _=require(_0x2712('0x0'));var util=require(_0x2712('0x1'));var moment=require(_0x2712('0x2'));var BPromise=require(_0x2712('0x3'));var rs=require(_0x2712('0x4'));var fs=require('fs');var Redis=require(_0x2712('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2712('0x6'));var logger=require(_0x2712('0x7'))(_0x2712('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2712('0x9')][_0x2712('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b4d5,_0x29a0e2,_0x1b2ebe){return new BPromise(function(_0x2db468,_0x504986){return client[_0x2712('0xb')](_0x36b4d5,_0x1b2ebe)[_0x2712('0xc')](function(_0x5079b2){logger[_0x2712('0xd')](_0x2712('0xe'),_0x29a0e2,_0x2712('0xf'));logger[_0x2712('0x10')](_0x2712('0x11'),_0x29a0e2,_0x2712('0xf'),JSON[_0x2712('0x12')](_0x5079b2));if(_0x5079b2[_0x2712('0x13')]){if(_0x5079b2[_0x2712('0x13')]['code']===0x1f4){logger[_0x2712('0x13')](_0x2712('0xe'),_0x29a0e2,_0x5079b2['error'][_0x2712('0x14')]);return _0x504986(_0x5079b2['error']['message']);}logger[_0x2712('0x13')](_0x2712('0xe'),_0x29a0e2,_0x5079b2['error'][_0x2712('0x14')]);return _0x2db468(_0x5079b2[_0x2712('0x13')][_0x2712('0x14')]);}else{logger[_0x2712('0xd')](_0x2712('0xe'),_0x29a0e2,_0x2712('0xf'));_0x2db468(_0x5079b2[_0x2712('0x15')][_0x2712('0x14')]);}})[_0x2712('0x16')](function(_0x1a285f){logger[_0x2712('0x13')](_0x2712('0xe'),_0x29a0e2,_0x1a285f);_0x504986(_0x1a285f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 26ccf62..5fe5944 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 _0x2ad6=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2ad6,0x1a1));var _0x62ad=function(_0x2d80cd,_0x2f99d){_0x2d80cd=_0x2d80cd-0x0;var _0x2f44aa=_0x2ad6[_0x2d80cd];return _0x2f44aa;};'use strict';var multer=require(_0x62ad('0x0'));var util=require('util');var path=require(_0x62ad('0x1'));var timeout=require(_0x62ad('0x2'));var express=require(_0x62ad('0x3'));var router=express[_0x62ad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x62ad('0x5'));var interaction=require(_0x62ad('0x6'));var config=require(_0x62ad('0x7'));var controller=require(_0x62ad('0x8'));router[_0x62ad('0x9')]('/',auth['isAuthenticated'](),controller[_0x62ad('0xa')]);router['get'](_0x62ad('0xb'),auth['isAuthenticated'](),controller[_0x62ad('0xc')]);router[_0x62ad('0x9')](_0x62ad('0xd'),auth[_0x62ad('0xe')](),controller[_0x62ad('0xf')]);router[_0x62ad('0x9')](_0x62ad('0x10'),auth['isAuthenticated'](),controller[_0x62ad('0x11')]);router['post']('/',auth[_0x62ad('0xe')](),controller[_0x62ad('0x12')]);router[_0x62ad('0x13')](_0x62ad('0xd'),auth['isAuthenticated'](),controller[_0x62ad('0x14')]);router[_0x62ad('0x15')](_0x62ad('0xb'),auth[_0x62ad('0xe')](),controller[_0x62ad('0x16')]);router[_0x62ad('0x17')](_0x62ad('0xb'),auth[_0x62ad('0xe')](),controller[_0x62ad('0x18')]);module[_0x62ad('0x19')]=router; \ No newline at end of file +var _0x59a1=['delete','/:id','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','post','addConfiguration','put'];(function(_0x21b254,_0x28c55b){var _0xa52d8c=function(_0x4f0a70){while(--_0x4f0a70){_0x21b254['push'](_0x21b254['shift']());}};_0xa52d8c(++_0x28c55b);}(_0x59a1,0xb7));var _0x159a=function(_0x45c0aa,_0x76ec58){_0x45c0aa=_0x45c0aa-0x0;var _0x2176dc=_0x59a1[_0x45c0aa];return _0x2176dc;};'use strict';var multer=require(_0x159a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x159a('0x1'));var express=require(_0x159a('0x2'));var router=express[_0x159a('0x3')]();var fs_extra=require(_0x159a('0x4'));var auth=require(_0x159a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x159a('0x6'));var controller=require(_0x159a('0x7'));router[_0x159a('0x8')]('/',auth[_0x159a('0x9')](),controller[_0x159a('0xa')]);router[_0x159a('0x8')]('/:id',auth[_0x159a('0x9')](),controller[_0x159a('0xb')]);router['get'](_0x159a('0xc'),auth[_0x159a('0x9')](),controller[_0x159a('0xd')]);router[_0x159a('0x8')]('/:id/fields',auth[_0x159a('0x9')](),controller['getFields']);router[_0x159a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x159a('0xe')](_0x159a('0xc'),auth['isAuthenticated'](),controller[_0x159a('0xf')]);router[_0x159a('0x10')]('/:id',auth[_0x159a('0x9')](),controller['update']);router[_0x159a('0x11')](_0x159a('0x12'),auth[_0x159a('0x9')](),controller[_0x159a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 32618aa..c1238f4 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 _0xaf11=['exports','STRING','username','remoteUri','ENUM','password','integrationTab','sequelize'];(function(_0x421791,_0x3625d8){var _0x495838=function(_0x5190c3){while(--_0x5190c3){_0x421791['push'](_0x421791['shift']());}};_0x495838(++_0x3625d8);}(_0xaf11,0x12f));var _0x1af1=function(_0x21b7ef,_0x4738b2){_0x21b7ef=_0x21b7ef-0x0;var _0x3f6a11=_0xaf11[_0x21b7ef];return _0x3f6a11;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'name':{'type':Sequelize[_0x1af1('0x2')]},'description':{'type':Sequelize[_0x1af1('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1af1('0x3')},'password':{'type':Sequelize[_0x1af1('0x2')]},'token':{'type':Sequelize[_0x1af1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1af1('0x4')},'authType':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x6'),'token'),'defaultValue':_0x1af1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x7'),'newTab'),'defaultValue':_0x1af1('0x7')}}; \ No newline at end of file +var _0x9ab8=['token','integrationTab','newTab','sequelize','exports','STRING','username','ENUM','password'];(function(_0xb7cfef,_0x41d481){var _0x3912b6=function(_0x32b7a4){while(--_0x32b7a4){_0xb7cfef['push'](_0xb7cfef['shift']());}};_0x3912b6(++_0x41d481);}(_0x9ab8,0x81));var _0x89ab=function(_0x3e4535,_0x3e8f58){_0x3e4535=_0x3e4535-0x0;var _0x5c054b=_0x9ab8[_0x3e4535];return _0x5c054b;};'use strict';var Sequelize=require(_0x89ab('0x0'));module[_0x89ab('0x1')]={'name':{'type':Sequelize[_0x89ab('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x89ab('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x89ab('0x2')]},'remoteUri':{'type':Sequelize[_0x89ab('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x5'),_0x89ab('0x6')),'defaultValue':_0x89ab('0x5')},'serverUrl':{'type':Sequelize[_0x89ab('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x7'),_0x89ab('0x8')),'defaultValue':_0x89ab('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c53afd6..a2346dd 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 _0x5423=['Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','ZendeskConfiguration','nolimit','findOne','AccountId','getSubjects','channel','type','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','lastIndexOf','ticket_fields','headers','Basic\x20%s','format','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x5423,0xe3));var _0x3542=function(_0x5e3e40,_0x2d6b1a){_0x5e3e40=_0x5e3e40-0x0;var _0x180888=_0x5423[_0x5e3e40];return _0x180888;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];var integrations=require(_0x3542('0x18'));function respondWithStatusCode(_0x43e977,_0x4ee86){_0x4ee86=_0x4ee86||0xcc;return function(_0x1a9062){if(_0x1a9062){return _0x43e977[_0x3542('0x19')](_0x4ee86);}return _0x43e977[_0x3542('0x1a')](_0x4ee86)[_0x3542('0x1b')]();};}function respondWithResult(_0x4bac5b,_0x14fe57){_0x14fe57=_0x14fe57||0xc8;return function(_0x4fb366){if(_0x4fb366){return _0x4bac5b[_0x3542('0x1a')](_0x14fe57)[_0x3542('0x1c')](_0x4fb366);}};}function respondWithFilteredResult(_0xc33d42,_0x546fbd){return function(_0x270312){if(_0x270312){var _0x177fb9=typeof _0x546fbd[_0x3542('0x1d')]==='undefined'&&typeof _0x546fbd[_0x3542('0x1e')]===_0x3542('0x1f');var _0x116859=_0x270312[_0x3542('0x20')];var _0x493d95=_0x177fb9?0x0:_0x546fbd[_0x3542('0x1d')];var _0x53d4aa=_0x177fb9?_0x270312[_0x3542('0x20')]:_0x546fbd[_0x3542('0x1d')]+_0x546fbd['limit'];var _0x1c6403;if(_0x53d4aa>=_0x116859){_0x53d4aa=_0x116859;_0x1c6403=0xc8;}else{_0x1c6403=0xce;}_0xc33d42[_0x3542('0x1a')](_0x1c6403);return _0xc33d42[_0x3542('0x21')](_0x3542('0x22'),_0x493d95+'-'+_0x53d4aa+'/'+_0x116859)[_0x3542('0x1c')](_0x270312);}return null;};}function patchUpdates(_0x4a7695){return function(_0x4a74b0){try{jsonpatch['apply'](_0x4a74b0,_0x4a7695,!![]);}catch(_0x17e3cf){return BPromise['reject'](_0x17e3cf);}return _0x4a74b0[_0x3542('0x23')]();};}function saveUpdates(_0x551645,_0x1d5f1e){return function(_0x55774d){if(_0x55774d){return _0x55774d['update'](_0x551645)[_0x3542('0x24')](function(_0xe3f983){return _0xe3f983;});}return null;};}function removeEntity(_0x5ae097,_0x5d05b2){return function(_0x3fc964){if(_0x3fc964){return _0x3fc964['destroy']()[_0x3542('0x24')](function(){_0x5ae097[_0x3542('0x1a')](0xcc)[_0x3542('0x1b')]();});}};}function handleEntityNotFound(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(!_0xf1f7d0){_0x2f2e63[_0x3542('0x19')](0x194);}return _0xf1f7d0;};}function handleError(_0x1e156e,_0x18dc6c){_0x18dc6c=_0x18dc6c||0x1f4;return function(_0x2841a1){logger[_0x3542('0x25')](_0x2841a1[_0x3542('0x26')]);if(_0x2841a1[_0x3542('0x27')]){delete _0x2841a1[_0x3542('0x27')];}_0x1e156e[_0x3542('0x1a')](_0x18dc6c)[_0x3542('0x28')](_0x2841a1);};}exports[_0x3542('0x29')]=function(_0x20eda1,_0x3bd666){var _0x5590a2={},_0x31ad47={},_0x35bbc9={'count':0x0,'rows':[]};var _0x2aec76=_['map'](db[_0x3542('0x2a')][_0x3542('0x2b')],function(_0x2e883a){return{'name':_0x2e883a[_0x3542('0x2c')],'type':_0x2e883a['type']['key']};});_0x31ad47[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x2aec76,_0x3542('0x27'));_0x31ad47[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x20eda1[_0x3542('0x2f')]);_0x31ad47[_0x3542('0x31')]=_['intersection'](_0x31ad47['model'],_0x31ad47[_0x3542('0x2f')]);_0x5590a2['attributes']=_['intersection'](_0x31ad47[_0x3542('0x2d')],qs['fields'](_0x20eda1['query'][_0x3542('0x32')]));_0x5590a2[_0x3542('0x33')]=_0x5590a2[_0x3542('0x33')]['length']?_0x5590a2[_0x3542('0x33')]:_0x31ad47['model'];if(!_0x20eda1[_0x3542('0x2f')][_0x3542('0x34')]('nolimit')){_0x5590a2[_0x3542('0x1e')]=qs['limit'](_0x20eda1[_0x3542('0x2f')][_0x3542('0x1e')]);_0x5590a2[_0x3542('0x1d')]=qs['offset'](_0x20eda1[_0x3542('0x2f')]['offset']);}_0x5590a2[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x20eda1[_0x3542('0x2f')][_0x3542('0x36')]);_0x5590a2[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x20eda1[_0x3542('0x2f')],_0x31ad47[_0x3542('0x31')]),_0x2aec76);if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]){_0x5590a2[_0x3542('0x37')]=_[_0x3542('0x3a')](_0x5590a2['where'],{'$or':_[_0x3542('0x2e')](_0x2aec76,function(_0x4a80ea){if(_0x4a80ea['type']!==_0x3542('0x3b')){var _0x3ffccc={};_0x3ffccc[_0x4a80ea[_0x3542('0x27')]]={'$like':'%'+_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x3ffccc;}})});}_0x5590a2=_[_0x3542('0x3a')]({},_0x5590a2,_0x20eda1[_0x3542('0x3c')]);var _0x42e87a={'where':_0x5590a2['where']};return db[_0x3542('0x2a')]['count'](_0x42e87a)[_0x3542('0x24')](function(_0x2baa01){_0x35bbc9['count']=_0x2baa01;if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x3d')]){_0x5590a2['include']=[{'all':!![]}];}return db[_0x3542('0x2a')][_0x3542('0x3e')](_0x5590a2);})['then'](function(_0x2682d0){_0x35bbc9[_0x3542('0x3f')]=_0x2682d0;return _0x35bbc9;})[_0x3542('0x24')](respondWithFilteredResult(_0x3bd666,_0x5590a2))[_0x3542('0x40')](handleError(_0x3bd666,null));};exports[_0x3542('0x41')]=function(_0xb12441,_0x2b54b9){var _0x4bf45a={'raw':![],'where':{'id':_0xb12441[_0x3542('0x42')]['id']}},_0x542e0c={};_0x542e0c[_0x3542('0x2d')]=_[_0x3542('0x30')](db[_0x3542('0x2a')][_0x3542('0x2b')]);_0x542e0c['query']=_[_0x3542('0x30')](_0xb12441['query']);_0x542e0c[_0x3542('0x31')]=_[_0x3542('0x43')](_0x542e0c[_0x3542('0x2d')],_0x542e0c['query']);_0x4bf45a[_0x3542('0x33')]=_[_0x3542('0x43')](_0x542e0c['model'],qs[_0x3542('0x32')](_0xb12441[_0x3542('0x2f')][_0x3542('0x32')]));_0x4bf45a[_0x3542('0x33')]=_0x4bf45a[_0x3542('0x33')][_0x3542('0x44')]?_0x4bf45a[_0x3542('0x33')]:_0x542e0c[_0x3542('0x2d')];if(_0xb12441['query']['includeAll']){_0x4bf45a['include']=[{'all':!![]}];}_0x4bf45a=_[_0x3542('0x3a')]({},_0x4bf45a,_0xb12441[_0x3542('0x3c')]);return db[_0x3542('0x2a')][_0x3542('0x45')](_0x4bf45a)[_0x3542('0x24')](handleEntityNotFound(_0x2b54b9,null))[_0x3542('0x24')](respondWithResult(_0x2b54b9,null))[_0x3542('0x40')](handleError(_0x2b54b9,null));};exports['create']=function(_0x157683,_0x14b960){return db[_0x3542('0x2a')][_0x3542('0x46')](_0x157683['body'],{})[_0x3542('0x24')](respondWithResult(_0x14b960,0xc9))[_0x3542('0x40')](handleError(_0x14b960,null));};exports['update']=function(_0x528f8c,_0x1fb253){if(_0x528f8c[_0x3542('0x47')]['id']){delete _0x528f8c[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x528f8c[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x1fb253,null))['then'](saveUpdates(_0x528f8c[_0x3542('0x47')],null))[_0x3542('0x24')](respondWithResult(_0x1fb253,null))[_0x3542('0x40')](handleError(_0x1fb253,null));};exports[_0x3542('0x48')]=function(_0x1ebc82,_0x28be34){return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x1ebc82[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x28be34,null))['then'](removeEntity(_0x28be34,null))[_0x3542('0x40')](handleError(_0x28be34,null));};exports['getConfigurations']=function(_0x5a798a,_0x572e7a,_0x286222){var _0xd5c5c3={};var _0x381885={};var _0x48cfc4;var _0x2db495;return db[_0x3542('0x2a')]['findOne']({'where':{'id':_0x5a798a[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x572e7a,null))[_0x3542('0x24')](function(_0x196c59){if(_0x196c59){_0x48cfc4=_0x196c59;_0x381885[_0x3542('0x2d')]=_['keys'](db[_0x3542('0x49')][_0x3542('0x2b')]);_0x381885[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5a798a[_0x3542('0x2f')]);_0x381885['filters']=_['intersection'](_0x381885[_0x3542('0x2d')],_0x381885[_0x3542('0x2f')]);_0xd5c5c3[_0x3542('0x33')]=_['intersection'](_0x381885[_0x3542('0x2d')],qs[_0x3542('0x32')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x32')]));_0xd5c5c3[_0x3542('0x33')]=_0xd5c5c3['attributes']['length']?_0xd5c5c3[_0x3542('0x33')]:_0x381885['model'];_0xd5c5c3[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x5a798a['query'][_0x3542('0x36')]);_0xd5c5c3[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x5a798a[_0x3542('0x2f')],_0x381885['filters']));if(_0x5a798a['query'][_0x3542('0x39')]){_0xd5c5c3['where']=_[_0x3542('0x3a')](_0xd5c5c3[_0x3542('0x37')],{'$or':_[_0x3542('0x2e')](_0xd5c5c3['attributes'],function(_0xd9c90c){var _0x1f8ddb={};_0x1f8ddb[_0xd9c90c]={'$like':'%'+_0x5a798a[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x1f8ddb;})});}_0xd5c5c3=_[_0x3542('0x3a')]({},_0xd5c5c3,_0x5a798a[_0x3542('0x3c')]);return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})[_0x3542('0x24')](function(_0x3ee446){if(_0x3ee446){_0x2db495=_0x3ee446[_0x3542('0x44')];if(!_0x5a798a[_0x3542('0x2f')][_0x3542('0x34')](_0x3542('0x4a'))){_0xd5c5c3['limit']=qs[_0x3542('0x1e')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1e')]);_0xd5c5c3[_0x3542('0x1d')]=qs['offset'](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1d')]);}return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})['then'](function(_0x2908e5){if(_0x2908e5){return _0x2908e5?{'count':_0x2db495,'rows':_0x2908e5}:null;}})['then'](respondWithResult(_0x572e7a,null))[_0x3542('0x40')](handleError(_0x572e7a,null));};exports['addConfiguration']=function(_0x484204,_0x42a34a,_0x471408){if(_0x484204[_0x3542('0x47')]['id']){delete _0x484204[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x4b')]({'where':{'id':_0x484204[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x42a34a,null))[_0x3542('0x24')](function(_0xf1cf57){if(_0xf1cf57){_0x484204[_0x3542('0x47')][_0x3542('0x4c')]=_0xf1cf57['id'];_0x484204[_0x3542('0x47')]['Subjects']=integrations[_0x3542('0x4d')](_0x484204[_0x3542('0x47')][_0x3542('0x4e')],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);_0x484204[_0x3542('0x47')][_0x3542('0x50')]=integrations['getDescriptions'](_0x484204[_0x3542('0x47')]['channel'],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);return db[_0x3542('0x49')][_0x3542('0x46')](_0x484204['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x3542('0x51')],'as':_0x3542('0x50')}]});}return null;})[_0x3542('0x24')](respondWithResult(_0x42a34a,null))[_0x3542('0x40')](handleError(_0x42a34a,null));};exports[_0x3542('0x52')]=function(_0x2afc71,_0x3c84fa,_0x77f0af){var _0x2b0de0='';return db['ZendeskAccount'][_0x3542('0x4b')]({'where':{'id':_0x2afc71[_0x3542('0x42')]['id']},'attributes':['id',_0x3542('0x53'),_0x3542('0x54'),_0x3542('0x55'),'authType','remoteUri']})[_0x3542('0x24')](handleEntityNotFound(_0x3c84fa,null))[_0x3542('0x24')](function(_0x52c26d){if(_0x52c26d){_0x2b0de0=_0x52c26d[_0x3542('0x56')];var _0x4b5327=_0x2b0de0[_0x3542('0x57')](-0x1);if(_0x4b5327==='/'){_0x2b0de0=_0x2b0de0['substring'](0x0,_0x2b0de0[_0x3542('0x58')](_0x4b5327));}var _0x153e1b={'method':'GET','uri':util['format']('%s/%s',_0x2b0de0,_0x3542('0x59')),'json':!![]};switch(_0x52c26d['authType']){case _0x3542('0x54'):_0x153e1b[_0x3542('0x5a')]={'Authorization':util['format'](_0x3542('0x5b'),new Buffer(util[_0x3542('0x5c')](_0x3542('0x5d'),_0x52c26d['username'],_0x52c26d[_0x3542('0x54')]))['toString'](_0x3542('0x5e')))};break;case'token':_0x153e1b[_0x3542('0x5a')]={'Authorization':util[_0x3542('0x5c')](_0x3542('0x5b'),new Buffer(util['format'](_0x3542('0x5f'),_0x52c26d[_0x3542('0x53')],_0x52c26d[_0x3542('0x55')]))[_0x3542('0x60')]('base64'))};break;default:throw new db['Sequelize'][(_0x3542('0x61'))](_0x3542('0x62'));}return rp(_0x153e1b);}})[_0x3542('0x24')](function(_0xaa97d5){if(_0xaa97d5){var _0x191fdd=[_0x3542('0x63'),_0x3542('0x64'),_0x3542('0x65'),_0x3542('0x66')];_[_0x3542('0x67')](_0xaa97d5[_0x3542('0x59')],function(_0x1c318c){return _0x191fdd[_0x3542('0x68')](_0x1c318c[_0x3542('0x4f')]);});return{'count':_0xaa97d5[_0x3542('0x59')][_0x3542('0x44')],'rows':_[_0x3542('0x2e')](_0xaa97d5[_0x3542('0x59')],function(_0x4e04b6){return{'id':_0x4e04b6['id'],'name':_0x4e04b6[_0x3542('0x69')]>0x7?_0x4e04b6[_0x3542('0x6a')]:_0x4e04b6['type'],'custom':_0x4e04b6['position']>0x7?!![]:![],'options':_0x4e04b6[_0x3542('0x6b')]?_0x4e04b6[_0x3542('0x6b')]:_0x4e04b6[_0x3542('0x6c')]?_0x4e04b6[_0x3542('0x6c')]:[]};})};}})['then'](respondWithResult(_0x3c84fa,null))[_0x3542('0x40')](function(_0x2d17ce){var _0x54e723=_0x2afc71[_0x3542('0x2f')]['test']?0x1f4:_0x2d17ce[_0x3542('0x6d')]||0x1f4;logger['error'](_0x3542('0x6e'),_0x3542('0x52'),_0x54e723,JSON[_0x3542('0x6f')](_0x2d17ce));delete _0x2d17ce[_0x3542('0x27')];if(_0x54e723===0x191){_0x54e723=0x190;}_0x3c84fa[_0x3542('0x1a')](_0x54e723)[_0x3542('0x28')](_0x2afc71[_0x3542('0x2f')]['test']?{'message':_0x3542('0x70'),'statusCode':_0x2d17ce['statusCode']}:_0x2d17ce);});}; \ No newline at end of file +var _0xefda=['getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','stringify','send','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','channel','type','Descriptions'];(function(_0x561049,_0x330926){var _0x52f109=function(_0x1a5d24){while(--_0x1a5d24){_0x561049['push'](_0x561049['shift']());}};_0x52f109(++_0x330926);}(_0xefda,0x96));var _0xaefd=function(_0x4a0ba2,_0x3bd15){_0x4a0ba2=_0x4a0ba2-0x0;var _0x3258d5=_0xefda[_0x4a0ba2];return _0x3258d5;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var integrations=require(_0xaefd('0x18'));function respondWithStatusCode(_0x2a310c,_0x4b2b5c){_0x4b2b5c=_0x4b2b5c||0xcc;return function(_0x3172d3){if(_0x3172d3){return _0x2a310c['sendStatus'](_0x4b2b5c);}return _0x2a310c[_0xaefd('0x19')](_0x4b2b5c)[_0xaefd('0x1a')]();};}function respondWithResult(_0x9dfdf6,_0x43b82a){_0x43b82a=_0x43b82a||0xc8;return function(_0x4ec92a){if(_0x4ec92a){return _0x9dfdf6[_0xaefd('0x19')](_0x43b82a)[_0xaefd('0x1b')](_0x4ec92a);}};}function respondWithFilteredResult(_0x41f345,_0x411701){return function(_0x10ee28){if(_0x10ee28){var _0x32f75e=typeof _0x411701[_0xaefd('0x1c')]===_0xaefd('0x1d')&&typeof _0x411701['limit']===_0xaefd('0x1d');var _0x109604=_0x10ee28[_0xaefd('0x1e')];var _0x1737a1=_0x32f75e?0x0:_0x411701[_0xaefd('0x1c')];var _0x244956=_0x32f75e?_0x10ee28['count']:_0x411701[_0xaefd('0x1c')]+_0x411701[_0xaefd('0x1f')];var _0x24f131;if(_0x244956>=_0x109604){_0x244956=_0x109604;_0x24f131=0xc8;}else{_0x24f131=0xce;}_0x41f345[_0xaefd('0x19')](_0x24f131);return _0x41f345[_0xaefd('0x20')](_0xaefd('0x21'),_0x1737a1+'-'+_0x244956+'/'+_0x109604)['json'](_0x10ee28);}return null;};}function patchUpdates(_0x463d48){return function(_0x18e71c){try{jsonpatch[_0xaefd('0x22')](_0x18e71c,_0x463d48,!![]);}catch(_0x3d9823){return BPromise[_0xaefd('0x23')](_0x3d9823);}return _0x18e71c['save']();};}function saveUpdates(_0x479486,_0x5b9967){return function(_0x21680a){if(_0x21680a){return _0x21680a[_0xaefd('0x24')](_0x479486)[_0xaefd('0x25')](function(_0x5a44ed){return _0x5a44ed;});}return null;};}function removeEntity(_0x23060f,_0x4cd9b2){return function(_0x3deec8){if(_0x3deec8){return _0x3deec8[_0xaefd('0x26')]()[_0xaefd('0x25')](function(){_0x23060f['status'](0xcc)[_0xaefd('0x1a')]();});}};}function handleEntityNotFound(_0x3ffc9c,_0x18e720){return function(_0x14cc9d){if(!_0x14cc9d){_0x3ffc9c[_0xaefd('0x27')](0x194);}return _0x14cc9d;};}function handleError(_0x5a170c,_0x2fe27e){_0x2fe27e=_0x2fe27e||0x1f4;return function(_0x58c008){logger[_0xaefd('0x28')](_0x58c008[_0xaefd('0x29')]);if(_0x58c008['name']){delete _0x58c008[_0xaefd('0x2a')];}_0x5a170c[_0xaefd('0x19')](_0x2fe27e)['send'](_0x58c008);};}exports[_0xaefd('0x2b')]=function(_0x114ec0,_0x36b6b7){var _0x4c0898={},_0x45f0e8={},_0x5c573b={'count':0x0,'rows':[]};var _0x109e19=_['map'](db['ZendeskAccount'][_0xaefd('0x2c')],function(_0x1b470c){return{'name':_0x1b470c['fieldName'],'type':_0x1b470c['type']['key']};});_0x45f0e8[_0xaefd('0x2d')]=_[_0xaefd('0x2e')](_0x109e19,'name');_0x45f0e8['query']=_[_0xaefd('0x2f')](_0x114ec0[_0xaefd('0x30')]);_0x45f0e8[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x45f0e8['model'],_0x45f0e8[_0xaefd('0x30')]);_0x4c0898[_0xaefd('0x33')]=_[_0xaefd('0x32')](_0x45f0e8[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x34')]));_0x4c0898[_0xaefd('0x33')]=_0x4c0898[_0xaefd('0x33')][_0xaefd('0x35')]?_0x4c0898[_0xaefd('0x33')]:_0x45f0e8[_0xaefd('0x2d')];if(!_0x114ec0[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4c0898[_0xaefd('0x1f')]=qs['limit'](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4c0898[_0xaefd('0x1c')]=qs['offset'](_0x114ec0[_0xaefd('0x30')]['offset']);}_0x4c0898[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x39')]);_0x4c0898[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x114ec0[_0xaefd('0x30')],_0x45f0e8[_0xaefd('0x31')]),_0x109e19);if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4c0898[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4c0898[_0xaefd('0x3a')],{'$or':_['map'](_0x109e19,function(_0x1cfd6d){if(_0x1cfd6d['type']!==_0xaefd('0x3e')){var _0x6562={};_0x6562[_0x1cfd6d[_0xaefd('0x2a')]]={'$like':'%'+_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x6562;}})});}_0x4c0898=_[_0xaefd('0x3d')]({},_0x4c0898,_0x114ec0[_0xaefd('0x3f')]);var _0x145e9e={'where':_0x4c0898[_0xaefd('0x3a')]};return db[_0xaefd('0x40')]['count'](_0x145e9e)[_0xaefd('0x25')](function(_0x3296ac){_0x5c573b['count']=_0x3296ac;if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x41')]){_0x4c0898[_0xaefd('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4c0898);})[_0xaefd('0x25')](function(_0x3d0abf){_0x5c573b[_0xaefd('0x43')]=_0x3d0abf;return _0x5c573b;})[_0xaefd('0x25')](respondWithFilteredResult(_0x36b6b7,_0x4c0898))[_0xaefd('0x44')](handleError(_0x36b6b7,null));};exports[_0xaefd('0x45')]=function(_0x2e17b5,_0x2e98aa){var _0x48a7af={'raw':![],'where':{'id':_0x2e17b5[_0xaefd('0x46')]['id']}},_0x26587e={};_0x26587e[_0xaefd('0x2d')]=_[_0xaefd('0x2f')](db[_0xaefd('0x40')][_0xaefd('0x2c')]);_0x26587e[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x2e17b5['query']);_0x26587e['filters']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],_0x26587e['query']);_0x48a7af['attributes']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x34')]));_0x48a7af[_0xaefd('0x33')]=_0x48a7af[_0xaefd('0x33')][_0xaefd('0x35')]?_0x48a7af[_0xaefd('0x33')]:_0x26587e['model'];if(_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x41')]){_0x48a7af[_0xaefd('0x42')]=[{'all':!![]}];}_0x48a7af=_[_0xaefd('0x3d')]({},_0x48a7af,_0x2e17b5[_0xaefd('0x3f')]);return db[_0xaefd('0x40')][_0xaefd('0x47')](_0x48a7af)['then'](handleEntityNotFound(_0x2e98aa,null))[_0xaefd('0x25')](respondWithResult(_0x2e98aa,null))['catch'](handleError(_0x2e98aa,null));};exports[_0xaefd('0x48')]=function(_0x374845,_0x16c664){return db[_0xaefd('0x40')]['create'](_0x374845['body'],{})[_0xaefd('0x25')](respondWithResult(_0x16c664,0xc9))[_0xaefd('0x44')](handleError(_0x16c664,null));};exports[_0xaefd('0x24')]=function(_0x4eeb56,_0x2a836a){if(_0x4eeb56[_0xaefd('0x49')]['id']){delete _0x4eeb56['body']['id'];}return db[_0xaefd('0x40')][_0xaefd('0x47')]({'where':{'id':_0x4eeb56[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x2a836a,null))[_0xaefd('0x25')](saveUpdates(_0x4eeb56[_0xaefd('0x49')],null))[_0xaefd('0x25')](respondWithResult(_0x2a836a,null))[_0xaefd('0x44')](handleError(_0x2a836a,null));};exports['destroy']=function(_0x567ceb,_0x1406b8){return db[_0xaefd('0x40')]['find']({'where':{'id':_0x567ceb[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1406b8,null))[_0xaefd('0x25')](removeEntity(_0x1406b8,null))[_0xaefd('0x44')](handleError(_0x1406b8,null));};exports[_0xaefd('0x4a')]=function(_0x69185e,_0x27fd3f,_0xf727cd){var _0x4b709a={};var _0x56e180={};var _0x1fd0b0;var _0x338823;return db['ZendeskAccount'][_0xaefd('0x4b')]({'where':{'id':_0x69185e[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x27fd3f,null))[_0xaefd('0x25')](function(_0x4a883b){if(_0x4a883b){_0x1fd0b0=_0x4a883b;_0x56e180['model']=_[_0xaefd('0x2f')](db[_0xaefd('0x4c')][_0xaefd('0x2c')]);_0x56e180[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x69185e['query']);_0x56e180[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x56e180['model'],_0x56e180[_0xaefd('0x30')]);_0x4b709a[_0xaefd('0x33')]=_['intersection'](_0x56e180[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x69185e[_0xaefd('0x30')]['fields']));_0x4b709a[_0xaefd('0x33')]=_0x4b709a[_0xaefd('0x33')]['length']?_0x4b709a[_0xaefd('0x33')]:_0x56e180[_0xaefd('0x2d')];_0x4b709a[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x69185e['query']['sort']);_0x4b709a[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x69185e[_0xaefd('0x30')],_0x56e180[_0xaefd('0x31')]));if(_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4b709a[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4b709a[_0xaefd('0x3a')],{'$or':_['map'](_0x4b709a['attributes'],function(_0x324eb4){var _0x431c1a={};_0x431c1a[_0x324eb4]={'$like':'%'+_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x431c1a;})});}_0x4b709a=_['merge']({},_0x4b709a,_0x69185e[_0xaefd('0x3f')]);return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x1ad04e){if(_0x1ad04e){_0x338823=_0x1ad04e[_0xaefd('0x35')];if(!_0x69185e[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4b709a['limit']=qs[_0xaefd('0x1f')](_0x69185e[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4b709a[_0xaefd('0x1c')]=qs['offset'](_0x69185e[_0xaefd('0x30')]['offset']);}return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x516913){if(_0x516913){return _0x516913?{'count':_0x338823,'rows':_0x516913}:null;}})['then'](respondWithResult(_0x27fd3f,null))[_0xaefd('0x44')](handleError(_0x27fd3f,null));};exports['addConfiguration']=function(_0x5e0068,_0x4e75bc,_0xe2397c){if(_0x5e0068[_0xaefd('0x49')]['id']){delete _0x5e0068[_0xaefd('0x49')]['id'];}return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x5e0068[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e75bc,null))['then'](function(_0x4f8e16){if(_0x4f8e16){_0x5e0068['body'][_0xaefd('0x4d')]=_0x4f8e16['id'];_0x5e0068['body'][_0xaefd('0x4e')]=integrations['getSubjects'](_0x5e0068[_0xaefd('0x49')][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);_0x5e0068[_0xaefd('0x49')][_0xaefd('0x51')]=integrations[_0xaefd('0x52')](_0x5e0068['body'][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);return db[_0xaefd('0x4c')]['create'](_0x5e0068[_0xaefd('0x49')],{'include':[{'model':db['ZendeskField'],'as':_0xaefd('0x4e')},{'model':db[_0xaefd('0x53')],'as':_0xaefd('0x51')}]});}return null;})[_0xaefd('0x25')](respondWithResult(_0x4e75bc,null))[_0xaefd('0x44')](handleError(_0x4e75bc,null));};exports[_0xaefd('0x54')]=function(_0x57776e,_0x1a6195,_0x3b39db){var _0x4a9fa5='';return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x57776e['params']['id']},'attributes':['id',_0xaefd('0x55'),_0xaefd('0x56'),_0xaefd('0x57'),_0xaefd('0x58'),_0xaefd('0x59')]})[_0xaefd('0x25')](handleEntityNotFound(_0x1a6195,null))[_0xaefd('0x25')](function(_0x6f99b0){if(_0x6f99b0){_0x4a9fa5=_0x6f99b0[_0xaefd('0x59')];var _0x1ec9be=_0x4a9fa5[_0xaefd('0x5a')](-0x1);if(_0x1ec9be==='/'){_0x4a9fa5=_0x4a9fa5[_0xaefd('0x5b')](0x0,_0x4a9fa5[_0xaefd('0x5c')](_0x1ec9be));}var _0x43338b={'method':_0xaefd('0x5d'),'uri':util[_0xaefd('0x5e')](_0xaefd('0x5f'),_0x4a9fa5,'ticket_fields'),'json':!![]};switch(_0x6f99b0[_0xaefd('0x58')]){case _0xaefd('0x56'):_0x43338b[_0xaefd('0x60')]={'Authorization':util['format'](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')](_0xaefd('0x62'),_0x6f99b0[_0xaefd('0x55')],_0x6f99b0['password']))[_0xaefd('0x63')]('base64'))};break;case _0xaefd('0x57'):_0x43338b['headers']={'Authorization':util[_0xaefd('0x5e')](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')]('%s/token:%s',_0x6f99b0['username'],_0x6f99b0[_0xaefd('0x57')]))[_0xaefd('0x63')](_0xaefd('0x64')))};break;default:throw new db[(_0xaefd('0x65'))][(_0xaefd('0x66'))](_0xaefd('0x67'));}return rp(_0x43338b);}})['then'](function(_0x499d7d){if(_0x499d7d){var _0x58c97c=['subject','description',_0xaefd('0x68'),_0xaefd('0x69')];_[_0xaefd('0x6a')](_0x499d7d[_0xaefd('0x6b')],function(_0x5ae635){return _0x58c97c[_0xaefd('0x6c')](_0x5ae635[_0xaefd('0x50')]);});return{'count':_0x499d7d['ticket_fields'][_0xaefd('0x35')],'rows':_['map'](_0x499d7d[_0xaefd('0x6b')],function(_0x51b6f1){return{'id':_0x51b6f1['id'],'name':_0x51b6f1[_0xaefd('0x6d')]>0x7?_0x51b6f1['title']:_0x51b6f1[_0xaefd('0x50')],'custom':_0x51b6f1['position']>0x7?!![]:![],'options':_0x51b6f1[_0xaefd('0x6e')]?_0x51b6f1[_0xaefd('0x6e')]:_0x51b6f1['custom_field_options']?_0x51b6f1[_0xaefd('0x6f')]:[]};})};}})[_0xaefd('0x25')](respondWithResult(_0x1a6195,null))[_0xaefd('0x44')](function(_0x564c89){var _0x42c55c=_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?0x1f4:_0x564c89[_0xaefd('0x71')]||0x1f4;logger[_0xaefd('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xaefd('0x54'),_0x42c55c,JSON[_0xaefd('0x72')](_0x564c89));delete _0x564c89['name'];if(_0x42c55c===0x191){_0x42c55c=0x190;}_0x1a6195[_0xaefd('0x19')](_0x42c55c)[_0xaefd('0x73')](_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x564c89[_0xaefd('0x71')]}:_0x564c89);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 9f3f481..67830e9 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 _0x7d18=['exports','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x7d18,0xc6));var _0x87d1=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x7d18[_0x2e50a2];return _0x47e5de;};'use strict';var _=require('lodash');var util=require(_0x87d1('0x0'));var logger=require(_0x87d1('0x1'))(_0x87d1('0x2'));var moment=require(_0x87d1('0x3'));var BPromise=require(_0x87d1('0x4'));var rp=require(_0x87d1('0x5'));var fs=require('fs');var path=require(_0x87d1('0x6'));var rimraf=require(_0x87d1('0x7'));var config=require('../../config/environment');var attributes=require(_0x87d1('0x8'));var integrations=require(_0x87d1('0x9'));module[_0x87d1('0xa')]=function(_0x3a8409,_0x511c31){return _0x3a8409['define'](_0x87d1('0xb'),attributes,{'tableName':_0x87d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6107=['ZendeskAccount','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6107,0x114));var _0x7610=function(_0xbcb8a8,_0x23e919){_0xbcb8a8=_0xbcb8a8-0x0;var _0xdee05d=_0x6107[_0xbcb8a8];return _0xdee05d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7610('0x0'))('api');var moment=require(_0x7610('0x1'));var BPromise=require(_0x7610('0x2'));var rp=require(_0x7610('0x3'));var fs=require('fs');var path=require(_0x7610('0x4'));var rimraf=require(_0x7610('0x5'));var config=require(_0x7610('0x6'));var attributes=require(_0x7610('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x7610('0x8')]=function(_0x382ff8,_0x1e3f1f){return _0x382ff8[_0x7610('0x9')](_0x7610('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index f7d07ed..b1594b9 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 _0xa2f0=['ZendeskAccount','findAll','options','attributes','include','model','map','ShowZendeskAccount','raw','where','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount'];(function(_0x5efce9,_0x11ee8d){var _0x273c91=function(_0x4d9087){while(--_0x4d9087){_0x5efce9['push'](_0x5efce9['shift']());}};_0x273c91(++_0x11ee8d);}(_0xa2f0,0x82));var _0x0a2f=function(_0x41d102,_0x6a30e7){_0x41d102=_0x41d102-0x0;var _0x2e2f51=_0xa2f0[_0x41d102];return _0x2e2f51;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a2f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a2f('0x1'))['db'];var utils=require(_0x0a2f('0x2'));var logger=require(_0x0a2f('0x3'))(_0x0a2f('0x4'));var config=require('../../config/environment');var jayson=require(_0x0a2f('0x5'));var client=jayson[_0x0a2f('0x6')][_0x0a2f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a9d4d,_0x524800,_0x562a04){return new BPromise(function(_0x47a56e,_0x231f98){return client['request'](_0x3a9d4d,_0x562a04)[_0x0a2f('0x8')](function(_0x5377a5){logger[_0x0a2f('0x9')](_0x0a2f('0xa'),_0x524800,_0x0a2f('0xb'));logger[_0x0a2f('0xc')](_0x0a2f('0xd'),_0x524800,'request\x20sent',JSON[_0x0a2f('0xe')](_0x5377a5));if(_0x5377a5[_0x0a2f('0xf')]){if(_0x5377a5[_0x0a2f('0xf')]['code']===0x1f4){logger[_0x0a2f('0xf')](_0x0a2f('0xa'),_0x524800,_0x5377a5['error'][_0x0a2f('0x10')]);return _0x231f98(_0x5377a5[_0x0a2f('0xf')][_0x0a2f('0x10')]);}logger[_0x0a2f('0xf')](_0x0a2f('0xa'),_0x524800,_0x5377a5[_0x0a2f('0xf')][_0x0a2f('0x10')]);return _0x47a56e(_0x5377a5[_0x0a2f('0xf')][_0x0a2f('0x10')]);}else{logger[_0x0a2f('0x9')](_0x0a2f('0xa'),_0x524800,_0x0a2f('0xb'));_0x47a56e(_0x5377a5[_0x0a2f('0x11')][_0x0a2f('0x10')]);}})[_0x0a2f('0x12')](function(_0xecf13c){logger[_0x0a2f('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x524800,_0xecf13c);_0x231f98(_0xecf13c);});});}exports[_0x0a2f('0x13')]=function(_0x4c6ffc){var _0x3fa538=this;return new Promise(function(_0x3e88ba,_0x479aa3){return db[_0x0a2f('0x14')][_0x0a2f('0x15')]({'raw':_0x4c6ffc[_0x0a2f('0x16')]?_0x4c6ffc['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c6ffc[_0x0a2f('0x16')]?_0x4c6ffc['options']['where']||null:null,'attributes':_0x4c6ffc['options']?_0x4c6ffc['options'][_0x0a2f('0x17')]||null:null,'limit':_0x4c6ffc['options']?_0x4c6ffc[_0x0a2f('0x16')]['limit']||null:null,'include':_0x4c6ffc[_0x0a2f('0x16')]?_0x4c6ffc[_0x0a2f('0x16')][_0x0a2f('0x18')]?_['map'](_0x4c6ffc['options'][_0x0a2f('0x18')],function(_0x3ec2e4){return{'model':db[_0x3ec2e4[_0x0a2f('0x19')]],'as':_0x3ec2e4['as'],'attributes':_0x3ec2e4['attributes'],'include':_0x3ec2e4[_0x0a2f('0x18')]?_[_0x0a2f('0x1a')](_0x3ec2e4[_0x0a2f('0x18')],function(_0x206640){return{'model':db[_0x206640[_0x0a2f('0x19')]],'as':_0x206640['as'],'attributes':_0x206640[_0x0a2f('0x17')],'include':_0x206640[_0x0a2f('0x18')]?_['map'](_0x206640[_0x0a2f('0x18')],function(_0x496796){return{'model':db[_0x496796[_0x0a2f('0x19')]],'as':_0x496796['as'],'attributes':_0x496796[_0x0a2f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0a2f('0x8')](function(_0x206cb8){logger[_0x0a2f('0x9')](_0x0a2f('0x13'),_0x4c6ffc);logger[_0x0a2f('0xc')](_0x0a2f('0x13'),_0x4c6ffc,JSON[_0x0a2f('0xe')](_0x206cb8));_0x3e88ba(_0x206cb8);})[_0x0a2f('0x12')](function(_0x2fb810){logger[_0x0a2f('0xf')](_0x0a2f('0x13'),_0x2fb810[_0x0a2f('0x10')],_0x4c6ffc);_0x479aa3(_0x3fa538[_0x0a2f('0xf')](0x1f4,_0x2fb810[_0x0a2f('0x10')]));});});};exports[_0x0a2f('0x1b')]=function(_0xd5fc60){var _0x52ba64=this;return new Promise(function(_0x2fa044,_0x3bfda0){return db[_0x0a2f('0x14')]['find']({'raw':_0xd5fc60[_0x0a2f('0x16')]?_0xd5fc60[_0x0a2f('0x16')][_0x0a2f('0x1c')]===undefined?!![]:![]:!![],'where':_0xd5fc60[_0x0a2f('0x16')]?_0xd5fc60['options'][_0x0a2f('0x1d')]||null:null,'attributes':_0xd5fc60[_0x0a2f('0x16')]?_0xd5fc60[_0x0a2f('0x16')][_0x0a2f('0x17')]||null:null,'include':_0xd5fc60[_0x0a2f('0x16')]?_0xd5fc60[_0x0a2f('0x16')]['include']?_[_0x0a2f('0x1a')](_0xd5fc60[_0x0a2f('0x16')][_0x0a2f('0x18')],function(_0x2e2955){return{'model':db[_0x2e2955[_0x0a2f('0x19')]],'as':_0x2e2955['as'],'attributes':_0x2e2955[_0x0a2f('0x17')],'include':_0x2e2955[_0x0a2f('0x18')]?_[_0x0a2f('0x1a')](_0x2e2955[_0x0a2f('0x18')],function(_0x846af8){return{'model':db[_0x846af8[_0x0a2f('0x19')]],'as':_0x846af8['as'],'attributes':_0x846af8[_0x0a2f('0x17')],'include':_0x846af8['include']?_[_0x0a2f('0x1a')](_0x846af8['include'],function(_0x1a9a3e){return{'model':db[_0x1a9a3e[_0x0a2f('0x19')]],'as':_0x1a9a3e['as'],'attributes':_0x1a9a3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a2f('0x8')](function(_0x16df01){logger['info']('ShowZendeskAccount',_0xd5fc60);logger['debug']('ShowZendeskAccount',_0xd5fc60,JSON['stringify'](_0x16df01));_0x2fa044(_0x16df01);})[_0x0a2f('0x12')](function(_0x579f89){logger['error']('ShowZendeskAccount',_0x579f89[_0x0a2f('0x10')],_0xd5fc60);_0x3bfda0(_0x52ba64['error'](0x1f4,_0x579f89['message']));});});}; \ No newline at end of file +var _0x3600=['where','limit','include','map','model','attributes','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw'];(function(_0x2b9b81,_0x5fbf90){var _0x4ca88b=function(_0x13f707){while(--_0x13f707){_0x2b9b81['push'](_0x2b9b81['shift']());}};_0x4ca88b(++_0x5fbf90);}(_0x3600,0x142));var _0x0360=function(_0x51e8d2,_0x5a823e){_0x51e8d2=_0x51e8d2-0x0;var _0x65a20d=_0x3600[_0x51e8d2];return _0x65a20d;};'use strict';var _=require(_0x0360('0x0'));var util=require(_0x0360('0x1'));var moment=require(_0x0360('0x2'));var BPromise=require(_0x0360('0x3'));var rs=require(_0x0360('0x4'));var fs=require('fs');var Redis=require(_0x0360('0x5'));var db=require(_0x0360('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0360('0x7'))(_0x0360('0x8'));var config=require(_0x0360('0x9'));var jayson=require(_0x0360('0xa'));var client=jayson[_0x0360('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46d23d,_0x2179f7,_0x400e04){return new BPromise(function(_0x408931,_0x1df293){return client['request'](_0x46d23d,_0x400e04)[_0x0360('0xc')](function(_0x51aefa){logger[_0x0360('0xd')](_0x0360('0xe'),_0x2179f7,_0x0360('0xf'));logger[_0x0360('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2179f7,_0x0360('0xf'),JSON[_0x0360('0x11')](_0x51aefa));if(_0x51aefa[_0x0360('0x12')]){if(_0x51aefa[_0x0360('0x12')][_0x0360('0x13')]===0x1f4){logger[_0x0360('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x2179f7,_0x51aefa['error'][_0x0360('0x14')]);return _0x1df293(_0x51aefa[_0x0360('0x12')][_0x0360('0x14')]);}logger[_0x0360('0x12')](_0x0360('0xe'),_0x2179f7,_0x51aefa[_0x0360('0x12')][_0x0360('0x14')]);return _0x408931(_0x51aefa[_0x0360('0x12')][_0x0360('0x14')]);}else{logger[_0x0360('0xd')](_0x0360('0xe'),_0x2179f7,_0x0360('0xf'));_0x408931(_0x51aefa[_0x0360('0x15')][_0x0360('0x14')]);}})[_0x0360('0x16')](function(_0x5dd481){logger[_0x0360('0x12')](_0x0360('0xe'),_0x2179f7,_0x5dd481);_0x1df293(_0x5dd481);});});}exports[_0x0360('0x17')]=function(_0x30cff5){var _0x1c266e=this;return new Promise(function(_0x51c4f9,_0x18ff86){return db[_0x0360('0x18')][_0x0360('0x19')]({'raw':_0x30cff5[_0x0360('0x1a')]?_0x30cff5['options'][_0x0360('0x1b')]===undefined?!![]:![]:!![],'where':_0x30cff5[_0x0360('0x1a')]?_0x30cff5[_0x0360('0x1a')][_0x0360('0x1c')]||null:null,'attributes':_0x30cff5['options']?_0x30cff5[_0x0360('0x1a')]['attributes']||null:null,'limit':_0x30cff5[_0x0360('0x1a')]?_0x30cff5[_0x0360('0x1a')][_0x0360('0x1d')]||null:null,'include':_0x30cff5[_0x0360('0x1a')]?_0x30cff5[_0x0360('0x1a')][_0x0360('0x1e')]?_[_0x0360('0x1f')](_0x30cff5[_0x0360('0x1a')][_0x0360('0x1e')],function(_0x39868e){return{'model':db[_0x39868e[_0x0360('0x20')]],'as':_0x39868e['as'],'attributes':_0x39868e[_0x0360('0x21')],'include':_0x39868e['include']?_[_0x0360('0x1f')](_0x39868e[_0x0360('0x1e')],function(_0x3cd121){return{'model':db[_0x3cd121['model']],'as':_0x3cd121['as'],'attributes':_0x3cd121[_0x0360('0x21')],'include':_0x3cd121[_0x0360('0x1e')]?_[_0x0360('0x1f')](_0x3cd121[_0x0360('0x1e')],function(_0x1f7228){return{'model':db[_0x1f7228[_0x0360('0x20')]],'as':_0x1f7228['as'],'attributes':_0x1f7228['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a6fe7){logger['info']('GetZendeskAccount',_0x30cff5);logger[_0x0360('0x10')](_0x0360('0x17'),_0x30cff5,JSON['stringify'](_0x3a6fe7));_0x51c4f9(_0x3a6fe7);})[_0x0360('0x16')](function(_0x591a32){logger[_0x0360('0x12')]('GetZendeskAccount',_0x591a32['message'],_0x30cff5);_0x18ff86(_0x1c266e['error'](0x1f4,_0x591a32[_0x0360('0x14')]));});});};exports[_0x0360('0x22')]=function(_0x1948fc){var _0xab9b26=this;return new Promise(function(_0x4ba8df,_0x2b4c45){return db[_0x0360('0x18')]['find']({'raw':_0x1948fc['options']?_0x1948fc['options'][_0x0360('0x1b')]===undefined?!![]:![]:!![],'where':_0x1948fc[_0x0360('0x1a')]?_0x1948fc[_0x0360('0x1a')][_0x0360('0x1c')]||null:null,'attributes':_0x1948fc[_0x0360('0x1a')]?_0x1948fc[_0x0360('0x1a')]['attributes']||null:null,'include':_0x1948fc[_0x0360('0x1a')]?_0x1948fc['options'][_0x0360('0x1e')]?_[_0x0360('0x1f')](_0x1948fc['options'][_0x0360('0x1e')],function(_0x1830ee){return{'model':db[_0x1830ee[_0x0360('0x20')]],'as':_0x1830ee['as'],'attributes':_0x1830ee['attributes'],'include':_0x1830ee[_0x0360('0x1e')]?_[_0x0360('0x1f')](_0x1830ee['include'],function(_0x502562){return{'model':db[_0x502562[_0x0360('0x20')]],'as':_0x502562['as'],'attributes':_0x502562[_0x0360('0x21')],'include':_0x502562[_0x0360('0x1e')]?_['map'](_0x502562[_0x0360('0x1e')],function(_0x235680){return{'model':db[_0x235680[_0x0360('0x20')]],'as':_0x235680['as'],'attributes':_0x235680['attributes']};}):[]};}):[]};}):[]:[]})[_0x0360('0xc')](function(_0x112ce0){logger[_0x0360('0xd')](_0x0360('0x22'),_0x1948fc);logger[_0x0360('0x10')](_0x0360('0x22'),_0x1948fc,JSON['stringify'](_0x112ce0));_0x4ba8df(_0x112ce0);})[_0x0360('0x16')](function(_0x127c37){logger[_0x0360('0x12')](_0x0360('0x22'),_0x127c37[_0x0360('0x14')],_0x1948fc);_0x2b4c45(_0xab9b26[_0x0360('0x12')](0x1f4,_0x127c37[_0x0360('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8160286..fd50499 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5b7aae,_0x3a8077){var _0x5273f4=function(_0x28ded3){while(--_0x28ded3){_0x5b7aae['push'](_0x5b7aae['shift']());}};_0x5273f4(++_0x3a8077);}(_0x5eb8,0xb0));var _0x85eb=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0x5eb8[_0x119705];return _0x2affc2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file +var _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(_0x310f1e,_0x35ee5a){var _0x339fb4=function(_0x5e157a){while(--_0x5e157a){_0x310f1e['push'](_0x310f1e['shift']());}};_0x339fb4(++_0x35ee5a);}(_0xe706,0xa3));var _0x6e70=function(_0x1a50a6,_0x400207){_0x1a50a6=_0x1a50a6-0x0;var _0x9cd101=_0xe706[_0x1a50a6];return _0x9cd101;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e462285..cd7332a 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 _0x633d=['STRING','sequelize','exports'];(function(_0xe7e125,_0x4a66a9){var _0x2cb4ea=function(_0x396937){while(--_0x396937){_0xe7e125['push'](_0xe7e125['shift']());}};_0x2cb4ea(++_0x4a66a9);}(_0x633d,0x1e1));var _0xd633=function(_0x1de023,_0x17334d){_0x1de023=_0x1de023-0x0;var _0x1b25ff=_0x633d[_0x1de023];return _0x1b25ff;};'use strict';var Sequelize=require(_0xd633('0x0'));module[_0xd633('0x1')]={'name':{'type':Sequelize[_0xd633('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x887a=['STRING','sequelize'];(function(_0x40bd84,_0x3f1117){var _0x5cc783=function(_0x21f0ce){while(--_0x21f0ce){_0x40bd84['push'](_0x40bd84['shift']());}};_0x5cc783(++_0x3f1117);}(_0x887a,0xa7));var _0xa887=function(_0x31c00b,_0x4fc23a){_0x31c00b=_0x31c00b-0x0;var _0x493ecc=_0x887a[_0x31c00b];return _0x493ecc;};'use strict';var Sequelize=require(_0xa887('0x0'));module['exports']={'name':{'type':Sequelize[_0xa887('0x1')]},'description':{'type':Sequelize[_0xa887('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 2b95d18..277efd3 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 _0x84c7=['type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x84c7,0x122));var _0x784c=function(_0x4d91c3,_0x138b8b){_0x4d91c3=_0x4d91c3-0x0;var _0x46bc7d=_0x84c7[_0x4d91c3];return _0x46bc7d;};'use strict';var emlformat=require(_0x784c('0x0'));var rimraf=require(_0x784c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x784c('0x2'));var rp=require(_0x784c('0x3'));var moment=require('moment');var BPromise=require(_0x784c('0x4'));var Mustache=require(_0x784c('0x5'));var util=require(_0x784c('0x6'));var path=require(_0x784c('0x7'));var sox=require(_0x784c('0x8'));var csv=require('to-csv');var ejs=require(_0x784c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x784c('0xa'));var squel=require(_0x784c('0xb'));var crypto=require(_0x784c('0xc'));var jsforce=require(_0x784c('0xd'));var deskjs=require(_0x784c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x784c('0xf'));var authService=require(_0x784c('0x10'));var qs=require(_0x784c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x784c('0x12'));var logger=require(_0x784c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x784c('0x14'));var licenseUtil=require(_0x784c('0x15'));var db=require(_0x784c('0x16'))['db'];function respondWithStatusCode(_0x13e968,_0x3530e3){_0x3530e3=_0x3530e3||0xcc;return function(_0x695c25){if(_0x695c25){return _0x13e968[_0x784c('0x17')](_0x3530e3);}return _0x13e968[_0x784c('0x18')](_0x3530e3)['end']();};}function respondWithResult(_0xb21325,_0x360ccc){_0x360ccc=_0x360ccc||0xc8;return function(_0x31a81b){if(_0x31a81b){return _0xb21325[_0x784c('0x18')](_0x360ccc)[_0x784c('0x19')](_0x31a81b);}};}function respondWithFilteredResult(_0x2d7390,_0x126d07){return function(_0x31b5a4){if(_0x31b5a4){var _0x2addac=typeof _0x126d07[_0x784c('0x1a')]===_0x784c('0x1b')&&typeof _0x126d07[_0x784c('0x1c')]===_0x784c('0x1b');var _0x56504d=_0x31b5a4[_0x784c('0x1d')];var _0x3fa508=_0x2addac?0x0:_0x126d07[_0x784c('0x1a')];var _0x3ff622=_0x2addac?_0x31b5a4['count']:_0x126d07[_0x784c('0x1a')]+_0x126d07[_0x784c('0x1c')];var _0x58ea99;if(_0x3ff622>=_0x56504d){_0x3ff622=_0x56504d;_0x58ea99=0xc8;}else{_0x58ea99=0xce;}_0x2d7390['status'](_0x58ea99);return _0x2d7390['set'](_0x784c('0x1e'),_0x3fa508+'-'+_0x3ff622+'/'+_0x56504d)['json'](_0x31b5a4);}return null;};}function patchUpdates(_0x3ed9ed){return function(_0x128d3a){try{jsonpatch[_0x784c('0x1f')](_0x128d3a,_0x3ed9ed,!![]);}catch(_0x511604){return BPromise[_0x784c('0x20')](_0x511604);}return _0x128d3a[_0x784c('0x21')]();};}function saveUpdates(_0x15d544,_0x445376){return function(_0x4bf807){if(_0x4bf807){return _0x4bf807[_0x784c('0x22')](_0x15d544)[_0x784c('0x23')](function(_0x5b3769){return _0x5b3769;});}return null;};}function removeEntity(_0x271758,_0x2561d6){return function(_0x29fd6e){if(_0x29fd6e){return _0x29fd6e[_0x784c('0x24')]()[_0x784c('0x23')](function(){_0x271758[_0x784c('0x18')](0xcc)[_0x784c('0x25')]();});}};}function handleEntityNotFound(_0x426480,_0x3eb871){return function(_0x49eade){if(!_0x49eade){_0x426480[_0x784c('0x17')](0x194);}return _0x49eade;};}function handleError(_0x3f1e88,_0x4cbe75){_0x4cbe75=_0x4cbe75||0x1f4;return function(_0x369f2d){logger[_0x784c('0x26')](_0x369f2d['stack']);if(_0x369f2d[_0x784c('0x27')]){delete _0x369f2d[_0x784c('0x27')];}_0x3f1e88[_0x784c('0x18')](_0x4cbe75)[_0x784c('0x28')](_0x369f2d);};}exports[_0x784c('0x29')]=function(_0x4f5d86,_0x39ee96){var _0x5926e={},_0x27fb75={},_0x10a2c5={'count':0x0,'rows':[]};var _0x17e85e=_[_0x784c('0x2a')](db[_0x784c('0x2b')][_0x784c('0x2c')],function(_0x53226e){return{'name':_0x53226e[_0x784c('0x2d')],'type':_0x53226e[_0x784c('0x2e')][_0x784c('0x2f')]};});_0x27fb75[_0x784c('0x30')]=_[_0x784c('0x2a')](_0x17e85e,_0x784c('0x27'));_0x27fb75['query']=_[_0x784c('0x31')](_0x4f5d86[_0x784c('0x32')]);_0x27fb75['filters']=_[_0x784c('0x33')](_0x27fb75[_0x784c('0x30')],_0x27fb75['query']);_0x5926e[_0x784c('0x34')]=_[_0x784c('0x33')](_0x27fb75[_0x784c('0x30')],qs[_0x784c('0x35')](_0x4f5d86[_0x784c('0x32')]['fields']));_0x5926e[_0x784c('0x34')]=_0x5926e['attributes'][_0x784c('0x36')]?_0x5926e['attributes']:_0x27fb75[_0x784c('0x30')];if(!_0x4f5d86['query'][_0x784c('0x37')](_0x784c('0x38'))){_0x5926e[_0x784c('0x1c')]=qs['limit'](_0x4f5d86[_0x784c('0x32')]['limit']);_0x5926e[_0x784c('0x1a')]=qs[_0x784c('0x1a')](_0x4f5d86[_0x784c('0x32')][_0x784c('0x1a')]);}_0x5926e[_0x784c('0x39')]=qs[_0x784c('0x3a')](_0x4f5d86[_0x784c('0x32')][_0x784c('0x3a')]);_0x5926e[_0x784c('0x3b')]=qs[_0x784c('0x3c')](_[_0x784c('0x3d')](_0x4f5d86['query'],_0x27fb75[_0x784c('0x3c')]),_0x17e85e);if(_0x4f5d86['query'][_0x784c('0x3e')]){_0x5926e['where']=_[_0x784c('0x3f')](_0x5926e[_0x784c('0x3b')],{'$or':_[_0x784c('0x2a')](_0x17e85e,function(_0xefa6de){if(_0xefa6de[_0x784c('0x2e')]!==_0x784c('0x40')){var _0xcbac06={};_0xcbac06[_0xefa6de[_0x784c('0x27')]]={'$like':'%'+_0x4f5d86[_0x784c('0x32')]['filter']+'%'};return _0xcbac06;}})});}_0x5926e=_[_0x784c('0x3f')]({},_0x5926e,_0x4f5d86[_0x784c('0x41')]);var _0x5166dd={'where':_0x5926e[_0x784c('0x3b')]};return db[_0x784c('0x2b')]['count'](_0x5166dd)['then'](function(_0x2266bb){_0x10a2c5['count']=_0x2266bb;if(_0x4f5d86[_0x784c('0x32')][_0x784c('0x42')]){_0x5926e[_0x784c('0x43')]=[{'all':!![]}];}return db[_0x784c('0x2b')][_0x784c('0x44')](_0x5926e);})['then'](function(_0x1628e9){_0x10a2c5[_0x784c('0x45')]=_0x1628e9;return _0x10a2c5;})[_0x784c('0x23')](respondWithFilteredResult(_0x39ee96,_0x5926e))[_0x784c('0x46')](handleError(_0x39ee96,null));};exports[_0x784c('0x47')]=function(_0x2e75e9,_0x4df261){var _0x2f9111={'raw':![],'where':{'id':_0x2e75e9[_0x784c('0x48')]['id']}},_0x24de89={};_0x24de89['model']=_[_0x784c('0x31')](db[_0x784c('0x2b')][_0x784c('0x2c')]);_0x24de89[_0x784c('0x32')]=_[_0x784c('0x31')](_0x2e75e9[_0x784c('0x32')]);_0x24de89['filters']=_[_0x784c('0x33')](_0x24de89[_0x784c('0x30')],_0x24de89[_0x784c('0x32')]);_0x2f9111[_0x784c('0x34')]=_[_0x784c('0x33')](_0x24de89[_0x784c('0x30')],qs[_0x784c('0x35')](_0x2e75e9[_0x784c('0x32')]['fields']));_0x2f9111['attributes']=_0x2f9111[_0x784c('0x34')]['length']?_0x2f9111['attributes']:_0x24de89['model'];if(_0x2e75e9['query']['includeAll']){_0x2f9111[_0x784c('0x43')]=[{'all':!![]}];}_0x2f9111=_[_0x784c('0x3f')]({},_0x2f9111,_0x2e75e9[_0x784c('0x41')]);return db['ZendeskConfiguration'][_0x784c('0x49')](_0x2f9111)[_0x784c('0x23')](handleEntityNotFound(_0x4df261,null))['then'](respondWithResult(_0x4df261,null))[_0x784c('0x46')](handleError(_0x4df261,null));};exports[_0x784c('0x4a')]=function(_0xbd730c,_0x795416){return db[_0x784c('0x2b')][_0x784c('0x4a')](_0xbd730c[_0x784c('0x4b')],{})['then'](respondWithResult(_0x795416,0xc9))[_0x784c('0x46')](handleError(_0x795416,null));};exports[_0x784c('0x22')]=function(_0x562cc2,_0x54a69c){if(_0x562cc2['body']['id']){delete _0x562cc2[_0x784c('0x4b')]['id'];}return db[_0x784c('0x2b')][_0x784c('0x49')]({'where':{'id':_0x562cc2[_0x784c('0x48')]['id']}})[_0x784c('0x23')](handleEntityNotFound(_0x54a69c,null))[_0x784c('0x23')](saveUpdates(_0x562cc2[_0x784c('0x4b')],null))[_0x784c('0x23')](respondWithResult(_0x54a69c,null))[_0x784c('0x46')](handleError(_0x54a69c,null));};exports[_0x784c('0x24')]=function(_0xf75251,_0x3c5312){return db[_0x784c('0x2b')][_0x784c('0x49')]({'where':{'id':_0xf75251[_0x784c('0x48')]['id']}})[_0x784c('0x23')](handleEntityNotFound(_0x3c5312,null))['then'](removeEntity(_0x3c5312,null))[_0x784c('0x46')](handleError(_0x3c5312,null));};exports[_0x784c('0x4c')]=function(_0x4cd73f,_0x43d506,_0x390d20){var _0x2b6e1a={};var _0x54fbd8={};var _0x43e09f;var _0xb999a9;return db[_0x784c('0x2b')][_0x784c('0x4d')]({'where':{'id':_0x4cd73f[_0x784c('0x48')]['id']}})[_0x784c('0x23')](handleEntityNotFound(_0x43d506,null))[_0x784c('0x23')](function(_0xa9f30){if(_0xa9f30){_0x43e09f=_0xa9f30;_0x54fbd8['model']=_[_0x784c('0x31')](db[_0x784c('0x4e')][_0x784c('0x2c')]);_0x54fbd8[_0x784c('0x32')]=_['keys'](_0x4cd73f['query']);_0x54fbd8['filters']=_[_0x784c('0x33')](_0x54fbd8[_0x784c('0x30')],_0x54fbd8[_0x784c('0x32')]);_0x2b6e1a[_0x784c('0x34')]=_['intersection'](_0x54fbd8[_0x784c('0x30')],qs[_0x784c('0x35')](_0x4cd73f['query'][_0x784c('0x35')]));_0x2b6e1a['attributes']=_0x2b6e1a[_0x784c('0x34')][_0x784c('0x36')]?_0x2b6e1a[_0x784c('0x34')]:_0x54fbd8[_0x784c('0x30')];_0x2b6e1a[_0x784c('0x39')]=qs[_0x784c('0x3a')](_0x4cd73f[_0x784c('0x32')][_0x784c('0x3a')]);_0x2b6e1a[_0x784c('0x3b')]=qs['filters'](_[_0x784c('0x3d')](_0x4cd73f[_0x784c('0x32')],_0x54fbd8[_0x784c('0x3c')]));if(_0x4cd73f[_0x784c('0x32')]['filter']){_0x2b6e1a[_0x784c('0x3b')]=_[_0x784c('0x3f')](_0x2b6e1a[_0x784c('0x3b')],{'$or':_[_0x784c('0x2a')](_0x2b6e1a[_0x784c('0x34')],function(_0x57f7b4){var _0x3899d7={};_0x3899d7[_0x57f7b4]={'$like':'%'+_0x4cd73f[_0x784c('0x32')][_0x784c('0x3e')]+'%'};return _0x3899d7;})});}_0x2b6e1a=_[_0x784c('0x3f')]({},_0x2b6e1a,_0x4cd73f['options']);return _0x43e09f['getFields'](_0x2b6e1a);}})[_0x784c('0x23')](function(_0xcb3ab7){if(_0xcb3ab7){_0xb999a9=_0xcb3ab7[_0x784c('0x36')];if(!_0x4cd73f[_0x784c('0x32')]['hasOwnProperty'](_0x784c('0x38'))){_0x2b6e1a[_0x784c('0x1c')]=qs['limit'](_0x4cd73f[_0x784c('0x32')][_0x784c('0x1c')]);_0x2b6e1a[_0x784c('0x1a')]=qs[_0x784c('0x1a')](_0x4cd73f[_0x784c('0x32')][_0x784c('0x1a')]);}return _0x43e09f['getFields'](_0x2b6e1a);}})[_0x784c('0x23')](function(_0x5e82eb){if(_0x5e82eb){return _0x5e82eb?{'count':_0xb999a9,'rows':_0x5e82eb}:null;}})['then'](respondWithResult(_0x43d506,null))['catch'](handleError(_0x43d506,null));};exports[_0x784c('0x4f')]=function(_0x491717,_0x287254,_0x30afbb){var _0x1ede63={};var _0x30bc42={};var _0x3bef21;var _0x55d97b;return db['ZendeskConfiguration'][_0x784c('0x4d')]({'where':{'id':_0x491717['params']['id']}})['then'](handleEntityNotFound(_0x287254,null))[_0x784c('0x23')](function(_0x5dce5e){if(_0x5dce5e){_0x3bef21=_0x5dce5e;_0x30bc42[_0x784c('0x30')]=_[_0x784c('0x31')](db['ZendeskField'][_0x784c('0x2c')]);_0x30bc42[_0x784c('0x32')]=_[_0x784c('0x31')](_0x491717[_0x784c('0x32')]);_0x30bc42[_0x784c('0x3c')]=_[_0x784c('0x33')](_0x30bc42['model'],_0x30bc42[_0x784c('0x32')]);_0x1ede63[_0x784c('0x34')]=_[_0x784c('0x33')](_0x30bc42['model'],qs['fields'](_0x491717['query'][_0x784c('0x35')]));_0x1ede63['attributes']=_0x1ede63[_0x784c('0x34')][_0x784c('0x36')]?_0x1ede63[_0x784c('0x34')]:_0x30bc42[_0x784c('0x30')];_0x1ede63[_0x784c('0x39')]=qs[_0x784c('0x3a')](_0x491717['query'][_0x784c('0x3a')]);_0x1ede63[_0x784c('0x3b')]=qs[_0x784c('0x3c')](_[_0x784c('0x3d')](_0x491717[_0x784c('0x32')],_0x30bc42['filters']));if(_0x491717[_0x784c('0x32')][_0x784c('0x3e')]){_0x1ede63[_0x784c('0x3b')]=_['merge'](_0x1ede63[_0x784c('0x3b')],{'$or':_[_0x784c('0x2a')](_0x1ede63[_0x784c('0x34')],function(_0x16a767){var _0x38f29e={};_0x38f29e[_0x16a767]={'$like':'%'+_0x491717['query'][_0x784c('0x3e')]+'%'};return _0x38f29e;})});}_0x1ede63=_['merge']({},_0x1ede63,_0x491717[_0x784c('0x41')]);return _0x3bef21[_0x784c('0x4f')](_0x1ede63);}})['then'](function(_0x392288){if(_0x392288){_0x55d97b=_0x392288['length'];if(!_0x491717[_0x784c('0x32')][_0x784c('0x37')](_0x784c('0x38'))){_0x1ede63[_0x784c('0x1c')]=qs[_0x784c('0x1c')](_0x491717[_0x784c('0x32')][_0x784c('0x1c')]);_0x1ede63[_0x784c('0x1a')]=qs[_0x784c('0x1a')](_0x491717[_0x784c('0x32')][_0x784c('0x1a')]);}return _0x3bef21[_0x784c('0x4f')](_0x1ede63);}})[_0x784c('0x23')](function(_0xa386b4){if(_0xa386b4){return _0xa386b4?{'count':_0x55d97b,'rows':_0xa386b4}:null;}})[_0x784c('0x23')](respondWithResult(_0x287254,null))['catch'](handleError(_0x287254,null));};exports[_0x784c('0x50')]=function(_0x498648,_0x37335e,_0x3813a1){var _0x39abd4={};var _0x4f57bd={};var _0xa12c25;var _0x5263d7;return db[_0x784c('0x2b')]['findOne']({'where':{'id':_0x498648[_0x784c('0x48')]['id']}})['then'](handleEntityNotFound(_0x37335e,null))[_0x784c('0x23')](function(_0x52f0d6){if(_0x52f0d6){_0xa12c25=_0x52f0d6;_0x4f57bd['model']=_[_0x784c('0x31')](db[_0x784c('0x4e')]['rawAttributes']);_0x4f57bd[_0x784c('0x32')]=_[_0x784c('0x31')](_0x498648[_0x784c('0x32')]);_0x4f57bd[_0x784c('0x3c')]=_[_0x784c('0x33')](_0x4f57bd['model'],_0x4f57bd[_0x784c('0x32')]);_0x39abd4['attributes']=_['intersection'](_0x4f57bd[_0x784c('0x30')],qs[_0x784c('0x35')](_0x498648[_0x784c('0x32')][_0x784c('0x35')]));_0x39abd4['attributes']=_0x39abd4['attributes']['length']?_0x39abd4[_0x784c('0x34')]:_0x4f57bd['model'];_0x39abd4[_0x784c('0x39')]=qs[_0x784c('0x3a')](_0x498648['query'][_0x784c('0x3a')]);_0x39abd4['where']=qs[_0x784c('0x3c')](_[_0x784c('0x3d')](_0x498648[_0x784c('0x32')],_0x4f57bd[_0x784c('0x3c')]));if(_0x498648[_0x784c('0x32')][_0x784c('0x3e')]){_0x39abd4['where']=_[_0x784c('0x3f')](_0x39abd4['where'],{'$or':_[_0x784c('0x2a')](_0x39abd4['attributes'],function(_0x3025b7){var _0x3566e7={};_0x3566e7[_0x3025b7]={'$like':'%'+_0x498648['query'][_0x784c('0x3e')]+'%'};return _0x3566e7;})});}_0x39abd4=_[_0x784c('0x3f')]({},_0x39abd4,_0x498648[_0x784c('0x41')]);return _0xa12c25[_0x784c('0x50')](_0x39abd4);}})[_0x784c('0x23')](function(_0x545a98){if(_0x545a98){_0x5263d7=_0x545a98['length'];if(!_0x498648[_0x784c('0x32')][_0x784c('0x37')](_0x784c('0x38'))){_0x39abd4[_0x784c('0x1c')]=qs[_0x784c('0x1c')](_0x498648[_0x784c('0x32')][_0x784c('0x1c')]);_0x39abd4['offset']=qs[_0x784c('0x1a')](_0x498648[_0x784c('0x32')][_0x784c('0x1a')]);}return _0xa12c25[_0x784c('0x50')](_0x39abd4);}})[_0x784c('0x23')](function(_0x1401ad){if(_0x1401ad){return _0x1401ad?{'count':_0x5263d7,'rows':_0x1401ad}:null;}})[_0x784c('0x23')](respondWithResult(_0x37335e,null))[_0x784c('0x46')](handleError(_0x37335e,null));};exports[_0x784c('0x51')]=function(_0x1b199a,_0x3a31ed,_0x17d62c){var _0x27d0f1={};var _0x2c91be={};var _0x9b57a1;var _0x2ec2a5;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1b199a[_0x784c('0x48')]['id']}})[_0x784c('0x23')](handleEntityNotFound(_0x3a31ed,null))['then'](function(_0x48ee79){if(_0x48ee79){_0x9b57a1=_0x48ee79;_0x2c91be[_0x784c('0x30')]=_[_0x784c('0x31')](db['Tag'][_0x784c('0x2c')]);_0x2c91be['query']=_[_0x784c('0x31')](_0x1b199a[_0x784c('0x32')]);_0x2c91be[_0x784c('0x3c')]=_[_0x784c('0x33')](_0x2c91be[_0x784c('0x30')],_0x2c91be[_0x784c('0x32')]);_0x27d0f1[_0x784c('0x34')]=_['intersection'](_0x2c91be[_0x784c('0x30')],qs[_0x784c('0x35')](_0x1b199a[_0x784c('0x32')][_0x784c('0x35')]));_0x27d0f1['attributes']=_0x27d0f1[_0x784c('0x34')][_0x784c('0x36')]?_0x27d0f1[_0x784c('0x34')]:_0x2c91be[_0x784c('0x30')];_0x27d0f1[_0x784c('0x39')]=qs[_0x784c('0x3a')](_0x1b199a['query'][_0x784c('0x3a')]);_0x27d0f1[_0x784c('0x3b')]=qs[_0x784c('0x3c')](_[_0x784c('0x3d')](_0x1b199a['query'],_0x2c91be[_0x784c('0x3c')]));if(_0x1b199a[_0x784c('0x32')][_0x784c('0x3e')]){_0x27d0f1['where']=_['merge'](_0x27d0f1[_0x784c('0x3b')],{'$or':_[_0x784c('0x2a')](_0x27d0f1['attributes'],function(_0x5221fb){var _0x5af699={};_0x5af699[_0x5221fb]={'$like':'%'+_0x1b199a['query'][_0x784c('0x3e')]+'%'};return _0x5af699;})});}_0x27d0f1=_[_0x784c('0x3f')]({},_0x27d0f1,_0x1b199a['options']);return _0x9b57a1['getTags'](_0x27d0f1);}})[_0x784c('0x23')](function(_0x5aff7a){if(_0x5aff7a){_0x2ec2a5=_0x5aff7a[_0x784c('0x36')];if(!_0x1b199a[_0x784c('0x32')][_0x784c('0x37')](_0x784c('0x38'))){_0x27d0f1[_0x784c('0x1c')]=qs[_0x784c('0x1c')](_0x1b199a[_0x784c('0x32')][_0x784c('0x1c')]);_0x27d0f1[_0x784c('0x1a')]=qs[_0x784c('0x1a')](_0x1b199a['query']['offset']);}return _0x9b57a1['getTags'](_0x27d0f1);}})[_0x784c('0x23')](function(_0x1d6a1b){if(_0x1d6a1b){return _0x1d6a1b?{'count':_0x2ec2a5,'rows':_0x1d6a1b}:null;}})[_0x784c('0x23')](respondWithResult(_0x3a31ed,null))['catch'](handleError(_0x3a31ed,null));};exports[_0x784c('0x52')]=function(_0x5d6ef6,_0x1f7287,_0x3b7cf4){if(_0x5d6ef6[_0x784c('0x4b')]['id']){delete _0x5d6ef6[_0x784c('0x4b')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5d6ef6[_0x784c('0x48')]['id']}})[_0x784c('0x23')](handleEntityNotFound(_0x1f7287,null))[_0x784c('0x23')](function(_0x391619){if(_0x391619){return _0x391619[_0x784c('0x52')](_0x5d6ef6[_0x784c('0x4b')][_0x784c('0x53')]||[]);}return null;})[_0x784c('0x23')](respondWithResult(_0x1f7287,null))[_0x784c('0x46')](handleError(_0x1f7287,null));}; \ No newline at end of file +var _0x6fe6=['count','apply','update','then','destroy','end','sendStatus','error','stack','map','ZendeskConfiguration','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','includeAll','include','catch','show','params','options','find','create','body','getFields','findOne','keys','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined'];(function(_0x536300,_0xe58389){var _0x416ffc=function(_0x367619){while(--_0x367619){_0x536300['push'](_0x536300['shift']());}};_0x416ffc(++_0xe58389);}(_0x6fe6,0x1a3));var _0x66fe=function(_0x43caf0,_0x5825e4){_0x43caf0=_0x43caf0-0x0;var _0x16cc04=_0x6fe6[_0x43caf0];return _0x16cc04;};'use strict';var emlformat=require(_0x66fe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x66fe('0x1'));var moment=require(_0x66fe('0x2'));var BPromise=require(_0x66fe('0x3'));var Mustache=require(_0x66fe('0x4'));var util=require(_0x66fe('0x5'));var path=require('path');var sox=require(_0x66fe('0x6'));var csv=require(_0x66fe('0x7'));var ejs=require(_0x66fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66fe('0x9'));var squel=require(_0x66fe('0xa'));var crypto=require(_0x66fe('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x66fe('0xc'));var Papa=require(_0x66fe('0xd'));var Redis=require(_0x66fe('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66fe('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66fe('0x10'))('api');var utils=require(_0x66fe('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x66fe('0x12'));var db=require(_0x66fe('0x13'))['db'];function respondWithStatusCode(_0x52c607,_0x44585b){_0x44585b=_0x44585b||0xcc;return function(_0x5007b8){if(_0x5007b8){return _0x52c607['sendStatus'](_0x44585b);}return _0x52c607['status'](_0x44585b)['end']();};}function respondWithResult(_0xb69bdb,_0x5bcb55){_0x5bcb55=_0x5bcb55||0xc8;return function(_0x15fa1e){if(_0x15fa1e){return _0xb69bdb[_0x66fe('0x14')](_0x5bcb55)[_0x66fe('0x15')](_0x15fa1e);}};}function respondWithFilteredResult(_0x261d72,_0x3f6887){return function(_0x1115ef){if(_0x1115ef){var _0xbf6a05=typeof _0x3f6887[_0x66fe('0x16')]==='undefined'&&typeof _0x3f6887[_0x66fe('0x17')]===_0x66fe('0x18');var _0x576bbf=_0x1115ef[_0x66fe('0x19')];var _0x2d2ca3=_0xbf6a05?0x0:_0x3f6887[_0x66fe('0x16')];var _0x293669=_0xbf6a05?_0x1115ef[_0x66fe('0x19')]:_0x3f6887['offset']+_0x3f6887[_0x66fe('0x17')];var _0xf4098b;if(_0x293669>=_0x576bbf){_0x293669=_0x576bbf;_0xf4098b=0xc8;}else{_0xf4098b=0xce;}_0x261d72['status'](_0xf4098b);return _0x261d72['set']('Content-Range',_0x2d2ca3+'-'+_0x293669+'/'+_0x576bbf)['json'](_0x1115ef);}return null;};}function patchUpdates(_0x3ebc6f){return function(_0x1a4b87){try{jsonpatch[_0x66fe('0x1a')](_0x1a4b87,_0x3ebc6f,!![]);}catch(_0x427b87){return BPromise['reject'](_0x427b87);}return _0x1a4b87['save']();};}function saveUpdates(_0x49501f,_0x39c693){return function(_0x19a17c){if(_0x19a17c){return _0x19a17c[_0x66fe('0x1b')](_0x49501f)[_0x66fe('0x1c')](function(_0x13fc94){return _0x13fc94;});}return null;};}function removeEntity(_0x5160bb,_0x13923a){return function(_0x53ce16){if(_0x53ce16){return _0x53ce16[_0x66fe('0x1d')]()['then'](function(){_0x5160bb[_0x66fe('0x14')](0xcc)[_0x66fe('0x1e')]();});}};}function handleEntityNotFound(_0x53910b,_0x38f6ed){return function(_0x2bf18c){if(!_0x2bf18c){_0x53910b[_0x66fe('0x1f')](0x194);}return _0x2bf18c;};}function handleError(_0x3432a4,_0xa55c87){_0xa55c87=_0xa55c87||0x1f4;return function(_0xd1f4f1){logger[_0x66fe('0x20')](_0xd1f4f1[_0x66fe('0x21')]);if(_0xd1f4f1['name']){delete _0xd1f4f1['name'];}_0x3432a4[_0x66fe('0x14')](_0xa55c87)['send'](_0xd1f4f1);};}exports['index']=function(_0x101d87,_0x541a2a){var _0x1f8124={},_0x52d0c2={},_0x3f9bfc={'count':0x0,'rows':[]};var _0x2630c8=_[_0x66fe('0x22')](db[_0x66fe('0x23')][_0x66fe('0x24')],function(_0x5624c1){return{'name':_0x5624c1['fieldName'],'type':_0x5624c1['type'][_0x66fe('0x25')]};});_0x52d0c2[_0x66fe('0x26')]=_[_0x66fe('0x22')](_0x2630c8,'name');_0x52d0c2[_0x66fe('0x27')]=_['keys'](_0x101d87[_0x66fe('0x27')]);_0x52d0c2[_0x66fe('0x28')]=_[_0x66fe('0x29')](_0x52d0c2[_0x66fe('0x26')],_0x52d0c2[_0x66fe('0x27')]);_0x1f8124[_0x66fe('0x2a')]=_[_0x66fe('0x29')](_0x52d0c2[_0x66fe('0x26')],qs['fields'](_0x101d87['query'][_0x66fe('0x2b')]));_0x1f8124[_0x66fe('0x2a')]=_0x1f8124[_0x66fe('0x2a')][_0x66fe('0x2c')]?_0x1f8124[_0x66fe('0x2a')]:_0x52d0c2[_0x66fe('0x26')];if(!_0x101d87['query']['hasOwnProperty'](_0x66fe('0x2d'))){_0x1f8124[_0x66fe('0x17')]=qs[_0x66fe('0x17')](_0x101d87['query']['limit']);_0x1f8124[_0x66fe('0x16')]=qs[_0x66fe('0x16')](_0x101d87[_0x66fe('0x27')][_0x66fe('0x16')]);}_0x1f8124[_0x66fe('0x2e')]=qs['sort'](_0x101d87[_0x66fe('0x27')][_0x66fe('0x2f')]);_0x1f8124[_0x66fe('0x30')]=qs['filters'](_[_0x66fe('0x31')](_0x101d87[_0x66fe('0x27')],_0x52d0c2[_0x66fe('0x28')]),_0x2630c8);if(_0x101d87[_0x66fe('0x27')][_0x66fe('0x32')]){_0x1f8124['where']=_['merge'](_0x1f8124[_0x66fe('0x30')],{'$or':_[_0x66fe('0x22')](_0x2630c8,function(_0x77cabc){if(_0x77cabc[_0x66fe('0x33')]!==_0x66fe('0x34')){var _0x24591e={};_0x24591e[_0x77cabc[_0x66fe('0x35')]]={'$like':'%'+_0x101d87[_0x66fe('0x27')][_0x66fe('0x32')]+'%'};return _0x24591e;}})});}_0x1f8124=_[_0x66fe('0x36')]({},_0x1f8124,_0x101d87['options']);var _0x14a31d={'where':_0x1f8124[_0x66fe('0x30')]};return db[_0x66fe('0x23')][_0x66fe('0x19')](_0x14a31d)['then'](function(_0x466ec0){_0x3f9bfc[_0x66fe('0x19')]=_0x466ec0;if(_0x101d87[_0x66fe('0x27')][_0x66fe('0x37')]){_0x1f8124[_0x66fe('0x38')]=[{'all':!![]}];}return db[_0x66fe('0x23')]['findAll'](_0x1f8124);})[_0x66fe('0x1c')](function(_0x5ae995){_0x3f9bfc['rows']=_0x5ae995;return _0x3f9bfc;})[_0x66fe('0x1c')](respondWithFilteredResult(_0x541a2a,_0x1f8124))[_0x66fe('0x39')](handleError(_0x541a2a,null));};exports[_0x66fe('0x3a')]=function(_0x52ac81,_0x487027){var _0x3c36df={'raw':![],'where':{'id':_0x52ac81[_0x66fe('0x3b')]['id']}},_0x45a922={};_0x45a922[_0x66fe('0x26')]=_['keys'](db[_0x66fe('0x23')][_0x66fe('0x24')]);_0x45a922['query']=_['keys'](_0x52ac81[_0x66fe('0x27')]);_0x45a922['filters']=_['intersection'](_0x45a922[_0x66fe('0x26')],_0x45a922[_0x66fe('0x27')]);_0x3c36df['attributes']=_['intersection'](_0x45a922['model'],qs[_0x66fe('0x2b')](_0x52ac81['query'][_0x66fe('0x2b')]));_0x3c36df[_0x66fe('0x2a')]=_0x3c36df[_0x66fe('0x2a')][_0x66fe('0x2c')]?_0x3c36df[_0x66fe('0x2a')]:_0x45a922['model'];if(_0x52ac81['query'][_0x66fe('0x37')]){_0x3c36df[_0x66fe('0x38')]=[{'all':!![]}];}_0x3c36df=_[_0x66fe('0x36')]({},_0x3c36df,_0x52ac81[_0x66fe('0x3c')]);return db[_0x66fe('0x23')][_0x66fe('0x3d')](_0x3c36df)[_0x66fe('0x1c')](handleEntityNotFound(_0x487027,null))[_0x66fe('0x1c')](respondWithResult(_0x487027,null))[_0x66fe('0x39')](handleError(_0x487027,null));};exports['create']=function(_0xa38e2,_0x47fa43){return db['ZendeskConfiguration'][_0x66fe('0x3e')](_0xa38e2[_0x66fe('0x3f')],{})[_0x66fe('0x1c')](respondWithResult(_0x47fa43,0xc9))[_0x66fe('0x39')](handleError(_0x47fa43,null));};exports['update']=function(_0x53678e,_0xfa5a7a){if(_0x53678e['body']['id']){delete _0x53678e[_0x66fe('0x3f')]['id'];}return db[_0x66fe('0x23')][_0x66fe('0x3d')]({'where':{'id':_0x53678e[_0x66fe('0x3b')]['id']}})[_0x66fe('0x1c')](handleEntityNotFound(_0xfa5a7a,null))[_0x66fe('0x1c')](saveUpdates(_0x53678e['body'],null))[_0x66fe('0x1c')](respondWithResult(_0xfa5a7a,null))['catch'](handleError(_0xfa5a7a,null));};exports[_0x66fe('0x1d')]=function(_0x1a6ccb,_0x3715e5){return db[_0x66fe('0x23')][_0x66fe('0x3d')]({'where':{'id':_0x1a6ccb[_0x66fe('0x3b')]['id']}})[_0x66fe('0x1c')](handleEntityNotFound(_0x3715e5,null))[_0x66fe('0x1c')](removeEntity(_0x3715e5,null))[_0x66fe('0x39')](handleError(_0x3715e5,null));};exports[_0x66fe('0x40')]=function(_0x188d18,_0x3239bb,_0x3ac20f){var _0x3f64cd={};var _0x311d6a={};var _0x312a00;var _0x11cdba;return db[_0x66fe('0x23')][_0x66fe('0x41')]({'where':{'id':_0x188d18[_0x66fe('0x3b')]['id']}})[_0x66fe('0x1c')](handleEntityNotFound(_0x3239bb,null))[_0x66fe('0x1c')](function(_0x390127){if(_0x390127){_0x312a00=_0x390127;_0x311d6a[_0x66fe('0x26')]=_[_0x66fe('0x42')](db[_0x66fe('0x43')]['rawAttributes']);_0x311d6a[_0x66fe('0x27')]=_[_0x66fe('0x42')](_0x188d18[_0x66fe('0x27')]);_0x311d6a[_0x66fe('0x28')]=_['intersection'](_0x311d6a[_0x66fe('0x26')],_0x311d6a[_0x66fe('0x27')]);_0x3f64cd[_0x66fe('0x2a')]=_[_0x66fe('0x29')](_0x311d6a[_0x66fe('0x26')],qs['fields'](_0x188d18[_0x66fe('0x27')][_0x66fe('0x2b')]));_0x3f64cd[_0x66fe('0x2a')]=_0x3f64cd[_0x66fe('0x2a')][_0x66fe('0x2c')]?_0x3f64cd[_0x66fe('0x2a')]:_0x311d6a['model'];_0x3f64cd['order']=qs[_0x66fe('0x2f')](_0x188d18['query'][_0x66fe('0x2f')]);_0x3f64cd[_0x66fe('0x30')]=qs[_0x66fe('0x28')](_[_0x66fe('0x31')](_0x188d18['query'],_0x311d6a[_0x66fe('0x28')]));if(_0x188d18[_0x66fe('0x27')][_0x66fe('0x32')]){_0x3f64cd['where']=_[_0x66fe('0x36')](_0x3f64cd[_0x66fe('0x30')],{'$or':_['map'](_0x3f64cd['attributes'],function(_0x172b61){var _0x5281bc={};_0x5281bc[_0x172b61]={'$like':'%'+_0x188d18[_0x66fe('0x27')]['filter']+'%'};return _0x5281bc;})});}_0x3f64cd=_[_0x66fe('0x36')]({},_0x3f64cd,_0x188d18[_0x66fe('0x3c')]);return _0x312a00[_0x66fe('0x40')](_0x3f64cd);}})[_0x66fe('0x1c')](function(_0x5c1fc7){if(_0x5c1fc7){_0x11cdba=_0x5c1fc7['length'];if(!_0x188d18[_0x66fe('0x27')][_0x66fe('0x44')](_0x66fe('0x2d'))){_0x3f64cd[_0x66fe('0x17')]=qs[_0x66fe('0x17')](_0x188d18[_0x66fe('0x27')]['limit']);_0x3f64cd[_0x66fe('0x16')]=qs[_0x66fe('0x16')](_0x188d18[_0x66fe('0x27')]['offset']);}return _0x312a00[_0x66fe('0x40')](_0x3f64cd);}})[_0x66fe('0x1c')](function(_0xe41d4d){if(_0xe41d4d){return _0xe41d4d?{'count':_0x11cdba,'rows':_0xe41d4d}:null;}})[_0x66fe('0x1c')](respondWithResult(_0x3239bb,null))[_0x66fe('0x39')](handleError(_0x3239bb,null));};exports[_0x66fe('0x45')]=function(_0x481c1c,_0x100816,_0x1060bf){var _0x5a7625={};var _0xdaa6aa={};var _0x6c7e13;var _0x55c356;return db[_0x66fe('0x23')][_0x66fe('0x41')]({'where':{'id':_0x481c1c[_0x66fe('0x3b')]['id']}})[_0x66fe('0x1c')](handleEntityNotFound(_0x100816,null))['then'](function(_0x10e5ec){if(_0x10e5ec){_0x6c7e13=_0x10e5ec;_0xdaa6aa['model']=_[_0x66fe('0x42')](db[_0x66fe('0x43')]['rawAttributes']);_0xdaa6aa[_0x66fe('0x27')]=_[_0x66fe('0x42')](_0x481c1c['query']);_0xdaa6aa[_0x66fe('0x28')]=_[_0x66fe('0x29')](_0xdaa6aa[_0x66fe('0x26')],_0xdaa6aa[_0x66fe('0x27')]);_0x5a7625['attributes']=_['intersection'](_0xdaa6aa['model'],qs[_0x66fe('0x2b')](_0x481c1c[_0x66fe('0x27')]['fields']));_0x5a7625['attributes']=_0x5a7625[_0x66fe('0x2a')][_0x66fe('0x2c')]?_0x5a7625[_0x66fe('0x2a')]:_0xdaa6aa[_0x66fe('0x26')];_0x5a7625[_0x66fe('0x2e')]=qs[_0x66fe('0x2f')](_0x481c1c[_0x66fe('0x27')]['sort']);_0x5a7625[_0x66fe('0x30')]=qs[_0x66fe('0x28')](_[_0x66fe('0x31')](_0x481c1c['query'],_0xdaa6aa[_0x66fe('0x28')]));if(_0x481c1c['query'][_0x66fe('0x32')]){_0x5a7625[_0x66fe('0x30')]=_['merge'](_0x5a7625[_0x66fe('0x30')],{'$or':_[_0x66fe('0x22')](_0x5a7625[_0x66fe('0x2a')],function(_0x5394fc){var _0x478e6a={};_0x478e6a[_0x5394fc]={'$like':'%'+_0x481c1c['query'][_0x66fe('0x32')]+'%'};return _0x478e6a;})});}_0x5a7625=_[_0x66fe('0x36')]({},_0x5a7625,_0x481c1c[_0x66fe('0x3c')]);return _0x6c7e13['getSubjects'](_0x5a7625);}})[_0x66fe('0x1c')](function(_0x5dc50e){if(_0x5dc50e){_0x55c356=_0x5dc50e['length'];if(!_0x481c1c[_0x66fe('0x27')][_0x66fe('0x44')](_0x66fe('0x2d'))){_0x5a7625[_0x66fe('0x17')]=qs['limit'](_0x481c1c['query']['limit']);_0x5a7625['offset']=qs[_0x66fe('0x16')](_0x481c1c[_0x66fe('0x27')][_0x66fe('0x16')]);}return _0x6c7e13['getSubjects'](_0x5a7625);}})[_0x66fe('0x1c')](function(_0x4f1684){if(_0x4f1684){return _0x4f1684?{'count':_0x55c356,'rows':_0x4f1684}:null;}})['then'](respondWithResult(_0x100816,null))[_0x66fe('0x39')](handleError(_0x100816,null));};exports['getDescriptions']=function(_0x31f729,_0x292644,_0x5e20b6){var _0x247bed={};var _0x463910={};var _0x2d2638;var _0x1b8fbb;return db[_0x66fe('0x23')][_0x66fe('0x41')]({'where':{'id':_0x31f729['params']['id']}})[_0x66fe('0x1c')](handleEntityNotFound(_0x292644,null))[_0x66fe('0x1c')](function(_0x44a184){if(_0x44a184){_0x2d2638=_0x44a184;_0x463910[_0x66fe('0x26')]=_[_0x66fe('0x42')](db['ZendeskField'][_0x66fe('0x24')]);_0x463910[_0x66fe('0x27')]=_[_0x66fe('0x42')](_0x31f729[_0x66fe('0x27')]);_0x463910['filters']=_[_0x66fe('0x29')](_0x463910[_0x66fe('0x26')],_0x463910['query']);_0x247bed[_0x66fe('0x2a')]=_[_0x66fe('0x29')](_0x463910[_0x66fe('0x26')],qs[_0x66fe('0x2b')](_0x31f729[_0x66fe('0x27')][_0x66fe('0x2b')]));_0x247bed[_0x66fe('0x2a')]=_0x247bed[_0x66fe('0x2a')][_0x66fe('0x2c')]?_0x247bed[_0x66fe('0x2a')]:_0x463910['model'];_0x247bed[_0x66fe('0x2e')]=qs[_0x66fe('0x2f')](_0x31f729[_0x66fe('0x27')][_0x66fe('0x2f')]);_0x247bed[_0x66fe('0x30')]=qs[_0x66fe('0x28')](_[_0x66fe('0x31')](_0x31f729[_0x66fe('0x27')],_0x463910[_0x66fe('0x28')]));if(_0x31f729['query'][_0x66fe('0x32')]){_0x247bed[_0x66fe('0x30')]=_['merge'](_0x247bed[_0x66fe('0x30')],{'$or':_[_0x66fe('0x22')](_0x247bed[_0x66fe('0x2a')],function(_0x3f52d3){var _0x3e847f={};_0x3e847f[_0x3f52d3]={'$like':'%'+_0x31f729[_0x66fe('0x27')][_0x66fe('0x32')]+'%'};return _0x3e847f;})});}_0x247bed=_[_0x66fe('0x36')]({},_0x247bed,_0x31f729[_0x66fe('0x3c')]);return _0x2d2638[_0x66fe('0x46')](_0x247bed);}})['then'](function(_0x3e7a03){if(_0x3e7a03){_0x1b8fbb=_0x3e7a03[_0x66fe('0x2c')];if(!_0x31f729['query'][_0x66fe('0x44')](_0x66fe('0x2d'))){_0x247bed[_0x66fe('0x17')]=qs[_0x66fe('0x17')](_0x31f729[_0x66fe('0x27')][_0x66fe('0x17')]);_0x247bed[_0x66fe('0x16')]=qs[_0x66fe('0x16')](_0x31f729['query'][_0x66fe('0x16')]);}return _0x2d2638[_0x66fe('0x46')](_0x247bed);}})['then'](function(_0x3bfda7){if(_0x3bfda7){return _0x3bfda7?{'count':_0x1b8fbb,'rows':_0x3bfda7}:null;}})[_0x66fe('0x1c')](respondWithResult(_0x292644,null))[_0x66fe('0x39')](handleError(_0x292644,null));};exports[_0x66fe('0x47')]=function(_0x2524ff,_0x5a51af,_0x488c07){var _0x8670c4={};var _0x200e26={};var _0x44bd56;var _0x5d7a2e;return db[_0x66fe('0x23')][_0x66fe('0x41')]({'where':{'id':_0x2524ff['params']['id']}})['then'](handleEntityNotFound(_0x5a51af,null))[_0x66fe('0x1c')](function(_0x592775){if(_0x592775){_0x44bd56=_0x592775;_0x200e26[_0x66fe('0x26')]=_[_0x66fe('0x42')](db['Tag']['rawAttributes']);_0x200e26[_0x66fe('0x27')]=_[_0x66fe('0x42')](_0x2524ff[_0x66fe('0x27')]);_0x200e26[_0x66fe('0x28')]=_[_0x66fe('0x29')](_0x200e26[_0x66fe('0x26')],_0x200e26[_0x66fe('0x27')]);_0x8670c4[_0x66fe('0x2a')]=_[_0x66fe('0x29')](_0x200e26[_0x66fe('0x26')],qs['fields'](_0x2524ff[_0x66fe('0x27')][_0x66fe('0x2b')]));_0x8670c4['attributes']=_0x8670c4['attributes'][_0x66fe('0x2c')]?_0x8670c4['attributes']:_0x200e26[_0x66fe('0x26')];_0x8670c4['order']=qs['sort'](_0x2524ff[_0x66fe('0x27')][_0x66fe('0x2f')]);_0x8670c4[_0x66fe('0x30')]=qs['filters'](_[_0x66fe('0x31')](_0x2524ff['query'],_0x200e26[_0x66fe('0x28')]));if(_0x2524ff[_0x66fe('0x27')]['filter']){_0x8670c4[_0x66fe('0x30')]=_[_0x66fe('0x36')](_0x8670c4[_0x66fe('0x30')],{'$or':_[_0x66fe('0x22')](_0x8670c4[_0x66fe('0x2a')],function(_0x2749fc){var _0x366fe9={};_0x366fe9[_0x2749fc]={'$like':'%'+_0x2524ff[_0x66fe('0x27')]['filter']+'%'};return _0x366fe9;})});}_0x8670c4=_[_0x66fe('0x36')]({},_0x8670c4,_0x2524ff[_0x66fe('0x3c')]);return _0x44bd56['getTags'](_0x8670c4);}})[_0x66fe('0x1c')](function(_0x2ac431){if(_0x2ac431){_0x5d7a2e=_0x2ac431['length'];if(!_0x2524ff['query']['hasOwnProperty'](_0x66fe('0x2d'))){_0x8670c4[_0x66fe('0x17')]=qs[_0x66fe('0x17')](_0x2524ff[_0x66fe('0x27')][_0x66fe('0x17')]);_0x8670c4[_0x66fe('0x16')]=qs[_0x66fe('0x16')](_0x2524ff['query'][_0x66fe('0x16')]);}return _0x44bd56[_0x66fe('0x47')](_0x8670c4);}})['then'](function(_0xd0ee15){if(_0xd0ee15){return _0xd0ee15?{'count':_0x5d7a2e,'rows':_0xd0ee15}:null;}})[_0x66fe('0x1c')](respondWithResult(_0x5a51af,null))[_0x66fe('0x39')](handleError(_0x5a51af,null));};exports[_0x66fe('0x48')]=function(_0x281832,_0x71f489,_0x5b6887){if(_0x281832[_0x66fe('0x3f')]['id']){delete _0x281832['body']['id'];}return db[_0x66fe('0x23')][_0x66fe('0x41')]({'where':{'id':_0x281832[_0x66fe('0x3b')]['id']}})[_0x66fe('0x1c')](handleEntityNotFound(_0x71f489,null))[_0x66fe('0x1c')](function(_0x52e2be){if(_0x52e2be){return _0x52e2be['setTags'](_0x281832[_0x66fe('0x3f')][_0x66fe('0x49')]||[]);}return null;})['then'](respondWithResult(_0x71f489,null))[_0x66fe('0x39')](handleError(_0x71f489,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 3ef919c..50c6b1b 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 _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','ZendeskConfiguration'];(function(_0x5a8560,_0x359dd6){var _0x3ab604=function(_0x3f80f0){while(--_0x3f80f0){_0x5a8560['push'](_0x5a8560['shift']());}};_0x3ab604(++_0x359dd6);}(_0x8f4c,0x113));var _0xc8f4=function(_0x48564d,_0x2c1c8c){_0x48564d=_0x48564d-0x0;var _0x2ad779=_0x8f4c[_0x48564d];return _0x2ad779;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e9=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0x292870,_0xd7e91d){var _0x220914=function(_0x509785){while(--_0x509785){_0x292870['push'](_0x292870['shift']());}};_0x220914(++_0xd7e91d);}(_0x93e9,0xcc));var _0x993e=function(_0x551b13,_0x44ebc3){_0x551b13=_0x551b13-0x0;var _0x1e1e1a=_0x93e9[_0x551b13];return _0x1e1e1a;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'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 b6b1c99..10204bc 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 _0xf189=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','catch'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0xf189,0x140));var _0x9f18=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf189[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x9f18('0x0'));var util=require(_0x9f18('0x1'));var moment=require(_0x9f18('0x2'));var BPromise=require(_0x9f18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f18('0x4'));var db=require(_0x9f18('0x5'))['db'];var utils=require(_0x9f18('0x6'));var logger=require(_0x9f18('0x7'))(_0x9f18('0x8'));var config=require('../../config/environment');var jayson=require(_0x9f18('0x9'));var client=jayson[_0x9f18('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27344b,_0x5f6d04,_0x1173bf){return new BPromise(function(_0x2a72f2,_0x3a39ce){return client['request'](_0x27344b,_0x1173bf)['then'](function(_0xc8a4e9){logger[_0x9f18('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5f6d04,_0x9f18('0xc'));logger[_0x9f18('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5f6d04,_0x9f18('0xc'),JSON[_0x9f18('0xe')](_0xc8a4e9));if(_0xc8a4e9[_0x9f18('0xf')]){if(_0xc8a4e9[_0x9f18('0xf')][_0x9f18('0x10')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5f6d04,_0xc8a4e9[_0x9f18('0xf')][_0x9f18('0x11')]);return _0x3a39ce(_0xc8a4e9[_0x9f18('0xf')][_0x9f18('0x11')]);}logger[_0x9f18('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5f6d04,_0xc8a4e9['error'][_0x9f18('0x11')]);return _0x2a72f2(_0xc8a4e9[_0x9f18('0xf')][_0x9f18('0x11')]);}else{logger[_0x9f18('0xb')](_0x9f18('0x12'),_0x5f6d04,_0x9f18('0xc'));_0x2a72f2(_0xc8a4e9['result']['message']);}})[_0x9f18('0x13')](function(_0x53c06e){logger[_0x9f18('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5f6d04,_0x53c06e);_0x3a39ce(_0x53c06e);});});} \ No newline at end of file +var _0xef7e=['rpc','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x463df1,_0x2173bb){var _0x4999d6=function(_0x13832d){while(--_0x13832d){_0x463df1['push'](_0x463df1['shift']());}};_0x4999d6(++_0x2173bb);}(_0xef7e,0x1db));var _0xeef7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xef7e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xeef7('0x0'));var util=require(_0xeef7('0x1'));var moment=require(_0xeef7('0x2'));var BPromise=require(_0xeef7('0x3'));var rs=require(_0xeef7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeef7('0x5'))['db'];var utils=require(_0xeef7('0x6'));var logger=require(_0xeef7('0x7'))(_0xeef7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xeef7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17667c,_0x29a9c9,_0x43c902){return new BPromise(function(_0x5e540b,_0x265ea0){return client[_0xeef7('0xa')](_0x17667c,_0x43c902)[_0xeef7('0xb')](function(_0xe447f9){logger[_0xeef7('0xc')](_0xeef7('0xd'),_0x29a9c9,_0xeef7('0xe'));logger[_0xeef7('0xf')](_0xeef7('0x10'),_0x29a9c9,_0xeef7('0xe'),JSON[_0xeef7('0x11')](_0xe447f9));if(_0xe447f9['error']){if(_0xe447f9[_0xeef7('0x12')][_0xeef7('0x13')]===0x1f4){logger[_0xeef7('0x12')](_0xeef7('0xd'),_0x29a9c9,_0xe447f9[_0xeef7('0x12')][_0xeef7('0x14')]);return _0x265ea0(_0xe447f9[_0xeef7('0x12')]['message']);}logger[_0xeef7('0x12')](_0xeef7('0xd'),_0x29a9c9,_0xe447f9['error'][_0xeef7('0x14')]);return _0x5e540b(_0xe447f9['error']['message']);}else{logger[_0xeef7('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x29a9c9,_0xeef7('0xe'));_0x5e540b(_0xe447f9[_0xeef7('0x15')][_0xeef7('0x14')]);}})[_0xeef7('0x16')](function(_0x2a1899){logger[_0xeef7('0x12')](_0xeef7('0xd'),_0x29a9c9,_0x2a1899);_0x265ea0(_0x2a1899);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index cfdb1d5..2761c01 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 _0xe549=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x47b930,_0x33f056){var _0x2d6844=function(_0x1246be){while(--_0x1246be){_0x47b930['push'](_0x47b930['shift']());}};_0x2d6844(++_0x33f056);}(_0xe549,0x167));var _0x9e54=function(_0x4a4386,_0x60caab){_0x4a4386=_0x4a4386-0x0;var _0x842cb9=_0xe549[_0x4a4386];return _0x842cb9;};'use strict';var multer=require('multer');var util=require(_0x9e54('0x0'));var path=require(_0x9e54('0x1'));var timeout=require(_0x9e54('0x2'));var express=require(_0x9e54('0x3'));var router=express['Router']();var fs_extra=require(_0x9e54('0x4'));var auth=require(_0x9e54('0x5'));var interaction=require(_0x9e54('0x6'));var config=require(_0x9e54('0x7'));var controller=require(_0x9e54('0x8'));router[_0x9e54('0x9')]('/',auth['isAuthenticated'](),controller[_0x9e54('0xa')]);router[_0x9e54('0x9')](_0x9e54('0xb'),auth['isAuthenticated'](),controller[_0x9e54('0xc')]);router['post']('/',auth[_0x9e54('0xd')](),controller[_0x9e54('0xe')]);router[_0x9e54('0xf')](_0x9e54('0xb'),auth['isAuthenticated'](),controller[_0x9e54('0x10')]);router[_0x9e54('0x11')](_0x9e54('0xb'),auth[_0x9e54('0xd')](),controller[_0x9e54('0x12')]);module[_0x9e54('0x13')]=router; \ No newline at end of file +var _0x1fbd=['show','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x280656,_0x1d69bf){var _0x152fff=function(_0x39fde){while(--_0x39fde){_0x280656['push'](_0x280656['shift']());}};_0x152fff(++_0x1d69bf);}(_0x1fbd,0xe5));var _0xd1fb=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x1fbd[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0xd1fb('0x0'));var util=require(_0xd1fb('0x1'));var path=require(_0xd1fb('0x2'));var timeout=require(_0xd1fb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd1fb('0x4'));var interaction=require(_0xd1fb('0x5'));var config=require('../../config/environment');var controller=require(_0xd1fb('0x6'));router[_0xd1fb('0x7')]('/',auth[_0xd1fb('0x8')](),controller[_0xd1fb('0x9')]);router[_0xd1fb('0x7')](_0xd1fb('0xa'),auth[_0xd1fb('0x8')](),controller[_0xd1fb('0xb')]);router['post']('/',auth[_0xd1fb('0x8')](),controller[_0xd1fb('0xc')]);router['put']('/:id',auth[_0xd1fb('0x8')](),controller['update']);router[_0xd1fb('0xd')](_0xd1fb('0xa'),auth[_0xd1fb('0x8')](),controller[_0xd1fb('0xe')]);module[_0xd1fb('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d15603d..b28680e 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 _0x0bad=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x236625,_0xb03d9f){var _0x466993=function(_0x11043e){while(--_0x11043e){_0x236625['push'](_0x236625['shift']());}};_0x466993(++_0xb03d9f);}(_0x0bad,0x15a));var _0xd0ba=function(_0x4dd6c0,_0xb3a7bf){_0x4dd6c0=_0x4dd6c0-0x0;var _0x1a073d=_0x0bad[_0x4dd6c0];return _0x1a073d;};'use strict';var Sequelize=require(_0xd0ba('0x0'));module['exports']={'type':{'type':Sequelize[_0xd0ba('0x1')](_0xd0ba('0x2'),_0xd0ba('0x3'),'customVariable',_0xd0ba('0x4'),'picklist'),'defaultValue':_0xd0ba('0x2')},'content':{'type':Sequelize[_0xd0ba('0x5')]},'key':{'type':Sequelize[_0xd0ba('0x5')]},'keyType':{'type':Sequelize[_0xd0ba('0x1')](_0xd0ba('0x2'),_0xd0ba('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd0ba('0x5')]},'idField':{'type':Sequelize[_0xd0ba('0x5')]},'nameField':{'type':Sequelize[_0xd0ba('0x5')]},'customField':{'type':Sequelize[_0xd0ba('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd0ba('0x5')]}}; \ No newline at end of file +var _0xc977=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x26eace,_0x3df62c){var _0x8ff8b4=function(_0x100874){while(--_0x100874){_0x26eace['push'](_0x26eace['shift']());}};_0x8ff8b4(++_0x3df62c);}(_0xc977,0x1a3));var _0x7c97=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0xc977[_0x4dbba7];return _0x43ef83;};'use strict';var Sequelize=require(_0x7c97('0x0'));module[_0x7c97('0x1')]={'type':{'type':Sequelize[_0x7c97('0x2')](_0x7c97('0x3'),_0x7c97('0x4'),'customVariable',_0x7c97('0x5'),_0x7c97('0x6')),'defaultValue':_0x7c97('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7c97('0x7')]},'keyType':{'type':Sequelize[_0x7c97('0x2')](_0x7c97('0x3'),'variable',_0x7c97('0x8'))},'keyContent':{'type':Sequelize[_0x7c97('0x7')]},'idField':{'type':Sequelize[_0x7c97('0x7')]},'nameField':{'type':Sequelize[_0x7c97('0x7')]},'customField':{'type':Sequelize[_0x7c97('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c97('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0f8ae1c..8aaed56 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 _0xf008=['length','find','catch','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','sendStatus','name','send','index','map','ZendeskField','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf008,0x1c8));var _0x8f00=function(_0x248b00,_0xc4a273){_0x248b00=_0x248b00-0x0;var _0x54d833=_0xf008[_0x248b00];return _0x54d833;};'use strict';var emlformat=require(_0x8f00('0x0'));var rimraf=require(_0x8f00('0x1'));var zipdir=require(_0x8f00('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f00('0x3'));var moment=require(_0x8f00('0x4'));var BPromise=require(_0x8f00('0x5'));var Mustache=require(_0x8f00('0x6'));var util=require(_0x8f00('0x7'));var path=require(_0x8f00('0x8'));var sox=require(_0x8f00('0x9'));var csv=require(_0x8f00('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f00('0xb'));var _=require(_0x8f00('0xc'));var squel=require(_0x8f00('0xd'));var crypto=require(_0x8f00('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8f00('0xf'));var toCsv=require(_0x8f00('0xa'));var querystring=require('querystring');var Papa=require(_0x8f00('0x10'));var Redis=require(_0x8f00('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f00('0x12'));var as=require(_0x8f00('0x13'));var hardwareService=require(_0x8f00('0x14'));var logger=require('../../config/logger')(_0x8f00('0x15'));var utils=require(_0x8f00('0x16'));var config=require(_0x8f00('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f00('0x18'))['db'];function respondWithStatusCode(_0x1d6d98,_0x1dd131){_0x1dd131=_0x1dd131||0xcc;return function(_0x3d2fc5){if(_0x3d2fc5){return _0x1d6d98['sendStatus'](_0x1dd131);}return _0x1d6d98[_0x8f00('0x19')](_0x1dd131)[_0x8f00('0x1a')]();};}function respondWithResult(_0x4173bc,_0x350b69){_0x350b69=_0x350b69||0xc8;return function(_0x49553a){if(_0x49553a){return _0x4173bc[_0x8f00('0x19')](_0x350b69)[_0x8f00('0x1b')](_0x49553a);}};}function respondWithFilteredResult(_0x4ebb29,_0x29328e){return function(_0xa44a2e){if(_0xa44a2e){var _0x3450d2=typeof _0x29328e[_0x8f00('0x1c')]===_0x8f00('0x1d')&&typeof _0x29328e[_0x8f00('0x1e')]===_0x8f00('0x1d');var _0x50b0c1=_0xa44a2e['count'];var _0x521da4=_0x3450d2?0x0:_0x29328e[_0x8f00('0x1c')];var _0x202ce3=_0x3450d2?_0xa44a2e[_0x8f00('0x1f')]:_0x29328e[_0x8f00('0x1c')]+_0x29328e[_0x8f00('0x1e')];var _0x50eb58;if(_0x202ce3>=_0x50b0c1){_0x202ce3=_0x50b0c1;_0x50eb58=0xc8;}else{_0x50eb58=0xce;}_0x4ebb29[_0x8f00('0x19')](_0x50eb58);return _0x4ebb29['set'](_0x8f00('0x20'),_0x521da4+'-'+_0x202ce3+'/'+_0x50b0c1)[_0x8f00('0x1b')](_0xa44a2e);}return null;};}function patchUpdates(_0x50fb49){return function(_0x1e7990){try{jsonpatch[_0x8f00('0x21')](_0x1e7990,_0x50fb49,!![]);}catch(_0xa3304b){return BPromise[_0x8f00('0x22')](_0xa3304b);}return _0x1e7990['save']();};}function saveUpdates(_0x1249a6,_0x43587d){return function(_0x35e546){if(_0x35e546){return _0x35e546['update'](_0x1249a6)[_0x8f00('0x23')](function(_0x897b28){return _0x897b28;});}return null;};}function removeEntity(_0x1adfdf,_0x34fdfd){return function(_0x154030){if(_0x154030){return _0x154030[_0x8f00('0x24')]()['then'](function(){_0x1adfdf['status'](0xcc)[_0x8f00('0x1a')]();});}};}function handleEntityNotFound(_0x210ddf,_0x5953e9){return function(_0x4e0afb){if(!_0x4e0afb){_0x210ddf[_0x8f00('0x25')](0x194);}return _0x4e0afb;};}function handleError(_0x4658ed,_0x2af603){_0x2af603=_0x2af603||0x1f4;return function(_0x1a7da3){logger['error'](_0x1a7da3['stack']);if(_0x1a7da3[_0x8f00('0x26')]){delete _0x1a7da3[_0x8f00('0x26')];}_0x4658ed['status'](_0x2af603)[_0x8f00('0x27')](_0x1a7da3);};}exports[_0x8f00('0x28')]=function(_0x68113c,_0x222e48){var _0x49b584={},_0x303433={},_0x30ad71={'count':0x0,'rows':[]};var _0x1d74ba=_[_0x8f00('0x29')](db[_0x8f00('0x2a')][_0x8f00('0x2b')],function(_0x4ca2a3){return{'name':_0x4ca2a3['fieldName'],'type':_0x4ca2a3[_0x8f00('0x2c')][_0x8f00('0x2d')]};});_0x303433['model']=_['map'](_0x1d74ba,_0x8f00('0x26'));_0x303433['query']=_['keys'](_0x68113c[_0x8f00('0x2e')]);_0x303433[_0x8f00('0x2f')]=_[_0x8f00('0x30')](_0x303433['model'],_0x303433[_0x8f00('0x2e')]);_0x49b584[_0x8f00('0x31')]=_[_0x8f00('0x30')](_0x303433[_0x8f00('0x32')],qs[_0x8f00('0x33')](_0x68113c[_0x8f00('0x2e')][_0x8f00('0x33')]));_0x49b584[_0x8f00('0x31')]=_0x49b584['attributes']['length']?_0x49b584[_0x8f00('0x31')]:_0x303433['model'];if(!_0x68113c[_0x8f00('0x2e')][_0x8f00('0x34')](_0x8f00('0x35'))){_0x49b584[_0x8f00('0x1e')]=qs[_0x8f00('0x1e')](_0x68113c[_0x8f00('0x2e')][_0x8f00('0x1e')]);_0x49b584[_0x8f00('0x1c')]=qs['offset'](_0x68113c['query'][_0x8f00('0x1c')]);}_0x49b584[_0x8f00('0x36')]=qs['sort'](_0x68113c[_0x8f00('0x2e')][_0x8f00('0x37')]);_0x49b584[_0x8f00('0x38')]=qs[_0x8f00('0x2f')](_[_0x8f00('0x39')](_0x68113c[_0x8f00('0x2e')],_0x303433[_0x8f00('0x2f')]),_0x1d74ba);if(_0x68113c['query'][_0x8f00('0x3a')]){_0x49b584['where']=_[_0x8f00('0x3b')](_0x49b584[_0x8f00('0x38')],{'$or':_['map'](_0x1d74ba,function(_0x3c9e4d){if(_0x3c9e4d[_0x8f00('0x2c')]!==_0x8f00('0x3c')){var _0x2fe7c5={};_0x2fe7c5[_0x3c9e4d['name']]={'$like':'%'+_0x68113c[_0x8f00('0x2e')][_0x8f00('0x3a')]+'%'};return _0x2fe7c5;}})});}_0x49b584=_[_0x8f00('0x3b')]({},_0x49b584,_0x68113c[_0x8f00('0x3d')]);var _0x5fb61f={'where':_0x49b584[_0x8f00('0x38')]};return db[_0x8f00('0x2a')]['count'](_0x5fb61f)[_0x8f00('0x23')](function(_0x43bcc0){_0x30ad71[_0x8f00('0x1f')]=_0x43bcc0;if(_0x68113c[_0x8f00('0x2e')][_0x8f00('0x3e')]){_0x49b584[_0x8f00('0x3f')]=[{'all':!![]}];}return db[_0x8f00('0x2a')][_0x8f00('0x40')](_0x49b584);})[_0x8f00('0x23')](function(_0x2eaeb7){_0x30ad71[_0x8f00('0x41')]=_0x2eaeb7;return _0x30ad71;})[_0x8f00('0x23')](respondWithFilteredResult(_0x222e48,_0x49b584))['catch'](handleError(_0x222e48,null));};exports[_0x8f00('0x42')]=function(_0x3d2bfc,_0x515873){var _0x267726={'raw':!![],'where':{'id':_0x3d2bfc[_0x8f00('0x43')]['id']}},_0x45d84f={};_0x45d84f[_0x8f00('0x32')]=_[_0x8f00('0x44')](db[_0x8f00('0x2a')][_0x8f00('0x2b')]);_0x45d84f[_0x8f00('0x2e')]=_[_0x8f00('0x44')](_0x3d2bfc[_0x8f00('0x2e')]);_0x45d84f[_0x8f00('0x2f')]=_[_0x8f00('0x30')](_0x45d84f[_0x8f00('0x32')],_0x45d84f[_0x8f00('0x2e')]);_0x267726[_0x8f00('0x31')]=_[_0x8f00('0x30')](_0x45d84f[_0x8f00('0x32')],qs[_0x8f00('0x33')](_0x3d2bfc['query'][_0x8f00('0x33')]));_0x267726[_0x8f00('0x31')]=_0x267726['attributes'][_0x8f00('0x45')]?_0x267726[_0x8f00('0x31')]:_0x45d84f[_0x8f00('0x32')];if(_0x3d2bfc[_0x8f00('0x2e')][_0x8f00('0x3e')]){_0x267726['include']=[{'all':!![]}];}_0x267726=_[_0x8f00('0x3b')]({},_0x267726,_0x3d2bfc['options']);return db['ZendeskField'][_0x8f00('0x46')](_0x267726)[_0x8f00('0x23')](handleEntityNotFound(_0x515873,null))[_0x8f00('0x23')](respondWithResult(_0x515873,null))[_0x8f00('0x47')](handleError(_0x515873,null));};exports[_0x8f00('0x48')]=function(_0x593acd,_0x240c4d){return db[_0x8f00('0x2a')][_0x8f00('0x48')](_0x593acd[_0x8f00('0x49')],{})[_0x8f00('0x23')](respondWithResult(_0x240c4d,0xc9))[_0x8f00('0x47')](handleError(_0x240c4d,null));};exports[_0x8f00('0x4a')]=function(_0xe37461,_0x7ac427){if(_0xe37461[_0x8f00('0x49')]['id']){delete _0xe37461[_0x8f00('0x49')]['id'];}return db[_0x8f00('0x2a')][_0x8f00('0x46')]({'where':{'id':_0xe37461[_0x8f00('0x43')]['id']}})[_0x8f00('0x23')](handleEntityNotFound(_0x7ac427,null))['then'](saveUpdates(_0xe37461[_0x8f00('0x49')],null))[_0x8f00('0x23')](respondWithResult(_0x7ac427,null))[_0x8f00('0x47')](handleError(_0x7ac427,null));};exports[_0x8f00('0x24')]=function(_0x5616a5,_0xcdc36e){return db[_0x8f00('0x2a')]['find']({'where':{'id':_0x5616a5['params']['id']}})[_0x8f00('0x23')](handleEntityNotFound(_0xcdc36e,null))[_0x8f00('0x23')](removeEntity(_0xcdc36e,null))[_0x8f00('0x47')](handleError(_0xcdc36e,null));}; \ No newline at end of file +var _0x5374=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','send','index','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','ZendeskField','includeAll','rows','catch','show','find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x5374,0xd6));var _0x4537=function(_0x4565cb,_0x3c447e){_0x4565cb=_0x4565cb-0x0;var _0x1ccd83=_0x5374[_0x4565cb];return _0x1ccd83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4537('0x0'));var zipdir=require(_0x4537('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4537('0x2'));var moment=require(_0x4537('0x3'));var BPromise=require(_0x4537('0x4'));var Mustache=require(_0x4537('0x5'));var util=require(_0x4537('0x6'));var path=require(_0x4537('0x7'));var sox=require(_0x4537('0x8'));var csv=require('to-csv');var ejs=require(_0x4537('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4537('0xa'));var squel=require(_0x4537('0xb'));var crypto=require(_0x4537('0xc'));var jsforce=require(_0x4537('0xd'));var deskjs=require(_0x4537('0xe'));var toCsv=require(_0x4537('0xf'));var querystring=require(_0x4537('0x10'));var Papa=require(_0x4537('0x11'));var Redis=require(_0x4537('0x12'));var authService=require(_0x4537('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4537('0x14'));var hardwareService=require(_0x4537('0x15'));var logger=require(_0x4537('0x16'))('api');var utils=require(_0x4537('0x17'));var config=require(_0x4537('0x18'));var licenseUtil=require(_0x4537('0x19'));var db=require(_0x4537('0x1a'))['db'];function respondWithStatusCode(_0x2d25d6,_0x4221a6){_0x4221a6=_0x4221a6||0xcc;return function(_0x39f360){if(_0x39f360){return _0x2d25d6['sendStatus'](_0x4221a6);}return _0x2d25d6[_0x4537('0x1b')](_0x4221a6)[_0x4537('0x1c')]();};}function respondWithResult(_0x300103,_0x3b5b4e){_0x3b5b4e=_0x3b5b4e||0xc8;return function(_0x5b7b7c){if(_0x5b7b7c){return _0x300103[_0x4537('0x1b')](_0x3b5b4e)[_0x4537('0x1d')](_0x5b7b7c);}};}function respondWithFilteredResult(_0x2958ce,_0x4518e7){return function(_0x3df8ce){if(_0x3df8ce){var _0x18e263=typeof _0x4518e7[_0x4537('0x1e')]==='undefined'&&typeof _0x4518e7[_0x4537('0x1f')]===_0x4537('0x20');var _0x23193f=_0x3df8ce['count'];var _0x5724a4=_0x18e263?0x0:_0x4518e7[_0x4537('0x1e')];var _0x4a9bb0=_0x18e263?_0x3df8ce[_0x4537('0x21')]:_0x4518e7[_0x4537('0x1e')]+_0x4518e7[_0x4537('0x1f')];var _0x1e097f;if(_0x4a9bb0>=_0x23193f){_0x4a9bb0=_0x23193f;_0x1e097f=0xc8;}else{_0x1e097f=0xce;}_0x2958ce['status'](_0x1e097f);return _0x2958ce[_0x4537('0x22')]('Content-Range',_0x5724a4+'-'+_0x4a9bb0+'/'+_0x23193f)[_0x4537('0x1d')](_0x3df8ce);}return null;};}function patchUpdates(_0x78c80e){return function(_0x3c5e86){try{jsonpatch['apply'](_0x3c5e86,_0x78c80e,!![]);}catch(_0x5f46b8){return BPromise[_0x4537('0x23')](_0x5f46b8);}return _0x3c5e86[_0x4537('0x24')]();};}function saveUpdates(_0x17356d,_0x5b2ab3){return function(_0x586d25){if(_0x586d25){return _0x586d25[_0x4537('0x25')](_0x17356d)[_0x4537('0x26')](function(_0x8b094a){return _0x8b094a;});}return null;};}function removeEntity(_0xb619e5,_0x40c7ab){return function(_0x442cf7){if(_0x442cf7){return _0x442cf7[_0x4537('0x27')]()[_0x4537('0x26')](function(){_0xb619e5[_0x4537('0x1b')](0xcc)[_0x4537('0x1c')]();});}};}function handleEntityNotFound(_0x21b70d,_0xc38a27){return function(_0x4fb2f3){if(!_0x4fb2f3){_0x21b70d['sendStatus'](0x194);}return _0x4fb2f3;};}function handleError(_0x2e83e4,_0x52670a){_0x52670a=_0x52670a||0x1f4;return function(_0x1ca0d6){logger[_0x4537('0x28')](_0x1ca0d6[_0x4537('0x29')]);if(_0x1ca0d6['name']){delete _0x1ca0d6['name'];}_0x2e83e4['status'](_0x52670a)[_0x4537('0x2a')](_0x1ca0d6);};}exports[_0x4537('0x2b')]=function(_0x2aaa2b,_0x487405){var _0xe9e363={},_0x42fe40={},_0x286921={'count':0x0,'rows':[]};var _0x18bfd4=_['map'](db['ZendeskField'][_0x4537('0x2c')],function(_0x3947bf){return{'name':_0x3947bf['fieldName'],'type':_0x3947bf['type'][_0x4537('0x2d')]};});_0x42fe40[_0x4537('0x2e')]=_[_0x4537('0x2f')](_0x18bfd4,_0x4537('0x30'));_0x42fe40[_0x4537('0x31')]=_[_0x4537('0x32')](_0x2aaa2b['query']);_0x42fe40[_0x4537('0x33')]=_[_0x4537('0x34')](_0x42fe40['model'],_0x42fe40[_0x4537('0x31')]);_0xe9e363[_0x4537('0x35')]=_[_0x4537('0x34')](_0x42fe40['model'],qs[_0x4537('0x36')](_0x2aaa2b[_0x4537('0x31')][_0x4537('0x36')]));_0xe9e363['attributes']=_0xe9e363[_0x4537('0x35')][_0x4537('0x37')]?_0xe9e363['attributes']:_0x42fe40['model'];if(!_0x2aaa2b[_0x4537('0x31')][_0x4537('0x38')](_0x4537('0x39'))){_0xe9e363[_0x4537('0x1f')]=qs[_0x4537('0x1f')](_0x2aaa2b['query'][_0x4537('0x1f')]);_0xe9e363[_0x4537('0x1e')]=qs[_0x4537('0x1e')](_0x2aaa2b[_0x4537('0x31')]['offset']);}_0xe9e363[_0x4537('0x3a')]=qs[_0x4537('0x3b')](_0x2aaa2b[_0x4537('0x31')][_0x4537('0x3b')]);_0xe9e363[_0x4537('0x3c')]=qs[_0x4537('0x33')](_['pick'](_0x2aaa2b['query'],_0x42fe40[_0x4537('0x33')]),_0x18bfd4);if(_0x2aaa2b['query'][_0x4537('0x3d')]){_0xe9e363[_0x4537('0x3c')]=_['merge'](_0xe9e363[_0x4537('0x3c')],{'$or':_[_0x4537('0x2f')](_0x18bfd4,function(_0x474781){if(_0x474781[_0x4537('0x3e')]!==_0x4537('0x3f')){var _0x9931fe={};_0x9931fe[_0x474781[_0x4537('0x30')]]={'$like':'%'+_0x2aaa2b['query'][_0x4537('0x3d')]+'%'};return _0x9931fe;}})});}_0xe9e363=_[_0x4537('0x40')]({},_0xe9e363,_0x2aaa2b[_0x4537('0x41')]);var _0x31449a={'where':_0xe9e363[_0x4537('0x3c')]};return db[_0x4537('0x42')][_0x4537('0x21')](_0x31449a)[_0x4537('0x26')](function(_0x2cef95){_0x286921[_0x4537('0x21')]=_0x2cef95;if(_0x2aaa2b[_0x4537('0x31')][_0x4537('0x43')]){_0xe9e363['include']=[{'all':!![]}];}return db[_0x4537('0x42')]['findAll'](_0xe9e363);})['then'](function(_0x5f4210){_0x286921[_0x4537('0x44')]=_0x5f4210;return _0x286921;})[_0x4537('0x26')](respondWithFilteredResult(_0x487405,_0xe9e363))[_0x4537('0x45')](handleError(_0x487405,null));};exports[_0x4537('0x46')]=function(_0x1688dd,_0x20f035){var _0x556a78={'raw':!![],'where':{'id':_0x1688dd['params']['id']}},_0x78d4ee={};_0x78d4ee[_0x4537('0x2e')]=_['keys'](db['ZendeskField'][_0x4537('0x2c')]);_0x78d4ee['query']=_[_0x4537('0x32')](_0x1688dd[_0x4537('0x31')]);_0x78d4ee[_0x4537('0x33')]=_['intersection'](_0x78d4ee[_0x4537('0x2e')],_0x78d4ee[_0x4537('0x31')]);_0x556a78[_0x4537('0x35')]=_[_0x4537('0x34')](_0x78d4ee[_0x4537('0x2e')],qs[_0x4537('0x36')](_0x1688dd['query']['fields']));_0x556a78[_0x4537('0x35')]=_0x556a78[_0x4537('0x35')]['length']?_0x556a78[_0x4537('0x35')]:_0x78d4ee[_0x4537('0x2e')];if(_0x1688dd[_0x4537('0x31')][_0x4537('0x43')]){_0x556a78['include']=[{'all':!![]}];}_0x556a78=_[_0x4537('0x40')]({},_0x556a78,_0x1688dd[_0x4537('0x41')]);return db[_0x4537('0x42')][_0x4537('0x47')](_0x556a78)[_0x4537('0x26')](handleEntityNotFound(_0x20f035,null))['then'](respondWithResult(_0x20f035,null))[_0x4537('0x45')](handleError(_0x20f035,null));};exports[_0x4537('0x48')]=function(_0x5e2f00,_0x45fd27){return db[_0x4537('0x42')]['create'](_0x5e2f00[_0x4537('0x49')],{})[_0x4537('0x26')](respondWithResult(_0x45fd27,0xc9))[_0x4537('0x45')](handleError(_0x45fd27,null));};exports['update']=function(_0x26dd7c,_0x67a49e){if(_0x26dd7c[_0x4537('0x49')]['id']){delete _0x26dd7c[_0x4537('0x49')]['id'];}return db[_0x4537('0x42')][_0x4537('0x47')]({'where':{'id':_0x26dd7c[_0x4537('0x4a')]['id']}})['then'](handleEntityNotFound(_0x67a49e,null))['then'](saveUpdates(_0x26dd7c[_0x4537('0x49')],null))[_0x4537('0x26')](respondWithResult(_0x67a49e,null))[_0x4537('0x45')](handleError(_0x67a49e,null));};exports[_0x4537('0x27')]=function(_0x19d38c,_0x399b38){return db[_0x4537('0x42')]['find']({'where':{'id':_0x19d38c[_0x4537('0x4a')]['id']}})[_0x4537('0x26')](handleEntityNotFound(_0x399b38,null))[_0x4537('0x26')](removeEntity(_0x399b38,null))[_0x4537('0x45')](handleError(_0x399b38,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 298f509..bd9a82c 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 _0x8d7e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','idField','FieldId','lodash'];(function(_0x64c367,_0x308eb7){var _0x25ac23=function(_0x3d49d8){while(--_0x3d49d8){_0x64c367['push'](_0x64c367['shift']());}};_0x25ac23(++_0x308eb7);}(_0x8d7e,0x15d));var _0xe8d7=function(_0x558110,_0x4d969f){_0x558110=_0x558110-0x0;var _0x43df78=_0x8d7e[_0x558110];return _0x43df78;};'use strict';var _=require(_0xe8d7('0x0'));var util=require(_0xe8d7('0x1'));var logger=require(_0xe8d7('0x2'))('api');var moment=require(_0xe8d7('0x3'));var BPromise=require(_0xe8d7('0x4'));var rp=require(_0xe8d7('0x5'));var fs=require('fs');var path=require(_0xe8d7('0x6'));var rimraf=require(_0xe8d7('0x7'));var config=require(_0xe8d7('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xe8d7('0x9')]=function(_0xab0da6,_0x7d550b){return _0xab0da6[_0xe8d7('0xa')](_0xe8d7('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xe8d7('0xc'),_0xe8d7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17cf=['FieldId','lodash','util','api','moment','path','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x31711a,_0x10590e){var _0x3b407f=function(_0x2f552c){while(--_0x2f552c){_0x31711a['push'](_0x31711a['shift']());}};_0x3b407f(++_0x10590e);}(_0x17cf,0xd9));var _0xf17c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x17cf[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xf17c('0x0'));var util=require(_0xf17c('0x1'));var logger=require('../../config/logger')(_0xf17c('0x2'));var moment=require(_0xf17c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf17c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf17c('0x5'));module[_0xf17c('0x6')]=function(_0x29d400,_0x50aebe){return _0x29d400['define'](_0xf17c('0x7'),attributes,{'tableName':_0xf17c('0x8'),'paranoid':![],'indexes':[{'name':_0xf17c('0x9'),'fields':[_0xf17c('0xa'),_0xf17c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 6bb8655..7111cc2 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 _0x3c06=['../../config/environment','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3c06,0x1db));var _0x63c0=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0x3c06[_0x19997d];return _0x49be7f;};'use strict';var _=require(_0x63c0('0x0'));var util=require(_0x63c0('0x1'));var moment=require(_0x63c0('0x2'));var BPromise=require(_0x63c0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63c0('0x4'))['db'];var utils=require(_0x63c0('0x5'));var logger=require(_0x63c0('0x6'))(_0x63c0('0x7'));var config=require(_0x63c0('0x8'));var jayson=require(_0x63c0('0x9'));var client=jayson['client'][_0x63c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50c6e8,_0x13e81e,_0x1cf124){return new BPromise(function(_0x52b18b,_0x48a242){return client[_0x63c0('0xb')](_0x50c6e8,_0x1cf124)[_0x63c0('0xc')](function(_0x34c472){logger[_0x63c0('0xd')](_0x63c0('0xe'),_0x13e81e,'request\x20sent');logger['debug'](_0x63c0('0xf'),_0x13e81e,'request\x20sent',JSON[_0x63c0('0x10')](_0x34c472));if(_0x34c472[_0x63c0('0x11')]){if(_0x34c472[_0x63c0('0x11')][_0x63c0('0x12')]===0x1f4){logger[_0x63c0('0x11')](_0x63c0('0xe'),_0x13e81e,_0x34c472[_0x63c0('0x11')][_0x63c0('0x13')]);return _0x48a242(_0x34c472[_0x63c0('0x11')]['message']);}logger['error'](_0x63c0('0xe'),_0x13e81e,_0x34c472[_0x63c0('0x11')]['message']);return _0x52b18b(_0x34c472[_0x63c0('0x11')][_0x63c0('0x13')]);}else{logger[_0x63c0('0xd')]('ZendeskField,\x20%s,\x20%s',_0x13e81e,'request\x20sent');_0x52b18b(_0x34c472['result'][_0x63c0('0x13')]);}})[_0x63c0('0x14')](function(_0x25ae4b){logger[_0x63c0('0x11')](_0x63c0('0xe'),_0x13e81e,_0x25ae4b);_0x48a242(_0x25ae4b);});});} \ No newline at end of file +var _0x1882=['client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x15474f,_0x32a464){var _0x34ca60=function(_0x23b934){while(--_0x23b934){_0x15474f['push'](_0x15474f['shift']());}};_0x34ca60(++_0x32a464);}(_0x1882,0x81));var _0x2188=function(_0x12d17e,_0x1de194){_0x12d17e=_0x12d17e-0x0;var _0x2bef50=_0x1882[_0x12d17e];return _0x2bef50;};'use strict';var _=require(_0x2188('0x0'));var util=require(_0x2188('0x1'));var moment=require(_0x2188('0x2'));var BPromise=require('bluebird');var rs=require(_0x2188('0x3'));var fs=require('fs');var Redis=require(_0x2188('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2188('0x5'));var logger=require('../../config/logger')(_0x2188('0x6'));var config=require(_0x2188('0x7'));var jayson=require(_0x2188('0x8'));var client=jayson[_0x2188('0x9')][_0x2188('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22ff5d,_0x41e0b7,_0x183d08){return new BPromise(function(_0x28bad2,_0x4c6309){return client['request'](_0x22ff5d,_0x183d08)[_0x2188('0xb')](function(_0xc2304b){logger[_0x2188('0xc')](_0x2188('0xd'),_0x41e0b7,_0x2188('0xe'));logger[_0x2188('0xf')](_0x2188('0x10'),_0x41e0b7,_0x2188('0xe'),JSON[_0x2188('0x11')](_0xc2304b));if(_0xc2304b[_0x2188('0x12')]){if(_0xc2304b[_0x2188('0x12')][_0x2188('0x13')]===0x1f4){logger[_0x2188('0x12')](_0x2188('0xd'),_0x41e0b7,_0xc2304b[_0x2188('0x12')][_0x2188('0x14')]);return _0x4c6309(_0xc2304b[_0x2188('0x12')]['message']);}logger[_0x2188('0x12')](_0x2188('0xd'),_0x41e0b7,_0xc2304b[_0x2188('0x12')][_0x2188('0x14')]);return _0x28bad2(_0xc2304b[_0x2188('0x12')][_0x2188('0x14')]);}else{logger[_0x2188('0xc')](_0x2188('0xd'),_0x41e0b7,_0x2188('0xe'));_0x28bad2(_0xc2304b[_0x2188('0x15')][_0x2188('0x14')]);}})[_0x2188('0x16')](function(_0x179b0b){logger[_0x2188('0x12')](_0x2188('0xd'),_0x41e0b7,_0x179b0b);_0x4c6309(_0x179b0b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ca62791..82dceac 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 _0x36cd=['multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','delete','destroy','exports'];(function(_0x9f1932,_0x38c10f){var _0x41f539=function(_0x3f98a7){while(--_0x3f98a7){_0x9f1932['push'](_0x9f1932['shift']());}};_0x41f539(++_0x38c10f);}(_0x36cd,0x1a2));var _0xd36c=function(_0x39bc4a,_0x595147){_0x39bc4a=_0x39bc4a-0x0;var _0x436b0d=_0x36cd[_0x39bc4a];return _0x436b0d;};'use strict';var multer=require(_0xd36c('0x0'));var util=require(_0xd36c('0x1'));var path=require(_0xd36c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd36c('0x3'));var interaction=require(_0xd36c('0x4'));var config=require(_0xd36c('0x5'));var controller=require('./intZohoAccount.controller');router[_0xd36c('0x6')]('/',auth[_0xd36c('0x7')](),controller['index']);router[_0xd36c('0x6')](_0xd36c('0x8'),auth['isAuthenticated'](),controller[_0xd36c('0x9')]);router[_0xd36c('0x6')](_0xd36c('0xa'),auth['isAuthenticated'](),controller[_0xd36c('0xb')]);router[_0xd36c('0x6')]('/:id/fields',auth[_0xd36c('0x7')](),controller[_0xd36c('0xc')]);router[_0xd36c('0xd')]('/',auth[_0xd36c('0x7')](),controller['create']);router[_0xd36c('0xd')](_0xd36c('0xa'),auth[_0xd36c('0x7')](),controller[_0xd36c('0xe')]);router['put'](_0xd36c('0x8'),auth[_0xd36c('0x7')](),controller[_0xd36c('0xf')]);router[_0xd36c('0x10')](_0xd36c('0x8'),auth['isAuthenticated'](),controller[_0xd36c('0x11')]);module[_0xd36c('0x12')]=router; \ No newline at end of file +var _0x4311=['Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','isAuthenticated','/:id/fields','getFields','post','/:id/configurations','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0xe9f4a2,_0x50f0c4){var _0x25e066=function(_0x32557f){while(--_0x32557f){_0xe9f4a2['push'](_0xe9f4a2['shift']());}};_0x25e066(++_0x50f0c4);}(_0x4311,0x161));var _0x1431=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4311[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x1431('0x0'));var util=require('util');var path=require(_0x1431('0x1'));var timeout=require(_0x1431('0x2'));var express=require(_0x1431('0x3'));var router=express[_0x1431('0x4')]();var fs_extra=require(_0x1431('0x5'));var auth=require(_0x1431('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1431('0x7'));var controller=require('./intZohoAccount.controller');router[_0x1431('0x8')]('/',auth['isAuthenticated'](),controller[_0x1431('0x9')]);router['get'](_0x1431('0xa'),auth['isAuthenticated'](),controller[_0x1431('0xb')]);router[_0x1431('0x8')]('/:id/configurations',auth[_0x1431('0xc')](),controller['getConfigurations']);router[_0x1431('0x8')](_0x1431('0xd'),auth['isAuthenticated'](),controller[_0x1431('0xe')]);router['post']('/',auth[_0x1431('0xc')](),controller['create']);router[_0x1431('0xf')](_0x1431('0x10'),auth[_0x1431('0xc')](),controller['addConfiguration']);router[_0x1431('0x11')](_0x1431('0xa'),auth[_0x1431('0xc')](),controller[_0x1431('0x12')]);router[_0x1431('0x13')](_0x1431('0xa'),auth[_0x1431('0xc')](),controller[_0x1431('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index bb54b3b..e9ade1b 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 _0x54ef=['STRING','sequelize','exports'];(function(_0x2f90ed,_0x90af12){var _0x4cda45=function(_0x46e1ca){while(--_0x46e1ca){_0x2f90ed['push'](_0x2f90ed['shift']());}};_0x4cda45(++_0x90af12);}(_0x54ef,0x112));var _0xf54e=function(_0x251506,_0x19db57){_0x251506=_0x251506-0x0;var _0xcf5219=_0x54ef[_0x251506];return _0xcf5219;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file +var _0xee5b=['sequelize','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xee5b,0x1f4));var _0xbee5=function(_0x366270,_0x4ca8cc){_0x366270=_0x366270-0x0;var _0x1fd8d6=_0xee5b[_0x366270];return _0x1fd8d6;};'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 703ffbe..012699f 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 _0xc72e=['attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','options','ZohoAccount','include','findAll','rows','params','find','create','catch','update','body','findOne','ZohoConfiguration','order','getConfigurations','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model'];(function(_0x53f113,_0x2b7a8a){var _0x5b39b2=function(_0x49f506){while(--_0x49f506){_0x53f113['push'](_0x53f113['shift']());}};_0x5b39b2(++_0x2b7a8a);}(_0xc72e,0x152));var _0xec72=function(_0x598257,_0x356750){_0x598257=_0x598257-0x0;var _0x4e85ff=_0xc72e[_0x598257];return _0x4e85ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec72('0x0'));var zipdir=require(_0xec72('0x1'));var jsonpatch=require(_0xec72('0x2'));var rp=require(_0xec72('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xec72('0x4'));var path=require('path');var sox=require(_0xec72('0x5'));var csv=require('to-csv');var ejs=require(_0xec72('0x6'));var fs=require('fs');var fs_extra=require(_0xec72('0x7'));var _=require('lodash');var squel=require(_0xec72('0x8'));var crypto=require('crypto');var jsforce=require(_0xec72('0x9'));var deskjs=require(_0xec72('0xa'));var toCsv=require(_0xec72('0xb'));var querystring=require(_0xec72('0xc'));var Papa=require(_0xec72('0xd'));var Redis=require(_0xec72('0xe'));var authService=require(_0xec72('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xec72('0x10'));var hardwareService=require(_0xec72('0x11'));var logger=require(_0xec72('0x12'))(_0xec72('0x13'));var utils=require(_0xec72('0x14'));var config=require(_0xec72('0x15'));var licenseUtil=require(_0xec72('0x16'));var db=require(_0xec72('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x330877,_0x25387a){_0x25387a=_0x25387a||0xcc;return function(_0x4603fb){if(_0x4603fb){return _0x330877['sendStatus'](_0x25387a);}return _0x330877['status'](_0x25387a)[_0xec72('0x18')]();};}function respondWithResult(_0x2448aa,_0x9f57f){_0x9f57f=_0x9f57f||0xc8;return function(_0x194a76){if(_0x194a76){return _0x2448aa[_0xec72('0x19')](_0x9f57f)[_0xec72('0x1a')](_0x194a76);}};}function respondWithFilteredResult(_0xf95d77,_0x1e5c78){return function(_0x382a7d){if(_0x382a7d){var _0x17e43a=typeof _0x1e5c78[_0xec72('0x1b')]==='undefined'&&typeof _0x1e5c78[_0xec72('0x1c')]===_0xec72('0x1d');var _0x4e6577=_0x382a7d[_0xec72('0x1e')];var _0x55bd20=_0x17e43a?0x0:_0x1e5c78[_0xec72('0x1b')];var _0x452156=_0x17e43a?_0x382a7d[_0xec72('0x1e')]:_0x1e5c78[_0xec72('0x1b')]+_0x1e5c78[_0xec72('0x1c')];var _0x36f83c;if(_0x452156>=_0x4e6577){_0x452156=_0x4e6577;_0x36f83c=0xc8;}else{_0x36f83c=0xce;}_0xf95d77[_0xec72('0x19')](_0x36f83c);return _0xf95d77['set'](_0xec72('0x1f'),_0x55bd20+'-'+_0x452156+'/'+_0x4e6577)[_0xec72('0x1a')](_0x382a7d);}return null;};}function patchUpdates(_0x1d1512){return function(_0x4f5ab4){try{jsonpatch[_0xec72('0x20')](_0x4f5ab4,_0x1d1512,!![]);}catch(_0x1c47af){return BPromise[_0xec72('0x21')](_0x1c47af);}return _0x4f5ab4[_0xec72('0x22')]();};}function saveUpdates(_0x43d5e6,_0x2adb1c){return function(_0x4f91d9){if(_0x4f91d9){return _0x4f91d9['update'](_0x43d5e6)[_0xec72('0x23')](function(_0x57e940){return _0x57e940;});}return null;};}function removeEntity(_0x487f1e,_0x232c6b){return function(_0xd4c2ed){if(_0xd4c2ed){return _0xd4c2ed[_0xec72('0x24')]()[_0xec72('0x23')](function(){_0x487f1e['status'](0xcc)[_0xec72('0x18')]();});}};}function handleEntityNotFound(_0x4577c4,_0x1fd016){return function(_0x3a3d7c){if(!_0x3a3d7c){_0x4577c4['sendStatus'](0x194);}return _0x3a3d7c;};}function handleError(_0x50e5f6,_0x24c0ae){_0x24c0ae=_0x24c0ae||0x1f4;return function(_0x4fb655){logger['error'](_0x4fb655[_0xec72('0x25')]);if(_0x4fb655[_0xec72('0x26')]){delete _0x4fb655['name'];}_0x50e5f6[_0xec72('0x19')](_0x24c0ae)[_0xec72('0x27')](_0x4fb655);};}exports[_0xec72('0x28')]=function(_0x4c4136,_0x525b92){var _0x110b9d={},_0x557c43={},_0x190ee8={'count':0x0,'rows':[]};var _0x5ea77f=_[_0xec72('0x29')](db['ZohoAccount'][_0xec72('0x2a')],function(_0x1cf742){return{'name':_0x1cf742[_0xec72('0x2b')],'type':_0x1cf742['type'][_0xec72('0x2c')]};});_0x557c43['model']=_[_0xec72('0x29')](_0x5ea77f,_0xec72('0x26'));_0x557c43[_0xec72('0x2d')]=_[_0xec72('0x2e')](_0x4c4136[_0xec72('0x2d')]);_0x557c43['filters']=_[_0xec72('0x2f')](_0x557c43[_0xec72('0x30')],_0x557c43[_0xec72('0x2d')]);_0x110b9d[_0xec72('0x31')]=_['intersection'](_0x557c43[_0xec72('0x30')],qs[_0xec72('0x32')](_0x4c4136['query']['fields']));_0x110b9d[_0xec72('0x31')]=_0x110b9d[_0xec72('0x31')][_0xec72('0x33')]?_0x110b9d[_0xec72('0x31')]:_0x557c43[_0xec72('0x30')];if(!_0x4c4136[_0xec72('0x2d')][_0xec72('0x34')]('nolimit')){_0x110b9d[_0xec72('0x1c')]=qs['limit'](_0x4c4136[_0xec72('0x2d')]['limit']);_0x110b9d[_0xec72('0x1b')]=qs[_0xec72('0x1b')](_0x4c4136[_0xec72('0x2d')][_0xec72('0x1b')]);}_0x110b9d['order']=qs[_0xec72('0x35')](_0x4c4136['query'][_0xec72('0x35')]);_0x110b9d[_0xec72('0x36')]=qs[_0xec72('0x37')](_[_0xec72('0x38')](_0x4c4136['query'],_0x557c43[_0xec72('0x37')]),_0x5ea77f);if(_0x4c4136['query'][_0xec72('0x39')]){_0x110b9d[_0xec72('0x36')]=_[_0xec72('0x3a')](_0x110b9d[_0xec72('0x36')],{'$or':_[_0xec72('0x29')](_0x5ea77f,function(_0x262dc7){if(_0x262dc7[_0xec72('0x3b')]!=='VIRTUAL'){var _0x459cf9={};_0x459cf9[_0x262dc7[_0xec72('0x26')]]={'$like':'%'+_0x4c4136[_0xec72('0x2d')][_0xec72('0x39')]+'%'};return _0x459cf9;}})});}_0x110b9d=_['merge']({},_0x110b9d,_0x4c4136[_0xec72('0x3c')]);var _0x114752={'where':_0x110b9d[_0xec72('0x36')]};return db[_0xec72('0x3d')][_0xec72('0x1e')](_0x114752)[_0xec72('0x23')](function(_0x5648b2){_0x190ee8[_0xec72('0x1e')]=_0x5648b2;if(_0x4c4136['query']['includeAll']){_0x110b9d[_0xec72('0x3e')]=[{'all':!![]}];}return db[_0xec72('0x3d')][_0xec72('0x3f')](_0x110b9d);})[_0xec72('0x23')](function(_0x69854b){_0x190ee8[_0xec72('0x40')]=_0x69854b;return _0x190ee8;})[_0xec72('0x23')](respondWithFilteredResult(_0x525b92,_0x110b9d))['catch'](handleError(_0x525b92,null));};exports['show']=function(_0x5a2880,_0x858d4e){var _0x28e6d2={'raw':![],'where':{'id':_0x5a2880[_0xec72('0x41')]['id']}},_0x54a919={};_0x54a919['model']=_[_0xec72('0x2e')](db[_0xec72('0x3d')]['rawAttributes']);_0x54a919[_0xec72('0x2d')]=_[_0xec72('0x2e')](_0x5a2880[_0xec72('0x2d')]);_0x54a919[_0xec72('0x37')]=_[_0xec72('0x2f')](_0x54a919['model'],_0x54a919[_0xec72('0x2d')]);_0x28e6d2[_0xec72('0x31')]=_[_0xec72('0x2f')](_0x54a919[_0xec72('0x30')],qs[_0xec72('0x32')](_0x5a2880[_0xec72('0x2d')]['fields']));_0x28e6d2['attributes']=_0x28e6d2[_0xec72('0x31')][_0xec72('0x33')]?_0x28e6d2[_0xec72('0x31')]:_0x54a919[_0xec72('0x30')];if(_0x5a2880[_0xec72('0x2d')]['includeAll']){_0x28e6d2[_0xec72('0x3e')]=[{'all':!![]}];}_0x28e6d2=_[_0xec72('0x3a')]({},_0x28e6d2,_0x5a2880[_0xec72('0x3c')]);return db[_0xec72('0x3d')][_0xec72('0x42')](_0x28e6d2)[_0xec72('0x23')](handleEntityNotFound(_0x858d4e,null))['then'](respondWithResult(_0x858d4e,null))['catch'](handleError(_0x858d4e,null));};exports['create']=function(_0x195120,_0x29dc11){return db['ZohoAccount'][_0xec72('0x43')](_0x195120['body'],{})['then'](respondWithResult(_0x29dc11,0xc9))[_0xec72('0x44')](handleError(_0x29dc11,null));};exports[_0xec72('0x45')]=function(_0x467952,_0xabd0b){if(_0x467952[_0xec72('0x46')]['id']){delete _0x467952['body']['id'];}return db[_0xec72('0x3d')]['find']({'where':{'id':_0x467952[_0xec72('0x41')]['id']}})[_0xec72('0x23')](handleEntityNotFound(_0xabd0b,null))[_0xec72('0x23')](saveUpdates(_0x467952['body'],null))['then'](respondWithResult(_0xabd0b,null))[_0xec72('0x44')](handleError(_0xabd0b,null));};exports[_0xec72('0x24')]=function(_0x4a939d,_0x3daa1c){return db['ZohoAccount'][_0xec72('0x42')]({'where':{'id':_0x4a939d[_0xec72('0x41')]['id']}})[_0xec72('0x23')](handleEntityNotFound(_0x3daa1c,null))[_0xec72('0x23')](removeEntity(_0x3daa1c,null))['catch'](handleError(_0x3daa1c,null));};exports['getConfigurations']=function(_0x5bd8c0,_0x550cf4,_0x44693b){var _0x39209d={};var _0x214e70={};var _0x4104f0;var _0x20bb26;return db['ZohoAccount'][_0xec72('0x47')]({'where':{'id':_0x5bd8c0[_0xec72('0x41')]['id']}})[_0xec72('0x23')](handleEntityNotFound(_0x550cf4,null))[_0xec72('0x23')](function(_0x456813){if(_0x456813){_0x4104f0=_0x456813;_0x214e70[_0xec72('0x30')]=_['keys'](db[_0xec72('0x48')]['rawAttributes']);_0x214e70[_0xec72('0x2d')]=_[_0xec72('0x2e')](_0x5bd8c0[_0xec72('0x2d')]);_0x214e70[_0xec72('0x37')]=_[_0xec72('0x2f')](_0x214e70[_0xec72('0x30')],_0x214e70[_0xec72('0x2d')]);_0x39209d[_0xec72('0x31')]=_[_0xec72('0x2f')](_0x214e70[_0xec72('0x30')],qs[_0xec72('0x32')](_0x5bd8c0[_0xec72('0x2d')][_0xec72('0x32')]));_0x39209d[_0xec72('0x31')]=_0x39209d[_0xec72('0x31')][_0xec72('0x33')]?_0x39209d[_0xec72('0x31')]:_0x214e70[_0xec72('0x30')];_0x39209d[_0xec72('0x49')]=qs[_0xec72('0x35')](_0x5bd8c0['query']['sort']);_0x39209d[_0xec72('0x36')]=qs[_0xec72('0x37')](_[_0xec72('0x38')](_0x5bd8c0[_0xec72('0x2d')],_0x214e70['filters']));if(_0x5bd8c0[_0xec72('0x2d')]['filter']){_0x39209d['where']=_['merge'](_0x39209d[_0xec72('0x36')],{'$or':_['map'](_0x39209d[_0xec72('0x31')],function(_0x90e153){var _0x3a9e2f={};_0x3a9e2f[_0x90e153]={'$like':'%'+_0x5bd8c0['query'][_0xec72('0x39')]+'%'};return _0x3a9e2f;})});}_0x39209d=_['merge']({},_0x39209d,_0x5bd8c0[_0xec72('0x3c')]);return _0x4104f0[_0xec72('0x4a')](_0x39209d);}})[_0xec72('0x23')](function(_0x4fdbde){if(_0x4fdbde){_0x20bb26=_0x4fdbde[_0xec72('0x33')];if(!_0x5bd8c0[_0xec72('0x2d')]['hasOwnProperty'](_0xec72('0x4b'))){_0x39209d[_0xec72('0x1c')]=qs[_0xec72('0x1c')](_0x5bd8c0[_0xec72('0x2d')][_0xec72('0x1c')]);_0x39209d[_0xec72('0x1b')]=qs[_0xec72('0x1b')](_0x5bd8c0[_0xec72('0x2d')][_0xec72('0x1b')]);}return _0x4104f0[_0xec72('0x4a')](_0x39209d);}})[_0xec72('0x23')](function(_0x3e9f0c){if(_0x3e9f0c){return _0x3e9f0c?{'count':_0x20bb26,'rows':_0x3e9f0c}:null;}})[_0xec72('0x23')](respondWithResult(_0x550cf4,null))[_0xec72('0x44')](handleError(_0x550cf4,null));};exports['addConfiguration']=function(_0x36ba51,_0x438d46,_0x48239f){if(_0x36ba51[_0xec72('0x46')]['id']){delete _0x36ba51['body']['id'];}return db[_0xec72('0x3d')][_0xec72('0x47')]({'where':{'id':_0x36ba51[_0xec72('0x41')]['id']}})[_0xec72('0x23')](handleEntityNotFound(_0x438d46,null))[_0xec72('0x23')](function(_0x4ee1cb){if(_0x4ee1cb){_0x36ba51[_0xec72('0x46')][_0xec72('0x4c')]=_0x4ee1cb['id'];_0x36ba51[_0xec72('0x46')][_0xec72('0x4d')]=integrations[_0xec72('0x4e')](_0x36ba51[_0xec72('0x46')][_0xec72('0x4f')],_0x36ba51[_0xec72('0x46')]['type']);_0x36ba51[_0xec72('0x46')][_0xec72('0x50')]=integrations[_0xec72('0x51')](_0x36ba51[_0xec72('0x46')][_0xec72('0x4f')],_0x36ba51['body'][_0xec72('0x3b')]);return db[_0xec72('0x48')][_0xec72('0x43')](_0x36ba51[_0xec72('0x46')],{'include':[{'model':db[_0xec72('0x52')],'as':_0xec72('0x4d')},{'model':db[_0xec72('0x52')],'as':_0xec72('0x50')}]});}return null;})[_0xec72('0x23')](respondWithResult(_0x438d46,null))['catch'](handleError(_0x438d46,null));};function getAccessToken(_0x5382fa){return new Promise(function(_0x5202d8,_0x170ba6){var _0x11252c;switch(_0x5382fa[_0xec72('0x53')]){case'US':_0x11252c=_0xec72('0x54');break;case'AU':_0x11252c=_0xec72('0x55');break;case'EU':_0x11252c='https://accounts.zoho.eu';break;case'IN':_0x11252c=_0xec72('0x56');break;case'CN':_0x11252c=_0xec72('0x57');break;default:_0x11252c='https://accounts.zoho.eu';break;}var _0x17126c={'method':'POST','uri':_0x11252c+_0xec72('0x58'),'qs':{'refresh_token':_0x5382fa[_0xec72('0x59')],'client_id':_0x5382fa[_0xec72('0x5a')],'client_secret':_0x5382fa[_0xec72('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x17126c)[_0xec72('0x23')](function(_0x5d4905){if(_0x5d4905[_0xec72('0x5c')]){_0x5202d8(_0x5d4905['access_token']);}else{_0x170ba6(_0xec72('0x5d'));}})[_0xec72('0x44')](function(_0x152b87){_0x170ba6(_0x152b87);});});}exports[_0xec72('0x5e')]=function(_0x5c775a,_0x1e0fe1,_0x1b6a72){var _0x3b4653,_0x46bf12,_0x4e07aa,_0x54ac93,_0x4f76f4;return db['ZohoAccount'][_0xec72('0x47')]({'where':{'id':_0x5c775a[_0xec72('0x41')]['id']},'attributes':['id',_0xec72('0x5f'),_0xec72('0x53'),_0xec72('0x5a'),'clientSecret',_0xec72('0x60'),_0xec72('0x61'),'refreshToken']})[_0xec72('0x23')](handleEntityNotFound(_0x1e0fe1,null))['then'](function(_0x57fbab){_0x4f76f4=_0x57fbab;_0x3b4653=_0x4f76f4[_0xec72('0x5f')];_0x46bf12=_0x3b4653===_0xec72('0x62')?'eu':'com';_0x4e07aa=_0x4f76f4['serverUrl'];var _0x19ff97=_0x4e07aa[_0xec72('0x63')](-0x1);if(_0x19ff97==='/'||_0x19ff97==='\x5c'||_0x19ff97===':'){_0x4e07aa=_0x4e07aa[_0xec72('0x64')](0x0,_0x4e07aa[_0xec72('0x65')](_0x19ff97));}if(!_0x4f76f4['refreshToken']){throw new Error(_0xec72('0x66'));}return getAccessToken(_0x4f76f4);})[_0xec72('0x23')](function(_0x313f54){if(_0x313f54){return rp({'method':_0xec72('0x67'),'uri':util[_0xec72('0x68')](_0xec72('0x69'),_0x46bf12),'qs':{'module':_0xec72('0x6a')},'headers':{'Authorization':_0xec72('0x6b')+_0x313f54},'json':!![]});}})[_0xec72('0x23')](function(_0xd3c417){if(_0xd3c417){if(_0xd3c417['response']&&_0xd3c417[_0xec72('0x6c')][_0xec72('0x6d')]){throw new Error(_0xd3c417[_0xec72('0x6c')][_0xec72('0x6d')]['message']);}var _0xe802d4=[];var _0x5f382e=[];var _0x5f3656=[_0xec72('0x6e'),_0xec72('0x6f'),_0xec72('0x70'),_0xec72('0x71'),'Call_Duration',_0xec72('0x72'),_0xec72('0x73'),_0xec72('0x74')];_0x5f382e=_[_0xec72('0x75')](_0xd3c417[_0xec72('0x32')],function(_0x56b8ed){return _0x5f3656[_0xec72('0x76')](_0x56b8ed['api_name']);});for(var _0x9315fe=0x0;_0x9315fe<_0x5f382e[_0xec72('0x33')];_0x9315fe++){if(_0x5f382e[_0x9315fe][_0xec72('0x77')]===![]){_0xe802d4[_0xec72('0x78')]({'id':_0x5f382e[_0x9315fe]['id'],'name':_0x5f382e[_0x9315fe]['display_label'],'custom':_0x5f382e[_0x9315fe][_0xec72('0x79')],'options':_0x5f382e[_0x9315fe][_0xec72('0x7a')]==='picklist'&&_0x5f382e[_0x9315fe]['pick_list_values'][_0xec72('0x33')]>-0x1?_['map'](_0x5f382e[_0x9315fe][_0xec72('0x7b')],function(_0x2b284e){return{'name':_0x2b284e,'value':_0x2b284e};}):[]});}}return{'count':_0xe802d4[_0xec72('0x33')],'rows':_0xe802d4};}else{return{'count':0x0,'rows':[]};}})[_0xec72('0x23')](respondWithResult(_0x1e0fe1,null))[_0xec72('0x44')](function(_0x2892ca){var _0x58aa02=_0x5c775a[_0xec72('0x2d')][_0xec72('0x7c')]?0x1f4:_0x2892ca[_0xec72('0x7d')]||0x1f4;logger[_0xec72('0x6d')](_0xec72('0x7e'),_0xec72('0x5e'),_0x58aa02,JSON[_0xec72('0x7f')](_0x2892ca));delete _0x2892ca[_0xec72('0x26')];if(_0x58aa02===0x191){_0x58aa02=0x190;}_0x1e0fe1['status'](_0x58aa02)[_0xec72('0x27')](_0x5c775a['query'][_0xec72('0x7c')]?{'message':_0xec72('0x80'),'statusCode':_0x2892ca[_0xec72('0x7d')]}:_0x2892ca);});}; \ No newline at end of file +var _0x84db=['body','update','destroy','findOne','ZohoConfiguration','filter','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','substring','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Result','Call_Start_Time','includes','api_name','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','util','path','sox','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/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ZohoAccount','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','type','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create'];(function(_0x10a67b,_0x287b95){var _0x10b328=function(_0x431554){while(--_0x431554){_0x10a67b['push'](_0x10a67b['shift']());}};_0x10b328(++_0x287b95);}(_0x84db,0x1ad));var _0xb84d=function(_0x18f42f,_0x397bc1){_0x18f42f=_0x18f42f-0x0;var _0x306ff1=_0x84db[_0x18f42f];return _0x306ff1;};'use strict';var emlformat=require(_0xb84d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb84d('0x1'));var rp=require(_0xb84d('0x2'));var moment=require(_0xb84d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb84d('0x4'));var path=require(_0xb84d('0x5'));var sox=require(_0xb84d('0x6'));var csv=require(_0xb84d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb84d('0x8'));var _=require(_0xb84d('0x9'));var squel=require(_0xb84d('0xa'));var crypto=require(_0xb84d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb84d('0xc'));var toCsv=require(_0xb84d('0x7'));var querystring=require('querystring');var Papa=require(_0xb84d('0xd'));var Redis=require('ioredis');var authService=require(_0xb84d('0xe'));var qs=require(_0xb84d('0xf'));var as=require(_0xb84d('0x10'));var hardwareService=require(_0xb84d('0x11'));var logger=require(_0xb84d('0x12'))(_0xb84d('0x13'));var utils=require('../../config/utils');var config=require(_0xb84d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb84d('0x15'))['db'];var integrations=require(_0xb84d('0x16'));function respondWithStatusCode(_0x41ac3d,_0x55ac13){_0x55ac13=_0x55ac13||0xcc;return function(_0x24808e){if(_0x24808e){return _0x41ac3d[_0xb84d('0x17')](_0x55ac13);}return _0x41ac3d['status'](_0x55ac13)[_0xb84d('0x18')]();};}function respondWithResult(_0x4037ed,_0x49d89b){_0x49d89b=_0x49d89b||0xc8;return function(_0x9302ad){if(_0x9302ad){return _0x4037ed[_0xb84d('0x19')](_0x49d89b)[_0xb84d('0x1a')](_0x9302ad);}};}function respondWithFilteredResult(_0x54ced2,_0x954116){return function(_0x1adaf0){if(_0x1adaf0){var _0x4c4a00=typeof _0x954116[_0xb84d('0x1b')]===_0xb84d('0x1c')&&typeof _0x954116[_0xb84d('0x1d')]==='undefined';var _0x543404=_0x1adaf0[_0xb84d('0x1e')];var _0x3bf9a3=_0x4c4a00?0x0:_0x954116[_0xb84d('0x1b')];var _0x33497d=_0x4c4a00?_0x1adaf0['count']:_0x954116[_0xb84d('0x1b')]+_0x954116['limit'];var _0x36737b;if(_0x33497d>=_0x543404){_0x33497d=_0x543404;_0x36737b=0xc8;}else{_0x36737b=0xce;}_0x54ced2[_0xb84d('0x19')](_0x36737b);return _0x54ced2['set'](_0xb84d('0x1f'),_0x3bf9a3+'-'+_0x33497d+'/'+_0x543404)[_0xb84d('0x1a')](_0x1adaf0);}return null;};}function patchUpdates(_0x1dac94){return function(_0x565331){try{jsonpatch[_0xb84d('0x20')](_0x565331,_0x1dac94,!![]);}catch(_0x970fc8){return BPromise[_0xb84d('0x21')](_0x970fc8);}return _0x565331[_0xb84d('0x22')]();};}function saveUpdates(_0x38f15d,_0x1ab631){return function(_0x14cf4c){if(_0x14cf4c){return _0x14cf4c['update'](_0x38f15d)[_0xb84d('0x23')](function(_0x385acc){return _0x385acc;});}return null;};}function removeEntity(_0x1ecce0,_0x519fc7){return function(_0x4abfb7){if(_0x4abfb7){return _0x4abfb7['destroy']()[_0xb84d('0x23')](function(){_0x1ecce0[_0xb84d('0x19')](0xcc)[_0xb84d('0x18')]();});}};}function handleEntityNotFound(_0x14b207,_0x3e11a9){return function(_0x9686e7){if(!_0x9686e7){_0x14b207['sendStatus'](0x194);}return _0x9686e7;};}function handleError(_0x2ab743,_0x217a8f){_0x217a8f=_0x217a8f||0x1f4;return function(_0x98fcfe){logger[_0xb84d('0x24')](_0x98fcfe[_0xb84d('0x25')]);if(_0x98fcfe['name']){delete _0x98fcfe[_0xb84d('0x26')];}_0x2ab743[_0xb84d('0x19')](_0x217a8f)[_0xb84d('0x27')](_0x98fcfe);};}exports[_0xb84d('0x28')]=function(_0x4dd7f9,_0x4a0c28){var _0x3061c1={},_0x47d6ef={},_0x274614={'count':0x0,'rows':[]};var _0xdbe168=_[_0xb84d('0x29')](db[_0xb84d('0x2a')]['rawAttributes'],function(_0xcf7cb5){return{'name':_0xcf7cb5[_0xb84d('0x2b')],'type':_0xcf7cb5['type'][_0xb84d('0x2c')]};});_0x47d6ef[_0xb84d('0x2d')]=_[_0xb84d('0x29')](_0xdbe168,'name');_0x47d6ef[_0xb84d('0x2e')]=_[_0xb84d('0x2f')](_0x4dd7f9[_0xb84d('0x2e')]);_0x47d6ef['filters']=_['intersection'](_0x47d6ef['model'],_0x47d6ef['query']);_0x3061c1[_0xb84d('0x30')]=_[_0xb84d('0x31')](_0x47d6ef[_0xb84d('0x2d')],qs['fields'](_0x4dd7f9[_0xb84d('0x2e')][_0xb84d('0x32')]));_0x3061c1['attributes']=_0x3061c1['attributes'][_0xb84d('0x33')]?_0x3061c1[_0xb84d('0x30')]:_0x47d6ef[_0xb84d('0x2d')];if(!_0x4dd7f9[_0xb84d('0x2e')][_0xb84d('0x34')](_0xb84d('0x35'))){_0x3061c1[_0xb84d('0x1d')]=qs[_0xb84d('0x1d')](_0x4dd7f9['query'][_0xb84d('0x1d')]);_0x3061c1['offset']=qs[_0xb84d('0x1b')](_0x4dd7f9[_0xb84d('0x2e')]['offset']);}_0x3061c1[_0xb84d('0x36')]=qs[_0xb84d('0x37')](_0x4dd7f9[_0xb84d('0x2e')][_0xb84d('0x37')]);_0x3061c1['where']=qs['filters'](_[_0xb84d('0x38')](_0x4dd7f9[_0xb84d('0x2e')],_0x47d6ef[_0xb84d('0x39')]),_0xdbe168);if(_0x4dd7f9[_0xb84d('0x2e')]['filter']){_0x3061c1[_0xb84d('0x3a')]=_[_0xb84d('0x3b')](_0x3061c1[_0xb84d('0x3a')],{'$or':_[_0xb84d('0x29')](_0xdbe168,function(_0x4ef92a){if(_0x4ef92a[_0xb84d('0x3c')]!=='VIRTUAL'){var _0x244960={};_0x244960[_0x4ef92a['name']]={'$like':'%'+_0x4dd7f9[_0xb84d('0x2e')]['filter']+'%'};return _0x244960;}})});}_0x3061c1=_[_0xb84d('0x3b')]({},_0x3061c1,_0x4dd7f9[_0xb84d('0x3d')]);var _0x36858c={'where':_0x3061c1[_0xb84d('0x3a')]};return db[_0xb84d('0x2a')][_0xb84d('0x1e')](_0x36858c)[_0xb84d('0x23')](function(_0x1cd57e){_0x274614[_0xb84d('0x1e')]=_0x1cd57e;if(_0x4dd7f9[_0xb84d('0x2e')][_0xb84d('0x3e')]){_0x3061c1[_0xb84d('0x3f')]=[{'all':!![]}];}return db[_0xb84d('0x2a')][_0xb84d('0x40')](_0x3061c1);})[_0xb84d('0x23')](function(_0x43c2f0){_0x274614[_0xb84d('0x41')]=_0x43c2f0;return _0x274614;})[_0xb84d('0x23')](respondWithFilteredResult(_0x4a0c28,_0x3061c1))['catch'](handleError(_0x4a0c28,null));};exports['show']=function(_0x484b1c,_0x9b939f){var _0x204003={'raw':![],'where':{'id':_0x484b1c[_0xb84d('0x42')]['id']}},_0x3bb669={};_0x3bb669['model']=_[_0xb84d('0x2f')](db[_0xb84d('0x2a')][_0xb84d('0x43')]);_0x3bb669[_0xb84d('0x2e')]=_[_0xb84d('0x2f')](_0x484b1c[_0xb84d('0x2e')]);_0x3bb669[_0xb84d('0x39')]=_[_0xb84d('0x31')](_0x3bb669[_0xb84d('0x2d')],_0x3bb669[_0xb84d('0x2e')]);_0x204003[_0xb84d('0x30')]=_[_0xb84d('0x31')](_0x3bb669[_0xb84d('0x2d')],qs[_0xb84d('0x32')](_0x484b1c['query'][_0xb84d('0x32')]));_0x204003['attributes']=_0x204003[_0xb84d('0x30')][_0xb84d('0x33')]?_0x204003[_0xb84d('0x30')]:_0x3bb669[_0xb84d('0x2d')];if(_0x484b1c[_0xb84d('0x2e')][_0xb84d('0x3e')]){_0x204003['include']=[{'all':!![]}];}_0x204003=_[_0xb84d('0x3b')]({},_0x204003,_0x484b1c[_0xb84d('0x3d')]);return db[_0xb84d('0x2a')][_0xb84d('0x44')](_0x204003)[_0xb84d('0x23')](handleEntityNotFound(_0x9b939f,null))[_0xb84d('0x23')](respondWithResult(_0x9b939f,null))[_0xb84d('0x45')](handleError(_0x9b939f,null));};exports[_0xb84d('0x46')]=function(_0xecfc1e,_0x4b353b){return db['ZohoAccount']['create'](_0xecfc1e[_0xb84d('0x47')],{})[_0xb84d('0x23')](respondWithResult(_0x4b353b,0xc9))[_0xb84d('0x45')](handleError(_0x4b353b,null));};exports[_0xb84d('0x48')]=function(_0x1d5d51,_0x392e3c){if(_0x1d5d51[_0xb84d('0x47')]['id']){delete _0x1d5d51[_0xb84d('0x47')]['id'];}return db[_0xb84d('0x2a')][_0xb84d('0x44')]({'where':{'id':_0x1d5d51['params']['id']}})[_0xb84d('0x23')](handleEntityNotFound(_0x392e3c,null))[_0xb84d('0x23')](saveUpdates(_0x1d5d51['body'],null))[_0xb84d('0x23')](respondWithResult(_0x392e3c,null))[_0xb84d('0x45')](handleError(_0x392e3c,null));};exports[_0xb84d('0x49')]=function(_0x4d6b32,_0x29972e){return db[_0xb84d('0x2a')][_0xb84d('0x44')]({'where':{'id':_0x4d6b32['params']['id']}})[_0xb84d('0x23')](handleEntityNotFound(_0x29972e,null))[_0xb84d('0x23')](removeEntity(_0x29972e,null))[_0xb84d('0x45')](handleError(_0x29972e,null));};exports['getConfigurations']=function(_0x2e4c42,_0x44e099,_0x148a95){var _0x19c84b={};var _0x31fab8={};var _0x45b5df;var _0x5af199;return db[_0xb84d('0x2a')][_0xb84d('0x4a')]({'where':{'id':_0x2e4c42[_0xb84d('0x42')]['id']}})['then'](handleEntityNotFound(_0x44e099,null))[_0xb84d('0x23')](function(_0x42a2e6){if(_0x42a2e6){_0x45b5df=_0x42a2e6;_0x31fab8[_0xb84d('0x2d')]=_[_0xb84d('0x2f')](db[_0xb84d('0x4b')][_0xb84d('0x43')]);_0x31fab8[_0xb84d('0x2e')]=_[_0xb84d('0x2f')](_0x2e4c42['query']);_0x31fab8[_0xb84d('0x39')]=_[_0xb84d('0x31')](_0x31fab8['model'],_0x31fab8[_0xb84d('0x2e')]);_0x19c84b[_0xb84d('0x30')]=_[_0xb84d('0x31')](_0x31fab8['model'],qs['fields'](_0x2e4c42[_0xb84d('0x2e')][_0xb84d('0x32')]));_0x19c84b[_0xb84d('0x30')]=_0x19c84b[_0xb84d('0x30')]['length']?_0x19c84b[_0xb84d('0x30')]:_0x31fab8[_0xb84d('0x2d')];_0x19c84b['order']=qs['sort'](_0x2e4c42['query'][_0xb84d('0x37')]);_0x19c84b[_0xb84d('0x3a')]=qs[_0xb84d('0x39')](_[_0xb84d('0x38')](_0x2e4c42[_0xb84d('0x2e')],_0x31fab8[_0xb84d('0x39')]));if(_0x2e4c42[_0xb84d('0x2e')][_0xb84d('0x4c')]){_0x19c84b[_0xb84d('0x3a')]=_['merge'](_0x19c84b[_0xb84d('0x3a')],{'$or':_[_0xb84d('0x29')](_0x19c84b['attributes'],function(_0x56079b){var _0xcefaf9={};_0xcefaf9[_0x56079b]={'$like':'%'+_0x2e4c42[_0xb84d('0x2e')][_0xb84d('0x4c')]+'%'};return _0xcefaf9;})});}_0x19c84b=_[_0xb84d('0x3b')]({},_0x19c84b,_0x2e4c42[_0xb84d('0x3d')]);return _0x45b5df['getConfigurations'](_0x19c84b);}})[_0xb84d('0x23')](function(_0x34c60a){if(_0x34c60a){_0x5af199=_0x34c60a['length'];if(!_0x2e4c42[_0xb84d('0x2e')]['hasOwnProperty']('nolimit')){_0x19c84b[_0xb84d('0x1d')]=qs['limit'](_0x2e4c42[_0xb84d('0x2e')][_0xb84d('0x1d')]);_0x19c84b[_0xb84d('0x1b')]=qs['offset'](_0x2e4c42[_0xb84d('0x2e')][_0xb84d('0x1b')]);}return _0x45b5df[_0xb84d('0x4d')](_0x19c84b);}})[_0xb84d('0x23')](function(_0x536480){if(_0x536480){return _0x536480?{'count':_0x5af199,'rows':_0x536480}:null;}})[_0xb84d('0x23')](respondWithResult(_0x44e099,null))['catch'](handleError(_0x44e099,null));};exports['addConfiguration']=function(_0xdb26ec,_0x592c0e,_0x24528c){if(_0xdb26ec[_0xb84d('0x47')]['id']){delete _0xdb26ec[_0xb84d('0x47')]['id'];}return db[_0xb84d('0x2a')]['findOne']({'where':{'id':_0xdb26ec[_0xb84d('0x42')]['id']}})['then'](handleEntityNotFound(_0x592c0e,null))['then'](function(_0x4aee9a){if(_0x4aee9a){_0xdb26ec[_0xb84d('0x47')][_0xb84d('0x4e')]=_0x4aee9a['id'];_0xdb26ec[_0xb84d('0x47')][_0xb84d('0x4f')]=integrations[_0xb84d('0x50')](_0xdb26ec[_0xb84d('0x47')][_0xb84d('0x51')],_0xdb26ec[_0xb84d('0x47')][_0xb84d('0x3c')]);_0xdb26ec[_0xb84d('0x47')][_0xb84d('0x52')]=integrations['getDescriptions'](_0xdb26ec[_0xb84d('0x47')][_0xb84d('0x51')],_0xdb26ec['body'][_0xb84d('0x3c')]);return db[_0xb84d('0x4b')]['create'](_0xdb26ec[_0xb84d('0x47')],{'include':[{'model':db[_0xb84d('0x53')],'as':_0xb84d('0x4f')},{'model':db[_0xb84d('0x53')],'as':_0xb84d('0x52')}]});}return null;})[_0xb84d('0x23')](respondWithResult(_0x592c0e,null))[_0xb84d('0x45')](handleError(_0x592c0e,null));};function getAccessToken(_0x4a2f72){return new Promise(function(_0x38c5bd,_0x4f5da3){var _0x532801;switch(_0x4a2f72[_0xb84d('0x54')]){case'US':_0x532801=_0xb84d('0x55');break;case'AU':_0x532801=_0xb84d('0x56');break;case'EU':_0x532801=_0xb84d('0x57');break;case'IN':_0x532801=_0xb84d('0x58');break;case'CN':_0x532801='https://accounts.zoho.com.cn';break;default:_0x532801=_0xb84d('0x57');break;}var _0x11c08a={'method':_0xb84d('0x59'),'uri':_0x532801+_0xb84d('0x5a'),'qs':{'refresh_token':_0x4a2f72[_0xb84d('0x5b')],'client_id':_0x4a2f72[_0xb84d('0x5c')],'client_secret':_0x4a2f72[_0xb84d('0x5d')],'grant_type':_0xb84d('0x5e')},'json':!![]};return rp(_0x11c08a)[_0xb84d('0x23')](function(_0x3d7fb1){if(_0x3d7fb1[_0xb84d('0x5f')]){_0x38c5bd(_0x3d7fb1[_0xb84d('0x5f')]);}else{_0x4f5da3(_0xb84d('0x60'));}})['catch'](function(_0x73339c){_0x4f5da3(_0x73339c);});});}exports[_0xb84d('0x61')]=function(_0xd2a1fd,_0x1ed085,_0x1b7c17){var _0xf7db59,_0x437af8,_0x579e98,_0x2e2549,_0x5ca3e8;return db[_0xb84d('0x2a')]['findOne']({'where':{'id':_0xd2a1fd[_0xb84d('0x42')]['id']},'attributes':['id',_0xb84d('0x62'),_0xb84d('0x54'),_0xb84d('0x5c'),'clientSecret',_0xb84d('0x63'),'code',_0xb84d('0x5b')]})[_0xb84d('0x23')](handleEntityNotFound(_0x1ed085,null))['then'](function(_0x20248f){_0x5ca3e8=_0x20248f;_0xf7db59=_0x5ca3e8[_0xb84d('0x62')];_0x437af8=_0xf7db59===_0xb84d('0x64')?'eu':_0xb84d('0x65');_0x579e98=_0x5ca3e8[_0xb84d('0x63')];var _0x752430=_0x579e98['slice'](-0x1);if(_0x752430==='/'||_0x752430==='\x5c'||_0x752430===':'){_0x579e98=_0x579e98[_0xb84d('0x66')](0x0,_0x579e98['lastIndexOf'](_0x752430));}if(!_0x5ca3e8[_0xb84d('0x5b')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5ca3e8);})[_0xb84d('0x23')](function(_0x5d9262){if(_0x5d9262){return rp({'method':'GET','uri':util[_0xb84d('0x67')](_0xb84d('0x68'),_0x437af8),'qs':{'module':_0xb84d('0x69')},'headers':{'Authorization':_0xb84d('0x6a')+_0x5d9262},'json':!![]});}})[_0xb84d('0x23')](function(_0x281a85){if(_0x281a85){if(_0x281a85[_0xb84d('0x6b')]&&_0x281a85['response']['error']){throw new Error(_0x281a85[_0xb84d('0x6b')][_0xb84d('0x24')]['message']);}var _0xb6beab=[];var _0x346ae6=[];var _0x2e0018=['Owner',_0xb84d('0x6c'),_0xb84d('0x6d'),_0xb84d('0x6e'),'Call_Duration',_0xb84d('0x6f'),_0xb84d('0x70'),'Call_Type'];_0x346ae6=_['remove'](_0x281a85[_0xb84d('0x32')],function(_0xb6446d){return _0x2e0018[_0xb84d('0x71')](_0xb6446d[_0xb84d('0x72')]);});for(var _0x52bd26=0x0;_0x52bd26<_0x346ae6[_0xb84d('0x33')];_0x52bd26++){if(_0x346ae6[_0x52bd26]['system_mandatory']===![]){_0xb6beab['push']({'id':_0x346ae6[_0x52bd26]['id'],'name':_0x346ae6[_0x52bd26][_0xb84d('0x73')],'custom':_0x346ae6[_0x52bd26][_0xb84d('0x74')],'options':_0x346ae6[_0x52bd26][_0xb84d('0x75')]===_0xb84d('0x76')&&_0x346ae6[_0x52bd26][_0xb84d('0x77')][_0xb84d('0x33')]>-0x1?_[_0xb84d('0x29')](_0x346ae6[_0x52bd26][_0xb84d('0x77')],function(_0x47f8b9){return{'name':_0x47f8b9,'value':_0x47f8b9};}):[]});}}return{'count':_0xb6beab[_0xb84d('0x33')],'rows':_0xb6beab};}else{return{'count':0x0,'rows':[]};}})[_0xb84d('0x23')](respondWithResult(_0x1ed085,null))[_0xb84d('0x45')](function(_0xbca1d1){var _0x12b4c9=_0xd2a1fd['query']['test']?0x1f4:_0xbca1d1['statusCode']||0x1f4;logger[_0xb84d('0x24')](_0xb84d('0x78'),_0xb84d('0x61'),_0x12b4c9,JSON[_0xb84d('0x79')](_0xbca1d1));delete _0xbca1d1['name'];if(_0x12b4c9===0x191){_0x12b4c9=0x190;}_0x1ed085[_0xb84d('0x19')](_0x12b4c9)[_0xb84d('0x27')](_0xd2a1fd[_0xb84d('0x2e')][_0xb84d('0x7a')]?{'message':_0xb84d('0x7b'),'statusCode':_0xbca1d1[_0xb84d('0x7c')]}:_0xbca1d1);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 5d6a48c..a27b026 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 _0xf6c9=['info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','serverUrl','clientId','https://accounts.zoho.eu','inspect','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token'];(function(_0x534d28,_0x1d503d){var _0x27cf45=function(_0x2fb13f){while(--_0x2fb13f){_0x534d28['push'](_0x534d28['shift']());}};_0x27cf45(++_0x1d503d);}(_0xf6c9,0x8c));var _0x9f6c=function(_0x3fc177,_0x18eef2){_0x3fc177=_0x3fc177-0x0;var _0x5a3fb3=_0xf6c9[_0x3fc177];return _0x5a3fb3;};'use strict';var _=require(_0x9f6c('0x0'));var util=require(_0x9f6c('0x1'));var logger=require(_0x9f6c('0x2'))('api');var moment=require(_0x9f6c('0x3'));var BPromise=require(_0x9f6c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f6c('0x5'));var rimraf=require(_0x9f6c('0x6'));var config=require(_0x9f6c('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x9f6c('0x8'));module[_0x9f6c('0x9')]=function(_0x12dfb7,_0x2f468b){return _0x12dfb7[_0x9f6c('0xa')](_0x9f6c('0xb'),attributes,{'tableName':_0x9f6c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x179bf8,_0x2434be,_0x25e49c){if(_0x179bf8[_0x9f6c('0xd')](_0x9f6c('0xe'))||_0x179bf8[_0x9f6c('0xd')]('serverUrl')||_0x179bf8['changed']('clientId')||_0x179bf8['changed'](_0x9f6c('0xf'))||_0x179bf8[_0x9f6c('0xd')](_0x9f6c('0x10'))||_0x179bf8[_0x9f6c('0xd')](_0x9f6c('0x11'))){var _0x339713,_0x45581a;_0x339713=_0x179bf8['serverUrl'];var _0x352d0d=_0x339713[_0x9f6c('0x12')](-0x1);if(_0x352d0d==='/'||_0x352d0d==='\x5c'||_0x352d0d===':'){_0x339713=_0x339713[_0x9f6c('0x13')](0x0,_0x339713[_0x9f6c('0x14')](_0x352d0d));}switch(_0x179bf8['zone']){case'US':_0x45581a=_0x9f6c('0x15');break;case'AU':_0x45581a=_0x9f6c('0x16');break;case'IN':_0x45581a=_0x9f6c('0x17');break;case'CN':_0x45581a=_0x9f6c('0x18');break;default:_0x45581a='https://accounts.zoho.eu';break;}var _0xf59ec7={'method':_0x9f6c('0x19'),'uri':_0x45581a+_0x9f6c('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x179bf8['clientId'],'client_secret':_0x179bf8[_0x9f6c('0xf')],'redirect_uri':_0x179bf8['serverUrl'],'code':_0x179bf8['code']},'headers':{'Content-Type':_0x9f6c('0x1b')}};return rp(_0xf59ec7)[_0x9f6c('0x1c')](function(_0x183f89){var _0x54412d=JSON[_0x9f6c('0x1d')](_0x183f89);if(_0x54412d['refresh_token']){_0x179bf8[_0x9f6c('0x1e')]=_0x54412d[_0x9f6c('0x1f')];logger[_0x9f6c('0x20')](util[_0x9f6c('0x21')](_0x9f6c('0x22'),_0x179bf8[_0x9f6c('0x23')],_0x179bf8['id']));}else{logger[_0x9f6c('0x24')](util[_0x9f6c('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x179bf8[_0x9f6c('0x23')],_0x179bf8['id']),util['inspect'](_0x54412d,{'showHidden':![],'depth':null}));}return _0x25e49c(null,_0x2434be);})[_0x9f6c('0x25')](function(_0x4d902e){logger[_0x9f6c('0x24')](util[_0x9f6c('0x21')](_0x9f6c('0x26'),_0x179bf8[_0x9f6c('0x23')],_0x179bf8['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x25e49c(_0x4d902e);});}else{return _0x25e49c(null,_0x2434be);}},'beforeUpdate':function(_0x54a66f,_0x1252dc,_0x2c6179){if(_0x54a66f[_0x9f6c('0xd')]('zone')||_0x54a66f[_0x9f6c('0xd')](_0x9f6c('0x27'))||_0x54a66f[_0x9f6c('0xd')](_0x9f6c('0x28'))||_0x54a66f[_0x9f6c('0xd')](_0x9f6c('0xf'))||_0x54a66f[_0x9f6c('0xd')]('code')||_0x54a66f[_0x9f6c('0xd')](_0x9f6c('0x11'))){var _0x888f30,_0x4b02b0;_0x888f30=_0x54a66f[_0x9f6c('0x27')];var _0x1bed57=_0x888f30[_0x9f6c('0x12')](-0x1);if(_0x1bed57==='/'||_0x1bed57==='\x5c'||_0x1bed57===':'){_0x888f30=_0x888f30['substring'](0x0,_0x888f30[_0x9f6c('0x14')](_0x1bed57));}switch(_0x54a66f['zone']){case'US':_0x4b02b0=_0x9f6c('0x15');break;case'AU':_0x4b02b0=_0x9f6c('0x16');break;case'IN':_0x4b02b0=_0x9f6c('0x17');break;case'CN':_0x4b02b0=_0x9f6c('0x18');break;default:_0x4b02b0=_0x9f6c('0x29');break;}var _0x425d47={'method':'POST','uri':_0x4b02b0+_0x9f6c('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x54a66f[_0x9f6c('0x28')],'client_secret':_0x54a66f['clientSecret'],'redirect_uri':_0x54a66f[_0x9f6c('0x27')],'code':_0x54a66f['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x425d47)[_0x9f6c('0x1c')](function(_0x3d2545){var _0x1133b1=JSON[_0x9f6c('0x1d')](_0x3d2545);if(_0x1133b1[_0x9f6c('0x1f')]){_0x54a66f[_0x9f6c('0x1e')]=_0x1133b1[_0x9f6c('0x1f')];logger[_0x9f6c('0x20')](util[_0x9f6c('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x54a66f[_0x9f6c('0x23')],_0x54a66f['id']));}else{logger[_0x9f6c('0x24')](util['format'](_0x9f6c('0x26'),_0x54a66f[_0x9f6c('0x23')],_0x54a66f['id']),util[_0x9f6c('0x2a')](_0x1133b1,{'showHidden':![],'depth':null}));}return _0x2c6179(null,_0x1252dc);})[_0x9f6c('0x25')](function(_0x1e10d1){logger[_0x9f6c('0x24')](util['format'](_0x9f6c('0x26'),_0x54a66f[_0x9f6c('0x23')],_0x54a66f['id']),util[_0x9f6c('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x2c6179(_0x1e10d1);});}else{return _0x2c6179(null,_0x1252dc);}}}});}; \ No newline at end of file +var _0x758e=['https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','POST','then','inspect','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientSecret','code','host','slice','substring','lastIndexOf'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x758e,0xec));var _0xe758=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x758e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var logger=require(_0xe758('0x1'))(_0xe758('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe758('0x3'));var fs=require('fs');var path=require(_0xe758('0x4'));var rimraf=require(_0xe758('0x5'));var config=require(_0xe758('0x6'));var attributes=require(_0xe758('0x7'));var integrations=require(_0xe758('0x8'));module[_0xe758('0x9')]=function(_0x24c237,_0x45f39b){return _0x24c237[_0xe758('0xa')](_0xe758('0xb'),attributes,{'tableName':_0xe758('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1daf89,_0x2386e8,_0x70b626){if(_0x1daf89['changed'](_0xe758('0xd'))||_0x1daf89[_0xe758('0xe')](_0xe758('0xf'))||_0x1daf89[_0xe758('0xe')]('clientId')||_0x1daf89[_0xe758('0xe')](_0xe758('0x10'))||_0x1daf89[_0xe758('0xe')](_0xe758('0x11'))||_0x1daf89[_0xe758('0xe')](_0xe758('0x12'))){var _0x4a26f4,_0x55b6a8;_0x4a26f4=_0x1daf89['serverUrl'];var _0x490e78=_0x4a26f4[_0xe758('0x13')](-0x1);if(_0x490e78==='/'||_0x490e78==='\x5c'||_0x490e78===':'){_0x4a26f4=_0x4a26f4[_0xe758('0x14')](0x0,_0x4a26f4[_0xe758('0x15')](_0x490e78));}switch(_0x1daf89['zone']){case'US':_0x55b6a8=_0xe758('0x16');break;case'AU':_0x55b6a8=_0xe758('0x17');break;case'IN':_0x55b6a8=_0xe758('0x18');break;case'CN':_0x55b6a8=_0xe758('0x19');break;default:_0x55b6a8=_0xe758('0x1a');break;}var _0x159a0e={'method':'POST','uri':_0x55b6a8+_0xe758('0x1b'),'form':{'grant_type':_0xe758('0x1c'),'client_id':_0x1daf89[_0xe758('0x1d')],'client_secret':_0x1daf89['clientSecret'],'redirect_uri':_0x1daf89['serverUrl'],'code':_0x1daf89[_0xe758('0x11')]},'headers':{'Content-Type':_0xe758('0x1e')}};return rp(_0x159a0e)['then'](function(_0x4eb42d){var _0x85c4c=JSON[_0xe758('0x1f')](_0x4eb42d);if(_0x85c4c[_0xe758('0x20')]){_0x1daf89[_0xe758('0x21')]=_0x85c4c[_0xe758('0x20')];logger['info'](util[_0xe758('0x22')](_0xe758('0x23'),_0x1daf89[_0xe758('0x24')],_0x1daf89['id']));}else{logger['error'](util[_0xe758('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1daf89['name'],_0x1daf89['id']),util['inspect'](_0x85c4c,{'showHidden':![],'depth':null}));}return _0x70b626(null,_0x2386e8);})[_0xe758('0x25')](function(_0x545360){logger[_0xe758('0x26')](util['format'](_0xe758('0x27'),_0x1daf89['name'],_0x1daf89['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x70b626(_0x545360);});}else{return _0x70b626(null,_0x2386e8);}},'beforeUpdate':function(_0x26482a,_0x1db698,_0x253a86){if(_0x26482a['changed']('zone')||_0x26482a[_0xe758('0xe')](_0xe758('0xf'))||_0x26482a[_0xe758('0xe')](_0xe758('0x1d'))||_0x26482a[_0xe758('0xe')](_0xe758('0x10'))||_0x26482a[_0xe758('0xe')](_0xe758('0x11'))||_0x26482a[_0xe758('0xe')](_0xe758('0x12'))){var _0x53e0d8,_0x34b67f;_0x53e0d8=_0x26482a['serverUrl'];var _0x1c65ee=_0x53e0d8[_0xe758('0x13')](-0x1);if(_0x1c65ee==='/'||_0x1c65ee==='\x5c'||_0x1c65ee===':'){_0x53e0d8=_0x53e0d8[_0xe758('0x14')](0x0,_0x53e0d8[_0xe758('0x15')](_0x1c65ee));}switch(_0x26482a['zone']){case'US':_0x34b67f=_0xe758('0x16');break;case'AU':_0x34b67f=_0xe758('0x17');break;case'IN':_0x34b67f=_0xe758('0x18');break;case'CN':_0x34b67f=_0xe758('0x19');break;default:_0x34b67f=_0xe758('0x1a');break;}var _0x3e6ae4={'method':_0xe758('0x28'),'uri':_0x34b67f+_0xe758('0x1b'),'form':{'grant_type':_0xe758('0x1c'),'client_id':_0x26482a[_0xe758('0x1d')],'client_secret':_0x26482a[_0xe758('0x10')],'redirect_uri':_0x26482a[_0xe758('0xf')],'code':_0x26482a[_0xe758('0x11')]},'headers':{'Content-Type':_0xe758('0x1e')}};return rp(_0x3e6ae4)[_0xe758('0x29')](function(_0x5e3bc4){var _0x32bde1=JSON[_0xe758('0x1f')](_0x5e3bc4);if(_0x32bde1[_0xe758('0x20')]){_0x26482a[_0xe758('0x21')]=_0x32bde1[_0xe758('0x20')];logger['info'](util[_0xe758('0x22')](_0xe758('0x23'),_0x26482a[_0xe758('0x24')],_0x26482a['id']));}else{logger['error'](util[_0xe758('0x22')](_0xe758('0x27'),_0x26482a[_0xe758('0x24')],_0x26482a['id']),util[_0xe758('0x2a')](_0x32bde1,{'showHidden':![],'depth':null}));}return _0x253a86(null,_0x1db698);})['catch'](function(_0x5ed756){logger[_0xe758('0x26')](util[_0xe758('0x22')](_0xe758('0x27'),_0x26482a[_0xe758('0x24')],_0x26482a['id']),util[_0xe758('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x253a86(_0x5ed756);});}else{return _0x253a86(null,_0x1db698);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index aab7fc4..e7d1906 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 _0x9db7=['ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0xdf7753,_0x46dbbd){var _0x2fc0ac=function(_0xfe5509){while(--_0xfe5509){_0xdf7753['push'](_0xdf7753['shift']());}};_0x2fc0ac(++_0x46dbbd);}(_0x9db7,0x1bf));var _0x79db=function(_0x557a4f,_0x4e3531){_0x557a4f=_0x557a4f-0x0;var _0x26afc6=_0x9db7[_0x557a4f];return _0x26afc6;};'use strict';var _=require(_0x79db('0x0'));var util=require(_0x79db('0x1'));var moment=require(_0x79db('0x2'));var BPromise=require(_0x79db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x79db('0x5'));var logger=require(_0x79db('0x6'))('rpc');var config=require(_0x79db('0x7'));var jayson=require(_0x79db('0x8'));var client=jayson[_0x79db('0x9')][_0x79db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7980b1,_0x395883,_0x214bf9){return new BPromise(function(_0x792510,_0x27d02a){return client[_0x79db('0xb')](_0x7980b1,_0x214bf9)[_0x79db('0xc')](function(_0x145a31){logger['info'](_0x79db('0xd'),_0x395883,_0x79db('0xe'));logger[_0x79db('0xf')](_0x79db('0x10'),_0x395883,_0x79db('0xe'),JSON[_0x79db('0x11')](_0x145a31));if(_0x145a31[_0x79db('0x12')]){if(_0x145a31[_0x79db('0x12')][_0x79db('0x13')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x395883,_0x145a31['error'][_0x79db('0x14')]);return _0x27d02a(_0x145a31['error'][_0x79db('0x14')]);}logger['error'](_0x79db('0xd'),_0x395883,_0x145a31[_0x79db('0x12')][_0x79db('0x14')]);return _0x792510(_0x145a31[_0x79db('0x12')][_0x79db('0x14')]);}else{logger[_0x79db('0x15')](_0x79db('0xd'),_0x395883,_0x79db('0xe'));_0x792510(_0x145a31[_0x79db('0x16')][_0x79db('0x14')]);}})[_0x79db('0x17')](function(_0x365889){logger[_0x79db('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x395883,_0x365889);_0x27d02a(_0x365889);});});}exports[_0x79db('0x18')]=function(_0x43912f){var _0x200c87=this;return new Promise(function(_0x77f6d0,_0x2532d4){return db['ZohoAccount'][_0x79db('0x19')]({'raw':_0x43912f[_0x79db('0x1a')]?_0x43912f['options'][_0x79db('0x1b')]===undefined?!![]:![]:!![],'where':_0x43912f[_0x79db('0x1a')]?_0x43912f['options'][_0x79db('0x1c')]||null:null,'attributes':_0x43912f[_0x79db('0x1a')]?_0x43912f[_0x79db('0x1a')][_0x79db('0x1d')]||null:null,'limit':_0x43912f[_0x79db('0x1a')]?_0x43912f[_0x79db('0x1a')][_0x79db('0x1e')]||null:null,'include':_0x43912f[_0x79db('0x1a')]?_0x43912f[_0x79db('0x1a')][_0x79db('0x1f')]?_[_0x79db('0x20')](_0x43912f[_0x79db('0x1a')][_0x79db('0x1f')],function(_0x25a360){return{'model':db[_0x25a360[_0x79db('0x21')]],'as':_0x25a360['as'],'attributes':_0x25a360['attributes'],'include':_0x25a360[_0x79db('0x1f')]?_[_0x79db('0x20')](_0x25a360['include'],function(_0x4dfa54){return{'model':db[_0x4dfa54[_0x79db('0x21')]],'as':_0x4dfa54['as'],'attributes':_0x4dfa54[_0x79db('0x1d')],'include':_0x4dfa54[_0x79db('0x1f')]?_[_0x79db('0x20')](_0x4dfa54[_0x79db('0x1f')],function(_0x3def02){return{'model':db[_0x3def02[_0x79db('0x21')]],'as':_0x3def02['as'],'attributes':_0x3def02[_0x79db('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x79db('0xc')](function(_0x4a6bb2){logger[_0x79db('0x15')]('GetZohoAccount',_0x43912f);logger[_0x79db('0xf')]('GetZohoAccount',_0x43912f,JSON['stringify'](_0x4a6bb2));_0x77f6d0(_0x4a6bb2);})[_0x79db('0x17')](function(_0x45bd26){logger['error'](_0x79db('0x18'),_0x45bd26[_0x79db('0x14')],_0x43912f);_0x2532d4(_0x200c87[_0x79db('0x12')](0x1f4,_0x45bd26['message']));});});};exports[_0x79db('0x22')]=function(_0x92a11){var _0x5e6778=this;return new Promise(function(_0x835267,_0x2da725){return db[_0x79db('0x23')][_0x79db('0x24')]({'raw':_0x92a11['options']?_0x92a11[_0x79db('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x92a11[_0x79db('0x1a')]?_0x92a11['options'][_0x79db('0x1c')]||null:null,'attributes':_0x92a11[_0x79db('0x1a')]?_0x92a11['options'][_0x79db('0x1d')]||null:null,'include':_0x92a11[_0x79db('0x1a')]?_0x92a11[_0x79db('0x1a')][_0x79db('0x1f')]?_[_0x79db('0x20')](_0x92a11[_0x79db('0x1a')][_0x79db('0x1f')],function(_0x8ddc7d){return{'model':db[_0x8ddc7d['model']],'as':_0x8ddc7d['as'],'attributes':_0x8ddc7d[_0x79db('0x1d')],'include':_0x8ddc7d['include']?_['map'](_0x8ddc7d[_0x79db('0x1f')],function(_0x40f54b){return{'model':db[_0x40f54b[_0x79db('0x21')]],'as':_0x40f54b['as'],'attributes':_0x40f54b[_0x79db('0x1d')],'include':_0x40f54b[_0x79db('0x1f')]?_[_0x79db('0x20')](_0x40f54b['include'],function(_0x572fb8){return{'model':db[_0x572fb8[_0x79db('0x21')]],'as':_0x572fb8['as'],'attributes':_0x572fb8[_0x79db('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x79db('0xc')](function(_0x55cf56){logger[_0x79db('0x15')]('ShowZohoAccount',_0x92a11);logger[_0x79db('0xf')](_0x79db('0x22'),_0x92a11,JSON[_0x79db('0x11')](_0x55cf56));_0x835267(_0x55cf56);})[_0x79db('0x17')](function(_0x26ce8a){logger[_0x79db('0x12')](_0x79db('0x22'),_0x26ce8a[_0x79db('0x14')],_0x92a11);_0x2da725(_0x5e6778[_0x79db('0x12')](0x1f4,_0x26ce8a[_0x79db('0x14')]));});});}; \ No newline at end of file +var _0x6ab9=['request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','model','map','catch','ShowZohoAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x6ab9,0x19a));var _0x96ab=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x6ab9[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x96ab('0x0'));var util=require(_0x96ab('0x1'));var moment=require('moment');var BPromise=require(_0x96ab('0x2'));var rs=require(_0x96ab('0x3'));var fs=require('fs');var Redis=require(_0x96ab('0x4'));var db=require(_0x96ab('0x5'))['db'];var utils=require(_0x96ab('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x96ab('0x7'));var jayson=require(_0x96ab('0x8'));var client=jayson[_0x96ab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2a35,_0xf8e2b1,_0x516cf7){return new BPromise(function(_0x313efb,_0x1e3f17){return client[_0x96ab('0xa')](_0x3d2a35,_0x516cf7)[_0x96ab('0xb')](function(_0x39b50e){logger[_0x96ab('0xc')](_0x96ab('0xd'),_0xf8e2b1,_0x96ab('0xe'));logger[_0x96ab('0xf')](_0x96ab('0x10'),_0xf8e2b1,_0x96ab('0xe'),JSON[_0x96ab('0x11')](_0x39b50e));if(_0x39b50e[_0x96ab('0x12')]){if(_0x39b50e['error'][_0x96ab('0x13')]===0x1f4){logger['error'](_0x96ab('0xd'),_0xf8e2b1,_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);return _0x1e3f17(_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);}logger[_0x96ab('0x12')](_0x96ab('0xd'),_0xf8e2b1,_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);return _0x313efb(_0x39b50e[_0x96ab('0x12')][_0x96ab('0x14')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0xf8e2b1,_0x96ab('0xe'));_0x313efb(_0x39b50e[_0x96ab('0x15')][_0x96ab('0x14')]);}})['catch'](function(_0x43e35e){logger[_0x96ab('0x12')]('ZohoAccount,\x20%s,\x20%s',_0xf8e2b1,_0x43e35e);_0x1e3f17(_0x43e35e);});});}exports[_0x96ab('0x16')]=function(_0x4eca78){var _0x231ed5=this;return new Promise(function(_0x1a502a,_0x397ffc){return db[_0x96ab('0x17')][_0x96ab('0x18')]({'raw':_0x4eca78[_0x96ab('0x19')]?_0x4eca78[_0x96ab('0x19')][_0x96ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x4eca78[_0x96ab('0x19')]?_0x4eca78[_0x96ab('0x19')][_0x96ab('0x1b')]||null:null,'attributes':_0x4eca78['options']?_0x4eca78['options'][_0x96ab('0x1c')]||null:null,'limit':_0x4eca78[_0x96ab('0x19')]?_0x4eca78[_0x96ab('0x19')]['limit']||null:null,'include':_0x4eca78[_0x96ab('0x19')]?_0x4eca78['options'][_0x96ab('0x1d')]?_['map'](_0x4eca78[_0x96ab('0x19')][_0x96ab('0x1d')],function(_0x5a02d0){return{'model':db[_0x5a02d0[_0x96ab('0x1e')]],'as':_0x5a02d0['as'],'attributes':_0x5a02d0[_0x96ab('0x1c')],'include':_0x5a02d0[_0x96ab('0x1d')]?_[_0x96ab('0x1f')](_0x5a02d0[_0x96ab('0x1d')],function(_0x27d6d5){return{'model':db[_0x27d6d5[_0x96ab('0x1e')]],'as':_0x27d6d5['as'],'attributes':_0x27d6d5[_0x96ab('0x1c')],'include':_0x27d6d5[_0x96ab('0x1d')]?_['map'](_0x27d6d5[_0x96ab('0x1d')],function(_0x524e1c){return{'model':db[_0x524e1c[_0x96ab('0x1e')]],'as':_0x524e1c['as'],'attributes':_0x524e1c[_0x96ab('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x96ab('0xb')](function(_0x240553){logger[_0x96ab('0xc')](_0x96ab('0x16'),_0x4eca78);logger[_0x96ab('0xf')](_0x96ab('0x16'),_0x4eca78,JSON['stringify'](_0x240553));_0x1a502a(_0x240553);})[_0x96ab('0x20')](function(_0x269c51){logger[_0x96ab('0x12')]('GetZohoAccount',_0x269c51[_0x96ab('0x14')],_0x4eca78);_0x397ffc(_0x231ed5[_0x96ab('0x12')](0x1f4,_0x269c51[_0x96ab('0x14')]));});});};exports[_0x96ab('0x21')]=function(_0xaccba6){var _0x4c9a55=this;return new Promise(function(_0x40a55b,_0x44529b){return db['ZohoAccount'][_0x96ab('0x22')]({'raw':_0xaccba6['options']?_0xaccba6['options']['raw']===undefined?!![]:![]:!![],'where':_0xaccba6['options']?_0xaccba6[_0x96ab('0x19')]['where']||null:null,'attributes':_0xaccba6[_0x96ab('0x19')]?_0xaccba6[_0x96ab('0x19')][_0x96ab('0x1c')]||null:null,'include':_0xaccba6[_0x96ab('0x19')]?_0xaccba6[_0x96ab('0x19')]['include']?_['map'](_0xaccba6[_0x96ab('0x19')][_0x96ab('0x1d')],function(_0x56e3e2){return{'model':db[_0x56e3e2[_0x96ab('0x1e')]],'as':_0x56e3e2['as'],'attributes':_0x56e3e2[_0x96ab('0x1c')],'include':_0x56e3e2['include']?_['map'](_0x56e3e2[_0x96ab('0x1d')],function(_0x39f56d){return{'model':db[_0x39f56d[_0x96ab('0x1e')]],'as':_0x39f56d['as'],'attributes':_0x39f56d[_0x96ab('0x1c')],'include':_0x39f56d['include']?_[_0x96ab('0x1f')](_0x39f56d['include'],function(_0x5e9020){return{'model':db[_0x5e9020[_0x96ab('0x1e')]],'as':_0x5e9020['as'],'attributes':_0x5e9020['attributes']};}):[]};}):[]};}):[]:[]})[_0x96ab('0xb')](function(_0xd3ec3b){logger[_0x96ab('0xc')](_0x96ab('0x21'),_0xaccba6);logger['debug'](_0x96ab('0x21'),_0xaccba6,JSON[_0x96ab('0x11')](_0xd3ec3b));_0x40a55b(_0xd3ec3b);})[_0x96ab('0x20')](function(_0x376775){logger[_0x96ab('0x12')]('ShowZohoAccount',_0x376775[_0x96ab('0x14')],_0xaccba6);_0x44529b(_0x4c9a55['error'](0x1f4,_0x376775[_0x96ab('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index e461685..d7d115d 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 _0x87bc=['/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index'];(function(_0x3477e8,_0x25840d){var _0x5b9594=function(_0x2e112c){while(--_0x2e112c){_0x3477e8['push'](_0x3477e8['shift']());}};_0x5b9594(++_0x25840d);}(_0x87bc,0x1d7));var _0xc87b=function(_0x27cec2,_0x1e4df8){_0x27cec2=_0x27cec2-0x0;var _0x43e695=_0x87bc[_0x27cec2];return _0x43e695;};'use strict';var multer=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var path=require('path');var timeout=require(_0xc87b('0x2'));var express=require(_0xc87b('0x3'));var router=express[_0xc87b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc87b('0x5'));var interaction=require(_0xc87b('0x6'));var config=require(_0xc87b('0x7'));var controller=require(_0xc87b('0x8'));router[_0xc87b('0x9')]('/',auth[_0xc87b('0xa')](),controller[_0xc87b('0xb')]);router['get'](_0xc87b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc87b('0x9')]('/:id/fields',auth[_0xc87b('0xa')](),controller[_0xc87b('0xd')]);router[_0xc87b('0x9')](_0xc87b('0xe'),auth[_0xc87b('0xa')](),controller[_0xc87b('0xf')]);router[_0xc87b('0x9')](_0xc87b('0x10'),auth[_0xc87b('0xa')](),controller['getDescriptions']);router[_0xc87b('0x11')]('/',auth[_0xc87b('0xa')](),controller['create']);router[_0xc87b('0x12')](_0xc87b('0xc'),auth[_0xc87b('0xa')](),controller[_0xc87b('0x13')]);router[_0xc87b('0x14')](_0xc87b('0xc'),auth[_0xc87b('0xa')](),controller[_0xc87b('0x15')]);module[_0xc87b('0x16')]=router; \ No newline at end of file +var _0x0c42=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x0c42,0x105));var _0x20c4=function(_0x510b33,_0x58ec20){_0x510b33=_0x510b33-0x0;var _0x5a6a89=_0x0c42[_0x510b33];return _0x5a6a89;};'use strict';var multer=require(_0x20c4('0x0'));var util=require(_0x20c4('0x1'));var path=require(_0x20c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x20c4('0x3'));var router=express[_0x20c4('0x4')]();var fs_extra=require(_0x20c4('0x5'));var auth=require(_0x20c4('0x6'));var interaction=require(_0x20c4('0x7'));var config=require(_0x20c4('0x8'));var controller=require(_0x20c4('0x9'));router[_0x20c4('0xa')]('/',auth[_0x20c4('0xb')](),controller[_0x20c4('0xc')]);router['get'](_0x20c4('0xd'),auth[_0x20c4('0xb')](),controller[_0x20c4('0xe')]);router[_0x20c4('0xa')]('/:id/fields',auth[_0x20c4('0xb')](),controller[_0x20c4('0xf')]);router[_0x20c4('0xa')](_0x20c4('0x10'),auth[_0x20c4('0xb')](),controller[_0x20c4('0x11')]);router['get'](_0x20c4('0x12'),auth[_0x20c4('0xb')](),controller[_0x20c4('0x13')]);router['post']('/',auth[_0x20c4('0xb')](),controller['create']);router[_0x20c4('0x14')](_0x20c4('0xd'),auth[_0x20c4('0xb')](),controller[_0x20c4('0x15')]);router[_0x20c4('0x16')](_0x20c4('0xd'),auth[_0x20c4('0xb')](),controller[_0x20c4('0x17')]);module[_0x20c4('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 5de9ab5..881a70c 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 _0x68f3=['contact','contact_lead','sequelize','STRING','ENUM','lead'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x68f3,0x7a));var _0x368f=function(_0x5edeab,_0x257283){_0x5edeab=_0x5edeab-0x0;var _0x132c3d=_0x68f3[_0x5edeab];return _0x132c3d;};'use strict';var Sequelize=require(_0x368f('0x0'));module['exports']={'name':{'type':Sequelize[_0x368f('0x1')]},'moduleCreate':{'type':Sequelize[_0x368f('0x2')](_0x368f('0x3'),_0x368f('0x4'),'nothing'),'defaultValue':_0x368f('0x3')},'moduleSearch':{'type':Sequelize[_0x368f('0x2')](_0x368f('0x5'),_0x368f('0x4'),_0x368f('0x3')),'defaultValue':_0x368f('0x5')},'description':{'type':Sequelize[_0x368f('0x1')]}}; \ No newline at end of file +var _0x58f0=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x1234da,_0x22abc8){var _0x30308d=function(_0xcb4883){while(--_0xcb4883){_0x1234da['push'](_0x1234da['shift']());}};_0x30308d(++_0x22abc8);}(_0x58f0,0x1a6));var _0x058f=function(_0x411223,_0x960fb4){_0x411223=_0x411223-0x0;var _0x3beed8=_0x58f0[_0x411223];return _0x3beed8;};'use strict';var Sequelize=require(_0x058f('0x0'));module[_0x058f('0x1')]={'name':{'type':Sequelize[_0x058f('0x2')]},'moduleCreate':{'type':Sequelize[_0x058f('0x3')](_0x058f('0x4'),_0x058f('0x5'),_0x058f('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x058f('0x3')]('contact_lead',_0x058f('0x5'),_0x058f('0x4')),'defaultValue':_0x058f('0x7')},'description':{'type':Sequelize[_0x058f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index defec7e..2e46de7 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 _0x6e92=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','ZohoConfiguration','rows','catch','show','params','intersection','include','options','find','create','body','getFields','order','pick','getSubjects','findOne','ZohoField','nolimit','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x526cbe,_0x5cf7c9){var _0x180405=function(_0x2e7db0){while(--_0x2e7db0){_0x526cbe['push'](_0x526cbe['shift']());}};_0x180405(++_0x5cf7c9);}(_0x6e92,0xd9));var _0x26e9=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x6e92[_0x1a89ca];return _0x29cbb2;};'use strict';var emlformat=require(_0x26e9('0x0'));var rimraf=require(_0x26e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26e9('0x2'));var rp=require(_0x26e9('0x3'));var moment=require(_0x26e9('0x4'));var BPromise=require(_0x26e9('0x5'));var Mustache=require(_0x26e9('0x6'));var util=require(_0x26e9('0x7'));var path=require(_0x26e9('0x8'));var sox=require('sox');var csv=require(_0x26e9('0x9'));var ejs=require(_0x26e9('0xa'));var fs=require('fs');var fs_extra=require(_0x26e9('0xb'));var _=require(_0x26e9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x26e9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x26e9('0x9'));var querystring=require(_0x26e9('0xe'));var Papa=require(_0x26e9('0xf'));var Redis=require(_0x26e9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x26e9('0x11'));var as=require(_0x26e9('0x12'));var hardwareService=require(_0x26e9('0x13'));var logger=require(_0x26e9('0x14'))(_0x26e9('0x15'));var utils=require(_0x26e9('0x16'));var config=require(_0x26e9('0x17'));var licenseUtil=require(_0x26e9('0x18'));var db=require(_0x26e9('0x19'))['db'];function respondWithStatusCode(_0x1c184b,_0x2cd7cf){_0x2cd7cf=_0x2cd7cf||0xcc;return function(_0x25af57){if(_0x25af57){return _0x1c184b[_0x26e9('0x1a')](_0x2cd7cf);}return _0x1c184b[_0x26e9('0x1b')](_0x2cd7cf)[_0x26e9('0x1c')]();};}function respondWithResult(_0x9f309d,_0x5068d1){_0x5068d1=_0x5068d1||0xc8;return function(_0x1623d3){if(_0x1623d3){return _0x9f309d['status'](_0x5068d1)[_0x26e9('0x1d')](_0x1623d3);}};}function respondWithFilteredResult(_0x44fb12,_0x3dd44b){return function(_0xf058ec){if(_0xf058ec){var _0x3e1ce8=typeof _0x3dd44b[_0x26e9('0x1e')]===_0x26e9('0x1f')&&typeof _0x3dd44b[_0x26e9('0x20')]==='undefined';var _0x904a49=_0xf058ec[_0x26e9('0x21')];var _0x5ad030=_0x3e1ce8?0x0:_0x3dd44b['offset'];var _0x3c0717=_0x3e1ce8?_0xf058ec[_0x26e9('0x21')]:_0x3dd44b['offset']+_0x3dd44b['limit'];var _0x4a36c7;if(_0x3c0717>=_0x904a49){_0x3c0717=_0x904a49;_0x4a36c7=0xc8;}else{_0x4a36c7=0xce;}_0x44fb12[_0x26e9('0x1b')](_0x4a36c7);return _0x44fb12[_0x26e9('0x22')](_0x26e9('0x23'),_0x5ad030+'-'+_0x3c0717+'/'+_0x904a49)[_0x26e9('0x1d')](_0xf058ec);}return null;};}function patchUpdates(_0x46d0b9){return function(_0x27f4d3){try{jsonpatch[_0x26e9('0x24')](_0x27f4d3,_0x46d0b9,!![]);}catch(_0xe45d59){return BPromise[_0x26e9('0x25')](_0xe45d59);}return _0x27f4d3[_0x26e9('0x26')]();};}function saveUpdates(_0x328eb8,_0x3575d2){return function(_0x802351){if(_0x802351){return _0x802351[_0x26e9('0x27')](_0x328eb8)[_0x26e9('0x28')](function(_0x5c5c0d){return _0x5c5c0d;});}return null;};}function removeEntity(_0x37d02d,_0x209873){return function(_0x3c9eae){if(_0x3c9eae){return _0x3c9eae[_0x26e9('0x29')]()['then'](function(){_0x37d02d[_0x26e9('0x1b')](0xcc)[_0x26e9('0x1c')]();});}};}function handleEntityNotFound(_0x171eb9,_0x5e4c76){return function(_0x3b77aa){if(!_0x3b77aa){_0x171eb9[_0x26e9('0x1a')](0x194);}return _0x3b77aa;};}function handleError(_0x3d76b3,_0x46ddac){_0x46ddac=_0x46ddac||0x1f4;return function(_0x16a0ca){logger['error'](_0x16a0ca[_0x26e9('0x2a')]);if(_0x16a0ca[_0x26e9('0x2b')]){delete _0x16a0ca['name'];}_0x3d76b3['status'](_0x46ddac)['send'](_0x16a0ca);};}exports[_0x26e9('0x2c')]=function(_0x18e99e,_0x5b4f0e){var _0x401ffa={},_0x4b26f0={},_0x491cf8={'count':0x0,'rows':[]};var _0x3b7265=_['map'](db['ZohoConfiguration'][_0x26e9('0x2d')],function(_0x14d632){return{'name':_0x14d632[_0x26e9('0x2e')],'type':_0x14d632[_0x26e9('0x2f')][_0x26e9('0x30')]};});_0x4b26f0[_0x26e9('0x31')]=_[_0x26e9('0x32')](_0x3b7265,_0x26e9('0x2b'));_0x4b26f0[_0x26e9('0x33')]=_[_0x26e9('0x34')](_0x18e99e['query']);_0x4b26f0[_0x26e9('0x35')]=_['intersection'](_0x4b26f0[_0x26e9('0x31')],_0x4b26f0['query']);_0x401ffa['attributes']=_['intersection'](_0x4b26f0[_0x26e9('0x31')],qs[_0x26e9('0x36')](_0x18e99e[_0x26e9('0x33')][_0x26e9('0x36')]));_0x401ffa['attributes']=_0x401ffa[_0x26e9('0x37')][_0x26e9('0x38')]?_0x401ffa[_0x26e9('0x37')]:_0x4b26f0[_0x26e9('0x31')];if(!_0x18e99e[_0x26e9('0x33')][_0x26e9('0x39')]('nolimit')){_0x401ffa[_0x26e9('0x20')]=qs['limit'](_0x18e99e['query'][_0x26e9('0x20')]);_0x401ffa[_0x26e9('0x1e')]=qs['offset'](_0x18e99e[_0x26e9('0x33')]['offset']);}_0x401ffa['order']=qs[_0x26e9('0x3a')](_0x18e99e['query'][_0x26e9('0x3a')]);_0x401ffa['where']=qs['filters'](_['pick'](_0x18e99e[_0x26e9('0x33')],_0x4b26f0[_0x26e9('0x35')]),_0x3b7265);if(_0x18e99e['query'][_0x26e9('0x3b')]){_0x401ffa[_0x26e9('0x3c')]=_[_0x26e9('0x3d')](_0x401ffa[_0x26e9('0x3c')],{'$or':_['map'](_0x3b7265,function(_0x2815d1){if(_0x2815d1['type']!==_0x26e9('0x3e')){var _0x1737e1={};_0x1737e1[_0x2815d1[_0x26e9('0x2b')]]={'$like':'%'+_0x18e99e[_0x26e9('0x33')][_0x26e9('0x3b')]+'%'};return _0x1737e1;}})});}_0x401ffa=_[_0x26e9('0x3d')]({},_0x401ffa,_0x18e99e['options']);var _0x2b3fba={'where':_0x401ffa[_0x26e9('0x3c')]};return db['ZohoConfiguration'][_0x26e9('0x21')](_0x2b3fba)[_0x26e9('0x28')](function(_0x46d0cf){_0x491cf8['count']=_0x46d0cf;if(_0x18e99e['query'][_0x26e9('0x3f')]){_0x401ffa['include']=[{'all':!![]}];}return db[_0x26e9('0x40')]['findAll'](_0x401ffa);})['then'](function(_0xb0f3a9){_0x491cf8[_0x26e9('0x41')]=_0xb0f3a9;return _0x491cf8;})[_0x26e9('0x28')](respondWithFilteredResult(_0x5b4f0e,_0x401ffa))[_0x26e9('0x42')](handleError(_0x5b4f0e,null));};exports[_0x26e9('0x43')]=function(_0x49bd96,_0x23d7f8){var _0x2a1beb={'raw':![],'where':{'id':_0x49bd96[_0x26e9('0x44')]['id']}},_0x3cda6a={};_0x3cda6a[_0x26e9('0x31')]=_[_0x26e9('0x34')](db['ZohoConfiguration'][_0x26e9('0x2d')]);_0x3cda6a[_0x26e9('0x33')]=_['keys'](_0x49bd96[_0x26e9('0x33')]);_0x3cda6a[_0x26e9('0x35')]=_[_0x26e9('0x45')](_0x3cda6a[_0x26e9('0x31')],_0x3cda6a[_0x26e9('0x33')]);_0x2a1beb[_0x26e9('0x37')]=_[_0x26e9('0x45')](_0x3cda6a[_0x26e9('0x31')],qs[_0x26e9('0x36')](_0x49bd96[_0x26e9('0x33')]['fields']));_0x2a1beb['attributes']=_0x2a1beb[_0x26e9('0x37')][_0x26e9('0x38')]?_0x2a1beb[_0x26e9('0x37')]:_0x3cda6a[_0x26e9('0x31')];if(_0x49bd96['query'][_0x26e9('0x3f')]){_0x2a1beb[_0x26e9('0x46')]=[{'all':!![]}];}_0x2a1beb=_[_0x26e9('0x3d')]({},_0x2a1beb,_0x49bd96[_0x26e9('0x47')]);return db['ZohoConfiguration'][_0x26e9('0x48')](_0x2a1beb)['then'](handleEntityNotFound(_0x23d7f8,null))['then'](respondWithResult(_0x23d7f8,null))[_0x26e9('0x42')](handleError(_0x23d7f8,null));};exports[_0x26e9('0x49')]=function(_0x975454,_0x3fc7d1){return db[_0x26e9('0x40')][_0x26e9('0x49')](_0x975454[_0x26e9('0x4a')],{})[_0x26e9('0x28')](respondWithResult(_0x3fc7d1,0xc9))[_0x26e9('0x42')](handleError(_0x3fc7d1,null));};exports[_0x26e9('0x27')]=function(_0x412c46,_0x50ca87){if(_0x412c46['body']['id']){delete _0x412c46['body']['id'];}return db[_0x26e9('0x40')][_0x26e9('0x48')]({'where':{'id':_0x412c46['params']['id']}})['then'](handleEntityNotFound(_0x50ca87,null))[_0x26e9('0x28')](saveUpdates(_0x412c46[_0x26e9('0x4a')],null))[_0x26e9('0x28')](respondWithResult(_0x50ca87,null))[_0x26e9('0x42')](handleError(_0x50ca87,null));};exports[_0x26e9('0x29')]=function(_0x1e6f7b,_0x49cd90){return db[_0x26e9('0x40')]['find']({'where':{'id':_0x1e6f7b[_0x26e9('0x44')]['id']}})[_0x26e9('0x28')](handleEntityNotFound(_0x49cd90,null))[_0x26e9('0x28')](removeEntity(_0x49cd90,null))[_0x26e9('0x42')](handleError(_0x49cd90,null));};exports[_0x26e9('0x4b')]=function(_0x4faaa7,_0x57422b,_0x28ab1a){var _0x1b6237={};var _0x142299={};var _0x1892d4;var _0x3b7059;return db[_0x26e9('0x40')]['findOne']({'where':{'id':_0x4faaa7['params']['id']}})[_0x26e9('0x28')](handleEntityNotFound(_0x57422b,null))[_0x26e9('0x28')](function(_0x26a45d){if(_0x26a45d){_0x1892d4=_0x26a45d;_0x142299[_0x26e9('0x31')]=_[_0x26e9('0x34')](db['ZohoField'][_0x26e9('0x2d')]);_0x142299['query']=_[_0x26e9('0x34')](_0x4faaa7['query']);_0x142299[_0x26e9('0x35')]=_[_0x26e9('0x45')](_0x142299['model'],_0x142299[_0x26e9('0x33')]);_0x1b6237[_0x26e9('0x37')]=_['intersection'](_0x142299[_0x26e9('0x31')],qs[_0x26e9('0x36')](_0x4faaa7[_0x26e9('0x33')][_0x26e9('0x36')]));_0x1b6237['attributes']=_0x1b6237[_0x26e9('0x37')][_0x26e9('0x38')]?_0x1b6237[_0x26e9('0x37')]:_0x142299[_0x26e9('0x31')];_0x1b6237[_0x26e9('0x4c')]=qs[_0x26e9('0x3a')](_0x4faaa7[_0x26e9('0x33')]['sort']);_0x1b6237[_0x26e9('0x3c')]=qs[_0x26e9('0x35')](_[_0x26e9('0x4d')](_0x4faaa7[_0x26e9('0x33')],_0x142299[_0x26e9('0x35')]));if(_0x4faaa7[_0x26e9('0x33')][_0x26e9('0x3b')]){_0x1b6237[_0x26e9('0x3c')]=_[_0x26e9('0x3d')](_0x1b6237[_0x26e9('0x3c')],{'$or':_[_0x26e9('0x32')](_0x1b6237[_0x26e9('0x37')],function(_0x232548){var _0x1a96b1={};_0x1a96b1[_0x232548]={'$like':'%'+_0x4faaa7[_0x26e9('0x33')]['filter']+'%'};return _0x1a96b1;})});}_0x1b6237=_[_0x26e9('0x3d')]({},_0x1b6237,_0x4faaa7[_0x26e9('0x47')]);return _0x1892d4[_0x26e9('0x4b')](_0x1b6237);}})[_0x26e9('0x28')](function(_0x3404b9){if(_0x3404b9){_0x3b7059=_0x3404b9[_0x26e9('0x38')];if(!_0x4faaa7[_0x26e9('0x33')]['hasOwnProperty']('nolimit')){_0x1b6237[_0x26e9('0x20')]=qs[_0x26e9('0x20')](_0x4faaa7[_0x26e9('0x33')][_0x26e9('0x20')]);_0x1b6237['offset']=qs['offset'](_0x4faaa7[_0x26e9('0x33')][_0x26e9('0x1e')]);}return _0x1892d4[_0x26e9('0x4b')](_0x1b6237);}})[_0x26e9('0x28')](function(_0x1f62a6){if(_0x1f62a6){return _0x1f62a6?{'count':_0x3b7059,'rows':_0x1f62a6}:null;}})['then'](respondWithResult(_0x57422b,null))[_0x26e9('0x42')](handleError(_0x57422b,null));};exports[_0x26e9('0x4e')]=function(_0x5a42b8,_0x5ca3e3,_0x465722){var _0x5b8e17={};var _0x34ae1c={};var _0x3b4910;var _0x2f483c;return db[_0x26e9('0x40')][_0x26e9('0x4f')]({'where':{'id':_0x5a42b8['params']['id']}})['then'](handleEntityNotFound(_0x5ca3e3,null))[_0x26e9('0x28')](function(_0x1b7dbf){if(_0x1b7dbf){_0x3b4910=_0x1b7dbf;_0x34ae1c[_0x26e9('0x31')]=_[_0x26e9('0x34')](db[_0x26e9('0x50')]['rawAttributes']);_0x34ae1c[_0x26e9('0x33')]=_[_0x26e9('0x34')](_0x5a42b8[_0x26e9('0x33')]);_0x34ae1c['filters']=_[_0x26e9('0x45')](_0x34ae1c['model'],_0x34ae1c[_0x26e9('0x33')]);_0x5b8e17['attributes']=_[_0x26e9('0x45')](_0x34ae1c[_0x26e9('0x31')],qs[_0x26e9('0x36')](_0x5a42b8[_0x26e9('0x33')][_0x26e9('0x36')]));_0x5b8e17[_0x26e9('0x37')]=_0x5b8e17[_0x26e9('0x37')][_0x26e9('0x38')]?_0x5b8e17[_0x26e9('0x37')]:_0x34ae1c[_0x26e9('0x31')];_0x5b8e17[_0x26e9('0x4c')]=qs['sort'](_0x5a42b8[_0x26e9('0x33')]['sort']);_0x5b8e17['where']=qs[_0x26e9('0x35')](_['pick'](_0x5a42b8[_0x26e9('0x33')],_0x34ae1c[_0x26e9('0x35')]));if(_0x5a42b8[_0x26e9('0x33')][_0x26e9('0x3b')]){_0x5b8e17[_0x26e9('0x3c')]=_[_0x26e9('0x3d')](_0x5b8e17[_0x26e9('0x3c')],{'$or':_[_0x26e9('0x32')](_0x5b8e17[_0x26e9('0x37')],function(_0x53f8fc){var _0x4a344a={};_0x4a344a[_0x53f8fc]={'$like':'%'+_0x5a42b8[_0x26e9('0x33')][_0x26e9('0x3b')]+'%'};return _0x4a344a;})});}_0x5b8e17=_[_0x26e9('0x3d')]({},_0x5b8e17,_0x5a42b8['options']);return _0x3b4910['getSubjects'](_0x5b8e17);}})[_0x26e9('0x28')](function(_0x2c16b7){if(_0x2c16b7){_0x2f483c=_0x2c16b7['length'];if(!_0x5a42b8['query'][_0x26e9('0x39')](_0x26e9('0x51'))){_0x5b8e17[_0x26e9('0x20')]=qs['limit'](_0x5a42b8[_0x26e9('0x33')][_0x26e9('0x20')]);_0x5b8e17['offset']=qs[_0x26e9('0x1e')](_0x5a42b8[_0x26e9('0x33')][_0x26e9('0x1e')]);}return _0x3b4910[_0x26e9('0x4e')](_0x5b8e17);}})[_0x26e9('0x28')](function(_0x5cd07d){if(_0x5cd07d){return _0x5cd07d?{'count':_0x2f483c,'rows':_0x5cd07d}:null;}})[_0x26e9('0x28')](respondWithResult(_0x5ca3e3,null))[_0x26e9('0x42')](handleError(_0x5ca3e3,null));};exports['getDescriptions']=function(_0x143266,_0xaedca1,_0x4e8cd7){var _0x5e433e={};var _0x568dbe={};var _0xee329a;var _0xf0478;return db[_0x26e9('0x40')]['findOne']({'where':{'id':_0x143266[_0x26e9('0x44')]['id']}})[_0x26e9('0x28')](handleEntityNotFound(_0xaedca1,null))[_0x26e9('0x28')](function(_0x104092){if(_0x104092){_0xee329a=_0x104092;_0x568dbe[_0x26e9('0x31')]=_['keys'](db[_0x26e9('0x50')][_0x26e9('0x2d')]);_0x568dbe[_0x26e9('0x33')]=_[_0x26e9('0x34')](_0x143266[_0x26e9('0x33')]);_0x568dbe[_0x26e9('0x35')]=_[_0x26e9('0x45')](_0x568dbe['model'],_0x568dbe[_0x26e9('0x33')]);_0x5e433e[_0x26e9('0x37')]=_[_0x26e9('0x45')](_0x568dbe[_0x26e9('0x31')],qs[_0x26e9('0x36')](_0x143266[_0x26e9('0x33')]['fields']));_0x5e433e[_0x26e9('0x37')]=_0x5e433e[_0x26e9('0x37')][_0x26e9('0x38')]?_0x5e433e[_0x26e9('0x37')]:_0x568dbe[_0x26e9('0x31')];_0x5e433e[_0x26e9('0x4c')]=qs[_0x26e9('0x3a')](_0x143266['query'][_0x26e9('0x3a')]);_0x5e433e[_0x26e9('0x3c')]=qs[_0x26e9('0x35')](_[_0x26e9('0x4d')](_0x143266[_0x26e9('0x33')],_0x568dbe[_0x26e9('0x35')]));if(_0x143266[_0x26e9('0x33')][_0x26e9('0x3b')]){_0x5e433e['where']=_[_0x26e9('0x3d')](_0x5e433e[_0x26e9('0x3c')],{'$or':_['map'](_0x5e433e[_0x26e9('0x37')],function(_0x382edb){var _0x5c2c0e={};_0x5c2c0e[_0x382edb]={'$like':'%'+_0x143266[_0x26e9('0x33')][_0x26e9('0x3b')]+'%'};return _0x5c2c0e;})});}_0x5e433e=_[_0x26e9('0x3d')]({},_0x5e433e,_0x143266[_0x26e9('0x47')]);return _0xee329a['getDescriptions'](_0x5e433e);}})[_0x26e9('0x28')](function(_0x4cd771){if(_0x4cd771){_0xf0478=_0x4cd771[_0x26e9('0x38')];if(!_0x143266[_0x26e9('0x33')][_0x26e9('0x39')](_0x26e9('0x51'))){_0x5e433e['limit']=qs[_0x26e9('0x20')](_0x143266[_0x26e9('0x33')][_0x26e9('0x20')]);_0x5e433e[_0x26e9('0x1e')]=qs[_0x26e9('0x1e')](_0x143266['query'][_0x26e9('0x1e')]);}return _0xee329a[_0x26e9('0x52')](_0x5e433e);}})[_0x26e9('0x28')](function(_0x635620){if(_0x635620){return _0x635620?{'count':_0xf0478,'rows':_0x635620}:null;}})['then'](respondWithResult(_0xaedca1,null))[_0x26e9('0x42')](handleError(_0xaedca1,null));}; \ No newline at end of file +var _0x6a67=['moment','bluebird','mustache','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','then','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','getFields','ZohoField','filter','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x6a67,0xd7));var _0x76a6=function(_0x30e4c0,_0x58fed1){_0x30e4c0=_0x30e4c0-0x0;var _0x30b6d0=_0x6a67[_0x30e4c0];return _0x30b6d0;};'use strict';var emlformat=require(_0x76a6('0x0'));var rimraf=require(_0x76a6('0x1'));var zipdir=require(_0x76a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76a6('0x3'));var moment=require(_0x76a6('0x4'));var BPromise=require(_0x76a6('0x5'));var Mustache=require(_0x76a6('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x76a6('0x7'));var ejs=require(_0x76a6('0x8'));var fs=require('fs');var fs_extra=require(_0x76a6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x76a6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x76a6('0x7'));var querystring=require('querystring');var Papa=require(_0x76a6('0xb'));var Redis=require(_0x76a6('0xc'));var authService=require(_0x76a6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x76a6('0xe'));var hardwareService=require(_0x76a6('0xf'));var logger=require('../../config/logger')(_0x76a6('0x10'));var utils=require('../../config/utils');var config=require(_0x76a6('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x76a6('0x12'))['db'];function respondWithStatusCode(_0x510e30,_0x343e96){_0x343e96=_0x343e96||0xcc;return function(_0x107899){if(_0x107899){return _0x510e30[_0x76a6('0x13')](_0x343e96);}return _0x510e30[_0x76a6('0x14')](_0x343e96)[_0x76a6('0x15')]();};}function respondWithResult(_0x3b5842,_0xbf3ee0){_0xbf3ee0=_0xbf3ee0||0xc8;return function(_0x2d23d2){if(_0x2d23d2){return _0x3b5842['status'](_0xbf3ee0)[_0x76a6('0x16')](_0x2d23d2);}};}function respondWithFilteredResult(_0x35130f,_0x4796ec){return function(_0x12f86e){if(_0x12f86e){var _0x1e21af=typeof _0x4796ec['offset']===_0x76a6('0x17')&&typeof _0x4796ec['limit']==='undefined';var _0xc11de4=_0x12f86e[_0x76a6('0x18')];var _0x2f50e9=_0x1e21af?0x0:_0x4796ec[_0x76a6('0x19')];var _0x367973=_0x1e21af?_0x12f86e[_0x76a6('0x18')]:_0x4796ec[_0x76a6('0x19')]+_0x4796ec[_0x76a6('0x1a')];var _0x57ba41;if(_0x367973>=_0xc11de4){_0x367973=_0xc11de4;_0x57ba41=0xc8;}else{_0x57ba41=0xce;}_0x35130f[_0x76a6('0x14')](_0x57ba41);return _0x35130f[_0x76a6('0x1b')](_0x76a6('0x1c'),_0x2f50e9+'-'+_0x367973+'/'+_0xc11de4)['json'](_0x12f86e);}return null;};}function patchUpdates(_0x125502){return function(_0x1cd919){try{jsonpatch[_0x76a6('0x1d')](_0x1cd919,_0x125502,!![]);}catch(_0x23ac19){return BPromise['reject'](_0x23ac19);}return _0x1cd919['save']();};}function saveUpdates(_0x41b673,_0x1cc26b){return function(_0x2d8584){if(_0x2d8584){return _0x2d8584[_0x76a6('0x1e')](_0x41b673)['then'](function(_0x583b8d){return _0x583b8d;});}return null;};}function removeEntity(_0x158ed0,_0x296062){return function(_0x463463){if(_0x463463){return _0x463463[_0x76a6('0x1f')]()[_0x76a6('0x20')](function(){_0x158ed0[_0x76a6('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5070dc,_0x3b66b9){return function(_0x20dc07){if(!_0x20dc07){_0x5070dc[_0x76a6('0x13')](0x194);}return _0x20dc07;};}function handleError(_0x5252be,_0x3ebe0b){_0x3ebe0b=_0x3ebe0b||0x1f4;return function(_0x601e94){logger['error'](_0x601e94[_0x76a6('0x21')]);if(_0x601e94[_0x76a6('0x22')]){delete _0x601e94['name'];}_0x5252be['status'](_0x3ebe0b)[_0x76a6('0x23')](_0x601e94);};}exports[_0x76a6('0x24')]=function(_0x82d9d4,_0x42d224){var _0x1e1595={},_0x363f8c={},_0xf0024={'count':0x0,'rows':[]};var _0x282084=_[_0x76a6('0x25')](db[_0x76a6('0x26')][_0x76a6('0x27')],function(_0x48e150){return{'name':_0x48e150['fieldName'],'type':_0x48e150[_0x76a6('0x28')]['key']};});_0x363f8c[_0x76a6('0x29')]=_[_0x76a6('0x25')](_0x282084,'name');_0x363f8c[_0x76a6('0x2a')]=_[_0x76a6('0x2b')](_0x82d9d4['query']);_0x363f8c[_0x76a6('0x2c')]=_['intersection'](_0x363f8c['model'],_0x363f8c['query']);_0x1e1595['attributes']=_[_0x76a6('0x2d')](_0x363f8c['model'],qs[_0x76a6('0x2e')](_0x82d9d4[_0x76a6('0x2a')]['fields']));_0x1e1595['attributes']=_0x1e1595[_0x76a6('0x2f')]['length']?_0x1e1595[_0x76a6('0x2f')]:_0x363f8c[_0x76a6('0x29')];if(!_0x82d9d4['query'][_0x76a6('0x30')](_0x76a6('0x31'))){_0x1e1595[_0x76a6('0x1a')]=qs[_0x76a6('0x1a')](_0x82d9d4['query']['limit']);_0x1e1595['offset']=qs[_0x76a6('0x19')](_0x82d9d4[_0x76a6('0x2a')][_0x76a6('0x19')]);}_0x1e1595[_0x76a6('0x32')]=qs['sort'](_0x82d9d4['query'][_0x76a6('0x33')]);_0x1e1595['where']=qs[_0x76a6('0x2c')](_[_0x76a6('0x34')](_0x82d9d4[_0x76a6('0x2a')],_0x363f8c[_0x76a6('0x2c')]),_0x282084);if(_0x82d9d4['query']['filter']){_0x1e1595[_0x76a6('0x35')]=_[_0x76a6('0x36')](_0x1e1595[_0x76a6('0x35')],{'$or':_[_0x76a6('0x25')](_0x282084,function(_0x1ba847){if(_0x1ba847['type']!=='VIRTUAL'){var _0xade791={};_0xade791[_0x1ba847[_0x76a6('0x22')]]={'$like':'%'+_0x82d9d4[_0x76a6('0x2a')]['filter']+'%'};return _0xade791;}})});}_0x1e1595=_['merge']({},_0x1e1595,_0x82d9d4[_0x76a6('0x37')]);var _0x11f64f={'where':_0x1e1595[_0x76a6('0x35')]};return db['ZohoConfiguration'][_0x76a6('0x18')](_0x11f64f)[_0x76a6('0x20')](function(_0x1d8496){_0xf0024[_0x76a6('0x18')]=_0x1d8496;if(_0x82d9d4[_0x76a6('0x2a')]['includeAll']){_0x1e1595[_0x76a6('0x38')]=[{'all':!![]}];}return db[_0x76a6('0x26')][_0x76a6('0x39')](_0x1e1595);})[_0x76a6('0x20')](function(_0x180c2a){_0xf0024[_0x76a6('0x3a')]=_0x180c2a;return _0xf0024;})[_0x76a6('0x20')](respondWithFilteredResult(_0x42d224,_0x1e1595))[_0x76a6('0x3b')](handleError(_0x42d224,null));};exports[_0x76a6('0x3c')]=function(_0x1593f5,_0x9d4756){var _0x4d154d={'raw':![],'where':{'id':_0x1593f5['params']['id']}},_0x22b9bf={};_0x22b9bf['model']=_[_0x76a6('0x2b')](db[_0x76a6('0x26')]['rawAttributes']);_0x22b9bf['query']=_[_0x76a6('0x2b')](_0x1593f5[_0x76a6('0x2a')]);_0x22b9bf[_0x76a6('0x2c')]=_[_0x76a6('0x2d')](_0x22b9bf[_0x76a6('0x29')],_0x22b9bf[_0x76a6('0x2a')]);_0x4d154d[_0x76a6('0x2f')]=_[_0x76a6('0x2d')](_0x22b9bf[_0x76a6('0x29')],qs['fields'](_0x1593f5[_0x76a6('0x2a')][_0x76a6('0x2e')]));_0x4d154d[_0x76a6('0x2f')]=_0x4d154d['attributes'][_0x76a6('0x3d')]?_0x4d154d[_0x76a6('0x2f')]:_0x22b9bf[_0x76a6('0x29')];if(_0x1593f5[_0x76a6('0x2a')][_0x76a6('0x3e')]){_0x4d154d[_0x76a6('0x38')]=[{'all':!![]}];}_0x4d154d=_[_0x76a6('0x36')]({},_0x4d154d,_0x1593f5[_0x76a6('0x37')]);return db['ZohoConfiguration'][_0x76a6('0x3f')](_0x4d154d)['then'](handleEntityNotFound(_0x9d4756,null))['then'](respondWithResult(_0x9d4756,null))['catch'](handleError(_0x9d4756,null));};exports[_0x76a6('0x40')]=function(_0x4c60f6,_0x901f07){return db[_0x76a6('0x26')][_0x76a6('0x40')](_0x4c60f6[_0x76a6('0x41')],{})['then'](respondWithResult(_0x901f07,0xc9))['catch'](handleError(_0x901f07,null));};exports['update']=function(_0x33d8a2,_0x231679){if(_0x33d8a2['body']['id']){delete _0x33d8a2[_0x76a6('0x41')]['id'];}return db['ZohoConfiguration'][_0x76a6('0x3f')]({'where':{'id':_0x33d8a2[_0x76a6('0x42')]['id']}})[_0x76a6('0x20')](handleEntityNotFound(_0x231679,null))[_0x76a6('0x20')](saveUpdates(_0x33d8a2[_0x76a6('0x41')],null))[_0x76a6('0x20')](respondWithResult(_0x231679,null))[_0x76a6('0x3b')](handleError(_0x231679,null));};exports['destroy']=function(_0x33cc78,_0x158d87){return db[_0x76a6('0x26')][_0x76a6('0x3f')]({'where':{'id':_0x33cc78[_0x76a6('0x42')]['id']}})['then'](handleEntityNotFound(_0x158d87,null))[_0x76a6('0x20')](removeEntity(_0x158d87,null))[_0x76a6('0x3b')](handleError(_0x158d87,null));};exports[_0x76a6('0x43')]=function(_0x3b1b44,_0x15e3ba,_0x14e873){var _0x30fa8e={};var _0x13b38f={};var _0x43bdcc;var _0x486ba7;return db[_0x76a6('0x26')]['findOne']({'where':{'id':_0x3b1b44[_0x76a6('0x42')]['id']}})[_0x76a6('0x20')](handleEntityNotFound(_0x15e3ba,null))[_0x76a6('0x20')](function(_0x11d45b){if(_0x11d45b){_0x43bdcc=_0x11d45b;_0x13b38f['model']=_['keys'](db[_0x76a6('0x44')][_0x76a6('0x27')]);_0x13b38f['query']=_['keys'](_0x3b1b44[_0x76a6('0x2a')]);_0x13b38f[_0x76a6('0x2c')]=_[_0x76a6('0x2d')](_0x13b38f['model'],_0x13b38f[_0x76a6('0x2a')]);_0x30fa8e[_0x76a6('0x2f')]=_[_0x76a6('0x2d')](_0x13b38f[_0x76a6('0x29')],qs[_0x76a6('0x2e')](_0x3b1b44[_0x76a6('0x2a')][_0x76a6('0x2e')]));_0x30fa8e[_0x76a6('0x2f')]=_0x30fa8e[_0x76a6('0x2f')][_0x76a6('0x3d')]?_0x30fa8e['attributes']:_0x13b38f['model'];_0x30fa8e[_0x76a6('0x32')]=qs[_0x76a6('0x33')](_0x3b1b44[_0x76a6('0x2a')][_0x76a6('0x33')]);_0x30fa8e[_0x76a6('0x35')]=qs['filters'](_['pick'](_0x3b1b44[_0x76a6('0x2a')],_0x13b38f['filters']));if(_0x3b1b44[_0x76a6('0x2a')][_0x76a6('0x45')]){_0x30fa8e[_0x76a6('0x35')]=_[_0x76a6('0x36')](_0x30fa8e[_0x76a6('0x35')],{'$or':_[_0x76a6('0x25')](_0x30fa8e['attributes'],function(_0xd6d6b5){var _0x32c410={};_0x32c410[_0xd6d6b5]={'$like':'%'+_0x3b1b44[_0x76a6('0x2a')][_0x76a6('0x45')]+'%'};return _0x32c410;})});}_0x30fa8e=_[_0x76a6('0x36')]({},_0x30fa8e,_0x3b1b44['options']);return _0x43bdcc[_0x76a6('0x43')](_0x30fa8e);}})[_0x76a6('0x20')](function(_0xf79479){if(_0xf79479){_0x486ba7=_0xf79479[_0x76a6('0x3d')];if(!_0x3b1b44[_0x76a6('0x2a')][_0x76a6('0x30')](_0x76a6('0x31'))){_0x30fa8e[_0x76a6('0x1a')]=qs['limit'](_0x3b1b44[_0x76a6('0x2a')][_0x76a6('0x1a')]);_0x30fa8e[_0x76a6('0x19')]=qs[_0x76a6('0x19')](_0x3b1b44['query'][_0x76a6('0x19')]);}return _0x43bdcc[_0x76a6('0x43')](_0x30fa8e);}})[_0x76a6('0x20')](function(_0x4a307c){if(_0x4a307c){return _0x4a307c?{'count':_0x486ba7,'rows':_0x4a307c}:null;}})[_0x76a6('0x20')](respondWithResult(_0x15e3ba,null))[_0x76a6('0x3b')](handleError(_0x15e3ba,null));};exports[_0x76a6('0x46')]=function(_0xd7f07a,_0x5b9407,_0x277da3){var _0x54f362={};var _0x3b8306={};var _0xc4fa11;var _0xa46d49;return db['ZohoConfiguration'][_0x76a6('0x47')]({'where':{'id':_0xd7f07a[_0x76a6('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b9407,null))['then'](function(_0x20c319){if(_0x20c319){_0xc4fa11=_0x20c319;_0x3b8306['model']=_[_0x76a6('0x2b')](db['ZohoField']['rawAttributes']);_0x3b8306['query']=_[_0x76a6('0x2b')](_0xd7f07a[_0x76a6('0x2a')]);_0x3b8306[_0x76a6('0x2c')]=_['intersection'](_0x3b8306[_0x76a6('0x29')],_0x3b8306['query']);_0x54f362[_0x76a6('0x2f')]=_[_0x76a6('0x2d')](_0x3b8306['model'],qs[_0x76a6('0x2e')](_0xd7f07a['query'][_0x76a6('0x2e')]));_0x54f362[_0x76a6('0x2f')]=_0x54f362[_0x76a6('0x2f')][_0x76a6('0x3d')]?_0x54f362[_0x76a6('0x2f')]:_0x3b8306[_0x76a6('0x29')];_0x54f362[_0x76a6('0x32')]=qs[_0x76a6('0x33')](_0xd7f07a[_0x76a6('0x2a')][_0x76a6('0x33')]);_0x54f362['where']=qs[_0x76a6('0x2c')](_[_0x76a6('0x34')](_0xd7f07a[_0x76a6('0x2a')],_0x3b8306[_0x76a6('0x2c')]));if(_0xd7f07a[_0x76a6('0x2a')][_0x76a6('0x45')]){_0x54f362[_0x76a6('0x35')]=_[_0x76a6('0x36')](_0x54f362[_0x76a6('0x35')],{'$or':_[_0x76a6('0x25')](_0x54f362[_0x76a6('0x2f')],function(_0x2ca98d){var _0x9d7be2={};_0x9d7be2[_0x2ca98d]={'$like':'%'+_0xd7f07a[_0x76a6('0x2a')][_0x76a6('0x45')]+'%'};return _0x9d7be2;})});}_0x54f362=_[_0x76a6('0x36')]({},_0x54f362,_0xd7f07a['options']);return _0xc4fa11[_0x76a6('0x46')](_0x54f362);}})[_0x76a6('0x20')](function(_0x2ae986){if(_0x2ae986){_0xa46d49=_0x2ae986[_0x76a6('0x3d')];if(!_0xd7f07a[_0x76a6('0x2a')][_0x76a6('0x30')](_0x76a6('0x31'))){_0x54f362[_0x76a6('0x1a')]=qs[_0x76a6('0x1a')](_0xd7f07a['query']['limit']);_0x54f362[_0x76a6('0x19')]=qs['offset'](_0xd7f07a[_0x76a6('0x2a')][_0x76a6('0x19')]);}return _0xc4fa11[_0x76a6('0x46')](_0x54f362);}})[_0x76a6('0x20')](function(_0x171984){if(_0x171984){return _0x171984?{'count':_0xa46d49,'rows':_0x171984}:null;}})[_0x76a6('0x20')](respondWithResult(_0x5b9407,null))[_0x76a6('0x3b')](handleError(_0x5b9407,null));};exports[_0x76a6('0x48')]=function(_0x26b0da,_0xd05150,_0x5c5643){var _0x5bcf18={};var _0x572bf7={};var _0x2e77b1;var _0xbb500d;return db[_0x76a6('0x26')][_0x76a6('0x47')]({'where':{'id':_0x26b0da[_0x76a6('0x42')]['id']}})[_0x76a6('0x20')](handleEntityNotFound(_0xd05150,null))[_0x76a6('0x20')](function(_0x5cd627){if(_0x5cd627){_0x2e77b1=_0x5cd627;_0x572bf7['model']=_['keys'](db[_0x76a6('0x44')][_0x76a6('0x27')]);_0x572bf7[_0x76a6('0x2a')]=_[_0x76a6('0x2b')](_0x26b0da[_0x76a6('0x2a')]);_0x572bf7[_0x76a6('0x2c')]=_[_0x76a6('0x2d')](_0x572bf7[_0x76a6('0x29')],_0x572bf7[_0x76a6('0x2a')]);_0x5bcf18[_0x76a6('0x2f')]=_[_0x76a6('0x2d')](_0x572bf7[_0x76a6('0x29')],qs[_0x76a6('0x2e')](_0x26b0da[_0x76a6('0x2a')]['fields']));_0x5bcf18[_0x76a6('0x2f')]=_0x5bcf18['attributes'][_0x76a6('0x3d')]?_0x5bcf18[_0x76a6('0x2f')]:_0x572bf7[_0x76a6('0x29')];_0x5bcf18[_0x76a6('0x32')]=qs[_0x76a6('0x33')](_0x26b0da[_0x76a6('0x2a')][_0x76a6('0x33')]);_0x5bcf18['where']=qs['filters'](_[_0x76a6('0x34')](_0x26b0da[_0x76a6('0x2a')],_0x572bf7['filters']));if(_0x26b0da[_0x76a6('0x2a')][_0x76a6('0x45')]){_0x5bcf18[_0x76a6('0x35')]=_[_0x76a6('0x36')](_0x5bcf18[_0x76a6('0x35')],{'$or':_[_0x76a6('0x25')](_0x5bcf18[_0x76a6('0x2f')],function(_0x3c8760){var _0x5d2130={};_0x5d2130[_0x3c8760]={'$like':'%'+_0x26b0da['query'][_0x76a6('0x45')]+'%'};return _0x5d2130;})});}_0x5bcf18=_['merge']({},_0x5bcf18,_0x26b0da['options']);return _0x2e77b1[_0x76a6('0x48')](_0x5bcf18);}})[_0x76a6('0x20')](function(_0x5444da){if(_0x5444da){_0xbb500d=_0x5444da[_0x76a6('0x3d')];if(!_0x26b0da[_0x76a6('0x2a')][_0x76a6('0x30')](_0x76a6('0x31'))){_0x5bcf18['limit']=qs['limit'](_0x26b0da['query'][_0x76a6('0x1a')]);_0x5bcf18[_0x76a6('0x19')]=qs[_0x76a6('0x19')](_0x26b0da[_0x76a6('0x2a')][_0x76a6('0x19')]);}return _0x2e77b1[_0x76a6('0x48')](_0x5bcf18);}})['then'](function(_0x5234cd){if(_0x5234cd){return _0x5234cd?{'count':_0xbb500d,'rows':_0x5234cd}:null;}})[_0x76a6('0x20')](respondWithResult(_0xd05150,null))['catch'](handleError(_0xd05150,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 72c4723..17634de 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 _0x0c28=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x0c28,0xac));var _0x80c2=function(_0x538f97,_0x329f5d){_0x538f97=_0x538f97-0x0;var _0x2a97af=_0x0c28[_0x538f97];return _0x2a97af;};'use strict';var _=require(_0x80c2('0x0'));var util=require(_0x80c2('0x1'));var logger=require(_0x80c2('0x2'))(_0x80c2('0x3'));var moment=require(_0x80c2('0x4'));var BPromise=require(_0x80c2('0x5'));var rp=require(_0x80c2('0x6'));var fs=require('fs');var path=require(_0x80c2('0x7'));var rimraf=require(_0x80c2('0x8'));var config=require('../../config/environment');var attributes=require(_0x80c2('0x9'));module[_0x80c2('0xa')]=function(_0xee8b13,_0xf74ef0){return _0xee8b13[_0x80c2('0xb')](_0x80c2('0xc'),attributes,{'tableName':_0x80c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x804a=['bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x804a,0xcc));var _0xa804=function(_0x59eed3,_0x3d53a6){_0x59eed3=_0x59eed3-0x0;var _0x45ca9e=_0x804a[_0x59eed3];return _0x45ca9e;};'use strict';var _=require(_0xa804('0x0'));var util=require('util');var logger=require(_0xa804('0x1'))(_0xa804('0x2'));var moment=require(_0xa804('0x3'));var BPromise=require(_0xa804('0x4'));var rp=require(_0xa804('0x5'));var fs=require('fs');var path=require(_0xa804('0x6'));var rimraf=require('rimraf');var config=require(_0xa804('0x7'));var attributes=require(_0xa804('0x8'));module[_0xa804('0x9')]=function(_0x2a95bf,_0x5ae5d7){return _0x2a95bf[_0xa804('0xa')](_0xa804('0xb'),attributes,{'tableName':_0xa804('0xc'),'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 e991695..2061a79 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 _0x1210=['stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1210,0x17c));var _0x0121=function(_0x64a51,_0x1c61b7){_0x64a51=_0x64a51-0x0;var _0x1eba45=_0x1210[_0x64a51];return _0x1eba45;};'use strict';var _=require('lodash');var util=require(_0x0121('0x0'));var moment=require('moment');var BPromise=require(_0x0121('0x1'));var rs=require(_0x0121('0x2'));var fs=require('fs');var Redis=require(_0x0121('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0121('0x4'));var logger=require(_0x0121('0x5'))(_0x0121('0x6'));var config=require('../../config/environment');var jayson=require(_0x0121('0x7'));var client=jayson[_0x0121('0x8')][_0x0121('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f048f,_0x272e88,_0x1be9b7){return new BPromise(function(_0x3cab06,_0x56dc76){return client[_0x0121('0xa')](_0x4f048f,_0x1be9b7)[_0x0121('0xb')](function(_0x31c781){logger[_0x0121('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x272e88,_0x0121('0xd'));logger[_0x0121('0xe')](_0x0121('0xf'),_0x272e88,_0x0121('0xd'),JSON[_0x0121('0x10')](_0x31c781));if(_0x31c781[_0x0121('0x11')]){if(_0x31c781[_0x0121('0x11')]['code']===0x1f4){logger[_0x0121('0x11')](_0x0121('0x12'),_0x272e88,_0x31c781['error'][_0x0121('0x13')]);return _0x56dc76(_0x31c781[_0x0121('0x11')][_0x0121('0x13')]);}logger[_0x0121('0x11')](_0x0121('0x12'),_0x272e88,_0x31c781['error']['message']);return _0x3cab06(_0x31c781['error'][_0x0121('0x13')]);}else{logger[_0x0121('0xc')](_0x0121('0x12'),_0x272e88,_0x0121('0xd'));_0x3cab06(_0x31c781[_0x0121('0x14')]['message']);}})[_0x0121('0x15')](function(_0x5e6827){logger[_0x0121('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x272e88,_0x5e6827);_0x56dc76(_0x5e6827);});});} \ No newline at end of file +var _0xf8a4=['error','code','message','info','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x269018,_0x5c01c5){var _0xb0f016=function(_0x5f0f41){while(--_0x5f0f41){_0x269018['push'](_0x269018['shift']());}};_0xb0f016(++_0x5c01c5);}(_0xf8a4,0xf0));var _0x4f8a=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xf8a4[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0x4f8a('0x0'));var util=require(_0x4f8a('0x1'));var moment=require(_0x4f8a('0x2'));var BPromise=require(_0x4f8a('0x3'));var rs=require(_0x4f8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f8a('0x5'))['db'];var utils=require(_0x4f8a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4f8a('0x7'));var jayson=require(_0x4f8a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53f4ad,_0x2a1590,_0x38a848){return new BPromise(function(_0xfadbb,_0x4344ff){return client[_0x4f8a('0x9')](_0x53f4ad,_0x38a848)[_0x4f8a('0xa')](function(_0x555b8a){logger['info'](_0x4f8a('0xb'),_0x2a1590,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2a1590,'request\x20sent',JSON['stringify'](_0x555b8a));if(_0x555b8a[_0x4f8a('0xc')]){if(_0x555b8a['error'][_0x4f8a('0xd')]===0x1f4){logger[_0x4f8a('0xc')](_0x4f8a('0xb'),_0x2a1590,_0x555b8a[_0x4f8a('0xc')][_0x4f8a('0xe')]);return _0x4344ff(_0x555b8a[_0x4f8a('0xc')][_0x4f8a('0xe')]);}logger['error'](_0x4f8a('0xb'),_0x2a1590,_0x555b8a[_0x4f8a('0xc')][_0x4f8a('0xe')]);return _0xfadbb(_0x555b8a[_0x4f8a('0xc')][_0x4f8a('0xe')]);}else{logger[_0x4f8a('0xf')](_0x4f8a('0xb'),_0x2a1590,_0x4f8a('0x10'));_0xfadbb(_0x555b8a['result']['message']);}})[_0x4f8a('0x11')](function(_0x20a2cf){logger['error'](_0x4f8a('0xb'),_0x2a1590,_0x20a2cf);_0x4344ff(_0x20a2cf);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 7d2fde2..249d81f 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 _0xe26b=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0xe26b,0x8f));var _0xbe26=function(_0x3a6e90,_0x1bceff){_0x3a6e90=_0x3a6e90-0x0;var _0x4081c9=_0xe26b[_0x3a6e90];return _0x4081c9;};'use strict';var multer=require(_0xbe26('0x0'));var util=require(_0xbe26('0x1'));var path=require(_0xbe26('0x2'));var timeout=require(_0xbe26('0x3'));var express=require(_0xbe26('0x4'));var router=express[_0xbe26('0x5')]();var fs_extra=require(_0xbe26('0x6'));var auth=require(_0xbe26('0x7'));var interaction=require(_0xbe26('0x8'));var config=require(_0xbe26('0x9'));var controller=require(_0xbe26('0xa'));router[_0xbe26('0xb')]('/',auth[_0xbe26('0xc')](),controller[_0xbe26('0xd')]);router[_0xbe26('0xb')](_0xbe26('0xe'),auth['isAuthenticated'](),controller[_0xbe26('0xf')]);router[_0xbe26('0x10')]('/',auth[_0xbe26('0xc')](),controller[_0xbe26('0x11')]);router[_0xbe26('0x12')](_0xbe26('0xe'),auth[_0xbe26('0xc')](),controller[_0xbe26('0x13')]);router[_0xbe26('0x14')]('/:id',auth[_0xbe26('0xc')](),controller['destroy']);module[_0xbe26('0x15')]=router; \ No newline at end of file +var _0x1441=['put','/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','show','post','create'];(function(_0x16508c,_0x4dcdfc){var _0x25614d=function(_0x55fed2){while(--_0x55fed2){_0x16508c['push'](_0x16508c['shift']());}};_0x25614d(++_0x4dcdfc);}(_0x1441,0x71));var _0x1144=function(_0x119fc9,_0x344319){_0x119fc9=_0x119fc9-0x0;var _0x5cea78=_0x1441[_0x119fc9];return _0x5cea78;};'use strict';var multer=require(_0x1144('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1144('0x1'));var express=require(_0x1144('0x2'));var router=express[_0x1144('0x3')]();var fs_extra=require(_0x1144('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1144('0x5'));var config=require(_0x1144('0x6'));var controller=require(_0x1144('0x7'));router['get']('/',auth[_0x1144('0x8')](),controller[_0x1144('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1144('0xa')]);router[_0x1144('0xb')]('/',auth[_0x1144('0x8')](),controller[_0x1144('0xc')]);router[_0x1144('0xd')](_0x1144('0xe'),auth[_0x1144('0x8')](),controller[_0x1144('0xf')]);router[_0x1144('0x10')](_0x1144('0xe'),auth[_0x1144('0x8')](),controller['destroy']);module[_0x1144('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 ddedbac..87ee86f 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 _0x4b09=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4b09,0xe7));var _0x94b0=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x4b09[_0xf51c06];return _0x1d5420;};'use strict';var Sequelize=require('sequelize');module[_0x94b0('0x0')]={'type':{'type':Sequelize[_0x94b0('0x1')](_0x94b0('0x2'),_0x94b0('0x3'),_0x94b0('0x4'),_0x94b0('0x5'),_0x94b0('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x94b0('0x7')]},'keyType':{'type':Sequelize[_0x94b0('0x1')](_0x94b0('0x2'),_0x94b0('0x3'),_0x94b0('0x4'))},'keyContent':{'type':Sequelize[_0x94b0('0x7')]},'idField':{'type':Sequelize[_0x94b0('0x7')]},'nameField':{'type':Sequelize[_0x94b0('0x7')]},'customField':{'type':Sequelize[_0x94b0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x94b0('0x7')]}}; \ No newline at end of file +var _0xbe7e=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x16eed2,_0x14d1d2){var _0x102394=function(_0x20aca6){while(--_0x20aca6){_0x16eed2['push'](_0x16eed2['shift']());}};_0x102394(++_0x14d1d2);}(_0xbe7e,0xa9));var _0xebe7=function(_0x1d7790,_0x180cf9){_0x1d7790=_0x1d7790-0x0;var _0xf4f99a=_0xbe7e[_0x1d7790];return _0xf4f99a;};'use strict';var Sequelize=require(_0xebe7('0x0'));module['exports']={'type':{'type':Sequelize[_0xebe7('0x1')](_0xebe7('0x2'),'variable',_0xebe7('0x3'),_0xebe7('0x4'),_0xebe7('0x5')),'defaultValue':_0xebe7('0x2')},'content':{'type':Sequelize[_0xebe7('0x6')]},'key':{'type':Sequelize[_0xebe7('0x6')]},'keyType':{'type':Sequelize[_0xebe7('0x1')](_0xebe7('0x2'),_0xebe7('0x7'),_0xebe7('0x3'))},'keyContent':{'type':Sequelize[_0xebe7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xebe7('0x6')]},'customField':{'type':Sequelize[_0xebe7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xebe7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 220813a..15cda06 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 _0x992d=['rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','ZohoField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','rows','catch','show','keys','find','create','body','params'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0x992d,0x8e));var _0xd992=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x992d[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd992('0x0'));var zipdir=require(_0xd992('0x1'));var jsonpatch=require(_0xd992('0x2'));var rp=require('request-promise');var moment=require(_0xd992('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd992('0x4'));var util=require(_0xd992('0x5'));var path=require(_0xd992('0x6'));var sox=require(_0xd992('0x7'));var csv=require(_0xd992('0x8'));var ejs=require(_0xd992('0x9'));var fs=require('fs');var fs_extra=require(_0xd992('0xa'));var _=require('lodash');var squel=require(_0xd992('0xb'));var crypto=require(_0xd992('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd992('0x8'));var querystring=require(_0xd992('0xd'));var Papa=require('papaparse');var Redis=require(_0xd992('0xe'));var authService=require(_0xd992('0xf'));var qs=require(_0xd992('0x10'));var as=require(_0xd992('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd992('0x12'))(_0xd992('0x13'));var utils=require('../../config/utils');var config=require(_0xd992('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd992('0x15'))['db'];function respondWithStatusCode(_0x50e658,_0x1fa4ac){_0x1fa4ac=_0x1fa4ac||0xcc;return function(_0x498732){if(_0x498732){return _0x50e658[_0xd992('0x16')](_0x1fa4ac);}return _0x50e658[_0xd992('0x17')](_0x1fa4ac)[_0xd992('0x18')]();};}function respondWithResult(_0x516486,_0x421458){_0x421458=_0x421458||0xc8;return function(_0x1001ab){if(_0x1001ab){return _0x516486['status'](_0x421458)[_0xd992('0x19')](_0x1001ab);}};}function respondWithFilteredResult(_0x445c63,_0x5c1b43){return function(_0x2a811b){if(_0x2a811b){var _0x382cb7=typeof _0x5c1b43[_0xd992('0x1a')]===_0xd992('0x1b')&&typeof _0x5c1b43[_0xd992('0x1c')]===_0xd992('0x1b');var _0x505869=_0x2a811b[_0xd992('0x1d')];var _0xfa421c=_0x382cb7?0x0:_0x5c1b43[_0xd992('0x1a')];var _0x247a9f=_0x382cb7?_0x2a811b['count']:_0x5c1b43[_0xd992('0x1a')]+_0x5c1b43[_0xd992('0x1c')];var _0x13fba6;if(_0x247a9f>=_0x505869){_0x247a9f=_0x505869;_0x13fba6=0xc8;}else{_0x13fba6=0xce;}_0x445c63[_0xd992('0x17')](_0x13fba6);return _0x445c63[_0xd992('0x1e')](_0xd992('0x1f'),_0xfa421c+'-'+_0x247a9f+'/'+_0x505869)[_0xd992('0x19')](_0x2a811b);}return null;};}function patchUpdates(_0x220ace){return function(_0x110e96){try{jsonpatch['apply'](_0x110e96,_0x220ace,!![]);}catch(_0x56392f){return BPromise[_0xd992('0x20')](_0x56392f);}return _0x110e96[_0xd992('0x21')]();};}function saveUpdates(_0x4dadf8,_0x487c9e){return function(_0x1140e6){if(_0x1140e6){return _0x1140e6[_0xd992('0x22')](_0x4dadf8)[_0xd992('0x23')](function(_0x5c70e3){return _0x5c70e3;});}return null;};}function removeEntity(_0x99a476,_0x314eae){return function(_0x3f5491){if(_0x3f5491){return _0x3f5491[_0xd992('0x24')]()[_0xd992('0x23')](function(){_0x99a476[_0xd992('0x17')](0xcc)[_0xd992('0x18')]();});}};}function handleEntityNotFound(_0x59546b,_0x4cb9f8){return function(_0x6807df){if(!_0x6807df){_0x59546b['sendStatus'](0x194);}return _0x6807df;};}function handleError(_0xc18e2c,_0x301ef6){_0x301ef6=_0x301ef6||0x1f4;return function(_0x3445f7){logger[_0xd992('0x25')](_0x3445f7['stack']);if(_0x3445f7[_0xd992('0x26')]){delete _0x3445f7[_0xd992('0x26')];}_0xc18e2c[_0xd992('0x17')](_0x301ef6)['send'](_0x3445f7);};}exports[_0xd992('0x27')]=function(_0x2a58ac,_0x3496fe){var _0x187559={},_0x10fece={},_0x41c542={'count':0x0,'rows':[]};var _0x42c439=_[_0xd992('0x28')](db[_0xd992('0x29')][_0xd992('0x2a')],function(_0x193248){return{'name':_0x193248[_0xd992('0x2b')],'type':_0x193248['type'][_0xd992('0x2c')]};});_0x10fece[_0xd992('0x2d')]=_[_0xd992('0x28')](_0x42c439,'name');_0x10fece[_0xd992('0x2e')]=_['keys'](_0x2a58ac[_0xd992('0x2e')]);_0x10fece[_0xd992('0x2f')]=_[_0xd992('0x30')](_0x10fece[_0xd992('0x2d')],_0x10fece['query']);_0x187559['attributes']=_['intersection'](_0x10fece[_0xd992('0x2d')],qs['fields'](_0x2a58ac[_0xd992('0x2e')][_0xd992('0x31')]));_0x187559[_0xd992('0x32')]=_0x187559[_0xd992('0x32')][_0xd992('0x33')]?_0x187559[_0xd992('0x32')]:_0x10fece[_0xd992('0x2d')];if(!_0x2a58ac[_0xd992('0x2e')][_0xd992('0x34')](_0xd992('0x35'))){_0x187559[_0xd992('0x1c')]=qs[_0xd992('0x1c')](_0x2a58ac['query'][_0xd992('0x1c')]);_0x187559[_0xd992('0x1a')]=qs[_0xd992('0x1a')](_0x2a58ac[_0xd992('0x2e')]['offset']);}_0x187559[_0xd992('0x36')]=qs['sort'](_0x2a58ac[_0xd992('0x2e')][_0xd992('0x37')]);_0x187559[_0xd992('0x38')]=qs[_0xd992('0x2f')](_[_0xd992('0x39')](_0x2a58ac[_0xd992('0x2e')],_0x10fece[_0xd992('0x2f')]),_0x42c439);if(_0x2a58ac[_0xd992('0x2e')][_0xd992('0x3a')]){_0x187559[_0xd992('0x38')]=_[_0xd992('0x3b')](_0x187559['where'],{'$or':_['map'](_0x42c439,function(_0x41c01e){if(_0x41c01e[_0xd992('0x3c')]!=='VIRTUAL'){var _0x3361a8={};_0x3361a8[_0x41c01e[_0xd992('0x26')]]={'$like':'%'+_0x2a58ac['query']['filter']+'%'};return _0x3361a8;}})});}_0x187559=_[_0xd992('0x3b')]({},_0x187559,_0x2a58ac[_0xd992('0x3d')]);var _0x4ca7ed={'where':_0x187559[_0xd992('0x38')]};return db[_0xd992('0x29')]['count'](_0x4ca7ed)[_0xd992('0x23')](function(_0x3a869e){_0x41c542[_0xd992('0x1d')]=_0x3a869e;if(_0x2a58ac[_0xd992('0x2e')]['includeAll']){_0x187559[_0xd992('0x3e')]=[{'all':!![]}];}return db[_0xd992('0x29')]['findAll'](_0x187559);})['then'](function(_0x309ac3){_0x41c542[_0xd992('0x3f')]=_0x309ac3;return _0x41c542;})['then'](respondWithFilteredResult(_0x3496fe,_0x187559))[_0xd992('0x40')](handleError(_0x3496fe,null));};exports[_0xd992('0x41')]=function(_0x3d8ba1,_0x1e71bc){var _0x5ade02={'raw':!![],'where':{'id':_0x3d8ba1['params']['id']}},_0x4d0a18={};_0x4d0a18[_0xd992('0x2d')]=_[_0xd992('0x42')](db[_0xd992('0x29')][_0xd992('0x2a')]);_0x4d0a18[_0xd992('0x2e')]=_['keys'](_0x3d8ba1[_0xd992('0x2e')]);_0x4d0a18[_0xd992('0x2f')]=_['intersection'](_0x4d0a18['model'],_0x4d0a18[_0xd992('0x2e')]);_0x5ade02[_0xd992('0x32')]=_[_0xd992('0x30')](_0x4d0a18['model'],qs[_0xd992('0x31')](_0x3d8ba1['query'][_0xd992('0x31')]));_0x5ade02[_0xd992('0x32')]=_0x5ade02['attributes'][_0xd992('0x33')]?_0x5ade02[_0xd992('0x32')]:_0x4d0a18[_0xd992('0x2d')];if(_0x3d8ba1[_0xd992('0x2e')]['includeAll']){_0x5ade02[_0xd992('0x3e')]=[{'all':!![]}];}_0x5ade02=_[_0xd992('0x3b')]({},_0x5ade02,_0x3d8ba1[_0xd992('0x3d')]);return db[_0xd992('0x29')][_0xd992('0x43')](_0x5ade02)['then'](handleEntityNotFound(_0x1e71bc,null))[_0xd992('0x23')](respondWithResult(_0x1e71bc,null))[_0xd992('0x40')](handleError(_0x1e71bc,null));};exports[_0xd992('0x44')]=function(_0x5f12db,_0x5e476f){return db['ZohoField'][_0xd992('0x44')](_0x5f12db['body'],{})['then'](respondWithResult(_0x5e476f,0xc9))[_0xd992('0x40')](handleError(_0x5e476f,null));};exports[_0xd992('0x22')]=function(_0x44456e,_0x1b0128){if(_0x44456e[_0xd992('0x45')]['id']){delete _0x44456e[_0xd992('0x45')]['id'];}return db[_0xd992('0x29')][_0xd992('0x43')]({'where':{'id':_0x44456e[_0xd992('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b0128,null))[_0xd992('0x23')](saveUpdates(_0x44456e[_0xd992('0x45')],null))[_0xd992('0x23')](respondWithResult(_0x1b0128,null))[_0xd992('0x40')](handleError(_0x1b0128,null));};exports[_0xd992('0x24')]=function(_0x26483b,_0x589030){return db['ZohoField'][_0xd992('0x43')]({'where':{'id':_0x26483b['params']['id']}})[_0xd992('0x23')](handleEntityNotFound(_0x589030,null))[_0xd992('0x23')](removeEntity(_0x589030,null))['catch'](handleError(_0x589030,null));}; \ No newline at end of file +var _0x5d45=['keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','params','create','body','find','destroy','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../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','apply','reject','save','update','then','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','model','query'];(function(_0xcb1bec,_0x2453c2){var _0x49c323=function(_0x4b0b20){while(--_0x4b0b20){_0xcb1bec['push'](_0xcb1bec['shift']());}};_0x49c323(++_0x2453c2);}(_0x5d45,0x165));var _0x55d4=function(_0x2a21fb,_0x50ad15){_0x2a21fb=_0x2a21fb-0x0;var _0x4f7128=_0x5d45[_0x2a21fb];return _0x4f7128;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x55d4('0x0'));var jsonpatch=require(_0x55d4('0x1'));var rp=require(_0x55d4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x55d4('0x3'));var sox=require(_0x55d4('0x4'));var csv=require(_0x55d4('0x5'));var ejs=require(_0x55d4('0x6'));var fs=require('fs');var fs_extra=require(_0x55d4('0x7'));var _=require(_0x55d4('0x8'));var squel=require(_0x55d4('0x9'));var crypto=require('crypto');var jsforce=require(_0x55d4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x55d4('0x5'));var querystring=require(_0x55d4('0xb'));var Papa=require(_0x55d4('0xc'));var Redis=require(_0x55d4('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x55d4('0xe'));var hardwareService=require(_0x55d4('0xf'));var logger=require(_0x55d4('0x10'))('api');var utils=require(_0x55d4('0x11'));var config=require(_0x55d4('0x12'));var licenseUtil=require(_0x55d4('0x13'));var db=require(_0x55d4('0x14'))['db'];function respondWithStatusCode(_0x4c0e5d,_0x11a757){_0x11a757=_0x11a757||0xcc;return function(_0x4745cb){if(_0x4745cb){return _0x4c0e5d[_0x55d4('0x15')](_0x11a757);}return _0x4c0e5d[_0x55d4('0x16')](_0x11a757)[_0x55d4('0x17')]();};}function respondWithResult(_0xdd6ce2,_0x19f704){_0x19f704=_0x19f704||0xc8;return function(_0x140dc0){if(_0x140dc0){return _0xdd6ce2['status'](_0x19f704)[_0x55d4('0x18')](_0x140dc0);}};}function respondWithFilteredResult(_0x2ae021,_0x560462){return function(_0x5e3138){if(_0x5e3138){var _0x5ad40e=typeof _0x560462[_0x55d4('0x19')]===_0x55d4('0x1a')&&typeof _0x560462[_0x55d4('0x1b')]===_0x55d4('0x1a');var _0x5cf2bb=_0x5e3138[_0x55d4('0x1c')];var _0x3d8c2b=_0x5ad40e?0x0:_0x560462[_0x55d4('0x19')];var _0x3ffc9f=_0x5ad40e?_0x5e3138['count']:_0x560462[_0x55d4('0x19')]+_0x560462[_0x55d4('0x1b')];var _0x3e71ea;if(_0x3ffc9f>=_0x5cf2bb){_0x3ffc9f=_0x5cf2bb;_0x3e71ea=0xc8;}else{_0x3e71ea=0xce;}_0x2ae021['status'](_0x3e71ea);return _0x2ae021[_0x55d4('0x1d')]('Content-Range',_0x3d8c2b+'-'+_0x3ffc9f+'/'+_0x5cf2bb)[_0x55d4('0x18')](_0x5e3138);}return null;};}function patchUpdates(_0x25d5c4){return function(_0x34283b){try{jsonpatch[_0x55d4('0x1e')](_0x34283b,_0x25d5c4,!![]);}catch(_0x2ede15){return BPromise[_0x55d4('0x1f')](_0x2ede15);}return _0x34283b[_0x55d4('0x20')]();};}function saveUpdates(_0x1260fc,_0x15a3c5){return function(_0x921e2c){if(_0x921e2c){return _0x921e2c[_0x55d4('0x21')](_0x1260fc)['then'](function(_0xc04cf){return _0xc04cf;});}return null;};}function removeEntity(_0x55bbc9,_0x564fc9){return function(_0x4afc5d){if(_0x4afc5d){return _0x4afc5d['destroy']()[_0x55d4('0x22')](function(){_0x55bbc9[_0x55d4('0x16')](0xcc)[_0x55d4('0x17')]();});}};}function handleEntityNotFound(_0x904187,_0x4f9f21){return function(_0x17bf8b){if(!_0x17bf8b){_0x904187[_0x55d4('0x15')](0x194);}return _0x17bf8b;};}function handleError(_0x55bb22,_0x3ddbb1){_0x3ddbb1=_0x3ddbb1||0x1f4;return function(_0x49b4db){logger[_0x55d4('0x23')](_0x49b4db[_0x55d4('0x24')]);if(_0x49b4db['name']){delete _0x49b4db[_0x55d4('0x25')];}_0x55bb22['status'](_0x3ddbb1)['send'](_0x49b4db);};}exports[_0x55d4('0x26')]=function(_0x551ebf,_0x5ef027){var _0x20a2e4={},_0x5c168b={},_0x32f1b4={'count':0x0,'rows':[]};var _0x483e84=_[_0x55d4('0x27')](db[_0x55d4('0x28')][_0x55d4('0x29')],function(_0x5f45af){return{'name':_0x5f45af[_0x55d4('0x2a')],'type':_0x5f45af['type']['key']};});_0x5c168b[_0x55d4('0x2b')]=_[_0x55d4('0x27')](_0x483e84,'name');_0x5c168b[_0x55d4('0x2c')]=_[_0x55d4('0x2d')](_0x551ebf['query']);_0x5c168b[_0x55d4('0x2e')]=_['intersection'](_0x5c168b[_0x55d4('0x2b')],_0x5c168b[_0x55d4('0x2c')]);_0x20a2e4['attributes']=_[_0x55d4('0x2f')](_0x5c168b[_0x55d4('0x2b')],qs[_0x55d4('0x30')](_0x551ebf[_0x55d4('0x2c')][_0x55d4('0x30')]));_0x20a2e4[_0x55d4('0x31')]=_0x20a2e4[_0x55d4('0x31')][_0x55d4('0x32')]?_0x20a2e4[_0x55d4('0x31')]:_0x5c168b[_0x55d4('0x2b')];if(!_0x551ebf['query']['hasOwnProperty'](_0x55d4('0x33'))){_0x20a2e4[_0x55d4('0x1b')]=qs[_0x55d4('0x1b')](_0x551ebf[_0x55d4('0x2c')][_0x55d4('0x1b')]);_0x20a2e4[_0x55d4('0x19')]=qs['offset'](_0x551ebf[_0x55d4('0x2c')][_0x55d4('0x19')]);}_0x20a2e4['order']=qs['sort'](_0x551ebf[_0x55d4('0x2c')][_0x55d4('0x34')]);_0x20a2e4[_0x55d4('0x35')]=qs[_0x55d4('0x2e')](_[_0x55d4('0x36')](_0x551ebf[_0x55d4('0x2c')],_0x5c168b[_0x55d4('0x2e')]),_0x483e84);if(_0x551ebf[_0x55d4('0x2c')][_0x55d4('0x37')]){_0x20a2e4[_0x55d4('0x35')]=_[_0x55d4('0x38')](_0x20a2e4['where'],{'$or':_['map'](_0x483e84,function(_0x11adc0){if(_0x11adc0[_0x55d4('0x39')]!=='VIRTUAL'){var _0x1a1004={};_0x1a1004[_0x11adc0['name']]={'$like':'%'+_0x551ebf['query'][_0x55d4('0x37')]+'%'};return _0x1a1004;}})});}_0x20a2e4=_['merge']({},_0x20a2e4,_0x551ebf['options']);var _0x20d49f={'where':_0x20a2e4['where']};return db[_0x55d4('0x28')][_0x55d4('0x1c')](_0x20d49f)[_0x55d4('0x22')](function(_0x37f6e3){_0x32f1b4[_0x55d4('0x1c')]=_0x37f6e3;if(_0x551ebf[_0x55d4('0x2c')][_0x55d4('0x3a')]){_0x20a2e4[_0x55d4('0x3b')]=[{'all':!![]}];}return db[_0x55d4('0x28')][_0x55d4('0x3c')](_0x20a2e4);})[_0x55d4('0x22')](function(_0x3bd7da){_0x32f1b4['rows']=_0x3bd7da;return _0x32f1b4;})[_0x55d4('0x22')](respondWithFilteredResult(_0x5ef027,_0x20a2e4))[_0x55d4('0x3d')](handleError(_0x5ef027,null));};exports['show']=function(_0x202579,_0x205b69){var _0x60177b={'raw':!![],'where':{'id':_0x202579[_0x55d4('0x3e')]['id']}},_0x1fece6={};_0x1fece6['model']=_[_0x55d4('0x2d')](db['ZohoField'][_0x55d4('0x29')]);_0x1fece6[_0x55d4('0x2c')]=_['keys'](_0x202579['query']);_0x1fece6['filters']=_[_0x55d4('0x2f')](_0x1fece6[_0x55d4('0x2b')],_0x1fece6[_0x55d4('0x2c')]);_0x60177b[_0x55d4('0x31')]=_[_0x55d4('0x2f')](_0x1fece6[_0x55d4('0x2b')],qs[_0x55d4('0x30')](_0x202579['query']['fields']));_0x60177b[_0x55d4('0x31')]=_0x60177b[_0x55d4('0x31')][_0x55d4('0x32')]?_0x60177b[_0x55d4('0x31')]:_0x1fece6[_0x55d4('0x2b')];if(_0x202579[_0x55d4('0x2c')]['includeAll']){_0x60177b[_0x55d4('0x3b')]=[{'all':!![]}];}_0x60177b=_[_0x55d4('0x38')]({},_0x60177b,_0x202579['options']);return db[_0x55d4('0x28')]['find'](_0x60177b)[_0x55d4('0x22')](handleEntityNotFound(_0x205b69,null))[_0x55d4('0x22')](respondWithResult(_0x205b69,null))[_0x55d4('0x3d')](handleError(_0x205b69,null));};exports[_0x55d4('0x3f')]=function(_0x2a5044,_0x83a7c2){return db['ZohoField'][_0x55d4('0x3f')](_0x2a5044[_0x55d4('0x40')],{})[_0x55d4('0x22')](respondWithResult(_0x83a7c2,0xc9))[_0x55d4('0x3d')](handleError(_0x83a7c2,null));};exports['update']=function(_0x33e545,_0x5b616a){if(_0x33e545[_0x55d4('0x40')]['id']){delete _0x33e545[_0x55d4('0x40')]['id'];}return db[_0x55d4('0x28')][_0x55d4('0x41')]({'where':{'id':_0x33e545['params']['id']}})['then'](handleEntityNotFound(_0x5b616a,null))[_0x55d4('0x22')](saveUpdates(_0x33e545['body'],null))[_0x55d4('0x22')](respondWithResult(_0x5b616a,null))[_0x55d4('0x3d')](handleError(_0x5b616a,null));};exports[_0x55d4('0x42')]=function(_0x469668,_0x2ba1cd){return db[_0x55d4('0x28')][_0x55d4('0x41')]({'where':{'id':_0x469668[_0x55d4('0x3e')]['id']}})[_0x55d4('0x22')](handleEntityNotFound(_0x2ba1cd,null))[_0x55d4('0x22')](removeEntity(_0x2ba1cd,null))[_0x55d4('0x3d')](handleError(_0x2ba1cd,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a3720fc..b3e526e 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 _0x7a54=['int_zoho_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0x44cb95,_0x5dfeee){var _0x1316d5=function(_0x332861){while(--_0x332861){_0x44cb95['push'](_0x44cb95['shift']());}};_0x1316d5(++_0x5dfeee);}(_0x7a54,0x106));var _0x47a5=function(_0x58d7a1,_0x4ee905){_0x58d7a1=_0x58d7a1-0x0;var _0x411c64=_0x7a54[_0x58d7a1];return _0x411c64;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2272=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports'];(function(_0x2739d9,_0x9d6e34){var _0xe7a648=function(_0x1b744d){while(--_0x1b744d){_0x2739d9['push'](_0x2739d9['shift']());}};_0xe7a648(++_0x9d6e34);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var logger=require(_0x2227('0x2'))(_0x2227('0x3'));var moment=require(_0x2227('0x4'));var BPromise=require('bluebird');var rp=require(_0x2227('0x5'));var fs=require('fs');var path=require(_0x2227('0x6'));var rimraf=require(_0x2227('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x2227('0x8')]=function(_0x3b8661,_0xb33647){return _0x3b8661[_0x2227('0x9')](_0x2227('0xa'),attributes,{'tableName':_0x2227('0xb'),'paranoid':![],'indexes':[{'name':_0x2227('0xc'),'fields':[_0x2227('0xd'),_0x2227('0xe')],'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 0682d9b..6aaadf6 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 _0x7eed=['code','ZohoField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7eed,0x190));var _0xd7ee=function(_0x2d034d,_0x532a40){_0x2d034d=_0x2d034d-0x0;var _0x286474=_0x7eed[_0x2d034d];return _0x286474;};'use strict';var _=require(_0xd7ee('0x0'));var util=require('util');var moment=require(_0xd7ee('0x1'));var BPromise=require(_0xd7ee('0x2'));var rs=require(_0xd7ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7ee('0x5'))(_0xd7ee('0x6'));var config=require(_0xd7ee('0x7'));var jayson=require(_0xd7ee('0x8'));var client=jayson['client'][_0xd7ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31ffdd,_0x5a6e9b,_0x5e53fe){return new BPromise(function(_0x13600e,_0x492997){return client[_0xd7ee('0xa')](_0x31ffdd,_0x5e53fe)[_0xd7ee('0xb')](function(_0x108632){logger[_0xd7ee('0xc')]('ZohoField,\x20%s,\x20%s',_0x5a6e9b,_0xd7ee('0xd'));logger[_0xd7ee('0xe')](_0xd7ee('0xf'),_0x5a6e9b,_0xd7ee('0xd'),JSON[_0xd7ee('0x10')](_0x108632));if(_0x108632[_0xd7ee('0x11')]){if(_0x108632[_0xd7ee('0x11')][_0xd7ee('0x12')]===0x1f4){logger[_0xd7ee('0x11')](_0xd7ee('0x13'),_0x5a6e9b,_0x108632[_0xd7ee('0x11')][_0xd7ee('0x14')]);return _0x492997(_0x108632[_0xd7ee('0x11')]['message']);}logger[_0xd7ee('0x11')](_0xd7ee('0x13'),_0x5a6e9b,_0x108632[_0xd7ee('0x11')][_0xd7ee('0x14')]);return _0x13600e(_0x108632[_0xd7ee('0x11')][_0xd7ee('0x14')]);}else{logger['info'](_0xd7ee('0x13'),_0x5a6e9b,'request\x20sent');_0x13600e(_0x108632['result'][_0xd7ee('0x14')]);}})[_0xd7ee('0x15')](function(_0x83137){logger['error'](_0xd7ee('0x13'),_0x5a6e9b,_0x83137);_0x492997(_0x83137);});});} \ No newline at end of file +var _0xad90=['../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3df4d5,_0x5da3e9){var _0x2942ec=function(_0x385f82){while(--_0x385f82){_0x3df4d5['push'](_0x3df4d5['shift']());}};_0x2942ec(++_0x5da3e9);}(_0xad90,0x6c));var _0x0ad9=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xad90[_0x46f1a6];return _0x38429a;};'use strict';var _=require(_0x0ad9('0x0'));var util=require('util');var moment=require(_0x0ad9('0x1'));var BPromise=require(_0x0ad9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ad9('0x3'))['db'];var utils=require(_0x0ad9('0x4'));var logger=require(_0x0ad9('0x5'))(_0x0ad9('0x6'));var config=require(_0x0ad9('0x7'));var jayson=require(_0x0ad9('0x8'));var client=jayson[_0x0ad9('0x9')][_0x0ad9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x580b04,_0x554cc1,_0x22c8fb){return new BPromise(function(_0x18ec3e,_0x2b9eb3){return client[_0x0ad9('0xb')](_0x580b04,_0x22c8fb)['then'](function(_0x4fd9ba){logger[_0x0ad9('0xc')](_0x0ad9('0xd'),_0x554cc1,_0x0ad9('0xe'));logger[_0x0ad9('0xf')](_0x0ad9('0x10'),_0x554cc1,_0x0ad9('0xe'),JSON[_0x0ad9('0x11')](_0x4fd9ba));if(_0x4fd9ba[_0x0ad9('0x12')]){if(_0x4fd9ba[_0x0ad9('0x12')][_0x0ad9('0x13')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x554cc1,_0x4fd9ba['error']['message']);return _0x2b9eb3(_0x4fd9ba[_0x0ad9('0x12')][_0x0ad9('0x14')]);}logger[_0x0ad9('0x12')](_0x0ad9('0xd'),_0x554cc1,_0x4fd9ba[_0x0ad9('0x12')][_0x0ad9('0x14')]);return _0x18ec3e(_0x4fd9ba[_0x0ad9('0x12')][_0x0ad9('0x14')]);}else{logger[_0x0ad9('0xc')](_0x0ad9('0xd'),_0x554cc1,'request\x20sent');_0x18ec3e(_0x4fd9ba[_0x0ad9('0x15')]['message']);}})[_0x0ad9('0x16')](function(_0x20f164){logger[_0x0ad9('0x12')](_0x0ad9('0xd'),_0x554cc1,_0x20f164);_0x2b9eb3(_0x20f164);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index bfaf5ac..0651a1c 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2e253a,_0x34ab6a){var _0x30142a=function(_0x2fbdf1){while(--_0x2fbdf1){_0x2e253a['push'](_0x2e253a['shift']());}};_0x30142a(++_0x34ab6a);}(_0x70e0,0x17b));var _0x070e=function(_0x495e4e,_0x4c0b10){_0x495e4e=_0x495e4e-0x0;var _0x46ab0c=_0x70e0[_0x495e4e];return _0x46ab0c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3440a4,_0x32c12c){var _0x5db7d6=function(_0x11fe60){while(--_0x11fe60){_0x3440a4['push'](_0x3440a4['shift']());}};_0x5db7d6(++_0x32c12c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 531bda3..5fc1c96 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 _0x9ae6=['unique_name_and_version','INTEGER','state','sequelize','exports','STRING'];(function(_0x3b28c2,_0x3a71a1){var _0x485208=function(_0x1ae6f2){while(--_0x1ae6f2){_0x3b28c2['push'](_0x3b28c2['shift']());}};_0x485208(++_0x3a71a1);}(_0x9ae6,0x177));var _0x69ae=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x9ae6[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require(_0x69ae('0x0'));module[_0x69ae('0x1')]={'name':{'type':Sequelize[_0x69ae('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x69ae('0x2')],'allowNull':![],'unique':_0x69ae('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x69ae('0x2')]},'path':{'type':Sequelize[_0x69ae('0x2')]},'type':{'type':Sequelize[_0x69ae('0x2')]},'size':{'type':Sequelize[_0x69ae('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x69ae('0x2')]},'logo':{'type':Sequelize[_0x69ae('0x2')]},'state':{'type':Sequelize[_0x69ae('0x2')],'unique':_0x69ae('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x69ae('0x2')]},'remoteUri':{'type':Sequelize[_0x69ae('0x2')]},'link':{'type':Sequelize[_0x69ae('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x6a53=['STRING','unique_name_and_version','app.js','INTEGER','state'];(function(_0xb8111f,_0x2b0a3b){var _0x233d1b=function(_0x416f63){while(--_0x416f63){_0xb8111f['push'](_0xb8111f['shift']());}};_0x233d1b(++_0x2b0a3b);}(_0x6a53,0x1ef));var _0x36a5=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0x6a53[_0x3c4016];return _0x3cebbd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x36a5('0x0')],'allowNull':![],'unique':_0x36a5('0x1')},'version':{'type':Sequelize[_0x36a5('0x0')],'allowNull':![],'unique':_0x36a5('0x1')},'main':{'type':Sequelize[_0x36a5('0x0')],'defaultValue':_0x36a5('0x2')},'filename':{'type':Sequelize[_0x36a5('0x0')]},'path':{'type':Sequelize[_0x36a5('0x0')]},'type':{'type':Sequelize[_0x36a5('0x0')]},'size':{'type':Sequelize[_0x36a5('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x36a5('0x0')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x36a5('0x0')],'unique':_0x36a5('0x4')},'description':{'type':Sequelize[_0x36a5('0x0')]},'title':{'type':Sequelize[_0x36a5('0x0')]},'remoteUri':{'type':Sequelize[_0x36a5('0x0')]},'link':{'type':Sequelize[_0x36a5('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ee8d6dc..f511467 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 _0x2542=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x23b57c,_0xdc7f98){var _0x4c3b1d=function(_0x283147){while(--_0x283147){_0x23b57c['push'](_0x23b57c['shift']());}};_0x4c3b1d(++_0xdc7f98);}(_0x2542,0x169));var _0x2254=function(_0x52a0b3,_0x1130f1){_0x52a0b3=_0x52a0b3-0x0;var _0x26244c=_0x2542[_0x52a0b3];return _0x26244c;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['Integration'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));}; \ No newline at end of file +var _0x430c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3e7b59,_0x14a4cd){var _0x4bd64a=function(_0x144656){while(--_0x144656){_0x3e7b59['push'](_0x3e7b59['shift']());}};_0x4bd64a(++_0x14a4cd);}(_0x430c,0x1a1));var _0xc430=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0x430c[_0x43026b];return _0x4a96cd;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index cd026ac..86c6adc 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 _0x9005=['request-promise','../../config/environment','exports','integrations','util','../../config/logger','moment','bluebird'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x9005,0x19c));var _0x5900=function(_0x3fd0e3,_0x48d51a){_0x3fd0e3=_0x3fd0e3-0x0;var _0x25c1cc=_0x9005[_0x3fd0e3];return _0x25c1cc;};'use strict';var _=require('lodash');var util=require(_0x5900('0x0'));var logger=require(_0x5900('0x1'))('api');var moment=require(_0x5900('0x2'));var BPromise=require(_0x5900('0x3'));var rp=require(_0x5900('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5900('0x5'));var attributes=require('./integration.attributes');module[_0x5900('0x6')]=function(_0x37d595,_0x48962e){return _0x37d595['define']('Integration',attributes,{'tableName':_0x5900('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4822=['api','moment','bluebird','path','rimraf','exports','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x229445,_0x59ed67){var _0x8e8878=function(_0x18fbd4){while(--_0x18fbd4){_0x229445['push'](_0x229445['shift']());}};_0x8e8878(++_0x59ed67);}(_0x4822,0x99));var _0x2482=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x4822[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x2482('0x0'));var util=require(_0x2482('0x1'));var logger=require(_0x2482('0x2'))(_0x2482('0x3'));var moment=require(_0x2482('0x4'));var BPromise=require(_0x2482('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2482('0x6'));var rimraf=require(_0x2482('0x7'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x2482('0x8')]=function(_0x5ba7f2,_0x9cd324){return _0x5ba7f2[_0x2482('0x9')](_0x2482('0xa'),attributes,{'tableName':_0x2482('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index ad6b149..1d44c1d 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 _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0x0b0e,0x187));var _0xe0b0=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x0b0e[_0x43a5c7];return _0x3b12a2;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x143aa4,_0x1f4af4){var _0xc9d11=function(_0x4c6dc3){while(--_0x4c6dc3){_0x143aa4['push'](_0x143aa4['shift']());}};_0xc9d11(++_0x1f4af4);}(_0x2542,0x169));var _0x2254=function(_0xb23018,_0x1ea35d){_0xb23018=_0xb23018-0x0;var _0x2687a8=_0x2542[_0xb23018];return _0x2687a8;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1fc2766..71f00ed 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 _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x1fa3f4,_0x56868e){var _0x491768=function(_0x162309){while(--_0x162309){_0x1fa3f4['push'](_0x1fa3f4['shift']());}};_0x491768(++_0x56868e);}(_0x1a85,0x178));var _0x51a8=function(_0x148785,_0x195ee5){_0x148785=_0x148785-0x0;var _0x17a172=_0x1a85[_0x148785];return _0x17a172;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file +var _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1c5dec,_0x930fd3){var _0xee8b88=function(_0x4a6fb5){while(--_0x4a6fb5){_0x1c5dec['push'](_0x1c5dec['shift']());}};_0xee8b88(++_0x930fd3);}(_0x955f,0x1eb));var _0xf955=function(_0x30f8ff,_0x4f260a){_0x30f8ff=_0x30f8ff-0x0;var _0x28449e=_0x955f[_0x30f8ff];return _0x28449e;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index aecda81..a42d488 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 _0x5301=['BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE'];(function(_0x475bf3,_0x5d06a1){var _0x5a9859=function(_0x515052){while(--_0x515052){_0x475bf3['push'](_0x475bf3['shift']());}};_0x5a9859(++_0x5d06a1);}(_0x5301,0x16e));var _0x1530=function(_0x8f6e,_0x2cb44e){_0x8f6e=_0x8f6e-0x0;var _0x2c2112=_0x5301[_0x8f6e];return _0x2c2112;};'use strict';var Sequelize=require(_0x1530('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x1530('0x1')]},'ticketId':{'type':Sequelize[_0x1530('0x1')]},'integrationId':{'type':Sequelize[_0x1530('0x2')]},'contacts':{'type':Sequelize[_0x1530('0x1')]},'uniqueid':{'type':Sequelize[_0x1530('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1530('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1530('0x1')]},'membername':{'type':Sequelize[_0x1530('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1530('0x3')]},'holdtime':{'type':Sequelize[_0x1530('0x2')]},'agentcomplete':{'type':Sequelize[_0x1530('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x1530('0x2')]},'agentacw':{'type':Sequelize[_0x1530('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1530('0x2')]},'reason':{'type':Sequelize[_0x1530('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x1530('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1530('0x3')]},'agentdump':{'type':Sequelize[_0x1530('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1530('0x3')]},'lastevent':{'type':Sequelize[_0x1530('0x1')]},'channel':{'type':Sequelize[_0x1530('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1530('0x1')]},'connectedlinenum':{'type':Sequelize[_0x1530('0x1')]},'connectedlinename':{'type':Sequelize[_0x1530('0x1')]},'language':{'type':Sequelize[_0x1530('0x1')]},'accountcode':{'type':Sequelize[_0x1530('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1530('0x1')]},'priority':{'type':Sequelize[_0x1530('0x1')]},'destchannel':{'type':Sequelize[_0x1530('0x1')]},'destchannelstate':{'type':Sequelize[_0x1530('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x1530('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x1530('0x1')]},'destlanguage':{'type':Sequelize[_0x1530('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1530('0x1')]},'destexten':{'type':Sequelize[_0x1530('0x1')]},'destpriority':{'type':Sequelize[_0x1530('0x1')]},'destuniqueid':{'type':Sequelize[_0x1530('0x1')]},'messageId':{'type':Sequelize[_0x1530('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x1530('0x1')]},'from':{'type':Sequelize[_0x1530('0x1')]},'to':{'type':Sequelize[_0x1530('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x1530('0x5')]},'html':{'type':Sequelize[_0x1530('0x5')]},'text':{'type':Sequelize[_0x1530('0x5')]},'status':{'type':Sequelize[_0x1530('0x6')](_0x1530('0x7'),'SENDING',_0x1530('0x8'),_0x1530('0x9'))},'url':{'type':Sequelize[_0x1530('0x1')]},'app':{'type':Sequelize[_0x1530('0x1')]},'appdata':{'type':Sequelize[_0x1530('0x1')]},'projectId':{'type':Sequelize[_0x1530('0x2')]}}; \ No newline at end of file +var _0x42d8=['TEXT','SENDING','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x24b897,_0x38df26){var _0x522698=function(_0x1757a3){while(--_0x1757a3){_0x24b897['push'](_0x24b897['shift']());}};_0x522698(++_0x38df26);}(_0x42d8,0xaa));var _0x842d=function(_0x20a001,_0x326e17){_0x20a001=_0x20a001-0x0;var _0x3d0500=_0x42d8[_0x20a001];return _0x3d0500;};'use strict';var Sequelize=require(_0x842d('0x0'));module[_0x842d('0x1')]={'integration':{'type':Sequelize[_0x842d('0x2')]},'eventChannel':{'type':Sequelize[_0x842d('0x2')]},'exitStatus':{'type':Sequelize[_0x842d('0x2')]},'ticketId':{'type':Sequelize[_0x842d('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x842d('0x2')]},'uniqueid':{'type':Sequelize[_0x842d('0x2')]},'calleridnum':{'type':Sequelize[_0x842d('0x2')]},'calleridname':{'type':Sequelize[_0x842d('0x2')]},'queue':{'type':Sequelize[_0x842d('0x2')]},'interface':{'type':Sequelize[_0x842d('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x842d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x842d('0x3')]},'holdtime':{'type':Sequelize[_0x842d('0x4')]},'agentcomplete':{'type':Sequelize[_0x842d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x842d('0x3')]},'talktime':{'type':Sequelize[_0x842d('0x4')]},'agentacw':{'type':Sequelize[_0x842d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x842d('0x4')]},'reason':{'type':Sequelize[_0x842d('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x842d('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x842d('0x3')]},'lastevent':{'type':Sequelize[_0x842d('0x2')]},'channel':{'type':Sequelize[_0x842d('0x2')]},'channelstate':{'type':Sequelize[_0x842d('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x842d('0x2')]},'connectedlinename':{'type':Sequelize[_0x842d('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x842d('0x2')]},'context':{'type':Sequelize[_0x842d('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x842d('0x2')]},'destchannelstate':{'type':Sequelize[_0x842d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x842d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x842d('0x2')]},'destcalleridname':{'type':Sequelize[_0x842d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x842d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x842d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x842d('0x2')]},'destcontext':{'type':Sequelize[_0x842d('0x2')]},'destexten':{'type':Sequelize[_0x842d('0x2')]},'destpriority':{'type':Sequelize[_0x842d('0x2')]},'destuniqueid':{'type':Sequelize[_0x842d('0x2')]},'messageId':{'type':Sequelize[_0x842d('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x842d('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x842d('0x2')]},'attachment':{'type':Sequelize[_0x842d('0x6')]},'html':{'type':Sequelize[_0x842d('0x6')]},'text':{'type':Sequelize[_0x842d('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x842d('0x7'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x842d('0x2')]},'app':{'type':Sequelize[_0x842d('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x842d('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c54bf5b..494386a 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 _0xfe50=['apply','reject','save','update','then','error','stack','name','send','map','IntegrationReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','merge','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','body','destroy','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range'];(function(_0x3a5f55,_0x58494d){var _0xe3a467=function(_0x4ec82c){while(--_0x4ec82c){_0x3a5f55['push'](_0x3a5f55['shift']());}};_0xe3a467(++_0x58494d);}(_0xfe50,0x16b));var _0x0fe5=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xfe50[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x0fe5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fe5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fe5('0x2'));var moment=require('moment');var BPromise=require(_0x0fe5('0x3'));var Mustache=require(_0x0fe5('0x4'));var util=require(_0x0fe5('0x5'));var path=require(_0x0fe5('0x6'));var sox=require(_0x0fe5('0x7'));var csv=require(_0x0fe5('0x8'));var ejs=require(_0x0fe5('0x9'));var fs=require('fs');var fs_extra=require(_0x0fe5('0xa'));var _=require(_0x0fe5('0xb'));var squel=require(_0x0fe5('0xc'));var crypto=require(_0x0fe5('0xd'));var jsforce=require(_0x0fe5('0xe'));var deskjs=require(_0x0fe5('0xf'));var toCsv=require(_0x0fe5('0x8'));var querystring=require(_0x0fe5('0x10'));var Papa=require(_0x0fe5('0x11'));var Redis=require(_0x0fe5('0x12'));var authService=require(_0x0fe5('0x13'));var qs=require(_0x0fe5('0x14'));var as=require(_0x0fe5('0x15'));var hardwareService=require(_0x0fe5('0x16'));var logger=require(_0x0fe5('0x17'))(_0x0fe5('0x18'));var utils=require(_0x0fe5('0x19'));var config=require(_0x0fe5('0x1a'));var licenseUtil=require(_0x0fe5('0x1b'));var db=require(_0x0fe5('0x1c'))['db'];function respondWithStatusCode(_0xe9e4f,_0x1feb92){_0x1feb92=_0x1feb92||0xcc;return function(_0x3226c2){if(_0x3226c2){return _0xe9e4f[_0x0fe5('0x1d')](_0x1feb92);}return _0xe9e4f[_0x0fe5('0x1e')](_0x1feb92)['end']();};}function respondWithResult(_0x57bb69,_0x1c1a0a){_0x1c1a0a=_0x1c1a0a||0xc8;return function(_0x4f5913){if(_0x4f5913){return _0x57bb69[_0x0fe5('0x1e')](_0x1c1a0a)[_0x0fe5('0x1f')](_0x4f5913);}};}function respondWithFilteredResult(_0x2ffab0,_0x3d22c9){return function(_0x254a55){if(_0x254a55){var _0x4bfcdb=typeof _0x3d22c9['offset']===_0x0fe5('0x20')&&typeof _0x3d22c9['limit']==='undefined';var _0x53500a=_0x254a55[_0x0fe5('0x21')];var _0x110557=_0x4bfcdb?0x0:_0x3d22c9[_0x0fe5('0x22')];var _0x56bb56=_0x4bfcdb?_0x254a55[_0x0fe5('0x21')]:_0x3d22c9[_0x0fe5('0x22')]+_0x3d22c9['limit'];var _0x5b099c;if(_0x56bb56>=_0x53500a){_0x56bb56=_0x53500a;_0x5b099c=0xc8;}else{_0x5b099c=0xce;}_0x2ffab0['status'](_0x5b099c);return _0x2ffab0[_0x0fe5('0x23')](_0x0fe5('0x24'),_0x110557+'-'+_0x56bb56+'/'+_0x53500a)[_0x0fe5('0x1f')](_0x254a55);}return null;};}function patchUpdates(_0xacf767){return function(_0x3cdace){try{jsonpatch[_0x0fe5('0x25')](_0x3cdace,_0xacf767,!![]);}catch(_0x47f7b9){return BPromise[_0x0fe5('0x26')](_0x47f7b9);}return _0x3cdace[_0x0fe5('0x27')]();};}function saveUpdates(_0x5bdbc6,_0x32ca7a){return function(_0x1f66fb){if(_0x1f66fb){return _0x1f66fb[_0x0fe5('0x28')](_0x5bdbc6)[_0x0fe5('0x29')](function(_0x5ae013){return _0x5ae013;});}return null;};}function removeEntity(_0x48db8e,_0x1e6fd7){return function(_0x592ad6){if(_0x592ad6){return _0x592ad6['destroy']()[_0x0fe5('0x29')](function(){_0x48db8e[_0x0fe5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a6a0,_0x333367){return function(_0x2fcffc){if(!_0x2fcffc){_0x38a6a0[_0x0fe5('0x1d')](0x194);}return _0x2fcffc;};}function handleError(_0xda8c04,_0x3fd102){_0x3fd102=_0x3fd102||0x1f4;return function(_0x3cf45e){logger[_0x0fe5('0x2a')](_0x3cf45e[_0x0fe5('0x2b')]);if(_0x3cf45e[_0x0fe5('0x2c')]){delete _0x3cf45e[_0x0fe5('0x2c')];}_0xda8c04['status'](_0x3fd102)[_0x0fe5('0x2d')](_0x3cf45e);};}exports['index']=function(_0x13a261,_0x3d3742){var _0x58b7b9={},_0x565865={},_0x33ef3a={'count':0x0,'rows':[]};var _0x5811a8=_[_0x0fe5('0x2e')](db[_0x0fe5('0x2f')]['rawAttributes'],function(_0x36f060){return{'name':_0x36f060[_0x0fe5('0x30')],'type':_0x36f060['type'][_0x0fe5('0x31')]};});_0x565865[_0x0fe5('0x32')]=_[_0x0fe5('0x2e')](_0x5811a8,_0x0fe5('0x2c'));_0x565865[_0x0fe5('0x33')]=_[_0x0fe5('0x34')](_0x13a261[_0x0fe5('0x33')]);_0x565865[_0x0fe5('0x35')]=_['intersection'](_0x565865[_0x0fe5('0x32')],_0x565865[_0x0fe5('0x33')]);_0x58b7b9['attributes']=_[_0x0fe5('0x36')](_0x565865[_0x0fe5('0x32')],qs['fields'](_0x13a261[_0x0fe5('0x33')][_0x0fe5('0x37')]));_0x58b7b9[_0x0fe5('0x38')]=_0x58b7b9[_0x0fe5('0x38')]['length']?_0x58b7b9[_0x0fe5('0x38')]:_0x565865[_0x0fe5('0x32')];if(!_0x13a261['query'][_0x0fe5('0x39')](_0x0fe5('0x3a'))){_0x58b7b9['limit']=qs[_0x0fe5('0x3b')](_0x13a261[_0x0fe5('0x33')][_0x0fe5('0x3b')]);_0x58b7b9[_0x0fe5('0x22')]=qs[_0x0fe5('0x22')](_0x13a261[_0x0fe5('0x33')]['offset']);}_0x58b7b9[_0x0fe5('0x3c')]=qs[_0x0fe5('0x3d')](_0x13a261[_0x0fe5('0x33')][_0x0fe5('0x3d')]);_0x58b7b9['where']=qs[_0x0fe5('0x35')](_[_0x0fe5('0x3e')](_0x13a261[_0x0fe5('0x33')],_0x565865[_0x0fe5('0x35')]),_0x5811a8);if(_0x13a261['query'][_0x0fe5('0x3f')]){_0x58b7b9[_0x0fe5('0x40')]=_['merge'](_0x58b7b9[_0x0fe5('0x40')],{'$or':_[_0x0fe5('0x2e')](_0x5811a8,function(_0x5ccecc){if(_0x5ccecc[_0x0fe5('0x41')]!=='VIRTUAL'){var _0x359d81={};_0x359d81[_0x5ccecc[_0x0fe5('0x2c')]]={'$like':'%'+_0x13a261['query'][_0x0fe5('0x3f')]+'%'};return _0x359d81;}})});}_0x58b7b9=_[_0x0fe5('0x42')]({},_0x58b7b9,_0x13a261['options']);var _0x164a9f={'where':_0x58b7b9['where']};return db['IntegrationReport'][_0x0fe5('0x21')](_0x164a9f)[_0x0fe5('0x29')](function(_0x53efb3){_0x33ef3a['count']=_0x53efb3;if(_0x13a261[_0x0fe5('0x33')][_0x0fe5('0x43')]){_0x58b7b9[_0x0fe5('0x44')]=[{'all':!![]}];}return db['IntegrationReport'][_0x0fe5('0x45')](_0x58b7b9);})[_0x0fe5('0x29')](function(_0x3f8a86){_0x33ef3a['rows']=_0x3f8a86;return _0x33ef3a;})[_0x0fe5('0x29')](respondWithFilteredResult(_0x3d3742,_0x58b7b9))[_0x0fe5('0x46')](handleError(_0x3d3742,null));};exports[_0x0fe5('0x47')]=function(_0x22cb8e,_0x7c050e){var _0x40b7e4={'raw':![],'where':{'id':_0x22cb8e[_0x0fe5('0x48')]['id']}},_0x4284db={};_0x4284db[_0x0fe5('0x32')]=_[_0x0fe5('0x34')](db[_0x0fe5('0x2f')][_0x0fe5('0x49')]);_0x4284db['query']=_['keys'](_0x22cb8e[_0x0fe5('0x33')]);_0x4284db[_0x0fe5('0x35')]=_[_0x0fe5('0x36')](_0x4284db[_0x0fe5('0x32')],_0x4284db['query']);_0x40b7e4[_0x0fe5('0x38')]=_['intersection'](_0x4284db[_0x0fe5('0x32')],qs[_0x0fe5('0x37')](_0x22cb8e[_0x0fe5('0x33')][_0x0fe5('0x37')]));_0x40b7e4['attributes']=_0x40b7e4[_0x0fe5('0x38')][_0x0fe5('0x4a')]?_0x40b7e4['attributes']:_0x4284db[_0x0fe5('0x32')];if(_0x22cb8e[_0x0fe5('0x33')][_0x0fe5('0x43')]){_0x40b7e4[_0x0fe5('0x44')]=[{'all':!![]}];}_0x40b7e4=_[_0x0fe5('0x42')]({},_0x40b7e4,_0x22cb8e[_0x0fe5('0x4b')]);return db[_0x0fe5('0x2f')][_0x0fe5('0x4c')](_0x40b7e4)['then'](handleEntityNotFound(_0x7c050e,null))[_0x0fe5('0x29')](respondWithResult(_0x7c050e,null))['catch'](handleError(_0x7c050e,null));};exports['create']=function(_0x434944,_0x402ad1){return db['IntegrationReport']['create'](_0x434944[_0x0fe5('0x4d')],{})[_0x0fe5('0x29')](respondWithResult(_0x402ad1,0xc9))[_0x0fe5('0x46')](handleError(_0x402ad1,null));};exports['update']=function(_0x4ef161,_0x926aeb){if(_0x4ef161[_0x0fe5('0x4d')]['id']){delete _0x4ef161[_0x0fe5('0x4d')]['id'];}return db[_0x0fe5('0x2f')][_0x0fe5('0x4c')]({'where':{'id':_0x4ef161[_0x0fe5('0x48')]['id']}})['then'](handleEntityNotFound(_0x926aeb,null))[_0x0fe5('0x29')](saveUpdates(_0x4ef161['body'],null))['then'](respondWithResult(_0x926aeb,null))[_0x0fe5('0x46')](handleError(_0x926aeb,null));};exports[_0x0fe5('0x4e')]=function(_0xcddc66,_0x12352b){return db[_0x0fe5('0x2f')][_0x0fe5('0x4c')]({'where':{'id':_0xcddc66['params']['id']}})[_0x0fe5('0x29')](handleEntityNotFound(_0x12352b,null))[_0x0fe5('0x29')](removeEntity(_0x12352b,null))[_0x0fe5('0x46')](handleError(_0x12352b,null));};exports[_0x0fe5('0x4f')]=function(_0x6b6a1e,_0x1877df){return db[_0x0fe5('0x2f')][_0x0fe5('0x4f')]()[_0x0fe5('0x29')](respondWithResult(_0x1877df,null))['catch'](handleError(_0x1877df,null));}; \ No newline at end of file +var _0x1d3d=['index','map','IntegrationReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','name'];(function(_0x201a6e,_0x495ce2){var _0x5909ca=function(_0x55b8d9){while(--_0x55b8d9){_0x201a6e['push'](_0x201a6e['shift']());}};_0x5909ca(++_0x495ce2);}(_0x1d3d,0x188));var _0xd1d3=function(_0x5b9c9e,_0x19730e){_0x5b9c9e=_0x5b9c9e-0x0;var _0x58f3d5=_0x1d3d[_0x5b9c9e];return _0x58f3d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd1d3('0x0'));var zipdir=require(_0xd1d3('0x1'));var jsonpatch=require(_0xd1d3('0x2'));var rp=require(_0xd1d3('0x3'));var moment=require(_0xd1d3('0x4'));var BPromise=require(_0xd1d3('0x5'));var Mustache=require(_0xd1d3('0x6'));var util=require(_0xd1d3('0x7'));var path=require('path');var sox=require(_0xd1d3('0x8'));var csv=require(_0xd1d3('0x9'));var ejs=require(_0xd1d3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1d3('0xb'));var squel=require(_0xd1d3('0xc'));var crypto=require(_0xd1d3('0xd'));var jsforce=require(_0xd1d3('0xe'));var deskjs=require(_0xd1d3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd1d3('0x10'));var Redis=require(_0xd1d3('0x11'));var authService=require(_0xd1d3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd1d3('0x13'));var hardwareService=require(_0xd1d3('0x14'));var logger=require(_0xd1d3('0x15'))(_0xd1d3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd1d3('0x17'));var db=require(_0xd1d3('0x18'))['db'];function respondWithStatusCode(_0x12726e,_0x5f1fd6){_0x5f1fd6=_0x5f1fd6||0xcc;return function(_0x447bb9){if(_0x447bb9){return _0x12726e[_0xd1d3('0x19')](_0x5f1fd6);}return _0x12726e['status'](_0x5f1fd6)[_0xd1d3('0x1a')]();};}function respondWithResult(_0x38cad0,_0x56afcc){_0x56afcc=_0x56afcc||0xc8;return function(_0x3b71c5){if(_0x3b71c5){return _0x38cad0['status'](_0x56afcc)[_0xd1d3('0x1b')](_0x3b71c5);}};}function respondWithFilteredResult(_0x40d267,_0x458e2e){return function(_0x50d448){if(_0x50d448){var _0x172db1=typeof _0x458e2e[_0xd1d3('0x1c')]===_0xd1d3('0x1d')&&typeof _0x458e2e[_0xd1d3('0x1e')]==='undefined';var _0x5916b0=_0x50d448[_0xd1d3('0x1f')];var _0x314416=_0x172db1?0x0:_0x458e2e['offset'];var _0x1316c8=_0x172db1?_0x50d448[_0xd1d3('0x1f')]:_0x458e2e[_0xd1d3('0x1c')]+_0x458e2e[_0xd1d3('0x1e')];var _0x16e93e;if(_0x1316c8>=_0x5916b0){_0x1316c8=_0x5916b0;_0x16e93e=0xc8;}else{_0x16e93e=0xce;}_0x40d267[_0xd1d3('0x20')](_0x16e93e);return _0x40d267['set'](_0xd1d3('0x21'),_0x314416+'-'+_0x1316c8+'/'+_0x5916b0)[_0xd1d3('0x1b')](_0x50d448);}return null;};}function patchUpdates(_0x944087){return function(_0x43ce2e){try{jsonpatch[_0xd1d3('0x22')](_0x43ce2e,_0x944087,!![]);}catch(_0x22d062){return BPromise[_0xd1d3('0x23')](_0x22d062);}return _0x43ce2e[_0xd1d3('0x24')]();};}function saveUpdates(_0x55f2e8,_0x1a0e20){return function(_0x2fb724){if(_0x2fb724){return _0x2fb724[_0xd1d3('0x25')](_0x55f2e8)[_0xd1d3('0x26')](function(_0x4578a1){return _0x4578a1;});}return null;};}function removeEntity(_0x4fa0b8,_0x1f1224){return function(_0x404dc8){if(_0x404dc8){return _0x404dc8['destroy']()[_0xd1d3('0x26')](function(){_0x4fa0b8['status'](0xcc)[_0xd1d3('0x1a')]();});}};}function handleEntityNotFound(_0x565aeb,_0x506ee2){return function(_0x24f4b9){if(!_0x24f4b9){_0x565aeb[_0xd1d3('0x19')](0x194);}return _0x24f4b9;};}function handleError(_0x29b673,_0x136b0f){_0x136b0f=_0x136b0f||0x1f4;return function(_0x42623e){logger['error'](_0x42623e['stack']);if(_0x42623e[_0xd1d3('0x27')]){delete _0x42623e[_0xd1d3('0x27')];}_0x29b673[_0xd1d3('0x20')](_0x136b0f)['send'](_0x42623e);};}exports[_0xd1d3('0x28')]=function(_0x5b47c7,_0x37e0ce){var _0x327eb4={},_0x2cf88a={},_0xeec77a={'count':0x0,'rows':[]};var _0x1c3910=_[_0xd1d3('0x29')](db[_0xd1d3('0x2a')][_0xd1d3('0x2b')],function(_0x4c0741){return{'name':_0x4c0741['fieldName'],'type':_0x4c0741[_0xd1d3('0x2c')]['key']};});_0x2cf88a[_0xd1d3('0x2d')]=_['map'](_0x1c3910,_0xd1d3('0x27'));_0x2cf88a[_0xd1d3('0x2e')]=_[_0xd1d3('0x2f')](_0x5b47c7['query']);_0x2cf88a['filters']=_[_0xd1d3('0x30')](_0x2cf88a[_0xd1d3('0x2d')],_0x2cf88a[_0xd1d3('0x2e')]);_0x327eb4[_0xd1d3('0x31')]=_[_0xd1d3('0x30')](_0x2cf88a[_0xd1d3('0x2d')],qs[_0xd1d3('0x32')](_0x5b47c7[_0xd1d3('0x2e')][_0xd1d3('0x32')]));_0x327eb4['attributes']=_0x327eb4['attributes'][_0xd1d3('0x33')]?_0x327eb4['attributes']:_0x2cf88a['model'];if(!_0x5b47c7[_0xd1d3('0x2e')][_0xd1d3('0x34')](_0xd1d3('0x35'))){_0x327eb4[_0xd1d3('0x1e')]=qs['limit'](_0x5b47c7[_0xd1d3('0x2e')]['limit']);_0x327eb4[_0xd1d3('0x1c')]=qs[_0xd1d3('0x1c')](_0x5b47c7[_0xd1d3('0x2e')][_0xd1d3('0x1c')]);}_0x327eb4['order']=qs['sort'](_0x5b47c7[_0xd1d3('0x2e')][_0xd1d3('0x36')]);_0x327eb4['where']=qs[_0xd1d3('0x37')](_[_0xd1d3('0x38')](_0x5b47c7[_0xd1d3('0x2e')],_0x2cf88a[_0xd1d3('0x37')]),_0x1c3910);if(_0x5b47c7[_0xd1d3('0x2e')]['filter']){_0x327eb4[_0xd1d3('0x39')]=_[_0xd1d3('0x3a')](_0x327eb4[_0xd1d3('0x39')],{'$or':_[_0xd1d3('0x29')](_0x1c3910,function(_0x44d5b4){if(_0x44d5b4['type']!==_0xd1d3('0x3b')){var _0x565fac={};_0x565fac[_0x44d5b4[_0xd1d3('0x27')]]={'$like':'%'+_0x5b47c7[_0xd1d3('0x2e')][_0xd1d3('0x3c')]+'%'};return _0x565fac;}})});}_0x327eb4=_[_0xd1d3('0x3a')]({},_0x327eb4,_0x5b47c7[_0xd1d3('0x3d')]);var _0x444eaf={'where':_0x327eb4[_0xd1d3('0x39')]};return db[_0xd1d3('0x2a')][_0xd1d3('0x1f')](_0x444eaf)['then'](function(_0x249f02){_0xeec77a[_0xd1d3('0x1f')]=_0x249f02;if(_0x5b47c7[_0xd1d3('0x2e')][_0xd1d3('0x3e')]){_0x327eb4[_0xd1d3('0x3f')]=[{'all':!![]}];}return db[_0xd1d3('0x2a')]['findAll'](_0x327eb4);})[_0xd1d3('0x26')](function(_0x5c7798){_0xeec77a[_0xd1d3('0x40')]=_0x5c7798;return _0xeec77a;})[_0xd1d3('0x26')](respondWithFilteredResult(_0x37e0ce,_0x327eb4))[_0xd1d3('0x41')](handleError(_0x37e0ce,null));};exports[_0xd1d3('0x42')]=function(_0x560778,_0x4be6b6){var _0x3e95fa={'raw':![],'where':{'id':_0x560778['params']['id']}},_0x70cebf={};_0x70cebf[_0xd1d3('0x2d')]=_[_0xd1d3('0x2f')](db[_0xd1d3('0x2a')][_0xd1d3('0x2b')]);_0x70cebf['query']=_[_0xd1d3('0x2f')](_0x560778[_0xd1d3('0x2e')]);_0x70cebf[_0xd1d3('0x37')]=_[_0xd1d3('0x30')](_0x70cebf['model'],_0x70cebf[_0xd1d3('0x2e')]);_0x3e95fa[_0xd1d3('0x31')]=_[_0xd1d3('0x30')](_0x70cebf[_0xd1d3('0x2d')],qs[_0xd1d3('0x32')](_0x560778[_0xd1d3('0x2e')][_0xd1d3('0x32')]));_0x3e95fa['attributes']=_0x3e95fa['attributes'][_0xd1d3('0x33')]?_0x3e95fa[_0xd1d3('0x31')]:_0x70cebf[_0xd1d3('0x2d')];if(_0x560778['query'][_0xd1d3('0x3e')]){_0x3e95fa['include']=[{'all':!![]}];}_0x3e95fa=_['merge']({},_0x3e95fa,_0x560778['options']);return db[_0xd1d3('0x2a')][_0xd1d3('0x43')](_0x3e95fa)[_0xd1d3('0x26')](handleEntityNotFound(_0x4be6b6,null))[_0xd1d3('0x26')](respondWithResult(_0x4be6b6,null))['catch'](handleError(_0x4be6b6,null));};exports[_0xd1d3('0x44')]=function(_0xc357c1,_0x50e132){return db[_0xd1d3('0x2a')]['create'](_0xc357c1[_0xd1d3('0x45')],{})[_0xd1d3('0x26')](respondWithResult(_0x50e132,0xc9))['catch'](handleError(_0x50e132,null));};exports['update']=function(_0xa45078,_0x22cc1d){if(_0xa45078[_0xd1d3('0x45')]['id']){delete _0xa45078[_0xd1d3('0x45')]['id'];}return db[_0xd1d3('0x2a')][_0xd1d3('0x43')]({'where':{'id':_0xa45078[_0xd1d3('0x46')]['id']}})[_0xd1d3('0x26')](handleEntityNotFound(_0x22cc1d,null))[_0xd1d3('0x26')](saveUpdates(_0xa45078[_0xd1d3('0x45')],null))[_0xd1d3('0x26')](respondWithResult(_0x22cc1d,null))[_0xd1d3('0x41')](handleError(_0x22cc1d,null));};exports[_0xd1d3('0x47')]=function(_0xeca133,_0xa2c6a5){return db[_0xd1d3('0x2a')][_0xd1d3('0x43')]({'where':{'id':_0xeca133['params']['id']}})[_0xd1d3('0x26')](handleEntityNotFound(_0xa2c6a5,null))[_0xd1d3('0x26')](removeEntity(_0xa2c6a5,null))[_0xd1d3('0x41')](handleError(_0xa2c6a5,null));};exports['describe']=function(_0x44adcc,_0x455902){return db[_0xd1d3('0x2a')]['describe']()[_0xd1d3('0x26')](respondWithResult(_0x455902,null))[_0xd1d3('0x41')](handleError(_0x455902,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 45bf0bc..68f2350 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 _0x2414=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x2414,0x108));var _0x4241=function(_0x53f531,_0x202e60){_0x53f531=_0x53f531-0x0;var _0x312f00=_0x2414[_0x53f531];return _0x312f00;};'use strict';var _=require(_0x4241('0x0'));var util=require(_0x4241('0x1'));var logger=require(_0x4241('0x2'))(_0x4241('0x3'));var moment=require(_0x4241('0x4'));var BPromise=require(_0x4241('0x5'));var rp=require(_0x4241('0x6'));var fs=require('fs');var path=require(_0x4241('0x7'));var rimraf=require(_0x4241('0x8'));var config=require(_0x4241('0x9'));var attributes=require(_0x4241('0xa'));module['exports']=function(_0x54b0bd,_0x35a7e5){return _0x54b0bd['define']('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ad=['request-promise','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0xa7ad,0x139));var _0xda7a=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xa7ad[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xda7a('0x0'));var util=require(_0xda7a('0x1'));var logger=require(_0xda7a('0x2'))(_0xda7a('0x3'));var moment=require(_0xda7a('0x4'));var BPromise=require(_0xda7a('0x5'));var rp=require(_0xda7a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda7a('0x7'));var config=require(_0xda7a('0x8'));var attributes=require(_0xda7a('0x9'));module['exports']=function(_0x15c227,_0x9960a0){return _0x15c227['define'](_0xda7a('0xa'),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 ee4227e..fb1460a 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2023b0,_0x30c5e6){var _0x59d324=function(_0x2cae31){while(--_0x2cae31){_0x2023b0['push'](_0x2023b0['shift']());}};_0x59d324(++_0x30c5e6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'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')]('IntegrationReport,\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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x35b76f,_0x324c48){var _0x582906=function(_0x5e4a7b){while(--_0x5e4a7b){_0x35b76f['push'](_0x35b76f['shift']());}};_0x582906(++_0x324c48);}(_0xadb5,0xad));var _0x5adb=function(_0xf0fc64,_0x8cdc95){_0xf0fc64=_0xf0fc64-0x0;var _0x248b47=_0xadb5[_0xf0fc64];return _0x248b47;};'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']('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index a625ade..3d67807 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 _0x55e2=['addInterval','/:id/sub_intervals/create_many','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x29c71d,_0x37fcc3){var _0x4c6512=function(_0x22872f){while(--_0x22872f){_0x29c71d['push'](_0x29c71d['shift']());}};_0x4c6512(++_0x37fcc3);}(_0x55e2,0xd8));var _0x255e=function(_0x9488c0,_0x19b28b){_0x9488c0=_0x9488c0-0x0;var _0x490866=_0x55e2[_0x9488c0];return _0x490866;};'use strict';var multer=require(_0x255e('0x0'));var util=require(_0x255e('0x1'));var path=require(_0x255e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x255e('0x3')]();var fs_extra=require(_0x255e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x255e('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x255e('0x6')]('/',auth[_0x255e('0x7')](),controller[_0x255e('0x8')]);router['get'](_0x255e('0x9'),auth[_0x255e('0x7')](),controller[_0x255e('0xa')]);router[_0x255e('0x6')](_0x255e('0xb'),auth[_0x255e('0x7')](),controller[_0x255e('0xc')]);router[_0x255e('0xd')]('/',auth[_0x255e('0x7')](),controller[_0x255e('0xe')]);router[_0x255e('0xd')]('/:id/sub_intervals',auth[_0x255e('0x7')](),controller[_0x255e('0xf')]);router[_0x255e('0xd')](_0x255e('0x10'),auth[_0x255e('0x7')](),controller['addIntervals']);router['put'](_0x255e('0x9'),auth[_0x255e('0x7')](),controller[_0x255e('0x11')]);router[_0x255e('0x12')](_0x255e('0x9'),auth['isAuthenticated'](),controller[_0x255e('0x13')]);module[_0x255e('0x14')]=router; \ No newline at end of file +var _0x2bd8=['addIntervals','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','post','/:id/sub_intervals/create_many'];(function(_0x2f1089,_0x42d03d){var _0x1af573=function(_0x13d931){while(--_0x13d931){_0x2f1089['push'](_0x2f1089['shift']());}};_0x1af573(++_0x42d03d);}(_0x2bd8,0x130));var _0x82bd=function(_0x24881e,_0x5ca0c7){_0x24881e=_0x24881e-0x0;var _0x40675b=_0x2bd8[_0x24881e];return _0x40675b;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['getIntervals']);router['post']('/',auth[_0x82bd('0xa')](),controller['create']);router['post'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['addInterval']);router[_0x82bd('0xe')](_0x82bd('0xf'),auth['isAuthenticated'](),controller[_0x82bd('0x10')]);router['put'](_0x82bd('0xb'),auth['isAuthenticated'](),controller[_0x82bd('0x11')]);router[_0x82bd('0x12')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller['destroy']);module[_0x82bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 54b433e..4999d9b 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 _0xa679=['sequelize','exports','STRING'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xa679,0x1e9));var _0x9a67=function(_0x15de5d,_0x5203f7){_0x15de5d=_0x15de5d-0x0;var _0x3449ec=_0xa679[_0x15de5d];return _0x3449ec;};'use strict';var Sequelize=require(_0x9a67('0x0'));module[_0x9a67('0x1')]={'name':{'type':Sequelize[_0x9a67('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9a67('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf52b=['exports','STRING','sequelize'];(function(_0x33bad8,_0xa77a59){var _0xed1658=function(_0x1864f4){while(--_0x1864f4){_0x33bad8['push'](_0x33bad8['shift']());}};_0xed1658(++_0xa77a59);}(_0xf52b,0xe6));var _0xbf52=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0xf52b[_0x55ff79];return _0x579067;};'use strict';var Sequelize=require(_0xbf52('0x0'));module[_0xbf52('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf52('0x2')]},'interval':{'type':Sequelize[_0xbf52('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 b9efeec..bab2d0c 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 _0x1f64=['role','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','Intervals','then','end','error','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Interval','findAll','catch','params','length','create','body','user'];(function(_0x29b4a2,_0x4dbb11){var _0x3021fb=function(_0x29ef61){while(--_0x29ef61){_0x29b4a2['push'](_0x29b4a2['shift']());}};_0x3021fb(++_0x4dbb11);}(_0x1f64,0x65));var _0x41f6=function(_0x382472,_0x1181b2){_0x382472=_0x382472-0x0;var _0x40f7d2=_0x1f64[_0x382472];return _0x40f7d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41f6('0x0'));var zipdir=require(_0x41f6('0x1'));var jsonpatch=require(_0x41f6('0x2'));var rp=require(_0x41f6('0x3'));var moment=require(_0x41f6('0x4'));var BPromise=require(_0x41f6('0x5'));var Mustache=require(_0x41f6('0x6'));var util=require(_0x41f6('0x7'));var path=require('path');var sox=require(_0x41f6('0x8'));var csv=require(_0x41f6('0x9'));var ejs=require(_0x41f6('0xa'));var fs=require('fs');var fs_extra=require(_0x41f6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x41f6('0xc'));var jsforce=require(_0x41f6('0xd'));var deskjs=require(_0x41f6('0xe'));var toCsv=require(_0x41f6('0x9'));var querystring=require(_0x41f6('0xf'));var Papa=require('papaparse');var Redis=require(_0x41f6('0x10'));var authService=require(_0x41f6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x41f6('0x12'));var hardwareService=require(_0x41f6('0x13'));var logger=require(_0x41f6('0x14'))(_0x41f6('0x15'));var utils=require(_0x41f6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x41f6('0x17'));var db=require(_0x41f6('0x18'))['db'];var extensions=require(_0x41f6('0x19'));function respondWithStatusCode(_0x3ed7fb,_0x4e3fad){_0x4e3fad=_0x4e3fad||0xcc;return function(_0x178496){if(_0x178496){return _0x3ed7fb[_0x41f6('0x1a')](_0x4e3fad);}return _0x3ed7fb[_0x41f6('0x1b')](_0x4e3fad)['end']();};}function respondWithResult(_0x2ff7be,_0x4d6794){_0x4d6794=_0x4d6794||0xc8;return function(_0x4c8a78){if(_0x4c8a78){return _0x2ff7be['status'](_0x4d6794)[_0x41f6('0x1c')](_0x4c8a78);}};}function respondWithFilteredResult(_0x19af39,_0x56fb43){return function(_0x4402ad){if(_0x4402ad){var _0xe86e1a=typeof _0x56fb43[_0x41f6('0x1d')]===_0x41f6('0x1e')&&typeof _0x56fb43[_0x41f6('0x1f')]===_0x41f6('0x1e');var _0x592241=_0x4402ad['count'];var _0x531882=_0xe86e1a?0x0:_0x56fb43['offset'];var _0x307199=_0xe86e1a?_0x4402ad[_0x41f6('0x20')]:_0x56fb43[_0x41f6('0x1d')]+_0x56fb43[_0x41f6('0x1f')];var _0x3b80b9;if(_0x307199>=_0x592241){_0x307199=_0x592241;_0x3b80b9=0xc8;}else{_0x3b80b9=0xce;}_0x19af39[_0x41f6('0x1b')](_0x3b80b9);return _0x19af39[_0x41f6('0x21')](_0x41f6('0x22'),_0x531882+'-'+_0x307199+'/'+_0x592241)[_0x41f6('0x1c')](_0x4402ad);}return null;};}function patchUpdates(_0x4207ea){return function(_0x5564cf){try{jsonpatch['apply'](_0x5564cf,_0x4207ea,!![]);}catch(_0x488f7a){return BPromise[_0x41f6('0x23')](_0x488f7a);}return _0x5564cf['save']();};}function saveUpdates(_0x5be8c9,_0x4599b6){return function(_0x28fe2f){if(_0x28fe2f){return _0x28fe2f[_0x41f6('0x24')](_0x5be8c9)['then'](function(_0x41b786){return _0x41b786;});}return null;};}function removeEntity(_0x83be7a,_0x1a59aa){return function(_0x150f25){if(_0x150f25){return _0x150f25[_0x41f6('0x25')]()['then'](function(){var _0x3b73df=_0x150f25[_0x41f6('0x26')]({'plain':!![]});var _0x379699=_0x41f6('0x27');return db['UserProfileResource'][_0x41f6('0x25')]({'where':{'type':_0x379699,'resourceId':_0x3b73df['id']}})['then'](function(){return _0x150f25;});})[_0x41f6('0x28')](function(){_0x83be7a[_0x41f6('0x1b')](0xcc)[_0x41f6('0x29')]();});}};}function handleEntityNotFound(_0x98d523,_0x51bf6c){return function(_0x3acee1){if(!_0x3acee1){_0x98d523['sendStatus'](0x194);}return _0x3acee1;};}function handleError(_0x191fda,_0x23067e){_0x23067e=_0x23067e||0x1f4;return function(_0x53d77b){logger[_0x41f6('0x2a')](_0x53d77b['stack']);if(_0x53d77b[_0x41f6('0x2b')]){delete _0x53d77b[_0x41f6('0x2b')];}_0x191fda['status'](_0x23067e)[_0x41f6('0x2c')](_0x53d77b);};}exports[_0x41f6('0x2d')]=function(_0x29de5c,_0x4224a0){var _0x36ee63={},_0x2848c3={},_0x58d2ed={'count':0x0,'rows':[]};var _0x17b074=_[_0x41f6('0x2e')](db['Interval'][_0x41f6('0x2f')],function(_0x19936b){return{'name':_0x19936b['fieldName'],'type':_0x19936b[_0x41f6('0x30')][_0x41f6('0x31')]};});_0x2848c3[_0x41f6('0x32')]=_[_0x41f6('0x2e')](_0x17b074,_0x41f6('0x2b'));_0x2848c3['query']=_[_0x41f6('0x33')](_0x29de5c['query']);_0x2848c3[_0x41f6('0x34')]=_['intersection'](_0x2848c3[_0x41f6('0x32')],_0x2848c3['query']);_0x36ee63['attributes']=_[_0x41f6('0x35')](_0x2848c3['model'],qs['fields'](_0x29de5c[_0x41f6('0x36')][_0x41f6('0x37')]));_0x36ee63[_0x41f6('0x38')]=_0x36ee63[_0x41f6('0x38')]['length']?_0x36ee63[_0x41f6('0x38')]:_0x2848c3[_0x41f6('0x32')];if(!_0x29de5c[_0x41f6('0x36')]['hasOwnProperty'](_0x41f6('0x39'))){_0x36ee63[_0x41f6('0x1f')]=qs['limit'](_0x29de5c['query']['limit']);_0x36ee63[_0x41f6('0x1d')]=qs['offset'](_0x29de5c[_0x41f6('0x36')]['offset']);}_0x36ee63[_0x41f6('0x3a')]=qs[_0x41f6('0x3b')](_0x29de5c[_0x41f6('0x36')][_0x41f6('0x3b')]);_0x36ee63[_0x41f6('0x3c')]=qs['filters'](_[_0x41f6('0x3d')](_0x29de5c[_0x41f6('0x36')],_0x2848c3[_0x41f6('0x34')]),_0x17b074);if(_0x29de5c['query'][_0x41f6('0x3e')]){_0x36ee63[_0x41f6('0x3c')]=_[_0x41f6('0x3f')](_0x36ee63[_0x41f6('0x3c')],{'$or':_[_0x41f6('0x2e')](_0x17b074,function(_0x136f48){if(_0x136f48['type']!=='VIRTUAL'){var _0x22bb99={};_0x22bb99[_0x136f48[_0x41f6('0x2b')]]={'$like':'%'+_0x29de5c[_0x41f6('0x36')][_0x41f6('0x3e')]+'%'};return _0x22bb99;}})});}_0x36ee63=_[_0x41f6('0x3f')]({},_0x36ee63,_0x29de5c[_0x41f6('0x40')]);var _0x288c81={'where':_0x36ee63[_0x41f6('0x3c')]};return db['Interval'][_0x41f6('0x20')](_0x288c81)['then'](function(_0x4e3b2e){_0x58d2ed[_0x41f6('0x20')]=_0x4e3b2e;if(_0x29de5c['query'][_0x41f6('0x41')]){_0x36ee63[_0x41f6('0x42')]=[{'all':!![]}];}return db[_0x41f6('0x43')][_0x41f6('0x44')](_0x36ee63);})[_0x41f6('0x28')](function(_0x10fa76){_0x58d2ed['rows']=_0x10fa76;return _0x58d2ed;})[_0x41f6('0x28')](respondWithFilteredResult(_0x4224a0,_0x36ee63))[_0x41f6('0x45')](handleError(_0x4224a0,null));};exports['show']=function(_0x1cafde,_0x541f89){var _0x23eaf1={'raw':!![],'where':{'id':_0x1cafde[_0x41f6('0x46')]['id']}},_0x5298ae={};_0x5298ae['model']=_['keys'](db['Interval'][_0x41f6('0x2f')]);_0x5298ae[_0x41f6('0x36')]=_[_0x41f6('0x33')](_0x1cafde['query']);_0x5298ae[_0x41f6('0x34')]=_[_0x41f6('0x35')](_0x5298ae['model'],_0x5298ae[_0x41f6('0x36')]);_0x23eaf1[_0x41f6('0x38')]=_['intersection'](_0x5298ae['model'],qs[_0x41f6('0x37')](_0x1cafde['query']['fields']));_0x23eaf1['attributes']=_0x23eaf1[_0x41f6('0x38')][_0x41f6('0x47')]?_0x23eaf1[_0x41f6('0x38')]:_0x5298ae['model'];if(_0x1cafde[_0x41f6('0x36')][_0x41f6('0x41')]){_0x23eaf1[_0x41f6('0x42')]=[{'all':!![]}];}_0x23eaf1=_[_0x41f6('0x3f')]({},_0x23eaf1,_0x1cafde[_0x41f6('0x40')]);return db[_0x41f6('0x43')]['find'](_0x23eaf1)[_0x41f6('0x28')](handleEntityNotFound(_0x541f89,null))['then'](respondWithResult(_0x541f89,null))[_0x41f6('0x45')](handleError(_0x541f89,null));};exports[_0x41f6('0x48')]=function(_0x268213,_0x2692c9){return db[_0x41f6('0x43')][_0x41f6('0x48')](_0x268213[_0x41f6('0x49')],{})[_0x41f6('0x28')](function(_0x4a0004){var _0x8acdbf=_0x268213[_0x41f6('0x4a')][_0x41f6('0x26')]({'plain':!![]});if(!_0x8acdbf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8acdbf[_0x41f6('0x4b')]===_0x41f6('0x4a')){var _0x165dae=_0x4a0004[_0x41f6('0x26')]({'plain':!![]});var _0x4fe4aa=_0x41f6('0x27');return db['UserProfileSection'][_0x41f6('0x4c')]({'where':{'name':_0x4fe4aa,'userProfileId':_0x8acdbf['userProfileId']},'raw':!![]})[_0x41f6('0x28')](function(_0x460028){if(_0x460028&&_0x460028[_0x41f6('0x4d')]===0x0){return db[_0x41f6('0x4e')][_0x41f6('0x48')]({'name':_0x165dae[_0x41f6('0x2b')],'resourceId':_0x165dae['id'],'type':_0x460028[_0x41f6('0x2b')],'sectionId':_0x460028['id']},{})[_0x41f6('0x28')](function(){return _0x4a0004;});}else{return _0x4a0004;}})[_0x41f6('0x45')](function(_0x1c3d93){logger['error'](_0x41f6('0x4f'),_0x1c3d93);throw _0x1c3d93;});}return _0x4a0004;})[_0x41f6('0x28')](respondWithResult(_0x2692c9,0xc9))[_0x41f6('0x45')](handleError(_0x2692c9,null));};exports[_0x41f6('0x24')]=function(_0x1e7663,_0x1fa0fe){if(_0x1e7663[_0x41f6('0x49')]['id']){delete _0x1e7663[_0x41f6('0x49')]['id'];}return db['Interval'][_0x41f6('0x4c')]({'where':{'id':_0x1e7663[_0x41f6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fa0fe,null))['then'](saveUpdates(_0x1e7663['body'],null))[_0x41f6('0x28')](respondWithResult(_0x1fa0fe,null))[_0x41f6('0x45')](handleError(_0x1fa0fe,null));};exports['destroy']=function(_0x2b7bfb,_0x4a00d6){return db[_0x41f6('0x43')]['find']({'where':{'id':_0x2b7bfb[_0x41f6('0x46')]['id']}})[_0x41f6('0x28')](handleEntityNotFound(_0x4a00d6,null))[_0x41f6('0x28')](removeEntity(_0x4a00d6,null))[_0x41f6('0x45')](handleError(_0x4a00d6,null));};exports[_0x41f6('0x50')]=function(_0x2bef6a,_0x54dac2,_0x65f1cb){if(_0x2bef6a[_0x41f6('0x49')]['id']){delete _0x2bef6a[_0x41f6('0x49')]['id'];}return db[_0x41f6('0x43')][_0x41f6('0x4c')]({'where':{'id':_0x2bef6a[_0x41f6('0x46')]['id']}})[_0x41f6('0x28')](handleEntityNotFound(_0x54dac2,null))[_0x41f6('0x28')](function(_0x460a15){if(_0x460a15){_0x2bef6a[_0x41f6('0x49')][_0x41f6('0x51')]=_0x460a15['id'];return db[_0x41f6('0x43')]['create'](_0x2bef6a['body']);}})[_0x41f6('0x28')](respondWithResult(_0x54dac2,null))[_0x41f6('0x45')](handleError(_0x54dac2,null));};exports[_0x41f6('0x52')]=function(_0x51057c,_0xabbfbd,_0x1121f4){var _0x54af6b={};var _0x4f431d={};var _0x551fb6;var _0x5122ed;return db[_0x41f6('0x43')][_0x41f6('0x53')]({'where':{'id':_0x51057c[_0x41f6('0x46')]['id']}})[_0x41f6('0x28')](handleEntityNotFound(_0xabbfbd,null))[_0x41f6('0x28')](function(_0x73b754){if(_0x73b754){_0x551fb6=_0x73b754;_0x4f431d[_0x41f6('0x32')]=_['keys'](db['Interval'][_0x41f6('0x2f')]);_0x4f431d[_0x41f6('0x36')]=_[_0x41f6('0x33')](_0x51057c[_0x41f6('0x36')]);_0x4f431d[_0x41f6('0x34')]=_['intersection'](_0x4f431d[_0x41f6('0x32')],_0x4f431d[_0x41f6('0x36')]);_0x54af6b['attributes']=_[_0x41f6('0x35')](_0x4f431d[_0x41f6('0x32')],qs['fields'](_0x51057c['query'][_0x41f6('0x37')]));_0x54af6b['attributes']=_0x54af6b['attributes'][_0x41f6('0x47')]?_0x54af6b['attributes']:_0x4f431d['model'];_0x54af6b[_0x41f6('0x3a')]=qs['sort'](_0x51057c['query'][_0x41f6('0x3b')]);_0x54af6b[_0x41f6('0x3c')]=qs[_0x41f6('0x34')](_[_0x41f6('0x3d')](_0x51057c[_0x41f6('0x36')],_0x4f431d['filters']));if(_0x51057c[_0x41f6('0x36')][_0x41f6('0x3e')]){_0x54af6b[_0x41f6('0x3c')]=_['merge'](_0x54af6b[_0x41f6('0x3c')],{'$or':_['map'](_0x54af6b['attributes'],function(_0x108643){var _0x3621a8={};_0x3621a8[_0x108643]={'$like':'%'+_0x51057c[_0x41f6('0x36')][_0x41f6('0x3e')]+'%'};return _0x3621a8;})});}_0x54af6b=_[_0x41f6('0x3f')]({},_0x54af6b,_0x51057c[_0x41f6('0x40')]);return _0x551fb6[_0x41f6('0x52')](_0x54af6b);}})[_0x41f6('0x28')](function(_0xa7e3e){if(_0xa7e3e){_0x5122ed=_0xa7e3e['length'];if(!_0x51057c[_0x41f6('0x36')]['hasOwnProperty'](_0x41f6('0x39'))){_0x54af6b[_0x41f6('0x1f')]=qs[_0x41f6('0x1f')](_0x51057c[_0x41f6('0x36')][_0x41f6('0x1f')]);_0x54af6b['offset']=qs['offset'](_0x51057c[_0x41f6('0x36')]['offset']);}return _0x551fb6[_0x41f6('0x52')](_0x54af6b);}})[_0x41f6('0x28')](function(_0x5077d4){if(_0x5077d4){return _0x5077d4?{'count':_0x5122ed,'rows':_0x5077d4}:null;}})[_0x41f6('0x28')](respondWithResult(_0xabbfbd,null))['catch'](handleError(_0xabbfbd,null));};exports[_0x41f6('0x54')]=function(_0x42b296,_0x50e609,_0x5e8059){return db['Interval'][_0x41f6('0x53')]({'where':{'id':_0x42b296[_0x41f6('0x46')]['id']}})['then'](handleEntityNotFound(_0x50e609,null))[_0x41f6('0x28')](function(_0x46eb04){if(_0x46eb04){return db[_0x41f6('0x55')][_0x41f6('0x56')](function(_0x353e17){return db[_0x41f6('0x43')][_0x41f6('0x25')]({'where':{'IntervalId':_0x42b296['params']['id']},'transaction':_0x353e17})[_0x41f6('0x28')](function(_0x1eb7b3){var _0x1fa070=_[_0x41f6('0x2e')](_0x42b296['body'],function(_0x3d4ed){delete _0x3d4ed['id'];_0x3d4ed[_0x41f6('0x51')]=_0x42b296['params']['id'];return _0x3d4ed;});return db[_0x41f6('0x43')][_0x41f6('0x57')](_0x1fa070,{'transaction':_0x353e17});});})[_0x41f6('0x28')](function(){return db[_0x41f6('0x43')]['findAll']({'where':{'IntervalId':_0x42b296[_0x41f6('0x46')]['id']}});});}})['then'](respondWithResult(_0x50e609,null))['catch'](handleError(_0x50e609,null));}; \ No newline at end of file +var _0xd726=['../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','then','get','Intervals','UserProfileResource','sendStatus','stack','name','send','map','Interval','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getIntervals','findOne','order','addIntervals','transaction','IntervalId','bulkCreate','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xd726,0x19c));var _0x6d72=function(_0x255b5c,_0x225f8c){_0x255b5c=_0x255b5c-0x0;var _0x3a4585=_0xd726[_0x255b5c];return _0x3a4585;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6d72('0x0'));var rp=require(_0x6d72('0x1'));var moment=require(_0x6d72('0x2'));var BPromise=require(_0x6d72('0x3'));var Mustache=require(_0x6d72('0x4'));var util=require(_0x6d72('0x5'));var path=require(_0x6d72('0x6'));var sox=require(_0x6d72('0x7'));var csv=require(_0x6d72('0x8'));var ejs=require(_0x6d72('0x9'));var fs=require('fs');var fs_extra=require(_0x6d72('0xa'));var _=require('lodash');var squel=require(_0x6d72('0xb'));var crypto=require(_0x6d72('0xc'));var jsforce=require(_0x6d72('0xd'));var deskjs=require(_0x6d72('0xe'));var toCsv=require(_0x6d72('0x8'));var querystring=require(_0x6d72('0xf'));var Papa=require(_0x6d72('0x10'));var Redis=require(_0x6d72('0x11'));var authService=require(_0x6d72('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d72('0x13'));var logger=require(_0x6d72('0x14'))(_0x6d72('0x15'));var utils=require(_0x6d72('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x6d72('0x17'));function respondWithStatusCode(_0x51e8ff,_0x1212d8){_0x1212d8=_0x1212d8||0xcc;return function(_0x135ae7){if(_0x135ae7){return _0x51e8ff['sendStatus'](_0x1212d8);}return _0x51e8ff[_0x6d72('0x18')](_0x1212d8)[_0x6d72('0x19')]();};}function respondWithResult(_0x4d06a5,_0xc2fbd3){_0xc2fbd3=_0xc2fbd3||0xc8;return function(_0xf892a){if(_0xf892a){return _0x4d06a5[_0x6d72('0x18')](_0xc2fbd3)[_0x6d72('0x1a')](_0xf892a);}};}function respondWithFilteredResult(_0x4a1191,_0x224cc1){return function(_0x37af53){if(_0x37af53){var _0x1d8593=typeof _0x224cc1[_0x6d72('0x1b')]===_0x6d72('0x1c')&&typeof _0x224cc1[_0x6d72('0x1d')]===_0x6d72('0x1c');var _0x5082ab=_0x37af53[_0x6d72('0x1e')];var _0x49801b=_0x1d8593?0x0:_0x224cc1['offset'];var _0x53fb42=_0x1d8593?_0x37af53['count']:_0x224cc1[_0x6d72('0x1b')]+_0x224cc1['limit'];var _0xafef1e;if(_0x53fb42>=_0x5082ab){_0x53fb42=_0x5082ab;_0xafef1e=0xc8;}else{_0xafef1e=0xce;}_0x4a1191[_0x6d72('0x18')](_0xafef1e);return _0x4a1191[_0x6d72('0x1f')]('Content-Range',_0x49801b+'-'+_0x53fb42+'/'+_0x5082ab)[_0x6d72('0x1a')](_0x37af53);}return null;};}function patchUpdates(_0x147b56){return function(_0x4e75f5){try{jsonpatch['apply'](_0x4e75f5,_0x147b56,!![]);}catch(_0x3b9bfa){return BPromise[_0x6d72('0x20')](_0x3b9bfa);}return _0x4e75f5['save']();};}function saveUpdates(_0x4510dc,_0x2e7099){return function(_0x4e46d5){if(_0x4e46d5){return _0x4e46d5[_0x6d72('0x21')](_0x4510dc)['then'](function(_0xf85ad8){return _0xf85ad8;});}return null;};}function removeEntity(_0x319c22,_0x478a0f){return function(_0x381055){if(_0x381055){return _0x381055[_0x6d72('0x22')]()[_0x6d72('0x23')](function(){var _0x1fa228=_0x381055[_0x6d72('0x24')]({'plain':!![]});var _0x50880b=_0x6d72('0x25');return db[_0x6d72('0x26')][_0x6d72('0x22')]({'where':{'type':_0x50880b,'resourceId':_0x1fa228['id']}})['then'](function(){return _0x381055;});})['then'](function(){_0x319c22['status'](0xcc)[_0x6d72('0x19')]();});}};}function handleEntityNotFound(_0x8455a8,_0x44fc1c){return function(_0xd98d91){if(!_0xd98d91){_0x8455a8[_0x6d72('0x27')](0x194);}return _0xd98d91;};}function handleError(_0x4f37e2,_0x3f848a){_0x3f848a=_0x3f848a||0x1f4;return function(_0x1a147d){logger['error'](_0x1a147d[_0x6d72('0x28')]);if(_0x1a147d['name']){delete _0x1a147d[_0x6d72('0x29')];}_0x4f37e2[_0x6d72('0x18')](_0x3f848a)[_0x6d72('0x2a')](_0x1a147d);};}exports['index']=function(_0x58d54f,_0x3f6727){var _0x1bbe65={},_0x30632e={},_0x15b75f={'count':0x0,'rows':[]};var _0x35e1f4=_[_0x6d72('0x2b')](db[_0x6d72('0x2c')][_0x6d72('0x2d')],function(_0x1ea2f8){return{'name':_0x1ea2f8[_0x6d72('0x2e')],'type':_0x1ea2f8[_0x6d72('0x2f')]['key']};});_0x30632e['model']=_['map'](_0x35e1f4,_0x6d72('0x29'));_0x30632e['query']=_[_0x6d72('0x30')](_0x58d54f[_0x6d72('0x31')]);_0x30632e[_0x6d72('0x32')]=_[_0x6d72('0x33')](_0x30632e[_0x6d72('0x34')],_0x30632e[_0x6d72('0x31')]);_0x1bbe65['attributes']=_[_0x6d72('0x33')](_0x30632e[_0x6d72('0x34')],qs[_0x6d72('0x35')](_0x58d54f['query']['fields']));_0x1bbe65[_0x6d72('0x36')]=_0x1bbe65[_0x6d72('0x36')][_0x6d72('0x37')]?_0x1bbe65[_0x6d72('0x36')]:_0x30632e[_0x6d72('0x34')];if(!_0x58d54f['query'][_0x6d72('0x38')](_0x6d72('0x39'))){_0x1bbe65[_0x6d72('0x1d')]=qs['limit'](_0x58d54f['query'][_0x6d72('0x1d')]);_0x1bbe65[_0x6d72('0x1b')]=qs[_0x6d72('0x1b')](_0x58d54f[_0x6d72('0x31')]['offset']);}_0x1bbe65['order']=qs['sort'](_0x58d54f['query'][_0x6d72('0x3a')]);_0x1bbe65[_0x6d72('0x3b')]=qs[_0x6d72('0x32')](_[_0x6d72('0x3c')](_0x58d54f[_0x6d72('0x31')],_0x30632e[_0x6d72('0x32')]),_0x35e1f4);if(_0x58d54f[_0x6d72('0x31')][_0x6d72('0x3d')]){_0x1bbe65['where']=_['merge'](_0x1bbe65[_0x6d72('0x3b')],{'$or':_[_0x6d72('0x2b')](_0x35e1f4,function(_0x9ce8fa){if(_0x9ce8fa[_0x6d72('0x2f')]!==_0x6d72('0x3e')){var _0x522408={};_0x522408[_0x9ce8fa[_0x6d72('0x29')]]={'$like':'%'+_0x58d54f[_0x6d72('0x31')][_0x6d72('0x3d')]+'%'};return _0x522408;}})});}_0x1bbe65=_['merge']({},_0x1bbe65,_0x58d54f[_0x6d72('0x3f')]);var _0x5983ee={'where':_0x1bbe65[_0x6d72('0x3b')]};return db[_0x6d72('0x2c')][_0x6d72('0x1e')](_0x5983ee)[_0x6d72('0x23')](function(_0x483e97){_0x15b75f[_0x6d72('0x1e')]=_0x483e97;if(_0x58d54f[_0x6d72('0x31')]['includeAll']){_0x1bbe65[_0x6d72('0x40')]=[{'all':!![]}];}return db[_0x6d72('0x2c')][_0x6d72('0x41')](_0x1bbe65);})[_0x6d72('0x23')](function(_0x382d3f){_0x15b75f[_0x6d72('0x42')]=_0x382d3f;return _0x15b75f;})[_0x6d72('0x23')](respondWithFilteredResult(_0x3f6727,_0x1bbe65))[_0x6d72('0x43')](handleError(_0x3f6727,null));};exports['show']=function(_0x3054c0,_0x3dafab){var _0x5bea06={'raw':!![],'where':{'id':_0x3054c0['params']['id']}},_0x20ff00={};_0x20ff00[_0x6d72('0x34')]=_[_0x6d72('0x30')](db[_0x6d72('0x2c')][_0x6d72('0x2d')]);_0x20ff00[_0x6d72('0x31')]=_[_0x6d72('0x30')](_0x3054c0[_0x6d72('0x31')]);_0x20ff00['filters']=_[_0x6d72('0x33')](_0x20ff00['model'],_0x20ff00['query']);_0x5bea06[_0x6d72('0x36')]=_[_0x6d72('0x33')](_0x20ff00[_0x6d72('0x34')],qs['fields'](_0x3054c0[_0x6d72('0x31')][_0x6d72('0x35')]));_0x5bea06[_0x6d72('0x36')]=_0x5bea06[_0x6d72('0x36')][_0x6d72('0x37')]?_0x5bea06[_0x6d72('0x36')]:_0x20ff00['model'];if(_0x3054c0['query'][_0x6d72('0x44')]){_0x5bea06[_0x6d72('0x40')]=[{'all':!![]}];}_0x5bea06=_[_0x6d72('0x45')]({},_0x5bea06,_0x3054c0[_0x6d72('0x3f')]);return db[_0x6d72('0x2c')]['find'](_0x5bea06)['then'](handleEntityNotFound(_0x3dafab,null))['then'](respondWithResult(_0x3dafab,null))[_0x6d72('0x43')](handleError(_0x3dafab,null));};exports[_0x6d72('0x46')]=function(_0x4e0aca,_0x2a6c95){return db[_0x6d72('0x2c')]['create'](_0x4e0aca[_0x6d72('0x47')],{})[_0x6d72('0x23')](function(_0x163d37){var _0x4896fb=_0x4e0aca[_0x6d72('0x48')]['get']({'plain':!![]});if(!_0x4896fb)throw new Error(_0x6d72('0x49'));if(_0x4896fb[_0x6d72('0x4a')]===_0x6d72('0x48')){var _0xbd642e=_0x163d37[_0x6d72('0x24')]({'plain':!![]});var _0x30eed0='Intervals';return db[_0x6d72('0x4b')][_0x6d72('0x4c')]({'where':{'name':_0x30eed0,'userProfileId':_0x4896fb['userProfileId']},'raw':!![]})[_0x6d72('0x23')](function(_0x4a5414){if(_0x4a5414&&_0x4a5414['autoAssociation']===0x0){return db['UserProfileResource'][_0x6d72('0x46')]({'name':_0xbd642e['name'],'resourceId':_0xbd642e['id'],'type':_0x4a5414[_0x6d72('0x29')],'sectionId':_0x4a5414['id']},{})[_0x6d72('0x23')](function(){return _0x163d37;});}else{return _0x163d37;}})['catch'](function(_0x57a0ec){logger[_0x6d72('0x4d')](_0x6d72('0x4e'),_0x57a0ec);throw _0x57a0ec;});}return _0x163d37;})['then'](respondWithResult(_0x2a6c95,0xc9))[_0x6d72('0x43')](handleError(_0x2a6c95,null));};exports[_0x6d72('0x21')]=function(_0x3cedc1,_0x3c7bf5){if(_0x3cedc1[_0x6d72('0x47')]['id']){delete _0x3cedc1[_0x6d72('0x47')]['id'];}return db[_0x6d72('0x2c')][_0x6d72('0x4c')]({'where':{'id':_0x3cedc1[_0x6d72('0x4f')]['id']}})[_0x6d72('0x23')](handleEntityNotFound(_0x3c7bf5,null))[_0x6d72('0x23')](saveUpdates(_0x3cedc1['body'],null))[_0x6d72('0x23')](respondWithResult(_0x3c7bf5,null))['catch'](handleError(_0x3c7bf5,null));};exports['destroy']=function(_0x5f276a,_0x1cc0a6){return db[_0x6d72('0x2c')][_0x6d72('0x4c')]({'where':{'id':_0x5f276a[_0x6d72('0x4f')]['id']}})[_0x6d72('0x23')](handleEntityNotFound(_0x1cc0a6,null))[_0x6d72('0x23')](removeEntity(_0x1cc0a6,null))['catch'](handleError(_0x1cc0a6,null));};exports['addInterval']=function(_0x2b0c00,_0x5bb997,_0x4f212d){if(_0x2b0c00[_0x6d72('0x47')]['id']){delete _0x2b0c00[_0x6d72('0x47')]['id'];}return db['Interval']['find']({'where':{'id':_0x2b0c00[_0x6d72('0x4f')]['id']}})[_0x6d72('0x23')](handleEntityNotFound(_0x5bb997,null))[_0x6d72('0x23')](function(_0x494999){if(_0x494999){_0x2b0c00[_0x6d72('0x47')]['IntervalId']=_0x494999['id'];return db[_0x6d72('0x2c')][_0x6d72('0x46')](_0x2b0c00[_0x6d72('0x47')]);}})[_0x6d72('0x23')](respondWithResult(_0x5bb997,null))[_0x6d72('0x43')](handleError(_0x5bb997,null));};exports[_0x6d72('0x50')]=function(_0x529b39,_0x4f25fe,_0x4d2c64){var _0x211e8d={};var _0x3cd939={};var _0x33014b;var _0x43725e;return db['Interval'][_0x6d72('0x51')]({'where':{'id':_0x529b39[_0x6d72('0x4f')]['id']}})[_0x6d72('0x23')](handleEntityNotFound(_0x4f25fe,null))['then'](function(_0x8bac11){if(_0x8bac11){_0x33014b=_0x8bac11;_0x3cd939[_0x6d72('0x34')]=_[_0x6d72('0x30')](db[_0x6d72('0x2c')][_0x6d72('0x2d')]);_0x3cd939['query']=_[_0x6d72('0x30')](_0x529b39[_0x6d72('0x31')]);_0x3cd939['filters']=_['intersection'](_0x3cd939[_0x6d72('0x34')],_0x3cd939[_0x6d72('0x31')]);_0x211e8d[_0x6d72('0x36')]=_['intersection'](_0x3cd939[_0x6d72('0x34')],qs['fields'](_0x529b39[_0x6d72('0x31')][_0x6d72('0x35')]));_0x211e8d[_0x6d72('0x36')]=_0x211e8d[_0x6d72('0x36')]['length']?_0x211e8d['attributes']:_0x3cd939[_0x6d72('0x34')];_0x211e8d[_0x6d72('0x52')]=qs[_0x6d72('0x3a')](_0x529b39[_0x6d72('0x31')][_0x6d72('0x3a')]);_0x211e8d[_0x6d72('0x3b')]=qs[_0x6d72('0x32')](_['pick'](_0x529b39[_0x6d72('0x31')],_0x3cd939[_0x6d72('0x32')]));if(_0x529b39[_0x6d72('0x31')][_0x6d72('0x3d')]){_0x211e8d[_0x6d72('0x3b')]=_['merge'](_0x211e8d[_0x6d72('0x3b')],{'$or':_[_0x6d72('0x2b')](_0x211e8d['attributes'],function(_0x2a92c4){var _0x322dfe={};_0x322dfe[_0x2a92c4]={'$like':'%'+_0x529b39[_0x6d72('0x31')][_0x6d72('0x3d')]+'%'};return _0x322dfe;})});}_0x211e8d=_['merge']({},_0x211e8d,_0x529b39[_0x6d72('0x3f')]);return _0x33014b[_0x6d72('0x50')](_0x211e8d);}})[_0x6d72('0x23')](function(_0x5c9f97){if(_0x5c9f97){_0x43725e=_0x5c9f97[_0x6d72('0x37')];if(!_0x529b39[_0x6d72('0x31')][_0x6d72('0x38')](_0x6d72('0x39'))){_0x211e8d[_0x6d72('0x1d')]=qs[_0x6d72('0x1d')](_0x529b39[_0x6d72('0x31')]['limit']);_0x211e8d[_0x6d72('0x1b')]=qs[_0x6d72('0x1b')](_0x529b39['query'][_0x6d72('0x1b')]);}return _0x33014b['getIntervals'](_0x211e8d);}})[_0x6d72('0x23')](function(_0x33c9ff){if(_0x33c9ff){return _0x33c9ff?{'count':_0x43725e,'rows':_0x33c9ff}:null;}})[_0x6d72('0x23')](respondWithResult(_0x4f25fe,null))[_0x6d72('0x43')](handleError(_0x4f25fe,null));};exports[_0x6d72('0x53')]=function(_0xc495c2,_0x13abcd,_0x458779){return db['Interval'][_0x6d72('0x51')]({'where':{'id':_0xc495c2[_0x6d72('0x4f')]['id']}})[_0x6d72('0x23')](handleEntityNotFound(_0x13abcd,null))[_0x6d72('0x23')](function(_0x1a89d6){if(_0x1a89d6){return db['sequelize'][_0x6d72('0x54')](function(_0x122f20){return db[_0x6d72('0x2c')][_0x6d72('0x22')]({'where':{'IntervalId':_0xc495c2[_0x6d72('0x4f')]['id']},'transaction':_0x122f20})[_0x6d72('0x23')](function(_0x3ebd5d){var _0x542d06=_[_0x6d72('0x2b')](_0xc495c2[_0x6d72('0x47')],function(_0x3ad2e9){delete _0x3ad2e9['id'];_0x3ad2e9[_0x6d72('0x55')]=_0xc495c2['params']['id'];return _0x3ad2e9;});return db[_0x6d72('0x2c')][_0x6d72('0x56')](_0x542d06,{'transaction':_0x122f20});});})[_0x6d72('0x23')](function(){return db[_0x6d72('0x2c')][_0x6d72('0x41')]({'where':{'IntervalId':_0xc495c2[_0x6d72('0x4f')]['id']}});});}})[_0x6d72('0x23')](respondWithResult(_0x13abcd,null))[_0x6d72('0x43')](handleError(_0x13abcd,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0a47065..d2a126c 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 _0x9ac0=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c7c4a,_0x520920){var _0x4d78ae=function(_0x3bcee0){while(--_0x3bcee0){_0x4c7c4a['push'](_0x4c7c4a['shift']());}};_0x4d78ae(++_0x520920);}(_0x9ac0,0x116));var _0x09ac=function(_0xfd219f,_0x4e9af4){_0xfd219f=_0xfd219f-0x0;var _0x23a9eb=_0x9ac0[_0xfd219f];return _0x23a9eb;};'use strict';var _=require('lodash');var util=require(_0x09ac('0x0'));var logger=require(_0x09ac('0x1'))(_0x09ac('0x2'));var moment=require(_0x09ac('0x3'));var BPromise=require(_0x09ac('0x4'));var rp=require(_0x09ac('0x5'));var fs=require('fs');var path=require(_0x09ac('0x6'));var rimraf=require('rimraf');var config=require(_0x09ac('0x7'));var attributes=require(_0x09ac('0x8'));var extensions=require(_0x09ac('0x9'));module[_0x09ac('0xa')]=function(_0x398c31,_0x2ab7b1){return _0x398c31[_0x09ac('0xb')](_0x09ac('0xc'),attributes,{'tableName':_0x09ac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d859e,_0x444627){extensions[_0x09ac('0xe')](_0x398c31,_0x3d859e);},'afterBulkCreate':function(_0x78416,_0x2bb40a,_0x2404df){_0x2404df();extensions[_0x09ac('0xe')](_0x398c31,_0x78416[0x0]);},'afterUpdate':function(_0x2fe341,_0x4b2bca){extensions[_0x09ac('0xe')](_0x398c31,_0x2fe341);},'afterDestroy':function(_0x10cfbc,_0x52d1a4){extensions['rewrite'](_0x398c31,_0x10cfbc);}}});}; \ No newline at end of file +var _0xdf77=['rewrite','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals'];(function(_0x3cd128,_0x4c36f5){var _0x1c3e99=function(_0x2b009f){while(--_0x2b009f){_0x3cd128['push'](_0x3cd128['shift']());}};_0x1c3e99(++_0x4c36f5);}(_0xdf77,0x1a1));var _0x7df7=function(_0x2ac054,_0x5c0053){_0x2ac054=_0x2ac054-0x0;var _0x13703d=_0xdf77[_0x2ac054];return _0x13703d;};'use strict';var _=require(_0x7df7('0x0'));var util=require(_0x7df7('0x1'));var logger=require('../../config/logger')(_0x7df7('0x2'));var moment=require(_0x7df7('0x3'));var BPromise=require(_0x7df7('0x4'));var rp=require(_0x7df7('0x5'));var fs=require('fs');var path=require(_0x7df7('0x6'));var rimraf=require(_0x7df7('0x7'));var config=require(_0x7df7('0x8'));var attributes=require(_0x7df7('0x9'));var extensions=require(_0x7df7('0xa'));module[_0x7df7('0xb')]=function(_0x4cc6f8,_0x349f37){return _0x4cc6f8[_0x7df7('0xc')](_0x7df7('0xd'),attributes,{'tableName':_0x7df7('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x973f22,_0x49ea23){extensions['rewrite'](_0x4cc6f8,_0x973f22);},'afterBulkCreate':function(_0xe6e22c,_0xcdfed4,_0x195fbe){_0x195fbe();extensions[_0x7df7('0xf')](_0x4cc6f8,_0xe6e22c[0x0]);},'afterUpdate':function(_0x34c225,_0x44d91b){extensions[_0x7df7('0xf')](_0x4cc6f8,_0x34c225);},'afterDestroy':function(_0x592f0a,_0x51ca45){extensions[_0x7df7('0xf')](_0x4cc6f8,_0x592f0a);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ad5217d..c995a01 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6f84f63..b687b8c 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x0b0e[_0x335271];return _0xa9fff8;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x287091,_0x42cf2f){var _0x19aabb=function(_0x1b2090){while(--_0x1b2090){_0x287091['push'](_0x287091['shift']());}};_0x19aabb(++_0x42cf2f);}(_0xadb5,0xad));var _0x5adb=function(_0x16c76f,_0x4b7924){_0x16c76f=_0x16c76f-0x0;var _0x29c698=_0xadb5[_0x16c76f];return _0x29c698;};'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['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b65d818..e4bd048 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 _0x815d=['Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','setEncoding','data','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','headers','x-forwarded-for','remoteAddress','socket','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify'];(function(_0x88a1be,_0x280730){var _0x4c3f81=function(_0x4c4a70){while(--_0x4c4a70){_0x88a1be['push'](_0x88a1be['shift']());}};_0x4c3f81(++_0x280730);}(_0x815d,0x1ef));var _0xd815=function(_0x47d18a,_0xd53074){_0x47d18a=_0x47d18a-0x0;var _0x130c43=_0x815d[_0x47d18a];return _0x130c43;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xd815('0x0'))('api');var USERNAME=_0xd815('0x1');var PASSWORD=_0xd815('0x2');function openIssue(_0x3daf4d,_0x26b517){var _0x1b237a={'fields':{'project':{'key':_0x3daf4d[_0xd815('0x3')]||_0xd815('0x4')},'summary':(_0x3daf4d[_0xd815('0x5')]||'Report')+_0xd815('0x6')+_0x3daf4d['ip'],'description':_0x3daf4d[_0xd815('0x7')]||JSON[_0xd815('0x8')](_0x3daf4d),'issuetype':{'name':_0x3daf4d['issuetype']||_0xd815('0x9')}}};_0x1b237a[_0xd815('0xa')][_0xd815('0xb')]=_0x3daf4d[_0xd815('0xc')];_0x1b237a[_0xd815('0xa')][_0xd815('0xd')]=_0x3daf4d['oldToken'];_0x1b237a[_0xd815('0xa')][_0xd815('0xe')]=_0x3daf4d[_0xd815('0xf')];_0x1b237a[_0xd815('0xa')]['customfield_11503']=_0x3daf4d[_0xd815('0x10')];_0x1b237a['fields'][_0xd815('0x11')]=_0x3daf4d[_0xd815('0x12')];_0x1b237a[_0xd815('0xa')][_0xd815('0x13')]=_0x3daf4d['ip'];var _0x4699cc={'host':_0xd815('0x14'),'port':0x1bb,'path':_0xd815('0x15'),'method':_0xd815('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xd815('0x17'),'Authorization':_0xd815('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xd815('0x19')]('base64')}};var _0x209fcf=JSON[_0xd815('0x8')](_0x1b237a);var _0x25aeac=https['request'](_0x4699cc,function(_0x32fb97){_0x32fb97[_0xd815('0x1a')]('utf8');var _0x59f444='';_0x32fb97['on'](_0xd815('0x1b'),function(_0x126900){_0x59f444+=_0x126900;});_0x32fb97['on']('end',function(){if(_0x26b517){return _0x26b517[_0xd815('0x1c')](_0x32fb97[_0xd815('0x1d')])[_0xd815('0x1e')](JSON['parse'](_0x59f444));}});});_0x25aeac['on'](_0xd815('0x1f'),function(_0x46a79b){if(_0x26b517){return _0x26b517[_0xd815('0x1c')](0x1f4)['json']({'errors':[{'message':_0xd815('0x20'),'type':_0xd815('0x21')}]});}});_0x25aeac[_0xd815('0x22')](_0x209fcf);_0x25aeac[_0xd815('0x23')]();}exports['openIssue']=openIssue;exports[_0xd815('0x24')]=function(_0x30e353,_0x2f115d){_0x30e353[_0xd815('0x25')]['ip']=_0x30e353[_0xd815('0x26')][_0xd815('0x27')]||_0x30e353['connection'][_0xd815('0x28')]||_0x30e353[_0xd815('0x29')][_0xd815('0x28')]||_0x30e353['connection'][_0xd815('0x29')][_0xd815('0x28')];return openIssue(_0x30e353[_0xd815('0x25')],_0x2f115d);}; \ No newline at end of file +var _0xea7b=['remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','fields','email','oldToken','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','stringify','request','setEncoding','utf8','data','end','status','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection'];(function(_0x1a4357,_0x37e110){var _0x35ff13=function(_0x5b94fa){while(--_0x5b94fa){_0x1a4357['push'](_0x1a4357['shift']());}};_0x35ff13(++_0x37e110);}(_0xea7b,0x13d));var _0xbea7=function(_0x2c2d38,_0x43e690){_0x2c2d38=_0x2c2d38-0x0;var _0x4d558f=_0xea7b[_0x2c2d38];return _0x4d558f;};'use strict';var BPromise=require(_0xbea7('0x0'));var https=require(_0xbea7('0x1'));var logger=require('../../config/logger')(_0xbea7('0x2'));var USERNAME=_0xbea7('0x3');var PASSWORD=_0xbea7('0x4');function openIssue(_0x5d0fd9,_0x277737){var _0x2b5726={'fields':{'project':{'key':_0x5d0fd9[_0xbea7('0x5')]||_0xbea7('0x6')},'summary':(_0x5d0fd9[_0xbea7('0x7')]||_0xbea7('0x8'))+_0xbea7('0x9')+_0x5d0fd9['ip'],'description':_0x5d0fd9[_0xbea7('0xa')]||JSON['stringify'](_0x5d0fd9),'issuetype':{'name':_0x5d0fd9['issuetype']||'Bug'}}};_0x2b5726[_0xbea7('0xb')]['customfield_11500']=_0x5d0fd9[_0xbea7('0xc')];_0x2b5726[_0xbea7('0xb')]['customfield_11501']=_0x5d0fd9[_0xbea7('0xd')];_0x2b5726[_0xbea7('0xb')]['customfield_11502']=_0x5d0fd9[_0xbea7('0xe')];_0x2b5726[_0xbea7('0xb')]['customfield_11503']=_0x5d0fd9[_0xbea7('0xf')];_0x2b5726[_0xbea7('0xb')][_0xbea7('0x10')]=_0x5d0fd9[_0xbea7('0x11')];_0x2b5726[_0xbea7('0xb')][_0xbea7('0x12')]=_0x5d0fd9['ip'];var _0x423de9={'host':_0xbea7('0x13'),'port':0x1bb,'path':_0xbea7('0x14'),'method':_0xbea7('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xbea7('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xbea7('0x17')](_0xbea7('0x18'))}};var _0x3fb71f=JSON[_0xbea7('0x19')](_0x2b5726);var _0x319a33=https[_0xbea7('0x1a')](_0x423de9,function(_0x21d41c){_0x21d41c[_0xbea7('0x1b')](_0xbea7('0x1c'));var _0x5d0814='';_0x21d41c['on'](_0xbea7('0x1d'),function(_0x5da452){_0x5d0814+=_0x5da452;});_0x21d41c['on'](_0xbea7('0x1e'),function(){if(_0x277737){return _0x277737[_0xbea7('0x1f')](_0x21d41c['statusCode'])[_0xbea7('0x20')](JSON['parse'](_0x5d0814));}});});_0x319a33['on'](_0xbea7('0x21'),function(_0x2fe16a){if(_0x277737){return _0x277737[_0xbea7('0x1f')](0x1f4)[_0xbea7('0x20')]({'errors':[{'message':_0xbea7('0x22'),'type':_0xbea7('0x23')}]});}});_0x319a33[_0xbea7('0x24')](_0x3fb71f);_0x319a33['end']();}exports[_0xbea7('0x25')]=openIssue;exports[_0xbea7('0x26')]=function(_0x2cbe28,_0x468fea){_0x2cbe28[_0xbea7('0x27')]['ip']=_0x2cbe28[_0xbea7('0x28')][_0xbea7('0x29')]||_0x2cbe28[_0xbea7('0x2a')][_0xbea7('0x2b')]||_0x2cbe28[_0xbea7('0x2c')]['remoteAddress']||_0x2cbe28[_0xbea7('0x2a')]['socket'][_0xbea7('0x2b')];return openIssue(_0x2cbe28[_0xbea7('0x27')],_0x468fea);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ebacaec..79bb0dc 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 _0xf109=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','exports','multer','util','path'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xf109,0xce));var _0x9f10=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xf109[_0x12f688];return _0x59c3de;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f10('0x3'));var auth=require(_0x9f10('0x4'));var interaction=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var controller=require(_0x9f10('0x7'));router[_0x9f10('0x8')]('/',auth[_0x9f10('0x9')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x8')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),controller['describe']);router[_0x9f10('0x8')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xd')]);router[_0x9f10('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f10('0xf')]);router[_0x9f10('0x10')](_0x9f10('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9f10('0x11')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller['destroy']);module[_0x9f10('0x12')]=router; \ No newline at end of file +var _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x649c04,_0x5b5f52){var _0x573528=function(_0x282037){while(--_0x282037){_0x649c04['push'](_0x649c04['shift']());}};_0x573528(++_0x5b5f52);}(_0xbec5,0xe5));var _0x5bec=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0xbec5[_0xd1a252];return _0x560ee1;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 0750d6d..21384d6 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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7a54,0x106));var _0x47a5=function(_0x3baf15,_0x513d2b){_0x3baf15=_0x3baf15-0x0;var _0x2b53ab=_0x7a54[_0x3baf15];return _0x2b53ab;};'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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x1b213e,_0x5697cf){_0x1b213e=_0x1b213e-0x0;var _0x200702=_0x7a54[_0x1b213e];return _0x200702;};'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 470cb76..2cc66cd 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 _0xba18=['filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick'];(function(_0x2f023d,_0x29dfe5){var _0x4ef240=function(_0x49f1ec){while(--_0x49f1ec){_0x2f023d['push'](_0x2f023d['shift']());}};_0x4ef240(++_0x29dfe5);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8ba1('0x0'));var rimraf=require(_0x8ba1('0x1'));var zipdir=require(_0x8ba1('0x2'));var jsonpatch=require(_0x8ba1('0x3'));var rp=require(_0x8ba1('0x4'));var moment=require(_0x8ba1('0x5'));var BPromise=require(_0x8ba1('0x6'));var Mustache=require(_0x8ba1('0x7'));var util=require('util');var path=require(_0x8ba1('0x8'));var sox=require(_0x8ba1('0x9'));var csv=require(_0x8ba1('0xa'));var ejs=require(_0x8ba1('0xb'));var fs=require('fs');var fs_extra=require(_0x8ba1('0xc'));var _=require(_0x8ba1('0xd'));var squel=require('squel');var crypto=require(_0x8ba1('0xe'));var jsforce=require(_0x8ba1('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ba1('0x10'));var Redis=require(_0x8ba1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8ba1('0x12'));var as=require(_0x8ba1('0x13'));var hardwareService=require(_0x8ba1('0x14'));var logger=require(_0x8ba1('0x15'))(_0x8ba1('0x16'));var utils=require('../../config/utils');var config=require(_0x8ba1('0x17'));var licenseUtil=require(_0x8ba1('0x18'));var db=require(_0x8ba1('0x19'))['db'];function respondWithStatusCode(_0x1fcfd7,_0x29adbb){_0x29adbb=_0x29adbb||0xcc;return function(_0x229748){if(_0x229748){return _0x1fcfd7['sendStatus'](_0x29adbb);}return _0x1fcfd7[_0x8ba1('0x1a')](_0x29adbb)[_0x8ba1('0x1b')]();};}function respondWithResult(_0x2e81d1,_0xca53c4){_0xca53c4=_0xca53c4||0xc8;return function(_0x4c8d5c){if(_0x4c8d5c){return _0x2e81d1['status'](_0xca53c4)['json'](_0x4c8d5c);}};}function respondWithFilteredResult(_0x3058ac,_0x398f40){return function(_0x5a3a8a){if(_0x5a3a8a){var _0x1b885b=typeof _0x398f40[_0x8ba1('0x1c')]===_0x8ba1('0x1d')&&typeof _0x398f40[_0x8ba1('0x1e')]===_0x8ba1('0x1d');var _0x19ade9=_0x5a3a8a[_0x8ba1('0x1f')];var _0x4d75fa=_0x1b885b?0x0:_0x398f40['offset'];var _0x1a48fa=_0x1b885b?_0x5a3a8a[_0x8ba1('0x1f')]:_0x398f40['offset']+_0x398f40[_0x8ba1('0x1e')];var _0x2e5fba;if(_0x1a48fa>=_0x19ade9){_0x1a48fa=_0x19ade9;_0x2e5fba=0xc8;}else{_0x2e5fba=0xce;}_0x3058ac[_0x8ba1('0x1a')](_0x2e5fba);return _0x3058ac[_0x8ba1('0x20')](_0x8ba1('0x21'),_0x4d75fa+'-'+_0x1a48fa+'/'+_0x19ade9)[_0x8ba1('0x22')](_0x5a3a8a);}return null;};}function patchUpdates(_0x5ddcf8){return function(_0x489662){try{jsonpatch['apply'](_0x489662,_0x5ddcf8,!![]);}catch(_0xd78e53){return BPromise[_0x8ba1('0x23')](_0xd78e53);}return _0x489662[_0x8ba1('0x24')]();};}function saveUpdates(_0x3dd1d8,_0x4e66e1){return function(_0x1d619c){if(_0x1d619c){return _0x1d619c[_0x8ba1('0x25')](_0x3dd1d8)[_0x8ba1('0x26')](function(_0x38a2de){return _0x38a2de;});}return null;};}function removeEntity(_0x2d4ad6,_0x3b70ea){return function(_0x845108){if(_0x845108){return _0x845108[_0x8ba1('0x27')]()[_0x8ba1('0x26')](function(){_0x2d4ad6[_0x8ba1('0x1a')](0xcc)[_0x8ba1('0x1b')]();});}};}function handleEntityNotFound(_0x550d33,_0x5c924e){return function(_0x41c2bb){if(!_0x41c2bb){_0x550d33[_0x8ba1('0x28')](0x194);}return _0x41c2bb;};}function handleError(_0x56aef2,_0x2baa80){_0x2baa80=_0x2baa80||0x1f4;return function(_0xef508d){logger[_0x8ba1('0x29')](_0xef508d[_0x8ba1('0x2a')]);if(_0xef508d[_0x8ba1('0x2b')]){delete _0xef508d[_0x8ba1('0x2b')];}_0x56aef2[_0x8ba1('0x1a')](_0x2baa80)[_0x8ba1('0x2c')](_0xef508d);};}exports[_0x8ba1('0x2d')]=function(_0x3f1b37,_0x3e8e6d){var _0x136eef={},_0x32782a={},_0x229e16={'count':0x0,'rows':[]};var _0x5e28b7=_[_0x8ba1('0x2e')](db[_0x8ba1('0x2f')][_0x8ba1('0x30')],function(_0x3c37fd){return{'name':_0x3c37fd[_0x8ba1('0x31')],'type':_0x3c37fd[_0x8ba1('0x32')]['key']};});_0x32782a[_0x8ba1('0x33')]=_[_0x8ba1('0x2e')](_0x5e28b7,'name');_0x32782a[_0x8ba1('0x34')]=_['keys'](_0x3f1b37[_0x8ba1('0x34')]);_0x32782a[_0x8ba1('0x35')]=_['intersection'](_0x32782a[_0x8ba1('0x33')],_0x32782a[_0x8ba1('0x34')]);_0x136eef[_0x8ba1('0x36')]=_[_0x8ba1('0x37')](_0x32782a[_0x8ba1('0x33')],qs['fields'](_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x38')]));_0x136eef[_0x8ba1('0x36')]=_0x136eef[_0x8ba1('0x36')][_0x8ba1('0x39')]?_0x136eef[_0x8ba1('0x36')]:_0x32782a[_0x8ba1('0x33')];if(!_0x3f1b37[_0x8ba1('0x34')]['hasOwnProperty'](_0x8ba1('0x3a'))){_0x136eef[_0x8ba1('0x1e')]=qs[_0x8ba1('0x1e')](_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x1e')]);_0x136eef[_0x8ba1('0x1c')]=qs[_0x8ba1('0x1c')](_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x1c')]);}_0x136eef[_0x8ba1('0x3b')]=qs['sort'](_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x3c')]);_0x136eef[_0x8ba1('0x3d')]=qs[_0x8ba1('0x35')](_[_0x8ba1('0x3e')](_0x3f1b37[_0x8ba1('0x34')],_0x32782a[_0x8ba1('0x35')]),_0x5e28b7);if(_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x3f')]){_0x136eef[_0x8ba1('0x3d')]=_['merge'](_0x136eef['where'],{'$or':_[_0x8ba1('0x2e')](_0x5e28b7,function(_0x3b02a6){if(_0x3b02a6[_0x8ba1('0x32')]!==_0x8ba1('0x40')){var _0x467a82={};_0x467a82[_0x3b02a6[_0x8ba1('0x2b')]]={'$like':'%'+_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x3f')]+'%'};return _0x467a82;}})});}_0x136eef=_[_0x8ba1('0x41')]({},_0x136eef,_0x3f1b37[_0x8ba1('0x42')]);var _0x2f4ac4={'where':_0x136eef[_0x8ba1('0x3d')]};return db[_0x8ba1('0x2f')][_0x8ba1('0x1f')](_0x2f4ac4)['then'](function(_0xf8c3b){_0x229e16[_0x8ba1('0x1f')]=_0xf8c3b;if(_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x43')]){_0x136eef['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x8ba1('0x44')](_0x136eef);})[_0x8ba1('0x26')](function(_0x1d1ffd){_0x229e16[_0x8ba1('0x45')]=_0x1d1ffd;return _0x229e16;})[_0x8ba1('0x26')](respondWithFilteredResult(_0x3e8e6d,_0x136eef))['catch'](handleError(_0x3e8e6d,null));};exports[_0x8ba1('0x46')]=function(_0x171054,_0x16bdb1){var _0x5b02d8={'raw':!![],'where':{'id':_0x171054[_0x8ba1('0x47')]['id']}},_0x1e5376={};_0x1e5376[_0x8ba1('0x33')]=_[_0x8ba1('0x48')](db[_0x8ba1('0x2f')][_0x8ba1('0x30')]);_0x1e5376['query']=_[_0x8ba1('0x48')](_0x171054['query']);_0x1e5376[_0x8ba1('0x35')]=_[_0x8ba1('0x37')](_0x1e5376[_0x8ba1('0x33')],_0x1e5376[_0x8ba1('0x34')]);_0x5b02d8[_0x8ba1('0x36')]=_[_0x8ba1('0x37')](_0x1e5376['model'],qs[_0x8ba1('0x38')](_0x171054[_0x8ba1('0x34')]['fields']));_0x5b02d8['attributes']=_0x5b02d8[_0x8ba1('0x36')][_0x8ba1('0x39')]?_0x5b02d8[_0x8ba1('0x36')]:_0x1e5376[_0x8ba1('0x33')];if(_0x171054[_0x8ba1('0x34')][_0x8ba1('0x43')]){_0x5b02d8[_0x8ba1('0x49')]=[{'all':!![]}];}_0x5b02d8=_[_0x8ba1('0x41')]({},_0x5b02d8,_0x171054[_0x8ba1('0x42')]);return db[_0x8ba1('0x2f')][_0x8ba1('0x4a')](_0x5b02d8)[_0x8ba1('0x26')](handleEntityNotFound(_0x16bdb1,null))[_0x8ba1('0x26')](respondWithResult(_0x16bdb1,null))['catch'](handleError(_0x16bdb1,null));};exports[_0x8ba1('0x4b')]=function(_0x3bb667,_0x1405a2){return db[_0x8ba1('0x2f')][_0x8ba1('0x4b')](_0x3bb667[_0x8ba1('0x4c')],{})[_0x8ba1('0x26')](respondWithResult(_0x1405a2,0xc9))[_0x8ba1('0x4d')](handleError(_0x1405a2,null));};exports[_0x8ba1('0x25')]=function(_0xd1ec48,_0xae04af){if(_0xd1ec48[_0x8ba1('0x4c')]['id']){delete _0xd1ec48[_0x8ba1('0x4c')]['id'];}return db[_0x8ba1('0x2f')]['find']({'where':{'id':_0xd1ec48[_0x8ba1('0x47')]['id']}})[_0x8ba1('0x26')](handleEntityNotFound(_0xae04af,null))['then'](saveUpdates(_0xd1ec48[_0x8ba1('0x4c')],null))[_0x8ba1('0x26')](respondWithResult(_0xae04af,null))[_0x8ba1('0x4d')](handleError(_0xae04af,null));};exports[_0x8ba1('0x27')]=function(_0x10fc3c,_0x5304c4){return db['JscriptyAnswerReport'][_0x8ba1('0x4a')]({'where':{'id':_0x10fc3c[_0x8ba1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5304c4,null))[_0x8ba1('0x26')](removeEntity(_0x5304c4,null))[_0x8ba1('0x4d')](handleError(_0x5304c4,null));};exports[_0x8ba1('0x4e')]=function(_0x4d93b2,_0x3b9bb4){return db[_0x8ba1('0x2f')][_0x8ba1('0x4e')]()['then'](respondWithResult(_0x3b9bb4,null))[_0x8ba1('0x4d')](handleError(_0x3b9bb4,null));}; \ No newline at end of file +var _0x6b8f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0x3f9ea9,_0x19840d){var _0x291e7f=function(_0x8012b4){while(--_0x8012b4){_0x3f9ea9['push'](_0x3f9ea9['shift']());}};_0x291e7f(++_0x19840d);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x23797c,_0xf2cfe6){_0x23797c=_0x23797c-0x0;var _0x24d521=_0x6b8f[_0x23797c];return _0x24d521;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));};exports['describe']=function(_0x55c392,_0x22c1eb){return db[_0xf6b8('0x25')][_0xf6b8('0x45')]()[_0xf6b8('0x1f')](respondWithResult(_0x22c1eb,null))['catch'](handleError(_0x22c1eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ec6a7c7..5af49e7 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 _0xb08a=['bluebird','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x778aca,_0x189d39){var _0x39f973=function(_0x312f5f){while(--_0x312f5f){_0x778aca['push'](_0x778aca['shift']());}};_0x39f973(++_0x189d39);}(_0xb08a,0xaf));var _0xab08=function(_0x252328,_0x4c22f0){_0x252328=_0x252328-0x0;var _0xaa85b7=_0xb08a[_0x252328];return _0xaa85b7;};'use strict';var _=require(_0xab08('0x0'));var util=require(_0xab08('0x1'));var logger=require(_0xab08('0x2'))(_0xab08('0x3'));var moment=require(_0xab08('0x4'));var BPromise=require(_0xab08('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab08('0x6'));var config=require(_0xab08('0x7'));var attributes=require(_0xab08('0x8'));module[_0xab08('0x9')]=function(_0x2854db,_0x13c2e9){return _0x2854db[_0xab08('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xab08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16f1=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x9f0919,_0x167941){var _0x27c8c5=function(_0x365055){while(--_0x365055){_0x9f0919['push'](_0x9f0919['shift']());}};_0x27c8c5(++_0x167941);}(_0x16f1,0x163));var _0x116f=function(_0x16b599,_0x406327){_0x16b599=_0x16b599-0x0;var _0x5a92b7=_0x16f1[_0x16b599];return _0x5a92b7;};'use strict';var _=require(_0x116f('0x0'));var util=require(_0x116f('0x1'));var logger=require(_0x116f('0x2'))(_0x116f('0x3'));var moment=require(_0x116f('0x4'));var BPromise=require(_0x116f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x116f('0x6'));var config=require(_0x116f('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0xae92d7,_0x54674b){return _0xae92d7[_0x116f('0x8')](_0x116f('0x9'),attributes,{'tableName':_0x116f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 28eede0..b5f435a 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 _0xd7a5=['../../config/environment','jayson/promise','request','then','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x23688d,_0x49164a){var _0x3cf64f=function(_0x532fb0){while(--_0x532fb0){_0x23688d['push'](_0x23688d['shift']());}};_0x3cf64f(++_0x49164a);}(_0xd7a5,0x65));var _0x5d7a=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xd7a5[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0x5d7a('0x0'));var util=require(_0x5d7a('0x1'));var moment=require('moment');var BPromise=require(_0x5d7a('0x2'));var rs=require(_0x5d7a('0x3'));var fs=require('fs');var Redis=require(_0x5d7a('0x4'));var db=require(_0x5d7a('0x5'))['db'];var utils=require(_0x5d7a('0x6'));var logger=require(_0x5d7a('0x7'))(_0x5d7a('0x8'));var config=require(_0x5d7a('0x9'));var jayson=require(_0x5d7a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f38d8,_0x179051,_0x12cdb9){return new BPromise(function(_0x4bd5cd,_0x2a2c0e){return client[_0x5d7a('0xb')](_0x4f38d8,_0x12cdb9)[_0x5d7a('0xc')](function(_0x4e48fe){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x179051,'request\x20sent');logger[_0x5d7a('0xd')](_0x5d7a('0xe'),_0x179051,_0x5d7a('0xf'),JSON[_0x5d7a('0x10')](_0x4e48fe));if(_0x4e48fe['error']){if(_0x4e48fe[_0x5d7a('0x11')]['code']===0x1f4){logger['error'](_0x5d7a('0x12'),_0x179051,_0x4e48fe['error']['message']);return _0x2a2c0e(_0x4e48fe['error'][_0x5d7a('0x13')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x179051,_0x4e48fe[_0x5d7a('0x11')][_0x5d7a('0x13')]);return _0x4bd5cd(_0x4e48fe[_0x5d7a('0x11')][_0x5d7a('0x13')]);}else{logger['info'](_0x5d7a('0x12'),_0x179051,_0x5d7a('0xf'));_0x4bd5cd(_0x4e48fe[_0x5d7a('0x14')]['message']);}})[_0x5d7a('0x15')](function(_0x22a0b2){logger[_0x5d7a('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x179051,_0x22a0b2);_0x2a2c0e(_0x22a0b2);});});} \ No newline at end of file +var _0x4061=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f75b6,_0x4c5a3a){var _0x3092d1=function(_0x3bb379){while(--_0x3bb379){_0x1f75b6['push'](_0x1f75b6['shift']());}};_0x3092d1(++_0x4c5a3a);}(_0x4061,0x88));var _0x1406=function(_0x5dffad,_0x4db2e2){_0x5dffad=_0x5dffad-0x0;var _0x393a9c=_0x4061[_0x5dffad];return _0x393a9c;};'use strict';var _=require(_0x1406('0x0'));var util=require(_0x1406('0x1'));var moment=require(_0x1406('0x2'));var BPromise=require(_0x1406('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1406('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1406('0x5'))(_0x1406('0x6'));var config=require(_0x1406('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1406('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41b126,_0x2dfa88,_0x5e42f6){return new BPromise(function(_0x357ff7,_0x5230af){return client[_0x1406('0x9')](_0x41b126,_0x5e42f6)[_0x1406('0xa')](function(_0x380063){logger[_0x1406('0xb')](_0x1406('0xc'),_0x2dfa88,_0x1406('0xd'));logger[_0x1406('0xe')](_0x1406('0xf'),_0x2dfa88,_0x1406('0xd'),JSON[_0x1406('0x10')](_0x380063));if(_0x380063['error']){if(_0x380063[_0x1406('0x11')][_0x1406('0x12')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2dfa88,_0x380063[_0x1406('0x11')]['message']);return _0x5230af(_0x380063[_0x1406('0x11')][_0x1406('0x13')]);}logger[_0x1406('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2dfa88,_0x380063[_0x1406('0x11')][_0x1406('0x13')]);return _0x357ff7(_0x380063[_0x1406('0x11')]['message']);}else{logger[_0x1406('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2dfa88,_0x1406('0xd'));_0x357ff7(_0x380063[_0x1406('0x14')][_0x1406('0x13')]);}})[_0x1406('0x15')](function(_0x598dc2){logger[_0x1406('0x11')](_0x1406('0xc'),_0x2dfa88,_0x598dc2);_0x5230af(_0x598dc2);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8fa5f14..0631267 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 _0x0064=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','clone','/:id','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5cd7a3,_0x1aa14f){var _0x21235d=function(_0x3152a9){while(--_0x3152a9){_0x5cd7a3['push'](_0x5cd7a3['shift']());}};_0x21235d(++_0x1aa14f);}(_0x0064,0x6a));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4006('0x0'));var express=require(_0x4006('0x1'));var router=express[_0x4006('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4006('0x3'));var interaction=require(_0x4006('0x4'));var config=require(_0x4006('0x5'));var controller=require(_0x4006('0x6'));router[_0x4006('0x7')]('/',auth[_0x4006('0x8')](),controller['index']);router[_0x4006('0x7')]('/:id',auth[_0x4006('0x8')](),controller[_0x4006('0x9')]);router[_0x4006('0x7')](_0x4006('0xa'),auth[_0x4006('0x8')](),controller[_0x4006('0xb')]);router[_0x4006('0x7')](_0x4006('0xc'),auth['isAuthenticated'](),controller[_0x4006('0xd')]);router[_0x4006('0x7')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x4006('0xe')),controller[_0x4006('0xf')]);router[_0x4006('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4006('0x10')]('/:id/clone',auth[_0x4006('0x8')](),controller[_0x4006('0x11')]);router['put'](_0x4006('0x12'),auth['isAuthenticated'](),controller[_0x4006('0x13')]);router['delete']('/:id',auth[_0x4006('0x8')](),controller[_0x4006('0x14')]);module[_0x4006('0x15')]=router; \ No newline at end of file +var _0x19c3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','show','isAuthenticated','getSessions','getAnswers','30s','getSummary','create','post','/:id/clone','clone','put','update','delete','exports','path','connect-timeout','express'];(function(_0x4e9345,_0x2aa5b4){var _0x3e3e48=function(_0x303505){while(--_0x303505){_0x4e9345['push'](_0x4e9345['shift']());}};_0x3e3e48(++_0x2aa5b4);}(_0x19c3,0x7f));var _0x319c=function(_0x4003c1,_0x4cb7b2){_0x4003c1=_0x4003c1-0x0;var _0xc8d345=_0x19c3[_0x4003c1];return _0xc8d345;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x319c('0x0'));var timeout=require(_0x319c('0x1'));var express=require(_0x319c('0x2'));var router=express[_0x319c('0x3')]();var fs_extra=require(_0x319c('0x4'));var auth=require(_0x319c('0x5'));var interaction=require(_0x319c('0x6'));var config=require(_0x319c('0x7'));var controller=require(_0x319c('0x8'));router[_0x319c('0x9')]('/',auth['isAuthenticated'](),controller[_0x319c('0xa')]);router['get'](_0x319c('0xb'),auth['isAuthenticated'](),controller[_0x319c('0xc')]);router[_0x319c('0x9')]('/:id/sessions',auth[_0x319c('0xd')](),controller[_0x319c('0xe')]);router[_0x319c('0x9')]('/:id/answers',auth[_0x319c('0xd')](),controller[_0x319c('0xf')]);router['get']('/:id/summary',auth[_0x319c('0xd')](),timeout(_0x319c('0x10')),controller[_0x319c('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x319c('0x12')]);router[_0x319c('0x13')](_0x319c('0x14'),auth[_0x319c('0xd')](),controller[_0x319c('0x15')]);router[_0x319c('0x16')](_0x319c('0xb'),auth['isAuthenticated'](),controller[_0x319c('0x17')]);router[_0x319c('0x18')]('/:id',auth[_0x319c('0xd')](),controller['destroy']);module[_0x319c('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 5745983..8359821 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 _0xeacc=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name','TEXT','long','setDataValue','stringify','formData'];(function(_0x10501,_0x1542f3){var _0x2ee5a1=function(_0x2e3182){while(--_0x2e3182){_0x10501['push'](_0x10501['shift']());}};_0x2ee5a1(++_0x1542f3);}(_0xeacc,0xd6));var _0xceac=function(_0xe995f1,_0x5c2868){_0xe995f1=_0xe995f1-0x0;var _0x261fff=_0xeacc[_0xe995f1];return _0x261fff;};'use strict';var Sequelize=require(_0xceac('0x0'));var _=require(_0xceac('0x1'));var util=require(_0xceac('0x2'));module[_0xceac('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0xceac('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xceac('0x5')](_0xceac('0x6')),'set':function(_0x4fb817){if(_['isObjectLike'](_0x4fb817)){this[_0xceac('0x7')]('formData',JSON[_0xceac('0x8')](_0x4fb817));}else if(_['isString'](_0x4fb817)){this[_0xceac('0x7')](_0xceac('0x9'),_0x4fb817);}else{this[_0xceac('0x7')](_0xceac('0x9'),util['format'](_0xceac('0xa'),this[_0xceac('0xb')]('name')||'',this['getDataValue'](_0xceac('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xceac('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x9f5b=['name','TEXT','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','sequelize','util','exports'];(function(_0x2795ff,_0x48d3ea){var _0x9d96be=function(_0x14c181){while(--_0x14c181){_0x2795ff['push'](_0x2795ff['shift']());}};_0x9d96be(++_0x48d3ea);}(_0x9f5b,0xbd));var _0xb9f5=function(_0x4e9e24,_0x34b638){_0x4e9e24=_0x4e9e24-0x0;var _0x3ef905=_0x9f5b[_0x4e9e24];return _0x3ef905;};'use strict';var Sequelize=require(_0xb9f5('0x0'));var _=require('lodash');var util=require(_0xb9f5('0x1'));module[_0xb9f5('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xb9f5('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb9f5('0x4')]('long'),'set':function(_0x4a3e09){if(_[_0xb9f5('0x5')](_0x4a3e09)){this[_0xb9f5('0x6')](_0xb9f5('0x7'),JSON[_0xb9f5('0x8')](_0x4a3e09));}else if(_[_0xb9f5('0x9')](_0x4a3e09)){this[_0xb9f5('0x6')]('formData',_0x4a3e09);}else{this[_0xb9f5('0x6')](_0xb9f5('0x7'),util['format'](_0xb9f5('0xa'),this[_0xb9f5('0xb')](_0xb9f5('0x3'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 882afb5..055f9a3 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 _0xb921=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','UserProfileResource','error','name','index','map','JscriptyProject','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','omit','updatedAt','createdAt','userProfileId','getSessions','findOne','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','indexOf','toString','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x15a6a1,_0x4d795b){var _0x574bee=function(_0x38b7ba){while(--_0x38b7ba){_0x15a6a1['push'](_0x15a6a1['shift']());}};_0x574bee(++_0x4d795b);}(_0xb921,0x16a));var _0x1b92=function(_0x19b834,_0x590212){_0x19b834=_0x19b834-0x0;var _0x43f4f1=_0xb921[_0x19b834];return _0x43f4f1;};'use strict';var emlformat=require(_0x1b92('0x0'));var rimraf=require(_0x1b92('0x1'));var zipdir=require(_0x1b92('0x2'));var jsonpatch=require(_0x1b92('0x3'));var rp=require(_0x1b92('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b92('0x5'));var util=require(_0x1b92('0x6'));var path=require(_0x1b92('0x7'));var sox=require(_0x1b92('0x8'));var csv=require(_0x1b92('0x9'));var ejs=require(_0x1b92('0xa'));var fs=require('fs');var fs_extra=require(_0x1b92('0xb'));var _=require(_0x1b92('0xc'));var squel=require(_0x1b92('0xd'));var crypto=require(_0x1b92('0xe'));var jsforce=require(_0x1b92('0xf'));var deskjs=require(_0x1b92('0x10'));var toCsv=require(_0x1b92('0x9'));var querystring=require(_0x1b92('0x11'));var Papa=require(_0x1b92('0x12'));var Redis=require('ioredis');var authService=require(_0x1b92('0x13'));var qs=require(_0x1b92('0x14'));var as=require(_0x1b92('0x15'));var hardwareService=require(_0x1b92('0x16'));var logger=require(_0x1b92('0x17'))(_0x1b92('0x18'));var utils=require(_0x1b92('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1b92('0x1a'));var db=require(_0x1b92('0x1b'))['db'];function respondWithStatusCode(_0x5a1ca5,_0x81cbe0){_0x81cbe0=_0x81cbe0||0xcc;return function(_0x29a7ed){if(_0x29a7ed){return _0x5a1ca5[_0x1b92('0x1c')](_0x81cbe0);}return _0x5a1ca5[_0x1b92('0x1d')](_0x81cbe0)[_0x1b92('0x1e')]();};}function respondWithResult(_0x290be6,_0x1d33bf){_0x1d33bf=_0x1d33bf||0xc8;return function(_0x4bbb76){if(_0x4bbb76){return _0x290be6[_0x1b92('0x1d')](_0x1d33bf)['json'](_0x4bbb76);}};}function respondWithFilteredResult(_0x1a559b,_0x511a97){return function(_0x694d4f){if(_0x694d4f){var _0x523285=typeof _0x511a97[_0x1b92('0x1f')]===_0x1b92('0x20')&&typeof _0x511a97[_0x1b92('0x21')]==='undefined';var _0x2d171f=_0x694d4f[_0x1b92('0x22')];var _0x289523=_0x523285?0x0:_0x511a97[_0x1b92('0x1f')];var _0x4368dc=_0x523285?_0x694d4f['count']:_0x511a97[_0x1b92('0x1f')]+_0x511a97[_0x1b92('0x21')];var _0x30b0d8;if(_0x4368dc>=_0x2d171f){_0x4368dc=_0x2d171f;_0x30b0d8=0xc8;}else{_0x30b0d8=0xce;}_0x1a559b['status'](_0x30b0d8);return _0x1a559b[_0x1b92('0x23')](_0x1b92('0x24'),_0x289523+'-'+_0x4368dc+'/'+_0x2d171f)[_0x1b92('0x25')](_0x694d4f);}return null;};}function patchUpdates(_0x4bfc51){return function(_0x1d9d28){try{jsonpatch['apply'](_0x1d9d28,_0x4bfc51,!![]);}catch(_0x39ef4e){return BPromise[_0x1b92('0x26')](_0x39ef4e);}return _0x1d9d28['save']();};}function saveUpdates(_0x4ea25f,_0x34c5c9){return function(_0x311487){if(_0x311487){return _0x311487[_0x1b92('0x27')](_0x4ea25f)[_0x1b92('0x28')](function(_0x41fc82){return _0x41fc82;});}return null;};}function removeEntity(_0x186030,_0x48cdf1){return function(_0x3be220){if(_0x3be220){return _0x3be220[_0x1b92('0x29')]()[_0x1b92('0x28')](function(){var _0x39dcaa=_0x3be220['get']({'plain':!![]});var _0x3f0e1b='Projects';return db[_0x1b92('0x2a')][_0x1b92('0x29')]({'where':{'type':_0x3f0e1b,'resourceId':_0x39dcaa['id']}})[_0x1b92('0x28')](function(){return _0x3be220;});})[_0x1b92('0x28')](function(){_0x186030[_0x1b92('0x1d')](0xcc)[_0x1b92('0x1e')]();});}};}function handleEntityNotFound(_0xa56a28,_0x44f379){return function(_0x4edbce){if(!_0x4edbce){_0xa56a28['sendStatus'](0x194);}return _0x4edbce;};}function handleError(_0x54d92c,_0x229c44){_0x229c44=_0x229c44||0x1f4;return function(_0x525d05){logger[_0x1b92('0x2b')](_0x525d05['stack']);if(_0x525d05[_0x1b92('0x2c')]){delete _0x525d05[_0x1b92('0x2c')];}_0x54d92c[_0x1b92('0x1d')](_0x229c44)['send'](_0x525d05);};}exports[_0x1b92('0x2d')]=function(_0x6f9678,_0x55eafd){var _0x544105={},_0x477498={},_0x3740e1={'count':0x0,'rows':[]};var _0x165f93=_[_0x1b92('0x2e')](db[_0x1b92('0x2f')]['rawAttributes'],function(_0x1f38f3){return{'name':_0x1f38f3[_0x1b92('0x30')],'type':_0x1f38f3[_0x1b92('0x31')][_0x1b92('0x32')]};});_0x477498[_0x1b92('0x33')]=_[_0x1b92('0x2e')](_0x165f93,_0x1b92('0x2c'));_0x477498['query']=_[_0x1b92('0x34')](_0x6f9678[_0x1b92('0x35')]);_0x477498['filters']=_[_0x1b92('0x36')](_0x477498[_0x1b92('0x33')],_0x477498[_0x1b92('0x35')]);_0x544105['attributes']=_[_0x1b92('0x36')](_0x477498[_0x1b92('0x33')],qs['fields'](_0x6f9678['query'][_0x1b92('0x37')]));_0x544105[_0x1b92('0x38')]=_0x544105[_0x1b92('0x38')][_0x1b92('0x39')]?_0x544105['attributes']:_0x477498['model'];if(!_0x6f9678['query'][_0x1b92('0x3a')](_0x1b92('0x3b'))){_0x544105[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x21')]);_0x544105[_0x1b92('0x1f')]=qs['offset'](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x544105['order']=qs[_0x1b92('0x3c')](_0x6f9678[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x544105[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x6f9678[_0x1b92('0x35')],_0x477498[_0x1b92('0x3e')]),_0x165f93);if(_0x6f9678[_0x1b92('0x35')][_0x1b92('0x40')]){_0x544105['where']=_[_0x1b92('0x41')](_0x544105['where'],{'$or':_[_0x1b92('0x2e')](_0x165f93,function(_0x588b3c){if(_0x588b3c[_0x1b92('0x31')]!==_0x1b92('0x42')){var _0x25e709={};_0x25e709[_0x588b3c[_0x1b92('0x2c')]]={'$like':'%'+_0x6f9678[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x25e709;}})});}_0x544105=_[_0x1b92('0x41')]({},_0x544105,_0x6f9678[_0x1b92('0x43')]);var _0x46b06b={'where':_0x544105['where']};return db[_0x1b92('0x2f')]['count'](_0x46b06b)[_0x1b92('0x28')](function(_0x1e945){_0x3740e1[_0x1b92('0x22')]=_0x1e945;if(_0x6f9678[_0x1b92('0x35')]['includeAll']){_0x544105[_0x1b92('0x44')]=[{'all':!![]}];}return db[_0x1b92('0x2f')][_0x1b92('0x45')](_0x544105);})[_0x1b92('0x28')](function(_0xd3f7b0){_0x3740e1[_0x1b92('0x46')]=_0xd3f7b0;return _0x3740e1;})['then'](respondWithFilteredResult(_0x55eafd,_0x544105))[_0x1b92('0x47')](handleError(_0x55eafd,null));};exports[_0x1b92('0x48')]=function(_0x2dcd14,_0x1cb316){var _0x3f77c3={'raw':![],'where':{'id':_0x2dcd14['params']['id']}},_0x2bb12f={};_0x2bb12f[_0x1b92('0x33')]=_[_0x1b92('0x34')](db['JscriptyProject'][_0x1b92('0x49')]);_0x2bb12f['query']=_[_0x1b92('0x34')](_0x2dcd14[_0x1b92('0x35')]);_0x2bb12f[_0x1b92('0x3e')]=_['intersection'](_0x2bb12f[_0x1b92('0x33')],_0x2bb12f[_0x1b92('0x35')]);_0x3f77c3['attributes']=_['intersection'](_0x2bb12f['model'],qs[_0x1b92('0x37')](_0x2dcd14[_0x1b92('0x35')][_0x1b92('0x37')]));_0x3f77c3[_0x1b92('0x38')]=_0x3f77c3[_0x1b92('0x38')][_0x1b92('0x39')]?_0x3f77c3['attributes']:_0x2bb12f[_0x1b92('0x33')];if(_0x2dcd14[_0x1b92('0x35')]['includeAll']){_0x3f77c3[_0x1b92('0x44')]=[{'all':!![]}];}_0x3f77c3=_[_0x1b92('0x41')]({},_0x3f77c3,_0x2dcd14[_0x1b92('0x43')]);return db['JscriptyProject'][_0x1b92('0x4a')](_0x3f77c3)[_0x1b92('0x28')](handleEntityNotFound(_0x1cb316,null))[_0x1b92('0x28')](respondWithResult(_0x1cb316,null))[_0x1b92('0x47')](handleError(_0x1cb316,null));};exports[_0x1b92('0x4b')]=function(_0x5ac096,_0x142d28){return db[_0x1b92('0x2f')][_0x1b92('0x4b')](_0x5ac096[_0x1b92('0x4c')],{})[_0x1b92('0x28')](function(_0x515292){var _0x5c5ebf=_0x5ac096[_0x1b92('0x4d')][_0x1b92('0x4e')]({'plain':!![]});if(!_0x5c5ebf)throw new Error(_0x1b92('0x4f'));if(_0x5c5ebf[_0x1b92('0x50')]==='user'){var _0x4e0954=_0x515292[_0x1b92('0x4e')]({'plain':!![]});var _0x5e10fa=_0x1b92('0x51');return db[_0x1b92('0x52')][_0x1b92('0x4a')]({'where':{'name':_0x5e10fa,'userProfileId':_0x5c5ebf['userProfileId']},'raw':!![]})[_0x1b92('0x28')](function(_0x559e3c){if(_0x559e3c&&_0x559e3c[_0x1b92('0x53')]===0x0){return db[_0x1b92('0x2a')][_0x1b92('0x4b')]({'name':_0x4e0954[_0x1b92('0x2c')],'resourceId':_0x4e0954['id'],'type':_0x559e3c[_0x1b92('0x2c')],'sectionId':_0x559e3c['id']},{})[_0x1b92('0x28')](function(){return _0x515292;});}else{return _0x515292;}})['catch'](function(_0x140202){logger['error'](_0x1b92('0x54'),_0x140202);throw _0x140202;});}return _0x515292;})[_0x1b92('0x28')](respondWithResult(_0x142d28,0xc9))[_0x1b92('0x47')](handleError(_0x142d28,null));};exports[_0x1b92('0x55')]=function(_0x376a9c,_0x3cab8e){var _0x306395={'where':{'id':_0x376a9c[_0x1b92('0x56')]['id']}},_0x32d994={};_0x32d994[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x2f')][_0x1b92('0x49')]);_0x306395[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x32d994[_0x1b92('0x33')],qs[_0x1b92('0x37')](_0x376a9c[_0x1b92('0x35')][_0x1b92('0x37')]));_0x306395[_0x1b92('0x38')]=_0x306395['attributes'][_0x1b92('0x39')]?_0x306395[_0x1b92('0x38')]:_0x32d994['model'];if(_0x376a9c[_0x1b92('0x35')][_0x1b92('0x57')]){_0x306395['include']=[{'all':!![]}];}_0x306395=_['merge']({},_0x306395,_0x376a9c[_0x1b92('0x43')]);return db[_0x1b92('0x2f')]['find'](_0x306395)[_0x1b92('0x28')](handleEntityNotFound(_0x3cab8e,null))[_0x1b92('0x28')](function(_0x1519d7){if(_0x1519d7){var _0x33069d=_0x1519d7[_0x1b92('0x4e')]({'plain':!![]});_0x33069d=qs[_0x1b92('0x58')](_0x33069d,['id','createdAt',_0x1b92('0x59')]);_0x376a9c['body']=_['omit'](_0x376a9c[_0x1b92('0x4c')],['id',_0x1b92('0x5a'),_0x1b92('0x59')]);return db[_0x1b92('0x2f')][_0x1b92('0x4b')](_[_0x1b92('0x41')](_0x33069d,_0x376a9c[_0x1b92('0x4c')]),{'include':_0x376a9c[_0x1b92('0x35')][_0x1b92('0x57')]?[{'all':!![]}]:undefined})[_0x1b92('0x28')](function(_0x587956){var _0x3ad925=_0x376a9c[_0x1b92('0x4d')][_0x1b92('0x4e')]({'plain':!![]});if(!_0x3ad925)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ad925['role']===_0x1b92('0x4d')){var _0x1b5c91=_0x587956[_0x1b92('0x4e')]({'plain':!![]});var _0x456f8c=_0x1b92('0x51');return db[_0x1b92('0x52')][_0x1b92('0x4a')]({'where':{'name':_0x456f8c,'userProfileId':_0x3ad925[_0x1b92('0x5b')]},'raw':!![]})[_0x1b92('0x28')](function(_0x406dd4){if(_0x406dd4&&_0x406dd4[_0x1b92('0x53')]===0x0){return db[_0x1b92('0x2a')]['create']({'name':_0x1b5c91[_0x1b92('0x2c')],'resourceId':_0x1b5c91['id'],'type':_0x406dd4[_0x1b92('0x2c')],'sectionId':_0x406dd4['id']},{})['then'](function(){return _0x587956;});}else{return _0x587956;}})[_0x1b92('0x47')](function(_0x46d1e9){logger['error'](_0x1b92('0x54'),_0x46d1e9);throw _0x46d1e9;});}return _0x587956;});}})[_0x1b92('0x28')](respondWithResult(_0x3cab8e,0xc9))[_0x1b92('0x47')](handleError(_0x3cab8e,null));};exports[_0x1b92('0x27')]=function(_0x2540d2,_0x590426){if(_0x2540d2['body']['id']){delete _0x2540d2['body']['id'];}return db['JscriptyProject'][_0x1b92('0x4a')]({'where':{'id':_0x2540d2[_0x1b92('0x56')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x590426,null))[_0x1b92('0x28')](saveUpdates(_0x2540d2['body'],null))[_0x1b92('0x28')](respondWithResult(_0x590426,null))[_0x1b92('0x47')](handleError(_0x590426,null));};exports['destroy']=function(_0x31977e,_0x51a2a1){return db['JscriptyProject'][_0x1b92('0x4a')]({'where':{'id':_0x31977e['params']['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x51a2a1,null))[_0x1b92('0x28')](removeEntity(_0x51a2a1,null))[_0x1b92('0x47')](handleError(_0x51a2a1,null));};exports[_0x1b92('0x5c')]=function(_0x197a4b,_0xd092bb,_0x5b408e){var _0x1e5951={'raw':!![],'where':{}};var _0x1bab85={};var _0xc0a853={'count':0x0,'rows':[]};return db[_0x1b92('0x2f')][_0x1b92('0x5d')]({'where':{'id':_0x197a4b['params']['id']}})['then'](handleEntityNotFound(_0xd092bb,null))[_0x1b92('0x28')](function(_0x22e1b2){if(_0x22e1b2){_0x1bab85[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x5e')][_0x1b92('0x49')]);_0x1bab85[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0x197a4b[_0x1b92('0x35')]);_0x1bab85['filters']=_[_0x1b92('0x36')](_0x1bab85[_0x1b92('0x33')],_0x1bab85[_0x1b92('0x35')]);_0x1e5951[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x1bab85[_0x1b92('0x33')],qs[_0x1b92('0x37')](_0x197a4b['query'][_0x1b92('0x37')]));_0x1e5951['attributes']=_0x1e5951['attributes'][_0x1b92('0x39')]?_0x1e5951[_0x1b92('0x38')]:_0x1bab85[_0x1b92('0x33')];if(!_0x197a4b[_0x1b92('0x35')]['hasOwnProperty']('nolimit')){_0x1e5951[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x197a4b['query'][_0x1b92('0x21')]);_0x1e5951[_0x1b92('0x1f')]=qs[_0x1b92('0x1f')](_0x197a4b[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x1e5951[_0x1b92('0x5f')]=qs['sort'](_0x197a4b[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x1e5951[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x197a4b['query'],_0x1bab85[_0x1b92('0x3e')]));_0x1e5951[_0x1b92('0x3d')][_0x1b92('0x60')]=_0x22e1b2['id'];if(_0x197a4b[_0x1b92('0x35')]['filter']){_0x1e5951[_0x1b92('0x3d')]=_[_0x1b92('0x41')](_0x1e5951['where'],{'$or':_[_0x1b92('0x2e')](_0x1e5951[_0x1b92('0x38')],function(_0x23958a){var _0x2fb82b={};_0x2fb82b[_0x23958a]={'$like':'%'+_0x197a4b[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x2fb82b;})});}_0x1e5951=_['merge']({},_0x1e5951,_0x197a4b[_0x1b92('0x43')]);return db[_0x1b92('0x5e')][_0x1b92('0x22')]({'where':_0x1e5951[_0x1b92('0x3d')]})[_0x1b92('0x28')](function(_0x2fa5d9){_0xc0a853[_0x1b92('0x22')]=_0x2fa5d9;if(_0x197a4b['query'][_0x1b92('0x57')]){_0x1e5951[_0x1b92('0x44')]=[{'all':!![]}];}return db[_0x1b92('0x5e')]['findAll'](_0x1e5951);})[_0x1b92('0x28')](function(_0x17bde5){_0xc0a853[_0x1b92('0x46')]=_0x17bde5;return _0xc0a853;});}})[_0x1b92('0x28')](respondWithFilteredResult(_0xd092bb,_0x1e5951))[_0x1b92('0x47')](handleError(_0xd092bb,null));};exports[_0x1b92('0x61')]=function(_0x685d82,_0x452284,_0x5c6586){var _0x334e3a={'raw':!![],'where':{}};var _0x558978={};var _0x22b84e={'count':0x0,'rows':[]};return db[_0x1b92('0x2f')][_0x1b92('0x5d')]({'where':{'id':_0x685d82[_0x1b92('0x56')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0x452284,null))['then'](function(_0x1b74f3){if(_0x1b74f3){_0x558978[_0x1b92('0x33')]=_[_0x1b92('0x34')](db[_0x1b92('0x62')][_0x1b92('0x49')]);_0x558978[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0x685d82[_0x1b92('0x35')]);_0x558978[_0x1b92('0x3e')]=_[_0x1b92('0x36')](_0x558978['model'],_0x558978[_0x1b92('0x35')]);_0x334e3a[_0x1b92('0x38')]=_[_0x1b92('0x36')](_0x558978['model'],qs[_0x1b92('0x37')](_0x685d82[_0x1b92('0x35')]['fields']));_0x334e3a[_0x1b92('0x38')]=_0x334e3a['attributes'][_0x1b92('0x39')]?_0x334e3a['attributes']:_0x558978['model'];if(!_0x685d82['query'][_0x1b92('0x3a')](_0x1b92('0x3b'))){_0x334e3a[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x685d82[_0x1b92('0x35')]['limit']);_0x334e3a[_0x1b92('0x1f')]=qs[_0x1b92('0x1f')](_0x685d82[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x334e3a[_0x1b92('0x5f')]=qs['sort'](_0x685d82[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x334e3a[_0x1b92('0x3d')]=qs[_0x1b92('0x3e')](_[_0x1b92('0x3f')](_0x685d82[_0x1b92('0x35')],_0x558978[_0x1b92('0x3e')]));_0x334e3a[_0x1b92('0x3d')]['ProjectId']=_0x1b74f3['id'];if(_0x685d82[_0x1b92('0x35')]['filter']){_0x334e3a[_0x1b92('0x3d')]=_['merge'](_0x334e3a[_0x1b92('0x3d')],{'$or':_[_0x1b92('0x2e')](_0x334e3a['attributes'],function(_0xb08603){var _0x21466a={};_0x21466a[_0xb08603]={'$like':'%'+_0x685d82[_0x1b92('0x35')][_0x1b92('0x40')]+'%'};return _0x21466a;})});}_0x334e3a=_[_0x1b92('0x41')]({},_0x334e3a,_0x685d82[_0x1b92('0x43')]);return db[_0x1b92('0x62')][_0x1b92('0x22')]({'where':_0x334e3a[_0x1b92('0x3d')]})['then'](function(_0x159bc8){_0x22b84e[_0x1b92('0x22')]=_0x159bc8;if(_0x685d82[_0x1b92('0x35')]['includeAll']){_0x334e3a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x334e3a);})[_0x1b92('0x28')](function(_0x22ea06){_0x22b84e[_0x1b92('0x46')]=_0x22ea06;return _0x22b84e;});}})['then'](respondWithFilteredResult(_0x452284,_0x334e3a))[_0x1b92('0x47')](handleError(_0x452284,null));};function char(_0x121aac){return _0x1b92('0x63')===typeof _0x121aac?String[_0x1b92('0x64')][_0x1b92('0x65')](null,arguments):_0x121aac;}function needsEncapsulation(_0x341b0d){return!!_0x341b0d&&(_0x341b0d['toString']()[_0x1b92('0x66')](char(0xd))>=0x0||_0x341b0d[_0x1b92('0x67')]()[_0x1b92('0x66')](char(0xa))>=0x0||_0x341b0d['toString']()[_0x1b92('0x66')](char(0x2c))>=0x0||_0x341b0d[_0x1b92('0x67')]()[_0x1b92('0x66')](char(0x22))>=0x0);}function encapsulate(_0x41b264){var _0x550cb4=char(0x22),_0x4d8dd1='\x5c'+char(0x22),_0x9fd44d=_0x41b264[_0x1b92('0x67')]()[_0x1b92('0x68')](new RegExp(_0x550cb4,'g'),_0x4d8dd1);return _0x550cb4+_0x9fd44d+_0x550cb4;}exports[_0x1b92('0x69')]=function(_0x2624ef,_0x5befe5,_0x43f256){var _0xf2629a,_0x40b0a3;var _0x186d97={'where':{'ProjectId':_0x2624ef[_0x1b92('0x56')]['id']}};if(_0x2624ef[_0x1b92('0x35')][_0x1b92('0x6a')]){_0x186d97[_0x1b92('0x3d')][_0x1b92('0x6b')]=JSON[_0x1b92('0x6c')](_0x2624ef[_0x1b92('0x35')][_0x1b92('0x6a')]);}return db[_0x1b92('0x5e')][_0x1b92('0x45')](_0x186d97)['then'](handleEntityNotFound(_0x5befe5,null))[_0x1b92('0x28')](function(_0x3ab527){if(_0x3ab527){_0xf2629a=_0x3ab527;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_['map'](_0xf2629a,'id')},'ProjectId':_0x2624ef[_0x1b92('0x56')]['id']},'order':_0x1b92('0x6d')});}})['then'](handleEntityNotFound(_0x5befe5,null))[_0x1b92('0x28')](function(_0x37c820){if(_0x37c820){_0x40b0a3=_0x37c820;var _0x319aca={};for(var _0x51133b=0x0,_0xdfaaff=_0x40b0a3[_0x1b92('0x39')];_0x51133b<_0xdfaaff;_0x51133b++){if(!_0x319aca[_0x1b92('0x3a')](_0x40b0a3[_0x51133b][_0x1b92('0x6e')])){_0x319aca[_0x40b0a3[_0x51133b][_0x1b92('0x6e')]]=needsEncapsulation(_0x40b0a3[_0x51133b][_0x1b92('0x6f')])?encapsulate(_0x40b0a3[_0x51133b]['question']):_0x40b0a3[_0x51133b][_0x1b92('0x6f')];}}var _0x172083=[],_0x1d7232={};for(var _0x51cd82=0x0,_0x418a0c=_0xf2629a[_0x1b92('0x39')];_0x51cd82<_0x418a0c;_0x51cd82++){_0x1d7232={'ProjectId':_0x2624ef['params']['id'],'SessionId':_0xf2629a[_0x51cd82]['id'],'StartTime':moment(_0xf2629a[_0x51cd82][_0x1b92('0x6b')])[_0x1b92('0x70')](_0x1b92('0x71'))};for(var _0x2b3fa0=0x0,_0x7e13b0=_0x40b0a3[_0x1b92('0x39')];_0x2b3fa0<_0x7e13b0;_0x2b3fa0++){if(_0x40b0a3[_0x2b3fa0][_0x1b92('0x72')]==_0xf2629a[_0x51cd82]['id']&&_0x319aca[_0x1b92('0x3a')](_0x40b0a3[_0x2b3fa0]['questionId'])){_0x1d7232[_0x319aca[_0x40b0a3[_0x2b3fa0][_0x1b92('0x6e')]]]=_0x40b0a3[_0x2b3fa0]['answer'];}}for(var _0x34ad43 in _0x319aca){if(!_0x1d7232['hasOwnProperty'](_0x319aca[_0x34ad43])){_0x1d7232[_0x319aca[_0x34ad43]]=null;}}_0x172083[_0x1b92('0x73')](_0x1d7232);}return _0x172083;}})[_0x1b92('0x28')](function(_0x1bbdb1){if(!_[_0x1b92('0x74')](_0x1bbdb1)){var _0x1b4733=toCsv(_0x1bbdb1);var _0x3573fb=Date['now']();fs[_0x1b92('0x75')](util[_0x1b92('0x70')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2624ef[_0x1b92('0x56')]['id'],_0x3573fb),_0x1b4733);_0x5befe5[_0x1b92('0x76')](_0x1b92('0x77'),_0x1b92('0x78')+util['format'](_0x1b92('0x79'),_0x2624ef[_0x1b92('0x56')]['id'],_0x3573fb));_0x5befe5[_0x1b92('0x76')](_0x1b92('0x7a'),_0x1b92('0x7b'));return _0x5befe5['download'](util[_0x1b92('0x70')](_0x1b92('0x7c'),_0x2624ef['params']['id'],_0x3573fb));}else{return _0x5befe5[_0x1b92('0x1c')](0xcc);}})['catch'](handleError(_0x5befe5,null));}; \ No newline at end of file +var _0x85ed=['api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','send','index','map','JscriptyProject','fieldName','type','key','query','keys','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x432b5e,_0x4a7c91){var _0xbbe93b=function(_0xd25444){while(--_0xd25444){_0x432b5e['push'](_0x432b5e['shift']());}};_0xbbe93b(++_0x4a7c91);}(_0x85ed,0x66));var _0xd85e=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x85ed[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0xd85e('0x0'));var rimraf=require(_0xd85e('0x1'));var zipdir=require(_0xd85e('0x2'));var jsonpatch=require(_0xd85e('0x3'));var rp=require(_0xd85e('0x4'));var moment=require(_0xd85e('0x5'));var BPromise=require(_0xd85e('0x6'));var Mustache=require('mustache');var util=require(_0xd85e('0x7'));var path=require(_0xd85e('0x8'));var sox=require(_0xd85e('0x9'));var csv=require(_0xd85e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd85e('0xb'));var _=require(_0xd85e('0xc'));var squel=require('squel');var crypto=require(_0xd85e('0xd'));var jsforce=require(_0xd85e('0xe'));var deskjs=require(_0xd85e('0xf'));var toCsv=require(_0xd85e('0xa'));var querystring=require('querystring');var Papa=require(_0xd85e('0x10'));var Redis=require(_0xd85e('0x11'));var authService=require(_0xd85e('0x12'));var qs=require(_0xd85e('0x13'));var as=require(_0xd85e('0x14'));var hardwareService=require(_0xd85e('0x15'));var logger=require('../../config/logger')(_0xd85e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd85e('0x17'));var db=require(_0xd85e('0x18'))['db'];function respondWithStatusCode(_0x5e9b20,_0x374652){_0x374652=_0x374652||0xcc;return function(_0x7d5918){if(_0x7d5918){return _0x5e9b20[_0xd85e('0x19')](_0x374652);}return _0x5e9b20['status'](_0x374652)[_0xd85e('0x1a')]();};}function respondWithResult(_0x33addd,_0xe0c8df){_0xe0c8df=_0xe0c8df||0xc8;return function(_0x32a52c){if(_0x32a52c){return _0x33addd[_0xd85e('0x1b')](_0xe0c8df)['json'](_0x32a52c);}};}function respondWithFilteredResult(_0x356b3f,_0x5ba31d){return function(_0x3aa5f6){if(_0x3aa5f6){var _0x3123a3=typeof _0x5ba31d[_0xd85e('0x1c')]==='undefined'&&typeof _0x5ba31d[_0xd85e('0x1d')]===_0xd85e('0x1e');var _0x56b412=_0x3aa5f6[_0xd85e('0x1f')];var _0x673820=_0x3123a3?0x0:_0x5ba31d[_0xd85e('0x1c')];var _0x4c432d=_0x3123a3?_0x3aa5f6[_0xd85e('0x1f')]:_0x5ba31d[_0xd85e('0x1c')]+_0x5ba31d[_0xd85e('0x1d')];var _0x1dfff9;if(_0x4c432d>=_0x56b412){_0x4c432d=_0x56b412;_0x1dfff9=0xc8;}else{_0x1dfff9=0xce;}_0x356b3f[_0xd85e('0x1b')](_0x1dfff9);return _0x356b3f[_0xd85e('0x20')](_0xd85e('0x21'),_0x673820+'-'+_0x4c432d+'/'+_0x56b412)[_0xd85e('0x22')](_0x3aa5f6);}return null;};}function patchUpdates(_0x2e0c94){return function(_0x3834ad){try{jsonpatch['apply'](_0x3834ad,_0x2e0c94,!![]);}catch(_0x255785){return BPromise[_0xd85e('0x23')](_0x255785);}return _0x3834ad[_0xd85e('0x24')]();};}function saveUpdates(_0x2ef958,_0xe9991){return function(_0x595199){if(_0x595199){return _0x595199[_0xd85e('0x25')](_0x2ef958)[_0xd85e('0x26')](function(_0x194173){return _0x194173;});}return null;};}function removeEntity(_0x4f620e,_0x45c727){return function(_0x44168e){if(_0x44168e){return _0x44168e[_0xd85e('0x27')]()[_0xd85e('0x26')](function(){var _0x26e64a=_0x44168e[_0xd85e('0x28')]({'plain':!![]});var _0x5604ae=_0xd85e('0x29');return db[_0xd85e('0x2a')][_0xd85e('0x27')]({'where':{'type':_0x5604ae,'resourceId':_0x26e64a['id']}})[_0xd85e('0x26')](function(){return _0x44168e;});})[_0xd85e('0x26')](function(){_0x4f620e[_0xd85e('0x1b')](0xcc)[_0xd85e('0x1a')]();});}};}function handleEntityNotFound(_0x1d659e,_0x540149){return function(_0x5e0914){if(!_0x5e0914){_0x1d659e[_0xd85e('0x19')](0x194);}return _0x5e0914;};}function handleError(_0x2fab0f,_0x3000cf){_0x3000cf=_0x3000cf||0x1f4;return function(_0x5dc7ac){logger['error'](_0x5dc7ac[_0xd85e('0x2b')]);if(_0x5dc7ac['name']){delete _0x5dc7ac[_0xd85e('0x2c')];}_0x2fab0f[_0xd85e('0x1b')](_0x3000cf)[_0xd85e('0x2d')](_0x5dc7ac);};}exports[_0xd85e('0x2e')]=function(_0x49cd47,_0x5ec4e9){var _0x5c5d9e={},_0x5c9879={},_0x5d4154={'count':0x0,'rows':[]};var _0x385823=_[_0xd85e('0x2f')](db[_0xd85e('0x30')]['rawAttributes'],function(_0x6a901d){return{'name':_0x6a901d[_0xd85e('0x31')],'type':_0x6a901d[_0xd85e('0x32')][_0xd85e('0x33')]};});_0x5c9879['model']=_[_0xd85e('0x2f')](_0x385823,_0xd85e('0x2c'));_0x5c9879[_0xd85e('0x34')]=_[_0xd85e('0x35')](_0x49cd47[_0xd85e('0x34')]);_0x5c9879['filters']=_[_0xd85e('0x36')](_0x5c9879['model'],_0x5c9879['query']);_0x5c5d9e[_0xd85e('0x37')]=_[_0xd85e('0x36')](_0x5c9879[_0xd85e('0x38')],qs['fields'](_0x49cd47['query'][_0xd85e('0x39')]));_0x5c5d9e['attributes']=_0x5c5d9e[_0xd85e('0x37')]['length']?_0x5c5d9e['attributes']:_0x5c9879[_0xd85e('0x38')];if(!_0x49cd47[_0xd85e('0x34')]['hasOwnProperty'](_0xd85e('0x3a'))){_0x5c5d9e[_0xd85e('0x1d')]=qs[_0xd85e('0x1d')](_0x49cd47[_0xd85e('0x34')][_0xd85e('0x1d')]);_0x5c5d9e[_0xd85e('0x1c')]=qs[_0xd85e('0x1c')](_0x49cd47[_0xd85e('0x34')][_0xd85e('0x1c')]);}_0x5c5d9e[_0xd85e('0x3b')]=qs[_0xd85e('0x3c')](_0x49cd47[_0xd85e('0x34')][_0xd85e('0x3c')]);_0x5c5d9e[_0xd85e('0x3d')]=qs['filters'](_[_0xd85e('0x3e')](_0x49cd47[_0xd85e('0x34')],_0x5c9879[_0xd85e('0x3f')]),_0x385823);if(_0x49cd47[_0xd85e('0x34')][_0xd85e('0x40')]){_0x5c5d9e[_0xd85e('0x3d')]=_[_0xd85e('0x41')](_0x5c5d9e[_0xd85e('0x3d')],{'$or':_[_0xd85e('0x2f')](_0x385823,function(_0x34349f){if(_0x34349f[_0xd85e('0x32')]!==_0xd85e('0x42')){var _0x2b3848={};_0x2b3848[_0x34349f[_0xd85e('0x2c')]]={'$like':'%'+_0x49cd47['query'][_0xd85e('0x40')]+'%'};return _0x2b3848;}})});}_0x5c5d9e=_[_0xd85e('0x41')]({},_0x5c5d9e,_0x49cd47[_0xd85e('0x43')]);var _0x5363ae={'where':_0x5c5d9e['where']};return db[_0xd85e('0x30')][_0xd85e('0x1f')](_0x5363ae)[_0xd85e('0x26')](function(_0x562cbd){_0x5d4154[_0xd85e('0x1f')]=_0x562cbd;if(_0x49cd47[_0xd85e('0x34')][_0xd85e('0x44')]){_0x5c5d9e[_0xd85e('0x45')]=[{'all':!![]}];}return db[_0xd85e('0x30')][_0xd85e('0x46')](_0x5c5d9e);})[_0xd85e('0x26')](function(_0x304fb2){_0x5d4154[_0xd85e('0x47')]=_0x304fb2;return _0x5d4154;})[_0xd85e('0x26')](respondWithFilteredResult(_0x5ec4e9,_0x5c5d9e))['catch'](handleError(_0x5ec4e9,null));};exports[_0xd85e('0x48')]=function(_0x564355,_0x141db){var _0x22e004={'raw':![],'where':{'id':_0x564355[_0xd85e('0x49')]['id']}},_0x15b997={};_0x15b997[_0xd85e('0x38')]=_[_0xd85e('0x35')](db[_0xd85e('0x30')][_0xd85e('0x4a')]);_0x15b997[_0xd85e('0x34')]=_[_0xd85e('0x35')](_0x564355[_0xd85e('0x34')]);_0x15b997['filters']=_['intersection'](_0x15b997[_0xd85e('0x38')],_0x15b997[_0xd85e('0x34')]);_0x22e004[_0xd85e('0x37')]=_[_0xd85e('0x36')](_0x15b997[_0xd85e('0x38')],qs['fields'](_0x564355['query'][_0xd85e('0x39')]));_0x22e004[_0xd85e('0x37')]=_0x22e004[_0xd85e('0x37')][_0xd85e('0x4b')]?_0x22e004[_0xd85e('0x37')]:_0x15b997[_0xd85e('0x38')];if(_0x564355[_0xd85e('0x34')]['includeAll']){_0x22e004[_0xd85e('0x45')]=[{'all':!![]}];}_0x22e004=_[_0xd85e('0x41')]({},_0x22e004,_0x564355[_0xd85e('0x43')]);return db[_0xd85e('0x30')][_0xd85e('0x4c')](_0x22e004)[_0xd85e('0x26')](handleEntityNotFound(_0x141db,null))[_0xd85e('0x26')](respondWithResult(_0x141db,null))[_0xd85e('0x4d')](handleError(_0x141db,null));};exports[_0xd85e('0x4e')]=function(_0x29773a,_0x11945f){return db[_0xd85e('0x30')][_0xd85e('0x4e')](_0x29773a[_0xd85e('0x4f')],{})[_0xd85e('0x26')](function(_0x402c4f){var _0x530b97=_0x29773a[_0xd85e('0x50')][_0xd85e('0x28')]({'plain':!![]});if(!_0x530b97)throw new Error(_0xd85e('0x51'));if(_0x530b97[_0xd85e('0x52')]==='user'){var _0x464bbd=_0x402c4f[_0xd85e('0x28')]({'plain':!![]});var _0x2a5bbb='Projects';return db[_0xd85e('0x53')][_0xd85e('0x4c')]({'where':{'name':_0x2a5bbb,'userProfileId':_0x530b97[_0xd85e('0x54')]},'raw':!![]})['then'](function(_0x6de8ae){if(_0x6de8ae&&_0x6de8ae[_0xd85e('0x55')]===0x0){return db['UserProfileResource'][_0xd85e('0x4e')]({'name':_0x464bbd[_0xd85e('0x2c')],'resourceId':_0x464bbd['id'],'type':_0x6de8ae['name'],'sectionId':_0x6de8ae['id']},{})[_0xd85e('0x26')](function(){return _0x402c4f;});}else{return _0x402c4f;}})[_0xd85e('0x4d')](function(_0x23b83a){logger[_0xd85e('0x56')](_0xd85e('0x57'),_0x23b83a);throw _0x23b83a;});}return _0x402c4f;})[_0xd85e('0x26')](respondWithResult(_0x11945f,0xc9))[_0xd85e('0x4d')](handleError(_0x11945f,null));};exports['clone']=function(_0x17049c,_0x132cd6){var _0x70f6bf={'where':{'id':_0x17049c[_0xd85e('0x49')]['id']}},_0x25c241={};_0x25c241['model']=_[_0xd85e('0x35')](db['JscriptyProject'][_0xd85e('0x4a')]);_0x70f6bf['attributes']=_['intersection'](_0x25c241[_0xd85e('0x38')],qs[_0xd85e('0x39')](_0x17049c[_0xd85e('0x34')]['fields']));_0x70f6bf[_0xd85e('0x37')]=_0x70f6bf['attributes'][_0xd85e('0x4b')]?_0x70f6bf['attributes']:_0x25c241['model'];if(_0x17049c[_0xd85e('0x34')][_0xd85e('0x44')]){_0x70f6bf[_0xd85e('0x45')]=[{'all':!![]}];}_0x70f6bf=_[_0xd85e('0x41')]({},_0x70f6bf,_0x17049c[_0xd85e('0x43')]);return db[_0xd85e('0x30')][_0xd85e('0x4c')](_0x70f6bf)[_0xd85e('0x26')](handleEntityNotFound(_0x132cd6,null))[_0xd85e('0x26')](function(_0x4be7d6){if(_0x4be7d6){var _0x4985b6=_0x4be7d6[_0xd85e('0x28')]({'plain':!![]});_0x4985b6=qs[_0xd85e('0x58')](_0x4985b6,['id',_0xd85e('0x59'),'updatedAt']);_0x17049c[_0xd85e('0x4f')]=_[_0xd85e('0x58')](_0x17049c[_0xd85e('0x4f')],['id',_0xd85e('0x59'),'updatedAt']);return db[_0xd85e('0x30')][_0xd85e('0x4e')](_[_0xd85e('0x41')](_0x4985b6,_0x17049c['body']),{'include':_0x17049c['query'][_0xd85e('0x44')]?[{'all':!![]}]:undefined})[_0xd85e('0x26')](function(_0x1dca75){var _0x5b9ff6=_0x17049c[_0xd85e('0x50')][_0xd85e('0x28')]({'plain':!![]});if(!_0x5b9ff6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b9ff6[_0xd85e('0x52')]===_0xd85e('0x50')){var _0x180e0a=_0x1dca75[_0xd85e('0x28')]({'plain':!![]});var _0x1e421a=_0xd85e('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x1e421a,'userProfileId':_0x5b9ff6[_0xd85e('0x54')]},'raw':!![]})['then'](function(_0x28988d){if(_0x28988d&&_0x28988d[_0xd85e('0x55')]===0x0){return db[_0xd85e('0x2a')][_0xd85e('0x4e')]({'name':_0x180e0a[_0xd85e('0x2c')],'resourceId':_0x180e0a['id'],'type':_0x28988d['name'],'sectionId':_0x28988d['id']},{})[_0xd85e('0x26')](function(){return _0x1dca75;});}else{return _0x1dca75;}})['catch'](function(_0x3b8a30){logger[_0xd85e('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b8a30);throw _0x3b8a30;});}return _0x1dca75;});}})[_0xd85e('0x26')](respondWithResult(_0x132cd6,0xc9))[_0xd85e('0x4d')](handleError(_0x132cd6,null));};exports['update']=function(_0x14de94,_0x118420){if(_0x14de94[_0xd85e('0x4f')]['id']){delete _0x14de94['body']['id'];}return db[_0xd85e('0x30')][_0xd85e('0x4c')]({'where':{'id':_0x14de94[_0xd85e('0x49')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x118420,null))[_0xd85e('0x26')](saveUpdates(_0x14de94[_0xd85e('0x4f')],null))[_0xd85e('0x26')](respondWithResult(_0x118420,null))['catch'](handleError(_0x118420,null));};exports[_0xd85e('0x27')]=function(_0x215632,_0x54528a){return db['JscriptyProject'][_0xd85e('0x4c')]({'where':{'id':_0x215632[_0xd85e('0x49')]['id']}})['then'](handleEntityNotFound(_0x54528a,null))[_0xd85e('0x26')](removeEntity(_0x54528a,null))[_0xd85e('0x4d')](handleError(_0x54528a,null));};exports[_0xd85e('0x5a')]=function(_0x3f2e6e,_0x3a5305,_0x496156){var _0x4382bf={'raw':!![],'where':{}};var _0xf4f01c={};var _0x15b741={'count':0x0,'rows':[]};return db[_0xd85e('0x30')][_0xd85e('0x5b')]({'where':{'id':_0x3f2e6e[_0xd85e('0x49')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x3a5305,null))[_0xd85e('0x26')](function(_0x4290a2){if(_0x4290a2){_0xf4f01c[_0xd85e('0x38')]=_[_0xd85e('0x35')](db[_0xd85e('0x5c')][_0xd85e('0x4a')]);_0xf4f01c[_0xd85e('0x34')]=_['keys'](_0x3f2e6e[_0xd85e('0x34')]);_0xf4f01c['filters']=_[_0xd85e('0x36')](_0xf4f01c[_0xd85e('0x38')],_0xf4f01c[_0xd85e('0x34')]);_0x4382bf[_0xd85e('0x37')]=_[_0xd85e('0x36')](_0xf4f01c[_0xd85e('0x38')],qs[_0xd85e('0x39')](_0x3f2e6e['query'][_0xd85e('0x39')]));_0x4382bf[_0xd85e('0x37')]=_0x4382bf[_0xd85e('0x37')][_0xd85e('0x4b')]?_0x4382bf[_0xd85e('0x37')]:_0xf4f01c[_0xd85e('0x38')];if(!_0x3f2e6e[_0xd85e('0x34')][_0xd85e('0x5d')]('nolimit')){_0x4382bf[_0xd85e('0x1d')]=qs[_0xd85e('0x1d')](_0x3f2e6e[_0xd85e('0x34')][_0xd85e('0x1d')]);_0x4382bf[_0xd85e('0x1c')]=qs[_0xd85e('0x1c')](_0x3f2e6e[_0xd85e('0x34')][_0xd85e('0x1c')]);}_0x4382bf['order']=qs[_0xd85e('0x3c')](_0x3f2e6e[_0xd85e('0x34')]['sort']);_0x4382bf[_0xd85e('0x3d')]=qs[_0xd85e('0x3f')](_[_0xd85e('0x3e')](_0x3f2e6e[_0xd85e('0x34')],_0xf4f01c[_0xd85e('0x3f')]));_0x4382bf[_0xd85e('0x3d')][_0xd85e('0x5e')]=_0x4290a2['id'];if(_0x3f2e6e[_0xd85e('0x34')][_0xd85e('0x40')]){_0x4382bf['where']=_[_0xd85e('0x41')](_0x4382bf[_0xd85e('0x3d')],{'$or':_[_0xd85e('0x2f')](_0x4382bf[_0xd85e('0x37')],function(_0x4892f2){var _0x2f284e={};_0x2f284e[_0x4892f2]={'$like':'%'+_0x3f2e6e['query'][_0xd85e('0x40')]+'%'};return _0x2f284e;})});}_0x4382bf=_[_0xd85e('0x41')]({},_0x4382bf,_0x3f2e6e['options']);return db[_0xd85e('0x5c')][_0xd85e('0x1f')]({'where':_0x4382bf[_0xd85e('0x3d')]})[_0xd85e('0x26')](function(_0x675b22){_0x15b741[_0xd85e('0x1f')]=_0x675b22;if(_0x3f2e6e['query'][_0xd85e('0x44')]){_0x4382bf['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd85e('0x46')](_0x4382bf);})[_0xd85e('0x26')](function(_0xbfbd04){_0x15b741[_0xd85e('0x47')]=_0xbfbd04;return _0x15b741;});}})[_0xd85e('0x26')](respondWithFilteredResult(_0x3a5305,_0x4382bf))[_0xd85e('0x4d')](handleError(_0x3a5305,null));};exports[_0xd85e('0x5f')]=function(_0x467da8,_0x39491b,_0x4d704f){var _0x177d4f={'raw':!![],'where':{}};var _0x3494fa={};var _0x4e8e49={'count':0x0,'rows':[]};return db[_0xd85e('0x30')][_0xd85e('0x5b')]({'where':{'id':_0x467da8[_0xd85e('0x49')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x39491b,null))[_0xd85e('0x26')](function(_0x4cd435){if(_0x4cd435){_0x3494fa[_0xd85e('0x38')]=_['keys'](db[_0xd85e('0x60')][_0xd85e('0x4a')]);_0x3494fa['query']=_[_0xd85e('0x35')](_0x467da8[_0xd85e('0x34')]);_0x3494fa[_0xd85e('0x3f')]=_[_0xd85e('0x36')](_0x3494fa['model'],_0x3494fa[_0xd85e('0x34')]);_0x177d4f[_0xd85e('0x37')]=_[_0xd85e('0x36')](_0x3494fa[_0xd85e('0x38')],qs[_0xd85e('0x39')](_0x467da8['query']['fields']));_0x177d4f[_0xd85e('0x37')]=_0x177d4f['attributes'][_0xd85e('0x4b')]?_0x177d4f[_0xd85e('0x37')]:_0x3494fa[_0xd85e('0x38')];if(!_0x467da8[_0xd85e('0x34')][_0xd85e('0x5d')]('nolimit')){_0x177d4f[_0xd85e('0x1d')]=qs[_0xd85e('0x1d')](_0x467da8['query'][_0xd85e('0x1d')]);_0x177d4f['offset']=qs[_0xd85e('0x1c')](_0x467da8['query'][_0xd85e('0x1c')]);}_0x177d4f[_0xd85e('0x3b')]=qs['sort'](_0x467da8['query'][_0xd85e('0x3c')]);_0x177d4f[_0xd85e('0x3d')]=qs[_0xd85e('0x3f')](_[_0xd85e('0x3e')](_0x467da8['query'],_0x3494fa[_0xd85e('0x3f')]));_0x177d4f[_0xd85e('0x3d')][_0xd85e('0x5e')]=_0x4cd435['id'];if(_0x467da8[_0xd85e('0x34')]['filter']){_0x177d4f[_0xd85e('0x3d')]=_['merge'](_0x177d4f[_0xd85e('0x3d')],{'$or':_[_0xd85e('0x2f')](_0x177d4f[_0xd85e('0x37')],function(_0xc48ea0){var _0x2c98ef={};_0x2c98ef[_0xc48ea0]={'$like':'%'+_0x467da8[_0xd85e('0x34')][_0xd85e('0x40')]+'%'};return _0x2c98ef;})});}_0x177d4f=_[_0xd85e('0x41')]({},_0x177d4f,_0x467da8[_0xd85e('0x43')]);return db[_0xd85e('0x60')][_0xd85e('0x1f')]({'where':_0x177d4f[_0xd85e('0x3d')]})[_0xd85e('0x26')](function(_0x300356){_0x4e8e49[_0xd85e('0x1f')]=_0x300356;if(_0x467da8[_0xd85e('0x34')][_0xd85e('0x44')]){_0x177d4f[_0xd85e('0x45')]=[{'all':!![]}];}return db[_0xd85e('0x60')][_0xd85e('0x46')](_0x177d4f);})['then'](function(_0x15c870){_0x4e8e49[_0xd85e('0x47')]=_0x15c870;return _0x4e8e49;});}})[_0xd85e('0x26')](respondWithFilteredResult(_0x39491b,_0x177d4f))[_0xd85e('0x4d')](handleError(_0x39491b,null));};function char(_0x2b4c67){return _0xd85e('0x61')===typeof _0x2b4c67?String[_0xd85e('0x62')][_0xd85e('0x63')](null,arguments):_0x2b4c67;}function needsEncapsulation(_0x2fe071){return!!_0x2fe071&&(_0x2fe071[_0xd85e('0x64')]()[_0xd85e('0x65')](char(0xd))>=0x0||_0x2fe071[_0xd85e('0x64')]()[_0xd85e('0x65')](char(0xa))>=0x0||_0x2fe071[_0xd85e('0x64')]()[_0xd85e('0x65')](char(0x2c))>=0x0||_0x2fe071[_0xd85e('0x64')]()[_0xd85e('0x65')](char(0x22))>=0x0);}function encapsulate(_0x4831dd){var _0x576770=char(0x22),_0x167a9b='\x5c'+char(0x22),_0x5c821d=_0x4831dd['toString']()[_0xd85e('0x66')](new RegExp(_0x576770,'g'),_0x167a9b);return _0x576770+_0x5c821d+_0x576770;}exports[_0xd85e('0x67')]=function(_0x427e81,_0x3b9038,_0x38597c){var _0x428f06,_0x14e23e;var _0x251d8c={'where':{'ProjectId':_0x427e81[_0xd85e('0x49')]['id']}};if(_0x427e81[_0xd85e('0x34')]['startTime']){_0x251d8c[_0xd85e('0x3d')][_0xd85e('0x68')]=JSON[_0xd85e('0x69')](_0x427e81[_0xd85e('0x34')][_0xd85e('0x6a')]);}return db['JscriptySessionReport'][_0xd85e('0x46')](_0x251d8c)[_0xd85e('0x26')](handleEntityNotFound(_0x3b9038,null))['then'](function(_0x3fca9f){if(_0x3fca9f){_0x428f06=_0x3fca9f;return db[_0xd85e('0x6b')]['findAll']({'where':{'SessionId':{'$in':_[_0xd85e('0x2f')](_0x428f06,'id')},'ProjectId':_0x427e81[_0xd85e('0x49')]['id']},'order':_0xd85e('0x6c')});}})['then'](handleEntityNotFound(_0x3b9038,null))[_0xd85e('0x26')](function(_0x3d037a){if(_0x3d037a){_0x14e23e=_0x3d037a;var _0x5f402f={};for(var _0x49fbfe=0x0,_0x2cfb57=_0x14e23e[_0xd85e('0x4b')];_0x49fbfe<_0x2cfb57;_0x49fbfe++){if(!_0x5f402f['hasOwnProperty'](_0x14e23e[_0x49fbfe][_0xd85e('0x6d')])){_0x5f402f[_0x14e23e[_0x49fbfe][_0xd85e('0x6d')]]=needsEncapsulation(_0x14e23e[_0x49fbfe]['question'])?encapsulate(_0x14e23e[_0x49fbfe][_0xd85e('0x6e')]):_0x14e23e[_0x49fbfe][_0xd85e('0x6e')];}}var _0x3ef8cf=[],_0x474fb3={};for(var _0x4ed082=0x0,_0x1e6494=_0x428f06['length'];_0x4ed082<_0x1e6494;_0x4ed082++){_0x474fb3={'ProjectId':_0x427e81[_0xd85e('0x49')]['id'],'SessionId':_0x428f06[_0x4ed082]['id'],'StartTime':moment(_0x428f06[_0x4ed082][_0xd85e('0x68')])[_0xd85e('0x6f')](_0xd85e('0x70'))};for(var _0x2a1b92=0x0,_0x1c5b76=_0x14e23e['length'];_0x2a1b92<_0x1c5b76;_0x2a1b92++){if(_0x14e23e[_0x2a1b92]['SessionId']==_0x428f06[_0x4ed082]['id']&&_0x5f402f['hasOwnProperty'](_0x14e23e[_0x2a1b92][_0xd85e('0x6d')])){_0x474fb3[_0x5f402f[_0x14e23e[_0x2a1b92][_0xd85e('0x6d')]]]=_0x14e23e[_0x2a1b92][_0xd85e('0x71')];}}for(var _0x26f69f in _0x5f402f){if(!_0x474fb3[_0xd85e('0x5d')](_0x5f402f[_0x26f69f])){_0x474fb3[_0x5f402f[_0x26f69f]]=null;}}_0x3ef8cf[_0xd85e('0x72')](_0x474fb3);}return _0x3ef8cf;}})['then'](function(_0x6a15b6){if(!_[_0xd85e('0x73')](_0x6a15b6)){var _0x4f22bc=toCsv(_0x6a15b6);var _0xa1816b=Date[_0xd85e('0x74')]();fs[_0xd85e('0x75')](util[_0xd85e('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x427e81[_0xd85e('0x49')]['id'],_0xa1816b),_0x4f22bc);_0x3b9038[_0xd85e('0x76')](_0xd85e('0x77'),_0xd85e('0x78')+util[_0xd85e('0x6f')]('Jscripty_Project_%d_Summary_%s.csv',_0x427e81[_0xd85e('0x49')]['id'],_0xa1816b));_0x3b9038[_0xd85e('0x76')](_0xd85e('0x79'),_0xd85e('0x7a'));return _0x3b9038[_0xd85e('0x7b')](util[_0xd85e('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x427e81[_0xd85e('0x49')]['id'],_0xa1816b));}else{return _0x3b9038[_0xd85e('0x19')](0xcc);}})[_0xd85e('0x4d')](handleError(_0x3b9038,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index bb81b05..5dc6286 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 _0x5ed2=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_0x5ed2,0x114));var _0x25ed=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x5ed2[_0x333767];return _0x51661b;};'use strict';var _=require(_0x25ed('0x0'));var util=require('util');var logger=require(_0x25ed('0x1'))(_0x25ed('0x2'));var moment=require('moment');var BPromise=require(_0x25ed('0x3'));var rp=require(_0x25ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25ed('0x5'));var config=require(_0x25ed('0x6'));var attributes=require(_0x25ed('0x7'));module[_0x25ed('0x8')]=function(_0x509ca3,_0x3650fd){return _0x509ca3[_0x25ed('0x9')](_0x25ed('0xa'),attributes,{'tableName':_0x25ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dd6=['../../config/environment','./jscriptyProject.attributes','define','jscripty_projects','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5abfb1,_0x312afe){var _0x307c08=function(_0x97832a){while(--_0x97832a){_0x5abfb1['push'](_0x5abfb1['shift']());}};_0x307c08(++_0x312afe);}(_0x0dd6,0xca));var _0x60dd=function(_0xa0cea8,_0x1e23ef){_0xa0cea8=_0xa0cea8-0x0;var _0x49522b=_0x0dd6[_0xa0cea8];return _0x49522b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60dd('0x0'))(_0x60dd('0x1'));var moment=require(_0x60dd('0x2'));var BPromise=require(_0x60dd('0x3'));var rp=require(_0x60dd('0x4'));var fs=require('fs');var path=require(_0x60dd('0x5'));var rimraf=require(_0x60dd('0x6'));var config=require(_0x60dd('0x7'));var attributes=require(_0x60dd('0x8'));module['exports']=function(_0x1c8c4e,_0x4875cb){return _0x1c8c4e[_0x60dd('0x9')]('JscriptyProject',attributes,{'tableName':_0x60dd('0xa'),'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 7dc51c9..e050ad4 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 _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x4c3d7f,_0x3628b1){var _0x58be81=function(_0x275b86){while(--_0x275b86){_0x4c3d7f['push'](_0x4c3d7f['shift']());}};_0x58be81(++_0x3628b1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb7e7[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +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(_0x54b8c0,_0x101de8){var _0x53330d=function(_0x307d06){while(--_0x307d06){_0x54b8c0['push'](_0x54b8c0['shift']());}};_0x53330d(++_0x101de8);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ef63de1..220567c 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 _0xeca1=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x469d45,_0x123d57){var _0x42fb33=function(_0x7b6170){while(--_0x7b6170){_0x469d45['push'](_0x469d45['shift']());}};_0x42fb33(++_0x123d57);}(_0xeca1,0x12b));var _0x1eca=function(_0x4856dc,_0x52782b){_0x4856dc=_0x4856dc-0x0;var _0x255aea=_0xeca1[_0x4856dc];return _0x255aea;};'use strict';var multer=require(_0x1eca('0x0'));var util=require(_0x1eca('0x1'));var path=require('path');var timeout=require(_0x1eca('0x2'));var express=require(_0x1eca('0x3'));var router=express['Router']();var fs_extra=require(_0x1eca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1eca('0x5'));var config=require(_0x1eca('0x6'));var controller=require(_0x1eca('0x7'));router[_0x1eca('0x8')]('/',auth[_0x1eca('0x9')](),controller['index']);router[_0x1eca('0x8')](_0x1eca('0xa'),auth[_0x1eca('0x9')](),controller[_0x1eca('0xb')]);router[_0x1eca('0x8')](_0x1eca('0xc'),auth[_0x1eca('0x9')](),controller[_0x1eca('0xd')]);router[_0x1eca('0xe')]('/',auth[_0x1eca('0x9')](),controller[_0x1eca('0xf')]);router[_0x1eca('0x10')](_0x1eca('0xc'),auth[_0x1eca('0x9')](),controller[_0x1eca('0x11')]);router[_0x1eca('0x12')](_0x1eca('0xc'),auth['isAuthenticated'](),controller[_0x1eca('0x13')]);module[_0x1eca('0x14')]=router; \ No newline at end of file +var _0x810e=['delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','update'];(function(_0x5b8939,_0x46b0b4){var _0x2c58ad=function(_0x48baa2){while(--_0x48baa2){_0x5b8939['push'](_0x5b8939['shift']());}};_0x2c58ad(++_0x46b0b4);}(_0x810e,0x1a8));var _0xe810=function(_0x3f7204,_0x3146fc){_0x3f7204=_0x3f7204-0x0;var _0x416f71=_0x810e[_0x3f7204];return _0x416f71;};'use strict';var multer=require(_0xe810('0x0'));var util=require(_0xe810('0x1'));var path=require('path');var timeout=require(_0xe810('0x2'));var express=require('express');var router=express[_0xe810('0x3')]();var fs_extra=require(_0xe810('0x4'));var auth=require(_0xe810('0x5'));var interaction=require(_0xe810('0x6'));var config=require(_0xe810('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0xe810('0x8')]('/',auth[_0xe810('0x9')](),controller[_0xe810('0xa')]);router[_0xe810('0x8')](_0xe810('0xb'),auth['isAuthenticated'](),controller[_0xe810('0xc')]);router[_0xe810('0x8')]('/:id',auth[_0xe810('0x9')](),controller['show']);router[_0xe810('0xd')]('/',auth[_0xe810('0x9')](),controller[_0xe810('0xe')]);router['put']('/:id',auth[_0xe810('0x9')](),controller[_0xe810('0xf')]);router[_0xe810('0x10')](_0xe810('0x11'),auth[_0xe810('0x9')](),controller[_0xe810('0x12')]);module[_0xe810('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 a24da25..d5374b7 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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x3712ae,_0x47afa0){_0x3712ae=_0x3712ae-0x0;var _0x511b9=_0x7a54[_0x3712ae];return _0x511b9;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x5e56e9,_0x4b1e4e){_0x5e56e9=_0x5e56e9-0x0;var _0x3259f3=_0x7a54[_0x5e56e9];return _0x3259f3;};'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 075f9dd..d1c29ac 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 _0x2372=['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','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','sendStatus','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','keys','options','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x5d6971,_0x5851b4){var _0x531a44=function(_0x321932){while(--_0x321932){_0x5d6971['push'](_0x5d6971['shift']());}};_0x531a44(++_0x5851b4);}(_0x2372,0x8a));var _0x2237=function(_0x2a26a8,_0xd6b224){_0x2a26a8=_0x2a26a8-0x0;var _0x25b98b=_0x2372[_0x2a26a8];return _0x25b98b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2237('0x0'));var zipdir=require(_0x2237('0x1'));var jsonpatch=require(_0x2237('0x2'));var rp=require('request-promise');var moment=require(_0x2237('0x3'));var BPromise=require(_0x2237('0x4'));var Mustache=require(_0x2237('0x5'));var util=require('util');var path=require(_0x2237('0x6'));var sox=require(_0x2237('0x7'));var csv=require(_0x2237('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2237('0x9'));var _=require(_0x2237('0xa'));var squel=require(_0x2237('0xb'));var crypto=require(_0x2237('0xc'));var jsforce=require(_0x2237('0xd'));var deskjs=require(_0x2237('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2237('0xf'));var Papa=require(_0x2237('0x10'));var Redis=require(_0x2237('0x11'));var authService=require(_0x2237('0x12'));var qs=require(_0x2237('0x13'));var as=require(_0x2237('0x14'));var hardwareService=require(_0x2237('0x15'));var logger=require(_0x2237('0x16'))(_0x2237('0x17'));var utils=require(_0x2237('0x18'));var config=require(_0x2237('0x19'));var licenseUtil=require(_0x2237('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x416585,_0x31c73b){_0x31c73b=_0x31c73b||0xcc;return function(_0x3977fb){if(_0x3977fb){return _0x416585['sendStatus'](_0x31c73b);}return _0x416585[_0x2237('0x1b')](_0x31c73b)[_0x2237('0x1c')]();};}function respondWithResult(_0x4604cb,_0x196023){_0x196023=_0x196023||0xc8;return function(_0x410192){if(_0x410192){return _0x4604cb[_0x2237('0x1b')](_0x196023)[_0x2237('0x1d')](_0x410192);}};}function respondWithFilteredResult(_0x3a8e11,_0x474faa){return function(_0x66b589){if(_0x66b589){var _0x19f760=typeof _0x474faa[_0x2237('0x1e')]==='undefined'&&typeof _0x474faa[_0x2237('0x1f')]===_0x2237('0x20');var _0x127349=_0x66b589[_0x2237('0x21')];var _0x1501e4=_0x19f760?0x0:_0x474faa[_0x2237('0x1e')];var _0x38cf41=_0x19f760?_0x66b589[_0x2237('0x21')]:_0x474faa[_0x2237('0x1e')]+_0x474faa['limit'];var _0x209744;if(_0x38cf41>=_0x127349){_0x38cf41=_0x127349;_0x209744=0xc8;}else{_0x209744=0xce;}_0x3a8e11[_0x2237('0x1b')](_0x209744);return _0x3a8e11[_0x2237('0x22')](_0x2237('0x23'),_0x1501e4+'-'+_0x38cf41+'/'+_0x127349)[_0x2237('0x1d')](_0x66b589);}return null;};}function patchUpdates(_0xb8321d){return function(_0x860c99){try{jsonpatch['apply'](_0x860c99,_0xb8321d,!![]);}catch(_0x42ce79){return BPromise[_0x2237('0x24')](_0x42ce79);}return _0x860c99['save']();};}function saveUpdates(_0x110be7,_0x5d5f32){return function(_0x2ebebc){if(_0x2ebebc){return _0x2ebebc['update'](_0x110be7)[_0x2237('0x25')](function(_0x1b3b6b){return _0x1b3b6b;});}return null;};}function removeEntity(_0x259d9c,_0x345c3c){return function(_0x383398){if(_0x383398){return _0x383398[_0x2237('0x26')]()[_0x2237('0x25')](function(){_0x259d9c[_0x2237('0x1b')](0xcc)[_0x2237('0x1c')]();});}};}function handleEntityNotFound(_0x465da7,_0x4af53e){return function(_0x6377b6){if(!_0x6377b6){_0x465da7[_0x2237('0x27')](0x194);}return _0x6377b6;};}function handleError(_0x364d55,_0x280d56){_0x280d56=_0x280d56||0x1f4;return function(_0x5418ff){logger['error'](_0x5418ff[_0x2237('0x28')]);if(_0x5418ff[_0x2237('0x29')]){delete _0x5418ff[_0x2237('0x29')];}_0x364d55[_0x2237('0x1b')](_0x280d56)[_0x2237('0x2a')](_0x5418ff);};}exports[_0x2237('0x2b')]=function(_0x4e0b43,_0x14ea3b){var _0x132e81={},_0x23f2e1={},_0x4cfc6d={'count':0x0,'rows':[]};var _0x1cb064=_[_0x2237('0x2c')](db[_0x2237('0x2d')][_0x2237('0x2e')],function(_0x5e4a6f){return{'name':_0x5e4a6f[_0x2237('0x2f')],'type':_0x5e4a6f['type'][_0x2237('0x30')]};});_0x23f2e1[_0x2237('0x31')]=_[_0x2237('0x2c')](_0x1cb064,_0x2237('0x29'));_0x23f2e1[_0x2237('0x32')]=_['keys'](_0x4e0b43[_0x2237('0x32')]);_0x23f2e1[_0x2237('0x33')]=_[_0x2237('0x34')](_0x23f2e1['model'],_0x23f2e1[_0x2237('0x32')]);_0x132e81[_0x2237('0x35')]=_[_0x2237('0x34')](_0x23f2e1[_0x2237('0x31')],qs[_0x2237('0x36')](_0x4e0b43[_0x2237('0x32')][_0x2237('0x36')]));_0x132e81['attributes']=_0x132e81['attributes'][_0x2237('0x37')]?_0x132e81['attributes']:_0x23f2e1[_0x2237('0x31')];if(!_0x4e0b43['query'][_0x2237('0x38')]('nolimit')){_0x132e81[_0x2237('0x1f')]=qs['limit'](_0x4e0b43[_0x2237('0x32')][_0x2237('0x1f')]);_0x132e81[_0x2237('0x1e')]=qs[_0x2237('0x1e')](_0x4e0b43[_0x2237('0x32')][_0x2237('0x1e')]);}_0x132e81['order']=qs[_0x2237('0x39')](_0x4e0b43['query']['sort']);_0x132e81['where']=qs[_0x2237('0x33')](_['pick'](_0x4e0b43[_0x2237('0x32')],_0x23f2e1[_0x2237('0x33')]),_0x1cb064);if(_0x4e0b43[_0x2237('0x32')][_0x2237('0x3a')]){_0x132e81[_0x2237('0x3b')]=_['merge'](_0x132e81[_0x2237('0x3b')],{'$or':_[_0x2237('0x2c')](_0x1cb064,function(_0xf2a708){if(_0xf2a708['type']!==_0x2237('0x3c')){var _0x121218={};_0x121218[_0xf2a708[_0x2237('0x29')]]={'$like':'%'+_0x4e0b43[_0x2237('0x32')]['filter']+'%'};return _0x121218;}})});}_0x132e81=_[_0x2237('0x3d')]({},_0x132e81,_0x4e0b43['options']);var _0x507bf0={'where':_0x132e81[_0x2237('0x3b')]};return db[_0x2237('0x2d')][_0x2237('0x21')](_0x507bf0)[_0x2237('0x25')](function(_0x3ccc13){_0x4cfc6d[_0x2237('0x21')]=_0x3ccc13;if(_0x4e0b43[_0x2237('0x32')][_0x2237('0x3e')]){_0x132e81[_0x2237('0x3f')]=[{'all':!![]}];}return db[_0x2237('0x2d')][_0x2237('0x40')](_0x132e81);})[_0x2237('0x25')](function(_0x323f0a){_0x4cfc6d['rows']=_0x323f0a;return _0x4cfc6d;})[_0x2237('0x25')](respondWithFilteredResult(_0x14ea3b,_0x132e81))[_0x2237('0x41')](handleError(_0x14ea3b,null));};exports[_0x2237('0x42')]=function(_0x7ea317,_0x3ead52){var _0x15c9fc={'raw':!![],'where':{'id':_0x7ea317['params']['id']}},_0x45c295={};_0x45c295[_0x2237('0x31')]=_[_0x2237('0x43')](db[_0x2237('0x2d')][_0x2237('0x2e')]);_0x45c295[_0x2237('0x32')]=_[_0x2237('0x43')](_0x7ea317[_0x2237('0x32')]);_0x45c295['filters']=_[_0x2237('0x34')](_0x45c295[_0x2237('0x31')],_0x45c295['query']);_0x15c9fc['attributes']=_[_0x2237('0x34')](_0x45c295[_0x2237('0x31')],qs[_0x2237('0x36')](_0x7ea317['query'][_0x2237('0x36')]));_0x15c9fc[_0x2237('0x35')]=_0x15c9fc[_0x2237('0x35')][_0x2237('0x37')]?_0x15c9fc['attributes']:_0x45c295[_0x2237('0x31')];if(_0x7ea317['query'][_0x2237('0x3e')]){_0x15c9fc[_0x2237('0x3f')]=[{'all':!![]}];}_0x15c9fc=_[_0x2237('0x3d')]({},_0x15c9fc,_0x7ea317[_0x2237('0x44')]);return db['JscriptyQuestionReport'][_0x2237('0x45')](_0x15c9fc)['then'](handleEntityNotFound(_0x3ead52,null))[_0x2237('0x25')](respondWithResult(_0x3ead52,null))[_0x2237('0x41')](handleError(_0x3ead52,null));};exports[_0x2237('0x46')]=function(_0x2b1b73,_0x23985e){return db[_0x2237('0x2d')][_0x2237('0x46')](_0x2b1b73[_0x2237('0x47')],{})[_0x2237('0x25')](respondWithResult(_0x23985e,0xc9))['catch'](handleError(_0x23985e,null));};exports[_0x2237('0x48')]=function(_0x679f0,_0x577f72){if(_0x679f0[_0x2237('0x47')]['id']){delete _0x679f0[_0x2237('0x47')]['id'];}return db[_0x2237('0x2d')]['find']({'where':{'id':_0x679f0[_0x2237('0x49')]['id']}})[_0x2237('0x25')](handleEntityNotFound(_0x577f72,null))[_0x2237('0x25')](saveUpdates(_0x679f0['body'],null))[_0x2237('0x25')](respondWithResult(_0x577f72,null))[_0x2237('0x41')](handleError(_0x577f72,null));};exports[_0x2237('0x26')]=function(_0x325a20,_0x54c673){return db[_0x2237('0x2d')][_0x2237('0x45')]({'where':{'id':_0x325a20[_0x2237('0x49')]['id']}})[_0x2237('0x25')](handleEntityNotFound(_0x54c673,null))[_0x2237('0x25')](removeEntity(_0x54c673,null))['catch'](handleError(_0x54c673,null));};exports[_0x2237('0x4a')]=function(_0x49687f,_0x270033){return db[_0x2237('0x2d')][_0x2237('0x4a')]()[_0x2237('0x25')](respondWithResult(_0x270033,null))[_0x2237('0x41')](handleError(_0x270033,null));}; \ No newline at end of file +var _0xdadc=['index','JscriptyQuestionReport','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send'];(function(_0x31a9be,_0x4989ef){var _0x22c699=function(_0x3b34b){while(--_0x3b34b){_0x31a9be['push'](_0x31a9be['shift']());}};_0x22c699(++_0x4989ef);}(_0xdadc,0x1ca));var _0xcdad=function(_0x5bd5e4,_0xc2787b){_0x5bd5e4=_0x5bd5e4-0x0;var _0x13be05=_0xdadc[_0x5bd5e4];return _0x13be05;};'use strict';var emlformat=require(_0xcdad('0x0'));var rimraf=require(_0xcdad('0x1'));var zipdir=require(_0xcdad('0x2'));var jsonpatch=require(_0xcdad('0x3'));var rp=require('request-promise');var moment=require(_0xcdad('0x4'));var BPromise=require(_0xcdad('0x5'));var Mustache=require(_0xcdad('0x6'));var util=require(_0xcdad('0x7'));var path=require(_0xcdad('0x8'));var sox=require(_0xcdad('0x9'));var csv=require(_0xcdad('0xa'));var ejs=require(_0xcdad('0xb'));var fs=require('fs');var fs_extra=require(_0xcdad('0xc'));var _=require(_0xcdad('0xd'));var squel=require('squel');var crypto=require(_0xcdad('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcdad('0xf'));var toCsv=require(_0xcdad('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdad('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcdad('0x11'));var as=require(_0xcdad('0x12'));var hardwareService=require(_0xcdad('0x13'));var logger=require(_0xcdad('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcdad('0x15'));var db=require(_0xcdad('0x16'))['db'];function respondWithStatusCode(_0x92dc8e,_0x266beb){_0x266beb=_0x266beb||0xcc;return function(_0xa7ea81){if(_0xa7ea81){return _0x92dc8e[_0xcdad('0x17')](_0x266beb);}return _0x92dc8e['status'](_0x266beb)[_0xcdad('0x18')]();};}function respondWithResult(_0x5945e6,_0x1266e0){_0x1266e0=_0x1266e0||0xc8;return function(_0x76f202){if(_0x76f202){return _0x5945e6[_0xcdad('0x19')](_0x1266e0)['json'](_0x76f202);}};}function respondWithFilteredResult(_0x41136d,_0x5d26dc){return function(_0x57367c){if(_0x57367c){var _0x1545bf=typeof _0x5d26dc[_0xcdad('0x1a')]===_0xcdad('0x1b')&&typeof _0x5d26dc[_0xcdad('0x1c')]===_0xcdad('0x1b');var _0x46e792=_0x57367c['count'];var _0x54b084=_0x1545bf?0x0:_0x5d26dc[_0xcdad('0x1a')];var _0x152e1a=_0x1545bf?_0x57367c[_0xcdad('0x1d')]:_0x5d26dc[_0xcdad('0x1a')]+_0x5d26dc[_0xcdad('0x1c')];var _0x1e92a6;if(_0x152e1a>=_0x46e792){_0x152e1a=_0x46e792;_0x1e92a6=0xc8;}else{_0x1e92a6=0xce;}_0x41136d['status'](_0x1e92a6);return _0x41136d[_0xcdad('0x1e')]('Content-Range',_0x54b084+'-'+_0x152e1a+'/'+_0x46e792)['json'](_0x57367c);}return null;};}function patchUpdates(_0x1720a9){return function(_0x43ca76){try{jsonpatch[_0xcdad('0x1f')](_0x43ca76,_0x1720a9,!![]);}catch(_0x31d81d){return BPromise[_0xcdad('0x20')](_0x31d81d);}return _0x43ca76['save']();};}function saveUpdates(_0x50cfd7,_0x4f0ac7){return function(_0x49f3cc){if(_0x49f3cc){return _0x49f3cc[_0xcdad('0x21')](_0x50cfd7)[_0xcdad('0x22')](function(_0x400a77){return _0x400a77;});}return null;};}function removeEntity(_0x43a900,_0x5dbcc5){return function(_0x547925){if(_0x547925){return _0x547925[_0xcdad('0x23')]()[_0xcdad('0x22')](function(){_0x43a900['status'](0xcc)[_0xcdad('0x18')]();});}};}function handleEntityNotFound(_0x2867f3,_0x2c1a35){return function(_0x57d0a2){if(!_0x57d0a2){_0x2867f3[_0xcdad('0x17')](0x194);}return _0x57d0a2;};}function handleError(_0xe2786f,_0x574fa3){_0x574fa3=_0x574fa3||0x1f4;return function(_0x3b4421){logger['error'](_0x3b4421[_0xcdad('0x24')]);if(_0x3b4421[_0xcdad('0x25')]){delete _0x3b4421['name'];}_0xe2786f[_0xcdad('0x19')](_0x574fa3)[_0xcdad('0x26')](_0x3b4421);};}exports[_0xcdad('0x27')]=function(_0x2f62ba,_0x2132b8){var _0x113ecb={},_0x4617dd={},_0x5b9a9a={'count':0x0,'rows':[]};var _0x4eae06=_['map'](db[_0xcdad('0x28')]['rawAttributes'],function(_0x27c4b9){return{'name':_0x27c4b9[_0xcdad('0x29')],'type':_0x27c4b9['type'][_0xcdad('0x2a')]};});_0x4617dd['model']=_[_0xcdad('0x2b')](_0x4eae06,_0xcdad('0x25'));_0x4617dd[_0xcdad('0x2c')]=_[_0xcdad('0x2d')](_0x2f62ba[_0xcdad('0x2c')]);_0x4617dd[_0xcdad('0x2e')]=_['intersection'](_0x4617dd[_0xcdad('0x2f')],_0x4617dd[_0xcdad('0x2c')]);_0x113ecb[_0xcdad('0x30')]=_[_0xcdad('0x31')](_0x4617dd[_0xcdad('0x2f')],qs['fields'](_0x2f62ba[_0xcdad('0x2c')][_0xcdad('0x32')]));_0x113ecb[_0xcdad('0x30')]=_0x113ecb['attributes']['length']?_0x113ecb[_0xcdad('0x30')]:_0x4617dd[_0xcdad('0x2f')];if(!_0x2f62ba[_0xcdad('0x2c')]['hasOwnProperty'](_0xcdad('0x33'))){_0x113ecb[_0xcdad('0x1c')]=qs[_0xcdad('0x1c')](_0x2f62ba['query']['limit']);_0x113ecb[_0xcdad('0x1a')]=qs[_0xcdad('0x1a')](_0x2f62ba[_0xcdad('0x2c')][_0xcdad('0x1a')]);}_0x113ecb[_0xcdad('0x34')]=qs[_0xcdad('0x35')](_0x2f62ba[_0xcdad('0x2c')][_0xcdad('0x35')]);_0x113ecb['where']=qs[_0xcdad('0x2e')](_[_0xcdad('0x36')](_0x2f62ba[_0xcdad('0x2c')],_0x4617dd[_0xcdad('0x2e')]),_0x4eae06);if(_0x2f62ba['query'][_0xcdad('0x37')]){_0x113ecb[_0xcdad('0x38')]=_[_0xcdad('0x39')](_0x113ecb[_0xcdad('0x38')],{'$or':_['map'](_0x4eae06,function(_0x4e1b64){if(_0x4e1b64['type']!==_0xcdad('0x3a')){var _0x1bb502={};_0x1bb502[_0x4e1b64[_0xcdad('0x25')]]={'$like':'%'+_0x2f62ba['query'][_0xcdad('0x37')]+'%'};return _0x1bb502;}})});}_0x113ecb=_[_0xcdad('0x39')]({},_0x113ecb,_0x2f62ba[_0xcdad('0x3b')]);var _0x26b8fb={'where':_0x113ecb[_0xcdad('0x38')]};return db[_0xcdad('0x28')][_0xcdad('0x1d')](_0x26b8fb)[_0xcdad('0x22')](function(_0x531573){_0x5b9a9a[_0xcdad('0x1d')]=_0x531573;if(_0x2f62ba['query'][_0xcdad('0x3c')]){_0x113ecb['include']=[{'all':!![]}];}return db[_0xcdad('0x28')]['findAll'](_0x113ecb);})[_0xcdad('0x22')](function(_0x43e1b1){_0x5b9a9a['rows']=_0x43e1b1;return _0x5b9a9a;})['then'](respondWithFilteredResult(_0x2132b8,_0x113ecb))[_0xcdad('0x3d')](handleError(_0x2132b8,null));};exports[_0xcdad('0x3e')]=function(_0x4f17ef,_0x42038e){var _0x31d5c2={'raw':!![],'where':{'id':_0x4f17ef[_0xcdad('0x3f')]['id']}},_0xcb4666={};_0xcb4666[_0xcdad('0x2f')]=_[_0xcdad('0x2d')](db[_0xcdad('0x28')][_0xcdad('0x40')]);_0xcb4666[_0xcdad('0x2c')]=_['keys'](_0x4f17ef[_0xcdad('0x2c')]);_0xcb4666[_0xcdad('0x2e')]=_['intersection'](_0xcb4666[_0xcdad('0x2f')],_0xcb4666[_0xcdad('0x2c')]);_0x31d5c2[_0xcdad('0x30')]=_[_0xcdad('0x31')](_0xcb4666[_0xcdad('0x2f')],qs[_0xcdad('0x32')](_0x4f17ef[_0xcdad('0x2c')][_0xcdad('0x32')]));_0x31d5c2['attributes']=_0x31d5c2['attributes'][_0xcdad('0x41')]?_0x31d5c2[_0xcdad('0x30')]:_0xcb4666[_0xcdad('0x2f')];if(_0x4f17ef[_0xcdad('0x2c')][_0xcdad('0x3c')]){_0x31d5c2[_0xcdad('0x42')]=[{'all':!![]}];}_0x31d5c2=_[_0xcdad('0x39')]({},_0x31d5c2,_0x4f17ef[_0xcdad('0x3b')]);return db[_0xcdad('0x28')][_0xcdad('0x43')](_0x31d5c2)[_0xcdad('0x22')](handleEntityNotFound(_0x42038e,null))['then'](respondWithResult(_0x42038e,null))[_0xcdad('0x3d')](handleError(_0x42038e,null));};exports[_0xcdad('0x44')]=function(_0x2ab1a6,_0x4c4d10){return db['JscriptyQuestionReport'][_0xcdad('0x44')](_0x2ab1a6['body'],{})[_0xcdad('0x22')](respondWithResult(_0x4c4d10,0xc9))[_0xcdad('0x3d')](handleError(_0x4c4d10,null));};exports['update']=function(_0x55f842,_0x3eaa89){if(_0x55f842[_0xcdad('0x45')]['id']){delete _0x55f842[_0xcdad('0x45')]['id'];}return db[_0xcdad('0x28')][_0xcdad('0x43')]({'where':{'id':_0x55f842['params']['id']}})[_0xcdad('0x22')](handleEntityNotFound(_0x3eaa89,null))[_0xcdad('0x22')](saveUpdates(_0x55f842['body'],null))['then'](respondWithResult(_0x3eaa89,null))[_0xcdad('0x3d')](handleError(_0x3eaa89,null));};exports[_0xcdad('0x23')]=function(_0x44311e,_0xd3226e){return db['JscriptyQuestionReport'][_0xcdad('0x43')]({'where':{'id':_0x44311e[_0xcdad('0x3f')]['id']}})[_0xcdad('0x22')](handleEntityNotFound(_0xd3226e,null))['then'](removeEntity(_0xd3226e,null))[_0xcdad('0x3d')](handleError(_0xd3226e,null));};exports[_0xcdad('0x46')]=function(_0x2a7c70,_0x3b525d){return db[_0xcdad('0x28')][_0xcdad('0x46')]()['then'](respondWithResult(_0x3b525d,null))[_0xcdad('0x3d')](handleError(_0x3b525d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d628295..c4eb41d 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 _0xf5e9=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','../../config/environment'];(function(_0x5be652,_0x129d44){var _0x3c89da=function(_0x2f01ac){while(--_0x2f01ac){_0x5be652['push'](_0x5be652['shift']());}};_0x3c89da(++_0x129d44);}(_0xf5e9,0x9f));var _0x9f5e=function(_0x4a0ae2,_0x4930df){_0x4a0ae2=_0x4a0ae2-0x0;var _0x3986a6=_0xf5e9[_0x4a0ae2];return _0x3986a6;};'use strict';var _=require(_0x9f5e('0x0'));var util=require(_0x9f5e('0x1'));var logger=require(_0x9f5e('0x2'))('api');var moment=require(_0x9f5e('0x3'));var BPromise=require(_0x9f5e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f5e('0x5'));var attributes=require(_0x9f5e('0x6'));module[_0x9f5e('0x7')]=function(_0x34a681,_0x4695f7){return _0x34a681[_0x9f5e('0x8')](_0x9f5e('0x9'),attributes,{'tableName':_0x9f5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80b8=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x3a63c7,_0x2c6823){var _0xc23462=function(_0x43aca1){while(--_0x43aca1){_0x3a63c7['push'](_0x3a63c7['shift']());}};_0xc23462(++_0x2c6823);}(_0x80b8,0x12b));var _0x880b=function(_0x51f33f,_0x42fecb){_0x51f33f=_0x51f33f-0x0;var _0x377677=_0x80b8[_0x51f33f];return _0x377677;};'use strict';var _=require(_0x880b('0x0'));var util=require(_0x880b('0x1'));var logger=require(_0x880b('0x2'))('api');var moment=require(_0x880b('0x3'));var BPromise=require(_0x880b('0x4'));var rp=require(_0x880b('0x5'));var fs=require('fs');var path=require(_0x880b('0x6'));var rimraf=require(_0x880b('0x7'));var config=require(_0x880b('0x8'));var attributes=require(_0x880b('0x9'));module[_0x880b('0xa')]=function(_0x40ee35,_0x297ff0){return _0x40ee35['define'](_0x880b('0xb'),attributes,{'tableName':_0x880b('0xc'),'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 e487e97..6c2b92d 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 _0x74fd=['client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x170902,_0x1627d5){var _0x1a2ff3=function(_0x5181ea){while(--_0x5181ea){_0x170902['push'](_0x170902['shift']());}};_0x1a2ff3(++_0x1627d5);}(_0x74fd,0x116));var _0xd74f=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x74fd[_0x104e21];return _0x605b37;};'use strict';var _=require(_0xd74f('0x0'));var util=require(_0xd74f('0x1'));var moment=require(_0xd74f('0x2'));var BPromise=require('bluebird');var rs=require(_0xd74f('0x3'));var fs=require('fs');var Redis=require(_0xd74f('0x4'));var db=require(_0xd74f('0x5'))['db'];var utils=require(_0xd74f('0x6'));var logger=require(_0xd74f('0x7'))(_0xd74f('0x8'));var config=require(_0xd74f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd74f('0xa')][_0xd74f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c9b57,_0x1a2984,_0x2ecbd5){return new BPromise(function(_0x2f63e2,_0x539ccc){return client['request'](_0x1c9b57,_0x2ecbd5)[_0xd74f('0xc')](function(_0x38037d){logger[_0xd74f('0xd')](_0xd74f('0xe'),_0x1a2984,'request\x20sent');logger[_0xd74f('0xf')](_0xd74f('0x10'),_0x1a2984,_0xd74f('0x11'),JSON[_0xd74f('0x12')](_0x38037d));if(_0x38037d[_0xd74f('0x13')]){if(_0x38037d[_0xd74f('0x13')][_0xd74f('0x14')]===0x1f4){logger[_0xd74f('0x13')](_0xd74f('0xe'),_0x1a2984,_0x38037d['error']['message']);return _0x539ccc(_0x38037d[_0xd74f('0x13')][_0xd74f('0x15')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1a2984,_0x38037d[_0xd74f('0x13')][_0xd74f('0x15')]);return _0x2f63e2(_0x38037d[_0xd74f('0x13')]['message']);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1a2984,_0xd74f('0x11'));_0x2f63e2(_0x38037d[_0xd74f('0x16')][_0xd74f('0x15')]);}})[_0xd74f('0x17')](function(_0x31ec5c){logger['error'](_0xd74f('0xe'),_0x1a2984,_0x31ec5c);_0x539ccc(_0x31ec5c);});});} \ No newline at end of file +var _0x8d9e=['info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x782071,_0x278cee){var _0x9c7802=function(_0x746de0){while(--_0x746de0){_0x782071['push'](_0x782071['shift']());}};_0x9c7802(++_0x278cee);}(_0x8d9e,0x79));var _0xe8d9=function(_0x456b86,_0x42ca24){_0x456b86=_0x456b86-0x0;var _0x2cd607=_0x8d9e[_0x456b86];return _0x2cd607;};'use strict';var _=require(_0xe8d9('0x0'));var util=require(_0xe8d9('0x1'));var moment=require(_0xe8d9('0x2'));var BPromise=require(_0xe8d9('0x3'));var rs=require(_0xe8d9('0x4'));var fs=require('fs');var Redis=require(_0xe8d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe8d9('0x6'))(_0xe8d9('0x7'));var config=require(_0xe8d9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe8d9('0x9')][_0xe8d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3db472,_0xf16b80,_0x4703d1){return new BPromise(function(_0x5506ff,_0x3e561e){return client[_0xe8d9('0xb')](_0x3db472,_0x4703d1)['then'](function(_0x48d6f3){logger['info'](_0xe8d9('0xc'),_0xf16b80,'request\x20sent');logger['debug'](_0xe8d9('0xd'),_0xf16b80,_0xe8d9('0xe'),JSON[_0xe8d9('0xf')](_0x48d6f3));if(_0x48d6f3[_0xe8d9('0x10')]){if(_0x48d6f3[_0xe8d9('0x10')][_0xe8d9('0x11')]===0x1f4){logger[_0xe8d9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xf16b80,_0x48d6f3['error'][_0xe8d9('0x12')]);return _0x3e561e(_0x48d6f3[_0xe8d9('0x10')][_0xe8d9('0x12')]);}logger['error'](_0xe8d9('0xc'),_0xf16b80,_0x48d6f3['error'][_0xe8d9('0x12')]);return _0x5506ff(_0x48d6f3[_0xe8d9('0x10')][_0xe8d9('0x12')]);}else{logger[_0xe8d9('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xf16b80,_0xe8d9('0xe'));_0x5506ff(_0x48d6f3['result'][_0xe8d9('0x12')]);}})['catch'](function(_0x2d15fc){logger[_0xe8d9('0x10')](_0xe8d9('0xc'),_0xf16b80,_0x2d15fc);_0x3e561e(_0x2d15fc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0a1138f..53b9d75 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 _0x5276=['fs-extra','./jscriptySessionReport.controller','get','index','isAuthenticated','show','/:id/questions','getQuestions','create','put','/:id','update','delete','exports','multer','util','express','Router'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5276,0x176));var _0x6527=function(_0x408fb3,_0xb456dc){_0x408fb3=_0x408fb3-0x0;var _0x5d0d53=_0x5276[_0x408fb3];return _0x5d0d53;};'use strict';var multer=require(_0x6527('0x0'));var util=require(_0x6527('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6527('0x2'));var router=express[_0x6527('0x3')]();var fs_extra=require(_0x6527('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6527('0x5'));router[_0x6527('0x6')]('/',auth['isAuthenticated'](),controller[_0x6527('0x7')]);router[_0x6527('0x6')]('/describe',auth[_0x6527('0x8')](),controller['describe']);router[_0x6527('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6527('0x9')]);router[_0x6527('0x6')](_0x6527('0xa'),auth['isAuthenticated'](),controller[_0x6527('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6527('0xc')]);router[_0x6527('0xd')](_0x6527('0xe'),auth[_0x6527('0x8')](),controller[_0x6527('0xf')]);router[_0x6527('0x10')](_0x6527('0xe'),auth[_0x6527('0x8')](),controller['destroy']);module[_0x6527('0x11')]=router; \ No newline at end of file +var _0xdd0e=['./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x15a14f,_0x571ecf){var _0x4a893b=function(_0x4d8907){while(--_0x4d8907){_0x15a14f['push'](_0x15a14f['shift']());}};_0x4a893b(++_0x571ecf);}(_0xdd0e,0x1b1));var _0xedd0=function(_0x23ee34,_0x5cfc7d){_0x23ee34=_0x23ee34-0x0;var _0x44093c=_0xdd0e[_0x23ee34];return _0x44093c;};'use strict';var multer=require(_0xedd0('0x0'));var util=require(_0xedd0('0x1'));var path=require(_0xedd0('0x2'));var timeout=require(_0xedd0('0x3'));var express=require('express');var router=express[_0xedd0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xedd0('0x5'));var interaction=require(_0xedd0('0x6'));var config=require('../../config/environment');var controller=require(_0xedd0('0x7'));router[_0xedd0('0x8')]('/',auth[_0xedd0('0x9')](),controller[_0xedd0('0xa')]);router[_0xedd0('0x8')](_0xedd0('0xb'),auth['isAuthenticated'](),controller[_0xedd0('0xc')]);router[_0xedd0('0x8')](_0xedd0('0xd'),auth[_0xedd0('0x9')](),controller[_0xedd0('0xe')]);router[_0xedd0('0x8')](_0xedd0('0xf'),auth[_0xedd0('0x9')](),controller[_0xedd0('0x10')]);router['post']('/',auth[_0xedd0('0x9')](),controller['create']);router['put'](_0xedd0('0xd'),auth[_0xedd0('0x9')](),controller['update']);router[_0xedd0('0x11')](_0xedd0('0xd'),auth['isAuthenticated'](),controller[_0xedd0('0x12')]);module[_0xedd0('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 66abd65..b0e9213 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 _0x3945=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','setDataValue','endtime'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x3945,0xd4));var _0x5394=function(_0x3ba2cb,_0x243d0d){_0x3ba2cb=_0x3ba2cb-0x0;var _0x151fe4=_0x3945[_0x3ba2cb];return _0x151fe4;};'use strict';var moment=require('moment');var Sequelize=require(_0x5394('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x5394('0x1')],'set':function(_0x215851){this['setDataValue']('starttime',_0x215851);this[_0x5394('0x2')](_0x5394('0x3'),moment()[_0x5394('0x4')](_0x5394('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x5394('0x6')]},'projectname':{'type':Sequelize[_0x5394('0x6')]},'queue':{'type':Sequelize[_0x5394('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5394('0x6')]},'calleridnum':{'type':Sequelize[_0x5394('0x6')]},'completed':{'type':Sequelize[_0x5394('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x0294=['starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','moment','exports'];(function(_0x2a9250,_0x263508){var _0x1839fe=function(_0x49bd3e){while(--_0x49bd3e){_0x2a9250['push'](_0x2a9250['shift']());}};_0x1839fe(++_0x263508);}(_0x0294,0x15e));var _0x4029=function(_0x73971d,_0x3e675f){_0x73971d=_0x73971d-0x0;var _0x4217fb=_0x0294[_0x73971d];return _0x4217fb;};'use strict';var moment=require(_0x4029('0x0'));var Sequelize=require('sequelize');module[_0x4029('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x40344c){this['setDataValue'](_0x4029('0x2'),_0x40344c);this[_0x4029('0x3')]('endtime',moment()[_0x4029('0x4')](_0x4029('0x5')));}},'endtime':{'type':Sequelize[_0x4029('0x6')]},'membername':{'type':Sequelize[_0x4029('0x7')]},'projectname':{'type':Sequelize[_0x4029('0x7')]},'queue':{'type':Sequelize[_0x4029('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4029('0x7')]},'calleridnum':{'type':Sequelize[_0x4029('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5baca25..2d5054b 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 _0x1a09=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','length','SessionId','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x252af1,_0x349850){var _0x2bcdee=function(_0xc0fa45){while(--_0xc0fa45){_0x252af1['push'](_0x252af1['shift']());}};_0x2bcdee(++_0x349850);}(_0x1a09,0xe8));var _0x91a0=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x1a09[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x91a0('0x0'));var rimraf=require(_0x91a0('0x1'));var zipdir=require(_0x91a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91a0('0x3'));var moment=require(_0x91a0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x91a0('0x5'));var path=require(_0x91a0('0x6'));var sox=require(_0x91a0('0x7'));var csv=require(_0x91a0('0x8'));var ejs=require(_0x91a0('0x9'));var fs=require('fs');var fs_extra=require(_0x91a0('0xa'));var _=require(_0x91a0('0xb'));var squel=require(_0x91a0('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(_0x91a0('0xd'));var Redis=require(_0x91a0('0xe'));var authService=require(_0x91a0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x91a0('0x10'));var hardwareService=require(_0x91a0('0x11'));var logger=require('../../config/logger')(_0x91a0('0x12'));var utils=require(_0x91a0('0x13'));var config=require(_0x91a0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x91a0('0x15'))['db'];function respondWithStatusCode(_0x417dec,_0x3f4211){_0x3f4211=_0x3f4211||0xcc;return function(_0x6bfe3d){if(_0x6bfe3d){return _0x417dec[_0x91a0('0x16')](_0x3f4211);}return _0x417dec[_0x91a0('0x17')](_0x3f4211)[_0x91a0('0x18')]();};}function respondWithResult(_0x488838,_0xea8cb){_0xea8cb=_0xea8cb||0xc8;return function(_0x1f5834){if(_0x1f5834){return _0x488838['status'](_0xea8cb)[_0x91a0('0x19')](_0x1f5834);}};}function respondWithFilteredResult(_0xefc4e8,_0x1d6fce){return function(_0x54fc80){if(_0x54fc80){var _0x17b917=typeof _0x1d6fce['offset']===_0x91a0('0x1a')&&typeof _0x1d6fce[_0x91a0('0x1b')]===_0x91a0('0x1a');var _0x226273=_0x54fc80['count'];var _0x4802f5=_0x17b917?0x0:_0x1d6fce[_0x91a0('0x1c')];var _0x3c8cb1=_0x17b917?_0x54fc80[_0x91a0('0x1d')]:_0x1d6fce[_0x91a0('0x1c')]+_0x1d6fce['limit'];var _0x215ef5;if(_0x3c8cb1>=_0x226273){_0x3c8cb1=_0x226273;_0x215ef5=0xc8;}else{_0x215ef5=0xce;}_0xefc4e8[_0x91a0('0x17')](_0x215ef5);return _0xefc4e8['set'](_0x91a0('0x1e'),_0x4802f5+'-'+_0x3c8cb1+'/'+_0x226273)[_0x91a0('0x19')](_0x54fc80);}return null;};}function patchUpdates(_0x347a8d){return function(_0x4ee11a){try{jsonpatch[_0x91a0('0x1f')](_0x4ee11a,_0x347a8d,!![]);}catch(_0x1d00ee){return BPromise[_0x91a0('0x20')](_0x1d00ee);}return _0x4ee11a[_0x91a0('0x21')]();};}function saveUpdates(_0xc32742,_0x52ae81){return function(_0x466b8f){if(_0x466b8f){return _0x466b8f[_0x91a0('0x22')](_0xc32742)['then'](function(_0x4561b7){return _0x4561b7;});}return null;};}function removeEntity(_0x1ce2c9,_0x112387){return function(_0x2b9bb5){if(_0x2b9bb5){return _0x2b9bb5[_0x91a0('0x23')]()[_0x91a0('0x24')](function(){_0x1ce2c9[_0x91a0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x317d64,_0x5ad108){return function(_0x1a3461){if(!_0x1a3461){_0x317d64['sendStatus'](0x194);}return _0x1a3461;};}function handleError(_0x1b6484,_0x417670){_0x417670=_0x417670||0x1f4;return function(_0x3074ed){logger[_0x91a0('0x25')](_0x3074ed[_0x91a0('0x26')]);if(_0x3074ed[_0x91a0('0x27')]){delete _0x3074ed['name'];}_0x1b6484[_0x91a0('0x17')](_0x417670)[_0x91a0('0x28')](_0x3074ed);};}exports[_0x91a0('0x29')]=function(_0x33cb4a,_0x2506cf){var _0x9da92b={},_0xf68823={},_0x26f8b6={'count':0x0,'rows':[]};var _0x103878=_[_0x91a0('0x2a')](db[_0x91a0('0x2b')][_0x91a0('0x2c')],function(_0x2b47f0){return{'name':_0x2b47f0[_0x91a0('0x2d')],'type':_0x2b47f0[_0x91a0('0x2e')]['key']};});_0xf68823['model']=_[_0x91a0('0x2a')](_0x103878,'name');_0xf68823[_0x91a0('0x2f')]=_[_0x91a0('0x30')](_0x33cb4a[_0x91a0('0x2f')]);_0xf68823['filters']=_[_0x91a0('0x31')](_0xf68823[_0x91a0('0x32')],_0xf68823['query']);_0x9da92b[_0x91a0('0x33')]=_[_0x91a0('0x31')](_0xf68823[_0x91a0('0x32')],qs[_0x91a0('0x34')](_0x33cb4a[_0x91a0('0x2f')][_0x91a0('0x34')]));_0x9da92b[_0x91a0('0x33')]=_0x9da92b[_0x91a0('0x33')]['length']?_0x9da92b[_0x91a0('0x33')]:_0xf68823[_0x91a0('0x32')];if(!_0x33cb4a[_0x91a0('0x2f')][_0x91a0('0x35')](_0x91a0('0x36'))){_0x9da92b[_0x91a0('0x1b')]=qs[_0x91a0('0x1b')](_0x33cb4a['query'][_0x91a0('0x1b')]);_0x9da92b['offset']=qs[_0x91a0('0x1c')](_0x33cb4a[_0x91a0('0x2f')][_0x91a0('0x1c')]);}_0x9da92b[_0x91a0('0x37')]=qs[_0x91a0('0x38')](_0x33cb4a[_0x91a0('0x2f')]['sort']);_0x9da92b[_0x91a0('0x39')]=qs[_0x91a0('0x3a')](_[_0x91a0('0x3b')](_0x33cb4a[_0x91a0('0x2f')],_0xf68823[_0x91a0('0x3a')]),_0x103878);if(_0x33cb4a['query'][_0x91a0('0x3c')]){_0x9da92b[_0x91a0('0x39')]=_[_0x91a0('0x3d')](_0x9da92b[_0x91a0('0x39')],{'$or':_[_0x91a0('0x2a')](_0x103878,function(_0x5dabd0){if(_0x5dabd0[_0x91a0('0x2e')]!==_0x91a0('0x3e')){var _0x14f47a={};_0x14f47a[_0x5dabd0[_0x91a0('0x27')]]={'$like':'%'+_0x33cb4a[_0x91a0('0x2f')][_0x91a0('0x3c')]+'%'};return _0x14f47a;}})});}_0x9da92b=_[_0x91a0('0x3d')]({},_0x9da92b,_0x33cb4a[_0x91a0('0x3f')]);var _0x1f6404={'where':_0x9da92b[_0x91a0('0x39')]};return db[_0x91a0('0x2b')][_0x91a0('0x1d')](_0x1f6404)[_0x91a0('0x24')](function(_0x48ee96){_0x26f8b6[_0x91a0('0x1d')]=_0x48ee96;if(_0x33cb4a['query'][_0x91a0('0x40')]){_0x9da92b[_0x91a0('0x41')]=[{'all':!![]}];}return db[_0x91a0('0x2b')][_0x91a0('0x42')](_0x9da92b);})[_0x91a0('0x24')](function(_0x3add81){_0x26f8b6[_0x91a0('0x43')]=_0x3add81;return _0x26f8b6;})[_0x91a0('0x24')](respondWithFilteredResult(_0x2506cf,_0x9da92b))[_0x91a0('0x44')](handleError(_0x2506cf,null));};exports['show']=function(_0x5ea487,_0x150b50){var _0xb4de67={'raw':!![],'where':{'id':_0x5ea487['params']['id']}},_0x42c7a2={};_0x42c7a2[_0x91a0('0x32')]=_[_0x91a0('0x30')](db[_0x91a0('0x2b')][_0x91a0('0x2c')]);_0x42c7a2['query']=_[_0x91a0('0x30')](_0x5ea487[_0x91a0('0x2f')]);_0x42c7a2['filters']=_['intersection'](_0x42c7a2[_0x91a0('0x32')],_0x42c7a2[_0x91a0('0x2f')]);_0xb4de67[_0x91a0('0x33')]=_[_0x91a0('0x31')](_0x42c7a2['model'],qs[_0x91a0('0x34')](_0x5ea487[_0x91a0('0x2f')]['fields']));_0xb4de67['attributes']=_0xb4de67[_0x91a0('0x33')]['length']?_0xb4de67[_0x91a0('0x33')]:_0x42c7a2[_0x91a0('0x32')];if(_0x5ea487[_0x91a0('0x2f')][_0x91a0('0x40')]){_0xb4de67[_0x91a0('0x41')]=[{'all':!![]}];}_0xb4de67=_[_0x91a0('0x3d')]({},_0xb4de67,_0x5ea487[_0x91a0('0x3f')]);return db[_0x91a0('0x2b')][_0x91a0('0x45')](_0xb4de67)['then'](handleEntityNotFound(_0x150b50,null))[_0x91a0('0x24')](respondWithResult(_0x150b50,null))[_0x91a0('0x44')](handleError(_0x150b50,null));};exports['create']=function(_0x2ec12d,_0x42c84b){return db[_0x91a0('0x2b')][_0x91a0('0x46')](_0x2ec12d[_0x91a0('0x47')],{})[_0x91a0('0x24')](respondWithResult(_0x42c84b,0xc9))['catch'](handleError(_0x42c84b,null));};exports['update']=function(_0x24a70e,_0xa0c7ba){if(_0x24a70e[_0x91a0('0x47')]['id']){delete _0x24a70e[_0x91a0('0x47')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x24a70e[_0x91a0('0x48')]['id']}})['then'](handleEntityNotFound(_0xa0c7ba,null))[_0x91a0('0x24')](saveUpdates(_0x24a70e['body'],null))[_0x91a0('0x24')](respondWithResult(_0xa0c7ba,null))[_0x91a0('0x44')](handleError(_0xa0c7ba,null));};exports[_0x91a0('0x23')]=function(_0x442d4e,_0x2692de){return db[_0x91a0('0x2b')][_0x91a0('0x45')]({'where':{'id':_0x442d4e[_0x91a0('0x48')]['id']}})[_0x91a0('0x24')](handleEntityNotFound(_0x2692de,null))[_0x91a0('0x24')](removeEntity(_0x2692de,null))[_0x91a0('0x44')](handleError(_0x2692de,null));};exports['describe']=function(_0x315f12,_0x3bf940){return db['JscriptySessionReport'][_0x91a0('0x49')]()[_0x91a0('0x24')](respondWithResult(_0x3bf940,null))[_0x91a0('0x44')](handleError(_0x3bf940,null));};exports[_0x91a0('0x4a')]=function(_0x53a86d,_0x441625,_0x32b33f){var _0x56b2e0={'raw':!![],'where':{}};var _0x3ae069={};var _0x294d4d={'count':0x0,'rows':[]};return db[_0x91a0('0x2b')][_0x91a0('0x4b')]({'where':{'id':_0x53a86d[_0x91a0('0x48')]['id']}})[_0x91a0('0x24')](handleEntityNotFound(_0x441625,null))['then'](function(_0x844d41){if(_0x844d41){_0x3ae069[_0x91a0('0x32')]=_[_0x91a0('0x30')](db[_0x91a0('0x4c')]['rawAttributes']);_0x3ae069['query']=_[_0x91a0('0x30')](_0x53a86d['query']);_0x3ae069[_0x91a0('0x3a')]=_[_0x91a0('0x31')](_0x3ae069['model'],_0x3ae069['query']);_0x56b2e0[_0x91a0('0x33')]=_['intersection'](_0x3ae069[_0x91a0('0x32')],qs[_0x91a0('0x34')](_0x53a86d[_0x91a0('0x2f')]['fields']));_0x56b2e0[_0x91a0('0x33')]=_0x56b2e0[_0x91a0('0x33')][_0x91a0('0x4d')]?_0x56b2e0[_0x91a0('0x33')]:_0x3ae069[_0x91a0('0x32')];if(!_0x53a86d['query'][_0x91a0('0x35')](_0x91a0('0x36'))){_0x56b2e0[_0x91a0('0x1b')]=qs[_0x91a0('0x1b')](_0x53a86d[_0x91a0('0x2f')][_0x91a0('0x1b')]);_0x56b2e0[_0x91a0('0x1c')]=qs[_0x91a0('0x1c')](_0x53a86d[_0x91a0('0x2f')][_0x91a0('0x1c')]);}_0x56b2e0[_0x91a0('0x37')]=qs[_0x91a0('0x38')](_0x53a86d[_0x91a0('0x2f')][_0x91a0('0x38')]);_0x56b2e0[_0x91a0('0x39')]=qs[_0x91a0('0x3a')](_[_0x91a0('0x3b')](_0x53a86d[_0x91a0('0x2f')],_0x3ae069['filters']));_0x56b2e0['where'][_0x91a0('0x4e')]=_0x844d41['id'];if(_0x53a86d[_0x91a0('0x2f')][_0x91a0('0x3c')]){_0x56b2e0[_0x91a0('0x39')]=_[_0x91a0('0x3d')](_0x56b2e0[_0x91a0('0x39')],{'$or':_['map'](_0x56b2e0['attributes'],function(_0x2033c7){var _0x2bae40={};_0x2bae40[_0x2033c7]={'$like':'%'+_0x53a86d[_0x91a0('0x2f')][_0x91a0('0x3c')]+'%'};return _0x2bae40;})});}_0x56b2e0=_[_0x91a0('0x3d')]({},_0x56b2e0,_0x53a86d['options']);return db[_0x91a0('0x4c')][_0x91a0('0x1d')]({'where':_0x56b2e0[_0x91a0('0x39')]})['then'](function(_0x45cc8b){_0x294d4d[_0x91a0('0x1d')]=_0x45cc8b;if(_0x53a86d[_0x91a0('0x2f')]['includeAll']){_0x56b2e0[_0x91a0('0x41')]=[{'all':!![]}];}return db[_0x91a0('0x4c')][_0x91a0('0x42')](_0x56b2e0);})[_0x91a0('0x24')](function(_0xa5f15e){_0x294d4d[_0x91a0('0x43')]=_0xa5f15e;return _0x294d4d;});}})[_0x91a0('0x24')](respondWithFilteredResult(_0x441625,_0x56b2e0))[_0x91a0('0x44')](handleError(_0x441625,null));}; \ No newline at end of file +var _0x465f=['create','body','find','destroy','describe','findOne','nolimit','SessionId','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','map','JscriptySessionReport','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','catch'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x465f,0x1d1));var _0xf465=function(_0x5ac72f,_0xa0794a){_0x5ac72f=_0x5ac72f-0x0;var _0x1f6d80=_0x465f[_0x5ac72f];return _0x1f6d80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf465('0x0'));var zipdir=require(_0xf465('0x1'));var jsonpatch=require(_0xf465('0x2'));var rp=require('request-promise');var moment=require(_0xf465('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf465('0x4'));var util=require('util');var path=require(_0xf465('0x5'));var sox=require(_0xf465('0x6'));var csv=require('to-csv');var ejs=require(_0xf465('0x7'));var fs=require('fs');var fs_extra=require(_0xf465('0x8'));var _=require(_0xf465('0x9'));var squel=require(_0xf465('0xa'));var crypto=require(_0xf465('0xb'));var jsforce=require(_0xf465('0xc'));var deskjs=require(_0xf465('0xd'));var toCsv=require(_0xf465('0xe'));var querystring=require(_0xf465('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf465('0x10'));var qs=require(_0xf465('0x11'));var as=require(_0xf465('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf465('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf465('0x14'));var licenseUtil=require(_0xf465('0x15'));var db=require(_0xf465('0x16'))['db'];function respondWithStatusCode(_0x26c1c5,_0x268fe3){_0x268fe3=_0x268fe3||0xcc;return function(_0x56410a){if(_0x56410a){return _0x26c1c5[_0xf465('0x17')](_0x268fe3);}return _0x26c1c5['status'](_0x268fe3)[_0xf465('0x18')]();};}function respondWithResult(_0x28cb8a,_0x140ede){_0x140ede=_0x140ede||0xc8;return function(_0xabbee5){if(_0xabbee5){return _0x28cb8a[_0xf465('0x19')](_0x140ede)[_0xf465('0x1a')](_0xabbee5);}};}function respondWithFilteredResult(_0x311e33,_0x205971){return function(_0x582a2c){if(_0x582a2c){var _0x55d6d1=typeof _0x205971[_0xf465('0x1b')]===_0xf465('0x1c')&&typeof _0x205971[_0xf465('0x1d')]===_0xf465('0x1c');var _0x510776=_0x582a2c[_0xf465('0x1e')];var _0x390ee3=_0x55d6d1?0x0:_0x205971[_0xf465('0x1b')];var _0x4c2bdb=_0x55d6d1?_0x582a2c['count']:_0x205971['offset']+_0x205971[_0xf465('0x1d')];var _0x2de862;if(_0x4c2bdb>=_0x510776){_0x4c2bdb=_0x510776;_0x2de862=0xc8;}else{_0x2de862=0xce;}_0x311e33[_0xf465('0x19')](_0x2de862);return _0x311e33[_0xf465('0x1f')](_0xf465('0x20'),_0x390ee3+'-'+_0x4c2bdb+'/'+_0x510776)['json'](_0x582a2c);}return null;};}function patchUpdates(_0x1e226b){return function(_0x12bcc8){try{jsonpatch['apply'](_0x12bcc8,_0x1e226b,!![]);}catch(_0x5585c0){return BPromise[_0xf465('0x21')](_0x5585c0);}return _0x12bcc8[_0xf465('0x22')]();};}function saveUpdates(_0x3f07d0,_0x390778){return function(_0x2daa37){if(_0x2daa37){return _0x2daa37[_0xf465('0x23')](_0x3f07d0)[_0xf465('0x24')](function(_0x176dfc){return _0x176dfc;});}return null;};}function removeEntity(_0x54a161,_0x173ff3){return function(_0x36c9c8){if(_0x36c9c8){return _0x36c9c8['destroy']()[_0xf465('0x24')](function(){_0x54a161['status'](0xcc)[_0xf465('0x18')]();});}};}function handleEntityNotFound(_0x3f1bff,_0x3cde31){return function(_0x175b3a){if(!_0x175b3a){_0x3f1bff[_0xf465('0x17')](0x194);}return _0x175b3a;};}function handleError(_0x50cfed,_0x17d660){_0x17d660=_0x17d660||0x1f4;return function(_0x4dd9e7){logger[_0xf465('0x25')](_0x4dd9e7[_0xf465('0x26')]);if(_0x4dd9e7['name']){delete _0x4dd9e7[_0xf465('0x27')];}_0x50cfed[_0xf465('0x19')](_0x17d660)['send'](_0x4dd9e7);};}exports['index']=function(_0x3cf795,_0x310756){var _0xca7df2={},_0x24c3c7={},_0x28d281={'count':0x0,'rows':[]};var _0x4beb7b=_[_0xf465('0x28')](db[_0xf465('0x29')]['rawAttributes'],function(_0x552f11){return{'name':_0x552f11['fieldName'],'type':_0x552f11['type'][_0xf465('0x2a')]};});_0x24c3c7[_0xf465('0x2b')]=_['map'](_0x4beb7b,_0xf465('0x27'));_0x24c3c7[_0xf465('0x2c')]=_[_0xf465('0x2d')](_0x3cf795[_0xf465('0x2c')]);_0x24c3c7[_0xf465('0x2e')]=_[_0xf465('0x2f')](_0x24c3c7['model'],_0x24c3c7['query']);_0xca7df2['attributes']=_[_0xf465('0x2f')](_0x24c3c7[_0xf465('0x2b')],qs['fields'](_0x3cf795[_0xf465('0x2c')][_0xf465('0x30')]));_0xca7df2[_0xf465('0x31')]=_0xca7df2[_0xf465('0x31')][_0xf465('0x32')]?_0xca7df2[_0xf465('0x31')]:_0x24c3c7[_0xf465('0x2b')];if(!_0x3cf795['query'][_0xf465('0x33')]('nolimit')){_0xca7df2[_0xf465('0x1d')]=qs[_0xf465('0x1d')](_0x3cf795[_0xf465('0x2c')][_0xf465('0x1d')]);_0xca7df2[_0xf465('0x1b')]=qs[_0xf465('0x1b')](_0x3cf795[_0xf465('0x2c')][_0xf465('0x1b')]);}_0xca7df2[_0xf465('0x34')]=qs[_0xf465('0x35')](_0x3cf795['query'][_0xf465('0x35')]);_0xca7df2[_0xf465('0x36')]=qs[_0xf465('0x2e')](_['pick'](_0x3cf795['query'],_0x24c3c7[_0xf465('0x2e')]),_0x4beb7b);if(_0x3cf795[_0xf465('0x2c')][_0xf465('0x37')]){_0xca7df2['where']=_[_0xf465('0x38')](_0xca7df2[_0xf465('0x36')],{'$or':_[_0xf465('0x28')](_0x4beb7b,function(_0x1a8ada){if(_0x1a8ada['type']!==_0xf465('0x39')){var _0x53f50a={};_0x53f50a[_0x1a8ada[_0xf465('0x27')]]={'$like':'%'+_0x3cf795[_0xf465('0x2c')][_0xf465('0x37')]+'%'};return _0x53f50a;}})});}_0xca7df2=_[_0xf465('0x38')]({},_0xca7df2,_0x3cf795['options']);var _0x457d67={'where':_0xca7df2[_0xf465('0x36')]};return db['JscriptySessionReport'][_0xf465('0x1e')](_0x457d67)[_0xf465('0x24')](function(_0x58ac43){_0x28d281[_0xf465('0x1e')]=_0x58ac43;if(_0x3cf795[_0xf465('0x2c')][_0xf465('0x3a')]){_0xca7df2[_0xf465('0x3b')]=[{'all':!![]}];}return db[_0xf465('0x29')][_0xf465('0x3c')](_0xca7df2);})[_0xf465('0x24')](function(_0x27e320){_0x28d281[_0xf465('0x3d')]=_0x27e320;return _0x28d281;})['then'](respondWithFilteredResult(_0x310756,_0xca7df2))['catch'](handleError(_0x310756,null));};exports[_0xf465('0x3e')]=function(_0x43a0ab,_0x2e23df){var _0x40913e={'raw':!![],'where':{'id':_0x43a0ab[_0xf465('0x3f')]['id']}},_0x38db84={};_0x38db84['model']=_[_0xf465('0x2d')](db[_0xf465('0x29')][_0xf465('0x40')]);_0x38db84['query']=_['keys'](_0x43a0ab['query']);_0x38db84[_0xf465('0x2e')]=_['intersection'](_0x38db84['model'],_0x38db84[_0xf465('0x2c')]);_0x40913e[_0xf465('0x31')]=_['intersection'](_0x38db84[_0xf465('0x2b')],qs[_0xf465('0x30')](_0x43a0ab[_0xf465('0x2c')]['fields']));_0x40913e[_0xf465('0x31')]=_0x40913e[_0xf465('0x31')]['length']?_0x40913e[_0xf465('0x31')]:_0x38db84[_0xf465('0x2b')];if(_0x43a0ab[_0xf465('0x2c')][_0xf465('0x3a')]){_0x40913e[_0xf465('0x3b')]=[{'all':!![]}];}_0x40913e=_[_0xf465('0x38')]({},_0x40913e,_0x43a0ab[_0xf465('0x41')]);return db[_0xf465('0x29')]['find'](_0x40913e)['then'](handleEntityNotFound(_0x2e23df,null))['then'](respondWithResult(_0x2e23df,null))[_0xf465('0x42')](handleError(_0x2e23df,null));};exports[_0xf465('0x43')]=function(_0x1c6d9e,_0x47c427){return db['JscriptySessionReport'][_0xf465('0x43')](_0x1c6d9e['body'],{})[_0xf465('0x24')](respondWithResult(_0x47c427,0xc9))['catch'](handleError(_0x47c427,null));};exports[_0xf465('0x23')]=function(_0x5b3b7a,_0x13a9de){if(_0x5b3b7a[_0xf465('0x44')]['id']){delete _0x5b3b7a[_0xf465('0x44')]['id'];}return db[_0xf465('0x29')][_0xf465('0x45')]({'where':{'id':_0x5b3b7a[_0xf465('0x3f')]['id']}})['then'](handleEntityNotFound(_0x13a9de,null))[_0xf465('0x24')](saveUpdates(_0x5b3b7a[_0xf465('0x44')],null))[_0xf465('0x24')](respondWithResult(_0x13a9de,null))['catch'](handleError(_0x13a9de,null));};exports[_0xf465('0x46')]=function(_0x34adbe,_0x46633e){return db[_0xf465('0x29')][_0xf465('0x45')]({'where':{'id':_0x34adbe[_0xf465('0x3f')]['id']}})['then'](handleEntityNotFound(_0x46633e,null))['then'](removeEntity(_0x46633e,null))[_0xf465('0x42')](handleError(_0x46633e,null));};exports[_0xf465('0x47')]=function(_0x26bed9,_0x42c67d){return db[_0xf465('0x29')][_0xf465('0x47')]()[_0xf465('0x24')](respondWithResult(_0x42c67d,null))['catch'](handleError(_0x42c67d,null));};exports['getQuestions']=function(_0x515559,_0x76e0fa,_0xb8828a){var _0x425004={'raw':!![],'where':{}};var _0x3ca845={};var _0xa2a855={'count':0x0,'rows':[]};return db[_0xf465('0x29')][_0xf465('0x48')]({'where':{'id':_0x515559[_0xf465('0x3f')]['id']}})['then'](handleEntityNotFound(_0x76e0fa,null))[_0xf465('0x24')](function(_0xdfa0b0){if(_0xdfa0b0){_0x3ca845[_0xf465('0x2b')]=_[_0xf465('0x2d')](db['JscriptyQuestionReport'][_0xf465('0x40')]);_0x3ca845[_0xf465('0x2c')]=_['keys'](_0x515559[_0xf465('0x2c')]);_0x3ca845[_0xf465('0x2e')]=_[_0xf465('0x2f')](_0x3ca845[_0xf465('0x2b')],_0x3ca845[_0xf465('0x2c')]);_0x425004[_0xf465('0x31')]=_['intersection'](_0x3ca845['model'],qs['fields'](_0x515559[_0xf465('0x2c')][_0xf465('0x30')]));_0x425004['attributes']=_0x425004[_0xf465('0x31')][_0xf465('0x32')]?_0x425004['attributes']:_0x3ca845['model'];if(!_0x515559['query'][_0xf465('0x33')](_0xf465('0x49'))){_0x425004[_0xf465('0x1d')]=qs['limit'](_0x515559[_0xf465('0x2c')]['limit']);_0x425004[_0xf465('0x1b')]=qs[_0xf465('0x1b')](_0x515559[_0xf465('0x2c')][_0xf465('0x1b')]);}_0x425004['order']=qs[_0xf465('0x35')](_0x515559[_0xf465('0x2c')][_0xf465('0x35')]);_0x425004[_0xf465('0x36')]=qs[_0xf465('0x2e')](_['pick'](_0x515559[_0xf465('0x2c')],_0x3ca845['filters']));_0x425004[_0xf465('0x36')][_0xf465('0x4a')]=_0xdfa0b0['id'];if(_0x515559[_0xf465('0x2c')][_0xf465('0x37')]){_0x425004[_0xf465('0x36')]=_[_0xf465('0x38')](_0x425004[_0xf465('0x36')],{'$or':_[_0xf465('0x28')](_0x425004[_0xf465('0x31')],function(_0x5ac71e){var _0x24cfb0={};_0x24cfb0[_0x5ac71e]={'$like':'%'+_0x515559[_0xf465('0x2c')][_0xf465('0x37')]+'%'};return _0x24cfb0;})});}_0x425004=_[_0xf465('0x38')]({},_0x425004,_0x515559[_0xf465('0x41')]);return db[_0xf465('0x4b')]['count']({'where':_0x425004[_0xf465('0x36')]})[_0xf465('0x24')](function(_0x5a766d){_0xa2a855[_0xf465('0x1e')]=_0x5a766d;if(_0x515559[_0xf465('0x2c')][_0xf465('0x3a')]){_0x425004['include']=[{'all':!![]}];}return db[_0xf465('0x4b')]['findAll'](_0x425004);})[_0xf465('0x24')](function(_0x4f016f){_0xa2a855[_0xf465('0x3d')]=_0x4f016f;return _0xa2a855;});}})[_0xf465('0x24')](respondWithFilteredResult(_0x76e0fa,_0x425004))['catch'](handleError(_0x76e0fa,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index b090890..caa5eda 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 _0x277c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x42937c,_0x10924f){var _0x5c53a7=function(_0x3351cc){while(--_0x3351cc){_0x42937c['push'](_0x42937c['shift']());}};_0x5c53a7(++_0x10924f);}(_0x277c,0x153));var _0xc277=function(_0x2c0586,_0x1af061){_0x2c0586=_0x2c0586-0x0;var _0x43c14c=_0x277c[_0x2c0586];return _0x43c14c;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require(_0xc277('0x4'));var rp=require(_0xc277('0x5'));var fs=require('fs');var path=require(_0xc277('0x6'));var rimraf=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1a6582,_0x5a4f03){return _0x1a6582[_0xc277('0x9')]('JscriptySessionReport',attributes,{'tableName':_0xc277('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd4=['rimraf','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x2d42e7,_0x5992d1){_0x2d42e7=_0x2d42e7-0x0;var _0x3de4e6=_0x9fd4[_0x2d42e7];return _0x3de4e6;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x49fd('0xb'),'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 0e6933f..9b7ed90 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 _0x3e24=['info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xe51920,_0x4a1092){var _0x4e4c70=function(_0x71151){while(--_0x71151){_0xe51920['push'](_0xe51920['shift']());}};_0x4e4c70(++_0x4a1092);}(_0x3e24,0x167));var _0x43e2=function(_0x3439ea,_0x3c68ba){_0x3439ea=_0x3439ea-0x0;var _0x3900a3=_0x3e24[_0x3439ea];return _0x3900a3;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});} \ No newline at end of file +var _0x4bd3=['request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x28781a,_0x21d586){var _0x7a2c47=function(_0x2c0232){while(--_0x2c0232){_0x28781a['push'](_0x28781a['shift']());}};_0x7a2c47(++_0x21d586);}(_0x4bd3,0x174));var _0x34bd=function(_0x2a457a,_0x1d3207){_0x2a457a=_0x2a457a-0x0;var _0x34531e=_0x4bd3[_0x2a457a];return _0x34531e;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var moment=require(_0x34bd('0x1'));var BPromise=require(_0x34bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x3'));var logger=require(_0x34bd('0x4'))(_0x34bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x6'));var client=jayson[_0x34bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8744,_0x213716,_0x51a4d7){return new BPromise(function(_0xd600e1,_0x76de8d){return client[_0x34bd('0x8')](_0x3e8744,_0x51a4d7)[_0x34bd('0x9')](function(_0x1ac77f){logger[_0x34bd('0xa')]('JscriptySessionReport,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));logger[_0x34bd('0xc')](_0x34bd('0xd'),_0x213716,_0x34bd('0xb'),JSON['stringify'](_0x1ac77f));if(_0x1ac77f['error']){if(_0x1ac77f[_0x34bd('0xe')]['code']===0x1f4){logger['error'](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0x76de8d(_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);}logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0xd600e1(_0x1ac77f['error'][_0x34bd('0x10')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));_0xd600e1(_0x1ac77f[_0x34bd('0x11')][_0x34bd('0x10')]);}})[_0x34bd('0x12')](function(_0x34b91b){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x34b91b);_0x76de8d(_0x34b91b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 42774ef..685aed1 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 _0xb957=['update','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated'];(function(_0x1dd355,_0xccef7e){var _0x143dcb=function(_0x49e26d){while(--_0x49e26d){_0x1dd355['push'](_0x1dd355['shift']());}};_0x143dcb(++_0xccef7e);}(_0xb957,0x6d));var _0x7b95=function(_0x17a9cd,_0x5c4a5b){_0x17a9cd=_0x17a9cd-0x0;var _0x59a706=_0xb957[_0x17a9cd];return _0x59a706;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b95('0x0'));var timeout=require('connect-timeout');var express=require(_0x7b95('0x1'));var router=express[_0x7b95('0x2')]();var fs_extra=require(_0x7b95('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b95('0x4'));var config=require(_0x7b95('0x5'));var controller=require(_0x7b95('0x6'));router[_0x7b95('0x7')]('/',controller[_0x7b95('0x8')]);router['put'](_0x7b95('0x9'),auth[_0x7b95('0xa')](),controller[_0x7b95('0xb')]);module['exports']=router; \ No newline at end of file +var _0x1de4=['./license.controller','index','put','/:id','isAuthenticated','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x47d483,_0xb9683){var _0x580869=function(_0x54e83f){while(--_0x54e83f){_0x47d483['push'](_0x47d483['shift']());}};_0x580869(++_0xb9683);}(_0x1de4,0x94));var _0x41de=function(_0xcf6b84,_0x380ac5){_0xcf6b84=_0xcf6b84-0x0;var _0x5cf7d0=_0x1de4[_0xcf6b84];return _0x5cf7d0;};'use strict';var multer=require(_0x41de('0x0'));var util=require(_0x41de('0x1'));var path=require(_0x41de('0x2'));var timeout=require(_0x41de('0x3'));var express=require('express');var router=express[_0x41de('0x4')]();var fs_extra=require(_0x41de('0x5'));var auth=require(_0x41de('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x41de('0x7'));var controller=require(_0x41de('0x8'));router['get']('/',controller[_0x41de('0x9')]);router[_0x41de('0xa')](_0x41de('0xb'),auth[_0x41de('0xc')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 217b011..1a7a051 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 _0x31a4=['sequelize','exports','TEXT','STRING'];(function(_0x53635f,_0x549e0f){var _0x5ed257=function(_0x4150ca){while(--_0x4150ca){_0x53635f['push'](_0x53635f['shift']());}};_0x5ed257(++_0x549e0f);}(_0x31a4,0x154));var _0x431a=function(_0x6a7f39,_0x3a848a){_0x6a7f39=_0x6a7f39-0x0;var _0x27918a=_0x31a4[_0x6a7f39];return _0x27918a;};'use strict';var Sequelize=require(_0x431a('0x0'));module[_0x431a('0x1')]={'license':{'type':Sequelize[_0x431a('0x2')]},'data1':{'type':Sequelize[_0x431a('0x3')]},'data2':{'type':Sequelize[_0x431a('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbd26=['INTEGER','sequelize','TEXT'];(function(_0x44b4fe,_0x5e9b20){var _0x4b4603=function(_0x127362){while(--_0x127362){_0x44b4fe['push'](_0x44b4fe['shift']());}};_0x4b4603(++_0x5e9b20);}(_0xbd26,0xeb));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6bd2('0x0'));module['exports']={'license':{'type':Sequelize[_0x6bd2('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x6bd2('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 2a938a2..9d3f8bb 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 _0xc4aa=['zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}var utilLicense=require(_0xac4a('0x15'));exports[_0xac4a('0x2a')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={'raw':!![],'where':{'id':0x1}},_0x47f49c={};_0x47f49c[_0xac4a('0x2b')]=_[_0xac4a('0x2c')](db[_0xac4a('0x2d')]['rawAttributes']);_0x47f49c['query']=_[_0xac4a('0x2c')](_0x2772fe[_0xac4a('0x2e')]);_0x47f49c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x47f49c[_0xac4a('0x2b')],_0x47f49c['query']);_0x4a5a9e[_0xac4a('0x31')]=_['intersection'](_0x47f49c[_0xac4a('0x2b')],qs['fields'](_0x2772fe[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x4a5a9e[_0xac4a('0x31')]=_0x4a5a9e[_0xac4a('0x31')][_0xac4a('0x33')]?_0x4a5a9e[_0xac4a('0x31')]:_0x47f49c[_0xac4a('0x2b')];_0x4a5a9e=_[_0xac4a('0x34')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x35')]);return utilLicense[_0xac4a('0x36')](_0x4a5a9e)[_0xac4a('0x24')](respondWithResult(_0x116700,null))[_0xac4a('0x37')](handleError(_0x116700,null));};exports[_0xac4a('0x23')]=function(_0x1a9d4e,_0x5634e2){if(_0x1a9d4e[_0xac4a('0x38')]['id']){delete _0x1a9d4e[_0xac4a('0x38')]['id'];}return db['License'][_0xac4a('0x39')]({'where':{'id':_0x1a9d4e[_0xac4a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5634e2,null))['then'](function(_0x11f0be){var _0x1ba096=_0x11f0be[_0xac4a('0x3b')]({'plain':!![]});return utilLicense[_0xac4a('0x3c')](_0x1ba096,_0x1a9d4e['body'][_0xac4a('0x3d')]);})[_0xac4a('0x24')](function(_0x4e7630){if(!_0x4e7630[_0xac4a('0x3e')]){return saveUpdates(_0x1a9d4e[_0xac4a('0x38')],null);}return _0x4e7630;})[_0xac4a('0x24')](respondWithResult(_0x5634e2,null))['catch'](handleError(_0x5634e2,null));}; \ No newline at end of file +var _0x1967=['params','checkLicense','key','demo','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','index','model','keys','rawAttributes','query','intersection','attributes','fields','merge','getLicense','body','find'];(function(_0x1e69af,_0x17b675){var _0x34f6c4=function(_0x2762b5){while(--_0x2762b5){_0x1e69af['push'](_0x1e69af['shift']());}};_0x34f6c4(++_0x17b675);}(_0x1967,0x173));var _0x7196=function(_0x70cfcc,_0x1dcb97){_0x70cfcc=_0x70cfcc-0x0;var _0x4dc639=_0x1967[_0x70cfcc];return _0x4dc639;};'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);};}var utilLicense=require('../../config/license/util');exports[_0x7196('0x2c')]=function(_0x4ecea1,_0x4fd339){var _0x59d79d={'raw':!![],'where':{'id':0x1}},_0x30151f={};_0x30151f[_0x7196('0x2d')]=_[_0x7196('0x2e')](db['License'][_0x7196('0x2f')]);_0x30151f[_0x7196('0x30')]=_[_0x7196('0x2e')](_0x4ecea1[_0x7196('0x30')]);_0x30151f['filters']=_[_0x7196('0x31')](_0x30151f[_0x7196('0x2d')],_0x30151f[_0x7196('0x30')]);_0x59d79d[_0x7196('0x32')]=_[_0x7196('0x31')](_0x30151f[_0x7196('0x2d')],qs[_0x7196('0x33')](_0x4ecea1[_0x7196('0x30')][_0x7196('0x33')]));_0x59d79d[_0x7196('0x32')]=_0x59d79d[_0x7196('0x32')]['length']?_0x59d79d[_0x7196('0x32')]:_0x30151f['model'];_0x59d79d=_[_0x7196('0x34')]({},_0x59d79d,_0x4ecea1['options']);return utilLicense[_0x7196('0x35')](_0x59d79d)[_0x7196('0x27')](respondWithResult(_0x4fd339,null))['catch'](handleError(_0x4fd339,null));};exports[_0x7196('0x26')]=function(_0x2bcadd,_0x4531d7){if(_0x2bcadd[_0x7196('0x36')]['id']){delete _0x2bcadd[_0x7196('0x36')]['id'];}return db['License'][_0x7196('0x37')]({'where':{'id':_0x2bcadd[_0x7196('0x38')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x4531d7,null))[_0x7196('0x27')](function(_0x3e8f98){var _0x123cad=_0x3e8f98['get']({'plain':!![]});return utilLicense[_0x7196('0x39')](_0x123cad,_0x2bcadd[_0x7196('0x36')][_0x7196('0x3a')]);})['then'](function(_0x33831a){if(!_0x33831a[_0x7196('0x3b')]){return saveUpdates(_0x2bcadd[_0x7196('0x36')],null);}return _0x33831a;})[_0x7196('0x27')](respondWithResult(_0x4531d7,null))[_0x7196('0x3c')](handleError(_0x4531d7,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 058ef6d..e5aa831 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 _0xefdd=['request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment'];(function(_0x5da045,_0x3499dd){var _0xda395e=function(_0x8107){while(--_0x8107){_0x5da045['push'](_0x5da045['shift']());}};_0xda395e(++_0x3499dd);}(_0xefdd,0x175));var _0xdefd=function(_0x4e50b1,_0x104de4){_0x4e50b1=_0x4e50b1-0x0;var _0x56e311=_0xefdd[_0x4e50b1];return _0x56e311;};'use strict';var _=require(_0xdefd('0x0'));var util=require(_0xdefd('0x1'));var logger=require(_0xdefd('0x2'))(_0xdefd('0x3'));var moment=require(_0xdefd('0x4'));var BPromise=require('bluebird');var rp=require(_0xdefd('0x5'));var fs=require('fs');var path=require(_0xdefd('0x6'));var rimraf=require(_0xdefd('0x7'));var config=require(_0xdefd('0x8'));var attributes=require(_0xdefd('0x9'));module[_0xdefd('0xa')]=function(_0xc91f88,_0xb335c5){return _0xc91f88[_0xdefd('0xb')](_0xdefd('0xc'),attributes,{'tableName':_0xdefd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1635=['rimraf','./license.attributes','exports','lodash','api','moment','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1635,0x14b));var _0x5163=function(_0x47487e,_0x4efc25){_0x47487e=_0x47487e-0x0;var _0x459102=_0x1635[_0x47487e];return _0x459102;};'use strict';var _=require(_0x5163('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5163('0x1'));var moment=require(_0x5163('0x2'));var BPromise=require('bluebird');var rp=require(_0x5163('0x3'));var fs=require('fs');var path=require(_0x5163('0x4'));var rimraf=require(_0x5163('0x5'));var config=require('../../config/environment');var attributes=require(_0x5163('0x6'));module[_0x5163('0x7')]=function(_0x3a5042,_0x570f3c){return _0x3a5042['define']('License',attributes,{'tableName':'license','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 9687cd5..bedfa61 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 _0x058d=['jayson/promise','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x058d,0x8b));var _0xd058=function(_0x3e0671,_0xbce4b3){_0x3e0671=_0x3e0671-0x0;var _0x288dc1=_0x058d[_0x3e0671];return _0x288dc1;};'use strict';var _=require('lodash');var util=require(_0xd058('0x0'));var moment=require(_0xd058('0x1'));var BPromise=require(_0xd058('0x2'));var rs=require(_0xd058('0x3'));var fs=require('fs');var Redis=require(_0xd058('0x4'));var db=require(_0xd058('0x5'))['db'];var utils=require(_0xd058('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd058('0x7'));var jayson=require(_0xd058('0x8'));var client=jayson['client'][_0xd058('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50183c,_0x50edaa,_0x1c01aa){return new BPromise(function(_0x157028,_0x1f3db8){return client[_0xd058('0xa')](_0x50183c,_0x1c01aa)[_0xd058('0xb')](function(_0x3984ee){logger['info'](_0xd058('0xc'),_0x50edaa,'request\x20sent');logger[_0xd058('0xd')](_0xd058('0xe'),_0x50edaa,'request\x20sent',JSON[_0xd058('0xf')](_0x3984ee));if(_0x3984ee[_0xd058('0x10')]){if(_0x3984ee[_0xd058('0x10')]['code']===0x1f4){logger[_0xd058('0x10')](_0xd058('0xc'),_0x50edaa,_0x3984ee['error']['message']);return _0x1f3db8(_0x3984ee['error'][_0xd058('0x11')]);}logger[_0xd058('0x10')](_0xd058('0xc'),_0x50edaa,_0x3984ee[_0xd058('0x10')]['message']);return _0x157028(_0x3984ee[_0xd058('0x10')][_0xd058('0x11')]);}else{logger['info'](_0xd058('0xc'),_0x50edaa,_0xd058('0x12'));_0x157028(_0x3984ee[_0xd058('0x13')][_0xd058('0x11')]);}})[_0xd058('0x14')](function(_0x22ce58){logger[_0xd058('0x10')](_0xd058('0xc'),_0x50edaa,_0x22ce58);_0x1f3db8(_0x22ce58);});});} \ No newline at end of file +var _0x4fc8=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error'];(function(_0x42655b,_0x46e45b){var _0x12be12=function(_0x53444b){while(--_0x53444b){_0x42655b['push'](_0x42655b['shift']());}};_0x12be12(++_0x46e45b);}(_0x4fc8,0x1bc));var _0x84fc=function(_0x266270,_0x1e16ce){_0x266270=_0x266270-0x0;var _0x3ec561=_0x4fc8[_0x266270];return _0x3ec561;};'use strict';var _=require(_0x84fc('0x0'));var util=require(_0x84fc('0x1'));var moment=require(_0x84fc('0x2'));var BPromise=require(_0x84fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84fc('0x4'));var db=require(_0x84fc('0x5'))['db'];var utils=require(_0x84fc('0x6'));var logger=require('../../config/logger')(_0x84fc('0x7'));var config=require(_0x84fc('0x8'));var jayson=require(_0x84fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25fcda,_0x4fa111,_0x1f5230){return new BPromise(function(_0x46b43f,_0x4752cc){return client[_0x84fc('0xa')](_0x25fcda,_0x1f5230)[_0x84fc('0xb')](function(_0x71e22){logger[_0x84fc('0xc')](_0x84fc('0xd'),_0x4fa111,_0x84fc('0xe'));logger[_0x84fc('0xf')](_0x84fc('0x10'),_0x4fa111,_0x84fc('0xe'),JSON['stringify'](_0x71e22));if(_0x71e22[_0x84fc('0x11')]){if(_0x71e22[_0x84fc('0x11')][_0x84fc('0x12')]===0x1f4){logger[_0x84fc('0x11')](_0x84fc('0xd'),_0x4fa111,_0x71e22['error'][_0x84fc('0x13')]);return _0x4752cc(_0x71e22['error'][_0x84fc('0x13')]);}logger[_0x84fc('0x11')](_0x84fc('0xd'),_0x4fa111,_0x71e22['error'][_0x84fc('0x13')]);return _0x46b43f(_0x71e22[_0x84fc('0x11')][_0x84fc('0x13')]);}else{logger[_0x84fc('0xc')](_0x84fc('0xd'),_0x4fa111,_0x84fc('0xe'));_0x46b43f(_0x71e22[_0x84fc('0x14')][_0x84fc('0x13')]);}})[_0x84fc('0x15')](function(_0x5c6486){logger['error'](_0x84fc('0xd'),_0x4fa111,_0x5c6486);_0x4752cc(_0x5c6486);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4dd5ef6..7dcf567 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 _0x4e39=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','index','get','/describe','describe','isAuthenticated','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addAgents','put','delete','/:id/dispositions','removeAnswers','removeImap','removeSmtp','/:id','destroy','/:id/users','removeAgents','util','express','Router'];(function(_0x11d4d8,_0x243b6c){var _0x1bc56d=function(_0x134c51){while(--_0x134c51){_0x11d4d8['push'](_0x11d4d8['shift']());}};_0x1bc56d(++_0x243b6c);}(_0x4e39,0x1e1));var _0x94e3=function(_0x104b35,_0x13f218){_0x104b35=_0x104b35-0x0;var _0x55584d=_0x4e39[_0x104b35];return _0x55584d;};'use strict';var multer=require('multer');var util=require(_0x94e3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94e3('0x1'));var router=express[_0x94e3('0x2')]();var fs_extra=require(_0x94e3('0x3'));var auth=require(_0x94e3('0x4'));var interaction=require(_0x94e3('0x5'));var config=require('../../config/environment');var controller=require(_0x94e3('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x94e3('0x7')]);router[_0x94e3('0x8')](_0x94e3('0x9'),auth['isAuthenticated'](),controller[_0x94e3('0xa')]);router[_0x94e3('0x8')]('/:id',auth[_0x94e3('0xb')](),controller[_0x94e3('0xc')]);router[_0x94e3('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x94e3('0xd')]);router['get'](_0x94e3('0xe'),auth[_0x94e3('0xb')](),controller[_0x94e3('0xf')]);router['get'](_0x94e3('0x10'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x11')]);router[_0x94e3('0x8')](_0x94e3('0x12'),auth[_0x94e3('0xb')](),controller['getSmtp']);router[_0x94e3('0x8')](_0x94e3('0x13'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x14')]);router['get'](_0x94e3('0x15'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x16')]);router['get'](_0x94e3('0x17'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x18')]);router[_0x94e3('0x8')](_0x94e3('0x19'),auth[_0x94e3('0xb')](),controller['verifySmtp']);router[_0x94e3('0x8')]('/:id/users',auth[_0x94e3('0xb')](),controller['getAgents']);router[_0x94e3('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x94e3('0x1b')]);router[_0x94e3('0x1a')]('/:id/canned_answers',auth[_0x94e3('0xb')](),controller[_0x94e3('0x1c')]);router[_0x94e3('0x1a')]('/',auth[_0x94e3('0xb')](),controller[_0x94e3('0x1d')]);router['post'](_0x94e3('0x10'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x1e')]);router[_0x94e3('0x1a')](_0x94e3('0x12'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x1f')]);router[_0x94e3('0x1a')](_0x94e3('0x13'),auth['isAuthenticated'](),controller[_0x94e3('0x20')]);router[_0x94e3('0x1a')](_0x94e3('0x15'),auth[_0x94e3('0xb')](),controller['addApplications']);router[_0x94e3('0x1a')]('/:id/send',auth[_0x94e3('0xb')](),controller['send']);router[_0x94e3('0x1a')]('/:id/users',auth[_0x94e3('0xb')](),controller[_0x94e3('0x21')]);router[_0x94e3('0x22')]('/:id',auth[_0x94e3('0xb')](),controller['update']);router[_0x94e3('0x23')](_0x94e3('0x24'),auth[_0x94e3('0xb')](),controller['removeDispositions']);router[_0x94e3('0x23')](_0x94e3('0xe'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x25')]);router['delete'](_0x94e3('0x10'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x26')]);router[_0x94e3('0x23')]('/:id/out_servers',auth[_0x94e3('0xb')](),controller[_0x94e3('0x27')]);router[_0x94e3('0x23')](_0x94e3('0x28'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x29')]);router[_0x94e3('0x23')](_0x94e3('0x2a'),auth[_0x94e3('0xb')](),controller[_0x94e3('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xde32=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addAnswer','/:id/in_servers','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','addAgents','put','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde32,0x11a));var _0x2de3=function(_0x3dc03a,_0x565367){_0x3dc03a=_0x3dc03a-0x0;var _0x58f09f=_0xde32[_0x3dc03a];return _0x58f09f;};'use strict';var multer=require('multer');var util=require(_0x2de3('0x0'));var path=require(_0x2de3('0x1'));var timeout=require(_0x2de3('0x2'));var express=require(_0x2de3('0x3'));var router=express[_0x2de3('0x4')]();var fs_extra=require(_0x2de3('0x5'));var auth=require(_0x2de3('0x6'));var interaction=require(_0x2de3('0x7'));var config=require(_0x2de3('0x8'));var controller=require(_0x2de3('0x9'));router[_0x2de3('0xa')]('/',auth[_0x2de3('0xb')](),controller[_0x2de3('0xc')]);router[_0x2de3('0xa')](_0x2de3('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x2de3('0xe'),auth[_0x2de3('0xb')](),controller[_0x2de3('0xf')]);router[_0x2de3('0xa')](_0x2de3('0x10'),auth[_0x2de3('0xb')](),controller['getDispositions']);router[_0x2de3('0xa')](_0x2de3('0x11'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x12')]);router[_0x2de3('0xa')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x2de3('0x13')]);router[_0x2de3('0xa')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x2de3('0x14')]);router[_0x2de3('0xa')](_0x2de3('0x15'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x16')]);router['get'](_0x2de3('0x17'),auth[_0x2de3('0xb')](),controller['getApplications']);router[_0x2de3('0xa')](_0x2de3('0x18'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x19')]);router[_0x2de3('0xa')]('/:id/verify',auth[_0x2de3('0xb')](),controller[_0x2de3('0x1a')]);router[_0x2de3('0xa')](_0x2de3('0x1b'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x1c')]);router[_0x2de3('0x1d')](_0x2de3('0x10'),auth[_0x2de3('0xb')](),controller['addDisposition']);router['post'](_0x2de3('0x11'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x1e')]);router[_0x2de3('0x1d')]('/',auth[_0x2de3('0xb')](),controller['create']);router[_0x2de3('0x1d')](_0x2de3('0x1f'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x20')]);router[_0x2de3('0x1d')](_0x2de3('0x21'),auth['isAuthenticated'](),controller[_0x2de3('0x22')]);router['post'](_0x2de3('0x15'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x23')]);router['post'](_0x2de3('0x17'),auth['isAuthenticated'](),controller[_0x2de3('0x24')]);router[_0x2de3('0x1d')](_0x2de3('0x25'),auth[_0x2de3('0xb')](),controller['send']);router[_0x2de3('0x1d')](_0x2de3('0x1b'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x26')]);router[_0x2de3('0x27')](_0x2de3('0xe'),auth[_0x2de3('0xb')](),controller['update']);router[_0x2de3('0x28')](_0x2de3('0x10'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x29')]);router[_0x2de3('0x28')](_0x2de3('0x11'),auth[_0x2de3('0xb')](),controller[_0x2de3('0x2a')]);router['delete'](_0x2de3('0x1f'),auth[_0x2de3('0xb')](),controller['removeImap']);router['delete'](_0x2de3('0x21'),auth['isAuthenticated'](),controller[_0x2de3('0x2b')]);router[_0x2de3('0x28')]('/:id',auth[_0x2de3('0xb')](),controller[_0x2de3('0x2c')]);router[_0x2de3('0x28')](_0x2de3('0x1b'),auth['isAuthenticated'](),controller[_0x2de3('0x2d')]);module[_0x2de3('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b2e7385..6e9f75e 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 _0xb43b=['mandatoryDispositionPauseId','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3fd4a7,_0x42cde1){var _0x3b99c3=function(_0x421384){while(--_0x421384){_0x3fd4a7['push'](_0x3fd4a7['shift']());}};_0x3b99c3(++_0x42cde1);}(_0xb43b,0xbf));var _0xbb43=function(_0x3e323f,_0x1ecae7){_0x3e323f=_0x3e323f-0x0;var _0x84d70b=_0xb43b[_0x3e323f];return _0x84d70b;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'description':{'type':Sequelize[_0xbb43('0x1')]},'name':{'type':Sequelize[_0xbb43('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xbb43('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xbb43('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xbb43('0x3')]},'markAsUnread':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xbb43('0x1')],'allowNull':![],'defaultValue':_0xbb43('0x4')},'fontSize':{'type':Sequelize[_0xbb43('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbb43('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb43('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb43('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xbb43('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':![],'comment':_0xbb43('0x7'),'set':function(_0x5a4589){if(!_0x5a4589)this[_0xbb43('0x8')](_0xbb43('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x5a4589);}}}; \ No newline at end of file +var _0x6108=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x403aa8,_0x4c393d){var _0x567696=function(_0x824873){while(--_0x824873){_0x403aa8['push'](_0x403aa8['shift']());}};_0x567696(++_0x4c393d);}(_0x6108,0xbc));var _0x8610=function(_0x4d10ce,_0x22df57){_0x4d10ce=_0x4d10ce-0x0;var _0x484ea7=_0x6108[_0x4d10ce];return _0x484ea7;};'use strict';var Sequelize=require(_0x8610('0x0'));module['exports']={'description':{'type':Sequelize[_0x8610('0x1')]},'name':{'type':Sequelize[_0x8610('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x8610('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x8610('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x8610('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8610('0x4')},'fontSize':{'type':Sequelize[_0x8610('0x5')](0x2)[_0x8610('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8610('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x8610('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8610('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8610('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8610('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8610('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8610('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x8610('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x8610('0x2')],'defaultValue':![],'comment':_0x8610('0x8'),'set':function(_0x1da432){if(!_0x1da432)this['setDataValue'](_0x8610('0x9'),null);this[_0x8610('0xa')](_0x8610('0xb'),_0x1da432);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 1bb2768..e646163 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 _0x4f3c=['info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','get','MailAccounts','UserProfileResource','stack','send','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','name','keys','intersection','query','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','options','MailAccount','includeAll','findAll','rows','show','Imap','include','find','body','params','update','describe','MailAccountId','create','getDispositions','Disposition','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','hasOwnProperty','removeAnswers','ids','ListId','isNil','active','description','cservice','cuser','password','pass','authentication','host','port','service','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','from','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','messageId','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','juice','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','then'];(function(_0x44ae75,_0x4e6c98){var _0x26c0ed=function(_0x2bc8de){while(--_0x2bc8de){_0x44ae75['push'](_0x44ae75['shift']());}};_0x26c0ed(++_0x4e6c98);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x4f3c[_0x31a576];return _0x30b1d3;};'use strict';var emlformat=require(_0xc4f3('0x0'));var rimraf=require(_0xc4f3('0x1'));var zipdir=require(_0xc4f3('0x2'));var jsonpatch=require(_0xc4f3('0x3'));var rp=require(_0xc4f3('0x4'));var moment=require(_0xc4f3('0x5'));var BPromise=require(_0xc4f3('0x6'));var Mustache=require(_0xc4f3('0x7'));var util=require(_0xc4f3('0x8'));var path=require(_0xc4f3('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc4f3('0xa'));var fs=require('fs');var fs_extra=require(_0xc4f3('0xb'));var _=require(_0xc4f3('0xc'));var squel=require(_0xc4f3('0xd'));var crypto=require(_0xc4f3('0xe'));var jsforce=require(_0xc4f3('0xf'));var deskjs=require(_0xc4f3('0x10'));var toCsv=require(_0xc4f3('0x11'));var querystring=require(_0xc4f3('0x12'));var Papa=require(_0xc4f3('0x13'));var htmlToText=require('html-to-text');var juice=require(_0xc4f3('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc4f3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4f3('0x16'));var logger=require(_0xc4f3('0x17'))(_0xc4f3('0x18'));var utils=require('../../config/utils');var config=require(_0xc4f3('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xc4f3('0x1a')](config[_0xc4f3('0x1b')],{'host':_0xc4f3('0x1c'),'port':0x18eb});var socket=require(_0xc4f3('0x1d'))(new Redis(config['redis']));require(_0xc4f3('0x1e'))[_0xc4f3('0x1f')](socket);var jayson=require(_0xc4f3('0x20'));var client=jayson[_0xc4f3('0x21')]['http']({'port':0x232b});function respondWithRpcPromise(_0x927b26,_0x3a4ff3,_0x52bd89,_0x2fdcb3){return new BPromise(function(_0x295324,_0x3da29c){var _0x53b0b6=_0x2fdcb3||client;return _0x53b0b6['request'](_0x927b26,_0x52bd89)[_0xc4f3('0x22')](function(_0x22f779){logger[_0xc4f3('0x23')](_0xc4f3('0x24'),_0x3a4ff3,'request\x20sent');logger[_0xc4f3('0x25')](_0xc4f3('0x26'),_0x3a4ff3,_0xc4f3('0x27'),JSON[_0xc4f3('0x28')](_0x22f779));if(_0x22f779[_0xc4f3('0x29')]){if(_0x22f779[_0xc4f3('0x29')][_0xc4f3('0x2a')]===0x1f4){logger[_0xc4f3('0x29')](_0xc4f3('0x24'),_0x3a4ff3,_0x22f779[_0xc4f3('0x29')][_0xc4f3('0x2b')]);return _0x3da29c(_0x22f779['error'][_0xc4f3('0x2b')]);}logger[_0xc4f3('0x29')]('MailAccount,\x20%s,\x20%s',_0x3a4ff3,_0x22f779['error'][_0xc4f3('0x2b')]);return _0x295324(_0x22f779[_0xc4f3('0x29')]['message']);}else{logger['info'](_0xc4f3('0x24'),_0x3a4ff3,_0xc4f3('0x27'));_0x295324(_0x22f779[_0xc4f3('0x2c')]['message']);}})[_0xc4f3('0x2d')](function(_0x460ee7){logger[_0xc4f3('0x29')](_0xc4f3('0x24'),_0x3a4ff3,_0x460ee7);_0x3da29c(_0x460ee7);});});}function respondWithStatusCode(_0x5ce75c,_0x378194){_0x378194=_0x378194||0xcc;return function(_0x46f5c6){if(_0x46f5c6){return _0x5ce75c[_0xc4f3('0x2e')](_0x378194);}return _0x5ce75c[_0xc4f3('0x2f')](_0x378194)[_0xc4f3('0x30')]();};}function respondWithResult(_0x278d0a,_0x2912e4){_0x2912e4=_0x2912e4||0xc8;return function(_0x541946){if(_0x541946){return _0x278d0a[_0xc4f3('0x2f')](_0x2912e4)[_0xc4f3('0x31')](_0x541946);}};}function respondWithFilteredResult(_0x7e4227,_0x4125be){return function(_0x5aa950){if(_0x5aa950){var _0x2731a5=typeof _0x4125be[_0xc4f3('0x32')]==='undefined'&&typeof _0x4125be['limit']===_0xc4f3('0x33');var _0x2c05c4=_0x5aa950['count'];var _0x3c1722=_0x2731a5?0x0:_0x4125be[_0xc4f3('0x32')];var _0x303b12=_0x2731a5?_0x5aa950[_0xc4f3('0x34')]:_0x4125be['offset']+_0x4125be[_0xc4f3('0x35')];var _0x3c0bcc;if(_0x303b12>=_0x2c05c4){_0x303b12=_0x2c05c4;_0x3c0bcc=0xc8;}else{_0x3c0bcc=0xce;}_0x7e4227[_0xc4f3('0x2f')](_0x3c0bcc);return _0x7e4227[_0xc4f3('0x36')](_0xc4f3('0x37'),_0x3c1722+'-'+_0x303b12+'/'+_0x2c05c4)[_0xc4f3('0x31')](_0x5aa950);}return null;};}function patchUpdates(_0x3ac6b6){return function(_0x55106a){try{jsonpatch[_0xc4f3('0x38')](_0x55106a,_0x3ac6b6,!![]);}catch(_0x6fa42d){return BPromise['reject'](_0x6fa42d);}return _0x55106a[_0xc4f3('0x39')]();};}function saveUpdates(_0x1ac929,_0x16d5f5){return function(_0x4b4a8d){if(_0x4b4a8d){return _0x4b4a8d['update'](_0x1ac929)[_0xc4f3('0x22')](function(_0x13b052){return _0x13b052;});}return null;};}function removeEntity(_0x2ba533,_0x2d1145){return function(_0x348791){if(_0x348791){return _0x348791[_0xc4f3('0x3a')]()[_0xc4f3('0x22')](function(){var _0xcd9767=_0x348791[_0xc4f3('0x3b')]({'plain':!![]});var _0x3a03e6=_0xc4f3('0x3c');return db[_0xc4f3('0x3d')]['destroy']({'where':{'type':_0x3a03e6,'resourceId':_0xcd9767['id']}})['then'](function(){return _0x348791;});})[_0xc4f3('0x22')](function(){_0x2ba533[_0xc4f3('0x2f')](0xcc)[_0xc4f3('0x30')]();});}};}function handleEntityNotFound(_0x445469,_0x1e4d5f){return function(_0x179eaa){if(!_0x179eaa){_0x445469[_0xc4f3('0x2e')](0x194);}return _0x179eaa;};}function handleError(_0x15456e,_0x39d0b3){_0x39d0b3=_0x39d0b3||0x1f4;return function(_0x55aad9){logger[_0xc4f3('0x29')](_0x55aad9[_0xc4f3('0x3e')]);if(_0x55aad9['name']){delete _0x55aad9['name'];}_0x15456e[_0xc4f3('0x2f')](_0x39d0b3)[_0xc4f3('0x3f')](_0x55aad9);};}exports['index']=function(_0x2b7efc,_0x13ea6d){var _0xf4fe40={'include':[{'model':db[_0xc4f3('0x40')],'as':'Imap'},{'model':db[_0xc4f3('0x41')],'as':_0xc4f3('0x42')},{'model':db[_0xc4f3('0x43')],'as':_0xc4f3('0x44')}]},_0x159fca={},_0x45bd0c={'count':0x0,'rows':[]};var _0x184f23=_[_0xc4f3('0x45')](db['MailAccount'][_0xc4f3('0x46')],function(_0x3e4519){return{'name':_0x3e4519[_0xc4f3('0x47')],'type':_0x3e4519[_0xc4f3('0x48')][_0xc4f3('0x49')]};});_0x159fca['model']=_[_0xc4f3('0x45')](_0x184f23,_0xc4f3('0x4a'));_0x159fca['query']=_[_0xc4f3('0x4b')](_0x2b7efc['query']);_0x159fca['filters']=_[_0xc4f3('0x4c')](_0x159fca['model'],_0x159fca[_0xc4f3('0x4d')]);_0xf4fe40['attributes']=_[_0xc4f3('0x4c')](_0x159fca[_0xc4f3('0x4e')],qs[_0xc4f3('0x4f')](_0x2b7efc[_0xc4f3('0x4d')][_0xc4f3('0x4f')]));_0xf4fe40[_0xc4f3('0x50')]=_0xf4fe40[_0xc4f3('0x50')][_0xc4f3('0x51')]?_0xf4fe40[_0xc4f3('0x50')]:_0x159fca[_0xc4f3('0x4e')];if(!_0x2b7efc[_0xc4f3('0x4d')]['hasOwnProperty'](_0xc4f3('0x52'))){_0xf4fe40['limit']=qs[_0xc4f3('0x35')](_0x2b7efc[_0xc4f3('0x4d')][_0xc4f3('0x35')]);_0xf4fe40[_0xc4f3('0x32')]=qs[_0xc4f3('0x32')](_0x2b7efc[_0xc4f3('0x4d')]['offset']);}_0xf4fe40[_0xc4f3('0x53')]=qs[_0xc4f3('0x54')](_0x2b7efc[_0xc4f3('0x4d')][_0xc4f3('0x54')]);_0xf4fe40[_0xc4f3('0x55')]=qs[_0xc4f3('0x56')](_[_0xc4f3('0x57')](_0x2b7efc[_0xc4f3('0x4d')],_0x159fca[_0xc4f3('0x56')]),_0x184f23);if(_0x2b7efc[_0xc4f3('0x4d')][_0xc4f3('0x58')]){_0xf4fe40['where']=_[_0xc4f3('0x59')](_0xf4fe40[_0xc4f3('0x55')],{'$or':_[_0xc4f3('0x45')](_0x184f23,function(_0x30b2bf){if(_0x30b2bf['type']!=='VIRTUAL'){var _0x19d857={};_0x19d857[_0x30b2bf[_0xc4f3('0x4a')]]={'$like':'%'+_0x2b7efc[_0xc4f3('0x4d')]['filter']+'%'};return _0x19d857;}})});}_0xf4fe40=_[_0xc4f3('0x59')]({},_0xf4fe40,_0x2b7efc[_0xc4f3('0x5a')]);var _0x53d2f2={'where':_0xf4fe40['where']};return db[_0xc4f3('0x5b')][_0xc4f3('0x34')](_0x53d2f2)[_0xc4f3('0x22')](function(_0x2c159c){_0x45bd0c[_0xc4f3('0x34')]=_0x2c159c;if(_0x2b7efc[_0xc4f3('0x4d')][_0xc4f3('0x5c')]){_0xf4fe40['include']=[{'all':!![]}];}return db[_0xc4f3('0x5b')][_0xc4f3('0x5d')](_0xf4fe40);})[_0xc4f3('0x22')](function(_0x50f3ab){_0x45bd0c[_0xc4f3('0x5e')]=_0x50f3ab;return _0x45bd0c;})[_0xc4f3('0x22')](respondWithFilteredResult(_0x13ea6d,_0xf4fe40))[_0xc4f3('0x2d')](handleError(_0x13ea6d,null));};exports[_0xc4f3('0x5f')]=function(_0x5b178a,_0x2c321d){var _0x5cc83d={'raw':![],'where':{'id':_0x5b178a['params']['id']},'include':[{'model':db[_0xc4f3('0x40')],'as':_0xc4f3('0x60')},{'model':db[_0xc4f3('0x41')],'as':'Smtp'},{'model':db[_0xc4f3('0x43')],'as':_0xc4f3('0x44')}]},_0x23fe2c={};_0x23fe2c['model']=_[_0xc4f3('0x4b')](db[_0xc4f3('0x5b')]['rawAttributes']);_0x23fe2c[_0xc4f3('0x4d')]=_[_0xc4f3('0x4b')](_0x5b178a[_0xc4f3('0x4d')]);_0x23fe2c[_0xc4f3('0x56')]=_[_0xc4f3('0x4c')](_0x23fe2c[_0xc4f3('0x4e')],_0x23fe2c[_0xc4f3('0x4d')]);_0x5cc83d['attributes']=_[_0xc4f3('0x4c')](_0x23fe2c['model'],qs[_0xc4f3('0x4f')](_0x5b178a['query'][_0xc4f3('0x4f')]));_0x5cc83d['attributes']=_0x5cc83d[_0xc4f3('0x50')][_0xc4f3('0x51')]?_0x5cc83d[_0xc4f3('0x50')]:_0x23fe2c[_0xc4f3('0x4e')];if(_0x5b178a[_0xc4f3('0x4d')][_0xc4f3('0x5c')]){_0x5cc83d[_0xc4f3('0x61')]=[{'all':!![]}];}_0x5cc83d=_[_0xc4f3('0x59')]({},_0x5cc83d,_0x5b178a['options']);return db[_0xc4f3('0x5b')][_0xc4f3('0x62')](_0x5cc83d)['then'](handleEntityNotFound(_0x2c321d,null))[_0xc4f3('0x22')](respondWithResult(_0x2c321d,null))['catch'](handleError(_0x2c321d,null));};exports['update']=function(_0xa2f3f5,_0x2ba4d7){if(_0xa2f3f5[_0xc4f3('0x63')]['id']){delete _0xa2f3f5[_0xc4f3('0x63')]['id'];}return db[_0xc4f3('0x5b')][_0xc4f3('0x62')]({'where':{'id':_0xa2f3f5[_0xc4f3('0x64')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xc4f3('0x60')},{'model':db[_0xc4f3('0x41')],'as':_0xc4f3('0x42')},{'model':db['Pause'],'as':_0xc4f3('0x44')}]})[_0xc4f3('0x22')](handleEntityNotFound(_0x2ba4d7,null))['then'](saveUpdates(_0xa2f3f5[_0xc4f3('0x63')],null))['then'](function(_0x25ffe5){if(_0x25ffe5&&_0xa2f3f5[_0xc4f3('0x63')][_0xc4f3('0x60')]){return db[_0xc4f3('0x40')][_0xc4f3('0x65')](_0xa2f3f5[_0xc4f3('0x63')][_0xc4f3('0x60')],{'where':{'MailAccountId':_0x25ffe5['id']}})['then'](function(){return _0x25ffe5;});}return _0x25ffe5;})['then'](function(_0x274fdf){if(_0x274fdf&&_0xa2f3f5[_0xc4f3('0x63')][_0xc4f3('0x42')]){return db[_0xc4f3('0x41')]['update'](_0xa2f3f5[_0xc4f3('0x63')][_0xc4f3('0x42')],{'where':{'MailAccountId':_0x274fdf['id']}})[_0xc4f3('0x22')](function(){return _0x274fdf;});}return _0x274fdf;})['then'](respondWithResult(_0x2ba4d7,null))[_0xc4f3('0x2d')](handleError(_0x2ba4d7,null));};exports[_0xc4f3('0x66')]=function(_0x3c3c4b,_0x52da19){return db[_0xc4f3('0x5b')][_0xc4f3('0x66')]()[_0xc4f3('0x22')](respondWithResult(_0x52da19,null))[_0xc4f3('0x2d')](handleError(_0x52da19,null));};exports['addDisposition']=function(_0x497910,_0x236359,_0x4b06a4){if(_0x497910['body']['id']){delete _0x497910[_0xc4f3('0x63')]['id'];}return db['MailAccount'][_0xc4f3('0x62')]({'where':{'id':_0x497910[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x236359,null))[_0xc4f3('0x22')](function(_0x2ca9a6){if(_0x2ca9a6){_0x497910[_0xc4f3('0x63')][_0xc4f3('0x67')]=_0x2ca9a6['id'];return db['Disposition'][_0xc4f3('0x68')](_0x497910['body']);}})['then'](respondWithResult(_0x236359,null))[_0xc4f3('0x2d')](handleError(_0x236359,null));};exports[_0xc4f3('0x69')]=function(_0x1577c7,_0x4a47ac,_0x45a388){var _0x57c4f7={'raw':![],'where':{}};var _0x41de89={};var _0x21dd99={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1577c7['params']['id']}})['then'](handleEntityNotFound(_0x4a47ac,null))[_0xc4f3('0x22')](function(_0x55ce2b){if(_0x55ce2b){_0x41de89['model']=_['keys'](db[_0xc4f3('0x6a')][_0xc4f3('0x46')]);_0x41de89['query']=_[_0xc4f3('0x4b')](_0x1577c7[_0xc4f3('0x4d')]);_0x41de89[_0xc4f3('0x56')]=_[_0xc4f3('0x4c')](_0x41de89['model'],_0x41de89[_0xc4f3('0x4d')]);_0x57c4f7[_0xc4f3('0x50')]=_[_0xc4f3('0x4c')](_0x41de89[_0xc4f3('0x4e')],qs[_0xc4f3('0x4f')](_0x1577c7[_0xc4f3('0x4d')][_0xc4f3('0x4f')]));_0x57c4f7[_0xc4f3('0x50')]=_0x57c4f7[_0xc4f3('0x50')][_0xc4f3('0x51')]?_0x57c4f7[_0xc4f3('0x50')]:_0x41de89[_0xc4f3('0x4e')];if(!_0x1577c7[_0xc4f3('0x4d')]['hasOwnProperty'](_0xc4f3('0x52'))){_0x57c4f7[_0xc4f3('0x35')]=qs[_0xc4f3('0x35')](_0x1577c7[_0xc4f3('0x4d')]['limit']);_0x57c4f7['offset']=qs[_0xc4f3('0x32')](_0x1577c7[_0xc4f3('0x4d')]['offset']);}_0x57c4f7['order']=qs[_0xc4f3('0x54')](_0x1577c7['query'][_0xc4f3('0x54')]);_0x57c4f7['where']=qs['filters'](_['pick'](_0x1577c7[_0xc4f3('0x4d')],_0x41de89[_0xc4f3('0x56')]));_0x57c4f7['where']['MailAccountId']=_0x55ce2b['id'];if(_0x1577c7[_0xc4f3('0x4d')][_0xc4f3('0x58')]){_0x57c4f7['where']=_[_0xc4f3('0x59')](_0x57c4f7[_0xc4f3('0x55')],{'$or':_['map'](_0x57c4f7['attributes'],function(_0x2dbaf8){var _0x24a8d8={};_0x24a8d8[_0x2dbaf8]={'$like':'%'+_0x1577c7[_0xc4f3('0x4d')][_0xc4f3('0x58')]+'%'};return _0x24a8d8;})});}_0x57c4f7=_[_0xc4f3('0x59')]({},_0x57c4f7,_0x1577c7[_0xc4f3('0x5a')]);return db[_0xc4f3('0x6a')]['count']({'where':_0x57c4f7[_0xc4f3('0x55')]})['then'](function(_0x58ec24){_0x21dd99[_0xc4f3('0x34')]=_0x58ec24;if(_0x1577c7[_0xc4f3('0x4d')]['includeAll']){_0x57c4f7[_0xc4f3('0x61')]=[{'all':!![]}];}return db[_0xc4f3('0x6a')][_0xc4f3('0x5d')](_0x57c4f7);})[_0xc4f3('0x22')](function(_0x454976){_0x21dd99[_0xc4f3('0x5e')]=_0x454976;return _0x21dd99;});}})[_0xc4f3('0x22')](respondWithFilteredResult(_0x4a47ac,_0x57c4f7))['catch'](handleError(_0x4a47ac,null));};exports[_0xc4f3('0x6b')]=function(_0x234175,_0x34f05a,_0x446e24){return db['MailAccount'][_0xc4f3('0x62')]({'where':{'id':_0x234175[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x34f05a,null))['then'](function(_0x45bd37){if(_0x45bd37){return _0x45bd37['removeDispositions'](_0x234175['query']['ids']);}})[_0xc4f3('0x22')](respondWithStatusCode(_0x34f05a,null))[_0xc4f3('0x2d')](handleError(_0x34f05a,null));};exports[_0xc4f3('0x6c')]=function(_0x35dde8,_0x5dd8be,_0x3eeb4c){if(_0x35dde8[_0xc4f3('0x63')]['id']){delete _0x35dde8[_0xc4f3('0x63')]['id'];}return db[_0xc4f3('0x5b')][_0xc4f3('0x62')]({'where':{'id':_0x35dde8[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x5dd8be,null))['then'](function(_0x327ca6){if(_0x327ca6){_0x35dde8[_0xc4f3('0x63')]['MailAccountId']=_0x327ca6['id'];return db['CannedAnswer']['create'](_0x35dde8['body']);}})[_0xc4f3('0x22')](respondWithResult(_0x5dd8be,null))[_0xc4f3('0x2d')](handleError(_0x5dd8be,null));};exports[_0xc4f3('0x6d')]=function(_0x377d3b,_0x23c193,_0x44c4ed){var _0x58c243={'raw':![],'where':{}};var _0x27900f={};var _0x270565={'count':0x0,'rows':[]};return db['MailAccount'][_0xc4f3('0x6e')]({'where':{'id':_0x377d3b[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x23c193,null))['then'](function(_0x3e000a){if(_0x3e000a){_0x27900f['model']=_['keys'](db[_0xc4f3('0x6f')][_0xc4f3('0x46')]);_0x27900f['query']=_[_0xc4f3('0x4b')](_0x377d3b[_0xc4f3('0x4d')]);_0x27900f[_0xc4f3('0x56')]=_[_0xc4f3('0x4c')](_0x27900f[_0xc4f3('0x4e')],_0x27900f[_0xc4f3('0x4d')]);_0x58c243[_0xc4f3('0x50')]=_['intersection'](_0x27900f[_0xc4f3('0x4e')],qs[_0xc4f3('0x4f')](_0x377d3b[_0xc4f3('0x4d')][_0xc4f3('0x4f')]));_0x58c243[_0xc4f3('0x50')]=_0x58c243[_0xc4f3('0x50')][_0xc4f3('0x51')]?_0x58c243['attributes']:_0x27900f[_0xc4f3('0x4e')];if(!_0x377d3b['query'][_0xc4f3('0x70')]('nolimit')){_0x58c243['limit']=qs[_0xc4f3('0x35')](_0x377d3b[_0xc4f3('0x4d')][_0xc4f3('0x35')]);_0x58c243[_0xc4f3('0x32')]=qs[_0xc4f3('0x32')](_0x377d3b['query'][_0xc4f3('0x32')]);}_0x58c243['order']=qs['sort'](_0x377d3b[_0xc4f3('0x4d')]['sort']);_0x58c243[_0xc4f3('0x55')]=qs[_0xc4f3('0x56')](_[_0xc4f3('0x57')](_0x377d3b[_0xc4f3('0x4d')],_0x27900f['filters']));_0x58c243[_0xc4f3('0x55')]['MailAccountId']=_0x3e000a['id'];if(_0x377d3b[_0xc4f3('0x4d')][_0xc4f3('0x58')]){_0x58c243[_0xc4f3('0x55')]=_[_0xc4f3('0x59')](_0x58c243[_0xc4f3('0x55')],{'$or':_[_0xc4f3('0x45')](_0x58c243[_0xc4f3('0x50')],function(_0x2cf9d2){var _0x5e99dd={};_0x5e99dd[_0x2cf9d2]={'$like':'%'+_0x377d3b['query'][_0xc4f3('0x58')]+'%'};return _0x5e99dd;})});}_0x58c243=_[_0xc4f3('0x59')]({},_0x58c243,_0x377d3b[_0xc4f3('0x5a')]);return db[_0xc4f3('0x6f')][_0xc4f3('0x34')]({'where':_0x58c243['where']})[_0xc4f3('0x22')](function(_0x19c899){_0x270565['count']=_0x19c899;if(_0x377d3b[_0xc4f3('0x4d')]['includeAll']){_0x58c243[_0xc4f3('0x61')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc4f3('0x5d')](_0x58c243);})[_0xc4f3('0x22')](function(_0x4c65be){_0x270565['rows']=_0x4c65be;return _0x270565;});}})[_0xc4f3('0x22')](respondWithFilteredResult(_0x23c193,_0x58c243))[_0xc4f3('0x2d')](handleError(_0x23c193,null));};exports[_0xc4f3('0x71')]=function(_0x46a625,_0x5edab0,_0x1ac888){return db[_0xc4f3('0x5b')][_0xc4f3('0x62')]({'where':{'id':_0x46a625[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x5edab0,null))[_0xc4f3('0x22')](function(_0x3f091c){if(_0x3f091c){return _0x3f091c[_0xc4f3('0x71')](_0x46a625[_0xc4f3('0x4d')][_0xc4f3('0x72')]);}})['then'](respondWithStatusCode(_0x5edab0,null))[_0xc4f3('0x2d')](handleError(_0x5edab0,null));};exports[_0xc4f3('0x68')]=function(_0x229956,_0x9a5790){var _0x45d1bf={'name':_0x229956['body']['name'],'key':_0x229956[_0xc4f3('0x63')][_0xc4f3('0x49')],'email':_0x229956[_0xc4f3('0x63')]['email'],'ListId':_0x229956[_0xc4f3('0x63')][_0xc4f3('0x73')],'active':!_[_0xc4f3('0x74')](_0x229956[_0xc4f3('0x63')][_0xc4f3('0x75')])?_0x229956[_0xc4f3('0x63')][_0xc4f3('0x75')]:!![],'description':_0x229956[_0xc4f3('0x63')][_0xc4f3('0x76')]||null,'Imap':{},'Smtp':{}};if(_[_0xc4f3('0x74')](_0x229956['body'][_0xc4f3('0x77')])){if(_0x229956[_0xc4f3('0x63')]['cauthentication']){_0x45d1bf[_0xc4f3('0x60')]['user']=_0x45d1bf[_0xc4f3('0x42')]['user']=_0x229956[_0xc4f3('0x63')][_0xc4f3('0x78')];_0x45d1bf[_0xc4f3('0x60')][_0xc4f3('0x79')]=_0x45d1bf[_0xc4f3('0x42')][_0xc4f3('0x7a')]=_0x229956[_0xc4f3('0x63')]['cpassword'];}else{_0x45d1bf[_0xc4f3('0x60')][_0xc4f3('0x7b')]=_0x45d1bf[_0xc4f3('0x42')][_0xc4f3('0x7b')]=![];}_0x45d1bf[_0xc4f3('0x60')][_0xc4f3('0x7c')]=_0x229956['body'][_0xc4f3('0x60')]['host'];_0x45d1bf['Imap'][_0xc4f3('0x7d')]=_0x229956[_0xc4f3('0x63')][_0xc4f3('0x60')][_0xc4f3('0x7d')];_0x45d1bf['Smtp']['host']=_0x229956['body'][_0xc4f3('0x42')][_0xc4f3('0x7c')];_0x45d1bf[_0xc4f3('0x42')][_0xc4f3('0x7d')]=_0x229956[_0xc4f3('0x63')][_0xc4f3('0x42')][_0xc4f3('0x7d')];}else{_0x45d1bf['Imap'][_0xc4f3('0x7e')]=_0x45d1bf[_0xc4f3('0x42')][_0xc4f3('0x7e')]=_0x229956[_0xc4f3('0x63')][_0xc4f3('0x77')];_0x45d1bf[_0xc4f3('0x60')]['user']=_0x45d1bf[_0xc4f3('0x42')][_0xc4f3('0x7f')]=_0x229956['body'][_0xc4f3('0x78')];_0x45d1bf[_0xc4f3('0x60')]['password']=_0x45d1bf['Smtp'][_0xc4f3('0x7a')]=_0x229956[_0xc4f3('0x63')]['cpassword'];}return db[_0xc4f3('0x5b')][_0xc4f3('0x68')](_0x45d1bf,{'include':[{'model':db[_0xc4f3('0x41')],'as':'Smtp'},{'model':db[_0xc4f3('0x40')],'as':'Imap'}]})[_0xc4f3('0x22')](function(_0x4516d2){var _0x417016=_0x229956['user'][_0xc4f3('0x3b')]({'plain':!![]});if(!_0x417016)throw new Error(_0xc4f3('0x80'));if(_0x417016[_0xc4f3('0x81')]==='user'){var _0x29ccdc=_0x4516d2[_0xc4f3('0x3b')]({'plain':!![]});return db[_0xc4f3('0x82')]['find']({'where':{'name':_0xc4f3('0x3c'),'userProfileId':_0x417016['userProfileId']},'raw':!![]})[_0xc4f3('0x22')](function(_0xb2f4f9){if(_0xb2f4f9&&_0xb2f4f9[_0xc4f3('0x83')]===0x0){return db[_0xc4f3('0x3d')][_0xc4f3('0x68')]({'name':_0x29ccdc['name'],'resourceId':_0x29ccdc['id'],'type':_0xb2f4f9['name'],'sectionId':_0xb2f4f9['id']},{})[_0xc4f3('0x22')](function(){return _0x4516d2;});}else{return _0x4516d2;}})[_0xc4f3('0x2d')](function(_0x3cee80){logger[_0xc4f3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cee80);throw _0x3cee80;});}return _0x4516d2;})['then'](respondWithResult(_0x9a5790,0xc9))['catch'](handleError(_0x9a5790,null));};exports[_0xc4f3('0x84')]=function(_0x161b00,_0x6866b7,_0x55e876){return db[_0xc4f3('0x5b')][_0xc4f3('0x6e')]({'where':{'id':_0x161b00['params']['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x6866b7,null))[_0xc4f3('0x22')](function(_0x286749){if(_0x286749){return _0x286749['getImap']();}return null;})[_0xc4f3('0x22')](respondWithResult(_0x6866b7,null))[_0xc4f3('0x2d')](handleError(_0x6866b7,null));};exports['addImap']=function(_0x284db8,_0x2763c6,_0x33b707){if(_0x284db8[_0xc4f3('0x63')]['id']){delete _0x284db8[_0xc4f3('0x63')]['id'];}return db[_0xc4f3('0x5b')][_0xc4f3('0x62')]({'where':{'id':_0x284db8[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x2763c6,null))[_0xc4f3('0x22')](function(_0x33cb79){if(_0x33cb79){_0x284db8[_0xc4f3('0x63')]['MailAccountId']=_0x33cb79['id'];return db[_0xc4f3('0x40')]['create'](_0x284db8[_0xc4f3('0x63')]);}})[_0xc4f3('0x22')](respondWithResult(_0x2763c6,null))[_0xc4f3('0x2d')](handleError(_0x2763c6,null));};exports[_0xc4f3('0x85')]=function(_0x393b6f,_0x4e2cc7,_0x9445c){return db[_0xc4f3('0x5b')][_0xc4f3('0x6e')]({'where':{'id':_0x393b6f[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x4e2cc7,null))['then'](function(_0x5cc8cb){if(_0x5cc8cb){return _0x5cc8cb['setImap'](null);}return null;})[_0xc4f3('0x22')](respondWithStatusCode(_0x4e2cc7,null))[_0xc4f3('0x2d')](handleError(_0x4e2cc7,null));};exports['getSmtp']=function(_0x23c635,_0x2afbe2,_0x2537c6){return db['MailAccount'][_0xc4f3('0x6e')]({'where':{'id':_0x23c635[_0xc4f3('0x64')]['id']}})['then'](handleEntityNotFound(_0x2afbe2,null))[_0xc4f3('0x22')](function(_0x35e871){if(_0x35e871){return _0x35e871[_0xc4f3('0x86')]();}return null;})[_0xc4f3('0x22')](respondWithResult(_0x2afbe2,null))[_0xc4f3('0x2d')](handleError(_0x2afbe2,null));};exports[_0xc4f3('0x87')]=function(_0x5162f3,_0x16a87a,_0x44a0c7){if(_0x5162f3[_0xc4f3('0x63')]['id']){delete _0x5162f3[_0xc4f3('0x63')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5162f3[_0xc4f3('0x64')]['id']}})['then'](handleEntityNotFound(_0x16a87a,null))[_0xc4f3('0x22')](function(_0x565107){if(_0x565107){_0x5162f3['body'][_0xc4f3('0x67')]=_0x565107['id'];return db[_0xc4f3('0x41')][_0xc4f3('0x68')](_0x5162f3[_0xc4f3('0x63')]);}})[_0xc4f3('0x22')](respondWithResult(_0x16a87a,null))[_0xc4f3('0x2d')](handleError(_0x16a87a,null));};exports['removeSmtp']=function(_0x3c20fb,_0x27115b,_0x3d881f){return db[_0xc4f3('0x5b')]['findOne']({'where':{'id':_0x3c20fb[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x27115b,null))[_0xc4f3('0x22')](function(_0x6c899d){if(_0x6c899d){return _0x6c899d[_0xc4f3('0x88')](null);}return null;})[_0xc4f3('0x22')](respondWithStatusCode(_0x27115b,null))['catch'](handleError(_0x27115b,null));};exports[_0xc4f3('0x89')]=function(_0x44da46,_0x54f295,_0x3cc56e){return db[_0xc4f3('0x8a')][_0xc4f3('0x62')]({'where':{'id':_0x44da46[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x54f295,null))[_0xc4f3('0x22')](function(_0x168e64){if(_0x168e64){return _0x168e64[_0xc4f3('0x89')](_0x44da46[_0xc4f3('0x63')]['ids'],_['omit'](_0x44da46['body'],['ids','id'])||{});}})[_0xc4f3('0x22')](respondWithResult(_0x54f295,null))[_0xc4f3('0x2d')](handleError(_0x54f295,null));};exports[_0xc4f3('0x8b')]=function(_0x386c03,_0x57061f,_0x1de439){var _0x128066={'raw':![],'where':{}};var _0x18d32d={};var _0x9f545e={'count':0x0,'rows':[]};return db[_0xc4f3('0x5b')][_0xc4f3('0x6e')]({'where':{'id':_0x386c03[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x57061f,null))['then'](function(_0x3cf6ef){if(_0x3cf6ef){_0x18d32d['model']=_['keys'](db[_0xc4f3('0x8a')][_0xc4f3('0x46')]);_0x18d32d[_0xc4f3('0x4d')]=_[_0xc4f3('0x4b')](_0x386c03[_0xc4f3('0x4d')]);_0x18d32d[_0xc4f3('0x56')]=_[_0xc4f3('0x4c')](_0x18d32d[_0xc4f3('0x4e')],_0x18d32d[_0xc4f3('0x4d')]);_0x128066['attributes']=_['intersection'](_0x18d32d['model'],qs[_0xc4f3('0x4f')](_0x386c03['query'][_0xc4f3('0x4f')]));_0x128066[_0xc4f3('0x50')]=_0x128066['attributes'][_0xc4f3('0x51')]?_0x128066[_0xc4f3('0x50')]:_0x18d32d[_0xc4f3('0x4e')];if(!_0x386c03[_0xc4f3('0x4d')][_0xc4f3('0x70')](_0xc4f3('0x52'))){_0x128066[_0xc4f3('0x35')]=qs[_0xc4f3('0x35')](_0x386c03[_0xc4f3('0x4d')][_0xc4f3('0x35')]);_0x128066[_0xc4f3('0x32')]=qs[_0xc4f3('0x32')](_0x386c03[_0xc4f3('0x4d')][_0xc4f3('0x32')]);}_0x128066[_0xc4f3('0x53')]=qs[_0xc4f3('0x54')](_0x386c03[_0xc4f3('0x4d')][_0xc4f3('0x54')]);_0x128066[_0xc4f3('0x55')]=qs['filters'](_['pick'](_0x386c03[_0xc4f3('0x4d')],_0x18d32d['filters']));_0x128066[_0xc4f3('0x55')][_0xc4f3('0x67')]=_0x3cf6ef['id'];if(_0x386c03['query'][_0xc4f3('0x58')]){_0x128066[_0xc4f3('0x55')]=_[_0xc4f3('0x59')](_0x128066[_0xc4f3('0x55')],{'$or':_['map'](_0x128066[_0xc4f3('0x50')],function(_0x600135){var _0x428a36={};_0x428a36[_0x600135]={'$like':'%'+_0x386c03[_0xc4f3('0x4d')][_0xc4f3('0x58')]+'%'};return _0x428a36;})});}_0x128066=_[_0xc4f3('0x59')]({},_0x128066,_0x386c03['options']);return db[_0xc4f3('0x8a')][_0xc4f3('0x34')]({'where':_0x128066[_0xc4f3('0x55')]})[_0xc4f3('0x22')](function(_0x5ec1f8){_0x9f545e[_0xc4f3('0x34')]=_0x5ec1f8;if(_0x386c03['query'][_0xc4f3('0x5c')]){_0x128066[_0xc4f3('0x61')]=[{'model':db[_0xc4f3('0x8c')],'as':'Contact','required':![]},{'model':db[_0xc4f3('0x8d')],'as':'Owner','attributes':[_0xc4f3('0x4a'),_0xc4f3('0x8e'),_0xc4f3('0x8f')],'required':![]},{'model':db[_0xc4f3('0x90')],'as':'Tags','attributes':['id',_0xc4f3('0x4a'),_0xc4f3('0x91')],'where':_0x386c03[_0xc4f3('0x4d')][_0xc4f3('0x92')]?{'id':_0x386c03[_0xc4f3('0x4d')][_0xc4f3('0x92')]}:undefined,'required':_0x386c03[_0xc4f3('0x4d')][_0xc4f3('0x92')]?!![]:![]}];}return db['MailInteraction'][_0xc4f3('0x5d')](_0x128066);})['then'](function(_0x33bc8f){_0x9f545e[_0xc4f3('0x5e')]=_0x33bc8f;return _0x9f545e;});}})[_0xc4f3('0x22')](respondWithFilteredResult(_0x57061f,_0x128066))[_0xc4f3('0x2d')](handleError(_0x57061f,null));};exports[_0xc4f3('0x93')]=function addApplications(_0x9ddb2f,_0x3a9980){var _0x23c099=_0x9ddb2f[_0xc4f3('0x64')]['id'];var _0x469ddd=_0x9ddb2f[_0xc4f3('0x63')];var _0x18060c=0xc8;var _0x1d6201=null;return db[_0xc4f3('0x94')][_0xc4f3('0x95')]({'isolationLevel':db['sequelize'][_0xc4f3('0x96')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4e151e){return db[_0xc4f3('0x5b')]['findOne']({'where':{'id':_0x23c099},'transaction':_0x4e151e})['then'](function(_0x4f64a2){if(_0x4f64a2){return db['MailApplication'][_0xc4f3('0x3a')]({'where':{'MailAccountId':_0x23c099},'transaction':_0x4e151e})['then'](function(){var _0x456421=_[_0xc4f3('0x45')](_0x469ddd,function(_0x272e83){_0x272e83[_0xc4f3('0x67')]=_0x23c099;return _0x272e83;});return db[_0xc4f3('0x97')][_0xc4f3('0x98')](_0x456421,{'transaction':_0x4e151e});});}else{_0x18060c=0x194;_0x1d6201=[];}});})[_0xc4f3('0x22')](function(){if(_0x18060c!==0x194){return db[_0xc4f3('0x97')]['findAndCountAll']({'where':{'MailAccountId':_0x23c099},'order':_0xc4f3('0x99')})['then'](function(_0x55c660){_0x1d6201=_0x55c660;});}})['catch'](function(_0x47edf3){_0x18060c=0x1f4;logger['error'](_0x47edf3[_0xc4f3('0x3e')]);if(_0x47edf3[_0xc4f3('0x4a')]){delete _0x47edf3[_0xc4f3('0x4a')];}_0x1d6201=_0x47edf3;})[_0xc4f3('0x9a')](function(){if(_0x1d6201===null){_0x3a9980[_0xc4f3('0x2e')](_0x18060c);}else{if(_0x18060c===0x1f4){_0x3a9980['status'](_0x18060c)[_0xc4f3('0x3f')](_0x1d6201);}else{_0x3a9980['status'](_0x18060c)[_0xc4f3('0x31')](_0x1d6201);}}});};exports[_0xc4f3('0x9b')]=function(_0x4f9bd9,_0x4aacb5,_0xcdb032){var _0x4f5edd={};var _0x1f55e4={};var _0x54677b;var _0x103529;return db['MailAccount']['findOne']({'where':{'id':_0x4f9bd9['params']['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x4aacb5,null))[_0xc4f3('0x22')](function(_0x426d75){if(_0x426d75){_0x54677b=_0x426d75;_0x1f55e4[_0xc4f3('0x4e')]=_[_0xc4f3('0x4b')](db[_0xc4f3('0x97')][_0xc4f3('0x46')]);_0x1f55e4['query']=_[_0xc4f3('0x4b')](_0x4f9bd9[_0xc4f3('0x4d')]);_0x1f55e4[_0xc4f3('0x56')]=_[_0xc4f3('0x4c')](_0x1f55e4[_0xc4f3('0x4e')],_0x1f55e4[_0xc4f3('0x4d')]);_0x4f5edd[_0xc4f3('0x50')]=_[_0xc4f3('0x4c')](_0x1f55e4[_0xc4f3('0x4e')],qs[_0xc4f3('0x4f')](_0x4f9bd9[_0xc4f3('0x4d')][_0xc4f3('0x4f')]));_0x4f5edd[_0xc4f3('0x50')]=_0x4f5edd[_0xc4f3('0x50')][_0xc4f3('0x51')]?_0x4f5edd[_0xc4f3('0x50')]:_0x1f55e4[_0xc4f3('0x4e')];_0x4f5edd['order']=qs[_0xc4f3('0x54')](_0x4f9bd9[_0xc4f3('0x4d')][_0xc4f3('0x54')]);_0x4f5edd[_0xc4f3('0x55')]=qs[_0xc4f3('0x56')](_['pick'](_0x4f9bd9[_0xc4f3('0x4d')],_0x1f55e4[_0xc4f3('0x56')]));if(_0x4f9bd9[_0xc4f3('0x4d')][_0xc4f3('0x58')]){_0x4f5edd[_0xc4f3('0x55')]=_['merge'](_0x4f5edd[_0xc4f3('0x55')],{'$or':_['map'](_0x4f5edd[_0xc4f3('0x50')],function(_0x46c7d9){var _0x1a9034={};_0x1a9034[_0x46c7d9]={'$like':'%'+_0x4f9bd9[_0xc4f3('0x4d')][_0xc4f3('0x58')]+'%'};return _0x1a9034;})});}_0x4f5edd=_[_0xc4f3('0x59')]({},_0x4f5edd,_0x4f9bd9[_0xc4f3('0x5a')]);return _0x54677b[_0xc4f3('0x9b')](_0x4f5edd);}})['then'](function(_0x300db0){if(_0x300db0){_0x103529=_0x300db0[_0xc4f3('0x51')];if(!_0x4f9bd9[_0xc4f3('0x4d')]['hasOwnProperty'](_0xc4f3('0x52'))){_0x4f5edd[_0xc4f3('0x35')]=qs[_0xc4f3('0x35')](_0x4f9bd9[_0xc4f3('0x4d')][_0xc4f3('0x35')]);_0x4f5edd[_0xc4f3('0x32')]=qs['offset'](_0x4f9bd9[_0xc4f3('0x4d')][_0xc4f3('0x32')]);}return _0x54677b[_0xc4f3('0x9b')](_0x4f5edd);}})['then'](function(_0x3cbdc6){if(_0x3cbdc6){return _0x3cbdc6?{'count':_0x103529,'rows':_0x3cbdc6}:null;}})['then'](respondWithResult(_0x4aacb5,null))[_0xc4f3('0x2d')](handleError(_0x4aacb5,null));};exports[_0xc4f3('0x9c')]=function(_0x49b199,_0x12ee2e,_0x355384){var _0x91af6={'raw':!![],'where':{}};var _0x365950={};var _0x1d2e0d={'count':0x0,'rows':[]};return db[_0xc4f3('0x5b')][_0xc4f3('0x6e')]({'where':{'id':_0x49b199[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x12ee2e,null))[_0xc4f3('0x22')](function(_0x1dcf0e){if(_0x1dcf0e){_0x365950[_0xc4f3('0x4e')]=_[_0xc4f3('0x4b')](db['MailMessage'][_0xc4f3('0x46')]);_0x365950[_0xc4f3('0x4d')]=_[_0xc4f3('0x4b')](_0x49b199['query']);_0x365950[_0xc4f3('0x56')]=_[_0xc4f3('0x4c')](_0x365950['model'],_0x365950[_0xc4f3('0x4d')]);_0x91af6[_0xc4f3('0x50')]=_['intersection'](_0x365950['model'],qs[_0xc4f3('0x4f')](_0x49b199['query'][_0xc4f3('0x4f')]));_0x91af6['attributes']=_0x91af6[_0xc4f3('0x50')][_0xc4f3('0x51')]?_0x91af6['attributes']:_0x365950[_0xc4f3('0x4e')];if(!_0x49b199[_0xc4f3('0x4d')][_0xc4f3('0x70')]('nolimit')){_0x91af6[_0xc4f3('0x35')]=qs[_0xc4f3('0x35')](_0x49b199['query'][_0xc4f3('0x35')]);_0x91af6[_0xc4f3('0x32')]=qs[_0xc4f3('0x32')](_0x49b199[_0xc4f3('0x4d')]['offset']);}_0x91af6['order']=qs[_0xc4f3('0x54')](_0x49b199[_0xc4f3('0x4d')][_0xc4f3('0x54')]);_0x91af6[_0xc4f3('0x55')]=qs['filters'](_[_0xc4f3('0x57')](_0x49b199[_0xc4f3('0x4d')],_0x365950[_0xc4f3('0x56')]));_0x91af6[_0xc4f3('0x55')][_0xc4f3('0x67')]=_0x1dcf0e['id'];if(_0x49b199[_0xc4f3('0x4d')][_0xc4f3('0x58')]){_0x91af6[_0xc4f3('0x55')]=_['merge'](_0x91af6[_0xc4f3('0x55')],{'$or':_[_0xc4f3('0x45')](_0x91af6[_0xc4f3('0x50')],function(_0x1cda18){var _0x2577b8={};_0x2577b8[_0x1cda18]={'$like':'%'+_0x49b199[_0xc4f3('0x4d')][_0xc4f3('0x58')]+'%'};return _0x2577b8;})});}if(_0x49b199['query'][_0xc4f3('0x9d')]){var _0x3b88fe=_0x49b199['query'][_0xc4f3('0x9d')][_0xc4f3('0x9e')](',');var _0x5d8368={};_0x5d8368[_0x3b88fe[0x0]]={'$gte':moment(_0x3b88fe[0x1])[_0xc4f3('0x9f')](_0xc4f3('0xa0'))};_0x91af6[_0xc4f3('0x55')]=_['merge'](_0x91af6['where'],_0x5d8368);}_0x91af6=_[_0xc4f3('0x59')]({},_0x91af6,_0x49b199[_0xc4f3('0x5a')]);return db[_0xc4f3('0xa1')][_0xc4f3('0x34')]({'where':_0x91af6[_0xc4f3('0x55')]})[_0xc4f3('0x22')](function(_0x2f35fe){_0x1d2e0d[_0xc4f3('0x34')]=_0x2f35fe;if(_0x49b199[_0xc4f3('0x4d')][_0xc4f3('0x5c')]){_0x91af6[_0xc4f3('0x61')]=[{'all':!![]}];}return db['MailMessage'][_0xc4f3('0x5d')](_0x91af6);})['then'](function(_0x5c1041){if(_0x49b199[_0xc4f3('0x4d')][_0xc4f3('0xa2')]===_0xc4f3('0xa3')){for(var _0x1b558c=0x0;_0x1b558c<_0x5c1041[_0xc4f3('0x51')];_0x1b558c++){_0x5c1041[_0x1b558c][_0xc4f3('0x63')]=juice(_0x5c1041[_0x1b558c][_0xc4f3('0x63')]);}}_0x1d2e0d[_0xc4f3('0x5e')]=_0x5c1041;return _0x1d2e0d;});}})[_0xc4f3('0x22')](respondWithFilteredResult(_0x12ee2e,_0x91af6))['catch'](handleError(_0x12ee2e,null));};exports[_0xc4f3('0x3f')]=function(_0x57bab6,_0x47305c,_0x291d22){var _0x37f676,_0x16bc3f={},_0x215664;if(_0x57bab6[_0xc4f3('0x63')]['to']){_0x215664=_0x57bab6[_0xc4f3('0x63')]['to']['split'](',')[0x0];}return db[_0xc4f3('0x5b')][_0xc4f3('0x62')]({'where':{'id':_0x57bab6['params']['id']},'include':[{'model':db[_0xc4f3('0xa4')],'as':_0xc4f3('0xa5'),'include':[{'model':db[_0xc4f3('0x8c')],'as':_0xc4f3('0xa6'),'where':{'email':_0x215664},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xc4f3('0x22')](handleEntityNotFound(_0x47305c,null))[_0xc4f3('0x22')](function(_0x52efec){if(_0x52efec){_0x37f676=_0x52efec;if(_0x52efec['Smtp']){if(_['isNil'](_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xa7')])){_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xa7')]=util[_0xc4f3('0x9f')]('%s\x20<%s>',_0x52efec['name'],_0x52efec[_0xc4f3('0xa8')]||_0x52efec['Smtp'][_0xc4f3('0x7f')]);}if(_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xa9')]&&_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xa9')][_0xc4f3('0x51')]){for(var _0x45bbcb=0x0;_0x45bbcb<_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xa9')][_0xc4f3('0x51')];_0x45bbcb+=0x1){_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xa9')][_0x45bbcb]={'filename':_0x57bab6[_0xc4f3('0x63')]['attachments'][_0x45bbcb][_0xc4f3('0x4a')],'path':path[_0xc4f3('0xaa')](config[_0xc4f3('0xab')],_0xc4f3('0xac'),_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xa9')][_0x45bbcb][_0xc4f3('0xad')])};}}var _0x5e8926={'tls':{'rejectUnauthorized':![]}};if(_[_0xc4f3('0x74')](_0x52efec[_0xc4f3('0x42')]['service'])){if(_0x52efec[_0xc4f3('0x42')]['authentication']){_0x5e8926[_0xc4f3('0xae')]={'user':_0x52efec[_0xc4f3('0x42')][_0xc4f3('0x7f')],'pass':_0x52efec[_0xc4f3('0x42')]['pass']};}_0x5e8926['host']=_0x52efec[_0xc4f3('0x42')]['host'];_0x5e8926['port']=_0x52efec['Smtp'][_0xc4f3('0x7d')];_0x5e8926[_0xc4f3('0xaf')]=_0x52efec[_0xc4f3('0x42')][_0xc4f3('0xaf')];}else{_0x5e8926[_0xc4f3('0x7e')]=_0x52efec[_0xc4f3('0x42')]['service'];_0x5e8926[_0xc4f3('0xae')]={'user':_0x52efec['Smtp'][_0xc4f3('0x7f')],'pass':_0x52efec['Smtp']['pass']};}return respondWithRpcPromise(_0xc4f3('0xb0'),'sendMail',{'account':_0x5e8926,'message':_0x57bab6[_0xc4f3('0x63')]});}else{throw new Error(_0xc4f3('0xb1'));}}})[_0xc4f3('0x22')](function(_0x499a54){if(_0x499a54){_0x16bc3f=_0x499a54;if(_0x37f676[_0xc4f3('0xa5')]){if(_0x37f676[_0xc4f3('0xa5')][_0xc4f3('0xa6')]['length']){return _0x37f676[_0xc4f3('0xa5')][_0xc4f3('0xa6')][0x0];}else{return db['CmContact'][_0xc4f3('0x68')](_['defaults'](_0x57bab6[_0xc4f3('0x63')],{'firstName':_0x57bab6[_0xc4f3('0x63')]['to'],'email':_0x57bab6['body']['to'],'phone':_0x57bab6[_0xc4f3('0x63')]['to'],'ListId':_0x37f676['ListId']}));}}else{throw new Error(_0xc4f3('0xb1'));}}})['then'](function(_0x444dde){if(_0x444dde){var _0x232f05={'UserId':_0x57bab6[_0xc4f3('0x7f')]['id'],'ContactId':_0x444dde['id'],'MailAccountId':_0x37f676['id'],'inReplyTo':_0x16bc3f[_0xc4f3('0xb2')],'to':_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xa7')],'cc':_0x57bab6[_0xc4f3('0x63')]['cc'],'subject':_0x57bab6[_0xc4f3('0x63')]['subject'],'attach':_0x57bab6[_0xc4f3('0x63')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xc4f3('0x9f')](_0xc4f3('0xa0')),'lastMsgDirection':'out','Messages':[_['merge'](_0x57bab6['body'],{'messageId':_0x16bc3f[_0xc4f3('0xb2')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x37f676['id'],'UserId':_0x57bab6[_0xc4f3('0x7f')]['id'],'ContactId':_0x444dde['id']})]};if(_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xb3')]){_0x232f05=_[_0xc4f3('0x59')](_0x232f05,_0x57bab6[_0xc4f3('0x63')][_0xc4f3('0xb3')]);}return db['MailInteraction'][_0xc4f3('0x68')](_0x232f05,{'include':[{'model':db[_0xc4f3('0xa1')],'as':'Messages'}]});}})[_0xc4f3('0x22')](respondWithResult(_0x47305c,null))[_0xc4f3('0x2d')](handleError(_0x47305c,null));};exports[_0xc4f3('0xb4')]=function(_0x414930,_0x3add78,_0x545144){return db['MailAccount']['find']({'where':{'id':_0x414930[_0xc4f3('0x64')]['id']},'include':[{'model':db[_0xc4f3('0x41')],'as':_0xc4f3('0x42'),'raw':!![]}]})[_0xc4f3('0x22')](handleEntityNotFound(_0x3add78,null))[_0xc4f3('0x22')](function(_0x22f6d6){if(_0x22f6d6&&_0x22f6d6['Smtp']){var _0x2c2f25={'id':_0x22f6d6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x22f6d6['Smtp'][_0xc4f3('0x7e')]){_0x2c2f25['service']=_0x22f6d6[_0xc4f3('0x42')]['service'];}else{_0x2c2f25[_0xc4f3('0x7c')]=_0x22f6d6[_0xc4f3('0x42')]['host'];_0x2c2f25[_0xc4f3('0x7d')]=_0x22f6d6[_0xc4f3('0x42')]['port'];_0x2c2f25[_0xc4f3('0xaf')]=_0x22f6d6[_0xc4f3('0x42')]['secure'];}if(_0x22f6d6[_0xc4f3('0x42')][_0xc4f3('0x7b')]){_0x2c2f25[_0xc4f3('0xae')]={'user':_0x22f6d6[_0xc4f3('0x42')][_0xc4f3('0x7f')],'pass':_0x22f6d6[_0xc4f3('0x42')][_0xc4f3('0x7a')]};}return respondWithRpcPromise(_0xc4f3('0xb5'),_0xc4f3('0xb4'),{'account':_0x2c2f25});}})['then'](respondWithResult(_0x3add78,null))[_0xc4f3('0x2d')](handleError(_0x3add78,null));};exports[_0xc4f3('0x3a')]=function(_0x570393,_0x733384){return db[_0xc4f3('0x5b')][_0xc4f3('0x62')]({'where':{'id':_0x570393[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x733384,null))[_0xc4f3('0x22')](function(_0xbc34){if(_0xbc34&&_0xbc34[_0xc4f3('0x7e')]){throw new db['Sequelize'][(_0xc4f3('0xb6'))](_0xc4f3('0xb7'));}return _0xbc34;})['then'](removeEntity(_0x733384,null))[_0xc4f3('0x2d')](handleError(_0x733384,null));};exports[_0xc4f3('0xb8')]=function(_0x47a826,_0x57d873,_0x4d71c8){return db[_0xc4f3('0x5b')][_0xc4f3('0x62')]({'where':{'id':_0x47a826['params']['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x57d873,null))[_0xc4f3('0x22')](function(_0x247abe){if(_0x247abe){return _0x247abe[_0xc4f3('0xb8')](_0x47a826[_0xc4f3('0x63')][_0xc4f3('0x72')],_[_0xc4f3('0xb9')](_0x47a826[_0xc4f3('0x63')],[_0xc4f3('0x72'),'id'])||{})['spread'](function(_0xaf95f3){for(var _0x16f699=0x0;_0x16f699<_0x47a826['body'][_0xc4f3('0x72')][_0xc4f3('0x51')];_0x16f699+=0x1){socket['emit'](_0xc4f3('0xba'),{'UserId':Number(_0x47a826[_0xc4f3('0x63')]['ids'][_0x16f699]),'MailAccountId':Number(_0x47a826['params']['id'])});}return _0xaf95f3;});}})[_0xc4f3('0x22')](respondWithResult(_0x57d873,null))['catch'](handleError(_0x57d873,null));};exports[_0xc4f3('0xbb')]=function(_0x93b238,_0x31fb93,_0x57941f){return db[_0xc4f3('0x5b')][_0xc4f3('0x62')]({'where':{'id':_0x93b238['params']['id']}})['then'](handleEntityNotFound(_0x31fb93,null))[_0xc4f3('0x22')](function(_0x42e31e){if(_0x42e31e){return _0x42e31e['removeAgents'](_0x93b238['query'][_0xc4f3('0x72')])['then'](function(){if(_[_0xc4f3('0xbc')](_0x93b238[_0xc4f3('0x4d')][_0xc4f3('0x72')])){for(var _0x48931e=0x0;_0x48931e<_0x93b238['query'][_0xc4f3('0x72')][_0xc4f3('0x51')];_0x48931e+=0x1){socket[_0xc4f3('0xbd')](_0xc4f3('0xbe'),{'UserId':Number(_0x93b238[_0xc4f3('0x4d')][_0xc4f3('0x72')][_0x48931e]),'MailAccountId':Number(_0x93b238[_0xc4f3('0x64')]['id'])});}}else{socket[_0xc4f3('0xbd')](_0xc4f3('0xbe'),{'UserId':Number(_0x93b238[_0xc4f3('0x4d')][_0xc4f3('0x72')]),'MailAccountId':Number(_0x93b238['params']['id'])});}});}})[_0xc4f3('0x22')](respondWithStatusCode(_0x31fb93,null))[_0xc4f3('0x2d')](handleError(_0x31fb93,null));};exports[_0xc4f3('0xbf')]=function(_0x5c05fd,_0x398763,_0x22816){var _0x2accae={};var _0x19b7f0={};var _0x42d1c0;var _0x483910;return db['MailAccount'][_0xc4f3('0x6e')]({'where':{'id':_0x5c05fd[_0xc4f3('0x64')]['id']}})[_0xc4f3('0x22')](handleEntityNotFound(_0x398763,null))[_0xc4f3('0x22')](function(_0x35c36b){if(_0x35c36b){_0x42d1c0=_0x35c36b;_0x19b7f0[_0xc4f3('0x4e')]=_[_0xc4f3('0x4b')](db[_0xc4f3('0x8d')][_0xc4f3('0x46')]);_0x19b7f0[_0xc4f3('0x4d')]=_[_0xc4f3('0x4b')](_0x5c05fd[_0xc4f3('0x4d')]);_0x19b7f0[_0xc4f3('0x56')]=_[_0xc4f3('0x4c')](_0x19b7f0[_0xc4f3('0x4e')],_0x19b7f0['query']);_0x2accae[_0xc4f3('0x50')]=_[_0xc4f3('0x4c')](_0x19b7f0[_0xc4f3('0x4e')],qs['fields'](_0x5c05fd[_0xc4f3('0x4d')][_0xc4f3('0x4f')]));_0x2accae[_0xc4f3('0x50')]=_0x2accae[_0xc4f3('0x50')]['length']?_0x2accae[_0xc4f3('0x50')]:_0x19b7f0[_0xc4f3('0x4e')];_0x2accae['order']=qs[_0xc4f3('0x54')](_0x5c05fd[_0xc4f3('0x4d')][_0xc4f3('0x54')]);_0x2accae['where']=qs['filters'](_[_0xc4f3('0x57')](_0x5c05fd[_0xc4f3('0x4d')],_0x19b7f0[_0xc4f3('0x56')]));if(_0x5c05fd[_0xc4f3('0x4d')]['filter']){_0x2accae[_0xc4f3('0x55')]=_[_0xc4f3('0x59')](_0x2accae[_0xc4f3('0x55')],{'$or':_[_0xc4f3('0x45')](_0x2accae[_0xc4f3('0x50')],function(_0x46605e){var _0x1ebf01={};_0x1ebf01[_0x46605e]={'$like':'%'+_0x5c05fd[_0xc4f3('0x4d')]['filter']+'%'};return _0x1ebf01;})});}_0x2accae=_[_0xc4f3('0x59')]({},_0x2accae,_0x5c05fd[_0xc4f3('0x5a')]);return _0x42d1c0[_0xc4f3('0xbf')](_0x2accae);}})[_0xc4f3('0x22')](function(_0x47e7ac){if(_0x47e7ac){_0x483910=_0x47e7ac[_0xc4f3('0x51')];if(!_0x5c05fd['query'][_0xc4f3('0x70')](_0xc4f3('0x52'))){_0x2accae[_0xc4f3('0x35')]=qs[_0xc4f3('0x35')](_0x5c05fd['query'][_0xc4f3('0x35')]);_0x2accae['offset']=qs[_0xc4f3('0x32')](_0x5c05fd[_0xc4f3('0x4d')][_0xc4f3('0x32')]);}return _0x42d1c0[_0xc4f3('0xbf')](_0x2accae);}})[_0xc4f3('0x22')](function(_0x4994fd){if(_0x4994fd){return _0x4994fd?{'count':_0x483910,'rows':_0x4994fd}:null;}})['then'](respondWithResult(_0x398763,null))[_0xc4f3('0x2d')](handleError(_0x398763,null));}; \ No newline at end of file +var _0xf8aa=['sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','MailServerIn','MailServerOut','Smtp','body','find','describe','MailAccountId','create','findOne','Disposition','options','removeDispositions','CannedAnswer','getAnswers','order','ids','email','ListId','active','description','cservice','user','password','pass','cpassword','authentication','host','port','service','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','destroy','bulkCreate','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','format','inlineCss','split','CmList','List','Contacts','updatedAt','DESC','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','MailAccounts','stack','name','index','Imap','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1d3ece,_0x556172){var _0x2feba1=function(_0x367b61){while(--_0x367b61){_0x1d3ece['push'](_0x1d3ece['shift']());}};_0x2feba1(++_0x556172);}(_0xf8aa,0x13b));var _0xaf8a=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xf8aa[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0xaf8a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf8a('0x1'));var rp=require('request-promise');var moment=require(_0xaf8a('0x2'));var BPromise=require(_0xaf8a('0x3'));var Mustache=require(_0xaf8a('0x4'));var util=require(_0xaf8a('0x5'));var path=require(_0xaf8a('0x6'));var sox=require(_0xaf8a('0x7'));var csv=require(_0xaf8a('0x8'));var ejs=require(_0xaf8a('0x9'));var fs=require('fs');var fs_extra=require(_0xaf8a('0xa'));var _=require(_0xaf8a('0xb'));var squel=require(_0xaf8a('0xc'));var crypto=require(_0xaf8a('0xd'));var jsforce=require(_0xaf8a('0xe'));var deskjs=require(_0xaf8a('0xf'));var toCsv=require(_0xaf8a('0x8'));var querystring=require('querystring');var Papa=require(_0xaf8a('0x10'));var htmlToText=require(_0xaf8a('0x11'));var juice=require(_0xaf8a('0x12'));var Redis=require(_0xaf8a('0x13'));var authService=require(_0xaf8a('0x14'));var qs=require(_0xaf8a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf8a('0x16'));var logger=require(_0xaf8a('0x17'))(_0xaf8a('0x18'));var utils=require(_0xaf8a('0x19'));var config=require(_0xaf8a('0x1a'));var licenseUtil=require(_0xaf8a('0x1b'));var db=require(_0xaf8a('0x1c'))['db'];config[_0xaf8a('0x1d')]=_[_0xaf8a('0x1e')](config[_0xaf8a('0x1d')],{'host':_0xaf8a('0x1f'),'port':0x18eb});var socket=require(_0xaf8a('0x20'))(new Redis(config[_0xaf8a('0x1d')]));require(_0xaf8a('0x21'))[_0xaf8a('0x22')](socket);var jayson=require(_0xaf8a('0x23'));var client=jayson[_0xaf8a('0x24')][_0xaf8a('0x25')]({'port':0x232b});function respondWithRpcPromise(_0x51f661,_0xf0abde,_0x1cd656,_0x1c2667){return new BPromise(function(_0x48cd13,_0x5c8877){var _0x54d79b=_0x1c2667||client;return _0x54d79b[_0xaf8a('0x26')](_0x51f661,_0x1cd656)['then'](function(_0x5e604a){logger['info'](_0xaf8a('0x27'),_0xf0abde,_0xaf8a('0x28'));logger['debug'](_0xaf8a('0x29'),_0xf0abde,_0xaf8a('0x28'),JSON[_0xaf8a('0x2a')](_0x5e604a));if(_0x5e604a[_0xaf8a('0x2b')]){if(_0x5e604a[_0xaf8a('0x2b')]['code']===0x1f4){logger['error'](_0xaf8a('0x27'),_0xf0abde,_0x5e604a['error']['message']);return _0x5c8877(_0x5e604a[_0xaf8a('0x2b')][_0xaf8a('0x2c')]);}logger[_0xaf8a('0x2b')](_0xaf8a('0x27'),_0xf0abde,_0x5e604a[_0xaf8a('0x2b')][_0xaf8a('0x2c')]);return _0x48cd13(_0x5e604a[_0xaf8a('0x2b')][_0xaf8a('0x2c')]);}else{logger['info'](_0xaf8a('0x27'),_0xf0abde,_0xaf8a('0x28'));_0x48cd13(_0x5e604a[_0xaf8a('0x2d')][_0xaf8a('0x2c')]);}})[_0xaf8a('0x2e')](function(_0x23e56e){logger[_0xaf8a('0x2b')](_0xaf8a('0x27'),_0xf0abde,_0x23e56e);_0x5c8877(_0x23e56e);});});}function respondWithStatusCode(_0x26cf79,_0x123f1e){_0x123f1e=_0x123f1e||0xcc;return function(_0x1b74ba){if(_0x1b74ba){return _0x26cf79[_0xaf8a('0x2f')](_0x123f1e);}return _0x26cf79[_0xaf8a('0x30')](_0x123f1e)[_0xaf8a('0x31')]();};}function respondWithResult(_0xd6bc0a,_0x3bb114){_0x3bb114=_0x3bb114||0xc8;return function(_0x27bded){if(_0x27bded){return _0xd6bc0a[_0xaf8a('0x30')](_0x3bb114)[_0xaf8a('0x32')](_0x27bded);}};}function respondWithFilteredResult(_0x13168c,_0x407a55){return function(_0xfc4061){if(_0xfc4061){var _0x5e6d16=typeof _0x407a55[_0xaf8a('0x33')]===_0xaf8a('0x34')&&typeof _0x407a55[_0xaf8a('0x35')]==='undefined';var _0x3cc3e4=_0xfc4061[_0xaf8a('0x36')];var _0x3e4e99=_0x5e6d16?0x0:_0x407a55['offset'];var _0x4f1628=_0x5e6d16?_0xfc4061[_0xaf8a('0x36')]:_0x407a55['offset']+_0x407a55[_0xaf8a('0x35')];var _0x2f4d8c;if(_0x4f1628>=_0x3cc3e4){_0x4f1628=_0x3cc3e4;_0x2f4d8c=0xc8;}else{_0x2f4d8c=0xce;}_0x13168c[_0xaf8a('0x30')](_0x2f4d8c);return _0x13168c[_0xaf8a('0x37')](_0xaf8a('0x38'),_0x3e4e99+'-'+_0x4f1628+'/'+_0x3cc3e4)[_0xaf8a('0x32')](_0xfc4061);}return null;};}function patchUpdates(_0x42e398){return function(_0x1a205a){try{jsonpatch[_0xaf8a('0x39')](_0x1a205a,_0x42e398,!![]);}catch(_0x35cfb4){return BPromise[_0xaf8a('0x3a')](_0x35cfb4);}return _0x1a205a['save']();};}function saveUpdates(_0x3e335a,_0x2932eb){return function(_0x187db6){if(_0x187db6){return _0x187db6[_0xaf8a('0x3b')](_0x3e335a)[_0xaf8a('0x3c')](function(_0x11decc){return _0x11decc;});}return null;};}function removeEntity(_0x8eca7f,_0x5d500f){return function(_0x119320){if(_0x119320){return _0x119320['destroy']()[_0xaf8a('0x3c')](function(){var _0x47fb1e=_0x119320[_0xaf8a('0x3d')]({'plain':!![]});var _0x44e8f5=_0xaf8a('0x3e');return db['UserProfileResource']['destroy']({'where':{'type':_0x44e8f5,'resourceId':_0x47fb1e['id']}})[_0xaf8a('0x3c')](function(){return _0x119320;});})[_0xaf8a('0x3c')](function(){_0x8eca7f[_0xaf8a('0x30')](0xcc)[_0xaf8a('0x31')]();});}};}function handleEntityNotFound(_0xe823cc,_0x3dfa9d){return function(_0x3763fc){if(!_0x3763fc){_0xe823cc['sendStatus'](0x194);}return _0x3763fc;};}function handleError(_0x1515c2,_0x3e9b23){_0x3e9b23=_0x3e9b23||0x1f4;return function(_0x454a8e){logger['error'](_0x454a8e[_0xaf8a('0x3f')]);if(_0x454a8e[_0xaf8a('0x40')]){delete _0x454a8e[_0xaf8a('0x40')];}_0x1515c2[_0xaf8a('0x30')](_0x3e9b23)['send'](_0x454a8e);};}exports[_0xaf8a('0x41')]=function(_0x134cd9,_0x5bf84e){var _0xddeb7b={'include':[{'model':db['MailServerIn'],'as':_0xaf8a('0x42')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xaf8a('0x43')],'as':_0xaf8a('0x44')}]},_0x458e1b={},_0x348712={'count':0x0,'rows':[]};var _0x366c19=_[_0xaf8a('0x45')](db[_0xaf8a('0x46')][_0xaf8a('0x47')],function(_0x42e15b){return{'name':_0x42e15b[_0xaf8a('0x48')],'type':_0x42e15b[_0xaf8a('0x49')][_0xaf8a('0x4a')]};});_0x458e1b[_0xaf8a('0x4b')]=_[_0xaf8a('0x45')](_0x366c19,_0xaf8a('0x40'));_0x458e1b[_0xaf8a('0x4c')]=_[_0xaf8a('0x4d')](_0x134cd9[_0xaf8a('0x4c')]);_0x458e1b[_0xaf8a('0x4e')]=_[_0xaf8a('0x4f')](_0x458e1b[_0xaf8a('0x4b')],_0x458e1b['query']);_0xddeb7b[_0xaf8a('0x50')]=_[_0xaf8a('0x4f')](_0x458e1b['model'],qs[_0xaf8a('0x51')](_0x134cd9[_0xaf8a('0x4c')][_0xaf8a('0x51')]));_0xddeb7b[_0xaf8a('0x50')]=_0xddeb7b[_0xaf8a('0x50')][_0xaf8a('0x52')]?_0xddeb7b[_0xaf8a('0x50')]:_0x458e1b[_0xaf8a('0x4b')];if(!_0x134cd9[_0xaf8a('0x4c')][_0xaf8a('0x53')](_0xaf8a('0x54'))){_0xddeb7b['limit']=qs['limit'](_0x134cd9[_0xaf8a('0x4c')]['limit']);_0xddeb7b[_0xaf8a('0x33')]=qs[_0xaf8a('0x33')](_0x134cd9[_0xaf8a('0x4c')][_0xaf8a('0x33')]);}_0xddeb7b['order']=qs[_0xaf8a('0x55')](_0x134cd9[_0xaf8a('0x4c')]['sort']);_0xddeb7b[_0xaf8a('0x56')]=qs[_0xaf8a('0x4e')](_[_0xaf8a('0x57')](_0x134cd9['query'],_0x458e1b[_0xaf8a('0x4e')]),_0x366c19);if(_0x134cd9['query'][_0xaf8a('0x58')]){_0xddeb7b[_0xaf8a('0x56')]=_[_0xaf8a('0x59')](_0xddeb7b['where'],{'$or':_[_0xaf8a('0x45')](_0x366c19,function(_0xa67ac3){if(_0xa67ac3[_0xaf8a('0x49')]!==_0xaf8a('0x5a')){var _0x118d0b={};_0x118d0b[_0xa67ac3['name']]={'$like':'%'+_0x134cd9[_0xaf8a('0x4c')][_0xaf8a('0x58')]+'%'};return _0x118d0b;}})});}_0xddeb7b=_['merge']({},_0xddeb7b,_0x134cd9['options']);var _0x7b3f47={'where':_0xddeb7b[_0xaf8a('0x56')]};return db[_0xaf8a('0x46')][_0xaf8a('0x36')](_0x7b3f47)[_0xaf8a('0x3c')](function(_0x171608){_0x348712[_0xaf8a('0x36')]=_0x171608;if(_0x134cd9[_0xaf8a('0x4c')][_0xaf8a('0x5b')]){_0xddeb7b[_0xaf8a('0x5c')]=[{'all':!![]}];}return db[_0xaf8a('0x46')][_0xaf8a('0x5d')](_0xddeb7b);})[_0xaf8a('0x3c')](function(_0x1cfc40){_0x348712[_0xaf8a('0x5e')]=_0x1cfc40;return _0x348712;})[_0xaf8a('0x3c')](respondWithFilteredResult(_0x5bf84e,_0xddeb7b))[_0xaf8a('0x2e')](handleError(_0x5bf84e,null));};exports[_0xaf8a('0x5f')]=function(_0x7d9451,_0xcbf406){var _0x14bc00={'raw':![],'where':{'id':_0x7d9451[_0xaf8a('0x60')]['id']},'include':[{'model':db[_0xaf8a('0x61')],'as':_0xaf8a('0x42')},{'model':db[_0xaf8a('0x62')],'as':_0xaf8a('0x63')},{'model':db[_0xaf8a('0x43')],'as':_0xaf8a('0x44')}]},_0x4170c6={};_0x4170c6[_0xaf8a('0x4b')]=_['keys'](db['MailAccount'][_0xaf8a('0x47')]);_0x4170c6[_0xaf8a('0x4c')]=_['keys'](_0x7d9451[_0xaf8a('0x4c')]);_0x4170c6[_0xaf8a('0x4e')]=_['intersection'](_0x4170c6[_0xaf8a('0x4b')],_0x4170c6[_0xaf8a('0x4c')]);_0x14bc00['attributes']=_[_0xaf8a('0x4f')](_0x4170c6[_0xaf8a('0x4b')],qs[_0xaf8a('0x51')](_0x7d9451[_0xaf8a('0x4c')]['fields']));_0x14bc00['attributes']=_0x14bc00[_0xaf8a('0x50')]['length']?_0x14bc00['attributes']:_0x4170c6['model'];if(_0x7d9451['query']['includeAll']){_0x14bc00[_0xaf8a('0x5c')]=[{'all':!![]}];}_0x14bc00=_[_0xaf8a('0x59')]({},_0x14bc00,_0x7d9451['options']);return db[_0xaf8a('0x46')]['find'](_0x14bc00)[_0xaf8a('0x3c')](handleEntityNotFound(_0xcbf406,null))['then'](respondWithResult(_0xcbf406,null))['catch'](handleError(_0xcbf406,null));};exports[_0xaf8a('0x3b')]=function(_0x4e2de1,_0x8da4ec){if(_0x4e2de1[_0xaf8a('0x64')]['id']){delete _0x4e2de1[_0xaf8a('0x64')]['id'];}return db['MailAccount'][_0xaf8a('0x65')]({'where':{'id':_0x4e2de1[_0xaf8a('0x60')]['id']},'include':[{'model':db[_0xaf8a('0x61')],'as':_0xaf8a('0x42')},{'model':db[_0xaf8a('0x62')],'as':_0xaf8a('0x63')},{'model':db[_0xaf8a('0x43')],'as':'mandatoryDispositionPause'}]})[_0xaf8a('0x3c')](handleEntityNotFound(_0x8da4ec,null))[_0xaf8a('0x3c')](saveUpdates(_0x4e2de1['body'],null))['then'](function(_0x207ffd){if(_0x207ffd&&_0x4e2de1['body'][_0xaf8a('0x42')]){return db[_0xaf8a('0x61')]['update'](_0x4e2de1[_0xaf8a('0x64')][_0xaf8a('0x42')],{'where':{'MailAccountId':_0x207ffd['id']}})[_0xaf8a('0x3c')](function(){return _0x207ffd;});}return _0x207ffd;})[_0xaf8a('0x3c')](function(_0x1a2857){if(_0x1a2857&&_0x4e2de1[_0xaf8a('0x64')][_0xaf8a('0x63')]){return db[_0xaf8a('0x62')][_0xaf8a('0x3b')](_0x4e2de1['body'][_0xaf8a('0x63')],{'where':{'MailAccountId':_0x1a2857['id']}})[_0xaf8a('0x3c')](function(){return _0x1a2857;});}return _0x1a2857;})[_0xaf8a('0x3c')](respondWithResult(_0x8da4ec,null))[_0xaf8a('0x2e')](handleError(_0x8da4ec,null));};exports[_0xaf8a('0x66')]=function(_0x89e46b,_0x36322d){return db['MailAccount']['describe']()[_0xaf8a('0x3c')](respondWithResult(_0x36322d,null))[_0xaf8a('0x2e')](handleError(_0x36322d,null));};exports['addDisposition']=function(_0x410107,_0x1dbea9,_0x2eac64){if(_0x410107['body']['id']){delete _0x410107[_0xaf8a('0x64')]['id'];}return db[_0xaf8a('0x46')][_0xaf8a('0x65')]({'where':{'id':_0x410107[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x1dbea9,null))[_0xaf8a('0x3c')](function(_0x3dc2f4){if(_0x3dc2f4){_0x410107[_0xaf8a('0x64')][_0xaf8a('0x67')]=_0x3dc2f4['id'];return db['Disposition'][_0xaf8a('0x68')](_0x410107[_0xaf8a('0x64')]);}})['then'](respondWithResult(_0x1dbea9,null))[_0xaf8a('0x2e')](handleError(_0x1dbea9,null));};exports['getDispositions']=function(_0x2e33be,_0x4e2442,_0x371fb0){var _0x2ded5b={'raw':![],'where':{}};var _0x54affb={};var _0x3ad95a={'count':0x0,'rows':[]};return db[_0xaf8a('0x46')][_0xaf8a('0x69')]({'where':{'id':_0x2e33be['params']['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x4e2442,null))['then'](function(_0x28f580){if(_0x28f580){_0x54affb[_0xaf8a('0x4b')]=_[_0xaf8a('0x4d')](db[_0xaf8a('0x6a')][_0xaf8a('0x47')]);_0x54affb['query']=_['keys'](_0x2e33be['query']);_0x54affb[_0xaf8a('0x4e')]=_[_0xaf8a('0x4f')](_0x54affb['model'],_0x54affb[_0xaf8a('0x4c')]);_0x2ded5b['attributes']=_[_0xaf8a('0x4f')](_0x54affb[_0xaf8a('0x4b')],qs[_0xaf8a('0x51')](_0x2e33be['query'][_0xaf8a('0x51')]));_0x2ded5b[_0xaf8a('0x50')]=_0x2ded5b['attributes'][_0xaf8a('0x52')]?_0x2ded5b[_0xaf8a('0x50')]:_0x54affb[_0xaf8a('0x4b')];if(!_0x2e33be[_0xaf8a('0x4c')][_0xaf8a('0x53')](_0xaf8a('0x54'))){_0x2ded5b[_0xaf8a('0x35')]=qs['limit'](_0x2e33be[_0xaf8a('0x4c')][_0xaf8a('0x35')]);_0x2ded5b[_0xaf8a('0x33')]=qs[_0xaf8a('0x33')](_0x2e33be['query']['offset']);}_0x2ded5b['order']=qs[_0xaf8a('0x55')](_0x2e33be[_0xaf8a('0x4c')][_0xaf8a('0x55')]);_0x2ded5b[_0xaf8a('0x56')]=qs[_0xaf8a('0x4e')](_[_0xaf8a('0x57')](_0x2e33be[_0xaf8a('0x4c')],_0x54affb['filters']));_0x2ded5b[_0xaf8a('0x56')][_0xaf8a('0x67')]=_0x28f580['id'];if(_0x2e33be[_0xaf8a('0x4c')][_0xaf8a('0x58')]){_0x2ded5b['where']=_[_0xaf8a('0x59')](_0x2ded5b[_0xaf8a('0x56')],{'$or':_[_0xaf8a('0x45')](_0x2ded5b[_0xaf8a('0x50')],function(_0x291149){var _0x544d04={};_0x544d04[_0x291149]={'$like':'%'+_0x2e33be['query'][_0xaf8a('0x58')]+'%'};return _0x544d04;})});}_0x2ded5b=_[_0xaf8a('0x59')]({},_0x2ded5b,_0x2e33be[_0xaf8a('0x6b')]);return db[_0xaf8a('0x6a')][_0xaf8a('0x36')]({'where':_0x2ded5b[_0xaf8a('0x56')]})[_0xaf8a('0x3c')](function(_0x14af19){_0x3ad95a['count']=_0x14af19;if(_0x2e33be[_0xaf8a('0x4c')][_0xaf8a('0x5b')]){_0x2ded5b[_0xaf8a('0x5c')]=[{'all':!![]}];}return db[_0xaf8a('0x6a')][_0xaf8a('0x5d')](_0x2ded5b);})[_0xaf8a('0x3c')](function(_0x20f3e2){_0x3ad95a[_0xaf8a('0x5e')]=_0x20f3e2;return _0x3ad95a;});}})[_0xaf8a('0x3c')](respondWithFilteredResult(_0x4e2442,_0x2ded5b))[_0xaf8a('0x2e')](handleError(_0x4e2442,null));};exports['removeDispositions']=function(_0x314d28,_0x588281,_0x57abb2){return db['MailAccount'][_0xaf8a('0x65')]({'where':{'id':_0x314d28[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x588281,null))[_0xaf8a('0x3c')](function(_0x312547){if(_0x312547){return _0x312547[_0xaf8a('0x6c')](_0x314d28[_0xaf8a('0x4c')]['ids']);}})[_0xaf8a('0x3c')](respondWithStatusCode(_0x588281,null))[_0xaf8a('0x2e')](handleError(_0x588281,null));};exports['addAnswer']=function(_0x30dd88,_0x1b1f15,_0x13407d){if(_0x30dd88['body']['id']){delete _0x30dd88['body']['id'];}return db[_0xaf8a('0x46')]['find']({'where':{'id':_0x30dd88['params']['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x1b1f15,null))[_0xaf8a('0x3c')](function(_0x1fdd87){if(_0x1fdd87){_0x30dd88[_0xaf8a('0x64')][_0xaf8a('0x67')]=_0x1fdd87['id'];return db[_0xaf8a('0x6d')]['create'](_0x30dd88[_0xaf8a('0x64')]);}})[_0xaf8a('0x3c')](respondWithResult(_0x1b1f15,null))[_0xaf8a('0x2e')](handleError(_0x1b1f15,null));};exports[_0xaf8a('0x6e')]=function(_0x5d2e38,_0x4892df,_0x440cb1){var _0x56b48c={'raw':![],'where':{}};var _0xb6bccf={};var _0x5dce9d={'count':0x0,'rows':[]};return db['MailAccount'][_0xaf8a('0x69')]({'where':{'id':_0x5d2e38[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x4892df,null))[_0xaf8a('0x3c')](function(_0x4f6770){if(_0x4f6770){_0xb6bccf['model']=_['keys'](db[_0xaf8a('0x6d')][_0xaf8a('0x47')]);_0xb6bccf[_0xaf8a('0x4c')]=_[_0xaf8a('0x4d')](_0x5d2e38[_0xaf8a('0x4c')]);_0xb6bccf[_0xaf8a('0x4e')]=_['intersection'](_0xb6bccf[_0xaf8a('0x4b')],_0xb6bccf['query']);_0x56b48c[_0xaf8a('0x50')]=_[_0xaf8a('0x4f')](_0xb6bccf[_0xaf8a('0x4b')],qs[_0xaf8a('0x51')](_0x5d2e38[_0xaf8a('0x4c')][_0xaf8a('0x51')]));_0x56b48c[_0xaf8a('0x50')]=_0x56b48c[_0xaf8a('0x50')][_0xaf8a('0x52')]?_0x56b48c[_0xaf8a('0x50')]:_0xb6bccf[_0xaf8a('0x4b')];if(!_0x5d2e38[_0xaf8a('0x4c')]['hasOwnProperty']('nolimit')){_0x56b48c['limit']=qs[_0xaf8a('0x35')](_0x5d2e38[_0xaf8a('0x4c')]['limit']);_0x56b48c[_0xaf8a('0x33')]=qs[_0xaf8a('0x33')](_0x5d2e38[_0xaf8a('0x4c')][_0xaf8a('0x33')]);}_0x56b48c[_0xaf8a('0x6f')]=qs[_0xaf8a('0x55')](_0x5d2e38[_0xaf8a('0x4c')]['sort']);_0x56b48c[_0xaf8a('0x56')]=qs[_0xaf8a('0x4e')](_[_0xaf8a('0x57')](_0x5d2e38[_0xaf8a('0x4c')],_0xb6bccf[_0xaf8a('0x4e')]));_0x56b48c[_0xaf8a('0x56')][_0xaf8a('0x67')]=_0x4f6770['id'];if(_0x5d2e38['query'][_0xaf8a('0x58')]){_0x56b48c[_0xaf8a('0x56')]=_[_0xaf8a('0x59')](_0x56b48c[_0xaf8a('0x56')],{'$or':_[_0xaf8a('0x45')](_0x56b48c[_0xaf8a('0x50')],function(_0x1da923){var _0x5c6347={};_0x5c6347[_0x1da923]={'$like':'%'+_0x5d2e38[_0xaf8a('0x4c')][_0xaf8a('0x58')]+'%'};return _0x5c6347;})});}_0x56b48c=_[_0xaf8a('0x59')]({},_0x56b48c,_0x5d2e38[_0xaf8a('0x6b')]);return db[_0xaf8a('0x6d')]['count']({'where':_0x56b48c[_0xaf8a('0x56')]})[_0xaf8a('0x3c')](function(_0x996fb3){_0x5dce9d[_0xaf8a('0x36')]=_0x996fb3;if(_0x5d2e38[_0xaf8a('0x4c')][_0xaf8a('0x5b')]){_0x56b48c[_0xaf8a('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xaf8a('0x5d')](_0x56b48c);})[_0xaf8a('0x3c')](function(_0x55980f){_0x5dce9d[_0xaf8a('0x5e')]=_0x55980f;return _0x5dce9d;});}})[_0xaf8a('0x3c')](respondWithFilteredResult(_0x4892df,_0x56b48c))['catch'](handleError(_0x4892df,null));};exports['removeAnswers']=function(_0x3b8277,_0x5bab10,_0x359416){return db['MailAccount'][_0xaf8a('0x65')]({'where':{'id':_0x3b8277[_0xaf8a('0x60')]['id']}})['then'](handleEntityNotFound(_0x5bab10,null))['then'](function(_0x2f88d0){if(_0x2f88d0){return _0x2f88d0['removeAnswers'](_0x3b8277[_0xaf8a('0x4c')][_0xaf8a('0x70')]);}})['then'](respondWithStatusCode(_0x5bab10,null))[_0xaf8a('0x2e')](handleError(_0x5bab10,null));};exports[_0xaf8a('0x68')]=function(_0x16005e,_0x43c7fb){var _0xb998be={'name':_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x40')],'key':_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x4a')],'email':_0x16005e['body'][_0xaf8a('0x71')],'ListId':_0x16005e['body'][_0xaf8a('0x72')],'active':!_['isNil'](_0x16005e['body'][_0xaf8a('0x73')])?_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x73')]:!![],'description':_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x74')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x75')])){if(_0x16005e[_0xaf8a('0x64')]['cauthentication']){_0xb998be[_0xaf8a('0x42')][_0xaf8a('0x76')]=_0xb998be['Smtp']['user']=_0x16005e[_0xaf8a('0x64')]['cuser'];_0xb998be[_0xaf8a('0x42')][_0xaf8a('0x77')]=_0xb998be['Smtp'][_0xaf8a('0x78')]=_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x79')];}else{_0xb998be['Imap'][_0xaf8a('0x7a')]=_0xb998be[_0xaf8a('0x63')]['authentication']=![];}_0xb998be['Imap'][_0xaf8a('0x7b')]=_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x42')][_0xaf8a('0x7b')];_0xb998be[_0xaf8a('0x42')]['port']=_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x42')][_0xaf8a('0x7c')];_0xb998be['Smtp'][_0xaf8a('0x7b')]=_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x63')][_0xaf8a('0x7b')];_0xb998be[_0xaf8a('0x63')]['port']=_0x16005e['body'][_0xaf8a('0x63')]['port'];}else{_0xb998be[_0xaf8a('0x42')][_0xaf8a('0x7d')]=_0xb998be['Smtp']['service']=_0x16005e['body'][_0xaf8a('0x75')];_0xb998be['Imap'][_0xaf8a('0x76')]=_0xb998be[_0xaf8a('0x63')][_0xaf8a('0x76')]=_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x7e')];_0xb998be['Imap'][_0xaf8a('0x77')]=_0xb998be[_0xaf8a('0x63')][_0xaf8a('0x78')]=_0x16005e[_0xaf8a('0x64')][_0xaf8a('0x79')];}return db[_0xaf8a('0x46')]['create'](_0xb998be,{'include':[{'model':db[_0xaf8a('0x62')],'as':_0xaf8a('0x63')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xaf8a('0x3c')](function(_0x444d54){var _0x5e114c=_0x16005e[_0xaf8a('0x76')][_0xaf8a('0x3d')]({'plain':!![]});if(!_0x5e114c)throw new Error(_0xaf8a('0x7f'));if(_0x5e114c['role']===_0xaf8a('0x76')){var _0x503938=_0x444d54[_0xaf8a('0x3d')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xaf8a('0x3e'),'userProfileId':_0x5e114c[_0xaf8a('0x80')]},'raw':!![]})[_0xaf8a('0x3c')](function(_0xdce3be){if(_0xdce3be&&_0xdce3be['autoAssociation']===0x0){return db[_0xaf8a('0x81')][_0xaf8a('0x68')]({'name':_0x503938[_0xaf8a('0x40')],'resourceId':_0x503938['id'],'type':_0xdce3be[_0xaf8a('0x40')],'sectionId':_0xdce3be['id']},{})[_0xaf8a('0x3c')](function(){return _0x444d54;});}else{return _0x444d54;}})[_0xaf8a('0x2e')](function(_0x371fd1){logger[_0xaf8a('0x2b')](_0xaf8a('0x82'),_0x371fd1);throw _0x371fd1;});}return _0x444d54;})[_0xaf8a('0x3c')](respondWithResult(_0x43c7fb,0xc9))[_0xaf8a('0x2e')](handleError(_0x43c7fb,null));};exports[_0xaf8a('0x83')]=function(_0x10bf6c,_0x302a31,_0x264934){return db[_0xaf8a('0x46')][_0xaf8a('0x69')]({'where':{'id':_0x10bf6c[_0xaf8a('0x60')]['id']}})['then'](handleEntityNotFound(_0x302a31,null))[_0xaf8a('0x3c')](function(_0x3122c1){if(_0x3122c1){return _0x3122c1[_0xaf8a('0x83')]();}return null;})[_0xaf8a('0x3c')](respondWithResult(_0x302a31,null))['catch'](handleError(_0x302a31,null));};exports['addImap']=function(_0x258a4c,_0xaccc7e,_0x285d2c){if(_0x258a4c[_0xaf8a('0x64')]['id']){delete _0x258a4c[_0xaf8a('0x64')]['id'];}return db[_0xaf8a('0x46')]['find']({'where':{'id':_0x258a4c[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0xaccc7e,null))[_0xaf8a('0x3c')](function(_0x582b50){if(_0x582b50){_0x258a4c[_0xaf8a('0x64')][_0xaf8a('0x67')]=_0x582b50['id'];return db['MailServerIn']['create'](_0x258a4c[_0xaf8a('0x64')]);}})['then'](respondWithResult(_0xaccc7e,null))[_0xaf8a('0x2e')](handleError(_0xaccc7e,null));};exports[_0xaf8a('0x84')]=function(_0x13754c,_0x5e46d9,_0x3977d4){return db[_0xaf8a('0x46')][_0xaf8a('0x69')]({'where':{'id':_0x13754c[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x5e46d9,null))[_0xaf8a('0x3c')](function(_0x158125){if(_0x158125){return _0x158125[_0xaf8a('0x85')](null);}return null;})[_0xaf8a('0x3c')](respondWithStatusCode(_0x5e46d9,null))[_0xaf8a('0x2e')](handleError(_0x5e46d9,null));};exports[_0xaf8a('0x86')]=function(_0x435d8e,_0x3a1f70,_0x417d34){return db[_0xaf8a('0x46')][_0xaf8a('0x69')]({'where':{'id':_0x435d8e[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x3a1f70,null))[_0xaf8a('0x3c')](function(_0x7a430b){if(_0x7a430b){return _0x7a430b[_0xaf8a('0x86')]();}return null;})[_0xaf8a('0x3c')](respondWithResult(_0x3a1f70,null))['catch'](handleError(_0x3a1f70,null));};exports[_0xaf8a('0x87')]=function(_0x363067,_0x2a11e9,_0x52d5b9){if(_0x363067[_0xaf8a('0x64')]['id']){delete _0x363067[_0xaf8a('0x64')]['id'];}return db[_0xaf8a('0x46')]['find']({'where':{'id':_0x363067['params']['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x2a11e9,null))['then'](function(_0x2f8467){if(_0x2f8467){_0x363067[_0xaf8a('0x64')][_0xaf8a('0x67')]=_0x2f8467['id'];return db[_0xaf8a('0x62')][_0xaf8a('0x68')](_0x363067['body']);}})[_0xaf8a('0x3c')](respondWithResult(_0x2a11e9,null))[_0xaf8a('0x2e')](handleError(_0x2a11e9,null));};exports[_0xaf8a('0x88')]=function(_0x12a5d9,_0x332279,_0x419144){return db['MailAccount'][_0xaf8a('0x69')]({'where':{'id':_0x12a5d9[_0xaf8a('0x60')]['id']}})['then'](handleEntityNotFound(_0x332279,null))[_0xaf8a('0x3c')](function(_0x1ba67d){if(_0x1ba67d){return _0x1ba67d['setSmtp'](null);}return null;})[_0xaf8a('0x3c')](respondWithStatusCode(_0x332279,null))['catch'](handleError(_0x332279,null));};exports[_0xaf8a('0x89')]=function(_0x180b5e,_0x2001f0,_0x11870d){return db[_0xaf8a('0x8a')][_0xaf8a('0x65')]({'where':{'id':_0x180b5e[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x2001f0,null))[_0xaf8a('0x3c')](function(_0x4f059f){if(_0x4f059f){return _0x4f059f[_0xaf8a('0x89')](_0x180b5e[_0xaf8a('0x64')][_0xaf8a('0x70')],_['omit'](_0x180b5e[_0xaf8a('0x64')],['ids','id'])||{});}})[_0xaf8a('0x3c')](respondWithResult(_0x2001f0,null))[_0xaf8a('0x2e')](handleError(_0x2001f0,null));};exports[_0xaf8a('0x8b')]=function(_0xde514d,_0x4fc245,_0x216b64){var _0x1923e7={'raw':![],'where':{}};var _0x593849={};var _0x465cd2={'count':0x0,'rows':[]};return db[_0xaf8a('0x46')][_0xaf8a('0x69')]({'where':{'id':_0xde514d[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x4fc245,null))[_0xaf8a('0x3c')](function(_0x4791c8){if(_0x4791c8){_0x593849[_0xaf8a('0x4b')]=_[_0xaf8a('0x4d')](db[_0xaf8a('0x8a')][_0xaf8a('0x47')]);_0x593849[_0xaf8a('0x4c')]=_[_0xaf8a('0x4d')](_0xde514d[_0xaf8a('0x4c')]);_0x593849['filters']=_[_0xaf8a('0x4f')](_0x593849[_0xaf8a('0x4b')],_0x593849[_0xaf8a('0x4c')]);_0x1923e7[_0xaf8a('0x50')]=_[_0xaf8a('0x4f')](_0x593849[_0xaf8a('0x4b')],qs[_0xaf8a('0x51')](_0xde514d[_0xaf8a('0x4c')]['fields']));_0x1923e7[_0xaf8a('0x50')]=_0x1923e7[_0xaf8a('0x50')]['length']?_0x1923e7['attributes']:_0x593849[_0xaf8a('0x4b')];if(!_0xde514d[_0xaf8a('0x4c')][_0xaf8a('0x53')](_0xaf8a('0x54'))){_0x1923e7[_0xaf8a('0x35')]=qs['limit'](_0xde514d[_0xaf8a('0x4c')][_0xaf8a('0x35')]);_0x1923e7[_0xaf8a('0x33')]=qs['offset'](_0xde514d[_0xaf8a('0x4c')][_0xaf8a('0x33')]);}_0x1923e7[_0xaf8a('0x6f')]=qs['sort'](_0xde514d[_0xaf8a('0x4c')][_0xaf8a('0x55')]);_0x1923e7[_0xaf8a('0x56')]=qs[_0xaf8a('0x4e')](_['pick'](_0xde514d[_0xaf8a('0x4c')],_0x593849[_0xaf8a('0x4e')]));_0x1923e7[_0xaf8a('0x56')][_0xaf8a('0x67')]=_0x4791c8['id'];if(_0xde514d[_0xaf8a('0x4c')]['filter']){_0x1923e7['where']=_[_0xaf8a('0x59')](_0x1923e7[_0xaf8a('0x56')],{'$or':_[_0xaf8a('0x45')](_0x1923e7['attributes'],function(_0x352c82){var _0x2a09c0={};_0x2a09c0[_0x352c82]={'$like':'%'+_0xde514d[_0xaf8a('0x4c')][_0xaf8a('0x58')]+'%'};return _0x2a09c0;})});}_0x1923e7=_[_0xaf8a('0x59')]({},_0x1923e7,_0xde514d[_0xaf8a('0x6b')]);return db['MailInteraction'][_0xaf8a('0x36')]({'where':_0x1923e7[_0xaf8a('0x56')]})[_0xaf8a('0x3c')](function(_0x2bc085){_0x465cd2[_0xaf8a('0x36')]=_0x2bc085;if(_0xde514d[_0xaf8a('0x4c')]['includeAll']){_0x1923e7[_0xaf8a('0x5c')]=[{'model':db[_0xaf8a('0x8c')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':['name','fullname',_0xaf8a('0x8d')],'required':![]},{'model':db[_0xaf8a('0x8e')],'as':_0xaf8a('0x8f'),'attributes':['id',_0xaf8a('0x40'),_0xaf8a('0x90')],'where':_0xde514d[_0xaf8a('0x4c')][_0xaf8a('0x91')]?{'id':_0xde514d['query'][_0xaf8a('0x91')]}:undefined,'required':_0xde514d[_0xaf8a('0x4c')]['tag']?!![]:![]}];}return db['MailInteraction'][_0xaf8a('0x5d')](_0x1923e7);})['then'](function(_0x4d9d55){_0x465cd2[_0xaf8a('0x5e')]=_0x4d9d55;return _0x465cd2;});}})[_0xaf8a('0x3c')](respondWithFilteredResult(_0x4fc245,_0x1923e7))[_0xaf8a('0x2e')](handleError(_0x4fc245,null));};exports[_0xaf8a('0x92')]=function addApplications(_0x256407,_0x5b0b6a){var _0x25dce8=_0x256407[_0xaf8a('0x60')]['id'];var _0x21ec5d=_0x256407['body'];var _0x3d3464=0xc8;var _0x225f9f=null;return db[_0xaf8a('0x93')][_0xaf8a('0x94')]({'isolationLevel':db[_0xaf8a('0x93')][_0xaf8a('0x95')][_0xaf8a('0x96')]['READ_COMMITTED']},function(_0x864572){return db['MailAccount'][_0xaf8a('0x69')]({'where':{'id':_0x25dce8},'transaction':_0x864572})[_0xaf8a('0x3c')](function(_0x24818b){if(_0x24818b){return db[_0xaf8a('0x97')][_0xaf8a('0x98')]({'where':{'MailAccountId':_0x25dce8},'transaction':_0x864572})[_0xaf8a('0x3c')](function(){var _0xfe187=_[_0xaf8a('0x45')](_0x21ec5d,function(_0x5a7877){_0x5a7877[_0xaf8a('0x67')]=_0x25dce8;return _0x5a7877;});return db[_0xaf8a('0x97')][_0xaf8a('0x99')](_0xfe187,{'transaction':_0x864572});});}else{_0x3d3464=0x194;_0x225f9f=[];}});})[_0xaf8a('0x3c')](function(){if(_0x3d3464!==0x194){return db[_0xaf8a('0x97')][_0xaf8a('0x9a')]({'where':{'MailAccountId':_0x25dce8},'order':_0xaf8a('0x9b')})[_0xaf8a('0x3c')](function(_0x370ada){_0x225f9f=_0x370ada;});}})[_0xaf8a('0x2e')](function(_0x7a831e){_0x3d3464=0x1f4;logger[_0xaf8a('0x2b')](_0x7a831e[_0xaf8a('0x3f')]);if(_0x7a831e[_0xaf8a('0x40')]){delete _0x7a831e[_0xaf8a('0x40')];}_0x225f9f=_0x7a831e;})[_0xaf8a('0x9c')](function(){if(_0x225f9f===null){_0x5b0b6a[_0xaf8a('0x2f')](_0x3d3464);}else{if(_0x3d3464===0x1f4){_0x5b0b6a[_0xaf8a('0x30')](_0x3d3464)['send'](_0x225f9f);}else{_0x5b0b6a[_0xaf8a('0x30')](_0x3d3464)[_0xaf8a('0x32')](_0x225f9f);}}});};exports[_0xaf8a('0x9d')]=function(_0xf5b5e5,_0x5d2742,_0x5af880){var _0x408f1c={};var _0x2ed08f={};var _0x195f85;var _0xab4065;return db[_0xaf8a('0x46')][_0xaf8a('0x69')]({'where':{'id':_0xf5b5e5['params']['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x5d2742,null))['then'](function(_0x50562a){if(_0x50562a){_0x195f85=_0x50562a;_0x2ed08f[_0xaf8a('0x4b')]=_[_0xaf8a('0x4d')](db[_0xaf8a('0x97')][_0xaf8a('0x47')]);_0x2ed08f[_0xaf8a('0x4c')]=_[_0xaf8a('0x4d')](_0xf5b5e5[_0xaf8a('0x4c')]);_0x2ed08f['filters']=_[_0xaf8a('0x4f')](_0x2ed08f[_0xaf8a('0x4b')],_0x2ed08f[_0xaf8a('0x4c')]);_0x408f1c['attributes']=_[_0xaf8a('0x4f')](_0x2ed08f[_0xaf8a('0x4b')],qs['fields'](_0xf5b5e5['query'][_0xaf8a('0x51')]));_0x408f1c[_0xaf8a('0x50')]=_0x408f1c[_0xaf8a('0x50')][_0xaf8a('0x52')]?_0x408f1c[_0xaf8a('0x50')]:_0x2ed08f['model'];_0x408f1c[_0xaf8a('0x6f')]=qs[_0xaf8a('0x55')](_0xf5b5e5['query'][_0xaf8a('0x55')]);_0x408f1c[_0xaf8a('0x56')]=qs['filters'](_[_0xaf8a('0x57')](_0xf5b5e5['query'],_0x2ed08f[_0xaf8a('0x4e')]));if(_0xf5b5e5[_0xaf8a('0x4c')][_0xaf8a('0x58')]){_0x408f1c[_0xaf8a('0x56')]=_['merge'](_0x408f1c['where'],{'$or':_['map'](_0x408f1c['attributes'],function(_0x1ad893){var _0xbdc7de={};_0xbdc7de[_0x1ad893]={'$like':'%'+_0xf5b5e5[_0xaf8a('0x4c')][_0xaf8a('0x58')]+'%'};return _0xbdc7de;})});}_0x408f1c=_['merge']({},_0x408f1c,_0xf5b5e5[_0xaf8a('0x6b')]);return _0x195f85[_0xaf8a('0x9d')](_0x408f1c);}})[_0xaf8a('0x3c')](function(_0x253e1d){if(_0x253e1d){_0xab4065=_0x253e1d[_0xaf8a('0x52')];if(!_0xf5b5e5[_0xaf8a('0x4c')][_0xaf8a('0x53')]('nolimit')){_0x408f1c[_0xaf8a('0x35')]=qs[_0xaf8a('0x35')](_0xf5b5e5['query'][_0xaf8a('0x35')]);_0x408f1c[_0xaf8a('0x33')]=qs['offset'](_0xf5b5e5['query']['offset']);}return _0x195f85['getApplications'](_0x408f1c);}})[_0xaf8a('0x3c')](function(_0x23e82d){if(_0x23e82d){return _0x23e82d?{'count':_0xab4065,'rows':_0x23e82d}:null;}})['then'](respondWithResult(_0x5d2742,null))[_0xaf8a('0x2e')](handleError(_0x5d2742,null));};exports['getMessages']=function(_0x169af1,_0x421669,_0x54e388){var _0x20c4df={'raw':!![],'where':{}};var _0x46f46b={};var _0x404e33={'count':0x0,'rows':[]};return db[_0xaf8a('0x46')][_0xaf8a('0x69')]({'where':{'id':_0x169af1[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x421669,null))[_0xaf8a('0x3c')](function(_0x1a2c16){if(_0x1a2c16){_0x46f46b[_0xaf8a('0x4b')]=_[_0xaf8a('0x4d')](db[_0xaf8a('0x9e')][_0xaf8a('0x47')]);_0x46f46b['query']=_[_0xaf8a('0x4d')](_0x169af1[_0xaf8a('0x4c')]);_0x46f46b[_0xaf8a('0x4e')]=_['intersection'](_0x46f46b[_0xaf8a('0x4b')],_0x46f46b['query']);_0x20c4df[_0xaf8a('0x50')]=_[_0xaf8a('0x4f')](_0x46f46b[_0xaf8a('0x4b')],qs[_0xaf8a('0x51')](_0x169af1[_0xaf8a('0x4c')][_0xaf8a('0x51')]));_0x20c4df['attributes']=_0x20c4df[_0xaf8a('0x50')][_0xaf8a('0x52')]?_0x20c4df[_0xaf8a('0x50')]:_0x46f46b[_0xaf8a('0x4b')];if(!_0x169af1[_0xaf8a('0x4c')][_0xaf8a('0x53')](_0xaf8a('0x54'))){_0x20c4df[_0xaf8a('0x35')]=qs[_0xaf8a('0x35')](_0x169af1['query'][_0xaf8a('0x35')]);_0x20c4df['offset']=qs[_0xaf8a('0x33')](_0x169af1[_0xaf8a('0x4c')][_0xaf8a('0x33')]);}_0x20c4df['order']=qs[_0xaf8a('0x55')](_0x169af1[_0xaf8a('0x4c')][_0xaf8a('0x55')]);_0x20c4df[_0xaf8a('0x56')]=qs['filters'](_[_0xaf8a('0x57')](_0x169af1['query'],_0x46f46b['filters']));_0x20c4df['where'][_0xaf8a('0x67')]=_0x1a2c16['id'];if(_0x169af1[_0xaf8a('0x4c')][_0xaf8a('0x58')]){_0x20c4df['where']=_[_0xaf8a('0x59')](_0x20c4df['where'],{'$or':_[_0xaf8a('0x45')](_0x20c4df[_0xaf8a('0x50')],function(_0x10cab2){var _0x317f65={};_0x317f65[_0x10cab2]={'$like':'%'+_0x169af1[_0xaf8a('0x4c')][_0xaf8a('0x58')]+'%'};return _0x317f65;})});}if(_0x169af1[_0xaf8a('0x4c')][_0xaf8a('0x9f')]){var _0x3c2b43=_0x169af1[_0xaf8a('0x4c')]['$gte']['split'](',');var _0x156294={};_0x156294[_0x3c2b43[0x0]]={'$gte':moment(_0x3c2b43[0x1])[_0xaf8a('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x20c4df['where']=_[_0xaf8a('0x59')](_0x20c4df[_0xaf8a('0x56')],_0x156294);}_0x20c4df=_[_0xaf8a('0x59')]({},_0x20c4df,_0x169af1[_0xaf8a('0x6b')]);return db[_0xaf8a('0x9e')][_0xaf8a('0x36')]({'where':_0x20c4df['where']})[_0xaf8a('0x3c')](function(_0x5b9cd2){_0x404e33[_0xaf8a('0x36')]=_0x5b9cd2;if(_0x169af1[_0xaf8a('0x4c')]['includeAll']){_0x20c4df[_0xaf8a('0x5c')]=[{'all':!![]}];}return db[_0xaf8a('0x9e')]['findAll'](_0x20c4df);})['then'](function(_0x46f464){if(_0x169af1['query'][_0xaf8a('0xa1')]==='true'){for(var _0x5503ee=0x0;_0x5503ee<_0x46f464[_0xaf8a('0x52')];_0x5503ee++){_0x46f464[_0x5503ee][_0xaf8a('0x64')]=juice(_0x46f464[_0x5503ee][_0xaf8a('0x64')]);}}_0x404e33[_0xaf8a('0x5e')]=_0x46f464;return _0x404e33;});}})[_0xaf8a('0x3c')](respondWithFilteredResult(_0x421669,_0x20c4df))['catch'](handleError(_0x421669,null));};exports['send']=function(_0x52ba4f,_0x58b3e4,_0x5d828e){var _0x250d6c,_0x11555f={},_0x258096;if(_0x52ba4f[_0xaf8a('0x64')]['to']){_0x258096=_0x52ba4f[_0xaf8a('0x64')]['to'][_0xaf8a('0xa2')](',')[0x0];}return db[_0xaf8a('0x46')][_0xaf8a('0x65')]({'where':{'id':_0x52ba4f[_0xaf8a('0x60')]['id']},'include':[{'model':db[_0xaf8a('0xa3')],'as':_0xaf8a('0xa4'),'include':[{'model':db[_0xaf8a('0x8c')],'as':_0xaf8a('0xa5'),'where':{'email':_0x258096},'limit':0x1,'order':[[_0xaf8a('0xa6'),_0xaf8a('0xa7')]]}]},{'model':db[_0xaf8a('0x62')],'as':_0xaf8a('0x63'),'raw':!![]}]})[_0xaf8a('0x3c')](handleEntityNotFound(_0x58b3e4,null))[_0xaf8a('0x3c')](function(_0x2c5e8d){if(_0x2c5e8d){_0x250d6c=_0x2c5e8d;if(_0x2c5e8d[_0xaf8a('0x63')]){if(_[_0xaf8a('0xa8')](_0x52ba4f[_0xaf8a('0x64')][_0xaf8a('0xa9')])){_0x52ba4f[_0xaf8a('0x64')]['from']=util[_0xaf8a('0xa0')](_0xaf8a('0xaa'),_0x2c5e8d[_0xaf8a('0x40')],_0x2c5e8d[_0xaf8a('0x71')]||_0x2c5e8d[_0xaf8a('0x63')][_0xaf8a('0x76')]);}if(_0x52ba4f[_0xaf8a('0x64')][_0xaf8a('0xab')]&&_0x52ba4f[_0xaf8a('0x64')][_0xaf8a('0xab')][_0xaf8a('0x52')]){for(var _0x3bcaf6=0x0;_0x3bcaf6<_0x52ba4f[_0xaf8a('0x64')][_0xaf8a('0xab')][_0xaf8a('0x52')];_0x3bcaf6+=0x1){_0x52ba4f[_0xaf8a('0x64')][_0xaf8a('0xab')][_0x3bcaf6]={'filename':_0x52ba4f[_0xaf8a('0x64')]['attachments'][_0x3bcaf6][_0xaf8a('0x40')],'path':path[_0xaf8a('0xac')](config[_0xaf8a('0xad')],_0xaf8a('0xae'),_0x52ba4f[_0xaf8a('0x64')]['attachments'][_0x3bcaf6][_0xaf8a('0xaf')])};}}var _0x486cd3={'tls':{'rejectUnauthorized':![]}};if(_[_0xaf8a('0xa8')](_0x2c5e8d[_0xaf8a('0x63')][_0xaf8a('0x7d')])){if(_0x2c5e8d[_0xaf8a('0x63')]['authentication']){_0x486cd3[_0xaf8a('0xb0')]={'user':_0x2c5e8d[_0xaf8a('0x63')][_0xaf8a('0x76')],'pass':_0x2c5e8d[_0xaf8a('0x63')][_0xaf8a('0x78')]};}_0x486cd3['host']=_0x2c5e8d['Smtp'][_0xaf8a('0x7b')];_0x486cd3[_0xaf8a('0x7c')]=_0x2c5e8d[_0xaf8a('0x63')][_0xaf8a('0x7c')];_0x486cd3['secure']=_0x2c5e8d[_0xaf8a('0x63')][_0xaf8a('0xb1')];}else{_0x486cd3['service']=_0x2c5e8d[_0xaf8a('0x63')][_0xaf8a('0x7d')];_0x486cd3[_0xaf8a('0xb0')]={'user':_0x2c5e8d['Smtp'][_0xaf8a('0x76')],'pass':_0x2c5e8d[_0xaf8a('0x63')][_0xaf8a('0x78')]};}return respondWithRpcPromise('SendMail',_0xaf8a('0xb2'),{'account':_0x486cd3,'message':_0x52ba4f[_0xaf8a('0x64')]});}else{throw new Error(_0xaf8a('0xb3'));}}})[_0xaf8a('0x3c')](function(_0x10e448){if(_0x10e448){_0x11555f=_0x10e448;if(_0x250d6c['List']){if(_0x250d6c['List'][_0xaf8a('0xa5')][_0xaf8a('0x52')]){return _0x250d6c[_0xaf8a('0xa4')][_0xaf8a('0xa5')][0x0];}else{return db['CmContact']['create'](_[_0xaf8a('0x1e')](_0x52ba4f['body'],{'firstName':_0x52ba4f[_0xaf8a('0x64')]['to'],'email':_0x52ba4f[_0xaf8a('0x64')]['to'],'phone':_0x52ba4f['body']['to'],'ListId':_0x250d6c[_0xaf8a('0x72')]}));}}else{throw new Error(_0xaf8a('0xb3'));}}})[_0xaf8a('0x3c')](function(_0x24bfc3){if(_0x24bfc3){var _0x237234={'UserId':_0x52ba4f[_0xaf8a('0x76')]['id'],'ContactId':_0x24bfc3['id'],'MailAccountId':_0x250d6c['id'],'inReplyTo':_0x11555f[_0xaf8a('0xb4')],'to':_0x52ba4f[_0xaf8a('0x64')][_0xaf8a('0xa9')],'cc':_0x52ba4f[_0xaf8a('0x64')]['cc'],'subject':_0x52ba4f['body'][_0xaf8a('0xb5')],'attach':_0x52ba4f[_0xaf8a('0x64')][_0xaf8a('0xb6')],'firstMsgDirection':_0xaf8a('0xb7'),'lastMsgAt':moment()[_0xaf8a('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xaf8a('0xb7'),'Messages':[_[_0xaf8a('0x59')](_0x52ba4f[_0xaf8a('0x64')],{'messageId':_0x11555f[_0xaf8a('0xb4')],'sentAt':moment()[_0xaf8a('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x250d6c['id'],'UserId':_0x52ba4f[_0xaf8a('0x76')]['id'],'ContactId':_0x24bfc3['id']})]};if(_0x52ba4f[_0xaf8a('0x64')][_0xaf8a('0xb8')]){_0x237234=_[_0xaf8a('0x59')](_0x237234,_0x52ba4f[_0xaf8a('0x64')]['Interaction']);}return db['MailInteraction'][_0xaf8a('0x68')](_0x237234,{'include':[{'model':db[_0xaf8a('0x9e')],'as':_0xaf8a('0xb9')}]});}})['then'](respondWithResult(_0x58b3e4,null))['catch'](handleError(_0x58b3e4,null));};exports[_0xaf8a('0xba')]=function(_0xf69796,_0x2098dc,_0x28d7c8){return db['MailAccount'][_0xaf8a('0x65')]({'where':{'id':_0xf69796[_0xaf8a('0x60')]['id']},'include':[{'model':db[_0xaf8a('0x62')],'as':_0xaf8a('0x63'),'raw':!![]}]})['then'](handleEntityNotFound(_0x2098dc,null))[_0xaf8a('0x3c')](function(_0x2e4a00){if(_0x2e4a00&&_0x2e4a00['Smtp']){var _0x37bcc8={'id':_0x2e4a00['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e4a00[_0xaf8a('0x63')]['service']){_0x37bcc8[_0xaf8a('0x7d')]=_0x2e4a00[_0xaf8a('0x63')][_0xaf8a('0x7d')];}else{_0x37bcc8['host']=_0x2e4a00[_0xaf8a('0x63')][_0xaf8a('0x7b')];_0x37bcc8[_0xaf8a('0x7c')]=_0x2e4a00[_0xaf8a('0x63')][_0xaf8a('0x7c')];_0x37bcc8[_0xaf8a('0xb1')]=_0x2e4a00[_0xaf8a('0x63')][_0xaf8a('0xb1')];}if(_0x2e4a00[_0xaf8a('0x63')][_0xaf8a('0x7a')]){_0x37bcc8[_0xaf8a('0xb0')]={'user':_0x2e4a00[_0xaf8a('0x63')][_0xaf8a('0x76')],'pass':_0x2e4a00[_0xaf8a('0x63')][_0xaf8a('0x78')]};}return respondWithRpcPromise(_0xaf8a('0xbb'),_0xaf8a('0xba'),{'account':_0x37bcc8});}})['then'](respondWithResult(_0x2098dc,null))[_0xaf8a('0x2e')](handleError(_0x2098dc,null));};exports['destroy']=function(_0x150126,_0x3f9f7a){return db[_0xaf8a('0x46')][_0xaf8a('0x65')]({'where':{'id':_0x150126[_0xaf8a('0x60')]['id']}})['then'](handleEntityNotFound(_0x3f9f7a,null))[_0xaf8a('0x3c')](function(_0x26a773){if(_0x26a773&&_0x26a773[_0xaf8a('0x7d')]){throw new db[(_0xaf8a('0xbc'))][(_0xaf8a('0xbd'))](_0xaf8a('0xbe'));}return _0x26a773;})[_0xaf8a('0x3c')](removeEntity(_0x3f9f7a,null))[_0xaf8a('0x2e')](handleError(_0x3f9f7a,null));};exports[_0xaf8a('0xbf')]=function(_0x43abdf,_0x3dc823,_0x13edc9){return db[_0xaf8a('0x46')][_0xaf8a('0x65')]({'where':{'id':_0x43abdf[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x3dc823,null))[_0xaf8a('0x3c')](function(_0x549cd0){if(_0x549cd0){return _0x549cd0[_0xaf8a('0xbf')](_0x43abdf[_0xaf8a('0x64')][_0xaf8a('0x70')],_['omit'](_0x43abdf['body'],[_0xaf8a('0x70'),'id'])||{})[_0xaf8a('0xc0')](function(_0x7d14e5){for(var _0x4f20c0=0x0;_0x4f20c0<_0x43abdf[_0xaf8a('0x64')]['ids'][_0xaf8a('0x52')];_0x4f20c0+=0x1){socket[_0xaf8a('0xc1')](_0xaf8a('0xc2'),{'UserId':Number(_0x43abdf['body'][_0xaf8a('0x70')][_0x4f20c0]),'MailAccountId':Number(_0x43abdf['params']['id'])});}return _0x7d14e5;});}})[_0xaf8a('0x3c')](respondWithResult(_0x3dc823,null))[_0xaf8a('0x2e')](handleError(_0x3dc823,null));};exports[_0xaf8a('0xc3')]=function(_0xb2af21,_0x4b76ea,_0x55a1d2){return db['MailAccount'][_0xaf8a('0x65')]({'where':{'id':_0xb2af21[_0xaf8a('0x60')]['id']}})[_0xaf8a('0x3c')](handleEntityNotFound(_0x4b76ea,null))[_0xaf8a('0x3c')](function(_0x2bbbde){if(_0x2bbbde){return _0x2bbbde['removeAgents'](_0xb2af21[_0xaf8a('0x4c')][_0xaf8a('0x70')])['then'](function(){if(_[_0xaf8a('0xc4')](_0xb2af21['query']['ids'])){for(var _0x4a3c73=0x0;_0x4a3c73<_0xb2af21[_0xaf8a('0x4c')][_0xaf8a('0x70')][_0xaf8a('0x52')];_0x4a3c73+=0x1){socket[_0xaf8a('0xc1')](_0xaf8a('0xc5'),{'UserId':Number(_0xb2af21[_0xaf8a('0x4c')]['ids'][_0x4a3c73]),'MailAccountId':Number(_0xb2af21[_0xaf8a('0x60')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0xb2af21[_0xaf8a('0x4c')][_0xaf8a('0x70')]),'MailAccountId':Number(_0xb2af21[_0xaf8a('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x4b76ea,null))[_0xaf8a('0x2e')](handleError(_0x4b76ea,null));};exports[_0xaf8a('0xc6')]=function(_0x329a87,_0x79c6cf,_0xf2dd82){var _0x7f7385={};var _0x425c57={};var _0x5d6b14;var _0x416542;return db[_0xaf8a('0x46')][_0xaf8a('0x69')]({'where':{'id':_0x329a87['params']['id']}})['then'](handleEntityNotFound(_0x79c6cf,null))[_0xaf8a('0x3c')](function(_0x2e782c){if(_0x2e782c){_0x5d6b14=_0x2e782c;_0x425c57['model']=_[_0xaf8a('0x4d')](db[_0xaf8a('0xc7')]['rawAttributes']);_0x425c57[_0xaf8a('0x4c')]=_[_0xaf8a('0x4d')](_0x329a87[_0xaf8a('0x4c')]);_0x425c57[_0xaf8a('0x4e')]=_[_0xaf8a('0x4f')](_0x425c57[_0xaf8a('0x4b')],_0x425c57['query']);_0x7f7385['attributes']=_[_0xaf8a('0x4f')](_0x425c57['model'],qs['fields'](_0x329a87[_0xaf8a('0x4c')][_0xaf8a('0x51')]));_0x7f7385[_0xaf8a('0x50')]=_0x7f7385[_0xaf8a('0x50')][_0xaf8a('0x52')]?_0x7f7385[_0xaf8a('0x50')]:_0x425c57['model'];_0x7f7385[_0xaf8a('0x6f')]=qs[_0xaf8a('0x55')](_0x329a87[_0xaf8a('0x4c')]['sort']);_0x7f7385['where']=qs['filters'](_['pick'](_0x329a87['query'],_0x425c57[_0xaf8a('0x4e')]));if(_0x329a87[_0xaf8a('0x4c')][_0xaf8a('0x58')]){_0x7f7385['where']=_[_0xaf8a('0x59')](_0x7f7385[_0xaf8a('0x56')],{'$or':_[_0xaf8a('0x45')](_0x7f7385[_0xaf8a('0x50')],function(_0x4b6afa){var _0xa179d7={};_0xa179d7[_0x4b6afa]={'$like':'%'+_0x329a87[_0xaf8a('0x4c')]['filter']+'%'};return _0xa179d7;})});}_0x7f7385=_[_0xaf8a('0x59')]({},_0x7f7385,_0x329a87[_0xaf8a('0x6b')]);return _0x5d6b14[_0xaf8a('0xc6')](_0x7f7385);}})[_0xaf8a('0x3c')](function(_0x4a56be){if(_0x4a56be){_0x416542=_0x4a56be['length'];if(!_0x329a87[_0xaf8a('0x4c')][_0xaf8a('0x53')](_0xaf8a('0x54'))){_0x7f7385[_0xaf8a('0x35')]=qs[_0xaf8a('0x35')](_0x329a87[_0xaf8a('0x4c')][_0xaf8a('0x35')]);_0x7f7385[_0xaf8a('0x33')]=qs[_0xaf8a('0x33')](_0x329a87[_0xaf8a('0x4c')]['offset']);}return _0x5d6b14[_0xaf8a('0xc6')](_0x7f7385);}})[_0xaf8a('0x3c')](function(_0x2f606a){if(_0x2f606a){return _0x2f606a?{'count':_0x416542,'rows':_0x2f606a}:null;}})[_0xaf8a('0x3c')](respondWithResult(_0x79c6cf,null))[_0xaf8a('0x2e')](handleError(_0x79c6cf,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index df7bb8b..d502e63 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 _0xbe54=['update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x272387,_0xc20a7){var _0x174a1a=function(_0x158554){while(--_0x158554){_0x272387['push'](_0x272387['shift']());}};_0x174a1a(++_0xc20a7);}(_0xbe54,0x9e));var _0x4be5=function(_0x46c38b,_0x5b38a1){_0x46c38b=_0x46c38b-0x0;var _0x3849aa=_0xbe54[_0x46c38b];return _0x3849aa;};'use strict';var EventEmitter=require(_0x4be5('0x0'));var MailAccount=require(_0x4be5('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4be5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4be5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5933b2){return function(_0x47f992,_0x5e0437,_0x107a04){MailAccountEvents['emit'](_0x5933b2+':'+_0x47f992['id'],_0x47f992);MailAccountEvents[_0x4be5('0x4')](_0x5933b2,_0x47f992);_0x107a04(null);};}for(var e in events){if(events[_0x4be5('0x5')](e)){var event=events[e];MailAccount[_0x4be5('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x3d49=['emit','../../mysqldb','MailAccount','setMaxListeners','save','remove'];(function(_0x1e0f5f,_0x430c5f){var _0x51e29c=function(_0x1cbabe){while(--_0x1cbabe){_0x1e0f5f['push'](_0x1e0f5f['shift']());}};_0x51e29c(++_0x430c5f);}(_0x3d49,0x151));var _0x93d4=function(_0xae9024,_0x17f58e){_0xae9024=_0xae9024-0x0;var _0x23e7d3=_0x3d49[_0xae9024];return _0x23e7d3;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x93d4('0x0'))['db'][_0x93d4('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x93d4('0x2')](0x0);var events={'afterCreate':_0x93d4('0x3'),'afterUpdate':'update','afterDestroy':_0x93d4('0x4')};function emitEvent(_0x9846c2){return function(_0xa1de2e,_0x41313a,_0x20e6c7){MailAccountEvents[_0x93d4('0x5')](_0x9846c2+':'+_0xa1de2e['id'],_0xa1de2e);MailAccountEvents['emit'](_0x9846c2,_0xa1de2e);_0x20e6c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index b542424..27942e8 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 _0x63b4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','mail_accounts','util'];(function(_0x105878,_0x7eb9c6){var _0x202398=function(_0x1d3e55){while(--_0x1d3e55){_0x105878['push'](_0x105878['shift']());}};_0x202398(++_0x7eb9c6);}(_0x63b4,0xbd));var _0x463b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x63b4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x463b('0x0'));var logger=require(_0x463b('0x1'))(_0x463b('0x2'));var moment=require(_0x463b('0x3'));var BPromise=require(_0x463b('0x4'));var rp=require(_0x463b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x463b('0x6'));var config=require(_0x463b('0x7'));var attributes=require(_0x463b('0x8'));module['exports']=function(_0x593814,_0x39a5a4){return _0x593814['define']('MailAccount',attributes,{'tableName':_0x463b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96bc=['../../config/logger','api','moment','bluebird','path','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','lodash'];(function(_0x280bb5,_0x4a1aff){var _0x2b760c=function(_0x53b65a){while(--_0x53b65a){_0x280bb5['push'](_0x280bb5['shift']());}};_0x2b760c(++_0x4a1aff);}(_0x96bc,0xfc));var _0xc96b=function(_0xcb48ca,_0x540ecb){_0xcb48ca=_0xcb48ca-0x0;var _0x37be10=_0x96bc[_0xcb48ca];return _0x37be10;};'use strict';var _=require(_0xc96b('0x0'));var util=require('util');var logger=require(_0xc96b('0x1'))(_0xc96b('0x2'));var moment=require(_0xc96b('0x3'));var BPromise=require(_0xc96b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc96b('0x5'));var rimraf=require('rimraf');var config=require(_0xc96b('0x6'));var attributes=require(_0xc96b('0x7'));module[_0xc96b('0x8')]=function(_0xfdcd93,_0x413038){return _0xfdcd93[_0xc96b('0x9')](_0xc96b('0xa'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index fe5960a..7842d27 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 _0xb2ea=['attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','name','unshift','agent','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMailAccount','MailAccount','findAll','raw','where','options','attributes','limit','include','map','model','stringify','ShowMailAccount','catch','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','applications','list','orderBy','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0xb2ea,0x78));var _0xab2e=function(_0x549bf0,_0x545544){_0x549bf0=_0x549bf0-0x0;var _0x583eca=_0xb2ea[_0x549bf0];return _0x583eca;};'use strict';var _=require('lodash');var util=require(_0xab2e('0x0'));var moment=require(_0xab2e('0x1'));var BPromise=require('bluebird');var rs=require(_0xab2e('0x2'));var fs=require('fs');var Redis=require(_0xab2e('0x3'));var db=require(_0xab2e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab2e('0x5'))(_0xab2e('0x6'));var config=require('../../config/environment');var jayson=require(_0xab2e('0x7'));var client=jayson[_0xab2e('0x8')][_0xab2e('0x9')]({'port':0x232c});config['redis']=_[_0xab2e('0xa')](config[_0xab2e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xab2e('0xc'))(new Redis(config[_0xab2e('0xb')]));require(_0xab2e('0xd'))[_0xab2e('0xe')](socket);function respondWithRpcPromise(_0x4ec26e,_0x5ed449,_0x4d7058){return new BPromise(function(_0x18492f,_0x1ba7a1){return client[_0xab2e('0xf')](_0x4ec26e,_0x4d7058)[_0xab2e('0x10')](function(_0x1a53ae){logger[_0xab2e('0x11')](_0xab2e('0x12'),_0x5ed449,'request\x20sent');logger[_0xab2e('0x13')](_0xab2e('0x14'),_0x5ed449,_0xab2e('0x15'),JSON['stringify'](_0x1a53ae));if(_0x1a53ae['error']){if(_0x1a53ae[_0xab2e('0x16')][_0xab2e('0x17')]===0x1f4){logger[_0xab2e('0x16')](_0xab2e('0x12'),_0x5ed449,_0x1a53ae[_0xab2e('0x16')]['message']);return _0x1ba7a1(_0x1a53ae[_0xab2e('0x16')][_0xab2e('0x18')]);}logger[_0xab2e('0x16')](_0xab2e('0x12'),_0x5ed449,_0x1a53ae[_0xab2e('0x16')][_0xab2e('0x18')]);return _0x18492f(_0x1a53ae[_0xab2e('0x16')][_0xab2e('0x18')]);}else{logger[_0xab2e('0x11')]('MailAccount,\x20%s,\x20%s',_0x5ed449,'request\x20sent');_0x18492f(_0x1a53ae[_0xab2e('0x19')][_0xab2e('0x18')]);}})['catch'](function(_0x124da1){logger[_0xab2e('0x16')](_0xab2e('0x12'),_0x5ed449,_0x124da1);_0x1ba7a1(_0x124da1);});});}exports[_0xab2e('0x1a')]=function(_0x13b538){var _0x2f8c64=this;return new Promise(function(_0x13e87b,_0x3512df){return db[_0xab2e('0x1b')][_0xab2e('0x1c')]({'raw':_0x13b538['options']?_0x13b538['options'][_0xab2e('0x1d')]===undefined?!![]:![]:!![],'where':_0x13b538['options']?_0x13b538['options'][_0xab2e('0x1e')]||null:null,'attributes':_0x13b538['options']?_0x13b538[_0xab2e('0x1f')][_0xab2e('0x20')]||null:null,'limit':_0x13b538[_0xab2e('0x1f')]?_0x13b538[_0xab2e('0x1f')][_0xab2e('0x21')]||null:null,'include':_0x13b538[_0xab2e('0x1f')]?_0x13b538['options'][_0xab2e('0x22')]?_[_0xab2e('0x23')](_0x13b538[_0xab2e('0x1f')]['include'],function(_0x4173ce){return{'model':db[_0x4173ce[_0xab2e('0x24')]],'as':_0x4173ce['as'],'attributes':_0x4173ce[_0xab2e('0x20')],'include':_0x4173ce[_0xab2e('0x22')]?_[_0xab2e('0x23')](_0x4173ce['include'],function(_0x5c13f1){return{'model':db[_0x5c13f1['model']],'as':_0x5c13f1['as'],'attributes':_0x5c13f1[_0xab2e('0x20')],'include':_0x5c13f1[_0xab2e('0x22')]?_[_0xab2e('0x23')](_0x5c13f1[_0xab2e('0x22')],function(_0x400bcd){return{'model':db[_0x400bcd[_0xab2e('0x24')]],'as':_0x400bcd['as'],'attributes':_0x400bcd['attributes']};}):[]};}):[]};}):[]:[]})[_0xab2e('0x10')](function(_0x4202d6){logger[_0xab2e('0x11')](_0xab2e('0x1a'),_0x13b538);logger['debug'](_0xab2e('0x1a'),_0x13b538,JSON[_0xab2e('0x25')](_0x4202d6));_0x13e87b(_0x4202d6);})['catch'](function(_0x288b99){logger[_0xab2e('0x16')](_0xab2e('0x1a'),_0x288b99[_0xab2e('0x18')],_0x13b538);_0x3512df(_0x2f8c64['error'](0x1f4,_0x288b99[_0xab2e('0x18')]));});});};exports[_0xab2e('0x26')]=function(_0x29f0eb){var _0x1f6ab5=this;return new Promise(function(_0x1586a2,_0x373fd9){return db['MailAccount']['find']({'raw':_0x29f0eb[_0xab2e('0x1f')]?_0x29f0eb['options']['raw']===undefined?!![]:![]:!![],'where':_0x29f0eb[_0xab2e('0x1f')]?_0x29f0eb[_0xab2e('0x1f')][_0xab2e('0x1e')]||null:null,'attributes':_0x29f0eb['options']?_0x29f0eb[_0xab2e('0x1f')][_0xab2e('0x20')]||null:null,'include':_0x29f0eb[_0xab2e('0x1f')]?_0x29f0eb[_0xab2e('0x1f')][_0xab2e('0x22')]?_['map'](_0x29f0eb[_0xab2e('0x1f')][_0xab2e('0x22')],function(_0x23b128){return{'model':db[_0x23b128[_0xab2e('0x24')]],'as':_0x23b128['as'],'attributes':_0x23b128[_0xab2e('0x20')],'include':_0x23b128['include']?_['map'](_0x23b128[_0xab2e('0x22')],function(_0x35d4c2){return{'model':db[_0x35d4c2[_0xab2e('0x24')]],'as':_0x35d4c2['as'],'attributes':_0x35d4c2[_0xab2e('0x20')],'include':_0x35d4c2[_0xab2e('0x22')]?_['map'](_0x35d4c2[_0xab2e('0x22')],function(_0x1f084c){return{'model':db[_0x1f084c['model']],'as':_0x1f084c['as'],'attributes':_0x1f084c[_0xab2e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xab2e('0x10')](function(_0x1c40e2){logger['info'](_0xab2e('0x26'),_0x29f0eb);logger[_0xab2e('0x13')](_0xab2e('0x26'),_0x29f0eb,JSON[_0xab2e('0x25')](_0x1c40e2));_0x1586a2(_0x1c40e2);})[_0xab2e('0x27')](function(_0x49f062){logger[_0xab2e('0x16')](_0xab2e('0x26'),_0x49f062[_0xab2e('0x18')],_0x29f0eb);_0x373fd9(_0x1f6ab5['error'](0x1f4,_0x49f062['message']));});});};exports[_0xab2e('0x28')]=function(_0x5f3729){var _0x4f4e2b=this;return new Promise(function(_0x22d467,_0x46c94e){var _0x47ef69={'body':_0x5f3729[_0xab2e('0x29')],'channel':_0xab2e('0x2a')};var _0x47da8f=_[_0xab2e('0x2b')](_[_0xab2e('0x2c')](db['CmContact'][_0xab2e('0x2d')]),[_0xab2e('0x2e'),_0xab2e('0x2f'),_0xab2e('0x30'),_0xab2e('0x31')]);var _0x37fed0=![];if(_0x5f3729[_0xab2e('0x29')]['id']){delete _0x5f3729[_0xab2e('0x29')]['id'];}if(_['isNil'](_0x5f3729[_0xab2e('0x29')][_0xab2e('0x32')])){return _0x46c94e(_0x4f4e2b[_0xab2e('0x16')](0x1f4,_0xab2e('0x33')));}if(_[_0xab2e('0x34')](_0x5f3729[_0xab2e('0x29')][_0xab2e('0x29')])||_0x5f3729[_0xab2e('0x29')]['body']===''){return _0x46c94e(_0x4f4e2b['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xab2e('0x34')](_0x5f3729[_0xab2e('0x29')][_0xab2e('0x35')])){return _0x46c94e(_0x4f4e2b[_0xab2e('0x16')](0x1f4,_0xab2e('0x36')+_0x47da8f));}if(!_[_0xab2e('0x37')](_0x47da8f,_0x5f3729[_0xab2e('0x29')][_0xab2e('0x35')])){return _0x46c94e(_0x4f4e2b[_0xab2e('0x16')](0x1f4,_0xab2e('0x38')+_0x47da8f));}var _0x5c0f3f={};_0x5c0f3f[_0x5f3729[_0xab2e('0x29')][_0xab2e('0x35')]]=_0x5f3729[_0xab2e('0x29')][_0xab2e('0x32')];return db['MailAccount'][_0xab2e('0x39')]({'where':{'id':_0x5f3729[_0xab2e('0x3a')]['id']},'include':[{'model':db[_0xab2e('0x3b')],'as':_0xab2e('0x3c'),'include':[{'model':db[_0xab2e('0x3d')],'as':_0xab2e('0x3e'),'where':_0x5c0f3f,'limit':0x1,'order':[[_0xab2e('0x2f'),_0xab2e('0x3f')]]}]},{'model':db[_0xab2e('0x40')],'as':_0xab2e('0x41')},{'model':db[_0xab2e('0x42')],'as':_0xab2e('0x43')}]})[_0xab2e('0x10')](function(_0xae6e7f){if(_0xae6e7f&&_0xae6e7f[_0xab2e('0x3c')]){var _0x3796a4=_0xae6e7f['get']({'plain':!![]});_0x47ef69[_0xab2e('0x3a')]=_[_0xab2e('0x44')](_0x3796a4,[_0xab2e('0x41'),_0xab2e('0x3c')]);_0x47ef69[_0xab2e('0x45')]=_0x3796a4[_0xab2e('0x41')];_0x47ef69[_0xab2e('0x46')]=_0x3796a4[_0xab2e('0x3c')];_0x47ef69[_0xab2e('0x45')]=_[_0xab2e('0x47')](_0x47ef69[_0xab2e('0x45')],['priority'],[_0xab2e('0x48')]);if(_0x47ef69['account']&&_0x47ef69[_0xab2e('0x3a')][_0xab2e('0x49')]){_0x47ef69['applications'][_0xab2e('0x4a')]({'id':0x0,'priority':_0x47ef69['applications'][_0xab2e('0x4b')]+0x1,'app':_0xab2e('0x4c'),'appdata':_0xab2e('0x49'),'interval':_0xab2e('0x4d')});}if(_0x47ef69['account'][_0xab2e('0x41')]){delete _0x47ef69['account'][_0xab2e('0x41')];}if(_0x47ef69[_0xab2e('0x3a')]['List']){delete _0x47ef69[_0xab2e('0x3a')][_0xab2e('0x3c')];}if(_0x3796a4[_0xab2e('0x3c')]['Contacts'][_0xab2e('0x4b')]){return _0x3796a4[_0xab2e('0x3c')][_0xab2e('0x3e')][0x0];}var _0x5014ad=_[_0xab2e('0xa')](_0x5f3729['body'],{'firstName':_0x5f3729['body'][_0xab2e('0x32')],'ListId':_0x3796a4[_0xab2e('0x31')]});_0x5014ad[_0x5f3729['body'][_0xab2e('0x35')]]=_0x5f3729[_0xab2e('0x29')][_0xab2e('0x32')];return db[_0xab2e('0x3d')][_0xab2e('0x4e')](_0x5014ad);}else{throw new Error(_0xab2e('0x4f'));}})[_0xab2e('0x10')](function(_0x3de6d6){_0x47ef69[_0xab2e('0x50')]=_0x3de6d6;if(_0x3de6d6){if(!_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x51')]){_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')]['messageId']=rs[_0xab2e('0x52')]()+'\x20'+_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')]['from'];}var _0x198294={'ContactId':_0x3de6d6['id'],'MailAccountId':_0x5f3729[_0xab2e('0x3a')]['id'],'inReplyTo':_0x5f3729['body']['message'][_0xab2e('0x51')],'to':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')]['from'],'cc':_0x5f3729['body'][_0xab2e('0x18')]['cc'],'subject':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x53')],'attach':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x54')],'lastMsgAt':moment()[_0xab2e('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xab2e('0x56')][_0xab2e('0x39')]({'where':{'closed':![],'MailAccountId':_0x5f3729[_0xab2e('0x3a')]['id']},'include':[{'model':db[_0xab2e('0x57')],'as':_0xab2e('0x58'),'attributes':['messageId'],'where':{'messageId':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x59')]}}]})[_0xab2e('0x10')](function(_0x5474f6){if(_0x5474f6){return[_0x5474f6,![]];}return db[_0xab2e('0x56')]['create'](_0x198294)[_0xab2e('0x10')](function(_0x17a9a2){return[_0x17a9a2,!![]];});});}else{throw new Error(_0xab2e('0x5a'));}})[_0xab2e('0x5b')](function(_0x270b0f,_0x5c4138){if(_0x270b0f){_0x37fed0=_0x5c4138;if(!_0x5c4138){return _0x270b0f[_0xab2e('0x5c')]({'inReplyTo':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x51')],'to':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')]['from'],'cc':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')]['cc'],'subject':_0x5f3729['body'][_0xab2e('0x18')][_0xab2e('0x53')],'attach':_0x270b0f[_0xab2e('0x54')]?_0x270b0f[_0xab2e('0x54')]:_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x54')],'substatus':null,'substatusAt':moment()['format'](_0xab2e('0x5d')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x270b0f;}}})[_0xab2e('0x10')](function(_0x490744){_0x47ef69[_0xab2e('0x5e')]=_0x490744['get']({'plain':!![]});_0x47ef69['interaction'][_0xab2e('0x5f')]=_0x37fed0;return db[_0xab2e('0x57')][_0xab2e('0x4e')]({'body':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x29')],'MailAccountId':_0x5f3729[_0xab2e('0x3a')]['id'],'MailInteractionId':_0x490744['id'],'direction':'in','ContactId':_0x47ef69[_0xab2e('0x50')]['id'],'messageId':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x51')],'from':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x32')],'to':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')]['to'],'cc':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')]['cc'],'subject':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x53')],'attach':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x54')],'Attachments':_0x5f3729['body'][_0xab2e('0x18')][_0xab2e('0x60')],'originTo':_0x5f3729['body'][_0xab2e('0x18')][_0xab2e('0x61')],'originCc':_0x5f3729[_0xab2e('0x29')]['message']['originCc'],'bcc':_0x5f3729[_0xab2e('0x29')]['message']['bcc'],'ChatWebsiteId':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x62')]||null,'originChannel':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')]['originChannel']||_0xab2e('0x63'),'ChatOfflineMessageId':_0x5f3729[_0xab2e('0x29')][_0xab2e('0x18')][_0xab2e('0x64')]||null},{'include':[{'model':db[_0xab2e('0x65')],'as':_0xab2e('0x66')}]});})[_0xab2e('0x10')](function(_0x548c7f){_0x47ef69[_0xab2e('0x18')]=_0x548c7f;if(_0x47ef69[_0xab2e('0x5e')]['UserId']){return db['User'][_0xab2e('0x39')]({'attributes':['id',_0xab2e('0x67')],'where':{'id':_0x47ef69['interaction']['UserId']}})['then'](function(_0x52b906){if(_0x52b906){_0x47ef69['applications'][_0xab2e('0x68')]({'id':0x0,'priority':0x0,'app':_0xab2e('0x69'),'appdata':_0x52b906['name']+','+(_0x47ef69['account']['waitForTheAssignedAgent']||0xa),'interval':_0xab2e('0x4d')});}return respondWithRpcPromise(_0xab2e('0x6a'),_0xab2e('0x6b'),_0x47ef69);});}return respondWithRpcPromise(_0xab2e('0x6a'),'startRouting',_0x47ef69);})[_0xab2e('0x10')](function(_0x937624){_0x22d467(_0x937624);})[_0xab2e('0x27')](function(_0x5bb70c){_0x46c94e(_0x4f4e2b['error'](0x1f4,_0x5bb70c[_0xab2e('0x18')]));});});}; \ No newline at end of file +var _0x3867=['update','interaction','created','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','Attachments','UserId','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','find','ShowMailAccount','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','body','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','MailApplication','MailServerOut','get','omit','Applications','applications','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','create','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread'];(function(_0x5f06c0,_0x2637c4){var _0x323312=function(_0x2236ec){while(--_0x2236ec){_0x5f06c0['push'](_0x5f06c0['shift']());}};_0x323312(++_0x2637c4);}(_0x3867,0x14f));var _0x7386=function(_0x13cb14,_0x555607){_0x13cb14=_0x13cb14-0x0;var _0x47e515=_0x3867[_0x13cb14];return _0x47e515;};'use strict';var _=require(_0x7386('0x0'));var util=require(_0x7386('0x1'));var moment=require(_0x7386('0x2'));var BPromise=require(_0x7386('0x3'));var rs=require(_0x7386('0x4'));var fs=require('fs');var Redis=require(_0x7386('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7386('0x6'));var logger=require('../../config/logger')(_0x7386('0x7'));var config=require(_0x7386('0x8'));var jayson=require(_0x7386('0x9'));var client=jayson[_0x7386('0xa')]['http']({'port':0x232c});config[_0x7386('0xb')]=_[_0x7386('0xc')](config[_0x7386('0xb')],{'host':_0x7386('0xd'),'port':0x18eb});var socket=require(_0x7386('0xe'))(new Redis(config[_0x7386('0xb')]));require(_0x7386('0xf'))['register'](socket);function respondWithRpcPromise(_0x2afde5,_0x37e5cd,_0x31a8bb){return new BPromise(function(_0x199c06,_0x1f99da){return client['request'](_0x2afde5,_0x31a8bb)['then'](function(_0x916b77){logger[_0x7386('0x10')]('MailAccount,\x20%s,\x20%s',_0x37e5cd,_0x7386('0x11'));logger[_0x7386('0x12')](_0x7386('0x13'),_0x37e5cd,'request\x20sent',JSON[_0x7386('0x14')](_0x916b77));if(_0x916b77['error']){if(_0x916b77[_0x7386('0x15')][_0x7386('0x16')]===0x1f4){logger[_0x7386('0x15')](_0x7386('0x17'),_0x37e5cd,_0x916b77[_0x7386('0x15')][_0x7386('0x18')]);return _0x1f99da(_0x916b77[_0x7386('0x15')]['message']);}logger[_0x7386('0x15')](_0x7386('0x17'),_0x37e5cd,_0x916b77[_0x7386('0x15')][_0x7386('0x18')]);return _0x199c06(_0x916b77[_0x7386('0x15')]['message']);}else{logger[_0x7386('0x10')](_0x7386('0x17'),_0x37e5cd,_0x7386('0x11'));_0x199c06(_0x916b77[_0x7386('0x19')]['message']);}})[_0x7386('0x1a')](function(_0x19d051){logger[_0x7386('0x15')](_0x7386('0x17'),_0x37e5cd,_0x19d051);_0x1f99da(_0x19d051);});});}exports[_0x7386('0x1b')]=function(_0x528d18){var _0x3a6ed1=this;return new Promise(function(_0x18f310,_0x140b76){return db[_0x7386('0x1c')][_0x7386('0x1d')]({'raw':_0x528d18[_0x7386('0x1e')]?_0x528d18[_0x7386('0x1e')][_0x7386('0x1f')]===undefined?!![]:![]:!![],'where':_0x528d18[_0x7386('0x1e')]?_0x528d18[_0x7386('0x1e')][_0x7386('0x20')]||null:null,'attributes':_0x528d18[_0x7386('0x1e')]?_0x528d18['options'][_0x7386('0x21')]||null:null,'limit':_0x528d18[_0x7386('0x1e')]?_0x528d18[_0x7386('0x1e')][_0x7386('0x22')]||null:null,'include':_0x528d18[_0x7386('0x1e')]?_0x528d18[_0x7386('0x1e')]['include']?_[_0x7386('0x23')](_0x528d18['options'][_0x7386('0x24')],function(_0xf5164a){return{'model':db[_0xf5164a['model']],'as':_0xf5164a['as'],'attributes':_0xf5164a['attributes'],'include':_0xf5164a[_0x7386('0x24')]?_[_0x7386('0x23')](_0xf5164a[_0x7386('0x24')],function(_0x1a3593){return{'model':db[_0x1a3593[_0x7386('0x25')]],'as':_0x1a3593['as'],'attributes':_0x1a3593['attributes'],'include':_0x1a3593[_0x7386('0x24')]?_[_0x7386('0x23')](_0x1a3593[_0x7386('0x24')],function(_0x146828){return{'model':db[_0x146828['model']],'as':_0x146828['as'],'attributes':_0x146828[_0x7386('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7386('0x26')](function(_0x8d5e03){logger[_0x7386('0x10')](_0x7386('0x1b'),_0x528d18);logger[_0x7386('0x12')]('GetMailAccount',_0x528d18,JSON[_0x7386('0x14')](_0x8d5e03));_0x18f310(_0x8d5e03);})[_0x7386('0x1a')](function(_0x1f2ffe){logger[_0x7386('0x15')](_0x7386('0x1b'),_0x1f2ffe[_0x7386('0x18')],_0x528d18);_0x140b76(_0x3a6ed1['error'](0x1f4,_0x1f2ffe[_0x7386('0x18')]));});});};exports['ShowMailAccount']=function(_0x3ac50c){var _0x578d56=this;return new Promise(function(_0x36aa6f,_0xf38b13){return db['MailAccount'][_0x7386('0x27')]({'raw':_0x3ac50c['options']?_0x3ac50c[_0x7386('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3ac50c[_0x7386('0x1e')]?_0x3ac50c[_0x7386('0x1e')][_0x7386('0x20')]||null:null,'attributes':_0x3ac50c[_0x7386('0x1e')]?_0x3ac50c[_0x7386('0x1e')]['attributes']||null:null,'include':_0x3ac50c[_0x7386('0x1e')]?_0x3ac50c[_0x7386('0x1e')][_0x7386('0x24')]?_['map'](_0x3ac50c[_0x7386('0x1e')][_0x7386('0x24')],function(_0x3d0158){return{'model':db[_0x3d0158['model']],'as':_0x3d0158['as'],'attributes':_0x3d0158['attributes'],'include':_0x3d0158[_0x7386('0x24')]?_['map'](_0x3d0158['include'],function(_0x4070b8){return{'model':db[_0x4070b8[_0x7386('0x25')]],'as':_0x4070b8['as'],'attributes':_0x4070b8[_0x7386('0x21')],'include':_0x4070b8['include']?_[_0x7386('0x23')](_0x4070b8[_0x7386('0x24')],function(_0x1905ac){return{'model':db[_0x1905ac[_0x7386('0x25')]],'as':_0x1905ac['as'],'attributes':_0x1905ac[_0x7386('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7386('0x26')](function(_0x149fbe){logger['info'](_0x7386('0x28'),_0x3ac50c);logger['debug'](_0x7386('0x28'),_0x3ac50c,JSON[_0x7386('0x14')](_0x149fbe));_0x36aa6f(_0x149fbe);})[_0x7386('0x1a')](function(_0x459b50){logger[_0x7386('0x15')]('ShowMailAccount',_0x459b50[_0x7386('0x18')],_0x3ac50c);_0xf38b13(_0x578d56['error'](0x1f4,_0x459b50[_0x7386('0x18')]));});});};exports['NotifyMailAccount']=function(_0x413bbd){var _0x374455=this;return new Promise(function(_0x194d12,_0x196436){var _0x5cefab={'body':_0x413bbd['body'],'channel':_0x7386('0x29')};var _0x2d2c86=_[_0x7386('0x2a')](_[_0x7386('0x2b')](db[_0x7386('0x2c')]['rawAttributes']),[_0x7386('0x2d'),_0x7386('0x2e'),_0x7386('0x2f'),_0x7386('0x30')]);var _0x2ebd73=![];if(_0x413bbd[_0x7386('0x31')]['id']){delete _0x413bbd[_0x7386('0x31')]['id'];}if(_['isNil'](_0x413bbd[_0x7386('0x31')][_0x7386('0x32')])){return _0x196436(_0x374455['error'](0x1f4,_0x7386('0x33')));}if(_['isNil'](_0x413bbd[_0x7386('0x31')]['body'])||_0x413bbd[_0x7386('0x31')][_0x7386('0x31')]===''){return _0x196436(_0x374455[_0x7386('0x15')](0x1f4,_0x7386('0x34')));}if(_[_0x7386('0x35')](_0x413bbd['body'][_0x7386('0x36')])){return _0x196436(_0x374455['error'](0x1f4,_0x7386('0x37')+_0x2d2c86));}if(!_[_0x7386('0x38')](_0x2d2c86,_0x413bbd[_0x7386('0x31')]['mapKey'])){return _0x196436(_0x374455['error'](0x1f4,_0x7386('0x39')+_0x2d2c86));}var _0x2ea885={};_0x2ea885[_0x413bbd[_0x7386('0x31')]['mapKey']]=_0x413bbd[_0x7386('0x31')][_0x7386('0x32')];return db[_0x7386('0x1c')][_0x7386('0x27')]({'where':{'id':_0x413bbd[_0x7386('0x3a')]['id']},'include':[{'model':db[_0x7386('0x3b')],'as':_0x7386('0x3c'),'include':[{'model':db[_0x7386('0x2c')],'as':_0x7386('0x3d'),'where':_0x2ea885,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x7386('0x3e')],'as':'Applications'},{'model':db[_0x7386('0x3f')],'as':'Smtp'}]})[_0x7386('0x26')](function(_0x241565){if(_0x241565&&_0x241565['List']){var _0x16d08a=_0x241565[_0x7386('0x40')]({'plain':!![]});_0x5cefab[_0x7386('0x3a')]=_[_0x7386('0x41')](_0x16d08a,[_0x7386('0x42'),'List']);_0x5cefab['applications']=_0x16d08a[_0x7386('0x42')];_0x5cefab['list']=_0x16d08a['List'];_0x5cefab[_0x7386('0x43')]=_[_0x7386('0x44')](_0x5cefab['applications'],[_0x7386('0x45')],[_0x7386('0x46')]);if(_0x5cefab[_0x7386('0x3a')]&&_0x5cefab[_0x7386('0x3a')]['autoclose']){_0x5cefab[_0x7386('0x43')][_0x7386('0x47')]({'id':0x0,'priority':_0x5cefab[_0x7386('0x43')][_0x7386('0x48')]+0x1,'app':_0x7386('0x49'),'appdata':_0x7386('0x4a'),'interval':_0x7386('0x4b')});}if(_0x5cefab['account'][_0x7386('0x42')]){delete _0x5cefab[_0x7386('0x3a')][_0x7386('0x42')];}if(_0x5cefab['account'][_0x7386('0x3c')]){delete _0x5cefab[_0x7386('0x3a')][_0x7386('0x3c')];}if(_0x16d08a[_0x7386('0x3c')]['Contacts']['length']){return _0x16d08a[_0x7386('0x3c')][_0x7386('0x3d')][0x0];}var _0x1a5721=_[_0x7386('0xc')](_0x413bbd[_0x7386('0x31')],{'firstName':_0x413bbd['body'][_0x7386('0x32')],'ListId':_0x16d08a['ListId']});_0x1a5721[_0x413bbd[_0x7386('0x31')][_0x7386('0x36')]]=_0x413bbd[_0x7386('0x31')]['from'];return db[_0x7386('0x2c')][_0x7386('0x4c')](_0x1a5721);}else{throw new Error('List\x20not\x20found');}})[_0x7386('0x26')](function(_0x26f57e){_0x5cefab[_0x7386('0x4d')]=_0x26f57e;if(_0x26f57e){if(!_0x413bbd['body'][_0x7386('0x18')]['messageId']){_0x413bbd[_0x7386('0x31')]['message'][_0x7386('0x4e')]=rs[_0x7386('0x4f')]()+'\x20'+_0x413bbd['body'][_0x7386('0x18')][_0x7386('0x32')];}var _0x3e20c9={'ContactId':_0x26f57e['id'],'MailAccountId':_0x413bbd[_0x7386('0x3a')]['id'],'inReplyTo':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x4e')],'to':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')]['from'],'cc':_0x413bbd['body']['message']['cc'],'subject':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x50')],'attach':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x51')],'lastMsgAt':moment()[_0x7386('0x52')](_0x7386('0x53')),'lastMsgDirection':'in'};return db[_0x7386('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x413bbd[_0x7386('0x3a')]['id']},'include':[{'model':db[_0x7386('0x55')],'as':_0x7386('0x56'),'attributes':[_0x7386('0x4e')],'where':{'messageId':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x57')]}}]})[_0x7386('0x26')](function(_0x2d094c){if(_0x2d094c){return[_0x2d094c,![]];}return db[_0x7386('0x54')][_0x7386('0x4c')](_0x3e20c9)['then'](function(_0x1880ac){return[_0x1880ac,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7386('0x58')](function(_0x48b0c9,_0x5eacd9){if(_0x48b0c9){_0x2ebd73=_0x5eacd9;if(!_0x5eacd9){return _0x48b0c9[_0x7386('0x59')]({'inReplyTo':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x4e')],'to':_0x413bbd['body'][_0x7386('0x18')][_0x7386('0x32')],'cc':_0x413bbd[_0x7386('0x31')]['message']['cc'],'subject':_0x413bbd['body'][_0x7386('0x18')][_0x7386('0x50')],'attach':_0x48b0c9['attach']?_0x48b0c9['attach']:_0x413bbd['body'][_0x7386('0x18')][_0x7386('0x51')],'substatus':null,'substatusAt':moment()[_0x7386('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x7386('0x52')](_0x7386('0x53')),'lastMsgDirection':'in'});}else{return _0x48b0c9;}}})['then'](function(_0xcb9f69){_0x5cefab[_0x7386('0x5a')]=_0xcb9f69[_0x7386('0x40')]({'plain':!![]});_0x5cefab['interaction'][_0x7386('0x5b')]=_0x2ebd73;return db['MailMessage'][_0x7386('0x4c')]({'body':_0x413bbd[_0x7386('0x31')][_0x7386('0x31')],'MailAccountId':_0x413bbd[_0x7386('0x3a')]['id'],'MailInteractionId':_0xcb9f69['id'],'direction':'in','ContactId':_0x5cefab[_0x7386('0x4d')]['id'],'messageId':_0x413bbd['body']['message'][_0x7386('0x4e')],'from':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x32')],'to':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')]['to'],'cc':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')]['cc'],'subject':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')]['subject'],'attach':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x51')],'Attachments':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x5c')],'originTo':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x5d')],'originCc':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x5e')],'bcc':_0x413bbd['body'][_0x7386('0x18')][_0x7386('0x5f')],'ChatWebsiteId':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')]['ChatWebsiteId']||null,'originChannel':_0x413bbd[_0x7386('0x31')][_0x7386('0x18')][_0x7386('0x60')]||_0x7386('0x61'),'ChatOfflineMessageId':_0x413bbd['body'][_0x7386('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x7386('0x62')],'as':_0x7386('0x63')}]});})[_0x7386('0x26')](function(_0x1443ec){_0x5cefab[_0x7386('0x18')]=_0x1443ec;if(_0x5cefab[_0x7386('0x5a')][_0x7386('0x64')]){return db['User'][_0x7386('0x27')]({'attributes':['id',_0x7386('0x65')],'where':{'id':_0x5cefab[_0x7386('0x5a')]['UserId']}})[_0x7386('0x26')](function(_0x1e164e){if(_0x1e164e){_0x5cefab[_0x7386('0x43')][_0x7386('0x66')]({'id':0x0,'priority':0x0,'app':_0x7386('0x67'),'appdata':_0x1e164e[_0x7386('0x65')]+','+(_0x5cefab['account']['waitForTheAssignedAgent']||0xa),'interval':_0x7386('0x4b')});}return respondWithRpcPromise(_0x7386('0x68'),'startRouting',_0x5cefab);});}return respondWithRpcPromise('Start',_0x7386('0x69'),_0x5cefab);})[_0x7386('0x26')](function(_0x16408c){_0x194d12(_0x16408c);})['catch'](function(_0x39e893){_0x196436(_0x374455[_0x7386('0x15')](0x1f4,_0x39e893[_0x7386('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 47aae59..7fea16f 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 _0x6a4b=['update','emit','register','length','mailAccount:','save'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6a4b,0x9b));var _0xb6a4=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x6a4b[_0x2b9b7f];return _0x4ed19a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xb6a4('0x0'),'remove',_0xb6a4('0x1')];function createListener(_0xf0198c,_0x99a15f){return function(_0x4f9182){_0x99a15f[_0xb6a4('0x2')](_0xf0198c,_0x4f9182);};}function removeListener(_0x1f3904,_0x3eab22){return function(){MailAccountEvents['removeListener'](_0x1f3904,_0x3eab22);};}exports[_0xb6a4('0x3')]=function(_0xb8bbd2){for(var _0xfa902b=0x0,_0x27ed35=events[_0xb6a4('0x4')];_0xfa902b<_0x27ed35;_0xfa902b++){var _0x231be8=events[_0xfa902b];var _0x46044f=createListener(_0xb6a4('0x5')+_0x231be8,_0xb8bbd2);MailAccountEvents['on'](_0x231be8,_0x46044f);}}; \ No newline at end of file +var _0xc4be=['register','length','./mailAccount.events','remove','update','emit','removeListener'];(function(_0x4f6683,_0x4b9f35){var _0x380b43=function(_0x2d4a96){while(--_0x2d4a96){_0x4f6683['push'](_0x4f6683['shift']());}};_0x380b43(++_0x4b9f35);}(_0xc4be,0x1bb));var _0xec4b=function(_0x36133f,_0x20d328){_0x36133f=_0x36133f-0x0;var _0x37295d=_0xc4be[_0x36133f];return _0x37295d;};'use strict';var MailAccountEvents=require(_0xec4b('0x0'));var events=['save',_0xec4b('0x1'),_0xec4b('0x2')];function createListener(_0x2d67f3,_0x4a1cab){return function(_0x4b7f15){_0x4a1cab[_0xec4b('0x3')](_0x2d67f3,_0x4b7f15);};}function removeListener(_0x1be41a,_0x45bbcb){return function(){MailAccountEvents[_0xec4b('0x4')](_0x1be41a,_0x45bbcb);};}exports[_0xec4b('0x5')]=function(_0x47f83d){for(var _0x5987c9=0x0,_0x36d465=events[_0xec4b('0x6')];_0x5987c9<_0x36d465;_0x5987c9++){var _0x313794=events[_0x5987c9];var _0x57059c=createListener('mailAccount:'+_0x313794,_0x47f83d);MailAccountEvents['on'](_0x313794,_0x57059c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 12173b1..bd00747 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 _0x05e8=['../../config/environment','get','isAuthenticated','put','/:id','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc3050a,_0x3f50b5){var _0x433e7a=function(_0x1fd962){while(--_0x1fd962){_0xc3050a['push'](_0xc3050a['shift']());}};_0x433e7a(++_0x3f50b5);}(_0x05e8,0x14a));var _0x805e=function(_0x5b18c8,_0x5b12c4){_0x5b18c8=_0x5b18c8-0x0;var _0x15da37=_0x05e8[_0x5b18c8];return _0x15da37;};'use strict';var multer=require('multer');var util=require(_0x805e('0x0'));var path=require(_0x805e('0x1'));var timeout=require('connect-timeout');var express=require(_0x805e('0x2'));var router=express[_0x805e('0x3')]();var fs_extra=require(_0x805e('0x4'));var auth=require(_0x805e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x805e('0x6'));var controller=require('./mailApplication.controller');router[_0x805e('0x7')]('/:id',auth[_0x805e('0x8')](),controller['show']);router[_0x805e('0x9')](_0x805e('0xa'),auth[_0x805e('0x8')](),controller[_0x805e('0xb')]);router['delete'](_0x805e('0xa'),auth[_0x805e('0x8')](),controller[_0x805e('0xc')]);module[_0x805e('0xd')]=router; \ No newline at end of file +var _0x8912=['express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','put','isAuthenticated','update','delete','exports','multer','util','path'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8912,0xb1));var _0x2891=function(_0x50b345,_0x34ea21){_0x50b345=_0x50b345-0x0;var _0x3804d8=_0x8912[_0x50b345];return _0x3804d8;};'use strict';var multer=require(_0x2891('0x0'));var util=require(_0x2891('0x1'));var path=require(_0x2891('0x2'));var timeout=require('connect-timeout');var express=require(_0x2891('0x3'));var router=express[_0x2891('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2891('0x5'));var interaction=require(_0x2891('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x2891('0x7')](_0x2891('0x8'),auth['isAuthenticated'](),controller[_0x2891('0x9')]);router[_0x2891('0xa')](_0x2891('0x8'),auth[_0x2891('0xb')](),controller[_0x2891('0xc')]);router[_0x2891('0xd')](_0x2891('0x8'),auth[_0x2891('0xb')](),controller['destroy']);module[_0x2891('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ca64537..450926c 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 _0xecb2=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x250ad5,_0x2f81cb){var _0x5c8120=function(_0x1af60d){while(--_0x1af60d){_0x250ad5['push'](_0x250ad5['shift']());}};_0x5c8120(++_0x2f81cb);}(_0xecb2,0x177));var _0x2ecb=function(_0x564343,_0x95188c){_0x564343=_0x564343-0x0;var _0x4547eb=_0xecb2[_0x564343];return _0x4547eb;};'use strict';var Sequelize=require('sequelize');module[_0x2ecb('0x0')]={'priority':{'type':Sequelize[_0x2ecb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2ecb('0x2')],'allowNull':![],'defaultValue':_0x2ecb('0x3')},'appdata':{'type':Sequelize[_0x2ecb('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2ecb('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3c0f=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2edf62,_0x335035){var _0x1e67ff=function(_0x3e1203){while(--_0x3e1203){_0x2edf62['push'](_0x2edf62['shift']());}};_0x1e67ff(++_0x335035);}(_0x3c0f,0xa9));var _0xf3c0=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x3c0f[_0x102f97];return _0xd22058;};'use strict';var Sequelize=require(_0xf3c0('0x0'));module[_0xf3c0('0x1')]={'priority':{'type':Sequelize[_0xf3c0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf3c0('0x3')],'allowNull':![],'defaultValue':_0xf3c0('0x4')},'appdata':{'type':Sequelize[_0xf3c0('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf3c0('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2a2f409..965d9a1 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0xaa88[_0x1529a3];return _0x1a0d4b;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x3b9149,_0x2f93ab){var _0x2067f4=function(_0x5a78ce){while(--_0x5a78ce){_0x3b9149['push'](_0x3b9149['shift']());}};_0x2067f4(++_0x2f93ab);}(_0x70e0,0x17b));var _0x070e=function(_0x366afd,_0x5b3062){_0x366afd=_0x366afd-0x0;var _0x3cc994=_0x70e0[_0x366afd];return _0x3cc994;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c506d79..e0c8640 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 _0x0813=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x0813,0x115));var _0x3081=function(_0xaa1350,_0x4a7ab4){_0xaa1350=_0xaa1350-0x0;var _0x5d5f6b=_0x0813[_0xaa1350];return _0x5d5f6b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3081('0x0'))(_0x3081('0x1'));var moment=require(_0x3081('0x2'));var BPromise=require('bluebird');var rp=require(_0x3081('0x3'));var fs=require('fs');var path=require(_0x3081('0x4'));var rimraf=require(_0x3081('0x5'));var config=require(_0x3081('0x6'));var attributes=require(_0x3081('0x7'));module[_0x3081('0x8')]=function(_0x30cd05,_0x3d3fdc){return _0x30cd05['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3081('0x9'),'collate':_0x3081('0xa')});}; \ No newline at end of file +var _0x769b=['mail_applications','utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication'];(function(_0x3c7201,_0x1e26f3){var _0xaeff37=function(_0x1856bd){while(--_0x1856bd){_0x3c7201['push'](_0x3c7201['shift']());}};_0xaeff37(++_0x1e26f3);}(_0x769b,0x14c));var _0xb769=function(_0x4f02d8,_0x5a99e3){_0x4f02d8=_0x4f02d8-0x0;var _0x420e26=_0x769b[_0x4f02d8];return _0x420e26;};'use strict';var _=require('lodash');var util=require(_0xb769('0x0'));var logger=require('../../config/logger')(_0xb769('0x1'));var moment=require(_0xb769('0x2'));var BPromise=require(_0xb769('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb769('0x4'));var config=require(_0xb769('0x5'));var attributes=require(_0xb769('0x6'));module['exports']=function(_0x2c3764,_0x5511bc){return _0x2c3764[_0xb769('0x7')](_0xb769('0x8'),attributes,{'tableName':_0xb769('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb769('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ab9c19b..83cfb53 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 _0x270b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','UpdateMailApplication','MailApplication','update','body','options','limit'];(function(_0x11620e,_0xb0407){var _0x354ff4=function(_0x10ae0a){while(--_0x10ae0a){_0x11620e['push'](_0x11620e['shift']());}};_0x354ff4(++_0xb0407);}(_0x270b,0x155));var _0xb270=function(_0x16f619,_0x57659a){_0x16f619=_0x16f619-0x0;var _0xd6ec27=_0x270b[_0x16f619];return _0xd6ec27;};'use strict';var _=require('lodash');var util=require(_0xb270('0x0'));var moment=require(_0xb270('0x1'));var BPromise=require(_0xb270('0x2'));var rs=require(_0xb270('0x3'));var fs=require('fs');var Redis=require(_0xb270('0x4'));var db=require(_0xb270('0x5'))['db'];var utils=require(_0xb270('0x6'));var logger=require(_0xb270('0x7'))(_0xb270('0x8'));var config=require(_0xb270('0x9'));var jayson=require(_0xb270('0xa'));var client=jayson['client'][_0xb270('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5edb51,_0x24b615,_0x14b058){return new BPromise(function(_0x5c8954,_0x1a476b){return client[_0xb270('0xc')](_0x5edb51,_0x14b058)[_0xb270('0xd')](function(_0x30f60c){logger['info'](_0xb270('0xe'),_0x24b615,'request\x20sent');logger[_0xb270('0xf')](_0xb270('0x10'),_0x24b615,'request\x20sent',JSON[_0xb270('0x11')](_0x30f60c));if(_0x30f60c[_0xb270('0x12')]){if(_0x30f60c[_0xb270('0x12')][_0xb270('0x13')]===0x1f4){logger['error'](_0xb270('0xe'),_0x24b615,_0x30f60c['error'][_0xb270('0x14')]);return _0x1a476b(_0x30f60c[_0xb270('0x12')][_0xb270('0x14')]);}logger[_0xb270('0x12')](_0xb270('0xe'),_0x24b615,_0x30f60c['error'][_0xb270('0x14')]);return _0x5c8954(_0x30f60c['error']['message']);}else{logger[_0xb270('0x15')]('MailApplication,\x20%s,\x20%s',_0x24b615,_0xb270('0x16'));_0x5c8954(_0x30f60c[_0xb270('0x17')][_0xb270('0x14')]);}})[_0xb270('0x18')](function(_0x1ab426){logger['error'](_0xb270('0xe'),_0x24b615,_0x1ab426);_0x1a476b(_0x1ab426);});});}exports[_0xb270('0x19')]=function(_0x1d6799){var _0x4e663b=this;return new Promise(function(_0x41e3ca,_0xd048ac){return db[_0xb270('0x1a')][_0xb270('0x1b')](_0x1d6799[_0xb270('0x1c')],{'raw':_0x1d6799[_0xb270('0x1d')]?_0x1d6799['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d6799[_0xb270('0x1d')]?_0x1d6799['options']['where']||null:null,'attributes':_0x1d6799['options']?_0x1d6799[_0xb270('0x1d')]['attributes']||null:null,'limit':_0x1d6799[_0xb270('0x1d')]?_0x1d6799[_0xb270('0x1d')][_0xb270('0x1e')]||null:null})['then'](function(_0x268427){logger['info'](_0xb270('0x19'),_0x1d6799);logger[_0xb270('0xf')](_0xb270('0x19'),_0x1d6799,JSON[_0xb270('0x11')](_0x268427));_0x41e3ca(_0x268427);})[_0xb270('0x18')](function(_0x4b0341){logger[_0xb270('0x12')](_0xb270('0x19'),_0x4b0341[_0xb270('0x14')],_0x1d6799);_0xd048ac(_0x4e663b[_0xb270('0x12')](0x1f4,_0x4b0341['message']));});});}; \ No newline at end of file +var _0x39b8=['jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','lodash','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x296266,_0x230c62){var _0x15e1bb=function(_0x3831c9){while(--_0x3831c9){_0x296266['push'](_0x296266['shift']());}};_0x15e1bb(++_0x230c62);}(_0x39b8,0x190));var _0x839b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x39b8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x839b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x839b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x839b('0x2'))['db'];var utils=require(_0x839b('0x3'));var logger=require('../../config/logger')(_0x839b('0x4'));var config=require('../../config/environment');var jayson=require(_0x839b('0x5'));var client=jayson[_0x839b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568452,_0x38c511,_0x5941a4){return new BPromise(function(_0x5e3241,_0x298693){return client[_0x839b('0x7')](_0x568452,_0x5941a4)[_0x839b('0x8')](function(_0x29813d){logger[_0x839b('0x9')](_0x839b('0xa'),_0x38c511,_0x839b('0xb'));logger[_0x839b('0xc')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x38c511,_0x839b('0xb'),JSON[_0x839b('0xd')](_0x29813d));if(_0x29813d[_0x839b('0xe')]){if(_0x29813d[_0x839b('0xe')][_0x839b('0xf')]===0x1f4){logger[_0x839b('0xe')]('MailApplication,\x20%s,\x20%s',_0x38c511,_0x29813d[_0x839b('0xe')]['message']);return _0x298693(_0x29813d['error'][_0x839b('0x10')]);}logger[_0x839b('0xe')](_0x839b('0xa'),_0x38c511,_0x29813d[_0x839b('0xe')][_0x839b('0x10')]);return _0x5e3241(_0x29813d[_0x839b('0xe')][_0x839b('0x10')]);}else{logger[_0x839b('0x9')](_0x839b('0xa'),_0x38c511,'request\x20sent');_0x5e3241(_0x29813d[_0x839b('0x11')][_0x839b('0x10')]);}})[_0x839b('0x12')](function(_0x4b2e4b){logger['error'](_0x839b('0xa'),_0x38c511,_0x4b2e4b);_0x298693(_0x4b2e4b);});});}exports[_0x839b('0x13')]=function(_0x50431b){var _0x38b99c=this;return new Promise(function(_0x1c6fee,_0x401ab1){return db[_0x839b('0x14')]['update'](_0x50431b[_0x839b('0x15')],{'raw':_0x50431b['options']?_0x50431b[_0x839b('0x16')][_0x839b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50431b['options']?_0x50431b[_0x839b('0x16')][_0x839b('0x18')]||null:null,'attributes':_0x50431b[_0x839b('0x16')]?_0x50431b['options'][_0x839b('0x19')]||null:null,'limit':_0x50431b[_0x839b('0x16')]?_0x50431b[_0x839b('0x16')][_0x839b('0x1a')]||null:null})[_0x839b('0x8')](function(_0x3ecb9d){logger[_0x839b('0x9')](_0x839b('0x13'),_0x50431b);logger[_0x839b('0xc')](_0x839b('0x13'),_0x50431b,JSON['stringify'](_0x3ecb9d));_0x1c6fee(_0x3ecb9d);})[_0x839b('0x12')](function(_0x169879){logger[_0x839b('0xe')]('UpdateMailApplication',_0x169879['message'],_0x50431b);_0x401ab1(_0x38b99c['error'](0x1f4,_0x169879[_0x839b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 21b4322..ada6fbf 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 _0xe6c7=['exports','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe','/:id','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe6c7,0x1a1));var _0x7e6c=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe6c7[_0x1da527];return _0x40fc7c;};'use strict';var express=require(_0x7e6c('0x0'));var router=express[_0x7e6c('0x1')]();var auth=require(_0x7e6c('0x2'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x7e6c('0x3')](),controller[_0x7e6c('0x4')]);router[_0x7e6c('0x5')](_0x7e6c('0x6'),auth[_0x7e6c('0x3')](),controller['describe']);router[_0x7e6c('0x5')](_0x7e6c('0x7'),auth[_0x7e6c('0x3')](),controller['show']);router[_0x7e6c('0x5')](_0x7e6c('0x8'),auth[_0x7e6c('0x3')](),controller['getMessages']);router[_0x7e6c('0x5')](_0x7e6c('0x9'),auth[_0x7e6c('0x3')](),controller[_0x7e6c('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e6c('0xb')]);router[_0x7e6c('0xc')](_0x7e6c('0x8'),auth[_0x7e6c('0x3')](),controller[_0x7e6c('0xd')]);router[_0x7e6c('0xc')](_0x7e6c('0xe'),auth[_0x7e6c('0x3')](),interaction[_0x7e6c('0xf')](_0x7e6c('0x10'),_0x7e6c('0x11')),controller[_0x7e6c('0x12')]);router[_0x7e6c('0x13')](_0x7e6c('0x7'),auth[_0x7e6c('0x3')](),interaction[_0x7e6c('0xf')]('mail',_0x7e6c('0x14')),controller['update']);router[_0x7e6c('0x15')]('/:id',auth[_0x7e6c('0x3')](),interaction[_0x7e6c('0xf')](_0x7e6c('0x10'),_0x7e6c('0x16')),controller[_0x7e6c('0x17')]);router['delete'](_0x7e6c('0xe'),auth[_0x7e6c('0x3')](),controller[_0x7e6c('0x18')]);module[_0x7e6c('0x19')]=router; \ No newline at end of file +var _0x7c47=['exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','mailinteraction:addtags','addTags','put','/:id','mail','mailinteraction:update','mailinteraction:destroy','destroy','delete','removeTags'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7c47,0xa9));var _0x77c4=function(_0x194838,_0x69a2ca){_0x194838=_0x194838-0x0;var _0x7ecc7c=_0x7c47[_0x194838];return _0x7ecc7c;};'use strict';var express=require('express');var router=express[_0x77c4('0x0')]();var auth=require(_0x77c4('0x1'));var interaction=require(_0x77c4('0x2'));var controller=require(_0x77c4('0x3'));router[_0x77c4('0x4')]('/',auth[_0x77c4('0x5')](),controller['index']);router[_0x77c4('0x4')](_0x77c4('0x6'),auth['isAuthenticated'](),controller[_0x77c4('0x7')]);router[_0x77c4('0x4')]('/:id',auth[_0x77c4('0x5')](),controller[_0x77c4('0x8')]);router[_0x77c4('0x4')](_0x77c4('0x9'),auth[_0x77c4('0x5')](),controller[_0x77c4('0xa')]);router[_0x77c4('0x4')](_0x77c4('0xb'),auth[_0x77c4('0x5')](),controller[_0x77c4('0xc')]);router['post']('/',auth[_0x77c4('0x5')](),controller[_0x77c4('0xd')]);router[_0x77c4('0xe')](_0x77c4('0x9'),auth[_0x77c4('0x5')](),controller['addMessage']);router[_0x77c4('0xe')](_0x77c4('0xf'),auth[_0x77c4('0x5')](),interaction[_0x77c4('0x10')]('mail',_0x77c4('0x11')),controller[_0x77c4('0x12')]);router[_0x77c4('0x13')](_0x77c4('0x14'),auth[_0x77c4('0x5')](),interaction['tracked'](_0x77c4('0x15'),_0x77c4('0x16')),controller['update']);router['delete'](_0x77c4('0x14'),auth[_0x77c4('0x5')](),interaction[_0x77c4('0x10')](_0x77c4('0x15'),_0x77c4('0x17')),controller[_0x77c4('0x18')]);router[_0x77c4('0x19')](_0x77c4('0xf'),auth[_0x77c4('0x5')](),controller[_0x77c4('0x1a')]);module[_0x77c4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index fbb7be7..ff5e898 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 _0x1135=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x1135,0x119));var _0x5113=function(_0x1a4b37,_0x2e30fd){_0x1a4b37=_0x1a4b37-0x0;var _0x46ddad=_0x1135[_0x1a4b37];return _0x46ddad;};'use strict';var Sequelize=require(_0x5113('0x0'));var iconv=require('iconv');module[_0x5113('0x1')]={'closed':{'type':Sequelize[_0x5113('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5113('0x3')]},'disposition':{'type':Sequelize[_0x5113('0x4')]},'secondDisposition':{'type':Sequelize[_0x5113('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5113('0x4')]},'note':{'type':Sequelize[_0x5113('0x4')]},'inReplyTo':{'type':Sequelize[_0x5113('0x4')](0x1fe)},'to':{'type':Sequelize[_0x5113('0x4')]},'cc':{'type':Sequelize[_0x5113('0x5')](_0x5113('0x6'))},'subject':{'type':Sequelize[_0x5113('0x5')]()},'attach':{'type':Sequelize[_0x5113('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x5113('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5113('0x7')]('in',_0x5113('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5113('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5113('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5113('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xeb36=['DATE','STRING','TEXT','out','sequelize','exports','BOOLEAN'];(function(_0xf805a6,_0x566679){var _0x30f441=function(_0x101a14){while(--_0x101a14){_0xf805a6['push'](_0xf805a6['shift']());}};_0x30f441(++_0x566679);}(_0xeb36,0x74));var _0x6eb3=function(_0x23116c,_0x22e524){_0x23116c=_0x23116c-0x0;var _0x5a7323=_0xeb36[_0x23116c];return _0x5a7323;};'use strict';var Sequelize=require(_0x6eb3('0x0'));var iconv=require('iconv');module[_0x6eb3('0x1')]={'closed':{'type':Sequelize[_0x6eb3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6eb3('0x3')]},'disposition':{'type':Sequelize[_0x6eb3('0x4')]},'secondDisposition':{'type':Sequelize[_0x6eb3('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6eb3('0x4')]},'note':{'type':Sequelize[_0x6eb3('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x6eb3('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6eb3('0x3')]},'substatus':{'type':Sequelize[_0x6eb3('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x6eb3('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6eb3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6eb3('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 120d2cc..b0a7cbd 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 _0x537c=['bcc','subject','createdAt','get','Messages','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','MailMessage','findOne','out','-id','lastMsgText','plainBody','catch','index','MailInteraction','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','select','field','tools_tags','u.id','u.fullname','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','keys','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','role','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.MailInteractionId\x20IN\x20?','MailInteractionId','enableEmailPreview','push','all','show','includeAll','include','create','body','params','destroy','describe','addMessage','ids','omit','YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','true','rows','addTags','color','emit','removeTags','unix','join','root','server','files','attachments','Attachment','Attachments'];(function(_0x764874,_0x3ed544){var _0x29f9d5=function(_0x152dad){while(--_0x152dad){_0x764874['push'](_0x764874['shift']());}};_0x29f9d5(++_0x3ed544);}(_0x537c,0xf6));var _0xc537=function(_0x4165c8,_0x3b5f00){_0x4165c8=_0x4165c8-0x0;var _0x299dd1=_0x537c[_0x4165c8];return _0x299dd1;};'use strict';var emlformat=require(_0xc537('0x0'));var rimraf=require(_0xc537('0x1'));var zipdir=require(_0xc537('0x2'));var moment=require(_0xc537('0x3'));var BPromise=require('bluebird');var util=require(_0xc537('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xc537('0x5'));var squel=require(_0xc537('0x6'));var juice=require(_0xc537('0x7'));var Redis=require(_0xc537('0x8'));var qs=require(_0xc537('0x9'));var as=require(_0xc537('0xa'));var logger=require('../../config/logger')(_0xc537('0xb'));var config=require('../../config/environment');var db=require(_0xc537('0xc'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0xc537('0xd')](config[_0xc537('0xe')],{'host':_0xc537('0xf'),'port':0x18eb});var socket=require(_0xc537('0x10'))(new Redis(config['redis']));require(_0xc537('0x11'))['register'](socket);function respondWithStatusCode(_0x166fec,_0x41e8d1){_0x41e8d1=_0x41e8d1||0xcc;return function(_0x9c02ae){if(_0x9c02ae){return _0x166fec[_0xc537('0x12')](_0x41e8d1);}return _0x166fec[_0xc537('0x13')](_0x41e8d1)[_0xc537('0x14')]();};}function respondWithResult(_0x49efd6,_0x3a7c68){_0x3a7c68=_0x3a7c68||0xc8;return function(_0x5751e5){if(_0x5751e5){return _0x49efd6[_0xc537('0x13')](_0x3a7c68)['json'](_0x5751e5);}};}function respondWithFilteredResult(_0x3a4c4f,_0xdb40ab){return function(_0xbfbb6a){if(_0xbfbb6a){var _0x1e7c56=typeof _0xdb40ab[_0xc537('0x15')]===_0xc537('0x16')&&typeof _0xdb40ab[_0xc537('0x17')]===_0xc537('0x16');var _0x31447c=_0xbfbb6a[_0xc537('0x18')];var _0x44d392=_0x1e7c56?0x0:_0xdb40ab[_0xc537('0x15')];var _0x5015db=_0x1e7c56?_0xbfbb6a[_0xc537('0x18')]:_0xdb40ab[_0xc537('0x15')]+_0xdb40ab['limit'];var _0x4a8c2c;if(_0x5015db>=_0x31447c){_0x5015db=_0x31447c;_0x4a8c2c=0xc8;}else{_0x4a8c2c=0xce;}_0x3a4c4f['status'](_0x4a8c2c);return _0x3a4c4f[_0xc537('0x19')](_0xc537('0x1a'),_0x44d392+'-'+_0x5015db+'/'+_0x31447c)[_0xc537('0x1b')](_0xbfbb6a);}return null;};}function saveUpdates(_0x37d583){return function(_0x2a8dbc){if(_0x2a8dbc){return _0x2a8dbc[_0xc537('0x1c')](_0x37d583)[_0xc537('0x1d')](function(_0x53b8e4){return _0x53b8e4;});}return null;};}function removeEntity(_0x27b0ff){return function(_0x509bf7){if(_0x509bf7){return _0x509bf7['destroy']()[_0xc537('0x1d')](function(){_0x27b0ff[_0xc537('0x13')](0xcc)[_0xc537('0x14')]();});}};}function handleEntityNotFound(_0x475787){return function(_0x2764c1){if(!_0x2764c1){_0x475787[_0xc537('0x12')](0x194);}return _0x2764c1;};}function handleError(_0x24703a,_0x29c80f){_0x29c80f=_0x29c80f||0x1f4;return function(_0x33ba11){logger[_0xc537('0x1e')](_0x33ba11[_0xc537('0x1f')]);if(_0x33ba11[_0xc537('0x20')]){delete _0x33ba11[_0xc537('0x20')];}_0x24703a[_0xc537('0x13')](_0x29c80f)['send'](_0x33ba11);};}function getInteractionUsers(_0x5c2269,_0x1c87f6){return new BPromise(function(_0x16c08f,_0x316463){try{if(_0x1c87f6[_0x5c2269['id']]){_0x5c2269[_0xc537('0x21')]=_[_0xc537('0x22')](_0x1c87f6[_0x5c2269['id']],function(_0x33a1cb){return{'id':_0x33a1cb['id'],'fullname':_0x33a1cb[_0xc537('0x23')]};});}}catch(_0x2f798c){_0x316463(_0x2f798c);}_0x16c08f(_0x5c2269);});}function getInteractionTags(_0xf152c9,_0x58487c){return new BPromise(function(_0x503bda,_0x21f822){try{if(_0xf152c9[_0xc537('0x24')]){_0xf152c9[_0xc537('0x25')]=[];_0xf152c9['TagIds'][_0xc537('0x26')](',')[_0xc537('0x27')](function(_0x534c4d){_0xf152c9[_0xc537('0x25')]['push'](_0x58487c[_0x534c4d]);});}delete _0xf152c9[_0xc537('0x24')];}catch(_0xa9f92b){_0x21f822(_0xa9f92b);}_0x503bda(_0xf152c9);});}function getLastMessageText(_0x4d8d16){return new BPromise(function(_0x19ec24,_0x48e1a3){return db[_0xc537('0x28')][_0xc537('0x29')]({'where':{'$and':[{'MailInteractionId':_0x4d8d16['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xc537('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xc537('0x2b'),'raw':!![]})['then'](function(_0x330aef){if(_0x330aef&&_0x330aef['plainBody']){_0x4d8d16[_0xc537('0x2c')]=_['trimStart'](_0x330aef[_0xc537('0x2d')]);}_0x19ec24(_0x4d8d16);})[_0xc537('0x2e')](function(_0x52642a){_0x48e1a3(_0x52642a);});});}function updateMailInteraction(_0x26c2af,_0x3baec7,_0x420dd6,_0x5b2053){return new BPromise(function(_0x48b445,_0x56348c){return getInteractionUsers(_0x26c2af,_0x420dd6)[_0xc537('0x1d')](function(_0x1d5c8e){return getInteractionTags(_0x1d5c8e,_0x3baec7);})[_0xc537('0x1d')](function(_0xd58205){if(_0x5b2053){_0x48b445(getLastMessageText(_0xd58205));}else{_0x48b445(_0xd58205);}})[_0xc537('0x2e')](function(_0x54d0ab){_0x56348c(_0x54d0ab);});});}exports[_0xc537('0x2f')]=function(_0x2f8191,_0x55dadd){var _0x2d82cb={},_0x4b08b8={},_0x252755={'count':0x0,'rows':[]};var _0x3c5dc1=_[_0xc537('0x22')](db[_0xc537('0x30')][_0xc537('0x31')],function(_0x4e9942){return{'name':_0x4e9942[_0xc537('0x32')],'type':_0x4e9942[_0xc537('0x33')]['key']};});_0x4b08b8[_0xc537('0x34')]=_['map'](_0x3c5dc1,'name');_0x4b08b8['query']=_['keys'](_0x2f8191['query']);_0x4b08b8[_0xc537('0x35')]=_[_0xc537('0x36')](_0x4b08b8[_0xc537('0x34')],_0x4b08b8[_0xc537('0x37')]);_0x2d82cb[_0xc537('0x38')]=_[_0xc537('0x36')](_0x4b08b8[_0xc537('0x34')],qs[_0xc537('0x39')](_0x2f8191[_0xc537('0x37')]['fields']));_0x2d82cb[_0xc537('0x38')]=_0x2d82cb[_0xc537('0x38')]['length']?_0x2d82cb['attributes']:_0x4b08b8[_0xc537('0x34')];if(!_0x2f8191[_0xc537('0x37')][_0xc537('0x3a')](_0xc537('0x3b'))){_0x2d82cb['limit']=qs['limit'](_0x2f8191['query'][_0xc537('0x17')]);_0x2d82cb[_0xc537('0x15')]=qs[_0xc537('0x15')](_0x2f8191['query'][_0xc537('0x15')]);}_0x2d82cb['order']=qs[_0xc537('0x3c')](_0x2f8191['query'][_0xc537('0x3c')]);_0x2d82cb[_0xc537('0x3d')]=qs[_0xc537('0x35')](_[_0xc537('0x3e')](_0x2f8191['query'],_0x4b08b8[_0xc537('0x35')]),_0x3c5dc1);var _0x12f773=[];var _0x32dc6c=squel[_0xc537('0x3f')]()[_0xc537('0x40')]('id')[_0xc537('0x40')](_0xc537('0x20'))[_0xc537('0x40')]('color')['from'](_0xc537('0x41'));var _0x1865ef=squel[_0xc537('0x3f')]()[_0xc537('0x40')](_0xc537('0x42'))[_0xc537('0x40')](_0xc537('0x43'))[_0xc537('0x40')]('ui.MailInteractionId')[_0xc537('0x44')](_0xc537('0x45'),'ui')[_0xc537('0x46')](_0xc537('0x47'),'u',_0xc537('0x48'));var _0x3b85a6=squel[_0xc537('0x3f')]()[_0xc537('0x44')]('mail_interactions','i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc537('0x46')]('users','o','o.id\x20=\x20i.UserId')[_0xc537('0x46')](_0xc537('0x49'),'a',_0xc537('0x4a'))[_0xc537('0x46')]('mail_messages','me',_0xc537('0x4b'))[_0xc537('0x46')]('mail_interaction_has_tags','it',_0xc537('0x4c'))[_0xc537('0x46')](_0xc537('0x41'),'t','t.id\x20=\x20it.TagId');var _0x2c42c9=squel['expr']();var _0x1b1999=[];var _0x3c3a6=squel[_0xc537('0x4d')]();var _0x59a056;if(_0x2f8191[_0xc537('0x37')][_0xc537('0x4e')]){_0x59a056=as[_0xc537('0x4f')](_0x2f8191[_0xc537('0x37')][_0xc537('0x4e')]);var _0x37db49=_0x59a056[_0xc537('0x50')];for(var _0x51b7d5=0x0;_0x51b7d5<_0x59a056['conditions'][_0xc537('0x51')];_0x51b7d5++){var _0x260dda=_0x59a056[_0xc537('0x52')][_0x51b7d5];var _0x45ab27='i';var _0x712272=_['find'](_0x3c5dc1,[_0xc537('0x20'),_0x260dda[_0xc537('0x40')]]);if(!_0x712272){switch(_0x260dda['field']){case _0xc537('0x53'):if(_0x260dda[_0xc537('0x54')]==0x1){_0x3b85a6[_0xc537('0x55')]('`'+_0x260dda[_0xc537('0x40')]+_0xc537('0x56'));}else{_0x3b85a6[_0xc537('0x55')]('`'+_0x260dda[_0xc537('0x40')]+'`\x20>\x200');}break;case _0xc537('0x57'):if(_0x260dda['operator']===_0xc537('0x58')){if(_0x260dda[_0xc537('0x54')][_0xc537('0x26')]('\x20')['length']>0x1){_0x2c42c9[_0x37db49](_0xc537('0x59'),qs[_0xc537('0x5a')](_0x260dda[_0xc537('0x54')]),null);}else{var _0x446bea='%'+_0x260dda[_0xc537('0x54')]+'%';_0x2c42c9[_0x37db49](_0xc537('0x5b'),_0x446bea,_0x446bea,_0x446bea);}}else{_0x712272=_[_0xc537('0x5c')](_0x3c5dc1,[_0xc537('0x20'),'ContactId']);_0x260dda[_0xc537('0x40')]='ContactId';_0x542d57=as[_0xc537('0x5d')](_0x45ab27,_0x712272[_0xc537('0x33')],_0x260dda);_0x2c42c9[_0x37db49](_0x542d57[_0xc537('0x5e')],_0x542d57[_0xc537('0x54')][_0xc537('0x5f')],_0x542d57['value']['end']);}break;case _0xc537('0x60'):var _0x1e6d9e=_0x260dda[_0xc537('0x54')]['split'](',')['map'](function(_0x28e7c9){return Number(_0x28e7c9);});_0x1e6d9e[_0xc537('0x27')](function(_0x44f4c5){_0x3c3a6['or'](_0xc537('0x61'),'%,'+_0x44f4c5+',%');});_0x1b1999=_[_0xc537('0x62')](_0x1b1999,_0x1e6d9e);break;case _0xc537('0x63'):if(_0x260dda[_0xc537('0x64')]==='$substring'){_0x2c42c9[_0x37db49]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x260dda['value']+'%',null);}else{_0x712272=_[_0xc537('0x5c')](_0x3c5dc1,[_0xc537('0x20'),_0xc537('0x65')]);_0x260dda[_0xc537('0x40')]='UserId';_0x542d57=as[_0xc537('0x5d')](_0x45ab27,_0x712272[_0xc537('0x33')],_0x260dda);_0x2c42c9[_0x37db49](_0x542d57[_0xc537('0x5e')],_0x542d57[_0xc537('0x54')][_0xc537('0x5f')],_0x542d57[_0xc537('0x54')][_0xc537('0x14')]);}break;case _0xc537('0x2d'):_0x542d57=as[_0xc537('0x5d')]('me',null,_0x260dda);_0x2c42c9[_0x37db49](_0x542d57[_0xc537('0x5e')],_0x542d57[_0xc537('0x54')][_0xc537('0x5f')],_0x542d57['value'][_0xc537('0x14')]);break;}}else{var _0x542d57=as[_0xc537('0x5d')](_0x45ab27,_0x712272['type'],_0x260dda);_0x2c42c9[_0x37db49](_0x542d57['text'],_0x542d57[_0xc537('0x54')][_0xc537('0x5f')],_0x542d57[_0xc537('0x54')][_0xc537('0x14')]);}}}else{var _0x5db1d4=_(_0x2f8191[_0xc537('0x37')])[_0xc537('0x66')]()[_0xc537('0x22')](function(_0x3e6163){return _[_0xc537('0x67')](_0x3c5dc1,[_0xc537('0x20'),_0x3e6163])?_0x3e6163:undefined;})[_0xc537('0x68')]()[_0xc537('0x54')]();if(!_['isEmpty'](_0x5db1d4)){_0x5db1d4['forEach'](function(_0x3aa46a){if(_0x3aa46a===_0xc537('0x69')){_0x3b85a6[_0xc537('0x3d')](_0xc537('0x6a'),[][_0xc537('0x6b')](_0x2f8191['query'][_0x3aa46a]));}else if(_0x3aa46a==='createdAt'){var _0xb40829=JSON['parse'](_0x2f8191['query'][_0x3aa46a])[_0xc537('0x6c')];var _0x493d96=JSON['parse'](_0x2f8191[_0xc537('0x37')][_0x3aa46a])[_0xc537('0x6d')];_0x3b85a6[_0xc537('0x3d')](_0xc537('0x6e'),_0xb40829,_0x493d96);}else{if(_0x2f8191[_0xc537('0x37')][_0x3aa46a]===_0xc537('0x6f')){_0x3b85a6['where']('i.'+_0x3aa46a+'\x20IS\x20NULL');}else{_0x3b85a6[_0xc537('0x3d')]('i.'+_0x3aa46a+'\x20=\x20?',_0x2f8191['query'][_0x3aa46a]);}}});}if(_0x2f8191[_0xc537('0x37')][_0xc537('0x70')]){if(_0x2f8191[_0xc537('0x37')][_0xc537('0x70')]==0x1){_0x3b85a6['having'](_0xc537('0x71'));}else{_0x3b85a6[_0xc537('0x55')](_0xc537('0x72'));}}if(_0x2f8191[_0xc537('0x37')][_0xc537('0x73')]){_0x1b1999=_[_0xc537('0x74')](_0x2f8191[_0xc537('0x37')][_0xc537('0x73')])?_0x2f8191[_0xc537('0x37')][_0xc537('0x73')]:new Array(_0x2f8191[_0xc537('0x37')][_0xc537('0x73')]);_0x1b1999[_0xc537('0x27')](function(_0x4da779){_0x3c3a6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4da779+',%');});}if(_0x2f8191['query'][_0xc537('0x75')]){var _0x3bf0ad=_0x2f8191[_0xc537('0x37')][_0xc537('0x75')][_0xc537('0x76')]('\x5c','\x5c\x5c')[_0xc537('0x76')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3bf0ad)){_0x2c42c9['or'](_0xc537('0x77'),_0x3bf0ad+'%');}else if(qs['isEmail'](_0x3bf0ad)){_0x2c42c9['or'](_0xc537('0x78'),_0x3bf0ad+'%');}else{_0x2c42c9['or'](_0xc537('0x79'),qs[_0xc537('0x5a')](_0x3bf0ad))['or'](_0xc537('0x7a'),qs[_0xc537('0x5a')](_0x3bf0ad));}}}_0x3b85a6[_0xc537('0x3d')](_0x2c42c9);_0x3b85a6[_0xc537('0x7b')](_0xc537('0x7c'));var _0x18868f={'type':db[_0xc537('0x7d')][_0xc537('0x7e')][_0xc537('0x7f')],'raw':!![]};var _0x56149b=_0x3b85a6[_0xc537('0x80')]();_0x56149b[_0xc537('0x40')](_0xc537('0x7c'));_0x56149b[_0xc537('0x40')](_0xc537('0x81'),_0xc537('0x53'));if(_0x2d82cb[_0xc537('0x82')]){_0x2d82cb[_0xc537('0x82')][_0xc537('0x27')](function(_0x3bc915){var _0x4d71a3=_0x3bc915[0x0]===_0xc537('0x83')?_0x3bc915[0x0]:'i.'+_0x3bc915[0x0];_0x3b85a6['order'](_0x4d71a3,_0x3bc915[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1b1999)){_0x3b85a6[_0xc537('0x55')](_0x3c3a6);_0x56149b[_0xc537('0x3d')](_0xc537('0x84'),_0x1b1999);}BPromise[_0xc537('0x85')]()['then'](function(){if(!_0x59a056){if(_0x2f8191[_0xc537('0x37')][_0xc537('0x69')])return;_0x56149b[_0xc537('0x3d')](_0xc537('0x86'));_0x3b85a6[_0xc537('0x3d')](_0xc537('0x86'));return;}if(_0x2f8191[_0xc537('0x87')]['role']!==_0xc537('0x88'))return;return _0x2f8191[_0xc537('0x87')][_0xc537('0x89')]({'attributes':['id'],'raw':!![]})[_0xc537('0x1d')](function(_0x44a45a){if(_[_0xc537('0x8a')](_0x44a45a)){_0x56149b['where'](_0xc537('0x8b'));_0x3b85a6[_0xc537('0x3d')](_0xc537('0x8b'));}else{_0x56149b[_0xc537('0x3d')](_0xc537('0x6a'),_[_0xc537('0x22')](_0x44a45a,'id'));_0x3b85a6[_0xc537('0x3d')](_0xc537('0x6a'),_[_0xc537('0x22')](_0x44a45a,'id'));}});})[_0xc537('0x1d')](function(){if(_0x2f8191[_0xc537('0x87')][_0xc537('0x8c')]===_0xc537('0x88')&&!_0x59a056&&!_0x2f8191[_0xc537('0x37')][_0xc537('0x69')])return[];return db['sequelize'][_0xc537('0x37')](_0x56149b['toString'](),_0x18868f);})[_0xc537('0x1d')](function(_0x166bb9){_0x252755[_0xc537('0x18')]=_0x166bb9[_0xc537('0x51')];if(_0x252755['count']===0x0)return[];return db['sequelize'][_0xc537('0x37')](_0x32dc6c[_0xc537('0x8d')](),_0x18868f)[_0xc537('0x1d')](function(_0x458f47){_0x12f773=_[_0xc537('0x8e')](_0x458f47,'id');_0x18868f=_[_0xc537('0x8f')](_0x18868f,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f8191['query'][_0xc537('0x39')]){_0x2d82cb['attributes'][_0xc537('0x27')](function(_0x4b0e3d){_0x3b85a6[_0xc537('0x40')]('i.'+_0x4b0e3d);});}else{_0x3b85a6[_0xc537('0x40')](_0xc537('0x81'),_0xc537('0x53'));_0x3b85a6[_0xc537('0x40')](_0xc537('0x90'),_0xc537('0x91'));_0x3b85a6['field'](_0xc537('0x92'),_0xc537('0x93'));_0x3b85a6[_0xc537('0x40')](_0xc537('0x94'),_0xc537('0x83'));_0x3b85a6[_0xc537('0x40')](_0xc537('0x7c'));_0x3b85a6['field'](_0xc537('0x95'));_0x3b85a6['field'](_0xc537('0x96'));_0x3b85a6[_0xc537('0x40')](_0xc537('0x97'));_0x3b85a6[_0xc537('0x40')]('i.closedAt');_0x3b85a6[_0xc537('0x40')](_0xc537('0x98'));_0x3b85a6[_0xc537('0x40')](_0xc537('0x99'));_0x3b85a6[_0xc537('0x40')]('i.lastMsgDirection');_0x3b85a6['field'](_0xc537('0x9a'));_0x3b85a6[_0xc537('0x40')](_0xc537('0x9b'));_0x3b85a6['field'](_0xc537('0x9c'));_0x3b85a6[_0xc537('0x40')](_0xc537('0x9d'));_0x3b85a6['field'](_0xc537('0x9e'));_0x3b85a6[_0xc537('0x40')](_0xc537('0x9f'));_0x3b85a6[_0xc537('0x40')](_0xc537('0xa0'));_0x3b85a6[_0xc537('0x40')](_0xc537('0xa1'));_0x3b85a6[_0xc537('0x40')](_0xc537('0xa2'));_0x3b85a6[_0xc537('0x40')](_0xc537('0xa3'),_0xc537('0xa4'));_0x3b85a6[_0xc537('0x40')]('c.lastName',_0xc537('0xa5'));_0x3b85a6[_0xc537('0x40')]('c.email',_0xc537('0xa6'));_0x3b85a6['field'](_0xc537('0xa7'),'Contact.phone');_0x3b85a6[_0xc537('0x40')](_0xc537('0xa8'),_0xc537('0xa9'));_0x3b85a6[_0xc537('0x40')](_0xc537('0xaa'),_0xc537('0xab'));_0x3b85a6[_0xc537('0x40')](_0xc537('0xac'),_0xc537('0xad'));_0x3b85a6[_0xc537('0x40')](_0xc537('0xae'),_0xc537('0xaf'));_0x3b85a6[_0xc537('0x40')](_0xc537('0xb0'),_0xc537('0x24'));}if(_0x2d82cb['limit'])_0x3b85a6['limit'](_0x2d82cb[_0xc537('0x17')]);if(_0x2d82cb['offset'])_0x3b85a6[_0xc537('0x15')](_0x2d82cb[_0xc537('0x15')]);return db[_0xc537('0xb1')][_0xc537('0x37')](_0x3b85a6[_0xc537('0x8d')](),_0x18868f);})[_0xc537('0x1d')](function(_0x56ba4a){if(_0x56ba4a[_0xc537('0x51')]>0x0)_0x1865ef[_0xc537('0x3d')](_0xc537('0xb2'),_[_0xc537('0x22')](_0x56ba4a,'id'));return db[_0xc537('0xb1')][_0xc537('0x37')](_0x1865ef[_0xc537('0x8d')](),_0x18868f)['then'](function(_0x1800f2){var _0xa700d2=_['groupBy'](_0x1800f2,_0xc537('0xb3'));var _0xb5488=[];return db['Setting']['findOne']({'attributes':[_0xc537('0xb4')],'raw':!![]})[_0xc537('0x1d')](function(_0x750940){var _0xa53c55=_0x750940[_0xc537('0xb4')];_0x56ba4a[_0xc537('0x27')](function(_0x4c2009){_0xb5488[_0xc537('0xb5')](updateMailInteraction(_0x4c2009,_0x12f773,_0xa700d2,_0xa53c55));});return BPromise[_0xc537('0xb6')](_0xb5488);});});});})['then'](function(_0x247f01){_0x252755['rows']=_0x247f01;return _0x252755;})[_0xc537('0x1d')](respondWithFilteredResult(_0x55dadd,_0x2d82cb))['catch'](handleError(_0x55dadd,null));};exports[_0xc537('0xb7')]=function(_0x1bc434,_0x31a083){var _0x4e6dfc={'raw':![],'where':{'id':_0x1bc434['params']['id']}},_0x5031cd={};_0x5031cd['model']=_[_0xc537('0x66')](db[_0xc537('0x30')]['rawAttributes']);_0x5031cd[_0xc537('0x37')]=_['keys'](_0x1bc434[_0xc537('0x37')]);_0x5031cd[_0xc537('0x35')]=_['intersection'](_0x5031cd[_0xc537('0x34')],_0x5031cd[_0xc537('0x37')]);_0x4e6dfc[_0xc537('0x38')]=_[_0xc537('0x36')](_0x5031cd[_0xc537('0x34')],qs[_0xc537('0x39')](_0x1bc434[_0xc537('0x37')][_0xc537('0x39')]));_0x4e6dfc[_0xc537('0x38')]=_0x4e6dfc[_0xc537('0x38')][_0xc537('0x51')]?_0x4e6dfc['attributes']:_0x5031cd[_0xc537('0x34')];if(_0x1bc434[_0xc537('0x37')][_0xc537('0xb8')]){_0x4e6dfc[_0xc537('0xb9')]=[{'all':!![]}];}_0x4e6dfc=_[_0xc537('0x8f')]({},_0x4e6dfc,_0x1bc434['options']);return db[_0xc537('0x30')][_0xc537('0x5c')](_0x4e6dfc)[_0xc537('0x1d')](handleEntityNotFound(_0x31a083,null))[_0xc537('0x1d')](respondWithResult(_0x31a083,null))[_0xc537('0x2e')](handleError(_0x31a083,null));};exports[_0xc537('0xba')]=function(_0x2f74f7,_0x1d11e6){return db[_0xc537('0x30')][_0xc537('0xba')](_0x2f74f7['body'],{})[_0xc537('0x1d')](respondWithResult(_0x1d11e6,0xc9))[_0xc537('0x2e')](handleError(_0x1d11e6,null));};exports[_0xc537('0x1c')]=function(_0x3989ae,_0x85a366){if(_0x3989ae['body']['id']){delete _0x3989ae[_0xc537('0xbb')]['id'];}return db[_0xc537('0x30')][_0xc537('0x5c')]({'where':{'id':_0x3989ae[_0xc537('0xbc')]['id']}})['then'](handleEntityNotFound(_0x85a366,null))[_0xc537('0x1d')](saveUpdates(_0x3989ae[_0xc537('0xbb')],null))[_0xc537('0x1d')](respondWithResult(_0x85a366,null))['catch'](handleError(_0x85a366,null));};exports[_0xc537('0xbd')]=function(_0x40262e,_0x49a1a7){return db['MailInteraction'][_0xc537('0x5c')]({'where':{'id':_0x40262e[_0xc537('0xbc')]['id']}})[_0xc537('0x1d')](handleEntityNotFound(_0x49a1a7,null))[_0xc537('0x1d')](removeEntity(_0x49a1a7,null))['catch'](handleError(_0x49a1a7,null));};exports[_0xc537('0xbe')]=function(_0x36de9e,_0x2767c6){return db[_0xc537('0x30')][_0xc537('0xbe')]()[_0xc537('0x1d')](respondWithResult(_0x2767c6,null))['catch'](handleError(_0x2767c6,null));};exports[_0xc537('0xbf')]=function(_0x18ec69,_0x34e718){return db[_0xc537('0x28')][_0xc537('0x5c')]({'where':{'id':_0x18ec69[_0xc537('0xbc')]['id']}})['then'](handleEntityNotFound(_0x34e718,null))[_0xc537('0x1d')](function(_0x5c3e76){if(_0x5c3e76){return _0x5c3e76['addMessage'](_0x18ec69[_0xc537('0xbb')][_0xc537('0xc0')],_[_0xc537('0xc1')](_0x18ec69[_0xc537('0xbb')],[_0xc537('0xc0'),'id'])||{});}})[_0xc537('0x1d')](respondWithResult(_0x34e718,null))[_0xc537('0x2e')](handleError(_0x34e718,null));};exports['getMessages']=function(_0x51b92f,_0x3b44f7){var _0x3a5fb8={'raw':![],'where':{}};var _0x231d49={};var _0x5bb099={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x51b92f[_0xc537('0xbc')]['id']}})[_0xc537('0x1d')](handleEntityNotFound(_0x3b44f7,null))[_0xc537('0x1d')](function(_0x37bcd7){if(_0x37bcd7){_0x231d49[_0xc537('0x34')]=_[_0xc537('0x66')](db[_0xc537('0x28')][_0xc537('0x31')]);_0x231d49[_0xc537('0x37')]=_['keys'](_0x51b92f[_0xc537('0x37')]);_0x231d49['filters']=_[_0xc537('0x36')](_0x231d49[_0xc537('0x34')],_0x231d49[_0xc537('0x37')]);_0x3a5fb8[_0xc537('0x38')]=_[_0xc537('0x36')](_0x231d49['model'],qs['fields'](_0x51b92f['query'][_0xc537('0x39')]));_0x3a5fb8['attributes']=_0x3a5fb8[_0xc537('0x38')][_0xc537('0x51')]?_0x3a5fb8['attributes']:_0x231d49['model'];if(!_0x51b92f[_0xc537('0x37')][_0xc537('0x3a')](_0xc537('0x3b'))){_0x3a5fb8['limit']=qs[_0xc537('0x17')](_0x51b92f[_0xc537('0x37')]['limit']);_0x3a5fb8[_0xc537('0x15')]=qs[_0xc537('0x15')](_0x51b92f[_0xc537('0x37')][_0xc537('0x15')]);}_0x3a5fb8[_0xc537('0x82')]=qs[_0xc537('0x3c')](_0x51b92f[_0xc537('0x37')][_0xc537('0x3c')]);_0x3a5fb8[_0xc537('0x3d')]=qs[_0xc537('0x35')](_[_0xc537('0x3e')](_0x51b92f[_0xc537('0x37')],_0x231d49['filters']));_0x3a5fb8['where'][_0xc537('0xb3')]=_0x37bcd7['id'];if(_0x51b92f[_0xc537('0x37')][_0xc537('0x75')]){_0x3a5fb8[_0xc537('0x3d')]=_[_0xc537('0x8f')](_0x3a5fb8[_0xc537('0x3d')],{'$or':_[_0xc537('0x22')](_0x3a5fb8[_0xc537('0x38')],function(_0x5d0456){var _0x295bf9={};_0x295bf9[_0x5d0456]={'$like':'%'+_0x51b92f[_0xc537('0x37')][_0xc537('0x75')]+'%'};return _0x295bf9;})});}if(_0x51b92f[_0xc537('0x37')][_0xc537('0x6c')]){var _0x26588a=_0x51b92f['query'][_0xc537('0x6c')][_0xc537('0x26')](',');var _0x301443={};_0x301443[_0x26588a[0x0]]={'$gte':moment(_0x26588a[0x1])['format'](_0xc537('0xc2'))};_0x3a5fb8[_0xc537('0x3d')]=_[_0xc537('0x8f')](_0x3a5fb8[_0xc537('0x3d')],_0x301443);}_0x3a5fb8=_[_0xc537('0x8f')]({},_0x3a5fb8,_0x51b92f[_0xc537('0xc3')]);return db[_0xc537('0x28')][_0xc537('0x18')]({'where':_0x3a5fb8['where']})[_0xc537('0x1d')](function(_0x320bc4){_0x5bb099['count']=_0x320bc4;if(_0x51b92f[_0xc537('0x37')]['includeAll']){_0x3a5fb8['include']=[{'all':!![]}];}return db[_0xc537('0x28')][_0xc537('0xc4')](_0x3a5fb8);})[_0xc537('0x1d')](function(_0x5f5224){if(_0x51b92f[_0xc537('0x37')][_0xc537('0xc5')]===_0xc537('0xc6')){for(var _0x374cd7=0x0;_0x374cd7<_0x5f5224[_0xc537('0x51')];_0x374cd7++){_0x5f5224[_0x374cd7][_0xc537('0xbb')]=juice(_0x5f5224[_0x374cd7][_0xc537('0xbb')]);}}_0x5bb099[_0xc537('0xc7')]=_0x5f5224;return _0x5bb099;});}})[_0xc537('0x1d')](respondWithFilteredResult(_0x3b44f7,_0x3a5fb8))[_0xc537('0x2e')](handleError(_0x3b44f7,null));};exports[_0xc537('0xc8')]=function(_0x116d02,_0x20b20a){return db[_0xc537('0x30')]['find']({'where':{'id':_0x116d02[_0xc537('0xbc')]['id']}})[_0xc537('0x1d')](handleEntityNotFound(_0x20b20a,null))[_0xc537('0x1d')](function(_0x4aea12){if(_0x4aea12){return _0x4aea12['setTags'](_0x116d02[_0xc537('0xbb')][_0xc537('0xc0')],_['omit'](_0x116d02[_0xc537('0xbb')],[_0xc537('0xc0'),'id'])||{})['spread'](function(){return db[_0xc537('0x60')]['findAll']({'attributes':['id','name',_0xc537('0xc9')],'where':{'id':_0x116d02[_0xc537('0xbb')][_0xc537('0xc0')]}});})['then'](function(_0x28220b){socket[_0xc537('0xca')]('mailInteractionTags:save',{'id':Number(_0x116d02['params']['id']),'tags':_0x28220b||[]});return{'id':Number(_0x116d02[_0xc537('0xbc')]['id']),'tags':_0x28220b||[]};});}})[_0xc537('0x1d')](respondWithResult(_0x20b20a,null))[_0xc537('0x2e')](handleError(_0x20b20a,null));};exports['removeTags']=function(_0x50dd52,_0x48fc0c){return db[_0xc537('0x30')][_0xc537('0x5c')]({'where':{'id':_0x50dd52[_0xc537('0xbc')]['id']}})[_0xc537('0x1d')](handleEntityNotFound(_0x48fc0c,null))[_0xc537('0x1d')](function(_0x37ec9d){if(_0x37ec9d){return _0x37ec9d[_0xc537('0xcb')](_0x50dd52['query'][_0xc537('0xc0')]);}})[_0xc537('0x1d')](respondWithStatusCode(_0x48fc0c,null))[_0xc537('0x2e')](handleError(_0x48fc0c,null));};exports['download']=function(_0x4ee622,_0x3b8fa0){var _0x207862=moment()[_0xc537('0xcc')]()['toString']();var _0x1c2f38=path[_0xc537('0xcd')](config[_0xc537('0xce')],_0xc537('0xcf'),_0xc537('0xd0'),'tmp');var _0x35e324=path[_0xc537('0xcd')](config['root'],'server',_0xc537('0xd0'),_0xc537('0xd1'));var _0x5b9dfe=path[_0xc537('0xcd')](_0x1c2f38,_0x207862);var _0x2140bb=util['format']('transcript-%d-%s.zip',_0x4ee622['params']['id'],_0x207862);var _0x4dc94=path[_0xc537('0xcd')](_0x1c2f38,_0x2140bb);var _0x563086=[];if(_0x4ee622[_0xc537('0x37')][_0xc537('0xd1')]){_0x563086[_0xc537('0xb5')]({'model':db[_0xc537('0xd2')],'as':_0xc537('0xd3'),'raw':!![]});}var _0x83d4cd=[{'model':db['MailMessage'],'as':'Messages','attributes':['id','body',_0xc537('0x44'),'to','cc',_0xc537('0xd4'),_0xc537('0xd5'),_0xc537('0xd6')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x563086}];return db[_0xc537('0x30')][_0xc537('0x5c')]({'where':{'id':_0x4ee622[_0xc537('0xbc')]['id']},'include':_0x83d4cd})[_0xc537('0x1d')](handleEntityNotFound(_0x3b8fa0,null))[_0xc537('0x1d')](function(_0x3d9fc0){if(_0x3d9fc0&&_0x3d9fc0['Messages']){var _0x2d933d=_0x3d9fc0[_0xc537('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x5b9dfe);return BPromise['each'](_0x2d933d[_0xc537('0xd8')],function(_0x51b512,_0x13db8a){var _0x359d48={'from':_0x51b512[_0xc537('0x44')],'to':_0x51b512['to'],'subject':_0x51b512[_0xc537('0xd5')],'html':htmlEntities[_0xc537('0xd9')](_0x51b512[_0xc537('0xbb')]),'headers':{'Date':moment(_0x51b512[_0xc537('0xd6')])[_0xc537('0xda')](_0xc537('0xdb'))},'attachments':[]};if(_0x51b512['cc']){_0x359d48[_0xc537('0xdc')]['Cc']=_0x51b512['cc'];}if(_0x51b512['bcc']){_0x359d48[_0xc537('0xdc')][_0xc537('0xdd')]=_0x51b512[_0xc537('0xd4')];}return new BPromise(function(_0x1bc614,_0x47a3c2){if(_0x51b512[_0xc537('0xd3')]){for(var _0x3fb9bb=0x0;_0x3fb9bb<_0x51b512['Attachments'][_0xc537('0x51')];_0x3fb9bb++){var _0x20aef6=_0x51b512['Attachments'][_0x3fb9bb];var _0x1003dc=path[_0xc537('0xcd')](_0x35e324,_0x20aef6[_0xc537('0xde')]);if(fs[_0xc537('0xdf')](_0x1003dc)){_0x359d48[_0xc537('0xd1')]['push']({'name':_0x20aef6[_0xc537('0x20')],'contentType':_0x20aef6[_0xc537('0x33')],'data':fs[_0xc537('0xe0')](_0x1003dc)});}}}emlformat[_0xc537('0xe1')](_0x359d48,function(_0x2bdc66,_0x129328){if(_0x2bdc66)return _0x47a3c2(_0x2bdc66);fs[_0xc537('0xe2')](path[_0xc537('0xcd')](_0x5b9dfe,util[_0xc537('0xda')](_0xc537('0xe3'),_0x13db8a)),_0x129328);return _0x1bc614(_0x129328);});});})['then'](function(){return new BPromise(function(_0x511fbf,_0x476cfd){zipdir(_0x5b9dfe,{'saveTo':_0x4dc94},function(_0x2ce8f2,_0x43edf1){if(_0x2ce8f2)return _0x476cfd(_0x2ce8f2);return _0x511fbf(_0x43edf1);});})['then'](function(){return new BPromise(function(_0x12ea08,_0x41c70d){rimraf(_0x5b9dfe,function(_0x305707){if(_0x305707)_0x41c70d(_0x305707);return _0x12ea08();});});})[_0xc537('0x1d')](function(){return _0x3b8fa0['download'](_0x4dc94,_0x2140bb,function(_0xc7ec4e){if(!_0xc7ec4e)fs[_0xc537('0xe4')](_0x4dc94);});});});}else{return _0x3b8fa0[_0xc537('0x12')](0xc8);}})[_0xc537('0x2e')](handleError(_0x3b8fa0,null));}; \ No newline at end of file +var _0x9934=['`\x20>\x200','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','MailAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','sequelize','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','all','rows','show','includeAll','create','body','params','destroy','describe','addMessage','ids','nolimit','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','true','spread','color','mailInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','format','Messages','bcc','get','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','html-entities','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','update','then','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','out','plainBody','-id','trimStart','catch','index','MailInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','length','conditions','find','unreadMessages','having','`\x20=\x200'];(function(_0x5ae28c,_0x59bcb2){var _0x4ae7dd=function(_0xf4f96a){while(--_0xf4f96a){_0x5ae28c['push'](_0x5ae28c['shift']());}};_0x4ae7dd(++_0x59bcb2);}(_0x9934,0x162));var _0x4993=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x9934[_0x120123];return _0x3bec4c;};'use strict';var emlformat=require(_0x4993('0x0'));var rimraf=require(_0x4993('0x1'));var zipdir=require(_0x4993('0x2'));var moment=require(_0x4993('0x3'));var BPromise=require('bluebird');var util=require(_0x4993('0x4'));var path=require(_0x4993('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4993('0x6'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x4993('0x7'));var as=require(_0x4993('0x8'));var logger=require('../../config/logger')(_0x4993('0x9'));var config=require('../../config/environment');var db=require(_0x4993('0xa'))['db'];var htmlEntities=require(_0x4993('0xb'));config['redis']=_[_0x4993('0xc')](config[_0x4993('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4993('0xe'))(new Redis(config[_0x4993('0xd')]));require(_0x4993('0xf'))[_0x4993('0x10')](socket);function respondWithStatusCode(_0x3bf4b4,_0x288ebf){_0x288ebf=_0x288ebf||0xcc;return function(_0x60936b){if(_0x60936b){return _0x3bf4b4['sendStatus'](_0x288ebf);}return _0x3bf4b4[_0x4993('0x11')](_0x288ebf)[_0x4993('0x12')]();};}function respondWithResult(_0x4702f1,_0x1960a9){_0x1960a9=_0x1960a9||0xc8;return function(_0x2450ec){if(_0x2450ec){return _0x4702f1['status'](_0x1960a9)[_0x4993('0x13')](_0x2450ec);}};}function respondWithFilteredResult(_0x37a107,_0x1794db){return function(_0xed2cc7){if(_0xed2cc7){var _0x10bb95=typeof _0x1794db[_0x4993('0x14')]===_0x4993('0x15')&&typeof _0x1794db['limit']===_0x4993('0x15');var _0x171450=_0xed2cc7[_0x4993('0x16')];var _0x33831b=_0x10bb95?0x0:_0x1794db[_0x4993('0x14')];var _0x1d351d=_0x10bb95?_0xed2cc7[_0x4993('0x16')]:_0x1794db['offset']+_0x1794db[_0x4993('0x17')];var _0x3acb78;if(_0x1d351d>=_0x171450){_0x1d351d=_0x171450;_0x3acb78=0xc8;}else{_0x3acb78=0xce;}_0x37a107['status'](_0x3acb78);return _0x37a107[_0x4993('0x18')]('Content-Range',_0x33831b+'-'+_0x1d351d+'/'+_0x171450)[_0x4993('0x13')](_0xed2cc7);}return null;};}function saveUpdates(_0x1f39c9){return function(_0x4e7a38){if(_0x4e7a38){return _0x4e7a38[_0x4993('0x19')](_0x1f39c9)[_0x4993('0x1a')](function(_0x64c32){return _0x64c32;});}return null;};}function removeEntity(_0x1bd923){return function(_0x264260){if(_0x264260){return _0x264260['destroy']()['then'](function(){_0x1bd923[_0x4993('0x11')](0xcc)[_0x4993('0x12')]();});}};}function handleEntityNotFound(_0x1942e4){return function(_0x1d02ad){if(!_0x1d02ad){_0x1942e4[_0x4993('0x1b')](0x194);}return _0x1d02ad;};}function handleError(_0x236f65,_0x15f5c2){_0x15f5c2=_0x15f5c2||0x1f4;return function(_0x3d8ccf){logger['error'](_0x3d8ccf[_0x4993('0x1c')]);if(_0x3d8ccf[_0x4993('0x1d')]){delete _0x3d8ccf['name'];}_0x236f65[_0x4993('0x11')](_0x15f5c2)[_0x4993('0x1e')](_0x3d8ccf);};}function getInteractionUsers(_0xb809bc,_0x586af5){return new BPromise(function(_0x469133,_0x92997d){try{if(_0x586af5[_0xb809bc['id']]){_0xb809bc[_0x4993('0x1f')]=_[_0x4993('0x20')](_0x586af5[_0xb809bc['id']],function(_0x49a5b1){return{'id':_0x49a5b1['id'],'fullname':_0x49a5b1[_0x4993('0x21')]};});}}catch(_0x2e3ca4){_0x92997d(_0x2e3ca4);}_0x469133(_0xb809bc);});}function getInteractionTags(_0x494097,_0xcf2250){return new BPromise(function(_0x2af4f9,_0x940ab4){try{if(_0x494097[_0x4993('0x22')]){_0x494097[_0x4993('0x23')]=[];_0x494097['TagIds']['split'](',')[_0x4993('0x24')](function(_0x3513fa){_0x494097['Tags'][_0x4993('0x25')](_0xcf2250[_0x3513fa]);});}delete _0x494097[_0x4993('0x22')];}catch(_0x23c8c9){_0x940ab4(_0x23c8c9);}_0x2af4f9(_0x494097);});}function getLastMessageText(_0x378bb1){return new BPromise(function(_0x31ef78,_0x39a79b){return db[_0x4993('0x26')][_0x4993('0x27')]({'where':{'$and':[{'MailInteractionId':_0x378bb1['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4993('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4993('0x29')],'order':_0x4993('0x2a'),'raw':!![]})[_0x4993('0x1a')](function(_0x417b44){if(_0x417b44&&_0x417b44[_0x4993('0x29')]){_0x378bb1['lastMsgText']=_[_0x4993('0x2b')](_0x417b44['plainBody']);}_0x31ef78(_0x378bb1);})[_0x4993('0x2c')](function(_0xcdbc26){_0x39a79b(_0xcdbc26);});});}function updateMailInteraction(_0x46434e,_0x54c492,_0x2f1ea0,_0x21ca1f){return new BPromise(function(_0x2e464a,_0x36ff6a){return getInteractionUsers(_0x46434e,_0x2f1ea0)['then'](function(_0x983142){return getInteractionTags(_0x983142,_0x54c492);})['then'](function(_0x4ad138){if(_0x21ca1f){_0x2e464a(getLastMessageText(_0x4ad138));}else{_0x2e464a(_0x4ad138);}})[_0x4993('0x2c')](function(_0x244a4d){_0x36ff6a(_0x244a4d);});});}exports[_0x4993('0x2d')]=function(_0x5ad0a9,_0x57dd0f){var _0x287c68={},_0x5d3c1b={},_0x203b29={'count':0x0,'rows':[]};var _0x8e5ae=_[_0x4993('0x20')](db[_0x4993('0x2e')][_0x4993('0x2f')],function(_0xc1d1e4){return{'name':_0xc1d1e4['fieldName'],'type':_0xc1d1e4[_0x4993('0x30')][_0x4993('0x31')]};});_0x5d3c1b[_0x4993('0x32')]=_[_0x4993('0x20')](_0x8e5ae,_0x4993('0x1d'));_0x5d3c1b[_0x4993('0x33')]=_[_0x4993('0x34')](_0x5ad0a9[_0x4993('0x33')]);_0x5d3c1b[_0x4993('0x35')]=_[_0x4993('0x36')](_0x5d3c1b[_0x4993('0x32')],_0x5d3c1b[_0x4993('0x33')]);_0x287c68[_0x4993('0x37')]=_[_0x4993('0x36')](_0x5d3c1b[_0x4993('0x32')],qs[_0x4993('0x38')](_0x5ad0a9['query'][_0x4993('0x38')]));_0x287c68[_0x4993('0x37')]=_0x287c68[_0x4993('0x37')]['length']?_0x287c68[_0x4993('0x37')]:_0x5d3c1b[_0x4993('0x32')];if(!_0x5ad0a9['query'][_0x4993('0x39')]('nolimit')){_0x287c68['limit']=qs[_0x4993('0x17')](_0x5ad0a9[_0x4993('0x33')][_0x4993('0x17')]);_0x287c68[_0x4993('0x14')]=qs[_0x4993('0x14')](_0x5ad0a9[_0x4993('0x33')][_0x4993('0x14')]);}_0x287c68[_0x4993('0x3a')]=qs[_0x4993('0x3b')](_0x5ad0a9['query'][_0x4993('0x3b')]);_0x287c68[_0x4993('0x3c')]=qs['filters'](_[_0x4993('0x3d')](_0x5ad0a9[_0x4993('0x33')],_0x5d3c1b['filters']),_0x8e5ae);var _0x372ed7=[];var _0x4dd61c=squel[_0x4993('0x3e')]()[_0x4993('0x3f')]('id')['field'](_0x4993('0x1d'))[_0x4993('0x3f')]('color')[_0x4993('0x40')](_0x4993('0x41'));var _0x19638f=squel['select']()['field'](_0x4993('0x42'))['field'](_0x4993('0x43'))[_0x4993('0x3f')](_0x4993('0x44'))[_0x4993('0x40')]('user_has_mail_interactions','ui')[_0x4993('0x45')](_0x4993('0x46'),'u','u.id\x20=\x20ui.UserId');var _0x4fae30=squel['select']()[_0x4993('0x40')](_0x4993('0x47'),'i')[_0x4993('0x45')](_0x4993('0x48'),'c',_0x4993('0x49'))['left_join']('users','o',_0x4993('0x4a'))[_0x4993('0x45')](_0x4993('0x4b'),'a',_0x4993('0x4c'))['left_join'](_0x4993('0x4d'),'me','me.MailInteractionId\x20=\x20i.id')['left_join']('mail_interaction_has_tags','it',_0x4993('0x4e'))[_0x4993('0x45')](_0x4993('0x41'),'t',_0x4993('0x4f'));var _0x412d9e=squel[_0x4993('0x50')]();var _0x328a75=[];var _0x3e5f69=squel[_0x4993('0x50')]();var _0x52fa23;if(_0x5ad0a9[_0x4993('0x33')]['search']){_0x52fa23=as[_0x4993('0x51')](_0x5ad0a9[_0x4993('0x33')][_0x4993('0x52')]);var _0x1bf82d=_0x52fa23[_0x4993('0x53')];for(var _0x2cabe8=0x0;_0x2cabe8<_0x52fa23['conditions'][_0x4993('0x54')];_0x2cabe8++){var _0x42f956=_0x52fa23[_0x4993('0x55')][_0x2cabe8];var _0x363708='i';var _0x3fe20e=_[_0x4993('0x56')](_0x8e5ae,[_0x4993('0x1d'),_0x42f956[_0x4993('0x3f')]]);if(!_0x3fe20e){switch(_0x42f956['field']){case _0x4993('0x57'):if(_0x42f956['value']==0x1){_0x4fae30[_0x4993('0x58')]('`'+_0x42f956[_0x4993('0x3f')]+_0x4993('0x59'));}else{_0x4fae30[_0x4993('0x58')]('`'+_0x42f956[_0x4993('0x3f')]+_0x4993('0x5a'));}break;case'Contact':if(_0x42f956[_0x4993('0x5b')]===_0x4993('0x5c')){if(_0x42f956[_0x4993('0x5d')][_0x4993('0x5e')]('\x20')[_0x4993('0x54')]>0x1){_0x412d9e[_0x1bf82d](_0x4993('0x5f'),qs[_0x4993('0x60')](_0x42f956[_0x4993('0x5d')]),null);}else{var _0x24295a='%'+_0x42f956[_0x4993('0x5d')]+'%';_0x412d9e[_0x1bf82d](_0x4993('0x61'),_0x24295a,_0x24295a,_0x24295a);}}else{_0x3fe20e=_[_0x4993('0x56')](_0x8e5ae,[_0x4993('0x1d'),_0x4993('0x62')]);_0x42f956[_0x4993('0x3f')]='ContactId';_0x256025=as[_0x4993('0x63')](_0x363708,_0x3fe20e['type'],_0x42f956);_0x412d9e[_0x1bf82d](_0x256025[_0x4993('0x64')],_0x256025['value'][_0x4993('0x65')],_0x256025[_0x4993('0x5d')][_0x4993('0x12')]);}break;case _0x4993('0x66'):var _0x3b9006=_0x42f956[_0x4993('0x5d')][_0x4993('0x5e')](',')['map'](function(_0x1f2508){return Number(_0x1f2508);});_0x3b9006[_0x4993('0x24')](function(_0x11efb8){_0x3e5f69['or'](_0x4993('0x67'),'%,'+_0x11efb8+',%');});_0x328a75=_[_0x4993('0x68')](_0x328a75,_0x3b9006);break;case _0x4993('0x69'):if(_0x42f956[_0x4993('0x5b')]===_0x4993('0x5c')){_0x412d9e[_0x1bf82d](_0x4993('0x6a'),'%'+_0x42f956[_0x4993('0x5d')]+'%',null);}else{_0x3fe20e=_['find'](_0x8e5ae,['name',_0x4993('0x6b')]);_0x42f956[_0x4993('0x3f')]='UserId';_0x256025=as[_0x4993('0x63')](_0x363708,_0x3fe20e['type'],_0x42f956);_0x412d9e[_0x1bf82d](_0x256025[_0x4993('0x64')],_0x256025['value'][_0x4993('0x65')],_0x256025['value'][_0x4993('0x12')]);}break;case'plainBody':_0x256025=as[_0x4993('0x63')]('me',null,_0x42f956);_0x412d9e[_0x1bf82d](_0x256025[_0x4993('0x64')],_0x256025[_0x4993('0x5d')]['start'],_0x256025[_0x4993('0x5d')]['end']);break;}}else{var _0x256025=as[_0x4993('0x63')](_0x363708,_0x3fe20e[_0x4993('0x30')],_0x42f956);_0x412d9e[_0x1bf82d](_0x256025[_0x4993('0x64')],_0x256025['value'][_0x4993('0x65')],_0x256025[_0x4993('0x5d')][_0x4993('0x12')]);}}}else{var _0x30a357=_(_0x5ad0a9[_0x4993('0x33')])[_0x4993('0x34')]()[_0x4993('0x20')](function(_0x5bf366){return _[_0x4993('0x6c')](_0x8e5ae,[_0x4993('0x1d'),_0x5bf366])?_0x5bf366:undefined;})['compact']()[_0x4993('0x5d')]();if(!_[_0x4993('0x6d')](_0x30a357)){_0x30a357[_0x4993('0x24')](function(_0x2ad521){if(_0x2ad521===_0x4993('0x6e')){_0x4fae30[_0x4993('0x3c')]('i.MailAccountId\x20IN\x20?',[][_0x4993('0x6f')](_0x5ad0a9[_0x4993('0x33')][_0x2ad521]));}else if(_0x2ad521===_0x4993('0x70')){var _0x2fbdcf=JSON[_0x4993('0x71')](_0x5ad0a9['query'][_0x2ad521])[_0x4993('0x72')];var _0x36395b=JSON[_0x4993('0x71')](_0x5ad0a9[_0x4993('0x33')][_0x2ad521])['$lte'];_0x4fae30['where'](_0x4993('0x73'),_0x2fbdcf,_0x36395b);}else{if(_0x5ad0a9[_0x4993('0x33')][_0x2ad521]==='null'){_0x4fae30[_0x4993('0x3c')]('i.'+_0x2ad521+_0x4993('0x74'));}else{_0x4fae30[_0x4993('0x3c')]('i.'+_0x2ad521+_0x4993('0x75'),_0x5ad0a9[_0x4993('0x33')][_0x2ad521]);}}});}if(_0x5ad0a9[_0x4993('0x33')]['read']){if(_0x5ad0a9[_0x4993('0x33')][_0x4993('0x76')]==0x1){_0x4fae30['having'](_0x4993('0x77'));}else{_0x4fae30[_0x4993('0x58')](_0x4993('0x78'));}}if(_0x5ad0a9['query'][_0x4993('0x79')]){_0x328a75=_[_0x4993('0x7a')](_0x5ad0a9['query'][_0x4993('0x79')])?_0x5ad0a9[_0x4993('0x33')][_0x4993('0x79')]:new Array(_0x5ad0a9[_0x4993('0x33')][_0x4993('0x79')]);_0x328a75[_0x4993('0x24')](function(_0x5164ea){_0x3e5f69['or'](_0x4993('0x67'),'%,'+_0x5164ea+',%');});}if(_0x5ad0a9[_0x4993('0x33')][_0x4993('0x7b')]){var _0x5de66b=_0x5ad0a9['query'][_0x4993('0x7b')][_0x4993('0x7c')]('\x5c','\x5c\x5c')[_0x4993('0x7c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5de66b)){_0x412d9e['or'](_0x4993('0x7d'),_0x5de66b+'%');}else if(qs[_0x4993('0x7e')](_0x5de66b)){_0x412d9e['or']('c.email\x20LIKE\x20?',_0x5de66b+'%');}else{_0x412d9e['or'](_0x4993('0x7f'),qs[_0x4993('0x60')](_0x5de66b))['or'](_0x4993('0x80'),qs[_0x4993('0x60')](_0x5de66b));}}}_0x4fae30[_0x4993('0x3c')](_0x412d9e);_0x4fae30[_0x4993('0x81')]('i.id');var _0x202402={'type':db[_0x4993('0x82')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3702c6=_0x4fae30[_0x4993('0x83')]();_0x3702c6['field'](_0x4993('0x84'));_0x3702c6['field'](_0x4993('0x85'),'unreadMessages');if(_0x287c68[_0x4993('0x3a')]){_0x287c68[_0x4993('0x3a')][_0x4993('0x24')](function(_0x2e24ac){var _0x23ac05=_0x2e24ac[0x0]==='contactName'?_0x2e24ac[0x0]:'i.'+_0x2e24ac[0x0];_0x4fae30[_0x4993('0x3a')](_0x23ac05,_0x2e24ac[0x1]===_0x4993('0x86')?![]:!![]);});}if(!_[_0x4993('0x6d')](_0x328a75)){_0x4fae30['having'](_0x3e5f69);_0x3702c6[_0x4993('0x3c')](_0x4993('0x87'),_0x328a75);}BPromise[_0x4993('0x88')]()[_0x4993('0x1a')](function(){if(!_0x52fa23){if(_0x5ad0a9[_0x4993('0x33')][_0x4993('0x6e')])return;_0x3702c6[_0x4993('0x3c')](_0x4993('0x89'));_0x4fae30[_0x4993('0x3c')](_0x4993('0x89'));return;}if(_0x5ad0a9[_0x4993('0x8a')]['role']!==_0x4993('0x8b'))return;return _0x5ad0a9[_0x4993('0x8a')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x4993('0x1a')](function(_0x5085d4){if(_['isEmpty'](_0x5085d4)){_0x3702c6['where'](_0x4993('0x8c'));_0x4fae30[_0x4993('0x3c')]('i.MailAccountId\x20IS\x20NULL');}else{_0x3702c6[_0x4993('0x3c')](_0x4993('0x8d'),_[_0x4993('0x20')](_0x5085d4,'id'));_0x4fae30['where']('i.MailAccountId\x20IN\x20?',_['map'](_0x5085d4,'id'));}});})['then'](function(){if(_0x5ad0a9[_0x4993('0x8a')]['role']===_0x4993('0x8b')&&!_0x52fa23&&!_0x5ad0a9[_0x4993('0x33')][_0x4993('0x6e')])return[];return db['sequelize'][_0x4993('0x33')](_0x3702c6[_0x4993('0x8e')](),_0x202402);})[_0x4993('0x1a')](function(_0x5ecb2b){_0x203b29['count']=_0x5ecb2b[_0x4993('0x54')];if(_0x203b29[_0x4993('0x16')]===0x0)return[];return db[_0x4993('0x8f')][_0x4993('0x33')](_0x4dd61c[_0x4993('0x8e')](),_0x202402)['then'](function(_0x34087c){_0x372ed7=_['keyBy'](_0x34087c,'id');_0x202402=_[_0x4993('0x90')](_0x202402,{'model':db[_0x4993('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5ad0a9[_0x4993('0x33')][_0x4993('0x38')]){_0x287c68['attributes'][_0x4993('0x24')](function(_0x5f3cd6){_0x4fae30['field']('i.'+_0x5f3cd6);});}else{_0x4fae30['field'](_0x4993('0x85'),_0x4993('0x57'));_0x4fae30['field']('a.key',_0x4993('0x91'));_0x4fae30['field'](_0x4993('0x92'),_0x4993('0x93'));_0x4fae30[_0x4993('0x3f')](_0x4993('0x94'),'contactName');_0x4fae30['field'](_0x4993('0x84'));_0x4fae30[_0x4993('0x3f')]('i.createdAt');_0x4fae30['field'](_0x4993('0x95'));_0x4fae30['field'](_0x4993('0x96'));_0x4fae30[_0x4993('0x3f')](_0x4993('0x97'));_0x4fae30[_0x4993('0x3f')]('i.attach');_0x4fae30[_0x4993('0x3f')]('i.lastMsgAt');_0x4fae30[_0x4993('0x3f')](_0x4993('0x98'));_0x4fae30[_0x4993('0x3f')]('i.subject');_0x4fae30[_0x4993('0x3f')](_0x4993('0x99'));_0x4fae30[_0x4993('0x3f')]('i.secondDisposition');_0x4fae30[_0x4993('0x3f')](_0x4993('0x9a'));_0x4fae30['field'](_0x4993('0x9b'));_0x4fae30['field'](_0x4993('0x9c'));_0x4fae30[_0x4993('0x3f')](_0x4993('0x9d'));_0x4fae30[_0x4993('0x3f')]('i.MailAccountId');_0x4fae30['field']('i.UserId');_0x4fae30[_0x4993('0x3f')](_0x4993('0x9e'),_0x4993('0x9f'));_0x4fae30[_0x4993('0x3f')](_0x4993('0xa0'),_0x4993('0xa1'));_0x4fae30[_0x4993('0x3f')](_0x4993('0xa2'),'Contact.email');_0x4fae30[_0x4993('0x3f')]('c.phone',_0x4993('0xa3'));_0x4fae30['field'](_0x4993('0xa4'),_0x4993('0xa5'));_0x4fae30[_0x4993('0x3f')]('c.fax',_0x4993('0xa6'));_0x4fae30['field']('o.fullname',_0x4993('0xa7'));_0x4fae30['field'](_0x4993('0xa8'),_0x4993('0xa9'));_0x4fae30[_0x4993('0x3f')](_0x4993('0xaa'),_0x4993('0x22'));}if(_0x287c68[_0x4993('0x17')])_0x4fae30[_0x4993('0x17')](_0x287c68['limit']);if(_0x287c68[_0x4993('0x14')])_0x4fae30[_0x4993('0x14')](_0x287c68[_0x4993('0x14')]);return db['sequelize']['query'](_0x4fae30[_0x4993('0x8e')](),_0x202402);})[_0x4993('0x1a')](function(_0x35adda){if(_0x35adda[_0x4993('0x54')]>0x0)_0x19638f[_0x4993('0x3c')](_0x4993('0xab'),_[_0x4993('0x20')](_0x35adda,'id'));return db['sequelize'][_0x4993('0x33')](_0x19638f[_0x4993('0x8e')](),_0x202402)[_0x4993('0x1a')](function(_0x3bf7fd){var _0x527a0b=_['groupBy'](_0x3bf7fd,_0x4993('0xac'));var _0x1e04de=[];return db[_0x4993('0xad')][_0x4993('0x27')]({'attributes':[_0x4993('0xae')],'raw':!![]})[_0x4993('0x1a')](function(_0x471a12){var _0x22a720=_0x471a12[_0x4993('0xae')];_0x35adda[_0x4993('0x24')](function(_0x28a883){_0x1e04de[_0x4993('0x25')](updateMailInteraction(_0x28a883,_0x372ed7,_0x527a0b,_0x22a720));});return BPromise[_0x4993('0xaf')](_0x1e04de);});});});})[_0x4993('0x1a')](function(_0xbbaa42){_0x203b29[_0x4993('0xb0')]=_0xbbaa42;return _0x203b29;})['then'](respondWithFilteredResult(_0x57dd0f,_0x287c68))[_0x4993('0x2c')](handleError(_0x57dd0f,null));};exports[_0x4993('0xb1')]=function(_0x526b9e,_0xe59e3a){var _0x884349={'raw':![],'where':{'id':_0x526b9e['params']['id']}},_0x3fec40={};_0x3fec40[_0x4993('0x32')]=_[_0x4993('0x34')](db[_0x4993('0x2e')]['rawAttributes']);_0x3fec40['query']=_[_0x4993('0x34')](_0x526b9e['query']);_0x3fec40[_0x4993('0x35')]=_[_0x4993('0x36')](_0x3fec40[_0x4993('0x32')],_0x3fec40[_0x4993('0x33')]);_0x884349[_0x4993('0x37')]=_['intersection'](_0x3fec40[_0x4993('0x32')],qs[_0x4993('0x38')](_0x526b9e[_0x4993('0x33')][_0x4993('0x38')]));_0x884349['attributes']=_0x884349[_0x4993('0x37')][_0x4993('0x54')]?_0x884349['attributes']:_0x3fec40[_0x4993('0x32')];if(_0x526b9e[_0x4993('0x33')][_0x4993('0xb2')]){_0x884349['include']=[{'all':!![]}];}_0x884349=_[_0x4993('0x90')]({},_0x884349,_0x526b9e['options']);return db[_0x4993('0x2e')][_0x4993('0x56')](_0x884349)[_0x4993('0x1a')](handleEntityNotFound(_0xe59e3a,null))['then'](respondWithResult(_0xe59e3a,null))[_0x4993('0x2c')](handleError(_0xe59e3a,null));};exports['create']=function(_0x223192,_0x452a02){return db[_0x4993('0x2e')][_0x4993('0xb3')](_0x223192['body'],{})['then'](respondWithResult(_0x452a02,0xc9))[_0x4993('0x2c')](handleError(_0x452a02,null));};exports[_0x4993('0x19')]=function(_0x505b14,_0x23c94d){if(_0x505b14[_0x4993('0xb4')]['id']){delete _0x505b14[_0x4993('0xb4')]['id'];}return db['MailInteraction'][_0x4993('0x56')]({'where':{'id':_0x505b14[_0x4993('0xb5')]['id']}})[_0x4993('0x1a')](handleEntityNotFound(_0x23c94d,null))[_0x4993('0x1a')](saveUpdates(_0x505b14[_0x4993('0xb4')],null))[_0x4993('0x1a')](respondWithResult(_0x23c94d,null))[_0x4993('0x2c')](handleError(_0x23c94d,null));};exports[_0x4993('0xb6')]=function(_0x45e215,_0x1f1cbe){return db[_0x4993('0x2e')][_0x4993('0x56')]({'where':{'id':_0x45e215[_0x4993('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1f1cbe,null))[_0x4993('0x1a')](removeEntity(_0x1f1cbe,null))['catch'](handleError(_0x1f1cbe,null));};exports[_0x4993('0xb7')]=function(_0x355d6b,_0x6eb606){return db[_0x4993('0x2e')]['describe']()[_0x4993('0x1a')](respondWithResult(_0x6eb606,null))[_0x4993('0x2c')](handleError(_0x6eb606,null));};exports[_0x4993('0xb8')]=function(_0x1e40ed,_0x216360){return db[_0x4993('0x26')][_0x4993('0x56')]({'where':{'id':_0x1e40ed[_0x4993('0xb5')]['id']}})[_0x4993('0x1a')](handleEntityNotFound(_0x216360,null))['then'](function(_0x11f6f9){if(_0x11f6f9){return _0x11f6f9[_0x4993('0xb8')](_0x1e40ed[_0x4993('0xb4')][_0x4993('0xb9')],_['omit'](_0x1e40ed['body'],[_0x4993('0xb9'),'id'])||{});}})[_0x4993('0x1a')](respondWithResult(_0x216360,null))[_0x4993('0x2c')](handleError(_0x216360,null));};exports['getMessages']=function(_0x415ea3,_0x5b33ea){var _0x440d4e={'raw':![],'where':{}};var _0x53da7e={};var _0x2bab0c={'count':0x0,'rows':[]};return db[_0x4993('0x2e')][_0x4993('0x27')]({'where':{'id':_0x415ea3[_0x4993('0xb5')]['id']}})[_0x4993('0x1a')](handleEntityNotFound(_0x5b33ea,null))[_0x4993('0x1a')](function(_0x368666){if(_0x368666){_0x53da7e['model']=_['keys'](db[_0x4993('0x26')]['rawAttributes']);_0x53da7e[_0x4993('0x33')]=_['keys'](_0x415ea3['query']);_0x53da7e['filters']=_['intersection'](_0x53da7e[_0x4993('0x32')],_0x53da7e[_0x4993('0x33')]);_0x440d4e[_0x4993('0x37')]=_[_0x4993('0x36')](_0x53da7e[_0x4993('0x32')],qs[_0x4993('0x38')](_0x415ea3[_0x4993('0x33')][_0x4993('0x38')]));_0x440d4e[_0x4993('0x37')]=_0x440d4e[_0x4993('0x37')][_0x4993('0x54')]?_0x440d4e['attributes']:_0x53da7e[_0x4993('0x32')];if(!_0x415ea3[_0x4993('0x33')]['hasOwnProperty'](_0x4993('0xba'))){_0x440d4e[_0x4993('0x17')]=qs['limit'](_0x415ea3[_0x4993('0x33')][_0x4993('0x17')]);_0x440d4e['offset']=qs[_0x4993('0x14')](_0x415ea3[_0x4993('0x33')][_0x4993('0x14')]);}_0x440d4e['order']=qs[_0x4993('0x3b')](_0x415ea3[_0x4993('0x33')]['sort']);_0x440d4e['where']=qs[_0x4993('0x35')](_[_0x4993('0x3d')](_0x415ea3[_0x4993('0x33')],_0x53da7e[_0x4993('0x35')]));_0x440d4e['where']['MailInteractionId']=_0x368666['id'];if(_0x415ea3[_0x4993('0x33')][_0x4993('0x7b')]){_0x440d4e[_0x4993('0x3c')]=_[_0x4993('0x90')](_0x440d4e['where'],{'$or':_['map'](_0x440d4e[_0x4993('0x37')],function(_0x2c5d53){var _0x5c5ec5={};_0x5c5ec5[_0x2c5d53]={'$like':'%'+_0x415ea3[_0x4993('0x33')][_0x4993('0x7b')]+'%'};return _0x5c5ec5;})});}if(_0x415ea3[_0x4993('0x33')][_0x4993('0x72')]){var _0x389716=_0x415ea3[_0x4993('0x33')][_0x4993('0x72')]['split'](',');var _0xf31088={};_0xf31088[_0x389716[0x0]]={'$gte':moment(_0x389716[0x1])['format'](_0x4993('0xbb'))};_0x440d4e[_0x4993('0x3c')]=_[_0x4993('0x90')](_0x440d4e['where'],_0xf31088);}_0x440d4e=_[_0x4993('0x90')]({},_0x440d4e,_0x415ea3[_0x4993('0xbc')]);return db[_0x4993('0x26')]['count']({'where':_0x440d4e[_0x4993('0x3c')]})[_0x4993('0x1a')](function(_0x95f204){_0x2bab0c[_0x4993('0x16')]=_0x95f204;if(_0x415ea3['query'][_0x4993('0xb2')]){_0x440d4e[_0x4993('0xbd')]=[{'all':!![]}];}return db[_0x4993('0x26')][_0x4993('0xbe')](_0x440d4e);})[_0x4993('0x1a')](function(_0x4f5e27){if(_0x415ea3[_0x4993('0x33')]['inlineCss']===_0x4993('0xbf')){for(var _0x1d3d13=0x0;_0x1d3d13<_0x4f5e27[_0x4993('0x54')];_0x1d3d13++){_0x4f5e27[_0x1d3d13][_0x4993('0xb4')]=juice(_0x4f5e27[_0x1d3d13]['body']);}}_0x2bab0c['rows']=_0x4f5e27;return _0x2bab0c;});}})['then'](respondWithFilteredResult(_0x5b33ea,_0x440d4e))[_0x4993('0x2c')](handleError(_0x5b33ea,null));};exports['addTags']=function(_0x90ea6,_0x26e9f7){return db[_0x4993('0x2e')][_0x4993('0x56')]({'where':{'id':_0x90ea6['params']['id']}})[_0x4993('0x1a')](handleEntityNotFound(_0x26e9f7,null))[_0x4993('0x1a')](function(_0x53be72){if(_0x53be72){return _0x53be72['setTags'](_0x90ea6['body'][_0x4993('0xb9')],_['omit'](_0x90ea6['body'],[_0x4993('0xb9'),'id'])||{})[_0x4993('0xc0')](function(){return db[_0x4993('0x66')][_0x4993('0xbe')]({'attributes':['id',_0x4993('0x1d'),_0x4993('0xc1')],'where':{'id':_0x90ea6['body']['ids']}});})[_0x4993('0x1a')](function(_0x341b5e){socket['emit'](_0x4993('0xc2'),{'id':Number(_0x90ea6['params']['id']),'tags':_0x341b5e||[]});return{'id':Number(_0x90ea6[_0x4993('0xb5')]['id']),'tags':_0x341b5e||[]};});}})[_0x4993('0x1a')](respondWithResult(_0x26e9f7,null))[_0x4993('0x2c')](handleError(_0x26e9f7,null));};exports[_0x4993('0xc3')]=function(_0xcb8bd,_0x1b525a){return db['MailInteraction']['find']({'where':{'id':_0xcb8bd[_0x4993('0xb5')]['id']}})[_0x4993('0x1a')](handleEntityNotFound(_0x1b525a,null))['then'](function(_0x3849fe){if(_0x3849fe){return _0x3849fe[_0x4993('0xc3')](_0xcb8bd[_0x4993('0x33')][_0x4993('0xb9')]);}})[_0x4993('0x1a')](respondWithStatusCode(_0x1b525a,null))[_0x4993('0x2c')](handleError(_0x1b525a,null));};exports['download']=function(_0x16fca0,_0x31203d){var _0x18e5fa=moment()[_0x4993('0xc4')]()['toString']();var _0x16eac1=path['join'](config[_0x4993('0xc5')],_0x4993('0xc6'),_0x4993('0xc7'),_0x4993('0xc8'));var _0x4f98fe=path[_0x4993('0xc9')](config[_0x4993('0xc5')],_0x4993('0xc6'),_0x4993('0xc7'),_0x4993('0xca'));var _0x1e6b3b=path[_0x4993('0xc9')](_0x16eac1,_0x18e5fa);var _0x2a0f93=util[_0x4993('0xcb')]('transcript-%d-%s.zip',_0x16fca0[_0x4993('0xb5')]['id'],_0x18e5fa);var _0x59a043=path['join'](_0x16eac1,_0x2a0f93);var _0x2c6bd4=[];if(_0x16fca0['query'][_0x4993('0xca')]){_0x2c6bd4[_0x4993('0x25')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x3cfeb6=[{'model':db[_0x4993('0x26')],'as':_0x4993('0xcc'),'attributes':['id',_0x4993('0xb4'),_0x4993('0x40'),'to','cc',_0x4993('0xcd'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x4993('0x3b')]('id'),'include':_0x2c6bd4}];return db[_0x4993('0x2e')][_0x4993('0x56')]({'where':{'id':_0x16fca0[_0x4993('0xb5')]['id']},'include':_0x3cfeb6})[_0x4993('0x1a')](handleEntityNotFound(_0x31203d,null))['then'](function(_0x53af43){if(_0x53af43&&_0x53af43[_0x4993('0xcc')]){var _0x26e5ff=_0x53af43[_0x4993('0xce')]({'plain':!![]});fs['mkdirSync'](_0x1e6b3b);return BPromise[_0x4993('0xcf')](_0x26e5ff['Messages'],function(_0x363ea3,_0x1c68b7){var _0x8e6c6f={'from':_0x363ea3[_0x4993('0x40')],'to':_0x363ea3['to'],'subject':_0x363ea3[_0x4993('0xd0')],'html':htmlEntities[_0x4993('0xd1')](_0x363ea3['body']),'headers':{'Date':moment(_0x363ea3[_0x4993('0x70')])[_0x4993('0xcb')](_0x4993('0xd2'))},'attachments':[]};if(_0x363ea3['cc']){_0x8e6c6f[_0x4993('0xd3')]['Cc']=_0x363ea3['cc'];}if(_0x363ea3[_0x4993('0xcd')]){_0x8e6c6f['headers'][_0x4993('0xd4')]=_0x363ea3[_0x4993('0xcd')];}return new BPromise(function(_0x4ada4d,_0x51cdee){if(_0x363ea3[_0x4993('0xd5')]){for(var _0x3065fc=0x0;_0x3065fc<_0x363ea3[_0x4993('0xd5')][_0x4993('0x54')];_0x3065fc++){var _0x577815=_0x363ea3[_0x4993('0xd5')][_0x3065fc];var _0x1d63c8=path['join'](_0x4f98fe,_0x577815[_0x4993('0xd6')]);if(fs[_0x4993('0xd7')](_0x1d63c8)){_0x8e6c6f[_0x4993('0xca')][_0x4993('0x25')]({'name':_0x577815[_0x4993('0x1d')],'contentType':_0x577815[_0x4993('0x30')],'data':fs[_0x4993('0xd8')](_0x1d63c8)});}}}emlformat[_0x4993('0xd9')](_0x8e6c6f,function(_0x96e1f2,_0x4dcb20){if(_0x96e1f2)return _0x51cdee(_0x96e1f2);fs[_0x4993('0xda')](path[_0x4993('0xc9')](_0x1e6b3b,util[_0x4993('0xcb')](_0x4993('0xdb'),_0x1c68b7)),_0x4dcb20);return _0x4ada4d(_0x4dcb20);});});})[_0x4993('0x1a')](function(){return new BPromise(function(_0x436c57,_0x37ce71){zipdir(_0x1e6b3b,{'saveTo':_0x59a043},function(_0x3f859a,_0x402a71){if(_0x3f859a)return _0x37ce71(_0x3f859a);return _0x436c57(_0x402a71);});})[_0x4993('0x1a')](function(){return new BPromise(function(_0x34acdc,_0x2ad236){rimraf(_0x1e6b3b,function(_0x53fa43){if(_0x53fa43)_0x2ad236(_0x53fa43);return _0x34acdc();});});})['then'](function(){return _0x31203d[_0x4993('0xdc')](_0x59a043,_0x2a0f93,function(_0x534176){if(!_0x534176)fs[_0x4993('0xdd')](_0x59a043);});});});}else{return _0x31203d[_0x4993('0x1b')](0xc8);}})['catch'](handleError(_0x31203d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3aca7e8..683bf4e 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 _0x5980=['../../mysqldb','MailMessage','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5980,0x1f2));var _0x0598=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x5980[_0x38537f];return _0x141e23;};'use strict';var EventEmitter=require(_0x0598('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x0598('0x1')];var MailMessage=require(_0x0598('0x2'))['db'][_0x0598('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0598('0x4'),'afterUpdate':_0x0598('0x5'),'afterDestroy':_0x0598('0x6')};function emitEvent(_0x61d1b3){return function(_0x17b49b,_0x148f48,_0x5e08c0){_0x17b49b[_0x0598('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4f4f37){_0x17b49b[_0x0598('0x8')](_0x0598('0x9'),_0x4f4f37[_0x0598('0xa')](function(_0x2e0b52){return{'id':_0x2e0b52['id']};}));return MailMessage[_0x0598('0xb')]({'where':{'MailInteractionId':_0x17b49b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0598('0xc')](function(_0x31e193){_0x17b49b[_0x0598('0x8')](_0x0598('0xd'),_0x31e193[_0x0598('0xe')]);MailInteractionEvents[_0x0598('0xf')](_0x61d1b3+':'+_0x17b49b['id'],_0x17b49b);MailInteractionEvents[_0x0598('0xf')](_0x61d1b3,_0x17b49b);_0x5e08c0(null);})[_0x0598('0x10')](_0x5e08c0(null));};}for(var e in events){if(events[_0x0598('0x11')](e)){var event=events[e];MailInteraction[_0x0598('0x12')](e,emitEvent(event));}}module[_0x0598('0x13')]=MailInteractionEvents; \ No newline at end of file +var _0xf181=['save','update','remove','then','Users','map','setDataValue','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','setMaxListeners'];(function(_0x17df64,_0x3455e5){var _0x368031=function(_0x4ff31c){while(--_0x4ff31c){_0x17df64['push'](_0x17df64['shift']());}};_0x368031(++_0x3455e5);}(_0xf181,0x6c));var _0x1f18=function(_0xa59345,_0x86f01c){_0xa59345=_0xa59345-0x0;var _0x22fc32=_0xf181[_0xa59345];return _0x22fc32;};'use strict';var EventEmitter=require(_0x1f18('0x0'));var MailInteraction=require(_0x1f18('0x1'))['db'][_0x1f18('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1f18('0x3')](0x0);var events={'afterCreate':_0x1f18('0x4'),'afterUpdate':_0x1f18('0x5'),'afterDestroy':_0x1f18('0x6')};function emitEvent(_0x236434){return function(_0x5add59,_0x1f386c,_0x446163){_0x5add59['getUsers']({'attributes':['id'],'raw':!![]})[_0x1f18('0x7')](function(_0x2c05ba){_0x5add59['setDataValue'](_0x1f18('0x8'),_0x2c05ba[_0x1f18('0x9')](function(_0x5da7fc){return{'id':_0x5da7fc['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5add59['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1f18('0x7')](function(_0x41bc8b){_0x5add59[_0x1f18('0xa')]('unreadMessages',_0x41bc8b[_0x1f18('0xb')]);MailInteractionEvents[_0x1f18('0xc')](_0x236434+':'+_0x5add59['id'],_0x5add59);MailInteractionEvents[_0x1f18('0xc')](_0x236434,_0x5add59);_0x446163(null);})[_0x1f18('0xd')](_0x446163(null));};}for(var e in events){if(events[_0x1f18('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x1f18('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 9f80ded..a58d624 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 _0x0027=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','get','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x0027,0x129));var _0x7002=function(_0x42826e,_0x538edc){_0x42826e=_0x42826e-0x0;var _0x3661cd=_0x0027[_0x42826e];return _0x3661cd;};'use strict';var _=require(_0x7002('0x0'));var util=require(_0x7002('0x1'));var logger=require(_0x7002('0x2'))('api');var moment=require(_0x7002('0x3'));var BPromise=require(_0x7002('0x4'));var rp=require(_0x7002('0x5'));var fs=require('fs');var path=require(_0x7002('0x6'));var rimraf=require(_0x7002('0x7'));var config=require(_0x7002('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x7002('0x9')]=function(_0x4b16aa,_0x2463e5){return _0x4b16aa[_0x7002('0xa')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7002('0xb'),'fields':[_0x7002('0xc'),'to'],'type':_0x7002('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20cb21,_0x5baac3,_0xb170e5){if(_0x20cb21['substatus']){_0x20cb21[_0x7002('0xe')]=moment()[_0x7002('0xf')](_0x7002('0x10'));}if(_0x20cb21[_0x7002('0x11')]){_0x20cb21[_0x7002('0x12')]=moment()[_0x7002('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0xb170e5(null,_0x5baac3);},'beforeUpdate':function(_0x19fca0,_0x1c0c5b,_0x5cf8a3){if(_0x19fca0[_0x7002('0x13')]('substatus')){_0x19fca0['substatusAt']=_0x19fca0[_0x7002('0x14')]?moment()[_0x7002('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x19fca0['changed'](_0x7002('0x11'))){_0x19fca0[_0x7002('0x12')]=moment()[_0x7002('0xf')](_0x7002('0x10'));_0x19fca0[_0x7002('0x14')]=null;_0x19fca0[_0x7002('0xe')]=null;}_0x5cf8a3(null,_0x19fca0);},'afterUpdate':function(_0x146618,_0x222f05,_0x38176d){var _0x59148e=_0x4b16aa['models'];var _0x494981=_0x146618[_0x7002('0x15')]({'plain':!![]});if(_0x494981['closed']){return _0x59148e['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x494981['id']}})['then'](function(){_0x38176d();})[_0x7002('0x16')](function(_0x9992bd){_0x38176d(_0x9992bd);});}else{_0x38176d();}}},'charset':_0x7002('0x17'),'collate':_0x7002('0x18')});}; \ No newline at end of file +var _0x2718=['format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x2718,0x8d));var _0x8271=function(_0x576a62,_0x152536){_0x576a62=_0x576a62-0x0;var _0x44bdff=_0x2718[_0x576a62];return _0x44bdff;};'use strict';var _=require('lodash');var util=require(_0x8271('0x0'));var logger=require(_0x8271('0x1'))('api');var moment=require(_0x8271('0x2'));var BPromise=require(_0x8271('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8271('0x4'));var config=require(_0x8271('0x5'));var attributes=require(_0x8271('0x6'));module[_0x8271('0x7')]=function(_0x95e7b5,_0x5668b7){return _0x95e7b5[_0x8271('0x8')]('MailInteraction',attributes,{'tableName':_0x8271('0x9'),'paranoid':![],'indexes':[{'name':_0x8271('0xa'),'fields':[_0x8271('0xb'),'to'],'type':_0x8271('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x197f09,_0x44c72b,_0x1751d9){if(_0x197f09[_0x8271('0xd')]){_0x197f09[_0x8271('0xe')]=moment()[_0x8271('0xf')](_0x8271('0x10'));}if(_0x197f09[_0x8271('0x11')]){_0x197f09[_0x8271('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1751d9(null,_0x44c72b);},'beforeUpdate':function(_0xafde83,_0x150050,_0x10b1bd){if(_0xafde83['changed']('substatus')){_0xafde83[_0x8271('0xe')]=_0xafde83[_0x8271('0xd')]?moment()[_0x8271('0xf')](_0x8271('0x10')):null;}if(_0xafde83['changed'](_0x8271('0x11'))){_0xafde83[_0x8271('0x12')]=moment()[_0x8271('0xf')](_0x8271('0x10'));_0xafde83['substatus']=null;_0xafde83['substatusAt']=null;}_0x10b1bd(null,_0xafde83);},'afterUpdate':function(_0x3f74de,_0x533024,_0x50f7fc){var _0x382c26=_0x95e7b5[_0x8271('0x13')];var _0x5cd8ae=_0x3f74de[_0x8271('0x14')]({'plain':!![]});if(_0x5cd8ae[_0x8271('0x11')]){return _0x382c26[_0x8271('0x15')][_0x8271('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x5cd8ae['id']}})[_0x8271('0x17')](function(){_0x50f7fc();})[_0x8271('0x18')](function(_0x17c99f){_0x50f7fc(_0x17c99f);});}else{_0x50f7fc();}}},'charset':'utf8mb4','collate':_0x8271('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 89bf569..83e2ad7 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 _0xf445=['moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','MailInteraction,\x20%s,\x20%s','info','result','catch','MailInteraction','update','options','raw','where','limit','then','UpdateMailInteraction','AddTagsToMailInteraction','addTags','ids','omit','body','spread','AddTags','lodash','util'];(function(_0x2db59f,_0x236c36){var _0x8e74b8=function(_0x230da4){while(--_0x230da4){_0x2db59f['push'](_0x2db59f['shift']());}};_0x8e74b8(++_0x236c36);}(_0xf445,0xe8));var _0x5f44=function(_0x38aa1d,_0x4faf18){_0x38aa1d=_0x38aa1d-0x0;var _0x2fb75d=_0xf445[_0x38aa1d];return _0x2fb75d;};'use strict';var _=require(_0x5f44('0x0'));var util=require(_0x5f44('0x1'));var moment=require(_0x5f44('0x2'));var BPromise=require(_0x5f44('0x3'));var rs=require(_0x5f44('0x4'));var fs=require('fs');var Redis=require(_0x5f44('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5f44('0x6'));var jayson=require(_0x5f44('0x7'));var client=jayson[_0x5f44('0x8')][_0x5f44('0x9')]({'port':0x232a});config['redis']=_[_0x5f44('0xa')](config[_0x5f44('0xb')],{'host':_0x5f44('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f44('0xb')]));require('./mailInteraction.socket')[_0x5f44('0xd')](socket);function respondWithRpcPromise(_0x57249c,_0x2a3cdd,_0x5ed720){return new BPromise(function(_0x1e0923,_0x387421){return client['request'](_0x57249c,_0x5ed720)['then'](function(_0x573280){logger['info']('MailInteraction,\x20%s,\x20%s',_0x2a3cdd,_0x5f44('0xe'));logger[_0x5f44('0xf')](_0x5f44('0x10'),_0x2a3cdd,_0x5f44('0xe'),JSON[_0x5f44('0x11')](_0x573280));if(_0x573280[_0x5f44('0x12')]){if(_0x573280['error']['code']===0x1f4){logger[_0x5f44('0x12')]('MailInteraction,\x20%s,\x20%s',_0x2a3cdd,_0x573280[_0x5f44('0x12')]['message']);return _0x387421(_0x573280[_0x5f44('0x12')][_0x5f44('0x13')]);}logger['error'](_0x5f44('0x14'),_0x2a3cdd,_0x573280[_0x5f44('0x12')][_0x5f44('0x13')]);return _0x1e0923(_0x573280[_0x5f44('0x12')][_0x5f44('0x13')]);}else{logger[_0x5f44('0x15')]('MailInteraction,\x20%s,\x20%s',_0x2a3cdd,_0x5f44('0xe'));_0x1e0923(_0x573280[_0x5f44('0x16')][_0x5f44('0x13')]);}})[_0x5f44('0x17')](function(_0x1a3077){logger[_0x5f44('0x12')](_0x5f44('0x14'),_0x2a3cdd,_0x1a3077);_0x387421(_0x1a3077);});});}exports['UpdateMailInteraction']=function(_0x28c4d9){var _0x3fce7e=this;return new Promise(function(_0x3d1805,_0x4268f8){return db[_0x5f44('0x18')][_0x5f44('0x19')](_0x28c4d9['body'],{'raw':_0x28c4d9[_0x5f44('0x1a')]?_0x28c4d9[_0x5f44('0x1a')][_0x5f44('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28c4d9[_0x5f44('0x1a')]?_0x28c4d9[_0x5f44('0x1a')][_0x5f44('0x1c')]||null:null,'attributes':_0x28c4d9[_0x5f44('0x1a')]?_0x28c4d9[_0x5f44('0x1a')]['attributes']||null:null,'limit':_0x28c4d9['options']?_0x28c4d9[_0x5f44('0x1a')][_0x5f44('0x1d')]||null:null})[_0x5f44('0x1e')](function(_0x56cf5e){logger[_0x5f44('0x15')](_0x5f44('0x1f'),_0x28c4d9);logger[_0x5f44('0xf')](_0x5f44('0x1f'),_0x28c4d9,JSON['stringify'](_0x56cf5e));_0x3d1805(_0x56cf5e);})[_0x5f44('0x17')](function(_0x2baacc){logger[_0x5f44('0x12')](_0x5f44('0x1f'),_0x2baacc['message'],_0x28c4d9);_0x4268f8(_0x3fce7e[_0x5f44('0x12')](0x1f4,_0x2baacc['message']));});});};exports[_0x5f44('0x20')]=function(_0x57180c){return new Promise(function(_0x3faba5,_0x9d09fd){return db['MailInteraction']['find']({'where':_0x57180c['options']?_0x57180c[_0x5f44('0x1a')][_0x5f44('0x1c')]||null:null})[_0x5f44('0x1e')](function(_0x1625c1){if(_0x1625c1){return _0x1625c1[_0x5f44('0x21')](_0x57180c['body'][_0x5f44('0x22')],_[_0x5f44('0x23')](_0x57180c[_0x5f44('0x24')],[_0x5f44('0x22'),'id'])||{});}})[_0x5f44('0x25')](function(_0x4165ef){logger[_0x5f44('0x15')](_0x5f44('0x26'),_0x57180c);logger[_0x5f44('0xf')](_0x5f44('0x26'),_0x57180c,JSON[_0x5f44('0x11')](_0x4165ef));_0x3faba5(_0x4165ef);})[_0x5f44('0x17')](function(_0x53206e){logger[_0x5f44('0x12')](_0x5f44('0x26'),_0x53206e[_0x5f44('0x13')],_0x57180c);_0x9d09fd(_this[_0x5f44('0x12')](0x1f4,_0x53206e[_0x5f44('0x13')]));});});}; \ No newline at end of file +var _0xed20=['./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x4b107d,_0x3ffc6f){var _0x35a1f4=function(_0x4c5664){while(--_0x4c5664){_0x4b107d['push'](_0x4b107d['shift']());}};_0x35a1f4(++_0x3ffc6f);}(_0xed20,0xce));var _0x0ed2=function(_0x2f6bf6,_0x180a99){_0x2f6bf6=_0x2f6bf6-0x0;var _0x1d95a5=_0xed20[_0x2f6bf6];return _0x1d95a5;};'use strict';var _=require(_0x0ed2('0x0'));var util=require(_0x0ed2('0x1'));var moment=require(_0x0ed2('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ed2('0x3'));var fs=require('fs');var Redis=require(_0x0ed2('0x4'));var db=require(_0x0ed2('0x5'))['db'];var utils=require(_0x0ed2('0x6'));var logger=require(_0x0ed2('0x7'))(_0x0ed2('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ed2('0x9'));var client=jayson[_0x0ed2('0xa')]['http']({'port':0x232a});config[_0x0ed2('0xb')]=_[_0x0ed2('0xc')](config[_0x0ed2('0xb')],{'host':_0x0ed2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ed2('0xb')]));require(_0x0ed2('0xe'))[_0x0ed2('0xf')](socket);function respondWithRpcPromise(_0x25a2d8,_0x48f0aa,_0x4d6fe2){return new BPromise(function(_0x36bd70,_0x1a3885){return client[_0x0ed2('0x10')](_0x25a2d8,_0x4d6fe2)[_0x0ed2('0x11')](function(_0x187709){logger[_0x0ed2('0x12')](_0x0ed2('0x13'),_0x48f0aa,_0x0ed2('0x14'));logger[_0x0ed2('0x15')](_0x0ed2('0x16'),_0x48f0aa,_0x0ed2('0x14'),JSON[_0x0ed2('0x17')](_0x187709));if(_0x187709['error']){if(_0x187709[_0x0ed2('0x18')][_0x0ed2('0x19')]===0x1f4){logger[_0x0ed2('0x18')](_0x0ed2('0x13'),_0x48f0aa,_0x187709[_0x0ed2('0x18')]['message']);return _0x1a3885(_0x187709[_0x0ed2('0x18')][_0x0ed2('0x1a')]);}logger[_0x0ed2('0x18')]('MailInteraction,\x20%s,\x20%s',_0x48f0aa,_0x187709[_0x0ed2('0x18')]['message']);return _0x36bd70(_0x187709[_0x0ed2('0x18')][_0x0ed2('0x1a')]);}else{logger[_0x0ed2('0x12')]('MailInteraction,\x20%s,\x20%s',_0x48f0aa,'request\x20sent');_0x36bd70(_0x187709[_0x0ed2('0x1b')][_0x0ed2('0x1a')]);}})['catch'](function(_0x322e35){logger['error'](_0x0ed2('0x13'),_0x48f0aa,_0x322e35);_0x1a3885(_0x322e35);});});}exports[_0x0ed2('0x1c')]=function(_0x4d5c76){var _0x5ac0aa=this;return new Promise(function(_0x585ac1,_0x13060b){return db[_0x0ed2('0x1d')][_0x0ed2('0x1e')](_0x4d5c76[_0x0ed2('0x1f')],{'raw':_0x4d5c76[_0x0ed2('0x20')]?_0x4d5c76[_0x0ed2('0x20')][_0x0ed2('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d5c76['options']?_0x4d5c76['options'][_0x0ed2('0x22')]||null:null,'attributes':_0x4d5c76[_0x0ed2('0x20')]?_0x4d5c76[_0x0ed2('0x20')][_0x0ed2('0x23')]||null:null,'limit':_0x4d5c76[_0x0ed2('0x20')]?_0x4d5c76[_0x0ed2('0x20')][_0x0ed2('0x24')]||null:null})[_0x0ed2('0x11')](function(_0x5f2660){logger[_0x0ed2('0x12')](_0x0ed2('0x1c'),_0x4d5c76);logger[_0x0ed2('0x15')](_0x0ed2('0x1c'),_0x4d5c76,JSON[_0x0ed2('0x17')](_0x5f2660));_0x585ac1(_0x5f2660);})['catch'](function(_0x14c0e6){logger[_0x0ed2('0x18')](_0x0ed2('0x1c'),_0x14c0e6[_0x0ed2('0x1a')],_0x4d5c76);_0x13060b(_0x5ac0aa[_0x0ed2('0x18')](0x1f4,_0x14c0e6[_0x0ed2('0x1a')]));});});};exports[_0x0ed2('0x25')]=function(_0x1d90ee){return new Promise(function(_0x1e62a8,_0x1e6efe){return db['MailInteraction'][_0x0ed2('0x26')]({'where':_0x1d90ee['options']?_0x1d90ee['options'][_0x0ed2('0x22')]||null:null})[_0x0ed2('0x11')](function(_0x11add7){if(_0x11add7){return _0x11add7[_0x0ed2('0x27')](_0x1d90ee[_0x0ed2('0x1f')][_0x0ed2('0x28')],_['omit'](_0x1d90ee['body'],['ids','id'])||{});}})[_0x0ed2('0x29')](function(_0x35eff4){logger[_0x0ed2('0x12')](_0x0ed2('0x2a'),_0x1d90ee);logger['debug'](_0x0ed2('0x2a'),_0x1d90ee,JSON['stringify'](_0x35eff4));_0x1e62a8(_0x35eff4);})[_0x0ed2('0x2b')](function(_0x793700){logger['error'](_0x0ed2('0x2a'),_0x793700['message'],_0x1d90ee);_0x1e6efe(_this[_0x0ed2('0x18')](0x1f4,_0x793700[_0x0ed2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a96aa4b..3a33fe1 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 _0xd21b=['update','length'];(function(_0x57b95e,_0x344d13){var _0x594311=function(_0xbd1c6){while(--_0xbd1c6){_0x57b95e['push'](_0x57b95e['shift']());}};_0x594311(++_0x344d13);}(_0xd21b,0x1d6));var _0xbd21=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0xd21b[_0x4d180c];return _0x49b57e;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save','remove',_0xbd21('0x0')];function createListener(_0x22560e,_0x37d51d){return function(_0x172a71){_0x37d51d['emit'](_0x22560e,_0x172a71);};}function removeListener(_0x3f3913,_0x489977){return function(){MailInteractionEvents['removeListener'](_0x3f3913,_0x489977);};}exports['register']=function(_0x1d2ee9){for(var _0x4e595f=0x0,_0x4198e1=events[_0xbd21('0x1')];_0x4e595f<_0x4198e1;_0x4e595f++){var _0x528eff=events[_0x4e595f];var _0x1be110=createListener('mailInteraction:'+_0x528eff,_0x1d2ee9);MailInteractionEvents['on'](_0x528eff,_0x1be110);}}; \ No newline at end of file +var _0x29bf=['remove','update','emit','removeListener','register','length','save'];(function(_0x2313e8,_0x332e97){var _0x482a35=function(_0xe736a0){while(--_0xe736a0){_0x2313e8['push'](_0x2313e8['shift']());}};_0x482a35(++_0x332e97);}(_0x29bf,0xdf));var _0xf29b=function(_0x56c540,_0x3ca49c){_0x56c540=_0x56c540-0x0;var _0x1ee77c=_0x29bf[_0x56c540];return _0x1ee77c;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xf29b('0x0'),_0xf29b('0x1'),_0xf29b('0x2')];function createListener(_0x39a991,_0x45db15){return function(_0x216b02){_0x45db15[_0xf29b('0x3')](_0x39a991,_0x216b02);};}function removeListener(_0x1307ea,_0x4c279c){return function(){MailInteractionEvents[_0xf29b('0x4')](_0x1307ea,_0x4c279c);};}exports[_0xf29b('0x5')]=function(_0x53a1ea){for(var _0x570142=0x0,_0xbdc0c8=events[_0xf29b('0x6')];_0x570142<_0xbdc0c8;_0x570142++){var _0x7e3102=events[_0x570142];var _0x5df0d4=createListener('mailInteraction:'+_0x7e3102,_0x53a1ea);MailInteractionEvents['on'](_0x7e3102,_0x5df0d4);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5548aab..13297d8 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 _0x0194=['describe','/:id','show','/:id/download','post','tracked','create','put','update','/:id/reject','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe'];(function(_0x59ec7a,_0x1eb345){var _0x8535ed=function(_0x5bca0b){while(--_0x5bca0b){_0x59ec7a['push'](_0x59ec7a['shift']());}};_0x8535ed(++_0x1eb345);}(_0x0194,0xf1));var _0x4019=function(_0x34a724,_0x14c9b0){_0x34a724=_0x34a724-0x0;var _0x594a67=_0x0194[_0x34a724];return _0x594a67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4019('0x0'));var timeout=require(_0x4019('0x1'));var express=require(_0x4019('0x2'));var router=express['Router']();var fs_extra=require(_0x4019('0x3'));var auth=require(_0x4019('0x4'));var interaction=require(_0x4019('0x5'));var config=require(_0x4019('0x6'));var controller=require(_0x4019('0x7'));router['get']('/',auth[_0x4019('0x8')](),controller[_0x4019('0x9')]);router[_0x4019('0xa')](_0x4019('0xb'),auth['isAuthenticated'](),controller[_0x4019('0xc')]);router[_0x4019('0xa')](_0x4019('0xd'),auth[_0x4019('0x8')](),controller[_0x4019('0xe')]);router[_0x4019('0xa')](_0x4019('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x4019('0x10')]('/',auth[_0x4019('0x8')](),interaction[_0x4019('0x11')]('mail','mailmessage:create'),controller[_0x4019('0x12')]);router[_0x4019('0x13')](_0x4019('0xd'),auth['isAuthenticated'](),controller[_0x4019('0x14')]);router[_0x4019('0x13')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x4019('0x13')](_0x4019('0x15'),auth[_0x4019('0x8')](),controller['reject']);router[_0x4019('0x16')]('/:id',auth[_0x4019('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfcc5=['/:id/accept','reject','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./mailMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','download','post','tracked','mail','put','update'];(function(_0xca171e,_0x22b904){var _0x26e039=function(_0x420a26){while(--_0x420a26){_0xca171e['push'](_0xca171e['shift']());}};_0x26e039(++_0x22b904);}(_0xfcc5,0x14a));var _0x5fcc=function(_0x217b53,_0x19068f){_0x217b53=_0x217b53-0x0;var _0x505328=_0xfcc5[_0x217b53];return _0x505328;};'use strict';var multer=require('multer');var util=require(_0x5fcc('0x0'));var path=require(_0x5fcc('0x1'));var timeout=require(_0x5fcc('0x2'));var express=require(_0x5fcc('0x3'));var router=express['Router']();var fs_extra=require(_0x5fcc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5fcc('0x5'));var controller=require(_0x5fcc('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5fcc('0x7')]);router[_0x5fcc('0x8')](_0x5fcc('0x9'),auth[_0x5fcc('0xa')](),controller[_0x5fcc('0xb')]);router['get'](_0x5fcc('0xc'),auth['isAuthenticated'](),controller[_0x5fcc('0xd')]);router[_0x5fcc('0x8')]('/:id/download',auth[_0x5fcc('0xa')](),controller[_0x5fcc('0xe')]);router[_0x5fcc('0xf')]('/',auth[_0x5fcc('0xa')](),interaction[_0x5fcc('0x10')](_0x5fcc('0x11'),'mailmessage:create'),controller['create']);router[_0x5fcc('0x12')](_0x5fcc('0xc'),auth[_0x5fcc('0xa')](),controller[_0x5fcc('0x13')]);router[_0x5fcc('0x12')](_0x5fcc('0x14'),auth[_0x5fcc('0xa')](),controller['accept']);router[_0x5fcc('0x12')]('/:id/reject',auth[_0x5fcc('0xa')](),controller[_0x5fcc('0x15')]);router[_0x5fcc('0x16')](_0x5fcc('0xc'),auth['isAuthenticated'](),controller[_0x5fcc('0x17')]);module[_0x5fcc('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 0a3d783..a830ba3 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 _0x021f=['lodash','exports','long','TEXT','medium','BOOLEAN','ENUM','out','DATE','INTEGER','Email','Chat','sequelize'];(function(_0x619df6,_0x5bd4f3){var _0xd67434=function(_0x12925){while(--_0x12925){_0x619df6['push'](_0x619df6['shift']());}};_0xd67434(++_0x5bd4f3);}(_0x021f,0x74));var _0xf021=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x021f[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0xf021('0x0'));var _=require(_0xf021('0x1'));module[_0xf021('0x2')]={'body':{'type':Sequelize['TEXT'](_0xf021('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf021('0x4')](_0xf021('0x5'))},'read':{'type':Sequelize[_0xf021('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf021('0x7')]('in',_0xf021('0x8')),'defaultValue':_0xf021('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf021('0x4')](_0xf021('0x3'))},'cc':{'type':Sequelize[_0xf021('0x4')]('long')},'bcc':{'type':Sequelize[_0xf021('0x4')]('long')},'subject':{'type':Sequelize[_0xf021('0x4')]},'sentAt':{'type':Sequelize[_0xf021('0x9')]},'attach':{'type':Sequelize[_0xf021('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf021('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf021('0x9')]},'originTo':{'type':Sequelize[_0xf021('0x4')](_0xf021('0x3'))},'originCc':{'type':Sequelize[_0xf021('0x4')](_0xf021('0x3'))},'originChannel':{'type':Sequelize[_0xf021('0x7')](_0xf021('0xb'),_0xf021('0xc')),'defaultValue':_0xf021('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xcb62=['out','DATE','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0xcb62,0x70));var _0x2cb6=function(_0x44fa55,_0x4e5332){_0x44fa55=_0x44fa55-0x0;var _0x1c7665=_0xcb62[_0x44fa55];return _0x1c7665;};'use strict';var Sequelize=require(_0x2cb6('0x0'));var _=require(_0x2cb6('0x1'));module[_0x2cb6('0x2')]={'body':{'type':Sequelize[_0x2cb6('0x3')](_0x2cb6('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2cb6('0x3')](_0x2cb6('0x5'))},'read':{'type':Sequelize[_0x2cb6('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2cb6('0x7')]('in','out'),'defaultValue':_0x2cb6('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2cb6('0x3')](_0x2cb6('0x4'))},'cc':{'type':Sequelize[_0x2cb6('0x3')](_0x2cb6('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x2cb6('0x4'))},'subject':{'type':Sequelize[_0x2cb6('0x3')]},'sentAt':{'type':Sequelize[_0x2cb6('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2cb6('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2cb6('0x9')]},'originTo':{'type':Sequelize[_0x2cb6('0x3')]('long')},'originCc':{'type':Sequelize[_0x2cb6('0x3')]('long')},'originChannel':{'type':Sequelize[_0x2cb6('0x7')](_0x2cb6('0xa'),_0x2cb6('0xb')),'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 b993c7c..be2d2d8 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 _0x01e2=['isNil','service','host','port','secure','authentication','auth','pass','user','attachments','join','root','server/files/attachments','basename','List','List\x20not\x20found','SendMail','sendMail','format','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','motionChannel','rejectmessage','unix','toString','files','bcc','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','undefined','count','offset','limit','set','Content-Range','json','destroy','stack','name','send','index','map','MailMessage','rawAttributes','type','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','update','body','find','describe','create','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp'];(function(_0x1f4b9c,_0x45504b){var _0x1f65ec=function(_0x3800ed){while(--_0x3800ed){_0x1f4b9c['push'](_0x1f4b9c['shift']());}};_0x1f65ec(++_0x45504b);}(_0x01e2,0x181));var _0x201e=function(_0x5172dc,_0x3855e4){_0x5172dc=_0x5172dc-0x0;var _0x48226d=_0x01e2[_0x5172dc];return _0x48226d;};'use strict';var emlformat=require(_0x201e('0x0'));var moment=require('moment');var BPromise=require(_0x201e('0x1'));var util=require(_0x201e('0x2'));var path=require(_0x201e('0x3'));var fs=require('fs');var _=require(_0x201e('0x4'));var Redis=require(_0x201e('0x5'));var htmlToText=require(_0x201e('0x6'));var qs=require(_0x201e('0x7'));var logger=require(_0x201e('0x8'))(_0x201e('0x9'));var interaction_log=require(_0x201e('0x8'))(_0x201e('0xa'));var config=require(_0x201e('0xb'));var db=require(_0x201e('0xc'))['db'];config[_0x201e('0xd')]=_[_0x201e('0xe')](config[_0x201e('0xd')],{'host':_0x201e('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x201e('0xd')]));var htmlEntities=require(_0x201e('0x10'));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x201e('0x11'));var client=jayson[_0x201e('0x12')]['http']({'port':0x232c});var client9003=jayson[_0x201e('0x12')][_0x201e('0x13')]({'port':0x232b});var client9002=jayson[_0x201e('0x12')][_0x201e('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1e3ce,_0x4386a1,_0x2084b9,_0x52808c){return new BPromise(function(_0x568dd4,_0x6ea764){var _0x5eb251=_0x52808c||client;return _0x5eb251[_0x201e('0x14')](_0x1e3ce,_0x2084b9)[_0x201e('0x15')](function(_0x3ebc6c){logger[_0x201e('0x16')](_0x201e('0x17'),_0x4386a1,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x4386a1,_0x201e('0x18'),JSON[_0x201e('0x19')](_0x3ebc6c));if(_0x3ebc6c[_0x201e('0x1a')]){if(_0x3ebc6c[_0x201e('0x1a')][_0x201e('0x1b')]===0x1f4){logger[_0x201e('0x1a')](_0x201e('0x17'),_0x4386a1,_0x3ebc6c[_0x201e('0x1a')][_0x201e('0x1c')]);return _0x6ea764(_0x3ebc6c[_0x201e('0x1a')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x4386a1,_0x3ebc6c['error']['message']);return _0x568dd4(_0x3ebc6c[_0x201e('0x1a')][_0x201e('0x1c')]);}else{logger[_0x201e('0x16')]('MailMessage,\x20%s,\x20%s',_0x4386a1,_0x201e('0x18'));_0x568dd4(_0x3ebc6c[_0x201e('0x1d')][_0x201e('0x1c')]);}})[_0x201e('0x1e')](function(_0x4af88a){logger[_0x201e('0x1a')](_0x201e('0x17'),_0x4386a1,_0x4af88a);_0x6ea764(_0x4af88a);});});}function respondWithResult(_0x3dd669,_0x5d395a){_0x5d395a=_0x5d395a||0xc8;return function(_0x592f08){if(_0x592f08){return _0x3dd669[_0x201e('0x1f')](_0x5d395a)['json'](_0x592f08);}};}function respondWithFilteredResult(_0x402326,_0x2e20dc){return function(_0x4fe6b8){if(_0x4fe6b8){var _0x1147e1=typeof _0x2e20dc['offset']===_0x201e('0x20')&&typeof _0x2e20dc['limit']===_0x201e('0x20');var _0x638ed0=_0x4fe6b8[_0x201e('0x21')];var _0x24fa2c=_0x1147e1?0x0:_0x2e20dc['offset'];var _0x13918b=_0x1147e1?_0x4fe6b8[_0x201e('0x21')]:_0x2e20dc[_0x201e('0x22')]+_0x2e20dc[_0x201e('0x23')];var _0x30f21f;if(_0x13918b>=_0x638ed0){_0x13918b=_0x638ed0;_0x30f21f=0xc8;}else{_0x30f21f=0xce;}_0x402326[_0x201e('0x1f')](_0x30f21f);return _0x402326[_0x201e('0x24')](_0x201e('0x25'),_0x24fa2c+'-'+_0x13918b+'/'+_0x638ed0)[_0x201e('0x26')](_0x4fe6b8);}return null;};}function saveUpdates(_0xffeb4d){return function(_0x4193d8){if(_0x4193d8){return _0x4193d8['update'](_0xffeb4d)[_0x201e('0x15')](function(_0x4b7467){return _0x4b7467;});}return null;};}function removeEntity(_0x1cc90a){return function(_0xdc0ba5){if(_0xdc0ba5){return _0xdc0ba5[_0x201e('0x27')]()[_0x201e('0x15')](function(){_0x1cc90a[_0x201e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da8f0){return function(_0x504681){if(!_0x504681){_0x4da8f0['sendStatus'](0x194);}return _0x504681;};}function handleError(_0x54a82f,_0x5789ba){_0x5789ba=_0x5789ba||0x1f4;return function(_0x593c90){logger[_0x201e('0x1a')](_0x593c90[_0x201e('0x28')]);if(_0x593c90[_0x201e('0x29')]){delete _0x593c90[_0x201e('0x29')];}_0x54a82f[_0x201e('0x1f')](_0x5789ba)[_0x201e('0x2a')](_0x593c90);};}exports[_0x201e('0x2b')]=function(_0x3b7c15,_0x5df91a){var _0x5e0dd9={},_0x25cf3d={},_0x3bd901={'count':0x0,'rows':[]};var _0x319a82=_[_0x201e('0x2c')](db[_0x201e('0x2d')][_0x201e('0x2e')],function(_0x21725c){return{'name':_0x21725c['fieldName'],'type':_0x21725c[_0x201e('0x2f')]['key']};});_0x25cf3d['model']=_[_0x201e('0x2c')](_0x319a82,_0x201e('0x29'));_0x25cf3d[_0x201e('0x30')]=_[_0x201e('0x31')](_0x3b7c15[_0x201e('0x30')]);_0x25cf3d[_0x201e('0x32')]=_[_0x201e('0x33')](_0x25cf3d['model'],_0x25cf3d['query']);_0x5e0dd9['attributes']=_[_0x201e('0x33')](_0x25cf3d[_0x201e('0x34')],qs[_0x201e('0x35')](_0x3b7c15[_0x201e('0x30')][_0x201e('0x35')]));_0x5e0dd9['attributes']=_0x5e0dd9['attributes'][_0x201e('0x36')]?_0x5e0dd9[_0x201e('0x37')]:_0x25cf3d[_0x201e('0x34')];if(!_0x3b7c15['query'][_0x201e('0x38')](_0x201e('0x39'))){_0x5e0dd9[_0x201e('0x23')]=qs[_0x201e('0x23')](_0x3b7c15[_0x201e('0x30')][_0x201e('0x23')]);_0x5e0dd9[_0x201e('0x22')]=qs[_0x201e('0x22')](_0x3b7c15[_0x201e('0x30')][_0x201e('0x22')]);}_0x5e0dd9[_0x201e('0x3a')]=qs['sort'](_0x3b7c15[_0x201e('0x30')][_0x201e('0x3b')]);_0x5e0dd9[_0x201e('0x3c')]=qs['filters'](_['pick'](_0x3b7c15[_0x201e('0x30')],_0x25cf3d['filters']),_0x319a82);if(_0x3b7c15['query'][_0x201e('0x3d')]){_0x5e0dd9[_0x201e('0x3c')]=_[_0x201e('0x3e')](_0x5e0dd9['where'],{'$or':_[_0x201e('0x2c')](_0x319a82,function(_0x174049){if(_0x174049[_0x201e('0x2f')]!==_0x201e('0x3f')){var _0x4d8590={};_0x4d8590[_0x174049[_0x201e('0x29')]]={'$like':'%'+_0x3b7c15[_0x201e('0x30')][_0x201e('0x3d')]+'%'};return _0x4d8590;}})});}_0x5e0dd9=_[_0x201e('0x3e')]({},_0x5e0dd9,_0x3b7c15[_0x201e('0x40')]);var _0x3a8b52={'where':_0x5e0dd9[_0x201e('0x3c')]};return db[_0x201e('0x2d')]['count'](_0x3a8b52)[_0x201e('0x15')](function(_0x5d005e){_0x3bd901['count']=_0x5d005e;if(_0x3b7c15['query'][_0x201e('0x41')]){_0x5e0dd9[_0x201e('0x42')]=[{'all':!![]}];}return db[_0x201e('0x2d')][_0x201e('0x43')](_0x5e0dd9);})[_0x201e('0x15')](function(_0x1384b9){_0x3bd901[_0x201e('0x44')]=_0x1384b9;return _0x3bd901;})[_0x201e('0x15')](respondWithFilteredResult(_0x5df91a,_0x5e0dd9))[_0x201e('0x1e')](handleError(_0x5df91a,null));};exports['show']=function(_0x131d34,_0x580daa){var _0x471a73={'raw':!![],'where':{'id':_0x131d34[_0x201e('0x45')]['id']}},_0x215e6d={};_0x215e6d[_0x201e('0x34')]=_[_0x201e('0x31')](db[_0x201e('0x2d')][_0x201e('0x2e')]);_0x215e6d[_0x201e('0x30')]=_[_0x201e('0x31')](_0x131d34[_0x201e('0x30')]);_0x215e6d['filters']=_[_0x201e('0x33')](_0x215e6d[_0x201e('0x34')],_0x215e6d[_0x201e('0x30')]);_0x471a73[_0x201e('0x37')]=_['intersection'](_0x215e6d['model'],qs[_0x201e('0x35')](_0x131d34['query'][_0x201e('0x35')]));_0x471a73[_0x201e('0x37')]=_0x471a73[_0x201e('0x37')][_0x201e('0x36')]?_0x471a73['attributes']:_0x215e6d['model'];if(_0x131d34[_0x201e('0x30')][_0x201e('0x41')]){_0x471a73[_0x201e('0x42')]=[{'all':!![]}];}_0x471a73=_[_0x201e('0x3e')]({},_0x471a73,_0x131d34['options']);return db[_0x201e('0x2d')]['find'](_0x471a73)['then'](handleEntityNotFound(_0x580daa,null))[_0x201e('0x15')](respondWithResult(_0x580daa,null))[_0x201e('0x1e')](handleError(_0x580daa,null));};exports[_0x201e('0x46')]=function(_0x1a0cb8,_0x1eb15f){if(_0x1a0cb8[_0x201e('0x47')]['id']){delete _0x1a0cb8['body']['id'];}return db[_0x201e('0x2d')][_0x201e('0x48')]({'where':{'id':_0x1a0cb8[_0x201e('0x45')]['id']}})[_0x201e('0x15')](handleEntityNotFound(_0x1eb15f,null))[_0x201e('0x15')](saveUpdates(_0x1a0cb8[_0x201e('0x47')],null))['then'](respondWithResult(_0x1eb15f,null))['catch'](handleError(_0x1eb15f,null));};exports[_0x201e('0x27')]=function(_0x5e93be,_0x46e092){return db[_0x201e('0x2d')][_0x201e('0x48')]({'where':{'id':_0x5e93be[_0x201e('0x45')]['id']}})[_0x201e('0x15')](handleEntityNotFound(_0x46e092,null))[_0x201e('0x15')](removeEntity(_0x46e092,null))[_0x201e('0x1e')](handleError(_0x46e092,null));};exports[_0x201e('0x49')]=function(_0x1c4091,_0x41e162){return db[_0x201e('0x2d')][_0x201e('0x49')]()[_0x201e('0x15')](respondWithResult(_0x41e162,null))[_0x201e('0x1e')](handleError(_0x41e162,null));};exports[_0x201e('0x4a')]=function(_0x2fb7be,_0x5d409b){return db[_0x201e('0x2d')][_0x201e('0x4a')](_0x2fb7be[_0x201e('0x47')])['then'](function(_0x2ef4bf){if(_0x2ef4bf){if(_0x2ef4bf['direction']==='out'&&!_0x2ef4bf['secret']){var _0x42b751,_0x4bacfa,_0x61ae9f;if(_0x2fb7be[_0x201e('0x47')]['to']){_0x4bacfa=_0x2fb7be[_0x201e('0x47')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2ef4bf[_0x201e('0x4b')]},'include':[{'model':db[_0x201e('0x4c')],'as':'List','include':[{'model':db[_0x201e('0x4d')],'as':_0x201e('0x4e'),'where':{'email':_0x4bacfa},'limit':0x1,'order':[[_0x201e('0x4f'),_0x201e('0x50')]]}]},{'model':db[_0x201e('0x51')],'as':_0x201e('0x52'),'raw':!![]}]})['then'](function(_0x95a402){_0x42b751=_0x95a402;if(_0x42b751&&_0x42b751[_0x201e('0x52')]){var _0x47cdb9={'tls':{'rejectUnauthorized':![]}};if(_[_0x201e('0x53')](_0x42b751['Smtp'][_0x201e('0x54')])){_0x47cdb9[_0x201e('0x55')]=_0x42b751[_0x201e('0x52')][_0x201e('0x55')];_0x47cdb9[_0x201e('0x56')]=_0x42b751[_0x201e('0x52')]['port'];_0x47cdb9['secure']=_0x42b751[_0x201e('0x52')][_0x201e('0x57')];if(_0x42b751['Smtp'][_0x201e('0x58')]){_0x47cdb9[_0x201e('0x59')]={'user':_0x42b751[_0x201e('0x52')]['user'],'pass':_0x42b751[_0x201e('0x52')][_0x201e('0x5a')]};}}else{_0x47cdb9[_0x201e('0x54')]=_0x42b751[_0x201e('0x52')][_0x201e('0x54')];_0x47cdb9[_0x201e('0x59')]={'user':_0x42b751[_0x201e('0x52')][_0x201e('0x5b')],'pass':_0x42b751['Smtp'][_0x201e('0x5a')]};_0x47cdb9[_0x201e('0x57')]=_0x42b751[_0x201e('0x52')][_0x201e('0x57')];}if(_0x2fb7be[_0x201e('0x47')]['attachments']&&_0x2fb7be[_0x201e('0x47')]['attachments'][_0x201e('0x36')]){for(var _0x47075a=0x0;_0x47075a<_0x2fb7be[_0x201e('0x47')][_0x201e('0x5c')][_0x201e('0x36')];_0x47075a+=0x1){_0x2fb7be[_0x201e('0x47')][_0x201e('0x5c')][_0x47075a]={'filename':_0x2fb7be['body']['attachments'][_0x47075a][_0x201e('0x29')],'path':path[_0x201e('0x5d')](config[_0x201e('0x5e')],_0x201e('0x5f'),_0x2fb7be[_0x201e('0x47')][_0x201e('0x5c')][_0x47075a][_0x201e('0x60')])};}}_0x61ae9f={'account':_0x47cdb9,'message':_0x2fb7be[_0x201e('0x47')]};return;}})[_0x201e('0x15')](function(){if(_0x42b751[_0x201e('0x61')]){if(_0x42b751[_0x201e('0x61')][_0x201e('0x4e')][_0x201e('0x36')]){return _0x42b751['List'][_0x201e('0x4e')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x2fb7be[_0x201e('0x47')],{'firstName':_0x2fb7be['body']['to'],'email':_0x2fb7be[_0x201e('0x47')]['to'],'phone':_0x2fb7be['body']['to'],'ListId':_0x42b751['ListId']}));}}else{throw new Error(_0x201e('0x62'));}})[_0x201e('0x15')](function(){if(_0x61ae9f){return respondWithRpcPromise(_0x201e('0x63'),_0x201e('0x64'),_0x61ae9f,client9003)['then'](function(_0x1322a0){return _0x2ef4bf[_0x201e('0x46')]({'read':!![],'messageId':_0x1322a0['messageId'],'sentAt':moment()[_0x201e('0x65')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x201e('0x1e')](function(_0x467744){logger[_0x201e('0x1a')]('%s',JSON[_0x201e('0x19')](_0x467744));return _0x2ef4bf;});}return _0x2ef4bf;});}return _0x2ef4bf;}})[_0x201e('0x15')](respondWithResult(_0x5d409b,0xc9))[_0x201e('0x1e')](handleError(_0x5d409b,null));};exports[_0x201e('0x66')]=function(_0x2fd298,_0x563b89){var _0x1e59e8={'agent':{},'channel':'mail'};if(_0x2fd298['body']['id']){delete _0x2fd298[_0x201e('0x47')]['id'];}_0x2fd298[_0x201e('0x47')]['read']=!![];_0x2fd298['body']['readAt']=moment()[_0x201e('0x65')](_0x201e('0x67'));_0x2fd298[_0x201e('0x47')][_0x201e('0x68')]=_0x2fd298[_0x201e('0x47')][_0x201e('0x68')]||_0x2fd298[_0x201e('0x5b')]['id'];_0x1e59e8[_0x201e('0x69')]['id']=_0x2fd298[_0x201e('0x47')][_0x201e('0x68')];return db[_0x201e('0x2d')][_0x201e('0x48')]({'where':{'id':_0x2fd298['params']['id'],'UserId':null}})[_0x201e('0x15')](handleEntityNotFound(_0x563b89,null))[_0x201e('0x15')](saveUpdates(_0x2fd298[_0x201e('0x47')],null))['then'](function(_0x24865f){if(_0x24865f){_0x1e59e8['message']=_0x24865f[_0x201e('0x6a')]({'plain':!![]});return db[_0x201e('0x6b')][_0x201e('0x48')]({'where':{'id':_0x24865f[_0x201e('0x6c')]}});}return null;})[_0x201e('0x15')](handleEntityNotFound(_0x563b89,null))[_0x201e('0x15')](function(_0x5714fa){if(_0x5714fa){return _0x5714fa[_0x201e('0x46')]({'UserId':_0x2fd298[_0x201e('0x47')][_0x201e('0x68')],'read1stAt':_[_0x201e('0x53')](_0x5714fa[_0x201e('0x6d')])?moment()[_0x201e('0x65')](_0x201e('0x67')):undefined});}return null;})[_0x201e('0x15')](function(_0x329b20){if(_0x329b20){_0x1e59e8['interaction']=_0x329b20[_0x201e('0x6a')]({'plain':!![]});interaction_log[_0x201e('0x16')](_0x201e('0x6e'),_0x2fd298[_0x201e('0x5b')]['id'],_0x2fd298[_0x201e('0x5b')][_0x201e('0x29')],_0x2fd298['user'][_0x201e('0x6f')],_0x1e59e8['interaction']['id'],_0x2fd298[_0x201e('0x47')]?JSON[_0x201e('0x19')](_0x2fd298[_0x201e('0x47')]):_0x201e('0x70'));return respondWithRpcPromise(_0x201e('0x71'),_0x201e('0x72'),_0x1e59e8);}return null;})['then'](function(_0x41e378){var _0x35c64b=_0x201e('0x73')+_0x41e378[_0x201e('0x1c')][_0x201e('0x74')];return db[_0x201e('0x75')][_0x201e('0x30')](_0x35c64b,{'type':db['Sequelize'][_0x201e('0x76')][_0x201e('0x77')],'raw':!![]})['then'](function(_0x361113){return _0x361113;});})[_0x201e('0x15')](function(_0x3cf24e){if(_0x3cf24e){_0x1e59e8[_0x201e('0x1c')][_0x201e('0x78')]=_0x3cf24e[0x0];if(!_0x2fd298[_0x201e('0x47')][_0x201e('0x68')])return;return db[_0x201e('0x79')][_0x201e('0x48')]({'where':{'id':_0x2fd298[_0x201e('0x47')]['UserId'],'role':_0x201e('0x69')},'attributes':['id',_0x201e('0x29'),_0x201e('0x7a'),_0x201e('0x7b'),_0x201e('0x7c')],'raw':!![]});}return null;})[_0x201e('0x15')](function(_0x33a94c){if(!_0x33a94c)return null;_0x1e59e8['message'][_0x201e('0x69')]=_0x33a94c;return _0x1e59e8;})[_0x201e('0x15')](function(_0x36cd7e){if(_0x36cd7e){if(_0x2fd298[_0x201e('0x47')][_0x201e('0x7d')]){_0x1e59e8['message'][_0x201e('0x7e')]=util[_0x201e('0x65')](_0x201e('0x7f'),_0x2fd298['user'][_0x201e('0x29')]);_0x1e59e8[_0x201e('0x1c')][_0x201e('0x80')]=_0x1e59e8[_0x201e('0x80')];_0x1e59e8[_0x201e('0x1c')]['motionChannel']=_0x1e59e8[_0x201e('0x80')];_0x1e59e8[_0x201e('0x1c')][_0x201e('0x81')]=_0x201e('0x66');_0x1e59e8[_0x201e('0x1c')][_0x201e('0x47')]=htmlToText[_0x201e('0x82')](_0x1e59e8[_0x201e('0x1c')]['body']);return respondWithRpcPromise(_0x201e('0x83'),'EventManager',{'event':_0x201e('0x84'),'message':_0x1e59e8['message']},client9002)[_0x201e('0x15')](function(){return _0x1e59e8;});}return _0x1e59e8;}return null;})[_0x201e('0x15')](respondWithResult(_0x563b89,null))[_0x201e('0x1e')](handleError(_0x563b89,null));};exports[_0x201e('0x85')]=function(_0x2b6213,_0x41f82d){var _0x51a409={'agent':{},'channel':'mail'};if(_0x2b6213['body']['id']){delete _0x2b6213[_0x201e('0x47')]['id'];}_0x2b6213[_0x201e('0x47')][_0x201e('0x68')]=_0x2b6213[_0x201e('0x47')][_0x201e('0x68')]||_0x2b6213[_0x201e('0x5b')]['id'];_0x51a409['agent']['id']=_0x2b6213['body'][_0x201e('0x68')];return db['MailMessage']['find']({'where':{'id':_0x2b6213[_0x201e('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x41f82d,null))['then'](function(_0x29e6e9){if(_0x29e6e9){_0x51a409['message']=_0x29e6e9[_0x201e('0x6a')]({'plain':!![]});return db[_0x201e('0x6b')]['find']({'where':{'id':_0x29e6e9[_0x201e('0x6c')]}});}return null;})[_0x201e('0x15')](handleEntityNotFound(_0x41f82d,null))['then'](function(_0x1180b9){if(_0x1180b9){_0x51a409[_0x201e('0x86')]=_0x1180b9[_0x201e('0x6a')]({'plain':!![]});interaction_log[_0x201e('0x16')](_0x201e('0x87'),_0x2b6213[_0x201e('0x5b')]['id'],_0x2b6213[_0x201e('0x5b')]['name'],_0x2b6213['user'][_0x201e('0x6f')],_0x51a409[_0x201e('0x86')]['id'],_0x2b6213['body']?JSON[_0x201e('0x19')](_0x2b6213[_0x201e('0x47')]):'null');return respondWithRpcPromise('RejectMessage',_0x201e('0x88'),_0x51a409);}return null;})[_0x201e('0x15')](function(_0x22048a){var _0xa0496c=_0x201e('0x73')+_0x22048a[_0x201e('0x1c')][_0x201e('0x74')];return db['sequelize'][_0x201e('0x30')](_0xa0496c,{'type':db[_0x201e('0x89')][_0x201e('0x76')][_0x201e('0x77')],'raw':!![]})[_0x201e('0x15')](function(_0x2e2e65){return _0x2e2e65;});})[_0x201e('0x15')](function(_0x4a8212){if(_0x4a8212){_0x51a409['message'][_0x201e('0x78')]=_0x4a8212[0x0];if(!_0x2b6213[_0x201e('0x47')][_0x201e('0x68')])return;return db[_0x201e('0x79')][_0x201e('0x48')]({'where':{'id':_0x2b6213[_0x201e('0x47')]['UserId'],'role':_0x201e('0x69')},'attributes':['id',_0x201e('0x29'),_0x201e('0x7a'),_0x201e('0x7b'),_0x201e('0x7c')],'raw':!![]});}return null;})[_0x201e('0x15')](function(_0x3a98c2){if(!_0x3a98c2)return null;_0x51a409[_0x201e('0x1c')][_0x201e('0x69')]=_0x3a98c2;return _0x51a409;})[_0x201e('0x15')](function(_0x4d3c55){if(_0x4d3c55){_0x4d3c55[_0x201e('0x1c')][_0x201e('0x7e')]=util[_0x201e('0x65')](_0x201e('0x7f'),_0x2b6213['user'][_0x201e('0x29')]);_0x4d3c55['message'][_0x201e('0x80')]=_0x51a409[_0x201e('0x80')];_0x4d3c55[_0x201e('0x1c')][_0x201e('0x8a')]=_0x51a409[_0x201e('0x80')];_0x4d3c55['message'][_0x201e('0x81')]='reject';_0x4d3c55[_0x201e('0x1c')]['body']=htmlToText[_0x201e('0x82')](_0x51a409[_0x201e('0x1c')][_0x201e('0x47')]);respondWithRpcPromise(_0x201e('0x83'),_0x201e('0x83'),{'event':_0x201e('0x8b'),'message':_0x4d3c55[_0x201e('0x1c')]},client9002);return _0x51a409;}return null;})[_0x201e('0x15')](respondWithResult(_0x41f82d,null))[_0x201e('0x1e')](handleError(_0x41f82d,null));};exports['download']=function(_0x231ae0,_0x46a900){var _0x53f6ad=moment()[_0x201e('0x8c')]()[_0x201e('0x8d')]();var _0x4439a8=path['join'](config[_0x201e('0x5e')],'server',_0x201e('0x8e'),'tmp');var _0x4c2fd2=path[_0x201e('0x5d')](config[_0x201e('0x5e')],'server',_0x201e('0x8e'),_0x201e('0x5c'));var _0x3cfd8a=util[_0x201e('0x65')]('message-%s.eml',_0x53f6ad);return db['MailMessage']['find']({'where':{'id':_0x231ae0[_0x201e('0x45')]['id']},'attributes':['id',_0x201e('0x47'),'from','to','cc',_0x201e('0x8f'),'subject',_0x201e('0x90')],'include':_0x231ae0[_0x201e('0x30')][_0x201e('0x5c')]?[{'model':db[_0x201e('0x91')],'as':_0x201e('0x92')}]:undefined})['then'](handleEntityNotFound(_0x46a900,null))[_0x201e('0x15')](function(_0x34a85a){if(_0x34a85a){var _0xc1f703=_0x34a85a;var _0x516a3a={'from':_0xc1f703['from'],'to':_0xc1f703['to'],'subject':_0xc1f703['subject'],'html':htmlEntities[_0x201e('0x93')](_0xc1f703['body']),'headers':{'Date':moment(_0xc1f703[_0x201e('0x90')])[_0x201e('0x65')](_0x201e('0x94'))},'attachments':[]};if(_0x34a85a['cc']){_0x516a3a[_0x201e('0x95')]['Cc']=_0x34a85a['cc'];}if(_0x34a85a[_0x201e('0x8f')]){_0x516a3a['headers'][_0x201e('0x96')]=_0x34a85a[_0x201e('0x8f')];}return new BPromise(function(_0x594379,_0x43ed10){if(_0x34a85a[_0x201e('0x92')]){for(var _0x4dd12b=0x0;_0x4dd12b<_0x34a85a[_0x201e('0x92')][_0x201e('0x36')];_0x4dd12b++){var _0x37bc81=_0x34a85a[_0x201e('0x92')][_0x4dd12b];var _0xa56817=path[_0x201e('0x5d')](_0x4c2fd2,_0x37bc81[_0x201e('0x60')]);if(fs[_0x201e('0x97')](_0xa56817)){_0x516a3a[_0x201e('0x5c')][_0x201e('0x98')]({'name':_0x37bc81[_0x201e('0x29')],'contentType':_0x37bc81[_0x201e('0x2f')],'data':fs[_0x201e('0x99')](_0xa56817)});}}}emlformat[_0x201e('0x9a')](_0x516a3a,function(_0x4af78e,_0x4b376c){if(_0x4af78e)return _0x43ed10(_0x4af78e);fs[_0x201e('0x9b')](path[_0x201e('0x5d')](_0x4439a8,_0x3cfd8a),_0x4b376c);return _0x594379(_0x4b376c);});});}})[_0x201e('0x15')](function(_0x55644a){if(_0x55644a){return _0x46a900['download'](path[_0x201e('0x5d')](_0x4439a8,_0x3cfd8a),_0x3cfd8a,function(_0x24a1ca){if(!_0x24a1ca)fs['unlinkSync'](path[_0x201e('0x5d')](_0x4439a8,_0x3cfd8a));});}})['catch'](handleError(_0x46a900,null));}; \ No newline at end of file +var _0xf50c=['fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','find','body','describe','create','direction','secret','MailAccount','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','length','root','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','get','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','rejectmessage','download','toString','join','server','files','tmp','message-%s.eml','from','subject','Attachments','decode','headers','Bcc','bcc','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','map','MailMessage','rawAttributes'];(function(_0x5baa3e,_0x2266a1){var _0x3cd3c8=function(_0x5d507f){while(--_0x5d507f){_0x5baa3e['push'](_0x5baa3e['shift']());}};_0x3cd3c8(++_0x2266a1);}(_0xf50c,0x1b3));var _0xcf50=function(_0x530dad,_0x20b1b7){_0x530dad=_0x530dad-0x0;var _0x469723=_0xf50c[_0x530dad];return _0x469723;};'use strict';var emlformat=require('eml-format');var moment=require(_0xcf50('0x0'));var BPromise=require(_0xcf50('0x1'));var util=require(_0xcf50('0x2'));var path=require(_0xcf50('0x3'));var fs=require('fs');var _=require(_0xcf50('0x4'));var Redis=require(_0xcf50('0x5'));var htmlToText=require(_0xcf50('0x6'));var qs=require(_0xcf50('0x7'));var logger=require(_0xcf50('0x8'))(_0xcf50('0x9'));var interaction_log=require(_0xcf50('0x8'))('mail-interactions');var config=require(_0xcf50('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xcf50('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf50('0xc'))(new Redis(config[_0xcf50('0xb')]));var htmlEntities=require(_0xcf50('0xd'));require(_0xcf50('0xe'))[_0xcf50('0xf')](socket);var jayson=require(_0xcf50('0x10'));var client=jayson[_0xcf50('0x11')][_0xcf50('0x12')]({'port':0x232c});var client9003=jayson[_0xcf50('0x11')]['http']({'port':0x232b});var client9002=jayson[_0xcf50('0x11')][_0xcf50('0x12')]({'port':0x232a});function respondWithRpcPromise(_0xd9396a,_0x3af409,_0x5f0c57,_0x25936d){return new BPromise(function(_0x5063d9,_0xa6dcda){var _0x1ac89d=_0x25936d||client;return _0x1ac89d[_0xcf50('0x13')](_0xd9396a,_0x5f0c57)[_0xcf50('0x14')](function(_0x3d866c){logger[_0xcf50('0x15')]('MailMessage,\x20%s,\x20%s',_0x3af409,_0xcf50('0x16'));logger[_0xcf50('0x17')](_0xcf50('0x18'),_0x3af409,_0xcf50('0x16'),JSON['stringify'](_0x3d866c));if(_0x3d866c[_0xcf50('0x19')]){if(_0x3d866c[_0xcf50('0x19')][_0xcf50('0x1a')]===0x1f4){logger['error'](_0xcf50('0x1b'),_0x3af409,_0x3d866c[_0xcf50('0x19')][_0xcf50('0x1c')]);return _0xa6dcda(_0x3d866c[_0xcf50('0x19')]['message']);}logger['error'](_0xcf50('0x1b'),_0x3af409,_0x3d866c[_0xcf50('0x19')][_0xcf50('0x1c')]);return _0x5063d9(_0x3d866c['error'][_0xcf50('0x1c')]);}else{logger['info'](_0xcf50('0x1b'),_0x3af409,_0xcf50('0x16'));_0x5063d9(_0x3d866c[_0xcf50('0x1d')][_0xcf50('0x1c')]);}})[_0xcf50('0x1e')](function(_0x1f82fe){logger['error'](_0xcf50('0x1b'),_0x3af409,_0x1f82fe);_0xa6dcda(_0x1f82fe);});});}function respondWithResult(_0x4af1b7,_0x38769f){_0x38769f=_0x38769f||0xc8;return function(_0x1a78d6){if(_0x1a78d6){return _0x4af1b7[_0xcf50('0x1f')](_0x38769f)[_0xcf50('0x20')](_0x1a78d6);}};}function respondWithFilteredResult(_0x184df0,_0x560cb5){return function(_0x4cf9a0){if(_0x4cf9a0){var _0x3437ff=typeof _0x560cb5[_0xcf50('0x21')]===_0xcf50('0x22')&&typeof _0x560cb5[_0xcf50('0x23')]===_0xcf50('0x22');var _0x1ba188=_0x4cf9a0[_0xcf50('0x24')];var _0x20944a=_0x3437ff?0x0:_0x560cb5['offset'];var _0x431e63=_0x3437ff?_0x4cf9a0[_0xcf50('0x24')]:_0x560cb5[_0xcf50('0x21')]+_0x560cb5[_0xcf50('0x23')];var _0x150f80;if(_0x431e63>=_0x1ba188){_0x431e63=_0x1ba188;_0x150f80=0xc8;}else{_0x150f80=0xce;}_0x184df0['status'](_0x150f80);return _0x184df0[_0xcf50('0x25')](_0xcf50('0x26'),_0x20944a+'-'+_0x431e63+'/'+_0x1ba188)['json'](_0x4cf9a0);}return null;};}function saveUpdates(_0x263df9){return function(_0x4b1448){if(_0x4b1448){return _0x4b1448[_0xcf50('0x27')](_0x263df9)[_0xcf50('0x14')](function(_0x3d40b4){return _0x3d40b4;});}return null;};}function removeEntity(_0x4a3e0f){return function(_0x1cb7e2){if(_0x1cb7e2){return _0x1cb7e2[_0xcf50('0x28')]()[_0xcf50('0x14')](function(){_0x4a3e0f['status'](0xcc)[_0xcf50('0x29')]();});}};}function handleEntityNotFound(_0x114f60){return function(_0x292673){if(!_0x292673){_0x114f60[_0xcf50('0x2a')](0x194);}return _0x292673;};}function handleError(_0x3f99b2,_0x312301){_0x312301=_0x312301||0x1f4;return function(_0x503bb8){logger[_0xcf50('0x19')](_0x503bb8[_0xcf50('0x2b')]);if(_0x503bb8[_0xcf50('0x2c')]){delete _0x503bb8[_0xcf50('0x2c')];}_0x3f99b2[_0xcf50('0x1f')](_0x312301)['send'](_0x503bb8);};}exports['index']=function(_0x240399,_0x37b3be){var _0x1ecad2={},_0x226655={},_0x204f93={'count':0x0,'rows':[]};var _0x405485=_[_0xcf50('0x2d')](db[_0xcf50('0x2e')][_0xcf50('0x2f')],function(_0x104fa6){return{'name':_0x104fa6[_0xcf50('0x30')],'type':_0x104fa6[_0xcf50('0x31')]['key']};});_0x226655[_0xcf50('0x32')]=_['map'](_0x405485,_0xcf50('0x2c'));_0x226655[_0xcf50('0x33')]=_['keys'](_0x240399[_0xcf50('0x33')]);_0x226655[_0xcf50('0x34')]=_[_0xcf50('0x35')](_0x226655[_0xcf50('0x32')],_0x226655[_0xcf50('0x33')]);_0x1ecad2[_0xcf50('0x36')]=_[_0xcf50('0x35')](_0x226655[_0xcf50('0x32')],qs[_0xcf50('0x37')](_0x240399[_0xcf50('0x33')][_0xcf50('0x37')]));_0x1ecad2['attributes']=_0x1ecad2[_0xcf50('0x36')]['length']?_0x1ecad2[_0xcf50('0x36')]:_0x226655['model'];if(!_0x240399['query'][_0xcf50('0x38')]('nolimit')){_0x1ecad2['limit']=qs[_0xcf50('0x23')](_0x240399[_0xcf50('0x33')][_0xcf50('0x23')]);_0x1ecad2[_0xcf50('0x21')]=qs[_0xcf50('0x21')](_0x240399[_0xcf50('0x33')][_0xcf50('0x21')]);}_0x1ecad2[_0xcf50('0x39')]=qs['sort'](_0x240399[_0xcf50('0x33')][_0xcf50('0x3a')]);_0x1ecad2[_0xcf50('0x3b')]=qs[_0xcf50('0x34')](_[_0xcf50('0x3c')](_0x240399['query'],_0x226655[_0xcf50('0x34')]),_0x405485);if(_0x240399['query'][_0xcf50('0x3d')]){_0x1ecad2[_0xcf50('0x3b')]=_[_0xcf50('0x3e')](_0x1ecad2[_0xcf50('0x3b')],{'$or':_[_0xcf50('0x2d')](_0x405485,function(_0x57d9c5){if(_0x57d9c5['type']!==_0xcf50('0x3f')){var _0x34ec58={};_0x34ec58[_0x57d9c5['name']]={'$like':'%'+_0x240399['query']['filter']+'%'};return _0x34ec58;}})});}_0x1ecad2=_[_0xcf50('0x3e')]({},_0x1ecad2,_0x240399[_0xcf50('0x40')]);var _0x37381c={'where':_0x1ecad2[_0xcf50('0x3b')]};return db['MailMessage'][_0xcf50('0x24')](_0x37381c)[_0xcf50('0x14')](function(_0x37bc83){_0x204f93[_0xcf50('0x24')]=_0x37bc83;if(_0x240399[_0xcf50('0x33')]['includeAll']){_0x1ecad2['include']=[{'all':!![]}];}return db[_0xcf50('0x2e')][_0xcf50('0x41')](_0x1ecad2);})[_0xcf50('0x14')](function(_0x5bea5b){_0x204f93[_0xcf50('0x42')]=_0x5bea5b;return _0x204f93;})[_0xcf50('0x14')](respondWithFilteredResult(_0x37b3be,_0x1ecad2))[_0xcf50('0x1e')](handleError(_0x37b3be,null));};exports[_0xcf50('0x43')]=function(_0x2dfdfd,_0x3aab30){var _0x3bb9e0={'raw':!![],'where':{'id':_0x2dfdfd[_0xcf50('0x44')]['id']}},_0x13e96e={};_0x13e96e[_0xcf50('0x32')]=_['keys'](db['MailMessage'][_0xcf50('0x2f')]);_0x13e96e[_0xcf50('0x33')]=_[_0xcf50('0x45')](_0x2dfdfd[_0xcf50('0x33')]);_0x13e96e[_0xcf50('0x34')]=_['intersection'](_0x13e96e[_0xcf50('0x32')],_0x13e96e['query']);_0x3bb9e0[_0xcf50('0x36')]=_[_0xcf50('0x35')](_0x13e96e[_0xcf50('0x32')],qs[_0xcf50('0x37')](_0x2dfdfd[_0xcf50('0x33')][_0xcf50('0x37')]));_0x3bb9e0[_0xcf50('0x36')]=_0x3bb9e0[_0xcf50('0x36')]['length']?_0x3bb9e0[_0xcf50('0x36')]:_0x13e96e[_0xcf50('0x32')];if(_0x2dfdfd[_0xcf50('0x33')]['includeAll']){_0x3bb9e0['include']=[{'all':!![]}];}_0x3bb9e0=_['merge']({},_0x3bb9e0,_0x2dfdfd[_0xcf50('0x40')]);return db[_0xcf50('0x2e')][_0xcf50('0x46')](_0x3bb9e0)['then'](handleEntityNotFound(_0x3aab30,null))[_0xcf50('0x14')](respondWithResult(_0x3aab30,null))[_0xcf50('0x1e')](handleError(_0x3aab30,null));};exports[_0xcf50('0x27')]=function(_0x3f9ff2,_0x3c3b27){if(_0x3f9ff2['body']['id']){delete _0x3f9ff2[_0xcf50('0x47')]['id'];}return db[_0xcf50('0x2e')][_0xcf50('0x46')]({'where':{'id':_0x3f9ff2['params']['id']}})['then'](handleEntityNotFound(_0x3c3b27,null))['then'](saveUpdates(_0x3f9ff2[_0xcf50('0x47')],null))[_0xcf50('0x14')](respondWithResult(_0x3c3b27,null))[_0xcf50('0x1e')](handleError(_0x3c3b27,null));};exports['destroy']=function(_0x2352e0,_0x2a62aa){return db[_0xcf50('0x2e')][_0xcf50('0x46')]({'where':{'id':_0x2352e0[_0xcf50('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a62aa,null))[_0xcf50('0x14')](removeEntity(_0x2a62aa,null))[_0xcf50('0x1e')](handleError(_0x2a62aa,null));};exports[_0xcf50('0x48')]=function(_0x3d8a71,_0x53d5df){return db[_0xcf50('0x2e')][_0xcf50('0x48')]()[_0xcf50('0x14')](respondWithResult(_0x53d5df,null))['catch'](handleError(_0x53d5df,null));};exports[_0xcf50('0x49')]=function(_0x15336c,_0x508626){return db['MailMessage'][_0xcf50('0x49')](_0x15336c[_0xcf50('0x47')])['then'](function(_0xa66d00){if(_0xa66d00){if(_0xa66d00[_0xcf50('0x4a')]==='out'&&!_0xa66d00[_0xcf50('0x4b')]){var _0x5bf0c2,_0x33176a,_0x10fabe;if(_0x15336c['body']['to']){_0x33176a=_0x15336c[_0xcf50('0x47')]['to']['split'](',')[0x0];}return db[_0xcf50('0x4c')]['findOne']({'where':{'id':_0xa66d00[_0xcf50('0x4d')]},'include':[{'model':db['CmList'],'as':_0xcf50('0x4e'),'include':[{'model':db[_0xcf50('0x4f')],'as':_0xcf50('0x50'),'where':{'email':_0x33176a},'limit':0x1,'order':[['updatedAt',_0xcf50('0x51')]]}]},{'model':db[_0xcf50('0x52')],'as':_0xcf50('0x53'),'raw':!![]}]})['then'](function(_0x3cbbc5){_0x5bf0c2=_0x3cbbc5;if(_0x5bf0c2&&_0x5bf0c2[_0xcf50('0x53')]){var _0x14febc={'tls':{'rejectUnauthorized':![]}};if(_[_0xcf50('0x54')](_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x55')])){_0x14febc[_0xcf50('0x56')]=_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x56')];_0x14febc['port']=_0x5bf0c2['Smtp'][_0xcf50('0x57')];_0x14febc[_0xcf50('0x58')]=_0x5bf0c2[_0xcf50('0x53')]['secure'];if(_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x59')]){_0x14febc[_0xcf50('0x5a')]={'user':_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x5b')],'pass':_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x5c')]};}}else{_0x14febc[_0xcf50('0x55')]=_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x55')];_0x14febc['auth']={'user':_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x5b')],'pass':_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x5c')]};_0x14febc['secure']=_0x5bf0c2[_0xcf50('0x53')][_0xcf50('0x58')];}if(_0x15336c['body']['attachments']&&_0x15336c['body'][_0xcf50('0x5d')][_0xcf50('0x5e')]){for(var _0x5555b6=0x0;_0x5555b6<_0x15336c[_0xcf50('0x47')][_0xcf50('0x5d')]['length'];_0x5555b6+=0x1){_0x15336c['body'][_0xcf50('0x5d')][_0x5555b6]={'filename':_0x15336c[_0xcf50('0x47')][_0xcf50('0x5d')][_0x5555b6][_0xcf50('0x2c')],'path':path['join'](config[_0xcf50('0x5f')],_0xcf50('0x60'),_0x15336c[_0xcf50('0x47')]['attachments'][_0x5555b6][_0xcf50('0x61')])};}}_0x10fabe={'account':_0x14febc,'message':_0x15336c[_0xcf50('0x47')]};return;}})[_0xcf50('0x14')](function(){if(_0x5bf0c2['List']){if(_0x5bf0c2[_0xcf50('0x4e')][_0xcf50('0x50')][_0xcf50('0x5e')]){return _0x5bf0c2[_0xcf50('0x4e')][_0xcf50('0x50')][0x0];}else{return db[_0xcf50('0x4f')][_0xcf50('0x49')](_[_0xcf50('0x62')](_0x15336c[_0xcf50('0x47')],{'firstName':_0x15336c['body']['to'],'email':_0x15336c[_0xcf50('0x47')]['to'],'phone':_0x15336c[_0xcf50('0x47')]['to'],'ListId':_0x5bf0c2[_0xcf50('0x63')]}));}}else{throw new Error(_0xcf50('0x64'));}})[_0xcf50('0x14')](function(){if(_0x10fabe){return respondWithRpcPromise(_0xcf50('0x65'),_0xcf50('0x66'),_0x10fabe,client9003)['then'](function(_0x1331bd){return _0xa66d00[_0xcf50('0x27')]({'read':!![],'messageId':_0x1331bd[_0xcf50('0x67')],'sentAt':moment()[_0xcf50('0x68')](_0xcf50('0x69'))});})['catch'](function(_0x34d916){logger[_0xcf50('0x19')]('%s',JSON['stringify'](_0x34d916));return _0xa66d00;});}return _0xa66d00;});}return _0xa66d00;}})[_0xcf50('0x14')](respondWithResult(_0x508626,0xc9))['catch'](handleError(_0x508626,null));};exports[_0xcf50('0x6a')]=function(_0x4efb16,_0x5cf6bb){var _0x22ddea={'agent':{},'channel':'mail'};if(_0x4efb16['body']['id']){delete _0x4efb16[_0xcf50('0x47')]['id'];}_0x4efb16[_0xcf50('0x47')][_0xcf50('0x6b')]=!![];_0x4efb16[_0xcf50('0x47')][_0xcf50('0x6c')]=moment()['format'](_0xcf50('0x69'));_0x4efb16['body'][_0xcf50('0x6d')]=_0x4efb16[_0xcf50('0x47')][_0xcf50('0x6d')]||_0x4efb16[_0xcf50('0x5b')]['id'];_0x22ddea[_0xcf50('0x6e')]['id']=_0x4efb16['body'][_0xcf50('0x6d')];return db[_0xcf50('0x2e')]['find']({'where':{'id':_0x4efb16[_0xcf50('0x44')]['id'],'UserId':null}})[_0xcf50('0x14')](handleEntityNotFound(_0x5cf6bb,null))[_0xcf50('0x14')](saveUpdates(_0x4efb16[_0xcf50('0x47')],null))['then'](function(_0x5559b1){if(_0x5559b1){_0x22ddea[_0xcf50('0x1c')]=_0x5559b1[_0xcf50('0x6f')]({'plain':!![]});return db['MailInteraction'][_0xcf50('0x46')]({'where':{'id':_0x5559b1['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5cf6bb,null))['then'](function(_0x2699d1){if(_0x2699d1){return _0x2699d1[_0xcf50('0x27')]({'UserId':_0x4efb16[_0xcf50('0x47')][_0xcf50('0x6d')],'read1stAt':_[_0xcf50('0x54')](_0x2699d1['read1stAt'])?moment()['format'](_0xcf50('0x69')):undefined});}return null;})[_0xcf50('0x14')](function(_0x1355bc){if(_0x1355bc){_0x22ddea[_0xcf50('0x70')]=_0x1355bc[_0xcf50('0x6f')]({'plain':!![]});interaction_log[_0xcf50('0x15')](_0xcf50('0x71'),_0x4efb16[_0xcf50('0x5b')]['id'],_0x4efb16[_0xcf50('0x5b')][_0xcf50('0x2c')],_0x4efb16[_0xcf50('0x5b')]['role'],_0x22ddea[_0xcf50('0x70')]['id'],_0x4efb16[_0xcf50('0x47')]?JSON['stringify'](_0x4efb16[_0xcf50('0x47')]):_0xcf50('0x72'));return respondWithRpcPromise(_0xcf50('0x73'),'acceptMessage',_0x22ddea);}return null;})[_0xcf50('0x14')](function(_0x336fde){var _0x51e6c8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x336fde['message'][_0xcf50('0x74')];return db[_0xcf50('0x75')][_0xcf50('0x33')](_0x51e6c8,{'type':db[_0xcf50('0x76')][_0xcf50('0x77')][_0xcf50('0x78')],'raw':!![]})['then'](function(_0x3e4681){return _0x3e4681;});})[_0xcf50('0x14')](function(_0x4b7b25){if(_0x4b7b25){_0x22ddea[_0xcf50('0x1c')][_0xcf50('0x79')]=_0x4b7b25[0x0];if(!_0x4efb16[_0xcf50('0x47')][_0xcf50('0x6d')])return;return db[_0xcf50('0x7a')]['find']({'where':{'id':_0x4efb16[_0xcf50('0x47')][_0xcf50('0x6d')],'role':_0xcf50('0x6e')},'attributes':['id','name',_0xcf50('0x7b'),'email',_0xcf50('0x7c')],'raw':!![]});}return null;})[_0xcf50('0x14')](function(_0x7c9d16){if(!_0x7c9d16)return null;_0x22ddea['message'][_0xcf50('0x6e')]=_0x7c9d16;return _0x22ddea;})['then'](function(_0x2a5328){if(_0x2a5328){if(_0x4efb16[_0xcf50('0x47')][_0xcf50('0x7d')]){_0x22ddea['message']['interface']=util[_0xcf50('0x68')](_0xcf50('0x7e'),_0x4efb16['user'][_0xcf50('0x2c')]);_0x22ddea['message'][_0xcf50('0x7f')]=_0x22ddea[_0xcf50('0x7f')];_0x22ddea[_0xcf50('0x1c')][_0xcf50('0x80')]=_0x22ddea[_0xcf50('0x7f')];_0x22ddea[_0xcf50('0x1c')]['event']='accept';_0x22ddea[_0xcf50('0x1c')][_0xcf50('0x47')]=htmlToText[_0xcf50('0x81')](_0x22ddea[_0xcf50('0x1c')]['body']);return respondWithRpcPromise('EventManager',_0xcf50('0x82'),{'event':_0xcf50('0x83'),'message':_0x22ddea[_0xcf50('0x1c')]},client9002)['then'](function(){return _0x22ddea;});}return _0x22ddea;}return null;})[_0xcf50('0x14')](respondWithResult(_0x5cf6bb,null))[_0xcf50('0x1e')](handleError(_0x5cf6bb,null));};exports['reject']=function(_0x483e16,_0x1fd8da){var _0x1fe9d2={'agent':{},'channel':_0xcf50('0x84')};if(_0x483e16[_0xcf50('0x47')]['id']){delete _0x483e16[_0xcf50('0x47')]['id'];}_0x483e16[_0xcf50('0x47')]['UserId']=_0x483e16['body']['UserId']||_0x483e16[_0xcf50('0x5b')]['id'];_0x1fe9d2['agent']['id']=_0x483e16[_0xcf50('0x47')][_0xcf50('0x6d')];return db[_0xcf50('0x2e')][_0xcf50('0x46')]({'where':{'id':_0x483e16[_0xcf50('0x44')]['id'],'UserId':null}})[_0xcf50('0x14')](handleEntityNotFound(_0x1fd8da,null))[_0xcf50('0x14')](function(_0x496d5f){if(_0x496d5f){_0x1fe9d2[_0xcf50('0x1c')]=_0x496d5f['get']({'plain':!![]});return db['MailInteraction'][_0xcf50('0x46')]({'where':{'id':_0x496d5f['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1fd8da,null))['then'](function(_0x48dc9f){if(_0x48dc9f){_0x1fe9d2['interaction']=_0x48dc9f[_0xcf50('0x6f')]({'plain':!![]});interaction_log[_0xcf50('0x15')](_0xcf50('0x85'),_0x483e16['user']['id'],_0x483e16['user'][_0xcf50('0x2c')],_0x483e16['user'][_0xcf50('0x86')],_0x1fe9d2['interaction']['id'],_0x483e16['body']?JSON[_0xcf50('0x87')](_0x483e16[_0xcf50('0x47')]):'null');return respondWithRpcPromise(_0xcf50('0x88'),_0xcf50('0x89'),_0x1fe9d2);}return null;})[_0xcf50('0x14')](function(_0x1511fd){var _0x5a67d5=_0xcf50('0x8a')+_0x1511fd[_0xcf50('0x1c')]['ContactId'];return db[_0xcf50('0x75')][_0xcf50('0x33')](_0x5a67d5,{'type':db['Sequelize'][_0xcf50('0x77')][_0xcf50('0x78')],'raw':!![]})[_0xcf50('0x14')](function(_0x35daae){return _0x35daae;});})[_0xcf50('0x14')](function(_0x262dfc){if(_0x262dfc){_0x1fe9d2['message']['contact']=_0x262dfc[0x0];if(!_0x483e16[_0xcf50('0x47')][_0xcf50('0x6d')])return;return db['User'][_0xcf50('0x46')]({'where':{'id':_0x483e16['body'][_0xcf50('0x6d')],'role':_0xcf50('0x6e')},'attributes':['id',_0xcf50('0x2c'),_0xcf50('0x7b'),_0xcf50('0x8b'),_0xcf50('0x7c')],'raw':!![]});}return null;})[_0xcf50('0x14')](function(_0xbe20c6){if(!_0xbe20c6)return null;_0x1fe9d2[_0xcf50('0x1c')]['agent']=_0xbe20c6;return _0x1fe9d2;})['then'](function(_0x1f000b){if(_0x1f000b){_0x1f000b[_0xcf50('0x1c')][_0xcf50('0x8c')]=util[_0xcf50('0x68')]('SIP/%s',_0x483e16[_0xcf50('0x5b')]['name']);_0x1f000b[_0xcf50('0x1c')][_0xcf50('0x7f')]=_0x1fe9d2[_0xcf50('0x7f')];_0x1f000b[_0xcf50('0x1c')]['motionChannel']=_0x1fe9d2[_0xcf50('0x7f')];_0x1f000b[_0xcf50('0x1c')]['event']='reject';_0x1f000b['message']['body']=htmlToText[_0xcf50('0x81')](_0x1fe9d2[_0xcf50('0x1c')][_0xcf50('0x47')]);respondWithRpcPromise(_0xcf50('0x82'),_0xcf50('0x82'),{'event':_0xcf50('0x8d'),'message':_0x1f000b[_0xcf50('0x1c')]},client9002);return _0x1fe9d2;}return null;})[_0xcf50('0x14')](respondWithResult(_0x1fd8da,null))[_0xcf50('0x1e')](handleError(_0x1fd8da,null));};exports[_0xcf50('0x8e')]=function(_0x31b037,_0x2ca541){var _0x14d0e4=moment()['unix']()[_0xcf50('0x8f')]();var _0x1fe91d=path[_0xcf50('0x90')](config[_0xcf50('0x5f')],_0xcf50('0x91'),_0xcf50('0x92'),_0xcf50('0x93'));var _0x2bdbba=path[_0xcf50('0x90')](config[_0xcf50('0x5f')],_0xcf50('0x91'),_0xcf50('0x92'),'attachments');var _0x12a21e=util[_0xcf50('0x68')](_0xcf50('0x94'),_0x14d0e4);return db[_0xcf50('0x2e')][_0xcf50('0x46')]({'where':{'id':_0x31b037[_0xcf50('0x44')]['id']},'attributes':['id','body',_0xcf50('0x95'),'to','cc','bcc',_0xcf50('0x96'),'createdAt'],'include':_0x31b037[_0xcf50('0x33')][_0xcf50('0x5d')]?[{'model':db['Attachment'],'as':_0xcf50('0x97')}]:undefined})[_0xcf50('0x14')](handleEntityNotFound(_0x2ca541,null))['then'](function(_0x44b7ae){if(_0x44b7ae){var _0x1d2bed=_0x44b7ae;var _0x59f9d8={'from':_0x1d2bed['from'],'to':_0x1d2bed['to'],'subject':_0x1d2bed[_0xcf50('0x96')],'html':htmlEntities[_0xcf50('0x98')](_0x1d2bed[_0xcf50('0x47')]),'headers':{'Date':moment(_0x1d2bed['createdAt'])[_0xcf50('0x68')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x44b7ae['cc']){_0x59f9d8[_0xcf50('0x99')]['Cc']=_0x44b7ae['cc'];}if(_0x44b7ae['bcc']){_0x59f9d8[_0xcf50('0x99')][_0xcf50('0x9a')]=_0x44b7ae[_0xcf50('0x9b')];}return new BPromise(function(_0x4ef8d4,_0x583270){if(_0x44b7ae[_0xcf50('0x97')]){for(var _0x2b4bf3=0x0;_0x2b4bf3<_0x44b7ae[_0xcf50('0x97')]['length'];_0x2b4bf3++){var _0x29ed66=_0x44b7ae['Attachments'][_0x2b4bf3];var _0x5b6eae=path[_0xcf50('0x90')](_0x2bdbba,_0x29ed66[_0xcf50('0x61')]);if(fs['existsSync'](_0x5b6eae)){_0x59f9d8[_0xcf50('0x5d')][_0xcf50('0x9c')]({'name':_0x29ed66[_0xcf50('0x2c')],'contentType':_0x29ed66[_0xcf50('0x31')],'data':fs[_0xcf50('0x9d')](_0x5b6eae)});}}}emlformat[_0xcf50('0x9e')](_0x59f9d8,function(_0xca4065,_0x802892){if(_0xca4065)return _0x583270(_0xca4065);fs[_0xcf50('0x9f')](path['join'](_0x1fe91d,_0x12a21e),_0x802892);return _0x4ef8d4(_0x802892);});});}})[_0xcf50('0x14')](function(_0x3660b0){if(_0x3660b0){return _0x2ca541[_0xcf50('0x8e')](path[_0xcf50('0x90')](_0x1fe91d,_0x12a21e),_0x12a21e,function(_0x3897ac){if(!_0x3897ac)fs[_0xcf50('0xa0')](path[_0xcf50('0x90')](_0x1fe91d,_0x12a21e));});}})[_0xcf50('0x1e')](handleError(_0x2ca541,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 94bde27..6503f14 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 _0x30ef=['MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30ef,0x10c));var _0xf30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ef[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf30e('0x0'));var MailMessage=require(_0xf30e('0x1'))['db'][_0xf30e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf30e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf30e('0x4'),'afterDestroy':_0xf30e('0x5')};function emitEvent(_0x3a4fc3){return function(_0x59381d,_0x2563e3,_0x42a5c1){MailMessageEvents[_0xf30e('0x6')](_0x3a4fc3+':'+_0x59381d['id'],_0x59381d);MailMessageEvents[_0xf30e('0x6')](_0x3a4fc3,_0x59381d);_0x42a5c1(null);};}for(var e in events){if(events[_0xf30e('0x7')](e)){var event=events[e];MailMessage[_0xf30e('0x8')](e,emitEvent(event));}}module[_0xf30e('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x19ed=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x115b0a,_0x5c5982){var _0x4421de=function(_0x144f05){while(--_0x144f05){_0x115b0a['push'](_0x115b0a['shift']());}};_0x4421de(++_0x5c5982);}(_0x19ed,0x1df));var _0xd19e=function(_0x5c920d,_0x4b12ca){_0x5c920d=_0x5c920d-0x0;var _0x35e4ad=_0x19ed[_0x5c920d];return _0x35e4ad;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xd19e('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd19e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd19e('0x2')};function emitEvent(_0x10aa01){return function(_0x2dfb79,_0x3b3aa6,_0x580f0a){MailMessageEvents[_0xd19e('0x3')](_0x10aa01+':'+_0x2dfb79['id'],_0x2dfb79);MailMessageEvents[_0xd19e('0x3')](_0x10aa01,_0x2dfb79);_0x580f0a(null);};}for(var e in events){if(events[_0xd19e('0x4')](e)){var event=events[e];MailMessage[_0xd19e('0x5')](e,emitEvent(event));}}module[_0xd19e('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9a97b77..56a608e 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 _0x5130=['toLowerCase','direction','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x5130,0xcd));var _0x0513=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0x5130[_0x4b9978];return _0x42f0e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0513('0x0'))(_0x0513('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0513('0x2'));var htmlToText=require(_0x0513('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0513('0x4'));var attributes=require(_0x0513('0x5'));module[_0x0513('0x6')]=function(_0x1335fb,_0x587e67){return _0x1335fb[_0x0513('0x7')](_0x0513('0x8'),attributes,{'tableName':_0x0513('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0513('0xa')]},{'name':_0x0513('0xb'),'fields':[_0x0513('0xc'),_0x0513('0xd')],'type':_0x0513('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x95ffd2,_0x540b87,_0x33d332){if(_0x95ffd2[_0x0513('0xf')]){_0x95ffd2[_0x0513('0xc')]=htmlToText[_0x0513('0x10')](_0x95ffd2[_0x0513('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x33d332(null,_0x540b87);},'afterCreate':function(_0x518daa,_0x429f12,_0x15bdee){var _0x35eae9=_0x1335fb[_0x0513('0x11')];var _0xc9f8e2=_0x518daa[_0x0513('0x12')]({'plain':!![]});if(_0xc9f8e2['direction'][_0x0513('0x13')]()==='in'||_0xc9f8e2[_0x0513('0x14')][_0x0513('0x13')]()==='out'&&!_0xc9f8e2['secret']&&!_[_0x0513('0x15')](_0xc9f8e2[_0x0513('0x16')])){_0x35eae9[_0x0513('0x17')][_0x0513('0x18')]({'where':{'id':_0xc9f8e2[_0x0513('0x19')]}})['then'](function(_0xbeff66){if(_0xbeff66){_0xbeff66[_0x0513('0x1a')]({'lastMsgAt':_0xc9f8e2[_0x0513('0x1b')],'lastMsgDirection':_0xc9f8e2[_0x0513('0x14')][_0x0513('0x13')]()});}})[_0x0513('0x1c')](function(_0x33ec27){console[_0x0513('0x1d')](_0x33ec27);});}_0x15bdee();}},'charset':_0x0513('0x1e'),'collate':_0x0513('0x1f')});}; \ No newline at end of file +var _0xc006=['out','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','direction','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','fti_mail_messages','plainBody','subject','fromString','body','toLowerCase'];(function(_0x1a0330,_0x3ff9f5){var _0x472141=function(_0x2e1e76){while(--_0x2e1e76){_0x1a0330['push'](_0x1a0330['shift']());}};_0x472141(++_0x3ff9f5);}(_0xc006,0x1bd));var _0x6c00=function(_0x478708,_0x816b6c){_0x478708=_0x478708-0x0;var _0x5c4bf0=_0xc006[_0x478708];return _0x5c4bf0;};'use strict';var _=require(_0x6c00('0x0'));var util=require(_0x6c00('0x1'));var logger=require(_0x6c00('0x2'))('api');var moment=require(_0x6c00('0x3'));var BPromise=require(_0x6c00('0x4'));var rp=require('request-promise');var htmlToText=require(_0x6c00('0x5'));var fs=require('fs');var path=require(_0x6c00('0x6'));var rimraf=require(_0x6c00('0x7'));var config=require(_0x6c00('0x8'));var attributes=require(_0x6c00('0x9'));module[_0x6c00('0xa')]=function(_0x47ff09,_0x5e1dd0){return _0x47ff09[_0x6c00('0xb')](_0x6c00('0xc'),attributes,{'tableName':_0x6c00('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x6c00('0xe'),'fields':[_0x6c00('0xf'),_0x6c00('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x598e4c,_0x1b0e48,_0x5a15a8){if(_0x598e4c['body']){_0x598e4c[_0x6c00('0xf')]=htmlToText[_0x6c00('0x11')](_0x598e4c[_0x6c00('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5a15a8(null,_0x1b0e48);},'afterCreate':function(_0x17ab58,_0x27736d,_0x1e1d21){var _0x574f52=_0x47ff09['models'];var _0x121481=_0x17ab58['get']({'plain':!![]});if(_0x121481['direction'][_0x6c00('0x13')]()==='in'||_0x121481['direction']['toLowerCase']()===_0x6c00('0x14')&&!_0x121481['secret']&&!_[_0x6c00('0x15')](_0x121481['UserId'])){_0x574f52[_0x6c00('0x16')][_0x6c00('0x17')]({'where':{'id':_0x121481[_0x6c00('0x18')]}})[_0x6c00('0x19')](function(_0x4c5961){if(_0x4c5961){_0x4c5961[_0x6c00('0x1a')]({'lastMsgAt':_0x121481[_0x6c00('0x1b')],'lastMsgDirection':_0x121481[_0x6c00('0x1c')][_0x6c00('0x13')]()});}})[_0x6c00('0x1d')](function(_0x128492){console['error'](_0x128492);});}_0x1e1d21();}},'charset':'utf8mb4','collate':_0x6c00('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e6f8cdd..b74b768 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63a5=['error','message','result','catch','body','options','raw','CreateMailMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xaab440,_0x2d77c4){var _0x230d7a=function(_0x155b52){while(--_0x155b52){_0xaab440['push'](_0xaab440['shift']());}};_0x230d7a(++_0x2d77c4);}(_0x63a5,0x18e));var _0x563a=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x63a5[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});config[_0x563a('0x9')]=_[_0x563a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x563a('0xb'))(new Redis(config[_0x563a('0x9')]));require(_0x563a('0xc'))[_0x563a('0xd')](socket);function respondWithRpcPromise(_0x255922,_0xa61ffa,_0xd1b480){return new BPromise(function(_0x381fab,_0x3e97a8){return client[_0x563a('0xe')](_0x255922,_0xd1b480)[_0x563a('0xf')](function(_0x2361dd){logger[_0x563a('0x10')](_0x563a('0x11'),_0xa61ffa,'request\x20sent');logger[_0x563a('0x12')](_0x563a('0x13'),_0xa61ffa,_0x563a('0x14'),JSON[_0x563a('0x15')](_0x2361dd));if(_0x2361dd[_0x563a('0x16')]){if(_0x2361dd[_0x563a('0x16')]['code']===0x1f4){logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);return _0x3e97a8(_0x2361dd['error']['message']);}logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd['error'][_0x563a('0x17')]);return _0x381fab(_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);}else{logger[_0x563a('0x10')]('MailMessage,\x20%s,\x20%s',_0xa61ffa,'request\x20sent');_0x381fab(_0x2361dd[_0x563a('0x18')][_0x563a('0x17')]);}})[_0x563a('0x19')](function(_0x526a51){logger['error']('MailMessage,\x20%s,\x20%s',_0xa61ffa,_0x526a51);_0x3e97a8(_0x526a51);});});}exports['CreateMailMessage']=function(_0x40916a){var _0x300956=this;return new Promise(function(_0x26061f,_0x43b7a8){return db['MailMessage']['create'](_0x40916a[_0x563a('0x1a')],{'raw':_0x40916a[_0x563a('0x1b')]?_0x40916a[_0x563a('0x1b')][_0x563a('0x1c')]===undefined?!![]:![]:!![]})[_0x563a('0xf')](function(_0x2dc7e2){logger[_0x563a('0x10')](_0x563a('0x1d'),_0x40916a);logger['debug'](_0x563a('0x1d'),_0x40916a,JSON['stringify'](_0x2dc7e2));_0x26061f(_0x2dc7e2);})[_0x563a('0x19')](function(_0xd3e0ae){logger[_0x563a('0x16')](_0x563a('0x1d'),_0xd3e0ae[_0x563a('0x17')],_0x40916a);_0x43b7a8(_0x300956[_0x563a('0x16')](0x1f4,_0xd3e0ae[_0x563a('0x17')]));});});}; \ No newline at end of file +var _0xd914=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','lodash'];(function(_0x64bfc4,_0x46d7fe){var _0x4f6d04=function(_0x4db4bd){while(--_0x4db4bd){_0x64bfc4['push'](_0x64bfc4['shift']());}};_0x4f6d04(++_0x46d7fe);}(_0xd914,0x17f));var _0x4d91=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0xd914[_0x290fa6];return _0x47f1f3;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});config[_0x4d91('0xb')]=_[_0x4d91('0xc')](config[_0x4d91('0xb')],{'host':_0x4d91('0xd'),'port':0x18eb});var socket=require(_0x4d91('0xe'))(new Redis(config[_0x4d91('0xb')]));require('./mailMessage.socket')[_0x4d91('0xf')](socket);function respondWithRpcPromise(_0xa4bb25,_0xc07c64,_0x278648){return new BPromise(function(_0xb234d2,_0x266b31){return client['request'](_0xa4bb25,_0x278648)['then'](function(_0x2ccd08){logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));logger[_0x4d91('0x13')](_0x4d91('0x14'),_0xc07c64,'request\x20sent',JSON['stringify'](_0x2ccd08));if(_0x2ccd08[_0x4d91('0x15')]){if(_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x16')]===0x1f4){logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0x266b31(_0x2ccd08['error'][_0x4d91('0x17')]);}logger[_0x4d91('0x15')](_0x4d91('0x11'),_0xc07c64,_0x2ccd08[_0x4d91('0x15')][_0x4d91('0x17')]);return _0xb234d2(_0x2ccd08['error'][_0x4d91('0x17')]);}else{logger[_0x4d91('0x10')](_0x4d91('0x11'),_0xc07c64,_0x4d91('0x12'));_0xb234d2(_0x2ccd08['result'][_0x4d91('0x17')]);}})[_0x4d91('0x18')](function(_0x13254c){logger['error'](_0x4d91('0x11'),_0xc07c64,_0x13254c);_0x266b31(_0x13254c);});});}exports[_0x4d91('0x19')]=function(_0x351388){var _0xd59fe=this;return new Promise(function(_0x10b767,_0x40cde4){return db[_0x4d91('0x1a')][_0x4d91('0x1b')](_0x351388[_0x4d91('0x1c')],{'raw':_0x351388[_0x4d91('0x1d')]?_0x351388['options'][_0x4d91('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x57913e){logger[_0x4d91('0x10')](_0x4d91('0x19'),_0x351388);logger[_0x4d91('0x13')](_0x4d91('0x19'),_0x351388,JSON[_0x4d91('0x1f')](_0x57913e));_0x10b767(_0x57913e);})[_0x4d91('0x18')](function(_0x100cd4){logger[_0x4d91('0x15')]('CreateMailMessage',_0x100cd4['message'],_0x351388);_0x40cde4(_0xd59fe[_0x4d91('0x15')](0x1f4,_0x100cd4[_0x4d91('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 47185da..039ce7f 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 _0x86d5=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x521528,_0x1d6ffe){var _0x33083e=function(_0x37f868){while(--_0x37f868){_0x521528['push'](_0x521528['shift']());}};_0x33083e(++_0x1d6ffe);}(_0x86d5,0x71));var _0x586d=function(_0x2a9ccc,_0xb277e3){_0x2a9ccc=_0x2a9ccc-0x0;var _0x24344e=_0x86d5[_0x2a9ccc];return _0x24344e;};'use strict';var MailMessageEvents=require(_0x586d('0x0'));var events=[_0x586d('0x1'),_0x586d('0x2'),_0x586d('0x3')];function createListener(_0x17441c,_0x23522e){return function(_0x4fc3e5){_0x23522e[_0x586d('0x4')](_0x17441c,_0x4fc3e5);};}function removeListener(_0x361768,_0x3fee90){return function(){MailMessageEvents[_0x586d('0x5')](_0x361768,_0x3fee90);};}exports[_0x586d('0x6')]=function(_0x1bc815){for(var _0x388c87=0x0,_0x38f5d4=events[_0x586d('0x7')];_0x388c87<_0x38f5d4;_0x388c87++){var _0x3c9fc8=events[_0x388c87];var _0x12068f=createListener(_0x586d('0x8')+_0x3c9fc8,_0x1bc815);MailMessageEvents['on'](_0x3c9fc8,_0x12068f);}}; \ No newline at end of file +var _0x2c81=['./mailMessage.events','save','removeListener','length','mailMessage:'];(function(_0x25368b,_0x7cf3e1){var _0x5ec93f=function(_0x27a231){while(--_0x27a231){_0x25368b['push'](_0x25368b['shift']());}};_0x5ec93f(++_0x7cf3e1);}(_0x2c81,0x1d1));var _0x12c8=function(_0x3e0f9c,_0x54fc51){_0x3e0f9c=_0x3e0f9c-0x0;var _0x15a0b5=_0x2c81[_0x3e0f9c];return _0x15a0b5;};'use strict';var MailMessageEvents=require(_0x12c8('0x0'));var events=[_0x12c8('0x1'),'remove','update'];function createListener(_0x12d152,_0x512e60){return function(_0x70bdcf){_0x512e60['emit'](_0x12d152,_0x70bdcf);};}function removeListener(_0x43c1d2,_0x3cfb77){return function(){MailMessageEvents[_0x12c8('0x2')](_0x43c1d2,_0x3cfb77);};}exports['register']=function(_0x3177cf){for(var _0x450e8a=0x0,_0xcf5ec4=events[_0x12c8('0x3')];_0x450e8a<_0xcf5ec4;_0x450e8a++){var _0x3f3588=events[_0x450e8a];var _0x188aa6=createListener(_0x12c8('0x4')+_0x3f3588,_0x3177cf);MailMessageEvents['on'](_0x3f3588,_0x188aa6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 915fb46..d210d4d 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 _0x2016=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','/:id','update','destroy','delete','removeTeams','removeAgents'];(function(_0x3b8549,_0x33366a){var _0x21a5c9=function(_0x2d37e8){while(--_0x2d37e8){_0x3b8549['push'](_0x3b8549['shift']());}};_0x21a5c9(++_0x33366a);}(_0x2016,0xd3));var _0x6201=function(_0x43f707,_0x424e21){_0x43f707=_0x43f707-0x0;var _0x2918b9=_0x2016[_0x43f707];return _0x2918b9;};'use strict';var multer=require(_0x6201('0x0'));var util=require('util');var path=require(_0x6201('0x1'));var timeout=require(_0x6201('0x2'));var express=require(_0x6201('0x3'));var router=express[_0x6201('0x4')]();var fs_extra=require(_0x6201('0x5'));var auth=require(_0x6201('0x6'));var interaction=require(_0x6201('0x7'));var config=require(_0x6201('0x8'));var controller=require(_0x6201('0x9'));router[_0x6201('0xa')]('/',auth[_0x6201('0xb')](),controller[_0x6201('0xc')]);router[_0x6201('0xa')](_0x6201('0xd'),auth['isAuthenticated'](),controller[_0x6201('0xe')]);router[_0x6201('0xa')]('/:id',auth[_0x6201('0xb')](),controller[_0x6201('0xf')]);router[_0x6201('0xa')](_0x6201('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0x6201('0xa')](_0x6201('0x11'),auth[_0x6201('0xb')](),controller[_0x6201('0x12')]);router[_0x6201('0xa')](_0x6201('0x13'),auth['isAuthenticated'](),controller[_0x6201('0x14')]);router['post']('/',auth[_0x6201('0xb')](),controller['create']);router[_0x6201('0x15')]('/:id/teams',auth[_0x6201('0xb')](),controller['addTeams']);router['post'](_0x6201('0x13'),auth[_0x6201('0xb')](),controller[_0x6201('0x16')]);router['put'](_0x6201('0x17'),auth[_0x6201('0xb')](),controller[_0x6201('0x18')]);router['delete'](_0x6201('0x17'),auth[_0x6201('0xb')](),controller[_0x6201('0x19')]);router[_0x6201('0x1a')](_0x6201('0x11'),auth[_0x6201('0xb')](),controller[_0x6201('0x1b')]);router[_0x6201('0x1a')](_0x6201('0x13'),auth[_0x6201('0xb')](),controller[_0x6201('0x1c')]);module[_0x6201('0x1d')]=router; \ No newline at end of file +var _0x36f7=['/:id/teams','addTeams','addAgents','update','destroy','removeTeams','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post'];(function(_0x3868e4,_0x1149b0){var _0x4c77f1=function(_0x2afa93){while(--_0x2afa93){_0x3868e4['push'](_0x3868e4['shift']());}};_0x4c77f1(++_0x1149b0);}(_0x36f7,0x18f));var _0x736f=function(_0x144b50,_0x597960){_0x144b50=_0x144b50-0x0;var _0x90f20b=_0x36f7[_0x144b50];return _0x90f20b;};'use strict';var multer=require(_0x736f('0x0'));var util=require(_0x736f('0x1'));var path=require('path');var timeout=require(_0x736f('0x2'));var express=require(_0x736f('0x3'));var router=express[_0x736f('0x4')]();var fs_extra=require(_0x736f('0x5'));var auth=require(_0x736f('0x6'));var interaction=require(_0x736f('0x7'));var config=require('../../config/environment');var controller=require(_0x736f('0x8'));router['get']('/',auth[_0x736f('0x9')](),controller[_0x736f('0xa')]);router[_0x736f('0xb')](_0x736f('0xc'),auth[_0x736f('0x9')](),controller[_0x736f('0xd')]);router[_0x736f('0xb')](_0x736f('0xe'),auth['isAuthenticated'](),controller[_0x736f('0xf')]);router[_0x736f('0xb')](_0x736f('0x10'),auth[_0x736f('0x9')](),controller[_0x736f('0x11')]);router[_0x736f('0xb')]('/:id/teams',auth[_0x736f('0x9')](),controller[_0x736f('0x12')]);router[_0x736f('0xb')](_0x736f('0x13'),auth[_0x736f('0x9')](),controller['getAgents']);router[_0x736f('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x736f('0x14')](_0x736f('0x15'),auth[_0x736f('0x9')](),controller[_0x736f('0x16')]);router[_0x736f('0x14')](_0x736f('0x13'),auth[_0x736f('0x9')](),controller[_0x736f('0x17')]);router['put'](_0x736f('0xe'),auth[_0x736f('0x9')](),controller[_0x736f('0x18')]);router['delete'](_0x736f('0xe'),auth[_0x736f('0x9')](),controller[_0x736f('0x19')]);router['delete']('/:id/teams',auth[_0x736f('0x9')](),controller[_0x736f('0x1a')]);router[_0x736f('0x1b')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);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 56e2830..a086f24 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 _0x4bb1=['exports','name','STRING','beepall','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4bb1,0x126));var _0x14bb=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x4bb1[_0x2e8418];return _0x548fe6;};'use strict';var Sequelize=require(_0x14bb('0x0'));module[_0x14bb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x14bb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x14bb('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x14bb('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x6631=['name','STRING','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x1301b0,_0x46eb10){var _0x1300fa=function(_0x439162){while(--_0x439162){_0x1301b0['push'](_0x1301b0['shift']());}};_0x1300fa(++_0x46eb10);}(_0x6631,0x66));var _0x1663=function(_0x4beb67,_0x5c290a){_0x4beb67=_0x4beb67-0x0;var _0x3f5d70=_0x6631[_0x4beb67];return _0x3f5d70;};'use strict';var Sequelize=require(_0x1663('0x0'));module[_0x1663('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1663('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1663('0x3')]},'timeout':{'type':Sequelize[_0x1663('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1663('0x5')](_0x1663('0x6'),_0x1663('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7873f35..fe42d8a 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 _0x0c4c=['ids','Team','Agents','online','voicePause','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','options','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','MailQueues','UserProfileResource','error','name','send','index','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','MailQueue','includeAll','include','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','describe','UserMailQueue','hasOwnProperty','order','MailQueueId','findAll','User','UserId','agent','mailPause','createdAt','%s/%s','findOne','getTeams'];(function(_0x2a5641,_0x13bc87){var _0x56d210=function(_0x5f4af4){while(--_0x5f4af4){_0x2a5641['push'](_0x2a5641['shift']());}};_0x56d210(++_0x13bc87);}(_0x0c4c,0x140));var _0xc0c4=function(_0x48ea0d,_0x5a8794){_0x48ea0d=_0x48ea0d-0x0;var _0x3fd615=_0x0c4c[_0x48ea0d];return _0x3fd615;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0c4('0x0'));var zipdir=require(_0xc0c4('0x1'));var jsonpatch=require(_0xc0c4('0x2'));var rp=require(_0xc0c4('0x3'));var moment=require(_0xc0c4('0x4'));var BPromise=require(_0xc0c4('0x5'));var Mustache=require(_0xc0c4('0x6'));var util=require(_0xc0c4('0x7'));var path=require(_0xc0c4('0x8'));var sox=require(_0xc0c4('0x9'));var csv=require(_0xc0c4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0c4('0xb'));var squel=require(_0xc0c4('0xc'));var crypto=require(_0xc0c4('0xd'));var jsforce=require(_0xc0c4('0xe'));var deskjs=require(_0xc0c4('0xf'));var toCsv=require(_0xc0c4('0xa'));var querystring=require(_0xc0c4('0x10'));var Papa=require('papaparse');var Redis=require(_0xc0c4('0x11'));var authService=require(_0xc0c4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0c4('0x13'))(_0xc0c4('0x14'));var utils=require(_0xc0c4('0x15'));var config=require(_0xc0c4('0x16'));var licenseUtil=require(_0xc0c4('0x17'));var db=require(_0xc0c4('0x18'))['db'];config[_0xc0c4('0x19')]=_[_0xc0c4('0x1a')](config[_0xc0c4('0x19')],{'host':_0xc0c4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0c4('0x19')]));require(_0xc0c4('0x1c'))['register'](socket);function respondWithStatusCode(_0x482b9d,_0x40b774){_0x40b774=_0x40b774||0xcc;return function(_0x22f4a0){if(_0x22f4a0){return _0x482b9d[_0xc0c4('0x1d')](_0x40b774);}return _0x482b9d[_0xc0c4('0x1e')](_0x40b774)[_0xc0c4('0x1f')]();};}function respondWithResult(_0x1dc0bb,_0x4fcd5b){_0x4fcd5b=_0x4fcd5b||0xc8;return function(_0x5559b4){if(_0x5559b4){return _0x1dc0bb[_0xc0c4('0x1e')](_0x4fcd5b)[_0xc0c4('0x20')](_0x5559b4);}};}function respondWithFilteredResult(_0x2a3642,_0x4764a6){return function(_0x239d3f){if(_0x239d3f){var _0x1acc73=typeof _0x4764a6[_0xc0c4('0x21')]===_0xc0c4('0x22')&&typeof _0x4764a6[_0xc0c4('0x23')]===_0xc0c4('0x22');var _0x39d38e=_0x239d3f['count'];var _0x2bb9ac=_0x1acc73?0x0:_0x4764a6[_0xc0c4('0x21')];var _0x84eae=_0x1acc73?_0x239d3f[_0xc0c4('0x24')]:_0x4764a6[_0xc0c4('0x21')]+_0x4764a6[_0xc0c4('0x23')];var _0x3989c1;if(_0x84eae>=_0x39d38e){_0x84eae=_0x39d38e;_0x3989c1=0xc8;}else{_0x3989c1=0xce;}_0x2a3642[_0xc0c4('0x1e')](_0x3989c1);return _0x2a3642['set'](_0xc0c4('0x25'),_0x2bb9ac+'-'+_0x84eae+'/'+_0x39d38e)[_0xc0c4('0x20')](_0x239d3f);}return null;};}function patchUpdates(_0x57aa44){return function(_0x5bae0b){try{jsonpatch[_0xc0c4('0x26')](_0x5bae0b,_0x57aa44,!![]);}catch(_0x287bc5){return BPromise[_0xc0c4('0x27')](_0x287bc5);}return _0x5bae0b[_0xc0c4('0x28')]();};}function saveUpdates(_0x30bd9a,_0x3a0037){return function(_0x4f7cfe){if(_0x4f7cfe){return _0x4f7cfe[_0xc0c4('0x29')](_0x30bd9a)[_0xc0c4('0x2a')](function(_0x5bc06d){return _0x5bc06d;});}return null;};}function removeEntity(_0x55896d,_0x1df3fe){return function(_0x5bcb13){if(_0x5bcb13){return _0x5bcb13['destroy']()[_0xc0c4('0x2a')](function(){var _0x5279c3=_0x5bcb13[_0xc0c4('0x2b')]({'plain':!![]});var _0x26b8f0=_0xc0c4('0x2c');return db[_0xc0c4('0x2d')]['destroy']({'where':{'type':_0x26b8f0,'resourceId':_0x5279c3['id']}})[_0xc0c4('0x2a')](function(){return _0x5bcb13;});})['then'](function(){_0x55896d[_0xc0c4('0x1e')](0xcc)[_0xc0c4('0x1f')]();});}};}function handleEntityNotFound(_0x12bd3a,_0x86eaa1){return function(_0x4c7337){if(!_0x4c7337){_0x12bd3a[_0xc0c4('0x1d')](0x194);}return _0x4c7337;};}function handleError(_0x2b1b8a,_0x35b1ac){_0x35b1ac=_0x35b1ac||0x1f4;return function(_0x408d31){logger[_0xc0c4('0x2e')](_0x408d31['stack']);if(_0x408d31[_0xc0c4('0x2f')]){delete _0x408d31[_0xc0c4('0x2f')];}_0x2b1b8a[_0xc0c4('0x1e')](_0x35b1ac)[_0xc0c4('0x30')](_0x408d31);};}exports[_0xc0c4('0x31')]=function(_0x3eb619,_0x316f8f){var _0x529993={},_0x200afd={},_0x240864={'count':0x0,'rows':[]};var _0x3f0585=_['map'](db['MailQueue']['rawAttributes'],function(_0x51fb25){return{'name':_0x51fb25['fieldName'],'type':_0x51fb25[_0xc0c4('0x32')]['key']};});_0x200afd[_0xc0c4('0x33')]=_[_0xc0c4('0x34')](_0x3f0585,_0xc0c4('0x2f'));_0x200afd[_0xc0c4('0x35')]=_[_0xc0c4('0x36')](_0x3eb619[_0xc0c4('0x35')]);_0x200afd[_0xc0c4('0x37')]=_[_0xc0c4('0x38')](_0x200afd['model'],_0x200afd[_0xc0c4('0x35')]);_0x529993['attributes']=_['intersection'](_0x200afd[_0xc0c4('0x33')],qs['fields'](_0x3eb619[_0xc0c4('0x35')][_0xc0c4('0x39')]));_0x529993['attributes']=_0x529993[_0xc0c4('0x3a')][_0xc0c4('0x3b')]?_0x529993[_0xc0c4('0x3a')]:_0x200afd['model'];if(!_0x3eb619[_0xc0c4('0x35')]['hasOwnProperty'](_0xc0c4('0x3c'))){_0x529993[_0xc0c4('0x23')]=qs[_0xc0c4('0x23')](_0x3eb619[_0xc0c4('0x35')][_0xc0c4('0x23')]);_0x529993[_0xc0c4('0x21')]=qs[_0xc0c4('0x21')](_0x3eb619[_0xc0c4('0x35')][_0xc0c4('0x21')]);}_0x529993['order']=qs[_0xc0c4('0x3d')](_0x3eb619['query'][_0xc0c4('0x3d')]);_0x529993[_0xc0c4('0x3e')]=qs[_0xc0c4('0x37')](_[_0xc0c4('0x3f')](_0x3eb619[_0xc0c4('0x35')],_0x200afd[_0xc0c4('0x37')]),_0x3f0585);if(_0x3eb619[_0xc0c4('0x35')][_0xc0c4('0x40')]){_0x529993[_0xc0c4('0x3e')]=_[_0xc0c4('0x41')](_0x529993['where'],{'$or':_['map'](_0x3f0585,function(_0x3bf2c0){if(_0x3bf2c0[_0xc0c4('0x32')]!==_0xc0c4('0x42')){var _0x159acd={};_0x159acd[_0x3bf2c0[_0xc0c4('0x2f')]]={'$like':'%'+_0x3eb619[_0xc0c4('0x35')][_0xc0c4('0x40')]+'%'};return _0x159acd;}})});}_0x529993=_['merge']({},_0x529993,_0x3eb619['options']);var _0x5aa463={'where':_0x529993['where']};return db[_0xc0c4('0x43')]['count'](_0x5aa463)[_0xc0c4('0x2a')](function(_0x5e8b65){_0x240864['count']=_0x5e8b65;if(_0x3eb619['query'][_0xc0c4('0x44')]){_0x529993[_0xc0c4('0x45')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x529993);})[_0xc0c4('0x2a')](function(_0x3bc375){_0x240864[_0xc0c4('0x46')]=_0x3bc375;return _0x240864;})[_0xc0c4('0x2a')](respondWithFilteredResult(_0x316f8f,_0x529993))[_0xc0c4('0x47')](handleError(_0x316f8f,null));};exports[_0xc0c4('0x48')]=function(_0x400d3e,_0xabd737){var _0x505076={'raw':!![],'where':{'id':_0x400d3e[_0xc0c4('0x49')]['id']}},_0x1d72b6={};_0x1d72b6[_0xc0c4('0x33')]=_['keys'](db[_0xc0c4('0x43')][_0xc0c4('0x4a')]);_0x1d72b6[_0xc0c4('0x35')]=_[_0xc0c4('0x36')](_0x400d3e[_0xc0c4('0x35')]);_0x1d72b6['filters']=_[_0xc0c4('0x38')](_0x1d72b6[_0xc0c4('0x33')],_0x1d72b6[_0xc0c4('0x35')]);_0x505076[_0xc0c4('0x3a')]=_[_0xc0c4('0x38')](_0x1d72b6[_0xc0c4('0x33')],qs[_0xc0c4('0x39')](_0x400d3e['query']['fields']));_0x505076[_0xc0c4('0x3a')]=_0x505076[_0xc0c4('0x3a')]['length']?_0x505076[_0xc0c4('0x3a')]:_0x1d72b6[_0xc0c4('0x33')];if(_0x400d3e['query'][_0xc0c4('0x44')]){_0x505076[_0xc0c4('0x45')]=[{'all':!![]}];}_0x505076=_[_0xc0c4('0x41')]({},_0x505076,_0x400d3e['options']);return db[_0xc0c4('0x43')]['find'](_0x505076)['then'](handleEntityNotFound(_0xabd737,null))[_0xc0c4('0x2a')](respondWithResult(_0xabd737,null))[_0xc0c4('0x47')](handleError(_0xabd737,null));};exports['create']=function(_0xbab447,_0xbde6e7){return db[_0xc0c4('0x43')][_0xc0c4('0x4b')](_0xbab447[_0xc0c4('0x4c')],{})[_0xc0c4('0x2a')](function(_0x5e5800){var _0x5ab7c3=_0xbab447[_0xc0c4('0x4d')][_0xc0c4('0x2b')]({'plain':!![]});if(!_0x5ab7c3)throw new Error(_0xc0c4('0x4e'));if(_0x5ab7c3[_0xc0c4('0x4f')]===_0xc0c4('0x4d')){var _0x4a51b0=_0x5e5800[_0xc0c4('0x2b')]({'plain':!![]});var _0xbb1efb=_0xc0c4('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0xbb1efb,'userProfileId':_0x5ab7c3['userProfileId']},'raw':!![]})[_0xc0c4('0x2a')](function(_0x13a241){if(_0x13a241&&_0x13a241['autoAssociation']===0x0){return db['UserProfileResource'][_0xc0c4('0x4b')]({'name':_0x4a51b0[_0xc0c4('0x2f')],'resourceId':_0x4a51b0['id'],'type':_0x13a241[_0xc0c4('0x2f')],'sectionId':_0x13a241['id']},{})[_0xc0c4('0x2a')](function(){return _0x5e5800;});}else{return _0x5e5800;}})['catch'](function(_0x274889){logger[_0xc0c4('0x2e')](_0xc0c4('0x50'),_0x274889);throw _0x274889;});}return _0x5e5800;})[_0xc0c4('0x2a')](respondWithResult(_0xbde6e7,0xc9))[_0xc0c4('0x47')](handleError(_0xbde6e7,null));};exports[_0xc0c4('0x29')]=function(_0x4270d1,_0x361853){if(_0x4270d1[_0xc0c4('0x4c')]['id']){delete _0x4270d1[_0xc0c4('0x4c')]['id'];}return db[_0xc0c4('0x43')][_0xc0c4('0x51')]({'where':{'id':_0x4270d1[_0xc0c4('0x49')]['id']}})[_0xc0c4('0x2a')](handleEntityNotFound(_0x361853,null))[_0xc0c4('0x2a')](saveUpdates(_0x4270d1[_0xc0c4('0x4c')],null))[_0xc0c4('0x2a')](respondWithResult(_0x361853,null))['catch'](handleError(_0x361853,null));};exports[_0xc0c4('0x52')]=function(_0x1faa98,_0x1ee9f9){return db[_0xc0c4('0x43')][_0xc0c4('0x51')]({'where':{'id':_0x1faa98['params']['id']}})[_0xc0c4('0x2a')](handleEntityNotFound(_0x1ee9f9,null))['then'](removeEntity(_0x1ee9f9,null))[_0xc0c4('0x47')](handleError(_0x1ee9f9,null));};exports[_0xc0c4('0x53')]=function(_0x530131,_0x5a1015){return db['MailQueue'][_0xc0c4('0x53')]()[_0xc0c4('0x2a')](respondWithResult(_0x5a1015,null))[_0xc0c4('0x47')](handleError(_0x5a1015,null));};exports['getMembers']=function(_0x3245bd,_0x1181ef,_0xd8de3e){var _0x5a3205={'raw':!![],'where':{}},_0x1ce92e={},_0x329fab;return db[_0xc0c4('0x43')]['findOne']({'where':{'id':_0x3245bd[_0xc0c4('0x49')]['id']}})[_0xc0c4('0x2a')](handleEntityNotFound(_0x1181ef,null))['then'](function(_0x2fb8f8){if(_0x2fb8f8){_0x329fab=_0x2fb8f8['get']({'plain':!![]});_0x1ce92e[_0xc0c4('0x33')]=_[_0xc0c4('0x36')](db[_0xc0c4('0x54')][_0xc0c4('0x4a')]);_0x1ce92e[_0xc0c4('0x35')]=_[_0xc0c4('0x36')](_0x3245bd[_0xc0c4('0x35')]);_0x1ce92e[_0xc0c4('0x37')]=_[_0xc0c4('0x38')](_0x1ce92e['model'],_0x1ce92e[_0xc0c4('0x35')]);_0x5a3205[_0xc0c4('0x3a')]=_[_0xc0c4('0x38')](_0x1ce92e[_0xc0c4('0x33')],qs['fields'](_0x3245bd[_0xc0c4('0x35')][_0xc0c4('0x39')]));_0x5a3205[_0xc0c4('0x3a')]=_0x5a3205[_0xc0c4('0x3a')][_0xc0c4('0x3b')]?_0x5a3205[_0xc0c4('0x3a')]:_0x1ce92e['model'];if(!_0x3245bd[_0xc0c4('0x35')][_0xc0c4('0x55')](_0xc0c4('0x3c'))){_0x5a3205[_0xc0c4('0x23')]=qs[_0xc0c4('0x23')](_0x3245bd['query'][_0xc0c4('0x23')]);_0x5a3205[_0xc0c4('0x21')]=qs['offset'](_0x3245bd['query'][_0xc0c4('0x21')]);}_0x5a3205[_0xc0c4('0x56')]=qs[_0xc0c4('0x3d')](_0x3245bd[_0xc0c4('0x35')][_0xc0c4('0x3d')]);_0x5a3205[_0xc0c4('0x3e')]=qs['filters'](_[_0xc0c4('0x3f')](_0x3245bd[_0xc0c4('0x35')],_0x1ce92e[_0xc0c4('0x37')]));_0x5a3205[_0xc0c4('0x3e')][_0xc0c4('0x57')]=_0x2fb8f8['id'];if(_0x3245bd[_0xc0c4('0x35')][_0xc0c4('0x40')]){_0x5a3205[_0xc0c4('0x3e')]=_[_0xc0c4('0x41')](_0x5a3205[_0xc0c4('0x3e')],{'$or':_[_0xc0c4('0x34')](_0x5a3205['attributes'],function(_0x189592){var _0x1406c3={};_0x1406c3[_0x189592]={'$like':'%'+_0x3245bd[_0xc0c4('0x35')][_0xc0c4('0x40')]+'%'};return _0x1406c3;})});}_0x5a3205=_['merge']({},_0x5a3205,_0x3245bd['options']);return db[_0xc0c4('0x54')][_0xc0c4('0x58')](_0x5a3205);}})[_0xc0c4('0x2a')](function(_0x38504f){if(_0x38504f){return db[_0xc0c4('0x59')]['findAndCountAll']({'where':{'id':_[_0xc0c4('0x34')](_0x38504f,_0xc0c4('0x5a')),'role':_0xc0c4('0x5b')},'attributes':['id','name',_0xc0c4('0x5c'),'updatedAt',_0xc0c4('0x5d')]});}})[_0xc0c4('0x2a')](function(_0x1f2e4a){if(_0x1f2e4a){return{'count':_0x1f2e4a['count'],'rows':_[_0xc0c4('0x34')](_0x1f2e4a[_0xc0c4('0x46')],function(_0x37fd26){return{'membername':_0x37fd26['name'],'UserId':_0x37fd26['id'],'queue_name':_0x329fab[_0xc0c4('0x2f')],'MailQueueId':_0x329fab['id'],'interface':util['format'](_0xc0c4('0x5e'),'SIP',_0x37fd26[_0xc0c4('0x2f')]),'penalty':0x0,'paused':_0x37fd26[_0xc0c4('0x5c')],'createdAt':_0x37fd26['createdAt'],'updatedAt':_0x37fd26['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc0c4('0x2a')](respondWithFilteredResult(_0x1181ef,_0x5a3205))[_0xc0c4('0x47')](handleError(_0x1181ef,null));};exports['getTeams']=function(_0x13d3b7,_0x1f3e26,_0x2849d7){var _0x3e8c81={};var _0x47dc96={};var _0x4d739f;var _0x3f091b;return db[_0xc0c4('0x43')][_0xc0c4('0x5f')]({'where':{'id':_0x13d3b7[_0xc0c4('0x49')]['id']}})[_0xc0c4('0x2a')](handleEntityNotFound(_0x1f3e26,null))[_0xc0c4('0x2a')](function(_0x5710d1){if(_0x5710d1){_0x4d739f=_0x5710d1;_0x47dc96[_0xc0c4('0x33')]=_[_0xc0c4('0x36')](db['Team'][_0xc0c4('0x4a')]);_0x47dc96[_0xc0c4('0x35')]=_[_0xc0c4('0x36')](_0x13d3b7[_0xc0c4('0x35')]);_0x47dc96[_0xc0c4('0x37')]=_[_0xc0c4('0x38')](_0x47dc96['model'],_0x47dc96[_0xc0c4('0x35')]);_0x3e8c81[_0xc0c4('0x3a')]=_[_0xc0c4('0x38')](_0x47dc96['model'],qs['fields'](_0x13d3b7[_0xc0c4('0x35')]['fields']));_0x3e8c81['attributes']=_0x3e8c81[_0xc0c4('0x3a')]['length']?_0x3e8c81[_0xc0c4('0x3a')]:_0x47dc96[_0xc0c4('0x33')];_0x3e8c81['order']=qs['sort'](_0x13d3b7[_0xc0c4('0x35')][_0xc0c4('0x3d')]);_0x3e8c81[_0xc0c4('0x3e')]=qs[_0xc0c4('0x37')](_[_0xc0c4('0x3f')](_0x13d3b7[_0xc0c4('0x35')],_0x47dc96[_0xc0c4('0x37')]));if(_0x13d3b7[_0xc0c4('0x35')][_0xc0c4('0x40')]){_0x3e8c81[_0xc0c4('0x3e')]=_['merge'](_0x3e8c81[_0xc0c4('0x3e')],{'$or':_['map'](_0x3e8c81[_0xc0c4('0x3a')],function(_0x20c261){var _0x2d19a6={};_0x2d19a6[_0x20c261]={'$like':'%'+_0x13d3b7[_0xc0c4('0x35')]['filter']+'%'};return _0x2d19a6;})});}_0x3e8c81=_[_0xc0c4('0x41')]({},_0x3e8c81,_0x13d3b7['options']);return _0x4d739f['getTeams'](_0x3e8c81);}})[_0xc0c4('0x2a')](function(_0x4d8e46){if(_0x4d8e46){_0x3f091b=_0x4d8e46['length'];if(!_0x13d3b7[_0xc0c4('0x35')][_0xc0c4('0x55')]('nolimit')){_0x3e8c81[_0xc0c4('0x23')]=qs['limit'](_0x13d3b7['query'][_0xc0c4('0x23')]);_0x3e8c81['offset']=qs[_0xc0c4('0x21')](_0x13d3b7[_0xc0c4('0x35')]['offset']);}return _0x4d739f[_0xc0c4('0x60')](_0x3e8c81);}})['then'](function(_0x51205f){if(_0x51205f){return _0x51205f?{'count':_0x3f091b,'rows':_0x51205f}:null;}})[_0xc0c4('0x2a')](respondWithResult(_0x1f3e26,null))['catch'](handleError(_0x1f3e26,null));};exports['addTeams']=function(_0x2aaf5f,_0x46e7e0,_0x4c2f7e){var _0x487d6f=_0x2aaf5f[_0xc0c4('0x4c')][_0xc0c4('0x61')];return db[_0xc0c4('0x62')]['findAll']({'where':{'id':_0x487d6f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc0c4('0x63'),'attributes':['id',_0xc0c4('0x2f'),_0xc0c4('0x64'),_0xc0c4('0x65'),_0xc0c4('0x66')],'raw':!![]}]})[_0xc0c4('0x2a')](function(_0x5449f0){if(_0x5449f0){var _0x34e722=_['flatMap'](_0x5449f0,function(_0xb5efb9){var _0x37e0e3=_0xb5efb9[_0xc0c4('0x2b')]({'plain':!![]});return _0x37e0e3[_0xc0c4('0x63')];});return db[_0xc0c4('0x43')][_0xc0c4('0x51')]({'where':{'id':_0x2aaf5f[_0xc0c4('0x49')]['id']}})[_0xc0c4('0x2a')](function(_0x217035){return db[_0xc0c4('0x67')]['transaction'](function(_0x52456d){return _0x217035[_0xc0c4('0x68')](_0x487d6f,{'transaction':_0x52456d})[_0xc0c4('0x2a')](function(){return BPromise[_0xc0c4('0x69')](_0x34e722,function(_0x46d65b){return db['UserMailQueue'][_0xc0c4('0x6a')]({'where':{'UserId':_0x46d65b['id'],'MailQueueId':_0x2aaf5f[_0xc0c4('0x49')]['id']},'transaction':_0x52456d});});})[_0xc0c4('0x2a')](function(){_0x34e722[_0xc0c4('0x6b')](function(_0x71c1dc){socket[_0xc0c4('0x6c')](_0xc0c4('0x6d'),{'UserId':_0x71c1dc['id'],'MailQueueId':_0x217035['id']});});});});});}})[_0xc0c4('0x2a')](respondWithStatusCode(_0x46e7e0,null))[_0xc0c4('0x47')](handleError(_0x46e7e0,null));};exports[_0xc0c4('0x6e')]=function(_0x4f9009,_0x25b7e5,_0x38283c){return db['Team'][_0xc0c4('0x58')]({'where':{'id':_0x4f9009[_0xc0c4('0x35')][_0xc0c4('0x61')]},'attributes':['id'],'include':[{'model':db[_0xc0c4('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc0c4('0x2a')](handleEntityNotFound(_0x25b7e5,null))[_0xc0c4('0x2a')](function(_0x412efe){var _0x16672a=_[_0xc0c4('0x34')](_0x412efe,'id');var _0x1051d9=[];var _0x6ed7a1=[];var _0xed73a0=squel['select']();_0xed73a0[_0xc0c4('0x6f')](_0xc0c4('0x70'))['from'](_0xc0c4('0x71'),'tq')[_0xc0c4('0x72')](_0xc0c4('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc0c4('0x74'),_0x4f9009['params']['id']);for(var _0x147a54=0x0;_0x147a54<_0x412efe[_0xc0c4('0x3b')];_0x147a54+=0x1){let _0x4636f0=_0x412efe[_0x147a54];for(var _0x53c459=0x0;_0x53c459<_0x4636f0[_0xc0c4('0x63')][_0xc0c4('0x3b')];_0x53c459+=0x1){let _0x33d4b9=_0x4636f0['Agents'][_0x53c459];var _0xa3a64c=_0xed73a0[_0xc0c4('0x75')]();_0xa3a64c[_0xc0c4('0x3e')]('ut.UserId\x20=\x20?',_0x33d4b9['id']);_0x6ed7a1[_0xc0c4('0x76')](db['sequelize'][_0xc0c4('0x35')](_0xa3a64c[_0xc0c4('0x77')](),{'type':db[_0xc0c4('0x67')][_0xc0c4('0x78')][_0xc0c4('0x79')]})[_0xc0c4('0x2a')](function(_0x2dea85){if(_0x2dea85[_0xc0c4('0x3b')]===0x1){return _0x33d4b9['id'];}else{var _0x553e02=_[_0xc0c4('0x7a')](_[_0xc0c4('0x34')](_0x2dea85,_0xc0c4('0x7b')),function(_0x26ed57){return _[_0xc0c4('0x7c')](_0x16672a,_0x26ed57);});if(_0x553e02){return _0x33d4b9['id'];}}}));}}return BPromise[_0xc0c4('0x7d')](_0x6ed7a1)[_0xc0c4('0x2a')](function(_0x579230){_0x1051d9=_(_0x1051d9)[_0xc0c4('0x7e')](_0x579230)[_0xc0c4('0x7f')]()[_0xc0c4('0x80')]();return db[_0xc0c4('0x43')][_0xc0c4('0x51')]({'where':{'id':_0x4f9009[_0xc0c4('0x49')]['id']}})[_0xc0c4('0x2a')](function(_0x3d4cba){return db['sequelize'][_0xc0c4('0x81')](function(_0x2793b3){return _0x3d4cba[_0xc0c4('0x6e')](_0x4f9009[_0xc0c4('0x35')][_0xc0c4('0x61')],{'transaction':_0x2793b3})['then'](function(){if(!_[_0xc0c4('0x82')](_0x1051d9)){return _0x3d4cba[_0xc0c4('0x83')](_0x1051d9,{'transaction':_0x2793b3});}})[_0xc0c4('0x2a')](function(){_0x1051d9['forEach'](function(_0x5a5bc9){socket[_0xc0c4('0x6c')]('userMailQueue:remove',{'UserId':_0x5a5bc9,'MailQueueId':_0x3d4cba['id']});});});});});});})['then'](respondWithStatusCode(_0x25b7e5,null))[_0xc0c4('0x47')](handleError(_0x25b7e5,null));};exports[_0xc0c4('0x84')]=function(_0x32abfe,_0x4f48c3,_0x1db494){return db[_0xc0c4('0x43')][_0xc0c4('0x51')]({'where':{'id':_0x32abfe['params']['id']}})[_0xc0c4('0x2a')](handleEntityNotFound(_0x4f48c3,null))[_0xc0c4('0x2a')](function(_0x668240){if(_0x668240){return _0x668240[_0xc0c4('0x84')](_0x32abfe[_0xc0c4('0x4c')][_0xc0c4('0x61')],_[_0xc0c4('0x85')](_0x32abfe[_0xc0c4('0x4c')],['ids','id'])||{})[_0xc0c4('0x86')](function(_0x5c7c6d){for(var _0x558dee=0x0;_0x558dee<_0x32abfe[_0xc0c4('0x4c')][_0xc0c4('0x61')][_0xc0c4('0x3b')];_0x558dee+=0x1){socket[_0xc0c4('0x6c')]('userMailQueue:save',{'UserId':Number(_0x32abfe[_0xc0c4('0x4c')]['ids'][_0x558dee]),'MailQueueId':Number(_0x32abfe[_0xc0c4('0x49')]['id'])});}return _0x5c7c6d;});}})[_0xc0c4('0x2a')](respondWithResult(_0x4f48c3,null))[_0xc0c4('0x47')](handleError(_0x4f48c3,null));};exports[_0xc0c4('0x83')]=function(_0x25f324,_0x173928,_0x196527){return db[_0xc0c4('0x43')][_0xc0c4('0x51')]({'where':{'id':_0x25f324['params']['id']}})[_0xc0c4('0x2a')](handleEntityNotFound(_0x173928,null))[_0xc0c4('0x2a')](function(_0x1a9b26){if(_0x1a9b26){return _0x1a9b26[_0xc0c4('0x83')](_0x25f324[_0xc0c4('0x35')][_0xc0c4('0x61')])[_0xc0c4('0x2a')](function(){if(_[_0xc0c4('0x87')](_0x25f324[_0xc0c4('0x35')]['ids'])){for(var _0x28366c=0x0;_0x28366c<_0x25f324[_0xc0c4('0x35')][_0xc0c4('0x61')]['length'];_0x28366c+=0x1){socket[_0xc0c4('0x6c')](_0xc0c4('0x88'),{'UserId':Number(_0x25f324[_0xc0c4('0x35')][_0xc0c4('0x61')][_0x28366c]),'MailQueueId':Number(_0x25f324[_0xc0c4('0x49')]['id'])});}}else{socket['emit'](_0xc0c4('0x88'),{'UserId':Number(_0x25f324[_0xc0c4('0x35')][_0xc0c4('0x61')]),'MailQueueId':Number(_0x25f324[_0xc0c4('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x173928,null))[_0xc0c4('0x47')](handleError(_0x173928,null));};exports[_0xc0c4('0x89')]=function(_0x55628a,_0x4a86f7,_0x13d55f){var _0x1bff74={};var _0x5e072a={};var _0x4fb639;var _0xf0a6d6;return db['MailQueue']['findOne']({'where':{'id':_0x55628a[_0xc0c4('0x49')]['id']}})[_0xc0c4('0x2a')](handleEntityNotFound(_0x4a86f7,null))[_0xc0c4('0x2a')](function(_0x5c9fa1){if(_0x5c9fa1){_0x4fb639=_0x5c9fa1;_0x5e072a[_0xc0c4('0x33')]=_[_0xc0c4('0x36')](db[_0xc0c4('0x59')]['rawAttributes']);_0x5e072a['query']=_[_0xc0c4('0x36')](_0x55628a[_0xc0c4('0x35')]);_0x5e072a[_0xc0c4('0x37')]=_[_0xc0c4('0x38')](_0x5e072a[_0xc0c4('0x33')],_0x5e072a[_0xc0c4('0x35')]);_0x1bff74[_0xc0c4('0x3a')]=_['intersection'](_0x5e072a[_0xc0c4('0x33')],qs[_0xc0c4('0x39')](_0x55628a[_0xc0c4('0x35')][_0xc0c4('0x39')]));_0x1bff74[_0xc0c4('0x3a')]=_0x1bff74[_0xc0c4('0x3a')][_0xc0c4('0x3b')]?_0x1bff74[_0xc0c4('0x3a')]:_0x5e072a[_0xc0c4('0x33')];_0x1bff74[_0xc0c4('0x56')]=qs[_0xc0c4('0x3d')](_0x55628a['query'][_0xc0c4('0x3d')]);_0x1bff74['where']=qs[_0xc0c4('0x37')](_[_0xc0c4('0x3f')](_0x55628a[_0xc0c4('0x35')],_0x5e072a[_0xc0c4('0x37')]));if(_0x55628a[_0xc0c4('0x35')][_0xc0c4('0x40')]){_0x1bff74[_0xc0c4('0x3e')]=_[_0xc0c4('0x41')](_0x1bff74[_0xc0c4('0x3e')],{'$or':_[_0xc0c4('0x34')](_0x1bff74[_0xc0c4('0x3a')],function(_0x5ea44f){var _0x39434c={};_0x39434c[_0x5ea44f]={'$like':'%'+_0x55628a['query'][_0xc0c4('0x40')]+'%'};return _0x39434c;})});}_0x1bff74=_['merge']({},_0x1bff74,_0x55628a[_0xc0c4('0x8a')]);return _0x4fb639[_0xc0c4('0x89')](_0x1bff74);}})[_0xc0c4('0x2a')](function(_0x444a64){if(_0x444a64){_0xf0a6d6=_0x444a64[_0xc0c4('0x3b')];if(!_0x55628a[_0xc0c4('0x35')][_0xc0c4('0x55')](_0xc0c4('0x3c'))){_0x1bff74['limit']=qs[_0xc0c4('0x23')](_0x55628a[_0xc0c4('0x35')][_0xc0c4('0x23')]);_0x1bff74['offset']=qs['offset'](_0x55628a[_0xc0c4('0x35')][_0xc0c4('0x21')]);}return _0x4fb639['getAgents'](_0x1bff74);}})['then'](function(_0x41d96a){if(_0x41d96a){return _0x41d96a?{'count':_0xf0a6d6,'rows':_0x41d96a}:null;}})[_0xc0c4('0x2a')](respondWithResult(_0x4a86f7,null))[_0xc0c4('0x47')](handleError(_0x4a86f7,null));}; \ No newline at end of file +var _0xc116=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','User','findAndCountAll','UserId','createdAt','%s/%s','SIP','mailPause','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','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','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','emit','userMailQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./mailQueue.socket','sendStatus','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','MailQueue','type','key','model','keys','intersection','query','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x27a399,_0x4f9e3c){var _0x41991a=function(_0x3d5184){while(--_0x3d5184){_0x27a399['push'](_0x27a399['shift']());}};_0x41991a(++_0x4f9e3c);}(_0xc116,0x164));var _0x6c11=function(_0x5de43a,_0xc3ce09){_0x5de43a=_0x5de43a-0x0;var _0x124fed=_0xc116[_0x5de43a];return _0x124fed;};'use strict';var emlformat=require(_0x6c11('0x0'));var rimraf=require(_0x6c11('0x1'));var zipdir=require(_0x6c11('0x2'));var jsonpatch=require(_0x6c11('0x3'));var rp=require(_0x6c11('0x4'));var moment=require(_0x6c11('0x5'));var BPromise=require(_0x6c11('0x6'));var Mustache=require(_0x6c11('0x7'));var util=require('util');var path=require(_0x6c11('0x8'));var sox=require(_0x6c11('0x9'));var csv=require(_0x6c11('0xa'));var ejs=require(_0x6c11('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c11('0xc'));var squel=require(_0x6c11('0xd'));var crypto=require('crypto');var jsforce=require(_0x6c11('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6c11('0xf'));var Papa=require(_0x6c11('0x10'));var Redis=require(_0x6c11('0x11'));var authService=require(_0x6c11('0x12'));var qs=require(_0x6c11('0x13'));var as=require(_0x6c11('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c11('0x15'))('api');var utils=require(_0x6c11('0x16'));var config=require(_0x6c11('0x17'));var licenseUtil=require(_0x6c11('0x18'));var db=require('../../mysqldb')['db'];config[_0x6c11('0x19')]=_[_0x6c11('0x1a')](config[_0x6c11('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c11('0x19')]));require(_0x6c11('0x1b'))['register'](socket);function respondWithStatusCode(_0x460afb,_0x401ee0){_0x401ee0=_0x401ee0||0xcc;return function(_0x355f9d){if(_0x355f9d){return _0x460afb[_0x6c11('0x1c')](_0x401ee0);}return _0x460afb['status'](_0x401ee0)['end']();};}function respondWithResult(_0x2a70ea,_0x2bf7bc){_0x2bf7bc=_0x2bf7bc||0xc8;return function(_0x1cb5c3){if(_0x1cb5c3){return _0x2a70ea['status'](_0x2bf7bc)['json'](_0x1cb5c3);}};}function respondWithFilteredResult(_0x3c9d0f,_0x27ddd9){return function(_0x53f629){if(_0x53f629){var _0x33be46=typeof _0x27ddd9[_0x6c11('0x1d')]===_0x6c11('0x1e')&&typeof _0x27ddd9[_0x6c11('0x1f')]===_0x6c11('0x1e');var _0x4747e5=_0x53f629[_0x6c11('0x20')];var _0x41ff73=_0x33be46?0x0:_0x27ddd9['offset'];var _0x146d4c=_0x33be46?_0x53f629['count']:_0x27ddd9[_0x6c11('0x1d')]+_0x27ddd9['limit'];var _0x55c894;if(_0x146d4c>=_0x4747e5){_0x146d4c=_0x4747e5;_0x55c894=0xc8;}else{_0x55c894=0xce;}_0x3c9d0f[_0x6c11('0x21')](_0x55c894);return _0x3c9d0f['set'](_0x6c11('0x22'),_0x41ff73+'-'+_0x146d4c+'/'+_0x4747e5)[_0x6c11('0x23')](_0x53f629);}return null;};}function patchUpdates(_0x4ea79e){return function(_0x49b15d){try{jsonpatch[_0x6c11('0x24')](_0x49b15d,_0x4ea79e,!![]);}catch(_0x4d3aa3){return BPromise[_0x6c11('0x25')](_0x4d3aa3);}return _0x49b15d[_0x6c11('0x26')]();};}function saveUpdates(_0x5066a1,_0x4d4fb5){return function(_0x123b30){if(_0x123b30){return _0x123b30[_0x6c11('0x27')](_0x5066a1)[_0x6c11('0x28')](function(_0x43e954){return _0x43e954;});}return null;};}function removeEntity(_0x9fddec,_0x39b29d){return function(_0x42b491){if(_0x42b491){return _0x42b491[_0x6c11('0x29')]()[_0x6c11('0x28')](function(){var _0x125976=_0x42b491[_0x6c11('0x2a')]({'plain':!![]});var _0x249058='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x249058,'resourceId':_0x125976['id']}})[_0x6c11('0x28')](function(){return _0x42b491;});})[_0x6c11('0x28')](function(){_0x9fddec['status'](0xcc)[_0x6c11('0x2b')]();});}};}function handleEntityNotFound(_0x2e7330,_0x1504c3){return function(_0x3a22de){if(!_0x3a22de){_0x2e7330[_0x6c11('0x1c')](0x194);}return _0x3a22de;};}function handleError(_0x255318,_0x1e175d){_0x1e175d=_0x1e175d||0x1f4;return function(_0x2d261d){logger[_0x6c11('0x2c')](_0x2d261d[_0x6c11('0x2d')]);if(_0x2d261d[_0x6c11('0x2e')]){delete _0x2d261d[_0x6c11('0x2e')];}_0x255318[_0x6c11('0x21')](_0x1e175d)[_0x6c11('0x2f')](_0x2d261d);};}exports[_0x6c11('0x30')]=function(_0x24cc12,_0x1f0ae6){var _0x215c0c={},_0x4643a2={},_0x139406={'count':0x0,'rows':[]};var _0x174ccf=_[_0x6c11('0x31')](db[_0x6c11('0x32')]['rawAttributes'],function(_0x5bee56){return{'name':_0x5bee56['fieldName'],'type':_0x5bee56[_0x6c11('0x33')][_0x6c11('0x34')]};});_0x4643a2[_0x6c11('0x35')]=_[_0x6c11('0x31')](_0x174ccf,'name');_0x4643a2['query']=_[_0x6c11('0x36')](_0x24cc12['query']);_0x4643a2['filters']=_[_0x6c11('0x37')](_0x4643a2[_0x6c11('0x35')],_0x4643a2[_0x6c11('0x38')]);_0x215c0c[_0x6c11('0x39')]=_[_0x6c11('0x37')](_0x4643a2['model'],qs[_0x6c11('0x3a')](_0x24cc12[_0x6c11('0x38')][_0x6c11('0x3a')]));_0x215c0c[_0x6c11('0x39')]=_0x215c0c[_0x6c11('0x39')]['length']?_0x215c0c[_0x6c11('0x39')]:_0x4643a2['model'];if(!_0x24cc12['query']['hasOwnProperty'](_0x6c11('0x3b'))){_0x215c0c[_0x6c11('0x1f')]=qs[_0x6c11('0x1f')](_0x24cc12[_0x6c11('0x38')][_0x6c11('0x1f')]);_0x215c0c['offset']=qs[_0x6c11('0x1d')](_0x24cc12[_0x6c11('0x38')]['offset']);}_0x215c0c[_0x6c11('0x3c')]=qs[_0x6c11('0x3d')](_0x24cc12['query']['sort']);_0x215c0c[_0x6c11('0x3e')]=qs[_0x6c11('0x3f')](_[_0x6c11('0x40')](_0x24cc12[_0x6c11('0x38')],_0x4643a2['filters']),_0x174ccf);if(_0x24cc12['query'][_0x6c11('0x41')]){_0x215c0c[_0x6c11('0x3e')]=_[_0x6c11('0x42')](_0x215c0c['where'],{'$or':_[_0x6c11('0x31')](_0x174ccf,function(_0x5c5f81){if(_0x5c5f81[_0x6c11('0x33')]!=='VIRTUAL'){var _0x329854={};_0x329854[_0x5c5f81['name']]={'$like':'%'+_0x24cc12['query'][_0x6c11('0x41')]+'%'};return _0x329854;}})});}_0x215c0c=_[_0x6c11('0x42')]({},_0x215c0c,_0x24cc12[_0x6c11('0x43')]);var _0x221cfa={'where':_0x215c0c[_0x6c11('0x3e')]};return db[_0x6c11('0x32')][_0x6c11('0x20')](_0x221cfa)[_0x6c11('0x28')](function(_0xa5fed1){_0x139406[_0x6c11('0x20')]=_0xa5fed1;if(_0x24cc12[_0x6c11('0x38')][_0x6c11('0x44')]){_0x215c0c[_0x6c11('0x45')]=[{'all':!![]}];}return db[_0x6c11('0x32')][_0x6c11('0x46')](_0x215c0c);})['then'](function(_0x364d8b){_0x139406[_0x6c11('0x47')]=_0x364d8b;return _0x139406;})[_0x6c11('0x28')](respondWithFilteredResult(_0x1f0ae6,_0x215c0c))[_0x6c11('0x48')](handleError(_0x1f0ae6,null));};exports[_0x6c11('0x49')]=function(_0x177cb2,_0x4eabf5){var _0x4c3b89={'raw':!![],'where':{'id':_0x177cb2[_0x6c11('0x4a')]['id']}},_0x1ef39f={};_0x1ef39f[_0x6c11('0x35')]=_[_0x6c11('0x36')](db[_0x6c11('0x32')][_0x6c11('0x4b')]);_0x1ef39f[_0x6c11('0x38')]=_['keys'](_0x177cb2[_0x6c11('0x38')]);_0x1ef39f[_0x6c11('0x3f')]=_[_0x6c11('0x37')](_0x1ef39f['model'],_0x1ef39f['query']);_0x4c3b89['attributes']=_['intersection'](_0x1ef39f[_0x6c11('0x35')],qs[_0x6c11('0x3a')](_0x177cb2[_0x6c11('0x38')]['fields']));_0x4c3b89[_0x6c11('0x39')]=_0x4c3b89[_0x6c11('0x39')][_0x6c11('0x4c')]?_0x4c3b89[_0x6c11('0x39')]:_0x1ef39f[_0x6c11('0x35')];if(_0x177cb2[_0x6c11('0x38')]['includeAll']){_0x4c3b89['include']=[{'all':!![]}];}_0x4c3b89=_[_0x6c11('0x42')]({},_0x4c3b89,_0x177cb2['options']);return db[_0x6c11('0x32')][_0x6c11('0x4d')](_0x4c3b89)[_0x6c11('0x28')](handleEntityNotFound(_0x4eabf5,null))['then'](respondWithResult(_0x4eabf5,null))[_0x6c11('0x48')](handleError(_0x4eabf5,null));};exports[_0x6c11('0x4e')]=function(_0x3ce928,_0x46db12){return db[_0x6c11('0x32')][_0x6c11('0x4e')](_0x3ce928[_0x6c11('0x4f')],{})['then'](function(_0x18d7e4){var _0x5cafea=_0x3ce928[_0x6c11('0x50')][_0x6c11('0x2a')]({'plain':!![]});if(!_0x5cafea)throw new Error(_0x6c11('0x51'));if(_0x5cafea['role']===_0x6c11('0x50')){var _0x56af70=_0x18d7e4[_0x6c11('0x2a')]({'plain':!![]});var _0x14df5a='MailQueues';return db[_0x6c11('0x52')]['find']({'where':{'name':_0x14df5a,'userProfileId':_0x5cafea[_0x6c11('0x53')]},'raw':!![]})['then'](function(_0x41f820){if(_0x41f820&&_0x41f820[_0x6c11('0x54')]===0x0){return db[_0x6c11('0x55')]['create']({'name':_0x56af70[_0x6c11('0x2e')],'resourceId':_0x56af70['id'],'type':_0x41f820['name'],'sectionId':_0x41f820['id']},{})[_0x6c11('0x28')](function(){return _0x18d7e4;});}else{return _0x18d7e4;}})['catch'](function(_0x58e4e8){logger[_0x6c11('0x2c')](_0x6c11('0x56'),_0x58e4e8);throw _0x58e4e8;});}return _0x18d7e4;})[_0x6c11('0x28')](respondWithResult(_0x46db12,0xc9))[_0x6c11('0x48')](handleError(_0x46db12,null));};exports[_0x6c11('0x27')]=function(_0xfc3b0b,_0x4bee6e){if(_0xfc3b0b[_0x6c11('0x4f')]['id']){delete _0xfc3b0b[_0x6c11('0x4f')]['id'];}return db[_0x6c11('0x32')][_0x6c11('0x4d')]({'where':{'id':_0xfc3b0b[_0x6c11('0x4a')]['id']}})[_0x6c11('0x28')](handleEntityNotFound(_0x4bee6e,null))[_0x6c11('0x28')](saveUpdates(_0xfc3b0b['body'],null))['then'](respondWithResult(_0x4bee6e,null))[_0x6c11('0x48')](handleError(_0x4bee6e,null));};exports['destroy']=function(_0xd80c2,_0x3ba5ae){return db[_0x6c11('0x32')][_0x6c11('0x4d')]({'where':{'id':_0xd80c2[_0x6c11('0x4a')]['id']}})[_0x6c11('0x28')](handleEntityNotFound(_0x3ba5ae,null))[_0x6c11('0x28')](removeEntity(_0x3ba5ae,null))[_0x6c11('0x48')](handleError(_0x3ba5ae,null));};exports[_0x6c11('0x57')]=function(_0x3dbf34,_0x5ee738){return db[_0x6c11('0x32')][_0x6c11('0x57')]()['then'](respondWithResult(_0x5ee738,null))['catch'](handleError(_0x5ee738,null));};exports[_0x6c11('0x58')]=function(_0x2fe6ed,_0x5aac27,_0x55755b){var _0x4b54be={'raw':!![],'where':{}},_0x3df84d={},_0x12b309;return db[_0x6c11('0x32')][_0x6c11('0x59')]({'where':{'id':_0x2fe6ed['params']['id']}})['then'](handleEntityNotFound(_0x5aac27,null))['then'](function(_0x43dd5e){if(_0x43dd5e){_0x12b309=_0x43dd5e[_0x6c11('0x2a')]({'plain':!![]});_0x3df84d[_0x6c11('0x35')]=_['keys'](db[_0x6c11('0x5a')][_0x6c11('0x4b')]);_0x3df84d[_0x6c11('0x38')]=_[_0x6c11('0x36')](_0x2fe6ed[_0x6c11('0x38')]);_0x3df84d[_0x6c11('0x3f')]=_[_0x6c11('0x37')](_0x3df84d[_0x6c11('0x35')],_0x3df84d[_0x6c11('0x38')]);_0x4b54be['attributes']=_[_0x6c11('0x37')](_0x3df84d[_0x6c11('0x35')],qs['fields'](_0x2fe6ed[_0x6c11('0x38')][_0x6c11('0x3a')]));_0x4b54be[_0x6c11('0x39')]=_0x4b54be[_0x6c11('0x39')][_0x6c11('0x4c')]?_0x4b54be['attributes']:_0x3df84d[_0x6c11('0x35')];if(!_0x2fe6ed[_0x6c11('0x38')][_0x6c11('0x5b')](_0x6c11('0x3b'))){_0x4b54be['limit']=qs[_0x6c11('0x1f')](_0x2fe6ed[_0x6c11('0x38')][_0x6c11('0x1f')]);_0x4b54be[_0x6c11('0x1d')]=qs[_0x6c11('0x1d')](_0x2fe6ed[_0x6c11('0x38')][_0x6c11('0x1d')]);}_0x4b54be['order']=qs[_0x6c11('0x3d')](_0x2fe6ed['query'][_0x6c11('0x3d')]);_0x4b54be[_0x6c11('0x3e')]=qs['filters'](_[_0x6c11('0x40')](_0x2fe6ed['query'],_0x3df84d[_0x6c11('0x3f')]));_0x4b54be[_0x6c11('0x3e')][_0x6c11('0x5c')]=_0x43dd5e['id'];if(_0x2fe6ed[_0x6c11('0x38')]['filter']){_0x4b54be[_0x6c11('0x3e')]=_[_0x6c11('0x42')](_0x4b54be[_0x6c11('0x3e')],{'$or':_[_0x6c11('0x31')](_0x4b54be[_0x6c11('0x39')],function(_0xd0aa2a){var _0x45d83d={};_0x45d83d[_0xd0aa2a]={'$like':'%'+_0x2fe6ed[_0x6c11('0x38')]['filter']+'%'};return _0x45d83d;})});}_0x4b54be=_[_0x6c11('0x42')]({},_0x4b54be,_0x2fe6ed['options']);return db[_0x6c11('0x5a')][_0x6c11('0x46')](_0x4b54be);}})['then'](function(_0x14a539){if(_0x14a539){return db[_0x6c11('0x5d')][_0x6c11('0x5e')]({'where':{'id':_[_0x6c11('0x31')](_0x14a539,_0x6c11('0x5f')),'role':'agent'},'attributes':['id','name','mailPause','updatedAt',_0x6c11('0x60')]});}})[_0x6c11('0x28')](function(_0x402b52){if(_0x402b52){return{'count':_0x402b52[_0x6c11('0x20')],'rows':_[_0x6c11('0x31')](_0x402b52[_0x6c11('0x47')],function(_0x58a503){return{'membername':_0x58a503['name'],'UserId':_0x58a503['id'],'queue_name':_0x12b309['name'],'MailQueueId':_0x12b309['id'],'interface':util['format'](_0x6c11('0x61'),_0x6c11('0x62'),_0x58a503[_0x6c11('0x2e')]),'penalty':0x0,'paused':_0x58a503[_0x6c11('0x63')],'createdAt':_0x58a503[_0x6c11('0x60')],'updatedAt':_0x58a503[_0x6c11('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6c11('0x28')](respondWithFilteredResult(_0x5aac27,_0x4b54be))[_0x6c11('0x48')](handleError(_0x5aac27,null));};exports[_0x6c11('0x65')]=function(_0x3c47cc,_0x441a75,_0x4da4c9){var _0x4b7696={};var _0x5dfddb={};var _0x476185;var _0x3fe105;return db[_0x6c11('0x32')][_0x6c11('0x59')]({'where':{'id':_0x3c47cc[_0x6c11('0x4a')]['id']}})[_0x6c11('0x28')](handleEntityNotFound(_0x441a75,null))[_0x6c11('0x28')](function(_0x1e685d){if(_0x1e685d){_0x476185=_0x1e685d;_0x5dfddb[_0x6c11('0x35')]=_[_0x6c11('0x36')](db[_0x6c11('0x66')]['rawAttributes']);_0x5dfddb[_0x6c11('0x38')]=_['keys'](_0x3c47cc[_0x6c11('0x38')]);_0x5dfddb[_0x6c11('0x3f')]=_['intersection'](_0x5dfddb['model'],_0x5dfddb[_0x6c11('0x38')]);_0x4b7696[_0x6c11('0x39')]=_[_0x6c11('0x37')](_0x5dfddb[_0x6c11('0x35')],qs[_0x6c11('0x3a')](_0x3c47cc[_0x6c11('0x38')][_0x6c11('0x3a')]));_0x4b7696[_0x6c11('0x39')]=_0x4b7696[_0x6c11('0x39')][_0x6c11('0x4c')]?_0x4b7696[_0x6c11('0x39')]:_0x5dfddb[_0x6c11('0x35')];_0x4b7696['order']=qs[_0x6c11('0x3d')](_0x3c47cc[_0x6c11('0x38')][_0x6c11('0x3d')]);_0x4b7696[_0x6c11('0x3e')]=qs[_0x6c11('0x3f')](_[_0x6c11('0x40')](_0x3c47cc[_0x6c11('0x38')],_0x5dfddb[_0x6c11('0x3f')]));if(_0x3c47cc[_0x6c11('0x38')][_0x6c11('0x41')]){_0x4b7696[_0x6c11('0x3e')]=_[_0x6c11('0x42')](_0x4b7696[_0x6c11('0x3e')],{'$or':_[_0x6c11('0x31')](_0x4b7696[_0x6c11('0x39')],function(_0x2868b5){var _0x5a24c2={};_0x5a24c2[_0x2868b5]={'$like':'%'+_0x3c47cc['query'][_0x6c11('0x41')]+'%'};return _0x5a24c2;})});}_0x4b7696=_['merge']({},_0x4b7696,_0x3c47cc[_0x6c11('0x43')]);return _0x476185['getTeams'](_0x4b7696);}})[_0x6c11('0x28')](function(_0x5641b8){if(_0x5641b8){_0x3fe105=_0x5641b8['length'];if(!_0x3c47cc['query'][_0x6c11('0x5b')](_0x6c11('0x3b'))){_0x4b7696[_0x6c11('0x1f')]=qs[_0x6c11('0x1f')](_0x3c47cc[_0x6c11('0x38')][_0x6c11('0x1f')]);_0x4b7696[_0x6c11('0x1d')]=qs['offset'](_0x3c47cc['query']['offset']);}return _0x476185[_0x6c11('0x65')](_0x4b7696);}})[_0x6c11('0x28')](function(_0x36e1b7){if(_0x36e1b7){return _0x36e1b7?{'count':_0x3fe105,'rows':_0x36e1b7}:null;}})['then'](respondWithResult(_0x441a75,null))[_0x6c11('0x48')](handleError(_0x441a75,null));};exports[_0x6c11('0x67')]=function(_0x41d696,_0x4cd775,_0x22319c){var _0x5a3e2b=_0x41d696[_0x6c11('0x4f')][_0x6c11('0x68')];return db['Team'][_0x6c11('0x46')]({'where':{'id':_0x5a3e2b},'attributes':['id'],'include':[{'model':db[_0x6c11('0x5d')],'as':_0x6c11('0x69'),'attributes':['id',_0x6c11('0x2e'),_0x6c11('0x6a'),_0x6c11('0x6b'),'interface'],'raw':!![]}]})[_0x6c11('0x28')](function(_0x9e1033){if(_0x9e1033){var _0x51ed27=_[_0x6c11('0x6c')](_0x9e1033,function(_0x226031){var _0x580b06=_0x226031[_0x6c11('0x2a')]({'plain':!![]});return _0x580b06['Agents'];});return db[_0x6c11('0x32')]['find']({'where':{'id':_0x41d696[_0x6c11('0x4a')]['id']}})[_0x6c11('0x28')](function(_0x37cf8e){return db[_0x6c11('0x6d')][_0x6c11('0x6e')](function(_0x5088ae){return _0x37cf8e[_0x6c11('0x67')](_0x5a3e2b,{'transaction':_0x5088ae})['then'](function(){return BPromise[_0x6c11('0x6f')](_0x51ed27,function(_0xa86eed){return db[_0x6c11('0x5a')][_0x6c11('0x70')]({'where':{'UserId':_0xa86eed['id'],'MailQueueId':_0x41d696['params']['id']},'transaction':_0x5088ae});});})[_0x6c11('0x28')](function(){_0x51ed27[_0x6c11('0x71')](function(_0x548b91){socket['emit'](_0x6c11('0x72'),{'UserId':_0x548b91['id'],'MailQueueId':_0x37cf8e['id']});});});});});}})[_0x6c11('0x28')](respondWithStatusCode(_0x4cd775,null))[_0x6c11('0x48')](handleError(_0x4cd775,null));};exports['removeTeams']=function(_0x1c423b,_0x580e4f,_0x3bcc45){return db[_0x6c11('0x66')]['findAll']({'where':{'id':_0x1c423b[_0x6c11('0x38')][_0x6c11('0x68')]},'attributes':['id'],'include':[{'model':db[_0x6c11('0x5d')],'as':_0x6c11('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x580e4f,null))['then'](function(_0x2dab93){var _0x3097ed=_[_0x6c11('0x31')](_0x2dab93,'id');var _0x1999fe=[];var _0x411a61=[];var _0x5f2cf4=squel[_0x6c11('0x73')]();_0x5f2cf4[_0x6c11('0x74')](_0x6c11('0x75'))['from'](_0x6c11('0x76'),'tq')['join'](_0x6c11('0x77'),'ut',_0x6c11('0x78'))[_0x6c11('0x3e')](_0x6c11('0x79'),_0x1c423b['params']['id']);for(var _0x4b9a85=0x0;_0x4b9a85<_0x2dab93[_0x6c11('0x4c')];_0x4b9a85+=0x1){let _0x375c69=_0x2dab93[_0x4b9a85];for(var _0x595034=0x0;_0x595034<_0x375c69[_0x6c11('0x69')]['length'];_0x595034+=0x1){let _0x5f14c6=_0x375c69['Agents'][_0x595034];var _0x13127d=_0x5f2cf4[_0x6c11('0x7a')]();_0x13127d[_0x6c11('0x3e')](_0x6c11('0x7b'),_0x5f14c6['id']);_0x411a61[_0x6c11('0x7c')](db[_0x6c11('0x6d')][_0x6c11('0x38')](_0x13127d[_0x6c11('0x7d')](),{'type':db[_0x6c11('0x6d')]['QueryTypes'][_0x6c11('0x7e')]})['then'](function(_0xbdad98){if(_0xbdad98[_0x6c11('0x4c')]===0x1){return _0x5f14c6['id'];}else{var _0x47a962=_['every'](_[_0x6c11('0x31')](_0xbdad98,_0x6c11('0x7f')),function(_0x5a7628){return _[_0x6c11('0x80')](_0x3097ed,_0x5a7628);});if(_0x47a962){return _0x5f14c6['id'];}}}));}}return BPromise[_0x6c11('0x81')](_0x411a61)[_0x6c11('0x28')](function(_0x29928f){_0x1999fe=_(_0x1999fe)[_0x6c11('0x82')](_0x29928f)[_0x6c11('0x83')]()[_0x6c11('0x84')]();return db['MailQueue'][_0x6c11('0x4d')]({'where':{'id':_0x1c423b[_0x6c11('0x4a')]['id']}})[_0x6c11('0x28')](function(_0x527495){return db[_0x6c11('0x6d')]['transaction'](function(_0x5079d){return _0x527495[_0x6c11('0x85')](_0x1c423b[_0x6c11('0x38')][_0x6c11('0x68')],{'transaction':_0x5079d})[_0x6c11('0x28')](function(){if(!_['isEmpty'](_0x1999fe)){return _0x527495[_0x6c11('0x86')](_0x1999fe,{'transaction':_0x5079d});}})['then'](function(){_0x1999fe[_0x6c11('0x71')](function(_0x3d9c8a){socket[_0x6c11('0x87')](_0x6c11('0x88'),{'UserId':_0x3d9c8a,'MailQueueId':_0x527495['id']});});});});});});})[_0x6c11('0x28')](respondWithStatusCode(_0x580e4f,null))[_0x6c11('0x48')](handleError(_0x580e4f,null));};exports[_0x6c11('0x89')]=function(_0x432988,_0x1271a9,_0x1b1ece){return db['MailQueue']['find']({'where':{'id':_0x432988[_0x6c11('0x4a')]['id']}})[_0x6c11('0x28')](handleEntityNotFound(_0x1271a9,null))['then'](function(_0x5c9a31){if(_0x5c9a31){return _0x5c9a31['addAgents'](_0x432988[_0x6c11('0x4f')]['ids'],_[_0x6c11('0x8a')](_0x432988[_0x6c11('0x4f')],[_0x6c11('0x68'),'id'])||{})['spread'](function(_0x256bc7){for(var _0x2d71aa=0x0;_0x2d71aa<_0x432988[_0x6c11('0x4f')][_0x6c11('0x68')][_0x6c11('0x4c')];_0x2d71aa+=0x1){socket[_0x6c11('0x87')](_0x6c11('0x72'),{'UserId':Number(_0x432988[_0x6c11('0x4f')][_0x6c11('0x68')][_0x2d71aa]),'MailQueueId':Number(_0x432988[_0x6c11('0x4a')]['id'])});}return _0x256bc7;});}})[_0x6c11('0x28')](respondWithResult(_0x1271a9,null))[_0x6c11('0x48')](handleError(_0x1271a9,null));};exports[_0x6c11('0x86')]=function(_0x445fe2,_0x31b3b2,_0x3346e2){return db[_0x6c11('0x32')][_0x6c11('0x4d')]({'where':{'id':_0x445fe2['params']['id']}})[_0x6c11('0x28')](handleEntityNotFound(_0x31b3b2,null))[_0x6c11('0x28')](function(_0x48c936){if(_0x48c936){return _0x48c936[_0x6c11('0x86')](_0x445fe2['query'][_0x6c11('0x68')])[_0x6c11('0x28')](function(){if(_[_0x6c11('0x8b')](_0x445fe2[_0x6c11('0x38')][_0x6c11('0x68')])){for(var _0x876142=0x0;_0x876142<_0x445fe2[_0x6c11('0x38')][_0x6c11('0x68')]['length'];_0x876142+=0x1){socket[_0x6c11('0x87')](_0x6c11('0x88'),{'UserId':Number(_0x445fe2['query'][_0x6c11('0x68')][_0x876142]),'MailQueueId':Number(_0x445fe2[_0x6c11('0x4a')]['id'])});}}else{socket['emit'](_0x6c11('0x88'),{'UserId':Number(_0x445fe2[_0x6c11('0x38')]['ids']),'MailQueueId':Number(_0x445fe2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x31b3b2,null))[_0x6c11('0x48')](handleError(_0x31b3b2,null));};exports[_0x6c11('0x8c')]=function(_0x435ebd,_0x380088,_0x526a5a){var _0x16f2d5={};var _0x3b24fa={};var _0x46881c;var _0xb5e8df;return db[_0x6c11('0x32')][_0x6c11('0x59')]({'where':{'id':_0x435ebd[_0x6c11('0x4a')]['id']}})[_0x6c11('0x28')](handleEntityNotFound(_0x380088,null))[_0x6c11('0x28')](function(_0x56f304){if(_0x56f304){_0x46881c=_0x56f304;_0x3b24fa[_0x6c11('0x35')]=_[_0x6c11('0x36')](db[_0x6c11('0x5d')][_0x6c11('0x4b')]);_0x3b24fa[_0x6c11('0x38')]=_[_0x6c11('0x36')](_0x435ebd[_0x6c11('0x38')]);_0x3b24fa[_0x6c11('0x3f')]=_[_0x6c11('0x37')](_0x3b24fa[_0x6c11('0x35')],_0x3b24fa[_0x6c11('0x38')]);_0x16f2d5[_0x6c11('0x39')]=_['intersection'](_0x3b24fa[_0x6c11('0x35')],qs[_0x6c11('0x3a')](_0x435ebd[_0x6c11('0x38')][_0x6c11('0x3a')]));_0x16f2d5['attributes']=_0x16f2d5[_0x6c11('0x39')][_0x6c11('0x4c')]?_0x16f2d5['attributes']:_0x3b24fa[_0x6c11('0x35')];_0x16f2d5[_0x6c11('0x3c')]=qs[_0x6c11('0x3d')](_0x435ebd[_0x6c11('0x38')][_0x6c11('0x3d')]);_0x16f2d5[_0x6c11('0x3e')]=qs['filters'](_['pick'](_0x435ebd['query'],_0x3b24fa[_0x6c11('0x3f')]));if(_0x435ebd[_0x6c11('0x38')][_0x6c11('0x41')]){_0x16f2d5['where']=_['merge'](_0x16f2d5[_0x6c11('0x3e')],{'$or':_[_0x6c11('0x31')](_0x16f2d5[_0x6c11('0x39')],function(_0x3d179a){var _0x1e7e86={};_0x1e7e86[_0x3d179a]={'$like':'%'+_0x435ebd[_0x6c11('0x38')][_0x6c11('0x41')]+'%'};return _0x1e7e86;})});}_0x16f2d5=_[_0x6c11('0x42')]({},_0x16f2d5,_0x435ebd[_0x6c11('0x43')]);return _0x46881c[_0x6c11('0x8c')](_0x16f2d5);}})[_0x6c11('0x28')](function(_0x441e89){if(_0x441e89){_0xb5e8df=_0x441e89['length'];if(!_0x435ebd['query'][_0x6c11('0x5b')](_0x6c11('0x3b'))){_0x16f2d5[_0x6c11('0x1f')]=qs[_0x6c11('0x1f')](_0x435ebd[_0x6c11('0x38')][_0x6c11('0x1f')]);_0x16f2d5[_0x6c11('0x1d')]=qs[_0x6c11('0x1d')](_0x435ebd[_0x6c11('0x38')][_0x6c11('0x1d')]);}return _0x46881c[_0x6c11('0x8c')](_0x16f2d5);}})['then'](function(_0x44daec){if(_0x44daec){return _0x44daec?{'count':_0xb5e8df,'rows':_0x44daec}:null;}})[_0x6c11('0x28')](respondWithResult(_0x380088,null))[_0x6c11('0x48')](handleError(_0x380088,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 55c7784..51cf8d5 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 _0x8a98=['events','../../mysqldb','MailQueue','save','update','remove','emit','hook'];(function(_0xce81c5,_0x5ecbac){var _0x579851=function(_0xd4b9ae){while(--_0xd4b9ae){_0xce81c5['push'](_0xce81c5['shift']());}};_0x579851(++_0x5ecbac);}(_0x8a98,0xc8));var _0x88a9=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x8a98[_0x1d6a82];return _0x5834ac;};'use strict';var EventEmitter=require(_0x88a9('0x0'));var MailQueue=require(_0x88a9('0x1'))['db'][_0x88a9('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x88a9('0x3'),'afterUpdate':_0x88a9('0x4'),'afterDestroy':_0x88a9('0x5')};function emitEvent(_0x370ab1){return function(_0x51adb9,_0x46cc85,_0x5a3cc4){MailQueueEvents[_0x88a9('0x6')](_0x370ab1+':'+_0x51adb9['id'],_0x51adb9);MailQueueEvents[_0x88a9('0x6')](_0x370ab1,_0x51adb9);_0x5a3cc4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x88a9('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x324f=['hook','exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x57c501,_0x319f03){var _0x4f15ba=function(_0x52e0c1){while(--_0x52e0c1){_0x57c501['push'](_0x57c501['shift']());}};_0x4f15ba(++_0x319f03);}(_0x324f,0xaa));var _0xf324=function(_0x3ff454,_0x564d83){_0x3ff454=_0x3ff454-0x0;var _0x40f602=_0x324f[_0x3ff454];return _0x40f602;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xf324('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf324('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf324('0x2'),'afterDestroy':_0xf324('0x3')};function emitEvent(_0x6d9c77){return function(_0x52c85c,_0x4f4cab,_0x32f62c){MailQueueEvents[_0xf324('0x4')](_0x6d9c77+':'+_0x52c85c['id'],_0x52c85c);MailQueueEvents[_0xf324('0x4')](_0x6d9c77,_0x52c85c);_0x32f62c(null);};}for(var e in events){if(events[_0xf324('0x5')](e)){var event=events[e];MailQueue[_0xf324('0x6')](e,emitEvent(event));}}module[_0xf324('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b4b9266..b824510 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 _0x4635=['../../config/environment','./mailQueue.attributes','exports','define','mail_queues','api','moment','bluebird','request-promise','path'];(function(_0x57e172,_0x3f7e02){var _0x33d96c=function(_0x5aaf19){while(--_0x5aaf19){_0x57e172['push'](_0x57e172['shift']());}};_0x33d96c(++_0x3f7e02);}(_0x4635,0x177));var _0x5463=function(_0xda5c34,_0x37ab57){_0xda5c34=_0xda5c34-0x0;var _0x4bba27=_0x4635[_0xda5c34];return _0x4bba27;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5463('0x0'));var moment=require(_0x5463('0x1'));var BPromise=require(_0x5463('0x2'));var rp=require(_0x5463('0x3'));var fs=require('fs');var path=require(_0x5463('0x4'));var rimraf=require('rimraf');var config=require(_0x5463('0x5'));var attributes=require(_0x5463('0x6'));module[_0x5463('0x7')]=function(_0x1c4b84,_0x1a5a5d){return _0x1c4b84[_0x5463('0x8')]('MailQueue',attributes,{'tableName':_0x5463('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab98=['bluebird','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3cc7c3,_0x2ecaa6){var _0x14cf19=function(_0xe16039){while(--_0xe16039){_0x3cc7c3['push'](_0x3cc7c3['shift']());}};_0x14cf19(++_0x2ecaa6);}(_0xab98,0xff));var _0x8ab9=function(_0x35507b,_0x247cbe){_0x35507b=_0x35507b-0x0;var _0x4ff363=_0xab98[_0x35507b];return _0x4ff363;};'use strict';var _=require(_0x8ab9('0x0'));var util=require(_0x8ab9('0x1'));var logger=require(_0x8ab9('0x2'))(_0x8ab9('0x3'));var moment=require(_0x8ab9('0x4'));var BPromise=require(_0x8ab9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ab9('0x6'));var rimraf=require('rimraf');var config=require(_0x8ab9('0x7'));var attributes=require(_0x8ab9('0x8'));module[_0x8ab9('0x9')]=function(_0x2339ac,_0x154dfb){return _0x2339ac[_0x8ab9('0xa')](_0x8ab9('0xb'),attributes,{'tableName':_0x8ab9('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 44b884a..a01e0db 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 _0x5c8f=['./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','ShowMailQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter'];(function(_0x34a99d,_0xed3f0e){var _0x430377=function(_0x59376d){while(--_0x59376d){_0x34a99d['push'](_0x34a99d['shift']());}};_0x430377(++_0xed3f0e);}(_0x5c8f,0x111));var _0xf5c8=function(_0x4fc114,_0x44813e){_0x4fc114=_0x4fc114-0x0;var _0x324801=_0x5c8f[_0x4fc114];return _0x324801;};'use strict';var _=require('lodash');var util=require(_0xf5c8('0x0'));var moment=require(_0xf5c8('0x1'));var BPromise=require(_0xf5c8('0x2'));var rs=require(_0xf5c8('0x3'));var fs=require('fs');var Redis=require(_0xf5c8('0x4'));var db=require(_0xf5c8('0x5'))['db'];var utils=require(_0xf5c8('0x6'));var logger=require('../../config/logger')(_0xf5c8('0x7'));var config=require(_0xf5c8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf5c8('0x9')][_0xf5c8('0xa')]({'port':0x232a});config[_0xf5c8('0xb')]=_['defaults'](config['redis'],{'host':_0xf5c8('0xc'),'port':0x18eb});var socket=require(_0xf5c8('0xd'))(new Redis(config[_0xf5c8('0xb')]));require(_0xf5c8('0xe'))[_0xf5c8('0xf')](socket);function respondWithRpcPromise(_0x4c3be9,_0x55d656,_0xdd74de){return new BPromise(function(_0x3f61b7,_0x2991fa){return client[_0xf5c8('0x10')](_0x4c3be9,_0xdd74de)['then'](function(_0x3d7db4){logger['info'](_0xf5c8('0x11'),_0x55d656,'request\x20sent');logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x55d656,_0xf5c8('0x12'),JSON[_0xf5c8('0x13')](_0x3d7db4));if(_0x3d7db4[_0xf5c8('0x14')]){if(_0x3d7db4[_0xf5c8('0x14')][_0xf5c8('0x15')]===0x1f4){logger[_0xf5c8('0x14')]('MailQueue,\x20%s,\x20%s',_0x55d656,_0x3d7db4['error']['message']);return _0x2991fa(_0x3d7db4[_0xf5c8('0x14')][_0xf5c8('0x16')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x55d656,_0x3d7db4[_0xf5c8('0x14')][_0xf5c8('0x16')]);return _0x3f61b7(_0x3d7db4[_0xf5c8('0x14')][_0xf5c8('0x16')]);}else{logger['info'](_0xf5c8('0x11'),_0x55d656,'request\x20sent');_0x3f61b7(_0x3d7db4[_0xf5c8('0x17')][_0xf5c8('0x16')]);}})[_0xf5c8('0x18')](function(_0x3accec){logger[_0xf5c8('0x14')](_0xf5c8('0x11'),_0x55d656,_0x3accec);_0x2991fa(_0x3accec);});});}exports[_0xf5c8('0x19')]=function(_0x4bc220){var _0x4f9776=this;return new Promise(function(_0x50a0f3,_0xf2b97a){return db[_0xf5c8('0x1a')][_0xf5c8('0x1b')]({'raw':_0x4bc220[_0xf5c8('0x1c')]?_0x4bc220[_0xf5c8('0x1c')][_0xf5c8('0x1d')]===undefined?!![]:![]:!![],'where':_0x4bc220[_0xf5c8('0x1c')]?_0x4bc220['options'][_0xf5c8('0x1e')]||null:null,'attributes':_0x4bc220[_0xf5c8('0x1c')]?_0x4bc220[_0xf5c8('0x1c')][_0xf5c8('0x1f')]||null:null,'limit':_0x4bc220[_0xf5c8('0x1c')]?_0x4bc220[_0xf5c8('0x1c')][_0xf5c8('0x20')]||null:null,'include':_0x4bc220[_0xf5c8('0x1c')]?_0x4bc220[_0xf5c8('0x1c')][_0xf5c8('0x21')]?_['map'](_0x4bc220[_0xf5c8('0x1c')][_0xf5c8('0x21')],function(_0x4b6ebd){return{'model':db[_0x4b6ebd[_0xf5c8('0x22')]],'as':_0x4b6ebd['as'],'attributes':_0x4b6ebd[_0xf5c8('0x1f')],'include':_0x4b6ebd[_0xf5c8('0x21')]?_['map'](_0x4b6ebd[_0xf5c8('0x21')],function(_0x2bd937){return{'model':db[_0x2bd937[_0xf5c8('0x22')]],'as':_0x2bd937['as'],'attributes':_0x2bd937['attributes'],'include':_0x2bd937[_0xf5c8('0x21')]?_[_0xf5c8('0x23')](_0x2bd937['include'],function(_0x56463b){return{'model':db[_0x56463b[_0xf5c8('0x22')]],'as':_0x56463b['as'],'attributes':_0x56463b[_0xf5c8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf5c8('0x24')](function(_0x5708dc){logger[_0xf5c8('0x25')](_0xf5c8('0x19'),_0x4bc220);logger[_0xf5c8('0x26')]('GetMailQueue',_0x4bc220,JSON[_0xf5c8('0x13')](_0x5708dc));_0x50a0f3(_0x5708dc);})[_0xf5c8('0x18')](function(_0x34d9cc){logger[_0xf5c8('0x14')]('GetMailQueue',_0x34d9cc[_0xf5c8('0x16')],_0x4bc220);_0xf2b97a(_0x4f9776[_0xf5c8('0x14')](0x1f4,_0x34d9cc[_0xf5c8('0x16')]));});});};exports[_0xf5c8('0x27')]=function(_0x48c1cf){var _0x1b6387=this;return new Promise(function(_0x428310,_0x572be1){return db[_0xf5c8('0x1a')][_0xf5c8('0x28')]({'raw':_0x48c1cf['options']?_0x48c1cf[_0xf5c8('0x1c')][_0xf5c8('0x1d')]===undefined?!![]:![]:!![],'where':_0x48c1cf[_0xf5c8('0x1c')]?_0x48c1cf[_0xf5c8('0x1c')][_0xf5c8('0x1e')]||null:null,'attributes':_0x48c1cf['options']?_0x48c1cf[_0xf5c8('0x1c')][_0xf5c8('0x1f')]||null:null,'include':_0x48c1cf[_0xf5c8('0x1c')]?_0x48c1cf[_0xf5c8('0x1c')]['include']?_['map'](_0x48c1cf[_0xf5c8('0x1c')][_0xf5c8('0x21')],function(_0x5e30c5){return{'model':db[_0x5e30c5[_0xf5c8('0x22')]],'as':_0x5e30c5['as'],'attributes':_0x5e30c5[_0xf5c8('0x1f')],'include':_0x5e30c5['include']?_[_0xf5c8('0x23')](_0x5e30c5[_0xf5c8('0x21')],function(_0x28a0b6){return{'model':db[_0x28a0b6[_0xf5c8('0x22')]],'as':_0x28a0b6['as'],'attributes':_0x28a0b6[_0xf5c8('0x1f')],'include':_0x28a0b6['include']?_['map'](_0x28a0b6['include'],function(_0x427b55){return{'model':db[_0x427b55[_0xf5c8('0x22')]],'as':_0x427b55['as'],'attributes':_0x427b55[_0xf5c8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf5c8('0x24')](function(_0xd1b239){logger['info'](_0xf5c8('0x27'),_0x48c1cf);logger[_0xf5c8('0x26')](_0xf5c8('0x27'),_0x48c1cf,JSON[_0xf5c8('0x13')](_0xd1b239));_0x428310(_0xd1b239);})[_0xf5c8('0x18')](function(_0x12e9c7){logger[_0xf5c8('0x14')]('ShowMailQueue',_0x12e9c7['message'],_0x48c1cf);_0x572be1(_0x1b6387[_0xf5c8('0x14')](0x1f4,_0x12e9c7[_0xf5c8('0x16')]));});});}; \ No newline at end of file +var _0x4fd9=['attributes','limit','include','map','model','debug','ShowMailQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4fd9,0xf1));var _0x94fd=function(_0x4ee781,_0x5a8076){_0x4ee781=_0x4ee781-0x0;var _0x29baa3=_0x4fd9[_0x4ee781];return _0x29baa3;};'use strict';var _=require(_0x94fd('0x0'));var util=require(_0x94fd('0x1'));var moment=require(_0x94fd('0x2'));var BPromise=require(_0x94fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94fd('0x4'));var db=require(_0x94fd('0x5'))['db'];var utils=require(_0x94fd('0x6'));var logger=require(_0x94fd('0x7'))(_0x94fd('0x8'));var config=require(_0x94fd('0x9'));var jayson=require(_0x94fd('0xa'));var client=jayson[_0x94fd('0xb')][_0x94fd('0xc')]({'port':0x232a});config[_0x94fd('0xd')]=_[_0x94fd('0xe')](config[_0x94fd('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94fd('0xd')]));require('./mailQueue.socket')[_0x94fd('0xf')](socket);function respondWithRpcPromise(_0x57ea90,_0x36a3c7,_0x5d54fc){return new BPromise(function(_0x3a5a89,_0x315600){return client['request'](_0x57ea90,_0x5d54fc)[_0x94fd('0x10')](function(_0x406d5a){logger[_0x94fd('0x11')](_0x94fd('0x12'),_0x36a3c7,_0x94fd('0x13'));logger['debug'](_0x94fd('0x14'),_0x36a3c7,_0x94fd('0x13'),JSON[_0x94fd('0x15')](_0x406d5a));if(_0x406d5a[_0x94fd('0x16')]){if(_0x406d5a[_0x94fd('0x16')][_0x94fd('0x17')]===0x1f4){logger[_0x94fd('0x16')](_0x94fd('0x12'),_0x36a3c7,_0x406d5a[_0x94fd('0x16')]['message']);return _0x315600(_0x406d5a[_0x94fd('0x16')][_0x94fd('0x18')]);}logger[_0x94fd('0x16')](_0x94fd('0x12'),_0x36a3c7,_0x406d5a[_0x94fd('0x16')]['message']);return _0x3a5a89(_0x406d5a[_0x94fd('0x16')][_0x94fd('0x18')]);}else{logger['info'](_0x94fd('0x12'),_0x36a3c7,'request\x20sent');_0x3a5a89(_0x406d5a['result'][_0x94fd('0x18')]);}})[_0x94fd('0x19')](function(_0x395063){logger[_0x94fd('0x16')](_0x94fd('0x12'),_0x36a3c7,_0x395063);_0x315600(_0x395063);});});}exports[_0x94fd('0x1a')]=function(_0x3e11a3){var _0x538fb7=this;return new Promise(function(_0x1a0a5c,_0x3b0db7){return db[_0x94fd('0x1b')][_0x94fd('0x1c')]({'raw':_0x3e11a3[_0x94fd('0x1d')]?_0x3e11a3[_0x94fd('0x1d')][_0x94fd('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e11a3['options']?_0x3e11a3[_0x94fd('0x1d')][_0x94fd('0x1f')]||null:null,'attributes':_0x3e11a3['options']?_0x3e11a3['options'][_0x94fd('0x20')]||null:null,'limit':_0x3e11a3[_0x94fd('0x1d')]?_0x3e11a3[_0x94fd('0x1d')][_0x94fd('0x21')]||null:null,'include':_0x3e11a3[_0x94fd('0x1d')]?_0x3e11a3[_0x94fd('0x1d')][_0x94fd('0x22')]?_[_0x94fd('0x23')](_0x3e11a3[_0x94fd('0x1d')][_0x94fd('0x22')],function(_0x326819){return{'model':db[_0x326819['model']],'as':_0x326819['as'],'attributes':_0x326819[_0x94fd('0x20')],'include':_0x326819[_0x94fd('0x22')]?_[_0x94fd('0x23')](_0x326819[_0x94fd('0x22')],function(_0x44cb85){return{'model':db[_0x44cb85[_0x94fd('0x24')]],'as':_0x44cb85['as'],'attributes':_0x44cb85['attributes'],'include':_0x44cb85['include']?_[_0x94fd('0x23')](_0x44cb85[_0x94fd('0x22')],function(_0x32f0d0){return{'model':db[_0x32f0d0[_0x94fd('0x24')]],'as':_0x32f0d0['as'],'attributes':_0x32f0d0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dce33){logger['info'](_0x94fd('0x1a'),_0x3e11a3);logger[_0x94fd('0x25')](_0x94fd('0x1a'),_0x3e11a3,JSON['stringify'](_0x2dce33));_0x1a0a5c(_0x2dce33);})['catch'](function(_0x51972b){logger[_0x94fd('0x16')]('GetMailQueue',_0x51972b[_0x94fd('0x18')],_0x3e11a3);_0x3b0db7(_0x538fb7[_0x94fd('0x16')](0x1f4,_0x51972b[_0x94fd('0x18')]));});});};exports[_0x94fd('0x26')]=function(_0x44016c){var _0x43f4dc=this;return new Promise(function(_0x697d95,_0xed6def){return db[_0x94fd('0x1b')]['find']({'raw':_0x44016c['options']?_0x44016c[_0x94fd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x44016c[_0x94fd('0x1d')]?_0x44016c[_0x94fd('0x1d')]['where']||null:null,'attributes':_0x44016c[_0x94fd('0x1d')]?_0x44016c['options'][_0x94fd('0x20')]||null:null,'include':_0x44016c[_0x94fd('0x1d')]?_0x44016c['options']['include']?_[_0x94fd('0x23')](_0x44016c[_0x94fd('0x1d')]['include'],function(_0x42e145){return{'model':db[_0x42e145[_0x94fd('0x24')]],'as':_0x42e145['as'],'attributes':_0x42e145[_0x94fd('0x20')],'include':_0x42e145['include']?_[_0x94fd('0x23')](_0x42e145[_0x94fd('0x22')],function(_0x55eeca){return{'model':db[_0x55eeca[_0x94fd('0x24')]],'as':_0x55eeca['as'],'attributes':_0x55eeca[_0x94fd('0x20')],'include':_0x55eeca[_0x94fd('0x22')]?_[_0x94fd('0x23')](_0x55eeca['include'],function(_0x5d27b4){return{'model':db[_0x5d27b4['model']],'as':_0x5d27b4['as'],'attributes':_0x5d27b4[_0x94fd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x94fd('0x10')](function(_0x5686d3){logger['info'](_0x94fd('0x26'),_0x44016c);logger[_0x94fd('0x25')](_0x94fd('0x26'),_0x44016c,JSON[_0x94fd('0x15')](_0x5686d3));_0x697d95(_0x5686d3);})[_0x94fd('0x19')](function(_0x7db74e){logger[_0x94fd('0x16')](_0x94fd('0x26'),_0x7db74e[_0x94fd('0x18')],_0x44016c);_0xed6def(_0x43f4dc[_0x94fd('0x16')](0x1f4,_0x7db74e[_0x94fd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 13a90d7..f64b274 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 _0x8f73=['mailQueue:','./mailQueue.events','save','remove','update','removeListener','register','length'];(function(_0x12cd34,_0x119864){var _0x138168=function(_0x2e6291){while(--_0x2e6291){_0x12cd34['push'](_0x12cd34['shift']());}};_0x138168(++_0x119864);}(_0x8f73,0x79));var _0x38f7=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x8f73[_0x334841];return _0x5beb4b;};'use strict';var MailQueueEvents=require(_0x38f7('0x0'));var events=[_0x38f7('0x1'),_0x38f7('0x2'),_0x38f7('0x3')];function createListener(_0x3757dd,_0x1349d2){return function(_0xe0de41){_0x1349d2['emit'](_0x3757dd,_0xe0de41);};}function removeListener(_0x349702,_0x1670ac){return function(){MailQueueEvents[_0x38f7('0x4')](_0x349702,_0x1670ac);};}exports[_0x38f7('0x5')]=function(_0x24759b){for(var _0x4c0645=0x0,_0x45b75c=events[_0x38f7('0x6')];_0x4c0645<_0x45b75c;_0x4c0645++){var _0x5aad6b=events[_0x4c0645];var _0x46180e=createListener(_0x38f7('0x7')+_0x5aad6b,_0x24759b);MailQueueEvents['on'](_0x5aad6b,_0x46180e);}}; \ No newline at end of file +var _0x635b=['length','mailQueue:','./mailQueue.events','save','remove','removeListener'];(function(_0x104b6e,_0x5bc6f9){var _0x15d1af=function(_0x3129ce){while(--_0x3129ce){_0x104b6e['push'](_0x104b6e['shift']());}};_0x15d1af(++_0x5bc6f9);}(_0x635b,0x16a));var _0xb635=function(_0x1c312e,_0x5cc58c){_0x1c312e=_0x1c312e-0x0;var _0x5d69c8=_0x635b[_0x1c312e];return _0x5d69c8;};'use strict';var MailQueueEvents=require(_0xb635('0x0'));var events=[_0xb635('0x1'),_0xb635('0x2'),'update'];function createListener(_0x1c23ef,_0x3d7b0d){return function(_0x174812){_0x3d7b0d['emit'](_0x1c23ef,_0x174812);};}function removeListener(_0x5f0bba,_0x5799ee){return function(){MailQueueEvents[_0xb635('0x3')](_0x5f0bba,_0x5799ee);};}exports['register']=function(_0x304add){for(var _0x4d81c2=0x0,_0x12fef0=events[_0xb635('0x4')];_0x4d81c2<_0x12fef0;_0x4d81c2++){var _0x3c9cff=events[_0x4d81c2];var _0x36fe81=createListener(_0xb635('0x5')+_0x3c9cff,_0x304add);MailQueueEvents['on'](_0x3c9cff,_0x36fe81);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 547faa1..0c69e1a 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 _0x003e=['./mailQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20f7ff,_0x257961){var _0x1e4989=function(_0x1ae749){while(--_0x1ae749){_0x20f7ff['push'](_0x20f7ff['shift']());}};_0x1e4989(++_0x257961);}(_0x003e,0x6a));var _0xe003=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x003e[_0x5a3cf0];return _0x5a64ee;};'use strict';var multer=require(_0xe003('0x0'));var util=require(_0xe003('0x1'));var path=require('path');var timeout=require(_0xe003('0x2'));var express=require(_0xe003('0x3'));var router=express[_0xe003('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe003('0x5'));var interaction=require(_0xe003('0x6'));var config=require(_0xe003('0x7'));var controller=require(_0xe003('0x8'));router[_0xe003('0x9')]('/',auth[_0xe003('0xa')](),controller[_0xe003('0xb')]);router['get']('/describe',auth[_0xe003('0xa')](),controller['describe']);router[_0xe003('0x9')](_0xe003('0xc'),auth[_0xe003('0xa')](),controller[_0xe003('0xd')]);router[_0xe003('0xe')]('/',auth[_0xe003('0xa')](),controller[_0xe003('0xf')]);router['put'](_0xe003('0xc'),auth[_0xe003('0xa')](),controller[_0xe003('0x10')]);router[_0xe003('0x11')](_0xe003('0xc'),auth[_0xe003('0xa')](),controller[_0xe003('0x12')]);module['exports']=router; \ No newline at end of file +var _0x94b6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x94b6,0x189));var _0x694b=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x94b6[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x694b('0x0'));var util=require(_0x694b('0x1'));var path=require('path');var timeout=require(_0x694b('0x2'));var express=require(_0x694b('0x3'));var router=express[_0x694b('0x4')]();var fs_extra=require(_0x694b('0x5'));var auth=require(_0x694b('0x6'));var interaction=require(_0x694b('0x7'));var config=require(_0x694b('0x8'));var controller=require(_0x694b('0x9'));router[_0x694b('0xa')]('/',auth[_0x694b('0xb')](),controller[_0x694b('0xc')]);router[_0x694b('0xa')](_0x694b('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x694b('0xa')](_0x694b('0xe'),auth[_0x694b('0xb')](),controller[_0x694b('0xf')]);router[_0x694b('0x10')]('/',auth[_0x694b('0xb')](),controller[_0x694b('0x11')]);router[_0x694b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x694b('0x13')]);router['delete'](_0x694b('0xe'),auth[_0x694b('0xb')](),controller[_0x694b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c4f005f..c95ac67 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 _0xa54c=['DATE','sequelize','STRING'];(function(_0x479746,_0x574758){var _0x36d2aa=function(_0x27e29d){while(--_0x27e29d){_0x479746['push'](_0x479746['shift']());}};_0x36d2aa(++_0x574758);}(_0xa54c,0xee));var _0xca54=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xa54c[_0x3afe18];return _0x19ed1f;};'use strict';var moment=require('moment');var Sequelize=require(_0xca54('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xca54('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xca54('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xca54('0x2')]},'exitAt':{'type':Sequelize[_0xca54('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb9d5=['STRING','DATE','sequelize','exports'];(function(_0x45c7eb,_0x3f15e4){var _0x5f1f19=function(_0x107319){while(--_0x107319){_0x45c7eb['push'](_0x45c7eb['shift']());}};_0x5f1f19(++_0x3f15e4);}(_0xb9d5,0xb6));var _0x5b9d=function(_0x34df62,_0xabfcf9){_0x34df62=_0x34df62-0x0;var _0x307190=_0xb9d5[_0x34df62];return _0x307190;};'use strict';var moment=require('moment');var Sequelize=require(_0x5b9d('0x0'));module[_0x5b9d('0x1')]={'uniqueid':{'type':Sequelize[_0x5b9d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5b9d('0x3')]},'acceptAt':{'type':Sequelize[_0x5b9d('0x3')]},'exitAt':{'type':Sequelize[_0x5b9d('0x3')]},'reason':{'type':Sequelize[_0x5b9d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2dfb559..4444af9 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 _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','MailQueueReport','includeAll','rows','catch','show'];(function(_0x6f76f5,_0x29737e){var _0x4b11e6=function(_0xcf4cb9){while(--_0xcf4cb9){_0x6f76f5['push'](_0x6f76f5['shift']());}};_0x4b11e6(++_0x29737e);}(_0x0295,0x1f0));var _0x5029=function(_0x499a43,_0x3cbee7){_0x499a43=_0x499a43-0x0;var _0x4e607e=_0x0295[_0x499a43];return _0x4e607e;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['MailQueueReport'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['MailQueueReport'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file +var _0xa456=['where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa456,0x142));var _0x6a45=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xa456[_0xe73080];return _0x12cbc4;};'use strict';var emlformat=require(_0x6a45('0x0'));var rimraf=require(_0x6a45('0x1'));var zipdir=require(_0x6a45('0x2'));var jsonpatch=require(_0x6a45('0x3'));var rp=require('request-promise');var moment=require(_0x6a45('0x4'));var BPromise=require(_0x6a45('0x5'));var Mustache=require(_0x6a45('0x6'));var util=require('util');var path=require(_0x6a45('0x7'));var sox=require(_0x6a45('0x8'));var csv=require(_0x6a45('0x9'));var ejs=require(_0x6a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511b92,_0x1aa4b4){_0x1aa4b4=_0x1aa4b4||0xcc;return function(_0x25a8b9){if(_0x25a8b9){return _0x511b92[_0x6a45('0x18')](_0x1aa4b4);}return _0x511b92[_0x6a45('0x19')](_0x1aa4b4)[_0x6a45('0x1a')]();};}function respondWithResult(_0x5a9f29,_0x563c3b){_0x563c3b=_0x563c3b||0xc8;return function(_0x3a5d94){if(_0x3a5d94){return _0x5a9f29[_0x6a45('0x19')](_0x563c3b)['json'](_0x3a5d94);}};}function respondWithFilteredResult(_0x2c20db,_0x171176){return function(_0x3fab82){if(_0x3fab82){var _0x13adc0=typeof _0x171176['offset']==='undefined'&&typeof _0x171176['limit']===_0x6a45('0x1b');var _0x391f81=_0x3fab82[_0x6a45('0x1c')];var _0x52a055=_0x13adc0?0x0:_0x171176[_0x6a45('0x1d')];var _0x102981=_0x13adc0?_0x3fab82[_0x6a45('0x1c')]:_0x171176['offset']+_0x171176['limit'];var _0x573453;if(_0x102981>=_0x391f81){_0x102981=_0x391f81;_0x573453=0xc8;}else{_0x573453=0xce;}_0x2c20db[_0x6a45('0x19')](_0x573453);return _0x2c20db[_0x6a45('0x1e')]('Content-Range',_0x52a055+'-'+_0x102981+'/'+_0x391f81)[_0x6a45('0x1f')](_0x3fab82);}return null;};}function patchUpdates(_0x1be485){return function(_0x4f7000){try{jsonpatch[_0x6a45('0x20')](_0x4f7000,_0x1be485,!![]);}catch(_0xdf10c6){return BPromise[_0x6a45('0x21')](_0xdf10c6);}return _0x4f7000[_0x6a45('0x22')]();};}function saveUpdates(_0x15ad0e,_0x487666){return function(_0x5d990e){if(_0x5d990e){return _0x5d990e[_0x6a45('0x23')](_0x15ad0e)[_0x6a45('0x24')](function(_0x11290c){return _0x11290c;});}return null;};}function removeEntity(_0x22373c,_0x25a380){return function(_0x3ad898){if(_0x3ad898){return _0x3ad898[_0x6a45('0x25')]()[_0x6a45('0x24')](function(){_0x22373c[_0x6a45('0x19')](0xcc)[_0x6a45('0x1a')]();});}};}function handleEntityNotFound(_0x1310d7,_0x46587a){return function(_0x5cd761){if(!_0x5cd761){_0x1310d7[_0x6a45('0x18')](0x194);}return _0x5cd761;};}function handleError(_0x5a0389,_0x1b83fa){_0x1b83fa=_0x1b83fa||0x1f4;return function(_0x25467d){logger[_0x6a45('0x26')](_0x25467d[_0x6a45('0x27')]);if(_0x25467d[_0x6a45('0x28')]){delete _0x25467d['name'];}_0x5a0389[_0x6a45('0x19')](_0x1b83fa)[_0x6a45('0x29')](_0x25467d);};}exports[_0x6a45('0x2a')]=function(_0x1ccff0,_0x8265d9){var _0x227b6f={},_0x3fac9b={},_0x313c13={'count':0x0,'rows':[]};var _0x54286d=_[_0x6a45('0x2b')](db[_0x6a45('0x2c')][_0x6a45('0x2d')],function(_0x201369){return{'name':_0x201369[_0x6a45('0x2e')],'type':_0x201369['type'][_0x6a45('0x2f')]};});_0x3fac9b[_0x6a45('0x30')]=_[_0x6a45('0x2b')](_0x54286d,_0x6a45('0x28'));_0x3fac9b['query']=_['keys'](_0x1ccff0[_0x6a45('0x31')]);_0x3fac9b['filters']=_[_0x6a45('0x32')](_0x3fac9b['model'],_0x3fac9b[_0x6a45('0x31')]);_0x227b6f[_0x6a45('0x33')]=_[_0x6a45('0x32')](_0x3fac9b[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x34')]));_0x227b6f[_0x6a45('0x33')]=_0x227b6f[_0x6a45('0x33')][_0x6a45('0x35')]?_0x227b6f[_0x6a45('0x33')]:_0x3fac9b[_0x6a45('0x30')];if(!_0x1ccff0[_0x6a45('0x31')]['hasOwnProperty'](_0x6a45('0x36'))){_0x227b6f['limit']=qs[_0x6a45('0x37')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x37')]);_0x227b6f[_0x6a45('0x1d')]=qs[_0x6a45('0x1d')](_0x1ccff0[_0x6a45('0x31')]['offset']);}_0x227b6f[_0x6a45('0x38')]=qs[_0x6a45('0x39')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x39')]);_0x227b6f[_0x6a45('0x3a')]=qs[_0x6a45('0x3b')](_['pick'](_0x1ccff0[_0x6a45('0x31')],_0x3fac9b[_0x6a45('0x3b')]),_0x54286d);if(_0x1ccff0['query'][_0x6a45('0x3c')]){_0x227b6f[_0x6a45('0x3a')]=_[_0x6a45('0x3d')](_0x227b6f[_0x6a45('0x3a')],{'$or':_[_0x6a45('0x2b')](_0x54286d,function(_0x50ebe0){if(_0x50ebe0[_0x6a45('0x3e')]!==_0x6a45('0x3f')){var _0x205afd={};_0x205afd[_0x50ebe0[_0x6a45('0x28')]]={'$like':'%'+_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x3c')]+'%'};return _0x205afd;}})});}_0x227b6f=_[_0x6a45('0x3d')]({},_0x227b6f,_0x1ccff0['options']);var _0x1c941a={'where':_0x227b6f['where']};return db[_0x6a45('0x2c')][_0x6a45('0x1c')](_0x1c941a)[_0x6a45('0x24')](function(_0x2715dc){_0x313c13['count']=_0x2715dc;if(_0x1ccff0['query'][_0x6a45('0x40')]){_0x227b6f[_0x6a45('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6a45('0x42')](_0x227b6f);})[_0x6a45('0x24')](function(_0x3bd926){_0x313c13[_0x6a45('0x43')]=_0x3bd926;return _0x313c13;})['then'](respondWithFilteredResult(_0x8265d9,_0x227b6f))['catch'](handleError(_0x8265d9,null));};exports['show']=function(_0x5b9798,_0xe90201){var _0xb5d191={'raw':!![],'where':{'id':_0x5b9798[_0x6a45('0x44')]['id']}},_0x328d9f={};_0x328d9f[_0x6a45('0x30')]=_[_0x6a45('0x45')](db[_0x6a45('0x2c')][_0x6a45('0x2d')]);_0x328d9f['query']=_[_0x6a45('0x45')](_0x5b9798['query']);_0x328d9f['filters']=_[_0x6a45('0x32')](_0x328d9f[_0x6a45('0x30')],_0x328d9f['query']);_0xb5d191[_0x6a45('0x33')]=_['intersection'](_0x328d9f[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x5b9798[_0x6a45('0x31')][_0x6a45('0x34')]));_0xb5d191['attributes']=_0xb5d191[_0x6a45('0x33')][_0x6a45('0x35')]?_0xb5d191[_0x6a45('0x33')]:_0x328d9f[_0x6a45('0x30')];if(_0x5b9798[_0x6a45('0x31')]['includeAll']){_0xb5d191[_0x6a45('0x41')]=[{'all':!![]}];}_0xb5d191=_['merge']({},_0xb5d191,_0x5b9798[_0x6a45('0x46')]);return db[_0x6a45('0x2c')]['find'](_0xb5d191)[_0x6a45('0x24')](handleEntityNotFound(_0xe90201,null))[_0x6a45('0x24')](respondWithResult(_0xe90201,null))[_0x6a45('0x47')](handleError(_0xe90201,null));};exports[_0x6a45('0x48')]=function(_0x524296,_0x34bbb7){return db['MailQueueReport'][_0x6a45('0x48')](_0x524296['body'],{})[_0x6a45('0x24')](respondWithResult(_0x34bbb7,0xc9))[_0x6a45('0x47')](handleError(_0x34bbb7,null));};exports[_0x6a45('0x23')]=function(_0x2bf8d3,_0x5d9f52){if(_0x2bf8d3[_0x6a45('0x49')]['id']){delete _0x2bf8d3[_0x6a45('0x49')]['id'];}return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x2bf8d3[_0x6a45('0x44')]['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x5d9f52,null))[_0x6a45('0x24')](saveUpdates(_0x2bf8d3[_0x6a45('0x49')],null))[_0x6a45('0x24')](respondWithResult(_0x5d9f52,null))[_0x6a45('0x47')](handleError(_0x5d9f52,null));};exports['destroy']=function(_0x3ea4a7,_0x8877c7){return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x3ea4a7['params']['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x8877c7,null))[_0x6a45('0x24')](removeEntity(_0x8877c7,null))[_0x6a45('0x47')](handleError(_0x8877c7,null));};exports['describe']=function(_0x4e7967,_0x5a17b8){return db[_0x6a45('0x2c')][_0x6a45('0x4b')]()[_0x6a45('0x24')](respondWithResult(_0x5a17b8,null))[_0x6a45('0x47')](handleError(_0x5a17b8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 6781ed3..c2c471a 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 _0xa729=['report_mail_queue','uniqueid','util','../../config/logger','api','bluebird','request-promise','rimraf','./mailQueueReport.attributes','exports','define'];(function(_0x9d3df9,_0x2038fa){var _0x50c613=function(_0x521678){while(--_0x521678){_0x9d3df9['push'](_0x9d3df9['shift']());}};_0x50c613(++_0x2038fa);}(_0xa729,0xf4));var _0x9a72=function(_0x586115,_0x283bd2){_0x586115=_0x586115-0x0;var _0x221bac=_0xa729[_0x586115];return _0x221bac;};'use strict';var _=require('lodash');var util=require(_0x9a72('0x0'));var logger=require(_0x9a72('0x1'))(_0x9a72('0x2'));var moment=require('moment');var BPromise=require(_0x9a72('0x3'));var rp=require(_0x9a72('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a72('0x5'));var config=require('../../config/environment');var attributes=require(_0x9a72('0x6'));module[_0x9a72('0x7')]=function(_0x326fd7,_0xdf238f){return _0x326fd7[_0x9a72('0x8')]('MailQueueReport',attributes,{'tableName':_0x9a72('0x9'),'paranoid':![],'indexes':[{'name':_0x9a72('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad7=['util','../../config/logger','api','moment','bluebird','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x58de95,_0x533852){var _0x58ab14=function(_0x11bbc7){while(--_0x11bbc7){_0x58de95['push'](_0x58de95['shift']());}};_0x58ab14(++_0x533852);}(_0x5ad7,0xbb));var _0x75ad=function(_0x48077f,_0x3bf7e1){_0x48077f=_0x48077f-0x0;var _0x27a417=_0x5ad7[_0x48077f];return _0x27a417;};'use strict';var _=require('lodash');var util=require(_0x75ad('0x0'));var logger=require(_0x75ad('0x1'))(_0x75ad('0x2'));var moment=require(_0x75ad('0x3'));var BPromise=require(_0x75ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x75ad('0x5'));module[_0x75ad('0x6')]=function(_0x4a4ee4,_0x15f049){return _0x4a4ee4[_0x75ad('0x7')](_0x75ad('0x8'),attributes,{'tableName':_0x75ad('0x9'),'paranoid':![],'indexes':[{'name':_0x75ad('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 30ce124..cc4e621 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x2dfe1e,_0x4e4285){var _0x59b8ab=function(_0x3317bd){while(--_0x3317bd){_0x2dfe1e['push'](_0x2dfe1e['shift']());}};_0x59b8ab(++_0x4e4285);}(_0x5f2f,0x73));var _0xf5f2=function(_0xb07062,_0x816630){_0xb07062=_0xb07062-0x0;var _0x5a9127=_0x5f2f[_0xb07062];return _0x5a9127;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x54de37,_0x16912b){var _0x5c0a8b=function(_0x2ce455){while(--_0x2ce455){_0x54de37['push'](_0x54de37['shift']());}};_0x5c0a8b(++_0x16912b);}(_0x1261,0x144));var _0x1126=function(_0x465533,_0x56ab66){_0x465533=_0x465533-0x0;var _0x49489b=_0x1261[_0x465533];return _0x49489b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 2c991b3..ed5b1ea 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(_0x39e997,_0x2dc948){var _0x52dedf=function(_0x11aeba){while(--_0x11aeba){_0x39e997['push'](_0x39e997['shift']());}};_0x52dedf(++_0x2dc948);}(_0xe706,0xa3));var _0x6e70=function(_0x470a01,_0x1ef188){_0x470a01=_0x470a01-0x0;var _0x5df181=_0xe706[_0x470a01];return _0x5df181;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x44e78e,_0x5f2ba5){var _0xff1bb2=function(_0x1dc6a8){while(--_0x1dc6a8){_0x44e78e['push'](_0x44e78e['shift']());}};_0xff1bb2(++_0x5f2ba5);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 7a2122f..0594861 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 _0x7980=['BOOLEAN','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x47a8cd,_0x588dc6){var _0x80ba4c=function(_0x39433f){while(--_0x39433f){_0x47a8cd['push'](_0x47a8cd['shift']());}};_0x80ba4c(++_0x588dc6);}(_0x7980,0xab));var _0x0798=function(_0x7aaba,_0x2a3fa6){_0x7aaba=_0x7aaba-0x0;var _0x3d187b=_0x7980[_0x7aaba];return _0x3d187b;};'use strict';var Sequelize=require(_0x0798('0x0'));module[_0x0798('0x1')]={'description':{'type':Sequelize[_0x0798('0x2')]},'host':{'type':Sequelize[_0x0798('0x2')]},'authentication':{'type':Sequelize[_0x0798('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0798('0x2')]},'port':{'type':Sequelize[_0x0798('0x4')]},'tls':{'type':Sequelize[_0x0798('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0798('0x2')],'defaultValue':_0x0798('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0798('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['INBOX','sequelize','STRING','BOOLEAN'];(function(_0x3b740d,_0x243824){var _0x90546c=function(_0x5c96df){while(--_0x5c96df){_0x3b740d['push'](_0x3b740d['shift']());}};_0x90546c(++_0x243824);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'description':{'type':Sequelize[_0x7b7e('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x7b7e('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7b7e('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x7b7e('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 99e259b..695bc49 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 _0x8f5b=['exports','lodash','util','../../config/logger','moment'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x8f5b,0xdd));var _0xb8f5=function(_0x14d413,_0x4ab482){_0x14d413=_0x14d413-0x0;var _0x44bc1e=_0x8f5b[_0x14d413];return _0x44bc1e;};'use strict';var _=require(_0xb8f5('0x0'));var util=require(_0xb8f5('0x1'));var logger=require(_0xb8f5('0x2'))('api');var moment=require(_0xb8f5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0xb8f5('0x4')]=function(_0x57423d,_0x2955fb){return _0x57423d['define']('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06a4=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in'];(function(_0x329703,_0x5368c9){var _0x5e2928=function(_0x33792e){while(--_0x33792e){_0x329703['push'](_0x329703['shift']());}};_0x5e2928(++_0x5368c9);}(_0x06a4,0x1c3));var _0x406a=function(_0xd3c515,_0x27b9bf){_0xd3c515=_0xd3c515-0x0;var _0x526fac=_0x06a4[_0xd3c515];return _0x526fac;};'use strict';var _=require(_0x406a('0x0'));var util=require(_0x406a('0x1'));var logger=require(_0x406a('0x2'))(_0x406a('0x3'));var moment=require('moment');var BPromise=require(_0x406a('0x4'));var rp=require(_0x406a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x406a('0x6'));var config=require(_0x406a('0x7'));var attributes=require(_0x406a('0x8'));module['exports']=function(_0x4c3e0d,_0xc2163b){return _0x4c3e0d['define'](_0x406a('0x9'),attributes,{'tableName':_0x406a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 081d007..b0e0b86 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 _0x3f43=['jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailServerIn','findAll','options','raw','attributes','model','map','include','debug','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x5965c7,_0x5b35f5){var _0xe13124=function(_0x2a04a1){while(--_0x2a04a1){_0x5965c7['push'](_0x5965c7['shift']());}};_0xe13124(++_0x5b35f5);}(_0x3f43,0x1e6));var _0x33f4=function(_0x466fdc,_0x132bf1){_0x466fdc=_0x466fdc-0x0;var _0x365e38=_0x3f43[_0x466fdc];return _0x365e38;};'use strict';var _=require(_0x33f4('0x0'));var util=require(_0x33f4('0x1'));var moment=require(_0x33f4('0x2'));var BPromise=require('bluebird');var rs=require(_0x33f4('0x3'));var fs=require('fs');var Redis=require(_0x33f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x33f4('0x5'));var logger=require('../../config/logger')(_0x33f4('0x6'));var config=require('../../config/environment');var jayson=require(_0x33f4('0x7'));var client=jayson['client'][_0x33f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf019e8,_0x5cd804,_0x271002){return new BPromise(function(_0x10cabc,_0x4757df){return client[_0x33f4('0x9')](_0xf019e8,_0x271002)[_0x33f4('0xa')](function(_0xbf69d1){logger[_0x33f4('0xb')](_0x33f4('0xc'),_0x5cd804,_0x33f4('0xd'));logger['debug'](_0x33f4('0xe'),_0x5cd804,_0x33f4('0xd'),JSON['stringify'](_0xbf69d1));if(_0xbf69d1[_0x33f4('0xf')]){if(_0xbf69d1[_0x33f4('0xf')]['code']===0x1f4){logger[_0x33f4('0xf')](_0x33f4('0xc'),_0x5cd804,_0xbf69d1[_0x33f4('0xf')]['message']);return _0x4757df(_0xbf69d1[_0x33f4('0xf')][_0x33f4('0x10')]);}logger[_0x33f4('0xf')]('MailServerIn,\x20%s,\x20%s',_0x5cd804,_0xbf69d1[_0x33f4('0xf')][_0x33f4('0x10')]);return _0x10cabc(_0xbf69d1[_0x33f4('0xf')][_0x33f4('0x10')]);}else{logger['info'](_0x33f4('0xc'),_0x5cd804,'request\x20sent');_0x10cabc(_0xbf69d1[_0x33f4('0x11')]['message']);}})[_0x33f4('0x12')](function(_0xb7c96){logger[_0x33f4('0xf')]('MailServerIn,\x20%s,\x20%s',_0x5cd804,_0xb7c96);_0x4757df(_0xb7c96);});});}exports[_0x33f4('0x13')]=function(_0x23307a){var _0x3aff5f=this;return new Promise(function(_0x4e93cf,_0x2e0170){return db['MailServerIn'][_0x33f4('0x14')]({'raw':_0x23307a[_0x33f4('0x15')]?_0x23307a[_0x33f4('0x15')][_0x33f4('0x16')]===undefined?!![]:![]:!![],'where':_0x23307a['options']?_0x23307a[_0x33f4('0x15')]['where']||null:null,'attributes':_0x23307a[_0x33f4('0x15')]?_0x23307a[_0x33f4('0x15')][_0x33f4('0x17')]||null:null,'limit':_0x23307a[_0x33f4('0x15')]?_0x23307a['options']['limit']||null:null,'include':_0x23307a['options']?_0x23307a[_0x33f4('0x15')]['include']?_['map'](_0x23307a[_0x33f4('0x15')]['include'],function(_0x2d0146){return{'model':db[_0x2d0146[_0x33f4('0x18')]],'as':_0x2d0146['as'],'attributes':_0x2d0146[_0x33f4('0x17')],'include':_0x2d0146['include']?_[_0x33f4('0x19')](_0x2d0146[_0x33f4('0x1a')],function(_0x58fa0e){return{'model':db[_0x58fa0e[_0x33f4('0x18')]],'as':_0x58fa0e['as'],'attributes':_0x58fa0e['attributes'],'include':_0x58fa0e['include']?_[_0x33f4('0x19')](_0x58fa0e[_0x33f4('0x1a')],function(_0x3228d9){return{'model':db[_0x3228d9[_0x33f4('0x18')]],'as':_0x3228d9['as'],'attributes':_0x3228d9[_0x33f4('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cdb7a){logger[_0x33f4('0xb')]('GetMailServerIn',_0x23307a);logger[_0x33f4('0x1b')](_0x33f4('0x13'),_0x23307a,JSON[_0x33f4('0x1c')](_0x1cdb7a));_0x4e93cf(_0x1cdb7a);})[_0x33f4('0x12')](function(_0x4757fe){logger[_0x33f4('0xf')](_0x33f4('0x13'),_0x4757fe[_0x33f4('0x10')],_0x23307a);_0x2e0170(_0x3aff5f[_0x33f4('0xf')](0x1f4,_0x4757fe[_0x33f4('0x10')]));});});}; \ No newline at end of file +var _0xa0aa=['MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','options','raw','limit','include','model','attributes','map','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x1c3763,_0x15f7ee){var _0x29509c=function(_0x351228){while(--_0x351228){_0x1c3763['push'](_0x1c3763['shift']());}};_0x29509c(++_0x15f7ee);}(_0xa0aa,0x19b));var _0xaa0a=function(_0x4f08b9,_0xfa989f){_0x4f08b9=_0x4f08b9-0x0;var _0x42fcb6=_0xa0aa[_0x4f08b9];return _0x42fcb6;};'use strict';var _=require(_0xaa0a('0x0'));var util=require(_0xaa0a('0x1'));var moment=require('moment');var BPromise=require(_0xaa0a('0x2'));var rs=require(_0xaa0a('0x3'));var fs=require('fs');var Redis=require(_0xaa0a('0x4'));var db=require(_0xaa0a('0x5'))['db'];var utils=require(_0xaa0a('0x6'));var logger=require(_0xaa0a('0x7'))(_0xaa0a('0x8'));var config=require(_0xaa0a('0x9'));var jayson=require(_0xaa0a('0xa'));var client=jayson[_0xaa0a('0xb')][_0xaa0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf80d91,_0x1cc2da,_0x5431c8){return new BPromise(function(_0x18a450,_0x441c7f){return client[_0xaa0a('0xd')](_0xf80d91,_0x5431c8)[_0xaa0a('0xe')](function(_0x4e41e9){logger[_0xaa0a('0xf')](_0xaa0a('0x10'),_0x1cc2da,_0xaa0a('0x11'));logger['debug'](_0xaa0a('0x12'),_0x1cc2da,_0xaa0a('0x11'),JSON[_0xaa0a('0x13')](_0x4e41e9));if(_0x4e41e9[_0xaa0a('0x14')]){if(_0x4e41e9[_0xaa0a('0x14')][_0xaa0a('0x15')]===0x1f4){logger['error'](_0xaa0a('0x10'),_0x1cc2da,_0x4e41e9[_0xaa0a('0x14')]['message']);return _0x441c7f(_0x4e41e9['error'][_0xaa0a('0x16')]);}logger['error'](_0xaa0a('0x10'),_0x1cc2da,_0x4e41e9[_0xaa0a('0x14')][_0xaa0a('0x16')]);return _0x18a450(_0x4e41e9[_0xaa0a('0x14')][_0xaa0a('0x16')]);}else{logger['info'](_0xaa0a('0x10'),_0x1cc2da,_0xaa0a('0x11'));_0x18a450(_0x4e41e9['result']['message']);}})[_0xaa0a('0x17')](function(_0x439af3){logger[_0xaa0a('0x14')](_0xaa0a('0x10'),_0x1cc2da,_0x439af3);_0x441c7f(_0x439af3);});});}exports[_0xaa0a('0x18')]=function(_0x5dd81f){var _0x1e6e48=this;return new Promise(function(_0x4061a9,_0x4f84b7){return db['MailServerIn']['findAll']({'raw':_0x5dd81f['options']?_0x5dd81f[_0xaa0a('0x19')][_0xaa0a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5dd81f[_0xaa0a('0x19')]?_0x5dd81f[_0xaa0a('0x19')]['where']||null:null,'attributes':_0x5dd81f[_0xaa0a('0x19')]?_0x5dd81f[_0xaa0a('0x19')]['attributes']||null:null,'limit':_0x5dd81f['options']?_0x5dd81f['options'][_0xaa0a('0x1b')]||null:null,'include':_0x5dd81f[_0xaa0a('0x19')]?_0x5dd81f['options'][_0xaa0a('0x1c')]?_['map'](_0x5dd81f[_0xaa0a('0x19')][_0xaa0a('0x1c')],function(_0x2d0b29){return{'model':db[_0x2d0b29[_0xaa0a('0x1d')]],'as':_0x2d0b29['as'],'attributes':_0x2d0b29[_0xaa0a('0x1e')],'include':_0x2d0b29[_0xaa0a('0x1c')]?_['map'](_0x2d0b29[_0xaa0a('0x1c')],function(_0x4d56ee){return{'model':db[_0x4d56ee[_0xaa0a('0x1d')]],'as':_0x4d56ee['as'],'attributes':_0x4d56ee[_0xaa0a('0x1e')],'include':_0x4d56ee['include']?_[_0xaa0a('0x1f')](_0x4d56ee[_0xaa0a('0x1c')],function(_0x1e0d5b){return{'model':db[_0x1e0d5b[_0xaa0a('0x1d')]],'as':_0x1e0d5b['as'],'attributes':_0x1e0d5b['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa0a('0xe')](function(_0x101c43){logger[_0xaa0a('0xf')](_0xaa0a('0x18'),_0x5dd81f);logger[_0xaa0a('0x20')](_0xaa0a('0x18'),_0x5dd81f,JSON[_0xaa0a('0x13')](_0x101c43));_0x4061a9(_0x101c43);})[_0xaa0a('0x17')](function(_0x51adbb){logger[_0xaa0a('0x14')](_0xaa0a('0x18'),_0x51adbb[_0xaa0a('0x16')],_0x5dd81f);_0x4f84b7(_0x1e6e48[_0xaa0a('0x14')](0x1f4,_0x51adbb[_0xaa0a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index da07622..3c9c568 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x45fdc5,_0x3c6eb2){_0x45fdc5=_0x45fdc5-0x0;var _0x1c81f6=_0x7a54[_0x45fdc5];return _0x1c81f6;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7a54,0x106));var _0x47a5=function(_0x213ee6,_0x3b6c56){_0x213ee6=_0x213ee6-0x0;var _0x5e5d1d=_0x7a54[_0x213ee6];return _0x5e5d1d;};'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 60f61e0..8ec74fc 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 _0x2af8=['sequelize','STRING','INTEGER'];(function(_0x164418,_0x27c5d1){var _0x332b94=function(_0x3d7bf2){while(--_0x3d7bf2){_0x164418['push'](_0x164418['shift']());}};_0x332b94(++_0x27c5d1);}(_0x2af8,0xf6));var _0x82af=function(_0x31b3a7,_0x453dfc){_0x31b3a7=_0x31b3a7-0x0;var _0x2ce250=_0x2af8[_0x31b3a7];return _0x2ce250;};'use strict';var Sequelize=require(_0x82af('0x0'));module['exports']={'description':{'type':Sequelize[_0x82af('0x1')]},'host':{'type':Sequelize[_0x82af('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x82af('0x1')]},'port':{'type':Sequelize[_0x82af('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x82af('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x116a=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x13f73c,_0x9a5352){var _0x19ada4=function(_0x2802a5){while(--_0x2802a5){_0x13f73c['push'](_0x13f73c['shift']());}};_0x19ada4(++_0x9a5352);}(_0x116a,0x174));var _0xa116=function(_0x57bdd5,_0x16e514){_0x57bdd5=_0x57bdd5-0x0;var _0x288a8f=_0x116a[_0x57bdd5];return _0x288a8f;};'use strict';var Sequelize=require(_0xa116('0x0'));module[_0xa116('0x1')]={'description':{'type':Sequelize[_0xa116('0x2')]},'host':{'type':Sequelize[_0xa116('0x2')]},'user':{'type':Sequelize[_0xa116('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa116('0x3')]},'secure':{'type':Sequelize[_0xa116('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xa116('0x2')]},'authentication':{'type':Sequelize[_0xa116('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 0f8a295..8198b11 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 _0x89a6=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','VIRTUAL','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x54cd25,_0x462584){var _0x5068a8=function(_0x31fa2e){while(--_0x31fa2e){_0x54cd25['push'](_0x54cd25['shift']());}};_0x5068a8(++_0x462584);}(_0x89a6,0x1bf));var _0x689a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x89a6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x689a('0x0'));var rimraf=require(_0x689a('0x1'));var zipdir=require(_0x689a('0x2'));var jsonpatch=require(_0x689a('0x3'));var rp=require(_0x689a('0x4'));var moment=require(_0x689a('0x5'));var BPromise=require(_0x689a('0x6'));var Mustache=require(_0x689a('0x7'));var util=require(_0x689a('0x8'));var path=require(_0x689a('0x9'));var sox=require(_0x689a('0xa'));var csv=require(_0x689a('0xb'));var ejs=require(_0x689a('0xc'));var fs=require('fs');var fs_extra=require(_0x689a('0xd'));var _=require(_0x689a('0xe'));var squel=require(_0x689a('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x689a('0xb'));var querystring=require(_0x689a('0x10'));var Papa=require(_0x689a('0x11'));var Redis=require('ioredis');var authService=require(_0x689a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x689a('0x13'));var hardwareService=require(_0x689a('0x14'));var logger=require('../../config/logger')(_0x689a('0x15'));var utils=require('../../config/utils');var config=require(_0x689a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3af5ab,_0x27502f){_0x27502f=_0x27502f||0xcc;return function(_0x46a6bf){if(_0x46a6bf){return _0x3af5ab[_0x689a('0x17')](_0x27502f);}return _0x3af5ab['status'](_0x27502f)[_0x689a('0x18')]();};}function respondWithResult(_0x590492,_0x19ee18){_0x19ee18=_0x19ee18||0xc8;return function(_0x57880){if(_0x57880){return _0x590492[_0x689a('0x19')](_0x19ee18)['json'](_0x57880);}};}function respondWithFilteredResult(_0x501954,_0x3a0cce){return function(_0x2d798a){if(_0x2d798a){var _0x29fa37=typeof _0x3a0cce[_0x689a('0x1a')]===_0x689a('0x1b')&&typeof _0x3a0cce['limit']===_0x689a('0x1b');var _0x46334b=_0x2d798a[_0x689a('0x1c')];var _0x21f860=_0x29fa37?0x0:_0x3a0cce['offset'];var _0x143a0a=_0x29fa37?_0x2d798a[_0x689a('0x1c')]:_0x3a0cce[_0x689a('0x1a')]+_0x3a0cce['limit'];var _0x5bd998;if(_0x143a0a>=_0x46334b){_0x143a0a=_0x46334b;_0x5bd998=0xc8;}else{_0x5bd998=0xce;}_0x501954[_0x689a('0x19')](_0x5bd998);return _0x501954[_0x689a('0x1d')](_0x689a('0x1e'),_0x21f860+'-'+_0x143a0a+'/'+_0x46334b)[_0x689a('0x1f')](_0x2d798a);}return null;};}function patchUpdates(_0x483bb1){return function(_0x2a129a){try{jsonpatch[_0x689a('0x20')](_0x2a129a,_0x483bb1,!![]);}catch(_0xc34d4d){return BPromise['reject'](_0xc34d4d);}return _0x2a129a[_0x689a('0x21')]();};}function saveUpdates(_0x246555,_0xf50f49){return function(_0x1a59e3){if(_0x1a59e3){return _0x1a59e3[_0x689a('0x22')](_0x246555)[_0x689a('0x23')](function(_0x5d6ab0){return _0x5d6ab0;});}return null;};}function removeEntity(_0x664690,_0x557ab0){return function(_0x438dcf){if(_0x438dcf){return _0x438dcf[_0x689a('0x24')]()[_0x689a('0x23')](function(){_0x664690[_0x689a('0x19')](0xcc)[_0x689a('0x18')]();});}};}function handleEntityNotFound(_0x49b9af,_0x22a00c){return function(_0x4e8f85){if(!_0x4e8f85){_0x49b9af['sendStatus'](0x194);}return _0x4e8f85;};}function handleError(_0x3ff8bd,_0x171459){_0x171459=_0x171459||0x1f4;return function(_0x50b899){logger[_0x689a('0x25')](_0x50b899[_0x689a('0x26')]);if(_0x50b899[_0x689a('0x27')]){delete _0x50b899[_0x689a('0x27')];}_0x3ff8bd[_0x689a('0x19')](_0x171459)[_0x689a('0x28')](_0x50b899);};}exports[_0x689a('0x29')]=function(_0xd5f8b2,_0x14f9b3){var _0x1d3f44={},_0x82da2a={},_0x4baef9={'count':0x0,'rows':[]};var _0xd7c2a0=_['map'](db['MailServerOut'][_0x689a('0x2a')],function(_0xb168c8){return{'name':_0xb168c8[_0x689a('0x2b')],'type':_0xb168c8[_0x689a('0x2c')][_0x689a('0x2d')]};});_0x82da2a[_0x689a('0x2e')]=_[_0x689a('0x2f')](_0xd7c2a0,_0x689a('0x27'));_0x82da2a[_0x689a('0x30')]=_['keys'](_0xd5f8b2['query']);_0x82da2a['filters']=_[_0x689a('0x31')](_0x82da2a[_0x689a('0x2e')],_0x82da2a[_0x689a('0x30')]);_0x1d3f44[_0x689a('0x32')]=_[_0x689a('0x31')](_0x82da2a[_0x689a('0x2e')],qs[_0x689a('0x33')](_0xd5f8b2[_0x689a('0x30')]['fields']));_0x1d3f44['attributes']=_0x1d3f44[_0x689a('0x32')][_0x689a('0x34')]?_0x1d3f44[_0x689a('0x32')]:_0x82da2a['model'];if(!_0xd5f8b2[_0x689a('0x30')]['hasOwnProperty'](_0x689a('0x35'))){_0x1d3f44[_0x689a('0x36')]=qs['limit'](_0xd5f8b2['query']['limit']);_0x1d3f44[_0x689a('0x1a')]=qs[_0x689a('0x1a')](_0xd5f8b2[_0x689a('0x30')][_0x689a('0x1a')]);}_0x1d3f44[_0x689a('0x37')]=qs[_0x689a('0x38')](_0xd5f8b2[_0x689a('0x30')][_0x689a('0x38')]);_0x1d3f44[_0x689a('0x39')]=qs[_0x689a('0x3a')](_['pick'](_0xd5f8b2[_0x689a('0x30')],_0x82da2a['filters']),_0xd7c2a0);if(_0xd5f8b2[_0x689a('0x30')][_0x689a('0x3b')]){_0x1d3f44[_0x689a('0x39')]=_['merge'](_0x1d3f44['where'],{'$or':_[_0x689a('0x2f')](_0xd7c2a0,function(_0x1d0d00){if(_0x1d0d00[_0x689a('0x2c')]!==_0x689a('0x3c')){var _0x2dfbd5={};_0x2dfbd5[_0x1d0d00[_0x689a('0x27')]]={'$like':'%'+_0xd5f8b2['query'][_0x689a('0x3b')]+'%'};return _0x2dfbd5;}})});}_0x1d3f44=_[_0x689a('0x3d')]({},_0x1d3f44,_0xd5f8b2[_0x689a('0x3e')]);var _0x3342ee={'where':_0x1d3f44[_0x689a('0x39')]};return db[_0x689a('0x3f')][_0x689a('0x1c')](_0x3342ee)[_0x689a('0x23')](function(_0x42c882){_0x4baef9[_0x689a('0x1c')]=_0x42c882;if(_0xd5f8b2[_0x689a('0x30')][_0x689a('0x40')]){_0x1d3f44[_0x689a('0x41')]=[{'all':!![]}];}return db['MailServerOut'][_0x689a('0x42')](_0x1d3f44);})[_0x689a('0x23')](function(_0x87fa78){_0x4baef9[_0x689a('0x43')]=_0x87fa78;return _0x4baef9;})[_0x689a('0x23')](respondWithFilteredResult(_0x14f9b3,_0x1d3f44))[_0x689a('0x44')](handleError(_0x14f9b3,null));};exports[_0x689a('0x45')]=function(_0x39e3e0,_0xb49697){var _0x13ffab={'raw':!![],'where':{'id':_0x39e3e0[_0x689a('0x46')]['id']}},_0x2a5e28={};_0x2a5e28[_0x689a('0x2e')]=_[_0x689a('0x47')](db['MailServerOut'][_0x689a('0x2a')]);_0x2a5e28[_0x689a('0x30')]=_[_0x689a('0x47')](_0x39e3e0[_0x689a('0x30')]);_0x2a5e28[_0x689a('0x3a')]=_[_0x689a('0x31')](_0x2a5e28['model'],_0x2a5e28[_0x689a('0x30')]);_0x13ffab[_0x689a('0x32')]=_[_0x689a('0x31')](_0x2a5e28[_0x689a('0x2e')],qs[_0x689a('0x33')](_0x39e3e0[_0x689a('0x30')][_0x689a('0x33')]));_0x13ffab[_0x689a('0x32')]=_0x13ffab[_0x689a('0x32')][_0x689a('0x34')]?_0x13ffab[_0x689a('0x32')]:_0x2a5e28[_0x689a('0x2e')];if(_0x39e3e0[_0x689a('0x30')][_0x689a('0x40')]){_0x13ffab[_0x689a('0x41')]=[{'all':!![]}];}_0x13ffab=_['merge']({},_0x13ffab,_0x39e3e0['options']);return db['MailServerOut'][_0x689a('0x48')](_0x13ffab)[_0x689a('0x23')](handleEntityNotFound(_0xb49697,null))[_0x689a('0x23')](respondWithResult(_0xb49697,null))[_0x689a('0x44')](handleError(_0xb49697,null));};exports[_0x689a('0x49')]=function(_0x4441c8,_0x3b10fd){return db[_0x689a('0x3f')][_0x689a('0x49')](_0x4441c8[_0x689a('0x4a')],{})[_0x689a('0x23')](respondWithResult(_0x3b10fd,0xc9))[_0x689a('0x44')](handleError(_0x3b10fd,null));};exports['update']=function(_0x2b5ee9,_0x4e1b9a){if(_0x2b5ee9[_0x689a('0x4a')]['id']){delete _0x2b5ee9[_0x689a('0x4a')]['id'];}return db[_0x689a('0x3f')]['find']({'where':{'id':_0x2b5ee9[_0x689a('0x46')]['id']}})[_0x689a('0x23')](handleEntityNotFound(_0x4e1b9a,null))[_0x689a('0x23')](saveUpdates(_0x2b5ee9[_0x689a('0x4a')],null))[_0x689a('0x23')](respondWithResult(_0x4e1b9a,null))[_0x689a('0x44')](handleError(_0x4e1b9a,null));};exports[_0x689a('0x24')]=function(_0x381eb6,_0x34744d){return db[_0x689a('0x3f')][_0x689a('0x48')]({'where':{'id':_0x381eb6['params']['id']}})[_0x689a('0x23')](handleEntityNotFound(_0x34744d,null))[_0x689a('0x23')](removeEntity(_0x34744d,null))[_0x689a('0x44')](handleError(_0x34744d,null));}; \ No newline at end of file +var _0x46ea=['merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','sort','pick','where'];(function(_0x49090b,_0x158c9d){var _0x29caa7=function(_0x23e6f0){while(--_0x23e6f0){_0x49090b['push'](_0x49090b['shift']());}};_0x29caa7(++_0x158c9d);}(_0x46ea,0x13c));var _0xa46e=function(_0x3bd4a5,_0x2597bd){_0x3bd4a5=_0x3bd4a5-0x0;var _0x41d843=_0x46ea[_0x3bd4a5];return _0x41d843;};'use strict';var emlformat=require(_0xa46e('0x0'));var rimraf=require(_0xa46e('0x1'));var zipdir=require(_0xa46e('0x2'));var jsonpatch=require(_0xa46e('0x3'));var rp=require(_0xa46e('0x4'));var moment=require(_0xa46e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa46e('0x6'));var util=require(_0xa46e('0x7'));var path=require(_0xa46e('0x8'));var sox=require(_0xa46e('0x9'));var csv=require('to-csv');var ejs=require(_0xa46e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa46e('0xb'));var squel=require(_0xa46e('0xc'));var crypto=require(_0xa46e('0xd'));var jsforce=require(_0xa46e('0xe'));var deskjs=require(_0xa46e('0xf'));var toCsv=require(_0xa46e('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa46e('0x11'));var authService=require(_0xa46e('0x12'));var qs=require(_0xa46e('0x13'));var as=require(_0xa46e('0x14'));var hardwareService=require(_0xa46e('0x15'));var logger=require('../../config/logger')(_0xa46e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa46e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3569a2,_0x34c2f2){_0x34c2f2=_0x34c2f2||0xcc;return function(_0x4db09b){if(_0x4db09b){return _0x3569a2[_0xa46e('0x18')](_0x34c2f2);}return _0x3569a2['status'](_0x34c2f2)['end']();};}function respondWithResult(_0x3694e9,_0x537717){_0x537717=_0x537717||0xc8;return function(_0x19db40){if(_0x19db40){return _0x3694e9[_0xa46e('0x19')](_0x537717)[_0xa46e('0x1a')](_0x19db40);}};}function respondWithFilteredResult(_0x5b53a1,_0x545bb2){return function(_0x1c874a){if(_0x1c874a){var _0x1c4d78=typeof _0x545bb2[_0xa46e('0x1b')]===_0xa46e('0x1c')&&typeof _0x545bb2[_0xa46e('0x1d')]==='undefined';var _0x3e08b5=_0x1c874a['count'];var _0x3d9f2b=_0x1c4d78?0x0:_0x545bb2[_0xa46e('0x1b')];var _0x2a1a21=_0x1c4d78?_0x1c874a['count']:_0x545bb2[_0xa46e('0x1b')]+_0x545bb2[_0xa46e('0x1d')];var _0x5a8521;if(_0x2a1a21>=_0x3e08b5){_0x2a1a21=_0x3e08b5;_0x5a8521=0xc8;}else{_0x5a8521=0xce;}_0x5b53a1['status'](_0x5a8521);return _0x5b53a1[_0xa46e('0x1e')](_0xa46e('0x1f'),_0x3d9f2b+'-'+_0x2a1a21+'/'+_0x3e08b5)[_0xa46e('0x1a')](_0x1c874a);}return null;};}function patchUpdates(_0x698a4){return function(_0x5e8b6e){try{jsonpatch[_0xa46e('0x20')](_0x5e8b6e,_0x698a4,!![]);}catch(_0x246c9c){return BPromise[_0xa46e('0x21')](_0x246c9c);}return _0x5e8b6e[_0xa46e('0x22')]();};}function saveUpdates(_0x1ff20e,_0x251480){return function(_0x141a08){if(_0x141a08){return _0x141a08[_0xa46e('0x23')](_0x1ff20e)[_0xa46e('0x24')](function(_0x579738){return _0x579738;});}return null;};}function removeEntity(_0x1c6bdf,_0x38113d){return function(_0x4d0fd6){if(_0x4d0fd6){return _0x4d0fd6[_0xa46e('0x25')]()['then'](function(){_0x1c6bdf[_0xa46e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218dd4,_0x2dd29c){return function(_0x146cf8){if(!_0x146cf8){_0x218dd4[_0xa46e('0x18')](0x194);}return _0x146cf8;};}function handleError(_0x50730d,_0x3c410b){_0x3c410b=_0x3c410b||0x1f4;return function(_0x1c60eb){logger['error'](_0x1c60eb[_0xa46e('0x26')]);if(_0x1c60eb['name']){delete _0x1c60eb[_0xa46e('0x27')];}_0x50730d[_0xa46e('0x19')](_0x3c410b)[_0xa46e('0x28')](_0x1c60eb);};}exports[_0xa46e('0x29')]=function(_0xa1421c,_0x4e2c89){var _0x413a92={},_0x41dc9f={},_0x4c4c4d={'count':0x0,'rows':[]};var _0x341e45=_[_0xa46e('0x2a')](db[_0xa46e('0x2b')][_0xa46e('0x2c')],function(_0x1cb708){return{'name':_0x1cb708[_0xa46e('0x2d')],'type':_0x1cb708[_0xa46e('0x2e')][_0xa46e('0x2f')]};});_0x41dc9f['model']=_[_0xa46e('0x2a')](_0x341e45,_0xa46e('0x27'));_0x41dc9f[_0xa46e('0x30')]=_[_0xa46e('0x31')](_0xa1421c[_0xa46e('0x30')]);_0x41dc9f[_0xa46e('0x32')]=_[_0xa46e('0x33')](_0x41dc9f['model'],_0x41dc9f[_0xa46e('0x30')]);_0x413a92[_0xa46e('0x34')]=_[_0xa46e('0x33')](_0x41dc9f[_0xa46e('0x35')],qs[_0xa46e('0x36')](_0xa1421c[_0xa46e('0x30')]['fields']));_0x413a92['attributes']=_0x413a92[_0xa46e('0x34')]['length']?_0x413a92[_0xa46e('0x34')]:_0x41dc9f[_0xa46e('0x35')];if(!_0xa1421c[_0xa46e('0x30')][_0xa46e('0x37')]('nolimit')){_0x413a92['limit']=qs[_0xa46e('0x1d')](_0xa1421c[_0xa46e('0x30')][_0xa46e('0x1d')]);_0x413a92['offset']=qs[_0xa46e('0x1b')](_0xa1421c[_0xa46e('0x30')]['offset']);}_0x413a92['order']=qs[_0xa46e('0x38')](_0xa1421c[_0xa46e('0x30')][_0xa46e('0x38')]);_0x413a92['where']=qs['filters'](_[_0xa46e('0x39')](_0xa1421c['query'],_0x41dc9f[_0xa46e('0x32')]),_0x341e45);if(_0xa1421c[_0xa46e('0x30')]['filter']){_0x413a92[_0xa46e('0x3a')]=_[_0xa46e('0x3b')](_0x413a92['where'],{'$or':_[_0xa46e('0x2a')](_0x341e45,function(_0xb82734){if(_0xb82734['type']!==_0xa46e('0x3c')){var _0x2204eb={};_0x2204eb[_0xb82734[_0xa46e('0x27')]]={'$like':'%'+_0xa1421c[_0xa46e('0x30')][_0xa46e('0x3d')]+'%'};return _0x2204eb;}})});}_0x413a92=_[_0xa46e('0x3b')]({},_0x413a92,_0xa1421c[_0xa46e('0x3e')]);var _0x2e28ce={'where':_0x413a92['where']};return db['MailServerOut'][_0xa46e('0x3f')](_0x2e28ce)[_0xa46e('0x24')](function(_0x41d5be){_0x4c4c4d[_0xa46e('0x3f')]=_0x41d5be;if(_0xa1421c['query']['includeAll']){_0x413a92[_0xa46e('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0xa46e('0x41')](_0x413a92);})[_0xa46e('0x24')](function(_0x408641){_0x4c4c4d[_0xa46e('0x42')]=_0x408641;return _0x4c4c4d;})[_0xa46e('0x24')](respondWithFilteredResult(_0x4e2c89,_0x413a92))[_0xa46e('0x43')](handleError(_0x4e2c89,null));};exports[_0xa46e('0x44')]=function(_0x16b52f,_0x395be2){var _0x52aea6={'raw':!![],'where':{'id':_0x16b52f[_0xa46e('0x45')]['id']}},_0x43ee10={};_0x43ee10[_0xa46e('0x35')]=_[_0xa46e('0x31')](db[_0xa46e('0x2b')][_0xa46e('0x2c')]);_0x43ee10[_0xa46e('0x30')]=_[_0xa46e('0x31')](_0x16b52f['query']);_0x43ee10['filters']=_['intersection'](_0x43ee10['model'],_0x43ee10[_0xa46e('0x30')]);_0x52aea6[_0xa46e('0x34')]=_[_0xa46e('0x33')](_0x43ee10[_0xa46e('0x35')],qs['fields'](_0x16b52f[_0xa46e('0x30')][_0xa46e('0x36')]));_0x52aea6[_0xa46e('0x34')]=_0x52aea6[_0xa46e('0x34')][_0xa46e('0x46')]?_0x52aea6[_0xa46e('0x34')]:_0x43ee10['model'];if(_0x16b52f[_0xa46e('0x30')][_0xa46e('0x47')]){_0x52aea6[_0xa46e('0x40')]=[{'all':!![]}];}_0x52aea6=_[_0xa46e('0x3b')]({},_0x52aea6,_0x16b52f['options']);return db['MailServerOut'][_0xa46e('0x48')](_0x52aea6)[_0xa46e('0x24')](handleEntityNotFound(_0x395be2,null))[_0xa46e('0x24')](respondWithResult(_0x395be2,null))[_0xa46e('0x43')](handleError(_0x395be2,null));};exports[_0xa46e('0x49')]=function(_0xcf7bf1,_0x3ee064){return db[_0xa46e('0x2b')][_0xa46e('0x49')](_0xcf7bf1[_0xa46e('0x4a')],{})[_0xa46e('0x24')](respondWithResult(_0x3ee064,0xc9))[_0xa46e('0x43')](handleError(_0x3ee064,null));};exports['update']=function(_0x48a535,_0x3db1ae){if(_0x48a535[_0xa46e('0x4a')]['id']){delete _0x48a535[_0xa46e('0x4a')]['id'];}return db[_0xa46e('0x2b')]['find']({'where':{'id':_0x48a535[_0xa46e('0x45')]['id']}})[_0xa46e('0x24')](handleEntityNotFound(_0x3db1ae,null))[_0xa46e('0x24')](saveUpdates(_0x48a535['body'],null))[_0xa46e('0x24')](respondWithResult(_0x3db1ae,null))['catch'](handleError(_0x3db1ae,null));};exports[_0xa46e('0x25')]=function(_0x414613,_0x24c17c){return db[_0xa46e('0x2b')][_0xa46e('0x48')]({'where':{'id':_0x414613[_0xa46e('0x45')]['id']}})[_0xa46e('0x24')](handleEntityNotFound(_0x24c17c,null))[_0xa46e('0x24')](removeEntity(_0x24c17c,null))[_0xa46e('0x43')](handleError(_0x24c17c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 3c59f1d..9504142 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 _0x52f0=['bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x216a99,_0xa8d8e3){var _0x1303f1=function(_0x3a99bb){while(--_0x3a99bb){_0x216a99['push'](_0x216a99['shift']());}};_0x1303f1(++_0xa8d8e3);}(_0x52f0,0x181));var _0x052f=function(_0x1aaf79,_0x298f15){_0x1aaf79=_0x1aaf79-0x0;var _0x12e371=_0x52f0[_0x1aaf79];return _0x12e371;};'use strict';var _=require(_0x052f('0x0'));var util=require(_0x052f('0x1'));var logger=require(_0x052f('0x2'))(_0x052f('0x3'));var moment=require(_0x052f('0x4'));var BPromise=require(_0x052f('0x5'));var rp=require(_0x052f('0x6'));var fs=require('fs');var path=require(_0x052f('0x7'));var rimraf=require(_0x052f('0x8'));var config=require('../../config/environment');var attributes=require(_0x052f('0x9'));module[_0x052f('0xa')]=function(_0x1d6a2b,_0x3b4174){return _0x1d6a2b[_0x052f('0xb')]('MailServerOut',attributes,{'tableName':_0x052f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3358=['../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','moment','request-promise','rimraf'];(function(_0x510f70,_0x5b9064){var _0x1a4aaf=function(_0x342557){while(--_0x342557){_0x510f70['push'](_0x510f70['shift']());}};_0x1a4aaf(++_0x5b9064);}(_0x3358,0x19d));var _0x8335=function(_0x4ac650,_0x27e24b){_0x4ac650=_0x4ac650-0x0;var _0xdd26aa=_0x3358[_0x4ac650];return _0xdd26aa;};'use strict';var _=require(_0x8335('0x0'));var util=require('util');var logger=require(_0x8335('0x1'))('api');var moment=require(_0x8335('0x2'));var BPromise=require('bluebird');var rp=require(_0x8335('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8335('0x4'));var config=require(_0x8335('0x5'));var attributes=require(_0x8335('0x6'));module[_0x8335('0x7')]=function(_0x3baf7d,_0x397c60){return _0x3baf7d[_0x8335('0x8')](_0x8335('0x9'),attributes,{'tableName':_0x8335('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 fc7291e..7073cca 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x247405,_0x390f4e){var _0x52404f=function(_0x272c5c){while(--_0x272c5c){_0x247405['push'](_0x247405['shift']());}};_0x52404f(++_0x390f4e);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e54de,_0x37c5b4){_0x5e54de=_0x5e54de-0x0;var _0x305290=_0x2ef3[_0x5e54de];return _0x305290;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1127bf,_0x542714){var _0x5bdfce=function(_0x29b766){while(--_0x29b766){_0x1127bf['push'](_0x1127bf['shift']());}};_0x5bdfce(++_0x542714);}(_0x2ef3,0xba));var _0x32ef=function(_0x47514d,_0x45588c){_0x47514d=_0x47514d-0x0;var _0x4c500f=_0x2ef3[_0x47514d];return _0x4c500f;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ac7551c..202b2d3 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 _0x893c=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','show','post','create','/:id','update','destroy','exports','multer'];(function(_0x50784b,_0x2f70b4){var _0x30bb70=function(_0x99c512){while(--_0x99c512){_0x50784b['push'](_0x50784b['shift']());}};_0x30bb70(++_0x2f70b4);}(_0x893c,0x179));var _0xc893=function(_0x384130,_0x4787dd){_0x384130=_0x384130-0x0;var _0x206897=_0x893c[_0x384130];return _0x206897;};'use strict';var multer=require(_0xc893('0x0'));var util=require('util');var path=require(_0xc893('0x1'));var timeout=require(_0xc893('0x2'));var express=require(_0xc893('0x3'));var router=express['Router']();var fs_extra=require(_0xc893('0x4'));var auth=require(_0xc893('0x5'));var interaction=require(_0xc893('0x6'));var config=require(_0xc893('0x7'));var controller=require(_0xc893('0x8'));router['get']('/',auth[_0xc893('0x9')](),controller[_0xc893('0xa')]);router[_0xc893('0xb')](_0xc893('0xc'),auth['isAuthenticated'](),controller[_0xc893('0xd')]);router[_0xc893('0xb')]('/:id',auth[_0xc893('0x9')](),controller[_0xc893('0xe')]);router[_0xc893('0xf')]('/',auth['isAuthenticated'](),controller[_0xc893('0x10')]);router['put'](_0xc893('0x11'),auth[_0xc893('0x9')](),controller[_0xc893('0x12')]);router['delete']('/:id',auth[_0xc893('0x9')](),controller[_0xc893('0x13')]);module[_0xc893('0x14')]=router; \ No newline at end of file +var _0x4815=['isAuthenticated','index','/describe','describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get'];(function(_0xf19d4f,_0x3fa6a0){var _0x569eb5=function(_0x38bb95){while(--_0x38bb95){_0xf19d4f['push'](_0xf19d4f['shift']());}};_0x569eb5(++_0x3fa6a0);}(_0x4815,0xee));var _0x5481=function(_0x3b1e18,_0x5c194d){_0x3b1e18=_0x3b1e18-0x0;var _0xc6ce52=_0x4815[_0x3b1e18];return _0xc6ce52;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5481('0x0'));var timeout=require(_0x5481('0x1'));var express=require(_0x5481('0x2'));var router=express[_0x5481('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5481('0x4'));var interaction=require(_0x5481('0x5'));var config=require(_0x5481('0x6'));var controller=require(_0x5481('0x7'));router[_0x5481('0x8')]('/',auth[_0x5481('0x9')](),controller[_0x5481('0xa')]);router[_0x5481('0x8')](_0x5481('0xb'),auth[_0x5481('0x9')](),controller[_0x5481('0xc')]);router[_0x5481('0x8')](_0x5481('0xd'),auth[_0x5481('0x9')](),controller[_0x5481('0xe')]);router['post']('/',auth[_0x5481('0x9')](),controller['create']);router['put']('/:id',auth[_0x5481('0x9')](),controller[_0x5481('0xf')]);router[_0x5481('0x10')](_0x5481('0xd'),auth[_0x5481('0x9')](),controller[_0x5481('0x11')]);module[_0x5481('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 60d3231..d65e03d 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 _0x07e8=['STRING','sequelize','exports'];(function(_0x215893,_0x48a8a4){var _0xe60edf=function(_0x222460){while(--_0x222460){_0x215893['push'](_0x215893['shift']());}};_0xe60edf(++_0x48a8a4);}(_0x07e8,0x10f));var _0x807e=function(_0xc644bf,_0x5201aa){_0xc644bf=_0xc644bf-0x0;var _0x1d1590=_0x07e8[_0xc644bf];return _0x1d1590;};'use strict';var Sequelize=require(_0x807e('0x0'));module[_0x807e('0x1')]={'name':{'type':Sequelize[_0x807e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x807e('0x2')]}}; \ No newline at end of file +var _0x82c4=['STRING','name','sequelize','exports'];(function(_0x45179e,_0xfd7c00){var _0x48df38=function(_0x5d2892){while(--_0x5d2892){_0x45179e['push'](_0x45179e['shift']());}};_0x48df38(++_0xfd7c00);}(_0x82c4,0x1ca));var _0x482c=function(_0x2a036a,_0x2cbbdf){_0x2a036a=_0x2a036a-0x0;var _0xee0b06=_0x82c4[_0x2a036a];return _0xee0b06;};'use strict';var Sequelize=require(_0x482c('0x0'));module[_0x482c('0x1')]={'name':{'type':Sequelize[_0x482c('0x2')],'unique':_0x482c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x482c('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d52e46b..d319aab 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 _0x3d62=['save','update','then','destroy','end','error','stack','name','send','index','map','MailSubstatus','type','query','keys','filters','model','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0x3d62,0x70));var _0x23d6=function(_0x2badec,_0xc14780){_0x2badec=_0x2badec-0x0;var _0x5f343e=_0x3d62[_0x2badec];return _0x5f343e;};'use strict';var emlformat=require(_0x23d6('0x0'));var rimraf=require(_0x23d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x23d6('0x2'));var moment=require(_0x23d6('0x3'));var BPromise=require(_0x23d6('0x4'));var Mustache=require(_0x23d6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x23d6('0x6'));var csv=require(_0x23d6('0x7'));var ejs=require(_0x23d6('0x8'));var fs=require('fs');var fs_extra=require(_0x23d6('0x9'));var _=require('lodash');var squel=require(_0x23d6('0xa'));var crypto=require(_0x23d6('0xb'));var jsforce=require(_0x23d6('0xc'));var deskjs=require(_0x23d6('0xd'));var toCsv=require(_0x23d6('0x7'));var querystring=require(_0x23d6('0xe'));var Papa=require(_0x23d6('0xf'));var Redis=require(_0x23d6('0x10'));var authService=require(_0x23d6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23d6('0x12'));var hardwareService=require(_0x23d6('0x13'));var logger=require(_0x23d6('0x14'))(_0x23d6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23d6('0x16'));var db=require(_0x23d6('0x17'))['db'];function respondWithStatusCode(_0x2b4fdf,_0x1ab61c){_0x1ab61c=_0x1ab61c||0xcc;return function(_0x2cdfd1){if(_0x2cdfd1){return _0x2b4fdf[_0x23d6('0x18')](_0x1ab61c);}return _0x2b4fdf[_0x23d6('0x19')](_0x1ab61c)['end']();};}function respondWithResult(_0x4a7a76,_0x366075){_0x366075=_0x366075||0xc8;return function(_0x522522){if(_0x522522){return _0x4a7a76[_0x23d6('0x19')](_0x366075)[_0x23d6('0x1a')](_0x522522);}};}function respondWithFilteredResult(_0x5850e7,_0x36ac17){return function(_0x59644e){if(_0x59644e){var _0x40322c=typeof _0x36ac17[_0x23d6('0x1b')]===_0x23d6('0x1c')&&typeof _0x36ac17['limit']==='undefined';var _0x20043c=_0x59644e[_0x23d6('0x1d')];var _0x33ab98=_0x40322c?0x0:_0x36ac17[_0x23d6('0x1b')];var _0x32d25b=_0x40322c?_0x59644e[_0x23d6('0x1d')]:_0x36ac17[_0x23d6('0x1b')]+_0x36ac17[_0x23d6('0x1e')];var _0x5469fc;if(_0x32d25b>=_0x20043c){_0x32d25b=_0x20043c;_0x5469fc=0xc8;}else{_0x5469fc=0xce;}_0x5850e7[_0x23d6('0x19')](_0x5469fc);return _0x5850e7[_0x23d6('0x1f')](_0x23d6('0x20'),_0x33ab98+'-'+_0x32d25b+'/'+_0x20043c)[_0x23d6('0x1a')](_0x59644e);}return null;};}function patchUpdates(_0x544777){return function(_0xee497e){try{jsonpatch[_0x23d6('0x21')](_0xee497e,_0x544777,!![]);}catch(_0x34dec3){return BPromise['reject'](_0x34dec3);}return _0xee497e[_0x23d6('0x22')]();};}function saveUpdates(_0x3cda7d,_0x5027e5){return function(_0x5111b6){if(_0x5111b6){return _0x5111b6[_0x23d6('0x23')](_0x3cda7d)[_0x23d6('0x24')](function(_0x38c62f){return _0x38c62f;});}return null;};}function removeEntity(_0x448c9c,_0x526fd2){return function(_0x22f2d5){if(_0x22f2d5){return _0x22f2d5[_0x23d6('0x25')]()['then'](function(){_0x448c9c[_0x23d6('0x19')](0xcc)[_0x23d6('0x26')]();});}};}function handleEntityNotFound(_0x42b1c3,_0xb49f9b){return function(_0x257656){if(!_0x257656){_0x42b1c3[_0x23d6('0x18')](0x194);}return _0x257656;};}function handleError(_0x4d1897,_0x304825){_0x304825=_0x304825||0x1f4;return function(_0x3583ad){logger[_0x23d6('0x27')](_0x3583ad[_0x23d6('0x28')]);if(_0x3583ad[_0x23d6('0x29')]){delete _0x3583ad[_0x23d6('0x29')];}_0x4d1897['status'](_0x304825)[_0x23d6('0x2a')](_0x3583ad);};}exports[_0x23d6('0x2b')]=function(_0x4d652c,_0x532fa9){var _0x456b54={},_0x3ce074={},_0x5ed138={'count':0x0,'rows':[]};var _0x2e5d4a=_[_0x23d6('0x2c')](db[_0x23d6('0x2d')]['rawAttributes'],function(_0xa3448c){return{'name':_0xa3448c['fieldName'],'type':_0xa3448c[_0x23d6('0x2e')]['key']};});_0x3ce074['model']=_['map'](_0x2e5d4a,_0x23d6('0x29'));_0x3ce074[_0x23d6('0x2f')]=_[_0x23d6('0x30')](_0x4d652c[_0x23d6('0x2f')]);_0x3ce074[_0x23d6('0x31')]=_['intersection'](_0x3ce074[_0x23d6('0x32')],_0x3ce074[_0x23d6('0x2f')]);_0x456b54[_0x23d6('0x33')]=_[_0x23d6('0x34')](_0x3ce074[_0x23d6('0x32')],qs[_0x23d6('0x35')](_0x4d652c['query']['fields']));_0x456b54[_0x23d6('0x33')]=_0x456b54[_0x23d6('0x33')][_0x23d6('0x36')]?_0x456b54['attributes']:_0x3ce074[_0x23d6('0x32')];if(!_0x4d652c[_0x23d6('0x2f')]['hasOwnProperty']('nolimit')){_0x456b54[_0x23d6('0x1e')]=qs[_0x23d6('0x1e')](_0x4d652c[_0x23d6('0x2f')][_0x23d6('0x1e')]);_0x456b54['offset']=qs['offset'](_0x4d652c[_0x23d6('0x2f')][_0x23d6('0x1b')]);}_0x456b54[_0x23d6('0x37')]=qs[_0x23d6('0x38')](_0x4d652c[_0x23d6('0x2f')][_0x23d6('0x38')]);_0x456b54['where']=qs['filters'](_[_0x23d6('0x39')](_0x4d652c[_0x23d6('0x2f')],_0x3ce074['filters']),_0x2e5d4a);if(_0x4d652c['query'][_0x23d6('0x3a')]){_0x456b54[_0x23d6('0x3b')]=_[_0x23d6('0x3c')](_0x456b54['where'],{'$or':_[_0x23d6('0x2c')](_0x2e5d4a,function(_0xf8be82){if(_0xf8be82[_0x23d6('0x2e')]!=='VIRTUAL'){var _0x40adb8={};_0x40adb8[_0xf8be82['name']]={'$like':'%'+_0x4d652c[_0x23d6('0x2f')]['filter']+'%'};return _0x40adb8;}})});}_0x456b54=_[_0x23d6('0x3c')]({},_0x456b54,_0x4d652c[_0x23d6('0x3d')]);var _0x5d1a41={'where':_0x456b54[_0x23d6('0x3b')]};return db['MailSubstatus']['count'](_0x5d1a41)[_0x23d6('0x24')](function(_0x11dcac){_0x5ed138['count']=_0x11dcac;if(_0x4d652c[_0x23d6('0x2f')][_0x23d6('0x3e')]){_0x456b54[_0x23d6('0x3f')]=[{'all':!![]}];}return db[_0x23d6('0x2d')][_0x23d6('0x40')](_0x456b54);})[_0x23d6('0x24')](function(_0x150012){_0x5ed138[_0x23d6('0x41')]=_0x150012;return _0x5ed138;})[_0x23d6('0x24')](respondWithFilteredResult(_0x532fa9,_0x456b54))['catch'](handleError(_0x532fa9,null));};exports[_0x23d6('0x42')]=function(_0x416eac,_0x20d065){var _0x22580d={'raw':!![],'where':{'id':_0x416eac[_0x23d6('0x43')]['id']}},_0xa499f3={};_0xa499f3[_0x23d6('0x32')]=_[_0x23d6('0x30')](db[_0x23d6('0x2d')]['rawAttributes']);_0xa499f3[_0x23d6('0x2f')]=_[_0x23d6('0x30')](_0x416eac['query']);_0xa499f3[_0x23d6('0x31')]=_[_0x23d6('0x34')](_0xa499f3[_0x23d6('0x32')],_0xa499f3[_0x23d6('0x2f')]);_0x22580d[_0x23d6('0x33')]=_[_0x23d6('0x34')](_0xa499f3[_0x23d6('0x32')],qs[_0x23d6('0x35')](_0x416eac[_0x23d6('0x2f')][_0x23d6('0x35')]));_0x22580d[_0x23d6('0x33')]=_0x22580d[_0x23d6('0x33')]['length']?_0x22580d[_0x23d6('0x33')]:_0xa499f3[_0x23d6('0x32')];if(_0x416eac['query'][_0x23d6('0x3e')]){_0x22580d[_0x23d6('0x3f')]=[{'all':!![]}];}_0x22580d=_[_0x23d6('0x3c')]({},_0x22580d,_0x416eac[_0x23d6('0x3d')]);return db[_0x23d6('0x2d')]['find'](_0x22580d)['then'](handleEntityNotFound(_0x20d065,null))[_0x23d6('0x24')](respondWithResult(_0x20d065,null))[_0x23d6('0x44')](handleError(_0x20d065,null));};exports[_0x23d6('0x45')]=function(_0x3cb7de,_0x5a7954){return db[_0x23d6('0x2d')][_0x23d6('0x45')](_0x3cb7de[_0x23d6('0x46')],{})[_0x23d6('0x24')](respondWithResult(_0x5a7954,0xc9))['catch'](handleError(_0x5a7954,null));};exports[_0x23d6('0x23')]=function(_0xc57b00,_0x3035a3){if(_0xc57b00[_0x23d6('0x46')]['id']){delete _0xc57b00['body']['id'];}return db['MailSubstatus'][_0x23d6('0x47')]({'where':{'id':_0xc57b00[_0x23d6('0x43')]['id']}})[_0x23d6('0x24')](handleEntityNotFound(_0x3035a3,null))[_0x23d6('0x24')](saveUpdates(_0xc57b00[_0x23d6('0x46')],null))[_0x23d6('0x24')](respondWithResult(_0x3035a3,null))[_0x23d6('0x44')](handleError(_0x3035a3,null));};exports[_0x23d6('0x25')]=function(_0xe0b023,_0xca98b8){return db[_0x23d6('0x2d')][_0x23d6('0x47')]({'where':{'id':_0xe0b023[_0x23d6('0x43')]['id']}})[_0x23d6('0x24')](handleEntityNotFound(_0xca98b8,null))['then'](removeEntity(_0xca98b8,null))[_0x23d6('0x44')](handleError(_0xca98b8,null));};exports[_0x23d6('0x48')]=function(_0x25fd28,_0x265029){return db['MailSubstatus'][_0x23d6('0x48')]()['then'](respondWithResult(_0x265029,null))[_0x23d6('0x44')](handleError(_0x265029,null));}; \ No newline at end of file +var _0x0f7c=['lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','reject','save','update','then','destroy','sendStatus','error','name','send','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x48a766,_0x2b095a){var _0x4a2207=function(_0x5ad397){while(--_0x5ad397){_0x48a766['push'](_0x48a766['shift']());}};_0x4a2207(++_0x2b095a);}(_0x0f7c,0x16b));var _0xc0f7=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x0f7c[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xc0f7('0x0'));var rimraf=require(_0xc0f7('0x1'));var zipdir=require(_0xc0f7('0x2'));var jsonpatch=require(_0xc0f7('0x3'));var rp=require(_0xc0f7('0x4'));var moment=require('moment');var BPromise=require(_0xc0f7('0x5'));var Mustache=require('mustache');var util=require(_0xc0f7('0x6'));var path=require(_0xc0f7('0x7'));var sox=require(_0xc0f7('0x8'));var csv=require(_0xc0f7('0x9'));var ejs=require(_0xc0f7('0xa'));var fs=require('fs');var fs_extra=require(_0xc0f7('0xb'));var _=require(_0xc0f7('0xc'));var squel=require('squel');var crypto=require(_0xc0f7('0xd'));var jsforce=require(_0xc0f7('0xe'));var deskjs=require(_0xc0f7('0xf'));var toCsv=require(_0xc0f7('0x9'));var querystring=require('querystring');var Papa=require(_0xc0f7('0x10'));var Redis=require(_0xc0f7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc0f7('0x12'));var hardwareService=require(_0xc0f7('0x13'));var logger=require(_0xc0f7('0x14'))(_0xc0f7('0x15'));var utils=require(_0xc0f7('0x16'));var config=require(_0xc0f7('0x17'));var licenseUtil=require(_0xc0f7('0x18'));var db=require(_0xc0f7('0x19'))['db'];function respondWithStatusCode(_0x5c30f6,_0x243c38){_0x243c38=_0x243c38||0xcc;return function(_0xd51c0a){if(_0xd51c0a){return _0x5c30f6['sendStatus'](_0x243c38);}return _0x5c30f6[_0xc0f7('0x1a')](_0x243c38)[_0xc0f7('0x1b')]();};}function respondWithResult(_0x1a78fb,_0x8511af){_0x8511af=_0x8511af||0xc8;return function(_0x4fdb6b){if(_0x4fdb6b){return _0x1a78fb[_0xc0f7('0x1a')](_0x8511af)[_0xc0f7('0x1c')](_0x4fdb6b);}};}function respondWithFilteredResult(_0x2c1ba3,_0x523c29){return function(_0x43ab60){if(_0x43ab60){var _0x558487=typeof _0x523c29[_0xc0f7('0x1d')]==='undefined'&&typeof _0x523c29['limit']===_0xc0f7('0x1e');var _0x5b499f=_0x43ab60[_0xc0f7('0x1f')];var _0x15faf1=_0x558487?0x0:_0x523c29[_0xc0f7('0x1d')];var _0xc05bcf=_0x558487?_0x43ab60[_0xc0f7('0x1f')]:_0x523c29[_0xc0f7('0x1d')]+_0x523c29[_0xc0f7('0x20')];var _0x1eacb1;if(_0xc05bcf>=_0x5b499f){_0xc05bcf=_0x5b499f;_0x1eacb1=0xc8;}else{_0x1eacb1=0xce;}_0x2c1ba3[_0xc0f7('0x1a')](_0x1eacb1);return _0x2c1ba3['set']('Content-Range',_0x15faf1+'-'+_0xc05bcf+'/'+_0x5b499f)[_0xc0f7('0x1c')](_0x43ab60);}return null;};}function patchUpdates(_0x2b2708){return function(_0x1c6b82){try{jsonpatch['apply'](_0x1c6b82,_0x2b2708,!![]);}catch(_0x5c5944){return BPromise[_0xc0f7('0x21')](_0x5c5944);}return _0x1c6b82[_0xc0f7('0x22')]();};}function saveUpdates(_0x471352,_0xa537c0){return function(_0x1dc09c){if(_0x1dc09c){return _0x1dc09c[_0xc0f7('0x23')](_0x471352)[_0xc0f7('0x24')](function(_0x37a42f){return _0x37a42f;});}return null;};}function removeEntity(_0x2f2429,_0x2b1696){return function(_0x2357f4){if(_0x2357f4){return _0x2357f4[_0xc0f7('0x25')]()[_0xc0f7('0x24')](function(){_0x2f2429[_0xc0f7('0x1a')](0xcc)[_0xc0f7('0x1b')]();});}};}function handleEntityNotFound(_0x2029dd,_0x2c525d){return function(_0x425bfd){if(!_0x425bfd){_0x2029dd[_0xc0f7('0x26')](0x194);}return _0x425bfd;};}function handleError(_0xb40dc2,_0x320903){_0x320903=_0x320903||0x1f4;return function(_0x3c22ee){logger[_0xc0f7('0x27')](_0x3c22ee['stack']);if(_0x3c22ee[_0xc0f7('0x28')]){delete _0x3c22ee[_0xc0f7('0x28')];}_0xb40dc2['status'](_0x320903)[_0xc0f7('0x29')](_0x3c22ee);};}exports['index']=function(_0x4def5a,_0x17702e){var _0x160b6f={},_0x13add9={},_0x5768ad={'count':0x0,'rows':[]};var _0x32c23b=_['map'](db[_0xc0f7('0x2a')][_0xc0f7('0x2b')],function(_0x1b7dce){return{'name':_0x1b7dce[_0xc0f7('0x2c')],'type':_0x1b7dce[_0xc0f7('0x2d')][_0xc0f7('0x2e')]};});_0x13add9[_0xc0f7('0x2f')]=_[_0xc0f7('0x30')](_0x32c23b,'name');_0x13add9[_0xc0f7('0x31')]=_[_0xc0f7('0x32')](_0x4def5a[_0xc0f7('0x31')]);_0x13add9[_0xc0f7('0x33')]=_[_0xc0f7('0x34')](_0x13add9[_0xc0f7('0x2f')],_0x13add9[_0xc0f7('0x31')]);_0x160b6f[_0xc0f7('0x35')]=_['intersection'](_0x13add9[_0xc0f7('0x2f')],qs['fields'](_0x4def5a[_0xc0f7('0x31')][_0xc0f7('0x36')]));_0x160b6f['attributes']=_0x160b6f[_0xc0f7('0x35')]['length']?_0x160b6f['attributes']:_0x13add9[_0xc0f7('0x2f')];if(!_0x4def5a['query'][_0xc0f7('0x37')](_0xc0f7('0x38'))){_0x160b6f['limit']=qs[_0xc0f7('0x20')](_0x4def5a[_0xc0f7('0x31')][_0xc0f7('0x20')]);_0x160b6f[_0xc0f7('0x1d')]=qs[_0xc0f7('0x1d')](_0x4def5a[_0xc0f7('0x31')][_0xc0f7('0x1d')]);}_0x160b6f[_0xc0f7('0x39')]=qs[_0xc0f7('0x3a')](_0x4def5a['query'][_0xc0f7('0x3a')]);_0x160b6f[_0xc0f7('0x3b')]=qs['filters'](_['pick'](_0x4def5a[_0xc0f7('0x31')],_0x13add9[_0xc0f7('0x33')]),_0x32c23b);if(_0x4def5a[_0xc0f7('0x31')][_0xc0f7('0x3c')]){_0x160b6f[_0xc0f7('0x3b')]=_[_0xc0f7('0x3d')](_0x160b6f[_0xc0f7('0x3b')],{'$or':_['map'](_0x32c23b,function(_0x3405b4){if(_0x3405b4[_0xc0f7('0x2d')]!=='VIRTUAL'){var _0x41538f={};_0x41538f[_0x3405b4[_0xc0f7('0x28')]]={'$like':'%'+_0x4def5a[_0xc0f7('0x31')]['filter']+'%'};return _0x41538f;}})});}_0x160b6f=_[_0xc0f7('0x3d')]({},_0x160b6f,_0x4def5a['options']);var _0x1e5676={'where':_0x160b6f[_0xc0f7('0x3b')]};return db['MailSubstatus'][_0xc0f7('0x1f')](_0x1e5676)[_0xc0f7('0x24')](function(_0x2f2749){_0x5768ad['count']=_0x2f2749;if(_0x4def5a[_0xc0f7('0x31')][_0xc0f7('0x3e')]){_0x160b6f[_0xc0f7('0x3f')]=[{'all':!![]}];}return db[_0xc0f7('0x2a')][_0xc0f7('0x40')](_0x160b6f);})[_0xc0f7('0x24')](function(_0x21716b){_0x5768ad[_0xc0f7('0x41')]=_0x21716b;return _0x5768ad;})[_0xc0f7('0x24')](respondWithFilteredResult(_0x17702e,_0x160b6f))[_0xc0f7('0x42')](handleError(_0x17702e,null));};exports[_0xc0f7('0x43')]=function(_0x26a389,_0x101713){var _0x479b77={'raw':!![],'where':{'id':_0x26a389[_0xc0f7('0x44')]['id']}},_0x46114c={};_0x46114c[_0xc0f7('0x2f')]=_[_0xc0f7('0x32')](db['MailSubstatus']['rawAttributes']);_0x46114c[_0xc0f7('0x31')]=_['keys'](_0x26a389[_0xc0f7('0x31')]);_0x46114c['filters']=_[_0xc0f7('0x34')](_0x46114c['model'],_0x46114c[_0xc0f7('0x31')]);_0x479b77[_0xc0f7('0x35')]=_[_0xc0f7('0x34')](_0x46114c['model'],qs[_0xc0f7('0x36')](_0x26a389[_0xc0f7('0x31')][_0xc0f7('0x36')]));_0x479b77[_0xc0f7('0x35')]=_0x479b77['attributes'][_0xc0f7('0x45')]?_0x479b77[_0xc0f7('0x35')]:_0x46114c['model'];if(_0x26a389[_0xc0f7('0x31')][_0xc0f7('0x3e')]){_0x479b77['include']=[{'all':!![]}];}_0x479b77=_[_0xc0f7('0x3d')]({},_0x479b77,_0x26a389[_0xc0f7('0x46')]);return db[_0xc0f7('0x2a')][_0xc0f7('0x47')](_0x479b77)['then'](handleEntityNotFound(_0x101713,null))['then'](respondWithResult(_0x101713,null))[_0xc0f7('0x42')](handleError(_0x101713,null));};exports[_0xc0f7('0x48')]=function(_0x1ed571,_0x175769){return db[_0xc0f7('0x2a')]['create'](_0x1ed571['body'],{})['then'](respondWithResult(_0x175769,0xc9))[_0xc0f7('0x42')](handleError(_0x175769,null));};exports['update']=function(_0x1c3d57,_0x787858){if(_0x1c3d57[_0xc0f7('0x49')]['id']){delete _0x1c3d57[_0xc0f7('0x49')]['id'];}return db[_0xc0f7('0x2a')][_0xc0f7('0x47')]({'where':{'id':_0x1c3d57[_0xc0f7('0x44')]['id']}})[_0xc0f7('0x24')](handleEntityNotFound(_0x787858,null))[_0xc0f7('0x24')](saveUpdates(_0x1c3d57[_0xc0f7('0x49')],null))[_0xc0f7('0x24')](respondWithResult(_0x787858,null))[_0xc0f7('0x42')](handleError(_0x787858,null));};exports[_0xc0f7('0x25')]=function(_0x56666c,_0x46e384){return db[_0xc0f7('0x2a')][_0xc0f7('0x47')]({'where':{'id':_0x56666c[_0xc0f7('0x44')]['id']}})['then'](handleEntityNotFound(_0x46e384,null))[_0xc0f7('0x24')](removeEntity(_0x46e384,null))[_0xc0f7('0x42')](handleError(_0x46e384,null));};exports[_0xc0f7('0x4a')]=function(_0x4149d2,_0x2804ca){return db[_0xc0f7('0x2a')][_0xc0f7('0x4a')]()[_0xc0f7('0x24')](respondWithResult(_0x2804ca,null))[_0xc0f7('0x42')](handleError(_0x2804ca,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 21bd8f0..6b5ab64 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 _0xf5d6=['mail_substatuses','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','MailSubstatus'];(function(_0x592502,_0x1148cd){var _0x4a685c=function(_0x1801eb){while(--_0x1801eb){_0x592502['push'](_0x592502['shift']());}};_0x4a685c(++_0x1148cd);}(_0xf5d6,0xc1));var _0x6f5d=function(_0x3043a7,_0x4f7643){_0x3043a7=_0x3043a7-0x0;var _0x2091c6=_0xf5d6[_0x3043a7];return _0x2091c6;};'use strict';var _=require(_0x6f5d('0x0'));var util=require(_0x6f5d('0x1'));var logger=require(_0x6f5d('0x2'))(_0x6f5d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6f5d('0x4'));var fs=require('fs');var path=require(_0x6f5d('0x5'));var rimraf=require(_0x6f5d('0x6'));var config=require(_0x6f5d('0x7'));var attributes=require('./mailSubstatus.attributes');module[_0x6f5d('0x8')]=function(_0xe5d562,_0x59dfaf){return _0xe5d562[_0x6f5d('0x9')](_0x6f5d('0xa'),attributes,{'tableName':_0x6f5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x614e=['rimraf','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xfe4a8d,_0x33d75d){var _0x1bf633=function(_0x57f0e5){while(--_0x57f0e5){_0xfe4a8d['push'](_0xfe4a8d['shift']());}};_0x1bf633(++_0x33d75d);}(_0x614e,0x10d));var _0xe614=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x614e[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xe614('0x0'));var logger=require(_0xe614('0x1'))(_0xe614('0x2'));var moment=require(_0xe614('0x3'));var BPromise=require(_0xe614('0x4'));var rp=require(_0xe614('0x5'));var fs=require('fs');var path=require(_0xe614('0x6'));var rimraf=require(_0xe614('0x7'));var config=require('../../config/environment');var attributes=require(_0xe614('0x8'));module[_0xe614('0x9')]=function(_0x432e84,_0x4265b6){return _0x432e84['define'](_0xe614('0xa'),attributes,{'tableName':_0xe614('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 3105a34..853b05f 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 _0x885f=['MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x286475,_0x28e2d8){var _0x2d439f=function(_0x396e9d){while(--_0x396e9d){_0x286475['push'](_0x286475['shift']());}};_0x2d439f(++_0x28e2d8);}(_0x885f,0xa5));var _0xf885=function(_0x216edc,_0x57df05){_0x216edc=_0x216edc-0x0;var _0x745d3e=_0x885f[_0x216edc];return _0x745d3e;};'use strict';var _=require(_0xf885('0x0'));var util=require(_0xf885('0x1'));var moment=require(_0xf885('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf885('0x3'));var db=require(_0xf885('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf885('0x5'))(_0xf885('0x6'));var config=require(_0xf885('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf885('0x8')][_0xf885('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa04e61,_0x3900ce,_0x590415){return new BPromise(function(_0x3b66a7,_0x59fb6a){return client[_0xf885('0xa')](_0xa04e61,_0x590415)[_0xf885('0xb')](function(_0x25585c){logger['info'](_0xf885('0xc'),_0x3900ce,_0xf885('0xd'));logger[_0xf885('0xe')](_0xf885('0xf'),_0x3900ce,_0xf885('0xd'),JSON['stringify'](_0x25585c));if(_0x25585c['error']){if(_0x25585c[_0xf885('0x10')]['code']===0x1f4){logger[_0xf885('0x10')](_0xf885('0xc'),_0x3900ce,_0x25585c[_0xf885('0x10')][_0xf885('0x11')]);return _0x59fb6a(_0x25585c[_0xf885('0x10')][_0xf885('0x11')]);}logger[_0xf885('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x3900ce,_0x25585c[_0xf885('0x10')]['message']);return _0x3b66a7(_0x25585c[_0xf885('0x10')][_0xf885('0x11')]);}else{logger['info'](_0xf885('0xc'),_0x3900ce,_0xf885('0xd'));_0x3b66a7(_0x25585c[_0xf885('0x12')][_0xf885('0x11')]);}})[_0xf885('0x13')](function(_0x5cf219){logger[_0xf885('0x10')](_0xf885('0xc'),_0x3900ce,_0x5cf219);_0x59fb6a(_0x5cf219);});});} \ No newline at end of file +var _0x15f8=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x5376db,_0x43e304){var _0x135021=function(_0x3d3325){while(--_0x3d3325){_0x5376db['push'](_0x5376db['shift']());}};_0x135021(++_0x43e304);}(_0x15f8,0x149));var _0x815f=function(_0x25058c,_0xd951a9){_0x25058c=_0x25058c-0x0;var _0x43c098=_0x15f8[_0x25058c];return _0x43c098;};'use strict';var _=require(_0x815f('0x0'));var util=require('util');var moment=require(_0x815f('0x1'));var BPromise=require('bluebird');var rs=require(_0x815f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x815f('0x3'))['db'];var utils=require(_0x815f('0x4'));var logger=require(_0x815f('0x5'))(_0x815f('0x6'));var config=require(_0x815f('0x7'));var jayson=require(_0x815f('0x8'));var client=jayson[_0x815f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43b91e,_0x5ae99e,_0x5af0b0){return new BPromise(function(_0x50b3a4,_0xc7861c){return client[_0x815f('0xa')](_0x43b91e,_0x5af0b0)[_0x815f('0xb')](function(_0x4cbf2f){logger['info'](_0x815f('0xc'),_0x5ae99e,_0x815f('0xd'));logger[_0x815f('0xe')](_0x815f('0xf'),_0x5ae99e,_0x815f('0xd'),JSON['stringify'](_0x4cbf2f));if(_0x4cbf2f['error']){if(_0x4cbf2f[_0x815f('0x10')][_0x815f('0x11')]===0x1f4){logger[_0x815f('0x10')](_0x815f('0xc'),_0x5ae99e,_0x4cbf2f['error'][_0x815f('0x12')]);return _0xc7861c(_0x4cbf2f[_0x815f('0x10')][_0x815f('0x12')]);}logger['error'](_0x815f('0xc'),_0x5ae99e,_0x4cbf2f[_0x815f('0x10')][_0x815f('0x12')]);return _0x50b3a4(_0x4cbf2f[_0x815f('0x10')][_0x815f('0x12')]);}else{logger[_0x815f('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x5ae99e,_0x815f('0xd'));_0x50b3a4(_0x4cbf2f[_0x815f('0x14')]['message']);}})[_0x815f('0x15')](function(_0x396be7){logger['error'](_0x815f('0xc'),_0x5ae99e,_0x396be7);_0xc7861c(_0x396be7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 4688401..d84417c 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 _0x40de=['exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','update','delete','destroy'];(function(_0x2494f5,_0x1f1d3c){var _0x5c60a4=function(_0x437901){while(--_0x437901){_0x2494f5['push'](_0x2494f5['shift']());}};_0x5c60a4(++_0x1f1d3c);}(_0x40de,0x141));var _0xe40d=function(_0x4fc9c1,_0x570e05){_0x4fc9c1=_0x4fc9c1-0x0;var _0x15d7a1=_0x40de[_0x4fc9c1];return _0x15d7a1;};'use strict';var multer=require('multer');var util=require(_0xe40d('0x0'));var path=require(_0xe40d('0x1'));var timeout=require(_0xe40d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe40d('0x3'));var auth=require(_0xe40d('0x4'));var interaction=require(_0xe40d('0x5'));var config=require(_0xe40d('0x6'));var controller=require(_0xe40d('0x7'));router[_0xe40d('0x8')]('/',auth[_0xe40d('0x9')](),controller[_0xe40d('0xa')]);router[_0xe40d('0x8')](_0xe40d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe40d('0x8')]('/:id',auth[_0xe40d('0x9')](),controller[_0xe40d('0xc')]);router[_0xe40d('0xd')]('/',auth[_0xe40d('0x9')](),controller[_0xe40d('0xe')]);router['put'](_0xe40d('0xf'),auth[_0xe40d('0x9')](),controller[_0xe40d('0x10')]);router[_0xe40d('0x11')](_0xe40d('0xf'),auth[_0xe40d('0x9')](),controller[_0xe40d('0x12')]);module[_0xe40d('0x13')]=router; \ No newline at end of file +var _0x2ef0=['create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','get','/:id','post'];(function(_0x48efc4,_0x4035c0){var _0x151c20=function(_0x53104f){while(--_0x53104f){_0x48efc4['push'](_0x48efc4['shift']());}};_0x151c20(++_0x4035c0);}(_0x2ef0,0xf0));var _0x02ef=function(_0x4cfff0,_0x4a5795){_0x4cfff0=_0x4cfff0-0x0;var _0x8dae99=_0x2ef0[_0x4cfff0];return _0x8dae99;};'use strict';var multer=require('multer');var util=require(_0x02ef('0x0'));var path=require('path');var timeout=require(_0x02ef('0x1'));var express=require('express');var router=express[_0x02ef('0x2')]();var fs_extra=require(_0x02ef('0x3'));var auth=require(_0x02ef('0x4'));var interaction=require(_0x02ef('0x5'));var config=require(_0x02ef('0x6'));var controller=require(_0x02ef('0x7'));router['get']('/',auth[_0x02ef('0x8')](),controller['index']);router[_0x02ef('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x02ef('0x9')](_0x02ef('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x02ef('0xb')]('/',auth[_0x02ef('0x8')](),controller[_0x02ef('0xc')]);router[_0x02ef('0xd')](_0x02ef('0xa'),auth[_0x02ef('0x8')](),controller[_0x02ef('0xe')]);router[_0x02ef('0xf')](_0x02ef('0xa'),auth[_0x02ef('0x8')](),controller[_0x02ef('0x10')]);module[_0x02ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 875525a..9823e7c 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4c7ad4,_0x3bcd90){var _0x26269c=function(_0xaad78d){while(--_0xaad78d){_0x4c7ad4['push'](_0x4c7ad4['shift']());}};_0x26269c(++_0x3bcd90);}(_0xaa88,0x137));var _0x8aa8=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0xaa88[_0x35e92e];return _0x1205a8;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x10f9ea,_0x13b417){var _0x5856a6=function(_0x2c0c65){while(--_0x2c0c65){_0x10f9ea['push'](_0x10f9ea['shift']());}};_0x5856a6(++_0x13b417);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0xf3cd[_0x294b6];return _0x38bb97;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d4f20c0..80be6bd 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 _0xa0fe=['nolimit','order','sort','filters','where','merge','type','VIRTUAL','filter','options','include','catch','show','params','includeAll','MailTransferReport','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length'];(function(_0x1707eb,_0x520e7e){var _0x31172f=function(_0x5297a6){while(--_0x5297a6){_0x1707eb['push'](_0x1707eb['shift']());}};_0x31172f(++_0x520e7e);}(_0xa0fe,0x16d));var _0xea0f=function(_0x2c4789,_0x4739b7){_0x2c4789=_0x2c4789-0x0;var _0x4e5b5a=_0xa0fe[_0x2c4789];return _0x4e5b5a;};'use strict';var emlformat=require(_0xea0f('0x0'));var rimraf=require(_0xea0f('0x1'));var zipdir=require(_0xea0f('0x2'));var jsonpatch=require(_0xea0f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xea0f('0x4'));var Mustache=require(_0xea0f('0x5'));var util=require(_0xea0f('0x6'));var path=require(_0xea0f('0x7'));var sox=require(_0xea0f('0x8'));var csv=require(_0xea0f('0x9'));var ejs=require(_0xea0f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea0f('0xb'));var squel=require('squel');var crypto=require(_0xea0f('0xc'));var jsforce=require(_0xea0f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea0f('0x9'));var querystring=require(_0xea0f('0xe'));var Papa=require(_0xea0f('0xf'));var Redis=require(_0xea0f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea0f('0x11'));var logger=require(_0xea0f('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xea0f('0x13'))['db'];function respondWithStatusCode(_0x382408,_0x54e31a){_0x54e31a=_0x54e31a||0xcc;return function(_0x4d1e80){if(_0x4d1e80){return _0x382408[_0xea0f('0x14')](_0x54e31a);}return _0x382408['status'](_0x54e31a)[_0xea0f('0x15')]();};}function respondWithResult(_0x5adf37,_0x10c6dc){_0x10c6dc=_0x10c6dc||0xc8;return function(_0x2eb3ac){if(_0x2eb3ac){return _0x5adf37['status'](_0x10c6dc)[_0xea0f('0x16')](_0x2eb3ac);}};}function respondWithFilteredResult(_0x138870,_0x5094b0){return function(_0x580db2){if(_0x580db2){var _0x2609a7=typeof _0x5094b0[_0xea0f('0x17')]===_0xea0f('0x18')&&typeof _0x5094b0[_0xea0f('0x19')]==='undefined';var _0x20a06e=_0x580db2[_0xea0f('0x1a')];var _0x2c56ed=_0x2609a7?0x0:_0x5094b0[_0xea0f('0x17')];var _0xeb9d4d=_0x2609a7?_0x580db2[_0xea0f('0x1a')]:_0x5094b0[_0xea0f('0x17')]+_0x5094b0['limit'];var _0x345ea0;if(_0xeb9d4d>=_0x20a06e){_0xeb9d4d=_0x20a06e;_0x345ea0=0xc8;}else{_0x345ea0=0xce;}_0x138870[_0xea0f('0x1b')](_0x345ea0);return _0x138870[_0xea0f('0x1c')]('Content-Range',_0x2c56ed+'-'+_0xeb9d4d+'/'+_0x20a06e)[_0xea0f('0x16')](_0x580db2);}return null;};}function patchUpdates(_0x5dbc38){return function(_0x1749e7){try{jsonpatch[_0xea0f('0x1d')](_0x1749e7,_0x5dbc38,!![]);}catch(_0x30b9a8){return BPromise[_0xea0f('0x1e')](_0x30b9a8);}return _0x1749e7[_0xea0f('0x1f')]();};}function saveUpdates(_0x29c9ff,_0x4a7dfa){return function(_0x22ed0d){if(_0x22ed0d){return _0x22ed0d[_0xea0f('0x20')](_0x29c9ff)[_0xea0f('0x21')](function(_0x434613){return _0x434613;});}return null;};}function removeEntity(_0x7f095d,_0x681605){return function(_0x585cd9){if(_0x585cd9){return _0x585cd9[_0xea0f('0x22')]()[_0xea0f('0x21')](function(){_0x7f095d[_0xea0f('0x1b')](0xcc)[_0xea0f('0x15')]();});}};}function handleEntityNotFound(_0x351748,_0x2b5d07){return function(_0xd3ca78){if(!_0xd3ca78){_0x351748[_0xea0f('0x14')](0x194);}return _0xd3ca78;};}function handleError(_0x468e51,_0x10580d){_0x10580d=_0x10580d||0x1f4;return function(_0x1da45e){logger['error'](_0x1da45e[_0xea0f('0x23')]);if(_0x1da45e[_0xea0f('0x24')]){delete _0x1da45e[_0xea0f('0x24')];}_0x468e51[_0xea0f('0x1b')](_0x10580d)[_0xea0f('0x25')](_0x1da45e);};}exports['index']=function(_0x3c8784,_0x15c1ea){var _0x37ab2e={},_0x2d4d5e={},_0x2b2eb7={'count':0x0,'rows':[]};var _0x4944d9=_['map'](db['MailTransferReport'][_0xea0f('0x26')],function(_0x236325){return{'name':_0x236325[_0xea0f('0x27')],'type':_0x236325['type'][_0xea0f('0x28')]};});_0x2d4d5e[_0xea0f('0x29')]=_[_0xea0f('0x2a')](_0x4944d9,_0xea0f('0x24'));_0x2d4d5e[_0xea0f('0x2b')]=_[_0xea0f('0x2c')](_0x3c8784[_0xea0f('0x2b')]);_0x2d4d5e['filters']=_[_0xea0f('0x2d')](_0x2d4d5e[_0xea0f('0x29')],_0x2d4d5e[_0xea0f('0x2b')]);_0x37ab2e[_0xea0f('0x2e')]=_[_0xea0f('0x2d')](_0x2d4d5e['model'],qs[_0xea0f('0x2f')](_0x3c8784[_0xea0f('0x2b')][_0xea0f('0x2f')]));_0x37ab2e[_0xea0f('0x2e')]=_0x37ab2e[_0xea0f('0x2e')][_0xea0f('0x30')]?_0x37ab2e['attributes']:_0x2d4d5e[_0xea0f('0x29')];if(!_0x3c8784['query']['hasOwnProperty'](_0xea0f('0x31'))){_0x37ab2e['limit']=qs[_0xea0f('0x19')](_0x3c8784['query']['limit']);_0x37ab2e['offset']=qs[_0xea0f('0x17')](_0x3c8784[_0xea0f('0x2b')][_0xea0f('0x17')]);}_0x37ab2e[_0xea0f('0x32')]=qs[_0xea0f('0x33')](_0x3c8784[_0xea0f('0x2b')][_0xea0f('0x33')]);_0x37ab2e['where']=qs[_0xea0f('0x34')](_['pick'](_0x3c8784[_0xea0f('0x2b')],_0x2d4d5e[_0xea0f('0x34')]),_0x4944d9);if(_0x3c8784[_0xea0f('0x2b')]['filter']){_0x37ab2e[_0xea0f('0x35')]=_[_0xea0f('0x36')](_0x37ab2e[_0xea0f('0x35')],{'$or':_[_0xea0f('0x2a')](_0x4944d9,function(_0x4f5405){if(_0x4f5405[_0xea0f('0x37')]!==_0xea0f('0x38')){var _0x1baf7c={};_0x1baf7c[_0x4f5405[_0xea0f('0x24')]]={'$like':'%'+_0x3c8784['query'][_0xea0f('0x39')]+'%'};return _0x1baf7c;}})});}_0x37ab2e=_[_0xea0f('0x36')]({},_0x37ab2e,_0x3c8784[_0xea0f('0x3a')]);var _0x4a3665={'where':_0x37ab2e[_0xea0f('0x35')]};return db['MailTransferReport'][_0xea0f('0x1a')](_0x4a3665)[_0xea0f('0x21')](function(_0x169f07){_0x2b2eb7[_0xea0f('0x1a')]=_0x169f07;if(_0x3c8784[_0xea0f('0x2b')]['includeAll']){_0x37ab2e[_0xea0f('0x3b')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x37ab2e);})['then'](function(_0x55890f){_0x2b2eb7['rows']=_0x55890f;return _0x2b2eb7;})[_0xea0f('0x21')](respondWithFilteredResult(_0x15c1ea,_0x37ab2e))[_0xea0f('0x3c')](handleError(_0x15c1ea,null));};exports[_0xea0f('0x3d')]=function(_0x210e5b,_0x2bdfd5){var _0x11e862={'raw':!![],'where':{'id':_0x210e5b[_0xea0f('0x3e')]['id']}},_0x5444c1={};_0x5444c1[_0xea0f('0x29')]=_['keys'](db['MailTransferReport'][_0xea0f('0x26')]);_0x5444c1[_0xea0f('0x2b')]=_['keys'](_0x210e5b[_0xea0f('0x2b')]);_0x5444c1['filters']=_[_0xea0f('0x2d')](_0x5444c1[_0xea0f('0x29')],_0x5444c1[_0xea0f('0x2b')]);_0x11e862[_0xea0f('0x2e')]=_[_0xea0f('0x2d')](_0x5444c1[_0xea0f('0x29')],qs[_0xea0f('0x2f')](_0x210e5b[_0xea0f('0x2b')][_0xea0f('0x2f')]));_0x11e862[_0xea0f('0x2e')]=_0x11e862[_0xea0f('0x2e')][_0xea0f('0x30')]?_0x11e862[_0xea0f('0x2e')]:_0x5444c1[_0xea0f('0x29')];if(_0x210e5b[_0xea0f('0x2b')][_0xea0f('0x3f')]){_0x11e862[_0xea0f('0x3b')]=[{'all':!![]}];}_0x11e862=_['merge']({},_0x11e862,_0x210e5b[_0xea0f('0x3a')]);return db[_0xea0f('0x40')][_0xea0f('0x41')](_0x11e862)[_0xea0f('0x21')](handleEntityNotFound(_0x2bdfd5,null))[_0xea0f('0x21')](respondWithResult(_0x2bdfd5,null))[_0xea0f('0x3c')](handleError(_0x2bdfd5,null));};exports[_0xea0f('0x42')]=function(_0x30a93d,_0x3474bd){return db[_0xea0f('0x40')]['create'](_0x30a93d[_0xea0f('0x43')],{})[_0xea0f('0x21')](respondWithResult(_0x3474bd,0xc9))[_0xea0f('0x3c')](handleError(_0x3474bd,null));};exports[_0xea0f('0x20')]=function(_0x595e59,_0x50025d){if(_0x595e59[_0xea0f('0x43')]['id']){delete _0x595e59[_0xea0f('0x43')]['id'];}return db[_0xea0f('0x40')][_0xea0f('0x41')]({'where':{'id':_0x595e59[_0xea0f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x50025d,null))[_0xea0f('0x21')](saveUpdates(_0x595e59[_0xea0f('0x43')],null))[_0xea0f('0x21')](respondWithResult(_0x50025d,null))[_0xea0f('0x3c')](handleError(_0x50025d,null));};exports[_0xea0f('0x22')]=function(_0x1430f0,_0x48411b){return db[_0xea0f('0x40')][_0xea0f('0x41')]({'where':{'id':_0x1430f0[_0xea0f('0x3e')]['id']}})[_0xea0f('0x21')](handleEntityNotFound(_0x48411b,null))[_0xea0f('0x21')](removeEntity(_0x48411b,null))[_0xea0f('0x3c')](handleError(_0x48411b,null));};exports[_0xea0f('0x44')]=function(_0x375973,_0x18c94d){return db[_0xea0f('0x40')][_0xea0f('0x44')]()[_0xea0f('0x21')](respondWithResult(_0x18c94d,null))[_0xea0f('0x3c')](handleError(_0x18c94d,null));}; \ No newline at end of file +var _0x0d72=['sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','MailTransferReport','includeAll','include','findAll','rows','catch','params','create','body','find','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0xb88d40,_0x53a65b){var _0x193479=function(_0x31220e){while(--_0x31220e){_0xb88d40['push'](_0xb88d40['shift']());}};_0x193479(++_0x53a65b);}(_0x0d72,0x193));var _0x20d7=function(_0x45a3f1,_0xd0a6c9){_0x45a3f1=_0x45a3f1-0x0;var _0x2534ec=_0x0d72[_0x45a3f1];return _0x2534ec;};'use strict';var emlformat=require(_0x20d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x20d7('0x2'));var BPromise=require(_0x20d7('0x3'));var Mustache=require(_0x20d7('0x4'));var util=require(_0x20d7('0x5'));var path=require(_0x20d7('0x6'));var sox=require(_0x20d7('0x7'));var csv=require(_0x20d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20d7('0x9'));var squel=require(_0x20d7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x20d7('0xb'));var toCsv=require(_0x20d7('0x8'));var querystring=require(_0x20d7('0xc'));var Papa=require(_0x20d7('0xd'));var Redis=require('ioredis');var authService=require(_0x20d7('0xe'));var qs=require(_0x20d7('0xf'));var as=require(_0x20d7('0x10'));var hardwareService=require(_0x20d7('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x20d7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x20d7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x282d14,_0x34e09c){_0x34e09c=_0x34e09c||0xcc;return function(_0x4c522b){if(_0x4c522b){return _0x282d14['sendStatus'](_0x34e09c);}return _0x282d14[_0x20d7('0x14')](_0x34e09c)['end']();};}function respondWithResult(_0x11c31e,_0x32f7c3){_0x32f7c3=_0x32f7c3||0xc8;return function(_0x10dfea){if(_0x10dfea){return _0x11c31e[_0x20d7('0x14')](_0x32f7c3)[_0x20d7('0x15')](_0x10dfea);}};}function respondWithFilteredResult(_0xfeb950,_0x14a965){return function(_0x5e7105){if(_0x5e7105){var _0x27d6e2=typeof _0x14a965[_0x20d7('0x16')]===_0x20d7('0x17')&&typeof _0x14a965[_0x20d7('0x18')]==='undefined';var _0x2366c8=_0x5e7105[_0x20d7('0x19')];var _0x35aea0=_0x27d6e2?0x0:_0x14a965[_0x20d7('0x16')];var _0x57c508=_0x27d6e2?_0x5e7105[_0x20d7('0x19')]:_0x14a965[_0x20d7('0x16')]+_0x14a965['limit'];var _0x3c781d;if(_0x57c508>=_0x2366c8){_0x57c508=_0x2366c8;_0x3c781d=0xc8;}else{_0x3c781d=0xce;}_0xfeb950[_0x20d7('0x14')](_0x3c781d);return _0xfeb950[_0x20d7('0x1a')](_0x20d7('0x1b'),_0x35aea0+'-'+_0x57c508+'/'+_0x2366c8)[_0x20d7('0x15')](_0x5e7105);}return null;};}function patchUpdates(_0x22f65d){return function(_0x23e497){try{jsonpatch[_0x20d7('0x1c')](_0x23e497,_0x22f65d,!![]);}catch(_0x41a402){return BPromise[_0x20d7('0x1d')](_0x41a402);}return _0x23e497[_0x20d7('0x1e')]();};}function saveUpdates(_0x4e9809,_0x2e9c26){return function(_0x50acfa){if(_0x50acfa){return _0x50acfa[_0x20d7('0x1f')](_0x4e9809)[_0x20d7('0x20')](function(_0x3e6bd0){return _0x3e6bd0;});}return null;};}function removeEntity(_0x3bc9b2,_0x32c379){return function(_0x44f7aa){if(_0x44f7aa){return _0x44f7aa[_0x20d7('0x21')]()[_0x20d7('0x20')](function(){_0x3bc9b2[_0x20d7('0x14')](0xcc)[_0x20d7('0x22')]();});}};}function handleEntityNotFound(_0x470d15,_0x77f5dc){return function(_0x4a2fac){if(!_0x4a2fac){_0x470d15[_0x20d7('0x23')](0x194);}return _0x4a2fac;};}function handleError(_0xaf10ce,_0x9d27f8){_0x9d27f8=_0x9d27f8||0x1f4;return function(_0x5bcf24){logger[_0x20d7('0x24')](_0x5bcf24[_0x20d7('0x25')]);if(_0x5bcf24[_0x20d7('0x26')]){delete _0x5bcf24[_0x20d7('0x26')];}_0xaf10ce['status'](_0x9d27f8)[_0x20d7('0x27')](_0x5bcf24);};}exports[_0x20d7('0x28')]=function(_0x581c39,_0x334fad){var _0x2bb8f5={},_0x1b77c9={},_0x584646={'count':0x0,'rows':[]};var _0x59de44=_[_0x20d7('0x29')](db['MailTransferReport'][_0x20d7('0x2a')],function(_0x42eae6){return{'name':_0x42eae6[_0x20d7('0x2b')],'type':_0x42eae6[_0x20d7('0x2c')]['key']};});_0x1b77c9[_0x20d7('0x2d')]=_['map'](_0x59de44,_0x20d7('0x26'));_0x1b77c9[_0x20d7('0x2e')]=_[_0x20d7('0x2f')](_0x581c39[_0x20d7('0x2e')]);_0x1b77c9[_0x20d7('0x30')]=_[_0x20d7('0x31')](_0x1b77c9[_0x20d7('0x2d')],_0x1b77c9['query']);_0x2bb8f5[_0x20d7('0x32')]=_[_0x20d7('0x31')](_0x1b77c9['model'],qs[_0x20d7('0x33')](_0x581c39['query']['fields']));_0x2bb8f5['attributes']=_0x2bb8f5[_0x20d7('0x32')][_0x20d7('0x34')]?_0x2bb8f5[_0x20d7('0x32')]:_0x1b77c9[_0x20d7('0x2d')];if(!_0x581c39[_0x20d7('0x2e')][_0x20d7('0x35')]('nolimit')){_0x2bb8f5[_0x20d7('0x18')]=qs['limit'](_0x581c39[_0x20d7('0x2e')][_0x20d7('0x18')]);_0x2bb8f5['offset']=qs['offset'](_0x581c39[_0x20d7('0x2e')][_0x20d7('0x16')]);}_0x2bb8f5[_0x20d7('0x36')]=qs[_0x20d7('0x37')](_0x581c39['query'][_0x20d7('0x37')]);_0x2bb8f5['where']=qs['filters'](_[_0x20d7('0x38')](_0x581c39[_0x20d7('0x2e')],_0x1b77c9[_0x20d7('0x30')]),_0x59de44);if(_0x581c39[_0x20d7('0x2e')]['filter']){_0x2bb8f5[_0x20d7('0x39')]=_[_0x20d7('0x3a')](_0x2bb8f5[_0x20d7('0x39')],{'$or':_['map'](_0x59de44,function(_0x488423){if(_0x488423['type']!==_0x20d7('0x3b')){var _0x3dd0dc={};_0x3dd0dc[_0x488423[_0x20d7('0x26')]]={'$like':'%'+_0x581c39[_0x20d7('0x2e')][_0x20d7('0x3c')]+'%'};return _0x3dd0dc;}})});}_0x2bb8f5=_[_0x20d7('0x3a')]({},_0x2bb8f5,_0x581c39[_0x20d7('0x3d')]);var _0xeb3465={'where':_0x2bb8f5['where']};return db[_0x20d7('0x3e')][_0x20d7('0x19')](_0xeb3465)[_0x20d7('0x20')](function(_0x12f6bb){_0x584646[_0x20d7('0x19')]=_0x12f6bb;if(_0x581c39[_0x20d7('0x2e')][_0x20d7('0x3f')]){_0x2bb8f5[_0x20d7('0x40')]=[{'all':!![]}];}return db[_0x20d7('0x3e')][_0x20d7('0x41')](_0x2bb8f5);})['then'](function(_0x536956){_0x584646[_0x20d7('0x42')]=_0x536956;return _0x584646;})[_0x20d7('0x20')](respondWithFilteredResult(_0x334fad,_0x2bb8f5))[_0x20d7('0x43')](handleError(_0x334fad,null));};exports['show']=function(_0x3b7b11,_0x26574e){var _0x1081a7={'raw':!![],'where':{'id':_0x3b7b11[_0x20d7('0x44')]['id']}},_0x290c57={};_0x290c57[_0x20d7('0x2d')]=_[_0x20d7('0x2f')](db[_0x20d7('0x3e')][_0x20d7('0x2a')]);_0x290c57['query']=_[_0x20d7('0x2f')](_0x3b7b11[_0x20d7('0x2e')]);_0x290c57[_0x20d7('0x30')]=_['intersection'](_0x290c57[_0x20d7('0x2d')],_0x290c57[_0x20d7('0x2e')]);_0x1081a7[_0x20d7('0x32')]=_['intersection'](_0x290c57['model'],qs[_0x20d7('0x33')](_0x3b7b11[_0x20d7('0x2e')][_0x20d7('0x33')]));_0x1081a7[_0x20d7('0x32')]=_0x1081a7[_0x20d7('0x32')][_0x20d7('0x34')]?_0x1081a7['attributes']:_0x290c57['model'];if(_0x3b7b11[_0x20d7('0x2e')]['includeAll']){_0x1081a7[_0x20d7('0x40')]=[{'all':!![]}];}_0x1081a7=_[_0x20d7('0x3a')]({},_0x1081a7,_0x3b7b11[_0x20d7('0x3d')]);return db[_0x20d7('0x3e')]['find'](_0x1081a7)['then'](handleEntityNotFound(_0x26574e,null))[_0x20d7('0x20')](respondWithResult(_0x26574e,null))[_0x20d7('0x43')](handleError(_0x26574e,null));};exports[_0x20d7('0x45')]=function(_0x10a105,_0x16c248){return db[_0x20d7('0x3e')][_0x20d7('0x45')](_0x10a105[_0x20d7('0x46')],{})['then'](respondWithResult(_0x16c248,0xc9))[_0x20d7('0x43')](handleError(_0x16c248,null));};exports[_0x20d7('0x1f')]=function(_0x1e16ae,_0x3de7fd){if(_0x1e16ae[_0x20d7('0x46')]['id']){delete _0x1e16ae[_0x20d7('0x46')]['id'];}return db[_0x20d7('0x3e')][_0x20d7('0x47')]({'where':{'id':_0x1e16ae['params']['id']}})[_0x20d7('0x20')](handleEntityNotFound(_0x3de7fd,null))['then'](saveUpdates(_0x1e16ae['body'],null))[_0x20d7('0x20')](respondWithResult(_0x3de7fd,null))['catch'](handleError(_0x3de7fd,null));};exports['destroy']=function(_0x108b6d,_0x1a80ec){return db[_0x20d7('0x3e')]['find']({'where':{'id':_0x108b6d['params']['id']}})[_0x20d7('0x20')](handleEntityNotFound(_0x1a80ec,null))[_0x20d7('0x20')](removeEntity(_0x1a80ec,null))['catch'](handleError(_0x1a80ec,null));};exports[_0x20d7('0x48')]=function(_0x12c9ec,_0x45f398){return db[_0x20d7('0x3e')][_0x20d7('0x48')]()[_0x20d7('0x20')](respondWithResult(_0x45f398,null))['catch'](handleError(_0x45f398,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index aeee096..19b6ac6 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 _0x09f4=['uniqueid','util','../../config/logger','moment','bluebird','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x5d3e18,_0x4c8524){var _0x1b04d1=function(_0x4b1a94){while(--_0x4b1a94){_0x5d3e18['push'](_0x5d3e18['shift']());}};_0x1b04d1(++_0x4c8524);}(_0x09f4,0x1a5));var _0x409f=function(_0x2815,_0x5f3c49){_0x2815=_0x2815-0x0;var _0x42d012=_0x09f4[_0x2815];return _0x42d012;};'use strict';var _=require('lodash');var util=require(_0x409f('0x0'));var logger=require(_0x409f('0x1'))('api');var moment=require(_0x409f('0x2'));var BPromise=require(_0x409f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x409f('0x4'));var rimraf=require(_0x409f('0x5'));var config=require('../../config/environment');var attributes=require(_0x409f('0x6'));module[_0x409f('0x7')]=function(_0x96907f,_0x44d4d1){return _0x96907f[_0x409f('0x8')](_0x409f('0x9'),attributes,{'tableName':_0x409f('0xa'),'paranoid':![],'indexes':[{'name':_0x409f('0xb'),'fields':[_0x409f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d6d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x26dfca,_0x131ede){var _0x42da68=function(_0x5f0d3a){while(--_0x5f0d3a){_0x26dfca['push'](_0x26dfca['shift']());}};_0x42da68(++_0x131ede);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x3d6d[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var logger=require(_0xd3d6('0x2'))(_0xd3d6('0x3'));var moment=require(_0xd3d6('0x4'));var BPromise=require(_0xd3d6('0x5'));var rp=require(_0xd3d6('0x6'));var fs=require('fs');var path=require(_0xd3d6('0x7'));var rimraf=require(_0xd3d6('0x8'));var config=require(_0xd3d6('0x9'));var attributes=require(_0xd3d6('0xa'));module['exports']=function(_0x5400f8,_0x3f36){return _0x5400f8[_0xd3d6('0xb')](_0xd3d6('0xc'),attributes,{'tableName':_0xd3d6('0xd'),'paranoid':![],'indexes':[{'name':_0xd3d6('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 1993c79..cbd770a 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 _0x84fe=['code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x721496,_0x42db3c){var _0x148862=function(_0xf3213d){while(--_0xf3213d){_0x721496['push'](_0x721496['shift']());}};_0x148862(++_0x42db3c);}(_0x84fe,0xb8));var _0xe84f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84fe[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe84f('0x0'));var moment=require(_0xe84f('0x1'));var BPromise=require('bluebird');var rs=require(_0xe84f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe84f('0x3'))['db'];var utils=require(_0xe84f('0x4'));var logger=require(_0xe84f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe84f('0x6'));var client=jayson[_0xe84f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x518f2b,_0x155ff7,_0x29d3b6){return new BPromise(function(_0x1fe40a,_0x8d97ce){return client['request'](_0x518f2b,_0x29d3b6)[_0xe84f('0x8')](function(_0xbf9c3b){logger[_0xe84f('0x9')](_0xe84f('0xa'),_0x155ff7,_0xe84f('0xb'));logger[_0xe84f('0xc')](_0xe84f('0xd'),_0x155ff7,'request\x20sent',JSON[_0xe84f('0xe')](_0xbf9c3b));if(_0xbf9c3b[_0xe84f('0xf')]){if(_0xbf9c3b[_0xe84f('0xf')][_0xe84f('0x10')]===0x1f4){logger[_0xe84f('0xf')](_0xe84f('0xa'),_0x155ff7,_0xbf9c3b[_0xe84f('0xf')]['message']);return _0x8d97ce(_0xbf9c3b['error']['message']);}logger['error'](_0xe84f('0xa'),_0x155ff7,_0xbf9c3b[_0xe84f('0xf')][_0xe84f('0x11')]);return _0x1fe40a(_0xbf9c3b[_0xe84f('0xf')][_0xe84f('0x11')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x155ff7,_0xe84f('0xb'));_0x1fe40a(_0xbf9c3b[_0xe84f('0x12')]['message']);}})[_0xe84f('0x13')](function(_0x51280a){logger[_0xe84f('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x155ff7,_0x51280a);_0x8d97ce(_0x51280a);});});} \ No newline at end of file +var _0x7df4=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x7df4,0x1de));var _0x47df=function(_0x1d0e9b,_0x4e9fc1){_0x1d0e9b=_0x1d0e9b-0x0;var _0x22c87e=_0x7df4[_0x1d0e9b];return _0x22c87e;};'use strict';var _=require(_0x47df('0x0'));var util=require(_0x47df('0x1'));var moment=require(_0x47df('0x2'));var BPromise=require(_0x47df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47df('0x4'));var db=require(_0x47df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47df('0x6'))('rpc');var config=require(_0x47df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x47df('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c0db4,_0xba8627,_0x35c4f6){return new BPromise(function(_0x49c5fd,_0x398cbc){return client[_0x47df('0x9')](_0x5c0db4,_0x35c4f6)['then'](function(_0x2a2eb3){logger[_0x47df('0xa')](_0x47df('0xb'),_0xba8627,_0x47df('0xc'));logger[_0x47df('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xba8627,'request\x20sent',JSON[_0x47df('0xe')](_0x2a2eb3));if(_0x2a2eb3[_0x47df('0xf')]){if(_0x2a2eb3[_0x47df('0xf')][_0x47df('0x10')]===0x1f4){logger[_0x47df('0xf')](_0x47df('0xb'),_0xba8627,_0x2a2eb3[_0x47df('0xf')][_0x47df('0x11')]);return _0x398cbc(_0x2a2eb3['error'][_0x47df('0x11')]);}logger[_0x47df('0xf')]('MailTransferReport,\x20%s,\x20%s',_0xba8627,_0x2a2eb3[_0x47df('0xf')][_0x47df('0x11')]);return _0x49c5fd(_0x2a2eb3['error'][_0x47df('0x11')]);}else{logger['info'](_0x47df('0xb'),_0xba8627,_0x47df('0xc'));_0x49c5fd(_0x2a2eb3[_0x47df('0x12')][_0x47df('0x11')]);}})[_0x47df('0x13')](function(_0xdc3db1){logger['error'](_0x47df('0xb'),_0xba8627,_0xdc3db1);_0x398cbc(_0xdc3db1);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0e8d078..c55b82c 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 _0xf944=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer'];(function(_0x46193d,_0x44672d){var _0x4ced28=function(_0x215f8b){while(--_0x215f8b){_0x46193d['push'](_0x46193d['shift']());}};_0x4ced28(++_0x44672d);}(_0xf944,0x1af));var _0x4f94=function(_0x51b07e,_0x719561){_0x51b07e=_0x51b07e-0x0;var _0x466a04=_0xf944[_0x51b07e];return _0x466a04;};'use strict';var multer=require(_0x4f94('0x0'));var util=require(_0x4f94('0x1'));var path=require(_0x4f94('0x2'));var timeout=require(_0x4f94('0x3'));var express=require('express');var router=express[_0x4f94('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4f94('0x5'));var interaction=require(_0x4f94('0x6'));var config=require(_0x4f94('0x7'));var controller=require('./memberReport.controller');router[_0x4f94('0x8')]('/',auth[_0x4f94('0x9')](),controller[_0x4f94('0xa')]);router[_0x4f94('0x8')]('/describe',auth[_0x4f94('0x9')](),controller['describe']);router['get'](_0x4f94('0xb'),auth[_0x4f94('0x9')](),controller[_0x4f94('0xc')]);router['post']('/',auth[_0x4f94('0x9')](),controller[_0x4f94('0xd')]);router[_0x4f94('0xe')](_0x4f94('0xb'),auth[_0x4f94('0x9')](),controller[_0x4f94('0xf')]);router[_0x4f94('0x10')](_0x4f94('0xb'),auth[_0x4f94('0x9')](),controller[_0x4f94('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3139=['create','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','describe','/:id','post'];(function(_0x4f6c8c,_0x287dd3){var _0x48d510=function(_0x2bfdd7){while(--_0x2bfdd7){_0x4f6c8c['push'](_0x4f6c8c['shift']());}};_0x48d510(++_0x287dd3);}(_0x3139,0x88));var _0x9313=function(_0xc4bd9d,_0x33852c){_0xc4bd9d=_0xc4bd9d-0x0;var _0x103569=_0x3139[_0xc4bd9d];return _0x103569;};'use strict';var multer=require(_0x9313('0x0'));var util=require(_0x9313('0x1'));var path=require(_0x9313('0x2'));var timeout=require(_0x9313('0x3'));var express=require(_0x9313('0x4'));var router=express['Router']();var fs_extra=require(_0x9313('0x5'));var auth=require(_0x9313('0x6'));var interaction=require(_0x9313('0x7'));var config=require(_0x9313('0x8'));var controller=require(_0x9313('0x9'));router['get']('/',auth[_0x9313('0xa')](),controller[_0x9313('0xb')]);router[_0x9313('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x9313('0xd')]);router[_0x9313('0xc')](_0x9313('0xe'),auth[_0x9313('0xa')](),controller['show']);router[_0x9313('0xf')]('/',auth['isAuthenticated'](),controller[_0x9313('0x10')]);router['put'](_0x9313('0xe'),auth[_0x9313('0xa')](),controller['update']);router['delete'](_0x9313('0xe'),auth[_0x9313('0xa')](),controller[_0x9313('0x11')]);module[_0x9313('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 5e7a37a..71dbf80 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 _0xd845=['DATE','getDataValue','seconds','setDataValue','duration','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x14f61c,_0x46d9e3){var _0x589bcb=function(_0x5ba919){while(--_0x5ba919){_0x14f61c['push'](_0x14f61c['shift']());}};_0x589bcb(++_0x46d9e3);}(_0xd845,0x135));var _0x5d84=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xd845[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x5d84('0x0'));var moment=require(_0x5d84('0x1'));module[_0x5d84('0x2')]={'channel':{'type':Sequelize[_0x5d84('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5d84('0x3')]},'type':{'type':Sequelize[_0x5d84('0x3')],'defaultValue':_0x5d84('0x4'),'comment':_0x5d84('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5d84('0x6')]},'exitAt':{'type':Sequelize[_0x5d84('0x6')],'set':function(_0x3e48e4){var _0x41ab60=moment(_0x3e48e4);var _0x1712cb=moment(this[_0x5d84('0x7')]('enterAt'));var _0x135c45=_0x41ab60['diff'](_0x1712cb,_0x5d84('0x8'));this[_0x5d84('0x9')]('exitAt',_0x3e48e4);this[_0x5d84('0x9')](_0x5d84('0xa'),_0x135c45||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x5d84('0x3')],'comment':_0x5d84('0xb')},'data3':{'type':Sequelize[_0x5d84('0x3')],'comment':_0x5d84('0xc')},'data4':{'type':Sequelize[_0x5d84('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x5d84('0x3')],'comment':_0x5d84('0xd')},'role':{'type':Sequelize[_0x5d84('0x3')]},'internal':{'type':Sequelize[_0x5d84('0xe')]},'uniqueid':{'type':Sequelize[_0x5d84('0x3')]}}; \ No newline at end of file +var _0x96a2=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','exports','STRING'];(function(_0x154204,_0x555ebf){var _0x14d0bc=function(_0x8af7f2){while(--_0x8af7f2){_0x154204['push'](_0x154204['shift']());}};_0x14d0bc(++_0x555ebf);}(_0x96a2,0x96));var _0x296a=function(_0x2ce3c8,_0x511a98){_0x2ce3c8=_0x2ce3c8-0x0;var _0x434e9e=_0x96a2[_0x2ce3c8];return _0x434e9e;};'use strict';var Sequelize=require(_0x296a('0x0'));var moment=require('moment');module[_0x296a('0x1')]={'channel':{'type':Sequelize[_0x296a('0x2')]},'membername':{'type':Sequelize[_0x296a('0x2')]},'interface':{'type':Sequelize[_0x296a('0x2')]},'type':{'type':Sequelize[_0x296a('0x2')],'defaultValue':_0x296a('0x3'),'comment':_0x296a('0x4')},'duration':{'type':Sequelize[_0x296a('0x5')]},'enterAt':{'type':Sequelize[_0x296a('0x6')]},'exitAt':{'type':Sequelize[_0x296a('0x6')],'set':function(_0x285be8){var _0x31bb42=moment(_0x285be8);var _0x4eb919=moment(this[_0x296a('0x7')](_0x296a('0x8')));var _0x3a2b44=_0x31bb42[_0x296a('0x9')](_0x4eb919,_0x296a('0xa'));this['setDataValue'](_0x296a('0xb'),_0x285be8);this[_0x296a('0xc')]('duration',_0x3a2b44||null);}},'data1':{'type':Sequelize[_0x296a('0x2')],'comment':_0x296a('0xd')},'data2':{'type':Sequelize[_0x296a('0x2')],'comment':_0x296a('0xe')},'data3':{'type':Sequelize[_0x296a('0x2')],'comment':_0x296a('0xf')},'data4':{'type':Sequelize[_0x296a('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x296a('0x2')],'comment':_0x296a('0x10')},'role':{'type':Sequelize[_0x296a('0x2')]},'internal':{'type':Sequelize[_0x296a('0x5')]},'uniqueid':{'type':Sequelize[_0x296a('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 5cad936..2ca7d4b 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x1fb250,_0x238363){var _0xeb3576=function(_0x1a50dd){while(--_0x1a50dd){_0x1fb250['push'](_0x1fb250['shift']());}};_0xeb3576(++_0x238363);}(_0x3e74,0x175));var _0x43e7=function(_0x324b76,_0xa128b6){_0x324b76=_0x324b76-0x0;var _0x38f254=_0x3e74[_0x324b76];return _0x38f254;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x6317d6,_0x424384){var _0x5add4d=function(_0x176118){while(--_0x176118){_0x6317d6['push'](_0x6317d6['shift']());}};_0x5add4d(++_0x424384);}(_0x3e74,0x175));var _0x43e7=function(_0x41d231,_0x14cb07){_0x41d231=_0x41d231-0x0;var _0x3c0136=_0x3e74[_0x41d231];return _0x3c0136;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 38390f1..8bb239f 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 _0x63f2=['bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment'];(function(_0x102ad5,_0x4b8ad9){var _0x272a6d=function(_0x4aebe4){while(--_0x4aebe4){_0x102ad5['push'](_0x102ad5['shift']());}};_0x272a6d(++_0x4b8ad9);}(_0x63f2,0x19b));var _0x263f=function(_0x59c6af,_0xf439b5){_0x59c6af=_0x59c6af-0x0;var _0x356dc4=_0x63f2[_0x59c6af];return _0x356dc4;};'use strict';var _=require(_0x263f('0x0'));var util=require(_0x263f('0x1'));var logger=require(_0x263f('0x2'))(_0x263f('0x3'));var moment=require(_0x263f('0x4'));var BPromise=require(_0x263f('0x5'));var rp=require(_0x263f('0x6'));var fs=require('fs');var path=require(_0x263f('0x7'));var rimraf=require(_0x263f('0x8'));var config=require('../../config/environment');var attributes=require(_0x263f('0x9'));module[_0x263f('0xa')]=function(_0x4c13d7,_0x4551c2){return _0x4c13d7[_0x263f('0xb')](_0x263f('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x263f('0xd'),'fields':[_0x263f('0xe'),_0x263f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa87e=['membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface'];(function(_0x4e54c4,_0x3e1eda){var _0x1b4745=function(_0x3369e4){while(--_0x3369e4){_0x4e54c4['push'](_0x4e54c4['shift']());}};_0x1b4745(++_0x3e1eda);}(_0xa87e,0x1c2));var _0xea87=function(_0xe3a3eb,_0x2a121c){_0xe3a3eb=_0xe3a3eb-0x0;var _0x527657=_0xa87e[_0xe3a3eb];return _0x527657;};'use strict';var _=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var logger=require(_0xea87('0x2'))(_0xea87('0x3'));var moment=require('moment');var BPromise=require(_0xea87('0x4'));var rp=require(_0xea87('0x5'));var fs=require('fs');var path=require(_0xea87('0x6'));var rimraf=require('rimraf');var config=require(_0xea87('0x7'));var attributes=require(_0xea87('0x8'));module[_0xea87('0x9')]=function(_0x33f15b,_0x5ea863){return _0x33f15b[_0xea87('0xa')](_0xea87('0xb'),attributes,{'tableName':_0xea87('0xc'),'paranoid':![],'indexes':[{'name':_0xea87('0xd'),'fields':[_0xea87('0xe'),_0xea87('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4c49d3e..ea7bad0 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 _0xb0e5=['model','CreateMemberReport','MemberReport','create','body','raw','UpdateMemberReport','update','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetMemberReport','findAll','options','attributes','include','map'];(function(_0x20f52e,_0x596d5e){var _0x1489ca=function(_0x550038){while(--_0x550038){_0x20f52e['push'](_0x20f52e['shift']());}};_0x1489ca(++_0x596d5e);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0x264c84,_0x598700){_0x264c84=_0x264c84-0x0;var _0x1fd84c=_0xb0e5[_0x264c84];return _0x1fd84c;};'use strict';var _=require(_0x5b0e('0x0'));var util=require(_0x5b0e('0x1'));var moment=require(_0x5b0e('0x2'));var BPromise=require(_0x5b0e('0x3'));var rs=require(_0x5b0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b0e('0x5'));var logger=require('../../config/logger')(_0x5b0e('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b0e('0x7'));var client=jayson[_0x5b0e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x598ede,_0xbed2ff,_0x1bf5d0){return new BPromise(function(_0x2e7503,_0xb3ec8d){return client[_0x5b0e('0x9')](_0x598ede,_0x1bf5d0)[_0x5b0e('0xa')](function(_0x1aa61c){logger[_0x5b0e('0xb')](_0x5b0e('0xc'),_0xbed2ff,'request\x20sent');logger[_0x5b0e('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0xbed2ff,'request\x20sent',JSON[_0x5b0e('0xe')](_0x1aa61c));if(_0x1aa61c[_0x5b0e('0xf')]){if(_0x1aa61c[_0x5b0e('0xf')]['code']===0x1f4){logger[_0x5b0e('0xf')]('MemberReport,\x20%s,\x20%s',_0xbed2ff,_0x1aa61c['error'][_0x5b0e('0x10')]);return _0xb3ec8d(_0x1aa61c[_0x5b0e('0xf')][_0x5b0e('0x10')]);}logger[_0x5b0e('0xf')](_0x5b0e('0xc'),_0xbed2ff,_0x1aa61c[_0x5b0e('0xf')][_0x5b0e('0x10')]);return _0x2e7503(_0x1aa61c[_0x5b0e('0xf')][_0x5b0e('0x10')]);}else{logger[_0x5b0e('0xb')](_0x5b0e('0xc'),_0xbed2ff,_0x5b0e('0x11'));_0x2e7503(_0x1aa61c[_0x5b0e('0x12')][_0x5b0e('0x10')]);}})[_0x5b0e('0x13')](function(_0x133f39){logger[_0x5b0e('0xf')](_0x5b0e('0xc'),_0xbed2ff,_0x133f39);_0xb3ec8d(_0x133f39);});});}exports[_0x5b0e('0x14')]=function(_0x3c876a){var _0x295714=this;return new Promise(function(_0x17ac8f,_0x4c769a){return db['MemberReport'][_0x5b0e('0x15')]({'raw':_0x3c876a[_0x5b0e('0x16')]?_0x3c876a[_0x5b0e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3c876a['options']?_0x3c876a[_0x5b0e('0x16')]['where']||null:null,'attributes':_0x3c876a[_0x5b0e('0x16')]?_0x3c876a[_0x5b0e('0x16')][_0x5b0e('0x17')]||null:null,'limit':_0x3c876a[_0x5b0e('0x16')]?_0x3c876a['options']['limit']||null:null,'include':_0x3c876a['options']?_0x3c876a['options'][_0x5b0e('0x18')]?_[_0x5b0e('0x19')](_0x3c876a[_0x5b0e('0x16')][_0x5b0e('0x18')],function(_0x80c8f9){return{'model':db[_0x80c8f9['model']],'as':_0x80c8f9['as'],'attributes':_0x80c8f9[_0x5b0e('0x17')],'include':_0x80c8f9['include']?_[_0x5b0e('0x19')](_0x80c8f9[_0x5b0e('0x18')],function(_0x22f0fd){return{'model':db[_0x22f0fd[_0x5b0e('0x1a')]],'as':_0x22f0fd['as'],'attributes':_0x22f0fd[_0x5b0e('0x17')],'include':_0x22f0fd[_0x5b0e('0x18')]?_[_0x5b0e('0x19')](_0x22f0fd[_0x5b0e('0x18')],function(_0x3b9321){return{'model':db[_0x3b9321[_0x5b0e('0x1a')]],'as':_0x3b9321['as'],'attributes':_0x3b9321[_0x5b0e('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5b0e('0xa')](function(_0x2f8137){logger[_0x5b0e('0xb')](_0x5b0e('0x14'),_0x3c876a);logger[_0x5b0e('0xd')](_0x5b0e('0x14'),_0x3c876a,JSON[_0x5b0e('0xe')](_0x2f8137));_0x17ac8f(_0x2f8137);})[_0x5b0e('0x13')](function(_0x333786){logger['error'](_0x5b0e('0x14'),_0x333786[_0x5b0e('0x10')],_0x3c876a);_0x4c769a(_0x295714[_0x5b0e('0xf')](0x1f4,_0x333786[_0x5b0e('0x10')]));});});};exports[_0x5b0e('0x1b')]=function(_0x4d4a5f){var _0xb4e34d=this;return new Promise(function(_0x425456,_0x3e8acb){return db[_0x5b0e('0x1c')][_0x5b0e('0x1d')](_0x4d4a5f[_0x5b0e('0x1e')],{'raw':_0x4d4a5f[_0x5b0e('0x16')]?_0x4d4a5f['options'][_0x5b0e('0x1f')]===undefined?!![]:![]:!![]})[_0x5b0e('0xa')](function(_0x5b6da2){logger[_0x5b0e('0xb')](_0x5b0e('0x1b'),_0x4d4a5f);logger[_0x5b0e('0xd')](_0x5b0e('0x1b'),_0x4d4a5f,JSON[_0x5b0e('0xe')](_0x5b6da2));_0x425456(_0x5b6da2);})[_0x5b0e('0x13')](function(_0x3854b2){logger[_0x5b0e('0xf')](_0x5b0e('0x1b'),_0x3854b2[_0x5b0e('0x10')],_0x4d4a5f);_0x3e8acb(_0xb4e34d[_0x5b0e('0xf')](0x1f4,_0x3854b2['message']));});});};exports[_0x5b0e('0x20')]=function(_0xf1eed9){var _0x39719e=this;return new Promise(function(_0x3d04ce,_0x5ce2e6){return db[_0x5b0e('0x1c')][_0x5b0e('0x21')](_0xf1eed9[_0x5b0e('0x1e')],{'raw':_0xf1eed9[_0x5b0e('0x16')]?_0xf1eed9[_0x5b0e('0x16')][_0x5b0e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1eed9['options']?_0xf1eed9[_0x5b0e('0x16')]['where']||null:null,'attributes':_0xf1eed9[_0x5b0e('0x16')]?_0xf1eed9[_0x5b0e('0x16')]['attributes']||null:null,'limit':_0xf1eed9[_0x5b0e('0x16')]?_0xf1eed9[_0x5b0e('0x16')][_0x5b0e('0x22')]||null:null})[_0x5b0e('0xa')](function(_0x545add){logger[_0x5b0e('0xb')](_0x5b0e('0x20'),_0xf1eed9);logger[_0x5b0e('0xd')](_0x5b0e('0x20'),_0xf1eed9,JSON[_0x5b0e('0xe')](_0x545add));_0x3d04ce(_0x545add);})[_0x5b0e('0x13')](function(_0x3b914a){logger['error'](_0x5b0e('0x20'),_0x3b914a['message'],_0xf1eed9);_0x5ce2e6(_0x39719e[_0x5b0e('0xf')](0x1f4,_0x3b914a[_0x5b0e('0x10')]));});});}; \ No newline at end of file +var _0x4ce6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','map','model','include','catch','CreateMemberReport','create','raw','UpdateMemberReport','update','debug','lodash','moment'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x4ce6,0x108));var _0x64ce=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x4ce6[_0x4347ec];return _0x4c8314;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var moment=require(_0x64ce('0x1'));var BPromise=require(_0x64ce('0x2'));var rs=require(_0x64ce('0x3'));var fs=require('fs');var Redis=require(_0x64ce('0x4'));var db=require(_0x64ce('0x5'))['db'];var utils=require(_0x64ce('0x6'));var logger=require('../../config/logger')(_0x64ce('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64ce('0x8')][_0x64ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b8f2d,_0x538b74,_0x3c279f){return new BPromise(function(_0x134230,_0x1b253e){return client[_0x64ce('0xa')](_0x5b8f2d,_0x3c279f)[_0x64ce('0xb')](function(_0x135482){logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));logger['debug'](_0x64ce('0xf'),_0x538b74,_0x64ce('0xe'),JSON[_0x64ce('0x10')](_0x135482));if(_0x135482[_0x64ce('0x11')]){if(_0x135482[_0x64ce('0x11')][_0x64ce('0x12')]===0x1f4){logger[_0x64ce('0x11')](_0x64ce('0xd'),_0x538b74,_0x135482['error'][_0x64ce('0x13')]);return _0x1b253e(_0x135482['error']['message']);}logger[_0x64ce('0x11')]('MemberReport,\x20%s,\x20%s',_0x538b74,_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);return _0x134230(_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);}else{logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));_0x134230(_0x135482[_0x64ce('0x14')][_0x64ce('0x13')]);}})['catch'](function(_0x4b49be){logger['error'](_0x64ce('0xd'),_0x538b74,_0x4b49be);_0x1b253e(_0x4b49be);});});}exports[_0x64ce('0x15')]=function(_0x1f6fd4){var _0x9cb092=this;return new Promise(function(_0x38d441,_0x3742c0){return db[_0x64ce('0x16')][_0x64ce('0x17')]({'raw':_0x1f6fd4[_0x64ce('0x18')]?_0x1f6fd4[_0x64ce('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1f6fd4['options']?_0x1f6fd4[_0x64ce('0x18')][_0x64ce('0x19')]||null:null,'attributes':_0x1f6fd4['options']?_0x1f6fd4[_0x64ce('0x18')][_0x64ce('0x1a')]||null:null,'limit':_0x1f6fd4[_0x64ce('0x18')]?_0x1f6fd4[_0x64ce('0x18')][_0x64ce('0x1b')]||null:null,'include':_0x1f6fd4[_0x64ce('0x18')]?_0x1f6fd4[_0x64ce('0x18')]['include']?_[_0x64ce('0x1c')](_0x1f6fd4[_0x64ce('0x18')]['include'],function(_0x1aec1f){return{'model':db[_0x1aec1f[_0x64ce('0x1d')]],'as':_0x1aec1f['as'],'attributes':_0x1aec1f['attributes'],'include':_0x1aec1f[_0x64ce('0x1e')]?_[_0x64ce('0x1c')](_0x1aec1f[_0x64ce('0x1e')],function(_0x33feb3){return{'model':db[_0x33feb3[_0x64ce('0x1d')]],'as':_0x33feb3['as'],'attributes':_0x33feb3[_0x64ce('0x1a')],'include':_0x33feb3['include']?_[_0x64ce('0x1c')](_0x33feb3[_0x64ce('0x1e')],function(_0x5415de){return{'model':db[_0x5415de[_0x64ce('0x1d')]],'as':_0x5415de['as'],'attributes':_0x5415de[_0x64ce('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34957c){logger[_0x64ce('0xc')](_0x64ce('0x15'),_0x1f6fd4);logger['debug'](_0x64ce('0x15'),_0x1f6fd4,JSON[_0x64ce('0x10')](_0x34957c));_0x38d441(_0x34957c);})[_0x64ce('0x1f')](function(_0x3e7a52){logger[_0x64ce('0x11')](_0x64ce('0x15'),_0x3e7a52[_0x64ce('0x13')],_0x1f6fd4);_0x3742c0(_0x9cb092[_0x64ce('0x11')](0x1f4,_0x3e7a52[_0x64ce('0x13')]));});});};exports[_0x64ce('0x20')]=function(_0x30d688){var _0xba6e8b=this;return new Promise(function(_0x531378,_0x14c100){return db['MemberReport'][_0x64ce('0x21')](_0x30d688['body'],{'raw':_0x30d688[_0x64ce('0x18')]?_0x30d688['options'][_0x64ce('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x563407){logger['info'](_0x64ce('0x20'),_0x30d688);logger['debug']('CreateMemberReport',_0x30d688,JSON[_0x64ce('0x10')](_0x563407));_0x531378(_0x563407);})[_0x64ce('0x1f')](function(_0x1e8ea8){logger[_0x64ce('0x11')](_0x64ce('0x20'),_0x1e8ea8['message'],_0x30d688);_0x14c100(_0xba6e8b[_0x64ce('0x11')](0x1f4,_0x1e8ea8[_0x64ce('0x13')]));});});};exports[_0x64ce('0x23')]=function(_0x3a0448){var _0x3a2389=this;return new Promise(function(_0x505db6,_0x3b9d90){return db[_0x64ce('0x16')][_0x64ce('0x24')](_0x3a0448['body'],{'raw':_0x3a0448[_0x64ce('0x18')]?_0x3a0448[_0x64ce('0x18')][_0x64ce('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a0448[_0x64ce('0x18')]?_0x3a0448[_0x64ce('0x18')][_0x64ce('0x19')]||null:null,'attributes':_0x3a0448[_0x64ce('0x18')]?_0x3a0448[_0x64ce('0x18')]['attributes']||null:null,'limit':_0x3a0448[_0x64ce('0x18')]?_0x3a0448['options']['limit']||null:null})[_0x64ce('0xb')](function(_0x4e8d70){logger[_0x64ce('0xc')](_0x64ce('0x23'),_0x3a0448);logger[_0x64ce('0x25')]('UpdateMemberReport',_0x3a0448,JSON[_0x64ce('0x10')](_0x4e8d70));_0x505db6(_0x4e8d70);})[_0x64ce('0x1f')](function(_0x5dd007){logger[_0x64ce('0x11')]('UpdateMemberReport',_0x5dd007[_0x64ce('0x13')],_0x3a0448);_0x3b9d90(_0x3a2389[_0x64ce('0x11')](0x1f4,_0x5dd007[_0x64ce('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c9e04df..41bc0d6 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 _0xbe3b=['./migration.controller','get','index','exports','util','path','express','../../components/auth/service'];(function(_0xe4854b,_0x414b50){var _0x1c3d72=function(_0x266317){while(--_0x266317){_0xe4854b['push'](_0xe4854b['shift']());}};_0x1c3d72(++_0x414b50);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x521e8d,_0x23a290){_0x521e8d=_0x521e8d-0x0;var _0x518bbd=_0xbe3b[_0x521e8d];return _0x518bbd;};'use strict';var multer=require('multer');var util=require(_0xbbe3('0x0'));var path=require(_0xbbe3('0x1'));var timeout=require('connect-timeout');var express=require(_0xbbe3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbbe3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbbe3('0x4'));router[_0xbbe3('0x5')]('/',controller[_0xbbe3('0x6')]);module[_0xbbe3('0x7')]=router; \ No newline at end of file +var _0x84e7=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x1b7127,_0x1b68dd){var _0x46c025=function(_0x14bc61){while(--_0x14bc61){_0x1b7127['push'](_0x1b7127['shift']());}};_0x46c025(++_0x1b68dd);}(_0x84e7,0x122));var _0x784e=function(_0x5baab1,_0x12dd2f){_0x5baab1=_0x5baab1-0x0;var _0x362b0e=_0x84e7[_0x5baab1];return _0x362b0e;};'use strict';var multer=require('multer');var util=require(_0x784e('0x0'));var path=require(_0x784e('0x1'));var timeout=require('connect-timeout');var express=require(_0x784e('0x2'));var router=express[_0x784e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x784e('0x4'));var interaction=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var controller=require(_0x784e('0x7'));router[_0x784e('0x8')]('/',controller[_0x784e('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 78bcd81..03ce7c3 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 _0x74b9=['sequelize','version'];(function(_0x214a7b,_0x4e7847){var _0x36c004=function(_0x2e5d7a){while(--_0x2e5d7a){_0x214a7b['push'](_0x214a7b['shift']());}};_0x36c004(++_0x4e7847);}(_0x74b9,0x12a));var _0x974b=function(_0x2741ba,_0x4c2f11){_0x2741ba=_0x2741ba-0x0;var _0x5f31c1=_0x74b9[_0x2741ba];return _0x5f31c1;};'use strict';var Sequelize=require(_0x974b('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x974b('0x1')}}; \ No newline at end of file +var _0xaa22=['exports','version','sequelize'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0xaa22,0x12b));var _0x2aa2=function(_0x27a350,_0x3c5874){_0x27a350=_0x27a350-0x0;var _0x4a459b=_0xaa22[_0x27a350];return _0x4a459b;};'use strict';var Sequelize=require(_0x2aa2('0x0'));module[_0x2aa2('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x2aa2('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6c3ad49..6ed1495 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 _0xfe7b=['update','then','error','stack','name','send','index','map','Migration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','rows','catch','eml-format','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x4ef1b6,_0x502ac2){var _0x164c1f=function(_0x3c6ee2){while(--_0x3c6ee2){_0x4ef1b6['push'](_0x4ef1b6['shift']());}};_0x164c1f(++_0x502ac2);}(_0xfe7b,0xef));var _0xbfe7=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0xfe7b[_0x282a1f];return _0x296ea7;};'use strict';var emlformat=require(_0xbfe7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfe7('0x1'));var jsonpatch=require(_0xbfe7('0x2'));var rp=require('request-promise');var moment=require(_0xbfe7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbfe7('0x4'));var path=require('path');var sox=require(_0xbfe7('0x5'));var csv=require('to-csv');var ejs=require(_0xbfe7('0x6'));var fs=require('fs');var fs_extra=require(_0xbfe7('0x7'));var _=require(_0xbfe7('0x8'));var squel=require(_0xbfe7('0x9'));var crypto=require(_0xbfe7('0xa'));var jsforce=require(_0xbfe7('0xb'));var deskjs=require(_0xbfe7('0xc'));var toCsv=require(_0xbfe7('0xd'));var querystring=require(_0xbfe7('0xe'));var Papa=require(_0xbfe7('0xf'));var Redis=require(_0xbfe7('0x10'));var authService=require(_0xbfe7('0x11'));var qs=require(_0xbfe7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfe7('0x13'));var logger=require(_0xbfe7('0x14'))(_0xbfe7('0x15'));var utils=require(_0xbfe7('0x16'));var config=require(_0xbfe7('0x17'));var licenseUtil=require(_0xbfe7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x569559,_0x5cc7e5){_0x5cc7e5=_0x5cc7e5||0xcc;return function(_0x4a1e32){if(_0x4a1e32){return _0x569559[_0xbfe7('0x19')](_0x5cc7e5);}return _0x569559[_0xbfe7('0x1a')](_0x5cc7e5)[_0xbfe7('0x1b')]();};}function respondWithResult(_0xf0b9ed,_0x26bfa7){_0x26bfa7=_0x26bfa7||0xc8;return function(_0x5ddcf6){if(_0x5ddcf6){return _0xf0b9ed['status'](_0x26bfa7)[_0xbfe7('0x1c')](_0x5ddcf6);}};}function respondWithFilteredResult(_0x580760,_0x409d9d){return function(_0x3da16f){if(_0x3da16f){var _0x3fe50b=typeof _0x409d9d[_0xbfe7('0x1d')]===_0xbfe7('0x1e')&&typeof _0x409d9d[_0xbfe7('0x1f')]===_0xbfe7('0x1e');var _0x3a78c2=_0x3da16f['count'];var _0x182281=_0x3fe50b?0x0:_0x409d9d[_0xbfe7('0x1d')];var _0x30a4b1=_0x3fe50b?_0x3da16f[_0xbfe7('0x20')]:_0x409d9d[_0xbfe7('0x1d')]+_0x409d9d[_0xbfe7('0x1f')];var _0x373245;if(_0x30a4b1>=_0x3a78c2){_0x30a4b1=_0x3a78c2;_0x373245=0xc8;}else{_0x373245=0xce;}_0x580760['status'](_0x373245);return _0x580760[_0xbfe7('0x21')](_0xbfe7('0x22'),_0x182281+'-'+_0x30a4b1+'/'+_0x3a78c2)[_0xbfe7('0x1c')](_0x3da16f);}return null;};}function patchUpdates(_0x5654de){return function(_0x21581e){try{jsonpatch[_0xbfe7('0x23')](_0x21581e,_0x5654de,!![]);}catch(_0x5a8178){return BPromise['reject'](_0x5a8178);}return _0x21581e[_0xbfe7('0x24')]();};}function saveUpdates(_0x35902b,_0x976004){return function(_0x4a4f8f){if(_0x4a4f8f){return _0x4a4f8f[_0xbfe7('0x25')](_0x35902b)[_0xbfe7('0x26')](function(_0x212b72){return _0x212b72;});}return null;};}function removeEntity(_0x3f2582,_0x1f68a5){return function(_0x1e0be1){if(_0x1e0be1){return _0x1e0be1['destroy']()[_0xbfe7('0x26')](function(){_0x3f2582[_0xbfe7('0x1a')](0xcc)[_0xbfe7('0x1b')]();});}};}function handleEntityNotFound(_0x1dbcdb,_0xb83d8d){return function(_0x2eb9b8){if(!_0x2eb9b8){_0x1dbcdb[_0xbfe7('0x19')](0x194);}return _0x2eb9b8;};}function handleError(_0xfdb1ff,_0x1880bb){_0x1880bb=_0x1880bb||0x1f4;return function(_0x58f009){logger[_0xbfe7('0x27')](_0x58f009[_0xbfe7('0x28')]);if(_0x58f009[_0xbfe7('0x29')]){delete _0x58f009['name'];}_0xfdb1ff[_0xbfe7('0x1a')](_0x1880bb)[_0xbfe7('0x2a')](_0x58f009);};}exports[_0xbfe7('0x2b')]=function(_0x1924cd,_0xe4cd5c){var _0x2191ba={},_0x1f629d={},_0x11b3d7={'count':0x0,'rows':[]};var _0x4fa7ba=_[_0xbfe7('0x2c')](db[_0xbfe7('0x2d')]['rawAttributes'],function(_0x3c06af){return{'name':_0x3c06af[_0xbfe7('0x2e')],'type':_0x3c06af['type'][_0xbfe7('0x2f')]};});_0x1f629d[_0xbfe7('0x30')]=_[_0xbfe7('0x2c')](_0x4fa7ba,_0xbfe7('0x29'));_0x1f629d[_0xbfe7('0x31')]=_[_0xbfe7('0x32')](_0x1924cd[_0xbfe7('0x31')]);_0x1f629d[_0xbfe7('0x33')]=_[_0xbfe7('0x34')](_0x1f629d[_0xbfe7('0x30')],_0x1f629d[_0xbfe7('0x31')]);_0x2191ba[_0xbfe7('0x35')]=_[_0xbfe7('0x34')](_0x1f629d[_0xbfe7('0x30')],qs[_0xbfe7('0x36')](_0x1924cd[_0xbfe7('0x31')]['fields']));_0x2191ba[_0xbfe7('0x35')]=_0x2191ba[_0xbfe7('0x35')][_0xbfe7('0x37')]?_0x2191ba[_0xbfe7('0x35')]:_0x1f629d[_0xbfe7('0x30')];if(!_0x1924cd[_0xbfe7('0x31')]['hasOwnProperty'](_0xbfe7('0x38'))){_0x2191ba['limit']=qs[_0xbfe7('0x1f')](_0x1924cd['query'][_0xbfe7('0x1f')]);_0x2191ba[_0xbfe7('0x1d')]=qs[_0xbfe7('0x1d')](_0x1924cd[_0xbfe7('0x31')][_0xbfe7('0x1d')]);}_0x2191ba[_0xbfe7('0x39')]=qs[_0xbfe7('0x3a')](_0x1924cd[_0xbfe7('0x31')][_0xbfe7('0x3a')]);_0x2191ba[_0xbfe7('0x3b')]=qs[_0xbfe7('0x33')](_[_0xbfe7('0x3c')](_0x1924cd[_0xbfe7('0x31')],_0x1f629d['filters']),_0x4fa7ba);if(_0x1924cd[_0xbfe7('0x31')][_0xbfe7('0x3d')]){_0x2191ba['where']=_['merge'](_0x2191ba['where'],{'$or':_['map'](_0x4fa7ba,function(_0x1b24fb){if(_0x1b24fb[_0xbfe7('0x3e')]!=='VIRTUAL'){var _0xeb07e0={};_0xeb07e0[_0x1b24fb[_0xbfe7('0x29')]]={'$like':'%'+_0x1924cd['query'][_0xbfe7('0x3d')]+'%'};return _0xeb07e0;}})});}_0x2191ba=_[_0xbfe7('0x3f')]({},_0x2191ba,_0x1924cd[_0xbfe7('0x40')]);var _0x174c03={'where':_0x2191ba[_0xbfe7('0x3b')]};return db['Migration'][_0xbfe7('0x20')](_0x174c03)[_0xbfe7('0x26')](function(_0x285b0c){_0x11b3d7[_0xbfe7('0x20')]=_0x285b0c;if(_0x1924cd[_0xbfe7('0x31')][_0xbfe7('0x41')]){_0x2191ba[_0xbfe7('0x42')]=[{'all':!![]}];}return db[_0xbfe7('0x2d')]['findAll'](_0x2191ba);})['then'](function(_0x5ef0c0){_0x11b3d7[_0xbfe7('0x43')]=_0x5ef0c0;return _0x11b3d7;})[_0xbfe7('0x26')](respondWithFilteredResult(_0xe4cd5c,_0x2191ba))[_0xbfe7('0x44')](handleError(_0xe4cd5c,null));}; \ No newline at end of file +var _0x50c1=['sort','where','merge','filter','includeAll','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x2cbccb,_0x27cbda){var _0x3c358a=function(_0x105c75){while(--_0x105c75){_0x2cbccb['push'](_0x2cbccb['shift']());}};_0x3c358a(++_0x27cbda);}(_0x50c1,0x162));var _0x150c=function(_0x229aa0,_0x5989ed){_0x229aa0=_0x229aa0-0x0;var _0x56b2c7=_0x50c1[_0x229aa0];return _0x56b2c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x150c('0x0'));var zipdir=require(_0x150c('0x1'));var jsonpatch=require(_0x150c('0x2'));var rp=require(_0x150c('0x3'));var moment=require(_0x150c('0x4'));var BPromise=require(_0x150c('0x5'));var Mustache=require(_0x150c('0x6'));var util=require(_0x150c('0x7'));var path=require(_0x150c('0x8'));var sox=require(_0x150c('0x9'));var csv=require(_0x150c('0xa'));var ejs=require(_0x150c('0xb'));var fs=require('fs');var fs_extra=require(_0x150c('0xc'));var _=require(_0x150c('0xd'));var squel=require(_0x150c('0xe'));var crypto=require(_0x150c('0xf'));var jsforce=require(_0x150c('0x10'));var deskjs=require(_0x150c('0x11'));var toCsv=require(_0x150c('0xa'));var querystring=require('querystring');var Papa=require(_0x150c('0x12'));var Redis=require(_0x150c('0x13'));var authService=require(_0x150c('0x14'));var qs=require(_0x150c('0x15'));var as=require(_0x150c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x150c('0x17'))('api');var utils=require(_0x150c('0x18'));var config=require(_0x150c('0x19'));var licenseUtil=require(_0x150c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1acc6b,_0x4127ac){_0x4127ac=_0x4127ac||0xcc;return function(_0x248524){if(_0x248524){return _0x1acc6b[_0x150c('0x1b')](_0x4127ac);}return _0x1acc6b[_0x150c('0x1c')](_0x4127ac)['end']();};}function respondWithResult(_0x29e3e6,_0x126e16){_0x126e16=_0x126e16||0xc8;return function(_0x33f4cf){if(_0x33f4cf){return _0x29e3e6[_0x150c('0x1c')](_0x126e16)[_0x150c('0x1d')](_0x33f4cf);}};}function respondWithFilteredResult(_0x21f8e9,_0x2ba711){return function(_0x4ad723){if(_0x4ad723){var _0x48b731=typeof _0x2ba711[_0x150c('0x1e')]==='undefined'&&typeof _0x2ba711[_0x150c('0x1f')]===_0x150c('0x20');var _0x23247b=_0x4ad723['count'];var _0x31bfeb=_0x48b731?0x0:_0x2ba711[_0x150c('0x1e')];var _0x1a4fde=_0x48b731?_0x4ad723[_0x150c('0x21')]:_0x2ba711[_0x150c('0x1e')]+_0x2ba711[_0x150c('0x1f')];var _0x1ddc14;if(_0x1a4fde>=_0x23247b){_0x1a4fde=_0x23247b;_0x1ddc14=0xc8;}else{_0x1ddc14=0xce;}_0x21f8e9['status'](_0x1ddc14);return _0x21f8e9[_0x150c('0x22')](_0x150c('0x23'),_0x31bfeb+'-'+_0x1a4fde+'/'+_0x23247b)['json'](_0x4ad723);}return null;};}function patchUpdates(_0x202514){return function(_0x364604){try{jsonpatch[_0x150c('0x24')](_0x364604,_0x202514,!![]);}catch(_0x56e716){return BPromise[_0x150c('0x25')](_0x56e716);}return _0x364604[_0x150c('0x26')]();};}function saveUpdates(_0x566189,_0x37cba4){return function(_0x3167a9){if(_0x3167a9){return _0x3167a9[_0x150c('0x27')](_0x566189)[_0x150c('0x28')](function(_0xf29c53){return _0xf29c53;});}return null;};}function removeEntity(_0x5b45f1,_0x487010){return function(_0x384e18){if(_0x384e18){return _0x384e18[_0x150c('0x29')]()[_0x150c('0x28')](function(){_0x5b45f1[_0x150c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x223848,_0xd1558c){return function(_0x308dc1){if(!_0x308dc1){_0x223848['sendStatus'](0x194);}return _0x308dc1;};}function handleError(_0x2ac8f9,_0x557345){_0x557345=_0x557345||0x1f4;return function(_0x3603a8){logger[_0x150c('0x2a')](_0x3603a8[_0x150c('0x2b')]);if(_0x3603a8['name']){delete _0x3603a8[_0x150c('0x2c')];}_0x2ac8f9[_0x150c('0x1c')](_0x557345)[_0x150c('0x2d')](_0x3603a8);};}exports[_0x150c('0x2e')]=function(_0x2f217,_0x37e326){var _0x2ad70c={},_0x4eb06b={},_0x3cfcec={'count':0x0,'rows':[]};var _0x436653=_[_0x150c('0x2f')](db[_0x150c('0x30')][_0x150c('0x31')],function(_0x55a827){return{'name':_0x55a827['fieldName'],'type':_0x55a827[_0x150c('0x32')][_0x150c('0x33')]};});_0x4eb06b[_0x150c('0x34')]=_['map'](_0x436653,_0x150c('0x2c'));_0x4eb06b[_0x150c('0x35')]=_[_0x150c('0x36')](_0x2f217[_0x150c('0x35')]);_0x4eb06b[_0x150c('0x37')]=_[_0x150c('0x38')](_0x4eb06b[_0x150c('0x34')],_0x4eb06b[_0x150c('0x35')]);_0x2ad70c[_0x150c('0x39')]=_[_0x150c('0x38')](_0x4eb06b[_0x150c('0x34')],qs['fields'](_0x2f217[_0x150c('0x35')]['fields']));_0x2ad70c[_0x150c('0x39')]=_0x2ad70c[_0x150c('0x39')][_0x150c('0x3a')]?_0x2ad70c[_0x150c('0x39')]:_0x4eb06b[_0x150c('0x34')];if(!_0x2f217['query'][_0x150c('0x3b')]('nolimit')){_0x2ad70c['limit']=qs[_0x150c('0x1f')](_0x2f217[_0x150c('0x35')][_0x150c('0x1f')]);_0x2ad70c[_0x150c('0x1e')]=qs[_0x150c('0x1e')](_0x2f217[_0x150c('0x35')][_0x150c('0x1e')]);}_0x2ad70c['order']=qs[_0x150c('0x3c')](_0x2f217['query']['sort']);_0x2ad70c[_0x150c('0x3d')]=qs[_0x150c('0x37')](_['pick'](_0x2f217[_0x150c('0x35')],_0x4eb06b['filters']),_0x436653);if(_0x2f217[_0x150c('0x35')]['filter']){_0x2ad70c[_0x150c('0x3d')]=_[_0x150c('0x3e')](_0x2ad70c[_0x150c('0x3d')],{'$or':_[_0x150c('0x2f')](_0x436653,function(_0x3c04ba){if(_0x3c04ba[_0x150c('0x32')]!=='VIRTUAL'){var _0x33413b={};_0x33413b[_0x3c04ba['name']]={'$like':'%'+_0x2f217[_0x150c('0x35')][_0x150c('0x3f')]+'%'};return _0x33413b;}})});}_0x2ad70c=_[_0x150c('0x3e')]({},_0x2ad70c,_0x2f217['options']);var _0xc73142={'where':_0x2ad70c[_0x150c('0x3d')]};return db[_0x150c('0x30')]['count'](_0xc73142)[_0x150c('0x28')](function(_0x501909){_0x3cfcec[_0x150c('0x21')]=_0x501909;if(_0x2f217[_0x150c('0x35')][_0x150c('0x40')]){_0x2ad70c[_0x150c('0x41')]=[{'all':!![]}];}return db[_0x150c('0x30')][_0x150c('0x42')](_0x2ad70c);})[_0x150c('0x28')](function(_0xf45677){_0x3cfcec[_0x150c('0x43')]=_0xf45677;return _0x3cfcec;})[_0x150c('0x28')](respondWithFilteredResult(_0x37e326,_0x2ad70c))[_0x150c('0x44')](handleError(_0x37e326,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 1ce6604..b742ee3 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 _0xc727=['./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xc727,0x170));var _0x7c72=function(_0x5f1354,_0x34ccff){_0x5f1354=_0x5f1354-0x0;var _0x57773d=_0xc727[_0x5f1354];return _0x57773d;};'use strict';var _=require(_0x7c72('0x0'));var util=require(_0x7c72('0x1'));var logger=require(_0x7c72('0x2'))(_0x7c72('0x3'));var moment=require(_0x7c72('0x4'));var BPromise=require(_0x7c72('0x5'));var rp=require(_0x7c72('0x6'));var fs=require('fs');var path=require(_0x7c72('0x7'));var rimraf=require('rimraf');var config=require(_0x7c72('0x8'));var attributes=require(_0x7c72('0x9'));module[_0x7c72('0xa')]=function(_0x519376,_0x272e17){return _0x519376['define'](_0x7c72('0xb'),attributes,{'tableName':_0x7c72('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x790e=['request-promise','../../config/environment','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x53438b,_0x441ee9){var _0x1af01a=function(_0x2f87a1){while(--_0x2f87a1){_0x53438b['push'](_0x53438b['shift']());}};_0x1af01a(++_0x441ee9);}(_0x790e,0x1a8));var _0xe790=function(_0x4da30d,_0x54c94b){_0x4da30d=_0x4da30d-0x0;var _0x27f0e6=_0x790e[_0x4da30d];return _0x27f0e6;};'use strict';var _=require(_0xe790('0x0'));var util=require(_0xe790('0x1'));var logger=require(_0xe790('0x2'))(_0xe790('0x3'));var moment=require(_0xe790('0x4'));var BPromise=require('bluebird');var rp=require(_0xe790('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe790('0x6'));var attributes=require('./migration.attributes');module[_0xe790('0x7')]=function(_0xb1aa2c,_0x9bcee5){return _0xb1aa2c[_0xe790('0x8')](_0xe790('0x9'),attributes,{'tableName':_0xe790('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 abf6fc6..910afc6 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 _0xb677=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb677,0x119));var _0x7b67=function(_0x139408,_0x5e51bd){_0x139408=_0x139408-0x0;var _0x1853fa=_0xb677[_0x139408];return _0x1853fa;};'use strict';var _=require(_0x7b67('0x0'));var util=require('util');var moment=require(_0x7b67('0x1'));var BPromise=require(_0x7b67('0x2'));var rs=require(_0x7b67('0x3'));var fs=require('fs');var Redis=require(_0x7b67('0x4'));var db=require(_0x7b67('0x5'))['db'];var utils=require(_0x7b67('0x6'));var logger=require(_0x7b67('0x7'))(_0x7b67('0x8'));var config=require('../../config/environment');var jayson=require(_0x7b67('0x9'));var client=jayson[_0x7b67('0xa')][_0x7b67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b7a82,_0x502c32,_0x5af161){return new BPromise(function(_0x560eea,_0x4ac7fb){return client['request'](_0x3b7a82,_0x5af161)[_0x7b67('0xc')](function(_0x4f853f){logger[_0x7b67('0xd')](_0x7b67('0xe'),_0x502c32,'request\x20sent');logger[_0x7b67('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x502c32,_0x7b67('0x10'),JSON[_0x7b67('0x11')](_0x4f853f));if(_0x4f853f[_0x7b67('0x12')]){if(_0x4f853f['error']['code']===0x1f4){logger['error'](_0x7b67('0xe'),_0x502c32,_0x4f853f[_0x7b67('0x12')][_0x7b67('0x13')]);return _0x4ac7fb(_0x4f853f[_0x7b67('0x12')][_0x7b67('0x13')]);}logger[_0x7b67('0x12')]('Migration,\x20%s,\x20%s',_0x502c32,_0x4f853f[_0x7b67('0x12')][_0x7b67('0x13')]);return _0x560eea(_0x4f853f[_0x7b67('0x12')][_0x7b67('0x13')]);}else{logger[_0x7b67('0xd')](_0x7b67('0xe'),_0x502c32,_0x7b67('0x10'));_0x560eea(_0x4f853f[_0x7b67('0x14')]['message']);}})[_0x7b67('0x15')](function(_0xd10561){logger[_0x7b67('0x12')](_0x7b67('0xe'),_0x502c32,_0xd10561);_0x4ac7fb(_0xd10561);});});} \ No newline at end of file +var _0x9bc3=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash'];(function(_0x50c369,_0x2fa32b){var _0x513d79=function(_0x533830){while(--_0x533830){_0x50c369['push'](_0x50c369['shift']());}};_0x513d79(++_0x2fa32b);}(_0x9bc3,0x137));var _0x39bc=function(_0x2768ab,_0x59be88){_0x2768ab=_0x2768ab-0x0;var _0x2b715f=_0x9bc3[_0x2768ab];return _0x2b715f;};'use strict';var _=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var moment=require(_0x39bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x39bc('0x3'));var fs=require('fs');var Redis=require(_0x39bc('0x4'));var db=require(_0x39bc('0x5'))['db'];var utils=require(_0x39bc('0x6'));var logger=require('../../config/logger')(_0x39bc('0x7'));var config=require(_0x39bc('0x8'));var jayson=require(_0x39bc('0x9'));var client=jayson[_0x39bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d6ce,_0x1367c6,_0x86cff3){return new BPromise(function(_0x10be27,_0x3fa4bd){return client[_0x39bc('0xb')](_0x38d6ce,_0x86cff3)[_0x39bc('0xc')](function(_0x2533c1){logger['info'](_0x39bc('0xd'),_0x1367c6,_0x39bc('0xe'));logger[_0x39bc('0xf')](_0x39bc('0x10'),_0x1367c6,_0x39bc('0xe'),JSON[_0x39bc('0x11')](_0x2533c1));if(_0x2533c1['error']){if(_0x2533c1['error'][_0x39bc('0x12')]===0x1f4){logger[_0x39bc('0x13')]('Migration,\x20%s,\x20%s',_0x1367c6,_0x2533c1[_0x39bc('0x13')][_0x39bc('0x14')]);return _0x3fa4bd(_0x2533c1[_0x39bc('0x13')]['message']);}logger['error']('Migration,\x20%s,\x20%s',_0x1367c6,_0x2533c1[_0x39bc('0x13')]['message']);return _0x10be27(_0x2533c1['error'][_0x39bc('0x14')]);}else{logger[_0x39bc('0x15')]('Migration,\x20%s,\x20%s',_0x1367c6,'request\x20sent');_0x10be27(_0x2533c1[_0x39bc('0x16')][_0x39bc('0x14')]);}})[_0x39bc('0x17')](function(_0x5d6b18){logger[_0x39bc('0x13')](_0x39bc('0xd'),_0x1367c6,_0x5d6b18);_0x3fa4bd(_0x5d6b18);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 9a36272..ae8820f 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 _0xcb22=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','post','put','update','delete','exports'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0xcb22,0xc8));var _0x2cb2=function(_0x413ff0,_0x1e782d){_0x413ff0=_0x413ff0-0x0;var _0x3826d4=_0xcb22[_0x413ff0];return _0x3826d4;};'use strict';var multer=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var path=require(_0x2cb2('0x2'));var timeout=require(_0x2cb2('0x3'));var express=require(_0x2cb2('0x4'));var router=express[_0x2cb2('0x5')]();var fs_extra=require(_0x2cb2('0x6'));var auth=require(_0x2cb2('0x7'));var interaction=require(_0x2cb2('0x8'));var config=require(_0x2cb2('0x9'));var controller=require(_0x2cb2('0xa'));router['get']('/',auth[_0x2cb2('0xb')](),controller[_0x2cb2('0xc')]);router[_0x2cb2('0xd')](_0x2cb2('0xe'),auth[_0x2cb2('0xb')](),controller['show']);router[_0x2cb2('0xf')]('/',auth[_0x2cb2('0xb')](),controller['create']);router[_0x2cb2('0x10')](_0x2cb2('0xe'),auth[_0x2cb2('0xb')](),controller[_0x2cb2('0x11')]);router[_0x2cb2('0x12')](_0x2cb2('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x2cb2('0x13')]=router; \ No newline at end of file +var _0x6cb2=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','put','/:id'];(function(_0x12c7e5,_0x4f82a7){var _0x266fe0=function(_0xe76c9){while(--_0xe76c9){_0x12c7e5['push'](_0x12c7e5['shift']());}};_0x266fe0(++_0x4f82a7);}(_0x6cb2,0xfa));var _0x26cb=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x6cb2[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x26cb('0x0'));var util=require(_0x26cb('0x1'));var path=require(_0x26cb('0x2'));var timeout=require(_0x26cb('0x3'));var express=require('express');var router=express[_0x26cb('0x4')]();var fs_extra=require(_0x26cb('0x5'));var auth=require(_0x26cb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x26cb('0x7'));var controller=require(_0x26cb('0x8'));router[_0x26cb('0x9')]('/',auth[_0x26cb('0xa')](),controller[_0x26cb('0xb')]);router[_0x26cb('0x9')]('/:id',auth[_0x26cb('0xa')](),controller[_0x26cb('0xc')]);router[_0x26cb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x26cb('0xe')](_0x26cb('0xf'),auth[_0x26cb('0xa')](),controller['update']);router[_0x26cb('0x10')](_0x26cb('0xf'),auth['isAuthenticated'](),controller[_0x26cb('0x11')]);module[_0x26cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d2b86e1..5f12da8 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 _0x5a0f=['sequelize','ENUM','localnet','STRING'];(function(_0x6433a,_0x5901cf){var _0x4c25d0=function(_0x534e93){while(--_0x534e93){_0x6433a['push'](_0x6433a['shift']());}};_0x4c25d0(++_0x5901cf);}(_0x5a0f,0x1e4));var _0xf5a0=function(_0x57aed4,_0x4f8e59){_0x57aed4=_0x57aed4-0x0;var _0x271d9a=_0x5a0f[_0x57aed4];return _0x271d9a;};'use strict';var Sequelize=require(_0xf5a0('0x0'));module['exports']={'type':{'type':Sequelize[_0xf5a0('0x1')](_0xf5a0('0x2'),'externip','stun','turn')},'value':{'type':Sequelize[_0xf5a0('0x3')]},'username':{'type':Sequelize[_0xf5a0('0x3')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17ac=['localnet','externip','STRING','sequelize','exports'];(function(_0x4e4861,_0x5bef58){var _0x1c98bc=function(_0x17f607){while(--_0x17f607){_0x4e4861['push'](_0x4e4861['shift']());}};_0x1c98bc(++_0x5bef58);}(_0x17ac,0x85));var _0xc17a=function(_0x38feee,_0x5609d5){_0x38feee=_0x38feee-0x0;var _0x3e7bc3=_0x17ac[_0x38feee];return _0x3e7bc3;};'use strict';var Sequelize=require(_0xc17a('0x0'));module[_0xc17a('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc17a('0x2'),_0xc17a('0x3'),'stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc17a('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 21d206e..27a767b 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 _0xca54=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','find','create','transaction','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','writeFileSync','Reload','res_stun_monitor.so','toUpperCase','utf8','render','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','sequelize','params','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model'];(function(_0x3ef99e,_0x380f8c){var _0x41d733=function(_0x502f66){while(--_0x502f66){_0x3ef99e['push'](_0x3ef99e['shift']());}};_0x41d733(++_0x380f8c);}(_0xca54,0x9c));var _0x4ca5=function(_0x47442f,_0xc5cd74){_0x47442f=_0x47442f-0x0;var _0x5bed03=_0xca54[_0x47442f];return _0x5bed03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ca5('0x0'));var zipdir=require(_0x4ca5('0x1'));var jsonpatch=require(_0x4ca5('0x2'));var rp=require(_0x4ca5('0x3'));var moment=require(_0x4ca5('0x4'));var BPromise=require(_0x4ca5('0x5'));var Mustache=require(_0x4ca5('0x6'));var util=require('util');var path=require(_0x4ca5('0x7'));var sox=require('sox');var csv=require(_0x4ca5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ca5('0x9'));var _=require(_0x4ca5('0xa'));var squel=require(_0x4ca5('0xb'));var crypto=require('crypto');var jsforce=require(_0x4ca5('0xc'));var deskjs=require(_0x4ca5('0xd'));var toCsv=require(_0x4ca5('0x8'));var querystring=require(_0x4ca5('0xe'));var Papa=require(_0x4ca5('0xf'));var Redis=require(_0x4ca5('0x10'));var authService=require(_0x4ca5('0x11'));var qs=require(_0x4ca5('0x12'));var as=require(_0x4ca5('0x13'));var hardwareService=require(_0x4ca5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4ca5('0x15'));var config=require(_0x4ca5('0x16'));var licenseUtil=require(_0x4ca5('0x17'));var db=require(_0x4ca5('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4ca5('0x19')][_0x4ca5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x38cafa,_0x2eee37,_0x285377,_0x1148e5){return new BPromise(function(_0x1fd2a2,_0x1287aa){var _0x5628c0=_0x1148e5||client;return _0x5628c0[_0x4ca5('0x1b')](_0x38cafa,_0x285377)[_0x4ca5('0x1c')](function(_0x33ae14){logger['info'](_0x4ca5('0x1d'),_0x2eee37,'request\x20sent');logger[_0x4ca5('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x2eee37,_0x4ca5('0x1f'),JSON['stringify'](_0x33ae14));if(_0x33ae14[_0x4ca5('0x20')]){if(_0x33ae14[_0x4ca5('0x20')]['code']===0x1f4){logger[_0x4ca5('0x20')]('Network,\x20%s,\x20%s',_0x2eee37,_0x33ae14[_0x4ca5('0x20')][_0x4ca5('0x21')]);return _0x1287aa(_0x33ae14[_0x4ca5('0x20')][_0x4ca5('0x21')]);}logger['error'](_0x4ca5('0x1d'),_0x2eee37,_0x33ae14[_0x4ca5('0x20')][_0x4ca5('0x21')]);return _0x1fd2a2(_0x33ae14[_0x4ca5('0x20')]['message']);}else{logger[_0x4ca5('0x22')](_0x4ca5('0x1d'),_0x2eee37,_0x4ca5('0x1f'));_0x1fd2a2(_0x33ae14[_0x4ca5('0x23')][_0x4ca5('0x21')]);}})[_0x4ca5('0x24')](function(_0x29b6a8){logger['error'](_0x4ca5('0x1d'),_0x2eee37,_0x29b6a8);_0x1287aa(_0x29b6a8);});});}function respondWithStatusCode(_0xbac90a,_0x5931a0){_0x5931a0=_0x5931a0||0xcc;return function(_0xbb239d){if(_0xbb239d){return _0xbac90a[_0x4ca5('0x25')](_0x5931a0);}return _0xbac90a[_0x4ca5('0x26')](_0x5931a0)[_0x4ca5('0x27')]();};}function respondWithResult(_0x11ecff,_0x11e0df){_0x11e0df=_0x11e0df||0xc8;return function(_0xc84945){if(_0xc84945){return _0x11ecff['status'](_0x11e0df)[_0x4ca5('0x28')](_0xc84945);}};}function respondWithFilteredResult(_0x1a464f,_0x2a0ed5){return function(_0x5629e4){if(_0x5629e4){var _0x494bca=typeof _0x2a0ed5[_0x4ca5('0x29')]===_0x4ca5('0x2a')&&typeof _0x2a0ed5[_0x4ca5('0x2b')]==='undefined';var _0x1dc1c6=_0x5629e4['count'];var _0x18b8e6=_0x494bca?0x0:_0x2a0ed5[_0x4ca5('0x29')];var _0x4cd427=_0x494bca?_0x5629e4[_0x4ca5('0x2c')]:_0x2a0ed5[_0x4ca5('0x29')]+_0x2a0ed5['limit'];var _0x112a55;if(_0x4cd427>=_0x1dc1c6){_0x4cd427=_0x1dc1c6;_0x112a55=0xc8;}else{_0x112a55=0xce;}_0x1a464f[_0x4ca5('0x26')](_0x112a55);return _0x1a464f[_0x4ca5('0x2d')](_0x4ca5('0x2e'),_0x18b8e6+'-'+_0x4cd427+'/'+_0x1dc1c6)[_0x4ca5('0x28')](_0x5629e4);}return null;};}function patchUpdates(_0x3bd008){return function(_0x21c6d3){try{jsonpatch[_0x4ca5('0x2f')](_0x21c6d3,_0x3bd008,!![]);}catch(_0x2871aa){return BPromise['reject'](_0x2871aa);}return _0x21c6d3[_0x4ca5('0x30')]();};}function saveUpdates(_0x284e42,_0x2009e8){return function(_0x4ea707){if(_0x4ea707){return _0x4ea707['update'](_0x284e42)[_0x4ca5('0x1c')](function(_0xc8457f){return _0xc8457f;});}return null;};}function removeEntity(_0x1c84c5,_0x647ce8){return function(_0x34a1a1){if(_0x34a1a1){return _0x34a1a1[_0x4ca5('0x31')]()[_0x4ca5('0x1c')](function(){_0x1c84c5[_0x4ca5('0x26')](0xcc)[_0x4ca5('0x27')]();});}};}function handleEntityNotFound(_0x4967d0,_0x31dbe2){return function(_0x1d8dea){if(!_0x1d8dea){_0x4967d0[_0x4ca5('0x25')](0x194);}return _0x1d8dea;};}function handleError(_0xbbfa9b,_0x1df56e){_0x1df56e=_0x1df56e||0x1f4;return function(_0x24e53c){logger[_0x4ca5('0x20')](_0x24e53c[_0x4ca5('0x32')]);if(_0x24e53c[_0x4ca5('0x33')]){delete _0x24e53c[_0x4ca5('0x33')];}_0xbbfa9b[_0x4ca5('0x26')](_0x1df56e)[_0x4ca5('0x34')](_0x24e53c);};}exports['index']=function(_0x3c8e4a,_0x237d1a){var _0x2c0f3a={},_0x2b8ab7={},_0x5a3812={'count':0x0,'rows':[]};var _0x5ee7e3=_[_0x4ca5('0x35')](db[_0x4ca5('0x36')][_0x4ca5('0x37')],function(_0x44c1c7){return{'name':_0x44c1c7[_0x4ca5('0x38')],'type':_0x44c1c7[_0x4ca5('0x39')][_0x4ca5('0x3a')]};});_0x2b8ab7[_0x4ca5('0x3b')]=_['map'](_0x5ee7e3,'name');_0x2b8ab7[_0x4ca5('0x3c')]=_['keys'](_0x3c8e4a['query']);_0x2b8ab7[_0x4ca5('0x3d')]=_[_0x4ca5('0x3e')](_0x2b8ab7[_0x4ca5('0x3b')],_0x2b8ab7[_0x4ca5('0x3c')]);_0x2c0f3a[_0x4ca5('0x3f')]=_[_0x4ca5('0x3e')](_0x2b8ab7['model'],qs[_0x4ca5('0x40')](_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x40')]));_0x2c0f3a[_0x4ca5('0x3f')]=_0x2c0f3a[_0x4ca5('0x3f')][_0x4ca5('0x41')]?_0x2c0f3a[_0x4ca5('0x3f')]:_0x2b8ab7[_0x4ca5('0x3b')];if(!_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x42')](_0x4ca5('0x43'))){_0x2c0f3a[_0x4ca5('0x2b')]=qs[_0x4ca5('0x2b')](_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x2b')]);_0x2c0f3a[_0x4ca5('0x29')]=qs[_0x4ca5('0x29')](_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x29')]);}_0x2c0f3a['order']=qs[_0x4ca5('0x44')](_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x44')]);_0x2c0f3a[_0x4ca5('0x45')]=qs[_0x4ca5('0x3d')](_[_0x4ca5('0x46')](_0x3c8e4a[_0x4ca5('0x3c')],_0x2b8ab7['filters']),_0x5ee7e3);if(_0x3c8e4a[_0x4ca5('0x3c')][_0x4ca5('0x47')]){_0x2c0f3a[_0x4ca5('0x45')]=_[_0x4ca5('0x48')](_0x2c0f3a[_0x4ca5('0x45')],{'$or':_[_0x4ca5('0x35')](_0x5ee7e3,function(_0x13d569){if(_0x13d569[_0x4ca5('0x39')]!==_0x4ca5('0x49')){var _0x362efb={};_0x362efb[_0x13d569['name']]={'$like':'%'+_0x3c8e4a['query'][_0x4ca5('0x47')]+'%'};return _0x362efb;}})});}_0x2c0f3a=_['merge']({},_0x2c0f3a,_0x3c8e4a[_0x4ca5('0x4a')]);var _0x412f16={'where':_0x2c0f3a[_0x4ca5('0x45')]};return db[_0x4ca5('0x36')][_0x4ca5('0x2c')](_0x412f16)['then'](function(_0x27daf1){_0x5a3812[_0x4ca5('0x2c')]=_0x27daf1;if(_0x3c8e4a['query']['includeAll']){_0x2c0f3a[_0x4ca5('0x4b')]=[{'all':!![]}];}return db['Network'][_0x4ca5('0x4c')](_0x2c0f3a);})[_0x4ca5('0x1c')](function(_0x1b7304){_0x5a3812[_0x4ca5('0x4d')]=_0x1b7304;return _0x5a3812;})[_0x4ca5('0x1c')](respondWithFilteredResult(_0x237d1a,_0x2c0f3a))['catch'](handleError(_0x237d1a,null));};exports[_0x4ca5('0x4e')]=function(_0xbb137c,_0x56b647){var _0x321a8e={'raw':!![],'where':{'id':_0xbb137c['params']['id']}},_0xda4478={};_0xda4478[_0x4ca5('0x3b')]=_[_0x4ca5('0x4f')](db['Network'][_0x4ca5('0x37')]);_0xda4478[_0x4ca5('0x3c')]=_[_0x4ca5('0x4f')](_0xbb137c[_0x4ca5('0x3c')]);_0xda4478[_0x4ca5('0x3d')]=_['intersection'](_0xda4478[_0x4ca5('0x3b')],_0xda4478[_0x4ca5('0x3c')]);_0x321a8e['attributes']=_[_0x4ca5('0x3e')](_0xda4478['model'],qs[_0x4ca5('0x40')](_0xbb137c[_0x4ca5('0x3c')][_0x4ca5('0x40')]));_0x321a8e[_0x4ca5('0x3f')]=_0x321a8e[_0x4ca5('0x3f')][_0x4ca5('0x41')]?_0x321a8e[_0x4ca5('0x3f')]:_0xda4478[_0x4ca5('0x3b')];if(_0xbb137c[_0x4ca5('0x3c')][_0x4ca5('0x50')]){_0x321a8e[_0x4ca5('0x4b')]=[{'all':!![]}];}_0x321a8e=_[_0x4ca5('0x48')]({},_0x321a8e,_0xbb137c['options']);return db[_0x4ca5('0x36')][_0x4ca5('0x51')](_0x321a8e)['then'](handleEntityNotFound(_0x56b647,null))[_0x4ca5('0x1c')](respondWithResult(_0x56b647,null))[_0x4ca5('0x24')](handleError(_0x56b647,null));};exports[_0x4ca5('0x52')]=function(_0x4dfa08,_0x5d994a,_0x5609a7){var _0x6278d0;return db['sequelize'][_0x4ca5('0x53')](function(_0x31efdb){return db[_0x4ca5('0x36')][_0x4ca5('0x52')](_0x4dfa08[_0x4ca5('0x54')],{'raw':!![]})[_0x4ca5('0x1c')](function(_0x365931){_0x6278d0=_0x365931;return db['Network'][_0x4ca5('0x4c')]({'where':{'type':_0x4dfa08['body'][_0x4ca5('0x39')]},'raw':!![]});})[_0x4ca5('0x1c')](function(_0x29953c){if(_0x6278d0[_0x4ca5('0x39')]['toUpperCase']()==_0x4ca5('0x55')){var _0x323b32=fs[_0x4ca5('0x56')](path[_0x4ca5('0x57')](config[_0x4ca5('0x58')],_0x4ca5('0x59')),'utf8');var _0x43dd=ejs['render'](_0x323b32,{'networks':_0x29953c||[]});fs[_0x4ca5('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x43dd);return respondWithRpcPromise(_0x4ca5('0x5b'),_0x4ca5('0x52'),{'module':_0x4ca5('0x5c')});}else if(_0x6278d0['type'][_0x4ca5('0x5d')]()=='TURN'){var _0x95ec91=fs[_0x4ca5('0x56')](path['join'](config[_0x4ca5('0x58')],'server/files/templates/turn_multiple.ejs'),_0x4ca5('0x5e'));var _0xb5f675=ejs[_0x4ca5('0x5f')](_0x95ec91,{'networks':_0x29953c||[]});fs[_0x4ca5('0x5a')]('/etc/asterisk/turn_xcally.conf',_0xb5f675);return respondWithRpcPromise(_0x4ca5('0x5b'),_0x4ca5('0x52'),{'module':_0x4ca5('0x5c')});}else{var _0x171032=fs[_0x4ca5('0x56')](path[_0x4ca5('0x57')](config[_0x4ca5('0x58')],'server/files/templates/network.ejs'),'utf8');var _0x399e64=ejs['render'](_0x171032,{'networks':_0x29953c||[]});fs['writeFileSync'](util['format'](_0x4ca5('0x60'),_0x4dfa08[_0x4ca5('0x54')][_0x4ca5('0x39')][_0x4ca5('0x61')]()),_0x399e64);return respondWithRpcPromise(_0x4ca5('0x5b'),_0x4ca5('0x52'),{'module':_0x4ca5('0x62')});}return null;})[_0x4ca5('0x1c')](function(){return _0x6278d0;});})[_0x4ca5('0x1c')](respondWithResult(_0x5d994a,0xc9))[_0x4ca5('0x24')](handleError(_0x5d994a,null));};exports[_0x4ca5('0x63')]=function(_0x452450,_0x72774a,_0x11ee82){var _0x34b8db;return db[_0x4ca5('0x64')]['transaction'](function(_0x3b755f){return db[_0x4ca5('0x36')]['find']({'where':{'id':_0x452450[_0x4ca5('0x65')]['id']}})['then'](handleEntityNotFound(_0x72774a,null))[_0x4ca5('0x1c')](saveUpdates(_0x452450[_0x4ca5('0x54')],null))[_0x4ca5('0x1c')](function(_0x2822e1){if(_0x2822e1){_0x34b8db=_0x2822e1;return db[_0x4ca5('0x36')][_0x4ca5('0x4c')]({'where':{'type':_0x34b8db[_0x4ca5('0x39')]},'raw':!![]});}return null;})[_0x4ca5('0x1c')](function(_0x3f9b3d){if(_0x34b8db[_0x4ca5('0x39')][_0x4ca5('0x5d')]()==_0x4ca5('0x55')){var _0x4e320c=fs[_0x4ca5('0x56')](path[_0x4ca5('0x57')](config[_0x4ca5('0x58')],_0x4ca5('0x59')),_0x4ca5('0x5e'));var _0x9624fa=ejs['render'](_0x4e320c,{'networks':_0x3f9b3d||[]});fs['writeFileSync'](_0x4ca5('0x66'),_0x9624fa);return respondWithRpcPromise(_0x4ca5('0x5b'),_0x4ca5('0x63'),{'module':_0x4ca5('0x5c')});}else if(_0x34b8db[_0x4ca5('0x39')][_0x4ca5('0x5d')]()==_0x4ca5('0x67')){var _0x52a540=fs['readFileSync'](path[_0x4ca5('0x57')](config[_0x4ca5('0x58')],_0x4ca5('0x68')),_0x4ca5('0x5e'));var _0x20254b=ejs[_0x4ca5('0x5f')](_0x52a540,{'networks':_0x3f9b3d||[]});fs[_0x4ca5('0x5a')](_0x4ca5('0x69'),_0x20254b);return respondWithRpcPromise('Reload',_0x4ca5('0x63'),{'module':_0x4ca5('0x5c')});}else{var _0x5a7603=fs[_0x4ca5('0x56')](path[_0x4ca5('0x57')](config[_0x4ca5('0x58')],_0x4ca5('0x6a')),'utf8');var _0x3dbe92=ejs['render'](_0x5a7603,{'networks':_0x3f9b3d||[]});fs[_0x4ca5('0x5a')](util[_0x4ca5('0x6b')](_0x4ca5('0x60'),_0x452450['body'][_0x4ca5('0x39')][_0x4ca5('0x61')]()),_0x3dbe92);return respondWithRpcPromise(_0x4ca5('0x5b'),'update',{'module':_0x4ca5('0x62')});}return null;})[_0x4ca5('0x1c')](function(_0x1d5a61){if(_0x1d5a61){return _0x34b8db;}return null;});})[_0x4ca5('0x1c')](respondWithResult(_0x72774a,null))['catch'](handleError(_0x72774a,null));};exports[_0x4ca5('0x31')]=function(_0x50fccd,_0x3bd065,_0x3b9f25){var _0x134915;return db[_0x4ca5('0x36')][_0x4ca5('0x51')]({'where':{'id':_0x50fccd[_0x4ca5('0x65')]['id']}})[_0x4ca5('0x1c')](function(_0x441f83){_0x134915=_0x441f83;return _0x441f83;})[_0x4ca5('0x1c')](handleEntityNotFound(_0x3bd065,null))['then'](removeEntity(_0x3bd065,null))[_0x4ca5('0x1c')](function(){if(_0x134915){return db[_0x4ca5('0x36')][_0x4ca5('0x4c')]({'where':{'type':_0x134915[_0x4ca5('0x39')]},'raw':!![]});}})[_0x4ca5('0x1c')](function(_0x17b95d){if(_0x134915[_0x4ca5('0x39')][_0x4ca5('0x5d')]()==_0x4ca5('0x55')){var _0x7951ac=fs['readFileSync'](path['join'](config[_0x4ca5('0x58')],_0x4ca5('0x59')),_0x4ca5('0x5e'));var _0x4d8009=ejs[_0x4ca5('0x5f')](_0x7951ac,{'networks':_0x17b95d||[]});fs[_0x4ca5('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x4d8009);return respondWithRpcPromise(_0x4ca5('0x5b'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x134915['type']['toUpperCase']()==_0x4ca5('0x67')){var _0x5e0477=fs['readFileSync'](path[_0x4ca5('0x57')](config[_0x4ca5('0x58')],'server/files/templates/turn_multiple.ejs'),_0x4ca5('0x5e'));var _0x5cc4ac=ejs[_0x4ca5('0x5f')](_0x5e0477,{'networks':_0x17b95d||[]});fs[_0x4ca5('0x5a')](_0x4ca5('0x69'),_0x5cc4ac);return respondWithRpcPromise('Reload',_0x4ca5('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x36e9f4=fs['readFileSync'](path[_0x4ca5('0x57')](config[_0x4ca5('0x58')],_0x4ca5('0x6a')),_0x4ca5('0x5e'));var _0x2e0d09=ejs[_0x4ca5('0x5f')](_0x36e9f4,{'networks':_0x17b95d||[]});fs[_0x4ca5('0x5a')](util[_0x4ca5('0x6b')]('/etc/asterisk/sip_xcally_%s.conf',_0x50fccd[_0x4ca5('0x54')][_0x4ca5('0x39')]['toLowerCase']()),_0x2e0d09);return respondWithRpcPromise(_0x4ca5('0x5b'),_0x4ca5('0x31'),{'module':_0x4ca5('0x62')});}return null;})['catch'](handleError(_0x3bd065,null));}; \ No newline at end of file +var _0x43c8=['stack','name','send','Network','rawAttributes','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','create','transaction','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','utf8','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','toUpperCase','find','TURN','server/files/templates/network.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','catch','end','status','json','limit','count','offset','set','Content-Range','save','update','then','destroy','sendStatus'];(function(_0x2dd68d,_0x276bbe){var _0x2ac747=function(_0x1bf1e2){while(--_0x1bf1e2){_0x2dd68d['push'](_0x2dd68d['shift']());}};_0x2ac747(++_0x276bbe);}(_0x43c8,0x1d6));var _0x843c=function(_0x2b3bc0,_0x506686){_0x2b3bc0=_0x2b3bc0-0x0;var _0x3ac12b=_0x43c8[_0x2b3bc0];return _0x3ac12b;};'use strict';var emlformat=require(_0x843c('0x0'));var rimraf=require(_0x843c('0x1'));var zipdir=require(_0x843c('0x2'));var jsonpatch=require(_0x843c('0x3'));var rp=require(_0x843c('0x4'));var moment=require(_0x843c('0x5'));var BPromise=require(_0x843c('0x6'));var Mustache=require(_0x843c('0x7'));var util=require('util');var path=require(_0x843c('0x8'));var sox=require(_0x843c('0x9'));var csv=require(_0x843c('0xa'));var ejs=require(_0x843c('0xb'));var fs=require('fs');var fs_extra=require(_0x843c('0xc'));var _=require('lodash');var squel=require(_0x843c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x843c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x843c('0xf'));var Papa=require(_0x843c('0x10'));var Redis=require(_0x843c('0x11'));var authService=require(_0x843c('0x12'));var qs=require(_0x843c('0x13'));var as=require(_0x843c('0x14'));var hardwareService=require(_0x843c('0x15'));var logger=require(_0x843c('0x16'))('api');var utils=require(_0x843c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x843c('0x18'));var db=require(_0x843c('0x19'))['db'];var jayson=require(_0x843c('0x1a'));var client=jayson[_0x843c('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5530ea,_0x5ab39f,_0x112085,_0xe8ccba){return new BPromise(function(_0x260c6c,_0x503e00){var _0x5f400d=_0xe8ccba||client;return _0x5f400d['request'](_0x5530ea,_0x112085)['then'](function(_0x500e36){logger[_0x843c('0x1c')]('Network,\x20%s,\x20%s',_0x5ab39f,_0x843c('0x1d'));logger[_0x843c('0x1e')](_0x843c('0x1f'),_0x5ab39f,_0x843c('0x1d'),JSON['stringify'](_0x500e36));if(_0x500e36['error']){if(_0x500e36[_0x843c('0x20')][_0x843c('0x21')]===0x1f4){logger[_0x843c('0x20')](_0x843c('0x22'),_0x5ab39f,_0x500e36[_0x843c('0x20')][_0x843c('0x23')]);return _0x503e00(_0x500e36['error'][_0x843c('0x23')]);}logger[_0x843c('0x20')](_0x843c('0x22'),_0x5ab39f,_0x500e36['error'][_0x843c('0x23')]);return _0x260c6c(_0x500e36[_0x843c('0x20')][_0x843c('0x23')]);}else{logger['info'](_0x843c('0x22'),_0x5ab39f,_0x843c('0x1d'));_0x260c6c(_0x500e36['result'][_0x843c('0x23')]);}})[_0x843c('0x24')](function(_0x1e8f6e){logger[_0x843c('0x20')](_0x843c('0x22'),_0x5ab39f,_0x1e8f6e);_0x503e00(_0x1e8f6e);});});}function respondWithStatusCode(_0x32b4e5,_0x380045){_0x380045=_0x380045||0xcc;return function(_0x1dbd64){if(_0x1dbd64){return _0x32b4e5['sendStatus'](_0x380045);}return _0x32b4e5['status'](_0x380045)[_0x843c('0x25')]();};}function respondWithResult(_0x3c1f75,_0x33a3d7){_0x33a3d7=_0x33a3d7||0xc8;return function(_0x485571){if(_0x485571){return _0x3c1f75[_0x843c('0x26')](_0x33a3d7)[_0x843c('0x27')](_0x485571);}};}function respondWithFilteredResult(_0x4948d3,_0xf09eca){return function(_0x5f2165){if(_0x5f2165){var _0x257947=typeof _0xf09eca['offset']==='undefined'&&typeof _0xf09eca[_0x843c('0x28')]==='undefined';var _0x1d61ff=_0x5f2165[_0x843c('0x29')];var _0x21aa1e=_0x257947?0x0:_0xf09eca['offset'];var _0x2d44bf=_0x257947?_0x5f2165[_0x843c('0x29')]:_0xf09eca[_0x843c('0x2a')]+_0xf09eca[_0x843c('0x28')];var _0x41da5d;if(_0x2d44bf>=_0x1d61ff){_0x2d44bf=_0x1d61ff;_0x41da5d=0xc8;}else{_0x41da5d=0xce;}_0x4948d3[_0x843c('0x26')](_0x41da5d);return _0x4948d3[_0x843c('0x2b')](_0x843c('0x2c'),_0x21aa1e+'-'+_0x2d44bf+'/'+_0x1d61ff)[_0x843c('0x27')](_0x5f2165);}return null;};}function patchUpdates(_0x4adcc6){return function(_0x2a8ba3){try{jsonpatch['apply'](_0x2a8ba3,_0x4adcc6,!![]);}catch(_0x212f07){return BPromise['reject'](_0x212f07);}return _0x2a8ba3[_0x843c('0x2d')]();};}function saveUpdates(_0x7edc2f,_0x252223){return function(_0x11454){if(_0x11454){return _0x11454[_0x843c('0x2e')](_0x7edc2f)[_0x843c('0x2f')](function(_0x1341a7){return _0x1341a7;});}return null;};}function removeEntity(_0x1236fd,_0x3d577c){return function(_0x385c82){if(_0x385c82){return _0x385c82[_0x843c('0x30')]()[_0x843c('0x2f')](function(){_0x1236fd[_0x843c('0x26')](0xcc)[_0x843c('0x25')]();});}};}function handleEntityNotFound(_0x2c5ac9,_0xf0134a){return function(_0xe911d0){if(!_0xe911d0){_0x2c5ac9[_0x843c('0x31')](0x194);}return _0xe911d0;};}function handleError(_0x5cf9d4,_0x405f69){_0x405f69=_0x405f69||0x1f4;return function(_0x258c91){logger[_0x843c('0x20')](_0x258c91[_0x843c('0x32')]);if(_0x258c91[_0x843c('0x33')]){delete _0x258c91[_0x843c('0x33')];}_0x5cf9d4[_0x843c('0x26')](_0x405f69)[_0x843c('0x34')](_0x258c91);};}exports['index']=function(_0x286196,_0x1241c3){var _0x3c98f6={},_0x28fea0={},_0xe2210={'count':0x0,'rows':[]};var _0x256c24=_['map'](db[_0x843c('0x35')][_0x843c('0x36')],function(_0x53eb36){return{'name':_0x53eb36['fieldName'],'type':_0x53eb36[_0x843c('0x37')][_0x843c('0x38')]};});_0x28fea0[_0x843c('0x39')]=_[_0x843c('0x3a')](_0x256c24,_0x843c('0x33'));_0x28fea0['query']=_[_0x843c('0x3b')](_0x286196['query']);_0x28fea0[_0x843c('0x3c')]=_[_0x843c('0x3d')](_0x28fea0['model'],_0x28fea0[_0x843c('0x3e')]);_0x3c98f6['attributes']=_['intersection'](_0x28fea0[_0x843c('0x39')],qs[_0x843c('0x3f')](_0x286196['query'][_0x843c('0x3f')]));_0x3c98f6[_0x843c('0x40')]=_0x3c98f6[_0x843c('0x40')][_0x843c('0x41')]?_0x3c98f6[_0x843c('0x40')]:_0x28fea0[_0x843c('0x39')];if(!_0x286196[_0x843c('0x3e')][_0x843c('0x42')](_0x843c('0x43'))){_0x3c98f6[_0x843c('0x28')]=qs[_0x843c('0x28')](_0x286196[_0x843c('0x3e')]['limit']);_0x3c98f6['offset']=qs['offset'](_0x286196['query'][_0x843c('0x2a')]);}_0x3c98f6['order']=qs[_0x843c('0x44')](_0x286196['query'][_0x843c('0x44')]);_0x3c98f6[_0x843c('0x45')]=qs[_0x843c('0x3c')](_[_0x843c('0x46')](_0x286196[_0x843c('0x3e')],_0x28fea0['filters']),_0x256c24);if(_0x286196[_0x843c('0x3e')][_0x843c('0x47')]){_0x3c98f6[_0x843c('0x45')]=_[_0x843c('0x48')](_0x3c98f6[_0x843c('0x45')],{'$or':_[_0x843c('0x3a')](_0x256c24,function(_0x34dfed){if(_0x34dfed['type']!=='VIRTUAL'){var _0xd13670={};_0xd13670[_0x34dfed[_0x843c('0x33')]]={'$like':'%'+_0x286196[_0x843c('0x3e')][_0x843c('0x47')]+'%'};return _0xd13670;}})});}_0x3c98f6=_[_0x843c('0x48')]({},_0x3c98f6,_0x286196['options']);var _0x41bd28={'where':_0x3c98f6['where']};return db[_0x843c('0x35')][_0x843c('0x29')](_0x41bd28)['then'](function(_0x5c421c){_0xe2210[_0x843c('0x29')]=_0x5c421c;if(_0x286196['query'][_0x843c('0x49')]){_0x3c98f6[_0x843c('0x4a')]=[{'all':!![]}];}return db[_0x843c('0x35')][_0x843c('0x4b')](_0x3c98f6);})[_0x843c('0x2f')](function(_0x5078f1){_0xe2210[_0x843c('0x4c')]=_0x5078f1;return _0xe2210;})[_0x843c('0x2f')](respondWithFilteredResult(_0x1241c3,_0x3c98f6))['catch'](handleError(_0x1241c3,null));};exports[_0x843c('0x4d')]=function(_0x292ca3,_0xf08e6b){var _0xc44e70={'raw':!![],'where':{'id':_0x292ca3[_0x843c('0x4e')]['id']}},_0x171f80={};_0x171f80['model']=_[_0x843c('0x3b')](db['Network'][_0x843c('0x36')]);_0x171f80[_0x843c('0x3e')]=_[_0x843c('0x3b')](_0x292ca3['query']);_0x171f80[_0x843c('0x3c')]=_[_0x843c('0x3d')](_0x171f80[_0x843c('0x39')],_0x171f80['query']);_0xc44e70[_0x843c('0x40')]=_[_0x843c('0x3d')](_0x171f80[_0x843c('0x39')],qs['fields'](_0x292ca3[_0x843c('0x3e')][_0x843c('0x3f')]));_0xc44e70['attributes']=_0xc44e70[_0x843c('0x40')][_0x843c('0x41')]?_0xc44e70[_0x843c('0x40')]:_0x171f80[_0x843c('0x39')];if(_0x292ca3[_0x843c('0x3e')][_0x843c('0x49')]){_0xc44e70[_0x843c('0x4a')]=[{'all':!![]}];}_0xc44e70=_['merge']({},_0xc44e70,_0x292ca3['options']);return db[_0x843c('0x35')]['find'](_0xc44e70)[_0x843c('0x2f')](handleEntityNotFound(_0xf08e6b,null))[_0x843c('0x2f')](respondWithResult(_0xf08e6b,null))['catch'](handleError(_0xf08e6b,null));};exports[_0x843c('0x4f')]=function(_0x5052c2,_0xa87086,_0x36c309){var _0x3a0943;return db['sequelize'][_0x843c('0x50')](function(_0x103b0c){return db[_0x843c('0x35')][_0x843c('0x4f')](_0x5052c2[_0x843c('0x51')],{'raw':!![]})['then'](function(_0x29b6e6){_0x3a0943=_0x29b6e6;return db[_0x843c('0x35')][_0x843c('0x4b')]({'where':{'type':_0x5052c2[_0x843c('0x51')][_0x843c('0x37')]},'raw':!![]});})['then'](function(_0x11aa89){if(_0x3a0943[_0x843c('0x37')]['toUpperCase']()==_0x843c('0x52')){var _0x33848d=fs[_0x843c('0x53')](path[_0x843c('0x54')](config[_0x843c('0x55')],_0x843c('0x56')),'utf8');var _0x29a384=ejs[_0x843c('0x57')](_0x33848d,{'networks':_0x11aa89||[]});fs[_0x843c('0x58')](_0x843c('0x59'),_0x29a384);return respondWithRpcPromise(_0x843c('0x5a'),_0x843c('0x4f'),{'module':_0x843c('0x5b')});}else if(_0x3a0943[_0x843c('0x37')]['toUpperCase']()=='TURN'){var _0x1b7799=fs[_0x843c('0x53')](path[_0x843c('0x54')](config[_0x843c('0x55')],_0x843c('0x5c')),'utf8');var _0x2f478d=ejs[_0x843c('0x57')](_0x1b7799,{'networks':_0x11aa89||[]});fs['writeFileSync'](_0x843c('0x5d'),_0x2f478d);return respondWithRpcPromise(_0x843c('0x5a'),_0x843c('0x4f'),{'module':_0x843c('0x5b')});}else{var _0x1150c4=fs['readFileSync'](path[_0x843c('0x54')](config[_0x843c('0x55')],'server/files/templates/network.ejs'),_0x843c('0x5e'));var _0x1732f2=ejs[_0x843c('0x57')](_0x1150c4,{'networks':_0x11aa89||[]});fs[_0x843c('0x58')](util[_0x843c('0x5f')](_0x843c('0x60'),_0x5052c2[_0x843c('0x51')]['type'][_0x843c('0x61')]()),_0x1732f2);return respondWithRpcPromise('Reload',_0x843c('0x4f'),{'module':_0x843c('0x62')});}return null;})[_0x843c('0x2f')](function(){return _0x3a0943;});})[_0x843c('0x2f')](respondWithResult(_0xa87086,0xc9))['catch'](handleError(_0xa87086,null));};exports[_0x843c('0x2e')]=function(_0x7c5314,_0xec6df6,_0x54e07d){var _0x381d12;return db[_0x843c('0x63')][_0x843c('0x50')](function(_0x257642){return db['Network']['find']({'where':{'id':_0x7c5314['params']['id']}})[_0x843c('0x2f')](handleEntityNotFound(_0xec6df6,null))['then'](saveUpdates(_0x7c5314[_0x843c('0x51')],null))['then'](function(_0x51d6d8){if(_0x51d6d8){_0x381d12=_0x51d6d8;return db['Network'][_0x843c('0x4b')]({'where':{'type':_0x381d12['type']},'raw':!![]});}return null;})[_0x843c('0x2f')](function(_0x29e20c){if(_0x381d12[_0x843c('0x37')][_0x843c('0x64')]()==_0x843c('0x52')){var _0xc44bc5=fs[_0x843c('0x53')](path[_0x843c('0x54')](config[_0x843c('0x55')],_0x843c('0x56')),_0x843c('0x5e'));var _0x572b69=ejs[_0x843c('0x57')](_0xc44bc5,{'networks':_0x29e20c||[]});fs['writeFileSync'](_0x843c('0x59'),_0x572b69);return respondWithRpcPromise(_0x843c('0x5a'),_0x843c('0x2e'),{'module':_0x843c('0x5b')});}else if(_0x381d12[_0x843c('0x37')][_0x843c('0x64')]()=='TURN'){var _0xea95ab=fs[_0x843c('0x53')](path[_0x843c('0x54')](config[_0x843c('0x55')],_0x843c('0x5c')),_0x843c('0x5e'));var _0x5dbcc4=ejs['render'](_0xea95ab,{'networks':_0x29e20c||[]});fs[_0x843c('0x58')](_0x843c('0x5d'),_0x5dbcc4);return respondWithRpcPromise(_0x843c('0x5a'),_0x843c('0x2e'),{'module':_0x843c('0x5b')});}else{var _0x1983f6=fs[_0x843c('0x53')](path[_0x843c('0x54')](config[_0x843c('0x55')],'server/files/templates/network.ejs'),_0x843c('0x5e'));var _0x1520f3=ejs[_0x843c('0x57')](_0x1983f6,{'networks':_0x29e20c||[]});fs['writeFileSync'](util['format'](_0x843c('0x60'),_0x7c5314['body'][_0x843c('0x37')]['toLowerCase']()),_0x1520f3);return respondWithRpcPromise('Reload',_0x843c('0x2e'),{'module':'chan_sip.so'});}return null;})[_0x843c('0x2f')](function(_0x428b13){if(_0x428b13){return _0x381d12;}return null;});})['then'](respondWithResult(_0xec6df6,null))[_0x843c('0x24')](handleError(_0xec6df6,null));};exports['destroy']=function(_0x19e7f3,_0x36ca90,_0x43b314){var _0x262008;return db[_0x843c('0x35')][_0x843c('0x65')]({'where':{'id':_0x19e7f3[_0x843c('0x4e')]['id']}})[_0x843c('0x2f')](function(_0x449ba8){_0x262008=_0x449ba8;return _0x449ba8;})[_0x843c('0x2f')](handleEntityNotFound(_0x36ca90,null))[_0x843c('0x2f')](removeEntity(_0x36ca90,null))[_0x843c('0x2f')](function(){if(_0x262008){return db['Network'][_0x843c('0x4b')]({'where':{'type':_0x262008[_0x843c('0x37')]},'raw':!![]});}})['then'](function(_0x56d9ae){if(_0x262008[_0x843c('0x37')][_0x843c('0x64')]()=='STUN'){var _0x5d747c=fs[_0x843c('0x53')](path[_0x843c('0x54')](config[_0x843c('0x55')],_0x843c('0x56')),_0x843c('0x5e'));var _0x5c811f=ejs[_0x843c('0x57')](_0x5d747c,{'networks':_0x56d9ae||[]});fs[_0x843c('0x58')](_0x843c('0x59'),_0x5c811f);return respondWithRpcPromise(_0x843c('0x5a'),_0x843c('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x262008[_0x843c('0x37')]['toUpperCase']()==_0x843c('0x66')){var _0x203947=fs[_0x843c('0x53')](path[_0x843c('0x54')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x843c('0x5e'));var _0x5a9c1e=ejs['render'](_0x203947,{'networks':_0x56d9ae||[]});fs[_0x843c('0x58')](_0x843c('0x5d'),_0x5a9c1e);return respondWithRpcPromise('Reload','destroy',{'module':_0x843c('0x5b')});}else{var _0x51d49f=fs[_0x843c('0x53')](path['join'](config[_0x843c('0x55')],_0x843c('0x67')),_0x843c('0x5e'));var _0x893f62=ejs[_0x843c('0x57')](_0x51d49f,{'networks':_0x56d9ae||[]});fs[_0x843c('0x58')](util[_0x843c('0x5f')](_0x843c('0x60'),_0x19e7f3[_0x843c('0x51')][_0x843c('0x37')][_0x843c('0x61')]()),_0x893f62);return respondWithRpcPromise(_0x843c('0x5a'),_0x843c('0x30'),{'module':_0x843c('0x62')});}return null;})[_0x843c('0x24')](handleError(_0x36ca90,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 858c797..84e0b3e 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','Network','network','lodash'];(function(_0x1e14ce,_0x2c3391){var _0x359cb1=function(_0x4ad050){while(--_0x4ad050){_0x1e14ce['push'](_0x1e14ce['shift']());}};_0x359cb1(++_0x2c3391);}(_0xaa88,0x137));var _0x8aa8=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0xaa88[_0x133fe4];return _0x4c4017;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd547=['define','../../config/logger','api','moment','bluebird','rimraf','./network.attributes'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd547,0x1c1));var _0x7d54=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0xd547[_0x17406e];return _0x2bfc5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d54('0x0'))(_0x7d54('0x1'));var moment=require(_0x7d54('0x2'));var BPromise=require(_0x7d54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d54('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x5'));module['exports']=function(_0x296dd6,_0x37defc){return _0x296dd6[_0x7d54('0x6')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 0452afa..f450c47 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0xf8c401,_0x1ad45e){_0xf8c401=_0xf8c401-0x0;var _0x212989=_0x7a54[_0xf8c401];return _0x212989;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x26161d,_0x1e5132){var _0x4bcff3=function(_0x421ce0){while(--_0x421ce0){_0x26161d['push'](_0x26161d['shift']());}};_0x4bcff3(++_0x1e5132);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 89d31c9..dbc52f4 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 _0xfa24=['/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','/:id/applications','addApplications','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1e5a87,_0xad9d5){var _0x309977=function(_0x1763c5){while(--_0x1763c5){_0x1e5a87['push'](_0x1e5a87['shift']());}};_0x309977(++_0xad9d5);}(_0xfa24,0x188));var _0x4fa2=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0xfa24[_0x2d4661];return _0x42ed1e;};'use strict';var multer=require(_0x4fa2('0x0'));var util=require(_0x4fa2('0x1'));var path=require(_0x4fa2('0x2'));var timeout=require(_0x4fa2('0x3'));var express=require('express');var router=express[_0x4fa2('0x4')]();var fs_extra=require(_0x4fa2('0x5'));var auth=require(_0x4fa2('0x6'));var interaction=require(_0x4fa2('0x7'));var config=require(_0x4fa2('0x8'));var controller=require('./openchannelAccount.controller');router[_0x4fa2('0x9')]('/',auth[_0x4fa2('0xa')](),controller['index']);router['get'](_0x4fa2('0xb'),auth['isAuthenticated'](),controller[_0x4fa2('0xc')]);router['get'](_0x4fa2('0xd'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0xe')]);router[_0x4fa2('0x9')](_0x4fa2('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x4fa2('0x10'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x11')]);router[_0x4fa2('0x9')]('/:id/applications',auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x12')]);router[_0x4fa2('0x9')](_0x4fa2('0x13'),auth['isAuthenticated'](),controller[_0x4fa2('0x14')]);router[_0x4fa2('0x9')](_0x4fa2('0x15'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x16')]);router[_0x4fa2('0x17')]('/',auth[_0x4fa2('0xa')](),controller['create']);router[_0x4fa2('0x17')](_0x4fa2('0xf'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x18')]);router[_0x4fa2('0x17')](_0x4fa2('0x10'),auth[_0x4fa2('0xa')](),controller['addAnswer']);router[_0x4fa2('0x17')](_0x4fa2('0x19'),controller[_0x4fa2('0x1a')]);router['post'](_0x4fa2('0x1b'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x1c')]);router[_0x4fa2('0x17')](_0x4fa2('0x15'),auth[_0x4fa2('0xa')](),controller['addAgents']);router[_0x4fa2('0x17')]('/:id/send',auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x1d')]);router[_0x4fa2('0x1e')](_0x4fa2('0xd'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x1f')]);router[_0x4fa2('0x20')](_0x4fa2('0xd'),auth[_0x4fa2('0xa')](),controller['destroy']);router['delete'](_0x4fa2('0xf'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x21')]);router[_0x4fa2('0x20')](_0x4fa2('0x10'),auth['isAuthenticated'](),controller[_0x4fa2('0x22')]);router['delete'](_0x4fa2('0x15'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x23')]);module[_0x4fa2('0x24')]=router; \ No newline at end of file +var _0x557d=['/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x557d,0x88));var _0xd557=function(_0x59b4e6,_0x142f5b){_0x59b4e6=_0x59b4e6-0x0;var _0x165939=_0x557d[_0x59b4e6];return _0x165939;};'use strict';var multer=require(_0xd557('0x0'));var util=require(_0xd557('0x1'));var path=require(_0xd557('0x2'));var timeout=require(_0xd557('0x3'));var express=require(_0xd557('0x4'));var router=express[_0xd557('0x5')]();var fs_extra=require(_0xd557('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd557('0x7'));var config=require(_0xd557('0x8'));var controller=require(_0xd557('0x9'));router[_0xd557('0xa')]('/',auth[_0xd557('0xb')](),controller[_0xd557('0xc')]);router[_0xd557('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd557('0xd')]);router['get'](_0xd557('0xe'),auth[_0xd557('0xb')](),controller[_0xd557('0xf')]);router['get'](_0xd557('0x10'),auth[_0xd557('0xb')](),controller[_0xd557('0x11')]);router[_0xd557('0xa')](_0xd557('0x12'),auth[_0xd557('0xb')](),controller[_0xd557('0x13')]);router[_0xd557('0xa')]('/:id/applications',auth[_0xd557('0xb')](),controller['getApplications']);router[_0xd557('0xa')]('/:id/interactions',auth[_0xd557('0xb')](),controller[_0xd557('0x14')]);router[_0xd557('0xa')](_0xd557('0x15'),auth[_0xd557('0xb')](),controller[_0xd557('0x16')]);router[_0xd557('0x17')]('/',auth['isAuthenticated'](),controller[_0xd557('0x18')]);router[_0xd557('0x17')](_0xd557('0x10'),auth[_0xd557('0xb')](),controller[_0xd557('0x19')]);router[_0xd557('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd557('0x1a')]);router[_0xd557('0x17')](_0xd557('0x1b'),controller[_0xd557('0x1c')]);router[_0xd557('0x17')](_0xd557('0x1d'),auth['isAuthenticated'](),controller[_0xd557('0x1e')]);router['post'](_0xd557('0x15'),auth[_0xd557('0xb')](),controller[_0xd557('0x1f')]);router[_0xd557('0x17')](_0xd557('0x20'),auth['isAuthenticated'](),controller[_0xd557('0x21')]);router[_0xd557('0x22')](_0xd557('0xe'),auth[_0xd557('0xb')](),controller[_0xd557('0x23')]);router[_0xd557('0x24')](_0xd557('0xe'),auth[_0xd557('0xb')](),controller[_0xd557('0x25')]);router[_0xd557('0x24')](_0xd557('0x10'),auth[_0xd557('0xb')](),controller[_0xd557('0x26')]);router[_0xd557('0x24')](_0xd557('0x12'),auth[_0xd557('0xb')](),controller[_0xd557('0x27')]);router[_0xd557('0x24')](_0xd557('0x15'),auth['isAuthenticated'](),controller[_0xd557('0x28')]);module[_0xd557('0x29')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 72d7d7d..9da20f1 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 _0x2c49=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','STRING','generate'];(function(_0x34bc84,_0x16f1b1){var _0x32b709=function(_0x454a83){while(--_0x454a83){_0x34bc84['push'](_0x34bc84['shift']());}};_0x32b709(++_0x16f1b1);}(_0x2c49,0x170));var _0x92c4=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x2c49[_0x671369];return _0x33f2b4;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x92c4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x92c4('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x92c4('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x92c4('0x3')]();}},'replyUri':{'type':Sequelize[_0x92c4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x92c4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x92c4('0x4')],'defaultValue':function(){return _0x92c4('0x5');}},'notificationSound':{'type':Sequelize[_0x92c4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x92c4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x92c4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x92c4('0x2')]},'queueTransfer':{'type':Sequelize[_0x92c4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x92c4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x92c4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x92c4('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x92c4('0x6')],'defaultValue':![],'comment':_0x92c4('0x8'),'set':function(_0x341cb2){if(!_0x341cb2)this[_0x92c4('0x9')](_0x92c4('0xa'),null);this[_0x92c4('0x9')](_0x92c4('0xb'),_0x341cb2);}}}; \ No newline at end of file +var _0x77ef=['randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0xef3e80,_0x1edef3){var _0x47887d=function(_0x5e1162){while(--_0x5e1162){_0xef3e80['push'](_0xef3e80['shift']());}};_0x47887d(++_0x1edef3);}(_0x77ef,0x137));var _0xf77e=function(_0x3a1dc0,_0x34b610){_0x3a1dc0=_0x3a1dc0-0x0;var _0x28af92=_0x77ef[_0x3a1dc0];return _0x28af92;};'use strict';var Sequelize=require(_0xf77e('0x0'));var rs=require(_0xf77e('0x1'));module[_0xf77e('0x2')]={'name':{'type':Sequelize[_0xf77e('0x3')],'unique':_0xf77e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xf77e('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xf77e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf77e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf77e('0x5')],'defaultValue':function(){return _0xf77e('0x6');}},'notificationSound':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf77e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf77e('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf77e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf77e('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf77e('0x7')],'defaultValue':![],'comment':_0xf77e('0x9'),'set':function(_0x5440d5){if(!_0x5440d5)this[_0xf77e('0xa')](_0xf77e('0xb'),null);this[_0xf77e('0xa')](_0xf77e('0xc'),_0x5440d5);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b4a57fa..d88cf17 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 _0x1a94=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','findAndCountAll','getApplications','Contact','User','fullname','Tag','Tags','color','tag','addAgents','omit','removeAgents','emit','userOpenchannelAccount:remove','getAgents','CmList','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','options','includeAll','include','findAll','rows','show','params','fields'];(function(_0x1f6e71,_0x19360b){var _0x2271aa=function(_0x2f0431){while(--_0x2f0431){_0x1f6e71['push'](_0x1f6e71['shift']());}};_0x2271aa(++_0x19360b);}(_0x1a94,0x1e1));var _0x41a9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1a94[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x41a9('0x0'));var rimraf=require(_0x41a9('0x1'));var zipdir=require(_0x41a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41a9('0x3'));var moment=require(_0x41a9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x41a9('0x5'));var sox=require(_0x41a9('0x6'));var csv=require('to-csv');var ejs=require(_0x41a9('0x7'));var fs=require('fs');var fs_extra=require(_0x41a9('0x8'));var _=require(_0x41a9('0x9'));var squel=require(_0x41a9('0xa'));var crypto=require(_0x41a9('0xb'));var jsforce=require(_0x41a9('0xc'));var deskjs=require(_0x41a9('0xd'));var toCsv=require(_0x41a9('0xe'));var querystring=require('querystring');var Papa=require(_0x41a9('0xf'));var Redis=require(_0x41a9('0x10'));var authService=require(_0x41a9('0x11'));var qs=require(_0x41a9('0x12'));var as=require(_0x41a9('0x13'));var hardwareService=require(_0x41a9('0x14'));var logger=require(_0x41a9('0x15'))(_0x41a9('0x16'));var utils=require('../../config/utils');var config=require(_0x41a9('0x17'));var licenseUtil=require(_0x41a9('0x18'));var db=require(_0x41a9('0x19'))['db'];config[_0x41a9('0x1a')]=_['defaults'](config[_0x41a9('0x1a')],{'host':_0x41a9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41a9('0x1a')]));require(_0x41a9('0x1c'))[_0x41a9('0x1d')](socket);var jayson=require(_0x41a9('0x1e'));var client=jayson[_0x41a9('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x41a9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x50a7c4,_0x39019a,_0xa5e3d3,_0x2d21e6){return new BPromise(function(_0x5c11b3,_0x346074){var _0x1b54da=_0x2d21e6||client;return _0x1b54da[_0x41a9('0x21')](_0x50a7c4,_0xa5e3d3)[_0x41a9('0x22')](function(_0x13a8bb){logger[_0x41a9('0x23')](_0x41a9('0x24'),_0x39019a,_0x41a9('0x25'));logger[_0x41a9('0x26')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x39019a,_0x41a9('0x25'),JSON[_0x41a9('0x27')](_0x13a8bb));if(_0x13a8bb[_0x41a9('0x28')]){if(_0x13a8bb[_0x41a9('0x28')]['code']===0x1f4){logger['error'](_0x41a9('0x24'),_0x39019a,_0x13a8bb[_0x41a9('0x28')][_0x41a9('0x29')]);return _0x346074(_0x13a8bb[_0x41a9('0x28')][_0x41a9('0x29')]);}logger[_0x41a9('0x28')](_0x41a9('0x24'),_0x39019a,_0x13a8bb['error']['message']);return _0x5c11b3(_0x13a8bb['error'][_0x41a9('0x29')]);}else{logger['info'](_0x41a9('0x24'),_0x39019a,_0x41a9('0x25'));_0x5c11b3(_0x13a8bb['result']['message']);}})[_0x41a9('0x2a')](function(_0x329384){logger[_0x41a9('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x39019a,_0x329384);_0x346074(_0x329384);});});}function respondWithStatusCode(_0x84dc06,_0x29f234){_0x29f234=_0x29f234||0xcc;return function(_0x4a75ca){if(_0x4a75ca){return _0x84dc06[_0x41a9('0x2b')](_0x29f234);}return _0x84dc06[_0x41a9('0x2c')](_0x29f234)[_0x41a9('0x2d')]();};}function respondWithResult(_0x179871,_0x4677a3){_0x4677a3=_0x4677a3||0xc8;return function(_0xc28853){if(_0xc28853){return _0x179871['status'](_0x4677a3)[_0x41a9('0x2e')](_0xc28853);}};}function respondWithFilteredResult(_0x35c010,_0x55d22c){return function(_0xab6605){if(_0xab6605){var _0x39f608=typeof _0x55d22c[_0x41a9('0x2f')]==='undefined'&&typeof _0x55d22c['limit']===_0x41a9('0x30');var _0x1e0e11=_0xab6605[_0x41a9('0x31')];var _0x3aa50b=_0x39f608?0x0:_0x55d22c[_0x41a9('0x2f')];var _0x39c414=_0x39f608?_0xab6605['count']:_0x55d22c['offset']+_0x55d22c['limit'];var _0x1f8c9f;if(_0x39c414>=_0x1e0e11){_0x39c414=_0x1e0e11;_0x1f8c9f=0xc8;}else{_0x1f8c9f=0xce;}_0x35c010['status'](_0x1f8c9f);return _0x35c010[_0x41a9('0x32')]('Content-Range',_0x3aa50b+'-'+_0x39c414+'/'+_0x1e0e11)[_0x41a9('0x2e')](_0xab6605);}return null;};}function patchUpdates(_0x50bafe){return function(_0x331a29){try{jsonpatch[_0x41a9('0x33')](_0x331a29,_0x50bafe,!![]);}catch(_0x7b5bef){return BPromise[_0x41a9('0x34')](_0x7b5bef);}return _0x331a29[_0x41a9('0x35')]();};}function saveUpdates(_0x292c97,_0xc41e4a){return function(_0x5e3feb){if(_0x5e3feb){return _0x5e3feb[_0x41a9('0x36')](_0x292c97)['then'](function(_0x57b60f){return _0x57b60f;});}return null;};}function removeEntity(_0x35bf15,_0x624b81){return function(_0x3b3db3){if(_0x3b3db3){return _0x3b3db3[_0x41a9('0x37')]()[_0x41a9('0x22')](function(){var _0x2234c1=_0x3b3db3[_0x41a9('0x38')]({'plain':!![]});var _0x240d70=_0x41a9('0x39');return db[_0x41a9('0x3a')]['destroy']({'where':{'type':_0x240d70,'resourceId':_0x2234c1['id']}})[_0x41a9('0x22')](function(){return _0x3b3db3;});})['then'](function(){_0x35bf15[_0x41a9('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x80e5e6,_0x35ceee){return function(_0x263677){if(!_0x263677){_0x80e5e6[_0x41a9('0x2b')](0x194);}return _0x263677;};}function handleError(_0x3ef824,_0x95f36a){_0x95f36a=_0x95f36a||0x1f4;return function(_0x33e2b6){logger['error'](_0x33e2b6[_0x41a9('0x3b')]);if(_0x33e2b6[_0x41a9('0x3c')]){delete _0x33e2b6[_0x41a9('0x3c')];}_0x3ef824[_0x41a9('0x2c')](_0x95f36a)[_0x41a9('0x3d')](_0x33e2b6);};}exports[_0x41a9('0x3e')]=function(_0x23f1c8,_0x30ede4){var _0x40bb7c={'include':[{'model':db[_0x41a9('0x3f')],'as':_0x41a9('0x40')}]},_0x29e2e2={},_0x2d6e56={'count':0x0,'rows':[]};var _0x25d237=_[_0x41a9('0x41')](db[_0x41a9('0x42')][_0x41a9('0x43')],function(_0xef61f7){return{'name':_0xef61f7[_0x41a9('0x44')],'type':_0xef61f7['type'][_0x41a9('0x45')]};});_0x29e2e2[_0x41a9('0x46')]=_[_0x41a9('0x41')](_0x25d237,_0x41a9('0x3c'));_0x29e2e2['query']=_[_0x41a9('0x47')](_0x23f1c8[_0x41a9('0x48')]);_0x29e2e2[_0x41a9('0x49')]=_[_0x41a9('0x4a')](_0x29e2e2['model'],_0x29e2e2[_0x41a9('0x48')]);_0x40bb7c[_0x41a9('0x4b')]=_['intersection'](_0x29e2e2[_0x41a9('0x46')],qs['fields'](_0x23f1c8['query']['fields']));_0x40bb7c[_0x41a9('0x4b')]=_0x40bb7c[_0x41a9('0x4b')][_0x41a9('0x4c')]?_0x40bb7c['attributes']:_0x29e2e2['model'];if(!_0x23f1c8[_0x41a9('0x48')][_0x41a9('0x4d')](_0x41a9('0x4e'))){_0x40bb7c['limit']=qs[_0x41a9('0x4f')](_0x23f1c8[_0x41a9('0x48')][_0x41a9('0x4f')]);_0x40bb7c[_0x41a9('0x2f')]=qs[_0x41a9('0x2f')](_0x23f1c8[_0x41a9('0x48')][_0x41a9('0x2f')]);}_0x40bb7c[_0x41a9('0x50')]=qs['sort'](_0x23f1c8[_0x41a9('0x48')][_0x41a9('0x51')]);_0x40bb7c['where']=qs[_0x41a9('0x49')](_[_0x41a9('0x52')](_0x23f1c8['query'],_0x29e2e2[_0x41a9('0x49')]),_0x25d237);if(_0x23f1c8['query'][_0x41a9('0x53')]){_0x40bb7c['where']=_[_0x41a9('0x54')](_0x40bb7c[_0x41a9('0x55')],{'$or':_[_0x41a9('0x41')](_0x25d237,function(_0x1819d9){if(_0x1819d9[_0x41a9('0x56')]!=='VIRTUAL'){var _0x3061de={};_0x3061de[_0x1819d9['name']]={'$like':'%'+_0x23f1c8[_0x41a9('0x48')][_0x41a9('0x53')]+'%'};return _0x3061de;}})});}_0x40bb7c=_[_0x41a9('0x54')]({},_0x40bb7c,_0x23f1c8[_0x41a9('0x57')]);var _0x5da6ae={'where':_0x40bb7c[_0x41a9('0x55')]};return db['OpenchannelAccount']['count'](_0x5da6ae)['then'](function(_0x59b33f){_0x2d6e56['count']=_0x59b33f;if(_0x23f1c8[_0x41a9('0x48')][_0x41a9('0x58')]){_0x40bb7c[_0x41a9('0x59')]=[{'all':!![]}];}return db[_0x41a9('0x42')][_0x41a9('0x5a')](_0x40bb7c);})[_0x41a9('0x22')](function(_0x4fe38b){_0x2d6e56[_0x41a9('0x5b')]=_0x4fe38b;return _0x2d6e56;})[_0x41a9('0x22')](respondWithFilteredResult(_0x30ede4,_0x40bb7c))['catch'](handleError(_0x30ede4,null));};exports[_0x41a9('0x5c')]=function(_0xe2b0db,_0x3b96bd){var _0x5ab736={'raw':![],'where':{'id':_0xe2b0db[_0x41a9('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x41a9('0x40')}]},_0xf90690={};_0xf90690['model']=_[_0x41a9('0x47')](db[_0x41a9('0x42')][_0x41a9('0x43')]);_0xf90690[_0x41a9('0x48')]=_[_0x41a9('0x47')](_0xe2b0db[_0x41a9('0x48')]);_0xf90690[_0x41a9('0x49')]=_['intersection'](_0xf90690[_0x41a9('0x46')],_0xf90690[_0x41a9('0x48')]);_0x5ab736[_0x41a9('0x4b')]=_[_0x41a9('0x4a')](_0xf90690[_0x41a9('0x46')],qs[_0x41a9('0x5e')](_0xe2b0db[_0x41a9('0x48')][_0x41a9('0x5e')]));_0x5ab736['attributes']=_0x5ab736[_0x41a9('0x4b')][_0x41a9('0x4c')]?_0x5ab736[_0x41a9('0x4b')]:_0xf90690[_0x41a9('0x46')];if(_0xe2b0db[_0x41a9('0x48')][_0x41a9('0x58')]){_0x5ab736[_0x41a9('0x59')]=[{'all':!![]}];}_0x5ab736=_[_0x41a9('0x54')]({},_0x5ab736,_0xe2b0db[_0x41a9('0x57')]);return db[_0x41a9('0x42')][_0x41a9('0x5f')](_0x5ab736)[_0x41a9('0x22')](handleEntityNotFound(_0x3b96bd,null))[_0x41a9('0x22')](respondWithResult(_0x3b96bd,null))[_0x41a9('0x2a')](handleError(_0x3b96bd,null));};exports['create']=function(_0x3c87e2,_0x4516b4){return db[_0x41a9('0x42')][_0x41a9('0x60')](_0x3c87e2[_0x41a9('0x61')],{})[_0x41a9('0x22')](function(_0x49f05e){var _0x3744d6=_0x3c87e2[_0x41a9('0x62')]['get']({'plain':!![]});if(!_0x3744d6)throw new Error(_0x41a9('0x63'));if(_0x3744d6[_0x41a9('0x64')]===_0x41a9('0x62')){var _0x431ec3=_0x49f05e[_0x41a9('0x38')]({'plain':!![]});var _0x3eb2f4=_0x41a9('0x39');return db[_0x41a9('0x65')][_0x41a9('0x5f')]({'where':{'name':_0x3eb2f4,'userProfileId':_0x3744d6[_0x41a9('0x66')]},'raw':!![]})[_0x41a9('0x22')](function(_0x540b66){if(_0x540b66&&_0x540b66[_0x41a9('0x67')]===0x0){return db[_0x41a9('0x3a')][_0x41a9('0x60')]({'name':_0x431ec3[_0x41a9('0x3c')],'resourceId':_0x431ec3['id'],'type':_0x540b66['name'],'sectionId':_0x540b66['id']},{})[_0x41a9('0x22')](function(){return _0x49f05e;});}else{return _0x49f05e;}})[_0x41a9('0x2a')](function(_0x5317b8){logger[_0x41a9('0x28')](_0x41a9('0x68'),_0x5317b8);throw _0x5317b8;});}return _0x49f05e;})[_0x41a9('0x22')](respondWithResult(_0x4516b4,0xc9))['catch'](handleError(_0x4516b4,null));};exports[_0x41a9('0x36')]=function(_0x1bbc65,_0x598680){if(_0x1bbc65[_0x41a9('0x61')]['id']){delete _0x1bbc65['body']['id'];}return db[_0x41a9('0x42')]['find']({'where':{'id':_0x1bbc65[_0x41a9('0x5d')]['id']},'include':[{'model':db[_0x41a9('0x3f')],'as':_0x41a9('0x40')}]})[_0x41a9('0x22')](handleEntityNotFound(_0x598680,null))[_0x41a9('0x22')](saveUpdates(_0x1bbc65[_0x41a9('0x61')],null))[_0x41a9('0x22')](respondWithResult(_0x598680,null))[_0x41a9('0x2a')](handleError(_0x598680,null));};exports[_0x41a9('0x37')]=function(_0x2e5b96,_0x12add9){return db[_0x41a9('0x42')][_0x41a9('0x5f')]({'where':{'id':_0x2e5b96['params']['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x12add9,null))[_0x41a9('0x22')](removeEntity(_0x12add9,null))[_0x41a9('0x2a')](handleError(_0x12add9,null));};exports[_0x41a9('0x69')]=function(_0x4bd55e,_0x19ce1f){return db[_0x41a9('0x42')][_0x41a9('0x69')]()['then'](respondWithResult(_0x19ce1f,null))[_0x41a9('0x2a')](handleError(_0x19ce1f,null));};exports[_0x41a9('0x6a')]=function(_0x38b3c1,_0x38a335,_0x4420ed){if(_0x38b3c1[_0x41a9('0x61')]['id']){delete _0x38b3c1[_0x41a9('0x61')]['id'];}return db[_0x41a9('0x42')]['find']({'where':{'id':_0x38b3c1['params']['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x38a335,null))[_0x41a9('0x22')](function(_0x236b67){if(_0x236b67){_0x38b3c1[_0x41a9('0x61')][_0x41a9('0x6b')]=_0x236b67['id'];return db[_0x41a9('0x6c')]['create'](_0x38b3c1[_0x41a9('0x61')]);}})[_0x41a9('0x22')](respondWithResult(_0x38a335,null))[_0x41a9('0x2a')](handleError(_0x38a335,null));};exports[_0x41a9('0x6d')]=function(_0x45b8a1,_0x10884e,_0x45ac7f){var _0x101206={'raw':![],'where':{}};var _0x1318bd={};var _0x27be12={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x41a9('0x6e')]({'where':{'id':_0x45b8a1[_0x41a9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x10884e,null))[_0x41a9('0x22')](function(_0x3ee19c){if(_0x3ee19c){_0x1318bd[_0x41a9('0x46')]=_['keys'](db[_0x41a9('0x6c')]['rawAttributes']);_0x1318bd['query']=_[_0x41a9('0x47')](_0x45b8a1[_0x41a9('0x48')]);_0x1318bd[_0x41a9('0x49')]=_[_0x41a9('0x4a')](_0x1318bd['model'],_0x1318bd['query']);_0x101206['attributes']=_['intersection'](_0x1318bd[_0x41a9('0x46')],qs['fields'](_0x45b8a1[_0x41a9('0x48')][_0x41a9('0x5e')]));_0x101206[_0x41a9('0x4b')]=_0x101206[_0x41a9('0x4b')][_0x41a9('0x4c')]?_0x101206['attributes']:_0x1318bd[_0x41a9('0x46')];if(!_0x45b8a1['query']['hasOwnProperty'](_0x41a9('0x4e'))){_0x101206[_0x41a9('0x4f')]=qs[_0x41a9('0x4f')](_0x45b8a1[_0x41a9('0x48')][_0x41a9('0x4f')]);_0x101206[_0x41a9('0x2f')]=qs['offset'](_0x45b8a1[_0x41a9('0x48')][_0x41a9('0x2f')]);}_0x101206[_0x41a9('0x50')]=qs[_0x41a9('0x51')](_0x45b8a1['query']['sort']);_0x101206['where']=qs[_0x41a9('0x49')](_['pick'](_0x45b8a1[_0x41a9('0x48')],_0x1318bd[_0x41a9('0x49')]));_0x101206[_0x41a9('0x55')][_0x41a9('0x6b')]=_0x3ee19c['id'];if(_0x45b8a1[_0x41a9('0x48')]['filter']){_0x101206[_0x41a9('0x55')]=_[_0x41a9('0x54')](_0x101206['where'],{'$or':_[_0x41a9('0x41')](_0x101206[_0x41a9('0x4b')],function(_0x2432d9){var _0x5af67b={};_0x5af67b[_0x2432d9]={'$like':'%'+_0x45b8a1[_0x41a9('0x48')]['filter']+'%'};return _0x5af67b;})});}_0x101206=_[_0x41a9('0x54')]({},_0x101206,_0x45b8a1[_0x41a9('0x57')]);return db[_0x41a9('0x6c')][_0x41a9('0x31')]({'where':_0x101206[_0x41a9('0x55')]})[_0x41a9('0x22')](function(_0x4c1b5f){_0x27be12[_0x41a9('0x31')]=_0x4c1b5f;if(_0x45b8a1[_0x41a9('0x48')][_0x41a9('0x58')]){_0x101206[_0x41a9('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x101206);})[_0x41a9('0x22')](function(_0x4b028e){_0x27be12['rows']=_0x4b028e;return _0x27be12;});}})[_0x41a9('0x22')](respondWithFilteredResult(_0x10884e,_0x101206))[_0x41a9('0x2a')](handleError(_0x10884e,null));};exports['removeDispositions']=function(_0x3054ba,_0x216eb5,_0x2b0ff2){return db['OpenchannelAccount'][_0x41a9('0x5f')]({'where':{'id':_0x3054ba['params']['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x216eb5,null))[_0x41a9('0x22')](function(_0x588be2){if(_0x588be2){return _0x588be2[_0x41a9('0x6f')](_0x3054ba[_0x41a9('0x48')][_0x41a9('0x70')]);}})['then'](respondWithStatusCode(_0x216eb5,null))['catch'](handleError(_0x216eb5,null));};exports['addAnswer']=function(_0x1437e6,_0x5ef225,_0x19d405){if(_0x1437e6[_0x41a9('0x61')]['id']){delete _0x1437e6['body']['id'];}return db[_0x41a9('0x42')][_0x41a9('0x5f')]({'where':{'id':_0x1437e6['params']['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x5ef225,null))[_0x41a9('0x22')](function(_0x2ca2f3){if(_0x2ca2f3){_0x1437e6[_0x41a9('0x61')][_0x41a9('0x6b')]=_0x2ca2f3['id'];return db[_0x41a9('0x71')][_0x41a9('0x60')](_0x1437e6[_0x41a9('0x61')]);}})[_0x41a9('0x22')](respondWithResult(_0x5ef225,null))[_0x41a9('0x2a')](handleError(_0x5ef225,null));};exports[_0x41a9('0x72')]=function(_0x1dfc36,_0x35ca62,_0x31f088){var _0x1553a8={'raw':![],'where':{}};var _0x353036={};var _0x427a74={'count':0x0,'rows':[]};return db[_0x41a9('0x42')][_0x41a9('0x6e')]({'where':{'id':_0x1dfc36[_0x41a9('0x5d')]['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x35ca62,null))[_0x41a9('0x22')](function(_0x111f73){if(_0x111f73){_0x353036[_0x41a9('0x46')]=_['keys'](db[_0x41a9('0x71')]['rawAttributes']);_0x353036[_0x41a9('0x48')]=_[_0x41a9('0x47')](_0x1dfc36[_0x41a9('0x48')]);_0x353036['filters']=_[_0x41a9('0x4a')](_0x353036[_0x41a9('0x46')],_0x353036[_0x41a9('0x48')]);_0x1553a8['attributes']=_[_0x41a9('0x4a')](_0x353036[_0x41a9('0x46')],qs[_0x41a9('0x5e')](_0x1dfc36['query'][_0x41a9('0x5e')]));_0x1553a8[_0x41a9('0x4b')]=_0x1553a8[_0x41a9('0x4b')][_0x41a9('0x4c')]?_0x1553a8[_0x41a9('0x4b')]:_0x353036[_0x41a9('0x46')];if(!_0x1dfc36[_0x41a9('0x48')][_0x41a9('0x4d')](_0x41a9('0x4e'))){_0x1553a8[_0x41a9('0x4f')]=qs[_0x41a9('0x4f')](_0x1dfc36[_0x41a9('0x48')][_0x41a9('0x4f')]);_0x1553a8['offset']=qs['offset'](_0x1dfc36['query']['offset']);}_0x1553a8['order']=qs['sort'](_0x1dfc36[_0x41a9('0x48')][_0x41a9('0x51')]);_0x1553a8['where']=qs[_0x41a9('0x49')](_['pick'](_0x1dfc36[_0x41a9('0x48')],_0x353036[_0x41a9('0x49')]));_0x1553a8[_0x41a9('0x55')][_0x41a9('0x6b')]=_0x111f73['id'];if(_0x1dfc36['query'][_0x41a9('0x53')]){_0x1553a8[_0x41a9('0x55')]=_[_0x41a9('0x54')](_0x1553a8['where'],{'$or':_['map'](_0x1553a8[_0x41a9('0x4b')],function(_0x3a9dd9){var _0x15fb47={};_0x15fb47[_0x3a9dd9]={'$like':'%'+_0x1dfc36[_0x41a9('0x48')][_0x41a9('0x53')]+'%'};return _0x15fb47;})});}_0x1553a8=_[_0x41a9('0x54')]({},_0x1553a8,_0x1dfc36[_0x41a9('0x57')]);return db[_0x41a9('0x71')]['count']({'where':_0x1553a8[_0x41a9('0x55')]})[_0x41a9('0x22')](function(_0x18c5b8){_0x427a74[_0x41a9('0x31')]=_0x18c5b8;if(_0x1dfc36['query'][_0x41a9('0x58')]){_0x1553a8['include']=[{'all':!![]}];}return db[_0x41a9('0x71')][_0x41a9('0x5a')](_0x1553a8);})[_0x41a9('0x22')](function(_0x29fec4){_0x427a74['rows']=_0x29fec4;return _0x427a74;});}})[_0x41a9('0x22')](respondWithFilteredResult(_0x35ca62,_0x1553a8))[_0x41a9('0x2a')](handleError(_0x35ca62,null));};exports[_0x41a9('0x73')]=function(_0x552b8e,_0x136d3c,_0x408b76){return db['OpenchannelAccount'][_0x41a9('0x5f')]({'where':{'id':_0x552b8e['params']['id']}})['then'](handleEntityNotFound(_0x136d3c,null))[_0x41a9('0x22')](function(_0x37b10a){if(_0x37b10a){return _0x37b10a[_0x41a9('0x73')](_0x552b8e[_0x41a9('0x48')][_0x41a9('0x70')]);}})[_0x41a9('0x22')](respondWithStatusCode(_0x136d3c,null))[_0x41a9('0x2a')](handleError(_0x136d3c,null));};exports[_0x41a9('0x74')]=function(_0x216018,_0x27473a,_0x5ade36){var _0x4d4619={'body':_0x216018['body'],'channel':_0x41a9('0x75')};var _0x1ef588=[];var _0x261079=[];var _0x4d99bf={};var _0x3b9b3e=![];return db['CmContact'][_0x41a9('0x69')]()[_0x41a9('0x22')](function(_0xd46884){if(!_0xd46884){throw new db[(_0x41a9('0x76'))][(_0x41a9('0x77'))](_0x41a9('0x78'));}_0x1ef588=_[_0x41a9('0x79')](_[_0x41a9('0x47')](_0xd46884),[_0x41a9('0x7a'),_0x41a9('0x7b')]);_0x261079=_[_0x41a9('0x79')](_[_0x41a9('0x47')](_0xd46884),[_0x41a9('0x7a'),_0x41a9('0x7b'),_0x41a9('0x7c'),_0x41a9('0x7d')]);if(_0x216018[_0x41a9('0x61')]['id']){delete _0x216018[_0x41a9('0x61')]['id'];}if(_[_0x41a9('0x7e')](_0x216018[_0x41a9('0x61')][_0x41a9('0x7f')])){throw new db[(_0x41a9('0x76'))]['ValidationError'](_0x41a9('0x80'));}if(_[_0x41a9('0x7e')](_0x216018[_0x41a9('0x61')][_0x41a9('0x61')])||_0x216018[_0x41a9('0x61')]['body']===''){throw new db[(_0x41a9('0x76'))][(_0x41a9('0x77'))](_0x41a9('0x81'));}if(_[_0x41a9('0x7e')](_0x216018[_0x41a9('0x61')][_0x41a9('0x82')])){throw new db['Sequelize'][(_0x41a9('0x77'))](_0x41a9('0x83')+_0x261079);}if(!_['includes'](_0x261079,_0x216018['body'][_0x41a9('0x82')])){throw new db[(_0x41a9('0x76'))][(_0x41a9('0x77'))](_0x41a9('0x84')+_0x261079);}_0x4d99bf[_0x216018['body'][_0x41a9('0x82')]]=_0x216018['body'][_0x41a9('0x7f')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x216018['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x41a9('0x85')],'as':_0x41a9('0x86'),'where':_0x4d99bf,'limit':0x1,'order':[[_0x41a9('0x7b'),_0x41a9('0x87')]]}]},{'model':db[_0x41a9('0x88')],'as':_0x41a9('0x89')}]});})[_0x41a9('0x22')](handleEntityNotFound(_0x27473a,null))[_0x41a9('0x22')](function(_0x26b927){if(_0x26b927&&_0x26b927[_0x41a9('0x8a')]){_0x4d4619[_0x41a9('0x8b')]=_0x26b927;_0x4d4619[_0x41a9('0x8c')]=_0x26b927[_0x41a9('0x89')];_0x4d4619[_0x41a9('0x8d')]=_0x26b927[_0x41a9('0x8a')];_0x4d4619['applications']=_[_0x41a9('0x8e')](_0x4d4619[_0x41a9('0x8c')],[_0x41a9('0x8f')],[_0x41a9('0x90')]);if(_0x4d4619[_0x41a9('0x8b')]['Applications']){delete _0x4d4619[_0x41a9('0x8b')][_0x41a9('0x89')];}if(_0x4d4619['account'][_0x41a9('0x8a')]&&_0x4d4619[_0x41a9('0x8b')]['List'][_0x41a9('0x86')][_0x41a9('0x4c')]){return _0x4d4619[_0x41a9('0x8b')][_0x41a9('0x8a')][_0x41a9('0x86')][0x0];}var _0x49ff89=_[_0x41a9('0x91')](_0x216018[_0x41a9('0x61')],{'firstName':_0x216018['body'][_0x41a9('0x7f')],'ListId':_0x26b927[_0x41a9('0x7d')]});_0x49ff89[_0x216018[_0x41a9('0x61')]['mapKey']]=_0x216018[_0x41a9('0x61')][_0x41a9('0x7f')];return db[_0x41a9('0x85')][_0x41a9('0x60')](_0x49ff89,{'fields':_0x1ef588,'raw':!![]});}})['then'](handleEntityNotFound(_0x27473a,null))[_0x41a9('0x22')](function(_0x4a523b){_0x4d4619[_0x41a9('0x92')]=_0x4a523b;if(_0x4a523b){var _0x2841f4={'ContactId':_0x4a523b['id'],'OpenchannelAccountId':_0x216018['params']['id'],'from':(_0x4a523b[_0x41a9('0x93')]||'')+'\x20'+(_0x4a523b[_0x41a9('0x94')]||'')};var _0x14f71d={'OpenchannelAccountId':_0x216018[_0x41a9('0x5d')]['id'],'closed':![]};if(_0x216018['body'][_0x41a9('0x95')]){_0x14f71d[_0x41a9('0x95')]=_0x216018[_0x41a9('0x61')][_0x41a9('0x95')];return db[_0x41a9('0x96')]['find']({'where':_0x14f71d})[_0x41a9('0x22')](function(_0x193d6f){if(_0x193d6f){return[_0x193d6f,![]];}_0x2841f4[_0x41a9('0x95')]=_0x216018[_0x41a9('0x61')][_0x41a9('0x95')];_0x2841f4[_0x41a9('0x97')]=_0x216018['body'][_0x41a9('0x97')];return db[_0x41a9('0x96')][_0x41a9('0x60')](_0x2841f4)[_0x41a9('0x22')](function(_0x459049){return[_0x459049,!![]];});});}else{_0x14f71d['threadId']=null;}_0x14f71d[_0x41a9('0x98')]=_0x4a523b['id'];return db[_0x41a9('0x96')][_0x41a9('0x5f')]({'where':_0x14f71d})[_0x41a9('0x22')](function(_0x1e832b){if(_0x1e832b){return[_0x1e832b,![]];}return db[_0x41a9('0x96')][_0x41a9('0x60')](_0x2841f4)[_0x41a9('0x22')](function(_0x56200a){return[_0x56200a,!![]];});});}})[_0x41a9('0x99')](function(_0x326cbe,_0x2908d0){if(_0x326cbe){_0x3b9b3e=_0x2908d0;if(!_0x2908d0){var _0x2ed886={'from':(_0x4d4619[_0x41a9('0x92')][_0x41a9('0x93')]||'')+'\x20'+(_0x4d4619['contact'][_0x41a9('0x94')]||'')};if(_0x216018[_0x41a9('0x61')][_0x41a9('0x95')]&&_0x216018[_0x41a9('0x61')][_0x41a9('0x9a')]&&_0x216018[_0x41a9('0x61')][_0x41a9('0x95')]!=_0x216018[_0x41a9('0x61')][_0x41a9('0x9a')]){_0x2ed886[_0x41a9('0x95')]=_0x216018[_0x41a9('0x61')]['messageId'];}return _0x326cbe[_0x41a9('0x36')](_0x2ed886);}else{return _0x326cbe;}}})['then'](function(_0x4524f4){_0x4d4619['interaction']=_0x4524f4[_0x41a9('0x38')]({'plain':!![]});_0x4d4619[_0x41a9('0x9b')][_0x41a9('0x9c')]=_0x3b9b3e;if(_0x4d4619[_0x41a9('0x9b')][_0x41a9('0x9c')]){if(_0x4d4619[_0x41a9('0x8b')][_0x41a9('0x9d')]){_0x4d4619[_0x41a9('0x8c')][_0x41a9('0x9e')]({'id':0x0,'priority':_0x4d4619[_0x41a9('0x8c')][_0x41a9('0x4c')]+0x1,'app':_0x41a9('0x9f'),'appdata':_0x41a9('0xa0'),'interval':'*,*,*,*'});}}return db[_0x41a9('0xa1')]['create']({'body':_0x216018[_0x41a9('0x61')]['body'],'OpenchannelAccountId':_0x216018['params']['id'],'OpenchannelInteractionId':_0x4524f4['id'],'direction':'in','ContactId':_0x4d4619['contact']['id'],'AttachmentId':_0x216018['body']['AttachmentId']});})[_0x41a9('0x22')](function(_0x5f294f){_0x4d4619[_0x41a9('0x29')]=_0x5f294f;if(_0x4d4619[_0x41a9('0x9b')][_0x41a9('0xa2')]){return db['User'][_0x41a9('0x5f')]({'attributes':['id',_0x41a9('0x3c')],'where':{'id':_0x4d4619[_0x41a9('0x9b')][_0x41a9('0xa2')]}})[_0x41a9('0x22')](function(_0x5d3b87){if(_0x5d3b87){_0x4d4619[_0x41a9('0x8c')][_0x41a9('0xa3')]({'id':0x0,'priority':0x0,'app':_0x41a9('0xa4'),'appdata':_0x5d3b87[_0x41a9('0x3c')]+','+(_0x4d4619[_0x41a9('0x8b')][_0x41a9('0xa5')]||0xa),'interval':_0x41a9('0xa6')});_0x4d4619[_0x41a9('0xa7')]=![];}return respondWithRpcPromise(_0x41a9('0xa8'),_0x41a9('0xa9'),_0x4d4619);});}return respondWithRpcPromise(_0x41a9('0xa8'),_0x41a9('0xa9'),_0x4d4619);})['then'](function(_0x4d12f8){respondWithRpcPromise(_0x41a9('0xaa'),_0x41a9('0xaa'),{'event':_0x41a9('0x74'),'message':_0x4d12f8},client9002);return _0x4d12f8;})[_0x41a9('0x22')](respondWithResult(_0x27473a,null))[_0x41a9('0x2a')](handleError(_0x27473a,null));};exports[_0x41a9('0xab')]=function(_0x3f3285,_0x55a160,_0x272531){return db[_0x41a9('0x42')][_0x41a9('0x6e')]({'where':{'id':_0x3f3285['params']['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x55a160,null))[_0x41a9('0x22')](function(_0x1de5c0){if(_0x1de5c0){return db[_0x41a9('0xac')][_0x41a9('0xad')](function(_0x29641d){return db[_0x41a9('0x88')][_0x41a9('0x37')]({'where':{'OpenchannelAccountId':_0x3f3285['params']['id']},'transaction':_0x29641d})[_0x41a9('0x22')](function(_0x3eab7d){var _0x472221=_[_0x41a9('0x41')](_0x3f3285[_0x41a9('0x61')],function(_0x381fdb){_0x381fdb[_0x41a9('0x6b')]=_0x3f3285['params']['id'];return _0x381fdb;});return db[_0x41a9('0x88')]['bulkCreate'](_0x472221,{'transaction':_0x29641d});});})['then'](function(){return db[_0x41a9('0x88')][_0x41a9('0xae')]({'where':{'OpenchannelAccountId':_0x3f3285[_0x41a9('0x5d')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x55a160,null))['catch'](handleError(_0x55a160,null));};exports[_0x41a9('0xaf')]=function(_0x534505,_0x49f346,_0x32e57f){var _0x3c7bbe={};var _0x2c6d3e={};var _0x2f0ff0;var _0x12faf3;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x534505[_0x41a9('0x5d')]['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x49f346,null))[_0x41a9('0x22')](function(_0x13b5aa){if(_0x13b5aa){_0x2f0ff0=_0x13b5aa;_0x2c6d3e[_0x41a9('0x46')]=_[_0x41a9('0x47')](db[_0x41a9('0x88')][_0x41a9('0x43')]);_0x2c6d3e[_0x41a9('0x48')]=_[_0x41a9('0x47')](_0x534505[_0x41a9('0x48')]);_0x2c6d3e[_0x41a9('0x49')]=_[_0x41a9('0x4a')](_0x2c6d3e[_0x41a9('0x46')],_0x2c6d3e['query']);_0x3c7bbe['attributes']=_[_0x41a9('0x4a')](_0x2c6d3e['model'],qs[_0x41a9('0x5e')](_0x534505[_0x41a9('0x48')][_0x41a9('0x5e')]));_0x3c7bbe[_0x41a9('0x4b')]=_0x3c7bbe['attributes'][_0x41a9('0x4c')]?_0x3c7bbe[_0x41a9('0x4b')]:_0x2c6d3e[_0x41a9('0x46')];_0x3c7bbe[_0x41a9('0x50')]=qs[_0x41a9('0x51')](_0x534505[_0x41a9('0x48')][_0x41a9('0x51')]);_0x3c7bbe['where']=qs[_0x41a9('0x49')](_[_0x41a9('0x52')](_0x534505[_0x41a9('0x48')],_0x2c6d3e[_0x41a9('0x49')]));if(_0x534505[_0x41a9('0x48')][_0x41a9('0x53')]){_0x3c7bbe[_0x41a9('0x55')]=_[_0x41a9('0x54')](_0x3c7bbe[_0x41a9('0x55')],{'$or':_[_0x41a9('0x41')](_0x3c7bbe[_0x41a9('0x4b')],function(_0xeca89a){var _0x3bcf7d={};_0x3bcf7d[_0xeca89a]={'$like':'%'+_0x534505[_0x41a9('0x48')]['filter']+'%'};return _0x3bcf7d;})});}_0x3c7bbe=_['merge']({},_0x3c7bbe,_0x534505[_0x41a9('0x57')]);return _0x2f0ff0[_0x41a9('0xaf')](_0x3c7bbe);}})['then'](function(_0xac911f){if(_0xac911f){_0x12faf3=_0xac911f[_0x41a9('0x4c')];if(!_0x534505[_0x41a9('0x48')]['hasOwnProperty'](_0x41a9('0x4e'))){_0x3c7bbe[_0x41a9('0x4f')]=qs[_0x41a9('0x4f')](_0x534505[_0x41a9('0x48')][_0x41a9('0x4f')]);_0x3c7bbe[_0x41a9('0x2f')]=qs['offset'](_0x534505[_0x41a9('0x48')][_0x41a9('0x2f')]);}return _0x2f0ff0['getApplications'](_0x3c7bbe);}})[_0x41a9('0x22')](function(_0x4371ca){if(_0x4371ca){return _0x4371ca?{'count':_0x12faf3,'rows':_0x4371ca}:null;}})[_0x41a9('0x22')](respondWithResult(_0x49f346,null))[_0x41a9('0x2a')](handleError(_0x49f346,null));};exports['getInteractions']=function(_0x2d78e4,_0x49a921,_0x5158f0){var _0x35b2fb={'raw':![],'where':{}};var _0x2a2a75={};var _0x1729b9={'count':0x0,'rows':[]};return db[_0x41a9('0x42')][_0x41a9('0x6e')]({'where':{'id':_0x2d78e4[_0x41a9('0x5d')]['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x49a921,null))[_0x41a9('0x22')](function(_0x60aee5){if(_0x60aee5){_0x2a2a75[_0x41a9('0x46')]=_['keys'](db['OpenchannelInteraction'][_0x41a9('0x43')]);_0x2a2a75[_0x41a9('0x48')]=_[_0x41a9('0x47')](_0x2d78e4['query']);_0x2a2a75[_0x41a9('0x49')]=_[_0x41a9('0x4a')](_0x2a2a75['model'],_0x2a2a75[_0x41a9('0x48')]);_0x35b2fb[_0x41a9('0x4b')]=_[_0x41a9('0x4a')](_0x2a2a75[_0x41a9('0x46')],qs[_0x41a9('0x5e')](_0x2d78e4[_0x41a9('0x48')][_0x41a9('0x5e')]));_0x35b2fb[_0x41a9('0x4b')]=_0x35b2fb[_0x41a9('0x4b')][_0x41a9('0x4c')]?_0x35b2fb[_0x41a9('0x4b')]:_0x2a2a75[_0x41a9('0x46')];if(!_0x2d78e4[_0x41a9('0x48')][_0x41a9('0x4d')](_0x41a9('0x4e'))){_0x35b2fb[_0x41a9('0x4f')]=qs[_0x41a9('0x4f')](_0x2d78e4[_0x41a9('0x48')][_0x41a9('0x4f')]);_0x35b2fb[_0x41a9('0x2f')]=qs[_0x41a9('0x2f')](_0x2d78e4[_0x41a9('0x48')][_0x41a9('0x2f')]);}_0x35b2fb[_0x41a9('0x50')]=qs[_0x41a9('0x51')](_0x2d78e4['query']['sort']);_0x35b2fb[_0x41a9('0x55')]=qs[_0x41a9('0x49')](_[_0x41a9('0x52')](_0x2d78e4[_0x41a9('0x48')],_0x2a2a75['filters']));_0x35b2fb[_0x41a9('0x55')][_0x41a9('0x6b')]=_0x60aee5['id'];if(_0x2d78e4[_0x41a9('0x48')][_0x41a9('0x53')]){_0x35b2fb[_0x41a9('0x55')]=_[_0x41a9('0x54')](_0x35b2fb[_0x41a9('0x55')],{'$or':_[_0x41a9('0x41')](_0x35b2fb[_0x41a9('0x4b')],function(_0x3e3c98){var _0x5bda6c={};_0x5bda6c[_0x3e3c98]={'$like':'%'+_0x2d78e4[_0x41a9('0x48')][_0x41a9('0x53')]+'%'};return _0x5bda6c;})});}_0x35b2fb=_[_0x41a9('0x54')]({},_0x35b2fb,_0x2d78e4[_0x41a9('0x57')]);return db[_0x41a9('0x96')][_0x41a9('0x31')]({'where':_0x35b2fb[_0x41a9('0x55')]})[_0x41a9('0x22')](function(_0x530973){_0x1729b9['count']=_0x530973;if(_0x2d78e4[_0x41a9('0x48')][_0x41a9('0x58')]){_0x35b2fb[_0x41a9('0x59')]=[{'model':db[_0x41a9('0x85')],'as':_0x41a9('0xb0'),'required':![]},{'model':db[_0x41a9('0xb1')],'as':'Owner','attributes':['name',_0x41a9('0xb2'),'internal'],'required':![]},{'model':db[_0x41a9('0xb3')],'as':_0x41a9('0xb4'),'attributes':['id',_0x41a9('0x3c'),_0x41a9('0xb5')],'where':_0x2d78e4[_0x41a9('0x48')]['tag']?{'id':_0x2d78e4['query']['tag']}:undefined,'required':_0x2d78e4['query'][_0x41a9('0xb6')]?!![]:![]}];}return db[_0x41a9('0x96')]['findAll'](_0x35b2fb);})[_0x41a9('0x22')](function(_0x1d197b){_0x1729b9[_0x41a9('0x5b')]=_0x1d197b;return _0x1729b9;});}})[_0x41a9('0x22')](respondWithFilteredResult(_0x49a921,_0x35b2fb))[_0x41a9('0x2a')](handleError(_0x49a921,null));};exports[_0x41a9('0xb7')]=function(_0x53cc46,_0x242b83,_0x52d7b3){return db['OpenchannelAccount']['find']({'where':{'id':_0x53cc46[_0x41a9('0x5d')]['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x242b83,null))[_0x41a9('0x22')](function(_0x47f271){if(_0x47f271){return _0x47f271[_0x41a9('0xb7')](_0x53cc46[_0x41a9('0x61')]['ids'],_[_0x41a9('0xb8')](_0x53cc46['body'],[_0x41a9('0x70'),'id'])||{})['spread'](function(_0x37e83e){for(var _0x1c0dee=0x0;_0x1c0dee<_0x53cc46[_0x41a9('0x61')][_0x41a9('0x70')][_0x41a9('0x4c')];_0x1c0dee+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x53cc46[_0x41a9('0x61')][_0x41a9('0x70')][_0x1c0dee]),'OpenchannelAccountId':Number(_0x53cc46['params']['id'])});}return _0x37e83e;});}})[_0x41a9('0x22')](respondWithResult(_0x242b83,null))['catch'](handleError(_0x242b83,null));};exports[_0x41a9('0xb9')]=function(_0x3823c1,_0x5462e8,_0x142f4f){return db[_0x41a9('0x42')][_0x41a9('0x5f')]({'where':{'id':_0x3823c1[_0x41a9('0x5d')]['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x5462e8,null))[_0x41a9('0x22')](function(_0x18f2ff){if(_0x18f2ff){return _0x18f2ff['removeAgents'](_0x3823c1[_0x41a9('0x48')][_0x41a9('0x70')])[_0x41a9('0x22')](function(){if(_['isArray'](_0x3823c1[_0x41a9('0x48')]['ids'])){for(var _0x241ebe=0x0;_0x241ebe<_0x3823c1['query'][_0x41a9('0x70')][_0x41a9('0x4c')];_0x241ebe+=0x1){socket[_0x41a9('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3823c1[_0x41a9('0x48')][_0x41a9('0x70')][_0x241ebe]),'OpenchannelAccountId':Number(_0x3823c1['params']['id'])});}}else{socket['emit'](_0x41a9('0xbb'),{'UserId':Number(_0x3823c1[_0x41a9('0x48')]['ids']),'OpenchannelAccountId':Number(_0x3823c1['params']['id'])});}});}})[_0x41a9('0x22')](respondWithStatusCode(_0x5462e8,null))['catch'](handleError(_0x5462e8,null));};exports[_0x41a9('0xbc')]=function(_0x4be40c,_0x4eeb40,_0x30c527){var _0x11257b={};var _0x4def8d={};var _0x42ffd2;var _0x159fce;return db[_0x41a9('0x42')]['findOne']({'where':{'id':_0x4be40c[_0x41a9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4eeb40,null))['then'](function(_0x5348ee){if(_0x5348ee){_0x42ffd2=_0x5348ee;_0x4def8d[_0x41a9('0x46')]=_[_0x41a9('0x47')](db[_0x41a9('0xb1')][_0x41a9('0x43')]);_0x4def8d[_0x41a9('0x48')]=_[_0x41a9('0x47')](_0x4be40c['query']);_0x4def8d['filters']=_[_0x41a9('0x4a')](_0x4def8d[_0x41a9('0x46')],_0x4def8d[_0x41a9('0x48')]);_0x11257b[_0x41a9('0x4b')]=_[_0x41a9('0x4a')](_0x4def8d[_0x41a9('0x46')],qs[_0x41a9('0x5e')](_0x4be40c[_0x41a9('0x48')]['fields']));_0x11257b['attributes']=_0x11257b[_0x41a9('0x4b')]['length']?_0x11257b['attributes']:_0x4def8d['model'];_0x11257b[_0x41a9('0x50')]=qs[_0x41a9('0x51')](_0x4be40c[_0x41a9('0x48')][_0x41a9('0x51')]);_0x11257b[_0x41a9('0x55')]=qs['filters'](_[_0x41a9('0x52')](_0x4be40c[_0x41a9('0x48')],_0x4def8d['filters']));if(_0x4be40c['query'][_0x41a9('0x53')]){_0x11257b[_0x41a9('0x55')]=_[_0x41a9('0x54')](_0x11257b[_0x41a9('0x55')],{'$or':_[_0x41a9('0x41')](_0x11257b[_0x41a9('0x4b')],function(_0x393604){var _0x33df8b={};_0x33df8b[_0x393604]={'$like':'%'+_0x4be40c[_0x41a9('0x48')]['filter']+'%'};return _0x33df8b;})});}_0x11257b=_[_0x41a9('0x54')]({},_0x11257b,_0x4be40c[_0x41a9('0x57')]);return _0x42ffd2[_0x41a9('0xbc')](_0x11257b);}})[_0x41a9('0x22')](function(_0x4d414c){if(_0x4d414c){_0x159fce=_0x4d414c[_0x41a9('0x4c')];if(!_0x4be40c[_0x41a9('0x48')]['hasOwnProperty'](_0x41a9('0x4e'))){_0x11257b[_0x41a9('0x4f')]=qs[_0x41a9('0x4f')](_0x4be40c[_0x41a9('0x48')][_0x41a9('0x4f')]);_0x11257b[_0x41a9('0x2f')]=qs[_0x41a9('0x2f')](_0x4be40c[_0x41a9('0x48')][_0x41a9('0x2f')]);}return _0x42ffd2['getAgents'](_0x11257b);}})[_0x41a9('0x22')](function(_0x748403){if(_0x748403){return _0x748403?{'count':_0x159fce,'rows':_0x748403}:null;}})[_0x41a9('0x22')](respondWithResult(_0x4eeb40,null))['catch'](handleError(_0x4eeb40,null));};exports[_0x41a9('0x3d')]=function(_0x3ff683,_0x4b131c,_0x260f26){var _0x1d5e87,_0x29030b,_0x4939a7;if(_[_0x41a9('0x7e')](_0x3ff683[_0x41a9('0x61')][_0x41a9('0x61')])||_0x3ff683[_0x41a9('0x61')][_0x41a9('0x61')]===''){throw new db[(_0x41a9('0x76'))][(_0x41a9('0x77'))](_0x41a9('0x81'));}if(_[_0x41a9('0x7e')](_0x3ff683[_0x41a9('0x61')]['to'])){}_0x1d5e87=_0x3ff683[_0x41a9('0x61')]['to'];return db[_0x41a9('0x42')][_0x41a9('0x6e')]({'where':{'id':_0x3ff683[_0x41a9('0x5d')]['id']}})[_0x41a9('0x22')](handleEntityNotFound(_0x4b131c,null))[_0x41a9('0x22')](function(_0x4d9903){if(_0x4d9903){return db['OpenchannelAccount'][_0x41a9('0x5f')]({'where':{'id':_0x4d9903['id']},'include':[{'model':db[_0x41a9('0xbd')],'as':_0x41a9('0x8a'),'include':[{'model':db[_0x41a9('0x85')],'as':'Contacts','where':{[_0x4d9903['mapKey']]:_0x1d5e87},'limit':0x1,'order':[[_0x41a9('0x7b'),_0x41a9('0x87')]]}]}]})[_0x41a9('0x22')](handleEntityNotFound(_0x4b131c,null))['then'](function(_0x233ab4){if(_0x233ab4&&_0x233ab4[_0x41a9('0x8a')]){_0x29030b=_0x233ab4[_0x41a9('0x38')]({'plain':!![]});if(_0x29030b[_0x41a9('0x8a')]&&_0x29030b[_0x41a9('0x8a')][_0x41a9('0x86')][_0x41a9('0x4c')]){return _0x29030b[_0x41a9('0x8a')][_0x41a9('0x86')][0x0];}return db[_0x41a9('0x85')][_0x41a9('0x60')](_[_0x41a9('0x91')](_0x3ff683['body'],{'firstName':_0x1d5e87,[_0x233ab4[_0x41a9('0x82')]]:_0x1d5e87,'phone':_0x1d5e87,'ListId':_0x29030b[_0x41a9('0x7d')]}));}})[_0x41a9('0x22')](handleEntityNotFound(_0x4b131c,null))[_0x41a9('0x22')](function(_0x747bb5){if(_0x747bb5){_0x4939a7=_0x747bb5;return db[_0x41a9('0x96')][_0x41a9('0x5f')]({'where':{'ContactId':_0x4939a7['id'],'closed':![],'OpenchannelAccountId':_0x29030b['id']}})['then'](function(_0x22b080){if(_0x22b080){return[_0x22b080,![]];}return db[_0x41a9('0x96')][_0x41a9('0x60')]({'UserId':_0x3ff683[_0x41a9('0x62')]['id'],'ContactId':_0x4939a7['id'],'OpenchannelAccountId':_0x29030b['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x3ff683['body'],{'read':![],'body':_0x3ff683[_0x41a9('0x61')]['body'],'OpenchannelAccountId':_0x29030b['id'],'UserId':_0x3ff683[_0x41a9('0x62')]['id'],'ContactId':_0x4939a7['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x41a9('0xbe')}]})[_0x41a9('0x22')](function(_0x3844a9){return[_0x3844a9,!![]];});});}})[_0x41a9('0x99')](function(_0x446218,_0x650c0b){if(_0x650c0b){return _0x446218;}return db['OpenchannelMessage']['create'](_[_0x41a9('0x54')](_0x3ff683['body'],{'read':![],'body':_0x3ff683[_0x41a9('0x61')][_0x41a9('0x61')],'OpenchannelAccountId':_0x29030b['id'],'OpenchannelInteractionId':_0x446218['id'],'UserId':_0x3ff683[_0x41a9('0x62')]['id'],'ContactId':_0x4939a7['id']}))['then'](function(_0x177207){_0x446218[_0x41a9('0xbf')][_0x41a9('0xbe')]=[];_0x446218['dataValues'][_0x41a9('0xbe')][_0x41a9('0x9e')](_0x177207['dataValues']);return _0x446218;});});}})[_0x41a9('0x22')](respondWithResult(_0x4b131c,null))[_0x41a9('0x2a')](handleError(_0x4b131c,null));}; \ No newline at end of file +var _0x4bf9=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','nolimit','sort','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','OpenchannelApplication','Applications','List','account','applications','list','asc','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','lastName','messageId','interaction','created','autoclose','push','close','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','findOne','sequelize','transaction','bulkCreate','priority','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','DESC','out','Messages','spread','dataValues','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','role','UserProfileSection','userProfileId'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4bf9,0x1cc));var _0x94bf=function(_0x415e0e,_0x4b6f92){_0x415e0e=_0x415e0e-0x0;var _0x36e9c1=_0x4bf9[_0x415e0e];return _0x36e9c1;};'use strict';var emlformat=require(_0x94bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94bf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94bf('0x2'));var moment=require(_0x94bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x94bf('0x4'));var util=require(_0x94bf('0x5'));var path=require(_0x94bf('0x6'));var sox=require(_0x94bf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94bf('0x8'));var _=require(_0x94bf('0x9'));var squel=require('squel');var crypto=require(_0x94bf('0xa'));var jsforce=require(_0x94bf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x94bf('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94bf('0xd'));var authService=require(_0x94bf('0xe'));var qs=require(_0x94bf('0xf'));var as=require(_0x94bf('0x10'));var hardwareService=require(_0x94bf('0x11'));var logger=require('../../config/logger')(_0x94bf('0x12'));var utils=require(_0x94bf('0x13'));var config=require(_0x94bf('0x14'));var licenseUtil=require(_0x94bf('0x15'));var db=require('../../mysqldb')['db'];config[_0x94bf('0x16')]=_[_0x94bf('0x17')](config[_0x94bf('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x94bf('0x18'))(new Redis(config[_0x94bf('0x16')]));require(_0x94bf('0x19'))[_0x94bf('0x1a')](socket);var jayson=require(_0x94bf('0x1b'));var client=jayson[_0x94bf('0x1c')][_0x94bf('0x1d')]({'port':0x232c});var client9002=jayson[_0x94bf('0x1c')][_0x94bf('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x456da5,_0x25d1c2,_0x396e4b,_0x3f6fb0){return new BPromise(function(_0x4fc4ca,_0xa8221b){var _0x37846a=_0x3f6fb0||client;return _0x37846a[_0x94bf('0x1e')](_0x456da5,_0x396e4b)['then'](function(_0x46b8d9){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x25d1c2,'request\x20sent');logger['debug'](_0x94bf('0x1f'),_0x25d1c2,_0x94bf('0x20'),JSON[_0x94bf('0x21')](_0x46b8d9));if(_0x46b8d9[_0x94bf('0x22')]){if(_0x46b8d9[_0x94bf('0x22')]['code']===0x1f4){logger[_0x94bf('0x22')](_0x94bf('0x23'),_0x25d1c2,_0x46b8d9[_0x94bf('0x22')][_0x94bf('0x24')]);return _0xa8221b(_0x46b8d9['error']['message']);}logger[_0x94bf('0x22')](_0x94bf('0x23'),_0x25d1c2,_0x46b8d9[_0x94bf('0x22')][_0x94bf('0x24')]);return _0x4fc4ca(_0x46b8d9[_0x94bf('0x22')]['message']);}else{logger['info'](_0x94bf('0x23'),_0x25d1c2,'request\x20sent');_0x4fc4ca(_0x46b8d9['result'][_0x94bf('0x24')]);}})['catch'](function(_0x322ac0){logger['error'](_0x94bf('0x23'),_0x25d1c2,_0x322ac0);_0xa8221b(_0x322ac0);});});}function respondWithStatusCode(_0x4fdfaf,_0x50854c){_0x50854c=_0x50854c||0xcc;return function(_0x4cc346){if(_0x4cc346){return _0x4fdfaf[_0x94bf('0x25')](_0x50854c);}return _0x4fdfaf[_0x94bf('0x26')](_0x50854c)[_0x94bf('0x27')]();};}function respondWithResult(_0x2739d0,_0x3640c6){_0x3640c6=_0x3640c6||0xc8;return function(_0x3f67f5){if(_0x3f67f5){return _0x2739d0[_0x94bf('0x26')](_0x3640c6)[_0x94bf('0x28')](_0x3f67f5);}};}function respondWithFilteredResult(_0x2426e2,_0x56a72b){return function(_0x518585){if(_0x518585){var _0x313cce=typeof _0x56a72b[_0x94bf('0x29')]===_0x94bf('0x2a')&&typeof _0x56a72b['limit']==='undefined';var _0x586534=_0x518585[_0x94bf('0x2b')];var _0xf63a95=_0x313cce?0x0:_0x56a72b[_0x94bf('0x29')];var _0x1222ff=_0x313cce?_0x518585[_0x94bf('0x2b')]:_0x56a72b['offset']+_0x56a72b[_0x94bf('0x2c')];var _0x14a43f;if(_0x1222ff>=_0x586534){_0x1222ff=_0x586534;_0x14a43f=0xc8;}else{_0x14a43f=0xce;}_0x2426e2['status'](_0x14a43f);return _0x2426e2[_0x94bf('0x2d')](_0x94bf('0x2e'),_0xf63a95+'-'+_0x1222ff+'/'+_0x586534)[_0x94bf('0x28')](_0x518585);}return null;};}function patchUpdates(_0x21056f){return function(_0x21c0fe){try{jsonpatch['apply'](_0x21c0fe,_0x21056f,!![]);}catch(_0x446fc9){return BPromise['reject'](_0x446fc9);}return _0x21c0fe['save']();};}function saveUpdates(_0x2010f5,_0x336b4c){return function(_0x106679){if(_0x106679){return _0x106679[_0x94bf('0x2f')](_0x2010f5)[_0x94bf('0x30')](function(_0x326ca8){return _0x326ca8;});}return null;};}function removeEntity(_0x2b3b23,_0x4016dc){return function(_0x2fb23e){if(_0x2fb23e){return _0x2fb23e['destroy']()[_0x94bf('0x30')](function(){var _0x1d3fb7=_0x2fb23e[_0x94bf('0x31')]({'plain':!![]});var _0x43c12c=_0x94bf('0x32');return db[_0x94bf('0x33')][_0x94bf('0x34')]({'where':{'type':_0x43c12c,'resourceId':_0x1d3fb7['id']}})[_0x94bf('0x30')](function(){return _0x2fb23e;});})[_0x94bf('0x30')](function(){_0x2b3b23[_0x94bf('0x26')](0xcc)[_0x94bf('0x27')]();});}};}function handleEntityNotFound(_0x5114f0,_0x54132c){return function(_0x425117){if(!_0x425117){_0x5114f0[_0x94bf('0x25')](0x194);}return _0x425117;};}function handleError(_0x10a911,_0x26d71e){_0x26d71e=_0x26d71e||0x1f4;return function(_0x3d89d0){logger[_0x94bf('0x22')](_0x3d89d0[_0x94bf('0x35')]);if(_0x3d89d0['name']){delete _0x3d89d0[_0x94bf('0x36')];}_0x10a911[_0x94bf('0x26')](_0x26d71e)[_0x94bf('0x37')](_0x3d89d0);};}exports[_0x94bf('0x38')]=function(_0x2f1b39,_0x16b1ea){var _0x12b70f={'include':[{'model':db[_0x94bf('0x39')],'as':_0x94bf('0x3a')}]},_0xc31ffe={},_0x475415={'count':0x0,'rows':[]};var _0x4985cb=_[_0x94bf('0x3b')](db[_0x94bf('0x3c')][_0x94bf('0x3d')],function(_0x6a75c9){return{'name':_0x6a75c9[_0x94bf('0x3e')],'type':_0x6a75c9['type'][_0x94bf('0x3f')]};});_0xc31ffe[_0x94bf('0x40')]=_[_0x94bf('0x3b')](_0x4985cb,'name');_0xc31ffe[_0x94bf('0x41')]=_[_0x94bf('0x42')](_0x2f1b39[_0x94bf('0x41')]);_0xc31ffe[_0x94bf('0x43')]=_[_0x94bf('0x44')](_0xc31ffe[_0x94bf('0x40')],_0xc31ffe[_0x94bf('0x41')]);_0x12b70f[_0x94bf('0x45')]=_['intersection'](_0xc31ffe[_0x94bf('0x40')],qs[_0x94bf('0x46')](_0x2f1b39[_0x94bf('0x41')][_0x94bf('0x46')]));_0x12b70f[_0x94bf('0x45')]=_0x12b70f[_0x94bf('0x45')][_0x94bf('0x47')]?_0x12b70f[_0x94bf('0x45')]:_0xc31ffe[_0x94bf('0x40')];if(!_0x2f1b39[_0x94bf('0x41')][_0x94bf('0x48')]('nolimit')){_0x12b70f[_0x94bf('0x2c')]=qs[_0x94bf('0x2c')](_0x2f1b39[_0x94bf('0x41')][_0x94bf('0x2c')]);_0x12b70f[_0x94bf('0x29')]=qs[_0x94bf('0x29')](_0x2f1b39['query'][_0x94bf('0x29')]);}_0x12b70f[_0x94bf('0x49')]=qs['sort'](_0x2f1b39[_0x94bf('0x41')]['sort']);_0x12b70f[_0x94bf('0x4a')]=qs[_0x94bf('0x43')](_[_0x94bf('0x4b')](_0x2f1b39[_0x94bf('0x41')],_0xc31ffe['filters']),_0x4985cb);if(_0x2f1b39[_0x94bf('0x41')][_0x94bf('0x4c')]){_0x12b70f[_0x94bf('0x4a')]=_[_0x94bf('0x4d')](_0x12b70f[_0x94bf('0x4a')],{'$or':_['map'](_0x4985cb,function(_0x8439aa){if(_0x8439aa[_0x94bf('0x4e')]!==_0x94bf('0x4f')){var _0x582723={};_0x582723[_0x8439aa['name']]={'$like':'%'+_0x2f1b39[_0x94bf('0x41')]['filter']+'%'};return _0x582723;}})});}_0x12b70f=_[_0x94bf('0x4d')]({},_0x12b70f,_0x2f1b39[_0x94bf('0x50')]);var _0x202848={'where':_0x12b70f[_0x94bf('0x4a')]};return db[_0x94bf('0x3c')][_0x94bf('0x2b')](_0x202848)[_0x94bf('0x30')](function(_0x28375b){_0x475415[_0x94bf('0x2b')]=_0x28375b;if(_0x2f1b39[_0x94bf('0x41')][_0x94bf('0x51')]){_0x12b70f[_0x94bf('0x52')]=[{'all':!![]}];}return db[_0x94bf('0x3c')][_0x94bf('0x53')](_0x12b70f);})[_0x94bf('0x30')](function(_0x3ae826){_0x475415[_0x94bf('0x54')]=_0x3ae826;return _0x475415;})[_0x94bf('0x30')](respondWithFilteredResult(_0x16b1ea,_0x12b70f))['catch'](handleError(_0x16b1ea,null));};exports[_0x94bf('0x55')]=function(_0x2b3153,_0x2b26ba){var _0x1fe4e6={'raw':![],'where':{'id':_0x2b3153[_0x94bf('0x56')]['id']},'include':[{'model':db[_0x94bf('0x39')],'as':'mandatoryDispositionPause'}]},_0x46d779={};_0x46d779[_0x94bf('0x40')]=_[_0x94bf('0x42')](db[_0x94bf('0x3c')]['rawAttributes']);_0x46d779['query']=_['keys'](_0x2b3153[_0x94bf('0x41')]);_0x46d779[_0x94bf('0x43')]=_['intersection'](_0x46d779[_0x94bf('0x40')],_0x46d779[_0x94bf('0x41')]);_0x1fe4e6['attributes']=_['intersection'](_0x46d779['model'],qs['fields'](_0x2b3153[_0x94bf('0x41')][_0x94bf('0x46')]));_0x1fe4e6['attributes']=_0x1fe4e6['attributes'][_0x94bf('0x47')]?_0x1fe4e6[_0x94bf('0x45')]:_0x46d779[_0x94bf('0x40')];if(_0x2b3153[_0x94bf('0x41')][_0x94bf('0x51')]){_0x1fe4e6[_0x94bf('0x52')]=[{'all':!![]}];}_0x1fe4e6=_['merge']({},_0x1fe4e6,_0x2b3153[_0x94bf('0x50')]);return db[_0x94bf('0x3c')][_0x94bf('0x57')](_0x1fe4e6)[_0x94bf('0x30')](handleEntityNotFound(_0x2b26ba,null))[_0x94bf('0x30')](respondWithResult(_0x2b26ba,null))[_0x94bf('0x58')](handleError(_0x2b26ba,null));};exports[_0x94bf('0x59')]=function(_0x39ea58,_0x149d1d){return db[_0x94bf('0x3c')][_0x94bf('0x59')](_0x39ea58[_0x94bf('0x5a')],{})['then'](function(_0x59fc61){var _0x224992=_0x39ea58[_0x94bf('0x5b')][_0x94bf('0x31')]({'plain':!![]});if(!_0x224992)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x224992[_0x94bf('0x5c')]===_0x94bf('0x5b')){var _0x30e6bc=_0x59fc61[_0x94bf('0x31')]({'plain':!![]});var _0x44fb9e=_0x94bf('0x32');return db[_0x94bf('0x5d')][_0x94bf('0x57')]({'where':{'name':_0x44fb9e,'userProfileId':_0x224992[_0x94bf('0x5e')]},'raw':!![]})['then'](function(_0x20e9c3){if(_0x20e9c3&&_0x20e9c3[_0x94bf('0x5f')]===0x0){return db[_0x94bf('0x33')][_0x94bf('0x59')]({'name':_0x30e6bc['name'],'resourceId':_0x30e6bc['id'],'type':_0x20e9c3[_0x94bf('0x36')],'sectionId':_0x20e9c3['id']},{})[_0x94bf('0x30')](function(){return _0x59fc61;});}else{return _0x59fc61;}})[_0x94bf('0x58')](function(_0x549719){logger['error'](_0x94bf('0x60'),_0x549719);throw _0x549719;});}return _0x59fc61;})[_0x94bf('0x30')](respondWithResult(_0x149d1d,0xc9))['catch'](handleError(_0x149d1d,null));};exports['update']=function(_0x3f0c01,_0x263a04){if(_0x3f0c01[_0x94bf('0x5a')]['id']){delete _0x3f0c01[_0x94bf('0x5a')]['id'];}return db[_0x94bf('0x3c')][_0x94bf('0x57')]({'where':{'id':_0x3f0c01[_0x94bf('0x56')]['id']},'include':[{'model':db[_0x94bf('0x39')],'as':_0x94bf('0x3a')}]})['then'](handleEntityNotFound(_0x263a04,null))[_0x94bf('0x30')](saveUpdates(_0x3f0c01[_0x94bf('0x5a')],null))['then'](respondWithResult(_0x263a04,null))[_0x94bf('0x58')](handleError(_0x263a04,null));};exports[_0x94bf('0x34')]=function(_0x3881d0,_0x2088d9){return db[_0x94bf('0x3c')][_0x94bf('0x57')]({'where':{'id':_0x3881d0[_0x94bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x2088d9,null))['then'](removeEntity(_0x2088d9,null))[_0x94bf('0x58')](handleError(_0x2088d9,null));};exports[_0x94bf('0x61')]=function(_0x52b5c7,_0x397735){return db[_0x94bf('0x3c')][_0x94bf('0x61')]()[_0x94bf('0x30')](respondWithResult(_0x397735,null))[_0x94bf('0x58')](handleError(_0x397735,null));};exports[_0x94bf('0x62')]=function(_0x26b7ad,_0x211d2b,_0x22d214){if(_0x26b7ad[_0x94bf('0x5a')]['id']){delete _0x26b7ad[_0x94bf('0x5a')]['id'];}return db[_0x94bf('0x3c')][_0x94bf('0x57')]({'where':{'id':_0x26b7ad['params']['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x211d2b,null))['then'](function(_0x541982){if(_0x541982){_0x26b7ad[_0x94bf('0x5a')][_0x94bf('0x63')]=_0x541982['id'];return db[_0x94bf('0x64')][_0x94bf('0x59')](_0x26b7ad[_0x94bf('0x5a')]);}})[_0x94bf('0x30')](respondWithResult(_0x211d2b,null))[_0x94bf('0x58')](handleError(_0x211d2b,null));};exports[_0x94bf('0x65')]=function(_0x5151f0,_0x476b0c,_0x434818){var _0x228101={'raw':![],'where':{}};var _0x2f2caa={};var _0x360f26={'count':0x0,'rows':[]};return db[_0x94bf('0x3c')]['findOne']({'where':{'id':_0x5151f0['params']['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x476b0c,null))[_0x94bf('0x30')](function(_0x4f1d65){if(_0x4f1d65){_0x2f2caa[_0x94bf('0x40')]=_[_0x94bf('0x42')](db['Disposition'][_0x94bf('0x3d')]);_0x2f2caa['query']=_[_0x94bf('0x42')](_0x5151f0['query']);_0x2f2caa[_0x94bf('0x43')]=_['intersection'](_0x2f2caa['model'],_0x2f2caa[_0x94bf('0x41')]);_0x228101[_0x94bf('0x45')]=_[_0x94bf('0x44')](_0x2f2caa[_0x94bf('0x40')],qs[_0x94bf('0x46')](_0x5151f0[_0x94bf('0x41')][_0x94bf('0x46')]));_0x228101[_0x94bf('0x45')]=_0x228101['attributes']['length']?_0x228101['attributes']:_0x2f2caa[_0x94bf('0x40')];if(!_0x5151f0['query'][_0x94bf('0x48')](_0x94bf('0x66'))){_0x228101[_0x94bf('0x2c')]=qs[_0x94bf('0x2c')](_0x5151f0[_0x94bf('0x41')]['limit']);_0x228101[_0x94bf('0x29')]=qs[_0x94bf('0x29')](_0x5151f0[_0x94bf('0x41')][_0x94bf('0x29')]);}_0x228101['order']=qs[_0x94bf('0x67')](_0x5151f0['query'][_0x94bf('0x67')]);_0x228101[_0x94bf('0x4a')]=qs[_0x94bf('0x43')](_[_0x94bf('0x4b')](_0x5151f0[_0x94bf('0x41')],_0x2f2caa['filters']));_0x228101[_0x94bf('0x4a')][_0x94bf('0x63')]=_0x4f1d65['id'];if(_0x5151f0['query']['filter']){_0x228101[_0x94bf('0x4a')]=_[_0x94bf('0x4d')](_0x228101['where'],{'$or':_['map'](_0x228101[_0x94bf('0x45')],function(_0x18d3fc){var _0x199184={};_0x199184[_0x18d3fc]={'$like':'%'+_0x5151f0['query'][_0x94bf('0x4c')]+'%'};return _0x199184;})});}_0x228101=_[_0x94bf('0x4d')]({},_0x228101,_0x5151f0[_0x94bf('0x50')]);return db['Disposition'][_0x94bf('0x2b')]({'where':_0x228101[_0x94bf('0x4a')]})[_0x94bf('0x30')](function(_0x4abdf6){_0x360f26[_0x94bf('0x2b')]=_0x4abdf6;if(_0x5151f0[_0x94bf('0x41')][_0x94bf('0x51')]){_0x228101['include']=[{'all':!![]}];}return db[_0x94bf('0x64')][_0x94bf('0x53')](_0x228101);})[_0x94bf('0x30')](function(_0x6c49cb){_0x360f26[_0x94bf('0x54')]=_0x6c49cb;return _0x360f26;});}})['then'](respondWithFilteredResult(_0x476b0c,_0x228101))[_0x94bf('0x58')](handleError(_0x476b0c,null));};exports[_0x94bf('0x68')]=function(_0x2e5ad8,_0x43d498,_0x26234f){return db[_0x94bf('0x3c')][_0x94bf('0x57')]({'where':{'id':_0x2e5ad8[_0x94bf('0x56')]['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x43d498,null))[_0x94bf('0x30')](function(_0x49c8e3){if(_0x49c8e3){return _0x49c8e3[_0x94bf('0x68')](_0x2e5ad8[_0x94bf('0x41')][_0x94bf('0x69')]);}})['then'](respondWithStatusCode(_0x43d498,null))[_0x94bf('0x58')](handleError(_0x43d498,null));};exports[_0x94bf('0x6a')]=function(_0x409c67,_0xa759dd,_0x5a28f2){if(_0x409c67[_0x94bf('0x5a')]['id']){delete _0x409c67[_0x94bf('0x5a')]['id'];}return db[_0x94bf('0x3c')][_0x94bf('0x57')]({'where':{'id':_0x409c67['params']['id']}})['then'](handleEntityNotFound(_0xa759dd,null))[_0x94bf('0x30')](function(_0x25feea){if(_0x25feea){_0x409c67[_0x94bf('0x5a')][_0x94bf('0x63')]=_0x25feea['id'];return db['CannedAnswer'][_0x94bf('0x59')](_0x409c67['body']);}})['then'](respondWithResult(_0xa759dd,null))['catch'](handleError(_0xa759dd,null));};exports['getAnswers']=function(_0x25397d,_0x590336,_0x35e3bb){var _0x137279={'raw':![],'where':{}};var _0xf855b={};var _0x2c54b2={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x25397d[_0x94bf('0x56')]['id']}})['then'](handleEntityNotFound(_0x590336,null))[_0x94bf('0x30')](function(_0x5bbe48){if(_0x5bbe48){_0xf855b['model']=_[_0x94bf('0x42')](db[_0x94bf('0x6b')]['rawAttributes']);_0xf855b[_0x94bf('0x41')]=_['keys'](_0x25397d[_0x94bf('0x41')]);_0xf855b['filters']=_[_0x94bf('0x44')](_0xf855b['model'],_0xf855b[_0x94bf('0x41')]);_0x137279[_0x94bf('0x45')]=_[_0x94bf('0x44')](_0xf855b[_0x94bf('0x40')],qs[_0x94bf('0x46')](_0x25397d['query'][_0x94bf('0x46')]));_0x137279[_0x94bf('0x45')]=_0x137279[_0x94bf('0x45')][_0x94bf('0x47')]?_0x137279[_0x94bf('0x45')]:_0xf855b['model'];if(!_0x25397d['query'][_0x94bf('0x48')](_0x94bf('0x66'))){_0x137279[_0x94bf('0x2c')]=qs['limit'](_0x25397d['query'][_0x94bf('0x2c')]);_0x137279[_0x94bf('0x29')]=qs[_0x94bf('0x29')](_0x25397d['query'][_0x94bf('0x29')]);}_0x137279[_0x94bf('0x49')]=qs[_0x94bf('0x67')](_0x25397d[_0x94bf('0x41')]['sort']);_0x137279['where']=qs[_0x94bf('0x43')](_[_0x94bf('0x4b')](_0x25397d['query'],_0xf855b[_0x94bf('0x43')]));_0x137279[_0x94bf('0x4a')][_0x94bf('0x63')]=_0x5bbe48['id'];if(_0x25397d[_0x94bf('0x41')]['filter']){_0x137279[_0x94bf('0x4a')]=_[_0x94bf('0x4d')](_0x137279['where'],{'$or':_['map'](_0x137279['attributes'],function(_0x528240){var _0x4cdf0e={};_0x4cdf0e[_0x528240]={'$like':'%'+_0x25397d[_0x94bf('0x41')][_0x94bf('0x4c')]+'%'};return _0x4cdf0e;})});}_0x137279=_[_0x94bf('0x4d')]({},_0x137279,_0x25397d['options']);return db[_0x94bf('0x6b')][_0x94bf('0x2b')]({'where':_0x137279[_0x94bf('0x4a')]})[_0x94bf('0x30')](function(_0x1deca2){_0x2c54b2[_0x94bf('0x2b')]=_0x1deca2;if(_0x25397d['query'][_0x94bf('0x51')]){_0x137279[_0x94bf('0x52')]=[{'all':!![]}];}return db[_0x94bf('0x6b')][_0x94bf('0x53')](_0x137279);})['then'](function(_0xda658f){_0x2c54b2[_0x94bf('0x54')]=_0xda658f;return _0x2c54b2;});}})[_0x94bf('0x30')](respondWithFilteredResult(_0x590336,_0x137279))[_0x94bf('0x58')](handleError(_0x590336,null));};exports[_0x94bf('0x6c')]=function(_0x5f0578,_0x533c10,_0x1feb27){return db[_0x94bf('0x3c')][_0x94bf('0x57')]({'where':{'id':_0x5f0578['params']['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x533c10,null))[_0x94bf('0x30')](function(_0x596e46){if(_0x596e46){return _0x596e46[_0x94bf('0x6c')](_0x5f0578['query']['ids']);}})[_0x94bf('0x30')](respondWithStatusCode(_0x533c10,null))[_0x94bf('0x58')](handleError(_0x533c10,null));};exports[_0x94bf('0x6d')]=function(_0x5065e3,_0x3ed2f3,_0x34201e){var _0xe2939d={'body':_0x5065e3[_0x94bf('0x5a')],'channel':_0x94bf('0x6e')};var _0x48951e=[];var _0x2d309f=[];var _0x1371f3={};var _0x5e6825=![];return db[_0x94bf('0x6f')]['describe']()[_0x94bf('0x30')](function(_0x3de32b){if(!_0x3de32b){throw new db[(_0x94bf('0x70'))]['ValidationError']('no\x20available\x20attributes');}_0x48951e=_[_0x94bf('0x71')](_[_0x94bf('0x42')](_0x3de32b),[_0x94bf('0x72'),_0x94bf('0x73')]);_0x2d309f=_['difference'](_['keys'](_0x3de32b),['createdAt',_0x94bf('0x73'),_0x94bf('0x74'),'ListId']);if(_0x5065e3[_0x94bf('0x5a')]['id']){delete _0x5065e3[_0x94bf('0x5a')]['id'];}if(_[_0x94bf('0x75')](_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x76')])){throw new db[(_0x94bf('0x70'))][(_0x94bf('0x77'))](_0x94bf('0x78'));}if(_[_0x94bf('0x75')](_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x5a')])||_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x5a')]===''){throw new db[(_0x94bf('0x70'))][(_0x94bf('0x77'))](_0x94bf('0x79'));}if(_[_0x94bf('0x75')](_0x5065e3['body'][_0x94bf('0x7a')])){throw new db[(_0x94bf('0x70'))][(_0x94bf('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d309f);}if(!_[_0x94bf('0x7b')](_0x2d309f,_0x5065e3['body'][_0x94bf('0x7a')])){throw new db[(_0x94bf('0x70'))][(_0x94bf('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d309f);}_0x1371f3[_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x7a')]]=_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x76')];})[_0x94bf('0x30')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x5065e3['params']['id']},'include':[{'model':db[_0x94bf('0x7c')],'as':'List','include':[{'model':db[_0x94bf('0x6f')],'as':_0x94bf('0x7d'),'where':_0x1371f3,'limit':0x1,'order':[[_0x94bf('0x73'),'DESC']]}]},{'model':db[_0x94bf('0x7e')],'as':_0x94bf('0x7f')}]});})[_0x94bf('0x30')](handleEntityNotFound(_0x3ed2f3,null))[_0x94bf('0x30')](function(_0x1f71bf){if(_0x1f71bf&&_0x1f71bf[_0x94bf('0x80')]){_0xe2939d[_0x94bf('0x81')]=_0x1f71bf;_0xe2939d[_0x94bf('0x82')]=_0x1f71bf['Applications'];_0xe2939d[_0x94bf('0x83')]=_0x1f71bf[_0x94bf('0x80')];_0xe2939d['applications']=_['orderBy'](_0xe2939d[_0x94bf('0x82')],['priority'],[_0x94bf('0x84')]);if(_0xe2939d['account']['Applications']){delete _0xe2939d[_0x94bf('0x81')][_0x94bf('0x7f')];}if(_0xe2939d[_0x94bf('0x81')][_0x94bf('0x80')]&&_0xe2939d['account'][_0x94bf('0x80')][_0x94bf('0x7d')][_0x94bf('0x47')]){return _0xe2939d['account'][_0x94bf('0x80')]['Contacts'][0x0];}var _0x18383b=_[_0x94bf('0x17')](_0x5065e3['body'],{'firstName':_0x5065e3[_0x94bf('0x5a')]['from'],'ListId':_0x1f71bf[_0x94bf('0x85')]});_0x18383b[_0x5065e3[_0x94bf('0x5a')]['mapKey']]=_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x76')];return db[_0x94bf('0x6f')][_0x94bf('0x59')](_0x18383b,{'fields':_0x48951e,'raw':!![]});}})[_0x94bf('0x30')](handleEntityNotFound(_0x3ed2f3,null))[_0x94bf('0x30')](function(_0x3db11b){_0xe2939d[_0x94bf('0x86')]=_0x3db11b;if(_0x3db11b){var _0x3b6644={'ContactId':_0x3db11b['id'],'OpenchannelAccountId':_0x5065e3[_0x94bf('0x56')]['id'],'from':(_0x3db11b[_0x94bf('0x87')]||'')+'\x20'+(_0x3db11b['lastName']||'')};var _0x5d86ea={'OpenchannelAccountId':_0x5065e3[_0x94bf('0x56')]['id'],'closed':![]};if(_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x88')]){_0x5d86ea[_0x94bf('0x88')]=_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x88')];return db[_0x94bf('0x89')]['find']({'where':_0x5d86ea})[_0x94bf('0x30')](function(_0x1eca01){if(_0x1eca01){return[_0x1eca01,![]];}_0x3b6644[_0x94bf('0x88')]=_0x5065e3['body'][_0x94bf('0x88')];_0x3b6644[_0x94bf('0x8a')]=_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x8a')];return db[_0x94bf('0x89')][_0x94bf('0x59')](_0x3b6644)['then'](function(_0x57514f){return[_0x57514f,!![]];});});}else{_0x5d86ea['threadId']=null;}_0x5d86ea['ContactId']=_0x3db11b['id'];return db['OpenchannelInteraction'][_0x94bf('0x57')]({'where':_0x5d86ea})[_0x94bf('0x30')](function(_0x4a091e){if(_0x4a091e){return[_0x4a091e,![]];}return db['OpenchannelInteraction'][_0x94bf('0x59')](_0x3b6644)[_0x94bf('0x30')](function(_0x2489ea){return[_0x2489ea,!![]];});});}})['spread'](function(_0x393cda,_0x50548e){if(_0x393cda){_0x5e6825=_0x50548e;if(!_0x50548e){var _0x2976a2={'from':(_0xe2939d[_0x94bf('0x86')][_0x94bf('0x87')]||'')+'\x20'+(_0xe2939d[_0x94bf('0x86')][_0x94bf('0x8b')]||'')};if(_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x88')]&&_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x8c')]&&_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x88')]!=_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x8c')]){_0x2976a2[_0x94bf('0x88')]=_0x5065e3[_0x94bf('0x5a')]['messageId'];}return _0x393cda[_0x94bf('0x2f')](_0x2976a2);}else{return _0x393cda;}}})[_0x94bf('0x30')](function(_0x4c1f94){_0xe2939d[_0x94bf('0x8d')]=_0x4c1f94[_0x94bf('0x31')]({'plain':!![]});_0xe2939d[_0x94bf('0x8d')][_0x94bf('0x8e')]=_0x5e6825;if(_0xe2939d[_0x94bf('0x8d')][_0x94bf('0x8e')]){if(_0xe2939d[_0x94bf('0x81')][_0x94bf('0x8f')]){_0xe2939d['applications'][_0x94bf('0x90')]({'id':0x0,'priority':_0xe2939d['applications'][_0x94bf('0x47')]+0x1,'app':_0x94bf('0x91'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x94bf('0x92')]['create']({'body':_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x5a')],'OpenchannelAccountId':_0x5065e3[_0x94bf('0x56')]['id'],'OpenchannelInteractionId':_0x4c1f94['id'],'direction':'in','ContactId':_0xe2939d[_0x94bf('0x86')]['id'],'AttachmentId':_0x5065e3[_0x94bf('0x5a')][_0x94bf('0x93')]});})[_0x94bf('0x30')](function(_0x526c06){_0xe2939d[_0x94bf('0x24')]=_0x526c06;if(_0xe2939d[_0x94bf('0x8d')][_0x94bf('0x94')]){return db[_0x94bf('0x95')]['find']({'attributes':['id',_0x94bf('0x36')],'where':{'id':_0xe2939d[_0x94bf('0x8d')][_0x94bf('0x94')]}})[_0x94bf('0x30')](function(_0x20d89e){if(_0x20d89e){_0xe2939d['applications'][_0x94bf('0x96')]({'id':0x0,'priority':0x0,'app':_0x94bf('0x97'),'appdata':_0x20d89e['name']+','+(_0xe2939d[_0x94bf('0x81')][_0x94bf('0x98')]||0xa),'interval':_0x94bf('0x99')});_0xe2939d[_0x94bf('0x9a')]=![];}return respondWithRpcPromise('Start','startRouting',_0xe2939d);});}return respondWithRpcPromise(_0x94bf('0x9b'),_0x94bf('0x9c'),_0xe2939d);})[_0x94bf('0x30')](function(_0x1283c4){respondWithRpcPromise(_0x94bf('0x9d'),'EventManager',{'event':_0x94bf('0x6d'),'message':_0x1283c4},client9002);return _0x1283c4;})[_0x94bf('0x30')](respondWithResult(_0x3ed2f3,null))[_0x94bf('0x58')](handleError(_0x3ed2f3,null));};exports[_0x94bf('0x9e')]=function(_0x5b09eb,_0x26aa8a,_0x33bff4){return db[_0x94bf('0x3c')][_0x94bf('0x9f')]({'where':{'id':_0x5b09eb[_0x94bf('0x56')]['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x26aa8a,null))['then'](function(_0x30d5b6){if(_0x30d5b6){return db[_0x94bf('0xa0')][_0x94bf('0xa1')](function(_0x318cd9){return db[_0x94bf('0x7e')][_0x94bf('0x34')]({'where':{'OpenchannelAccountId':_0x5b09eb[_0x94bf('0x56')]['id']},'transaction':_0x318cd9})[_0x94bf('0x30')](function(_0x192136){var _0xad89d3=_[_0x94bf('0x3b')](_0x5b09eb[_0x94bf('0x5a')],function(_0x227059){_0x227059['OpenchannelAccountId']=_0x5b09eb['params']['id'];return _0x227059;});return db[_0x94bf('0x7e')][_0x94bf('0xa2')](_0xad89d3,{'transaction':_0x318cd9});});})[_0x94bf('0x30')](function(){return db[_0x94bf('0x7e')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5b09eb[_0x94bf('0x56')]['id']},'order':_0x94bf('0xa3')});});}})[_0x94bf('0x30')](respondWithResult(_0x26aa8a,null))['catch'](handleError(_0x26aa8a,null));};exports[_0x94bf('0xa4')]=function(_0x33cf02,_0x15b711,_0x3d9e0c){var _0x28443b={};var _0xfc3db7={};var _0x5decd3;var _0x431103;return db['OpenchannelAccount'][_0x94bf('0x9f')]({'where':{'id':_0x33cf02[_0x94bf('0x56')]['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x15b711,null))['then'](function(_0x40d1c3){if(_0x40d1c3){_0x5decd3=_0x40d1c3;_0xfc3db7['model']=_[_0x94bf('0x42')](db[_0x94bf('0x7e')][_0x94bf('0x3d')]);_0xfc3db7['query']=_[_0x94bf('0x42')](_0x33cf02['query']);_0xfc3db7['filters']=_[_0x94bf('0x44')](_0xfc3db7[_0x94bf('0x40')],_0xfc3db7[_0x94bf('0x41')]);_0x28443b['attributes']=_[_0x94bf('0x44')](_0xfc3db7['model'],qs['fields'](_0x33cf02[_0x94bf('0x41')][_0x94bf('0x46')]));_0x28443b['attributes']=_0x28443b[_0x94bf('0x45')][_0x94bf('0x47')]?_0x28443b[_0x94bf('0x45')]:_0xfc3db7[_0x94bf('0x40')];_0x28443b[_0x94bf('0x49')]=qs['sort'](_0x33cf02[_0x94bf('0x41')][_0x94bf('0x67')]);_0x28443b[_0x94bf('0x4a')]=qs[_0x94bf('0x43')](_[_0x94bf('0x4b')](_0x33cf02[_0x94bf('0x41')],_0xfc3db7[_0x94bf('0x43')]));if(_0x33cf02[_0x94bf('0x41')][_0x94bf('0x4c')]){_0x28443b[_0x94bf('0x4a')]=_[_0x94bf('0x4d')](_0x28443b[_0x94bf('0x4a')],{'$or':_['map'](_0x28443b[_0x94bf('0x45')],function(_0x521dc1){var _0x5827ff={};_0x5827ff[_0x521dc1]={'$like':'%'+_0x33cf02[_0x94bf('0x41')]['filter']+'%'};return _0x5827ff;})});}_0x28443b=_['merge']({},_0x28443b,_0x33cf02['options']);return _0x5decd3['getApplications'](_0x28443b);}})['then'](function(_0x427710){if(_0x427710){_0x431103=_0x427710['length'];if(!_0x33cf02[_0x94bf('0x41')][_0x94bf('0x48')](_0x94bf('0x66'))){_0x28443b[_0x94bf('0x2c')]=qs['limit'](_0x33cf02[_0x94bf('0x41')][_0x94bf('0x2c')]);_0x28443b[_0x94bf('0x29')]=qs[_0x94bf('0x29')](_0x33cf02[_0x94bf('0x41')]['offset']);}return _0x5decd3[_0x94bf('0xa4')](_0x28443b);}})[_0x94bf('0x30')](function(_0x69c34f){if(_0x69c34f){return _0x69c34f?{'count':_0x431103,'rows':_0x69c34f}:null;}})[_0x94bf('0x30')](respondWithResult(_0x15b711,null))[_0x94bf('0x58')](handleError(_0x15b711,null));};exports[_0x94bf('0xa5')]=function(_0x17e4d5,_0x473d3a,_0x19cc72){var _0x5f4078={'raw':![],'where':{}};var _0x2e12e7={};var _0x3d75b7={'count':0x0,'rows':[]};return db[_0x94bf('0x3c')][_0x94bf('0x9f')]({'where':{'id':_0x17e4d5['params']['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x473d3a,null))[_0x94bf('0x30')](function(_0x4624db){if(_0x4624db){_0x2e12e7['model']=_[_0x94bf('0x42')](db[_0x94bf('0x89')][_0x94bf('0x3d')]);_0x2e12e7[_0x94bf('0x41')]=_[_0x94bf('0x42')](_0x17e4d5['query']);_0x2e12e7['filters']=_[_0x94bf('0x44')](_0x2e12e7['model'],_0x2e12e7[_0x94bf('0x41')]);_0x5f4078[_0x94bf('0x45')]=_['intersection'](_0x2e12e7['model'],qs[_0x94bf('0x46')](_0x17e4d5[_0x94bf('0x41')][_0x94bf('0x46')]));_0x5f4078[_0x94bf('0x45')]=_0x5f4078[_0x94bf('0x45')][_0x94bf('0x47')]?_0x5f4078[_0x94bf('0x45')]:_0x2e12e7[_0x94bf('0x40')];if(!_0x17e4d5[_0x94bf('0x41')][_0x94bf('0x48')](_0x94bf('0x66'))){_0x5f4078['limit']=qs[_0x94bf('0x2c')](_0x17e4d5[_0x94bf('0x41')]['limit']);_0x5f4078[_0x94bf('0x29')]=qs['offset'](_0x17e4d5[_0x94bf('0x41')][_0x94bf('0x29')]);}_0x5f4078[_0x94bf('0x49')]=qs[_0x94bf('0x67')](_0x17e4d5[_0x94bf('0x41')][_0x94bf('0x67')]);_0x5f4078['where']=qs[_0x94bf('0x43')](_['pick'](_0x17e4d5[_0x94bf('0x41')],_0x2e12e7[_0x94bf('0x43')]));_0x5f4078[_0x94bf('0x4a')][_0x94bf('0x63')]=_0x4624db['id'];if(_0x17e4d5[_0x94bf('0x41')][_0x94bf('0x4c')]){_0x5f4078['where']=_[_0x94bf('0x4d')](_0x5f4078[_0x94bf('0x4a')],{'$or':_[_0x94bf('0x3b')](_0x5f4078[_0x94bf('0x45')],function(_0x326bd6){var _0x2d2b52={};_0x2d2b52[_0x326bd6]={'$like':'%'+_0x17e4d5['query']['filter']+'%'};return _0x2d2b52;})});}_0x5f4078=_[_0x94bf('0x4d')]({},_0x5f4078,_0x17e4d5[_0x94bf('0x50')]);return db['OpenchannelInteraction'][_0x94bf('0x2b')]({'where':_0x5f4078['where']})['then'](function(_0x17c1ba){_0x3d75b7['count']=_0x17c1ba;if(_0x17e4d5[_0x94bf('0x41')][_0x94bf('0x51')]){_0x5f4078[_0x94bf('0x52')]=[{'model':db[_0x94bf('0x6f')],'as':_0x94bf('0xa6'),'required':![]},{'model':db[_0x94bf('0x95')],'as':'Owner','attributes':['name',_0x94bf('0xa7'),_0x94bf('0xa8')],'required':![]},{'model':db[_0x94bf('0xa9')],'as':_0x94bf('0xaa'),'attributes':['id',_0x94bf('0x36'),_0x94bf('0xab')],'where':_0x17e4d5['query'][_0x94bf('0xac')]?{'id':_0x17e4d5[_0x94bf('0x41')]['tag']}:undefined,'required':_0x17e4d5[_0x94bf('0x41')]['tag']?!![]:![]}];}return db[_0x94bf('0x89')]['findAll'](_0x5f4078);})[_0x94bf('0x30')](function(_0x8afb04){_0x3d75b7['rows']=_0x8afb04;return _0x3d75b7;});}})[_0x94bf('0x30')](respondWithFilteredResult(_0x473d3a,_0x5f4078))[_0x94bf('0x58')](handleError(_0x473d3a,null));};exports[_0x94bf('0xad')]=function(_0x38c680,_0x7b2698,_0x5aba3f){return db[_0x94bf('0x3c')]['find']({'where':{'id':_0x38c680[_0x94bf('0x56')]['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x7b2698,null))[_0x94bf('0x30')](function(_0x5a5f94){if(_0x5a5f94){return _0x5a5f94[_0x94bf('0xad')](_0x38c680[_0x94bf('0x5a')][_0x94bf('0x69')],_[_0x94bf('0xae')](_0x38c680['body'],[_0x94bf('0x69'),'id'])||{})['spread'](function(_0x571e14){for(var _0x3fc73f=0x0;_0x3fc73f<_0x38c680[_0x94bf('0x5a')][_0x94bf('0x69')][_0x94bf('0x47')];_0x3fc73f+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x38c680[_0x94bf('0x5a')][_0x94bf('0x69')][_0x3fc73f]),'OpenchannelAccountId':Number(_0x38c680[_0x94bf('0x56')]['id'])});}return _0x571e14;});}})[_0x94bf('0x30')](respondWithResult(_0x7b2698,null))['catch'](handleError(_0x7b2698,null));};exports[_0x94bf('0xaf')]=function(_0x2524dd,_0x377cc9,_0x2559c8){return db[_0x94bf('0x3c')][_0x94bf('0x57')]({'where':{'id':_0x2524dd[_0x94bf('0x56')]['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x377cc9,null))[_0x94bf('0x30')](function(_0xe34282){if(_0xe34282){return _0xe34282[_0x94bf('0xaf')](_0x2524dd[_0x94bf('0x41')][_0x94bf('0x69')])['then'](function(){if(_[_0x94bf('0xb0')](_0x2524dd[_0x94bf('0x41')][_0x94bf('0x69')])){for(var _0x39ed51=0x0;_0x39ed51<_0x2524dd[_0x94bf('0x41')][_0x94bf('0x69')][_0x94bf('0x47')];_0x39ed51+=0x1){socket['emit'](_0x94bf('0xb1'),{'UserId':Number(_0x2524dd['query'][_0x94bf('0x69')][_0x39ed51]),'OpenchannelAccountId':Number(_0x2524dd['params']['id'])});}}else{socket[_0x94bf('0xb2')](_0x94bf('0xb1'),{'UserId':Number(_0x2524dd[_0x94bf('0x41')][_0x94bf('0x69')]),'OpenchannelAccountId':Number(_0x2524dd[_0x94bf('0x56')]['id'])});}});}})[_0x94bf('0x30')](respondWithStatusCode(_0x377cc9,null))['catch'](handleError(_0x377cc9,null));};exports['getAgents']=function(_0x2162de,_0x53ce4a,_0x839e4a){var _0x1291b4={};var _0x299b54={};var _0x362376;var _0x33515e;return db[_0x94bf('0x3c')][_0x94bf('0x9f')]({'where':{'id':_0x2162de[_0x94bf('0x56')]['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x53ce4a,null))[_0x94bf('0x30')](function(_0x37f716){if(_0x37f716){_0x362376=_0x37f716;_0x299b54['model']=_[_0x94bf('0x42')](db[_0x94bf('0x95')][_0x94bf('0x3d')]);_0x299b54[_0x94bf('0x41')]=_['keys'](_0x2162de['query']);_0x299b54['filters']=_[_0x94bf('0x44')](_0x299b54[_0x94bf('0x40')],_0x299b54['query']);_0x1291b4[_0x94bf('0x45')]=_['intersection'](_0x299b54[_0x94bf('0x40')],qs[_0x94bf('0x46')](_0x2162de[_0x94bf('0x41')][_0x94bf('0x46')]));_0x1291b4[_0x94bf('0x45')]=_0x1291b4[_0x94bf('0x45')][_0x94bf('0x47')]?_0x1291b4[_0x94bf('0x45')]:_0x299b54[_0x94bf('0x40')];_0x1291b4[_0x94bf('0x49')]=qs[_0x94bf('0x67')](_0x2162de[_0x94bf('0x41')][_0x94bf('0x67')]);_0x1291b4['where']=qs['filters'](_[_0x94bf('0x4b')](_0x2162de[_0x94bf('0x41')],_0x299b54[_0x94bf('0x43')]));if(_0x2162de[_0x94bf('0x41')][_0x94bf('0x4c')]){_0x1291b4[_0x94bf('0x4a')]=_[_0x94bf('0x4d')](_0x1291b4[_0x94bf('0x4a')],{'$or':_[_0x94bf('0x3b')](_0x1291b4[_0x94bf('0x45')],function(_0x3735a1){var _0x4bd26e={};_0x4bd26e[_0x3735a1]={'$like':'%'+_0x2162de[_0x94bf('0x41')]['filter']+'%'};return _0x4bd26e;})});}_0x1291b4=_['merge']({},_0x1291b4,_0x2162de['options']);return _0x362376[_0x94bf('0xb3')](_0x1291b4);}})[_0x94bf('0x30')](function(_0xcf9568){if(_0xcf9568){_0x33515e=_0xcf9568[_0x94bf('0x47')];if(!_0x2162de[_0x94bf('0x41')][_0x94bf('0x48')]('nolimit')){_0x1291b4[_0x94bf('0x2c')]=qs[_0x94bf('0x2c')](_0x2162de[_0x94bf('0x41')][_0x94bf('0x2c')]);_0x1291b4[_0x94bf('0x29')]=qs[_0x94bf('0x29')](_0x2162de['query'][_0x94bf('0x29')]);}return _0x362376[_0x94bf('0xb3')](_0x1291b4);}})[_0x94bf('0x30')](function(_0x7db31c){if(_0x7db31c){return _0x7db31c?{'count':_0x33515e,'rows':_0x7db31c}:null;}})[_0x94bf('0x30')](respondWithResult(_0x53ce4a,null))['catch'](handleError(_0x53ce4a,null));};exports[_0x94bf('0x37')]=function(_0x5d327b,_0x147f60,_0x12918a){var _0x4bf1cd,_0x2ca325,_0x3b8235;if(_[_0x94bf('0x75')](_0x5d327b['body']['body'])||_0x5d327b['body']['body']===''){throw new db['Sequelize'][(_0x94bf('0x77'))](_0x94bf('0x79'));}if(_[_0x94bf('0x75')](_0x5d327b['body']['to'])){}_0x4bf1cd=_0x5d327b[_0x94bf('0x5a')]['to'];return db[_0x94bf('0x3c')][_0x94bf('0x9f')]({'where':{'id':_0x5d327b[_0x94bf('0x56')]['id']}})[_0x94bf('0x30')](handleEntityNotFound(_0x147f60,null))[_0x94bf('0x30')](function(_0x1ae61f){if(_0x1ae61f){return db[_0x94bf('0x3c')][_0x94bf('0x57')]({'where':{'id':_0x1ae61f['id']},'include':[{'model':db[_0x94bf('0x7c')],'as':_0x94bf('0x80'),'include':[{'model':db['CmContact'],'as':_0x94bf('0x7d'),'where':{[_0x1ae61f[_0x94bf('0x7a')]]:_0x4bf1cd},'limit':0x1,'order':[[_0x94bf('0x73'),_0x94bf('0xb4')]]}]}]})['then'](handleEntityNotFound(_0x147f60,null))[_0x94bf('0x30')](function(_0x1f27f2){if(_0x1f27f2&&_0x1f27f2[_0x94bf('0x80')]){_0x2ca325=_0x1f27f2['get']({'plain':!![]});if(_0x2ca325[_0x94bf('0x80')]&&_0x2ca325[_0x94bf('0x80')][_0x94bf('0x7d')][_0x94bf('0x47')]){return _0x2ca325['List'][_0x94bf('0x7d')][0x0];}return db[_0x94bf('0x6f')][_0x94bf('0x59')](_[_0x94bf('0x17')](_0x5d327b['body'],{'firstName':_0x4bf1cd,[_0x1f27f2[_0x94bf('0x7a')]]:_0x4bf1cd,'phone':_0x4bf1cd,'ListId':_0x2ca325['ListId']}));}})[_0x94bf('0x30')](handleEntityNotFound(_0x147f60,null))[_0x94bf('0x30')](function(_0x94c712){if(_0x94c712){_0x3b8235=_0x94c712;return db[_0x94bf('0x89')][_0x94bf('0x57')]({'where':{'ContactId':_0x3b8235['id'],'closed':![],'OpenchannelAccountId':_0x2ca325['id']}})[_0x94bf('0x30')](function(_0x4486a6){if(_0x4486a6){return[_0x4486a6,![]];}return db[_0x94bf('0x89')][_0x94bf('0x59')]({'UserId':_0x5d327b[_0x94bf('0x5b')]['id'],'ContactId':_0x3b8235['id'],'OpenchannelAccountId':_0x2ca325['id'],'lastMsgDirection':_0x94bf('0xb5'),'Messages':[_[_0x94bf('0x4d')](_0x5d327b[_0x94bf('0x5a')],{'read':![],'body':_0x5d327b['body']['body'],'OpenchannelAccountId':_0x2ca325['id'],'UserId':_0x5d327b[_0x94bf('0x5b')]['id'],'ContactId':_0x3b8235['id']})]},{'include':[{'model':db[_0x94bf('0x92')],'as':_0x94bf('0xb6')}]})[_0x94bf('0x30')](function(_0x69b219){return[_0x69b219,!![]];});});}})[_0x94bf('0xb7')](function(_0x142fd1,_0x379cdf){if(_0x379cdf){return _0x142fd1;}return db[_0x94bf('0x92')][_0x94bf('0x59')](_[_0x94bf('0x4d')](_0x5d327b[_0x94bf('0x5a')],{'read':![],'body':_0x5d327b[_0x94bf('0x5a')][_0x94bf('0x5a')],'OpenchannelAccountId':_0x2ca325['id'],'OpenchannelInteractionId':_0x142fd1['id'],'UserId':_0x5d327b[_0x94bf('0x5b')]['id'],'ContactId':_0x3b8235['id']}))['then'](function(_0x46e43a){_0x142fd1[_0x94bf('0xb8')]['Messages']=[];_0x142fd1['dataValues'][_0x94bf('0xb6')][_0x94bf('0x90')](_0x46e43a[_0x94bf('0xb8')]);return _0x142fd1;});});}})[_0x94bf('0x30')](respondWithResult(_0x147f60,null))[_0x94bf('0x58')](handleError(_0x147f60,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d49c40d..8016b88 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 _0xb821=['OpenchannelAccount','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x45efd6,_0x2eb5c7){var _0x488c4f=function(_0xa63e38){while(--_0xa63e38){_0x45efd6['push'](_0x45efd6['shift']());}};_0x488c4f(++_0x2eb5c7);}(_0xb821,0xa7));var _0x1b82=function(_0x4b281e,_0x3602fe){_0x4b281e=_0x4b281e-0x0;var _0x13924a=_0xb821[_0x4b281e];return _0x13924a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x1b82('0x0'))['db'][_0x1b82('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b82('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b1809){return function(_0x3b1d14,_0x1403ab,_0x3fadf0){OpenchannelAccountEvents[_0x1b82('0x3')](_0x4b1809+':'+_0x3b1d14['id'],_0x3b1d14);OpenchannelAccountEvents['emit'](_0x4b1809,_0x3b1d14);_0x3fadf0(null);};}for(var e in events){if(events[_0x1b82('0x4')](e)){var event=events[e];OpenchannelAccount[_0x1b82('0x5')](e,emitEvent(event));}}module[_0x1b82('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x153f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount'];(function(_0x4b10e8,_0x22279e){var _0x4aa183=function(_0xb46b1e){while(--_0xb46b1e){_0x4b10e8['push'](_0x4b10e8['shift']());}};_0x4aa183(++_0x22279e);}(_0x153f,0x15b));var _0xf153=function(_0x5e2acf,_0x1ac4b7){_0x5e2acf=_0x5e2acf-0x0;var _0x9d6f05=_0x153f[_0x5e2acf];return _0x9d6f05;};'use strict';var EventEmitter=require(_0xf153('0x0'));var OpenchannelAccount=require(_0xf153('0x1'))['db'][_0xf153('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf153('0x3')](0x0);var events={'afterCreate':_0xf153('0x4'),'afterUpdate':_0xf153('0x5'),'afterDestroy':_0xf153('0x6')};function emitEvent(_0x59757c){return function(_0x364e65,_0x5c49c7,_0x1f9ead){OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c+':'+_0x364e65['id'],_0x364e65);OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c,_0x364e65);_0x1f9ead(null);};}for(var e in events){if(events[_0xf153('0x8')](e)){var event=events[e];OpenchannelAccount[_0xf153('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b54c711..1ca03f0 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(_0x1830e7,_0x1cbeb4){var _0x2feb8f=function(_0x26275b){while(--_0x26275b){_0x1830e7['push'](_0x1830e7['shift']());}};_0x2feb8f(++_0x1cbeb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x439282,_0xeb9a28){var _0x2adb31=function(_0x2366f9){while(--_0x2366f9){_0x439282['push'](_0x439282['shift']());}};_0x2adb31(++_0xeb9a28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d4d2023..f2b6393 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 _0xeffd=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xeffd,0x6b));var _0xdeff=function(_0x1874e7,_0x165679){_0x1874e7=_0x1874e7-0x0;var _0x44b3f6=_0xeffd[_0x1874e7];return _0x44b3f6;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});config[_0xdeff('0xd')]=_[_0xdeff('0xe')](config[_0xdeff('0xd')],{'host':_0xdeff('0xf'),'port':0x18eb});var socket=require(_0xdeff('0x10'))(new Redis(config['redis']));require(_0xdeff('0x11'))[_0xdeff('0x12')](socket);function respondWithRpcPromise(_0xf6d58d,_0x51fcb7,_0x1ff265){return new BPromise(function(_0x4423e9,_0x3c1482){return client[_0xdeff('0x13')](_0xf6d58d,_0x1ff265)[_0xdeff('0x14')](function(_0x256b73){logger[_0xdeff('0x15')](_0xdeff('0x16'),_0x51fcb7,'request\x20sent');logger[_0xdeff('0x17')](_0xdeff('0x18'),_0x51fcb7,'request\x20sent',JSON[_0xdeff('0x19')](_0x256b73));if(_0x256b73['error']){if(_0x256b73['error'][_0xdeff('0x1a')]===0x1f4){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')]['message']);return _0x3c1482(_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);}logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);return _0x4423e9(_0x256b73['error']['message']);}else{logger[_0xdeff('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x51fcb7,'request\x20sent');_0x4423e9(_0x256b73[_0xdeff('0x1d')][_0xdeff('0x1c')]);}})['catch'](function(_0x2de203){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x2de203);_0x3c1482(_0x2de203);});});} \ No newline at end of file +var _0xeffd=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xeffd,0x6b));var _0xdeff=function(_0x136ee3,_0x5d3527){_0x136ee3=_0x136ee3-0x0;var _0x1fe589=_0xeffd[_0x136ee3];return _0x1fe589;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});config[_0xdeff('0xd')]=_[_0xdeff('0xe')](config[_0xdeff('0xd')],{'host':_0xdeff('0xf'),'port':0x18eb});var socket=require(_0xdeff('0x10'))(new Redis(config['redis']));require(_0xdeff('0x11'))[_0xdeff('0x12')](socket);function respondWithRpcPromise(_0xf6d58d,_0x51fcb7,_0x1ff265){return new BPromise(function(_0x4423e9,_0x3c1482){return client[_0xdeff('0x13')](_0xf6d58d,_0x1ff265)[_0xdeff('0x14')](function(_0x256b73){logger[_0xdeff('0x15')](_0xdeff('0x16'),_0x51fcb7,'request\x20sent');logger[_0xdeff('0x17')](_0xdeff('0x18'),_0x51fcb7,'request\x20sent',JSON[_0xdeff('0x19')](_0x256b73));if(_0x256b73['error']){if(_0x256b73['error'][_0xdeff('0x1a')]===0x1f4){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')]['message']);return _0x3c1482(_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);}logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);return _0x4423e9(_0x256b73['error']['message']);}else{logger[_0xdeff('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x51fcb7,'request\x20sent');_0x4423e9(_0x256b73[_0xdeff('0x1d')][_0xdeff('0x1c')]);}})['catch'](function(_0x2de203){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x2de203);_0x3c1482(_0x2de203);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index bcaf3c7..df4a0bb 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 _0x702d=['remove','update','emit','register','length','./openchannelAccount.events','save'];(function(_0x191407,_0x2b5595){var _0x5c489c=function(_0x2a7ddd){while(--_0x2a7ddd){_0x191407['push'](_0x191407['shift']());}};_0x5c489c(++_0x2b5595);}(_0x702d,0x147));var _0xd702=function(_0x1ee1aa,_0x2e1644){_0x1ee1aa=_0x1ee1aa-0x0;var _0x5d81c5=_0x702d[_0x1ee1aa];return _0x5d81c5;};'use strict';var OpenchannelAccountEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){OpenchannelAccountEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('openchannelAccount:'+_0x5af246,_0x544e94);OpenchannelAccountEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file +var _0x76dc=['./openchannelAccount.events','save','remove','update','register','openchannelAccount:'];(function(_0x57c25d,_0x36a59d){var _0x4ad82c=function(_0x1a47f4){while(--_0x1a47f4){_0x57c25d['push'](_0x57c25d['shift']());}};_0x4ad82c(++_0x36a59d);}(_0x76dc,0x1f2));var _0xc76d=function(_0x4b4ee7,_0x37a1a2){_0x4b4ee7=_0x4b4ee7-0x0;var _0x16a01c=_0x76dc[_0x4b4ee7];return _0x16a01c;};'use strict';var OpenchannelAccountEvents=require(_0xc76d('0x0'));var events=[_0xc76d('0x1'),_0xc76d('0x2'),_0xc76d('0x3')];function createListener(_0x49c651,_0x2a8b7d){return function(_0x1ba6a1){_0x2a8b7d['emit'](_0x49c651,_0x1ba6a1);};}function removeListener(_0x300f11,_0x50ed3a){return function(){OpenchannelAccountEvents['removeListener'](_0x300f11,_0x50ed3a);};}exports[_0xc76d('0x4')]=function(_0x29ab70){for(var _0x1c86fc=0x0,_0x4832bd=events['length'];_0x1c86fc<_0x4832bd;_0x1c86fc++){var _0x119f38=events[_0x1c86fc];var _0x114572=createListener(_0xc76d('0x5')+_0x119f38,_0x29ab70);OpenchannelAccountEvents['on'](_0x119f38,_0x114572);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 662b827..a22a17c 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 _0x4e5c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x47dcfa,_0x23f84f){var _0x1fa806=function(_0x4aedcf){while(--_0x4aedcf){_0x47dcfa['push'](_0x47dcfa['shift']());}};_0x1fa806(++_0x23f84f);}(_0x4e5c,0xa9));var _0xc4e5=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4e5c[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xc4e5('0x0'));var util=require(_0xc4e5('0x1'));var path=require(_0xc4e5('0x2'));var timeout=require(_0xc4e5('0x3'));var express=require(_0xc4e5('0x4'));var router=express[_0xc4e5('0x5')]();var fs_extra=require(_0xc4e5('0x6'));var auth=require(_0xc4e5('0x7'));var interaction=require(_0xc4e5('0x8'));var config=require(_0xc4e5('0x9'));var controller=require(_0xc4e5('0xa'));router[_0xc4e5('0xb')]('/',auth['isAuthenticated'](),controller[_0xc4e5('0xc')]);router[_0xc4e5('0xb')](_0xc4e5('0xd'),auth[_0xc4e5('0xe')](),controller['show']);router[_0xc4e5('0xf')]('/',auth['isAuthenticated'](),controller[_0xc4e5('0x10')]);router[_0xc4e5('0x11')](_0xc4e5('0xd'),auth[_0xc4e5('0xe')](),controller[_0xc4e5('0x12')]);router[_0xc4e5('0x13')](_0xc4e5('0xd'),auth[_0xc4e5('0xe')](),controller[_0xc4e5('0x14')]);module[_0xc4e5('0x15')]=router; \ No newline at end of file +var _0x421a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','post','isAuthenticated','put','update','multer','path'];(function(_0x5896d6,_0x5e7ff3){var _0x566def=function(_0x31aa8c){while(--_0x31aa8c){_0x5896d6['push'](_0x5896d6['shift']());}};_0x566def(++_0x5e7ff3);}(_0x421a,0x1c0));var _0xa421=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x421a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa421('0x0'));var util=require('util');var path=require(_0xa421('0x1'));var timeout=require(_0xa421('0x2'));var express=require(_0xa421('0x3'));var router=express['Router']();var fs_extra=require(_0xa421('0x4'));var auth=require(_0xa421('0x5'));var interaction=require(_0xa421('0x6'));var config=require(_0xa421('0x7'));var controller=require(_0xa421('0x8'));router[_0xa421('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa421('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa421('0xb')]('/',auth[_0xa421('0xc')](),controller['create']);router[_0xa421('0xd')](_0xa421('0xa'),auth[_0xa421('0xc')](),controller[_0xa421('0xe')]);router['delete'](_0xa421('0xa'),auth[_0xa421('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index aba63a2..20f0770 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 _0x1f1f=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x5206e1,_0x2a2b0b){var _0xcc5430=function(_0x10656f){while(--_0x10656f){_0x5206e1['push'](_0x5206e1['shift']());}};_0xcc5430(++_0x2a2b0b);}(_0x1f1f,0x1d3));var _0xf1f1=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0x1f1f[_0x4c321c];return _0x25accb;};'use strict';var Sequelize=require(_0xf1f1('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf1f1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf1f1('0x2')],'allowNull':![],'defaultValue':_0xf1f1('0x3')},'appdata':{'type':Sequelize[_0xf1f1('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf1f1('0x2')],'defaultValue':_0xf1f1('0x5')}}; \ No newline at end of file +var _0x6de7=['sequelize','exports','TEXT','STRING','*,*,*,*'];(function(_0x18e4a9,_0x483058){var _0xeb55c3=function(_0x218497){while(--_0x218497){_0x18e4a9['push'](_0x18e4a9['shift']());}};_0xeb55c3(++_0x483058);}(_0x6de7,0x1cc));var _0x76de=function(_0x767fe7,_0x1db449){_0x767fe7=_0x767fe7-0x0;var _0x47771d=_0x6de7[_0x767fe7];return _0x47771d;};'use strict';var Sequelize=require(_0x76de('0x0'));module[_0x76de('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x76de('0x2')]()},'description':{'type':Sequelize[_0x76de('0x3')]},'interval':{'type':Sequelize[_0x76de('0x3')],'defaultValue':_0x76de('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 2f75975..9d0ca56 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 _0x5233=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','error','name','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x5233,0x90));var _0x3523=function(_0x2b685a,_0x561bf4){_0x2b685a=_0x2b685a-0x0;var _0x3f3a96=_0x5233[_0x2b685a];return _0x3f3a96;};'use strict';var emlformat=require(_0x3523('0x0'));var rimraf=require(_0x3523('0x1'));var zipdir=require(_0x3523('0x2'));var jsonpatch=require(_0x3523('0x3'));var rp=require(_0x3523('0x4'));var moment=require(_0x3523('0x5'));var BPromise=require(_0x3523('0x6'));var Mustache=require('mustache');var util=require(_0x3523('0x7'));var path=require(_0x3523('0x8'));var sox=require('sox');var csv=require(_0x3523('0x9'));var ejs=require(_0x3523('0xa'));var fs=require('fs');var fs_extra=require(_0x3523('0xb'));var _=require(_0x3523('0xc'));var squel=require(_0x3523('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3523('0xe'));var toCsv=require(_0x3523('0x9'));var querystring=require(_0x3523('0xf'));var Papa=require(_0x3523('0x10'));var Redis=require(_0x3523('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3523('0x12'));var logger=require(_0x3523('0x13'))('api');var utils=require(_0x3523('0x14'));var config=require(_0x3523('0x15'));var licenseUtil=require(_0x3523('0x16'));var db=require(_0x3523('0x17'))['db'];function respondWithStatusCode(_0x2a9e12,_0x364519){_0x364519=_0x364519||0xcc;return function(_0x522cda){if(_0x522cda){return _0x2a9e12[_0x3523('0x18')](_0x364519);}return _0x2a9e12[_0x3523('0x19')](_0x364519)['end']();};}function respondWithResult(_0x572683,_0x113d4e){_0x113d4e=_0x113d4e||0xc8;return function(_0x542e3f){if(_0x542e3f){return _0x572683[_0x3523('0x19')](_0x113d4e)['json'](_0x542e3f);}};}function respondWithFilteredResult(_0x5c0ce1,_0x5a4054){return function(_0x49ef90){if(_0x49ef90){var _0x2c7adc=typeof _0x5a4054['offset']==='undefined'&&typeof _0x5a4054['limit']===_0x3523('0x1a');var _0x11f5da=_0x49ef90[_0x3523('0x1b')];var _0x1c58a4=_0x2c7adc?0x0:_0x5a4054['offset'];var _0x4c0247=_0x2c7adc?_0x49ef90['count']:_0x5a4054[_0x3523('0x1c')]+_0x5a4054[_0x3523('0x1d')];var _0x1ea59e;if(_0x4c0247>=_0x11f5da){_0x4c0247=_0x11f5da;_0x1ea59e=0xc8;}else{_0x1ea59e=0xce;}_0x5c0ce1[_0x3523('0x19')](_0x1ea59e);return _0x5c0ce1[_0x3523('0x1e')](_0x3523('0x1f'),_0x1c58a4+'-'+_0x4c0247+'/'+_0x11f5da)['json'](_0x49ef90);}return null;};}function patchUpdates(_0xefcdc9){return function(_0x37f2ea){try{jsonpatch[_0x3523('0x20')](_0x37f2ea,_0xefcdc9,!![]);}catch(_0x20f37f){return BPromise[_0x3523('0x21')](_0x20f37f);}return _0x37f2ea['save']();};}function saveUpdates(_0x4f93a3,_0x231864){return function(_0x4a81b8){if(_0x4a81b8){return _0x4a81b8[_0x3523('0x22')](_0x4f93a3)[_0x3523('0x23')](function(_0x1ce8ef){return _0x1ce8ef;});}return null;};}function removeEntity(_0x516304,_0x562cb6){return function(_0x47f859){if(_0x47f859){return _0x47f859['destroy']()[_0x3523('0x23')](function(){_0x516304['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x218022,_0x2a2632){return function(_0x2007ae){if(!_0x2007ae){_0x218022[_0x3523('0x18')](0x194);}return _0x2007ae;};}function handleError(_0x24befd,_0x23b2e0){_0x23b2e0=_0x23b2e0||0x1f4;return function(_0x54b8c8){logger[_0x3523('0x24')](_0x54b8c8['stack']);if(_0x54b8c8['name']){delete _0x54b8c8[_0x3523('0x25')];}_0x24befd[_0x3523('0x19')](_0x23b2e0)['send'](_0x54b8c8);};}exports['index']=function(_0x5a8363,_0x44b909){var _0x474d39={},_0x4ec0fe={},_0x56d140={'count':0x0,'rows':[]};var _0x830064=_[_0x3523('0x26')](db[_0x3523('0x27')][_0x3523('0x28')],function(_0x542cd3){return{'name':_0x542cd3[_0x3523('0x29')],'type':_0x542cd3[_0x3523('0x2a')][_0x3523('0x2b')]};});_0x4ec0fe[_0x3523('0x2c')]=_[_0x3523('0x26')](_0x830064,_0x3523('0x25'));_0x4ec0fe[_0x3523('0x2d')]=_['keys'](_0x5a8363[_0x3523('0x2d')]);_0x4ec0fe[_0x3523('0x2e')]=_['intersection'](_0x4ec0fe[_0x3523('0x2c')],_0x4ec0fe[_0x3523('0x2d')]);_0x474d39['attributes']=_[_0x3523('0x2f')](_0x4ec0fe[_0x3523('0x2c')],qs[_0x3523('0x30')](_0x5a8363[_0x3523('0x2d')]['fields']));_0x474d39[_0x3523('0x31')]=_0x474d39[_0x3523('0x31')]['length']?_0x474d39[_0x3523('0x31')]:_0x4ec0fe[_0x3523('0x2c')];if(!_0x5a8363['query'][_0x3523('0x32')](_0x3523('0x33'))){_0x474d39['limit']=qs[_0x3523('0x1d')](_0x5a8363[_0x3523('0x2d')][_0x3523('0x1d')]);_0x474d39[_0x3523('0x1c')]=qs[_0x3523('0x1c')](_0x5a8363[_0x3523('0x2d')][_0x3523('0x1c')]);}_0x474d39[_0x3523('0x34')]=qs[_0x3523('0x35')](_0x5a8363[_0x3523('0x2d')][_0x3523('0x35')]);_0x474d39[_0x3523('0x36')]=qs[_0x3523('0x2e')](_[_0x3523('0x37')](_0x5a8363[_0x3523('0x2d')],_0x4ec0fe[_0x3523('0x2e')]),_0x830064);if(_0x5a8363['query'][_0x3523('0x38')]){_0x474d39[_0x3523('0x36')]=_[_0x3523('0x39')](_0x474d39[_0x3523('0x36')],{'$or':_['map'](_0x830064,function(_0x4e0b78){if(_0x4e0b78[_0x3523('0x2a')]!=='VIRTUAL'){var _0x53a77c={};_0x53a77c[_0x4e0b78['name']]={'$like':'%'+_0x5a8363[_0x3523('0x2d')]['filter']+'%'};return _0x53a77c;}})});}_0x474d39=_[_0x3523('0x39')]({},_0x474d39,_0x5a8363[_0x3523('0x3a')]);var _0x27e5dd={'where':_0x474d39[_0x3523('0x36')]};return db['OpenchannelApplication'][_0x3523('0x1b')](_0x27e5dd)['then'](function(_0x208916){_0x56d140[_0x3523('0x1b')]=_0x208916;if(_0x5a8363[_0x3523('0x2d')][_0x3523('0x3b')]){_0x474d39[_0x3523('0x3c')]=[{'all':!![]}];}return db[_0x3523('0x27')][_0x3523('0x3d')](_0x474d39);})[_0x3523('0x23')](function(_0xd7847a){_0x56d140[_0x3523('0x3e')]=_0xd7847a;return _0x56d140;})[_0x3523('0x23')](respondWithFilteredResult(_0x44b909,_0x474d39))[_0x3523('0x3f')](handleError(_0x44b909,null));};exports[_0x3523('0x40')]=function(_0x231620,_0x28efbd){var _0x502c0b={'raw':!![],'where':{'id':_0x231620[_0x3523('0x41')]['id']}},_0x3f8c2e={};_0x3f8c2e[_0x3523('0x2c')]=_[_0x3523('0x42')](db['OpenchannelApplication'][_0x3523('0x28')]);_0x3f8c2e[_0x3523('0x2d')]=_[_0x3523('0x42')](_0x231620[_0x3523('0x2d')]);_0x3f8c2e[_0x3523('0x2e')]=_[_0x3523('0x2f')](_0x3f8c2e[_0x3523('0x2c')],_0x3f8c2e[_0x3523('0x2d')]);_0x502c0b[_0x3523('0x31')]=_['intersection'](_0x3f8c2e[_0x3523('0x2c')],qs['fields'](_0x231620['query'][_0x3523('0x30')]));_0x502c0b[_0x3523('0x31')]=_0x502c0b[_0x3523('0x31')][_0x3523('0x43')]?_0x502c0b[_0x3523('0x31')]:_0x3f8c2e[_0x3523('0x2c')];if(_0x231620['query']['includeAll']){_0x502c0b[_0x3523('0x3c')]=[{'all':!![]}];}_0x502c0b=_[_0x3523('0x39')]({},_0x502c0b,_0x231620[_0x3523('0x3a')]);return db['OpenchannelApplication'][_0x3523('0x44')](_0x502c0b)[_0x3523('0x23')](handleEntityNotFound(_0x28efbd,null))[_0x3523('0x23')](respondWithResult(_0x28efbd,null))[_0x3523('0x3f')](handleError(_0x28efbd,null));};exports[_0x3523('0x45')]=function(_0x31aa4b,_0x499685){return db[_0x3523('0x27')][_0x3523('0x45')](_0x31aa4b[_0x3523('0x46')],{})[_0x3523('0x23')](respondWithResult(_0x499685,0xc9))[_0x3523('0x3f')](handleError(_0x499685,null));};exports[_0x3523('0x22')]=function(_0x23479f,_0x233746){if(_0x23479f[_0x3523('0x46')]['id']){delete _0x23479f[_0x3523('0x46')]['id'];}return db[_0x3523('0x27')][_0x3523('0x44')]({'where':{'id':_0x23479f[_0x3523('0x41')]['id']}})[_0x3523('0x23')](handleEntityNotFound(_0x233746,null))[_0x3523('0x23')](saveUpdates(_0x23479f[_0x3523('0x46')],null))['then'](respondWithResult(_0x233746,null))['catch'](handleError(_0x233746,null));};exports[_0x3523('0x47')]=function(_0x508342,_0x702c72){return db['OpenchannelApplication'][_0x3523('0x44')]({'where':{'id':_0x508342['params']['id']}})[_0x3523('0x23')](handleEntityNotFound(_0x702c72,null))['then'](removeEntity(_0x702c72,null))['catch'](handleError(_0x702c72,null));}; \ No newline at end of file +var _0xbd5d=['set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset'];(function(_0xdf6334,_0x1658f8){var _0x8ca5f7=function(_0x48e60e){while(--_0x48e60e){_0xdf6334['push'](_0xdf6334['shift']());}};_0x8ca5f7(++_0x1658f8);}(_0xbd5d,0x73));var _0xdbd5=function(_0x11ba75,_0x31fbd2){_0x11ba75=_0x11ba75-0x0;var _0x118378=_0xbd5d[_0x11ba75];return _0x118378;};'use strict';var emlformat=require(_0xdbd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbd5('0x1'));var jsonpatch=require(_0xdbd5('0x2'));var rp=require(_0xdbd5('0x3'));var moment=require(_0xdbd5('0x4'));var BPromise=require(_0xdbd5('0x5'));var Mustache=require(_0xdbd5('0x6'));var util=require(_0xdbd5('0x7'));var path=require(_0xdbd5('0x8'));var sox=require('sox');var csv=require(_0xdbd5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbd5('0xa'));var _=require(_0xdbd5('0xb'));var squel=require(_0xdbd5('0xc'));var crypto=require(_0xdbd5('0xd'));var jsforce=require(_0xdbd5('0xe'));var deskjs=require(_0xdbd5('0xf'));var toCsv=require(_0xdbd5('0x9'));var querystring=require(_0xdbd5('0x10'));var Papa=require(_0xdbd5('0x11'));var Redis=require(_0xdbd5('0x12'));var authService=require(_0xdbd5('0x13'));var qs=require(_0xdbd5('0x14'));var as=require(_0xdbd5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbd5('0x16'))('api');var utils=require(_0xdbd5('0x17'));var config=require(_0xdbd5('0x18'));var licenseUtil=require(_0xdbd5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd458d4,_0x901390){_0x901390=_0x901390||0xcc;return function(_0x75fbdf){if(_0x75fbdf){return _0xd458d4[_0xdbd5('0x1a')](_0x901390);}return _0xd458d4[_0xdbd5('0x1b')](_0x901390)[_0xdbd5('0x1c')]();};}function respondWithResult(_0x13131f,_0x5c62bd){_0x5c62bd=_0x5c62bd||0xc8;return function(_0x328c95){if(_0x328c95){return _0x13131f['status'](_0x5c62bd)['json'](_0x328c95);}};}function respondWithFilteredResult(_0x898e06,_0x3c2570){return function(_0x25ec92){if(_0x25ec92){var _0x435f6e=typeof _0x3c2570['offset']===_0xdbd5('0x1d')&&typeof _0x3c2570[_0xdbd5('0x1e')]==='undefined';var _0x49f176=_0x25ec92[_0xdbd5('0x1f')];var _0x432c5c=_0x435f6e?0x0:_0x3c2570[_0xdbd5('0x20')];var _0x55db31=_0x435f6e?_0x25ec92['count']:_0x3c2570['offset']+_0x3c2570['limit'];var _0x4de109;if(_0x55db31>=_0x49f176){_0x55db31=_0x49f176;_0x4de109=0xc8;}else{_0x4de109=0xce;}_0x898e06[_0xdbd5('0x1b')](_0x4de109);return _0x898e06[_0xdbd5('0x21')](_0xdbd5('0x22'),_0x432c5c+'-'+_0x55db31+'/'+_0x49f176)['json'](_0x25ec92);}return null;};}function patchUpdates(_0x438a90){return function(_0x3b1108){try{jsonpatch[_0xdbd5('0x23')](_0x3b1108,_0x438a90,!![]);}catch(_0x3e208e){return BPromise[_0xdbd5('0x24')](_0x3e208e);}return _0x3b1108[_0xdbd5('0x25')]();};}function saveUpdates(_0x3b4672,_0x273594){return function(_0x3192a6){if(_0x3192a6){return _0x3192a6[_0xdbd5('0x26')](_0x3b4672)[_0xdbd5('0x27')](function(_0x3033d7){return _0x3033d7;});}return null;};}function removeEntity(_0x5105e4,_0x3f98a5){return function(_0x34753b){if(_0x34753b){return _0x34753b[_0xdbd5('0x28')]()[_0xdbd5('0x27')](function(){_0x5105e4[_0xdbd5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19bdd9,_0x3cfbc5){return function(_0x5afa02){if(!_0x5afa02){_0x19bdd9['sendStatus'](0x194);}return _0x5afa02;};}function handleError(_0x4a5f6e,_0x3f916c){_0x3f916c=_0x3f916c||0x1f4;return function(_0x4748a4){logger[_0xdbd5('0x29')](_0x4748a4['stack']);if(_0x4748a4['name']){delete _0x4748a4[_0xdbd5('0x2a')];}_0x4a5f6e['status'](_0x3f916c)[_0xdbd5('0x2b')](_0x4748a4);};}exports[_0xdbd5('0x2c')]=function(_0x407780,_0x478caa){var _0x31498c={},_0x5ff2f2={},_0x2f9ee9={'count':0x0,'rows':[]};var _0x5e1dff=_[_0xdbd5('0x2d')](db[_0xdbd5('0x2e')][_0xdbd5('0x2f')],function(_0xffe85){return{'name':_0xffe85[_0xdbd5('0x30')],'type':_0xffe85['type'][_0xdbd5('0x31')]};});_0x5ff2f2[_0xdbd5('0x32')]=_['map'](_0x5e1dff,_0xdbd5('0x2a'));_0x5ff2f2['query']=_[_0xdbd5('0x33')](_0x407780[_0xdbd5('0x34')]);_0x5ff2f2['filters']=_[_0xdbd5('0x35')](_0x5ff2f2[_0xdbd5('0x32')],_0x5ff2f2[_0xdbd5('0x34')]);_0x31498c[_0xdbd5('0x36')]=_[_0xdbd5('0x35')](_0x5ff2f2[_0xdbd5('0x32')],qs['fields'](_0x407780[_0xdbd5('0x34')][_0xdbd5('0x37')]));_0x31498c[_0xdbd5('0x36')]=_0x31498c[_0xdbd5('0x36')][_0xdbd5('0x38')]?_0x31498c['attributes']:_0x5ff2f2[_0xdbd5('0x32')];if(!_0x407780[_0xdbd5('0x34')]['hasOwnProperty'](_0xdbd5('0x39'))){_0x31498c[_0xdbd5('0x1e')]=qs['limit'](_0x407780[_0xdbd5('0x34')][_0xdbd5('0x1e')]);_0x31498c[_0xdbd5('0x20')]=qs[_0xdbd5('0x20')](_0x407780[_0xdbd5('0x34')][_0xdbd5('0x20')]);}_0x31498c[_0xdbd5('0x3a')]=qs[_0xdbd5('0x3b')](_0x407780[_0xdbd5('0x34')][_0xdbd5('0x3b')]);_0x31498c[_0xdbd5('0x3c')]=qs[_0xdbd5('0x3d')](_[_0xdbd5('0x3e')](_0x407780[_0xdbd5('0x34')],_0x5ff2f2[_0xdbd5('0x3d')]),_0x5e1dff);if(_0x407780[_0xdbd5('0x34')][_0xdbd5('0x3f')]){_0x31498c['where']=_[_0xdbd5('0x40')](_0x31498c[_0xdbd5('0x3c')],{'$or':_[_0xdbd5('0x2d')](_0x5e1dff,function(_0x39cc1e){if(_0x39cc1e['type']!==_0xdbd5('0x41')){var _0x1f41dc={};_0x1f41dc[_0x39cc1e[_0xdbd5('0x2a')]]={'$like':'%'+_0x407780['query']['filter']+'%'};return _0x1f41dc;}})});}_0x31498c=_[_0xdbd5('0x40')]({},_0x31498c,_0x407780[_0xdbd5('0x42')]);var _0xf5d354={'where':_0x31498c[_0xdbd5('0x3c')]};return db['OpenchannelApplication']['count'](_0xf5d354)[_0xdbd5('0x27')](function(_0x3aef7e){_0x2f9ee9['count']=_0x3aef7e;if(_0x407780[_0xdbd5('0x34')][_0xdbd5('0x43')]){_0x31498c[_0xdbd5('0x44')]=[{'all':!![]}];}return db[_0xdbd5('0x2e')][_0xdbd5('0x45')](_0x31498c);})[_0xdbd5('0x27')](function(_0x4dd97e){_0x2f9ee9['rows']=_0x4dd97e;return _0x2f9ee9;})[_0xdbd5('0x27')](respondWithFilteredResult(_0x478caa,_0x31498c))[_0xdbd5('0x46')](handleError(_0x478caa,null));};exports['show']=function(_0x4ccdc9,_0x399557){var _0x2357b6={'raw':!![],'where':{'id':_0x4ccdc9[_0xdbd5('0x47')]['id']}},_0x16bb98={};_0x16bb98[_0xdbd5('0x32')]=_['keys'](db[_0xdbd5('0x2e')]['rawAttributes']);_0x16bb98[_0xdbd5('0x34')]=_[_0xdbd5('0x33')](_0x4ccdc9[_0xdbd5('0x34')]);_0x16bb98['filters']=_[_0xdbd5('0x35')](_0x16bb98[_0xdbd5('0x32')],_0x16bb98[_0xdbd5('0x34')]);_0x2357b6[_0xdbd5('0x36')]=_[_0xdbd5('0x35')](_0x16bb98[_0xdbd5('0x32')],qs['fields'](_0x4ccdc9['query']['fields']));_0x2357b6[_0xdbd5('0x36')]=_0x2357b6[_0xdbd5('0x36')]['length']?_0x2357b6[_0xdbd5('0x36')]:_0x16bb98[_0xdbd5('0x32')];if(_0x4ccdc9[_0xdbd5('0x34')][_0xdbd5('0x43')]){_0x2357b6[_0xdbd5('0x44')]=[{'all':!![]}];}_0x2357b6=_['merge']({},_0x2357b6,_0x4ccdc9[_0xdbd5('0x42')]);return db['OpenchannelApplication']['find'](_0x2357b6)[_0xdbd5('0x27')](handleEntityNotFound(_0x399557,null))['then'](respondWithResult(_0x399557,null))[_0xdbd5('0x46')](handleError(_0x399557,null));};exports['create']=function(_0x574451,_0x3cd33c){return db['OpenchannelApplication']['create'](_0x574451['body'],{})[_0xdbd5('0x27')](respondWithResult(_0x3cd33c,0xc9))[_0xdbd5('0x46')](handleError(_0x3cd33c,null));};exports[_0xdbd5('0x26')]=function(_0x953cb5,_0x177f01){if(_0x953cb5['body']['id']){delete _0x953cb5[_0xdbd5('0x48')]['id'];}return db['OpenchannelApplication'][_0xdbd5('0x49')]({'where':{'id':_0x953cb5['params']['id']}})[_0xdbd5('0x27')](handleEntityNotFound(_0x177f01,null))[_0xdbd5('0x27')](saveUpdates(_0x953cb5[_0xdbd5('0x48')],null))[_0xdbd5('0x27')](respondWithResult(_0x177f01,null))[_0xdbd5('0x46')](handleError(_0x177f01,null));};exports[_0xdbd5('0x28')]=function(_0x3f6d35,_0xaaa845){return db[_0xdbd5('0x2e')][_0xdbd5('0x49')]({'where':{'id':_0x3f6d35[_0xdbd5('0x47')]['id']}})[_0xdbd5('0x27')](handleEntityNotFound(_0xaaa845,null))[_0xdbd5('0x27')](removeEntity(_0xaaa845,null))[_0xdbd5('0x46')](handleError(_0xaaa845,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index bd519a1..f1a3c27 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 _0x55a3=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x55a3,0xe3));var _0x355a=function(_0x2c2781,_0x5f1153){_0x2c2781=_0x2c2781-0x0;var _0x3fe469=_0x55a3[_0x2c2781];return _0x3fe469;};'use strict';var _=require(_0x355a('0x0'));var util=require(_0x355a('0x1'));var logger=require(_0x355a('0x2'))('api');var moment=require(_0x355a('0x3'));var BPromise=require(_0x355a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x355a('0x5'));var rimraf=require(_0x355a('0x6'));var config=require(_0x355a('0x7'));var attributes=require(_0x355a('0x8'));module[_0x355a('0x9')]=function(_0x1f7cce,_0x2a1753){return _0x1f7cce[_0x355a('0xa')](_0x355a('0xb'),attributes,{'tableName':_0x355a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x355a('0xd'),'collate':_0x355a('0xe')});}; \ No newline at end of file +var _0x4f5d=['define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x1a210e,_0x18a85a){var _0x368a5d=function(_0x247e77){while(--_0x247e77){_0x1a210e['push'](_0x1a210e['shift']());}};_0x368a5d(++_0x18a85a);}(_0x4f5d,0xef));var _0xd4f5=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4f5d[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xd4f5('0x0'));var util=require('util');var logger=require(_0xd4f5('0x1'))('api');var moment=require(_0xd4f5('0x2'));var BPromise=require(_0xd4f5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f5('0x4'));var rimraf=require(_0xd4f5('0x5'));var config=require(_0xd4f5('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0xd4f5('0x7')]=function(_0xfb941e,_0x4f8677){return _0xfb941e[_0xd4f5('0x8')](_0xd4f5('0x9'),attributes,{'tableName':_0xd4f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd4f5('0xb'),'collate':_0xd4f5('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 627dcfe..472269a 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 _0x9966=['request\x20sent','error','code','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','stringify','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x9966,0x11e));var _0x6996=function(_0x27e649,_0x40868c){_0x27e649=_0x27e649-0x0;var _0x27f389=_0x9966[_0x27e649];return _0x27f389;};'use strict';var _=require('lodash');var util=require(_0x6996('0x0'));var moment=require('moment');var BPromise=require(_0x6996('0x1'));var rs=require(_0x6996('0x2'));var fs=require('fs');var Redis=require(_0x6996('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6996('0x4'))('rpc');var config=require(_0x6996('0x5'));var jayson=require(_0x6996('0x6'));var client=jayson[_0x6996('0x7')][_0x6996('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e1612,_0x26287b,_0xde4bef){return new BPromise(function(_0x104aec,_0x3913ae){return client[_0x6996('0x9')](_0x1e1612,_0xde4bef)[_0x6996('0xa')](function(_0x52edd9){logger['info'](_0x6996('0xb'),_0x26287b,'request\x20sent');logger[_0x6996('0xc')](_0x6996('0xd'),_0x26287b,_0x6996('0xe'),JSON['stringify'](_0x52edd9));if(_0x52edd9[_0x6996('0xf')]){if(_0x52edd9[_0x6996('0xf')][_0x6996('0x10')]===0x1f4){logger[_0x6996('0xf')](_0x6996('0xb'),_0x26287b,_0x52edd9[_0x6996('0xf')]['message']);return _0x3913ae(_0x52edd9[_0x6996('0xf')][_0x6996('0x11')]);}logger['error'](_0x6996('0xb'),_0x26287b,_0x52edd9[_0x6996('0xf')][_0x6996('0x11')]);return _0x104aec(_0x52edd9[_0x6996('0xf')]['message']);}else{logger[_0x6996('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x26287b,'request\x20sent');_0x104aec(_0x52edd9['result'][_0x6996('0x11')]);}})[_0x6996('0x13')](function(_0x4bb54b){logger['error'](_0x6996('0xb'),_0x26287b,_0x4bb54b);_0x3913ae(_0x4bb54b);});});}exports[_0x6996('0x14')]=function(_0x36f370){var _0x5abb5d=this;return new Promise(function(_0x6a2a9c,_0x71740c){return db[_0x6996('0x15')][_0x6996('0x16')](_0x36f370[_0x6996('0x17')],{'raw':_0x36f370[_0x6996('0x18')]?_0x36f370[_0x6996('0x18')][_0x6996('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f370['options']?_0x36f370[_0x6996('0x18')][_0x6996('0x1a')]||null:null,'attributes':_0x36f370[_0x6996('0x18')]?_0x36f370['options'][_0x6996('0x1b')]||null:null,'limit':_0x36f370[_0x6996('0x18')]?_0x36f370[_0x6996('0x18')][_0x6996('0x1c')]||null:null})[_0x6996('0xa')](function(_0x3799a3){logger['info'](_0x6996('0x14'),_0x36f370);logger[_0x6996('0xc')](_0x6996('0x14'),_0x36f370,JSON[_0x6996('0x1d')](_0x3799a3));_0x6a2a9c(_0x3799a3);})[_0x6996('0x13')](function(_0x5ea3b0){logger['error']('UpdateOpenchannelApplication',_0x5ea3b0[_0x6996('0x11')],_0x36f370);_0x71740c(_0x5abb5d[_0x6996('0xf')](0x1f4,_0x5ea3b0[_0x6996('0x11')]));});});}; \ No newline at end of file +var _0x43fb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','raw','options','where','limit','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x2c25c7,_0x57f2d7){var _0x1e51bd=function(_0x544467){while(--_0x544467){_0x2c25c7['push'](_0x2c25c7['shift']());}};_0x1e51bd(++_0x57f2d7);}(_0x43fb,0xb5));var _0xb43f=function(_0x5c6b87,_0x6d552e){_0x5c6b87=_0x5c6b87-0x0;var _0x4a07cf=_0x43fb[_0x5c6b87];return _0x4a07cf;};'use strict';var _=require(_0xb43f('0x0'));var util=require(_0xb43f('0x1'));var moment=require(_0xb43f('0x2'));var BPromise=require('bluebird');var rs=require(_0xb43f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb43f('0x4'))['db'];var utils=require(_0xb43f('0x5'));var logger=require(_0xb43f('0x6'))(_0xb43f('0x7'));var config=require(_0xb43f('0x8'));var jayson=require(_0xb43f('0x9'));var client=jayson[_0xb43f('0xa')][_0xb43f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b7f1,_0x1d5ea6,_0x46f72d){return new BPromise(function(_0x2c0b13,_0x3bdfcb){return client['request'](_0x26b7f1,_0x46f72d)[_0xb43f('0xc')](function(_0x2e32c2){logger[_0xb43f('0xd')](_0xb43f('0xe'),_0x1d5ea6,_0xb43f('0xf'));logger[_0xb43f('0x10')](_0xb43f('0x11'),_0x1d5ea6,_0xb43f('0xf'),JSON[_0xb43f('0x12')](_0x2e32c2));if(_0x2e32c2[_0xb43f('0x13')]){if(_0x2e32c2[_0xb43f('0x13')][_0xb43f('0x14')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1d5ea6,_0x2e32c2[_0xb43f('0x13')][_0xb43f('0x15')]);return _0x3bdfcb(_0x2e32c2['error'][_0xb43f('0x15')]);}logger[_0xb43f('0x13')](_0xb43f('0xe'),_0x1d5ea6,_0x2e32c2[_0xb43f('0x13')][_0xb43f('0x15')]);return _0x2c0b13(_0x2e32c2[_0xb43f('0x13')][_0xb43f('0x15')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x1d5ea6,_0xb43f('0xf'));_0x2c0b13(_0x2e32c2['result'][_0xb43f('0x15')]);}})[_0xb43f('0x16')](function(_0x537678){logger[_0xb43f('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x1d5ea6,_0x537678);_0x3bdfcb(_0x537678);});});}exports[_0xb43f('0x17')]=function(_0x4eed08){var _0x1df48b=this;return new Promise(function(_0x188669,_0x4e15fb){return db[_0xb43f('0x18')][_0xb43f('0x19')](_0x4eed08[_0xb43f('0x1a')],{'raw':_0x4eed08['options']?_0x4eed08['options'][_0xb43f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eed08[_0xb43f('0x1c')]?_0x4eed08[_0xb43f('0x1c')][_0xb43f('0x1d')]||null:null,'attributes':_0x4eed08[_0xb43f('0x1c')]?_0x4eed08[_0xb43f('0x1c')]['attributes']||null:null,'limit':_0x4eed08[_0xb43f('0x1c')]?_0x4eed08[_0xb43f('0x1c')][_0xb43f('0x1e')]||null:null})[_0xb43f('0xc')](function(_0x34231d){logger[_0xb43f('0xd')](_0xb43f('0x17'),_0x4eed08);logger['debug'](_0xb43f('0x17'),_0x4eed08,JSON[_0xb43f('0x12')](_0x34231d));_0x188669(_0x34231d);})[_0xb43f('0x16')](function(_0x1bb328){logger[_0xb43f('0x13')]('UpdateOpenchannelApplication',_0x1bb328[_0xb43f('0x15')],_0x4eed08);_0x4e15fb(_0x1df48b[_0xb43f('0x13')](0x1f4,_0x1bb328[_0xb43f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 92a50f1..1ae43e5 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 _0x2134=['addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','removeTags','multer','util','express','Router','fs-extra','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','/:id/messages'];(function(_0x1e2e74,_0x44f15d){var _0x2a6034=function(_0x28009e){while(--_0x28009e){_0x1e2e74['push'](_0x1e2e74['shift']());}};_0x2a6034(++_0x44f15d);}(_0x2134,0x15a));var _0x4213=function(_0x2c4a59,_0x4cdc19){_0x2c4a59=_0x2c4a59-0x0;var _0x4307e2=_0x2134[_0x2c4a59];return _0x4307e2;};'use strict';var multer=require(_0x4213('0x0'));var util=require(_0x4213('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4213('0x2'));var router=express[_0x4213('0x3')]();var fs_extra=require(_0x4213('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4213('0x5'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4213('0x6')]);router[_0x4213('0x7')](_0x4213('0x8'),auth[_0x4213('0x9')](),controller[_0x4213('0xa')]);router['get'](_0x4213('0xb'),auth[_0x4213('0x9')](),controller[_0x4213('0xc')]);router[_0x4213('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4213('0xd')]);router[_0x4213('0x7')](_0x4213('0xe'),auth[_0x4213('0x9')](),controller['download']);router[_0x4213('0xf')]('/',auth['isAuthenticated'](),controller[_0x4213('0x10')]);router[_0x4213('0xf')](_0x4213('0x11'),auth[_0x4213('0x9')](),controller[_0x4213('0x12')]);router[_0x4213('0xf')](_0x4213('0x13'),auth[_0x4213('0x9')](),interaction[_0x4213('0x14')]('openchannel',_0x4213('0x15')),controller[_0x4213('0x16')]);router[_0x4213('0x17')]('/:id',auth[_0x4213('0x9')](),interaction[_0x4213('0x14')](_0x4213('0x18'),'openchannelinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x4213('0x14')](_0x4213('0x18'),'openchannelinteraction:destroy'),controller['destroy']);router['delete'](_0x4213('0x13'),auth[_0x4213('0x9')](),controller[_0x4213('0x19')]);module['exports']=router; \ No newline at end of file +var _0xdeed=['removeTags','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','openchannelinteraction:addtags','addTags','put','tracked','update','delete','openchannel'];(function(_0x315751,_0x42107d){var _0x2cdcd5=function(_0x3de2eb){while(--_0x3de2eb){_0x315751['push'](_0x315751['shift']());}};_0x2cdcd5(++_0x42107d);}(_0xdeed,0x16d));var _0xddee=function(_0x2c1f52,_0x1e6f49){_0x2c1f52=_0x2c1f52-0x0;var _0x241bc1=_0xdeed[_0x2c1f52];return _0x241bc1;};'use strict';var multer=require(_0xddee('0x0'));var util=require('util');var path=require(_0xddee('0x1'));var timeout=require(_0xddee('0x2'));var express=require(_0xddee('0x3'));var router=express[_0xddee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xddee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddee('0x6'));var controller=require(_0xddee('0x7'));router[_0xddee('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xddee('0x8')](_0xddee('0x9'),auth[_0xddee('0xa')](),controller[_0xddee('0xb')]);router[_0xddee('0x8')](_0xddee('0xc'),auth['isAuthenticated'](),controller[_0xddee('0xd')]);router[_0xddee('0x8')](_0xddee('0xe'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xddee('0xf'),auth[_0xddee('0xa')](),controller[_0xddee('0x10')]);router[_0xddee('0x11')]('/',auth['isAuthenticated'](),controller[_0xddee('0x12')]);router[_0xddee('0x11')](_0xddee('0xe'),auth[_0xddee('0xa')](),controller[_0xddee('0x13')]);router[_0xddee('0x11')]('/:id/tags',auth[_0xddee('0xa')](),interaction['tracked']('openchannel',_0xddee('0x14')),controller[_0xddee('0x15')]);router[_0xddee('0x16')](_0xddee('0xc'),auth[_0xddee('0xa')](),interaction[_0xddee('0x17')]('openchannel','openchannelinteraction:update'),controller[_0xddee('0x18')]);router[_0xddee('0x19')](_0xddee('0xc'),auth['isAuthenticated'](),interaction[_0xddee('0x17')](_0xddee('0x1a'),'openchannelinteraction:destroy'),controller['destroy']);router[_0xddee('0x19')]('/:id/tags',auth[_0xddee('0xa')](),controller[_0xddee('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ba0dd67..17a72a0 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 _0xfd3a=['ENUM','out','BOOLEAN','STRING','DATE'];(function(_0x451cc1,_0xba13e2){var _0x11745b=function(_0x50ce99){while(--_0x50ce99){_0x451cc1['push'](_0x451cc1['shift']());}};_0x11745b(++_0xba13e2);}(_0xfd3a,0xb1));var _0xafd3=function(_0x5c40b0,_0x2f7aed){_0x5c40b0=_0x5c40b0-0x0;var _0x2b71f1=_0xfd3a[_0x5c40b0];return _0x2b71f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xafd3('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xafd3('0x1')]},'thirdDisposition':{'type':Sequelize[_0xafd3('0x1')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xafd3('0x2')]},'threadId':{'type':Sequelize[_0xafd3('0x1')]},'externalUrl':{'type':Sequelize[_0xafd3('0x1')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xafd3('0x3')]('in',_0xafd3('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xafd3('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0xafd3('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x32ef=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x1eb05b,_0x190b22){var _0x134f13=function(_0x103c18){while(--_0x103c18){_0x1eb05b['push'](_0x1eb05b['shift']());}};_0x134f13(++_0x190b22);}(_0x32ef,0xf9));var _0xf32e=function(_0x215e1b,_0x447a1a){_0x215e1b=_0x215e1b-0x0;var _0x1db15c=_0x32ef[_0x215e1b];return _0x1db15c;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'closed':{'type':Sequelize[_0xf32e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf32e('0x3')]},'disposition':{'type':Sequelize[_0xf32e('0x4')]},'secondDisposition':{'type':Sequelize[_0xf32e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf32e('0x4')]},'read1stAt':{'type':Sequelize[_0xf32e('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xf32e('0x4')]},'lastMsgAt':{'type':Sequelize[_0xf32e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf32e('0x5')]('in',_0xf32e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf32e('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf32e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 83ad4bc..ef0e555 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 _0xdd36=['operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IN\x20?','sequelize','merge','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','toString','groupBy','OpenchannelInteractionId','push','all','rows','catch','params','includeAll','options','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','pick','include','setTags','spread','findAll','color','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','firstName','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','Messages','Attachment','basename','existsSync','pipe','direction','out','lastName','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','Users','map','fullname','TagIds','Tags','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','select','field','from','tools_tags','u.fullname','user_has_openchannel_interactions','left_join','users','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User'];(function(_0x2ba4d0,_0x5d1ecc){var _0x35e3af=function(_0xd42a64){while(--_0xd42a64){_0x2ba4d0['push'](_0x2ba4d0['shift']());}};_0x35e3af(++_0x5d1ecc);}(_0xdd36,0x16e));var _0x6dd3=function(_0x3d8a3b,_0xfd036a){_0x3d8a3b=_0x3d8a3b-0x0;var _0x599e5c=_0xdd36[_0x3d8a3b];return _0x599e5c;};'use strict';var emlformat=require(_0x6dd3('0x0'));var rimraf=require(_0x6dd3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6dd3('0x2'));var rp=require('request-promise');var moment=require(_0x6dd3('0x3'));var BPromise=require(_0x6dd3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6dd3('0x5'));var csv=require(_0x6dd3('0x6'));var ejs=require(_0x6dd3('0x7'));var fs=require('fs');var fs_extra=require(_0x6dd3('0x8'));var _=require(_0x6dd3('0x9'));var squel=require('squel');var crypto=require(_0x6dd3('0xa'));var jsforce=require(_0x6dd3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6dd3('0x6'));var querystring=require(_0x6dd3('0xc'));var Papa=require(_0x6dd3('0xd'));var Redis=require('ioredis');var authService=require(_0x6dd3('0xe'));var qs=require(_0x6dd3('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x6dd3('0x10'));var hardwareService=require(_0x6dd3('0x11'));var logger=require(_0x6dd3('0x12'))(_0x6dd3('0x13'));var utils=require(_0x6dd3('0x14'));var config=require(_0x6dd3('0x15'));var licenseUtil=require(_0x6dd3('0x16'));var db=require(_0x6dd3('0x17'))['db'];config[_0x6dd3('0x18')]=_['defaults'](config[_0x6dd3('0x18')],{'host':_0x6dd3('0x19'),'port':0x18eb});var socket=require(_0x6dd3('0x1a'))(new Redis(config['redis']));require(_0x6dd3('0x1b'))[_0x6dd3('0x1c')](socket);function respondWithStatusCode(_0x7d6d8d,_0x59e531){_0x59e531=_0x59e531||0xcc;return function(_0x363df8){if(_0x363df8){return _0x7d6d8d[_0x6dd3('0x1d')](_0x59e531);}return _0x7d6d8d[_0x6dd3('0x1e')](_0x59e531)['end']();};}function respondWithResult(_0x4810ee,_0x1ab7f9){_0x1ab7f9=_0x1ab7f9||0xc8;return function(_0x2623b4){if(_0x2623b4){return _0x4810ee[_0x6dd3('0x1e')](_0x1ab7f9)[_0x6dd3('0x1f')](_0x2623b4);}};}function respondWithFilteredResult(_0x39de6b,_0x33a1c3){return function(_0x293092){if(_0x293092){var _0x59b8c0=typeof _0x33a1c3[_0x6dd3('0x20')]===_0x6dd3('0x21')&&typeof _0x33a1c3['limit']===_0x6dd3('0x21');var _0x3254b5=_0x293092['count'];var _0x4caacd=_0x59b8c0?0x0:_0x33a1c3['offset'];var _0x230fcf=_0x59b8c0?_0x293092[_0x6dd3('0x22')]:_0x33a1c3[_0x6dd3('0x20')]+_0x33a1c3[_0x6dd3('0x23')];var _0x28ede1;if(_0x230fcf>=_0x3254b5){_0x230fcf=_0x3254b5;_0x28ede1=0xc8;}else{_0x28ede1=0xce;}_0x39de6b['status'](_0x28ede1);return _0x39de6b[_0x6dd3('0x24')](_0x6dd3('0x25'),_0x4caacd+'-'+_0x230fcf+'/'+_0x3254b5)['json'](_0x293092);}return null;};}function patchUpdates(_0x2401b6){return function(_0x5800a2){try{jsonpatch[_0x6dd3('0x26')](_0x5800a2,_0x2401b6,!![]);}catch(_0x6cd663){return BPromise[_0x6dd3('0x27')](_0x6cd663);}return _0x5800a2[_0x6dd3('0x28')]();};}function saveUpdates(_0x2f0dc1,_0x4d69ca){return function(_0x2c9bf1){if(_0x2c9bf1){return _0x2c9bf1[_0x6dd3('0x29')](_0x2f0dc1)['then'](function(_0x1839a7){return _0x1839a7;});}return null;};}function removeEntity(_0xf022cf,_0x181fa6){return function(_0x390591){if(_0x390591){return _0x390591[_0x6dd3('0x2a')]()[_0x6dd3('0x2b')](function(){_0xf022cf[_0x6dd3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x222bd9,_0x3dd0c5){return function(_0x3aef24){if(!_0x3aef24){_0x222bd9[_0x6dd3('0x1d')](0x194);}return _0x3aef24;};}function handleError(_0x444567,_0x5c00d1){_0x5c00d1=_0x5c00d1||0x1f4;return function(_0x35898f){logger[_0x6dd3('0x2c')](_0x35898f[_0x6dd3('0x2d')]);if(_0x35898f[_0x6dd3('0x2e')]){delete _0x35898f[_0x6dd3('0x2e')];}_0x444567['status'](_0x5c00d1)['send'](_0x35898f);};}function getInteractionUsers(_0x489286,_0x1ac6aa){return new BPromise(function(_0xed3c36,_0xbf74cd){try{if(_0x1ac6aa[_0x489286['id']]){_0x489286[_0x6dd3('0x2f')]=_[_0x6dd3('0x30')](_0x1ac6aa[_0x489286['id']],function(_0x6e172a){return{'id':_0x6e172a['id'],'fullname':_0x6e172a[_0x6dd3('0x31')]};});}}catch(_0x2d2ecc){_0xbf74cd(_0x2d2ecc);}_0xed3c36(_0x489286);});}function getInteractionTags(_0x2d8ff2,_0x56a851){return new BPromise(function(_0x3ed7aa,_0x204511){try{if(_0x2d8ff2[_0x6dd3('0x32')]){_0x2d8ff2[_0x6dd3('0x33')]=[];_0x2d8ff2[_0x6dd3('0x32')]['split'](',')['forEach'](function(_0x40263d){_0x2d8ff2['Tags']['push'](_0x56a851[_0x40263d]);});}delete _0x2d8ff2['TagIds'];}catch(_0x3ae320){_0x204511(_0x3ae320);}_0x3ed7aa(_0x2d8ff2);});}function updateOpenchannelInteraction(_0x2adc82,_0x5f0b5e,_0x5323ee){return new BPromise(function(_0x249dfc,_0x39b783){return getInteractionUsers(_0x2adc82,_0x5323ee)[_0x6dd3('0x2b')](function(_0x5cac7a){return getInteractionTags(_0x5cac7a,_0x5f0b5e);})[_0x6dd3('0x2b')](function(_0xa9e535){_0x249dfc(_0xa9e535);})['catch'](function(_0x48b556){_0x39b783(_0x48b556);});});}exports[_0x6dd3('0x34')]=function(_0x41359f,_0x973ea9){var _0x30e4c3={},_0x579ef1={},_0x27850a={'count':0x0,'rows':[]};var _0xb73dfa=_[_0x6dd3('0x30')](db[_0x6dd3('0x35')][_0x6dd3('0x36')],function(_0x1a67c1){return{'name':_0x1a67c1[_0x6dd3('0x37')],'type':_0x1a67c1[_0x6dd3('0x38')][_0x6dd3('0x39')]};});_0x579ef1['model']=_[_0x6dd3('0x30')](_0xb73dfa,_0x6dd3('0x2e'));_0x579ef1[_0x6dd3('0x3a')]=_[_0x6dd3('0x3b')](_0x41359f[_0x6dd3('0x3a')]);_0x579ef1[_0x6dd3('0x3c')]=_[_0x6dd3('0x3d')](_0x579ef1[_0x6dd3('0x3e')],_0x579ef1[_0x6dd3('0x3a')]);_0x30e4c3[_0x6dd3('0x3f')]=_[_0x6dd3('0x3d')](_0x579ef1[_0x6dd3('0x3e')],qs['fields'](_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x40')]));_0x30e4c3[_0x6dd3('0x3f')]=_0x30e4c3[_0x6dd3('0x3f')]['length']?_0x30e4c3[_0x6dd3('0x3f')]:_0x579ef1[_0x6dd3('0x3e')];if(!_0x41359f[_0x6dd3('0x3a')]['hasOwnProperty'](_0x6dd3('0x41'))){_0x30e4c3[_0x6dd3('0x23')]=qs[_0x6dd3('0x23')](_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x23')]);_0x30e4c3[_0x6dd3('0x20')]=qs[_0x6dd3('0x20')](_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x20')]);}_0x30e4c3['order']=qs[_0x6dd3('0x42')](_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x42')]);_0x30e4c3[_0x6dd3('0x43')]=qs[_0x6dd3('0x3c')](_['pick'](_0x41359f[_0x6dd3('0x3a')],_0x579ef1[_0x6dd3('0x3c')]),_0xb73dfa);var _0x5eb4af=[];var _0x45f5fd=squel[_0x6dd3('0x44')]()['field']('id')['field']('name')[_0x6dd3('0x45')]('color')[_0x6dd3('0x46')](_0x6dd3('0x47'));var _0x2315ac=squel[_0x6dd3('0x44')]()[_0x6dd3('0x45')]('u.id')[_0x6dd3('0x45')](_0x6dd3('0x48'))[_0x6dd3('0x45')]('ui.OpenchannelInteractionId')[_0x6dd3('0x46')](_0x6dd3('0x49'),'ui')[_0x6dd3('0x4a')](_0x6dd3('0x4b'),'u','u.id\x20=\x20ui.UserId');var _0x3c868f=squel[_0x6dd3('0x44')]()[_0x6dd3('0x46')](_0x6dd3('0x4c'),'i')[_0x6dd3('0x4a')]('cm_contacts','c',_0x6dd3('0x4d'))[_0x6dd3('0x4a')](_0x6dd3('0x4b'),'o',_0x6dd3('0x4e'))[_0x6dd3('0x4a')]('openchannel_accounts','a',_0x6dd3('0x4f'))[_0x6dd3('0x4a')](_0x6dd3('0x50'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x6dd3('0x4a')](_0x6dd3('0x51'),'it',_0x6dd3('0x52'))[_0x6dd3('0x4a')](_0x6dd3('0x47'),'t',_0x6dd3('0x53'));var _0x282383=squel[_0x6dd3('0x54')]();var _0xa35f5a=[];var _0x5ed89e=squel[_0x6dd3('0x54')]();var _0x4f2af5;if(_0x41359f['query'][_0x6dd3('0x55')]){_0x4f2af5=as[_0x6dd3('0x56')](_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x55')]);var _0x1e69e7=_0x4f2af5[_0x6dd3('0x57')];for(var _0x10bfd5=0x0;_0x10bfd5<_0x4f2af5['conditions'][_0x6dd3('0x58')];_0x10bfd5++){var _0x4c9fb7=_0x4f2af5[_0x6dd3('0x59')][_0x10bfd5];var _0x11211b='i';var _0xcde468=_['find'](_0xb73dfa,[_0x6dd3('0x2e'),_0x4c9fb7[_0x6dd3('0x45')]]);if(!_0xcde468){switch(_0x4c9fb7[_0x6dd3('0x45')]){case'unreadMessages':if(_0x4c9fb7[_0x6dd3('0x5a')]==0x1){_0x3c868f[_0x6dd3('0x5b')]('`'+_0x4c9fb7[_0x6dd3('0x45')]+_0x6dd3('0x5c'));}else{_0x3c868f['having']('`'+_0x4c9fb7[_0x6dd3('0x45')]+_0x6dd3('0x5d'));}break;case _0x6dd3('0x5e'):if(_0x4c9fb7['operator']==='$substring'){if(_0x4c9fb7[_0x6dd3('0x5a')]['split']('\x20')['length']>0x1){_0x282383[_0x1e69e7](_0x6dd3('0x5f'),qs[_0x6dd3('0x60')](_0x4c9fb7['value']),null);}else{var _0xf392c1='%'+_0x4c9fb7['value']+'%';_0x282383[_0x1e69e7](_0x6dd3('0x61'),_0xf392c1,_0xf392c1,_0xf392c1);}}else{_0xcde468=_['find'](_0xb73dfa,[_0x6dd3('0x2e'),_0x6dd3('0x62')]);_0x4c9fb7[_0x6dd3('0x45')]='ContactId';_0x423dd2=as['buildExpression'](_0x11211b,_0xcde468[_0x6dd3('0x38')],_0x4c9fb7);_0x282383[_0x1e69e7](_0x423dd2[_0x6dd3('0x63')],_0x423dd2[_0x6dd3('0x5a')][_0x6dd3('0x64')],_0x423dd2['value'][_0x6dd3('0x65')]);}break;case _0x6dd3('0x66'):var _0x4430fb=_0x4c9fb7[_0x6dd3('0x5a')][_0x6dd3('0x67')](',')[_0x6dd3('0x30')](function(_0x15c6a2){return Number(_0x15c6a2);});_0x4430fb[_0x6dd3('0x68')](function(_0x575dc8){_0x5ed89e['or'](_0x6dd3('0x69'),'%,'+_0x575dc8+',%');});_0xa35f5a=_[_0x6dd3('0x6a')](_0xa35f5a,_0x4430fb);break;case _0x6dd3('0x6b'):if(_0x4c9fb7[_0x6dd3('0x6c')]===_0x6dd3('0x6d')){_0x282383[_0x1e69e7](_0x6dd3('0x6e'),'%'+_0x4c9fb7[_0x6dd3('0x5a')]+'%',null);}else{_0xcde468=_[_0x6dd3('0x6f')](_0xb73dfa,[_0x6dd3('0x2e'),_0x6dd3('0x70')]);_0x4c9fb7['field']='UserId';_0x423dd2=as['buildExpression'](_0x11211b,_0xcde468['type'],_0x4c9fb7);_0x282383[_0x1e69e7](_0x423dd2['text'],_0x423dd2[_0x6dd3('0x5a')][_0x6dd3('0x64')],_0x423dd2['value'][_0x6dd3('0x65')]);}break;case'body':_0x423dd2=as['buildExpression']('me',null,_0x4c9fb7);_0x282383[_0x1e69e7](_0x423dd2[_0x6dd3('0x63')],_0x423dd2[_0x6dd3('0x5a')]['start'],_0x423dd2[_0x6dd3('0x5a')]['end']);break;}}else{var _0x423dd2=as[_0x6dd3('0x71')](_0x11211b,_0xcde468[_0x6dd3('0x38')],_0x4c9fb7);_0x282383[_0x1e69e7](_0x423dd2[_0x6dd3('0x63')],_0x423dd2[_0x6dd3('0x5a')][_0x6dd3('0x64')],_0x423dd2[_0x6dd3('0x5a')][_0x6dd3('0x65')]);}}}else{var _0x57b7b8=_(_0x41359f[_0x6dd3('0x3a')])['keys']()['map'](function(_0x103cef){return _['some'](_0xb73dfa,[_0x6dd3('0x2e'),_0x103cef])?_0x103cef:undefined;})[_0x6dd3('0x72')]()[_0x6dd3('0x5a')]();if(!_[_0x6dd3('0x73')](_0x57b7b8)){_0x57b7b8[_0x6dd3('0x68')](function(_0x32a361){if(_0x32a361===_0x6dd3('0x74')){_0x3c868f['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x6dd3('0x75')](_0x41359f['query'][_0x32a361]));}else if(_0x32a361===_0x6dd3('0x76')){var _0x591e6e=JSON[_0x6dd3('0x77')](_0x41359f[_0x6dd3('0x3a')][_0x32a361])[_0x6dd3('0x78')];var _0x5b93f8=JSON['parse'](_0x41359f[_0x6dd3('0x3a')][_0x32a361])[_0x6dd3('0x79')];_0x3c868f[_0x6dd3('0x43')](_0x6dd3('0x7a'),_0x591e6e,_0x5b93f8);}else{if(_0x41359f[_0x6dd3('0x3a')][_0x32a361]===_0x6dd3('0x7b')){_0x3c868f['where']('i.'+_0x32a361+'\x20IS\x20NULL');}else{_0x3c868f[_0x6dd3('0x43')]('i.'+_0x32a361+'\x20=\x20?',_0x41359f['query'][_0x32a361]);}}});}if(_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x7c')]){if(_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x7c')]==0x1){_0x3c868f['having'](_0x6dd3('0x7d'));}else{_0x3c868f[_0x6dd3('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0x41359f[_0x6dd3('0x3a')]['tag']){_0xa35f5a=_['isArray'](_0x41359f['query'][_0x6dd3('0x7e')])?_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x7e')]:new Array(_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x7e')]);_0xa35f5a[_0x6dd3('0x68')](function(_0x302a90){_0x5ed89e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x302a90+',%');});}if(_0x41359f['query'][_0x6dd3('0x7f')]){var _0x597dbf=_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x6dd3('0x80')](/'/g,'\x27\x27');if(qs[_0x6dd3('0x81')](_0x597dbf)){_0x282383['or'](_0x6dd3('0x82'),_0x597dbf+'%');}else{_0x282383['or'](_0x6dd3('0x83'),qs['getFullTextValue'](_0x597dbf))['or']('i.from\x20LIKE\x20?',_0x597dbf+'%')['or'](_0x6dd3('0x84'),_0x597dbf+'%');}}}_0x3c868f['where'](_0x282383);_0x3c868f[_0x6dd3('0x85')](_0x6dd3('0x86'));var _0x3cc4be={'type':db['Sequelize'][_0x6dd3('0x87')][_0x6dd3('0x88')],'raw':!![]};var _0x4faa39=_0x3c868f[_0x6dd3('0x89')]();_0x4faa39[_0x6dd3('0x45')](_0x6dd3('0x86'));_0x4faa39['field'](_0x6dd3('0x8a'),'unreadMessages');if(_0x30e4c3['order']){_0x30e4c3[_0x6dd3('0x8b')][_0x6dd3('0x68')](function(_0x3d53da){var _0x38d26d=_0x3d53da[0x0]==='contactName'?_0x3d53da[0x0]:'i.'+_0x3d53da[0x0];_0x3c868f['order'](_0x38d26d,_0x3d53da[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6dd3('0x73')](_0xa35f5a)){_0x3c868f['having'](_0x5ed89e);_0x4faa39[_0x6dd3('0x43')](_0x6dd3('0x8c'),_0xa35f5a);}BPromise[_0x6dd3('0x8d')]()[_0x6dd3('0x2b')](function(){if(!_0x4f2af5){if(_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x74')])return;_0x4faa39[_0x6dd3('0x43')](_0x6dd3('0x8e'));_0x3c868f['where'](_0x6dd3('0x8e'));return;}if(_0x41359f[_0x6dd3('0x8f')][_0x6dd3('0x90')]!==_0x6dd3('0x91'))return;return _0x41359f[_0x6dd3('0x8f')][_0x6dd3('0x92')]({'attributes':['id'],'raw':!![]})[_0x6dd3('0x2b')](function(_0x7beeff){if(_['isEmpty'](_0x7beeff)){_0x4faa39['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x3c868f[_0x6dd3('0x43')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x4faa39[_0x6dd3('0x43')](_0x6dd3('0x93'),_[_0x6dd3('0x30')](_0x7beeff,'id'));_0x3c868f[_0x6dd3('0x43')](_0x6dd3('0x93'),_[_0x6dd3('0x30')](_0x7beeff,'id'));}});})[_0x6dd3('0x2b')](function(){if(_0x41359f[_0x6dd3('0x8f')][_0x6dd3('0x90')]===_0x6dd3('0x91')&&!_0x4f2af5&&!_0x41359f[_0x6dd3('0x3a')][_0x6dd3('0x74')])return[];return db[_0x6dd3('0x94')][_0x6dd3('0x3a')](_0x4faa39['toString'](),_0x3cc4be);})[_0x6dd3('0x2b')](function(_0x223aed){_0x27850a[_0x6dd3('0x22')]=_0x223aed['length'];if(_0x27850a[_0x6dd3('0x22')]===0x0)return[];return db[_0x6dd3('0x94')][_0x6dd3('0x3a')](_0x45f5fd['toString'](),_0x3cc4be)[_0x6dd3('0x2b')](function(_0x2c00a0){_0x5eb4af=_['keyBy'](_0x2c00a0,'id');_0x3cc4be=_[_0x6dd3('0x95')](_0x3cc4be,{'model':db[_0x6dd3('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41359f[_0x6dd3('0x3a')]['fields']){_0x30e4c3[_0x6dd3('0x3f')][_0x6dd3('0x68')](function(_0x26650d){_0x3c868f[_0x6dd3('0x45')]('i.'+_0x26650d);});}else{_0x3c868f[_0x6dd3('0x45')](_0x6dd3('0x8a'),_0x6dd3('0x96'));_0x3c868f[_0x6dd3('0x45')](_0x6dd3('0x97'),_0x6dd3('0x98'));_0x3c868f[_0x6dd3('0x45')](_0x6dd3('0x99'),_0x6dd3('0x9a'));_0x3c868f[_0x6dd3('0x45')](_0x6dd3('0x9b'),_0x6dd3('0x9c'));_0x3c868f[_0x6dd3('0x45')]('i.*');_0x3c868f[_0x6dd3('0x45')]('c.firstName',_0x6dd3('0x9d'));_0x3c868f[_0x6dd3('0x45')]('c.lastName',_0x6dd3('0x9e'));_0x3c868f[_0x6dd3('0x45')]('c.email',_0x6dd3('0x9f'));_0x3c868f['field'](_0x6dd3('0xa0'),'Contact.phone');_0x3c868f[_0x6dd3('0x45')]('c.mobile',_0x6dd3('0xa1'));_0x3c868f[_0x6dd3('0x45')]('c.fax',_0x6dd3('0xa2'));_0x3c868f[_0x6dd3('0x45')](_0x6dd3('0xa3'),_0x6dd3('0xa4'));_0x3c868f['field'](_0x6dd3('0xa5'),_0x6dd3('0xa6'));_0x3c868f['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6dd3('0x32'));}if(_0x30e4c3[_0x6dd3('0x23')])_0x3c868f['limit'](_0x30e4c3['limit']);if(_0x30e4c3[_0x6dd3('0x20')])_0x3c868f[_0x6dd3('0x20')](_0x30e4c3['offset']);return db[_0x6dd3('0x94')][_0x6dd3('0x3a')](_0x3c868f['toString'](),_0x3cc4be);})[_0x6dd3('0x2b')](function(_0x939029){if(_0x939029[_0x6dd3('0x58')]>0x0)_0x2315ac['where'](_0x6dd3('0xa7'),_[_0x6dd3('0x30')](_0x939029,'id'));return db[_0x6dd3('0x94')][_0x6dd3('0x3a')](_0x2315ac[_0x6dd3('0xa8')](),_0x3cc4be)[_0x6dd3('0x2b')](function(_0x4b9c2b){var _0x1563e2=_[_0x6dd3('0xa9')](_0x4b9c2b,_0x6dd3('0xaa'));var _0x52dd8d=[];_0x939029['forEach'](function(_0x22be7e){_0x52dd8d[_0x6dd3('0xab')](updateOpenchannelInteraction(_0x22be7e,_0x5eb4af,_0x1563e2));});return BPromise[_0x6dd3('0xac')](_0x52dd8d);});});})[_0x6dd3('0x2b')](function(_0x103824){_0x27850a[_0x6dd3('0xad')]=_0x103824;return _0x27850a;})[_0x6dd3('0x2b')](respondWithFilteredResult(_0x973ea9,_0x30e4c3))[_0x6dd3('0xae')](handleError(_0x973ea9,null));};exports['show']=function(_0x1cf451,_0x4b48d0){var _0x104c4d={};if(_0x1cf451['query'][_0x6dd3('0x38')]&&_0x1cf451[_0x6dd3('0x3a')]['type']===_0x6dd3('0x46')){_0x104c4d[_0x6dd3('0x46')]=_0x1cf451[_0x6dd3('0xaf')]['id'];}else{_0x104c4d['id']=_0x1cf451['params']['id'];}var _0x33fb20={'raw':![],'where':_0x104c4d},_0x5958e9={};_0x5958e9[_0x6dd3('0x3e')]=_['keys'](db[_0x6dd3('0x35')][_0x6dd3('0x36')]);_0x5958e9[_0x6dd3('0x3a')]=_['keys'](_0x1cf451[_0x6dd3('0x3a')]);_0x5958e9['filters']=_[_0x6dd3('0x3d')](_0x5958e9[_0x6dd3('0x3e')],_0x5958e9[_0x6dd3('0x3a')]);_0x33fb20['attributes']=_[_0x6dd3('0x3d')](_0x5958e9[_0x6dd3('0x3e')],qs[_0x6dd3('0x40')](_0x1cf451[_0x6dd3('0x3a')][_0x6dd3('0x40')]));_0x33fb20[_0x6dd3('0x3f')]=_0x33fb20[_0x6dd3('0x3f')][_0x6dd3('0x58')]?_0x33fb20[_0x6dd3('0x3f')]:_0x5958e9['model'];if(_0x1cf451['query'][_0x6dd3('0xb0')]){_0x33fb20['include']=[{'all':!![]}];}_0x33fb20=_[_0x6dd3('0x95')]({},_0x33fb20,_0x1cf451[_0x6dd3('0xb1')]);return db['OpenchannelInteraction']['find'](_0x33fb20)[_0x6dd3('0x2b')](handleEntityNotFound(_0x4b48d0,null))['then'](respondWithResult(_0x4b48d0,null))[_0x6dd3('0xae')](handleError(_0x4b48d0,null));};exports['create']=function(_0x5543ed,_0x426a9a){return db[_0x6dd3('0x35')]['create'](_0x5543ed[_0x6dd3('0xb2')],{})[_0x6dd3('0x2b')](respondWithResult(_0x426a9a,0xc9))[_0x6dd3('0xae')](handleError(_0x426a9a,null));};exports[_0x6dd3('0x29')]=function(_0x49257d,_0x10b1da){if(_0x49257d['body']['id']){delete _0x49257d['body']['id'];}return db[_0x6dd3('0x35')][_0x6dd3('0x6f')]({'where':{'id':_0x49257d[_0x6dd3('0xaf')]['id']}})['then'](handleEntityNotFound(_0x10b1da,null))[_0x6dd3('0x2b')](saveUpdates(_0x49257d[_0x6dd3('0xb2')],null))[_0x6dd3('0x2b')](respondWithResult(_0x10b1da,null))['catch'](handleError(_0x10b1da,null));};exports[_0x6dd3('0x2a')]=function(_0x2dc117,_0x56e98a){return db[_0x6dd3('0x35')][_0x6dd3('0x6f')]({'where':{'id':_0x2dc117['params']['id']}})[_0x6dd3('0x2b')](handleEntityNotFound(_0x56e98a,null))[_0x6dd3('0x2b')](removeEntity(_0x56e98a,null))[_0x6dd3('0xae')](handleError(_0x56e98a,null));};exports[_0x6dd3('0xb3')]=function(_0x3bcd63,_0x38fdbf){return db[_0x6dd3('0x35')][_0x6dd3('0xb3')]()['then'](respondWithResult(_0x38fdbf,null))[_0x6dd3('0xae')](handleError(_0x38fdbf,null));};exports[_0x6dd3('0xb4')]=function(_0x4fa0d0,_0x3f7734,_0x8e3971){return db[_0x6dd3('0xb5')][_0x6dd3('0x6f')]({'where':{'id':_0x4fa0d0[_0x6dd3('0xaf')]['id']}})[_0x6dd3('0x2b')](handleEntityNotFound(_0x3f7734,null))[_0x6dd3('0x2b')](function(_0x137445){if(_0x137445){return _0x137445[_0x6dd3('0xb4')](_0x4fa0d0['body'][_0x6dd3('0xb6')],_[_0x6dd3('0xb7')](_0x4fa0d0[_0x6dd3('0xb2')],[_0x6dd3('0xb6'),'id'])||{});}})[_0x6dd3('0x2b')](respondWithResult(_0x3f7734,null))[_0x6dd3('0xae')](handleError(_0x3f7734,null));};exports[_0x6dd3('0xb8')]=function(_0xed89b6,_0x4b67da,_0x225e7e){var _0xbb5694={'raw':![],'where':{}};var _0x9c99d={};var _0x369d3e={'count':0x0,'rows':[]};return db[_0x6dd3('0x35')][_0x6dd3('0xb9')]({'where':{'id':_0xed89b6['params']['id']}})[_0x6dd3('0x2b')](handleEntityNotFound(_0x4b67da,null))[_0x6dd3('0x2b')](function(_0x543856){if(_0x543856){_0x9c99d['model']=_[_0x6dd3('0x3b')](db[_0x6dd3('0xb5')][_0x6dd3('0x36')]);_0x9c99d[_0x6dd3('0x3a')]=_[_0x6dd3('0x3b')](_0xed89b6[_0x6dd3('0x3a')]);_0x9c99d[_0x6dd3('0x3c')]=_[_0x6dd3('0x3d')](_0x9c99d[_0x6dd3('0x3e')],_0x9c99d['query']);_0xbb5694['attributes']=_[_0x6dd3('0x3d')](_0x9c99d[_0x6dd3('0x3e')],qs['fields'](_0xed89b6[_0x6dd3('0x3a')]['fields']));_0xbb5694['attributes']=_0xbb5694['attributes'][_0x6dd3('0x58')]?_0xbb5694[_0x6dd3('0x3f')]:_0x9c99d[_0x6dd3('0x3e')];if(!_0xed89b6[_0x6dd3('0x3a')][_0x6dd3('0xba')](_0x6dd3('0x41'))){_0xbb5694[_0x6dd3('0x23')]=qs['limit'](_0xed89b6[_0x6dd3('0x3a')][_0x6dd3('0x23')]);_0xbb5694[_0x6dd3('0x20')]=qs[_0x6dd3('0x20')](_0xed89b6[_0x6dd3('0x3a')]['offset']);}_0xbb5694[_0x6dd3('0x8b')]=qs[_0x6dd3('0x42')](_0xed89b6['query'][_0x6dd3('0x42')]);_0xbb5694[_0x6dd3('0x43')]=qs[_0x6dd3('0x3c')](_[_0x6dd3('0xbb')](_0xed89b6[_0x6dd3('0x3a')],_0x9c99d[_0x6dd3('0x3c')]));_0xbb5694[_0x6dd3('0x43')][_0x6dd3('0xaa')]=_0x543856['id'];if(_0xed89b6[_0x6dd3('0x3a')][_0x6dd3('0x7f')]){_0xbb5694['where']=_[_0x6dd3('0x95')](_0xbb5694['where'],{'$or':_['map'](_0xbb5694['attributes'],function(_0x3cfa3e){var _0x4a68f5={};_0x4a68f5[_0x3cfa3e]={'$like':'%'+_0xed89b6['query'][_0x6dd3('0x7f')]+'%'};return _0x4a68f5;})});}if(_0xed89b6['query'][_0x6dd3('0x78')]){var _0x7c4c27=_0xed89b6[_0x6dd3('0x3a')][_0x6dd3('0x78')][_0x6dd3('0x67')](',');var _0x91760c={};_0x91760c[_0x7c4c27[0x0]]={'$gte':moment(_0x7c4c27[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xbb5694[_0x6dd3('0x43')]=_[_0x6dd3('0x95')](_0xbb5694[_0x6dd3('0x43')],_0x91760c);}_0xbb5694=_[_0x6dd3('0x95')]({},_0xbb5694,_0xed89b6[_0x6dd3('0xb1')]);return db[_0x6dd3('0xb5')][_0x6dd3('0x22')]({'where':_0xbb5694[_0x6dd3('0x43')]})[_0x6dd3('0x2b')](function(_0x9bae58){_0x369d3e[_0x6dd3('0x22')]=_0x9bae58;if(_0xed89b6[_0x6dd3('0x3a')][_0x6dd3('0xb0')]){_0xbb5694[_0x6dd3('0xbc')]=[{'all':!![]}];}return db[_0x6dd3('0xb5')]['findAll'](_0xbb5694);})[_0x6dd3('0x2b')](function(_0x488755){_0x369d3e[_0x6dd3('0xad')]=_0x488755;return _0x369d3e;});}})[_0x6dd3('0x2b')](respondWithFilteredResult(_0x4b67da,_0xbb5694))[_0x6dd3('0xae')](handleError(_0x4b67da,null));};exports['addTags']=function(_0x2c8de6,_0x9efe9c,_0x42447e){return db[_0x6dd3('0x35')][_0x6dd3('0x6f')]({'where':{'id':_0x2c8de6['params']['id']}})[_0x6dd3('0x2b')](handleEntityNotFound(_0x9efe9c,null))[_0x6dd3('0x2b')](function(_0x2b4b82){if(_0x2b4b82){return _0x2b4b82[_0x6dd3('0xbd')](_0x2c8de6[_0x6dd3('0xb2')]['ids'],_[_0x6dd3('0xb7')](_0x2c8de6['body'],[_0x6dd3('0xb6'),'id'])||{})[_0x6dd3('0xbe')](function(){return db[_0x6dd3('0x66')][_0x6dd3('0xbf')]({'attributes':['id','name',_0x6dd3('0xc0')],'where':{'id':_0x2c8de6[_0x6dd3('0xb2')][_0x6dd3('0xb6')]}});})['then'](function(_0x4cc568){socket['emit'](_0x6dd3('0xc1'),{'id':Number(_0x2c8de6[_0x6dd3('0xaf')]['id']),'tags':_0x4cc568||[]});return{'id':Number(_0x2c8de6[_0x6dd3('0xaf')]['id']),'tags':_0x4cc568||[]};});}})[_0x6dd3('0x2b')](respondWithResult(_0x9efe9c,null))['catch'](handleError(_0x9efe9c,null));};exports[_0x6dd3('0xc2')]=function(_0x4f3690,_0x45be32,_0x97bdbf){return db[_0x6dd3('0x35')][_0x6dd3('0x6f')]({'where':{'id':_0x4f3690[_0x6dd3('0xaf')]['id']}})[_0x6dd3('0x2b')](handleEntityNotFound(_0x45be32,null))[_0x6dd3('0x2b')](function(_0x48700a){if(_0x48700a){return _0x48700a['removeTags'](_0x4f3690[_0x6dd3('0x3a')]['ids']);}})[_0x6dd3('0x2b')](respondWithStatusCode(_0x45be32,null))[_0x6dd3('0xae')](handleError(_0x45be32,null));};exports['download']=function(_0x8bf979,_0x4423ca){var _0x3762d9=moment()[_0x6dd3('0xc3')]()['toString']();var _0x1edc69=path[_0x6dd3('0xc4')](config[_0x6dd3('0xc5')],_0x6dd3('0xc6'),_0x6dd3('0xc7'),_0x6dd3('0xc8'));var _0x5f54b1=path[_0x6dd3('0xc4')](config[_0x6dd3('0xc5')],_0x6dd3('0xc6'),_0x6dd3('0xc7'),_0x6dd3('0xc9'));var _0x8f0ea4=path[_0x6dd3('0xc4')](_0x1edc69,_0x3762d9);var _0x166062=util[_0x6dd3('0xca')](_0x6dd3('0xcb'),_0x8bf979['params']['id'],_0x3762d9);var _0x26ce3c=path[_0x6dd3('0xc4')](_0x1edc69,_0x166062);var _0x277fe5=[];_0x277fe5[_0x6dd3('0xab')]({'model':db['User'],'as':_0x6dd3('0x6b'),'attributes':['id',_0x6dd3('0x31')],'raw':!![]});_0x277fe5[_0x6dd3('0xab')]({'model':db[_0x6dd3('0xcc')],'as':_0x6dd3('0x5e'),'attributes':['id',_0x6dd3('0xcd'),'lastName'],'raw':!![]});if(_0x8bf979['query'][_0x6dd3('0xc9')]){_0x277fe5[_0x6dd3('0xab')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x3ca423=[{'model':db[_0x6dd3('0xb5')],'as':'Messages','attributes':['id',_0x6dd3('0xb2'),'createdAt','direction',_0x6dd3('0xce'),_0x6dd3('0x7c')],'include':_0x277fe5}];_0x3ca423[_0x6dd3('0xab')]({'model':db[_0x6dd3('0xcf')],'as':_0x6dd3('0xd0'),'attributes':['id','name']});_0x3ca423[_0x6dd3('0xab')]({'model':db[_0x6dd3('0x6b')],'as':'Owner','attributes':['id','fullname']});return db[_0x6dd3('0x35')][_0x6dd3('0x6f')]({'where':{'id':_0x8bf979['params']['id']},'include':_0x3ca423})[_0x6dd3('0x2b')](handleEntityNotFound(_0x4423ca,null))[_0x6dd3('0x2b')](function(_0x56fb23){if(_0x56fb23){var _0x2fa1bd=_0x56fb23[_0x6dd3('0xd1')]({'plain':!![]});fs[_0x6dd3('0xd2')](_0x8f0ea4);var _0x1f5a9d={'channel':_0x6dd3('0xd3'),'account':_0x2fa1bd[_0x6dd3('0xd0')][_0x6dd3('0x2e')],'agent':_0x2fa1bd[_0x6dd3('0xd4')]?_0x2fa1bd[_0x6dd3('0xd4')][_0x6dd3('0x31')]:_0x6dd3('0xd5'),'createdAt':moment(_0x2fa1bd['createdAt'])[_0x6dd3('0xca')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2fa1bd[_0x6dd3('0xd6')]?moment(_0x2fa1bd[_0x6dd3('0xd7')])[_0x6dd3('0xca')](_0x6dd3('0xd8'))[_0x6dd3('0xa8')]():'','disposition':_0x2fa1bd[_0x6dd3('0xd9')],'visibility':_0x2fa1bd[_0x6dd3('0xda')]?_0x6dd3('0xdb'):_0x6dd3('0xdc'),'messages':_(_0x2fa1bd[_0x6dd3('0xdd')])[_0x6dd3('0x7f')]({'secret':![]})[_0x6dd3('0x30')](function(_0x23063d){if(_0x23063d[_0x6dd3('0xde')]){var _0x3e78ed=path[_0x6dd3('0xc4')](_0x5f54b1,_0x23063d['Attachment'][_0x6dd3('0xdf')]);if(fs[_0x6dd3('0xe0')](_0x3e78ed)){fs['createReadStream'](_0x3e78ed)[_0x6dd3('0xe1')](fs['createWriteStream'](path[_0x6dd3('0xc4')](_0x8f0ea4,_0x23063d[_0x6dd3('0xde')][_0x6dd3('0xdf')])));}}return{'date':moment(_0x23063d[_0x6dd3('0x76')])[_0x6dd3('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6dd3('0xa8')](),'sender':_0x23063d[_0x6dd3('0xe2')]===_0x6dd3('0xe3')?_0x23063d['User']?_0x23063d['User'][_0x6dd3('0x31')]:'System':_0x23063d[_0x6dd3('0x5e')][_0x6dd3('0xcd')]+(_0x23063d[_0x6dd3('0x5e')][_0x6dd3('0xe4')]?'\x20'+_0x23063d['Contact']['lastName']:''),'body':_0x23063d[_0x6dd3('0xde')]?_0x23063d['Attachment'][_0x6dd3('0xdf')]:_0x23063d[_0x6dd3('0xb2')],'direction':_0x23063d[_0x6dd3('0xe2')]==='out'?'A':'C','secret':_0x23063d['secret'],'read':_0x23063d[_0x6dd3('0x7c')],'attachment':_0x23063d[_0x6dd3('0xde')]};})[_0x6dd3('0x5a')]()};return ejs[_0x6dd3('0xe5')](path[_0x6dd3('0xc4')](config['root'],'server',_0x6dd3('0xe6'),_0x6dd3('0xe7')),{'interaction':_0x1f5a9d})['then'](function(_0x5b5d63){var _0x27c74a=path['join'](_0x8f0ea4,'transcript-'+_0x2fa1bd['id']+'-'+_0x3762d9+_0x6dd3('0xe8'));var _0xf4342a={'path':_0x27c74a,'channel':'Openchannel','interactionId':_0x2fa1bd['id']};return pdf[_0x6dd3('0xe9')](_0x5b5d63,_0xf4342a);})[_0x6dd3('0x2b')](function(){return new BPromise(function(_0xec98c1,_0x61b51b){zipdir(_0x8f0ea4,{'saveTo':_0x26ce3c},function(_0x2caf26,_0x5958f5){if(_0x2caf26)return _0x61b51b(_0x2caf26);return _0xec98c1(_0x5958f5);});})[_0x6dd3('0x2b')](function(){return new BPromise(function(_0x5eadf2,_0x2c7502){rimraf(_0x8f0ea4,function(_0x457042){if(_0x457042)_0x2c7502(_0x457042);return _0x5eadf2();});});})[_0x6dd3('0x2b')](function(){return _0x4423ca[_0x6dd3('0xea')](_0x26ce3c,_0x166062,function(_0x42389f){if(_0x42389f){console['log'](_0x6dd3('0xeb'),_0x42389f);}else{fs[_0x6dd3('0xec')](_0x26ce3c);}});});});}else{return _0x4423ca[_0x6dd3('0x1d')](0xc8);}})['catch'](handleError(_0x4423ca,null));}; \ No newline at end of file +var _0xb3cf=['jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','end','name','send','Users','map','fullname','Tags','TagIds','split','forEach','catch','index','OpenchannelInteraction','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','isEmpty','OpenchannelAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','push','all','rows','show','params','rawAttributes','includeAll','include','options','create','describe','OpenchannelMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','get','N.A.','createdAt','closed','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','root','downloadInteraction.ejs','transcript-','.pdf','Openchannel','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x5b9ad6,_0x1bb22e){var _0xf726be=function(_0x2acf8a){while(--_0x2acf8a){_0x5b9ad6['push'](_0x5b9ad6['shift']());}};_0xf726be(++_0x1bb22e);}(_0xb3cf,0x1d1));var _0xfb3c=function(_0x375b7d,_0x243a50){_0x375b7d=_0x375b7d-0x0;var _0x4b4cfb=_0xb3cf[_0x375b7d];return _0x4b4cfb;};'use strict';var emlformat=require(_0xfb3c('0x0'));var rimraf=require(_0xfb3c('0x1'));var zipdir=require(_0xfb3c('0x2'));var jsonpatch=require(_0xfb3c('0x3'));var rp=require(_0xfb3c('0x4'));var moment=require(_0xfb3c('0x5'));var BPromise=require(_0xfb3c('0x6'));var Mustache=require(_0xfb3c('0x7'));var util=require(_0xfb3c('0x8'));var path=require(_0xfb3c('0x9'));var sox=require(_0xfb3c('0xa'));var csv=require('to-csv');var ejs=require(_0xfb3c('0xb'));var fs=require('fs');var fs_extra=require(_0xfb3c('0xc'));var _=require(_0xfb3c('0xd'));var squel=require(_0xfb3c('0xe'));var crypto=require('crypto');var jsforce=require(_0xfb3c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfb3c('0x10'));var querystring=require(_0xfb3c('0x11'));var Papa=require(_0xfb3c('0x12'));var Redis=require('ioredis');var authService=require(_0xfb3c('0x13'));var qs=require(_0xfb3c('0x14'));var as=require(_0xfb3c('0x15'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xfb3c('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xfb3c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfb3c('0x18'));var db=require('../../mysqldb')['db'];config[_0xfb3c('0x19')]=_[_0xfb3c('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfb3c('0x1b'))(new Redis(config[_0xfb3c('0x19')]));require(_0xfb3c('0x1c'))[_0xfb3c('0x1d')](socket);function respondWithStatusCode(_0x3ce884,_0x15ea77){_0x15ea77=_0x15ea77||0xcc;return function(_0x40f3ca){if(_0x40f3ca){return _0x3ce884[_0xfb3c('0x1e')](_0x15ea77);}return _0x3ce884['status'](_0x15ea77)['end']();};}function respondWithResult(_0x57ae45,_0x3a6ccc){_0x3a6ccc=_0x3a6ccc||0xc8;return function(_0x16ceb4){if(_0x16ceb4){return _0x57ae45[_0xfb3c('0x1f')](_0x3a6ccc)[_0xfb3c('0x20')](_0x16ceb4);}};}function respondWithFilteredResult(_0xac43bf,_0x2e846c){return function(_0x3cb1db){if(_0x3cb1db){var _0x33f9c9=typeof _0x2e846c['offset']==='undefined'&&typeof _0x2e846c[_0xfb3c('0x21')]===_0xfb3c('0x22');var _0x2f16e1=_0x3cb1db[_0xfb3c('0x23')];var _0x282014=_0x33f9c9?0x0:_0x2e846c[_0xfb3c('0x24')];var _0x271056=_0x33f9c9?_0x3cb1db[_0xfb3c('0x23')]:_0x2e846c['offset']+_0x2e846c[_0xfb3c('0x21')];var _0x4c3859;if(_0x271056>=_0x2f16e1){_0x271056=_0x2f16e1;_0x4c3859=0xc8;}else{_0x4c3859=0xce;}_0xac43bf[_0xfb3c('0x1f')](_0x4c3859);return _0xac43bf[_0xfb3c('0x25')](_0xfb3c('0x26'),_0x282014+'-'+_0x271056+'/'+_0x2f16e1)[_0xfb3c('0x20')](_0x3cb1db);}return null;};}function patchUpdates(_0x155994){return function(_0x57bd93){try{jsonpatch['apply'](_0x57bd93,_0x155994,!![]);}catch(_0x2e1ef7){return BPromise[_0xfb3c('0x27')](_0x2e1ef7);}return _0x57bd93[_0xfb3c('0x28')]();};}function saveUpdates(_0x48061e,_0x5cb4ea){return function(_0x2a84fd){if(_0x2a84fd){return _0x2a84fd['update'](_0x48061e)[_0xfb3c('0x29')](function(_0x47b38b){return _0x47b38b;});}return null;};}function removeEntity(_0x273ff3,_0x1c0bcd){return function(_0x3340c9){if(_0x3340c9){return _0x3340c9[_0xfb3c('0x2a')]()[_0xfb3c('0x29')](function(){_0x273ff3['status'](0xcc)[_0xfb3c('0x2b')]();});}};}function handleEntityNotFound(_0x17ace2,_0x304ea5){return function(_0x4d1092){if(!_0x4d1092){_0x17ace2[_0xfb3c('0x1e')](0x194);}return _0x4d1092;};}function handleError(_0x39dcd2,_0x576fc4){_0x576fc4=_0x576fc4||0x1f4;return function(_0x5a978c){logger['error'](_0x5a978c['stack']);if(_0x5a978c[_0xfb3c('0x2c')]){delete _0x5a978c[_0xfb3c('0x2c')];}_0x39dcd2[_0xfb3c('0x1f')](_0x576fc4)[_0xfb3c('0x2d')](_0x5a978c);};}function getInteractionUsers(_0x3f2cfa,_0x3050f6){return new BPromise(function(_0x2bfd64,_0x4f48d2){try{if(_0x3050f6[_0x3f2cfa['id']]){_0x3f2cfa[_0xfb3c('0x2e')]=_[_0xfb3c('0x2f')](_0x3050f6[_0x3f2cfa['id']],function(_0x33d4f6){return{'id':_0x33d4f6['id'],'fullname':_0x33d4f6[_0xfb3c('0x30')]};});}}catch(_0x30bb7a){_0x4f48d2(_0x30bb7a);}_0x2bfd64(_0x3f2cfa);});}function getInteractionTags(_0x32c7e7,_0x33cd29){return new BPromise(function(_0xc31c9,_0x4ca239){try{if(_0x32c7e7['TagIds']){_0x32c7e7[_0xfb3c('0x31')]=[];_0x32c7e7[_0xfb3c('0x32')][_0xfb3c('0x33')](',')[_0xfb3c('0x34')](function(_0x4a6924){_0x32c7e7[_0xfb3c('0x31')]['push'](_0x33cd29[_0x4a6924]);});}delete _0x32c7e7[_0xfb3c('0x32')];}catch(_0x136854){_0x4ca239(_0x136854);}_0xc31c9(_0x32c7e7);});}function updateOpenchannelInteraction(_0x58fbaa,_0x298a58,_0x4ee356){return new BPromise(function(_0x4e1b73,_0x2d1825){return getInteractionUsers(_0x58fbaa,_0x4ee356)[_0xfb3c('0x29')](function(_0x1c3afb){return getInteractionTags(_0x1c3afb,_0x298a58);})[_0xfb3c('0x29')](function(_0x44e6dc){_0x4e1b73(_0x44e6dc);})[_0xfb3c('0x35')](function(_0x232aa8){_0x2d1825(_0x232aa8);});});}exports[_0xfb3c('0x36')]=function(_0x31ce97,_0x4334c2){var _0x4c7fe2={},_0x42fab1={},_0x46f9db={'count':0x0,'rows':[]};var _0xbff696=_[_0xfb3c('0x2f')](db[_0xfb3c('0x37')]['rawAttributes'],function(_0x32e49d){return{'name':_0x32e49d[_0xfb3c('0x38')],'type':_0x32e49d[_0xfb3c('0x39')][_0xfb3c('0x3a')]};});_0x42fab1[_0xfb3c('0x3b')]=_[_0xfb3c('0x2f')](_0xbff696,_0xfb3c('0x2c'));_0x42fab1[_0xfb3c('0x3c')]=_['keys'](_0x31ce97[_0xfb3c('0x3c')]);_0x42fab1[_0xfb3c('0x3d')]=_[_0xfb3c('0x3e')](_0x42fab1[_0xfb3c('0x3b')],_0x42fab1[_0xfb3c('0x3c')]);_0x4c7fe2[_0xfb3c('0x3f')]=_[_0xfb3c('0x3e')](_0x42fab1[_0xfb3c('0x3b')],qs[_0xfb3c('0x40')](_0x31ce97['query']['fields']));_0x4c7fe2['attributes']=_0x4c7fe2[_0xfb3c('0x3f')][_0xfb3c('0x41')]?_0x4c7fe2[_0xfb3c('0x3f')]:_0x42fab1[_0xfb3c('0x3b')];if(!_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x42')](_0xfb3c('0x43'))){_0x4c7fe2[_0xfb3c('0x21')]=qs['limit'](_0x31ce97['query']['limit']);_0x4c7fe2[_0xfb3c('0x24')]=qs[_0xfb3c('0x24')](_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x24')]);}_0x4c7fe2['order']=qs['sort'](_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x44')]);_0x4c7fe2[_0xfb3c('0x45')]=qs[_0xfb3c('0x3d')](_[_0xfb3c('0x46')](_0x31ce97['query'],_0x42fab1[_0xfb3c('0x3d')]),_0xbff696);var _0x52e3bd=[];var _0x6f68ce=squel['select']()[_0xfb3c('0x47')]('id')[_0xfb3c('0x47')]('name')[_0xfb3c('0x47')](_0xfb3c('0x48'))[_0xfb3c('0x49')](_0xfb3c('0x4a'));var _0x12d363=squel[_0xfb3c('0x4b')]()[_0xfb3c('0x47')](_0xfb3c('0x4c'))[_0xfb3c('0x47')](_0xfb3c('0x4d'))[_0xfb3c('0x47')]('ui.OpenchannelInteractionId')[_0xfb3c('0x49')](_0xfb3c('0x4e'),'ui')[_0xfb3c('0x4f')](_0xfb3c('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x376bca=squel['select']()[_0xfb3c('0x49')]('openchannel_interactions','i')[_0xfb3c('0x4f')](_0xfb3c('0x51'),'c',_0xfb3c('0x52'))[_0xfb3c('0x4f')](_0xfb3c('0x50'),'o',_0xfb3c('0x53'))[_0xfb3c('0x4f')](_0xfb3c('0x54'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0xfb3c('0x55'),'me',_0xfb3c('0x56'))['left_join'](_0xfb3c('0x57'),'it',_0xfb3c('0x58'))[_0xfb3c('0x4f')](_0xfb3c('0x4a'),'t',_0xfb3c('0x59'));var _0xa0cab1=squel[_0xfb3c('0x5a')]();var _0x212dc7=[];var _0x37b1c1=squel[_0xfb3c('0x5a')]();var _0x50c242;if(_0x31ce97['query'][_0xfb3c('0x5b')]){_0x50c242=as[_0xfb3c('0x5c')](_0x31ce97[_0xfb3c('0x3c')]['search']);var _0x2e2be9=_0x50c242['sqlOperator'];for(var _0x2637d1=0x0;_0x2637d1<_0x50c242[_0xfb3c('0x5d')][_0xfb3c('0x41')];_0x2637d1++){var _0x34e9a3=_0x50c242['conditions'][_0x2637d1];var _0x593bdc='i';var _0xf6afaa=_[_0xfb3c('0x5e')](_0xbff696,[_0xfb3c('0x2c'),_0x34e9a3[_0xfb3c('0x47')]]);if(!_0xf6afaa){switch(_0x34e9a3[_0xfb3c('0x47')]){case _0xfb3c('0x5f'):if(_0x34e9a3[_0xfb3c('0x60')]==0x1){_0x376bca[_0xfb3c('0x61')]('`'+_0x34e9a3[_0xfb3c('0x47')]+_0xfb3c('0x62'));}else{_0x376bca['having']('`'+_0x34e9a3['field']+_0xfb3c('0x63'));}break;case'Contact':if(_0x34e9a3[_0xfb3c('0x64')]===_0xfb3c('0x65')){if(_0x34e9a3[_0xfb3c('0x60')][_0xfb3c('0x33')]('\x20')[_0xfb3c('0x41')]>0x1){_0xa0cab1[_0x2e2be9](_0xfb3c('0x66'),qs[_0xfb3c('0x67')](_0x34e9a3['value']),null);}else{var _0x867e09='%'+_0x34e9a3[_0xfb3c('0x60')]+'%';_0xa0cab1[_0x2e2be9](_0xfb3c('0x68'),_0x867e09,_0x867e09,_0x867e09);}}else{_0xf6afaa=_['find'](_0xbff696,[_0xfb3c('0x2c'),'ContactId']);_0x34e9a3[_0xfb3c('0x47')]=_0xfb3c('0x69');_0x4d4af9=as[_0xfb3c('0x6a')](_0x593bdc,_0xf6afaa[_0xfb3c('0x39')],_0x34e9a3);_0xa0cab1[_0x2e2be9](_0x4d4af9[_0xfb3c('0x6b')],_0x4d4af9['value'][_0xfb3c('0x6c')],_0x4d4af9[_0xfb3c('0x60')]['end']);}break;case _0xfb3c('0x6d'):var _0x2ff99f=_0x34e9a3[_0xfb3c('0x60')]['split'](',')[_0xfb3c('0x2f')](function(_0x56afe1){return Number(_0x56afe1);});_0x2ff99f[_0xfb3c('0x34')](function(_0x2a8118){_0x37b1c1['or'](_0xfb3c('0x6e'),'%,'+_0x2a8118+',%');});_0x212dc7=_['union'](_0x212dc7,_0x2ff99f);break;case _0xfb3c('0x6f'):if(_0x34e9a3['operator']===_0xfb3c('0x65')){_0xa0cab1[_0x2e2be9](_0xfb3c('0x70'),'%'+_0x34e9a3[_0xfb3c('0x60')]+'%',null);}else{_0xf6afaa=_['find'](_0xbff696,[_0xfb3c('0x2c'),_0xfb3c('0x71')]);_0x34e9a3[_0xfb3c('0x47')]=_0xfb3c('0x71');_0x4d4af9=as[_0xfb3c('0x6a')](_0x593bdc,_0xf6afaa['type'],_0x34e9a3);_0xa0cab1[_0x2e2be9](_0x4d4af9[_0xfb3c('0x6b')],_0x4d4af9['value'][_0xfb3c('0x6c')],_0x4d4af9[_0xfb3c('0x60')][_0xfb3c('0x2b')]);}break;case _0xfb3c('0x72'):_0x4d4af9=as[_0xfb3c('0x6a')]('me',null,_0x34e9a3);_0xa0cab1[_0x2e2be9](_0x4d4af9[_0xfb3c('0x6b')],_0x4d4af9[_0xfb3c('0x60')][_0xfb3c('0x6c')],_0x4d4af9[_0xfb3c('0x60')][_0xfb3c('0x2b')]);break;}}else{var _0x4d4af9=as[_0xfb3c('0x6a')](_0x593bdc,_0xf6afaa[_0xfb3c('0x39')],_0x34e9a3);_0xa0cab1[_0x2e2be9](_0x4d4af9[_0xfb3c('0x6b')],_0x4d4af9[_0xfb3c('0x60')][_0xfb3c('0x6c')],_0x4d4af9['value'][_0xfb3c('0x2b')]);}}}else{var _0x325b35=_(_0x31ce97[_0xfb3c('0x3c')])[_0xfb3c('0x73')]()[_0xfb3c('0x2f')](function(_0x6ff2f5){return _['some'](_0xbff696,[_0xfb3c('0x2c'),_0x6ff2f5])?_0x6ff2f5:undefined;})[_0xfb3c('0x74')]()[_0xfb3c('0x60')]();if(!_[_0xfb3c('0x75')](_0x325b35)){_0x325b35['forEach'](function(_0x379479){if(_0x379479===_0xfb3c('0x76')){_0x376bca[_0xfb3c('0x45')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xfb3c('0x77')](_0x31ce97[_0xfb3c('0x3c')][_0x379479]));}else if(_0x379479==='createdAt'){var _0x10fd19=JSON[_0xfb3c('0x78')](_0x31ce97['query'][_0x379479])[_0xfb3c('0x79')];var _0x17f9c2=JSON[_0xfb3c('0x78')](_0x31ce97[_0xfb3c('0x3c')][_0x379479])[_0xfb3c('0x7a')];_0x376bca[_0xfb3c('0x45')](_0xfb3c('0x7b'),_0x10fd19,_0x17f9c2);}else{if(_0x31ce97[_0xfb3c('0x3c')][_0x379479]===_0xfb3c('0x7c')){_0x376bca[_0xfb3c('0x45')]('i.'+_0x379479+_0xfb3c('0x7d'));}else{_0x376bca[_0xfb3c('0x45')]('i.'+_0x379479+_0xfb3c('0x7e'),_0x31ce97[_0xfb3c('0x3c')][_0x379479]);}}});}if(_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x7f')]){if(_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x7f')]==0x1){_0x376bca[_0xfb3c('0x61')](_0xfb3c('0x80'));}else{_0x376bca['having'](_0xfb3c('0x81'));}}if(_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x82')]){_0x212dc7=_[_0xfb3c('0x83')](_0x31ce97[_0xfb3c('0x3c')]['tag'])?_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x82')]:new Array(_0x31ce97['query'][_0xfb3c('0x82')]);_0x212dc7['forEach'](function(_0x322e69){_0x37b1c1['or'](_0xfb3c('0x6e'),'%,'+_0x322e69+',%');});}if(_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x84')]){var _0x353733=_0x31ce97['query'][_0xfb3c('0x84')][_0xfb3c('0x85')]('\x5c','\x5c\x5c')[_0xfb3c('0x85')](/'/g,'\x27\x27');if(qs[_0xfb3c('0x86')](_0x353733)){_0xa0cab1['or']('i.id\x20LIKE\x20?',_0x353733+'%');}else{_0xa0cab1['or'](_0xfb3c('0x87'),qs[_0xfb3c('0x67')](_0x353733))['or'](_0xfb3c('0x88'),_0x353733+'%')['or'](_0xfb3c('0x89'),_0x353733+'%');}}}_0x376bca[_0xfb3c('0x45')](_0xa0cab1);_0x376bca[_0xfb3c('0x8a')](_0xfb3c('0x8b'));var _0x5f29e4={'type':db['Sequelize'][_0xfb3c('0x8c')][_0xfb3c('0x8d')],'raw':!![]};var _0x1c1ca0=_0x376bca[_0xfb3c('0x8e')]();_0x1c1ca0['field'](_0xfb3c('0x8b'));_0x1c1ca0[_0xfb3c('0x47')](_0xfb3c('0x8f'),_0xfb3c('0x5f'));if(_0x4c7fe2[_0xfb3c('0x90')]){_0x4c7fe2[_0xfb3c('0x90')][_0xfb3c('0x34')](function(_0x1473d1){var _0x1535a0=_0x1473d1[0x0]===_0xfb3c('0x91')?_0x1473d1[0x0]:'i.'+_0x1473d1[0x0];_0x376bca[_0xfb3c('0x90')](_0x1535a0,_0x1473d1[0x1]==='DESC'?![]:!![]);});}if(!_[_0xfb3c('0x75')](_0x212dc7)){_0x376bca[_0xfb3c('0x61')](_0x37b1c1);_0x1c1ca0[_0xfb3c('0x45')](_0xfb3c('0x92'),_0x212dc7);}BPromise[_0xfb3c('0x93')]()[_0xfb3c('0x29')](function(){if(!_0x50c242){if(_0x31ce97[_0xfb3c('0x3c')]['OpenchannelAccountId'])return;_0x1c1ca0[_0xfb3c('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x376bca[_0xfb3c('0x45')](_0xfb3c('0x94'));return;}if(_0x31ce97[_0xfb3c('0x95')][_0xfb3c('0x96')]!==_0xfb3c('0x97'))return;return _0x31ce97[_0xfb3c('0x95')][_0xfb3c('0x98')]({'attributes':['id'],'raw':!![]})[_0xfb3c('0x29')](function(_0x23b497){if(_[_0xfb3c('0x75')](_0x23b497)){_0x1c1ca0[_0xfb3c('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x376bca[_0xfb3c('0x45')](_0xfb3c('0x99'));}else{_0x1c1ca0['where'](_0xfb3c('0x9a'),_[_0xfb3c('0x2f')](_0x23b497,'id'));_0x376bca[_0xfb3c('0x45')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xfb3c('0x2f')](_0x23b497,'id'));}});})[_0xfb3c('0x29')](function(){if(_0x31ce97[_0xfb3c('0x95')]['role']==='agent'&&!_0x50c242&&!_0x31ce97[_0xfb3c('0x3c')][_0xfb3c('0x76')])return[];return db[_0xfb3c('0x9b')][_0xfb3c('0x3c')](_0x1c1ca0[_0xfb3c('0x9c')](),_0x5f29e4);})[_0xfb3c('0x29')](function(_0x46255c){_0x46f9db[_0xfb3c('0x23')]=_0x46255c['length'];if(_0x46f9db[_0xfb3c('0x23')]===0x0)return[];return db[_0xfb3c('0x9b')][_0xfb3c('0x3c')](_0x6f68ce[_0xfb3c('0x9c')](),_0x5f29e4)[_0xfb3c('0x29')](function(_0x2c3fd7){_0x52e3bd=_['keyBy'](_0x2c3fd7,'id');_0x5f29e4=_[_0xfb3c('0x9d')](_0x5f29e4,{'model':db[_0xfb3c('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31ce97['query'][_0xfb3c('0x40')]){_0x4c7fe2[_0xfb3c('0x3f')][_0xfb3c('0x34')](function(_0x22f6fd){_0x376bca[_0xfb3c('0x47')]('i.'+_0x22f6fd);});}else{_0x376bca[_0xfb3c('0x47')](_0xfb3c('0x8f'),_0xfb3c('0x5f'));_0x376bca[_0xfb3c('0x47')](_0xfb3c('0x9e'),'Account.key');_0x376bca[_0xfb3c('0x47')](_0xfb3c('0x9f'),_0xfb3c('0xa0'));_0x376bca[_0xfb3c('0x47')](_0xfb3c('0xa1'),_0xfb3c('0x91'));_0x376bca[_0xfb3c('0x47')](_0xfb3c('0xa2'));_0x376bca[_0xfb3c('0x47')](_0xfb3c('0xa3'),_0xfb3c('0xa4'));_0x376bca[_0xfb3c('0x47')](_0xfb3c('0xa5'),_0xfb3c('0xa6'));_0x376bca['field'](_0xfb3c('0xa7'),_0xfb3c('0xa8'));_0x376bca[_0xfb3c('0x47')]('c.phone',_0xfb3c('0xa9'));_0x376bca[_0xfb3c('0x47')]('c.mobile',_0xfb3c('0xaa'));_0x376bca[_0xfb3c('0x47')]('c.fax','Contact.fax');_0x376bca[_0xfb3c('0x47')](_0xfb3c('0xab'),_0xfb3c('0xac'));_0x376bca[_0xfb3c('0x47')](_0xfb3c('0xad'),_0xfb3c('0xae'));_0x376bca[_0xfb3c('0x47')](_0xfb3c('0xaf'),'TagIds');}if(_0x4c7fe2[_0xfb3c('0x21')])_0x376bca['limit'](_0x4c7fe2[_0xfb3c('0x21')]);if(_0x4c7fe2[_0xfb3c('0x24')])_0x376bca['offset'](_0x4c7fe2['offset']);return db[_0xfb3c('0x9b')][_0xfb3c('0x3c')](_0x376bca[_0xfb3c('0x9c')](),_0x5f29e4);})[_0xfb3c('0x29')](function(_0x3ac0a4){if(_0x3ac0a4[_0xfb3c('0x41')]>0x0)_0x12d363[_0xfb3c('0x45')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xfb3c('0x2f')](_0x3ac0a4,'id'));return db[_0xfb3c('0x9b')][_0xfb3c('0x3c')](_0x12d363[_0xfb3c('0x9c')](),_0x5f29e4)['then'](function(_0x214054){var _0x47b560=_[_0xfb3c('0xb0')](_0x214054,_0xfb3c('0xb1'));var _0x3b66e4=[];_0x3ac0a4[_0xfb3c('0x34')](function(_0x3074fe){_0x3b66e4[_0xfb3c('0xb2')](updateOpenchannelInteraction(_0x3074fe,_0x52e3bd,_0x47b560));});return BPromise[_0xfb3c('0xb3')](_0x3b66e4);});});})[_0xfb3c('0x29')](function(_0x4e2608){_0x46f9db[_0xfb3c('0xb4')]=_0x4e2608;return _0x46f9db;})['then'](respondWithFilteredResult(_0x4334c2,_0x4c7fe2))[_0xfb3c('0x35')](handleError(_0x4334c2,null));};exports[_0xfb3c('0xb5')]=function(_0x306047,_0x5eddb4){var _0xd8d5f0={};if(_0x306047[_0xfb3c('0x3c')]['type']&&_0x306047[_0xfb3c('0x3c')][_0xfb3c('0x39')]===_0xfb3c('0x49')){_0xd8d5f0[_0xfb3c('0x49')]=_0x306047['params']['id'];}else{_0xd8d5f0['id']=_0x306047[_0xfb3c('0xb6')]['id'];}var _0x500bd2={'raw':![],'where':_0xd8d5f0},_0x3cf5db={};_0x3cf5db[_0xfb3c('0x3b')]=_[_0xfb3c('0x73')](db[_0xfb3c('0x37')][_0xfb3c('0xb7')]);_0x3cf5db[_0xfb3c('0x3c')]=_[_0xfb3c('0x73')](_0x306047[_0xfb3c('0x3c')]);_0x3cf5db[_0xfb3c('0x3d')]=_['intersection'](_0x3cf5db[_0xfb3c('0x3b')],_0x3cf5db[_0xfb3c('0x3c')]);_0x500bd2['attributes']=_['intersection'](_0x3cf5db[_0xfb3c('0x3b')],qs[_0xfb3c('0x40')](_0x306047['query'][_0xfb3c('0x40')]));_0x500bd2[_0xfb3c('0x3f')]=_0x500bd2[_0xfb3c('0x3f')][_0xfb3c('0x41')]?_0x500bd2['attributes']:_0x3cf5db[_0xfb3c('0x3b')];if(_0x306047['query'][_0xfb3c('0xb8')]){_0x500bd2[_0xfb3c('0xb9')]=[{'all':!![]}];}_0x500bd2=_[_0xfb3c('0x9d')]({},_0x500bd2,_0x306047[_0xfb3c('0xba')]);return db[_0xfb3c('0x37')][_0xfb3c('0x5e')](_0x500bd2)['then'](handleEntityNotFound(_0x5eddb4,null))[_0xfb3c('0x29')](respondWithResult(_0x5eddb4,null))[_0xfb3c('0x35')](handleError(_0x5eddb4,null));};exports[_0xfb3c('0xbb')]=function(_0x4e689f,_0x9b2e76){return db[_0xfb3c('0x37')]['create'](_0x4e689f[_0xfb3c('0x72')],{})[_0xfb3c('0x29')](respondWithResult(_0x9b2e76,0xc9))[_0xfb3c('0x35')](handleError(_0x9b2e76,null));};exports['update']=function(_0xa94bc8,_0x5e3b52){if(_0xa94bc8[_0xfb3c('0x72')]['id']){delete _0xa94bc8['body']['id'];}return db['OpenchannelInteraction'][_0xfb3c('0x5e')]({'where':{'id':_0xa94bc8[_0xfb3c('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5e3b52,null))[_0xfb3c('0x29')](saveUpdates(_0xa94bc8['body'],null))['then'](respondWithResult(_0x5e3b52,null))[_0xfb3c('0x35')](handleError(_0x5e3b52,null));};exports[_0xfb3c('0x2a')]=function(_0x14e53f,_0x42e2b1){return db['OpenchannelInteraction'][_0xfb3c('0x5e')]({'where':{'id':_0x14e53f[_0xfb3c('0xb6')]['id']}})['then'](handleEntityNotFound(_0x42e2b1,null))['then'](removeEntity(_0x42e2b1,null))['catch'](handleError(_0x42e2b1,null));};exports[_0xfb3c('0xbc')]=function(_0x2a9091,_0x3fee76){return db[_0xfb3c('0x37')]['describe']()[_0xfb3c('0x29')](respondWithResult(_0x3fee76,null))['catch'](handleError(_0x3fee76,null));};exports['addMessage']=function(_0x16e47c,_0x1cf688,_0xee7e58){return db[_0xfb3c('0xbd')]['find']({'where':{'id':_0x16e47c[_0xfb3c('0xb6')]['id']}})[_0xfb3c('0x29')](handleEntityNotFound(_0x1cf688,null))['then'](function(_0x58e7d4){if(_0x58e7d4){return _0x58e7d4['addMessage'](_0x16e47c['body'][_0xfb3c('0xbe')],_[_0xfb3c('0xbf')](_0x16e47c[_0xfb3c('0x72')],['ids','id'])||{});}})[_0xfb3c('0x29')](respondWithResult(_0x1cf688,null))['catch'](handleError(_0x1cf688,null));};exports[_0xfb3c('0xc0')]=function(_0x8e8207,_0x24e2a9,_0x53844d){var _0x2762ba={'raw':![],'where':{}};var _0x1ce14c={};var _0x20dcc8={'count':0x0,'rows':[]};return db[_0xfb3c('0x37')]['findOne']({'where':{'id':_0x8e8207[_0xfb3c('0xb6')]['id']}})[_0xfb3c('0x29')](handleEntityNotFound(_0x24e2a9,null))['then'](function(_0x19352f){if(_0x19352f){_0x1ce14c[_0xfb3c('0x3b')]=_[_0xfb3c('0x73')](db[_0xfb3c('0xbd')][_0xfb3c('0xb7')]);_0x1ce14c['query']=_[_0xfb3c('0x73')](_0x8e8207[_0xfb3c('0x3c')]);_0x1ce14c[_0xfb3c('0x3d')]=_['intersection'](_0x1ce14c[_0xfb3c('0x3b')],_0x1ce14c[_0xfb3c('0x3c')]);_0x2762ba[_0xfb3c('0x3f')]=_[_0xfb3c('0x3e')](_0x1ce14c['model'],qs['fields'](_0x8e8207['query'][_0xfb3c('0x40')]));_0x2762ba['attributes']=_0x2762ba['attributes'][_0xfb3c('0x41')]?_0x2762ba[_0xfb3c('0x3f')]:_0x1ce14c['model'];if(!_0x8e8207['query'][_0xfb3c('0x42')]('nolimit')){_0x2762ba[_0xfb3c('0x21')]=qs[_0xfb3c('0x21')](_0x8e8207[_0xfb3c('0x3c')][_0xfb3c('0x21')]);_0x2762ba[_0xfb3c('0x24')]=qs['offset'](_0x8e8207[_0xfb3c('0x3c')][_0xfb3c('0x24')]);}_0x2762ba[_0xfb3c('0x90')]=qs[_0xfb3c('0x44')](_0x8e8207[_0xfb3c('0x3c')][_0xfb3c('0x44')]);_0x2762ba[_0xfb3c('0x45')]=qs[_0xfb3c('0x3d')](_[_0xfb3c('0x46')](_0x8e8207[_0xfb3c('0x3c')],_0x1ce14c[_0xfb3c('0x3d')]));_0x2762ba['where']['OpenchannelInteractionId']=_0x19352f['id'];if(_0x8e8207[_0xfb3c('0x3c')][_0xfb3c('0x84')]){_0x2762ba[_0xfb3c('0x45')]=_['merge'](_0x2762ba[_0xfb3c('0x45')],{'$or':_[_0xfb3c('0x2f')](_0x2762ba[_0xfb3c('0x3f')],function(_0xbb11d4){var _0x34fe23={};_0x34fe23[_0xbb11d4]={'$like':'%'+_0x8e8207[_0xfb3c('0x3c')][_0xfb3c('0x84')]+'%'};return _0x34fe23;})});}if(_0x8e8207[_0xfb3c('0x3c')][_0xfb3c('0x79')]){var _0x1b3918=_0x8e8207[_0xfb3c('0x3c')][_0xfb3c('0x79')]['split'](',');var _0x3a53dd={};_0x3a53dd[_0x1b3918[0x0]]={'$gte':moment(_0x1b3918[0x1])[_0xfb3c('0xc1')](_0xfb3c('0xc2'))};_0x2762ba[_0xfb3c('0x45')]=_['merge'](_0x2762ba[_0xfb3c('0x45')],_0x3a53dd);}_0x2762ba=_[_0xfb3c('0x9d')]({},_0x2762ba,_0x8e8207['options']);return db[_0xfb3c('0xbd')]['count']({'where':_0x2762ba[_0xfb3c('0x45')]})[_0xfb3c('0x29')](function(_0x2949b0){_0x20dcc8[_0xfb3c('0x23')]=_0x2949b0;if(_0x8e8207['query'][_0xfb3c('0xb8')]){_0x2762ba[_0xfb3c('0xb9')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xfb3c('0xc3')](_0x2762ba);})[_0xfb3c('0x29')](function(_0x3372f){_0x20dcc8[_0xfb3c('0xb4')]=_0x3372f;return _0x20dcc8;});}})[_0xfb3c('0x29')](respondWithFilteredResult(_0x24e2a9,_0x2762ba))[_0xfb3c('0x35')](handleError(_0x24e2a9,null));};exports['addTags']=function(_0x18b488,_0x31a3cd,_0x19b492){return db[_0xfb3c('0x37')][_0xfb3c('0x5e')]({'where':{'id':_0x18b488['params']['id']}})[_0xfb3c('0x29')](handleEntityNotFound(_0x31a3cd,null))[_0xfb3c('0x29')](function(_0x35d3e0){if(_0x35d3e0){return _0x35d3e0['setTags'](_0x18b488[_0xfb3c('0x72')]['ids'],_[_0xfb3c('0xbf')](_0x18b488[_0xfb3c('0x72')],['ids','id'])||{})[_0xfb3c('0xc4')](function(){return db[_0xfb3c('0x6d')][_0xfb3c('0xc3')]({'attributes':['id','name',_0xfb3c('0x48')],'where':{'id':_0x18b488[_0xfb3c('0x72')][_0xfb3c('0xbe')]}});})['then'](function(_0x478fef){socket[_0xfb3c('0xc5')](_0xfb3c('0xc6'),{'id':Number(_0x18b488[_0xfb3c('0xb6')]['id']),'tags':_0x478fef||[]});return{'id':Number(_0x18b488[_0xfb3c('0xb6')]['id']),'tags':_0x478fef||[]};});}})[_0xfb3c('0x29')](respondWithResult(_0x31a3cd,null))[_0xfb3c('0x35')](handleError(_0x31a3cd,null));};exports[_0xfb3c('0xc7')]=function(_0x7d4b12,_0x48687e,_0x1e2da3){return db[_0xfb3c('0x37')]['find']({'where':{'id':_0x7d4b12['params']['id']}})[_0xfb3c('0x29')](handleEntityNotFound(_0x48687e,null))[_0xfb3c('0x29')](function(_0xafbfd3){if(_0xafbfd3){return _0xafbfd3[_0xfb3c('0xc7')](_0x7d4b12[_0xfb3c('0x3c')][_0xfb3c('0xbe')]);}})[_0xfb3c('0x29')](respondWithStatusCode(_0x48687e,null))[_0xfb3c('0x35')](handleError(_0x48687e,null));};exports[_0xfb3c('0xc8')]=function(_0x97efe8,_0x18b29a){var _0xb666db=moment()[_0xfb3c('0xc9')]()[_0xfb3c('0x9c')]();var _0x147852=path[_0xfb3c('0xca')](config['root'],'server',_0xfb3c('0xcb'),_0xfb3c('0xcc'));var _0xd09865=path[_0xfb3c('0xca')](config['root'],_0xfb3c('0xcd'),_0xfb3c('0xcb'),_0xfb3c('0xce'));var _0x202fb3=path[_0xfb3c('0xca')](_0x147852,_0xb666db);var _0x8b9bf6=util[_0xfb3c('0xc1')](_0xfb3c('0xcf'),_0x97efe8[_0xfb3c('0xb6')]['id'],_0xb666db);var _0x588c6c=path['join'](_0x147852,_0x8b9bf6);var _0x266805=[];_0x266805[_0xfb3c('0xb2')]({'model':db[_0xfb3c('0x6f')],'as':_0xfb3c('0x6f'),'attributes':['id',_0xfb3c('0x30')],'raw':!![]});_0x266805['push']({'model':db[_0xfb3c('0xd0')],'as':_0xfb3c('0xd1'),'attributes':['id',_0xfb3c('0xd2'),_0xfb3c('0xd3')],'raw':!![]});if(_0x97efe8[_0xfb3c('0x3c')][_0xfb3c('0xce')]){_0x266805[_0xfb3c('0xb2')]({'model':db[_0xfb3c('0xd4')],'as':'Attachment','raw':!![]});}var _0x4952b0=[{'model':db['OpenchannelMessage'],'as':_0xfb3c('0xd5'),'attributes':['id',_0xfb3c('0x72'),'createdAt',_0xfb3c('0xd6'),'secret',_0xfb3c('0x7f')],'include':_0x266805}];_0x4952b0[_0xfb3c('0xb2')]({'model':db[_0xfb3c('0xd7')],'as':_0xfb3c('0xd8'),'attributes':['id','name']});_0x4952b0[_0xfb3c('0xb2')]({'model':db[_0xfb3c('0x6f')],'as':_0xfb3c('0xd9'),'attributes':['id',_0xfb3c('0x30')]});return db[_0xfb3c('0x37')][_0xfb3c('0x5e')]({'where':{'id':_0x97efe8[_0xfb3c('0xb6')]['id']},'include':_0x4952b0})['then'](handleEntityNotFound(_0x18b29a,null))[_0xfb3c('0x29')](function(_0xcef396){if(_0xcef396){var _0x17ac95=_0xcef396[_0xfb3c('0xda')]({'plain':!![]});fs['mkdirSync'](_0x202fb3);var _0x56be0b={'channel':'Openchannel','account':_0x17ac95[_0xfb3c('0xd8')][_0xfb3c('0x2c')],'agent':_0x17ac95['Owner']?_0x17ac95[_0xfb3c('0xd9')]['fullname']:_0xfb3c('0xdb'),'createdAt':moment(_0x17ac95[_0xfb3c('0xdc')])[_0xfb3c('0xc1')](_0xfb3c('0xc2'))[_0xfb3c('0x9c')](),'closedAt':_0x17ac95[_0xfb3c('0xdd')]?moment(_0x17ac95['closedAt'])[_0xfb3c('0xc1')](_0xfb3c('0xc2'))[_0xfb3c('0x9c')]():'','disposition':_0x17ac95[_0xfb3c('0xde')],'visibility':_0x17ac95[_0xfb3c('0xdf')]?_0xfb3c('0xe0'):_0xfb3c('0xe1'),'messages':_(_0x17ac95[_0xfb3c('0xd5')])['filter']({'secret':![]})['map'](function(_0x11cec8){if(_0x11cec8[_0xfb3c('0xd4')]){var _0xc9da00=path[_0xfb3c('0xca')](_0xd09865,_0x11cec8[_0xfb3c('0xd4')][_0xfb3c('0xe2')]);if(fs[_0xfb3c('0xe3')](_0xc9da00)){fs[_0xfb3c('0xe4')](_0xc9da00)[_0xfb3c('0xe5')](fs[_0xfb3c('0xe6')](path[_0xfb3c('0xca')](_0x202fb3,_0x11cec8[_0xfb3c('0xd4')][_0xfb3c('0xe2')])));}}return{'date':moment(_0x11cec8[_0xfb3c('0xdc')])[_0xfb3c('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfb3c('0x9c')](),'sender':_0x11cec8[_0xfb3c('0xd6')]===_0xfb3c('0xe7')?_0x11cec8[_0xfb3c('0x6f')]?_0x11cec8[_0xfb3c('0x6f')][_0xfb3c('0x30')]:_0xfb3c('0xe8'):_0x11cec8[_0xfb3c('0xd1')][_0xfb3c('0xd2')]+(_0x11cec8[_0xfb3c('0xd1')][_0xfb3c('0xd3')]?'\x20'+_0x11cec8[_0xfb3c('0xd1')][_0xfb3c('0xd3')]:''),'body':_0x11cec8[_0xfb3c('0xd4')]?_0x11cec8['Attachment'][_0xfb3c('0xe2')]:_0x11cec8[_0xfb3c('0x72')],'direction':_0x11cec8['direction']===_0xfb3c('0xe7')?'A':'C','secret':_0x11cec8['secret'],'read':_0x11cec8[_0xfb3c('0x7f')],'attachment':_0x11cec8[_0xfb3c('0xd4')]};})['value']()};return ejs[_0xfb3c('0xe9')](path[_0xfb3c('0xca')](config[_0xfb3c('0xea')],_0xfb3c('0xcd'),'views',_0xfb3c('0xeb')),{'interaction':_0x56be0b})['then'](function(_0x59abaa){var _0x58a860=path[_0xfb3c('0xca')](_0x202fb3,_0xfb3c('0xec')+_0x17ac95['id']+'-'+_0xb666db+_0xfb3c('0xed'));var _0x15a8c2={'path':_0x58a860,'channel':_0xfb3c('0xee'),'interactionId':_0x17ac95['id']};return pdf['createPdfFromHTML'](_0x59abaa,_0x15a8c2);})[_0xfb3c('0x29')](function(){return new BPromise(function(_0x65b452,_0x18921e){zipdir(_0x202fb3,{'saveTo':_0x588c6c},function(_0x342d5c,_0x26379d){if(_0x342d5c)return _0x18921e(_0x342d5c);return _0x65b452(_0x26379d);});})[_0xfb3c('0x29')](function(){return new BPromise(function(_0x42fbe7,_0x10f5d8){rimraf(_0x202fb3,function(_0x95e462){if(_0x95e462)_0x10f5d8(_0x95e462);return _0x42fbe7();});});})[_0xfb3c('0x29')](function(){return _0x18b29a[_0xfb3c('0xc8')](_0x588c6c,_0x8b9bf6,function(_0x12983d){if(_0x12983d){console['log']('err',_0x12983d);}else{fs[_0xfb3c('0xef')](_0x588c6c);}});});});}else{return _0x18b29a['sendStatus'](0xc8);}})[_0xfb3c('0x35')](handleError(_0x18b29a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c48f079..ad8785a 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 _0xeb7d=['findAll','length','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove','then','setDataValue','Users','map'];(function(_0x2950a6,_0x36ddb6){var _0x19aedd=function(_0x2748eb){while(--_0x2748eb){_0x2950a6['push'](_0x2950a6['shift']());}};_0x19aedd(++_0x36ddb6);}(_0xeb7d,0x156));var _0xdeb7=function(_0x10a26a,_0xe95601){_0x10a26a=_0x10a26a-0x0;var _0x2308d9=_0xeb7d[_0x10a26a];return _0x2308d9;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xdeb7('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xdeb7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdeb7('0x2'),'afterDestroy':_0xdeb7('0x3')};function emitEvent(_0x46f684){return function(_0x284726,_0x2ccace,_0x73904b){_0x284726['getUsers']({'attributes':['id'],'raw':!![]})[_0xdeb7('0x4')](function(_0x5f14a1){_0x284726[_0xdeb7('0x5')](_0xdeb7('0x6'),_0x5f14a1[_0xdeb7('0x7')](function(_0x254a86){return{'id':_0x254a86['id']};}));return OpenchannelMessage[_0xdeb7('0x8')]({'where':{'OpenchannelInteractionId':_0x284726['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdeb7('0x4')](function(_0x2d47ad){_0x284726[_0xdeb7('0x5')]('unreadMessages',_0x2d47ad[_0xdeb7('0x9')]);OpenchannelInteractionEvents[_0xdeb7('0xa')](_0x46f684+':'+_0x284726['id'],_0x284726);OpenchannelInteractionEvents[_0xdeb7('0xa')](_0x46f684,_0x284726);_0x73904b(null);})['catch'](_0x73904b(null));};}for(var e in events){if(events[_0xdeb7('0xb')](e)){var event=events[e];OpenchannelInteraction[_0xdeb7('0xc')](e,emitEvent(event));}}module[_0xdeb7('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4bd3=['map','setDataValue','length','emit','catch','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','Users'];(function(_0x3486aa,_0x16ff6b){var _0x592017=function(_0x4d170c){while(--_0x4d170c){_0x3486aa['push'](_0x3486aa['shift']());}};_0x592017(++_0x16ff6b);}(_0x4bd3,0x70));var _0x34bd=function(_0x5d0df6,_0x3c790c){_0x5d0df6=_0x5d0df6-0x0;var _0x31b504=_0x4bd3[_0x5d0df6];return _0x31b504;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x34bd('0x0'))['db'][_0x34bd('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':_0x34bd('0x3'),'afterUpdate':'update','afterDestroy':_0x34bd('0x4')};function emitEvent(_0x32f121){return function(_0x4c75e9,_0x24e6b1,_0x31cfca){_0x4c75e9[_0x34bd('0x5')]({'attributes':['id'],'raw':!![]})[_0x34bd('0x6')](function(_0x4f1f38){_0x4c75e9['setDataValue'](_0x34bd('0x7'),_0x4f1f38[_0x34bd('0x8')](function(_0x4a82d5){return{'id':_0x4a82d5['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4c75e9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x34bd('0x6')](function(_0x5e4079){_0x4c75e9[_0x34bd('0x9')]('unreadMessages',_0x5e4079[_0x34bd('0xa')]);OpenchannelInteractionEvents[_0x34bd('0xb')](_0x32f121+':'+_0x4c75e9['id'],_0x4c75e9);OpenchannelInteractionEvents['emit'](_0x32f121,_0x4c75e9);_0x31cfca(null);})[_0x34bd('0xc')](_0x31cfca(null));};}for(var e in events){if(events[_0x34bd('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x34bd('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1502a15..8dedd50 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 _0x8ac9=['exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','./openchannelInteraction.attributes'];(function(_0x30994d,_0x2cc269){var _0x4554df=function(_0x125125){while(--_0x125125){_0x30994d['push'](_0x30994d['shift']());}};_0x4554df(++_0x2cc269);}(_0x8ac9,0x199));var _0x98ac=function(_0x875441,_0x10496d){_0x875441=_0x875441-0x0;var _0x28c6dd=_0x8ac9[_0x875441];return _0x28c6dd;};'use strict';var _=require(_0x98ac('0x0'));var util=require(_0x98ac('0x1'));var logger=require(_0x98ac('0x2'))('api');var moment=require('moment');var BPromise=require(_0x98ac('0x3'));var rp=require(_0x98ac('0x4'));var fs=require('fs');var path=require(_0x98ac('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x98ac('0x6'));module[_0x98ac('0x7')]=function(_0x349708,_0x5b9b0c){return _0x349708['define'](_0x98ac('0x8'),attributes,{'tableName':_0x98ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x98ac('0xa'),'collate':_0x98ac('0xb'),'hooks':{'beforeUpdate':function(_0x355f0f,_0x33d54a,_0x5bb362){if(_0x355f0f[_0x98ac('0xc')]('closed')){_0x355f0f[_0x98ac('0xd')]=moment()[_0x98ac('0xe')](_0x98ac('0xf'));}_0x5bb362(null,_0x355f0f);}}});}; \ No newline at end of file +var _0x2f3e=['utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions'];(function(_0x1be5eb,_0x1928ac){var _0x22d66a=function(_0x5132c5){while(--_0x5132c5){_0x1be5eb['push'](_0x1be5eb['shift']());}};_0x22d66a(++_0x1928ac);}(_0x2f3e,0x1d6));var _0xe2f3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2f3e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe2f3('0x0'));var util=require(_0xe2f3('0x1'));var logger=require(_0xe2f3('0x2'))(_0xe2f3('0x3'));var moment=require('moment');var BPromise=require(_0xe2f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2f3('0x5'));var rimraf=require('rimraf');var config=require(_0xe2f3('0x6'));var attributes=require(_0xe2f3('0x7'));module['exports']=function(_0x5c09f5,_0x151eb3){return _0x5c09f5['define'](_0xe2f3('0x8'),attributes,{'tableName':_0xe2f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe2f3('0xa'),'hooks':{'beforeUpdate':function(_0x3ef056,_0x46cf1b,_0x2340e1){if(_0x3ef056['changed'](_0xe2f3('0xb'))){_0x3ef056[_0xe2f3('0xc')]=moment()[_0xe2f3('0xd')](_0xe2f3('0xe'));}_0x2340e1(null,_0x3ef056);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3a7a06c..34aee46 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 _0x96c9=['defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','OpenchannelInteraction','update','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','find','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x28ce53,_0x50a391){var _0xe256ce=function(_0x5a6987){while(--_0x5a6987){_0x28ce53['push'](_0x28ce53['shift']());}};_0xe256ce(++_0x50a391);}(_0x96c9,0x1ab));var _0x996c=function(_0x2766f2,_0x49b770){_0x2766f2=_0x2766f2-0x0;var _0x2d5247=_0x96c9[_0x2766f2];return _0x2d5247;};'use strict';var _=require(_0x996c('0x0'));var util=require(_0x996c('0x1'));var moment=require('moment');var BPromise=require(_0x996c('0x2'));var rs=require(_0x996c('0x3'));var fs=require('fs');var Redis=require(_0x996c('0x4'));var db=require(_0x996c('0x5'))['db'];var utils=require(_0x996c('0x6'));var logger=require(_0x996c('0x7'))(_0x996c('0x8'));var config=require(_0x996c('0x9'));var jayson=require(_0x996c('0xa'));var client=jayson['client'][_0x996c('0xb')]({'port':0x232a});config[_0x996c('0xc')]=_[_0x996c('0xd')](config[_0x996c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x996c('0xe'))(new Redis(config[_0x996c('0xc')]));require(_0x996c('0xf'))[_0x996c('0x10')](socket);function respondWithRpcPromise(_0x357fe2,_0x30a2ad,_0x15ae5b){return new BPromise(function(_0x301be9,_0x145889){return client[_0x996c('0x11')](_0x357fe2,_0x15ae5b)[_0x996c('0x12')](function(_0x215837){logger[_0x996c('0x13')](_0x996c('0x14'),_0x30a2ad,'request\x20sent');logger[_0x996c('0x15')](_0x996c('0x16'),_0x30a2ad,_0x996c('0x17'),JSON['stringify'](_0x215837));if(_0x215837[_0x996c('0x18')]){if(_0x215837[_0x996c('0x18')][_0x996c('0x19')]===0x1f4){logger[_0x996c('0x18')](_0x996c('0x14'),_0x30a2ad,_0x215837[_0x996c('0x18')]['message']);return _0x145889(_0x215837['error'][_0x996c('0x1a')]);}logger[_0x996c('0x18')](_0x996c('0x14'),_0x30a2ad,_0x215837[_0x996c('0x18')]['message']);return _0x301be9(_0x215837[_0x996c('0x18')][_0x996c('0x1a')]);}else{logger[_0x996c('0x13')](_0x996c('0x14'),_0x30a2ad,_0x996c('0x17'));_0x301be9(_0x215837[_0x996c('0x1b')][_0x996c('0x1a')]);}})[_0x996c('0x1c')](function(_0x19ebbc){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x30a2ad,_0x19ebbc);_0x145889(_0x19ebbc);});});}exports['UpdateOpenchannelInteraction']=function(_0x2890a7){var _0x706966=this;return new Promise(function(_0x172053,_0x4ed111){return db[_0x996c('0x1d')][_0x996c('0x1e')](_0x2890a7['body'],{'raw':_0x2890a7[_0x996c('0x1f')]?_0x2890a7[_0x996c('0x1f')][_0x996c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2890a7['options']?_0x2890a7[_0x996c('0x1f')][_0x996c('0x21')]||null:null,'attributes':_0x2890a7[_0x996c('0x1f')]?_0x2890a7[_0x996c('0x1f')][_0x996c('0x22')]||null:null,'limit':_0x2890a7['options']?_0x2890a7[_0x996c('0x1f')][_0x996c('0x23')]||null:null})[_0x996c('0x12')](function(_0x2a459e){logger[_0x996c('0x13')](_0x996c('0x24'),_0x2890a7);logger[_0x996c('0x15')](_0x996c('0x24'),_0x2890a7,JSON[_0x996c('0x25')](_0x2a459e));_0x172053(_0x2a459e);})[_0x996c('0x1c')](function(_0xfe844e){logger[_0x996c('0x18')](_0x996c('0x24'),_0xfe844e['message'],_0x2890a7);_0x4ed111(_0x706966[_0x996c('0x18')](0x1f4,_0xfe844e[_0x996c('0x1a')]));});});};exports[_0x996c('0x26')]=function(_0x48c788){return new Promise(function(_0x25065d,_0x3e4a1c){return db[_0x996c('0x1d')][_0x996c('0x27')]({'where':_0x48c788['options']?_0x48c788[_0x996c('0x1f')][_0x996c('0x21')]||null:null})[_0x996c('0x12')](function(_0x2e58bb){if(_0x2e58bb){return _0x2e58bb['addTags'](_0x48c788['body']['ids'],_['omit'](_0x48c788[_0x996c('0x28')],[_0x996c('0x29'),'id'])||{});}})[_0x996c('0x2a')](function(_0x508dd5){logger[_0x996c('0x13')](_0x996c('0x2b'),_0x48c788);logger[_0x996c('0x15')](_0x996c('0x2b'),_0x48c788,JSON['stringify'](_0x508dd5));_0x25065d(_0x508dd5);})['catch'](function(_0x50bcf5){logger['error'](_0x996c('0x2b'),_0x50bcf5['message'],_0x48c788);_0x3e4a1c(_this[_0x996c('0x18')](0x1f4,_0x50bcf5[_0x996c('0x1a')]));});});}; \ No newline at end of file +var _0xea3c=['options','where','attributes','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body'];(function(_0xe1309a,_0xf8f2ab){var _0xe69827=function(_0x139698){while(--_0x139698){_0xe1309a['push'](_0xe1309a['shift']());}};_0xe69827(++_0xf8f2ab);}(_0xea3c,0xa9));var _0xcea3=function(_0x5cdf5d,_0x616e66){_0x5cdf5d=_0x5cdf5d-0x0;var _0x2b947a=_0xea3c[_0x5cdf5d];return _0x2b947a;};'use strict';var _=require(_0xcea3('0x0'));var util=require(_0xcea3('0x1'));var moment=require(_0xcea3('0x2'));var BPromise=require(_0xcea3('0x3'));var rs=require(_0xcea3('0x4'));var fs=require('fs');var Redis=require(_0xcea3('0x5'));var db=require(_0xcea3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcea3('0x7'))(_0xcea3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcea3('0x9')][_0xcea3('0xa')]({'port':0x232a});config[_0xcea3('0xb')]=_[_0xcea3('0xc')](config[_0xcea3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcea3('0xd'))(new Redis(config[_0xcea3('0xb')]));require(_0xcea3('0xe'))[_0xcea3('0xf')](socket);function respondWithRpcPromise(_0x5606a1,_0x5ac2e3,_0x5b05d9){return new BPromise(function(_0x330296,_0x5ed683){return client[_0xcea3('0x10')](_0x5606a1,_0x5b05d9)[_0xcea3('0x11')](function(_0x28e66c){logger[_0xcea3('0x12')](_0xcea3('0x13'),_0x5ac2e3,_0xcea3('0x14'));logger[_0xcea3('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x5ac2e3,_0xcea3('0x14'),JSON[_0xcea3('0x16')](_0x28e66c));if(_0x28e66c[_0xcea3('0x17')]){if(_0x28e66c[_0xcea3('0x17')][_0xcea3('0x18')]===0x1f4){logger[_0xcea3('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5ac2e3,_0x28e66c[_0xcea3('0x17')][_0xcea3('0x19')]);return _0x5ed683(_0x28e66c[_0xcea3('0x17')]['message']);}logger[_0xcea3('0x17')](_0xcea3('0x13'),_0x5ac2e3,_0x28e66c[_0xcea3('0x17')][_0xcea3('0x19')]);return _0x330296(_0x28e66c[_0xcea3('0x17')][_0xcea3('0x19')]);}else{logger[_0xcea3('0x12')](_0xcea3('0x13'),_0x5ac2e3,_0xcea3('0x14'));_0x330296(_0x28e66c['result'][_0xcea3('0x19')]);}})[_0xcea3('0x1a')](function(_0x40c86a){logger[_0xcea3('0x17')](_0xcea3('0x13'),_0x5ac2e3,_0x40c86a);_0x5ed683(_0x40c86a);});});}exports[_0xcea3('0x1b')]=function(_0x48535c){var _0x9a7a6d=this;return new Promise(function(_0x3eeb60,_0x1096fa){return db[_0xcea3('0x1c')][_0xcea3('0x1d')](_0x48535c[_0xcea3('0x1e')],{'raw':_0x48535c['options']?_0x48535c[_0xcea3('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48535c[_0xcea3('0x1f')]?_0x48535c[_0xcea3('0x1f')][_0xcea3('0x20')]||null:null,'attributes':_0x48535c['options']?_0x48535c['options'][_0xcea3('0x21')]||null:null,'limit':_0x48535c[_0xcea3('0x1f')]?_0x48535c['options']['limit']||null:null})['then'](function(_0x465de4){logger[_0xcea3('0x12')](_0xcea3('0x1b'),_0x48535c);logger['debug'](_0xcea3('0x1b'),_0x48535c,JSON[_0xcea3('0x16')](_0x465de4));_0x3eeb60(_0x465de4);})['catch'](function(_0xe51b08){logger[_0xcea3('0x17')](_0xcea3('0x1b'),_0xe51b08[_0xcea3('0x19')],_0x48535c);_0x1096fa(_0x9a7a6d[_0xcea3('0x17')](0x1f4,_0xe51b08[_0xcea3('0x19')]));});});};exports[_0xcea3('0x22')]=function(_0x4528dc){return new Promise(function(_0x390049,_0x596fa2){return db[_0xcea3('0x1c')]['find']({'where':_0x4528dc[_0xcea3('0x1f')]?_0x4528dc[_0xcea3('0x1f')][_0xcea3('0x20')]||null:null})[_0xcea3('0x11')](function(_0x4efb3f){if(_0x4efb3f){return _0x4efb3f[_0xcea3('0x23')](_0x4528dc[_0xcea3('0x1e')][_0xcea3('0x24')],_[_0xcea3('0x25')](_0x4528dc[_0xcea3('0x1e')],[_0xcea3('0x24'),'id'])||{});}})[_0xcea3('0x26')](function(_0x4d80db){logger[_0xcea3('0x12')](_0xcea3('0x27'),_0x4528dc);logger[_0xcea3('0x15')](_0xcea3('0x27'),_0x4528dc,JSON[_0xcea3('0x16')](_0x4d80db));_0x390049(_0x4d80db);})[_0xcea3('0x1a')](function(_0xf1a810){logger[_0xcea3('0x17')](_0xcea3('0x27'),_0xf1a810[_0xcea3('0x19')],_0x4528dc);_0x596fa2(_this['error'](0x1f4,_0xf1a810['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 202e983..75f850a 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 _0x701a=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x701a,0xbc));var _0xa701=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x701a[_0x27dba4];return _0x35ec9d;};'use strict';var OpenchannelInteractionEvents=require(_0xa701('0x0'));var events=[_0xa701('0x1'),_0xa701('0x2'),_0xa701('0x3')];function createListener(_0x5d6c8c,_0x44b12b){return function(_0x15b296){_0x44b12b[_0xa701('0x4')](_0x5d6c8c,_0x15b296);};}function removeListener(_0x4159f1,_0x1bf9b8){return function(){OpenchannelInteractionEvents[_0xa701('0x5')](_0x4159f1,_0x1bf9b8);};}exports[_0xa701('0x6')]=function(_0x565c53){for(var _0x41af7c=0x0,_0x234754=events[_0xa701('0x7')];_0x41af7c<_0x234754;_0x41af7c++){var _0x138c60=events[_0x41af7c];var _0x7f360f=createListener(_0xa701('0x8')+_0x138c60,_0x565c53);OpenchannelInteractionEvents['on'](_0x138c60,_0x7f360f);}}; \ No newline at end of file +var _0xc29f=['openchannelInteraction:','./openchannelInteraction.events','save','removeListener','register','length'];(function(_0x3977ea,_0x1c023d){var _0x47f984=function(_0x5ebe35){while(--_0x5ebe35){_0x3977ea['push'](_0x3977ea['shift']());}};_0x47f984(++_0x1c023d);}(_0xc29f,0x1cf));var _0xfc29=function(_0x53fdd5,_0x1f3f58){_0x53fdd5=_0x53fdd5-0x0;var _0x1cc7bf=_0xc29f[_0x53fdd5];return _0x1cc7bf;};'use strict';var OpenchannelInteractionEvents=require(_0xfc29('0x0'));var events=[_0xfc29('0x1'),'remove','update'];function createListener(_0x2ffa92,_0x30c1fe){return function(_0x20e50d){_0x30c1fe['emit'](_0x2ffa92,_0x20e50d);};}function removeListener(_0x36edbc,_0x348e2b){return function(){OpenchannelInteractionEvents[_0xfc29('0x2')](_0x36edbc,_0x348e2b);};}exports[_0xfc29('0x3')]=function(_0x815e6){for(var _0x1e311e=0x0,_0x301ef3=events[_0xfc29('0x4')];_0x1e311e<_0x301ef3;_0x1e311e++){var _0x2b3677=events[_0x1e311e];var _0x2150f1=createListener(_0xfc29('0x5')+_0x2b3677,_0x815e6);OpenchannelInteractionEvents['on'](_0x2b3677,_0x2150f1);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 420580b..9669998 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 _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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0xa4f609,_0x473660){_0xa4f609=_0xa4f609-0x0;var _0xfa6df2=_0x70e0[_0xa4f609];return _0xfa6df2;};'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 +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x520663,_0x4d37dd){var _0x391fe3=function(_0x3b99cc){while(--_0x3b99cc){_0x520663['push'](_0x520663['shift']());}};_0x391fe3(++_0x4d37dd);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 08f551e..18f68f5 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 _0xee4e=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x1ed779,_0x30c297){var _0x1d2375=function(_0x6d5ab5){while(--_0x6d5ab5){_0x1ed779['push'](_0x1ed779['shift']());}};_0x1d2375(++_0x30c297);}(_0xee4e,0x122));var _0xeee4=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xee4e[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0xeee4('0x0'));module[_0xeee4('0x1')]={'body':{'type':Sequelize[_0xeee4('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeee4('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeee4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeee4('0x4')]('in',_0xeee4('0x5')),'defaultValue':_0xeee4('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeee4('0x6')]},'providerName':{'type':Sequelize[_0xeee4('0x7')]},'providerResponse':{'type':Sequelize[_0xeee4('0x2')]}}; \ No newline at end of file +var _0xf894=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf894,0xfd));var _0x4f89=function(_0x21c09f,_0x2e5e11){_0x21c09f=_0x21c09f-0x0;var _0x321a05=_0xf894[_0x21c09f];return _0x321a05;};'use strict';var Sequelize=require(_0x4f89('0x0'));module[_0x4f89('0x1')]={'body':{'type':Sequelize[_0x4f89('0x2')](_0x4f89('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4f89('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4f89('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f89('0x5')]('in',_0x4f89('0x6')),'defaultValue':_0x4f89('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4f89('0x7')]},'providerName':{'type':Sequelize[_0x4f89('0x8')]},'providerResponse':{'type':Sequelize[_0x4f89('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 23052be..88b336f 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 _0x4677=['user','channel','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','email','motionChannel','rejectmessage','eml-format','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','then','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','accept','openchannel','readAt','format','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE: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','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s'];(function(_0x57bee7,_0x374280){var _0x49b722=function(_0x190fe4){while(--_0x190fe4){_0x57bee7['push'](_0x57bee7['shift']());}};_0x49b722(++_0x374280);}(_0x4677,0x105));var _0x7467=function(_0x522812,_0x361bee){_0x522812=_0x522812-0x0;var _0x3b9e59=_0x4677[_0x522812];return _0x3b9e59;};'use strict';var emlformat=require(_0x7467('0x0'));var rimraf=require(_0x7467('0x1'));var zipdir=require(_0x7467('0x2'));var jsonpatch=require(_0x7467('0x3'));var rp=require(_0x7467('0x4'));var moment=require(_0x7467('0x5'));var BPromise=require(_0x7467('0x6'));var Mustache=require(_0x7467('0x7'));var util=require(_0x7467('0x8'));var path=require(_0x7467('0x9'));var sox=require(_0x7467('0xa'));var csv=require(_0x7467('0xb'));var ejs=require(_0x7467('0xc'));var fs=require('fs');var fs_extra=require(_0x7467('0xd'));var _=require('lodash');var squel=require(_0x7467('0xe'));var crypto=require(_0x7467('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7467('0x10'));var toCsv=require(_0x7467('0xb'));var querystring=require(_0x7467('0x11'));var Papa=require(_0x7467('0x12'));var Redis=require('ioredis');var authService=require(_0x7467('0x13'));var qs=require(_0x7467('0x14'));var as=require(_0x7467('0x15'));var hardwareService=require(_0x7467('0x16'));var logger=require(_0x7467('0x17'))(_0x7467('0x18'));var utils=require(_0x7467('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7467('0x1a'));var db=require('../../mysqldb')['db'];config[_0x7467('0x1b')]=_[_0x7467('0x1c')](config['redis'],{'host':_0x7467('0x1d'),'port':0x18eb});var socket=require(_0x7467('0x1e'))(new Redis(config['redis']));require(_0x7467('0x1f'))[_0x7467('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7467('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38d41b,_0x2a3d1f,_0x1ee33b,_0x41b752){return new BPromise(function(_0x323e24,_0x3b5691){var _0x52d737=_0x41b752||client;return _0x52d737['request'](_0x38d41b,_0x1ee33b)[_0x7467('0x22')](function(_0x2cf75e){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2a3d1f,'request\x20sent');logger['debug'](_0x7467('0x23'),_0x2a3d1f,'request\x20sent',JSON[_0x7467('0x24')](_0x2cf75e));if(_0x2cf75e[_0x7467('0x25')]){if(_0x2cf75e[_0x7467('0x25')][_0x7467('0x26')]===0x1f4){logger[_0x7467('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x2a3d1f,_0x2cf75e[_0x7467('0x25')][_0x7467('0x27')]);return _0x3b5691(_0x2cf75e[_0x7467('0x25')][_0x7467('0x27')]);}logger[_0x7467('0x25')](_0x7467('0x28'),_0x2a3d1f,_0x2cf75e[_0x7467('0x25')]['message']);return _0x323e24(_0x2cf75e[_0x7467('0x25')][_0x7467('0x27')]);}else{logger['info'](_0x7467('0x28'),_0x2a3d1f,'request\x20sent');_0x323e24(_0x2cf75e['result']['message']);}})['catch'](function(_0x166c6b){logger[_0x7467('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x2a3d1f,_0x166c6b);_0x3b5691(_0x166c6b);});});}function respondWithStatusCode(_0x58f81b,_0x30cb4b){_0x30cb4b=_0x30cb4b||0xcc;return function(_0x259239){if(_0x259239){return _0x58f81b['sendStatus'](_0x30cb4b);}return _0x58f81b['status'](_0x30cb4b)[_0x7467('0x29')]();};}function respondWithResult(_0x1281bc,_0x2133a8){_0x2133a8=_0x2133a8||0xc8;return function(_0x4e7d1c){if(_0x4e7d1c){return _0x1281bc[_0x7467('0x2a')](_0x2133a8)['json'](_0x4e7d1c);}};}function respondWithFilteredResult(_0x3c2670,_0x1268ca){return function(_0x55f3be){if(_0x55f3be){var _0x5b7a80=typeof _0x1268ca[_0x7467('0x2b')]===_0x7467('0x2c')&&typeof _0x1268ca[_0x7467('0x2d')]===_0x7467('0x2c');var _0x143a44=_0x55f3be[_0x7467('0x2e')];var _0x1aa58e=_0x5b7a80?0x0:_0x1268ca[_0x7467('0x2b')];var _0x108ac9=_0x5b7a80?_0x55f3be[_0x7467('0x2e')]:_0x1268ca['offset']+_0x1268ca[_0x7467('0x2d')];var _0x3299cd;if(_0x108ac9>=_0x143a44){_0x108ac9=_0x143a44;_0x3299cd=0xc8;}else{_0x3299cd=0xce;}_0x3c2670['status'](_0x3299cd);return _0x3c2670['set'](_0x7467('0x2f'),_0x1aa58e+'-'+_0x108ac9+'/'+_0x143a44)[_0x7467('0x30')](_0x55f3be);}return null;};}function patchUpdates(_0x3bf4a9){return function(_0x3337bb){try{jsonpatch[_0x7467('0x31')](_0x3337bb,_0x3bf4a9,!![]);}catch(_0x57de69){return BPromise[_0x7467('0x32')](_0x57de69);}return _0x3337bb[_0x7467('0x33')]();};}function saveUpdates(_0xc7f2fc,_0x1a2dfc){return function(_0x508089){if(_0x508089){return _0x508089[_0x7467('0x34')](_0xc7f2fc)[_0x7467('0x22')](function(_0x1d6f6f){return _0x1d6f6f;});}return null;};}function removeEntity(_0x2728bf,_0x2c27c6){return function(_0x5d54c3){if(_0x5d54c3){return _0x5d54c3[_0x7467('0x35')]()['then'](function(){_0x2728bf[_0x7467('0x2a')](0xcc)[_0x7467('0x29')]();});}};}function handleEntityNotFound(_0x4833ea,_0x38f274){return function(_0x2528fb){if(!_0x2528fb){_0x4833ea[_0x7467('0x36')](0x194);}return _0x2528fb;};}function handleError(_0x1b539c,_0x182234){_0x182234=_0x182234||0x1f4;return function(_0x338e8e){logger[_0x7467('0x25')](_0x338e8e[_0x7467('0x37')]);if(_0x338e8e[_0x7467('0x38')]){delete _0x338e8e[_0x7467('0x38')];}_0x1b539c[_0x7467('0x2a')](_0x182234)['send'](_0x338e8e);};}exports[_0x7467('0x39')]=function(_0xb1da2b,_0x4ce246){var _0x304cb0={},_0x222cfa={},_0xa5b607={'count':0x0,'rows':[]};var _0x4024d4=_[_0x7467('0x3a')](db[_0x7467('0x3b')][_0x7467('0x3c')],function(_0xee58a4){return{'name':_0xee58a4['fieldName'],'type':_0xee58a4[_0x7467('0x3d')][_0x7467('0x3e')]};});_0x222cfa[_0x7467('0x3f')]=_[_0x7467('0x3a')](_0x4024d4,_0x7467('0x38'));_0x222cfa[_0x7467('0x40')]=_[_0x7467('0x41')](_0xb1da2b['query']);_0x222cfa[_0x7467('0x42')]=_['intersection'](_0x222cfa[_0x7467('0x3f')],_0x222cfa['query']);_0x304cb0[_0x7467('0x43')]=_[_0x7467('0x44')](_0x222cfa[_0x7467('0x3f')],qs[_0x7467('0x45')](_0xb1da2b['query'][_0x7467('0x45')]));_0x304cb0[_0x7467('0x43')]=_0x304cb0[_0x7467('0x43')][_0x7467('0x46')]?_0x304cb0[_0x7467('0x43')]:_0x222cfa[_0x7467('0x3f')];if(!_0xb1da2b[_0x7467('0x40')][_0x7467('0x47')](_0x7467('0x48'))){_0x304cb0[_0x7467('0x2d')]=qs[_0x7467('0x2d')](_0xb1da2b[_0x7467('0x40')][_0x7467('0x2d')]);_0x304cb0['offset']=qs[_0x7467('0x2b')](_0xb1da2b[_0x7467('0x40')]['offset']);}_0x304cb0['order']=qs[_0x7467('0x49')](_0xb1da2b[_0x7467('0x40')][_0x7467('0x49')]);_0x304cb0[_0x7467('0x4a')]=qs[_0x7467('0x42')](_[_0x7467('0x4b')](_0xb1da2b[_0x7467('0x40')],_0x222cfa[_0x7467('0x42')]),_0x4024d4);if(_0xb1da2b[_0x7467('0x40')][_0x7467('0x4c')]){_0x304cb0[_0x7467('0x4a')]=_['merge'](_0x304cb0[_0x7467('0x4a')],{'$or':_[_0x7467('0x3a')](_0x4024d4,function(_0x2bce5c){if(_0x2bce5c[_0x7467('0x3d')]!=='VIRTUAL'){var _0xc60ad5={};_0xc60ad5[_0x2bce5c[_0x7467('0x38')]]={'$like':'%'+_0xb1da2b['query'][_0x7467('0x4c')]+'%'};return _0xc60ad5;}})});}_0x304cb0=_[_0x7467('0x4d')]({},_0x304cb0,_0xb1da2b['options']);var _0x383be5={'where':_0x304cb0[_0x7467('0x4a')]};return db[_0x7467('0x3b')][_0x7467('0x2e')](_0x383be5)[_0x7467('0x22')](function(_0x5426b3){_0xa5b607[_0x7467('0x2e')]=_0x5426b3;if(_0xb1da2b['query'][_0x7467('0x4e')]){_0x304cb0[_0x7467('0x4f')]=[{'all':!![]}];}return db[_0x7467('0x3b')][_0x7467('0x50')](_0x304cb0);})[_0x7467('0x22')](function(_0x420b58){_0xa5b607[_0x7467('0x51')]=_0x420b58;return _0xa5b607;})[_0x7467('0x22')](respondWithFilteredResult(_0x4ce246,_0x304cb0))[_0x7467('0x52')](handleError(_0x4ce246,null));};exports['show']=function(_0x5d1920,_0x35c423){var _0x57b1ce={'raw':!![],'where':{'id':_0x5d1920[_0x7467('0x53')]['id']}},_0x4a5b40={};_0x4a5b40['model']=_[_0x7467('0x41')](db['OpenchannelMessage'][_0x7467('0x3c')]);_0x4a5b40[_0x7467('0x40')]=_['keys'](_0x5d1920[_0x7467('0x40')]);_0x4a5b40[_0x7467('0x42')]=_[_0x7467('0x44')](_0x4a5b40['model'],_0x4a5b40[_0x7467('0x40')]);_0x57b1ce['attributes']=_[_0x7467('0x44')](_0x4a5b40[_0x7467('0x3f')],qs[_0x7467('0x45')](_0x5d1920[_0x7467('0x40')][_0x7467('0x45')]));_0x57b1ce[_0x7467('0x43')]=_0x57b1ce[_0x7467('0x43')][_0x7467('0x46')]?_0x57b1ce[_0x7467('0x43')]:_0x4a5b40[_0x7467('0x3f')];if(_0x5d1920['query'][_0x7467('0x4e')]){_0x57b1ce[_0x7467('0x4f')]=[{'all':!![]}];}_0x57b1ce=_['merge']({},_0x57b1ce,_0x5d1920[_0x7467('0x54')]);return db[_0x7467('0x3b')][_0x7467('0x55')](_0x57b1ce)[_0x7467('0x22')](handleEntityNotFound(_0x35c423,null))['then'](respondWithResult(_0x35c423,null))[_0x7467('0x52')](handleError(_0x35c423,null));};exports[_0x7467('0x56')]=function(_0x7f07bb,_0x3de90a){return db[_0x7467('0x3b')][_0x7467('0x56')](_0x7f07bb[_0x7467('0x57')],{})[_0x7467('0x22')](respondWithResult(_0x3de90a,0xc9))[_0x7467('0x52')](handleError(_0x3de90a,null));};exports[_0x7467('0x34')]=function(_0x223e6b,_0x2114a1){if(_0x223e6b['body']['id']){delete _0x223e6b[_0x7467('0x57')]['id'];}return db[_0x7467('0x3b')][_0x7467('0x55')]({'where':{'id':_0x223e6b[_0x7467('0x53')]['id']}})[_0x7467('0x22')](handleEntityNotFound(_0x2114a1,null))[_0x7467('0x22')](saveUpdates(_0x223e6b[_0x7467('0x57')],null))['then'](respondWithResult(_0x2114a1,null))[_0x7467('0x52')](handleError(_0x2114a1,null));};exports[_0x7467('0x35')]=function(_0x57423a,_0x2e8fb6){return db[_0x7467('0x3b')][_0x7467('0x55')]({'where':{'id':_0x57423a['params']['id']}})[_0x7467('0x22')](handleEntityNotFound(_0x2e8fb6,null))['then'](removeEntity(_0x2e8fb6,null))[_0x7467('0x52')](handleError(_0x2e8fb6,null));};exports['describe']=function(_0xf2cd82,_0x4214e6){return db['OpenchannelMessage'][_0x7467('0x58')]()[_0x7467('0x22')](respondWithResult(_0x4214e6,null))[_0x7467('0x52')](handleError(_0x4214e6,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x7467('0x59')]=function(_0x575a4a,_0x240133,_0x3645cd){var _0xf71dd1={'agent':{},'channel':_0x7467('0x5a')};if(_0x575a4a[_0x7467('0x57')]['id']){delete _0x575a4a[_0x7467('0x57')]['id'];}_0x575a4a[_0x7467('0x57')]['read']=!![];_0x575a4a[_0x7467('0x57')][_0x7467('0x5b')]=moment()[_0x7467('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x575a4a[_0x7467('0x57')][_0x7467('0x5d')]=_0x575a4a['body'][_0x7467('0x5d')]||_0x575a4a['user']['id'];_0xf71dd1[_0x7467('0x5e')]['id']=_0x575a4a[_0x7467('0x57')][_0x7467('0x5d')];return db[_0x7467('0x3b')][_0x7467('0x55')]({'where':{'id':_0x575a4a[_0x7467('0x53')]['id'],'UserId':null}})[_0x7467('0x22')](handleEntityNotFound(_0x240133,null))[_0x7467('0x22')](saveUpdates(_0x575a4a[_0x7467('0x57')],null))[_0x7467('0x22')](function(_0x4052fd){if(_0x4052fd){_0xf71dd1[_0x7467('0x27')]=_0x4052fd[_0x7467('0x5f')]({'plain':!![]});return db[_0x7467('0x60')][_0x7467('0x55')]({'where':{'id':_0x4052fd[_0x7467('0x61')]}});}return null;})[_0x7467('0x22')](handleEntityNotFound(_0x240133,null))[_0x7467('0x22')](function(_0x96a83f){if(_0x96a83f){return _0x96a83f['update']({'UserId':_0x575a4a['body'][_0x7467('0x5d')],'read1stAt':_['isNil'](_0x96a83f[_0x7467('0x62')])?moment()[_0x7467('0x5c')](_0x7467('0x63')):undefined});}return null;})['then'](function(_0x5a2cfa){if(_0x5a2cfa){_0xf71dd1[_0x7467('0x64')]=_0x5a2cfa['get']({'plain':!![]});interaction_log['info'](_0x7467('0x65'),_0x575a4a['user']['id'],_0x575a4a['user'][_0x7467('0x38')],_0x575a4a['user'][_0x7467('0x66')],_0xf71dd1[_0x7467('0x64')]['id'],_0x575a4a[_0x7467('0x57')]?JSON[_0x7467('0x24')](_0x575a4a[_0x7467('0x57')]):_0x7467('0x67'));return respondWithRpcPromise(_0x7467('0x68'),'acceptMessage',_0xf71dd1);}return null;})[_0x7467('0x22')](function(_0xda5619){var _0x3f6314=_0x7467('0x69')+_0xda5619[_0x7467('0x27')][_0x7467('0x6a')];return db[_0x7467('0x6b')]['query'](_0x3f6314,{'type':db[_0x7467('0x6c')][_0x7467('0x6d')][_0x7467('0x6e')],'raw':!![]})[_0x7467('0x22')](function(_0x4104dc){return _0x4104dc;});})[_0x7467('0x22')](function(_0x5ae6c7){if(_0x5ae6c7){_0xf71dd1['message'][_0x7467('0x6f')]=_0x5ae6c7[0x0];if(!_0x575a4a['body'][_0x7467('0x5d')])return;return db[_0x7467('0x70')][_0x7467('0x55')]({'where':{'id':_0x575a4a['body']['UserId'],'role':_0x7467('0x5e')},'attributes':['id',_0x7467('0x38'),'fullname','email',_0x7467('0x71')],'raw':!![]});}return null;})[_0x7467('0x22')](function(_0x2c8338){if(!_0x2c8338)return null;_0xf71dd1['message'][_0x7467('0x5e')]=_0x2c8338;return _0xf71dd1;})[_0x7467('0x22')](function(_0x221002){if(_0x221002){if(_0x575a4a['body'][_0x7467('0x72')]){_0xf71dd1[_0x7467('0x27')][_0x7467('0x73')]=util[_0x7467('0x5c')](_0x7467('0x74'),_0x575a4a[_0x7467('0x75')][_0x7467('0x38')]);_0xf71dd1['message'][_0x7467('0x76')]=_0xf71dd1[_0x7467('0x76')];_0xf71dd1[_0x7467('0x27')]['motionChannel']=_0xf71dd1[_0x7467('0x76')];_0xf71dd1['message']['event']=_0x7467('0x59');return respondWithRpcPromise('EventManager',_0x7467('0x77'),{'event':_0x7467('0x78'),'message':_0xf71dd1['message']},client9002)['then'](function(){return _0xf71dd1;});}return _0xf71dd1;}return null;})[_0x7467('0x22')](respondWithResult(_0x240133,null))['catch'](handleError(_0x240133,null));};var interaction_log=require('../../config/logger')(_0x7467('0x79'));exports['reject']=function(_0x5aa183,_0x473527,_0x4f95c7){var _0xcc8708={'agent':{},'channel':_0x7467('0x5a')};if(_0x5aa183[_0x7467('0x57')]['id']){delete _0x5aa183[_0x7467('0x57')]['id'];}_0x5aa183[_0x7467('0x57')][_0x7467('0x5d')]=_0x5aa183[_0x7467('0x57')][_0x7467('0x5d')]||_0x5aa183['user']['id'];_0xcc8708[_0x7467('0x5e')]['id']=_0x5aa183[_0x7467('0x57')][_0x7467('0x5d')];return db[_0x7467('0x3b')][_0x7467('0x55')]({'where':{'id':_0x5aa183[_0x7467('0x53')]['id'],'UserId':null}})[_0x7467('0x22')](handleEntityNotFound(_0x473527,null))[_0x7467('0x22')](function(_0x364483){if(_0x364483){_0xcc8708[_0x7467('0x27')]=_0x364483[_0x7467('0x5f')]({'plain':!![]});return db[_0x7467('0x60')][_0x7467('0x55')]({'where':{'id':_0x364483[_0x7467('0x61')]}});}return null;})[_0x7467('0x22')](handleEntityNotFound(_0x473527,null))[_0x7467('0x22')](function(_0x575b6d){if(_0x575b6d){_0xcc8708[_0x7467('0x64')]=_0x575b6d[_0x7467('0x5f')]({'plain':!![]});interaction_log['info'](_0x7467('0x7a'),_0x5aa183[_0x7467('0x75')]['id'],_0x5aa183[_0x7467('0x75')][_0x7467('0x38')],_0x5aa183[_0x7467('0x75')]['role'],_0xcc8708['interaction']['id'],_0x5aa183['body']?JSON[_0x7467('0x24')](_0x5aa183[_0x7467('0x57')]):_0x7467('0x67'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0xcc8708);}return null;})[_0x7467('0x22')](function(_0x2dcc57){var _0x13af4a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2dcc57[_0x7467('0x27')]['ContactId'];return db['sequelize']['query'](_0x13af4a,{'type':db[_0x7467('0x6c')][_0x7467('0x6d')][_0x7467('0x6e')],'raw':!![]})['then'](function(_0x4fa155){return _0x4fa155;});})[_0x7467('0x22')](function(_0x47fdfd){if(_0x47fdfd){_0xcc8708['message'][_0x7467('0x6f')]=_0x47fdfd[0x0];if(!_0x5aa183[_0x7467('0x57')]['UserId'])return;return db[_0x7467('0x70')]['find']({'where':{'id':_0x5aa183[_0x7467('0x57')][_0x7467('0x5d')],'role':_0x7467('0x5e')},'attributes':['id','name','fullname',_0x7467('0x7b'),_0x7467('0x71')],'raw':!![]});}return null;})['then'](function(_0xbcf1b9){if(!_0xbcf1b9)return null;_0xcc8708[_0x7467('0x27')][_0x7467('0x5e')]=_0xbcf1b9;return _0xcc8708;})[_0x7467('0x22')](function(_0x40265f){if(_0x40265f){_0x40265f[_0x7467('0x27')][_0x7467('0x73')]=util[_0x7467('0x5c')](_0x7467('0x74'),_0x5aa183[_0x7467('0x75')][_0x7467('0x38')]);_0x40265f[_0x7467('0x27')][_0x7467('0x76')]=_0xcc8708[_0x7467('0x76')];_0x40265f[_0x7467('0x27')][_0x7467('0x7c')]=_0xcc8708['channel'];_0x40265f[_0x7467('0x27')]['event']='reject';respondWithRpcPromise(_0x7467('0x77'),_0x7467('0x77'),{'event':_0x7467('0x7d'),'message':_0x40265f[_0x7467('0x27')]},client9002);return _0xcc8708;}return null;})['then'](respondWithResult(_0x473527,null))[_0x7467('0x52')](handleError(_0x473527,null));}; \ No newline at end of file +var _0x2777=['includeAll','include','findAll','params','intersection','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','internal','manual','interface','channel','motionChannel','event','EventManager','../../config/logger','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','fullname','email','SIP/%s','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','result','message','catch','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x1140d6,_0x349fdc){var _0x598781=function(_0x4f7e06){while(--_0x4f7e06){_0x1140d6['push'](_0x1140d6['shift']());}};_0x598781(++_0x349fdc);}(_0x2777,0x130));var _0x7277=function(_0x493536,_0x2e9217){_0x493536=_0x493536-0x0;var _0xac9660=_0x2777[_0x493536];return _0xac9660;};'use strict';var emlformat=require(_0x7277('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7277('0x1'));var jsonpatch=require(_0x7277('0x2'));var rp=require(_0x7277('0x3'));var moment=require(_0x7277('0x4'));var BPromise=require(_0x7277('0x5'));var Mustache=require(_0x7277('0x6'));var util=require(_0x7277('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7277('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7277('0x9'));var _=require(_0x7277('0xa'));var squel=require(_0x7277('0xb'));var crypto=require(_0x7277('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7277('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7277('0xe'));var Papa=require(_0x7277('0xf'));var Redis=require(_0x7277('0x10'));var authService=require(_0x7277('0x11'));var qs=require(_0x7277('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7277('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7277('0x14'));var config=require(_0x7277('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7277('0x16')]=_[_0x7277('0x17')](config[_0x7277('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7277('0x18'))(new Redis(config[_0x7277('0x16')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x7277('0x19'));var client=jayson[_0x7277('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x7277('0x1a')][_0x7277('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x62552e,_0xe08f89,_0x48174e,_0x5e6df4){return new BPromise(function(_0x59b273,_0x1a2d76){var _0x173c0c=_0x5e6df4||client;return _0x173c0c[_0x7277('0x1c')](_0x62552e,_0x48174e)['then'](function(_0x41465){logger[_0x7277('0x1d')](_0x7277('0x1e'),_0xe08f89,_0x7277('0x1f'));logger[_0x7277('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xe08f89,_0x7277('0x1f'),JSON[_0x7277('0x21')](_0x41465));if(_0x41465['error']){if(_0x41465[_0x7277('0x22')]['code']===0x1f4){logger[_0x7277('0x22')](_0x7277('0x1e'),_0xe08f89,_0x41465[_0x7277('0x22')]['message']);return _0x1a2d76(_0x41465[_0x7277('0x22')]['message']);}logger['error'](_0x7277('0x1e'),_0xe08f89,_0x41465[_0x7277('0x22')]['message']);return _0x59b273(_0x41465[_0x7277('0x22')]['message']);}else{logger[_0x7277('0x1d')](_0x7277('0x1e'),_0xe08f89,_0x7277('0x1f'));_0x59b273(_0x41465[_0x7277('0x23')][_0x7277('0x24')]);}})[_0x7277('0x25')](function(_0x2ba4b7){logger[_0x7277('0x22')](_0x7277('0x1e'),_0xe08f89,_0x2ba4b7);_0x1a2d76(_0x2ba4b7);});});}function respondWithStatusCode(_0x4f1c0e,_0x10dc0b){_0x10dc0b=_0x10dc0b||0xcc;return function(_0x276336){if(_0x276336){return _0x4f1c0e[_0x7277('0x26')](_0x10dc0b);}return _0x4f1c0e['status'](_0x10dc0b)[_0x7277('0x27')]();};}function respondWithResult(_0x40aa58,_0x13cca7){_0x13cca7=_0x13cca7||0xc8;return function(_0x17d0a1){if(_0x17d0a1){return _0x40aa58[_0x7277('0x28')](_0x13cca7)[_0x7277('0x29')](_0x17d0a1);}};}function respondWithFilteredResult(_0xc42f16,_0xdf8172){return function(_0x15c7d3){if(_0x15c7d3){var _0x31a582=typeof _0xdf8172['offset']===_0x7277('0x2a')&&typeof _0xdf8172[_0x7277('0x2b')]==='undefined';var _0x473de2=_0x15c7d3[_0x7277('0x2c')];var _0x409ba8=_0x31a582?0x0:_0xdf8172['offset'];var _0xd32665=_0x31a582?_0x15c7d3[_0x7277('0x2c')]:_0xdf8172['offset']+_0xdf8172[_0x7277('0x2b')];var _0x3cd256;if(_0xd32665>=_0x473de2){_0xd32665=_0x473de2;_0x3cd256=0xc8;}else{_0x3cd256=0xce;}_0xc42f16[_0x7277('0x28')](_0x3cd256);return _0xc42f16[_0x7277('0x2d')](_0x7277('0x2e'),_0x409ba8+'-'+_0xd32665+'/'+_0x473de2)[_0x7277('0x29')](_0x15c7d3);}return null;};}function patchUpdates(_0x2c7895){return function(_0x196cd2){try{jsonpatch[_0x7277('0x2f')](_0x196cd2,_0x2c7895,!![]);}catch(_0x3811be){return BPromise[_0x7277('0x30')](_0x3811be);}return _0x196cd2[_0x7277('0x31')]();};}function saveUpdates(_0x12b234,_0x10dcae){return function(_0x3139da){if(_0x3139da){return _0x3139da[_0x7277('0x32')](_0x12b234)[_0x7277('0x33')](function(_0x247b48){return _0x247b48;});}return null;};}function removeEntity(_0x45fde8,_0x4a5543){return function(_0x42ac52){if(_0x42ac52){return _0x42ac52[_0x7277('0x34')]()['then'](function(){_0x45fde8[_0x7277('0x28')](0xcc)[_0x7277('0x27')]();});}};}function handleEntityNotFound(_0x5b5b90,_0x38a64b){return function(_0x5cead4){if(!_0x5cead4){_0x5b5b90[_0x7277('0x26')](0x194);}return _0x5cead4;};}function handleError(_0x1801d7,_0x2eb36c){_0x2eb36c=_0x2eb36c||0x1f4;return function(_0x19ef78){logger[_0x7277('0x22')](_0x19ef78['stack']);if(_0x19ef78[_0x7277('0x35')]){delete _0x19ef78[_0x7277('0x35')];}_0x1801d7['status'](_0x2eb36c)['send'](_0x19ef78);};}exports[_0x7277('0x36')]=function(_0x1a22c8,_0x11cc3f){var _0x26e242={},_0x2fa823={},_0x137d6e={'count':0x0,'rows':[]};var _0x1214c6=_[_0x7277('0x37')](db[_0x7277('0x38')][_0x7277('0x39')],function(_0x381347){return{'name':_0x381347[_0x7277('0x3a')],'type':_0x381347[_0x7277('0x3b')]['key']};});_0x2fa823['model']=_[_0x7277('0x37')](_0x1214c6,'name');_0x2fa823[_0x7277('0x3c')]=_[_0x7277('0x3d')](_0x1a22c8[_0x7277('0x3c')]);_0x2fa823[_0x7277('0x3e')]=_['intersection'](_0x2fa823[_0x7277('0x3f')],_0x2fa823[_0x7277('0x3c')]);_0x26e242['attributes']=_['intersection'](_0x2fa823['model'],qs[_0x7277('0x40')](_0x1a22c8['query'][_0x7277('0x40')]));_0x26e242[_0x7277('0x41')]=_0x26e242['attributes'][_0x7277('0x42')]?_0x26e242[_0x7277('0x41')]:_0x2fa823[_0x7277('0x3f')];if(!_0x1a22c8[_0x7277('0x3c')][_0x7277('0x43')]('nolimit')){_0x26e242['limit']=qs[_0x7277('0x2b')](_0x1a22c8[_0x7277('0x3c')]['limit']);_0x26e242['offset']=qs[_0x7277('0x44')](_0x1a22c8[_0x7277('0x3c')][_0x7277('0x44')]);}_0x26e242[_0x7277('0x45')]=qs['sort'](_0x1a22c8[_0x7277('0x3c')][_0x7277('0x46')]);_0x26e242[_0x7277('0x47')]=qs['filters'](_[_0x7277('0x48')](_0x1a22c8[_0x7277('0x3c')],_0x2fa823[_0x7277('0x3e')]),_0x1214c6);if(_0x1a22c8[_0x7277('0x3c')][_0x7277('0x49')]){_0x26e242[_0x7277('0x47')]=_[_0x7277('0x4a')](_0x26e242['where'],{'$or':_[_0x7277('0x37')](_0x1214c6,function(_0x1aba45){if(_0x1aba45[_0x7277('0x3b')]!==_0x7277('0x4b')){var _0x414c54={};_0x414c54[_0x1aba45['name']]={'$like':'%'+_0x1a22c8[_0x7277('0x3c')]['filter']+'%'};return _0x414c54;}})});}_0x26e242=_[_0x7277('0x4a')]({},_0x26e242,_0x1a22c8[_0x7277('0x4c')]);var _0x5efc59={'where':_0x26e242['where']};return db[_0x7277('0x38')][_0x7277('0x2c')](_0x5efc59)[_0x7277('0x33')](function(_0x324571){_0x137d6e[_0x7277('0x2c')]=_0x324571;if(_0x1a22c8[_0x7277('0x3c')][_0x7277('0x4d')]){_0x26e242[_0x7277('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7277('0x4f')](_0x26e242);})[_0x7277('0x33')](function(_0x3f1231){_0x137d6e['rows']=_0x3f1231;return _0x137d6e;})[_0x7277('0x33')](respondWithFilteredResult(_0x11cc3f,_0x26e242))[_0x7277('0x25')](handleError(_0x11cc3f,null));};exports['show']=function(_0x15a421,_0x5f316d){var _0x46a124={'raw':!![],'where':{'id':_0x15a421[_0x7277('0x50')]['id']}},_0x434535={};_0x434535[_0x7277('0x3f')]=_[_0x7277('0x3d')](db['OpenchannelMessage']['rawAttributes']);_0x434535[_0x7277('0x3c')]=_[_0x7277('0x3d')](_0x15a421[_0x7277('0x3c')]);_0x434535[_0x7277('0x3e')]=_[_0x7277('0x51')](_0x434535['model'],_0x434535[_0x7277('0x3c')]);_0x46a124['attributes']=_[_0x7277('0x51')](_0x434535[_0x7277('0x3f')],qs[_0x7277('0x40')](_0x15a421[_0x7277('0x3c')][_0x7277('0x40')]));_0x46a124[_0x7277('0x41')]=_0x46a124['attributes'][_0x7277('0x42')]?_0x46a124['attributes']:_0x434535['model'];if(_0x15a421['query'][_0x7277('0x4d')]){_0x46a124['include']=[{'all':!![]}];}_0x46a124=_[_0x7277('0x4a')]({},_0x46a124,_0x15a421[_0x7277('0x4c')]);return db[_0x7277('0x38')][_0x7277('0x52')](_0x46a124)[_0x7277('0x33')](handleEntityNotFound(_0x5f316d,null))[_0x7277('0x33')](respondWithResult(_0x5f316d,null))[_0x7277('0x25')](handleError(_0x5f316d,null));};exports[_0x7277('0x53')]=function(_0x1604ab,_0x173622){return db[_0x7277('0x38')][_0x7277('0x53')](_0x1604ab[_0x7277('0x54')],{})[_0x7277('0x33')](respondWithResult(_0x173622,0xc9))[_0x7277('0x25')](handleError(_0x173622,null));};exports[_0x7277('0x32')]=function(_0x4b140f,_0x57091c){if(_0x4b140f[_0x7277('0x54')]['id']){delete _0x4b140f['body']['id'];}return db[_0x7277('0x38')]['find']({'where':{'id':_0x4b140f['params']['id']}})['then'](handleEntityNotFound(_0x57091c,null))[_0x7277('0x33')](saveUpdates(_0x4b140f[_0x7277('0x54')],null))[_0x7277('0x33')](respondWithResult(_0x57091c,null))[_0x7277('0x25')](handleError(_0x57091c,null));};exports[_0x7277('0x34')]=function(_0x392536,_0x1292e4){return db[_0x7277('0x38')][_0x7277('0x52')]({'where':{'id':_0x392536[_0x7277('0x50')]['id']}})[_0x7277('0x33')](handleEntityNotFound(_0x1292e4,null))[_0x7277('0x33')](removeEntity(_0x1292e4,null))[_0x7277('0x25')](handleError(_0x1292e4,null));};exports[_0x7277('0x55')]=function(_0x5586a4,_0x249b53){return db[_0x7277('0x38')][_0x7277('0x55')]()[_0x7277('0x33')](respondWithResult(_0x249b53,null))[_0x7277('0x25')](handleError(_0x249b53,null));};var interaction_log=require('../../config/logger')(_0x7277('0x56'));exports[_0x7277('0x57')]=function(_0x58e161,_0x2e24b9,_0xe200e0){var _0x96b1ae={'agent':{},'channel':_0x7277('0x58')};if(_0x58e161[_0x7277('0x54')]['id']){delete _0x58e161['body']['id'];}_0x58e161['body'][_0x7277('0x59')]=!![];_0x58e161[_0x7277('0x54')][_0x7277('0x5a')]=moment()[_0x7277('0x5b')](_0x7277('0x5c'));_0x58e161[_0x7277('0x54')][_0x7277('0x5d')]=_0x58e161[_0x7277('0x54')][_0x7277('0x5d')]||_0x58e161[_0x7277('0x5e')]['id'];_0x96b1ae['agent']['id']=_0x58e161[_0x7277('0x54')]['UserId'];return db['OpenchannelMessage'][_0x7277('0x52')]({'where':{'id':_0x58e161['params']['id'],'UserId':null}})[_0x7277('0x33')](handleEntityNotFound(_0x2e24b9,null))[_0x7277('0x33')](saveUpdates(_0x58e161[_0x7277('0x54')],null))[_0x7277('0x33')](function(_0x1b7614){if(_0x1b7614){_0x96b1ae[_0x7277('0x24')]=_0x1b7614[_0x7277('0x5f')]({'plain':!![]});return db[_0x7277('0x60')][_0x7277('0x52')]({'where':{'id':_0x1b7614[_0x7277('0x61')]}});}return null;})[_0x7277('0x33')](handleEntityNotFound(_0x2e24b9,null))['then'](function(_0x4ed32b){if(_0x4ed32b){return _0x4ed32b[_0x7277('0x32')]({'UserId':_0x58e161[_0x7277('0x54')]['UserId'],'read1stAt':_['isNil'](_0x4ed32b[_0x7277('0x62')])?moment()[_0x7277('0x5b')](_0x7277('0x5c')):undefined});}return null;})[_0x7277('0x33')](function(_0x40e8df){if(_0x40e8df){_0x96b1ae[_0x7277('0x63')]=_0x40e8df[_0x7277('0x5f')]({'plain':!![]});interaction_log['info'](_0x7277('0x64'),_0x58e161[_0x7277('0x5e')]['id'],_0x58e161[_0x7277('0x5e')][_0x7277('0x35')],_0x58e161[_0x7277('0x5e')]['role'],_0x96b1ae['interaction']['id'],_0x58e161[_0x7277('0x54')]?JSON[_0x7277('0x21')](_0x58e161[_0x7277('0x54')]):'null');return respondWithRpcPromise(_0x7277('0x65'),'acceptMessage',_0x96b1ae);}return null;})[_0x7277('0x33')](function(_0x18ebef){var _0x54535d=_0x7277('0x66')+_0x18ebef[_0x7277('0x24')][_0x7277('0x67')];return db[_0x7277('0x68')][_0x7277('0x3c')](_0x54535d,{'type':db[_0x7277('0x69')][_0x7277('0x6a')][_0x7277('0x6b')],'raw':!![]})['then'](function(_0x2237de){return _0x2237de;});})[_0x7277('0x33')](function(_0xa54d52){if(_0xa54d52){_0x96b1ae[_0x7277('0x24')][_0x7277('0x6c')]=_0xa54d52[0x0];if(!_0x58e161[_0x7277('0x54')][_0x7277('0x5d')])return;return db[_0x7277('0x6d')][_0x7277('0x52')]({'where':{'id':_0x58e161['body']['UserId'],'role':_0x7277('0x6e')},'attributes':['id',_0x7277('0x35'),'fullname','email',_0x7277('0x6f')],'raw':!![]});}return null;})[_0x7277('0x33')](function(_0x2ab3d9){if(!_0x2ab3d9)return null;_0x96b1ae[_0x7277('0x24')][_0x7277('0x6e')]=_0x2ab3d9;return _0x96b1ae;})[_0x7277('0x33')](function(_0x2c603a){if(_0x2c603a){if(_0x58e161[_0x7277('0x54')][_0x7277('0x70')]){_0x96b1ae['message'][_0x7277('0x71')]=util[_0x7277('0x5b')]('SIP/%s',_0x58e161['user'][_0x7277('0x35')]);_0x96b1ae[_0x7277('0x24')][_0x7277('0x72')]=_0x96b1ae[_0x7277('0x72')];_0x96b1ae['message'][_0x7277('0x73')]=_0x96b1ae[_0x7277('0x72')];_0x96b1ae[_0x7277('0x24')][_0x7277('0x74')]='accept';return respondWithRpcPromise(_0x7277('0x75'),'EventManager',{'event':'acceptmessage','message':_0x96b1ae[_0x7277('0x24')]},client9002)[_0x7277('0x33')](function(){return _0x96b1ae;});}return _0x96b1ae;}return null;})['then'](respondWithResult(_0x2e24b9,null))[_0x7277('0x25')](handleError(_0x2e24b9,null));};var interaction_log=require(_0x7277('0x76'))('openchannel-interactions');exports['reject']=function(_0x241434,_0x2960b3,_0xf87dbc){var _0xadd9e7={'agent':{},'channel':_0x7277('0x58')};if(_0x241434['body']['id']){delete _0x241434[_0x7277('0x54')]['id'];}_0x241434[_0x7277('0x54')]['UserId']=_0x241434[_0x7277('0x54')]['UserId']||_0x241434['user']['id'];_0xadd9e7[_0x7277('0x6e')]['id']=_0x241434['body'][_0x7277('0x5d')];return db[_0x7277('0x38')][_0x7277('0x52')]({'where':{'id':_0x241434[_0x7277('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2960b3,null))[_0x7277('0x33')](function(_0x30ac4c){if(_0x30ac4c){_0xadd9e7[_0x7277('0x24')]=_0x30ac4c['get']({'plain':!![]});return db[_0x7277('0x60')][_0x7277('0x52')]({'where':{'id':_0x30ac4c['OpenchannelInteractionId']}});}return null;})[_0x7277('0x33')](handleEntityNotFound(_0x2960b3,null))[_0x7277('0x33')](function(_0x4c1444){if(_0x4c1444){_0xadd9e7[_0x7277('0x63')]=_0x4c1444[_0x7277('0x5f')]({'plain':!![]});interaction_log[_0x7277('0x1d')](_0x7277('0x77'),_0x241434[_0x7277('0x5e')]['id'],_0x241434['user'][_0x7277('0x35')],_0x241434[_0x7277('0x5e')][_0x7277('0x78')],_0xadd9e7[_0x7277('0x63')]['id'],_0x241434[_0x7277('0x54')]?JSON[_0x7277('0x21')](_0x241434[_0x7277('0x54')]):_0x7277('0x79'));return respondWithRpcPromise('RejectMessage',_0x7277('0x7a'),_0xadd9e7);}return null;})[_0x7277('0x33')](function(_0x37d889){var _0x3384b6=_0x7277('0x66')+_0x37d889[_0x7277('0x24')]['ContactId'];return db[_0x7277('0x68')][_0x7277('0x3c')](_0x3384b6,{'type':db['Sequelize'][_0x7277('0x6a')][_0x7277('0x6b')],'raw':!![]})[_0x7277('0x33')](function(_0x383838){return _0x383838;});})[_0x7277('0x33')](function(_0x2a087c){if(_0x2a087c){_0xadd9e7[_0x7277('0x24')][_0x7277('0x6c')]=_0x2a087c[0x0];if(!_0x241434[_0x7277('0x54')][_0x7277('0x5d')])return;return db[_0x7277('0x6d')][_0x7277('0x52')]({'where':{'id':_0x241434[_0x7277('0x54')][_0x7277('0x5d')],'role':'agent'},'attributes':['id',_0x7277('0x35'),_0x7277('0x7b'),_0x7277('0x7c'),_0x7277('0x6f')],'raw':!![]});}return null;})['then'](function(_0x417a3e){if(!_0x417a3e)return null;_0xadd9e7[_0x7277('0x24')]['agent']=_0x417a3e;return _0xadd9e7;})[_0x7277('0x33')](function(_0x191ec3){if(_0x191ec3){_0x191ec3[_0x7277('0x24')][_0x7277('0x71')]=util[_0x7277('0x5b')](_0x7277('0x7d'),_0x241434['user']['name']);_0x191ec3[_0x7277('0x24')][_0x7277('0x72')]=_0xadd9e7['channel'];_0x191ec3[_0x7277('0x24')][_0x7277('0x73')]=_0xadd9e7[_0x7277('0x72')];_0x191ec3[_0x7277('0x24')][_0x7277('0x74')]=_0x7277('0x30');respondWithRpcPromise(_0x7277('0x75'),_0x7277('0x75'),{'event':_0x7277('0x7e'),'message':_0x191ec3[_0x7277('0x24')]},client9002);return _0xadd9e7;}return null;})[_0x7277('0x33')](respondWithResult(_0x2960b3,null))[_0x7277('0x25')](handleError(_0x2960b3,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 92e48ce..aff0cb2 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 _0xbce7=['save','update','remove','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x12004b,_0x969450){var _0x2677aa=function(_0x51a1d9){while(--_0x51a1d9){_0x12004b['push'](_0x12004b['shift']());}};_0x2677aa(++_0x969450);}(_0xbce7,0x65));var _0x7bce=function(_0x48e85e,_0x5ad084){_0x48e85e=_0x48e85e-0x0;var _0x506aee=_0xbce7[_0x48e85e];return _0x506aee;};'use strict';var EventEmitter=require(_0x7bce('0x0'));var OpenchannelMessage=require(_0x7bce('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7bce('0x2')](0x0);var events={'afterCreate':_0x7bce('0x3'),'afterUpdate':_0x7bce('0x4'),'afterDestroy':_0x7bce('0x5')};function emitEvent(_0x5aa069){return function(_0xa1e893,_0x56b8d4,_0x434ac8){OpenchannelMessageEvents[_0x7bce('0x6')](_0x5aa069+':'+_0xa1e893['id'],_0xa1e893);OpenchannelMessageEvents[_0x7bce('0x6')](_0x5aa069,_0xa1e893);_0x434ac8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x7bce('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x88ba=['setMaxListeners','save','remove','emit','hook','events','../../mysqldb'];(function(_0x9ae2e2,_0x3ac847){var _0x18c74f=function(_0x52a07b){while(--_0x52a07b){_0x9ae2e2['push'](_0x9ae2e2['shift']());}};_0x18c74f(++_0x3ac847);}(_0x88ba,0xc2));var _0xa88b=function(_0x51e5bd,_0x3c2cf1){_0x51e5bd=_0x51e5bd-0x0;var _0x250aed=_0x88ba[_0x51e5bd];return _0x250aed;};'use strict';var EventEmitter=require(_0xa88b('0x0'));var OpenchannelMessage=require(_0xa88b('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa88b('0x2')](0x0);var events={'afterCreate':_0xa88b('0x3'),'afterUpdate':'update','afterDestroy':_0xa88b('0x4')};function emitEvent(_0x21e8e7){return function(_0x5a1728,_0x298642,_0x2c941){OpenchannelMessageEvents[_0xa88b('0x5')](_0x21e8e7+':'+_0x5a1728['id'],_0x5a1728);OpenchannelMessageEvents[_0xa88b('0x5')](_0x21e8e7,_0x5a1728);_0x2c941(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xa88b('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index bcad3f4..9529188 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 _0x5c00=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','OpenchannelInteraction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','direction','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get'];(function(_0x3d563b,_0x21b4a7){var _0x504015=function(_0xe732d8){while(--_0xe732d8){_0x3d563b['push'](_0x3d563b['shift']());}};_0x504015(++_0x21b4a7);}(_0x5c00,0x17e));var _0x05c0=function(_0x5ea797,_0x2d39dd){_0x5ea797=_0x5ea797-0x0;var _0x500783=_0x5c00[_0x5ea797];return _0x500783;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[{'name':_0x05c0('0xb'),'fields':[_0x05c0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32a795,_0x32cdfa,_0x996d6b){var _0x321c09=_0x3521fe[_0x05c0('0xd')];var _0x1edbb=_0x32a795['get']({'plain':!![]});if(_0x1edbb['direction'][_0x05c0('0xe')]()==='in'||_0x1edbb['direction'][_0x05c0('0xe')]()===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]&&!_['isNil'](_0x1edbb[_0x05c0('0x11')])){_0x321c09['OpenchannelInteraction'][_0x05c0('0x12')]({'where':{'id':_0x1edbb[_0x05c0('0x13')]}})[_0x05c0('0x14')](function(_0x12deeb){if(_0x12deeb){_0x12deeb[_0x05c0('0x15')]({'lastMsgAt':_0x1edbb[_0x05c0('0x16')],'lastMsgDirection':_0x1edbb[_0x05c0('0x17')][_0x05c0('0xe')]()});}})['catch'](function(_0x238e25){console[_0x05c0('0x18')](_0x238e25);});}if(_0x1edbb[_0x05c0('0x17')]===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]){var _0x40153e;_0x321c09[_0x05c0('0x19')][_0x05c0('0x1a')]()[_0x05c0('0x14')](function(_0x521cbd){return _0x321c09[_0x05c0('0x1b')][_0x05c0('0x1c')]({'where':{'id':_0x1edbb[_0x05c0('0x1d')]},'include':[{'model':_0x321c09['OpenchannelInteraction'],'as':_0x05c0('0x1e'),'where':{'id':_0x1edbb[_0x05c0('0x13')]},'limit':0x1,'include':[{'model':_0x321c09[_0x05c0('0x19')],'as':_0x05c0('0x1f'),'attributes':_[_0x05c0('0x20')](_0x521cbd)}]}]});})['then'](function(_0x407c1f){_0x40153e=_0x407c1f[_0x05c0('0x21')]({'plain':!![]});if(_0x40153e&&_0x40153e['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x24'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x40153e[_0x05c0('0x1e')]&&_0x40153e[_0x05c0('0x1e')][_0x05c0('0x26')]){_0x1edbb['Interaction']=_[_0x05c0('0x27')](_0x40153e[_0x05c0('0x1e')][0x0],'Contact');_0x1edbb['Contact']=_0x40153e['Interactions'][0x0]['Contact'];}var _0x32cdfa={'method':_0x05c0('0x28'),'uri':encodeURI(_0x40153e[_0x05c0('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32cdfa['method']){case _0x05c0('0x29'):_0x32cdfa['qs']=_0x1edbb;break;case _0x05c0('0x28'):_0x32cdfa[_0x05c0('0xc')]=_0x1edbb;break;}return rp(_0x32cdfa)[_0x05c0('0x14')](function(_0x58769a){logger[_0x05c0('0x2a')](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x2c'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x58769a['body']['threadId']&&_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]!=_0x1edbb[_0x05c0('0x2e')][_0x05c0('0x2d')]){return _0x321c09[_0x05c0('0x2f')][_0x05c0('0x15')]({'threadId':_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]},{'logging':!![],'where':{'id':_0x1edbb[_0x05c0('0x2e')]['id']}});}else{return;}})[_0x05c0('0x14')](function(){return _0x32a795[_0x05c0('0x15')]({'read':!![]});})[_0x05c0('0x30')](function(_0x50f03d){logger['error'](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x31')](_0x50f03d,{'showHidden':![],'depth':null}));_0x996d6b();});}else{_0x996d6b();}})['finally'](function(){_0x996d6b();});}else{_0x996d6b();}}},'charset':_0x05c0('0x32'),'collate':_0x05c0('0x33')});}; \ No newline at end of file +var _0x34b7=['moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x34b7,0x196));var _0x734b=function(_0x46eb0e,_0x296d16){_0x46eb0e=_0x46eb0e-0x0;var _0x523297=_0x34b7[_0x46eb0e];return _0x523297;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x734b('0xa'),'fields':[_0x734b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f163,_0x5f4b3a,_0x19a88e){var _0x598dee=_0x2f3128[_0x734b('0xc')];var _0x333738=_0x53f163[_0x734b('0xd')]({'plain':!![]});if(_0x333738[_0x734b('0xe')][_0x734b('0xf')]()==='in'||_0x333738[_0x734b('0xe')][_0x734b('0xf')]()===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]&&!_[_0x734b('0x12')](_0x333738[_0x734b('0x13')])){_0x598dee[_0x734b('0x14')][_0x734b('0x15')]({'where':{'id':_0x333738[_0x734b('0x16')]}})['then'](function(_0x18fc18){if(_0x18fc18){_0x18fc18[_0x734b('0x17')]({'lastMsgAt':_0x333738[_0x734b('0x18')],'lastMsgDirection':_0x333738[_0x734b('0xe')][_0x734b('0xf')]()});}})[_0x734b('0x19')](function(_0x2372bd){console[_0x734b('0x1a')](_0x2372bd);});}if(_0x333738[_0x734b('0xe')]===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]){var _0x4d2d23;_0x598dee[_0x734b('0x1b')][_0x734b('0x1c')]()[_0x734b('0x1d')](function(_0x5edbe9){return _0x598dee['OpenchannelAccount']['find']({'where':{'id':_0x333738[_0x734b('0x1e')]},'include':[{'model':_0x598dee[_0x734b('0x14')],'as':_0x734b('0x1f'),'where':{'id':_0x333738[_0x734b('0x16')]},'limit':0x1,'include':[{'model':_0x598dee[_0x734b('0x1b')],'as':_0x734b('0x20'),'attributes':_[_0x734b('0x21')](_0x5edbe9)}]}]});})[_0x734b('0x1d')](function(_0x67eed){_0x4d2d23=_0x67eed[_0x734b('0xd')]({'plain':!![]});if(_0x4d2d23&&_0x4d2d23[_0x734b('0x22')]){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util['format'](_0x734b('0x26'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x4d2d23['Interactions']&&_0x4d2d23[_0x734b('0x1f')][_0x734b('0x27')]){_0x333738[_0x734b('0x28')]=_[_0x734b('0x29')](_0x4d2d23[_0x734b('0x1f')][0x0],_0x734b('0x20'));_0x333738[_0x734b('0x20')]=_0x4d2d23[_0x734b('0x1f')][0x0][_0x734b('0x20')];}var _0x5f4b3a={'method':_0x734b('0x2a'),'uri':encodeURI(_0x4d2d23[_0x734b('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5f4b3a[_0x734b('0x2b')]){case'GET':_0x5f4b3a['qs']=_0x333738;break;case'POST':_0x5f4b3a[_0x734b('0xb')]=_0x333738;break;}return rp(_0x5f4b3a)[_0x734b('0x1d')](function(_0x47a0a9){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2c')](_0x734b('0x2d'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x47a0a9[_0x734b('0xb')]['threadId']&&_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]!=_0x333738[_0x734b('0x28')][_0x734b('0x2e')]){return _0x598dee[_0x734b('0x14')][_0x734b('0x17')]({'threadId':_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]},{'logging':!![],'where':{'id':_0x333738[_0x734b('0x28')]['id']}});}else{return;}})[_0x734b('0x1d')](function(){return _0x53f163['update']({'read':!![]});})[_0x734b('0x19')](function(_0x37f1a1){logger['error'](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2f')](_0x37f1a1,{'showHidden':![],'depth':null}));_0x19a88e();});}else{_0x19a88e();}})[_0x734b('0x30')](function(){_0x19a88e();});}else{_0x19a88e();}}},'charset':_0x734b('0x31'),'collate':_0x734b('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index aa3e326..1eba0ee 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf13a69,_0x20ed0b){var _0x3549fe=function(_0x5727df){while(--_0x5727df){_0xf13a69['push'](_0xf13a69['shift']());}};_0x3549fe(++_0x20ed0b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b1bc8,_0x54dba5){_0x2b1bc8=_0x2b1bc8-0x0;var _0x56733b=_0x5f2f[_0x2b1bc8];return _0x56733b;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3f46fe,_0x5f359c){var _0x1c8bdd=function(_0x13f4e9){while(--_0x13f4e9){_0x3f46fe['push'](_0x3f46fe['shift']());}};_0x1c8bdd(++_0x5f359c);}(_0xadb5,0xad));var _0x5adb=function(_0x5d4d5c,_0x1dc8e3){_0x5d4d5c=_0x5d4d5c-0x0;var _0x326c33=_0xadb5[_0x5d4d5c];return _0x326c33;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 774260d..cc956e7 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 _0xadc2=['remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x5bcb0f,_0x221e89){var _0x57eec2=function(_0x8e295){while(--_0x8e295){_0x5bcb0f['push'](_0x5bcb0f['shift']());}};_0x57eec2(++_0x221e89);}(_0xadc2,0x187));var _0x2adc=function(_0x421f57,_0x19ada2){_0x421f57=_0x421f57-0x0;var _0x528d04=_0xadc2[_0x421f57];return _0x528d04;};'use strict';var OpenchannelMessageEvents=require(_0x2adc('0x0'));var events=['save',_0x2adc('0x1'),_0x2adc('0x2')];function createListener(_0x576e19,_0x401d03){return function(_0xa5c6a3){_0x401d03[_0x2adc('0x3')](_0x576e19,_0xa5c6a3);};}function removeListener(_0x514394,_0x5c6f4f){return function(){OpenchannelMessageEvents[_0x2adc('0x4')](_0x514394,_0x5c6f4f);};}exports['register']=function(_0x38b07c){for(var _0x4ca949=0x0,_0x273f1c=events[_0x2adc('0x5')];_0x4ca949<_0x273f1c;_0x4ca949++){var _0xcbf2d1=events[_0x4ca949];var _0x374279=createListener(_0x2adc('0x6')+_0xcbf2d1,_0x38b07c);OpenchannelMessageEvents['on'](_0xcbf2d1,_0x374279);}}; \ No newline at end of file +var _0x0d91=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x0d91,0x76));var _0x10d9=function(_0x2ebce5,_0x4d089a){_0x2ebce5=_0x2ebce5-0x0;var _0x2173cf=_0x0d91[_0x2ebce5];return _0x2173cf;};'use strict';var OpenchannelMessageEvents=require(_0x10d9('0x0'));var events=[_0x10d9('0x1'),_0x10d9('0x2'),_0x10d9('0x3')];function createListener(_0x5497db,_0xc2882){return function(_0x38311f){_0xc2882[_0x10d9('0x4')](_0x5497db,_0x38311f);};}function removeListener(_0x56ab5d,_0x2f6e57){return function(){OpenchannelMessageEvents[_0x10d9('0x5')](_0x56ab5d,_0x2f6e57);};}exports[_0x10d9('0x6')]=function(_0x4d89f0){for(var _0x3cc578=0x0,_0x3a49ab=events[_0x10d9('0x7')];_0x3cc578<_0x3a49ab;_0x3cc578++){var _0x26b6cf=events[_0x3cc578];var _0x2558bb=createListener(_0x10d9('0x8')+_0x26b6cf,_0x4d89f0);OpenchannelMessageEvents['on'](_0x26b6cf,_0x2558bb);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 622e07f..1c2b10b 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 _0x4328=['post','create','addTeams','delete','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4328,0x115));var _0x8432=function(_0x5559a5,_0x8b083c){_0x5559a5=_0x5559a5-0x0;var _0x2c7616=_0x4328[_0x5559a5];return _0x2c7616;};'use strict';var multer=require('multer');var util=require(_0x8432('0x0'));var path=require('path');var timeout=require(_0x8432('0x1'));var express=require(_0x8432('0x2'));var router=express[_0x8432('0x3')]();var fs_extra=require(_0x8432('0x4'));var auth=require(_0x8432('0x5'));var interaction=require(_0x8432('0x6'));var config=require(_0x8432('0x7'));var controller=require(_0x8432('0x8'));router[_0x8432('0x9')]('/',auth['isAuthenticated'](),controller[_0x8432('0xa')]);router[_0x8432('0x9')]('/describe',auth[_0x8432('0xb')](),controller[_0x8432('0xc')]);router[_0x8432('0x9')](_0x8432('0xd'),auth[_0x8432('0xb')](),controller[_0x8432('0xe')]);router['get']('/:id/members',auth[_0x8432('0xb')](),controller[_0x8432('0xf')]);router['get'](_0x8432('0x10'),auth[_0x8432('0xb')](),controller[_0x8432('0x11')]);router[_0x8432('0x9')](_0x8432('0x12'),auth[_0x8432('0xb')](),controller[_0x8432('0x13')]);router[_0x8432('0x14')]('/',auth[_0x8432('0xb')](),controller[_0x8432('0x15')]);router[_0x8432('0x14')](_0x8432('0x10'),auth[_0x8432('0xb')](),controller[_0x8432('0x16')]);router['post']('/:id/users',auth[_0x8432('0xb')](),controller['addAgents']);router['put'](_0x8432('0xd'),auth[_0x8432('0xb')](),controller['update']);router[_0x8432('0x17')](_0x8432('0xd'),auth[_0x8432('0xb')](),controller['destroy']);router[_0x8432('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8432('0x18')]);router[_0x8432('0x17')](_0x8432('0x12'),auth[_0x8432('0xb')](),controller[_0x8432('0x19')]);module[_0x8432('0x1a')]=router; \ No newline at end of file +var _0x8625=['/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','update','delete','destroy','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x8625,0x1eb));var _0x5862=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x8625[_0x2adbeb];return _0x5e18a6;};'use strict';var multer=require(_0x5862('0x0'));var util=require(_0x5862('0x1'));var path=require(_0x5862('0x2'));var timeout=require('connect-timeout');var express=require(_0x5862('0x3'));var router=express[_0x5862('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5862('0x5'));var interaction=require(_0x5862('0x6'));var config=require(_0x5862('0x7'));var controller=require(_0x5862('0x8'));router[_0x5862('0x9')]('/',auth[_0x5862('0xa')](),controller['index']);router[_0x5862('0x9')](_0x5862('0xb'),auth[_0x5862('0xa')](),controller[_0x5862('0xc')]);router[_0x5862('0x9')](_0x5862('0xd'),auth[_0x5862('0xa')](),controller['show']);router['get'](_0x5862('0xe'),auth[_0x5862('0xa')](),controller[_0x5862('0xf')]);router[_0x5862('0x9')](_0x5862('0x10'),auth[_0x5862('0xa')](),controller[_0x5862('0x11')]);router[_0x5862('0x9')]('/:id/users',auth[_0x5862('0xa')](),controller[_0x5862('0x12')]);router[_0x5862('0x13')]('/',auth[_0x5862('0xa')](),controller[_0x5862('0x14')]);router['post'](_0x5862('0x10'),auth[_0x5862('0xa')](),controller[_0x5862('0x15')]);router[_0x5862('0x13')](_0x5862('0x16'),auth[_0x5862('0xa')](),controller[_0x5862('0x17')]);router['put'](_0x5862('0xd'),auth[_0x5862('0xa')](),controller[_0x5862('0x18')]);router[_0x5862('0x19')](_0x5862('0xd'),auth[_0x5862('0xa')](),controller[_0x5862('0x1a')]);router['delete'](_0x5862('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x5862('0x16'),auth[_0x5862('0xa')](),controller[_0x5862('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 14d6a3d..75b2223 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 _0xa560=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0xa560,0xeb));var _0x0a56=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa560[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x0a56('0x0'));module[_0x0a56('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0a56('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0a56('0x3')]},'timeout':{'type':Sequelize[_0x0a56('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0a56('0x5')](_0x0a56('0x6'),_0x0a56('0x7'),_0x0a56('0x8'))}}; \ No newline at end of file +var _0x964e=['sequelize','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x533a4b,_0x3fef3d){var _0x10dcd9=function(_0x27c088){while(--_0x27c088){_0x533a4b['push'](_0x533a4b['shift']());}};_0x10dcd9(++_0x3fef3d);}(_0x964e,0x108));var _0xe964=function(_0x15a72f,_0x412d0b){_0x15a72f=_0x15a72f-0x0;var _0x23142d=_0x964e[_0x15a72f];return _0x23142d;};'use strict';var Sequelize=require(_0xe964('0x0'));module['exports']={'name':{'type':Sequelize[_0xe964('0x1')],'unique':_0xe964('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe964('0x1')]},'timeout':{'type':Sequelize[_0xe964('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe964('0x4')]('rrmemory','beepall',_0xe964('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index fc409ec..05bdf64 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 _0x9719=['compact','value','transaction','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','getMembers','findOne','hasOwnProperty','OpenchannelQueueId','UserOpenchannelQueue','findAll','User','findAndCountAll','openchannelPause','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x9719,0x1a3));var _0x9971=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9719[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x9971('0x0'));var rimraf=require(_0x9971('0x1'));var zipdir=require(_0x9971('0x2'));var jsonpatch=require(_0x9971('0x3'));var rp=require(_0x9971('0x4'));var moment=require(_0x9971('0x5'));var BPromise=require(_0x9971('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9971('0x7'));var sox=require('sox');var csv=require(_0x9971('0x8'));var ejs=require(_0x9971('0x9'));var fs=require('fs');var fs_extra=require(_0x9971('0xa'));var _=require(_0x9971('0xb'));var squel=require(_0x9971('0xc'));var crypto=require('crypto');var jsforce=require(_0x9971('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9971('0x8'));var querystring=require(_0x9971('0xe'));var Papa=require('papaparse');var Redis=require(_0x9971('0xf'));var authService=require(_0x9971('0x10'));var qs=require(_0x9971('0x11'));var as=require(_0x9971('0x12'));var hardwareService=require(_0x9971('0x13'));var logger=require(_0x9971('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9971('0x15'));var licenseUtil=require(_0x9971('0x16'));var db=require(_0x9971('0x17'))['db'];config[_0x9971('0x18')]=_['defaults'](config[_0x9971('0x18')],{'host':_0x9971('0x19'),'port':0x18eb});var socket=require(_0x9971('0x1a'))(new Redis(config[_0x9971('0x18')]));require(_0x9971('0x1b'))['register'](socket);function respondWithStatusCode(_0x2a502a,_0x3612e9){_0x3612e9=_0x3612e9||0xcc;return function(_0x842325){if(_0x842325){return _0x2a502a[_0x9971('0x1c')](_0x3612e9);}return _0x2a502a[_0x9971('0x1d')](_0x3612e9)[_0x9971('0x1e')]();};}function respondWithResult(_0x2b4776,_0x58f0eb){_0x58f0eb=_0x58f0eb||0xc8;return function(_0x464edd){if(_0x464edd){return _0x2b4776[_0x9971('0x1d')](_0x58f0eb)['json'](_0x464edd);}};}function respondWithFilteredResult(_0x28d989,_0x2fa9d2){return function(_0x30d381){if(_0x30d381){var _0x2b1b40=typeof _0x2fa9d2[_0x9971('0x1f')]===_0x9971('0x20')&&typeof _0x2fa9d2[_0x9971('0x21')]===_0x9971('0x20');var _0x326385=_0x30d381['count'];var _0x4cc041=_0x2b1b40?0x0:_0x2fa9d2['offset'];var _0x680cca=_0x2b1b40?_0x30d381[_0x9971('0x22')]:_0x2fa9d2[_0x9971('0x1f')]+_0x2fa9d2[_0x9971('0x21')];var _0xbd6904;if(_0x680cca>=_0x326385){_0x680cca=_0x326385;_0xbd6904=0xc8;}else{_0xbd6904=0xce;}_0x28d989[_0x9971('0x1d')](_0xbd6904);return _0x28d989[_0x9971('0x23')]('Content-Range',_0x4cc041+'-'+_0x680cca+'/'+_0x326385)['json'](_0x30d381);}return null;};}function patchUpdates(_0x5560f9){return function(_0x273a2c){try{jsonpatch[_0x9971('0x24')](_0x273a2c,_0x5560f9,!![]);}catch(_0x1e2e45){return BPromise[_0x9971('0x25')](_0x1e2e45);}return _0x273a2c[_0x9971('0x26')]();};}function saveUpdates(_0x336b0f,_0x5a8286){return function(_0x228c92){if(_0x228c92){return _0x228c92[_0x9971('0x27')](_0x336b0f)[_0x9971('0x28')](function(_0xd5f6f1){return _0xd5f6f1;});}return null;};}function removeEntity(_0x339202,_0xd19ee2){return function(_0x15d441){if(_0x15d441){return _0x15d441[_0x9971('0x29')]()[_0x9971('0x28')](function(){var _0x14a977=_0x15d441[_0x9971('0x2a')]({'plain':!![]});var _0x116ec0=_0x9971('0x2b');return db[_0x9971('0x2c')][_0x9971('0x29')]({'where':{'type':_0x116ec0,'resourceId':_0x14a977['id']}})[_0x9971('0x28')](function(){return _0x15d441;});})['then'](function(){_0x339202[_0x9971('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd06e70,_0x530abe){return function(_0x1e3376){if(!_0x1e3376){_0xd06e70[_0x9971('0x1c')](0x194);}return _0x1e3376;};}function handleError(_0x549c3a,_0x456530){_0x456530=_0x456530||0x1f4;return function(_0x5bb7cb){logger[_0x9971('0x2d')](_0x5bb7cb[_0x9971('0x2e')]);if(_0x5bb7cb[_0x9971('0x2f')]){delete _0x5bb7cb['name'];}_0x549c3a[_0x9971('0x1d')](_0x456530)[_0x9971('0x30')](_0x5bb7cb);};}exports[_0x9971('0x31')]=function(_0x28c80d,_0x45cc78){var _0x4729db={},_0x9e0192={},_0xe86614={'count':0x0,'rows':[]};var _0x3331ca=_[_0x9971('0x32')](db[_0x9971('0x33')][_0x9971('0x34')],function(_0x1be286){return{'name':_0x1be286[_0x9971('0x35')],'type':_0x1be286['type'][_0x9971('0x36')]};});_0x9e0192[_0x9971('0x37')]=_[_0x9971('0x32')](_0x3331ca,_0x9971('0x2f'));_0x9e0192[_0x9971('0x38')]=_[_0x9971('0x39')](_0x28c80d[_0x9971('0x38')]);_0x9e0192[_0x9971('0x3a')]=_[_0x9971('0x3b')](_0x9e0192['model'],_0x9e0192['query']);_0x4729db[_0x9971('0x3c')]=_[_0x9971('0x3b')](_0x9e0192['model'],qs[_0x9971('0x3d')](_0x28c80d[_0x9971('0x38')]['fields']));_0x4729db['attributes']=_0x4729db[_0x9971('0x3c')]['length']?_0x4729db[_0x9971('0x3c')]:_0x9e0192[_0x9971('0x37')];if(!_0x28c80d['query']['hasOwnProperty'](_0x9971('0x3e'))){_0x4729db[_0x9971('0x21')]=qs[_0x9971('0x21')](_0x28c80d[_0x9971('0x38')][_0x9971('0x21')]);_0x4729db[_0x9971('0x1f')]=qs[_0x9971('0x1f')](_0x28c80d[_0x9971('0x38')][_0x9971('0x1f')]);}_0x4729db[_0x9971('0x3f')]=qs[_0x9971('0x40')](_0x28c80d['query'][_0x9971('0x40')]);_0x4729db[_0x9971('0x41')]=qs[_0x9971('0x3a')](_[_0x9971('0x42')](_0x28c80d['query'],_0x9e0192[_0x9971('0x3a')]),_0x3331ca);if(_0x28c80d['query'][_0x9971('0x43')]){_0x4729db[_0x9971('0x41')]=_[_0x9971('0x44')](_0x4729db[_0x9971('0x41')],{'$or':_[_0x9971('0x32')](_0x3331ca,function(_0x40b296){if(_0x40b296['type']!=='VIRTUAL'){var _0x1f8ad1={};_0x1f8ad1[_0x40b296[_0x9971('0x2f')]]={'$like':'%'+_0x28c80d['query'][_0x9971('0x43')]+'%'};return _0x1f8ad1;}})});}_0x4729db=_['merge']({},_0x4729db,_0x28c80d[_0x9971('0x45')]);var _0x48e138={'where':_0x4729db[_0x9971('0x41')]};return db['OpenchannelQueue'][_0x9971('0x22')](_0x48e138)['then'](function(_0x5bb9cb){_0xe86614['count']=_0x5bb9cb;if(_0x28c80d['query']['includeAll']){_0x4729db['include']=[{'all':!![]}];}return db[_0x9971('0x33')]['findAll'](_0x4729db);})[_0x9971('0x28')](function(_0x21788c){_0xe86614[_0x9971('0x46')]=_0x21788c;return _0xe86614;})['then'](respondWithFilteredResult(_0x45cc78,_0x4729db))[_0x9971('0x47')](handleError(_0x45cc78,null));};exports[_0x9971('0x48')]=function(_0x233be2,_0x2d8475){var _0xd0819={'raw':!![],'where':{'id':_0x233be2[_0x9971('0x49')]['id']}},_0x2fbca3={};_0x2fbca3[_0x9971('0x37')]=_[_0x9971('0x39')](db[_0x9971('0x33')][_0x9971('0x34')]);_0x2fbca3['query']=_[_0x9971('0x39')](_0x233be2['query']);_0x2fbca3[_0x9971('0x3a')]=_[_0x9971('0x3b')](_0x2fbca3[_0x9971('0x37')],_0x2fbca3['query']);_0xd0819[_0x9971('0x3c')]=_[_0x9971('0x3b')](_0x2fbca3[_0x9971('0x37')],qs[_0x9971('0x3d')](_0x233be2[_0x9971('0x38')]['fields']));_0xd0819[_0x9971('0x3c')]=_0xd0819['attributes'][_0x9971('0x4a')]?_0xd0819['attributes']:_0x2fbca3['model'];if(_0x233be2[_0x9971('0x38')][_0x9971('0x4b')]){_0xd0819['include']=[{'all':!![]}];}_0xd0819=_[_0x9971('0x44')]({},_0xd0819,_0x233be2[_0x9971('0x45')]);return db[_0x9971('0x33')][_0x9971('0x4c')](_0xd0819)[_0x9971('0x28')](handleEntityNotFound(_0x2d8475,null))['then'](respondWithResult(_0x2d8475,null))['catch'](handleError(_0x2d8475,null));};exports[_0x9971('0x4d')]=function(_0x3ce6f2,_0x5ce622){return db[_0x9971('0x33')][_0x9971('0x4d')](_0x3ce6f2[_0x9971('0x4e')],{})[_0x9971('0x28')](function(_0xe4d707){var _0x5afb3a=_0x3ce6f2[_0x9971('0x4f')]['get']({'plain':!![]});if(!_0x5afb3a)throw new Error(_0x9971('0x50'));if(_0x5afb3a[_0x9971('0x51')]===_0x9971('0x4f')){var _0x3158e5=_0xe4d707[_0x9971('0x2a')]({'plain':!![]});var _0x385bad='OpenchannelQueues';return db['UserProfileSection'][_0x9971('0x4c')]({'where':{'name':_0x385bad,'userProfileId':_0x5afb3a[_0x9971('0x52')]},'raw':!![]})[_0x9971('0x28')](function(_0x22b993){if(_0x22b993&&_0x22b993[_0x9971('0x53')]===0x0){return db[_0x9971('0x2c')][_0x9971('0x4d')]({'name':_0x3158e5[_0x9971('0x2f')],'resourceId':_0x3158e5['id'],'type':_0x22b993[_0x9971('0x2f')],'sectionId':_0x22b993['id']},{})['then'](function(){return _0xe4d707;});}else{return _0xe4d707;}})['catch'](function(_0x1940a0){logger[_0x9971('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1940a0);throw _0x1940a0;});}return _0xe4d707;})['then'](respondWithResult(_0x5ce622,0xc9))[_0x9971('0x47')](handleError(_0x5ce622,null));};exports[_0x9971('0x27')]=function(_0x15e95e,_0x30350d){if(_0x15e95e['body']['id']){delete _0x15e95e[_0x9971('0x4e')]['id'];}return db[_0x9971('0x33')]['find']({'where':{'id':_0x15e95e[_0x9971('0x49')]['id']}})[_0x9971('0x28')](handleEntityNotFound(_0x30350d,null))[_0x9971('0x28')](saveUpdates(_0x15e95e[_0x9971('0x4e')],null))[_0x9971('0x28')](respondWithResult(_0x30350d,null))[_0x9971('0x47')](handleError(_0x30350d,null));};exports[_0x9971('0x29')]=function(_0x148cc6,_0x54f738){return db['OpenchannelQueue'][_0x9971('0x4c')]({'where':{'id':_0x148cc6[_0x9971('0x49')]['id']}})[_0x9971('0x28')](handleEntityNotFound(_0x54f738,null))[_0x9971('0x28')](removeEntity(_0x54f738,null))[_0x9971('0x47')](handleError(_0x54f738,null));};exports[_0x9971('0x54')]=function(_0x328918,_0x1ae08f){return db['OpenchannelQueue'][_0x9971('0x54')]()['then'](respondWithResult(_0x1ae08f,null))['catch'](handleError(_0x1ae08f,null));};exports[_0x9971('0x55')]=function(_0x191e80,_0x76ca7b,_0xfee92a){var _0x5cfe67={'raw':!![],'where':{}},_0x32eb42={},_0x4faf3a;return db[_0x9971('0x33')][_0x9971('0x56')]({'where':{'id':_0x191e80[_0x9971('0x49')]['id']}})['then'](handleEntityNotFound(_0x76ca7b,null))['then'](function(_0x32d670){if(_0x32d670){_0x4faf3a=_0x32d670[_0x9971('0x2a')]({'plain':!![]});_0x32eb42['model']=_['keys'](db['UserOpenchannelQueue']['rawAttributes']);_0x32eb42['query']=_[_0x9971('0x39')](_0x191e80['query']);_0x32eb42[_0x9971('0x3a')]=_[_0x9971('0x3b')](_0x32eb42[_0x9971('0x37')],_0x32eb42[_0x9971('0x38')]);_0x5cfe67[_0x9971('0x3c')]=_[_0x9971('0x3b')](_0x32eb42[_0x9971('0x37')],qs[_0x9971('0x3d')](_0x191e80[_0x9971('0x38')][_0x9971('0x3d')]));_0x5cfe67[_0x9971('0x3c')]=_0x5cfe67[_0x9971('0x3c')][_0x9971('0x4a')]?_0x5cfe67[_0x9971('0x3c')]:_0x32eb42[_0x9971('0x37')];if(!_0x191e80[_0x9971('0x38')][_0x9971('0x57')](_0x9971('0x3e'))){_0x5cfe67[_0x9971('0x21')]=qs[_0x9971('0x21')](_0x191e80['query'][_0x9971('0x21')]);_0x5cfe67[_0x9971('0x1f')]=qs[_0x9971('0x1f')](_0x191e80[_0x9971('0x38')][_0x9971('0x1f')]);}_0x5cfe67['order']=qs[_0x9971('0x40')](_0x191e80['query'][_0x9971('0x40')]);_0x5cfe67[_0x9971('0x41')]=qs[_0x9971('0x3a')](_['pick'](_0x191e80[_0x9971('0x38')],_0x32eb42['filters']));_0x5cfe67['where'][_0x9971('0x58')]=_0x32d670['id'];if(_0x191e80[_0x9971('0x38')][_0x9971('0x43')]){_0x5cfe67['where']=_[_0x9971('0x44')](_0x5cfe67[_0x9971('0x41')],{'$or':_[_0x9971('0x32')](_0x5cfe67[_0x9971('0x3c')],function(_0x3e31c5){var _0x2ca8d8={};_0x2ca8d8[_0x3e31c5]={'$like':'%'+_0x191e80[_0x9971('0x38')][_0x9971('0x43')]+'%'};return _0x2ca8d8;})});}_0x5cfe67=_[_0x9971('0x44')]({},_0x5cfe67,_0x191e80['options']);return db[_0x9971('0x59')][_0x9971('0x5a')](_0x5cfe67);}})['then'](function(_0x3aa9e1){if(_0x3aa9e1){return db[_0x9971('0x5b')][_0x9971('0x5c')]({'where':{'id':_[_0x9971('0x32')](_0x3aa9e1,'UserId'),'role':'agent'},'attributes':['id','name',_0x9971('0x5d'),'updatedAt',_0x9971('0x5e')]});}})[_0x9971('0x28')](function(_0x325e70){if(_0x325e70){return{'count':_0x325e70[_0x9971('0x22')],'rows':_[_0x9971('0x32')](_0x325e70[_0x9971('0x46')],function(_0x1b6c02){return{'membername':_0x1b6c02[_0x9971('0x2f')],'UserId':_0x1b6c02['id'],'queue_name':_0x4faf3a[_0x9971('0x2f')],'OpenchannelQueueId':_0x4faf3a['id'],'interface':util[_0x9971('0x5f')](_0x9971('0x60'),_0x9971('0x61'),_0x1b6c02[_0x9971('0x2f')]),'penalty':0x0,'paused':_0x1b6c02[_0x9971('0x5d')],'createdAt':_0x1b6c02['createdAt'],'updatedAt':_0x1b6c02['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9971('0x28')](respondWithFilteredResult(_0x76ca7b,_0x5cfe67))[_0x9971('0x47')](handleError(_0x76ca7b,null));};exports[_0x9971('0x62')]=function(_0x4006eb,_0x1b940b,_0x1f8dcd){var _0x68a49a={};var _0x5901ef={};var _0x2fad0e;var _0x4f89f2;return db[_0x9971('0x33')][_0x9971('0x56')]({'where':{'id':_0x4006eb['params']['id']}})[_0x9971('0x28')](handleEntityNotFound(_0x1b940b,null))[_0x9971('0x28')](function(_0x518388){if(_0x518388){_0x2fad0e=_0x518388;_0x5901ef[_0x9971('0x37')]=_[_0x9971('0x39')](db[_0x9971('0x63')][_0x9971('0x34')]);_0x5901ef[_0x9971('0x38')]=_[_0x9971('0x39')](_0x4006eb['query']);_0x5901ef[_0x9971('0x3a')]=_[_0x9971('0x3b')](_0x5901ef['model'],_0x5901ef[_0x9971('0x38')]);_0x68a49a[_0x9971('0x3c')]=_[_0x9971('0x3b')](_0x5901ef[_0x9971('0x37')],qs['fields'](_0x4006eb[_0x9971('0x38')]['fields']));_0x68a49a[_0x9971('0x3c')]=_0x68a49a[_0x9971('0x3c')]['length']?_0x68a49a[_0x9971('0x3c')]:_0x5901ef[_0x9971('0x37')];_0x68a49a[_0x9971('0x3f')]=qs['sort'](_0x4006eb[_0x9971('0x38')][_0x9971('0x40')]);_0x68a49a['where']=qs[_0x9971('0x3a')](_['pick'](_0x4006eb[_0x9971('0x38')],_0x5901ef[_0x9971('0x3a')]));if(_0x4006eb[_0x9971('0x38')][_0x9971('0x43')]){_0x68a49a[_0x9971('0x41')]=_['merge'](_0x68a49a[_0x9971('0x41')],{'$or':_['map'](_0x68a49a[_0x9971('0x3c')],function(_0x1683bb){var _0x5cc488={};_0x5cc488[_0x1683bb]={'$like':'%'+_0x4006eb['query'][_0x9971('0x43')]+'%'};return _0x5cc488;})});}_0x68a49a=_[_0x9971('0x44')]({},_0x68a49a,_0x4006eb[_0x9971('0x45')]);return _0x2fad0e[_0x9971('0x62')](_0x68a49a);}})[_0x9971('0x28')](function(_0x4df616){if(_0x4df616){_0x4f89f2=_0x4df616[_0x9971('0x4a')];if(!_0x4006eb['query'][_0x9971('0x57')](_0x9971('0x3e'))){_0x68a49a[_0x9971('0x21')]=qs[_0x9971('0x21')](_0x4006eb['query'][_0x9971('0x21')]);_0x68a49a[_0x9971('0x1f')]=qs[_0x9971('0x1f')](_0x4006eb[_0x9971('0x38')][_0x9971('0x1f')]);}return _0x2fad0e['getTeams'](_0x68a49a);}})[_0x9971('0x28')](function(_0x19c270){if(_0x19c270){return _0x19c270?{'count':_0x4f89f2,'rows':_0x19c270}:null;}})[_0x9971('0x28')](respondWithResult(_0x1b940b,null))['catch'](handleError(_0x1b940b,null));};exports['addTeams']=function(_0x5696e7,_0x557ea1,_0xd7f365){var _0x25532f=_0x5696e7[_0x9971('0x4e')][_0x9971('0x64')];return db[_0x9971('0x63')][_0x9971('0x5a')]({'where':{'id':_0x25532f},'attributes':['id'],'include':[{'model':db[_0x9971('0x5b')],'as':_0x9971('0x65'),'attributes':['id',_0x9971('0x2f'),_0x9971('0x66'),_0x9971('0x67'),_0x9971('0x68')],'raw':!![]}]})[_0x9971('0x28')](function(_0x3297e3){if(_0x3297e3){var _0x4a49fd=_[_0x9971('0x69')](_0x3297e3,function(_0x3f3469){var _0x369fe0=_0x3f3469[_0x9971('0x2a')]({'plain':!![]});return _0x369fe0[_0x9971('0x65')];});return db[_0x9971('0x33')]['find']({'where':{'id':_0x5696e7[_0x9971('0x49')]['id']}})['then'](function(_0x2e8d3f){return db[_0x9971('0x6a')]['transaction'](function(_0x4978d4){return _0x2e8d3f['addTeams'](_0x25532f,{'transaction':_0x4978d4})['then'](function(){return BPromise[_0x9971('0x6b')](_0x4a49fd,function(_0x35cbbf){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x35cbbf['id'],'OpenchannelQueueId':_0x5696e7[_0x9971('0x49')]['id']},'transaction':_0x4978d4});});})[_0x9971('0x28')](function(){_0x4a49fd[_0x9971('0x6c')](function(_0x1e3d3a){socket[_0x9971('0x6d')]('userOpenchannelQueue:save',{'UserId':_0x1e3d3a['id'],'OpenchannelQueueId':_0x2e8d3f['id']});});});});});}})['then'](respondWithStatusCode(_0x557ea1,null))[_0x9971('0x47')](handleError(_0x557ea1,null));};exports[_0x9971('0x6e')]=function(_0x1a47dd,_0x3a2554,_0x14b011){return db[_0x9971('0x63')][_0x9971('0x5a')]({'where':{'id':_0x1a47dd[_0x9971('0x38')][_0x9971('0x64')]},'attributes':['id'],'include':[{'model':db[_0x9971('0x5b')],'as':_0x9971('0x65'),'attributes':['id'],'raw':!![]}]})[_0x9971('0x28')](handleEntityNotFound(_0x3a2554,null))['then'](function(_0x131a74){var _0x48438d=_[_0x9971('0x32')](_0x131a74,'id');var _0x15f0de=[];var _0x371836=[];var _0xfb2de2=squel[_0x9971('0x6f')]();_0xfb2de2[_0x9971('0x70')]('tq.TeamId')[_0x9971('0x71')]('team_has_openchannel_queues','tq')[_0x9971('0x72')](_0x9971('0x73'),'ut',_0x9971('0x74'))[_0x9971('0x41')]('OpenchannelQueueId\x20=\x20?',_0x1a47dd['params']['id']);for(var _0x260ca6=0x0;_0x260ca6<_0x131a74[_0x9971('0x4a')];_0x260ca6+=0x1){let _0x8b413a=_0x131a74[_0x260ca6];for(var _0x40c3ac=0x0;_0x40c3ac<_0x8b413a[_0x9971('0x65')][_0x9971('0x4a')];_0x40c3ac+=0x1){let _0x32b7f8=_0x8b413a[_0x9971('0x65')][_0x40c3ac];var _0x51394b=_0xfb2de2['clone']();_0x51394b['where'](_0x9971('0x75'),_0x32b7f8['id']);_0x371836[_0x9971('0x76')](db[_0x9971('0x6a')][_0x9971('0x38')](_0x51394b[_0x9971('0x77')](),{'type':db['sequelize'][_0x9971('0x78')]['SELECT']})[_0x9971('0x28')](function(_0x256da1){if(_0x256da1['length']===0x1){return _0x32b7f8['id'];}else{var _0xc5360e=_[_0x9971('0x79')](_[_0x9971('0x32')](_0x256da1,'TeamId'),function(_0x5d1b8d){return _[_0x9971('0x7a')](_0x48438d,_0x5d1b8d);});if(_0xc5360e){return _0x32b7f8['id'];}}}));}}return BPromise[_0x9971('0x7b')](_0x371836)[_0x9971('0x28')](function(_0x5371cf){_0x15f0de=_(_0x15f0de)[_0x9971('0x7c')](_0x5371cf)[_0x9971('0x7d')]()[_0x9971('0x7e')]();return db[_0x9971('0x33')][_0x9971('0x4c')]({'where':{'id':_0x1a47dd[_0x9971('0x49')]['id']}})['then'](function(_0x500298){return db[_0x9971('0x6a')][_0x9971('0x7f')](function(_0x385706){return _0x500298[_0x9971('0x6e')](_0x1a47dd[_0x9971('0x38')][_0x9971('0x64')],{'transaction':_0x385706})[_0x9971('0x28')](function(){if(!_['isEmpty'](_0x15f0de)){return _0x500298[_0x9971('0x80')](_0x15f0de,{'transaction':_0x385706});}})[_0x9971('0x28')](function(){_0x15f0de[_0x9971('0x6c')](function(_0x17c0b7){socket[_0x9971('0x6d')](_0x9971('0x81'),{'UserId':_0x17c0b7,'OpenchannelQueueId':_0x500298['id']});});});});});});})['then'](respondWithStatusCode(_0x3a2554,null))['catch'](handleError(_0x3a2554,null));};exports[_0x9971('0x82')]=function(_0x242235,_0x4b84b5,_0x3fb5f5){return db[_0x9971('0x33')][_0x9971('0x4c')]({'where':{'id':_0x242235[_0x9971('0x49')]['id']}})[_0x9971('0x28')](handleEntityNotFound(_0x4b84b5,null))['then'](function(_0x20e8c9){if(_0x20e8c9){return _0x20e8c9['addAgents'](_0x242235[_0x9971('0x4e')][_0x9971('0x64')],_[_0x9971('0x83')](_0x242235['body'],[_0x9971('0x64'),'id'])||{})[_0x9971('0x84')](function(_0x254f50){for(var _0x12bbfa=0x0;_0x12bbfa<_0x242235['body'][_0x9971('0x64')][_0x9971('0x4a')];_0x12bbfa+=0x1){socket[_0x9971('0x6d')](_0x9971('0x85'),{'UserId':Number(_0x242235[_0x9971('0x4e')][_0x9971('0x64')][_0x12bbfa]),'OpenchannelQueueId':Number(_0x242235[_0x9971('0x49')]['id'])});}return _0x254f50;});}})[_0x9971('0x28')](respondWithResult(_0x4b84b5,null))[_0x9971('0x47')](handleError(_0x4b84b5,null));};exports[_0x9971('0x80')]=function(_0x18da8c,_0x15ece0,_0x20e088){return db['OpenchannelQueue'][_0x9971('0x4c')]({'where':{'id':_0x18da8c['params']['id']}})[_0x9971('0x28')](handleEntityNotFound(_0x15ece0,null))[_0x9971('0x28')](function(_0x45a171){if(_0x45a171){return _0x45a171[_0x9971('0x80')](_0x18da8c[_0x9971('0x38')][_0x9971('0x64')])[_0x9971('0x28')](function(){if(_[_0x9971('0x86')](_0x18da8c[_0x9971('0x38')][_0x9971('0x64')])){for(var _0x1c61ff=0x0;_0x1c61ff<_0x18da8c[_0x9971('0x38')][_0x9971('0x64')]['length'];_0x1c61ff+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x18da8c[_0x9971('0x38')][_0x9971('0x64')][_0x1c61ff]),'OpenchannelQueueId':Number(_0x18da8c['params']['id'])});}}else{socket[_0x9971('0x6d')](_0x9971('0x81'),{'UserId':Number(_0x18da8c[_0x9971('0x38')]['ids']),'OpenchannelQueueId':Number(_0x18da8c[_0x9971('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x15ece0,null))[_0x9971('0x47')](handleError(_0x15ece0,null));};exports[_0x9971('0x87')]=function(_0x381256,_0x2a2986,_0x22c3be){var _0x55ab1c={};var _0x433893={};var _0x3f3357;var _0x518a39;return db[_0x9971('0x33')][_0x9971('0x56')]({'where':{'id':_0x381256[_0x9971('0x49')]['id']}})[_0x9971('0x28')](handleEntityNotFound(_0x2a2986,null))['then'](function(_0x14efc3){if(_0x14efc3){_0x3f3357=_0x14efc3;_0x433893['model']=_['keys'](db[_0x9971('0x5b')][_0x9971('0x34')]);_0x433893[_0x9971('0x38')]=_[_0x9971('0x39')](_0x381256[_0x9971('0x38')]);_0x433893[_0x9971('0x3a')]=_['intersection'](_0x433893[_0x9971('0x37')],_0x433893[_0x9971('0x38')]);_0x55ab1c['attributes']=_['intersection'](_0x433893[_0x9971('0x37')],qs[_0x9971('0x3d')](_0x381256[_0x9971('0x38')][_0x9971('0x3d')]));_0x55ab1c[_0x9971('0x3c')]=_0x55ab1c['attributes'][_0x9971('0x4a')]?_0x55ab1c[_0x9971('0x3c')]:_0x433893[_0x9971('0x37')];_0x55ab1c['order']=qs[_0x9971('0x40')](_0x381256[_0x9971('0x38')]['sort']);_0x55ab1c['where']=qs[_0x9971('0x3a')](_[_0x9971('0x42')](_0x381256[_0x9971('0x38')],_0x433893['filters']));if(_0x381256[_0x9971('0x38')][_0x9971('0x43')]){_0x55ab1c['where']=_[_0x9971('0x44')](_0x55ab1c['where'],{'$or':_[_0x9971('0x32')](_0x55ab1c['attributes'],function(_0x1b855f){var _0x5ce23a={};_0x5ce23a[_0x1b855f]={'$like':'%'+_0x381256[_0x9971('0x38')][_0x9971('0x43')]+'%'};return _0x5ce23a;})});}_0x55ab1c=_[_0x9971('0x44')]({},_0x55ab1c,_0x381256[_0x9971('0x45')]);return _0x3f3357[_0x9971('0x87')](_0x55ab1c);}})[_0x9971('0x28')](function(_0x108c32){if(_0x108c32){_0x518a39=_0x108c32[_0x9971('0x4a')];if(!_0x381256['query'][_0x9971('0x57')]('nolimit')){_0x55ab1c[_0x9971('0x21')]=qs[_0x9971('0x21')](_0x381256[_0x9971('0x38')][_0x9971('0x21')]);_0x55ab1c[_0x9971('0x1f')]=qs['offset'](_0x381256[_0x9971('0x38')][_0x9971('0x1f')]);}return _0x3f3357[_0x9971('0x87')](_0x55ab1c);}})[_0x9971('0x28')](function(_0x455e7a){if(_0x455e7a){return _0x455e7a?{'count':_0x518a39,'rows':_0x455e7a}:null;}})[_0x9971('0x28')](respondWithResult(_0x2a2986,null))[_0x9971('0x47')](handleError(_0x2a2986,null));}; \ No newline at end of file +var _0x2222=['push','sequelize','toString','SELECT','every','TeamId','includes','all','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','OpenchannelQueue','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','online','voicePause','interface','Agents','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x2222,0x128));var _0x2222=function(_0x4f06ac,_0x1b73e1){_0x4f06ac=_0x4f06ac-0x0;var _0x12618f=_0x2222[_0x4f06ac];return _0x12618f;};'use strict';var emlformat=require(_0x2222('0x0'));var rimraf=require(_0x2222('0x1'));var zipdir=require(_0x2222('0x2'));var jsonpatch=require(_0x2222('0x3'));var rp=require(_0x2222('0x4'));var moment=require(_0x2222('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2222('0x6'));var util=require('util');var path=require(_0x2222('0x7'));var sox=require(_0x2222('0x8'));var csv=require('to-csv');var ejs=require(_0x2222('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2222('0xa'));var crypto=require(_0x2222('0xb'));var jsforce=require(_0x2222('0xc'));var deskjs=require(_0x2222('0xd'));var toCsv=require(_0x2222('0xe'));var querystring=require('querystring');var Papa=require(_0x2222('0xf'));var Redis=require(_0x2222('0x10'));var authService=require(_0x2222('0x11'));var qs=require(_0x2222('0x12'));var as=require(_0x2222('0x13'));var hardwareService=require(_0x2222('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2222('0x15'));var config=require(_0x2222('0x16'));var licenseUtil=require(_0x2222('0x17'));var db=require(_0x2222('0x18'))['db'];config['redis']=_[_0x2222('0x19')](config[_0x2222('0x1a')],{'host':_0x2222('0x1b'),'port':0x18eb});var socket=require(_0x2222('0x1c'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x4176a7,_0x36d220){_0x36d220=_0x36d220||0xcc;return function(_0x24f669){if(_0x24f669){return _0x4176a7[_0x2222('0x1d')](_0x36d220);}return _0x4176a7[_0x2222('0x1e')](_0x36d220)[_0x2222('0x1f')]();};}function respondWithResult(_0x2cf385,_0x1eb430){_0x1eb430=_0x1eb430||0xc8;return function(_0x36d08e){if(_0x36d08e){return _0x2cf385['status'](_0x1eb430)[_0x2222('0x20')](_0x36d08e);}};}function respondWithFilteredResult(_0x139785,_0xecb589){return function(_0x4153ad){if(_0x4153ad){var _0x39b9ea=typeof _0xecb589[_0x2222('0x21')]===_0x2222('0x22')&&typeof _0xecb589[_0x2222('0x23')]===_0x2222('0x22');var _0x1ff6dc=_0x4153ad[_0x2222('0x24')];var _0x50c32b=_0x39b9ea?0x0:_0xecb589[_0x2222('0x21')];var _0xdd7232=_0x39b9ea?_0x4153ad[_0x2222('0x24')]:_0xecb589[_0x2222('0x21')]+_0xecb589['limit'];var _0x1bd230;if(_0xdd7232>=_0x1ff6dc){_0xdd7232=_0x1ff6dc;_0x1bd230=0xc8;}else{_0x1bd230=0xce;}_0x139785[_0x2222('0x1e')](_0x1bd230);return _0x139785[_0x2222('0x25')](_0x2222('0x26'),_0x50c32b+'-'+_0xdd7232+'/'+_0x1ff6dc)[_0x2222('0x20')](_0x4153ad);}return null;};}function patchUpdates(_0x148978){return function(_0x469004){try{jsonpatch[_0x2222('0x27')](_0x469004,_0x148978,!![]);}catch(_0x9fe3dd){return BPromise['reject'](_0x9fe3dd);}return _0x469004[_0x2222('0x28')]();};}function saveUpdates(_0xa9749,_0x962828){return function(_0x16ecab){if(_0x16ecab){return _0x16ecab[_0x2222('0x29')](_0xa9749)['then'](function(_0xb4aafa){return _0xb4aafa;});}return null;};}function removeEntity(_0x2a4b6c,_0x49d4f0){return function(_0x5c9c5e){if(_0x5c9c5e){return _0x5c9c5e[_0x2222('0x2a')]()[_0x2222('0x2b')](function(){var _0x522a72=_0x5c9c5e[_0x2222('0x2c')]({'plain':!![]});var _0xdecce4=_0x2222('0x2d');return db[_0x2222('0x2e')][_0x2222('0x2a')]({'where':{'type':_0xdecce4,'resourceId':_0x522a72['id']}})[_0x2222('0x2b')](function(){return _0x5c9c5e;});})[_0x2222('0x2b')](function(){_0x2a4b6c['status'](0xcc)[_0x2222('0x1f')]();});}};}function handleEntityNotFound(_0x1f80b3,_0x5567b4){return function(_0x440bbc){if(!_0x440bbc){_0x1f80b3[_0x2222('0x1d')](0x194);}return _0x440bbc;};}function handleError(_0x580dee,_0x503866){_0x503866=_0x503866||0x1f4;return function(_0x217ae4){logger['error'](_0x217ae4[_0x2222('0x2f')]);if(_0x217ae4[_0x2222('0x30')]){delete _0x217ae4[_0x2222('0x30')];}_0x580dee[_0x2222('0x1e')](_0x503866)[_0x2222('0x31')](_0x217ae4);};}exports[_0x2222('0x32')]=function(_0x358be5,_0x1185c2){var _0xd356ed={},_0x146d63={},_0x2c7919={'count':0x0,'rows':[]};var _0x1a3d93=_['map'](db[_0x2222('0x33')][_0x2222('0x34')],function(_0x2678fa){return{'name':_0x2678fa['fieldName'],'type':_0x2678fa[_0x2222('0x35')][_0x2222('0x36')]};});_0x146d63[_0x2222('0x37')]=_[_0x2222('0x38')](_0x1a3d93,'name');_0x146d63[_0x2222('0x39')]=_[_0x2222('0x3a')](_0x358be5[_0x2222('0x39')]);_0x146d63[_0x2222('0x3b')]=_[_0x2222('0x3c')](_0x146d63['model'],_0x146d63[_0x2222('0x39')]);_0xd356ed[_0x2222('0x3d')]=_[_0x2222('0x3c')](_0x146d63[_0x2222('0x37')],qs[_0x2222('0x3e')](_0x358be5['query'][_0x2222('0x3e')]));_0xd356ed[_0x2222('0x3d')]=_0xd356ed['attributes'][_0x2222('0x3f')]?_0xd356ed[_0x2222('0x3d')]:_0x146d63[_0x2222('0x37')];if(!_0x358be5[_0x2222('0x39')][_0x2222('0x40')](_0x2222('0x41'))){_0xd356ed['limit']=qs[_0x2222('0x23')](_0x358be5[_0x2222('0x39')][_0x2222('0x23')]);_0xd356ed[_0x2222('0x21')]=qs[_0x2222('0x21')](_0x358be5[_0x2222('0x39')][_0x2222('0x21')]);}_0xd356ed[_0x2222('0x42')]=qs[_0x2222('0x43')](_0x358be5[_0x2222('0x39')][_0x2222('0x43')]);_0xd356ed[_0x2222('0x44')]=qs[_0x2222('0x3b')](_[_0x2222('0x45')](_0x358be5[_0x2222('0x39')],_0x146d63[_0x2222('0x3b')]),_0x1a3d93);if(_0x358be5[_0x2222('0x39')][_0x2222('0x46')]){_0xd356ed[_0x2222('0x44')]=_[_0x2222('0x47')](_0xd356ed[_0x2222('0x44')],{'$or':_[_0x2222('0x38')](_0x1a3d93,function(_0x4e848a){if(_0x4e848a['type']!==_0x2222('0x48')){var _0x487c5b={};_0x487c5b[_0x4e848a[_0x2222('0x30')]]={'$like':'%'+_0x358be5[_0x2222('0x39')][_0x2222('0x46')]+'%'};return _0x487c5b;}})});}_0xd356ed=_[_0x2222('0x47')]({},_0xd356ed,_0x358be5[_0x2222('0x49')]);var _0x231e51={'where':_0xd356ed[_0x2222('0x44')]};return db[_0x2222('0x33')][_0x2222('0x24')](_0x231e51)['then'](function(_0x2b8906){_0x2c7919[_0x2222('0x24')]=_0x2b8906;if(_0x358be5[_0x2222('0x39')]['includeAll']){_0xd356ed[_0x2222('0x4a')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0xd356ed);})[_0x2222('0x2b')](function(_0x5a538b){_0x2c7919[_0x2222('0x4b')]=_0x5a538b;return _0x2c7919;})[_0x2222('0x2b')](respondWithFilteredResult(_0x1185c2,_0xd356ed))[_0x2222('0x4c')](handleError(_0x1185c2,null));};exports[_0x2222('0x4d')]=function(_0x1c95a4,_0x2469ad){var _0x4387ad={'raw':!![],'where':{'id':_0x1c95a4[_0x2222('0x4e')]['id']}},_0x100bfd={};_0x100bfd['model']=_[_0x2222('0x3a')](db['OpenchannelQueue'][_0x2222('0x34')]);_0x100bfd[_0x2222('0x39')]=_[_0x2222('0x3a')](_0x1c95a4[_0x2222('0x39')]);_0x100bfd[_0x2222('0x3b')]=_['intersection'](_0x100bfd[_0x2222('0x37')],_0x100bfd[_0x2222('0x39')]);_0x4387ad[_0x2222('0x3d')]=_['intersection'](_0x100bfd[_0x2222('0x37')],qs[_0x2222('0x3e')](_0x1c95a4[_0x2222('0x39')][_0x2222('0x3e')]));_0x4387ad['attributes']=_0x4387ad[_0x2222('0x3d')][_0x2222('0x3f')]?_0x4387ad[_0x2222('0x3d')]:_0x100bfd['model'];if(_0x1c95a4['query'][_0x2222('0x4f')]){_0x4387ad['include']=[{'all':!![]}];}_0x4387ad=_[_0x2222('0x47')]({},_0x4387ad,_0x1c95a4[_0x2222('0x49')]);return db['OpenchannelQueue'][_0x2222('0x50')](_0x4387ad)[_0x2222('0x2b')](handleEntityNotFound(_0x2469ad,null))[_0x2222('0x2b')](respondWithResult(_0x2469ad,null))[_0x2222('0x4c')](handleError(_0x2469ad,null));};exports['create']=function(_0x446b7c,_0x5e69aa){return db['OpenchannelQueue'][_0x2222('0x51')](_0x446b7c['body'],{})['then'](function(_0x53a61b){var _0x244c08=_0x446b7c['user']['get']({'plain':!![]});if(!_0x244c08)throw new Error(_0x2222('0x52'));if(_0x244c08[_0x2222('0x53')]==='user'){var _0x10043a=_0x53a61b[_0x2222('0x2c')]({'plain':!![]});var _0x1cb3bb='OpenchannelQueues';return db['UserProfileSection']['find']({'where':{'name':_0x1cb3bb,'userProfileId':_0x244c08['userProfileId']},'raw':!![]})[_0x2222('0x2b')](function(_0x4144a6){if(_0x4144a6&&_0x4144a6[_0x2222('0x54')]===0x0){return db[_0x2222('0x2e')][_0x2222('0x51')]({'name':_0x10043a[_0x2222('0x30')],'resourceId':_0x10043a['id'],'type':_0x4144a6[_0x2222('0x30')],'sectionId':_0x4144a6['id']},{})[_0x2222('0x2b')](function(){return _0x53a61b;});}else{return _0x53a61b;}})[_0x2222('0x4c')](function(_0xc5afcb){logger[_0x2222('0x55')](_0x2222('0x56'),_0xc5afcb);throw _0xc5afcb;});}return _0x53a61b;})['then'](respondWithResult(_0x5e69aa,0xc9))[_0x2222('0x4c')](handleError(_0x5e69aa,null));};exports['update']=function(_0x1f6ab3,_0x320736){if(_0x1f6ab3['body']['id']){delete _0x1f6ab3['body']['id'];}return db[_0x2222('0x33')][_0x2222('0x50')]({'where':{'id':_0x1f6ab3[_0x2222('0x4e')]['id']}})[_0x2222('0x2b')](handleEntityNotFound(_0x320736,null))[_0x2222('0x2b')](saveUpdates(_0x1f6ab3[_0x2222('0x57')],null))[_0x2222('0x2b')](respondWithResult(_0x320736,null))[_0x2222('0x4c')](handleError(_0x320736,null));};exports[_0x2222('0x2a')]=function(_0xe92369,_0x5ca977){return db[_0x2222('0x33')][_0x2222('0x50')]({'where':{'id':_0xe92369['params']['id']}})[_0x2222('0x2b')](handleEntityNotFound(_0x5ca977,null))['then'](removeEntity(_0x5ca977,null))['catch'](handleError(_0x5ca977,null));};exports[_0x2222('0x58')]=function(_0x21ac72,_0x4c627e){return db[_0x2222('0x33')]['describe']()[_0x2222('0x2b')](respondWithResult(_0x4c627e,null))[_0x2222('0x4c')](handleError(_0x4c627e,null));};exports[_0x2222('0x59')]=function(_0x2173b5,_0x14b89f,_0x5b9700){var _0x4c0b8e={'raw':!![],'where':{}},_0x3c9ebd={},_0x349151;return db[_0x2222('0x33')][_0x2222('0x5a')]({'where':{'id':_0x2173b5[_0x2222('0x4e')]['id']}})[_0x2222('0x2b')](handleEntityNotFound(_0x14b89f,null))[_0x2222('0x2b')](function(_0x55cc5b){if(_0x55cc5b){_0x349151=_0x55cc5b['get']({'plain':!![]});_0x3c9ebd[_0x2222('0x37')]=_[_0x2222('0x3a')](db[_0x2222('0x5b')][_0x2222('0x34')]);_0x3c9ebd[_0x2222('0x39')]=_[_0x2222('0x3a')](_0x2173b5[_0x2222('0x39')]);_0x3c9ebd[_0x2222('0x3b')]=_[_0x2222('0x3c')](_0x3c9ebd[_0x2222('0x37')],_0x3c9ebd['query']);_0x4c0b8e[_0x2222('0x3d')]=_[_0x2222('0x3c')](_0x3c9ebd[_0x2222('0x37')],qs['fields'](_0x2173b5[_0x2222('0x39')][_0x2222('0x3e')]));_0x4c0b8e['attributes']=_0x4c0b8e[_0x2222('0x3d')][_0x2222('0x3f')]?_0x4c0b8e[_0x2222('0x3d')]:_0x3c9ebd['model'];if(!_0x2173b5[_0x2222('0x39')][_0x2222('0x40')](_0x2222('0x41'))){_0x4c0b8e[_0x2222('0x23')]=qs[_0x2222('0x23')](_0x2173b5[_0x2222('0x39')][_0x2222('0x23')]);_0x4c0b8e[_0x2222('0x21')]=qs['offset'](_0x2173b5[_0x2222('0x39')][_0x2222('0x21')]);}_0x4c0b8e['order']=qs[_0x2222('0x43')](_0x2173b5[_0x2222('0x39')]['sort']);_0x4c0b8e[_0x2222('0x44')]=qs['filters'](_['pick'](_0x2173b5[_0x2222('0x39')],_0x3c9ebd[_0x2222('0x3b')]));_0x4c0b8e['where']['OpenchannelQueueId']=_0x55cc5b['id'];if(_0x2173b5[_0x2222('0x39')][_0x2222('0x46')]){_0x4c0b8e[_0x2222('0x44')]=_[_0x2222('0x47')](_0x4c0b8e[_0x2222('0x44')],{'$or':_['map'](_0x4c0b8e[_0x2222('0x3d')],function(_0x37612b){var _0x3dfc24={};_0x3dfc24[_0x37612b]={'$like':'%'+_0x2173b5[_0x2222('0x39')][_0x2222('0x46')]+'%'};return _0x3dfc24;})});}_0x4c0b8e=_[_0x2222('0x47')]({},_0x4c0b8e,_0x2173b5[_0x2222('0x49')]);return db['UserOpenchannelQueue'][_0x2222('0x5c')](_0x4c0b8e);}})[_0x2222('0x2b')](function(_0x3ed34d){if(_0x3ed34d){return db[_0x2222('0x5d')][_0x2222('0x5e')]({'where':{'id':_[_0x2222('0x38')](_0x3ed34d,_0x2222('0x5f')),'role':_0x2222('0x60')},'attributes':['id','name',_0x2222('0x61'),_0x2222('0x62'),_0x2222('0x63')]});}})[_0x2222('0x2b')](function(_0x227cf2){if(_0x227cf2){return{'count':_0x227cf2[_0x2222('0x24')],'rows':_[_0x2222('0x38')](_0x227cf2[_0x2222('0x4b')],function(_0x559140){return{'membername':_0x559140[_0x2222('0x30')],'UserId':_0x559140['id'],'queue_name':_0x349151[_0x2222('0x30')],'OpenchannelQueueId':_0x349151['id'],'interface':util[_0x2222('0x64')](_0x2222('0x65'),_0x2222('0x66'),_0x559140[_0x2222('0x30')]),'penalty':0x0,'paused':_0x559140[_0x2222('0x61')],'createdAt':_0x559140[_0x2222('0x63')],'updatedAt':_0x559140[_0x2222('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14b89f,_0x4c0b8e))[_0x2222('0x4c')](handleError(_0x14b89f,null));};exports[_0x2222('0x67')]=function(_0x20ef20,_0x147606,_0x530414){var _0xe899bd={};var _0x3979c3={};var _0x43867c;var _0x3becae;return db[_0x2222('0x33')]['findOne']({'where':{'id':_0x20ef20['params']['id']}})[_0x2222('0x2b')](handleEntityNotFound(_0x147606,null))[_0x2222('0x2b')](function(_0x3c1873){if(_0x3c1873){_0x43867c=_0x3c1873;_0x3979c3['model']=_[_0x2222('0x3a')](db[_0x2222('0x68')][_0x2222('0x34')]);_0x3979c3[_0x2222('0x39')]=_[_0x2222('0x3a')](_0x20ef20[_0x2222('0x39')]);_0x3979c3[_0x2222('0x3b')]=_[_0x2222('0x3c')](_0x3979c3[_0x2222('0x37')],_0x3979c3[_0x2222('0x39')]);_0xe899bd['attributes']=_[_0x2222('0x3c')](_0x3979c3[_0x2222('0x37')],qs['fields'](_0x20ef20[_0x2222('0x39')][_0x2222('0x3e')]));_0xe899bd['attributes']=_0xe899bd['attributes'][_0x2222('0x3f')]?_0xe899bd[_0x2222('0x3d')]:_0x3979c3[_0x2222('0x37')];_0xe899bd['order']=qs[_0x2222('0x43')](_0x20ef20['query']['sort']);_0xe899bd[_0x2222('0x44')]=qs[_0x2222('0x3b')](_['pick'](_0x20ef20[_0x2222('0x39')],_0x3979c3['filters']));if(_0x20ef20['query'][_0x2222('0x46')]){_0xe899bd[_0x2222('0x44')]=_['merge'](_0xe899bd[_0x2222('0x44')],{'$or':_[_0x2222('0x38')](_0xe899bd[_0x2222('0x3d')],function(_0x5d1cd8){var _0x65db82={};_0x65db82[_0x5d1cd8]={'$like':'%'+_0x20ef20[_0x2222('0x39')]['filter']+'%'};return _0x65db82;})});}_0xe899bd=_['merge']({},_0xe899bd,_0x20ef20[_0x2222('0x49')]);return _0x43867c['getTeams'](_0xe899bd);}})[_0x2222('0x2b')](function(_0x462c33){if(_0x462c33){_0x3becae=_0x462c33['length'];if(!_0x20ef20[_0x2222('0x39')][_0x2222('0x40')](_0x2222('0x41'))){_0xe899bd['limit']=qs[_0x2222('0x23')](_0x20ef20[_0x2222('0x39')][_0x2222('0x23')]);_0xe899bd[_0x2222('0x21')]=qs[_0x2222('0x21')](_0x20ef20[_0x2222('0x39')][_0x2222('0x21')]);}return _0x43867c[_0x2222('0x67')](_0xe899bd);}})[_0x2222('0x2b')](function(_0x5a5482){if(_0x5a5482){return _0x5a5482?{'count':_0x3becae,'rows':_0x5a5482}:null;}})[_0x2222('0x2b')](respondWithResult(_0x147606,null))['catch'](handleError(_0x147606,null));};exports[_0x2222('0x69')]=function(_0x1dd43a,_0x34c50d,_0x3d9cf2){var _0x2caa0c=_0x1dd43a[_0x2222('0x57')]['ids'];return db[_0x2222('0x68')][_0x2222('0x5c')]({'where':{'id':_0x2caa0c},'attributes':['id'],'include':[{'model':db[_0x2222('0x5d')],'as':'Agents','attributes':['id',_0x2222('0x30'),_0x2222('0x6a'),_0x2222('0x6b'),_0x2222('0x6c')],'raw':!![]}]})[_0x2222('0x2b')](function(_0x4ae7e8){if(_0x4ae7e8){var _0x48600b=_['flatMap'](_0x4ae7e8,function(_0x1da4fc){var _0x17af63=_0x1da4fc['get']({'plain':!![]});return _0x17af63[_0x2222('0x6d')];});return db[_0x2222('0x33')][_0x2222('0x50')]({'where':{'id':_0x1dd43a[_0x2222('0x4e')]['id']}})[_0x2222('0x2b')](function(_0x4603b3){return db['sequelize'][_0x2222('0x6e')](function(_0x3e1fdd){return _0x4603b3[_0x2222('0x69')](_0x2caa0c,{'transaction':_0x3e1fdd})['then'](function(){return BPromise[_0x2222('0x6f')](_0x48600b,function(_0x40167){return db[_0x2222('0x5b')]['findOrCreate']({'where':{'UserId':_0x40167['id'],'OpenchannelQueueId':_0x1dd43a[_0x2222('0x4e')]['id']},'transaction':_0x3e1fdd});});})[_0x2222('0x2b')](function(){_0x48600b[_0x2222('0x70')](function(_0xe1b268){socket[_0x2222('0x71')](_0x2222('0x72'),{'UserId':_0xe1b268['id'],'OpenchannelQueueId':_0x4603b3['id']});});});});});}})[_0x2222('0x2b')](respondWithStatusCode(_0x34c50d,null))[_0x2222('0x4c')](handleError(_0x34c50d,null));};exports[_0x2222('0x73')]=function(_0x323d9a,_0x5cb66b,_0x334be7){return db[_0x2222('0x68')][_0x2222('0x5c')]({'where':{'id':_0x323d9a['query'][_0x2222('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2222('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5cb66b,null))[_0x2222('0x2b')](function(_0x8d55a1){var _0x3e6744=_[_0x2222('0x38')](_0x8d55a1,'id');var _0x59bca1=[];var _0x2b5116=[];var _0x36cee4=squel[_0x2222('0x75')]();_0x36cee4[_0x2222('0x76')]('tq.TeamId')['from']('team_has_openchannel_queues','tq')[_0x2222('0x77')](_0x2222('0x78'),'ut',_0x2222('0x79'))[_0x2222('0x44')](_0x2222('0x7a'),_0x323d9a[_0x2222('0x4e')]['id']);for(var _0x870252=0x0;_0x870252<_0x8d55a1[_0x2222('0x3f')];_0x870252+=0x1){let _0x152cb2=_0x8d55a1[_0x870252];for(var _0x70ac04=0x0;_0x70ac04<_0x152cb2[_0x2222('0x6d')]['length'];_0x70ac04+=0x1){let _0x3a3f19=_0x152cb2[_0x2222('0x6d')][_0x70ac04];var _0x4efcbd=_0x36cee4[_0x2222('0x7b')]();_0x4efcbd[_0x2222('0x44')]('ut.UserId\x20=\x20?',_0x3a3f19['id']);_0x2b5116[_0x2222('0x7c')](db[_0x2222('0x7d')][_0x2222('0x39')](_0x4efcbd[_0x2222('0x7e')](),{'type':db['sequelize']['QueryTypes'][_0x2222('0x7f')]})['then'](function(_0x389cde){if(_0x389cde[_0x2222('0x3f')]===0x1){return _0x3a3f19['id'];}else{var _0x13e8c6=_[_0x2222('0x80')](_[_0x2222('0x38')](_0x389cde,_0x2222('0x81')),function(_0x45e091){return _[_0x2222('0x82')](_0x3e6744,_0x45e091);});if(_0x13e8c6){return _0x3a3f19['id'];}}}));}}return BPromise[_0x2222('0x83')](_0x2b5116)[_0x2222('0x2b')](function(_0x1ff394){_0x59bca1=_(_0x59bca1)['union'](_0x1ff394)['compact']()['value']();return db[_0x2222('0x33')][_0x2222('0x50')]({'where':{'id':_0x323d9a[_0x2222('0x4e')]['id']}})[_0x2222('0x2b')](function(_0x201e7a){return db[_0x2222('0x7d')][_0x2222('0x6e')](function(_0x2141cb){return _0x201e7a[_0x2222('0x73')](_0x323d9a[_0x2222('0x39')][_0x2222('0x74')],{'transaction':_0x2141cb})[_0x2222('0x2b')](function(){if(!_[_0x2222('0x84')](_0x59bca1)){return _0x201e7a[_0x2222('0x85')](_0x59bca1,{'transaction':_0x2141cb});}})[_0x2222('0x2b')](function(){_0x59bca1['forEach'](function(_0x4ad7e6){socket[_0x2222('0x71')](_0x2222('0x86'),{'UserId':_0x4ad7e6,'OpenchannelQueueId':_0x201e7a['id']});});});});});});})[_0x2222('0x2b')](respondWithStatusCode(_0x5cb66b,null))[_0x2222('0x4c')](handleError(_0x5cb66b,null));};exports['addAgents']=function(_0x569fda,_0x64073f,_0x2f14cd){return db[_0x2222('0x33')][_0x2222('0x50')]({'where':{'id':_0x569fda[_0x2222('0x4e')]['id']}})['then'](handleEntityNotFound(_0x64073f,null))[_0x2222('0x2b')](function(_0x243ed8){if(_0x243ed8){return _0x243ed8[_0x2222('0x87')](_0x569fda[_0x2222('0x57')][_0x2222('0x74')],_[_0x2222('0x88')](_0x569fda[_0x2222('0x57')],['ids','id'])||{})[_0x2222('0x89')](function(_0x5af970){for(var _0x4f4995=0x0;_0x4f4995<_0x569fda[_0x2222('0x57')]['ids']['length'];_0x4f4995+=0x1){socket[_0x2222('0x71')](_0x2222('0x72'),{'UserId':Number(_0x569fda['body'][_0x2222('0x74')][_0x4f4995]),'OpenchannelQueueId':Number(_0x569fda[_0x2222('0x4e')]['id'])});}return _0x5af970;});}})[_0x2222('0x2b')](respondWithResult(_0x64073f,null))['catch'](handleError(_0x64073f,null));};exports['removeAgents']=function(_0x2c6079,_0x4f4f62,_0x56b9b0){return db[_0x2222('0x33')]['find']({'where':{'id':_0x2c6079[_0x2222('0x4e')]['id']}})[_0x2222('0x2b')](handleEntityNotFound(_0x4f4f62,null))[_0x2222('0x2b')](function(_0x57114b){if(_0x57114b){return _0x57114b[_0x2222('0x85')](_0x2c6079[_0x2222('0x39')][_0x2222('0x74')])[_0x2222('0x2b')](function(){if(_[_0x2222('0x8a')](_0x2c6079[_0x2222('0x39')]['ids'])){for(var _0x17d24d=0x0;_0x17d24d<_0x2c6079[_0x2222('0x39')]['ids'][_0x2222('0x3f')];_0x17d24d+=0x1){socket[_0x2222('0x71')](_0x2222('0x86'),{'UserId':Number(_0x2c6079[_0x2222('0x39')][_0x2222('0x74')][_0x17d24d]),'OpenchannelQueueId':Number(_0x2c6079['params']['id'])});}}else{socket[_0x2222('0x71')](_0x2222('0x86'),{'UserId':Number(_0x2c6079[_0x2222('0x39')][_0x2222('0x74')]),'OpenchannelQueueId':Number(_0x2c6079[_0x2222('0x4e')]['id'])});}});}})[_0x2222('0x2b')](respondWithStatusCode(_0x4f4f62,null))[_0x2222('0x4c')](handleError(_0x4f4f62,null));};exports[_0x2222('0x8b')]=function(_0x1b008b,_0x10fe29,_0x3ad984){var _0x343957={};var _0x22bef5={};var _0x26f8b5;var _0x2b9175;return db[_0x2222('0x33')][_0x2222('0x5a')]({'where':{'id':_0x1b008b[_0x2222('0x4e')]['id']}})[_0x2222('0x2b')](handleEntityNotFound(_0x10fe29,null))[_0x2222('0x2b')](function(_0x177996){if(_0x177996){_0x26f8b5=_0x177996;_0x22bef5[_0x2222('0x37')]=_[_0x2222('0x3a')](db['User']['rawAttributes']);_0x22bef5[_0x2222('0x39')]=_[_0x2222('0x3a')](_0x1b008b[_0x2222('0x39')]);_0x22bef5['filters']=_['intersection'](_0x22bef5[_0x2222('0x37')],_0x22bef5[_0x2222('0x39')]);_0x343957[_0x2222('0x3d')]=_['intersection'](_0x22bef5[_0x2222('0x37')],qs[_0x2222('0x3e')](_0x1b008b['query'][_0x2222('0x3e')]));_0x343957[_0x2222('0x3d')]=_0x343957[_0x2222('0x3d')][_0x2222('0x3f')]?_0x343957['attributes']:_0x22bef5[_0x2222('0x37')];_0x343957[_0x2222('0x42')]=qs[_0x2222('0x43')](_0x1b008b[_0x2222('0x39')][_0x2222('0x43')]);_0x343957[_0x2222('0x44')]=qs[_0x2222('0x3b')](_[_0x2222('0x45')](_0x1b008b['query'],_0x22bef5[_0x2222('0x3b')]));if(_0x1b008b[_0x2222('0x39')]['filter']){_0x343957[_0x2222('0x44')]=_['merge'](_0x343957['where'],{'$or':_[_0x2222('0x38')](_0x343957[_0x2222('0x3d')],function(_0x3377ef){var _0x1dacd0={};_0x1dacd0[_0x3377ef]={'$like':'%'+_0x1b008b[_0x2222('0x39')][_0x2222('0x46')]+'%'};return _0x1dacd0;})});}_0x343957=_['merge']({},_0x343957,_0x1b008b[_0x2222('0x49')]);return _0x26f8b5[_0x2222('0x8b')](_0x343957);}})[_0x2222('0x2b')](function(_0x459539){if(_0x459539){_0x2b9175=_0x459539[_0x2222('0x3f')];if(!_0x1b008b[_0x2222('0x39')][_0x2222('0x40')](_0x2222('0x41'))){_0x343957[_0x2222('0x23')]=qs['limit'](_0x1b008b[_0x2222('0x39')][_0x2222('0x23')]);_0x343957['offset']=qs[_0x2222('0x21')](_0x1b008b[_0x2222('0x39')][_0x2222('0x21')]);}return _0x26f8b5[_0x2222('0x8b')](_0x343957);}})['then'](function(_0x491c47){if(_0x491c47){return _0x491c47?{'count':_0x2b9175,'rows':_0x491c47}:null;}})[_0x2222('0x2b')](respondWithResult(_0x10fe29,null))[_0x2222('0x4c')](handleError(_0x10fe29,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ba714a9..183c30d 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 _0x8b50=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x5fecb1,_0x483d11){var _0x31e083=function(_0x129d10){while(--_0x129d10){_0x5fecb1['push'](_0x5fecb1['shift']());}};_0x31e083(++_0x483d11);}(_0x8b50,0x165));var _0x08b5=function(_0x1b6a14,_0x4d71b4){_0x1b6a14=_0x1b6a14-0x0;var _0x32848e=_0x8b50[_0x1b6a14];return _0x32848e;};'use strict';var EventEmitter=require(_0x08b5('0x0'));var OpenchannelQueue=require(_0x08b5('0x1'))['db'][_0x08b5('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x08b5('0x3')](0x0);var events={'afterCreate':_0x08b5('0x4'),'afterUpdate':_0x08b5('0x5'),'afterDestroy':_0x08b5('0x6')};function emitEvent(_0x1cafec){return function(_0x32174f,_0x89c234,_0x5c927e){OpenchannelQueueEvents['emit'](_0x1cafec+':'+_0x32174f['id'],_0x32174f);OpenchannelQueueEvents[_0x08b5('0x7')](_0x1cafec,_0x32174f);_0x5c927e(null);};}for(var e in events){if(events[_0x08b5('0x8')](e)){var event=events[e];OpenchannelQueue[_0x08b5('0x9')](e,emitEvent(event));}}module[_0x08b5('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x21c1=['update','remove','emit','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x37eca7,_0x3e016e){var _0x222bce=function(_0xebd0b7){while(--_0xebd0b7){_0x37eca7['push'](_0x37eca7['shift']());}};_0x222bce(++_0x3e016e);}(_0x21c1,0x185));var _0x121c=function(_0x15cf2d,_0x4c292e){_0x15cf2d=_0x15cf2d-0x0;var _0x3dd84b=_0x21c1[_0x15cf2d];return _0x3dd84b;};'use strict';var EventEmitter=require(_0x121c('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x121c('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x121c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x121c('0x3'),'afterDestroy':_0x121c('0x4')};function emitEvent(_0x3143b8){return function(_0x2da26c,_0x4b9855,_0x5426fc){OpenchannelQueueEvents[_0x121c('0x5')](_0x3143b8+':'+_0x2da26c['id'],_0x2da26c);OpenchannelQueueEvents[_0x121c('0x5')](_0x3143b8,_0x2da26c);_0x5426fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x121c('0x6')](e,emitEvent(event));}}module[_0x121c('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 19a6be0..13a1ab4 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 _0x6455=['exports','define','openchannel_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6455,0x1cb));var _0x5645=function(_0x591331,_0xa538a3){_0x591331=_0x591331-0x0;var _0x1caffa=_0x6455[_0x591331];return _0x1caffa;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require('bluebird');var rp=require(_0x5645('0x4'));var fs=require('fs');var path=require(_0x5645('0x5'));var rimraf=require(_0x5645('0x6'));var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x222e2f,_0x43affc){return _0x222e2f[_0x5645('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x5645('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9134=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x303d9f,_0x5af1f4){var _0x15b530=function(_0x1f8f9a){while(--_0x1f8f9a){_0x303d9f['push'](_0x303d9f['shift']());}};_0x15b530(++_0x5af1f4);}(_0x9134,0x15a));var _0x4913=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9134[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x4913('0x0'));var logger=require('../../config/logger')(_0x4913('0x1'));var moment=require('moment');var BPromise=require(_0x4913('0x2'));var rp=require(_0x4913('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4913('0x4'));var config=require(_0x4913('0x5'));var attributes=require(_0x4913('0x6'));module[_0x4913('0x7')]=function(_0x485484,_0x251019){return _0x485484[_0x4913('0x8')](_0x4913('0x9'),attributes,{'tableName':_0x4913('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index e0bfb0a..187942a 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 _0x3771=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','limit','include','map','model','ShowOpenchannelQueue','find','raw','where','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x1e3abb,_0xc26402){var _0x165244=function(_0x6fd9b9){while(--_0x6fd9b9){_0x1e3abb['push'](_0x1e3abb['shift']());}};_0x165244(++_0xc26402);}(_0x3771,0x135));var _0x1377=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x3771[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x1377('0x0'));var util=require(_0x1377('0x1'));var moment=require(_0x1377('0x2'));var BPromise=require(_0x1377('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1377('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1377('0x5'));var logger=require('../../config/logger')(_0x1377('0x6'));var config=require(_0x1377('0x7'));var jayson=require(_0x1377('0x8'));var client=jayson[_0x1377('0x9')][_0x1377('0xa')]({'port':0x232a});config['redis']=_[_0x1377('0xb')](config[_0x1377('0xc')],{'host':_0x1377('0xd'),'port':0x18eb});var socket=require(_0x1377('0xe'))(new Redis(config[_0x1377('0xc')]));require(_0x1377('0xf'))[_0x1377('0x10')](socket);function respondWithRpcPromise(_0x34b074,_0x5322fc,_0x49defc){return new BPromise(function(_0x23883b,_0x45404b){return client['request'](_0x34b074,_0x49defc)[_0x1377('0x11')](function(_0x4d9d68){logger[_0x1377('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x5322fc,_0x1377('0x13'));logger[_0x1377('0x14')](_0x1377('0x15'),_0x5322fc,'request\x20sent',JSON[_0x1377('0x16')](_0x4d9d68));if(_0x4d9d68[_0x1377('0x17')]){if(_0x4d9d68[_0x1377('0x17')][_0x1377('0x18')]===0x1f4){logger[_0x1377('0x17')](_0x1377('0x19'),_0x5322fc,_0x4d9d68[_0x1377('0x17')]['message']);return _0x45404b(_0x4d9d68[_0x1377('0x17')][_0x1377('0x1a')]);}logger[_0x1377('0x17')](_0x1377('0x19'),_0x5322fc,_0x4d9d68['error']['message']);return _0x23883b(_0x4d9d68[_0x1377('0x17')][_0x1377('0x1a')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x5322fc,_0x1377('0x13'));_0x23883b(_0x4d9d68[_0x1377('0x1b')][_0x1377('0x1a')]);}})[_0x1377('0x1c')](function(_0x5119ca){logger['error'](_0x1377('0x19'),_0x5322fc,_0x5119ca);_0x45404b(_0x5119ca);});});}exports[_0x1377('0x1d')]=function(_0x365ca0){var _0x275848=this;return new Promise(function(_0x3d67c0,_0x2d7147){return db[_0x1377('0x1e')][_0x1377('0x1f')]({'raw':_0x365ca0['options']?_0x365ca0[_0x1377('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x365ca0[_0x1377('0x20')]?_0x365ca0[_0x1377('0x20')]['where']||null:null,'attributes':_0x365ca0['options']?_0x365ca0[_0x1377('0x20')][_0x1377('0x21')]||null:null,'limit':_0x365ca0[_0x1377('0x20')]?_0x365ca0['options'][_0x1377('0x22')]||null:null,'include':_0x365ca0[_0x1377('0x20')]?_0x365ca0[_0x1377('0x20')][_0x1377('0x23')]?_[_0x1377('0x24')](_0x365ca0[_0x1377('0x20')][_0x1377('0x23')],function(_0x43b782){return{'model':db[_0x43b782[_0x1377('0x25')]],'as':_0x43b782['as'],'attributes':_0x43b782[_0x1377('0x21')],'include':_0x43b782[_0x1377('0x23')]?_['map'](_0x43b782['include'],function(_0x397142){return{'model':db[_0x397142[_0x1377('0x25')]],'as':_0x397142['as'],'attributes':_0x397142[_0x1377('0x21')],'include':_0x397142['include']?_[_0x1377('0x24')](_0x397142['include'],function(_0x5a1ea1){return{'model':db[_0x5a1ea1[_0x1377('0x25')]],'as':_0x5a1ea1['as'],'attributes':_0x5a1ea1[_0x1377('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1377('0x11')](function(_0x4306e9){logger['info']('GetOpenchannelQueue',_0x365ca0);logger[_0x1377('0x14')]('GetOpenchannelQueue',_0x365ca0,JSON['stringify'](_0x4306e9));_0x3d67c0(_0x4306e9);})[_0x1377('0x1c')](function(_0x1df20e){logger[_0x1377('0x17')](_0x1377('0x1d'),_0x1df20e['message'],_0x365ca0);_0x2d7147(_0x275848['error'](0x1f4,_0x1df20e['message']));});});};exports[_0x1377('0x26')]=function(_0xa586d1){var _0x10563c=this;return new Promise(function(_0x2b983a,_0x3a1cba){return db[_0x1377('0x1e')][_0x1377('0x27')]({'raw':_0xa586d1[_0x1377('0x20')]?_0xa586d1[_0x1377('0x20')][_0x1377('0x28')]===undefined?!![]:![]:!![],'where':_0xa586d1[_0x1377('0x20')]?_0xa586d1[_0x1377('0x20')][_0x1377('0x29')]||null:null,'attributes':_0xa586d1[_0x1377('0x20')]?_0xa586d1[_0x1377('0x20')]['attributes']||null:null,'include':_0xa586d1[_0x1377('0x20')]?_0xa586d1[_0x1377('0x20')][_0x1377('0x23')]?_[_0x1377('0x24')](_0xa586d1[_0x1377('0x20')]['include'],function(_0x126957){return{'model':db[_0x126957[_0x1377('0x25')]],'as':_0x126957['as'],'attributes':_0x126957[_0x1377('0x21')],'include':_0x126957[_0x1377('0x23')]?_[_0x1377('0x24')](_0x126957[_0x1377('0x23')],function(_0x26a48b){return{'model':db[_0x26a48b[_0x1377('0x25')]],'as':_0x26a48b['as'],'attributes':_0x26a48b[_0x1377('0x21')],'include':_0x26a48b[_0x1377('0x23')]?_[_0x1377('0x24')](_0x26a48b[_0x1377('0x23')],function(_0x422cc4){return{'model':db[_0x422cc4[_0x1377('0x25')]],'as':_0x422cc4['as'],'attributes':_0x422cc4[_0x1377('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1377('0x11')](function(_0x53f205){logger[_0x1377('0x12')]('ShowOpenchannelQueue',_0xa586d1);logger[_0x1377('0x14')](_0x1377('0x26'),_0xa586d1,JSON[_0x1377('0x16')](_0x53f205));_0x2b983a(_0x53f205);})[_0x1377('0x1c')](function(_0x58e91e){logger['error']('ShowOpenchannelQueue',_0x58e91e['message'],_0xa586d1);_0x3a1cba(_0x10563c['error'](0x1f4,_0x58e91e['message']));});});}; \ No newline at end of file +var _0x54fe=['map','model','ShowOpenchannelQueue','OpenchannelQueue','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','findAll','options','where','attributes','limit','include'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x54fe,0x136));var _0xe54f=function(_0x3bf999,_0x516512){_0x3bf999=_0x3bf999-0x0;var _0x4f8efb=_0x54fe[_0x3bf999];return _0x4f8efb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe54f('0x0'));var BPromise=require(_0xe54f('0x1'));var rs=require(_0xe54f('0x2'));var fs=require('fs');var Redis=require(_0xe54f('0x3'));var db=require(_0xe54f('0x4'))['db'];var utils=require(_0xe54f('0x5'));var logger=require('../../config/logger')(_0xe54f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xe54f('0x7')](config[_0xe54f('0x8')],{'host':_0xe54f('0x9'),'port':0x18eb});var socket=require(_0xe54f('0xa'))(new Redis(config[_0xe54f('0x8')]));require('./openchannelQueue.socket')[_0xe54f('0xb')](socket);function respondWithRpcPromise(_0xc45ae5,_0x24872f,_0x1add5d){return new BPromise(function(_0x7cb572,_0x3c96c6){return client[_0xe54f('0xc')](_0xc45ae5,_0x1add5d)[_0xe54f('0xd')](function(_0x291fb1){logger[_0xe54f('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x24872f,_0xe54f('0xf'));logger[_0xe54f('0x10')](_0xe54f('0x11'),_0x24872f,_0xe54f('0xf'),JSON[_0xe54f('0x12')](_0x291fb1));if(_0x291fb1[_0xe54f('0x13')]){if(_0x291fb1[_0xe54f('0x13')][_0xe54f('0x14')]===0x1f4){logger[_0xe54f('0x13')](_0xe54f('0x15'),_0x24872f,_0x291fb1[_0xe54f('0x13')][_0xe54f('0x16')]);return _0x3c96c6(_0x291fb1[_0xe54f('0x13')][_0xe54f('0x16')]);}logger[_0xe54f('0x13')](_0xe54f('0x15'),_0x24872f,_0x291fb1['error'][_0xe54f('0x16')]);return _0x7cb572(_0x291fb1[_0xe54f('0x13')][_0xe54f('0x16')]);}else{logger[_0xe54f('0xe')](_0xe54f('0x15'),_0x24872f,_0xe54f('0xf'));_0x7cb572(_0x291fb1[_0xe54f('0x17')][_0xe54f('0x16')]);}})[_0xe54f('0x18')](function(_0x1a5d9e){logger[_0xe54f('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x24872f,_0x1a5d9e);_0x3c96c6(_0x1a5d9e);});});}exports[_0xe54f('0x19')]=function(_0x5dc6d3){var _0x515830=this;return new Promise(function(_0x4eefa8,_0x2ff516){return db['OpenchannelQueue'][_0xe54f('0x1a')]({'raw':_0x5dc6d3[_0xe54f('0x1b')]?_0x5dc6d3[_0xe54f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5dc6d3[_0xe54f('0x1b')]?_0x5dc6d3[_0xe54f('0x1b')][_0xe54f('0x1c')]||null:null,'attributes':_0x5dc6d3[_0xe54f('0x1b')]?_0x5dc6d3[_0xe54f('0x1b')][_0xe54f('0x1d')]||null:null,'limit':_0x5dc6d3[_0xe54f('0x1b')]?_0x5dc6d3[_0xe54f('0x1b')][_0xe54f('0x1e')]||null:null,'include':_0x5dc6d3[_0xe54f('0x1b')]?_0x5dc6d3[_0xe54f('0x1b')][_0xe54f('0x1f')]?_[_0xe54f('0x20')](_0x5dc6d3[_0xe54f('0x1b')][_0xe54f('0x1f')],function(_0x4ae93c){return{'model':db[_0x4ae93c[_0xe54f('0x21')]],'as':_0x4ae93c['as'],'attributes':_0x4ae93c[_0xe54f('0x1d')],'include':_0x4ae93c[_0xe54f('0x1f')]?_['map'](_0x4ae93c[_0xe54f('0x1f')],function(_0x1d9462){return{'model':db[_0x1d9462['model']],'as':_0x1d9462['as'],'attributes':_0x1d9462[_0xe54f('0x1d')],'include':_0x1d9462[_0xe54f('0x1f')]?_[_0xe54f('0x20')](_0x1d9462[_0xe54f('0x1f')],function(_0x78b81e){return{'model':db[_0x78b81e[_0xe54f('0x21')]],'as':_0x78b81e['as'],'attributes':_0x78b81e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe54f('0xd')](function(_0x226a17){logger[_0xe54f('0xe')](_0xe54f('0x19'),_0x5dc6d3);logger[_0xe54f('0x10')]('GetOpenchannelQueue',_0x5dc6d3,JSON[_0xe54f('0x12')](_0x226a17));_0x4eefa8(_0x226a17);})['catch'](function(_0x1aee23){logger[_0xe54f('0x13')](_0xe54f('0x19'),_0x1aee23[_0xe54f('0x16')],_0x5dc6d3);_0x2ff516(_0x515830[_0xe54f('0x13')](0x1f4,_0x1aee23[_0xe54f('0x16')]));});});};exports[_0xe54f('0x22')]=function(_0x42f99b){var _0x12ad07=this;return new Promise(function(_0x570aad,_0x19bef6){return db[_0xe54f('0x23')][_0xe54f('0x24')]({'raw':_0x42f99b['options']?_0x42f99b['options'][_0xe54f('0x25')]===undefined?!![]:![]:!![],'where':_0x42f99b['options']?_0x42f99b['options'][_0xe54f('0x1c')]||null:null,'attributes':_0x42f99b['options']?_0x42f99b[_0xe54f('0x1b')][_0xe54f('0x1d')]||null:null,'include':_0x42f99b[_0xe54f('0x1b')]?_0x42f99b[_0xe54f('0x1b')][_0xe54f('0x1f')]?_[_0xe54f('0x20')](_0x42f99b['options'][_0xe54f('0x1f')],function(_0x326c94){return{'model':db[_0x326c94[_0xe54f('0x21')]],'as':_0x326c94['as'],'attributes':_0x326c94['attributes'],'include':_0x326c94['include']?_['map'](_0x326c94['include'],function(_0x3e2471){return{'model':db[_0x3e2471[_0xe54f('0x21')]],'as':_0x3e2471['as'],'attributes':_0x3e2471[_0xe54f('0x1d')],'include':_0x3e2471[_0xe54f('0x1f')]?_[_0xe54f('0x20')](_0x3e2471['include'],function(_0x5cfaa9){return{'model':db[_0x5cfaa9[_0xe54f('0x21')]],'as':_0x5cfaa9['as'],'attributes':_0x5cfaa9[_0xe54f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x594354){logger[_0xe54f('0xe')]('ShowOpenchannelQueue',_0x42f99b);logger['debug']('ShowOpenchannelQueue',_0x42f99b,JSON[_0xe54f('0x12')](_0x594354));_0x570aad(_0x594354);})[_0xe54f('0x18')](function(_0xaac587){logger['error'](_0xe54f('0x22'),_0xaac587[_0xe54f('0x16')],_0x42f99b);_0x19bef6(_0x12ad07[_0xe54f('0x13')](0x1f4,_0xaac587['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 548e24b..30ed036 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 _0x3753=['update','emit','removeListener','register','length','./openchannelQueue.events','remove'];(function(_0x516390,_0x139bd3){var _0x5db5aa=function(_0x548e13){while(--_0x548e13){_0x516390['push'](_0x516390['shift']());}};_0x5db5aa(++_0x139bd3);}(_0x3753,0xa6));var _0x3375=function(_0x2f24c5,_0x2ea46e){_0x2f24c5=_0x2f24c5-0x0;var _0x3301ae=_0x3753[_0x2f24c5];return _0x3301ae;};'use strict';var OpenchannelQueueEvents=require(_0x3375('0x0'));var events=['save',_0x3375('0x1'),_0x3375('0x2')];function createListener(_0x517021,_0x59cbd7){return function(_0x153ea0){_0x59cbd7[_0x3375('0x3')](_0x517021,_0x153ea0);};}function removeListener(_0x244426,_0x48e9d3){return function(){OpenchannelQueueEvents[_0x3375('0x4')](_0x244426,_0x48e9d3);};}exports[_0x3375('0x5')]=function(_0x481c6e){for(var _0x3278cc=0x0,_0x471ecf=events[_0x3375('0x6')];_0x3278cc<_0x471ecf;_0x3278cc++){var _0x535ce3=events[_0x3278cc];var _0x5afb86=createListener('openchannelQueue:'+_0x535ce3,_0x481c6e);OpenchannelQueueEvents['on'](_0x535ce3,_0x5afb86);}}; \ No newline at end of file +var _0xa714=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x225634,_0x2822e2){var _0x2f3c62=function(_0x4ffe0e){while(--_0x4ffe0e){_0x225634['push'](_0x225634['shift']());}};_0x2f3c62(++_0x2822e2);}(_0xa714,0xaf));var _0x4a71=function(_0x39b72b,_0x2f8999){_0x39b72b=_0x39b72b-0x0;var _0x2c2848=_0xa714[_0x39b72b];return _0x2c2848;};'use strict';var OpenchannelQueueEvents=require(_0x4a71('0x0'));var events=[_0x4a71('0x1'),_0x4a71('0x2'),_0x4a71('0x3')];function createListener(_0x4ba1ff,_0x4ec3c8){return function(_0x301bf0){_0x4ec3c8[_0x4a71('0x4')](_0x4ba1ff,_0x301bf0);};}function removeListener(_0x1bd47c,_0x3662f3){return function(){OpenchannelQueueEvents[_0x4a71('0x5')](_0x1bd47c,_0x3662f3);};}exports[_0x4a71('0x6')]=function(_0x32aef8){for(var _0xee9b53=0x0,_0x31bcb1=events[_0x4a71('0x7')];_0xee9b53<_0x31bcb1;_0xee9b53++){var _0x389625=events[_0xee9b53];var _0x27439d=createListener(_0x4a71('0x8')+_0x389625,_0x32aef8);OpenchannelQueueEvents['on'](_0x389625,_0x27439d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e3710b3..8a79b24 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 _0xe9c9=['../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4eb69e,_0x3b4691){var _0x213b4a=function(_0x2ab14a){while(--_0x2ab14a){_0x4eb69e['push'](_0x4eb69e['shift']());}};_0x213b4a(++_0x3b4691);}(_0xe9c9,0x19d));var _0x9e9c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe9c9[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x9e9c('0x0'));var util=require(_0x9e9c('0x1'));var path=require(_0x9e9c('0x2'));var timeout=require(_0x9e9c('0x3'));var express=require('express');var router=express[_0x9e9c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9e9c('0x5'));var interaction=require(_0x9e9c('0x6'));var config=require(_0x9e9c('0x7'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x9e9c('0x8')](),controller[_0x9e9c('0x9')]);router[_0x9e9c('0xa')](_0x9e9c('0xb'),auth[_0x9e9c('0x8')](),controller[_0x9e9c('0xc')]);router['get']('/:id',auth[_0x9e9c('0x8')](),controller[_0x9e9c('0xd')]);router[_0x9e9c('0xe')]('/',auth[_0x9e9c('0x8')](),controller['create']);router[_0x9e9c('0xf')](_0x9e9c('0x10'),auth['isAuthenticated'](),controller[_0x9e9c('0x11')]);router[_0x9e9c('0x12')](_0x9e9c('0x10'),auth[_0x9e9c('0x8')](),controller[_0x9e9c('0x13')]);module[_0x9e9c('0x14')]=router; \ No newline at end of file +var _0xf41a=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x4a66f0,_0xb1ad99){var _0x5eebbf=function(_0x1e21aa){while(--_0x1e21aa){_0x4a66f0['push'](_0x4a66f0['shift']());}};_0x5eebbf(++_0xb1ad99);}(_0xf41a,0x163));var _0xaf41=function(_0x14eafa,_0x1f47c7){_0x14eafa=_0x14eafa-0x0;var _0x20cbd3=_0xf41a[_0x14eafa];return _0x20cbd3;};'use strict';var multer=require(_0xaf41('0x0'));var util=require(_0xaf41('0x1'));var path=require('path');var timeout=require(_0xaf41('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaf41('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xaf41('0x4'));var config=require(_0xaf41('0x5'));var controller=require(_0xaf41('0x6'));router[_0xaf41('0x7')]('/',auth[_0xaf41('0x8')](),controller[_0xaf41('0x9')]);router[_0xaf41('0x7')](_0xaf41('0xa'),auth[_0xaf41('0x8')](),controller[_0xaf41('0xb')]);router[_0xaf41('0x7')]('/:id',auth[_0xaf41('0x8')](),controller[_0xaf41('0xc')]);router[_0xaf41('0xd')]('/',auth['isAuthenticated'](),controller[_0xaf41('0xe')]);router['put'](_0xaf41('0xf'),auth[_0xaf41('0x8')](),controller[_0xaf41('0x10')]);router[_0xaf41('0x11')]('/:id',auth[_0xaf41('0x8')](),controller[_0xaf41('0x12')]);module[_0xaf41('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 93eb1a0..3383bde 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 _0xb41e=['moment','exports','STRING','DATE'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0xb41e,0x1f0));var _0xeb41=function(_0x467e39,_0x54a12e){_0x467e39=_0x467e39-0x0;var _0x3d4c8e=_0xb41e[_0x467e39];return _0x3d4c8e;};'use strict';var moment=require(_0xeb41('0x0'));var Sequelize=require('sequelize');module[_0xeb41('0x1')]={'uniqueid':{'type':Sequelize[_0xeb41('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xeb41('0x2')]},'joinAt':{'type':Sequelize[_0xeb41('0x3')]},'leaveAt':{'type':Sequelize[_0xeb41('0x3')]},'acceptAt':{'type':Sequelize[_0xeb41('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xeb41('0x2')]}}; \ No newline at end of file +var _0xc09f=['moment','sequelize','STRING','DATE'];(function(_0x24e3a1,_0x3a7096){var _0x3b58cf=function(_0x50242c){while(--_0x50242c){_0x24e3a1['push'](_0x24e3a1['shift']());}};_0x3b58cf(++_0x3a7096);}(_0xc09f,0xe4));var _0xfc09=function(_0x17ebb6,_0x465af7){_0x17ebb6=_0x17ebb6-0x0;var _0x32ec22=_0xc09f[_0x17ebb6];return _0x32ec22;};'use strict';var moment=require(_0xfc09('0x0'));var Sequelize=require(_0xfc09('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfc09('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfc09('0x2')]},'joinAt':{'type':Sequelize[_0xfc09('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfc09('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xfc09('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5d15fff..02133e2 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 _0x79c2=['jsforce','desk.js','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','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','OpenchannelQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','fields','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3e24fe,_0x28f5e5){var _0x8e5265=function(_0x4d8696){while(--_0x4d8696){_0x3e24fe['push'](_0x3e24fe['shift']());}};_0x8e5265(++_0x28f5e5);}(_0x79c2,0x16e));var _0x279c=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x79c2[_0x39ffd1];return _0x31267e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x279c('0x0'));var zipdir=require(_0x279c('0x1'));var jsonpatch=require(_0x279c('0x2'));var rp=require('request-promise');var moment=require(_0x279c('0x3'));var BPromise=require(_0x279c('0x4'));var Mustache=require(_0x279c('0x5'));var util=require('util');var path=require(_0x279c('0x6'));var sox=require(_0x279c('0x7'));var csv=require(_0x279c('0x8'));var ejs=require(_0x279c('0x9'));var fs=require('fs');var fs_extra=require(_0x279c('0xa'));var _=require(_0x279c('0xb'));var squel=require(_0x279c('0xc'));var crypto=require(_0x279c('0xd'));var jsforce=require(_0x279c('0xe'));var deskjs=require(_0x279c('0xf'));var toCsv=require(_0x279c('0x8'));var querystring=require(_0x279c('0x10'));var Papa=require(_0x279c('0x11'));var Redis=require('ioredis');var authService=require(_0x279c('0x12'));var qs=require(_0x279c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x279c('0x14'));var logger=require(_0x279c('0x15'))(_0x279c('0x16'));var utils=require(_0x279c('0x17'));var config=require(_0x279c('0x18'));var licenseUtil=require(_0x279c('0x19'));var db=require(_0x279c('0x1a'))['db'];function respondWithStatusCode(_0x14eb94,_0x331dc8){_0x331dc8=_0x331dc8||0xcc;return function(_0xe6838e){if(_0xe6838e){return _0x14eb94[_0x279c('0x1b')](_0x331dc8);}return _0x14eb94[_0x279c('0x1c')](_0x331dc8)[_0x279c('0x1d')]();};}function respondWithResult(_0x46fc1c,_0x3a2574){_0x3a2574=_0x3a2574||0xc8;return function(_0x568153){if(_0x568153){return _0x46fc1c[_0x279c('0x1c')](_0x3a2574)[_0x279c('0x1e')](_0x568153);}};}function respondWithFilteredResult(_0x5e6d10,_0x1b2fe6){return function(_0x53c445){if(_0x53c445){var _0x278530=typeof _0x1b2fe6[_0x279c('0x1f')]===_0x279c('0x20')&&typeof _0x1b2fe6[_0x279c('0x21')]===_0x279c('0x20');var _0x56d7d3=_0x53c445[_0x279c('0x22')];var _0x53447e=_0x278530?0x0:_0x1b2fe6[_0x279c('0x1f')];var _0x735b5d=_0x278530?_0x53c445['count']:_0x1b2fe6[_0x279c('0x1f')]+_0x1b2fe6['limit'];var _0x3920fb;if(_0x735b5d>=_0x56d7d3){_0x735b5d=_0x56d7d3;_0x3920fb=0xc8;}else{_0x3920fb=0xce;}_0x5e6d10[_0x279c('0x1c')](_0x3920fb);return _0x5e6d10[_0x279c('0x23')](_0x279c('0x24'),_0x53447e+'-'+_0x735b5d+'/'+_0x56d7d3)[_0x279c('0x1e')](_0x53c445);}return null;};}function patchUpdates(_0x333aac){return function(_0x1c357a){try{jsonpatch[_0x279c('0x25')](_0x1c357a,_0x333aac,!![]);}catch(_0x16971d){return BPromise[_0x279c('0x26')](_0x16971d);}return _0x1c357a['save']();};}function saveUpdates(_0x18d4fe,_0x1de476){return function(_0x4d88f3){if(_0x4d88f3){return _0x4d88f3[_0x279c('0x27')](_0x18d4fe)[_0x279c('0x28')](function(_0x50ee4c){return _0x50ee4c;});}return null;};}function removeEntity(_0x3b1199,_0x2693ed){return function(_0x1a7a9d){if(_0x1a7a9d){return _0x1a7a9d[_0x279c('0x29')]()[_0x279c('0x28')](function(){_0x3b1199[_0x279c('0x1c')](0xcc)[_0x279c('0x1d')]();});}};}function handleEntityNotFound(_0x14d988,_0x1e3082){return function(_0x41c045){if(!_0x41c045){_0x14d988[_0x279c('0x1b')](0x194);}return _0x41c045;};}function handleError(_0x6f1bad,_0x51b118){_0x51b118=_0x51b118||0x1f4;return function(_0x443669){logger[_0x279c('0x2a')](_0x443669['stack']);if(_0x443669[_0x279c('0x2b')]){delete _0x443669[_0x279c('0x2b')];}_0x6f1bad['status'](_0x51b118)[_0x279c('0x2c')](_0x443669);};}exports['index']=function(_0x16bf96,_0x278732){var _0x18b8a1={},_0x21de39={},_0x1ca11a={'count':0x0,'rows':[]};var _0x3a881a=_[_0x279c('0x2d')](db[_0x279c('0x2e')][_0x279c('0x2f')],function(_0x2d0e36){return{'name':_0x2d0e36['fieldName'],'type':_0x2d0e36[_0x279c('0x30')][_0x279c('0x31')]};});_0x21de39[_0x279c('0x32')]=_[_0x279c('0x2d')](_0x3a881a,_0x279c('0x2b'));_0x21de39['query']=_[_0x279c('0x33')](_0x16bf96[_0x279c('0x34')]);_0x21de39[_0x279c('0x35')]=_[_0x279c('0x36')](_0x21de39[_0x279c('0x32')],_0x21de39['query']);_0x18b8a1[_0x279c('0x37')]=_[_0x279c('0x36')](_0x21de39['model'],qs['fields'](_0x16bf96[_0x279c('0x34')]['fields']));_0x18b8a1[_0x279c('0x37')]=_0x18b8a1[_0x279c('0x37')][_0x279c('0x38')]?_0x18b8a1[_0x279c('0x37')]:_0x21de39['model'];if(!_0x16bf96['query'][_0x279c('0x39')](_0x279c('0x3a'))){_0x18b8a1[_0x279c('0x21')]=qs['limit'](_0x16bf96[_0x279c('0x34')][_0x279c('0x21')]);_0x18b8a1['offset']=qs[_0x279c('0x1f')](_0x16bf96[_0x279c('0x34')]['offset']);}_0x18b8a1[_0x279c('0x3b')]=qs[_0x279c('0x3c')](_0x16bf96[_0x279c('0x34')][_0x279c('0x3c')]);_0x18b8a1['where']=qs[_0x279c('0x35')](_[_0x279c('0x3d')](_0x16bf96[_0x279c('0x34')],_0x21de39[_0x279c('0x35')]),_0x3a881a);if(_0x16bf96[_0x279c('0x34')]['filter']){_0x18b8a1[_0x279c('0x3e')]=_['merge'](_0x18b8a1[_0x279c('0x3e')],{'$or':_['map'](_0x3a881a,function(_0x56ec01){if(_0x56ec01[_0x279c('0x30')]!==_0x279c('0x3f')){var _0x28ebcb={};_0x28ebcb[_0x56ec01[_0x279c('0x2b')]]={'$like':'%'+_0x16bf96['query'][_0x279c('0x40')]+'%'};return _0x28ebcb;}})});}_0x18b8a1=_[_0x279c('0x41')]({},_0x18b8a1,_0x16bf96[_0x279c('0x42')]);var _0x19696d={'where':_0x18b8a1[_0x279c('0x3e')]};return db[_0x279c('0x2e')]['count'](_0x19696d)[_0x279c('0x28')](function(_0xb239cc){_0x1ca11a['count']=_0xb239cc;if(_0x16bf96[_0x279c('0x34')][_0x279c('0x43')]){_0x18b8a1[_0x279c('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x18b8a1);})[_0x279c('0x28')](function(_0x168ed9){_0x1ca11a[_0x279c('0x45')]=_0x168ed9;return _0x1ca11a;})[_0x279c('0x28')](respondWithFilteredResult(_0x278732,_0x18b8a1))['catch'](handleError(_0x278732,null));};exports['show']=function(_0x3953e6,_0x129070){var _0x20aacf={'raw':!![],'where':{'id':_0x3953e6['params']['id']}},_0x1df934={};_0x1df934['model']=_[_0x279c('0x33')](db[_0x279c('0x2e')][_0x279c('0x2f')]);_0x1df934['query']=_[_0x279c('0x33')](_0x3953e6[_0x279c('0x34')]);_0x1df934[_0x279c('0x35')]=_[_0x279c('0x36')](_0x1df934[_0x279c('0x32')],_0x1df934[_0x279c('0x34')]);_0x20aacf[_0x279c('0x37')]=_[_0x279c('0x36')](_0x1df934[_0x279c('0x32')],qs[_0x279c('0x46')](_0x3953e6[_0x279c('0x34')]['fields']));_0x20aacf[_0x279c('0x37')]=_0x20aacf[_0x279c('0x37')][_0x279c('0x38')]?_0x20aacf[_0x279c('0x37')]:_0x1df934[_0x279c('0x32')];if(_0x3953e6[_0x279c('0x34')][_0x279c('0x43')]){_0x20aacf[_0x279c('0x44')]=[{'all':!![]}];}_0x20aacf=_['merge']({},_0x20aacf,_0x3953e6[_0x279c('0x42')]);return db[_0x279c('0x2e')][_0x279c('0x47')](_0x20aacf)[_0x279c('0x28')](handleEntityNotFound(_0x129070,null))[_0x279c('0x28')](respondWithResult(_0x129070,null))[_0x279c('0x48')](handleError(_0x129070,null));};exports[_0x279c('0x49')]=function(_0x1e290b,_0x483af6){return db['OpenchannelQueueReport'][_0x279c('0x49')](_0x1e290b[_0x279c('0x4a')],{})['then'](respondWithResult(_0x483af6,0xc9))[_0x279c('0x48')](handleError(_0x483af6,null));};exports[_0x279c('0x27')]=function(_0x33fbf4,_0x333fc0){if(_0x33fbf4[_0x279c('0x4a')]['id']){delete _0x33fbf4[_0x279c('0x4a')]['id'];}return db[_0x279c('0x2e')][_0x279c('0x47')]({'where':{'id':_0x33fbf4[_0x279c('0x4b')]['id']}})[_0x279c('0x28')](handleEntityNotFound(_0x333fc0,null))[_0x279c('0x28')](saveUpdates(_0x33fbf4[_0x279c('0x4a')],null))[_0x279c('0x28')](respondWithResult(_0x333fc0,null))['catch'](handleError(_0x333fc0,null));};exports['destroy']=function(_0x1633ce,_0x67df87){return db[_0x279c('0x2e')][_0x279c('0x47')]({'where':{'id':_0x1633ce[_0x279c('0x4b')]['id']}})[_0x279c('0x28')](handleEntityNotFound(_0x67df87,null))['then'](removeEntity(_0x67df87,null))['catch'](handleError(_0x67df87,null));};exports['describe']=function(_0x482a41,_0x186a89){return db[_0x279c('0x2e')]['describe']()[_0x279c('0x28')](respondWithResult(_0x186a89,null))[_0x279c('0x48')](handleError(_0x186a89,null));}; \ No newline at end of file +var _0x8439=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','find','catch','body','describe','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x2ced4f,_0x3e2bec){var _0x4cf01a=function(_0x1c0a08){while(--_0x1c0a08){_0x2ced4f['push'](_0x2ced4f['shift']());}};_0x4cf01a(++_0x3e2bec);}(_0x8439,0x13d));var _0x9843=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8439[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9843('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9843('0x1'));var moment=require('moment');var BPromise=require(_0x9843('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9843('0x3'));var sox=require(_0x9843('0x4'));var csv=require(_0x9843('0x5'));var ejs=require(_0x9843('0x6'));var fs=require('fs');var fs_extra=require(_0x9843('0x7'));var _=require('lodash');var squel=require(_0x9843('0x8'));var crypto=require('crypto');var jsforce=require(_0x9843('0x9'));var deskjs=require(_0x9843('0xa'));var toCsv=require(_0x9843('0x5'));var querystring=require(_0x9843('0xb'));var Papa=require(_0x9843('0xc'));var Redis=require(_0x9843('0xd'));var authService=require(_0x9843('0xe'));var qs=require(_0x9843('0xf'));var as=require(_0x9843('0x10'));var hardwareService=require(_0x9843('0x11'));var logger=require('../../config/logger')(_0x9843('0x12'));var utils=require(_0x9843('0x13'));var config=require(_0x9843('0x14'));var licenseUtil=require(_0x9843('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x503320,_0x3bb39f){_0x3bb39f=_0x3bb39f||0xcc;return function(_0x32b237){if(_0x32b237){return _0x503320[_0x9843('0x16')](_0x3bb39f);}return _0x503320['status'](_0x3bb39f)[_0x9843('0x17')]();};}function respondWithResult(_0x2ebf93,_0x47ee56){_0x47ee56=_0x47ee56||0xc8;return function(_0x918014){if(_0x918014){return _0x2ebf93[_0x9843('0x18')](_0x47ee56)[_0x9843('0x19')](_0x918014);}};}function respondWithFilteredResult(_0x368202,_0x496f8a){return function(_0x114205){if(_0x114205){var _0x178849=typeof _0x496f8a[_0x9843('0x1a')]===_0x9843('0x1b')&&typeof _0x496f8a[_0x9843('0x1c')]===_0x9843('0x1b');var _0x1eabe5=_0x114205['count'];var _0x59d570=_0x178849?0x0:_0x496f8a[_0x9843('0x1a')];var _0xe7beca=_0x178849?_0x114205[_0x9843('0x1d')]:_0x496f8a[_0x9843('0x1a')]+_0x496f8a[_0x9843('0x1c')];var _0x3974c8;if(_0xe7beca>=_0x1eabe5){_0xe7beca=_0x1eabe5;_0x3974c8=0xc8;}else{_0x3974c8=0xce;}_0x368202[_0x9843('0x18')](_0x3974c8);return _0x368202[_0x9843('0x1e')](_0x9843('0x1f'),_0x59d570+'-'+_0xe7beca+'/'+_0x1eabe5)['json'](_0x114205);}return null;};}function patchUpdates(_0x5e77ae){return function(_0x4b40e2){try{jsonpatch['apply'](_0x4b40e2,_0x5e77ae,!![]);}catch(_0x585ef3){return BPromise[_0x9843('0x20')](_0x585ef3);}return _0x4b40e2[_0x9843('0x21')]();};}function saveUpdates(_0x35eada,_0x19829e){return function(_0x1faebd){if(_0x1faebd){return _0x1faebd[_0x9843('0x22')](_0x35eada)[_0x9843('0x23')](function(_0xfc4850){return _0xfc4850;});}return null;};}function removeEntity(_0x58bee2,_0x49f13e){return function(_0x2c8d7a){if(_0x2c8d7a){return _0x2c8d7a[_0x9843('0x24')]()['then'](function(){_0x58bee2[_0x9843('0x18')](0xcc)[_0x9843('0x17')]();});}};}function handleEntityNotFound(_0x1b40de,_0x3ebcaa){return function(_0x447a32){if(!_0x447a32){_0x1b40de['sendStatus'](0x194);}return _0x447a32;};}function handleError(_0x1b5fa6,_0x1578a9){_0x1578a9=_0x1578a9||0x1f4;return function(_0x25bf60){logger[_0x9843('0x25')](_0x25bf60[_0x9843('0x26')]);if(_0x25bf60[_0x9843('0x27')]){delete _0x25bf60[_0x9843('0x27')];}_0x1b5fa6[_0x9843('0x18')](_0x1578a9)['send'](_0x25bf60);};}exports[_0x9843('0x28')]=function(_0x3fd687,_0x56a713){var _0x23171d={},_0x4b321c={},_0x247844={'count':0x0,'rows':[]};var _0x1a821d=_[_0x9843('0x29')](db[_0x9843('0x2a')][_0x9843('0x2b')],function(_0x1db064){return{'name':_0x1db064[_0x9843('0x2c')],'type':_0x1db064[_0x9843('0x2d')][_0x9843('0x2e')]};});_0x4b321c[_0x9843('0x2f')]=_['map'](_0x1a821d,_0x9843('0x27'));_0x4b321c[_0x9843('0x30')]=_[_0x9843('0x31')](_0x3fd687[_0x9843('0x30')]);_0x4b321c[_0x9843('0x32')]=_[_0x9843('0x33')](_0x4b321c[_0x9843('0x2f')],_0x4b321c['query']);_0x23171d[_0x9843('0x34')]=_[_0x9843('0x33')](_0x4b321c[_0x9843('0x2f')],qs[_0x9843('0x35')](_0x3fd687['query']['fields']));_0x23171d[_0x9843('0x34')]=_0x23171d[_0x9843('0x34')][_0x9843('0x36')]?_0x23171d[_0x9843('0x34')]:_0x4b321c[_0x9843('0x2f')];if(!_0x3fd687[_0x9843('0x30')][_0x9843('0x37')](_0x9843('0x38'))){_0x23171d['limit']=qs[_0x9843('0x1c')](_0x3fd687[_0x9843('0x30')][_0x9843('0x1c')]);_0x23171d['offset']=qs['offset'](_0x3fd687[_0x9843('0x30')]['offset']);}_0x23171d[_0x9843('0x39')]=qs[_0x9843('0x3a')](_0x3fd687['query'][_0x9843('0x3a')]);_0x23171d[_0x9843('0x3b')]=qs['filters'](_['pick'](_0x3fd687['query'],_0x4b321c[_0x9843('0x32')]),_0x1a821d);if(_0x3fd687[_0x9843('0x30')][_0x9843('0x3c')]){_0x23171d[_0x9843('0x3b')]=_[_0x9843('0x3d')](_0x23171d['where'],{'$or':_['map'](_0x1a821d,function(_0x19d4d2){if(_0x19d4d2[_0x9843('0x2d')]!==_0x9843('0x3e')){var _0x5bd997={};_0x5bd997[_0x19d4d2[_0x9843('0x27')]]={'$like':'%'+_0x3fd687[_0x9843('0x30')][_0x9843('0x3c')]+'%'};return _0x5bd997;}})});}_0x23171d=_['merge']({},_0x23171d,_0x3fd687[_0x9843('0x3f')]);var _0x229e34={'where':_0x23171d['where']};return db[_0x9843('0x2a')]['count'](_0x229e34)[_0x9843('0x23')](function(_0x21f86b){_0x247844['count']=_0x21f86b;if(_0x3fd687[_0x9843('0x30')]['includeAll']){_0x23171d['include']=[{'all':!![]}];}return db[_0x9843('0x2a')][_0x9843('0x40')](_0x23171d);})[_0x9843('0x23')](function(_0x596603){_0x247844[_0x9843('0x41')]=_0x596603;return _0x247844;})[_0x9843('0x23')](respondWithFilteredResult(_0x56a713,_0x23171d))['catch'](handleError(_0x56a713,null));};exports[_0x9843('0x42')]=function(_0x4cbc7b,_0x1be9d4){var _0x3f3a0c={'raw':!![],'where':{'id':_0x4cbc7b[_0x9843('0x43')]['id']}},_0x2e17b7={};_0x2e17b7[_0x9843('0x2f')]=_['keys'](db['OpenchannelQueueReport']['rawAttributes']);_0x2e17b7[_0x9843('0x30')]=_['keys'](_0x4cbc7b[_0x9843('0x30')]);_0x2e17b7['filters']=_[_0x9843('0x33')](_0x2e17b7['model'],_0x2e17b7[_0x9843('0x30')]);_0x3f3a0c[_0x9843('0x34')]=_[_0x9843('0x33')](_0x2e17b7[_0x9843('0x2f')],qs[_0x9843('0x35')](_0x4cbc7b['query']['fields']));_0x3f3a0c['attributes']=_0x3f3a0c['attributes']['length']?_0x3f3a0c[_0x9843('0x34')]:_0x2e17b7['model'];if(_0x4cbc7b[_0x9843('0x30')][_0x9843('0x44')]){_0x3f3a0c['include']=[{'all':!![]}];}_0x3f3a0c=_[_0x9843('0x3d')]({},_0x3f3a0c,_0x4cbc7b[_0x9843('0x3f')]);return db[_0x9843('0x2a')][_0x9843('0x45')](_0x3f3a0c)['then'](handleEntityNotFound(_0x1be9d4,null))[_0x9843('0x23')](respondWithResult(_0x1be9d4,null))[_0x9843('0x46')](handleError(_0x1be9d4,null));};exports['create']=function(_0x25df9d,_0x368361){return db[_0x9843('0x2a')]['create'](_0x25df9d[_0x9843('0x47')],{})[_0x9843('0x23')](respondWithResult(_0x368361,0xc9))[_0x9843('0x46')](handleError(_0x368361,null));};exports['update']=function(_0xf8f05,_0xb9befc){if(_0xf8f05[_0x9843('0x47')]['id']){delete _0xf8f05['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0xf8f05[_0x9843('0x43')]['id']}})[_0x9843('0x23')](handleEntityNotFound(_0xb9befc,null))[_0x9843('0x23')](saveUpdates(_0xf8f05[_0x9843('0x47')],null))[_0x9843('0x23')](respondWithResult(_0xb9befc,null))[_0x9843('0x46')](handleError(_0xb9befc,null));};exports[_0x9843('0x24')]=function(_0xcf0624,_0x931a6a){return db[_0x9843('0x2a')][_0x9843('0x45')]({'where':{'id':_0xcf0624[_0x9843('0x43')]['id']}})[_0x9843('0x23')](handleEntityNotFound(_0x931a6a,null))['then'](removeEntity(_0x931a6a,null))[_0x9843('0x46')](handleError(_0x931a6a,null));};exports[_0x9843('0x48')]=function(_0x1d6459,_0x99411c){return db['OpenchannelQueueReport'][_0x9843('0x48')]()[_0x9843('0x23')](respondWithResult(_0x99411c,null))['catch'](handleError(_0x99411c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2d47ef1..47c21d4 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x45ae89,_0x1c706e){var _0x59a535=function(_0x570f1e){while(--_0x570f1e){_0x45ae89['push'](_0x45ae89['shift']());}};_0x59a535(++_0x1c706e);}(_0x1261,0x144));var _0x1126=function(_0x2adf4,_0x5df6de){_0x2adf4=_0x2adf4-0x0;var _0x45d47d=_0x1261[_0x2adf4];return _0x45d47d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x1c5278,_0x28e1b6){var _0x320820=function(_0x268763){while(--_0x268763){_0x1c5278['push'](_0x1c5278['shift']());}};_0x320820(++_0x28e1b6);}(_0x1261,0x144));var _0x1126=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0x1261[_0x1aac60];return _0x186adf;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8b39608..26a0f9e 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 _0x536f=['../../config/logger','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','debug','catch','update','body','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0xdfd26a,_0x1af3fc){var _0x5222fd=function(_0x4f3091){while(--_0x4f3091){_0xdfd26a['push'](_0xdfd26a['shift']());}};_0x5222fd(++_0x1af3fc);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1df79c){var _0xddf70e=this;return new Promise(function(_0x2d9dfb,_0x252cae){return db[_0xf536('0x12')][_0xf536('0x17')](_0x1df79c[_0xf536('0x18')],{'raw':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')][_0xf536('0x1a')]||null:null,'attributes':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x1b')]||null:null,'limit':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')]['limit']||null:null})[_0xf536('0x9')](function(_0x485da0){logger[_0xf536('0x10')](_0xf536('0x1c'),_0x1df79c);logger[_0xf536('0x15')](_0xf536('0x1c'),_0x1df79c,JSON[_0xf536('0xc')](_0x485da0));_0x2d9dfb(_0x485da0);})[_0xf536('0x16')](function(_0x330c47){logger[_0xf536('0xd')](_0xf536('0x1c'),_0x330c47[_0xf536('0xf')],_0x1df79c);_0x252cae(_0xddf70e[_0xf536('0xd')](0x1f4,_0x330c47[_0xf536('0xf')]));});});}; \ No newline at end of file +var _0x94d4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','then','stringify','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x94d4,0xa5));var _0x494d=function(_0x35653e,_0x49e23c){_0x35653e=_0x35653e-0x0;var _0x169ed8=_0x94d4[_0x35653e];return _0x169ed8;};'use strict';var _=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var moment=require('moment');var BPromise=require(_0x494d('0x2'));var rs=require(_0x494d('0x3'));var fs=require('fs');var Redis=require(_0x494d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x494d('0x5'));var logger=require(_0x494d('0x6'))(_0x494d('0x7'));var config=require(_0x494d('0x8'));var jayson=require(_0x494d('0x9'));var client=jayson[_0x494d('0xa')][_0x494d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c53d7,_0x4f4576,_0x5269db){return new BPromise(function(_0x396280,_0x3f6b68){return client['request'](_0x4c53d7,_0x5269db)['then'](function(_0x456fe8){logger[_0x494d('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));logger[_0x494d('0xe')](_0x494d('0xf'),_0x4f4576,_0x494d('0xd'),JSON['stringify'](_0x456fe8));if(_0x456fe8[_0x494d('0x10')]){if(_0x456fe8[_0x494d('0x10')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x3f6b68(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x396280(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}else{logger[_0x494d('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));_0x396280(_0x456fe8[_0x494d('0x13')][_0x494d('0x11')]);}})[_0x494d('0x14')](function(_0x120488){logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x120488);_0x3f6b68(_0x120488);});});}exports[_0x494d('0x15')]=function(_0x4301fc){var _0x1552bb=this;return new Promise(function(_0x12a484,_0xd67ea4){return db[_0x494d('0x16')][_0x494d('0x17')](_0x4301fc[_0x494d('0x18')],{'raw':_0x4301fc[_0x494d('0x19')]?_0x4301fc[_0x494d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x494d('0x1a')](function(_0x172763){logger[_0x494d('0xc')](_0x494d('0x15'),_0x4301fc);logger['debug']('CreateOpenchannelQueueReport',_0x4301fc,JSON[_0x494d('0x1b')](_0x172763));_0x12a484(_0x172763);})[_0x494d('0x14')](function(_0x56e992){logger['error'](_0x494d('0x15'),_0x56e992['message'],_0x4301fc);_0xd67ea4(_0x1552bb[_0x494d('0x10')](0x1f4,_0x56e992['message']));});});};exports[_0x494d('0x1c')]=function(_0x29220e){var _0x49120d=this;return new Promise(function(_0x2fdb5b,_0xc107f4){return db[_0x494d('0x16')][_0x494d('0x1d')](_0x29220e[_0x494d('0x18')],{'raw':_0x29220e['options']?_0x29220e[_0x494d('0x19')][_0x494d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29220e['options']?_0x29220e['options'][_0x494d('0x1f')]||null:null,'attributes':_0x29220e[_0x494d('0x19')]?_0x29220e[_0x494d('0x19')][_0x494d('0x20')]||null:null,'limit':_0x29220e[_0x494d('0x19')]?_0x29220e[_0x494d('0x19')][_0x494d('0x21')]||null:null})[_0x494d('0x1a')](function(_0x213939){logger[_0x494d('0xc')](_0x494d('0x1c'),_0x29220e);logger[_0x494d('0xe')](_0x494d('0x1c'),_0x29220e,JSON['stringify'](_0x213939));_0x2fdb5b(_0x213939);})[_0x494d('0x14')](function(_0xa78384){logger[_0x494d('0x10')](_0x494d('0x1c'),_0xa78384[_0x494d('0x11')],_0x29220e);_0xc107f4(_0x49120d[_0x494d('0x10')](0x1f4,_0xa78384[_0x494d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 90978f0..da7ec91 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 _0x17cb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2ca537,_0x4a7cad){var _0x1c98eb=function(_0x3a47a5){while(--_0x3a47a5){_0x2ca537['push'](_0x2ca537['shift']());}};_0x1c98eb(++_0x4a7cad);}(_0x17cb,0xe1));var _0xb17c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x17cb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb17c('0x0'));var util=require(_0xb17c('0x1'));var path=require(_0xb17c('0x2'));var timeout=require(_0xb17c('0x3'));var express=require(_0xb17c('0x4'));var router=express[_0xb17c('0x5')]();var fs_extra=require(_0xb17c('0x6'));var auth=require(_0xb17c('0x7'));var interaction=require(_0xb17c('0x8'));var config=require(_0xb17c('0x9'));var controller=require(_0xb17c('0xa'));router[_0xb17c('0xb')]('/',auth[_0xb17c('0xc')](),controller[_0xb17c('0xd')]);router[_0xb17c('0xb')](_0xb17c('0xe'),auth[_0xb17c('0xc')](),controller[_0xb17c('0xf')]);router['get'](_0xb17c('0x10'),auth['isAuthenticated'](),controller[_0xb17c('0x11')]);router['post']('/',auth[_0xb17c('0xc')](),controller[_0xb17c('0x12')]);router[_0xb17c('0x13')](_0xb17c('0x10'),auth[_0xb17c('0xc')](),controller['update']);router[_0xb17c('0x14')](_0xb17c('0x10'),auth[_0xb17c('0xc')](),controller[_0xb17c('0x15')]);module[_0xb17c('0x16')]=router; \ No newline at end of file +var _0x59b0=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x538dd2,_0x553983){var _0x3b7899=function(_0x240153){while(--_0x240153){_0x538dd2['push'](_0x538dd2['shift']());}};_0x3b7899(++_0x553983);}(_0x59b0,0x16f));var _0x059b=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x59b0[_0x276468];return _0x36dc3a;};'use strict';var multer=require(_0x059b('0x0'));var util=require(_0x059b('0x1'));var path=require(_0x059b('0x2'));var timeout=require(_0x059b('0x3'));var express=require(_0x059b('0x4'));var router=express[_0x059b('0x5')]();var fs_extra=require(_0x059b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x059b('0x7'));var config=require('../../config/environment');var controller=require(_0x059b('0x8'));router[_0x059b('0x9')]('/',auth[_0x059b('0xa')](),controller[_0x059b('0xb')]);router[_0x059b('0x9')](_0x059b('0xc'),auth[_0x059b('0xa')](),controller[_0x059b('0xd')]);router['get'](_0x059b('0xe'),auth[_0x059b('0xa')](),controller[_0x059b('0xf')]);router[_0x059b('0x10')]('/',auth[_0x059b('0xa')](),controller[_0x059b('0x11')]);router[_0x059b('0x12')](_0x059b('0xe'),auth[_0x059b('0xa')](),controller[_0x059b('0x13')]);router[_0x059b('0x14')](_0x059b('0xe'),auth[_0x059b('0xa')](),controller[_0x059b('0x15')]);module[_0x059b('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 49b34d3..03ba57e 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x5133c2,_0x49fa51){var _0x55b197=function(_0x59b2c8){while(--_0x59b2c8){_0x5133c2['push'](_0x5133c2['shift']());}};_0x55b197(++_0x49fa51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x220c2e,_0x5e2e5d){_0x220c2e=_0x220c2e-0x0;var _0x39a5a5=_0x9bde[_0x220c2e];return _0x39a5a5;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 24f67cf..b474f8c 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 _0x31b0=['then','end','stack','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','name','filter','merge','OpenchannelTransferReport','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x31b0,0x103));var _0x031b=function(_0x53dcc2,_0x13c7fa){_0x53dcc2=_0x53dcc2-0x0;var _0x13288c=_0x31b0[_0x53dcc2];return _0x13288c;};'use strict';var emlformat=require(_0x031b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031b('0x1'));var jsonpatch=require(_0x031b('0x2'));var rp=require('request-promise');var moment=require(_0x031b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x031b('0x4'));var util=require(_0x031b('0x5'));var path=require('path');var sox=require(_0x031b('0x6'));var csv=require(_0x031b('0x7'));var ejs=require(_0x031b('0x8'));var fs=require('fs');var fs_extra=require(_0x031b('0x9'));var _=require(_0x031b('0xa'));var squel=require(_0x031b('0xb'));var crypto=require(_0x031b('0xc'));var jsforce=require(_0x031b('0xd'));var deskjs=require(_0x031b('0xe'));var toCsv=require(_0x031b('0x7'));var querystring=require(_0x031b('0xf'));var Papa=require(_0x031b('0x10'));var Redis=require('ioredis');var authService=require(_0x031b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x031b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x031b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x031b('0x14'));var db=require(_0x031b('0x15'))['db'];function respondWithStatusCode(_0x2cab41,_0xcd5f2a){_0xcd5f2a=_0xcd5f2a||0xcc;return function(_0x542a7f){if(_0x542a7f){return _0x2cab41[_0x031b('0x16')](_0xcd5f2a);}return _0x2cab41[_0x031b('0x17')](_0xcd5f2a)['end']();};}function respondWithResult(_0x1bbddb,_0x160e83){_0x160e83=_0x160e83||0xc8;return function(_0x6574a9){if(_0x6574a9){return _0x1bbddb[_0x031b('0x17')](_0x160e83)[_0x031b('0x18')](_0x6574a9);}};}function respondWithFilteredResult(_0x4dd5cf,_0x4270bd){return function(_0x4cbd5b){if(_0x4cbd5b){var _0x2fa510=typeof _0x4270bd['offset']==='undefined'&&typeof _0x4270bd['limit']==='undefined';var _0x218667=_0x4cbd5b[_0x031b('0x19')];var _0x12fc29=_0x2fa510?0x0:_0x4270bd[_0x031b('0x1a')];var _0x198a0a=_0x2fa510?_0x4cbd5b['count']:_0x4270bd[_0x031b('0x1a')]+_0x4270bd[_0x031b('0x1b')];var _0x280959;if(_0x198a0a>=_0x218667){_0x198a0a=_0x218667;_0x280959=0xc8;}else{_0x280959=0xce;}_0x4dd5cf[_0x031b('0x17')](_0x280959);return _0x4dd5cf[_0x031b('0x1c')](_0x031b('0x1d'),_0x12fc29+'-'+_0x198a0a+'/'+_0x218667)[_0x031b('0x18')](_0x4cbd5b);}return null;};}function patchUpdates(_0x41f54c){return function(_0x275ed6){try{jsonpatch['apply'](_0x275ed6,_0x41f54c,!![]);}catch(_0x12bf9e){return BPromise[_0x031b('0x1e')](_0x12bf9e);}return _0x275ed6[_0x031b('0x1f')]();};}function saveUpdates(_0x2302d4,_0x480267){return function(_0x6b3518){if(_0x6b3518){return _0x6b3518[_0x031b('0x20')](_0x2302d4)[_0x031b('0x21')](function(_0x411716){return _0x411716;});}return null;};}function removeEntity(_0x38d490,_0xa51ad9){return function(_0x440eed){if(_0x440eed){return _0x440eed['destroy']()['then'](function(){_0x38d490[_0x031b('0x17')](0xcc)[_0x031b('0x22')]();});}};}function handleEntityNotFound(_0x4f6034,_0x4a13be){return function(_0x5a5ff9){if(!_0x5a5ff9){_0x4f6034[_0x031b('0x16')](0x194);}return _0x5a5ff9;};}function handleError(_0x297227,_0x266007){_0x266007=_0x266007||0x1f4;return function(_0x3e420d){logger['error'](_0x3e420d[_0x031b('0x23')]);if(_0x3e420d['name']){delete _0x3e420d['name'];}_0x297227[_0x031b('0x17')](_0x266007)[_0x031b('0x24')](_0x3e420d);};}exports[_0x031b('0x25')]=function(_0x503b1f,_0xb3ac92){var _0x495b6f={},_0x9b8642={},_0x4ad027={'count':0x0,'rows':[]};var _0x1f8e3c=_[_0x031b('0x26')](db['OpenchannelTransferReport'][_0x031b('0x27')],function(_0x9e728a){return{'name':_0x9e728a[_0x031b('0x28')],'type':_0x9e728a[_0x031b('0x29')][_0x031b('0x2a')]};});_0x9b8642[_0x031b('0x2b')]=_[_0x031b('0x26')](_0x1f8e3c,'name');_0x9b8642['query']=_[_0x031b('0x2c')](_0x503b1f['query']);_0x9b8642[_0x031b('0x2d')]=_[_0x031b('0x2e')](_0x9b8642[_0x031b('0x2b')],_0x9b8642[_0x031b('0x2f')]);_0x495b6f[_0x031b('0x30')]=_['intersection'](_0x9b8642['model'],qs[_0x031b('0x31')](_0x503b1f['query'][_0x031b('0x31')]));_0x495b6f[_0x031b('0x30')]=_0x495b6f[_0x031b('0x30')]['length']?_0x495b6f[_0x031b('0x30')]:_0x9b8642['model'];if(!_0x503b1f['query']['hasOwnProperty'](_0x031b('0x32'))){_0x495b6f['limit']=qs[_0x031b('0x1b')](_0x503b1f['query'][_0x031b('0x1b')]);_0x495b6f[_0x031b('0x1a')]=qs[_0x031b('0x1a')](_0x503b1f[_0x031b('0x2f')][_0x031b('0x1a')]);}_0x495b6f[_0x031b('0x33')]=qs['sort'](_0x503b1f[_0x031b('0x2f')][_0x031b('0x34')]);_0x495b6f[_0x031b('0x35')]=qs[_0x031b('0x2d')](_[_0x031b('0x36')](_0x503b1f['query'],_0x9b8642[_0x031b('0x2d')]),_0x1f8e3c);if(_0x503b1f['query']['filter']){_0x495b6f[_0x031b('0x35')]=_['merge'](_0x495b6f[_0x031b('0x35')],{'$or':_[_0x031b('0x26')](_0x1f8e3c,function(_0x366a05){if(_0x366a05['type']!==_0x031b('0x37')){var _0x3a124e={};_0x3a124e[_0x366a05[_0x031b('0x38')]]={'$like':'%'+_0x503b1f[_0x031b('0x2f')][_0x031b('0x39')]+'%'};return _0x3a124e;}})});}_0x495b6f=_[_0x031b('0x3a')]({},_0x495b6f,_0x503b1f['options']);var _0x490344={'where':_0x495b6f['where']};return db[_0x031b('0x3b')][_0x031b('0x19')](_0x490344)[_0x031b('0x21')](function(_0x201ad9){_0x4ad027[_0x031b('0x19')]=_0x201ad9;if(_0x503b1f[_0x031b('0x2f')][_0x031b('0x3c')]){_0x495b6f[_0x031b('0x3d')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x031b('0x3e')](_0x495b6f);})[_0x031b('0x21')](function(_0x12f793){_0x4ad027[_0x031b('0x3f')]=_0x12f793;return _0x4ad027;})[_0x031b('0x21')](respondWithFilteredResult(_0xb3ac92,_0x495b6f))['catch'](handleError(_0xb3ac92,null));};exports[_0x031b('0x40')]=function(_0x1e2ca4,_0x903f37){var _0x5fe035={'raw':!![],'where':{'id':_0x1e2ca4['params']['id']}},_0x7bee92={};_0x7bee92['model']=_[_0x031b('0x2c')](db[_0x031b('0x3b')]['rawAttributes']);_0x7bee92[_0x031b('0x2f')]=_[_0x031b('0x2c')](_0x1e2ca4['query']);_0x7bee92[_0x031b('0x2d')]=_[_0x031b('0x2e')](_0x7bee92['model'],_0x7bee92[_0x031b('0x2f')]);_0x5fe035[_0x031b('0x30')]=_['intersection'](_0x7bee92[_0x031b('0x2b')],qs[_0x031b('0x31')](_0x1e2ca4[_0x031b('0x2f')]['fields']));_0x5fe035[_0x031b('0x30')]=_0x5fe035[_0x031b('0x30')][_0x031b('0x41')]?_0x5fe035[_0x031b('0x30')]:_0x7bee92[_0x031b('0x2b')];if(_0x1e2ca4[_0x031b('0x2f')][_0x031b('0x3c')]){_0x5fe035[_0x031b('0x3d')]=[{'all':!![]}];}_0x5fe035=_[_0x031b('0x3a')]({},_0x5fe035,_0x1e2ca4['options']);return db[_0x031b('0x3b')][_0x031b('0x42')](_0x5fe035)['then'](handleEntityNotFound(_0x903f37,null))[_0x031b('0x21')](respondWithResult(_0x903f37,null))[_0x031b('0x43')](handleError(_0x903f37,null));};exports[_0x031b('0x44')]=function(_0x418fcb,_0x28b2b5){return db['OpenchannelTransferReport'][_0x031b('0x44')](_0x418fcb[_0x031b('0x45')],{})[_0x031b('0x21')](respondWithResult(_0x28b2b5,0xc9))[_0x031b('0x43')](handleError(_0x28b2b5,null));};exports[_0x031b('0x20')]=function(_0x20ea31,_0x44b610){if(_0x20ea31[_0x031b('0x45')]['id']){delete _0x20ea31[_0x031b('0x45')]['id'];}return db['OpenchannelTransferReport'][_0x031b('0x42')]({'where':{'id':_0x20ea31[_0x031b('0x46')]['id']}})['then'](handleEntityNotFound(_0x44b610,null))['then'](saveUpdates(_0x20ea31['body'],null))[_0x031b('0x21')](respondWithResult(_0x44b610,null))['catch'](handleError(_0x44b610,null));};exports[_0x031b('0x47')]=function(_0x1c515d,_0x3c6ecd){return db[_0x031b('0x3b')][_0x031b('0x42')]({'where':{'id':_0x1c515d[_0x031b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3c6ecd,null))[_0x031b('0x21')](removeEntity(_0x3c6ecd,null))[_0x031b('0x43')](handleError(_0x3c6ecd,null));};exports[_0x031b('0x48')]=function(_0x3b75f7,_0x36c16d){return db[_0x031b('0x3b')]['describe']()[_0x031b('0x21')](respondWithResult(_0x36c16d,null))[_0x031b('0x43')](handleError(_0x36c16d,null));}; \ No newline at end of file +var _0xf30e=['apply','reject','update','then','end','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','rows','show','params','fields','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf30e,0xc1));var _0xef30=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0xf30e[_0x7a3247];return _0x1bfde5;};'use strict';var emlformat=require(_0xef30('0x0'));var rimraf=require(_0xef30('0x1'));var zipdir=require(_0xef30('0x2'));var jsonpatch=require(_0xef30('0x3'));var rp=require(_0xef30('0x4'));var moment=require(_0xef30('0x5'));var BPromise=require(_0xef30('0x6'));var Mustache=require(_0xef30('0x7'));var util=require(_0xef30('0x8'));var path=require('path');var sox=require(_0xef30('0x9'));var csv=require('to-csv');var ejs=require(_0xef30('0xa'));var fs=require('fs');var fs_extra=require(_0xef30('0xb'));var _=require(_0xef30('0xc'));var squel=require(_0xef30('0xd'));var crypto=require(_0xef30('0xe'));var jsforce=require(_0xef30('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef30('0x10'));var qs=require(_0xef30('0x11'));var as=require(_0xef30('0x12'));var hardwareService=require(_0xef30('0x13'));var logger=require('../../config/logger')(_0xef30('0x14'));var utils=require(_0xef30('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xef30('0x16'));var db=require(_0xef30('0x17'))['db'];function respondWithStatusCode(_0x4ca552,_0x14039a){_0x14039a=_0x14039a||0xcc;return function(_0x151587){if(_0x151587){return _0x4ca552[_0xef30('0x18')](_0x14039a);}return _0x4ca552[_0xef30('0x19')](_0x14039a)['end']();};}function respondWithResult(_0x4aea9c,_0x56369d){_0x56369d=_0x56369d||0xc8;return function(_0x34b5c3){if(_0x34b5c3){return _0x4aea9c[_0xef30('0x19')](_0x56369d)['json'](_0x34b5c3);}};}function respondWithFilteredResult(_0x51b2f6,_0x38bee4){return function(_0x5eea55){if(_0x5eea55){var _0x52e21e=typeof _0x38bee4[_0xef30('0x1a')]===_0xef30('0x1b')&&typeof _0x38bee4['limit']===_0xef30('0x1b');var _0x4da26f=_0x5eea55[_0xef30('0x1c')];var _0x2393c8=_0x52e21e?0x0:_0x38bee4[_0xef30('0x1a')];var _0x52b959=_0x52e21e?_0x5eea55['count']:_0x38bee4['offset']+_0x38bee4[_0xef30('0x1d')];var _0x55cdf2;if(_0x52b959>=_0x4da26f){_0x52b959=_0x4da26f;_0x55cdf2=0xc8;}else{_0x55cdf2=0xce;}_0x51b2f6[_0xef30('0x19')](_0x55cdf2);return _0x51b2f6[_0xef30('0x1e')]('Content-Range',_0x2393c8+'-'+_0x52b959+'/'+_0x4da26f)[_0xef30('0x1f')](_0x5eea55);}return null;};}function patchUpdates(_0x38f439){return function(_0x24eee3){try{jsonpatch[_0xef30('0x20')](_0x24eee3,_0x38f439,!![]);}catch(_0x269533){return BPromise[_0xef30('0x21')](_0x269533);}return _0x24eee3['save']();};}function saveUpdates(_0x5348fe,_0x48dc1f){return function(_0x5e84de){if(_0x5e84de){return _0x5e84de[_0xef30('0x22')](_0x5348fe)[_0xef30('0x23')](function(_0x3e0e1d){return _0x3e0e1d;});}return null;};}function removeEntity(_0x1d0ae9,_0x3f5ff9){return function(_0x369b49){if(_0x369b49){return _0x369b49['destroy']()['then'](function(){_0x1d0ae9['status'](0xcc)[_0xef30('0x24')]();});}};}function handleEntityNotFound(_0x39fbfc,_0x265025){return function(_0x433bc9){if(!_0x433bc9){_0x39fbfc[_0xef30('0x18')](0x194);}return _0x433bc9;};}function handleError(_0x930410,_0x5846f2){_0x5846f2=_0x5846f2||0x1f4;return function(_0x2bdfa7){logger[_0xef30('0x25')](_0x2bdfa7['stack']);if(_0x2bdfa7[_0xef30('0x26')]){delete _0x2bdfa7[_0xef30('0x26')];}_0x930410[_0xef30('0x19')](_0x5846f2)[_0xef30('0x27')](_0x2bdfa7);};}exports['index']=function(_0x338024,_0x371ec9){var _0x1161f8={},_0x551b68={},_0x3d77e7={'count':0x0,'rows':[]};var _0x27fbcf=_[_0xef30('0x28')](db['OpenchannelTransferReport'][_0xef30('0x29')],function(_0x44b932){return{'name':_0x44b932[_0xef30('0x2a')],'type':_0x44b932['type'][_0xef30('0x2b')]};});_0x551b68[_0xef30('0x2c')]=_[_0xef30('0x28')](_0x27fbcf,_0xef30('0x26'));_0x551b68[_0xef30('0x2d')]=_[_0xef30('0x2e')](_0x338024[_0xef30('0x2d')]);_0x551b68[_0xef30('0x2f')]=_[_0xef30('0x30')](_0x551b68[_0xef30('0x2c')],_0x551b68[_0xef30('0x2d')]);_0x1161f8[_0xef30('0x31')]=_[_0xef30('0x30')](_0x551b68[_0xef30('0x2c')],qs['fields'](_0x338024[_0xef30('0x2d')]['fields']));_0x1161f8[_0xef30('0x31')]=_0x1161f8[_0xef30('0x31')][_0xef30('0x32')]?_0x1161f8[_0xef30('0x31')]:_0x551b68[_0xef30('0x2c')];if(!_0x338024[_0xef30('0x2d')][_0xef30('0x33')](_0xef30('0x34'))){_0x1161f8[_0xef30('0x1d')]=qs['limit'](_0x338024[_0xef30('0x2d')][_0xef30('0x1d')]);_0x1161f8[_0xef30('0x1a')]=qs[_0xef30('0x1a')](_0x338024[_0xef30('0x2d')][_0xef30('0x1a')]);}_0x1161f8[_0xef30('0x35')]=qs['sort'](_0x338024[_0xef30('0x2d')][_0xef30('0x36')]);_0x1161f8['where']=qs[_0xef30('0x2f')](_[_0xef30('0x37')](_0x338024[_0xef30('0x2d')],_0x551b68['filters']),_0x27fbcf);if(_0x338024[_0xef30('0x2d')]['filter']){_0x1161f8[_0xef30('0x38')]=_[_0xef30('0x39')](_0x1161f8[_0xef30('0x38')],{'$or':_[_0xef30('0x28')](_0x27fbcf,function(_0x1923f4){if(_0x1923f4[_0xef30('0x3a')]!==_0xef30('0x3b')){var _0x4d9d8f={};_0x4d9d8f[_0x1923f4[_0xef30('0x26')]]={'$like':'%'+_0x338024[_0xef30('0x2d')]['filter']+'%'};return _0x4d9d8f;}})});}_0x1161f8=_['merge']({},_0x1161f8,_0x338024[_0xef30('0x3c')]);var _0x2bbd7d={'where':_0x1161f8[_0xef30('0x38')]};return db[_0xef30('0x3d')][_0xef30('0x1c')](_0x2bbd7d)[_0xef30('0x23')](function(_0x3aba58){_0x3d77e7[_0xef30('0x1c')]=_0x3aba58;if(_0x338024[_0xef30('0x2d')][_0xef30('0x3e')]){_0x1161f8[_0xef30('0x3f')]=[{'all':!![]}];}return db[_0xef30('0x3d')][_0xef30('0x40')](_0x1161f8);})[_0xef30('0x23')](function(_0x155337){_0x3d77e7[_0xef30('0x41')]=_0x155337;return _0x3d77e7;})[_0xef30('0x23')](respondWithFilteredResult(_0x371ec9,_0x1161f8))['catch'](handleError(_0x371ec9,null));};exports[_0xef30('0x42')]=function(_0x30cc05,_0x4ba4cd){var _0x16b78a={'raw':!![],'where':{'id':_0x30cc05[_0xef30('0x43')]['id']}},_0x34d9b9={};_0x34d9b9['model']=_[_0xef30('0x2e')](db[_0xef30('0x3d')][_0xef30('0x29')]);_0x34d9b9['query']=_['keys'](_0x30cc05['query']);_0x34d9b9[_0xef30('0x2f')]=_[_0xef30('0x30')](_0x34d9b9[_0xef30('0x2c')],_0x34d9b9[_0xef30('0x2d')]);_0x16b78a[_0xef30('0x31')]=_['intersection'](_0x34d9b9[_0xef30('0x2c')],qs[_0xef30('0x44')](_0x30cc05['query']['fields']));_0x16b78a['attributes']=_0x16b78a[_0xef30('0x31')][_0xef30('0x32')]?_0x16b78a['attributes']:_0x34d9b9[_0xef30('0x2c')];if(_0x30cc05[_0xef30('0x2d')][_0xef30('0x3e')]){_0x16b78a['include']=[{'all':!![]}];}_0x16b78a=_[_0xef30('0x39')]({},_0x16b78a,_0x30cc05[_0xef30('0x3c')]);return db[_0xef30('0x3d')][_0xef30('0x45')](_0x16b78a)['then'](handleEntityNotFound(_0x4ba4cd,null))[_0xef30('0x23')](respondWithResult(_0x4ba4cd,null))['catch'](handleError(_0x4ba4cd,null));};exports['create']=function(_0x2ebfd3,_0x31bbd6){return db[_0xef30('0x3d')][_0xef30('0x46')](_0x2ebfd3['body'],{})['then'](respondWithResult(_0x31bbd6,0xc9))['catch'](handleError(_0x31bbd6,null));};exports[_0xef30('0x22')]=function(_0x4d882d,_0x2933dd){if(_0x4d882d[_0xef30('0x47')]['id']){delete _0x4d882d[_0xef30('0x47')]['id'];}return db[_0xef30('0x3d')][_0xef30('0x45')]({'where':{'id':_0x4d882d[_0xef30('0x43')]['id']}})[_0xef30('0x23')](handleEntityNotFound(_0x2933dd,null))['then'](saveUpdates(_0x4d882d[_0xef30('0x47')],null))[_0xef30('0x23')](respondWithResult(_0x2933dd,null))[_0xef30('0x48')](handleError(_0x2933dd,null));};exports[_0xef30('0x49')]=function(_0x2753a5,_0x3ca73a){return db[_0xef30('0x3d')]['find']({'where':{'id':_0x2753a5[_0xef30('0x43')]['id']}})[_0xef30('0x23')](handleEntityNotFound(_0x3ca73a,null))[_0xef30('0x23')](removeEntity(_0x3ca73a,null))[_0xef30('0x48')](handleError(_0x3ca73a,null));};exports[_0xef30('0x4a')]=function(_0x149b5a,_0x564e3e){return db[_0xef30('0x3d')][_0xef30('0x4a')]()[_0xef30('0x23')](respondWithResult(_0x564e3e,null))['catch'](handleError(_0x564e3e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 62d905d..09e1cc1 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 _0xcbc1=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','path','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x186550,_0x26f3ee){var _0x4b4c70=function(_0x2e255e){while(--_0x2e255e){_0x186550['push'](_0x186550['shift']());}};_0x4b4c70(++_0x26f3ee);}(_0xcbc1,0x1a7));var _0x1cbc=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0xcbc1[_0x3cf387];return _0x24425f;};'use strict';var _=require(_0x1cbc('0x0'));var util=require(_0x1cbc('0x1'));var logger=require('../../config/logger')(_0x1cbc('0x2'));var moment=require(_0x1cbc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cbc('0x4'));var rimraf=require('rimraf');var config=require(_0x1cbc('0x5'));var attributes=require(_0x1cbc('0x6'));module[_0x1cbc('0x7')]=function(_0xc58f38,_0x4315c4){return _0xc58f38[_0x1cbc('0x8')](_0x1cbc('0x9'),attributes,{'tableName':_0x1cbc('0xa'),'paranoid':![],'indexes':[{'name':_0x1cbc('0xb'),'fields':[_0x1cbc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed4d=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','./openchannelTransferReport.attributes','OpenchannelTransferReport'];(function(_0xf738ad,_0x5e1d7f){var _0x598570=function(_0x35088e){while(--_0x35088e){_0xf738ad['push'](_0xf738ad['shift']());}};_0x598570(++_0x5e1d7f);}(_0xed4d,0xb6));var _0xded4=function(_0x37c541,_0x13c53a){_0x37c541=_0x37c541-0x0;var _0x5321d8=_0xed4d[_0x37c541];return _0x5321d8;};'use strict';var _=require(_0xded4('0x0'));var util=require(_0xded4('0x1'));var logger=require(_0xded4('0x2'))('api');var moment=require(_0xded4('0x3'));var BPromise=require('bluebird');var rp=require(_0xded4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xded4('0x5'));module['exports']=function(_0x55fba3,_0x511e11){return _0x55fba3['define'](_0xded4('0x6'),attributes,{'tableName':_0xded4('0x7'),'paranoid':![],'indexes':[{'name':_0xded4('0x8'),'fields':[_0xded4('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 34f7075..72867da 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 _0xeedf=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x3dea8b,_0x231a01){var _0x3a511e=function(_0x5a946d){while(--_0x5a946d){_0x3dea8b['push'](_0x3dea8b['shift']());}};_0x3a511e(++_0x231a01);}(_0xeedf,0x12c));var _0xfeed=function(_0x1118f3,_0x590086){_0x1118f3=_0x1118f3-0x0;var _0x4837fe=_0xeedf[_0x1118f3];return _0x4837fe;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var moment=require(_0xfeed('0x2'));var BPromise=require('bluebird');var rs=require(_0xfeed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfeed('0x4'))['db'];var utils=require(_0xfeed('0x5'));var logger=require(_0xfeed('0x6'))(_0xfeed('0x7'));var config=require('../../config/environment');var jayson=require(_0xfeed('0x8'));var client=jayson[_0xfeed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19f2de,_0x52286c,_0x22fd66){return new BPromise(function(_0x5c147d,_0x124bdf){return client['request'](_0x19f2de,_0x22fd66)['then'](function(_0x5163e7){logger[_0xfeed('0xa')](_0xfeed('0xb'),_0x52286c,_0xfeed('0xc'));logger[_0xfeed('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x52286c,_0xfeed('0xc'),JSON[_0xfeed('0xe')](_0x5163e7));if(_0x5163e7[_0xfeed('0xf')]){if(_0x5163e7[_0xfeed('0xf')]['code']===0x1f4){logger['error'](_0xfeed('0xb'),_0x52286c,_0x5163e7[_0xfeed('0xf')][_0xfeed('0x10')]);return _0x124bdf(_0x5163e7[_0xfeed('0xf')][_0xfeed('0x10')]);}logger[_0xfeed('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x52286c,_0x5163e7[_0xfeed('0xf')][_0xfeed('0x10')]);return _0x5c147d(_0x5163e7[_0xfeed('0xf')][_0xfeed('0x10')]);}else{logger[_0xfeed('0xa')](_0xfeed('0xb'),_0x52286c,_0xfeed('0xc'));_0x5c147d(_0x5163e7[_0xfeed('0x11')][_0xfeed('0x10')]);}})[_0xfeed('0x12')](function(_0x17eb91){logger[_0xfeed('0xf')](_0xfeed('0xb'),_0x52286c,_0x17eb91);_0x124bdf(_0x17eb91);});});} \ No newline at end of file +var _0x85d0=['../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2b2191,_0x1a52aa){var _0x390958=function(_0x588440){while(--_0x588440){_0x2b2191['push'](_0x2b2191['shift']());}};_0x390958(++_0x1a52aa);}(_0x85d0,0x164));var _0x085d=function(_0x427d22,_0x59de4d){_0x427d22=_0x427d22-0x0;var _0x5450c6=_0x85d0[_0x427d22];return _0x5450c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x085d('0x0'));var fs=require('fs');var Redis=require(_0x085d('0x1'));var db=require(_0x085d('0x2'))['db'];var utils=require(_0x085d('0x3'));var logger=require(_0x085d('0x4'))(_0x085d('0x5'));var config=require('../../config/environment');var jayson=require(_0x085d('0x6'));var client=jayson['client'][_0x085d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9acc97,_0x2a6902,_0x4a12b7){return new BPromise(function(_0xf65d01,_0xa94124){return client[_0x085d('0x8')](_0x9acc97,_0x4a12b7)[_0x085d('0x9')](function(_0x349271){logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));logger[_0x085d('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2a6902,_0x085d('0xc'),JSON[_0x085d('0xe')](_0x349271));if(_0x349271[_0x085d('0xf')]){if(_0x349271[_0x085d('0xf')]['code']===0x1f4){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x349271['error'][_0x085d('0x10')]);return _0xa94124(_0x349271[_0x085d('0xf')][_0x085d('0x10')]);}logger[_0x085d('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2a6902,_0x349271[_0x085d('0xf')][_0x085d('0x10')]);return _0xf65d01(_0x349271['error']['message']);}else{logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));_0xf65d01(_0x349271[_0x085d('0x11')][_0x085d('0x10')]);}})['catch'](function(_0x2b29be){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x2b29be);_0xa94124(_0x2b29be);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 62944bb..bb83de4 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 _0xb714=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x10868c,_0x565ca8){var _0x40a899=function(_0x4062e4){while(--_0x4062e4){_0x10868c['push'](_0x10868c['shift']());}};_0x40a899(++_0x565ca8);}(_0xb714,0xf1));var _0x4b71=function(_0x3027b0,_0x5dd103){_0x3027b0=_0x3027b0-0x0;var _0x14bac4=_0xb714[_0x3027b0];return _0x14bac4;};'use strict';var multer=require(_0x4b71('0x0'));var util=require(_0x4b71('0x1'));var path=require(_0x4b71('0x2'));var timeout=require(_0x4b71('0x3'));var express=require(_0x4b71('0x4'));var router=express[_0x4b71('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b71('0x6'));var config=require(_0x4b71('0x7'));var controller=require(_0x4b71('0x8'));router[_0x4b71('0x9')]('/',auth[_0x4b71('0xa')](),controller['index']);router[_0x4b71('0x9')](_0x4b71('0xb'),auth['isAuthenticated'](),controller[_0x4b71('0xc')]);router[_0x4b71('0xd')]('/',auth[_0x4b71('0xa')](),controller[_0x4b71('0xe')]);router[_0x4b71('0xf')](_0x4b71('0xb'),auth[_0x4b71('0xa')](),controller[_0x4b71('0x10')]);router['delete']('/:id',auth[_0x4b71('0xa')](),controller[_0x4b71('0x11')]);module[_0x4b71('0x12')]=router; \ No newline at end of file +var _0x15ac=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x373222,_0x5a4d08){var _0x10f86e=function(_0x49f448){while(--_0x49f448){_0x373222['push'](_0x373222['shift']());}};_0x10f86e(++_0x5a4d08);}(_0x15ac,0x68));var _0xc15a=function(_0x40a9c5,_0x10af6a){_0x40a9c5=_0x40a9c5-0x0;var _0x4ab17d=_0x15ac[_0x40a9c5];return _0x4ab17d;};'use strict';var multer=require(_0xc15a('0x0'));var util=require(_0xc15a('0x1'));var path=require(_0xc15a('0x2'));var timeout=require(_0xc15a('0x3'));var express=require(_0xc15a('0x4'));var router=express[_0xc15a('0x5')]();var fs_extra=require(_0xc15a('0x6'));var auth=require(_0xc15a('0x7'));var interaction=require(_0xc15a('0x8'));var config=require(_0xc15a('0x9'));var controller=require(_0xc15a('0xa'));router[_0xc15a('0xb')]('/',auth[_0xc15a('0xc')](),controller[_0xc15a('0xd')]);router[_0xc15a('0xb')](_0xc15a('0xe'),auth[_0xc15a('0xc')](),controller[_0xc15a('0xf')]);router[_0xc15a('0x10')]('/',auth[_0xc15a('0xc')](),controller[_0xc15a('0x11')]);router['put']('/:id',auth[_0xc15a('0xc')](),controller[_0xc15a('0x12')]);router[_0xc15a('0x13')](_0xc15a('0xe'),auth[_0xc15a('0xc')](),controller[_0xc15a('0x14')]);module[_0xc15a('0x15')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 041cc5f..6597f82 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 _0x6a00=['STRING','name','exports'];(function(_0x370359,_0x58b344){var _0x399817=function(_0x54f64c){while(--_0x54f64c){_0x370359['push'](_0x370359['shift']());}};_0x399817(++_0x58b344);}(_0x6a00,0x191));var _0x06a0=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x6a00[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require('sequelize');module[_0x06a0('0x0')]={'name':{'type':Sequelize[_0x06a0('0x1')],'unique':_0x06a0('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x06a0('0x1')]}}; \ No newline at end of file +var _0xecb2=['name','sequelize','exports','STRING'];(function(_0x15aa6b,_0x2de48c){var _0x61e8=function(_0x21df49){while(--_0x21df49){_0x15aa6b['push'](_0x15aa6b['shift']());}};_0x61e8(++_0x2de48c);}(_0xecb2,0xa5));var _0x2ecb=function(_0xbcf41e,_0x2d0f39){_0xbcf41e=_0xbcf41e-0x0;var _0x5675ce=_0xecb2[_0xbcf41e];return _0x5675ce;};'use strict';var Sequelize=require(_0x2ecb('0x0'));module[_0x2ecb('0x1')]={'name':{'type':Sequelize[_0x2ecb('0x2')],'unique':_0x2ecb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2ecb('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 27e5e0c..d2548e9 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 _0x9304=['Content-Range','apply','reject','save','then','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count'];(function(_0x226311,_0x4cfd1e){var _0x2583ad=function(_0x13df1f){while(--_0x13df1f){_0x226311['push'](_0x226311['shift']());}};_0x2583ad(++_0x4cfd1e);}(_0x9304,0x1af));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4930('0x0'));var rimraf=require(_0x4930('0x1'));var zipdir=require(_0x4930('0x2'));var jsonpatch=require(_0x4930('0x3'));var rp=require(_0x4930('0x4'));var moment=require(_0x4930('0x5'));var BPromise=require(_0x4930('0x6'));var Mustache=require(_0x4930('0x7'));var util=require(_0x4930('0x8'));var path=require(_0x4930('0x9'));var sox=require('sox');var csv=require(_0x4930('0xa'));var ejs=require(_0x4930('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4930('0xc'));var squel=require('squel');var crypto=require(_0x4930('0xd'));var jsforce=require(_0x4930('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4930('0xf'));var Redis=require(_0x4930('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4930('0x11'));var as=require(_0x4930('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4930('0x13'))(_0x4930('0x14'));var utils=require(_0x4930('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4930('0x16'));var db=require(_0x4930('0x17'))['db'];function respondWithStatusCode(_0x5a3281,_0x210419){_0x210419=_0x210419||0xcc;return function(_0x177148){if(_0x177148){return _0x5a3281[_0x4930('0x18')](_0x210419);}return _0x5a3281['status'](_0x210419)[_0x4930('0x19')]();};}function respondWithResult(_0x28ddd3,_0x4bf84c){_0x4bf84c=_0x4bf84c||0xc8;return function(_0x50cd0f){if(_0x50cd0f){return _0x28ddd3[_0x4930('0x1a')](_0x4bf84c)[_0x4930('0x1b')](_0x50cd0f);}};}function respondWithFilteredResult(_0x149ca9,_0x68af1c){return function(_0x386258){if(_0x386258){var _0xfe5e4f=typeof _0x68af1c[_0x4930('0x1c')]==='undefined'&&typeof _0x68af1c[_0x4930('0x1d')]==='undefined';var _0x125016=_0x386258[_0x4930('0x1e')];var _0x42b8af=_0xfe5e4f?0x0:_0x68af1c['offset'];var _0x403082=_0xfe5e4f?_0x386258[_0x4930('0x1e')]:_0x68af1c[_0x4930('0x1c')]+_0x68af1c[_0x4930('0x1d')];var _0x1d6f88;if(_0x403082>=_0x125016){_0x403082=_0x125016;_0x1d6f88=0xc8;}else{_0x1d6f88=0xce;}_0x149ca9['status'](_0x1d6f88);return _0x149ca9['set'](_0x4930('0x1f'),_0x42b8af+'-'+_0x403082+'/'+_0x125016)[_0x4930('0x1b')](_0x386258);}return null;};}function patchUpdates(_0x3c2471){return function(_0x20f119){try{jsonpatch[_0x4930('0x20')](_0x20f119,_0x3c2471,!![]);}catch(_0x7be832){return BPromise[_0x4930('0x21')](_0x7be832);}return _0x20f119[_0x4930('0x22')]();};}function saveUpdates(_0x41e23e,_0x5c936f){return function(_0x436fc4){if(_0x436fc4){return _0x436fc4['update'](_0x41e23e)[_0x4930('0x23')](function(_0x59a112){return _0x59a112;});}return null;};}function removeEntity(_0x18ab77,_0x470f50){return function(_0x4e4721){if(_0x4e4721){return _0x4e4721['destroy']()[_0x4930('0x23')](function(){var _0x3aaddb=_0x4e4721[_0x4930('0x24')]({'plain':!![]});var _0x17afdd=_0x4930('0x25');return db[_0x4930('0x26')]['destroy']({'where':{'type':_0x17afdd,'resourceId':_0x3aaddb['id']}})[_0x4930('0x23')](function(){return _0x4e4721;});})[_0x4930('0x23')](function(){_0x18ab77[_0x4930('0x1a')](0xcc)[_0x4930('0x19')]();});}};}function handleEntityNotFound(_0xef05df,_0x15fedb){return function(_0x269ffb){if(!_0x269ffb){_0xef05df[_0x4930('0x18')](0x194);}return _0x269ffb;};}function handleError(_0x41988d,_0x174a1b){_0x174a1b=_0x174a1b||0x1f4;return function(_0x153b65){logger[_0x4930('0x27')](_0x153b65[_0x4930('0x28')]);if(_0x153b65['name']){delete _0x153b65[_0x4930('0x29')];}_0x41988d[_0x4930('0x1a')](_0x174a1b)[_0x4930('0x2a')](_0x153b65);};}exports[_0x4930('0x2b')]=function(_0x4a8c47,_0x56a162){var _0x2f7bd9={},_0x44f250={},_0x363a4f={'count':0x0,'rows':[]};var _0x4fa200=_[_0x4930('0x2c')](db[_0x4930('0x2d')]['rawAttributes'],function(_0x8edac8){return{'name':_0x8edac8['fieldName'],'type':_0x8edac8['type'][_0x4930('0x2e')]};});_0x44f250[_0x4930('0x2f')]=_[_0x4930('0x2c')](_0x4fa200,_0x4930('0x29'));_0x44f250[_0x4930('0x30')]=_[_0x4930('0x31')](_0x4a8c47[_0x4930('0x30')]);_0x44f250[_0x4930('0x32')]=_[_0x4930('0x33')](_0x44f250['model'],_0x44f250[_0x4930('0x30')]);_0x2f7bd9[_0x4930('0x34')]=_[_0x4930('0x33')](_0x44f250[_0x4930('0x2f')],qs[_0x4930('0x35')](_0x4a8c47[_0x4930('0x30')]['fields']));_0x2f7bd9[_0x4930('0x34')]=_0x2f7bd9[_0x4930('0x34')]['length']?_0x2f7bd9[_0x4930('0x34')]:_0x44f250[_0x4930('0x2f')];if(!_0x4a8c47['query'][_0x4930('0x36')]('nolimit')){_0x2f7bd9[_0x4930('0x1d')]=qs[_0x4930('0x1d')](_0x4a8c47['query'][_0x4930('0x1d')]);_0x2f7bd9[_0x4930('0x1c')]=qs[_0x4930('0x1c')](_0x4a8c47[_0x4930('0x30')]['offset']);}_0x2f7bd9[_0x4930('0x37')]=qs[_0x4930('0x38')](_0x4a8c47[_0x4930('0x30')][_0x4930('0x38')]);_0x2f7bd9[_0x4930('0x39')]=qs['filters'](_[_0x4930('0x3a')](_0x4a8c47[_0x4930('0x30')],_0x44f250[_0x4930('0x32')]),_0x4fa200);if(_0x4a8c47[_0x4930('0x30')][_0x4930('0x3b')]){_0x2f7bd9['where']=_[_0x4930('0x3c')](_0x2f7bd9[_0x4930('0x39')],{'$or':_[_0x4930('0x2c')](_0x4fa200,function(_0x5365cc){if(_0x5365cc[_0x4930('0x3d')]!==_0x4930('0x3e')){var _0xe2c358={};_0xe2c358[_0x5365cc[_0x4930('0x29')]]={'$like':'%'+_0x4a8c47['query']['filter']+'%'};return _0xe2c358;}})});}_0x2f7bd9=_[_0x4930('0x3c')]({},_0x2f7bd9,_0x4a8c47[_0x4930('0x3f')]);var _0x3c97fe={'where':_0x2f7bd9[_0x4930('0x39')]};return db[_0x4930('0x2d')]['count'](_0x3c97fe)[_0x4930('0x23')](function(_0x56226d){_0x363a4f[_0x4930('0x1e')]=_0x56226d;if(_0x4a8c47[_0x4930('0x30')][_0x4930('0x40')]){_0x2f7bd9[_0x4930('0x41')]=[{'all':!![]}];}return db[_0x4930('0x2d')]['findAll'](_0x2f7bd9);})[_0x4930('0x23')](function(_0x101b62){_0x363a4f['rows']=_0x101b62;return _0x363a4f;})[_0x4930('0x23')](respondWithFilteredResult(_0x56a162,_0x2f7bd9))[_0x4930('0x42')](handleError(_0x56a162,null));};exports[_0x4930('0x43')]=function(_0x5c4dea,_0x53e727){var _0x4c438e={'raw':!![],'where':{'id':_0x5c4dea['params']['id']}},_0x4571e9={};_0x4571e9[_0x4930('0x2f')]=_[_0x4930('0x31')](db['Pause'][_0x4930('0x44')]);_0x4571e9[_0x4930('0x30')]=_[_0x4930('0x31')](_0x5c4dea[_0x4930('0x30')]);_0x4571e9[_0x4930('0x32')]=_['intersection'](_0x4571e9[_0x4930('0x2f')],_0x4571e9[_0x4930('0x30')]);_0x4c438e[_0x4930('0x34')]=_['intersection'](_0x4571e9[_0x4930('0x2f')],qs[_0x4930('0x35')](_0x5c4dea['query'][_0x4930('0x35')]));_0x4c438e['attributes']=_0x4c438e[_0x4930('0x34')][_0x4930('0x45')]?_0x4c438e['attributes']:_0x4571e9[_0x4930('0x2f')];if(_0x5c4dea[_0x4930('0x30')][_0x4930('0x40')]){_0x4c438e[_0x4930('0x41')]=[{'all':!![]}];}_0x4c438e=_['merge']({},_0x4c438e,_0x5c4dea['options']);return db['Pause']['find'](_0x4c438e)[_0x4930('0x23')](handleEntityNotFound(_0x53e727,null))['then'](respondWithResult(_0x53e727,null))[_0x4930('0x42')](handleError(_0x53e727,null));};exports[_0x4930('0x46')]=function(_0x270666,_0x5029f6){return db[_0x4930('0x2d')][_0x4930('0x46')](_0x270666[_0x4930('0x47')],{})[_0x4930('0x23')](function(_0xd129e2){var _0xd01d4e=_0x270666['user']['get']({'plain':!![]});if(!_0xd01d4e)throw new Error(_0x4930('0x48'));if(_0xd01d4e['role']==='user'){var _0x11383f=_0xd129e2[_0x4930('0x24')]({'plain':!![]});var _0x23e446=_0x4930('0x25');return db['UserProfileSection'][_0x4930('0x49')]({'where':{'name':_0x23e446,'userProfileId':_0xd01d4e[_0x4930('0x4a')]},'raw':!![]})[_0x4930('0x23')](function(_0x251505){if(_0x251505&&_0x251505['autoAssociation']===0x0){return db[_0x4930('0x26')][_0x4930('0x46')]({'name':_0x11383f['name'],'resourceId':_0x11383f['id'],'type':_0x251505[_0x4930('0x29')],'sectionId':_0x251505['id']},{})['then'](function(){return _0xd129e2;});}else{return _0xd129e2;}})['catch'](function(_0x1eaffb){logger[_0x4930('0x27')](_0x4930('0x4b'),_0x1eaffb);throw _0x1eaffb;});}return _0xd129e2;})[_0x4930('0x23')](respondWithResult(_0x5029f6,0xc9))[_0x4930('0x42')](handleError(_0x5029f6,null));};exports['update']=function(_0x162920,_0x1d56e7){if(_0x162920['body']['id']){delete _0x162920[_0x4930('0x47')]['id'];}return db[_0x4930('0x2d')][_0x4930('0x49')]({'where':{'id':_0x162920[_0x4930('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d56e7,null))[_0x4930('0x23')](saveUpdates(_0x162920['body'],null))[_0x4930('0x23')](respondWithResult(_0x1d56e7,null))[_0x4930('0x42')](handleError(_0x1d56e7,null));};exports['destroy']=function(_0x28dbf5,_0x15b411){return db[_0x4930('0x2d')][_0x4930('0x49')]({'where':{'id':_0x28dbf5['params']['id']}})[_0x4930('0x23')](handleEntityNotFound(_0x15b411,null))[_0x4930('0x23')](removeEntity(_0x15b411,null))[_0x4930('0x42')](handleError(_0x15b411,null));}; \ No newline at end of file +var _0x1a66=['include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x4b2667,_0x53659c){var _0x3ba2f7=function(_0x1cb2e6){while(--_0x1cb2e6){_0x4b2667['push'](_0x4b2667['shift']());}};_0x3ba2f7(++_0x53659c);}(_0x1a66,0x69));var _0x61a6=function(_0x5241a8,_0x32fa8e){_0x5241a8=_0x5241a8-0x0;var _0x4563f3=_0x1a66[_0x5241a8];return _0x4563f3;};'use strict';var emlformat=require(_0x61a6('0x0'));var rimraf=require(_0x61a6('0x1'));var zipdir=require(_0x61a6('0x2'));var jsonpatch=require(_0x61a6('0x3'));var rp=require('request-promise');var moment=require(_0x61a6('0x4'));var BPromise=require(_0x61a6('0x5'));var Mustache=require(_0x61a6('0x6'));var util=require('util');var path=require(_0x61a6('0x7'));var sox=require(_0x61a6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61a6('0x9'));var _=require(_0x61a6('0xa'));var squel=require(_0x61a6('0xb'));var crypto=require(_0x61a6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x61a6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x61a6('0xe'));var Papa=require(_0x61a6('0xf'));var Redis=require(_0x61a6('0x10'));var authService=require(_0x61a6('0x11'));var qs=require(_0x61a6('0x12'));var as=require(_0x61a6('0x13'));var hardwareService=require(_0x61a6('0x14'));var logger=require(_0x61a6('0x15'))(_0x61a6('0x16'));var utils=require(_0x61a6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x61a6('0x18'))['db'];function respondWithStatusCode(_0x2e4185,_0x5a7a19){_0x5a7a19=_0x5a7a19||0xcc;return function(_0x4231ff){if(_0x4231ff){return _0x2e4185[_0x61a6('0x19')](_0x5a7a19);}return _0x2e4185[_0x61a6('0x1a')](_0x5a7a19)[_0x61a6('0x1b')]();};}function respondWithResult(_0x7ebd42,_0x128372){_0x128372=_0x128372||0xc8;return function(_0x5683ac){if(_0x5683ac){return _0x7ebd42[_0x61a6('0x1a')](_0x128372)[_0x61a6('0x1c')](_0x5683ac);}};}function respondWithFilteredResult(_0x483533,_0x228ef2){return function(_0x22cbc1){if(_0x22cbc1){var _0x11fa91=typeof _0x228ef2[_0x61a6('0x1d')]===_0x61a6('0x1e')&&typeof _0x228ef2['limit']===_0x61a6('0x1e');var _0x586273=_0x22cbc1['count'];var _0x35492f=_0x11fa91?0x0:_0x228ef2[_0x61a6('0x1d')];var _0x26700b=_0x11fa91?_0x22cbc1[_0x61a6('0x1f')]:_0x228ef2[_0x61a6('0x1d')]+_0x228ef2[_0x61a6('0x20')];var _0x564c97;if(_0x26700b>=_0x586273){_0x26700b=_0x586273;_0x564c97=0xc8;}else{_0x564c97=0xce;}_0x483533['status'](_0x564c97);return _0x483533[_0x61a6('0x21')](_0x61a6('0x22'),_0x35492f+'-'+_0x26700b+'/'+_0x586273)[_0x61a6('0x1c')](_0x22cbc1);}return null;};}function patchUpdates(_0x15d073){return function(_0x302db8){try{jsonpatch['apply'](_0x302db8,_0x15d073,!![]);}catch(_0x1aa014){return BPromise[_0x61a6('0x23')](_0x1aa014);}return _0x302db8[_0x61a6('0x24')]();};}function saveUpdates(_0x44a922,_0x3b8169){return function(_0x5ecb67){if(_0x5ecb67){return _0x5ecb67[_0x61a6('0x25')](_0x44a922)[_0x61a6('0x26')](function(_0x2e0702){return _0x2e0702;});}return null;};}function removeEntity(_0x33ddc9,_0x33c967){return function(_0x57176f){if(_0x57176f){return _0x57176f[_0x61a6('0x27')]()[_0x61a6('0x26')](function(){var _0x5ced58=_0x57176f[_0x61a6('0x28')]({'plain':!![]});var _0x4608fa='Pauses';return db[_0x61a6('0x29')]['destroy']({'where':{'type':_0x4608fa,'resourceId':_0x5ced58['id']}})['then'](function(){return _0x57176f;});})[_0x61a6('0x26')](function(){_0x33ddc9[_0x61a6('0x1a')](0xcc)[_0x61a6('0x1b')]();});}};}function handleEntityNotFound(_0x5e7c81,_0x5aa35f){return function(_0x40c1d5){if(!_0x40c1d5){_0x5e7c81['sendStatus'](0x194);}return _0x40c1d5;};}function handleError(_0x51ce79,_0x20c019){_0x20c019=_0x20c019||0x1f4;return function(_0x255f75){logger['error'](_0x255f75['stack']);if(_0x255f75['name']){delete _0x255f75[_0x61a6('0x2a')];}_0x51ce79['status'](_0x20c019)[_0x61a6('0x2b')](_0x255f75);};}exports[_0x61a6('0x2c')]=function(_0x2dff4f,_0x37539e){var _0x233a21={},_0x3d9d2d={},_0x5d9658={'count':0x0,'rows':[]};var _0x51494c=_[_0x61a6('0x2d')](db[_0x61a6('0x2e')][_0x61a6('0x2f')],function(_0x231ab0){return{'name':_0x231ab0[_0x61a6('0x30')],'type':_0x231ab0[_0x61a6('0x31')][_0x61a6('0x32')]};});_0x3d9d2d[_0x61a6('0x33')]=_[_0x61a6('0x2d')](_0x51494c,_0x61a6('0x2a'));_0x3d9d2d[_0x61a6('0x34')]=_[_0x61a6('0x35')](_0x2dff4f[_0x61a6('0x34')]);_0x3d9d2d[_0x61a6('0x36')]=_[_0x61a6('0x37')](_0x3d9d2d['model'],_0x3d9d2d[_0x61a6('0x34')]);_0x233a21[_0x61a6('0x38')]=_[_0x61a6('0x37')](_0x3d9d2d[_0x61a6('0x33')],qs[_0x61a6('0x39')](_0x2dff4f[_0x61a6('0x34')]['fields']));_0x233a21[_0x61a6('0x38')]=_0x233a21[_0x61a6('0x38')][_0x61a6('0x3a')]?_0x233a21[_0x61a6('0x38')]:_0x3d9d2d[_0x61a6('0x33')];if(!_0x2dff4f[_0x61a6('0x34')][_0x61a6('0x3b')](_0x61a6('0x3c'))){_0x233a21['limit']=qs[_0x61a6('0x20')](_0x2dff4f[_0x61a6('0x34')][_0x61a6('0x20')]);_0x233a21[_0x61a6('0x1d')]=qs['offset'](_0x2dff4f['query'][_0x61a6('0x1d')]);}_0x233a21[_0x61a6('0x3d')]=qs[_0x61a6('0x3e')](_0x2dff4f['query'][_0x61a6('0x3e')]);_0x233a21[_0x61a6('0x3f')]=qs[_0x61a6('0x36')](_[_0x61a6('0x40')](_0x2dff4f[_0x61a6('0x34')],_0x3d9d2d[_0x61a6('0x36')]),_0x51494c);if(_0x2dff4f[_0x61a6('0x34')][_0x61a6('0x41')]){_0x233a21[_0x61a6('0x3f')]=_[_0x61a6('0x42')](_0x233a21[_0x61a6('0x3f')],{'$or':_[_0x61a6('0x2d')](_0x51494c,function(_0x96e3fe){if(_0x96e3fe[_0x61a6('0x31')]!==_0x61a6('0x43')){var _0x4dc14f={};_0x4dc14f[_0x96e3fe[_0x61a6('0x2a')]]={'$like':'%'+_0x2dff4f[_0x61a6('0x34')][_0x61a6('0x41')]+'%'};return _0x4dc14f;}})});}_0x233a21=_['merge']({},_0x233a21,_0x2dff4f[_0x61a6('0x44')]);var _0x5a5627={'where':_0x233a21['where']};return db[_0x61a6('0x2e')]['count'](_0x5a5627)[_0x61a6('0x26')](function(_0x41c31f){_0x5d9658[_0x61a6('0x1f')]=_0x41c31f;if(_0x2dff4f['query']['includeAll']){_0x233a21[_0x61a6('0x45')]=[{'all':!![]}];}return db[_0x61a6('0x2e')][_0x61a6('0x46')](_0x233a21);})[_0x61a6('0x26')](function(_0x5b9833){_0x5d9658['rows']=_0x5b9833;return _0x5d9658;})[_0x61a6('0x26')](respondWithFilteredResult(_0x37539e,_0x233a21))[_0x61a6('0x47')](handleError(_0x37539e,null));};exports[_0x61a6('0x48')]=function(_0xfbad72,_0x553662){var _0x35d492={'raw':!![],'where':{'id':_0xfbad72[_0x61a6('0x49')]['id']}},_0x2454e4={};_0x2454e4['model']=_[_0x61a6('0x35')](db[_0x61a6('0x2e')][_0x61a6('0x2f')]);_0x2454e4[_0x61a6('0x34')]=_['keys'](_0xfbad72['query']);_0x2454e4[_0x61a6('0x36')]=_[_0x61a6('0x37')](_0x2454e4[_0x61a6('0x33')],_0x2454e4['query']);_0x35d492[_0x61a6('0x38')]=_[_0x61a6('0x37')](_0x2454e4[_0x61a6('0x33')],qs[_0x61a6('0x39')](_0xfbad72[_0x61a6('0x34')][_0x61a6('0x39')]));_0x35d492[_0x61a6('0x38')]=_0x35d492[_0x61a6('0x38')][_0x61a6('0x3a')]?_0x35d492[_0x61a6('0x38')]:_0x2454e4[_0x61a6('0x33')];if(_0xfbad72[_0x61a6('0x34')][_0x61a6('0x4a')]){_0x35d492[_0x61a6('0x45')]=[{'all':!![]}];}_0x35d492=_[_0x61a6('0x42')]({},_0x35d492,_0xfbad72[_0x61a6('0x44')]);return db['Pause'][_0x61a6('0x4b')](_0x35d492)[_0x61a6('0x26')](handleEntityNotFound(_0x553662,null))['then'](respondWithResult(_0x553662,null))[_0x61a6('0x47')](handleError(_0x553662,null));};exports[_0x61a6('0x4c')]=function(_0x1c5a89,_0x292e66){return db['Pause']['create'](_0x1c5a89[_0x61a6('0x4d')],{})[_0x61a6('0x26')](function(_0x1b1f27){var _0x5e62f7=_0x1c5a89[_0x61a6('0x4e')][_0x61a6('0x28')]({'plain':!![]});if(!_0x5e62f7)throw new Error(_0x61a6('0x4f'));if(_0x5e62f7[_0x61a6('0x50')]===_0x61a6('0x4e')){var _0x1e24f6=_0x1b1f27[_0x61a6('0x28')]({'plain':!![]});var _0x48716c=_0x61a6('0x51');return db[_0x61a6('0x52')]['find']({'where':{'name':_0x48716c,'userProfileId':_0x5e62f7[_0x61a6('0x53')]},'raw':!![]})['then'](function(_0x3d46be){if(_0x3d46be&&_0x3d46be[_0x61a6('0x54')]===0x0){return db['UserProfileResource'][_0x61a6('0x4c')]({'name':_0x1e24f6['name'],'resourceId':_0x1e24f6['id'],'type':_0x3d46be[_0x61a6('0x2a')],'sectionId':_0x3d46be['id']},{})[_0x61a6('0x26')](function(){return _0x1b1f27;});}else{return _0x1b1f27;}})['catch'](function(_0x30de7a){logger[_0x61a6('0x55')](_0x61a6('0x56'),_0x30de7a);throw _0x30de7a;});}return _0x1b1f27;})[_0x61a6('0x26')](respondWithResult(_0x292e66,0xc9))[_0x61a6('0x47')](handleError(_0x292e66,null));};exports[_0x61a6('0x25')]=function(_0x38a738,_0x5e51cf){if(_0x38a738[_0x61a6('0x4d')]['id']){delete _0x38a738[_0x61a6('0x4d')]['id'];}return db[_0x61a6('0x2e')][_0x61a6('0x4b')]({'where':{'id':_0x38a738[_0x61a6('0x49')]['id']}})[_0x61a6('0x26')](handleEntityNotFound(_0x5e51cf,null))['then'](saveUpdates(_0x38a738['body'],null))[_0x61a6('0x26')](respondWithResult(_0x5e51cf,null))[_0x61a6('0x47')](handleError(_0x5e51cf,null));};exports['destroy']=function(_0x170406,_0x36aef9){return db[_0x61a6('0x2e')]['find']({'where':{'id':_0x170406[_0x61a6('0x49')]['id']}})[_0x61a6('0x26')](handleEntityNotFound(_0x36aef9,null))[_0x61a6('0x26')](removeEntity(_0x36aef9,null))[_0x61a6('0x47')](handleError(_0x36aef9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2b6334a..2064ced 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x26d587,_0x30dc33){var _0x1b29f0=function(_0x5f0033){while(--_0x5f0033){_0x26d587['push'](_0x26d587['shift']());}};_0x1b29f0(++_0x30dc33);}(_0x5fc3,0xa8));var _0x35fc=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x5fc3[_0x48c4ef];return _0x435715;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x22eba1,_0x20c1e0){var _0x18ce06=function(_0x427102){while(--_0x427102){_0x22eba1['push'](_0x22eba1['shift']());}};_0x18ce06(++_0x20c1e0);}(_0xf494,0x1c6));var _0x4f49=function(_0x29e83b,_0x275a30){_0x29e83b=_0x29e83b-0x0;var _0x26cf3a=_0xf494[_0x29e83b];return _0x26cf3a;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5a02348..929e88b 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(_0x2ee200,_0x506470){var _0x2237e4=function(_0xfe37f9){while(--_0xfe37f9){_0x2ee200['push'](_0x2ee200['shift']());}};_0x2237e4(++_0x506470);}(_0xb10b,0x12a));var _0xbb10=function(_0x89ace6,_0x39064b){_0x89ace6=_0x89ace6-0x0;var _0x302694=_0xb10b[_0x89ace6];return _0x302694;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xda2dda,_0x3eef05){var _0xd9ddb0=function(_0x1651ba){while(--_0x1651ba){_0xda2dda['push'](_0xda2dda['shift']());}};_0xd9ddb0(++_0x3eef05);}(_0x7a54,0x106));var _0x47a5=function(_0x480de7,_0x3923de){_0x480de7=_0x480de7-0x0;var _0x49ac0b=_0x7a54[_0x480de7];return _0x49ac0b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index bf767db..ff2ce09 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 _0x50a6=['../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','show','isAuthenticated','download','root','originalname','format','%s-%s%s','basename','extname','post','single','file','put','update','delete','exports','multer','util','express','fs-extra'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x50a6,0xa4));var _0x650a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x50a6[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x650a('0x2'));var router=express['Router']();var fs_extra=require(_0x650a('0x3'));var auth=require(_0x650a('0x4'));var interaction=require(_0x650a('0x5'));var config=require('../../config/environment');var controller=require(_0x650a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x650a('0x7')]);router[_0x650a('0x8')](_0x650a('0x9'),controller[_0x650a('0xa')]);router['get'](_0x650a('0xb'),auth['isAuthenticated'](),controller[_0x650a('0xc')]);router[_0x650a('0x8')]('/:id/download',auth[_0x650a('0xd')](),controller[_0x650a('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3e2406,_0x526881,_0x142cdb){_0x142cdb(null,path['join'](config[_0x650a('0xf')],'server/files/plugins'));},'filename':function(_0x2f8bf8,_0x48077a,_0x33e73d){_0x48077a[_0x650a('0x10')]=_0x48077a[_0x650a('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e73d(null,util[_0x650a('0x11')](_0x650a('0x12'),path[_0x650a('0x13')](_0x48077a[_0x650a('0x10')],path[_0x650a('0x14')](_0x48077a[_0x650a('0x10')])),Date['now'](),path[_0x650a('0x14')](_0x48077a['originalname'])));}})});router[_0x650a('0x15')]('/',upload[_0x650a('0x16')](_0x650a('0x17')),controller['upload']);router['post']('/webhook',controller['webhookPost']);router[_0x650a('0x18')](_0x650a('0xb'),auth[_0x650a('0xd')](),controller[_0x650a('0x19')]);router[_0x650a('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x650a('0x1a')]);module[_0x650a('0x1b')]=router; \ No newline at end of file +var _0x6f0d=['delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','put','/:id','update'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x367353,_0x29d448){_0x367353=_0x367353-0x0;var _0x1bd728=_0x6f0d[_0x367353];return _0x1bd728;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x136eee,_0xee144c,_0x329f69){_0x329f69(null,path[_0xd6f0('0x10')](config['root'],_0xd6f0('0x11')));},'filename':function(_0x2f0459,_0x306aad,_0x45973d){_0x306aad[_0xd6f0('0x12')]=_0x306aad[_0xd6f0('0x12')][_0xd6f0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45973d(null,util[_0xd6f0('0x14')](_0xd6f0('0x15'),path['basename'](_0x306aad[_0xd6f0('0x12')],path[_0xd6f0('0x16')](_0x306aad['originalname'])),Date[_0xd6f0('0x17')](),path['extname'](_0x306aad[_0xd6f0('0x12')])));}})});router[_0xd6f0('0x18')]('/',upload[_0xd6f0('0x19')](_0xd6f0('0x1a')),controller[_0xd6f0('0x1b')]);router[_0xd6f0('0x18')](_0xd6f0('0xb'),controller[_0xd6f0('0x1c')]);router[_0xd6f0('0x1d')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1f')]);router[_0xd6f0('0x20')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x20')]);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 fc11c5f..4aeb8c5 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 _0x61de=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x61de,0xa7));var _0xe61d=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x61de[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0xe61d('0x0'));module[_0xe61d('0x1')]={'name':{'type':Sequelize[_0xe61d('0x2')]},'type':{'type':Sequelize[_0xe61d('0x3')](_0xe61d('0x4'),_0xe61d('0x5'))},'description':{'type':Sequelize[_0xe61d('0x6')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xe61d('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe61d('0x7')},'sidebar':{'type':Sequelize[_0xe61d('0x3')](_0xe61d('0x8'),'agentOnly','always','never'),'defaultValue':_0xe61d('0x9'),'comment':_0xe61d('0xa')},'icon':{'type':Sequelize[_0xe61d('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xe61d('0x2')]},'scriptName':{'type':Sequelize[_0xe61d('0x2')]},'scriptPath':{'type':Sequelize[_0xe61d('0x2')]}}; \ No newline at end of file +var _0x295c=['html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM'];(function(_0x141b3a,_0xb7e037){var _0x15a7b3=function(_0x10c61a){while(--_0x10c61a){_0x141b3a['push'](_0x141b3a['shift']());}};_0x15a7b3(++_0xb7e037);}(_0x295c,0x165));var _0xc295=function(_0xddb03,_0x4b9362){_0xddb03=_0xddb03-0x0;var _0xdfd0fd=_0x295c[_0xddb03];return _0xdfd0fd;};'use strict';var Sequelize=require(_0xc295('0x0'));module['exports']={'name':{'type':Sequelize[_0xc295('0x1')]},'type':{'type':Sequelize[_0xc295('0x2')](_0xc295('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xc295('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xc295('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc295('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0xc295('0x7'),_0xc295('0x8'),_0xc295('0x9'),_0xc295('0xa')),'defaultValue':_0xc295('0x9'),'comment':_0xc295('0xb')},'icon':{'type':Sequelize[_0xc295('0x1')]},'adminUrl':{'type':Sequelize[_0xc295('0x1')]},'agentUrl':{'type':Sequelize[_0xc295('0x1')]},'scriptName':{'type':Sequelize[_0xc295('0x1')]},'scriptPath':{'type':Sequelize[_0xc295('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index dcd44aa..1aba6e4 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 _0xb803=['Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','method','format','%s%s','headers','content-length','content-type','set','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','encoding','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','desk.js','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','destroy','Plugins','then','error','stack','name','send','map','Plugin','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','params','rawAttributes','find','download','path','join','root','server/files/plugins','%s.zip','basename','zip','warning','code'];(function(_0x3c66e5,_0xab5ea3){var _0x678a=function(_0xd43f50){while(--_0xd43f50){_0x3c66e5['push'](_0x3c66e5['shift']());}};_0x678a(++_0xab5ea3);}(_0xb803,0x100));var _0x3b80=function(_0x5c9e93,_0x17331c){_0x5c9e93=_0x5c9e93-0x0;var _0x2ccd6d=_0xb803[_0x5c9e93];return _0x2ccd6d;};'use strict';var emlformat=require(_0x3b80('0x0'));var rimraf=require(_0x3b80('0x1'));var zipdir=require(_0x3b80('0x2'));var jsonpatch=require(_0x3b80('0x3'));var rp=require(_0x3b80('0x4'));var moment=require(_0x3b80('0x5'));var BPromise=require(_0x3b80('0x6'));var Mustache=require('mustache');var util=require(_0x3b80('0x7'));var path=require('path');var sox=require(_0x3b80('0x8'));var csv=require('to-csv');var ejs=require(_0x3b80('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b80('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b80('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x3b80('0x1'));var archiver=require(_0x3b80('0xc'));var Redis=require(_0x3b80('0xd'));var authService=require(_0x3b80('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3b80('0xf'));var hardwareService=require(_0x3b80('0x10'));var logger=require(_0x3b80('0x11'))(_0x3b80('0x12'));var utils=require(_0x3b80('0x13'));var config=require(_0x3b80('0x14'));var licenseUtil=require(_0x3b80('0x15'));var db=require(_0x3b80('0x16'))['db'];config[_0x3b80('0x17')]=_[_0x3b80('0x18')](config[_0x3b80('0x17')],{'host':_0x3b80('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b80('0x17')]));require(_0x3b80('0x1a'))[_0x3b80('0x1b')](socket);function respondWithStatusCode(_0x10bfc0,_0x4b520b){_0x4b520b=_0x4b520b||0xcc;return function(_0x4af6bd){if(_0x4af6bd){return _0x10bfc0[_0x3b80('0x1c')](_0x4b520b);}return _0x10bfc0['status'](_0x4b520b)[_0x3b80('0x1d')]();};}function respondWithResult(_0x297bbc,_0x8ab67f){_0x8ab67f=_0x8ab67f||0xc8;return function(_0x5eb81b){if(_0x5eb81b){return _0x297bbc[_0x3b80('0x1e')](_0x8ab67f)['json'](_0x5eb81b);}};}function respondWithFilteredResult(_0xc29d6c,_0x208cde){return function(_0x513a7b){if(_0x513a7b){var _0x5c94b2=typeof _0x208cde[_0x3b80('0x1f')]===_0x3b80('0x20')&&typeof _0x208cde[_0x3b80('0x21')]==='undefined';var _0x4a6091=_0x513a7b[_0x3b80('0x22')];var _0x1247f5=_0x5c94b2?0x0:_0x208cde[_0x3b80('0x1f')];var _0x54ebac=_0x5c94b2?_0x513a7b['count']:_0x208cde['offset']+_0x208cde[_0x3b80('0x21')];var _0x2d4364;if(_0x54ebac>=_0x4a6091){_0x54ebac=_0x4a6091;_0x2d4364=0xc8;}else{_0x2d4364=0xce;}_0xc29d6c['status'](_0x2d4364);return _0xc29d6c['set']('Content-Range',_0x1247f5+'-'+_0x54ebac+'/'+_0x4a6091)[_0x3b80('0x23')](_0x513a7b);}return null;};}function patchUpdates(_0x9baf99){return function(_0x4c9f08){try{jsonpatch[_0x3b80('0x24')](_0x4c9f08,_0x9baf99,!![]);}catch(_0x296f65){return BPromise[_0x3b80('0x25')](_0x296f65);}return _0x4c9f08[_0x3b80('0x26')]();};}function saveUpdates(_0x1ef4dc,_0x4153e2){return function(_0x39c7cc){if(_0x39c7cc){return _0x39c7cc['update'](_0x1ef4dc)['then'](function(_0x51f581){return _0x51f581;});}return null;};}function removeEntity(_0x399d65,_0x4536fa){return function(_0x426b33){if(_0x426b33){return _0x426b33[_0x3b80('0x27')]()['then'](function(){var _0x2c0a0b=_0x426b33['get']({'plain':!![]});var _0x5c6833=_0x3b80('0x28');return db['UserProfileResource'][_0x3b80('0x27')]({'where':{'type':_0x5c6833,'resourceId':_0x2c0a0b['id']}})[_0x3b80('0x29')](function(){return _0x426b33;});})['then'](function(){_0x399d65[_0x3b80('0x1e')](0xcc)[_0x3b80('0x1d')]();});}};}function handleEntityNotFound(_0x4b1d9a,_0x4f85fd){return function(_0x3dcc38){if(!_0x3dcc38){_0x4b1d9a[_0x3b80('0x1c')](0x194);}return _0x3dcc38;};}function handleError(_0x44ea10,_0x1f5297){_0x1f5297=_0x1f5297||0x1f4;return function(_0x2a3601){logger[_0x3b80('0x2a')](_0x2a3601[_0x3b80('0x2b')]);if(_0x2a3601[_0x3b80('0x2c')]){delete _0x2a3601['name'];}_0x44ea10['status'](_0x1f5297)[_0x3b80('0x2d')](_0x2a3601);};}exports['index']=function(_0x20dbb4,_0x4deb1e){var _0x577022={},_0x331392={},_0x57f382={'count':0x0,'rows':[]};var _0x173cf1=_[_0x3b80('0x2e')](db[_0x3b80('0x2f')]['rawAttributes'],function(_0x38aee1){return{'name':_0x38aee1['fieldName'],'type':_0x38aee1[_0x3b80('0x30')][_0x3b80('0x31')]};});_0x331392[_0x3b80('0x32')]=_[_0x3b80('0x2e')](_0x173cf1,_0x3b80('0x2c'));_0x331392['query']=_[_0x3b80('0x33')](_0x20dbb4[_0x3b80('0x34')]);_0x331392[_0x3b80('0x35')]=_[_0x3b80('0x36')](_0x331392[_0x3b80('0x32')],_0x331392[_0x3b80('0x34')]);_0x577022[_0x3b80('0x37')]=_['intersection'](_0x331392[_0x3b80('0x32')],qs[_0x3b80('0x38')](_0x20dbb4[_0x3b80('0x34')]['fields']));_0x577022['attributes']=_0x577022['attributes'][_0x3b80('0x39')]?_0x577022[_0x3b80('0x37')]:_0x331392[_0x3b80('0x32')];if(!_0x20dbb4[_0x3b80('0x34')][_0x3b80('0x3a')](_0x3b80('0x3b'))){_0x577022[_0x3b80('0x21')]=qs[_0x3b80('0x21')](_0x20dbb4[_0x3b80('0x34')]['limit']);_0x577022[_0x3b80('0x1f')]=qs[_0x3b80('0x1f')](_0x20dbb4[_0x3b80('0x34')][_0x3b80('0x1f')]);}_0x577022[_0x3b80('0x3c')]=qs['sort'](_0x20dbb4[_0x3b80('0x34')][_0x3b80('0x3d')]);_0x577022['where']=qs[_0x3b80('0x35')](_[_0x3b80('0x3e')](_0x20dbb4[_0x3b80('0x34')],_0x331392[_0x3b80('0x35')]),_0x173cf1);if(_0x20dbb4[_0x3b80('0x34')][_0x3b80('0x3f')]){_0x577022[_0x3b80('0x40')]=_[_0x3b80('0x41')](_0x577022[_0x3b80('0x40')],{'$or':_[_0x3b80('0x2e')](_0x173cf1,function(_0x2c38d5){if(_0x2c38d5['type']!=='VIRTUAL'){var _0x1a5be9={};_0x1a5be9[_0x2c38d5[_0x3b80('0x2c')]]={'$like':'%'+_0x20dbb4[_0x3b80('0x34')]['filter']+'%'};return _0x1a5be9;}})});}_0x577022=_[_0x3b80('0x41')]({},_0x577022,_0x20dbb4[_0x3b80('0x42')]);var _0x3b6c24={'where':_0x577022[_0x3b80('0x40')]};return db[_0x3b80('0x2f')][_0x3b80('0x22')](_0x3b6c24)[_0x3b80('0x29')](function(_0x2edc6f){_0x57f382[_0x3b80('0x22')]=_0x2edc6f;if(_0x20dbb4['query'][_0x3b80('0x43')]){_0x577022[_0x3b80('0x44')]=[{'all':!![]}];}return db[_0x3b80('0x2f')]['findAll'](_0x577022);})[_0x3b80('0x29')](function(_0x383fd2){_0x57f382[_0x3b80('0x45')]=_0x383fd2;return _0x57f382;})['then'](respondWithFilteredResult(_0x4deb1e,_0x577022))[_0x3b80('0x46')](handleError(_0x4deb1e,null));};exports['show']=function(_0x515f30,_0x29064c){var _0x25ade3={'raw':!![],'where':{'id':_0x515f30[_0x3b80('0x47')]['id']}},_0x5cbf3d={};_0x5cbf3d['model']=_[_0x3b80('0x33')](db[_0x3b80('0x2f')][_0x3b80('0x48')]);_0x5cbf3d['query']=_[_0x3b80('0x33')](_0x515f30[_0x3b80('0x34')]);_0x5cbf3d[_0x3b80('0x35')]=_[_0x3b80('0x36')](_0x5cbf3d[_0x3b80('0x32')],_0x5cbf3d[_0x3b80('0x34')]);_0x25ade3['attributes']=_[_0x3b80('0x36')](_0x5cbf3d[_0x3b80('0x32')],qs[_0x3b80('0x38')](_0x515f30[_0x3b80('0x34')][_0x3b80('0x38')]));_0x25ade3[_0x3b80('0x37')]=_0x25ade3[_0x3b80('0x37')]['length']?_0x25ade3[_0x3b80('0x37')]:_0x5cbf3d[_0x3b80('0x32')];if(_0x515f30[_0x3b80('0x34')][_0x3b80('0x43')]){_0x25ade3[_0x3b80('0x44')]=[{'all':!![]}];}_0x25ade3=_[_0x3b80('0x41')]({},_0x25ade3,_0x515f30[_0x3b80('0x42')]);return db[_0x3b80('0x2f')][_0x3b80('0x49')](_0x25ade3)[_0x3b80('0x29')](handleEntityNotFound(_0x29064c,null))[_0x3b80('0x29')](respondWithResult(_0x29064c,null))[_0x3b80('0x46')](handleError(_0x29064c,null));};exports[_0x3b80('0x4a')]=function(_0x1e88cc,_0x4ce52f,_0x2bd425){return db['Plugin']['find']({'where':{'id':_0x1e88cc[_0x3b80('0x47')]['id']},'attributes':[_0x3b80('0x2c'),_0x3b80('0x4b')],'raw':!![]})[_0x3b80('0x29')](handleEntityNotFound(_0x4ce52f,null))[_0x3b80('0x29')](function(_0x13ef99){if(_0x13ef99){var _0x28ddd9=path[_0x3b80('0x4c')](config[_0x3b80('0x4d')],_0x3b80('0x4e'),util['format'](_0x3b80('0x4f'),path[_0x3b80('0x50')](_0x13ef99[_0x3b80('0x4b')])));var _0x6ea76=fs['createWriteStream'](_0x28ddd9);var _0x1c3aa0=archiver(_0x3b80('0x51'),{'zlib':{'level':0x9}});_0x1c3aa0['on'](_0x3b80('0x52'),function(_0x3f3cf9){if(_0x3f3cf9[_0x3b80('0x53')]==='ENOENT'){logger[_0x3b80('0x2a')](_0x3f3cf9);}else{throw new db[(_0x3b80('0x54'))][(_0x3b80('0x55'))](_0x3b80('0x56'));}});_0x1c3aa0['on'](_0x3b80('0x2a'),function(_0x2106ba){throw new db[(_0x3b80('0x54'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x1c3aa0[_0x3b80('0x57')](_0x6ea76);_0x1c3aa0[_0x3b80('0x58')](_0x3b80('0x59'),{'cwd':path[_0x3b80('0x4c')](config[_0x3b80('0x4d')],'server/files/plugins',path[_0x3b80('0x5a')](_0x13ef99[_0x3b80('0x4b')])),'ignore':[path[_0x3b80('0x4c')](path[_0x3b80('0x50')](_0x13ef99['path']),_0x3b80('0x5b')),path[_0x3b80('0x4c')](path[_0x3b80('0x50')](_0x13ef99[_0x3b80('0x4b')]),_0x3b80('0x5c'))],'nodir':!![]})[_0x3b80('0x5d')]();_0x6ea76['on'](_0x3b80('0x5e'),function(){if(!fs[_0x3b80('0x5f')](_0x28ddd9)){throw new db[(_0x3b80('0x54'))]['Error'](_0x3b80('0x60'));}return _0x4ce52f[_0x3b80('0x4a')](_0x28ddd9,util['format']('%s.zip',path[_0x3b80('0x50')](_0x13ef99[_0x3b80('0x4b')])),function(_0x32ceef){if(_0x32ceef){throw new db[(_0x3b80('0x54'))][(_0x3b80('0x55'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x3b80('0x61')](_0x28ddd9);logger['info']('Download\x20completed');logger[_0x3b80('0x62')](_0x3b80('0x63'));});});}return null;})[_0x3b80('0x46')](handleError(_0x4ce52f,null));};exports[_0x3b80('0x64')]=function(_0x4a54ef,_0x3144e7,_0x110134){var _0x3193dc=path[_0x3b80('0x50')](_0x4a54ef[_0x3b80('0x65')][_0x3b80('0x66')],path['extname'](_0x4a54ef[_0x3b80('0x65')][_0x3b80('0x66')]));var _0x1e759a=path[_0x3b80('0x4c')](config[_0x3b80('0x4d')],_0x3b80('0x4e'),_0x4a54ef[_0x3b80('0x65')][_0x3b80('0x66')]);var _0x42263f=path[_0x3b80('0x4c')](config[_0x3b80('0x4d')],'server/files/plugins',_0x3193dc);logger['info'](_0x3b80('0x67'),_0x1e759a);logger[_0x3b80('0x62')](_0x3b80('0x68'),_0x42263f);try{fs[_0x3b80('0x69')](_0x1e759a,parseInt(_0x3b80('0x6a'),0x8));extract(_0x1e759a,{'dir':_0x42263f},function(_0x4f9fc8){if(_0x4f9fc8){logger[_0x3b80('0x2a')](_0x4f9fc8);handleError(_0x4f9fc8,!![]);};var _0x31d41e=fs['readdirSync'](_0x42263f);if(_0x31d41e[_0x3b80('0x39')]>0x1){removeReferences(_0x1e759a,_0x42263f);logger[_0x3b80('0x2a')](_0x3b80('0x6b'));return _0x110134(new Error(_0x3b80('0x6b')));}var _0x37b79e=fs[_0x3b80('0x6c')](path['join'](_0x42263f,_0x31d41e[0x0]));if(_0x37b79e[_0x3b80('0x6d')]()){removeReferences(_0x1e759a,_0x42263f);logger[_0x3b80('0x2a')](_0x3b80('0x6b'));return _0x110134(new Error(_0x3b80('0x6b')));}if(_0x37b79e[_0x3b80('0x6e')]()){var _0xe3b744=fs[_0x3b80('0x6f')](path[_0x3b80('0x4c')](_0x42263f,_0x31d41e[0x0]));if(_0xe3b744[_0x3b80('0x39')]===0x0){removeReferences(_0x1e759a,_0x42263f);logger['error'](_0x3b80('0x6b'));return _0x110134(new Error(_0x3b80('0x6b')));}var _0x1734fd=_0xe3b744[_0x3b80('0x70')](function(_0x29595d){return _0x29595d===_0x3b80('0x71');});if(!_0x1734fd){return _0x110134(new Error(_0x3b80('0x72')));}var _0x542634=fs[_0x3b80('0x73')](path['join'](_0x42263f,_0x31d41e[0x0],_0x3b80('0x71')));var _0x2b9942=JSON[_0x3b80('0x74')](_0x542634);if(_0x3b80('0x20')==typeof _0x2b9942[_0x3b80('0x2c')]){return _0x110134(new Error(_0x3b80('0x75')));}if(_0x3b80('0x20')==typeof _0x2b9942['type']){return _0x110134(new Error(_0x3b80('0x76')));}if(_0x3b80('0x20')==typeof _0x2b9942['version']){return _0x110134(new Error(_0x3b80('0x77')));}if(_0x3b80('0x20')==typeof _0x2b9942[_0x3b80('0x78')]){return _0x110134(new Error(_0x3b80('0x79')));}if(_0x2b9942[_0x3b80('0x30')]===_0x3b80('0x7a')){if('undefined'==typeof _0x2b9942[_0x3b80('0x78')][_0x3b80('0x7b')]){return _0x110134(new Error(_0x3b80('0x7c')));}if('undefined'==typeof _0x2b9942[_0x3b80('0x78')]['views'][_0x3b80('0x7d')]&&_0x3b80('0x20')==typeof _0x2b9942['parameters'][_0x3b80('0x7b')][_0x3b80('0x7e')]){return _0x110134(new Error(_0x3b80('0x7f')));}}else if(_0x2b9942[_0x3b80('0x30')]===_0x3b80('0x80')){if('undefined'==typeof _0x2b9942['parameters'][_0x3b80('0x81')]){return _0x110134(new Error(_0x3b80('0x82')));}if(_0x3b80('0x20')==typeof _0x2b9942[_0x3b80('0x78')]['scriptPath']){return _0x110134(new Error(_0x3b80('0x83')));}}else{return _0x110134(new Error(_0x3b80('0x84')));}var _0x3fd5ba=_0x2b9942[_0x3b80('0x2c')];var _0x2e261f=_0x2b9942[_0x3b80('0x85')];var _0x5b71dc=_0x2b9942[_0x3b80('0x30')];var _0x42fd3f=_0x2b9942['sidebar']?_0x2b9942['sidebar']:_0x3b80('0x86');var _0x4f7a1d=_0x2b9942[_0x3b80('0x87')]?_0x2b9942['icon']:_0x3b80('0x88');var _0x1fa8f0='';var _0x24708a='';var _0x3aa856='';var _0x18ff33='';var _0x19dbd6=_0x2b9942[_0x3b80('0x89')];if(_0x5b71dc==='html'){if(_0x3b80('0x20')!=typeof _0x2b9942[_0x3b80('0x78')][_0x3b80('0x7b')]['admin']){var _0x4c5a57=_0x2b9942[_0x3b80('0x78')][_0x3b80('0x7b')][_0x3b80('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x3b80('0x8a')](_0x4c5a57)){_0x1fa8f0=path[_0x3b80('0x4c')](_0x3b80('0x8b'),_0x3193dc,_0x31d41e[0x0],_0x4c5a57);}else{_0x1fa8f0=_0x4c5a57;}}else{logger[_0x3b80('0x62')](_0x3b80('0x8c'));}if(_0x3b80('0x20')!=typeof _0x2b9942['parameters'][_0x3b80('0x7b')][_0x3b80('0x7e')]){var _0x55f1c8=_0x2b9942['parameters'][_0x3b80('0x7b')][_0x3b80('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x55f1c8)){_0x24708a=path['join'](_0x3b80('0x8b'),_0x3193dc,_0x31d41e[0x0],_0x55f1c8);}else{_0x24708a=_0x55f1c8;}}else{logger[_0x3b80('0x62')](_0x3b80('0x8d'));}}else if(_0x5b71dc==='script'){_0x3aa856=_0x2b9942[_0x3b80('0x78')][_0x3b80('0x81')];_0x18ff33=_0x2b9942[_0x3b80('0x78')][_0x3b80('0x8e')];if(_0x3b80('0x20')!=typeof _0x2b9942['parameters']['views']){if(_0x3b80('0x20')!=typeof _0x2b9942[_0x3b80('0x78')][_0x3b80('0x7b')][_0x3b80('0x7d')]){var _0x4c5a57=_0x2b9942[_0x3b80('0x78')][_0x3b80('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3b80('0x8a')](_0x4c5a57)){_0x1fa8f0=path[_0x3b80('0x4c')](_0x3b80('0x8b'),_0x3193dc,_0x31d41e[0x0],_0x4c5a57);}else{_0x1fa8f0=_0x4c5a57;}}if(_0x3b80('0x20')!=typeof _0x2b9942[_0x3b80('0x78')][_0x3b80('0x7b')]['agent']){var _0x55f1c8=_0x2b9942[_0x3b80('0x78')][_0x3b80('0x7b')][_0x3b80('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x3b80('0x8a')](_0x55f1c8)){_0x24708a=path[_0x3b80('0x4c')](_0x3b80('0x8b'),_0x3193dc,_0x31d41e[0x0],_0x55f1c8);}else{_0x24708a=_0x55f1c8;}}}}var _0x350a3b={'name':_0x3fd5ba,'description':_0x2e261f,'path':path[_0x3b80('0x4c')](_0x3193dc,_0x31d41e[0x0]),'type':_0x5b71dc,'sidebar':_0x42fd3f,'icon':_0x4f7a1d,'adminUrl':_0x1fa8f0,'agentUrl':_0x24708a,'scriptName':_0x3aa856,'scriptPath':_0x18ff33,'version':_0x19dbd6};removeReferences(_0x1e759a,null);return db['Plugin'][_0x3b80('0x8f')](_0x350a3b)[_0x3b80('0x29')](function(_0x463aee){var _0x3a4286={'role':_0x4a54ef[_0x3b80('0x90')]['role'],'userProfileId':_0x4a54ef[_0x3b80('0x90')][_0x3b80('0x91')]};if(!_0x3a4286)throw new Error(_0x3b80('0x92'));if(_0x3a4286['role']===_0x3b80('0x93')){var _0x4bd3e4=_0x463aee[_0x3b80('0x94')]({'plain':!![]});return db[_0x3b80('0x95')]['find']({'where':{'name':_0x3b80('0x28'),'userProfileId':_0x3a4286[_0x3b80('0x91')]},'raw':!![]})[_0x3b80('0x29')](function(_0x492547){if(_0x492547&&_0x492547[_0x3b80('0x96')]===0x0){return db[_0x3b80('0x97')][_0x3b80('0x8f')]({'name':_0x4bd3e4[_0x3b80('0x2c')],'resourceId':_0x4bd3e4['id'],'type':_0x492547['name'],'sectionId':_0x492547['id']},{})['then'](function(){return _0x463aee;});}else{return _0x463aee;}})[_0x3b80('0x46')](function(_0x13061){logger[_0x3b80('0x2a')](_0x3b80('0x98'),_0x13061);throw _0x13061;});}return _0x463aee;})[_0x3b80('0x29')](respondWithResult(_0x3144e7,null))['catch'](handleError(_0x3144e7,null));}});}catch(_0x3a3a97){_0x3144e7[_0x3b80('0x1e')](0x1f4)[_0x3b80('0x2d')](_0x3a3a97);}};function removeReferences(_0x1ac7c6,_0x587c2d){try{if(_0x1ac7c6){fs['unlinkSync'](_0x1ac7c6);logger[_0x3b80('0x62')]('Zip\x20archive\x20removed');}if(_0x587c2d){rimraf(_0x587c2d,function(){});logger[_0x3b80('0x62')](_0x3b80('0x99'));}}catch(_0x1e1775){logger[_0x3b80('0x2a')](_0x1e1775);}}exports[_0x3b80('0x9a')]=function(_0x2682cf,_0x4ff5fb,_0x4629f0){return db[_0x3b80('0x2f')][_0x3b80('0x49')]({'where':{'id':_0x2682cf[_0x3b80('0x47')]['id']}})[_0x3b80('0x29')](handleEntityNotFound(_0x4ff5fb,null))['then'](saveUpdates(_0x2682cf['body'],null))[_0x3b80('0x29')](respondWithResult(_0x4ff5fb,null))['catch'](handleError(_0x4ff5fb,null));};exports['delete']=function(_0x5af154,_0x64388c,_0x2db47f){return db[_0x3b80('0x2f')]['find']({'where':{'id':_0x5af154[_0x3b80('0x47')]['id']}})[_0x3b80('0x29')](function(_0x5c4b0f){if(_0x5c4b0f){return _0x5c4b0f[_0x3b80('0x27')]();}})[_0x3b80('0x29')](function(_0x2f99cf){rimraf(path[_0x3b80('0x4c')](config['root'],_0x3b80('0x4e'),path[_0x3b80('0x5a')](_0x2f99cf[_0x3b80('0x4b')])),function(){});return _0x2f99cf;})[_0x3b80('0x29')](handleEntityNotFound(_0x64388c,null))['then'](respondWithStatusCode(_0x64388c,null))[_0x3b80('0x46')](handleError(_0x64388c,null));};exports['webhookGet']=function(_0x2f012e,_0x481e47,_0x284bec){return BPromise[_0x3b80('0x9b')]()[_0x3b80('0x29')](function(){if(!_0x2f012e[_0x3b80('0x34')][_0x3b80('0x4b')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2f012e['query'][_0x3b80('0x9c')]){throw new Error(_0x3b80('0x9d'));}var _0x773f9f=_0x2f012e[_0x3b80('0x34')][_0x3b80('0x9e')]?_0x2f012e[_0x3b80('0x34')][_0x3b80('0x9e')]+':'+_0x2f012e[_0x3b80('0x34')][_0x3b80('0x9c')]:'http://localhost:'+_0x2f012e[_0x3b80('0x34')][_0x3b80('0x9c')];var _0x1624d0=_0x2f012e[_0x3b80('0x34')][_0x3b80('0x23')]?_0x2f012e[_0x3b80('0x34')][_0x3b80('0x23')]:!![];var _0x3247c9=_0x2f012e[_0x3b80('0x34')]['encoding']?_0x2f012e[_0x3b80('0x34')]['encoding']:null;var _0x1f4443={'method':_0x2f012e[_0x3b80('0x9f')],'uri':util[_0x3b80('0xa0')](_0x3b80('0xa1'),_0x773f9f,_0x2f012e[_0x3b80('0x34')][_0x3b80('0x4b')]),'json':_0x1624d0,'resolveWithFullResponse':!![],'encoding':_0x3247c9,'qs':_0x2f012e['query']};if(_0x2f012e[_0x3b80('0xa2')]){_0x1f4443[_0x3b80('0xa2')]=_0x2f012e[_0x3b80('0xa2')];if(_0x1f4443[_0x3b80('0xa2')][_0x3b80('0xa3')]){delete _0x1f4443['headers']['content-length'];}}if(_0x1f4443[_0x3b80('0xa2')][_0x3b80('0xa4')]){delete _0x1f4443[_0x3b80('0xa2')][_0x3b80('0xa4')];}return rp(_0x1f4443);})['then'](function(_0x1c088f){if(_0x1c088f){_0x481e47[_0x3b80('0xa5')](_0x1c088f[_0x3b80('0xa2')]);logger[_0x3b80('0x62')](_0x1c088f[_0x3b80('0x90')]);if(_[_0x3b80('0xa6')](_0x2f012e['query'][_0x3b80('0x4b')],_0x3b80('0x4a'))&&_0x1c088f[_0x3b80('0xa7')]==0x1f4){return _0x481e47[_0x3b80('0x1c')](_0x1c088f[_0x3b80('0xa7')]);}else{return _0x481e47[_0x3b80('0x1e')](_0x1c088f[_0x3b80('0xa7')])[_0x3b80('0x2d')](_0x1c088f[_0x3b80('0x90')]);}}else{return _0x481e47[_0x3b80('0x1c')](0xc8);}})[_0x3b80('0x46')](handleError(_0x481e47,null));};exports['webhookPost']=function(_0x5b6ae6,_0x1febbe,_0x519f61){return BPromise[_0x3b80('0x9b')]()[_0x3b80('0x29')](function(){if(!_0x5b6ae6[_0x3b80('0x34')]['path']){throw new Error(_0x3b80('0xa8'));}if(!_0x5b6ae6['query'][_0x3b80('0x9c')]){throw new Error(_0x3b80('0x9d'));}var _0x2a415e=_0x5b6ae6[_0x3b80('0x34')]['hostname']?_0x5b6ae6[_0x3b80('0x34')][_0x3b80('0x9e')]+':'+_0x5b6ae6[_0x3b80('0x34')][_0x3b80('0x9c')]:'http://localhost:'+_0x5b6ae6[_0x3b80('0x34')]['port'];var _0x20b9ae=_0x5b6ae6['query'][_0x3b80('0x23')]?_0x5b6ae6[_0x3b80('0x34')][_0x3b80('0x23')]:!![];var _0x3ba8e0=_0x5b6ae6['query'][_0x3b80('0xa9')]?_0x5b6ae6[_0x3b80('0x34')]['encoding']:null;var _0x216754={'method':_0x5b6ae6[_0x3b80('0x9f')],'uri':util[_0x3b80('0xa0')](_0x3b80('0xa1'),_0x2a415e,_0x5b6ae6['query']['path']),'json':_0x20b9ae,'resolveWithFullResponse':!![],'encoding':_0x3ba8e0,'body':_0x5b6ae6['body']};if(_0x5b6ae6[_0x3b80('0xa2')]){_0x216754[_0x3b80('0xa2')]=_0x5b6ae6[_0x3b80('0xa2')];if(_0x216754[_0x3b80('0xa2')][_0x3b80('0xa3')]){delete _0x216754['headers'][_0x3b80('0xa3')];}}if(_0x216754[_0x3b80('0xa2')][_0x3b80('0xa4')]){delete _0x216754[_0x3b80('0xa2')][_0x3b80('0xa4')];}return rp(_0x216754);})[_0x3b80('0x29')](function(_0x4f7ab8){if(_0x4f7ab8){_0x1febbe[_0x3b80('0xa5')](_0x4f7ab8['headers']);logger[_0x3b80('0x62')](_0x4f7ab8['body']);return _0x1febbe[_0x3b80('0x1e')](_0x4f7ab8[_0x3b80('0xa7')])['send'](_0x4f7ab8[_0x3b80('0x90')]);}else{return _0x1febbe[_0x3b80('0x1c')](0xc8);}})['catch'](handleError(_0x1febbe,null));}; \ No newline at end of file +var _0x8a47=['readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','type','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','body','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','statusCode','send','webhookPost','http://localhost:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','index','map','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','Plugin','show','includeAll','include','find','download','params','server/files/plugins','format','%s.zip','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','root','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing'];(function(_0x2d84d5,_0x290676){var _0x3c914e=function(_0x219836){while(--_0x219836){_0x2d84d5['push'](_0x2d84d5['shift']());}};_0x3c914e(++_0x290676);}(_0x8a47,0x189));var _0x78a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a47[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x78a4('0x0'));var rimraf=require(_0x78a4('0x1'));var zipdir=require(_0x78a4('0x2'));var jsonpatch=require(_0x78a4('0x3'));var rp=require(_0x78a4('0x4'));var moment=require(_0x78a4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x78a4('0x6'));var util=require(_0x78a4('0x7'));var path=require(_0x78a4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x78a4('0x9'));var fs=require('fs');var fs_extra=require(_0x78a4('0xa'));var _=require('lodash');var squel=require(_0x78a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x78a4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x78a4('0xd'));var querystring=require(_0x78a4('0xe'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x78a4('0xf'));var Redis=require(_0x78a4('0x10'));var authService=require(_0x78a4('0x11'));var qs=require(_0x78a4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78a4('0x13'));var logger=require(_0x78a4('0x14'))('api');var utils=require(_0x78a4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x78a4('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x78a4('0x17')](config['redis'],{'host':_0x78a4('0x18'),'port':0x18eb});var socket=require(_0x78a4('0x19'))(new Redis(config[_0x78a4('0x1a')]));require('./plugin.socket')[_0x78a4('0x1b')](socket);function respondWithStatusCode(_0x32d310,_0xf908b){_0xf908b=_0xf908b||0xcc;return function(_0xb7a11){if(_0xb7a11){return _0x32d310[_0x78a4('0x1c')](_0xf908b);}return _0x32d310['status'](_0xf908b)[_0x78a4('0x1d')]();};}function respondWithResult(_0x39db55,_0x4a1a21){_0x4a1a21=_0x4a1a21||0xc8;return function(_0x26cca0){if(_0x26cca0){return _0x39db55[_0x78a4('0x1e')](_0x4a1a21)[_0x78a4('0x1f')](_0x26cca0);}};}function respondWithFilteredResult(_0x1b477e,_0x3a7447){return function(_0xf9cca6){if(_0xf9cca6){var _0x5e1d3e=typeof _0x3a7447[_0x78a4('0x20')]===_0x78a4('0x21')&&typeof _0x3a7447['limit']===_0x78a4('0x21');var _0x1fa861=_0xf9cca6[_0x78a4('0x22')];var _0x32e7b0=_0x5e1d3e?0x0:_0x3a7447[_0x78a4('0x20')];var _0xb3080=_0x5e1d3e?_0xf9cca6[_0x78a4('0x22')]:_0x3a7447['offset']+_0x3a7447['limit'];var _0x3df50c;if(_0xb3080>=_0x1fa861){_0xb3080=_0x1fa861;_0x3df50c=0xc8;}else{_0x3df50c=0xce;}_0x1b477e[_0x78a4('0x1e')](_0x3df50c);return _0x1b477e[_0x78a4('0x23')](_0x78a4('0x24'),_0x32e7b0+'-'+_0xb3080+'/'+_0x1fa861)[_0x78a4('0x1f')](_0xf9cca6);}return null;};}function patchUpdates(_0x52c4a2){return function(_0x4cfadd){try{jsonpatch[_0x78a4('0x25')](_0x4cfadd,_0x52c4a2,!![]);}catch(_0x38af30){return BPromise['reject'](_0x38af30);}return _0x4cfadd[_0x78a4('0x26')]();};}function saveUpdates(_0x17ef2d,_0x2ea8f9){return function(_0x35e99a){if(_0x35e99a){return _0x35e99a[_0x78a4('0x27')](_0x17ef2d)[_0x78a4('0x28')](function(_0x251db4){return _0x251db4;});}return null;};}function removeEntity(_0x51ff4b,_0x155a03){return function(_0x4d2be5){if(_0x4d2be5){return _0x4d2be5[_0x78a4('0x29')]()['then'](function(){var _0x53c5af=_0x4d2be5[_0x78a4('0x2a')]({'plain':!![]});var _0x5daf00=_0x78a4('0x2b');return db[_0x78a4('0x2c')]['destroy']({'where':{'type':_0x5daf00,'resourceId':_0x53c5af['id']}})['then'](function(){return _0x4d2be5;});})[_0x78a4('0x28')](function(){_0x51ff4b[_0x78a4('0x1e')](0xcc)[_0x78a4('0x1d')]();});}};}function handleEntityNotFound(_0x3e6b73,_0x29d603){return function(_0x1ba040){if(!_0x1ba040){_0x3e6b73[_0x78a4('0x1c')](0x194);}return _0x1ba040;};}function handleError(_0x392e8d,_0x463697){_0x463697=_0x463697||0x1f4;return function(_0x5d09fc){logger[_0x78a4('0x2d')](_0x5d09fc[_0x78a4('0x2e')]);if(_0x5d09fc[_0x78a4('0x2f')]){delete _0x5d09fc['name'];}_0x392e8d[_0x78a4('0x1e')](_0x463697)['send'](_0x5d09fc);};}exports[_0x78a4('0x30')]=function(_0x2ea74d,_0x4187e3){var _0x48e421={},_0x5d7970={},_0x391eac={'count':0x0,'rows':[]};var _0x472647=_[_0x78a4('0x31')](db['Plugin'][_0x78a4('0x32')],function(_0x2d3c2d){return{'name':_0x2d3c2d['fieldName'],'type':_0x2d3c2d['type'][_0x78a4('0x33')]};});_0x5d7970[_0x78a4('0x34')]=_[_0x78a4('0x31')](_0x472647,_0x78a4('0x2f'));_0x5d7970[_0x78a4('0x35')]=_[_0x78a4('0x36')](_0x2ea74d['query']);_0x5d7970['filters']=_[_0x78a4('0x37')](_0x5d7970['model'],_0x5d7970[_0x78a4('0x35')]);_0x48e421[_0x78a4('0x38')]=_[_0x78a4('0x37')](_0x5d7970[_0x78a4('0x34')],qs[_0x78a4('0x39')](_0x2ea74d[_0x78a4('0x35')][_0x78a4('0x39')]));_0x48e421[_0x78a4('0x38')]=_0x48e421['attributes'][_0x78a4('0x3a')]?_0x48e421[_0x78a4('0x38')]:_0x5d7970[_0x78a4('0x34')];if(!_0x2ea74d[_0x78a4('0x35')][_0x78a4('0x3b')](_0x78a4('0x3c'))){_0x48e421[_0x78a4('0x3d')]=qs[_0x78a4('0x3d')](_0x2ea74d[_0x78a4('0x35')]['limit']);_0x48e421['offset']=qs['offset'](_0x2ea74d[_0x78a4('0x35')][_0x78a4('0x20')]);}_0x48e421[_0x78a4('0x3e')]=qs['sort'](_0x2ea74d[_0x78a4('0x35')][_0x78a4('0x3f')]);_0x48e421[_0x78a4('0x40')]=qs[_0x78a4('0x41')](_['pick'](_0x2ea74d['query'],_0x5d7970['filters']),_0x472647);if(_0x2ea74d['query'][_0x78a4('0x42')]){_0x48e421[_0x78a4('0x40')]=_[_0x78a4('0x43')](_0x48e421[_0x78a4('0x40')],{'$or':_[_0x78a4('0x31')](_0x472647,function(_0x4f195f){if(_0x4f195f['type']!=='VIRTUAL'){var _0x154095={};_0x154095[_0x4f195f[_0x78a4('0x2f')]]={'$like':'%'+_0x2ea74d['query']['filter']+'%'};return _0x154095;}})});}_0x48e421=_[_0x78a4('0x43')]({},_0x48e421,_0x2ea74d[_0x78a4('0x44')]);var _0x17ca55={'where':_0x48e421['where']};return db['Plugin'][_0x78a4('0x22')](_0x17ca55)[_0x78a4('0x28')](function(_0x3e3666){_0x391eac['count']=_0x3e3666;if(_0x2ea74d[_0x78a4('0x35')]['includeAll']){_0x48e421['include']=[{'all':!![]}];}return db[_0x78a4('0x45')]['findAll'](_0x48e421);})[_0x78a4('0x28')](function(_0x413a5d){_0x391eac['rows']=_0x413a5d;return _0x391eac;})['then'](respondWithFilteredResult(_0x4187e3,_0x48e421))['catch'](handleError(_0x4187e3,null));};exports[_0x78a4('0x46')]=function(_0x2d4e76,_0x5301e6){var _0x332389={'raw':!![],'where':{'id':_0x2d4e76['params']['id']}},_0x189fb5={};_0x189fb5['model']=_['keys'](db[_0x78a4('0x45')][_0x78a4('0x32')]);_0x189fb5[_0x78a4('0x35')]=_['keys'](_0x2d4e76['query']);_0x189fb5[_0x78a4('0x41')]=_[_0x78a4('0x37')](_0x189fb5[_0x78a4('0x34')],_0x189fb5['query']);_0x332389[_0x78a4('0x38')]=_[_0x78a4('0x37')](_0x189fb5[_0x78a4('0x34')],qs['fields'](_0x2d4e76['query'][_0x78a4('0x39')]));_0x332389['attributes']=_0x332389[_0x78a4('0x38')][_0x78a4('0x3a')]?_0x332389[_0x78a4('0x38')]:_0x189fb5['model'];if(_0x2d4e76[_0x78a4('0x35')][_0x78a4('0x47')]){_0x332389[_0x78a4('0x48')]=[{'all':!![]}];}_0x332389=_[_0x78a4('0x43')]({},_0x332389,_0x2d4e76[_0x78a4('0x44')]);return db[_0x78a4('0x45')][_0x78a4('0x49')](_0x332389)[_0x78a4('0x28')](handleEntityNotFound(_0x5301e6,null))[_0x78a4('0x28')](respondWithResult(_0x5301e6,null))['catch'](handleError(_0x5301e6,null));};exports[_0x78a4('0x4a')]=function(_0x4c9bac,_0x2aca74,_0x343e21){return db[_0x78a4('0x45')][_0x78a4('0x49')]({'where':{'id':_0x4c9bac[_0x78a4('0x4b')]['id']},'attributes':['name',_0x78a4('0x8')],'raw':!![]})[_0x78a4('0x28')](handleEntityNotFound(_0x2aca74,null))[_0x78a4('0x28')](function(_0x44116f){if(_0x44116f){var _0x4adab1=path['join'](config['root'],_0x78a4('0x4c'),util[_0x78a4('0x4d')](_0x78a4('0x4e'),path['basename'](_0x44116f[_0x78a4('0x8')])));var _0x2e204b=fs[_0x78a4('0x4f')](_0x4adab1);var _0x2af433=archiver('zip',{'zlib':{'level':0x9}});_0x2af433['on'](_0x78a4('0x50'),function(_0x1c25a2){if(_0x1c25a2[_0x78a4('0x51')]===_0x78a4('0x52')){logger[_0x78a4('0x2d')](_0x1c25a2);}else{throw new db[(_0x78a4('0x53'))][(_0x78a4('0x54'))](_0x78a4('0x55'));}});_0x2af433['on']('error',function(_0x45a544){throw new db[(_0x78a4('0x53'))][(_0x78a4('0x54'))](_0x78a4('0x55'));});_0x2af433[_0x78a4('0x56')](_0x2e204b);_0x2af433['glob'](_0x78a4('0x57'),{'cwd':path[_0x78a4('0x58')](config[_0x78a4('0x59')],_0x78a4('0x4c'),path[_0x78a4('0x5a')](_0x44116f['path'])),'ignore':[path[_0x78a4('0x58')](path[_0x78a4('0x5b')](_0x44116f[_0x78a4('0x8')]),_0x78a4('0x5c')),path[_0x78a4('0x58')](path[_0x78a4('0x5b')](_0x44116f[_0x78a4('0x8')]),_0x78a4('0x5d'))],'nodir':!![]})[_0x78a4('0x5e')]();_0x2e204b['on'](_0x78a4('0x5f'),function(){if(!fs[_0x78a4('0x60')](_0x4adab1)){throw new db[(_0x78a4('0x53'))][(_0x78a4('0x54'))](_0x78a4('0x61'));}return _0x2aca74['download'](_0x4adab1,util[_0x78a4('0x4d')](_0x78a4('0x4e'),path[_0x78a4('0x5b')](_0x44116f['path'])),function(_0xf39269){if(_0xf39269){throw new db[(_0x78a4('0x53'))][(_0x78a4('0x54'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x78a4('0x62')](_0x4adab1);logger[_0x78a4('0x63')](_0x78a4('0x64'));logger[_0x78a4('0x63')](_0x78a4('0x65'));});});}return null;})['catch'](handleError(_0x2aca74,null));};exports['upload']=function(_0x403e85,_0x170558,_0x472bb1){var _0x5b7e83=path[_0x78a4('0x5b')](_0x403e85[_0x78a4('0x66')][_0x78a4('0x67')],path[_0x78a4('0x68')](_0x403e85[_0x78a4('0x66')][_0x78a4('0x67')]));var _0x3773f8=path[_0x78a4('0x58')](config[_0x78a4('0x59')],_0x78a4('0x4c'),_0x403e85[_0x78a4('0x66')][_0x78a4('0x67')]);var _0x5b092a=path[_0x78a4('0x58')](config[_0x78a4('0x59')],'server/files/plugins',_0x5b7e83);logger[_0x78a4('0x63')]('Plugin\x20upload\x20filepath:\x20%s',_0x3773f8);logger[_0x78a4('0x63')](_0x78a4('0x69'),_0x5b092a);try{fs[_0x78a4('0x6a')](_0x3773f8,parseInt(_0x78a4('0x6b'),0x8));extract(_0x3773f8,{'dir':_0x5b092a},function(_0x17f6f0){if(_0x17f6f0){logger[_0x78a4('0x2d')](_0x17f6f0);handleError(_0x17f6f0,!![]);};var _0x3cc732=fs[_0x78a4('0x6c')](_0x5b092a);if(_0x3cc732[_0x78a4('0x3a')]>0x1){removeReferences(_0x3773f8,_0x5b092a);logger['error'](_0x78a4('0x6d'));return _0x472bb1(new Error('Invalid\x20plugin\x20structure'));}var _0x552821=fs['lstatSync'](path[_0x78a4('0x58')](_0x5b092a,_0x3cc732[0x0]));if(_0x552821[_0x78a4('0x6e')]()){removeReferences(_0x3773f8,_0x5b092a);logger['error'](_0x78a4('0x6d'));return _0x472bb1(new Error(_0x78a4('0x6d')));}if(_0x552821[_0x78a4('0x6f')]()){var _0x369ea5=fs[_0x78a4('0x6c')](path['join'](_0x5b092a,_0x3cc732[0x0]));if(_0x369ea5[_0x78a4('0x3a')]===0x0){removeReferences(_0x3773f8,_0x5b092a);logger[_0x78a4('0x2d')](_0x78a4('0x6d'));return _0x472bb1(new Error(_0x78a4('0x6d')));}var _0x271981=_0x369ea5[_0x78a4('0x70')](function(_0x5a03fd){return _0x5a03fd==='manifest.json';});if(!_0x271981){return _0x472bb1(new Error(_0x78a4('0x71')));}var _0x33fd53=fs[_0x78a4('0x72')](path[_0x78a4('0x58')](_0x5b092a,_0x3cc732[0x0],_0x78a4('0x73')));var _0x23c2ce=JSON[_0x78a4('0x74')](_0x33fd53);if(_0x78a4('0x21')==typeof _0x23c2ce['name']){return _0x472bb1(new Error(_0x78a4('0x75')));}if(_0x78a4('0x21')==typeof _0x23c2ce['type']){return _0x472bb1(new Error(_0x78a4('0x76')));}if(_0x78a4('0x21')==typeof _0x23c2ce[_0x78a4('0x77')]){return _0x472bb1(new Error(_0x78a4('0x78')));}if(_0x78a4('0x21')==typeof _0x23c2ce['parameters']){return _0x472bb1(new Error(_0x78a4('0x79')));}if(_0x23c2ce['type']===_0x78a4('0x7a')){if(_0x78a4('0x21')==typeof _0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')]){return _0x472bb1(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x78a4('0x21')==typeof _0x23c2ce['parameters'][_0x78a4('0x7c')][_0x78a4('0x7d')]&&'undefined'==typeof _0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')][_0x78a4('0x7e')]){return _0x472bb1(new Error(_0x78a4('0x7f')));}}else if(_0x23c2ce[_0x78a4('0x80')]===_0x78a4('0x81')){if(_0x78a4('0x21')==typeof _0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x82')]){return _0x472bb1(new Error(_0x78a4('0x83')));}if(_0x78a4('0x21')==typeof _0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x84')]){return _0x472bb1(new Error(_0x78a4('0x85')));}}else{return _0x472bb1(new Error(_0x78a4('0x86')));}var _0x48bb5e=_0x23c2ce['name'];var _0x777fa6=_0x23c2ce['description'];var _0x4142b6=_0x23c2ce['type'];var _0x1508a4=_0x23c2ce[_0x78a4('0x87')]?_0x23c2ce[_0x78a4('0x87')]:'always';var _0x3778bd=_0x23c2ce[_0x78a4('0x88')]?_0x23c2ce['icon']:_0x78a4('0x89');var _0x233b48='';var _0x151961='';var _0x309d10='';var _0x16a36d='';var _0x55e7bc=_0x23c2ce[_0x78a4('0x77')];if(_0x4142b6===_0x78a4('0x7a')){if(_0x78a4('0x21')!=typeof _0x23c2ce[_0x78a4('0x7b')]['views'][_0x78a4('0x7d')]){var _0x31d79a=_0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')][_0x78a4('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x78a4('0x8a')](_0x31d79a)){_0x233b48=path['join'](_0x78a4('0x8b'),_0x5b7e83,_0x3cc732[0x0],_0x31d79a);}else{_0x233b48=_0x31d79a;}}else{logger[_0x78a4('0x63')](_0x78a4('0x8c'));}if(_0x78a4('0x21')!=typeof _0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')]['agent']){var _0x6fd63a=_0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')][_0x78a4('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x6fd63a)){_0x151961=path[_0x78a4('0x58')]('plugins',_0x5b7e83,_0x3cc732[0x0],_0x6fd63a);}else{_0x151961=_0x6fd63a;}}else{logger[_0x78a4('0x63')](_0x78a4('0x8d'));}}else if(_0x4142b6===_0x78a4('0x81')){_0x309d10=_0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x82')];_0x16a36d=_0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x84')];if('undefined'!=typeof _0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')]){if('undefined'!=typeof _0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')][_0x78a4('0x7d')]){var _0x31d79a=_0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')][_0x78a4('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x78a4('0x8a')](_0x31d79a)){_0x233b48=path['join']('plugins',_0x5b7e83,_0x3cc732[0x0],_0x31d79a);}else{_0x233b48=_0x31d79a;}}if('undefined'!=typeof _0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')][_0x78a4('0x7e')]){var _0x6fd63a=_0x23c2ce[_0x78a4('0x7b')][_0x78a4('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x6fd63a)){_0x151961=path[_0x78a4('0x58')]('plugins',_0x5b7e83,_0x3cc732[0x0],_0x6fd63a);}else{_0x151961=_0x6fd63a;}}}}var _0x24fe87={'name':_0x48bb5e,'description':_0x777fa6,'path':path['join'](_0x5b7e83,_0x3cc732[0x0]),'type':_0x4142b6,'sidebar':_0x1508a4,'icon':_0x3778bd,'adminUrl':_0x233b48,'agentUrl':_0x151961,'scriptName':_0x309d10,'scriptPath':_0x16a36d,'version':_0x55e7bc};removeReferences(_0x3773f8,null);return db[_0x78a4('0x45')]['create'](_0x24fe87)['then'](function(_0x4d6afb){var _0x1c3f8b={'role':_0x403e85['body'][_0x78a4('0x8e')],'userProfileId':_0x403e85['body'][_0x78a4('0x8f')]};if(!_0x1c3f8b)throw new Error(_0x78a4('0x90'));if(_0x1c3f8b[_0x78a4('0x8e')]===_0x78a4('0x91')){var _0x2464ca=_0x4d6afb[_0x78a4('0x2a')]({'plain':!![]});return db[_0x78a4('0x92')][_0x78a4('0x49')]({'where':{'name':_0x78a4('0x2b'),'userProfileId':_0x1c3f8b['userProfileId']},'raw':!![]})[_0x78a4('0x28')](function(_0x307fff){if(_0x307fff&&_0x307fff[_0x78a4('0x93')]===0x0){return db[_0x78a4('0x2c')][_0x78a4('0x94')]({'name':_0x2464ca[_0x78a4('0x2f')],'resourceId':_0x2464ca['id'],'type':_0x307fff[_0x78a4('0x2f')],'sectionId':_0x307fff['id']},{})[_0x78a4('0x28')](function(){return _0x4d6afb;});}else{return _0x4d6afb;}})[_0x78a4('0x95')](function(_0x3ec368){logger[_0x78a4('0x2d')](_0x78a4('0x96'),_0x3ec368);throw _0x3ec368;});}return _0x4d6afb;})[_0x78a4('0x28')](respondWithResult(_0x170558,null))[_0x78a4('0x95')](handleError(_0x170558,null));}});}catch(_0x13a371){_0x170558[_0x78a4('0x1e')](0x1f4)['send'](_0x13a371);}};function removeReferences(_0x28d1cb,_0x4028a1){try{if(_0x28d1cb){fs[_0x78a4('0x62')](_0x28d1cb);logger[_0x78a4('0x63')](_0x78a4('0x97'));}if(_0x4028a1){rimraf(_0x4028a1,function(){});logger[_0x78a4('0x63')]('Extracted\x20folder\x20removed');}}catch(_0x2d293b){logger[_0x78a4('0x2d')](_0x2d293b);}}exports[_0x78a4('0x27')]=function(_0x176a08,_0x3f9700,_0x1c9005){return db[_0x78a4('0x45')][_0x78a4('0x49')]({'where':{'id':_0x176a08[_0x78a4('0x4b')]['id']}})[_0x78a4('0x28')](handleEntityNotFound(_0x3f9700,null))[_0x78a4('0x28')](saveUpdates(_0x176a08[_0x78a4('0x98')],null))['then'](respondWithResult(_0x3f9700,null))[_0x78a4('0x95')](handleError(_0x3f9700,null));};exports['delete']=function(_0x51a259,_0x19f3b1,_0x2467c2){return db['Plugin'][_0x78a4('0x49')]({'where':{'id':_0x51a259[_0x78a4('0x4b')]['id']}})[_0x78a4('0x28')](function(_0x2313c5){if(_0x2313c5){return _0x2313c5[_0x78a4('0x29')]();}})[_0x78a4('0x28')](function(_0x321808){rimraf(path[_0x78a4('0x58')](config['root'],_0x78a4('0x4c'),path[_0x78a4('0x5a')](_0x321808[_0x78a4('0x8')])),function(){});return _0x321808;})[_0x78a4('0x28')](handleEntityNotFound(_0x19f3b1,null))[_0x78a4('0x28')](respondWithStatusCode(_0x19f3b1,null))[_0x78a4('0x95')](handleError(_0x19f3b1,null));};exports[_0x78a4('0x99')]=function(_0x4bd3ca,_0x3ab55b,_0x358746){return BPromise[_0x78a4('0x9a')]()[_0x78a4('0x28')](function(){if(!_0x4bd3ca['query']['path']){throw new Error(_0x78a4('0x9b'));}if(!_0x4bd3ca[_0x78a4('0x35')][_0x78a4('0x9c')]){throw new Error(_0x78a4('0x9d'));}var _0x3710ee=_0x4bd3ca['query'][_0x78a4('0x9e')]?_0x4bd3ca['query'][_0x78a4('0x9e')]+':'+_0x4bd3ca[_0x78a4('0x35')][_0x78a4('0x9c')]:'http://localhost:'+_0x4bd3ca[_0x78a4('0x35')][_0x78a4('0x9c')];var _0x486e86=_0x4bd3ca['query'][_0x78a4('0x1f')]?_0x4bd3ca[_0x78a4('0x35')][_0x78a4('0x1f')]:!![];var _0x3dece2=_0x4bd3ca[_0x78a4('0x35')][_0x78a4('0x9f')]?_0x4bd3ca[_0x78a4('0x35')][_0x78a4('0x9f')]:null;var _0x5cce43={'method':_0x4bd3ca[_0x78a4('0xa0')],'uri':util['format'](_0x78a4('0xa1'),_0x3710ee,_0x4bd3ca['query'][_0x78a4('0x8')]),'json':_0x486e86,'resolveWithFullResponse':!![],'encoding':_0x3dece2,'qs':_0x4bd3ca['query']};if(_0x4bd3ca[_0x78a4('0xa2')]){_0x5cce43[_0x78a4('0xa2')]=_0x4bd3ca[_0x78a4('0xa2')];if(_0x5cce43[_0x78a4('0xa2')]['content-length']){delete _0x5cce43[_0x78a4('0xa2')][_0x78a4('0xa3')];}}if(_0x5cce43[_0x78a4('0xa2')][_0x78a4('0xa4')]){delete _0x5cce43[_0x78a4('0xa2')]['content-type'];}return rp(_0x5cce43);})[_0x78a4('0x28')](function(_0x2009f9){if(_0x2009f9){_0x3ab55b['set'](_0x2009f9[_0x78a4('0xa2')]);logger['info'](_0x2009f9[_0x78a4('0x98')]);if(_['endsWith'](_0x4bd3ca[_0x78a4('0x35')][_0x78a4('0x8')],_0x78a4('0x4a'))&&_0x2009f9['statusCode']==0x1f4){return _0x3ab55b['sendStatus'](_0x2009f9[_0x78a4('0xa5')]);}else{return _0x3ab55b[_0x78a4('0x1e')](_0x2009f9[_0x78a4('0xa5')])[_0x78a4('0xa6')](_0x2009f9[_0x78a4('0x98')]);}}else{return _0x3ab55b[_0x78a4('0x1c')](0xc8);}})[_0x78a4('0x95')](handleError(_0x3ab55b,null));};exports[_0x78a4('0xa7')]=function(_0x466d6b,_0x1c7686,_0x2cb124){return BPromise['resolve']()['then'](function(){if(!_0x466d6b['query'][_0x78a4('0x8')]){throw new Error(_0x78a4('0x9b'));}if(!_0x466d6b[_0x78a4('0x35')]['port']){throw new Error(_0x78a4('0x9d'));}var _0x336368=_0x466d6b[_0x78a4('0x35')]['hostname']?_0x466d6b[_0x78a4('0x35')][_0x78a4('0x9e')]+':'+_0x466d6b[_0x78a4('0x35')][_0x78a4('0x9c')]:_0x78a4('0xa8')+_0x466d6b[_0x78a4('0x35')][_0x78a4('0x9c')];var _0x26e3b9=_0x466d6b[_0x78a4('0x35')][_0x78a4('0x1f')]?_0x466d6b[_0x78a4('0x35')]['json']:!![];var _0x4fefd4=_0x466d6b[_0x78a4('0x35')]['encoding']?_0x466d6b[_0x78a4('0x35')][_0x78a4('0x9f')]:null;var _0x25e9fa={'method':_0x466d6b['method'],'uri':util[_0x78a4('0x4d')](_0x78a4('0xa1'),_0x336368,_0x466d6b[_0x78a4('0x35')][_0x78a4('0x8')]),'json':_0x26e3b9,'resolveWithFullResponse':!![],'encoding':_0x4fefd4,'body':_0x466d6b[_0x78a4('0x98')]};if(_0x466d6b['headers']){_0x25e9fa[_0x78a4('0xa2')]=_0x466d6b['headers'];if(_0x25e9fa[_0x78a4('0xa2')][_0x78a4('0xa3')]){delete _0x25e9fa['headers'][_0x78a4('0xa3')];}}if(_0x25e9fa[_0x78a4('0xa2')][_0x78a4('0xa4')]){delete _0x25e9fa[_0x78a4('0xa2')]['content-type'];}return rp(_0x25e9fa);})[_0x78a4('0x28')](function(_0x580d7d){if(_0x580d7d){_0x1c7686['set'](_0x580d7d[_0x78a4('0xa2')]);logger[_0x78a4('0x63')](_0x580d7d[_0x78a4('0x98')]);return _0x1c7686[_0x78a4('0x1e')](_0x580d7d['statusCode'])[_0x78a4('0xa6')](_0x580d7d['body']);}else{return _0x1c7686['sendStatus'](0xc8);}})[_0x78a4('0x95')](handleError(_0x1c7686,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 7d460bd..b0f86d6 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 _0xae35=['events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2a80b4,_0x4d29a2){var _0x235877=function(_0x122418){while(--_0x122418){_0x2a80b4['push'](_0x2a80b4['shift']());}};_0x235877(++_0x4d29a2);}(_0xae35,0x172));var _0x5ae3=function(_0xaeb111,_0x4818aa){_0xaeb111=_0xaeb111-0x0;var _0x503302=_0xae35[_0xaeb111];return _0x503302;};'use strict';var EventEmitter=require(_0x5ae3('0x0'));var Plugin=require(_0x5ae3('0x1'))['db'][_0x5ae3('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5ae3('0x3')](0x0);var events={'afterCreate':_0x5ae3('0x4'),'afterUpdate':_0x5ae3('0x5'),'afterDestroy':_0x5ae3('0x6')};function emitEvent(_0x39d9b7){return function(_0x54c0f2,_0x6dffe3,_0x4d1536){PluginEvents[_0x5ae3('0x7')](_0x39d9b7+':'+_0x54c0f2['id'],_0x54c0f2);PluginEvents[_0x5ae3('0x7')](_0x39d9b7,_0x54c0f2);_0x4d1536(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x5ae3('0x8')](e,emitEvent(event));}}module[_0x5ae3('0x9')]=PluginEvents; \ No newline at end of file +var _0x8ac9=['remove','emit','exports','events','../../mysqldb','Plugin','update'];(function(_0x1366c2,_0x219667){var _0x53ce5c=function(_0x3fbf74){while(--_0x3fbf74){_0x1366c2['push'](_0x1366c2['shift']());}};_0x53ce5c(++_0x219667);}(_0x8ac9,0x199));var _0x98ac=function(_0x30f2d2,_0x413650){_0x30f2d2=_0x30f2d2-0x0;var _0x285f5c=_0x8ac9[_0x30f2d2];return _0x285f5c;};'use strict';var EventEmitter=require(_0x98ac('0x0'));var Plugin=require(_0x98ac('0x1'))['db'][_0x98ac('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x98ac('0x3'),'afterDestroy':_0x98ac('0x4')};function emitEvent(_0xd555bb){return function(_0x59f76b,_0x4bac60,_0x18968a){PluginEvents[_0x98ac('0x5')](_0xd555bb+':'+_0x59f76b['id'],_0x59f76b);PluginEvents[_0x98ac('0x5')](_0xd555bb,_0x59f76b);_0x18968a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x98ac('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 1362679..64b63f6 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 _0x0faf=['path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x0faf,0x132));var _0xf0fa=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0x0faf[_0x3c1312];return _0x5b4831;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));module['exports']=function(_0x3637a3,_0x44ffa0){return _0x3637a3[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf881=['define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x1bb1c0,_0x4d0be1){var _0x51722c=function(_0x2c4a65){while(--_0x2c4a65){_0x1bb1c0['push'](_0x1bb1c0['shift']());}};_0x51722c(++_0x4d0be1);}(_0xf881,0x9f));var _0x1f88=function(_0x84b7f2,_0x3bbc1d){_0x84b7f2=_0x84b7f2-0x0;var _0x52f617=_0xf881[_0x84b7f2];return _0x52f617;};'use strict';var _=require(_0x1f88('0x0'));var util=require(_0x1f88('0x1'));var logger=require(_0x1f88('0x2'))('api');var moment=require(_0x1f88('0x3'));var BPromise=require(_0x1f88('0x4'));var rp=require(_0x1f88('0x5'));var fs=require('fs');var path=require(_0x1f88('0x6'));var rimraf=require('rimraf');var config=require(_0x1f88('0x7'));var attributes=require('./plugin.attributes');module[_0x1f88('0x8')]=function(_0x451378,_0x4b7548){return _0x451378[_0x1f88('0x9')](_0x1f88('0xa'),attributes,{'tableName':_0x1f88('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 cdb9261..daa42dc 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 _0xdba6=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdba6,0x169));var _0x6dba=function(_0x4cb5be,_0x48489f){_0x4cb5be=_0x4cb5be-0x0;var _0x267c0c=_0xdba6[_0x4cb5be];return _0x267c0c;};'use strict';var _=require(_0x6dba('0x0'));var util=require(_0x6dba('0x1'));var moment=require(_0x6dba('0x2'));var BPromise=require(_0x6dba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dba('0x4'));var db=require(_0x6dba('0x5'))['db'];var utils=require(_0x6dba('0x6'));var logger=require(_0x6dba('0x7'))(_0x6dba('0x8'));var config=require('../../config/environment');var jayson=require(_0x6dba('0x9'));var client=jayson[_0x6dba('0xa')][_0x6dba('0xb')]({'port':0x232a});config[_0x6dba('0xc')]=_[_0x6dba('0xd')](config['redis'],{'host':_0x6dba('0xe'),'port':0x18eb});var socket=require(_0x6dba('0xf'))(new Redis(config[_0x6dba('0xc')]));require(_0x6dba('0x10'))[_0x6dba('0x11')](socket);function respondWithRpcPromise(_0x3cf66e,_0x4be35f,_0x386017){return new BPromise(function(_0x3b0dff,_0xa4c2bc){return client[_0x6dba('0x12')](_0x3cf66e,_0x386017)['then'](function(_0x517fb0){logger[_0x6dba('0x13')]('Plugin,\x20%s,\x20%s',_0x4be35f,_0x6dba('0x14'));logger[_0x6dba('0x15')](_0x6dba('0x16'),_0x4be35f,_0x6dba('0x14'),JSON[_0x6dba('0x17')](_0x517fb0));if(_0x517fb0['error']){if(_0x517fb0[_0x6dba('0x18')][_0x6dba('0x19')]===0x1f4){logger[_0x6dba('0x18')](_0x6dba('0x1a'),_0x4be35f,_0x517fb0[_0x6dba('0x18')][_0x6dba('0x1b')]);return _0xa4c2bc(_0x517fb0[_0x6dba('0x18')][_0x6dba('0x1b')]);}logger[_0x6dba('0x18')](_0x6dba('0x1a'),_0x4be35f,_0x517fb0[_0x6dba('0x18')][_0x6dba('0x1b')]);return _0x3b0dff(_0x517fb0[_0x6dba('0x18')][_0x6dba('0x1b')]);}else{logger['info'](_0x6dba('0x1a'),_0x4be35f,_0x6dba('0x14'));_0x3b0dff(_0x517fb0[_0x6dba('0x1c')][_0x6dba('0x1b')]);}})[_0x6dba('0x1d')](function(_0x21158d){logger[_0x6dba('0x18')](_0x6dba('0x1a'),_0x4be35f,_0x21158d);_0xa4c2bc(_0x21158d);});});}exports[_0x6dba('0x1e')]=function(_0x50cca6){var _0x9728ed=this;return new Promise(function(_0x2400c0,_0x278f39){return db[_0x6dba('0x1f')][_0x6dba('0x20')](_0x50cca6[_0x6dba('0x21')],{'raw':_0x50cca6[_0x6dba('0x22')]?_0x50cca6[_0x6dba('0x22')][_0x6dba('0x23')]===undefined?!![]:![]:!![]})[_0x6dba('0x24')](function(_0x29abcc){logger[_0x6dba('0x13')](_0x6dba('0x1e'),_0x50cca6);logger[_0x6dba('0x15')](_0x6dba('0x1e'),_0x50cca6,JSON[_0x6dba('0x17')](_0x29abcc));_0x2400c0(_0x29abcc);})[_0x6dba('0x1d')](function(_0x1ae37c){logger[_0x6dba('0x18')](_0x6dba('0x1e'),_0x1ae37c[_0x6dba('0x1b')],_0x50cca6);_0x278f39(_0x9728ed[_0x6dba('0x18')](0x1f4,_0x1ae37c[_0x6dba('0x1b')]));});});}; \ No newline at end of file +var _0x290f=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','request\x20sent','debug','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','Plugin','create','body','options','raw','CreatePlugin','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x8d29a8,_0x5582c3){var _0x1c6535=function(_0x338c){while(--_0x338c){_0x8d29a8['push'](_0x8d29a8['shift']());}};_0x1c6535(++_0x5582c3);}(_0x290f,0x110));var _0xf290=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x290f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf290('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf290('0x1'));var rs=require(_0xf290('0x2'));var fs=require('fs');var Redis=require(_0xf290('0x3'));var db=require(_0xf290('0x4'))['db'];var utils=require(_0xf290('0x5'));var logger=require(_0xf290('0x6'))(_0xf290('0x7'));var config=require(_0xf290('0x8'));var jayson=require(_0xf290('0x9'));var client=jayson[_0xf290('0xa')][_0xf290('0xb')]({'port':0x232a});config[_0xf290('0xc')]=_[_0xf290('0xd')](config[_0xf290('0xc')],{'host':_0xf290('0xe'),'port':0x18eb});var socket=require(_0xf290('0xf'))(new Redis(config[_0xf290('0xc')]));require(_0xf290('0x10'))['register'](socket);function respondWithRpcPromise(_0x2e39cb,_0x54df86,_0x546b2){return new BPromise(function(_0x13826d,_0x5e9386){return client[_0xf290('0x11')](_0x2e39cb,_0x546b2)[_0xf290('0x12')](function(_0x10c8b4){logger[_0xf290('0x13')]('Plugin,\x20%s,\x20%s',_0x54df86,_0xf290('0x14'));logger[_0xf290('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x54df86,'request\x20sent',JSON[_0xf290('0x16')](_0x10c8b4));if(_0x10c8b4[_0xf290('0x17')]){if(_0x10c8b4[_0xf290('0x17')][_0xf290('0x18')]===0x1f4){logger[_0xf290('0x17')]('Plugin,\x20%s,\x20%s',_0x54df86,_0x10c8b4['error'][_0xf290('0x19')]);return _0x5e9386(_0x10c8b4[_0xf290('0x17')][_0xf290('0x19')]);}logger[_0xf290('0x17')]('Plugin,\x20%s,\x20%s',_0x54df86,_0x10c8b4['error'][_0xf290('0x19')]);return _0x13826d(_0x10c8b4[_0xf290('0x17')][_0xf290('0x19')]);}else{logger[_0xf290('0x13')](_0xf290('0x1a'),_0x54df86,'request\x20sent');_0x13826d(_0x10c8b4[_0xf290('0x1b')][_0xf290('0x19')]);}})['catch'](function(_0x33ddda){logger[_0xf290('0x17')](_0xf290('0x1a'),_0x54df86,_0x33ddda);_0x5e9386(_0x33ddda);});});}exports['CreatePlugin']=function(_0x165641){var _0x16c7c1=this;return new Promise(function(_0x50b07e,_0x32e1d1){return db[_0xf290('0x1c')][_0xf290('0x1d')](_0x165641[_0xf290('0x1e')],{'raw':_0x165641[_0xf290('0x1f')]?_0x165641[_0xf290('0x1f')][_0xf290('0x20')]===undefined?!![]:![]:!![]})[_0xf290('0x12')](function(_0x87ece){logger[_0xf290('0x13')](_0xf290('0x21'),_0x165641);logger[_0xf290('0x15')](_0xf290('0x21'),_0x165641,JSON[_0xf290('0x16')](_0x87ece));_0x50b07e(_0x87ece);})[_0xf290('0x22')](function(_0xcae9f){logger['error'](_0xf290('0x21'),_0xcae9f[_0xf290('0x19')],_0x165641);_0x32e1d1(_0x16c7c1[_0xf290('0x17')](0x1f4,_0xcae9f['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5c964da..c3636c4 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 _0x320c=['register','length','plugin:','./plugin.events','save','remove','update','removeListener'];(function(_0x49f04c,_0x23c2b8){var _0x67e16b=function(_0x5e59eb){while(--_0x5e59eb){_0x49f04c['push'](_0x49f04c['shift']());}};_0x67e16b(++_0x23c2b8);}(_0x320c,0x193));var _0xc320=function(_0xc7ff6,_0x152b5f){_0xc7ff6=_0xc7ff6-0x0;var _0x460df6=_0x320c[_0xc7ff6];return _0x460df6;};'use strict';var PluginEvents=require(_0xc320('0x0'));var events=[_0xc320('0x1'),_0xc320('0x2'),_0xc320('0x3')];function createListener(_0x5aad57,_0x8b6df8){return function(_0x229623){_0x8b6df8['emit'](_0x5aad57,_0x229623);};}function removeListener(_0x4e960b,_0x29992a){return function(){PluginEvents[_0xc320('0x4')](_0x4e960b,_0x29992a);};}exports[_0xc320('0x5')]=function(_0x372ef7){for(var _0x529f4f=0x0,_0x9d922=events[_0xc320('0x6')];_0x529f4f<_0x9d922;_0x529f4f++){var _0x1ff37f=events[_0x529f4f];var _0x1239d7=createListener(_0xc320('0x7')+_0x1ff37f,_0x372ef7);PluginEvents['on'](_0x1ff37f,_0x1239d7);}}; \ No newline at end of file +var _0x65d4=['removeListener','register','length','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x1a57d1,_0x4281ff){var _0x394876=function(_0x268ec9){while(--_0x268ec9){_0x1a57d1['push'](_0x1a57d1['shift']());}};_0x394876(++_0x4281ff);}(_0x65d4,0x163));var _0x465d=function(_0x3fb86b,_0x3b30c8){_0x3fb86b=_0x3fb86b-0x0;var _0x13ffc7=_0x65d4[_0x3fb86b];return _0x13ffc7;};'use strict';var PluginEvents=require(_0x465d('0x0'));var events=[_0x465d('0x1'),_0x465d('0x2'),_0x465d('0x3')];function createListener(_0x37db00,_0x2e4659){return function(_0x3e9b4b){_0x2e4659[_0x465d('0x4')](_0x37db00,_0x3e9b4b);};}function removeListener(_0x58148e,_0x491914){return function(){PluginEvents[_0x465d('0x5')](_0x58148e,_0x491914);};}exports[_0x465d('0x6')]=function(_0xf315ee){for(var _0x35f20d=0x0,_0x547dd4=events[_0x465d('0x7')];_0x35f20d<_0x547dd4;_0x35f20d++){var _0x16af6c=events[_0x35f20d];var _0x214a17=createListener(_0x465d('0x8')+_0x16af6c,_0xf315ee);PluginEvents['on'](_0x16af6c,_0x214a17);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index d330d72..9a890ac 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(_0x5f399c,_0x35fc4e){var _0x31c813=function(_0x11d3c4){while(--_0x11d3c4){_0x5f399c['push'](_0x5f399c['shift']());}};_0x31c813(++_0x35fc4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x18fd88,_0x32fb37){var _0xe4298d=function(_0x15583c){while(--_0x15583c){_0x18fd88['push'](_0x18fd88['shift']());}};_0xe4298d(++_0x32fb37);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 8b570df..906aad4 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 _0x5b02=['../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','motion2','catch','show','describe','params','create','body','script','join'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x5b02,0xe9));var _0x25b0=function(_0x51bfde,_0x5d2967){_0x51bfde=_0x51bfde-0x0;var _0x2c1f72=_0x5b02[_0x51bfde];return _0x2c1f72;};'use strict';var _=require(_0x25b0('0x0'));var pm2=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var path=require('path');var exec=require('child_process')[_0x25b0('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3e1d20,_0x31c9c2){return function(_0x38dc14){if(!_0x38dc14){_0x3e1d20[_0x25b0('0x5')](0x194);;}return _0x38dc14;};}function respondWithResult(_0x2d84a9,_0x4eea55){_0x4eea55=_0x4eea55||0xc8;return function(_0x1d82c6){if(_0x1d82c6){return _0x2d84a9[_0x25b0('0x6')](_0x4eea55)['json'](_0x1d82c6);}return null;};}function handleError(_0x412954,_0x4d3e71){_0x4d3e71=_0x4d3e71||0x1f4;return function(_0x56feca){logger[_0x25b0('0x7')](_0x56feca[_0x25b0('0x8')]);if(_0x56feca[_0x25b0('0x9')]){delete _0x56feca['name'];}_0x412954[_0x25b0('0x6')](_0x4d3e71)[_0x25b0('0xa')](_0x56feca);};}function execChildProcess(){return new BPromise(function(_0x135afb,_0x250d31){exec(_0x25b0('0xb'),function(_0x2f57af,_0x44afbc,_0x10c3fb){logger[_0x25b0('0xc')](_0x44afbc);logger[_0x25b0('0xc')](_0x10c3fb);if(_0x2f57af){logger[_0x25b0('0x7')](_0x2f57af);return _0x250d31(_0x2f57af);}return _0x135afb(_0x44afbc);});});}exports[_0x25b0('0xd')]=function(_0x2048dc,_0x3655c2){return pm2[_0x25b0('0xe')]()[_0x25b0('0xf')](function(_0x293203){if(_0x293203){var _0x211658=_[_0x25b0('0x10')](_0x293203,function(_0x3b89e7){return _0x3b89e7[_0x25b0('0x9')]==='express'||_0x3b89e7['name']===_0x25b0('0x11');});return{'rows':_0x211658,'count':_0x211658['length']};}return null;})[_0x25b0('0xf')](respondWithResult(_0x3655c2,null))[_0x25b0('0x12')](handleError(_0x3655c2,null));};exports[_0x25b0('0x13')]=function(_0x3267b9,_0x5e3a3a){return pm2[_0x25b0('0x14')](_0x3267b9[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x5e3a3a,null))[_0x25b0('0xf')](handleEntityNotFound(_0x5e3a3a,null))[_0x25b0('0x12')](handleError(_0x5e3a3a,null));};exports[_0x25b0('0x16')]=function(_0x54f458,_0x348d36){if(_0x54f458[_0x25b0('0x17')][_0x25b0('0x9')]&&_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]){var _0xea4162=path[_0x25b0('0x19')](__dirname,_0x25b0('0x1a'),_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]);var _0x2b2eda=process[_0x25b0('0x1b')]();process['chdir'](path[_0x25b0('0x1c')](_0xea4162));return execChildProcess()[_0x25b0('0xf')](function(_0x517ec5){process[_0x25b0('0x1d')](_0x2b2eda);return pm2[_0x25b0('0x1e')]({'name':_0x54f458[_0x25b0('0x17')]['name'],'script':_0xea4162});})['then'](function(_0x50089e){pm2[_0x25b0('0x1f')]();return _0x50089e[0x0];})[_0x25b0('0xf')](respondWithResult(_0x348d36,0xc9))[_0x25b0('0x12')](handleError(_0x348d36,null));}else{return _0x348d36[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x20')});}};exports[_0x25b0('0x21')]=function(_0x75ce7a,_0x22e024){if(_0x75ce7a['body']['id']){delete _0x75ce7a[_0x25b0('0x17')]['id'];}var _0xbfba84={'online':'restart','stopped':'stop'};if(_0xbfba84['hasOwnProperty'](_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')])){return pm2[_0xbfba84[_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')]]](_0x75ce7a[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x22e024,0xc8))[_0x25b0('0x12')](handleError(_0x22e024,null));}else{return _0x22e024[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x22')});}};exports[_0x25b0('0x23')]=function(_0x3161c1,_0x1ea374){if(_0x3161c1['body']['id']){delete _0x3161c1['body']['id'];}if(_0x3161c1[_0x25b0('0x15')]['id']){return pm2['delete'](_0x3161c1['params']['id'])[_0x25b0('0xf')](function(_0x419975){pm2[_0x25b0('0x1f')]();return _0x419975[0x0];})[_0x25b0('0xf')](respondWithResult(_0x1ea374,null))[_0x25b0('0x12')](handleError(_0x1ea374,null));}else{return _0x1ea374['status'](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x24')});}}; \ No newline at end of file +var _0x2bc6=['json','error','stack','name','send','npm\x20install','info','then','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','bluebird','status'];(function(_0x1ee04b,_0x554b3d){var _0x412848=function(_0x11917a){while(--_0x11917a){_0x1ee04b['push'](_0x1ee04b['shift']());}};_0x412848(++_0x554b3d);}(_0x2bc6,0x163));var _0x62bc=function(_0x34401e,_0x169eaa){_0x34401e=_0x34401e-0x0;var _0x181b0e=_0x2bc6[_0x34401e];return _0x181b0e;};'use strict';var _=require(_0x62bc('0x0'));var pm2=require(_0x62bc('0x1'));var logger=require(_0x62bc('0x2'))('api');var path=require('path');var exec=require('child_process')['exec'];var BPromise=require(_0x62bc('0x3'));function handleEntityNotFound(_0x576608,_0x2a1959){return function(_0x2b12de){if(!_0x2b12de){_0x576608['sendStatus'](0x194);;}return _0x2b12de;};}function respondWithResult(_0x3cce26,_0x450cb6){_0x450cb6=_0x450cb6||0xc8;return function(_0x40af10){if(_0x40af10){return _0x3cce26[_0x62bc('0x4')](_0x450cb6)[_0x62bc('0x5')](_0x40af10);}return null;};}function handleError(_0x3f625c,_0x5bedeb){_0x5bedeb=_0x5bedeb||0x1f4;return function(_0x441722){logger[_0x62bc('0x6')](_0x441722[_0x62bc('0x7')]);if(_0x441722[_0x62bc('0x8')]){delete _0x441722['name'];}_0x3f625c[_0x62bc('0x4')](_0x5bedeb)[_0x62bc('0x9')](_0x441722);};}function execChildProcess(){return new BPromise(function(_0x1e3a57,_0x546acc){exec(_0x62bc('0xa'),function(_0x22e6c8,_0x256784,_0x444910){logger[_0x62bc('0xb')](_0x256784);logger[_0x62bc('0xb')](_0x444910);if(_0x22e6c8){logger[_0x62bc('0x6')](_0x22e6c8);return _0x546acc(_0x22e6c8);}return _0x1e3a57(_0x256784);});});}exports['index']=function(_0x2a96ae,_0x28390b){return pm2['list']()[_0x62bc('0xc')](function(_0x10230f){if(_0x10230f){var _0xc14ac9=_['reject'](_0x10230f,function(_0x263424){return _0x263424[_0x62bc('0x8')]==='express'||_0x263424['name']===_0x62bc('0xd');});return{'rows':_0xc14ac9,'count':_0xc14ac9[_0x62bc('0xe')]};}return null;})['then'](respondWithResult(_0x28390b,null))[_0x62bc('0xf')](handleError(_0x28390b,null));};exports[_0x62bc('0x10')]=function(_0xc1211c,_0x1e2405){return pm2[_0x62bc('0x11')](_0xc1211c[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](respondWithResult(_0x1e2405,null))[_0x62bc('0xc')](handleEntityNotFound(_0x1e2405,null))[_0x62bc('0xf')](handleError(_0x1e2405,null));};exports['create']=function(_0x5dd6f0,_0x2b2e5f){if(_0x5dd6f0[_0x62bc('0x13')][_0x62bc('0x8')]&&_0x5dd6f0['body'][_0x62bc('0x14')]){var _0x495f99=path[_0x62bc('0x15')](__dirname,_0x62bc('0x16'),_0x5dd6f0[_0x62bc('0x13')]['script']);var _0x3b8644=process[_0x62bc('0x17')]();process[_0x62bc('0x18')](path[_0x62bc('0x19')](_0x495f99));return execChildProcess()[_0x62bc('0xc')](function(_0x3b2eb0){process['chdir'](_0x3b8644);return pm2[_0x62bc('0x1a')]({'name':_0x5dd6f0[_0x62bc('0x13')][_0x62bc('0x8')],'script':_0x495f99});})[_0x62bc('0xc')](function(_0x117ebc){pm2['dump']();return _0x117ebc[0x0];})['then'](respondWithResult(_0x2b2e5f,0xc9))[_0x62bc('0xf')](handleError(_0x2b2e5f,null));}else{return _0x2b2e5f['status'](0x1f4)[_0x62bc('0x9')]({'message':_0x62bc('0x1b')});}};exports[_0x62bc('0x1c')]=function(_0x4a72d6,_0x3d55df){if(_0x4a72d6[_0x62bc('0x13')]['id']){delete _0x4a72d6[_0x62bc('0x13')]['id'];}var _0x5c03ac={'online':'restart','stopped':_0x62bc('0x1d')};if(_0x5c03ac[_0x62bc('0x1e')](_0x4a72d6[_0x62bc('0x13')]['status'])){return pm2[_0x5c03ac[_0x4a72d6[_0x62bc('0x13')][_0x62bc('0x4')]]](_0x4a72d6[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](respondWithResult(_0x3d55df,0xc8))['catch'](handleError(_0x3d55df,null));}else{return _0x3d55df[_0x62bc('0x4')](0x1f4)['send']({'message':_0x62bc('0x1f')});}};exports[_0x62bc('0x20')]=function(_0x32048f,_0x2dd7fd){if(_0x32048f[_0x62bc('0x13')]['id']){delete _0x32048f[_0x62bc('0x13')]['id'];}if(_0x32048f[_0x62bc('0x12')]['id']){return pm2[_0x62bc('0x21')](_0x32048f[_0x62bc('0x12')]['id'])[_0x62bc('0xc')](function(_0x156f95){pm2[_0x62bc('0x22')]();return _0x156f95[0x0];})[_0x62bc('0xc')](respondWithResult(_0x2dd7fd,null))[_0x62bc('0xf')](handleError(_0x2dd7fd,null));}else{return _0x2dd7fd[_0x62bc('0x4')](0x1f4)[_0x62bc('0x9')]({'message':_0x62bc('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index ea16ad1..50e5dab 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 _0x7b77=['Router','../../components/auth/service','./realtime.controller','/queues','isAuthenticated','getQueues','express'];(function(_0x11086d,_0x5207a1){var _0x23a14c=function(_0x524dc8){while(--_0x524dc8){_0x11086d['push'](_0x11086d['shift']());}};_0x23a14c(++_0x5207a1);}(_0x7b77,0x179));var _0x77b7=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x7b77[_0x31a371];return _0x2a5bd6;};'use strict';var express=require(_0x77b7('0x0'));var router=express[_0x77b7('0x1')]();var auth=require(_0x77b7('0x2'));var controller=require(_0x77b7('0x3'));router['get'](_0x77b7('0x4'),auth[_0x77b7('0x5')](),controller[_0x77b7('0x6')]);module['exports']=router; \ No newline at end of file +var _0xafec=['../../components/auth/service','./realtime.controller','get','isAuthenticated','exports','Router'];(function(_0x6f67ca,_0x2bda69){var _0x485f4d=function(_0x56d0d6){while(--_0x56d0d6){_0x6f67ca['push'](_0x6f67ca['shift']());}};_0x485f4d(++_0x2bda69);}(_0xafec,0x161));var _0xcafe=function(_0x2e2763,_0x5cfb9c){_0x2e2763=_0x2e2763-0x0;var _0x26aef0=_0xafec[_0x2e2763];return _0x26aef0;};'use strict';var express=require('express');var router=express[_0xcafe('0x0')]();var auth=require(_0xcafe('0x1'));var controller=require(_0xcafe('0x2'));router[_0xcafe('0x3')]('/queues',auth[_0xcafe('0x4')](),controller['getQueues']);module[_0xcafe('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 9c42825..017b900 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 _0x2e0b=['pick','filter','queue','length','some','internal','toString','UserId','accountcode','online','User','startCase','Queue','Pause','findAll','QueueId','getQueues','chat','openchannel','fax','whatsapp','resolve','query','channel','includes','toLowerCase','Invalid\x20channel','rawAttributes','fieldName','type','key','role','user','UserProfile','findAndCountAll','rows','all','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','limit','undefined','count','Content-Range','json','error','name','status','send','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','outbound','push','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','find'];(function(_0x35e8a2,_0x180e53){var _0x5097fa=function(_0x2784ce){while(--_0x2784ce){_0x35e8a2['push'](_0x35e8a2['shift']());}};_0x5097fa(++_0x180e53);}(_0x2e0b,0x1a5));var _0xb2e0=function(_0x18f1e6,_0x521510){_0x18f1e6=_0x18f1e6-0x0;var _0x5dcd46=_0x2e0b[_0x18f1e6];return _0x5dcd46;};'use strict';var util=require('util');var _=require(_0xb2e0('0x0'));var jayson=require(_0xb2e0('0x1'));var qs=require(_0xb2e0('0x2'));var logger=require(_0xb2e0('0x3'))(_0xb2e0('0x4'));var db=require(_0xb2e0('0x5'))['db'];var amiClient=jayson[_0xb2e0('0x6')][_0xb2e0('0x7')]({'port':0x232a});var routingClient=jayson['client'][_0xb2e0('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x23b560,_0x4f6f33){return function(_0x1ddb64){if(_0x1ddb64){var _0xe18d5c=typeof _0x4f6f33[_0xb2e0('0x8')]==='undefined'&&typeof _0x4f6f33[_0xb2e0('0x9')]===_0xb2e0('0xa');var _0x53f001=_0x1ddb64[_0xb2e0('0xb')];var _0x4c1c35=_0xe18d5c?0x0:_0x4f6f33[_0xb2e0('0x8')];var _0x2096ca=_0xe18d5c?_0x1ddb64[_0xb2e0('0xb')]:_0x4f6f33[_0xb2e0('0x8')]+_0x4f6f33['limit'];var _0x1fbb08;if(_0x2096ca>=_0x53f001){_0x2096ca=_0x53f001;_0x1fbb08=0xc8;}else{_0x1fbb08=0xce;}_0x23b560['status'](_0x1fbb08);return _0x23b560['set'](_0xb2e0('0xc'),_0x4c1c35+'-'+_0x2096ca+'/'+_0x53f001)[_0xb2e0('0xd')](_0x1ddb64);}return null;};}function handleError(_0x10cde7,_0x1f0770){_0x1f0770=_0x1f0770||0x1f4;return function(_0x1a2677){logger[_0xb2e0('0xe')](_0x1a2677['stack']);if(_0x1a2677[_0xb2e0('0xf')]){delete _0x1a2677[_0xb2e0('0xf')];}_0x10cde7[_0xb2e0('0x10')](_0x1f0770)[_0xb2e0('0x11')](_0x1a2677);};}function getRealtimeAgents(){return new Promise(function(_0x136a8e,_0x34e8a5){return amiClient[_0xb2e0('0x12')]('Agents',{})[_0xb2e0('0x13')](function(_0x5de5ec){if(_0x5de5ec[_0xb2e0('0xe')])throw new Error(_0xb2e0('0x14'));var _0x203fde=_0x5de5ec[_0xb2e0('0x15')];return routingClient[_0xb2e0('0x12')](_0xb2e0('0x16'),{})[_0xb2e0('0x13')](function(_0x34d8bb){if(_0x34d8bb[_0xb2e0('0xe')])throw new Error(_0xb2e0('0x17'));var _0x481c88=_0x34d8bb['result'];return _0x136a8e(_[_0xb2e0('0x18')]({},_0x203fde,_0x481c88));});})[_0xb2e0('0x19')](function(_0x3c795a){_0x34e8a5(_0x3c795a);});});}function getRealtimeQueues(_0x66d18,_0x385681){return new Promise(function(_0x4f317a,_0x2afdfe){var _0xfbefe4=_0x385681===_0xb2e0('0x1a')?amiClient:routingClient;return _0xfbefe4[_0xb2e0('0x12')](_['startCase'](_0x385681)+_0xb2e0('0x1b'),_0x66d18)[_0xb2e0('0x13')](function(_0x3272e6){if(_0x3272e6[_0xb2e0('0xe')])throw new Error(util[_0xb2e0('0x1c')](_0xb2e0('0x1d'),_0x385681));return _0x4f317a(_0x3272e6[_0xb2e0('0x15')]);})['catch'](function(_0x3c09b4){_0x2afdfe(_0x3c09b4);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x35c6c5,_0x258cac){return amiClient['request'](_0xb2e0('0x1e'),{})['then'](function(_0x8bfc50){if(_0x8bfc50['error'])throw new Error(_0xb2e0('0x1f'));return _0x35c6c5(_0x8bfc50[_0xb2e0('0x15')]);})[_0xb2e0('0x19')](function(_0x13d924){_0x258cac(_0x13d924);});});}function initializeQueues(_0x1ca143,_0x24acd4,_0x25aa0d,_0x171839){var _0x1ea055=['loggedIn',_0xb2e0('0x20'),_0xb2e0('0x21'),_0xb2e0('0x22'),_0xb2e0('0x23')];if(_0x25aa0d===_0xb2e0('0x1a')&&_0x171839===_0xb2e0('0x24')){_0x1ea055[_0xb2e0('0x25')](_0xb2e0('0x26'),'originated',_0xb2e0('0x27'),_0xb2e0('0x28'),_0xb2e0('0x29'),_0xb2e0('0x2a'),_0xb2e0('0x2b'),_0xb2e0('0x2c'),_0xb2e0('0x2d'),_0xb2e0('0x2e'),_0xb2e0('0x2f'),'erlangBusyFactor','dialPredictiveInterval',_0xb2e0('0x30'),_0xb2e0('0x31'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0xb2e0('0x32'),'predictiveIntervalDroppedCallsCallersExit',_0xb2e0('0x33'),_0xb2e0('0x34'));}return _0x1ca143[_0xb2e0('0x35')](function(_0x9fab63){var _0x22fd23=_0x9fab63[_0xb2e0('0x36')]({'plain':!![]});_0x22fd23[_0xb2e0('0x37')]=[];_0x22fd23[_0xb2e0('0x23')]=0x0;_0x22fd23[_0xb2e0('0x38')]=0x0;_0x22fd23['loggedIn']=0x0;_0x22fd23['available']=0x0;_0x22fd23['waiting']=0x0;if(_0x25aa0d==='voice'){_0x22fd23['talking']=0x0;_0x22fd23[_0xb2e0('0x39')]=0x0;if(_0x171839===_0xb2e0('0x24')){_0x22fd23['pTalking']=0x0;_0x22fd23['originated']=0x0;}}var _0x2f5bde=_[_0xb2e0('0x3a')](_0x24acd4,['id',_0x22fd23['id']]);if(_0x2f5bde)_[_0xb2e0('0x18')](_0x22fd23,_[_0xb2e0('0x3b')](_0x2f5bde,_0x1ea055));return _0x22fd23;});}function updateAgentVoiceStatus(_0x3c1d0f,_0xed479,_0x560cd9){var _0x2b36c7=_[_0xb2e0('0x3c')](_0x560cd9,[_0xb2e0('0x3d'),_0xed479['name']]);if(_0x2b36c7[_0xb2e0('0x3e')]===0x0)return _0x3c1d0f['busy']=!![];if(_[_0xb2e0('0x3f')](_0x2b36c7,['connectedlinenum',_0x3c1d0f[_0xb2e0('0x40')][_0xb2e0('0x41')]()]))return _0x3c1d0f[_0xb2e0('0x22')]=!![];if(!_0x3c1d0f[_0xb2e0('0x22')])return _0x3c1d0f[_0xb2e0('0x39')]=!![];}function getVoiceQueueAgents(_0x146fa9,_0x171622,_0x18f689,_0x4eed98){var _0x4e40da=_['find'](_0x171622,['id',_0x146fa9['id']]);if(!_0x4e40da)return _0x146fa9;return _0x4e40da['getMembers']({'raw':!![]})[_0xb2e0('0x13')](function(_0xbddacc){for(var _0x5f201e=0x0;_0x5f201e<_0xbddacc[_0xb2e0('0x3e')];_0x5f201e++){var _0x33b122=_[_0xb2e0('0x3a')](_0x18f689,['id',_0xbddacc[_0x5f201e][_0xb2e0('0x42')]]);if(!_0x33b122){_0x33b122={'id':_0xbddacc[_0x5f201e][_0xb2e0('0x42')],'name':_0xbddacc[_0x5f201e][_0xb2e0('0x42')],'accountcode':'','online':![]};}var _0x3d495b={'id':_0x33b122['id'],'name':_0x33b122[_0xb2e0('0xf')],'internal':_0x33b122[_0xb2e0('0x43')],'online':Boolean(_0x33b122['online']),'paused':Boolean(_0xbddacc[_0x5f201e][_0xb2e0('0x23')])};if(_0x33b122['voiceStatus']==='talking')updateAgentVoiceStatus(_0x3d495b,_0x146fa9,_0x4eed98);if(_0x3d495b[_0xb2e0('0x44')])_0x146fa9['loggedInDb']++;if(_0x3d495b[_0xb2e0('0x39')])_0x146fa9['busy']++;if(_0x3d495b[_0xb2e0('0x23')]&&!_0x3d495b[_0xb2e0('0x39')]&&!_0x3d495b['talking'])_0x146fa9[_0xb2e0('0x23')]++;_0x146fa9[_0xb2e0('0x37')][_0xb2e0('0x25')](_0x3d495b);}return _0x146fa9;});}function getQueueAgents(_0x2912ea,_0x249d32,_0x1ae2e9){var _0x5e053f=_0xb2e0('0x45')+_[_0xb2e0('0x46')](_0x1ae2e9)+_0xb2e0('0x47');var _0x2940ed=_0x1ae2e9+_0xb2e0('0x48');return db[_0x5e053f][_0xb2e0('0x49')]({'where':{[_[_0xb2e0('0x46')](_0x1ae2e9)+_0xb2e0('0x4a')]:_0x2912ea['id']},'raw':!![]})[_0xb2e0('0x13')](function(_0x5de7ea){for(var _0x1dcb49=0x0;_0x1dcb49<_0x5de7ea[_0xb2e0('0x3e')];_0x1dcb49++){var _0x35b5c7=_[_0xb2e0('0x3a')](_0x249d32,['id',_0x5de7ea[_0x1dcb49][_0xb2e0('0x42')]]);if(!_0x35b5c7){_0x35b5c7={'id':_0x5de7ea[_0x1dcb49][_0xb2e0('0x42')],'name':_0x5de7ea[_0x1dcb49][_0xb2e0('0x42')],'online':![],['pauseField']:![]};}var _0x311d6e={'id':_0x35b5c7['id'],'name':_0x35b5c7[_0xb2e0('0xf')],'online':Boolean(_0x35b5c7[_0xb2e0('0x44')]),'paused':Boolean(_0x35b5c7[_0x2940ed])};if(_0x311d6e[_0xb2e0('0x44')])_0x2912ea['loggedInDb']++;_0x2912ea[_0xb2e0('0x37')][_0xb2e0('0x25')](_0x311d6e);}return _0x2912ea;});}exports[_0xb2e0('0x4b')]=function(_0x3f4f17,_0x365c3c){var _0x5ae7ed=['mail',_0xb2e0('0x4c'),'sms',_0xb2e0('0x4d'),_0xb2e0('0x4e'),_0xb2e0('0x4f'),_0xb2e0('0x1a')];var _0x3246b0={'count':0x0,'rows':[]},_0x2919e5={},_0x4b5ab2,_0x400465,_0x190a31,_0x42b3d9,_0x31c613;Promise[_0xb2e0('0x50')]()['then'](function(){if(_0x3f4f17[_0xb2e0('0x51')][_0xb2e0('0x52')]){if(!_[_0xb2e0('0x53')](_0x5ae7ed,_0x3f4f17[_0xb2e0('0x51')][_0xb2e0('0x52')][_0xb2e0('0x54')]()))throw new Error(_0xb2e0('0x55'));_0x4b5ab2=_0x3f4f17[_0xb2e0('0x51')][_0xb2e0('0x52')][_0xb2e0('0x54')]();}var _0x1b2dba=_['startCase'](_0x4b5ab2)+'Queue';var _0x279dea=_[_0xb2e0('0x35')](db[_0x1b2dba][_0xb2e0('0x56')],function(_0x1137ab){return{'name':_0x1137ab[_0xb2e0('0x57')],'type':_0x1137ab[_0xb2e0('0x58')][_0xb2e0('0x59')]};});_0x2919e5=qs['getOptions'](_0x279dea,_0x3f4f17);if(_0x3f4f17['user'][_0xb2e0('0x5a')]===_0xb2e0('0x5b')){var _0x1f0f5b={'params':{'id':_0x3f4f17[_0xb2e0('0x5b')]['userProfileId']},'query':{'section':_0x4b5ab2===_0xb2e0('0x1a')&&_0x3f4f17[_0xb2e0('0x51')]['type']===_0xb2e0('0x24')?'QueueCampaigns':_[_0xb2e0('0x46')](_0x4b5ab2)+'Queues','type':_0x3f4f17[_0xb2e0('0x51')][_0xb2e0('0x58')],'nolimit':!![],'sort':_0xb2e0('0xf'),'filter':_0x3f4f17['query']['filter']}};return db[_0xb2e0('0x5c')]['getResources'](_0x1f0f5b);}return db[_0x1b2dba][_0xb2e0('0x5d')](_0x2919e5);})[_0xb2e0('0x13')](function(_0x548e79){_0x3246b0[_0xb2e0('0xb')]=_0x548e79['count'];_0x400465=_0x548e79[_0xb2e0('0x5e')];return getRealtimeQueues(_0x3f4f17,_0x4b5ab2);})[_0xb2e0('0x13')](function(_0x55670b){_0x42b3d9=_0x55670b[_0xb2e0('0x5e')];return getRealtimeAgents();})[_0xb2e0('0x13')](function(_0x3ca398){_0x190a31=_0x3ca398['rows'];if(_0x4b5ab2!=_0xb2e0('0x1a'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x33cd44){_0x31c613=_0x33cd44?_0x33cd44[_0xb2e0('0x5e')]:[];return initializeQueues(_0x400465,_0x42b3d9,_0x4b5ab2,_0x3f4f17[_0xb2e0('0x51')][_0xb2e0('0x58')]);})[_0xb2e0('0x13')](function(_0x5a5ebb){var _0x45cfa1=_0x5a5ebb[_0xb2e0('0x35')](function(_0x3a3ccc){if(_0x4b5ab2===_0xb2e0('0x1a'))return getVoiceQueueAgents(_0x3a3ccc,_0x400465,_0x190a31,_0x31c613);else return getQueueAgents(_0x3a3ccc,_0x190a31,_0x4b5ab2);});return Promise[_0xb2e0('0x5f')](_0x45cfa1);})[_0xb2e0('0x13')](function(_0x328750){_0x3246b0[_0xb2e0('0x5e')]=_0x328750;return _0x3246b0;})[_0xb2e0('0x13')](respondWithFilteredResult(_0x365c3c,_0x2919e5))[_0xb2e0('0x19')](handleError(_0x365c3c,null));}; \ No newline at end of file +var _0x6046=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','get','loggedInDb','available','busy','filter','queue','length','some','internal','talking','find','getMembers','accountcode','online','voiceStatus','agents','User','Pause','findAll','QueueId','UserId','mail','chat','sms','openchannel','fax','whatsapp','resolve','query','includes','channel','toLowerCase','Invalid\x20channel','Queue','rawAttributes','fieldName','type','key','getOptions','user','QueueCampaigns','UserProfile','getResources','findAndCountAll','rows','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','undefined','count','offset','limit','status','set','Content-Range','json','name','send','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls'];(function(_0x40bef3,_0x12f30d){var _0x4c8d09=function(_0x18a37f){while(--_0x18a37f){_0x40bef3['push'](_0x40bef3['shift']());}};_0x4c8d09(++_0x12f30d);}(_0x6046,0x96));var _0x6604=function(_0x21e000,_0x32db1f){_0x21e000=_0x21e000-0x0;var _0x218e1c=_0x6046[_0x21e000];return _0x218e1c;};'use strict';var util=require(_0x6604('0x0'));var _=require(_0x6604('0x1'));var jayson=require(_0x6604('0x2'));var qs=require(_0x6604('0x3'));var logger=require(_0x6604('0x4'))(_0x6604('0x5'));var db=require(_0x6604('0x6'))['db'];var amiClient=jayson[_0x6604('0x7')][_0x6604('0x8')]({'port':0x232a});var routingClient=jayson[_0x6604('0x7')][_0x6604('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x56e90e,_0x4536b3){return function(_0x48897f){if(_0x48897f){var _0x38c656=typeof _0x4536b3['offset']===_0x6604('0x9')&&typeof _0x4536b3['limit']===_0x6604('0x9');var _0x215b48=_0x48897f[_0x6604('0xa')];var _0x1db593=_0x38c656?0x0:_0x4536b3['offset'];var _0x18da9f=_0x38c656?_0x48897f[_0x6604('0xa')]:_0x4536b3[_0x6604('0xb')]+_0x4536b3[_0x6604('0xc')];var _0x32fc9a;if(_0x18da9f>=_0x215b48){_0x18da9f=_0x215b48;_0x32fc9a=0xc8;}else{_0x32fc9a=0xce;}_0x56e90e[_0x6604('0xd')](_0x32fc9a);return _0x56e90e[_0x6604('0xe')](_0x6604('0xf'),_0x1db593+'-'+_0x18da9f+'/'+_0x215b48)[_0x6604('0x10')](_0x48897f);}return null;};}function handleError(_0x55a0b9,_0x349cfd){_0x349cfd=_0x349cfd||0x1f4;return function(_0x9fc9d4){logger['error'](_0x9fc9d4['stack']);if(_0x9fc9d4[_0x6604('0x11')]){delete _0x9fc9d4[_0x6604('0x11')];}_0x55a0b9[_0x6604('0xd')](_0x349cfd)[_0x6604('0x12')](_0x9fc9d4);};}function getRealtimeAgents(){return new Promise(function(_0x370a36,_0x15d00b){return amiClient[_0x6604('0x13')](_0x6604('0x14'),{})[_0x6604('0x15')](function(_0x474f1b){if(_0x474f1b[_0x6604('0x16')])throw new Error(_0x6604('0x17'));var _0x456c67=_0x474f1b[_0x6604('0x18')];return routingClient[_0x6604('0x13')]('Agents',{})[_0x6604('0x15')](function(_0x509616){if(_0x509616[_0x6604('0x16')])throw new Error(_0x6604('0x19'));var _0x3c27d9=_0x509616[_0x6604('0x18')];return _0x370a36(_[_0x6604('0x1a')]({},_0x456c67,_0x3c27d9));});})[_0x6604('0x1b')](function(_0x5f06cd){_0x15d00b(_0x5f06cd);});});}function getRealtimeQueues(_0x543914,_0x420486){return new Promise(function(_0x3ecc0a,_0x3539fb){var _0x55338c=_0x420486===_0x6604('0x1c')?amiClient:routingClient;return _0x55338c[_0x6604('0x13')](_[_0x6604('0x1d')](_0x420486)+_0x6604('0x1e'),_0x543914)[_0x6604('0x15')](function(_0x2a6287){if(_0x2a6287[_0x6604('0x16')])throw new Error(util[_0x6604('0x1f')](_0x6604('0x20'),_0x420486));return _0x3ecc0a(_0x2a6287['result']);})[_0x6604('0x1b')](function(_0x57a9f5){_0x3539fb(_0x57a9f5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5a1942,_0x23be8b){return amiClient[_0x6604('0x13')](_0x6604('0x21'),{})['then'](function(_0xf0349){if(_0xf0349['error'])throw new Error(_0x6604('0x22'));return _0x5a1942(_0xf0349[_0x6604('0x18')]);})[_0x6604('0x1b')](function(_0x7bff4f){_0x23be8b(_0x7bff4f);});});}function initializeQueues(_0x5685a1,_0x39089b,_0x35cdd2,_0x28c287){var _0x30946c=[_0x6604('0x23'),'available',_0x6604('0x24'),'talking',_0x6604('0x25')];if(_0x35cdd2===_0x6604('0x1c')&&_0x28c287===_0x6604('0x26')){_0x30946c[_0x6604('0x27')](_0x6604('0x28'),_0x6604('0x29'),_0x6604('0x2a'),_0x6604('0x2b'),_0x6604('0x2c'),_0x6604('0x2d'),_0x6604('0x2e'),'startProgressive',_0x6604('0x2f'),_0x6604('0x30'),_0x6604('0x31'),'erlangBusyFactor','dialPredictiveInterval',_0x6604('0x32'),_0x6604('0x33'),_0x6604('0x34'),'predictiveIntervalTotalCalls',_0x6604('0x35'),'predictiveIntervalDroppedCallsTimeout',_0x6604('0x36'),'predictiveIntervalAvgHoldtime',_0x6604('0x37'));}return _0x5685a1[_0x6604('0x38')](function(_0x7a3af){var _0x5dd649=_0x7a3af[_0x6604('0x39')]({'plain':!![]});_0x5dd649['agents']=[];_0x5dd649[_0x6604('0x25')]=0x0;_0x5dd649[_0x6604('0x3a')]=0x0;_0x5dd649[_0x6604('0x23')]=0x0;_0x5dd649[_0x6604('0x3b')]=0x0;_0x5dd649[_0x6604('0x24')]=0x0;if(_0x35cdd2===_0x6604('0x1c')){_0x5dd649['talking']=0x0;_0x5dd649[_0x6604('0x3c')]=0x0;if(_0x28c287==='outbound'){_0x5dd649['pTalking']=0x0;_0x5dd649['originated']=0x0;}}var _0x1eafe5=_['find'](_0x39089b,['id',_0x5dd649['id']]);if(_0x1eafe5)_[_0x6604('0x1a')](_0x5dd649,_['pick'](_0x1eafe5,_0x30946c));return _0x5dd649;});}function updateAgentVoiceStatus(_0x236975,_0x1e61ae,_0x3429f9){var _0x55c806=_[_0x6604('0x3d')](_0x3429f9,[_0x6604('0x3e'),_0x1e61ae[_0x6604('0x11')]]);if(_0x55c806[_0x6604('0x3f')]===0x0)return _0x236975[_0x6604('0x3c')]=!![];if(_[_0x6604('0x40')](_0x55c806,['connectedlinenum',_0x236975[_0x6604('0x41')]['toString']()]))return _0x236975[_0x6604('0x42')]=!![];if(!_0x236975[_0x6604('0x42')])return _0x236975['busy']=!![];}function getVoiceQueueAgents(_0x38fb70,_0x1af198,_0x3832d7,_0x1b3555){var _0x38eec5=_[_0x6604('0x43')](_0x1af198,['id',_0x38fb70['id']]);if(!_0x38eec5)return _0x38fb70;return _0x38eec5[_0x6604('0x44')]({'raw':!![]})['then'](function(_0x404801){for(var _0x3045d8=0x0;_0x3045d8<_0x404801['length'];_0x3045d8++){var _0x4e5386=_[_0x6604('0x43')](_0x3832d7,['id',_0x404801[_0x3045d8]['UserId']]);if(!_0x4e5386){_0x4e5386={'id':_0x404801[_0x3045d8]['UserId'],'name':_0x404801[_0x3045d8]['UserId'],'accountcode':'','online':![]};}var _0x21a0d2={'id':_0x4e5386['id'],'name':_0x4e5386[_0x6604('0x11')],'internal':_0x4e5386[_0x6604('0x45')],'online':Boolean(_0x4e5386[_0x6604('0x46')]),'paused':Boolean(_0x404801[_0x3045d8][_0x6604('0x25')])};if(_0x4e5386[_0x6604('0x47')]===_0x6604('0x42'))updateAgentVoiceStatus(_0x21a0d2,_0x38fb70,_0x1b3555);if(_0x21a0d2['online'])_0x38fb70[_0x6604('0x3a')]++;if(_0x21a0d2[_0x6604('0x3c')])_0x38fb70[_0x6604('0x3c')]++;if(_0x21a0d2['paused']&&!_0x21a0d2['busy']&&!_0x21a0d2['talking'])_0x38fb70[_0x6604('0x25')]++;_0x38fb70[_0x6604('0x48')]['push'](_0x21a0d2);}return _0x38fb70;});}function getQueueAgents(_0x41f10f,_0x187598,_0x58bce0){var _0x982b49=_0x6604('0x49')+_[_0x6604('0x1d')](_0x58bce0)+'Queue';var _0x4c229f=_0x58bce0+_0x6604('0x4a');return db[_0x982b49][_0x6604('0x4b')]({'where':{[_[_0x6604('0x1d')](_0x58bce0)+_0x6604('0x4c')]:_0x41f10f['id']},'raw':!![]})[_0x6604('0x15')](function(_0xb71b51){for(var _0x141cbc=0x0;_0x141cbc<_0xb71b51[_0x6604('0x3f')];_0x141cbc++){var _0x265bca=_[_0x6604('0x43')](_0x187598,['id',_0xb71b51[_0x141cbc]['UserId']]);if(!_0x265bca){_0x265bca={'id':_0xb71b51[_0x141cbc][_0x6604('0x4d')],'name':_0xb71b51[_0x141cbc][_0x6604('0x4d')],'online':![],['pauseField']:![]};}var _0xcb96ad={'id':_0x265bca['id'],'name':_0x265bca['name'],'online':Boolean(_0x265bca[_0x6604('0x46')]),'paused':Boolean(_0x265bca[_0x4c229f])};if(_0xcb96ad[_0x6604('0x46')])_0x41f10f['loggedInDb']++;_0x41f10f['agents'][_0x6604('0x27')](_0xcb96ad);}return _0x41f10f;});}exports['getQueues']=function(_0x234241,_0x2392ca){var _0x2b5c74=[_0x6604('0x4e'),_0x6604('0x4f'),_0x6604('0x50'),_0x6604('0x51'),_0x6604('0x52'),_0x6604('0x53'),_0x6604('0x1c')];var _0x465588={'count':0x0,'rows':[]},_0x3c0479={},_0x544b9c,_0x5244a8,_0x3ecec9,_0x312f2f,_0x5b487b;Promise[_0x6604('0x54')]()['then'](function(){if(_0x234241[_0x6604('0x55')]['channel']){if(!_[_0x6604('0x56')](_0x2b5c74,_0x234241[_0x6604('0x55')][_0x6604('0x57')][_0x6604('0x58')]()))throw new Error(_0x6604('0x59'));_0x544b9c=_0x234241[_0x6604('0x55')][_0x6604('0x57')][_0x6604('0x58')]();}var _0xe65940=_[_0x6604('0x1d')](_0x544b9c)+_0x6604('0x5a');var _0xb50c74=_[_0x6604('0x38')](db[_0xe65940][_0x6604('0x5b')],function(_0x4a33f4){return{'name':_0x4a33f4[_0x6604('0x5c')],'type':_0x4a33f4[_0x6604('0x5d')][_0x6604('0x5e')]};});_0x3c0479=qs[_0x6604('0x5f')](_0xb50c74,_0x234241);if(_0x234241[_0x6604('0x60')]['role']==='user'){var _0x2e5ad4={'params':{'id':_0x234241['user']['userProfileId']},'query':{'section':_0x544b9c==='voice'&&_0x234241['query'][_0x6604('0x5d')]===_0x6604('0x26')?_0x6604('0x61'):_[_0x6604('0x1d')](_0x544b9c)+_0x6604('0x1e'),'type':_0x234241[_0x6604('0x55')]['type'],'nolimit':!![],'sort':_0x6604('0x11'),'filter':_0x234241[_0x6604('0x55')]['filter']}};return db[_0x6604('0x62')][_0x6604('0x63')](_0x2e5ad4);}return db[_0xe65940][_0x6604('0x64')](_0x3c0479);})['then'](function(_0x4f98e4){_0x465588[_0x6604('0xa')]=_0x4f98e4[_0x6604('0xa')];_0x5244a8=_0x4f98e4['rows'];return getRealtimeQueues(_0x234241,_0x544b9c);})['then'](function(_0x12a86c){_0x312f2f=_0x12a86c['rows'];return getRealtimeAgents();})[_0x6604('0x15')](function(_0x68e4c7){_0x3ecec9=_0x68e4c7['rows'];if(_0x544b9c!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x6604('0x15')](function(_0x2635e3){_0x5b487b=_0x2635e3?_0x2635e3[_0x6604('0x65')]:[];return initializeQueues(_0x5244a8,_0x312f2f,_0x544b9c,_0x234241[_0x6604('0x55')][_0x6604('0x5d')]);})[_0x6604('0x15')](function(_0x942cd6){var _0x16e9fc=_0x942cd6[_0x6604('0x38')](function(_0x5c9b2e){if(_0x544b9c===_0x6604('0x1c'))return getVoiceQueueAgents(_0x5c9b2e,_0x5244a8,_0x3ecec9,_0x5b487b);else return getQueueAgents(_0x5c9b2e,_0x3ecec9,_0x544b9c);});return Promise['all'](_0x16e9fc);})[_0x6604('0x15')](function(_0x3b4408){_0x465588[_0x6604('0x65')]=_0x3b4408;return _0x465588;})[_0x6604('0x15')](respondWithFilteredResult(_0x2392ca,_0x3c0479))[_0x6604('0x1b')](handleError(_0x2392ca,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index dc59c42..dfca472 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2b2e44,_0x36b38a){var _0x2d0b45=function(_0x474e39){while(--_0x474e39){_0x2b2e44['push'](_0x2b2e44['shift']());}};_0x2d0b45(++_0x36b38a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x226e40,_0x5d4f63){var _0x28d859=function(_0x4d4262){while(--_0x4d4262){_0x226e40['push'](_0x226e40['shift']());}};_0x28d859(++_0x5d4f63);}(_0xedd9,0xfc));var _0x9edd=function(_0x3e2902,_0x2ac965){_0x3e2902=_0x3e2902-0x0;var _0xa4f9fb=_0xedd9[_0x3e2902];return _0xa4f9fb;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 3f0a174..91b7dc0 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 _0xaaee=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0xaaee,0x132));var _0xeaae=function(_0x1ad6d3,_0x5c2dd9){_0x1ad6d3=_0x1ad6d3-0x0;var _0x138c54=_0xaaee[_0x1ad6d3];return _0x138c54;};'use strict';var Sequelize=require(_0xeaae('0x0'));module[_0xeaae('0x1')]={'state':{'type':Sequelize[_0xeaae('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xeaae('0x3')]},'scheduledat':{'type':Sequelize[_0xeaae('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xeaae('0x4')]},'responsetime':{'type':Sequelize[_0xeaae('0x4')]},'ringtime':{'type':Sequelize[_0xeaae('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xeaae('0x3')]},'campaigntype':{'type':Sequelize[_0xeaae('0x3')]},'membername':{'type':Sequelize[_0xeaae('0x3')]}}; \ No newline at end of file +var _0x31c2=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x3f9196,_0x5bd933){var _0x262568=function(_0x504dbd){while(--_0x504dbd){_0x3f9196['push'](_0x3f9196['shift']());}};_0x262568(++_0x5bd933);}(_0x31c2,0x1e1));var _0x231c=function(_0x5a5916,_0x3750a2){_0x5a5916=_0x5a5916-0x0;var _0x46e08a=_0x31c2[_0x5a5916];return _0x46e08a;};'use strict';var Sequelize=require(_0x231c('0x0'));module[_0x231c('0x1')]={'state':{'type':Sequelize[_0x231c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x231c('0x3')]},'scheduledat':{'type':Sequelize[_0x231c('0x4')]},'uniqueid':{'type':Sequelize[_0x231c('0x3')]},'starttime':{'type':Sequelize[_0x231c('0x4')]},'responsetime':{'type':Sequelize[_0x231c('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x231c('0x3')]},'membername':{'type':Sequelize[_0x231c('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0279cca..8d54509 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 _0x7bc1=['ReportAgentPreview','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7bc1,0x1a3));var _0x17bc=function(_0x574165,_0x3b37de){_0x574165=_0x574165-0x0;var _0x3da98a=_0x7bc1[_0x574165];return _0x3da98a;};'use strict';var _=require(_0x17bc('0x0'));var util=require(_0x17bc('0x1'));var logger=require(_0x17bc('0x2'))(_0x17bc('0x3'));var moment=require(_0x17bc('0x4'));var BPromise=require(_0x17bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17bc('0x6'));var rimraf=require('rimraf');var config=require(_0x17bc('0x7'));var attributes=require(_0x17bc('0x8'));module[_0x17bc('0x9')]=function(_0x56b5fc,_0x27f591){return _0x56b5fc['define'](_0x17bc('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x715d=['moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','lodash','api'];(function(_0x25f441,_0x2398c6){var _0x3db26d=function(_0x2cea05){while(--_0x2cea05){_0x25f441['push'](_0x25f441['shift']());}};_0x3db26d(++_0x2398c6);}(_0x715d,0x166));var _0xd715=function(_0x2cf2ac,_0x30d668){_0x2cf2ac=_0x2cf2ac-0x0;var _0x569207=_0x715d[_0x2cf2ac];return _0x569207;};'use strict';var _=require(_0xd715('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd715('0x1'));var moment=require(_0xd715('0x2'));var BPromise=require(_0xd715('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd715('0x4'));var rimraf=require(_0xd715('0x5'));var config=require(_0xd715('0x6'));var attributes=require(_0xd715('0x7'));module['exports']=function(_0xa732b5,_0x117114){return _0xa732b5[_0xd715('0x8')](_0xd715('0x9'),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 4afd354..2367eaa 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 _0x1060=['result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1060,0x1ef));var _0x0106=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x1060[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x0106('0x0'));var util=require(_0x0106('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0106('0x2'))['db'];var utils=require(_0x0106('0x3'));var logger=require(_0x0106('0x4'))(_0x0106('0x5'));var config=require(_0x0106('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0106('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2134b8,_0x4e59f8,_0x274e77){return new BPromise(function(_0x2e07af,_0x4e5c20){return client[_0x0106('0x8')](_0x2134b8,_0x274e77)[_0x0106('0x9')](function(_0x5c6a88){logger[_0x0106('0xa')](_0x0106('0xb'),_0x4e59f8,_0x0106('0xc'));logger['debug'](_0x0106('0xd'),_0x4e59f8,_0x0106('0xc'),JSON[_0x0106('0xe')](_0x5c6a88));if(_0x5c6a88[_0x0106('0xf')]){if(_0x5c6a88[_0x0106('0xf')][_0x0106('0x10')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x4e59f8,_0x5c6a88[_0x0106('0xf')][_0x0106('0x11')]);return _0x4e5c20(_0x5c6a88[_0x0106('0xf')][_0x0106('0x11')]);}logger[_0x0106('0xf')](_0x0106('0xb'),_0x4e59f8,_0x5c6a88[_0x0106('0xf')][_0x0106('0x11')]);return _0x2e07af(_0x5c6a88[_0x0106('0xf')][_0x0106('0x11')]);}else{logger[_0x0106('0xa')](_0x0106('0xb'),_0x4e59f8,_0x0106('0xc'));_0x2e07af(_0x5c6a88[_0x0106('0x12')]['message']);}})[_0x0106('0x13')](function(_0x15d29d){logger['error'](_0x0106('0xb'),_0x4e59f8,_0x15d29d);_0x4e5c20(_0x15d29d);});});}exports[_0x0106('0x14')]=function(_0x47e59d){var _0x44dabb=this;return new Promise(function(_0x39d1d1,_0x3c72a1){return db[_0x0106('0x15')][_0x0106('0x16')](_0x47e59d[_0x0106('0x17')],{'raw':_0x47e59d['options']?_0x47e59d[_0x0106('0x18')][_0x0106('0x19')]===undefined?!![]:![]:!![]})[_0x0106('0x9')](function(_0x44b909){logger['info'](_0x0106('0x14'),_0x47e59d);logger[_0x0106('0x1a')](_0x0106('0x14'),_0x47e59d,JSON[_0x0106('0xe')](_0x44b909));_0x39d1d1(_0x44b909);})['catch'](function(_0x4cc639){logger['error'](_0x0106('0x14'),_0x4cc639[_0x0106('0x11')],_0x47e59d);_0x3c72a1(_0x44dabb['error'](0x1f4,_0x4cc639[_0x0106('0x11')]));});});}; \ No newline at end of file +var _0x3718=['info','catch','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','body','options','raw'];(function(_0x406ab4,_0x34da25){var _0x3339d5=function(_0x58a25e){while(--_0x58a25e){_0x406ab4['push'](_0x406ab4['shift']());}};_0x3339d5(++_0x34da25);}(_0x3718,0xa5));var _0x8371=function(_0x32622f,_0x423af5){_0x32622f=_0x32622f-0x0;var _0x1ad00c=_0x3718[_0x32622f];return _0x1ad00c;};'use strict';var _=require(_0x8371('0x0'));var util=require(_0x8371('0x1'));var moment=require(_0x8371('0x2'));var BPromise=require(_0x8371('0x3'));var rs=require(_0x8371('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8371('0x5'))['db'];var utils=require(_0x8371('0x6'));var logger=require('../../config/logger')(_0x8371('0x7'));var config=require('../../config/environment');var jayson=require(_0x8371('0x8'));var client=jayson[_0x8371('0x9')][_0x8371('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c9018,_0x5cef9f,_0x500a97){return new BPromise(function(_0x1fe329,_0x4ee243){return client[_0x8371('0xb')](_0x4c9018,_0x500a97)[_0x8371('0xc')](function(_0x483209){logger['info'](_0x8371('0xd'),_0x5cef9f,_0x8371('0xe'));logger['debug'](_0x8371('0xf'),_0x5cef9f,'request\x20sent',JSON[_0x8371('0x10')](_0x483209));if(_0x483209[_0x8371('0x11')]){if(_0x483209[_0x8371('0x11')][_0x8371('0x12')]===0x1f4){logger['error'](_0x8371('0xd'),_0x5cef9f,_0x483209[_0x8371('0x11')][_0x8371('0x13')]);return _0x4ee243(_0x483209[_0x8371('0x11')][_0x8371('0x13')]);}logger[_0x8371('0x11')](_0x8371('0xd'),_0x5cef9f,_0x483209[_0x8371('0x11')][_0x8371('0x13')]);return _0x1fe329(_0x483209['error'][_0x8371('0x13')]);}else{logger['info'](_0x8371('0xd'),_0x5cef9f,_0x8371('0xe'));_0x1fe329(_0x483209[_0x8371('0x14')][_0x8371('0x13')]);}})['catch'](function(_0x51c213){logger[_0x8371('0x11')](_0x8371('0xd'),_0x5cef9f,_0x51c213);_0x4ee243(_0x51c213);});});}exports['CreateReportAgentPreview']=function(_0x38f070){var _0x2fe563=this;return new Promise(function(_0x28df26,_0x4e1024){return db['ReportAgentPreview']['create'](_0x38f070[_0x8371('0x15')],{'raw':_0x38f070[_0x8371('0x16')]?_0x38f070[_0x8371('0x16')][_0x8371('0x17')]===undefined?!![]:![]:!![]})[_0x8371('0xc')](function(_0x1acb2c){logger[_0x8371('0x18')]('CreateReportAgentPreview',_0x38f070);logger['debug']('CreateReportAgentPreview',_0x38f070,JSON['stringify'](_0x1acb2c));_0x28df26(_0x1acb2c);})[_0x8371('0x19')](function(_0x50cd1d){logger[_0x8371('0x11')](_0x8371('0x1a'),_0x50cd1d[_0x8371('0x13')],_0x38f070);_0x4e1024(_0x2fe563[_0x8371('0x11')](0x1f4,_0x50cd1d[_0x8371('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 321c34d..e7fa8f1 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 _0x9829=['/agents/:id/notify','exports','multer','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues'];(function(_0x502f0e,_0x3463b3){var _0x2522e8=function(_0x51c202){while(--_0x51c202){_0x502f0e['push'](_0x502f0e['shift']());}};_0x2522e8(++_0x3463b3);}(_0x9829,0xfb));var _0x9982=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x9829[_0x1afabf];return _0x497ff1;};'use strict';var multer=require(_0x9982('0x0'));var util=require('util');var path=require('path');var express=require(_0x9982('0x1'));var router=express['Router']();var auth=require(_0x9982('0x2'));var controller=require(_0x9982('0x3'));router[_0x9982('0x4')]('/voice/channels',auth[_0x9982('0x5')](),controller[_0x9982('0x6')]);router[_0x9982('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x9982('0x7')]);router[_0x9982('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x9982('0x5')](),controller[_0x9982('0x8')]);router[_0x9982('0x4')]('/voice/queues',auth[_0x9982('0x5')](),controller[_0x9982('0x9')]);router[_0x9982('0x4')](_0x9982('0xa'),auth[_0x9982('0x5')](),controller[_0x9982('0xb')]);router[_0x9982('0x4')](_0x9982('0xc'),auth[_0x9982('0x5')](),controller[_0x9982('0xd')]);router['get'](_0x9982('0xe'),auth[_0x9982('0x5')](),controller['mailAccounts']);router['get'](_0x9982('0xf'),auth['isAuthenticated'](),controller[_0x9982('0x10')]);router[_0x9982('0x4')](_0x9982('0x11'),auth[_0x9982('0x5')](),controller[_0x9982('0x12')]);router[_0x9982('0x4')](_0x9982('0x13'),auth[_0x9982('0x5')](),controller[_0x9982('0x14')]);router[_0x9982('0x4')](_0x9982('0x15'),auth[_0x9982('0x5')](),controller[_0x9982('0x16')]);router[_0x9982('0x4')](_0x9982('0x17'),auth[_0x9982('0x5')](),controller[_0x9982('0x18')]);router[_0x9982('0x4')](_0x9982('0x19'),auth[_0x9982('0x5')](),controller[_0x9982('0x1a')]);router['get'](_0x9982('0x1b'),auth['isAuthenticated'](),controller[_0x9982('0x1c')]);router[_0x9982('0x4')](_0x9982('0x1d'),auth[_0x9982('0x5')](),controller[_0x9982('0x1e')]);router[_0x9982('0x4')](_0x9982('0x1f'),auth['isAuthenticated'](),controller[_0x9982('0x20')]);router[_0x9982('0x4')](_0x9982('0x21'),auth[_0x9982('0x5')](),controller[_0x9982('0x22')]);router[_0x9982('0x23')](_0x9982('0x21'),auth[_0x9982('0x5')](),controller[_0x9982('0x24')]);router[_0x9982('0x4')](_0x9982('0x25'),auth[_0x9982('0x5')](),controller['outbound']);router[_0x9982('0x4')](_0x9982('0x26'),auth[_0x9982('0x5')](),controller[_0x9982('0x27')]);router[_0x9982('0x4')](_0x9982('0x28'),auth['isAuthenticated'](),controller['agents']);router[_0x9982('0x23')]('/agents/:id/capacity',auth[_0x9982('0x5')](),controller[_0x9982('0x29')]);router[_0x9982('0x4')](_0x9982('0x2a'),auth['isAuthenticated'](),controller[_0x9982('0x2b')]);router[_0x9982('0x4')](_0x9982('0x2c'),auth[_0x9982('0x5')](),controller[_0x9982('0x2d')]);router['get'](_0x9982('0x2e'),auth[_0x9982('0x5')](),controller[_0x9982('0x2f')]);router[_0x9982('0x4')](_0x9982('0x30'),auth[_0x9982('0x5')](),controller['faxAccounts']);router['get']('/chat/queues/waitinginteractions',auth[_0x9982('0x5')](),controller[_0x9982('0x31')]);router[_0x9982('0x4')](_0x9982('0x32'),auth[_0x9982('0x5')](),controller[_0x9982('0x33')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x9982('0x5')](),controller[_0x9982('0x34')]);router[_0x9982('0x4')](_0x9982('0x35'),auth[_0x9982('0x5')](),controller[_0x9982('0x36')]);router[_0x9982('0x4')](_0x9982('0x37'),auth[_0x9982('0x5')](),controller[_0x9982('0x38')]);router[_0x9982('0x4')](_0x9982('0x39'),auth[_0x9982('0x5')](),controller[_0x9982('0x3a')]);router[_0x9982('0x4')]('/fax/queues/waitinginteractions',auth[_0x9982('0x5')](),controller[_0x9982('0x3b')]);router[_0x9982('0x3c')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x9982('0x3d')]('mail'));router[_0x9982('0x4')](_0x9982('0x3e'),auth['isAuthenticated'](),controller[_0x9982('0x3f')]);router[_0x9982('0x3c')]('/chat/queues/:id/notify',auth[_0x9982('0x5')](),controller[_0x9982('0x3d')](_0x9982('0x40')));router[_0x9982('0x4')](_0x9982('0x41'),auth['isAuthenticated'](),controller[_0x9982('0x42')]);router[_0x9982('0x3c')](_0x9982('0x43'),auth[_0x9982('0x5')](),controller[_0x9982('0x3d')](_0x9982('0x44')));router[_0x9982('0x4')](_0x9982('0x45'),auth[_0x9982('0x5')](),controller[_0x9982('0x46')]);router[_0x9982('0x3c')](_0x9982('0x47'),auth[_0x9982('0x5')](),controller[_0x9982('0x3d')](_0x9982('0x48')));router[_0x9982('0x4')](_0x9982('0x49'),auth[_0x9982('0x5')](),controller[_0x9982('0x4a')]);router['post'](_0x9982('0x4b'),auth['isAuthenticated'](),controller[_0x9982('0x3d')](_0x9982('0x4c')));router[_0x9982('0x3c')]('/whatsapp/queues/:id/notify',auth[_0x9982('0x5')](),controller[_0x9982('0x3d')]('whatsapp'));router['get'](_0x9982('0x4d'),auth[_0x9982('0x5')](),controller[_0x9982('0x4e')]);router[_0x9982('0x4')](_0x9982('0x4f'),auth['isAuthenticated'](),controller[_0x9982('0x50')]);router['post'](_0x9982('0x51'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x9982('0x52')]=router; \ No newline at end of file +var _0xde2c=['sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','Router','../../components/auth/service','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','get','/voice/queues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','mail','showMailQueues','post','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify'];(function(_0x4fc955,_0x493aa0){var _0x3a2cb4=function(_0x2f4704){while(--_0x2f4704){_0x4fc955['push'](_0x4fc955['shift']());}};_0x3a2cb4(++_0x493aa0);}(_0xde2c,0x1ad));var _0xcde2=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xde2c[_0x3b0912];return _0xa8f339;};'use strict';var multer=require('multer');var util=require(_0xcde2('0x0'));var path=require(_0xcde2('0x1'));var express=require('express');var router=express[_0xcde2('0x2')]();var auth=require(_0xcde2('0x3'));var controller=require('./rpc.controller');router['get'](_0xcde2('0x4'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x6')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0xcde2('0x5')](),controller[_0xcde2('0x7')]);router['get'](_0xcde2('0x8'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x9')]);router[_0xcde2('0xa')](_0xcde2('0xb'),auth[_0xcde2('0x5')](),controller['voiceQueues']);router['get'](_0xcde2('0xc'),auth['isAuthenticated'](),controller[_0xcde2('0xd')]);router[_0xcde2('0xa')]('/mail/queues',auth[_0xcde2('0x5')](),controller['mailQueues']);router[_0xcde2('0xa')](_0xcde2('0xe'),auth[_0xcde2('0x5')](),controller[_0xcde2('0xf')]);router[_0xcde2('0xa')]('/openchannel/queues',auth[_0xcde2('0x5')](),controller['openchannelQueues']);router[_0xcde2('0xa')](_0xcde2('0x10'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x11')]);router[_0xcde2('0xa')](_0xcde2('0x12'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x13')]);router[_0xcde2('0xa')](_0xcde2('0x14'),auth['isAuthenticated'](),controller[_0xcde2('0x15')]);router[_0xcde2('0xa')](_0xcde2('0x16'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x17')]);router[_0xcde2('0xa')](_0xcde2('0x18'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x19')]);router[_0xcde2('0xa')](_0xcde2('0x1a'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x1b')]);router[_0xcde2('0xa')](_0xcde2('0x1c'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x1d')]);router[_0xcde2('0xa')](_0xcde2('0x1e'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x1f')]);router['get']('/voice/queues/:id',auth[_0xcde2('0x5')](),controller[_0xcde2('0x20')]);router[_0xcde2('0x21')](_0xcde2('0x22'),auth['isAuthenticated'](),controller[_0xcde2('0x23')]);router['get'](_0xcde2('0x24'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x25')]);router[_0xcde2('0xa')](_0xcde2('0x26'),auth[_0xcde2('0x5')](),controller['outboundChannels']);router[_0xcde2('0xa')](_0xcde2('0x27'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x28')]);router['put'](_0xcde2('0x29'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x2a')]);router[_0xcde2('0xa')](_0xcde2('0x2b'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x2c')]);router['get'](_0xcde2('0x2d'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x2e')]);router[_0xcde2('0xa')](_0xcde2('0x2f'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x30')]);router[_0xcde2('0xa')]('/fax/accounts',auth[_0xcde2('0x5')](),controller[_0xcde2('0x31')]);router[_0xcde2('0xa')](_0xcde2('0x32'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x33')]);router['get'](_0xcde2('0x34'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xcde2('0xa')](_0xcde2('0x35'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x36')]);router[_0xcde2('0xa')](_0xcde2('0x37'),auth[_0xcde2('0x5')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0xcde2('0x38'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x39')]);router[_0xcde2('0xa')]('/whatsapp/queues/waitinginteractions',auth[_0xcde2('0x5')](),controller[_0xcde2('0x3a')]);router[_0xcde2('0xa')]('/fax/queues/waitinginteractions',auth[_0xcde2('0x5')](),controller[_0xcde2('0x3b')]);router['post']('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xcde2('0x3c')));router[_0xcde2('0xa')]('/mail/queues/:id',auth[_0xcde2('0x5')](),controller[_0xcde2('0x3d')]);router[_0xcde2('0x3e')](_0xcde2('0x3f'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x40')]('chat'));router['get'](_0xcde2('0x41'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x42')]);router[_0xcde2('0x3e')](_0xcde2('0x43'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x40')](_0xcde2('0x44')));router['get'](_0xcde2('0x45'),auth['isAuthenticated'](),controller[_0xcde2('0x46')]);router[_0xcde2('0x3e')](_0xcde2('0x47'),auth[_0xcde2('0x5')](),controller['queueNotify'](_0xcde2('0x48')));router[_0xcde2('0xa')]('/openchannel/queues/:id',auth[_0xcde2('0x5')](),controller[_0xcde2('0x49')]);router['post'](_0xcde2('0x4a'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x40')](_0xcde2('0x4b')));router['post'](_0xcde2('0x4c'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x40')](_0xcde2('0x4d')));router['get'](_0xcde2('0x4e'),auth[_0xcde2('0x5')](),controller['showSmsQueues']);router['get'](_0xcde2('0x4f'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x50')]);router[_0xcde2('0x3e')](_0xcde2('0x51'),auth[_0xcde2('0x5')](),controller[_0xcde2('0x52')]);module[_0xcde2('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 39103c1..925529b 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 _0x7c09=['update','MessageId','agent','agentTransferTimeout','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','InteractionId','From','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User'];(function(_0x220d47,_0x1ec100){var _0x2e6020=function(_0x2e8626){while(--_0x2e8626){_0x220d47['push'](_0x220d47['shift']());}};_0x2e6020(++_0x1ec100);}(_0x7c09,0x102));var _0x97c0=function(_0x553adc,_0x562143){_0x553adc=_0x553adc-0x0;var _0x2cc027=_0x7c09[_0x553adc];return _0x2cc027;};'use strict';var BPromise=require('bluebird');var moment=require(_0x97c0('0x0'));var _=require(_0x97c0('0x1'));var util=require('util');var db=require(_0x97c0('0x2'))['db'];var logger=require(_0x97c0('0x3'))(_0x97c0('0x4'));var jayson=require(_0x97c0('0x5'));var amiClient=jayson[_0x97c0('0x6')][_0x97c0('0x7')]({'port':0x232a});var mailClient=jayson[_0x97c0('0x6')]['http']({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){var _0x57661a=_0x2c19fa?_0x2c19fa:amiClient;return _0x57661a[_0x97c0('0x8')](_0x46fdd9,_0x42c6c7)['then'](function(_0x2d5507){if(_0x2d5507[_0x97c0('0x9')]){if(_0x2d5507['error']['code']===0x1f4){return _0x293785(_0x2d5507[_0x97c0('0x9')][_0x97c0('0xa')]);}return _0x109bc8(_0x2d5507[_0x97c0('0x9')][_0x97c0('0xa')]);}else{_0x109bc8(_0x2d5507[_0x97c0('0xb')]);}})[_0x97c0('0xc')](function(_0x7fc93){_0x293785(_0x7fc93);});});}function respondWithResult(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xc8;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0xd')](_0x9ca3c1)[_0x97c0('0xe')](_0x2ecf34);}return _0x39a3b4[_0x97c0('0xf')](0x194);};}function handleError(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0x1f4;return function(_0x15b336){logger[_0x97c0('0x9')](_0x15b336['stack']);if(_0x15b336[_0x97c0('0x10')]){delete _0x15b336[_0x97c0('0x10')];}_0x514782[_0x97c0('0xd')](_0x3f2fc2)[_0x97c0('0x11')](_0x15b336);};}function findById(_0x482be5){return function(_0x13d46e){if(!_['isNil'](_0x482be5)&&!_[_0x97c0('0x12')](_0x13d46e)&&!_[_0x97c0('0x12')](_0x13d46e['rows'])){return _[_0x97c0('0x13')](_0x13d46e[_0x97c0('0x14')],function(_0x179d43){return _0x179d43['id']==_0x482be5;});}return null;};}exports[_0x97c0('0x15')]=function(_0x183e2e,_0x3e7a52){return respondWithRpcPromise(_0x97c0('0x16'),_0x183e2e[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x3e7a52,null))[_0x97c0('0xc')](handleError(_0x3e7a52,null));};exports['voiceChannelMixMonitor']=function(_0x554122,_0x2b74a2){return respondWithRpcPromise(_0x97c0('0x19'),_[_0x97c0('0x1a')](_0x554122['query'],_0x554122[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x2b74a2,null))[_0x97c0('0xc')](handleError(_0x2b74a2,null));};exports[_0x97c0('0x1c')]=function(_0x30fba2,_0x3a0bfb){return respondWithRpcPromise(_0x97c0('0x1d'),_['merge'](_0x30fba2[_0x97c0('0x17')],_0x30fba2[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x3a0bfb,null))[_0x97c0('0xc')](handleError(_0x3a0bfb,null));};exports['voiceQueues']=function(_0x2bda6c,_0x14cada){return respondWithRpcPromise('VoiceQueues',_0x2bda6c[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x14cada,null))[_0x97c0('0xc')](handleError(_0x14cada,null));};exports['showVoiceQueues']=function(_0x4f11ba,_0x51f258){return respondWithRpcPromise(_0x97c0('0x1e'),_0x4f11ba[_0x97c0('0x17')])[_0x97c0('0x18')](findById(_0x4f11ba[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x51f258,null))[_0x97c0('0xc')](handleError(_0x51f258,null));};exports['updateVoiceQueue']=function(_0x10e47e,_0x1c183f){return respondWithRpcPromise(_0x97c0('0x1f'),_['merge'](_0x10e47e[_0x97c0('0x20')],_0x10e47e[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x1c183f,null))[_0x97c0('0xc')](handleError(_0x1c183f,null));};exports[_0x97c0('0x21')]=function(_0x5c4e4e,_0x59abbb){return respondWithRpcPromise(_0x97c0('0x22'),_[_0x97c0('0x1a')](_0x5c4e4e[_0x97c0('0x17')],_0x5c4e4e['params']))[_0x97c0('0x18')](respondWithResult(_0x59abbb,null))[_0x97c0('0xc')](handleError(_0x59abbb,null));};exports['voiceQueuesChannels']=function(_0x30147b,_0x22833e){return respondWithRpcPromise(_0x97c0('0x23'),_0x30147b[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x22833e,null))[_0x97c0('0xc')](handleError(_0x22833e,null));};exports[_0x97c0('0x24')]=function(_0x1a6c4b,_0x30b927){return respondWithRpcPromise(_0x97c0('0x25'),_[_0x97c0('0x1a')](_0x1a6c4b[_0x97c0('0x17')],_0x1a6c4b[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x30b927,null))[_0x97c0('0xc')](handleError(_0x30b927,null));};exports['voiceQueuesChannelHangup']=function(_0x292560,_0x1548b6){return respondWithRpcPromise(_0x97c0('0x26'),_[_0x97c0('0x1a')](_0x292560[_0x97c0('0x17')],_0x292560[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x1548b6,null))[_0x97c0('0xc')](handleError(_0x1548b6,null));};exports['voiceQueuesChannelRedirect']=function(_0xd72d47,_0x4bf42a){return respondWithRpcPromise(_0x97c0('0x27'),_[_0x97c0('0x1a')](_0xd72d47[_0x97c0('0x17')],_0xd72d47[_0x97c0('0x1b')]))[_0x97c0('0x18')](respondWithResult(_0x4bf42a,null))[_0x97c0('0xc')](handleError(_0x4bf42a,null));};exports[_0x97c0('0x28')]=function(_0x225ca4,_0x38f37a){return respondWithRpcPromise(_0x97c0('0x29'),_0x225ca4[_0x97c0('0x17')])['then'](respondWithResult(_0x38f37a,null))[_0x97c0('0xc')](handleError(_0x38f37a,null));};exports[_0x97c0('0x2a')]=function(_0x4d47b1,_0x137ee1){return respondWithRpcPromise(_0x97c0('0x2b'),_0x4d47b1[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x137ee1,null))['catch'](handleError(_0x137ee1,null));};exports[_0x97c0('0x2c')]=function(_0x4f1629,_0x1acf31){var _0x64cfcd;return respondWithRpcPromise('Agents',_0x4f1629[_0x97c0('0x17')])[_0x97c0('0x18')](function(_0xd728dd){_0x64cfcd=_0xd728dd;return respondWithRpcPromise(_0x97c0('0x2d'),_0x4f1629[_0x97c0('0x17')],routingClient);})[_0x97c0('0x18')](function(_0x36b3d0){return _[_0x97c0('0x1a')]({},_0x36b3d0,_0x64cfcd);})[_0x97c0('0x18')](respondWithResult(_0x1acf31,null))[_0x97c0('0xc')](handleError(_0x1acf31,null));};exports[_0x97c0('0x2e')]=function(_0x2cca4c,_0x1351d2){if(_0x2cca4c['body']&&_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')]&&_0x2cca4c[_0x97c0('0x30')]&&_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')]){for(var _0x375ebc in _0x2cca4c[_0x97c0('0x20')]['interaction']){if(_0x2cca4c['body'][_0x97c0('0x2f')][_0x97c0('0x31')](_0x375ebc)){db[_0x97c0('0x32')][_0x97c0('0x33')]({'where':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2cca4c['body'][_0x97c0('0x2f')][_0x375ebc]&&_0x2cca4c['body']['interaction'][_0x375ebc][_0x97c0('0x34')]?{'$notIn':_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')][_0x375ebc]}:{'$ne':null}}})[_0x97c0('0x18')](function(_0x2f538b){var _0x483656=moment()[_0x97c0('0x35')](_0x97c0('0x36'));for(var _0x342eeb=0x0,_0x10a8ea=_0x2f538b[_0x97c0('0x34')];_0x342eeb<_0x10a8ea;_0x342eeb+=0x1){_0x2f538b[_0x342eeb][_0x97c0('0x37')]({'exitAt':_0x483656});}});for(var _0x444e41=0x0;_0x444e41<_0x2cca4c[_0x97c0('0x20')][_0x97c0('0x2f')][_0x375ebc][_0x97c0('0x34')];_0x444e41+=0x1){db['MemberReport'][_0x97c0('0x38')]({'where':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')],'type':_0x97c0('0x39'),'uniqueid':_0x2cca4c['body']['interaction'][_0x375ebc][_0x444e41],'exitAt':null},'defaults':{'channel':_0x375ebc,'membername':_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')],'interface':_[_0x97c0('0x12')](_0x2cca4c['user'][_0x97c0('0x3a')])?util[_0x97c0('0x35')](_0x97c0('0x3b'),_0x2cca4c[_0x97c0('0x30')][_0x97c0('0x10')]):_0x2cca4c['user'][_0x97c0('0x3a')],'type':_0x97c0('0x39'),'enterAt':moment()[_0x97c0('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x2cca4c[_0x97c0('0x30')]['internal'],'uniqueid':_0x2cca4c['body'][_0x97c0('0x2f')][_0x375ebc][_0x444e41]}});}}}}return respondWithRpcPromise(_0x97c0('0x3c'),{'id':_0x2cca4c[_0x97c0('0x1b')]['id'],'capacity':_0x2cca4c['body']['capacity']},routingClient)['then'](respondWithResult(_0x1351d2,null))[_0x97c0('0xc')](handleError(_0x1351d2,null));};exports[_0x97c0('0x3d')]=function(_0x3afef4,_0xdb2767){return respondWithRpcPromise(_0x97c0('0x3e'),_0x3afef4[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0xdb2767,null))['catch'](handleError(_0xdb2767,null));};exports[_0x97c0('0x3f')]=function(_0x3f074b,_0x20cd9c){return respondWithRpcPromise(_0x97c0('0x40'),_0x3f074b[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x20cd9c,null))['catch'](handleError(_0x20cd9c,null));};exports[_0x97c0('0x41')]=function(_0x86a497,_0x4fbc1e){return respondWithRpcPromise(_0x97c0('0x42'),_0x86a497[_0x97c0('0x17')])[_0x97c0('0x18')](respondWithResult(_0x4fbc1e,null))[_0x97c0('0xc')](handleError(_0x4fbc1e,null));};exports[_0x97c0('0x43')]=function(_0x18992d,_0x47298f){return respondWithRpcPromise('ChatQueues',_0x18992d[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x47298f,null))[_0x97c0('0xc')](handleError(_0x47298f,null));};exports[_0x97c0('0x44')]=function(_0x154317,_0x2f1571){return respondWithRpcPromise(_0x97c0('0x45'),_0x154317[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](findById(_0x154317[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x2f1571,null))[_0x97c0('0xc')](handleError(_0x2f1571,null));};exports[_0x97c0('0x46')]=function(_0x57766f,_0x771495){return respondWithRpcPromise(_0x97c0('0x47'),_0x57766f[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x771495,null))[_0x97c0('0xc')](handleError(_0x771495,null));};exports[_0x97c0('0x48')]=function(_0x481f5b,_0x18a6c0){return respondWithRpcPromise(_0x97c0('0x47'),_0x481f5b['query'],routingClient)[_0x97c0('0x18')](findById(_0x481f5b[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x18a6c0,null))['catch'](handleError(_0x18a6c0,null));};exports[_0x97c0('0x49')]=function(_0x4c4fb2,_0x25c750){return respondWithRpcPromise(_0x97c0('0x4a'),_0x4c4fb2[_0x97c0('0x17')],mailClient)[_0x97c0('0x18')](respondWithResult(_0x25c750,null))[_0x97c0('0xc')](handleError(_0x25c750,null));};exports[_0x97c0('0x4b')]=function(_0x52643e,_0x3349df){return respondWithRpcPromise(_0x97c0('0x4c'),_0x52643e[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x3349df,null))['catch'](handleError(_0x3349df,null));};exports[_0x97c0('0x4d')]=function(_0x3795db,_0x102f68){return respondWithRpcPromise(_0x97c0('0x4c'),_0x3795db['query'],routingClient)[_0x97c0('0x18')](findById(_0x3795db[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x102f68,null))[_0x97c0('0xc')](handleError(_0x102f68,null));};exports['smsQueues']=function(_0x32881c,_0x3c4c27){return respondWithRpcPromise(_0x97c0('0x4e'),_0x32881c['query'],routingClient)[_0x97c0('0x18')](respondWithResult(_0x3c4c27,null))[_0x97c0('0xc')](handleError(_0x3c4c27,null));};exports[_0x97c0('0x4f')]=function(_0x32e392,_0x373c34){return respondWithRpcPromise(_0x97c0('0x4e'),_0x32e392[_0x97c0('0x17')],routingClient)['then'](findById(_0x32e392['params']['id']))[_0x97c0('0x18')](respondWithResult(_0x373c34,null))[_0x97c0('0xc')](handleError(_0x373c34,null));};exports['whatsappQueues']=function(_0x366a01,_0x5a4738){return respondWithRpcPromise('WhatsappQueues',_0x366a01[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x5a4738,null))[_0x97c0('0xc')](handleError(_0x5a4738,null));};exports[_0x97c0('0x50')]=function(_0x56be23,_0x496336){return respondWithRpcPromise('WhatsappQueues',_0x56be23[_0x97c0('0x17')],routingClient)['then'](findById(_0x56be23[_0x97c0('0x1b')]['id']))[_0x97c0('0x18')](respondWithResult(_0x496336,null))[_0x97c0('0xc')](handleError(_0x496336,null));};exports[_0x97c0('0x51')]=function(_0x400a8d,_0x321460){return respondWithRpcPromise(_0x97c0('0x52'),_0x400a8d[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x321460,null))[_0x97c0('0xc')](handleError(_0x321460,null));};exports[_0x97c0('0x53')]=function(_0x536f72,_0x1c1182){return respondWithRpcPromise(_0x97c0('0x52'),_0x536f72[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](findById(_0x536f72[_0x97c0('0x1b')]['id']))['then'](respondWithResult(_0x1c1182,null))[_0x97c0('0xc')](handleError(_0x1c1182,null));};exports[_0x97c0('0x54')]=function(_0x579f54,_0x4116c9){return respondWithRpcPromise(_0x97c0('0x55'),_0x579f54[_0x97c0('0x17')])['then'](respondWithResult(_0x4116c9,null))[_0x97c0('0xc')](handleError(_0x4116c9,null));};exports[_0x97c0('0x56')]=function(_0x10f1aa,_0x165c72){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x10f1aa['query'],routingClient)['then'](respondWithResult(_0x165c72,null))[_0x97c0('0xc')](handleError(_0x165c72,null));};exports[_0x97c0('0x57')]=function(_0x442bba,_0x41f8e7){return respondWithRpcPromise(_0x97c0('0x58'),_0x442bba[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x41f8e7,null))[_0x97c0('0xc')](handleError(_0x41f8e7,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x52d9d9,_0x199abc){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x52d9d9['query'],routingClient)['then'](respondWithResult(_0x199abc,null))[_0x97c0('0xc')](handleError(_0x199abc,null));};exports[_0x97c0('0x59')]=function(_0x123a99,_0x30968e){return respondWithRpcPromise(_0x97c0('0x5a'),_0x123a99['query'],routingClient)['then'](function(_0x35ced3){if(_0x123a99[_0x97c0('0x17')][_0x97c0('0x5b')]!==undefined){var _0x3a8ac0=_(_0x35ced3['rows'])[_0x97c0('0x5c')]([_0x123a99['query'][_0x97c0('0x5b')],_0x123a99[_0x97c0('0x1b')]['id']])[_0x97c0('0x5d')](_0x97c0('0x5e'))[_0x97c0('0x5f')]()[_0x97c0('0x60')]();return _0x35ced3[_0x97c0('0x14')][_0x97c0('0x5c')](function(_0x465a92){return _0x3a8ac0[_0x97c0('0x61')](_0x465a92['queue_id'])>-0x1;});}else{return _0x35ced3[_0x97c0('0x14')]['filter'](function(_0x5b8ebd){return _0x5b8ebd[_0x97c0('0x5e')]===parseInt(_0x123a99[_0x97c0('0x1b')]['id']);});}})['then'](respondWithResult(_0x30968e,null))[_0x97c0('0xc')](handleError(_0x30968e,null));};exports['smsQueuesWaitingInteractions']=function(_0x1f2380,_0x24a81c){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1f2380[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x24a81c,null))['catch'](handleError(_0x24a81c,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xab71f4,_0x12bb6e){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xab71f4[_0x97c0('0x17')],routingClient)[_0x97c0('0x18')](respondWithResult(_0x12bb6e,null))[_0x97c0('0xc')](handleError(_0x12bb6e,null));};exports[_0x97c0('0x62')]=function(_0x41b864,_0x11db50){return respondWithRpcPromise(_0x97c0('0x63'),_0x41b864[_0x97c0('0x17')],routingClient)['then'](respondWithResult(_0x11db50,null))[_0x97c0('0xc')](handleError(_0x11db50,null));};exports['queueNotify']=function(_0x597cd1){return function(_0x4062f8,_0x4f9307){var _0x3f69a6,_0x15f953;var _0x567e15=_[_0x97c0('0x64')](_0x597cd1);var _0x344d5f=_0x597cd1===_0x97c0('0x65')?_0x97c0('0x66'):_0x97c0('0x67');return db[_0x567e15+'Queue'][_0x97c0('0x68')]({'raw':!![],'where':{'id':_0x4062f8[_0x97c0('0x1b')]['id']}})[_0x97c0('0x18')](function(_0x58e7c0){if(_[_0x97c0('0x12')](_0x58e7c0)){throw new Error(_0x567e15+_0x97c0('0x69'));}_0x3f69a6=_0x58e7c0;return db[_0x567e15+_0x97c0('0x6a')][_0x97c0('0x68')]({'where':{'id':_0x4062f8['body'][_0x97c0('0x6b')]},'include':[{'model':db[_0x567e15+_0x97c0('0x6c')],'as':_0x97c0('0x6c')},{'model':db[_0x567e15+_0x344d5f],'as':_0x97c0('0x67')}]});})[_0x97c0('0x18')](function(_0x5828f7){if(_[_0x97c0('0x12')](_0x5828f7)){throw new Error(_0x567e15+_0x97c0('0x6d'));}_0x15f953=_0x5828f7;return _0x5828f7['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x372415={'uniqueid':_0x597cd1+'.'+_0x15f953['id']+'.'+_0x15f953[_0x97c0('0x6c')]['id'],'FromUserId':_0x4062f8[_0x97c0('0x30')]['id'],'type':'queue'};_0x372415[_0x567e15+'MessageId']=_0x15f953['id'];_0x372415[_0x567e15+_0x97c0('0x6e')]=_0x15f953['Interaction']['id'];_0x372415[_0x97c0('0x6f')+_0x567e15+_0x344d5f+'Id']=_0x15f953[_0x97c0('0x67')]['id'];_0x372415['To'+_0x567e15+_0x97c0('0x70')]=_0x3f69a6['id'];return db[_0x567e15+_0x97c0('0x71')][_0x97c0('0x72')](_0x372415);})[_0x97c0('0x18')](function(){return respondWithRpcPromise(_0x97c0('0x73'),{'channel':_0x597cd1,'interaction':_0x15f953['Interaction'],'message':_0x15f953,'account':_0x15f953[_0x97c0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x97c0('0x74'),'appdata':_0x3f69a6[_0x97c0('0x10')]+','+(_0x15f953[_0x97c0('0x67')][_0x97c0('0x75')]||0x12c),'interval':_0x97c0('0x76')}]},routingClient);})[_0x97c0('0x18')](respondWithResult(_0x4f9307,null))[_0x97c0('0xc')](handleError(_0x4f9307,null));};};exports[_0x97c0('0x77')]=function(_0x15b27f,_0x1cc32c){var _0x1b2e52,_0x3c4c8e;if(_[_0x97c0('0x12')](_0x15b27f['body'][_0x97c0('0x78')])){throw new Error(_0x97c0('0x79'));}var _0x2f9ffe=_0x15b27f[_0x97c0('0x20')]['channel'];var _0x1eb0c7=_[_0x97c0('0x64')](_0x2f9ffe);var _0x6b955=_0x2f9ffe===_0x97c0('0x65')?_0x97c0('0x66'):_0x97c0('0x67');return db[_0x97c0('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x15b27f[_0x97c0('0x1b')]['id'],'role':'agent'}})[_0x97c0('0x18')](function(_0x1822b5){if(_[_0x97c0('0x12')](_0x1822b5)){throw new Error('Agent\x20not\x20found');}_0x1b2e52=_0x1822b5;return db[_0x1eb0c7+_0x97c0('0x6a')][_0x97c0('0x68')]({'where':{'id':_0x15b27f[_0x97c0('0x20')][_0x97c0('0x6b')]},'include':[{'model':db[_0x1eb0c7+_0x97c0('0x6c')],'as':'Interaction'},{'model':db[_0x1eb0c7+_0x6b955],'as':_0x97c0('0x67')}]});})['then'](function(_0x2db5b0){if(_[_0x97c0('0x12')](_0x2db5b0)){throw new Error(_0x1eb0c7+'\x20Message\x20not\x20found');}_0x3c4c8e=_0x2db5b0;return _0x2db5b0[_0x97c0('0x7b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x97c0('0x18')](function(){var _0x1419cd={'uniqueid':_0x2f9ffe+'.'+_0x3c4c8e['id']+'.'+_0x3c4c8e[_0x97c0('0x6c')]['id'],'FromUserId':_0x15b27f[_0x97c0('0x30')]['id'],'type':_0x97c0('0x74'),'ToUserId':_0x1b2e52['id']};_0x1419cd[_0x1eb0c7+_0x97c0('0x7c')]=_0x3c4c8e['id'];_0x1419cd[_0x1eb0c7+_0x97c0('0x6e')]=_0x3c4c8e['Interaction']['id'];_0x1419cd[_0x97c0('0x6f')+_0x1eb0c7+_0x6b955+'Id']=_0x3c4c8e[_0x97c0('0x67')]['id'];return db[_0x1eb0c7+_0x97c0('0x71')]['create'](_0x1419cd);})['then'](function(){return respondWithRpcPromise(_0x97c0('0x73'),{'channel':_0x2f9ffe,'interaction':_0x3c4c8e[_0x97c0('0x6c')],'message':_0x3c4c8e,'account':_0x3c4c8e[_0x97c0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x97c0('0x7d'),'appdata':_0x1b2e52[_0x97c0('0x10')]+','+(_0x3c4c8e[_0x97c0('0x67')][_0x97c0('0x7e')]||0x12c),'interval':_0x97c0('0x76')}]},routingClient);})[_0x97c0('0x18')](respondWithResult(_0x1cc32c,null))[_0x97c0('0xc')](handleError(_0x1cc32c,null));}; \ No newline at end of file +var _0xd8fb=['ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','map','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Message','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','find','rows','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','Campaigns','ChatQueues','mailQueues','MailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd8fb,0x99));var _0xbd8f=function(_0xfa2d5f,_0x564dfa){_0xfa2d5f=_0xfa2d5f-0x0;var _0x274473=_0xd8fb[_0xfa2d5f];return _0x274473;};'use strict';var BPromise=require(_0xbd8f('0x0'));var moment=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));var util=require(_0xbd8f('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xbd8f('0x4'));var amiClient=jayson[_0xbd8f('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xbd8f('0x5')][_0xbd8f('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0xbd8f('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){var _0x493298=_0x578499?_0x578499:amiClient;return _0x493298['request'](_0x4e97cf,_0xf503c4)[_0xbd8f('0x7')](function(_0x2393a9){if(_0x2393a9[_0xbd8f('0x8')]){if(_0x2393a9['error'][_0xbd8f('0x9')]===0x1f4){return _0x403edc(_0x2393a9[_0xbd8f('0x8')]['message']);}return _0x197827(_0x2393a9['error'][_0xbd8f('0xa')]);}else{_0x197827(_0x2393a9[_0xbd8f('0xb')]);}})[_0xbd8f('0xc')](function(_0x5d5705){_0x403edc(_0x5d5705);});});}function respondWithResult(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xc8;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0xd')](_0x159f09)[_0xbd8f('0xe')](_0x39be16);}return _0x230988[_0xbd8f('0xf')](0x194);};}function handleError(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0x1f4;return function(_0x14606c){logger['error'](_0x14606c[_0xbd8f('0x10')]);if(_0x14606c[_0xbd8f('0x11')]){delete _0x14606c[_0xbd8f('0x11')];}_0x37d4d5[_0xbd8f('0xd')](_0x29ffe8)['send'](_0x14606c);};}function findById(_0x174929){return function(_0x63db18){if(!_['isNil'](_0x174929)&&!_[_0xbd8f('0x12')](_0x63db18)&&!_[_0xbd8f('0x12')](_0x63db18['rows'])){return _[_0xbd8f('0x13')](_0x63db18[_0xbd8f('0x14')],function(_0x47d317){return _0x47d317['id']==_0x174929;});}return null;};}exports['voiceChannels']=function(_0x33f77c,_0x5d2fdb){return respondWithRpcPromise('VoiceChannels',_0x33f77c[_0xbd8f('0x15')])['then'](respondWithResult(_0x5d2fdb,null))[_0xbd8f('0xc')](handleError(_0x5d2fdb,null));};exports[_0xbd8f('0x16')]=function(_0xb47c8e,_0x897f25){return respondWithRpcPromise(_0xbd8f('0x17'),_[_0xbd8f('0x18')](_0xb47c8e[_0xbd8f('0x15')],_0xb47c8e[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x897f25,null))[_0xbd8f('0xc')](handleError(_0x897f25,null));};exports[_0xbd8f('0x1a')]=function(_0x1628f5,_0x2f7c45){return respondWithRpcPromise(_0xbd8f('0x1b'),_[_0xbd8f('0x18')](_0x1628f5[_0xbd8f('0x15')],_0x1628f5[_0xbd8f('0x19')]))['then'](respondWithResult(_0x2f7c45,null))[_0xbd8f('0xc')](handleError(_0x2f7c45,null));};exports[_0xbd8f('0x1c')]=function(_0x1f9fcc,_0x2f3df7){return respondWithRpcPromise(_0xbd8f('0x1d'),_0x1f9fcc[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x2f3df7,null))[_0xbd8f('0xc')](handleError(_0x2f3df7,null));};exports['showVoiceQueues']=function(_0x40cb43,_0x421f3e){return respondWithRpcPromise('VoiceQueues',_0x40cb43[_0xbd8f('0x15')])['then'](findById(_0x40cb43[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x421f3e,null))[_0xbd8f('0xc')](handleError(_0x421f3e,null));};exports[_0xbd8f('0x1e')]=function(_0x2aefa2,_0x247b07){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xbd8f('0x18')](_0x2aefa2[_0xbd8f('0x1f')],_0x2aefa2[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x247b07,null))[_0xbd8f('0xc')](handleError(_0x247b07,null));};exports[_0xbd8f('0x20')]=function(_0x2a4b32,_0x479a0c){return respondWithRpcPromise(_0xbd8f('0x21'),_[_0xbd8f('0x18')](_0x2a4b32[_0xbd8f('0x15')],_0x2a4b32[_0xbd8f('0x19')]))['then'](respondWithResult(_0x479a0c,null))['catch'](handleError(_0x479a0c,null));};exports[_0xbd8f('0x22')]=function(_0x3cdec2,_0x2fd6f8){return respondWithRpcPromise(_0xbd8f('0x23'),_0x3cdec2['query'])[_0xbd8f('0x7')](respondWithResult(_0x2fd6f8,null))[_0xbd8f('0xc')](handleError(_0x2fd6f8,null));};exports[_0xbd8f('0x24')]=function(_0x2137ed,_0x25ad9a){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xbd8f('0x18')](_0x2137ed[_0xbd8f('0x15')],_0x2137ed[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x25ad9a,null))[_0xbd8f('0xc')](handleError(_0x25ad9a,null));};exports['voiceQueuesChannelHangup']=function(_0x24e5f4,_0x5f404e){return respondWithRpcPromise(_0xbd8f('0x25'),_[_0xbd8f('0x18')](_0x24e5f4[_0xbd8f('0x15')],_0x24e5f4[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x5f404e,null))[_0xbd8f('0xc')](handleError(_0x5f404e,null));};exports['voiceQueuesChannelRedirect']=function(_0x4bafcd,_0x4c9a8d){return respondWithRpcPromise(_0xbd8f('0x26'),_[_0xbd8f('0x18')](_0x4bafcd[_0xbd8f('0x15')],_0x4bafcd[_0xbd8f('0x19')]))[_0xbd8f('0x7')](respondWithResult(_0x4c9a8d,null))[_0xbd8f('0xc')](handleError(_0x4c9a8d,null));};exports[_0xbd8f('0x27')]=function(_0x30c1c2,_0x2d4882){return respondWithRpcPromise(_0xbd8f('0x28'),_0x30c1c2[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x2d4882,null))[_0xbd8f('0xc')](handleError(_0x2d4882,null));};exports[_0xbd8f('0x29')]=function(_0x391d45,_0x50e081){return respondWithRpcPromise(_0xbd8f('0x2a'),_0x391d45[_0xbd8f('0x15')])['then'](respondWithResult(_0x50e081,null))[_0xbd8f('0xc')](handleError(_0x50e081,null));};exports[_0xbd8f('0x2b')]=function(_0x3d3902,_0x582bcf){var _0x21da54;return respondWithRpcPromise('Agents',_0x3d3902[_0xbd8f('0x15')])[_0xbd8f('0x7')](function(_0x298952){_0x21da54=_0x298952;return respondWithRpcPromise('Agents',_0x3d3902[_0xbd8f('0x15')],routingClient);})[_0xbd8f('0x7')](function(_0xdab323){return _['merge']({},_0xdab323,_0x21da54);})[_0xbd8f('0x7')](respondWithResult(_0x582bcf,null))[_0xbd8f('0xc')](handleError(_0x582bcf,null));};exports[_0xbd8f('0x2c')]=function(_0x351027,_0x280d95){if(_0x351027[_0xbd8f('0x1f')]&&_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')]&&_0x351027[_0xbd8f('0x2e')]&&_0x351027['user']['name']){for(var _0x2907a3 in _0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')]){if(_0x351027[_0xbd8f('0x1f')]['interaction'][_0xbd8f('0x2f')](_0x2907a3)){db[_0xbd8f('0x30')][_0xbd8f('0x31')]({'where':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x351027['body'][_0xbd8f('0x2d')][_0x2907a3]&&_0x351027['body'][_0xbd8f('0x2d')][_0x2907a3][_0xbd8f('0x32')]?{'$notIn':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3]}:{'$ne':null}}})[_0xbd8f('0x7')](function(_0x151f82){var _0x1ea49a=moment()[_0xbd8f('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x36c43f=0x0,_0x2fbbbe=_0x151f82[_0xbd8f('0x32')];_0x36c43f<_0x2fbbbe;_0x36c43f+=0x1){_0x151f82[_0x36c43f][_0xbd8f('0x34')]({'exitAt':_0x1ea49a});}});for(var _0x229bc0=0x0;_0x229bc0<_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3][_0xbd8f('0x32')];_0x229bc0+=0x1){db['MemberReport'][_0xbd8f('0x35')]({'where':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'type':_0xbd8f('0x36'),'uniqueid':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x2d')][_0x2907a3][_0x229bc0],'exitAt':null},'defaults':{'channel':_0x2907a3,'membername':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')],'interface':_[_0xbd8f('0x12')](_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x37')])?util[_0xbd8f('0x33')](_0xbd8f('0x38'),_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x11')]):_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x37')],'type':_0xbd8f('0x36'),'enterAt':moment()[_0xbd8f('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xbd8f('0x39'),'internal':_0x351027[_0xbd8f('0x2e')][_0xbd8f('0x3a')],'uniqueid':_0x351027[_0xbd8f('0x1f')]['interaction'][_0x2907a3][_0x229bc0]}});}}}}return respondWithRpcPromise(_0xbd8f('0x3b'),{'id':_0x351027['params']['id'],'capacity':_0x351027[_0xbd8f('0x1f')][_0xbd8f('0x3c')]},routingClient)[_0xbd8f('0x7')](respondWithResult(_0x280d95,null))[_0xbd8f('0xc')](handleError(_0x280d95,null));};exports['telephones']=function(_0x3964f5,_0x35b814){return respondWithRpcPromise(_0xbd8f('0x3d'),_0x3964f5[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x35b814,null))[_0xbd8f('0xc')](handleError(_0x35b814,null));};exports['trunks']=function(_0x42a597,_0x4a2da8){return respondWithRpcPromise(_0xbd8f('0x3e'),_0x42a597[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x4a2da8,null))[_0xbd8f('0xc')](handleError(_0x4a2da8,null));};exports[_0xbd8f('0x3f')]=function(_0x358424,_0x2a331d){return respondWithRpcPromise(_0xbd8f('0x40'),_0x358424[_0xbd8f('0x15')])['then'](respondWithResult(_0x2a331d,null))[_0xbd8f('0xc')](handleError(_0x2a331d,null));};exports['chatQueues']=function(_0xd09e5,_0xb04dae){return respondWithRpcPromise('ChatQueues',_0xd09e5[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0xb04dae,null))['catch'](handleError(_0xb04dae,null));};exports['showChatQueues']=function(_0x55de68,_0x4042e0){return respondWithRpcPromise(_0xbd8f('0x41'),_0x55de68[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x55de68[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x4042e0,null))['catch'](handleError(_0x4042e0,null));};exports[_0xbd8f('0x42')]=function(_0x3848cb,_0x21d40b){return respondWithRpcPromise(_0xbd8f('0x43'),_0x3848cb[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x21d40b,null))[_0xbd8f('0xc')](handleError(_0x21d40b,null));};exports['showMailQueues']=function(_0x9cf2d5,_0x40c834){return respondWithRpcPromise(_0xbd8f('0x43'),_0x9cf2d5['query'],routingClient)[_0xbd8f('0x7')](findById(_0x9cf2d5[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x40c834,null))[_0xbd8f('0xc')](handleError(_0x40c834,null));};exports['mailAccounts']=function(_0x5327f2,_0x388af8){return respondWithRpcPromise('MailAccounts',_0x5327f2[_0xbd8f('0x15')],mailClient)[_0xbd8f('0x7')](respondWithResult(_0x388af8,null))[_0xbd8f('0xc')](handleError(_0x388af8,null));};exports[_0xbd8f('0x44')]=function(_0x4a86a9,_0x5ea275){return respondWithRpcPromise(_0xbd8f('0x45'),_0x4a86a9[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5ea275,null))[_0xbd8f('0xc')](handleError(_0x5ea275,null));};exports[_0xbd8f('0x46')]=function(_0x21cad7,_0x31adfb){return respondWithRpcPromise(_0xbd8f('0x45'),_0x21cad7[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x21cad7[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x31adfb,null))[_0xbd8f('0xc')](handleError(_0x31adfb,null));};exports[_0xbd8f('0x47')]=function(_0x225ebd,_0x12ee82){return respondWithRpcPromise(_0xbd8f('0x48'),_0x225ebd[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x12ee82,null))[_0xbd8f('0xc')](handleError(_0x12ee82,null));};exports[_0xbd8f('0x49')]=function(_0x538fd7,_0x5e18fc){return respondWithRpcPromise(_0xbd8f('0x48'),_0x538fd7[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x538fd7['params']['id']))['then'](respondWithResult(_0x5e18fc,null))[_0xbd8f('0xc')](handleError(_0x5e18fc,null));};exports['whatsappQueues']=function(_0x565e63,_0x5b5bd8){return respondWithRpcPromise('WhatsappQueues',_0x565e63['query'],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5b5bd8,null))['catch'](handleError(_0x5b5bd8,null));};exports[_0xbd8f('0x4a')]=function(_0x400aac,_0x53f297){return respondWithRpcPromise(_0xbd8f('0x4b'),_0x400aac[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](findById(_0x400aac[_0xbd8f('0x19')]['id']))[_0xbd8f('0x7')](respondWithResult(_0x53f297,null))['catch'](handleError(_0x53f297,null));};exports['faxQueues']=function(_0x378e72,_0x44469e){return respondWithRpcPromise(_0xbd8f('0x4c'),_0x378e72[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x44469e,null))[_0xbd8f('0xc')](handleError(_0x44469e,null));};exports['showFaxQueues']=function(_0x4eddf2,_0x467b0f){return respondWithRpcPromise(_0xbd8f('0x4c'),_0x4eddf2['query'],routingClient)[_0xbd8f('0x7')](findById(_0x4eddf2[_0xbd8f('0x19')]['id']))['then'](respondWithResult(_0x467b0f,null))[_0xbd8f('0xc')](handleError(_0x467b0f,null));};exports[_0xbd8f('0x4d')]=function(_0x10268a,_0x5a8c8f){return respondWithRpcPromise('FaxAccounts',_0x10268a[_0xbd8f('0x15')])[_0xbd8f('0x7')](respondWithResult(_0x5a8c8f,null))[_0xbd8f('0xc')](handleError(_0x5a8c8f,null));};exports[_0xbd8f('0x4e')]=function(_0x41be86,_0x5b900c){return respondWithRpcPromise(_0xbd8f('0x4f'),_0x41be86[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x5b900c,null))[_0xbd8f('0xc')](handleError(_0x5b900c,null));};exports[_0xbd8f('0x50')]=function(_0x3574a6,_0x2a7eaa){return respondWithRpcPromise(_0xbd8f('0x51'),_0x3574a6[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x2a7eaa,null))[_0xbd8f('0xc')](handleError(_0x2a7eaa,null));};exports[_0xbd8f('0x52')]=function(_0x34eec5,_0x40fc53){return respondWithRpcPromise(_0xbd8f('0x53'),_0x34eec5[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x40fc53,null))[_0xbd8f('0xc')](handleError(_0x40fc53,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x38d98e,_0x2957fd){return respondWithRpcPromise(_0xbd8f('0x53'),_0x38d98e[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](function(_0x18ccf2){if(_0x38d98e['query']['type']!==undefined){var _0x2a3982=_(_0x18ccf2[_0xbd8f('0x14')])['filter']([_0x38d98e[_0xbd8f('0x15')]['type'],_0x38d98e[_0xbd8f('0x19')]['id']])[_0xbd8f('0x54')](_0xbd8f('0x55'))[_0xbd8f('0x56')]()['value']();return _0x18ccf2[_0xbd8f('0x14')][_0xbd8f('0x57')](function(_0x84e98d){return _0x2a3982['indexOf'](_0x84e98d[_0xbd8f('0x55')])>-0x1;});}else{return _0x18ccf2[_0xbd8f('0x14')][_0xbd8f('0x57')](function(_0x161ec8){return _0x161ec8['queue_id']===parseInt(_0x38d98e[_0xbd8f('0x19')]['id']);});}})[_0xbd8f('0x7')](respondWithResult(_0x2957fd,null))[_0xbd8f('0xc')](handleError(_0x2957fd,null));};exports[_0xbd8f('0x58')]=function(_0x18645e,_0x23e962){return respondWithRpcPromise(_0xbd8f('0x59'),_0x18645e[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x23e962,null))[_0xbd8f('0xc')](handleError(_0x23e962,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3da31b,_0x4e908d){return respondWithRpcPromise(_0xbd8f('0x5a'),_0x3da31b[_0xbd8f('0x15')],routingClient)['then'](respondWithResult(_0x4e908d,null))[_0xbd8f('0xc')](handleError(_0x4e908d,null));};exports[_0xbd8f('0x5b')]=function(_0x60cd2b,_0x2ab853){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x60cd2b[_0xbd8f('0x15')],routingClient)[_0xbd8f('0x7')](respondWithResult(_0x2ab853,null))[_0xbd8f('0xc')](handleError(_0x2ab853,null));};exports[_0xbd8f('0x5c')]=function(_0x58651d){return function(_0x4e19ec,_0x2fb942){var _0x3641e9,_0x1f685d;var _0x2acd13=_[_0xbd8f('0x5d')](_0x58651d);var _0x53076d=_0x58651d===_0xbd8f('0x5e')?_0xbd8f('0x5f'):_0xbd8f('0x60');return db[_0x2acd13+_0xbd8f('0x61')][_0xbd8f('0x62')]({'raw':!![],'where':{'id':_0x4e19ec['params']['id']}})['then'](function(_0x542075){if(_[_0xbd8f('0x12')](_0x542075)){throw new Error(_0x2acd13+'\x20Queue\x20not\x20found');}_0x3641e9=_0x542075;return db[_0x2acd13+'Message']['findOne']({'where':{'id':_0x4e19ec[_0xbd8f('0x1f')][_0xbd8f('0x63')]},'include':[{'model':db[_0x2acd13+_0xbd8f('0x64')],'as':_0xbd8f('0x64')},{'model':db[_0x2acd13+_0x53076d],'as':_0xbd8f('0x60')}]});})[_0xbd8f('0x7')](function(_0xefcfc1){if(_[_0xbd8f('0x12')](_0xefcfc1)){throw new Error(_0x2acd13+'\x20Message\x20not\x20found');}_0x1f685d=_0xefcfc1;return _0xefcfc1[_0xbd8f('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbd8f('0x7')](function(){var _0x3caa98={'uniqueid':_0x58651d+'.'+_0x1f685d['id']+'.'+_0x1f685d['Interaction']['id'],'FromUserId':_0x4e19ec[_0xbd8f('0x2e')]['id'],'type':_0xbd8f('0x66')};_0x3caa98[_0x2acd13+_0xbd8f('0x67')]=_0x1f685d['id'];_0x3caa98[_0x2acd13+_0xbd8f('0x68')]=_0x1f685d[_0xbd8f('0x64')]['id'];_0x3caa98[_0xbd8f('0x69')+_0x2acd13+_0x53076d+'Id']=_0x1f685d[_0xbd8f('0x60')]['id'];_0x3caa98['To'+_0x2acd13+_0xbd8f('0x6a')]=_0x3641e9['id'];return db[_0x2acd13+_0xbd8f('0x6b')][_0xbd8f('0x6c')](_0x3caa98);})['then'](function(){return respondWithRpcPromise(_0xbd8f('0x6d'),{'channel':_0x58651d,'interaction':_0x1f685d[_0xbd8f('0x64')],'message':_0x1f685d,'account':_0x1f685d[_0xbd8f('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3641e9[_0xbd8f('0x11')]+','+(_0x1f685d['Account'][_0xbd8f('0x6e')]||0x12c),'interval':_0xbd8f('0x6f')}]},routingClient);})[_0xbd8f('0x7')](respondWithResult(_0x2fb942,null))[_0xbd8f('0xc')](handleError(_0x2fb942,null));};};exports[_0xbd8f('0x70')]=function(_0x57762c,_0xe58b64){var _0x198d4b,_0x60c94c;if(_[_0xbd8f('0x12')](_0x57762c[_0xbd8f('0x1f')][_0xbd8f('0x71')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x672cfb=_0x57762c[_0xbd8f('0x1f')]['channel'];var _0x49e15e=_[_0xbd8f('0x5d')](_0x672cfb);var _0x5b0716=_0x672cfb==='chat'?'Website':_0xbd8f('0x60');return db[_0xbd8f('0x72')][_0xbd8f('0x62')]({'raw':!![],'where':{'id':_0x57762c[_0xbd8f('0x19')]['id'],'role':'agent'}})[_0xbd8f('0x7')](function(_0x398cc9){if(_['isNil'](_0x398cc9)){throw new Error('Agent\x20not\x20found');}_0x198d4b=_0x398cc9;return db[_0x49e15e+_0xbd8f('0x73')]['findOne']({'where':{'id':_0x57762c[_0xbd8f('0x1f')]['messageId']},'include':[{'model':db[_0x49e15e+'Interaction'],'as':_0xbd8f('0x64')},{'model':db[_0x49e15e+_0x5b0716],'as':_0xbd8f('0x60')}]});})[_0xbd8f('0x7')](function(_0x18e9f0){if(_[_0xbd8f('0x12')](_0x18e9f0)){throw new Error(_0x49e15e+'\x20Message\x20not\x20found');}_0x60c94c=_0x18e9f0;return _0x18e9f0[_0xbd8f('0x65')]({'read':0x0,'readAt':null,'UserId':null});})[_0xbd8f('0x7')](function(){var _0x3a6ec4={'uniqueid':_0x672cfb+'.'+_0x60c94c['id']+'.'+_0x60c94c['Interaction']['id'],'FromUserId':_0x57762c[_0xbd8f('0x2e')]['id'],'type':_0xbd8f('0x66'),'ToUserId':_0x198d4b['id']};_0x3a6ec4[_0x49e15e+_0xbd8f('0x67')]=_0x60c94c['id'];_0x3a6ec4[_0x49e15e+_0xbd8f('0x68')]=_0x60c94c[_0xbd8f('0x64')]['id'];_0x3a6ec4[_0xbd8f('0x69')+_0x49e15e+_0x5b0716+'Id']=_0x60c94c[_0xbd8f('0x60')]['id'];return db[_0x49e15e+_0xbd8f('0x6b')][_0xbd8f('0x6c')](_0x3a6ec4);})[_0xbd8f('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x672cfb,'interaction':_0x60c94c['Interaction'],'message':_0x60c94c,'account':_0x60c94c['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x198d4b[_0xbd8f('0x11')]+','+(_0x60c94c[_0xbd8f('0x60')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xe58b64,null))['catch'](handleError(_0xe58b64,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9f69be3..5b95999 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 _0x8393=['./schedule.controller','get','index','isAuthenticated','show','/:id/run','run','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x8393,0x16d));var _0x3839=function(_0x120f7e,_0x1c43c1){_0x120f7e=_0x120f7e-0x0;var _0x122639=_0x8393[_0x120f7e];return _0x122639;};'use strict';var multer=require(_0x3839('0x0'));var util=require(_0x3839('0x1'));var path=require(_0x3839('0x2'));var timeout=require(_0x3839('0x3'));var express=require(_0x3839('0x4'));var router=express[_0x3839('0x5')]();var fs_extra=require(_0x3839('0x6'));var auth=require(_0x3839('0x7'));var interaction=require(_0x3839('0x8'));var config=require(_0x3839('0x9'));var controller=require(_0x3839('0xa'));router[_0x3839('0xb')]('/',auth['isAuthenticated'](),controller[_0x3839('0xc')]);router[_0x3839('0xb')]('/:id',auth[_0x3839('0xd')](),controller[_0x3839('0xe')]);router[_0x3839('0xb')](_0x3839('0xf'),auth[_0x3839('0xd')](),controller[_0x3839('0x10')]);router[_0x3839('0x11')]('/',auth['isAuthenticated'](),controller[_0x3839('0x12')]);router[_0x3839('0x13')]('/:id',auth[_0x3839('0xd')](),controller[_0x3839('0x14')]);router[_0x3839('0x15')](_0x3839('0x16'),auth[_0x3839('0xd')](),controller[_0x3839('0x17')]);module[_0x3839('0x18')]=router; \ No newline at end of file +var _0xf446=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','index','/:id','show','post','create','put','update','delete','isAuthenticated','exports','multer'];(function(_0x27833a,_0x531af2){var _0x2f2594=function(_0x837f16){while(--_0x837f16){_0x27833a['push'](_0x27833a['shift']());}};_0x2f2594(++_0x531af2);}(_0xf446,0x1e5));var _0x6f44=function(_0x286b55,_0x723c8b){_0x286b55=_0x286b55-0x0;var _0x5efe59=_0xf446[_0x286b55];return _0x5efe59;};'use strict';var multer=require(_0x6f44('0x0'));var util=require('util');var path=require(_0x6f44('0x1'));var timeout=require(_0x6f44('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6f44('0x3'));var auth=require(_0x6f44('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6f44('0x5'));var controller=require(_0x6f44('0x6'));router[_0x6f44('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f44('0x8')]);router[_0x6f44('0x7')](_0x6f44('0x9'),auth['isAuthenticated'](),controller[_0x6f44('0xa')]);router[_0x6f44('0x7')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x6f44('0xb')]('/',auth['isAuthenticated'](),controller[_0x6f44('0xc')]);router[_0x6f44('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6f44('0xe')]);router[_0x6f44('0xf')](_0x6f44('0x9'),auth[_0x6f44('0x10')](),controller['destroy']);module[_0x6f44('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index cff209e..242561c 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 _0x2fce=['ENUM','quarters','months','weeks','hours','days','csv','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0x2b20eb,_0x53d501){var _0x3443b9=function(_0x39e4b9){while(--_0x39e4b9){_0x2b20eb['push'](_0x2b20eb['shift']());}};_0x3443b9(++_0x53d501);}(_0x2fce,0x185));var _0xe2fc=function(_0x12d9c1,_0x348bd4){_0x12d9c1=_0x12d9c1-0x0;var _0x12190e=_0x2fce[_0x12d9c1];return _0x12190e;};'use strict';var Sequelize=require(_0xe2fc('0x0'));module[_0xe2fc('0x1')]={'name':{'type':Sequelize[_0xe2fc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe2fc('0x2')]},'active':{'type':Sequelize[_0xe2fc('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe2fc('0x2')],'allowNull':![],'defaultValue':_0xe2fc('0x4')},'startAt':{'type':Sequelize[_0xe2fc('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe2fc('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe2fc('0x7')]('years',_0xe2fc('0x8'),_0xe2fc('0x9'),_0xe2fc('0xa'),'days',_0xe2fc('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xe2fc('0xc')},'output':{'type':Sequelize['ENUM'](_0xe2fc('0xd'),'pdf',_0xe2fc('0xe')),'allowNull':![],'defaultValue':_0xe2fc('0xd')},'type':{'type':Sequelize[_0xe2fc('0x7')]('custom',_0xe2fc('0xf')),'allowNull':![],'defaultValue':_0xe2fc('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe2fc('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xe2fc('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0c6a=['years','months','weeks','days','hours','csv','pdf','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x0c6a,0x14d));var _0xa0c6=function(_0x48d6c2,_0x1ce5d2){_0x48d6c2=_0x48d6c2-0x0;var _0x39eeb1=_0x0c6a[_0x48d6c2];return _0x39eeb1;};'use strict';var Sequelize=require(_0xa0c6('0x0'));module[_0xa0c6('0x1')]={'name':{'type':Sequelize[_0xa0c6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa0c6('0x2')]},'active':{'type':Sequelize[_0xa0c6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa0c6('0x4')},'startAt':{'type':Sequelize[_0xa0c6('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa0c6('0x6')](_0xa0c6('0x7'),'quarters',_0xa0c6('0x8'),_0xa0c6('0x9'),_0xa0c6('0xa'),_0xa0c6('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xa0c6('0xa')},'output':{'type':Sequelize[_0xa0c6('0x6')](_0xa0c6('0xc'),_0xa0c6('0xd'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xa0c6('0x6')](_0xa0c6('0xe'),_0xa0c6('0xf')),'allowNull':![],'defaultValue':_0xa0c6('0xe')},'sendMail':{'type':Sequelize[_0xa0c6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa0c6('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xa0c6('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 1fa73f0..5861e67 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 _0x0732=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','Schedule','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x9cc9ad,_0x56ebc1){var _0x35916b=function(_0x138799){while(--_0x138799){_0x9cc9ad['push'](_0x9cc9ad['shift']());}};_0x35916b(++_0x56ebc1);}(_0x0732,0x1b6));var _0x2073=function(_0x2c1ddd,_0x2a667f){_0x2c1ddd=_0x2c1ddd-0x0;var _0x49fa39=_0x0732[_0x2c1ddd];return _0x49fa39;};'use strict';var emlformat=require(_0x2073('0x0'));var rimraf=require(_0x2073('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2073('0x2'));var rp=require(_0x2073('0x3'));var moment=require(_0x2073('0x4'));var BPromise=require(_0x2073('0x5'));var Mustache=require('mustache');var util=require(_0x2073('0x6'));var path=require(_0x2073('0x7'));var sox=require(_0x2073('0x8'));var csv=require(_0x2073('0x9'));var ejs=require(_0x2073('0xa'));var fs=require('fs');var fs_extra=require(_0x2073('0xb'));var _=require(_0x2073('0xc'));var squel=require(_0x2073('0xd'));var crypto=require('crypto');var jsforce=require(_0x2073('0xe'));var deskjs=require(_0x2073('0xf'));var toCsv=require(_0x2073('0x9'));var querystring=require(_0x2073('0x10'));var Papa=require('papaparse');var Redis=require(_0x2073('0x11'));var authService=require(_0x2073('0x12'));var qs=require(_0x2073('0x13'));var as=require(_0x2073('0x14'));var hardwareService=require(_0x2073('0x15'));var logger=require(_0x2073('0x16'))(_0x2073('0x17'));var utils=require(_0x2073('0x18'));var config=require(_0x2073('0x19'));var licenseUtil=require(_0x2073('0x1a'));var db=require(_0x2073('0x1b'))['db'];function respondWithStatusCode(_0x374d7e,_0x2264b3){_0x2264b3=_0x2264b3||0xcc;return function(_0x47cf52){if(_0x47cf52){return _0x374d7e['sendStatus'](_0x2264b3);}return _0x374d7e[_0x2073('0x1c')](_0x2264b3)[_0x2073('0x1d')]();};}function respondWithResult(_0x552c6f,_0x4a6804){_0x4a6804=_0x4a6804||0xc8;return function(_0x1db8a7){if(_0x1db8a7){return _0x552c6f['status'](_0x4a6804)[_0x2073('0x1e')](_0x1db8a7);}};}function respondWithFilteredResult(_0x27ac75,_0x400082){return function(_0x24fa3d){if(_0x24fa3d){var _0x2ec037=typeof _0x400082[_0x2073('0x1f')]===_0x2073('0x20')&&typeof _0x400082[_0x2073('0x21')]===_0x2073('0x20');var _0x2f1b4a=_0x24fa3d[_0x2073('0x22')];var _0x3cd156=_0x2ec037?0x0:_0x400082[_0x2073('0x1f')];var _0x2ca731=_0x2ec037?_0x24fa3d[_0x2073('0x22')]:_0x400082[_0x2073('0x1f')]+_0x400082[_0x2073('0x21')];var _0x1de2aa;if(_0x2ca731>=_0x2f1b4a){_0x2ca731=_0x2f1b4a;_0x1de2aa=0xc8;}else{_0x1de2aa=0xce;}_0x27ac75[_0x2073('0x1c')](_0x1de2aa);return _0x27ac75['set'](_0x2073('0x23'),_0x3cd156+'-'+_0x2ca731+'/'+_0x2f1b4a)['json'](_0x24fa3d);}return null;};}function patchUpdates(_0x227bf3){return function(_0x120c49){try{jsonpatch[_0x2073('0x24')](_0x120c49,_0x227bf3,!![]);}catch(_0x58d074){return BPromise[_0x2073('0x25')](_0x58d074);}return _0x120c49[_0x2073('0x26')]();};}function saveUpdates(_0x280209,_0x2a54b6){return function(_0x3524e1){if(_0x3524e1){return _0x3524e1[_0x2073('0x27')](_0x280209)[_0x2073('0x28')](function(_0x572661){return _0x572661;});}return null;};}function removeEntity(_0x353a2a,_0x34d70c){return function(_0x52ad30){if(_0x52ad30){return _0x52ad30[_0x2073('0x29')]()[_0x2073('0x28')](function(){var _0x20e21a=_0x52ad30['get']({'plain':!![]});var _0x31dff3=_0x2073('0x2a');return db[_0x2073('0x2b')][_0x2073('0x29')]({'where':{'type':_0x31dff3,'resourceId':_0x20e21a['id']}})[_0x2073('0x28')](function(){return _0x52ad30;});})[_0x2073('0x28')](function(){_0x353a2a['status'](0xcc)[_0x2073('0x1d')]();});}};}function handleEntityNotFound(_0x348b21,_0x1174ff){return function(_0x18aca5){if(!_0x18aca5){_0x348b21['sendStatus'](0x194);}return _0x18aca5;};}function handleError(_0x558b02,_0x57a298){_0x57a298=_0x57a298||0x1f4;return function(_0xf04c44){logger['error'](_0xf04c44[_0x2073('0x2c')]);if(_0xf04c44[_0x2073('0x2d')]){delete _0xf04c44['name'];}_0x558b02[_0x2073('0x1c')](_0x57a298)[_0x2073('0x2e')](_0xf04c44);};}exports[_0x2073('0x2f')]=function(_0x5ba8ea,_0x152d08){var _0x214e0a={},_0x26a458={},_0x3de608={'count':0x0,'rows':[]};var _0x44081d=_[_0x2073('0x30')](db['Schedule'][_0x2073('0x31')],function(_0x2d4978){return{'name':_0x2d4978[_0x2073('0x32')],'type':_0x2d4978[_0x2073('0x33')][_0x2073('0x34')]};});_0x26a458['model']=_[_0x2073('0x30')](_0x44081d,_0x2073('0x2d'));_0x26a458[_0x2073('0x35')]=_[_0x2073('0x36')](_0x5ba8ea[_0x2073('0x35')]);_0x26a458[_0x2073('0x37')]=_[_0x2073('0x38')](_0x26a458['model'],_0x26a458[_0x2073('0x35')]);_0x214e0a[_0x2073('0x39')]=_['intersection'](_0x26a458[_0x2073('0x3a')],qs[_0x2073('0x3b')](_0x5ba8ea[_0x2073('0x35')]['fields']));_0x214e0a['attributes']=_0x214e0a[_0x2073('0x39')][_0x2073('0x3c')]?_0x214e0a['attributes']:_0x26a458[_0x2073('0x3a')];if(!_0x5ba8ea[_0x2073('0x35')][_0x2073('0x3d')](_0x2073('0x3e'))){_0x214e0a[_0x2073('0x21')]=qs[_0x2073('0x21')](_0x5ba8ea[_0x2073('0x35')][_0x2073('0x21')]);_0x214e0a[_0x2073('0x1f')]=qs[_0x2073('0x1f')](_0x5ba8ea['query'][_0x2073('0x1f')]);}_0x214e0a['order']=qs['sort'](_0x5ba8ea['query'][_0x2073('0x3f')]);_0x214e0a[_0x2073('0x40')]=qs[_0x2073('0x37')](_[_0x2073('0x41')](_0x5ba8ea[_0x2073('0x35')],_0x26a458[_0x2073('0x37')]),_0x44081d);if(_0x5ba8ea[_0x2073('0x35')]['filter']){_0x214e0a[_0x2073('0x40')]=_[_0x2073('0x42')](_0x214e0a['where'],{'$or':_[_0x2073('0x30')](_0x44081d,function(_0x2ceaa3){if(_0x2ceaa3[_0x2073('0x33')]!=='VIRTUAL'){var _0x5462be={};_0x5462be[_0x2ceaa3[_0x2073('0x2d')]]={'$like':'%'+_0x5ba8ea[_0x2073('0x35')][_0x2073('0x43')]+'%'};return _0x5462be;}})});}_0x214e0a=_[_0x2073('0x42')]({},_0x214e0a,_0x5ba8ea[_0x2073('0x44')]);var _0x424398={'where':_0x214e0a[_0x2073('0x40')]};return db['Schedule']['count'](_0x424398)[_0x2073('0x28')](function(_0x1760b7){_0x3de608[_0x2073('0x22')]=_0x1760b7;if(_0x5ba8ea[_0x2073('0x35')]['includeAll']){_0x214e0a['include']=[{'all':!![]}];}return db[_0x2073('0x45')][_0x2073('0x46')](_0x214e0a);})['then'](function(_0x518819){_0x3de608[_0x2073('0x47')]=_0x518819;return _0x3de608;})['then'](respondWithFilteredResult(_0x152d08,_0x214e0a))[_0x2073('0x48')](handleError(_0x152d08,null));};exports[_0x2073('0x49')]=function(_0x2f5c66,_0x9055d9){var _0x494931={'raw':![],'where':{'id':_0x2f5c66[_0x2073('0x4a')]['id']}},_0x171ecf={};_0x171ecf[_0x2073('0x3a')]=_[_0x2073('0x36')](db[_0x2073('0x45')]['rawAttributes']);_0x171ecf[_0x2073('0x35')]=_[_0x2073('0x36')](_0x2f5c66[_0x2073('0x35')]);_0x171ecf[_0x2073('0x37')]=_[_0x2073('0x38')](_0x171ecf[_0x2073('0x3a')],_0x171ecf[_0x2073('0x35')]);_0x494931[_0x2073('0x39')]=_[_0x2073('0x38')](_0x171ecf[_0x2073('0x3a')],qs[_0x2073('0x3b')](_0x2f5c66[_0x2073('0x35')][_0x2073('0x3b')]));_0x494931['attributes']=_0x494931[_0x2073('0x39')][_0x2073('0x3c')]?_0x494931[_0x2073('0x39')]:_0x171ecf[_0x2073('0x3a')];if(_0x2f5c66[_0x2073('0x35')][_0x2073('0x4b')]){_0x494931[_0x2073('0x4c')]=[{'all':!![]}];}_0x494931=_['merge']({},_0x494931,_0x2f5c66['options']);return db[_0x2073('0x45')][_0x2073('0x4d')](_0x494931)[_0x2073('0x28')](handleEntityNotFound(_0x9055d9,null))[_0x2073('0x28')](respondWithResult(_0x9055d9,null))[_0x2073('0x48')](handleError(_0x9055d9,null));};exports[_0x2073('0x4e')]=function(_0x26050d,_0x1d7c61){return db['Schedule']['create'](_0x26050d[_0x2073('0x4f')],{})[_0x2073('0x28')](function(_0x354e4a){var _0x5ec9c0=_0x26050d[_0x2073('0x50')][_0x2073('0x51')]({'plain':!![]});if(!_0x5ec9c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ec9c0[_0x2073('0x52')]==='user'){var _0x42e89f=_0x354e4a[_0x2073('0x51')]({'plain':!![]});var _0x113845='Scheduler';return db[_0x2073('0x53')][_0x2073('0x4d')]({'where':{'name':_0x113845,'userProfileId':_0x5ec9c0[_0x2073('0x54')]},'raw':!![]})[_0x2073('0x28')](function(_0x365457){if(_0x365457&&_0x365457[_0x2073('0x55')]===0x0){return db[_0x2073('0x2b')][_0x2073('0x4e')]({'name':_0x42e89f[_0x2073('0x2d')],'resourceId':_0x42e89f['id'],'type':_0x365457['name'],'sectionId':_0x365457['id']},{})[_0x2073('0x28')](function(){return _0x354e4a;});}else{return _0x354e4a;}})[_0x2073('0x48')](function(_0x2b9fcc){logger[_0x2073('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b9fcc);throw _0x2b9fcc;});}return _0x354e4a;})[_0x2073('0x28')](respondWithResult(_0x1d7c61,0xc9))[_0x2073('0x48')](handleError(_0x1d7c61,null));};exports['update']=function(_0x291dd8,_0x4d5b1d){if(_0x291dd8[_0x2073('0x4f')]['id']){delete _0x291dd8['body']['id'];}return db[_0x2073('0x45')][_0x2073('0x4d')]({'where':{'id':_0x291dd8[_0x2073('0x4a')]['id']}})[_0x2073('0x28')](handleEntityNotFound(_0x4d5b1d,null))[_0x2073('0x28')](saveUpdates(_0x291dd8[_0x2073('0x4f')],null))[_0x2073('0x28')](respondWithResult(_0x4d5b1d,null))[_0x2073('0x48')](handleError(_0x4d5b1d,null));};exports['destroy']=function(_0x39c032,_0x12d51a){return db['Schedule']['find']({'where':{'id':_0x39c032['params']['id']}})['then'](handleEntityNotFound(_0x12d51a,null))[_0x2073('0x28')](removeEntity(_0x12d51a,null))['catch'](handleError(_0x12d51a,null));};exports[_0x2073('0x57')]=function(_0x4ab701,_0x529089,_0x110331){var _0x182ff9=require(_0x2073('0x58'));return db[_0x2073('0x45')]['find']({'where':{'id':_0x4ab701[_0x2073('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x529089,null))[_0x2073('0x28')](function(){_0x182ff9[_0x2073('0x57')](_0x4ab701[_0x2073('0x4a')]['id']);})[_0x2073('0x28')](respondWithStatusCode(_0x529089,null))[_0x2073('0x48')](handleError(_0x529089,null));}; \ No newline at end of file +var _0x2ee1=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','model','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Scheduler','destroy','error','name','send','index','map','Schedule','rawAttributes','fieldName','query','filters','attributes','fields','length','hasOwnProperty','nolimit','where','pick'];(function(_0x237f1e,_0x32e440){var _0x18985d=function(_0x253e7e){while(--_0x253e7e){_0x237f1e['push'](_0x237f1e['shift']());}};_0x18985d(++_0x32e440);}(_0x2ee1,0x6e));var _0x12ee=function(_0x4ed827,_0x54d776){_0x4ed827=_0x4ed827-0x0;var _0x2e1038=_0x2ee1[_0x4ed827];return _0x2e1038;};'use strict';var emlformat=require(_0x12ee('0x0'));var rimraf=require(_0x12ee('0x1'));var zipdir=require(_0x12ee('0x2'));var jsonpatch=require(_0x12ee('0x3'));var rp=require(_0x12ee('0x4'));var moment=require('moment');var BPromise=require(_0x12ee('0x5'));var Mustache=require(_0x12ee('0x6'));var util=require(_0x12ee('0x7'));var path=require(_0x12ee('0x8'));var sox=require(_0x12ee('0x9'));var csv=require(_0x12ee('0xa'));var ejs=require(_0x12ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12ee('0xc'));var squel=require(_0x12ee('0xd'));var crypto=require(_0x12ee('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x12ee('0xa'));var querystring=require(_0x12ee('0xf'));var Papa=require(_0x12ee('0x10'));var Redis=require(_0x12ee('0x11'));var authService=require(_0x12ee('0x12'));var qs=require(_0x12ee('0x13'));var as=require(_0x12ee('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x12ee('0x15'));var utils=require('../../config/utils');var config=require(_0x12ee('0x16'));var licenseUtil=require(_0x12ee('0x17'));var db=require(_0x12ee('0x18'))['db'];function respondWithStatusCode(_0xd3cec5,_0xc1f2ff){_0xc1f2ff=_0xc1f2ff||0xcc;return function(_0x5341cd){if(_0x5341cd){return _0xd3cec5[_0x12ee('0x19')](_0xc1f2ff);}return _0xd3cec5[_0x12ee('0x1a')](_0xc1f2ff)[_0x12ee('0x1b')]();};}function respondWithResult(_0x2f5cb4,_0x4cca4a){_0x4cca4a=_0x4cca4a||0xc8;return function(_0x4bf6c4){if(_0x4bf6c4){return _0x2f5cb4['status'](_0x4cca4a)[_0x12ee('0x1c')](_0x4bf6c4);}};}function respondWithFilteredResult(_0x510c47,_0x28d140){return function(_0x27b518){if(_0x27b518){var _0x5e78ef=typeof _0x28d140[_0x12ee('0x1d')]===_0x12ee('0x1e')&&typeof _0x28d140['limit']===_0x12ee('0x1e');var _0x3bfc9f=_0x27b518[_0x12ee('0x1f')];var _0x5d8716=_0x5e78ef?0x0:_0x28d140[_0x12ee('0x1d')];var _0x340554=_0x5e78ef?_0x27b518[_0x12ee('0x1f')]:_0x28d140[_0x12ee('0x1d')]+_0x28d140[_0x12ee('0x20')];var _0x49014b;if(_0x340554>=_0x3bfc9f){_0x340554=_0x3bfc9f;_0x49014b=0xc8;}else{_0x49014b=0xce;}_0x510c47[_0x12ee('0x1a')](_0x49014b);return _0x510c47[_0x12ee('0x21')](_0x12ee('0x22'),_0x5d8716+'-'+_0x340554+'/'+_0x3bfc9f)[_0x12ee('0x1c')](_0x27b518);}return null;};}function patchUpdates(_0x18082f){return function(_0xb4f3c3){try{jsonpatch[_0x12ee('0x23')](_0xb4f3c3,_0x18082f,!![]);}catch(_0x197786){return BPromise[_0x12ee('0x24')](_0x197786);}return _0xb4f3c3[_0x12ee('0x25')]();};}function saveUpdates(_0x5f5260,_0x564ebe){return function(_0x22afdf){if(_0x22afdf){return _0x22afdf[_0x12ee('0x26')](_0x5f5260)[_0x12ee('0x27')](function(_0x1fa5d0){return _0x1fa5d0;});}return null;};}function removeEntity(_0x343d5f,_0x283c6f){return function(_0x3ea26f){if(_0x3ea26f){return _0x3ea26f['destroy']()[_0x12ee('0x27')](function(){var _0x2739c8=_0x3ea26f[_0x12ee('0x28')]({'plain':!![]});var _0x5b647f=_0x12ee('0x29');return db['UserProfileResource'][_0x12ee('0x2a')]({'where':{'type':_0x5b647f,'resourceId':_0x2739c8['id']}})[_0x12ee('0x27')](function(){return _0x3ea26f;});})[_0x12ee('0x27')](function(){_0x343d5f[_0x12ee('0x1a')](0xcc)[_0x12ee('0x1b')]();});}};}function handleEntityNotFound(_0x2fcb29,_0x59b82f){return function(_0x24368c){if(!_0x24368c){_0x2fcb29[_0x12ee('0x19')](0x194);}return _0x24368c;};}function handleError(_0x2f80eb,_0x33a7a6){_0x33a7a6=_0x33a7a6||0x1f4;return function(_0x2593ef){logger[_0x12ee('0x2b')](_0x2593ef['stack']);if(_0x2593ef['name']){delete _0x2593ef[_0x12ee('0x2c')];}_0x2f80eb[_0x12ee('0x1a')](_0x33a7a6)[_0x12ee('0x2d')](_0x2593ef);};}exports[_0x12ee('0x2e')]=function(_0x245ea9,_0x30597b){var _0xb6e6e={},_0x26607f={},_0x1cba83={'count':0x0,'rows':[]};var _0x24e50a=_[_0x12ee('0x2f')](db[_0x12ee('0x30')][_0x12ee('0x31')],function(_0x2baf82){return{'name':_0x2baf82[_0x12ee('0x32')],'type':_0x2baf82['type']['key']};});_0x26607f['model']=_[_0x12ee('0x2f')](_0x24e50a,_0x12ee('0x2c'));_0x26607f['query']=_['keys'](_0x245ea9[_0x12ee('0x33')]);_0x26607f[_0x12ee('0x34')]=_['intersection'](_0x26607f['model'],_0x26607f[_0x12ee('0x33')]);_0xb6e6e[_0x12ee('0x35')]=_['intersection'](_0x26607f['model'],qs['fields'](_0x245ea9[_0x12ee('0x33')][_0x12ee('0x36')]));_0xb6e6e[_0x12ee('0x35')]=_0xb6e6e[_0x12ee('0x35')][_0x12ee('0x37')]?_0xb6e6e['attributes']:_0x26607f['model'];if(!_0x245ea9[_0x12ee('0x33')][_0x12ee('0x38')](_0x12ee('0x39'))){_0xb6e6e[_0x12ee('0x20')]=qs[_0x12ee('0x20')](_0x245ea9[_0x12ee('0x33')][_0x12ee('0x20')]);_0xb6e6e[_0x12ee('0x1d')]=qs['offset'](_0x245ea9['query'][_0x12ee('0x1d')]);}_0xb6e6e['order']=qs['sort'](_0x245ea9[_0x12ee('0x33')]['sort']);_0xb6e6e[_0x12ee('0x3a')]=qs[_0x12ee('0x34')](_[_0x12ee('0x3b')](_0x245ea9['query'],_0x26607f[_0x12ee('0x34')]),_0x24e50a);if(_0x245ea9[_0x12ee('0x33')][_0x12ee('0x3c')]){_0xb6e6e[_0x12ee('0x3a')]=_[_0x12ee('0x3d')](_0xb6e6e[_0x12ee('0x3a')],{'$or':_[_0x12ee('0x2f')](_0x24e50a,function(_0x51bb88){if(_0x51bb88[_0x12ee('0x3e')]!==_0x12ee('0x3f')){var _0x514a85={};_0x514a85[_0x51bb88[_0x12ee('0x2c')]]={'$like':'%'+_0x245ea9[_0x12ee('0x33')]['filter']+'%'};return _0x514a85;}})});}_0xb6e6e=_[_0x12ee('0x3d')]({},_0xb6e6e,_0x245ea9[_0x12ee('0x40')]);var _0x9a0c97={'where':_0xb6e6e[_0x12ee('0x3a')]};return db[_0x12ee('0x30')]['count'](_0x9a0c97)[_0x12ee('0x27')](function(_0x523056){_0x1cba83['count']=_0x523056;if(_0x245ea9['query'][_0x12ee('0x41')]){_0xb6e6e[_0x12ee('0x42')]=[{'all':!![]}];}return db[_0x12ee('0x30')][_0x12ee('0x43')](_0xb6e6e);})['then'](function(_0x891018){_0x1cba83[_0x12ee('0x44')]=_0x891018;return _0x1cba83;})[_0x12ee('0x27')](respondWithFilteredResult(_0x30597b,_0xb6e6e))['catch'](handleError(_0x30597b,null));};exports[_0x12ee('0x45')]=function(_0xd99a07,_0x9da518){var _0x30d70d={'raw':![],'where':{'id':_0xd99a07['params']['id']}},_0x1df4c2={};_0x1df4c2[_0x12ee('0x46')]=_[_0x12ee('0x47')](db['Schedule'][_0x12ee('0x31')]);_0x1df4c2[_0x12ee('0x33')]=_[_0x12ee('0x47')](_0xd99a07[_0x12ee('0x33')]);_0x1df4c2[_0x12ee('0x34')]=_['intersection'](_0x1df4c2['model'],_0x1df4c2['query']);_0x30d70d[_0x12ee('0x35')]=_['intersection'](_0x1df4c2[_0x12ee('0x46')],qs['fields'](_0xd99a07[_0x12ee('0x33')][_0x12ee('0x36')]));_0x30d70d['attributes']=_0x30d70d['attributes'][_0x12ee('0x37')]?_0x30d70d[_0x12ee('0x35')]:_0x1df4c2[_0x12ee('0x46')];if(_0xd99a07[_0x12ee('0x33')][_0x12ee('0x41')]){_0x30d70d['include']=[{'all':!![]}];}_0x30d70d=_['merge']({},_0x30d70d,_0xd99a07[_0x12ee('0x40')]);return db['Schedule'][_0x12ee('0x48')](_0x30d70d)['then'](handleEntityNotFound(_0x9da518,null))[_0x12ee('0x27')](respondWithResult(_0x9da518,null))[_0x12ee('0x49')](handleError(_0x9da518,null));};exports[_0x12ee('0x4a')]=function(_0x50cc6d,_0x289caa){return db['Schedule'][_0x12ee('0x4a')](_0x50cc6d[_0x12ee('0x4b')],{})[_0x12ee('0x27')](function(_0x547ca5){var _0x5a45c9=_0x50cc6d[_0x12ee('0x4c')][_0x12ee('0x28')]({'plain':!![]});if(!_0x5a45c9)throw new Error(_0x12ee('0x4d'));if(_0x5a45c9[_0x12ee('0x4e')]===_0x12ee('0x4c')){var _0xe899aa=_0x547ca5[_0x12ee('0x28')]({'plain':!![]});var _0x24a086=_0x12ee('0x29');return db['UserProfileSection'][_0x12ee('0x48')]({'where':{'name':_0x24a086,'userProfileId':_0x5a45c9[_0x12ee('0x4f')]},'raw':!![]})[_0x12ee('0x27')](function(_0x3f7b14){if(_0x3f7b14&&_0x3f7b14[_0x12ee('0x50')]===0x0){return db[_0x12ee('0x51')][_0x12ee('0x4a')]({'name':_0xe899aa['name'],'resourceId':_0xe899aa['id'],'type':_0x3f7b14[_0x12ee('0x2c')],'sectionId':_0x3f7b14['id']},{})['then'](function(){return _0x547ca5;});}else{return _0x547ca5;}})[_0x12ee('0x49')](function(_0x594417){logger[_0x12ee('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x594417);throw _0x594417;});}return _0x547ca5;})['then'](respondWithResult(_0x289caa,0xc9))[_0x12ee('0x49')](handleError(_0x289caa,null));};exports[_0x12ee('0x26')]=function(_0x35e6e2,_0xbf9894){if(_0x35e6e2['body']['id']){delete _0x35e6e2[_0x12ee('0x4b')]['id'];}return db[_0x12ee('0x30')][_0x12ee('0x48')]({'where':{'id':_0x35e6e2[_0x12ee('0x52')]['id']}})[_0x12ee('0x27')](handleEntityNotFound(_0xbf9894,null))['then'](saveUpdates(_0x35e6e2['body'],null))['then'](respondWithResult(_0xbf9894,null))[_0x12ee('0x49')](handleError(_0xbf9894,null));};exports[_0x12ee('0x2a')]=function(_0x4bb372,_0x3b490c){return db[_0x12ee('0x30')]['find']({'where':{'id':_0x4bb372[_0x12ee('0x52')]['id']}})['then'](handleEntityNotFound(_0x3b490c,null))[_0x12ee('0x27')](removeEntity(_0x3b490c,null))[_0x12ee('0x49')](handleError(_0x3b490c,null));};exports[_0x12ee('0x53')]=function(_0x1e368b,_0x97c118,_0x559185){var _0x4f9b32=require(_0x12ee('0x54'));return db[_0x12ee('0x30')][_0x12ee('0x48')]({'where':{'id':_0x1e368b['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x97c118,null))[_0x12ee('0x27')](function(){_0x4f9b32['run'](_0x1e368b['params']['id']);})[_0x12ee('0x27')](respondWithStatusCode(_0x97c118,null))[_0x12ee('0x49')](handleError(_0x97c118,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 55b3d79..4869be0 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 _0xe4b0=['../../config/environment','./schedule.attributes','define','tools_schedules','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x880b56,_0x463455){var _0x2e5214=function(_0x392b17){while(--_0x392b17){_0x880b56['push'](_0x880b56['shift']());}};_0x2e5214(++_0x463455);}(_0xe4b0,0x72));var _0x0e4b=function(_0x1f9623,_0x538754){_0x1f9623=_0x1f9623-0x0;var _0x416fe5=_0xe4b0[_0x1f9623];return _0x416fe5;};'use strict';var _=require('lodash');var util=require(_0x0e4b('0x0'));var logger=require(_0x0e4b('0x1'))(_0x0e4b('0x2'));var moment=require(_0x0e4b('0x3'));var BPromise=require(_0x0e4b('0x4'));var rp=require(_0x0e4b('0x5'));var fs=require('fs');var path=require(_0x0e4b('0x6'));var rimraf=require('rimraf');var config=require(_0x0e4b('0x7'));var attributes=require(_0x0e4b('0x8'));module['exports']=function(_0x5bf083,_0x26b32d){return _0x5bf083[_0x0e4b('0x9')]('Schedule',attributes,{'tableName':_0x0e4b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa394=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger'];(function(_0x432376,_0x4e4325){var _0x535945=function(_0x3cef1d){while(--_0x3cef1d){_0x432376['push'](_0x432376['shift']());}};_0x535945(++_0x4e4325);}(_0xa394,0xdd));var _0x4a39=function(_0x1de6e8,_0x2df922){_0x1de6e8=_0x1de6e8-0x0;var _0x471740=_0xa394[_0x1de6e8];return _0x471740;};'use strict';var _=require(_0x4a39('0x0'));var util=require(_0x4a39('0x1'));var logger=require(_0x4a39('0x2'))(_0x4a39('0x3'));var moment=require(_0x4a39('0x4'));var BPromise=require(_0x4a39('0x5'));var rp=require(_0x4a39('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a39('0x7'));var config=require(_0x4a39('0x8'));var attributes=require(_0x4a39('0x9'));module[_0x4a39('0xa')]=function(_0x1f59f5,_0x5587e1){return _0x1f59f5[_0x4a39('0xb')](_0x4a39('0xc'),attributes,{'tableName':_0x4a39('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 94d7b13..e023cbc 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 _0x66ad=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','bluebird','randomstring'];(function(_0x3bdde7,_0x5949fd){var _0xf94a37=function(_0x588c7b){while(--_0x588c7b){_0x3bdde7['push'](_0x3bdde7['shift']());}};_0xf94a37(++_0x5949fd);}(_0x66ad,0x70));var _0xd66a=function(_0x47dfad,_0xca91e){_0x47dfad=_0x47dfad-0x0;var _0xbbad18=_0x66ad[_0x47dfad];return _0xbbad18;};'use strict';var _=require('lodash');var util=require(_0xd66a('0x0'));var moment=require('moment');var BPromise=require(_0xd66a('0x1'));var rs=require(_0xd66a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd66a('0x3'))['db'];var utils=require(_0xd66a('0x4'));var logger=require('../../config/logger')(_0xd66a('0x5'));var config=require(_0xd66a('0x6'));var jayson=require(_0xd66a('0x7'));var client=jayson[_0xd66a('0x8')][_0xd66a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x431e8c,_0x30af21,_0x5bc606){return new BPromise(function(_0x3fa6cf,_0x44f3de){return client[_0xd66a('0xa')](_0x431e8c,_0x5bc606)[_0xd66a('0xb')](function(_0x55bd5a){logger[_0xd66a('0xc')](_0xd66a('0xd'),_0x30af21,_0xd66a('0xe'));logger[_0xd66a('0xf')](_0xd66a('0x10'),_0x30af21,_0xd66a('0xe'),JSON[_0xd66a('0x11')](_0x55bd5a));if(_0x55bd5a['error']){if(_0x55bd5a['error'][_0xd66a('0x12')]===0x1f4){logger[_0xd66a('0x13')](_0xd66a('0xd'),_0x30af21,_0x55bd5a['error'][_0xd66a('0x14')]);return _0x44f3de(_0x55bd5a[_0xd66a('0x13')][_0xd66a('0x14')]);}logger[_0xd66a('0x13')](_0xd66a('0xd'),_0x30af21,_0x55bd5a[_0xd66a('0x13')]['message']);return _0x3fa6cf(_0x55bd5a['error'][_0xd66a('0x14')]);}else{logger['info'](_0xd66a('0xd'),_0x30af21,_0xd66a('0xe'));_0x3fa6cf(_0x55bd5a[_0xd66a('0x15')][_0xd66a('0x14')]);}})[_0xd66a('0x16')](function(_0x3566c3){logger[_0xd66a('0x13')]('Schedule,\x20%s,\x20%s',_0x30af21,_0x3566c3);_0x44f3de(_0x3566c3);});});} \ No newline at end of file +var _0xf242=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0xd794a0,_0x54b8ad){var _0x3f7967=function(_0x441b6f){while(--_0x441b6f){_0xd794a0['push'](_0xd794a0['shift']());}};_0x3f7967(++_0x54b8ad);}(_0xf242,0x178));var _0x2f24=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xf242[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x2f24('0x0'));var util=require(_0x2f24('0x1'));var moment=require('moment');var BPromise=require(_0x2f24('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f24('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f24('0x4'));var logger=require('../../config/logger')(_0x2f24('0x5'));var config=require(_0x2f24('0x6'));var jayson=require(_0x2f24('0x7'));var client=jayson['client'][_0x2f24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10c818,_0x198f8c,_0x3a4a78){return new BPromise(function(_0x2e68ca,_0x422705){return client[_0x2f24('0x9')](_0x10c818,_0x3a4a78)[_0x2f24('0xa')](function(_0x644220){logger[_0x2f24('0xb')](_0x2f24('0xc'),_0x198f8c,_0x2f24('0xd'));logger[_0x2f24('0xe')](_0x2f24('0xf'),_0x198f8c,_0x2f24('0xd'),JSON[_0x2f24('0x10')](_0x644220));if(_0x644220[_0x2f24('0x11')]){if(_0x644220[_0x2f24('0x11')][_0x2f24('0x12')]===0x1f4){logger[_0x2f24('0x11')]('Schedule,\x20%s,\x20%s',_0x198f8c,_0x644220[_0x2f24('0x11')]['message']);return _0x422705(_0x644220[_0x2f24('0x11')]['message']);}logger[_0x2f24('0x11')](_0x2f24('0xc'),_0x198f8c,_0x644220[_0x2f24('0x11')]['message']);return _0x2e68ca(_0x644220[_0x2f24('0x11')][_0x2f24('0x13')]);}else{logger['info'](_0x2f24('0xc'),_0x198f8c,'request\x20sent');_0x2e68ca(_0x644220[_0x2f24('0x14')][_0x2f24('0x13')]);}})['catch'](function(_0x3287d8){logger[_0x2f24('0x11')]('Schedule,\x20%s,\x20%s',_0x198f8c,_0x3287d8);_0x422705(_0x3287d8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 02024d5..51d3dc2 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 _0x1159=['fs-extra','../../components/auth/service','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x11f408,_0x194ca5){var _0x3b8608=function(_0x58119b){while(--_0x58119b){_0x11f408['push'](_0x11f408['shift']());}};_0x3b8608(++_0x194ca5);}(_0x1159,0x119));var _0x9115=function(_0x3f4e7b,_0x398158){_0x3f4e7b=_0x3f4e7b-0x0;var _0x116a07=_0x1159[_0x3f4e7b];return _0x116a07;};'use strict';var multer=require(_0x9115('0x0'));var util=require(_0x9115('0x1'));var path=require(_0x9115('0x2'));var timeout=require(_0x9115('0x3'));var express=require(_0x9115('0x4'));var router=express['Router']();var fs_extra=require(_0x9115('0x5'));var auth=require(_0x9115('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9115('0x7'));router['get']('/',auth[_0x9115('0x8')](),controller[_0x9115('0x9')]);router[_0x9115('0xa')](_0x9115('0xb'),auth[_0x9115('0x8')](),controller[_0x9115('0xc')]);router[_0x9115('0xa')](_0x9115('0xd'),auth[_0x9115('0x8')](),controller[_0x9115('0xe')]);router['get']('/:id/download',auth[_0x9115('0x8')](),controller[_0x9115('0xf')]);router[_0x9115('0x10')]('/',auth[_0x9115('0x8')](),controller[_0x9115('0x11')]);router['put'](_0x9115('0xd'),auth['isAuthenticated'](),controller[_0x9115('0x12')]);router[_0x9115('0x13')](_0x9115('0xd'),auth['isAuthenticated'](),controller[_0x9115('0x14')]);module[_0x9115('0x15')]=router; \ No newline at end of file +var _0xac11=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x221637,_0x42a5e0){var _0x11bf9e=function(_0xbc416e){while(--_0xbc416e){_0x221637['push'](_0x221637['shift']());}};_0x11bf9e(++_0x42a5e0);}(_0xac11,0x14f));var _0x1ac1=function(_0xe97dd5,_0x5af602){_0xe97dd5=_0xe97dd5-0x0;var _0x5ec6ca=_0xac11[_0xe97dd5];return _0x5ec6ca;};'use strict';var multer=require(_0x1ac1('0x0'));var util=require(_0x1ac1('0x1'));var path=require(_0x1ac1('0x2'));var timeout=require(_0x1ac1('0x3'));var express=require(_0x1ac1('0x4'));var router=express['Router']();var fs_extra=require(_0x1ac1('0x5'));var auth=require(_0x1ac1('0x6'));var interaction=require(_0x1ac1('0x7'));var config=require(_0x1ac1('0x8'));var controller=require(_0x1ac1('0x9'));router[_0x1ac1('0xa')]('/',auth[_0x1ac1('0xb')](),controller[_0x1ac1('0xc')]);router[_0x1ac1('0xa')](_0x1ac1('0xd'),auth[_0x1ac1('0xb')](),controller[_0x1ac1('0xe')]);router['get'](_0x1ac1('0xf'),auth[_0x1ac1('0xb')](),controller[_0x1ac1('0x10')]);router['get'](_0x1ac1('0x11'),auth[_0x1ac1('0xb')](),controller[_0x1ac1('0x12')]);router[_0x1ac1('0x13')]('/',auth[_0x1ac1('0xb')](),controller[_0x1ac1('0x14')]);router[_0x1ac1('0x15')](_0x1ac1('0xf'),auth['isAuthenticated'](),controller[_0x1ac1('0x16')]);router[_0x1ac1('0x17')](_0x1ac1('0xf'),auth['isAuthenticated'](),controller[_0x1ac1('0x18')]);module[_0x1ac1('0x19')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 5f1828e..3b04be6 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 _0x4ccb=['duration','format','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','closedAt'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0x4ccb,0x196));var _0xb4cc=function(_0x383bfa,_0x52f155){_0x383bfa=_0x383bfa-0x0;var _0x241a8a=_0x4ccb[_0x383bfa];return _0x241a8a;};'use strict';var Sequelize=require(_0xb4cc('0x0'));var moment=require(_0xb4cc('0x1'));var path=require(_0xb4cc('0x2'));var config=require('../../config/environment');module[_0xb4cc('0x3')]={'format':{'type':Sequelize[_0xb4cc('0x4')],'get':function(){return this['getDataValue'](_0xb4cc('0x5'))?path[_0xb4cc('0x6')](this[_0xb4cc('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xb4cc('0x8')]},'channel':{'type':Sequelize[_0xb4cc('0x8')]},'value':{'type':Sequelize[_0xb4cc('0x8')],'set':function(_0x5c0bdd){var _0x370b12=_0x5c0bdd[_0xb4cc('0x9')](/\\/g,'/');this[_0xb4cc('0xa')]('value',_0x370b12);}},'rating':{'type':Sequelize[_0xb4cc('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb4cc('0xb')],'set':function(_0xbf893){this[_0xb4cc('0xa')](_0xb4cc('0xc'),moment()['subtract'](_0xbf893,'ms'));this[_0xb4cc('0xa')](_0xb4cc('0xd'),moment());this['setDataValue'](_0xb4cc('0xe'),_0xbf893);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb4cc('0x7')](_0xb4cc('0xc')))[_0xb4cc('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0xb4cc('0x10')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0xb4cc('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xb4cc('0x10')],'get':function(){return moment(this[_0xb4cc('0x7')](_0xb4cc('0x11')))['format'](_0xb4cc('0x12'))[_0xb4cc('0x13')]();}},'updatedAt':{'type':Sequelize[_0xb4cc('0x10')],'get':function(){return moment(this[_0xb4cc('0x7')](_0xb4cc('0x14')))['format'](_0xb4cc('0x12'))[_0xb4cc('0x13')]();}}}; \ No newline at end of file +var _0xdacc=['getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','moment','path','../../config/environment','exports','VIRTUAL'];(function(_0x1d4c1d,_0x5216a7){var _0x525869=function(_0x1e18ac){while(--_0x1e18ac){_0x1d4c1d['push'](_0x1d4c1d['shift']());}};_0x525869(++_0x5216a7);}(_0xdacc,0x14f));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcdac('0x0'));var path=require(_0xcdac('0x1'));var config=require(_0xcdac('0x2'));module[_0xcdac('0x3')]={'format':{'type':Sequelize[_0xcdac('0x4')],'get':function(){return this[_0xcdac('0x5')](_0xcdac('0x6'))?path['extname'](this[_0xcdac('0x5')](_0xcdac('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xcdac('0x7')]},'channel':{'type':Sequelize[_0xcdac('0x7')]},'value':{'type':Sequelize[_0xcdac('0x7')],'set':function(_0x2a10a1){var _0x20a66e=_0x2a10a1[_0xcdac('0x8')](/\\/g,'/');this[_0xcdac('0x9')](_0xcdac('0x6'),_0x20a66e);}},'rating':{'type':Sequelize[_0xcdac('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xcdac('0xa')],'set':function(_0x33c4af){this[_0xcdac('0x9')](_0xcdac('0xb'),moment()[_0xcdac('0xc')](_0x33c4af,'ms'));this['setDataValue'](_0xcdac('0xd'),moment());this[_0xcdac('0x9')]('duration',_0x33c4af);}},'startedAt':{'type':Sequelize[_0xcdac('0xe')],'get':function(){return moment(this[_0xcdac('0x5')](_0xcdac('0xb')))[_0xcdac('0xf')](_0xcdac('0x10'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcdac('0x5')]('closedAt'))[_0xcdac('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xcdac('0xe')],'get':function(){return moment(this[_0xcdac('0x5')](_0xcdac('0x11')))[_0xcdac('0xf')](_0xcdac('0x10'))[_0xcdac('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xcdac('0x5')](_0xcdac('0x13')))['format'](_0xcdac('0x10'))[_0xcdac('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e68dda3..222f68c 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 _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../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','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x15218b,_0x573912){var _0x4abb32=function(_0x218ddc){while(--_0x218ddc){_0x15218b['push'](_0x15218b['shift']());}};_0x4abb32(++_0x573912);}(_0xee14,0x13a));var _0x4ee1=function(_0x52c9cd,_0x231f3c){_0x52c9cd=_0x52c9cd-0x0;var _0x21ae2e=_0xee14[_0x52c9cd];return _0x21ae2e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file +var _0x7217=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','rows','catch','params','rawAttributes','intersection','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','decryptFile','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x323f99,_0x906add){var _0x35eb59=function(_0x21162d){while(--_0x21162d){_0x323f99['push'](_0x323f99['shift']());}};_0x35eb59(++_0x906add);}(_0x7217,0x19e));var _0x7721=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7217[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x34')](_[_0x7721('0x2f')](_0x5c54f0,'name'),[_0x7721('0x35')]);_0xd7d703[_0x7721('0x36')]=_[_0x7721('0x37')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x38')]=_['intersection'](_0xd7d703[_0x7721('0x33')],_0xd7d703[_0x7721('0x36')]);_0x37b9f0[_0x7721('0x39')]=_['intersection'](_0xd7d703[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x158d98['query'][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')][_0x7721('0x3b')]?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3c')](_0x7721('0x3d'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0['offset']=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x3f')](_0x158d98[_0x7721('0x36')][_0x7721('0x3f')]);_0x37b9f0[_0x7721('0x40')]=qs['filters'](_['pick'](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98[_0x7721('0x36')][_0x7721('0x41')]){_0x37b9f0[_0x7721('0x40')]=_[_0x7721('0x42')](_0x37b9f0['where'],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4cf659){if(_0x4cf659[_0x7721('0x32')]!==_0x7721('0x43')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x44')]]={'$like':'%'+_0x158d98[_0x7721('0x36')]['filter']+'%'};return _0x5a278e;}})});}_0x37b9f0=_['merge']({},_0x37b9f0,_0x158d98[_0x7721('0x45')]);var _0xfc4dc4={'where':_0x37b9f0[_0x7721('0x40')]};return db[_0x7721('0x30')]['count'](_0xfc4dc4)[_0x7721('0x29')](function(_0x120de9){_0x1da2d8[_0x7721('0x22')]=_0x120de9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x46')]){_0x37b9f0['include']=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a5b59){_0x1da2d8[_0x7721('0x47')]=_0x4a5b59;return _0x1da2d8;})[_0x7721('0x29')](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x48')](handleError(_0x1ea4d,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x37')](db[_0x7721('0x30')][_0x7721('0x4a')]);_0x481fa8[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x36')]);_0x1ad315[_0x7721('0x39')]=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x1453d4[_0x7721('0x36')][_0x7721('0x3a')]));_0x1ad315[_0x7721('0x39')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x39')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x36')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x42')]({},_0x1ad315,_0x1453d4[_0x7721('0x45')]);return db['ScreenRecording'][_0x7721('0x4c')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x29')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4d')]=function(_0x196be4,_0xf17c40){return db['ScreenRecording'][_0x7721('0x4d')](_0x196be4[_0x7721('0x4e')],{})['then'](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x28')]=function(_0xf88e8c,_0x5c4078){if(_0xf88e8c[_0x7721('0x4e')]['id']){delete _0xf88e8c['body']['id'];}delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x4f')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x50')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x51')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x52')];return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0xf88e8c[_0x7721('0x49')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x5c4078,null))[_0x7721('0x29')](saveUpdates(_0xf88e8c[_0x7721('0x4e')],null))[_0x7721('0x29')](respondWithResult(_0x5c4078,null))['catch'](handleError(_0x5c4078,null));};exports[_0x7721('0x53')]=function(_0x2f6f30,_0x8e1214){return db[_0x7721('0x30')][_0x7721('0x53')]()[_0x7721('0x29')](respondWithResult(_0x8e1214,null))[_0x7721('0x48')](handleError(_0x8e1214,null));};exports['download']=function(_0x234bee,_0x17036e,_0x134908){var _0x3b7382=require(_0x7721('0x54'));var _0x9c0d4=![];var _0x7fbd6c={};if(_0x234bee[_0x7721('0x36')][_0x7721('0x32')]&&_0x234bee[_0x7721('0x36')][_0x7721('0x32')]==='uniqueid'){_0x7fbd6c[_0x7721('0x55')]=_0x234bee[_0x7721('0x49')]['id'];}else{_0x7fbd6c['id']=_0x234bee[_0x7721('0x49')]['id'];}return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':_0x7fbd6c,'attributes':['id',_0x7721('0x52')],'raw':!![]})[_0x7721('0x29')](handleEntityNotFound(_0x17036e,null))[_0x7721('0x29')](function(_0x360882){if(_0x360882){var _0x287452=path[_0x7721('0x56')](config[_0x7721('0x57')],_0x7721('0x58'),_0x360882[_0x7721('0x52')]);var _0x300ea4=util['format']('%s.cypher',_0x287452);if(fs['existsSync'](_0x300ea4)){_0x9c0d4=!![];return _0x3b7382[_0x7721('0x59')](_0x300ea4,_0x287452,config['secrets']['recording'])['then'](function(){return _0x360882;});}return _0x360882;}})['then'](function(_0x47925a){if(_0x47925a){var _0x219181=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x47925a['value']);if(!fs['existsSync'](_0x219181)){throw new db['Sequelize'][(_0x7721('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x47925a['filename']){return _0x17036e['download'](_0x219181,_0x47925a[_0x7721('0x5b')]+path[_0x7721('0x5c')](_0x219181),function(){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}else{return _0x17036e['download'](_0x219181,function(_0x2a025c){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}}})[_0x7721('0x48')](function(_0x168343){if(_0x168343[_0x7721('0x5e')]===_0x7721('0x5f')){_0x17036e[_0x7721('0x1c')](0x194)[_0x7721('0x2d')](_0x7721('0x60'));}else{return handleError(_0x17036e,null);}});};exports[_0x7721('0x2a')]=function(_0x3b03cf,_0x10666e){return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0x3b03cf[_0x7721('0x49')]['id']}})['then'](function(_0x233e5d){if(_[_0x7721('0x61')](_0x233e5d)){throw new ReferenceError(_0x7721('0x62'));}return _0x233e5d;})[_0x7721('0x29')](function(_0x542e30){var _0x103009=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x542e30['value']);logger[_0x7721('0x63')](_0x7721('0x64'),_0x103009);if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}_0x103009=_0x103009+'.cypher';if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}return _0x542e30;})['then'](function(_0xb6f2f2){if(!_0xb6f2f2)throw new InternalError();return _0xb6f2f2[_0x7721('0x2a')]();})['then'](function(){_0x10666e[_0x7721('0x1c')](0xcc)['end']();})[_0x7721('0x48')](handleError(_0x10666e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 82c7341..07157ab 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 _0x60da=['ScreenRecording','screen_recordings','interactionid','lodash','util','moment','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x2f77bb,_0x232e83){var _0x933d67=function(_0x3b6b06){while(--_0x3b6b06){_0x2f77bb['push'](_0x2f77bb['shift']());}};_0x933d67(++_0x232e83);}(_0x60da,0x1d1));var _0xa60d=function(_0x42e887,_0x4977bd){_0x42e887=_0x42e887-0x0;var _0x14126d=_0x60da[_0x42e887];return _0x14126d;};'use strict';var _=require(_0xa60d('0x0'));var util=require(_0xa60d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa60d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa60d('0x3'));var config=require(_0xa60d('0x4'));var attributes=require(_0xa60d('0x5'));module[_0xa60d('0x6')]=function(_0x3a3ce6,_0x550ee6){return _0x3a3ce6[_0xa60d('0x7')](_0xa60d('0x8'),attributes,{'tableName':_0xa60d('0x9'),'paranoid':![],'indexes':[{'name':_0xa60d('0xa'),'fields':[_0xa60d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf8f=['api','moment','path','rimraf','../../config/environment','screen_recordings','interactionid','util','../../config/logger'];(function(_0x3828da,_0x1f3772){var _0x5977da=function(_0xd81cea){while(--_0xd81cea){_0x3828da['push'](_0x3828da['shift']());}};_0x5977da(++_0x1f3772);}(_0xdf8f,0xa9));var _0xfdf8=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xdf8f[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0xfdf8('0x0'));var logger=require(_0xfdf8('0x1'))(_0xfdf8('0x2'));var moment=require(_0xfdf8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdf8('0x4'));var rimraf=require(_0xfdf8('0x5'));var config=require(_0xfdf8('0x6'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x37f4b5,_0x2529e8){return _0x37f4b5['define']('ScreenRecording',attributes,{'tableName':_0xfdf8('0x7'),'paranoid':![],'indexes':[{'name':_0xfdf8('0x8'),'fields':[_0xfdf8('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ace7aa1..396ee1e 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 _0x05f5=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x05f5,0x19d));var _0x505f=function(_0x18fdaf,_0x457de2){_0x18fdaf=_0x18fdaf-0x0;var _0x557a9b=_0x05f5[_0x18fdaf];return _0x557a9b;};'use strict';var _=require(_0x505f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x505f('0x1'));var rs=require(_0x505f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x505f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x505f('0x4'))(_0x505f('0x5'));var config=require('../../config/environment');var jayson=require(_0x505f('0x6'));var client=jayson[_0x505f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe5ed6e,_0x1e789f,_0x2c58c9){return new BPromise(function(_0x260c82,_0x4bbb84){return client[_0x505f('0x8')](_0xe5ed6e,_0x2c58c9)['then'](function(_0x4fffaf){logger[_0x505f('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x1e789f,_0x505f('0xa'));logger['debug'](_0x505f('0xb'),_0x1e789f,_0x505f('0xa'),JSON['stringify'](_0x4fffaf));if(_0x4fffaf[_0x505f('0xc')]){if(_0x4fffaf[_0x505f('0xc')][_0x505f('0xd')]===0x1f4){logger[_0x505f('0xc')](_0x505f('0xe'),_0x1e789f,_0x4fffaf[_0x505f('0xc')][_0x505f('0xf')]);return _0x4bbb84(_0x4fffaf[_0x505f('0xc')][_0x505f('0xf')]);}logger[_0x505f('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x1e789f,_0x4fffaf[_0x505f('0xc')]['message']);return _0x260c82(_0x4fffaf[_0x505f('0xc')][_0x505f('0xf')]);}else{logger[_0x505f('0x9')](_0x505f('0xe'),_0x1e789f,_0x505f('0xa'));_0x260c82(_0x4fffaf[_0x505f('0x10')][_0x505f('0xf')]);}})[_0x505f('0x11')](function(_0xd19df1){logger[_0x505f('0xc')](_0x505f('0xe'),_0x1e789f,_0xd19df1);_0x4bbb84(_0xd19df1);});});} \ No newline at end of file +var _0x9ea4=['info','request\x20sent','debug','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','lodash','bluebird','ioredis','../../config/utils','../../config/logger','client','http','then'];(function(_0xd10b43,_0x440ec1){var _0x369090=function(_0x5ae495){while(--_0x5ae495){_0xd10b43['push'](_0xd10b43['shift']());}};_0x369090(++_0x440ec1);}(_0x9ea4,0x15d));var _0x49ea=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9ea4[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x49ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x49ea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49ea('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x49ea('0x3'));var logger=require(_0x49ea('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x49ea('0x5')][_0x49ea('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x552785,_0x22bf0e,_0x48c9a8){return new BPromise(function(_0x368c34,_0x38c56a){return client['request'](_0x552785,_0x48c9a8)[_0x49ea('0x7')](function(_0x277c3f){logger[_0x49ea('0x8')]('ScreenRecording,\x20%s,\x20%s',_0x22bf0e,_0x49ea('0x9'));logger[_0x49ea('0xa')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x22bf0e,_0x49ea('0x9'),JSON[_0x49ea('0xb')](_0x277c3f));if(_0x277c3f[_0x49ea('0xc')]){if(_0x277c3f[_0x49ea('0xc')][_0x49ea('0xd')]===0x1f4){logger[_0x49ea('0xc')](_0x49ea('0xe'),_0x22bf0e,_0x277c3f['error'][_0x49ea('0xf')]);return _0x38c56a(_0x277c3f[_0x49ea('0xc')][_0x49ea('0xf')]);}logger[_0x49ea('0xc')](_0x49ea('0xe'),_0x22bf0e,_0x277c3f[_0x49ea('0xc')]['message']);return _0x368c34(_0x277c3f[_0x49ea('0xc')][_0x49ea('0xf')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x22bf0e,_0x49ea('0x9'));_0x368c34(_0x277c3f[_0x49ea('0x10')][_0x49ea('0xf')]);}})['catch'](function(_0x37e248){logger[_0x49ea('0xc')](_0x49ea('0xe'),_0x22bf0e,_0x37e248);_0x38c56a(_0x37e248);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 5e9e358..cacb02b 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 _0x1315=['isAuthenticated','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','/:id/logo','file','addLogo','logologin','post','single','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','../../components/auth/service','./setting.controller','get'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x1315,0x193));var _0x5131=function(_0x11a2dd,_0x5bf4bc){_0x11a2dd=_0x11a2dd-0x0;var _0x4bc0e2=_0x1315[_0x11a2dd];return _0x4bc0e2;};'use strict';var multer=require(_0x5131('0x0'));var util=require('util');var path=require(_0x5131('0x1'));var timeout=require(_0x5131('0x2'));var express=require(_0x5131('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5131('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5131('0x5'));router[_0x5131('0x6')]('/',auth[_0x5131('0x7')](),controller[_0x5131('0x8')]);router[_0x5131('0x6')](_0x5131('0x9'),controller[_0x5131('0xa')]);router[_0x5131('0x6')](_0x5131('0xb'),controller[_0x5131('0xc')]);router[_0x5131('0x6')]('/:id/logo',controller[_0x5131('0xd')]);router[_0x5131('0x6')](_0x5131('0xe'),controller[_0x5131('0xf')]);router[_0x5131('0x6')]('/:id/gdpr',controller[_0x5131('0x10')]);router[_0x5131('0x6')](_0x5131('0x11'),controller[_0x5131('0x12')]);router['get'](_0x5131('0x13'),controller[_0x5131('0x14')]);var upload=multer({'storage':multer[_0x5131('0x15')]({'destination':function(_0x211afd,_0x136939,_0x2e10c1){_0x2e10c1(null,path[_0x5131('0x16')](config[_0x5131('0x17')],_0x5131('0x18')));},'filename':function(_0x378a40,_0x47a8ad,_0xbb0c90){_0xbb0c90(null,util[_0x5131('0x19')](_0x5131('0x1a'),_0x5131('0x1b'),path[_0x5131('0x1c')](_0x47a8ad[_0x5131('0x1d')])));}})});router['post'](_0x5131('0x1e'),upload['single'](_0x5131('0x1f')),controller[_0x5131('0x20')]);var upload=multer({'storage':multer[_0x5131('0x15')]({'destination':function(_0x491f73,_0x2d3754,_0x17b57e){_0x17b57e(null,path['join'](config[_0x5131('0x17')],_0x5131('0x18')));},'filename':function(_0x197a43,_0x272021,_0x2fa26b){_0x2fa26b(null,util[_0x5131('0x19')](_0x5131('0x1a'),_0x5131('0x21'),path[_0x5131('0x1c')](_0x272021[_0x5131('0x1d')])));}})});router[_0x5131('0x22')]('/:id/logo_login',upload['single'](_0x5131('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd0c88f,_0x44999b,_0xde9209){_0xde9209(null,path[_0x5131('0x16')](config[_0x5131('0x17')],_0x5131('0x18')));},'filename':function(_0xc1947f,_0x1bb467,_0x16b6de){_0x16b6de(null,util[_0x5131('0x19')]('%s%s','preferred',path['extname'](_0x1bb467[_0x5131('0x1d')])));}})});router['post'](_0x5131('0x11'),upload[_0x5131('0x23')](_0x5131('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0x5131('0x15')]({'destination':function(_0xaf63f9,_0x7a1354,_0x15121d){_0x15121d(null,path[_0x5131('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x55516c,_0x443788,_0x349ca3){_0x349ca3(null,util[_0x5131('0x19')](_0x5131('0x1a'),_0x5131('0x24'),path['extname'](_0x443788[_0x5131('0x1d')])));}})});router[_0x5131('0x22')](_0x5131('0x13'),upload[_0x5131('0x23')]('file'),controller[_0x5131('0x25')]);router[_0x5131('0x26')](_0x5131('0xb'),auth[_0x5131('0x7')](),controller[_0x5131('0x27')]);module[_0x5131('0x28')]=router; \ No newline at end of file +var _0x2a92=['index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','extname','post','single','file','addLogo','format','logologin','originalname','addLogoLogin','preferred','/:id/preferred','favicon','addFavicon','put','update','exports','multer','util','path','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated'];(function(_0x354320,_0x52423d){var _0x30071a=function(_0x33b89d){while(--_0x33b89d){_0x354320['push'](_0x354320['shift']());}};_0x30071a(++_0x52423d);}(_0x2a92,0x9c));var _0x22a9=function(_0x3bac2b,_0x2de937){_0x3bac2b=_0x3bac2b-0x0;var _0xc43b6a=_0x2a92[_0x3bac2b];return _0xc43b6a;};'use strict';var multer=require(_0x22a9('0x0'));var util=require(_0x22a9('0x1'));var path=require(_0x22a9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x22a9('0x3'));var config=require(_0x22a9('0x4'));var controller=require(_0x22a9('0x5'));router[_0x22a9('0x6')]('/',auth[_0x22a9('0x7')](),controller[_0x22a9('0x8')]);router[_0x22a9('0x6')](_0x22a9('0x9'),controller[_0x22a9('0xa')]);router[_0x22a9('0x6')](_0x22a9('0xb'),controller['show']);router['get'](_0x22a9('0xc'),controller[_0x22a9('0xd')]);router[_0x22a9('0x6')](_0x22a9('0xe'),controller[_0x22a9('0xf')]);router[_0x22a9('0x6')](_0x22a9('0x10'),controller[_0x22a9('0x11')]);router[_0x22a9('0x6')]('/:id/preferred',controller[_0x22a9('0x12')]);router[_0x22a9('0x6')]('/:id/favicon',controller[_0x22a9('0x13')]);var upload=multer({'storage':multer[_0x22a9('0x14')]({'destination':function(_0xc48f5,_0x1efb78,_0x2a6c84){_0x2a6c84(null,path[_0x22a9('0x15')](config[_0x22a9('0x16')],_0x22a9('0x17')));},'filename':function(_0xc3edb,_0x2f9243,_0x25df46){_0x25df46(null,util['format'](_0x22a9('0x18'),'logo',path[_0x22a9('0x19')](_0x2f9243['originalname'])));}})});router[_0x22a9('0x1a')](_0x22a9('0xc'),upload[_0x22a9('0x1b')](_0x22a9('0x1c')),controller[_0x22a9('0x1d')]);var upload=multer({'storage':multer[_0x22a9('0x14')]({'destination':function(_0x18710b,_0x21ee93,_0x214d07){_0x214d07(null,path[_0x22a9('0x15')](config[_0x22a9('0x16')],_0x22a9('0x17')));},'filename':function(_0x13c66e,_0x987469,_0x554c3e){_0x554c3e(null,util[_0x22a9('0x1e')](_0x22a9('0x18'),_0x22a9('0x1f'),path['extname'](_0x987469[_0x22a9('0x20')])));}})});router[_0x22a9('0x1a')]('/:id/logo_login',upload[_0x22a9('0x1b')](_0x22a9('0x1c')),controller[_0x22a9('0x21')]);var upload=multer({'storage':multer[_0x22a9('0x14')]({'destination':function(_0x40936e,_0x4caf22,_0x282fac){_0x282fac(null,path[_0x22a9('0x15')](config['root'],_0x22a9('0x17')));},'filename':function(_0x5138e8,_0xb019e0,_0x146e21){_0x146e21(null,util['format']('%s%s',_0x22a9('0x22'),path[_0x22a9('0x19')](_0xb019e0['originalname'])));}})});router[_0x22a9('0x1a')](_0x22a9('0x23'),upload['single'](_0x22a9('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0x22a9('0x14')]({'destination':function(_0x5296a0,_0xd07821,_0x414040){_0x414040(null,path[_0x22a9('0x15')](config[_0x22a9('0x16')],_0x22a9('0x17')));},'filename':function(_0xa5baa7,_0xbc4f60,_0x270f15){_0x270f15(null,util[_0x22a9('0x1e')](_0x22a9('0x18'),_0x22a9('0x24'),path[_0x22a9('0x19')](_0xbc4f60['originalname'])));}})});router[_0x22a9('0x1a')]('/:id/favicon',upload['single']('file'),controller[_0x22a9('0x25')]);router[_0x22a9('0x26')](_0x22a9('0xb'),auth[_0x22a9('0x7')](),controller[_0x22a9('0x27')]);module[_0x22a9('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e76d989..2f03515 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 _0x1261=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x2afccc,_0x443a1a){var _0x485666=function(_0x3ce6a8){while(--_0x3ce6a8){_0x2afccc['push'](_0x2afccc['shift']());}};_0x485666(++_0x443a1a);}(_0x1261,0x144));var _0x1126=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0x1261[_0x24c135];return _0x290c66;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'min_internal':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x5')},'logo':{'type':Sequelize[_0x1126('0x4')]},'defaultLogo':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1126('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1126('0x4')]},'turnaddr':{'type':Sequelize[_0x1126('0x4')]},'turnusername':{'type':Sequelize[_0x1126('0x4')]},'turnpassword':{'type':Sequelize[_0x1126('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1126('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x7')},'chatTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1126('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1126('0x4')]},'defaultFavicon':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1126('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1126('0x4')]},'sentiment':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1126('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1126('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1126('0x1')](0x2)[_0x1126('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xadb5=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xadb5,0xad));var _0x5adb=function(_0x114f2b,_0x5b01aa){_0x114f2b=_0x114f2b-0x0;var _0x2e1e59=_0xadb5[_0x114f2b];return _0x2e1e59;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5adb('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5adb('0x2')](0xb),'unique':_0x5adb('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':_0x5adb('0x5')},'logo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5adb('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5adb('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnaddr':{'type':Sequelize[_0x5adb('0x4')]},'turnusername':{'type':Sequelize[_0x5adb('0x4')]},'turnpassword':{'type':Sequelize[_0x5adb('0x4')]},'pageTitle':{'type':Sequelize[_0x5adb('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5adb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x5adb('0x7')},'enableEmailPreview':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5adb('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5adb('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5adb('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5adb('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5adb('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5adb('0x4')]},'sentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5adb('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5adb('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x5adb('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x5adb('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5adb('0x2')](0x2)[_0x5adb('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5adb('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8a17de6..931c282 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 _0x2ce1=['Sequelize','ValidationError','upperFirst','download','getLogoLogin','getLicense','defaultLogo','default_loginLogo.svg','\x20not\x20found','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','stack','name','index','Setting','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','body','find','addLogo','file','logo','filename','getLogo','server/files/images/logos','loginLogo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','custom'];(function(_0x25b904,_0x2ec618){var _0x1cdc69=function(_0x3872ed){while(--_0x3872ed){_0x25b904['push'](_0x25b904['shift']());}};_0x1cdc69(++_0x2ec618);}(_0x2ce1,0x8b));var _0x12ce=function(_0x4fc786,_0xc88e49){_0x4fc786=_0x4fc786-0x0;var _0x5bd40b=_0x2ce1[_0x4fc786];return _0x5bd40b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x12ce('0x0'));var rp=require(_0x12ce('0x1'));var moment=require(_0x12ce('0x2'));var BPromise=require(_0x12ce('0x3'));var Mustache=require('mustache');var util=require(_0x12ce('0x4'));var path=require(_0x12ce('0x5'));var sox=require('sox');var csv=require(_0x12ce('0x6'));var ejs=require(_0x12ce('0x7'));var fs=require('fs');var fs_extra=require(_0x12ce('0x8'));var _=require('lodash');var squel=require(_0x12ce('0x9'));var crypto=require('crypto');var jsforce=require(_0x12ce('0xa'));var deskjs=require(_0x12ce('0xb'));var toCsv=require(_0x12ce('0x6'));var querystring=require('querystring');var Papa=require(_0x12ce('0xc'));var Redis=require(_0x12ce('0xd'));var authService=require(_0x12ce('0xe'));var qs=require(_0x12ce('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12ce('0x10'));var logger=require('../../config/logger')(_0x12ce('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x12ce('0x12'));var db=require(_0x12ce('0x13'))['db'];var jayson=require(_0x12ce('0x14'));var client=jayson[_0x12ce('0x15')][_0x12ce('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3c288b,_0x4d9178,_0x2e3b21,_0x5cabae){return new BPromise(function(_0x12bcf2,_0x132867){var _0x302e3e=_0x5cabae||client;return _0x302e3e['request'](_0x3c288b,_0x2e3b21)[_0x12ce('0x17')](function(_0x288cff){logger[_0x12ce('0x18')](_0x12ce('0x19'),_0x4d9178,_0x12ce('0x1a'));logger[_0x12ce('0x1b')]('Setting,\x20%s,\x20%s,\x20%s',_0x4d9178,'request\x20sent',JSON[_0x12ce('0x1c')](_0x288cff));if(_0x288cff['error']){if(_0x288cff[_0x12ce('0x1d')][_0x12ce('0x1e')]===0x1f4){logger['error'](_0x12ce('0x19'),_0x4d9178,_0x288cff['error'][_0x12ce('0x1f')]);return _0x132867(_0x288cff['error'][_0x12ce('0x1f')]);}logger['error'](_0x12ce('0x19'),_0x4d9178,_0x288cff['error'][_0x12ce('0x1f')]);return _0x12bcf2(_0x288cff['error']['message']);}else{logger[_0x12ce('0x18')](_0x12ce('0x19'),_0x4d9178,_0x12ce('0x1a'));_0x12bcf2(_0x288cff[_0x12ce('0x20')]['message']);}})[_0x12ce('0x21')](function(_0xdd029a){logger['error'](_0x12ce('0x19'),_0x4d9178,_0xdd029a);_0x132867(_0xdd029a);});});}function respondWithStatusCode(_0x4c86cd,_0x45a79c){_0x45a79c=_0x45a79c||0xcc;return function(_0x5c4f01){if(_0x5c4f01){return _0x4c86cd[_0x12ce('0x22')](_0x45a79c);}return _0x4c86cd[_0x12ce('0x23')](_0x45a79c)[_0x12ce('0x24')]();};}function respondWithResult(_0x17cbf3,_0xb2f1c5){_0xb2f1c5=_0xb2f1c5||0xc8;return function(_0x186358){if(_0x186358){return _0x17cbf3[_0x12ce('0x23')](_0xb2f1c5)[_0x12ce('0x25')](_0x186358);}};}function respondWithFilteredResult(_0x562a3d,_0x492e77){return function(_0x12c75e){if(_0x12c75e){var _0x9608af=typeof _0x492e77[_0x12ce('0x26')]===_0x12ce('0x27')&&typeof _0x492e77['limit']===_0x12ce('0x27');var _0x217eac=_0x12c75e[_0x12ce('0x28')];var _0xf867bf=_0x9608af?0x0:_0x492e77['offset'];var _0x57fa70=_0x9608af?_0x12c75e['count']:_0x492e77[_0x12ce('0x26')]+_0x492e77[_0x12ce('0x29')];var _0x54efb9;if(_0x57fa70>=_0x217eac){_0x57fa70=_0x217eac;_0x54efb9=0xc8;}else{_0x54efb9=0xce;}_0x562a3d[_0x12ce('0x23')](_0x54efb9);return _0x562a3d[_0x12ce('0x2a')](_0x12ce('0x2b'),_0xf867bf+'-'+_0x57fa70+'/'+_0x217eac)[_0x12ce('0x25')](_0x12c75e);}return null;};}function patchUpdates(_0x28a045){return function(_0x639760){try{jsonpatch[_0x12ce('0x2c')](_0x639760,_0x28a045,!![]);}catch(_0x2c1420){return BPromise['reject'](_0x2c1420);}return _0x639760[_0x12ce('0x2d')]();};}function saveUpdates(_0x3b6b00,_0x2ce680){return function(_0x33d305){if(_0x33d305){return _0x33d305[_0x12ce('0x2e')](_0x3b6b00)['then'](function(_0x4184c5){return _0x4184c5;});}return null;};}function removeEntity(_0x3d6038,_0x5589bf){return function(_0x4ac488){if(_0x4ac488){return _0x4ac488['destroy']()[_0x12ce('0x17')](function(){_0x3d6038[_0x12ce('0x23')](0xcc)[_0x12ce('0x24')]();});}};}function handleEntityNotFound(_0xc876f3,_0x230d32){return function(_0x87d3c1){if(!_0x87d3c1){_0xc876f3['sendStatus'](0x194);}return _0x87d3c1;};}function handleError(_0x254ff8,_0x22ff50){_0x22ff50=_0x22ff50||0x1f4;return function(_0xef41f2){logger[_0x12ce('0x1d')](_0xef41f2[_0x12ce('0x2f')]);if(_0xef41f2[_0x12ce('0x30')]){delete _0xef41f2[_0x12ce('0x30')];}_0x254ff8[_0x12ce('0x23')](_0x22ff50)['send'](_0xef41f2);};}exports[_0x12ce('0x31')]=function(_0x18d2fe,_0x7f2020){var _0x5e6e6d={},_0x289d13={},_0x33693c={'count':0x0,'rows':[]};var _0x2cfead=_['map'](db[_0x12ce('0x32')]['rawAttributes'],function(_0x4efd9f){return{'name':_0x4efd9f[_0x12ce('0x33')],'type':_0x4efd9f['type'][_0x12ce('0x34')]};});_0x289d13[_0x12ce('0x35')]=_[_0x12ce('0x36')](_0x2cfead,'name');_0x289d13[_0x12ce('0x37')]=_[_0x12ce('0x38')](_0x18d2fe[_0x12ce('0x37')]);_0x289d13[_0x12ce('0x39')]=_[_0x12ce('0x3a')](_0x289d13[_0x12ce('0x35')],_0x289d13['query']);_0x5e6e6d['attributes']=_['intersection'](_0x289d13[_0x12ce('0x35')],qs[_0x12ce('0x3b')](_0x18d2fe[_0x12ce('0x37')]['fields']));_0x5e6e6d[_0x12ce('0x3c')]=_0x5e6e6d[_0x12ce('0x3c')][_0x12ce('0x3d')]?_0x5e6e6d[_0x12ce('0x3c')]:_0x289d13[_0x12ce('0x35')];if(!_0x18d2fe[_0x12ce('0x37')]['hasOwnProperty'](_0x12ce('0x3e'))){_0x5e6e6d[_0x12ce('0x29')]=qs[_0x12ce('0x29')](_0x18d2fe['query'][_0x12ce('0x29')]);_0x5e6e6d[_0x12ce('0x26')]=qs[_0x12ce('0x26')](_0x18d2fe['query']['offset']);}_0x5e6e6d[_0x12ce('0x3f')]=qs[_0x12ce('0x40')](_0x18d2fe[_0x12ce('0x37')]['sort']);_0x5e6e6d[_0x12ce('0x41')]=qs[_0x12ce('0x39')](_[_0x12ce('0x42')](_0x18d2fe[_0x12ce('0x37')],_0x289d13[_0x12ce('0x39')]),_0x2cfead);if(_0x18d2fe[_0x12ce('0x37')][_0x12ce('0x43')]){_0x5e6e6d[_0x12ce('0x41')]=_[_0x12ce('0x44')](_0x5e6e6d[_0x12ce('0x41')],{'$or':_[_0x12ce('0x36')](_0x2cfead,function(_0x56dd3f){if(_0x56dd3f['type']!==_0x12ce('0x45')){var _0x259d71={};_0x259d71[_0x56dd3f[_0x12ce('0x30')]]={'$like':'%'+_0x18d2fe['query']['filter']+'%'};return _0x259d71;}})});}_0x5e6e6d=_['merge']({},_0x5e6e6d,_0x18d2fe[_0x12ce('0x46')]);var _0x862bda={'where':_0x5e6e6d[_0x12ce('0x41')]};return db[_0x12ce('0x32')][_0x12ce('0x28')](_0x862bda)[_0x12ce('0x17')](function(_0x2bf4c8){_0x33693c['count']=_0x2bf4c8;if(_0x18d2fe['query'][_0x12ce('0x47')]){_0x5e6e6d['include']=[{'all':!![]}];}return db[_0x12ce('0x32')][_0x12ce('0x48')](_0x5e6e6d);})[_0x12ce('0x17')](function(_0xd17a37){_0x33693c[_0x12ce('0x49')]=_0xd17a37;return _0x33693c;})[_0x12ce('0x17')](respondWithFilteredResult(_0x7f2020,_0x5e6e6d))['catch'](handleError(_0x7f2020,null));};exports[_0x12ce('0x4a')]=function(_0x59244f,_0x409277){var _0x38eea7={'raw':![],'where':{'id':_0x59244f[_0x12ce('0x4b')]['id']}},_0x3a5849={};_0x3a5849[_0x12ce('0x35')]=_[_0x12ce('0x38')](db[_0x12ce('0x32')]['rawAttributes']);_0x3a5849['query']=_[_0x12ce('0x38')](_0x59244f[_0x12ce('0x37')]);_0x3a5849['filters']=_['intersection'](_0x3a5849[_0x12ce('0x35')],_0x3a5849[_0x12ce('0x37')]);_0x38eea7[_0x12ce('0x3c')]=_[_0x12ce('0x3a')](_0x3a5849[_0x12ce('0x35')],qs[_0x12ce('0x3b')](_0x59244f[_0x12ce('0x37')][_0x12ce('0x3b')]));_0x38eea7[_0x12ce('0x3c')]=_0x38eea7[_0x12ce('0x3c')][_0x12ce('0x3d')]?_0x38eea7[_0x12ce('0x3c')]:_0x3a5849[_0x12ce('0x35')];if(_0x59244f[_0x12ce('0x37')][_0x12ce('0x47')]){_0x38eea7['include']=[{'all':!![]}];}_0x38eea7=_['merge']({},_0x38eea7,_0x59244f['options']);return db[_0x12ce('0x32')]['find'](_0x38eea7)[_0x12ce('0x17')](handleEntityNotFound(_0x409277,null))[_0x12ce('0x17')](respondWithResult(_0x409277,null))['catch'](handleError(_0x409277,null));};exports[_0x12ce('0x2e')]=function(_0x37699f,_0x42a311){if(_0x37699f[_0x12ce('0x4c')]['id']){delete _0x37699f[_0x12ce('0x4c')]['id'];}return db[_0x12ce('0x32')][_0x12ce('0x4d')]({'where':{'id':_0x37699f[_0x12ce('0x4b')]['id']}})[_0x12ce('0x17')](handleEntityNotFound(_0x42a311,null))['then'](saveUpdates(_0x37699f[_0x12ce('0x4c')],null))[_0x12ce('0x17')](respondWithResult(_0x42a311,null))['catch'](handleError(_0x42a311,null));};exports[_0x12ce('0x4e')]=function(_0x3430c0,_0x31fc53,_0x4a7a68){if(_0x3430c0[_0x12ce('0x4f')]&&_0x3430c0[_0x12ce('0x4f')]['filename']){_0x3430c0[_0x12ce('0x4c')][_0x12ce('0x50')]=_0x3430c0[_0x12ce('0x4f')][_0x12ce('0x51')];}return db[_0x12ce('0x32')]['find']({'where':{'id':_0x3430c0[_0x12ce('0x4b')]['id']}})[_0x12ce('0x17')](handleEntityNotFound(_0x31fc53,null))[_0x12ce('0x17')](saveUpdates(_0x3430c0['body'],null))[_0x12ce('0x17')](respondWithResult(_0x31fc53,null))['catch'](handleError(_0x31fc53,null));};exports['addLogoLogin']=function(_0x47e046,_0x5e44f3,_0x22eee3){if(_0x47e046[_0x12ce('0x4f')]&&_0x47e046[_0x12ce('0x4f')][_0x12ce('0x51')]){_0x47e046[_0x12ce('0x4c')]['loginLogo']=_0x47e046['file'][_0x12ce('0x51')];}return db[_0x12ce('0x32')][_0x12ce('0x4d')]({'where':{'id':_0x47e046[_0x12ce('0x4b')]['id']}})[_0x12ce('0x17')](handleEntityNotFound(_0x5e44f3,null))[_0x12ce('0x17')](saveUpdates(_0x47e046[_0x12ce('0x4c')],null))['then'](respondWithResult(_0x5e44f3,null))[_0x12ce('0x21')](handleError(_0x5e44f3,null));};var utilLicense=require(_0x12ce('0x12'));exports[_0x12ce('0x52')]=function(_0x52a0c6,_0x3fa1ba,_0x70a57c){var _0x4af742=_0x12ce('0x53');var _0x260a4d={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x26b343){if(_0x26b343){_0x260a4d=_0x26b343;}return db['Setting']['find']({'where':{'id':_0x52a0c6[_0x12ce('0x4b')]['id']},'attributes':['logo',_0x12ce('0x54'),_0x12ce('0x55'),_0x12ce('0x56'),'defaultLogo',_0x12ce('0x57'),_0x12ce('0x58'),_0x12ce('0x59')],'raw':!![]});})[_0x12ce('0x17')](handleEntityNotFound(_0x3fa1ba,null))['then'](function(_0xba4af9){if(_0xba4af9){var _0x5b0fe7=_0xba4af9[_0x12ce('0x50')]&&fs[_0x12ce('0x5a')](path['join'](config[_0x12ce('0x5b')],_0x4af742,_[_0x12ce('0x5c')](_0xba4af9[_0x12ce('0x50')])))?path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x4af742,_[_0x12ce('0x5c')](_0xba4af9[_0x12ce('0x50')])):path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x4af742,_[_0x12ce('0x5c')](_0x12ce('0x5e')));var _0x3f4f45=_0x12ce('0x5f')+_['upperFirst'](_0x12ce('0x50'));if(_0xba4af9[_0x3f4f45]||!_0x260a4d[_0x12ce('0x60')]){_0x5b0fe7=path['join'](config[_0x12ce('0x5b')],_0x4af742,_['toLower'](_0x12ce('0x5e')));}if(!fs[_0x12ce('0x5a')](_0x5b0fe7)){throw new db[(_0x12ce('0x61'))][(_0x12ce('0x62'))](_[_0x12ce('0x63')](_0x12ce('0x50'))+'\x20not\x20found');}return _0x3fa1ba[_0x12ce('0x64')](_0x5b0fe7);}})[_0x12ce('0x21')](handleError(_0x3fa1ba,null));};var utilLicense=require(_0x12ce('0x12'));exports[_0x12ce('0x65')]=function(_0x572aec,_0x5e8500,_0x2ab52b){var _0x5d7a71=_0x12ce('0x53');var _0x40e114={'custom':![]};return utilLicense[_0x12ce('0x66')]()[_0x12ce('0x17')](function(_0x48012e){if(_0x48012e){_0x40e114=_0x48012e;}return db['Setting'][_0x12ce('0x4d')]({'where':{'id':_0x572aec[_0x12ce('0x4b')]['id']},'attributes':[_0x12ce('0x50'),_0x12ce('0x54'),_0x12ce('0x55'),_0x12ce('0x56'),_0x12ce('0x67'),'defaultLoginLogo',_0x12ce('0x58'),_0x12ce('0x59')],'raw':!![]});})[_0x12ce('0x17')](handleEntityNotFound(_0x5e8500,null))[_0x12ce('0x17')](function(_0x447cc6){if(_0x447cc6){var _0x45e71a=_0x447cc6[_0x12ce('0x54')]&&fs[_0x12ce('0x5a')](path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x5d7a71,_[_0x12ce('0x5c')](_0x447cc6['loginLogo'])))?path['join'](config[_0x12ce('0x5b')],_0x5d7a71,_[_0x12ce('0x5c')](_0x447cc6['loginLogo'])):path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x5d7a71,_[_0x12ce('0x5c')](_0x12ce('0x68')));var _0x2d7665=_0x12ce('0x5f')+_[_0x12ce('0x63')](_0x12ce('0x54'));if(_0x447cc6[_0x2d7665]||!_0x40e114['custom']){_0x45e71a=path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x5d7a71,_[_0x12ce('0x5c')](_0x12ce('0x68')));}if(!fs[_0x12ce('0x5a')](_0x45e71a)){throw new db[(_0x12ce('0x61'))][(_0x12ce('0x62'))](_['upperFirst'](_0x12ce('0x54'))+_0x12ce('0x69'));}return _0x5e8500[_0x12ce('0x64')](_0x45e71a);}})[_0x12ce('0x21')](handleError(_0x5e8500,null));};exports['gdpr']=function(_0x237793,_0x26985a){return db[_0x12ce('0x32')][_0x12ce('0x4d')]({'where':{'id':_0x237793['params']['id']},'attributes':[_0x12ce('0x6a')]})['then'](respondWithResult(_0x26985a,null))['catch'](handleError(_0x26985a,null));};exports[_0x12ce('0x6b')]=function(_0x3f50f9,_0x128049,_0x5c926c){if(_0x3f50f9['file']&&_0x3f50f9[_0x12ce('0x4f')][_0x12ce('0x51')]){_0x3f50f9[_0x12ce('0x4c')][_0x12ce('0x55')]=_0x3f50f9[_0x12ce('0x4f')][_0x12ce('0x51')];}return db[_0x12ce('0x32')]['find']({'where':{'id':_0x3f50f9['params']['id']}})[_0x12ce('0x17')](handleEntityNotFound(_0x128049,null))['then'](saveUpdates(_0x3f50f9[_0x12ce('0x4c')],null))[_0x12ce('0x17')](respondWithResult(_0x128049,null))['catch'](handleError(_0x128049,null));};var utilLicense=require(_0x12ce('0x12'));exports[_0x12ce('0x6c')]=function(_0x5bf370,_0x294982,_0x7f61c){var _0x316d75=_0x12ce('0x53');var _0x164762={'custom':![]};return utilLicense['getLicense']()[_0x12ce('0x17')](function(_0x4facd8){if(_0x4facd8){_0x164762=_0x4facd8;}return db['Setting'][_0x12ce('0x4d')]({'where':{'id':_0x5bf370[_0x12ce('0x4b')]['id']},'attributes':[_0x12ce('0x50'),_0x12ce('0x54'),_0x12ce('0x55'),_0x12ce('0x56'),'defaultLogo',_0x12ce('0x57'),_0x12ce('0x58'),_0x12ce('0x59')],'raw':!![]});})[_0x12ce('0x17')](handleEntityNotFound(_0x294982,null))[_0x12ce('0x17')](function(_0x5cf92e){if(_0x5cf92e){var _0x1e1c30=_0x5cf92e[_0x12ce('0x55')]&&fs[_0x12ce('0x5a')](path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x316d75,_['toLower'](_0x5cf92e[_0x12ce('0x55')])))?path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x316d75,_[_0x12ce('0x5c')](_0x5cf92e[_0x12ce('0x55')])):path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x316d75,_[_0x12ce('0x5c')](_0x12ce('0x6d')));var _0x21816f=_0x12ce('0x5f')+_[_0x12ce('0x63')](_0x12ce('0x55'));if(_0x5cf92e[_0x21816f]||!_0x164762['custom']||!_0x164762[_0x12ce('0x55')]){_0x1e1c30=path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0x316d75,_[_0x12ce('0x5c')](_0x12ce('0x6d')));}if(!fs[_0x12ce('0x5a')](_0x1e1c30)){throw new db['Sequelize'][(_0x12ce('0x62'))](_[_0x12ce('0x63')](_0x12ce('0x55'))+_0x12ce('0x69'));}return _0x294982['download'](_0x1e1c30);}})['catch'](handleError(_0x294982,null));};exports[_0x12ce('0x6e')]=function(_0x28e3b9,_0x42b2f2,_0x3b28cc){if(_0x28e3b9[_0x12ce('0x4f')]&&_0x28e3b9[_0x12ce('0x4f')]['filename']){_0x28e3b9[_0x12ce('0x4c')][_0x12ce('0x56')]=_0x28e3b9[_0x12ce('0x4f')][_0x12ce('0x51')];}return db[_0x12ce('0x32')][_0x12ce('0x4d')]({'where':{'id':_0x28e3b9[_0x12ce('0x4b')]['id']}})[_0x12ce('0x17')](handleEntityNotFound(_0x42b2f2,null))[_0x12ce('0x17')](saveUpdates(_0x28e3b9[_0x12ce('0x4c')],null))[_0x12ce('0x17')](respondWithResult(_0x42b2f2,null))['catch'](handleError(_0x42b2f2,null));};var utilLicense=require(_0x12ce('0x12'));exports[_0x12ce('0x6f')]=function(_0x51123b,_0x2a7f5f,_0x54120c){var _0xe242b1='server/files/images/logos';var _0x3a9d1b={'custom':![]};return utilLicense['getLicense']()[_0x12ce('0x17')](function(_0x17d547){if(_0x17d547){_0x3a9d1b=_0x17d547;}return db[_0x12ce('0x32')][_0x12ce('0x4d')]({'where':{'id':_0x51123b[_0x12ce('0x4b')]['id']},'attributes':['logo','loginLogo',_0x12ce('0x55'),_0x12ce('0x56'),_0x12ce('0x67'),_0x12ce('0x57'),_0x12ce('0x58'),'defaultFavicon'],'raw':!![]});})[_0x12ce('0x17')](handleEntityNotFound(_0x2a7f5f,null))[_0x12ce('0x17')](function(_0x28eea9){if(_0x28eea9){var _0xf9db1f=_0x28eea9[_0x12ce('0x56')]&&fs[_0x12ce('0x5a')](path[_0x12ce('0x5d')](config[_0x12ce('0x5b')],_0xe242b1,_[_0x12ce('0x5c')](_0x28eea9[_0x12ce('0x56')])))?path[_0x12ce('0x5d')](config['root'],_0xe242b1,_[_0x12ce('0x5c')](_0x28eea9[_0x12ce('0x56')])):path['join'](config[_0x12ce('0x5b')],_0xe242b1,_[_0x12ce('0x5c')](_0x12ce('0x70')));var _0x30de66=_0x12ce('0x5f')+_['upperFirst'](_0x12ce('0x56'));if(_0x28eea9[_0x30de66]||!_0x3a9d1b[_0x12ce('0x60')]){_0xf9db1f=path[_0x12ce('0x5d')](config['root'],_0xe242b1,_[_0x12ce('0x5c')](_0x12ce('0x70')));}if(!fs[_0x12ce('0x5a')](_0xf9db1f)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x12ce('0x56'))+_0x12ce('0x69'));}return _0x2a7f5f[_0x12ce('0x64')](_0xf9db1f);}})[_0x12ce('0x21')](handleError(_0x2a7f5f,null));};exports['getDate']=function(_0x152f60,_0x31bb4e){var _0x3d3841={'offset':moment()['utcOffset']()};_0x3d3841[_0x12ce('0x71')]=moment()[_0x12ce('0x72')](_0x3d3841[_0x12ce('0x26')])[_0x12ce('0x73')](_0x12ce('0x74'));return _0x31bb4e[_0x12ce('0x23')](0xc8)[_0x12ce('0x75')](_0x3d3841);}; \ No newline at end of file +var _0xdcd9=['default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','loginLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default','upperFirst','default_logo.svg','ValidationError','getLogoLogin','getLicense','favicon','default_loginLogo.svg','custom','existsSync','Sequelize','\x20not\x20found','download','gdpr','addFavicon'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xdcd9,0xf5));var _0x9dcd=function(_0x2870cd,_0x856b58){_0x2870cd=_0x2870cd-0x0;var _0x245747=_0xdcd9[_0x2870cd];return _0x245747;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dcd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9dcd('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9dcd('0x2'));var Mustache=require(_0x9dcd('0x3'));var util=require(_0x9dcd('0x4'));var path=require(_0x9dcd('0x5'));var sox=require(_0x9dcd('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9dcd('0x7'));var _=require(_0x9dcd('0x8'));var squel=require(_0x9dcd('0x9'));var crypto=require(_0x9dcd('0xa'));var jsforce=require(_0x9dcd('0xb'));var deskjs=require(_0x9dcd('0xc'));var toCsv=require(_0x9dcd('0xd'));var querystring=require(_0x9dcd('0xe'));var Papa=require(_0x9dcd('0xf'));var Redis=require(_0x9dcd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9dcd('0x11'));var as=require(_0x9dcd('0x12'));var hardwareService=require(_0x9dcd('0x13'));var logger=require(_0x9dcd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9dcd('0x15'));var licenseUtil=require(_0x9dcd('0x16'));var db=require(_0x9dcd('0x17'))['db'];var jayson=require(_0x9dcd('0x18'));var client=jayson[_0x9dcd('0x19')][_0x9dcd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x31cb53,_0x31a764,_0xf0f83b,_0x5e7fa8){return new BPromise(function(_0x38a8e8,_0x22d809){var _0x2e9e61=_0x5e7fa8||client;return _0x2e9e61[_0x9dcd('0x1b')](_0x31cb53,_0xf0f83b)[_0x9dcd('0x1c')](function(_0x18e795){logger[_0x9dcd('0x1d')](_0x9dcd('0x1e'),_0x31a764,_0x9dcd('0x1f'));logger[_0x9dcd('0x20')](_0x9dcd('0x21'),_0x31a764,_0x9dcd('0x1f'),JSON['stringify'](_0x18e795));if(_0x18e795[_0x9dcd('0x22')]){if(_0x18e795[_0x9dcd('0x22')][_0x9dcd('0x23')]===0x1f4){logger[_0x9dcd('0x22')](_0x9dcd('0x1e'),_0x31a764,_0x18e795['error'][_0x9dcd('0x24')]);return _0x22d809(_0x18e795[_0x9dcd('0x22')][_0x9dcd('0x24')]);}logger[_0x9dcd('0x22')](_0x9dcd('0x1e'),_0x31a764,_0x18e795[_0x9dcd('0x22')][_0x9dcd('0x24')]);return _0x38a8e8(_0x18e795[_0x9dcd('0x22')][_0x9dcd('0x24')]);}else{logger[_0x9dcd('0x1d')]('Setting,\x20%s,\x20%s',_0x31a764,_0x9dcd('0x1f'));_0x38a8e8(_0x18e795['result'][_0x9dcd('0x24')]);}})[_0x9dcd('0x25')](function(_0x24e6c2){logger[_0x9dcd('0x22')]('Setting,\x20%s,\x20%s',_0x31a764,_0x24e6c2);_0x22d809(_0x24e6c2);});});}function respondWithStatusCode(_0x4c6866,_0x348f0d){_0x348f0d=_0x348f0d||0xcc;return function(_0xa1176b){if(_0xa1176b){return _0x4c6866['sendStatus'](_0x348f0d);}return _0x4c6866['status'](_0x348f0d)[_0x9dcd('0x26')]();};}function respondWithResult(_0x1535c5,_0x5ddd69){_0x5ddd69=_0x5ddd69||0xc8;return function(_0x10d07c){if(_0x10d07c){return _0x1535c5[_0x9dcd('0x27')](_0x5ddd69)[_0x9dcd('0x28')](_0x10d07c);}};}function respondWithFilteredResult(_0x3c4b99,_0x97d79d){return function(_0x3c98c2){if(_0x3c98c2){var _0x478751=typeof _0x97d79d[_0x9dcd('0x29')]===_0x9dcd('0x2a')&&typeof _0x97d79d['limit']===_0x9dcd('0x2a');var _0x3ebd92=_0x3c98c2['count'];var _0x5f4b26=_0x478751?0x0:_0x97d79d[_0x9dcd('0x29')];var _0x1d1caf=_0x478751?_0x3c98c2[_0x9dcd('0x2b')]:_0x97d79d[_0x9dcd('0x29')]+_0x97d79d[_0x9dcd('0x2c')];var _0x3b27da;if(_0x1d1caf>=_0x3ebd92){_0x1d1caf=_0x3ebd92;_0x3b27da=0xc8;}else{_0x3b27da=0xce;}_0x3c4b99[_0x9dcd('0x27')](_0x3b27da);return _0x3c4b99[_0x9dcd('0x2d')](_0x9dcd('0x2e'),_0x5f4b26+'-'+_0x1d1caf+'/'+_0x3ebd92)[_0x9dcd('0x28')](_0x3c98c2);}return null;};}function patchUpdates(_0x12a582){return function(_0xbfe0c5){try{jsonpatch[_0x9dcd('0x2f')](_0xbfe0c5,_0x12a582,!![]);}catch(_0x6e3771){return BPromise[_0x9dcd('0x30')](_0x6e3771);}return _0xbfe0c5[_0x9dcd('0x31')]();};}function saveUpdates(_0x245f25,_0x1adc41){return function(_0x39895f){if(_0x39895f){return _0x39895f[_0x9dcd('0x32')](_0x245f25)[_0x9dcd('0x1c')](function(_0x2271cd){return _0x2271cd;});}return null;};}function removeEntity(_0x35ac1f,_0x2c61d7){return function(_0x21c4af){if(_0x21c4af){return _0x21c4af[_0x9dcd('0x33')]()['then'](function(){_0x35ac1f[_0x9dcd('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbad301,_0x12f9ea){return function(_0x30d2e8){if(!_0x30d2e8){_0xbad301[_0x9dcd('0x34')](0x194);}return _0x30d2e8;};}function handleError(_0x13cd99,_0x4240b7){_0x4240b7=_0x4240b7||0x1f4;return function(_0xca3f1c){logger['error'](_0xca3f1c['stack']);if(_0xca3f1c[_0x9dcd('0x35')]){delete _0xca3f1c[_0x9dcd('0x35')];}_0x13cd99[_0x9dcd('0x27')](_0x4240b7)[_0x9dcd('0x36')](_0xca3f1c);};}exports[_0x9dcd('0x37')]=function(_0x74346c,_0x55df41){var _0x360dfa={},_0x51b3c2={},_0x3b3b4e={'count':0x0,'rows':[]};var _0x54d49b=_[_0x9dcd('0x38')](db[_0x9dcd('0x39')][_0x9dcd('0x3a')],function(_0x28a68d){return{'name':_0x28a68d[_0x9dcd('0x3b')],'type':_0x28a68d[_0x9dcd('0x3c')][_0x9dcd('0x3d')]};});_0x51b3c2[_0x9dcd('0x3e')]=_[_0x9dcd('0x38')](_0x54d49b,_0x9dcd('0x35'));_0x51b3c2['query']=_[_0x9dcd('0x3f')](_0x74346c[_0x9dcd('0x40')]);_0x51b3c2[_0x9dcd('0x41')]=_['intersection'](_0x51b3c2[_0x9dcd('0x3e')],_0x51b3c2[_0x9dcd('0x40')]);_0x360dfa[_0x9dcd('0x42')]=_[_0x9dcd('0x43')](_0x51b3c2[_0x9dcd('0x3e')],qs[_0x9dcd('0x44')](_0x74346c['query']['fields']));_0x360dfa[_0x9dcd('0x42')]=_0x360dfa[_0x9dcd('0x42')][_0x9dcd('0x45')]?_0x360dfa[_0x9dcd('0x42')]:_0x51b3c2[_0x9dcd('0x3e')];if(!_0x74346c[_0x9dcd('0x40')][_0x9dcd('0x46')]('nolimit')){_0x360dfa[_0x9dcd('0x2c')]=qs[_0x9dcd('0x2c')](_0x74346c['query'][_0x9dcd('0x2c')]);_0x360dfa[_0x9dcd('0x29')]=qs['offset'](_0x74346c['query'][_0x9dcd('0x29')]);}_0x360dfa['order']=qs[_0x9dcd('0x47')](_0x74346c[_0x9dcd('0x40')][_0x9dcd('0x47')]);_0x360dfa[_0x9dcd('0x48')]=qs[_0x9dcd('0x41')](_['pick'](_0x74346c[_0x9dcd('0x40')],_0x51b3c2[_0x9dcd('0x41')]),_0x54d49b);if(_0x74346c['query'][_0x9dcd('0x49')]){_0x360dfa[_0x9dcd('0x48')]=_[_0x9dcd('0x4a')](_0x360dfa[_0x9dcd('0x48')],{'$or':_[_0x9dcd('0x38')](_0x54d49b,function(_0x3e115a){if(_0x3e115a['type']!==_0x9dcd('0x4b')){var _0x2aa246={};_0x2aa246[_0x3e115a[_0x9dcd('0x35')]]={'$like':'%'+_0x74346c[_0x9dcd('0x40')][_0x9dcd('0x49')]+'%'};return _0x2aa246;}})});}_0x360dfa=_[_0x9dcd('0x4a')]({},_0x360dfa,_0x74346c[_0x9dcd('0x4c')]);var _0x371cb1={'where':_0x360dfa['where']};return db['Setting']['count'](_0x371cb1)[_0x9dcd('0x1c')](function(_0x2cf6c8){_0x3b3b4e[_0x9dcd('0x2b')]=_0x2cf6c8;if(_0x74346c[_0x9dcd('0x40')][_0x9dcd('0x4d')]){_0x360dfa[_0x9dcd('0x4e')]=[{'all':!![]}];}return db['Setting'][_0x9dcd('0x4f')](_0x360dfa);})['then'](function(_0x115916){_0x3b3b4e[_0x9dcd('0x50')]=_0x115916;return _0x3b3b4e;})[_0x9dcd('0x1c')](respondWithFilteredResult(_0x55df41,_0x360dfa))[_0x9dcd('0x25')](handleError(_0x55df41,null));};exports['show']=function(_0x41e3cf,_0x3a48c5){var _0xe18425={'raw':![],'where':{'id':_0x41e3cf[_0x9dcd('0x51')]['id']}},_0x4aa1af={};_0x4aa1af['model']=_[_0x9dcd('0x3f')](db[_0x9dcd('0x39')][_0x9dcd('0x3a')]);_0x4aa1af[_0x9dcd('0x40')]=_[_0x9dcd('0x3f')](_0x41e3cf['query']);_0x4aa1af[_0x9dcd('0x41')]=_[_0x9dcd('0x43')](_0x4aa1af[_0x9dcd('0x3e')],_0x4aa1af[_0x9dcd('0x40')]);_0xe18425[_0x9dcd('0x42')]=_[_0x9dcd('0x43')](_0x4aa1af['model'],qs['fields'](_0x41e3cf[_0x9dcd('0x40')][_0x9dcd('0x44')]));_0xe18425[_0x9dcd('0x42')]=_0xe18425[_0x9dcd('0x42')][_0x9dcd('0x45')]?_0xe18425[_0x9dcd('0x42')]:_0x4aa1af[_0x9dcd('0x3e')];if(_0x41e3cf['query'][_0x9dcd('0x4d')]){_0xe18425['include']=[{'all':!![]}];}_0xe18425=_[_0x9dcd('0x4a')]({},_0xe18425,_0x41e3cf[_0x9dcd('0x4c')]);return db['Setting'][_0x9dcd('0x52')](_0xe18425)[_0x9dcd('0x1c')](handleEntityNotFound(_0x3a48c5,null))[_0x9dcd('0x1c')](respondWithResult(_0x3a48c5,null))[_0x9dcd('0x25')](handleError(_0x3a48c5,null));};exports[_0x9dcd('0x32')]=function(_0x130ab0,_0x1d071b){if(_0x130ab0[_0x9dcd('0x53')]['id']){delete _0x130ab0[_0x9dcd('0x53')]['id'];}return db['Setting'][_0x9dcd('0x52')]({'where':{'id':_0x130ab0[_0x9dcd('0x51')]['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x1d071b,null))[_0x9dcd('0x1c')](saveUpdates(_0x130ab0[_0x9dcd('0x53')],null))[_0x9dcd('0x1c')](respondWithResult(_0x1d071b,null))['catch'](handleError(_0x1d071b,null));};exports[_0x9dcd('0x54')]=function(_0x5a987e,_0x15e441,_0x544822){if(_0x5a987e[_0x9dcd('0x55')]&&_0x5a987e[_0x9dcd('0x55')][_0x9dcd('0x56')]){_0x5a987e[_0x9dcd('0x53')][_0x9dcd('0x57')]=_0x5a987e[_0x9dcd('0x55')]['filename'];}return db[_0x9dcd('0x39')]['find']({'where':{'id':_0x5a987e[_0x9dcd('0x51')]['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x15e441,null))[_0x9dcd('0x1c')](saveUpdates(_0x5a987e[_0x9dcd('0x53')],null))[_0x9dcd('0x1c')](respondWithResult(_0x15e441,null))[_0x9dcd('0x25')](handleError(_0x15e441,null));};exports[_0x9dcd('0x58')]=function(_0x5db851,_0x6f0b3,_0x4c8ce9){if(_0x5db851['file']&&_0x5db851[_0x9dcd('0x55')][_0x9dcd('0x56')]){_0x5db851[_0x9dcd('0x53')]['loginLogo']=_0x5db851[_0x9dcd('0x55')][_0x9dcd('0x56')];}return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x5db851[_0x9dcd('0x51')]['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x6f0b3,null))[_0x9dcd('0x1c')](saveUpdates(_0x5db851[_0x9dcd('0x53')],null))['then'](respondWithResult(_0x6f0b3,null))[_0x9dcd('0x25')](handleError(_0x6f0b3,null));};var utilLicense=require(_0x9dcd('0x16'));exports[_0x9dcd('0x59')]=function(_0x5dce09,_0x15e423,_0x4d2bcd){var _0x3ad642=_0x9dcd('0x5a');var _0x2622db={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x49092f){if(_0x49092f){_0x2622db=_0x49092f;}return db[_0x9dcd('0x39')]['find']({'where':{'id':_0x5dce09[_0x9dcd('0x51')]['id']},'attributes':['logo',_0x9dcd('0x5b'),_0x9dcd('0x5c'),'favicon',_0x9dcd('0x5d'),_0x9dcd('0x5e'),_0x9dcd('0x5f'),_0x9dcd('0x60')],'raw':!![]});})[_0x9dcd('0x1c')](handleEntityNotFound(_0x15e423,null))[_0x9dcd('0x1c')](function(_0x109152){if(_0x109152){var _0x22a319=_0x109152[_0x9dcd('0x57')]&&fs['existsSync'](path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x3ad642,_[_0x9dcd('0x63')](_0x109152[_0x9dcd('0x57')])))?path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x3ad642,_[_0x9dcd('0x63')](_0x109152[_0x9dcd('0x57')])):path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x3ad642,_['toLower']('default_logo.svg'));var _0x21dc2f=_0x9dcd('0x64')+_[_0x9dcd('0x65')](_0x9dcd('0x57'));if(_0x109152[_0x21dc2f]||!_0x2622db['custom']){_0x22a319=path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x3ad642,_[_0x9dcd('0x63')](_0x9dcd('0x66')));}if(!fs['existsSync'](_0x22a319)){throw new db['Sequelize'][(_0x9dcd('0x67'))](_[_0x9dcd('0x65')](_0x9dcd('0x57'))+'\x20not\x20found');}return _0x15e423['download'](_0x22a319);}})['catch'](handleError(_0x15e423,null));};var utilLicense=require(_0x9dcd('0x16'));exports[_0x9dcd('0x68')]=function(_0x2c18d0,_0x1f99c3,_0x658e89){var _0x2dbaf7=_0x9dcd('0x5a');var _0x46cf18={'custom':![]};return utilLicense[_0x9dcd('0x69')]()['then'](function(_0xe7bb2e){if(_0xe7bb2e){_0x46cf18=_0xe7bb2e;}return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x2c18d0['params']['id']},'attributes':[_0x9dcd('0x57'),_0x9dcd('0x5b'),_0x9dcd('0x5c'),_0x9dcd('0x6a'),'defaultLogo',_0x9dcd('0x5e'),_0x9dcd('0x5f'),_0x9dcd('0x60')],'raw':!![]});})[_0x9dcd('0x1c')](handleEntityNotFound(_0x1f99c3,null))[_0x9dcd('0x1c')](function(_0xa1d142){if(_0xa1d142){var _0x4b7fd7=_0xa1d142[_0x9dcd('0x5b')]&&fs['existsSync'](path['join'](config[_0x9dcd('0x62')],_0x2dbaf7,_[_0x9dcd('0x63')](_0xa1d142['loginLogo'])))?path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x2dbaf7,_['toLower'](_0xa1d142['loginLogo'])):path[_0x9dcd('0x61')](config['root'],_0x2dbaf7,_[_0x9dcd('0x63')](_0x9dcd('0x6b')));var _0x8fc655=_0x9dcd('0x64')+_[_0x9dcd('0x65')](_0x9dcd('0x5b'));if(_0xa1d142[_0x8fc655]||!_0x46cf18[_0x9dcd('0x6c')]){_0x4b7fd7=path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x2dbaf7,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x9dcd('0x6d')](_0x4b7fd7)){throw new db[(_0x9dcd('0x6e'))][(_0x9dcd('0x67'))](_[_0x9dcd('0x65')]('loginLogo')+_0x9dcd('0x6f'));}return _0x1f99c3[_0x9dcd('0x70')](_0x4b7fd7);}})[_0x9dcd('0x25')](handleError(_0x1f99c3,null));};exports[_0x9dcd('0x71')]=function(_0x3338d3,_0x2e5a54){return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x3338d3[_0x9dcd('0x51')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x2e5a54,null))[_0x9dcd('0x25')](handleError(_0x2e5a54,null));};exports['addPreferred']=function(_0x4e71e1,_0x294c64,_0x5798e5){if(_0x4e71e1[_0x9dcd('0x55')]&&_0x4e71e1[_0x9dcd('0x55')]['filename']){_0x4e71e1[_0x9dcd('0x53')][_0x9dcd('0x5c')]=_0x4e71e1[_0x9dcd('0x55')][_0x9dcd('0x56')];}return db['Setting'][_0x9dcd('0x52')]({'where':{'id':_0x4e71e1['params']['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x294c64,null))['then'](saveUpdates(_0x4e71e1[_0x9dcd('0x53')],null))[_0x9dcd('0x1c')](respondWithResult(_0x294c64,null))['catch'](handleError(_0x294c64,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x41821e,_0x4c15f4,_0x379740){var _0x45ff50=_0x9dcd('0x5a');var _0x429a92={'custom':![]};return utilLicense[_0x9dcd('0x69')]()[_0x9dcd('0x1c')](function(_0x32a026){if(_0x32a026){_0x429a92=_0x32a026;}return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x41821e[_0x9dcd('0x51')]['id']},'attributes':['logo',_0x9dcd('0x5b'),_0x9dcd('0x5c'),_0x9dcd('0x6a'),_0x9dcd('0x5d'),_0x9dcd('0x5e'),'defaultPreferred',_0x9dcd('0x60')],'raw':!![]});})[_0x9dcd('0x1c')](handleEntityNotFound(_0x4c15f4,null))[_0x9dcd('0x1c')](function(_0x5ab34e){if(_0x5ab34e){var _0x241f3c=_0x5ab34e['preferred']&&fs['existsSync'](path['join'](config[_0x9dcd('0x62')],_0x45ff50,_[_0x9dcd('0x63')](_0x5ab34e[_0x9dcd('0x5c')])))?path[_0x9dcd('0x61')](config['root'],_0x45ff50,_[_0x9dcd('0x63')](_0x5ab34e['preferred'])):path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x45ff50,_[_0x9dcd('0x63')]('default_preferred.png'));var _0x1f6d5b=_0x9dcd('0x64')+_['upperFirst'](_0x9dcd('0x5c'));if(_0x5ab34e[_0x1f6d5b]||!_0x429a92[_0x9dcd('0x6c')]||!_0x429a92[_0x9dcd('0x5c')]){_0x241f3c=path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x45ff50,_['toLower']('default_preferred.png'));}if(!fs[_0x9dcd('0x6d')](_0x241f3c)){throw new db[(_0x9dcd('0x6e'))][(_0x9dcd('0x67'))](_[_0x9dcd('0x65')]('preferred')+_0x9dcd('0x6f'));}return _0x4c15f4[_0x9dcd('0x70')](_0x241f3c);}})['catch'](handleError(_0x4c15f4,null));};exports[_0x9dcd('0x72')]=function(_0x1b6c3c,_0x7c9ab2,_0xafb282){if(_0x1b6c3c[_0x9dcd('0x55')]&&_0x1b6c3c[_0x9dcd('0x55')][_0x9dcd('0x56')]){_0x1b6c3c['body'][_0x9dcd('0x6a')]=_0x1b6c3c['file']['filename'];}return db[_0x9dcd('0x39')][_0x9dcd('0x52')]({'where':{'id':_0x1b6c3c[_0x9dcd('0x51')]['id']}})[_0x9dcd('0x1c')](handleEntityNotFound(_0x7c9ab2,null))[_0x9dcd('0x1c')](saveUpdates(_0x1b6c3c[_0x9dcd('0x53')],null))[_0x9dcd('0x1c')](respondWithResult(_0x7c9ab2,null))[_0x9dcd('0x25')](handleError(_0x7c9ab2,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x5531d4,_0x1640e6,_0x191f89){var _0x4ca654=_0x9dcd('0x5a');var _0x2f2a1a={'custom':![]};return utilLicense[_0x9dcd('0x69')]()['then'](function(_0x35277a){if(_0x35277a){_0x2f2a1a=_0x35277a;}return db[_0x9dcd('0x39')]['find']({'where':{'id':_0x5531d4[_0x9dcd('0x51')]['id']},'attributes':[_0x9dcd('0x57'),_0x9dcd('0x5b'),_0x9dcd('0x5c'),_0x9dcd('0x6a'),_0x9dcd('0x5d'),_0x9dcd('0x5e'),_0x9dcd('0x5f'),_0x9dcd('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x1640e6,null))['then'](function(_0x29daca){if(_0x29daca){var _0x38f068=_0x29daca[_0x9dcd('0x6a')]&&fs[_0x9dcd('0x6d')](path[_0x9dcd('0x61')](config[_0x9dcd('0x62')],_0x4ca654,_[_0x9dcd('0x63')](_0x29daca[_0x9dcd('0x6a')])))?path['join'](config[_0x9dcd('0x62')],_0x4ca654,_[_0x9dcd('0x63')](_0x29daca[_0x9dcd('0x6a')])):path[_0x9dcd('0x61')](config['root'],_0x4ca654,_[_0x9dcd('0x63')](_0x9dcd('0x73')));var _0x467466=_0x9dcd('0x64')+_[_0x9dcd('0x65')]('favicon');if(_0x29daca[_0x467466]||!_0x2f2a1a[_0x9dcd('0x6c')]){_0x38f068=path['join'](config[_0x9dcd('0x62')],_0x4ca654,_[_0x9dcd('0x63')]('default_favicon.ico'));}if(!fs[_0x9dcd('0x6d')](_0x38f068)){throw new db[(_0x9dcd('0x6e'))][(_0x9dcd('0x67'))](_[_0x9dcd('0x65')](_0x9dcd('0x6a'))+'\x20not\x20found');}return _0x1640e6[_0x9dcd('0x70')](_0x38f068);}})[_0x9dcd('0x25')](handleError(_0x1640e6,null));};exports[_0x9dcd('0x74')]=function(_0x2fc876,_0x26e0a0){var _0x36c81a={'offset':moment()[_0x9dcd('0x75')]()};_0x36c81a['now']=moment()[_0x9dcd('0x75')](_0x36c81a[_0x9dcd('0x29')])[_0x9dcd('0x76')](_0x9dcd('0x77'));return _0x26e0a0[_0x9dcd('0x27')](0xc8)['send'](_0x36c81a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 64bded5..a59227b 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x55ca,0x126));var _0xa55c=function(_0x1b892b,_0x4efe48){_0x1b892b=_0x1b892b-0x0;var _0xa99e57=_0x55ca[_0x1b892b];return _0xa99e57;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index a1e4f8d..38fc1b9 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 _0x7822=['rpc','../../config/environment','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting','find','options','raw','attributes','include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x246890,_0x46b964){var _0x2b2a5a=function(_0x4f1232){while(--_0x4f1232){_0x246890['push'](_0x246890['shift']());}};_0x2b2a5a(++_0x46b964);}(_0x7822,0x90));var _0x2782=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7822[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2782('0x0'));var util=require(_0x2782('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2782('0x2'));var fs=require('fs');var Redis=require(_0x2782('0x3'));var db=require(_0x2782('0x4'))['db'];var utils=require(_0x2782('0x5'));var logger=require('../../config/logger')(_0x2782('0x6'));var config=require(_0x2782('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2782('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c1150,_0x11fa8a,_0x596502){return new BPromise(function(_0x5e9a09,_0x217399){return client[_0x2782('0x9')](_0x2c1150,_0x596502)[_0x2782('0xa')](function(_0x490c14){logger[_0x2782('0xb')](_0x2782('0xc'),_0x11fa8a,_0x2782('0xd'));logger[_0x2782('0xe')](_0x2782('0xf'),_0x11fa8a,_0x2782('0xd'),JSON[_0x2782('0x10')](_0x490c14));if(_0x490c14[_0x2782('0x11')]){if(_0x490c14[_0x2782('0x11')]['code']===0x1f4){logger['error'](_0x2782('0xc'),_0x11fa8a,_0x490c14[_0x2782('0x11')]['message']);return _0x217399(_0x490c14['error'][_0x2782('0x12')]);}logger[_0x2782('0x11')]('Setting,\x20%s,\x20%s',_0x11fa8a,_0x490c14[_0x2782('0x11')]['message']);return _0x5e9a09(_0x490c14[_0x2782('0x11')][_0x2782('0x12')]);}else{logger['info'](_0x2782('0xc'),_0x11fa8a,_0x2782('0xd'));_0x5e9a09(_0x490c14[_0x2782('0x13')]['message']);}})[_0x2782('0x14')](function(_0x32240e){logger['error'](_0x2782('0xc'),_0x11fa8a,_0x32240e);_0x217399(_0x32240e);});});}exports[_0x2782('0x15')]=function(_0x1211c4){var _0x3942d7=this;return new Promise(function(_0x35e62e,_0x30f823){return db[_0x2782('0x16')][_0x2782('0x17')]({'raw':_0x1211c4['options']?_0x1211c4[_0x2782('0x18')][_0x2782('0x19')]===undefined?!![]:![]:!![],'where':_0x1211c4[_0x2782('0x18')]?_0x1211c4[_0x2782('0x18')]['where']||null:null,'attributes':_0x1211c4['options']?_0x1211c4[_0x2782('0x18')][_0x2782('0x1a')]||null:null,'include':_0x1211c4[_0x2782('0x18')]?_0x1211c4[_0x2782('0x18')][_0x2782('0x1b')]?_[_0x2782('0x1c')](_0x1211c4['options']['include'],function(_0x11e8aa){return{'model':db[_0x11e8aa['model']],'as':_0x11e8aa['as'],'attributes':_0x11e8aa['attributes'],'include':_0x11e8aa['include']?_['map'](_0x11e8aa[_0x2782('0x1b')],function(_0x4c7879){return{'model':db[_0x4c7879['model']],'as':_0x4c7879['as'],'attributes':_0x4c7879['attributes'],'include':_0x4c7879[_0x2782('0x1b')]?_[_0x2782('0x1c')](_0x4c7879[_0x2782('0x1b')],function(_0x209af9){return{'model':db[_0x209af9[_0x2782('0x1d')]],'as':_0x209af9['as'],'attributes':_0x209af9[_0x2782('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2782('0xa')](function(_0x26a4c5){logger[_0x2782('0xb')](_0x2782('0x15'),_0x1211c4);logger[_0x2782('0xe')](_0x2782('0x15'),_0x1211c4,JSON['stringify'](_0x26a4c5));_0x35e62e(_0x26a4c5);})[_0x2782('0x14')](function(_0x43889d){logger[_0x2782('0x11')](_0x2782('0x15'),_0x43889d['message'],_0x1211c4);_0x30f823(_0x3942d7[_0x2782('0x11')](0x1f4,_0x43889d[_0x2782('0x12')]));});});}; \ No newline at end of file +var _0x2016=['map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','options','raw','where','attributes','include'];(function(_0x27e729,_0x5b9bab){var _0xe6a802=function(_0xdc719c){while(--_0xdc719c){_0x27e729['push'](_0x27e729['shift']());}};_0xe6a802(++_0x5b9bab);}(_0x2016,0x179));var _0x6201=function(_0x5ea0cf,_0x3639f0){_0x5ea0cf=_0x5ea0cf-0x0;var _0x17ab63=_0x2016[_0x5ea0cf];return _0x17ab63;};'use strict';var _=require(_0x6201('0x0'));var util=require(_0x6201('0x1'));var moment=require(_0x6201('0x2'));var BPromise=require('bluebird');var rs=require(_0x6201('0x3'));var fs=require('fs');var Redis=require(_0x6201('0x4'));var db=require(_0x6201('0x5'))['db'];var utils=require(_0x6201('0x6'));var logger=require(_0x6201('0x7'))(_0x6201('0x8'));var config=require(_0x6201('0x9'));var jayson=require(_0x6201('0xa'));var client=jayson[_0x6201('0xb')][_0x6201('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3581c2,_0x5562ac,_0x487044){return new BPromise(function(_0x5f041d,_0x3855aa){return client[_0x6201('0xd')](_0x3581c2,_0x487044)[_0x6201('0xe')](function(_0x11c9f1){logger[_0x6201('0xf')](_0x6201('0x10'),_0x5562ac,_0x6201('0x11'));logger['debug'](_0x6201('0x12'),_0x5562ac,'request\x20sent',JSON[_0x6201('0x13')](_0x11c9f1));if(_0x11c9f1[_0x6201('0x14')]){if(_0x11c9f1[_0x6201('0x14')][_0x6201('0x15')]===0x1f4){logger[_0x6201('0x14')](_0x6201('0x10'),_0x5562ac,_0x11c9f1[_0x6201('0x14')]['message']);return _0x3855aa(_0x11c9f1[_0x6201('0x14')][_0x6201('0x16')]);}logger['error'](_0x6201('0x10'),_0x5562ac,_0x11c9f1[_0x6201('0x14')][_0x6201('0x16')]);return _0x5f041d(_0x11c9f1[_0x6201('0x14')][_0x6201('0x16')]);}else{logger[_0x6201('0xf')]('Setting,\x20%s,\x20%s',_0x5562ac,_0x6201('0x11'));_0x5f041d(_0x11c9f1[_0x6201('0x17')][_0x6201('0x16')]);}})[_0x6201('0x18')](function(_0x1ab43b){logger[_0x6201('0x14')](_0x6201('0x10'),_0x5562ac,_0x1ab43b);_0x3855aa(_0x1ab43b);});});}exports[_0x6201('0x19')]=function(_0x41d66e){var _0x40b576=this;return new Promise(function(_0x476ad8,_0x3b8624){return db['Setting']['find']({'raw':_0x41d66e[_0x6201('0x1a')]?_0x41d66e[_0x6201('0x1a')][_0x6201('0x1b')]===undefined?!![]:![]:!![],'where':_0x41d66e['options']?_0x41d66e[_0x6201('0x1a')][_0x6201('0x1c')]||null:null,'attributes':_0x41d66e[_0x6201('0x1a')]?_0x41d66e['options'][_0x6201('0x1d')]||null:null,'include':_0x41d66e[_0x6201('0x1a')]?_0x41d66e[_0x6201('0x1a')][_0x6201('0x1e')]?_['map'](_0x41d66e[_0x6201('0x1a')]['include'],function(_0x325f25){return{'model':db[_0x325f25['model']],'as':_0x325f25['as'],'attributes':_0x325f25['attributes'],'include':_0x325f25[_0x6201('0x1e')]?_[_0x6201('0x1f')](_0x325f25[_0x6201('0x1e')],function(_0x422b5f){return{'model':db[_0x422b5f[_0x6201('0x20')]],'as':_0x422b5f['as'],'attributes':_0x422b5f[_0x6201('0x1d')],'include':_0x422b5f['include']?_[_0x6201('0x1f')](_0x422b5f[_0x6201('0x1e')],function(_0x10cb94){return{'model':db[_0x10cb94[_0x6201('0x20')]],'as':_0x10cb94['as'],'attributes':_0x10cb94[_0x6201('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22d93d){logger['info'](_0x6201('0x19'),_0x41d66e);logger[_0x6201('0x21')](_0x6201('0x19'),_0x41d66e,JSON[_0x6201('0x13')](_0x22d93d));_0x476ad8(_0x22d93d);})[_0x6201('0x18')](function(_0x1e0b09){logger['error'](_0x6201('0x19'),_0x1e0b09[_0x6201('0x16')],_0x41d66e);_0x3b8624(_0x40b576[_0x6201('0x14')](0x1f4,_0x1e0b09[_0x6201('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6b926e7..3c6478e 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 _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x44e0c1,_0x12efd7){var _0x189b5b=function(_0x4ac6d3){while(--_0x4ac6d3){_0x44e0c1['push'](_0x44e0c1['shift']());}};_0x189b5b(++_0x12efd7);}(_0x53ec,0x192));var _0xc53e=function(_0xec722a,_0x354472){_0xec722a=_0xec722a-0x0;var _0xbb0f9e=_0x53ec[_0xec722a];return _0xbb0f9e;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x27487a,_0x5923cb){var _0x5dbded=function(_0x54d13d){while(--_0x54d13d){_0x27487a['push'](_0x27487a['shift']());}};_0x5dbded(++_0x5923cb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x176103,_0x342154){_0x176103=_0x176103-0x0;var _0x5180c2=_0x8ef6[_0x176103];return _0x5180c2;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4d96163..bb147e9 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 _0x53fe=['STRING','name','ENUM','twilio','skebby','connectel','clicksend','clickatell','bandwidth','csc','infobip','BOOLEAN','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x509024,_0x5e6c3d){var _0x5c36e8=function(_0x595c7c){while(--_0x595c7c){_0x509024['push'](_0x509024['shift']());}};_0x5c36e8(++_0x5e6c3d);}(_0x53fe,0xef));var _0xe53f=function(_0x180d5e,_0x3f5bf6){_0x180d5e=_0x180d5e-0x0;var _0x4c7d88=_0x53fe[_0x180d5e];return _0x4c7d88;};'use strict';var Sequelize=require(_0xe53f('0x0'));var rs=require(_0xe53f('0x1'));module[_0xe53f('0x2')]={'name':{'type':Sequelize[_0xe53f('0x3')],'unique':_0xe53f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe53f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe53f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe53f('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xe53f('0x3')]},'type':{'type':Sequelize[_0xe53f('0x5')](_0xe53f('0x6'),_0xe53f('0x7'),_0xe53f('0x8'),_0xe53f('0x9'),'plivo',_0xe53f('0xa'),_0xe53f('0xb'),_0xe53f('0xc'),_0xe53f('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0xe53f('0x3')]},'authId':{'type':Sequelize[_0xe53f('0x3')]},'authToken':{'type':Sequelize[_0xe53f('0x3')]},'smsMethod':{'type':Sequelize[_0xe53f('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe53f('0x3')]},'apiKey':{'type':Sequelize[_0xe53f('0x3')]},'applicationId':{'type':Sequelize[_0xe53f('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xe53f('0x3')]},'deliveryReport':{'type':Sequelize[_0xe53f('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xe53f('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe53f('0xf');}},'notificationSound':{'type':Sequelize[_0xe53f('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe53f('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe53f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe53f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe53f('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe53f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe53f('0x10')],'comment':_0xe53f('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xe53f('0xe')],'defaultValue':![],'comment':_0xe53f('0x12'),'set':function(_0x514997){if(!_0x514997)this[_0xe53f('0x13')](_0xe53f('0x14'),null);this[_0xe53f('0x13')](_0xe53f('0x15'),_0x514997);}}}; \ No newline at end of file +var _0x30d3=['intelepeer','ENUM','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip'];(function(_0x2e1b41,_0x17914a){var _0x163368=function(_0x1b2c7e){while(--_0x1b2c7e){_0x2e1b41['push'](_0x2e1b41['shift']());}};_0x163368(++_0x17914a);}(_0x30d3,0x1d7));var _0x330d=function(_0x25dad5,_0x2f9368){_0x25dad5=_0x25dad5-0x0;var _0x4cb559=_0x30d3[_0x25dad5];return _0x4cb559;};'use strict';var Sequelize=require(_0x330d('0x0'));var rs=require(_0x330d('0x1'));module[_0x330d('0x2')]={'name':{'type':Sequelize[_0x330d('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x330d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x330d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x330d('0x3')],'defaultValue':function(){return rs[_0x330d('0x4')]();}},'phone':{'type':Sequelize[_0x330d('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x330d('0x5'),_0x330d('0x6'),_0x330d('0x7'),_0x330d('0x8'),_0x330d('0x9'),_0x330d('0xa'),_0x330d('0xb'),_0x330d('0xc'),_0x330d('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x330d('0x3')]},'authToken':{'type':Sequelize[_0x330d('0x3')]},'smsMethod':{'type':Sequelize[_0x330d('0xe')]('SI','TI','GP')},'username':{'type':Sequelize[_0x330d('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x330d('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x330d('0x3')]},'senderString':{'type':Sequelize[_0x330d('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x330d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x330d('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x330d('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x330d('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x330d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x330d('0x11')],'comment':_0x330d('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x330d('0x10')],'defaultValue':![],'comment':_0x330d('0x13'),'set':function(_0xad44e7){if(!_0xad44e7)this[_0x330d('0x14')](_0x330d('0x15'),null);this[_0x330d('0x14')]('mandatoryDisposition',_0xad44e7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index dd70fb7..ca0d7c1 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 _0x43da=['transaction','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','User','fullname','internal','Tag','color','tag','CmList','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','offset','undefined','count','set','json','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','attributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','Text','infobip','results','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','addApplications','sequelize'];(function(_0x3c27cd,_0x306687){var _0x2c488d=function(_0x10fb43){while(--_0x10fb43){_0x3c27cd['push'](_0x3c27cd['shift']());}};_0x2c488d(++_0x306687);}(_0x43da,0x119));var _0xa43d=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x43da[_0xe73080];return _0x12cbc4;};'use strict';var emlformat=require(_0xa43d('0x0'));var rimraf=require(_0xa43d('0x1'));var zipdir=require(_0xa43d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa43d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa43d('0x4'));var util=require(_0xa43d('0x5'));var path=require(_0xa43d('0x6'));var sox=require('sox');var csv=require(_0xa43d('0x7'));var ejs=require(_0xa43d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa43d('0x9'));var squel=require('squel');var crypto=require(_0xa43d('0xa'));var jsforce=require(_0xa43d('0xb'));var deskjs=require(_0xa43d('0xc'));var toCsv=require(_0xa43d('0x7'));var querystring=require('querystring');var Papa=require(_0xa43d('0xd'));var Redis=require(_0xa43d('0xe'));var authService=require(_0xa43d('0xf'));var qs=require(_0xa43d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa43d('0x11'));var logger=require(_0xa43d('0x12'))(_0xa43d('0x13'));var utils=require('../../config/utils');var config=require(_0xa43d('0x14'));var licenseUtil=require(_0xa43d('0x15'));var db=require(_0xa43d('0x16'))['db'];config['redis']=_[_0xa43d('0x17')](config[_0xa43d('0x18')],{'host':_0xa43d('0x19'),'port':0x18eb});var socket=require(_0xa43d('0x1a'))(new Redis(config[_0xa43d('0x18')]));require(_0xa43d('0x1b'))[_0xa43d('0x1c')](socket);var jayson=require(_0xa43d('0x1d'));var client=jayson['client'][_0xa43d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5a24a2,_0x2d5cb5,_0x9bbcf2,_0x207642){return new BPromise(function(_0x3632dc,_0x53ae4e){var _0xfc310a=_0x207642||client;return _0xfc310a[_0xa43d('0x1f')](_0x5a24a2,_0x9bbcf2)[_0xa43d('0x20')](function(_0x6afdc9){logger[_0xa43d('0x21')](_0xa43d('0x22'),_0x2d5cb5,_0xa43d('0x23'));logger[_0xa43d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d5cb5,_0xa43d('0x23'),JSON[_0xa43d('0x25')](_0x6afdc9));if(_0x6afdc9[_0xa43d('0x26')]){if(_0x6afdc9[_0xa43d('0x26')][_0xa43d('0x27')]===0x1f4){logger[_0xa43d('0x26')]('SmsAccount,\x20%s,\x20%s',_0x2d5cb5,_0x6afdc9[_0xa43d('0x26')][_0xa43d('0x28')]);return _0x53ae4e(_0x6afdc9['error'][_0xa43d('0x28')]);}logger[_0xa43d('0x26')](_0xa43d('0x22'),_0x2d5cb5,_0x6afdc9[_0xa43d('0x26')][_0xa43d('0x28')]);return _0x3632dc(_0x6afdc9[_0xa43d('0x26')]['message']);}else{logger[_0xa43d('0x21')]('SmsAccount,\x20%s,\x20%s',_0x2d5cb5,_0xa43d('0x23'));_0x3632dc(_0x6afdc9[_0xa43d('0x29')][_0xa43d('0x28')]);}})[_0xa43d('0x2a')](function(_0x21f09){logger['error'](_0xa43d('0x22'),_0x2d5cb5,_0x21f09);_0x53ae4e(_0x21f09);});});}function respondWithStatusCode(_0x142137,_0x294f93){_0x294f93=_0x294f93||0xcc;return function(_0x47138f){if(_0x47138f){return _0x142137['sendStatus'](_0x294f93);}return _0x142137[_0xa43d('0x2b')](_0x294f93)[_0xa43d('0x2c')]();};}function respondWithResult(_0x35a4ea,_0x1a0653){_0x1a0653=_0x1a0653||0xc8;return function(_0x4363e1){if(_0x4363e1){return _0x35a4ea[_0xa43d('0x2b')](_0x1a0653)['json'](_0x4363e1);}};}function respondWithFilteredResult(_0x309f6b,_0x2c6ade){return function(_0x465e0c){if(_0x465e0c){var _0x3774d7=typeof _0x2c6ade[_0xa43d('0x2d')]===_0xa43d('0x2e')&&typeof _0x2c6ade['limit']===_0xa43d('0x2e');var _0x367e54=_0x465e0c['count'];var _0x48db1b=_0x3774d7?0x0:_0x2c6ade[_0xa43d('0x2d')];var _0x45f617=_0x3774d7?_0x465e0c[_0xa43d('0x2f')]:_0x2c6ade[_0xa43d('0x2d')]+_0x2c6ade['limit'];var _0xb0d67b;if(_0x45f617>=_0x367e54){_0x45f617=_0x367e54;_0xb0d67b=0xc8;}else{_0xb0d67b=0xce;}_0x309f6b['status'](_0xb0d67b);return _0x309f6b[_0xa43d('0x30')]('Content-Range',_0x48db1b+'-'+_0x45f617+'/'+_0x367e54)[_0xa43d('0x31')](_0x465e0c);}return null;};}function patchUpdates(_0x58bd10){return function(_0x2e049a){try{jsonpatch[_0xa43d('0x32')](_0x2e049a,_0x58bd10,!![]);}catch(_0x28ea8f){return BPromise['reject'](_0x28ea8f);}return _0x2e049a[_0xa43d('0x33')]();};}function saveUpdates(_0x7c3125,_0x60b248){return function(_0x54d667){if(_0x54d667){return _0x54d667[_0xa43d('0x34')](_0x7c3125)['then'](function(_0x4f8ee1){return _0x4f8ee1;});}return null;};}function removeEntity(_0x267c29,_0x45668d){return function(_0x52b20f){if(_0x52b20f){return _0x52b20f[_0xa43d('0x35')]()[_0xa43d('0x20')](function(){var _0x2ba4ba=_0x52b20f[_0xa43d('0x36')]({'plain':!![]});var _0x2de03a=_0xa43d('0x37');return db[_0xa43d('0x38')][_0xa43d('0x35')]({'where':{'type':_0x2de03a,'resourceId':_0x2ba4ba['id']}})[_0xa43d('0x20')](function(){return _0x52b20f;});})[_0xa43d('0x20')](function(){_0x267c29[_0xa43d('0x2b')](0xcc)[_0xa43d('0x2c')]();});}};}function handleEntityNotFound(_0x4552c1,_0x23d0de){return function(_0x3c3f97){if(!_0x3c3f97){_0x4552c1[_0xa43d('0x39')](0x194);}return _0x3c3f97;};}function handleError(_0x36c539,_0x331c7f){_0x331c7f=_0x331c7f||0x1f4;return function(_0x571eaf){logger[_0xa43d('0x26')](_0x571eaf[_0xa43d('0x3a')]);if(_0x571eaf[_0xa43d('0x3b')]){delete _0x571eaf[_0xa43d('0x3b')];}_0x36c539['status'](_0x331c7f)[_0xa43d('0x3c')](_0x571eaf);};}exports[_0xa43d('0x3d')]=function(_0x3b4c7b,_0x3122c0){var _0x2d4e4e={'include':[{'model':db[_0xa43d('0x3e')],'as':_0xa43d('0x3f')}]},_0x10a18b={},_0x5560dd={'count':0x0,'rows':[]};var _0x514c11=_[_0xa43d('0x40')](db[_0xa43d('0x41')][_0xa43d('0x42')],function(_0xd87905){return{'name':_0xd87905[_0xa43d('0x43')],'type':_0xd87905[_0xa43d('0x44')][_0xa43d('0x45')]};});_0x10a18b[_0xa43d('0x46')]=_[_0xa43d('0x40')](_0x514c11,_0xa43d('0x3b'));_0x10a18b[_0xa43d('0x47')]=_[_0xa43d('0x48')](_0x3b4c7b['query']);_0x10a18b[_0xa43d('0x49')]=_[_0xa43d('0x4a')](_0x10a18b[_0xa43d('0x46')],_0x10a18b[_0xa43d('0x47')]);_0x2d4e4e['attributes']=_['intersection'](_0x10a18b['model'],qs['fields'](_0x3b4c7b[_0xa43d('0x47')][_0xa43d('0x4b')]));_0x2d4e4e['attributes']=_0x2d4e4e['attributes'][_0xa43d('0x4c')]?_0x2d4e4e['attributes']:_0x10a18b[_0xa43d('0x46')];if(!_0x3b4c7b[_0xa43d('0x47')][_0xa43d('0x4d')](_0xa43d('0x4e'))){_0x2d4e4e[_0xa43d('0x4f')]=qs[_0xa43d('0x4f')](_0x3b4c7b[_0xa43d('0x47')][_0xa43d('0x4f')]);_0x2d4e4e['offset']=qs[_0xa43d('0x2d')](_0x3b4c7b[_0xa43d('0x47')]['offset']);}_0x2d4e4e[_0xa43d('0x50')]=qs[_0xa43d('0x51')](_0x3b4c7b[_0xa43d('0x47')][_0xa43d('0x51')]);_0x2d4e4e[_0xa43d('0x52')]=qs[_0xa43d('0x49')](_[_0xa43d('0x53')](_0x3b4c7b[_0xa43d('0x47')],_0x10a18b[_0xa43d('0x49')]),_0x514c11);if(_0x3b4c7b[_0xa43d('0x47')][_0xa43d('0x54')]){_0x2d4e4e[_0xa43d('0x52')]=_['merge'](_0x2d4e4e[_0xa43d('0x52')],{'$or':_[_0xa43d('0x40')](_0x514c11,function(_0x250913){if(_0x250913['type']!==_0xa43d('0x55')){var _0x40eb4c={};_0x40eb4c[_0x250913[_0xa43d('0x3b')]]={'$like':'%'+_0x3b4c7b[_0xa43d('0x47')]['filter']+'%'};return _0x40eb4c;}})});}_0x2d4e4e=_[_0xa43d('0x56')]({},_0x2d4e4e,_0x3b4c7b[_0xa43d('0x57')]);var _0x494f02={'where':_0x2d4e4e['where']};return db[_0xa43d('0x41')][_0xa43d('0x2f')](_0x494f02)[_0xa43d('0x20')](function(_0x17fb91){_0x5560dd[_0xa43d('0x2f')]=_0x17fb91;if(_0x3b4c7b[_0xa43d('0x47')][_0xa43d('0x58')]){_0x2d4e4e[_0xa43d('0x59')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x2d4e4e);})[_0xa43d('0x20')](function(_0x551205){_0x5560dd[_0xa43d('0x5a')]=_0x551205;return _0x5560dd;})[_0xa43d('0x20')](respondWithFilteredResult(_0x3122c0,_0x2d4e4e))['catch'](handleError(_0x3122c0,null));};exports[_0xa43d('0x5b')]=function(_0x2f2e06,_0x32c2e7){var _0x18f2ba={'raw':![],'where':{'id':_0x2f2e06[_0xa43d('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xa43d('0x3f')}]},_0x2f22ff={};_0x2f22ff['model']=_['keys'](db[_0xa43d('0x41')][_0xa43d('0x42')]);_0x2f22ff[_0xa43d('0x47')]=_['keys'](_0x2f2e06[_0xa43d('0x47')]);_0x2f22ff['filters']=_['intersection'](_0x2f22ff[_0xa43d('0x46')],_0x2f22ff[_0xa43d('0x47')]);_0x18f2ba[_0xa43d('0x5d')]=_[_0xa43d('0x4a')](_0x2f22ff[_0xa43d('0x46')],qs[_0xa43d('0x4b')](_0x2f2e06[_0xa43d('0x47')][_0xa43d('0x4b')]));_0x18f2ba[_0xa43d('0x5d')]=_0x18f2ba[_0xa43d('0x5d')][_0xa43d('0x4c')]?_0x18f2ba['attributes']:_0x2f22ff[_0xa43d('0x46')];if(_0x2f2e06[_0xa43d('0x47')][_0xa43d('0x58')]){_0x18f2ba[_0xa43d('0x59')]=[{'all':!![]}];}_0x18f2ba=_[_0xa43d('0x56')]({},_0x18f2ba,_0x2f2e06[_0xa43d('0x57')]);return db[_0xa43d('0x41')][_0xa43d('0x5e')](_0x18f2ba)[_0xa43d('0x20')](handleEntityNotFound(_0x32c2e7,null))[_0xa43d('0x20')](respondWithResult(_0x32c2e7,null))[_0xa43d('0x2a')](handleError(_0x32c2e7,null));};exports[_0xa43d('0x5f')]=function(_0x1846d5,_0x590a5f){return db[_0xa43d('0x41')][_0xa43d('0x5f')](_0x1846d5[_0xa43d('0x60')],{})[_0xa43d('0x20')](function(_0x2a67d1){var _0x60528d=_0x1846d5[_0xa43d('0x61')][_0xa43d('0x36')]({'plain':!![]});if(!_0x60528d)throw new Error(_0xa43d('0x62'));if(_0x60528d[_0xa43d('0x63')]===_0xa43d('0x61')){var _0x5b0b7a=_0x2a67d1[_0xa43d('0x36')]({'plain':!![]});var _0x1e7266='SmsAccounts';return db[_0xa43d('0x64')]['find']({'where':{'name':_0x1e7266,'userProfileId':_0x60528d[_0xa43d('0x65')]},'raw':!![]})[_0xa43d('0x20')](function(_0x5050f9){if(_0x5050f9&&_0x5050f9[_0xa43d('0x66')]===0x0){return db[_0xa43d('0x38')]['create']({'name':_0x5b0b7a['name'],'resourceId':_0x5b0b7a['id'],'type':_0x5050f9['name'],'sectionId':_0x5050f9['id']},{})[_0xa43d('0x20')](function(){return _0x2a67d1;});}else{return _0x2a67d1;}})['catch'](function(_0x30adcd){logger[_0xa43d('0x26')](_0xa43d('0x67'),_0x30adcd);throw _0x30adcd;});}return _0x2a67d1;})[_0xa43d('0x20')](respondWithResult(_0x590a5f,0xc9))[_0xa43d('0x2a')](handleError(_0x590a5f,null));};exports['update']=function(_0x195059,_0x4904c5){if(_0x195059[_0xa43d('0x60')]['id']){delete _0x195059[_0xa43d('0x60')]['id'];}return db['SmsAccount'][_0xa43d('0x5e')]({'where':{'id':_0x195059[_0xa43d('0x5c')]['id']},'include':[{'model':db[_0xa43d('0x3e')],'as':_0xa43d('0x3f')}]})['then'](handleEntityNotFound(_0x4904c5,null))[_0xa43d('0x20')](saveUpdates(_0x195059['body'],null))['then'](respondWithResult(_0x4904c5,null))['catch'](handleError(_0x4904c5,null));};exports[_0xa43d('0x35')]=function(_0x43bdc9,_0x1290b2){return db[_0xa43d('0x41')][_0xa43d('0x5e')]({'where':{'id':_0x43bdc9['params']['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x1290b2,null))['then'](removeEntity(_0x1290b2,null))[_0xa43d('0x2a')](handleError(_0x1290b2,null));};exports[_0xa43d('0x68')]=function(_0x4626d0,_0x3eecfd){return db['SmsAccount'][_0xa43d('0x68')]()['then'](respondWithResult(_0x3eecfd,null))[_0xa43d('0x2a')](handleError(_0x3eecfd,null));};exports[_0xa43d('0x69')]=function(_0x400655,_0x5c0392,_0x4f6a74){if(_0x400655[_0xa43d('0x60')]['id']){delete _0x400655[_0xa43d('0x60')]['id'];}return db['SmsAccount'][_0xa43d('0x5e')]({'where':{'id':_0x400655[_0xa43d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5c0392,null))[_0xa43d('0x20')](function(_0x2b5732){if(_0x2b5732){_0x400655[_0xa43d('0x60')][_0xa43d('0x6a')]=_0x2b5732['id'];return db[_0xa43d('0x6b')][_0xa43d('0x5f')](_0x400655[_0xa43d('0x60')]);}})['then'](respondWithResult(_0x5c0392,null))['catch'](handleError(_0x5c0392,null));};exports[_0xa43d('0x6c')]=function(_0x3970e9,_0x5c3c36,_0x682302){var _0x3a14d5={'raw':![],'where':{}};var _0x5b18f6={};var _0x57293a={'count':0x0,'rows':[]};return db[_0xa43d('0x41')][_0xa43d('0x6d')]({'where':{'id':_0x3970e9['params']['id']}})['then'](handleEntityNotFound(_0x5c3c36,null))[_0xa43d('0x20')](function(_0x2b4fae){if(_0x2b4fae){_0x5b18f6[_0xa43d('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x5b18f6[_0xa43d('0x47')]=_[_0xa43d('0x48')](_0x3970e9[_0xa43d('0x47')]);_0x5b18f6[_0xa43d('0x49')]=_[_0xa43d('0x4a')](_0x5b18f6[_0xa43d('0x46')],_0x5b18f6[_0xa43d('0x47')]);_0x3a14d5[_0xa43d('0x5d')]=_[_0xa43d('0x4a')](_0x5b18f6[_0xa43d('0x46')],qs[_0xa43d('0x4b')](_0x3970e9[_0xa43d('0x47')][_0xa43d('0x4b')]));_0x3a14d5[_0xa43d('0x5d')]=_0x3a14d5[_0xa43d('0x5d')][_0xa43d('0x4c')]?_0x3a14d5[_0xa43d('0x5d')]:_0x5b18f6[_0xa43d('0x46')];if(!_0x3970e9[_0xa43d('0x47')][_0xa43d('0x4d')](_0xa43d('0x4e'))){_0x3a14d5[_0xa43d('0x4f')]=qs[_0xa43d('0x4f')](_0x3970e9['query']['limit']);_0x3a14d5[_0xa43d('0x2d')]=qs[_0xa43d('0x2d')](_0x3970e9[_0xa43d('0x47')][_0xa43d('0x2d')]);}_0x3a14d5['order']=qs[_0xa43d('0x51')](_0x3970e9[_0xa43d('0x47')][_0xa43d('0x51')]);_0x3a14d5['where']=qs['filters'](_[_0xa43d('0x53')](_0x3970e9[_0xa43d('0x47')],_0x5b18f6[_0xa43d('0x49')]));_0x3a14d5[_0xa43d('0x52')][_0xa43d('0x6a')]=_0x2b4fae['id'];if(_0x3970e9['query']['filter']){_0x3a14d5['where']=_['merge'](_0x3a14d5[_0xa43d('0x52')],{'$or':_[_0xa43d('0x40')](_0x3a14d5['attributes'],function(_0x11ba9c){var _0x331ab0={};_0x331ab0[_0x11ba9c]={'$like':'%'+_0x3970e9[_0xa43d('0x47')][_0xa43d('0x54')]+'%'};return _0x331ab0;})});}_0x3a14d5=_[_0xa43d('0x56')]({},_0x3a14d5,_0x3970e9[_0xa43d('0x57')]);return db[_0xa43d('0x6b')][_0xa43d('0x2f')]({'where':_0x3a14d5['where']})[_0xa43d('0x20')](function(_0x3d751b){_0x57293a[_0xa43d('0x2f')]=_0x3d751b;if(_0x3970e9[_0xa43d('0x47')][_0xa43d('0x58')]){_0x3a14d5[_0xa43d('0x59')]=[{'all':!![]}];}return db[_0xa43d('0x6b')][_0xa43d('0x6e')](_0x3a14d5);})[_0xa43d('0x20')](function(_0x5cf067){_0x57293a[_0xa43d('0x5a')]=_0x5cf067;return _0x57293a;});}})[_0xa43d('0x20')](respondWithFilteredResult(_0x5c3c36,_0x3a14d5))[_0xa43d('0x2a')](handleError(_0x5c3c36,null));};exports['removeDispositions']=function(_0x29a511,_0x2a4b62,_0x38496d){return db[_0xa43d('0x41')]['find']({'where':{'id':_0x29a511['params']['id']}})['then'](handleEntityNotFound(_0x2a4b62,null))[_0xa43d('0x20')](function(_0x4a0ac9){if(_0x4a0ac9){return _0x4a0ac9[_0xa43d('0x6f')](_0x29a511['query'][_0xa43d('0x70')]);}})[_0xa43d('0x20')](respondWithStatusCode(_0x2a4b62,null))[_0xa43d('0x2a')](handleError(_0x2a4b62,null));};exports[_0xa43d('0x71')]=function(_0xc453ac,_0x46bf37,_0x4287a8){if(_0xc453ac[_0xa43d('0x60')]['id']){delete _0xc453ac[_0xa43d('0x60')]['id'];}return db[_0xa43d('0x41')][_0xa43d('0x5e')]({'where':{'id':_0xc453ac[_0xa43d('0x5c')]['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x46bf37,null))[_0xa43d('0x20')](function(_0x4c05d5){if(_0x4c05d5){_0xc453ac[_0xa43d('0x60')][_0xa43d('0x6a')]=_0x4c05d5['id'];return db[_0xa43d('0x72')][_0xa43d('0x5f')](_0xc453ac[_0xa43d('0x60')]);}})[_0xa43d('0x20')](respondWithResult(_0x46bf37,null))['catch'](handleError(_0x46bf37,null));};exports['getAnswers']=function(_0x23622a,_0x541182,_0x81b7b3){var _0x41c90c={'raw':![],'where':{}};var _0x4c06b5={};var _0x305502={'count':0x0,'rows':[]};return db[_0xa43d('0x41')]['findOne']({'where':{'id':_0x23622a[_0xa43d('0x5c')]['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x541182,null))['then'](function(_0x4bd6ce){if(_0x4bd6ce){_0x4c06b5[_0xa43d('0x46')]=_['keys'](db['CannedAnswer'][_0xa43d('0x42')]);_0x4c06b5[_0xa43d('0x47')]=_[_0xa43d('0x48')](_0x23622a[_0xa43d('0x47')]);_0x4c06b5[_0xa43d('0x49')]=_[_0xa43d('0x4a')](_0x4c06b5[_0xa43d('0x46')],_0x4c06b5[_0xa43d('0x47')]);_0x41c90c[_0xa43d('0x5d')]=_[_0xa43d('0x4a')](_0x4c06b5[_0xa43d('0x46')],qs[_0xa43d('0x4b')](_0x23622a['query'][_0xa43d('0x4b')]));_0x41c90c[_0xa43d('0x5d')]=_0x41c90c[_0xa43d('0x5d')][_0xa43d('0x4c')]?_0x41c90c[_0xa43d('0x5d')]:_0x4c06b5[_0xa43d('0x46')];if(!_0x23622a[_0xa43d('0x47')][_0xa43d('0x4d')]('nolimit')){_0x41c90c[_0xa43d('0x4f')]=qs[_0xa43d('0x4f')](_0x23622a[_0xa43d('0x47')]['limit']);_0x41c90c[_0xa43d('0x2d')]=qs['offset'](_0x23622a[_0xa43d('0x47')][_0xa43d('0x2d')]);}_0x41c90c[_0xa43d('0x50')]=qs[_0xa43d('0x51')](_0x23622a[_0xa43d('0x47')]['sort']);_0x41c90c[_0xa43d('0x52')]=qs[_0xa43d('0x49')](_[_0xa43d('0x53')](_0x23622a[_0xa43d('0x47')],_0x4c06b5[_0xa43d('0x49')]));_0x41c90c[_0xa43d('0x52')][_0xa43d('0x6a')]=_0x4bd6ce['id'];if(_0x23622a[_0xa43d('0x47')][_0xa43d('0x54')]){_0x41c90c[_0xa43d('0x52')]=_[_0xa43d('0x56')](_0x41c90c[_0xa43d('0x52')],{'$or':_[_0xa43d('0x40')](_0x41c90c[_0xa43d('0x5d')],function(_0x4d3a35){var _0x3541c2={};_0x3541c2[_0x4d3a35]={'$like':'%'+_0x23622a[_0xa43d('0x47')][_0xa43d('0x54')]+'%'};return _0x3541c2;})});}_0x41c90c=_['merge']({},_0x41c90c,_0x23622a[_0xa43d('0x57')]);return db[_0xa43d('0x72')]['count']({'where':_0x41c90c[_0xa43d('0x52')]})['then'](function(_0x4b1346){_0x305502[_0xa43d('0x2f')]=_0x4b1346;if(_0x23622a['query']['includeAll']){_0x41c90c[_0xa43d('0x59')]=[{'all':!![]}];}return db[_0xa43d('0x72')][_0xa43d('0x6e')](_0x41c90c);})[_0xa43d('0x20')](function(_0x350920){_0x305502['rows']=_0x350920;return _0x305502;});}})[_0xa43d('0x20')](respondWithFilteredResult(_0x541182,_0x41c90c))[_0xa43d('0x2a')](handleError(_0x541182,null));};exports[_0xa43d('0x73')]=function(_0x40c905,_0x54e9a7,_0x709475){return db['SmsAccount'][_0xa43d('0x5e')]({'where':{'id':_0x40c905[_0xa43d('0x5c')]['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x54e9a7,null))[_0xa43d('0x20')](function(_0x31e347){if(_0x31e347){return _0x31e347['removeAnswers'](_0x40c905[_0xa43d('0x47')][_0xa43d('0x70')]);}})[_0xa43d('0x20')](respondWithStatusCode(_0x54e9a7,null))[_0xa43d('0x2a')](handleError(_0x54e9a7,null));};exports[_0xa43d('0x74')]=function(_0x55cf6,_0xf3b5c9,_0x3b75b8){var _0x234b2b={'channel':_0xa43d('0x75')};var _0x162a37=[];var _0x4135ab=[];var _0x12ca6b={};return db[_0xa43d('0x41')][_0xa43d('0x5e')]({'where':{'id':_0x55cf6['params']['id']},'include':[{'model':db[_0xa43d('0x76')],'as':_0xa43d('0x77')}]})[_0xa43d('0x20')](handleEntityNotFound(_0xf3b5c9,null))[_0xa43d('0x20')](function(_0x227f64){_0x234b2b[_0xa43d('0x78')]=_0x227f64;_0x234b2b['applications']=_['orderBy'](_0x227f64[_0xa43d('0x77')],['priority'],[_0xa43d('0x79')]);if(_0x234b2b[_0xa43d('0x78')][_0xa43d('0x77')]){delete _0x234b2b['account']['Applications'];}return db[_0xa43d('0x7a')]['describe']();})[_0xa43d('0x20')](function(_0x78e5aa){if(!_0x78e5aa){throw new db['Sequelize'][(_0xa43d('0x7b'))](_0xa43d('0x7c'));}_0x162a37=_[_0xa43d('0x7d')](_[_0xa43d('0x48')](_0x78e5aa),[_0xa43d('0x7e'),_0xa43d('0x7f')]);_0x4135ab=_[_0xa43d('0x7d')](_['keys'](_0x78e5aa),[_0xa43d('0x7e'),_0xa43d('0x7f'),_0xa43d('0x80'),_0xa43d('0x81')]);_0x234b2b[_0xa43d('0x60')]={'mapKey':_0xa43d('0x82')};if(_0x234b2b['account'][_0xa43d('0x44')]){switch(_0x234b2b[_0xa43d('0x78')][_0xa43d('0x44')]){case'twilio':_0x234b2b['body'][_0xa43d('0x83')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x84')];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x60')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x85')];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x86')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x87')];break;case _0xa43d('0x88'):_0x234b2b[_0xa43d('0x60')]['from']='+'+_0x55cf6['body']['sender'];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x60')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x89')];break;case _0xa43d('0x8a'):_0x234b2b['body'][_0xa43d('0x83')]=_0x55cf6[_0xa43d('0x60')]['from'];_0x234b2b['body'][_0xa43d('0x60')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x28')];break;case _0xa43d('0x8b'):_0x234b2b[_0xa43d('0x60')]['from']=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x83')];_0x234b2b[_0xa43d('0x60')]['body']=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x60')];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x86')]=_0x55cf6['body'][_0xa43d('0x8c')];break;case _0xa43d('0x8d'):_0x234b2b['body'][_0xa43d('0x83')]=_0x55cf6['body'][_0xa43d('0x84')];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x60')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x8e')];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x86')]=_0x55cf6[_0xa43d('0x60')]['MessageUUID'];break;case _0xa43d('0x8f'):_0x234b2b['body']['from']='+'+_0x55cf6[_0xa43d('0x60')][_0xa43d('0x90')][0x0][_0xa43d('0x83')];_0x234b2b['body'][_0xa43d('0x60')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x90')][0x0][_0xa43d('0x89')];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x86')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x90')][0x0][_0xa43d('0x86')];break;case'csc':_0x234b2b[_0xa43d('0x60')]['from']=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x91')];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x60')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x92')]['message'];break;case'clickatell':_0x234b2b[_0xa43d('0x60')]['from']=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x93')];_0x234b2b[_0xa43d('0x60')]['body']=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x89')];_0x234b2b[_0xa43d('0x60')]['messageId']=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x94')];break;case _0xa43d('0x95'):_0x234b2b[_0xa43d('0x60')][_0xa43d('0x86')]=_0x55cf6[_0xa43d('0x60')][0x0][_0xa43d('0x28')]['id'];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x83')]=_0x55cf6[_0xa43d('0x60')][0x0][_0xa43d('0x28')]['from'];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x60')]=_0x55cf6[_0xa43d('0x60')][0x0][_0xa43d('0x28')][_0xa43d('0x89')];break;case _0xa43d('0x96'):_0x234b2b['body'][_0xa43d('0x83')]=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x83')];_0x234b2b[_0xa43d('0x60')]['body']=_0x55cf6[_0xa43d('0x60')][_0xa43d('0x28')];_0x234b2b[_0xa43d('0x60')][_0xa43d('0x86')]=_0x55cf6['body'][_0xa43d('0x97')];break;}}if(_0x234b2b[_0xa43d('0x60')]['id']){delete _0x234b2b[_0xa43d('0x60')]['id'];}if(_[_0xa43d('0x98')](_0x234b2b['body'][_0xa43d('0x83')])){throw new db['Sequelize']['ValidationError'](_0xa43d('0x99'));}if(_['isNil'](_0x234b2b['body'][_0xa43d('0x60')])||_0x234b2b['body'][_0xa43d('0x60')]===''){throw new db[(_0xa43d('0x9a'))]['ValidationError'](_0xa43d('0x9b'));}if(_[_0xa43d('0x98')](_0x234b2b['body'][_0xa43d('0x9c')])){throw new db[(_0xa43d('0x9a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4135ab);}if(!_[_0xa43d('0x9d')](_0x4135ab,_0x234b2b['body'][_0xa43d('0x9c')])){throw new db['Sequelize'][(_0xa43d('0x7b'))](_0xa43d('0x9e')+_0x4135ab);}_0x12ca6b[_0x234b2b[_0xa43d('0x60')]['mapKey']]=_0x234b2b[_0xa43d('0x60')][_0xa43d('0x83')];return db['CmList'][_0xa43d('0x5e')]({'where':{'id':_0x234b2b['account'][_0xa43d('0x81')]},'include':[{'model':db['CmContact'],'as':_0xa43d('0x9f'),'where':_0x12ca6b,'limit':0x1,'order':[['updatedAt',_0xa43d('0xa0')]]}]});})[_0xa43d('0x20')](handleEntityNotFound(_0xf3b5c9,null))[_0xa43d('0x20')](function(_0x562155){if(_0x562155){_0x234b2b[_0xa43d('0xa1')]=_[_0xa43d('0xa2')](_0x562155,[_0xa43d('0x9f')]);if(_0x562155[_0xa43d('0x9f')][_0xa43d('0x4c')]){return _0x562155[_0xa43d('0x9f')][0x0];}var _0x227003=_['defaults'](_0x234b2b[_0xa43d('0x60')],{'firstName':_0x234b2b[_0xa43d('0x60')][_0xa43d('0x83')],'ListId':_0x562155['id']});_0x227003[_0x234b2b['body']['mapKey']]=_0x234b2b[_0xa43d('0x60')][_0xa43d('0x83')];return db[_0xa43d('0x7a')][_0xa43d('0x5f')](_0x227003,{'fields':_0x162a37,'raw':!![]});}})[_0xa43d('0x20')](handleEntityNotFound(_0xf3b5c9,null))['then'](function(_0x18d226){if(_0x18d226){_0x234b2b[_0xa43d('0xa3')]=_0x18d226;var _0x8bec60={'ContactId':_0x18d226['id'],'phone':_0x234b2b[_0xa43d('0x60')][_0xa43d('0x83')],'SmsAccountId':_0x55cf6['params']['id']};var _0x28c0f8={'ContactId':_0x18d226['id'],'SmsAccountId':_0x55cf6[_0xa43d('0x5c')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x28c0f8})[_0xa43d('0x20')](function(_0x23b0e0){if(_0x23b0e0){return[_0x23b0e0,![]];}return db[_0xa43d('0xa4')][_0xa43d('0x5f')](_0x8bec60)[_0xa43d('0x20')](function(_0x9d084b){return[_0x9d084b,!![]];});});}})[_0xa43d('0xa5')](function(_0x169f04,_0x469be5){_0x234b2b[_0xa43d('0xa6')]=_0x169f04[_0xa43d('0x36')]({'plain':!![]});_0x234b2b['interaction'][_0xa43d('0xa7')]=![];if(_0x469be5){if(_0x234b2b[_0xa43d('0x78')][_0xa43d('0xa8')]){_0x234b2b[_0xa43d('0xa9')][_0xa43d('0xaa')]({'id':0x0,'priority':_0x234b2b[_0xa43d('0xa9')][_0xa43d('0x4c')]+0x1,'app':'close','appdata':_0xa43d('0xab'),'interval':_0xa43d('0xac')});}_0x234b2b[_0xa43d('0xa6')][_0xa43d('0xa7')]=!![];}return db[_0xa43d('0xad')]['create']({'phone':_0x234b2b['body']['from'],'messageId':_0x234b2b[_0xa43d('0x60')][_0xa43d('0x86')],'body':_0x234b2b[_0xa43d('0x60')][_0xa43d('0x60')],'SmsAccountId':_0x55cf6[_0xa43d('0x5c')]['id'],'SmsInteractionId':_0x169f04['id'],'direction':'in','ContactId':_0x169f04[_0xa43d('0xae')],'AttachmentId':_0x234b2b[_0xa43d('0x60')][_0xa43d('0xaf')]});})['then'](function(_0x1d87b6){_0x234b2b['message']=_0x1d87b6;if(_0x234b2b[_0xa43d('0xa6')]['UserId']){return db['User'][_0xa43d('0x5e')]({'attributes':['id',_0xa43d('0x3b')],'where':{'id':_0x234b2b[_0xa43d('0xa6')][_0xa43d('0xb0')]}})[_0xa43d('0x20')](function(_0x5d7e36){if(_0x5d7e36){_0x234b2b[_0xa43d('0xa9')][_0xa43d('0xb1')]({'id':0x0,'priority':0x0,'app':_0xa43d('0xb2'),'appdata':_0x5d7e36['name']+','+(_0x234b2b[_0xa43d('0x78')][_0xa43d('0xb3')]||0xa),'interval':_0xa43d('0xac')});}return respondWithRpcPromise(_0xa43d('0xb4'),_0xa43d('0xb5'),_0x234b2b);});}return respondWithRpcPromise(_0xa43d('0xb4'),_0xa43d('0xb5'),_0x234b2b);})[_0xa43d('0x20')](function(_0x43df68){if(_0x43df68){var _0x12d3b3=0xc8;var _0x568909=_0xa43d('0xb6');logger['info'](_0xa43d('0xb7'),_0x568909,_0x12d3b3,_0xa43d('0xb8'));logger['debug'](_0xa43d('0xb9'),_0x568909,_0x12d3b3,_0xa43d('0xb8'),JSON[_0xa43d('0x25')](_0x43df68));if(_0x234b2b['account'][_0xa43d('0x44')]===_0xa43d('0xba')){return _0xf3b5c9['status'](_0x12d3b3)['set']('Content-Type',_0xa43d('0xbb'))['send'](_0xa43d('0xbc'));}else{return _0xf3b5c9[_0xa43d('0x2b')](_0x12d3b3)['json'](_0x43df68);}}})['catch'](handleError(_0xf3b5c9,null));};exports[_0xa43d('0xbd')]=function(_0x34c0e1,_0x52eb1d,_0x2e690b){return db[_0xa43d('0x41')][_0xa43d('0x6d')]({'where':{'id':_0x34c0e1[_0xa43d('0x5c')]['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x52eb1d,null))['then'](function(_0x12df83){if(_0x12df83){return db[_0xa43d('0xbe')][_0xa43d('0xbf')](function(_0x28e8b6){return db['SmsApplication'][_0xa43d('0x35')]({'where':{'SmsAccountId':_0x34c0e1[_0xa43d('0x5c')]['id']},'transaction':_0x28e8b6})[_0xa43d('0x20')](function(_0x5a65dc){var _0x138a27=_[_0xa43d('0x40')](_0x34c0e1['body'],function(_0x1f06a5){_0x1f06a5[_0xa43d('0x6a')]=_0x34c0e1[_0xa43d('0x5c')]['id'];return _0x1f06a5;});return db[_0xa43d('0x76')][_0xa43d('0xc0')](_0x138a27,{'transaction':_0x28e8b6});});})['then'](function(){return db[_0xa43d('0x76')][_0xa43d('0xc1')]({'where':{'SmsAccountId':_0x34c0e1['params']['id']},'order':_0xa43d('0xc2')});});}})[_0xa43d('0x20')](respondWithResult(_0x52eb1d,null))['catch'](handleError(_0x52eb1d,null));};exports[_0xa43d('0xc3')]=function(_0x2eabee,_0x17f8b2,_0x40a3d1){var _0x3c804a={};var _0x3f46bf={};var _0x5d6ee3;var _0x429f92;return db[_0xa43d('0x41')][_0xa43d('0x6d')]({'where':{'id':_0x2eabee[_0xa43d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x17f8b2,null))['then'](function(_0x26a62f){if(_0x26a62f){_0x5d6ee3=_0x26a62f;_0x3f46bf[_0xa43d('0x46')]=_[_0xa43d('0x48')](db['SmsApplication']['rawAttributes']);_0x3f46bf[_0xa43d('0x47')]=_[_0xa43d('0x48')](_0x2eabee[_0xa43d('0x47')]);_0x3f46bf[_0xa43d('0x49')]=_['intersection'](_0x3f46bf[_0xa43d('0x46')],_0x3f46bf[_0xa43d('0x47')]);_0x3c804a[_0xa43d('0x5d')]=_[_0xa43d('0x4a')](_0x3f46bf[_0xa43d('0x46')],qs['fields'](_0x2eabee[_0xa43d('0x47')][_0xa43d('0x4b')]));_0x3c804a[_0xa43d('0x5d')]=_0x3c804a[_0xa43d('0x5d')][_0xa43d('0x4c')]?_0x3c804a[_0xa43d('0x5d')]:_0x3f46bf[_0xa43d('0x46')];_0x3c804a[_0xa43d('0x50')]=qs[_0xa43d('0x51')](_0x2eabee[_0xa43d('0x47')][_0xa43d('0x51')]);_0x3c804a[_0xa43d('0x52')]=qs[_0xa43d('0x49')](_[_0xa43d('0x53')](_0x2eabee[_0xa43d('0x47')],_0x3f46bf['filters']));if(_0x2eabee['query']['filter']){_0x3c804a[_0xa43d('0x52')]=_[_0xa43d('0x56')](_0x3c804a[_0xa43d('0x52')],{'$or':_[_0xa43d('0x40')](_0x3c804a[_0xa43d('0x5d')],function(_0x5a7a78){var _0x1aa050={};_0x1aa050[_0x5a7a78]={'$like':'%'+_0x2eabee[_0xa43d('0x47')][_0xa43d('0x54')]+'%'};return _0x1aa050;})});}_0x3c804a=_[_0xa43d('0x56')]({},_0x3c804a,_0x2eabee['options']);return _0x5d6ee3[_0xa43d('0xc3')](_0x3c804a);}})[_0xa43d('0x20')](function(_0x49e0dd){if(_0x49e0dd){_0x429f92=_0x49e0dd[_0xa43d('0x4c')];if(!_0x2eabee[_0xa43d('0x47')][_0xa43d('0x4d')]('nolimit')){_0x3c804a[_0xa43d('0x4f')]=qs[_0xa43d('0x4f')](_0x2eabee[_0xa43d('0x47')][_0xa43d('0x4f')]);_0x3c804a[_0xa43d('0x2d')]=qs['offset'](_0x2eabee[_0xa43d('0x47')][_0xa43d('0x2d')]);}return _0x5d6ee3[_0xa43d('0xc3')](_0x3c804a);}})[_0xa43d('0x20')](function(_0xbc3f66){if(_0xbc3f66){return _0xbc3f66?{'count':_0x429f92,'rows':_0xbc3f66}:null;}})[_0xa43d('0x20')](respondWithResult(_0x17f8b2,null))[_0xa43d('0x2a')](handleError(_0x17f8b2,null));};exports[_0xa43d('0xc4')]=function(_0x462b2c,_0x482684,_0x4c31f9){var _0x106481={'raw':![],'where':{}};var _0xe50840={};var _0x418814={'count':0x0,'rows':[]};return db[_0xa43d('0x41')][_0xa43d('0x6d')]({'where':{'id':_0x462b2c[_0xa43d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x482684,null))[_0xa43d('0x20')](function(_0x187ea2){if(_0x187ea2){_0xe50840[_0xa43d('0x46')]=_[_0xa43d('0x48')](db[_0xa43d('0xa4')][_0xa43d('0x42')]);_0xe50840[_0xa43d('0x47')]=_[_0xa43d('0x48')](_0x462b2c[_0xa43d('0x47')]);_0xe50840['filters']=_['intersection'](_0xe50840[_0xa43d('0x46')],_0xe50840[_0xa43d('0x47')]);_0x106481[_0xa43d('0x5d')]=_['intersection'](_0xe50840[_0xa43d('0x46')],qs[_0xa43d('0x4b')](_0x462b2c[_0xa43d('0x47')][_0xa43d('0x4b')]));_0x106481[_0xa43d('0x5d')]=_0x106481[_0xa43d('0x5d')]['length']?_0x106481['attributes']:_0xe50840['model'];if(!_0x462b2c[_0xa43d('0x47')][_0xa43d('0x4d')](_0xa43d('0x4e'))){_0x106481[_0xa43d('0x4f')]=qs[_0xa43d('0x4f')](_0x462b2c[_0xa43d('0x47')][_0xa43d('0x4f')]);_0x106481[_0xa43d('0x2d')]=qs[_0xa43d('0x2d')](_0x462b2c[_0xa43d('0x47')]['offset']);}_0x106481['order']=qs[_0xa43d('0x51')](_0x462b2c[_0xa43d('0x47')][_0xa43d('0x51')]);_0x106481['where']=qs['filters'](_[_0xa43d('0x53')](_0x462b2c[_0xa43d('0x47')],_0xe50840[_0xa43d('0x49')]));_0x106481[_0xa43d('0x52')][_0xa43d('0x6a')]=_0x187ea2['id'];if(_0x462b2c[_0xa43d('0x47')][_0xa43d('0x54')]){_0x106481[_0xa43d('0x52')]=_[_0xa43d('0x56')](_0x106481[_0xa43d('0x52')],{'$or':_[_0xa43d('0x40')](_0x106481[_0xa43d('0x5d')],function(_0x4be1cd){var _0x29e8b3={};_0x29e8b3[_0x4be1cd]={'$like':'%'+_0x462b2c[_0xa43d('0x47')][_0xa43d('0x54')]+'%'};return _0x29e8b3;})});}_0x106481=_[_0xa43d('0x56')]({},_0x106481,_0x462b2c[_0xa43d('0x57')]);return db[_0xa43d('0xa4')]['count']({'where':_0x106481[_0xa43d('0x52')]})[_0xa43d('0x20')](function(_0x448809){_0x418814[_0xa43d('0x2f')]=_0x448809;if(_0x462b2c['query'][_0xa43d('0x58')]){_0x106481[_0xa43d('0x59')]=[{'model':db[_0xa43d('0x7a')],'as':_0xa43d('0xc5'),'required':![]},{'model':db[_0xa43d('0xc6')],'as':'Owner','attributes':['name',_0xa43d('0xc7'),_0xa43d('0xc8')],'required':![]},{'model':db[_0xa43d('0xc9')],'as':'Tags','attributes':['id','name',_0xa43d('0xca')],'where':_0x462b2c[_0xa43d('0x47')][_0xa43d('0xcb')]?{'id':_0x462b2c[_0xa43d('0x47')][_0xa43d('0xcb')]}:undefined,'required':_0x462b2c[_0xa43d('0x47')][_0xa43d('0xcb')]?!![]:![]}];}return db['SmsInteraction'][_0xa43d('0x6e')](_0x106481);})[_0xa43d('0x20')](function(_0x37cc77){_0x418814[_0xa43d('0x5a')]=_0x37cc77;return _0x418814;});}})[_0xa43d('0x20')](respondWithFilteredResult(_0x482684,_0x106481))[_0xa43d('0x2a')](handleError(_0x482684,null));};exports[_0xa43d('0x3c')]=function(_0x290539,_0x572911,_0x47e159){var _0x14a1b7,_0x364525,_0xbf5d64;if(_[_0xa43d('0x98')](_0x290539['body'][_0xa43d('0x60')])||_0x290539[_0xa43d('0x60')][_0xa43d('0x60')]===''){throw new db[(_0xa43d('0x9a'))][(_0xa43d('0x7b'))](_0xa43d('0x9b'));}if(_[_0xa43d('0x98')](_0x290539[_0xa43d('0x60')]['to'])){throw new db[(_0xa43d('0x9a'))]['ValidationError']('to\x20is\x20mandatory');}_0x14a1b7=_0x290539[_0xa43d('0x60')]['to'];return db['SmsAccount'][_0xa43d('0x5e')]({'where':{'id':_0x290539[_0xa43d('0x5c')]['id']},'include':[{'model':db[_0xa43d('0xcc')],'as':_0xa43d('0xcd'),'include':[{'model':db[_0xa43d('0x7a')],'as':'Contacts','where':{'mobile':_0x14a1b7},'limit':0x1,'order':[[_0xa43d('0x7f'),_0xa43d('0xa0')]]}]}]})[_0xa43d('0x20')](handleEntityNotFound(_0x572911,null))[_0xa43d('0x20')](function(_0x395010){if(_0x395010&&_0x395010['List']){_0x364525=_0x395010[_0xa43d('0x36')]({'plain':!![]});if(_0x364525[_0xa43d('0xcd')]&&_0x364525[_0xa43d('0xcd')]['Contacts']['length']){return _0x364525[_0xa43d('0xcd')]['Contacts'][0x0];}return db[_0xa43d('0x7a')][_0xa43d('0x5f')](_[_0xa43d('0x17')](_0x290539[_0xa43d('0x60')],{'firstName':_0x14a1b7,'mobile':_0x14a1b7,'phone':_0x14a1b7,'ListId':_0x364525[_0xa43d('0x81')]}));}})['then'](handleEntityNotFound(_0x572911,null))['then'](function(_0x337d0d){if(_0x337d0d){_0xbf5d64=_0x337d0d;return db[_0xa43d('0xa4')]['find']({'where':{'ContactId':_0xbf5d64['id'],'closed':![],'SmsAccountId':_0x364525['id']}})[_0xa43d('0x20')](function(_0x49fe07){if(_0x49fe07){return[_0x49fe07,![]];}return db['SmsInteraction'][_0xa43d('0x5f')]({'UserId':_0x290539[_0xa43d('0x61')]['id'],'ContactId':_0xbf5d64['id'],'SmsAccountId':_0x364525['id'],'phone':_0x14a1b7,'firstMsgDirection':_0xa43d('0xce'),'Messages':[_[_0xa43d('0x56')](_0x290539[_0xa43d('0x60')],{'read':![],'body':_0x290539[_0xa43d('0x60')][_0xa43d('0x60')],'phone':_0x14a1b7,'SmsAccountId':_0x364525['id'],'UserId':_0x290539[_0xa43d('0x61')]['id'],'ContactId':_0xbf5d64['id']})]},{'include':[{'model':db[_0xa43d('0xad')],'as':_0xa43d('0xcf')}]})[_0xa43d('0x20')](function(_0x283d39){return[_0x283d39,!![]];});});}})['spread'](function(_0x19140e,_0x298c84){if(_0x298c84){return _0x19140e;}return db['SmsMessage'][_0xa43d('0x5f')](_[_0xa43d('0x56')](_0x290539['body'],{'read':![],'body':_0x290539[_0xa43d('0x60')][_0xa43d('0x60')],'phone':_0x14a1b7,'SmsAccountId':_0x364525['id'],'SmsInteractionId':_0x19140e['id'],'UserId':_0x290539['user']['id'],'ContactId':_0xbf5d64['id']}))['then'](function(_0x1ad28e){_0x19140e['dataValues'][_0xa43d('0xcf')]=[];_0x19140e[_0xa43d('0xd0')][_0xa43d('0xcf')][_0xa43d('0xaa')](_0x1ad28e['dataValues']);return _0x19140e;});})[_0xa43d('0x20')](respondWithResult(_0x572911,null))[_0xa43d('0x2a')](handleError(_0x572911,null));};exports[_0xa43d('0x2b')]=function(_0x1dfe13,_0x2281ac,_0x2c008a){if(_0x1dfe13[_0xa43d('0x60')]['id']){delete _0x1dfe13[_0xa43d('0x60')]['id'];}var _0x42253d,_0x289d3d,_0x329e82;return db[_0xa43d('0x41')]['find']({'where':{'id':_0x1dfe13[_0xa43d('0x5c')]['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x2281ac,null))['then'](function(_0x4e5fc5){if(_0x4e5fc5){_0x329e82=_0x4e5fc5;logger[_0xa43d('0x24')](_0xa43d('0xb7'),_0xa43d('0x2b'),_0xa43d('0xd1'),_0x4e5fc5[_0xa43d('0x44')],util['inspect'](_0x1dfe13[_0xa43d('0x60')],{'showHidden':![],'depth':null}));switch(_0x4e5fc5['type']){case'skebby':if(_0x1dfe13[_0xa43d('0x60')][_0xa43d('0xd2')]&&_0x1dfe13['body'][_0xa43d('0x2b')]){_0x289d3d=_0x1dfe13['body'][_0xa43d('0x2b')];return db[_0xa43d('0xad')][_0xa43d('0x5e')]({'where':{'messageId':_0x1dfe13[_0xa43d('0x60')][_0xa43d('0xd2')]}});}break;case'connectel':if(_0x1dfe13['body'][_0xa43d('0xd3')]&&_0x1dfe13['body']['statusInt']){_0x289d3d=_0x1dfe13[_0xa43d('0x60')][_0xa43d('0xd4')];return db[_0xa43d('0xad')][_0xa43d('0x5e')]({'where':{'messageId':_0x1dfe13[_0xa43d('0x60')]['requestid']}});}break;case _0xa43d('0x8b'):if(_0x1dfe13[_0xa43d('0x60')]['message_id']&&_0x1dfe13[_0xa43d('0x60')]['status_code']){_0x289d3d=_0x1dfe13['body'][_0xa43d('0xd5')];return db['SmsMessage'][_0xa43d('0x5e')]({'where':{'messageId':_0x1dfe13[_0xa43d('0x60')][_0xa43d('0x8c')]}});}break;case _0xa43d('0x8f'):var _0x5896fe=_0x1dfe13[_0xa43d('0x60')]['results'][0x0];if(_0x5896fe[_0xa43d('0x86')]&&_0x5896fe[_0xa43d('0x2b')][_0xa43d('0xd6')]===_0xa43d('0xd7')){_0x289d3d=_0x5896fe['status'][_0xa43d('0xd6')];return db[_0xa43d('0xad')][_0xa43d('0x5e')]({'where':{'messageId':_0x5896fe[_0xa43d('0x86')]}});}break;case _0xa43d('0xd8'):if(_0x1dfe13[_0xa43d('0x60')]['messageId']&&_0x1dfe13[_0xa43d('0x60')]['status']){_0x289d3d=_0x1dfe13[_0xa43d('0x60')]['status'];return db[_0xa43d('0xad')][_0xa43d('0x5e')]({'where':{'messageId':_0x1dfe13['body'][_0xa43d('0x86')]}});}break;case _0xa43d('0x95'):if(_0x1dfe13[_0xa43d('0x60')][0x0][_0xa43d('0x28')]['id']){_0x289d3d=_0x1dfe13[_0xa43d('0x60')][0x0][_0xa43d('0x44')];return db['SmsMessage'][_0xa43d('0x5e')]({'where':{'messageId':_0x1dfe13[_0xa43d('0x60')][0x0]['message']['id']}});}break;case _0xa43d('0x96'):if(_0x1dfe13['body'][_0xa43d('0xd9')]&&_0x1dfe13[_0xa43d('0x60')]['status']){_0x289d3d=_0x1dfe13['body'][_0xa43d('0x2b')];return db[_0xa43d('0xad')]['find']({'where':{'messageId':_0x1dfe13['body'][_0xa43d('0xd9')]}});}break;}}})[_0xa43d('0x20')](handleEntityNotFound(_0x2281ac,null))[_0xa43d('0x20')](function(_0x5a69b6){if(_0x5a69b6){_0x42253d=_0x5a69b6;switch(_0x329e82[_0xa43d('0x44')]){case _0xa43d('0x88'):if(_0x289d3d===_0xa43d('0xd7')){return _0x42253d[_0xa43d('0x34')]({'read':!![]});}else{logger[_0xa43d('0x26')](_0xa43d('0xb7'),_0xa43d('0x2b'),_0xa43d('0x88'),util[_0xa43d('0xda')](_0x1dfe13['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x289d3d==='1'){return _0x42253d[_0xa43d('0x34')]({'read':!![]});}else{logger[_0xa43d('0x26')](_0xa43d('0xb7'),_0xa43d('0x2b'),_0xa43d('0x88'),util[_0xa43d('0xda')](_0x1dfe13['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1dfe13[_0xa43d('0x60')][_0xa43d('0xdb')]&&_0x289d3d>=0xc8&&_0x289d3d<=0xce){return _0x42253d[_0xa43d('0x34')]({'read':!![]});}else{logger[_0xa43d('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa43d('0x2b'),_0xa43d('0x8b'),util['inspect'](_0x1dfe13[_0xa43d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xa43d('0x8f'):var _0x428435=_0x1dfe13[_0xa43d('0x60')][_0xa43d('0x90')][0x0];if(_0x428435[_0xa43d('0x2b')]['groupName']===_0xa43d('0xd7')){return _0x42253d[_0xa43d('0x34')]({'read':!![]});}else{logger[_0xa43d('0x26')](_0xa43d('0xb7'),_0xa43d('0x2b'),_0xa43d('0x8f'),util[_0xa43d('0xda')](_0x1dfe13['body'],{'showHidden':![],'depth':null}));}break;case _0xa43d('0xd8'):if(_0x289d3d==_0xa43d('0xdc')||_0x289d3d==_0xa43d('0xdd')){return _0x42253d[_0xa43d('0x34')]({'read':!![]});}else{logger['error'](_0xa43d('0xb7'),'status',_0xa43d('0xd8'),util[_0xa43d('0xda')](_0x1dfe13[_0xa43d('0x60')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x289d3d==_0xa43d('0xde')){return _0x42253d['update']({'read':!![]});}else{logger[_0xa43d('0x26')](_0xa43d('0xb7'),'status',_0xa43d('0x95'),util[_0xa43d('0xda')](_0x1dfe13[_0xa43d('0x60')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x289d3d===_0xa43d('0xdf')||_0x289d3d===_0xa43d('0xe0')){return _0x42253d[_0xa43d('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa43d('0x2b'),_0xa43d('0x96'),util['inspect'](_0x1dfe13[_0xa43d('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x42253d;}})[_0xa43d('0x20')](respondWithResult(_0x2281ac,null))[_0xa43d('0x2a')](handleError(_0x2281ac,null));};exports[_0xa43d('0xe1')]=function(_0x179788,_0x280782,_0x38b892){var _0x3b0e1f,_0x3e604e,_0x410eeb;return db[_0xa43d('0x41')][_0xa43d('0x5e')]({'where':{'id':_0x179788['params']['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x280782,null))[_0xa43d('0x20')](function(_0x9a1b8f){if(_0x9a1b8f){_0x410eeb=_0x9a1b8f;logger[_0xa43d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa43d('0x2b'),_0xa43d('0xd1'),_0x9a1b8f[_0xa43d('0x44')],util[_0xa43d('0xda')](_0x179788[_0xa43d('0x47')],{'showHidden':![],'depth':null}));switch(_0x9a1b8f['type']){case _0xa43d('0xe2'):if(_0x179788['query'][_0xa43d('0xe3')]&&_0x179788[_0xa43d('0x47')][_0xa43d('0xe4')]){_0x3e604e=_0x179788[_0xa43d('0x47')][_0xa43d('0xe4')];return db[_0xa43d('0xad')][_0xa43d('0x5e')]({'where':{'messageId':_0x179788[_0xa43d('0x47')][_0xa43d('0xe3')]}});}break;}}})['then'](handleEntityNotFound(_0x280782,null))[_0xa43d('0x20')](function(_0x396f8a){if(_0x396f8a){_0x3b0e1f=_0x396f8a;switch(_0x410eeb[_0xa43d('0x44')]){case _0xa43d('0xe2'):if(_0x3e604e==='2'||_0x3e604e==='6'){return _0x3b0e1f['update']({'read':!![]});}else{logger['error'](_0xa43d('0xb7'),_0xa43d('0x2b'),'csc',util['inspect'](_0x179788[_0xa43d('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x3b0e1f;}})['then'](respondWithResult(_0x280782,null))[_0xa43d('0x2a')](handleError(_0x280782,null));};exports['addAgents']=function(_0x4f0649,_0x3f56b6,_0xb187f2){return db[_0xa43d('0x41')][_0xa43d('0x5e')]({'where':{'id':_0x4f0649['params']['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x3f56b6,null))[_0xa43d('0x20')](function(_0x2122be){if(_0x2122be){return _0x2122be[_0xa43d('0xe5')](_0x4f0649[_0xa43d('0x60')][_0xa43d('0x70')],_[_0xa43d('0xa2')](_0x4f0649[_0xa43d('0x60')],['ids','id'])||{})['spread'](function(_0x437748){for(var _0x23a846=0x0;_0x23a846<_0x4f0649[_0xa43d('0x60')][_0xa43d('0x70')][_0xa43d('0x4c')];_0x23a846+=0x1){socket['emit'](_0xa43d('0xe6'),{'UserId':Number(_0x4f0649[_0xa43d('0x60')][_0xa43d('0x70')][_0x23a846]),'SmsAccountId':Number(_0x4f0649['params']['id'])});}return _0x437748;});}})[_0xa43d('0x20')](respondWithResult(_0x3f56b6,null))[_0xa43d('0x2a')](handleError(_0x3f56b6,null));};exports[_0xa43d('0xe7')]=function(_0x48df66,_0x537b08,_0x26ff83){return db['SmsAccount'][_0xa43d('0x5e')]({'where':{'id':_0x48df66['params']['id']}})['then'](handleEntityNotFound(_0x537b08,null))[_0xa43d('0x20')](function(_0x24ae86){if(_0x24ae86){return _0x24ae86[_0xa43d('0xe7')](_0x48df66[_0xa43d('0x47')][_0xa43d('0x70')])[_0xa43d('0x20')](function(){if(_[_0xa43d('0xe8')](_0x48df66[_0xa43d('0x47')][_0xa43d('0x70')])){for(var _0x378674=0x0;_0x378674<_0x48df66[_0xa43d('0x47')][_0xa43d('0x70')][_0xa43d('0x4c')];_0x378674+=0x1){socket['emit'](_0xa43d('0xe9'),{'UserId':Number(_0x48df66[_0xa43d('0x47')][_0xa43d('0x70')][_0x378674]),'SmsAccountId':Number(_0x48df66[_0xa43d('0x5c')]['id'])});}}else{socket[_0xa43d('0xea')]('userSmsAccount:remove',{'UserId':Number(_0x48df66[_0xa43d('0x47')]['ids']),'SmsAccountId':Number(_0x48df66[_0xa43d('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x537b08,null))[_0xa43d('0x2a')](handleError(_0x537b08,null));};exports[_0xa43d('0xeb')]=function(_0x218a5c,_0x515622,_0x518228){var _0x1dfbac={};var _0x3fc904={};var _0xeffefa;var _0x467a69;return db[_0xa43d('0x41')]['findOne']({'where':{'id':_0x218a5c['params']['id']}})[_0xa43d('0x20')](handleEntityNotFound(_0x515622,null))[_0xa43d('0x20')](function(_0x1b6b0b){if(_0x1b6b0b){_0xeffefa=_0x1b6b0b;_0x3fc904[_0xa43d('0x46')]=_[_0xa43d('0x48')](db['User'][_0xa43d('0x42')]);_0x3fc904[_0xa43d('0x47')]=_['keys'](_0x218a5c[_0xa43d('0x47')]);_0x3fc904[_0xa43d('0x49')]=_[_0xa43d('0x4a')](_0x3fc904['model'],_0x3fc904[_0xa43d('0x47')]);_0x1dfbac['attributes']=_[_0xa43d('0x4a')](_0x3fc904[_0xa43d('0x46')],qs[_0xa43d('0x4b')](_0x218a5c['query'][_0xa43d('0x4b')]));_0x1dfbac[_0xa43d('0x5d')]=_0x1dfbac[_0xa43d('0x5d')][_0xa43d('0x4c')]?_0x1dfbac['attributes']:_0x3fc904[_0xa43d('0x46')];_0x1dfbac[_0xa43d('0x50')]=qs[_0xa43d('0x51')](_0x218a5c[_0xa43d('0x47')][_0xa43d('0x51')]);_0x1dfbac['where']=qs[_0xa43d('0x49')](_[_0xa43d('0x53')](_0x218a5c[_0xa43d('0x47')],_0x3fc904[_0xa43d('0x49')]));if(_0x218a5c[_0xa43d('0x47')][_0xa43d('0x54')]){_0x1dfbac[_0xa43d('0x52')]=_[_0xa43d('0x56')](_0x1dfbac[_0xa43d('0x52')],{'$or':_[_0xa43d('0x40')](_0x1dfbac[_0xa43d('0x5d')],function(_0x4ef11c){var _0x1418bc={};_0x1418bc[_0x4ef11c]={'$like':'%'+_0x218a5c[_0xa43d('0x47')][_0xa43d('0x54')]+'%'};return _0x1418bc;})});}_0x1dfbac=_[_0xa43d('0x56')]({},_0x1dfbac,_0x218a5c['options']);return _0xeffefa['getAgents'](_0x1dfbac);}})[_0xa43d('0x20')](function(_0x2fde18){if(_0x2fde18){_0x467a69=_0x2fde18['length'];if(!_0x218a5c[_0xa43d('0x47')]['hasOwnProperty'](_0xa43d('0x4e'))){_0x1dfbac[_0xa43d('0x4f')]=qs[_0xa43d('0x4f')](_0x218a5c[_0xa43d('0x47')]['limit']);_0x1dfbac[_0xa43d('0x2d')]=qs['offset'](_0x218a5c[_0xa43d('0x47')][_0xa43d('0x2d')]);}return _0xeffefa[_0xa43d('0xeb')](_0x1dfbac);}})[_0xa43d('0x20')](function(_0x1e924d){if(_0x1e924d){return _0x1e924d?{'count':_0x467a69,'rows':_0x1e924d}:null;}})['then'](respondWithResult(_0x515622,null))[_0xa43d('0x2a')](handleError(_0x515622,null));}; \ No newline at end of file +var _0xd774=['update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','account','orderBy','priority','asc','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','Body','MessageSid','skebby','text','connectel','clicksend','messageId','plivo','From','Text','MessageUUID','infobip','results','segmentedMessage','fromNumber','replyMessageId','bandwidth','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','DESC','omit','Contacts','SmsInteraction','spread','interaction','autoclose','applications','push','unmanaged','*,*,*,*','created','SmsMessage','ContactId','UserId','unshift','agent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','findOne','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','internal','Tag','Tags','color','tag','CmList','List','out','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','message_id','groupName','DELIVERED','clickatell','intelepeer','redif','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save'];(function(_0xb4bed2,_0x1ba3db){var _0x17a2a5=function(_0x3957c1){while(--_0x3957c1){_0xb4bed2['push'](_0xb4bed2['shift']());}};_0x17a2a5(++_0x1ba3db);}(_0xd774,0xa8));var _0x4d77=function(_0x2f9160,_0x4e0325){_0x2f9160=_0x2f9160-0x0;var _0xe0be91=_0xd774[_0x2f9160];return _0xe0be91;};'use strict';var emlformat=require(_0x4d77('0x0'));var rimraf=require(_0x4d77('0x1'));var zipdir=require(_0x4d77('0x2'));var jsonpatch=require(_0x4d77('0x3'));var rp=require(_0x4d77('0x4'));var moment=require(_0x4d77('0x5'));var BPromise=require(_0x4d77('0x6'));var Mustache=require(_0x4d77('0x7'));var util=require(_0x4d77('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x4d77('0x9'));var ejs=require(_0x4d77('0xa'));var fs=require('fs');var fs_extra=require(_0x4d77('0xb'));var _=require('lodash');var squel=require(_0x4d77('0xc'));var crypto=require('crypto');var jsforce=require(_0x4d77('0xd'));var deskjs=require(_0x4d77('0xe'));var toCsv=require(_0x4d77('0x9'));var querystring=require('querystring');var Papa=require(_0x4d77('0xf'));var Redis=require(_0x4d77('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4d77('0x11'));var as=require(_0x4d77('0x12'));var hardwareService=require(_0x4d77('0x13'));var logger=require(_0x4d77('0x14'))(_0x4d77('0x15'));var utils=require(_0x4d77('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4d77('0x17'))['db'];config['redis']=_[_0x4d77('0x18')](config[_0x4d77('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d77('0x1a'))(new Redis(config[_0x4d77('0x19')]));require(_0x4d77('0x1b'))['register'](socket);var jayson=require(_0x4d77('0x1c'));var client=jayson[_0x4d77('0x1d')][_0x4d77('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x1f7cb2,_0x38d62c,_0x192b36,_0x242c1b){return new BPromise(function(_0x218db1,_0x47ecf7){var _0x21215a=_0x242c1b||client;return _0x21215a[_0x4d77('0x1f')](_0x1f7cb2,_0x192b36)['then'](function(_0x2c1b52){logger[_0x4d77('0x20')](_0x4d77('0x21'),_0x38d62c,_0x4d77('0x22'));logger[_0x4d77('0x23')](_0x4d77('0x24'),_0x38d62c,'request\x20sent',JSON[_0x4d77('0x25')](_0x2c1b52));if(_0x2c1b52[_0x4d77('0x26')]){if(_0x2c1b52[_0x4d77('0x26')][_0x4d77('0x27')]===0x1f4){logger[_0x4d77('0x26')]('SmsAccount,\x20%s,\x20%s',_0x38d62c,_0x2c1b52['error']['message']);return _0x47ecf7(_0x2c1b52[_0x4d77('0x26')]['message']);}logger[_0x4d77('0x26')](_0x4d77('0x21'),_0x38d62c,_0x2c1b52[_0x4d77('0x26')][_0x4d77('0x28')]);return _0x218db1(_0x2c1b52['error'][_0x4d77('0x28')]);}else{logger[_0x4d77('0x20')](_0x4d77('0x21'),_0x38d62c,'request\x20sent');_0x218db1(_0x2c1b52[_0x4d77('0x29')][_0x4d77('0x28')]);}})[_0x4d77('0x2a')](function(_0x4b79a6){logger[_0x4d77('0x26')](_0x4d77('0x21'),_0x38d62c,_0x4b79a6);_0x47ecf7(_0x4b79a6);});});}function respondWithStatusCode(_0x30c31b,_0x56851b){_0x56851b=_0x56851b||0xcc;return function(_0x158dcc){if(_0x158dcc){return _0x30c31b[_0x4d77('0x2b')](_0x56851b);}return _0x30c31b[_0x4d77('0x2c')](_0x56851b)[_0x4d77('0x2d')]();};}function respondWithResult(_0x3e5787,_0x2fdb77){_0x2fdb77=_0x2fdb77||0xc8;return function(_0x44c10a){if(_0x44c10a){return _0x3e5787[_0x4d77('0x2c')](_0x2fdb77)[_0x4d77('0x2e')](_0x44c10a);}};}function respondWithFilteredResult(_0x3bdc0e,_0x24e692){return function(_0x5e50b2){if(_0x5e50b2){var _0x4f83ea=typeof _0x24e692[_0x4d77('0x2f')]==='undefined'&&typeof _0x24e692[_0x4d77('0x30')]===_0x4d77('0x31');var _0x10a3f7=_0x5e50b2['count'];var _0x288ad2=_0x4f83ea?0x0:_0x24e692[_0x4d77('0x2f')];var _0x362500=_0x4f83ea?_0x5e50b2[_0x4d77('0x32')]:_0x24e692[_0x4d77('0x2f')]+_0x24e692[_0x4d77('0x30')];var _0x23f680;if(_0x362500>=_0x10a3f7){_0x362500=_0x10a3f7;_0x23f680=0xc8;}else{_0x23f680=0xce;}_0x3bdc0e['status'](_0x23f680);return _0x3bdc0e[_0x4d77('0x33')](_0x4d77('0x34'),_0x288ad2+'-'+_0x362500+'/'+_0x10a3f7)['json'](_0x5e50b2);}return null;};}function patchUpdates(_0xeffb0b){return function(_0x4d7106){try{jsonpatch['apply'](_0x4d7106,_0xeffb0b,!![]);}catch(_0x2214e1){return BPromise[_0x4d77('0x35')](_0x2214e1);}return _0x4d7106[_0x4d77('0x36')]();};}function saveUpdates(_0x503546,_0x353665){return function(_0x4ba5c9){if(_0x4ba5c9){return _0x4ba5c9[_0x4d77('0x37')](_0x503546)[_0x4d77('0x38')](function(_0x235173){return _0x235173;});}return null;};}function removeEntity(_0x4f0079,_0x527fa3){return function(_0x273f99){if(_0x273f99){return _0x273f99[_0x4d77('0x39')]()[_0x4d77('0x38')](function(){var _0x44dd34=_0x273f99[_0x4d77('0x3a')]({'plain':!![]});var _0x1c3d75=_0x4d77('0x3b');return db[_0x4d77('0x3c')][_0x4d77('0x39')]({'where':{'type':_0x1c3d75,'resourceId':_0x44dd34['id']}})[_0x4d77('0x38')](function(){return _0x273f99;});})[_0x4d77('0x38')](function(){_0x4f0079[_0x4d77('0x2c')](0xcc)[_0x4d77('0x2d')]();});}};}function handleEntityNotFound(_0x557ca8,_0x32b40a){return function(_0x1e653b){if(!_0x1e653b){_0x557ca8[_0x4d77('0x2b')](0x194);}return _0x1e653b;};}function handleError(_0x3e3b78,_0x3b6180){_0x3b6180=_0x3b6180||0x1f4;return function(_0x40fc5e){logger[_0x4d77('0x26')](_0x40fc5e[_0x4d77('0x3d')]);if(_0x40fc5e[_0x4d77('0x3e')]){delete _0x40fc5e[_0x4d77('0x3e')];}_0x3e3b78[_0x4d77('0x2c')](_0x3b6180)[_0x4d77('0x3f')](_0x40fc5e);};}exports[_0x4d77('0x40')]=function(_0x52a5d5,_0x583b89){var _0x47bad7={'include':[{'model':db[_0x4d77('0x41')],'as':_0x4d77('0x42')}]},_0x3e3fca={},_0x4bb385={'count':0x0,'rows':[]};var _0xde7d77=_[_0x4d77('0x43')](db[_0x4d77('0x44')]['rawAttributes'],function(_0xf8af8c){return{'name':_0xf8af8c[_0x4d77('0x45')],'type':_0xf8af8c[_0x4d77('0x46')][_0x4d77('0x47')]};});_0x3e3fca['model']=_[_0x4d77('0x43')](_0xde7d77,_0x4d77('0x3e'));_0x3e3fca[_0x4d77('0x48')]=_['keys'](_0x52a5d5[_0x4d77('0x48')]);_0x3e3fca[_0x4d77('0x49')]=_[_0x4d77('0x4a')](_0x3e3fca[_0x4d77('0x4b')],_0x3e3fca[_0x4d77('0x48')]);_0x47bad7[_0x4d77('0x4c')]=_[_0x4d77('0x4a')](_0x3e3fca[_0x4d77('0x4b')],qs['fields'](_0x52a5d5[_0x4d77('0x48')][_0x4d77('0x4d')]));_0x47bad7[_0x4d77('0x4c')]=_0x47bad7[_0x4d77('0x4c')][_0x4d77('0x4e')]?_0x47bad7['attributes']:_0x3e3fca[_0x4d77('0x4b')];if(!_0x52a5d5[_0x4d77('0x48')][_0x4d77('0x4f')](_0x4d77('0x50'))){_0x47bad7[_0x4d77('0x30')]=qs['limit'](_0x52a5d5[_0x4d77('0x48')][_0x4d77('0x30')]);_0x47bad7['offset']=qs[_0x4d77('0x2f')](_0x52a5d5[_0x4d77('0x48')][_0x4d77('0x2f')]);}_0x47bad7[_0x4d77('0x51')]=qs[_0x4d77('0x52')](_0x52a5d5[_0x4d77('0x48')][_0x4d77('0x52')]);_0x47bad7[_0x4d77('0x53')]=qs[_0x4d77('0x49')](_[_0x4d77('0x54')](_0x52a5d5['query'],_0x3e3fca[_0x4d77('0x49')]),_0xde7d77);if(_0x52a5d5[_0x4d77('0x48')][_0x4d77('0x55')]){_0x47bad7[_0x4d77('0x53')]=_[_0x4d77('0x56')](_0x47bad7[_0x4d77('0x53')],{'$or':_[_0x4d77('0x43')](_0xde7d77,function(_0x3567c5){if(_0x3567c5['type']!==_0x4d77('0x57')){var _0xab2f8c={};_0xab2f8c[_0x3567c5['name']]={'$like':'%'+_0x52a5d5[_0x4d77('0x48')][_0x4d77('0x55')]+'%'};return _0xab2f8c;}})});}_0x47bad7=_[_0x4d77('0x56')]({},_0x47bad7,_0x52a5d5['options']);var _0x58d0ec={'where':_0x47bad7[_0x4d77('0x53')]};return db[_0x4d77('0x44')][_0x4d77('0x32')](_0x58d0ec)[_0x4d77('0x38')](function(_0x33ef11){_0x4bb385[_0x4d77('0x32')]=_0x33ef11;if(_0x52a5d5['query'][_0x4d77('0x58')]){_0x47bad7[_0x4d77('0x59')]=[{'all':!![]}];}return db[_0x4d77('0x44')][_0x4d77('0x5a')](_0x47bad7);})['then'](function(_0x51011f){_0x4bb385[_0x4d77('0x5b')]=_0x51011f;return _0x4bb385;})[_0x4d77('0x38')](respondWithFilteredResult(_0x583b89,_0x47bad7))['catch'](handleError(_0x583b89,null));};exports[_0x4d77('0x5c')]=function(_0x227271,_0x15b15a){var _0x29bd76={'raw':![],'where':{'id':_0x227271[_0x4d77('0x5d')]['id']},'include':[{'model':db[_0x4d77('0x41')],'as':_0x4d77('0x42')}]},_0x2912ea={};_0x2912ea[_0x4d77('0x4b')]=_[_0x4d77('0x5e')](db['SmsAccount'][_0x4d77('0x5f')]);_0x2912ea[_0x4d77('0x48')]=_[_0x4d77('0x5e')](_0x227271[_0x4d77('0x48')]);_0x2912ea['filters']=_[_0x4d77('0x4a')](_0x2912ea[_0x4d77('0x4b')],_0x2912ea[_0x4d77('0x48')]);_0x29bd76['attributes']=_[_0x4d77('0x4a')](_0x2912ea[_0x4d77('0x4b')],qs[_0x4d77('0x4d')](_0x227271[_0x4d77('0x48')][_0x4d77('0x4d')]));_0x29bd76[_0x4d77('0x4c')]=_0x29bd76['attributes'][_0x4d77('0x4e')]?_0x29bd76[_0x4d77('0x4c')]:_0x2912ea['model'];if(_0x227271[_0x4d77('0x48')]['includeAll']){_0x29bd76['include']=[{'all':!![]}];}_0x29bd76=_[_0x4d77('0x56')]({},_0x29bd76,_0x227271[_0x4d77('0x60')]);return db[_0x4d77('0x44')][_0x4d77('0x61')](_0x29bd76)[_0x4d77('0x38')](handleEntityNotFound(_0x15b15a,null))[_0x4d77('0x38')](respondWithResult(_0x15b15a,null))[_0x4d77('0x2a')](handleError(_0x15b15a,null));};exports[_0x4d77('0x62')]=function(_0x17788d,_0x9ea944){return db['SmsAccount'][_0x4d77('0x62')](_0x17788d[_0x4d77('0x63')],{})[_0x4d77('0x38')](function(_0x379445){var _0x5111fd=_0x17788d[_0x4d77('0x64')][_0x4d77('0x3a')]({'plain':!![]});if(!_0x5111fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5111fd[_0x4d77('0x65')]===_0x4d77('0x64')){var _0x25c99e=_0x379445[_0x4d77('0x3a')]({'plain':!![]});var _0x5596a1=_0x4d77('0x3b');return db[_0x4d77('0x66')][_0x4d77('0x61')]({'where':{'name':_0x5596a1,'userProfileId':_0x5111fd[_0x4d77('0x67')]},'raw':!![]})['then'](function(_0x327afb){if(_0x327afb&&_0x327afb['autoAssociation']===0x0){return db[_0x4d77('0x3c')]['create']({'name':_0x25c99e[_0x4d77('0x3e')],'resourceId':_0x25c99e['id'],'type':_0x327afb['name'],'sectionId':_0x327afb['id']},{})[_0x4d77('0x38')](function(){return _0x379445;});}else{return _0x379445;}})[_0x4d77('0x2a')](function(_0x383f3f){logger['error'](_0x4d77('0x68'),_0x383f3f);throw _0x383f3f;});}return _0x379445;})[_0x4d77('0x38')](respondWithResult(_0x9ea944,0xc9))['catch'](handleError(_0x9ea944,null));};exports['update']=function(_0x5abe3a,_0x25a196){if(_0x5abe3a['body']['id']){delete _0x5abe3a[_0x4d77('0x63')]['id'];}return db[_0x4d77('0x44')][_0x4d77('0x61')]({'where':{'id':_0x5abe3a[_0x4d77('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x4d77('0x42')}]})[_0x4d77('0x38')](handleEntityNotFound(_0x25a196,null))['then'](saveUpdates(_0x5abe3a[_0x4d77('0x63')],null))[_0x4d77('0x38')](respondWithResult(_0x25a196,null))['catch'](handleError(_0x25a196,null));};exports[_0x4d77('0x39')]=function(_0x3655d6,_0x32e2ca){return db[_0x4d77('0x44')][_0x4d77('0x61')]({'where':{'id':_0x3655d6['params']['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x32e2ca,null))['then'](removeEntity(_0x32e2ca,null))[_0x4d77('0x2a')](handleError(_0x32e2ca,null));};exports[_0x4d77('0x69')]=function(_0x36e6b0,_0x3ce559){return db[_0x4d77('0x44')]['describe']()[_0x4d77('0x38')](respondWithResult(_0x3ce559,null))[_0x4d77('0x2a')](handleError(_0x3ce559,null));};exports[_0x4d77('0x6a')]=function(_0xba0d1e,_0x4ab9cf,_0x284e29){if(_0xba0d1e[_0x4d77('0x63')]['id']){delete _0xba0d1e[_0x4d77('0x63')]['id'];}return db[_0x4d77('0x44')]['find']({'where':{'id':_0xba0d1e[_0x4d77('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4ab9cf,null))['then'](function(_0x32554c){if(_0x32554c){_0xba0d1e[_0x4d77('0x63')][_0x4d77('0x6b')]=_0x32554c['id'];return db[_0x4d77('0x6c')]['create'](_0xba0d1e['body']);}})[_0x4d77('0x38')](respondWithResult(_0x4ab9cf,null))[_0x4d77('0x2a')](handleError(_0x4ab9cf,null));};exports[_0x4d77('0x6d')]=function(_0x348e99,_0x53611a,_0x262d82){var _0x704bb9={'raw':![],'where':{}};var _0x8f7053={};var _0x59e317={'count':0x0,'rows':[]};return db[_0x4d77('0x44')]['findOne']({'where':{'id':_0x348e99[_0x4d77('0x5d')]['id']}})['then'](handleEntityNotFound(_0x53611a,null))[_0x4d77('0x38')](function(_0x438be7){if(_0x438be7){_0x8f7053[_0x4d77('0x4b')]=_[_0x4d77('0x5e')](db[_0x4d77('0x6c')][_0x4d77('0x5f')]);_0x8f7053[_0x4d77('0x48')]=_[_0x4d77('0x5e')](_0x348e99[_0x4d77('0x48')]);_0x8f7053[_0x4d77('0x49')]=_[_0x4d77('0x4a')](_0x8f7053['model'],_0x8f7053['query']);_0x704bb9['attributes']=_['intersection'](_0x8f7053[_0x4d77('0x4b')],qs[_0x4d77('0x4d')](_0x348e99['query'][_0x4d77('0x4d')]));_0x704bb9[_0x4d77('0x4c')]=_0x704bb9['attributes'][_0x4d77('0x4e')]?_0x704bb9[_0x4d77('0x4c')]:_0x8f7053[_0x4d77('0x4b')];if(!_0x348e99[_0x4d77('0x48')][_0x4d77('0x4f')]('nolimit')){_0x704bb9['limit']=qs[_0x4d77('0x30')](_0x348e99['query'][_0x4d77('0x30')]);_0x704bb9[_0x4d77('0x2f')]=qs[_0x4d77('0x2f')](_0x348e99[_0x4d77('0x48')][_0x4d77('0x2f')]);}_0x704bb9[_0x4d77('0x51')]=qs[_0x4d77('0x52')](_0x348e99[_0x4d77('0x48')]['sort']);_0x704bb9['where']=qs[_0x4d77('0x49')](_[_0x4d77('0x54')](_0x348e99[_0x4d77('0x48')],_0x8f7053[_0x4d77('0x49')]));_0x704bb9['where'][_0x4d77('0x6b')]=_0x438be7['id'];if(_0x348e99[_0x4d77('0x48')][_0x4d77('0x55')]){_0x704bb9['where']=_[_0x4d77('0x56')](_0x704bb9['where'],{'$or':_[_0x4d77('0x43')](_0x704bb9[_0x4d77('0x4c')],function(_0x5de030){var _0x261e1f={};_0x261e1f[_0x5de030]={'$like':'%'+_0x348e99[_0x4d77('0x48')][_0x4d77('0x55')]+'%'};return _0x261e1f;})});}_0x704bb9=_[_0x4d77('0x56')]({},_0x704bb9,_0x348e99['options']);return db[_0x4d77('0x6c')]['count']({'where':_0x704bb9['where']})[_0x4d77('0x38')](function(_0x16fc17){_0x59e317[_0x4d77('0x32')]=_0x16fc17;if(_0x348e99[_0x4d77('0x48')][_0x4d77('0x58')]){_0x704bb9[_0x4d77('0x59')]=[{'all':!![]}];}return db[_0x4d77('0x6c')]['findAll'](_0x704bb9);})[_0x4d77('0x38')](function(_0x30e5d8){_0x59e317[_0x4d77('0x5b')]=_0x30e5d8;return _0x59e317;});}})[_0x4d77('0x38')](respondWithFilteredResult(_0x53611a,_0x704bb9))[_0x4d77('0x2a')](handleError(_0x53611a,null));};exports[_0x4d77('0x6e')]=function(_0x22cc54,_0x1b580a,_0x899ee9){return db[_0x4d77('0x44')]['find']({'where':{'id':_0x22cc54[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x1b580a,null))['then'](function(_0x1f6e6c){if(_0x1f6e6c){return _0x1f6e6c['removeDispositions'](_0x22cc54[_0x4d77('0x48')][_0x4d77('0x6f')]);}})[_0x4d77('0x38')](respondWithStatusCode(_0x1b580a,null))[_0x4d77('0x2a')](handleError(_0x1b580a,null));};exports[_0x4d77('0x70')]=function(_0x3e5100,_0x17d119,_0x59d63e){if(_0x3e5100[_0x4d77('0x63')]['id']){delete _0x3e5100[_0x4d77('0x63')]['id'];}return db[_0x4d77('0x44')]['find']({'where':{'id':_0x3e5100[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x17d119,null))[_0x4d77('0x38')](function(_0xb3eca6){if(_0xb3eca6){_0x3e5100[_0x4d77('0x63')][_0x4d77('0x6b')]=_0xb3eca6['id'];return db[_0x4d77('0x71')]['create'](_0x3e5100[_0x4d77('0x63')]);}})[_0x4d77('0x38')](respondWithResult(_0x17d119,null))[_0x4d77('0x2a')](handleError(_0x17d119,null));};exports[_0x4d77('0x72')]=function(_0xd5a08d,_0x4486f1,_0x58769b){var _0x5f3cf2={'raw':![],'where':{}};var _0x329a8a={};var _0x2e332b={'count':0x0,'rows':[]};return db[_0x4d77('0x44')]['findOne']({'where':{'id':_0xd5a08d['params']['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x4486f1,null))['then'](function(_0x4c7c3f){if(_0x4c7c3f){_0x329a8a[_0x4d77('0x4b')]=_[_0x4d77('0x5e')](db['CannedAnswer'][_0x4d77('0x5f')]);_0x329a8a[_0x4d77('0x48')]=_[_0x4d77('0x5e')](_0xd5a08d[_0x4d77('0x48')]);_0x329a8a[_0x4d77('0x49')]=_[_0x4d77('0x4a')](_0x329a8a[_0x4d77('0x4b')],_0x329a8a[_0x4d77('0x48')]);_0x5f3cf2[_0x4d77('0x4c')]=_[_0x4d77('0x4a')](_0x329a8a[_0x4d77('0x4b')],qs[_0x4d77('0x4d')](_0xd5a08d[_0x4d77('0x48')][_0x4d77('0x4d')]));_0x5f3cf2[_0x4d77('0x4c')]=_0x5f3cf2[_0x4d77('0x4c')]['length']?_0x5f3cf2[_0x4d77('0x4c')]:_0x329a8a[_0x4d77('0x4b')];if(!_0xd5a08d[_0x4d77('0x48')][_0x4d77('0x4f')](_0x4d77('0x50'))){_0x5f3cf2[_0x4d77('0x30')]=qs[_0x4d77('0x30')](_0xd5a08d[_0x4d77('0x48')][_0x4d77('0x30')]);_0x5f3cf2['offset']=qs[_0x4d77('0x2f')](_0xd5a08d['query'][_0x4d77('0x2f')]);}_0x5f3cf2[_0x4d77('0x51')]=qs[_0x4d77('0x52')](_0xd5a08d['query']['sort']);_0x5f3cf2[_0x4d77('0x53')]=qs[_0x4d77('0x49')](_[_0x4d77('0x54')](_0xd5a08d['query'],_0x329a8a['filters']));_0x5f3cf2[_0x4d77('0x53')]['SmsAccountId']=_0x4c7c3f['id'];if(_0xd5a08d[_0x4d77('0x48')][_0x4d77('0x55')]){_0x5f3cf2['where']=_['merge'](_0x5f3cf2[_0x4d77('0x53')],{'$or':_[_0x4d77('0x43')](_0x5f3cf2['attributes'],function(_0x5a8b53){var _0x38220c={};_0x38220c[_0x5a8b53]={'$like':'%'+_0xd5a08d[_0x4d77('0x48')][_0x4d77('0x55')]+'%'};return _0x38220c;})});}_0x5f3cf2=_[_0x4d77('0x56')]({},_0x5f3cf2,_0xd5a08d[_0x4d77('0x60')]);return db[_0x4d77('0x71')][_0x4d77('0x32')]({'where':_0x5f3cf2[_0x4d77('0x53')]})[_0x4d77('0x38')](function(_0x55fc02){_0x2e332b['count']=_0x55fc02;if(_0xd5a08d[_0x4d77('0x48')][_0x4d77('0x58')]){_0x5f3cf2[_0x4d77('0x59')]=[{'all':!![]}];}return db[_0x4d77('0x71')][_0x4d77('0x5a')](_0x5f3cf2);})[_0x4d77('0x38')](function(_0x36bd0f){_0x2e332b[_0x4d77('0x5b')]=_0x36bd0f;return _0x2e332b;});}})[_0x4d77('0x38')](respondWithFilteredResult(_0x4486f1,_0x5f3cf2))[_0x4d77('0x2a')](handleError(_0x4486f1,null));};exports['removeAnswers']=function(_0x171bc3,_0x1f5bf4,_0x375a4e){return db['SmsAccount']['find']({'where':{'id':_0x171bc3[_0x4d77('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1f5bf4,null))[_0x4d77('0x38')](function(_0x398ade){if(_0x398ade){return _0x398ade[_0x4d77('0x73')](_0x171bc3[_0x4d77('0x48')][_0x4d77('0x6f')]);}})['then'](respondWithStatusCode(_0x1f5bf4,null))['catch'](handleError(_0x1f5bf4,null));};exports[_0x4d77('0x74')]=function(_0x3b416f,_0x10e286,_0x27638d){var _0x3e75ab={'channel':'sms'};var _0x2696a1=[];var _0xbd97ab=[];var _0x25adf4={};return db[_0x4d77('0x44')][_0x4d77('0x61')]({'where':{'id':_0x3b416f[_0x4d77('0x5d')]['id']},'include':[{'model':db[_0x4d77('0x75')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x10e286,null))[_0x4d77('0x38')](function(_0x5ec138){_0x3e75ab[_0x4d77('0x76')]=_0x5ec138;_0x3e75ab['applications']=_[_0x4d77('0x77')](_0x5ec138['Applications'],[_0x4d77('0x78')],[_0x4d77('0x79')]);if(_0x3e75ab['account'][_0x4d77('0x7a')]){delete _0x3e75ab['account'][_0x4d77('0x7a')];}return db[_0x4d77('0x7b')][_0x4d77('0x69')]();})['then'](function(_0x32464a){if(!_0x32464a){throw new db[(_0x4d77('0x7c'))][(_0x4d77('0x7d'))](_0x4d77('0x7e'));}_0x2696a1=_['difference'](_[_0x4d77('0x5e')](_0x32464a),[_0x4d77('0x7f'),_0x4d77('0x80')]);_0xbd97ab=_[_0x4d77('0x81')](_[_0x4d77('0x5e')](_0x32464a),[_0x4d77('0x7f'),'updatedAt',_0x4d77('0x82'),_0x4d77('0x83')]);_0x3e75ab[_0x4d77('0x63')]={'mapKey':'mobile'};if(_0x3e75ab[_0x4d77('0x76')][_0x4d77('0x46')]){switch(_0x3e75ab['account'][_0x4d77('0x46')]){case'twilio':_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x84')]=_0x3b416f[_0x4d77('0x63')]['From'];_0x3e75ab['body']['body']=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x85')];_0x3e75ab[_0x4d77('0x63')]['messageId']=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x86')];break;case _0x4d77('0x87'):_0x3e75ab[_0x4d77('0x63')]['from']='+'+_0x3b416f[_0x4d77('0x63')]['sender'];_0x3e75ab[_0x4d77('0x63')]['body']=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x88')];break;case _0x4d77('0x89'):_0x3e75ab['body'][_0x4d77('0x84')]=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x84')];_0x3e75ab[_0x4d77('0x63')]['body']=_0x3b416f[_0x4d77('0x63')]['message'];break;case _0x4d77('0x8a'):_0x3e75ab[_0x4d77('0x63')]['from']=_0x3b416f[_0x4d77('0x63')]['from'];_0x3e75ab[_0x4d77('0x63')]['body']=_0x3b416f['body'][_0x4d77('0x63')];_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x8b')]=_0x3b416f[_0x4d77('0x63')]['message_id'];break;case _0x4d77('0x8c'):_0x3e75ab['body'][_0x4d77('0x84')]=_0x3b416f['body'][_0x4d77('0x8d')];_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x63')]=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x8e')];_0x3e75ab[_0x4d77('0x63')]['messageId']=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x8f')];break;case _0x4d77('0x90'):_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x84')]='+'+_0x3b416f[_0x4d77('0x63')]['results'][0x0][_0x4d77('0x84')];_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x63')]=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x91')][0x0][_0x4d77('0x88')];_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x8b')]=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x91')][0x0][_0x4d77('0x8b')];break;case'csc':_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x84')]=_0x3b416f['body']['originatingAddress'];_0x3e75ab['body'][_0x4d77('0x63')]=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x92')][_0x4d77('0x28')];break;case'clickatell':_0x3e75ab[_0x4d77('0x63')]['from']=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x93')];_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x63')]=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x88')];_0x3e75ab['body']['messageId']=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x94')];break;case _0x4d77('0x95'):_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x8b')]=_0x3b416f[_0x4d77('0x63')][0x0]['message']['id'];_0x3e75ab[_0x4d77('0x63')]['from']=_0x3b416f[_0x4d77('0x63')][0x0][_0x4d77('0x28')][_0x4d77('0x84')];_0x3e75ab['body'][_0x4d77('0x63')]=_0x3b416f[_0x4d77('0x63')][0x0][_0x4d77('0x28')][_0x4d77('0x88')];break;case'intelepeer':_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x84')]=_0x3b416f['body'][_0x4d77('0x84')];_0x3e75ab[_0x4d77('0x63')]['body']=_0x3b416f[_0x4d77('0x63')][_0x4d77('0x28')];_0x3e75ab['body'][_0x4d77('0x8b')]=_0x3b416f[_0x4d77('0x63')]['refid'];break;}}if(_0x3e75ab[_0x4d77('0x63')]['id']){delete _0x3e75ab[_0x4d77('0x63')]['id'];}if(_[_0x4d77('0x96')](_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x84')])){throw new db[(_0x4d77('0x7c'))][(_0x4d77('0x7d'))]('from\x20is\x20mandatory');}if(_[_0x4d77('0x96')](_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x63')])||_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x63')]===''){throw new db[(_0x4d77('0x7c'))][(_0x4d77('0x7d'))](_0x4d77('0x97'));}if(_[_0x4d77('0x96')](_0x3e75ab['body'][_0x4d77('0x98')])){throw new db['Sequelize']['ValidationError'](_0x4d77('0x99')+_0xbd97ab);}if(!_[_0x4d77('0x9a')](_0xbd97ab,_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x98')])){throw new db[(_0x4d77('0x7c'))][(_0x4d77('0x7d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xbd97ab);}_0x25adf4[_0x3e75ab[_0x4d77('0x63')]['mapKey']]=_0x3e75ab['body'][_0x4d77('0x84')];return db['CmList'][_0x4d77('0x61')]({'where':{'id':_0x3e75ab[_0x4d77('0x76')][_0x4d77('0x83')]},'include':[{'model':db[_0x4d77('0x7b')],'as':'Contacts','where':_0x25adf4,'limit':0x1,'order':[['updatedAt',_0x4d77('0x9b')]]}]});})[_0x4d77('0x38')](handleEntityNotFound(_0x10e286,null))[_0x4d77('0x38')](function(_0xcd2aa2){if(_0xcd2aa2){_0x3e75ab['list']=_[_0x4d77('0x9c')](_0xcd2aa2,['Contacts']);if(_0xcd2aa2[_0x4d77('0x9d')][_0x4d77('0x4e')]){return _0xcd2aa2['Contacts'][0x0];}var _0xd20cb4=_['defaults'](_0x3e75ab['body'],{'firstName':_0x3e75ab[_0x4d77('0x63')]['from'],'ListId':_0xcd2aa2['id']});_0xd20cb4[_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x98')]]=_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x84')];return db[_0x4d77('0x7b')][_0x4d77('0x62')](_0xd20cb4,{'fields':_0x2696a1,'raw':!![]});}})['then'](handleEntityNotFound(_0x10e286,null))[_0x4d77('0x38')](function(_0x210ae4){if(_0x210ae4){_0x3e75ab['contact']=_0x210ae4;var _0x440c79={'ContactId':_0x210ae4['id'],'phone':_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x84')],'SmsAccountId':_0x3b416f[_0x4d77('0x5d')]['id']};var _0x448ff4={'ContactId':_0x210ae4['id'],'SmsAccountId':_0x3b416f[_0x4d77('0x5d')]['id'],'closed':![]};return db[_0x4d77('0x9e')][_0x4d77('0x61')]({'where':_0x448ff4})[_0x4d77('0x38')](function(_0x2e7e01){if(_0x2e7e01){return[_0x2e7e01,![]];}return db[_0x4d77('0x9e')][_0x4d77('0x62')](_0x440c79)[_0x4d77('0x38')](function(_0x32ff38){return[_0x32ff38,!![]];});});}})[_0x4d77('0x9f')](function(_0x2fe8f3,_0x3f0b6a){_0x3e75ab['interaction']=_0x2fe8f3[_0x4d77('0x3a')]({'plain':!![]});_0x3e75ab[_0x4d77('0xa0')]['created']=![];if(_0x3f0b6a){if(_0x3e75ab[_0x4d77('0x76')][_0x4d77('0xa1')]){_0x3e75ab[_0x4d77('0xa2')][_0x4d77('0xa3')]({'id':0x0,'priority':_0x3e75ab['applications'][_0x4d77('0x4e')]+0x1,'app':'close','appdata':_0x4d77('0xa4'),'interval':_0x4d77('0xa5')});}_0x3e75ab['interaction'][_0x4d77('0xa6')]=!![];}return db[_0x4d77('0xa7')]['create']({'phone':_0x3e75ab[_0x4d77('0x63')][_0x4d77('0x84')],'messageId':_0x3e75ab['body']['messageId'],'body':_0x3e75ab['body'][_0x4d77('0x63')],'SmsAccountId':_0x3b416f['params']['id'],'SmsInteractionId':_0x2fe8f3['id'],'direction':'in','ContactId':_0x2fe8f3[_0x4d77('0xa8')],'AttachmentId':_0x3e75ab[_0x4d77('0x63')]['AttachmentId']});})[_0x4d77('0x38')](function(_0x43aee5){_0x3e75ab[_0x4d77('0x28')]=_0x43aee5;if(_0x3e75ab[_0x4d77('0xa0')][_0x4d77('0xa9')]){return db['User'][_0x4d77('0x61')]({'attributes':['id',_0x4d77('0x3e')],'where':{'id':_0x3e75ab[_0x4d77('0xa0')][_0x4d77('0xa9')]}})['then'](function(_0x2364a5){if(_0x2364a5){_0x3e75ab[_0x4d77('0xa2')][_0x4d77('0xaa')]({'id':0x0,'priority':0x0,'app':_0x4d77('0xab'),'appdata':_0x2364a5[_0x4d77('0x3e')]+','+(_0x3e75ab[_0x4d77('0x76')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x3e75ab);});}return respondWithRpcPromise(_0x4d77('0xac'),'startRouting',_0x3e75ab);})[_0x4d77('0x38')](function(_0x153f58){if(_0x153f58){var _0x53c15b=0xc8;var _0x288bd6=_0x4d77('0xad');logger[_0x4d77('0x20')](_0x4d77('0x24'),_0x288bd6,_0x53c15b,_0x4d77('0xae'));logger['debug'](_0x4d77('0xaf'),_0x288bd6,_0x53c15b,_0x4d77('0xae'),JSON[_0x4d77('0x25')](_0x153f58));if(_0x3e75ab['account'][_0x4d77('0x46')]===_0x4d77('0xb0')){return _0x10e286[_0x4d77('0x2c')](_0x53c15b)[_0x4d77('0x33')]('Content-Type',_0x4d77('0xb1'))[_0x4d77('0x3f')](_0x4d77('0xb2'));}else{return _0x10e286[_0x4d77('0x2c')](_0x53c15b)[_0x4d77('0x2e')](_0x153f58);}}})[_0x4d77('0x2a')](handleError(_0x10e286,null));};exports['addApplications']=function(_0x5a5ffb,_0x347879,_0x2fd1d4){return db['SmsAccount'][_0x4d77('0xb3')]({'where':{'id':_0x5a5ffb['params']['id']}})['then'](handleEntityNotFound(_0x347879,null))['then'](function(_0x52535b){if(_0x52535b){return db[_0x4d77('0xb4')][_0x4d77('0xb5')](function(_0x1cdf85){return db[_0x4d77('0x75')][_0x4d77('0x39')]({'where':{'SmsAccountId':_0x5a5ffb[_0x4d77('0x5d')]['id']},'transaction':_0x1cdf85})[_0x4d77('0x38')](function(_0x2ad498){var _0x375cf2=_[_0x4d77('0x43')](_0x5a5ffb[_0x4d77('0x63')],function(_0x274344){_0x274344[_0x4d77('0x6b')]=_0x5a5ffb[_0x4d77('0x5d')]['id'];return _0x274344;});return db[_0x4d77('0x75')][_0x4d77('0xb6')](_0x375cf2,{'transaction':_0x1cdf85});});})[_0x4d77('0x38')](function(){return db[_0x4d77('0x75')][_0x4d77('0xb7')]({'where':{'SmsAccountId':_0x5a5ffb[_0x4d77('0x5d')]['id']},'order':_0x4d77('0x78')});});}})[_0x4d77('0x38')](respondWithResult(_0x347879,null))[_0x4d77('0x2a')](handleError(_0x347879,null));};exports[_0x4d77('0xb8')]=function(_0x1395e1,_0x272548,_0xc519cd){var _0xc5c738={};var _0xf0da72={};var _0x214497;var _0x193382;return db['SmsAccount'][_0x4d77('0xb3')]({'where':{'id':_0x1395e1[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x272548,null))['then'](function(_0x141eeb){if(_0x141eeb){_0x214497=_0x141eeb;_0xf0da72[_0x4d77('0x4b')]=_[_0x4d77('0x5e')](db[_0x4d77('0x75')]['rawAttributes']);_0xf0da72[_0x4d77('0x48')]=_[_0x4d77('0x5e')](_0x1395e1[_0x4d77('0x48')]);_0xf0da72[_0x4d77('0x49')]=_['intersection'](_0xf0da72[_0x4d77('0x4b')],_0xf0da72[_0x4d77('0x48')]);_0xc5c738[_0x4d77('0x4c')]=_[_0x4d77('0x4a')](_0xf0da72[_0x4d77('0x4b')],qs[_0x4d77('0x4d')](_0x1395e1[_0x4d77('0x48')][_0x4d77('0x4d')]));_0xc5c738[_0x4d77('0x4c')]=_0xc5c738[_0x4d77('0x4c')][_0x4d77('0x4e')]?_0xc5c738[_0x4d77('0x4c')]:_0xf0da72['model'];_0xc5c738['order']=qs[_0x4d77('0x52')](_0x1395e1[_0x4d77('0x48')][_0x4d77('0x52')]);_0xc5c738['where']=qs[_0x4d77('0x49')](_[_0x4d77('0x54')](_0x1395e1['query'],_0xf0da72[_0x4d77('0x49')]));if(_0x1395e1[_0x4d77('0x48')][_0x4d77('0x55')]){_0xc5c738['where']=_['merge'](_0xc5c738[_0x4d77('0x53')],{'$or':_[_0x4d77('0x43')](_0xc5c738[_0x4d77('0x4c')],function(_0x2d8a3e){var _0x3c8547={};_0x3c8547[_0x2d8a3e]={'$like':'%'+_0x1395e1['query'][_0x4d77('0x55')]+'%'};return _0x3c8547;})});}_0xc5c738=_[_0x4d77('0x56')]({},_0xc5c738,_0x1395e1[_0x4d77('0x60')]);return _0x214497[_0x4d77('0xb8')](_0xc5c738);}})[_0x4d77('0x38')](function(_0x2ce063){if(_0x2ce063){_0x193382=_0x2ce063['length'];if(!_0x1395e1[_0x4d77('0x48')][_0x4d77('0x4f')](_0x4d77('0x50'))){_0xc5c738[_0x4d77('0x30')]=qs[_0x4d77('0x30')](_0x1395e1['query']['limit']);_0xc5c738[_0x4d77('0x2f')]=qs[_0x4d77('0x2f')](_0x1395e1['query'][_0x4d77('0x2f')]);}return _0x214497[_0x4d77('0xb8')](_0xc5c738);}})[_0x4d77('0x38')](function(_0x4daece){if(_0x4daece){return _0x4daece?{'count':_0x193382,'rows':_0x4daece}:null;}})[_0x4d77('0x38')](respondWithResult(_0x272548,null))['catch'](handleError(_0x272548,null));};exports['getInteractions']=function(_0x28ad34,_0x812d44,_0x53f78a){var _0x2c683f={'raw':![],'where':{}};var _0x134f05={};var _0x570595={'count':0x0,'rows':[]};return db[_0x4d77('0x44')]['findOne']({'where':{'id':_0x28ad34[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x812d44,null))[_0x4d77('0x38')](function(_0x5665e7){if(_0x5665e7){_0x134f05[_0x4d77('0x4b')]=_[_0x4d77('0x5e')](db['SmsInteraction'][_0x4d77('0x5f')]);_0x134f05[_0x4d77('0x48')]=_['keys'](_0x28ad34[_0x4d77('0x48')]);_0x134f05[_0x4d77('0x49')]=_[_0x4d77('0x4a')](_0x134f05[_0x4d77('0x4b')],_0x134f05['query']);_0x2c683f['attributes']=_[_0x4d77('0x4a')](_0x134f05[_0x4d77('0x4b')],qs[_0x4d77('0x4d')](_0x28ad34[_0x4d77('0x48')][_0x4d77('0x4d')]));_0x2c683f[_0x4d77('0x4c')]=_0x2c683f[_0x4d77('0x4c')]['length']?_0x2c683f['attributes']:_0x134f05[_0x4d77('0x4b')];if(!_0x28ad34[_0x4d77('0x48')][_0x4d77('0x4f')](_0x4d77('0x50'))){_0x2c683f[_0x4d77('0x30')]=qs[_0x4d77('0x30')](_0x28ad34[_0x4d77('0x48')][_0x4d77('0x30')]);_0x2c683f['offset']=qs[_0x4d77('0x2f')](_0x28ad34[_0x4d77('0x48')][_0x4d77('0x2f')]);}_0x2c683f[_0x4d77('0x51')]=qs['sort'](_0x28ad34[_0x4d77('0x48')][_0x4d77('0x52')]);_0x2c683f[_0x4d77('0x53')]=qs[_0x4d77('0x49')](_[_0x4d77('0x54')](_0x28ad34['query'],_0x134f05[_0x4d77('0x49')]));_0x2c683f['where'][_0x4d77('0x6b')]=_0x5665e7['id'];if(_0x28ad34[_0x4d77('0x48')][_0x4d77('0x55')]){_0x2c683f['where']=_[_0x4d77('0x56')](_0x2c683f[_0x4d77('0x53')],{'$or':_[_0x4d77('0x43')](_0x2c683f[_0x4d77('0x4c')],function(_0x498a1c){var _0x139e12={};_0x139e12[_0x498a1c]={'$like':'%'+_0x28ad34[_0x4d77('0x48')][_0x4d77('0x55')]+'%'};return _0x139e12;})});}_0x2c683f=_[_0x4d77('0x56')]({},_0x2c683f,_0x28ad34[_0x4d77('0x60')]);return db['SmsInteraction'][_0x4d77('0x32')]({'where':_0x2c683f[_0x4d77('0x53')]})['then'](function(_0xfa9de0){_0x570595['count']=_0xfa9de0;if(_0x28ad34[_0x4d77('0x48')][_0x4d77('0x58')]){_0x2c683f[_0x4d77('0x59')]=[{'model':db['CmContact'],'as':_0x4d77('0xb9'),'required':![]},{'model':db[_0x4d77('0xba')],'as':_0x4d77('0xbb'),'attributes':[_0x4d77('0x3e'),'fullname',_0x4d77('0xbc')],'required':![]},{'model':db[_0x4d77('0xbd')],'as':_0x4d77('0xbe'),'attributes':['id','name',_0x4d77('0xbf')],'where':_0x28ad34[_0x4d77('0x48')][_0x4d77('0xc0')]?{'id':_0x28ad34[_0x4d77('0x48')][_0x4d77('0xc0')]}:undefined,'required':_0x28ad34[_0x4d77('0x48')]['tag']?!![]:![]}];}return db[_0x4d77('0x9e')][_0x4d77('0x5a')](_0x2c683f);})['then'](function(_0x4bf532){_0x570595[_0x4d77('0x5b')]=_0x4bf532;return _0x570595;});}})[_0x4d77('0x38')](respondWithFilteredResult(_0x812d44,_0x2c683f))[_0x4d77('0x2a')](handleError(_0x812d44,null));};exports['send']=function(_0x547697,_0x402010,_0x42c70a){var _0x758a72,_0xcb13a2,_0x34d94a;if(_[_0x4d77('0x96')](_0x547697[_0x4d77('0x63')]['body'])||_0x547697['body']['body']===''){throw new db[(_0x4d77('0x7c'))][(_0x4d77('0x7d'))](_0x4d77('0x97'));}if(_[_0x4d77('0x96')](_0x547697['body']['to'])){throw new db['Sequelize'][(_0x4d77('0x7d'))]('to\x20is\x20mandatory');}_0x758a72=_0x547697[_0x4d77('0x63')]['to'];return db['SmsAccount'][_0x4d77('0x61')]({'where':{'id':_0x547697[_0x4d77('0x5d')]['id']},'include':[{'model':db[_0x4d77('0xc1')],'as':'List','include':[{'model':db[_0x4d77('0x7b')],'as':_0x4d77('0x9d'),'where':{'mobile':_0x758a72},'limit':0x1,'order':[[_0x4d77('0x80'),_0x4d77('0x9b')]]}]}]})[_0x4d77('0x38')](handleEntityNotFound(_0x402010,null))['then'](function(_0x2d762b){if(_0x2d762b&&_0x2d762b['List']){_0xcb13a2=_0x2d762b['get']({'plain':!![]});if(_0xcb13a2['List']&&_0xcb13a2[_0x4d77('0xc2')][_0x4d77('0x9d')]['length']){return _0xcb13a2[_0x4d77('0xc2')][_0x4d77('0x9d')][0x0];}return db[_0x4d77('0x7b')][_0x4d77('0x62')](_[_0x4d77('0x18')](_0x547697['body'],{'firstName':_0x758a72,'mobile':_0x758a72,'phone':_0x758a72,'ListId':_0xcb13a2[_0x4d77('0x83')]}));}})[_0x4d77('0x38')](handleEntityNotFound(_0x402010,null))['then'](function(_0x1cb0d1){if(_0x1cb0d1){_0x34d94a=_0x1cb0d1;return db[_0x4d77('0x9e')][_0x4d77('0x61')]({'where':{'ContactId':_0x34d94a['id'],'closed':![],'SmsAccountId':_0xcb13a2['id']}})[_0x4d77('0x38')](function(_0x106cb1){if(_0x106cb1){return[_0x106cb1,![]];}return db[_0x4d77('0x9e')][_0x4d77('0x62')]({'UserId':_0x547697[_0x4d77('0x64')]['id'],'ContactId':_0x34d94a['id'],'SmsAccountId':_0xcb13a2['id'],'phone':_0x758a72,'firstMsgDirection':_0x4d77('0xc3'),'Messages':[_['merge'](_0x547697['body'],{'read':![],'body':_0x547697['body'][_0x4d77('0x63')],'phone':_0x758a72,'SmsAccountId':_0xcb13a2['id'],'UserId':_0x547697[_0x4d77('0x64')]['id'],'ContactId':_0x34d94a['id']})]},{'include':[{'model':db[_0x4d77('0xa7')],'as':'Messages'}]})[_0x4d77('0x38')](function(_0x3d03b3){return[_0x3d03b3,!![]];});});}})[_0x4d77('0x9f')](function(_0x2e6265,_0x229dd4){if(_0x229dd4){return _0x2e6265;}return db['SmsMessage'][_0x4d77('0x62')](_[_0x4d77('0x56')](_0x547697[_0x4d77('0x63')],{'read':![],'body':_0x547697[_0x4d77('0x63')][_0x4d77('0x63')],'phone':_0x758a72,'SmsAccountId':_0xcb13a2['id'],'SmsInteractionId':_0x2e6265['id'],'UserId':_0x547697[_0x4d77('0x64')]['id'],'ContactId':_0x34d94a['id']}))[_0x4d77('0x38')](function(_0x3ae8a7){_0x2e6265[_0x4d77('0xc4')]['Messages']=[];_0x2e6265[_0x4d77('0xc4')]['Messages'][_0x4d77('0xa3')](_0x3ae8a7[_0x4d77('0xc4')]);return _0x2e6265;});})[_0x4d77('0x38')](respondWithResult(_0x402010,null))[_0x4d77('0x2a')](handleError(_0x402010,null));};exports[_0x4d77('0x2c')]=function(_0x2256d1,_0x593a6d,_0x5d4f87){if(_0x2256d1[_0x4d77('0x63')]['id']){delete _0x2256d1['body']['id'];}var _0x28e35d,_0x3faa9b,_0x1db700;return db[_0x4d77('0x44')][_0x4d77('0x61')]({'where':{'id':_0x2256d1[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x593a6d,null))[_0x4d77('0x38')](function(_0xe3d22b){if(_0xe3d22b){_0x1db700=_0xe3d22b;logger[_0x4d77('0x23')](_0x4d77('0x24'),_0x4d77('0x2c'),'received\x20delivery\x20report\x20from',_0xe3d22b[_0x4d77('0x46')],util[_0x4d77('0xc5')](_0x2256d1[_0x4d77('0x63')],{'showHidden':![],'depth':null}));switch(_0xe3d22b[_0x4d77('0x46')]){case _0x4d77('0x87'):if(_0x2256d1[_0x4d77('0x63')][_0x4d77('0xc6')]&&_0x2256d1[_0x4d77('0x63')][_0x4d77('0x2c')]){_0x3faa9b=_0x2256d1[_0x4d77('0x63')]['status'];return db[_0x4d77('0xa7')][_0x4d77('0x61')]({'where':{'messageId':_0x2256d1['body'][_0x4d77('0xc6')]}});}break;case'connectel':if(_0x2256d1[_0x4d77('0x63')][_0x4d77('0xc7')]&&_0x2256d1[_0x4d77('0x63')][_0x4d77('0xc8')]){_0x3faa9b=_0x2256d1[_0x4d77('0x63')][_0x4d77('0xc8')];return db[_0x4d77('0xa7')][_0x4d77('0x61')]({'where':{'messageId':_0x2256d1['body'][_0x4d77('0xc7')]}});}break;case _0x4d77('0x8a'):if(_0x2256d1['body']['message_id']&&_0x2256d1['body'][_0x4d77('0xc9')]){_0x3faa9b=_0x2256d1['body'][_0x4d77('0xc9')];return db[_0x4d77('0xa7')][_0x4d77('0x61')]({'where':{'messageId':_0x2256d1[_0x4d77('0x63')][_0x4d77('0xca')]}});}break;case _0x4d77('0x90'):var _0x54d7cf=_0x2256d1[_0x4d77('0x63')][_0x4d77('0x91')][0x0];if(_0x54d7cf['messageId']&&_0x54d7cf['status'][_0x4d77('0xcb')]===_0x4d77('0xcc')){_0x3faa9b=_0x54d7cf['status']['groupName'];return db[_0x4d77('0xa7')][_0x4d77('0x61')]({'where':{'messageId':_0x54d7cf[_0x4d77('0x8b')]}});}break;case _0x4d77('0xcd'):if(_0x2256d1[_0x4d77('0x63')][_0x4d77('0x8b')]&&_0x2256d1[_0x4d77('0x63')]['status']){_0x3faa9b=_0x2256d1[_0x4d77('0x63')][_0x4d77('0x2c')];return db[_0x4d77('0xa7')][_0x4d77('0x61')]({'where':{'messageId':_0x2256d1[_0x4d77('0x63')][_0x4d77('0x8b')]}});}break;case _0x4d77('0x95'):if(_0x2256d1[_0x4d77('0x63')][0x0][_0x4d77('0x28')]['id']){_0x3faa9b=_0x2256d1[_0x4d77('0x63')][0x0][_0x4d77('0x46')];return db['SmsMessage'][_0x4d77('0x61')]({'where':{'messageId':_0x2256d1['body'][0x0]['message']['id']}});}break;case _0x4d77('0xce'):if(_0x2256d1[_0x4d77('0x63')][_0x4d77('0xcf')]&&_0x2256d1[_0x4d77('0x63')]['status']){_0x3faa9b=_0x2256d1[_0x4d77('0x63')][_0x4d77('0x2c')];return db[_0x4d77('0xa7')][_0x4d77('0x61')]({'where':{'messageId':_0x2256d1[_0x4d77('0x63')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x593a6d,null))[_0x4d77('0x38')](function(_0x43bfe0){if(_0x43bfe0){_0x28e35d=_0x43bfe0;switch(_0x1db700[_0x4d77('0x46')]){case'skebby':if(_0x3faa9b===_0x4d77('0xcc')){return _0x28e35d[_0x4d77('0x37')]({'read':!![]});}else{logger['error'](_0x4d77('0x24'),_0x4d77('0x2c'),'skebby',util['inspect'](_0x2256d1['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3faa9b==='1'){return _0x28e35d[_0x4d77('0x37')]({'read':!![]});}else{logger[_0x4d77('0x26')](_0x4d77('0x24'),_0x4d77('0x2c'),_0x4d77('0x87'),util[_0x4d77('0xc5')](_0x2256d1[_0x4d77('0x63')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2256d1[_0x4d77('0x63')][_0x4d77('0xd0')]&&_0x3faa9b>=0xc8&&_0x3faa9b<=0xce){return _0x28e35d[_0x4d77('0x37')]({'read':!![]});}else{logger[_0x4d77('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d77('0x2c'),_0x4d77('0x8a'),util[_0x4d77('0xc5')](_0x2256d1['body'],{'showHidden':![],'depth':null}));}break;case _0x4d77('0x90'):var _0x5c7f92=_0x2256d1['body'][_0x4d77('0x91')][0x0];if(_0x5c7f92['status']['groupName']===_0x4d77('0xcc')){return _0x28e35d['update']({'read':!![]});}else{logger['error'](_0x4d77('0x24'),'status',_0x4d77('0x90'),util['inspect'](_0x2256d1[_0x4d77('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4d77('0xcd'):if(_0x3faa9b=='DELIVERED_TO_GATEWAY'||_0x3faa9b==_0x4d77('0xd1')){return _0x28e35d[_0x4d77('0x37')]({'read':!![]});}else{logger[_0x4d77('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d77('0x2c'),_0x4d77('0xcd'),util[_0x4d77('0xc5')](_0x2256d1['body'],{'showHidden':![],'depth':null}));}break;case _0x4d77('0x95'):if(_0x3faa9b=='message-delivered'){return _0x28e35d['update']({'read':!![]});}else{logger[_0x4d77('0x26')](_0x4d77('0x24'),_0x4d77('0x2c'),_0x4d77('0x95'),util[_0x4d77('0xc5')](_0x2256d1[_0x4d77('0x63')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3faa9b===_0x4d77('0xd2')||_0x3faa9b===_0x4d77('0xd3')){return _0x28e35d[_0x4d77('0x37')]({'read':!![]});}else{logger['error'](_0x4d77('0x24'),'status',_0x4d77('0xce'),util['inspect'](_0x2256d1[_0x4d77('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x28e35d;}})[_0x4d77('0x38')](respondWithResult(_0x593a6d,null))[_0x4d77('0x2a')](handleError(_0x593a6d,null));};exports[_0x4d77('0xd4')]=function(_0x2f9dec,_0x8682ab,_0x5de95c){var _0x326d97,_0x345d9f,_0x29318c;return db[_0x4d77('0x44')][_0x4d77('0x61')]({'where':{'id':_0x2f9dec[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x8682ab,null))[_0x4d77('0x38')](function(_0x500dfd){if(_0x500dfd){_0x29318c=_0x500dfd;logger[_0x4d77('0x23')](_0x4d77('0x24'),'status',_0x4d77('0xd5'),_0x500dfd['type'],util[_0x4d77('0xc5')](_0x2f9dec[_0x4d77('0x48')],{'showHidden':![],'depth':null}));switch(_0x500dfd['type']){case _0x4d77('0xd6'):if(_0x2f9dec[_0x4d77('0x48')][_0x4d77('0xd7')]&&_0x2f9dec[_0x4d77('0x48')]['state']){_0x345d9f=_0x2f9dec[_0x4d77('0x48')][_0x4d77('0xd8')];return db['SmsMessage'][_0x4d77('0x61')]({'where':{'messageId':_0x2f9dec[_0x4d77('0x48')][_0x4d77('0xd7')]}});}break;}}})[_0x4d77('0x38')](handleEntityNotFound(_0x8682ab,null))['then'](function(_0xfbf18a){if(_0xfbf18a){_0x326d97=_0xfbf18a;switch(_0x29318c[_0x4d77('0x46')]){case'csc':if(_0x345d9f==='2'||_0x345d9f==='6'){return _0x326d97[_0x4d77('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d77('0x2c'),_0x4d77('0xd6'),util[_0x4d77('0xc5')](_0x2f9dec[_0x4d77('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x326d97;}})[_0x4d77('0x38')](respondWithResult(_0x8682ab,null))['catch'](handleError(_0x8682ab,null));};exports[_0x4d77('0xd9')]=function(_0x49f50c,_0x3bbdbe,_0x22f50c){return db[_0x4d77('0x44')]['find']({'where':{'id':_0x49f50c[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x3bbdbe,null))[_0x4d77('0x38')](function(_0x4585ff){if(_0x4585ff){return _0x4585ff['addAgents'](_0x49f50c['body'][_0x4d77('0x6f')],_[_0x4d77('0x9c')](_0x49f50c[_0x4d77('0x63')],['ids','id'])||{})[_0x4d77('0x9f')](function(_0x457244){for(var _0x49d256=0x0;_0x49d256<_0x49f50c['body'][_0x4d77('0x6f')]['length'];_0x49d256+=0x1){socket['emit'](_0x4d77('0xda'),{'UserId':Number(_0x49f50c[_0x4d77('0x63')][_0x4d77('0x6f')][_0x49d256]),'SmsAccountId':Number(_0x49f50c[_0x4d77('0x5d')]['id'])});}return _0x457244;});}})[_0x4d77('0x38')](respondWithResult(_0x3bbdbe,null))[_0x4d77('0x2a')](handleError(_0x3bbdbe,null));};exports['removeAgents']=function(_0x2b7265,_0x421c08,_0x25bd3a){return db[_0x4d77('0x44')][_0x4d77('0x61')]({'where':{'id':_0x2b7265[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x421c08,null))['then'](function(_0x3f588e){if(_0x3f588e){return _0x3f588e[_0x4d77('0xdb')](_0x2b7265['query'][_0x4d77('0x6f')])['then'](function(){if(_['isArray'](_0x2b7265[_0x4d77('0x48')]['ids'])){for(var _0x724050=0x0;_0x724050<_0x2b7265['query'][_0x4d77('0x6f')][_0x4d77('0x4e')];_0x724050+=0x1){socket[_0x4d77('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x2b7265[_0x4d77('0x48')]['ids'][_0x724050]),'SmsAccountId':Number(_0x2b7265[_0x4d77('0x5d')]['id'])});}}else{socket[_0x4d77('0xdc')](_0x4d77('0xdd'),{'UserId':Number(_0x2b7265[_0x4d77('0x48')][_0x4d77('0x6f')]),'SmsAccountId':Number(_0x2b7265[_0x4d77('0x5d')]['id'])});}});}})[_0x4d77('0x38')](respondWithStatusCode(_0x421c08,null))[_0x4d77('0x2a')](handleError(_0x421c08,null));};exports[_0x4d77('0xde')]=function(_0x4744ab,_0x15c0b7,_0xd147f8){var _0x21dcb1={};var _0xfbe488={};var _0x31396f;var _0x1d9852;return db['SmsAccount']['findOne']({'where':{'id':_0x4744ab[_0x4d77('0x5d')]['id']}})[_0x4d77('0x38')](handleEntityNotFound(_0x15c0b7,null))[_0x4d77('0x38')](function(_0x34c1d5){if(_0x34c1d5){_0x31396f=_0x34c1d5;_0xfbe488[_0x4d77('0x4b')]=_[_0x4d77('0x5e')](db[_0x4d77('0xba')][_0x4d77('0x5f')]);_0xfbe488[_0x4d77('0x48')]=_[_0x4d77('0x5e')](_0x4744ab[_0x4d77('0x48')]);_0xfbe488[_0x4d77('0x49')]=_['intersection'](_0xfbe488['model'],_0xfbe488[_0x4d77('0x48')]);_0x21dcb1[_0x4d77('0x4c')]=_[_0x4d77('0x4a')](_0xfbe488[_0x4d77('0x4b')],qs['fields'](_0x4744ab[_0x4d77('0x48')]['fields']));_0x21dcb1[_0x4d77('0x4c')]=_0x21dcb1['attributes']['length']?_0x21dcb1['attributes']:_0xfbe488['model'];_0x21dcb1[_0x4d77('0x51')]=qs[_0x4d77('0x52')](_0x4744ab[_0x4d77('0x48')][_0x4d77('0x52')]);_0x21dcb1[_0x4d77('0x53')]=qs['filters'](_[_0x4d77('0x54')](_0x4744ab[_0x4d77('0x48')],_0xfbe488['filters']));if(_0x4744ab[_0x4d77('0x48')][_0x4d77('0x55')]){_0x21dcb1[_0x4d77('0x53')]=_[_0x4d77('0x56')](_0x21dcb1['where'],{'$or':_[_0x4d77('0x43')](_0x21dcb1[_0x4d77('0x4c')],function(_0x5f814f){var _0x5f2254={};_0x5f2254[_0x5f814f]={'$like':'%'+_0x4744ab[_0x4d77('0x48')][_0x4d77('0x55')]+'%'};return _0x5f2254;})});}_0x21dcb1=_[_0x4d77('0x56')]({},_0x21dcb1,_0x4744ab['options']);return _0x31396f[_0x4d77('0xde')](_0x21dcb1);}})[_0x4d77('0x38')](function(_0x444da3){if(_0x444da3){_0x1d9852=_0x444da3[_0x4d77('0x4e')];if(!_0x4744ab[_0x4d77('0x48')][_0x4d77('0x4f')](_0x4d77('0x50'))){_0x21dcb1[_0x4d77('0x30')]=qs[_0x4d77('0x30')](_0x4744ab[_0x4d77('0x48')][_0x4d77('0x30')]);_0x21dcb1[_0x4d77('0x2f')]=qs[_0x4d77('0x2f')](_0x4744ab[_0x4d77('0x48')][_0x4d77('0x2f')]);}return _0x31396f['getAgents'](_0x21dcb1);}})[_0x4d77('0x38')](function(_0x5b4e02){if(_0x5b4e02){return _0x5b4e02?{'count':_0x1d9852,'rows':_0x5b4e02}:null;}})[_0x4d77('0x38')](respondWithResult(_0x15c0b7,null))['catch'](handleError(_0x15c0b7,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2a6ffb6..def7a4d 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 _0xa43b=['hook','exports','SmsAccount','save','update','emit','hasOwnProperty'];(function(_0x4020b6,_0x354d61){var _0x94ee1b=function(_0x1edc05){while(--_0x1edc05){_0x4020b6['push'](_0x4020b6['shift']());}};_0x94ee1b(++_0x354d61);}(_0xa43b,0x16e));var _0xba43=function(_0x2bb0cd,_0x175950){_0x2bb0cd=_0x2bb0cd-0x0;var _0x49b81a=_0xa43b[_0x2bb0cd];return _0x49b81a;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0xba43('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xba43('0x1'),'afterUpdate':_0xba43('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5d9cfb){return function(_0x5a8cb5,_0x5b6478,_0x56a87a){SmsAccountEvents[_0xba43('0x3')](_0x5d9cfb+':'+_0x5a8cb5['id'],_0x5a8cb5);SmsAccountEvents[_0xba43('0x3')](_0x5d9cfb,_0x5a8cb5);_0x56a87a(null);};}for(var e in events){if(events[_0xba43('0x4')](e)){var event=events[e];SmsAccount[_0xba43('0x5')](e,emitEvent(event));}}module[_0xba43('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xd0fe=['SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x149c26,_0xf40f9){var _0x367ecd=function(_0x15ffa8){while(--_0x15ffa8){_0x149c26['push'](_0x149c26['shift']());}};_0x367ecd(++_0xf40f9);}(_0xd0fe,0x1f2));var _0xed0f=function(_0x4d951e,_0x127c93){_0x4d951e=_0x4d951e-0x0;var _0x46fb72=_0xd0fe[_0x4d951e];return _0x46fb72;};'use strict';var EventEmitter=require(_0xed0f('0x0'));var SmsAccount=require(_0xed0f('0x1'))['db'][_0xed0f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xed0f('0x3')](0x0);var events={'afterCreate':_0xed0f('0x4'),'afterUpdate':_0xed0f('0x5'),'afterDestroy':_0xed0f('0x6')};function emitEvent(_0x5217e6){return function(_0x145b52,_0x196e1b,_0x4fc79c){SmsAccountEvents[_0xed0f('0x7')](_0x5217e6+':'+_0x145b52['id'],_0x145b52);SmsAccountEvents['emit'](_0x5217e6,_0x145b52);_0x4fc79c(null);};}for(var e in events){if(events[_0xed0f('0x8')](e)){var event=events[e];SmsAccount[_0xed0f('0x9')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d43dba7..3f87829 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 _0xa68c=['exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./smsAccount.attributes'];(function(_0x162a48,_0x4b93c2){var _0x4f4721=function(_0x6261e4){while(--_0x6261e4){_0x162a48['push'](_0x162a48['shift']());}};_0x4f4721(++_0x4b93c2);}(_0xa68c,0x1a8));var _0xca68=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa68c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xca68('0x0'));var util=require(_0xca68('0x1'));var logger=require(_0xca68('0x2'))(_0xca68('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca68('0x4'));var fs=require('fs');var path=require(_0xca68('0x5'));var rimraf=require('rimraf');var config=require(_0xca68('0x6'));var attributes=require(_0xca68('0x7'));module[_0xca68('0x8')]=function(_0x461892,_0x25fef4){return _0x461892[_0xca68('0x9')](_0xca68('0xa'),attributes,{'tableName':_0xca68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd635=['path','rimraf','./smsAccount.attributes','define','SmsAccount','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xd635,0x18b));var _0x5d63=function(_0x2e3d56,_0x4fb6ed){_0x2e3d56=_0x2e3d56-0x0;var _0x1815c1=_0xd635[_0x2e3d56];return _0x1815c1;};'use strict';var _=require(_0x5d63('0x0'));var util=require(_0x5d63('0x1'));var logger=require(_0x5d63('0x2'))('api');var moment=require(_0x5d63('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d63('0x4'));var fs=require('fs');var path=require(_0x5d63('0x5'));var rimraf=require(_0x5d63('0x6'));var config=require('../../config/environment');var attributes=require(_0x5d63('0x7'));module['exports']=function(_0x4eec7a,_0x3c7916){return _0x4eec7a[_0x5d63('0x8')](_0x5d63('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index d22a0eb..25eade4 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 _0x05d8=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','request\x20sent','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','SmsAccount','find','options','where','include','map','model','attributes','catch','util','moment'];(function(_0x35652f,_0x1b2c2b){var _0xea4b4b=function(_0x2568d4){while(--_0x2568d4){_0x35652f['push'](_0x35652f['shift']());}};_0xea4b4b(++_0x1b2c2b);}(_0x05d8,0xfe));var _0x805d=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x05d8[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0x805d('0x0'));var moment=require(_0x805d('0x1'));var BPromise=require('bluebird');var rs=require(_0x805d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x805d('0x3'))['db'];var utils=require(_0x805d('0x4'));var logger=require(_0x805d('0x5'))(_0x805d('0x6'));var config=require(_0x805d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x805d('0x8')]({'port':0x232a});config[_0x805d('0x9')]=_['defaults'](config['redis'],{'host':_0x805d('0xa'),'port':0x18eb});var socket=require(_0x805d('0xb'))(new Redis(config['redis']));require(_0x805d('0xc'))[_0x805d('0xd')](socket);function respondWithRpcPromise(_0x1b5b6a,_0x5dbe3e,_0x273b13){return new BPromise(function(_0x415adb,_0x7e73b6){return client['request'](_0x1b5b6a,_0x273b13)[_0x805d('0xe')](function(_0x1a1238){logger[_0x805d('0xf')]('SmsAccount,\x20%s,\x20%s',_0x5dbe3e,_0x805d('0x10'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5dbe3e,'request\x20sent',JSON[_0x805d('0x11')](_0x1a1238));if(_0x1a1238['error']){if(_0x1a1238['error']['code']===0x1f4){logger[_0x805d('0x12')](_0x805d('0x13'),_0x5dbe3e,_0x1a1238[_0x805d('0x12')][_0x805d('0x14')]);return _0x7e73b6(_0x1a1238['error'][_0x805d('0x14')]);}logger['error'](_0x805d('0x13'),_0x5dbe3e,_0x1a1238[_0x805d('0x12')][_0x805d('0x14')]);return _0x415adb(_0x1a1238[_0x805d('0x12')][_0x805d('0x14')]);}else{logger['info'](_0x805d('0x13'),_0x5dbe3e,_0x805d('0x10'));_0x415adb(_0x1a1238[_0x805d('0x15')][_0x805d('0x14')]);}})['catch'](function(_0x600d1e){logger[_0x805d('0x12')]('SmsAccount,\x20%s,\x20%s',_0x5dbe3e,_0x600d1e);_0x7e73b6(_0x600d1e);});});}exports[_0x805d('0x16')]=function(_0x10ea5a){var _0x5b11f5=this;return new Promise(function(_0x4766e4,_0x4162fb){return db[_0x805d('0x17')][_0x805d('0x18')]({'raw':_0x10ea5a[_0x805d('0x19')]?_0x10ea5a[_0x805d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x10ea5a[_0x805d('0x19')]?_0x10ea5a[_0x805d('0x19')][_0x805d('0x1a')]||null:null,'attributes':_0x10ea5a[_0x805d('0x19')]?_0x10ea5a[_0x805d('0x19')]['attributes']||null:null,'include':_0x10ea5a[_0x805d('0x19')]?_0x10ea5a[_0x805d('0x19')][_0x805d('0x1b')]?_[_0x805d('0x1c')](_0x10ea5a['options']['include'],function(_0x3dc852){return{'model':db[_0x3dc852[_0x805d('0x1d')]],'as':_0x3dc852['as'],'attributes':_0x3dc852[_0x805d('0x1e')],'include':_0x3dc852[_0x805d('0x1b')]?_[_0x805d('0x1c')](_0x3dc852[_0x805d('0x1b')],function(_0x97e577){return{'model':db[_0x97e577[_0x805d('0x1d')]],'as':_0x97e577['as'],'attributes':_0x97e577[_0x805d('0x1e')],'include':_0x97e577[_0x805d('0x1b')]?_['map'](_0x97e577[_0x805d('0x1b')],function(_0x510dfd){return{'model':db[_0x510dfd[_0x805d('0x1d')]],'as':_0x510dfd['as'],'attributes':_0x510dfd[_0x805d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ea3d4){logger[_0x805d('0xf')](_0x805d('0x16'),_0x10ea5a);logger['debug']('ShowSmsAccount',_0x10ea5a,JSON['stringify'](_0x5ea3d4));_0x4766e4(_0x5ea3d4);})[_0x805d('0x1f')](function(_0x3fb582){logger[_0x805d('0x12')](_0x805d('0x16'),_0x3fb582['message'],_0x10ea5a);_0x4162fb(_0x5b11f5[_0x805d('0x12')](0x1f4,_0x3fb582[_0x805d('0x14')]));});});}; \ No newline at end of file +var _0xace8=['socket.io-emitter','./smsAccount.socket','then','info','request\x20sent','debug','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','model','map','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xace8,0x16b));var _0x8ace=function(_0x49cc6d,_0x49b7f4){_0x49cc6d=_0x49cc6d-0x0;var _0x2054d9=_0xace8[_0x49cc6d];return _0x2054d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8ace('0x0'));var BPromise=require('bluebird');var rs=require(_0x8ace('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ace('0x2'))['db'];var utils=require(_0x8ace('0x3'));var logger=require(_0x8ace('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8ace('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x8ace('0x6')]=_[_0x8ace('0x7')](config[_0x8ace('0x6')],{'host':_0x8ace('0x8'),'port':0x18eb});var socket=require(_0x8ace('0x9'))(new Redis(config[_0x8ace('0x6')]));require(_0x8ace('0xa'))['register'](socket);function respondWithRpcPromise(_0x22c3a4,_0x1d548e,_0x4703db){return new BPromise(function(_0x290708,_0x598432){return client['request'](_0x22c3a4,_0x4703db)[_0x8ace('0xb')](function(_0x47dd64){logger[_0x8ace('0xc')]('SmsAccount,\x20%s,\x20%s',_0x1d548e,_0x8ace('0xd'));logger[_0x8ace('0xe')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1d548e,'request\x20sent',JSON[_0x8ace('0xf')](_0x47dd64));if(_0x47dd64[_0x8ace('0x10')]){if(_0x47dd64[_0x8ace('0x10')][_0x8ace('0x11')]===0x1f4){logger[_0x8ace('0x10')]('SmsAccount,\x20%s,\x20%s',_0x1d548e,_0x47dd64[_0x8ace('0x10')][_0x8ace('0x12')]);return _0x598432(_0x47dd64[_0x8ace('0x10')]['message']);}logger[_0x8ace('0x10')](_0x8ace('0x13'),_0x1d548e,_0x47dd64[_0x8ace('0x10')][_0x8ace('0x12')]);return _0x290708(_0x47dd64['error'][_0x8ace('0x12')]);}else{logger[_0x8ace('0xc')]('SmsAccount,\x20%s,\x20%s',_0x1d548e,'request\x20sent');_0x290708(_0x47dd64[_0x8ace('0x14')]['message']);}})[_0x8ace('0x15')](function(_0x8c0c4f){logger[_0x8ace('0x10')](_0x8ace('0x13'),_0x1d548e,_0x8c0c4f);_0x598432(_0x8c0c4f);});});}exports[_0x8ace('0x16')]=function(_0x5da012){var _0x14c903=this;return new Promise(function(_0x36cd92,_0x437ebf){return db['SmsAccount'][_0x8ace('0x17')]({'raw':_0x5da012[_0x8ace('0x18')]?_0x5da012['options'][_0x8ace('0x19')]===undefined?!![]:![]:!![],'where':_0x5da012[_0x8ace('0x18')]?_0x5da012['options'][_0x8ace('0x1a')]||null:null,'attributes':_0x5da012[_0x8ace('0x18')]?_0x5da012[_0x8ace('0x18')][_0x8ace('0x1b')]||null:null,'include':_0x5da012[_0x8ace('0x18')]?_0x5da012[_0x8ace('0x18')]['include']?_['map'](_0x5da012[_0x8ace('0x18')][_0x8ace('0x1c')],function(_0x2acc01){return{'model':db[_0x2acc01[_0x8ace('0x1d')]],'as':_0x2acc01['as'],'attributes':_0x2acc01[_0x8ace('0x1b')],'include':_0x2acc01[_0x8ace('0x1c')]?_['map'](_0x2acc01[_0x8ace('0x1c')],function(_0x64d5e){return{'model':db[_0x64d5e[_0x8ace('0x1d')]],'as':_0x64d5e['as'],'attributes':_0x64d5e[_0x8ace('0x1b')],'include':_0x64d5e['include']?_[_0x8ace('0x1e')](_0x64d5e[_0x8ace('0x1c')],function(_0x17228a){return{'model':db[_0x17228a['model']],'as':_0x17228a['as'],'attributes':_0x17228a[_0x8ace('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8ace('0xb')](function(_0x4d164a){logger['info'](_0x8ace('0x16'),_0x5da012);logger[_0x8ace('0xe')](_0x8ace('0x16'),_0x5da012,JSON[_0x8ace('0xf')](_0x4d164a));_0x36cd92(_0x4d164a);})[_0x8ace('0x15')](function(_0x23444a){logger[_0x8ace('0x10')]('ShowSmsAccount',_0x23444a[_0x8ace('0x12')],_0x5da012);_0x437ebf(_0x14c903[_0x8ace('0x10')](0x1f4,_0x23444a[_0x8ace('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ea5e54c..370a160 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 9b7872a..6773b34 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(_0x3f2e09,_0x231aee){var _0x2268e5=function(_0x46c277){while(--_0x46c277){_0x3f2e09['push'](_0x3f2e09['shift']());}};_0x2268e5(++_0x231aee);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ce7f4,_0x33d7da){_0x4ce7f4=_0x4ce7f4-0x0;var _0x7dd490=_0xedd9[_0x4ce7f4];return _0x7dd490;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x71d4f3,_0x4662e1){var _0x330245=function(_0xf57e25){while(--_0xf57e25){_0x71d4f3['push'](_0x71d4f3['shift']());}};_0x330245(++_0x4662e1);}(_0x3e74,0x175));var _0x43e7=function(_0x424d04,_0x408518){_0x424d04=_0x424d04-0x0;var _0x26e743=_0x3e74[_0x424d04];return _0x26e743;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6458927..94ebc18 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 _0x4d2d=['*,*,*,*','sequelize','STRING','TEXT'];(function(_0x5d3862,_0x41fcd5){var _0x399205=function(_0x472041){while(--_0x472041){_0x5d3862['push'](_0x5d3862['shift']());}};_0x399205(++_0x41fcd5);}(_0x4d2d,0x175));var _0xd4d2=function(_0x1f9bc0,_0x1edaaf){_0x1f9bc0=_0x1f9bc0-0x0;var _0x40de7a=_0x4d2d[_0x1f9bc0];return _0x40de7a;};'use strict';var Sequelize=require(_0xd4d2('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd4d2('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd4d2('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd4d2('0x1')],'defaultValue':_0xd4d2('0x3')}}; \ No newline at end of file +var _0xbaca=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xbaca,0xfc));var _0xabac=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xbaca[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0xabac('0x0'));module[_0xabac('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xabac('0x2')],'allowNull':![],'defaultValue':_0xabac('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xabac('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xabac('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index eca2168..52e0d22 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 _0x2ac4=['intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','SmsApplication','includeAll','catch','show','params','include','options','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x2ac4,0x183));var _0x42ac=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0x2ac4[_0x50b1c5];return _0x344f99;};'use strict';var emlformat=require(_0x42ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42ac('0x1'));var jsonpatch=require(_0x42ac('0x2'));var rp=require(_0x42ac('0x3'));var moment=require(_0x42ac('0x4'));var BPromise=require(_0x42ac('0x5'));var Mustache=require(_0x42ac('0x6'));var util=require(_0x42ac('0x7'));var path=require(_0x42ac('0x8'));var sox=require(_0x42ac('0x9'));var csv=require(_0x42ac('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x42ac('0xb'));var _=require(_0x42ac('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42ac('0xd'));var deskjs=require(_0x42ac('0xe'));var toCsv=require(_0x42ac('0xa'));var querystring=require(_0x42ac('0xf'));var Papa=require(_0x42ac('0x10'));var Redis=require(_0x42ac('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x42ac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42ac('0x13'))(_0x42ac('0x14'));var utils=require(_0x42ac('0x15'));var config=require(_0x42ac('0x16'));var licenseUtil=require(_0x42ac('0x17'));var db=require(_0x42ac('0x18'))['db'];function respondWithStatusCode(_0x37d0fd,_0x309898){_0x309898=_0x309898||0xcc;return function(_0x213db9){if(_0x213db9){return _0x37d0fd[_0x42ac('0x19')](_0x309898);}return _0x37d0fd[_0x42ac('0x1a')](_0x309898)[_0x42ac('0x1b')]();};}function respondWithResult(_0x44cdd7,_0x2e28b4){_0x2e28b4=_0x2e28b4||0xc8;return function(_0x404f21){if(_0x404f21){return _0x44cdd7[_0x42ac('0x1a')](_0x2e28b4)[_0x42ac('0x1c')](_0x404f21);}};}function respondWithFilteredResult(_0x3b19a7,_0x15b77d){return function(_0x483244){if(_0x483244){var _0xec9709=typeof _0x15b77d[_0x42ac('0x1d')]===_0x42ac('0x1e')&&typeof _0x15b77d[_0x42ac('0x1f')]===_0x42ac('0x1e');var _0x2658f7=_0x483244[_0x42ac('0x20')];var _0x33576d=_0xec9709?0x0:_0x15b77d[_0x42ac('0x1d')];var _0x53a52d=_0xec9709?_0x483244[_0x42ac('0x20')]:_0x15b77d[_0x42ac('0x1d')]+_0x15b77d[_0x42ac('0x1f')];var _0x4513bd;if(_0x53a52d>=_0x2658f7){_0x53a52d=_0x2658f7;_0x4513bd=0xc8;}else{_0x4513bd=0xce;}_0x3b19a7[_0x42ac('0x1a')](_0x4513bd);return _0x3b19a7[_0x42ac('0x21')]('Content-Range',_0x33576d+'-'+_0x53a52d+'/'+_0x2658f7)[_0x42ac('0x1c')](_0x483244);}return null;};}function patchUpdates(_0x4b9276){return function(_0xaaf21f){try{jsonpatch[_0x42ac('0x22')](_0xaaf21f,_0x4b9276,!![]);}catch(_0x1232c9){return BPromise[_0x42ac('0x23')](_0x1232c9);}return _0xaaf21f['save']();};}function saveUpdates(_0x1b910e,_0x996d5f){return function(_0x740c04){if(_0x740c04){return _0x740c04[_0x42ac('0x24')](_0x1b910e)[_0x42ac('0x25')](function(_0x4c22d0){return _0x4c22d0;});}return null;};}function removeEntity(_0x40442a,_0x567830){return function(_0x2797ea){if(_0x2797ea){return _0x2797ea['destroy']()[_0x42ac('0x25')](function(){_0x40442a[_0x42ac('0x1a')](0xcc)[_0x42ac('0x1b')]();});}};}function handleEntityNotFound(_0x3f1799,_0x4ff78d){return function(_0x4fb822){if(!_0x4fb822){_0x3f1799[_0x42ac('0x19')](0x194);}return _0x4fb822;};}function handleError(_0xd6ecfc,_0x4c1c18){_0x4c1c18=_0x4c1c18||0x1f4;return function(_0x2777fb){logger[_0x42ac('0x26')](_0x2777fb[_0x42ac('0x27')]);if(_0x2777fb[_0x42ac('0x28')]){delete _0x2777fb[_0x42ac('0x28')];}_0xd6ecfc[_0x42ac('0x1a')](_0x4c1c18)[_0x42ac('0x29')](_0x2777fb);};}exports['index']=function(_0x8bd23f,_0x224478){var _0xd3fcd3={},_0x433068={},_0x52fb0e={'count':0x0,'rows':[]};var _0x42de25=_[_0x42ac('0x2a')](db['SmsApplication'][_0x42ac('0x2b')],function(_0x173d8c){return{'name':_0x173d8c[_0x42ac('0x2c')],'type':_0x173d8c[_0x42ac('0x2d')][_0x42ac('0x2e')]};});_0x433068[_0x42ac('0x2f')]=_[_0x42ac('0x2a')](_0x42de25,_0x42ac('0x28'));_0x433068[_0x42ac('0x30')]=_[_0x42ac('0x31')](_0x8bd23f['query']);_0x433068[_0x42ac('0x32')]=_['intersection'](_0x433068[_0x42ac('0x2f')],_0x433068[_0x42ac('0x30')]);_0xd3fcd3['attributes']=_[_0x42ac('0x33')](_0x433068[_0x42ac('0x2f')],qs[_0x42ac('0x34')](_0x8bd23f[_0x42ac('0x30')][_0x42ac('0x34')]));_0xd3fcd3[_0x42ac('0x35')]=_0xd3fcd3[_0x42ac('0x35')][_0x42ac('0x36')]?_0xd3fcd3[_0x42ac('0x35')]:_0x433068['model'];if(!_0x8bd23f['query'][_0x42ac('0x37')]('nolimit')){_0xd3fcd3['limit']=qs[_0x42ac('0x1f')](_0x8bd23f[_0x42ac('0x30')][_0x42ac('0x1f')]);_0xd3fcd3[_0x42ac('0x1d')]=qs['offset'](_0x8bd23f[_0x42ac('0x30')][_0x42ac('0x1d')]);}_0xd3fcd3[_0x42ac('0x38')]=qs[_0x42ac('0x39')](_0x8bd23f[_0x42ac('0x30')][_0x42ac('0x39')]);_0xd3fcd3['where']=qs[_0x42ac('0x32')](_[_0x42ac('0x3a')](_0x8bd23f[_0x42ac('0x30')],_0x433068[_0x42ac('0x32')]),_0x42de25);if(_0x8bd23f[_0x42ac('0x30')]['filter']){_0xd3fcd3[_0x42ac('0x3b')]=_[_0x42ac('0x3c')](_0xd3fcd3[_0x42ac('0x3b')],{'$or':_[_0x42ac('0x2a')](_0x42de25,function(_0x15ffcb){if(_0x15ffcb[_0x42ac('0x2d')]!==_0x42ac('0x3d')){var _0x1c2e37={};_0x1c2e37[_0x15ffcb[_0x42ac('0x28')]]={'$like':'%'+_0x8bd23f[_0x42ac('0x30')][_0x42ac('0x3e')]+'%'};return _0x1c2e37;}})});}_0xd3fcd3=_[_0x42ac('0x3c')]({},_0xd3fcd3,_0x8bd23f['options']);var _0xbb44e4={'where':_0xd3fcd3[_0x42ac('0x3b')]};return db[_0x42ac('0x3f')][_0x42ac('0x20')](_0xbb44e4)['then'](function(_0x3f1270){_0x52fb0e[_0x42ac('0x20')]=_0x3f1270;if(_0x8bd23f['query'][_0x42ac('0x40')]){_0xd3fcd3['include']=[{'all':!![]}];}return db[_0x42ac('0x3f')]['findAll'](_0xd3fcd3);})['then'](function(_0x34b588){_0x52fb0e['rows']=_0x34b588;return _0x52fb0e;})[_0x42ac('0x25')](respondWithFilteredResult(_0x224478,_0xd3fcd3))[_0x42ac('0x41')](handleError(_0x224478,null));};exports[_0x42ac('0x42')]=function(_0x176959,_0x215662){var _0x2848fe={'raw':!![],'where':{'id':_0x176959[_0x42ac('0x43')]['id']}},_0x1b7eac={};_0x1b7eac[_0x42ac('0x2f')]=_[_0x42ac('0x31')](db[_0x42ac('0x3f')]['rawAttributes']);_0x1b7eac['query']=_['keys'](_0x176959['query']);_0x1b7eac[_0x42ac('0x32')]=_[_0x42ac('0x33')](_0x1b7eac['model'],_0x1b7eac[_0x42ac('0x30')]);_0x2848fe[_0x42ac('0x35')]=_[_0x42ac('0x33')](_0x1b7eac[_0x42ac('0x2f')],qs['fields'](_0x176959['query'][_0x42ac('0x34')]));_0x2848fe['attributes']=_0x2848fe['attributes']['length']?_0x2848fe[_0x42ac('0x35')]:_0x1b7eac['model'];if(_0x176959[_0x42ac('0x30')][_0x42ac('0x40')]){_0x2848fe[_0x42ac('0x44')]=[{'all':!![]}];}_0x2848fe=_[_0x42ac('0x3c')]({},_0x2848fe,_0x176959[_0x42ac('0x45')]);return db['SmsApplication']['find'](_0x2848fe)[_0x42ac('0x25')](handleEntityNotFound(_0x215662,null))[_0x42ac('0x25')](respondWithResult(_0x215662,null))['catch'](handleError(_0x215662,null));};exports[_0x42ac('0x46')]=function(_0x312188,_0x40f498){return db[_0x42ac('0x3f')][_0x42ac('0x46')](_0x312188[_0x42ac('0x47')],{})['then'](respondWithResult(_0x40f498,0xc9))[_0x42ac('0x41')](handleError(_0x40f498,null));};exports[_0x42ac('0x24')]=function(_0x1b3fb1,_0x3bb23b){if(_0x1b3fb1['body']['id']){delete _0x1b3fb1[_0x42ac('0x47')]['id'];}return db[_0x42ac('0x3f')][_0x42ac('0x48')]({'where':{'id':_0x1b3fb1[_0x42ac('0x43')]['id']}})['then'](handleEntityNotFound(_0x3bb23b,null))['then'](saveUpdates(_0x1b3fb1[_0x42ac('0x47')],null))['then'](respondWithResult(_0x3bb23b,null))[_0x42ac('0x41')](handleError(_0x3bb23b,null));};exports['destroy']=function(_0x40be80,_0x527c35){return db[_0x42ac('0x3f')]['find']({'where':{'id':_0x40be80[_0x42ac('0x43')]['id']}})[_0x42ac('0x25')](handleEntityNotFound(_0x527c35,null))[_0x42ac('0x25')](removeEntity(_0x527c35,null))[_0x42ac('0x41')](handleError(_0x527c35,null));}; \ No newline at end of file +var _0xd464=['fields','attributes','nolimit','sort','filters','pick','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','rawAttributes','length','options','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','fieldName','type','key','model','query','keys','intersection'];(function(_0x3f9f01,_0x565932){var _0x3d5ccc=function(_0x1477a0){while(--_0x1477a0){_0x3f9f01['push'](_0x3f9f01['shift']());}};_0x3d5ccc(++_0x565932);}(_0xd464,0x136));var _0x4d46=function(_0x3a6a8a,_0x377e84){_0x3a6a8a=_0x3a6a8a-0x0;var _0x56bf28=_0xd464[_0x3a6a8a];return _0x56bf28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d46('0x0'));var zipdir=require(_0x4d46('0x1'));var jsonpatch=require(_0x4d46('0x2'));var rp=require(_0x4d46('0x3'));var moment=require('moment');var BPromise=require(_0x4d46('0x4'));var Mustache=require(_0x4d46('0x5'));var util=require(_0x4d46('0x6'));var path=require(_0x4d46('0x7'));var sox=require(_0x4d46('0x8'));var csv=require(_0x4d46('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d46('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4d46('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4d46('0xc'));var toCsv=require(_0x4d46('0x9'));var querystring=require(_0x4d46('0xd'));var Papa=require(_0x4d46('0xe'));var Redis=require(_0x4d46('0xf'));var authService=require(_0x4d46('0x10'));var qs=require(_0x4d46('0x11'));var as=require(_0x4d46('0x12'));var hardwareService=require(_0x4d46('0x13'));var logger=require('../../config/logger')(_0x4d46('0x14'));var utils=require(_0x4d46('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4d46('0x16'));var db=require(_0x4d46('0x17'))['db'];function respondWithStatusCode(_0x170fca,_0x443ec0){_0x443ec0=_0x443ec0||0xcc;return function(_0x137879){if(_0x137879){return _0x170fca[_0x4d46('0x18')](_0x443ec0);}return _0x170fca[_0x4d46('0x19')](_0x443ec0)['end']();};}function respondWithResult(_0x54255e,_0xaf11b6){_0xaf11b6=_0xaf11b6||0xc8;return function(_0x2edd9f){if(_0x2edd9f){return _0x54255e[_0x4d46('0x19')](_0xaf11b6)[_0x4d46('0x1a')](_0x2edd9f);}};}function respondWithFilteredResult(_0x51da0f,_0x38fb03){return function(_0x1a1475){if(_0x1a1475){var _0x4cedf9=typeof _0x38fb03[_0x4d46('0x1b')]===_0x4d46('0x1c')&&typeof _0x38fb03[_0x4d46('0x1d')]==='undefined';var _0x5eee5c=_0x1a1475['count'];var _0x384437=_0x4cedf9?0x0:_0x38fb03['offset'];var _0x4115d5=_0x4cedf9?_0x1a1475['count']:_0x38fb03[_0x4d46('0x1b')]+_0x38fb03[_0x4d46('0x1d')];var _0x1f4fdb;if(_0x4115d5>=_0x5eee5c){_0x4115d5=_0x5eee5c;_0x1f4fdb=0xc8;}else{_0x1f4fdb=0xce;}_0x51da0f[_0x4d46('0x19')](_0x1f4fdb);return _0x51da0f[_0x4d46('0x1e')]('Content-Range',_0x384437+'-'+_0x4115d5+'/'+_0x5eee5c)[_0x4d46('0x1a')](_0x1a1475);}return null;};}function patchUpdates(_0x472ffd){return function(_0x4dd8d9){try{jsonpatch['apply'](_0x4dd8d9,_0x472ffd,!![]);}catch(_0x27339d){return BPromise[_0x4d46('0x1f')](_0x27339d);}return _0x4dd8d9[_0x4d46('0x20')]();};}function saveUpdates(_0x1700a4,_0x7bd434){return function(_0x41c020){if(_0x41c020){return _0x41c020[_0x4d46('0x21')](_0x1700a4)[_0x4d46('0x22')](function(_0x5217ea){return _0x5217ea;});}return null;};}function removeEntity(_0x493fae,_0x3d1e31){return function(_0x41d1de){if(_0x41d1de){return _0x41d1de[_0x4d46('0x23')]()['then'](function(){_0x493fae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31d066,_0x1a2ebc){return function(_0x3d97e5){if(!_0x3d97e5){_0x31d066[_0x4d46('0x18')](0x194);}return _0x3d97e5;};}function handleError(_0xf58c02,_0x5b9e92){_0x5b9e92=_0x5b9e92||0x1f4;return function(_0x40dc2f){logger[_0x4d46('0x24')](_0x40dc2f[_0x4d46('0x25')]);if(_0x40dc2f[_0x4d46('0x26')]){delete _0x40dc2f[_0x4d46('0x26')];}_0xf58c02[_0x4d46('0x19')](_0x5b9e92)[_0x4d46('0x27')](_0x40dc2f);};}exports[_0x4d46('0x28')]=function(_0x953834,_0x5af2a0){var _0x2d44fb={},_0x2dc211={},_0x1196bb={'count':0x0,'rows':[]};var _0x1298e5=_[_0x4d46('0x29')](db[_0x4d46('0x2a')]['rawAttributes'],function(_0x32a220){return{'name':_0x32a220[_0x4d46('0x2b')],'type':_0x32a220[_0x4d46('0x2c')][_0x4d46('0x2d')]};});_0x2dc211[_0x4d46('0x2e')]=_['map'](_0x1298e5,'name');_0x2dc211[_0x4d46('0x2f')]=_[_0x4d46('0x30')](_0x953834[_0x4d46('0x2f')]);_0x2dc211['filters']=_[_0x4d46('0x31')](_0x2dc211[_0x4d46('0x2e')],_0x2dc211[_0x4d46('0x2f')]);_0x2d44fb['attributes']=_[_0x4d46('0x31')](_0x2dc211['model'],qs[_0x4d46('0x32')](_0x953834[_0x4d46('0x2f')][_0x4d46('0x32')]));_0x2d44fb[_0x4d46('0x33')]=_0x2d44fb[_0x4d46('0x33')]['length']?_0x2d44fb[_0x4d46('0x33')]:_0x2dc211[_0x4d46('0x2e')];if(!_0x953834[_0x4d46('0x2f')]['hasOwnProperty'](_0x4d46('0x34'))){_0x2d44fb[_0x4d46('0x1d')]=qs[_0x4d46('0x1d')](_0x953834[_0x4d46('0x2f')][_0x4d46('0x1d')]);_0x2d44fb[_0x4d46('0x1b')]=qs[_0x4d46('0x1b')](_0x953834[_0x4d46('0x2f')][_0x4d46('0x1b')]);}_0x2d44fb['order']=qs[_0x4d46('0x35')](_0x953834['query'][_0x4d46('0x35')]);_0x2d44fb['where']=qs[_0x4d46('0x36')](_[_0x4d46('0x37')](_0x953834[_0x4d46('0x2f')],_0x2dc211[_0x4d46('0x36')]),_0x1298e5);if(_0x953834[_0x4d46('0x2f')]['filter']){_0x2d44fb[_0x4d46('0x38')]=_[_0x4d46('0x39')](_0x2d44fb[_0x4d46('0x38')],{'$or':_[_0x4d46('0x29')](_0x1298e5,function(_0x589b7a){if(_0x589b7a[_0x4d46('0x2c')]!==_0x4d46('0x3a')){var _0x15b638={};_0x15b638[_0x589b7a[_0x4d46('0x26')]]={'$like':'%'+_0x953834[_0x4d46('0x2f')]['filter']+'%'};return _0x15b638;}})});}_0x2d44fb=_[_0x4d46('0x39')]({},_0x2d44fb,_0x953834['options']);var _0x51c83b={'where':_0x2d44fb['where']};return db[_0x4d46('0x2a')][_0x4d46('0x3b')](_0x51c83b)[_0x4d46('0x22')](function(_0x5cc325){_0x1196bb[_0x4d46('0x3b')]=_0x5cc325;if(_0x953834[_0x4d46('0x2f')][_0x4d46('0x3c')]){_0x2d44fb[_0x4d46('0x3d')]=[{'all':!![]}];}return db[_0x4d46('0x2a')][_0x4d46('0x3e')](_0x2d44fb);})[_0x4d46('0x22')](function(_0x53e3a3){_0x1196bb[_0x4d46('0x3f')]=_0x53e3a3;return _0x1196bb;})['then'](respondWithFilteredResult(_0x5af2a0,_0x2d44fb))['catch'](handleError(_0x5af2a0,null));};exports[_0x4d46('0x40')]=function(_0x493576,_0x4a7250){var _0x215e7e={'raw':!![],'where':{'id':_0x493576[_0x4d46('0x41')]['id']}},_0xd8fa2b={};_0xd8fa2b[_0x4d46('0x2e')]=_[_0x4d46('0x30')](db['SmsApplication'][_0x4d46('0x42')]);_0xd8fa2b[_0x4d46('0x2f')]=_[_0x4d46('0x30')](_0x493576[_0x4d46('0x2f')]);_0xd8fa2b[_0x4d46('0x36')]=_[_0x4d46('0x31')](_0xd8fa2b[_0x4d46('0x2e')],_0xd8fa2b['query']);_0x215e7e[_0x4d46('0x33')]=_[_0x4d46('0x31')](_0xd8fa2b[_0x4d46('0x2e')],qs[_0x4d46('0x32')](_0x493576['query'][_0x4d46('0x32')]));_0x215e7e[_0x4d46('0x33')]=_0x215e7e['attributes'][_0x4d46('0x43')]?_0x215e7e['attributes']:_0xd8fa2b[_0x4d46('0x2e')];if(_0x493576[_0x4d46('0x2f')][_0x4d46('0x3c')]){_0x215e7e[_0x4d46('0x3d')]=[{'all':!![]}];}_0x215e7e=_[_0x4d46('0x39')]({},_0x215e7e,_0x493576[_0x4d46('0x44')]);return db['SmsApplication'][_0x4d46('0x45')](_0x215e7e)[_0x4d46('0x22')](handleEntityNotFound(_0x4a7250,null))[_0x4d46('0x22')](respondWithResult(_0x4a7250,null))[_0x4d46('0x46')](handleError(_0x4a7250,null));};exports['create']=function(_0x7a238c,_0x4af4c1){return db[_0x4d46('0x2a')]['create'](_0x7a238c['body'],{})[_0x4d46('0x22')](respondWithResult(_0x4af4c1,0xc9))[_0x4d46('0x46')](handleError(_0x4af4c1,null));};exports[_0x4d46('0x21')]=function(_0x54934b,_0xf4c64c){if(_0x54934b['body']['id']){delete _0x54934b['body']['id'];}return db[_0x4d46('0x2a')][_0x4d46('0x45')]({'where':{'id':_0x54934b[_0x4d46('0x41')]['id']}})['then'](handleEntityNotFound(_0xf4c64c,null))[_0x4d46('0x22')](saveUpdates(_0x54934b[_0x4d46('0x47')],null))[_0x4d46('0x22')](respondWithResult(_0xf4c64c,null))[_0x4d46('0x46')](handleError(_0xf4c64c,null));};exports[_0x4d46('0x23')]=function(_0x27c75c,_0x5be80b){return db[_0x4d46('0x2a')][_0x4d46('0x45')]({'where':{'id':_0x27c75c[_0x4d46('0x41')]['id']}})[_0x4d46('0x22')](handleEntityNotFound(_0x5be80b,null))['then'](removeEntity(_0x5be80b,null))[_0x4d46('0x46')](handleError(_0x5be80b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 89232a2..bcfce12 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 _0xb0c2=['../../config/environment','./smsApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0xb0c2,0x1aa));var _0x2b0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2b0c('0x0'));var util=require(_0x2b0c('0x1'));var logger=require(_0x2b0c('0x2'))(_0x2b0c('0x3'));var moment=require(_0x2b0c('0x4'));var BPromise=require(_0x2b0c('0x5'));var rp=require(_0x2b0c('0x6'));var fs=require('fs');var path=require(_0x2b0c('0x7'));var rimraf=require('rimraf');var config=require(_0x2b0c('0x8'));var attributes=require(_0x2b0c('0x9'));module[_0x2b0c('0xa')]=function(_0x5080d0,_0x55fc15){return _0x5080d0[_0x2b0c('0xb')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2b0c('0xc'),'collate':_0x2b0c('0xd')});}; \ No newline at end of file +var _0x6cb0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1d45a6,_0x3424cf){var _0x4d0386=function(_0x4fcbcf){while(--_0x4fcbcf){_0x1d45a6['push'](_0x1d45a6['shift']());}};_0x4d0386(++_0x3424cf);}(_0x6cb0,0x1bf));var _0x06cb=function(_0xb43d1b,_0x3935cf){_0xb43d1b=_0xb43d1b-0x0;var _0x4aafca=_0x6cb0[_0xb43d1b];return _0x4aafca;};'use strict';var _=require(_0x06cb('0x0'));var util=require('util');var logger=require(_0x06cb('0x1'))(_0x06cb('0x2'));var moment=require(_0x06cb('0x3'));var BPromise=require(_0x06cb('0x4'));var rp=require(_0x06cb('0x5'));var fs=require('fs');var path=require(_0x06cb('0x6'));var rimraf=require(_0x06cb('0x7'));var config=require(_0x06cb('0x8'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x23be93,_0x36eafa){return _0x23be93[_0x06cb('0x9')](_0x06cb('0xa'),attributes,{'tableName':_0x06cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x06cb('0xc'),'collate':_0x06cb('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 452f8e7..32645a9 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 _0x6257=['info','request\x20sent','debug','code','message','error','SmsApplication,\x20%s,\x20%s','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2911da,_0x15b359){var _0x390d9c=function(_0x4888b8){while(--_0x4888b8){_0x2911da['push'](_0x2911da['shift']());}};_0x390d9c(++_0x15b359);}(_0x6257,0x1d4));var _0x7625=function(_0x45cfae,_0x56a10b){_0x45cfae=_0x45cfae-0x0;var _0x3f0055=_0x6257[_0x45cfae];return _0x3f0055;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var moment=require(_0x7625('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7625('0x2'));var db=require(_0x7625('0x3'))['db'];var utils=require(_0x7625('0x4'));var logger=require(_0x7625('0x5'))(_0x7625('0x6'));var config=require(_0x7625('0x7'));var jayson=require(_0x7625('0x8'));var client=jayson[_0x7625('0x9')][_0x7625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427050,_0x5cf7a8,_0x4b790d){return new BPromise(function(_0x287434,_0x1a02de){return client['request'](_0x427050,_0x4b790d)[_0x7625('0xb')](function(_0x2a2625){logger[_0x7625('0xc')]('SmsApplication,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'));logger[_0x7625('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'),JSON['stringify'](_0x2a2625));if(_0x2a2625['error']){if(_0x2a2625['error'][_0x7625('0xf')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x5cf7a8,_0x2a2625['error'][_0x7625('0x10')]);return _0x1a02de(_0x2a2625[_0x7625('0x11')][_0x7625('0x10')]);}logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x2a2625[_0x7625('0x11')]['message']);return _0x287434(_0x2a2625['error'][_0x7625('0x10')]);}else{logger['info'](_0x7625('0x12'),_0x5cf7a8,_0x7625('0xd'));_0x287434(_0x2a2625[_0x7625('0x13')]['message']);}})['catch'](function(_0x43206e){logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x43206e);_0x1a02de(_0x43206e);});});} \ No newline at end of file +var _0xcb22=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x32fa20,_0x7ed4ed){var _0xe524ab=function(_0x5f9dd9){while(--_0x5f9dd9){_0x32fa20['push'](_0x32fa20['shift']());}};_0xe524ab(++_0x7ed4ed);}(_0xcb22,0xc8));var _0x2cb2=function(_0x29bb51,_0x1fb819){_0x29bb51=_0x29bb51-0x0;var _0x2dbdb3=_0xcb22[_0x29bb51];return _0x2dbdb3;};'use strict';var _=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var moment=require(_0x2cb2('0x2'));var BPromise=require(_0x2cb2('0x3'));var rs=require(_0x2cb2('0x4'));var fs=require('fs');var Redis=require(_0x2cb2('0x5'));var db=require(_0x2cb2('0x6'))['db'];var utils=require(_0x2cb2('0x7'));var logger=require(_0x2cb2('0x8'))(_0x2cb2('0x9'));var config=require(_0x2cb2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2cb2('0xb')][_0x2cb2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31bf9f,_0x16b1a1,_0x460984){return new BPromise(function(_0x587c3e,_0x46ec04){return client[_0x2cb2('0xd')](_0x31bf9f,_0x460984)['then'](function(_0x16b59d){logger[_0x2cb2('0xe')](_0x2cb2('0xf'),_0x16b1a1,_0x2cb2('0x10'));logger[_0x2cb2('0x11')](_0x2cb2('0x12'),_0x16b1a1,'request\x20sent',JSON['stringify'](_0x16b59d));if(_0x16b59d[_0x2cb2('0x13')]){if(_0x16b59d[_0x2cb2('0x13')]['code']===0x1f4){logger['error'](_0x2cb2('0xf'),_0x16b1a1,_0x16b59d['error'][_0x2cb2('0x14')]);return _0x46ec04(_0x16b59d['error'][_0x2cb2('0x14')]);}logger[_0x2cb2('0x13')]('SmsApplication,\x20%s,\x20%s',_0x16b1a1,_0x16b59d[_0x2cb2('0x13')][_0x2cb2('0x14')]);return _0x587c3e(_0x16b59d[_0x2cb2('0x13')]['message']);}else{logger[_0x2cb2('0xe')](_0x2cb2('0xf'),_0x16b1a1,'request\x20sent');_0x587c3e(_0x16b59d[_0x2cb2('0x15')]['message']);}})[_0x2cb2('0x16')](function(_0x26045d){logger[_0x2cb2('0x13')](_0x2cb2('0xf'),_0x16b1a1,_0x26045d);_0x46ec04(_0x26045d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 49e43d0..182287b 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 _0x96cc=['smsinteraction:destroy','delete','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update'];(function(_0x226ee2,_0x15540b){var _0x5617c0=function(_0x2c73e6){while(--_0x2c73e6){_0x226ee2['push'](_0x226ee2['shift']());}};_0x5617c0(++_0x15540b);}(_0x96cc,0x16c));var _0xc96c=function(_0x3e10b0,_0x4544e3){_0x3e10b0=_0x3e10b0-0x0;var _0x14b94d=_0x96cc[_0x3e10b0];return _0x14b94d;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['show']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['getMessages']);router[_0xc96c('0x9')]('/:id/download',auth[_0xc96c('0xa')](),controller['download']);router[_0xc96c('0xf')]('/',auth[_0xc96c('0xa')](),controller[_0xc96c('0x10')]);router[_0xc96c('0xf')]('/:id/messages',auth[_0xc96c('0xa')](),controller[_0xc96c('0x11')]);router[_0xc96c('0xf')](_0xc96c('0x12'),auth['isAuthenticated'](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x15')),controller[_0xc96c('0x16')]);router[_0xc96c('0x17')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x18')),controller[_0xc96c('0x19')]);router['delete']('/:id',auth[_0xc96c('0xa')](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x1a')),controller['destroy']);router[_0xc96c('0x1b')](_0xc96c('0x12'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x1c')]);module[_0xc96c('0x1d')]=router; \ No newline at end of file +var _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5c00,0x17e));var _0x05c0=function(_0x30eb36,_0x4f7dab){_0x30eb36=_0x30eb36-0x0;var _0x1b33d1=_0x5c00[_0x30eb36];return _0x1b33d1;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index cd175ea..b94c0cf 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 _0x078c=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x402d59,_0x1f2447){var _0x1d95bb=function(_0x312a73){while(--_0x312a73){_0x402d59['push'](_0x402d59['shift']());}};_0x1d95bb(++_0x1f2447);}(_0x078c,0x19f));var _0xc078=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x078c[_0x1aba25];return _0x47d997;};'use strict';var Sequelize=require(_0xc078('0x0'));var moment=require('moment');module[_0xc078('0x1')]={'closed':{'type':Sequelize[_0xc078('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc078('0x3')]},'secondDisposition':{'type':Sequelize[_0xc078('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc078('0x3')]},'note':{'type':Sequelize[_0xc078('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc078('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc078('0x5')]('in',_0xc078('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc078('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc078('0x5')]('in',_0xc078('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc078('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd8a7=['BOOLEAN','sequelize','DATE','STRING','out','ENUM'];(function(_0x176259,_0x30e46f){var _0x48dc40=function(_0x3aa524){while(--_0x3aa524){_0x176259['push'](_0x176259['shift']());}};_0x48dc40(++_0x30e46f);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x21f1a2,_0x1b9787){_0x21f1a2=_0x21f1a2-0x0;var _0xec888c=_0xd8a7[_0x21f1a2];return _0xec888c;};'use strict';var Sequelize=require(_0x7d8a('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d8a('0x1')]},'disposition':{'type':Sequelize[_0x7d8a('0x2')]},'secondDisposition':{'type':Sequelize[_0x7d8a('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7d8a('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7d8a('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7d8a('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7d8a('0x4')]('in',_0x7d8a('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7d8a('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c816b5c..f1e9b7b 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 _0xc3fb=['download','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Messages','secret','Account','Owner','mkdirSync','Sms','N.A.','closed','closedAt','disposition','YYYY-MM-DD\x20HH:mm:ss','direction','out','System','renderFile','views','.pdf','createPdfFromHTML','err','sendStatus','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./smsInteraction.socket','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','isEmpty','i.SmsAccountId\x20IN\x20?','role','toString','sequelize','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','params','includeAll','include','options','create','body','destroy','describe','ids','omit','getMessages','findOne','SmsMessage','$gte','format','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags'];(function(_0x56b4e6,_0x1e5dfa){var _0x4dd8c4=function(_0x3ac8b0){while(--_0x3ac8b0){_0x56b4e6['push'](_0x56b4e6['shift']());}};_0x4dd8c4(++_0x1e5dfa);}(_0xc3fb,0x1ea));var _0xbc3f=function(_0x2ac105,_0x3527f9){_0x2ac105=_0x2ac105-0x0;var _0xd2ff6f=_0xc3fb[_0x2ac105];return _0xd2ff6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc3f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc3f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbc3f('0x2'));var Mustache=require('mustache');var util=require(_0xbc3f('0x3'));var path=require(_0xbc3f('0x4'));var sox=require(_0xbc3f('0x5'));var csv=require(_0xbc3f('0x6'));var ejs=require(_0xbc3f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc3f('0x8'));var squel=require(_0xbc3f('0x9'));var crypto=require(_0xbc3f('0xa'));var jsforce=require(_0xbc3f('0xb'));var deskjs=require(_0xbc3f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbc3f('0xd'));var Papa=require(_0xbc3f('0xe'));var Redis=require(_0xbc3f('0xf'));var authService=require(_0xbc3f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbc3f('0x11'));var pdf=require(_0xbc3f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc3f('0x13'))(_0xbc3f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbc3f('0x15'));var db=require('../../mysqldb')['db'];config[_0xbc3f('0x16')]=_['defaults'](config[_0xbc3f('0x16')],{'host':_0xbc3f('0x17'),'port':0x18eb});var socket=require(_0xbc3f('0x18'))(new Redis(config[_0xbc3f('0x16')]));require(_0xbc3f('0x19'))['register'](socket);function respondWithStatusCode(_0xd48560,_0x139e66){_0x139e66=_0x139e66||0xcc;return function(_0x56e004){if(_0x56e004){return _0xd48560['sendStatus'](_0x139e66);}return _0xd48560[_0xbc3f('0x1a')](_0x139e66)[_0xbc3f('0x1b')]();};}function respondWithResult(_0x4353f8,_0x3b1b27){_0x3b1b27=_0x3b1b27||0xc8;return function(_0x252f43){if(_0x252f43){return _0x4353f8[_0xbc3f('0x1a')](_0x3b1b27)['json'](_0x252f43);}};}function respondWithFilteredResult(_0x1f5e26,_0x46ceac){return function(_0x344e35){if(_0x344e35){var _0x5f16a8=typeof _0x46ceac[_0xbc3f('0x1c')]==='undefined'&&typeof _0x46ceac[_0xbc3f('0x1d')]===_0xbc3f('0x1e');var _0xccae07=_0x344e35[_0xbc3f('0x1f')];var _0x1bba09=_0x5f16a8?0x0:_0x46ceac[_0xbc3f('0x1c')];var _0x621aa6=_0x5f16a8?_0x344e35[_0xbc3f('0x1f')]:_0x46ceac[_0xbc3f('0x1c')]+_0x46ceac[_0xbc3f('0x1d')];var _0x13683b;if(_0x621aa6>=_0xccae07){_0x621aa6=_0xccae07;_0x13683b=0xc8;}else{_0x13683b=0xce;}_0x1f5e26[_0xbc3f('0x1a')](_0x13683b);return _0x1f5e26[_0xbc3f('0x20')](_0xbc3f('0x21'),_0x1bba09+'-'+_0x621aa6+'/'+_0xccae07)[_0xbc3f('0x22')](_0x344e35);}return null;};}function patchUpdates(_0x19aeea){return function(_0xc31d71){try{jsonpatch[_0xbc3f('0x23')](_0xc31d71,_0x19aeea,!![]);}catch(_0x5884cd){return BPromise[_0xbc3f('0x24')](_0x5884cd);}return _0xc31d71[_0xbc3f('0x25')]();};}function saveUpdates(_0xd7b16e,_0x462c4b){return function(_0x209f48){if(_0x209f48){return _0x209f48[_0xbc3f('0x26')](_0xd7b16e)[_0xbc3f('0x27')](function(_0x3ed361){return _0x3ed361;});}return null;};}function removeEntity(_0x41e067,_0x2b178b){return function(_0x389327){if(_0x389327){return _0x389327['destroy']()[_0xbc3f('0x27')](function(){_0x41e067[_0xbc3f('0x1a')](0xcc)[_0xbc3f('0x1b')]();});}};}function handleEntityNotFound(_0xe99354,_0x22cec5){return function(_0x23722e){if(!_0x23722e){_0xe99354['sendStatus'](0x194);}return _0x23722e;};}function handleError(_0x436124,_0x23ac34){_0x23ac34=_0x23ac34||0x1f4;return function(_0x488b4f){logger[_0xbc3f('0x28')](_0x488b4f[_0xbc3f('0x29')]);if(_0x488b4f[_0xbc3f('0x2a')]){delete _0x488b4f[_0xbc3f('0x2a')];}_0x436124[_0xbc3f('0x1a')](_0x23ac34)[_0xbc3f('0x2b')](_0x488b4f);};}function getInteractionUsers(_0x542445,_0x270645){return new BPromise(function(_0x418790,_0x50a37b){try{if(_0x270645[_0x542445['id']]){_0x542445[_0xbc3f('0x2c')]=_[_0xbc3f('0x2d')](_0x270645[_0x542445['id']],function(_0x4d3e62){return{'id':_0x4d3e62['id'],'fullname':_0x4d3e62[_0xbc3f('0x2e')]};});}}catch(_0x17c269){_0x50a37b(_0x17c269);}_0x418790(_0x542445);});}function getInteractionTags(_0x9ef4c7,_0x4650e5){return new BPromise(function(_0x56353b,_0x592aee){try{if(_0x9ef4c7[_0xbc3f('0x2f')]){_0x9ef4c7[_0xbc3f('0x30')]=[];_0x9ef4c7[_0xbc3f('0x2f')][_0xbc3f('0x31')](',')[_0xbc3f('0x32')](function(_0x3e476f){_0x9ef4c7[_0xbc3f('0x30')][_0xbc3f('0x33')](_0x4650e5[_0x3e476f]);});}delete _0x9ef4c7['TagIds'];}catch(_0x2ac528){_0x592aee(_0x2ac528);}_0x56353b(_0x9ef4c7);});}function updateSmsInteraction(_0x53ee63,_0x8e2faa,_0x86a11f){return new BPromise(function(_0x1b8173,_0x3f58ec){return getInteractionUsers(_0x53ee63,_0x86a11f)[_0xbc3f('0x27')](function(_0x526642){return getInteractionTags(_0x526642,_0x8e2faa);})[_0xbc3f('0x27')](function(_0x44fcca){_0x1b8173(_0x44fcca);})[_0xbc3f('0x34')](function(_0x390eb8){_0x3f58ec(_0x390eb8);});});}exports['index']=function(_0x54db1a,_0xa668f0){var _0x6e997a={},_0x1350ca={},_0x282cf4={'count':0x0,'rows':[]};var _0x33b19c=_[_0xbc3f('0x2d')](db['SmsInteraction'][_0xbc3f('0x35')],function(_0x48e06a){return{'name':_0x48e06a[_0xbc3f('0x36')],'type':_0x48e06a['type'][_0xbc3f('0x37')]};});_0x1350ca[_0xbc3f('0x38')]=_[_0xbc3f('0x2d')](_0x33b19c,_0xbc3f('0x2a'));_0x1350ca[_0xbc3f('0x39')]=_[_0xbc3f('0x3a')](_0x54db1a['query']);_0x1350ca['filters']=_['intersection'](_0x1350ca[_0xbc3f('0x38')],_0x1350ca[_0xbc3f('0x39')]);_0x6e997a['attributes']=_[_0xbc3f('0x3b')](_0x1350ca[_0xbc3f('0x38')],qs[_0xbc3f('0x3c')](_0x54db1a['query'][_0xbc3f('0x3c')]));_0x6e997a[_0xbc3f('0x3d')]=_0x6e997a[_0xbc3f('0x3d')][_0xbc3f('0x3e')]?_0x6e997a[_0xbc3f('0x3d')]:_0x1350ca[_0xbc3f('0x38')];if(!_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x3f')](_0xbc3f('0x40'))){_0x6e997a[_0xbc3f('0x1d')]=qs[_0xbc3f('0x1d')](_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x1d')]);_0x6e997a[_0xbc3f('0x1c')]=qs['offset'](_0x54db1a['query']['offset']);}_0x6e997a[_0xbc3f('0x41')]=qs[_0xbc3f('0x42')](_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x42')]);_0x6e997a[_0xbc3f('0x43')]=qs['filters'](_[_0xbc3f('0x44')](_0x54db1a[_0xbc3f('0x39')],_0x1350ca[_0xbc3f('0x45')]),_0x33b19c);var _0x33ae76=[];var _0x153f55=squel[_0xbc3f('0x46')]()['field']('id')[_0xbc3f('0x47')](_0xbc3f('0x2a'))['field'](_0xbc3f('0x48'))[_0xbc3f('0x49')](_0xbc3f('0x4a'));var _0x4425a5=squel['select']()[_0xbc3f('0x47')](_0xbc3f('0x4b'))[_0xbc3f('0x47')](_0xbc3f('0x4c'))[_0xbc3f('0x47')]('ui.SmsInteractionId')[_0xbc3f('0x49')](_0xbc3f('0x4d'),'ui')[_0xbc3f('0x4e')](_0xbc3f('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x3fc9a8=squel[_0xbc3f('0x46')]()[_0xbc3f('0x49')](_0xbc3f('0x50'),'i')[_0xbc3f('0x4e')](_0xbc3f('0x51'),'c',_0xbc3f('0x52'))[_0xbc3f('0x4e')](_0xbc3f('0x4f'),'o',_0xbc3f('0x53'))[_0xbc3f('0x4e')](_0xbc3f('0x54'),'a',_0xbc3f('0x55'))[_0xbc3f('0x4e')]('sms_messages','me',_0xbc3f('0x56'))[_0xbc3f('0x4e')](_0xbc3f('0x57'),'it',_0xbc3f('0x58'))['left_join'](_0xbc3f('0x4a'),'t',_0xbc3f('0x59'));var _0x8ebf4a=squel[_0xbc3f('0x5a')]();var _0x7ad6af=[];var _0x1c279e=squel[_0xbc3f('0x5a')]();var _0x1042df;if(_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x5b')]){_0x1042df=as[_0xbc3f('0x5c')](_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x5b')]);var _0x1469be=_0x1042df['sqlOperator'];for(var _0x30940a=0x0;_0x30940a<_0x1042df[_0xbc3f('0x5d')]['length'];_0x30940a++){var _0x3146e1=_0x1042df[_0xbc3f('0x5d')][_0x30940a];var _0x598bfe='i';var _0x2c796a=_[_0xbc3f('0x5e')](_0x33b19c,[_0xbc3f('0x2a'),_0x3146e1[_0xbc3f('0x47')]]);if(!_0x2c796a){switch(_0x3146e1[_0xbc3f('0x47')]){case _0xbc3f('0x5f'):if(_0x3146e1[_0xbc3f('0x60')]==0x1){_0x3fc9a8['having']('`'+_0x3146e1[_0xbc3f('0x47')]+_0xbc3f('0x61'));}else{_0x3fc9a8[_0xbc3f('0x62')]('`'+_0x3146e1['field']+_0xbc3f('0x63'));}break;case _0xbc3f('0x64'):if(_0x3146e1[_0xbc3f('0x65')]===_0xbc3f('0x66')){if(_0x3146e1[_0xbc3f('0x60')][_0xbc3f('0x31')]('\x20')[_0xbc3f('0x3e')]>0x1){_0x8ebf4a[_0x1469be](_0xbc3f('0x67'),qs['getFullTextValue'](_0x3146e1[_0xbc3f('0x60')]),null);}else{var _0x1286a9='%'+_0x3146e1[_0xbc3f('0x60')]+'%';_0x8ebf4a[_0x1469be](_0xbc3f('0x68'),_0x1286a9,_0x1286a9,_0x1286a9);}}else{_0x2c796a=_['find'](_0x33b19c,['name',_0xbc3f('0x69')]);_0x3146e1[_0xbc3f('0x47')]='ContactId';_0x309f63=as[_0xbc3f('0x6a')](_0x598bfe,_0x2c796a[_0xbc3f('0x6b')],_0x3146e1);_0x8ebf4a[_0x1469be](_0x309f63[_0xbc3f('0x6c')],_0x309f63[_0xbc3f('0x60')]['start'],_0x309f63[_0xbc3f('0x60')][_0xbc3f('0x1b')]);}break;case _0xbc3f('0x6d'):var _0x55e206=_0x3146e1[_0xbc3f('0x60')][_0xbc3f('0x31')](',')[_0xbc3f('0x2d')](function(_0x4ff598){return Number(_0x4ff598);});_0x55e206[_0xbc3f('0x32')](function(_0x377e9b){_0x1c279e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x377e9b+',%');});_0x7ad6af=_['union'](_0x7ad6af,_0x55e206);break;case _0xbc3f('0x6e'):if(_0x3146e1[_0xbc3f('0x65')]===_0xbc3f('0x66')){_0x8ebf4a[_0x1469be](_0xbc3f('0x6f'),'%'+_0x3146e1['value']+'%',null);}else{_0x2c796a=_[_0xbc3f('0x5e')](_0x33b19c,['name','UserId']);_0x3146e1[_0xbc3f('0x47')]='UserId';_0x309f63=as[_0xbc3f('0x6a')](_0x598bfe,_0x2c796a['type'],_0x3146e1);_0x8ebf4a[_0x1469be](_0x309f63['text'],_0x309f63[_0xbc3f('0x60')]['start'],_0x309f63['value'][_0xbc3f('0x1b')]);}break;case'body':_0x309f63=as[_0xbc3f('0x6a')]('me',null,_0x3146e1);_0x8ebf4a[_0x1469be](_0x309f63['text'],_0x309f63[_0xbc3f('0x60')][_0xbc3f('0x70')],_0x309f63['value'][_0xbc3f('0x1b')]);break;}}else{var _0x309f63=as[_0xbc3f('0x6a')](_0x598bfe,_0x2c796a[_0xbc3f('0x6b')],_0x3146e1);_0x8ebf4a[_0x1469be](_0x309f63[_0xbc3f('0x6c')],_0x309f63['value']['start'],_0x309f63[_0xbc3f('0x60')][_0xbc3f('0x1b')]);}}}else{var _0x477c17=_(_0x54db1a[_0xbc3f('0x39')])[_0xbc3f('0x3a')]()['map'](function(_0x6b230f){return _[_0xbc3f('0x71')](_0x33b19c,[_0xbc3f('0x2a'),_0x6b230f])?_0x6b230f:undefined;})[_0xbc3f('0x72')]()[_0xbc3f('0x60')]();if(!_['isEmpty'](_0x477c17)){_0x477c17[_0xbc3f('0x32')](function(_0x538d09){if(_0x538d09==='SmsAccountId'){_0x3fc9a8[_0xbc3f('0x43')]('i.SmsAccountId\x20IN\x20?',[][_0xbc3f('0x73')](_0x54db1a['query'][_0x538d09]));}else if(_0x538d09===_0xbc3f('0x74')){var _0x101666=JSON[_0xbc3f('0x75')](_0x54db1a['query'][_0x538d09])['$gte'];var _0x2681c1=JSON[_0xbc3f('0x75')](_0x54db1a[_0xbc3f('0x39')][_0x538d09])[_0xbc3f('0x76')];_0x3fc9a8[_0xbc3f('0x43')](_0xbc3f('0x77'),_0x101666,_0x2681c1);}else{if(_0x54db1a[_0xbc3f('0x39')][_0x538d09]==='null'){_0x3fc9a8[_0xbc3f('0x43')]('i.'+_0x538d09+'\x20IS\x20NULL');}else{_0x3fc9a8[_0xbc3f('0x43')]('i.'+_0x538d09+_0xbc3f('0x78'),_0x54db1a['query'][_0x538d09]);}}});}if(_0x54db1a[_0xbc3f('0x39')]['read']){if(_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x79')]==0x1){_0x3fc9a8[_0xbc3f('0x62')](_0xbc3f('0x7a'));}else{_0x3fc9a8[_0xbc3f('0x62')](_0xbc3f('0x7b'));}}if(_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x7c')]){_0x7ad6af=_[_0xbc3f('0x7d')](_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x7c')])?_0x54db1a['query']['tag']:new Array(_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x7c')]);_0x7ad6af[_0xbc3f('0x32')](function(_0x34375a){_0x1c279e['or'](_0xbc3f('0x7e'),'%,'+_0x34375a+',%');});}if(_0x54db1a['query']['filter']){var _0x527669=_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x7f')][_0xbc3f('0x80')]('\x5c','\x5c\x5c')[_0xbc3f('0x80')](/'/g,'\x27\x27');if(qs[_0xbc3f('0x81')](_0x527669)){_0x8ebf4a['or']('i.id\x20LIKE\x20?',_0x527669+'%')['or'](_0xbc3f('0x82'),_0x527669+'%');}else{_0x8ebf4a['or'](_0xbc3f('0x83'),qs[_0xbc3f('0x84')](_0x527669))['or'](_0xbc3f('0x85'),_0x527669+'%');}}}_0x3fc9a8[_0xbc3f('0x43')](_0x8ebf4a);_0x3fc9a8[_0xbc3f('0x86')](_0xbc3f('0x87'));var _0x3d1e09={'type':db['Sequelize'][_0xbc3f('0x88')][_0xbc3f('0x89')],'raw':!![]};var _0x20ee56=_0x3fc9a8[_0xbc3f('0x8a')]();_0x20ee56['field'](_0xbc3f('0x87'));_0x20ee56[_0xbc3f('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbc3f('0x5f'));if(_0x6e997a[_0xbc3f('0x41')]){_0x6e997a[_0xbc3f('0x41')][_0xbc3f('0x32')](function(_0x3f822d){var _0x2c02a3=_0x3f822d[0x0]==='contactName'?_0x3f822d[0x0]:'i.'+_0x3f822d[0x0];_0x3fc9a8[_0xbc3f('0x41')](_0x2c02a3,_0x3f822d[0x1]===_0xbc3f('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x7ad6af)){_0x3fc9a8[_0xbc3f('0x62')](_0x1c279e);_0x20ee56[_0xbc3f('0x43')](_0xbc3f('0x8c'),_0x7ad6af);}BPromise[_0xbc3f('0x8d')]()['then'](function(){if(!_0x1042df){if(_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x8e')])return;_0x20ee56[_0xbc3f('0x43')](_0xbc3f('0x8f'));_0x3fc9a8[_0xbc3f('0x43')](_0xbc3f('0x8f'));return;}if(_0x54db1a['user']['role']!==_0xbc3f('0x90'))return;return _0x54db1a[_0xbc3f('0x91')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0xf29987){if(_[_0xbc3f('0x92')](_0xf29987)){_0x20ee56[_0xbc3f('0x43')]('i.SmsAccountId\x20IS\x20NULL');_0x3fc9a8['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x20ee56[_0xbc3f('0x43')](_0xbc3f('0x93'),_[_0xbc3f('0x2d')](_0xf29987,'id'));_0x3fc9a8['where']('i.SmsAccountId\x20IN\x20?',_[_0xbc3f('0x2d')](_0xf29987,'id'));}});})['then'](function(){if(_0x54db1a['user'][_0xbc3f('0x94')]===_0xbc3f('0x90')&&!_0x1042df&&!_0x54db1a[_0xbc3f('0x39')]['SmsAccountId'])return[];return db['sequelize']['query'](_0x20ee56[_0xbc3f('0x95')](),_0x3d1e09);})[_0xbc3f('0x27')](function(_0xfd1005){_0x282cf4['count']=_0xfd1005[_0xbc3f('0x3e')];if(_0x282cf4['count']===0x0)return[];return db[_0xbc3f('0x96')][_0xbc3f('0x39')](_0x153f55[_0xbc3f('0x95')](),_0x3d1e09)[_0xbc3f('0x27')](function(_0x59d909){_0x33ae76=_[_0xbc3f('0x97')](_0x59d909,'id');_0x3d1e09=_[_0xbc3f('0x98')](_0x3d1e09,{'model':db[_0xbc3f('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54db1a[_0xbc3f('0x39')][_0xbc3f('0x3c')]){_0x6e997a[_0xbc3f('0x3d')][_0xbc3f('0x32')](function(_0x2173c){_0x3fc9a8[_0xbc3f('0x47')]('i.'+_0x2173c);});}else{_0x3fc9a8['field'](_0xbc3f('0x9a'),'unreadMessages');_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0x9b'),_0xbc3f('0x9c'));_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0x9d'),_0xbc3f('0x9e'));_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0x9f'),_0xbc3f('0xa0'));_0x3fc9a8['field'](_0xbc3f('0xa1'));_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0xa2'),_0xbc3f('0xa3'));_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0xa4'),'Contact.lastName');_0x3fc9a8['field'](_0xbc3f('0xa5'),_0xbc3f('0xa6'));_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0xa7'),_0xbc3f('0xa8'));_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0xa9'),_0xbc3f('0xaa'));_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0xab'),_0xbc3f('0xac'));_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0xad'),'Owner.fullname');_0x3fc9a8[_0xbc3f('0x47')]('o.internal','Owner.internal');_0x3fc9a8[_0xbc3f('0x47')](_0xbc3f('0xae'),_0xbc3f('0x2f'));}if(_0x6e997a[_0xbc3f('0x1d')])_0x3fc9a8[_0xbc3f('0x1d')](_0x6e997a[_0xbc3f('0x1d')]);if(_0x6e997a[_0xbc3f('0x1c')])_0x3fc9a8[_0xbc3f('0x1c')](_0x6e997a[_0xbc3f('0x1c')]);return db[_0xbc3f('0x96')][_0xbc3f('0x39')](_0x3fc9a8[_0xbc3f('0x95')](),_0x3d1e09);})[_0xbc3f('0x27')](function(_0x5bbab1){if(_0x5bbab1[_0xbc3f('0x3e')]>0x0)_0x4425a5[_0xbc3f('0x43')]('ui.SmsInteractionId\x20IN\x20?',_[_0xbc3f('0x2d')](_0x5bbab1,'id'));return db[_0xbc3f('0x96')][_0xbc3f('0x39')](_0x4425a5['toString'](),_0x3d1e09)['then'](function(_0x36c584){var _0x3a844=_[_0xbc3f('0xaf')](_0x36c584,_0xbc3f('0xb0'));var _0x56dfd8=[];_0x5bbab1[_0xbc3f('0x32')](function(_0x4758c3){_0x56dfd8[_0xbc3f('0x33')](updateSmsInteraction(_0x4758c3,_0x33ae76,_0x3a844));});return BPromise['all'](_0x56dfd8);});});})['then'](function(_0x1f3e70){_0x282cf4[_0xbc3f('0xb1')]=_0x1f3e70;return _0x282cf4;})['then'](respondWithFilteredResult(_0xa668f0,_0x6e997a))[_0xbc3f('0x34')](handleError(_0xa668f0,null));};exports[_0xbc3f('0xb2')]=function(_0x13005f,_0x581f17){var _0x325540={'raw':![],'where':{'id':_0x13005f[_0xbc3f('0xb3')]['id']}},_0x539989={};_0x539989[_0xbc3f('0x38')]=_['keys'](db['SmsInteraction'][_0xbc3f('0x35')]);_0x539989['query']=_[_0xbc3f('0x3a')](_0x13005f[_0xbc3f('0x39')]);_0x539989[_0xbc3f('0x45')]=_[_0xbc3f('0x3b')](_0x539989['model'],_0x539989[_0xbc3f('0x39')]);_0x325540['attributes']=_[_0xbc3f('0x3b')](_0x539989[_0xbc3f('0x38')],qs[_0xbc3f('0x3c')](_0x13005f[_0xbc3f('0x39')]['fields']));_0x325540[_0xbc3f('0x3d')]=_0x325540[_0xbc3f('0x3d')]['length']?_0x325540[_0xbc3f('0x3d')]:_0x539989[_0xbc3f('0x38')];if(_0x13005f['query'][_0xbc3f('0xb4')]){_0x325540[_0xbc3f('0xb5')]=[{'all':!![]}];}_0x325540=_['merge']({},_0x325540,_0x13005f[_0xbc3f('0xb6')]);return db['SmsInteraction']['find'](_0x325540)[_0xbc3f('0x27')](handleEntityNotFound(_0x581f17,null))[_0xbc3f('0x27')](respondWithResult(_0x581f17,null))[_0xbc3f('0x34')](handleError(_0x581f17,null));};exports[_0xbc3f('0xb7')]=function(_0x2c0389,_0x3739da){return db['SmsInteraction'][_0xbc3f('0xb7')](_0x2c0389[_0xbc3f('0xb8')],{})[_0xbc3f('0x27')](respondWithResult(_0x3739da,0xc9))[_0xbc3f('0x34')](handleError(_0x3739da,null));};exports[_0xbc3f('0x26')]=function(_0x1e7c46,_0x2e0017){if(_0x1e7c46[_0xbc3f('0xb8')]['id']){delete _0x1e7c46[_0xbc3f('0xb8')]['id'];}return db[_0xbc3f('0x99')][_0xbc3f('0x5e')]({'where':{'id':_0x1e7c46[_0xbc3f('0xb3')]['id']}})[_0xbc3f('0x27')](handleEntityNotFound(_0x2e0017,null))[_0xbc3f('0x27')](saveUpdates(_0x1e7c46[_0xbc3f('0xb8')],null))[_0xbc3f('0x27')](respondWithResult(_0x2e0017,null))['catch'](handleError(_0x2e0017,null));};exports[_0xbc3f('0xb9')]=function(_0x241f94,_0x5b26c0){return db['SmsInteraction']['find']({'where':{'id':_0x241f94['params']['id']}})[_0xbc3f('0x27')](handleEntityNotFound(_0x5b26c0,null))[_0xbc3f('0x27')](removeEntity(_0x5b26c0,null))[_0xbc3f('0x34')](handleError(_0x5b26c0,null));};exports[_0xbc3f('0xba')]=function(_0x548ab4,_0x19a694){return db[_0xbc3f('0x99')][_0xbc3f('0xba')]()[_0xbc3f('0x27')](respondWithResult(_0x19a694,null))[_0xbc3f('0x34')](handleError(_0x19a694,null));};exports['addMessage']=function(_0x3a7e74,_0x25f283,_0x39de64){return db['SmsMessage']['find']({'where':{'id':_0x3a7e74[_0xbc3f('0xb3')]['id']}})['then'](handleEntityNotFound(_0x25f283,null))[_0xbc3f('0x27')](function(_0x223f89){if(_0x223f89){return _0x223f89['addMessage'](_0x3a7e74[_0xbc3f('0xb8')][_0xbc3f('0xbb')],_[_0xbc3f('0xbc')](_0x3a7e74[_0xbc3f('0xb8')],[_0xbc3f('0xbb'),'id'])||{});}})[_0xbc3f('0x27')](respondWithResult(_0x25f283,null))[_0xbc3f('0x34')](handleError(_0x25f283,null));};exports[_0xbc3f('0xbd')]=function(_0x9c6ba5,_0x128492,_0x5c346e){var _0x46062d={'raw':![],'where':{}};var _0x4fc2b2={};var _0x36a560={'count':0x0,'rows':[]};return db[_0xbc3f('0x99')][_0xbc3f('0xbe')]({'where':{'id':_0x9c6ba5[_0xbc3f('0xb3')]['id']}})[_0xbc3f('0x27')](handleEntityNotFound(_0x128492,null))[_0xbc3f('0x27')](function(_0x5162ee){if(_0x5162ee){_0x4fc2b2['model']=_['keys'](db[_0xbc3f('0xbf')][_0xbc3f('0x35')]);_0x4fc2b2['query']=_[_0xbc3f('0x3a')](_0x9c6ba5[_0xbc3f('0x39')]);_0x4fc2b2[_0xbc3f('0x45')]=_[_0xbc3f('0x3b')](_0x4fc2b2[_0xbc3f('0x38')],_0x4fc2b2[_0xbc3f('0x39')]);_0x46062d['attributes']=_[_0xbc3f('0x3b')](_0x4fc2b2[_0xbc3f('0x38')],qs['fields'](_0x9c6ba5[_0xbc3f('0x39')]['fields']));_0x46062d[_0xbc3f('0x3d')]=_0x46062d[_0xbc3f('0x3d')]['length']?_0x46062d[_0xbc3f('0x3d')]:_0x4fc2b2[_0xbc3f('0x38')];if(!_0x9c6ba5['query'][_0xbc3f('0x3f')](_0xbc3f('0x40'))){_0x46062d[_0xbc3f('0x1d')]=qs[_0xbc3f('0x1d')](_0x9c6ba5[_0xbc3f('0x39')]['limit']);_0x46062d[_0xbc3f('0x1c')]=qs[_0xbc3f('0x1c')](_0x9c6ba5['query']['offset']);}_0x46062d[_0xbc3f('0x41')]=qs[_0xbc3f('0x42')](_0x9c6ba5['query'][_0xbc3f('0x42')]);_0x46062d[_0xbc3f('0x43')]=qs['filters'](_['pick'](_0x9c6ba5[_0xbc3f('0x39')],_0x4fc2b2[_0xbc3f('0x45')]));_0x46062d['where'][_0xbc3f('0xb0')]=_0x5162ee['id'];if(_0x9c6ba5[_0xbc3f('0x39')][_0xbc3f('0x7f')]){_0x46062d[_0xbc3f('0x43')]=_[_0xbc3f('0x98')](_0x46062d['where'],{'$or':_[_0xbc3f('0x2d')](_0x46062d[_0xbc3f('0x3d')],function(_0xc3ccc9){var _0x32b7fe={};_0x32b7fe[_0xc3ccc9]={'$like':'%'+_0x9c6ba5[_0xbc3f('0x39')][_0xbc3f('0x7f')]+'%'};return _0x32b7fe;})});}if(_0x9c6ba5[_0xbc3f('0x39')][_0xbc3f('0xc0')]){var _0x2ff302=_0x9c6ba5[_0xbc3f('0x39')]['$gte'][_0xbc3f('0x31')](',');var _0x238880={};_0x238880[_0x2ff302[0x0]]={'$gte':moment(_0x2ff302[0x1])[_0xbc3f('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x46062d[_0xbc3f('0x43')]=_[_0xbc3f('0x98')](_0x46062d[_0xbc3f('0x43')],_0x238880);}_0x46062d=_[_0xbc3f('0x98')]({},_0x46062d,_0x9c6ba5[_0xbc3f('0xb6')]);return db[_0xbc3f('0xbf')][_0xbc3f('0x1f')]({'where':_0x46062d[_0xbc3f('0x43')]})['then'](function(_0x3bd90a){_0x36a560[_0xbc3f('0x1f')]=_0x3bd90a;if(_0x9c6ba5[_0xbc3f('0x39')][_0xbc3f('0xb4')]){_0x46062d['include']=[{'all':!![]}];}return db[_0xbc3f('0xbf')]['findAll'](_0x46062d);})[_0xbc3f('0x27')](function(_0x591a9d){_0x36a560['rows']=_0x591a9d;return _0x36a560;});}})['then'](respondWithFilteredResult(_0x128492,_0x46062d))['catch'](handleError(_0x128492,null));};exports[_0xbc3f('0xc2')]=function(_0x52def1,_0x1fb0f9,_0x375b1c){return db[_0xbc3f('0x99')][_0xbc3f('0x5e')]({'where':{'id':_0x52def1[_0xbc3f('0xb3')]['id']}})[_0xbc3f('0x27')](handleEntityNotFound(_0x1fb0f9,null))['then'](function(_0x37314c){if(_0x37314c){return _0x37314c[_0xbc3f('0xc3')](_0x52def1[_0xbc3f('0xb8')]['ids'],_['omit'](_0x52def1['body'],['ids','id'])||{})[_0xbc3f('0xc4')](function(){return db[_0xbc3f('0x6d')]['findAll']({'attributes':['id',_0xbc3f('0x2a'),_0xbc3f('0x48')],'where':{'id':_0x52def1[_0xbc3f('0xb8')][_0xbc3f('0xbb')]}});})['then'](function(_0x3f4bac){socket[_0xbc3f('0xc5')](_0xbc3f('0xc6'),{'id':Number(_0x52def1[_0xbc3f('0xb3')]['id']),'tags':_0x3f4bac||[]});return{'id':Number(_0x52def1['params']['id']),'tags':_0x3f4bac||[]};});}})[_0xbc3f('0x27')](respondWithResult(_0x1fb0f9,null))[_0xbc3f('0x34')](handleError(_0x1fb0f9,null));};exports['removeTags']=function(_0x870679,_0x452742,_0x4ef36d){return db['SmsInteraction'][_0xbc3f('0x5e')]({'where':{'id':_0x870679[_0xbc3f('0xb3')]['id']}})['then'](handleEntityNotFound(_0x452742,null))[_0xbc3f('0x27')](function(_0x5ed13a){if(_0x5ed13a){return _0x5ed13a[_0xbc3f('0xc7')](_0x870679[_0xbc3f('0x39')][_0xbc3f('0xbb')]);}})[_0xbc3f('0x27')](respondWithStatusCode(_0x452742,null))['catch'](handleError(_0x452742,null));};exports[_0xbc3f('0xc8')]=function(_0x4160be,_0x220895){var _0x4a8840=moment()['unix']()[_0xbc3f('0x95')]();var _0x3fc1b8=path[_0xbc3f('0xc9')](config[_0xbc3f('0xca')],_0xbc3f('0xcb'),_0xbc3f('0xcc'),_0xbc3f('0xcd'));var _0xd80cde=path[_0xbc3f('0xc9')](config[_0xbc3f('0xca')],_0xbc3f('0xcb'),_0xbc3f('0xcc'),_0xbc3f('0xce'));var _0x3e5708=path[_0xbc3f('0xc9')](_0x3fc1b8,_0x4a8840);var _0x66378a=util[_0xbc3f('0xc1')]('transcript-%d-%s.zip',_0x4160be[_0xbc3f('0xb3')]['id'],_0x4a8840);var _0x367d51=path[_0xbc3f('0xc9')](_0x3fc1b8,_0x66378a);var _0x262452=[];_0x262452['push']({'model':db[_0xbc3f('0x6e')],'as':_0xbc3f('0x6e'),'attributes':['id',_0xbc3f('0x2e')],'raw':!![]});_0x262452[_0xbc3f('0x33')]({'model':db[_0xbc3f('0xcf')],'as':_0xbc3f('0x64'),'attributes':['id',_0xbc3f('0xd0'),_0xbc3f('0xd1')],'raw':!![]});var _0x1a7e74=[{'model':db[_0xbc3f('0xbf')],'as':_0xbc3f('0xd2'),'attributes':['id',_0xbc3f('0xb8'),_0xbc3f('0x74'),'direction',_0xbc3f('0xd3'),'read'],'include':_0x262452}];_0x1a7e74['push']({'model':db['SmsAccount'],'as':_0xbc3f('0xd4'),'attributes':['id',_0xbc3f('0x2a')]});_0x1a7e74[_0xbc3f('0x33')]({'model':db[_0xbc3f('0x6e')],'as':_0xbc3f('0xd5'),'attributes':['id','fullname']});return db[_0xbc3f('0x99')][_0xbc3f('0x5e')]({'where':{'id':_0x4160be[_0xbc3f('0xb3')]['id']},'include':_0x1a7e74})[_0xbc3f('0x27')](handleEntityNotFound(_0x220895,null))[_0xbc3f('0x27')](function(_0x5f0a59){if(_0x5f0a59){var _0x56d11b=_0x5f0a59['get']({'plain':!![]});fs[_0xbc3f('0xd6')](_0x3e5708);var _0xdc732d={'channel':_0xbc3f('0xd7'),'account':_0x56d11b[_0xbc3f('0xd4')]['name'],'agent':_0x56d11b[_0xbc3f('0xd5')]?_0x56d11b['Owner'][_0xbc3f('0x2e')]:_0xbc3f('0xd8'),'createdAt':moment(_0x56d11b['createdAt'])[_0xbc3f('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbc3f('0x95')](),'closedAt':_0x56d11b[_0xbc3f('0xd9')]?moment(_0x56d11b[_0xbc3f('0xda')])[_0xbc3f('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbc3f('0x95')]():'','disposition':_0x56d11b[_0xbc3f('0xdb')],'messages':_(_0x56d11b['Messages'])[_0xbc3f('0x7f')]({'secret':![]})[_0xbc3f('0x2d')](function(_0x5a79c2){return{'date':moment(_0x5a79c2[_0xbc3f('0x74')])['format'](_0xbc3f('0xdc'))[_0xbc3f('0x95')](),'sender':_0x5a79c2[_0xbc3f('0xdd')]===_0xbc3f('0xde')?_0x5a79c2[_0xbc3f('0x6e')]?_0x5a79c2['User'][_0xbc3f('0x2e')]:_0xbc3f('0xdf'):_0x5a79c2['Contact'][_0xbc3f('0xd0')]+(_0x5a79c2[_0xbc3f('0x64')][_0xbc3f('0xd1')]?'\x20'+_0x5a79c2[_0xbc3f('0x64')][_0xbc3f('0xd1')]:''),'body':_0x5a79c2[_0xbc3f('0xb8')],'direction':_0x5a79c2[_0xbc3f('0xdd')]===_0xbc3f('0xde')?'A':'C','secret':_0x5a79c2[_0xbc3f('0xd3')],'read':_0x5a79c2['read']};})[_0xbc3f('0x60')]()};return ejs[_0xbc3f('0xe0')](path['join'](config['root'],'server',_0xbc3f('0xe1'),'downloadInteraction.ejs'),{'interaction':_0xdc732d})[_0xbc3f('0x27')](function(_0x3f2778){var _0x4f14d5=path['join'](_0x3e5708,'transcript-'+_0x56d11b['id']+'-'+_0x4a8840+_0xbc3f('0xe2'));var _0x541523={'path':_0x4f14d5,'channel':_0xbc3f('0xd7'),'interactionId':_0x56d11b['id']};return pdf[_0xbc3f('0xe3')](_0x3f2778,_0x541523);})[_0xbc3f('0x27')](function(){return new BPromise(function(_0x4bd041,_0x5edbc5){zipdir(_0x3e5708,{'saveTo':_0x367d51},function(_0x2776f9,_0xffce16){if(_0x2776f9)return _0x5edbc5(_0x2776f9);return _0x4bd041(_0xffce16);});})[_0xbc3f('0x27')](function(){return new BPromise(function(_0x24ac90,_0x2190eb){rimraf(_0x3e5708,function(_0x490a37){if(_0x490a37)_0x2190eb(_0x490a37);return _0x24ac90();});});})['then'](function(){return _0x220895[_0xbc3f('0xc8')](_0x367d51,_0x66378a,function(_0x21eb5c){if(_0x21eb5c){console['log'](_0xbc3f('0xe4'),_0x21eb5c);}else{fs['unlinkSync'](_0x367d51);}});});});}else{return _0x220895[_0xbc3f('0xe5')](0xc8);}})[_0xbc3f('0x34')](handleError(_0x220895,null));}; \ No newline at end of file +var _0x9820=['error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','length','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','replace','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','unreadMessages','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','c.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','rawAttributes','includeAll','include','options','create','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','format','transcript-%d-%s.zip','CmContact','lastName','Messages','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closedAt','disposition','direction','out','System','firstName','renderFile','views','downloadInteraction.ejs','.pdf','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0x478efe,_0xcb6ce5){var _0x49924d=function(_0x3e4c88){while(--_0x3e4c88){_0x478efe['push'](_0x478efe['shift']());}};_0x49924d(++_0xcb6ce5);}(_0x9820,0xb6));var _0x0982=function(_0x53c815,_0x4659bb){_0x53c815=_0x53c815-0x0;var _0x57f866=_0x9820[_0x53c815];return _0x57f866;};'use strict';var emlformat=require(_0x0982('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0982('0x1'));var jsonpatch=require(_0x0982('0x2'));var rp=require(_0x0982('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0982('0x4'));var util=require(_0x0982('0x5'));var path=require(_0x0982('0x6'));var sox=require(_0x0982('0x7'));var csv=require(_0x0982('0x8'));var ejs=require(_0x0982('0x9'));var fs=require('fs');var fs_extra=require(_0x0982('0xa'));var _=require(_0x0982('0xb'));var squel=require(_0x0982('0xc'));var crypto=require(_0x0982('0xd'));var jsforce=require(_0x0982('0xe'));var deskjs=require(_0x0982('0xf'));var toCsv=require(_0x0982('0x8'));var querystring=require('querystring');var Papa=require(_0x0982('0x10'));var Redis=require(_0x0982('0x11'));var authService=require(_0x0982('0x12'));var qs=require(_0x0982('0x13'));var as=require(_0x0982('0x14'));var pdf=require(_0x0982('0x15'));var hardwareService=require(_0x0982('0x16'));var logger=require('../../config/logger')(_0x0982('0x17'));var utils=require('../../config/utils');var config=require(_0x0982('0x18'));var licenseUtil=require(_0x0982('0x19'));var db=require('../../mysqldb')['db'];config[_0x0982('0x1a')]=_[_0x0982('0x1b')](config[_0x0982('0x1a')],{'host':_0x0982('0x1c'),'port':0x18eb});var socket=require(_0x0982('0x1d'))(new Redis(config[_0x0982('0x1a')]));require(_0x0982('0x1e'))[_0x0982('0x1f')](socket);function respondWithStatusCode(_0x5fd9ee,_0x7ea69e){_0x7ea69e=_0x7ea69e||0xcc;return function(_0x5c0dba){if(_0x5c0dba){return _0x5fd9ee[_0x0982('0x20')](_0x7ea69e);}return _0x5fd9ee[_0x0982('0x21')](_0x7ea69e)['end']();};}function respondWithResult(_0x59aa56,_0x30c3dd){_0x30c3dd=_0x30c3dd||0xc8;return function(_0x2bbdfd){if(_0x2bbdfd){return _0x59aa56['status'](_0x30c3dd)[_0x0982('0x22')](_0x2bbdfd);}};}function respondWithFilteredResult(_0x25bdef,_0x51b4a4){return function(_0x3c5ce9){if(_0x3c5ce9){var _0x314a4c=typeof _0x51b4a4[_0x0982('0x23')]===_0x0982('0x24')&&typeof _0x51b4a4[_0x0982('0x25')]==='undefined';var _0x33e3df=_0x3c5ce9['count'];var _0x15b5bc=_0x314a4c?0x0:_0x51b4a4[_0x0982('0x23')];var _0x234795=_0x314a4c?_0x3c5ce9[_0x0982('0x26')]:_0x51b4a4[_0x0982('0x23')]+_0x51b4a4[_0x0982('0x25')];var _0xceb7c4;if(_0x234795>=_0x33e3df){_0x234795=_0x33e3df;_0xceb7c4=0xc8;}else{_0xceb7c4=0xce;}_0x25bdef[_0x0982('0x21')](_0xceb7c4);return _0x25bdef[_0x0982('0x27')](_0x0982('0x28'),_0x15b5bc+'-'+_0x234795+'/'+_0x33e3df)['json'](_0x3c5ce9);}return null;};}function patchUpdates(_0x11ec80){return function(_0x9a2c78){try{jsonpatch[_0x0982('0x29')](_0x9a2c78,_0x11ec80,!![]);}catch(_0x216259){return BPromise[_0x0982('0x2a')](_0x216259);}return _0x9a2c78[_0x0982('0x2b')]();};}function saveUpdates(_0x5624e4,_0xa0a428){return function(_0x25cfc3){if(_0x25cfc3){return _0x25cfc3[_0x0982('0x2c')](_0x5624e4)[_0x0982('0x2d')](function(_0x301ac2){return _0x301ac2;});}return null;};}function removeEntity(_0x52570c,_0xeea8b0){return function(_0x5f5462){if(_0x5f5462){return _0x5f5462[_0x0982('0x2e')]()['then'](function(){_0x52570c['status'](0xcc)[_0x0982('0x2f')]();});}};}function handleEntityNotFound(_0x24948c,_0x50d200){return function(_0x5beef3){if(!_0x5beef3){_0x24948c[_0x0982('0x20')](0x194);}return _0x5beef3;};}function handleError(_0x16a223,_0x1a5b28){_0x1a5b28=_0x1a5b28||0x1f4;return function(_0x1cabae){logger[_0x0982('0x30')](_0x1cabae[_0x0982('0x31')]);if(_0x1cabae[_0x0982('0x32')]){delete _0x1cabae[_0x0982('0x32')];}_0x16a223[_0x0982('0x21')](_0x1a5b28)[_0x0982('0x33')](_0x1cabae);};}function getInteractionUsers(_0x53bd7b,_0x1955f3){return new BPromise(function(_0x10fb31,_0x4122e1){try{if(_0x1955f3[_0x53bd7b['id']]){_0x53bd7b['Users']=_[_0x0982('0x34')](_0x1955f3[_0x53bd7b['id']],function(_0x3eb717){return{'id':_0x3eb717['id'],'fullname':_0x3eb717[_0x0982('0x35')]};});}}catch(_0x28a42b){_0x4122e1(_0x28a42b);}_0x10fb31(_0x53bd7b);});}function getInteractionTags(_0x3fb9b9,_0x264d54){return new BPromise(function(_0x165f7d,_0xd11074){try{if(_0x3fb9b9[_0x0982('0x36')]){_0x3fb9b9[_0x0982('0x37')]=[];_0x3fb9b9[_0x0982('0x36')][_0x0982('0x38')](',')[_0x0982('0x39')](function(_0x15c296){_0x3fb9b9[_0x0982('0x37')][_0x0982('0x3a')](_0x264d54[_0x15c296]);});}delete _0x3fb9b9[_0x0982('0x36')];}catch(_0x58eca8){_0xd11074(_0x58eca8);}_0x165f7d(_0x3fb9b9);});}function updateSmsInteraction(_0x3a3cdf,_0x420cbd,_0x2cc581){return new BPromise(function(_0x2c6697,_0x5d14d3){return getInteractionUsers(_0x3a3cdf,_0x2cc581)[_0x0982('0x2d')](function(_0xb679b7){return getInteractionTags(_0xb679b7,_0x420cbd);})[_0x0982('0x2d')](function(_0x905bbc){_0x2c6697(_0x905bbc);})[_0x0982('0x3b')](function(_0xcf1be0){_0x5d14d3(_0xcf1be0);});});}exports[_0x0982('0x3c')]=function(_0x141479,_0x1b760d){var _0x6431ea={},_0x47fa17={},_0x11816c={'count':0x0,'rows':[]};var _0x50cc57=_[_0x0982('0x34')](db[_0x0982('0x3d')]['rawAttributes'],function(_0x5f4602){return{'name':_0x5f4602[_0x0982('0x3e')],'type':_0x5f4602[_0x0982('0x3f')][_0x0982('0x40')]};});_0x47fa17[_0x0982('0x41')]=_[_0x0982('0x34')](_0x50cc57,_0x0982('0x32'));_0x47fa17[_0x0982('0x42')]=_[_0x0982('0x43')](_0x141479['query']);_0x47fa17[_0x0982('0x44')]=_[_0x0982('0x45')](_0x47fa17[_0x0982('0x41')],_0x47fa17[_0x0982('0x42')]);_0x6431ea[_0x0982('0x46')]=_[_0x0982('0x45')](_0x47fa17['model'],qs['fields'](_0x141479[_0x0982('0x42')][_0x0982('0x47')]));_0x6431ea['attributes']=_0x6431ea[_0x0982('0x46')]['length']?_0x6431ea[_0x0982('0x46')]:_0x47fa17[_0x0982('0x41')];if(!_0x141479['query'][_0x0982('0x48')](_0x0982('0x49'))){_0x6431ea[_0x0982('0x25')]=qs['limit'](_0x141479[_0x0982('0x42')][_0x0982('0x25')]);_0x6431ea[_0x0982('0x23')]=qs['offset'](_0x141479[_0x0982('0x42')][_0x0982('0x23')]);}_0x6431ea['order']=qs['sort'](_0x141479['query'][_0x0982('0x4a')]);_0x6431ea[_0x0982('0x4b')]=qs[_0x0982('0x44')](_[_0x0982('0x4c')](_0x141479[_0x0982('0x42')],_0x47fa17[_0x0982('0x44')]),_0x50cc57);var _0x2e36a7=[];var _0x28308c=squel[_0x0982('0x4d')]()[_0x0982('0x4e')]('id')['field'](_0x0982('0x32'))[_0x0982('0x4e')](_0x0982('0x4f'))[_0x0982('0x50')]('tools_tags');var _0x1af683=squel['select']()[_0x0982('0x4e')]('u.id')['field']('u.fullname')[_0x0982('0x4e')](_0x0982('0x51'))[_0x0982('0x50')](_0x0982('0x52'),'ui')[_0x0982('0x53')](_0x0982('0x54'),'u',_0x0982('0x55'));var _0x33a96a=squel[_0x0982('0x4d')]()[_0x0982('0x50')](_0x0982('0x56'),'i')[_0x0982('0x53')](_0x0982('0x57'),'c',_0x0982('0x58'))[_0x0982('0x53')]('users','o',_0x0982('0x59'))[_0x0982('0x53')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0x0982('0x53')](_0x0982('0x5a'),'me',_0x0982('0x5b'))[_0x0982('0x53')](_0x0982('0x5c'),'it',_0x0982('0x5d'))[_0x0982('0x53')]('tools_tags','t',_0x0982('0x5e'));var _0xeff30d=squel['expr']();var _0x604a08=[];var _0x2f2e70=squel[_0x0982('0x5f')]();var _0x2db8d2;if(_0x141479[_0x0982('0x42')]['search']){_0x2db8d2=as['parseSearch'](_0x141479[_0x0982('0x42')]['search']);var _0x1825ed=_0x2db8d2[_0x0982('0x60')];for(var _0xcc4c02=0x0;_0xcc4c02<_0x2db8d2[_0x0982('0x61')][_0x0982('0x62')];_0xcc4c02++){var _0x3543e2=_0x2db8d2[_0x0982('0x61')][_0xcc4c02];var _0xa4adaa='i';var _0x6a99fd=_[_0x0982('0x63')](_0x50cc57,[_0x0982('0x32'),_0x3543e2['field']]);if(!_0x6a99fd){switch(_0x3543e2[_0x0982('0x4e')]){case'unreadMessages':if(_0x3543e2[_0x0982('0x64')]==0x1){_0x33a96a[_0x0982('0x65')]('`'+_0x3543e2['field']+_0x0982('0x66'));}else{_0x33a96a[_0x0982('0x65')]('`'+_0x3543e2[_0x0982('0x4e')]+_0x0982('0x67'));}break;case _0x0982('0x68'):if(_0x3543e2['operator']===_0x0982('0x69')){if(_0x3543e2[_0x0982('0x64')]['split']('\x20')[_0x0982('0x62')]>0x1){_0xeff30d[_0x1825ed](_0x0982('0x6a'),qs[_0x0982('0x6b')](_0x3543e2[_0x0982('0x64')]),null);}else{var _0x2a4f85='%'+_0x3543e2['value']+'%';_0xeff30d[_0x1825ed](_0x0982('0x6c'),_0x2a4f85,_0x2a4f85,_0x2a4f85);}}else{_0x6a99fd=_[_0x0982('0x63')](_0x50cc57,[_0x0982('0x32'),_0x0982('0x6d')]);_0x3543e2[_0x0982('0x4e')]=_0x0982('0x6d');_0x2719d5=as[_0x0982('0x6e')](_0xa4adaa,_0x6a99fd[_0x0982('0x3f')],_0x3543e2);_0xeff30d[_0x1825ed](_0x2719d5[_0x0982('0x6f')],_0x2719d5[_0x0982('0x64')][_0x0982('0x70')],_0x2719d5[_0x0982('0x64')][_0x0982('0x2f')]);}break;case _0x0982('0x71'):var _0x36ac75=_0x3543e2[_0x0982('0x64')][_0x0982('0x38')](',')['map'](function(_0x3d38bc){return Number(_0x3d38bc);});_0x36ac75[_0x0982('0x39')](function(_0x222e16){_0x2f2e70['or'](_0x0982('0x72'),'%,'+_0x222e16+',%');});_0x604a08=_[_0x0982('0x73')](_0x604a08,_0x36ac75);break;case _0x0982('0x74'):if(_0x3543e2[_0x0982('0x75')]==='$substring'){_0xeff30d[_0x1825ed](_0x0982('0x76'),'%'+_0x3543e2[_0x0982('0x64')]+'%',null);}else{_0x6a99fd=_[_0x0982('0x63')](_0x50cc57,[_0x0982('0x32'),_0x0982('0x77')]);_0x3543e2[_0x0982('0x4e')]='UserId';_0x2719d5=as[_0x0982('0x6e')](_0xa4adaa,_0x6a99fd[_0x0982('0x3f')],_0x3543e2);_0xeff30d[_0x1825ed](_0x2719d5['text'],_0x2719d5[_0x0982('0x64')][_0x0982('0x70')],_0x2719d5['value'][_0x0982('0x2f')]);}break;case _0x0982('0x78'):_0x2719d5=as[_0x0982('0x6e')]('me',null,_0x3543e2);_0xeff30d[_0x1825ed](_0x2719d5[_0x0982('0x6f')],_0x2719d5[_0x0982('0x64')][_0x0982('0x70')],_0x2719d5['value']['end']);break;}}else{var _0x2719d5=as['buildExpression'](_0xa4adaa,_0x6a99fd[_0x0982('0x3f')],_0x3543e2);_0xeff30d[_0x1825ed](_0x2719d5['text'],_0x2719d5[_0x0982('0x64')][_0x0982('0x70')],_0x2719d5[_0x0982('0x64')][_0x0982('0x2f')]);}}}else{var _0x12c6f8=_(_0x141479['query'])['keys']()[_0x0982('0x34')](function(_0x22eb06){return _[_0x0982('0x79')](_0x50cc57,['name',_0x22eb06])?_0x22eb06:undefined;})['compact']()['value']();if(!_[_0x0982('0x7a')](_0x12c6f8)){_0x12c6f8[_0x0982('0x39')](function(_0x32bfa4){if(_0x32bfa4===_0x0982('0x7b')){_0x33a96a[_0x0982('0x4b')](_0x0982('0x7c'),[][_0x0982('0x7d')](_0x141479['query'][_0x32bfa4]));}else if(_0x32bfa4===_0x0982('0x7e')){var _0x56835b=JSON['parse'](_0x141479[_0x0982('0x42')][_0x32bfa4])['$gte'];var _0x53337b=JSON[_0x0982('0x7f')](_0x141479[_0x0982('0x42')][_0x32bfa4])[_0x0982('0x80')];_0x33a96a[_0x0982('0x4b')](_0x0982('0x81'),_0x56835b,_0x53337b);}else{if(_0x141479[_0x0982('0x42')][_0x32bfa4]===_0x0982('0x82')){_0x33a96a[_0x0982('0x4b')]('i.'+_0x32bfa4+_0x0982('0x83'));}else{_0x33a96a[_0x0982('0x4b')]('i.'+_0x32bfa4+_0x0982('0x84'),_0x141479[_0x0982('0x42')][_0x32bfa4]);}}});}if(_0x141479['query']['read']){if(_0x141479[_0x0982('0x42')][_0x0982('0x85')]==0x1){_0x33a96a[_0x0982('0x65')]('`unreadMessages`\x20=\x200');}else{_0x33a96a[_0x0982('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x141479['query'][_0x0982('0x86')]){_0x604a08=_['isArray'](_0x141479[_0x0982('0x42')][_0x0982('0x86')])?_0x141479['query'][_0x0982('0x86')]:new Array(_0x141479['query'][_0x0982('0x86')]);_0x604a08[_0x0982('0x39')](function(_0x70a561){_0x2f2e70['or'](_0x0982('0x72'),'%,'+_0x70a561+',%');});}if(_0x141479[_0x0982('0x42')][_0x0982('0x87')]){var _0x3dbb56=_0x141479[_0x0982('0x42')]['filter'][_0x0982('0x88')]('\x5c','\x5c\x5c')[_0x0982('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3dbb56)){_0xeff30d['or']('i.id\x20LIKE\x20?',_0x3dbb56+'%')['or'](_0x0982('0x89'),_0x3dbb56+'%');}else{_0xeff30d['or'](_0x0982('0x8a'),qs[_0x0982('0x6b')](_0x3dbb56))['or'](_0x0982('0x8b'),_0x3dbb56+'%');}}}_0x33a96a[_0x0982('0x4b')](_0xeff30d);_0x33a96a[_0x0982('0x8c')](_0x0982('0x8d'));var _0x5365ff={'type':db[_0x0982('0x8e')][_0x0982('0x8f')]['SELECT'],'raw':!![]};var _0x37fcc2=_0x33a96a[_0x0982('0x90')]();_0x37fcc2[_0x0982('0x4e')](_0x0982('0x8d'));_0x37fcc2[_0x0982('0x4e')](_0x0982('0x91'),'unreadMessages');if(_0x6431ea[_0x0982('0x92')]){_0x6431ea[_0x0982('0x92')][_0x0982('0x39')](function(_0xfcb5a4){var _0x5c1899=_0xfcb5a4[0x0]===_0x0982('0x93')?_0xfcb5a4[0x0]:'i.'+_0xfcb5a4[0x0];_0x33a96a[_0x0982('0x92')](_0x5c1899,_0xfcb5a4[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0982('0x7a')](_0x604a08)){_0x33a96a[_0x0982('0x65')](_0x2f2e70);_0x37fcc2[_0x0982('0x4b')]('t.id\x20IN\x20?',_0x604a08);}BPromise[_0x0982('0x94')]()['then'](function(){if(!_0x2db8d2){if(_0x141479['query'][_0x0982('0x7b')])return;_0x37fcc2[_0x0982('0x4b')](_0x0982('0x95'));_0x33a96a['where'](_0x0982('0x95'));return;}if(_0x141479[_0x0982('0x96')][_0x0982('0x97')]!==_0x0982('0x98'))return;return _0x141479['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x0982('0x2d')](function(_0x4c43e3){if(_[_0x0982('0x7a')](_0x4c43e3)){_0x37fcc2['where'](_0x0982('0x99'));_0x33a96a[_0x0982('0x4b')](_0x0982('0x99'));}else{_0x37fcc2[_0x0982('0x4b')](_0x0982('0x7c'),_[_0x0982('0x34')](_0x4c43e3,'id'));_0x33a96a['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x4c43e3,'id'));}});})[_0x0982('0x2d')](function(){if(_0x141479[_0x0982('0x96')]['role']==='agent'&&!_0x2db8d2&&!_0x141479[_0x0982('0x42')][_0x0982('0x7b')])return[];return db[_0x0982('0x9a')][_0x0982('0x42')](_0x37fcc2[_0x0982('0x9b')](),_0x5365ff);})[_0x0982('0x2d')](function(_0x2f778c){_0x11816c[_0x0982('0x26')]=_0x2f778c[_0x0982('0x62')];if(_0x11816c[_0x0982('0x26')]===0x0)return[];return db[_0x0982('0x9a')][_0x0982('0x42')](_0x28308c[_0x0982('0x9b')](),_0x5365ff)[_0x0982('0x2d')](function(_0x28265b){_0x2e36a7=_[_0x0982('0x9c')](_0x28265b,'id');_0x5365ff=_[_0x0982('0x9d')](_0x5365ff,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x141479[_0x0982('0x42')][_0x0982('0x47')]){_0x6431ea[_0x0982('0x46')][_0x0982('0x39')](function(_0x443305){_0x33a96a['field']('i.'+_0x443305);});}else{_0x33a96a['field'](_0x0982('0x91'),_0x0982('0x9e'));_0x33a96a[_0x0982('0x4e')](_0x0982('0x9f'),_0x0982('0xa0'));_0x33a96a[_0x0982('0x4e')]('a.mandatoryDisposition',_0x0982('0xa1'));_0x33a96a[_0x0982('0x4e')](_0x0982('0xa2'),_0x0982('0x93'));_0x33a96a[_0x0982('0x4e')](_0x0982('0xa3'));_0x33a96a[_0x0982('0x4e')](_0x0982('0xa4'),_0x0982('0xa5'));_0x33a96a[_0x0982('0x4e')]('c.lastName','Contact.lastName');_0x33a96a[_0x0982('0x4e')](_0x0982('0xa6'),'Contact.email');_0x33a96a[_0x0982('0x4e')](_0x0982('0xa7'),'Contact.phone');_0x33a96a[_0x0982('0x4e')]('c.mobile',_0x0982('0xa8'));_0x33a96a['field'](_0x0982('0xa9'),'Contact.fax');_0x33a96a[_0x0982('0x4e')]('o.fullname',_0x0982('0xaa'));_0x33a96a['field'](_0x0982('0xab'),'Owner.internal');_0x33a96a['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0982('0x36'));}if(_0x6431ea[_0x0982('0x25')])_0x33a96a[_0x0982('0x25')](_0x6431ea['limit']);if(_0x6431ea[_0x0982('0x23')])_0x33a96a[_0x0982('0x23')](_0x6431ea['offset']);return db[_0x0982('0x9a')]['query'](_0x33a96a[_0x0982('0x9b')](),_0x5365ff);})[_0x0982('0x2d')](function(_0x29f7cd){if(_0x29f7cd['length']>0x0)_0x1af683[_0x0982('0x4b')](_0x0982('0xac'),_[_0x0982('0x34')](_0x29f7cd,'id'));return db[_0x0982('0x9a')][_0x0982('0x42')](_0x1af683[_0x0982('0x9b')](),_0x5365ff)[_0x0982('0x2d')](function(_0x459b67){var _0x20a88b=_[_0x0982('0xad')](_0x459b67,_0x0982('0xae'));var _0x211322=[];_0x29f7cd['forEach'](function(_0x1e4966){_0x211322[_0x0982('0x3a')](updateSmsInteraction(_0x1e4966,_0x2e36a7,_0x20a88b));});return BPromise[_0x0982('0xaf')](_0x211322);});});})['then'](function(_0x4f64bd){_0x11816c['rows']=_0x4f64bd;return _0x11816c;})[_0x0982('0x2d')](respondWithFilteredResult(_0x1b760d,_0x6431ea))[_0x0982('0x3b')](handleError(_0x1b760d,null));};exports[_0x0982('0xb0')]=function(_0x4dfb85,_0x58439a){var _0x173af6={'raw':![],'where':{'id':_0x4dfb85[_0x0982('0xb1')]['id']}},_0x3f5bfd={};_0x3f5bfd[_0x0982('0x41')]=_[_0x0982('0x43')](db[_0x0982('0x3d')][_0x0982('0xb2')]);_0x3f5bfd[_0x0982('0x42')]=_[_0x0982('0x43')](_0x4dfb85['query']);_0x3f5bfd[_0x0982('0x44')]=_[_0x0982('0x45')](_0x3f5bfd[_0x0982('0x41')],_0x3f5bfd[_0x0982('0x42')]);_0x173af6[_0x0982('0x46')]=_[_0x0982('0x45')](_0x3f5bfd[_0x0982('0x41')],qs[_0x0982('0x47')](_0x4dfb85['query'][_0x0982('0x47')]));_0x173af6['attributes']=_0x173af6[_0x0982('0x46')][_0x0982('0x62')]?_0x173af6[_0x0982('0x46')]:_0x3f5bfd[_0x0982('0x41')];if(_0x4dfb85['query'][_0x0982('0xb3')]){_0x173af6[_0x0982('0xb4')]=[{'all':!![]}];}_0x173af6=_['merge']({},_0x173af6,_0x4dfb85[_0x0982('0xb5')]);return db[_0x0982('0x3d')]['find'](_0x173af6)['then'](handleEntityNotFound(_0x58439a,null))[_0x0982('0x2d')](respondWithResult(_0x58439a,null))[_0x0982('0x3b')](handleError(_0x58439a,null));};exports[_0x0982('0xb6')]=function(_0x53c178,_0x4716d3){return db[_0x0982('0x3d')][_0x0982('0xb6')](_0x53c178[_0x0982('0x78')],{})[_0x0982('0x2d')](respondWithResult(_0x4716d3,0xc9))[_0x0982('0x3b')](handleError(_0x4716d3,null));};exports[_0x0982('0x2c')]=function(_0x3ffe01,_0x5d0eb8){if(_0x3ffe01['body']['id']){delete _0x3ffe01[_0x0982('0x78')]['id'];}return db[_0x0982('0x3d')][_0x0982('0x63')]({'where':{'id':_0x3ffe01[_0x0982('0xb1')]['id']}})[_0x0982('0x2d')](handleEntityNotFound(_0x5d0eb8,null))['then'](saveUpdates(_0x3ffe01[_0x0982('0x78')],null))['then'](respondWithResult(_0x5d0eb8,null))[_0x0982('0x3b')](handleError(_0x5d0eb8,null));};exports['destroy']=function(_0x138dc2,_0x2f55c6){return db['SmsInteraction']['find']({'where':{'id':_0x138dc2[_0x0982('0xb1')]['id']}})[_0x0982('0x2d')](handleEntityNotFound(_0x2f55c6,null))[_0x0982('0x2d')](removeEntity(_0x2f55c6,null))[_0x0982('0x3b')](handleError(_0x2f55c6,null));};exports[_0x0982('0xb7')]=function(_0x4fe100,_0xb04113){return db['SmsInteraction'][_0x0982('0xb7')]()[_0x0982('0x2d')](respondWithResult(_0xb04113,null))[_0x0982('0x3b')](handleError(_0xb04113,null));};exports[_0x0982('0xb8')]=function(_0x865d98,_0x20c4a2,_0x25c4eb){return db[_0x0982('0xb9')][_0x0982('0x63')]({'where':{'id':_0x865d98[_0x0982('0xb1')]['id']}})[_0x0982('0x2d')](handleEntityNotFound(_0x20c4a2,null))[_0x0982('0x2d')](function(_0x49146a){if(_0x49146a){return _0x49146a[_0x0982('0xb8')](_0x865d98[_0x0982('0x78')]['ids'],_[_0x0982('0xba')](_0x865d98[_0x0982('0x78')],[_0x0982('0xbb'),'id'])||{});}})[_0x0982('0x2d')](respondWithResult(_0x20c4a2,null))[_0x0982('0x3b')](handleError(_0x20c4a2,null));};exports[_0x0982('0xbc')]=function(_0x110ae1,_0x250a45,_0x339f0f){var _0x502fca={'raw':![],'where':{}};var _0x390a1a={};var _0x5b2da7={'count':0x0,'rows':[]};return db[_0x0982('0x3d')][_0x0982('0xbd')]({'where':{'id':_0x110ae1[_0x0982('0xb1')]['id']}})['then'](handleEntityNotFound(_0x250a45,null))['then'](function(_0x58d017){if(_0x58d017){_0x390a1a[_0x0982('0x41')]=_[_0x0982('0x43')](db[_0x0982('0xb9')][_0x0982('0xb2')]);_0x390a1a[_0x0982('0x42')]=_[_0x0982('0x43')](_0x110ae1['query']);_0x390a1a['filters']=_[_0x0982('0x45')](_0x390a1a[_0x0982('0x41')],_0x390a1a[_0x0982('0x42')]);_0x502fca[_0x0982('0x46')]=_['intersection'](_0x390a1a[_0x0982('0x41')],qs[_0x0982('0x47')](_0x110ae1[_0x0982('0x42')]['fields']));_0x502fca[_0x0982('0x46')]=_0x502fca[_0x0982('0x46')][_0x0982('0x62')]?_0x502fca[_0x0982('0x46')]:_0x390a1a['model'];if(!_0x110ae1['query'][_0x0982('0x48')](_0x0982('0x49'))){_0x502fca['limit']=qs[_0x0982('0x25')](_0x110ae1[_0x0982('0x42')][_0x0982('0x25')]);_0x502fca[_0x0982('0x23')]=qs['offset'](_0x110ae1[_0x0982('0x42')][_0x0982('0x23')]);}_0x502fca[_0x0982('0x92')]=qs['sort'](_0x110ae1[_0x0982('0x42')]['sort']);_0x502fca[_0x0982('0x4b')]=qs[_0x0982('0x44')](_[_0x0982('0x4c')](_0x110ae1[_0x0982('0x42')],_0x390a1a[_0x0982('0x44')]));_0x502fca['where'][_0x0982('0xae')]=_0x58d017['id'];if(_0x110ae1['query'][_0x0982('0x87')]){_0x502fca[_0x0982('0x4b')]=_[_0x0982('0x9d')](_0x502fca[_0x0982('0x4b')],{'$or':_['map'](_0x502fca[_0x0982('0x46')],function(_0x501e02){var _0x308e3b={};_0x308e3b[_0x501e02]={'$like':'%'+_0x110ae1[_0x0982('0x42')][_0x0982('0x87')]+'%'};return _0x308e3b;})});}if(_0x110ae1[_0x0982('0x42')][_0x0982('0xbe')]){var _0x4bc106=_0x110ae1[_0x0982('0x42')][_0x0982('0xbe')][_0x0982('0x38')](',');var _0x376592={};_0x376592[_0x4bc106[0x0]]={'$gte':moment(_0x4bc106[0x1])['format'](_0x0982('0xbf'))};_0x502fca['where']=_[_0x0982('0x9d')](_0x502fca[_0x0982('0x4b')],_0x376592);}_0x502fca=_[_0x0982('0x9d')]({},_0x502fca,_0x110ae1[_0x0982('0xb5')]);return db[_0x0982('0xb9')][_0x0982('0x26')]({'where':_0x502fca['where']})[_0x0982('0x2d')](function(_0x5ac926){_0x5b2da7[_0x0982('0x26')]=_0x5ac926;if(_0x110ae1[_0x0982('0x42')][_0x0982('0xb3')]){_0x502fca[_0x0982('0xb4')]=[{'all':!![]}];}return db[_0x0982('0xb9')][_0x0982('0xc0')](_0x502fca);})[_0x0982('0x2d')](function(_0x48de0d){_0x5b2da7[_0x0982('0xc1')]=_0x48de0d;return _0x5b2da7;});}})[_0x0982('0x2d')](respondWithFilteredResult(_0x250a45,_0x502fca))[_0x0982('0x3b')](handleError(_0x250a45,null));};exports[_0x0982('0xc2')]=function(_0x3cedd0,_0x32ded5,_0x3c9041){return db[_0x0982('0x3d')]['find']({'where':{'id':_0x3cedd0[_0x0982('0xb1')]['id']}})['then'](handleEntityNotFound(_0x32ded5,null))['then'](function(_0x54597f){if(_0x54597f){return _0x54597f[_0x0982('0xc3')](_0x3cedd0[_0x0982('0x78')][_0x0982('0xbb')],_[_0x0982('0xba')](_0x3cedd0[_0x0982('0x78')],[_0x0982('0xbb'),'id'])||{})[_0x0982('0xc4')](function(){return db[_0x0982('0x71')][_0x0982('0xc0')]({'attributes':['id',_0x0982('0x32'),_0x0982('0x4f')],'where':{'id':_0x3cedd0['body'][_0x0982('0xbb')]}});})[_0x0982('0x2d')](function(_0x8969a7){socket[_0x0982('0xc5')](_0x0982('0xc6'),{'id':Number(_0x3cedd0['params']['id']),'tags':_0x8969a7||[]});return{'id':Number(_0x3cedd0[_0x0982('0xb1')]['id']),'tags':_0x8969a7||[]};});}})['then'](respondWithResult(_0x32ded5,null))[_0x0982('0x3b')](handleError(_0x32ded5,null));};exports[_0x0982('0xc7')]=function(_0xe3c251,_0x4bc707,_0x38a36c){return db[_0x0982('0x3d')][_0x0982('0x63')]({'where':{'id':_0xe3c251[_0x0982('0xb1')]['id']}})[_0x0982('0x2d')](handleEntityNotFound(_0x4bc707,null))['then'](function(_0x4d7eb9){if(_0x4d7eb9){return _0x4d7eb9[_0x0982('0xc7')](_0xe3c251[_0x0982('0x42')][_0x0982('0xbb')]);}})['then'](respondWithStatusCode(_0x4bc707,null))[_0x0982('0x3b')](handleError(_0x4bc707,null));};exports[_0x0982('0xc8')]=function(_0x31995a,_0x246403){var _0x1656b6=moment()[_0x0982('0xc9')]()[_0x0982('0x9b')]();var _0x4df1b5=path[_0x0982('0xca')](config['root'],_0x0982('0xcb'),_0x0982('0xcc'),_0x0982('0xcd'));var _0x435c6d=path[_0x0982('0xca')](config[_0x0982('0xce')],_0x0982('0xcb'),'files','attachments');var _0x5e3854=path[_0x0982('0xca')](_0x4df1b5,_0x1656b6);var _0x51f03f=util[_0x0982('0xcf')](_0x0982('0xd0'),_0x31995a[_0x0982('0xb1')]['id'],_0x1656b6);var _0x513b2d=path[_0x0982('0xca')](_0x4df1b5,_0x51f03f);var _0x8d72a1=[];_0x8d72a1['push']({'model':db['User'],'as':_0x0982('0x74'),'attributes':['id',_0x0982('0x35')],'raw':!![]});_0x8d72a1[_0x0982('0x3a')]({'model':db[_0x0982('0xd1')],'as':_0x0982('0x68'),'attributes':['id','firstName',_0x0982('0xd2')],'raw':!![]});var _0x509cb8=[{'model':db[_0x0982('0xb9')],'as':_0x0982('0xd3'),'attributes':['id','body','createdAt','direction',_0x0982('0xd4'),_0x0982('0x85')],'include':_0x8d72a1}];_0x509cb8[_0x0982('0x3a')]({'model':db[_0x0982('0xd5')],'as':_0x0982('0xd6'),'attributes':['id',_0x0982('0x32')]});_0x509cb8[_0x0982('0x3a')]({'model':db[_0x0982('0x74')],'as':_0x0982('0xd7'),'attributes':['id',_0x0982('0x35')]});return db[_0x0982('0x3d')][_0x0982('0x63')]({'where':{'id':_0x31995a[_0x0982('0xb1')]['id']},'include':_0x509cb8})[_0x0982('0x2d')](handleEntityNotFound(_0x246403,null))[_0x0982('0x2d')](function(_0xd34dee){if(_0xd34dee){var _0x2dad94=_0xd34dee['get']({'plain':!![]});fs[_0x0982('0xd8')](_0x5e3854);var _0x135954={'channel':_0x0982('0xd9'),'account':_0x2dad94[_0x0982('0xd6')]['name'],'agent':_0x2dad94[_0x0982('0xd7')]?_0x2dad94[_0x0982('0xd7')][_0x0982('0x35')]:_0x0982('0xda'),'createdAt':moment(_0x2dad94[_0x0982('0x7e')])['format'](_0x0982('0xbf'))['toString'](),'closedAt':_0x2dad94['closed']?moment(_0x2dad94[_0x0982('0xdb')])[_0x0982('0xcf')](_0x0982('0xbf'))[_0x0982('0x9b')]():'','disposition':_0x2dad94[_0x0982('0xdc')],'messages':_(_0x2dad94[_0x0982('0xd3')])['filter']({'secret':![]})[_0x0982('0x34')](function(_0x4236c2){return{'date':moment(_0x4236c2['createdAt'])[_0x0982('0xcf')](_0x0982('0xbf'))[_0x0982('0x9b')](),'sender':_0x4236c2[_0x0982('0xdd')]===_0x0982('0xde')?_0x4236c2[_0x0982('0x74')]?_0x4236c2['User'][_0x0982('0x35')]:_0x0982('0xdf'):_0x4236c2['Contact'][_0x0982('0xe0')]+(_0x4236c2[_0x0982('0x68')][_0x0982('0xd2')]?'\x20'+_0x4236c2[_0x0982('0x68')][_0x0982('0xd2')]:''),'body':_0x4236c2[_0x0982('0x78')],'direction':_0x4236c2[_0x0982('0xdd')]===_0x0982('0xde')?'A':'C','secret':_0x4236c2[_0x0982('0xd4')],'read':_0x4236c2[_0x0982('0x85')]};})[_0x0982('0x64')]()};return ejs[_0x0982('0xe1')](path[_0x0982('0xca')](config[_0x0982('0xce')],_0x0982('0xcb'),_0x0982('0xe2'),_0x0982('0xe3')),{'interaction':_0x135954})['then'](function(_0x3eb124){var _0x4d76b1=path[_0x0982('0xca')](_0x5e3854,'transcript-'+_0x2dad94['id']+'-'+_0x1656b6+_0x0982('0xe4'));var _0x428567={'path':_0x4d76b1,'channel':'Sms','interactionId':_0x2dad94['id']};return pdf['createPdfFromHTML'](_0x3eb124,_0x428567);})[_0x0982('0x2d')](function(){return new BPromise(function(_0x1abffd,_0x263cce){zipdir(_0x5e3854,{'saveTo':_0x513b2d},function(_0x3e2791,_0x5c9045){if(_0x3e2791)return _0x263cce(_0x3e2791);return _0x1abffd(_0x5c9045);});})[_0x0982('0x2d')](function(){return new BPromise(function(_0x544112,_0x53e06c){rimraf(_0x5e3854,function(_0x462f8a){if(_0x462f8a)_0x53e06c(_0x462f8a);return _0x544112();});});})[_0x0982('0x2d')](function(){return _0x246403[_0x0982('0xc8')](_0x513b2d,_0x51f03f,function(_0x38e705){if(_0x38e705){console['log']('err',_0x38e705);}else{fs[_0x0982('0xe5')](_0x513b2d);}});});});}else{return _0x246403['sendStatus'](0xc8);}})[_0x0982('0x3b')](handleError(_0x246403,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 2b31d64..075c453 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 _0x14a0=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','setDataValue','Users','findAll','length','emit','catch'];(function(_0x1ad74d,_0x3870f3){var _0x1a869a=function(_0x3c2711){while(--_0x3c2711){_0x1ad74d['push'](_0x1ad74d['shift']());}};_0x1a869a(++_0x3870f3);}(_0x14a0,0x8e));var _0x014a=function(_0x4921cb,_0x346408){_0x4921cb=_0x4921cb-0x0;var _0x5820ac=_0x14a0[_0x4921cb];return _0x5820ac;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x014a('0x0'))['db'][_0x014a('0x1')];var SmsMessage=require(_0x014a('0x0'))['db'][_0x014a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x014a('0x3')](0x0);var events={'afterCreate':_0x014a('0x4'),'afterUpdate':_0x014a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57a522){return function(_0x1730a5,_0x12e8da,_0x38a22c){_0x1730a5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x11b8ce){_0x1730a5[_0x014a('0x6')](_0x014a('0x7'),_0x11b8ce['map'](function(_0x5d3d7f){return{'id':_0x5d3d7f['id']};}));return SmsMessage[_0x014a('0x8')]({'where':{'SmsInteractionId':_0x1730a5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x490ea2){_0x1730a5['setDataValue']('unreadMessages',_0x490ea2[_0x014a('0x9')]);SmsInteractionEvents['emit'](_0x57a522+':'+_0x1730a5['id'],_0x1730a5);SmsInteractionEvents[_0x014a('0xa')](_0x57a522,_0x1730a5);_0x38a22c(null);})[_0x014a('0xb')](_0x38a22c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x014a('0xc')](e,emitEvent(event));}}module[_0x014a('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0x7708=['hook','exports','events','../../mysqldb','remove','getUsers','then','setDataValue','Users','map','length','emit','catch'];(function(_0x5cdcff,_0x3118f2){var _0x46b31a=function(_0x1b2224){while(--_0x1b2224){_0x5cdcff['push'](_0x5cdcff['shift']());}};_0x46b31a(++_0x3118f2);}(_0x7708,0x188));var _0x8770=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x7708[_0x26f1b2];return _0x1624a4;};'use strict';var EventEmitter=require(_0x8770('0x0'));var SmsInteraction=require(_0x8770('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8770('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8770('0x2')};function emitEvent(_0x1a796d){return function(_0x577b13,_0x40d401,_0x50bab7){_0x577b13[_0x8770('0x3')]({'attributes':['id'],'raw':!![]})[_0x8770('0x4')](function(_0x2b0295){_0x577b13[_0x8770('0x5')](_0x8770('0x6'),_0x2b0295[_0x8770('0x7')](function(_0x2d4a1d){return{'id':_0x2d4a1d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x577b13['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8770('0x4')](function(_0x2ca830){_0x577b13[_0x8770('0x5')]('unreadMessages',_0x2ca830[_0x8770('0x8')]);SmsInteractionEvents[_0x8770('0x9')](_0x1a796d+':'+_0x577b13['id'],_0x577b13);SmsInteractionEvents[_0x8770('0x9')](_0x1a796d,_0x577b13);_0x50bab7(null);})[_0x8770('0xa')](_0x50bab7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x8770('0xb')](e,emitEvent(event));}}module[_0x8770('0xc')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 17da4ec..4a31623 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 _0x22da=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1a77e8,_0x374c98){var _0x1ea975=function(_0x5e8217){while(--_0x5e8217){_0x1a77e8['push'](_0x1a77e8['shift']());}};_0x1ea975(++_0x374c98);}(_0x22da,0x1e9));var _0xa22d=function(_0x1e7391,_0x373232){_0x1e7391=_0x1e7391-0x0;var _0x4cc8e6=_0x22da[_0x1e7391];return _0x4cc8e6;};'use strict';var _=require(_0xa22d('0x0'));var util=require(_0xa22d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa22d('0x2'));var BPromise=require('bluebird');var rp=require(_0xa22d('0x3'));var fs=require('fs');var path=require(_0xa22d('0x4'));var rimraf=require(_0xa22d('0x5'));var config=require(_0xa22d('0x6'));var attributes=require(_0xa22d('0x7'));module[_0xa22d('0x8')]=function(_0x5022b3,_0x5cce0b){return _0x5022b3[_0xa22d('0x9')](_0xa22d('0xa'),attributes,{'tableName':_0xa22d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2579a4,_0x1f86ed,_0x26a407){if(_0x2579a4[_0xa22d('0xc')](_0xa22d('0xd'))){_0x2579a4[_0xa22d('0xe')]=moment()['format'](_0xa22d('0xf'));}_0x26a407(null,_0x2579a4);}}});}; \ No newline at end of file +var _0x3a5a=['request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt','lodash','util','bluebird'];(function(_0x58718e,_0x27ede3){var _0x4ac755=function(_0x413d13){while(--_0x413d13){_0x58718e['push'](_0x58718e['shift']());}};_0x4ac755(++_0x27ede3);}(_0x3a5a,0x99));var _0xa3a5=function(_0x2e02ae,_0x4a4623){_0x2e02ae=_0x2e02ae-0x0;var _0x375a6b=_0x3a5a[_0x2e02ae];return _0x375a6b;};'use strict';var _=require(_0xa3a5('0x0'));var util=require(_0xa3a5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa3a5('0x2'));var rp=require(_0xa3a5('0x3'));var fs=require('fs');var path=require(_0xa3a5('0x4'));var rimraf=require(_0xa3a5('0x5'));var config=require('../../config/environment');var attributes=require(_0xa3a5('0x6'));module[_0xa3a5('0x7')]=function(_0x25bf49,_0x5f08d6){return _0x25bf49[_0xa3a5('0x8')](_0xa3a5('0x9'),attributes,{'tableName':_0xa3a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c4db3,_0x33be14,_0xb4382f){if(_0x5c4db3[_0xa3a5('0xb')]('closed')){_0x5c4db3[_0xa3a5('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xb4382f(null,_0x5c4db3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ccc8e5c..cae194f 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 _0x35dd=['register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','options','where','attributes','limit','debug','AddTagsToSmsInteraction','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket'];(function(_0x117f87,_0x587d46){var _0x21a74a=function(_0x7f975){while(--_0x7f975){_0x117f87['push'](_0x117f87['shift']());}};_0x21a74a(++_0x587d46);}(_0x35dd,0xc1));var _0xd35d=function(_0x170899,_0x1ae82f){_0x170899=_0x170899-0x0;var _0x541358=_0x35dd[_0x170899];return _0x541358;};'use strict';var _=require('lodash');var util=require(_0xd35d('0x0'));var moment=require(_0xd35d('0x1'));var BPromise=require(_0xd35d('0x2'));var rs=require(_0xd35d('0x3'));var fs=require('fs');var Redis=require(_0xd35d('0x4'));var db=require(_0xd35d('0x5'))['db'];var utils=require(_0xd35d('0x6'));var logger=require(_0xd35d('0x7'))('rpc');var config=require(_0xd35d('0x8'));var jayson=require(_0xd35d('0x9'));var client=jayson[_0xd35d('0xa')][_0xd35d('0xb')]({'port':0x232a});config[_0xd35d('0xc')]=_[_0xd35d('0xd')](config[_0xd35d('0xc')],{'host':_0xd35d('0xe'),'port':0x18eb});var socket=require(_0xd35d('0xf'))(new Redis(config['redis']));require(_0xd35d('0x10'))[_0xd35d('0x11')](socket);function respondWithRpcPromise(_0x42de79,_0x516eea,_0x1d090c){return new BPromise(function(_0x2580a9,_0x2c14b5){return client['request'](_0x42de79,_0x1d090c)[_0xd35d('0x12')](function(_0x96d165){logger[_0xd35d('0x13')](_0xd35d('0x14'),_0x516eea,_0xd35d('0x15'));logger['debug'](_0xd35d('0x16'),_0x516eea,_0xd35d('0x15'),JSON[_0xd35d('0x17')](_0x96d165));if(_0x96d165[_0xd35d('0x18')]){if(_0x96d165[_0xd35d('0x18')][_0xd35d('0x19')]===0x1f4){logger['error'](_0xd35d('0x14'),_0x516eea,_0x96d165['error'][_0xd35d('0x1a')]);return _0x2c14b5(_0x96d165[_0xd35d('0x18')][_0xd35d('0x1a')]);}logger[_0xd35d('0x18')](_0xd35d('0x14'),_0x516eea,_0x96d165['error'][_0xd35d('0x1a')]);return _0x2580a9(_0x96d165[_0xd35d('0x18')][_0xd35d('0x1a')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x516eea,_0xd35d('0x15'));_0x2580a9(_0x96d165[_0xd35d('0x1b')][_0xd35d('0x1a')]);}})[_0xd35d('0x1c')](function(_0x4e5319){logger[_0xd35d('0x18')](_0xd35d('0x14'),_0x516eea,_0x4e5319);_0x2c14b5(_0x4e5319);});});}exports[_0xd35d('0x1d')]=function(_0x4a5a11){var _0x4832fd=this;return new Promise(function(_0x37f08b,_0x5b6d05){return db[_0xd35d('0x1e')]['update'](_0x4a5a11['body'],{'raw':_0x4a5a11[_0xd35d('0x1f')]?_0x4a5a11[_0xd35d('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a5a11['options']?_0x4a5a11[_0xd35d('0x1f')][_0xd35d('0x20')]||null:null,'attributes':_0x4a5a11[_0xd35d('0x1f')]?_0x4a5a11['options'][_0xd35d('0x21')]||null:null,'limit':_0x4a5a11['options']?_0x4a5a11[_0xd35d('0x1f')][_0xd35d('0x22')]||null:null})[_0xd35d('0x12')](function(_0x2ba9ba){logger[_0xd35d('0x13')](_0xd35d('0x1d'),_0x4a5a11);logger[_0xd35d('0x23')]('UpdateSmsInteraction',_0x4a5a11,JSON[_0xd35d('0x17')](_0x2ba9ba));_0x37f08b(_0x2ba9ba);})[_0xd35d('0x1c')](function(_0x35bcc9){logger['error'](_0xd35d('0x1d'),_0x35bcc9['message'],_0x4a5a11);_0x5b6d05(_0x4832fd[_0xd35d('0x18')](0x1f4,_0x35bcc9[_0xd35d('0x1a')]));});});};exports[_0xd35d('0x24')]=function(_0x30784a){return new Promise(function(_0x18c9f6,_0x30ab76){return db[_0xd35d('0x1e')]['find']({'where':_0x30784a[_0xd35d('0x1f')]?_0x30784a['options'][_0xd35d('0x20')]||null:null})[_0xd35d('0x12')](function(_0xcdc037){if(_0xcdc037){return _0xcdc037['addTags'](_0x30784a[_0xd35d('0x25')][_0xd35d('0x26')],_[_0xd35d('0x27')](_0x30784a[_0xd35d('0x25')],['ids','id'])||{});}})[_0xd35d('0x28')](function(_0x12d9af){logger['info'](_0xd35d('0x29'),_0x30784a);logger['debug']('AddTags',_0x30784a,JSON['stringify'](_0x12d9af));_0x18c9f6(_0x12d9af);})['catch'](function(_0x31537c){logger[_0xd35d('0x18')](_0xd35d('0x29'),_0x31537c['message'],_0x30784a);_0x30ab76(_this[_0xd35d('0x18')](0x1f4,_0x31537c[_0xd35d('0x1a')]));});});}; \ No newline at end of file +var _0x7b06=['redis','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','options','raw','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','body','omit','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','localhost'];(function(_0x3a48c1,_0x35e608){var _0x474eff=function(_0x515a4f){while(--_0x515a4f){_0x3a48c1['push'](_0x3a48c1['shift']());}};_0x474eff(++_0x35e608);}(_0x7b06,0x196));var _0x67b0=function(_0x29b974,_0x4d7e73){_0x29b974=_0x29b974-0x0;var _0x33e066=_0x7b06[_0x29b974];return _0x33e066;};'use strict';var _=require('lodash');var util=require(_0x67b0('0x0'));var moment=require(_0x67b0('0x1'));var BPromise=require(_0x67b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67b0('0x3'));var db=require(_0x67b0('0x4'))['db'];var utils=require(_0x67b0('0x5'));var logger=require(_0x67b0('0x6'))(_0x67b0('0x7'));var config=require(_0x67b0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x67b0('0x9')]({'port':0x232a});config['redis']=_[_0x67b0('0xa')](config['redis'],{'host':_0x67b0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67b0('0xc')]));require(_0x67b0('0xd'))[_0x67b0('0xe')](socket);function respondWithRpcPromise(_0x423ed6,_0x22c5de,_0x3e44f0){return new BPromise(function(_0x13fe1f,_0x20f2da){return client['request'](_0x423ed6,_0x3e44f0)[_0x67b0('0xf')](function(_0x2518ec){logger[_0x67b0('0x10')](_0x67b0('0x11'),_0x22c5de,_0x67b0('0x12'));logger[_0x67b0('0x13')](_0x67b0('0x14'),_0x22c5de,_0x67b0('0x12'),JSON[_0x67b0('0x15')](_0x2518ec));if(_0x2518ec['error']){if(_0x2518ec[_0x67b0('0x16')][_0x67b0('0x17')]===0x1f4){logger[_0x67b0('0x16')](_0x67b0('0x11'),_0x22c5de,_0x2518ec['error'][_0x67b0('0x18')]);return _0x20f2da(_0x2518ec[_0x67b0('0x16')][_0x67b0('0x18')]);}logger[_0x67b0('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x22c5de,_0x2518ec['error']['message']);return _0x13fe1f(_0x2518ec[_0x67b0('0x16')][_0x67b0('0x18')]);}else{logger[_0x67b0('0x10')](_0x67b0('0x11'),_0x22c5de,_0x67b0('0x12'));_0x13fe1f(_0x2518ec[_0x67b0('0x19')]['message']);}})[_0x67b0('0x1a')](function(_0x17756a){logger[_0x67b0('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x22c5de,_0x17756a);_0x20f2da(_0x17756a);});});}exports['UpdateSmsInteraction']=function(_0x3bf441){var _0x2ef4f8=this;return new Promise(function(_0x2d7eb6,_0x353cc9){return db[_0x67b0('0x1b')]['update'](_0x3bf441['body'],{'raw':_0x3bf441['options']?_0x3bf441[_0x67b0('0x1c')][_0x67b0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bf441[_0x67b0('0x1c')]?_0x3bf441['options']['where']||null:null,'attributes':_0x3bf441[_0x67b0('0x1c')]?_0x3bf441['options'][_0x67b0('0x1e')]||null:null,'limit':_0x3bf441[_0x67b0('0x1c')]?_0x3bf441['options'][_0x67b0('0x1f')]||null:null})[_0x67b0('0xf')](function(_0x56beac){logger['info']('UpdateSmsInteraction',_0x3bf441);logger[_0x67b0('0x13')](_0x67b0('0x20'),_0x3bf441,JSON[_0x67b0('0x15')](_0x56beac));_0x2d7eb6(_0x56beac);})['catch'](function(_0x2b9c44){logger[_0x67b0('0x16')](_0x67b0('0x20'),_0x2b9c44[_0x67b0('0x18')],_0x3bf441);_0x353cc9(_0x2ef4f8[_0x67b0('0x16')](0x1f4,_0x2b9c44[_0x67b0('0x18')]));});});};exports[_0x67b0('0x21')]=function(_0x5df727){return new Promise(function(_0x51c9a3,_0x1b73aa){return db[_0x67b0('0x1b')]['find']({'where':_0x5df727[_0x67b0('0x1c')]?_0x5df727[_0x67b0('0x1c')]['where']||null:null})[_0x67b0('0xf')](function(_0x27aa5e){if(_0x27aa5e){return _0x27aa5e[_0x67b0('0x22')](_0x5df727[_0x67b0('0x23')]['ids'],_[_0x67b0('0x24')](_0x5df727[_0x67b0('0x23')],['ids','id'])||{});}})['spread'](function(_0x233afa){logger[_0x67b0('0x10')](_0x67b0('0x25'),_0x5df727);logger[_0x67b0('0x13')]('AddTags',_0x5df727,JSON[_0x67b0('0x15')](_0x233afa));_0x51c9a3(_0x233afa);})[_0x67b0('0x1a')](function(_0x324bd4){logger[_0x67b0('0x16')](_0x67b0('0x25'),_0x324bd4[_0x67b0('0x18')],_0x5df727);_0x1b73aa(_this['error'](0x1f4,_0x324bd4[_0x67b0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5f9ac34..291bfc4 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 _0x37e3=['remove','update','emit','smsInteraction:','./smsInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37e3,0x1e9));var _0x337e=function(_0x20b60d,_0x1cfd8b){_0x20b60d=_0x20b60d-0x0;var _0x1303e0=_0x37e3[_0x20b60d];return _0x1303e0;};'use strict';var SmsInteractionEvents=require(_0x337e('0x0'));var events=['save',_0x337e('0x1'),_0x337e('0x2')];function createListener(_0x4de62b,_0x2e7bec){return function(_0x30b176){_0x2e7bec[_0x337e('0x3')](_0x4de62b,_0x30b176);};}function removeListener(_0x3da3ff,_0x357df2){return function(){SmsInteractionEvents['removeListener'](_0x3da3ff,_0x357df2);};}exports['register']=function(_0x72d3db){for(var _0xd3a181=0x0,_0x157d46=events['length'];_0xd3a181<_0x157d46;_0xd3a181++){var _0x63ce54=events[_0xd3a181];var _0x5b51ab=createListener(_0x337e('0x4')+_0x63ce54,_0x72d3db);SmsInteractionEvents['on'](_0x63ce54,_0x5b51ab);}}; \ No newline at end of file +var _0x2bd6=['length','smsInteraction:','./smsInteraction.events','save','update','register'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x2bd6,0x116));var _0x62bd=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x2bd6[_0x4ca333];return _0x13b2e1;};'use strict';var SmsInteractionEvents=require(_0x62bd('0x0'));var events=[_0x62bd('0x1'),'remove',_0x62bd('0x2')];function createListener(_0x4c3796,_0x40b5a0){return function(_0x34bec2){_0x40b5a0['emit'](_0x4c3796,_0x34bec2);};}function removeListener(_0x2cb784,_0x3aebd2){return function(){SmsInteractionEvents['removeListener'](_0x2cb784,_0x3aebd2);};}exports[_0x62bd('0x3')]=function(_0xe3f45b){for(var _0x27c66b=0x0,_0x3abe7b=events[_0x62bd('0x4')];_0x27c66b<_0x3abe7b;_0x27c66b++){var _0x2191e2=events[_0x27c66b];var _0x57ea39=createListener(_0x62bd('0x5')+_0x2191e2,_0xe3f45b);SmsInteractionEvents['on'](_0x2191e2,_0x57ea39);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5a5668a..61b7b98 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 _0x012b=['post','tracked','smsmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x15338d,_0x556f55){var _0x201155=function(_0x1c99d8){while(--_0x1c99d8){_0x15338d['push'](_0x15338d['shift']());}};_0x201155(++_0x556f55);}(_0x012b,0x11c));var _0xb012=function(_0x3b87d1,_0xf32fef){_0x3b87d1=_0x3b87d1-0x0;var _0x8796e=_0x012b[_0x3b87d1];return _0x8796e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb012('0x0'));var timeout=require('connect-timeout');var express=require(_0xb012('0x1'));var router=express[_0xb012('0x2')]();var fs_extra=require(_0xb012('0x3'));var auth=require(_0xb012('0x4'));var interaction=require(_0xb012('0x5'));var config=require(_0xb012('0x6'));var controller=require(_0xb012('0x7'));router[_0xb012('0x8')]('/',auth['isAuthenticated'](),controller[_0xb012('0x9')]);router['get'](_0xb012('0xa'),auth[_0xb012('0xb')](),controller[_0xb012('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb012('0xd')]('/',auth[_0xb012('0xb')](),interaction[_0xb012('0xe')]('sms',_0xb012('0xf')),controller[_0xb012('0x10')]);router[_0xb012('0xd')](_0xb012('0x11'),controller[_0xb012('0x12')]);router[_0xb012('0x13')](_0xb012('0x14'),auth[_0xb012('0xb')](),controller['update']);router[_0xb012('0x13')](_0xb012('0x15'),auth[_0xb012('0xb')](),controller[_0xb012('0x16')]);router[_0xb012('0x13')](_0xb012('0x17'),auth[_0xb012('0xb')](),controller['reject']);router[_0xb012('0x18')]('/:id',auth[_0xb012('0xb')](),controller[_0xb012('0x19')]);module[_0xb012('0x1a')]=router; \ No newline at end of file +var _0x2ebe=['tracked','sms','smsmessage:create','create','status','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x34a223,_0x5b0fe9){var _0x4a9a0e=function(_0x2f109a){while(--_0x2f109a){_0x34a223['push'](_0x34a223['shift']());}};_0x4a9a0e(++_0x5b0fe9);}(_0x2ebe,0x125));var _0xe2eb=function(_0x1b897e,_0x5aae5b){_0x1b897e=_0x1b897e-0x0;var _0x51b676=_0x2ebe[_0x1b897e];return _0x51b676;};'use strict';var multer=require(_0xe2eb('0x0'));var util=require(_0xe2eb('0x1'));var path=require(_0xe2eb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe2eb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe2eb('0x4'));var interaction=require(_0xe2eb('0x5'));var config=require(_0xe2eb('0x6'));var controller=require(_0xe2eb('0x7'));router[_0xe2eb('0x8')]('/',auth[_0xe2eb('0x9')](),controller[_0xe2eb('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe2eb('0xb')]);router[_0xe2eb('0x8')](_0xe2eb('0xc'),auth[_0xe2eb('0x9')](),controller[_0xe2eb('0xd')]);router[_0xe2eb('0xe')]('/',auth[_0xe2eb('0x9')](),interaction[_0xe2eb('0xf')](_0xe2eb('0x10'),_0xe2eb('0x11')),controller[_0xe2eb('0x12')]);router[_0xe2eb('0xe')]('/:id/status',controller[_0xe2eb('0x13')]);router['put'](_0xe2eb('0xc'),auth[_0xe2eb('0x9')](),controller[_0xe2eb('0x14')]);router['put'](_0xe2eb('0x15'),auth[_0xe2eb('0x9')](),controller[_0xe2eb('0x16')]);router[_0xe2eb('0x17')](_0xe2eb('0x18'),auth[_0xe2eb('0x9')](),controller[_0xe2eb('0x19')]);router[_0xe2eb('0x1a')]('/:id',auth[_0xe2eb('0x9')](),controller[_0xe2eb('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index dbb8240..9ac4ebf 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 _0xeadc=['exports','TEXT','ENUM','out','STRING','DATE','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeadc,0x1d4));var _0xcead=function(_0xd9ed0d,_0x1c318c){_0xd9ed0d=_0xd9ed0d-0x0;var _0x298e5a=_0xeadc[_0xd9ed0d];return _0x298e5a;};'use strict';var Sequelize=require(_0xcead('0x0'));module[_0xcead('0x1')]={'body':{'type':Sequelize[_0xcead('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xcead('0x3')]('in',_0xcead('0x4')),'defaultValue':_0xcead('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcead('0x5')](0xbe)},'phone':{'type':Sequelize[_0xcead('0x5')]},'readAt':{'type':Sequelize[_0xcead('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcead('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xaa9c=['ENUM','out','STRING','sequelize','exports','TEXT','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa9c,0x1f4));var _0xcaa9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xaa9c[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xcaa9('0x0'));module[_0xcaa9('0x1')]={'body':{'type':Sequelize[_0xcaa9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcaa9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcaa9('0x4')]('in',_0xcaa9('0x5')),'defaultValue':_0xcaa9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xcaa9('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xcaa9('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcaa9('0x6')]},'providerResponse':{'type':Sequelize[_0xcaa9('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 939c760..edcc9bb 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 _0x5ec3=['sendStatus','stack','name','send','map','SmsMessage','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','type','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','create','body','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','internal','event','rejectmessage','SmsAccountId','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','results','groupName','DELIVERED','infobip','inspect','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_0x5ec3,0xf2));var _0x35ec=function(_0x47d727,_0x23d2b0){_0x47d727=_0x47d727-0x0;var _0x16205d=_0x5ec3[_0x47d727];return _0x16205d;};'use strict';var emlformat=require(_0x35ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35ec('0x1'));var jsonpatch=require(_0x35ec('0x2'));var rp=require('request-promise');var moment=require(_0x35ec('0x3'));var BPromise=require(_0x35ec('0x4'));var Mustache=require('mustache');var util=require(_0x35ec('0x5'));var path=require(_0x35ec('0x6'));var sox=require(_0x35ec('0x7'));var csv=require(_0x35ec('0x8'));var ejs=require(_0x35ec('0x9'));var fs=require('fs');var fs_extra=require(_0x35ec('0xa'));var _=require(_0x35ec('0xb'));var squel=require(_0x35ec('0xc'));var crypto=require(_0x35ec('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x35ec('0xe'));var toCsv=require(_0x35ec('0x8'));var querystring=require(_0x35ec('0xf'));var Papa=require(_0x35ec('0x10'));var Redis=require('ioredis');var authService=require(_0x35ec('0x11'));var qs=require(_0x35ec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ec('0x13'));var logger=require(_0x35ec('0x14'))(_0x35ec('0x15'));var utils=require(_0x35ec('0x16'));var config=require(_0x35ec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x35ec('0x18'))['db'];config['redis']=_[_0x35ec('0x19')](config[_0x35ec('0x1a')],{'host':_0x35ec('0x1b'),'port':0x18eb});var socket=require(_0x35ec('0x1c'))(new Redis(config[_0x35ec('0x1a')]));require(_0x35ec('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x35ec('0x1e')][_0x35ec('0x1f')]({'port':0x232c});var client9002=jayson[_0x35ec('0x1e')][_0x35ec('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5275f6,_0x1d3ada,_0x25e527,_0x6e975c){return new BPromise(function(_0x588f50,_0x15d09e){var _0x510f35=_0x6e975c||client;return _0x510f35[_0x35ec('0x20')](_0x5275f6,_0x25e527)[_0x35ec('0x21')](function(_0x4e50a9){logger[_0x35ec('0x22')](_0x35ec('0x23'),_0x1d3ada,'request\x20sent');logger[_0x35ec('0x24')](_0x35ec('0x25'),_0x1d3ada,_0x35ec('0x26'),JSON[_0x35ec('0x27')](_0x4e50a9));if(_0x4e50a9[_0x35ec('0x28')]){if(_0x4e50a9[_0x35ec('0x28')][_0x35ec('0x29')]===0x1f4){logger[_0x35ec('0x28')](_0x35ec('0x23'),_0x1d3ada,_0x4e50a9['error'][_0x35ec('0x2a')]);return _0x15d09e(_0x4e50a9[_0x35ec('0x28')][_0x35ec('0x2a')]);}logger[_0x35ec('0x28')](_0x35ec('0x23'),_0x1d3ada,_0x4e50a9[_0x35ec('0x28')]['message']);return _0x588f50(_0x4e50a9['error']['message']);}else{logger['info'](_0x35ec('0x23'),_0x1d3ada,_0x35ec('0x26'));_0x588f50(_0x4e50a9[_0x35ec('0x2b')]['message']);}})[_0x35ec('0x2c')](function(_0x2b6cc2){logger[_0x35ec('0x28')](_0x35ec('0x23'),_0x1d3ada,_0x2b6cc2);_0x15d09e(_0x2b6cc2);});});}function respondWithStatusCode(_0x3b9a66,_0x4ddbfe){_0x4ddbfe=_0x4ddbfe||0xcc;return function(_0x347436){if(_0x347436){return _0x3b9a66['sendStatus'](_0x4ddbfe);}return _0x3b9a66[_0x35ec('0x2d')](_0x4ddbfe)[_0x35ec('0x2e')]();};}function respondWithResult(_0x4dfd06,_0x311932){_0x311932=_0x311932||0xc8;return function(_0x23d00d){if(_0x23d00d){return _0x4dfd06[_0x35ec('0x2d')](_0x311932)['json'](_0x23d00d);}};}function respondWithFilteredResult(_0x44518f,_0x161a79){return function(_0x4322f3){if(_0x4322f3){var _0x349878=typeof _0x161a79[_0x35ec('0x2f')]===_0x35ec('0x30')&&typeof _0x161a79[_0x35ec('0x31')]===_0x35ec('0x30');var _0x54881e=_0x4322f3[_0x35ec('0x32')];var _0x3e6319=_0x349878?0x0:_0x161a79[_0x35ec('0x2f')];var _0x33b7e7=_0x349878?_0x4322f3[_0x35ec('0x32')]:_0x161a79['offset']+_0x161a79[_0x35ec('0x31')];var _0x14c73d;if(_0x33b7e7>=_0x54881e){_0x33b7e7=_0x54881e;_0x14c73d=0xc8;}else{_0x14c73d=0xce;}_0x44518f[_0x35ec('0x2d')](_0x14c73d);return _0x44518f[_0x35ec('0x33')](_0x35ec('0x34'),_0x3e6319+'-'+_0x33b7e7+'/'+_0x54881e)[_0x35ec('0x35')](_0x4322f3);}return null;};}function patchUpdates(_0x1e54e9){return function(_0xce9e37){try{jsonpatch['apply'](_0xce9e37,_0x1e54e9,!![]);}catch(_0x312bcf){return BPromise['reject'](_0x312bcf);}return _0xce9e37['save']();};}function saveUpdates(_0x1e926c,_0x25c457){return function(_0x5c6915){if(_0x5c6915){return _0x5c6915[_0x35ec('0x36')](_0x1e926c)[_0x35ec('0x21')](function(_0x282514){return _0x282514;});}return null;};}function removeEntity(_0x46ebdd,_0xab6678){return function(_0xc4338){if(_0xc4338){return _0xc4338[_0x35ec('0x37')]()[_0x35ec('0x21')](function(){_0x46ebdd[_0x35ec('0x2d')](0xcc)[_0x35ec('0x2e')]();});}};}function handleEntityNotFound(_0x3a18ce,_0x1b3840){return function(_0x58f55c){if(!_0x58f55c){_0x3a18ce[_0x35ec('0x38')](0x194);}return _0x58f55c;};}function handleError(_0x14ac37,_0x3920ff){_0x3920ff=_0x3920ff||0x1f4;return function(_0x34a762){logger['error'](_0x34a762[_0x35ec('0x39')]);if(_0x34a762[_0x35ec('0x3a')]){delete _0x34a762['name'];}_0x14ac37['status'](_0x3920ff)[_0x35ec('0x3b')](_0x34a762);};}exports['index']=function(_0x2c6d9b,_0x5a2aa0){var _0xab1f28={},_0xa21c9e={},_0x50f809={'count':0x0,'rows':[]};var _0x22fb58=_[_0x35ec('0x3c')](db[_0x35ec('0x3d')]['rawAttributes'],function(_0x4d1b1e){return{'name':_0x4d1b1e[_0x35ec('0x3e')],'type':_0x4d1b1e['type'][_0x35ec('0x3f')]};});_0xa21c9e[_0x35ec('0x40')]=_[_0x35ec('0x3c')](_0x22fb58,'name');_0xa21c9e['query']=_['keys'](_0x2c6d9b[_0x35ec('0x41')]);_0xa21c9e['filters']=_[_0x35ec('0x42')](_0xa21c9e[_0x35ec('0x40')],_0xa21c9e['query']);_0xab1f28[_0x35ec('0x43')]=_[_0x35ec('0x42')](_0xa21c9e[_0x35ec('0x40')],qs[_0x35ec('0x44')](_0x2c6d9b[_0x35ec('0x41')][_0x35ec('0x44')]));_0xab1f28[_0x35ec('0x43')]=_0xab1f28['attributes'][_0x35ec('0x45')]?_0xab1f28[_0x35ec('0x43')]:_0xa21c9e['model'];if(!_0x2c6d9b[_0x35ec('0x41')][_0x35ec('0x46')]('nolimit')){_0xab1f28['limit']=qs[_0x35ec('0x31')](_0x2c6d9b[_0x35ec('0x41')][_0x35ec('0x31')]);_0xab1f28[_0x35ec('0x2f')]=qs[_0x35ec('0x2f')](_0x2c6d9b['query']['offset']);}_0xab1f28[_0x35ec('0x47')]=qs['sort'](_0x2c6d9b[_0x35ec('0x41')][_0x35ec('0x48')]);_0xab1f28['where']=qs[_0x35ec('0x49')](_[_0x35ec('0x4a')](_0x2c6d9b[_0x35ec('0x41')],_0xa21c9e['filters']),_0x22fb58);if(_0x2c6d9b[_0x35ec('0x41')][_0x35ec('0x4b')]){_0xab1f28['where']=_[_0x35ec('0x4c')](_0xab1f28[_0x35ec('0x4d')],{'$or':_[_0x35ec('0x3c')](_0x22fb58,function(_0x1db6e6){if(_0x1db6e6[_0x35ec('0x4e')]!=='VIRTUAL'){var _0x2cbf4d={};_0x2cbf4d[_0x1db6e6['name']]={'$like':'%'+_0x2c6d9b[_0x35ec('0x41')][_0x35ec('0x4b')]+'%'};return _0x2cbf4d;}})});}_0xab1f28=_['merge']({},_0xab1f28,_0x2c6d9b[_0x35ec('0x4f')]);var _0x3b9376={'where':_0xab1f28[_0x35ec('0x4d')]};return db[_0x35ec('0x3d')]['count'](_0x3b9376)[_0x35ec('0x21')](function(_0x597674){_0x50f809[_0x35ec('0x32')]=_0x597674;if(_0x2c6d9b['query'][_0x35ec('0x50')]){_0xab1f28[_0x35ec('0x51')]=[{'all':!![]}];}return db[_0x35ec('0x3d')][_0x35ec('0x52')](_0xab1f28);})[_0x35ec('0x21')](function(_0x4e4afe){_0x50f809['rows']=_0x4e4afe;return _0x50f809;})[_0x35ec('0x21')](respondWithFilteredResult(_0x5a2aa0,_0xab1f28))[_0x35ec('0x2c')](handleError(_0x5a2aa0,null));};exports[_0x35ec('0x53')]=function(_0x3e406b,_0x5cb3c5){var _0x2bb6af={'raw':!![],'where':{'id':_0x3e406b[_0x35ec('0x54')]['id']}},_0x2151ac={};_0x2151ac[_0x35ec('0x40')]=_[_0x35ec('0x55')](db[_0x35ec('0x3d')][_0x35ec('0x56')]);_0x2151ac[_0x35ec('0x41')]=_['keys'](_0x3e406b[_0x35ec('0x41')]);_0x2151ac[_0x35ec('0x49')]=_[_0x35ec('0x42')](_0x2151ac[_0x35ec('0x40')],_0x2151ac[_0x35ec('0x41')]);_0x2bb6af[_0x35ec('0x43')]=_[_0x35ec('0x42')](_0x2151ac[_0x35ec('0x40')],qs[_0x35ec('0x44')](_0x3e406b[_0x35ec('0x41')]['fields']));_0x2bb6af[_0x35ec('0x43')]=_0x2bb6af[_0x35ec('0x43')][_0x35ec('0x45')]?_0x2bb6af[_0x35ec('0x43')]:_0x2151ac[_0x35ec('0x40')];if(_0x3e406b[_0x35ec('0x41')][_0x35ec('0x50')]){_0x2bb6af['include']=[{'all':!![]}];}_0x2bb6af=_['merge']({},_0x2bb6af,_0x3e406b['options']);return db['SmsMessage'][_0x35ec('0x57')](_0x2bb6af)[_0x35ec('0x21')](handleEntityNotFound(_0x5cb3c5,null))[_0x35ec('0x21')](respondWithResult(_0x5cb3c5,null))['catch'](handleError(_0x5cb3c5,null));};exports[_0x35ec('0x58')]=function(_0x21a603,_0x15662d){return db[_0x35ec('0x3d')][_0x35ec('0x58')](_0x21a603[_0x35ec('0x59')],{})[_0x35ec('0x21')](respondWithResult(_0x15662d,0xc9))['catch'](handleError(_0x15662d,null));};exports['update']=function(_0x4226c4,_0x1de6c4){if(_0x4226c4[_0x35ec('0x59')]['id']){delete _0x4226c4['body']['id'];}return db[_0x35ec('0x3d')][_0x35ec('0x57')]({'where':{'id':_0x4226c4['params']['id']}})[_0x35ec('0x21')](handleEntityNotFound(_0x1de6c4,null))[_0x35ec('0x21')](saveUpdates(_0x4226c4[_0x35ec('0x59')],null))['then'](respondWithResult(_0x1de6c4,null))[_0x35ec('0x2c')](handleError(_0x1de6c4,null));};exports['destroy']=function(_0x5d6fb0,_0x566c5c){return db[_0x35ec('0x3d')][_0x35ec('0x57')]({'where':{'id':_0x5d6fb0[_0x35ec('0x54')]['id']}})[_0x35ec('0x21')](handleEntityNotFound(_0x566c5c,null))[_0x35ec('0x21')](removeEntity(_0x566c5c,null))[_0x35ec('0x2c')](handleError(_0x566c5c,null));};exports[_0x35ec('0x5a')]=function(_0x4c7226,_0x461488){return db[_0x35ec('0x3d')][_0x35ec('0x5a')]()[_0x35ec('0x21')](respondWithResult(_0x461488,null))[_0x35ec('0x2c')](handleError(_0x461488,null));};var interaction_log=require('../../config/logger')(_0x35ec('0x5b'));exports[_0x35ec('0x5c')]=function(_0xa6d1cd,_0x5b6150,_0x55248e){var _0x8a7b7b={'agent':{},'channel':'sms'};if(_0xa6d1cd['body']['id']){delete _0xa6d1cd[_0x35ec('0x59')]['id'];}_0xa6d1cd[_0x35ec('0x59')][_0x35ec('0x5d')]=!![];_0xa6d1cd[_0x35ec('0x59')][_0x35ec('0x5e')]=moment()[_0x35ec('0x5f')](_0x35ec('0x60'));_0xa6d1cd[_0x35ec('0x59')][_0x35ec('0x61')]=_0xa6d1cd[_0x35ec('0x59')][_0x35ec('0x61')]||_0xa6d1cd[_0x35ec('0x62')]['id'];_0x8a7b7b[_0x35ec('0x63')]['id']=_0xa6d1cd['body']['UserId'];return db[_0x35ec('0x3d')][_0x35ec('0x57')]({'where':{'id':_0xa6d1cd[_0x35ec('0x54')]['id'],'UserId':null}})[_0x35ec('0x21')](handleEntityNotFound(_0x5b6150,null))[_0x35ec('0x21')](saveUpdates(_0xa6d1cd[_0x35ec('0x59')],null))['then'](function(_0x5729bf){if(_0x5729bf){_0x8a7b7b[_0x35ec('0x2a')]=_0x5729bf[_0x35ec('0x64')]({'plain':!![]});return db[_0x35ec('0x65')][_0x35ec('0x57')]({'where':{'id':_0x5729bf[_0x35ec('0x66')]}});}return null;})[_0x35ec('0x21')](handleEntityNotFound(_0x5b6150,null))[_0x35ec('0x21')](function(_0x559235){if(_0x559235){return _0x559235['update']({'UserId':_0xa6d1cd['body'][_0x35ec('0x61')],'read1stAt':_[_0x35ec('0x67')](_0x559235[_0x35ec('0x68')])?moment()[_0x35ec('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x35ec('0x21')](function(_0x3728ee){if(_0x3728ee){_0x8a7b7b[_0x35ec('0x69')]=_0x3728ee['get']({'plain':!![]});interaction_log[_0x35ec('0x22')](_0x35ec('0x6a'),_0xa6d1cd[_0x35ec('0x62')]['id'],_0xa6d1cd[_0x35ec('0x62')][_0x35ec('0x3a')],_0xa6d1cd[_0x35ec('0x62')][_0x35ec('0x6b')],_0x8a7b7b[_0x35ec('0x69')]['id'],_0xa6d1cd[_0x35ec('0x59')]?JSON[_0x35ec('0x27')](_0xa6d1cd[_0x35ec('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0x35ec('0x6c'),_0x8a7b7b);}return null;})[_0x35ec('0x21')](function(_0x3e94c3){var _0xf92cc0=_0x35ec('0x6d')+_0x3e94c3[_0x35ec('0x2a')][_0x35ec('0x6e')];return db[_0x35ec('0x6f')][_0x35ec('0x41')](_0xf92cc0,{'type':db[_0x35ec('0x70')][_0x35ec('0x71')][_0x35ec('0x72')],'raw':!![]})[_0x35ec('0x21')](function(_0x102139){return _0x102139;});})[_0x35ec('0x21')](function(_0x5a740a){if(_0x5a740a){_0x8a7b7b[_0x35ec('0x2a')][_0x35ec('0x73')]=_0x5a740a[0x0];if(!_0xa6d1cd['body'][_0x35ec('0x61')])return;return db[_0x35ec('0x74')][_0x35ec('0x57')]({'where':{'id':_0xa6d1cd[_0x35ec('0x59')]['UserId'],'role':_0x35ec('0x63')},'attributes':['id','name','fullname',_0x35ec('0x75'),'internal'],'raw':!![]});}return null;})[_0x35ec('0x21')](function(_0x356e01){if(!_0x356e01)return null;_0x8a7b7b[_0x35ec('0x2a')]['agent']=_0x356e01;return _0x8a7b7b;})[_0x35ec('0x21')](function(_0xf4f90a){if(_0xf4f90a){if(_0xa6d1cd[_0x35ec('0x59')][_0x35ec('0x76')]){_0x8a7b7b[_0x35ec('0x2a')][_0x35ec('0x77')]=util[_0x35ec('0x5f')](_0x35ec('0x78'),_0xa6d1cd[_0x35ec('0x62')][_0x35ec('0x3a')]);_0x8a7b7b[_0x35ec('0x2a')][_0x35ec('0x79')]=_0x8a7b7b['channel'];_0x8a7b7b[_0x35ec('0x2a')][_0x35ec('0x7a')]=_0x8a7b7b[_0x35ec('0x79')];_0x8a7b7b[_0x35ec('0x2a')]['event']=_0x35ec('0x5c');return respondWithRpcPromise('EventManager',_0x35ec('0x7b'),{'event':_0x35ec('0x7c'),'message':_0x8a7b7b['message']},client9002)[_0x35ec('0x21')](function(){return _0x8a7b7b;});}return _0x8a7b7b;}return null;})['then'](respondWithResult(_0x5b6150,null))[_0x35ec('0x2c')](handleError(_0x5b6150,null));};var interaction_log=require(_0x35ec('0x14'))('sms-interactions');exports[_0x35ec('0x7d')]=function(_0x14746c,_0x342180,_0x11525a){var _0x334a3d={'agent':{},'channel':_0x35ec('0x7e')};if(_0x14746c[_0x35ec('0x59')]['id']){delete _0x14746c['body']['id'];}_0x14746c['body']['UserId']=_0x14746c[_0x35ec('0x59')][_0x35ec('0x61')]||_0x14746c[_0x35ec('0x62')]['id'];_0x334a3d['agent']['id']=_0x14746c[_0x35ec('0x59')][_0x35ec('0x61')];return db[_0x35ec('0x3d')]['find']({'where':{'id':_0x14746c[_0x35ec('0x54')]['id'],'UserId':null}})[_0x35ec('0x21')](handleEntityNotFound(_0x342180,null))['then'](function(_0x2842b8){if(_0x2842b8){_0x334a3d[_0x35ec('0x2a')]=_0x2842b8['get']({'plain':!![]});return db[_0x35ec('0x65')][_0x35ec('0x57')]({'where':{'id':_0x2842b8[_0x35ec('0x66')]}});}return null;})[_0x35ec('0x21')](handleEntityNotFound(_0x342180,null))[_0x35ec('0x21')](function(_0x264b70){if(_0x264b70){_0x334a3d[_0x35ec('0x69')]=_0x264b70['get']({'plain':!![]});interaction_log[_0x35ec('0x22')](_0x35ec('0x7f'),_0x14746c['user']['id'],_0x14746c['user'][_0x35ec('0x3a')],_0x14746c[_0x35ec('0x62')][_0x35ec('0x6b')],_0x334a3d['interaction']['id'],_0x14746c[_0x35ec('0x59')]?JSON[_0x35ec('0x27')](_0x14746c[_0x35ec('0x59')]):_0x35ec('0x80'));return respondWithRpcPromise(_0x35ec('0x81'),_0x35ec('0x82'),_0x334a3d);}return null;})['then'](function(_0x1f156b){var _0xed280d=_0x35ec('0x6d')+_0x1f156b[_0x35ec('0x2a')][_0x35ec('0x6e')];return db[_0x35ec('0x6f')][_0x35ec('0x41')](_0xed280d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x35ec('0x21')](function(_0x360b02){return _0x360b02;});})[_0x35ec('0x21')](function(_0x1578a9){if(_0x1578a9){_0x334a3d[_0x35ec('0x2a')]['contact']=_0x1578a9[0x0];if(!_0x14746c[_0x35ec('0x59')][_0x35ec('0x61')])return;return db[_0x35ec('0x74')][_0x35ec('0x57')]({'where':{'id':_0x14746c['body'][_0x35ec('0x61')],'role':_0x35ec('0x63')},'attributes':['id',_0x35ec('0x3a'),'fullname',_0x35ec('0x75'),_0x35ec('0x83')],'raw':!![]});}return null;})[_0x35ec('0x21')](function(_0xe68a7f){if(!_0xe68a7f)return null;_0x334a3d['message'][_0x35ec('0x63')]=_0xe68a7f;return _0x334a3d;})['then'](function(_0x3caf9c){if(_0x3caf9c){_0x3caf9c['message'][_0x35ec('0x77')]=util[_0x35ec('0x5f')](_0x35ec('0x78'),_0x14746c[_0x35ec('0x62')][_0x35ec('0x3a')]);_0x3caf9c['message'][_0x35ec('0x79')]=_0x334a3d[_0x35ec('0x79')];_0x3caf9c[_0x35ec('0x2a')][_0x35ec('0x7a')]=_0x334a3d[_0x35ec('0x79')];_0x3caf9c['message'][_0x35ec('0x84')]=_0x35ec('0x7d');respondWithRpcPromise(_0x35ec('0x7b'),_0x35ec('0x7b'),{'event':_0x35ec('0x85'),'message':_0x3caf9c['message']},client9002);return _0x334a3d;}return null;})['then'](respondWithResult(_0x342180,null))[_0x35ec('0x2c')](handleError(_0x342180,null));};exports[_0x35ec('0x2d')]=function(_0x3632e1,_0x4a2100,_0xf6fcce){if(_0x3632e1[_0x35ec('0x59')]['id']){delete _0x3632e1[_0x35ec('0x59')]['id'];}var _0x12b5fa;return db[_0x35ec('0x3d')]['find']({'where':{'id':_0x3632e1[_0x35ec('0x54')]['id']}})[_0x35ec('0x21')](handleEntityNotFound(_0x4a2100,null))[_0x35ec('0x21')](function(_0x4ecfee){if(_0x4ecfee){_0x12b5fa=_0x4ecfee;return db['SmsAccount'][_0x35ec('0x57')]({'where':{'id':_0x4ecfee[_0x35ec('0x86')]}});}})[_0x35ec('0x21')](handleEntityNotFound(_0x4a2100,null))[_0x35ec('0x21')](function(_0x29ae19){if(_0x29ae19){logger[_0x35ec('0x24')](_0x35ec('0x25'),'status','received\x20delivery\x20report\x20from',_0x29ae19['type'],util['inspect'](_0x3632e1[_0x35ec('0x59')],{'showHidden':![],'depth':null}));switch(_0x29ae19['type']){case _0x35ec('0x87'):if(_0x3632e1['body']['MessageSid']&&_0x3632e1[_0x35ec('0x59')][_0x35ec('0x88')]===_0x12b5fa[_0x35ec('0x89')]){return _0x12b5fa[_0x35ec('0x36')]({'read':!![]});}else{logger[_0x35ec('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x35ec('0x2d'),_0x35ec('0x87'),util['inspect'](_0x3632e1[_0x35ec('0x59')],{'showHidden':![],'depth':null}));}break;case _0x35ec('0x8a'):if(_0x3632e1[_0x35ec('0x59')]['MessageUUID']&&_0x3632e1[_0x35ec('0x59')][_0x35ec('0x8b')]===_0x12b5fa[_0x35ec('0x89')]&&_[_0x35ec('0x8c')](['sent',_0x35ec('0x8d')],_0x3632e1[_0x35ec('0x59')][_0x35ec('0x8e')])>=0x0){return _0x12b5fa[_0x35ec('0x36')]({'read':!![]});}else{logger[_0x35ec('0x28')](_0x35ec('0x8f'),_0x35ec('0x2d'),'plivio',util['inspect'](_0x3632e1['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x49ae71=_0x3632e1[_0x35ec('0x59')][_0x35ec('0x90')][0x0];if(_0x49ae71[_0x35ec('0x2d')][_0x35ec('0x91')]===_0x35ec('0x92')){return _0x12b5fa[_0x35ec('0x36')]({'read':!![]});}else{logger[_0x35ec('0x28')](_0x35ec('0x8f'),_0x35ec('0x2d'),_0x35ec('0x93'),util[_0x35ec('0x94')](_0x3632e1['body'],{'showHidden':![],'depth':null}));}break;}return _0x12b5fa;}})[_0x35ec('0x21')](respondWithResult(_0x4a2100,null))['catch'](handleError(_0x4a2100,null));}; \ No newline at end of file +var _0x8277=['body','find','params','destroy','describe','sms-interactions','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','sequelize','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','internal','motionChannel','SmsAccount','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','sent','delivered','Status','infobip','results','groupName','DELIVERED','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','stack','name','send','map','SmsMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','create'];(function(_0x18ce30,_0x437d06){var _0x4471a3=function(_0x403a4a){while(--_0x403a4a){_0x18ce30['push'](_0x18ce30['shift']());}};_0x4471a3(++_0x437d06);}(_0x8277,0xcf));var _0x7827=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x8277[_0xfc0976];return _0x23579f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7827('0x0'));var zipdir=require(_0x7827('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7827('0x2'));var moment=require(_0x7827('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7827('0x4'));var util=require(_0x7827('0x5'));var path=require('path');var sox=require(_0x7827('0x6'));var csv=require(_0x7827('0x7'));var ejs=require(_0x7827('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7827('0x9'));var squel=require(_0x7827('0xa'));var crypto=require(_0x7827('0xb'));var jsforce=require(_0x7827('0xc'));var deskjs=require(_0x7827('0xd'));var toCsv=require(_0x7827('0x7'));var querystring=require(_0x7827('0xe'));var Papa=require(_0x7827('0xf'));var Redis=require(_0x7827('0x10'));var authService=require(_0x7827('0x11'));var qs=require(_0x7827('0x12'));var as=require(_0x7827('0x13'));var hardwareService=require(_0x7827('0x14'));var logger=require(_0x7827('0x15'))('api');var utils=require(_0x7827('0x16'));var config=require(_0x7827('0x17'));var licenseUtil=require(_0x7827('0x18'));var db=require(_0x7827('0x19'))['db'];config['redis']=_[_0x7827('0x1a')](config[_0x7827('0x1b')],{'host':_0x7827('0x1c'),'port':0x18eb});var socket=require(_0x7827('0x1d'))(new Redis(config[_0x7827('0x1b')]));require(_0x7827('0x1e'))[_0x7827('0x1f')](socket);var jayson=require(_0x7827('0x20'));var client=jayson[_0x7827('0x21')][_0x7827('0x22')]({'port':0x232c});var client9002=jayson[_0x7827('0x21')][_0x7827('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2fe484,_0x85c389,_0x2055f6,_0x5143e4){return new BPromise(function(_0x3767f0,_0x1e7ca4){var _0x19be26=_0x5143e4||client;return _0x19be26[_0x7827('0x23')](_0x2fe484,_0x2055f6)[_0x7827('0x24')](function(_0x2e001d){logger[_0x7827('0x25')](_0x7827('0x26'),_0x85c389,'request\x20sent');logger[_0x7827('0x27')](_0x7827('0x28'),_0x85c389,_0x7827('0x29'),JSON[_0x7827('0x2a')](_0x2e001d));if(_0x2e001d[_0x7827('0x2b')]){if(_0x2e001d[_0x7827('0x2b')][_0x7827('0x2c')]===0x1f4){logger['error'](_0x7827('0x26'),_0x85c389,_0x2e001d['error'][_0x7827('0x2d')]);return _0x1e7ca4(_0x2e001d[_0x7827('0x2b')][_0x7827('0x2d')]);}logger[_0x7827('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x85c389,_0x2e001d[_0x7827('0x2b')][_0x7827('0x2d')]);return _0x3767f0(_0x2e001d[_0x7827('0x2b')]['message']);}else{logger[_0x7827('0x25')]('SmsMessage,\x20%s,\x20%s',_0x85c389,_0x7827('0x29'));_0x3767f0(_0x2e001d['result'][_0x7827('0x2d')]);}})[_0x7827('0x2e')](function(_0x2745e4){logger[_0x7827('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x85c389,_0x2745e4);_0x1e7ca4(_0x2745e4);});});}function respondWithStatusCode(_0x26ba79,_0x4b2a0d){_0x4b2a0d=_0x4b2a0d||0xcc;return function(_0x3ec12e){if(_0x3ec12e){return _0x26ba79[_0x7827('0x2f')](_0x4b2a0d);}return _0x26ba79[_0x7827('0x30')](_0x4b2a0d)[_0x7827('0x31')]();};}function respondWithResult(_0x3b3f8a,_0x1dd67f){_0x1dd67f=_0x1dd67f||0xc8;return function(_0x32ba3c){if(_0x32ba3c){return _0x3b3f8a[_0x7827('0x30')](_0x1dd67f)[_0x7827('0x32')](_0x32ba3c);}};}function respondWithFilteredResult(_0x4b25ba,_0x21b502){return function(_0x301b31){if(_0x301b31){var _0x25415b=typeof _0x21b502[_0x7827('0x33')]===_0x7827('0x34')&&typeof _0x21b502[_0x7827('0x35')]===_0x7827('0x34');var _0x4549f8=_0x301b31[_0x7827('0x36')];var _0x49cc2a=_0x25415b?0x0:_0x21b502['offset'];var _0xd88452=_0x25415b?_0x301b31['count']:_0x21b502[_0x7827('0x33')]+_0x21b502[_0x7827('0x35')];var _0x524609;if(_0xd88452>=_0x4549f8){_0xd88452=_0x4549f8;_0x524609=0xc8;}else{_0x524609=0xce;}_0x4b25ba[_0x7827('0x30')](_0x524609);return _0x4b25ba[_0x7827('0x37')](_0x7827('0x38'),_0x49cc2a+'-'+_0xd88452+'/'+_0x4549f8)['json'](_0x301b31);}return null;};}function patchUpdates(_0x2d9849){return function(_0x5257b0){try{jsonpatch[_0x7827('0x39')](_0x5257b0,_0x2d9849,!![]);}catch(_0x1b075f){return BPromise['reject'](_0x1b075f);}return _0x5257b0[_0x7827('0x3a')]();};}function saveUpdates(_0x567b0b,_0x10f3b8){return function(_0x4cb66a){if(_0x4cb66a){return _0x4cb66a[_0x7827('0x3b')](_0x567b0b)[_0x7827('0x24')](function(_0x2fb8a6){return _0x2fb8a6;});}return null;};}function removeEntity(_0x2ce05e,_0x1f1d02){return function(_0x4ce5c0){if(_0x4ce5c0){return _0x4ce5c0['destroy']()[_0x7827('0x24')](function(){_0x2ce05e['status'](0xcc)[_0x7827('0x31')]();});}};}function handleEntityNotFound(_0x536ea2,_0x30e16b){return function(_0x259879){if(!_0x259879){_0x536ea2['sendStatus'](0x194);}return _0x259879;};}function handleError(_0x454113,_0x9a9adf){_0x9a9adf=_0x9a9adf||0x1f4;return function(_0xe029e1){logger['error'](_0xe029e1[_0x7827('0x3c')]);if(_0xe029e1[_0x7827('0x3d')]){delete _0xe029e1[_0x7827('0x3d')];}_0x454113[_0x7827('0x30')](_0x9a9adf)[_0x7827('0x3e')](_0xe029e1);};}exports['index']=function(_0x95fcb,_0x4ff709){var _0x844332={},_0xf5dd31={},_0x2c78ce={'count':0x0,'rows':[]};var _0x54e35c=_[_0x7827('0x3f')](db[_0x7827('0x40')][_0x7827('0x41')],function(_0x4624af){return{'name':_0x4624af['fieldName'],'type':_0x4624af[_0x7827('0x42')][_0x7827('0x43')]};});_0xf5dd31[_0x7827('0x44')]=_['map'](_0x54e35c,'name');_0xf5dd31[_0x7827('0x45')]=_[_0x7827('0x46')](_0x95fcb['query']);_0xf5dd31[_0x7827('0x47')]=_['intersection'](_0xf5dd31['model'],_0xf5dd31[_0x7827('0x45')]);_0x844332[_0x7827('0x48')]=_[_0x7827('0x49')](_0xf5dd31[_0x7827('0x44')],qs['fields'](_0x95fcb[_0x7827('0x45')][_0x7827('0x4a')]));_0x844332[_0x7827('0x48')]=_0x844332[_0x7827('0x48')][_0x7827('0x4b')]?_0x844332[_0x7827('0x48')]:_0xf5dd31[_0x7827('0x44')];if(!_0x95fcb[_0x7827('0x45')]['hasOwnProperty'](_0x7827('0x4c'))){_0x844332['limit']=qs[_0x7827('0x35')](_0x95fcb[_0x7827('0x45')][_0x7827('0x35')]);_0x844332[_0x7827('0x33')]=qs[_0x7827('0x33')](_0x95fcb[_0x7827('0x45')][_0x7827('0x33')]);}_0x844332[_0x7827('0x4d')]=qs[_0x7827('0x4e')](_0x95fcb[_0x7827('0x45')][_0x7827('0x4e')]);_0x844332[_0x7827('0x4f')]=qs[_0x7827('0x47')](_[_0x7827('0x50')](_0x95fcb[_0x7827('0x45')],_0xf5dd31[_0x7827('0x47')]),_0x54e35c);if(_0x95fcb[_0x7827('0x45')][_0x7827('0x51')]){_0x844332[_0x7827('0x4f')]=_['merge'](_0x844332['where'],{'$or':_[_0x7827('0x3f')](_0x54e35c,function(_0x538949){if(_0x538949[_0x7827('0x42')]!==_0x7827('0x52')){var _0x2ad872={};_0x2ad872[_0x538949['name']]={'$like':'%'+_0x95fcb[_0x7827('0x45')][_0x7827('0x51')]+'%'};return _0x2ad872;}})});}_0x844332=_[_0x7827('0x53')]({},_0x844332,_0x95fcb[_0x7827('0x54')]);var _0x2e0e8f={'where':_0x844332[_0x7827('0x4f')]};return db[_0x7827('0x40')][_0x7827('0x36')](_0x2e0e8f)[_0x7827('0x24')](function(_0x4f7f1e){_0x2c78ce[_0x7827('0x36')]=_0x4f7f1e;if(_0x95fcb[_0x7827('0x45')][_0x7827('0x55')]){_0x844332[_0x7827('0x56')]=[{'all':!![]}];}return db[_0x7827('0x40')][_0x7827('0x57')](_0x844332);})[_0x7827('0x24')](function(_0x4afa51){_0x2c78ce[_0x7827('0x58')]=_0x4afa51;return _0x2c78ce;})[_0x7827('0x24')](respondWithFilteredResult(_0x4ff709,_0x844332))[_0x7827('0x2e')](handleError(_0x4ff709,null));};exports[_0x7827('0x59')]=function(_0x137029,_0x1e1542){var _0x777c87={'raw':!![],'where':{'id':_0x137029['params']['id']}},_0x48ef30={};_0x48ef30['model']=_[_0x7827('0x46')](db[_0x7827('0x40')]['rawAttributes']);_0x48ef30[_0x7827('0x45')]=_['keys'](_0x137029['query']);_0x48ef30[_0x7827('0x47')]=_['intersection'](_0x48ef30[_0x7827('0x44')],_0x48ef30[_0x7827('0x45')]);_0x777c87[_0x7827('0x48')]=_[_0x7827('0x49')](_0x48ef30['model'],qs[_0x7827('0x4a')](_0x137029[_0x7827('0x45')][_0x7827('0x4a')]));_0x777c87[_0x7827('0x48')]=_0x777c87[_0x7827('0x48')][_0x7827('0x4b')]?_0x777c87[_0x7827('0x48')]:_0x48ef30[_0x7827('0x44')];if(_0x137029[_0x7827('0x45')]['includeAll']){_0x777c87[_0x7827('0x56')]=[{'all':!![]}];}_0x777c87=_['merge']({},_0x777c87,_0x137029[_0x7827('0x54')]);return db[_0x7827('0x40')]['find'](_0x777c87)['then'](handleEntityNotFound(_0x1e1542,null))['then'](respondWithResult(_0x1e1542,null))['catch'](handleError(_0x1e1542,null));};exports[_0x7827('0x5a')]=function(_0x3bfa07,_0x14ff5a){return db[_0x7827('0x40')][_0x7827('0x5a')](_0x3bfa07[_0x7827('0x5b')],{})[_0x7827('0x24')](respondWithResult(_0x14ff5a,0xc9))[_0x7827('0x2e')](handleError(_0x14ff5a,null));};exports[_0x7827('0x3b')]=function(_0x20882b,_0xc1bbc9){if(_0x20882b[_0x7827('0x5b')]['id']){delete _0x20882b[_0x7827('0x5b')]['id'];}return db[_0x7827('0x40')][_0x7827('0x5c')]({'where':{'id':_0x20882b[_0x7827('0x5d')]['id']}})['then'](handleEntityNotFound(_0xc1bbc9,null))[_0x7827('0x24')](saveUpdates(_0x20882b[_0x7827('0x5b')],null))[_0x7827('0x24')](respondWithResult(_0xc1bbc9,null))[_0x7827('0x2e')](handleError(_0xc1bbc9,null));};exports[_0x7827('0x5e')]=function(_0x6800f1,_0x259cb0){return db['SmsMessage']['find']({'where':{'id':_0x6800f1[_0x7827('0x5d')]['id']}})[_0x7827('0x24')](handleEntityNotFound(_0x259cb0,null))['then'](removeEntity(_0x259cb0,null))[_0x7827('0x2e')](handleError(_0x259cb0,null));};exports[_0x7827('0x5f')]=function(_0x2f4425,_0x736142){return db[_0x7827('0x40')][_0x7827('0x5f')]()['then'](respondWithResult(_0x736142,null))['catch'](handleError(_0x736142,null));};var interaction_log=require('../../config/logger')(_0x7827('0x60'));exports['accept']=function(_0x5f4e7e,_0x420f7e,_0x1394f9){var _0x37835c={'agent':{},'channel':'sms'};if(_0x5f4e7e[_0x7827('0x5b')]['id']){delete _0x5f4e7e['body']['id'];}_0x5f4e7e[_0x7827('0x5b')]['read']=!![];_0x5f4e7e[_0x7827('0x5b')]['readAt']=moment()[_0x7827('0x61')](_0x7827('0x62'));_0x5f4e7e[_0x7827('0x5b')][_0x7827('0x63')]=_0x5f4e7e[_0x7827('0x5b')][_0x7827('0x63')]||_0x5f4e7e[_0x7827('0x64')]['id'];_0x37835c[_0x7827('0x65')]['id']=_0x5f4e7e[_0x7827('0x5b')]['UserId'];return db['SmsMessage'][_0x7827('0x5c')]({'where':{'id':_0x5f4e7e[_0x7827('0x5d')]['id'],'UserId':null}})[_0x7827('0x24')](handleEntityNotFound(_0x420f7e,null))[_0x7827('0x24')](saveUpdates(_0x5f4e7e[_0x7827('0x5b')],null))[_0x7827('0x24')](function(_0x155998){if(_0x155998){_0x37835c[_0x7827('0x2d')]=_0x155998[_0x7827('0x66')]({'plain':!![]});return db[_0x7827('0x67')][_0x7827('0x5c')]({'where':{'id':_0x155998[_0x7827('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x420f7e,null))[_0x7827('0x24')](function(_0x17f449){if(_0x17f449){return _0x17f449[_0x7827('0x3b')]({'UserId':_0x5f4e7e[_0x7827('0x5b')][_0x7827('0x63')],'read1stAt':_[_0x7827('0x69')](_0x17f449['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7827('0x24')](function(_0x4b409a){if(_0x4b409a){_0x37835c[_0x7827('0x6a')]=_0x4b409a['get']({'plain':!![]});interaction_log['info'](_0x7827('0x6b'),_0x5f4e7e[_0x7827('0x64')]['id'],_0x5f4e7e['user']['name'],_0x5f4e7e[_0x7827('0x64')][_0x7827('0x6c')],_0x37835c['interaction']['id'],_0x5f4e7e[_0x7827('0x5b')]?JSON[_0x7827('0x2a')](_0x5f4e7e[_0x7827('0x5b')]):_0x7827('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x7827('0x6e'),_0x37835c);}return null;})['then'](function(_0x1c42eb){var _0x3cef3c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c42eb[_0x7827('0x2d')]['ContactId'];return db[_0x7827('0x6f')][_0x7827('0x45')](_0x3cef3c,{'type':db[_0x7827('0x70')]['QueryTypes'][_0x7827('0x71')],'raw':!![]})[_0x7827('0x24')](function(_0x3072fd){return _0x3072fd;});})[_0x7827('0x24')](function(_0x511680){if(_0x511680){_0x37835c[_0x7827('0x2d')][_0x7827('0x72')]=_0x511680[0x0];if(!_0x5f4e7e['body'][_0x7827('0x63')])return;return db[_0x7827('0x73')][_0x7827('0x5c')]({'where':{'id':_0x5f4e7e[_0x7827('0x5b')][_0x7827('0x63')],'role':'agent'},'attributes':['id',_0x7827('0x3d'),_0x7827('0x74'),_0x7827('0x75'),'internal'],'raw':!![]});}return null;})[_0x7827('0x24')](function(_0x59abf1){if(!_0x59abf1)return null;_0x37835c['message']['agent']=_0x59abf1;return _0x37835c;})[_0x7827('0x24')](function(_0x30e106){if(_0x30e106){if(_0x5f4e7e[_0x7827('0x5b')][_0x7827('0x76')]){_0x37835c[_0x7827('0x2d')][_0x7827('0x77')]=util['format'](_0x7827('0x78'),_0x5f4e7e[_0x7827('0x64')][_0x7827('0x3d')]);_0x37835c[_0x7827('0x2d')][_0x7827('0x79')]=_0x37835c[_0x7827('0x79')];_0x37835c[_0x7827('0x2d')]['motionChannel']=_0x37835c[_0x7827('0x79')];_0x37835c[_0x7827('0x2d')]['event']='accept';return respondWithRpcPromise(_0x7827('0x7a'),_0x7827('0x7a'),{'event':_0x7827('0x7b'),'message':_0x37835c[_0x7827('0x2d')]},client9002)[_0x7827('0x24')](function(){return _0x37835c;});}return _0x37835c;}return null;})[_0x7827('0x24')](respondWithResult(_0x420f7e,null))['catch'](handleError(_0x420f7e,null));};var interaction_log=require(_0x7827('0x15'))(_0x7827('0x60'));exports[_0x7827('0x7c')]=function(_0x215f41,_0xbcc9b1,_0xf99b5){var _0x3f8d89={'agent':{},'channel':_0x7827('0x7d')};if(_0x215f41[_0x7827('0x5b')]['id']){delete _0x215f41['body']['id'];}_0x215f41[_0x7827('0x5b')]['UserId']=_0x215f41[_0x7827('0x5b')][_0x7827('0x63')]||_0x215f41['user']['id'];_0x3f8d89[_0x7827('0x65')]['id']=_0x215f41['body'][_0x7827('0x63')];return db['SmsMessage'][_0x7827('0x5c')]({'where':{'id':_0x215f41['params']['id'],'UserId':null}})[_0x7827('0x24')](handleEntityNotFound(_0xbcc9b1,null))[_0x7827('0x24')](function(_0x1c0b1f){if(_0x1c0b1f){_0x3f8d89['message']=_0x1c0b1f[_0x7827('0x66')]({'plain':!![]});return db[_0x7827('0x67')][_0x7827('0x5c')]({'where':{'id':_0x1c0b1f[_0x7827('0x68')]}});}return null;})[_0x7827('0x24')](handleEntityNotFound(_0xbcc9b1,null))[_0x7827('0x24')](function(_0x2197d3){if(_0x2197d3){_0x3f8d89[_0x7827('0x6a')]=_0x2197d3['get']({'plain':!![]});interaction_log[_0x7827('0x25')](_0x7827('0x7e'),_0x215f41[_0x7827('0x64')]['id'],_0x215f41[_0x7827('0x64')][_0x7827('0x3d')],_0x215f41[_0x7827('0x64')][_0x7827('0x6c')],_0x3f8d89['interaction']['id'],_0x215f41[_0x7827('0x5b')]?JSON[_0x7827('0x2a')](_0x215f41[_0x7827('0x5b')]):_0x7827('0x6d'));return respondWithRpcPromise(_0x7827('0x7f'),_0x7827('0x80'),_0x3f8d89);}return null;})['then'](function(_0x643f90){var _0x1c1307=_0x7827('0x81')+_0x643f90[_0x7827('0x2d')][_0x7827('0x82')];return db[_0x7827('0x6f')][_0x7827('0x45')](_0x1c1307,{'type':db[_0x7827('0x70')][_0x7827('0x83')][_0x7827('0x71')],'raw':!![]})[_0x7827('0x24')](function(_0xbb51a5){return _0xbb51a5;});})['then'](function(_0x61054e){if(_0x61054e){_0x3f8d89[_0x7827('0x2d')][_0x7827('0x72')]=_0x61054e[0x0];if(!_0x215f41[_0x7827('0x5b')]['UserId'])return;return db[_0x7827('0x73')][_0x7827('0x5c')]({'where':{'id':_0x215f41['body'][_0x7827('0x63')],'role':_0x7827('0x65')},'attributes':['id',_0x7827('0x3d'),_0x7827('0x74'),'email',_0x7827('0x84')],'raw':!![]});}return null;})[_0x7827('0x24')](function(_0x599c3f){if(!_0x599c3f)return null;_0x3f8d89[_0x7827('0x2d')][_0x7827('0x65')]=_0x599c3f;return _0x3f8d89;})['then'](function(_0x209103){if(_0x209103){_0x209103[_0x7827('0x2d')][_0x7827('0x77')]=util[_0x7827('0x61')](_0x7827('0x78'),_0x215f41[_0x7827('0x64')]['name']);_0x209103['message'][_0x7827('0x79')]=_0x3f8d89[_0x7827('0x79')];_0x209103[_0x7827('0x2d')][_0x7827('0x85')]=_0x3f8d89[_0x7827('0x79')];_0x209103[_0x7827('0x2d')]['event']=_0x7827('0x7c');respondWithRpcPromise(_0x7827('0x7a'),_0x7827('0x7a'),{'event':'rejectmessage','message':_0x209103[_0x7827('0x2d')]},client9002);return _0x3f8d89;}return null;})[_0x7827('0x24')](respondWithResult(_0xbcc9b1,null))[_0x7827('0x2e')](handleError(_0xbcc9b1,null));};exports[_0x7827('0x30')]=function(_0x253fbf,_0xc143,_0x10bb44){if(_0x253fbf['body']['id']){delete _0x253fbf['body']['id'];}var _0x3fb405;return db[_0x7827('0x40')][_0x7827('0x5c')]({'where':{'id':_0x253fbf[_0x7827('0x5d')]['id']}})['then'](handleEntityNotFound(_0xc143,null))['then'](function(_0x17fc62){if(_0x17fc62){_0x3fb405=_0x17fc62;return db[_0x7827('0x86')][_0x7827('0x5c')]({'where':{'id':_0x17fc62['SmsAccountId']}});}})[_0x7827('0x24')](handleEntityNotFound(_0xc143,null))['then'](function(_0x56d740){if(_0x56d740){logger['debug'](_0x7827('0x28'),_0x7827('0x30'),'received\x20delivery\x20report\x20from',_0x56d740[_0x7827('0x42')],util['inspect'](_0x253fbf[_0x7827('0x5b')],{'showHidden':![],'depth':null}));switch(_0x56d740['type']){case _0x7827('0x87'):if(_0x253fbf[_0x7827('0x5b')][_0x7827('0x88')]&&_0x253fbf['body'][_0x7827('0x88')]===_0x3fb405[_0x7827('0x89')]){return _0x3fb405[_0x7827('0x3b')]({'read':!![]});}else{logger[_0x7827('0x2b')](_0x7827('0x8a'),_0x7827('0x30'),'twilio',util[_0x7827('0x8b')](_0x253fbf['body'],{'showHidden':![],'depth':null}));}break;case _0x7827('0x8c'):if(_0x253fbf[_0x7827('0x5b')]['MessageUUID']&&_0x253fbf[_0x7827('0x5b')][_0x7827('0x8d')]===_0x3fb405[_0x7827('0x89')]&&_['indexOf']([_0x7827('0x8e'),_0x7827('0x8f')],_0x253fbf[_0x7827('0x5b')][_0x7827('0x90')])>=0x0){return _0x3fb405[_0x7827('0x3b')]({'read':!![]});}else{logger[_0x7827('0x2b')](_0x7827('0x8a'),_0x7827('0x30'),'plivio',util[_0x7827('0x8b')](_0x253fbf['body'],{'showHidden':![],'depth':null}));}break;case _0x7827('0x91'):var _0x5ced48=_0x253fbf[_0x7827('0x5b')][_0x7827('0x92')][0x0];if(_0x5ced48['status'][_0x7827('0x93')]===_0x7827('0x94')){return _0x3fb405['update']({'read':!![]});}else{logger[_0x7827('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7827('0x91'),util[_0x7827('0x8b')](_0x253fbf[_0x7827('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3fb405;}})['then'](respondWithResult(_0xc143,null))[_0x7827('0x2e')](handleError(_0xc143,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 03226ed..b771335 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 _0xd23b=['update','remove','emit','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x387d11,_0x159b02){var _0x2a8337=function(_0x4e3d69){while(--_0x4e3d69){_0x387d11['push'](_0x387d11['shift']());}};_0x2a8337(++_0x159b02);}(_0xd23b,0xaf));var _0xbd23=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0xd23b[_0x4667b2];return _0x1070f2;};'use strict';var EventEmitter=require(_0xbd23('0x0'));var SmsMessage=require(_0xbd23('0x1'))['db'][_0xbd23('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xbd23('0x3')](0x0);var events={'afterCreate':_0xbd23('0x4'),'afterUpdate':_0xbd23('0x5'),'afterDestroy':_0xbd23('0x6')};function emitEvent(_0x3f4b62){return function(_0x1ae366,_0x99198,_0x199a12){SmsMessageEvents[_0xbd23('0x7')](_0x3f4b62+':'+_0x1ae366['id'],_0x1ae366);SmsMessageEvents[_0xbd23('0x7')](_0x3f4b62,_0x1ae366);_0x199a12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xbd23('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x7da7=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x7da7,0x192));var _0x77da=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x7da7[_0x43c8b8];return _0x413be3;};'use strict';var EventEmitter=require(_0x77da('0x0'));var SmsMessage=require(_0x77da('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x77da('0x2')](0x0);var events={'afterCreate':_0x77da('0x3'),'afterUpdate':_0x77da('0x4'),'afterDestroy':_0x77da('0x5')};function emitEvent(_0x39310e){return function(_0x1a235e,_0x532e40,_0x1d0e92){SmsMessageEvents['emit'](_0x39310e+':'+_0x1a235e['id'],_0x1a235e);SmsMessageEvents[_0x77da('0x6')](_0x39310e,_0x1a235e);_0x1d0e92(null);};}for(var e in events){if(events[_0x77da('0x7')](e)){var event=events[e];SmsMessage[_0x77da('0x8')](e,emitEvent(event));}}module[_0x77da('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index badf4b0..30a7622 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 _0x2f9e=['length','apiKey','createHash','md5','hex','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','username','&password=','password','GET','sms','POST','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','text','timestamp','keys'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x2f9e,0x1ed));var _0xe2f9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2f9e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe2f9('0x0'));var util=require(_0xe2f9('0x1'));var logger=require(_0xe2f9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe2f9('0x3'));var rp=require(_0xe2f9('0x4'));var fs=require('fs');var path=require(_0xe2f9('0x5'));var rimraf=require(_0xe2f9('0x6'));var config=require('../../config/environment');var attributes=require(_0xe2f9('0x7'));module[_0xe2f9('0x8')]=function(_0x4e4215,_0x1d7794){return _0x4e4215[_0xe2f9('0x9')](_0xe2f9('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xe2f9('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xe2f9('0xc')],'type':_0xe2f9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xde2f56,_0x4b9ef4,_0x4483c6){var _0x1ec733=_0x4e4215[_0xe2f9('0xe')];var _0x5eebcc=_0xde2f56[_0xe2f9('0xf')]({'plain':!![]});if(_0x5eebcc[_0xe2f9('0x10')][_0xe2f9('0x11')]()==='in'||_0x5eebcc['direction'][_0xe2f9('0x11')]()===_0xe2f9('0x12')&&!_0x5eebcc[_0xe2f9('0x13')]&&!_['isNil'](_0x5eebcc['UserId'])&&!_[_0xe2f9('0x14')](_0x5eebcc[_0xe2f9('0x15')])){_0x1ec733[_0xe2f9('0x16')]['findOne']({'where':{'id':_0x5eebcc[_0xe2f9('0x15')]}})[_0xe2f9('0x17')](function(_0xb07e45){if(_0xb07e45){_0xb07e45[_0xe2f9('0x18')]({'lastMsgAt':_0x5eebcc[_0xe2f9('0x19')],'lastMsgDirection':_0x5eebcc[_0xe2f9('0x10')]['toLowerCase']()});}})[_0xe2f9('0x1a')](function(_0x27eed1){console[_0xe2f9('0x1b')](_0x27eed1);});}if(_0x5eebcc[_0xe2f9('0x10')]==='out'&&!_0x5eebcc[_0xe2f9('0x13')]){var _0x41cb6e;_0x1ec733[_0xe2f9('0x1c')]['find']({'where':{'id':_0x5eebcc[_0xe2f9('0x1d')]},'raw':!![]})[_0xe2f9('0x17')](function(_0x16c7a6){_0x41cb6e=_0x16c7a6;if(_0x41cb6e&&_0x41cb6e[_0xe2f9('0x1e')]){switch(_0x41cb6e[_0xe2f9('0x1e')]){case _0xe2f9('0x1f'):var _0x1d8714=require(_0xe2f9('0x1f'));if(_0x41cb6e[_0xe2f9('0x20')]&&_0x41cb6e['authToken']&&_0x41cb6e['phone']){var _0x538f8=new _0x1d8714(_0x41cb6e[_0xe2f9('0x20')],_0x41cb6e[_0xe2f9('0x21')]);_0x538f8[_0xe2f9('0x22')][_0xe2f9('0x23')]({'body':_0x5eebcc['body'],'to':_0x5eebcc[_0xe2f9('0x24')],'from':_0x41cb6e[_0xe2f9('0x24')],'statusCallback':_0x41cb6e[_0xe2f9('0x25')]+_0xe2f9('0x26')+_0x5eebcc['id']+_0xe2f9('0x27')+_0x41cb6e[_0xe2f9('0x28')]})['then'](function(_0x7df25e){if(_0x7df25e[_0xe2f9('0x29')]){return _0xde2f56[_0xe2f9('0x18')]({'messageId':_0x7df25e[_0xe2f9('0x29')]});}})['catch'](function(_0x2cf5f7){logger['error'](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x1f'),util['inspect'](_0x2cf5f7,{'showHidden':![],'depth':null}));});}else{logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe2f9('0x2c'):var _0x216bb3=_0xe2f9('0x2d');if(_0x41cb6e['username']&&_0x41cb6e['password']){var _0x3242dc={'recipient':[_0x5eebcc[_0xe2f9('0x24')]],'message':_0x5eebcc['body'],'message_type':_0x41cb6e['smsMethod']};if(_0x41cb6e[_0xe2f9('0x2e')]&&_0x41cb6e['smsMethod']!=='SI'){_0x3242dc[_0xe2f9('0x2f')]=_0x41cb6e[_0xe2f9('0x24')];}var _0xde6a43={'url':_0x216bb3+'login?username='+_0x41cb6e[_0xe2f9('0x30')]+_0xe2f9('0x31')+_0x41cb6e[_0xe2f9('0x32')],'method':_0xe2f9('0x33')};rp(_0xde6a43)[_0xe2f9('0x17')](function(_0x33a237){var _0x5b81b3=_0x33a237['split'](';');var _0x16bc78={'user_key':_0x5b81b3[0x0],'session_key':_0x5b81b3[0x1]};_0xde6a43={'url':_0x216bb3+_0xe2f9('0x34'),'method':_0xe2f9('0x35'),'headers':{'user_key':_0x16bc78['user_key'],'Session_key':_0x16bc78['session_key']},'json':!![],'body':_0x3242dc};return rp(_0xde6a43);})[_0xe2f9('0x17')](function(_0x598c1c){if(_0x598c1c[_0xe2f9('0x36')]>=0x1){var _0x4a9a12={'messageId':_0x598c1c[_0xe2f9('0x37')]};if(_0x41cb6e[_0xe2f9('0x2e')]!=='GP'||!_0x41cb6e[_0xe2f9('0x38')]){_0x4a9a12[_0xe2f9('0x39')]=!![];}return _0xde2f56[_0xe2f9('0x18')](_0x4a9a12);}else{return logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x2c'),util[_0xe2f9('0x3a')](_0x598c1c,{'showHidden':![],'depth':null}));}})[_0xe2f9('0x1a')](function(_0x3302fd){return logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x2c'),util[_0xe2f9('0x3a')](_0x3302fd,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe2f9('0x2c'),_0xe2f9('0x3b'));}break;case _0xe2f9('0x3c'):if(_0x41cb6e[_0xe2f9('0x21')]){var _0x29eb1f={'recipient':_0x5eebcc[_0xe2f9('0x24')],'message':_0x5eebcc[_0xe2f9('0xc')],'sender':_0x41cb6e[_0xe2f9('0x3d')]||_0x41cb6e[_0xe2f9('0x24')],'authorization':_0x41cb6e[_0xe2f9('0x21')]};var _0x4b9ef4={'method':_0xe2f9('0x35'),'uri':_0xe2f9('0x3e'),'body':_0x29eb1f,'json':!![]};rp(_0x4b9ef4)[_0xe2f9('0x17')](function(_0x565a48){var _0x1c0220={'messageId':_0x565a48['requestid']};if(!_0x41cb6e['deliveryReport']){_0x1c0220[_0xe2f9('0x39')]=!![];}return _0xde2f56[_0xe2f9('0x18')](_0x1c0220);})[_0xe2f9('0x1a')](function(_0x558a6f){logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),'connectel',util[_0xe2f9('0x3a')](_0x558a6f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x3c'),_0xe2f9('0x3f'));}break;case _0xe2f9('0x40'):if(_0x41cb6e[_0xe2f9('0x30')]&&_0x41cb6e['password']){var _0x29eb1f={'messages':[{'source':_0xe2f9('0x41'),'to':_0x5eebcc[_0xe2f9('0x24')],'body':_0x5eebcc[_0xe2f9('0xc')],'from':_0x41cb6e['senderString']||_0x41cb6e[_0xe2f9('0x24')]}]};var _0x1efa4c=util[_0xe2f9('0x42')](_0xe2f9('0x43'),_0x41cb6e[_0xe2f9('0x30')],_0x41cb6e[_0xe2f9('0x32')]);var _0x4b9ef4={'method':_0xe2f9('0x35'),'uri':_0xe2f9('0x44'),'body':_0x29eb1f,'headers':{'Authorization':util[_0xe2f9('0x42')](_0xe2f9('0x45'),new Buffer(_0x1efa4c)[_0xe2f9('0x46')](_0xe2f9('0x47')))},'json':!![]};rp(_0x4b9ef4)['then'](function(_0x16eac1){if(_0x16eac1['http_code']>=0xc8&&_0x16eac1[_0xe2f9('0x48')]<=0xce){if(_0x16eac1[_0xe2f9('0x49')]&&_0x16eac1[_0xe2f9('0x49')][_0xe2f9('0x4a')]>0x0){var _0x231d5a=_[_0xe2f9('0x4b')](_0x16eac1[_0xe2f9('0x49')][_0xe2f9('0x22')]);var _0x347ea6={'messageId':_0x231d5a[_0xe2f9('0x4c')]};if(!_0x41cb6e[_0xe2f9('0x38')]){_0x347ea6[_0xe2f9('0x39')]=!![];}return _0xde2f56[_0xe2f9('0x18')](_0x347ea6);}else{logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x4d'),util['inspect'](_0x16eac1,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe2f9('0x2b'),_0xe2f9('0x4d'),util[_0xe2f9('0x3a')](_0x16eac1,{'showHidden':![],'depth':null}));}})[_0xe2f9('0x1a')](function(_0x20201a){logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x4d'),util[_0xe2f9('0x3a')](_0x20201a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe2f9('0x2b'),_0xe2f9('0x4d'),_0xe2f9('0x3b'));}break;case _0xe2f9('0x4e'):if(_0x41cb6e['authId']&&_0x41cb6e[_0xe2f9('0x21')]){var _0x29eb1f={'dst':_0x5eebcc[_0xe2f9('0x24')],'text':_0x5eebcc[_0xe2f9('0xc')],'src':_0x41cb6e['senderString']||_0x41cb6e[_0xe2f9('0x24')],'url':_0x41cb6e[_0xe2f9('0x25')]+_0xe2f9('0x26')+_0x5eebcc['id']+'/status?token='+_0x41cb6e[_0xe2f9('0x28')]};var _0x1efa4c=util['format'](_0xe2f9('0x43'),_0x41cb6e[_0xe2f9('0x4f')],_0x41cb6e['authToken']);var _0x4b9ef4={'method':_0xe2f9('0x35'),'uri':util[_0xe2f9('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x41cb6e[_0xe2f9('0x4f')]),'body':_0x29eb1f,'headers':{'Authorization':util[_0xe2f9('0x42')]('Basic\x20%s',new Buffer(_0x1efa4c)[_0xe2f9('0x46')](_0xe2f9('0x47')))},'json':!![]};rp(_0x4b9ef4)[_0xe2f9('0x17')](function(_0x172410){var _0x4bc011={'messageId':_0x172410[_0xe2f9('0x50')][0x0]};return _0xde2f56['update'](_0x4bc011);})[_0xe2f9('0x1a')](function(_0x273a7d){logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x4e'),util[_0xe2f9('0x3a')](_0x273a7d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe2f9('0x2b'),_0xe2f9('0x4e'),_0xe2f9('0x51'));}break;case _0xe2f9('0x52'):if(_0x41cb6e[_0xe2f9('0x30')]&&_0x41cb6e[_0xe2f9('0x32')]){if(_0x41cb6e['baseUrl']){var _0x5d7b3e={'method':_0xe2f9('0x35'),'uri':_0x41cb6e[_0xe2f9('0x53')]+_0xe2f9('0x54'),'body':{'username':_0x41cb6e[_0xe2f9('0x30')],'password':_0x41cb6e[_0xe2f9('0x32')]},'json':!![]};return rp(_0x5d7b3e)['then'](function(_0x2a0c27){var _0x5ab59f={'method':_0xe2f9('0x35'),'uri':_0x41cb6e[_0xe2f9('0x53')]+_0xe2f9('0x55'),'body':{'messages':[{'from':_0x41cb6e[_0xe2f9('0x24')],'destinations':[{'to':_0x5eebcc[_0xe2f9('0x24')]}],'text':_0x5eebcc[_0xe2f9('0xc')],'notifyUrl':_0x41cb6e[_0xe2f9('0x25')]+_0xe2f9('0x26')+_0x5eebcc['id']+_0xe2f9('0x27')+_0x41cb6e[_0xe2f9('0x28')],'notifyContentType':'application/json','callbackData':_0x41cb6e[_0xe2f9('0x24')]+';'+_0x5eebcc[_0xe2f9('0xc')]}]},'headers':{'Authorization':_0xe2f9('0x56')+_0x2a0c27[_0xe2f9('0x28')]},'json':!![]};return rp(_0x5ab59f)[_0xe2f9('0x17')](function(_0x4cb747){if(_0x4cb747[_0xe2f9('0x22')]){var _0x21b470={'messageId':_0x4cb747[_0xe2f9('0x22')][0x0][_0xe2f9('0xb')]};if(!_0x41cb6e['deliveryReport']){_0x21b470[_0xe2f9('0x39')]=!![];}return _0xde2f56[_0xe2f9('0x18')](_0x21b470);}else{return logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x52'),util[_0xe2f9('0x3a')](_0x4cb747,{'showHidden':![],'depth':null}));}});})[_0xe2f9('0x1a')](function(_0xb02c03){return logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x52'),util[_0xe2f9('0x3a')](_0xb02c03,{'showHidden':![],'depth':null}));});}else{logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x52'),_0xe2f9('0x57'));}}else{logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xe2f9('0x58'):var _0x1ec056=require('crypto');if(_0x41cb6e['apiKey']){var _0x344be4={};_0x344be4['login']=_0x41cb6e[_0xe2f9('0x30')];_0x344be4[_0xe2f9('0x24')]=_0x5eebcc[_0xe2f9('0x24')];_0x344be4[_0xe2f9('0x2f')]=_0x41cb6e[_0xe2f9('0x24')];_0x344be4[_0xe2f9('0x59')]=_0x5eebcc[_0xe2f9('0xc')];_0x344be4[_0xe2f9('0x5a')]=+new Date();var _0x16b23e='';var _0x87aa84='';var _0x44411b=Object[_0xe2f9('0x5b')](_0x344be4);_0x44411b['sort']();for(var _0x490de8=0x0;_0x490de8<_0x44411b[_0xe2f9('0x5c')];_0x490de8++){if(_0x16b23e!=''){_0x16b23e+='&';}_0x16b23e+=_0x44411b[_0x490de8]+'='+encodeURIComponent(_0x344be4[_0x44411b[_0x490de8]]);_0x87aa84+=_0x344be4[_0x44411b[_0x490de8]];}_0x87aa84+=_0x41cb6e[_0xe2f9('0x5d')];_0x87aa84=_0x1ec056[_0xe2f9('0x5e')](_0xe2f9('0x5f'))[_0xe2f9('0x18')](_0x87aa84)['digest'](_0xe2f9('0x60'));if(_0x16b23e!==''){_0x16b23e+='&';}_0x16b23e+='signature='+_0x87aa84;var _0xde6a43={'method':_0xe2f9('0x33'),'uri':_0x41cb6e[_0xe2f9('0x53')]+'/external/get/send.php?'+_0x16b23e,'json':!![]};return rp(_0xde6a43)[_0xe2f9('0x17')](function(_0x1bc2ac){var _0x263f6f=Object[_0xe2f9('0x5b')](_0x1bc2ac);if(_0x1bc2ac[_0x263f6f[0x0]][_0xe2f9('0x1b')]&&parseInt(_0x1bc2ac[_0x263f6f[0x0]][_0xe2f9('0x1b')])===0x0){var _0x33dfff={'messageId':_0x1bc2ac[_0x263f6f[0x0]][_0xe2f9('0x61')]};if(!_0x41cb6e['deliveryReport']){_0x33dfff[_0xe2f9('0x39')]=!![];}return _0xde2f56[_0xe2f9('0x18')](_0x33dfff);}else{return logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),'csc',util[_0xe2f9('0x3a')](_0x1bc2ac[_0xe2f9('0x1b')],{'showHidden':![],'depth':null}));}})[_0xe2f9('0x1a')](function(_0x52fdd0){return logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),'csc',util[_0xe2f9('0x3a')](_0x52fdd0,{'showHidden':![],'depth':null}));});}else{logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0xe2f9('0x62'):if(_0x41cb6e[_0xe2f9('0x5d')]){var _0x239ce5={'method':_0xe2f9('0x35'),'uri':_0xe2f9('0x63'),'headers':{'Authorization':_0x41cb6e['apiKey']},'body':{'content':_0x5eebcc[_0xe2f9('0xc')],'to':[_0x5eebcc[_0xe2f9('0x24')]],'from':_0x41cb6e[_0xe2f9('0x24')],'binary':![],'clientMessageId':_0xe2f9('0x64'),'charset':'UTF-8'},'json':!![]};rp(_0x239ce5)[_0xe2f9('0x17')](function(_0x21f61a){if(!_0x21f61a[_0xe2f9('0x1b')]){var _0x4a09ed={'messageId':_0x21f61a[_0xe2f9('0x22')][0x0][_0xe2f9('0x65')]};if(!_0x41cb6e['deliveryReport']){_0x4a09ed[_0xe2f9('0x39')]=!![];}return _0xde2f56[_0xe2f9('0x18')](_0x4a09ed);}else{return logger[_0xe2f9('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0xe2f9('0x3a')](_0x21f61a['error'],{'showHidden':![],'depth':null}));}})[_0xe2f9('0x1a')](function(_0x1d98e6){return logger['error'](_0xe2f9('0x2a'),'afterCreate',_0xe2f9('0x62'),util[_0xe2f9('0x3a')](_0x1d98e6,{'showHidden':![],'depth':null}));});}else{logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x62'),_0xe2f9('0x66'));}break;case'bandwidth':if(_0x41cb6e['username']&&_0x41cb6e[_0xe2f9('0x32')]){var _0x1efa4c=util[_0xe2f9('0x42')]('%s:%s',_0x41cb6e[_0xe2f9('0x30')],_0x41cb6e[_0xe2f9('0x32')]);var _0x4b9ef4={'method':'POST','uri':_0xe2f9('0x67')+_0x41cb6e['accountId']+'/messages','body':{'to':[_0x5eebcc['phone']],'text':_0x5eebcc[_0xe2f9('0xc')],'from':_0x41cb6e['phone'],'applicationId':_0x41cb6e[_0xe2f9('0x68')]},'headers':{'Authorization':util[_0xe2f9('0x42')](_0xe2f9('0x45'),new Buffer(_0x1efa4c)[_0xe2f9('0x46')](_0xe2f9('0x47')))},'json':!![]};rp(_0x4b9ef4)[_0xe2f9('0x17')](function(_0x14c901){if(_0x14c901['id']){var _0x476b9b={'messageId':_0x14c901['id']};return _0xde2f56[_0xe2f9('0x18')](_0x476b9b);}else{logger['error'](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x69'),util['inspect'](_0x14c901,{'showHidden':![],'depth':null}));}})[_0xe2f9('0x1a')](function(_0x2fa60e){logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),'afterCreate',_0xe2f9('0x69'),util[_0xe2f9('0x3a')](_0x2fa60e,{'showHidden':![],'depth':null}));});}else{logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),'afterCreate','bandwidth',_0xe2f9('0x3b'));}break;case _0xe2f9('0x6a'):if(_0x41cb6e[_0xe2f9('0x5d')]){var _0x515f83={};var _0xde6a43={'method':_0xe2f9('0x35'),'uri':_0xe2f9('0x6b'),'headers':{'Authorization':_0xe2f9('0x6c')+_0x41cb6e['apiKey'],'Content-Type':_0xe2f9('0x6d')},'body':{'from':_0x41cb6e[_0xe2f9('0x24')],'to':_0x5eebcc[_0xe2f9('0x24')],'text':_0x5eebcc[_0xe2f9('0xc')]},'json':!![]};return rp(_0xde6a43)[_0xe2f9('0x17')](function(_0xb346cb){if(_0xb346cb[_0xe2f9('0x6e')]==0xca){_0x515f83[_0xe2f9('0x6f')]=_0xb346cb;var _0x329b0b={'method':_0xe2f9('0x35'),'uri':_0xe2f9('0x70'),'headers':{'Authorization':_0xe2f9('0x6c')+_0x41cb6e[_0xe2f9('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x515f83[_0xe2f9('0x6f')]['refid']},'json':!![]};return rp(_0x329b0b)[_0xe2f9('0x17')](function(_0x2c702d){_0x515f83[_0xe2f9('0x71')]=_0x2c702d;var _0x4de7e5={'messageId':_0x515f83['message']['refid'],'read':!![]};return _0xde2f56[_0xe2f9('0x18')](_0x4de7e5);});}else{return logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x6a'),util[_0xe2f9('0x3a')](_0xb346cb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x595c50){return logger['error'](_0xe2f9('0x2a'),_0xe2f9('0x2b'),_0xe2f9('0x6a'),util[_0xe2f9('0x3a')](_0x595c50,{'showHidden':![],'depth':null}));});}else{return logger[_0xe2f9('0x1b')](_0xe2f9('0x2a'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0xe2f9('0x72')](function(){_0x4483c6();});}else{_0x4483c6();}}},'charset':_0xe2f9('0x73'),'collate':_0xe2f9('0x74')});}; \ No newline at end of file +var _0x201f=['deliveryReport','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','base64','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','get','toLowerCase','direction','out','secret','isNil','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','find','type','twilio','authToken','phone','accountSid','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','split','sms','POST','user_key','session_key','total_sent','internal_order_id','read','afterCreate','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid'];(function(_0x44dafa,_0x4dbc5b){var _0x1d166b=function(_0xe3e5b4){while(--_0xe3e5b4){_0x44dafa['push'](_0x44dafa['shift']());}};_0x1d166b(++_0x4dbc5b);}(_0x201f,0x130));var _0xf201=function(_0x275210,_0x26f095){_0x275210=_0x275210-0x0;var _0x184247=_0x201f[_0x275210];return _0x184247;};'use strict';var _=require(_0xf201('0x0'));var util=require('util');var logger=require(_0xf201('0x1'))(_0xf201('0x2'));var moment=require(_0xf201('0x3'));var BPromise=require(_0xf201('0x4'));var rp=require(_0xf201('0x5'));var fs=require('fs');var path=require(_0xf201('0x6'));var rimraf=require(_0xf201('0x7'));var config=require(_0xf201('0x8'));var attributes=require(_0xf201('0x9'));module[_0xf201('0xa')]=function(_0xeb268e,_0x5cfd71){return _0xeb268e[_0xf201('0xb')]('SmsMessage',attributes,{'tableName':_0xf201('0xc'),'paranoid':![],'indexes':[{'name':_0xf201('0xd'),'fields':['messageId']},{'name':_0xf201('0xe'),'fields':[_0xf201('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e69c4,_0x400a3b,_0x273e4d){var _0x17f158=_0xeb268e['models'];var _0x14ac58=_0x1e69c4[_0xf201('0x10')]({'plain':!![]});if(_0x14ac58['direction'][_0xf201('0x11')]()==='in'||_0x14ac58[_0xf201('0x12')][_0xf201('0x11')]()===_0xf201('0x13')&&!_0x14ac58[_0xf201('0x14')]&&!_[_0xf201('0x15')](_0x14ac58['UserId'])&&!_[_0xf201('0x15')](_0x14ac58[_0xf201('0x16')])){_0x17f158[_0xf201('0x17')]['findOne']({'where':{'id':_0x14ac58[_0xf201('0x16')]}})[_0xf201('0x18')](function(_0x3b8766){if(_0x3b8766){_0x3b8766[_0xf201('0x19')]({'lastMsgAt':_0x14ac58[_0xf201('0x1a')],'lastMsgDirection':_0x14ac58['direction'][_0xf201('0x11')]()});}})[_0xf201('0x1b')](function(_0x45ff0f){console[_0xf201('0x1c')](_0x45ff0f);});}if(_0x14ac58[_0xf201('0x12')]==='out'&&!_0x14ac58[_0xf201('0x14')]){var _0x37859e;_0x17f158['SmsAccount'][_0xf201('0x1d')]({'where':{'id':_0x14ac58['SmsAccountId']},'raw':!![]})[_0xf201('0x18')](function(_0x3633b1){_0x37859e=_0x3633b1;if(_0x37859e&&_0x37859e[_0xf201('0x1e')]){switch(_0x37859e[_0xf201('0x1e')]){case _0xf201('0x1f'):var _0x7b4536=require(_0xf201('0x1f'));if(_0x37859e['accountSid']&&_0x37859e[_0xf201('0x20')]&&_0x37859e[_0xf201('0x21')]){var _0x4f30bf=new _0x7b4536(_0x37859e[_0xf201('0x22')],_0x37859e[_0xf201('0x20')]);_0x4f30bf[_0xf201('0x23')]['create']({'body':_0x14ac58[_0xf201('0xf')],'to':_0x14ac58[_0xf201('0x21')],'from':_0x37859e[_0xf201('0x21')],'statusCallback':_0x37859e[_0xf201('0x24')]+_0xf201('0x25')+_0x14ac58['id']+_0xf201('0x26')+_0x37859e[_0xf201('0x27')]})[_0xf201('0x18')](function(_0x476c59){if(_0x476c59['sid']){return _0x1e69c4[_0xf201('0x19')]({'messageId':_0x476c59[_0xf201('0x28')]});}})[_0xf201('0x1b')](function(_0x35a7f7){logger[_0xf201('0x1c')](_0xf201('0x29'),'afterCreate',_0xf201('0x1f'),util['inspect'](_0x35a7f7,{'showHidden':![],'depth':null}));});}else{logger[_0xf201('0x1c')](_0xf201('0x29'),'afterCreate',_0xf201('0x1f'),_0xf201('0x2a'));}break;case _0xf201('0x2b'):var _0xddebcd=_0xf201('0x2c');if(_0x37859e[_0xf201('0x2d')]&&_0x37859e['password']){var _0x4255b8={'recipient':[_0x14ac58[_0xf201('0x21')]],'message':_0x14ac58[_0xf201('0xf')],'message_type':_0x37859e[_0xf201('0x2e')]};if(_0x37859e[_0xf201('0x2e')]&&_0x37859e[_0xf201('0x2e')]!=='SI'){_0x4255b8[_0xf201('0x2f')]=_0x37859e[_0xf201('0x21')];}var _0x2aeae0={'url':_0xddebcd+_0xf201('0x30')+_0x37859e[_0xf201('0x2d')]+_0xf201('0x31')+_0x37859e[_0xf201('0x32')],'method':'GET'};rp(_0x2aeae0)[_0xf201('0x18')](function(_0x11b1e3){var _0x448685=_0x11b1e3[_0xf201('0x33')](';');var _0x214396={'user_key':_0x448685[0x0],'session_key':_0x448685[0x1]};_0x2aeae0={'url':_0xddebcd+_0xf201('0x34'),'method':_0xf201('0x35'),'headers':{'user_key':_0x214396[_0xf201('0x36')],'Session_key':_0x214396[_0xf201('0x37')]},'json':!![],'body':_0x4255b8};return rp(_0x2aeae0);})[_0xf201('0x18')](function(_0x8d9a5e){if(_0x8d9a5e[_0xf201('0x38')]>=0x1){var _0x59f2a1={'messageId':_0x8d9a5e[_0xf201('0x39')]};if(_0x37859e[_0xf201('0x2e')]!=='GP'||!_0x37859e['deliveryReport']){_0x59f2a1[_0xf201('0x3a')]=!![];}return _0x1e69c4[_0xf201('0x19')](_0x59f2a1);}else{return logger['error'](_0xf201('0x29'),_0xf201('0x3b'),'skebby',util[_0xf201('0x3c')](_0x8d9a5e,{'showHidden':![],'depth':null}));}})[_0xf201('0x1b')](function(_0x1e9678){return logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x2b'),util[_0xf201('0x3c')](_0x1e9678,{'showHidden':![],'depth':null}));});}else{logger[_0xf201('0x1c')](_0xf201('0x29'),'afterCreate',_0xf201('0x2b'),_0xf201('0x3d'));}break;case _0xf201('0x3e'):if(_0x37859e['authToken']){var _0xc4cf93={'recipient':_0x14ac58[_0xf201('0x21')],'message':_0x14ac58[_0xf201('0xf')],'sender':_0x37859e[_0xf201('0x3f')]||_0x37859e[_0xf201('0x21')],'authorization':_0x37859e[_0xf201('0x20')]};var _0x400a3b={'method':_0xf201('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xc4cf93,'json':!![]};rp(_0x400a3b)[_0xf201('0x18')](function(_0x5344b7){var _0x329c3e={'messageId':_0x5344b7[_0xf201('0x40')]};if(!_0x37859e[_0xf201('0x41')]){_0x329c3e[_0xf201('0x3a')]=!![];}return _0x1e69c4[_0xf201('0x19')](_0x329c3e);})[_0xf201('0x1b')](function(_0x4ca3dc){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf201('0x3e'),util[_0xf201('0x3c')](_0x4ca3dc,{'showHidden':![],'depth':null}));});}else{logger[_0xf201('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf201('0x3b'),_0xf201('0x3e'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x37859e[_0xf201('0x2d')]&&_0x37859e[_0xf201('0x32')]){var _0xc4cf93={'messages':[{'source':_0xf201('0x42'),'to':_0x14ac58[_0xf201('0x21')],'body':_0x14ac58[_0xf201('0xf')],'from':_0x37859e[_0xf201('0x3f')]||_0x37859e[_0xf201('0x21')]}]};var _0x4b7485=util[_0xf201('0x43')](_0xf201('0x44'),_0x37859e[_0xf201('0x2d')],_0x37859e[_0xf201('0x32')]);var _0x400a3b={'method':_0xf201('0x35'),'uri':_0xf201('0x45'),'body':_0xc4cf93,'headers':{'Authorization':util[_0xf201('0x43')](_0xf201('0x46'),new Buffer(_0x4b7485)[_0xf201('0x47')]('base64'))},'json':!![]};rp(_0x400a3b)[_0xf201('0x18')](function(_0x17fc7b){if(_0x17fc7b['http_code']>=0xc8&&_0x17fc7b[_0xf201('0x48')]<=0xce){if(_0x17fc7b[_0xf201('0x49')]&&_0x17fc7b[_0xf201('0x49')][_0xf201('0x4a')]>0x0){var _0xc53aeb=_[_0xf201('0x4b')](_0x17fc7b['data'][_0xf201('0x23')]);var _0x4ff249={'messageId':_0xc53aeb[_0xf201('0x4c')]};if(!_0x37859e[_0xf201('0x41')]){_0x4ff249[_0xf201('0x3a')]=!![];}return _0x1e69c4[_0xf201('0x19')](_0x4ff249);}else{logger[_0xf201('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf201('0x3b'),'clickSend',util['inspect'](_0x17fc7b,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xf201('0x29'),_0xf201('0x3b'),'clickSend',util[_0xf201('0x3c')](_0x17fc7b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x311209){logger[_0xf201('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf201('0x3b'),_0xf201('0x4d'),util[_0xf201('0x3c')](_0x311209,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x4d'),_0xf201('0x3d'));}break;case _0xf201('0x4e'):if(_0x37859e[_0xf201('0x4f')]&&_0x37859e[_0xf201('0x20')]){var _0xc4cf93={'dst':_0x14ac58[_0xf201('0x21')],'text':_0x14ac58['body'],'src':_0x37859e[_0xf201('0x3f')]||_0x37859e[_0xf201('0x21')],'url':_0x37859e['remote']+_0xf201('0x25')+_0x14ac58['id']+_0xf201('0x26')+_0x37859e[_0xf201('0x27')]};var _0x4b7485=util[_0xf201('0x43')](_0xf201('0x44'),_0x37859e[_0xf201('0x4f')],_0x37859e[_0xf201('0x20')]);var _0x400a3b={'method':_0xf201('0x35'),'uri':util[_0xf201('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x37859e['authId']),'body':_0xc4cf93,'headers':{'Authorization':util[_0xf201('0x43')]('Basic\x20%s',new Buffer(_0x4b7485)['toString'](_0xf201('0x50')))},'json':!![]};rp(_0x400a3b)[_0xf201('0x18')](function(_0x5cd633){var _0x143ebd={'messageId':_0x5cd633[_0xf201('0x51')][0x0]};return _0x1e69c4[_0xf201('0x19')](_0x143ebd);})['catch'](function(_0x74a69f){logger['error'](_0xf201('0x29'),'afterCreate',_0xf201('0x4e'),util['inspect'](_0x74a69f,{'showHidden':![],'depth':null}));});}else{logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x37859e['username']&&_0x37859e['password']){if(_0x37859e[_0xf201('0x52')]){var _0x338f56={'method':_0xf201('0x35'),'uri':_0x37859e[_0xf201('0x52')]+_0xf201('0x53'),'body':{'username':_0x37859e['username'],'password':_0x37859e['password']},'json':!![]};return rp(_0x338f56)[_0xf201('0x18')](function(_0x51375e){var _0x963838={'method':_0xf201('0x35'),'uri':_0x37859e['baseUrl']+_0xf201('0x54'),'body':{'messages':[{'from':_0x37859e[_0xf201('0x21')],'destinations':[{'to':_0x14ac58[_0xf201('0x21')]}],'text':_0x14ac58[_0xf201('0xf')],'notifyUrl':_0x37859e[_0xf201('0x24')]+'/api/sms/messages/'+_0x14ac58['id']+_0xf201('0x26')+_0x37859e[_0xf201('0x27')],'notifyContentType':_0xf201('0x55'),'callbackData':_0x37859e[_0xf201('0x21')]+';'+_0x14ac58[_0xf201('0xf')]}]},'headers':{'Authorization':_0xf201('0x56')+_0x51375e[_0xf201('0x27')]},'json':!![]};return rp(_0x963838)[_0xf201('0x18')](function(_0x43e7a3){if(_0x43e7a3[_0xf201('0x23')]){var _0x9693ad={'messageId':_0x43e7a3['messages'][0x0][_0xf201('0xd')]};if(!_0x37859e[_0xf201('0x41')]){_0x9693ad[_0xf201('0x3a')]=!![];}return _0x1e69c4['update'](_0x9693ad);}else{return logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x57'),util[_0xf201('0x3c')](_0x43e7a3,{'showHidden':![],'depth':null}));}});})[_0xf201('0x1b')](function(_0x36d24f){return logger['error'](_0xf201('0x29'),'afterCreate',_0xf201('0x57'),util[_0xf201('0x3c')](_0x36d24f,{'showHidden':![],'depth':null}));});}else{logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x57'),_0xf201('0x58'));}}else{logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x57'),_0xf201('0x3d'));}break;case _0xf201('0x59'):var _0x2f431b=require(_0xf201('0x5a'));if(_0x37859e[_0xf201('0x5b')]){var _0x2c813b={};_0x2c813b[_0xf201('0x5c')]=_0x37859e[_0xf201('0x2d')];_0x2c813b[_0xf201('0x21')]=_0x14ac58[_0xf201('0x21')];_0x2c813b[_0xf201('0x2f')]=_0x37859e[_0xf201('0x21')];_0x2c813b[_0xf201('0x5d')]=_0x14ac58[_0xf201('0xf')];_0x2c813b[_0xf201('0x5e')]=+new Date();var _0x338356='';var _0x2e7aa2='';var _0x115501=Object['keys'](_0x2c813b);_0x115501[_0xf201('0x5f')]();for(var _0x57d670=0x0;_0x57d670<_0x115501[_0xf201('0x60')];_0x57d670++){if(_0x338356!=''){_0x338356+='&';}_0x338356+=_0x115501[_0x57d670]+'='+encodeURIComponent(_0x2c813b[_0x115501[_0x57d670]]);_0x2e7aa2+=_0x2c813b[_0x115501[_0x57d670]];}_0x2e7aa2+=_0x37859e[_0xf201('0x5b')];_0x2e7aa2=_0x2f431b[_0xf201('0x61')]('md5')[_0xf201('0x19')](_0x2e7aa2)[_0xf201('0x62')](_0xf201('0x63'));if(_0x338356!==''){_0x338356+='&';}_0x338356+=_0xf201('0x64')+_0x2e7aa2;var _0x2aeae0={'method':'GET','uri':_0x37859e[_0xf201('0x52')]+_0xf201('0x65')+_0x338356,'json':!![]};return rp(_0x2aeae0)[_0xf201('0x18')](function(_0x1f54f7){var _0x56f35d=Object['keys'](_0x1f54f7);if(_0x1f54f7[_0x56f35d[0x0]][_0xf201('0x1c')]&&parseInt(_0x1f54f7[_0x56f35d[0x0]][_0xf201('0x1c')])===0x0){var _0x38d7f2={'messageId':_0x1f54f7[_0x56f35d[0x0]][_0xf201('0x66')]};if(!_0x37859e[_0xf201('0x41')]){_0x38d7f2[_0xf201('0x3a')]=!![];}return _0x1e69c4['update'](_0x38d7f2);}else{return logger[_0xf201('0x1c')](_0xf201('0x29'),'afterCreate',_0xf201('0x59'),util[_0xf201('0x3c')](_0x1f54f7[_0xf201('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x345afb){return logger['error'](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x59'),util['inspect'](_0x345afb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x59'),_0xf201('0x67'));}break;case _0xf201('0x68'):if(_0x37859e['apiKey']){var _0x318591={'method':_0xf201('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x37859e[_0xf201('0x5b')]},'body':{'content':_0x14ac58[_0xf201('0xf')],'to':[_0x14ac58[_0xf201('0x21')]],'from':_0x37859e['phone'],'binary':![],'clientMessageId':_0xf201('0x69'),'charset':_0xf201('0x6a')},'json':!![]};rp(_0x318591)[_0xf201('0x18')](function(_0x31c548){if(!_0x31c548[_0xf201('0x1c')]){var _0x3f738f={'messageId':_0x31c548[_0xf201('0x23')][0x0][_0xf201('0x6b')]};if(!_0x37859e[_0xf201('0x41')]){_0x3f738f[_0xf201('0x3a')]=!![];}return _0x1e69c4['update'](_0x3f738f);}else{return logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x68'),util['inspect'](_0x31c548[_0xf201('0x1c')],{'showHidden':![],'depth':null}));}})[_0xf201('0x1b')](function(_0x3a536b){return logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x68'),util[_0xf201('0x3c')](_0x3a536b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x68'),_0xf201('0x67'));}break;case _0xf201('0x6c'):if(_0x37859e[_0xf201('0x2d')]&&_0x37859e[_0xf201('0x32')]){var _0x4b7485=util[_0xf201('0x43')](_0xf201('0x44'),_0x37859e[_0xf201('0x2d')],_0x37859e[_0xf201('0x32')]);var _0x400a3b={'method':_0xf201('0x35'),'uri':_0xf201('0x6d')+_0x37859e[_0xf201('0x6e')]+_0xf201('0x6f'),'body':{'to':[_0x14ac58['phone']],'text':_0x14ac58[_0xf201('0xf')],'from':_0x37859e[_0xf201('0x21')],'applicationId':_0x37859e[_0xf201('0x70')]},'headers':{'Authorization':util[_0xf201('0x43')](_0xf201('0x46'),new Buffer(_0x4b7485)[_0xf201('0x47')](_0xf201('0x50')))},'json':!![]};rp(_0x400a3b)[_0xf201('0x18')](function(_0x19f76b){if(_0x19f76b['id']){var _0x56b9c5={'messageId':_0x19f76b['id']};return _0x1e69c4[_0xf201('0x19')](_0x56b9c5);}else{logger['error'](_0xf201('0x29'),'afterCreate','bandwidth',util[_0xf201('0x3c')](_0x19f76b,{'showHidden':![],'depth':null}));}})[_0xf201('0x1b')](function(_0x2f2b95){logger[_0xf201('0x1c')](_0xf201('0x29'),'afterCreate',_0xf201('0x6c'),util[_0xf201('0x3c')](_0x2f2b95,{'showHidden':![],'depth':null}));});}else{logger[_0xf201('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf201('0x6c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf201('0x71'):if(_0x37859e[_0xf201('0x5b')]){var _0x451f18={};var _0x2aeae0={'method':_0xf201('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xf201('0x72')+_0x37859e[_0xf201('0x5b')],'Content-Type':_0xf201('0x55')},'body':{'from':_0x37859e[_0xf201('0x21')],'to':_0x14ac58[_0xf201('0x21')],'text':_0x14ac58[_0xf201('0xf')]},'json':!![]};return rp(_0x2aeae0)[_0xf201('0x18')](function(_0x845df6){if(_0x845df6[_0xf201('0x73')]==0xca){_0x451f18[_0xf201('0x74')]=_0x845df6;var _0x45c285={'method':_0xf201('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xf201('0x72')+_0x37859e[_0xf201('0x5b')],'Content-Type':_0xf201('0x55')},'body':{'refid':_0x451f18['message']['refid']},'json':!![]};return rp(_0x45c285)[_0xf201('0x18')](function(_0x1f4cdf){_0x451f18[_0xf201('0x75')]=_0x1f4cdf;var _0x512e0f={'messageId':_0x451f18[_0xf201('0x74')][_0xf201('0x76')],'read':!![]};return _0x1e69c4[_0xf201('0x19')](_0x512e0f);});}else{return logger[_0xf201('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf201('0x3b'),'intelepeer',util[_0xf201('0x3c')](_0x845df6,{'showHidden':![],'depth':null}));}})[_0xf201('0x1b')](function(_0x26a293){return logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x71'),util['inspect'](_0x26a293,{'showHidden':![],'depth':null}));});}else{return logger[_0xf201('0x1c')](_0xf201('0x29'),_0xf201('0x3b'),_0xf201('0x71'),_0xf201('0x77'));}break;}}})[_0xf201('0x78')](function(){_0x273e4d();});}else{_0x273e4d();}}},'charset':_0xf201('0x79'),'collate':_0xf201('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 1144276..6d70d2c 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 _0xa11c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment'];(function(_0x25d9cf,_0x44a3c6){var _0x392f19=function(_0x353139){while(--_0x353139){_0x25d9cf['push'](_0x25d9cf['shift']());}};_0x392f19(++_0x44a3c6);}(_0xa11c,0x14a));var _0xca11=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa11c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xca11('0x0'));var util=require(_0xca11('0x1'));var moment=require(_0xca11('0x2'));var BPromise=require(_0xca11('0x3'));var rs=require(_0xca11('0x4'));var fs=require('fs');var Redis=require(_0xca11('0x5'));var db=require(_0xca11('0x6'))['db'];var utils=require(_0xca11('0x7'));var logger=require(_0xca11('0x8'))(_0xca11('0x9'));var config=require('../../config/environment');var jayson=require(_0xca11('0xa'));var client=jayson[_0xca11('0xb')][_0xca11('0xc')]({'port':0x232a});config[_0xca11('0xd')]=_[_0xca11('0xe')](config[_0xca11('0xd')],{'host':_0xca11('0xf'),'port':0x18eb});var socket=require(_0xca11('0x10'))(new Redis(config[_0xca11('0xd')]));require(_0xca11('0x11'))['register'](socket);function respondWithRpcPromise(_0x9dede1,_0x1bce2e,_0x110c8b){return new BPromise(function(_0x386431,_0x32cead){return client[_0xca11('0x12')](_0x9dede1,_0x110c8b)[_0xca11('0x13')](function(_0x5ed218){logger[_0xca11('0x14')](_0xca11('0x15'),_0x1bce2e,_0xca11('0x16'));logger[_0xca11('0x17')](_0xca11('0x18'),_0x1bce2e,_0xca11('0x16'),JSON[_0xca11('0x19')](_0x5ed218));if(_0x5ed218[_0xca11('0x1a')]){if(_0x5ed218[_0xca11('0x1a')][_0xca11('0x1b')]===0x1f4){logger[_0xca11('0x1a')](_0xca11('0x15'),_0x1bce2e,_0x5ed218[_0xca11('0x1a')][_0xca11('0x1c')]);return _0x32cead(_0x5ed218[_0xca11('0x1a')][_0xca11('0x1c')]);}logger[_0xca11('0x1a')](_0xca11('0x15'),_0x1bce2e,_0x5ed218[_0xca11('0x1a')][_0xca11('0x1c')]);return _0x386431(_0x5ed218['error']['message']);}else{logger['info'](_0xca11('0x15'),_0x1bce2e,_0xca11('0x16'));_0x386431(_0x5ed218[_0xca11('0x1d')][_0xca11('0x1c')]);}})[_0xca11('0x1e')](function(_0x163f01){logger[_0xca11('0x1a')](_0xca11('0x15'),_0x1bce2e,_0x163f01);_0x32cead(_0x163f01);});});}exports[_0xca11('0x1f')]=function(_0x55a405){var _0xe04493=this;return new Promise(function(_0x29dee7,_0x201492){return db[_0xca11('0x20')][_0xca11('0x21')](_0x55a405[_0xca11('0x22')],{'raw':_0x55a405[_0xca11('0x23')]?_0x55a405[_0xca11('0x23')][_0xca11('0x24')]===undefined?!![]:![]:!![]})[_0xca11('0x13')](function(_0x1f9e55){logger['info'](_0xca11('0x1f'),_0x55a405);logger[_0xca11('0x17')](_0xca11('0x1f'),_0x55a405,JSON[_0xca11('0x19')](_0x1f9e55));_0x29dee7(_0x1f9e55);})[_0xca11('0x1e')](function(_0x14b380){logger['error'](_0xca11('0x1f'),_0x14b380[_0xca11('0x1c')],_0x55a405);_0x201492(_0xe04493[_0xca11('0x1a')](0x1f4,_0x14b380[_0xca11('0x1c')]));});});}; \ No newline at end of file +var _0xf7b6=['then','info','request\x20sent','debug','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsMessage.socket','request'];(function(_0x1155d2,_0x5e8b69){var _0x313ffb=function(_0x1a52f5){while(--_0x1a52f5){_0x1155d2['push'](_0x1155d2['shift']());}};_0x313ffb(++_0x5e8b69);}(_0xf7b6,0x1b4));var _0x6f7b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf7b6[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x6f7b('0x0'));var moment=require(_0x6f7b('0x1'));var BPromise=require(_0x6f7b('0x2'));var rs=require(_0x6f7b('0x3'));var fs=require('fs');var Redis=require(_0x6f7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6f7b('0x5'))('rpc');var config=require(_0x6f7b('0x6'));var jayson=require(_0x6f7b('0x7'));var client=jayson[_0x6f7b('0x8')][_0x6f7b('0x9')]({'port':0x232a});config[_0x6f7b('0xa')]=_['defaults'](config[_0x6f7b('0xa')],{'host':_0x6f7b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f7b('0xa')]));require(_0x6f7b('0xc'))['register'](socket);function respondWithRpcPromise(_0x26c757,_0x513945,_0x4fbdd7){return new BPromise(function(_0x372645,_0x362bfd){return client[_0x6f7b('0xd')](_0x26c757,_0x4fbdd7)[_0x6f7b('0xe')](function(_0x570283){logger[_0x6f7b('0xf')]('SmsMessage,\x20%s,\x20%s',_0x513945,_0x6f7b('0x10'));logger[_0x6f7b('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x513945,'request\x20sent',JSON['stringify'](_0x570283));if(_0x570283[_0x6f7b('0x12')]){if(_0x570283[_0x6f7b('0x12')]['code']===0x1f4){logger[_0x6f7b('0x12')](_0x6f7b('0x13'),_0x513945,_0x570283[_0x6f7b('0x12')][_0x6f7b('0x14')]);return _0x362bfd(_0x570283[_0x6f7b('0x12')]['message']);}logger['error'](_0x6f7b('0x13'),_0x513945,_0x570283['error'][_0x6f7b('0x14')]);return _0x372645(_0x570283[_0x6f7b('0x12')][_0x6f7b('0x14')]);}else{logger[_0x6f7b('0xf')]('SmsMessage,\x20%s,\x20%s',_0x513945,_0x6f7b('0x10'));_0x372645(_0x570283[_0x6f7b('0x15')]['message']);}})[_0x6f7b('0x16')](function(_0x51370f){logger['error'](_0x6f7b('0x13'),_0x513945,_0x51370f);_0x362bfd(_0x51370f);});});}exports[_0x6f7b('0x17')]=function(_0x20ec10){var _0x554b21=this;return new Promise(function(_0x46d8e3,_0x1f78a0){return db[_0x6f7b('0x18')][_0x6f7b('0x19')](_0x20ec10[_0x6f7b('0x1a')],{'raw':_0x20ec10[_0x6f7b('0x1b')]?_0x20ec10[_0x6f7b('0x1b')][_0x6f7b('0x1c')]===undefined?!![]:![]:!![]})[_0x6f7b('0xe')](function(_0x40f0e0){logger[_0x6f7b('0xf')](_0x6f7b('0x17'),_0x20ec10);logger['debug'](_0x6f7b('0x17'),_0x20ec10,JSON[_0x6f7b('0x1d')](_0x40f0e0));_0x46d8e3(_0x40f0e0);})[_0x6f7b('0x16')](function(_0x6229e5){logger['error']('CreateSmsMessage',_0x6229e5[_0x6f7b('0x14')],_0x20ec10);_0x1f78a0(_0x554b21[_0x6f7b('0x12')](0x1f4,_0x6229e5[_0x6f7b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 185f2c6..6dcd3e6 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 _0xf932=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xf932,0x1d4));var _0x2f93=function(_0xc13ee4,_0x4164ab){_0xc13ee4=_0xc13ee4-0x0;var _0x9611f6=_0xf932[_0xc13ee4];return _0x9611f6;};'use strict';var SmsMessageEvents=require(_0x2f93('0x0'));var events=[_0x2f93('0x1'),_0x2f93('0x2'),_0x2f93('0x3')];function createListener(_0xa51ab,_0x382e70){return function(_0x57e550){_0x382e70[_0x2f93('0x4')](_0xa51ab,_0x57e550);};}function removeListener(_0x2747e6,_0x211b2f){return function(){SmsMessageEvents[_0x2f93('0x5')](_0x2747e6,_0x211b2f);};}exports[_0x2f93('0x6')]=function(_0x449e3f){for(var _0x2acd9b=0x0,_0x1cea7d=events[_0x2f93('0x7')];_0x2acd9b<_0x1cea7d;_0x2acd9b++){var _0x43326d=events[_0x2acd9b];var _0x38cf80=createListener(_0x2f93('0x8')+_0x43326d,_0x449e3f);SmsMessageEvents['on'](_0x43326d,_0x38cf80);}}; \ No newline at end of file +var _0x39fc=['./smsMessage.events','save','remove','update','register','length'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x39fc,0x156));var _0xc39f=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x39fc[_0x3b56c0];return _0x377efe;};'use strict';var SmsMessageEvents=require(_0xc39f('0x0'));var events=[_0xc39f('0x1'),_0xc39f('0x2'),_0xc39f('0x3')];function createListener(_0x30938e,_0x4edf6a){return function(_0x2292d0){_0x4edf6a['emit'](_0x30938e,_0x2292d0);};}function removeListener(_0x15cdbe,_0x3a067c){return function(){SmsMessageEvents['removeListener'](_0x15cdbe,_0x3a067c);};}exports[_0xc39f('0x4')]=function(_0x51d456){for(var _0x4037f3=0x0,_0xceef68=events[_0xc39f('0x5')];_0x4037f3<_0xceef68;_0x4037f3++){var _0x4d1772=events[_0x4037f3];var _0x341ea6=createListener('smsMessage:'+_0x4d1772,_0x51d456);SmsMessageEvents['on'](_0x4d1772,_0x341ea6);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 345a891..c094015 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 _0x4397=['removeAgents','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4397,0x196));var _0x7439=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x4397[_0x254abd];return _0x31bf1b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7439('0x0'));var timeout=require(_0x7439('0x1'));var express=require('express');var router=express[_0x7439('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7439('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7439('0x4'));var controller=require('./smsQueue.controller');router[_0x7439('0x5')]('/',auth[_0x7439('0x6')](),controller[_0x7439('0x7')]);router[_0x7439('0x5')](_0x7439('0x8'),auth[_0x7439('0x6')](),controller[_0x7439('0x9')]);router[_0x7439('0x5')](_0x7439('0xa'),auth[_0x7439('0x6')](),controller[_0x7439('0xb')]);router[_0x7439('0x5')](_0x7439('0xc'),auth[_0x7439('0x6')](),controller[_0x7439('0xd')]);router[_0x7439('0x5')](_0x7439('0xe'),auth[_0x7439('0x6')](),controller[_0x7439('0xf')]);router[_0x7439('0x5')](_0x7439('0x10'),auth[_0x7439('0x6')](),controller[_0x7439('0x11')]);router[_0x7439('0x12')]('/',auth[_0x7439('0x6')](),controller[_0x7439('0x13')]);router[_0x7439('0x12')](_0x7439('0xe'),auth['isAuthenticated'](),controller[_0x7439('0x14')]);router[_0x7439('0x12')](_0x7439('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7439('0x15')](_0x7439('0xa'),auth['isAuthenticated'](),controller[_0x7439('0x16')]);router[_0x7439('0x17')](_0x7439('0xa'),auth['isAuthenticated'](),controller[_0x7439('0x18')]);router[_0x7439('0x17')](_0x7439('0xe'),auth[_0x7439('0x6')](),controller[_0x7439('0x19')]);router['delete']('/:id/users',auth[_0x7439('0x6')](),controller[_0x7439('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0265=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members'];(function(_0x49263e,_0x800591){var _0x349ab6=function(_0x16c568){while(--_0x16c568){_0x49263e['push'](_0x49263e['shift']());}};_0x349ab6(++_0x800591);}(_0x0265,0xe2));var _0x5026=function(_0x4e96ad,_0x2aa8ab){_0x4e96ad=_0x4e96ad-0x0;var _0x34aff8=_0x0265[_0x4e96ad];return _0x34aff8;};'use strict';var multer=require(_0x5026('0x0'));var util=require(_0x5026('0x1'));var path=require(_0x5026('0x2'));var timeout=require(_0x5026('0x3'));var express=require(_0x5026('0x4'));var router=express[_0x5026('0x5')]();var fs_extra=require(_0x5026('0x6'));var auth=require(_0x5026('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5026('0x8'));var controller=require(_0x5026('0x9'));router[_0x5026('0xa')]('/',auth[_0x5026('0xb')](),controller[_0x5026('0xc')]);router[_0x5026('0xa')](_0x5026('0xd'),auth[_0x5026('0xb')](),controller['describe']);router[_0x5026('0xa')](_0x5026('0xe'),auth[_0x5026('0xb')](),controller[_0x5026('0xf')]);router['get'](_0x5026('0x10'),auth[_0x5026('0xb')](),controller[_0x5026('0x11')]);router['get'](_0x5026('0x12'),auth[_0x5026('0xb')](),controller[_0x5026('0x13')]);router[_0x5026('0xa')](_0x5026('0x14'),auth[_0x5026('0xb')](),controller[_0x5026('0x15')]);router[_0x5026('0x16')]('/',auth[_0x5026('0xb')](),controller['create']);router['post'](_0x5026('0x12'),auth[_0x5026('0xb')](),controller['addTeams']);router[_0x5026('0x16')](_0x5026('0x14'),auth[_0x5026('0xb')](),controller[_0x5026('0x17')]);router[_0x5026('0x18')]('/:id',auth[_0x5026('0xb')](),controller[_0x5026('0x19')]);router[_0x5026('0x1a')]('/:id',auth[_0x5026('0xb')](),controller['destroy']);router[_0x5026('0x1a')](_0x5026('0x12'),auth[_0x5026('0xb')](),controller['removeTeams']);router[_0x5026('0x1a')](_0x5026('0x14'),auth[_0x5026('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index cd38c85..5530840 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 _0x76ca=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x272156,_0x5e4b0d){var _0x1071d0=function(_0x5f1f6b){while(--_0x5f1f6b){_0x272156['push'](_0x272156['shift']());}};_0x1071d0(++_0x5e4b0d);}(_0x76ca,0xf3));var _0xa76c=function(_0x17ddbd,_0x380196){_0x17ddbd=_0x17ddbd-0x0;var _0x181956=_0x76ca[_0x17ddbd];return _0x181956;};'use strict';var Sequelize=require(_0xa76c('0x0'));module[_0xa76c('0x1')]={'name':{'type':Sequelize[_0xa76c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa76c('0x2')]},'timeout':{'type':Sequelize[_0xa76c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa76c('0x4')](_0xa76c('0x5'),'beepall',_0xa76c('0x6'))}}; \ No newline at end of file +var _0xdc66=['sequelize','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdc66,0x78));var _0x6dc6=function(_0xac2821,_0x136c33){_0xac2821=_0xac2821-0x0;var _0x1f4d3f=_0xdc66[_0xac2821];return _0x1f4d3f;};'use strict';var Sequelize=require(_0x6dc6('0x0'));module['exports']={'name':{'type':Sequelize[_0x6dc6('0x1')],'unique':_0x6dc6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6dc6('0x1')]},'timeout':{'type':Sequelize[_0x6dc6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6dc6('0x4')]('rrmemory','beepall',_0x6dc6('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c4eb8a2..03da6a5 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 _0xa13a=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','redis','defaults','localhost','sendStatus','status','end','json','undefined','limit','count','offset','apply','save','update','destroy','get','SmsQueues','UserProfileResource','then','error','name','send','index','SmsQueue','rawAttributes','type','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','sort','SmsQueueId','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','emit','userSmsQueue:save','removeTeams','ids','select','tq.TeamId','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5a0484,_0x569844){var _0x240275=function(_0x5c8367){while(--_0x5c8367){_0x5a0484['push'](_0x5a0484['shift']());}};_0x240275(++_0x569844);}(_0xa13a,0x78));var _0xaa13=function(_0x66afa6,_0x24566a){_0x66afa6=_0x66afa6-0x0;var _0x264d0c=_0xa13a[_0x66afa6];return _0x264d0c;};'use strict';var emlformat=require(_0xaa13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa13('0x1'));var jsonpatch=require(_0xaa13('0x2'));var rp=require(_0xaa13('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaa13('0x4'));var util=require('util');var path=require(_0xaa13('0x5'));var sox=require('sox');var csv=require(_0xaa13('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa13('0x7'));var squel=require(_0xaa13('0x8'));var crypto=require(_0xaa13('0x9'));var jsforce=require(_0xaa13('0xa'));var deskjs=require(_0xaa13('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaa13('0xc'));var Papa=require(_0xaa13('0xd'));var Redis=require('ioredis');var authService=require(_0xaa13('0xe'));var qs=require(_0xaa13('0xf'));var as=require(_0xaa13('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa13('0x11'));var utils=require('../../config/utils');var config=require(_0xaa13('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xaa13('0x13')]=_[_0xaa13('0x14')](config[_0xaa13('0x13')],{'host':_0xaa13('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x73ae25,_0x321884){_0x321884=_0x321884||0xcc;return function(_0x20da15){if(_0x20da15){return _0x73ae25[_0xaa13('0x16')](_0x321884);}return _0x73ae25[_0xaa13('0x17')](_0x321884)[_0xaa13('0x18')]();};}function respondWithResult(_0x4c6e6d,_0x591f2b){_0x591f2b=_0x591f2b||0xc8;return function(_0x2c1515){if(_0x2c1515){return _0x4c6e6d[_0xaa13('0x17')](_0x591f2b)[_0xaa13('0x19')](_0x2c1515);}};}function respondWithFilteredResult(_0x57cf19,_0x1b892c){return function(_0x515a08){if(_0x515a08){var _0x59bb9a=typeof _0x1b892c['offset']===_0xaa13('0x1a')&&typeof _0x1b892c[_0xaa13('0x1b')]==='undefined';var _0x4f006b=_0x515a08[_0xaa13('0x1c')];var _0x299738=_0x59bb9a?0x0:_0x1b892c[_0xaa13('0x1d')];var _0x35c2b1=_0x59bb9a?_0x515a08['count']:_0x1b892c[_0xaa13('0x1d')]+_0x1b892c['limit'];var _0x3c487e;if(_0x35c2b1>=_0x4f006b){_0x35c2b1=_0x4f006b;_0x3c487e=0xc8;}else{_0x3c487e=0xce;}_0x57cf19['status'](_0x3c487e);return _0x57cf19['set']('Content-Range',_0x299738+'-'+_0x35c2b1+'/'+_0x4f006b)['json'](_0x515a08);}return null;};}function patchUpdates(_0x3dbd62){return function(_0x769259){try{jsonpatch[_0xaa13('0x1e')](_0x769259,_0x3dbd62,!![]);}catch(_0x6213d7){return BPromise['reject'](_0x6213d7);}return _0x769259[_0xaa13('0x1f')]();};}function saveUpdates(_0xab4b52,_0x37035d){return function(_0x4ad454){if(_0x4ad454){return _0x4ad454[_0xaa13('0x20')](_0xab4b52)['then'](function(_0x24bfa3){return _0x24bfa3;});}return null;};}function removeEntity(_0x1b2bb7,_0x56c58b){return function(_0x443ed5){if(_0x443ed5){return _0x443ed5[_0xaa13('0x21')]()['then'](function(){var _0x575dcb=_0x443ed5[_0xaa13('0x22')]({'plain':!![]});var _0xa8fa42=_0xaa13('0x23');return db[_0xaa13('0x24')][_0xaa13('0x21')]({'where':{'type':_0xa8fa42,'resourceId':_0x575dcb['id']}})[_0xaa13('0x25')](function(){return _0x443ed5;});})[_0xaa13('0x25')](function(){_0x1b2bb7[_0xaa13('0x17')](0xcc)[_0xaa13('0x18')]();});}};}function handleEntityNotFound(_0x269560,_0x46a3bd){return function(_0x4c482c){if(!_0x4c482c){_0x269560[_0xaa13('0x16')](0x194);}return _0x4c482c;};}function handleError(_0x3e5341,_0x409d0d){_0x409d0d=_0x409d0d||0x1f4;return function(_0x321760){logger[_0xaa13('0x26')](_0x321760['stack']);if(_0x321760[_0xaa13('0x27')]){delete _0x321760['name'];}_0x3e5341[_0xaa13('0x17')](_0x409d0d)[_0xaa13('0x28')](_0x321760);};}exports[_0xaa13('0x29')]=function(_0x35e413,_0x3dd1f0){var _0x34568a={},_0x357f86={},_0x416059={'count':0x0,'rows':[]};var _0x371ba2=_['map'](db[_0xaa13('0x2a')][_0xaa13('0x2b')],function(_0x38c36a){return{'name':_0x38c36a['fieldName'],'type':_0x38c36a[_0xaa13('0x2c')][_0xaa13('0x2d')]};});_0x357f86[_0xaa13('0x2e')]=_[_0xaa13('0x2f')](_0x371ba2,_0xaa13('0x27'));_0x357f86[_0xaa13('0x30')]=_['keys'](_0x35e413['query']);_0x357f86['filters']=_[_0xaa13('0x31')](_0x357f86[_0xaa13('0x2e')],_0x357f86[_0xaa13('0x30')]);_0x34568a['attributes']=_[_0xaa13('0x31')](_0x357f86[_0xaa13('0x2e')],qs['fields'](_0x35e413[_0xaa13('0x30')][_0xaa13('0x32')]));_0x34568a[_0xaa13('0x33')]=_0x34568a[_0xaa13('0x33')]['length']?_0x34568a[_0xaa13('0x33')]:_0x357f86['model'];if(!_0x35e413['query'][_0xaa13('0x34')](_0xaa13('0x35'))){_0x34568a[_0xaa13('0x1b')]=qs['limit'](_0x35e413[_0xaa13('0x30')][_0xaa13('0x1b')]);_0x34568a[_0xaa13('0x1d')]=qs[_0xaa13('0x1d')](_0x35e413[_0xaa13('0x30')][_0xaa13('0x1d')]);}_0x34568a[_0xaa13('0x36')]=qs['sort'](_0x35e413[_0xaa13('0x30')]['sort']);_0x34568a[_0xaa13('0x37')]=qs['filters'](_[_0xaa13('0x38')](_0x35e413[_0xaa13('0x30')],_0x357f86[_0xaa13('0x39')]),_0x371ba2);if(_0x35e413[_0xaa13('0x30')][_0xaa13('0x3a')]){_0x34568a['where']=_['merge'](_0x34568a[_0xaa13('0x37')],{'$or':_[_0xaa13('0x2f')](_0x371ba2,function(_0x2d7a4f){if(_0x2d7a4f[_0xaa13('0x2c')]!==_0xaa13('0x3b')){var _0x26f99f={};_0x26f99f[_0x2d7a4f[_0xaa13('0x27')]]={'$like':'%'+_0x35e413[_0xaa13('0x30')]['filter']+'%'};return _0x26f99f;}})});}_0x34568a=_[_0xaa13('0x3c')]({},_0x34568a,_0x35e413[_0xaa13('0x3d')]);var _0x45bd59={'where':_0x34568a[_0xaa13('0x37')]};return db['SmsQueue']['count'](_0x45bd59)[_0xaa13('0x25')](function(_0x24b4af){_0x416059[_0xaa13('0x1c')]=_0x24b4af;if(_0x35e413[_0xaa13('0x30')][_0xaa13('0x3e')]){_0x34568a[_0xaa13('0x3f')]=[{'all':!![]}];}return db[_0xaa13('0x2a')][_0xaa13('0x40')](_0x34568a);})['then'](function(_0x5d87a6){_0x416059[_0xaa13('0x41')]=_0x5d87a6;return _0x416059;})['then'](respondWithFilteredResult(_0x3dd1f0,_0x34568a))[_0xaa13('0x42')](handleError(_0x3dd1f0,null));};exports['show']=function(_0x1d54dd,_0x2745d4){var _0x357776={'raw':!![],'where':{'id':_0x1d54dd[_0xaa13('0x43')]['id']}},_0x5b0009={};_0x5b0009['model']=_[_0xaa13('0x44')](db[_0xaa13('0x2a')][_0xaa13('0x2b')]);_0x5b0009['query']=_[_0xaa13('0x44')](_0x1d54dd[_0xaa13('0x30')]);_0x5b0009['filters']=_[_0xaa13('0x31')](_0x5b0009[_0xaa13('0x2e')],_0x5b0009[_0xaa13('0x30')]);_0x357776[_0xaa13('0x33')]=_['intersection'](_0x5b0009[_0xaa13('0x2e')],qs[_0xaa13('0x32')](_0x1d54dd[_0xaa13('0x30')][_0xaa13('0x32')]));_0x357776[_0xaa13('0x33')]=_0x357776[_0xaa13('0x33')][_0xaa13('0x45')]?_0x357776[_0xaa13('0x33')]:_0x5b0009[_0xaa13('0x2e')];if(_0x1d54dd[_0xaa13('0x30')]['includeAll']){_0x357776['include']=[{'all':!![]}];}_0x357776=_[_0xaa13('0x3c')]({},_0x357776,_0x1d54dd[_0xaa13('0x3d')]);return db[_0xaa13('0x2a')]['find'](_0x357776)[_0xaa13('0x25')](handleEntityNotFound(_0x2745d4,null))[_0xaa13('0x25')](respondWithResult(_0x2745d4,null))['catch'](handleError(_0x2745d4,null));};exports['create']=function(_0x3893f3,_0x38169b){return db['SmsQueue']['create'](_0x3893f3[_0xaa13('0x46')],{})[_0xaa13('0x25')](function(_0x3897f4){var _0x3222b7=_0x3893f3[_0xaa13('0x47')]['get']({'plain':!![]});if(!_0x3222b7)throw new Error(_0xaa13('0x48'));if(_0x3222b7[_0xaa13('0x49')]===_0xaa13('0x47')){var _0x76cdfd=_0x3897f4['get']({'plain':!![]});var _0x13e8d1=_0xaa13('0x23');return db[_0xaa13('0x4a')][_0xaa13('0x4b')]({'where':{'name':_0x13e8d1,'userProfileId':_0x3222b7[_0xaa13('0x4c')]},'raw':!![]})[_0xaa13('0x25')](function(_0x591d8c){if(_0x591d8c&&_0x591d8c[_0xaa13('0x4d')]===0x0){return db[_0xaa13('0x24')]['create']({'name':_0x76cdfd[_0xaa13('0x27')],'resourceId':_0x76cdfd['id'],'type':_0x591d8c[_0xaa13('0x27')],'sectionId':_0x591d8c['id']},{})[_0xaa13('0x25')](function(){return _0x3897f4;});}else{return _0x3897f4;}})[_0xaa13('0x42')](function(_0x26a06b){logger[_0xaa13('0x26')](_0xaa13('0x4e'),_0x26a06b);throw _0x26a06b;});}return _0x3897f4;})[_0xaa13('0x25')](respondWithResult(_0x38169b,0xc9))['catch'](handleError(_0x38169b,null));};exports[_0xaa13('0x20')]=function(_0x3d4860,_0x171576){if(_0x3d4860[_0xaa13('0x46')]['id']){delete _0x3d4860[_0xaa13('0x46')]['id'];}return db['SmsQueue'][_0xaa13('0x4b')]({'where':{'id':_0x3d4860[_0xaa13('0x43')]['id']}})[_0xaa13('0x25')](handleEntityNotFound(_0x171576,null))['then'](saveUpdates(_0x3d4860[_0xaa13('0x46')],null))[_0xaa13('0x25')](respondWithResult(_0x171576,null))[_0xaa13('0x42')](handleError(_0x171576,null));};exports[_0xaa13('0x21')]=function(_0x4c5586,_0x3c225e){return db[_0xaa13('0x2a')]['find']({'where':{'id':_0x4c5586[_0xaa13('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c225e,null))[_0xaa13('0x25')](removeEntity(_0x3c225e,null))['catch'](handleError(_0x3c225e,null));};exports[_0xaa13('0x4f')]=function(_0x4865b6,_0x10a9b3){return db[_0xaa13('0x2a')][_0xaa13('0x4f')]()[_0xaa13('0x25')](respondWithResult(_0x10a9b3,null))[_0xaa13('0x42')](handleError(_0x10a9b3,null));};exports['getMembers']=function(_0x42fda2,_0x443b4c,_0x25103c){var _0x5235f2={'raw':!![],'where':{}},_0x1ff761={},_0x2361e6;return db[_0xaa13('0x2a')][_0xaa13('0x50')]({'where':{'id':_0x42fda2[_0xaa13('0x43')]['id']}})['then'](handleEntityNotFound(_0x443b4c,null))[_0xaa13('0x25')](function(_0x6980d0){if(_0x6980d0){_0x2361e6=_0x6980d0['get']({'plain':!![]});_0x1ff761[_0xaa13('0x2e')]=_[_0xaa13('0x44')](db[_0xaa13('0x51')][_0xaa13('0x2b')]);_0x1ff761[_0xaa13('0x30')]=_[_0xaa13('0x44')](_0x42fda2['query']);_0x1ff761[_0xaa13('0x39')]=_['intersection'](_0x1ff761[_0xaa13('0x2e')],_0x1ff761[_0xaa13('0x30')]);_0x5235f2[_0xaa13('0x33')]=_[_0xaa13('0x31')](_0x1ff761[_0xaa13('0x2e')],qs[_0xaa13('0x32')](_0x42fda2[_0xaa13('0x30')][_0xaa13('0x32')]));_0x5235f2[_0xaa13('0x33')]=_0x5235f2[_0xaa13('0x33')]['length']?_0x5235f2[_0xaa13('0x33')]:_0x1ff761[_0xaa13('0x2e')];if(!_0x42fda2[_0xaa13('0x30')][_0xaa13('0x34')](_0xaa13('0x35'))){_0x5235f2[_0xaa13('0x1b')]=qs[_0xaa13('0x1b')](_0x42fda2[_0xaa13('0x30')][_0xaa13('0x1b')]);_0x5235f2[_0xaa13('0x1d')]=qs[_0xaa13('0x1d')](_0x42fda2[_0xaa13('0x30')][_0xaa13('0x1d')]);}_0x5235f2['order']=qs[_0xaa13('0x52')](_0x42fda2['query'][_0xaa13('0x52')]);_0x5235f2[_0xaa13('0x37')]=qs[_0xaa13('0x39')](_[_0xaa13('0x38')](_0x42fda2[_0xaa13('0x30')],_0x1ff761[_0xaa13('0x39')]));_0x5235f2['where'][_0xaa13('0x53')]=_0x6980d0['id'];if(_0x42fda2[_0xaa13('0x30')][_0xaa13('0x3a')]){_0x5235f2['where']=_[_0xaa13('0x3c')](_0x5235f2[_0xaa13('0x37')],{'$or':_[_0xaa13('0x2f')](_0x5235f2[_0xaa13('0x33')],function(_0x20336a){var _0xb335b7={};_0xb335b7[_0x20336a]={'$like':'%'+_0x42fda2['query'][_0xaa13('0x3a')]+'%'};return _0xb335b7;})});}_0x5235f2=_[_0xaa13('0x3c')]({},_0x5235f2,_0x42fda2[_0xaa13('0x3d')]);return db[_0xaa13('0x51')][_0xaa13('0x40')](_0x5235f2);}})[_0xaa13('0x25')](function(_0x28b315){if(_0x28b315){return db[_0xaa13('0x54')][_0xaa13('0x55')]({'where':{'id':_[_0xaa13('0x2f')](_0x28b315,'UserId'),'role':_0xaa13('0x56')},'attributes':['id','name',_0xaa13('0x57'),_0xaa13('0x58'),_0xaa13('0x59')]});}})[_0xaa13('0x25')](function(_0x1bd5b3){if(_0x1bd5b3){return{'count':_0x1bd5b3['count'],'rows':_[_0xaa13('0x2f')](_0x1bd5b3[_0xaa13('0x41')],function(_0x26b2c0){return{'membername':_0x26b2c0['name'],'UserId':_0x26b2c0['id'],'queue_name':_0x2361e6[_0xaa13('0x27')],'SmsQueueId':_0x2361e6['id'],'interface':util[_0xaa13('0x5a')]('%s/%s',_0xaa13('0x5b'),_0x26b2c0[_0xaa13('0x27')]),'penalty':0x0,'paused':_0x26b2c0[_0xaa13('0x57')],'createdAt':_0x26b2c0[_0xaa13('0x59')],'updatedAt':_0x26b2c0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa13('0x25')](respondWithFilteredResult(_0x443b4c,_0x5235f2))[_0xaa13('0x42')](handleError(_0x443b4c,null));};exports[_0xaa13('0x5c')]=function(_0x34d121,_0x3d1ed2,_0xd28a32){var _0x5a0224={};var _0x122da9={};var _0x941694;var _0x59c86c;return db[_0xaa13('0x2a')]['findOne']({'where':{'id':_0x34d121[_0xaa13('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d1ed2,null))[_0xaa13('0x25')](function(_0x30fe4c){if(_0x30fe4c){_0x941694=_0x30fe4c;_0x122da9[_0xaa13('0x2e')]=_[_0xaa13('0x44')](db[_0xaa13('0x5d')][_0xaa13('0x2b')]);_0x122da9[_0xaa13('0x30')]=_[_0xaa13('0x44')](_0x34d121[_0xaa13('0x30')]);_0x122da9[_0xaa13('0x39')]=_[_0xaa13('0x31')](_0x122da9[_0xaa13('0x2e')],_0x122da9[_0xaa13('0x30')]);_0x5a0224['attributes']=_[_0xaa13('0x31')](_0x122da9[_0xaa13('0x2e')],qs[_0xaa13('0x32')](_0x34d121[_0xaa13('0x30')][_0xaa13('0x32')]));_0x5a0224['attributes']=_0x5a0224[_0xaa13('0x33')][_0xaa13('0x45')]?_0x5a0224[_0xaa13('0x33')]:_0x122da9[_0xaa13('0x2e')];_0x5a0224[_0xaa13('0x36')]=qs[_0xaa13('0x52')](_0x34d121['query'][_0xaa13('0x52')]);_0x5a0224[_0xaa13('0x37')]=qs[_0xaa13('0x39')](_[_0xaa13('0x38')](_0x34d121[_0xaa13('0x30')],_0x122da9[_0xaa13('0x39')]));if(_0x34d121[_0xaa13('0x30')]['filter']){_0x5a0224[_0xaa13('0x37')]=_[_0xaa13('0x3c')](_0x5a0224['where'],{'$or':_[_0xaa13('0x2f')](_0x5a0224[_0xaa13('0x33')],function(_0x347436){var _0x45ecc8={};_0x45ecc8[_0x347436]={'$like':'%'+_0x34d121[_0xaa13('0x30')][_0xaa13('0x3a')]+'%'};return _0x45ecc8;})});}_0x5a0224=_[_0xaa13('0x3c')]({},_0x5a0224,_0x34d121[_0xaa13('0x3d')]);return _0x941694['getTeams'](_0x5a0224);}})[_0xaa13('0x25')](function(_0x430de3){if(_0x430de3){_0x59c86c=_0x430de3['length'];if(!_0x34d121['query'][_0xaa13('0x34')]('nolimit')){_0x5a0224['limit']=qs[_0xaa13('0x1b')](_0x34d121[_0xaa13('0x30')][_0xaa13('0x1b')]);_0x5a0224[_0xaa13('0x1d')]=qs[_0xaa13('0x1d')](_0x34d121[_0xaa13('0x30')]['offset']);}return _0x941694['getTeams'](_0x5a0224);}})[_0xaa13('0x25')](function(_0x521862){if(_0x521862){return _0x521862?{'count':_0x59c86c,'rows':_0x521862}:null;}})[_0xaa13('0x25')](respondWithResult(_0x3d1ed2,null))[_0xaa13('0x42')](handleError(_0x3d1ed2,null));};exports['addTeams']=function(_0x952495,_0xc4e392,_0x2d9c57){var _0x4efb25=_0x952495[_0xaa13('0x46')]['ids'];return db[_0xaa13('0x5d')][_0xaa13('0x40')]({'where':{'id':_0x4efb25},'attributes':['id'],'include':[{'model':db['User'],'as':_0xaa13('0x5e'),'attributes':['id',_0xaa13('0x27'),_0xaa13('0x5f'),_0xaa13('0x60'),_0xaa13('0x61')],'raw':!![]}]})[_0xaa13('0x25')](function(_0x47a670){if(_0x47a670){var _0x50d6da=_[_0xaa13('0x62')](_0x47a670,function(_0xeac37b){var _0x5c5110=_0xeac37b[_0xaa13('0x22')]({'plain':!![]});return _0x5c5110['Agents'];});return db[_0xaa13('0x2a')][_0xaa13('0x4b')]({'where':{'id':_0x952495[_0xaa13('0x43')]['id']}})['then'](function(_0x4ee8c6){return db[_0xaa13('0x63')]['transaction'](function(_0x136a15){return _0x4ee8c6[_0xaa13('0x64')](_0x4efb25,{'transaction':_0x136a15})[_0xaa13('0x25')](function(){return BPromise[_0xaa13('0x65')](_0x50d6da,function(_0x9f5d8d){return db[_0xaa13('0x51')][_0xaa13('0x66')]({'where':{'UserId':_0x9f5d8d['id'],'SmsQueueId':_0x952495[_0xaa13('0x43')]['id']},'transaction':_0x136a15});});})[_0xaa13('0x25')](function(){_0x50d6da['forEach'](function(_0x40c42a){socket[_0xaa13('0x67')](_0xaa13('0x68'),{'UserId':_0x40c42a['id'],'SmsQueueId':_0x4ee8c6['id']});});});});});}})['then'](respondWithStatusCode(_0xc4e392,null))[_0xaa13('0x42')](handleError(_0xc4e392,null));};exports[_0xaa13('0x69')]=function(_0x11541e,_0x1dda1e,_0x411797){return db[_0xaa13('0x5d')][_0xaa13('0x40')]({'where':{'id':_0x11541e['query'][_0xaa13('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xaa13('0x54')],'as':_0xaa13('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1dda1e,null))[_0xaa13('0x25')](function(_0x2078c9){var _0x2abc12=_[_0xaa13('0x2f')](_0x2078c9,'id');var _0x3b4263=[];var _0x37b665=[];var _0x3bd48d=squel[_0xaa13('0x6b')]();_0x3bd48d['field'](_0xaa13('0x6c'))['from']('team_has_sms_queues','tq')[_0xaa13('0x6d')](_0xaa13('0x6e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xaa13('0x37')](_0xaa13('0x6f'),_0x11541e[_0xaa13('0x43')]['id']);for(var _0x449698=0x0;_0x449698<_0x2078c9[_0xaa13('0x45')];_0x449698+=0x1){let _0x5cd92d=_0x2078c9[_0x449698];for(var _0x28cea0=0x0;_0x28cea0<_0x5cd92d[_0xaa13('0x5e')]['length'];_0x28cea0+=0x1){let _0x167352=_0x5cd92d[_0xaa13('0x5e')][_0x28cea0];var _0x20fba4=_0x3bd48d[_0xaa13('0x70')]();_0x20fba4[_0xaa13('0x37')](_0xaa13('0x71'),_0x167352['id']);_0x37b665[_0xaa13('0x72')](db[_0xaa13('0x63')][_0xaa13('0x30')](_0x20fba4[_0xaa13('0x73')](),{'type':db[_0xaa13('0x63')]['QueryTypes']['SELECT']})[_0xaa13('0x25')](function(_0xeda07b){if(_0xeda07b[_0xaa13('0x45')]===0x1){return _0x167352['id'];}else{var _0x52d252=_[_0xaa13('0x74')](_[_0xaa13('0x2f')](_0xeda07b,_0xaa13('0x75')),function(_0x135603){return _[_0xaa13('0x76')](_0x2abc12,_0x135603);});if(_0x52d252){return _0x167352['id'];}}}));}}return BPromise[_0xaa13('0x77')](_0x37b665)[_0xaa13('0x25')](function(_0x514aae){_0x3b4263=_(_0x3b4263)[_0xaa13('0x78')](_0x514aae)[_0xaa13('0x79')]()[_0xaa13('0x7a')]();return db['SmsQueue'][_0xaa13('0x4b')]({'where':{'id':_0x11541e[_0xaa13('0x43')]['id']}})[_0xaa13('0x25')](function(_0x5a2e1e){return db[_0xaa13('0x63')][_0xaa13('0x7b')](function(_0x24f1a3){return _0x5a2e1e[_0xaa13('0x69')](_0x11541e['query'][_0xaa13('0x6a')],{'transaction':_0x24f1a3})[_0xaa13('0x25')](function(){if(!_[_0xaa13('0x7c')](_0x3b4263)){return _0x5a2e1e[_0xaa13('0x7d')](_0x3b4263,{'transaction':_0x24f1a3});}})['then'](function(){_0x3b4263[_0xaa13('0x7e')](function(_0x114523){socket[_0xaa13('0x67')](_0xaa13('0x7f'),{'UserId':_0x114523,'SmsQueueId':_0x5a2e1e['id']});});});});});});})[_0xaa13('0x25')](respondWithStatusCode(_0x1dda1e,null))['catch'](handleError(_0x1dda1e,null));};exports[_0xaa13('0x80')]=function(_0x5c1d99,_0xf24ee9,_0x38c882){return db[_0xaa13('0x2a')]['find']({'where':{'id':_0x5c1d99['params']['id']}})[_0xaa13('0x25')](handleEntityNotFound(_0xf24ee9,null))[_0xaa13('0x25')](function(_0x120441){if(_0x120441){return _0x120441[_0xaa13('0x80')](_0x5c1d99['body'][_0xaa13('0x6a')],_[_0xaa13('0x81')](_0x5c1d99[_0xaa13('0x46')],[_0xaa13('0x6a'),'id'])||{})[_0xaa13('0x82')](function(_0x41b35c){for(var _0x53987f=0x0;_0x53987f<_0x5c1d99[_0xaa13('0x46')][_0xaa13('0x6a')][_0xaa13('0x45')];_0x53987f+=0x1){socket[_0xaa13('0x67')](_0xaa13('0x68'),{'UserId':Number(_0x5c1d99['body'][_0xaa13('0x6a')][_0x53987f]),'SmsQueueId':Number(_0x5c1d99[_0xaa13('0x43')]['id'])});}return _0x41b35c;});}})['then'](respondWithResult(_0xf24ee9,null))[_0xaa13('0x42')](handleError(_0xf24ee9,null));};exports[_0xaa13('0x7d')]=function(_0x517f2c,_0x45dee3,_0x5d25d5){return db[_0xaa13('0x2a')]['find']({'where':{'id':_0x517f2c[_0xaa13('0x43')]['id']}})['then'](handleEntityNotFound(_0x45dee3,null))[_0xaa13('0x25')](function(_0x24ba6f){if(_0x24ba6f){return _0x24ba6f['removeAgents'](_0x517f2c[_0xaa13('0x30')]['ids'])[_0xaa13('0x25')](function(){if(_[_0xaa13('0x83')](_0x517f2c[_0xaa13('0x30')][_0xaa13('0x6a')])){for(var _0x54ac9d=0x0;_0x54ac9d<_0x517f2c[_0xaa13('0x30')][_0xaa13('0x6a')]['length'];_0x54ac9d+=0x1){socket[_0xaa13('0x67')](_0xaa13('0x7f'),{'UserId':Number(_0x517f2c[_0xaa13('0x30')]['ids'][_0x54ac9d]),'SmsQueueId':Number(_0x517f2c['params']['id'])});}}else{socket[_0xaa13('0x67')]('userSmsQueue:remove',{'UserId':Number(_0x517f2c['query']['ids']),'SmsQueueId':Number(_0x517f2c[_0xaa13('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x45dee3,null))[_0xaa13('0x42')](handleError(_0x45dee3,null));};exports['getAgents']=function(_0x4418ae,_0x32c839,_0x1ca8f4){var _0x314f93={};var _0x38022a={};var _0x37b4b7;var _0x4d808e;return db['SmsQueue']['findOne']({'where':{'id':_0x4418ae[_0xaa13('0x43')]['id']}})[_0xaa13('0x25')](handleEntityNotFound(_0x32c839,null))['then'](function(_0x3e2c22){if(_0x3e2c22){_0x37b4b7=_0x3e2c22;_0x38022a[_0xaa13('0x2e')]=_[_0xaa13('0x44')](db[_0xaa13('0x54')]['rawAttributes']);_0x38022a[_0xaa13('0x30')]=_[_0xaa13('0x44')](_0x4418ae[_0xaa13('0x30')]);_0x38022a[_0xaa13('0x39')]=_[_0xaa13('0x31')](_0x38022a[_0xaa13('0x2e')],_0x38022a[_0xaa13('0x30')]);_0x314f93[_0xaa13('0x33')]=_[_0xaa13('0x31')](_0x38022a[_0xaa13('0x2e')],qs['fields'](_0x4418ae[_0xaa13('0x30')][_0xaa13('0x32')]));_0x314f93[_0xaa13('0x33')]=_0x314f93[_0xaa13('0x33')][_0xaa13('0x45')]?_0x314f93[_0xaa13('0x33')]:_0x38022a['model'];_0x314f93[_0xaa13('0x36')]=qs[_0xaa13('0x52')](_0x4418ae[_0xaa13('0x30')][_0xaa13('0x52')]);_0x314f93['where']=qs[_0xaa13('0x39')](_['pick'](_0x4418ae[_0xaa13('0x30')],_0x38022a['filters']));if(_0x4418ae[_0xaa13('0x30')][_0xaa13('0x3a')]){_0x314f93[_0xaa13('0x37')]=_[_0xaa13('0x3c')](_0x314f93[_0xaa13('0x37')],{'$or':_[_0xaa13('0x2f')](_0x314f93[_0xaa13('0x33')],function(_0x153bac){var _0x3d22c5={};_0x3d22c5[_0x153bac]={'$like':'%'+_0x4418ae['query'][_0xaa13('0x3a')]+'%'};return _0x3d22c5;})});}_0x314f93=_[_0xaa13('0x3c')]({},_0x314f93,_0x4418ae[_0xaa13('0x3d')]);return _0x37b4b7[_0xaa13('0x84')](_0x314f93);}})[_0xaa13('0x25')](function(_0x11763e){if(_0x11763e){_0x4d808e=_0x11763e[_0xaa13('0x45')];if(!_0x4418ae['query'][_0xaa13('0x34')](_0xaa13('0x35'))){_0x314f93[_0xaa13('0x1b')]=qs[_0xaa13('0x1b')](_0x4418ae['query']['limit']);_0x314f93[_0xaa13('0x1d')]=qs[_0xaa13('0x1d')](_0x4418ae[_0xaa13('0x30')][_0xaa13('0x1d')]);}return _0x37b4b7[_0xaa13('0x84')](_0x314f93);}})[_0xaa13('0x25')](function(_0x419124){if(_0x419124){return _0x419124?{'count':_0x4d808e,'rows':_0x419124}:null;}})['then'](respondWithResult(_0x32c839,null))[_0xaa13('0x42')](handleError(_0x32c839,null));}; \ No newline at end of file +var _0xf10f=['userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','SmsQueueId','filter','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','rows','%s/%s','SIP','getTeams','Team','addTeams','voicePause','interface','Agents','transaction','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','union','compact','value','removeTeams','ids','isEmpty','removeAgents','userSmsQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','SmsQueues','end','error','name','send','index','map','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','options','SmsQueue','includeAll','include','findAll','show','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find'];(function(_0x18b548,_0x43b771){var _0x2141b6=function(_0x1ba849){while(--_0x1ba849){_0x18b548['push'](_0x18b548['shift']());}};_0x2141b6(++_0x43b771);}(_0xf10f,0x15a));var _0xff10=function(_0x35670c,_0x2fbf8a){_0x35670c=_0x35670c-0x0;var _0x56c211=_0xf10f[_0x35670c];return _0x56c211;};'use strict';var emlformat=require(_0xff10('0x0'));var rimraf=require(_0xff10('0x1'));var zipdir=require(_0xff10('0x2'));var jsonpatch=require(_0xff10('0x3'));var rp=require('request-promise');var moment=require(_0xff10('0x4'));var BPromise=require(_0xff10('0x5'));var Mustache=require(_0xff10('0x6'));var util=require('util');var path=require(_0xff10('0x7'));var sox=require(_0xff10('0x8'));var csv=require(_0xff10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff10('0xa'));var _=require(_0xff10('0xb'));var squel=require(_0xff10('0xc'));var crypto=require(_0xff10('0xd'));var jsforce=require(_0xff10('0xe'));var deskjs=require(_0xff10('0xf'));var toCsv=require('to-csv');var querystring=require(_0xff10('0x10'));var Papa=require('papaparse');var Redis=require(_0xff10('0x11'));var authService=require(_0xff10('0x12'));var qs=require(_0xff10('0x13'));var as=require(_0xff10('0x14'));var hardwareService=require(_0xff10('0x15'));var logger=require('../../config/logger')(_0xff10('0x16'));var utils=require(_0xff10('0x17'));var config=require(_0xff10('0x18'));var licenseUtil=require(_0xff10('0x19'));var db=require(_0xff10('0x1a'))['db'];config[_0xff10('0x1b')]=_[_0xff10('0x1c')](config[_0xff10('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xff10('0x1d'))(new Redis(config['redis']));require(_0xff10('0x1e'))[_0xff10('0x1f')](socket);function respondWithStatusCode(_0x2c73aa,_0x13d0d1){_0x13d0d1=_0x13d0d1||0xcc;return function(_0x85b141){if(_0x85b141){return _0x2c73aa[_0xff10('0x20')](_0x13d0d1);}return _0x2c73aa[_0xff10('0x21')](_0x13d0d1)['end']();};}function respondWithResult(_0xcc6a3e,_0x2bab21){_0x2bab21=_0x2bab21||0xc8;return function(_0x5936dc){if(_0x5936dc){return _0xcc6a3e[_0xff10('0x21')](_0x2bab21)[_0xff10('0x22')](_0x5936dc);}};}function respondWithFilteredResult(_0x527f81,_0x6b5177){return function(_0x83e7ea){if(_0x83e7ea){var _0x302d15=typeof _0x6b5177[_0xff10('0x23')]===_0xff10('0x24')&&typeof _0x6b5177[_0xff10('0x25')]==='undefined';var _0x3d9f3d=_0x83e7ea[_0xff10('0x26')];var _0x53023f=_0x302d15?0x0:_0x6b5177[_0xff10('0x23')];var _0x7a9386=_0x302d15?_0x83e7ea[_0xff10('0x26')]:_0x6b5177[_0xff10('0x23')]+_0x6b5177[_0xff10('0x25')];var _0x3e47fe;if(_0x7a9386>=_0x3d9f3d){_0x7a9386=_0x3d9f3d;_0x3e47fe=0xc8;}else{_0x3e47fe=0xce;}_0x527f81['status'](_0x3e47fe);return _0x527f81[_0xff10('0x27')](_0xff10('0x28'),_0x53023f+'-'+_0x7a9386+'/'+_0x3d9f3d)[_0xff10('0x22')](_0x83e7ea);}return null;};}function patchUpdates(_0x1d71d2){return function(_0x3e4ce9){try{jsonpatch[_0xff10('0x29')](_0x3e4ce9,_0x1d71d2,!![]);}catch(_0x5ad9e1){return BPromise[_0xff10('0x2a')](_0x5ad9e1);}return _0x3e4ce9[_0xff10('0x2b')]();};}function saveUpdates(_0x107dcb,_0x5945c4){return function(_0x8255a1){if(_0x8255a1){return _0x8255a1[_0xff10('0x2c')](_0x107dcb)['then'](function(_0x396331){return _0x396331;});}return null;};}function removeEntity(_0x1d0bcf,_0x1a5a25){return function(_0x20eb04){if(_0x20eb04){return _0x20eb04[_0xff10('0x2d')]()[_0xff10('0x2e')](function(){var _0x27232e=_0x20eb04[_0xff10('0x2f')]({'plain':!![]});var _0x24d4b2=_0xff10('0x30');return db['UserProfileResource'][_0xff10('0x2d')]({'where':{'type':_0x24d4b2,'resourceId':_0x27232e['id']}})[_0xff10('0x2e')](function(){return _0x20eb04;});})['then'](function(){_0x1d0bcf['status'](0xcc)[_0xff10('0x31')]();});}};}function handleEntityNotFound(_0x25c656,_0x22214c){return function(_0x4ae9f5){if(!_0x4ae9f5){_0x25c656['sendStatus'](0x194);}return _0x4ae9f5;};}function handleError(_0x249c8e,_0x1d0b41){_0x1d0b41=_0x1d0b41||0x1f4;return function(_0x285757){logger[_0xff10('0x32')](_0x285757['stack']);if(_0x285757[_0xff10('0x33')]){delete _0x285757[_0xff10('0x33')];}_0x249c8e['status'](_0x1d0b41)[_0xff10('0x34')](_0x285757);};}exports[_0xff10('0x35')]=function(_0xfaef74,_0x44fd1e){var _0x167498={},_0x280574={},_0x462b3c={'count':0x0,'rows':[]};var _0xa0ea6d=_[_0xff10('0x36')](db['SmsQueue'][_0xff10('0x37')],function(_0x23d0b6){return{'name':_0x23d0b6['fieldName'],'type':_0x23d0b6['type'][_0xff10('0x38')]};});_0x280574[_0xff10('0x39')]=_[_0xff10('0x36')](_0xa0ea6d,_0xff10('0x33'));_0x280574[_0xff10('0x3a')]=_['keys'](_0xfaef74['query']);_0x280574['filters']=_[_0xff10('0x3b')](_0x280574[_0xff10('0x39')],_0x280574[_0xff10('0x3a')]);_0x167498['attributes']=_[_0xff10('0x3b')](_0x280574[_0xff10('0x39')],qs[_0xff10('0x3c')](_0xfaef74['query']['fields']));_0x167498[_0xff10('0x3d')]=_0x167498['attributes'][_0xff10('0x3e')]?_0x167498['attributes']:_0x280574[_0xff10('0x39')];if(!_0xfaef74[_0xff10('0x3a')][_0xff10('0x3f')](_0xff10('0x40'))){_0x167498[_0xff10('0x25')]=qs['limit'](_0xfaef74[_0xff10('0x3a')][_0xff10('0x25')]);_0x167498[_0xff10('0x23')]=qs[_0xff10('0x23')](_0xfaef74[_0xff10('0x3a')]['offset']);}_0x167498[_0xff10('0x41')]=qs['sort'](_0xfaef74[_0xff10('0x3a')][_0xff10('0x42')]);_0x167498[_0xff10('0x43')]=qs['filters'](_[_0xff10('0x44')](_0xfaef74['query'],_0x280574[_0xff10('0x45')]),_0xa0ea6d);if(_0xfaef74[_0xff10('0x3a')]['filter']){_0x167498[_0xff10('0x43')]=_[_0xff10('0x46')](_0x167498[_0xff10('0x43')],{'$or':_[_0xff10('0x36')](_0xa0ea6d,function(_0x2ca546){if(_0x2ca546[_0xff10('0x47')]!==_0xff10('0x48')){var _0x4ddf83={};_0x4ddf83[_0x2ca546[_0xff10('0x33')]]={'$like':'%'+_0xfaef74[_0xff10('0x3a')]['filter']+'%'};return _0x4ddf83;}})});}_0x167498=_[_0xff10('0x46')]({},_0x167498,_0xfaef74[_0xff10('0x49')]);var _0x2b2c66={'where':_0x167498[_0xff10('0x43')]};return db[_0xff10('0x4a')][_0xff10('0x26')](_0x2b2c66)[_0xff10('0x2e')](function(_0x33a9f7){_0x462b3c[_0xff10('0x26')]=_0x33a9f7;if(_0xfaef74['query'][_0xff10('0x4b')]){_0x167498[_0xff10('0x4c')]=[{'all':!![]}];}return db[_0xff10('0x4a')][_0xff10('0x4d')](_0x167498);})[_0xff10('0x2e')](function(_0xc39fbf){_0x462b3c['rows']=_0xc39fbf;return _0x462b3c;})['then'](respondWithFilteredResult(_0x44fd1e,_0x167498))['catch'](handleError(_0x44fd1e,null));};exports[_0xff10('0x4e')]=function(_0x4b5d37,_0xe88bd4){var _0x324935={'raw':!![],'where':{'id':_0x4b5d37[_0xff10('0x4f')]['id']}},_0x378003={};_0x378003[_0xff10('0x39')]=_[_0xff10('0x50')](db[_0xff10('0x4a')]['rawAttributes']);_0x378003['query']=_['keys'](_0x4b5d37[_0xff10('0x3a')]);_0x378003[_0xff10('0x45')]=_['intersection'](_0x378003[_0xff10('0x39')],_0x378003['query']);_0x324935['attributes']=_['intersection'](_0x378003[_0xff10('0x39')],qs[_0xff10('0x3c')](_0x4b5d37[_0xff10('0x3a')][_0xff10('0x3c')]));_0x324935[_0xff10('0x3d')]=_0x324935[_0xff10('0x3d')][_0xff10('0x3e')]?_0x324935['attributes']:_0x378003[_0xff10('0x39')];if(_0x4b5d37[_0xff10('0x3a')][_0xff10('0x4b')]){_0x324935['include']=[{'all':!![]}];}_0x324935=_[_0xff10('0x46')]({},_0x324935,_0x4b5d37[_0xff10('0x49')]);return db[_0xff10('0x4a')]['find'](_0x324935)[_0xff10('0x2e')](handleEntityNotFound(_0xe88bd4,null))[_0xff10('0x2e')](respondWithResult(_0xe88bd4,null))[_0xff10('0x51')](handleError(_0xe88bd4,null));};exports[_0xff10('0x52')]=function(_0x3fdbb4,_0x2a062f){return db[_0xff10('0x4a')][_0xff10('0x52')](_0x3fdbb4[_0xff10('0x53')],{})['then'](function(_0x4327f5){var _0xb55172=_0x3fdbb4[_0xff10('0x54')]['get']({'plain':!![]});if(!_0xb55172)throw new Error(_0xff10('0x55'));if(_0xb55172[_0xff10('0x56')]===_0xff10('0x54')){var _0x190ff7=_0x4327f5[_0xff10('0x2f')]({'plain':!![]});var _0x2cc5ed=_0xff10('0x30');return db[_0xff10('0x57')][_0xff10('0x58')]({'where':{'name':_0x2cc5ed,'userProfileId':_0xb55172[_0xff10('0x59')]},'raw':!![]})[_0xff10('0x2e')](function(_0x36c995){if(_0x36c995&&_0x36c995['autoAssociation']===0x0){return db[_0xff10('0x5a')][_0xff10('0x52')]({'name':_0x190ff7[_0xff10('0x33')],'resourceId':_0x190ff7['id'],'type':_0x36c995['name'],'sectionId':_0x36c995['id']},{})['then'](function(){return _0x4327f5;});}else{return _0x4327f5;}})[_0xff10('0x51')](function(_0x24e201){logger[_0xff10('0x32')](_0xff10('0x5b'),_0x24e201);throw _0x24e201;});}return _0x4327f5;})[_0xff10('0x2e')](respondWithResult(_0x2a062f,0xc9))[_0xff10('0x51')](handleError(_0x2a062f,null));};exports[_0xff10('0x2c')]=function(_0x51cccf,_0x5498cf){if(_0x51cccf[_0xff10('0x53')]['id']){delete _0x51cccf['body']['id'];}return db[_0xff10('0x4a')][_0xff10('0x58')]({'where':{'id':_0x51cccf[_0xff10('0x4f')]['id']}})[_0xff10('0x2e')](handleEntityNotFound(_0x5498cf,null))['then'](saveUpdates(_0x51cccf['body'],null))[_0xff10('0x2e')](respondWithResult(_0x5498cf,null))[_0xff10('0x51')](handleError(_0x5498cf,null));};exports[_0xff10('0x2d')]=function(_0x2a0a01,_0x166d09){return db[_0xff10('0x4a')][_0xff10('0x58')]({'where':{'id':_0x2a0a01[_0xff10('0x4f')]['id']}})['then'](handleEntityNotFound(_0x166d09,null))['then'](removeEntity(_0x166d09,null))['catch'](handleError(_0x166d09,null));};exports[_0xff10('0x5c')]=function(_0x120a0e,_0x3ade33){return db[_0xff10('0x4a')][_0xff10('0x5c')]()[_0xff10('0x2e')](respondWithResult(_0x3ade33,null))['catch'](handleError(_0x3ade33,null));};exports['getMembers']=function(_0x864486,_0x3ad0ea,_0x1706ad){var _0x5d1e1a={'raw':!![],'where':{}},_0x3a08cf={},_0x144724;return db[_0xff10('0x4a')][_0xff10('0x5d')]({'where':{'id':_0x864486['params']['id']}})[_0xff10('0x2e')](handleEntityNotFound(_0x3ad0ea,null))[_0xff10('0x2e')](function(_0x1e85f1){if(_0x1e85f1){_0x144724=_0x1e85f1[_0xff10('0x2f')]({'plain':!![]});_0x3a08cf[_0xff10('0x39')]=_['keys'](db['UserSmsQueue'][_0xff10('0x37')]);_0x3a08cf[_0xff10('0x3a')]=_[_0xff10('0x50')](_0x864486[_0xff10('0x3a')]);_0x3a08cf[_0xff10('0x45')]=_['intersection'](_0x3a08cf[_0xff10('0x39')],_0x3a08cf[_0xff10('0x3a')]);_0x5d1e1a[_0xff10('0x3d')]=_[_0xff10('0x3b')](_0x3a08cf[_0xff10('0x39')],qs[_0xff10('0x3c')](_0x864486[_0xff10('0x3a')][_0xff10('0x3c')]));_0x5d1e1a[_0xff10('0x3d')]=_0x5d1e1a[_0xff10('0x3d')][_0xff10('0x3e')]?_0x5d1e1a[_0xff10('0x3d')]:_0x3a08cf[_0xff10('0x39')];if(!_0x864486['query'][_0xff10('0x3f')](_0xff10('0x40'))){_0x5d1e1a[_0xff10('0x25')]=qs['limit'](_0x864486['query'][_0xff10('0x25')]);_0x5d1e1a[_0xff10('0x23')]=qs[_0xff10('0x23')](_0x864486[_0xff10('0x3a')][_0xff10('0x23')]);}_0x5d1e1a[_0xff10('0x41')]=qs[_0xff10('0x42')](_0x864486[_0xff10('0x3a')][_0xff10('0x42')]);_0x5d1e1a[_0xff10('0x43')]=qs['filters'](_[_0xff10('0x44')](_0x864486[_0xff10('0x3a')],_0x3a08cf[_0xff10('0x45')]));_0x5d1e1a[_0xff10('0x43')][_0xff10('0x5e')]=_0x1e85f1['id'];if(_0x864486[_0xff10('0x3a')]['filter']){_0x5d1e1a[_0xff10('0x43')]=_[_0xff10('0x46')](_0x5d1e1a['where'],{'$or':_['map'](_0x5d1e1a['attributes'],function(_0xd5addf){var _0x25a3eb={};_0x25a3eb[_0xd5addf]={'$like':'%'+_0x864486[_0xff10('0x3a')][_0xff10('0x5f')]+'%'};return _0x25a3eb;})});}_0x5d1e1a=_['merge']({},_0x5d1e1a,_0x864486[_0xff10('0x49')]);return db[_0xff10('0x60')][_0xff10('0x4d')](_0x5d1e1a);}})[_0xff10('0x2e')](function(_0x21af6f){if(_0x21af6f){return db[_0xff10('0x61')][_0xff10('0x62')]({'where':{'id':_[_0xff10('0x36')](_0x21af6f,_0xff10('0x63')),'role':_0xff10('0x64')},'attributes':['id',_0xff10('0x33'),_0xff10('0x65'),_0xff10('0x66'),'createdAt']});}})[_0xff10('0x2e')](function(_0x1ef050){if(_0x1ef050){return{'count':_0x1ef050[_0xff10('0x26')],'rows':_[_0xff10('0x36')](_0x1ef050[_0xff10('0x67')],function(_0x1ff3de){return{'membername':_0x1ff3de[_0xff10('0x33')],'UserId':_0x1ff3de['id'],'queue_name':_0x144724[_0xff10('0x33')],'SmsQueueId':_0x144724['id'],'interface':util['format'](_0xff10('0x68'),_0xff10('0x69'),_0x1ff3de[_0xff10('0x33')]),'penalty':0x0,'paused':_0x1ff3de['smsPause'],'createdAt':_0x1ff3de['createdAt'],'updatedAt':_0x1ff3de['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xff10('0x2e')](respondWithFilteredResult(_0x3ad0ea,_0x5d1e1a))[_0xff10('0x51')](handleError(_0x3ad0ea,null));};exports[_0xff10('0x6a')]=function(_0xa2a934,_0x35ba0f,_0x1badd3){var _0x58b65e={};var _0xd54dec={};var _0x3f5d6b;var _0xabf541;return db[_0xff10('0x4a')][_0xff10('0x5d')]({'where':{'id':_0xa2a934[_0xff10('0x4f')]['id']}})['then'](handleEntityNotFound(_0x35ba0f,null))[_0xff10('0x2e')](function(_0x2c9471){if(_0x2c9471){_0x3f5d6b=_0x2c9471;_0xd54dec[_0xff10('0x39')]=_[_0xff10('0x50')](db[_0xff10('0x6b')]['rawAttributes']);_0xd54dec['query']=_['keys'](_0xa2a934['query']);_0xd54dec[_0xff10('0x45')]=_['intersection'](_0xd54dec['model'],_0xd54dec[_0xff10('0x3a')]);_0x58b65e[_0xff10('0x3d')]=_[_0xff10('0x3b')](_0xd54dec[_0xff10('0x39')],qs[_0xff10('0x3c')](_0xa2a934[_0xff10('0x3a')][_0xff10('0x3c')]));_0x58b65e[_0xff10('0x3d')]=_0x58b65e[_0xff10('0x3d')][_0xff10('0x3e')]?_0x58b65e[_0xff10('0x3d')]:_0xd54dec[_0xff10('0x39')];_0x58b65e[_0xff10('0x41')]=qs[_0xff10('0x42')](_0xa2a934[_0xff10('0x3a')][_0xff10('0x42')]);_0x58b65e['where']=qs[_0xff10('0x45')](_[_0xff10('0x44')](_0xa2a934['query'],_0xd54dec[_0xff10('0x45')]));if(_0xa2a934[_0xff10('0x3a')][_0xff10('0x5f')]){_0x58b65e[_0xff10('0x43')]=_[_0xff10('0x46')](_0x58b65e[_0xff10('0x43')],{'$or':_[_0xff10('0x36')](_0x58b65e[_0xff10('0x3d')],function(_0x1af1c9){var _0x32a3fa={};_0x32a3fa[_0x1af1c9]={'$like':'%'+_0xa2a934[_0xff10('0x3a')][_0xff10('0x5f')]+'%'};return _0x32a3fa;})});}_0x58b65e=_[_0xff10('0x46')]({},_0x58b65e,_0xa2a934[_0xff10('0x49')]);return _0x3f5d6b[_0xff10('0x6a')](_0x58b65e);}})[_0xff10('0x2e')](function(_0x4c30fe){if(_0x4c30fe){_0xabf541=_0x4c30fe[_0xff10('0x3e')];if(!_0xa2a934[_0xff10('0x3a')][_0xff10('0x3f')](_0xff10('0x40'))){_0x58b65e[_0xff10('0x25')]=qs[_0xff10('0x25')](_0xa2a934[_0xff10('0x3a')]['limit']);_0x58b65e['offset']=qs[_0xff10('0x23')](_0xa2a934[_0xff10('0x3a')]['offset']);}return _0x3f5d6b[_0xff10('0x6a')](_0x58b65e);}})[_0xff10('0x2e')](function(_0x461176){if(_0x461176){return _0x461176?{'count':_0xabf541,'rows':_0x461176}:null;}})[_0xff10('0x2e')](respondWithResult(_0x35ba0f,null))[_0xff10('0x51')](handleError(_0x35ba0f,null));};exports[_0xff10('0x6c')]=function(_0x498f09,_0x44e0e0,_0x4c9cca){var _0x1370d1=_0x498f09[_0xff10('0x53')]['ids'];return db[_0xff10('0x6b')][_0xff10('0x4d')]({'where':{'id':_0x1370d1},'attributes':['id'],'include':[{'model':db[_0xff10('0x61')],'as':'Agents','attributes':['id',_0xff10('0x33'),'online',_0xff10('0x6d'),_0xff10('0x6e')],'raw':!![]}]})[_0xff10('0x2e')](function(_0x165717){if(_0x165717){var _0x53c8ca=_['flatMap'](_0x165717,function(_0x425fb8){var _0x37b0c2=_0x425fb8[_0xff10('0x2f')]({'plain':!![]});return _0x37b0c2[_0xff10('0x6f')];});return db[_0xff10('0x4a')][_0xff10('0x58')]({'where':{'id':_0x498f09['params']['id']}})[_0xff10('0x2e')](function(_0x5c95c9){return db['sequelize'][_0xff10('0x70')](function(_0xed4c20){return _0x5c95c9[_0xff10('0x6c')](_0x1370d1,{'transaction':_0xed4c20})[_0xff10('0x2e')](function(){return BPromise['each'](_0x53c8ca,function(_0x338f04){return db[_0xff10('0x60')][_0xff10('0x71')]({'where':{'UserId':_0x338f04['id'],'SmsQueueId':_0x498f09[_0xff10('0x4f')]['id']},'transaction':_0xed4c20});});})[_0xff10('0x2e')](function(){_0x53c8ca[_0xff10('0x72')](function(_0x278e61){socket[_0xff10('0x73')](_0xff10('0x74'),{'UserId':_0x278e61['id'],'SmsQueueId':_0x5c95c9['id']});});});});});}})[_0xff10('0x2e')](respondWithStatusCode(_0x44e0e0,null))[_0xff10('0x51')](handleError(_0x44e0e0,null));};exports['removeTeams']=function(_0x382812,_0x424a40,_0x176274){return db[_0xff10('0x6b')]['findAll']({'where':{'id':_0x382812[_0xff10('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xff10('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x424a40,null))[_0xff10('0x2e')](function(_0x24356a){var _0x5e485a=_[_0xff10('0x36')](_0x24356a,'id');var _0x2feb9a=[];var _0x59f618=[];var _0x41ff54=squel[_0xff10('0x75')]();_0x41ff54[_0xff10('0x76')](_0xff10('0x77'))[_0xff10('0x78')]('team_has_sms_queues','tq')[_0xff10('0x79')](_0xff10('0x7a'),'ut',_0xff10('0x7b'))[_0xff10('0x43')](_0xff10('0x7c'),_0x382812['params']['id']);for(var _0x5f47c0=0x0;_0x5f47c0<_0x24356a[_0xff10('0x3e')];_0x5f47c0+=0x1){let _0x10d461=_0x24356a[_0x5f47c0];for(var _0x43371e=0x0;_0x43371e<_0x10d461['Agents'][_0xff10('0x3e')];_0x43371e+=0x1){let _0x32e509=_0x10d461[_0xff10('0x6f')][_0x43371e];var _0x186c16=_0x41ff54[_0xff10('0x7d')]();_0x186c16[_0xff10('0x43')]('ut.UserId\x20=\x20?',_0x32e509['id']);_0x59f618[_0xff10('0x7e')](db['sequelize'][_0xff10('0x3a')](_0x186c16[_0xff10('0x7f')](),{'type':db[_0xff10('0x80')][_0xff10('0x81')][_0xff10('0x82')]})[_0xff10('0x2e')](function(_0x5a9c2a){if(_0x5a9c2a[_0xff10('0x3e')]===0x1){return _0x32e509['id'];}else{var _0x1f15fe=_[_0xff10('0x83')](_['map'](_0x5a9c2a,_0xff10('0x84')),function(_0x3ad390){return _['includes'](_0x5e485a,_0x3ad390);});if(_0x1f15fe){return _0x32e509['id'];}}}));}}return BPromise['all'](_0x59f618)[_0xff10('0x2e')](function(_0x26eb65){_0x2feb9a=_(_0x2feb9a)[_0xff10('0x85')](_0x26eb65)[_0xff10('0x86')]()[_0xff10('0x87')]();return db[_0xff10('0x4a')]['find']({'where':{'id':_0x382812[_0xff10('0x4f')]['id']}})[_0xff10('0x2e')](function(_0x4f3be1){return db[_0xff10('0x80')][_0xff10('0x70')](function(_0x3a22bf){return _0x4f3be1[_0xff10('0x88')](_0x382812[_0xff10('0x3a')][_0xff10('0x89')],{'transaction':_0x3a22bf})[_0xff10('0x2e')](function(){if(!_[_0xff10('0x8a')](_0x2feb9a)){return _0x4f3be1[_0xff10('0x8b')](_0x2feb9a,{'transaction':_0x3a22bf});}})[_0xff10('0x2e')](function(){_0x2feb9a['forEach'](function(_0x526bff){socket['emit'](_0xff10('0x8c'),{'UserId':_0x526bff,'SmsQueueId':_0x4f3be1['id']});});});});});});})[_0xff10('0x2e')](respondWithStatusCode(_0x424a40,null))[_0xff10('0x51')](handleError(_0x424a40,null));};exports['addAgents']=function(_0x105012,_0x59af7f,_0xcc4ba4){return db[_0xff10('0x4a')]['find']({'where':{'id':_0x105012[_0xff10('0x4f')]['id']}})[_0xff10('0x2e')](handleEntityNotFound(_0x59af7f,null))[_0xff10('0x2e')](function(_0x1f72ed){if(_0x1f72ed){return _0x1f72ed['addAgents'](_0x105012[_0xff10('0x53')]['ids'],_[_0xff10('0x8d')](_0x105012['body'],['ids','id'])||{})[_0xff10('0x8e')](function(_0x5766ac){for(var _0x4f2407=0x0;_0x4f2407<_0x105012[_0xff10('0x53')][_0xff10('0x89')]['length'];_0x4f2407+=0x1){socket['emit'](_0xff10('0x74'),{'UserId':Number(_0x105012['body'][_0xff10('0x89')][_0x4f2407]),'SmsQueueId':Number(_0x105012['params']['id'])});}return _0x5766ac;});}})[_0xff10('0x2e')](respondWithResult(_0x59af7f,null))[_0xff10('0x51')](handleError(_0x59af7f,null));};exports[_0xff10('0x8b')]=function(_0x584352,_0x4936eb,_0x151e85){return db[_0xff10('0x4a')][_0xff10('0x58')]({'where':{'id':_0x584352['params']['id']}})[_0xff10('0x2e')](handleEntityNotFound(_0x4936eb,null))[_0xff10('0x2e')](function(_0x12e9fc){if(_0x12e9fc){return _0x12e9fc['removeAgents'](_0x584352[_0xff10('0x3a')][_0xff10('0x89')])[_0xff10('0x2e')](function(){if(_[_0xff10('0x8f')](_0x584352['query']['ids'])){for(var _0x121c42=0x0;_0x121c42<_0x584352['query'][_0xff10('0x89')][_0xff10('0x3e')];_0x121c42+=0x1){socket[_0xff10('0x73')](_0xff10('0x8c'),{'UserId':Number(_0x584352['query']['ids'][_0x121c42]),'SmsQueueId':Number(_0x584352[_0xff10('0x4f')]['id'])});}}else{socket[_0xff10('0x73')](_0xff10('0x8c'),{'UserId':Number(_0x584352[_0xff10('0x3a')][_0xff10('0x89')]),'SmsQueueId':Number(_0x584352[_0xff10('0x4f')]['id'])});}});}})[_0xff10('0x2e')](respondWithStatusCode(_0x4936eb,null))[_0xff10('0x51')](handleError(_0x4936eb,null));};exports[_0xff10('0x90')]=function(_0x152954,_0x4acece,_0x4d9e62){var _0x4b4939={};var _0x5f3390={};var _0x1b51a3;var _0x42ff9e;return db['SmsQueue'][_0xff10('0x5d')]({'where':{'id':_0x152954[_0xff10('0x4f')]['id']}})[_0xff10('0x2e')](handleEntityNotFound(_0x4acece,null))['then'](function(_0x4f6d27){if(_0x4f6d27){_0x1b51a3=_0x4f6d27;_0x5f3390['model']=_['keys'](db[_0xff10('0x61')][_0xff10('0x37')]);_0x5f3390['query']=_[_0xff10('0x50')](_0x152954['query']);_0x5f3390[_0xff10('0x45')]=_[_0xff10('0x3b')](_0x5f3390[_0xff10('0x39')],_0x5f3390['query']);_0x4b4939['attributes']=_[_0xff10('0x3b')](_0x5f3390[_0xff10('0x39')],qs[_0xff10('0x3c')](_0x152954[_0xff10('0x3a')]['fields']));_0x4b4939[_0xff10('0x3d')]=_0x4b4939[_0xff10('0x3d')][_0xff10('0x3e')]?_0x4b4939[_0xff10('0x3d')]:_0x5f3390[_0xff10('0x39')];_0x4b4939['order']=qs[_0xff10('0x42')](_0x152954[_0xff10('0x3a')][_0xff10('0x42')]);_0x4b4939[_0xff10('0x43')]=qs[_0xff10('0x45')](_[_0xff10('0x44')](_0x152954[_0xff10('0x3a')],_0x5f3390[_0xff10('0x45')]));if(_0x152954['query'][_0xff10('0x5f')]){_0x4b4939['where']=_[_0xff10('0x46')](_0x4b4939[_0xff10('0x43')],{'$or':_[_0xff10('0x36')](_0x4b4939[_0xff10('0x3d')],function(_0x33c894){var _0x422949={};_0x422949[_0x33c894]={'$like':'%'+_0x152954[_0xff10('0x3a')][_0xff10('0x5f')]+'%'};return _0x422949;})});}_0x4b4939=_[_0xff10('0x46')]({},_0x4b4939,_0x152954[_0xff10('0x49')]);return _0x1b51a3[_0xff10('0x90')](_0x4b4939);}})[_0xff10('0x2e')](function(_0xe66342){if(_0xe66342){_0x42ff9e=_0xe66342[_0xff10('0x3e')];if(!_0x152954[_0xff10('0x3a')]['hasOwnProperty'](_0xff10('0x40'))){_0x4b4939['limit']=qs[_0xff10('0x25')](_0x152954[_0xff10('0x3a')][_0xff10('0x25')]);_0x4b4939[_0xff10('0x23')]=qs[_0xff10('0x23')](_0x152954['query'][_0xff10('0x23')]);}return _0x1b51a3[_0xff10('0x90')](_0x4b4939);}})[_0xff10('0x2e')](function(_0x237305){if(_0x237305){return _0x237305?{'count':_0x42ff9e,'rows':_0x237305}:null;}})[_0xff10('0x2e')](respondWithResult(_0x4acece,null))[_0xff10('0x51')](handleError(_0x4acece,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a59c4c9..45e1c76 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 _0xaf52=['exports','events','SmsQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xaf52,0x88));var _0x2af5=function(_0x19017b,_0x56d52c){_0x19017b=_0x19017b-0x0;var _0x3becdc=_0xaf52[_0x19017b];return _0x3becdc;};'use strict';var EventEmitter=require(_0x2af5('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x2af5('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2af5('0x2')](0x0);var events={'afterCreate':_0x2af5('0x3'),'afterUpdate':'update','afterDestroy':_0x2af5('0x4')};function emitEvent(_0x2db4a9){return function(_0x3719ab,_0x595b23,_0x205ff3){SmsQueueEvents[_0x2af5('0x5')](_0x2db4a9+':'+_0x3719ab['id'],_0x3719ab);SmsQueueEvents['emit'](_0x2db4a9,_0x3719ab);_0x205ff3(null);};}for(var e in events){if(events[_0x2af5('0x6')](e)){var event=events[e];SmsQueue[_0x2af5('0x7')](e,emitEvent(event));}}module[_0x2af5('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xf02f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','SmsQueue'];(function(_0x51f3df,_0x4738f7){var _0x1ed740=function(_0x2fd7ab){while(--_0x2fd7ab){_0x51f3df['push'](_0x51f3df['shift']());}};_0x1ed740(++_0x4738f7);}(_0xf02f,0x152));var _0xff02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf02f[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xff02('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xff02('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xff02('0x2')](0x0);var events={'afterCreate':_0xff02('0x3'),'afterUpdate':_0xff02('0x4'),'afterDestroy':_0xff02('0x5')};function emitEvent(_0x1b1780){return function(_0x12019d,_0x4e2b8c,_0x134cce){SmsQueueEvents[_0xff02('0x6')](_0x1b1780+':'+_0x12019d['id'],_0x12019d);SmsQueueEvents[_0xff02('0x6')](_0x1b1780,_0x12019d);_0x134cce(null);};}for(var e in events){if(events[_0xff02('0x7')](e)){var event=events[e];SmsQueue[_0xff02('0x8')](e,emitEvent(event));}}module[_0xff02('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index d85d105..abff6ab 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 _0x1b62=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1b62,0x1bc));var _0x21b6=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x1b62[_0x2b0a86];return _0x955940;};'use strict';var _=require(_0x21b6('0x0'));var util=require(_0x21b6('0x1'));var logger=require(_0x21b6('0x2'))(_0x21b6('0x3'));var moment=require(_0x21b6('0x4'));var BPromise=require(_0x21b6('0x5'));var rp=require(_0x21b6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21b6('0x7'));var config=require('../../config/environment');var attributes=require(_0x21b6('0x8'));module[_0x21b6('0x9')]=function(_0x1c292f,_0xb82fb8){return _0x1c292f[_0x21b6('0xa')](_0x21b6('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bec=['util','api','moment','bluebird','request-promise','./smsQueue.attributes','sms_queues','lodash'];(function(_0x356977,_0x2980e8){var _0x504a6b=function(_0x3b763c){while(--_0x3b763c){_0x356977['push'](_0x356977['shift']());}};_0x504a6b(++_0x2980e8);}(_0x4bec,0x177));var _0xc4be=function(_0x1bc07d,_0x1766bb){_0x1bc07d=_0x1bc07d-0x0;var _0x2ffd82=_0x4bec[_0x1bc07d];return _0x2ffd82;};'use strict';var _=require(_0xc4be('0x0'));var util=require(_0xc4be('0x1'));var logger=require('../../config/logger')(_0xc4be('0x2'));var moment=require(_0xc4be('0x3'));var BPromise=require(_0xc4be('0x4'));var rp=require(_0xc4be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4be('0x6'));module['exports']=function(_0x43104f,_0x587958){return _0x43104f['define']('SmsQueue',attributes,{'tableName':_0xc4be('0x7'),'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 81ef7f9..1a43038 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 _0x9ba4=['then','SmsQueue','raw','ShowSmsQueue','lodash','util','randomstring','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','attributes','limit','include','map','model'];(function(_0x3f9902,_0x257469){var _0x223b2e=function(_0x2a30a1){while(--_0x2a30a1){_0x3f9902['push'](_0x3f9902['shift']());}};_0x223b2e(++_0x257469);}(_0x9ba4,0x11c));var _0x49ba=function(_0x1f7f82,_0x164613){_0x1f7f82=_0x1f7f82-0x0;var _0x482584=_0x9ba4[_0x1f7f82];return _0x482584;};'use strict';var _=require(_0x49ba('0x0'));var util=require(_0x49ba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x49ba('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x49ba('0x3'))(_0x49ba('0x4'));var config=require('../../config/environment');var jayson=require(_0x49ba('0x5'));var client=jayson['client'][_0x49ba('0x6')]({'port':0x232a});config[_0x49ba('0x7')]=_[_0x49ba('0x8')](config['redis'],{'host':_0x49ba('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x49ba('0xa'))[_0x49ba('0xb')](socket);function respondWithRpcPromise(_0x207055,_0x2f7a15,_0x59994f){return new BPromise(function(_0x4f99e8,_0x26c587){return client[_0x49ba('0xc')](_0x207055,_0x59994f)['then'](function(_0x28e0bd){logger[_0x49ba('0xd')](_0x49ba('0xe'),_0x2f7a15,_0x49ba('0xf'));logger[_0x49ba('0x10')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2f7a15,_0x49ba('0xf'),JSON[_0x49ba('0x11')](_0x28e0bd));if(_0x28e0bd[_0x49ba('0x12')]){if(_0x28e0bd[_0x49ba('0x12')][_0x49ba('0x13')]===0x1f4){logger[_0x49ba('0x12')]('SmsQueue,\x20%s,\x20%s',_0x2f7a15,_0x28e0bd[_0x49ba('0x12')][_0x49ba('0x14')]);return _0x26c587(_0x28e0bd[_0x49ba('0x12')][_0x49ba('0x14')]);}logger[_0x49ba('0x12')]('SmsQueue,\x20%s,\x20%s',_0x2f7a15,_0x28e0bd[_0x49ba('0x12')][_0x49ba('0x14')]);return _0x4f99e8(_0x28e0bd['error'][_0x49ba('0x14')]);}else{logger[_0x49ba('0xd')](_0x49ba('0xe'),_0x2f7a15,_0x49ba('0xf'));_0x4f99e8(_0x28e0bd[_0x49ba('0x15')][_0x49ba('0x14')]);}})[_0x49ba('0x16')](function(_0x1721f2){logger[_0x49ba('0x12')](_0x49ba('0xe'),_0x2f7a15,_0x1721f2);_0x26c587(_0x1721f2);});});}exports[_0x49ba('0x17')]=function(_0x521d55){var _0xc9e55=this;return new Promise(function(_0xb164a9,_0x4b34d1){return db['SmsQueue'][_0x49ba('0x18')]({'raw':_0x521d55['options']?_0x521d55['options']['raw']===undefined?!![]:![]:!![],'where':_0x521d55[_0x49ba('0x19')]?_0x521d55[_0x49ba('0x19')]['where']||null:null,'attributes':_0x521d55[_0x49ba('0x19')]?_0x521d55[_0x49ba('0x19')][_0x49ba('0x1a')]||null:null,'limit':_0x521d55[_0x49ba('0x19')]?_0x521d55[_0x49ba('0x19')][_0x49ba('0x1b')]||null:null,'include':_0x521d55['options']?_0x521d55['options'][_0x49ba('0x1c')]?_[_0x49ba('0x1d')](_0x521d55[_0x49ba('0x19')]['include'],function(_0x461991){return{'model':db[_0x461991['model']],'as':_0x461991['as'],'attributes':_0x461991['attributes'],'include':_0x461991[_0x49ba('0x1c')]?_[_0x49ba('0x1d')](_0x461991[_0x49ba('0x1c')],function(_0x424cf8){return{'model':db[_0x424cf8[_0x49ba('0x1e')]],'as':_0x424cf8['as'],'attributes':_0x424cf8['attributes'],'include':_0x424cf8[_0x49ba('0x1c')]?_[_0x49ba('0x1d')](_0x424cf8[_0x49ba('0x1c')],function(_0xf119db){return{'model':db[_0xf119db[_0x49ba('0x1e')]],'as':_0xf119db['as'],'attributes':_0xf119db[_0x49ba('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x49ba('0x1f')](function(_0x145fa3){logger[_0x49ba('0xd')](_0x49ba('0x17'),_0x521d55);logger[_0x49ba('0x10')](_0x49ba('0x17'),_0x521d55,JSON['stringify'](_0x145fa3));_0xb164a9(_0x145fa3);})[_0x49ba('0x16')](function(_0x5df8cb){logger['error'](_0x49ba('0x17'),_0x5df8cb[_0x49ba('0x14')],_0x521d55);_0x4b34d1(_0xc9e55[_0x49ba('0x12')](0x1f4,_0x5df8cb['message']));});});};exports['ShowSmsQueue']=function(_0x3f6369){var _0x5e7c97=this;return new Promise(function(_0x3e17a2,_0x1c45ee){return db[_0x49ba('0x20')]['find']({'raw':_0x3f6369['options']?_0x3f6369[_0x49ba('0x19')][_0x49ba('0x21')]===undefined?!![]:![]:!![],'where':_0x3f6369['options']?_0x3f6369['options']['where']||null:null,'attributes':_0x3f6369[_0x49ba('0x19')]?_0x3f6369[_0x49ba('0x19')][_0x49ba('0x1a')]||null:null,'include':_0x3f6369[_0x49ba('0x19')]?_0x3f6369[_0x49ba('0x19')]['include']?_[_0x49ba('0x1d')](_0x3f6369[_0x49ba('0x19')]['include'],function(_0x2fe258){return{'model':db[_0x2fe258[_0x49ba('0x1e')]],'as':_0x2fe258['as'],'attributes':_0x2fe258[_0x49ba('0x1a')],'include':_0x2fe258['include']?_[_0x49ba('0x1d')](_0x2fe258[_0x49ba('0x1c')],function(_0x1ea8d1){return{'model':db[_0x1ea8d1[_0x49ba('0x1e')]],'as':_0x1ea8d1['as'],'attributes':_0x1ea8d1['attributes'],'include':_0x1ea8d1['include']?_[_0x49ba('0x1d')](_0x1ea8d1[_0x49ba('0x1c')],function(_0x14c0f2){return{'model':db[_0x14c0f2[_0x49ba('0x1e')]],'as':_0x14c0f2['as'],'attributes':_0x14c0f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x49ba('0x1f')](function(_0x20eedb){logger[_0x49ba('0xd')](_0x49ba('0x22'),_0x3f6369);logger[_0x49ba('0x10')](_0x49ba('0x22'),_0x3f6369,JSON[_0x49ba('0x11')](_0x20eedb));_0x3e17a2(_0x20eedb);})[_0x49ba('0x16')](function(_0x41c52d){logger[_0x49ba('0x12')](_0x49ba('0x22'),_0x41c52d[_0x49ba('0x14')],_0x3f6369);_0x1c45ee(_0x5e7c97[_0x49ba('0x12')](0x1f4,_0x41c52d[_0x49ba('0x14')]));});});}; \ No newline at end of file +var _0x46c5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','model','map','ShowSmsQueue','raw','info','lodash','util','moment','bluebird','ioredis'];(function(_0x2f5943,_0xba490b){var _0x465b7b=function(_0x4d234d){while(--_0x4d234d){_0x2f5943['push'](_0x2f5943['shift']());}};_0x465b7b(++_0xba490b);}(_0x46c5,0xf7));var _0x546c=function(_0x43c40d,_0x16102c){_0x43c40d=_0x43c40d-0x0;var _0x374cd7=_0x46c5[_0x43c40d];return _0x374cd7;};'use strict';var _=require(_0x546c('0x0'));var util=require(_0x546c('0x1'));var moment=require(_0x546c('0x2'));var BPromise=require(_0x546c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x546c('0x4'));var db=require(_0x546c('0x5'))['db'];var utils=require(_0x546c('0x6'));var logger=require(_0x546c('0x7'))(_0x546c('0x8'));var config=require(_0x546c('0x9'));var jayson=require(_0x546c('0xa'));var client=jayson[_0x546c('0xb')]['http']({'port':0x232a});config[_0x546c('0xc')]=_[_0x546c('0xd')](config[_0x546c('0xc')],{'host':_0x546c('0xe'),'port':0x18eb});var socket=require(_0x546c('0xf'))(new Redis(config[_0x546c('0xc')]));require(_0x546c('0x10'))['register'](socket);function respondWithRpcPromise(_0x26496b,_0xe82c2e,_0x270214){return new BPromise(function(_0xec9233,_0x3b3c63){return client[_0x546c('0x11')](_0x26496b,_0x270214)[_0x546c('0x12')](function(_0x1406de){logger['info'](_0x546c('0x13'),_0xe82c2e,_0x546c('0x14'));logger[_0x546c('0x15')](_0x546c('0x16'),_0xe82c2e,_0x546c('0x14'),JSON[_0x546c('0x17')](_0x1406de));if(_0x1406de[_0x546c('0x18')]){if(_0x1406de[_0x546c('0x18')][_0x546c('0x19')]===0x1f4){logger[_0x546c('0x18')]('SmsQueue,\x20%s,\x20%s',_0xe82c2e,_0x1406de['error'][_0x546c('0x1a')]);return _0x3b3c63(_0x1406de[_0x546c('0x18')][_0x546c('0x1a')]);}logger['error'](_0x546c('0x13'),_0xe82c2e,_0x1406de[_0x546c('0x18')][_0x546c('0x1a')]);return _0xec9233(_0x1406de[_0x546c('0x18')][_0x546c('0x1a')]);}else{logger['info'](_0x546c('0x13'),_0xe82c2e,'request\x20sent');_0xec9233(_0x1406de[_0x546c('0x1b')][_0x546c('0x1a')]);}})[_0x546c('0x1c')](function(_0xb5bdac){logger['error'](_0x546c('0x13'),_0xe82c2e,_0xb5bdac);_0x3b3c63(_0xb5bdac);});});}exports[_0x546c('0x1d')]=function(_0x317273){var _0x27b646=this;return new Promise(function(_0x59e1af,_0x530459){return db[_0x546c('0x1e')][_0x546c('0x1f')]({'raw':_0x317273[_0x546c('0x20')]?_0x317273['options']['raw']===undefined?!![]:![]:!![],'where':_0x317273['options']?_0x317273[_0x546c('0x20')][_0x546c('0x21')]||null:null,'attributes':_0x317273[_0x546c('0x20')]?_0x317273[_0x546c('0x20')][_0x546c('0x22')]||null:null,'limit':_0x317273['options']?_0x317273[_0x546c('0x20')][_0x546c('0x23')]||null:null,'include':_0x317273['options']?_0x317273[_0x546c('0x20')]['include']?_['map'](_0x317273[_0x546c('0x20')][_0x546c('0x24')],function(_0x680b2b){return{'model':db[_0x680b2b[_0x546c('0x25')]],'as':_0x680b2b['as'],'attributes':_0x680b2b[_0x546c('0x22')],'include':_0x680b2b[_0x546c('0x24')]?_[_0x546c('0x26')](_0x680b2b[_0x546c('0x24')],function(_0x39b44a){return{'model':db[_0x39b44a['model']],'as':_0x39b44a['as'],'attributes':_0x39b44a['attributes'],'include':_0x39b44a[_0x546c('0x24')]?_[_0x546c('0x26')](_0x39b44a[_0x546c('0x24')],function(_0xe52bc7){return{'model':db[_0xe52bc7[_0x546c('0x25')]],'as':_0xe52bc7['as'],'attributes':_0xe52bc7[_0x546c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bb9d2){logger['info'](_0x546c('0x1d'),_0x317273);logger[_0x546c('0x15')]('GetSmsQueue',_0x317273,JSON[_0x546c('0x17')](_0x5bb9d2));_0x59e1af(_0x5bb9d2);})[_0x546c('0x1c')](function(_0x38a98d){logger['error'](_0x546c('0x1d'),_0x38a98d[_0x546c('0x1a')],_0x317273);_0x530459(_0x27b646[_0x546c('0x18')](0x1f4,_0x38a98d[_0x546c('0x1a')]));});});};exports[_0x546c('0x27')]=function(_0x4c5d5c){var _0x33c23f=this;return new Promise(function(_0x1690b7,_0x7f41ef){return db['SmsQueue']['find']({'raw':_0x4c5d5c[_0x546c('0x20')]?_0x4c5d5c[_0x546c('0x20')][_0x546c('0x28')]===undefined?!![]:![]:!![],'where':_0x4c5d5c['options']?_0x4c5d5c[_0x546c('0x20')][_0x546c('0x21')]||null:null,'attributes':_0x4c5d5c['options']?_0x4c5d5c['options'][_0x546c('0x22')]||null:null,'include':_0x4c5d5c[_0x546c('0x20')]?_0x4c5d5c[_0x546c('0x20')][_0x546c('0x24')]?_[_0x546c('0x26')](_0x4c5d5c[_0x546c('0x20')]['include'],function(_0x580ecb){return{'model':db[_0x580ecb[_0x546c('0x25')]],'as':_0x580ecb['as'],'attributes':_0x580ecb[_0x546c('0x22')],'include':_0x580ecb[_0x546c('0x24')]?_[_0x546c('0x26')](_0x580ecb['include'],function(_0x57fd13){return{'model':db[_0x57fd13[_0x546c('0x25')]],'as':_0x57fd13['as'],'attributes':_0x57fd13[_0x546c('0x22')],'include':_0x57fd13[_0x546c('0x24')]?_['map'](_0x57fd13[_0x546c('0x24')],function(_0xd6522a){return{'model':db[_0xd6522a[_0x546c('0x25')]],'as':_0xd6522a['as'],'attributes':_0xd6522a[_0x546c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x452d02){logger[_0x546c('0x29')](_0x546c('0x27'),_0x4c5d5c);logger[_0x546c('0x15')](_0x546c('0x27'),_0x4c5d5c,JSON[_0x546c('0x17')](_0x452d02));_0x1690b7(_0x452d02);})['catch'](function(_0x4cb1c2){logger[_0x546c('0x18')](_0x546c('0x27'),_0x4cb1c2[_0x546c('0x1a')],_0x4c5d5c);_0x7f41ef(_0x33c23f[_0x546c('0x18')](0x1f4,_0x4cb1c2[_0x546c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 897462c..aaad53d 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 _0x3627=['smsQueue:','./smsQueue.events','update','emit','removeListener','register','length'];(function(_0x493116,_0x21994d){var _0x553436=function(_0xc032b6){while(--_0xc032b6){_0x493116['push'](_0x493116['shift']());}};_0x553436(++_0x21994d);}(_0x3627,0x8d));var _0x7362=function(_0x1e8090,_0x382318){_0x1e8090=_0x1e8090-0x0;var _0xe5ba14=_0x3627[_0x1e8090];return _0xe5ba14;};'use strict';var SmsQueueEvents=require(_0x7362('0x0'));var events=['save','remove',_0x7362('0x1')];function createListener(_0x30e65c,_0xa4ad31){return function(_0x5c01bd){_0xa4ad31[_0x7362('0x2')](_0x30e65c,_0x5c01bd);};}function removeListener(_0x3f88e2,_0x35b902){return function(){SmsQueueEvents[_0x7362('0x3')](_0x3f88e2,_0x35b902);};}exports[_0x7362('0x4')]=function(_0x1c46c8){for(var _0x14aadf=0x0,_0x5d5d7b=events[_0x7362('0x5')];_0x14aadf<_0x5d5d7b;_0x14aadf++){var _0x5feb9e=events[_0x14aadf];var _0x264a33=createListener(_0x7362('0x6')+_0x5feb9e,_0x1c46c8);SmsQueueEvents['on'](_0x5feb9e,_0x264a33);}}; \ No newline at end of file +var _0xce9b=['remove','update','emit','removeListener','register','length','smsQueue:','save'];(function(_0x3285bb,_0x421249){var _0x418a97=function(_0x5178fd){while(--_0x5178fd){_0x3285bb['push'](_0x3285bb['shift']());}};_0x418a97(++_0x421249);}(_0xce9b,0x8f));var _0xbce9=function(_0x2f969a,_0x914ee0){_0x2f969a=_0x2f969a-0x0;var _0x155edf=_0xce9b[_0x2f969a];return _0x155edf;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xbce9('0x0'),_0xbce9('0x1'),_0xbce9('0x2')];function createListener(_0x17bc20,_0x4be950){return function(_0x55a280){_0x4be950[_0xbce9('0x3')](_0x17bc20,_0x55a280);};}function removeListener(_0x50f794,_0x273dac){return function(){SmsQueueEvents[_0xbce9('0x4')](_0x50f794,_0x273dac);};}exports[_0xbce9('0x5')]=function(_0x439b51){for(var _0x38adcd=0x0,_0x1b3bfd=events[_0xbce9('0x6')];_0x38adcd<_0x1b3bfd;_0x38adcd++){var _0x52ae23=events[_0x38adcd];var _0x411784=createListener(_0xbce9('0x7')+_0x52ae23,_0x439b51);SmsQueueEvents['on'](_0x52ae23,_0x411784);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 40ff0bb..267a2d8 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 _0x19d1=['/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put'];(function(_0xa1e82e,_0x1ad26e){var _0x318346=function(_0x3b4cc2){while(--_0x3b4cc2){_0xa1e82e['push'](_0xa1e82e['shift']());}};_0x318346(++_0x1ad26e);}(_0x19d1,0x16c));var _0x119d=function(_0x207a6e,_0x13f5d8){_0x207a6e=_0x207a6e-0x0;var _0xfc80d8=_0x19d1[_0x207a6e];return _0xfc80d8;};'use strict';var multer=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var path=require('path');var timeout=require(_0x119d('0x2'));var express=require(_0x119d('0x3'));var router=express[_0x119d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x119d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x119d('0x6'));var controller=require(_0x119d('0x7'));router[_0x119d('0x8')]('/',auth[_0x119d('0x9')](),controller[_0x119d('0xa')]);router[_0x119d('0x8')](_0x119d('0xb'),auth['isAuthenticated'](),controller[_0x119d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x119d('0xd')]);router[_0x119d('0xe')]('/',auth[_0x119d('0x9')](),controller['create']);router[_0x119d('0xf')](_0x119d('0x10'),auth[_0x119d('0x9')](),controller[_0x119d('0x11')]);router[_0x119d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x119d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x584f=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x28ddff,_0xad2582){var _0x7efc36=function(_0x47b688){while(--_0x47b688){_0x28ddff['push'](_0x28ddff['shift']());}};_0x7efc36(++_0xad2582);}(_0x584f,0x108));var _0xf584=function(_0xeb76d0,_0x36a3b0){_0xeb76d0=_0xeb76d0-0x0;var _0x22f589=_0x584f[_0xeb76d0];return _0x22f589;};'use strict';var multer=require(_0xf584('0x0'));var util=require(_0xf584('0x1'));var path=require('path');var timeout=require(_0xf584('0x2'));var express=require(_0xf584('0x3'));var router=express[_0xf584('0x4')]();var fs_extra=require(_0xf584('0x5'));var auth=require(_0xf584('0x6'));var interaction=require(_0xf584('0x7'));var config=require(_0xf584('0x8'));var controller=require('./smsQueueReport.controller');router[_0xf584('0x9')]('/',auth[_0xf584('0xa')](),controller[_0xf584('0xb')]);router[_0xf584('0x9')](_0xf584('0xc'),auth[_0xf584('0xa')](),controller[_0xf584('0xd')]);router[_0xf584('0x9')](_0xf584('0xe'),auth[_0xf584('0xa')](),controller[_0xf584('0xf')]);router[_0xf584('0x10')]('/',auth['isAuthenticated'](),controller[_0xf584('0x11')]);router[_0xf584('0x12')](_0xf584('0xe'),auth[_0xf584('0xa')](),controller[_0xf584('0x13')]);router[_0xf584('0x14')](_0xf584('0xe'),auth[_0xf584('0xa')](),controller['destroy']);module[_0xf584('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 12701a6..6e1b600 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 _0x9a14=['exports','STRING','DATE'];(function(_0x467d03,_0x4486b9){var _0x163fdf=function(_0x250d38){while(--_0x250d38){_0x467d03['push'](_0x467d03['shift']());}};_0x163fdf(++_0x4486b9);}(_0x9a14,0xa8));var _0x49a1=function(_0x10d108,_0x18011b){_0x10d108=_0x10d108-0x0;var _0x20f6f4=_0x9a14[_0x10d108];return _0x20f6f4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49a1('0x0')]={'uniqueid':{'type':Sequelize[_0x49a1('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x49a1('0x1')]},'joinAt':{'type':Sequelize[_0x49a1('0x2')]},'leaveAt':{'type':Sequelize[_0x49a1('0x2')]},'acceptAt':{'type':Sequelize[_0x49a1('0x2')]},'exitAt':{'type':Sequelize[_0x49a1('0x2')]},'reason':{'type':Sequelize[_0x49a1('0x1')]}}; \ No newline at end of file +var _0x63cb=['sequelize','exports','STRING','DATE','moment'];(function(_0x5331a9,_0x4cdbd8){var _0x3c8423=function(_0x1539c1){while(--_0x1539c1){_0x5331a9['push'](_0x5331a9['shift']());}};_0x3c8423(++_0x4cdbd8);}(_0x63cb,0x158));var _0xb63c=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x63cb[_0xc67528];return _0x38e26d;};'use strict';var moment=require(_0xb63c('0x0'));var Sequelize=require(_0xb63c('0x1'));module[_0xb63c('0x2')]={'uniqueid':{'type':Sequelize[_0xb63c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb63c('0x3')]},'joinAt':{'type':Sequelize[_0xb63c('0x4')]},'leaveAt':{'type':Sequelize[_0xb63c('0x4')]},'acceptAt':{'type':Sequelize[_0xb63c('0x4')]},'exitAt':{'type':Sequelize[_0xb63c('0x4')]},'reason':{'type':Sequelize[_0xb63c('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index dee41f0..138e34c 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 _0x208b=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x208b,0xec));var _0xb208=function(_0x5db98f,_0x55b235){_0x5db98f=_0x5db98f-0x0;var _0xe3be4d=_0x208b[_0x5db98f];return _0xe3be4d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb208('0x0'));var jsonpatch=require(_0xb208('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb208('0x2'));var Mustache=require(_0xb208('0x3'));var util=require(_0xb208('0x4'));var path=require('path');var sox=require(_0xb208('0x5'));var csv=require(_0xb208('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb208('0x7'));var _=require('lodash');var squel=require(_0xb208('0x8'));var crypto=require(_0xb208('0x9'));var jsforce=require(_0xb208('0xa'));var deskjs=require(_0xb208('0xb'));var toCsv=require(_0xb208('0x6'));var querystring=require(_0xb208('0xc'));var Papa=require(_0xb208('0xd'));var Redis=require(_0xb208('0xe'));var authService=require(_0xb208('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb208('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb208('0x11'))(_0xb208('0x12'));var utils=require(_0xb208('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb208('0x14'));var db=require(_0xb208('0x15'))['db'];function respondWithStatusCode(_0x49bdf8,_0xd9b216){_0xd9b216=_0xd9b216||0xcc;return function(_0x335df4){if(_0x335df4){return _0x49bdf8['sendStatus'](_0xd9b216);}return _0x49bdf8[_0xb208('0x16')](_0xd9b216)[_0xb208('0x17')]();};}function respondWithResult(_0x5a9ed4,_0x547a55){_0x547a55=_0x547a55||0xc8;return function(_0xce7dce){if(_0xce7dce){return _0x5a9ed4['status'](_0x547a55)[_0xb208('0x18')](_0xce7dce);}};}function respondWithFilteredResult(_0x16a316,_0xf37adf){return function(_0x1b1170){if(_0x1b1170){var _0x278518=typeof _0xf37adf[_0xb208('0x19')]===_0xb208('0x1a')&&typeof _0xf37adf[_0xb208('0x1b')]===_0xb208('0x1a');var _0x1a5c73=_0x1b1170[_0xb208('0x1c')];var _0xc1975b=_0x278518?0x0:_0xf37adf[_0xb208('0x19')];var _0x29e57f=_0x278518?_0x1b1170['count']:_0xf37adf[_0xb208('0x19')]+_0xf37adf[_0xb208('0x1b')];var _0x41983b;if(_0x29e57f>=_0x1a5c73){_0x29e57f=_0x1a5c73;_0x41983b=0xc8;}else{_0x41983b=0xce;}_0x16a316[_0xb208('0x16')](_0x41983b);return _0x16a316[_0xb208('0x1d')]('Content-Range',_0xc1975b+'-'+_0x29e57f+'/'+_0x1a5c73)[_0xb208('0x18')](_0x1b1170);}return null;};}function patchUpdates(_0x1758c3){return function(_0x3048c0){try{jsonpatch[_0xb208('0x1e')](_0x3048c0,_0x1758c3,!![]);}catch(_0x477803){return BPromise[_0xb208('0x1f')](_0x477803);}return _0x3048c0[_0xb208('0x20')]();};}function saveUpdates(_0xde0c79,_0x4c00e3){return function(_0x248576){if(_0x248576){return _0x248576[_0xb208('0x21')](_0xde0c79)[_0xb208('0x22')](function(_0x8c9a4f){return _0x8c9a4f;});}return null;};}function removeEntity(_0x5ddf99,_0x1f065d){return function(_0x3d0030){if(_0x3d0030){return _0x3d0030[_0xb208('0x23')]()[_0xb208('0x22')](function(){_0x5ddf99[_0xb208('0x16')](0xcc)[_0xb208('0x17')]();});}};}function handleEntityNotFound(_0x2f5a29,_0x569ff9){return function(_0x4c73e8){if(!_0x4c73e8){_0x2f5a29[_0xb208('0x24')](0x194);}return _0x4c73e8;};}function handleError(_0x2d37f9,_0x22d2e1){_0x22d2e1=_0x22d2e1||0x1f4;return function(_0xde16a6){logger[_0xb208('0x25')](_0xde16a6['stack']);if(_0xde16a6['name']){delete _0xde16a6['name'];}_0x2d37f9[_0xb208('0x16')](_0x22d2e1)['send'](_0xde16a6);};}exports['index']=function(_0x411fd8,_0x4de573){var _0x31a19c={},_0x1d00da={},_0x5e143b={'count':0x0,'rows':[]};var _0x2b2ae7=_[_0xb208('0x26')](db[_0xb208('0x27')][_0xb208('0x28')],function(_0xb7d3ee){return{'name':_0xb7d3ee[_0xb208('0x29')],'type':_0xb7d3ee[_0xb208('0x2a')][_0xb208('0x2b')]};});_0x1d00da[_0xb208('0x2c')]=_[_0xb208('0x26')](_0x2b2ae7,_0xb208('0x2d'));_0x1d00da[_0xb208('0x2e')]=_[_0xb208('0x2f')](_0x411fd8['query']);_0x1d00da[_0xb208('0x30')]=_[_0xb208('0x31')](_0x1d00da[_0xb208('0x2c')],_0x1d00da[_0xb208('0x2e')]);_0x31a19c[_0xb208('0x32')]=_[_0xb208('0x31')](_0x1d00da[_0xb208('0x2c')],qs['fields'](_0x411fd8[_0xb208('0x2e')][_0xb208('0x33')]));_0x31a19c[_0xb208('0x32')]=_0x31a19c[_0xb208('0x32')][_0xb208('0x34')]?_0x31a19c[_0xb208('0x32')]:_0x1d00da[_0xb208('0x2c')];if(!_0x411fd8['query'][_0xb208('0x35')](_0xb208('0x36'))){_0x31a19c[_0xb208('0x1b')]=qs['limit'](_0x411fd8['query']['limit']);_0x31a19c[_0xb208('0x19')]=qs[_0xb208('0x19')](_0x411fd8['query'][_0xb208('0x19')]);}_0x31a19c[_0xb208('0x37')]=qs[_0xb208('0x38')](_0x411fd8[_0xb208('0x2e')][_0xb208('0x38')]);_0x31a19c[_0xb208('0x39')]=qs[_0xb208('0x30')](_['pick'](_0x411fd8[_0xb208('0x2e')],_0x1d00da[_0xb208('0x30')]),_0x2b2ae7);if(_0x411fd8[_0xb208('0x2e')][_0xb208('0x3a')]){_0x31a19c[_0xb208('0x39')]=_[_0xb208('0x3b')](_0x31a19c[_0xb208('0x39')],{'$or':_[_0xb208('0x26')](_0x2b2ae7,function(_0x22f532){if(_0x22f532['type']!==_0xb208('0x3c')){var _0x2f9fb1={};_0x2f9fb1[_0x22f532[_0xb208('0x2d')]]={'$like':'%'+_0x411fd8[_0xb208('0x2e')]['filter']+'%'};return _0x2f9fb1;}})});}_0x31a19c=_['merge']({},_0x31a19c,_0x411fd8['options']);var _0x17272a={'where':_0x31a19c[_0xb208('0x39')]};return db['SmsQueueReport'][_0xb208('0x1c')](_0x17272a)[_0xb208('0x22')](function(_0x2abfb9){_0x5e143b[_0xb208('0x1c')]=_0x2abfb9;if(_0x411fd8[_0xb208('0x2e')]['includeAll']){_0x31a19c[_0xb208('0x3d')]=[{'all':!![]}];}return db[_0xb208('0x27')][_0xb208('0x3e')](_0x31a19c);})[_0xb208('0x22')](function(_0x2c1858){_0x5e143b[_0xb208('0x3f')]=_0x2c1858;return _0x5e143b;})['then'](respondWithFilteredResult(_0x4de573,_0x31a19c))[_0xb208('0x40')](handleError(_0x4de573,null));};exports[_0xb208('0x41')]=function(_0x1a1d65,_0x93ed5d){var _0xc37151={'raw':!![],'where':{'id':_0x1a1d65[_0xb208('0x42')]['id']}},_0x2b0e90={};_0x2b0e90[_0xb208('0x2c')]=_['keys'](db[_0xb208('0x27')][_0xb208('0x28')]);_0x2b0e90[_0xb208('0x2e')]=_[_0xb208('0x2f')](_0x1a1d65[_0xb208('0x2e')]);_0x2b0e90[_0xb208('0x30')]=_['intersection'](_0x2b0e90[_0xb208('0x2c')],_0x2b0e90[_0xb208('0x2e')]);_0xc37151[_0xb208('0x32')]=_[_0xb208('0x31')](_0x2b0e90[_0xb208('0x2c')],qs[_0xb208('0x33')](_0x1a1d65['query']['fields']));_0xc37151['attributes']=_0xc37151['attributes'][_0xb208('0x34')]?_0xc37151[_0xb208('0x32')]:_0x2b0e90['model'];if(_0x1a1d65[_0xb208('0x2e')][_0xb208('0x43')]){_0xc37151[_0xb208('0x3d')]=[{'all':!![]}];}_0xc37151=_[_0xb208('0x3b')]({},_0xc37151,_0x1a1d65['options']);return db['SmsQueueReport'][_0xb208('0x44')](_0xc37151)[_0xb208('0x22')](handleEntityNotFound(_0x93ed5d,null))[_0xb208('0x22')](respondWithResult(_0x93ed5d,null))['catch'](handleError(_0x93ed5d,null));};exports[_0xb208('0x45')]=function(_0x27b318,_0x160429){return db[_0xb208('0x27')][_0xb208('0x45')](_0x27b318[_0xb208('0x46')],{})[_0xb208('0x22')](respondWithResult(_0x160429,0xc9))[_0xb208('0x40')](handleError(_0x160429,null));};exports[_0xb208('0x21')]=function(_0x2e4b08,_0x50f5eb){if(_0x2e4b08[_0xb208('0x46')]['id']){delete _0x2e4b08[_0xb208('0x46')]['id'];}return db[_0xb208('0x27')][_0xb208('0x44')]({'where':{'id':_0x2e4b08['params']['id']}})[_0xb208('0x22')](handleEntityNotFound(_0x50f5eb,null))[_0xb208('0x22')](saveUpdates(_0x2e4b08[_0xb208('0x46')],null))[_0xb208('0x22')](respondWithResult(_0x50f5eb,null))[_0xb208('0x40')](handleError(_0x50f5eb,null));};exports['destroy']=function(_0x1a84dd,_0xe4f212){return db['SmsQueueReport'][_0xb208('0x44')]({'where':{'id':_0x1a84dd[_0xb208('0x42')]['id']}})[_0xb208('0x22')](handleEntityNotFound(_0xe4f212,null))[_0xb208('0x22')](removeEntity(_0xe4f212,null))[_0xb208('0x40')](handleError(_0xe4f212,null));};exports[_0xb208('0x47')]=function(_0x51a60d,_0x3e64b0){return db[_0xb208('0x27')]['describe']()[_0xb208('0x22')](respondWithResult(_0x3e64b0,null))[_0xb208('0x40')](handleError(_0x3e64b0,null));}; \ No newline at end of file +var _0xbdd3=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4d9bbd,_0x32d443){var _0x46e611=function(_0x5d38cb){while(--_0x5d38cb){_0x4d9bbd['push'](_0x4d9bbd['shift']());}};_0x46e611(++_0x32d443);}(_0xbdd3,0x1bd));var _0x3bdd=function(_0x4417ba,_0x45c1e2){_0x4417ba=_0x4417ba-0x0;var _0x88b88d=_0xbdd3[_0x4417ba];return _0x88b88d;};'use strict';var emlformat=require(_0x3bdd('0x0'));var rimraf=require(_0x3bdd('0x1'));var zipdir=require(_0x3bdd('0x2'));var jsonpatch=require(_0x3bdd('0x3'));var rp=require(_0x3bdd('0x4'));var moment=require(_0x3bdd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3bdd('0x6'));var path=require(_0x3bdd('0x7'));var sox=require(_0x3bdd('0x8'));var csv=require(_0x3bdd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bdd('0xa'));var _=require(_0x3bdd('0xb'));var squel=require(_0x3bdd('0xc'));var crypto=require(_0x3bdd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3bdd('0xe'));var toCsv=require(_0x3bdd('0x9'));var querystring=require(_0x3bdd('0xf'));var Papa=require(_0x3bdd('0x10'));var Redis=require('ioredis');var authService=require(_0x3bdd('0x11'));var qs=require(_0x3bdd('0x12'));var as=require(_0x3bdd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bdd('0x14'))('api');var utils=require(_0x3bdd('0x15'));var config=require(_0x3bdd('0x16'));var licenseUtil=require(_0x3bdd('0x17'));var db=require(_0x3bdd('0x18'))['db'];function respondWithStatusCode(_0x202b4a,_0x2b30cf){_0x2b30cf=_0x2b30cf||0xcc;return function(_0x135462){if(_0x135462){return _0x202b4a[_0x3bdd('0x19')](_0x2b30cf);}return _0x202b4a['status'](_0x2b30cf)['end']();};}function respondWithResult(_0x29c218,_0x569098){_0x569098=_0x569098||0xc8;return function(_0x3ec803){if(_0x3ec803){return _0x29c218[_0x3bdd('0x1a')](_0x569098)[_0x3bdd('0x1b')](_0x3ec803);}};}function respondWithFilteredResult(_0x203fac,_0x2b19fe){return function(_0xa4733e){if(_0xa4733e){var _0x2b2781=typeof _0x2b19fe[_0x3bdd('0x1c')]===_0x3bdd('0x1d')&&typeof _0x2b19fe[_0x3bdd('0x1e')]===_0x3bdd('0x1d');var _0x11663b=_0xa4733e[_0x3bdd('0x1f')];var _0x2fffbc=_0x2b2781?0x0:_0x2b19fe['offset'];var _0x56592e=_0x2b2781?_0xa4733e[_0x3bdd('0x1f')]:_0x2b19fe[_0x3bdd('0x1c')]+_0x2b19fe[_0x3bdd('0x1e')];var _0x4a332e;if(_0x56592e>=_0x11663b){_0x56592e=_0x11663b;_0x4a332e=0xc8;}else{_0x4a332e=0xce;}_0x203fac[_0x3bdd('0x1a')](_0x4a332e);return _0x203fac[_0x3bdd('0x20')](_0x3bdd('0x21'),_0x2fffbc+'-'+_0x56592e+'/'+_0x11663b)['json'](_0xa4733e);}return null;};}function patchUpdates(_0x330912){return function(_0x451698){try{jsonpatch[_0x3bdd('0x22')](_0x451698,_0x330912,!![]);}catch(_0x294057){return BPromise[_0x3bdd('0x23')](_0x294057);}return _0x451698[_0x3bdd('0x24')]();};}function saveUpdates(_0x41c8ce,_0x276075){return function(_0x4585c0){if(_0x4585c0){return _0x4585c0[_0x3bdd('0x25')](_0x41c8ce)[_0x3bdd('0x26')](function(_0x5488be){return _0x5488be;});}return null;};}function removeEntity(_0x1415a3,_0x53fba5){return function(_0x7dbebd){if(_0x7dbebd){return _0x7dbebd[_0x3bdd('0x27')]()[_0x3bdd('0x26')](function(){_0x1415a3[_0x3bdd('0x1a')](0xcc)[_0x3bdd('0x28')]();});}};}function handleEntityNotFound(_0x1dc43c,_0x1a6b74){return function(_0xd4f101){if(!_0xd4f101){_0x1dc43c[_0x3bdd('0x19')](0x194);}return _0xd4f101;};}function handleError(_0x292ec0,_0x23f6c8){_0x23f6c8=_0x23f6c8||0x1f4;return function(_0x5c50eb){logger[_0x3bdd('0x29')](_0x5c50eb['stack']);if(_0x5c50eb[_0x3bdd('0x2a')]){delete _0x5c50eb[_0x3bdd('0x2a')];}_0x292ec0[_0x3bdd('0x1a')](_0x23f6c8)['send'](_0x5c50eb);};}exports[_0x3bdd('0x2b')]=function(_0x5d0ac6,_0x1865b8){var _0x4a9baf={},_0x450aac={},_0x4075d0={'count':0x0,'rows':[]};var _0x1d2e42=_[_0x3bdd('0x2c')](db[_0x3bdd('0x2d')][_0x3bdd('0x2e')],function(_0x17d153){return{'name':_0x17d153[_0x3bdd('0x2f')],'type':_0x17d153[_0x3bdd('0x30')][_0x3bdd('0x31')]};});_0x450aac[_0x3bdd('0x32')]=_[_0x3bdd('0x2c')](_0x1d2e42,'name');_0x450aac[_0x3bdd('0x33')]=_[_0x3bdd('0x34')](_0x5d0ac6['query']);_0x450aac[_0x3bdd('0x35')]=_['intersection'](_0x450aac[_0x3bdd('0x32')],_0x450aac[_0x3bdd('0x33')]);_0x4a9baf[_0x3bdd('0x36')]=_['intersection'](_0x450aac['model'],qs[_0x3bdd('0x37')](_0x5d0ac6[_0x3bdd('0x33')][_0x3bdd('0x37')]));_0x4a9baf['attributes']=_0x4a9baf[_0x3bdd('0x36')][_0x3bdd('0x38')]?_0x4a9baf[_0x3bdd('0x36')]:_0x450aac[_0x3bdd('0x32')];if(!_0x5d0ac6[_0x3bdd('0x33')][_0x3bdd('0x39')](_0x3bdd('0x3a'))){_0x4a9baf[_0x3bdd('0x1e')]=qs[_0x3bdd('0x1e')](_0x5d0ac6['query'][_0x3bdd('0x1e')]);_0x4a9baf['offset']=qs['offset'](_0x5d0ac6[_0x3bdd('0x33')][_0x3bdd('0x1c')]);}_0x4a9baf['order']=qs[_0x3bdd('0x3b')](_0x5d0ac6['query'][_0x3bdd('0x3b')]);_0x4a9baf['where']=qs[_0x3bdd('0x35')](_[_0x3bdd('0x3c')](_0x5d0ac6['query'],_0x450aac[_0x3bdd('0x35')]),_0x1d2e42);if(_0x5d0ac6['query'][_0x3bdd('0x3d')]){_0x4a9baf['where']=_[_0x3bdd('0x3e')](_0x4a9baf[_0x3bdd('0x3f')],{'$or':_[_0x3bdd('0x2c')](_0x1d2e42,function(_0x1e5273){if(_0x1e5273[_0x3bdd('0x30')]!==_0x3bdd('0x40')){var _0x322195={};_0x322195[_0x1e5273[_0x3bdd('0x2a')]]={'$like':'%'+_0x5d0ac6[_0x3bdd('0x33')]['filter']+'%'};return _0x322195;}})});}_0x4a9baf=_['merge']({},_0x4a9baf,_0x5d0ac6[_0x3bdd('0x41')]);var _0x4e6b67={'where':_0x4a9baf[_0x3bdd('0x3f')]};return db[_0x3bdd('0x2d')][_0x3bdd('0x1f')](_0x4e6b67)[_0x3bdd('0x26')](function(_0x2bc99c){_0x4075d0[_0x3bdd('0x1f')]=_0x2bc99c;if(_0x5d0ac6[_0x3bdd('0x33')][_0x3bdd('0x42')]){_0x4a9baf[_0x3bdd('0x43')]=[{'all':!![]}];}return db[_0x3bdd('0x2d')][_0x3bdd('0x44')](_0x4a9baf);})['then'](function(_0x1dd148){_0x4075d0[_0x3bdd('0x45')]=_0x1dd148;return _0x4075d0;})[_0x3bdd('0x26')](respondWithFilteredResult(_0x1865b8,_0x4a9baf))[_0x3bdd('0x46')](handleError(_0x1865b8,null));};exports[_0x3bdd('0x47')]=function(_0x141ecf,_0x484d9a){var _0x118baf={'raw':!![],'where':{'id':_0x141ecf[_0x3bdd('0x48')]['id']}},_0xbf9891={};_0xbf9891[_0x3bdd('0x32')]=_['keys'](db[_0x3bdd('0x2d')][_0x3bdd('0x2e')]);_0xbf9891['query']=_[_0x3bdd('0x34')](_0x141ecf[_0x3bdd('0x33')]);_0xbf9891['filters']=_[_0x3bdd('0x49')](_0xbf9891[_0x3bdd('0x32')],_0xbf9891[_0x3bdd('0x33')]);_0x118baf['attributes']=_['intersection'](_0xbf9891[_0x3bdd('0x32')],qs[_0x3bdd('0x37')](_0x141ecf[_0x3bdd('0x33')][_0x3bdd('0x37')]));_0x118baf[_0x3bdd('0x36')]=_0x118baf['attributes'][_0x3bdd('0x38')]?_0x118baf[_0x3bdd('0x36')]:_0xbf9891[_0x3bdd('0x32')];if(_0x141ecf[_0x3bdd('0x33')][_0x3bdd('0x42')]){_0x118baf['include']=[{'all':!![]}];}_0x118baf=_[_0x3bdd('0x3e')]({},_0x118baf,_0x141ecf[_0x3bdd('0x41')]);return db[_0x3bdd('0x2d')][_0x3bdd('0x4a')](_0x118baf)[_0x3bdd('0x26')](handleEntityNotFound(_0x484d9a,null))['then'](respondWithResult(_0x484d9a,null))[_0x3bdd('0x46')](handleError(_0x484d9a,null));};exports[_0x3bdd('0x4b')]=function(_0x4ab44e,_0x13912){return db[_0x3bdd('0x2d')]['create'](_0x4ab44e['body'],{})[_0x3bdd('0x26')](respondWithResult(_0x13912,0xc9))[_0x3bdd('0x46')](handleError(_0x13912,null));};exports['update']=function(_0x15b214,_0x88673){if(_0x15b214[_0x3bdd('0x4c')]['id']){delete _0x15b214[_0x3bdd('0x4c')]['id'];}return db['SmsQueueReport'][_0x3bdd('0x4a')]({'where':{'id':_0x15b214['params']['id']}})[_0x3bdd('0x26')](handleEntityNotFound(_0x88673,null))[_0x3bdd('0x26')](saveUpdates(_0x15b214[_0x3bdd('0x4c')],null))[_0x3bdd('0x26')](respondWithResult(_0x88673,null))[_0x3bdd('0x46')](handleError(_0x88673,null));};exports[_0x3bdd('0x27')]=function(_0x17dc6e,_0x5c4bc4){return db['SmsQueueReport'][_0x3bdd('0x4a')]({'where':{'id':_0x17dc6e['params']['id']}})[_0x3bdd('0x26')](handleEntityNotFound(_0x5c4bc4,null))[_0x3bdd('0x26')](removeEntity(_0x5c4bc4,null))[_0x3bdd('0x46')](handleError(_0x5c4bc4,null));};exports['describe']=function(_0x517c2b,_0x1cda02){return db[_0x3bdd('0x2d')][_0x3bdd('0x4d')]()[_0x3bdd('0x26')](respondWithResult(_0x1cda02,null))[_0x3bdd('0x46')](handleError(_0x1cda02,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c787bc6..2a9f903 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x4e7fd0,_0x29cccd){var _0x1de972=function(_0x430190){while(--_0x430190){_0x4e7fd0['push'](_0x4e7fd0['shift']());}};_0x1de972(++_0x29cccd);}(_0xe706,0xa3));var _0x6e70=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe706[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x56d1f1,_0x3f545f){var _0x261553=function(_0x2915da){while(--_0x2915da){_0x56d1f1['push'](_0x56d1f1['shift']());}};_0x261553(++_0x3f545f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 317f65c..239535a 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 _0x301a=['info','catch','CreateSmsQueueReport','create','options','raw','debug','SmsQueueReport','update','body','where','attributes','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x49428e,_0x22fa48){var _0x329b30=function(_0x5997cf){while(--_0x5997cf){_0x49428e['push'](_0x49428e['shift']());}};_0x329b30(++_0x22fa48);}(_0x301a,0x14d));var _0xa301=function(_0x2fe733,_0x14d852){_0x2fe733=_0x2fe733-0x0;var _0x396ea9=_0x301a[_0x2fe733];return _0x396ea9;};'use strict';var _=require('lodash');var util=require(_0xa301('0x0'));var moment=require(_0xa301('0x1'));var BPromise=require(_0xa301('0x2'));var rs=require(_0xa301('0x3'));var fs=require('fs');var Redis=require(_0xa301('0x4'));var db=require(_0xa301('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa301('0x6'))('rpc');var config=require(_0xa301('0x7'));var jayson=require(_0xa301('0x8'));var client=jayson[_0xa301('0x9')][_0xa301('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc61bb3,_0x589083,_0x1edb4a){return new BPromise(function(_0x47f4c6,_0x1ceabc){return client[_0xa301('0xb')](_0xc61bb3,_0x1edb4a)[_0xa301('0xc')](function(_0x2cdd86){logger['info'](_0xa301('0xd'),_0x589083,_0xa301('0xe'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x589083,'request\x20sent',JSON[_0xa301('0xf')](_0x2cdd86));if(_0x2cdd86[_0xa301('0x10')]){if(_0x2cdd86[_0xa301('0x10')][_0xa301('0x11')]===0x1f4){logger['error'](_0xa301('0xd'),_0x589083,_0x2cdd86[_0xa301('0x10')][_0xa301('0x12')]);return _0x1ceabc(_0x2cdd86['error'][_0xa301('0x12')]);}logger[_0xa301('0x10')](_0xa301('0xd'),_0x589083,_0x2cdd86['error'][_0xa301('0x12')]);return _0x47f4c6(_0x2cdd86['error'][_0xa301('0x12')]);}else{logger[_0xa301('0x13')](_0xa301('0xd'),_0x589083,_0xa301('0xe'));_0x47f4c6(_0x2cdd86['result'][_0xa301('0x12')]);}})[_0xa301('0x14')](function(_0x1453d0){logger[_0xa301('0x10')](_0xa301('0xd'),_0x589083,_0x1453d0);_0x1ceabc(_0x1453d0);});});}exports[_0xa301('0x15')]=function(_0xb05b21){var _0x29d63a=this;return new Promise(function(_0x252b62,_0x309064){return db['SmsQueueReport'][_0xa301('0x16')](_0xb05b21['body'],{'raw':_0xb05b21[_0xa301('0x17')]?_0xb05b21[_0xa301('0x17')][_0xa301('0x18')]===undefined?!![]:![]:!![]})[_0xa301('0xc')](function(_0x31673e){logger[_0xa301('0x13')](_0xa301('0x15'),_0xb05b21);logger[_0xa301('0x19')]('CreateSmsQueueReport',_0xb05b21,JSON[_0xa301('0xf')](_0x31673e));_0x252b62(_0x31673e);})[_0xa301('0x14')](function(_0x209fdb){logger[_0xa301('0x10')](_0xa301('0x15'),_0x209fdb[_0xa301('0x12')],_0xb05b21);_0x309064(_0x29d63a[_0xa301('0x10')](0x1f4,_0x209fdb[_0xa301('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x3d44e1){var _0x515d64=this;return new Promise(function(_0x5b4527,_0x23bacb){return db[_0xa301('0x1a')][_0xa301('0x1b')](_0x3d44e1[_0xa301('0x1c')],{'raw':_0x3d44e1[_0xa301('0x17')]?_0x3d44e1['options'][_0xa301('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d44e1[_0xa301('0x17')]?_0x3d44e1[_0xa301('0x17')][_0xa301('0x1d')]||null:null,'attributes':_0x3d44e1['options']?_0x3d44e1[_0xa301('0x17')][_0xa301('0x1e')]||null:null,'limit':_0x3d44e1['options']?_0x3d44e1['options']['limit']||null:null})['then'](function(_0xc24e23){logger[_0xa301('0x13')](_0xa301('0x1f'),_0x3d44e1);logger[_0xa301('0x19')](_0xa301('0x1f'),_0x3d44e1,JSON['stringify'](_0xc24e23));_0x5b4527(_0xc24e23);})['catch'](function(_0x17f41a){logger[_0xa301('0x10')](_0xa301('0x1f'),_0x17f41a[_0xa301('0x12')],_0x3d44e1);_0x23bacb(_0x515d64['error'](0x1f4,_0x17f41a[_0xa301('0x12')]));});});}; \ No newline at end of file +var _0x2b39=['SmsQueueReport','body','options','then','update','attributes','limit','UpdateSmsQueueReport','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateSmsQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2b39,0xc4));var _0x92b3=function(_0x193dad,_0x38d83d){_0x193dad=_0x193dad-0x0;var _0x5eafa4=_0x2b39[_0x193dad];return _0x5eafa4;};'use strict';var _=require(_0x92b3('0x0'));var util=require(_0x92b3('0x1'));var moment=require(_0x92b3('0x2'));var BPromise=require(_0x92b3('0x3'));var rs=require(_0x92b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b3('0x5'))['db'];var utils=require(_0x92b3('0x6'));var logger=require(_0x92b3('0x7'))(_0x92b3('0x8'));var config=require(_0x92b3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x92b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x248ec9,_0x5bf862,_0x5cfc19){return new BPromise(function(_0x3ada64,_0x59f65e){return client[_0x92b3('0xb')](_0x248ec9,_0x5cfc19)['then'](function(_0x37e38b){logger['info'](_0x92b3('0xc'),_0x5bf862,_0x92b3('0xd'));logger['debug'](_0x92b3('0xe'),_0x5bf862,_0x92b3('0xd'),JSON[_0x92b3('0xf')](_0x37e38b));if(_0x37e38b['error']){if(_0x37e38b['error']['code']===0x1f4){logger[_0x92b3('0x10')](_0x92b3('0xc'),_0x5bf862,_0x37e38b['error'][_0x92b3('0x11')]);return _0x59f65e(_0x37e38b[_0x92b3('0x10')]['message']);}logger['error'](_0x92b3('0xc'),_0x5bf862,_0x37e38b[_0x92b3('0x10')][_0x92b3('0x11')]);return _0x3ada64(_0x37e38b[_0x92b3('0x10')][_0x92b3('0x11')]);}else{logger[_0x92b3('0x12')](_0x92b3('0xc'),_0x5bf862,_0x92b3('0xd'));_0x3ada64(_0x37e38b[_0x92b3('0x13')][_0x92b3('0x11')]);}})['catch'](function(_0x7124d){logger[_0x92b3('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x5bf862,_0x7124d);_0x59f65e(_0x7124d);});});}exports[_0x92b3('0x14')]=function(_0x5d27c1){var _0x2b43b1=this;return new Promise(function(_0x312bd6,_0x4b5c1b){return db[_0x92b3('0x15')]['create'](_0x5d27c1[_0x92b3('0x16')],{'raw':_0x5d27c1['options']?_0x5d27c1[_0x92b3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x92b3('0x18')](function(_0x3a7810){logger[_0x92b3('0x12')](_0x92b3('0x14'),_0x5d27c1);logger['debug'](_0x92b3('0x14'),_0x5d27c1,JSON[_0x92b3('0xf')](_0x3a7810));_0x312bd6(_0x3a7810);})['catch'](function(_0xed52ca){logger[_0x92b3('0x10')](_0x92b3('0x14'),_0xed52ca['message'],_0x5d27c1);_0x4b5c1b(_0x2b43b1[_0x92b3('0x10')](0x1f4,_0xed52ca[_0x92b3('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x2feaea){var _0x5e1f8b=this;return new Promise(function(_0x54594a,_0x2c0a05){return db[_0x92b3('0x15')][_0x92b3('0x19')](_0x2feaea[_0x92b3('0x16')],{'raw':_0x2feaea[_0x92b3('0x17')]?_0x2feaea[_0x92b3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2feaea[_0x92b3('0x17')]?_0x2feaea['options']['where']||null:null,'attributes':_0x2feaea['options']?_0x2feaea[_0x92b3('0x17')][_0x92b3('0x1a')]||null:null,'limit':_0x2feaea[_0x92b3('0x17')]?_0x2feaea[_0x92b3('0x17')][_0x92b3('0x1b')]||null:null})[_0x92b3('0x18')](function(_0x1291db){logger[_0x92b3('0x12')](_0x92b3('0x1c'),_0x2feaea);logger[_0x92b3('0x1d')](_0x92b3('0x1c'),_0x2feaea,JSON[_0x92b3('0xf')](_0x1291db));_0x54594a(_0x1291db);})[_0x92b3('0x1e')](function(_0x1ad9a5){logger[_0x92b3('0x10')]('UpdateSmsQueueReport',_0x1ad9a5['message'],_0x2feaea);_0x2c0a05(_0x5e1f8b[_0x92b3('0x10')](0x1f4,_0x1ad9a5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ff96ec4..ec54f18 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 _0x0bde=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x5c826c,_0x2035ab){var _0x3b8084=function(_0x3fc7e8){while(--_0x3fc7e8){_0x5c826c['push'](_0x5c826c['shift']());}};_0x3b8084(++_0x2035ab);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe0bd('0x0'));var util=require('util');var path=require(_0xe0bd('0x1'));var timeout=require(_0xe0bd('0x2'));var express=require('express');var router=express[_0xe0bd('0x3')]();var fs_extra=require(_0xe0bd('0x4'));var auth=require(_0xe0bd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe0bd('0x6'));var controller=require(_0xe0bd('0x7'));router[_0xe0bd('0x8')]('/',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xa')]);router[_0xe0bd('0x8')](_0xe0bd('0xb'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xc')]);router[_0xe0bd('0x8')](_0xe0bd('0xd'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xe')]);router['post']('/',auth[_0xe0bd('0x9')](),controller[_0xe0bd('0xf')]);router['put'](_0xe0bd('0xd'),auth['isAuthenticated'](),controller[_0xe0bd('0x10')]);router[_0xe0bd('0x11')](_0xe0bd('0xd'),auth[_0xe0bd('0x9')](),controller[_0xe0bd('0x12')]);module[_0xe0bd('0x13')]=router; \ No newline at end of file +var _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x17ea94,_0x5cc3ce){var _0xb20e3f=function(_0x98e597){while(--_0x98e597){_0x17ea94['push'](_0x17ea94['shift']());}};_0xb20e3f(++_0x5cc3ce);}(_0xa630,0xbe));var _0x0a63=function(_0x5d47a5,_0x333491){_0x5d47a5=_0x5d47a5-0x0;var _0x467c9f=_0xa630[_0x5d47a5];return _0x467c9f;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 32fb469..c4adcf7 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x29ac6b,_0x184514){var _0x44a29b=function(_0x2dad03){while(--_0x2dad03){_0x29ac6b['push'](_0x29ac6b['shift']());}};_0x44a29b(++_0x184514);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x109fd7,_0x4a347f){var _0x357a8e=function(_0x48cf80){while(--_0x48cf80){_0x109fd7['push'](_0x109fd7['shift']());}};_0x357a8e(++_0x4a347f);}(_0xedd9,0xfc));var _0x9edd=function(_0x543980,_0x41df6c){_0x543980=_0x543980-0x0;var _0xf6761c=_0xedd9[_0x543980];return _0xf6761c;};'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 adc35c1..6b6d7d5 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 _0x39ed=['rows','catch','show','params','keys','intersection','length','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','end','name','send','map','rawAttributes','fieldName','type','key','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','SmsTransferReport','includeAll','include','findAll'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x39ed,0x13c));var _0xd39e=function(_0x1a9525,_0x2f1e9a){_0x1a9525=_0x1a9525-0x0;var _0x11ba7f=_0x39ed[_0x1a9525];return _0x11ba7f;};'use strict';var emlformat=require(_0xd39e('0x0'));var rimraf=require(_0xd39e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd39e('0x2'));var rp=require(_0xd39e('0x3'));var moment=require(_0xd39e('0x4'));var BPromise=require(_0xd39e('0x5'));var Mustache=require('mustache');var util=require(_0xd39e('0x6'));var path=require('path');var sox=require(_0xd39e('0x7'));var csv=require(_0xd39e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd39e('0x9'));var _=require(_0xd39e('0xa'));var squel=require(_0xd39e('0xb'));var crypto=require(_0xd39e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd39e('0xd'));var toCsv=require(_0xd39e('0x8'));var querystring=require(_0xd39e('0xe'));var Papa=require(_0xd39e('0xf'));var Redis=require(_0xd39e('0x10'));var authService=require(_0xd39e('0x11'));var qs=require(_0xd39e('0x12'));var as=require(_0xd39e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd39e('0x14'));var utils=require(_0xd39e('0x15'));var config=require(_0xd39e('0x16'));var licenseUtil=require(_0xd39e('0x17'));var db=require(_0xd39e('0x18'))['db'];function respondWithStatusCode(_0x4f6158,_0x2ccc96){_0x2ccc96=_0x2ccc96||0xcc;return function(_0x10726f){if(_0x10726f){return _0x4f6158[_0xd39e('0x19')](_0x2ccc96);}return _0x4f6158[_0xd39e('0x1a')](_0x2ccc96)['end']();};}function respondWithResult(_0x5d1a3e,_0x15257d){_0x15257d=_0x15257d||0xc8;return function(_0x2154e1){if(_0x2154e1){return _0x5d1a3e[_0xd39e('0x1a')](_0x15257d)[_0xd39e('0x1b')](_0x2154e1);}};}function respondWithFilteredResult(_0x21f762,_0x11136f){return function(_0x43b886){if(_0x43b886){var _0x36fec8=typeof _0x11136f['offset']==='undefined'&&typeof _0x11136f['limit']===_0xd39e('0x1c');var _0x467f98=_0x43b886[_0xd39e('0x1d')];var _0x589c50=_0x36fec8?0x0:_0x11136f[_0xd39e('0x1e')];var _0x5d0581=_0x36fec8?_0x43b886[_0xd39e('0x1d')]:_0x11136f[_0xd39e('0x1e')]+_0x11136f[_0xd39e('0x1f')];var _0x3575f0;if(_0x5d0581>=_0x467f98){_0x5d0581=_0x467f98;_0x3575f0=0xc8;}else{_0x3575f0=0xce;}_0x21f762[_0xd39e('0x1a')](_0x3575f0);return _0x21f762[_0xd39e('0x20')](_0xd39e('0x21'),_0x589c50+'-'+_0x5d0581+'/'+_0x467f98)[_0xd39e('0x1b')](_0x43b886);}return null;};}function patchUpdates(_0x239071){return function(_0x296782){try{jsonpatch[_0xd39e('0x22')](_0x296782,_0x239071,!![]);}catch(_0x4826fd){return BPromise[_0xd39e('0x23')](_0x4826fd);}return _0x296782[_0xd39e('0x24')]();};}function saveUpdates(_0x20e150,_0x4281c9){return function(_0x2f09cb){if(_0x2f09cb){return _0x2f09cb['update'](_0x20e150)[_0xd39e('0x25')](function(_0x3f1a0d){return _0x3f1a0d;});}return null;};}function removeEntity(_0x16ca8d,_0xb068ed){return function(_0x5b4f36){if(_0x5b4f36){return _0x5b4f36['destroy']()['then'](function(){_0x16ca8d['status'](0xcc)[_0xd39e('0x26')]();});}};}function handleEntityNotFound(_0xf2b679,_0x213c87){return function(_0x57f532){if(!_0x57f532){_0xf2b679[_0xd39e('0x19')](0x194);}return _0x57f532;};}function handleError(_0x5377e3,_0x43cea3){_0x43cea3=_0x43cea3||0x1f4;return function(_0x3b5cb9){logger['error'](_0x3b5cb9['stack']);if(_0x3b5cb9[_0xd39e('0x27')]){delete _0x3b5cb9[_0xd39e('0x27')];}_0x5377e3[_0xd39e('0x1a')](_0x43cea3)[_0xd39e('0x28')](_0x3b5cb9);};}exports['index']=function(_0x123381,_0x24cab6){var _0x2bcbb8={},_0x1ff11e={},_0x48a01a={'count':0x0,'rows':[]};var _0x4e76f6=_[_0xd39e('0x29')](db['SmsTransferReport'][_0xd39e('0x2a')],function(_0x3c7104){return{'name':_0x3c7104[_0xd39e('0x2b')],'type':_0x3c7104[_0xd39e('0x2c')][_0xd39e('0x2d')]};});_0x1ff11e[_0xd39e('0x2e')]=_[_0xd39e('0x29')](_0x4e76f6,_0xd39e('0x27'));_0x1ff11e[_0xd39e('0x2f')]=_['keys'](_0x123381[_0xd39e('0x2f')]);_0x1ff11e['filters']=_['intersection'](_0x1ff11e[_0xd39e('0x2e')],_0x1ff11e[_0xd39e('0x2f')]);_0x2bcbb8[_0xd39e('0x30')]=_['intersection'](_0x1ff11e[_0xd39e('0x2e')],qs[_0xd39e('0x31')](_0x123381[_0xd39e('0x2f')][_0xd39e('0x31')]));_0x2bcbb8[_0xd39e('0x30')]=_0x2bcbb8[_0xd39e('0x30')]['length']?_0x2bcbb8[_0xd39e('0x30')]:_0x1ff11e[_0xd39e('0x2e')];if(!_0x123381[_0xd39e('0x2f')][_0xd39e('0x32')](_0xd39e('0x33'))){_0x2bcbb8[_0xd39e('0x1f')]=qs[_0xd39e('0x1f')](_0x123381[_0xd39e('0x2f')][_0xd39e('0x1f')]);_0x2bcbb8[_0xd39e('0x1e')]=qs[_0xd39e('0x1e')](_0x123381[_0xd39e('0x2f')][_0xd39e('0x1e')]);}_0x2bcbb8[_0xd39e('0x34')]=qs['sort'](_0x123381[_0xd39e('0x2f')][_0xd39e('0x35')]);_0x2bcbb8[_0xd39e('0x36')]=qs['filters'](_['pick'](_0x123381[_0xd39e('0x2f')],_0x1ff11e[_0xd39e('0x37')]),_0x4e76f6);if(_0x123381[_0xd39e('0x2f')][_0xd39e('0x38')]){_0x2bcbb8[_0xd39e('0x36')]=_['merge'](_0x2bcbb8[_0xd39e('0x36')],{'$or':_[_0xd39e('0x29')](_0x4e76f6,function(_0x3e9ac5){if(_0x3e9ac5[_0xd39e('0x2c')]!==_0xd39e('0x39')){var _0x147653={};_0x147653[_0x3e9ac5[_0xd39e('0x27')]]={'$like':'%'+_0x123381[_0xd39e('0x2f')][_0xd39e('0x38')]+'%'};return _0x147653;}})});}_0x2bcbb8=_[_0xd39e('0x3a')]({},_0x2bcbb8,_0x123381[_0xd39e('0x3b')]);var _0x5791d6={'where':_0x2bcbb8[_0xd39e('0x36')]};return db[_0xd39e('0x3c')]['count'](_0x5791d6)[_0xd39e('0x25')](function(_0x498f23){_0x48a01a[_0xd39e('0x1d')]=_0x498f23;if(_0x123381[_0xd39e('0x2f')][_0xd39e('0x3d')]){_0x2bcbb8[_0xd39e('0x3e')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xd39e('0x3f')](_0x2bcbb8);})[_0xd39e('0x25')](function(_0x46ba7b){_0x48a01a[_0xd39e('0x40')]=_0x46ba7b;return _0x48a01a;})['then'](respondWithFilteredResult(_0x24cab6,_0x2bcbb8))[_0xd39e('0x41')](handleError(_0x24cab6,null));};exports[_0xd39e('0x42')]=function(_0x22a80e,_0xf7bae9){var _0x1bb013={'raw':!![],'where':{'id':_0x22a80e[_0xd39e('0x43')]['id']}},_0x451c32={};_0x451c32['model']=_['keys'](db[_0xd39e('0x3c')][_0xd39e('0x2a')]);_0x451c32['query']=_[_0xd39e('0x44')](_0x22a80e[_0xd39e('0x2f')]);_0x451c32[_0xd39e('0x37')]=_[_0xd39e('0x45')](_0x451c32[_0xd39e('0x2e')],_0x451c32[_0xd39e('0x2f')]);_0x1bb013[_0xd39e('0x30')]=_[_0xd39e('0x45')](_0x451c32['model'],qs['fields'](_0x22a80e[_0xd39e('0x2f')][_0xd39e('0x31')]));_0x1bb013['attributes']=_0x1bb013[_0xd39e('0x30')][_0xd39e('0x46')]?_0x1bb013[_0xd39e('0x30')]:_0x451c32[_0xd39e('0x2e')];if(_0x22a80e[_0xd39e('0x2f')][_0xd39e('0x3d')]){_0x1bb013[_0xd39e('0x3e')]=[{'all':!![]}];}_0x1bb013=_[_0xd39e('0x3a')]({},_0x1bb013,_0x22a80e[_0xd39e('0x3b')]);return db[_0xd39e('0x3c')][_0xd39e('0x47')](_0x1bb013)[_0xd39e('0x25')](handleEntityNotFound(_0xf7bae9,null))[_0xd39e('0x25')](respondWithResult(_0xf7bae9,null))[_0xd39e('0x41')](handleError(_0xf7bae9,null));};exports[_0xd39e('0x48')]=function(_0x261e56,_0x5a07ae){return db['SmsTransferReport'][_0xd39e('0x48')](_0x261e56[_0xd39e('0x49')],{})[_0xd39e('0x25')](respondWithResult(_0x5a07ae,0xc9))[_0xd39e('0x41')](handleError(_0x5a07ae,null));};exports[_0xd39e('0x4a')]=function(_0x34d939,_0x542130){if(_0x34d939[_0xd39e('0x49')]['id']){delete _0x34d939[_0xd39e('0x49')]['id'];}return db[_0xd39e('0x3c')][_0xd39e('0x47')]({'where':{'id':_0x34d939[_0xd39e('0x43')]['id']}})['then'](handleEntityNotFound(_0x542130,null))['then'](saveUpdates(_0x34d939[_0xd39e('0x49')],null))[_0xd39e('0x25')](respondWithResult(_0x542130,null))['catch'](handleError(_0x542130,null));};exports['destroy']=function(_0x161069,_0x20d67b){return db['SmsTransferReport'][_0xd39e('0x47')]({'where':{'id':_0x161069[_0xd39e('0x43')]['id']}})[_0xd39e('0x25')](handleEntityNotFound(_0x20d67b,null))[_0xd39e('0x25')](removeEntity(_0x20d67b,null))['catch'](handleError(_0x20d67b,null));};exports[_0xd39e('0x4b')]=function(_0x4b5648,_0x21c91b){return db['SmsTransferReport'][_0xd39e('0x4b')]()[_0xd39e('0x25')](respondWithResult(_0x21c91b,null))[_0xd39e('0x41')](handleError(_0x21c91b,null));}; \ No newline at end of file +var _0xef83=['update','then','error','stack','name','SmsTransferReport','rawAttributes','fieldName','type','model','query','intersection','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save'];(function(_0x193f9a,_0x2e4c00){var _0x9015c0=function(_0x149c46){while(--_0x149c46){_0x193f9a['push'](_0x193f9a['shift']());}};_0x9015c0(++_0x2e4c00);}(_0xef83,0x107));var _0x3ef8=function(_0x9664b9,_0x51d10e){_0x9664b9=_0x9664b9-0x0;var _0x420c36=_0xef83[_0x9664b9];return _0x420c36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ef8('0x0'));var zipdir=require(_0x3ef8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ef8('0x2'));var moment=require(_0x3ef8('0x3'));var BPromise=require(_0x3ef8('0x4'));var Mustache=require(_0x3ef8('0x5'));var util=require(_0x3ef8('0x6'));var path=require(_0x3ef8('0x7'));var sox=require(_0x3ef8('0x8'));var csv=require(_0x3ef8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ef8('0xa'));var _=require(_0x3ef8('0xb'));var squel=require(_0x3ef8('0xc'));var crypto=require(_0x3ef8('0xd'));var jsforce=require(_0x3ef8('0xe'));var deskjs=require(_0x3ef8('0xf'));var toCsv=require(_0x3ef8('0x9'));var querystring=require('querystring');var Papa=require(_0x3ef8('0x10'));var Redis=require(_0x3ef8('0x11'));var authService=require(_0x3ef8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3ef8('0x13'));var hardwareService=require(_0x3ef8('0x14'));var logger=require(_0x3ef8('0x15'))(_0x3ef8('0x16'));var utils=require(_0x3ef8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3ef8('0x18'));var db=require(_0x3ef8('0x19'))['db'];function respondWithStatusCode(_0xd17e11,_0x33d1cf){_0x33d1cf=_0x33d1cf||0xcc;return function(_0x3f8ea0){if(_0x3f8ea0){return _0xd17e11[_0x3ef8('0x1a')](_0x33d1cf);}return _0xd17e11[_0x3ef8('0x1b')](_0x33d1cf)[_0x3ef8('0x1c')]();};}function respondWithResult(_0x4fd1d6,_0x39b429){_0x39b429=_0x39b429||0xc8;return function(_0x174f35){if(_0x174f35){return _0x4fd1d6['status'](_0x39b429)['json'](_0x174f35);}};}function respondWithFilteredResult(_0xb952fb,_0x479ba8){return function(_0x3c1f47){if(_0x3c1f47){var _0x32fa74=typeof _0x479ba8[_0x3ef8('0x1d')]===_0x3ef8('0x1e')&&typeof _0x479ba8[_0x3ef8('0x1f')]===_0x3ef8('0x1e');var _0x300a56=_0x3c1f47[_0x3ef8('0x20')];var _0x1ea3fb=_0x32fa74?0x0:_0x479ba8['offset'];var _0x514171=_0x32fa74?_0x3c1f47[_0x3ef8('0x20')]:_0x479ba8[_0x3ef8('0x1d')]+_0x479ba8[_0x3ef8('0x1f')];var _0x1d2da1;if(_0x514171>=_0x300a56){_0x514171=_0x300a56;_0x1d2da1=0xc8;}else{_0x1d2da1=0xce;}_0xb952fb[_0x3ef8('0x1b')](_0x1d2da1);return _0xb952fb[_0x3ef8('0x21')](_0x3ef8('0x22'),_0x1ea3fb+'-'+_0x514171+'/'+_0x300a56)[_0x3ef8('0x23')](_0x3c1f47);}return null;};}function patchUpdates(_0x23237e){return function(_0x1666d1){try{jsonpatch['apply'](_0x1666d1,_0x23237e,!![]);}catch(_0x33f26b){return BPromise['reject'](_0x33f26b);}return _0x1666d1[_0x3ef8('0x24')]();};}function saveUpdates(_0x545934,_0x29bb46){return function(_0x54b1b1){if(_0x54b1b1){return _0x54b1b1[_0x3ef8('0x25')](_0x545934)[_0x3ef8('0x26')](function(_0x450896){return _0x450896;});}return null;};}function removeEntity(_0x3a5cd5,_0x1fde2d){return function(_0x2838b0){if(_0x2838b0){return _0x2838b0['destroy']()[_0x3ef8('0x26')](function(){_0x3a5cd5[_0x3ef8('0x1b')](0xcc)[_0x3ef8('0x1c')]();});}};}function handleEntityNotFound(_0x18475b,_0x4f36e1){return function(_0x4f6293){if(!_0x4f6293){_0x18475b[_0x3ef8('0x1a')](0x194);}return _0x4f6293;};}function handleError(_0x544676,_0x5293d1){_0x5293d1=_0x5293d1||0x1f4;return function(_0x22bc1a){logger[_0x3ef8('0x27')](_0x22bc1a[_0x3ef8('0x28')]);if(_0x22bc1a[_0x3ef8('0x29')]){delete _0x22bc1a[_0x3ef8('0x29')];}_0x544676[_0x3ef8('0x1b')](_0x5293d1)['send'](_0x22bc1a);};}exports['index']=function(_0x5c0535,_0x554347){var _0x265c8f={},_0x4f51ac={},_0x255919={'count':0x0,'rows':[]};var _0x2f2e62=_['map'](db[_0x3ef8('0x2a')][_0x3ef8('0x2b')],function(_0x4a6566){return{'name':_0x4a6566[_0x3ef8('0x2c')],'type':_0x4a6566[_0x3ef8('0x2d')]['key']};});_0x4f51ac[_0x3ef8('0x2e')]=_['map'](_0x2f2e62,_0x3ef8('0x29'));_0x4f51ac[_0x3ef8('0x2f')]=_['keys'](_0x5c0535['query']);_0x4f51ac['filters']=_[_0x3ef8('0x30')](_0x4f51ac['model'],_0x4f51ac[_0x3ef8('0x2f')]);_0x265c8f['attributes']=_[_0x3ef8('0x30')](_0x4f51ac[_0x3ef8('0x2e')],qs['fields'](_0x5c0535[_0x3ef8('0x2f')]['fields']));_0x265c8f['attributes']=_0x265c8f['attributes'][_0x3ef8('0x31')]?_0x265c8f[_0x3ef8('0x32')]:_0x4f51ac[_0x3ef8('0x2e')];if(!_0x5c0535[_0x3ef8('0x2f')][_0x3ef8('0x33')](_0x3ef8('0x34'))){_0x265c8f['limit']=qs[_0x3ef8('0x1f')](_0x5c0535[_0x3ef8('0x2f')][_0x3ef8('0x1f')]);_0x265c8f[_0x3ef8('0x1d')]=qs['offset'](_0x5c0535[_0x3ef8('0x2f')][_0x3ef8('0x1d')]);}_0x265c8f[_0x3ef8('0x35')]=qs[_0x3ef8('0x36')](_0x5c0535[_0x3ef8('0x2f')][_0x3ef8('0x36')]);_0x265c8f[_0x3ef8('0x37')]=qs[_0x3ef8('0x38')](_[_0x3ef8('0x39')](_0x5c0535[_0x3ef8('0x2f')],_0x4f51ac[_0x3ef8('0x38')]),_0x2f2e62);if(_0x5c0535[_0x3ef8('0x2f')]['filter']){_0x265c8f[_0x3ef8('0x37')]=_[_0x3ef8('0x3a')](_0x265c8f[_0x3ef8('0x37')],{'$or':_[_0x3ef8('0x3b')](_0x2f2e62,function(_0x1ab118){if(_0x1ab118[_0x3ef8('0x2d')]!=='VIRTUAL'){var _0x585dd6={};_0x585dd6[_0x1ab118[_0x3ef8('0x29')]]={'$like':'%'+_0x5c0535['query']['filter']+'%'};return _0x585dd6;}})});}_0x265c8f=_['merge']({},_0x265c8f,_0x5c0535[_0x3ef8('0x3c')]);var _0x136625={'where':_0x265c8f['where']};return db['SmsTransferReport']['count'](_0x136625)['then'](function(_0x12f539){_0x255919['count']=_0x12f539;if(_0x5c0535[_0x3ef8('0x2f')][_0x3ef8('0x3d')]){_0x265c8f[_0x3ef8('0x3e')]=[{'all':!![]}];}return db[_0x3ef8('0x2a')][_0x3ef8('0x3f')](_0x265c8f);})[_0x3ef8('0x26')](function(_0x4c4fae){_0x255919[_0x3ef8('0x40')]=_0x4c4fae;return _0x255919;})[_0x3ef8('0x26')](respondWithFilteredResult(_0x554347,_0x265c8f))[_0x3ef8('0x41')](handleError(_0x554347,null));};exports[_0x3ef8('0x42')]=function(_0x489a1d,_0x72526){var _0x3c95b8={'raw':!![],'where':{'id':_0x489a1d[_0x3ef8('0x43')]['id']}},_0xd367a2={};_0xd367a2[_0x3ef8('0x2e')]=_['keys'](db[_0x3ef8('0x2a')][_0x3ef8('0x2b')]);_0xd367a2[_0x3ef8('0x2f')]=_[_0x3ef8('0x44')](_0x489a1d['query']);_0xd367a2[_0x3ef8('0x38')]=_['intersection'](_0xd367a2[_0x3ef8('0x2e')],_0xd367a2[_0x3ef8('0x2f')]);_0x3c95b8['attributes']=_[_0x3ef8('0x30')](_0xd367a2[_0x3ef8('0x2e')],qs[_0x3ef8('0x45')](_0x489a1d['query'][_0x3ef8('0x45')]));_0x3c95b8[_0x3ef8('0x32')]=_0x3c95b8[_0x3ef8('0x32')][_0x3ef8('0x31')]?_0x3c95b8['attributes']:_0xd367a2[_0x3ef8('0x2e')];if(_0x489a1d[_0x3ef8('0x2f')][_0x3ef8('0x3d')]){_0x3c95b8['include']=[{'all':!![]}];}_0x3c95b8=_[_0x3ef8('0x3a')]({},_0x3c95b8,_0x489a1d[_0x3ef8('0x3c')]);return db[_0x3ef8('0x2a')][_0x3ef8('0x46')](_0x3c95b8)[_0x3ef8('0x26')](handleEntityNotFound(_0x72526,null))[_0x3ef8('0x26')](respondWithResult(_0x72526,null))['catch'](handleError(_0x72526,null));};exports[_0x3ef8('0x47')]=function(_0xbcdff1,_0x36c58b){return db[_0x3ef8('0x2a')][_0x3ef8('0x47')](_0xbcdff1[_0x3ef8('0x48')],{})[_0x3ef8('0x26')](respondWithResult(_0x36c58b,0xc9))[_0x3ef8('0x41')](handleError(_0x36c58b,null));};exports[_0x3ef8('0x25')]=function(_0x44e9a4,_0x39bf69){if(_0x44e9a4[_0x3ef8('0x48')]['id']){delete _0x44e9a4[_0x3ef8('0x48')]['id'];}return db[_0x3ef8('0x2a')]['find']({'where':{'id':_0x44e9a4[_0x3ef8('0x43')]['id']}})[_0x3ef8('0x26')](handleEntityNotFound(_0x39bf69,null))['then'](saveUpdates(_0x44e9a4[_0x3ef8('0x48')],null))[_0x3ef8('0x26')](respondWithResult(_0x39bf69,null))[_0x3ef8('0x41')](handleError(_0x39bf69,null));};exports[_0x3ef8('0x49')]=function(_0x41db18,_0x2e1b6b){return db[_0x3ef8('0x2a')][_0x3ef8('0x46')]({'where':{'id':_0x41db18[_0x3ef8('0x43')]['id']}})[_0x3ef8('0x26')](handleEntityNotFound(_0x2e1b6b,null))[_0x3ef8('0x26')](removeEntity(_0x2e1b6b,null))[_0x3ef8('0x41')](handleError(_0x2e1b6b,null));};exports[_0x3ef8('0x4a')]=function(_0x5be082,_0xb65ad){return db[_0x3ef8('0x2a')]['describe']()[_0x3ef8('0x26')](respondWithResult(_0xb65ad,null))[_0x3ef8('0x41')](handleError(_0xb65ad,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 970bdb0..e04b48b 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 _0x0411=['api','moment','bluebird','request-promise','path','rimraf','exports','uniqueid','lodash','util','../../config/logger'];(function(_0x5575d8,_0x23db75){var _0x6a0da1=function(_0x6189ba){while(--_0x6189ba){_0x5575d8['push'](_0x5575d8['shift']());}};_0x6a0da1(++_0x23db75);}(_0x0411,0x15d));var _0x1041=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0x0411[_0x4ebdf4];return _0x18d1c1;};'use strict';var _=require(_0x1041('0x0'));var util=require(_0x1041('0x1'));var logger=require(_0x1041('0x2'))(_0x1041('0x3'));var moment=require(_0x1041('0x4'));var BPromise=require(_0x1041('0x5'));var rp=require(_0x1041('0x6'));var fs=require('fs');var path=require(_0x1041('0x7'));var rimraf=require(_0x1041('0x8'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x1041('0x9')]=function(_0x109868,_0x4d9940){return _0x109868['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x1041('0xa'),'fields':[_0x1041('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d9e=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_sms_transfer'];(function(_0x4d39c4,_0x4fe227){var _0x31b318=function(_0x14617b){while(--_0x14617b){_0x4d39c4['push'](_0x4d39c4['shift']());}};_0x31b318(++_0x4fe227);}(_0x3d9e,0x181));var _0xe3d9=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x3d9e[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require(_0xe3d9('0x0'));var logger=require(_0xe3d9('0x1'))(_0xe3d9('0x2'));var moment=require(_0xe3d9('0x3'));var BPromise=require(_0xe3d9('0x4'));var rp=require(_0xe3d9('0x5'));var fs=require('fs');var path=require(_0xe3d9('0x6'));var rimraf=require(_0xe3d9('0x7'));var config=require(_0xe3d9('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0xe3d9('0x9')]=function(_0xfa896e,_0x178be9){return _0xfa896e['define']('SmsTransferReport',attributes,{'tableName':_0xe3d9('0xa'),'paranoid':![],'indexes':[{'name':_0xe3d9('0xb'),'fields':[_0xe3d9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 314804b..61ff71e 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 _0xf88f=['then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2b4c19,_0x20f21c){var _0x3881e0=function(_0xc9c4ac){while(--_0xc9c4ac){_0x2b4c19['push'](_0x2b4c19['shift']());}};_0x3881e0(++_0x20f21c);}(_0xf88f,0x1bb));var _0xff88=function(_0xcf2783,_0xf0ceaf){_0xcf2783=_0xcf2783-0x0;var _0x56d6a7=_0xf88f[_0xcf2783];return _0x56d6a7;};'use strict';var _=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var moment=require(_0xff88('0x2'));var BPromise=require(_0xff88('0x3'));var rs=require(_0xff88('0x4'));var fs=require('fs');var Redis=require(_0xff88('0x5'));var db=require(_0xff88('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xff88('0x7'))(_0xff88('0x8'));var config=require(_0xff88('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff88('0xa')][_0xff88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4140a8,_0x1c3110,_0x3551e6){return new BPromise(function(_0x469bfd,_0x585e2b){return client[_0xff88('0xc')](_0x4140a8,_0x3551e6)[_0xff88('0xd')](function(_0x233e85){logger[_0xff88('0xe')](_0xff88('0xf'),_0x1c3110,_0xff88('0x10'));logger[_0xff88('0x11')](_0xff88('0x12'),_0x1c3110,_0xff88('0x10'),JSON[_0xff88('0x13')](_0x233e85));if(_0x233e85[_0xff88('0x14')]){if(_0x233e85[_0xff88('0x14')][_0xff88('0x15')]===0x1f4){logger[_0xff88('0x14')](_0xff88('0xf'),_0x1c3110,_0x233e85['error'][_0xff88('0x16')]);return _0x585e2b(_0x233e85[_0xff88('0x14')][_0xff88('0x16')]);}logger['error'](_0xff88('0xf'),_0x1c3110,_0x233e85[_0xff88('0x14')][_0xff88('0x16')]);return _0x469bfd(_0x233e85[_0xff88('0x14')][_0xff88('0x16')]);}else{logger[_0xff88('0xe')](_0xff88('0xf'),_0x1c3110,_0xff88('0x10'));_0x469bfd(_0x233e85['result'][_0xff88('0x16')]);}})[_0xff88('0x17')](function(_0x5d75ff){logger['error'](_0xff88('0xf'),_0x1c3110,_0x5d75ff);_0x585e2b(_0x5d75ff);});});} \ No newline at end of file +var _0xf2cf=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','util','moment'];(function(_0x5bf372,_0x100981){var _0x255b42=function(_0x55d2b7){while(--_0x55d2b7){_0x5bf372['push'](_0x5bf372['shift']());}};_0x255b42(++_0x100981);}(_0xf2cf,0xf5));var _0xff2c=function(_0x54ced1,_0x2d2638){_0x54ced1=_0x54ced1-0x0;var _0x431832=_0xf2cf[_0x54ced1];return _0x431832;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var moment=require(_0xff2c('0x1'));var BPromise=require(_0xff2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff2c('0x3'));var db=require(_0xff2c('0x4'))['db'];var utils=require(_0xff2c('0x5'));var logger=require(_0xff2c('0x6'))(_0xff2c('0x7'));var config=require(_0xff2c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xff2c('0x9')][_0xff2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ba3d,_0x21c5a5,_0x223a86){return new BPromise(function(_0x105f4d,_0x7ba107){return client[_0xff2c('0xb')](_0x57ba3d,_0x223a86)[_0xff2c('0xc')](function(_0x133ee9){logger['info'](_0xff2c('0xd'),_0x21c5a5,_0xff2c('0xe'));logger[_0xff2c('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x21c5a5,_0xff2c('0xe'),JSON[_0xff2c('0x10')](_0x133ee9));if(_0x133ee9[_0xff2c('0x11')]){if(_0x133ee9['error']['code']===0x1f4){logger[_0xff2c('0x11')](_0xff2c('0xd'),_0x21c5a5,_0x133ee9['error'][_0xff2c('0x12')]);return _0x7ba107(_0x133ee9['error']['message']);}logger[_0xff2c('0x11')](_0xff2c('0xd'),_0x21c5a5,_0x133ee9[_0xff2c('0x11')][_0xff2c('0x12')]);return _0x105f4d(_0x133ee9['error'][_0xff2c('0x12')]);}else{logger['info'](_0xff2c('0xd'),_0x21c5a5,_0xff2c('0xe'));_0x105f4d(_0x133ee9['result']['message']);}})['catch'](function(_0x31cec8){logger[_0xff2c('0x11')](_0xff2c('0xd'),_0x21c5a5,_0x31cec8);_0x7ba107(_0x31cec8);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 4012ac2..1f3171f 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 _0xe821=['delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update'];(function(_0x285b1c,_0x2fac84){var _0x1ed03e=function(_0x503562){while(--_0x503562){_0x285b1c['push'](_0x285b1c['shift']());}};_0x1ed03e(++_0x2fac84);}(_0xe821,0xdb));var _0x1e82=function(_0x57c566,_0x4bdb66){_0x57c566=_0x57c566-0x0;var _0x344f09=_0xe821[_0x57c566];return _0x344f09;};'use strict';var multer=require(_0x1e82('0x0'));var util=require(_0x1e82('0x1'));var path=require('path');var timeout=require(_0x1e82('0x2'));var express=require('express');var router=express[_0x1e82('0x3')]();var fs_extra=require(_0x1e82('0x4'));var auth=require(_0x1e82('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e82('0x6'));router[_0x1e82('0x7')]('/',auth[_0x1e82('0x8')](),controller['index']);router[_0x1e82('0x7')](_0x1e82('0x9'),auth[_0x1e82('0x8')](),controller[_0x1e82('0xa')]);router[_0x1e82('0x7')](_0x1e82('0xb'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x1e82('0xc')]({'destination':function(_0x1f47c2,_0x3b130c,_0x1d1d55){_0x1d1d55(null,path[_0x1e82('0xd')](config[_0x1e82('0xe')],_0x1e82('0xf')));},'filename':function(_0x575000,_0xa9579f,_0x37b845){_0xa9579f[_0x1e82('0x10')]=_0xa9579f['originalname'][_0x1e82('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x37b845(null,util[_0x1e82('0x12')](_0x1e82('0x13'),path[_0x1e82('0x14')](_0xa9579f['originalname'],path[_0x1e82('0x15')](_0xa9579f[_0x1e82('0x10')])),Date[_0x1e82('0x16')](),path[_0x1e82('0x15')](_0xa9579f[_0x1e82('0x10')])));}})});router[_0x1e82('0x17')]('/',upload[_0x1e82('0x18')](_0x1e82('0x19')),controller[_0x1e82('0x1a')]);router[_0x1e82('0x1b')](_0x1e82('0x9'),auth['isAuthenticated'](),controller[_0x1e82('0x1c')]);router[_0x1e82('0x1d')]('/:id',auth[_0x1e82('0x8')](),controller['delete']);module[_0x1e82('0x1e')]=router; \ No newline at end of file +var _0x3b73=['get','isAuthenticated','/:id/download','download','diskStorage','join','root','originalname','replace','basename','now','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x3b73,0x7d));var _0x33b7=function(_0xd256a1,_0x2aae80){_0xd256a1=_0xd256a1-0x0;var _0x2a11a4=_0x3b73[_0xd256a1];return _0x2a11a4;};'use strict';var multer=require(_0x33b7('0x0'));var util=require(_0x33b7('0x1'));var path=require(_0x33b7('0x2'));var timeout=require(_0x33b7('0x3'));var express=require(_0x33b7('0x4'));var router=express[_0x33b7('0x5')]();var fs_extra=require(_0x33b7('0x6'));var auth=require(_0x33b7('0x7'));var interaction=require(_0x33b7('0x8'));var config=require(_0x33b7('0x9'));var controller=require('./sound.controller');router[_0x33b7('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x33b7('0xb')](),controller['show']);router[_0x33b7('0xa')](_0x33b7('0xc'),auth[_0x33b7('0xb')](),controller[_0x33b7('0xd')]);var upload=multer({'storage':multer[_0x33b7('0xe')]({'destination':function(_0x247024,_0x5e0874,_0x3ca814){_0x3ca814(null,path[_0x33b7('0xf')](config[_0x33b7('0x10')],'server/files/sounds/original/'));},'filename':function(_0x106a4a,_0xd2e1de,_0x5a6f9a){_0xd2e1de[_0x33b7('0x11')]=_0xd2e1de['originalname'][_0x33b7('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5a6f9a(null,util['format']('%s-%s%s',path[_0x33b7('0x13')](_0xd2e1de['originalname'],path['extname'](_0xd2e1de[_0x33b7('0x11')])),Date[_0x33b7('0x14')](),path['extname'](_0xd2e1de['originalname'])));}})});router[_0x33b7('0x15')]('/',upload['single']('file'),controller[_0x33b7('0x16')]);router[_0x33b7('0x17')]('/:id',auth[_0x33b7('0xb')](),controller[_0x33b7('0x18')]);router[_0x33b7('0x19')]('/:id',auth[_0x33b7('0xb')](),controller['delete']);module[_0x33b7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f4762a1..5a2a77f 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 _0x1e7c=['exports','name','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x48fd64,_0x1d50e3){var _0x1bb92e=function(_0x4b745a){while(--_0x4b745a){_0x48fd64['push'](_0x48fd64['shift']());}};_0x1bb92e(++_0x1d50e3);}(_0x1e7c,0x186));var _0xc1e7=function(_0x3c11a1,_0x19c207){_0x3c11a1=_0x3c11a1-0x0;var _0x1941c7=_0x1e7c[_0x3c11a1];return _0x1941c7;};'use strict';var Sequelize=require('sequelize');module[_0xc1e7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc1e7('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc1e7('0x2')]},'display_name':{'type':Sequelize[_0xc1e7('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xc1e7('0x2')]},'original_duration':{'type':Sequelize[_0xc1e7('0x3')]},'original_sampleCount':{'type':Sequelize[_0xc1e7('0x4')]},'original_channelCount':{'type':Sequelize[_0xc1e7('0x5')]},'original_bitRate':{'type':Sequelize[_0xc1e7('0x4')]},'original_sampleRate':{'type':Sequelize[_0xc1e7('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xc1e7('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xc1e7('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xc1e7('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x47c1=['BIGINT','INTEGER','sequelize','exports','name','STRING','FLOAT'];(function(_0x1460ab,_0x74d06e){var _0x1eeb5c=function(_0x28de38){while(--_0x28de38){_0x1460ab['push'](_0x1460ab['shift']());}};_0x1eeb5c(++_0x74d06e);}(_0x47c1,0x1bb));var _0x147c=function(_0x3cb09b,_0x31c2a5){_0x3cb09b=_0x3cb09b-0x0;var _0x242048=_0x47c1[_0x3cb09b];return _0x242048;};'use strict';var Sequelize=require(_0x147c('0x0'));module[_0x147c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x147c('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x147c('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x147c('0x4')]},'original_sampleCount':{'type':Sequelize[_0x147c('0x5')]},'original_channelCount':{'type':Sequelize[_0x147c('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x147c('0x6')]},'converted_format':{'type':Sequelize[_0x147c('0x3')]},'converted_duration':{'type':Sequelize[_0x147c('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x147c('0x5')]},'converted_channelCount':{'type':Sequelize[_0x147c('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x147c('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 64427fd..690706a 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 _0xd9e3=['set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','includeAll','include','findAll','catch','params','length','options','find','download','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','save_name','converted_format','create','originalname','extname','file','substring','wav','server/files/sounds/original','filename','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0xd9e3,0x1dc));var _0x3d9e=function(_0x446f52,_0x5b9dc6){_0x446f52=_0x446f52-0x0;var _0x2013cd=_0xd9e3[_0x446f52];return _0x2013cd;};'use strict';var emlformat=require(_0x3d9e('0x0'));var rimraf=require(_0x3d9e('0x1'));var zipdir=require(_0x3d9e('0x2'));var jsonpatch=require(_0x3d9e('0x3'));var rp=require(_0x3d9e('0x4'));var moment=require(_0x3d9e('0x5'));var BPromise=require(_0x3d9e('0x6'));var Mustache=require(_0x3d9e('0x7'));var util=require(_0x3d9e('0x8'));var path=require(_0x3d9e('0x9'));var sox=require('sox');var csv=require(_0x3d9e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d9e('0xb'));var _=require('lodash');var squel=require(_0x3d9e('0xc'));var crypto=require(_0x3d9e('0xd'));var jsforce=require(_0x3d9e('0xe'));var deskjs=require(_0x3d9e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3d9e('0x10'));var Redis=require(_0x3d9e('0x11'));var authService=require(_0x3d9e('0x12'));var qs=require(_0x3d9e('0x13'));var as=require(_0x3d9e('0x14'));var hardwareService=require(_0x3d9e('0x15'));var logger=require(_0x3d9e('0x16'))(_0x3d9e('0x17'));var utils=require(_0x3d9e('0x18'));var config=require(_0x3d9e('0x19'));var licenseUtil=require(_0x3d9e('0x1a'));var db=require(_0x3d9e('0x1b'))['db'];function respondWithStatusCode(_0x4668f7,_0x15a354){_0x15a354=_0x15a354||0xcc;return function(_0xf0ed86){if(_0xf0ed86){return _0x4668f7[_0x3d9e('0x1c')](_0x15a354);}return _0x4668f7[_0x3d9e('0x1d')](_0x15a354)[_0x3d9e('0x1e')]();};}function respondWithResult(_0x307656,_0x5d1bda){_0x5d1bda=_0x5d1bda||0xc8;return function(_0x2d79b6){if(_0x2d79b6){return _0x307656['status'](_0x5d1bda)[_0x3d9e('0x1f')](_0x2d79b6);}};}function respondWithFilteredResult(_0x4ab31f,_0x586600){return function(_0x79e0ec){if(_0x79e0ec){var _0x252fac=typeof _0x586600[_0x3d9e('0x20')]===_0x3d9e('0x21')&&typeof _0x586600[_0x3d9e('0x22')]===_0x3d9e('0x21');var _0x117a2b=_0x79e0ec['count'];var _0x249050=_0x252fac?0x0:_0x586600[_0x3d9e('0x20')];var _0x5e1d4f=_0x252fac?_0x79e0ec[_0x3d9e('0x23')]:_0x586600[_0x3d9e('0x20')]+_0x586600[_0x3d9e('0x22')];var _0x466039;if(_0x5e1d4f>=_0x117a2b){_0x5e1d4f=_0x117a2b;_0x466039=0xc8;}else{_0x466039=0xce;}_0x4ab31f[_0x3d9e('0x1d')](_0x466039);return _0x4ab31f[_0x3d9e('0x24')](_0x3d9e('0x25'),_0x249050+'-'+_0x5e1d4f+'/'+_0x117a2b)['json'](_0x79e0ec);}return null;};}function patchUpdates(_0x225dae){return function(_0x107d3b){try{jsonpatch[_0x3d9e('0x26')](_0x107d3b,_0x225dae,!![]);}catch(_0x2edfa3){return BPromise[_0x3d9e('0x27')](_0x2edfa3);}return _0x107d3b[_0x3d9e('0x28')]();};}function saveUpdates(_0x4b6cef,_0x57aac0){return function(_0x507456){if(_0x507456){return _0x507456[_0x3d9e('0x29')](_0x4b6cef)[_0x3d9e('0x2a')](function(_0x478b8e){return _0x478b8e;});}return null;};}function removeEntity(_0x8cadc4,_0x261800){return function(_0xeff775){if(_0xeff775){return _0xeff775[_0x3d9e('0x2b')]()[_0x3d9e('0x2a')](function(){var _0x2001aa=_0xeff775[_0x3d9e('0x2c')]({'plain':!![]});var _0x12c39d=_0x3d9e('0x2d');return db[_0x3d9e('0x2e')][_0x3d9e('0x2b')]({'where':{'type':_0x12c39d,'resourceId':_0x2001aa['id']}})[_0x3d9e('0x2a')](function(){return _0xeff775;});})['then'](function(){_0x8cadc4[_0x3d9e('0x1d')](0xcc)[_0x3d9e('0x1e')]();});}};}function handleEntityNotFound(_0x81d692,_0x28a02d){return function(_0xdeaa3f){if(!_0xdeaa3f){_0x81d692['sendStatus'](0x194);}return _0xdeaa3f;};}function handleError(_0x4df81a,_0x51c01f){_0x51c01f=_0x51c01f||0x1f4;return function(_0x30aed5){logger[_0x3d9e('0x2f')](_0x30aed5[_0x3d9e('0x30')]);if(_0x30aed5[_0x3d9e('0x31')]){delete _0x30aed5['name'];}_0x4df81a['status'](_0x51c01f)[_0x3d9e('0x32')](_0x30aed5);};}exports['index']=function(_0x385fa2,_0x4ad32b){var _0x43944e={},_0x17db91={},_0x299e6e={'count':0x0,'rows':[]};var _0x5171c1=_[_0x3d9e('0x33')](db[_0x3d9e('0x34')][_0x3d9e('0x35')],function(_0x3d74bf){return{'name':_0x3d74bf[_0x3d9e('0x36')],'type':_0x3d74bf[_0x3d9e('0x37')][_0x3d9e('0x38')]};});_0x17db91[_0x3d9e('0x39')]=_[_0x3d9e('0x33')](_0x5171c1,_0x3d9e('0x31'));_0x17db91[_0x3d9e('0x3a')]=_[_0x3d9e('0x3b')](_0x385fa2[_0x3d9e('0x3a')]);_0x17db91['filters']=_[_0x3d9e('0x3c')](_0x17db91[_0x3d9e('0x39')],_0x17db91['query']);_0x43944e[_0x3d9e('0x3d')]=_[_0x3d9e('0x3c')](_0x17db91[_0x3d9e('0x39')],qs[_0x3d9e('0x3e')](_0x385fa2['query']['fields']));_0x43944e['attributes']=_0x43944e['attributes']['length']?_0x43944e[_0x3d9e('0x3d')]:_0x17db91[_0x3d9e('0x39')];if(!_0x385fa2[_0x3d9e('0x3a')][_0x3d9e('0x3f')]('nolimit')){_0x43944e['limit']=qs['limit'](_0x385fa2[_0x3d9e('0x3a')]['limit']);_0x43944e[_0x3d9e('0x20')]=qs['offset'](_0x385fa2[_0x3d9e('0x3a')]['offset']);}_0x43944e[_0x3d9e('0x40')]=qs[_0x3d9e('0x41')](_0x385fa2[_0x3d9e('0x3a')][_0x3d9e('0x41')]);_0x43944e[_0x3d9e('0x42')]=qs[_0x3d9e('0x43')](_[_0x3d9e('0x44')](_0x385fa2[_0x3d9e('0x3a')],_0x17db91[_0x3d9e('0x43')]),_0x5171c1);if(_0x385fa2[_0x3d9e('0x3a')]['filter']){_0x43944e['where']=_['merge'](_0x43944e['where'],{'$or':_['map'](_0x5171c1,function(_0x1db019){if(_0x1db019[_0x3d9e('0x37')]!=='VIRTUAL'){var _0x343bb6={};_0x343bb6[_0x1db019[_0x3d9e('0x31')]]={'$like':'%'+_0x385fa2[_0x3d9e('0x3a')][_0x3d9e('0x45')]+'%'};return _0x343bb6;}})});}_0x43944e=_['merge']({},_0x43944e,_0x385fa2['options']);var _0x18a4ca={'where':_0x43944e['where']};return db[_0x3d9e('0x34')]['count'](_0x18a4ca)[_0x3d9e('0x2a')](function(_0x1c5ec8){_0x299e6e[_0x3d9e('0x23')]=_0x1c5ec8;if(_0x385fa2[_0x3d9e('0x3a')][_0x3d9e('0x46')]){_0x43944e[_0x3d9e('0x47')]=[{'all':!![]}];}return db[_0x3d9e('0x34')][_0x3d9e('0x48')](_0x43944e);})[_0x3d9e('0x2a')](function(_0x4e3f08){_0x299e6e['rows']=_0x4e3f08;return _0x299e6e;})[_0x3d9e('0x2a')](respondWithFilteredResult(_0x4ad32b,_0x43944e))[_0x3d9e('0x49')](handleError(_0x4ad32b,null));};exports['show']=function(_0x21d864,_0x457b76){var _0x51e2d4={'raw':!![],'where':{'id':_0x21d864[_0x3d9e('0x4a')]['id']}},_0x2ac47e={};_0x2ac47e['model']=_[_0x3d9e('0x3b')](db[_0x3d9e('0x34')][_0x3d9e('0x35')]);_0x2ac47e['query']=_[_0x3d9e('0x3b')](_0x21d864[_0x3d9e('0x3a')]);_0x2ac47e['filters']=_[_0x3d9e('0x3c')](_0x2ac47e['model'],_0x2ac47e[_0x3d9e('0x3a')]);_0x51e2d4[_0x3d9e('0x3d')]=_[_0x3d9e('0x3c')](_0x2ac47e[_0x3d9e('0x39')],qs['fields'](_0x21d864[_0x3d9e('0x3a')]['fields']));_0x51e2d4['attributes']=_0x51e2d4[_0x3d9e('0x3d')][_0x3d9e('0x4b')]?_0x51e2d4[_0x3d9e('0x3d')]:_0x2ac47e[_0x3d9e('0x39')];if(_0x21d864[_0x3d9e('0x3a')][_0x3d9e('0x46')]){_0x51e2d4[_0x3d9e('0x47')]=[{'all':!![]}];}_0x51e2d4=_['merge']({},_0x51e2d4,_0x21d864[_0x3d9e('0x4c')]);return db['Sound'][_0x3d9e('0x4d')](_0x51e2d4)[_0x3d9e('0x2a')](handleEntityNotFound(_0x457b76,null))[_0x3d9e('0x2a')](respondWithResult(_0x457b76,null))[_0x3d9e('0x49')](handleError(_0x457b76,null));};exports[_0x3d9e('0x4e')]=function(_0x12ce96,_0x573f9f,_0x38567b){return db[_0x3d9e('0x34')][_0x3d9e('0x4d')]({'where':{'id':_0x12ce96[_0x3d9e('0x4a')]['id']},'attributes':['name','save_name','converted_format'],'raw':!![]})[_0x3d9e('0x2a')](handleEntityNotFound(_0x573f9f,null))[_0x3d9e('0x2a')](function(_0xe2034f){if(_0xe2034f){if(!fs[_0x3d9e('0x4f')](path[_0x3d9e('0x50')](config[_0x3d9e('0x51')],_0x3d9e('0x52'),_0xe2034f['save_name']+'.'+_0xe2034f['converted_format']))){throw new db[(_0x3d9e('0x53'))]['ValidationError'](_0x3d9e('0x54'));}return _0x573f9f[_0x3d9e('0x4e')](path[_0x3d9e('0x50')](config[_0x3d9e('0x51')],_0x3d9e('0x52'),util[_0x3d9e('0x55')](_0x3d9e('0x56'),_0xe2034f[_0x3d9e('0x57')],_0xe2034f[_0x3d9e('0x58')])),util['format'](_0x3d9e('0x56'),_0xe2034f[_0x3d9e('0x31')],_0xe2034f[_0x3d9e('0x58')]));}return null;})['catch'](handleError(_0x573f9f,null));};exports[_0x3d9e('0x59')]=function(_0x1bc447,_0x5b312a,_0x1a03a1){var _0x299b89={'name':path['basename'](_0x1bc447['file'][_0x3d9e('0x5a')],path[_0x3d9e('0x5b')](_0x1bc447['file'][_0x3d9e('0x5a')])),'save_name':path['basename'](_0x1bc447[_0x3d9e('0x5c')]['filename'],path[_0x3d9e('0x5b')](_0x1bc447[_0x3d9e('0x5c')]['filename'])),'original_format':path[_0x3d9e('0x5b')](_0x1bc447[_0x3d9e('0x5c')]['originalname'])[_0x3d9e('0x5d')](0x1),'converted_format':_0x3d9e('0x5e')};var _0x3a2849=path['join'](config[_0x3d9e('0x51')],_0x3d9e('0x5f'),_0x1bc447[_0x3d9e('0x5c')][_0x3d9e('0x60')]);var _0x49db09=path[_0x3d9e('0x50')](config[_0x3d9e('0x51')],_0x3d9e('0x52'),util[_0x3d9e('0x55')]('%s.%s',path[_0x3d9e('0x61')](_0x1bc447[_0x3d9e('0x5c')][_0x3d9e('0x60')],path[_0x3d9e('0x5b')](_0x1bc447['file'][_0x3d9e('0x60')])),_0x299b89[_0x3d9e('0x58')]));logger[_0x3d9e('0x62')](_0x3d9e('0x63'),_0x3a2849);logger['info'](_0x3d9e('0x64'),_0x49db09);try{fs['chmodSync'](_0x3a2849,parseInt('0777',0x8));var _0x6305de=sox[_0x3d9e('0x65')](_0x3a2849,_0x49db09,{'sampleRate':0x1f40,'format':_0x3d9e('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6305de['on']('error',function(_0x35ef1d){fs['unlinkSync'](_0x3a2849);_0x5b312a[_0x3d9e('0x1d')](0x1f4)[_0x3d9e('0x32')](_0x35ef1d);});_0x6305de['on']('src',function(_0x48975d){_0x299b89[_0x3d9e('0x66')]=isNaN(_0x48975d[_0x3d9e('0x67')])?null:_0x48975d['duration']*0x3e8;_0x299b89[_0x3d9e('0x68')]=isNaN(_0x48975d[_0x3d9e('0x69')])?null:_0x48975d[_0x3d9e('0x69')];_0x299b89['original_channelCount']=isNaN(_0x48975d[_0x3d9e('0x6a')])?null:_0x48975d[_0x3d9e('0x6a')];_0x299b89[_0x3d9e('0x6b')]=isNaN(_0x48975d[_0x3d9e('0x6c')])?null:_0x48975d[_0x3d9e('0x6c')];_0x299b89[_0x3d9e('0x6d')]=isNaN(_0x48975d[_0x3d9e('0x6e')])?null:_0x48975d[_0x3d9e('0x6e')];});_0x6305de['on'](_0x3d9e('0x6f'),function(_0xc4fc26){_0x299b89[_0x3d9e('0x70')]=isNaN(_0xc4fc26[_0x3d9e('0x67')])?null:_0xc4fc26['duration']*0x3e8;_0x299b89[_0x3d9e('0x71')]=isNaN(_0xc4fc26[_0x3d9e('0x69')])?null:_0xc4fc26[_0x3d9e('0x69')];_0x299b89[_0x3d9e('0x72')]=isNaN(_0xc4fc26[_0x3d9e('0x6a')])?null:_0xc4fc26['channelCount'];_0x299b89[_0x3d9e('0x73')]=isNaN(_0xc4fc26[_0x3d9e('0x6c')])?null:_0xc4fc26[_0x3d9e('0x6c')];_0x299b89[_0x3d9e('0x74')]=isNaN(_0xc4fc26['sampleRate'])?null:_0xc4fc26['sampleRate'];});_0x6305de['on'](_0x3d9e('0x1e'),function(){fs[_0x3d9e('0x75')](_0x49db09,parseInt(_0x3d9e('0x76'),0x8));return db['Sound'][_0x3d9e('0x59')](_0x299b89)[_0x3d9e('0x2a')](function(_0x108018){var _0x3bbb20={'role':_0x1bc447[_0x3d9e('0x77')][_0x3d9e('0x78')],'userProfileId':_0x1bc447['body'][_0x3d9e('0x79')]};if(!_0x3bbb20)throw new Error(_0x3d9e('0x7a'));if(_0x3bbb20[_0x3d9e('0x78')]===_0x3d9e('0x7b')){var _0x2e8666=_0x108018[_0x3d9e('0x2c')]({'plain':!![]});return db[_0x3d9e('0x7c')][_0x3d9e('0x4d')]({'where':{'name':_0x3d9e('0x2d'),'userProfileId':_0x3bbb20[_0x3d9e('0x79')]},'raw':!![]})[_0x3d9e('0x2a')](function(_0x4b046c){if(_0x4b046c&&_0x4b046c[_0x3d9e('0x7d')]===0x0){return db[_0x3d9e('0x2e')]['create']({'name':_0x2e8666[_0x3d9e('0x31')],'resourceId':_0x2e8666['id'],'type':_0x4b046c[_0x3d9e('0x31')],'sectionId':_0x4b046c['id']},{})['then'](function(){return _0x108018;});}else{return _0x108018;}})[_0x3d9e('0x49')](function(_0x50d74b){logger[_0x3d9e('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50d74b);throw _0x50d74b;});}return _0x108018;})[_0x3d9e('0x2a')](respondWithResult(_0x5b312a,null))[_0x3d9e('0x49')](handleError(_0x5b312a,null));});_0x6305de['start']();}catch(_0x22eee5){_0x5b312a[_0x3d9e('0x1d')](0x1f4)[_0x3d9e('0x32')](_0x22eee5);}};exports[_0x3d9e('0x29')]=function(_0x1685ec,_0xed98dc,_0x38fd1f){return db[_0x3d9e('0x34')][_0x3d9e('0x4d')]({'where':{'id':_0x1685ec[_0x3d9e('0x4a')]['id']}})[_0x3d9e('0x2a')](handleEntityNotFound(_0xed98dc,null))[_0x3d9e('0x2a')](saveUpdates(_[_0x3d9e('0x44')](_0x1685ec[_0x3d9e('0x77')],[_0x3d9e('0x31'),'description']),null))[_0x3d9e('0x2a')](respondWithResult(_0xed98dc,null))[_0x3d9e('0x49')](handleError(_0xed98dc,null));};exports[_0x3d9e('0x7e')]=function(_0x24fed0,_0x26b4f5,_0x499fef){return db[_0x3d9e('0x34')][_0x3d9e('0x4d')]({'where':{'id':_0x24fed0[_0x3d9e('0x4a')]['id']}})[_0x3d9e('0x2a')](function(_0x35e31a){if(_0x35e31a){return _0x35e31a[_0x3d9e('0x2b')]();}})[_0x3d9e('0x2a')](function(_0x429bd8){var _0x31e90c=path[_0x3d9e('0x50')](config['root'],_0x3d9e('0x5f'),util[_0x3d9e('0x55')](_0x3d9e('0x56'),_0x429bd8[_0x3d9e('0x57')],_0x429bd8[_0x3d9e('0x7f')]));var _0x1b3b49=path[_0x3d9e('0x50')](config[_0x3d9e('0x51')],_0x3d9e('0x52'),util['format'](_0x3d9e('0x56'),_0x429bd8[_0x3d9e('0x57')],_0x429bd8[_0x3d9e('0x58')]));fs['unlinkSync'](_0x31e90c);fs['unlinkSync'](_0x1b3b49);return _0x429bd8;})['then'](function(_0x59b0ca){if(_0x59b0ca){return _0x26b4f5[_0x3d9e('0x1d')](0xcc)[_0x3d9e('0x1e')]();}})['then'](handleEntityNotFound(_0x26b4f5,null))[_0x3d9e('0x49')](handleError(_0x26b4f5,null));}; \ No newline at end of file +var _0x011d=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','chmodSync','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','start','description','delete','original_format','unlinkSync','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','update','destroy','then','Sounds','error','name','send','map','Sound','fieldName','type'];(function(_0x41f3ff,_0x2eefde){var _0xeede54=function(_0x259a33){while(--_0x259a33){_0x41f3ff['push'](_0x41f3ff['shift']());}};_0xeede54(++_0x2eefde);}(_0x011d,0x13e));var _0xd011=function(_0x313532,_0x33e75f){_0x313532=_0x313532-0x0;var _0x44bc16=_0x011d[_0x313532];return _0x44bc16;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd011('0x0'));var jsonpatch=require(_0xd011('0x1'));var rp=require('request-promise');var moment=require(_0xd011('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd011('0x3'));var util=require(_0xd011('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd011('0x5'));var ejs=require(_0xd011('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd011('0x7'));var squel=require('squel');var crypto=require(_0xd011('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xd011('0x9'));var toCsv=require(_0xd011('0x5'));var querystring=require(_0xd011('0xa'));var Papa=require(_0xd011('0xb'));var Redis=require(_0xd011('0xc'));var authService=require(_0xd011('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xd011('0xe'));var hardwareService=require(_0xd011('0xf'));var logger=require(_0xd011('0x10'))(_0xd011('0x11'));var utils=require(_0xd011('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd011('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bbd1e,_0x206b60){_0x206b60=_0x206b60||0xcc;return function(_0x1c0669){if(_0x1c0669){return _0x3bbd1e[_0xd011('0x14')](_0x206b60);}return _0x3bbd1e['status'](_0x206b60)[_0xd011('0x15')]();};}function respondWithResult(_0x4007ff,_0x2663f6){_0x2663f6=_0x2663f6||0xc8;return function(_0x2b22ee){if(_0x2b22ee){return _0x4007ff['status'](_0x2663f6)[_0xd011('0x16')](_0x2b22ee);}};}function respondWithFilteredResult(_0x1b7d64,_0x1e2d51){return function(_0x1f2d25){if(_0x1f2d25){var _0x55e1a6=typeof _0x1e2d51[_0xd011('0x17')]===_0xd011('0x18')&&typeof _0x1e2d51['limit']===_0xd011('0x18');var _0x3e4bd1=_0x1f2d25[_0xd011('0x19')];var _0x1220a1=_0x55e1a6?0x0:_0x1e2d51['offset'];var _0x15e2a8=_0x55e1a6?_0x1f2d25['count']:_0x1e2d51[_0xd011('0x17')]+_0x1e2d51[_0xd011('0x1a')];var _0x54cfee;if(_0x15e2a8>=_0x3e4bd1){_0x15e2a8=_0x3e4bd1;_0x54cfee=0xc8;}else{_0x54cfee=0xce;}_0x1b7d64[_0xd011('0x1b')](_0x54cfee);return _0x1b7d64[_0xd011('0x1c')](_0xd011('0x1d'),_0x1220a1+'-'+_0x15e2a8+'/'+_0x3e4bd1)[_0xd011('0x16')](_0x1f2d25);}return null;};}function patchUpdates(_0x399cab){return function(_0x3a7a39){try{jsonpatch[_0xd011('0x1e')](_0x3a7a39,_0x399cab,!![]);}catch(_0x40a21b){return BPromise['reject'](_0x40a21b);}return _0x3a7a39['save']();};}function saveUpdates(_0x36da36,_0x304552){return function(_0x5b11b7){if(_0x5b11b7){return _0x5b11b7[_0xd011('0x1f')](_0x36da36)['then'](function(_0x52f087){return _0x52f087;});}return null;};}function removeEntity(_0x36af8a,_0x2f7a4d){return function(_0x577efe){if(_0x577efe){return _0x577efe[_0xd011('0x20')]()[_0xd011('0x21')](function(){var _0x3344a6=_0x577efe['get']({'plain':!![]});var _0x2853ba=_0xd011('0x22');return db['UserProfileResource'][_0xd011('0x20')]({'where':{'type':_0x2853ba,'resourceId':_0x3344a6['id']}})[_0xd011('0x21')](function(){return _0x577efe;});})['then'](function(){_0x36af8a[_0xd011('0x1b')](0xcc)[_0xd011('0x15')]();});}};}function handleEntityNotFound(_0x1e735b,_0x306dd7){return function(_0x17ec1f){if(!_0x17ec1f){_0x1e735b[_0xd011('0x14')](0x194);}return _0x17ec1f;};}function handleError(_0x4edaab,_0x4adcda){_0x4adcda=_0x4adcda||0x1f4;return function(_0x124616){logger[_0xd011('0x23')](_0x124616['stack']);if(_0x124616[_0xd011('0x24')]){delete _0x124616[_0xd011('0x24')];}_0x4edaab[_0xd011('0x1b')](_0x4adcda)[_0xd011('0x25')](_0x124616);};}exports['index']=function(_0x49f8b8,_0x265abb){var _0x3812d1={},_0x164bc1={},_0x38b2a3={'count':0x0,'rows':[]};var _0x1446df=_[_0xd011('0x26')](db[_0xd011('0x27')]['rawAttributes'],function(_0x2b99be){return{'name':_0x2b99be[_0xd011('0x28')],'type':_0x2b99be[_0xd011('0x29')]['key']};});_0x164bc1[_0xd011('0x2a')]=_[_0xd011('0x26')](_0x1446df,_0xd011('0x24'));_0x164bc1[_0xd011('0x2b')]=_[_0xd011('0x2c')](_0x49f8b8[_0xd011('0x2b')]);_0x164bc1[_0xd011('0x2d')]=_[_0xd011('0x2e')](_0x164bc1[_0xd011('0x2a')],_0x164bc1[_0xd011('0x2b')]);_0x3812d1['attributes']=_[_0xd011('0x2e')](_0x164bc1[_0xd011('0x2a')],qs[_0xd011('0x2f')](_0x49f8b8['query']['fields']));_0x3812d1[_0xd011('0x30')]=_0x3812d1[_0xd011('0x30')][_0xd011('0x31')]?_0x3812d1[_0xd011('0x30')]:_0x164bc1[_0xd011('0x2a')];if(!_0x49f8b8[_0xd011('0x2b')][_0xd011('0x32')](_0xd011('0x33'))){_0x3812d1[_0xd011('0x1a')]=qs[_0xd011('0x1a')](_0x49f8b8['query'][_0xd011('0x1a')]);_0x3812d1[_0xd011('0x17')]=qs[_0xd011('0x17')](_0x49f8b8[_0xd011('0x2b')][_0xd011('0x17')]);}_0x3812d1[_0xd011('0x34')]=qs['sort'](_0x49f8b8[_0xd011('0x2b')]['sort']);_0x3812d1[_0xd011('0x35')]=qs[_0xd011('0x2d')](_[_0xd011('0x36')](_0x49f8b8[_0xd011('0x2b')],_0x164bc1[_0xd011('0x2d')]),_0x1446df);if(_0x49f8b8['query'][_0xd011('0x37')]){_0x3812d1[_0xd011('0x35')]=_[_0xd011('0x38')](_0x3812d1[_0xd011('0x35')],{'$or':_[_0xd011('0x26')](_0x1446df,function(_0x1de71f){if(_0x1de71f['type']!=='VIRTUAL'){var _0x5e5be9={};_0x5e5be9[_0x1de71f[_0xd011('0x24')]]={'$like':'%'+_0x49f8b8['query']['filter']+'%'};return _0x5e5be9;}})});}_0x3812d1=_[_0xd011('0x38')]({},_0x3812d1,_0x49f8b8[_0xd011('0x39')]);var _0x2c2d3a={'where':_0x3812d1[_0xd011('0x35')]};return db[_0xd011('0x27')]['count'](_0x2c2d3a)[_0xd011('0x21')](function(_0x1775ea){_0x38b2a3[_0xd011('0x19')]=_0x1775ea;if(_0x49f8b8[_0xd011('0x2b')]['includeAll']){_0x3812d1[_0xd011('0x3a')]=[{'all':!![]}];}return db[_0xd011('0x27')][_0xd011('0x3b')](_0x3812d1);})[_0xd011('0x21')](function(_0x349390){_0x38b2a3[_0xd011('0x3c')]=_0x349390;return _0x38b2a3;})[_0xd011('0x21')](respondWithFilteredResult(_0x265abb,_0x3812d1))[_0xd011('0x3d')](handleError(_0x265abb,null));};exports[_0xd011('0x3e')]=function(_0x1d83b0,_0x186bba){var _0x2f4302={'raw':!![],'where':{'id':_0x1d83b0[_0xd011('0x3f')]['id']}},_0x1a55af={};_0x1a55af[_0xd011('0x2a')]=_[_0xd011('0x2c')](db[_0xd011('0x27')][_0xd011('0x40')]);_0x1a55af[_0xd011('0x2b')]=_[_0xd011('0x2c')](_0x1d83b0[_0xd011('0x2b')]);_0x1a55af[_0xd011('0x2d')]=_[_0xd011('0x2e')](_0x1a55af['model'],_0x1a55af[_0xd011('0x2b')]);_0x2f4302[_0xd011('0x30')]=_[_0xd011('0x2e')](_0x1a55af[_0xd011('0x2a')],qs[_0xd011('0x2f')](_0x1d83b0[_0xd011('0x2b')][_0xd011('0x2f')]));_0x2f4302['attributes']=_0x2f4302[_0xd011('0x30')]['length']?_0x2f4302['attributes']:_0x1a55af[_0xd011('0x2a')];if(_0x1d83b0[_0xd011('0x2b')][_0xd011('0x41')]){_0x2f4302[_0xd011('0x3a')]=[{'all':!![]}];}_0x2f4302=_['merge']({},_0x2f4302,_0x1d83b0['options']);return db[_0xd011('0x27')][_0xd011('0x42')](_0x2f4302)['then'](handleEntityNotFound(_0x186bba,null))[_0xd011('0x21')](respondWithResult(_0x186bba,null))['catch'](handleError(_0x186bba,null));};exports[_0xd011('0x43')]=function(_0x37e4af,_0x56f165,_0x2f044e){return db[_0xd011('0x27')][_0xd011('0x42')]({'where':{'id':_0x37e4af[_0xd011('0x3f')]['id']},'attributes':['name',_0xd011('0x44'),_0xd011('0x45')],'raw':!![]})[_0xd011('0x21')](handleEntityNotFound(_0x56f165,null))[_0xd011('0x21')](function(_0x4416c3){if(_0x4416c3){if(!fs[_0xd011('0x46')](path['join'](config[_0xd011('0x47')],_0xd011('0x48'),_0x4416c3['save_name']+'.'+_0x4416c3['converted_format']))){throw new db[(_0xd011('0x49'))][(_0xd011('0x4a'))](_0xd011('0x4b'));}return _0x56f165[_0xd011('0x43')](path[_0xd011('0x4c')](config[_0xd011('0x47')],_0xd011('0x48'),util[_0xd011('0x4d')]('%s.%s',_0x4416c3[_0xd011('0x44')],_0x4416c3['converted_format'])),util[_0xd011('0x4d')](_0xd011('0x4e'),_0x4416c3['name'],_0x4416c3[_0xd011('0x45')]));}return null;})[_0xd011('0x3d')](handleError(_0x56f165,null));};exports[_0xd011('0x4f')]=function(_0xedbbe6,_0x2cea3f,_0x15f6a4){var _0x3cee9a={'name':path[_0xd011('0x50')](_0xedbbe6[_0xd011('0x51')][_0xd011('0x52')],path[_0xd011('0x53')](_0xedbbe6[_0xd011('0x51')]['originalname'])),'save_name':path['basename'](_0xedbbe6[_0xd011('0x51')][_0xd011('0x54')],path[_0xd011('0x53')](_0xedbbe6[_0xd011('0x51')][_0xd011('0x54')])),'original_format':path['extname'](_0xedbbe6[_0xd011('0x51')][_0xd011('0x52')])[_0xd011('0x55')](0x1),'converted_format':_0xd011('0x56')};var _0x33e9c6=path['join'](config[_0xd011('0x47')],_0xd011('0x57'),_0xedbbe6[_0xd011('0x51')][_0xd011('0x54')]);var _0x509285=path[_0xd011('0x4c')](config[_0xd011('0x47')],_0xd011('0x48'),util[_0xd011('0x4d')](_0xd011('0x4e'),path[_0xd011('0x50')](_0xedbbe6['file'][_0xd011('0x54')],path[_0xd011('0x53')](_0xedbbe6[_0xd011('0x51')]['filename'])),_0x3cee9a[_0xd011('0x45')]));logger['info'](_0xd011('0x58'),_0x33e9c6);logger['info'](_0xd011('0x59'),_0x509285);try{fs['chmodSync'](_0x33e9c6,parseInt(_0xd011('0x5a'),0x8));var _0x3ef939=sox[_0xd011('0x5b')](_0x33e9c6,_0x509285,{'sampleRate':0x1f40,'format':_0xd011('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3ef939['on']('error',function(_0x4c9f4c){fs['unlinkSync'](_0x33e9c6);_0x2cea3f[_0xd011('0x1b')](0x1f4)[_0xd011('0x25')](_0x4c9f4c);});_0x3ef939['on'](_0xd011('0x5c'),function(_0x4cebdc){_0x3cee9a[_0xd011('0x5d')]=isNaN(_0x4cebdc[_0xd011('0x5e')])?null:_0x4cebdc[_0xd011('0x5e')]*0x3e8;_0x3cee9a[_0xd011('0x5f')]=isNaN(_0x4cebdc[_0xd011('0x60')])?null:_0x4cebdc[_0xd011('0x60')];_0x3cee9a[_0xd011('0x61')]=isNaN(_0x4cebdc[_0xd011('0x62')])?null:_0x4cebdc[_0xd011('0x62')];_0x3cee9a[_0xd011('0x63')]=isNaN(_0x4cebdc['bitRate'])?null:_0x4cebdc[_0xd011('0x64')];_0x3cee9a['original_sampleRate']=isNaN(_0x4cebdc[_0xd011('0x65')])?null:_0x4cebdc[_0xd011('0x65')];});_0x3ef939['on'](_0xd011('0x66'),function(_0x307935){_0x3cee9a[_0xd011('0x67')]=isNaN(_0x307935[_0xd011('0x5e')])?null:_0x307935[_0xd011('0x5e')]*0x3e8;_0x3cee9a[_0xd011('0x68')]=isNaN(_0x307935[_0xd011('0x60')])?null:_0x307935['sampleCount'];_0x3cee9a[_0xd011('0x69')]=isNaN(_0x307935[_0xd011('0x62')])?null:_0x307935[_0xd011('0x62')];_0x3cee9a[_0xd011('0x6a')]=isNaN(_0x307935['bitRate'])?null:_0x307935[_0xd011('0x64')];_0x3cee9a['converted_sampleRate']=isNaN(_0x307935[_0xd011('0x65')])?null:_0x307935[_0xd011('0x65')];});_0x3ef939['on'](_0xd011('0x15'),function(){fs[_0xd011('0x6b')](_0x509285,parseInt(_0xd011('0x5a'),0x8));return db[_0xd011('0x27')]['create'](_0x3cee9a)['then'](function(_0x27cfb9){var _0x1f696a={'role':_0xedbbe6[_0xd011('0x6c')]['role'],'userProfileId':_0xedbbe6[_0xd011('0x6c')]['userProfileId']};if(!_0x1f696a)throw new Error(_0xd011('0x6d'));if(_0x1f696a[_0xd011('0x6e')]==='user'){var _0x590907=_0x27cfb9['get']({'plain':!![]});return db[_0xd011('0x6f')][_0xd011('0x42')]({'where':{'name':'Sounds','userProfileId':_0x1f696a[_0xd011('0x70')]},'raw':!![]})['then'](function(_0x5bdae8){if(_0x5bdae8&&_0x5bdae8[_0xd011('0x71')]===0x0){return db[_0xd011('0x72')][_0xd011('0x4f')]({'name':_0x590907['name'],'resourceId':_0x590907['id'],'type':_0x5bdae8[_0xd011('0x24')],'sectionId':_0x5bdae8['id']},{})[_0xd011('0x21')](function(){return _0x27cfb9;});}else{return _0x27cfb9;}})[_0xd011('0x3d')](function(_0x36de31){logger[_0xd011('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36de31);throw _0x36de31;});}return _0x27cfb9;})[_0xd011('0x21')](respondWithResult(_0x2cea3f,null))[_0xd011('0x3d')](handleError(_0x2cea3f,null));});_0x3ef939[_0xd011('0x73')]();}catch(_0x266ad7){_0x2cea3f[_0xd011('0x1b')](0x1f4)[_0xd011('0x25')](_0x266ad7);}};exports[_0xd011('0x1f')]=function(_0xd94faf,_0x587fa6,_0x626d0a){return db[_0xd011('0x27')]['find']({'where':{'id':_0xd94faf[_0xd011('0x3f')]['id']}})[_0xd011('0x21')](handleEntityNotFound(_0x587fa6,null))[_0xd011('0x21')](saveUpdates(_['pick'](_0xd94faf[_0xd011('0x6c')],[_0xd011('0x24'),_0xd011('0x74')]),null))[_0xd011('0x21')](respondWithResult(_0x587fa6,null))[_0xd011('0x3d')](handleError(_0x587fa6,null));};exports[_0xd011('0x75')]=function(_0x1a05be,_0x5963c4,_0x2d92a0){return db['Sound'][_0xd011('0x42')]({'where':{'id':_0x1a05be['params']['id']}})[_0xd011('0x21')](function(_0x2f5d83){if(_0x2f5d83){return _0x2f5d83['destroy']();}})['then'](function(_0x290f47){var _0x587ba4=path[_0xd011('0x4c')](config[_0xd011('0x47')],_0xd011('0x57'),util[_0xd011('0x4d')](_0xd011('0x4e'),_0x290f47['save_name'],_0x290f47[_0xd011('0x76')]));var _0x175661=path[_0xd011('0x4c')](config[_0xd011('0x47')],_0xd011('0x48'),util[_0xd011('0x4d')](_0xd011('0x4e'),_0x290f47['save_name'],_0x290f47[_0xd011('0x45')]));fs[_0xd011('0x77')](_0x587ba4);fs['unlinkSync'](_0x175661);return _0x290f47;})[_0xd011('0x21')](function(_0x3c1f24){if(_0x3c1f24){return _0x5963c4[_0xd011('0x1b')](0xcc)['end']();}})[_0xd011('0x21')](handleEntityNotFound(_0x5963c4,null))[_0xd011('0x3d')](handleError(_0x5963c4,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 651c669..f2857ec 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 _0x65fe=['define','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x30b1e2,_0x88644d){var _0x5e2c30=function(_0x383262){while(--_0x383262){_0x30b1e2['push'](_0x30b1e2['shift']());}};_0x5e2c30(++_0x88644d);}(_0x65fe,0xb6));var _0xe65f=function(_0x308a9a,_0xd452bb){_0x308a9a=_0x308a9a-0x0;var _0xf317d1=_0x65fe[_0x308a9a];return _0xf317d1;};'use strict';var _=require('lodash');var util=require(_0xe65f('0x0'));var logger=require(_0xe65f('0x1'))(_0xe65f('0x2'));var moment=require(_0xe65f('0x3'));var BPromise=require(_0xe65f('0x4'));var rp=require(_0xe65f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0xe65f('0x6')]=function(_0x348db1,_0x494ffb){return _0x348db1[_0xe65f('0x7')]('Sound',attributes,{'tableName':_0xe65f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2104=['moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api'];(function(_0x97a80f,_0x3d70d7){var _0x534071=function(_0xd8966e){while(--_0xd8966e){_0x97a80f['push'](_0x97a80f['shift']());}};_0x534071(++_0x3d70d7);}(_0x2104,0x1eb));var _0x4210=function(_0x119d25,_0x588c8){_0x119d25=_0x119d25-0x0;var _0x39cf30=_0x2104[_0x119d25];return _0x39cf30;};'use strict';var _=require('lodash');var util=require(_0x4210('0x0'));var logger=require(_0x4210('0x1'))(_0x4210('0x2'));var moment=require(_0x4210('0x3'));var BPromise=require(_0x4210('0x4'));var rp=require(_0x4210('0x5'));var fs=require('fs');var path=require(_0x4210('0x6'));var rimraf=require(_0x4210('0x7'));var config=require('../../config/environment');var attributes=require(_0x4210('0x8'));module[_0x4210('0x9')]=function(_0x7aa93f,_0x4340f5){return _0x7aa93f[_0x4210('0xa')](_0x4210('0xb'),attributes,{'tableName':_0x4210('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index bc9dcb3..6ce8a3c 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 _0x3aa2=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','options','raw','where','map','include','model','attributes','util','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x3aa2,0xe1));var _0x23aa=function(_0x93c171,_0x2b3a4c){_0x93c171=_0x93c171-0x0;var _0x4970d9=_0x3aa2[_0x93c171];return _0x4970d9;};'use strict';var _=require('lodash');var util=require(_0x23aa('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23aa('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x23aa('0x2'))(_0x23aa('0x3'));var config=require('../../config/environment');var jayson=require(_0x23aa('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53d740,_0x19358e,_0x565088){return new BPromise(function(_0x4673ca,_0x3373f0){return client[_0x23aa('0x5')](_0x53d740,_0x565088)[_0x23aa('0x6')](function(_0x1ca422){logger[_0x23aa('0x7')](_0x23aa('0x8'),_0x19358e,_0x23aa('0x9'));logger[_0x23aa('0xa')](_0x23aa('0xb'),_0x19358e,_0x23aa('0x9'),JSON[_0x23aa('0xc')](_0x1ca422));if(_0x1ca422[_0x23aa('0xd')]){if(_0x1ca422['error'][_0x23aa('0xe')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x19358e,_0x1ca422['error']['message']);return _0x3373f0(_0x1ca422[_0x23aa('0xd')][_0x23aa('0xf')]);}logger[_0x23aa('0xd')](_0x23aa('0x8'),_0x19358e,_0x1ca422[_0x23aa('0xd')][_0x23aa('0xf')]);return _0x4673ca(_0x1ca422[_0x23aa('0xd')][_0x23aa('0xf')]);}else{logger[_0x23aa('0x7')](_0x23aa('0x8'),_0x19358e,_0x23aa('0x9'));_0x4673ca(_0x1ca422[_0x23aa('0x10')]['message']);}})[_0x23aa('0x11')](function(_0x39ab05){logger['error'](_0x23aa('0x8'),_0x19358e,_0x39ab05);_0x3373f0(_0x39ab05);});});}exports[_0x23aa('0x12')]=function(_0x3e2053){var _0x39e97a=this;return new Promise(function(_0x1580a7,_0x3f53b0){return db['Sound']['find']({'raw':_0x3e2053['options']?_0x3e2053[_0x23aa('0x13')][_0x23aa('0x14')]===undefined?!![]:![]:!![],'where':_0x3e2053[_0x23aa('0x13')]?_0x3e2053[_0x23aa('0x13')][_0x23aa('0x15')]||null:null,'attributes':_0x3e2053[_0x23aa('0x13')]?_0x3e2053[_0x23aa('0x13')]['attributes']||null:null,'include':_0x3e2053[_0x23aa('0x13')]?_0x3e2053[_0x23aa('0x13')]['include']?_[_0x23aa('0x16')](_0x3e2053[_0x23aa('0x13')][_0x23aa('0x17')],function(_0x3224b5){return{'model':db[_0x3224b5[_0x23aa('0x18')]],'as':_0x3224b5['as'],'attributes':_0x3224b5[_0x23aa('0x19')],'include':_0x3224b5[_0x23aa('0x17')]?_[_0x23aa('0x16')](_0x3224b5[_0x23aa('0x17')],function(_0x3a6a34){return{'model':db[_0x3a6a34[_0x23aa('0x18')]],'as':_0x3a6a34['as'],'attributes':_0x3a6a34[_0x23aa('0x19')],'include':_0x3a6a34[_0x23aa('0x17')]?_[_0x23aa('0x16')](_0x3a6a34['include'],function(_0x5d85ce){return{'model':db[_0x5d85ce[_0x23aa('0x18')]],'as':_0x5d85ce['as'],'attributes':_0x5d85ce[_0x23aa('0x19')]};}):[]};}):[]};}):[]:[]})[_0x23aa('0x6')](function(_0x1875ca){logger[_0x23aa('0x7')](_0x23aa('0x12'),_0x3e2053);logger[_0x23aa('0xa')](_0x23aa('0x12'),_0x3e2053,JSON[_0x23aa('0xc')](_0x1875ca));_0x1580a7(_0x1875ca);})[_0x23aa('0x11')](function(_0x4d9b7f){logger[_0x23aa('0xd')](_0x23aa('0x12'),_0x4d9b7f[_0x23aa('0xf')],_0x3e2053);_0x3f53b0(_0x39e97a['error'](0x1f4,_0x4d9b7f['message']));});});}; \ No newline at end of file +var _0x200b=['model','then','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSound','find','options','where','attributes','include','map'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x200b,0x197));var _0xb200=function(_0x344bcc,_0x2c2d51){_0x344bcc=_0x344bcc-0x0;var _0x289790=_0x200b[_0x344bcc];return _0x289790;};'use strict';var _=require(_0xb200('0x0'));var util=require(_0xb200('0x1'));var moment=require(_0xb200('0x2'));var BPromise=require(_0xb200('0x3'));var rs=require(_0xb200('0x4'));var fs=require('fs');var Redis=require(_0xb200('0x5'));var db=require(_0xb200('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb200('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb200('0x8'));var client=jayson[_0xb200('0x9')][_0xb200('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x178d4d,_0x5e7067,_0x2bd341){return new BPromise(function(_0x3c77bb,_0x562204){return client[_0xb200('0xb')](_0x178d4d,_0x2bd341)['then'](function(_0x52ac68){logger[_0xb200('0xc')](_0xb200('0xd'),_0x5e7067,_0xb200('0xe'));logger['debug'](_0xb200('0xf'),_0x5e7067,'request\x20sent',JSON['stringify'](_0x52ac68));if(_0x52ac68[_0xb200('0x10')]){if(_0x52ac68[_0xb200('0x10')]['code']===0x1f4){logger['error'](_0xb200('0xd'),_0x5e7067,_0x52ac68['error']['message']);return _0x562204(_0x52ac68[_0xb200('0x10')][_0xb200('0x11')]);}logger['error']('Sound,\x20%s,\x20%s',_0x5e7067,_0x52ac68[_0xb200('0x10')][_0xb200('0x11')]);return _0x3c77bb(_0x52ac68[_0xb200('0x10')][_0xb200('0x11')]);}else{logger[_0xb200('0xc')](_0xb200('0xd'),_0x5e7067,_0xb200('0xe'));_0x3c77bb(_0x52ac68[_0xb200('0x12')][_0xb200('0x11')]);}})[_0xb200('0x13')](function(_0x150f90){logger[_0xb200('0x10')](_0xb200('0xd'),_0x5e7067,_0x150f90);_0x562204(_0x150f90);});});}exports[_0xb200('0x14')]=function(_0x582df6){var _0x22dccd=this;return new Promise(function(_0x52dfbc,_0x3ea404){return db['Sound'][_0xb200('0x15')]({'raw':_0x582df6[_0xb200('0x16')]?_0x582df6[_0xb200('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x582df6[_0xb200('0x16')]?_0x582df6[_0xb200('0x16')][_0xb200('0x17')]||null:null,'attributes':_0x582df6['options']?_0x582df6[_0xb200('0x16')][_0xb200('0x18')]||null:null,'include':_0x582df6[_0xb200('0x16')]?_0x582df6[_0xb200('0x16')][_0xb200('0x19')]?_[_0xb200('0x1a')](_0x582df6[_0xb200('0x16')]['include'],function(_0x4035f1){return{'model':db[_0x4035f1[_0xb200('0x1b')]],'as':_0x4035f1['as'],'attributes':_0x4035f1[_0xb200('0x18')],'include':_0x4035f1['include']?_[_0xb200('0x1a')](_0x4035f1[_0xb200('0x19')],function(_0x3978c0){return{'model':db[_0x3978c0[_0xb200('0x1b')]],'as':_0x3978c0['as'],'attributes':_0x3978c0['attributes'],'include':_0x3978c0['include']?_['map'](_0x3978c0[_0xb200('0x19')],function(_0x3d81bc){return{'model':db[_0x3d81bc[_0xb200('0x1b')]],'as':_0x3d81bc['as'],'attributes':_0x3d81bc[_0xb200('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb200('0x1c')](function(_0x3c83a4){logger[_0xb200('0xc')](_0xb200('0x14'),_0x582df6);logger[_0xb200('0x1d')](_0xb200('0x14'),_0x582df6,JSON[_0xb200('0x1e')](_0x3c83a4));_0x52dfbc(_0x3c83a4);})[_0xb200('0x13')](function(_0x43a895){logger[_0xb200('0x10')](_0xb200('0x14'),_0x43a895['message'],_0x582df6);_0x3ea404(_0x22dccd[_0xb200('0x10')](0x1f4,_0x43a895[_0xb200('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 6d1bcd3..899bf36 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x9d312e,_0x17b4d7){var _0x25dbf5=function(_0x4fcce7){while(--_0x4fcce7){_0x9d312e['push'](_0x9d312e['shift']());}};_0x25dbf5(++_0x17b4d7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'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('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x260636,_0x27a833){var _0x2ed63f=function(_0x547e87){while(--_0x547e87){_0x260636['push'](_0x260636['shift']());}};_0x2ed63f(++_0x27a833);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xb7e7[_0x50007c];return _0x5c1ec7;};'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('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9ea06ea..ad293ec 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 _0x807c=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x807c,0x185));var _0xc807=function(_0xb2bdab,_0x4faf67){_0xb2bdab=_0xb2bdab-0x0;var _0x25daba=_0x807c[_0xb2bdab];return _0x25daba;};'use strict';var Sequelize=require(_0xc807('0x0'));module[_0xc807('0x1')]={'uniqueid':{'type':Sequelize[_0xc807('0x2')]},'body':{'type':Sequelize[_0xc807('0x3')](_0xc807('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xc807('0x5')]('in',_0xc807('0x6')),'defaultValue':_0xc807('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xc807('0x2')]},'providerResponse':{'type':Sequelize[_0xc807('0x3')]}}; \ No newline at end of file +var _0x2e06=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x5b959e,_0x28debf){var _0x11df5a=function(_0x1bcd63){while(--_0x1bcd63){_0x5b959e['push'](_0x5b959e['shift']());}};_0x11df5a(++_0x28debf);}(_0x2e06,0xcb));var _0x62e0=function(_0x458043,_0x23b1ea){_0x458043=_0x458043-0x0;var _0x1a1635=_0x2e06[_0x458043];return _0x1a1635;};'use strict';var Sequelize=require(_0x62e0('0x0'));module[_0x62e0('0x1')]={'uniqueid':{'type':Sequelize[_0x62e0('0x2')]},'body':{'type':Sequelize[_0x62e0('0x3')](_0x62e0('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x62e0('0x5')]('in','out'),'defaultValue':_0x62e0('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x62e0('0x2')]},'providerResponse':{'type':Sequelize[_0x62e0('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 50909f6..55f11c2 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 _0x8212=['fields','hasOwnProperty','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','SquareMessage','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes'];(function(_0x28d6b9,_0xbe9964){var _0x1e2bee=function(_0xc75f76){while(--_0xc75f76){_0x28d6b9['push'](_0x28d6b9['shift']());}};_0x1e2bee(++_0xbe9964);}(_0x8212,0xb3));var _0x2821=function(_0x19454e,_0x436336){_0x19454e=_0x19454e-0x0;var _0x11e26e=_0x8212[_0x19454e];return _0x11e26e;};'use strict';var emlformat=require(_0x2821('0x0'));var rimraf=require(_0x2821('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2821('0x2'));var rp=require(_0x2821('0x3'));var moment=require(_0x2821('0x4'));var BPromise=require(_0x2821('0x5'));var Mustache=require(_0x2821('0x6'));var util=require(_0x2821('0x7'));var path=require(_0x2821('0x8'));var sox=require(_0x2821('0x9'));var csv=require('to-csv');var ejs=require(_0x2821('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2821('0xb'));var squel=require(_0x2821('0xc'));var crypto=require('crypto');var jsforce=require(_0x2821('0xd'));var deskjs=require(_0x2821('0xe'));var toCsv=require(_0x2821('0xf'));var querystring=require(_0x2821('0x10'));var Papa=require(_0x2821('0x11'));var Redis=require(_0x2821('0x12'));var authService=require(_0x2821('0x13'));var qs=require(_0x2821('0x14'));var as=require(_0x2821('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2821('0x16'))(_0x2821('0x17'));var utils=require(_0x2821('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c81c1,_0x11d227){_0x11d227=_0x11d227||0xcc;return function(_0x18a2bb){if(_0x18a2bb){return _0x4c81c1[_0x2821('0x19')](_0x11d227);}return _0x4c81c1[_0x2821('0x1a')](_0x11d227)[_0x2821('0x1b')]();};}function respondWithResult(_0x2fbc96,_0x5d5ee5){_0x5d5ee5=_0x5d5ee5||0xc8;return function(_0x3ba091){if(_0x3ba091){return _0x2fbc96['status'](_0x5d5ee5)['json'](_0x3ba091);}};}function respondWithFilteredResult(_0x4142f1,_0xe30acf){return function(_0x243c46){if(_0x243c46){var _0x472238=typeof _0xe30acf['offset']===_0x2821('0x1c')&&typeof _0xe30acf['limit']===_0x2821('0x1c');var _0x2673d2=_0x243c46[_0x2821('0x1d')];var _0x3f1057=_0x472238?0x0:_0xe30acf[_0x2821('0x1e')];var _0x500357=_0x472238?_0x243c46[_0x2821('0x1d')]:_0xe30acf[_0x2821('0x1e')]+_0xe30acf['limit'];var _0x22990a;if(_0x500357>=_0x2673d2){_0x500357=_0x2673d2;_0x22990a=0xc8;}else{_0x22990a=0xce;}_0x4142f1['status'](_0x22990a);return _0x4142f1[_0x2821('0x1f')](_0x2821('0x20'),_0x3f1057+'-'+_0x500357+'/'+_0x2673d2)[_0x2821('0x21')](_0x243c46);}return null;};}function patchUpdates(_0x8ba96e){return function(_0x38d898){try{jsonpatch[_0x2821('0x22')](_0x38d898,_0x8ba96e,!![]);}catch(_0x1c0907){return BPromise[_0x2821('0x23')](_0x1c0907);}return _0x38d898[_0x2821('0x24')]();};}function saveUpdates(_0x1f4e4f,_0x275810){return function(_0x597d8b){if(_0x597d8b){return _0x597d8b['update'](_0x1f4e4f)[_0x2821('0x25')](function(_0x243ff2){return _0x243ff2;});}return null;};}function removeEntity(_0x2838d8,_0x279a46){return function(_0x37c669){if(_0x37c669){return _0x37c669[_0x2821('0x26')]()[_0x2821('0x25')](function(){_0x2838d8[_0x2821('0x1a')](0xcc)[_0x2821('0x1b')]();});}};}function handleEntityNotFound(_0x27cef1,_0x7a49da){return function(_0x1d2c8f){if(!_0x1d2c8f){_0x27cef1[_0x2821('0x19')](0x194);}return _0x1d2c8f;};}function handleError(_0x3ddbe7,_0x14fbd4){_0x14fbd4=_0x14fbd4||0x1f4;return function(_0x2ab3ab){logger[_0x2821('0x27')](_0x2ab3ab[_0x2821('0x28')]);if(_0x2ab3ab[_0x2821('0x29')]){delete _0x2ab3ab[_0x2821('0x29')];}_0x3ddbe7['status'](_0x14fbd4)[_0x2821('0x2a')](_0x2ab3ab);};}exports['index']=function(_0x109262,_0x4402ea){var _0x449e46={},_0x7dfdc3={},_0x5eba60={'count':0x0,'rows':[]};var _0x3ea1de=_[_0x2821('0x2b')](db['SquareMessage'][_0x2821('0x2c')],function(_0x2e4395){return{'name':_0x2e4395[_0x2821('0x2d')],'type':_0x2e4395['type'][_0x2821('0x2e')]};});_0x7dfdc3[_0x2821('0x2f')]=_[_0x2821('0x2b')](_0x3ea1de,_0x2821('0x29'));_0x7dfdc3[_0x2821('0x30')]=_[_0x2821('0x31')](_0x109262[_0x2821('0x30')]);_0x7dfdc3['filters']=_[_0x2821('0x32')](_0x7dfdc3[_0x2821('0x2f')],_0x7dfdc3[_0x2821('0x30')]);_0x449e46[_0x2821('0x33')]=_[_0x2821('0x32')](_0x7dfdc3[_0x2821('0x2f')],qs[_0x2821('0x34')](_0x109262[_0x2821('0x30')][_0x2821('0x34')]));_0x449e46[_0x2821('0x33')]=_0x449e46[_0x2821('0x33')]['length']?_0x449e46[_0x2821('0x33')]:_0x7dfdc3[_0x2821('0x2f')];if(!_0x109262[_0x2821('0x30')][_0x2821('0x35')]('nolimit')){_0x449e46[_0x2821('0x36')]=qs[_0x2821('0x36')](_0x109262[_0x2821('0x30')][_0x2821('0x36')]);_0x449e46[_0x2821('0x1e')]=qs[_0x2821('0x1e')](_0x109262[_0x2821('0x30')][_0x2821('0x1e')]);}_0x449e46[_0x2821('0x37')]=qs[_0x2821('0x38')](_0x109262['query'][_0x2821('0x38')]);_0x449e46[_0x2821('0x39')]=qs[_0x2821('0x3a')](_[_0x2821('0x3b')](_0x109262[_0x2821('0x30')],_0x7dfdc3['filters']),_0x3ea1de);if(_0x109262[_0x2821('0x30')]['filter']){_0x449e46['where']=_[_0x2821('0x3c')](_0x449e46[_0x2821('0x39')],{'$or':_[_0x2821('0x2b')](_0x3ea1de,function(_0x276edc){if(_0x276edc[_0x2821('0x3d')]!==_0x2821('0x3e')){var _0x210c60={};_0x210c60[_0x276edc['name']]={'$like':'%'+_0x109262['query'][_0x2821('0x3f')]+'%'};return _0x210c60;}})});}_0x449e46=_[_0x2821('0x3c')]({},_0x449e46,_0x109262[_0x2821('0x40')]);var _0x2737a7={'where':_0x449e46[_0x2821('0x39')]};return db['SquareMessage']['count'](_0x2737a7)[_0x2821('0x25')](function(_0x26d389){_0x5eba60[_0x2821('0x1d')]=_0x26d389;if(_0x109262[_0x2821('0x30')][_0x2821('0x41')]){_0x449e46[_0x2821('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x2821('0x43')](_0x449e46);})[_0x2821('0x25')](function(_0x4fe0cd){_0x5eba60[_0x2821('0x44')]=_0x4fe0cd;return _0x5eba60;})[_0x2821('0x25')](respondWithFilteredResult(_0x4402ea,_0x449e46))[_0x2821('0x45')](handleError(_0x4402ea,null));};exports[_0x2821('0x46')]=function(_0x20c8db,_0x4ffc43){var _0x2b2796={'raw':!![],'where':{'id':_0x20c8db[_0x2821('0x47')]['id']}},_0x8d988a={};_0x8d988a[_0x2821('0x2f')]=_['keys'](db['SquareMessage'][_0x2821('0x2c')]);_0x8d988a[_0x2821('0x30')]=_[_0x2821('0x31')](_0x20c8db[_0x2821('0x30')]);_0x8d988a[_0x2821('0x3a')]=_[_0x2821('0x32')](_0x8d988a[_0x2821('0x2f')],_0x8d988a['query']);_0x2b2796['attributes']=_[_0x2821('0x32')](_0x8d988a['model'],qs[_0x2821('0x34')](_0x20c8db[_0x2821('0x30')][_0x2821('0x34')]));_0x2b2796[_0x2821('0x33')]=_0x2b2796[_0x2821('0x33')][_0x2821('0x48')]?_0x2b2796[_0x2821('0x33')]:_0x8d988a['model'];if(_0x20c8db[_0x2821('0x30')][_0x2821('0x41')]){_0x2b2796[_0x2821('0x42')]=[{'all':!![]}];}_0x2b2796=_[_0x2821('0x3c')]({},_0x2b2796,_0x20c8db[_0x2821('0x40')]);return db[_0x2821('0x49')][_0x2821('0x4a')](_0x2b2796)[_0x2821('0x25')](handleEntityNotFound(_0x4ffc43,null))['then'](respondWithResult(_0x4ffc43,null))[_0x2821('0x45')](handleError(_0x4ffc43,null));};exports[_0x2821('0x4b')]=function(_0x175ef3,_0x3f370d){return db['SquareMessage'][_0x2821('0x4b')](_0x175ef3[_0x2821('0x4c')],{})[_0x2821('0x25')](respondWithResult(_0x3f370d,0xc9))['catch'](handleError(_0x3f370d,null));};exports['update']=function(_0x5162b3,_0x9721){if(_0x5162b3[_0x2821('0x4c')]['id']){delete _0x5162b3[_0x2821('0x4c')]['id'];}return db['SquareMessage'][_0x2821('0x4a')]({'where':{'id':_0x5162b3[_0x2821('0x47')]['id']}})[_0x2821('0x25')](handleEntityNotFound(_0x9721,null))[_0x2821('0x25')](saveUpdates(_0x5162b3[_0x2821('0x4c')],null))[_0x2821('0x25')](respondWithResult(_0x9721,null))['catch'](handleError(_0x9721,null));};exports['destroy']=function(_0x284b28,_0x39fcc9){return db['SquareMessage'][_0x2821('0x4a')]({'where':{'id':_0x284b28[_0x2821('0x47')]['id']}})[_0x2821('0x25')](handleEntityNotFound(_0x39fcc9,null))[_0x2821('0x25')](removeEntity(_0x39fcc9,null))[_0x2821('0x45')](handleError(_0x39fcc9,null));}; \ No newline at end of file +var _0xdb89=['path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x3f7ba5,_0x402666){var _0xa7d981=function(_0xc156f1){while(--_0xc156f1){_0x3f7ba5['push'](_0x3f7ba5['shift']());}};_0xa7d981(++_0x402666);}(_0xdb89,0xda));var _0x9db8=function(_0x55e25d,_0x357aa7){_0x55e25d=_0x55e25d-0x0;var _0x1f59c1=_0xdb89[_0x55e25d];return _0x1f59c1;};'use strict';var emlformat=require(_0x9db8('0x0'));var rimraf=require(_0x9db8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9db8('0x2'));var moment=require(_0x9db8('0x3'));var BPromise=require(_0x9db8('0x4'));var Mustache=require(_0x9db8('0x5'));var util=require(_0x9db8('0x6'));var path=require(_0x9db8('0x7'));var sox=require(_0x9db8('0x8'));var csv=require(_0x9db8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9db8('0xa'));var _=require(_0x9db8('0xb'));var squel=require(_0x9db8('0xc'));var crypto=require(_0x9db8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9db8('0xe'));var toCsv=require(_0x9db8('0x9'));var querystring=require(_0x9db8('0xf'));var Papa=require(_0x9db8('0x10'));var Redis=require('ioredis');var authService=require(_0x9db8('0x11'));var qs=require(_0x9db8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9db8('0x13'))(_0x9db8('0x14'));var utils=require(_0x9db8('0x15'));var config=require(_0x9db8('0x16'));var licenseUtil=require(_0x9db8('0x17'));var db=require(_0x9db8('0x18'))['db'];function respondWithStatusCode(_0x59142a,_0x1d98a8){_0x1d98a8=_0x1d98a8||0xcc;return function(_0x1409cb){if(_0x1409cb){return _0x59142a['sendStatus'](_0x1d98a8);}return _0x59142a['status'](_0x1d98a8)[_0x9db8('0x19')]();};}function respondWithResult(_0x1c689e,_0x6c54eb){_0x6c54eb=_0x6c54eb||0xc8;return function(_0x422b6d){if(_0x422b6d){return _0x1c689e[_0x9db8('0x1a')](_0x6c54eb)[_0x9db8('0x1b')](_0x422b6d);}};}function respondWithFilteredResult(_0x5760fd,_0x5f26b5){return function(_0x2880d7){if(_0x2880d7){var _0x58cf9f=typeof _0x5f26b5[_0x9db8('0x1c')]==='undefined'&&typeof _0x5f26b5[_0x9db8('0x1d')]===_0x9db8('0x1e');var _0x269591=_0x2880d7[_0x9db8('0x1f')];var _0x5632c3=_0x58cf9f?0x0:_0x5f26b5['offset'];var _0x136621=_0x58cf9f?_0x2880d7[_0x9db8('0x1f')]:_0x5f26b5[_0x9db8('0x1c')]+_0x5f26b5[_0x9db8('0x1d')];var _0x48924b;if(_0x136621>=_0x269591){_0x136621=_0x269591;_0x48924b=0xc8;}else{_0x48924b=0xce;}_0x5760fd[_0x9db8('0x1a')](_0x48924b);return _0x5760fd[_0x9db8('0x20')](_0x9db8('0x21'),_0x5632c3+'-'+_0x136621+'/'+_0x269591)[_0x9db8('0x1b')](_0x2880d7);}return null;};}function patchUpdates(_0xa94a2c){return function(_0x31ab32){try{jsonpatch['apply'](_0x31ab32,_0xa94a2c,!![]);}catch(_0x353a70){return BPromise[_0x9db8('0x22')](_0x353a70);}return _0x31ab32[_0x9db8('0x23')]();};}function saveUpdates(_0x182326,_0x4fadbd){return function(_0x5495f9){if(_0x5495f9){return _0x5495f9[_0x9db8('0x24')](_0x182326)[_0x9db8('0x25')](function(_0x3a423f){return _0x3a423f;});}return null;};}function removeEntity(_0xaf2628,_0x24df5e){return function(_0x35149f){if(_0x35149f){return _0x35149f['destroy']()[_0x9db8('0x25')](function(){_0xaf2628[_0x9db8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541844,_0x389484){return function(_0x47d47b){if(!_0x47d47b){_0x541844[_0x9db8('0x26')](0x194);}return _0x47d47b;};}function handleError(_0x856faf,_0xdfe698){_0xdfe698=_0xdfe698||0x1f4;return function(_0x51047a){logger[_0x9db8('0x27')](_0x51047a['stack']);if(_0x51047a[_0x9db8('0x28')]){delete _0x51047a[_0x9db8('0x28')];}_0x856faf['status'](_0xdfe698)[_0x9db8('0x29')](_0x51047a);};}exports[_0x9db8('0x2a')]=function(_0x4a5e54,_0x434e5a){var _0x4948fb={},_0x1d395b={},_0x5e8f10={'count':0x0,'rows':[]};var _0xd0c994=_[_0x9db8('0x2b')](db[_0x9db8('0x2c')][_0x9db8('0x2d')],function(_0x20f9c9){return{'name':_0x20f9c9[_0x9db8('0x2e')],'type':_0x20f9c9[_0x9db8('0x2f')][_0x9db8('0x30')]};});_0x1d395b[_0x9db8('0x31')]=_[_0x9db8('0x2b')](_0xd0c994,_0x9db8('0x28'));_0x1d395b[_0x9db8('0x32')]=_[_0x9db8('0x33')](_0x4a5e54[_0x9db8('0x32')]);_0x1d395b[_0x9db8('0x34')]=_['intersection'](_0x1d395b[_0x9db8('0x31')],_0x1d395b[_0x9db8('0x32')]);_0x4948fb['attributes']=_[_0x9db8('0x35')](_0x1d395b[_0x9db8('0x31')],qs[_0x9db8('0x36')](_0x4a5e54[_0x9db8('0x32')]['fields']));_0x4948fb[_0x9db8('0x37')]=_0x4948fb[_0x9db8('0x37')]['length']?_0x4948fb[_0x9db8('0x37')]:_0x1d395b[_0x9db8('0x31')];if(!_0x4a5e54[_0x9db8('0x32')][_0x9db8('0x38')]('nolimit')){_0x4948fb[_0x9db8('0x1d')]=qs[_0x9db8('0x1d')](_0x4a5e54['query'][_0x9db8('0x1d')]);_0x4948fb[_0x9db8('0x1c')]=qs['offset'](_0x4a5e54[_0x9db8('0x32')]['offset']);}_0x4948fb[_0x9db8('0x39')]=qs[_0x9db8('0x3a')](_0x4a5e54[_0x9db8('0x32')]['sort']);_0x4948fb[_0x9db8('0x3b')]=qs['filters'](_[_0x9db8('0x3c')](_0x4a5e54[_0x9db8('0x32')],_0x1d395b[_0x9db8('0x34')]),_0xd0c994);if(_0x4a5e54['query']['filter']){_0x4948fb['where']=_[_0x9db8('0x3d')](_0x4948fb['where'],{'$or':_[_0x9db8('0x2b')](_0xd0c994,function(_0x37260c){if(_0x37260c[_0x9db8('0x2f')]!==_0x9db8('0x3e')){var _0x13236d={};_0x13236d[_0x37260c['name']]={'$like':'%'+_0x4a5e54[_0x9db8('0x32')]['filter']+'%'};return _0x13236d;}})});}_0x4948fb=_['merge']({},_0x4948fb,_0x4a5e54[_0x9db8('0x3f')]);var _0x1cdef2={'where':_0x4948fb[_0x9db8('0x3b')]};return db[_0x9db8('0x2c')][_0x9db8('0x1f')](_0x1cdef2)[_0x9db8('0x25')](function(_0x2ec2b3){_0x5e8f10['count']=_0x2ec2b3;if(_0x4a5e54[_0x9db8('0x32')][_0x9db8('0x40')]){_0x4948fb[_0x9db8('0x41')]=[{'all':!![]}];}return db[_0x9db8('0x2c')][_0x9db8('0x42')](_0x4948fb);})[_0x9db8('0x25')](function(_0x372de6){_0x5e8f10[_0x9db8('0x43')]=_0x372de6;return _0x5e8f10;})['then'](respondWithFilteredResult(_0x434e5a,_0x4948fb))[_0x9db8('0x44')](handleError(_0x434e5a,null));};exports[_0x9db8('0x45')]=function(_0x452374,_0x499fcf){var _0x28c4d5={'raw':!![],'where':{'id':_0x452374[_0x9db8('0x46')]['id']}},_0x566fac={};_0x566fac[_0x9db8('0x31')]=_['keys'](db[_0x9db8('0x2c')]['rawAttributes']);_0x566fac[_0x9db8('0x32')]=_['keys'](_0x452374['query']);_0x566fac[_0x9db8('0x34')]=_[_0x9db8('0x35')](_0x566fac[_0x9db8('0x31')],_0x566fac[_0x9db8('0x32')]);_0x28c4d5[_0x9db8('0x37')]=_[_0x9db8('0x35')](_0x566fac['model'],qs['fields'](_0x452374['query']['fields']));_0x28c4d5['attributes']=_0x28c4d5['attributes'][_0x9db8('0x47')]?_0x28c4d5[_0x9db8('0x37')]:_0x566fac[_0x9db8('0x31')];if(_0x452374[_0x9db8('0x32')][_0x9db8('0x40')]){_0x28c4d5[_0x9db8('0x41')]=[{'all':!![]}];}_0x28c4d5=_['merge']({},_0x28c4d5,_0x452374['options']);return db[_0x9db8('0x2c')]['find'](_0x28c4d5)[_0x9db8('0x25')](handleEntityNotFound(_0x499fcf,null))[_0x9db8('0x25')](respondWithResult(_0x499fcf,null))[_0x9db8('0x44')](handleError(_0x499fcf,null));};exports[_0x9db8('0x48')]=function(_0x30e520,_0x3c2144){return db[_0x9db8('0x2c')][_0x9db8('0x48')](_0x30e520['body'],{})[_0x9db8('0x25')](respondWithResult(_0x3c2144,0xc9))['catch'](handleError(_0x3c2144,null));};exports['update']=function(_0x320ec7,_0x5e5c19){if(_0x320ec7[_0x9db8('0x49')]['id']){delete _0x320ec7[_0x9db8('0x49')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x320ec7['params']['id']}})[_0x9db8('0x25')](handleEntityNotFound(_0x5e5c19,null))[_0x9db8('0x25')](saveUpdates(_0x320ec7[_0x9db8('0x49')],null))[_0x9db8('0x25')](respondWithResult(_0x5e5c19,null))['catch'](handleError(_0x5e5c19,null));};exports['destroy']=function(_0x38d2be,_0x42cf87){return db[_0x9db8('0x2c')][_0x9db8('0x4a')]({'where':{'id':_0x38d2be['params']['id']}})[_0x9db8('0x25')](handleEntityNotFound(_0x42cf87,null))[_0x9db8('0x25')](removeEntity(_0x42cf87,null))[_0x9db8('0x44')](handleError(_0x42cf87,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3571152..ddcaa20 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 _0xb667=['define','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x77388d,_0x2c7822){var _0x3b880d=function(_0xc774cb){while(--_0xc774cb){_0x77388d['push'](_0x77388d['shift']());}};_0x3b880d(++_0x2c7822);}(_0xb667,0x142));var _0x7b66=function(_0x14a572,_0x3abaea){_0x14a572=_0x14a572-0x0;var _0x2d1273=_0xb667[_0x14a572];return _0x2d1273;};'use strict';var _=require(_0x7b66('0x0'));var util=require('util');var logger=require(_0x7b66('0x1'))(_0x7b66('0x2'));var moment=require(_0x7b66('0x3'));var BPromise=require(_0x7b66('0x4'));var rp=require(_0x7b66('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7b66('0x6'));var attributes=require('./squareMessage.attributes');module[_0x7b66('0x7')]=function(_0x372a54,_0x19750f){return _0x372a54[_0x7b66('0x8')](_0x7b66('0x9'),attributes,{'tableName':_0x7b66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c4b=['lodash','api','moment','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0c4b,0x96));var _0xb0c4=function(_0x490014,_0x519ad6){_0x490014=_0x490014-0x0;var _0x289bee=_0x0c4b[_0x490014];return _0x289bee;};'use strict';var _=require(_0xb0c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb0c4('0x1'));var moment=require(_0xb0c4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0c4('0x3'));var rimraf=require(_0xb0c4('0x4'));var config=require(_0xb0c4('0x5'));var attributes=require('./squareMessage.attributes');module[_0xb0c4('0x6')]=function(_0x23adb7,_0x340f60){return _0x23adb7[_0xb0c4('0x7')](_0xb0c4('0x8'),attributes,{'tableName':_0xb0c4('0x9'),'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 31fae75..98b341e 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 _0xdecb=['stringify','error','code','message','result','catch','SquareMessage','create','body','options','raw','CreateSquareMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x201c59,_0x17916b){var _0x475f62=function(_0x54b2dc){while(--_0x54b2dc){_0x201c59['push'](_0x201c59['shift']());}};_0x475f62(++_0x17916b);}(_0xdecb,0x185));var _0xbdec=function(_0x3949e6,_0x28d94f){_0x3949e6=_0x3949e6-0x0;var _0x323881=_0xdecb[_0x3949e6];return _0x323881;};'use strict';var _=require('lodash');var util=require(_0xbdec('0x0'));var moment=require(_0xbdec('0x1'));var BPromise=require(_0xbdec('0x2'));var rs=require(_0xbdec('0x3'));var fs=require('fs');var Redis=require(_0xbdec('0x4'));var db=require(_0xbdec('0x5'))['db'];var utils=require(_0xbdec('0x6'));var logger=require(_0xbdec('0x7'))(_0xbdec('0x8'));var config=require(_0xbdec('0x9'));var jayson=require(_0xbdec('0xa'));var client=jayson[_0xbdec('0xb')][_0xbdec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f6cc2,_0x24a45c,_0x5215e8){return new BPromise(function(_0x5f78af,_0x1d64d5){return client['request'](_0x2f6cc2,_0x5215e8)[_0xbdec('0xd')](function(_0x118143){logger[_0xbdec('0xe')](_0xbdec('0xf'),_0x24a45c,'request\x20sent');logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x24a45c,_0xbdec('0x10'),JSON[_0xbdec('0x11')](_0x118143));if(_0x118143[_0xbdec('0x12')]){if(_0x118143[_0xbdec('0x12')][_0xbdec('0x13')]===0x1f4){logger[_0xbdec('0x12')](_0xbdec('0xf'),_0x24a45c,_0x118143[_0xbdec('0x12')]['message']);return _0x1d64d5(_0x118143[_0xbdec('0x12')][_0xbdec('0x14')]);}logger[_0xbdec('0x12')](_0xbdec('0xf'),_0x24a45c,_0x118143[_0xbdec('0x12')][_0xbdec('0x14')]);return _0x5f78af(_0x118143[_0xbdec('0x12')][_0xbdec('0x14')]);}else{logger[_0xbdec('0xe')](_0xbdec('0xf'),_0x24a45c,'request\x20sent');_0x5f78af(_0x118143[_0xbdec('0x15')][_0xbdec('0x14')]);}})[_0xbdec('0x16')](function(_0x2bfc65){logger[_0xbdec('0x12')]('SquareMessage,\x20%s,\x20%s',_0x24a45c,_0x2bfc65);_0x1d64d5(_0x2bfc65);});});}exports['CreateSquareMessage']=function(_0x264b06){var _0x450334=this;return new Promise(function(_0x2480a9,_0x3dcf9f){return db[_0xbdec('0x17')][_0xbdec('0x18')](_0x264b06[_0xbdec('0x19')],{'raw':_0x264b06['options']?_0x264b06[_0xbdec('0x1a')][_0xbdec('0x1b')]===undefined?!![]:![]:!![]})[_0xbdec('0xd')](function(_0x2eaa6a){logger[_0xbdec('0xe')]('CreateSquareMessage',_0x264b06);logger['debug'](_0xbdec('0x1c'),_0x264b06,JSON[_0xbdec('0x11')](_0x2eaa6a));_0x2480a9(_0x2eaa6a);})[_0xbdec('0x16')](function(_0x41c287){logger[_0xbdec('0x12')]('CreateSquareMessage',_0x41c287[_0xbdec('0x14')],_0x264b06);_0x3dcf9f(_0x450334['error'](0x1f4,_0x41c287[_0xbdec('0x14')]));});});}; \ No newline at end of file +var _0x3592=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SquareMessage','create','body','raw','CreateSquareMessage','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x340092,_0x556475){var _0x1724a6=function(_0x45ecdb){while(--_0x45ecdb){_0x340092['push'](_0x340092['shift']());}};_0x1724a6(++_0x556475);}(_0x3592,0x1bf));var _0x2359=function(_0x1a8892,_0x48d157){_0x1a8892=_0x1a8892-0x0;var _0x2444a2=_0x3592[_0x1a8892];return _0x2444a2;};'use strict';var _=require('lodash');var util=require(_0x2359('0x0'));var moment=require(_0x2359('0x1'));var BPromise=require(_0x2359('0x2'));var rs=require(_0x2359('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2359('0x4'))['db'];var utils=require(_0x2359('0x5'));var logger=require(_0x2359('0x6'))('rpc');var config=require(_0x2359('0x7'));var jayson=require(_0x2359('0x8'));var client=jayson[_0x2359('0x9')][_0x2359('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32ce00,_0x17fa31,_0x56510a){return new BPromise(function(_0x38b7b6,_0x3bc32f){return client['request'](_0x32ce00,_0x56510a)[_0x2359('0xb')](function(_0x8f8eee){logger[_0x2359('0xc')](_0x2359('0xd'),_0x17fa31,_0x2359('0xe'));logger[_0x2359('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x17fa31,'request\x20sent',JSON[_0x2359('0x10')](_0x8f8eee));if(_0x8f8eee[_0x2359('0x11')]){if(_0x8f8eee['error'][_0x2359('0x12')]===0x1f4){logger[_0x2359('0x11')](_0x2359('0xd'),_0x17fa31,_0x8f8eee[_0x2359('0x11')]['message']);return _0x3bc32f(_0x8f8eee[_0x2359('0x11')][_0x2359('0x13')]);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x17fa31,_0x8f8eee[_0x2359('0x11')][_0x2359('0x13')]);return _0x38b7b6(_0x8f8eee[_0x2359('0x11')][_0x2359('0x13')]);}else{logger[_0x2359('0xc')](_0x2359('0xd'),_0x17fa31,'request\x20sent');_0x38b7b6(_0x8f8eee[_0x2359('0x14')][_0x2359('0x13')]);}})[_0x2359('0x15')](function(_0x38acb2){logger[_0x2359('0x11')](_0x2359('0xd'),_0x17fa31,_0x38acb2);_0x3bc32f(_0x38acb2);});});}exports['CreateSquareMessage']=function(_0x21b2be){var _0x18f34f=this;return new Promise(function(_0x45a1cd,_0x436ab0){return db[_0x2359('0x16')][_0x2359('0x17')](_0x21b2be[_0x2359('0x18')],{'raw':_0x21b2be['options']?_0x21b2be['options'][_0x2359('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x56762a){logger[_0x2359('0xc')](_0x2359('0x1a'),_0x21b2be);logger['debug']('CreateSquareMessage',_0x21b2be,JSON[_0x2359('0x10')](_0x56762a));_0x45a1cd(_0x56762a);})[_0x2359('0x15')](function(_0x47edc5){logger[_0x2359('0x11')](_0x2359('0x1a'),_0x47edc5[_0x2359('0x13')],_0x21b2be);_0x436ab0(_0x18f34f['error'](0x1f4,_0x47edc5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 4b09455..ecf9fb3 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 _0x4d16=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','/:id/test','15s','test','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x35a867,_0x3e4da4){var _0x65f050=function(_0x4d4674){while(--_0x4d4674){_0x35a867['push'](_0x35a867['shift']());}};_0x65f050(++_0x3e4da4);}(_0x4d16,0x67));var _0x64d1=function(_0x967dbc,_0x315358){_0x967dbc=_0x967dbc-0x0;var _0x1982fb=_0x4d16[_0x967dbc];return _0x1982fb;};'use strict';var multer=require(_0x64d1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x64d1('0x1'));var express=require('express');var router=express[_0x64d1('0x2')]();var fs_extra=require(_0x64d1('0x3'));var auth=require(_0x64d1('0x4'));var interaction=require(_0x64d1('0x5'));var config=require(_0x64d1('0x6'));var controller=require(_0x64d1('0x7'));router[_0x64d1('0x8')]('/',auth[_0x64d1('0x9')](),controller['index']);router[_0x64d1('0x8')]('/:id',auth[_0x64d1('0x9')](),controller[_0x64d1('0xa')]);router[_0x64d1('0x8')](_0x64d1('0xb'),auth[_0x64d1('0x9')](),timeout(_0x64d1('0xc')),controller[_0x64d1('0xd')]);router[_0x64d1('0xe')]('/',auth[_0x64d1('0x9')](),controller['create']);router[_0x64d1('0xf')](_0x64d1('0x10'),auth['isAuthenticated'](),controller[_0x64d1('0x11')]);router[_0x64d1('0x12')](_0x64d1('0x10'),auth[_0x64d1('0x9')](),controller[_0x64d1('0x13')]);module[_0x64d1('0x14')]=router; \ No newline at end of file +var _0xc491=['isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xc491,0x7b));var _0x1c49=function(_0x387583,_0x127b08){_0x387583=_0x387583-0x0;var _0x45d2f9=_0xc491[_0x387583];return _0x45d2f9;};'use strict';var multer=require(_0x1c49('0x0'));var util=require('util');var path=require(_0x1c49('0x1'));var timeout=require(_0x1c49('0x2'));var express=require(_0x1c49('0x3'));var router=express[_0x1c49('0x4')]();var fs_extra=require(_0x1c49('0x5'));var auth=require(_0x1c49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1c49('0x7'));var controller=require('./squareOdbc.controller');router[_0x1c49('0x8')]('/',auth[_0x1c49('0x9')](),controller[_0x1c49('0xa')]);router[_0x1c49('0x8')](_0x1c49('0xb'),auth[_0x1c49('0x9')](),controller[_0x1c49('0xc')]);router[_0x1c49('0x8')](_0x1c49('0xd'),auth[_0x1c49('0x9')](),timeout(_0x1c49('0xe')),controller[_0x1c49('0xf')]);router[_0x1c49('0x10')]('/',auth[_0x1c49('0x9')](),controller[_0x1c49('0x11')]);router['put']('/:id',auth[_0x1c49('0x9')](),controller[_0x1c49('0x12')]);router[_0x1c49('0x13')](_0x1c49('0xb'),auth[_0x1c49('0x9')](),controller[_0x1c49('0x14')]);module[_0x1c49('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 51ebcab..cfcd0cb 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 _0x77f9=['STRING','sequelize','exports'];(function(_0x237d2d,_0x456d17){var _0x5132e5=function(_0x7f0900){while(--_0x7f0900){_0x237d2d['push'](_0x237d2d['shift']());}};_0x5132e5(++_0x456d17);}(_0x77f9,0x106));var _0x977f=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x77f9[_0x5027b1];return _0x4a46cf;};'use strict';var Sequelize=require(_0x977f('0x0'));module[_0x977f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x977f('0x2')]},'description':{'type':Sequelize[_0x977f('0x2')]}}; \ No newline at end of file +var _0x3b46=['STRING','name','sequelize'];(function(_0xfd885e,_0x436051){var _0xd8bfac=function(_0x5992b4){while(--_0x5992b4){_0xfd885e['push'](_0xfd885e['shift']());}};_0xd8bfac(++_0x436051);}(_0x3b46,0x1e8));var _0x63b4=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x3b46[_0x2181b1];return _0x530548;};'use strict';var Sequelize=require(_0x63b4('0x0'));module['exports']={'name':{'type':Sequelize[_0x63b4('0x1')],'unique':_0x63b4('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x63b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 785c9e9..7737821 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 _0xac0e=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','index','map','SquareOdbc','rawAttributes','fieldName','keys','filters','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','name','options','includeAll','rows','show','params','include','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x3d9f11,_0x130b60){var _0x1534dc=function(_0x293ee7){while(--_0x293ee7){_0x3d9f11['push'](_0x3d9f11['shift']());}};_0x1534dc(++_0x130b60);}(_0xac0e,0x90));var _0xeac0=function(_0x3249fd,_0x304c39){_0x3249fd=_0x3249fd-0x0;var _0x3b26f7=_0xac0e[_0x3249fd];return _0x3b26f7;};'use strict';var emlformat=require(_0xeac0('0x0'));var rimraf=require(_0xeac0('0x1'));var zipdir=require(_0xeac0('0x2'));var jsonpatch=require(_0xeac0('0x3'));var rp=require('request-promise');var moment=require(_0xeac0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeac0('0x5'));var util=require(_0xeac0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xeac0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeac0('0x8'));var _=require(_0xeac0('0x9'));var squel=require(_0xeac0('0xa'));var crypto=require(_0xeac0('0xb'));var jsforce=require(_0xeac0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeac0('0xd'));var Papa=require(_0xeac0('0xe'));var Redis=require(_0xeac0('0xf'));var authService=require(_0xeac0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeac0('0x11'));var hardwareService=require(_0xeac0('0x12'));var logger=require(_0xeac0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xeac0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14812d,_0x350353){_0x350353=_0x350353||0xcc;return function(_0x336cca){if(_0x336cca){return _0x14812d[_0xeac0('0x15')](_0x350353);}return _0x14812d[_0xeac0('0x16')](_0x350353)[_0xeac0('0x17')]();};}function respondWithResult(_0x2815f7,_0x42c369){_0x42c369=_0x42c369||0xc8;return function(_0x376db6){if(_0x376db6){return _0x2815f7[_0xeac0('0x16')](_0x42c369)[_0xeac0('0x18')](_0x376db6);}};}function respondWithFilteredResult(_0x33ba6d,_0x534765){return function(_0x506cec){if(_0x506cec){var _0x1bb364=typeof _0x534765[_0xeac0('0x19')]==='undefined'&&typeof _0x534765['limit']===_0xeac0('0x1a');var _0x48f667=_0x506cec[_0xeac0('0x1b')];var _0x4ea1bd=_0x1bb364?0x0:_0x534765['offset'];var _0x231c6b=_0x1bb364?_0x506cec['count']:_0x534765[_0xeac0('0x19')]+_0x534765[_0xeac0('0x1c')];var _0x11bee6;if(_0x231c6b>=_0x48f667){_0x231c6b=_0x48f667;_0x11bee6=0xc8;}else{_0x11bee6=0xce;}_0x33ba6d[_0xeac0('0x16')](_0x11bee6);return _0x33ba6d['set']('Content-Range',_0x4ea1bd+'-'+_0x231c6b+'/'+_0x48f667)['json'](_0x506cec);}return null;};}function patchUpdates(_0xefe9a){return function(_0x393458){try{jsonpatch[_0xeac0('0x1d')](_0x393458,_0xefe9a,!![]);}catch(_0xf6b86){return BPromise['reject'](_0xf6b86);}return _0x393458[_0xeac0('0x1e')]();};}function saveUpdates(_0x1f8bd4,_0x2b82ba){return function(_0x5da439){if(_0x5da439){return _0x5da439[_0xeac0('0x1f')](_0x1f8bd4)[_0xeac0('0x20')](function(_0x2c8b02){return _0x2c8b02;});}return null;};}function removeEntity(_0x57aee4,_0x43a8f8){return function(_0x528bc1){if(_0x528bc1){return _0x528bc1[_0xeac0('0x21')]()['then'](function(){var _0x1d5c9a=_0x528bc1[_0xeac0('0x22')]({'plain':!![]});var _0xd918b0=_0xeac0('0x23');return db[_0xeac0('0x24')][_0xeac0('0x21')]({'where':{'type':_0xd918b0,'resourceId':_0x1d5c9a['id']}})['then'](function(){return _0x528bc1;});})[_0xeac0('0x20')](function(){_0x57aee4[_0xeac0('0x16')](0xcc)[_0xeac0('0x17')]();});}};}function handleEntityNotFound(_0x1dd6dd,_0x107aee){return function(_0x548cb5){if(!_0x548cb5){_0x1dd6dd['sendStatus'](0x194);}return _0x548cb5;};}function handleError(_0x489609,_0x2afa90){_0x2afa90=_0x2afa90||0x1f4;return function(_0x30dd88){logger[_0xeac0('0x25')](_0x30dd88[_0xeac0('0x26')]);if(_0x30dd88['name']){delete _0x30dd88['name'];}_0x489609[_0xeac0('0x16')](_0x2afa90)['send'](_0x30dd88);};}exports[_0xeac0('0x27')]=function(_0x165298,_0x4412d1){var _0x138c3a={},_0x5e3f61={},_0x147ecf={'count':0x0,'rows':[]};var _0xed14ab=_[_0xeac0('0x28')](db[_0xeac0('0x29')][_0xeac0('0x2a')],function(_0x5d4819){return{'name':_0x5d4819[_0xeac0('0x2b')],'type':_0x5d4819['type']['key']};});_0x5e3f61['model']=_[_0xeac0('0x28')](_0xed14ab,'name');_0x5e3f61['query']=_[_0xeac0('0x2c')](_0x165298['query']);_0x5e3f61[_0xeac0('0x2d')]=_['intersection'](_0x5e3f61[_0xeac0('0x2e')],_0x5e3f61[_0xeac0('0x2f')]);_0x138c3a[_0xeac0('0x30')]=_[_0xeac0('0x31')](_0x5e3f61[_0xeac0('0x2e')],qs[_0xeac0('0x32')](_0x165298[_0xeac0('0x2f')][_0xeac0('0x32')]));_0x138c3a[_0xeac0('0x30')]=_0x138c3a[_0xeac0('0x30')]['length']?_0x138c3a[_0xeac0('0x30')]:_0x5e3f61['model'];if(!_0x165298[_0xeac0('0x2f')][_0xeac0('0x33')](_0xeac0('0x34'))){_0x138c3a['limit']=qs[_0xeac0('0x1c')](_0x165298['query']['limit']);_0x138c3a['offset']=qs['offset'](_0x165298[_0xeac0('0x2f')]['offset']);}_0x138c3a[_0xeac0('0x35')]=qs[_0xeac0('0x36')](_0x165298['query'][_0xeac0('0x36')]);_0x138c3a['where']=qs['filters'](_['pick'](_0x165298[_0xeac0('0x2f')],_0x5e3f61['filters']),_0xed14ab);if(_0x165298['query'][_0xeac0('0x37')]){_0x138c3a[_0xeac0('0x38')]=_[_0xeac0('0x39')](_0x138c3a[_0xeac0('0x38')],{'$or':_['map'](_0xed14ab,function(_0x117d13){if(_0x117d13[_0xeac0('0x3a')]!=='VIRTUAL'){var _0x4420f8={};_0x4420f8[_0x117d13[_0xeac0('0x3b')]]={'$like':'%'+_0x165298['query']['filter']+'%'};return _0x4420f8;}})});}_0x138c3a=_[_0xeac0('0x39')]({},_0x138c3a,_0x165298[_0xeac0('0x3c')]);var _0x2275c4={'where':_0x138c3a[_0xeac0('0x38')]};return db[_0xeac0('0x29')][_0xeac0('0x1b')](_0x2275c4)[_0xeac0('0x20')](function(_0x3914e3){_0x147ecf[_0xeac0('0x1b')]=_0x3914e3;if(_0x165298[_0xeac0('0x2f')][_0xeac0('0x3d')]){_0x138c3a['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x138c3a);})['then'](function(_0x358625){_0x147ecf[_0xeac0('0x3e')]=_0x358625;return _0x147ecf;})[_0xeac0('0x20')](respondWithFilteredResult(_0x4412d1,_0x138c3a))['catch'](handleError(_0x4412d1,null));};exports[_0xeac0('0x3f')]=function(_0x46fd18,_0x3ea8a3){var _0x26ba0e={'raw':!![],'where':{'id':_0x46fd18[_0xeac0('0x40')]['id']}},_0xb982ca={};_0xb982ca[_0xeac0('0x2e')]=_[_0xeac0('0x2c')](db[_0xeac0('0x29')]['rawAttributes']);_0xb982ca['query']=_['keys'](_0x46fd18[_0xeac0('0x2f')]);_0xb982ca[_0xeac0('0x2d')]=_['intersection'](_0xb982ca['model'],_0xb982ca[_0xeac0('0x2f')]);_0x26ba0e[_0xeac0('0x30')]=_[_0xeac0('0x31')](_0xb982ca[_0xeac0('0x2e')],qs[_0xeac0('0x32')](_0x46fd18['query'][_0xeac0('0x32')]));_0x26ba0e[_0xeac0('0x30')]=_0x26ba0e[_0xeac0('0x30')]['length']?_0x26ba0e[_0xeac0('0x30')]:_0xb982ca['model'];if(_0x46fd18['query']['includeAll']){_0x26ba0e[_0xeac0('0x41')]=[{'all':!![]}];}_0x26ba0e=_[_0xeac0('0x39')]({},_0x26ba0e,_0x46fd18[_0xeac0('0x3c')]);return db[_0xeac0('0x29')][_0xeac0('0x42')](_0x26ba0e)[_0xeac0('0x20')](handleEntityNotFound(_0x3ea8a3,null))[_0xeac0('0x20')](respondWithResult(_0x3ea8a3,null))[_0xeac0('0x43')](handleError(_0x3ea8a3,null));};exports['create']=function(_0x369ee2,_0x43dbf5){return db['SquareOdbc']['create'](_0x369ee2[_0xeac0('0x44')],{})[_0xeac0('0x20')](function(_0x372bb3){var _0x2e20e2=_0x369ee2[_0xeac0('0x45')][_0xeac0('0x22')]({'plain':!![]});if(!_0x2e20e2)throw new Error(_0xeac0('0x46'));if(_0x2e20e2[_0xeac0('0x47')]===_0xeac0('0x45')){var _0x4d739b=_0x372bb3[_0xeac0('0x22')]({'plain':!![]});var _0x25a56b='ODBC';return db[_0xeac0('0x48')]['find']({'where':{'name':_0x25a56b,'userProfileId':_0x2e20e2[_0xeac0('0x49')]},'raw':!![]})['then'](function(_0x46b883){if(_0x46b883&&_0x46b883[_0xeac0('0x4a')]===0x0){return db[_0xeac0('0x24')]['create']({'name':_0x4d739b[_0xeac0('0x3b')],'resourceId':_0x4d739b['id'],'type':_0x46b883['name'],'sectionId':_0x46b883['id']},{})[_0xeac0('0x20')](function(){return _0x372bb3;});}else{return _0x372bb3;}})[_0xeac0('0x43')](function(_0x854ea8){logger['error'](_0xeac0('0x4b'),_0x854ea8);throw _0x854ea8;});}return _0x372bb3;})['then'](respondWithResult(_0x43dbf5,0xc9))[_0xeac0('0x43')](handleError(_0x43dbf5,null));};exports[_0xeac0('0x1f')]=function(_0x3d5bec,_0x21c3eb){if(_0x3d5bec[_0xeac0('0x44')]['id']){delete _0x3d5bec[_0xeac0('0x44')]['id'];}return db[_0xeac0('0x29')]['find']({'where':{'id':_0x3d5bec[_0xeac0('0x40')]['id']}})[_0xeac0('0x20')](handleEntityNotFound(_0x21c3eb,null))[_0xeac0('0x20')](saveUpdates(_0x3d5bec['body'],null))['then'](respondWithResult(_0x21c3eb,null))[_0xeac0('0x43')](handleError(_0x21c3eb,null));};exports['destroy']=function(_0x25757f,_0x56c4f9){return db['SquareOdbc'][_0xeac0('0x42')]({'where':{'id':_0x25757f[_0xeac0('0x40')]['id']}})[_0xeac0('0x20')](handleEntityNotFound(_0x56c4f9,null))[_0xeac0('0x20')](removeEntity(_0x56c4f9,null))[_0xeac0('0x43')](handleError(_0x56c4f9,null));};exports[_0xeac0('0x4c')]=function(_0x16ec96,_0x3c90da,_0xf642e4){var _0x4bebe8;return db[_0xeac0('0x29')][_0xeac0('0x42')]({'where':{'id':_0x16ec96[_0xeac0('0x40')]['id']},'attributes':['id',_0xeac0('0x4d')]})[_0xeac0('0x20')](handleEntityNotFound(_0x3c90da,null))[_0xeac0('0x20')](function(_0x1c2bf3){if(_0x1c2bf3){var _0x458df8=require('odbc')();_0x458df8[_0xeac0('0x4e')](_0x1c2bf3[_0xeac0('0x4d')]);_0x458df8[_0xeac0('0x4f')]();return _0x1c2bf3;}})['then'](respondWithResult(_0x3c90da,null))[_0xeac0('0x43')](handleError(_0x3c90da,null));}; \ No newline at end of file +var _0x8b28=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','SquareOdbc','rows','catch','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x237fea,_0x1ff78a){var _0x2a04f1=function(_0x4518c3){while(--_0x4518c3){_0x237fea['push'](_0x237fea['shift']());}};_0x2a04f1(++_0x1ff78a);}(_0x8b28,0x194));var _0x88b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b28[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x88b2('0x0'));var rimraf=require(_0x88b2('0x1'));var zipdir=require(_0x88b2('0x2'));var jsonpatch=require(_0x88b2('0x3'));var rp=require(_0x88b2('0x4'));var moment=require(_0x88b2('0x5'));var BPromise=require(_0x88b2('0x6'));var Mustache=require(_0x88b2('0x7'));var util=require('util');var path=require(_0x88b2('0x8'));var sox=require('sox');var csv=require(_0x88b2('0x9'));var ejs=require(_0x88b2('0xa'));var fs=require('fs');var fs_extra=require(_0x88b2('0xb'));var _=require(_0x88b2('0xc'));var squel=require(_0x88b2('0xd'));var crypto=require(_0x88b2('0xe'));var jsforce=require(_0x88b2('0xf'));var deskjs=require(_0x88b2('0x10'));var toCsv=require(_0x88b2('0x9'));var querystring=require(_0x88b2('0x11'));var Papa=require(_0x88b2('0x12'));var Redis=require(_0x88b2('0x13'));var authService=require(_0x88b2('0x14'));var qs=require(_0x88b2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88b2('0x16'));var logger=require(_0x88b2('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x88b2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x88b2('0x19'))['db'];function respondWithStatusCode(_0x3bbf73,_0x1467f3){_0x1467f3=_0x1467f3||0xcc;return function(_0x2227c3){if(_0x2227c3){return _0x3bbf73[_0x88b2('0x1a')](_0x1467f3);}return _0x3bbf73[_0x88b2('0x1b')](_0x1467f3)['end']();};}function respondWithResult(_0x1535d0,_0x5da595){_0x5da595=_0x5da595||0xc8;return function(_0x56e6f3){if(_0x56e6f3){return _0x1535d0[_0x88b2('0x1b')](_0x5da595)[_0x88b2('0x1c')](_0x56e6f3);}};}function respondWithFilteredResult(_0xa68909,_0x3f1fb6){return function(_0x290978){if(_0x290978){var _0x7b0c6c=typeof _0x3f1fb6['offset']===_0x88b2('0x1d')&&typeof _0x3f1fb6[_0x88b2('0x1e')]===_0x88b2('0x1d');var _0x206755=_0x290978[_0x88b2('0x1f')];var _0x3126fc=_0x7b0c6c?0x0:_0x3f1fb6[_0x88b2('0x20')];var _0x4c1a18=_0x7b0c6c?_0x290978[_0x88b2('0x1f')]:_0x3f1fb6[_0x88b2('0x20')]+_0x3f1fb6[_0x88b2('0x1e')];var _0x681df8;if(_0x4c1a18>=_0x206755){_0x4c1a18=_0x206755;_0x681df8=0xc8;}else{_0x681df8=0xce;}_0xa68909[_0x88b2('0x1b')](_0x681df8);return _0xa68909[_0x88b2('0x21')](_0x88b2('0x22'),_0x3126fc+'-'+_0x4c1a18+'/'+_0x206755)[_0x88b2('0x1c')](_0x290978);}return null;};}function patchUpdates(_0x53bf25){return function(_0x43cba3){try{jsonpatch[_0x88b2('0x23')](_0x43cba3,_0x53bf25,!![]);}catch(_0x2237ed){return BPromise[_0x88b2('0x24')](_0x2237ed);}return _0x43cba3[_0x88b2('0x25')]();};}function saveUpdates(_0x3175a6,_0x5628a3){return function(_0x407fd8){if(_0x407fd8){return _0x407fd8['update'](_0x3175a6)[_0x88b2('0x26')](function(_0x128ebe){return _0x128ebe;});}return null;};}function removeEntity(_0x9ffb2,_0x5cd07a){return function(_0x3e801b){if(_0x3e801b){return _0x3e801b[_0x88b2('0x27')]()[_0x88b2('0x26')](function(){var _0x2d467e=_0x3e801b[_0x88b2('0x28')]({'plain':!![]});var _0x342c3f=_0x88b2('0x29');return db[_0x88b2('0x2a')][_0x88b2('0x27')]({'where':{'type':_0x342c3f,'resourceId':_0x2d467e['id']}})['then'](function(){return _0x3e801b;});})['then'](function(){_0x9ffb2[_0x88b2('0x1b')](0xcc)[_0x88b2('0x2b')]();});}};}function handleEntityNotFound(_0xcc1ea0,_0x29dd24){return function(_0x5ee644){if(!_0x5ee644){_0xcc1ea0[_0x88b2('0x1a')](0x194);}return _0x5ee644;};}function handleError(_0x55b569,_0x5cd09a){_0x5cd09a=_0x5cd09a||0x1f4;return function(_0x3c3d6a){logger[_0x88b2('0x2c')](_0x3c3d6a[_0x88b2('0x2d')]);if(_0x3c3d6a[_0x88b2('0x2e')]){delete _0x3c3d6a['name'];}_0x55b569['status'](_0x5cd09a)[_0x88b2('0x2f')](_0x3c3d6a);};}exports[_0x88b2('0x30')]=function(_0x15a696,_0x5646da){var _0x17fc63={},_0x4788bd={},_0x2ffaa6={'count':0x0,'rows':[]};var _0xe764ed=_[_0x88b2('0x31')](db['SquareOdbc'][_0x88b2('0x32')],function(_0x45c4b8){return{'name':_0x45c4b8['fieldName'],'type':_0x45c4b8['type']['key']};});_0x4788bd['model']=_[_0x88b2('0x31')](_0xe764ed,_0x88b2('0x2e'));_0x4788bd[_0x88b2('0x33')]=_['keys'](_0x15a696[_0x88b2('0x33')]);_0x4788bd[_0x88b2('0x34')]=_[_0x88b2('0x35')](_0x4788bd[_0x88b2('0x36')],_0x4788bd[_0x88b2('0x33')]);_0x17fc63[_0x88b2('0x37')]=_[_0x88b2('0x35')](_0x4788bd[_0x88b2('0x36')],qs[_0x88b2('0x38')](_0x15a696[_0x88b2('0x33')][_0x88b2('0x38')]));_0x17fc63[_0x88b2('0x37')]=_0x17fc63['attributes']['length']?_0x17fc63[_0x88b2('0x37')]:_0x4788bd['model'];if(!_0x15a696[_0x88b2('0x33')][_0x88b2('0x39')]('nolimit')){_0x17fc63[_0x88b2('0x1e')]=qs[_0x88b2('0x1e')](_0x15a696[_0x88b2('0x33')][_0x88b2('0x1e')]);_0x17fc63['offset']=qs[_0x88b2('0x20')](_0x15a696[_0x88b2('0x33')][_0x88b2('0x20')]);}_0x17fc63[_0x88b2('0x3a')]=qs['sort'](_0x15a696['query'][_0x88b2('0x3b')]);_0x17fc63[_0x88b2('0x3c')]=qs[_0x88b2('0x34')](_[_0x88b2('0x3d')](_0x15a696[_0x88b2('0x33')],_0x4788bd['filters']),_0xe764ed);if(_0x15a696[_0x88b2('0x33')][_0x88b2('0x3e')]){_0x17fc63[_0x88b2('0x3c')]=_[_0x88b2('0x3f')](_0x17fc63[_0x88b2('0x3c')],{'$or':_['map'](_0xe764ed,function(_0x275ef4){if(_0x275ef4[_0x88b2('0x40')]!==_0x88b2('0x41')){var _0x3f8f54={};_0x3f8f54[_0x275ef4['name']]={'$like':'%'+_0x15a696[_0x88b2('0x33')][_0x88b2('0x3e')]+'%'};return _0x3f8f54;}})});}_0x17fc63=_['merge']({},_0x17fc63,_0x15a696[_0x88b2('0x42')]);var _0x173f5d={'where':_0x17fc63[_0x88b2('0x3c')]};return db['SquareOdbc'][_0x88b2('0x1f')](_0x173f5d)['then'](function(_0x324e97){_0x2ffaa6[_0x88b2('0x1f')]=_0x324e97;if(_0x15a696[_0x88b2('0x33')][_0x88b2('0x43')]){_0x17fc63['include']=[{'all':!![]}];}return db[_0x88b2('0x44')]['findAll'](_0x17fc63);})[_0x88b2('0x26')](function(_0x2eb7f1){_0x2ffaa6[_0x88b2('0x45')]=_0x2eb7f1;return _0x2ffaa6;})[_0x88b2('0x26')](respondWithFilteredResult(_0x5646da,_0x17fc63))[_0x88b2('0x46')](handleError(_0x5646da,null));};exports['show']=function(_0x385999,_0x1bf5a8){var _0x243bed={'raw':!![],'where':{'id':_0x385999[_0x88b2('0x47')]['id']}},_0x2a96ce={};_0x2a96ce['model']=_['keys'](db[_0x88b2('0x44')]['rawAttributes']);_0x2a96ce[_0x88b2('0x33')]=_['keys'](_0x385999[_0x88b2('0x33')]);_0x2a96ce['filters']=_[_0x88b2('0x35')](_0x2a96ce[_0x88b2('0x36')],_0x2a96ce[_0x88b2('0x33')]);_0x243bed[_0x88b2('0x37')]=_[_0x88b2('0x35')](_0x2a96ce[_0x88b2('0x36')],qs[_0x88b2('0x38')](_0x385999[_0x88b2('0x33')][_0x88b2('0x38')]));_0x243bed['attributes']=_0x243bed[_0x88b2('0x37')]['length']?_0x243bed[_0x88b2('0x37')]:_0x2a96ce[_0x88b2('0x36')];if(_0x385999[_0x88b2('0x33')][_0x88b2('0x43')]){_0x243bed[_0x88b2('0x48')]=[{'all':!![]}];}_0x243bed=_[_0x88b2('0x3f')]({},_0x243bed,_0x385999[_0x88b2('0x42')]);return db['SquareOdbc'][_0x88b2('0x49')](_0x243bed)[_0x88b2('0x26')](handleEntityNotFound(_0x1bf5a8,null))['then'](respondWithResult(_0x1bf5a8,null))[_0x88b2('0x46')](handleError(_0x1bf5a8,null));};exports[_0x88b2('0x4a')]=function(_0x246c0e,_0x346880){return db[_0x88b2('0x44')][_0x88b2('0x4a')](_0x246c0e[_0x88b2('0x4b')],{})[_0x88b2('0x26')](function(_0x4bb7f1){var _0x213766=_0x246c0e['user'][_0x88b2('0x28')]({'plain':!![]});if(!_0x213766)throw new Error(_0x88b2('0x4c'));if(_0x213766['role']==='user'){var _0x3a49b3=_0x4bb7f1[_0x88b2('0x28')]({'plain':!![]});var _0x4d40f9=_0x88b2('0x29');return db['UserProfileSection'][_0x88b2('0x49')]({'where':{'name':_0x4d40f9,'userProfileId':_0x213766['userProfileId']},'raw':!![]})[_0x88b2('0x26')](function(_0x26ad60){if(_0x26ad60&&_0x26ad60[_0x88b2('0x4d')]===0x0){return db['UserProfileResource'][_0x88b2('0x4a')]({'name':_0x3a49b3[_0x88b2('0x2e')],'resourceId':_0x3a49b3['id'],'type':_0x26ad60[_0x88b2('0x2e')],'sectionId':_0x26ad60['id']},{})[_0x88b2('0x26')](function(){return _0x4bb7f1;});}else{return _0x4bb7f1;}})[_0x88b2('0x46')](function(_0x3acd9d){logger['error'](_0x88b2('0x4e'),_0x3acd9d);throw _0x3acd9d;});}return _0x4bb7f1;})[_0x88b2('0x26')](respondWithResult(_0x346880,0xc9))[_0x88b2('0x46')](handleError(_0x346880,null));};exports[_0x88b2('0x4f')]=function(_0x11c23b,_0x5c0e40){if(_0x11c23b[_0x88b2('0x4b')]['id']){delete _0x11c23b[_0x88b2('0x4b')]['id'];}return db[_0x88b2('0x44')][_0x88b2('0x49')]({'where':{'id':_0x11c23b['params']['id']}})[_0x88b2('0x26')](handleEntityNotFound(_0x5c0e40,null))[_0x88b2('0x26')](saveUpdates(_0x11c23b['body'],null))[_0x88b2('0x26')](respondWithResult(_0x5c0e40,null))['catch'](handleError(_0x5c0e40,null));};exports[_0x88b2('0x27')]=function(_0x5ba348,_0x3a969b){return db[_0x88b2('0x44')][_0x88b2('0x49')]({'where':{'id':_0x5ba348[_0x88b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a969b,null))[_0x88b2('0x26')](removeEntity(_0x3a969b,null))[_0x88b2('0x46')](handleError(_0x3a969b,null));};exports['test']=function(_0x5ed8a9,_0x2ec657,_0x56d1a3){var _0x13ddc3;return db[_0x88b2('0x44')][_0x88b2('0x49')]({'where':{'id':_0x5ed8a9[_0x88b2('0x47')]['id']},'attributes':['id',_0x88b2('0x50')]})['then'](handleEntityNotFound(_0x2ec657,null))[_0x88b2('0x26')](function(_0x459f24){if(_0x459f24){var _0x1e4e61=require(_0x88b2('0x51'))();_0x1e4e61[_0x88b2('0x52')](_0x459f24['dsn']);_0x1e4e61[_0x88b2('0x53')]();return _0x459f24;}})[_0x88b2('0x26')](respondWithResult(_0x2ec657,null))[_0x88b2('0x46')](handleError(_0x2ec657,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 447a5ba..27d039d 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 _0xa0cd=['SquareOdbc','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x208798,_0x1dfbd4){var _0x2e76c8=function(_0x4844a0){while(--_0x4844a0){_0x208798['push'](_0x208798['shift']());}};_0x2e76c8(++_0x1dfbd4);}(_0xa0cd,0xa1));var _0xda0c=function(_0x1fddd6,_0x35c1c8){_0x1fddd6=_0x1fddd6-0x0;var _0xdd2ba2=_0xa0cd[_0x1fddd6];return _0xdd2ba2;};'use strict';var _=require(_0xda0c('0x0'));var util=require(_0xda0c('0x1'));var logger=require('../../config/logger')(_0xda0c('0x2'));var moment=require('moment');var BPromise=require(_0xda0c('0x3'));var rp=require(_0xda0c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda0c('0x5'));var config=require(_0xda0c('0x6'));var attributes=require('./squareOdbc.attributes');module[_0xda0c('0x7')]=function(_0x54f02b,_0x4e148b){return _0x54f02b[_0xda0c('0x8')](_0xda0c('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d8f=['request-promise','rimraf','exports','define','square_odbc','lodash','util','api','moment','bluebird'];(function(_0x52591a,_0x1c4f04){var _0x59548d=function(_0x2d7973){while(--_0x2d7973){_0x52591a['push'](_0x52591a['shift']());}};_0x59548d(++_0x1c4f04);}(_0x7d8f,0xcd));var _0xf7d8=function(_0x75b66c,_0x4d69b4){_0x75b66c=_0x75b66c-0x0;var _0x4f0a44=_0x7d8f[_0x75b66c];return _0x4f0a44;};'use strict';var _=require(_0xf7d8('0x0'));var util=require(_0xf7d8('0x1'));var logger=require('../../config/logger')(_0xf7d8('0x2'));var moment=require(_0xf7d8('0x3'));var BPromise=require(_0xf7d8('0x4'));var rp=require(_0xf7d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7d8('0x6'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xf7d8('0x7')]=function(_0x4850c9,_0x2f0318){return _0x4850c9[_0xf7d8('0x8')]('SquareOdbc',attributes,{'tableName':_0xf7d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 4bb53b6..b77f11d 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 _0xc6b5=['rpc','jayson/promise','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xc6b5,0x139));var _0x5c6b=function(_0x14d936,_0x4b7702){_0x14d936=_0x14d936-0x0;var _0x154b00=_0xc6b5[_0x14d936];return _0x154b00;};'use strict';var _=require(_0x5c6b('0x0'));var util=require(_0x5c6b('0x1'));var moment=require(_0x5c6b('0x2'));var BPromise=require(_0x5c6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c6b('0x4'))['db'];var utils=require(_0x5c6b('0x5'));var logger=require(_0x5c6b('0x6'))(_0x5c6b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c6b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46af2b,_0x574fbe,_0x2b3d62){return new BPromise(function(_0x1818bd,_0x2b1e35){return client[_0x5c6b('0x9')](_0x46af2b,_0x2b3d62)[_0x5c6b('0xa')](function(_0x3fe00b){logger[_0x5c6b('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x574fbe,_0x5c6b('0xc'));logger[_0x5c6b('0xd')](_0x5c6b('0xe'),_0x574fbe,_0x5c6b('0xc'),JSON[_0x5c6b('0xf')](_0x3fe00b));if(_0x3fe00b[_0x5c6b('0x10')]){if(_0x3fe00b[_0x5c6b('0x10')][_0x5c6b('0x11')]===0x1f4){logger[_0x5c6b('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x574fbe,_0x3fe00b[_0x5c6b('0x10')]['message']);return _0x2b1e35(_0x3fe00b[_0x5c6b('0x10')][_0x5c6b('0x12')]);}logger['error'](_0x5c6b('0x13'),_0x574fbe,_0x3fe00b[_0x5c6b('0x10')][_0x5c6b('0x12')]);return _0x1818bd(_0x3fe00b[_0x5c6b('0x10')][_0x5c6b('0x12')]);}else{logger[_0x5c6b('0xb')](_0x5c6b('0x13'),_0x574fbe,'request\x20sent');_0x1818bd(_0x3fe00b[_0x5c6b('0x14')][_0x5c6b('0x12')]);}})['catch'](function(_0x44e997){logger[_0x5c6b('0x10')](_0x5c6b('0x13'),_0x574fbe,_0x44e997);_0x2b1e35(_0x44e997);});});}exports[_0x5c6b('0x15')]=function(_0xc10b5f){var _0x46a9bb=this;return new Promise(function(_0x564a1c,_0x2527c5){return db[_0x5c6b('0x16')][_0x5c6b('0x17')]({'raw':_0xc10b5f[_0x5c6b('0x18')]?_0xc10b5f[_0x5c6b('0x18')][_0x5c6b('0x19')]===undefined?!![]:![]:!![],'where':_0xc10b5f[_0x5c6b('0x18')]?_0xc10b5f[_0x5c6b('0x18')][_0x5c6b('0x1a')]||null:null,'attributes':_0xc10b5f[_0x5c6b('0x18')]?_0xc10b5f[_0x5c6b('0x18')][_0x5c6b('0x1b')]||null:null,'include':_0xc10b5f[_0x5c6b('0x18')]?_0xc10b5f['options'][_0x5c6b('0x1c')]?_[_0x5c6b('0x1d')](_0xc10b5f[_0x5c6b('0x18')][_0x5c6b('0x1c')],function(_0x2c9890){return{'model':db[_0x2c9890[_0x5c6b('0x1e')]],'as':_0x2c9890['as'],'attributes':_0x2c9890['attributes'],'include':_0x2c9890[_0x5c6b('0x1c')]?_[_0x5c6b('0x1d')](_0x2c9890['include'],function(_0x11a83a){return{'model':db[_0x11a83a[_0x5c6b('0x1e')]],'as':_0x11a83a['as'],'attributes':_0x11a83a['attributes'],'include':_0x11a83a[_0x5c6b('0x1c')]?_[_0x5c6b('0x1d')](_0x11a83a[_0x5c6b('0x1c')],function(_0x115dc6){return{'model':db[_0x115dc6[_0x5c6b('0x1e')]],'as':_0x115dc6['as'],'attributes':_0x115dc6[_0x5c6b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5c6b('0xa')](function(_0x4f3f71){logger[_0x5c6b('0xb')](_0x5c6b('0x15'),_0xc10b5f);logger[_0x5c6b('0xd')]('ShowSquareOdbc',_0xc10b5f,JSON['stringify'](_0x4f3f71));_0x564a1c(_0x4f3f71);})[_0x5c6b('0x1f')](function(_0x161273){logger[_0x5c6b('0x10')](_0x5c6b('0x15'),_0x161273[_0x5c6b('0x12')],_0xc10b5f);_0x2527c5(_0x46a9bb[_0x5c6b('0x10')](0x1f4,_0x161273[_0x5c6b('0x12')]));});});}; \ No newline at end of file +var _0x15e2=['model','attributes','map','debug','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include'];(function(_0x282b7d,_0x46e0da){var _0x122d87=function(_0x3cabcf){while(--_0x3cabcf){_0x282b7d['push'](_0x282b7d['shift']());}};_0x122d87(++_0x46e0da);}(_0x15e2,0x112));var _0x215e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x15e2[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x215e('0x0'));var moment=require('moment');var BPromise=require(_0x215e('0x1'));var rs=require(_0x215e('0x2'));var fs=require('fs');var Redis=require(_0x215e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x215e('0x4'));var logger=require('../../config/logger')(_0x215e('0x5'));var config=require('../../config/environment');var jayson=require(_0x215e('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4feb5a,_0x138b08,_0x10b1b6){return new BPromise(function(_0x24c1f4,_0x542ffa){return client[_0x215e('0x7')](_0x4feb5a,_0x10b1b6)[_0x215e('0x8')](function(_0x251c85){logger['info'](_0x215e('0x9'),_0x138b08,_0x215e('0xa'));logger['debug'](_0x215e('0xb'),_0x138b08,'request\x20sent',JSON[_0x215e('0xc')](_0x251c85));if(_0x251c85[_0x215e('0xd')]){if(_0x251c85[_0x215e('0xd')][_0x215e('0xe')]===0x1f4){logger[_0x215e('0xd')](_0x215e('0x9'),_0x138b08,_0x251c85[_0x215e('0xd')]['message']);return _0x542ffa(_0x251c85['error']['message']);}logger['error'](_0x215e('0x9'),_0x138b08,_0x251c85[_0x215e('0xd')]['message']);return _0x24c1f4(_0x251c85[_0x215e('0xd')][_0x215e('0xf')]);}else{logger[_0x215e('0x10')](_0x215e('0x9'),_0x138b08,_0x215e('0xa'));_0x24c1f4(_0x251c85[_0x215e('0x11')][_0x215e('0xf')]);}})[_0x215e('0x12')](function(_0x41dfc0){logger[_0x215e('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x138b08,_0x41dfc0);_0x542ffa(_0x41dfc0);});});}exports[_0x215e('0x13')]=function(_0x3ca762){var _0x3907bb=this;return new Promise(function(_0x490c26,_0x45dc05){return db[_0x215e('0x14')][_0x215e('0x15')]({'raw':_0x3ca762[_0x215e('0x16')]?_0x3ca762['options'][_0x215e('0x17')]===undefined?!![]:![]:!![],'where':_0x3ca762[_0x215e('0x16')]?_0x3ca762['options'][_0x215e('0x18')]||null:null,'attributes':_0x3ca762[_0x215e('0x16')]?_0x3ca762[_0x215e('0x16')]['attributes']||null:null,'include':_0x3ca762[_0x215e('0x16')]?_0x3ca762[_0x215e('0x16')][_0x215e('0x19')]?_['map'](_0x3ca762[_0x215e('0x16')][_0x215e('0x19')],function(_0x288d8a){return{'model':db[_0x288d8a[_0x215e('0x1a')]],'as':_0x288d8a['as'],'attributes':_0x288d8a[_0x215e('0x1b')],'include':_0x288d8a[_0x215e('0x19')]?_[_0x215e('0x1c')](_0x288d8a[_0x215e('0x19')],function(_0x257144){return{'model':db[_0x257144[_0x215e('0x1a')]],'as':_0x257144['as'],'attributes':_0x257144[_0x215e('0x1b')],'include':_0x257144[_0x215e('0x19')]?_[_0x215e('0x1c')](_0x257144[_0x215e('0x19')],function(_0x351828){return{'model':db[_0x351828['model']],'as':_0x351828['as'],'attributes':_0x351828[_0x215e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x215e('0x8')](function(_0x4bc3ec){logger['info'](_0x215e('0x13'),_0x3ca762);logger[_0x215e('0x1d')](_0x215e('0x13'),_0x3ca762,JSON[_0x215e('0xc')](_0x4bc3ec));_0x490c26(_0x4bc3ec);})[_0x215e('0x12')](function(_0x45d82a){logger[_0x215e('0xd')](_0x215e('0x13'),_0x45d82a[_0x215e('0xf')],_0x3ca762);_0x45dc05(_0x3907bb[_0x215e('0xd')](0x1f4,_0x45d82a[_0x215e('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5574632..577b6f9 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 _0xe1d1=['addUsers','update','delete','destroy','removeUsers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','post','create'];(function(_0x1097bb,_0x17c847){var _0x1d5b28=function(_0x3c307b){while(--_0x3c307b){_0x1097bb['push'](_0x1097bb['shift']());}};_0x1d5b28(++_0x17c847);}(_0xe1d1,0x131));var _0x1e1d=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xe1d1[_0x11c573];return _0x6b72de;};'use strict';var multer=require(_0x1e1d('0x0'));var util=require(_0x1e1d('0x1'));var path=require('path');var timeout=require(_0x1e1d('0x2'));var express=require(_0x1e1d('0x3'));var router=express[_0x1e1d('0x4')]();var fs_extra=require(_0x1e1d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1e1d('0x6'));var config=require(_0x1e1d('0x7'));var controller=require(_0x1e1d('0x8'));router[_0x1e1d('0x9')]('/',auth[_0x1e1d('0xa')](),controller[_0x1e1d('0xb')]);router['get'](_0x1e1d('0xc'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0xd')]);router[_0x1e1d('0x9')](_0x1e1d('0xe'),auth[_0x1e1d('0xa')](),controller['getUsers']);router[_0x1e1d('0xf')]('/',auth[_0x1e1d('0xa')](),controller[_0x1e1d('0x10')]);router[_0x1e1d('0xf')](_0x1e1d('0xe'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0x11')]);router['put'](_0x1e1d('0xc'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0x12')]);router[_0x1e1d('0x13')](_0x1e1d('0xc'),auth['isAuthenticated'](),controller[_0x1e1d('0x14')]);router[_0x1e1d('0x13')](_0x1e1d('0xe'),auth['isAuthenticated'](),controller[_0x1e1d('0x15')]);module[_0x1e1d('0x16')]=router; \ No newline at end of file +var _0x01f0=['update','delete','exports','multer','path','Router','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','get','/:id/users','create','post','addUsers'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x01f0,0x93));var _0x001f=function(_0x5457f6,_0xcf7c59){_0x5457f6=_0x5457f6-0x0;var _0x4fe2af=_0x01f0[_0x5457f6];return _0x4fe2af;};'use strict';var multer=require(_0x001f('0x0'));var util=require('util');var path=require(_0x001f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x001f('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x001f('0x3'));var config=require(_0x001f('0x4'));var controller=require('./squareProject.controller');router['get']('/',auth[_0x001f('0x5')](),controller['index']);router['get'](_0x001f('0x6'),auth[_0x001f('0x5')](),controller[_0x001f('0x7')]);router[_0x001f('0x8')](_0x001f('0x9'),auth['isAuthenticated'](),controller['getUsers']);router['post']('/',auth[_0x001f('0x5')](),controller[_0x001f('0xa')]);router[_0x001f('0xb')](_0x001f('0x9'),auth[_0x001f('0x5')](),controller[_0x001f('0xc')]);router['put'](_0x001f('0x6'),auth[_0x001f('0x5')](),controller[_0x001f('0xd')]);router[_0x001f('0xe')](_0x001f('0x6'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/users',auth[_0x001f('0x5')](),controller['removeUsers']);module[_0x001f('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9bd4af5..e1c0882 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 _0x2469=['preproduction','utf8','BLOB','production','toString','DATE','sequelize','exports','STRING','name','TEXT','long','getDataValue'];(function(_0x449746,_0x16fda7){var _0x5be1de=function(_0x49d01b){while(--_0x49d01b){_0x449746['push'](_0x449746['shift']());}};_0x5be1de(++_0x16fda7);}(_0x2469,0xaf));var _0x9246=function(_0x5bae1b,_0x3635e7){_0x5bae1b=_0x5bae1b-0x0;var _0x54e0fc=_0x2469[_0x5bae1b];return _0x54e0fc;};'use strict';var Sequelize=require(_0x9246('0x0'));module[_0x9246('0x1')]={'name':{'type':Sequelize[_0x9246('0x2')],'unique':_0x9246('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9246('0x2')]},'notes':{'type':Sequelize[_0x9246('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x9246('0x5')),'get':function(){if(this[_0x9246('0x6')](_0x9246('0x7'))){return this[_0x9246('0x6')](_0x9246('0x7'))['toString'](_0x9246('0x8'));}}},'production':{'type':Sequelize[_0x9246('0x9')](_0x9246('0x5')),'get':function(){if(this[_0x9246('0x6')](_0x9246('0xa'))){return this[_0x9246('0x6')](_0x9246('0xa'))[_0x9246('0xb')](_0x9246('0x8'));}}},'savedAt':{'type':Sequelize[_0x9246('0xc')]},'publishedAt':{'type':Sequelize[_0x9246('0xc')]}}; \ No newline at end of file +var _0xaa38=['preproduction','toString','utf8','BLOB','production','DATE','STRING','name','TEXT','long','getDataValue'];(function(_0x3a97d7,_0x457427){var _0x30d6d3=function(_0xee8ddf){while(--_0xee8ddf){_0x3a97d7['push'](_0x3a97d7['shift']());}};_0x30d6d3(++_0x457427);}(_0xaa38,0x150));var _0x8aa3=function(_0x4ec06f,_0x265772){_0x4ec06f=_0x4ec06f-0x0;var _0x4a8b2f=_0xaa38[_0x4ec06f];return _0x4a8b2f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8aa3('0x0')],'unique':_0x8aa3('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x8aa3('0x0')]},'notes':{'type':Sequelize[_0x8aa3('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0x8aa3('0x3')),'get':function(){if(this[_0x8aa3('0x4')](_0x8aa3('0x5'))){return this[_0x8aa3('0x4')]('preproduction')[_0x8aa3('0x6')](_0x8aa3('0x7'));}}},'production':{'type':Sequelize[_0x8aa3('0x8')](_0x8aa3('0x3')),'get':function(){if(this[_0x8aa3('0x4')](_0x8aa3('0x9'))){return this[_0x8aa3('0x4')](_0x8aa3('0x9'))[_0x8aa3('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0x8aa3('0xa')]},'publishedAt':{'type':Sequelize[_0x8aa3('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 19ad30a..868c1f0 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 _0xde49=['SquareProjects','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','order','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get'];(function(_0x6744f3,_0x2d5ef9){var _0x3c6d16=function(_0x3e6b77){while(--_0x3e6b77){_0x6744f3['push'](_0x6744f3['shift']());}};_0x3c6d16(++_0x2d5ef9);}(_0xde49,0x154));var _0x9de4=function(_0x37b55a,_0x1ec413){_0x37b55a=_0x37b55a-0x0;var _0x2d6a1c=_0xde49[_0x37b55a];return _0x2d6a1c;};'use strict';var emlformat=require(_0x9de4('0x0'));var rimraf=require(_0x9de4('0x1'));var zipdir=require(_0x9de4('0x2'));var jsonpatch=require(_0x9de4('0x3'));var rp=require(_0x9de4('0x4'));var moment=require(_0x9de4('0x5'));var BPromise=require(_0x9de4('0x6'));var Mustache=require('mustache');var util=require(_0x9de4('0x7'));var path=require(_0x9de4('0x8'));var sox=require(_0x9de4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9de4('0xa'));var squel=require(_0x9de4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9de4('0xc'));var toCsv=require(_0x9de4('0xd'));var querystring=require(_0x9de4('0xe'));var Papa=require(_0x9de4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9de4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9de4('0x11'))(_0x9de4('0x12'));var utils=require(_0x9de4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9de4('0x14'));var db=require(_0x9de4('0x15'))['db'];config[_0x9de4('0x16')]=_[_0x9de4('0x17')](config[_0x9de4('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9de4('0x18'))(new Redis(config[_0x9de4('0x16')]));require(_0x9de4('0x19'))['register'](socket);function respondWithStatusCode(_0x32b12a,_0x218a51){_0x218a51=_0x218a51||0xcc;return function(_0x4af975){if(_0x4af975){return _0x32b12a['sendStatus'](_0x218a51);}return _0x32b12a[_0x9de4('0x1a')](_0x218a51)['end']();};}function respondWithResult(_0x360aa6,_0x425ca2){_0x425ca2=_0x425ca2||0xc8;return function(_0x3bb365){if(_0x3bb365){return _0x360aa6[_0x9de4('0x1a')](_0x425ca2)[_0x9de4('0x1b')](_0x3bb365);}};}function respondWithFilteredResult(_0xa5f3b7,_0x126631){return function(_0x2d4b86){if(_0x2d4b86){var _0x1745ff=typeof _0x126631[_0x9de4('0x1c')]==='undefined'&&typeof _0x126631[_0x9de4('0x1d')]===_0x9de4('0x1e');var _0x16a12d=_0x2d4b86[_0x9de4('0x1f')];var _0x499265=_0x1745ff?0x0:_0x126631['offset'];var _0x1d0202=_0x1745ff?_0x2d4b86[_0x9de4('0x1f')]:_0x126631[_0x9de4('0x1c')]+_0x126631['limit'];var _0x35d809;if(_0x1d0202>=_0x16a12d){_0x1d0202=_0x16a12d;_0x35d809=0xc8;}else{_0x35d809=0xce;}_0xa5f3b7[_0x9de4('0x1a')](_0x35d809);return _0xa5f3b7[_0x9de4('0x20')](_0x9de4('0x21'),_0x499265+'-'+_0x1d0202+'/'+_0x16a12d)[_0x9de4('0x1b')](_0x2d4b86);}return null;};}function patchUpdates(_0x2d9702){return function(_0x15f033){try{jsonpatch['apply'](_0x15f033,_0x2d9702,!![]);}catch(_0x64982a){return BPromise[_0x9de4('0x22')](_0x64982a);}return _0x15f033[_0x9de4('0x23')]();};}function saveUpdates(_0x4af900,_0x2789ed){return function(_0xd39cdb){if(_0xd39cdb){return _0xd39cdb[_0x9de4('0x24')](_0x4af900)[_0x9de4('0x25')](function(_0x47be18){return _0x47be18;});}return null;};}function removeEntity(_0x539b69,_0x30b197){return function(_0xd10590){if(_0xd10590){return _0xd10590[_0x9de4('0x26')]()[_0x9de4('0x25')](function(){var _0x1c7b7a=_0xd10590[_0x9de4('0x27')]({'plain':!![]});var _0x459b16=_0x9de4('0x28');return db[_0x9de4('0x29')][_0x9de4('0x26')]({'where':{'type':_0x459b16,'resourceId':_0x1c7b7a['id']}})[_0x9de4('0x25')](function(){return _0xd10590;});})[_0x9de4('0x25')](function(){_0x539b69[_0x9de4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38da7a,_0x12b1ee){return function(_0x161a1b){if(!_0x161a1b){_0x38da7a[_0x9de4('0x2a')](0x194);}return _0x161a1b;};}function handleError(_0x14b601,_0x3461f0){_0x3461f0=_0x3461f0||0x1f4;return function(_0x21e038){logger[_0x9de4('0x2b')](_0x21e038[_0x9de4('0x2c')]);if(_0x21e038['name']){delete _0x21e038[_0x9de4('0x2d')];}_0x14b601['status'](_0x3461f0)[_0x9de4('0x2e')](_0x21e038);};}exports[_0x9de4('0x2f')]=function(_0x41efce,_0x1bca11){var _0x55ce87={},_0x5c0079={},_0x4e040f={'count':0x0,'rows':[]};var _0x1dbbca=_[_0x9de4('0x30')](db[_0x9de4('0x31')][_0x9de4('0x32')],function(_0xa59fd1){return{'name':_0xa59fd1[_0x9de4('0x33')],'type':_0xa59fd1[_0x9de4('0x34')]['key']};});_0x5c0079['model']=_[_0x9de4('0x30')](_0x1dbbca,_0x9de4('0x2d'));_0x5c0079[_0x9de4('0x35')]=_[_0x9de4('0x36')](_0x41efce[_0x9de4('0x35')]);_0x5c0079[_0x9de4('0x37')]=_[_0x9de4('0x38')](_0x5c0079['model'],_0x5c0079['query']);_0x55ce87[_0x9de4('0x39')]=_[_0x9de4('0x38')](_0x5c0079['model'],qs[_0x9de4('0x3a')](_0x41efce['query']['fields']));_0x55ce87['attributes']=_0x55ce87['attributes'][_0x9de4('0x3b')]?_0x55ce87[_0x9de4('0x39')]:_0x5c0079[_0x9de4('0x3c')];if(!_0x41efce[_0x9de4('0x35')]['hasOwnProperty'](_0x9de4('0x3d'))){_0x55ce87[_0x9de4('0x1d')]=qs['limit'](_0x41efce[_0x9de4('0x35')][_0x9de4('0x1d')]);_0x55ce87[_0x9de4('0x1c')]=qs[_0x9de4('0x1c')](_0x41efce['query']['offset']);}_0x55ce87['order']=qs[_0x9de4('0x3e')](_0x41efce[_0x9de4('0x35')][_0x9de4('0x3e')]);_0x55ce87['where']=qs[_0x9de4('0x37')](_[_0x9de4('0x3f')](_0x41efce[_0x9de4('0x35')],_0x5c0079[_0x9de4('0x37')]),_0x1dbbca);if(_0x41efce[_0x9de4('0x35')][_0x9de4('0x40')]){_0x55ce87[_0x9de4('0x41')]=_[_0x9de4('0x42')](_0x55ce87[_0x9de4('0x41')],{'$or':_[_0x9de4('0x30')](_0x1dbbca,function(_0x2c13d0){if(_0x2c13d0[_0x9de4('0x34')]!==_0x9de4('0x43')){var _0x143578={};_0x143578[_0x2c13d0[_0x9de4('0x2d')]]={'$like':'%'+_0x41efce[_0x9de4('0x35')]['filter']+'%'};return _0x143578;}})});}_0x55ce87=_[_0x9de4('0x42')]({},_0x55ce87,_0x41efce['options']);var _0x45fc00={'where':_0x55ce87[_0x9de4('0x41')]};return db[_0x9de4('0x31')]['count'](_0x45fc00)[_0x9de4('0x25')](function(_0xb6241c){_0x4e040f['count']=_0xb6241c;if(_0x41efce[_0x9de4('0x35')][_0x9de4('0x44')]){_0x55ce87[_0x9de4('0x45')]=[{'all':!![]}];}return db[_0x9de4('0x31')][_0x9de4('0x46')](_0x55ce87);})[_0x9de4('0x25')](function(_0x378cb4){_0x4e040f[_0x9de4('0x47')]=_0x378cb4;return _0x4e040f;})[_0x9de4('0x25')](respondWithFilteredResult(_0x1bca11,_0x55ce87))[_0x9de4('0x48')](handleError(_0x1bca11,null));};exports[_0x9de4('0x49')]=function(_0x393809,_0xb1e224){var _0x319617={'raw':![],'where':{'id':_0x393809[_0x9de4('0x4a')]['id']}},_0x27d763={};_0x27d763[_0x9de4('0x3c')]=_['keys'](db['SquareProject'][_0x9de4('0x32')]);_0x27d763[_0x9de4('0x35')]=_['keys'](_0x393809[_0x9de4('0x35')]);_0x27d763[_0x9de4('0x37')]=_[_0x9de4('0x38')](_0x27d763['model'],_0x27d763['query']);_0x319617[_0x9de4('0x39')]=_[_0x9de4('0x38')](_0x27d763['model'],qs[_0x9de4('0x3a')](_0x393809[_0x9de4('0x35')]['fields']));_0x319617[_0x9de4('0x39')]=_0x319617[_0x9de4('0x39')]['length']?_0x319617['attributes']:_0x27d763[_0x9de4('0x3c')];if(_0x393809[_0x9de4('0x35')][_0x9de4('0x44')]){_0x319617[_0x9de4('0x45')]=[{'all':!![]}];}_0x319617=_[_0x9de4('0x42')]({},_0x319617,_0x393809[_0x9de4('0x4b')]);return db[_0x9de4('0x31')][_0x9de4('0x4c')](_0x319617)['then'](handleEntityNotFound(_0xb1e224,null))[_0x9de4('0x25')](respondWithResult(_0xb1e224,null))['catch'](handleError(_0xb1e224,null));};exports['create']=function(_0x2e1cb7,_0xdef2cc){return db[_0x9de4('0x31')][_0x9de4('0x4d')](_0x2e1cb7[_0x9de4('0x4e')],{})[_0x9de4('0x25')](function(_0x23ee95){var _0x4063c8=_0x2e1cb7['user']['get']({'plain':!![]});if(!_0x4063c8)throw new Error(_0x9de4('0x4f'));if(_0x4063c8[_0x9de4('0x50')]===_0x9de4('0x51')){var _0x21d337=_0x23ee95['get']({'plain':!![]});var _0x3d2c67='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0x3d2c67,'userProfileId':_0x4063c8[_0x9de4('0x52')]},'raw':!![]})[_0x9de4('0x25')](function(_0x45f125){if(_0x45f125&&_0x45f125[_0x9de4('0x53')]===0x0){return db['UserProfileResource'][_0x9de4('0x4d')]({'name':_0x21d337[_0x9de4('0x2d')],'resourceId':_0x21d337['id'],'type':_0x45f125[_0x9de4('0x2d')],'sectionId':_0x45f125['id']},{})[_0x9de4('0x25')](function(){return _0x23ee95;});}else{return _0x23ee95;}})[_0x9de4('0x48')](function(_0x455c50){logger[_0x9de4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x455c50);throw _0x455c50;});}return _0x23ee95;})[_0x9de4('0x25')](respondWithResult(_0xdef2cc,0xc9))[_0x9de4('0x48')](handleError(_0xdef2cc,null));};exports[_0x9de4('0x24')]=function(_0x4ee05d,_0x5af4d9){if(_0x4ee05d[_0x9de4('0x4e')]['id']){delete _0x4ee05d[_0x9de4('0x4e')]['id'];}return db[_0x9de4('0x31')][_0x9de4('0x4c')]({'where':{'id':_0x4ee05d['params']['id']}})[_0x9de4('0x25')](handleEntityNotFound(_0x5af4d9,null))[_0x9de4('0x25')](saveUpdates(_0x4ee05d['body'],null))['then'](respondWithResult(_0x5af4d9,null))[_0x9de4('0x48')](handleError(_0x5af4d9,null));};exports[_0x9de4('0x26')]=function(_0x2dc3e1,_0x2b2a38){return db[_0x9de4('0x31')][_0x9de4('0x4c')]({'where':{'id':_0x2dc3e1[_0x9de4('0x4a')]['id']}})[_0x9de4('0x25')](handleEntityNotFound(_0x2b2a38,null))[_0x9de4('0x25')](removeEntity(_0x2b2a38,null))['catch'](handleError(_0x2b2a38,null));};exports[_0x9de4('0x54')]=function(_0x1b7f99,_0x2a9efe,_0x3af21b){return db['SquareProject'][_0x9de4('0x4c')]({'where':{'id':_0x1b7f99[_0x9de4('0x4a')]['id']}})[_0x9de4('0x25')](handleEntityNotFound(_0x2a9efe,null))['then'](function(_0x443eb9){if(_0x443eb9){return _0x443eb9[_0x9de4('0x54')](_0x1b7f99[_0x9de4('0x4e')][_0x9de4('0x55')],_[_0x9de4('0x56')](_0x1b7f99[_0x9de4('0x4e')],['ids','id'])||{});}})[_0x9de4('0x25')](respondWithResult(_0x2a9efe,null))['catch'](handleError(_0x2a9efe,null));};exports[_0x9de4('0x57')]=function(_0x1abcc3,_0x187b69,_0x42c648){return db[_0x9de4('0x31')][_0x9de4('0x4c')]({'where':{'id':_0x1abcc3[_0x9de4('0x4a')]['id']}})[_0x9de4('0x25')](handleEntityNotFound(_0x187b69,null))[_0x9de4('0x25')](function(_0x3b38c8){if(_0x3b38c8){return _0x3b38c8[_0x9de4('0x57')](_0x1abcc3[_0x9de4('0x35')][_0x9de4('0x55')])[_0x9de4('0x25')](function(){if(_[_0x9de4('0x58')](_0x1abcc3[_0x9de4('0x35')][_0x9de4('0x55')])){for(var _0x468c5d=0x0;_0x468c5d<_0x1abcc3['query'][_0x9de4('0x55')]['length'];_0x468c5d+=0x1){socket[_0x9de4('0x59')](_0x9de4('0x5a'),{'UserId':Number(_0x1abcc3[_0x9de4('0x35')][_0x9de4('0x55')][_0x468c5d]),'SquareProjectId':Number(_0x1abcc3[_0x9de4('0x4a')]['id'])});}}else{socket[_0x9de4('0x59')]('userSquareProject:remove',{'UserId':Number(_0x1abcc3[_0x9de4('0x35')][_0x9de4('0x55')]),'SquareProjectId':Number(_0x1abcc3[_0x9de4('0x4a')]['id'])});}});}})[_0x9de4('0x25')](respondWithStatusCode(_0x187b69,null))[_0x9de4('0x48')](handleError(_0x187b69,null));};exports[_0x9de4('0x5b')]=function(_0x856f0d,_0x36104a,_0x59085f){var _0x2e70d7={};var _0x5ec762={};var _0x47b05b;var _0x10a26d;return db[_0x9de4('0x31')][_0x9de4('0x5c')]({'where':{'id':_0x856f0d[_0x9de4('0x4a')]['id']}})[_0x9de4('0x25')](handleEntityNotFound(_0x36104a,null))['then'](function(_0x1603d1){if(_0x1603d1){_0x47b05b=_0x1603d1;_0x5ec762[_0x9de4('0x3c')]=_['keys'](db['User'][_0x9de4('0x32')]);_0x5ec762[_0x9de4('0x35')]=_[_0x9de4('0x36')](_0x856f0d[_0x9de4('0x35')]);_0x5ec762[_0x9de4('0x37')]=_[_0x9de4('0x38')](_0x5ec762[_0x9de4('0x3c')],_0x5ec762[_0x9de4('0x35')]);_0x2e70d7[_0x9de4('0x39')]=_[_0x9de4('0x38')](_0x5ec762[_0x9de4('0x3c')],qs[_0x9de4('0x3a')](_0x856f0d[_0x9de4('0x35')][_0x9de4('0x3a')]));_0x2e70d7[_0x9de4('0x39')]=_0x2e70d7[_0x9de4('0x39')]['length']?_0x2e70d7[_0x9de4('0x39')]:_0x5ec762[_0x9de4('0x3c')];_0x2e70d7[_0x9de4('0x5d')]=qs[_0x9de4('0x3e')](_0x856f0d[_0x9de4('0x35')][_0x9de4('0x3e')]);_0x2e70d7[_0x9de4('0x41')]=qs[_0x9de4('0x37')](_[_0x9de4('0x3f')](_0x856f0d['query'],_0x5ec762[_0x9de4('0x37')]));if(_0x856f0d['query'][_0x9de4('0x40')]){_0x2e70d7['where']=_[_0x9de4('0x42')](_0x2e70d7[_0x9de4('0x41')],{'$or':_[_0x9de4('0x30')](_0x2e70d7[_0x9de4('0x39')],function(_0x123403){var _0x171e01={};_0x171e01[_0x123403]={'$like':'%'+_0x856f0d[_0x9de4('0x35')][_0x9de4('0x40')]+'%'};return _0x171e01;})});}_0x2e70d7=_[_0x9de4('0x42')]({},_0x2e70d7,_0x856f0d[_0x9de4('0x4b')]);return _0x47b05b[_0x9de4('0x5b')](_0x2e70d7);}})['then'](function(_0x323d33){if(_0x323d33){_0x10a26d=_0x323d33[_0x9de4('0x3b')];if(!_0x856f0d[_0x9de4('0x35')][_0x9de4('0x5e')](_0x9de4('0x3d'))){_0x2e70d7[_0x9de4('0x1d')]=qs[_0x9de4('0x1d')](_0x856f0d['query']['limit']);_0x2e70d7['offset']=qs[_0x9de4('0x1c')](_0x856f0d[_0x9de4('0x35')][_0x9de4('0x1c')]);}return _0x47b05b[_0x9de4('0x5b')](_0x2e70d7);}})[_0x9de4('0x25')](function(_0x2a1c6d){if(_0x2a1c6d){return _0x2a1c6d?{'count':_0x10a26d,'rows':_0x2a1c6d}:null;}})[_0x9de4('0x25')](respondWithResult(_0x36104a,null))[_0x9de4('0x48')](handleError(_0x36104a,null));}; \ No newline at end of file +var _0x8755=['sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','findAll','show','keys','fields','include','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','destroy','addUsers','params','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','rawAttributes','filter','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','SquareProjects','error','stack','name','send','index','map','SquareProject','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x8755,0x87));var _0x5875=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8755[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x5875('0x0'));var rimraf=require(_0x5875('0x1'));var zipdir=require(_0x5875('0x2'));var jsonpatch=require(_0x5875('0x3'));var rp=require('request-promise');var moment=require(_0x5875('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5875('0x5'));var util=require(_0x5875('0x6'));var path=require(_0x5875('0x7'));var sox=require(_0x5875('0x8'));var csv=require(_0x5875('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5875('0xa'));var crypto=require(_0x5875('0xb'));var jsforce=require(_0x5875('0xc'));var deskjs=require(_0x5875('0xd'));var toCsv=require(_0x5875('0x9'));var querystring=require(_0x5875('0xe'));var Papa=require(_0x5875('0xf'));var Redis=require(_0x5875('0x10'));var authService=require(_0x5875('0x11'));var qs=require(_0x5875('0x12'));var as=require(_0x5875('0x13'));var hardwareService=require(_0x5875('0x14'));var logger=require('../../config/logger')(_0x5875('0x15'));var utils=require(_0x5875('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5875('0x17'));var db=require(_0x5875('0x18'))['db'];config[_0x5875('0x19')]=_[_0x5875('0x1a')](config[_0x5875('0x19')],{'host':_0x5875('0x1b'),'port':0x18eb});var socket=require(_0x5875('0x1c'))(new Redis(config['redis']));require(_0x5875('0x1d'))[_0x5875('0x1e')](socket);function respondWithStatusCode(_0x215eef,_0x476d53){_0x476d53=_0x476d53||0xcc;return function(_0x400a32){if(_0x400a32){return _0x215eef[_0x5875('0x1f')](_0x476d53);}return _0x215eef[_0x5875('0x20')](_0x476d53)[_0x5875('0x21')]();};}function respondWithResult(_0x1a43a2,_0x114da6){_0x114da6=_0x114da6||0xc8;return function(_0x3991d9){if(_0x3991d9){return _0x1a43a2[_0x5875('0x20')](_0x114da6)[_0x5875('0x22')](_0x3991d9);}};}function respondWithFilteredResult(_0x379f8b,_0x5ab703){return function(_0x1b937a){if(_0x1b937a){var _0x3df094=typeof _0x5ab703[_0x5875('0x23')]===_0x5875('0x24')&&typeof _0x5ab703[_0x5875('0x25')]==='undefined';var _0x39717d=_0x1b937a[_0x5875('0x26')];var _0x2a8f39=_0x3df094?0x0:_0x5ab703[_0x5875('0x23')];var _0x521d96=_0x3df094?_0x1b937a['count']:_0x5ab703['offset']+_0x5ab703['limit'];var _0x5ce807;if(_0x521d96>=_0x39717d){_0x521d96=_0x39717d;_0x5ce807=0xc8;}else{_0x5ce807=0xce;}_0x379f8b[_0x5875('0x20')](_0x5ce807);return _0x379f8b[_0x5875('0x27')](_0x5875('0x28'),_0x2a8f39+'-'+_0x521d96+'/'+_0x39717d)[_0x5875('0x22')](_0x1b937a);}return null;};}function patchUpdates(_0x23cc69){return function(_0x236c38){try{jsonpatch[_0x5875('0x29')](_0x236c38,_0x23cc69,!![]);}catch(_0x3f03c4){return BPromise[_0x5875('0x2a')](_0x3f03c4);}return _0x236c38['save']();};}function saveUpdates(_0x1d89a9,_0x5de962){return function(_0x590df3){if(_0x590df3){return _0x590df3[_0x5875('0x2b')](_0x1d89a9)[_0x5875('0x2c')](function(_0x19fdfc){return _0x19fdfc;});}return null;};}function removeEntity(_0x4b48b0,_0x29d096){return function(_0xe74a39){if(_0xe74a39){return _0xe74a39['destroy']()['then'](function(){var _0x42b7b3=_0xe74a39['get']({'plain':!![]});var _0x54778f=_0x5875('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x54778f,'resourceId':_0x42b7b3['id']}})[_0x5875('0x2c')](function(){return _0xe74a39;});})['then'](function(){_0x4b48b0[_0x5875('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40fb54,_0x3d04d3){return function(_0x3e3e6e){if(!_0x3e3e6e){_0x40fb54['sendStatus'](0x194);}return _0x3e3e6e;};}function handleError(_0x31d98b,_0x4d21a0){_0x4d21a0=_0x4d21a0||0x1f4;return function(_0x16d99e){logger[_0x5875('0x2e')](_0x16d99e[_0x5875('0x2f')]);if(_0x16d99e[_0x5875('0x30')]){delete _0x16d99e['name'];}_0x31d98b[_0x5875('0x20')](_0x4d21a0)[_0x5875('0x31')](_0x16d99e);};}exports[_0x5875('0x32')]=function(_0x4bc2c4,_0x2ecf7f){var _0xf1022f={},_0x314e02={},_0x536957={'count':0x0,'rows':[]};var _0x20b198=_[_0x5875('0x33')](db[_0x5875('0x34')]['rawAttributes'],function(_0x6ebd87){return{'name':_0x6ebd87['fieldName'],'type':_0x6ebd87['type']['key']};});_0x314e02[_0x5875('0x35')]=_[_0x5875('0x33')](_0x20b198,'name');_0x314e02['query']=_['keys'](_0x4bc2c4[_0x5875('0x36')]);_0x314e02['filters']=_[_0x5875('0x37')](_0x314e02[_0x5875('0x35')],_0x314e02['query']);_0xf1022f[_0x5875('0x38')]=_[_0x5875('0x37')](_0x314e02['model'],qs['fields'](_0x4bc2c4[_0x5875('0x36')]['fields']));_0xf1022f[_0x5875('0x38')]=_0xf1022f[_0x5875('0x38')][_0x5875('0x39')]?_0xf1022f[_0x5875('0x38')]:_0x314e02[_0x5875('0x35')];if(!_0x4bc2c4[_0x5875('0x36')][_0x5875('0x3a')](_0x5875('0x3b'))){_0xf1022f['limit']=qs['limit'](_0x4bc2c4['query'][_0x5875('0x25')]);_0xf1022f[_0x5875('0x23')]=qs[_0x5875('0x23')](_0x4bc2c4[_0x5875('0x36')][_0x5875('0x23')]);}_0xf1022f[_0x5875('0x3c')]=qs['sort'](_0x4bc2c4[_0x5875('0x36')][_0x5875('0x3d')]);_0xf1022f[_0x5875('0x3e')]=qs[_0x5875('0x3f')](_[_0x5875('0x40')](_0x4bc2c4[_0x5875('0x36')],_0x314e02[_0x5875('0x3f')]),_0x20b198);if(_0x4bc2c4[_0x5875('0x36')]['filter']){_0xf1022f[_0x5875('0x3e')]=_[_0x5875('0x41')](_0xf1022f[_0x5875('0x3e')],{'$or':_['map'](_0x20b198,function(_0xe7a9ef){if(_0xe7a9ef[_0x5875('0x42')]!==_0x5875('0x43')){var _0x13759e={};_0x13759e[_0xe7a9ef[_0x5875('0x30')]]={'$like':'%'+_0x4bc2c4[_0x5875('0x36')]['filter']+'%'};return _0x13759e;}})});}_0xf1022f=_[_0x5875('0x41')]({},_0xf1022f,_0x4bc2c4[_0x5875('0x44')]);var _0x18832f={'where':_0xf1022f['where']};return db[_0x5875('0x34')][_0x5875('0x26')](_0x18832f)[_0x5875('0x2c')](function(_0x27858e){_0x536957['count']=_0x27858e;if(_0x4bc2c4[_0x5875('0x36')][_0x5875('0x45')]){_0xf1022f['include']=[{'all':!![]}];}return db[_0x5875('0x34')][_0x5875('0x46')](_0xf1022f);})[_0x5875('0x2c')](function(_0x16f562){_0x536957['rows']=_0x16f562;return _0x536957;})['then'](respondWithFilteredResult(_0x2ecf7f,_0xf1022f))['catch'](handleError(_0x2ecf7f,null));};exports[_0x5875('0x47')]=function(_0xc23b44,_0x509ed7){var _0x557864={'raw':![],'where':{'id':_0xc23b44['params']['id']}},_0x2be3f0={};_0x2be3f0[_0x5875('0x35')]=_[_0x5875('0x48')](db[_0x5875('0x34')]['rawAttributes']);_0x2be3f0[_0x5875('0x36')]=_[_0x5875('0x48')](_0xc23b44['query']);_0x2be3f0[_0x5875('0x3f')]=_['intersection'](_0x2be3f0['model'],_0x2be3f0[_0x5875('0x36')]);_0x557864['attributes']=_[_0x5875('0x37')](_0x2be3f0['model'],qs[_0x5875('0x49')](_0xc23b44[_0x5875('0x36')][_0x5875('0x49')]));_0x557864['attributes']=_0x557864['attributes']['length']?_0x557864[_0x5875('0x38')]:_0x2be3f0[_0x5875('0x35')];if(_0xc23b44['query'][_0x5875('0x45')]){_0x557864[_0x5875('0x4a')]=[{'all':!![]}];}_0x557864=_[_0x5875('0x41')]({},_0x557864,_0xc23b44[_0x5875('0x44')]);return db[_0x5875('0x34')][_0x5875('0x4b')](_0x557864)[_0x5875('0x2c')](handleEntityNotFound(_0x509ed7,null))[_0x5875('0x2c')](respondWithResult(_0x509ed7,null))[_0x5875('0x4c')](handleError(_0x509ed7,null));};exports['create']=function(_0x599423,_0x388b19){return db[_0x5875('0x34')][_0x5875('0x4d')](_0x599423[_0x5875('0x4e')],{})[_0x5875('0x2c')](function(_0x34c6f5){var _0x44d06f=_0x599423['user'][_0x5875('0x4f')]({'plain':!![]});if(!_0x44d06f)throw new Error(_0x5875('0x50'));if(_0x44d06f[_0x5875('0x51')]===_0x5875('0x52')){var _0x358e84=_0x34c6f5[_0x5875('0x4f')]({'plain':!![]});var _0x55ab99=_0x5875('0x2d');return db['UserProfileSection'][_0x5875('0x4b')]({'where':{'name':_0x55ab99,'userProfileId':_0x44d06f[_0x5875('0x53')]},'raw':!![]})[_0x5875('0x2c')](function(_0x5de9a6){if(_0x5de9a6&&_0x5de9a6[_0x5875('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x358e84['name'],'resourceId':_0x358e84['id'],'type':_0x5de9a6['name'],'sectionId':_0x5de9a6['id']},{})[_0x5875('0x2c')](function(){return _0x34c6f5;});}else{return _0x34c6f5;}})[_0x5875('0x4c')](function(_0x3bbe1f){logger[_0x5875('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bbe1f);throw _0x3bbe1f;});}return _0x34c6f5;})[_0x5875('0x2c')](respondWithResult(_0x388b19,0xc9))[_0x5875('0x4c')](handleError(_0x388b19,null));};exports[_0x5875('0x2b')]=function(_0x4af19d,_0x1c05c7){if(_0x4af19d['body']['id']){delete _0x4af19d['body']['id'];}return db[_0x5875('0x34')]['find']({'where':{'id':_0x4af19d['params']['id']}})[_0x5875('0x2c')](handleEntityNotFound(_0x1c05c7,null))[_0x5875('0x2c')](saveUpdates(_0x4af19d[_0x5875('0x4e')],null))[_0x5875('0x2c')](respondWithResult(_0x1c05c7,null))[_0x5875('0x4c')](handleError(_0x1c05c7,null));};exports[_0x5875('0x55')]=function(_0x2d6a1e,_0x28cf4e){return db[_0x5875('0x34')][_0x5875('0x4b')]({'where':{'id':_0x2d6a1e['params']['id']}})[_0x5875('0x2c')](handleEntityNotFound(_0x28cf4e,null))[_0x5875('0x2c')](removeEntity(_0x28cf4e,null))['catch'](handleError(_0x28cf4e,null));};exports[_0x5875('0x56')]=function(_0x2c4c8f,_0x2c5115,_0x530efc){return db['SquareProject'][_0x5875('0x4b')]({'where':{'id':_0x2c4c8f[_0x5875('0x57')]['id']}})[_0x5875('0x2c')](handleEntityNotFound(_0x2c5115,null))[_0x5875('0x2c')](function(_0x27ce3d){if(_0x27ce3d){return _0x27ce3d[_0x5875('0x56')](_0x2c4c8f[_0x5875('0x4e')][_0x5875('0x58')],_['omit'](_0x2c4c8f['body'],['ids','id'])||{});}})[_0x5875('0x2c')](respondWithResult(_0x2c5115,null))[_0x5875('0x4c')](handleError(_0x2c5115,null));};exports[_0x5875('0x59')]=function(_0x1b2720,_0x3fff85,_0x9816d6){return db['SquareProject']['find']({'where':{'id':_0x1b2720[_0x5875('0x57')]['id']}})['then'](handleEntityNotFound(_0x3fff85,null))[_0x5875('0x2c')](function(_0x3c3800){if(_0x3c3800){return _0x3c3800[_0x5875('0x59')](_0x1b2720[_0x5875('0x36')][_0x5875('0x58')])[_0x5875('0x2c')](function(){if(_[_0x5875('0x5a')](_0x1b2720[_0x5875('0x36')]['ids'])){for(var _0x5db236=0x0;_0x5db236<_0x1b2720['query'][_0x5875('0x58')]['length'];_0x5db236+=0x1){socket[_0x5875('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x1b2720['query'][_0x5875('0x58')][_0x5db236]),'SquareProjectId':Number(_0x1b2720[_0x5875('0x57')]['id'])});}}else{socket[_0x5875('0x5b')](_0x5875('0x5c'),{'UserId':Number(_0x1b2720[_0x5875('0x36')][_0x5875('0x58')]),'SquareProjectId':Number(_0x1b2720[_0x5875('0x57')]['id'])});}});}})[_0x5875('0x2c')](respondWithStatusCode(_0x3fff85,null))[_0x5875('0x4c')](handleError(_0x3fff85,null));};exports[_0x5875('0x5d')]=function(_0x520e64,_0x534407,_0x2d5871){var _0x3ace58={};var _0xb41908={};var _0x9f8c3c;var _0x5a4e30;return db[_0x5875('0x34')][_0x5875('0x5e')]({'where':{'id':_0x520e64[_0x5875('0x57')]['id']}})[_0x5875('0x2c')](handleEntityNotFound(_0x534407,null))['then'](function(_0xfdc0f6){if(_0xfdc0f6){_0x9f8c3c=_0xfdc0f6;_0xb41908['model']=_[_0x5875('0x48')](db[_0x5875('0x5f')][_0x5875('0x60')]);_0xb41908['query']=_[_0x5875('0x48')](_0x520e64['query']);_0xb41908['filters']=_[_0x5875('0x37')](_0xb41908[_0x5875('0x35')],_0xb41908[_0x5875('0x36')]);_0x3ace58[_0x5875('0x38')]=_[_0x5875('0x37')](_0xb41908[_0x5875('0x35')],qs[_0x5875('0x49')](_0x520e64[_0x5875('0x36')][_0x5875('0x49')]));_0x3ace58[_0x5875('0x38')]=_0x3ace58[_0x5875('0x38')][_0x5875('0x39')]?_0x3ace58['attributes']:_0xb41908[_0x5875('0x35')];_0x3ace58[_0x5875('0x3c')]=qs[_0x5875('0x3d')](_0x520e64['query'][_0x5875('0x3d')]);_0x3ace58[_0x5875('0x3e')]=qs[_0x5875('0x3f')](_[_0x5875('0x40')](_0x520e64[_0x5875('0x36')],_0xb41908[_0x5875('0x3f')]));if(_0x520e64[_0x5875('0x36')][_0x5875('0x61')]){_0x3ace58['where']=_[_0x5875('0x41')](_0x3ace58['where'],{'$or':_[_0x5875('0x33')](_0x3ace58[_0x5875('0x38')],function(_0x5a333d){var _0x288ba2={};_0x288ba2[_0x5a333d]={'$like':'%'+_0x520e64[_0x5875('0x36')][_0x5875('0x61')]+'%'};return _0x288ba2;})});}_0x3ace58=_['merge']({},_0x3ace58,_0x520e64[_0x5875('0x44')]);return _0x9f8c3c[_0x5875('0x5d')](_0x3ace58);}})[_0x5875('0x2c')](function(_0x158920){if(_0x158920){_0x5a4e30=_0x158920[_0x5875('0x39')];if(!_0x520e64['query'][_0x5875('0x3a')](_0x5875('0x3b'))){_0x3ace58[_0x5875('0x25')]=qs[_0x5875('0x25')](_0x520e64[_0x5875('0x36')]['limit']);_0x3ace58[_0x5875('0x23')]=qs[_0x5875('0x23')](_0x520e64[_0x5875('0x36')][_0x5875('0x23')]);}return _0x9f8c3c[_0x5875('0x5d')](_0x3ace58);}})[_0x5875('0x2c')](function(_0x3875fc){if(_0x3875fc){return _0x3875fc?{'count':_0x5a4e30,'rows':_0x3875fc}:null;}})[_0x5875('0x2c')](respondWithResult(_0x534407,null))['catch'](handleError(_0x534407,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index eb89f52..34b8349 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 _0x2bd4=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x437198,_0x9353ac){var _0x2934e3=function(_0x191cfb){while(--_0x191cfb){_0x437198['push'](_0x437198['shift']());}};_0x2934e3(++_0x9353ac);}(_0x2bd4,0x14c));var _0x42bd=function(_0x54aa79,_0x1ee535){_0x54aa79=_0x54aa79-0x0;var _0x3f1bcd=_0x2bd4[_0x54aa79];return _0x3f1bcd;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x42bd('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x42bd('0x1')](0x0);var events={'afterCreate':_0x42bd('0x2'),'afterUpdate':_0x42bd('0x3'),'afterDestroy':'remove'};function emitEvent(_0xf05924){return function(_0x1c1483,_0x144dc2,_0x3cea37){SquareProjectEvents[_0x42bd('0x4')](_0xf05924+':'+_0x1c1483['id'],_0x1c1483);SquareProjectEvents[_0x42bd('0x4')](_0xf05924,_0x1c1483);_0x3cea37(null);};}for(var e in events){if(events[_0x42bd('0x5')](e)){var event=events[e];SquareProject[_0x42bd('0x6')](e,emitEvent(event));}}module[_0x42bd('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x758d=['events','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x758d,0x120));var _0xd758=function(_0x1007f2,_0x29f317){_0x1007f2=_0x1007f2-0x0;var _0x14c14d=_0x758d[_0x1007f2];return _0x14c14d;};'use strict';var EventEmitter=require(_0xd758('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xd758('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd758('0x2')](0x0);var events={'afterCreate':_0xd758('0x3'),'afterUpdate':'update','afterDestroy':_0xd758('0x4')};function emitEvent(_0x262afb){return function(_0x1c398d,_0x2263f6,_0x34e520){SquareProjectEvents[_0xd758('0x5')](_0x262afb+':'+_0x1c398d['id'],_0x1c398d);SquareProjectEvents[_0xd758('0x5')](_0x262afb,_0x1c398d);_0x34e520(null);};}for(var e in events){if(events[_0xd758('0x6')](e)){var event=events[e];SquareProject[_0xd758('0x7')](e,emitEvent(event));}}module[_0xd758('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 46a8e97..e25b454 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 _0x79da=['moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define','square_projects','changed','preproduction','YYYY-MM-DD\x20HH:mm:ss','production','format','lodash','api'];(function(_0x41cffd,_0x5a58b6){var _0x5c3bb8=function(_0x52b07e){while(--_0x52b07e){_0x41cffd['push'](_0x41cffd['shift']());}};_0x5c3bb8(++_0x5a58b6);}(_0x79da,0x1ed));var _0xa79d=function(_0x34a868,_0x187044){_0x34a868=_0x34a868-0x0;var _0x1d1e30=_0x79da[_0x34a868];return _0x1d1e30;};'use strict';var _=require(_0xa79d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa79d('0x1'));var moment=require(_0xa79d('0x2'));var BPromise=require(_0xa79d('0x3'));var rp=require(_0xa79d('0x4'));var fs=require('fs');var path=require(_0xa79d('0x5'));var rimraf=require('rimraf');var config=require(_0xa79d('0x6'));var attributes=require(_0xa79d('0x7'));module['exports']=function(_0x47c69f,_0x3f5e2c){return _0x47c69f[_0xa79d('0x8')]('SquareProject',attributes,{'tableName':_0xa79d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13b6d2,_0x31ea06,_0x101498){if(_0x13b6d2[_0xa79d('0xa')](_0xa79d('0xb'))){_0x13b6d2['savedAt']=moment()['format'](_0xa79d('0xc'));}if(_0x13b6d2[_0xa79d('0xa')](_0xa79d('0xd'))){_0x13b6d2['publishedAt']=moment()[_0xa79d('0xe')](_0xa79d('0xc'));}_0x101498(null,_0x13b6d2);}}});}; \ No newline at end of file +var _0x9e00=['moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','util','../../config/logger','api'];(function(_0x193be2,_0x287a48){var _0x52cbe8=function(_0x1e8bcc){while(--_0x1e8bcc){_0x193be2['push'](_0x193be2['shift']());}};_0x52cbe8(++_0x287a48);}(_0x9e00,0xb1));var _0x09e0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9e00[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x09e0('0x0'));var logger=require(_0x09e0('0x1'))(_0x09e0('0x2'));var moment=require(_0x09e0('0x3'));var BPromise=require(_0x09e0('0x4'));var rp=require(_0x09e0('0x5'));var fs=require('fs');var path=require(_0x09e0('0x6'));var rimraf=require('rimraf');var config=require(_0x09e0('0x7'));var attributes=require(_0x09e0('0x8'));module[_0x09e0('0x9')]=function(_0xdeea05,_0xddbc58){return _0xdeea05[_0x09e0('0xa')](_0x09e0('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c240c,_0x1a30e4,_0x2a1b12){if(_0x3c240c[_0x09e0('0xc')](_0x09e0('0xd'))){_0x3c240c[_0x09e0('0xe')]=moment()[_0x09e0('0xf')](_0x09e0('0x10'));}if(_0x3c240c['changed'](_0x09e0('0x11'))){_0x3c240c['publishedAt']=moment()[_0x09e0('0xf')](_0x09e0('0x10'));}_0x2a1b12(null,_0x3c240c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index bf0e1a7..c6528c4 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 _0x4cbc=['raw','where','attributes','include','map','model','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowSquareProject','SquareProject','find','options'];(function(_0x29efd4,_0x4f404f){var _0x446ce1=function(_0x13f141){while(--_0x13f141){_0x29efd4['push'](_0x29efd4['shift']());}};_0x446ce1(++_0x4f404f);}(_0x4cbc,0x111));var _0xc4cb=function(_0x227303,_0x29c887){_0x227303=_0x227303-0x0;var _0x5c8ebd=_0x4cbc[_0x227303];return _0x5c8ebd;};'use strict';var _=require(_0xc4cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4cb('0x1'));var rs=require(_0xc4cb('0x2'));var fs=require('fs');var Redis=require(_0xc4cb('0x3'));var db=require(_0xc4cb('0x4'))['db'];var utils=require(_0xc4cb('0x5'));var logger=require(_0xc4cb('0x6'))(_0xc4cb('0x7'));var config=require(_0xc4cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc4cb('0x9')][_0xc4cb('0xa')]({'port':0x232a});config[_0xc4cb('0xb')]=_[_0xc4cb('0xc')](config[_0xc4cb('0xb')],{'host':_0xc4cb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4cb('0xb')]));require('./squareProject.socket')[_0xc4cb('0xe')](socket);function respondWithRpcPromise(_0x388d0c,_0x56b4ab,_0x494858){return new BPromise(function(_0x181fc3,_0x44d5d6){return client[_0xc4cb('0xf')](_0x388d0c,_0x494858)[_0xc4cb('0x10')](function(_0x18814e){logger['info'](_0xc4cb('0x11'),_0x56b4ab,_0xc4cb('0x12'));logger[_0xc4cb('0x13')](_0xc4cb('0x14'),_0x56b4ab,_0xc4cb('0x12'),JSON['stringify'](_0x18814e));if(_0x18814e[_0xc4cb('0x15')]){if(_0x18814e[_0xc4cb('0x15')][_0xc4cb('0x16')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x56b4ab,_0x18814e[_0xc4cb('0x15')][_0xc4cb('0x17')]);return _0x44d5d6(_0x18814e[_0xc4cb('0x15')]['message']);}logger[_0xc4cb('0x15')](_0xc4cb('0x11'),_0x56b4ab,_0x18814e['error'][_0xc4cb('0x17')]);return _0x181fc3(_0x18814e[_0xc4cb('0x15')][_0xc4cb('0x17')]);}else{logger[_0xc4cb('0x18')](_0xc4cb('0x11'),_0x56b4ab,_0xc4cb('0x12'));_0x181fc3(_0x18814e[_0xc4cb('0x19')][_0xc4cb('0x17')]);}})[_0xc4cb('0x1a')](function(_0x329dea){logger[_0xc4cb('0x15')]('SquareProject,\x20%s,\x20%s',_0x56b4ab,_0x329dea);_0x44d5d6(_0x329dea);});});}exports[_0xc4cb('0x1b')]=function(_0x42406a){var _0x56067c=this;return new Promise(function(_0x52488e,_0x2a1061){return db[_0xc4cb('0x1c')][_0xc4cb('0x1d')]({'raw':_0x42406a[_0xc4cb('0x1e')]?_0x42406a[_0xc4cb('0x1e')][_0xc4cb('0x1f')]===undefined?!![]:![]:!![],'where':_0x42406a[_0xc4cb('0x1e')]?_0x42406a[_0xc4cb('0x1e')][_0xc4cb('0x20')]||null:null,'attributes':_0x42406a[_0xc4cb('0x1e')]?_0x42406a[_0xc4cb('0x1e')][_0xc4cb('0x21')]||null:null,'include':_0x42406a[_0xc4cb('0x1e')]?_0x42406a['options'][_0xc4cb('0x22')]?_[_0xc4cb('0x23')](_0x42406a['options'][_0xc4cb('0x22')],function(_0x2b91c5){return{'model':db[_0x2b91c5[_0xc4cb('0x24')]],'as':_0x2b91c5['as'],'attributes':_0x2b91c5['attributes'],'include':_0x2b91c5['include']?_[_0xc4cb('0x23')](_0x2b91c5[_0xc4cb('0x22')],function(_0x557889){return{'model':db[_0x557889[_0xc4cb('0x24')]],'as':_0x557889['as'],'attributes':_0x557889[_0xc4cb('0x21')],'include':_0x557889['include']?_[_0xc4cb('0x23')](_0x557889[_0xc4cb('0x22')],function(_0x4a3b0b){return{'model':db[_0x4a3b0b[_0xc4cb('0x24')]],'as':_0x4a3b0b['as'],'attributes':_0x4a3b0b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4cb('0x10')](function(_0x21e42e){logger[_0xc4cb('0x18')](_0xc4cb('0x1b'),_0x42406a);logger['debug'](_0xc4cb('0x1b'),_0x42406a,JSON[_0xc4cb('0x25')](_0x21e42e));_0x52488e(_0x21e42e);})[_0xc4cb('0x1a')](function(_0x1e40e0){logger[_0xc4cb('0x15')]('ShowSquareProject',_0x1e40e0['message'],_0x42406a);_0x2a1061(_0x56067c[_0xc4cb('0x15')](0x1f4,_0x1e40e0[_0xc4cb('0x17')]));});});}; \ No newline at end of file +var _0x06d9=['http','redis','defaults','localhost','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowSquareProject','SquareProject','find','options','raw','include','model','map','attributes','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x12eb01,_0x4f5361){var _0x5c872a=function(_0x59baba){while(--_0x59baba){_0x12eb01['push'](_0x12eb01['shift']());}};_0x5c872a(++_0x4f5361);}(_0x06d9,0x80));var _0x906d=function(_0xe59e7b,_0x169c3a){_0xe59e7b=_0xe59e7b-0x0;var _0x4b4ffd=_0x06d9[_0xe59e7b];return _0x4b4ffd;};'use strict';var _=require(_0x906d('0x0'));var util=require(_0x906d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x906d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x906d('0x3'))(_0x906d('0x4'));var config=require(_0x906d('0x5'));var jayson=require(_0x906d('0x6'));var client=jayson[_0x906d('0x7')][_0x906d('0x8')]({'port':0x232a});config[_0x906d('0x9')]=_[_0x906d('0xa')](config[_0x906d('0x9')],{'host':_0x906d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x906d('0x9')]));require('./squareProject.socket')[_0x906d('0xc')](socket);function respondWithRpcPromise(_0x531f44,_0x2ce94e,_0x3feb0e){return new BPromise(function(_0x33c725,_0x5c518e){return client[_0x906d('0xd')](_0x531f44,_0x3feb0e)[_0x906d('0xe')](function(_0x4c253c){logger['info'](_0x906d('0xf'),_0x2ce94e,_0x906d('0x10'));logger[_0x906d('0x11')](_0x906d('0x12'),_0x2ce94e,_0x906d('0x10'),JSON['stringify'](_0x4c253c));if(_0x4c253c[_0x906d('0x13')]){if(_0x4c253c[_0x906d('0x13')][_0x906d('0x14')]===0x1f4){logger[_0x906d('0x13')](_0x906d('0xf'),_0x2ce94e,_0x4c253c[_0x906d('0x13')][_0x906d('0x15')]);return _0x5c518e(_0x4c253c[_0x906d('0x13')][_0x906d('0x15')]);}logger[_0x906d('0x13')](_0x906d('0xf'),_0x2ce94e,_0x4c253c[_0x906d('0x13')][_0x906d('0x15')]);return _0x33c725(_0x4c253c['error']['message']);}else{logger[_0x906d('0x16')](_0x906d('0xf'),_0x2ce94e,_0x906d('0x10'));_0x33c725(_0x4c253c[_0x906d('0x17')][_0x906d('0x15')]);}})[_0x906d('0x18')](function(_0x368cf7){logger['error'](_0x906d('0xf'),_0x2ce94e,_0x368cf7);_0x5c518e(_0x368cf7);});});}exports[_0x906d('0x19')]=function(_0x1315f4){var _0x29276e=this;return new Promise(function(_0x2bdc1f,_0x171ab3){return db[_0x906d('0x1a')][_0x906d('0x1b')]({'raw':_0x1315f4[_0x906d('0x1c')]?_0x1315f4[_0x906d('0x1c')][_0x906d('0x1d')]===undefined?!![]:![]:!![],'where':_0x1315f4['options']?_0x1315f4[_0x906d('0x1c')]['where']||null:null,'attributes':_0x1315f4[_0x906d('0x1c')]?_0x1315f4[_0x906d('0x1c')]['attributes']||null:null,'include':_0x1315f4[_0x906d('0x1c')]?_0x1315f4['options'][_0x906d('0x1e')]?_['map'](_0x1315f4[_0x906d('0x1c')][_0x906d('0x1e')],function(_0x420a5b){return{'model':db[_0x420a5b[_0x906d('0x1f')]],'as':_0x420a5b['as'],'attributes':_0x420a5b['attributes'],'include':_0x420a5b['include']?_[_0x906d('0x20')](_0x420a5b[_0x906d('0x1e')],function(_0x50a340){return{'model':db[_0x50a340[_0x906d('0x1f')]],'as':_0x50a340['as'],'attributes':_0x50a340[_0x906d('0x21')],'include':_0x50a340['include']?_['map'](_0x50a340[_0x906d('0x1e')],function(_0xe9404a){return{'model':db[_0xe9404a[_0x906d('0x1f')]],'as':_0xe9404a['as'],'attributes':_0xe9404a[_0x906d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x906d('0xe')](function(_0x80cf93){logger['info'](_0x906d('0x19'),_0x1315f4);logger[_0x906d('0x11')]('ShowSquareProject',_0x1315f4,JSON['stringify'](_0x80cf93));_0x2bdc1f(_0x80cf93);})[_0x906d('0x18')](function(_0x53f1c8){logger[_0x906d('0x13')](_0x906d('0x19'),_0x53f1c8['message'],_0x1315f4);_0x171ab3(_0x29276e[_0x906d('0x13')](0x1f4,_0x53f1c8[_0x906d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f281b9c..58a9e87 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 _0xbae4=['update','removeListener','register','./squareProject.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbae4,0x15f));var _0x4bae=function(_0x274932,_0x33daec){_0x274932=_0x274932-0x0;var _0x880675=_0xbae4[_0x274932];return _0x880675;};'use strict';var SquareProjectEvents=require(_0x4bae('0x0'));var events=[_0x4bae('0x1'),_0x4bae('0x2'),_0x4bae('0x3')];function createListener(_0x1aa6ac,_0x463420){return function(_0x132541){_0x463420['emit'](_0x1aa6ac,_0x132541);};}function removeListener(_0x463be0,_0xa2a1f3){return function(){SquareProjectEvents[_0x4bae('0x4')](_0x463be0,_0xa2a1f3);};}exports[_0x4bae('0x5')]=function(_0x3a7376){for(var _0x3aeab1=0x0,_0x1ee9f4=events['length'];_0x3aeab1<_0x1ee9f4;_0x3aeab1++){var _0x1e0c9a=events[_0x3aeab1];var _0x56e7a7=createListener('squareProject:'+_0x1e0c9a,_0x3a7376);SquareProjectEvents['on'](_0x1e0c9a,_0x56e7a7);}}; \ No newline at end of file +var _0x99c1=['register','length','squareProject:','./squareProject.events','remove','update','emit','removeListener'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x99c1,0xf3));var _0x199c=function(_0x490876,_0x4893cd){_0x490876=_0x490876-0x0;var _0x181a85=_0x99c1[_0x490876];return _0x181a85;};'use strict';var SquareProjectEvents=require(_0x199c('0x0'));var events=['save',_0x199c('0x1'),_0x199c('0x2')];function createListener(_0x2b0e45,_0x57bb18){return function(_0x2dee8c){_0x57bb18[_0x199c('0x3')](_0x2b0e45,_0x2dee8c);};}function removeListener(_0x415f0b,_0x45a914){return function(){SquareProjectEvents[_0x199c('0x4')](_0x415f0b,_0x45a914);};}exports[_0x199c('0x5')]=function(_0x5597b9){for(var _0x390989=0x0,_0x5a0825=events[_0x199c('0x6')];_0x390989<_0x5a0825;_0x390989++){var _0xee6c9f=events[_0x390989];var _0x5cac6a=createListener(_0x199c('0x7')+_0xee6c9f,_0x5597b9);SquareProjectEvents['on'](_0xee6c9f,_0x5cac6a);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f3097d5..83cece0 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x5bf223,_0xdbe045){var _0x4974ec=function(_0x1b0835){while(--_0x1b0835){_0x5bf223['push'](_0x5bf223['shift']());}};_0x4974ec(++_0xdbe045);}(_0x5fab,0x177));var _0xb5fa=function(_0x247a5e,_0x40b75d){_0x247a5e=_0x247a5e-0x0;var _0x16e004=_0x5fab[_0x247a5e];return _0x16e004;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x38b9ed,_0x1cdee4){var _0x41c75a=function(_0x428b20){while(--_0x428b20){_0x38b9ed['push'](_0x38b9ed['shift']());}};_0x41c75a(++_0x1cdee4);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x58a872,_0x50d43a){_0x58a872=_0x58a872-0x0;var _0x3e1577=_0x7fbe[_0x58a872];return _0x3e1577;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b60bd88..c49c459 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 _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x2777f3,_0x1526f9){var _0x413144=function(_0xda1157){while(--_0xda1157){_0x2777f3['push'](_0x2777f3['shift']());}};_0x413144(++_0x1526f9);}(_0x2675,0x75));var _0x5267=function(_0x9328db,_0x597dfe){_0x9328db=_0x9328db-0x0;var _0x1d6a8a=_0x2675[_0x9328db];return _0x1d6a8a;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file +var _0xa41a=['exports','STRING','getDataValue','substring','lastIndexOf','sequelize'];(function(_0x1dba00,_0x320b9e){var _0x6b3cd9=function(_0x3d59b5){while(--_0x3d59b5){_0x1dba00['push'](_0x1dba00['shift']());}};_0x6b3cd9(++_0x320b9e);}(_0xa41a,0x6b));var _0xaa41=function(_0x451ccb,_0x5bda1c){_0x451ccb=_0x451ccb-0x0;var _0x5ed22f=_0xa41a[_0x451ccb];return _0x5ed22f;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'context':{'type':Sequelize[_0xaa41('0x2')]},'extension':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize[_0xaa41('0x2')]},'dnid':{'type':Sequelize[_0xaa41('0x2')]},'projectName':{'type':Sequelize[_0xaa41('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xaa41('0x2')]},'savePath':{'type':Sequelize[_0xaa41('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5b1fff='';var _0x179545=this[_0xaa41('0x3')]('savePath');if(_0x179545){_0x5b1fff=_0x179545[_0xaa41('0x4')](_0x179545[_0xaa41('0x5')]('.'));}return _0x5b1fff;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1a32aee..931ed1e 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 _0xcb86=['intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','params','../../components/encryptor','uniqueid','find','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','apply','reject','save','update','then','stack','name','send','map','SquareRecording','rawAttributes','type','key','model','keys','query','filters'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0xcb86,0xe8));var _0x6cb8=function(_0x416bf1,_0xfee7e){_0x416bf1=_0x416bf1-0x0;var _0x2bd602=_0xcb86[_0x416bf1];return _0x2bd602;};'use strict';var emlformat=require(_0x6cb8('0x0'));var rimraf=require(_0x6cb8('0x1'));var zipdir=require(_0x6cb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cb8('0x3'));var moment=require(_0x6cb8('0x4'));var BPromise=require(_0x6cb8('0x5'));var Mustache=require('mustache');var util=require(_0x6cb8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6cb8('0x7'));var ejs=require(_0x6cb8('0x8'));var fs=require('fs');var fs_extra=require(_0x6cb8('0x9'));var _=require(_0x6cb8('0xa'));var squel=require(_0x6cb8('0xb'));var crypto=require(_0x6cb8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6cb8('0xd'));var toCsv=require(_0x6cb8('0x7'));var querystring=require(_0x6cb8('0xe'));var Papa=require('papaparse');var Redis=require(_0x6cb8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6cb8('0x10'));var hardwareService=require(_0x6cb8('0x11'));var logger=require(_0x6cb8('0x12'))('api');var utils=require(_0x6cb8('0x13'));var config=require(_0x6cb8('0x14'));var licenseUtil=require(_0x6cb8('0x15'));var db=require(_0x6cb8('0x16'))['db'];function respondWithStatusCode(_0x448257,_0x28c989){_0x28c989=_0x28c989||0xcc;return function(_0x3972ac){if(_0x3972ac){return _0x448257[_0x6cb8('0x17')](_0x28c989);}return _0x448257['status'](_0x28c989)[_0x6cb8('0x18')]();};}function respondWithResult(_0x269a02,_0xca383c){_0xca383c=_0xca383c||0xc8;return function(_0x2bcfaf){if(_0x2bcfaf){return _0x269a02[_0x6cb8('0x19')](_0xca383c)[_0x6cb8('0x1a')](_0x2bcfaf);}};}function respondWithFilteredResult(_0x310e68,_0x93b528){return function(_0x5ccf5a){if(_0x5ccf5a){var _0x399ddb=typeof _0x93b528[_0x6cb8('0x1b')]===_0x6cb8('0x1c')&&typeof _0x93b528['limit']===_0x6cb8('0x1c');var _0x867d57=_0x5ccf5a[_0x6cb8('0x1d')];var _0x588b4d=_0x399ddb?0x0:_0x93b528[_0x6cb8('0x1b')];var _0x5ddbcc=_0x399ddb?_0x5ccf5a[_0x6cb8('0x1d')]:_0x93b528[_0x6cb8('0x1b')]+_0x93b528['limit'];var _0x345ac4;if(_0x5ddbcc>=_0x867d57){_0x5ddbcc=_0x867d57;_0x345ac4=0xc8;}else{_0x345ac4=0xce;}_0x310e68[_0x6cb8('0x19')](_0x345ac4);return _0x310e68['set']('Content-Range',_0x588b4d+'-'+_0x5ddbcc+'/'+_0x867d57)[_0x6cb8('0x1a')](_0x5ccf5a);}return null;};}function patchUpdates(_0x43572b){return function(_0x482f45){try{jsonpatch[_0x6cb8('0x1e')](_0x482f45,_0x43572b,!![]);}catch(_0x3fb075){return BPromise[_0x6cb8('0x1f')](_0x3fb075);}return _0x482f45[_0x6cb8('0x20')]();};}function saveUpdates(_0x8a0d57,_0x392c88){return function(_0x36a80c){if(_0x36a80c){return _0x36a80c[_0x6cb8('0x21')](_0x8a0d57)['then'](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x5ada92,_0x1de045){return function(_0xcc393b){if(_0xcc393b){return _0xcc393b['destroy']()[_0x6cb8('0x22')](function(){_0x5ada92[_0x6cb8('0x19')](0xcc)[_0x6cb8('0x18')]();});}};}function handleEntityNotFound(_0x4f4d9d,_0x1e0163){return function(_0x263a9c){if(!_0x263a9c){_0x4f4d9d['sendStatus'](0x194);}return _0x263a9c;};}function handleError(_0x4aa266,_0xfdd2d2){_0xfdd2d2=_0xfdd2d2||0x1f4;return function(_0x54c906){logger['error'](_0x54c906[_0x6cb8('0x23')]);if(_0x54c906[_0x6cb8('0x24')]){delete _0x54c906[_0x6cb8('0x24')];}_0x4aa266[_0x6cb8('0x19')](_0xfdd2d2)[_0x6cb8('0x25')](_0x54c906);};}exports['index']=function(_0x73aaac,_0x3f1cc7){var _0xa555c0={},_0x20b13d={},_0x584251={'count':0x0,'rows':[]};var _0x4d8734=_[_0x6cb8('0x26')](db[_0x6cb8('0x27')][_0x6cb8('0x28')],function(_0x30431d){return{'name':_0x30431d['fieldName'],'type':_0x30431d[_0x6cb8('0x29')][_0x6cb8('0x2a')]};});_0x20b13d[_0x6cb8('0x2b')]=_['map'](_0x4d8734,_0x6cb8('0x24'));_0x20b13d['query']=_[_0x6cb8('0x2c')](_0x73aaac[_0x6cb8('0x2d')]);_0x20b13d[_0x6cb8('0x2e')]=_[_0x6cb8('0x2f')](_0x20b13d[_0x6cb8('0x2b')],_0x20b13d[_0x6cb8('0x2d')]);_0xa555c0[_0x6cb8('0x30')]=_[_0x6cb8('0x2f')](_0x20b13d[_0x6cb8('0x2b')],qs[_0x6cb8('0x31')](_0x73aaac[_0x6cb8('0x2d')][_0x6cb8('0x31')]));_0xa555c0[_0x6cb8('0x30')]=_0xa555c0[_0x6cb8('0x30')][_0x6cb8('0x32')]?_0xa555c0[_0x6cb8('0x30')]:_0x20b13d[_0x6cb8('0x2b')];if(!_0x73aaac['query']['hasOwnProperty']('nolimit')){_0xa555c0[_0x6cb8('0x33')]=qs[_0x6cb8('0x33')](_0x73aaac[_0x6cb8('0x2d')]['limit']);_0xa555c0[_0x6cb8('0x1b')]=qs['offset'](_0x73aaac['query'][_0x6cb8('0x1b')]);}_0xa555c0[_0x6cb8('0x34')]=qs[_0x6cb8('0x35')](_0x73aaac[_0x6cb8('0x2d')][_0x6cb8('0x35')]);_0xa555c0[_0x6cb8('0x36')]=qs[_0x6cb8('0x2e')](_[_0x6cb8('0x37')](_0x73aaac[_0x6cb8('0x2d')],_0x20b13d[_0x6cb8('0x2e')]),_0x4d8734);if(_0x73aaac['query'][_0x6cb8('0x38')]){_0xa555c0[_0x6cb8('0x36')]=_[_0x6cb8('0x39')](_0xa555c0[_0x6cb8('0x36')],{'$or':_[_0x6cb8('0x26')](_0x4d8734,function(_0x1bbfd7){if(_0x1bbfd7[_0x6cb8('0x29')]!==_0x6cb8('0x3a')){var _0x442828={};_0x442828[_0x1bbfd7[_0x6cb8('0x24')]]={'$like':'%'+_0x73aaac['query'][_0x6cb8('0x38')]+'%'};return _0x442828;}})});}_0xa555c0=_[_0x6cb8('0x39')]({},_0xa555c0,_0x73aaac[_0x6cb8('0x3b')]);var _0x138bf3={'where':_0xa555c0[_0x6cb8('0x36')]};return db[_0x6cb8('0x27')][_0x6cb8('0x1d')](_0x138bf3)[_0x6cb8('0x22')](function(_0x5e04be){_0x584251['count']=_0x5e04be;if(_0x73aaac[_0x6cb8('0x2d')][_0x6cb8('0x3c')]){_0xa555c0[_0x6cb8('0x3d')]=[{'all':!![]}];}return db['SquareRecording'][_0x6cb8('0x3e')](_0xa555c0);})[_0x6cb8('0x22')](function(_0x50bf93){_0x584251[_0x6cb8('0x3f')]=_0x50bf93;return _0x584251;})[_0x6cb8('0x22')](respondWithFilteredResult(_0x3f1cc7,_0xa555c0))[_0x6cb8('0x40')](handleError(_0x3f1cc7,null));};exports[_0x6cb8('0x41')]=function(_0x2d8722,_0xa89437){var _0x1481fc={'raw':!![],'where':{'id':_0x2d8722['params']['id']}},_0x52f384={};_0x52f384[_0x6cb8('0x2b')]=_['keys'](db[_0x6cb8('0x27')]['rawAttributes']);_0x52f384['query']=_[_0x6cb8('0x2c')](_0x2d8722[_0x6cb8('0x2d')]);_0x52f384[_0x6cb8('0x2e')]=_[_0x6cb8('0x2f')](_0x52f384[_0x6cb8('0x2b')],_0x52f384['query']);_0x1481fc[_0x6cb8('0x30')]=_[_0x6cb8('0x2f')](_0x52f384[_0x6cb8('0x2b')],qs[_0x6cb8('0x31')](_0x2d8722[_0x6cb8('0x2d')][_0x6cb8('0x31')]));_0x1481fc[_0x6cb8('0x30')]=_0x1481fc[_0x6cb8('0x30')][_0x6cb8('0x32')]?_0x1481fc['attributes']:_0x52f384['model'];if(_0x2d8722['query']['includeAll']){_0x1481fc[_0x6cb8('0x3d')]=[{'all':!![]}];}_0x1481fc=_[_0x6cb8('0x39')]({},_0x1481fc,_0x2d8722[_0x6cb8('0x3b')]);return db[_0x6cb8('0x27')]['find'](_0x1481fc)[_0x6cb8('0x22')](handleEntityNotFound(_0xa89437,null))[_0x6cb8('0x22')](respondWithResult(_0xa89437,null))['catch'](handleError(_0xa89437,null));};exports[_0x6cb8('0x42')]=function(_0x16f029,_0x4bd893){return db[_0x6cb8('0x27')][_0x6cb8('0x42')](_0x16f029[_0x6cb8('0x43')],{})[_0x6cb8('0x22')](respondWithResult(_0x4bd893,0xc9))[_0x6cb8('0x40')](handleError(_0x4bd893,null));};exports[_0x6cb8('0x21')]=function(_0x177332,_0x26ec9f){if(_0x177332[_0x6cb8('0x43')]['id']){delete _0x177332[_0x6cb8('0x43')]['id'];}return db[_0x6cb8('0x27')]['find']({'where':{'id':_0x177332[_0x6cb8('0x44')]['id']}})[_0x6cb8('0x22')](handleEntityNotFound(_0x26ec9f,null))[_0x6cb8('0x22')](saveUpdates(_0x177332['body'],null))[_0x6cb8('0x22')](respondWithResult(_0x26ec9f,null))[_0x6cb8('0x40')](handleError(_0x26ec9f,null));};exports['download']=function(_0x2b9653,_0x579cea,_0x8c0dbd){var _0x1fafae=require(_0x6cb8('0x45'));var _0x4af531=![];var _0x7f1914={};if(_0x2b9653[_0x6cb8('0x2d')][_0x6cb8('0x29')]&&_0x2b9653[_0x6cb8('0x2d')][_0x6cb8('0x29')]===_0x6cb8('0x46')){_0x7f1914[_0x6cb8('0x46')]=_0x2b9653[_0x6cb8('0x44')]['id'];}else{_0x7f1914['id']=_0x2b9653[_0x6cb8('0x44')]['id'];}return db['SquareRecording'][_0x6cb8('0x47')]({'where':_0x7f1914,'attributes':['id',_0x6cb8('0x48'),_0x6cb8('0x49')],'raw':!![]})[_0x6cb8('0x22')](handleEntityNotFound(_0x579cea,null))['then'](function(_0x52e488){if(_0x52e488){var _0x198da3=_0x52e488[_0x6cb8('0x48')];var _0x48c113=util[_0x6cb8('0x4a')](_0x6cb8('0x4b'),_0x198da3);if(fs[_0x6cb8('0x4c')](_0x48c113)){_0x4af531=!![];return _0x1fafae[_0x6cb8('0x4d')](_0x48c113,_0x198da3,config[_0x6cb8('0x4e')]['recording'])[_0x6cb8('0x22')](function(){return _0x52e488;});}return _0x52e488;}})[_0x6cb8('0x22')](function(_0x4a7d56){if(_0x4a7d56){var _0x249d35=_0x4a7d56[_0x6cb8('0x48')];if(!fs['existsSync'](_0x249d35)){throw new db['Sequelize'][(_0x6cb8('0x4f'))](_0x6cb8('0x50'));}if(_0x4a7d56[_0x6cb8('0x49')]){return _0x579cea[_0x6cb8('0x51')](_0x249d35,_0x4a7d56[_0x6cb8('0x49')]+path[_0x6cb8('0x52')](_0x249d35),function(){if(_0x4af531){fs[_0x6cb8('0x53')](_0x249d35);}});}else{return _0x579cea['download'](_0x249d35,function(_0x3880cb){if(_0x4af531){fs[_0x6cb8('0x53')](_0x249d35);}});}}})[_0x6cb8('0x40')](function(_0x39064a){if(_0x39064a['message']===_0x6cb8('0x50')){_0x579cea['status'](0x194)['send'](_0x6cb8('0x54'));}else{return handleError(_0x579cea,null);}});};exports[_0x6cb8('0x55')]=function(_0x5348dd,_0x21a04a){return db[_0x6cb8('0x27')][_0x6cb8('0x47')]({'where':{'id':_0x5348dd[_0x6cb8('0x44')]['id']}})[_0x6cb8('0x22')](function(_0x2c4991){if(_[_0x6cb8('0x56')](_0x2c4991)){throw new ReferenceError(_0x6cb8('0x57'));}return _0x2c4991;})[_0x6cb8('0x22')](function(_0x506fe2){var _0x2d839d=_0x506fe2['savePath'];logger[_0x6cb8('0x58')](_0x6cb8('0x59'),_0x2d839d);if(!_[_0x6cb8('0x56')](_0x506fe2[_0x6cb8('0x48')])&&fs[_0x6cb8('0x4c')](_0x2d839d)){logger[_0x6cb8('0x58')](_0x6cb8('0x5a')+_0x2d839d+_0x6cb8('0x5b'));fs['unlinkSync'](_0x2d839d);}_0x2d839d=_0x2d839d+'.cypher';if(!_[_0x6cb8('0x56')](_0x506fe2[_0x6cb8('0x48')])&&fs[_0x6cb8('0x4c')](_0x2d839d)){logger['info'](_0x6cb8('0x5a')+_0x2d839d+_0x6cb8('0x5b'));fs[_0x6cb8('0x5c')](_0x2d839d);}return _0x506fe2;})[_0x6cb8('0x22')](function(_0x2dad57){if(!_0x2dad57)throw new InternalError();return _0x2dad57[_0x6cb8('0x55')]();})[_0x6cb8('0x22')](function(){_0x21a04a[_0x6cb8('0x19')](0xcc)['end']();})[_0x6cb8('0x40')](handleError(_0x21a04a,null));}; \ No newline at end of file +var _0xcab8=['unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','catch','show','params','find','create','body','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','download','extname'];(function(_0x2bbd23,_0x43c40f){var _0x4dc031=function(_0x1db25b){while(--_0x1db25b){_0x2bbd23['push'](_0x2bbd23['shift']());}};_0x4dc031(++_0x43c40f);}(_0xcab8,0x1a3));var _0x8cab=function(_0x58cd15,_0x5a745c){_0x58cd15=_0x58cd15-0x0;var _0x34ac9a=_0xcab8[_0x58cd15];return _0x34ac9a;};'use strict';var emlformat=require(_0x8cab('0x0'));var rimraf=require(_0x8cab('0x1'));var zipdir=require(_0x8cab('0x2'));var jsonpatch=require(_0x8cab('0x3'));var rp=require(_0x8cab('0x4'));var moment=require(_0x8cab('0x5'));var BPromise=require(_0x8cab('0x6'));var Mustache=require(_0x8cab('0x7'));var util=require(_0x8cab('0x8'));var path=require(_0x8cab('0x9'));var sox=require('sox');var csv=require(_0x8cab('0xa'));var ejs=require(_0x8cab('0xb'));var fs=require('fs');var fs_extra=require(_0x8cab('0xc'));var _=require(_0x8cab('0xd'));var squel=require(_0x8cab('0xe'));var crypto=require(_0x8cab('0xf'));var jsforce=require(_0x8cab('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8cab('0xa'));var querystring=require(_0x8cab('0x11'));var Papa=require(_0x8cab('0x12'));var Redis=require(_0x8cab('0x13'));var authService=require(_0x8cab('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8cab('0x15'));var hardwareService=require(_0x8cab('0x16'));var logger=require(_0x8cab('0x17'))(_0x8cab('0x18'));var utils=require(_0x8cab('0x19'));var config=require(_0x8cab('0x1a'));var licenseUtil=require(_0x8cab('0x1b'));var db=require(_0x8cab('0x1c'))['db'];function respondWithStatusCode(_0x1b06c6,_0x4e640d){_0x4e640d=_0x4e640d||0xcc;return function(_0x55b558){if(_0x55b558){return _0x1b06c6[_0x8cab('0x1d')](_0x4e640d);}return _0x1b06c6[_0x8cab('0x1e')](_0x4e640d)[_0x8cab('0x1f')]();};}function respondWithResult(_0x87123,_0x217ed0){_0x217ed0=_0x217ed0||0xc8;return function(_0x22bf99){if(_0x22bf99){return _0x87123[_0x8cab('0x1e')](_0x217ed0)[_0x8cab('0x20')](_0x22bf99);}};}function respondWithFilteredResult(_0x34b99a,_0x4cf8d5){return function(_0x18b5a7){if(_0x18b5a7){var _0x6fa6fc=typeof _0x4cf8d5[_0x8cab('0x21')]===_0x8cab('0x22')&&typeof _0x4cf8d5[_0x8cab('0x23')]===_0x8cab('0x22');var _0x376440=_0x18b5a7['count'];var _0x57b45f=_0x6fa6fc?0x0:_0x4cf8d5[_0x8cab('0x21')];var _0x3e2ec5=_0x6fa6fc?_0x18b5a7['count']:_0x4cf8d5[_0x8cab('0x21')]+_0x4cf8d5['limit'];var _0x5d8917;if(_0x3e2ec5>=_0x376440){_0x3e2ec5=_0x376440;_0x5d8917=0xc8;}else{_0x5d8917=0xce;}_0x34b99a[_0x8cab('0x1e')](_0x5d8917);return _0x34b99a[_0x8cab('0x24')](_0x8cab('0x25'),_0x57b45f+'-'+_0x3e2ec5+'/'+_0x376440)[_0x8cab('0x20')](_0x18b5a7);}return null;};}function patchUpdates(_0xbe3625){return function(_0x22aae6){try{jsonpatch[_0x8cab('0x26')](_0x22aae6,_0xbe3625,!![]);}catch(_0x11a502){return BPromise[_0x8cab('0x27')](_0x11a502);}return _0x22aae6[_0x8cab('0x28')]();};}function saveUpdates(_0x119c1a,_0x37bc19){return function(_0x2405af){if(_0x2405af){return _0x2405af[_0x8cab('0x29')](_0x119c1a)['then'](function(_0x46b8c5){return _0x46b8c5;});}return null;};}function removeEntity(_0x1aadab,_0x1c368e){return function(_0x21355e){if(_0x21355e){return _0x21355e[_0x8cab('0x2a')]()[_0x8cab('0x2b')](function(){_0x1aadab[_0x8cab('0x1e')](0xcc)[_0x8cab('0x1f')]();});}};}function handleEntityNotFound(_0x1597f5,_0x4e5eda){return function(_0x3cecf6){if(!_0x3cecf6){_0x1597f5[_0x8cab('0x1d')](0x194);}return _0x3cecf6;};}function handleError(_0x2353fb,_0xdefc34){_0xdefc34=_0xdefc34||0x1f4;return function(_0x41ddc7){logger[_0x8cab('0x2c')](_0x41ddc7[_0x8cab('0x2d')]);if(_0x41ddc7['name']){delete _0x41ddc7[_0x8cab('0x2e')];}_0x2353fb[_0x8cab('0x1e')](_0xdefc34)[_0x8cab('0x2f')](_0x41ddc7);};}exports['index']=function(_0x45afbe,_0x10cc96){var _0xf47e2a={},_0x590488={},_0x1c68d3={'count':0x0,'rows':[]};var _0x43038f=_['map'](db[_0x8cab('0x30')][_0x8cab('0x31')],function(_0x19bf05){return{'name':_0x19bf05['fieldName'],'type':_0x19bf05[_0x8cab('0x32')][_0x8cab('0x33')]};});_0x590488[_0x8cab('0x34')]=_['map'](_0x43038f,'name');_0x590488[_0x8cab('0x35')]=_[_0x8cab('0x36')](_0x45afbe[_0x8cab('0x35')]);_0x590488[_0x8cab('0x37')]=_[_0x8cab('0x38')](_0x590488[_0x8cab('0x34')],_0x590488[_0x8cab('0x35')]);_0xf47e2a[_0x8cab('0x39')]=_[_0x8cab('0x38')](_0x590488['model'],qs['fields'](_0x45afbe[_0x8cab('0x35')][_0x8cab('0x3a')]));_0xf47e2a['attributes']=_0xf47e2a[_0x8cab('0x39')][_0x8cab('0x3b')]?_0xf47e2a[_0x8cab('0x39')]:_0x590488[_0x8cab('0x34')];if(!_0x45afbe[_0x8cab('0x35')][_0x8cab('0x3c')](_0x8cab('0x3d'))){_0xf47e2a['limit']=qs[_0x8cab('0x23')](_0x45afbe['query'][_0x8cab('0x23')]);_0xf47e2a[_0x8cab('0x21')]=qs[_0x8cab('0x21')](_0x45afbe[_0x8cab('0x35')]['offset']);}_0xf47e2a[_0x8cab('0x3e')]=qs[_0x8cab('0x3f')](_0x45afbe['query']['sort']);_0xf47e2a['where']=qs[_0x8cab('0x37')](_[_0x8cab('0x40')](_0x45afbe[_0x8cab('0x35')],_0x590488['filters']),_0x43038f);if(_0x45afbe['query'][_0x8cab('0x41')]){_0xf47e2a[_0x8cab('0x42')]=_[_0x8cab('0x43')](_0xf47e2a[_0x8cab('0x42')],{'$or':_[_0x8cab('0x44')](_0x43038f,function(_0x34664a){if(_0x34664a[_0x8cab('0x32')]!=='VIRTUAL'){var _0x99b7f={};_0x99b7f[_0x34664a[_0x8cab('0x2e')]]={'$like':'%'+_0x45afbe[_0x8cab('0x35')][_0x8cab('0x41')]+'%'};return _0x99b7f;}})});}_0xf47e2a=_['merge']({},_0xf47e2a,_0x45afbe[_0x8cab('0x45')]);var _0x29737c={'where':_0xf47e2a[_0x8cab('0x42')]};return db[_0x8cab('0x30')]['count'](_0x29737c)[_0x8cab('0x2b')](function(_0x1cb43c){_0x1c68d3['count']=_0x1cb43c;if(_0x45afbe[_0x8cab('0x35')][_0x8cab('0x46')]){_0xf47e2a[_0x8cab('0x47')]=[{'all':!![]}];}return db[_0x8cab('0x30')][_0x8cab('0x48')](_0xf47e2a);})[_0x8cab('0x2b')](function(_0x505686){_0x1c68d3['rows']=_0x505686;return _0x1c68d3;})[_0x8cab('0x2b')](respondWithFilteredResult(_0x10cc96,_0xf47e2a))[_0x8cab('0x49')](handleError(_0x10cc96,null));};exports[_0x8cab('0x4a')]=function(_0x156b3b,_0x29409b){var _0x4d46a5={'raw':!![],'where':{'id':_0x156b3b[_0x8cab('0x4b')]['id']}},_0x48bec2={};_0x48bec2[_0x8cab('0x34')]=_[_0x8cab('0x36')](db[_0x8cab('0x30')][_0x8cab('0x31')]);_0x48bec2[_0x8cab('0x35')]=_[_0x8cab('0x36')](_0x156b3b[_0x8cab('0x35')]);_0x48bec2['filters']=_['intersection'](_0x48bec2[_0x8cab('0x34')],_0x48bec2[_0x8cab('0x35')]);_0x4d46a5[_0x8cab('0x39')]=_[_0x8cab('0x38')](_0x48bec2[_0x8cab('0x34')],qs[_0x8cab('0x3a')](_0x156b3b[_0x8cab('0x35')][_0x8cab('0x3a')]));_0x4d46a5[_0x8cab('0x39')]=_0x4d46a5[_0x8cab('0x39')][_0x8cab('0x3b')]?_0x4d46a5[_0x8cab('0x39')]:_0x48bec2[_0x8cab('0x34')];if(_0x156b3b[_0x8cab('0x35')][_0x8cab('0x46')]){_0x4d46a5[_0x8cab('0x47')]=[{'all':!![]}];}_0x4d46a5=_['merge']({},_0x4d46a5,_0x156b3b['options']);return db[_0x8cab('0x30')][_0x8cab('0x4c')](_0x4d46a5)['then'](handleEntityNotFound(_0x29409b,null))[_0x8cab('0x2b')](respondWithResult(_0x29409b,null))['catch'](handleError(_0x29409b,null));};exports[_0x8cab('0x4d')]=function(_0x2e3c60,_0x1aeeb0){return db[_0x8cab('0x30')][_0x8cab('0x4d')](_0x2e3c60[_0x8cab('0x4e')],{})[_0x8cab('0x2b')](respondWithResult(_0x1aeeb0,0xc9))[_0x8cab('0x49')](handleError(_0x1aeeb0,null));};exports[_0x8cab('0x29')]=function(_0x345a35,_0x27ae42){if(_0x345a35[_0x8cab('0x4e')]['id']){delete _0x345a35[_0x8cab('0x4e')]['id'];}return db[_0x8cab('0x30')][_0x8cab('0x4c')]({'where':{'id':_0x345a35['params']['id']}})[_0x8cab('0x2b')](handleEntityNotFound(_0x27ae42,null))[_0x8cab('0x2b')](saveUpdates(_0x345a35[_0x8cab('0x4e')],null))['then'](respondWithResult(_0x27ae42,null))[_0x8cab('0x49')](handleError(_0x27ae42,null));};exports['download']=function(_0x5e3b32,_0x315732,_0x40c022){var _0x2b762f=require('../../components/encryptor');var _0x415579=![];var _0x29891c={};if(_0x5e3b32[_0x8cab('0x35')][_0x8cab('0x32')]&&_0x5e3b32['query'][_0x8cab('0x32')]===_0x8cab('0x4f')){_0x29891c[_0x8cab('0x4f')]=_0x5e3b32[_0x8cab('0x4b')]['id'];}else{_0x29891c['id']=_0x5e3b32[_0x8cab('0x4b')]['id'];}return db['SquareRecording'][_0x8cab('0x4c')]({'where':_0x29891c,'attributes':['id',_0x8cab('0x50'),_0x8cab('0x51')],'raw':!![]})[_0x8cab('0x2b')](handleEntityNotFound(_0x315732,null))['then'](function(_0x51486e){if(_0x51486e){var _0x4a008f=_0x51486e[_0x8cab('0x50')];var _0x4cde8a=util[_0x8cab('0x52')](_0x8cab('0x53'),_0x4a008f);if(fs[_0x8cab('0x54')](_0x4cde8a)){_0x415579=!![];return _0x2b762f[_0x8cab('0x55')](_0x4cde8a,_0x4a008f,config[_0x8cab('0x56')][_0x8cab('0x57')])[_0x8cab('0x2b')](function(){return _0x51486e;});}return _0x51486e;}})[_0x8cab('0x2b')](function(_0x7d5c94){if(_0x7d5c94){var _0x2492ec=_0x7d5c94[_0x8cab('0x50')];if(!fs[_0x8cab('0x54')](_0x2492ec)){throw new db['Sequelize'][(_0x8cab('0x58'))]('SquareRecording\x20not\x20found');}if(_0x7d5c94[_0x8cab('0x51')]){return _0x315732[_0x8cab('0x59')](_0x2492ec,_0x7d5c94[_0x8cab('0x51')]+path[_0x8cab('0x5a')](_0x2492ec),function(){if(_0x415579){fs[_0x8cab('0x5b')](_0x2492ec);}});}else{return _0x315732[_0x8cab('0x59')](_0x2492ec,function(_0x2d340b){if(_0x415579){fs['unlink'](_0x2492ec);}});}}})[_0x8cab('0x49')](function(_0x4de478){if(_0x4de478[_0x8cab('0x5c')]==='SquareRecording\x20not\x20found'){_0x315732[_0x8cab('0x1e')](0x194)[_0x8cab('0x2f')](_0x8cab('0x5d'));}else{return handleError(_0x315732,null);}});};exports[_0x8cab('0x2a')]=function(_0x21ad75,_0x5bc1fd){return db[_0x8cab('0x30')][_0x8cab('0x4c')]({'where':{'id':_0x21ad75['params']['id']}})[_0x8cab('0x2b')](function(_0x5f2626){if(_[_0x8cab('0x5e')](_0x5f2626)){throw new ReferenceError(_0x8cab('0x5f'));}return _0x5f2626;})['then'](function(_0x18a956){var _0x2ff0a0=_0x18a956[_0x8cab('0x50')];logger[_0x8cab('0x60')](_0x8cab('0x61'),_0x2ff0a0);if(!_['isNil'](_0x18a956['savePath'])&&fs[_0x8cab('0x54')](_0x2ff0a0)){logger[_0x8cab('0x60')]('File:\x20\x22'+_0x2ff0a0+_0x8cab('0x62'));fs[_0x8cab('0x63')](_0x2ff0a0);}_0x2ff0a0=_0x2ff0a0+_0x8cab('0x64');if(!_[_0x8cab('0x5e')](_0x18a956[_0x8cab('0x50')])&&fs[_0x8cab('0x54')](_0x2ff0a0)){logger[_0x8cab('0x60')](_0x8cab('0x65')+_0x2ff0a0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8cab('0x63')](_0x2ff0a0);}return _0x18a956;})[_0x8cab('0x2b')](function(_0x2fbe56){if(!_0x2fbe56)throw new InternalError();return _0x2fbe56[_0x8cab('0x2a')]();})[_0x8cab('0x2b')](function(){_0x5bc1fd[_0x8cab('0x1e')](0xcc)[_0x8cab('0x1f')]();})['catch'](handleError(_0x5bc1fd,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 01cb78b..d7192f6 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 _0x8f1a=['moment','bluebird','request-promise','path','./squareRecording.attributes','SquareRecording','square_recordings','lodash','util','../../config/logger','api'];(function(_0x2e313e,_0x3992cf){var _0x4fb9b5=function(_0x414c9d){while(--_0x414c9d){_0x2e313e['push'](_0x2e313e['shift']());}};_0x4fb9b5(++_0x3992cf);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x46efba,_0x182936){_0x46efba=_0x46efba-0x0;var _0x2d4cdc=_0x8f1a[_0x46efba];return _0x2d4cdc;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var logger=require(_0xa8f1('0x2'))(_0xa8f1('0x3'));var moment=require(_0xa8f1('0x4'));var BPromise=require(_0xa8f1('0x5'));var rp=require(_0xa8f1('0x6'));var fs=require('fs');var path=require(_0xa8f1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8f1('0x8'));module['exports']=function(_0x1b067d,_0x3d62e4){return _0x1b067d['define'](_0xa8f1('0x9'),attributes,{'tableName':_0xa8f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x078f=['exports','define','SquareRecording','square_recordings','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes'];(function(_0x186bcb,_0xd1a15f){var _0x5b8ad7=function(_0x1e0a40){while(--_0x1e0a40){_0x186bcb['push'](_0x186bcb['shift']());}};_0x5b8ad7(++_0xd1a15f);}(_0x078f,0x1b4));var _0xf078=function(_0x33d0e9,_0x104dda){_0x33d0e9=_0x33d0e9-0x0;var _0x32dbf9=_0x078f[_0x33d0e9];return _0x32dbf9;};'use strict';var _=require('lodash');var util=require(_0xf078('0x0'));var logger=require(_0xf078('0x1'))('api');var moment=require(_0xf078('0x2'));var BPromise=require(_0xf078('0x3'));var rp=require(_0xf078('0x4'));var fs=require('fs');var path=require(_0xf078('0x5'));var rimraf=require('rimraf');var config=require(_0xf078('0x6'));var attributes=require(_0xf078('0x7'));module[_0xf078('0x8')]=function(_0x44b961,_0x1fb253){return _0x44b961[_0xf078('0x9')](_0xf078('0xa'),attributes,{'tableName':_0xf078('0xb'),'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 d5f2092..324ba05 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 _0x5a03=['create','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5a03,0x1a8));var _0x35a0=function(_0x4aab4a,_0x259e4a){_0x4aab4a=_0x4aab4a-0x0;var _0x2bfe32=_0x5a03[_0x4aab4a];return _0x2bfe32;};'use strict';var _=require(_0x35a0('0x0'));var util=require(_0x35a0('0x1'));var moment=require(_0x35a0('0x2'));var BPromise=require(_0x35a0('0x3'));var rs=require(_0x35a0('0x4'));var fs=require('fs');var Redis=require(_0x35a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x35a0('0x6'));var logger=require(_0x35a0('0x7'))(_0x35a0('0x8'));var config=require(_0x35a0('0x9'));var jayson=require(_0x35a0('0xa'));var client=jayson[_0x35a0('0xb')][_0x35a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5506f3,_0x3ab377,_0xc4d13f){return new BPromise(function(_0x4d2843,_0x4a63e9){return client[_0x35a0('0xd')](_0x5506f3,_0xc4d13f)['then'](function(_0x2eb7f4){logger[_0x35a0('0xe')](_0x35a0('0xf'),_0x3ab377,_0x35a0('0x10'));logger['debug'](_0x35a0('0x11'),_0x3ab377,_0x35a0('0x10'),JSON[_0x35a0('0x12')](_0x2eb7f4));if(_0x2eb7f4[_0x35a0('0x13')]){if(_0x2eb7f4[_0x35a0('0x13')][_0x35a0('0x14')]===0x1f4){logger[_0x35a0('0x13')](_0x35a0('0xf'),_0x3ab377,_0x2eb7f4[_0x35a0('0x13')][_0x35a0('0x15')]);return _0x4a63e9(_0x2eb7f4['error'][_0x35a0('0x15')]);}logger['error'](_0x35a0('0xf'),_0x3ab377,_0x2eb7f4['error'][_0x35a0('0x15')]);return _0x4d2843(_0x2eb7f4[_0x35a0('0x13')][_0x35a0('0x15')]);}else{logger[_0x35a0('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3ab377,'request\x20sent');_0x4d2843(_0x2eb7f4[_0x35a0('0x16')]['message']);}})[_0x35a0('0x17')](function(_0x8437e){logger[_0x35a0('0x13')](_0x35a0('0xf'),_0x3ab377,_0x8437e);_0x4a63e9(_0x8437e);});});}exports[_0x35a0('0x18')]=function(_0x156f00){var _0x1cfdc6=this;return new Promise(function(_0x21ed8f,_0x5bf505){return db[_0x35a0('0x19')][_0x35a0('0x1a')](_0x156f00['body'],{'raw':_0x156f00['options']?_0x156f00[_0x35a0('0x1b')][_0x35a0('0x1c')]===undefined?!![]:![]:!![]})[_0x35a0('0x1d')](function(_0x4a6a66){logger[_0x35a0('0xe')](_0x35a0('0x18'),_0x156f00);logger['debug']('CreateSquareRecording',_0x156f00,JSON['stringify'](_0x4a6a66));_0x21ed8f(_0x4a6a66);})[_0x35a0('0x17')](function(_0x22590b){logger['error'](_0x35a0('0x18'),_0x22590b['message'],_0x156f00);_0x5bf505(_0x1cfdc6[_0x35a0('0x13')](0x1f4,_0x22590b[_0x35a0('0x15')]));});});}; \ No newline at end of file +var _0x2d89=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x37e9d6,_0x4b7539){var _0x34744e=function(_0xd94516){while(--_0xd94516){_0x37e9d6['push'](_0x37e9d6['shift']());}};_0x34744e(++_0x4b7539);}(_0x2d89,0x10e));var _0x92d8=function(_0x2c5805,_0x462c52){_0x2c5805=_0x2c5805-0x0;var _0x1e5216=_0x2d89[_0x2c5805];return _0x1e5216;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x92d8('0x0'));var BPromise=require(_0x92d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92d8('0x2'));var db=require(_0x92d8('0x3'))['db'];var utils=require(_0x92d8('0x4'));var logger=require(_0x92d8('0x5'))(_0x92d8('0x6'));var config=require(_0x92d8('0x7'));var jayson=require(_0x92d8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4f5f,_0x5c5a0c,_0x264535){return new BPromise(function(_0x42d1b7,_0x2a959d){return client[_0x92d8('0x9')](_0x3b4f5f,_0x264535)[_0x92d8('0xa')](function(_0x2c9f6a){logger[_0x92d8('0xb')](_0x92d8('0xc'),_0x5c5a0c,_0x92d8('0xd'));logger[_0x92d8('0xe')](_0x92d8('0xf'),_0x5c5a0c,'request\x20sent',JSON[_0x92d8('0x10')](_0x2c9f6a));if(_0x2c9f6a['error']){if(_0x2c9f6a[_0x92d8('0x11')][_0x92d8('0x12')]===0x1f4){logger[_0x92d8('0x11')](_0x92d8('0xc'),_0x5c5a0c,_0x2c9f6a[_0x92d8('0x11')][_0x92d8('0x13')]);return _0x2a959d(_0x2c9f6a[_0x92d8('0x11')][_0x92d8('0x13')]);}logger[_0x92d8('0x11')](_0x92d8('0xc'),_0x5c5a0c,_0x2c9f6a[_0x92d8('0x11')]['message']);return _0x42d1b7(_0x2c9f6a[_0x92d8('0x11')][_0x92d8('0x13')]);}else{logger['info'](_0x92d8('0xc'),_0x5c5a0c,_0x92d8('0xd'));_0x42d1b7(_0x2c9f6a[_0x92d8('0x14')][_0x92d8('0x13')]);}})['catch'](function(_0x14ea44){logger[_0x92d8('0x11')](_0x92d8('0xc'),_0x5c5a0c,_0x14ea44);_0x2a959d(_0x14ea44);});});}exports[_0x92d8('0x15')]=function(_0x4869e4){var _0x3b4192=this;return new Promise(function(_0xd3604a,_0x6b357d){return db[_0x92d8('0x16')][_0x92d8('0x17')](_0x4869e4[_0x92d8('0x18')],{'raw':_0x4869e4['options']?_0x4869e4[_0x92d8('0x19')][_0x92d8('0x1a')]===undefined?!![]:![]:!![]})[_0x92d8('0xa')](function(_0x3ec573){logger[_0x92d8('0xb')](_0x92d8('0x15'),_0x4869e4);logger[_0x92d8('0xe')](_0x92d8('0x15'),_0x4869e4,JSON[_0x92d8('0x10')](_0x3ec573));_0xd3604a(_0x3ec573);})[_0x92d8('0x1b')](function(_0x1a0250){logger[_0x92d8('0x11')](_0x92d8('0x15'),_0x1a0250[_0x92d8('0x13')],_0x4869e4);_0x6b357d(_0x3b4192[_0x92d8('0x11')](0x1f4,_0x1a0250[_0x92d8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 5bde808..a68e825 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(_0x4db76c,_0x3f729b){var _0x246eed=function(_0x3ad48c){while(--_0x3ad48c){_0x4db76c['push'](_0x4db76c['shift']());}};_0x246eed(++_0x3f729b);}(_0xe706,0xa3));var _0x6e70=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0xe706[_0x33c9f8];return _0x2d7004;};'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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xa97175,_0x32ce03){var _0x214c65=function(_0x18c163){while(--_0x18c163){_0xa97175['push'](_0xa97175['shift']());}};_0x214c65(++_0x32ce03);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 865c151..fe10b9c 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 _0x110a=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x110a,0x1ca));var _0xa110=function(_0x29f1b5,_0x19ac42){_0x29f1b5=_0x29f1b5-0x0;var _0x5bcfbd=_0x110a[_0x29f1b5];return _0x5bcfbd;};'use strict';var Sequelize=require(_0xa110('0x0'));module[_0xa110('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa110('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa110('0x2')]},'uniqueid':{'type':Sequelize[_0xa110('0x2')]},'version':{'type':Sequelize[_0xa110('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xa110('0x2')]},'callington':{'type':Sequelize[_0xa110('0x2')]},'callingtns':{'type':Sequelize[_0xa110('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xa110('0x2')]},'context':{'type':Sequelize[_0xa110('0x2')]},'extension':{'type':Sequelize[_0xa110('0x2')]},'priority':{'type':Sequelize[_0xa110('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa110('0x2')]},'threadid':{'type':Sequelize[_0xa110('0x2')]},'project_name':{'type':Sequelize[_0xa110('0x2')]},'joinAt':{'type':Sequelize[_0xa110('0x3')]},'leaveAt':{'type':Sequelize[_0xa110('0x3')]},'bot':{'type':Sequelize[_0xa110('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xed82=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x246b99,_0x54566d){var _0x327e35=function(_0x507166){while(--_0x507166){_0x246b99['push'](_0x246b99['shift']());}};_0x327e35(++_0x54566d);}(_0xed82,0x1af));var _0x2ed8=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xed82[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x2ed8('0x0'));module[_0x2ed8('0x1')]={'network':{'type':Sequelize[_0x2ed8('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x2ed8('0x2')]},'channel':{'type':Sequelize[_0x2ed8('0x2')]},'language':{'type':Sequelize[_0x2ed8('0x2')]},'type':{'type':Sequelize[_0x2ed8('0x2')]},'uniqueid':{'type':Sequelize[_0x2ed8('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2ed8('0x2')]},'callingpres':{'type':Sequelize[_0x2ed8('0x2')]},'callingani2':{'type':Sequelize[_0x2ed8('0x2')]},'callington':{'type':Sequelize[_0x2ed8('0x2')]},'callingtns':{'type':Sequelize[_0x2ed8('0x2')]},'dnid':{'type':Sequelize[_0x2ed8('0x2')]},'rdnis':{'type':Sequelize[_0x2ed8('0x2')]},'context':{'type':Sequelize[_0x2ed8('0x2')]},'extension':{'type':Sequelize[_0x2ed8('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x2ed8('0x2')]},'accountcode':{'type':Sequelize[_0x2ed8('0x2')]},'threadid':{'type':Sequelize[_0x2ed8('0x2')]},'project_name':{'type':Sequelize[_0x2ed8('0x2')]},'joinAt':{'type':Sequelize[_0x2ed8('0x3')]},'leaveAt':{'type':Sequelize[_0x2ed8('0x3')]},'bot':{'type':Sequelize[_0x2ed8('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 74b521e..a764f5a 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 _0xbea5=['fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','SquareReport','includeAll','include','findAll','rows','catch','fields','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes'];(function(_0xa55108,_0x4ff85c){var _0x50f13d=function(_0x4ba9d2){while(--_0x4ba9d2){_0xa55108['push'](_0xa55108['shift']());}};_0x50f13d(++_0x4ff85c);}(_0xbea5,0x18a));var _0x5bea=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xbea5[_0x152136];return _0x20df44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5bea('0x0'));var zipdir=require(_0x5bea('0x1'));var jsonpatch=require(_0x5bea('0x2'));var rp=require(_0x5bea('0x3'));var moment=require(_0x5bea('0x4'));var BPromise=require(_0x5bea('0x5'));var Mustache=require(_0x5bea('0x6'));var util=require('util');var path=require(_0x5bea('0x7'));var sox=require(_0x5bea('0x8'));var csv=require(_0x5bea('0x9'));var ejs=require(_0x5bea('0xa'));var fs=require('fs');var fs_extra=require(_0x5bea('0xb'));var _=require(_0x5bea('0xc'));var squel=require('squel');var crypto=require(_0x5bea('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5bea('0xe'));var Papa=require(_0x5bea('0xf'));var Redis=require(_0x5bea('0x10'));var authService=require(_0x5bea('0x11'));var qs=require(_0x5bea('0x12'));var as=require(_0x5bea('0x13'));var hardwareService=require(_0x5bea('0x14'));var logger=require(_0x5bea('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5bea('0x16'));var licenseUtil=require(_0x5bea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x214d64,_0x3b9945){_0x3b9945=_0x3b9945||0xcc;return function(_0x4fbd44){if(_0x4fbd44){return _0x214d64[_0x5bea('0x18')](_0x3b9945);}return _0x214d64[_0x5bea('0x19')](_0x3b9945)[_0x5bea('0x1a')]();};}function respondWithResult(_0x1ec331,_0xf50ed){_0xf50ed=_0xf50ed||0xc8;return function(_0x28b7d5){if(_0x28b7d5){return _0x1ec331[_0x5bea('0x19')](_0xf50ed)['json'](_0x28b7d5);}};}function respondWithFilteredResult(_0x507674,_0x211562){return function(_0x268e4a){if(_0x268e4a){var _0x9b8908=typeof _0x211562['offset']==='undefined'&&typeof _0x211562['limit']===_0x5bea('0x1b');var _0x2e6222=_0x268e4a[_0x5bea('0x1c')];var _0xbe5205=_0x9b8908?0x0:_0x211562[_0x5bea('0x1d')];var _0x518933=_0x9b8908?_0x268e4a[_0x5bea('0x1c')]:_0x211562[_0x5bea('0x1d')]+_0x211562[_0x5bea('0x1e')];var _0x3c2ea3;if(_0x518933>=_0x2e6222){_0x518933=_0x2e6222;_0x3c2ea3=0xc8;}else{_0x3c2ea3=0xce;}_0x507674[_0x5bea('0x19')](_0x3c2ea3);return _0x507674[_0x5bea('0x1f')]('Content-Range',_0xbe5205+'-'+_0x518933+'/'+_0x2e6222)[_0x5bea('0x20')](_0x268e4a);}return null;};}function patchUpdates(_0x504119){return function(_0x14774b){try{jsonpatch[_0x5bea('0x21')](_0x14774b,_0x504119,!![]);}catch(_0x2ca4e5){return BPromise[_0x5bea('0x22')](_0x2ca4e5);}return _0x14774b[_0x5bea('0x23')]();};}function saveUpdates(_0x2558ef,_0x5eb75f){return function(_0xf1bcee){if(_0xf1bcee){return _0xf1bcee['update'](_0x2558ef)[_0x5bea('0x24')](function(_0x906fb4){return _0x906fb4;});}return null;};}function removeEntity(_0x373471,_0x4bc175){return function(_0x4babe4){if(_0x4babe4){return _0x4babe4[_0x5bea('0x25')]()[_0x5bea('0x24')](function(){_0x373471[_0x5bea('0x19')](0xcc)[_0x5bea('0x1a')]();});}};}function handleEntityNotFound(_0x105487,_0x29a19a){return function(_0x55e9db){if(!_0x55e9db){_0x105487['sendStatus'](0x194);}return _0x55e9db;};}function handleError(_0x1a5318,_0x5b80bf){_0x5b80bf=_0x5b80bf||0x1f4;return function(_0x247cf2){logger[_0x5bea('0x26')](_0x247cf2[_0x5bea('0x27')]);if(_0x247cf2[_0x5bea('0x28')]){delete _0x247cf2[_0x5bea('0x28')];}_0x1a5318[_0x5bea('0x19')](_0x5b80bf)['send'](_0x247cf2);};}exports[_0x5bea('0x29')]=function(_0x2e9454,_0xd977eb){var _0x13b2b0={},_0x34d767={},_0x5727f9={'count':0x0,'rows':[]};var _0x479db7=_[_0x5bea('0x2a')](db['SquareReport'][_0x5bea('0x2b')],function(_0xacd4aa){return{'name':_0xacd4aa[_0x5bea('0x2c')],'type':_0xacd4aa[_0x5bea('0x2d')]['key']};});_0x34d767[_0x5bea('0x2e')]=_['map'](_0x479db7,_0x5bea('0x28'));_0x34d767[_0x5bea('0x2f')]=_[_0x5bea('0x30')](_0x2e9454[_0x5bea('0x2f')]);_0x34d767['filters']=_['intersection'](_0x34d767['model'],_0x34d767[_0x5bea('0x2f')]);_0x13b2b0['attributes']=_[_0x5bea('0x31')](_0x34d767[_0x5bea('0x2e')],qs['fields'](_0x2e9454[_0x5bea('0x2f')]['fields']));_0x13b2b0[_0x5bea('0x32')]=_0x13b2b0[_0x5bea('0x32')][_0x5bea('0x33')]?_0x13b2b0[_0x5bea('0x32')]:_0x34d767[_0x5bea('0x2e')];if(!_0x2e9454[_0x5bea('0x2f')][_0x5bea('0x34')]('nolimit')){_0x13b2b0[_0x5bea('0x1e')]=qs[_0x5bea('0x1e')](_0x2e9454[_0x5bea('0x2f')][_0x5bea('0x1e')]);_0x13b2b0['offset']=qs[_0x5bea('0x1d')](_0x2e9454[_0x5bea('0x2f')]['offset']);}_0x13b2b0[_0x5bea('0x35')]=qs[_0x5bea('0x36')](_0x2e9454[_0x5bea('0x2f')]['sort']);_0x13b2b0[_0x5bea('0x37')]=qs[_0x5bea('0x38')](_['pick'](_0x2e9454[_0x5bea('0x2f')],_0x34d767[_0x5bea('0x38')]),_0x479db7);if(_0x2e9454['query'][_0x5bea('0x39')]){_0x13b2b0[_0x5bea('0x37')]=_[_0x5bea('0x3a')](_0x13b2b0[_0x5bea('0x37')],{'$or':_['map'](_0x479db7,function(_0x25d605){if(_0x25d605['type']!==_0x5bea('0x3b')){var _0x4bb340={};_0x4bb340[_0x25d605['name']]={'$like':'%'+_0x2e9454[_0x5bea('0x2f')]['filter']+'%'};return _0x4bb340;}})});}_0x13b2b0=_[_0x5bea('0x3a')]({},_0x13b2b0,_0x2e9454['options']);var _0x930990={'where':_0x13b2b0['where']};return db[_0x5bea('0x3c')][_0x5bea('0x1c')](_0x930990)[_0x5bea('0x24')](function(_0x557773){_0x5727f9[_0x5bea('0x1c')]=_0x557773;if(_0x2e9454['query'][_0x5bea('0x3d')]){_0x13b2b0[_0x5bea('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0x5bea('0x3f')](_0x13b2b0);})[_0x5bea('0x24')](function(_0x466718){_0x5727f9[_0x5bea('0x40')]=_0x466718;return _0x5727f9;})[_0x5bea('0x24')](respondWithFilteredResult(_0xd977eb,_0x13b2b0))[_0x5bea('0x41')](handleError(_0xd977eb,null));};exports['show']=function(_0x24ea7a,_0x54e65d){var _0x586e21={'raw':!![],'where':{'id':_0x24ea7a['params']['id']}},_0x3b98c0={};_0x3b98c0['model']=_[_0x5bea('0x30')](db[_0x5bea('0x3c')][_0x5bea('0x2b')]);_0x3b98c0[_0x5bea('0x2f')]=_[_0x5bea('0x30')](_0x24ea7a[_0x5bea('0x2f')]);_0x3b98c0[_0x5bea('0x38')]=_[_0x5bea('0x31')](_0x3b98c0[_0x5bea('0x2e')],_0x3b98c0[_0x5bea('0x2f')]);_0x586e21[_0x5bea('0x32')]=_[_0x5bea('0x31')](_0x3b98c0[_0x5bea('0x2e')],qs[_0x5bea('0x42')](_0x24ea7a[_0x5bea('0x2f')][_0x5bea('0x42')]));_0x586e21[_0x5bea('0x32')]=_0x586e21[_0x5bea('0x32')]['length']?_0x586e21[_0x5bea('0x32')]:_0x3b98c0['model'];if(_0x24ea7a[_0x5bea('0x2f')][_0x5bea('0x3d')]){_0x586e21['include']=[{'all':!![]}];}_0x586e21=_[_0x5bea('0x3a')]({},_0x586e21,_0x24ea7a['options']);return db[_0x5bea('0x3c')][_0x5bea('0x43')](_0x586e21)[_0x5bea('0x24')](handleEntityNotFound(_0x54e65d,null))[_0x5bea('0x24')](respondWithResult(_0x54e65d,null))[_0x5bea('0x41')](handleError(_0x54e65d,null));};exports['create']=function(_0x11a2c6,_0x1848e5){return db['SquareReport'][_0x5bea('0x44')](_0x11a2c6[_0x5bea('0x45')],{})['then'](respondWithResult(_0x1848e5,0xc9))[_0x5bea('0x41')](handleError(_0x1848e5,null));};exports[_0x5bea('0x46')]=function(_0x1dd7a0,_0x3a1326){if(_0x1dd7a0[_0x5bea('0x45')]['id']){delete _0x1dd7a0[_0x5bea('0x45')]['id'];}return db[_0x5bea('0x3c')][_0x5bea('0x43')]({'where':{'id':_0x1dd7a0[_0x5bea('0x47')]['id']}})[_0x5bea('0x24')](handleEntityNotFound(_0x3a1326,null))[_0x5bea('0x24')](saveUpdates(_0x1dd7a0['body'],null))[_0x5bea('0x24')](respondWithResult(_0x3a1326,null))[_0x5bea('0x41')](handleError(_0x3a1326,null));};exports[_0x5bea('0x25')]=function(_0x44b785,_0x2cf80b){return db[_0x5bea('0x3c')][_0x5bea('0x43')]({'where':{'id':_0x44b785['params']['id']}})[_0x5bea('0x24')](handleEntityNotFound(_0x2cf80b,null))[_0x5bea('0x24')](removeEntity(_0x2cf80b,null))[_0x5bea('0x41')](handleError(_0x2cf80b,null));};exports[_0x5bea('0x48')]=function(_0x4b7473,_0x13f552){return db[_0x5bea('0x3c')]['describe']()[_0x5bea('0x24')](respondWithResult(_0x13f552,null))[_0x5bea('0x41')](handleError(_0x13f552,null));}; \ No newline at end of file +var _0x19c4=['type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','options','find','create','catch','body','params','rimraf','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes'];(function(_0x1c42cb,_0x4db886){var _0x3d65de=function(_0x5a4b69){while(--_0x5a4b69){_0x1c42cb['push'](_0x1c42cb['shift']());}};_0x3d65de(++_0x4db886);}(_0x19c4,0xf4));var _0x419c=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0x19c4[_0x1d04b5];return _0x161342;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x419c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x419c('0x1'));var rp=require('request-promise');var moment=require(_0x419c('0x2'));var BPromise=require(_0x419c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x419c('0x4'));var sox=require(_0x419c('0x5'));var csv=require('to-csv');var ejs=require(_0x419c('0x6'));var fs=require('fs');var fs_extra=require(_0x419c('0x7'));var _=require(_0x419c('0x8'));var squel=require(_0x419c('0x9'));var crypto=require(_0x419c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x419c('0xb'));var toCsv=require(_0x419c('0xc'));var querystring=require(_0x419c('0xd'));var Papa=require(_0x419c('0xe'));var Redis=require('ioredis');var authService=require(_0x419c('0xf'));var qs=require(_0x419c('0x10'));var as=require(_0x419c('0x11'));var hardwareService=require(_0x419c('0x12'));var logger=require(_0x419c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x419c('0x14'));var licenseUtil=require(_0x419c('0x15'));var db=require(_0x419c('0x16'))['db'];function respondWithStatusCode(_0x193101,_0x4fb81b){_0x4fb81b=_0x4fb81b||0xcc;return function(_0x3e83b3){if(_0x3e83b3){return _0x193101[_0x419c('0x17')](_0x4fb81b);}return _0x193101[_0x419c('0x18')](_0x4fb81b)[_0x419c('0x19')]();};}function respondWithResult(_0x3908ef,_0x3fc8c8){_0x3fc8c8=_0x3fc8c8||0xc8;return function(_0x5e22b7){if(_0x5e22b7){return _0x3908ef['status'](_0x3fc8c8)['json'](_0x5e22b7);}};}function respondWithFilteredResult(_0x2a312a,_0x56ffd1){return function(_0x319cdd){if(_0x319cdd){var _0x40327e=typeof _0x56ffd1[_0x419c('0x1a')]==='undefined'&&typeof _0x56ffd1[_0x419c('0x1b')]===_0x419c('0x1c');var _0x28f083=_0x319cdd['count'];var _0x6f49a9=_0x40327e?0x0:_0x56ffd1[_0x419c('0x1a')];var _0x5af7e1=_0x40327e?_0x319cdd[_0x419c('0x1d')]:_0x56ffd1[_0x419c('0x1a')]+_0x56ffd1[_0x419c('0x1b')];var _0x1c00a0;if(_0x5af7e1>=_0x28f083){_0x5af7e1=_0x28f083;_0x1c00a0=0xc8;}else{_0x1c00a0=0xce;}_0x2a312a[_0x419c('0x18')](_0x1c00a0);return _0x2a312a[_0x419c('0x1e')](_0x419c('0x1f'),_0x6f49a9+'-'+_0x5af7e1+'/'+_0x28f083)[_0x419c('0x20')](_0x319cdd);}return null;};}function patchUpdates(_0x1f9ef6){return function(_0x42ccf5){try{jsonpatch[_0x419c('0x21')](_0x42ccf5,_0x1f9ef6,!![]);}catch(_0x39750f){return BPromise['reject'](_0x39750f);}return _0x42ccf5['save']();};}function saveUpdates(_0x5d7c1b,_0x86dea3){return function(_0x3a5db8){if(_0x3a5db8){return _0x3a5db8[_0x419c('0x22')](_0x5d7c1b)[_0x419c('0x23')](function(_0x313afe){return _0x313afe;});}return null;};}function removeEntity(_0x1777df,_0x21138b){return function(_0x4b0025){if(_0x4b0025){return _0x4b0025[_0x419c('0x24')]()[_0x419c('0x23')](function(){_0x1777df[_0x419c('0x18')](0xcc)[_0x419c('0x19')]();});}};}function handleEntityNotFound(_0x59ed84,_0x342faf){return function(_0x1bac4b){if(!_0x1bac4b){_0x59ed84[_0x419c('0x17')](0x194);}return _0x1bac4b;};}function handleError(_0x38f188,_0x2270e4){_0x2270e4=_0x2270e4||0x1f4;return function(_0xa26f48){logger[_0x419c('0x25')](_0xa26f48[_0x419c('0x26')]);if(_0xa26f48[_0x419c('0x27')]){delete _0xa26f48[_0x419c('0x27')];}_0x38f188[_0x419c('0x18')](_0x2270e4)[_0x419c('0x28')](_0xa26f48);};}exports[_0x419c('0x29')]=function(_0x2ee8ca,_0x37e78f){var _0x33aeac={},_0x58e930={},_0x584643={'count':0x0,'rows':[]};var _0x2aa685=_['map'](db[_0x419c('0x2a')][_0x419c('0x2b')],function(_0xbf1ba0){return{'name':_0xbf1ba0['fieldName'],'type':_0xbf1ba0[_0x419c('0x2c')][_0x419c('0x2d')]};});_0x58e930[_0x419c('0x2e')]=_[_0x419c('0x2f')](_0x2aa685,_0x419c('0x27'));_0x58e930[_0x419c('0x30')]=_[_0x419c('0x31')](_0x2ee8ca[_0x419c('0x30')]);_0x58e930[_0x419c('0x32')]=_[_0x419c('0x33')](_0x58e930[_0x419c('0x2e')],_0x58e930[_0x419c('0x30')]);_0x33aeac['attributes']=_[_0x419c('0x33')](_0x58e930[_0x419c('0x2e')],qs[_0x419c('0x34')](_0x2ee8ca[_0x419c('0x30')][_0x419c('0x34')]));_0x33aeac[_0x419c('0x35')]=_0x33aeac[_0x419c('0x35')][_0x419c('0x36')]?_0x33aeac[_0x419c('0x35')]:_0x58e930[_0x419c('0x2e')];if(!_0x2ee8ca[_0x419c('0x30')][_0x419c('0x37')]('nolimit')){_0x33aeac['limit']=qs['limit'](_0x2ee8ca[_0x419c('0x30')]['limit']);_0x33aeac['offset']=qs[_0x419c('0x1a')](_0x2ee8ca[_0x419c('0x30')]['offset']);}_0x33aeac['order']=qs[_0x419c('0x38')](_0x2ee8ca[_0x419c('0x30')]['sort']);_0x33aeac[_0x419c('0x39')]=qs[_0x419c('0x32')](_[_0x419c('0x3a')](_0x2ee8ca[_0x419c('0x30')],_0x58e930[_0x419c('0x32')]),_0x2aa685);if(_0x2ee8ca[_0x419c('0x30')][_0x419c('0x3b')]){_0x33aeac[_0x419c('0x39')]=_['merge'](_0x33aeac[_0x419c('0x39')],{'$or':_[_0x419c('0x2f')](_0x2aa685,function(_0x4e6640){if(_0x4e6640[_0x419c('0x2c')]!=='VIRTUAL'){var _0x5c7a3c={};_0x5c7a3c[_0x4e6640[_0x419c('0x27')]]={'$like':'%'+_0x2ee8ca[_0x419c('0x30')][_0x419c('0x3b')]+'%'};return _0x5c7a3c;}})});}_0x33aeac=_[_0x419c('0x3c')]({},_0x33aeac,_0x2ee8ca['options']);var _0x568e39={'where':_0x33aeac['where']};return db[_0x419c('0x2a')][_0x419c('0x1d')](_0x568e39)[_0x419c('0x23')](function(_0x1a8e95){_0x584643[_0x419c('0x1d')]=_0x1a8e95;if(_0x2ee8ca[_0x419c('0x30')][_0x419c('0x3d')]){_0x33aeac[_0x419c('0x3e')]=[{'all':!![]}];}return db[_0x419c('0x2a')][_0x419c('0x3f')](_0x33aeac);})[_0x419c('0x23')](function(_0x155912){_0x584643[_0x419c('0x40')]=_0x155912;return _0x584643;})[_0x419c('0x23')](respondWithFilteredResult(_0x37e78f,_0x33aeac))['catch'](handleError(_0x37e78f,null));};exports[_0x419c('0x41')]=function(_0x49c239,_0x492c0c){var _0x295af2={'raw':!![],'where':{'id':_0x49c239['params']['id']}},_0x5e46dd={};_0x5e46dd['model']=_[_0x419c('0x31')](db[_0x419c('0x2a')][_0x419c('0x2b')]);_0x5e46dd['query']=_['keys'](_0x49c239[_0x419c('0x30')]);_0x5e46dd[_0x419c('0x32')]=_['intersection'](_0x5e46dd['model'],_0x5e46dd[_0x419c('0x30')]);_0x295af2[_0x419c('0x35')]=_[_0x419c('0x33')](_0x5e46dd[_0x419c('0x2e')],qs['fields'](_0x49c239['query'][_0x419c('0x34')]));_0x295af2[_0x419c('0x35')]=_0x295af2['attributes']['length']?_0x295af2[_0x419c('0x35')]:_0x5e46dd[_0x419c('0x2e')];if(_0x49c239['query'][_0x419c('0x3d')]){_0x295af2[_0x419c('0x3e')]=[{'all':!![]}];}_0x295af2=_[_0x419c('0x3c')]({},_0x295af2,_0x49c239[_0x419c('0x42')]);return db[_0x419c('0x2a')][_0x419c('0x43')](_0x295af2)[_0x419c('0x23')](handleEntityNotFound(_0x492c0c,null))[_0x419c('0x23')](respondWithResult(_0x492c0c,null))['catch'](handleError(_0x492c0c,null));};exports[_0x419c('0x44')]=function(_0x3ea3fe,_0x5ece91){return db[_0x419c('0x2a')][_0x419c('0x44')](_0x3ea3fe['body'],{})[_0x419c('0x23')](respondWithResult(_0x5ece91,0xc9))[_0x419c('0x45')](handleError(_0x5ece91,null));};exports[_0x419c('0x22')]=function(_0x36a68b,_0x5195a3){if(_0x36a68b[_0x419c('0x46')]['id']){delete _0x36a68b[_0x419c('0x46')]['id'];}return db[_0x419c('0x2a')][_0x419c('0x43')]({'where':{'id':_0x36a68b[_0x419c('0x47')]['id']}})[_0x419c('0x23')](handleEntityNotFound(_0x5195a3,null))[_0x419c('0x23')](saveUpdates(_0x36a68b[_0x419c('0x46')],null))[_0x419c('0x23')](respondWithResult(_0x5195a3,null))['catch'](handleError(_0x5195a3,null));};exports['destroy']=function(_0x7e517d,_0x24cb59){return db['SquareReport'][_0x419c('0x43')]({'where':{'id':_0x7e517d[_0x419c('0x47')]['id']}})[_0x419c('0x23')](handleEntityNotFound(_0x24cb59,null))[_0x419c('0x23')](removeEntity(_0x24cb59,null))[_0x419c('0x45')](handleError(_0x24cb59,null));};exports['describe']=function(_0x1b3d69,_0x15830e){return db[_0x419c('0x2a')]['describe']()['then'](respondWithResult(_0x15830e,null))[_0x419c('0x45')](handleError(_0x15830e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index be0e8b8..5478b0d 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 _0xc24d=['path','rimraf','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','bluebird'];(function(_0x12263a,_0x56cd69){var _0xadaefc=function(_0x14cadc){while(--_0x14cadc){_0x12263a['push'](_0x12263a['shift']());}};_0xadaefc(++_0x56cd69);}(_0xc24d,0x176));var _0xdc24=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc24d[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xdc24('0x0'));var util=require('util');var logger=require(_0xdc24('0x1'))(_0xdc24('0x2'));var moment=require('moment');var BPromise=require(_0xdc24('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc24('0x4'));var rimraf=require(_0xdc24('0x5'));var config=require('../../config/environment');var attributes=require(_0xdc24('0x6'));module['exports']=function(_0x50d611,_0x2b1d7e){return _0x50d611[_0xdc24('0x7')](_0xdc24('0x8'),attributes,{'tableName':_0xdc24('0x9'),'paranoid':![],'indexes':[{'name':_0xdc24('0xa'),'fields':[_0xdc24('0xb'),_0xdc24('0xc')]},{'name':_0xdc24('0xd'),'fields':[_0xdc24('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1120=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square'];(function(_0x550f80,_0x2d7260){var _0x2159d9=function(_0x3416e3){while(--_0x3416e3){_0x550f80['push'](_0x550f80['shift']());}};_0x2159d9(++_0x2d7260);}(_0x1120,0x1e0));var _0x0112=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x1120[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x0112('0x0'));var util=require(_0x0112('0x1'));var logger=require(_0x0112('0x2'))(_0x0112('0x3'));var moment=require(_0x0112('0x4'));var BPromise=require(_0x0112('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0112('0x6'));var rimraf=require(_0x0112('0x7'));var config=require(_0x0112('0x8'));var attributes=require(_0x0112('0x9'));module[_0x0112('0xa')]=function(_0x26927a,_0x59796c){return _0x26927a['define'](_0x0112('0xb'),attributes,{'tableName':_0x0112('0xc'),'paranoid':![],'indexes':[{'name':_0x0112('0xd'),'fields':[_0x0112('0xe'),_0x0112('0xf')]},{'name':_0x0112('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 14eb27f..3fd7101 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 _0x5ea3=['code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','SquareReport','body','options','then','update','where','UpdateSquareReport','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x697b1,_0xf7b04f){var _0x384c54=function(_0x1ba82b){while(--_0x1ba82b){_0x697b1['push'](_0x697b1['shift']());}};_0x384c54(++_0xf7b04f);}(_0x5ea3,0x141));var _0x35ea=function(_0x404a13,_0x3d52d2){_0x404a13=_0x404a13-0x0;var _0x585130=_0x5ea3[_0x404a13];return _0x585130;};'use strict';var _=require('lodash');var util=require(_0x35ea('0x0'));var moment=require(_0x35ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x35ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35ea('0x3'))['db'];var utils=require(_0x35ea('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x35ea('0x5'));var jayson=require(_0x35ea('0x6'));var client=jayson['client'][_0x35ea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x205dca,_0x446df6,_0x4c9539){return new BPromise(function(_0xc75a7c,_0x23f474){return client[_0x35ea('0x8')](_0x205dca,_0x4c9539)['then'](function(_0x324ec0){logger[_0x35ea('0x9')]('SquareReport,\x20%s,\x20%s',_0x446df6,_0x35ea('0xa'));logger[_0x35ea('0xb')](_0x35ea('0xc'),_0x446df6,_0x35ea('0xa'),JSON[_0x35ea('0xd')](_0x324ec0));if(_0x324ec0[_0x35ea('0xe')]){if(_0x324ec0[_0x35ea('0xe')][_0x35ea('0xf')]===0x1f4){logger[_0x35ea('0xe')]('SquareReport,\x20%s,\x20%s',_0x446df6,_0x324ec0['error']['message']);return _0x23f474(_0x324ec0[_0x35ea('0xe')][_0x35ea('0x10')]);}logger[_0x35ea('0xe')]('SquareReport,\x20%s,\x20%s',_0x446df6,_0x324ec0[_0x35ea('0xe')][_0x35ea('0x10')]);return _0xc75a7c(_0x324ec0[_0x35ea('0xe')]['message']);}else{logger[_0x35ea('0x9')](_0x35ea('0x11'),_0x446df6,'request\x20sent');_0xc75a7c(_0x324ec0[_0x35ea('0x12')][_0x35ea('0x10')]);}})[_0x35ea('0x13')](function(_0x26488e){logger[_0x35ea('0xe')]('SquareReport,\x20%s,\x20%s',_0x446df6,_0x26488e);_0x23f474(_0x26488e);});});}exports[_0x35ea('0x14')]=function(_0x1d437b){var _0x368d97=this;return new Promise(function(_0x2c3da5,_0x20af45){return db[_0x35ea('0x15')]['create'](_0x1d437b[_0x35ea('0x16')],{'raw':_0x1d437b[_0x35ea('0x17')]?_0x1d437b['options']['raw']===undefined?!![]:![]:!![]})[_0x35ea('0x18')](function(_0x1160b5){logger[_0x35ea('0x9')](_0x35ea('0x14'),_0x1d437b);logger[_0x35ea('0xb')](_0x35ea('0x14'),_0x1d437b,JSON['stringify'](_0x1160b5));_0x2c3da5(_0x1160b5);})[_0x35ea('0x13')](function(_0x2bbd35){logger[_0x35ea('0xe')](_0x35ea('0x14'),_0x2bbd35[_0x35ea('0x10')],_0x1d437b);_0x20af45(_0x368d97[_0x35ea('0xe')](0x1f4,_0x2bbd35[_0x35ea('0x10')]));});});};exports['UpdateSquareReport']=function(_0x54f860){var _0x4ec889=this;return new Promise(function(_0x563a97,_0x215222){return db['SquareReport'][_0x35ea('0x19')](_0x54f860[_0x35ea('0x16')],{'raw':_0x54f860[_0x35ea('0x17')]?_0x54f860[_0x35ea('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54f860[_0x35ea('0x17')]?_0x54f860[_0x35ea('0x17')][_0x35ea('0x1a')]||null:null,'attributes':_0x54f860[_0x35ea('0x17')]?_0x54f860[_0x35ea('0x17')]['attributes']||null:null,'limit':_0x54f860[_0x35ea('0x17')]?_0x54f860[_0x35ea('0x17')]['limit']||null:null})[_0x35ea('0x18')](function(_0x569c5a){logger[_0x35ea('0x9')](_0x35ea('0x1b'),_0x54f860);logger[_0x35ea('0xb')]('UpdateSquareReport',_0x54f860,JSON[_0x35ea('0xd')](_0x569c5a));_0x563a97(_0x569c5a);})[_0x35ea('0x13')](function(_0x584b39){logger[_0x35ea('0xe')]('UpdateSquareReport',_0x584b39[_0x35ea('0x10')],_0x54f860);_0x215222(_0x4ec889[_0x35ea('0xe')](0x1f4,_0x584b39[_0x35ea('0x10')]));});});}; \ No newline at end of file +var _0x5fcc=['raw','debug','update','attributes','UpdateSquareReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','stringify','error','SquareReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareReport','SquareReport','body','options'];(function(_0x3d82b1,_0x3501bb){var _0x26abd7=function(_0x164199){while(--_0x164199){_0x3d82b1['push'](_0x3d82b1['shift']());}};_0x26abd7(++_0x3501bb);}(_0x5fcc,0x1f2));var _0xc5fc=function(_0x4a3b67,_0x2e0c40){_0x4a3b67=_0x4a3b67-0x0;var _0x273be6=_0x5fcc[_0x4a3b67];return _0x273be6;};'use strict';var _=require(_0xc5fc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc5fc('0x1'));var rs=require(_0xc5fc('0x2'));var fs=require('fs');var Redis=require(_0xc5fc('0x3'));var db=require(_0xc5fc('0x4'))['db'];var utils=require(_0xc5fc('0x5'));var logger=require(_0xc5fc('0x6'))(_0xc5fc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc5fc('0x8')][_0xc5fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x334f0d,_0x4536fe,_0x5b9b97){return new BPromise(function(_0x31559b,_0x30acdb){return client[_0xc5fc('0xa')](_0x334f0d,_0x5b9b97)[_0xc5fc('0xb')](function(_0x5760ef){logger['info']('SquareReport,\x20%s,\x20%s',_0x4536fe,_0xc5fc('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x4536fe,_0xc5fc('0xc'),JSON[_0xc5fc('0xd')](_0x5760ef));if(_0x5760ef[_0xc5fc('0xe')]){if(_0x5760ef[_0xc5fc('0xe')]['code']===0x1f4){logger[_0xc5fc('0xe')](_0xc5fc('0xf'),_0x4536fe,_0x5760ef[_0xc5fc('0xe')]['message']);return _0x30acdb(_0x5760ef[_0xc5fc('0xe')][_0xc5fc('0x10')]);}logger[_0xc5fc('0xe')](_0xc5fc('0xf'),_0x4536fe,_0x5760ef[_0xc5fc('0xe')][_0xc5fc('0x10')]);return _0x31559b(_0x5760ef[_0xc5fc('0xe')][_0xc5fc('0x10')]);}else{logger[_0xc5fc('0x11')]('SquareReport,\x20%s,\x20%s',_0x4536fe,_0xc5fc('0xc'));_0x31559b(_0x5760ef[_0xc5fc('0x12')][_0xc5fc('0x10')]);}})[_0xc5fc('0x13')](function(_0x3b80dd){logger[_0xc5fc('0xe')](_0xc5fc('0xf'),_0x4536fe,_0x3b80dd);_0x30acdb(_0x3b80dd);});});}exports[_0xc5fc('0x14')]=function(_0x4f9fc8){var _0xcf6c7e=this;return new Promise(function(_0x5d57fa,_0x39309b){return db[_0xc5fc('0x15')]['create'](_0x4f9fc8[_0xc5fc('0x16')],{'raw':_0x4f9fc8[_0xc5fc('0x17')]?_0x4f9fc8[_0xc5fc('0x17')][_0xc5fc('0x18')]===undefined?!![]:![]:!![]})[_0xc5fc('0xb')](function(_0x3871ba){logger[_0xc5fc('0x11')]('CreateSquareReport',_0x4f9fc8);logger[_0xc5fc('0x19')](_0xc5fc('0x14'),_0x4f9fc8,JSON['stringify'](_0x3871ba));_0x5d57fa(_0x3871ba);})[_0xc5fc('0x13')](function(_0x5ee193){logger['error'](_0xc5fc('0x14'),_0x5ee193[_0xc5fc('0x10')],_0x4f9fc8);_0x39309b(_0xcf6c7e[_0xc5fc('0xe')](0x1f4,_0x5ee193[_0xc5fc('0x10')]));});});};exports['UpdateSquareReport']=function(_0x80c716){var _0x32a9c7=this;return new Promise(function(_0x186d2c,_0x3266b8){return db['SquareReport'][_0xc5fc('0x1a')](_0x80c716[_0xc5fc('0x16')],{'raw':_0x80c716[_0xc5fc('0x17')]?_0x80c716['options'][_0xc5fc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x80c716[_0xc5fc('0x17')]?_0x80c716['options']['where']||null:null,'attributes':_0x80c716['options']?_0x80c716[_0xc5fc('0x17')][_0xc5fc('0x1b')]||null:null,'limit':_0x80c716[_0xc5fc('0x17')]?_0x80c716[_0xc5fc('0x17')]['limit']||null:null})[_0xc5fc('0xb')](function(_0x51229e){logger[_0xc5fc('0x11')]('UpdateSquareReport',_0x80c716);logger[_0xc5fc('0x19')]('UpdateSquareReport',_0x80c716,JSON[_0xc5fc('0xd')](_0x51229e));_0x186d2c(_0x51229e);})[_0xc5fc('0x13')](function(_0x571c78){logger[_0xc5fc('0xe')](_0xc5fc('0x1c'),_0x571c78[_0xc5fc('0x10')],_0x80c716);_0x3266b8(_0x32a9c7[_0xc5fc('0xe')](0x1f4,_0x571c78['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index cad2f4e..9cade06 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 _0xd3d6=['post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show'];(function(_0x304f9d,_0x2f3ec0){var _0x179bc4=function(_0x30d230){while(--_0x30d230){_0x304f9d['push'](_0x304f9d['shift']());}};_0x179bc4(++_0x2f3ec0);}(_0xd3d6,0x1a8));var _0x6d3d=function(_0x1f4817,_0x432d15){_0x1f4817=_0x1f4817-0x0;var _0x28d3b7=_0xd3d6[_0x1f4817];return _0x28d3b7;};'use strict';var multer=require(_0x6d3d('0x0'));var util=require(_0x6d3d('0x1'));var path=require(_0x6d3d('0x2'));var timeout=require(_0x6d3d('0x3'));var express=require(_0x6d3d('0x4'));var router=express[_0x6d3d('0x5')]();var fs_extra=require(_0x6d3d('0x6'));var auth=require(_0x6d3d('0x7'));var interaction=require(_0x6d3d('0x8'));var config=require(_0x6d3d('0x9'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x6d3d('0xa')](),controller[_0x6d3d('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6d3d('0xc')]);router[_0x6d3d('0xd')](_0x6d3d('0xe'),auth[_0x6d3d('0xa')](),controller[_0x6d3d('0xf')]);router[_0x6d3d('0x10')]('/',auth[_0x6d3d('0xa')](),controller['create']);router['put']('/:id',auth[_0x6d3d('0xa')](),controller[_0x6d3d('0x11')]);router[_0x6d3d('0x12')]('/:id',auth[_0x6d3d('0xa')](),controller[_0x6d3d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4454=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','put','/:id','update','delete'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x4454,0x18d));var _0x4445=function(_0xbb3103,_0x14302c){_0xbb3103=_0xbb3103-0x0;var _0x1d031f=_0x4454[_0xbb3103];return _0x1d031f;};'use strict';var multer=require(_0x4445('0x0'));var util=require(_0x4445('0x1'));var path=require(_0x4445('0x2'));var timeout=require('connect-timeout');var express=require(_0x4445('0x3'));var router=express[_0x4445('0x4')]();var fs_extra=require(_0x4445('0x5'));var auth=require(_0x4445('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4445('0x7'));var controller=require('./squareReportDetail.controller');router[_0x4445('0x8')]('/',auth[_0x4445('0x9')](),controller['index']);router[_0x4445('0x8')](_0x4445('0xa'),auth[_0x4445('0x9')](),controller[_0x4445('0xb')]);router[_0x4445('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4445('0xc')]);router['post']('/',auth[_0x4445('0x9')](),controller['create']);router[_0x4445('0xd')](_0x4445('0xe'),auth[_0x4445('0x9')](),controller[_0x4445('0xf')]);router[_0x4445('0x10')](_0x4445('0xe'),auth[_0x4445('0x9')](),controller[_0x4445('0x11')]);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 b0e96f8..5916d76 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 _0x827e=['STRING','TEXT','exports'];(function(_0xee337d,_0x297a05){var _0x4626e0=function(_0x2a71d6){while(--_0x2a71d6){_0xee337d['push'](_0xee337d['shift']());}};_0x4626e0(++_0x297a05);}(_0x827e,0x1eb));var _0xe827=function(_0x3fa953,_0x1a6d0b){_0x3fa953=_0x3fa953-0x0;var _0x52c593=_0x827e[_0x3fa953];return _0x52c593;};'use strict';var Sequelize=require('sequelize');module[_0xe827('0x0')]={'uniqueid':{'type':Sequelize[_0xe827('0x1')]},'node':{'type':Sequelize[_0xe827('0x1')]},'application':{'type':Sequelize[_0xe827('0x1')]},'data':{'type':Sequelize[_0xe827('0x2')]},'project_name':{'type':Sequelize[_0xe827('0x1')]},'callerid':{'type':Sequelize[_0xe827('0x1')]}}; \ No newline at end of file +var _0x8ae0=['STRING','sequelize','exports'];(function(_0x2b7e66,_0x4e7b3d){var _0x1c49e6=function(_0x391e6f){while(--_0x391e6f){_0x2b7e66['push'](_0x2b7e66['shift']());}};_0x1c49e6(++_0x4e7b3d);}(_0x8ae0,0x115));var _0x08ae=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8ae0[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x08ae('0x0'));module[_0x08ae('0x1')]={'uniqueid':{'type':Sequelize[_0x08ae('0x2')]},'node':{'type':Sequelize[_0x08ae('0x2')]},'application':{'type':Sequelize[_0x08ae('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x08ae('0x2')]},'callerid':{'type':Sequelize[_0x08ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 7f11770..9f7d25a 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 _0xc773=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1c1fdc,_0x4d9736){var _0x706cfd=function(_0x42d680){while(--_0x42d680){_0x1c1fdc['push'](_0x1c1fdc['shift']());}};_0x706cfd(++_0x4d9736);}(_0xc773,0x15e));var _0x3c77=function(_0x38f5e8,_0x6ba3e8){_0x38f5e8=_0x38f5e8-0x0;var _0x22b42d=_0xc773[_0x38f5e8];return _0x22b42d;};'use strict';var emlformat=require(_0x3c77('0x0'));var rimraf=require(_0x3c77('0x1'));var zipdir=require(_0x3c77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c77('0x3'));var moment=require(_0x3c77('0x4'));var BPromise=require(_0x3c77('0x5'));var Mustache=require(_0x3c77('0x6'));var util=require(_0x3c77('0x7'));var path=require('path');var sox=require(_0x3c77('0x8'));var csv=require(_0x3c77('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c77('0xa'));var _=require(_0x3c77('0xb'));var squel=require(_0x3c77('0xc'));var crypto=require(_0x3c77('0xd'));var jsforce=require(_0x3c77('0xe'));var deskjs=require(_0x3c77('0xf'));var toCsv=require(_0x3c77('0x9'));var querystring=require(_0x3c77('0x10'));var Papa=require(_0x3c77('0x11'));var Redis=require(_0x3c77('0x12'));var authService=require(_0x3c77('0x13'));var qs=require(_0x3c77('0x14'));var as=require(_0x3c77('0x15'));var hardwareService=require(_0x3c77('0x16'));var logger=require(_0x3c77('0x17'))(_0x3c77('0x18'));var utils=require(_0x3c77('0x19'));var config=require(_0x3c77('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3c77('0x1b'))['db'];function respondWithStatusCode(_0xec5b96,_0x5741fd){_0x5741fd=_0x5741fd||0xcc;return function(_0x1c9097){if(_0x1c9097){return _0xec5b96[_0x3c77('0x1c')](_0x5741fd);}return _0xec5b96[_0x3c77('0x1d')](_0x5741fd)[_0x3c77('0x1e')]();};}function respondWithResult(_0x1389c8,_0x59153){_0x59153=_0x59153||0xc8;return function(_0x1c1bed){if(_0x1c1bed){return _0x1389c8[_0x3c77('0x1d')](_0x59153)[_0x3c77('0x1f')](_0x1c1bed);}};}function respondWithFilteredResult(_0x3b3b52,_0x389701){return function(_0x216b53){if(_0x216b53){var _0x17da4d=typeof _0x389701[_0x3c77('0x20')]===_0x3c77('0x21')&&typeof _0x389701[_0x3c77('0x22')]==='undefined';var _0x5b9741=_0x216b53[_0x3c77('0x23')];var _0x1f2a89=_0x17da4d?0x0:_0x389701['offset'];var _0x3b56ce=_0x17da4d?_0x216b53[_0x3c77('0x23')]:_0x389701[_0x3c77('0x20')]+_0x389701[_0x3c77('0x22')];var _0x121bcd;if(_0x3b56ce>=_0x5b9741){_0x3b56ce=_0x5b9741;_0x121bcd=0xc8;}else{_0x121bcd=0xce;}_0x3b3b52[_0x3c77('0x1d')](_0x121bcd);return _0x3b3b52[_0x3c77('0x24')]('Content-Range',_0x1f2a89+'-'+_0x3b56ce+'/'+_0x5b9741)[_0x3c77('0x1f')](_0x216b53);}return null;};}function patchUpdates(_0x40ec85){return function(_0x10872f){try{jsonpatch['apply'](_0x10872f,_0x40ec85,!![]);}catch(_0x1990c9){return BPromise[_0x3c77('0x25')](_0x1990c9);}return _0x10872f['save']();};}function saveUpdates(_0x4fbdb8,_0x54f53f){return function(_0x38fd3a){if(_0x38fd3a){return _0x38fd3a[_0x3c77('0x26')](_0x4fbdb8)[_0x3c77('0x27')](function(_0x53e209){return _0x53e209;});}return null;};}function removeEntity(_0x437b46,_0x3dad96){return function(_0x3c955c){if(_0x3c955c){return _0x3c955c['destroy']()[_0x3c77('0x27')](function(){_0x437b46['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7b41,_0x3eec66){return function(_0x2c9207){if(!_0x2c9207){_0x4e7b41[_0x3c77('0x1c')](0x194);}return _0x2c9207;};}function handleError(_0x572689,_0x438d8d){_0x438d8d=_0x438d8d||0x1f4;return function(_0x2673da){logger['error'](_0x2673da[_0x3c77('0x28')]);if(_0x2673da[_0x3c77('0x29')]){delete _0x2673da[_0x3c77('0x29')];}_0x572689[_0x3c77('0x1d')](_0x438d8d)[_0x3c77('0x2a')](_0x2673da);};}exports['index']=function(_0x114163,_0x45a397){var _0x362d83={},_0x42c0ee={},_0x2b6625={'count':0x0,'rows':[]};var _0x2cf0f6=_[_0x3c77('0x2b')](db[_0x3c77('0x2c')][_0x3c77('0x2d')],function(_0x5c3dfb){return{'name':_0x5c3dfb[_0x3c77('0x2e')],'type':_0x5c3dfb[_0x3c77('0x2f')][_0x3c77('0x30')]};});_0x42c0ee['model']=_['map'](_0x2cf0f6,_0x3c77('0x29'));_0x42c0ee[_0x3c77('0x31')]=_[_0x3c77('0x32')](_0x114163[_0x3c77('0x31')]);_0x42c0ee['filters']=_[_0x3c77('0x33')](_0x42c0ee[_0x3c77('0x34')],_0x42c0ee[_0x3c77('0x31')]);_0x362d83[_0x3c77('0x35')]=_[_0x3c77('0x33')](_0x42c0ee[_0x3c77('0x34')],qs['fields'](_0x114163['query'][_0x3c77('0x36')]));_0x362d83[_0x3c77('0x35')]=_0x362d83[_0x3c77('0x35')]['length']?_0x362d83[_0x3c77('0x35')]:_0x42c0ee[_0x3c77('0x34')];if(!_0x114163['query']['hasOwnProperty']('nolimit')){_0x362d83[_0x3c77('0x22')]=qs['limit'](_0x114163[_0x3c77('0x31')][_0x3c77('0x22')]);_0x362d83[_0x3c77('0x20')]=qs['offset'](_0x114163[_0x3c77('0x31')][_0x3c77('0x20')]);}_0x362d83[_0x3c77('0x37')]=qs[_0x3c77('0x38')](_0x114163[_0x3c77('0x31')][_0x3c77('0x38')]);_0x362d83[_0x3c77('0x39')]=qs[_0x3c77('0x3a')](_[_0x3c77('0x3b')](_0x114163[_0x3c77('0x31')],_0x42c0ee[_0x3c77('0x3a')]),_0x2cf0f6);if(_0x114163[_0x3c77('0x31')][_0x3c77('0x3c')]){_0x362d83[_0x3c77('0x39')]=_[_0x3c77('0x3d')](_0x362d83[_0x3c77('0x39')],{'$or':_['map'](_0x2cf0f6,function(_0x13cf53){if(_0x13cf53[_0x3c77('0x2f')]!==_0x3c77('0x3e')){var _0x249611={};_0x249611[_0x13cf53['name']]={'$like':'%'+_0x114163[_0x3c77('0x31')][_0x3c77('0x3c')]+'%'};return _0x249611;}})});}_0x362d83=_[_0x3c77('0x3d')]({},_0x362d83,_0x114163[_0x3c77('0x3f')]);var _0x13ce8d={'where':_0x362d83[_0x3c77('0x39')]};return db[_0x3c77('0x2c')][_0x3c77('0x23')](_0x13ce8d)[_0x3c77('0x27')](function(_0x4aef86){_0x2b6625[_0x3c77('0x23')]=_0x4aef86;if(_0x114163[_0x3c77('0x31')][_0x3c77('0x40')]){_0x362d83[_0x3c77('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x362d83);})[_0x3c77('0x27')](function(_0x469820){_0x2b6625[_0x3c77('0x42')]=_0x469820;return _0x2b6625;})['then'](respondWithFilteredResult(_0x45a397,_0x362d83))[_0x3c77('0x43')](handleError(_0x45a397,null));};exports['show']=function(_0x59fde2,_0x2e27c7){var _0xd0f3f8={'raw':!![],'where':{'id':_0x59fde2[_0x3c77('0x44')]['id']}},_0x23f277={};_0x23f277[_0x3c77('0x34')]=_[_0x3c77('0x32')](db['SquareDetailsReport'][_0x3c77('0x2d')]);_0x23f277[_0x3c77('0x31')]=_[_0x3c77('0x32')](_0x59fde2['query']);_0x23f277['filters']=_[_0x3c77('0x33')](_0x23f277[_0x3c77('0x34')],_0x23f277[_0x3c77('0x31')]);_0xd0f3f8[_0x3c77('0x35')]=_[_0x3c77('0x33')](_0x23f277[_0x3c77('0x34')],qs['fields'](_0x59fde2['query'][_0x3c77('0x36')]));_0xd0f3f8[_0x3c77('0x35')]=_0xd0f3f8[_0x3c77('0x35')]['length']?_0xd0f3f8['attributes']:_0x23f277['model'];if(_0x59fde2[_0x3c77('0x31')]['includeAll']){_0xd0f3f8[_0x3c77('0x41')]=[{'all':!![]}];}_0xd0f3f8=_[_0x3c77('0x3d')]({},_0xd0f3f8,_0x59fde2[_0x3c77('0x3f')]);return db['SquareDetailsReport'][_0x3c77('0x45')](_0xd0f3f8)['then'](handleEntityNotFound(_0x2e27c7,null))['then'](respondWithResult(_0x2e27c7,null))[_0x3c77('0x43')](handleError(_0x2e27c7,null));};exports[_0x3c77('0x46')]=function(_0xe07251,_0x255e92){return db[_0x3c77('0x2c')]['create'](_0xe07251[_0x3c77('0x47')],{})['then'](respondWithResult(_0x255e92,0xc9))['catch'](handleError(_0x255e92,null));};exports[_0x3c77('0x26')]=function(_0x194193,_0x3a42ee){if(_0x194193['body']['id']){delete _0x194193['body']['id'];}return db[_0x3c77('0x2c')][_0x3c77('0x45')]({'where':{'id':_0x194193[_0x3c77('0x44')]['id']}})[_0x3c77('0x27')](handleEntityNotFound(_0x3a42ee,null))[_0x3c77('0x27')](saveUpdates(_0x194193['body'],null))[_0x3c77('0x27')](respondWithResult(_0x3a42ee,null))[_0x3c77('0x43')](handleError(_0x3a42ee,null));};exports[_0x3c77('0x48')]=function(_0x9a4e87,_0x4387cd){return db[_0x3c77('0x2c')][_0x3c77('0x45')]({'where':{'id':_0x9a4e87[_0x3c77('0x44')]['id']}})['then'](handleEntityNotFound(_0x4387cd,null))['then'](removeEntity(_0x4387cd,null))['catch'](handleError(_0x4387cd,null));};exports[_0x3c77('0x49')]=function(_0x5f40cb,_0x4b51d8){return db[_0x3c77('0x2c')]['describe']()[_0x3c77('0x27')](respondWithResult(_0x4b51d8,null))[_0x3c77('0x43')](handleError(_0x4b51d8,null));}; \ No newline at end of file +var _0xe2fc=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','intersection','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','SquareDetailsReport','rawAttributes','type','model','query','keys','filters','attributes'];(function(_0xd67c47,_0x573be0){var _0x4030d5=function(_0x579b38){while(--_0x579b38){_0xd67c47['push'](_0xd67c47['shift']());}};_0x4030d5(++_0x573be0);}(_0xe2fc,0x1ce));var _0xce2f=function(_0x234e86,_0x349928){_0x234e86=_0x234e86-0x0;var _0x4f9891=_0xe2fc[_0x234e86];return _0x4f9891;};'use strict';var emlformat=require(_0xce2f('0x0'));var rimraf=require(_0xce2f('0x1'));var zipdir=require(_0xce2f('0x2'));var jsonpatch=require(_0xce2f('0x3'));var rp=require('request-promise');var moment=require(_0xce2f('0x4'));var BPromise=require(_0xce2f('0x5'));var Mustache=require('mustache');var util=require(_0xce2f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xce2f('0x7'));var ejs=require(_0xce2f('0x8'));var fs=require('fs');var fs_extra=require(_0xce2f('0x9'));var _=require(_0xce2f('0xa'));var squel=require('squel');var crypto=require(_0xce2f('0xb'));var jsforce=require(_0xce2f('0xc'));var deskjs=require(_0xce2f('0xd'));var toCsv=require(_0xce2f('0x7'));var querystring=require('querystring');var Papa=require(_0xce2f('0xe'));var Redis=require('ioredis');var authService=require(_0xce2f('0xf'));var qs=require(_0xce2f('0x10'));var as=require(_0xce2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce2f('0x12'))(_0xce2f('0x13'));var utils=require('../../config/utils');var config=require(_0xce2f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3c20,_0x2f5793){_0x2f5793=_0x2f5793||0xcc;return function(_0x3a379b){if(_0x3a379b){return _0x5c3c20[_0xce2f('0x15')](_0x2f5793);}return _0x5c3c20[_0xce2f('0x16')](_0x2f5793)[_0xce2f('0x17')]();};}function respondWithResult(_0x2b3d61,_0x31faa2){_0x31faa2=_0x31faa2||0xc8;return function(_0x138cbb){if(_0x138cbb){return _0x2b3d61['status'](_0x31faa2)[_0xce2f('0x18')](_0x138cbb);}};}function respondWithFilteredResult(_0x53c4c2,_0x4e6d25){return function(_0x10dd13){if(_0x10dd13){var _0xc12027=typeof _0x4e6d25[_0xce2f('0x19')]===_0xce2f('0x1a')&&typeof _0x4e6d25[_0xce2f('0x1b')]==='undefined';var _0x6a9fe6=_0x10dd13['count'];var _0x2ae29b=_0xc12027?0x0:_0x4e6d25[_0xce2f('0x19')];var _0x229be4=_0xc12027?_0x10dd13['count']:_0x4e6d25[_0xce2f('0x19')]+_0x4e6d25['limit'];var _0x3116f6;if(_0x229be4>=_0x6a9fe6){_0x229be4=_0x6a9fe6;_0x3116f6=0xc8;}else{_0x3116f6=0xce;}_0x53c4c2[_0xce2f('0x16')](_0x3116f6);return _0x53c4c2[_0xce2f('0x1c')](_0xce2f('0x1d'),_0x2ae29b+'-'+_0x229be4+'/'+_0x6a9fe6)['json'](_0x10dd13);}return null;};}function patchUpdates(_0x4426dd){return function(_0x2cd213){try{jsonpatch[_0xce2f('0x1e')](_0x2cd213,_0x4426dd,!![]);}catch(_0x228a6f){return BPromise[_0xce2f('0x1f')](_0x228a6f);}return _0x2cd213[_0xce2f('0x20')]();};}function saveUpdates(_0x251e7c,_0x1d5dab){return function(_0xe9a085){if(_0xe9a085){return _0xe9a085[_0xce2f('0x21')](_0x251e7c)['then'](function(_0x4bffc3){return _0x4bffc3;});}return null;};}function removeEntity(_0x3c7573,_0x292892){return function(_0x109106){if(_0x109106){return _0x109106[_0xce2f('0x22')]()[_0xce2f('0x23')](function(){_0x3c7573['status'](0xcc)[_0xce2f('0x17')]();});}};}function handleEntityNotFound(_0x539947,_0x5f27d2){return function(_0x132e5f){if(!_0x132e5f){_0x539947[_0xce2f('0x15')](0x194);}return _0x132e5f;};}function handleError(_0x4f4a61,_0x44684b){_0x44684b=_0x44684b||0x1f4;return function(_0x42c7a8){logger[_0xce2f('0x24')](_0x42c7a8[_0xce2f('0x25')]);if(_0x42c7a8[_0xce2f('0x26')]){delete _0x42c7a8[_0xce2f('0x26')];}_0x4f4a61[_0xce2f('0x16')](_0x44684b)['send'](_0x42c7a8);};}exports[_0xce2f('0x27')]=function(_0x13e309,_0x10a6dc){var _0x3c9339={},_0x3ae862={},_0x1d6c11={'count':0x0,'rows':[]};var _0xbd6f87=_[_0xce2f('0x28')](db[_0xce2f('0x29')][_0xce2f('0x2a')],function(_0x4a2764){return{'name':_0x4a2764['fieldName'],'type':_0x4a2764[_0xce2f('0x2b')]['key']};});_0x3ae862[_0xce2f('0x2c')]=_[_0xce2f('0x28')](_0xbd6f87,_0xce2f('0x26'));_0x3ae862[_0xce2f('0x2d')]=_[_0xce2f('0x2e')](_0x13e309[_0xce2f('0x2d')]);_0x3ae862[_0xce2f('0x2f')]=_['intersection'](_0x3ae862[_0xce2f('0x2c')],_0x3ae862[_0xce2f('0x2d')]);_0x3c9339[_0xce2f('0x30')]=_['intersection'](_0x3ae862['model'],qs[_0xce2f('0x31')](_0x13e309['query'][_0xce2f('0x31')]));_0x3c9339[_0xce2f('0x30')]=_0x3c9339['attributes'][_0xce2f('0x32')]?_0x3c9339['attributes']:_0x3ae862[_0xce2f('0x2c')];if(!_0x13e309[_0xce2f('0x2d')][_0xce2f('0x33')](_0xce2f('0x34'))){_0x3c9339[_0xce2f('0x1b')]=qs['limit'](_0x13e309[_0xce2f('0x2d')][_0xce2f('0x1b')]);_0x3c9339[_0xce2f('0x19')]=qs[_0xce2f('0x19')](_0x13e309[_0xce2f('0x2d')][_0xce2f('0x19')]);}_0x3c9339[_0xce2f('0x35')]=qs['sort'](_0x13e309[_0xce2f('0x2d')][_0xce2f('0x36')]);_0x3c9339[_0xce2f('0x37')]=qs[_0xce2f('0x2f')](_[_0xce2f('0x38')](_0x13e309[_0xce2f('0x2d')],_0x3ae862[_0xce2f('0x2f')]),_0xbd6f87);if(_0x13e309[_0xce2f('0x2d')][_0xce2f('0x39')]){_0x3c9339['where']=_[_0xce2f('0x3a')](_0x3c9339[_0xce2f('0x37')],{'$or':_['map'](_0xbd6f87,function(_0x356b06){if(_0x356b06[_0xce2f('0x2b')]!==_0xce2f('0x3b')){var _0x4b02c8={};_0x4b02c8[_0x356b06[_0xce2f('0x26')]]={'$like':'%'+_0x13e309[_0xce2f('0x2d')][_0xce2f('0x39')]+'%'};return _0x4b02c8;}})});}_0x3c9339=_['merge']({},_0x3c9339,_0x13e309[_0xce2f('0x3c')]);var _0x2f2651={'where':_0x3c9339[_0xce2f('0x37')]};return db[_0xce2f('0x29')][_0xce2f('0x3d')](_0x2f2651)[_0xce2f('0x23')](function(_0x219e25){_0x1d6c11['count']=_0x219e25;if(_0x13e309[_0xce2f('0x2d')][_0xce2f('0x3e')]){_0x3c9339['include']=[{'all':!![]}];}return db[_0xce2f('0x29')][_0xce2f('0x3f')](_0x3c9339);})[_0xce2f('0x23')](function(_0x59e55a){_0x1d6c11[_0xce2f('0x40')]=_0x59e55a;return _0x1d6c11;})['then'](respondWithFilteredResult(_0x10a6dc,_0x3c9339))[_0xce2f('0x41')](handleError(_0x10a6dc,null));};exports[_0xce2f('0x42')]=function(_0x149043,_0x635afc){var _0x198f4a={'raw':!![],'where':{'id':_0x149043[_0xce2f('0x43')]['id']}},_0x4f5ca8={};_0x4f5ca8[_0xce2f('0x2c')]=_[_0xce2f('0x2e')](db[_0xce2f('0x29')][_0xce2f('0x2a')]);_0x4f5ca8[_0xce2f('0x2d')]=_['keys'](_0x149043['query']);_0x4f5ca8[_0xce2f('0x2f')]=_[_0xce2f('0x44')](_0x4f5ca8['model'],_0x4f5ca8[_0xce2f('0x2d')]);_0x198f4a[_0xce2f('0x30')]=_[_0xce2f('0x44')](_0x4f5ca8[_0xce2f('0x2c')],qs[_0xce2f('0x31')](_0x149043[_0xce2f('0x2d')]['fields']));_0x198f4a[_0xce2f('0x30')]=_0x198f4a[_0xce2f('0x30')][_0xce2f('0x32')]?_0x198f4a[_0xce2f('0x30')]:_0x4f5ca8[_0xce2f('0x2c')];if(_0x149043[_0xce2f('0x2d')]['includeAll']){_0x198f4a[_0xce2f('0x45')]=[{'all':!![]}];}_0x198f4a=_[_0xce2f('0x3a')]({},_0x198f4a,_0x149043[_0xce2f('0x3c')]);return db[_0xce2f('0x29')][_0xce2f('0x46')](_0x198f4a)['then'](handleEntityNotFound(_0x635afc,null))[_0xce2f('0x23')](respondWithResult(_0x635afc,null))[_0xce2f('0x41')](handleError(_0x635afc,null));};exports['create']=function(_0x152241,_0x6c9a6e){return db[_0xce2f('0x29')]['create'](_0x152241[_0xce2f('0x47')],{})[_0xce2f('0x23')](respondWithResult(_0x6c9a6e,0xc9))[_0xce2f('0x41')](handleError(_0x6c9a6e,null));};exports[_0xce2f('0x21')]=function(_0x2bd21f,_0x6edb91){if(_0x2bd21f[_0xce2f('0x47')]['id']){delete _0x2bd21f[_0xce2f('0x47')]['id'];}return db[_0xce2f('0x29')][_0xce2f('0x46')]({'where':{'id':_0x2bd21f[_0xce2f('0x43')]['id']}})[_0xce2f('0x23')](handleEntityNotFound(_0x6edb91,null))['then'](saveUpdates(_0x2bd21f['body'],null))['then'](respondWithResult(_0x6edb91,null))[_0xce2f('0x41')](handleError(_0x6edb91,null));};exports[_0xce2f('0x22')]=function(_0x1d37f7,_0x422376){return db[_0xce2f('0x29')]['find']({'where':{'id':_0x1d37f7[_0xce2f('0x43')]['id']}})[_0xce2f('0x23')](handleEntityNotFound(_0x422376,null))['then'](removeEntity(_0x422376,null))[_0xce2f('0x41')](handleError(_0x422376,null));};exports[_0xce2f('0x48')]=function(_0x1fcfe4,_0x27c283){return db['SquareDetailsReport'][_0xce2f('0x48')]()[_0xce2f('0x23')](respondWithResult(_0x27c283,null))[_0xce2f('0x41')](handleError(_0x27c283,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 8775119..c808f94 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 _0x7fd8=['define','SquareDetailsReport','report_square_details','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fd8,0x87));var _0x87fd=function(_0x26d9a4,_0x507b56){_0x26d9a4=_0x26d9a4-0x0;var _0x32f7ff=_0x7fd8[_0x26d9a4];return _0x32f7ff;};'use strict';var _=require(_0x87fd('0x0'));var util=require('util');var logger=require(_0x87fd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x87fd('0x2'));var rp=require(_0x87fd('0x3'));var fs=require('fs');var path=require(_0x87fd('0x4'));var rimraf=require(_0x87fd('0x5'));var config=require(_0x87fd('0x6'));var attributes=require(_0x87fd('0x7'));module[_0x87fd('0x8')]=function(_0x24faef,_0x98bc11){return _0x24faef[_0x87fd('0x9')](_0x87fd('0xa'),attributes,{'tableName':_0x87fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32f9=['rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xa3694b,_0x5e536c){var _0x32f337=function(_0x415698){while(--_0x415698){_0xa3694b['push'](_0xa3694b['shift']());}};_0x32f337(++_0x5e536c);}(_0x32f9,0x15a));var _0x932f=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x32f9[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x932f('0x0'));var util=require(_0x932f('0x1'));var logger=require(_0x932f('0x2'))('api');var moment=require(_0x932f('0x3'));var BPromise=require(_0x932f('0x4'));var rp=require(_0x932f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x932f('0x6'));var config=require('../../config/environment');var attributes=require(_0x932f('0x7'));module[_0x932f('0x8')]=function(_0x57ebd0,_0x137384){return _0x57ebd0[_0x932f('0x9')](_0x932f('0xa'),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 203d8c2..e6fb324 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 _0x94d4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','stringify','lodash','util','bluebird'];(function(_0x3201e1,_0x6ad573){var _0x2c1ab8=function(_0xb4a975){while(--_0xb4a975){_0x3201e1['push'](_0x3201e1['shift']());}};_0x2c1ab8(++_0x6ad573);}(_0x94d4,0xa5));var _0x494d=function(_0x83b5a0,_0x44f31f){_0x83b5a0=_0x83b5a0-0x0;var _0x445f43=_0x94d4[_0x83b5a0];return _0x445f43;};'use strict';var _=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var moment=require('moment');var BPromise=require(_0x494d('0x2'));var rs=require(_0x494d('0x3'));var fs=require('fs');var Redis=require(_0x494d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x494d('0x5'));var logger=require(_0x494d('0x6'))(_0x494d('0x7'));var config=require(_0x494d('0x8'));var jayson=require(_0x494d('0x9'));var client=jayson[_0x494d('0xa')][_0x494d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c53d7,_0x4f4576,_0x5269db){return new BPromise(function(_0x396280,_0x3f6b68){return client['request'](_0x4c53d7,_0x5269db)['then'](function(_0x456fe8){logger[_0x494d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));logger[_0x494d('0xe')](_0x494d('0xf'),_0x4f4576,_0x494d('0xd'),JSON['stringify'](_0x456fe8));if(_0x456fe8[_0x494d('0x10')]){if(_0x456fe8[_0x494d('0x10')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x3f6b68(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x396280(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}else{logger[_0x494d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));_0x396280(_0x456fe8[_0x494d('0x13')][_0x494d('0x11')]);}})[_0x494d('0x14')](function(_0x120488){logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x120488);_0x3f6b68(_0x120488);});});}exports[_0x494d('0x15')]=function(_0x4301fc){var _0x1552bb=this;return new Promise(function(_0x12a484,_0xd67ea4){return db[_0x494d('0x16')][_0x494d('0x17')](_0x4301fc[_0x494d('0x18')],{'raw':_0x4301fc[_0x494d('0x19')]?_0x4301fc[_0x494d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x494d('0x1a')](function(_0x172763){logger[_0x494d('0xc')](_0x494d('0x15'),_0x4301fc);logger['debug']('CreateSquareDetailsReport',_0x4301fc,JSON[_0x494d('0x1b')](_0x172763));_0x12a484(_0x172763);})[_0x494d('0x14')](function(_0x56e992){logger['error'](_0x494d('0x15'),_0x56e992['message'],_0x4301fc);_0xd67ea4(_0x1552bb[_0x494d('0x10')](0x1f4,_0x56e992['message']));});});}; \ No newline at end of file +var _0x5204=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash'];(function(_0x106840,_0x4ace2c){var _0x428086=function(_0x34b144){while(--_0x34b144){_0x106840['push'](_0x106840['shift']());}};_0x428086(++_0x4ace2c);}(_0x5204,0xdf));var _0x4520=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x5204[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c46c5){logger[_0x4520('0xc')]('CreateSquareDetailsReport',_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x4c46c5));_0x4ba69f(_0x4c46c5);})['catch'](function(_0x3199a9){logger[_0x4520('0x12')](_0x4520('0x17'),_0x3199a9['message'],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x3199a9[_0x4520('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 6fbbb7a..c3261d9 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 _0x9720=['/process/:pid/kill','killProcess','exports','express','../../components/auth/service','isAuthenticated','index'];(function(_0x5d072b,_0x7178){var _0x43a6aa=function(_0x413fb2){while(--_0x413fb2){_0x5d072b['push'](_0x5d072b['shift']());}};_0x43a6aa(++_0x7178);}(_0x9720,0x199));var _0x0972=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x9720[_0x45783c];return _0x1161da;};'use strict';var express=require(_0x0972('0x0'));var router=express['Router']();var auth=require(_0x0972('0x1'));var controller=require('./system.controller');router['get']('/',auth[_0x0972('0x2')](),controller[_0x0972('0x3')]);router['get'](_0x0972('0x4'),auth['isAuthenticated'](),controller[_0x0972('0x5')]);module[_0x0972('0x6')]=router; \ No newline at end of file +var _0xe221=['exports','../../components/auth/service','isAuthenticated','index','get'];(function(_0x31c7d8,_0x10762b){var _0x36c7ab=function(_0x3d3191){while(--_0x3d3191){_0x31c7d8['push'](_0x31c7d8['shift']());}};_0x36c7ab(++_0x10762b);}(_0xe221,0x173));var _0x1e22=function(_0x2d320a,_0x525a16){_0x2d320a=_0x2d320a-0x0;var _0x3b73a3=_0xe221[_0x2d320a];return _0x3b73a3;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1e22('0x0'));var controller=require('./system.controller');router['get']('/',auth[_0x1e22('0x1')](),controller[_0x1e22('0x2')]);router[_0x1e22('0x3')]('/process/:pid/kill',auth[_0x1e22('0x1')](),controller['killProcess']);module[_0x1e22('0x4')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index a3eccc3..a4901a9 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 _0xe509=['then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','catch','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','getAllData'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xe509,0x184));var _0x9e50=function(_0x44ca6e,_0x5e2c91){_0x44ca6e=_0x44ca6e-0x0;var _0x2edab2=_0xe509[_0x44ca6e];return _0x2edab2;};'use strict';var info=require('systeminformation');var exec=require(_0x9e50('0x0'))[_0x9e50('0x1')];var logger=require(_0x9e50('0x2'))(_0x9e50('0x3'));var util=require(_0x9e50('0x4'));var BPromise=require(_0x9e50('0x5'));var _=require('lodash');function handleError(_0x1543e9,_0x284e81,_0x4b5d0c){_0x284e81=_0x284e81||0x1f4;return function(_0x4cab62){logger[_0x9e50('0x6')](_0x9e50('0x7'),_0x4b5d0c,_0x284e81,util[_0x9e50('0x8')](_0x4cab62,{'showHidden':![],'depth':null}));delete _0x4cab62['name'];_0x1543e9[_0x9e50('0x9')](_0x284e81)['send'](_0x4cab62);};}exports[_0x9e50('0xa')]=function(_0x4edba0,_0x3cf787){return info[_0x9e50('0xb')]()[_0x9e50('0xc')](function(_0x33a77f){return _0x3cf787[_0x9e50('0x9')](0xc8)[_0x9e50('0xd')](_0x33a77f);})['catch'](function(_0x10b8ad){return _0x3cf787[_0x9e50('0x9')](0x1f4)[_0x9e50('0xd')](_0x10b8ad);});};exports[_0x9e50('0xe')]=function(_0x25f4da,_0x561ddf){var _0x26c991=[_0x9e50('0xf')];return new BPromise(function(_0x4fc2b6,_0x15b1c3){return exec(util[_0x9e50('0x10')](_0x9e50('0x11'),_0x25f4da[_0x9e50('0x12')][_0x9e50('0x13')]),function(_0x2e6a21,_0x4706e6,_0x3f9012){if(_0x2e6a21){return _0x15b1c3(_0x2e6a21);}return _0x4fc2b6(_0x4706e6);});})['then'](function(_0x43bb34){var _0xd9ec6d=![];var _0x377a46=_0x43bb34[_0x9e50('0x14')](/\n/);for(var _0x34efbc=0x0,_0x4c8a88=_0x26c991[_0x9e50('0x15')];_0x34efbc<_0x4c8a88,_0xd9ec6d===![];_0x34efbc+=0x1){if(_0x43bb34['indexOf'](_0x26c991[_0x34efbc])>=0x0){_0xd9ec6d=!![];}}if(!_0xd9ec6d){throw new Error(util[_0x9e50('0x10')](_0x9e50('0x16'),_0x25f4da[_0x9e50('0x12')]['pid']));}process['kill'](_0x25f4da[_0x9e50('0x12')][_0x9e50('0x13')],_0x9e50('0x17'));return _0x561ddf[_0x9e50('0x9')](0xc8)[_0x9e50('0xd')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x25f4da[_0x9e50('0x12')][_0x9e50('0x13')])});})[_0x9e50('0x18')](handleError(_0x561ddf,null,'killProcess'));}; \ No newline at end of file +var _0x5e87=['length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','systeminformation','exec','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','send','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split'];(function(_0x209e33,_0x377d9d){var _0x584b89=function(_0x2cd439){while(--_0x2cd439){_0x209e33['push'](_0x209e33['shift']());}};_0x584b89(++_0x377d9d);}(_0x5e87,0x119));var _0x75e8=function(_0xfb3127,_0x5380f0){_0xfb3127=_0xfb3127-0x0;var _0x6f5fad=_0x5e87[_0xfb3127];return _0x6f5fad;};'use strict';var info=require(_0x75e8('0x0'));var exec=require('child_process')[_0x75e8('0x1')];var logger=require('../../config/logger')('api');var util=require(_0x75e8('0x2'));var BPromise=require(_0x75e8('0x3'));var _=require(_0x75e8('0x4'));function handleError(_0x2dd5b8,_0x55601b,_0x3b9fb9){_0x55601b=_0x55601b||0x1f4;return function(_0x1f044d){logger['error'](_0x75e8('0x5'),_0x3b9fb9,_0x55601b,util[_0x75e8('0x6')](_0x1f044d,{'showHidden':![],'depth':null}));delete _0x1f044d['name'];_0x2dd5b8['status'](_0x55601b)[_0x75e8('0x7')](_0x1f044d);};}exports['index']=function(_0x433237,_0x93b000){return info['getAllData']()[_0x75e8('0x8')](function(_0x1db3c0){return _0x93b000[_0x75e8('0x9')](0xc8)[_0x75e8('0xa')](_0x1db3c0);})[_0x75e8('0xb')](function(_0x57f084){return _0x93b000[_0x75e8('0x9')](0x1f4)[_0x75e8('0xa')](_0x57f084);});};exports[_0x75e8('0xc')]=function(_0x31956b,_0x4fcae3){var _0x52a510=[_0x75e8('0xd')];return new BPromise(function(_0x7d3698,_0x567cad){return exec(util[_0x75e8('0xe')](_0x75e8('0xf'),_0x31956b['params'][_0x75e8('0x10')]),function(_0x1112db,_0x9a87,_0x12327b){if(_0x1112db){return _0x567cad(_0x1112db);}return _0x7d3698(_0x9a87);});})['then'](function(_0x19df3c){var _0x3f01d9=![];var _0x2dd973=_0x19df3c[_0x75e8('0x11')](/\n/);for(var _0x1c3a05=0x0,_0x161a82=_0x52a510[_0x75e8('0x12')];_0x1c3a05<_0x161a82,_0x3f01d9===![];_0x1c3a05+=0x1){if(_0x19df3c[_0x75e8('0x13')](_0x52a510[_0x1c3a05])>=0x0){_0x3f01d9=!![];}}if(!_0x3f01d9){throw new Error(util['format'](_0x75e8('0x14'),_0x31956b[_0x75e8('0x15')][_0x75e8('0x10')]));}process[_0x75e8('0x16')](_0x31956b['params'][_0x75e8('0x10')],'SIGINT');return _0x4fcae3[_0x75e8('0x9')](0xc8)[_0x75e8('0xa')]({'message':util[_0x75e8('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x31956b[_0x75e8('0x15')][_0x75e8('0x10')])});})[_0x75e8('0xb')](handleError(_0x4fcae3,null,_0x75e8('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7595abf..0fc90b5 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 _0x51b4=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x51b4,0x1a1));var _0x451b=function(_0x5df416,_0xbbc38e){_0x5df416=_0x5df416-0x0;var _0x316693=_0x51b4[_0x5df416];return _0x316693;};'use strict';var multer=require(_0x451b('0x0'));var util=require(_0x451b('0x1'));var path=require(_0x451b('0x2'));var timeout=require(_0x451b('0x3'));var express=require(_0x451b('0x4'));var router=express[_0x451b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x451b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x451b('0x7'));var controller=require(_0x451b('0x8'));router[_0x451b('0x9')]('/',auth[_0x451b('0xa')](),controller[_0x451b('0xb')]);router[_0x451b('0x9')](_0x451b('0xc'),auth[_0x451b('0xa')](),controller[_0x451b('0xd')]);router[_0x451b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x451b('0xf')]);router[_0x451b('0x10')](_0x451b('0xc'),auth[_0x451b('0xa')](),controller[_0x451b('0x11')]);module[_0x451b('0x12')]=router; \ No newline at end of file +var _0x9c90=['../../config/environment','./tag.controller','get','isAuthenticated','index','create','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x198965,_0x1a4925){var _0x44673d=function(_0x228e0c){while(--_0x228e0c){_0x198965['push'](_0x198965['shift']());}};_0x44673d(++_0x1a4925);}(_0x9c90,0xd1));var _0x09c9=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x9c90[_0x5db313];return _0x36d503;};'use strict';var multer=require('multer');var util=require(_0x09c9('0x0'));var path=require('path');var timeout=require(_0x09c9('0x1'));var express=require(_0x09c9('0x2'));var router=express[_0x09c9('0x3')]();var fs_extra=require(_0x09c9('0x4'));var auth=require(_0x09c9('0x5'));var interaction=require(_0x09c9('0x6'));var config=require(_0x09c9('0x7'));var controller=require(_0x09c9('0x8'));router[_0x09c9('0x9')]('/',auth[_0x09c9('0xa')](),controller[_0x09c9('0xb')]);router[_0x09c9('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x09c9('0xa')](),controller[_0x09c9('0xc')]);router[_0x09c9('0xd')](_0x09c9('0xe'),auth['isAuthenticated'](),controller[_0x09c9('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x09c9('0x10')]);module[_0x09c9('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9b3f43d..6ccf0cb 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 _0x1c8a=['sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c8a,0x140));var _0xa1c8=function(_0xff765f,_0xdc88a9){_0xff765f=_0xff765f-0x0;var _0x36ceea=_0x1c8a[_0xff765f];return _0x36ceea;};'use strict';var Sequelize=require(_0xa1c8('0x0'));module[_0xa1c8('0x1')]={'name':{'type':Sequelize[_0xa1c8('0x2')],'unique':_0xa1c8('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa1c8('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa1c8('0x2')]}}; \ No newline at end of file +var _0x689b=['#0091EA','sequelize','STRING'];(function(_0x3b70c9,_0x214dbd){var _0x18d99e=function(_0x2f953d){while(--_0x2f953d){_0x3b70c9['push'](_0x3b70c9['shift']());}};_0x18d99e(++_0x214dbd);}(_0x689b,0x142));var _0xb689=function(_0x48be25,_0x1b9e37){_0x48be25=_0x48be25-0x0;var _0x28c7c7=_0x689b[_0x48be25];return _0x28c7c7;};'use strict';var Sequelize=require(_0xb689('0x0'));module['exports']={'name':{'type':Sequelize[_0xb689('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xb689('0x2')},'description':{'type':Sequelize[_0xb689('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index aa26e97..84e3e6c 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 _0xf3cd=['params','length','find','create','user','UserProfileSection','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x553af2,_0x23cd38){var _0x525181=function(_0x2a76bd){while(--_0x2a76bd){_0x553af2['push'](_0x553af2['shift']());}};_0x525181(++_0x23cd38);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0xf3cd[_0x3f6c29];return _0x4af959;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d483c,_0x166ae5){_0x166ae5=_0x166ae5||0xcc;return function(_0x41fc33){if(_0x41fc33){return _0x1d483c[_0xdf3c('0x1a')](_0x166ae5);}return _0x1d483c['status'](_0x166ae5)[_0xdf3c('0x1b')]();};}function respondWithResult(_0x461079,_0x13ea5f){_0x13ea5f=_0x13ea5f||0xc8;return function(_0x5e0047){if(_0x5e0047){return _0x461079[_0xdf3c('0x1c')](_0x13ea5f)[_0xdf3c('0x1d')](_0x5e0047);}};}function respondWithFilteredResult(_0x173041,_0x4274fd){return function(_0x21e587){if(_0x21e587){var _0x1a7a5a=typeof _0x4274fd[_0xdf3c('0x1e')]===_0xdf3c('0x1f')&&typeof _0x4274fd[_0xdf3c('0x20')]===_0xdf3c('0x1f');var _0x54cdd4=_0x21e587[_0xdf3c('0x21')];var _0x465e7d=_0x1a7a5a?0x0:_0x4274fd[_0xdf3c('0x1e')];var _0x18d4ec=_0x1a7a5a?_0x21e587[_0xdf3c('0x21')]:_0x4274fd[_0xdf3c('0x1e')]+_0x4274fd[_0xdf3c('0x20')];var _0x3ee0af;if(_0x18d4ec>=_0x54cdd4){_0x18d4ec=_0x54cdd4;_0x3ee0af=0xc8;}else{_0x3ee0af=0xce;}_0x173041[_0xdf3c('0x1c')](_0x3ee0af);return _0x173041[_0xdf3c('0x22')](_0xdf3c('0x23'),_0x465e7d+'-'+_0x18d4ec+'/'+_0x54cdd4)[_0xdf3c('0x1d')](_0x21e587);}return null;};}function patchUpdates(_0x25487c){return function(_0x5d2390){try{jsonpatch['apply'](_0x5d2390,_0x25487c,!![]);}catch(_0x3aa254){return BPromise['reject'](_0x3aa254);}return _0x5d2390[_0xdf3c('0x24')]();};}function saveUpdates(_0x40e7ec,_0x36552e){return function(_0x38b319){if(_0x38b319){return _0x38b319[_0xdf3c('0x25')](_0x40e7ec)[_0xdf3c('0x26')](function(_0x50d8ca){return _0x50d8ca;});}return null;};}function removeEntity(_0x22a164,_0x213d75){return function(_0x13e3ca){if(_0x13e3ca){return _0x13e3ca[_0xdf3c('0x27')]()[_0xdf3c('0x26')](function(){var _0x3b5371=_0x13e3ca[_0xdf3c('0x28')]({'plain':!![]});var _0x155f54=_0xdf3c('0x29');return db[_0xdf3c('0x2a')]['destroy']({'where':{'type':_0x155f54,'resourceId':_0x3b5371['id']}})[_0xdf3c('0x26')](function(){return _0x13e3ca;});})[_0xdf3c('0x26')](function(){_0x22a164['status'](0xcc)[_0xdf3c('0x1b')]();});}};}function handleEntityNotFound(_0x59659e,_0x4eaced){return function(_0x508be9){if(!_0x508be9){_0x59659e[_0xdf3c('0x1a')](0x194);}return _0x508be9;};}function handleError(_0x186bba,_0x52b8f6){_0x52b8f6=_0x52b8f6||0x1f4;return function(_0x5c3b5a){logger[_0xdf3c('0x2b')](_0x5c3b5a[_0xdf3c('0x2c')]);if(_0x5c3b5a[_0xdf3c('0x2d')]){delete _0x5c3b5a[_0xdf3c('0x2d')];}_0x186bba['status'](_0x52b8f6)[_0xdf3c('0x2e')](_0x5c3b5a);};}exports[_0xdf3c('0x2f')]=function(_0x5386bf,_0x51e0a4){var _0x1f1d8a={},_0x46f0e3={},_0x36937e={'count':0x0,'rows':[]};var _0x540f3a=_[_0xdf3c('0x30')](db[_0xdf3c('0x31')][_0xdf3c('0x32')],function(_0x10099e){return{'name':_0x10099e['fieldName'],'type':_0x10099e[_0xdf3c('0x33')][_0xdf3c('0x34')]};});_0x46f0e3['model']=_[_0xdf3c('0x30')](_0x540f3a,_0xdf3c('0x2d'));_0x46f0e3[_0xdf3c('0x35')]=_[_0xdf3c('0x36')](_0x5386bf['query']);_0x46f0e3[_0xdf3c('0x37')]=_[_0xdf3c('0x38')](_0x46f0e3[_0xdf3c('0x39')],_0x46f0e3[_0xdf3c('0x35')]);_0x1f1d8a['attributes']=_[_0xdf3c('0x38')](_0x46f0e3[_0xdf3c('0x39')],qs['fields'](_0x5386bf['query'][_0xdf3c('0x3a')]));_0x1f1d8a['attributes']=_0x1f1d8a[_0xdf3c('0x3b')]['length']?_0x1f1d8a['attributes']:_0x46f0e3['model'];if(!_0x5386bf[_0xdf3c('0x35')][_0xdf3c('0x3c')](_0xdf3c('0x3d'))){_0x1f1d8a[_0xdf3c('0x20')]=qs['limit'](_0x5386bf['query'][_0xdf3c('0x20')]);_0x1f1d8a['offset']=qs[_0xdf3c('0x1e')](_0x5386bf[_0xdf3c('0x35')][_0xdf3c('0x1e')]);}_0x1f1d8a[_0xdf3c('0x3e')]=qs[_0xdf3c('0x3f')](_0x5386bf[_0xdf3c('0x35')][_0xdf3c('0x3f')]);_0x1f1d8a[_0xdf3c('0x40')]=qs[_0xdf3c('0x37')](_['pick'](_0x5386bf[_0xdf3c('0x35')],_0x46f0e3['filters']),_0x540f3a);if(_0x5386bf['query'][_0xdf3c('0x41')]){_0x1f1d8a['where']=_[_0xdf3c('0x42')](_0x1f1d8a['where'],{'$or':_[_0xdf3c('0x30')](_0x540f3a,function(_0x27ee91){if(_0x27ee91[_0xdf3c('0x33')]!==_0xdf3c('0x43')){var _0x3098cb={};_0x3098cb[_0x27ee91[_0xdf3c('0x2d')]]={'$like':'%'+_0x5386bf[_0xdf3c('0x35')][_0xdf3c('0x41')]+'%'};return _0x3098cb;}})});}_0x1f1d8a=_[_0xdf3c('0x42')]({},_0x1f1d8a,_0x5386bf[_0xdf3c('0x44')]);var _0x424acf={'where':_0x1f1d8a[_0xdf3c('0x40')]};return db['Tag']['count'](_0x424acf)[_0xdf3c('0x26')](function(_0x5752e6){_0x36937e[_0xdf3c('0x21')]=_0x5752e6;if(_0x5386bf[_0xdf3c('0x35')][_0xdf3c('0x45')]){_0x1f1d8a[_0xdf3c('0x46')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x1f1d8a);})[_0xdf3c('0x26')](function(_0x33edab){_0x36937e[_0xdf3c('0x47')]=_0x33edab;return _0x36937e;})['then'](respondWithFilteredResult(_0x51e0a4,_0x1f1d8a))[_0xdf3c('0x48')](handleError(_0x51e0a4,null));};exports[_0xdf3c('0x49')]=function(_0x6fc3b6,_0x45b25a){var _0x5da4ef={'raw':!![],'where':{'id':_0x6fc3b6[_0xdf3c('0x4a')]['id']}},_0x127685={};_0x127685[_0xdf3c('0x39')]=_[_0xdf3c('0x36')](db[_0xdf3c('0x31')]['rawAttributes']);_0x127685[_0xdf3c('0x35')]=_[_0xdf3c('0x36')](_0x6fc3b6[_0xdf3c('0x35')]);_0x127685[_0xdf3c('0x37')]=_[_0xdf3c('0x38')](_0x127685[_0xdf3c('0x39')],_0x127685['query']);_0x5da4ef['attributes']=_[_0xdf3c('0x38')](_0x127685[_0xdf3c('0x39')],qs['fields'](_0x6fc3b6['query'][_0xdf3c('0x3a')]));_0x5da4ef[_0xdf3c('0x3b')]=_0x5da4ef[_0xdf3c('0x3b')][_0xdf3c('0x4b')]?_0x5da4ef[_0xdf3c('0x3b')]:_0x127685[_0xdf3c('0x39')];if(_0x6fc3b6[_0xdf3c('0x35')][_0xdf3c('0x45')]){_0x5da4ef[_0xdf3c('0x46')]=[{'all':!![]}];}_0x5da4ef=_['merge']({},_0x5da4ef,_0x6fc3b6[_0xdf3c('0x44')]);return db[_0xdf3c('0x31')][_0xdf3c('0x4c')](_0x5da4ef)[_0xdf3c('0x26')](handleEntityNotFound(_0x45b25a,null))[_0xdf3c('0x26')](respondWithResult(_0x45b25a,null))[_0xdf3c('0x48')](handleError(_0x45b25a,null));};exports[_0xdf3c('0x4d')]=function(_0x553f70,_0x1751a8){return db['Tag'][_0xdf3c('0x4d')](_0x553f70['body'],{})[_0xdf3c('0x26')](function(_0x28144f){var _0x2ec575=_0x553f70[_0xdf3c('0x4e')]['get']({'plain':!![]});if(!_0x2ec575)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ec575['role']===_0xdf3c('0x4e')){var _0x5f5726=_0x28144f[_0xdf3c('0x28')]({'plain':!![]});var _0x3b92d6=_0xdf3c('0x29');return db[_0xdf3c('0x4f')][_0xdf3c('0x4c')]({'where':{'name':_0x3b92d6,'userProfileId':_0x2ec575['userProfileId']},'raw':!![]})['then'](function(_0x2371aa){if(_0x2371aa&&_0x2371aa[_0xdf3c('0x50')]===0x0){return db['UserProfileResource'][_0xdf3c('0x4d')]({'name':_0x5f5726[_0xdf3c('0x2d')],'resourceId':_0x5f5726['id'],'type':_0x2371aa[_0xdf3c('0x2d')],'sectionId':_0x2371aa['id']},{})[_0xdf3c('0x26')](function(){return _0x28144f;});}else{return _0x28144f;}})[_0xdf3c('0x48')](function(_0x46dfb1){logger[_0xdf3c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46dfb1);throw _0x46dfb1;});}return _0x28144f;})['then'](respondWithResult(_0x1751a8,0xc9))[_0xdf3c('0x48')](handleError(_0x1751a8,null));};exports[_0xdf3c('0x25')]=function(_0x1bca39,_0x1ad771){if(_0x1bca39[_0xdf3c('0x51')]['id']){delete _0x1bca39[_0xdf3c('0x51')]['id'];}return db[_0xdf3c('0x31')][_0xdf3c('0x4c')]({'where':{'id':_0x1bca39[_0xdf3c('0x4a')]['id']}})[_0xdf3c('0x26')](handleEntityNotFound(_0x1ad771,null))[_0xdf3c('0x26')](saveUpdates(_0x1bca39['body'],null))[_0xdf3c('0x26')](respondWithResult(_0x1ad771,null))['catch'](handleError(_0x1ad771,null));};exports['destroy']=function(_0x5052d5,_0x58fcbf){return db['Tag'][_0xdf3c('0x4c')]({'where':{'id':_0x5052d5[_0xdf3c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58fcbf,null))[_0xdf3c('0x26')](removeEntity(_0x58fcbf,null))[_0xdf3c('0x48')](handleError(_0x58fcbf,null));}; \ No newline at end of file +var _0x593e=['UserProfileResource','error','name','send','index','map','Tag','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','Tags'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x593e,0xcb));var _0xe593=function(_0x3e7c71,_0x48887a){_0x3e7c71=_0x3e7c71-0x0;var _0x5109e8=_0x593e[_0x3e7c71];return _0x5109e8;};'use strict';var emlformat=require(_0xe593('0x0'));var rimraf=require(_0xe593('0x1'));var zipdir=require(_0xe593('0x2'));var jsonpatch=require(_0xe593('0x3'));var rp=require(_0xe593('0x4'));var moment=require(_0xe593('0x5'));var BPromise=require(_0xe593('0x6'));var Mustache=require(_0xe593('0x7'));var util=require('util');var path=require(_0xe593('0x8'));var sox=require(_0xe593('0x9'));var csv=require(_0xe593('0xa'));var ejs=require(_0xe593('0xb'));var fs=require('fs');var fs_extra=require(_0xe593('0xc'));var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];function respondWithStatusCode(_0x8ee313,_0x31dad0){_0x31dad0=_0x31dad0||0xcc;return function(_0x24c9fd){if(_0x24c9fd){return _0x8ee313[_0xe593('0x1c')](_0x31dad0);}return _0x8ee313[_0xe593('0x1d')](_0x31dad0)[_0xe593('0x1e')]();};}function respondWithResult(_0x499819,_0x2907e4){_0x2907e4=_0x2907e4||0xc8;return function(_0x1de391){if(_0x1de391){return _0x499819['status'](_0x2907e4)[_0xe593('0x1f')](_0x1de391);}};}function respondWithFilteredResult(_0x44837b,_0x5d4c6a){return function(_0x2ae9b6){if(_0x2ae9b6){var _0x40416c=typeof _0x5d4c6a[_0xe593('0x20')]===_0xe593('0x21')&&typeof _0x5d4c6a[_0xe593('0x22')]===_0xe593('0x21');var _0x48f3b4=_0x2ae9b6[_0xe593('0x23')];var _0x470d07=_0x40416c?0x0:_0x5d4c6a['offset'];var _0xd1020e=_0x40416c?_0x2ae9b6[_0xe593('0x23')]:_0x5d4c6a['offset']+_0x5d4c6a[_0xe593('0x22')];var _0x3dba1b;if(_0xd1020e>=_0x48f3b4){_0xd1020e=_0x48f3b4;_0x3dba1b=0xc8;}else{_0x3dba1b=0xce;}_0x44837b[_0xe593('0x1d')](_0x3dba1b);return _0x44837b[_0xe593('0x24')](_0xe593('0x25'),_0x470d07+'-'+_0xd1020e+'/'+_0x48f3b4)[_0xe593('0x1f')](_0x2ae9b6);}return null;};}function patchUpdates(_0x3d2a51){return function(_0x4ea53f){try{jsonpatch['apply'](_0x4ea53f,_0x3d2a51,!![]);}catch(_0x1634d4){return BPromise['reject'](_0x1634d4);}return _0x4ea53f['save']();};}function saveUpdates(_0x1bb8e8,_0x3c65b5){return function(_0x57379d){if(_0x57379d){return _0x57379d[_0xe593('0x26')](_0x1bb8e8)['then'](function(_0x1672bf){return _0x1672bf;});}return null;};}function removeEntity(_0x2c191f,_0x185cea){return function(_0x44d997){if(_0x44d997){return _0x44d997[_0xe593('0x27')]()[_0xe593('0x28')](function(){var _0x20a098=_0x44d997[_0xe593('0x29')]({'plain':!![]});var _0x4fc483=_0xe593('0x2a');return db[_0xe593('0x2b')]['destroy']({'where':{'type':_0x4fc483,'resourceId':_0x20a098['id']}})['then'](function(){return _0x44d997;});})[_0xe593('0x28')](function(){_0x2c191f[_0xe593('0x1d')](0xcc)[_0xe593('0x1e')]();});}};}function handleEntityNotFound(_0x43699d,_0x3b66bc){return function(_0x27a3d2){if(!_0x27a3d2){_0x43699d['sendStatus'](0x194);}return _0x27a3d2;};}function handleError(_0x350e2b,_0x54e5e2){_0x54e5e2=_0x54e5e2||0x1f4;return function(_0x1dacf6){logger[_0xe593('0x2c')](_0x1dacf6['stack']);if(_0x1dacf6[_0xe593('0x2d')]){delete _0x1dacf6['name'];}_0x350e2b[_0xe593('0x1d')](_0x54e5e2)[_0xe593('0x2e')](_0x1dacf6);};}exports[_0xe593('0x2f')]=function(_0x501e54,_0x1ae8d9){var _0x13f44={},_0x3066ed={},_0x338222={'count':0x0,'rows':[]};var _0x2588be=_[_0xe593('0x30')](db[_0xe593('0x31')]['rawAttributes'],function(_0x4098a9){return{'name':_0x4098a9[_0xe593('0x32')],'type':_0x4098a9['type'][_0xe593('0x33')]};});_0x3066ed['model']=_[_0xe593('0x30')](_0x2588be,_0xe593('0x2d'));_0x3066ed[_0xe593('0x34')]=_[_0xe593('0x35')](_0x501e54[_0xe593('0x34')]);_0x3066ed[_0xe593('0x36')]=_[_0xe593('0x37')](_0x3066ed[_0xe593('0x38')],_0x3066ed[_0xe593('0x34')]);_0x13f44[_0xe593('0x39')]=_['intersection'](_0x3066ed[_0xe593('0x38')],qs[_0xe593('0x3a')](_0x501e54[_0xe593('0x34')]['fields']));_0x13f44['attributes']=_0x13f44[_0xe593('0x39')]['length']?_0x13f44[_0xe593('0x39')]:_0x3066ed[_0xe593('0x38')];if(!_0x501e54[_0xe593('0x34')][_0xe593('0x3b')](_0xe593('0x3c'))){_0x13f44[_0xe593('0x22')]=qs[_0xe593('0x22')](_0x501e54['query']['limit']);_0x13f44[_0xe593('0x20')]=qs['offset'](_0x501e54[_0xe593('0x34')]['offset']);}_0x13f44[_0xe593('0x3d')]=qs['sort'](_0x501e54['query'][_0xe593('0x3e')]);_0x13f44[_0xe593('0x3f')]=qs[_0xe593('0x36')](_['pick'](_0x501e54['query'],_0x3066ed['filters']),_0x2588be);if(_0x501e54[_0xe593('0x34')]['filter']){_0x13f44[_0xe593('0x3f')]=_[_0xe593('0x40')](_0x13f44[_0xe593('0x3f')],{'$or':_[_0xe593('0x30')](_0x2588be,function(_0x50249e){if(_0x50249e[_0xe593('0x41')]!=='VIRTUAL'){var _0x36c08e={};_0x36c08e[_0x50249e['name']]={'$like':'%'+_0x501e54['query']['filter']+'%'};return _0x36c08e;}})});}_0x13f44=_[_0xe593('0x40')]({},_0x13f44,_0x501e54['options']);var _0x3addf0={'where':_0x13f44[_0xe593('0x3f')]};return db[_0xe593('0x31')]['count'](_0x3addf0)[_0xe593('0x28')](function(_0x3f9784){_0x338222[_0xe593('0x23')]=_0x3f9784;if(_0x501e54[_0xe593('0x34')][_0xe593('0x42')]){_0x13f44[_0xe593('0x43')]=[{'all':!![]}];}return db[_0xe593('0x31')][_0xe593('0x44')](_0x13f44);})['then'](function(_0x211065){_0x338222[_0xe593('0x45')]=_0x211065;return _0x338222;})[_0xe593('0x28')](respondWithFilteredResult(_0x1ae8d9,_0x13f44))[_0xe593('0x46')](handleError(_0x1ae8d9,null));};exports[_0xe593('0x47')]=function(_0x4d3018,_0x4a9a5f){var _0x3fd874={'raw':!![],'where':{'id':_0x4d3018[_0xe593('0x48')]['id']}},_0x380429={};_0x380429['model']=_[_0xe593('0x35')](db[_0xe593('0x31')]['rawAttributes']);_0x380429['query']=_[_0xe593('0x35')](_0x4d3018[_0xe593('0x34')]);_0x380429[_0xe593('0x36')]=_['intersection'](_0x380429[_0xe593('0x38')],_0x380429[_0xe593('0x34')]);_0x3fd874[_0xe593('0x39')]=_[_0xe593('0x37')](_0x380429['model'],qs['fields'](_0x4d3018['query']['fields']));_0x3fd874[_0xe593('0x39')]=_0x3fd874['attributes'][_0xe593('0x49')]?_0x3fd874[_0xe593('0x39')]:_0x380429[_0xe593('0x38')];if(_0x4d3018[_0xe593('0x34')][_0xe593('0x42')]){_0x3fd874[_0xe593('0x43')]=[{'all':!![]}];}_0x3fd874=_[_0xe593('0x40')]({},_0x3fd874,_0x4d3018[_0xe593('0x4a')]);return db['Tag'][_0xe593('0x4b')](_0x3fd874)[_0xe593('0x28')](handleEntityNotFound(_0x4a9a5f,null))[_0xe593('0x28')](respondWithResult(_0x4a9a5f,null))['catch'](handleError(_0x4a9a5f,null));};exports[_0xe593('0x4c')]=function(_0x5dfdb1,_0x39ec9e){return db[_0xe593('0x31')][_0xe593('0x4c')](_0x5dfdb1['body'],{})['then'](function(_0x7431a3){var _0x45beb1=_0x5dfdb1['user']['get']({'plain':!![]});if(!_0x45beb1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45beb1['role']==='user'){var _0x383645=_0x7431a3[_0xe593('0x29')]({'plain':!![]});var _0x1ed8b5=_0xe593('0x2a');return db[_0xe593('0x4d')][_0xe593('0x4b')]({'where':{'name':_0x1ed8b5,'userProfileId':_0x45beb1[_0xe593('0x4e')]},'raw':!![]})[_0xe593('0x28')](function(_0x355ad8){if(_0x355ad8&&_0x355ad8[_0xe593('0x4f')]===0x0){return db[_0xe593('0x2b')][_0xe593('0x4c')]({'name':_0x383645[_0xe593('0x2d')],'resourceId':_0x383645['id'],'type':_0x355ad8[_0xe593('0x2d')],'sectionId':_0x355ad8['id']},{})[_0xe593('0x28')](function(){return _0x7431a3;});}else{return _0x7431a3;}})[_0xe593('0x46')](function(_0x5d60c3){logger[_0xe593('0x2c')](_0xe593('0x50'),_0x5d60c3);throw _0x5d60c3;});}return _0x7431a3;})[_0xe593('0x28')](respondWithResult(_0x39ec9e,0xc9))[_0xe593('0x46')](handleError(_0x39ec9e,null));};exports[_0xe593('0x26')]=function(_0x8130b2,_0x363643){if(_0x8130b2[_0xe593('0x51')]['id']){delete _0x8130b2[_0xe593('0x51')]['id'];}return db[_0xe593('0x31')][_0xe593('0x4b')]({'where':{'id':_0x8130b2[_0xe593('0x48')]['id']}})[_0xe593('0x28')](handleEntityNotFound(_0x363643,null))[_0xe593('0x28')](saveUpdates(_0x8130b2[_0xe593('0x51')],null))['then'](respondWithResult(_0x363643,null))[_0xe593('0x46')](handleError(_0x363643,null));};exports[_0xe593('0x27')]=function(_0x142d0f,_0x24d061){return db[_0xe593('0x31')]['find']({'where':{'id':_0x142d0f['params']['id']}})[_0xe593('0x28')](handleEntityNotFound(_0x24d061,null))[_0xe593('0x28')](removeEntity(_0x24d061,null))[_0xe593('0x46')](handleError(_0x24d061,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 73d00d5..9750dbc 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 _0xc85c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','tools_tags'];(function(_0x508336,_0x153bb8){var _0x1efe18=function(_0x20a011){while(--_0x20a011){_0x508336['push'](_0x508336['shift']());}};_0x1efe18(++_0x153bb8);}(_0xc85c,0xf2));var _0xcc85=function(_0x1b48cd,_0x4e1a55){_0x1b48cd=_0x1b48cd-0x0;var _0x11a3c8=_0xc85c[_0x1b48cd];return _0x11a3c8;};'use strict';var _=require(_0xcc85('0x0'));var util=require(_0xcc85('0x1'));var logger=require('../../config/logger')(_0xcc85('0x2'));var moment=require(_0xcc85('0x3'));var BPromise=require(_0xcc85('0x4'));var rp=require(_0xcc85('0x5'));var fs=require('fs');var path=require(_0xcc85('0x6'));var rimraf=require(_0xcc85('0x7'));var config=require(_0xcc85('0x8'));var attributes=require(_0xcc85('0x9'));module['exports']=function(_0x4db35d,_0x5aeeb3){return _0x4db35d['define']('Tag',attributes,{'tableName':_0xcc85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x163f=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','lodash','util'];(function(_0x27e811,_0x1fad22){var _0x1bfe61=function(_0x2d8d02){while(--_0x2d8d02){_0x27e811['push'](_0x27e811['shift']());}};_0x1bfe61(++_0x1fad22);}(_0x163f,0x6a));var _0xf163=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x163f[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xf163('0x0'));var util=require(_0xf163('0x1'));var logger=require(_0xf163('0x2'))(_0xf163('0x3'));var moment=require('moment');var BPromise=require(_0xf163('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf163('0x5'));var rimraf=require(_0xf163('0x6'));var config=require(_0xf163('0x7'));var attributes=require(_0xf163('0x8'));module[_0xf163('0x9')]=function(_0x134a28,_0x30e36f){return _0x134a28[_0xf163('0xa')](_0xf163('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index a5d7daa..9d6bacc 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 _0xac55=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x40c7f7,_0x42bc78){var _0x479755=function(_0x502b1e){while(--_0x502b1e){_0x40c7f7['push'](_0x40c7f7['shift']());}};_0x479755(++_0x42bc78);}(_0xac55,0x1c8));var _0x5ac5=function(_0x54ba86,_0x38db43){_0x54ba86=_0x54ba86-0x0;var _0x434803=_0xac55[_0x54ba86];return _0x434803;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var moment=require(_0x5ac5('0x2'));var BPromise=require(_0x5ac5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac5('0x4'));var db=require(_0x5ac5('0x5'))['db'];var utils=require(_0x5ac5('0x6'));var logger=require(_0x5ac5('0x7'))(_0x5ac5('0x8'));var config=require(_0x5ac5('0x9'));var jayson=require(_0x5ac5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34093b,_0x247752,_0x2bee03){return new BPromise(function(_0x42551a,_0x455a94){return client[_0x5ac5('0xb')](_0x34093b,_0x2bee03)[_0x5ac5('0xc')](function(_0x5b84a3){logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));logger['debug'](_0x5ac5('0xf'),_0x247752,_0x5ac5('0xe'),JSON['stringify'](_0x5b84a3));if(_0x5b84a3[_0x5ac5('0x10')]){if(_0x5b84a3[_0x5ac5('0x10')]['code']===0x1f4){logger[_0x5ac5('0x10')](_0x5ac5('0xd'),_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x455a94(_0x5b84a3[_0x5ac5('0x10')]['message']);}logger[_0x5ac5('0x10')]('Tag,\x20%s,\x20%s',_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x42551a(_0x5b84a3['error'][_0x5ac5('0x11')]);}else{logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));_0x42551a(_0x5b84a3[_0x5ac5('0x12')][_0x5ac5('0x11')]);}})[_0x5ac5('0x13')](function(_0x3e35e9){logger[_0x5ac5('0x10')]('Tag,\x20%s,\x20%s',_0x247752,_0x3e35e9);_0x455a94(_0x3e35e9);});});} \ No newline at end of file +var _0x8a28=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2d7355,_0x57ae2d){var _0x56cbba=function(_0x5cfa27){while(--_0x5cfa27){_0x2d7355['push'](_0x2d7355['shift']());}};_0x56cbba(++_0x57ae2d);}(_0x8a28,0xfd));var _0x88a2=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x8a28[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var moment=require(_0x88a2('0x2'));var BPromise=require(_0x88a2('0x3'));var rs=require(_0x88a2('0x4'));var fs=require('fs');var Redis=require(_0x88a2('0x5'));var db=require(_0x88a2('0x6'))['db'];var utils=require(_0x88a2('0x7'));var logger=require('../../config/logger')(_0x88a2('0x8'));var config=require(_0x88a2('0x9'));var jayson=require(_0x88a2('0xa'));var client=jayson[_0x88a2('0xb')][_0x88a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cb591,_0x1629ea,_0x5406ed){return new BPromise(function(_0x1cdf6b,_0x2a8576){return client[_0x88a2('0xd')](_0x5cb591,_0x5406ed)[_0x88a2('0xe')](function(_0x2db7dd){logger[_0x88a2('0xf')](_0x88a2('0x10'),_0x1629ea,_0x88a2('0x11'));logger[_0x88a2('0x12')]('Tag,\x20%s,\x20%s,\x20%s',_0x1629ea,'request\x20sent',JSON[_0x88a2('0x13')](_0x2db7dd));if(_0x2db7dd[_0x88a2('0x14')]){if(_0x2db7dd[_0x88a2('0x14')][_0x88a2('0x15')]===0x1f4){logger[_0x88a2('0x14')]('Tag,\x20%s,\x20%s',_0x1629ea,_0x2db7dd[_0x88a2('0x14')][_0x88a2('0x16')]);return _0x2a8576(_0x2db7dd[_0x88a2('0x14')][_0x88a2('0x16')]);}logger['error'](_0x88a2('0x10'),_0x1629ea,_0x2db7dd[_0x88a2('0x14')][_0x88a2('0x16')]);return _0x1cdf6b(_0x2db7dd['error'][_0x88a2('0x16')]);}else{logger[_0x88a2('0xf')](_0x88a2('0x10'),_0x1629ea,_0x88a2('0x11'));_0x1cdf6b(_0x2db7dd[_0x88a2('0x17')][_0x88a2('0x16')]);}})[_0x88a2('0x18')](function(_0x2f5220){logger[_0x88a2('0x14')](_0x88a2('0x10'),_0x1629ea,_0x2f5220);_0x2a8576(_0x2f5220);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ef6ec6a..a7ca8c7 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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 c978a55..30ac5ad 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x30fcc6,_0x427dbd){var _0x3dcf05=function(_0x4b6ae3){while(--_0x4b6ae3){_0x30fcc6['push'](_0x30fcc6['shift']());}};_0x3dcf05(++_0x427dbd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 434c3e1..b901a0c 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 _0x0f7d=['Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','emit','online','interface','upsert','isNil','format','SIP/%s','all','spread','removeAgents','UserVoiceQueueRt','getAgents','eml-format','fast-json-patch','request-promise','bluebird','mustache','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','error','stack','name','send','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','fields','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','findOne','Queues','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Mail','Sms'];(function(_0x4b7ebc,_0x2ca8d3){var _0x33ecb1=function(_0x19bb0b){while(--_0x19bb0b){_0x4b7ebc['push'](_0x4b7ebc['shift']());}};_0x33ecb1(++_0x2ca8d3);}(_0x0f7d,0x1d6));var _0xd0f7=function(_0x741427,_0x21fe4c){_0x741427=_0x741427-0x0;var _0x5e0a59=_0x0f7d[_0x741427];return _0x5e0a59;};'use strict';var emlformat=require(_0xd0f7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0f7('0x1'));var rp=require(_0xd0f7('0x2'));var moment=require('moment');var BPromise=require(_0xd0f7('0x3'));var Mustache=require(_0xd0f7('0x4'));var util=require('util');var path=require(_0xd0f7('0x5'));var sox=require(_0xd0f7('0x6'));var csv=require(_0xd0f7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0f7('0x8'));var _=require(_0xd0f7('0x9'));var squel=require(_0xd0f7('0xa'));var crypto=require(_0xd0f7('0xb'));var jsforce=require(_0xd0f7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd0f7('0x7'));var querystring=require(_0xd0f7('0xd'));var Papa=require(_0xd0f7('0xe'));var Redis=require(_0xd0f7('0xf'));var authService=require(_0xd0f7('0x10'));var qs=require(_0xd0f7('0x11'));var as=require(_0xd0f7('0x12'));var hardwareService=require(_0xd0f7('0x13'));var logger=require(_0xd0f7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd0f7('0x15'));var licenseUtil=require(_0xd0f7('0x16'));var db=require(_0xd0f7('0x17'))['db'];config[_0xd0f7('0x18')]=_[_0xd0f7('0x19')](config[_0xd0f7('0x18')],{'host':_0xd0f7('0x1a'),'port':0x18eb});var socket=require(_0xd0f7('0x1b'))(new Redis(config[_0xd0f7('0x18')]));require(_0xd0f7('0x1c'))['register'](socket);function respondWithStatusCode(_0x4bdf0c,_0x435922){_0x435922=_0x435922||0xcc;return function(_0x52d13a){if(_0x52d13a){return _0x4bdf0c[_0xd0f7('0x1d')](_0x435922);}return _0x4bdf0c[_0xd0f7('0x1e')](_0x435922)[_0xd0f7('0x1f')]();};}function respondWithResult(_0x1a80da,_0xb8a7b0){_0xb8a7b0=_0xb8a7b0||0xc8;return function(_0x553734){if(_0x553734){return _0x1a80da[_0xd0f7('0x1e')](_0xb8a7b0)['json'](_0x553734);}};}function respondWithFilteredResult(_0xc0d9dc,_0x1c4cbf){return function(_0x32d71b){if(_0x32d71b){var _0x414e03=typeof _0x1c4cbf[_0xd0f7('0x20')]===_0xd0f7('0x21')&&typeof _0x1c4cbf[_0xd0f7('0x22')]==='undefined';var _0x4e8f8e=_0x32d71b['count'];var _0x2a9810=_0x414e03?0x0:_0x1c4cbf[_0xd0f7('0x20')];var _0x102a26=_0x414e03?_0x32d71b[_0xd0f7('0x23')]:_0x1c4cbf[_0xd0f7('0x20')]+_0x1c4cbf[_0xd0f7('0x22')];var _0x7ceec7;if(_0x102a26>=_0x4e8f8e){_0x102a26=_0x4e8f8e;_0x7ceec7=0xc8;}else{_0x7ceec7=0xce;}_0xc0d9dc[_0xd0f7('0x1e')](_0x7ceec7);return _0xc0d9dc[_0xd0f7('0x24')](_0xd0f7('0x25'),_0x2a9810+'-'+_0x102a26+'/'+_0x4e8f8e)[_0xd0f7('0x26')](_0x32d71b);}return null;};}function patchUpdates(_0x35b155){return function(_0x14cd4e){try{jsonpatch['apply'](_0x14cd4e,_0x35b155,!![]);}catch(_0x35a9f2){return BPromise[_0xd0f7('0x27')](_0x35a9f2);}return _0x14cd4e[_0xd0f7('0x28')]();};}function saveUpdates(_0x490401,_0x4404fb){return function(_0x1fc3da){if(_0x1fc3da){return _0x1fc3da['update'](_0x490401)[_0xd0f7('0x29')](function(_0x5b0bcf){return _0x5b0bcf;});}return null;};}function handleEntityNotFound(_0x47f0ef,_0x41c158){return function(_0x583c03){if(!_0x583c03){_0x47f0ef[_0xd0f7('0x1d')](0x194);}return _0x583c03;};}function handleError(_0x33875a,_0x27b2a5){_0x27b2a5=_0x27b2a5||0x1f4;return function(_0x5bdede){logger[_0xd0f7('0x2a')](_0x5bdede[_0xd0f7('0x2b')]);if(_0x5bdede[_0xd0f7('0x2c')]){delete _0x5bdede[_0xd0f7('0x2c')];}_0x33875a[_0xd0f7('0x1e')](_0x27b2a5)[_0xd0f7('0x2d')](_0x5bdede);};}exports['index']=function(_0x10208c,_0x49bb94){var _0x3fa7e8={},_0x32638d={},_0x23a0ff={'count':0x0,'rows':[]};var _0x407f88=_[_0xd0f7('0x2e')](db[_0xd0f7('0x2f')][_0xd0f7('0x30')],function(_0xbeaf21){return{'name':_0xbeaf21[_0xd0f7('0x31')],'type':_0xbeaf21[_0xd0f7('0x32')][_0xd0f7('0x33')]};});_0x32638d[_0xd0f7('0x34')]=_[_0xd0f7('0x2e')](_0x407f88,'name');_0x32638d[_0xd0f7('0x35')]=_[_0xd0f7('0x36')](_0x10208c['query']);_0x32638d[_0xd0f7('0x37')]=_[_0xd0f7('0x38')](_0x32638d['model'],_0x32638d[_0xd0f7('0x35')]);_0x3fa7e8[_0xd0f7('0x39')]=_['intersection'](_0x32638d[_0xd0f7('0x34')],qs['fields'](_0x10208c[_0xd0f7('0x35')]['fields']));_0x3fa7e8[_0xd0f7('0x39')]=_0x3fa7e8[_0xd0f7('0x39')][_0xd0f7('0x3a')]?_0x3fa7e8[_0xd0f7('0x39')]:_0x32638d['model'];if(!_0x10208c[_0xd0f7('0x35')][_0xd0f7('0x3b')]('nolimit')){_0x3fa7e8[_0xd0f7('0x22')]=qs[_0xd0f7('0x22')](_0x10208c[_0xd0f7('0x35')][_0xd0f7('0x22')]);_0x3fa7e8[_0xd0f7('0x20')]=qs['offset'](_0x10208c[_0xd0f7('0x35')][_0xd0f7('0x20')]);}_0x3fa7e8['order']=qs[_0xd0f7('0x3c')](_0x10208c[_0xd0f7('0x35')][_0xd0f7('0x3c')]);_0x3fa7e8[_0xd0f7('0x3d')]=qs[_0xd0f7('0x37')](_[_0xd0f7('0x3e')](_0x10208c[_0xd0f7('0x35')],_0x32638d[_0xd0f7('0x37')]),_0x407f88);if(_0x10208c['query'][_0xd0f7('0x3f')]){_0x3fa7e8[_0xd0f7('0x3d')]=_[_0xd0f7('0x40')](_0x3fa7e8[_0xd0f7('0x3d')],{'$or':_[_0xd0f7('0x2e')](_0x407f88,function(_0x1e391f){if(_0x1e391f[_0xd0f7('0x32')]!==_0xd0f7('0x41')){var _0x42509d={};_0x42509d[_0x1e391f[_0xd0f7('0x2c')]]={'$like':'%'+_0x10208c[_0xd0f7('0x35')]['filter']+'%'};return _0x42509d;}})});}_0x3fa7e8=_[_0xd0f7('0x40')]({},_0x3fa7e8,_0x10208c[_0xd0f7('0x42')]);var _0x14cd92={'where':_0x3fa7e8[_0xd0f7('0x3d')]};return db[_0xd0f7('0x2f')]['count'](_0x14cd92)[_0xd0f7('0x29')](function(_0x497957){_0x23a0ff[_0xd0f7('0x23')]=_0x497957;if(_0x10208c[_0xd0f7('0x35')][_0xd0f7('0x43')]){_0x3fa7e8['include']=[{'all':!![]}];}return db[_0xd0f7('0x2f')][_0xd0f7('0x44')](_0x3fa7e8);})[_0xd0f7('0x29')](function(_0x5beec8){_0x23a0ff[_0xd0f7('0x45')]=_0x5beec8;return _0x23a0ff;})[_0xd0f7('0x29')](respondWithFilteredResult(_0x49bb94,_0x3fa7e8))['catch'](handleError(_0x49bb94,null));};exports['show']=function(_0x4256f4,_0x519c63){var _0x28bf7d={'raw':![],'where':{'id':_0x4256f4[_0xd0f7('0x46')]['id']}},_0x5dd9b9={};_0x5dd9b9[_0xd0f7('0x34')]=_['keys'](db[_0xd0f7('0x2f')][_0xd0f7('0x30')]);_0x5dd9b9[_0xd0f7('0x35')]=_['keys'](_0x4256f4['query']);_0x5dd9b9[_0xd0f7('0x37')]=_['intersection'](_0x5dd9b9[_0xd0f7('0x34')],_0x5dd9b9[_0xd0f7('0x35')]);_0x28bf7d[_0xd0f7('0x39')]=_['intersection'](_0x5dd9b9[_0xd0f7('0x34')],qs[_0xd0f7('0x47')](_0x4256f4[_0xd0f7('0x35')][_0xd0f7('0x47')]));_0x28bf7d['attributes']=_0x28bf7d['attributes'][_0xd0f7('0x3a')]?_0x28bf7d['attributes']:_0x5dd9b9[_0xd0f7('0x34')];if(_0x4256f4['query'][_0xd0f7('0x43')]){_0x28bf7d[_0xd0f7('0x48')]=[{'all':!![]}];}_0x28bf7d=_[_0xd0f7('0x40')]({},_0x28bf7d,_0x4256f4[_0xd0f7('0x42')]);return db[_0xd0f7('0x2f')][_0xd0f7('0x49')](_0x28bf7d)[_0xd0f7('0x29')](handleEntityNotFound(_0x519c63,null))[_0xd0f7('0x29')](respondWithResult(_0x519c63,null))['catch'](handleError(_0x519c63,null));};exports[_0xd0f7('0x4a')]=function(_0x1b409d,_0x20899b){return db['Team'][_0xd0f7('0x4a')](_0x1b409d['body'],{})[_0xd0f7('0x29')](function(_0x4e76d9){var _0xd0c214=_0x1b409d['user'][_0xd0f7('0x4b')]({'plain':!![]});if(!_0xd0c214)throw new Error(_0xd0f7('0x4c'));if(_0xd0c214['role']===_0xd0f7('0x4d')){var _0x3eda8e=_0x4e76d9[_0xd0f7('0x4b')]({'plain':!![]});var _0x316792=_0xd0f7('0x4e');return db[_0xd0f7('0x4f')][_0xd0f7('0x49')]({'where':{'name':_0x316792,'userProfileId':_0xd0c214[_0xd0f7('0x50')]},'raw':!![]})['then'](function(_0x5db9bf){if(_0x5db9bf&&_0x5db9bf[_0xd0f7('0x51')]===0x0){return db[_0xd0f7('0x52')]['create']({'name':_0x3eda8e[_0xd0f7('0x2c')],'resourceId':_0x3eda8e['id'],'type':_0x5db9bf[_0xd0f7('0x2c')],'sectionId':_0x5db9bf['id']},{})[_0xd0f7('0x29')](function(){return _0x4e76d9;});}else{return _0x4e76d9;}})[_0xd0f7('0x53')](function(_0x1fb0e0){logger[_0xd0f7('0x2a')](_0xd0f7('0x54'),_0x1fb0e0);throw _0x1fb0e0;});}return _0x4e76d9;})[_0xd0f7('0x29')](respondWithResult(_0x20899b,0xc9))[_0xd0f7('0x53')](handleError(_0x20899b,null));};exports[_0xd0f7('0x55')]=function(_0xf78d26,_0x4361a3){if(_0xf78d26[_0xd0f7('0x56')]['id']){delete _0xf78d26[_0xd0f7('0x56')]['id'];}return db['Team'][_0xd0f7('0x49')]({'where':{'id':_0xf78d26['params']['id']}})[_0xd0f7('0x29')](handleEntityNotFound(_0x4361a3,null))[_0xd0f7('0x29')](saveUpdates(_0xf78d26[_0xd0f7('0x56')],null))[_0xd0f7('0x29')](respondWithResult(_0x4361a3,null))[_0xd0f7('0x53')](handleError(_0x4361a3,null));};exports[_0xd0f7('0x57')]=function(_0x3207c5,_0x5e9359){var _0x4e4565=_0x3207c5['params']['id'];var _0x3a6ab6=[];return db[_0xd0f7('0x58')][_0xd0f7('0x59')](function(_0x3af11b){var _0x2a9372=_0xd0f7('0x5a')+_0x4e4565;return db[_0xd0f7('0x58')][_0xd0f7('0x35')](_0x2a9372,{'type':db[_0xd0f7('0x5b')]['QueryTypes'][_0xd0f7('0x5c')],'raw':!![],'transaction':_0x3af11b})[_0xd0f7('0x29')](function(_0x5aac16){_0x3a6ab6=_['map'](_0x5aac16,function(_0x2ed8a1){return Number(_0x2ed8a1[_0xd0f7('0x5d')]);});})[_0xd0f7('0x29')](function(){var _0x24f072='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4e4565;return db[_0xd0f7('0x58')][_0xd0f7('0x35')](_0x24f072,{'type':db[_0xd0f7('0x5b')][_0xd0f7('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(_0x4dddf1){var _0x4000db=_['map'](_0x4dddf1,function(_0x111d09){return Number(_0x111d09[_0xd0f7('0x5f')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x3a6ab6},'VoiceQueueId':{'$in':_0x4000db}},'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(){var _0x1f90d1=_0xd0f7('0x60')+_0x4e4565;return db[_0xd0f7('0x58')]['query'](_0x1f90d1,{'type':db['Sequelize'][_0xd0f7('0x5e')][_0xd0f7('0x5c')],'raw':!![],'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(_0x1600ab){var _0x373fe3=_[_0xd0f7('0x2e')](_0x1600ab,function(_0x4a945e){return Number(_0x4a945e[_0xd0f7('0x61')]);});return db[_0xd0f7('0x62')][_0xd0f7('0x57')]({'where':{'UserId':{'$in':_0x3a6ab6},'MailQueueId':{'$in':_0x373fe3}},'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(){var _0x145e6e=_0xd0f7('0x63')+_0x4e4565;return db['sequelize'][_0xd0f7('0x35')](_0x145e6e,{'type':db[_0xd0f7('0x5b')][_0xd0f7('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(_0x30dc1c){var _0x189400=_['map'](_0x30dc1c,function(_0x262be6){return Number(_0x262be6[_0xd0f7('0x64')]);});return db['UserSmsQueue'][_0xd0f7('0x57')]({'where':{'UserId':{'$in':_0x3a6ab6},'SmsQueueId':{'$in':_0x189400}},'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(){var _0x226cb5='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4e4565;return db[_0xd0f7('0x58')][_0xd0f7('0x35')](_0x226cb5,{'type':db[_0xd0f7('0x5b')][_0xd0f7('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(_0x41bfa4){var _0x14bbe9=_[_0xd0f7('0x2e')](_0x41bfa4,function(_0x16b313){return Number(_0x16b313[_0xd0f7('0x65')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x3a6ab6},'ChatQueueId':{'$in':_0x14bbe9}},'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(){var _0x41aa24=_0xd0f7('0x66')+_0x4e4565;return db[_0xd0f7('0x58')][_0xd0f7('0x35')](_0x41aa24,{'type':db[_0xd0f7('0x5b')][_0xd0f7('0x5e')][_0xd0f7('0x5c')],'raw':!![],'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(_0x2c3a8a){var _0x1e8a1a=_[_0xd0f7('0x2e')](_0x2c3a8a,function(_0x230899){return Number(_0x230899[_0xd0f7('0x67')]);});return db['UserFaxQueue'][_0xd0f7('0x57')]({'where':{'UserId':{'$in':_0x3a6ab6},'FaxQueueId':{'$in':_0x1e8a1a}},'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(){var _0x5803be=_0xd0f7('0x68')+_0x4e4565;return db[_0xd0f7('0x58')][_0xd0f7('0x35')](_0x5803be,{'type':db[_0xd0f7('0x5b')][_0xd0f7('0x5e')][_0xd0f7('0x5c')],'raw':!![],'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(_0x1a2510){var _0x4bc57c=_[_0xd0f7('0x2e')](_0x1a2510,function(_0x5351b4){return Number(_0x5351b4[_0xd0f7('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x3a6ab6},'OpenchannelQueueId':{'$in':_0x4bc57c}},'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(){var _0x5585b5='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4e4565;return db[_0xd0f7('0x58')][_0xd0f7('0x35')](_0x5585b5,{'type':db[_0xd0f7('0x5b')]['QueryTypes'][_0xd0f7('0x5c')],'raw':!![],'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(_0x125885){var _0x1bd0d8=_[_0xd0f7('0x2e')](_0x125885,function(_0x2e59b2){return Number(_0x2e59b2[_0xd0f7('0x6a')]);});return db[_0xd0f7('0x6b')][_0xd0f7('0x57')]({'where':{'UserId':{'$in':_0x3a6ab6},'WhatsappQueueId':{'$in':_0x1bd0d8}},'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(){return db[_0xd0f7('0x6c')]['find']({'where':{'TeamId':_0x4e4565}});})[_0xd0f7('0x29')](function(_0x1641d1){if(_0x1641d1===null){return;}return db[_0xd0f7('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x3a6ab6},'VoicePrefixId':_0x1641d1[_0xd0f7('0x6e')]},'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(){return db[_0xd0f7('0x2f')]['destroy']({'where':{'id':_0x4e4565},'cascade':!![],'transaction':_0x3af11b});})[_0xd0f7('0x29')](function(_0x136ba4){if(_0x136ba4===0x0){_0x5e9359[_0xd0f7('0x1d')](0x194);}else{return db[_0xd0f7('0x52')]['destroy']({'where':{'type':_0xd0f7('0x4e'),'resourceId':_0x4e4565},'cascade':!![],'transaction':_0x3af11b})['then'](function(){_0x5e9359['status'](0xcc)[_0xd0f7('0x1f')]();});}})['catch'](function(_0x3760af){_0x5e9359[_0xd0f7('0x1e')](0x1f4)[_0xd0f7('0x2d')](_0x3760af);});});};exports['getQueues']=function(_0x300f82,_0x254cdf,_0x3d158f){return db['Team']['findOne']({'where':{'id':_0x300f82[_0xd0f7('0x46')]['id']}})['then'](handleEntityNotFound(_0x254cdf,null))[_0xd0f7('0x29')](function(_0x41a281){if(!_0x300f82['query'][_0xd0f7('0x6f')]||!utils[_0xd0f7('0x70')](_0x300f82[_0xd0f7('0x35')][_0xd0f7('0x6f')])){throw new db[(_0xd0f7('0x5b'))][(_0xd0f7('0x71'))](_0xd0f7('0x72'));}var _0x1627b4={};var _0x31104f={};_0x31104f['model']=_[_0xd0f7('0x36')](db[_[_0xd0f7('0x73')](_0x300f82[_0xd0f7('0x35')][_0xd0f7('0x6f')][_0xd0f7('0x74')]())+_0xd0f7('0x75')]['rawAttributes']);_0x31104f[_0xd0f7('0x35')]=_['keys'](_0x300f82['query']);_0x31104f['filters']=_['intersection'](_0x31104f[_0xd0f7('0x34')],_0x31104f['query']);_0x1627b4[_0xd0f7('0x39')]=_['intersection'](_0x31104f[_0xd0f7('0x34')],qs['fields'](_0x300f82[_0xd0f7('0x35')][_0xd0f7('0x47')]));_0x1627b4['attributes']=_0x1627b4['attributes'][_0xd0f7('0x3a')]?_0x1627b4[_0xd0f7('0x39')]:_0x31104f[_0xd0f7('0x34')];_0x1627b4[_0xd0f7('0x22')]=qs[_0xd0f7('0x22')](_0x300f82[_0xd0f7('0x35')][_0xd0f7('0x22')]);_0x1627b4[_0xd0f7('0x20')]=qs[_0xd0f7('0x20')](_0x300f82[_0xd0f7('0x35')][_0xd0f7('0x20')]);_0x1627b4[_0xd0f7('0x76')]=qs[_0xd0f7('0x3c')](_0x300f82[_0xd0f7('0x35')][_0xd0f7('0x3c')]);_0x1627b4[_0xd0f7('0x3d')]=qs['filters'](_[_0xd0f7('0x3e')](_0x300f82[_0xd0f7('0x35')],_0x31104f[_0xd0f7('0x37')]));_0x1627b4=_[_0xd0f7('0x40')]({},_0x1627b4,_0x300f82[_0xd0f7('0x42')]);return _0x41a281['get'+_[_0xd0f7('0x73')](_0x300f82['query'][_0xd0f7('0x6f')][_0xd0f7('0x74')]())+'Queues'](_0x1627b4);})[_0xd0f7('0x29')](respondWithResult(_0x254cdf,null))[_0xd0f7('0x53')](handleError(_0x254cdf,null));};exports['addQueues']=function(_0x2f6be6,_0x2cf0f6,_0x5434b6){return db[_0xd0f7('0x2f')][_0xd0f7('0x77')]({'where':{'id':_0x2f6be6[_0xd0f7('0x46')]['id']}})[_0xd0f7('0x29')](function(_0x1ad7cd){if(_0x1ad7cd){if(!_0x2f6be6['body'][_0xd0f7('0x6f')]||!utils[_0xd0f7('0x70')](_0x2f6be6[_0xd0f7('0x56')][_0xd0f7('0x6f')])){throw new db[(_0xd0f7('0x5b'))]['ValidationError'](_0xd0f7('0x72'));}return _0x1ad7cd['add'+_[_0xd0f7('0x73')](_0x2f6be6[_0xd0f7('0x56')][_0xd0f7('0x6f')][_0xd0f7('0x74')]())+_0xd0f7('0x78')](_0x2f6be6['body']['ids']);}return null;})[_0xd0f7('0x29')](handleEntityNotFound(_0x2cf0f6,null))[_0xd0f7('0x29')](respondWithStatusCode(_0x2cf0f6,null))[_0xd0f7('0x53')](handleError(_0x2cf0f6,null));};exports[_0xd0f7('0x79')]=function(_0x354166,_0xe91339,_0x44bfbc){return db['Team']['findOne']({'where':{'id':_0x354166[_0xd0f7('0x46')]['id']}})[_0xd0f7('0x29')](function(_0x177a99){if(_0x177a99){if(!_0x354166[_0xd0f7('0x35')][_0xd0f7('0x6f')]||!utils[_0xd0f7('0x70')](_0x354166[_0xd0f7('0x35')][_0xd0f7('0x6f')])){throw new db[(_0xd0f7('0x5b'))][(_0xd0f7('0x71'))](_0xd0f7('0x72'));}return _0x177a99[_0xd0f7('0x7a')+_[_0xd0f7('0x73')](_0x354166[_0xd0f7('0x35')][_0xd0f7('0x6f')][_0xd0f7('0x74')]())+_0xd0f7('0x78')](_0x354166[_0xd0f7('0x35')][_0xd0f7('0x7b')]);}return null;})[_0xd0f7('0x29')](handleEntityNotFound(_0xe91339,null))[_0xd0f7('0x29')](respondWithStatusCode(_0xe91339,null))['catch'](handleError(_0xe91339,null));};exports[_0xd0f7('0x7c')]=function(_0x43345a,_0x40c97c){var _0x655f9a=_[_0xd0f7('0x7d')](_0x43345a[_0xd0f7('0x56')][_0xd0f7('0x7b')])?_0x43345a[_0xd0f7('0x56')]['ids']:[_0x43345a[_0xd0f7('0x56')]['ids']];var _0x3d9278=_0x43345a[_0xd0f7('0x46')]['id'];return db[_0xd0f7('0x2f')][_0xd0f7('0x49')]({'where':{'id':_0x3d9278}})[_0xd0f7('0x29')](handleEntityNotFound(_0x40c97c,null))[_0xd0f7('0x29')](function(_0x53de5a){if(_0x53de5a){var _0x42a988=[_0xd0f7('0x7e'),_0xd0f7('0x7f'),_0xd0f7('0x80'),_0xd0f7('0x81'),_0xd0f7('0x82'),_0xd0f7('0x83'),_0xd0f7('0x84')];return db['sequelize'][_0xd0f7('0x59')](function(_0x4637a1){var _0x529ac4=_[_0xd0f7('0x2e')](_0x42a988,function(_0x10cd50){var _0x571131={'attributes':['id',_0xd0f7('0x2c')]};if(_0x10cd50===_0xd0f7('0x7e')){_0x571131[_0xd0f7('0x85')]={'attributes':[_0xd0f7('0x86')]};}return _0x53de5a[_0xd0f7('0x4b')+_0x10cd50+_0xd0f7('0x78')](_0x571131)['then'](function(_0x381fd8){var _0x4483f2=_['map'](_0x381fd8,function(_0x4ea758){var _0x2c3d26=_[_0xd0f7('0x2e')](_0x655f9a,function(_0x181076){var _0x3ed124={'where':{'UserId':_0x181076,[_0x10cd50+_0xd0f7('0x87')]:_0x4ea758['id']},'transaction':_0x4637a1};if(_0x10cd50===_0xd0f7('0x7e')){_0x3ed124[_0xd0f7('0x19')]={'penalty':_0x4ea758[_0xd0f7('0x88')][_0xd0f7('0x86')]};}return db[_0xd0f7('0x89')+_0x10cd50+_0xd0f7('0x75')]['findOrCreate'](_0x3ed124)[_0xd0f7('0x29')](function(){socket[_0xd0f7('0x8a')](_0xd0f7('0x4d')+_0x10cd50+'Queue:save',{'UserId':_0x181076,[_0x10cd50+_0xd0f7('0x87')]:_0x4ea758['id']});if(_0x10cd50!==_0xd0f7('0x7e')){return;}return db[_0xd0f7('0x89')]['findAll']({'where':{'id':_0x655f9a,'online':0x1},'attributes':['id',_0xd0f7('0x2c'),_0xd0f7('0x8b'),'voicePause',_0xd0f7('0x8c')],'raw':!![]})['then'](function(_0x58b2a2){var _0x2f4d0b=_[_0xd0f7('0x2e')](_0x58b2a2,function(_0x403c83){return db['UserVoiceQueueRt'][_0xd0f7('0x8d')]({'membername':_0x403c83[_0xd0f7('0x2c')],'UserId':_0x403c83['id'],'queue_name':_0x4ea758[_0xd0f7('0x2c')],'VoiceQueueId':_0x4ea758['id'],'interface':_[_0xd0f7('0x8e')](_0x403c83[_0xd0f7('0x8c')])?util[_0xd0f7('0x8f')](_0xd0f7('0x90'),_0x403c83['name']):_0x403c83[_0xd0f7('0x8c')],'paused':_0x403c83['voicePause']||![],'penalty':_0x4ea758['TeamVoiceQueue'][_0xd0f7('0x86')]},{'transaction':_0x4637a1});});return Promise[_0xd0f7('0x91')](_0x2f4d0b);});});});return Promise[_0xd0f7('0x91')](_0x2c3d26);});return Promise['all'](_0x4483f2);})[_0xd0f7('0x29')](function(){return db[_0xd0f7('0x6c')][_0xd0f7('0x77')]({'where':{'teamId':_0x3d9278}})['then'](function(_0x1b94d6){if(_0x1b94d6){var _0x5233a8=_[_0xd0f7('0x2e')](_0x655f9a,function(_0x87032c){db[_0xd0f7('0x6d')][_0xd0f7('0x8d')]({'UserId':_0x87032c,'VoicePrefixId':_0x1b94d6[_0xd0f7('0x6e')]});});return Promise['all'](_0x5233a8);}});});});return Promise[_0xd0f7('0x91')](_0x529ac4)[_0xd0f7('0x29')](function(){return _0x53de5a[_0xd0f7('0x7c')](_0x655f9a,{'transaction':_0x4637a1})[_0xd0f7('0x92')](function(_0x5677e3){return _0x5677e3;});});});}})['then'](respondWithResult(_0x40c97c,null))[_0xd0f7('0x53')](handleError(_0x40c97c,null));};exports[_0xd0f7('0x93')]=function(_0x4076f3,_0x2349a7){var _0x40b1c6=_[_0xd0f7('0x7d')](_0x4076f3['query'][_0xd0f7('0x7b')])?_0x4076f3['query'][_0xd0f7('0x7b')]:[_0x4076f3['query'][_0xd0f7('0x7b')]];var _0x5a7919=_0x4076f3[_0xd0f7('0x46')]['id'];return db['Team'][_0xd0f7('0x49')]({'where':{'id':_0x5a7919}})[_0xd0f7('0x29')](handleEntityNotFound(_0x2349a7,null))[_0xd0f7('0x29')](function(_0x437c1b){if(_0x437c1b){var _0x4d8305=[_0xd0f7('0x7e'),_0xd0f7('0x7f'),_0xd0f7('0x80'),_0xd0f7('0x81'),_0xd0f7('0x82'),'Openchannel',_0xd0f7('0x84')];return db['sequelize'][_0xd0f7('0x59')](function(_0x3f3dbb){var _0x500b16=_[_0xd0f7('0x2e')](_0x4d8305,function(_0x2597e3){var _0x4d7ffc={'attributes':['id',_0xd0f7('0x2c')]};return _0x437c1b[_0xd0f7('0x4b')+_0x2597e3+_0xd0f7('0x78')](_0x4d7ffc)[_0xd0f7('0x29')](function(_0x235520){var _0x2e18d0=_['map'](_0x235520,function(_0x316431){return _0x316431['removeAgents'](_0x40b1c6,{'transaction':_0x3f3dbb})[_0xd0f7('0x29')](function(){var _0xd2a128=_[_0xd0f7('0x2e')](_0x40b1c6,function(_0x4f37b7){socket[_0xd0f7('0x8a')]('user'+_0x2597e3+'Queue:remove',{'UserId':Number(_0x4f37b7),[_0x2597e3+_0xd0f7('0x87')]:_0x316431['id']});if(_0x2597e3!=='Voice'){return;}return db[_0xd0f7('0x94')][_0xd0f7('0x57')]({'where':{'VoiceQueueId':_0x316431['id'],'UserId':_0x4f37b7},'transaction':_0x3f3dbb});});return Promise[_0xd0f7('0x91')](_0xd2a128);});});return Promise[_0xd0f7('0x91')](_0x2e18d0);});});return Promise[_0xd0f7('0x91')](_0x500b16)[_0xd0f7('0x29')](function(){return _0x437c1b[_0xd0f7('0x93')](_0x40b1c6,{'transaction':_0x3f3dbb});})['then'](function(){return db[_0xd0f7('0x6c')][_0xd0f7('0x77')]({'where':{'teamId':_0x5a7919}})[_0xd0f7('0x29')](function(_0x52df9a){if(_0x52df9a){var _0x5cae54=_[_0xd0f7('0x2e')](_0x40b1c6,function(_0x3a8e4f){db[_0xd0f7('0x6d')][_0xd0f7('0x57')]({'where':{'UserId':_0x3a8e4f,'VoicePrefixId':_0x52df9a[_0xd0f7('0x6e')]}});});return Promise[_0xd0f7('0x91')](_0x5cae54);}});});});}})[_0xd0f7('0x29')](respondWithStatusCode(_0x2349a7,null))['catch'](handleError(_0x2349a7,null));};exports[_0xd0f7('0x95')]=function(_0x542b32,_0x1d08c0,_0x4c335d){var _0x167646={};var _0x40442f={};var _0x3ef135;var _0x567b8f;return db[_0xd0f7('0x2f')][_0xd0f7('0x77')]({'where':{'id':_0x542b32[_0xd0f7('0x46')]['id']}})[_0xd0f7('0x29')](handleEntityNotFound(_0x1d08c0,null))[_0xd0f7('0x29')](function(_0x5a4d1c){if(_0x5a4d1c){_0x3ef135=_0x5a4d1c;_0x40442f[_0xd0f7('0x34')]=_[_0xd0f7('0x36')](db[_0xd0f7('0x89')][_0xd0f7('0x30')]);_0x40442f[_0xd0f7('0x35')]=_['keys'](_0x542b32[_0xd0f7('0x35')]);_0x40442f[_0xd0f7('0x37')]=_[_0xd0f7('0x38')](_0x40442f[_0xd0f7('0x34')],_0x40442f['query']);_0x167646[_0xd0f7('0x39')]=_[_0xd0f7('0x38')](_0x40442f[_0xd0f7('0x34')],qs[_0xd0f7('0x47')](_0x542b32[_0xd0f7('0x35')]['fields']));_0x167646[_0xd0f7('0x39')]=_0x167646[_0xd0f7('0x39')][_0xd0f7('0x3a')]?_0x167646[_0xd0f7('0x39')]:_0x40442f[_0xd0f7('0x34')];_0x167646[_0xd0f7('0x76')]=qs[_0xd0f7('0x3c')](_0x542b32[_0xd0f7('0x35')]['sort']);_0x167646['where']=qs[_0xd0f7('0x37')](_[_0xd0f7('0x3e')](_0x542b32[_0xd0f7('0x35')],_0x40442f[_0xd0f7('0x37')]));if(_0x542b32[_0xd0f7('0x35')][_0xd0f7('0x3f')]){_0x167646[_0xd0f7('0x3d')]=_[_0xd0f7('0x40')](_0x167646['where'],{'$or':_[_0xd0f7('0x2e')](_0x167646['attributes'],function(_0x4d5fdd){var _0x56cd1d={};_0x56cd1d[_0x4d5fdd]={'$like':'%'+_0x542b32[_0xd0f7('0x35')]['filter']+'%'};return _0x56cd1d;})});}_0x167646=_[_0xd0f7('0x40')]({},_0x167646,_0x542b32[_0xd0f7('0x42')]);return _0x3ef135[_0xd0f7('0x95')](_0x167646);}})[_0xd0f7('0x29')](function(_0x37ab75){if(_0x37ab75){_0x567b8f=_0x37ab75['length'];if(!_0x542b32['query'][_0xd0f7('0x3b')]('nolimit')){_0x167646[_0xd0f7('0x22')]=qs[_0xd0f7('0x22')](_0x542b32[_0xd0f7('0x35')][_0xd0f7('0x22')]);_0x167646[_0xd0f7('0x20')]=qs[_0xd0f7('0x20')](_0x542b32[_0xd0f7('0x35')][_0xd0f7('0x20')]);}return _0x3ef135['getAgents'](_0x167646);}})[_0xd0f7('0x29')](function(_0x3765ec){if(_0x3765ec){return _0x3765ec?{'count':_0x567b8f,'rows':_0x3765ec}:null;}})[_0xd0f7('0x29')](respondWithResult(_0x1d08c0,null))[_0xd0f7('0x53')](handleError(_0x1d08c0,null));}; \ No newline at end of file +var _0xea32=['UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','getQueues','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','findAll','online','interface','upsert','isNil','SIP/%s','voicePause','all','spread','removeAgents','Sms','Queue:remove','UserVoiceQueueRt','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','./team.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xea32,0x1f2));var _0x2ea3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea32[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x2ea3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ea3('0x1'));var jsonpatch=require(_0x2ea3('0x2'));var rp=require('request-promise');var moment=require(_0x2ea3('0x3'));var BPromise=require(_0x2ea3('0x4'));var Mustache=require('mustache');var util=require(_0x2ea3('0x5'));var path=require(_0x2ea3('0x6'));var sox=require('sox');var csv=require(_0x2ea3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ea3('0x8'));var squel=require('squel');var crypto=require(_0x2ea3('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2ea3('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ea3('0xb'));var qs=require(_0x2ea3('0xc'));var as=require(_0x2ea3('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ea3('0xe'))(_0x2ea3('0xf'));var utils=require(_0x2ea3('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2ea3('0x11')]=_[_0x2ea3('0x12')](config['redis'],{'host':_0x2ea3('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ea3('0x11')]));require(_0x2ea3('0x14'))['register'](socket);function respondWithStatusCode(_0x565f6a,_0x394bc5){_0x394bc5=_0x394bc5||0xcc;return function(_0x55cf17){if(_0x55cf17){return _0x565f6a[_0x2ea3('0x15')](_0x394bc5);}return _0x565f6a[_0x2ea3('0x16')](_0x394bc5)[_0x2ea3('0x17')]();};}function respondWithResult(_0x3ca508,_0x518e7f){_0x518e7f=_0x518e7f||0xc8;return function(_0x574700){if(_0x574700){return _0x3ca508[_0x2ea3('0x16')](_0x518e7f)['json'](_0x574700);}};}function respondWithFilteredResult(_0x53b6eb,_0x28491e){return function(_0x143e86){if(_0x143e86){var _0x756a00=typeof _0x28491e[_0x2ea3('0x18')]==='undefined'&&typeof _0x28491e[_0x2ea3('0x19')]===_0x2ea3('0x1a');var _0x516e7a=_0x143e86[_0x2ea3('0x1b')];var _0x433507=_0x756a00?0x0:_0x28491e['offset'];var _0xbfb566=_0x756a00?_0x143e86[_0x2ea3('0x1b')]:_0x28491e[_0x2ea3('0x18')]+_0x28491e[_0x2ea3('0x19')];var _0x24796d;if(_0xbfb566>=_0x516e7a){_0xbfb566=_0x516e7a;_0x24796d=0xc8;}else{_0x24796d=0xce;}_0x53b6eb[_0x2ea3('0x16')](_0x24796d);return _0x53b6eb[_0x2ea3('0x1c')](_0x2ea3('0x1d'),_0x433507+'-'+_0xbfb566+'/'+_0x516e7a)[_0x2ea3('0x1e')](_0x143e86);}return null;};}function patchUpdates(_0x177004){return function(_0x998792){try{jsonpatch[_0x2ea3('0x1f')](_0x998792,_0x177004,!![]);}catch(_0x304cd8){return BPromise[_0x2ea3('0x20')](_0x304cd8);}return _0x998792[_0x2ea3('0x21')]();};}function saveUpdates(_0x3b9d2c,_0x5ab662){return function(_0x1c0e33){if(_0x1c0e33){return _0x1c0e33[_0x2ea3('0x22')](_0x3b9d2c)[_0x2ea3('0x23')](function(_0x38dd47){return _0x38dd47;});}return null;};}function handleEntityNotFound(_0x171d69,_0x36bf38){return function(_0x535542){if(!_0x535542){_0x171d69[_0x2ea3('0x15')](0x194);}return _0x535542;};}function handleError(_0x14c0b7,_0x313c98){_0x313c98=_0x313c98||0x1f4;return function(_0x5658d6){logger[_0x2ea3('0x24')](_0x5658d6[_0x2ea3('0x25')]);if(_0x5658d6[_0x2ea3('0x26')]){delete _0x5658d6['name'];}_0x14c0b7[_0x2ea3('0x16')](_0x313c98)[_0x2ea3('0x27')](_0x5658d6);};}exports[_0x2ea3('0x28')]=function(_0x2fc1dd,_0x2beea4){var _0x4fbf1d={},_0xf651de={},_0x15382d={'count':0x0,'rows':[]};var _0x5f520a=_['map'](db[_0x2ea3('0x29')][_0x2ea3('0x2a')],function(_0x507436){return{'name':_0x507436[_0x2ea3('0x2b')],'type':_0x507436[_0x2ea3('0x2c')][_0x2ea3('0x2d')]};});_0xf651de[_0x2ea3('0x2e')]=_[_0x2ea3('0x2f')](_0x5f520a,_0x2ea3('0x26'));_0xf651de[_0x2ea3('0x30')]=_[_0x2ea3('0x31')](_0x2fc1dd[_0x2ea3('0x30')]);_0xf651de[_0x2ea3('0x32')]=_['intersection'](_0xf651de[_0x2ea3('0x2e')],_0xf651de[_0x2ea3('0x30')]);_0x4fbf1d[_0x2ea3('0x33')]=_[_0x2ea3('0x34')](_0xf651de[_0x2ea3('0x2e')],qs[_0x2ea3('0x35')](_0x2fc1dd[_0x2ea3('0x30')]['fields']));_0x4fbf1d['attributes']=_0x4fbf1d['attributes'][_0x2ea3('0x36')]?_0x4fbf1d[_0x2ea3('0x33')]:_0xf651de[_0x2ea3('0x2e')];if(!_0x2fc1dd[_0x2ea3('0x30')]['hasOwnProperty']('nolimit')){_0x4fbf1d['limit']=qs[_0x2ea3('0x19')](_0x2fc1dd['query'][_0x2ea3('0x19')]);_0x4fbf1d['offset']=qs[_0x2ea3('0x18')](_0x2fc1dd[_0x2ea3('0x30')]['offset']);}_0x4fbf1d[_0x2ea3('0x37')]=qs[_0x2ea3('0x38')](_0x2fc1dd[_0x2ea3('0x30')]['sort']);_0x4fbf1d['where']=qs[_0x2ea3('0x32')](_[_0x2ea3('0x39')](_0x2fc1dd[_0x2ea3('0x30')],_0xf651de[_0x2ea3('0x32')]),_0x5f520a);if(_0x2fc1dd[_0x2ea3('0x30')][_0x2ea3('0x3a')]){_0x4fbf1d['where']=_[_0x2ea3('0x3b')](_0x4fbf1d[_0x2ea3('0x3c')],{'$or':_['map'](_0x5f520a,function(_0x2ca419){if(_0x2ca419[_0x2ea3('0x2c')]!==_0x2ea3('0x3d')){var _0x1f30f4={};_0x1f30f4[_0x2ca419[_0x2ea3('0x26')]]={'$like':'%'+_0x2fc1dd['query'][_0x2ea3('0x3a')]+'%'};return _0x1f30f4;}})});}_0x4fbf1d=_[_0x2ea3('0x3b')]({},_0x4fbf1d,_0x2fc1dd[_0x2ea3('0x3e')]);var _0x4213e5={'where':_0x4fbf1d[_0x2ea3('0x3c')]};return db[_0x2ea3('0x29')][_0x2ea3('0x1b')](_0x4213e5)[_0x2ea3('0x23')](function(_0x55c33c){_0x15382d[_0x2ea3('0x1b')]=_0x55c33c;if(_0x2fc1dd[_0x2ea3('0x30')][_0x2ea3('0x3f')]){_0x4fbf1d[_0x2ea3('0x40')]=[{'all':!![]}];}return db[_0x2ea3('0x29')]['findAll'](_0x4fbf1d);})[_0x2ea3('0x23')](function(_0x5d77d){_0x15382d['rows']=_0x5d77d;return _0x15382d;})['then'](respondWithFilteredResult(_0x2beea4,_0x4fbf1d))[_0x2ea3('0x41')](handleError(_0x2beea4,null));};exports['show']=function(_0x493afe,_0x451791){var _0x1949f3={'raw':![],'where':{'id':_0x493afe[_0x2ea3('0x42')]['id']}},_0x2634a2={};_0x2634a2[_0x2ea3('0x2e')]=_[_0x2ea3('0x31')](db[_0x2ea3('0x29')][_0x2ea3('0x2a')]);_0x2634a2[_0x2ea3('0x30')]=_[_0x2ea3('0x31')](_0x493afe[_0x2ea3('0x30')]);_0x2634a2[_0x2ea3('0x32')]=_[_0x2ea3('0x34')](_0x2634a2[_0x2ea3('0x2e')],_0x2634a2[_0x2ea3('0x30')]);_0x1949f3['attributes']=_['intersection'](_0x2634a2['model'],qs['fields'](_0x493afe['query'][_0x2ea3('0x35')]));_0x1949f3[_0x2ea3('0x33')]=_0x1949f3[_0x2ea3('0x33')][_0x2ea3('0x36')]?_0x1949f3[_0x2ea3('0x33')]:_0x2634a2[_0x2ea3('0x2e')];if(_0x493afe[_0x2ea3('0x30')][_0x2ea3('0x3f')]){_0x1949f3[_0x2ea3('0x40')]=[{'all':!![]}];}_0x1949f3=_[_0x2ea3('0x3b')]({},_0x1949f3,_0x493afe[_0x2ea3('0x3e')]);return db[_0x2ea3('0x29')][_0x2ea3('0x43')](_0x1949f3)[_0x2ea3('0x23')](handleEntityNotFound(_0x451791,null))[_0x2ea3('0x23')](respondWithResult(_0x451791,null))[_0x2ea3('0x41')](handleError(_0x451791,null));};exports[_0x2ea3('0x44')]=function(_0x5152a4,_0xa3f392){return db['Team'][_0x2ea3('0x44')](_0x5152a4['body'],{})[_0x2ea3('0x23')](function(_0xe73baa){var _0xb95830=_0x5152a4['user']['get']({'plain':!![]});if(!_0xb95830)throw new Error(_0x2ea3('0x45'));if(_0xb95830[_0x2ea3('0x46')]===_0x2ea3('0x47')){var _0x10a6ba=_0xe73baa[_0x2ea3('0x48')]({'plain':!![]});var _0x477e93='Teams';return db[_0x2ea3('0x49')]['find']({'where':{'name':_0x477e93,'userProfileId':_0xb95830[_0x2ea3('0x4a')]},'raw':!![]})[_0x2ea3('0x23')](function(_0x3f6e3e){if(_0x3f6e3e&&_0x3f6e3e[_0x2ea3('0x4b')]===0x0){return db[_0x2ea3('0x4c')][_0x2ea3('0x44')]({'name':_0x10a6ba[_0x2ea3('0x26')],'resourceId':_0x10a6ba['id'],'type':_0x3f6e3e['name'],'sectionId':_0x3f6e3e['id']},{})['then'](function(){return _0xe73baa;});}else{return _0xe73baa;}})[_0x2ea3('0x41')](function(_0x1b7a03){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b7a03);throw _0x1b7a03;});}return _0xe73baa;})[_0x2ea3('0x23')](respondWithResult(_0xa3f392,0xc9))[_0x2ea3('0x41')](handleError(_0xa3f392,null));};exports['update']=function(_0x37496f,_0xf0f191){if(_0x37496f[_0x2ea3('0x4d')]['id']){delete _0x37496f[_0x2ea3('0x4d')]['id'];}return db['Team'][_0x2ea3('0x43')]({'where':{'id':_0x37496f[_0x2ea3('0x42')]['id']}})[_0x2ea3('0x23')](handleEntityNotFound(_0xf0f191,null))['then'](saveUpdates(_0x37496f[_0x2ea3('0x4d')],null))[_0x2ea3('0x23')](respondWithResult(_0xf0f191,null))[_0x2ea3('0x41')](handleError(_0xf0f191,null));};exports['destroy']=function(_0x3ee238,_0x4fb642){var _0x10f40d=_0x3ee238[_0x2ea3('0x42')]['id'];var _0x2ebc02=[];return db['sequelize'][_0x2ea3('0x4e')](function(_0x1cb91b){var _0x4d5255=_0x2ea3('0x4f')+_0x10f40d;return db[_0x2ea3('0x50')]['query'](_0x4d5255,{'type':db[_0x2ea3('0x51')][_0x2ea3('0x52')][_0x2ea3('0x53')],'raw':!![],'transaction':_0x1cb91b})[_0x2ea3('0x23')](function(_0x43e2bb){_0x2ebc02=_[_0x2ea3('0x2f')](_0x43e2bb,function(_0x326cfb){return Number(_0x326cfb[_0x2ea3('0x54')]);});})[_0x2ea3('0x23')](function(){var _0x161f84='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x10f40d;return db[_0x2ea3('0x50')][_0x2ea3('0x30')](_0x161f84,{'type':db[_0x2ea3('0x51')]['QueryTypes'][_0x2ea3('0x53')],'raw':!![],'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(_0x4fd8b6){var _0x3cb471=_[_0x2ea3('0x2f')](_0x4fd8b6,function(_0x34f084){return Number(_0x34f084[_0x2ea3('0x55')]);});return db[_0x2ea3('0x56')][_0x2ea3('0x57')]({'where':{'UserId':{'$in':_0x2ebc02},'VoiceQueueId':{'$in':_0x3cb471}},'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(){var _0x5b38ac=_0x2ea3('0x58')+_0x10f40d;return db[_0x2ea3('0x50')][_0x2ea3('0x30')](_0x5b38ac,{'type':db[_0x2ea3('0x51')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(_0x4fd8ee){var _0x8b7c75=_[_0x2ea3('0x2f')](_0x4fd8ee,function(_0x2738fa){return Number(_0x2738fa[_0x2ea3('0x59')]);});return db[_0x2ea3('0x5a')][_0x2ea3('0x57')]({'where':{'UserId':{'$in':_0x2ebc02},'MailQueueId':{'$in':_0x8b7c75}},'transaction':_0x1cb91b});})['then'](function(){var _0x1e1892=_0x2ea3('0x5b')+_0x10f40d;return db[_0x2ea3('0x50')]['query'](_0x1e1892,{'type':db[_0x2ea3('0x51')][_0x2ea3('0x52')][_0x2ea3('0x53')],'raw':!![],'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(_0x1e4ffe){var _0x2ee396=_[_0x2ea3('0x2f')](_0x1e4ffe,function(_0x51a25c){return Number(_0x51a25c['SmsQueueId']);});return db['UserSmsQueue'][_0x2ea3('0x57')]({'where':{'UserId':{'$in':_0x2ebc02},'SmsQueueId':{'$in':_0x2ee396}},'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(){var _0x181978='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x10f40d;return db[_0x2ea3('0x50')]['query'](_0x181978,{'type':db[_0x2ea3('0x51')]['QueryTypes'][_0x2ea3('0x53')],'raw':!![],'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(_0x62ad3d){var _0x59ec01=_['map'](_0x62ad3d,function(_0x89c765){return Number(_0x89c765[_0x2ea3('0x5c')]);});return db[_0x2ea3('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x2ebc02},'ChatQueueId':{'$in':_0x59ec01}},'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(){var _0xa3ee77=_0x2ea3('0x5e')+_0x10f40d;return db[_0x2ea3('0x50')][_0x2ea3('0x30')](_0xa3ee77,{'type':db['Sequelize']['QueryTypes'][_0x2ea3('0x53')],'raw':!![],'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(_0x39188a){var _0x49d012=_['map'](_0x39188a,function(_0x3fdb37){return Number(_0x3fdb37[_0x2ea3('0x5f')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x2ebc02},'FaxQueueId':{'$in':_0x49d012}},'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(){var _0x2072bd='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x10f40d;return db[_0x2ea3('0x50')]['query'](_0x2072bd,{'type':db['Sequelize'][_0x2ea3('0x52')][_0x2ea3('0x53')],'raw':!![],'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(_0x2f6420){var _0x16c8ee=_[_0x2ea3('0x2f')](_0x2f6420,function(_0x30148c){return Number(_0x30148c['OpenchannelQueueId']);});return db[_0x2ea3('0x60')][_0x2ea3('0x57')]({'where':{'UserId':{'$in':_0x2ebc02},'OpenchannelQueueId':{'$in':_0x16c8ee}},'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(){var _0x46c78e=_0x2ea3('0x61')+_0x10f40d;return db[_0x2ea3('0x50')][_0x2ea3('0x30')](_0x46c78e,{'type':db[_0x2ea3('0x51')][_0x2ea3('0x52')][_0x2ea3('0x53')],'raw':!![],'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(_0x28afad){var _0x95e91a=_['map'](_0x28afad,function(_0xcc065f){return Number(_0xcc065f['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x2ebc02},'WhatsappQueueId':{'$in':_0x95e91a}},'transaction':_0x1cb91b});})['then'](function(){return db[_0x2ea3('0x62')][_0x2ea3('0x43')]({'where':{'TeamId':_0x10f40d}});})[_0x2ea3('0x23')](function(_0xd60b4d){if(_0xd60b4d===null){return;}return db[_0x2ea3('0x63')][_0x2ea3('0x57')]({'where':{'UserId':{'$in':_0x2ebc02},'VoicePrefixId':_0xd60b4d[_0x2ea3('0x64')]},'transaction':_0x1cb91b});})['then'](function(){return db[_0x2ea3('0x29')][_0x2ea3('0x57')]({'where':{'id':_0x10f40d},'cascade':!![],'transaction':_0x1cb91b});})[_0x2ea3('0x23')](function(_0x1fb5f0){if(_0x1fb5f0===0x0){_0x4fb642[_0x2ea3('0x15')](0x194);}else{return db['UserProfileResource'][_0x2ea3('0x57')]({'where':{'type':_0x2ea3('0x65'),'resourceId':_0x10f40d},'cascade':!![],'transaction':_0x1cb91b})['then'](function(){_0x4fb642[_0x2ea3('0x16')](0xcc)['end']();});}})['catch'](function(_0x109321){_0x4fb642['status'](0x1f4)[_0x2ea3('0x27')](_0x109321);});});};exports[_0x2ea3('0x66')]=function(_0x26169a,_0x5f4db1,_0x5cb33e){return db['Team']['findOne']({'where':{'id':_0x26169a['params']['id']}})[_0x2ea3('0x23')](handleEntityNotFound(_0x5f4db1,null))[_0x2ea3('0x23')](function(_0x55fe98){if(!_0x26169a[_0x2ea3('0x30')]['channel']||!utils[_0x2ea3('0x67')](_0x26169a['query'][_0x2ea3('0x68')])){throw new db[(_0x2ea3('0x51'))][(_0x2ea3('0x69'))](_0x2ea3('0x6a'));}var _0x19aedc={};var _0x3b66d0={};_0x3b66d0['model']=_[_0x2ea3('0x31')](db[_[_0x2ea3('0x6b')](_0x26169a['query'][_0x2ea3('0x68')][_0x2ea3('0x6c')]())+_0x2ea3('0x6d')][_0x2ea3('0x2a')]);_0x3b66d0[_0x2ea3('0x30')]=_[_0x2ea3('0x31')](_0x26169a['query']);_0x3b66d0[_0x2ea3('0x32')]=_['intersection'](_0x3b66d0[_0x2ea3('0x2e')],_0x3b66d0['query']);_0x19aedc['attributes']=_[_0x2ea3('0x34')](_0x3b66d0[_0x2ea3('0x2e')],qs[_0x2ea3('0x35')](_0x26169a['query'][_0x2ea3('0x35')]));_0x19aedc[_0x2ea3('0x33')]=_0x19aedc['attributes']['length']?_0x19aedc[_0x2ea3('0x33')]:_0x3b66d0[_0x2ea3('0x2e')];_0x19aedc[_0x2ea3('0x19')]=qs['limit'](_0x26169a[_0x2ea3('0x30')][_0x2ea3('0x19')]);_0x19aedc[_0x2ea3('0x18')]=qs['offset'](_0x26169a['query'][_0x2ea3('0x18')]);_0x19aedc[_0x2ea3('0x37')]=qs[_0x2ea3('0x38')](_0x26169a[_0x2ea3('0x30')][_0x2ea3('0x38')]);_0x19aedc[_0x2ea3('0x3c')]=qs['filters'](_[_0x2ea3('0x39')](_0x26169a[_0x2ea3('0x30')],_0x3b66d0[_0x2ea3('0x32')]));_0x19aedc=_[_0x2ea3('0x3b')]({},_0x19aedc,_0x26169a['options']);return _0x55fe98[_0x2ea3('0x48')+_[_0x2ea3('0x6b')](_0x26169a['query']['channel'][_0x2ea3('0x6c')]())+_0x2ea3('0x6e')](_0x19aedc);})[_0x2ea3('0x23')](respondWithResult(_0x5f4db1,null))[_0x2ea3('0x41')](handleError(_0x5f4db1,null));};exports[_0x2ea3('0x6f')]=function(_0x19fc59,_0x4bb0d9,_0x15caf5){return db[_0x2ea3('0x29')][_0x2ea3('0x70')]({'where':{'id':_0x19fc59['params']['id']}})[_0x2ea3('0x23')](function(_0x1c195d){if(_0x1c195d){if(!_0x19fc59['body'][_0x2ea3('0x68')]||!utils['isValidChannel'](_0x19fc59[_0x2ea3('0x4d')][_0x2ea3('0x68')])){throw new db[(_0x2ea3('0x51'))]['ValidationError'](_0x2ea3('0x6a'));}return _0x1c195d[_0x2ea3('0x71')+_[_0x2ea3('0x6b')](_0x19fc59['body'][_0x2ea3('0x68')][_0x2ea3('0x6c')]())+_0x2ea3('0x6e')](_0x19fc59[_0x2ea3('0x4d')][_0x2ea3('0x72')]);}return null;})[_0x2ea3('0x23')](handleEntityNotFound(_0x4bb0d9,null))[_0x2ea3('0x23')](respondWithStatusCode(_0x4bb0d9,null))['catch'](handleError(_0x4bb0d9,null));};exports[_0x2ea3('0x73')]=function(_0x402b07,_0x481c70,_0x1e2e22){return db[_0x2ea3('0x29')][_0x2ea3('0x70')]({'where':{'id':_0x402b07['params']['id']}})[_0x2ea3('0x23')](function(_0x4f0ca0){if(_0x4f0ca0){if(!_0x402b07[_0x2ea3('0x30')][_0x2ea3('0x68')]||!utils['isValidChannel'](_0x402b07['query'][_0x2ea3('0x68')])){throw new db['Sequelize'][(_0x2ea3('0x69'))](_0x2ea3('0x6a'));}return _0x4f0ca0[_0x2ea3('0x74')+_[_0x2ea3('0x6b')](_0x402b07[_0x2ea3('0x30')]['channel'][_0x2ea3('0x6c')]())+_0x2ea3('0x6e')](_0x402b07['query'][_0x2ea3('0x72')]);}return null;})[_0x2ea3('0x23')](handleEntityNotFound(_0x481c70,null))[_0x2ea3('0x23')](respondWithStatusCode(_0x481c70,null))[_0x2ea3('0x41')](handleError(_0x481c70,null));};exports[_0x2ea3('0x75')]=function(_0x59a668,_0x5216f3){var _0x2dbade=_[_0x2ea3('0x76')](_0x59a668[_0x2ea3('0x4d')][_0x2ea3('0x72')])?_0x59a668[_0x2ea3('0x4d')][_0x2ea3('0x72')]:[_0x59a668[_0x2ea3('0x4d')][_0x2ea3('0x72')]];var _0x3d327a=_0x59a668['params']['id'];return db[_0x2ea3('0x29')][_0x2ea3('0x43')]({'where':{'id':_0x3d327a}})[_0x2ea3('0x23')](handleEntityNotFound(_0x5216f3,null))[_0x2ea3('0x23')](function(_0x483206){if(_0x483206){var _0x48465c=[_0x2ea3('0x77'),_0x2ea3('0x78'),_0x2ea3('0x79'),'Sms',_0x2ea3('0x7a'),_0x2ea3('0x7b'),_0x2ea3('0x7c')];return db['sequelize'][_0x2ea3('0x4e')](function(_0x56cf7b){var _0x393307=_[_0x2ea3('0x2f')](_0x48465c,function(_0x529677){var _0x3e62d5={'attributes':['id',_0x2ea3('0x26')]};if(_0x529677===_0x2ea3('0x77')){_0x3e62d5[_0x2ea3('0x7d')]={'attributes':['penalty']};}return _0x483206[_0x2ea3('0x48')+_0x529677+_0x2ea3('0x6e')](_0x3e62d5)[_0x2ea3('0x23')](function(_0x2f439a){var _0x750950=_[_0x2ea3('0x2f')](_0x2f439a,function(_0x519d42){var _0x3c64a2=_[_0x2ea3('0x2f')](_0x2dbade,function(_0x3beb04){var _0x212a04={'where':{'UserId':_0x3beb04,[_0x529677+'QueueId']:_0x519d42['id']},'transaction':_0x56cf7b};if(_0x529677==='Voice'){_0x212a04['defaults']={'penalty':_0x519d42[_0x2ea3('0x7e')][_0x2ea3('0x7f')]};}return db[_0x2ea3('0x80')+_0x529677+_0x2ea3('0x6d')][_0x2ea3('0x81')](_0x212a04)['then'](function(){socket[_0x2ea3('0x82')](_0x2ea3('0x47')+_0x529677+_0x2ea3('0x83'),{'UserId':_0x3beb04,[_0x529677+'QueueId']:_0x519d42['id']});if(_0x529677!=='Voice'){return;}return db[_0x2ea3('0x80')][_0x2ea3('0x84')]({'where':{'id':_0x2dbade,'online':0x1},'attributes':['id',_0x2ea3('0x26'),_0x2ea3('0x85'),'voicePause',_0x2ea3('0x86')],'raw':!![]})[_0x2ea3('0x23')](function(_0x42545c){var _0x3f8418=_[_0x2ea3('0x2f')](_0x42545c,function(_0x34b0f8){return db['UserVoiceQueueRt'][_0x2ea3('0x87')]({'membername':_0x34b0f8[_0x2ea3('0x26')],'UserId':_0x34b0f8['id'],'queue_name':_0x519d42['name'],'VoiceQueueId':_0x519d42['id'],'interface':_[_0x2ea3('0x88')](_0x34b0f8[_0x2ea3('0x86')])?util['format'](_0x2ea3('0x89'),_0x34b0f8['name']):_0x34b0f8[_0x2ea3('0x86')],'paused':_0x34b0f8[_0x2ea3('0x8a')]||![],'penalty':_0x519d42[_0x2ea3('0x7e')][_0x2ea3('0x7f')]},{'transaction':_0x56cf7b});});return Promise[_0x2ea3('0x8b')](_0x3f8418);});});});return Promise['all'](_0x3c64a2);});return Promise[_0x2ea3('0x8b')](_0x750950);})[_0x2ea3('0x23')](function(){return db['TeamVoicePrefix'][_0x2ea3('0x70')]({'where':{'teamId':_0x3d327a}})['then'](function(_0x12f396){if(_0x12f396){var _0x3f975c=_[_0x2ea3('0x2f')](_0x2dbade,function(_0x541378){db[_0x2ea3('0x63')][_0x2ea3('0x87')]({'UserId':_0x541378,'VoicePrefixId':_0x12f396[_0x2ea3('0x64')]});});return Promise[_0x2ea3('0x8b')](_0x3f975c);}});});});return Promise['all'](_0x393307)['then'](function(){return _0x483206[_0x2ea3('0x75')](_0x2dbade,{'transaction':_0x56cf7b})[_0x2ea3('0x8c')](function(_0x400aaa){return _0x400aaa;});});});}})['then'](respondWithResult(_0x5216f3,null))[_0x2ea3('0x41')](handleError(_0x5216f3,null));};exports[_0x2ea3('0x8d')]=function(_0x3ffbba,_0x436af2){var _0x3226c3=_['isArray'](_0x3ffbba[_0x2ea3('0x30')]['ids'])?_0x3ffbba[_0x2ea3('0x30')][_0x2ea3('0x72')]:[_0x3ffbba[_0x2ea3('0x30')]['ids']];var _0x3b66d4=_0x3ffbba['params']['id'];return db[_0x2ea3('0x29')][_0x2ea3('0x43')]({'where':{'id':_0x3b66d4}})[_0x2ea3('0x23')](handleEntityNotFound(_0x436af2,null))[_0x2ea3('0x23')](function(_0x21fbf4){if(_0x21fbf4){var _0x4c98a2=[_0x2ea3('0x77'),_0x2ea3('0x78'),_0x2ea3('0x79'),_0x2ea3('0x8e'),_0x2ea3('0x7a'),_0x2ea3('0x7b'),_0x2ea3('0x7c')];return db[_0x2ea3('0x50')]['transaction'](function(_0x476e1a){var _0x216171=_['map'](_0x4c98a2,function(_0x37b0a3){var _0x6ae151={'attributes':['id',_0x2ea3('0x26')]};return _0x21fbf4[_0x2ea3('0x48')+_0x37b0a3+'Queues'](_0x6ae151)[_0x2ea3('0x23')](function(_0x1558ce){var _0x2eef19=_[_0x2ea3('0x2f')](_0x1558ce,function(_0x56f2d2){return _0x56f2d2[_0x2ea3('0x8d')](_0x3226c3,{'transaction':_0x476e1a})[_0x2ea3('0x23')](function(){var _0x470a3b=_[_0x2ea3('0x2f')](_0x3226c3,function(_0x4365a3){socket[_0x2ea3('0x82')](_0x2ea3('0x47')+_0x37b0a3+_0x2ea3('0x8f'),{'UserId':Number(_0x4365a3),[_0x37b0a3+'QueueId']:_0x56f2d2['id']});if(_0x37b0a3!==_0x2ea3('0x77')){return;}return db[_0x2ea3('0x90')][_0x2ea3('0x57')]({'where':{'VoiceQueueId':_0x56f2d2['id'],'UserId':_0x4365a3},'transaction':_0x476e1a});});return Promise[_0x2ea3('0x8b')](_0x470a3b);});});return Promise[_0x2ea3('0x8b')](_0x2eef19);});});return Promise[_0x2ea3('0x8b')](_0x216171)['then'](function(){return _0x21fbf4[_0x2ea3('0x8d')](_0x3226c3,{'transaction':_0x476e1a});})[_0x2ea3('0x23')](function(){return db[_0x2ea3('0x62')][_0x2ea3('0x70')]({'where':{'teamId':_0x3b66d4}})[_0x2ea3('0x23')](function(_0x4b7419){if(_0x4b7419){var _0x5e76f4=_[_0x2ea3('0x2f')](_0x3226c3,function(_0x15d6d6){db['UserVoicePrefix'][_0x2ea3('0x57')]({'where':{'UserId':_0x15d6d6,'VoicePrefixId':_0x4b7419['VoicePrefixId']}});});return Promise[_0x2ea3('0x8b')](_0x5e76f4);}});});});}})[_0x2ea3('0x23')](respondWithStatusCode(_0x436af2,null))[_0x2ea3('0x41')](handleError(_0x436af2,null));};exports[_0x2ea3('0x91')]=function(_0x40fe40,_0x1fad0d,_0x1f8aac){var _0x21feec={};var _0x2df81e={};var _0x2e7c4e;var _0x31bda7;return db[_0x2ea3('0x29')]['findOne']({'where':{'id':_0x40fe40[_0x2ea3('0x42')]['id']}})[_0x2ea3('0x23')](handleEntityNotFound(_0x1fad0d,null))[_0x2ea3('0x23')](function(_0xe578b3){if(_0xe578b3){_0x2e7c4e=_0xe578b3;_0x2df81e[_0x2ea3('0x2e')]=_[_0x2ea3('0x31')](db[_0x2ea3('0x80')][_0x2ea3('0x2a')]);_0x2df81e[_0x2ea3('0x30')]=_[_0x2ea3('0x31')](_0x40fe40['query']);_0x2df81e[_0x2ea3('0x32')]=_[_0x2ea3('0x34')](_0x2df81e[_0x2ea3('0x2e')],_0x2df81e[_0x2ea3('0x30')]);_0x21feec[_0x2ea3('0x33')]=_[_0x2ea3('0x34')](_0x2df81e[_0x2ea3('0x2e')],qs[_0x2ea3('0x35')](_0x40fe40[_0x2ea3('0x30')][_0x2ea3('0x35')]));_0x21feec[_0x2ea3('0x33')]=_0x21feec[_0x2ea3('0x33')][_0x2ea3('0x36')]?_0x21feec[_0x2ea3('0x33')]:_0x2df81e['model'];_0x21feec['order']=qs['sort'](_0x40fe40[_0x2ea3('0x30')][_0x2ea3('0x38')]);_0x21feec[_0x2ea3('0x3c')]=qs[_0x2ea3('0x32')](_[_0x2ea3('0x39')](_0x40fe40[_0x2ea3('0x30')],_0x2df81e[_0x2ea3('0x32')]));if(_0x40fe40[_0x2ea3('0x30')]['filter']){_0x21feec[_0x2ea3('0x3c')]=_[_0x2ea3('0x3b')](_0x21feec['where'],{'$or':_[_0x2ea3('0x2f')](_0x21feec[_0x2ea3('0x33')],function(_0x3bb4fb){var _0xe8855b={};_0xe8855b[_0x3bb4fb]={'$like':'%'+_0x40fe40[_0x2ea3('0x30')][_0x2ea3('0x3a')]+'%'};return _0xe8855b;})});}_0x21feec=_[_0x2ea3('0x3b')]({},_0x21feec,_0x40fe40[_0x2ea3('0x3e')]);return _0x2e7c4e['getAgents'](_0x21feec);}})[_0x2ea3('0x23')](function(_0x985340){if(_0x985340){_0x31bda7=_0x985340[_0x2ea3('0x36')];if(!_0x40fe40[_0x2ea3('0x30')][_0x2ea3('0x92')]('nolimit')){_0x21feec[_0x2ea3('0x19')]=qs[_0x2ea3('0x19')](_0x40fe40['query'][_0x2ea3('0x19')]);_0x21feec['offset']=qs[_0x2ea3('0x18')](_0x40fe40[_0x2ea3('0x30')][_0x2ea3('0x18')]);}return _0x2e7c4e[_0x2ea3('0x91')](_0x21feec);}})[_0x2ea3('0x23')](function(_0x44415d){if(_0x44415d){return _0x44415d?{'count':_0x31bda7,'rows':_0x44415d}:null;}})[_0x2ea3('0x23')](respondWithResult(_0x1fad0d,null))['catch'](handleError(_0x1fad0d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 8b75abe..3f58290 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 _0x121c=['hook','exports','events','../../mysqldb','Team','save','update','remove','emit','hasOwnProperty'];(function(_0xd4f90b,_0x148333){var _0x451848=function(_0x12c95c){while(--_0x12c95c){_0xd4f90b['push'](_0xd4f90b['shift']());}};_0x451848(++_0x148333);}(_0x121c,0xfc));var _0xc121=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x121c[_0xa6cc5c];return _0x44803d;};'use strict';var EventEmitter=require(_0xc121('0x0'));var Team=require(_0xc121('0x1'))['db'][_0xc121('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc121('0x3'),'afterUpdate':_0xc121('0x4'),'afterDestroy':_0xc121('0x5')};function emitEvent(_0x8303d0){return function(_0x2a4fdb,_0x491bbe,_0x567d54){TeamEvents[_0xc121('0x6')](_0x8303d0+':'+_0x2a4fdb['id'],_0x2a4fdb);TeamEvents[_0xc121('0x6')](_0x8303d0,_0x2a4fdb);_0x567d54(null);};}for(var e in events){if(events[_0xc121('0x7')](e)){var event=events[e];Team[_0xc121('0x8')](e,emitEvent(event));}}module[_0xc121('0x9')]=TeamEvents; \ No newline at end of file +var _0x756a=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x37dc21,_0x2bae86){var _0x34dc9e=function(_0x351e38){while(--_0x351e38){_0x37dc21['push'](_0x37dc21['shift']());}};_0x34dc9e(++_0x2bae86);}(_0x756a,0x190));var _0xa756=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x756a[_0x50aa2e];return _0x5e07f0;};'use strict';var EventEmitter=require(_0xa756('0x0'));var Team=require(_0xa756('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xa756('0x2')](0x0);var events={'afterCreate':_0xa756('0x3'),'afterUpdate':_0xa756('0x4'),'afterDestroy':_0xa756('0x5')};function emitEvent(_0x3a24e2){return function(_0x3b2949,_0x5757b6,_0x438b0c){TeamEvents[_0xa756('0x6')](_0x3a24e2+':'+_0x3b2949['id'],_0x3b2949);TeamEvents[_0xa756('0x6')](_0x3a24e2,_0x3b2949);_0x438b0c(null);};}for(var e in events){if(events[_0xa756('0x7')](e)){var event=events[e];Team[_0xa756('0x8')](e,emitEvent(event));}}module[_0xa756('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 959117b..0c08765 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 _0xc256=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','teams','lodash','util','../../config/logger','api'];(function(_0x19fffd,_0xb8cadf){var _0x54f80f=function(_0x572157){while(--_0x572157){_0x19fffd['push'](_0x19fffd['shift']());}};_0x54f80f(++_0xb8cadf);}(_0xc256,0x88));var _0x6c25=function(_0x1506fc,_0x5ed6a2){_0x1506fc=_0x1506fc-0x0;var _0x4b6b57=_0xc256[_0x1506fc];return _0x4b6b57;};'use strict';var _=require(_0x6c25('0x0'));var util=require(_0x6c25('0x1'));var logger=require(_0x6c25('0x2'))(_0x6c25('0x3'));var moment=require(_0x6c25('0x4'));var BPromise=require(_0x6c25('0x5'));var rp=require(_0x6c25('0x6'));var fs=require('fs');var path=require(_0x6c25('0x7'));var rimraf=require(_0x6c25('0x8'));var config=require(_0x6c25('0x9'));var attributes=require('./team.attributes');module[_0x6c25('0xa')]=function(_0x53bfa5,_0xb1c12){return _0x53bfa5[_0x6c25('0xb')](_0x6c25('0xc'),attributes,{'tableName':_0x6c25('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cc8=['define','Team','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./team.attributes','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8cc8,0xab));var _0x88cc=function(_0x492063,_0xe743cd){_0x492063=_0x492063-0x0;var _0x5f2c12=_0x8cc8[_0x492063];return _0x5f2c12;};'use strict';var _=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var logger=require(_0x88cc('0x2'))(_0x88cc('0x3'));var moment=require(_0x88cc('0x4'));var BPromise=require(_0x88cc('0x5'));var rp=require(_0x88cc('0x6'));var fs=require('fs');var path=require(_0x88cc('0x7'));var rimraf=require(_0x88cc('0x8'));var config=require('../../config/environment');var attributes=require(_0x88cc('0x9'));module[_0x88cc('0xa')]=function(_0x1e2731,_0x2d4bd4){return _0x1e2731[_0x88cc('0xb')](_0x88cc('0xc'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d83bb51..82d3a15 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 _0x7a3d=['redis','./team.socket','request','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a3d,0x109));var _0xd7a3=function(_0x358ddd,_0x29235d){_0x358ddd=_0x358ddd-0x0;var _0x46d5a2=_0x7a3d[_0x358ddd];return _0x46d5a2;};'use strict';var _=require('lodash');var util=require(_0xd7a3('0x0'));var moment=require(_0xd7a3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7a3('0x2'))['db'];var utils=require(_0xd7a3('0x3'));var logger=require(_0xd7a3('0x4'))(_0xd7a3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd7a3('0x6')][_0xd7a3('0x7')]({'port':0x232a});config[_0xd7a3('0x8')]=_['defaults'](config[_0xd7a3('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7a3('0x8')]));require(_0xd7a3('0x9'))['register'](socket);function respondWithRpcPromise(_0x1a4eda,_0x1a9ce9,_0x1a34af){return new BPromise(function(_0x1a0dd0,_0x4f0dad){return client[_0xd7a3('0xa')](_0x1a4eda,_0x1a34af)['then'](function(_0x2111a1){logger['info'](_0xd7a3('0xb'),_0x1a9ce9,_0xd7a3('0xc'));logger[_0xd7a3('0xd')](_0xd7a3('0xe'),_0x1a9ce9,_0xd7a3('0xc'),JSON[_0xd7a3('0xf')](_0x2111a1));if(_0x2111a1[_0xd7a3('0x10')]){if(_0x2111a1[_0xd7a3('0x10')][_0xd7a3('0x11')]===0x1f4){logger[_0xd7a3('0x10')]('Team,\x20%s,\x20%s',_0x1a9ce9,_0x2111a1[_0xd7a3('0x10')][_0xd7a3('0x12')]);return _0x4f0dad(_0x2111a1[_0xd7a3('0x10')][_0xd7a3('0x12')]);}logger[_0xd7a3('0x10')](_0xd7a3('0xb'),_0x1a9ce9,_0x2111a1[_0xd7a3('0x10')]['message']);return _0x1a0dd0(_0x2111a1[_0xd7a3('0x10')][_0xd7a3('0x12')]);}else{logger[_0xd7a3('0x13')](_0xd7a3('0xb'),_0x1a9ce9,_0xd7a3('0xc'));_0x1a0dd0(_0x2111a1['result']['message']);}})[_0xd7a3('0x14')](function(_0x2ed237){logger['error'](_0xd7a3('0xb'),_0x1a9ce9,_0x2ed237);_0x4f0dad(_0x2ed237);});});} \ No newline at end of file +var _0x285d=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./team.socket','register','then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x285d,0x92));var _0xd285=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x285d[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xd285('0x0'));var util=require(_0xd285('0x1'));var moment=require(_0xd285('0x2'));var BPromise=require(_0xd285('0x3'));var rs=require(_0xd285('0x4'));var fs=require('fs');var Redis=require(_0xd285('0x5'));var db=require(_0xd285('0x6'))['db'];var utils=require(_0xd285('0x7'));var logger=require(_0xd285('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd285('0x9'));var client=jayson[_0xd285('0xa')]['http']({'port':0x232a});config['redis']=_[_0xd285('0xb')](config[_0xd285('0xc')],{'host':_0xd285('0xd'),'port':0x18eb});var socket=require(_0xd285('0xe'))(new Redis(config[_0xd285('0xc')]));require(_0xd285('0xf'))[_0xd285('0x10')](socket);function respondWithRpcPromise(_0x4e3101,_0x1f2705,_0x3ec23c){return new BPromise(function(_0x15570a,_0x5f5516){return client['request'](_0x4e3101,_0x3ec23c)[_0xd285('0x11')](function(_0x39c7ac){logger['info'](_0xd285('0x12'),_0x1f2705,'request\x20sent');logger[_0xd285('0x13')](_0xd285('0x14'),_0x1f2705,_0xd285('0x15'),JSON[_0xd285('0x16')](_0x39c7ac));if(_0x39c7ac['error']){if(_0x39c7ac[_0xd285('0x17')]['code']===0x1f4){logger[_0xd285('0x17')](_0xd285('0x12'),_0x1f2705,_0x39c7ac[_0xd285('0x17')][_0xd285('0x18')]);return _0x5f5516(_0x39c7ac[_0xd285('0x17')][_0xd285('0x18')]);}logger['error'](_0xd285('0x12'),_0x1f2705,_0x39c7ac[_0xd285('0x17')][_0xd285('0x18')]);return _0x15570a(_0x39c7ac[_0xd285('0x17')][_0xd285('0x18')]);}else{logger[_0xd285('0x19')]('Team,\x20%s,\x20%s',_0x1f2705,_0xd285('0x15'));_0x15570a(_0x39c7ac[_0xd285('0x1a')]['message']);}})[_0xd285('0x1b')](function(_0x5a7820){logger[_0xd285('0x17')](_0xd285('0x12'),_0x1f2705,_0x5a7820);_0x5f5516(_0x5a7820);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e25854a..1c0482e 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 _0xde46=['team:','./team.events','remove','emit','removeListener','register','length'];(function(_0x2f4de8,_0x313395){var _0x4569cb=function(_0x17572f){while(--_0x17572f){_0x2f4de8['push'](_0x2f4de8['shift']());}};_0x4569cb(++_0x313395);}(_0xde46,0x174));var _0x6de4=function(_0x54358,_0x304ba8){_0x54358=_0x54358-0x0;var _0x1c3925=_0xde46[_0x54358];return _0x1c3925;};'use strict';var TeamEvents=require(_0x6de4('0x0'));var events=['save',_0x6de4('0x1'),'update'];function createListener(_0x465de2,_0x1d5be1){return function(_0x3d9a0f){_0x1d5be1[_0x6de4('0x2')](_0x465de2,_0x3d9a0f);};}function removeListener(_0x26e6a9,_0x3deef5){return function(){TeamEvents[_0x6de4('0x3')](_0x26e6a9,_0x3deef5);};}exports[_0x6de4('0x4')]=function(_0x52d8ad){for(var _0x1c9de2=0x0,_0x29887f=events[_0x6de4('0x5')];_0x1c9de2<_0x29887f;_0x1c9de2++){var _0x14939a=events[_0x1c9de2];var _0x2b6cba=createListener(_0x6de4('0x6')+_0x14939a,_0x52d8ad);TeamEvents['on'](_0x14939a,_0x2b6cba);}}; \ No newline at end of file +var _0x6a73=['./team.events','save','emit','removeListener','length','team:'];(function(_0x146994,_0x559c73){var _0x131ddb=function(_0x30c7bf){while(--_0x30c7bf){_0x146994['push'](_0x146994['shift']());}};_0x131ddb(++_0x559c73);}(_0x6a73,0x174));var _0x36a7=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0x6a73[_0x2543d6];return _0x55213c;};'use strict';var TeamEvents=require(_0x36a7('0x0'));var events=[_0x36a7('0x1'),'remove','update'];function createListener(_0x145264,_0x28bbb0){return function(_0x84ddc5){_0x28bbb0[_0x36a7('0x2')](_0x145264,_0x84ddc5);};}function removeListener(_0x8be28c,_0x21ec02){return function(){TeamEvents[_0x36a7('0x3')](_0x8be28c,_0x21ec02);};}exports['register']=function(_0x1f4a48){for(var _0x8561c1=0x0,_0x44816f=events[_0x36a7('0x4')];_0x8561c1<_0x44816f;_0x8561c1++){var _0xfb6903=events[_0x8561c1];var _0x5832ab=createListener(_0x36a7('0x5')+_0xfb6903,_0x1f4a48);TeamEvents['on'](_0xfb6903,_0x5832ab);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6be1d88..3e478af 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 _0x92e8=['sequelize','exports','INTEGER'];(function(_0x4f0e6a,_0xf3d457){var _0x4ec438=function(_0x1bd825){while(--_0x1bd825){_0x4f0e6a['push'](_0x4f0e6a['shift']());}};_0x4ec438(++_0xf3d457);}(_0x92e8,0x81));var _0x892e=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x92e8[_0x30cc1a];return _0xb3f18f;};'use strict';var Sequelize=require(_0x892e('0x0'));module[_0x892e('0x1')]={'TeamId':{'type':Sequelize[_0x892e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x892e('0x2')]}}; \ No newline at end of file +var _0xd57b=['sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd57b,0x1be));var _0xbd57=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xd57b[_0x15cdcb];return _0x37b069;};'use strict';var Sequelize=require(_0xbd57('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e58638b..29a2629 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 _0x6c9c=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x1718da,_0x17d2a6){var _0x1d4dd8=function(_0x37fa99){while(--_0x37fa99){_0x1718da['push'](_0x1718da['shift']());}};_0x1d4dd8(++_0x17d2a6);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x2b341b,_0x50c4ea){_0x2b341b=_0x2b341b-0x0;var _0x281b3d=_0x6c9c[_0x2b341b];return _0x281b3d;};'use strict';var _=require(_0xc6c9('0x0'));var util=require(_0xc6c9('0x1'));var logger=require('../../config/logger')(_0xc6c9('0x2'));var moment=require(_0xc6c9('0x3'));var BPromise=require(_0xc6c9('0x4'));var rp=require(_0xc6c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6c9('0x6'));var config=require(_0xc6c9('0x7'));var attributes=require(_0xc6c9('0x8'));module[_0xc6c9('0x9')]=function(_0x422195,_0x84b96e){return _0x422195[_0xc6c9('0xa')](_0xc6c9('0xb'),attributes,{'tableName':_0xc6c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde1e=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports'];(function(_0x34caea,_0x52a020){var _0x11d044=function(_0x5a2df2){while(--_0x5a2df2){_0x34caea['push'](_0x34caea['shift']());}};_0x11d044(++_0x52a020);}(_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 diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ce8971f..fc0615d 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x417ea3,_0x156e87){var _0x18c29d=function(_0x22df4b){while(--_0x22df4b){_0x417ea3['push'](_0x417ea3['shift']());}};_0x18c29d(++_0x156e87);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x372e31,_0xc8ab8d){var _0x2295e8=function(_0x27eca0){while(--_0x27eca0){_0x372e31['push'](_0x372e31['shift']());}};_0x2295e8(++_0xc8ab8d);}(_0x70e0,0x17b));var _0x070e=function(_0x2a4cde,_0x4e19ff){_0x2a4cde=_0x2a4cde-0x0;var _0x348ebe=_0x70e0[_0x2a4cde];return _0x348ebe;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9b96b3d..a0be293 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 _0x3404=['sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3404,0xc9));var _0x4340=function(_0x944a9b,_0x5ba26b){_0x944a9b=_0x944a9b-0x0;var _0x3f0d15=_0x3404[_0x944a9b];return _0x3f0d15;};'use strict';var Sequelize=require(_0x4340('0x0'));module[_0x4340('0x1')]={'penalty':{'type':Sequelize[_0x4340('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b28=['INTEGER','sequelize','exports'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4b28,0x121));var _0x84b2=function(_0x599ef3,_0x2c708f){_0x599ef3=_0x599ef3-0x0;var _0x42867e=_0x4b28[_0x599ef3];return _0x42867e;};'use strict';var Sequelize=require(_0x84b2('0x0'));module[_0x84b2('0x1')]={'penalty':{'type':Sequelize[_0x84b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index afba99c..73c251e 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 _0x385b=['../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x310c60,_0x17f2f2){var _0x3fe026=function(_0x5063f7){while(--_0x5063f7){_0x310c60['push'](_0x310c60['shift']());}};_0x3fe026(++_0x17f2f2);}(_0x385b,0x1a7));var _0xb385=function(_0x3bf6cb,_0x931865){_0x3bf6cb=_0x3bf6cb-0x0;var _0x416d27=_0x385b[_0x3bf6cb];return _0x416d27;};'use strict';var _=require('lodash');var util=require(_0xb385('0x0'));var logger=require('../../config/logger')(_0xb385('0x1'));var moment=require(_0xb385('0x2'));var BPromise=require(_0xb385('0x3'));var rp=require(_0xb385('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb385('0x5'));var config=require(_0xb385('0x6'));var attributes=require(_0xb385('0x7'));module[_0xb385('0x8')]=function(_0x3268bc,_0x576d81){return _0x3268bc[_0xb385('0x9')](_0xb385('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad3=['team_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define'];(function(_0x359ae6,_0x4869aa){var _0x3cb745=function(_0x3dde98){while(--_0x3dde98){_0x359ae6['push'](_0x359ae6['shift']());}};_0x3cb745(++_0x4869aa);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0x5ad3[_0x4a8418];return _0x390174;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));module[_0x35ad('0xa')]=function(_0x436dcb,_0x36c606){return _0x436dcb[_0x35ad('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0x35ad('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 26f5aa2..09d2bb8 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 _0x4062=['client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x4062,0x1ae));var _0x2406=function(_0x3932ea,_0x1fe763){_0x3932ea=_0x3932ea-0x0;var _0x296a85=_0x4062[_0x3932ea];return _0x296a85;};'use strict';var _=require('lodash');var util=require(_0x2406('0x0'));var moment=require('moment');var BPromise=require(_0x2406('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2406('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2406('0x3'));var logger=require('../../config/logger')(_0x2406('0x4'));var config=require(_0x2406('0x5'));var jayson=require(_0x2406('0x6'));var client=jayson[_0x2406('0x7')][_0x2406('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33fc20,_0x4ca360,_0xc18f1b){return new BPromise(function(_0x49fd0a,_0x534e5b){return client[_0x2406('0x9')](_0x33fc20,_0xc18f1b)[_0x2406('0xa')](function(_0x55169e){logger[_0x2406('0xb')](_0x2406('0xc'),_0x4ca360,'request\x20sent');logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4ca360,_0x2406('0xd'),JSON[_0x2406('0xe')](_0x55169e));if(_0x55169e[_0x2406('0xf')]){if(_0x55169e[_0x2406('0xf')][_0x2406('0x10')]===0x1f4){logger[_0x2406('0xf')](_0x2406('0xc'),_0x4ca360,_0x55169e[_0x2406('0xf')][_0x2406('0x11')]);return _0x534e5b(_0x55169e[_0x2406('0xf')][_0x2406('0x11')]);}logger['error'](_0x2406('0xc'),_0x4ca360,_0x55169e[_0x2406('0xf')][_0x2406('0x11')]);return _0x49fd0a(_0x55169e['error'][_0x2406('0x11')]);}else{logger[_0x2406('0xb')](_0x2406('0xc'),_0x4ca360,_0x2406('0xd'));_0x49fd0a(_0x55169e[_0x2406('0x12')]['message']);}})['catch'](function(_0x922e20){logger[_0x2406('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4ca360,_0x922e20);_0x534e5b(_0x922e20);});});} \ No newline at end of file +var _0xe81b=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x28b2ab,_0x372517){var _0x2332bf=function(_0x5e277e){while(--_0x5e277e){_0x28b2ab['push'](_0x28b2ab['shift']());}};_0x2332bf(++_0x372517);}(_0xe81b,0xde));var _0xbe81=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xe81b[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xbe81('0x0'));var util=require(_0xbe81('0x1'));var moment=require('moment');var BPromise=require(_0xbe81('0x2'));var rs=require(_0xbe81('0x3'));var fs=require('fs');var Redis=require(_0xbe81('0x4'));var db=require(_0xbe81('0x5'))['db'];var utils=require(_0xbe81('0x6'));var logger=require(_0xbe81('0x7'))(_0xbe81('0x8'));var config=require(_0xbe81('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29b368,_0x5191fb,_0x4a5662){return new BPromise(function(_0x37fdea,_0x581648){return client[_0xbe81('0xb')](_0x29b368,_0x4a5662)[_0xbe81('0xc')](function(_0xba1b4b){logger['info'](_0xbe81('0xd'),_0x5191fb,_0xbe81('0xe'));logger[_0xbe81('0xf')](_0xbe81('0x10'),_0x5191fb,_0xbe81('0xe'),JSON['stringify'](_0xba1b4b));if(_0xba1b4b['error']){if(_0xba1b4b[_0xbe81('0x11')]['code']===0x1f4){logger[_0xbe81('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5191fb,_0xba1b4b['error']['message']);return _0x581648(_0xba1b4b['error'][_0xbe81('0x12')]);}logger[_0xbe81('0x11')](_0xbe81('0xd'),_0x5191fb,_0xba1b4b['error'][_0xbe81('0x12')]);return _0x37fdea(_0xba1b4b[_0xbe81('0x11')][_0xbe81('0x12')]);}else{logger[_0xbe81('0x13')](_0xbe81('0xd'),_0x5191fb,_0xbe81('0xe'));_0x37fdea(_0xba1b4b[_0xbe81('0x14')][_0xbe81('0x12')]);}})[_0xbe81('0x15')](function(_0x31f879){logger['error'](_0xbe81('0xd'),_0x5191fb,_0x31f879);_0x581648(_0x31f879);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e7d60c1..35c1931 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 _0x0a1c=['show','post','create','put','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x3ddc7d,_0xa1432e){var _0x3a9f23=function(_0x239165){while(--_0x239165){_0x3ddc7d['push'](_0x3ddc7d['shift']());}};_0x3a9f23(++_0xa1432e);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0x0a1c[_0x483ab9];return _0x35043b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0a1('0x0'));var timeout=require(_0xc0a1('0x1'));var express=require(_0xc0a1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc0a1('0x3'));var interaction=require(_0xc0a1('0x4'));var config=require(_0xc0a1('0x5'));var controller=require(_0xc0a1('0x6'));router[_0xc0a1('0x7')]('/',auth[_0xc0a1('0x8')](),controller[_0xc0a1('0x9')]);router[_0xc0a1('0x7')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller[_0xc0a1('0xb')]);router[_0xc0a1('0xc')]('/',auth[_0xc0a1('0x8')](),controller[_0xc0a1('0xd')]);router[_0xc0a1('0xe')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller['update']);router[_0xc0a1('0xf')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller['destroy']);module[_0xc0a1('0x10')]=router; \ No newline at end of file +var _0x3445=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./template.controller','get','isAuthenticated','show','create','put','/:id','update','delete'];(function(_0x5c4959,_0x55abe2){var _0x2a4d99=function(_0x16db95){while(--_0x16db95){_0x5c4959['push'](_0x5c4959['shift']());}};_0x2a4d99(++_0x55abe2);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var path=require(_0x5344('0x2'));var timeout=require(_0x5344('0x3'));var express=require(_0x5344('0x4'));var router=express[_0x5344('0x5')]();var fs_extra=require(_0x5344('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5344('0x7'));var controller=require(_0x5344('0x8'));router[_0x5344('0x9')]('/',auth[_0x5344('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5344('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5344('0xc')]);router[_0x5344('0xd')](_0x5344('0xe'),auth['isAuthenticated'](),controller[_0x5344('0xf')]);router[_0x5344('0x10')](_0x5344('0xe'),auth[_0x5344('0xa')](),controller[_0x5344('0x11')]);module[_0x5344('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0d325a4..da6c6a2 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 _0xf09b=['TEXT','STRING'];(function(_0xbf16e8,_0x587db3){var _0x4473c4=function(_0x5f24ec){while(--_0x5f24ec){_0xbf16e8['push'](_0xbf16e8['shift']());}};_0x4473c4(++_0x587db3);}(_0xf09b,0x119));var _0xbf09=function(_0x16aad2,_0xd70544){_0x16aad2=_0x16aad2-0x0;var _0x1cbbb7=_0xf09b[_0x16aad2];return _0x1cbbb7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbf09('0x0')]},'description':{'type':Sequelize[_0xbf09('0x0')]},'html':{'type':Sequelize[_0xbf09('0x1')]}}; \ No newline at end of file +var _0x1120=['STRING','TEXT','sequelize','exports'];(function(_0x1acaf5,_0x3ae694){var _0x3d0fd5=function(_0x301e5b){while(--_0x301e5b){_0x1acaf5['push'](_0x1acaf5['shift']());}};_0x3d0fd5(++_0x3ae694);}(_0x1120,0x82));var _0x0112=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1120[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0112('0x0'));module[_0x0112('0x1')]={'name':{'type':Sequelize[_0x0112('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x0112('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 807b6ab..4c3286a 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 _0x31a0=['includeAll','include','findAll','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','error','stack','name','send','index','map','Template','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options'];(function(_0x2ccf04,_0x2b0d62){var _0x23a933=function(_0x25b72a){while(--_0x25b72a){_0x2ccf04['push'](_0x2ccf04['shift']());}};_0x23a933(++_0x2b0d62);}(_0x31a0,0x68));var _0x031a=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x31a0[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require(_0x031a('0x0'));var rimraf=require(_0x031a('0x1'));var zipdir=require(_0x031a('0x2'));var jsonpatch=require(_0x031a('0x3'));var rp=require(_0x031a('0x4'));var moment=require(_0x031a('0x5'));var BPromise=require(_0x031a('0x6'));var Mustache=require(_0x031a('0x7'));var util=require(_0x031a('0x8'));var path=require(_0x031a('0x9'));var sox=require(_0x031a('0xa'));var csv=require(_0x031a('0xb'));var ejs=require(_0x031a('0xc'));var fs=require('fs');var fs_extra=require(_0x031a('0xd'));var _=require(_0x031a('0xe'));var squel=require(_0x031a('0xf'));var crypto=require(_0x031a('0x10'));var jsforce=require(_0x031a('0x11'));var deskjs=require(_0x031a('0x12'));var toCsv=require(_0x031a('0xb'));var querystring=require(_0x031a('0x13'));var Papa=require(_0x031a('0x14'));var Redis=require(_0x031a('0x15'));var authService=require(_0x031a('0x16'));var qs=require(_0x031a('0x17'));var as=require(_0x031a('0x18'));var hardwareService=require(_0x031a('0x19'));var logger=require(_0x031a('0x1a'))('api');var utils=require(_0x031a('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x031a('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c0ff3,_0x471041){_0x471041=_0x471041||0xcc;return function(_0x5a9483){if(_0x5a9483){return _0x2c0ff3['sendStatus'](_0x471041);}return _0x2c0ff3[_0x031a('0x1d')](_0x471041)[_0x031a('0x1e')]();};}function respondWithResult(_0xe823ee,_0x12b28e){_0x12b28e=_0x12b28e||0xc8;return function(_0x247283){if(_0x247283){return _0xe823ee[_0x031a('0x1d')](_0x12b28e)[_0x031a('0x1f')](_0x247283);}};}function respondWithFilteredResult(_0x5bf65e,_0x1b8bc5){return function(_0x2dce74){if(_0x2dce74){var _0x5884ea=typeof _0x1b8bc5[_0x031a('0x20')]==='undefined'&&typeof _0x1b8bc5[_0x031a('0x21')]===_0x031a('0x22');var _0x22d1bd=_0x2dce74[_0x031a('0x23')];var _0x38024f=_0x5884ea?0x0:_0x1b8bc5[_0x031a('0x20')];var _0x1f12fb=_0x5884ea?_0x2dce74[_0x031a('0x23')]:_0x1b8bc5[_0x031a('0x20')]+_0x1b8bc5[_0x031a('0x21')];var _0x213957;if(_0x1f12fb>=_0x22d1bd){_0x1f12fb=_0x22d1bd;_0x213957=0xc8;}else{_0x213957=0xce;}_0x5bf65e[_0x031a('0x1d')](_0x213957);return _0x5bf65e[_0x031a('0x24')](_0x031a('0x25'),_0x38024f+'-'+_0x1f12fb+'/'+_0x22d1bd)['json'](_0x2dce74);}return null;};}function patchUpdates(_0x3c54ba){return function(_0x19cbd4){try{jsonpatch[_0x031a('0x26')](_0x19cbd4,_0x3c54ba,!![]);}catch(_0x54fbb5){return BPromise[_0x031a('0x27')](_0x54fbb5);}return _0x19cbd4[_0x031a('0x28')]();};}function saveUpdates(_0x17dbaf,_0x1cc5f5){return function(_0x5bfb5){if(_0x5bfb5){return _0x5bfb5[_0x031a('0x29')](_0x17dbaf)[_0x031a('0x2a')](function(_0x483ccb){return _0x483ccb;});}return null;};}function removeEntity(_0x1e19a9,_0x57623f){return function(_0x21fd06){if(_0x21fd06){return _0x21fd06[_0x031a('0x2b')]()['then'](function(){var _0x5da771=_0x21fd06[_0x031a('0x2c')]({'plain':!![]});var _0x5ac811=_0x031a('0x2d');return db['UserProfileResource'][_0x031a('0x2b')]({'where':{'type':_0x5ac811,'resourceId':_0x5da771['id']}})[_0x031a('0x2a')](function(){return _0x21fd06;});})[_0x031a('0x2a')](function(){_0x1e19a9['status'](0xcc)[_0x031a('0x1e')]();});}};}function handleEntityNotFound(_0x5083e6,_0x35723e){return function(_0xfae809){if(!_0xfae809){_0x5083e6['sendStatus'](0x194);}return _0xfae809;};}function handleError(_0xe4b098,_0x438e47){_0x438e47=_0x438e47||0x1f4;return function(_0x506d21){logger[_0x031a('0x2e')](_0x506d21[_0x031a('0x2f')]);if(_0x506d21[_0x031a('0x30')]){delete _0x506d21[_0x031a('0x30')];}_0xe4b098[_0x031a('0x1d')](_0x438e47)[_0x031a('0x31')](_0x506d21);};}exports[_0x031a('0x32')]=function(_0x12e8a0,_0x2b5474){var _0x193a79={},_0x265c5f={},_0x19292f={'count':0x0,'rows':[]};var _0x445228=_[_0x031a('0x33')](db[_0x031a('0x34')][_0x031a('0x35')],function(_0x311965){return{'name':_0x311965['fieldName'],'type':_0x311965['type'][_0x031a('0x36')]};});_0x265c5f['model']=_[_0x031a('0x33')](_0x445228,_0x031a('0x30'));_0x265c5f[_0x031a('0x37')]=_[_0x031a('0x38')](_0x12e8a0[_0x031a('0x37')]);_0x265c5f['filters']=_[_0x031a('0x39')](_0x265c5f[_0x031a('0x3a')],_0x265c5f[_0x031a('0x37')]);_0x193a79[_0x031a('0x3b')]=_[_0x031a('0x39')](_0x265c5f[_0x031a('0x3a')],qs[_0x031a('0x3c')](_0x12e8a0[_0x031a('0x37')]['fields']));_0x193a79['attributes']=_0x193a79[_0x031a('0x3b')][_0x031a('0x3d')]?_0x193a79[_0x031a('0x3b')]:_0x265c5f[_0x031a('0x3a')];if(!_0x12e8a0['query']['hasOwnProperty']('nolimit')){_0x193a79[_0x031a('0x21')]=qs['limit'](_0x12e8a0['query'][_0x031a('0x21')]);_0x193a79['offset']=qs[_0x031a('0x20')](_0x12e8a0[_0x031a('0x37')]['offset']);}_0x193a79[_0x031a('0x3e')]=qs['sort'](_0x12e8a0[_0x031a('0x37')][_0x031a('0x3f')]);_0x193a79[_0x031a('0x40')]=qs[_0x031a('0x41')](_[_0x031a('0x42')](_0x12e8a0[_0x031a('0x37')],_0x265c5f[_0x031a('0x41')]),_0x445228);if(_0x12e8a0[_0x031a('0x37')]['filter']){_0x193a79[_0x031a('0x40')]=_[_0x031a('0x43')](_0x193a79[_0x031a('0x40')],{'$or':_[_0x031a('0x33')](_0x445228,function(_0x263afb){if(_0x263afb[_0x031a('0x44')]!==_0x031a('0x45')){var _0x2714b6={};_0x2714b6[_0x263afb[_0x031a('0x30')]]={'$like':'%'+_0x12e8a0['query'][_0x031a('0x46')]+'%'};return _0x2714b6;}})});}_0x193a79=_[_0x031a('0x43')]({},_0x193a79,_0x12e8a0[_0x031a('0x47')]);var _0x44f42e={'where':_0x193a79[_0x031a('0x40')]};return db[_0x031a('0x34')]['count'](_0x44f42e)[_0x031a('0x2a')](function(_0x2b8e5e){_0x19292f[_0x031a('0x23')]=_0x2b8e5e;if(_0x12e8a0[_0x031a('0x37')][_0x031a('0x48')]){_0x193a79[_0x031a('0x49')]=[{'all':!![]}];}return db[_0x031a('0x34')][_0x031a('0x4a')](_0x193a79);})[_0x031a('0x2a')](function(_0x17ca72){_0x19292f[_0x031a('0x4b')]=_0x17ca72;return _0x19292f;})[_0x031a('0x2a')](respondWithFilteredResult(_0x2b5474,_0x193a79))[_0x031a('0x4c')](handleError(_0x2b5474,null));};exports[_0x031a('0x4d')]=function(_0x53cbe6,_0x36e548){var _0x11a7e9={'raw':!![],'where':{'id':_0x53cbe6[_0x031a('0x4e')]['id']}},_0x43ef25={};_0x43ef25[_0x031a('0x3a')]=_[_0x031a('0x38')](db[_0x031a('0x34')][_0x031a('0x35')]);_0x43ef25['query']=_[_0x031a('0x38')](_0x53cbe6['query']);_0x43ef25[_0x031a('0x41')]=_[_0x031a('0x39')](_0x43ef25[_0x031a('0x3a')],_0x43ef25[_0x031a('0x37')]);_0x11a7e9[_0x031a('0x3b')]=_[_0x031a('0x39')](_0x43ef25[_0x031a('0x3a')],qs[_0x031a('0x3c')](_0x53cbe6[_0x031a('0x37')][_0x031a('0x3c')]));_0x11a7e9[_0x031a('0x3b')]=_0x11a7e9[_0x031a('0x3b')][_0x031a('0x3d')]?_0x11a7e9[_0x031a('0x3b')]:_0x43ef25[_0x031a('0x3a')];if(_0x53cbe6[_0x031a('0x37')][_0x031a('0x48')]){_0x11a7e9[_0x031a('0x49')]=[{'all':!![]}];}_0x11a7e9=_[_0x031a('0x43')]({},_0x11a7e9,_0x53cbe6[_0x031a('0x47')]);return db[_0x031a('0x34')][_0x031a('0x4f')](_0x11a7e9)[_0x031a('0x2a')](handleEntityNotFound(_0x36e548,null))['then'](respondWithResult(_0x36e548,null))[_0x031a('0x4c')](handleError(_0x36e548,null));};exports['create']=function(_0x341e38,_0x3a49b7){return db[_0x031a('0x34')]['create'](_0x341e38[_0x031a('0x50')],{})[_0x031a('0x2a')](function(_0x3d4877){var _0xa64031=_0x341e38['user'][_0x031a('0x2c')]({'plain':!![]});if(!_0xa64031)throw new Error(_0x031a('0x51'));if(_0xa64031[_0x031a('0x52')]===_0x031a('0x53')){var _0x148070=_0x3d4877[_0x031a('0x2c')]({'plain':!![]});var _0x35142c=_0x031a('0x2d');return db[_0x031a('0x54')]['find']({'where':{'name':_0x35142c,'userProfileId':_0xa64031[_0x031a('0x55')]},'raw':!![]})[_0x031a('0x2a')](function(_0x4e46fe){if(_0x4e46fe&&_0x4e46fe[_0x031a('0x56')]===0x0){return db['UserProfileResource'][_0x031a('0x57')]({'name':_0x148070[_0x031a('0x30')],'resourceId':_0x148070['id'],'type':_0x4e46fe['name'],'sectionId':_0x4e46fe['id']},{})[_0x031a('0x2a')](function(){return _0x3d4877;});}else{return _0x3d4877;}})[_0x031a('0x4c')](function(_0x2cca79){logger[_0x031a('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cca79);throw _0x2cca79;});}return _0x3d4877;})[_0x031a('0x2a')](respondWithResult(_0x3a49b7,0xc9))[_0x031a('0x4c')](handleError(_0x3a49b7,null));};exports['update']=function(_0x42e627,_0x498ed6){if(_0x42e627[_0x031a('0x50')]['id']){delete _0x42e627[_0x031a('0x50')]['id'];}return db[_0x031a('0x34')][_0x031a('0x4f')]({'where':{'id':_0x42e627['params']['id']}})[_0x031a('0x2a')](handleEntityNotFound(_0x498ed6,null))[_0x031a('0x2a')](saveUpdates(_0x42e627[_0x031a('0x50')],null))['then'](respondWithResult(_0x498ed6,null))[_0x031a('0x4c')](handleError(_0x498ed6,null));};exports[_0x031a('0x2b')]=function(_0x17e5d9,_0xa17b82){return db[_0x031a('0x34')][_0x031a('0x4f')]({'where':{'id':_0x17e5d9['params']['id']}})[_0x031a('0x2a')](handleEntityNotFound(_0xa17b82,null))[_0x031a('0x2a')](removeEntity(_0xa17b82,null))[_0x031a('0x4c')](handleError(_0xa17b82,null));}; \ No newline at end of file +var _0xe008=['request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','UserProfileResource','then','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','Template','includeAll','include','findAll','rows','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','params','eml-format','rimraf','fast-json-patch'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xe008,0xf6));var _0x8e00=function(_0x337740,_0x565d3d){_0x337740=_0x337740-0x0;var _0x54c54c=_0xe008[_0x337740];return _0x54c54c;};'use strict';var emlformat=require(_0x8e00('0x0'));var rimraf=require(_0x8e00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e00('0x2'));var rp=require(_0x8e00('0x3'));var moment=require(_0x8e00('0x4'));var BPromise=require(_0x8e00('0x5'));var Mustache=require('mustache');var util=require(_0x8e00('0x6'));var path=require(_0x8e00('0x7'));var sox=require('sox');var csv=require(_0x8e00('0x8'));var ejs=require(_0x8e00('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e00('0xa'));var squel=require(_0x8e00('0xb'));var crypto=require(_0x8e00('0xc'));var jsforce=require(_0x8e00('0xd'));var deskjs=require(_0x8e00('0xe'));var toCsv=require(_0x8e00('0x8'));var querystring=require(_0x8e00('0xf'));var Papa=require(_0x8e00('0x10'));var Redis=require('ioredis');var authService=require(_0x8e00('0x11'));var qs=require(_0x8e00('0x12'));var as=require(_0x8e00('0x13'));var hardwareService=require(_0x8e00('0x14'));var logger=require('../../config/logger')(_0x8e00('0x15'));var utils=require(_0x8e00('0x16'));var config=require(_0x8e00('0x17'));var licenseUtil=require(_0x8e00('0x18'));var db=require(_0x8e00('0x19'))['db'];function respondWithStatusCode(_0x1d7559,_0x1f415f){_0x1f415f=_0x1f415f||0xcc;return function(_0xd5dd44){if(_0xd5dd44){return _0x1d7559['sendStatus'](_0x1f415f);}return _0x1d7559[_0x8e00('0x1a')](_0x1f415f)[_0x8e00('0x1b')]();};}function respondWithResult(_0x199bb3,_0x3399ba){_0x3399ba=_0x3399ba||0xc8;return function(_0x278c46){if(_0x278c46){return _0x199bb3[_0x8e00('0x1a')](_0x3399ba)[_0x8e00('0x1c')](_0x278c46);}};}function respondWithFilteredResult(_0x18f71c,_0x19cc57){return function(_0x1c358a){if(_0x1c358a){var _0x239cc8=typeof _0x19cc57[_0x8e00('0x1d')]==='undefined'&&typeof _0x19cc57[_0x8e00('0x1e')]===_0x8e00('0x1f');var _0x3c5f65=_0x1c358a[_0x8e00('0x20')];var _0x1a056c=_0x239cc8?0x0:_0x19cc57['offset'];var _0x4d61d3=_0x239cc8?_0x1c358a['count']:_0x19cc57[_0x8e00('0x1d')]+_0x19cc57[_0x8e00('0x1e')];var _0x4e34e1;if(_0x4d61d3>=_0x3c5f65){_0x4d61d3=_0x3c5f65;_0x4e34e1=0xc8;}else{_0x4e34e1=0xce;}_0x18f71c[_0x8e00('0x1a')](_0x4e34e1);return _0x18f71c[_0x8e00('0x21')](_0x8e00('0x22'),_0x1a056c+'-'+_0x4d61d3+'/'+_0x3c5f65)[_0x8e00('0x1c')](_0x1c358a);}return null;};}function patchUpdates(_0x1f2cb9){return function(_0x5d141a){try{jsonpatch[_0x8e00('0x23')](_0x5d141a,_0x1f2cb9,!![]);}catch(_0x4e3797){return BPromise['reject'](_0x4e3797);}return _0x5d141a[_0x8e00('0x24')]();};}function saveUpdates(_0x1a8246,_0x4747fd){return function(_0x251ee1){if(_0x251ee1){return _0x251ee1[_0x8e00('0x25')](_0x1a8246)['then'](function(_0x1dbc3c){return _0x1dbc3c;});}return null;};}function removeEntity(_0x258f04,_0x55cf6c){return function(_0x494305){if(_0x494305){return _0x494305[_0x8e00('0x26')]()['then'](function(){var _0x1a217a=_0x494305['get']({'plain':!![]});var _0x87684d='Templates';return db[_0x8e00('0x27')]['destroy']({'where':{'type':_0x87684d,'resourceId':_0x1a217a['id']}})['then'](function(){return _0x494305;});})[_0x8e00('0x28')](function(){_0x258f04['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e41e8,_0x28071a){return function(_0x48cebc){if(!_0x48cebc){_0x6e41e8[_0x8e00('0x29')](0x194);}return _0x48cebc;};}function handleError(_0x46465b,_0x514aa2){_0x514aa2=_0x514aa2||0x1f4;return function(_0xd6e993){logger[_0x8e00('0x2a')](_0xd6e993[_0x8e00('0x2b')]);if(_0xd6e993[_0x8e00('0x2c')]){delete _0xd6e993['name'];}_0x46465b[_0x8e00('0x1a')](_0x514aa2)['send'](_0xd6e993);};}exports[_0x8e00('0x2d')]=function(_0x648b30,_0x587560){var _0x8aa213={},_0x5de726={},_0x1c7aeb={'count':0x0,'rows':[]};var _0x2da4d5=_[_0x8e00('0x2e')](db['Template'][_0x8e00('0x2f')],function(_0xc731b7){return{'name':_0xc731b7['fieldName'],'type':_0xc731b7[_0x8e00('0x30')][_0x8e00('0x31')]};});_0x5de726[_0x8e00('0x32')]=_['map'](_0x2da4d5,'name');_0x5de726[_0x8e00('0x33')]=_[_0x8e00('0x34')](_0x648b30[_0x8e00('0x33')]);_0x5de726[_0x8e00('0x35')]=_[_0x8e00('0x36')](_0x5de726[_0x8e00('0x32')],_0x5de726[_0x8e00('0x33')]);_0x8aa213[_0x8e00('0x37')]=_[_0x8e00('0x36')](_0x5de726[_0x8e00('0x32')],qs['fields'](_0x648b30[_0x8e00('0x33')][_0x8e00('0x38')]));_0x8aa213[_0x8e00('0x37')]=_0x8aa213[_0x8e00('0x37')][_0x8e00('0x39')]?_0x8aa213[_0x8e00('0x37')]:_0x5de726['model'];if(!_0x648b30[_0x8e00('0x33')][_0x8e00('0x3a')](_0x8e00('0x3b'))){_0x8aa213[_0x8e00('0x1e')]=qs['limit'](_0x648b30[_0x8e00('0x33')][_0x8e00('0x1e')]);_0x8aa213[_0x8e00('0x1d')]=qs['offset'](_0x648b30[_0x8e00('0x33')]['offset']);}_0x8aa213['order']=qs[_0x8e00('0x3c')](_0x648b30[_0x8e00('0x33')][_0x8e00('0x3c')]);_0x8aa213[_0x8e00('0x3d')]=qs[_0x8e00('0x35')](_[_0x8e00('0x3e')](_0x648b30[_0x8e00('0x33')],_0x5de726[_0x8e00('0x35')]),_0x2da4d5);if(_0x648b30[_0x8e00('0x33')]['filter']){_0x8aa213[_0x8e00('0x3d')]=_[_0x8e00('0x3f')](_0x8aa213[_0x8e00('0x3d')],{'$or':_[_0x8e00('0x2e')](_0x2da4d5,function(_0x4d212a){if(_0x4d212a['type']!==_0x8e00('0x40')){var _0x1f33be={};_0x1f33be[_0x4d212a[_0x8e00('0x2c')]]={'$like':'%'+_0x648b30[_0x8e00('0x33')][_0x8e00('0x41')]+'%'};return _0x1f33be;}})});}_0x8aa213=_[_0x8e00('0x3f')]({},_0x8aa213,_0x648b30[_0x8e00('0x42')]);var _0x12f625={'where':_0x8aa213['where']};return db[_0x8e00('0x43')]['count'](_0x12f625)[_0x8e00('0x28')](function(_0x2c935c){_0x1c7aeb[_0x8e00('0x20')]=_0x2c935c;if(_0x648b30[_0x8e00('0x33')][_0x8e00('0x44')]){_0x8aa213[_0x8e00('0x45')]=[{'all':!![]}];}return db[_0x8e00('0x43')][_0x8e00('0x46')](_0x8aa213);})[_0x8e00('0x28')](function(_0x1f04f4){_0x1c7aeb[_0x8e00('0x47')]=_0x1f04f4;return _0x1c7aeb;})[_0x8e00('0x28')](respondWithFilteredResult(_0x587560,_0x8aa213))[_0x8e00('0x48')](handleError(_0x587560,null));};exports['show']=function(_0x2a8673,_0x1cdb38){var _0x118132={'raw':!![],'where':{'id':_0x2a8673['params']['id']}},_0x10fda4={};_0x10fda4[_0x8e00('0x32')]=_[_0x8e00('0x34')](db['Template'][_0x8e00('0x2f')]);_0x10fda4['query']=_[_0x8e00('0x34')](_0x2a8673['query']);_0x10fda4[_0x8e00('0x35')]=_[_0x8e00('0x36')](_0x10fda4[_0x8e00('0x32')],_0x10fda4[_0x8e00('0x33')]);_0x118132[_0x8e00('0x37')]=_['intersection'](_0x10fda4[_0x8e00('0x32')],qs[_0x8e00('0x38')](_0x2a8673[_0x8e00('0x33')][_0x8e00('0x38')]));_0x118132['attributes']=_0x118132[_0x8e00('0x37')][_0x8e00('0x39')]?_0x118132[_0x8e00('0x37')]:_0x10fda4[_0x8e00('0x32')];if(_0x2a8673['query'][_0x8e00('0x44')]){_0x118132[_0x8e00('0x45')]=[{'all':!![]}];}_0x118132=_[_0x8e00('0x3f')]({},_0x118132,_0x2a8673[_0x8e00('0x42')]);return db['Template']['find'](_0x118132)[_0x8e00('0x28')](handleEntityNotFound(_0x1cdb38,null))[_0x8e00('0x28')](respondWithResult(_0x1cdb38,null))[_0x8e00('0x48')](handleError(_0x1cdb38,null));};exports[_0x8e00('0x49')]=function(_0x198342,_0x554e1d){return db[_0x8e00('0x43')]['create'](_0x198342[_0x8e00('0x4a')],{})[_0x8e00('0x28')](function(_0x394245){var _0x3a901a=_0x198342[_0x8e00('0x4b')][_0x8e00('0x4c')]({'plain':!![]});if(!_0x3a901a)throw new Error(_0x8e00('0x4d'));if(_0x3a901a[_0x8e00('0x4e')]==='user'){var _0x30afd6=_0x394245[_0x8e00('0x4c')]({'plain':!![]});var _0x59001e=_0x8e00('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x59001e,'userProfileId':_0x3a901a[_0x8e00('0x50')]},'raw':!![]})[_0x8e00('0x28')](function(_0x57a137){if(_0x57a137&&_0x57a137[_0x8e00('0x51')]===0x0){return db['UserProfileResource'][_0x8e00('0x49')]({'name':_0x30afd6[_0x8e00('0x2c')],'resourceId':_0x30afd6['id'],'type':_0x57a137[_0x8e00('0x2c')],'sectionId':_0x57a137['id']},{})[_0x8e00('0x28')](function(){return _0x394245;});}else{return _0x394245;}})[_0x8e00('0x48')](function(_0x286990){logger[_0x8e00('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x286990);throw _0x286990;});}return _0x394245;})[_0x8e00('0x28')](respondWithResult(_0x554e1d,0xc9))[_0x8e00('0x48')](handleError(_0x554e1d,null));};exports['update']=function(_0x2e2da0,_0x7b2a18){if(_0x2e2da0[_0x8e00('0x4a')]['id']){delete _0x2e2da0[_0x8e00('0x4a')]['id'];}return db[_0x8e00('0x43')]['find']({'where':{'id':_0x2e2da0[_0x8e00('0x52')]['id']}})['then'](handleEntityNotFound(_0x7b2a18,null))[_0x8e00('0x28')](saveUpdates(_0x2e2da0['body'],null))[_0x8e00('0x28')](respondWithResult(_0x7b2a18,null))[_0x8e00('0x48')](handleError(_0x7b2a18,null));};exports[_0x8e00('0x26')]=function(_0x491494,_0x26f5b3){return db[_0x8e00('0x43')]['find']({'where':{'id':_0x491494[_0x8e00('0x52')]['id']}})['then'](handleEntityNotFound(_0x26f5b3,null))[_0x8e00('0x28')](removeEntity(_0x26f5b3,null))['catch'](handleError(_0x26f5b3,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 20a6f85..01c4fa7 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 _0xa8ed=['tools_templates','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','Template'];(function(_0xd09733,_0x59073f){var _0x4e8dca=function(_0x1ef84c){while(--_0x1ef84c){_0xd09733['push'](_0xd09733['shift']());}};_0x4e8dca(++_0x59073f);}(_0xa8ed,0x79));var _0xda8e=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xa8ed[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xda8e('0x0'));var util=require('util');var logger=require(_0xda8e('0x1'))(_0xda8e('0x2'));var moment=require(_0xda8e('0x3'));var BPromise=require('bluebird');var rp=require(_0xda8e('0x4'));var fs=require('fs');var path=require(_0xda8e('0x5'));var rimraf=require(_0xda8e('0x6'));var config=require(_0xda8e('0x7'));var attributes=require(_0xda8e('0x8'));module[_0xda8e('0x9')]=function(_0x420497,_0x4a382c){return _0x420497['define'](_0xda8e('0xa'),attributes,{'tableName':_0xda8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7623=['../../config/environment','./template.attributes','exports','tools_templates','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x7623,0x144));var _0x3762=function(_0x44bcb6,_0x16e9a3){_0x44bcb6=_0x44bcb6-0x0;var _0x49ac0f=_0x7623[_0x44bcb6];return _0x49ac0f;};'use strict';var _=require(_0x3762('0x0'));var util=require('util');var logger=require(_0x3762('0x1'))(_0x3762('0x2'));var moment=require(_0x3762('0x3'));var BPromise=require('bluebird');var rp=require(_0x3762('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3762('0x5'));var config=require(_0x3762('0x6'));var attributes=require(_0x3762('0x7'));module[_0x3762('0x8')]=function(_0x4e5ec6,_0x23a76e){return _0x4e5ec6['define']('Template',attributes,{'tableName':_0x3762('0x9'),'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 93fb133..7b00dda 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 _0x3651=['GetTemplate','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Template','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x70ccc3,_0x366280){var _0x393134=function(_0x1a0d8b){while(--_0x1a0d8b){_0x70ccc3['push'](_0x70ccc3['shift']());}};_0x393134(++_0x366280);}(_0x3651,0x1e1));var _0x1365=function(_0x335f4,_0x486916){_0x335f4=_0x335f4-0x0;var _0x56e562=_0x3651[_0x335f4];return _0x56e562;};'use strict';var _=require(_0x1365('0x0'));var util=require(_0x1365('0x1'));var moment=require('moment');var BPromise=require(_0x1365('0x2'));var rs=require(_0x1365('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1365('0x4'))['db'];var utils=require(_0x1365('0x5'));var logger=require(_0x1365('0x6'))(_0x1365('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1365('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bdda9,_0x15b51d,_0x483df7){return new BPromise(function(_0x1841f7,_0x138bef){return client[_0x1365('0x9')](_0x5bdda9,_0x483df7)[_0x1365('0xa')](function(_0x17c24d){logger[_0x1365('0xb')](_0x1365('0xc'),_0x15b51d,_0x1365('0xd'));logger[_0x1365('0xe')](_0x1365('0xf'),_0x15b51d,_0x1365('0xd'),JSON[_0x1365('0x10')](_0x17c24d));if(_0x17c24d[_0x1365('0x11')]){if(_0x17c24d['error']['code']===0x1f4){logger[_0x1365('0x11')]('Template,\x20%s,\x20%s',_0x15b51d,_0x17c24d[_0x1365('0x11')][_0x1365('0x12')]);return _0x138bef(_0x17c24d[_0x1365('0x11')]['message']);}logger['error'](_0x1365('0xc'),_0x15b51d,_0x17c24d[_0x1365('0x11')][_0x1365('0x12')]);return _0x1841f7(_0x17c24d[_0x1365('0x11')][_0x1365('0x12')]);}else{logger['info'](_0x1365('0xc'),_0x15b51d,_0x1365('0xd'));_0x1841f7(_0x17c24d[_0x1365('0x13')][_0x1365('0x12')]);}})[_0x1365('0x14')](function(_0x5124fd){logger['error'](_0x1365('0xc'),_0x15b51d,_0x5124fd);_0x138bef(_0x5124fd);});});}exports['GetTemplate']=function(_0x55d788){var _0x4dc3bb=this;return new Promise(function(_0x5c4d4d,_0x592552){return db[_0x1365('0x15')][_0x1365('0x16')]({'raw':_0x55d788['options']?_0x55d788[_0x1365('0x17')][_0x1365('0x18')]===undefined?!![]:![]:!![],'where':_0x55d788['options']?_0x55d788[_0x1365('0x17')][_0x1365('0x19')]||null:null,'attributes':_0x55d788[_0x1365('0x17')]?_0x55d788['options']['attributes']||null:null,'limit':_0x55d788[_0x1365('0x17')]?_0x55d788[_0x1365('0x17')][_0x1365('0x1a')]||null:null,'include':_0x55d788[_0x1365('0x17')]?_0x55d788[_0x1365('0x17')][_0x1365('0x1b')]?_[_0x1365('0x1c')](_0x55d788[_0x1365('0x17')][_0x1365('0x1b')],function(_0x597b8b){return{'model':db[_0x597b8b[_0x1365('0x1d')]],'as':_0x597b8b['as'],'attributes':_0x597b8b[_0x1365('0x1e')],'include':_0x597b8b[_0x1365('0x1b')]?_[_0x1365('0x1c')](_0x597b8b[_0x1365('0x1b')],function(_0x499653){return{'model':db[_0x499653['model']],'as':_0x499653['as'],'attributes':_0x499653[_0x1365('0x1e')],'include':_0x499653[_0x1365('0x1b')]?_[_0x1365('0x1c')](_0x499653[_0x1365('0x1b')],function(_0x42b280){return{'model':db[_0x42b280['model']],'as':_0x42b280['as'],'attributes':_0x42b280[_0x1365('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1365('0xa')](function(_0x22eaa3){logger[_0x1365('0xb')](_0x1365('0x1f'),_0x55d788);logger[_0x1365('0xe')]('GetTemplate',_0x55d788,JSON[_0x1365('0x10')](_0x22eaa3));_0x5c4d4d(_0x22eaa3);})[_0x1365('0x14')](function(_0x517677){logger[_0x1365('0x11')](_0x1365('0x1f'),_0x517677[_0x1365('0x12')],_0x55d788);_0x592552(_0x4dc3bb[_0x1365('0x11')](0x1f4,_0x517677['message']));});});}; \ No newline at end of file +var _0x62db=['findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','GetTemplate','Template'];(function(_0x25ef10,_0x18d17e){var _0x42f748=function(_0x23f7f8){while(--_0x23f7f8){_0x25ef10['push'](_0x25ef10['shift']());}};_0x42f748(++_0x18d17e);}(_0x62db,0x1a2));var _0xb62d=function(_0x48d695,_0xecfd19){_0x48d695=_0x48d695-0x0;var _0x1fe2fd=_0x62db[_0x48d695];return _0x1fe2fd;};'use strict';var _=require(_0xb62d('0x0'));var util=require('util');var moment=require(_0xb62d('0x1'));var BPromise=require(_0xb62d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb62d('0x3'));var db=require(_0xb62d('0x4'))['db'];var utils=require(_0xb62d('0x5'));var logger=require('../../config/logger')(_0xb62d('0x6'));var config=require(_0xb62d('0x7'));var jayson=require(_0xb62d('0x8'));var client=jayson['client'][_0xb62d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b1e53,_0x22173b,_0x23b6d3){return new BPromise(function(_0x5cee9e,_0x3bb685){return client[_0xb62d('0xa')](_0x1b1e53,_0x23b6d3)[_0xb62d('0xb')](function(_0x56a42e){logger['info'](_0xb62d('0xc'),_0x22173b,_0xb62d('0xd'));logger[_0xb62d('0xe')](_0xb62d('0xf'),_0x22173b,_0xb62d('0xd'),JSON[_0xb62d('0x10')](_0x56a42e));if(_0x56a42e['error']){if(_0x56a42e['error'][_0xb62d('0x11')]===0x1f4){logger[_0xb62d('0x12')](_0xb62d('0xc'),_0x22173b,_0x56a42e['error'][_0xb62d('0x13')]);return _0x3bb685(_0x56a42e[_0xb62d('0x12')][_0xb62d('0x13')]);}logger['error'](_0xb62d('0xc'),_0x22173b,_0x56a42e['error'][_0xb62d('0x13')]);return _0x5cee9e(_0x56a42e['error'][_0xb62d('0x13')]);}else{logger[_0xb62d('0x14')](_0xb62d('0xc'),_0x22173b,'request\x20sent');_0x5cee9e(_0x56a42e[_0xb62d('0x15')][_0xb62d('0x13')]);}})['catch'](function(_0x39140e){logger[_0xb62d('0x12')]('Template,\x20%s,\x20%s',_0x22173b,_0x39140e);_0x3bb685(_0x39140e);});});}exports[_0xb62d('0x16')]=function(_0x1180db){var _0x984d9e=this;return new Promise(function(_0x227901,_0x50d5a3){return db[_0xb62d('0x17')][_0xb62d('0x18')]({'raw':_0x1180db[_0xb62d('0x19')]?_0x1180db[_0xb62d('0x19')][_0xb62d('0x1a')]===undefined?!![]:![]:!![],'where':_0x1180db[_0xb62d('0x19')]?_0x1180db['options'][_0xb62d('0x1b')]||null:null,'attributes':_0x1180db['options']?_0x1180db[_0xb62d('0x19')][_0xb62d('0x1c')]||null:null,'limit':_0x1180db[_0xb62d('0x19')]?_0x1180db[_0xb62d('0x19')][_0xb62d('0x1d')]||null:null,'include':_0x1180db['options']?_0x1180db['options'][_0xb62d('0x1e')]?_[_0xb62d('0x1f')](_0x1180db[_0xb62d('0x19')][_0xb62d('0x1e')],function(_0x1b905d){return{'model':db[_0x1b905d[_0xb62d('0x20')]],'as':_0x1b905d['as'],'attributes':_0x1b905d[_0xb62d('0x1c')],'include':_0x1b905d['include']?_[_0xb62d('0x1f')](_0x1b905d['include'],function(_0x4f402d){return{'model':db[_0x4f402d['model']],'as':_0x4f402d['as'],'attributes':_0x4f402d['attributes'],'include':_0x4f402d[_0xb62d('0x1e')]?_[_0xb62d('0x1f')](_0x4f402d[_0xb62d('0x1e')],function(_0x1db6ed){return{'model':db[_0x1db6ed['model']],'as':_0x1db6ed['as'],'attributes':_0x1db6ed[_0xb62d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb62d('0xb')](function(_0x19c14d){logger['info']('GetTemplate',_0x1180db);logger[_0xb62d('0xe')]('GetTemplate',_0x1180db,JSON[_0xb62d('0x10')](_0x19c14d));_0x227901(_0x19c14d);})[_0xb62d('0x21')](function(_0x2e9405){logger['error'](_0xb62d('0x16'),_0x2e9405[_0xb62d('0x13')],_0x1180db);_0x50d5a3(_0x984d9e[_0xb62d('0x12')](0x1f4,_0x2e9405['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 68d71ca..22f54a5 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 _0x0ca8=['put','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAction'];(function(_0x850dba,_0x2aa4b7){var _0x45d478=function(_0x5d68ce){while(--_0x5d68ce){_0x850dba['push'](_0x850dba['shift']());}};_0x45d478(++_0x2aa4b7);}(_0x0ca8,0xe6));var _0x80ca=function(_0x52f195,_0xbba422){_0x52f195=_0x52f195-0x0;var _0x50b809=_0x0ca8[_0x52f195];return _0x50b809;};'use strict';var multer=require(_0x80ca('0x0'));var util=require(_0x80ca('0x1'));var path=require('path');var timeout=require(_0x80ca('0x2'));var express=require(_0x80ca('0x3'));var router=express['Router']();var fs_extra=require(_0x80ca('0x4'));var auth=require(_0x80ca('0x5'));var interaction=require(_0x80ca('0x6'));var config=require(_0x80ca('0x7'));var controller=require(_0x80ca('0x8'));router[_0x80ca('0x9')]('/',auth[_0x80ca('0xa')](),controller['index']);router[_0x80ca('0x9')]('/:id',auth[_0x80ca('0xa')](),controller['show']);router['get'](_0x80ca('0xb'),auth[_0x80ca('0xa')](),controller['getAllConditions']);router['get'](_0x80ca('0xc'),auth[_0x80ca('0xa')](),controller[_0x80ca('0xd')]);router['get'](_0x80ca('0xe'),auth['isAuthenticated'](),controller[_0x80ca('0xf')]);router[_0x80ca('0x10')]('/',auth['isAuthenticated'](),controller[_0x80ca('0x11')]);router[_0x80ca('0x10')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x80ca('0x12')]);router[_0x80ca('0x10')]('/:id/any_conditions',auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x80ca('0x10')](_0x80ca('0xe'),auth[_0x80ca('0xa')](),controller[_0x80ca('0x13')]);router[_0x80ca('0x14')](_0x80ca('0x15'),auth[_0x80ca('0xa')](),controller[_0x80ca('0x16')]);router['delete'](_0x80ca('0x15'),auth[_0x80ca('0xa')](),controller[_0x80ca('0x17')]);module[_0x80ca('0x18')]=router; \ No newline at end of file +var _0xca21=['post','addAllCondition','addAction','put','/:id','update','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions'];(function(_0x5d31ee,_0x183e43){var _0x21c2e6=function(_0x176343){while(--_0x176343){_0x5d31ee['push'](_0x5d31ee['shift']());}};_0x21c2e6(++_0x183e43);}(_0xca21,0xcf));var _0x1ca2=function(_0x2e8823,_0x494a1d){_0x2e8823=_0x2e8823-0x0;var _0x29b0d7=_0xca21[_0x2e8823];return _0x29b0d7;};'use strict';var multer=require(_0x1ca2('0x0'));var util=require(_0x1ca2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1ca2('0x2'));var router=express[_0x1ca2('0x3')]();var fs_extra=require(_0x1ca2('0x4'));var auth=require(_0x1ca2('0x5'));var interaction=require(_0x1ca2('0x6'));var config=require(_0x1ca2('0x7'));var controller=require(_0x1ca2('0x8'));router[_0x1ca2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ca2('0x9')]('/:id',auth[_0x1ca2('0xa')](),controller[_0x1ca2('0xb')]);router['get'](_0x1ca2('0xc'),auth['isAuthenticated'](),controller[_0x1ca2('0xd')]);router[_0x1ca2('0x9')](_0x1ca2('0xe'),auth[_0x1ca2('0xa')](),controller[_0x1ca2('0xf')]);router['get'](_0x1ca2('0x10'),auth['isAuthenticated'](),controller[_0x1ca2('0x11')]);router['post']('/',auth[_0x1ca2('0xa')](),controller['create']);router[_0x1ca2('0x12')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x1ca2('0x13')]);router[_0x1ca2('0x12')](_0x1ca2('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x1ca2('0x12')](_0x1ca2('0x10'),auth['isAuthenticated'](),controller[_0x1ca2('0x14')]);router[_0x1ca2('0x15')](_0x1ca2('0x16'),auth[_0x1ca2('0xa')](),controller[_0x1ca2('0x17')]);router['delete'](_0x1ca2('0x16'),auth['isAuthenticated'](),controller[_0x1ca2('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3eea8ee..9f163cc 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 _0xff39=['exports','STRING','BOOLEAN'];(function(_0x4e2c96,_0x527b89){var _0x55dda5=function(_0x52f9f2){while(--_0x52f9f2){_0x4e2c96['push'](_0x4e2c96['shift']());}};_0x55dda5(++_0x527b89);}(_0xff39,0xba));var _0x9ff3=function(_0x37bab4,_0x4fa85e){_0x37bab4=_0x37bab4-0x0;var _0x336d20=_0xff39[_0x37bab4];return _0x336d20;};'use strict';var Sequelize=require('sequelize');module[_0x9ff3('0x0')]={'name':{'type':Sequelize[_0x9ff3('0x1')]},'channel':{'type':Sequelize[_0x9ff3('0x1')]},'description':{'type':Sequelize[_0x9ff3('0x1')]},'status':{'type':Sequelize[_0x9ff3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe816=['STRING','BOOLEAN','sequelize','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xe816,0x126));var _0x6e81=function(_0x3caa1d,_0x51acd2){_0x3caa1d=_0x3caa1d-0x0;var _0x597187=_0xe816[_0x3caa1d];return _0x597187;};'use strict';var Sequelize=require(_0x6e81('0x0'));module[_0x6e81('0x1')]={'name':{'type':Sequelize[_0x6e81('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6e81('0x2')]},'status':{'type':Sequelize[_0x6e81('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 e335811..4d1f30e 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 _0xfc9b=['json','offset','limit','undefined','count','set','reject','update','then','destroy','get','Triggers','UserProfileResource','name','send','map','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','Trigger','include','rows','catch','show','params','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','keys','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x34c6d2,_0x9cc217){var _0x5626e4=function(_0x45d2d8){while(--_0x45d2d8){_0x34c6d2['push'](_0x34c6d2['shift']());}};_0x5626e4(++_0x9cc217);}(_0xfc9b,0xf6));var _0xbfc9=function(_0x10b849,_0xff5d3b){_0x10b849=_0x10b849-0x0;var _0x4b646d=_0xfc9b[_0x10b849];return _0x4b646d;};'use strict';var emlformat=require(_0xbfc9('0x0'));var rimraf=require(_0xbfc9('0x1'));var zipdir=require(_0xbfc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbfc9('0x3'));var moment=require('moment');var BPromise=require(_0xbfc9('0x4'));var Mustache=require(_0xbfc9('0x5'));var util=require(_0xbfc9('0x6'));var path=require(_0xbfc9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfc9('0x8'));var _=require(_0xbfc9('0x9'));var squel=require(_0xbfc9('0xa'));var crypto=require('crypto');var jsforce=require(_0xbfc9('0xb'));var deskjs=require(_0xbfc9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbfc9('0xd'));var Papa=require(_0xbfc9('0xe'));var Redis=require(_0xbfc9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbfc9('0x10'));var hardwareService=require(_0xbfc9('0x11'));var logger=require(_0xbfc9('0x12'))(_0xbfc9('0x13'));var utils=require(_0xbfc9('0x14'));var config=require(_0xbfc9('0x15'));var licenseUtil=require(_0xbfc9('0x16'));var db=require(_0xbfc9('0x17'))['db'];function respondWithStatusCode(_0x57a039,_0x53798d){_0x53798d=_0x53798d||0xcc;return function(_0x1523a6){if(_0x1523a6){return _0x57a039[_0xbfc9('0x18')](_0x53798d);}return _0x57a039[_0xbfc9('0x19')](_0x53798d)[_0xbfc9('0x1a')]();};}function respondWithResult(_0x243220,_0x8fcd73){_0x8fcd73=_0x8fcd73||0xc8;return function(_0x4e485d){if(_0x4e485d){return _0x243220['status'](_0x8fcd73)[_0xbfc9('0x1b')](_0x4e485d);}};}function respondWithFilteredResult(_0xcba91b,_0x76e399){return function(_0x3cdd79){if(_0x3cdd79){var _0x105592=typeof _0x76e399[_0xbfc9('0x1c')]==='undefined'&&typeof _0x76e399[_0xbfc9('0x1d')]===_0xbfc9('0x1e');var _0xcfb08a=_0x3cdd79[_0xbfc9('0x1f')];var _0x456233=_0x105592?0x0:_0x76e399['offset'];var _0x3feaf4=_0x105592?_0x3cdd79['count']:_0x76e399[_0xbfc9('0x1c')]+_0x76e399[_0xbfc9('0x1d')];var _0x4e9a96;if(_0x3feaf4>=_0xcfb08a){_0x3feaf4=_0xcfb08a;_0x4e9a96=0xc8;}else{_0x4e9a96=0xce;}_0xcba91b['status'](_0x4e9a96);return _0xcba91b[_0xbfc9('0x20')]('Content-Range',_0x456233+'-'+_0x3feaf4+'/'+_0xcfb08a)['json'](_0x3cdd79);}return null;};}function patchUpdates(_0x439c42){return function(_0x2c723a){try{jsonpatch['apply'](_0x2c723a,_0x439c42,!![]);}catch(_0x43bc1d){return BPromise[_0xbfc9('0x21')](_0x43bc1d);}return _0x2c723a['save']();};}function saveUpdates(_0x4c802f,_0x3ec26a){return function(_0xec80fc){if(_0xec80fc){return _0xec80fc[_0xbfc9('0x22')](_0x4c802f)[_0xbfc9('0x23')](function(_0x15f995){return _0x15f995;});}return null;};}function removeEntity(_0x11f7b6,_0xe1cace){return function(_0x47547f){if(_0x47547f){return _0x47547f[_0xbfc9('0x24')]()['then'](function(){var _0xa4bac4=_0x47547f[_0xbfc9('0x25')]({'plain':!![]});var _0x2357c5=_0xbfc9('0x26');return db[_0xbfc9('0x27')][_0xbfc9('0x24')]({'where':{'type':_0x2357c5,'resourceId':_0xa4bac4['id']}})['then'](function(){return _0x47547f;});})[_0xbfc9('0x23')](function(){_0x11f7b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4507ea,_0x560e1e){return function(_0x502dde){if(!_0x502dde){_0x4507ea[_0xbfc9('0x18')](0x194);}return _0x502dde;};}function handleError(_0x2d80c0,_0x2a228a){_0x2a228a=_0x2a228a||0x1f4;return function(_0x393033){logger['error'](_0x393033['stack']);if(_0x393033['name']){delete _0x393033[_0xbfc9('0x28')];}_0x2d80c0['status'](_0x2a228a)[_0xbfc9('0x29')](_0x393033);};}exports['index']=function(_0x2b815c,_0x1cd2b6){var _0x27fa57={},_0x3ab147={},_0x140bc3={'count':0x0,'rows':[]};var _0x432eb0=_[_0xbfc9('0x2a')](db['Trigger']['rawAttributes'],function(_0x2ed65e){return{'name':_0x2ed65e['fieldName'],'type':_0x2ed65e[_0xbfc9('0x2b')]['key']};});_0x3ab147[_0xbfc9('0x2c')]=_[_0xbfc9('0x2a')](_0x432eb0,'name');_0x3ab147[_0xbfc9('0x2d')]=_['keys'](_0x2b815c[_0xbfc9('0x2d')]);_0x3ab147[_0xbfc9('0x2e')]=_['intersection'](_0x3ab147['model'],_0x3ab147[_0xbfc9('0x2d')]);_0x27fa57[_0xbfc9('0x2f')]=_[_0xbfc9('0x30')](_0x3ab147[_0xbfc9('0x2c')],qs[_0xbfc9('0x31')](_0x2b815c[_0xbfc9('0x2d')][_0xbfc9('0x31')]));_0x27fa57['attributes']=_0x27fa57[_0xbfc9('0x2f')][_0xbfc9('0x32')]?_0x27fa57[_0xbfc9('0x2f')]:_0x3ab147[_0xbfc9('0x2c')];if(!_0x2b815c[_0xbfc9('0x2d')]['hasOwnProperty'](_0xbfc9('0x33'))){_0x27fa57[_0xbfc9('0x1d')]=qs[_0xbfc9('0x1d')](_0x2b815c['query']['limit']);_0x27fa57[_0xbfc9('0x1c')]=qs[_0xbfc9('0x1c')](_0x2b815c[_0xbfc9('0x2d')][_0xbfc9('0x1c')]);}_0x27fa57[_0xbfc9('0x34')]=qs['sort'](_0x2b815c[_0xbfc9('0x2d')][_0xbfc9('0x35')]);_0x27fa57[_0xbfc9('0x36')]=qs[_0xbfc9('0x2e')](_[_0xbfc9('0x37')](_0x2b815c['query'],_0x3ab147[_0xbfc9('0x2e')]),_0x432eb0);if(_0x2b815c[_0xbfc9('0x2d')][_0xbfc9('0x38')]){_0x27fa57[_0xbfc9('0x36')]=_[_0xbfc9('0x39')](_0x27fa57[_0xbfc9('0x36')],{'$or':_[_0xbfc9('0x2a')](_0x432eb0,function(_0x5d8c4b){if(_0x5d8c4b[_0xbfc9('0x2b')]!=='VIRTUAL'){var _0x187c5b={};_0x187c5b[_0x5d8c4b[_0xbfc9('0x28')]]={'$like':'%'+_0x2b815c[_0xbfc9('0x2d')]['filter']+'%'};return _0x187c5b;}})});}_0x27fa57=_[_0xbfc9('0x39')]({},_0x27fa57,_0x2b815c[_0xbfc9('0x3a')]);var _0x2f3822={'where':_0x27fa57[_0xbfc9('0x36')]};return db[_0xbfc9('0x3b')][_0xbfc9('0x1f')](_0x2f3822)[_0xbfc9('0x23')](function(_0x5870b9){_0x140bc3[_0xbfc9('0x1f')]=_0x5870b9;if(_0x2b815c[_0xbfc9('0x2d')]['includeAll']){_0x27fa57[_0xbfc9('0x3c')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x27fa57);})[_0xbfc9('0x23')](function(_0x16f987){_0x140bc3[_0xbfc9('0x3d')]=_0x16f987;return _0x140bc3;})[_0xbfc9('0x23')](respondWithFilteredResult(_0x1cd2b6,_0x27fa57))[_0xbfc9('0x3e')](handleError(_0x1cd2b6,null));};exports[_0xbfc9('0x3f')]=function(_0x35db3c,_0x1e7641){var _0xfbcfa9={'raw':![],'where':{'id':_0x35db3c[_0xbfc9('0x40')]['id']}},_0x30c4f8={};_0x30c4f8[_0xbfc9('0x2c')]=_['keys'](db[_0xbfc9('0x3b')][_0xbfc9('0x41')]);_0x30c4f8['query']=_['keys'](_0x35db3c[_0xbfc9('0x2d')]);_0x30c4f8[_0xbfc9('0x2e')]=_[_0xbfc9('0x30')](_0x30c4f8[_0xbfc9('0x2c')],_0x30c4f8[_0xbfc9('0x2d')]);_0xfbcfa9['attributes']=_[_0xbfc9('0x30')](_0x30c4f8['model'],qs[_0xbfc9('0x31')](_0x35db3c[_0xbfc9('0x2d')][_0xbfc9('0x31')]));_0xfbcfa9['attributes']=_0xfbcfa9[_0xbfc9('0x2f')][_0xbfc9('0x32')]?_0xfbcfa9[_0xbfc9('0x2f')]:_0x30c4f8[_0xbfc9('0x2c')];if(_0x35db3c['query'][_0xbfc9('0x42')]){_0xfbcfa9[_0xbfc9('0x3c')]=[{'all':!![]}];}_0xfbcfa9=_[_0xbfc9('0x39')]({},_0xfbcfa9,_0x35db3c[_0xbfc9('0x3a')]);return db['Trigger'][_0xbfc9('0x43')](_0xfbcfa9)[_0xbfc9('0x23')](handleEntityNotFound(_0x1e7641,null))[_0xbfc9('0x23')](respondWithResult(_0x1e7641,null))['catch'](handleError(_0x1e7641,null));};exports[_0xbfc9('0x44')]=function(_0x3d78bc,_0x1f331c){return db[_0xbfc9('0x3b')][_0xbfc9('0x44')](_0x3d78bc['body'],{})[_0xbfc9('0x23')](function(_0x21016a){var _0x6029ca=_0x3d78bc[_0xbfc9('0x45')][_0xbfc9('0x25')]({'plain':!![]});if(!_0x6029ca)throw new Error(_0xbfc9('0x46'));if(_0x6029ca['role']==='user'){var _0x42b23a=_0x21016a[_0xbfc9('0x25')]({'plain':!![]});var _0x54e72d=_0xbfc9('0x26');return db[_0xbfc9('0x47')][_0xbfc9('0x43')]({'where':{'name':_0x54e72d,'userProfileId':_0x6029ca[_0xbfc9('0x48')]},'raw':!![]})['then'](function(_0x5913bd){if(_0x5913bd&&_0x5913bd[_0xbfc9('0x49')]===0x0){return db[_0xbfc9('0x27')]['create']({'name':_0x42b23a[_0xbfc9('0x28')],'resourceId':_0x42b23a['id'],'type':_0x5913bd[_0xbfc9('0x28')],'sectionId':_0x5913bd['id']},{})['then'](function(){return _0x21016a;});}else{return _0x21016a;}})[_0xbfc9('0x3e')](function(_0x38c6bf){logger[_0xbfc9('0x4a')](_0xbfc9('0x4b'),_0x38c6bf);throw _0x38c6bf;});}return _0x21016a;})[_0xbfc9('0x23')](respondWithResult(_0x1f331c,0xc9))[_0xbfc9('0x3e')](handleError(_0x1f331c,null));};exports[_0xbfc9('0x22')]=function(_0x370b5f,_0x3b8f33){if(_0x370b5f[_0xbfc9('0x4c')]['id']){delete _0x370b5f[_0xbfc9('0x4c')]['id'];}return db[_0xbfc9('0x3b')][_0xbfc9('0x43')]({'where':{'id':_0x370b5f[_0xbfc9('0x40')]['id']}})[_0xbfc9('0x23')](handleEntityNotFound(_0x3b8f33,null))['then'](saveUpdates(_0x370b5f['body'],null))[_0xbfc9('0x23')](respondWithResult(_0x3b8f33,null))['catch'](handleError(_0x3b8f33,null));};exports[_0xbfc9('0x24')]=function(_0x348308,_0x3faa8b){return db[_0xbfc9('0x3b')][_0xbfc9('0x43')]({'where':{'id':_0x348308[_0xbfc9('0x40')]['id']}})[_0xbfc9('0x23')](handleEntityNotFound(_0x3faa8b,null))[_0xbfc9('0x23')](removeEntity(_0x3faa8b,null))[_0xbfc9('0x3e')](handleError(_0x3faa8b,null));};exports[_0xbfc9('0x4d')]=function(_0x369a7c,_0x665c87,_0x3909d4){if(_0x369a7c[_0xbfc9('0x4c')]['id']){delete _0x369a7c['body']['id'];}return db[_0xbfc9('0x3b')][_0xbfc9('0x43')]({'where':{'id':_0x369a7c[_0xbfc9('0x40')]['id']}})[_0xbfc9('0x23')](handleEntityNotFound(_0x665c87,null))[_0xbfc9('0x23')](function(_0x9cda19){if(_0x9cda19){_0x369a7c[_0xbfc9('0x4c')][_0xbfc9('0x4e')]=_0x9cda19['id'];return db[_0xbfc9('0x4f')][_0xbfc9('0x44')](_0x369a7c[_0xbfc9('0x4c')]);}})['then'](respondWithResult(_0x665c87,null))[_0xbfc9('0x3e')](handleError(_0x665c87,null));};exports[_0xbfc9('0x50')]=function(_0x424d35,_0x369676,_0x493ff0){if(_0x424d35[_0xbfc9('0x4c')]['id']){delete _0x424d35['body']['id'];}return db[_0xbfc9('0x3b')][_0xbfc9('0x43')]({'where':{'id':_0x424d35[_0xbfc9('0x40')]['id']}})[_0xbfc9('0x23')](handleEntityNotFound(_0x369676,null))[_0xbfc9('0x23')](function(_0x427b1d){if(_0x427b1d){_0x424d35['body'][_0xbfc9('0x51')]=_0x427b1d['id'];return db[_0xbfc9('0x4f')]['create'](_0x424d35['body']);}})[_0xbfc9('0x23')](respondWithResult(_0x369676,null))['catch'](handleError(_0x369676,null));};exports[_0xbfc9('0x52')]=function(_0x1f27ac,_0x127893,_0x382493){var _0x6e5afc={};var _0x134b4f={};var _0x198133;var _0x2b2786;return db['Trigger'][_0xbfc9('0x53')]({'where':{'id':_0x1f27ac['params']['id']}})[_0xbfc9('0x23')](handleEntityNotFound(_0x127893,null))[_0xbfc9('0x23')](function(_0x16c3c5){if(_0x16c3c5){_0x198133=_0x16c3c5;_0x134b4f[_0xbfc9('0x2c')]=_[_0xbfc9('0x54')](db[_0xbfc9('0x4f')][_0xbfc9('0x41')]);_0x134b4f[_0xbfc9('0x2d')]=_[_0xbfc9('0x54')](_0x1f27ac[_0xbfc9('0x2d')]);_0x134b4f['filters']=_[_0xbfc9('0x30')](_0x134b4f[_0xbfc9('0x2c')],_0x134b4f[_0xbfc9('0x2d')]);_0x6e5afc['attributes']=_[_0xbfc9('0x30')](_0x134b4f['model'],qs[_0xbfc9('0x31')](_0x1f27ac[_0xbfc9('0x2d')][_0xbfc9('0x31')]));_0x6e5afc[_0xbfc9('0x2f')]=_0x6e5afc[_0xbfc9('0x2f')][_0xbfc9('0x32')]?_0x6e5afc[_0xbfc9('0x2f')]:_0x134b4f[_0xbfc9('0x2c')];_0x6e5afc['order']=qs[_0xbfc9('0x35')](_0x1f27ac[_0xbfc9('0x2d')]['sort']);_0x6e5afc[_0xbfc9('0x36')]=qs[_0xbfc9('0x2e')](_['pick'](_0x1f27ac[_0xbfc9('0x2d')],_0x134b4f[_0xbfc9('0x2e')]));if(_0x1f27ac[_0xbfc9('0x2d')][_0xbfc9('0x38')]){_0x6e5afc[_0xbfc9('0x36')]=_[_0xbfc9('0x39')](_0x6e5afc['where'],{'$or':_[_0xbfc9('0x2a')](_0x6e5afc[_0xbfc9('0x2f')],function(_0x5c8948){var _0x5a1fb6={};_0x5a1fb6[_0x5c8948]={'$like':'%'+_0x1f27ac[_0xbfc9('0x2d')]['filter']+'%'};return _0x5a1fb6;})});}_0x6e5afc=_['merge']({},_0x6e5afc,_0x1f27ac[_0xbfc9('0x3a')]);return _0x198133['getAllConditions'](_0x6e5afc);}})[_0xbfc9('0x23')](function(_0x131d6b){if(_0x131d6b){_0x2b2786=_0x131d6b['length'];if(!_0x1f27ac['query'][_0xbfc9('0x55')](_0xbfc9('0x33'))){_0x6e5afc['limit']=qs['limit'](_0x1f27ac[_0xbfc9('0x2d')]['limit']);_0x6e5afc[_0xbfc9('0x1c')]=qs[_0xbfc9('0x1c')](_0x1f27ac[_0xbfc9('0x2d')][_0xbfc9('0x1c')]);}return _0x198133['getAllConditions'](_0x6e5afc);}})[_0xbfc9('0x23')](function(_0x18506c){if(_0x18506c){return _0x18506c?{'count':_0x2b2786,'rows':_0x18506c}:null;}})[_0xbfc9('0x23')](respondWithResult(_0x127893,null))[_0xbfc9('0x3e')](handleError(_0x127893,null));};exports['getAnyConditions']=function(_0x415445,_0x5c7fbe,_0x4144e7){var _0x4aabc2={};var _0x37b87d={};var _0x24387a;var _0x3511ee;return db['Trigger'][_0xbfc9('0x53')]({'where':{'id':_0x415445['params']['id']}})[_0xbfc9('0x23')](handleEntityNotFound(_0x5c7fbe,null))[_0xbfc9('0x23')](function(_0x5e28af){if(_0x5e28af){_0x24387a=_0x5e28af;_0x37b87d['model']=_[_0xbfc9('0x54')](db[_0xbfc9('0x4f')]['rawAttributes']);_0x37b87d[_0xbfc9('0x2d')]=_[_0xbfc9('0x54')](_0x415445[_0xbfc9('0x2d')]);_0x37b87d['filters']=_['intersection'](_0x37b87d[_0xbfc9('0x2c')],_0x37b87d[_0xbfc9('0x2d')]);_0x4aabc2[_0xbfc9('0x2f')]=_[_0xbfc9('0x30')](_0x37b87d[_0xbfc9('0x2c')],qs['fields'](_0x415445[_0xbfc9('0x2d')][_0xbfc9('0x31')]));_0x4aabc2[_0xbfc9('0x2f')]=_0x4aabc2[_0xbfc9('0x2f')][_0xbfc9('0x32')]?_0x4aabc2[_0xbfc9('0x2f')]:_0x37b87d['model'];_0x4aabc2[_0xbfc9('0x34')]=qs[_0xbfc9('0x35')](_0x415445[_0xbfc9('0x2d')][_0xbfc9('0x35')]);_0x4aabc2['where']=qs[_0xbfc9('0x2e')](_[_0xbfc9('0x37')](_0x415445['query'],_0x37b87d[_0xbfc9('0x2e')]));if(_0x415445[_0xbfc9('0x2d')][_0xbfc9('0x38')]){_0x4aabc2[_0xbfc9('0x36')]=_[_0xbfc9('0x39')](_0x4aabc2[_0xbfc9('0x36')],{'$or':_['map'](_0x4aabc2[_0xbfc9('0x2f')],function(_0x47b691){var _0x570da1={};_0x570da1[_0x47b691]={'$like':'%'+_0x415445[_0xbfc9('0x2d')][_0xbfc9('0x38')]+'%'};return _0x570da1;})});}_0x4aabc2=_[_0xbfc9('0x39')]({},_0x4aabc2,_0x415445['options']);return _0x24387a['getAnyConditions'](_0x4aabc2);}})[_0xbfc9('0x23')](function(_0x79563e){if(_0x79563e){_0x3511ee=_0x79563e[_0xbfc9('0x32')];if(!_0x415445['query'][_0xbfc9('0x55')](_0xbfc9('0x33'))){_0x4aabc2[_0xbfc9('0x1d')]=qs[_0xbfc9('0x1d')](_0x415445[_0xbfc9('0x2d')]['limit']);_0x4aabc2[_0xbfc9('0x1c')]=qs['offset'](_0x415445[_0xbfc9('0x2d')]['offset']);}return _0x24387a[_0xbfc9('0x56')](_0x4aabc2);}})[_0xbfc9('0x23')](function(_0x4b033e){if(_0x4b033e){return _0x4b033e?{'count':_0x3511ee,'rows':_0x4b033e}:null;}})[_0xbfc9('0x23')](respondWithResult(_0x5c7fbe,null))[_0xbfc9('0x3e')](handleError(_0x5c7fbe,null));};exports[_0xbfc9('0x57')]=function(_0x153a1e,_0x38b7be,_0x443384){if(_0x153a1e['body']['id']){delete _0x153a1e['body']['id'];}return db[_0xbfc9('0x3b')][_0xbfc9('0x43')]({'where':{'id':_0x153a1e[_0xbfc9('0x40')]['id']}})[_0xbfc9('0x23')](handleEntityNotFound(_0x38b7be,null))[_0xbfc9('0x23')](function(_0x48d870){if(_0x48d870){_0x153a1e[_0xbfc9('0x4c')][_0xbfc9('0x58')]=_0x48d870['id'];return db[_0xbfc9('0x59')][_0xbfc9('0x44')](_0x153a1e[_0xbfc9('0x4c')]);}})['then'](respondWithResult(_0x38b7be,null))[_0xbfc9('0x3e')](handleError(_0x38b7be,null));};exports[_0xbfc9('0x5a')]=function(_0x4f9d4c,_0x10e421,_0x35a670){var _0x10c87d={};var _0x484d80={};var _0x4394a6;var _0x1a7ece;return db[_0xbfc9('0x3b')][_0xbfc9('0x53')]({'where':{'id':_0x4f9d4c[_0xbfc9('0x40')]['id']}})[_0xbfc9('0x23')](handleEntityNotFound(_0x10e421,null))[_0xbfc9('0x23')](function(_0x2ae582){if(_0x2ae582){_0x4394a6=_0x2ae582;_0x484d80[_0xbfc9('0x2c')]=_[_0xbfc9('0x54')](db['Action']['rawAttributes']);_0x484d80[_0xbfc9('0x2d')]=_['keys'](_0x4f9d4c[_0xbfc9('0x2d')]);_0x484d80['filters']=_[_0xbfc9('0x30')](_0x484d80[_0xbfc9('0x2c')],_0x484d80[_0xbfc9('0x2d')]);_0x10c87d[_0xbfc9('0x2f')]=_[_0xbfc9('0x30')](_0x484d80[_0xbfc9('0x2c')],qs[_0xbfc9('0x31')](_0x4f9d4c[_0xbfc9('0x2d')][_0xbfc9('0x31')]));_0x10c87d[_0xbfc9('0x2f')]=_0x10c87d[_0xbfc9('0x2f')][_0xbfc9('0x32')]?_0x10c87d['attributes']:_0x484d80[_0xbfc9('0x2c')];_0x10c87d[_0xbfc9('0x34')]=qs['sort'](_0x4f9d4c['query'][_0xbfc9('0x35')]);_0x10c87d['where']=qs[_0xbfc9('0x2e')](_[_0xbfc9('0x37')](_0x4f9d4c[_0xbfc9('0x2d')],_0x484d80[_0xbfc9('0x2e')]));if(_0x4f9d4c['query'][_0xbfc9('0x38')]){_0x10c87d[_0xbfc9('0x36')]=_[_0xbfc9('0x39')](_0x10c87d[_0xbfc9('0x36')],{'$or':_[_0xbfc9('0x2a')](_0x10c87d[_0xbfc9('0x2f')],function(_0x175342){var _0x3dc117={};_0x3dc117[_0x175342]={'$like':'%'+_0x4f9d4c[_0xbfc9('0x2d')][_0xbfc9('0x38')]+'%'};return _0x3dc117;})});}_0x10c87d=_[_0xbfc9('0x39')]({},_0x10c87d,_0x4f9d4c['options']);return _0x4394a6[_0xbfc9('0x5a')](_0x10c87d);}})[_0xbfc9('0x23')](function(_0x3baaef){if(_0x3baaef){_0x1a7ece=_0x3baaef[_0xbfc9('0x32')];if(!_0x4f9d4c[_0xbfc9('0x2d')][_0xbfc9('0x55')](_0xbfc9('0x33'))){_0x10c87d[_0xbfc9('0x1d')]=qs[_0xbfc9('0x1d')](_0x4f9d4c[_0xbfc9('0x2d')][_0xbfc9('0x1d')]);_0x10c87d['offset']=qs['offset'](_0x4f9d4c['query'][_0xbfc9('0x1c')]);}return _0x4394a6[_0xbfc9('0x5a')](_0x10c87d);}})[_0xbfc9('0x23')](function(_0x5129cf){if(_0x5129cf){return _0x5129cf?{'count':_0x1a7ece,'rows':_0x5129cf}:null;}})[_0xbfc9('0x23')](respondWithResult(_0x10e421,null))['catch'](handleError(_0x10e421,null));}; \ No newline at end of file +var _0xe363=['error','params','addAllCondition','TriggerAllId','create','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','get','Triggers','UserProfileResource','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe363,0x13c));var _0x3e36=function(_0xbb0a3c,_0x28ae78){_0xbb0a3c=_0xbb0a3c-0x0;var _0x3c39ff=_0xe363[_0xbb0a3c];return _0x3c39ff;};'use strict';var emlformat=require(_0x3e36('0x0'));var rimraf=require(_0x3e36('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3e36('0x2'));var moment=require(_0x3e36('0x3'));var BPromise=require(_0x3e36('0x4'));var Mustache=require(_0x3e36('0x5'));var util=require(_0x3e36('0x6'));var path=require(_0x3e36('0x7'));var sox=require(_0x3e36('0x8'));var csv=require(_0x3e36('0x9'));var ejs=require(_0x3e36('0xa'));var fs=require('fs');var fs_extra=require(_0x3e36('0xb'));var _=require(_0x3e36('0xc'));var squel=require(_0x3e36('0xd'));var crypto=require(_0x3e36('0xe'));var jsforce=require(_0x3e36('0xf'));var deskjs=require(_0x3e36('0x10'));var toCsv=require(_0x3e36('0x9'));var querystring=require(_0x3e36('0x11'));var Papa=require('papaparse');var Redis=require(_0x3e36('0x12'));var authService=require(_0x3e36('0x13'));var qs=require(_0x3e36('0x14'));var as=require(_0x3e36('0x15'));var hardwareService=require(_0x3e36('0x16'));var logger=require(_0x3e36('0x17'))(_0x3e36('0x18'));var utils=require(_0x3e36('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3e36('0x1a'));var db=require(_0x3e36('0x1b'))['db'];function respondWithStatusCode(_0x4161cf,_0x6cfb66){_0x6cfb66=_0x6cfb66||0xcc;return function(_0x5d8152){if(_0x5d8152){return _0x4161cf[_0x3e36('0x1c')](_0x6cfb66);}return _0x4161cf[_0x3e36('0x1d')](_0x6cfb66)[_0x3e36('0x1e')]();};}function respondWithResult(_0x3eafc3,_0x51c8e9){_0x51c8e9=_0x51c8e9||0xc8;return function(_0x35a88a){if(_0x35a88a){return _0x3eafc3[_0x3e36('0x1d')](_0x51c8e9)[_0x3e36('0x1f')](_0x35a88a);}};}function respondWithFilteredResult(_0x1f4be9,_0x186ec0){return function(_0x3993bf){if(_0x3993bf){var _0x654fb1=typeof _0x186ec0[_0x3e36('0x20')]===_0x3e36('0x21')&&typeof _0x186ec0[_0x3e36('0x22')]===_0x3e36('0x21');var _0xb58af1=_0x3993bf[_0x3e36('0x23')];var _0x230648=_0x654fb1?0x0:_0x186ec0[_0x3e36('0x20')];var _0x4a7e60=_0x654fb1?_0x3993bf['count']:_0x186ec0['offset']+_0x186ec0['limit'];var _0x1a7f7c;if(_0x4a7e60>=_0xb58af1){_0x4a7e60=_0xb58af1;_0x1a7f7c=0xc8;}else{_0x1a7f7c=0xce;}_0x1f4be9['status'](_0x1a7f7c);return _0x1f4be9[_0x3e36('0x24')]('Content-Range',_0x230648+'-'+_0x4a7e60+'/'+_0xb58af1)[_0x3e36('0x1f')](_0x3993bf);}return null;};}function patchUpdates(_0x461b04){return function(_0x2fa5b1){try{jsonpatch['apply'](_0x2fa5b1,_0x461b04,!![]);}catch(_0x5cda8e){return BPromise['reject'](_0x5cda8e);}return _0x2fa5b1[_0x3e36('0x25')]();};}function saveUpdates(_0x330085,_0x34f35c){return function(_0x523368){if(_0x523368){return _0x523368[_0x3e36('0x26')](_0x330085)[_0x3e36('0x27')](function(_0x138d97){return _0x138d97;});}return null;};}function removeEntity(_0x4b5037,_0x98a3fe){return function(_0xd8a17d){if(_0xd8a17d){return _0xd8a17d[_0x3e36('0x28')]()[_0x3e36('0x27')](function(){var _0x4ee6ef=_0xd8a17d[_0x3e36('0x29')]({'plain':!![]});var _0x18e5b1=_0x3e36('0x2a');return db[_0x3e36('0x2b')][_0x3e36('0x28')]({'where':{'type':_0x18e5b1,'resourceId':_0x4ee6ef['id']}})['then'](function(){return _0xd8a17d;});})[_0x3e36('0x27')](function(){_0x4b5037[_0x3e36('0x1d')](0xcc)[_0x3e36('0x1e')]();});}};}function handleEntityNotFound(_0x5456bd,_0x2dbe31){return function(_0x5b21dd){if(!_0x5b21dd){_0x5456bd[_0x3e36('0x1c')](0x194);}return _0x5b21dd;};}function handleError(_0x229c89,_0x293dd0){_0x293dd0=_0x293dd0||0x1f4;return function(_0x39eb51){logger['error'](_0x39eb51['stack']);if(_0x39eb51['name']){delete _0x39eb51[_0x3e36('0x2c')];}_0x229c89['status'](_0x293dd0)[_0x3e36('0x2d')](_0x39eb51);};}exports[_0x3e36('0x2e')]=function(_0x11d737,_0x31ad73){var _0x1aa372={},_0x3fd85f={},_0x323a08={'count':0x0,'rows':[]};var _0x203ed4=_[_0x3e36('0x2f')](db[_0x3e36('0x30')][_0x3e36('0x31')],function(_0x209b0f){return{'name':_0x209b0f[_0x3e36('0x32')],'type':_0x209b0f[_0x3e36('0x33')][_0x3e36('0x34')]};});_0x3fd85f[_0x3e36('0x35')]=_[_0x3e36('0x2f')](_0x203ed4,_0x3e36('0x2c'));_0x3fd85f[_0x3e36('0x36')]=_[_0x3e36('0x37')](_0x11d737[_0x3e36('0x36')]);_0x3fd85f['filters']=_[_0x3e36('0x38')](_0x3fd85f[_0x3e36('0x35')],_0x3fd85f[_0x3e36('0x36')]);_0x1aa372[_0x3e36('0x39')]=_['intersection'](_0x3fd85f[_0x3e36('0x35')],qs[_0x3e36('0x3a')](_0x11d737[_0x3e36('0x36')][_0x3e36('0x3a')]));_0x1aa372[_0x3e36('0x39')]=_0x1aa372[_0x3e36('0x39')][_0x3e36('0x3b')]?_0x1aa372[_0x3e36('0x39')]:_0x3fd85f['model'];if(!_0x11d737['query'][_0x3e36('0x3c')]('nolimit')){_0x1aa372['limit']=qs[_0x3e36('0x22')](_0x11d737['query']['limit']);_0x1aa372[_0x3e36('0x20')]=qs[_0x3e36('0x20')](_0x11d737[_0x3e36('0x36')][_0x3e36('0x20')]);}_0x1aa372[_0x3e36('0x3d')]=qs['sort'](_0x11d737[_0x3e36('0x36')][_0x3e36('0x3e')]);_0x1aa372[_0x3e36('0x3f')]=qs[_0x3e36('0x40')](_[_0x3e36('0x41')](_0x11d737[_0x3e36('0x36')],_0x3fd85f[_0x3e36('0x40')]),_0x203ed4);if(_0x11d737['query'][_0x3e36('0x42')]){_0x1aa372[_0x3e36('0x3f')]=_[_0x3e36('0x43')](_0x1aa372[_0x3e36('0x3f')],{'$or':_['map'](_0x203ed4,function(_0x50d248){if(_0x50d248[_0x3e36('0x33')]!==_0x3e36('0x44')){var _0x45c475={};_0x45c475[_0x50d248['name']]={'$like':'%'+_0x11d737['query'][_0x3e36('0x42')]+'%'};return _0x45c475;}})});}_0x1aa372=_[_0x3e36('0x43')]({},_0x1aa372,_0x11d737[_0x3e36('0x45')]);var _0x2416dc={'where':_0x1aa372[_0x3e36('0x3f')]};return db[_0x3e36('0x30')]['count'](_0x2416dc)[_0x3e36('0x27')](function(_0x1d77c0){_0x323a08[_0x3e36('0x23')]=_0x1d77c0;if(_0x11d737[_0x3e36('0x36')][_0x3e36('0x46')]){_0x1aa372[_0x3e36('0x47')]=[{'all':!![]}];}return db['Trigger'][_0x3e36('0x48')](_0x1aa372);})[_0x3e36('0x27')](function(_0x25a6f2){_0x323a08[_0x3e36('0x49')]=_0x25a6f2;return _0x323a08;})[_0x3e36('0x27')](respondWithFilteredResult(_0x31ad73,_0x1aa372))[_0x3e36('0x4a')](handleError(_0x31ad73,null));};exports[_0x3e36('0x4b')]=function(_0x221a5b,_0x22d422){var _0x33acc2={'raw':![],'where':{'id':_0x221a5b['params']['id']}},_0x38bf3f={};_0x38bf3f['model']=_[_0x3e36('0x37')](db['Trigger']['rawAttributes']);_0x38bf3f[_0x3e36('0x36')]=_[_0x3e36('0x37')](_0x221a5b['query']);_0x38bf3f['filters']=_[_0x3e36('0x38')](_0x38bf3f['model'],_0x38bf3f[_0x3e36('0x36')]);_0x33acc2[_0x3e36('0x39')]=_[_0x3e36('0x38')](_0x38bf3f[_0x3e36('0x35')],qs[_0x3e36('0x3a')](_0x221a5b['query'][_0x3e36('0x3a')]));_0x33acc2['attributes']=_0x33acc2[_0x3e36('0x39')][_0x3e36('0x3b')]?_0x33acc2[_0x3e36('0x39')]:_0x38bf3f[_0x3e36('0x35')];if(_0x221a5b[_0x3e36('0x36')]['includeAll']){_0x33acc2['include']=[{'all':!![]}];}_0x33acc2=_[_0x3e36('0x43')]({},_0x33acc2,_0x221a5b[_0x3e36('0x45')]);return db[_0x3e36('0x30')][_0x3e36('0x4c')](_0x33acc2)['then'](handleEntityNotFound(_0x22d422,null))[_0x3e36('0x27')](respondWithResult(_0x22d422,null))['catch'](handleError(_0x22d422,null));};exports['create']=function(_0x12dd0f,_0x25dfad){return db[_0x3e36('0x30')]['create'](_0x12dd0f[_0x3e36('0x4d')],{})[_0x3e36('0x27')](function(_0x57122d){var _0x1a6cce=_0x12dd0f['user'][_0x3e36('0x29')]({'plain':!![]});if(!_0x1a6cce)throw new Error(_0x3e36('0x4e'));if(_0x1a6cce[_0x3e36('0x4f')]===_0x3e36('0x50')){var _0x5b81ec=_0x57122d[_0x3e36('0x29')]({'plain':!![]});var _0x34d87b=_0x3e36('0x2a');return db[_0x3e36('0x51')]['find']({'where':{'name':_0x34d87b,'userProfileId':_0x1a6cce[_0x3e36('0x52')]},'raw':!![]})['then'](function(_0x1f905e){if(_0x1f905e&&_0x1f905e[_0x3e36('0x53')]===0x0){return db[_0x3e36('0x2b')]['create']({'name':_0x5b81ec['name'],'resourceId':_0x5b81ec['id'],'type':_0x1f905e['name'],'sectionId':_0x1f905e['id']},{})['then'](function(){return _0x57122d;});}else{return _0x57122d;}})[_0x3e36('0x4a')](function(_0x36509e){logger[_0x3e36('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36509e);throw _0x36509e;});}return _0x57122d;})[_0x3e36('0x27')](respondWithResult(_0x25dfad,0xc9))[_0x3e36('0x4a')](handleError(_0x25dfad,null));};exports['update']=function(_0x3f28b0,_0x6a6bb4){if(_0x3f28b0[_0x3e36('0x4d')]['id']){delete _0x3f28b0[_0x3e36('0x4d')]['id'];}return db[_0x3e36('0x30')][_0x3e36('0x4c')]({'where':{'id':_0x3f28b0[_0x3e36('0x55')]['id']}})['then'](handleEntityNotFound(_0x6a6bb4,null))[_0x3e36('0x27')](saveUpdates(_0x3f28b0[_0x3e36('0x4d')],null))['then'](respondWithResult(_0x6a6bb4,null))[_0x3e36('0x4a')](handleError(_0x6a6bb4,null));};exports['destroy']=function(_0x58ab78,_0x39c84e){return db['Trigger']['find']({'where':{'id':_0x58ab78['params']['id']}})[_0x3e36('0x27')](handleEntityNotFound(_0x39c84e,null))[_0x3e36('0x27')](removeEntity(_0x39c84e,null))[_0x3e36('0x4a')](handleError(_0x39c84e,null));};exports[_0x3e36('0x56')]=function(_0x2a5584,_0x3007ab,_0x2fc00b){if(_0x2a5584[_0x3e36('0x4d')]['id']){delete _0x2a5584[_0x3e36('0x4d')]['id'];}return db['Trigger'][_0x3e36('0x4c')]({'where':{'id':_0x2a5584['params']['id']}})[_0x3e36('0x27')](handleEntityNotFound(_0x3007ab,null))['then'](function(_0x485c56){if(_0x485c56){_0x2a5584[_0x3e36('0x4d')][_0x3e36('0x57')]=_0x485c56['id'];return db['Condition'][_0x3e36('0x58')](_0x2a5584[_0x3e36('0x4d')]);}})['then'](respondWithResult(_0x3007ab,null))[_0x3e36('0x4a')](handleError(_0x3007ab,null));};exports[_0x3e36('0x59')]=function(_0x388adc,_0x395308,_0x5d65a9){if(_0x388adc[_0x3e36('0x4d')]['id']){delete _0x388adc[_0x3e36('0x4d')]['id'];}return db['Trigger'][_0x3e36('0x4c')]({'where':{'id':_0x388adc[_0x3e36('0x55')]['id']}})[_0x3e36('0x27')](handleEntityNotFound(_0x395308,null))['then'](function(_0x294de3){if(_0x294de3){_0x388adc[_0x3e36('0x4d')][_0x3e36('0x5a')]=_0x294de3['id'];return db[_0x3e36('0x5b')][_0x3e36('0x58')](_0x388adc[_0x3e36('0x4d')]);}})[_0x3e36('0x27')](respondWithResult(_0x395308,null))[_0x3e36('0x4a')](handleError(_0x395308,null));};exports[_0x3e36('0x5c')]=function(_0x498e06,_0x12bff3,_0x368c76){var _0x3af37e={};var _0x3c41e7={};var _0x1828a4;var _0xb189ed;return db[_0x3e36('0x30')][_0x3e36('0x5d')]({'where':{'id':_0x498e06[_0x3e36('0x55')]['id']}})[_0x3e36('0x27')](handleEntityNotFound(_0x12bff3,null))[_0x3e36('0x27')](function(_0x899e88){if(_0x899e88){_0x1828a4=_0x899e88;_0x3c41e7['model']=_[_0x3e36('0x37')](db[_0x3e36('0x5b')][_0x3e36('0x31')]);_0x3c41e7[_0x3e36('0x36')]=_[_0x3e36('0x37')](_0x498e06[_0x3e36('0x36')]);_0x3c41e7[_0x3e36('0x40')]=_[_0x3e36('0x38')](_0x3c41e7[_0x3e36('0x35')],_0x3c41e7[_0x3e36('0x36')]);_0x3af37e[_0x3e36('0x39')]=_['intersection'](_0x3c41e7[_0x3e36('0x35')],qs[_0x3e36('0x3a')](_0x498e06['query']['fields']));_0x3af37e[_0x3e36('0x39')]=_0x3af37e[_0x3e36('0x39')]['length']?_0x3af37e[_0x3e36('0x39')]:_0x3c41e7[_0x3e36('0x35')];_0x3af37e[_0x3e36('0x3d')]=qs['sort'](_0x498e06[_0x3e36('0x36')]['sort']);_0x3af37e['where']=qs[_0x3e36('0x40')](_['pick'](_0x498e06[_0x3e36('0x36')],_0x3c41e7[_0x3e36('0x40')]));if(_0x498e06[_0x3e36('0x36')][_0x3e36('0x42')]){_0x3af37e[_0x3e36('0x3f')]=_[_0x3e36('0x43')](_0x3af37e[_0x3e36('0x3f')],{'$or':_[_0x3e36('0x2f')](_0x3af37e['attributes'],function(_0x5a184f){var _0x4b6483={};_0x4b6483[_0x5a184f]={'$like':'%'+_0x498e06['query']['filter']+'%'};return _0x4b6483;})});}_0x3af37e=_[_0x3e36('0x43')]({},_0x3af37e,_0x498e06[_0x3e36('0x45')]);return _0x1828a4['getAllConditions'](_0x3af37e);}})[_0x3e36('0x27')](function(_0x10568c){if(_0x10568c){_0xb189ed=_0x10568c[_0x3e36('0x3b')];if(!_0x498e06['query'][_0x3e36('0x3c')](_0x3e36('0x5e'))){_0x3af37e['limit']=qs[_0x3e36('0x22')](_0x498e06[_0x3e36('0x36')][_0x3e36('0x22')]);_0x3af37e['offset']=qs[_0x3e36('0x20')](_0x498e06[_0x3e36('0x36')]['offset']);}return _0x1828a4[_0x3e36('0x5c')](_0x3af37e);}})[_0x3e36('0x27')](function(_0x4e8548){if(_0x4e8548){return _0x4e8548?{'count':_0xb189ed,'rows':_0x4e8548}:null;}})[_0x3e36('0x27')](respondWithResult(_0x12bff3,null))['catch'](handleError(_0x12bff3,null));};exports['getAnyConditions']=function(_0x41ffda,_0xe30bb0,_0x2a3863){var _0x457824={};var _0x2696df={};var _0x46d304;var _0x45615a;return db[_0x3e36('0x30')][_0x3e36('0x5d')]({'where':{'id':_0x41ffda[_0x3e36('0x55')]['id']}})[_0x3e36('0x27')](handleEntityNotFound(_0xe30bb0,null))[_0x3e36('0x27')](function(_0x5dcac4){if(_0x5dcac4){_0x46d304=_0x5dcac4;_0x2696df[_0x3e36('0x35')]=_[_0x3e36('0x37')](db[_0x3e36('0x5b')]['rawAttributes']);_0x2696df[_0x3e36('0x36')]=_[_0x3e36('0x37')](_0x41ffda['query']);_0x2696df[_0x3e36('0x40')]=_[_0x3e36('0x38')](_0x2696df[_0x3e36('0x35')],_0x2696df[_0x3e36('0x36')]);_0x457824[_0x3e36('0x39')]=_[_0x3e36('0x38')](_0x2696df['model'],qs['fields'](_0x41ffda[_0x3e36('0x36')]['fields']));_0x457824[_0x3e36('0x39')]=_0x457824[_0x3e36('0x39')]['length']?_0x457824[_0x3e36('0x39')]:_0x2696df[_0x3e36('0x35')];_0x457824['order']=qs[_0x3e36('0x3e')](_0x41ffda[_0x3e36('0x36')][_0x3e36('0x3e')]);_0x457824['where']=qs[_0x3e36('0x40')](_[_0x3e36('0x41')](_0x41ffda[_0x3e36('0x36')],_0x2696df['filters']));if(_0x41ffda['query'][_0x3e36('0x42')]){_0x457824[_0x3e36('0x3f')]=_[_0x3e36('0x43')](_0x457824[_0x3e36('0x3f')],{'$or':_['map'](_0x457824[_0x3e36('0x39')],function(_0x290192){var _0x2db027={};_0x2db027[_0x290192]={'$like':'%'+_0x41ffda[_0x3e36('0x36')][_0x3e36('0x42')]+'%'};return _0x2db027;})});}_0x457824=_[_0x3e36('0x43')]({},_0x457824,_0x41ffda[_0x3e36('0x45')]);return _0x46d304[_0x3e36('0x5f')](_0x457824);}})[_0x3e36('0x27')](function(_0xd6d6d9){if(_0xd6d6d9){_0x45615a=_0xd6d6d9[_0x3e36('0x3b')];if(!_0x41ffda[_0x3e36('0x36')][_0x3e36('0x3c')]('nolimit')){_0x457824['limit']=qs[_0x3e36('0x22')](_0x41ffda[_0x3e36('0x36')][_0x3e36('0x22')]);_0x457824[_0x3e36('0x20')]=qs[_0x3e36('0x20')](_0x41ffda[_0x3e36('0x36')][_0x3e36('0x20')]);}return _0x46d304[_0x3e36('0x5f')](_0x457824);}})['then'](function(_0xf60326){if(_0xf60326){return _0xf60326?{'count':_0x45615a,'rows':_0xf60326}:null;}})[_0x3e36('0x27')](respondWithResult(_0xe30bb0,null))[_0x3e36('0x4a')](handleError(_0xe30bb0,null));};exports[_0x3e36('0x60')]=function(_0x40ee33,_0x4003e2,_0x4894ea){if(_0x40ee33[_0x3e36('0x4d')]['id']){delete _0x40ee33[_0x3e36('0x4d')]['id'];}return db[_0x3e36('0x30')][_0x3e36('0x4c')]({'where':{'id':_0x40ee33[_0x3e36('0x55')]['id']}})['then'](handleEntityNotFound(_0x4003e2,null))[_0x3e36('0x27')](function(_0x5e2c1b){if(_0x5e2c1b){_0x40ee33[_0x3e36('0x4d')][_0x3e36('0x61')]=_0x5e2c1b['id'];return db[_0x3e36('0x62')][_0x3e36('0x58')](_0x40ee33[_0x3e36('0x4d')]);}})[_0x3e36('0x27')](respondWithResult(_0x4003e2,null))[_0x3e36('0x4a')](handleError(_0x4003e2,null));};exports[_0x3e36('0x63')]=function(_0x2f11f7,_0xdf81aa,_0x359739){var _0x4f374f={};var _0x47c3d2={};var _0x5b5332;var _0x5c438a;return db[_0x3e36('0x30')]['findOne']({'where':{'id':_0x2f11f7['params']['id']}})[_0x3e36('0x27')](handleEntityNotFound(_0xdf81aa,null))[_0x3e36('0x27')](function(_0x755710){if(_0x755710){_0x5b5332=_0x755710;_0x47c3d2['model']=_['keys'](db['Action']['rawAttributes']);_0x47c3d2[_0x3e36('0x36')]=_[_0x3e36('0x37')](_0x2f11f7[_0x3e36('0x36')]);_0x47c3d2[_0x3e36('0x40')]=_[_0x3e36('0x38')](_0x47c3d2['model'],_0x47c3d2['query']);_0x4f374f[_0x3e36('0x39')]=_[_0x3e36('0x38')](_0x47c3d2[_0x3e36('0x35')],qs[_0x3e36('0x3a')](_0x2f11f7['query']['fields']));_0x4f374f[_0x3e36('0x39')]=_0x4f374f[_0x3e36('0x39')][_0x3e36('0x3b')]?_0x4f374f['attributes']:_0x47c3d2[_0x3e36('0x35')];_0x4f374f[_0x3e36('0x3d')]=qs[_0x3e36('0x3e')](_0x2f11f7[_0x3e36('0x36')]['sort']);_0x4f374f[_0x3e36('0x3f')]=qs[_0x3e36('0x40')](_['pick'](_0x2f11f7['query'],_0x47c3d2[_0x3e36('0x40')]));if(_0x2f11f7[_0x3e36('0x36')][_0x3e36('0x42')]){_0x4f374f[_0x3e36('0x3f')]=_[_0x3e36('0x43')](_0x4f374f[_0x3e36('0x3f')],{'$or':_[_0x3e36('0x2f')](_0x4f374f[_0x3e36('0x39')],function(_0x301418){var _0x3c4a3b={};_0x3c4a3b[_0x301418]={'$like':'%'+_0x2f11f7[_0x3e36('0x36')]['filter']+'%'};return _0x3c4a3b;})});}_0x4f374f=_[_0x3e36('0x43')]({},_0x4f374f,_0x2f11f7['options']);return _0x5b5332['getActions'](_0x4f374f);}})[_0x3e36('0x27')](function(_0x198849){if(_0x198849){_0x5c438a=_0x198849[_0x3e36('0x3b')];if(!_0x2f11f7[_0x3e36('0x36')][_0x3e36('0x3c')](_0x3e36('0x5e'))){_0x4f374f[_0x3e36('0x22')]=qs[_0x3e36('0x22')](_0x2f11f7[_0x3e36('0x36')]['limit']);_0x4f374f[_0x3e36('0x20')]=qs['offset'](_0x2f11f7[_0x3e36('0x36')][_0x3e36('0x20')]);}return _0x5b5332['getActions'](_0x4f374f);}})[_0x3e36('0x27')](function(_0x55e43b){if(_0x55e43b){return _0x55e43b?{'count':_0x5c438a,'rows':_0x55e43b}:null;}})[_0x3e36('0x27')](respondWithResult(_0xdf81aa,null))['catch'](handleError(_0xdf81aa,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d1f5eab..a2db415 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 _0x9585=['Trigger','tools_triggers','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define'];(function(_0x23da78,_0x2d5bdb){var _0x136ba9=function(_0x8461bc){while(--_0x8461bc){_0x23da78['push'](_0x23da78['shift']());}};_0x136ba9(++_0x2d5bdb);}(_0x9585,0x15e));var _0x5958=function(_0x1e284d,_0x3e1bd4){_0x1e284d=_0x1e284d-0x0;var _0x513ff7=_0x9585[_0x1e284d];return _0x513ff7;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var logger=require('../../config/logger')(_0x5958('0x1'));var moment=require(_0x5958('0x2'));var BPromise=require(_0x5958('0x3'));var rp=require(_0x5958('0x4'));var fs=require('fs');var path=require(_0x5958('0x5'));var rimraf=require(_0x5958('0x6'));var config=require(_0x5958('0x7'));var attributes=require(_0x5958('0x8'));module['exports']=function(_0x202d6f,_0x48ddaf){return _0x202d6f[_0x5958('0x9')](_0x5958('0xa'),attributes,{'tableName':_0x5958('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1f=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x2a8bbd,_0x2d998b){var _0x276e9c=function(_0x5ef6db){while(--_0x5ef6db){_0x2a8bbd['push'](_0x2a8bbd['shift']());}};_0x276e9c(++_0x2d998b);}(_0xed1f,0x6a));var _0xfed1=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xed1f[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 381bdd6..a64373c 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 _0x5bdd=['ShowTrigger','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','Trigger','findAll','options','raw','attributes','limit','include','map','model','then','GetTrigger'];(function(_0x414af5,_0x1c5e8c){var _0x30ebf3=function(_0x18c7ef){while(--_0x18c7ef){_0x414af5['push'](_0x414af5['shift']());}};_0x30ebf3(++_0x1c5e8c);}(_0x5bdd,0x155));var _0xd5bd=function(_0x1e83fb,_0x3cbe21){_0x1e83fb=_0x1e83fb-0x0;var _0x1107aa=_0x5bdd[_0x1e83fb];return _0x1107aa;};'use strict';var _=require(_0xd5bd('0x0'));var util=require('util');var moment=require(_0xd5bd('0x1'));var BPromise=require(_0xd5bd('0x2'));var rs=require(_0xd5bd('0x3'));var fs=require('fs');var Redis=require(_0xd5bd('0x4'));var db=require(_0xd5bd('0x5'))['db'];var utils=require(_0xd5bd('0x6'));var logger=require(_0xd5bd('0x7'))(_0xd5bd('0x8'));var config=require(_0xd5bd('0x9'));var jayson=require(_0xd5bd('0xa'));var client=jayson[_0xd5bd('0xb')][_0xd5bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a061d,_0x307ee5,_0x47560d){return new BPromise(function(_0x11ab87,_0x111610){return client['request'](_0x7a061d,_0x47560d)['then'](function(_0x3ad76b){logger[_0xd5bd('0xd')](_0xd5bd('0xe'),_0x307ee5,_0xd5bd('0xf'));logger[_0xd5bd('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x307ee5,_0xd5bd('0xf'),JSON[_0xd5bd('0x11')](_0x3ad76b));if(_0x3ad76b[_0xd5bd('0x12')]){if(_0x3ad76b[_0xd5bd('0x12')][_0xd5bd('0x13')]===0x1f4){logger['error'](_0xd5bd('0xe'),_0x307ee5,_0x3ad76b[_0xd5bd('0x12')][_0xd5bd('0x14')]);return _0x111610(_0x3ad76b['error']['message']);}logger['error'](_0xd5bd('0xe'),_0x307ee5,_0x3ad76b[_0xd5bd('0x12')]['message']);return _0x11ab87(_0x3ad76b[_0xd5bd('0x12')][_0xd5bd('0x14')]);}else{logger[_0xd5bd('0xd')](_0xd5bd('0xe'),_0x307ee5,_0xd5bd('0xf'));_0x11ab87(_0x3ad76b['result']['message']);}})[_0xd5bd('0x15')](function(_0x49327f){logger[_0xd5bd('0x12')]('Trigger,\x20%s,\x20%s',_0x307ee5,_0x49327f);_0x111610(_0x49327f);});});}exports['GetTrigger']=function(_0x549d5e){var _0x519ec1=this;return new Promise(function(_0x2d2919,_0x15dc2a){return db[_0xd5bd('0x16')][_0xd5bd('0x17')]({'raw':_0x549d5e[_0xd5bd('0x18')]?_0x549d5e[_0xd5bd('0x18')][_0xd5bd('0x19')]===undefined?!![]:![]:!![],'where':_0x549d5e[_0xd5bd('0x18')]?_0x549d5e[_0xd5bd('0x18')]['where']||null:null,'attributes':_0x549d5e[_0xd5bd('0x18')]?_0x549d5e[_0xd5bd('0x18')][_0xd5bd('0x1a')]||null:null,'limit':_0x549d5e[_0xd5bd('0x18')]?_0x549d5e[_0xd5bd('0x18')][_0xd5bd('0x1b')]||null:null,'include':_0x549d5e['options']?_0x549d5e[_0xd5bd('0x18')][_0xd5bd('0x1c')]?_[_0xd5bd('0x1d')](_0x549d5e[_0xd5bd('0x18')][_0xd5bd('0x1c')],function(_0x52d49b){return{'model':db[_0x52d49b[_0xd5bd('0x1e')]],'as':_0x52d49b['as'],'attributes':_0x52d49b['attributes'],'include':_0x52d49b['include']?_[_0xd5bd('0x1d')](_0x52d49b['include'],function(_0xab7317){return{'model':db[_0xab7317[_0xd5bd('0x1e')]],'as':_0xab7317['as'],'attributes':_0xab7317[_0xd5bd('0x1a')],'include':_0xab7317[_0xd5bd('0x1c')]?_[_0xd5bd('0x1d')](_0xab7317[_0xd5bd('0x1c')],function(_0x898fcf){return{'model':db[_0x898fcf[_0xd5bd('0x1e')]],'as':_0x898fcf['as'],'attributes':_0x898fcf['attributes']};}):[]};}):[]};}):[]:[]})[_0xd5bd('0x1f')](function(_0x33048a){logger[_0xd5bd('0xd')](_0xd5bd('0x20'),_0x549d5e);logger['debug'](_0xd5bd('0x20'),_0x549d5e,JSON[_0xd5bd('0x11')](_0x33048a));_0x2d2919(_0x33048a);})[_0xd5bd('0x15')](function(_0xb50726){logger[_0xd5bd('0x12')]('GetTrigger',_0xb50726[_0xd5bd('0x14')],_0x549d5e);_0x15dc2a(_0x519ec1[_0xd5bd('0x12')](0x1f4,_0xb50726['message']));});});};exports[_0xd5bd('0x21')]=function(_0x6a4947){var _0x4c9b48=this;return new Promise(function(_0x3cd40d,_0x3a63a5){return db[_0xd5bd('0x16')]['find']({'raw':_0x6a4947[_0xd5bd('0x18')]?_0x6a4947[_0xd5bd('0x18')][_0xd5bd('0x19')]===undefined?!![]:![]:!![],'where':_0x6a4947[_0xd5bd('0x18')]?_0x6a4947[_0xd5bd('0x18')]['where']||null:null,'attributes':_0x6a4947['options']?_0x6a4947[_0xd5bd('0x18')][_0xd5bd('0x1a')]||null:null,'include':_0x6a4947[_0xd5bd('0x18')]?_0x6a4947[_0xd5bd('0x18')]['include']?_[_0xd5bd('0x1d')](_0x6a4947[_0xd5bd('0x18')][_0xd5bd('0x1c')],function(_0x1e4291){return{'model':db[_0x1e4291['model']],'as':_0x1e4291['as'],'attributes':_0x1e4291[_0xd5bd('0x1a')],'include':_0x1e4291[_0xd5bd('0x1c')]?_[_0xd5bd('0x1d')](_0x1e4291[_0xd5bd('0x1c')],function(_0x49ee2c){return{'model':db[_0x49ee2c[_0xd5bd('0x1e')]],'as':_0x49ee2c['as'],'attributes':_0x49ee2c['attributes'],'include':_0x49ee2c[_0xd5bd('0x1c')]?_[_0xd5bd('0x1d')](_0x49ee2c['include'],function(_0x5d6940){return{'model':db[_0x5d6940[_0xd5bd('0x1e')]],'as':_0x5d6940['as'],'attributes':_0x5d6940[_0xd5bd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd5bd('0x1f')](function(_0x1fe926){logger[_0xd5bd('0xd')]('ShowTrigger',_0x6a4947);logger['debug'](_0xd5bd('0x21'),_0x6a4947,JSON['stringify'](_0x1fe926));_0x3cd40d(_0x1fe926);})[_0xd5bd('0x15')](function(_0x221356){logger[_0xd5bd('0x12')]('ShowTrigger',_0x221356[_0xd5bd('0x14')],_0x6a4947);_0x3a63a5(_0x4c9b48[_0xd5bd('0x12')](0x1f4,_0x221356[_0xd5bd('0x14')]));});});}; \ No newline at end of file +var _0x5085=['GetTrigger','options','raw','where','attributes','limit','map','include','model','ShowTrigger','Trigger','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x55d850,_0x3f896f){var _0x3ed61b=function(_0x45d366){while(--_0x45d366){_0x55d850['push'](_0x55d850['shift']());}};_0x3ed61b(++_0x3f896f);}(_0x5085,0x114));var _0x5508=function(_0x57b2b8,_0x5adf41){_0x57b2b8=_0x57b2b8-0x0;var _0x26b8e9=_0x5085[_0x57b2b8];return _0x26b8e9;};'use strict';var _=require(_0x5508('0x0'));var util=require(_0x5508('0x1'));var moment=require(_0x5508('0x2'));var BPromise=require('bluebird');var rs=require(_0x5508('0x3'));var fs=require('fs');var Redis=require(_0x5508('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5508('0x5'));var logger=require(_0x5508('0x6'))('rpc');var config=require(_0x5508('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5508('0x8')][_0x5508('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52efe5,_0x20fe4c,_0x155d41){return new BPromise(function(_0x2b18d5,_0x321155){return client['request'](_0x52efe5,_0x155d41)[_0x5508('0xa')](function(_0x1dbb3c){logger[_0x5508('0xb')](_0x5508('0xc'),_0x20fe4c,_0x5508('0xd'));logger[_0x5508('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x20fe4c,_0x5508('0xd'),JSON[_0x5508('0xf')](_0x1dbb3c));if(_0x1dbb3c['error']){if(_0x1dbb3c[_0x5508('0x10')][_0x5508('0x11')]===0x1f4){logger[_0x5508('0x10')]('Trigger,\x20%s,\x20%s',_0x20fe4c,_0x1dbb3c[_0x5508('0x10')]['message']);return _0x321155(_0x1dbb3c['error'][_0x5508('0x12')]);}logger[_0x5508('0x10')]('Trigger,\x20%s,\x20%s',_0x20fe4c,_0x1dbb3c[_0x5508('0x10')]['message']);return _0x2b18d5(_0x1dbb3c[_0x5508('0x10')][_0x5508('0x12')]);}else{logger['info'](_0x5508('0xc'),_0x20fe4c,_0x5508('0xd'));_0x2b18d5(_0x1dbb3c[_0x5508('0x13')][_0x5508('0x12')]);}})[_0x5508('0x14')](function(_0x5dedf4){logger[_0x5508('0x10')](_0x5508('0xc'),_0x20fe4c,_0x5dedf4);_0x321155(_0x5dedf4);});});}exports[_0x5508('0x15')]=function(_0x1fb2ae){var _0x5b7283=this;return new Promise(function(_0x1c129a,_0x1275f5){return db['Trigger']['findAll']({'raw':_0x1fb2ae[_0x5508('0x16')]?_0x1fb2ae[_0x5508('0x16')][_0x5508('0x17')]===undefined?!![]:![]:!![],'where':_0x1fb2ae[_0x5508('0x16')]?_0x1fb2ae['options'][_0x5508('0x18')]||null:null,'attributes':_0x1fb2ae[_0x5508('0x16')]?_0x1fb2ae[_0x5508('0x16')][_0x5508('0x19')]||null:null,'limit':_0x1fb2ae[_0x5508('0x16')]?_0x1fb2ae[_0x5508('0x16')][_0x5508('0x1a')]||null:null,'include':_0x1fb2ae[_0x5508('0x16')]?_0x1fb2ae[_0x5508('0x16')]['include']?_[_0x5508('0x1b')](_0x1fb2ae['options'][_0x5508('0x1c')],function(_0x66e18a){return{'model':db[_0x66e18a['model']],'as':_0x66e18a['as'],'attributes':_0x66e18a['attributes'],'include':_0x66e18a[_0x5508('0x1c')]?_[_0x5508('0x1b')](_0x66e18a[_0x5508('0x1c')],function(_0x211b14){return{'model':db[_0x211b14['model']],'as':_0x211b14['as'],'attributes':_0x211b14[_0x5508('0x19')],'include':_0x211b14[_0x5508('0x1c')]?_[_0x5508('0x1b')](_0x211b14['include'],function(_0x39ce09){return{'model':db[_0x39ce09[_0x5508('0x1d')]],'as':_0x39ce09['as'],'attributes':_0x39ce09[_0x5508('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5508('0xa')](function(_0x3d6297){logger[_0x5508('0xb')](_0x5508('0x15'),_0x1fb2ae);logger[_0x5508('0xe')]('GetTrigger',_0x1fb2ae,JSON[_0x5508('0xf')](_0x3d6297));_0x1c129a(_0x3d6297);})[_0x5508('0x14')](function(_0x5ab4f3){logger['error'](_0x5508('0x15'),_0x5ab4f3[_0x5508('0x12')],_0x1fb2ae);_0x1275f5(_0x5b7283[_0x5508('0x10')](0x1f4,_0x5ab4f3['message']));});});};exports[_0x5508('0x1e')]=function(_0x5c74aa){var _0x1ea296=this;return new Promise(function(_0x59de50,_0xa52ea7){return db[_0x5508('0x1f')][_0x5508('0x20')]({'raw':_0x5c74aa['options']?_0x5c74aa[_0x5508('0x16')][_0x5508('0x17')]===undefined?!![]:![]:!![],'where':_0x5c74aa[_0x5508('0x16')]?_0x5c74aa['options'][_0x5508('0x18')]||null:null,'attributes':_0x5c74aa[_0x5508('0x16')]?_0x5c74aa[_0x5508('0x16')][_0x5508('0x19')]||null:null,'include':_0x5c74aa[_0x5508('0x16')]?_0x5c74aa[_0x5508('0x16')][_0x5508('0x1c')]?_[_0x5508('0x1b')](_0x5c74aa['options'][_0x5508('0x1c')],function(_0x545fc5){return{'model':db[_0x545fc5[_0x5508('0x1d')]],'as':_0x545fc5['as'],'attributes':_0x545fc5[_0x5508('0x19')],'include':_0x545fc5[_0x5508('0x1c')]?_[_0x5508('0x1b')](_0x545fc5[_0x5508('0x1c')],function(_0x7b7b40){return{'model':db[_0x7b7b40[_0x5508('0x1d')]],'as':_0x7b7b40['as'],'attributes':_0x7b7b40[_0x5508('0x19')],'include':_0x7b7b40[_0x5508('0x1c')]?_[_0x5508('0x1b')](_0x7b7b40[_0x5508('0x1c')],function(_0x2953f0){return{'model':db[_0x2953f0[_0x5508('0x1d')]],'as':_0x2953f0['as'],'attributes':_0x2953f0[_0x5508('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5508('0xa')](function(_0x20e849){logger[_0x5508('0xb')](_0x5508('0x1e'),_0x5c74aa);logger[_0x5508('0xe')]('ShowTrigger',_0x5c74aa,JSON[_0x5508('0xf')](_0x20e849));_0x59de50(_0x20e849);})[_0x5508('0x14')](function(_0x5df8a1){logger[_0x5508('0x10')](_0x5508('0x1e'),_0x5df8a1['message'],_0x5c74aa);_0xa52ea7(_0x1ea296[_0x5508('0x10')](0x1f4,_0x5df8a1['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b8bb0f6..72d0b5d 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 _0xb34f=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','show','/:id/clone','clone','post'];(function(_0x294a33,_0x52c944){var _0x10032a=function(_0x1a6fc2){while(--_0x1a6fc2){_0x294a33['push'](_0x294a33['shift']());}};_0x10032a(++_0x52c944);}(_0xb34f,0x11b));var _0xfb34=function(_0x10c3f0,_0x6cf4cd){_0x10c3f0=_0x10c3f0-0x0;var _0x560775=_0xb34f[_0x10c3f0];return _0x560775;};'use strict';var multer=require(_0xfb34('0x0'));var util=require(_0xfb34('0x1'));var path=require(_0xfb34('0x2'));var timeout=require(_0xfb34('0x3'));var express=require(_0xfb34('0x4'));var router=express[_0xfb34('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb34('0x6'));var interaction=require(_0xfb34('0x7'));var config=require(_0xfb34('0x8'));var controller=require(_0xfb34('0x9'));router['get']('/',auth[_0xfb34('0xa')](),controller[_0xfb34('0xb')]);router['get']('/:id',auth[_0xfb34('0xa')](),controller[_0xfb34('0xc')]);router['post'](_0xfb34('0xd'),auth[_0xfb34('0xa')](),controller[_0xfb34('0xe')]);router[_0xfb34('0xf')]('/',auth[_0xfb34('0xa')](),controller[_0xfb34('0x10')]);router[_0xfb34('0x11')](_0xfb34('0x12'),auth[_0xfb34('0xa')](),controller[_0xfb34('0x13')]);router[_0xfb34('0x14')]('/:id',auth[_0xfb34('0xa')](),controller[_0xfb34('0x15')]);module[_0xfb34('0x16')]=router; \ No newline at end of file +var _0xc94b=['exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','destroy'];(function(_0x256250,_0x35b654){var _0x42b426=function(_0x4773d0){while(--_0x4773d0){_0x256250['push'](_0x256250['shift']());}};_0x42b426(++_0x35b654);}(_0xc94b,0x177));var _0xbc94=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xc94b[_0x1b6c6d];return _0x290d9d;};'use strict';var multer=require(_0xbc94('0x0'));var util=require('util');var path=require(_0xbc94('0x1'));var timeout=require(_0xbc94('0x2'));var express=require('express');var router=express[_0xbc94('0x3')]();var fs_extra=require(_0xbc94('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbc94('0x5'));var controller=require(_0xbc94('0x6'));router[_0xbc94('0x7')]('/',auth[_0xbc94('0x8')](),controller[_0xbc94('0x9')]);router[_0xbc94('0x7')](_0xbc94('0xa'),auth[_0xbc94('0x8')](),controller[_0xbc94('0xb')]);router[_0xbc94('0xc')](_0xbc94('0xd'),auth[_0xbc94('0x8')](),controller[_0xbc94('0xe')]);router[_0xbc94('0xc')]('/',auth[_0xbc94('0x8')](),controller['create']);router['put'](_0xbc94('0xa'),auth[_0xbc94('0x8')](),controller['update']);router['delete'](_0xbc94('0xa'),auth[_0xbc94('0x8')](),controller[_0xbc94('0xf')]);module[_0xbc94('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 745fe74..4790303 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 _0x1170=['name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','rfc2833','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','setDataValue','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','actpass','dynamic','update,nonat','sequelize','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1170,0x1b6));var _0x0117=function(_0x194fc5,_0xe0267){_0x194fc5=_0x194fc5-0x0;var _0x28de4a=_0x1170[_0x194fc5];return _0x28de4a;};'use strict';var Sequelize=require(_0x0117('0x0'));module['exports']={'name':{'type':Sequelize[_0x0117('0x1')],'allowNull':![],'unique':_0x0117('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x4'),'user',_0x0117('0x5')),'allowNull':![],'defaultValue':_0x0117('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0117('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x0117('0x7'),'ALLOWED_PASSED_SCREEN',_0x0117('0x8'),_0x0117('0x9'),'PROHIB_NOT_SCREENED',_0x0117('0xa'),_0x0117('0xb'),_0x0117('0xc'))},'deny':{'type':Sequelize[_0x0117('0x1')]},'permit':{'type':Sequelize[_0x0117('0x1')]},'secret':{'type':Sequelize[_0x0117('0x1')]},'md5secret':{'type':Sequelize[_0x0117('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x0117('0xd'),'set':function(_0x26e2c8){this['setDataValue'](_0x0117('0xe'),_0x26e2c8?_0x26e2c8[_0x0117('0xf')](','):null);},'get':function(){return this[_0x0117('0x10')](_0x0117('0xe'))?this[_0x0117('0x10')]('transport')[_0x0117('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x12'),'info','shortinfo','inband','auto'),'defaultValue':_0x0117('0x12')},'directmedia':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no','nonat',_0x0117('0x14'),_0x0117('0x15')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0117('0x1')]},'directmediadeny':{'type':Sequelize[_0x0117('0x1')]},'nat':{'type':Sequelize[_0x0117('0x1')],'defaultValue':_0x0117('0x16'),'set':function(_0x2d115e){this['setDataValue'](_0x0117('0x17'),_0x2d115e?_0x2d115e['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x0117('0x10')](_0x0117('0x17'))[_0x0117('0x11')](','):null;},'comment':_0x0117('0x18')},'callgroup':{'type':Sequelize[_0x0117('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0117('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x0117('0x1')]},'language':{'type':Sequelize[_0x0117('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0117('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x0117('0x1')],'allowNull':![],'defaultValue':_0x0117('0x19'),'set':function(_0x4ddf54){this['setDataValue']('allow',_0x4ddf54?_0x4ddf54['join'](';'):_0x0117('0x19'));},'get':function(){return this[_0x0117('0x10')](_0x0117('0x1a'))?this[_0x0117('0x10')](_0x0117('0x1a'))[_0x0117('0x11')](';'):null;},'comment':_0x0117('0x1b')},'autoframing':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x0117('0x1c'),'set':function(_0x2d6d95){this[_0x0117('0x1d')](_0x0117('0x1e'),_0x2d6d95?_0x2d6d95['join'](','):null);},'get':function(){return this[_0x0117('0x10')]('insecure')?this[_0x0117('0x10')]('insecure')[_0x0117('0x11')](','):null;},'comment':_0x0117('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0x0117('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no','never')},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x0117('0x13'),'no')},'accountcode':{'type':Sequelize[_0x0117('0x20')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x0117('0x21')},'amaflags':{'type':Sequelize[_0x0117('0x1')]},'callcounter':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no'),'defaultValue':_0x0117('0x13')},'busylevel':{'type':Sequelize[_0x0117('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x0117('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no')},'subscribecontext':{'type':Sequelize[_0x0117('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no',_0x0117('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0117('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no')},'mailbox':{'type':Sequelize[_0x0117('0x1')]},'session_timers':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x23'),'refuse',_0x0117('0x24'))},'session_expires':{'type':Sequelize[_0x0117('0x20')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x25'),_0x0117('0x26')),'defaultValue':_0x0117('0x26')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x0117('0x1')]},'fromuser':{'type':Sequelize[_0x0117('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no'),'defaultValue':_0x0117('0x13')},'keepalive':{'type':Sequelize[_0x0117('0x20')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x0117('0x1')]},'rtptimeout':{'type':Sequelize[_0x0117('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0117('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x0117('0x3')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0117('0x1')]},'callbackextension':{'type':Sequelize[_0x0117('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x0117('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x0117('0x20')](0xb)},'contactpermit':{'type':Sequelize[_0x0117('0x1')]},'contactdeny':{'type':Sequelize[_0x0117('0x1')]},'contactacl':{'type':Sequelize[_0x0117('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x0117('0x1')]},'use_q850_reason':{'type':Sequelize[_0x0117('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x0117('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x0117('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0x0117('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x0117('0x27'),_0x0117('0x28'))},'dtlsrekey':{'type':Sequelize[_0x0117('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0117('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x0117('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x0117('0x1')]},'dtlscapath':{'type':Sequelize[_0x0117('0x1')]},'dtlssetup':{'type':Sequelize[_0x0117('0x3')]('active','passive',_0x0117('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0117('0x1')]},'usereqphone':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0117('0x1')]},'recordofffeature':{'type':Sequelize[_0x0117('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x0117('0x13'),'no')},'subscribemwi':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x0117('0x1')]},'mohsuggest':{'type':Sequelize[_0x0117('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0117('0x1')]},'host':{'type':Sequelize[_0x0117('0x1')],'defaultValue':_0x0117('0x2a')},'canreinvite':{'type':Sequelize[_0x0117('0x3')](_0x0117('0x13'),'no','nonat',_0x0117('0x14'),_0x0117('0x2b')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0117('0x1')]},'otherFields':{'type':Sequelize[_0x0117('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0117('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3dcb=['actpass','dynamic','update,nonat','BOOLEAN','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active'];(function(_0x229532,_0x1c0e67){var _0x598c8a=function(_0x3e25ac){while(--_0x3e25ac){_0x229532['push'](_0x229532['shift']());}};_0x598c8a(++_0x1c0e67);}(_0x3dcb,0xa3));var _0xb3dc=function(_0x19aaab,_0x4539e8){_0x19aaab=_0x19aaab-0x0;var _0x29a830=_0x3dcb[_0x19aaab];return _0x29a830;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb3dc('0x0')],'allowNull':![],'unique':_0xb3dc('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x3'),_0xb3dc('0x4'),'peer'),'allowNull':![],'defaultValue':_0xb3dc('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb3dc('0x5')},'callingpres':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x6'),_0xb3dc('0x7'),_0xb3dc('0x8'),_0xb3dc('0x9'),_0xb3dc('0xa'),_0xb3dc('0xb'),_0xb3dc('0xc'),_0xb3dc('0xd'))},'deny':{'type':Sequelize[_0xb3dc('0x0')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xb3dc('0x0')]},'md5secret':{'type':Sequelize[_0xb3dc('0x0')]},'remotesecret':{'type':Sequelize[_0xb3dc('0x0')]},'transport':{'type':Sequelize[_0xb3dc('0x0')],'defaultValue':_0xb3dc('0xe'),'set':function(_0x5f095c){this['setDataValue'](_0xb3dc('0xf'),_0x5f095c?_0x5f095c[_0xb3dc('0x10')](','):null);},'get':function(){return this[_0xb3dc('0x11')]('transport')?this['getDataValue'](_0xb3dc('0xf'))['split'](','):null;},'comment':_0xb3dc('0x12')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xb3dc('0x13'),_0xb3dc('0x14'),_0xb3dc('0x15'),_0xb3dc('0x16')),'defaultValue':_0xb3dc('0x17')},'directmedia':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no',_0xb3dc('0x19'),'update',_0xb3dc('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xb3dc('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xb3dc('0x0')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xb3dc('0x1b'),'set':function(_0x1f39e0){this['setDataValue'](_0xb3dc('0x1c'),_0x1f39e0?_0x1f39e0['join'](','):null);},'get':function(){return this[_0xb3dc('0x11')]('nat')?this['getDataValue'](_0xb3dc('0x1c'))['split'](','):null;},'comment':_0xb3dc('0x1d')},'callgroup':{'type':Sequelize[_0xb3dc('0x0')]},'namedcallgroup':{'type':Sequelize[_0xb3dc('0x0')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb3dc('0x0')]},'language':{'type':Sequelize[_0xb3dc('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb3dc('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xb3dc('0x0')],'defaultValue':_0xb3dc('0x1e')},'allow':{'type':Sequelize[_0xb3dc('0x0')],'allowNull':![],'defaultValue':_0xb3dc('0x1f'),'set':function(_0xe44a2c){this[_0xb3dc('0x20')]('allow',_0xe44a2c?_0xe44a2c[_0xb3dc('0x10')](';'):_0xb3dc('0x1f'));},'get':function(){return this[_0xb3dc('0x11')]('allow')?this[_0xb3dc('0x11')](_0xb3dc('0x21'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'insecure':{'type':Sequelize[_0xb3dc('0x0')],'defaultValue':_0xb3dc('0x22'),'set':function(_0x32bc7a){this['setDataValue']('insecure',_0x32bc7a?_0x32bc7a[_0xb3dc('0x10')](','):null);},'get':function(){return this[_0xb3dc('0x11')](_0xb3dc('0x23'))?this[_0xb3dc('0x11')](_0xb3dc('0x23'))['split'](','):null;},'comment':_0xb3dc('0x24')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xb3dc('0x25'))},'promiscredir':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'accountcode':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xb3dc('0x27')},'amaflags':{'type':Sequelize[_0xb3dc('0x0')]},'callcounter':{'type':Sequelize['ENUM'](_0xb3dc('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xb3dc('0x0')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no',_0xb3dc('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'mailbox':{'type':Sequelize[_0xb3dc('0x0')]},'session_timers':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x29'),_0xb3dc('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x2b'),'uas'),'defaultValue':_0xb3dc('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xb3dc('0x0')]},'fromdomain':{'type':Sequelize[_0xb3dc('0x0')]},'fromuser':{'type':Sequelize[_0xb3dc('0x0')]},'port':{'type':Sequelize[_0xb3dc('0x26')](0x5)},'qualify':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no'),'defaultValue':_0xb3dc('0x18')},'keepalive':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'defaultip':{'type':Sequelize[_0xb3dc('0x0')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no',_0xb3dc('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb3dc('0x0')]},'callbackextension':{'type':Sequelize[_0xb3dc('0x0')]},'timert1':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'timerb':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xb3dc('0x0')]},'contactdeny':{'type':Sequelize[_0xb3dc('0x0')]},'contactacl':{'type':Sequelize[_0xb3dc('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0xb3dc('0x0')]},'use_q850_reason':{'type':Sequelize[_0xb3dc('0x0')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'force_avp':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'icesupport':{'type':Sequelize[_0xb3dc('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no',_0xb3dc('0x2e'),_0xb3dc('0x2f'))},'dtlsrekey':{'type':Sequelize[_0xb3dc('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xb3dc('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0xb3dc('0x0')]},'dtlscipher':{'type':Sequelize[_0xb3dc('0x0')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xb3dc('0x0')]},'dtlssetup':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x30'),'passive',_0xb3dc('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb3dc('0x0')]},'usereqphone':{'type':Sequelize['ENUM'](_0xb3dc('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no')},'vmexten':{'type':Sequelize[_0xb3dc('0x0')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xb3dc('0x0')]},'parkinglot':{'type':Sequelize[_0xb3dc('0x0')]},'description':{'type':Sequelize[_0xb3dc('0x0')]},'host':{'type':Sequelize[_0xb3dc('0x0')],'defaultValue':_0xb3dc('0x32')},'canreinvite':{'type':Sequelize[_0xb3dc('0x2')](_0xb3dc('0x18'),'no',_0xb3dc('0x19'),'update',_0xb3dc('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb3dc('0x0')]},'otherFields':{'type':Sequelize[_0xb3dc('0x0')]},'active':{'type':Sequelize[_0xb3dc('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5a338bb..791eec3 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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x3158d2,_0x277d23){var _0x57c15a=function(_0xcda96c){while(--_0xcda96c){_0x3158d2['push'](_0x3158d2['shift']());}};_0x57c15a(++_0x277d23);}(_0xe5b3,0x133));var _0x3e5b=function(_0x44a8a2,_0x3fe728){_0x44a8a2=_0x44a8a2-0x0;var _0x91b58f=_0xe5b3[_0x44a8a2];return _0x91b58f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file +var _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x3ae509,_0x216239){var _0x33c559=function(_0x45ba97){while(--_0x45ba97){_0x3ae509['push'](_0x3ae509['shift']());}};_0x33c559(++_0x216239);}(_0x425d,0x1e0));var _0xd425=function(_0x5b012e,_0x5cb94c){_0x5b012e=_0x5b012e-0x0;var _0xd6daf0=_0x425d[_0x5b012e];return _0xd6daf0;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index d24bb47..fdbfc20 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 _0x0a92=['Trunk','tools_trunks','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x28bd05,_0x22c789){var _0x52bacb=function(_0x56a860){while(--_0x56a860){_0x28bd05['push'](_0x28bd05['shift']());}};_0x52bacb(++_0x22c789);}(_0x0a92,0x1db));var _0x20a9=function(_0x2586ad,_0x3a2816){_0x2586ad=_0x2586ad-0x0;var _0x4128db=_0x0a92[_0x2586ad];return _0x4128db;};'use strict';var _=require('lodash');var util=require(_0x20a9('0x0'));var logger=require('../../config/logger')(_0x20a9('0x1'));var moment=require(_0x20a9('0x2'));var BPromise=require('bluebird');var rp=require(_0x20a9('0x3'));var fs=require('fs');var path=require(_0x20a9('0x4'));var rimraf=require(_0x20a9('0x5'));var config=require(_0x20a9('0x6'));var attributes=require('./trunk.attributes');module[_0x20a9('0x7')]=function(_0x42d91d,_0x23a9b7){return _0x42d91d[_0x20a9('0x8')](_0x20a9('0x9'),attributes,{'tableName':_0x20a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ba8=['../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','bluebird','request-promise','path','rimraf'];(function(_0x33e0ad,_0x4bbb98){var _0x25b272=function(_0x1711a3){while(--_0x1711a3){_0x33e0ad['push'](_0x33e0ad['shift']());}};_0x25b272(++_0x4bbb98);}(_0x7ba8,0x1ea));var _0x87ba=function(_0x2b5809,_0x5e79a5){_0x2b5809=_0x2b5809-0x0;var _0x38d74b=_0x7ba8[_0x2b5809];return _0x38d74b;};'use strict';var _=require(_0x87ba('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x87ba('0x1'));var rp=require(_0x87ba('0x2'));var fs=require('fs');var path=require(_0x87ba('0x3'));var rimraf=require(_0x87ba('0x4'));var config=require(_0x87ba('0x5'));var attributes=require(_0x87ba('0x6'));module[_0x87ba('0x7')]=function(_0x400a8b,_0x425fa2){return _0x400a8b[_0x87ba('0x8')](_0x87ba('0x9'),attributes,{'tableName':_0x87ba('0xa'),'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 cff345e..93e52bb 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 _0xd9cf=['ShowTrunk','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','findAll','options','raw','where','limit','include','map','attributes','model','then','catch','GetTrunk'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xd9cf,0x189));var _0xfd9c=function(_0x1cb5bf,_0x2e794e){_0x1cb5bf=_0x1cb5bf-0x0;var _0x56cb54=_0xd9cf[_0x1cb5bf];return _0x56cb54;};'use strict';var _=require('lodash');var util=require(_0xfd9c('0x0'));var moment=require('moment');var BPromise=require(_0xfd9c('0x1'));var rs=require(_0xfd9c('0x2'));var fs=require('fs');var Redis=require(_0xfd9c('0x3'));var db=require(_0xfd9c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfd9c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd9c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526b56,_0x1fd439,_0x3d2687){return new BPromise(function(_0x1f84f5,_0x47f1c3){return client['request'](_0x526b56,_0x3d2687)['then'](function(_0x574fa9){logger[_0xfd9c('0x7')]('Trunk,\x20%s,\x20%s',_0x1fd439,_0xfd9c('0x8'));logger[_0xfd9c('0x9')](_0xfd9c('0xa'),_0x1fd439,'request\x20sent',JSON[_0xfd9c('0xb')](_0x574fa9));if(_0x574fa9[_0xfd9c('0xc')]){if(_0x574fa9[_0xfd9c('0xc')]['code']===0x1f4){logger[_0xfd9c('0xc')](_0xfd9c('0xd'),_0x1fd439,_0x574fa9[_0xfd9c('0xc')][_0xfd9c('0xe')]);return _0x47f1c3(_0x574fa9[_0xfd9c('0xc')][_0xfd9c('0xe')]);}logger[_0xfd9c('0xc')](_0xfd9c('0xd'),_0x1fd439,_0x574fa9[_0xfd9c('0xc')][_0xfd9c('0xe')]);return _0x1f84f5(_0x574fa9[_0xfd9c('0xc')][_0xfd9c('0xe')]);}else{logger[_0xfd9c('0x7')](_0xfd9c('0xd'),_0x1fd439,_0xfd9c('0x8'));_0x1f84f5(_0x574fa9['result'][_0xfd9c('0xe')]);}})['catch'](function(_0x38b90b){logger[_0xfd9c('0xc')]('Trunk,\x20%s,\x20%s',_0x1fd439,_0x38b90b);_0x47f1c3(_0x38b90b);});});}exports['GetTrunk']=function(_0x29f62a){var _0x22e0b0=this;return new Promise(function(_0x3e572d,_0x30a6c5){return db['Trunk'][_0xfd9c('0xf')]({'raw':_0x29f62a[_0xfd9c('0x10')]?_0x29f62a[_0xfd9c('0x10')][_0xfd9c('0x11')]===undefined?!![]:![]:!![],'where':_0x29f62a['options']?_0x29f62a[_0xfd9c('0x10')][_0xfd9c('0x12')]||null:null,'attributes':_0x29f62a['options']?_0x29f62a['options']['attributes']||null:null,'limit':_0x29f62a[_0xfd9c('0x10')]?_0x29f62a[_0xfd9c('0x10')][_0xfd9c('0x13')]||null:null,'include':_0x29f62a[_0xfd9c('0x10')]?_0x29f62a[_0xfd9c('0x10')][_0xfd9c('0x14')]?_[_0xfd9c('0x15')](_0x29f62a[_0xfd9c('0x10')][_0xfd9c('0x14')],function(_0x16855c){return{'model':db[_0x16855c['model']],'as':_0x16855c['as'],'attributes':_0x16855c[_0xfd9c('0x16')],'include':_0x16855c[_0xfd9c('0x14')]?_[_0xfd9c('0x15')](_0x16855c[_0xfd9c('0x14')],function(_0x4e9e2e){return{'model':db[_0x4e9e2e['model']],'as':_0x4e9e2e['as'],'attributes':_0x4e9e2e['attributes'],'include':_0x4e9e2e['include']?_[_0xfd9c('0x15')](_0x4e9e2e[_0xfd9c('0x14')],function(_0x512a07){return{'model':db[_0x512a07[_0xfd9c('0x17')]],'as':_0x512a07['as'],'attributes':_0x512a07[_0xfd9c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfd9c('0x18')](function(_0x264380){logger['info']('GetTrunk',_0x29f62a);logger['debug']('GetTrunk',_0x29f62a,JSON['stringify'](_0x264380));_0x3e572d(_0x264380);})[_0xfd9c('0x19')](function(_0x21d5d6){logger['error'](_0xfd9c('0x1a'),_0x21d5d6[_0xfd9c('0xe')],_0x29f62a);_0x30a6c5(_0x22e0b0[_0xfd9c('0xc')](0x1f4,_0x21d5d6['message']));});});};exports[_0xfd9c('0x1b')]=function(_0x52899d){var _0x5bd833=this;return new Promise(function(_0x4a8f41,_0x46ff80){return db['Trunk']['find']({'raw':_0x52899d[_0xfd9c('0x10')]?_0x52899d['options'][_0xfd9c('0x11')]===undefined?!![]:![]:!![],'where':_0x52899d[_0xfd9c('0x10')]?_0x52899d[_0xfd9c('0x10')][_0xfd9c('0x12')]||null:null,'attributes':_0x52899d['options']?_0x52899d['options'][_0xfd9c('0x16')]||null:null,'include':_0x52899d[_0xfd9c('0x10')]?_0x52899d[_0xfd9c('0x10')][_0xfd9c('0x14')]?_[_0xfd9c('0x15')](_0x52899d[_0xfd9c('0x10')]['include'],function(_0x61cb5b){return{'model':db[_0x61cb5b[_0xfd9c('0x17')]],'as':_0x61cb5b['as'],'attributes':_0x61cb5b[_0xfd9c('0x16')],'include':_0x61cb5b[_0xfd9c('0x14')]?_[_0xfd9c('0x15')](_0x61cb5b[_0xfd9c('0x14')],function(_0x5e5953){return{'model':db[_0x5e5953[_0xfd9c('0x17')]],'as':_0x5e5953['as'],'attributes':_0x5e5953['attributes'],'include':_0x5e5953[_0xfd9c('0x14')]?_[_0xfd9c('0x15')](_0x5e5953['include'],function(_0x5a2c1a){return{'model':db[_0x5a2c1a['model']],'as':_0x5a2c1a['as'],'attributes':_0x5a2c1a[_0xfd9c('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e41cd){logger[_0xfd9c('0x7')](_0xfd9c('0x1b'),_0x52899d);logger['debug'](_0xfd9c('0x1b'),_0x52899d,JSON[_0xfd9c('0xb')](_0x3e41cd));_0x4a8f41(_0x3e41cd);})[_0xfd9c('0x19')](function(_0x5125af){logger[_0xfd9c('0xc')](_0xfd9c('0x1b'),_0x5125af['message'],_0x52899d);_0x46ff80(_0x5bd833[_0xfd9c('0xc')](0x1f4,_0x5125af[_0xfd9c('0xe')]));});});}; \ No newline at end of file +var _0xf250=['ShowTrunk','Trunk','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetTrunk','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf250,0xce));var _0x0f25=function(_0x3a9083,_0x3c9f8d){_0x3a9083=_0x3a9083-0x0;var _0x160306=_0xf250[_0x3a9083];return _0x160306;};'use strict';var _=require(_0x0f25('0x0'));var util=require(_0x0f25('0x1'));var moment=require(_0x0f25('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f25('0x3'));var fs=require('fs');var Redis=require(_0x0f25('0x4'));var db=require(_0x0f25('0x5'))['db'];var utils=require(_0x0f25('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0f25('0x7'));var jayson=require(_0x0f25('0x8'));var client=jayson[_0x0f25('0x9')][_0x0f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1210cd,_0x526fa9,_0x157a41){return new BPromise(function(_0x5f1c43,_0x488850){return client['request'](_0x1210cd,_0x157a41)[_0x0f25('0xb')](function(_0x522ec9){logger[_0x0f25('0xc')](_0x0f25('0xd'),_0x526fa9,'request\x20sent');logger[_0x0f25('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x526fa9,_0x0f25('0xf'),JSON[_0x0f25('0x10')](_0x522ec9));if(_0x522ec9['error']){if(_0x522ec9[_0x0f25('0x11')][_0x0f25('0x12')]===0x1f4){logger[_0x0f25('0x11')](_0x0f25('0xd'),_0x526fa9,_0x522ec9[_0x0f25('0x11')][_0x0f25('0x13')]);return _0x488850(_0x522ec9[_0x0f25('0x11')][_0x0f25('0x13')]);}logger[_0x0f25('0x11')]('Trunk,\x20%s,\x20%s',_0x526fa9,_0x522ec9['error'][_0x0f25('0x13')]);return _0x5f1c43(_0x522ec9[_0x0f25('0x11')][_0x0f25('0x13')]);}else{logger[_0x0f25('0xc')](_0x0f25('0xd'),_0x526fa9,_0x0f25('0xf'));_0x5f1c43(_0x522ec9[_0x0f25('0x14')][_0x0f25('0x13')]);}})[_0x0f25('0x15')](function(_0x308ae0){logger[_0x0f25('0x11')]('Trunk,\x20%s,\x20%s',_0x526fa9,_0x308ae0);_0x488850(_0x308ae0);});});}exports[_0x0f25('0x16')]=function(_0x11ced3){var _0x2a0ca7=this;return new Promise(function(_0x1b5612,_0x497426){return db['Trunk'][_0x0f25('0x17')]({'raw':_0x11ced3[_0x0f25('0x18')]?_0x11ced3[_0x0f25('0x18')][_0x0f25('0x19')]===undefined?!![]:![]:!![],'where':_0x11ced3[_0x0f25('0x18')]?_0x11ced3['options'][_0x0f25('0x1a')]||null:null,'attributes':_0x11ced3[_0x0f25('0x18')]?_0x11ced3[_0x0f25('0x18')][_0x0f25('0x1b')]||null:null,'limit':_0x11ced3[_0x0f25('0x18')]?_0x11ced3[_0x0f25('0x18')][_0x0f25('0x1c')]||null:null,'include':_0x11ced3[_0x0f25('0x18')]?_0x11ced3[_0x0f25('0x18')][_0x0f25('0x1d')]?_[_0x0f25('0x1e')](_0x11ced3[_0x0f25('0x18')][_0x0f25('0x1d')],function(_0x4e3071){return{'model':db[_0x4e3071[_0x0f25('0x1f')]],'as':_0x4e3071['as'],'attributes':_0x4e3071[_0x0f25('0x1b')],'include':_0x4e3071[_0x0f25('0x1d')]?_[_0x0f25('0x1e')](_0x4e3071['include'],function(_0x38acde){return{'model':db[_0x38acde[_0x0f25('0x1f')]],'as':_0x38acde['as'],'attributes':_0x38acde['attributes'],'include':_0x38acde['include']?_[_0x0f25('0x1e')](_0x38acde['include'],function(_0x18a242){return{'model':db[_0x18a242['model']],'as':_0x18a242['as'],'attributes':_0x18a242[_0x0f25('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0f25('0xb')](function(_0x5b4fdd){logger[_0x0f25('0xc')](_0x0f25('0x16'),_0x11ced3);logger[_0x0f25('0xe')](_0x0f25('0x16'),_0x11ced3,JSON['stringify'](_0x5b4fdd));_0x1b5612(_0x5b4fdd);})[_0x0f25('0x15')](function(_0x370e26){logger[_0x0f25('0x11')]('GetTrunk',_0x370e26['message'],_0x11ced3);_0x497426(_0x2a0ca7['error'](0x1f4,_0x370e26[_0x0f25('0x13')]));});});};exports[_0x0f25('0x20')]=function(_0x2c284c){var _0x138d8c=this;return new Promise(function(_0x39eb3a,_0x16c7e2){return db[_0x0f25('0x21')]['find']({'raw':_0x2c284c[_0x0f25('0x18')]?_0x2c284c['options'][_0x0f25('0x19')]===undefined?!![]:![]:!![],'where':_0x2c284c[_0x0f25('0x18')]?_0x2c284c[_0x0f25('0x18')]['where']||null:null,'attributes':_0x2c284c[_0x0f25('0x18')]?_0x2c284c['options'][_0x0f25('0x1b')]||null:null,'include':_0x2c284c['options']?_0x2c284c['options'][_0x0f25('0x1d')]?_[_0x0f25('0x1e')](_0x2c284c[_0x0f25('0x18')][_0x0f25('0x1d')],function(_0x104326){return{'model':db[_0x104326['model']],'as':_0x104326['as'],'attributes':_0x104326[_0x0f25('0x1b')],'include':_0x104326['include']?_[_0x0f25('0x1e')](_0x104326[_0x0f25('0x1d')],function(_0x4fc781){return{'model':db[_0x4fc781[_0x0f25('0x1f')]],'as':_0x4fc781['as'],'attributes':_0x4fc781['attributes'],'include':_0x4fc781[_0x0f25('0x1d')]?_[_0x0f25('0x1e')](_0x4fc781[_0x0f25('0x1d')],function(_0x4bdf93){return{'model':db[_0x4bdf93[_0x0f25('0x1f')]],'as':_0x4bdf93['as'],'attributes':_0x4bdf93[_0x0f25('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0f25('0xb')](function(_0x3722cd){logger[_0x0f25('0xc')](_0x0f25('0x20'),_0x2c284c);logger['debug'](_0x0f25('0x20'),_0x2c284c,JSON[_0x0f25('0x10')](_0x3722cd));_0x39eb3a(_0x3722cd);})['catch'](function(_0x427b4f){logger[_0x0f25('0x11')](_0x0f25('0x20'),_0x427b4f['message'],_0x2c284c);_0x16c7e2(_0x138d8c[_0x0f25('0x11')](0x1f4,_0x427b4f[_0x0f25('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 6ba4432..e10f4fc 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 _0x5910=['removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','create','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions'];(function(_0x25b52f,_0xe15649){var _0x441278=function(_0x41469d){while(--_0x41469d){_0x25b52f['push'](_0x25b52f['shift']());}};_0x441278(++_0xe15649);}(_0x5910,0x83));var _0x0591=function(_0x27c677,_0x2c141e){_0x27c677=_0x27c677-0x0;var _0x5bc832=_0x5910[_0x27c677];return _0x5bc832;};'use strict';var multer=require(_0x0591('0x0'));var util=require(_0x0591('0x1'));var path=require('path');var timeout=require(_0x0591('0x2'));var express=require('express');var router=express[_0x0591('0x3')]();var fs_extra=require(_0x0591('0x4'));var auth=require(_0x0591('0x5'));var interaction=require(_0x0591('0x6'));var config=require(_0x0591('0x7'));var controller=require('./user.controller');router[_0x0591('0x8')]('/',auth[_0x0591('0x9')](),controller[_0x0591('0xa')]);router['get'](_0x0591('0xb'),auth[_0x0591('0x9')](),controller[_0x0591('0xc')]);router['get'](_0x0591('0xd'),auth[_0x0591('0x9')](),controller[_0x0591('0xe')]);router[_0x0591('0x8')](_0x0591('0xf'),auth[_0x0591('0x9')](),controller[_0x0591('0x10')]);router['get'](_0x0591('0x11'),auth[_0x0591('0x9')](),controller['show']);router[_0x0591('0x8')](_0x0591('0x12'),controller[_0x0591('0x13')]);router[_0x0591('0x8')](_0x0591('0x14'),auth[_0x0591('0x9')](),controller[_0x0591('0x15')]);router[_0x0591('0x8')](_0x0591('0x16'),auth[_0x0591('0x9')](),controller['getContacts']);router[_0x0591('0x8')](_0x0591('0x17'),auth[_0x0591('0x9')](),controller[_0x0591('0x18')]);router[_0x0591('0x8')](_0x0591('0x19'),auth[_0x0591('0x9')](),controller[_0x0591('0x1a')]);router['get'](_0x0591('0x1b'),auth[_0x0591('0x9')](),controller[_0x0591('0x1c')]);router[_0x0591('0x8')](_0x0591('0x1d'),auth[_0x0591('0x9')](),controller[_0x0591('0x1e')]);router[_0x0591('0x8')](_0x0591('0x1f'),auth[_0x0591('0x9')](),controller[_0x0591('0x20')]);router[_0x0591('0x8')](_0x0591('0x21'),auth['isAuthenticated'](),controller[_0x0591('0x22')]);router[_0x0591('0x8')](_0x0591('0x23'),auth[_0x0591('0x9')](),controller['getOpenchannelInteractions']);router['get'](_0x0591('0x24'),auth[_0x0591('0x9')](),controller[_0x0591('0x25')]);router['get']('/:id/sms/interactions',auth[_0x0591('0x9')](),controller['getSmsInteractions']);router[_0x0591('0x8')](_0x0591('0x26'),auth['isAuthenticated'](),controller[_0x0591('0x27')]);router[_0x0591('0x8')]('/:id/whatsapp/interactions',auth[_0x0591('0x9')](),controller['getWhatsappInteractions']);router[_0x0591('0x8')](_0x0591('0x28'),auth[_0x0591('0x9')](),controller[_0x0591('0x29')]);router[_0x0591('0x8')](_0x0591('0x2a'),auth[_0x0591('0x9')](),controller[_0x0591('0x2b')]);router['get'](_0x0591('0x2c'),auth[_0x0591('0x9')](),controller[_0x0591('0x2d')]);router['get'](_0x0591('0x2e'),auth['isAuthenticated'](),controller[_0x0591('0x2f')]);router['get']('/:id/fax_accounts',auth[_0x0591('0x9')](),controller[_0x0591('0x30')]);router[_0x0591('0x8')](_0x0591('0x31'),auth[_0x0591('0x9')](),controller['getMailAccounts']);router[_0x0591('0x8')](_0x0591('0x32'),auth['isAuthenticated'](),controller[_0x0591('0x33')]);router['get']('/:id/sms_accounts',auth[_0x0591('0x9')](),controller[_0x0591('0x34')]);router['get'](_0x0591('0x35'),auth[_0x0591('0x9')](),controller[_0x0591('0x36')]);router[_0x0591('0x8')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x0591('0x8')](_0x0591('0x37'),auth[_0x0591('0x9')](),controller[_0x0591('0x38')]);router[_0x0591('0x8')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x0591('0x39')]);router[_0x0591('0x8')](_0x0591('0x3a'),auth[_0x0591('0x9')](),controller[_0x0591('0x3b')]);router['post']('/:id/contacts',auth[_0x0591('0x9')](),controller['addContacts']);router['post']('/',auth[_0x0591('0x9')](),controller[_0x0591('0x3c')]);router[_0x0591('0x3d')](_0x0591('0x3e'),auth[_0x0591('0x9')](),controller[_0x0591('0x3f')]);router[_0x0591('0x3d')](_0x0591('0x17'),auth['isAuthenticated'](),controller[_0x0591('0x40')]);var upload=multer({'storage':multer[_0x0591('0x41')]({'destination':function(_0x128eca,_0x1c122b,_0x37a974){_0x37a974(null,path[_0x0591('0x42')](config[_0x0591('0x43')],_0x0591('0x44')));},'filename':function(_0x30dd8a,_0x4d4afb,_0x2e04df){_0x2e04df(null,util[_0x0591('0x45')](_0x0591('0x46'),Date[_0x0591('0x47')](),_0x4d4afb[_0x0591('0x48')]));}})});router[_0x0591('0x3d')](_0x0591('0x12'),upload[_0x0591('0x49')](_0x0591('0x4a')),controller[_0x0591('0x4b')]);router[_0x0591('0x3d')](_0x0591('0x4c'),auth['isAuthenticated'](),controller[_0x0591('0x4d')]);router[_0x0591('0x3d')]('/:id/logout',auth['isAuthenticated'](),controller['logout']);router[_0x0591('0x3d')](_0x0591('0x4e'),auth[_0x0591('0x9')](),controller['pause']);router[_0x0591('0x3d')](_0x0591('0x4f'),auth['isAuthenticated'](),controller[_0x0591('0x50')]);router[_0x0591('0x3d')](_0x0591('0x28'),auth[_0x0591('0x9')](),controller[_0x0591('0x51')]);router[_0x0591('0x3d')](_0x0591('0x52'),auth['isAuthenticated'](),controller[_0x0591('0x53')]);router[_0x0591('0x3d')](_0x0591('0x54'),auth[_0x0591('0x9')](),controller[_0x0591('0x55')]);router[_0x0591('0x3d')](_0x0591('0x56'),auth[_0x0591('0x9')](),controller['addFaxInteractions']);router['post'](_0x0591('0x57'),auth[_0x0591('0x9')](),controller['addSmsInteractions']);router[_0x0591('0x3d')]('/:id/openchannel_interactions',auth[_0x0591('0x9')](),controller[_0x0591('0x58')]);router[_0x0591('0x3d')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x0591('0x59')]);router[_0x0591('0x3d')](_0x0591('0x5a'),auth[_0x0591('0x9')](),controller[_0x0591('0x5b')]);router[_0x0591('0x3d')](_0x0591('0x31'),auth[_0x0591('0x9')](),controller[_0x0591('0x5c')]);router[_0x0591('0x3d')](_0x0591('0x32'),auth[_0x0591('0x9')](),controller[_0x0591('0x5d')]);router[_0x0591('0x3d')](_0x0591('0x5e'),auth[_0x0591('0x9')](),controller[_0x0591('0x5f')]);router[_0x0591('0x3d')](_0x0591('0x35'),auth[_0x0591('0x9')](),controller[_0x0591('0x60')]);router['post'](_0x0591('0x61'),auth[_0x0591('0x9')](),controller[_0x0591('0x62')]);router[_0x0591('0x3d')]('/:id/square_projects',auth['isAuthenticated'](),controller['addSquareProjects']);router['post'](_0x0591('0x3a'),auth['isAuthenticated'](),controller[_0x0591('0x63')]);router[_0x0591('0x64')](_0x0591('0x11'),auth[_0x0591('0x9')](),controller['update']);router[_0x0591('0x64')](_0x0591('0x65'),auth[_0x0591('0x9')](),controller[_0x0591('0x66')]);router[_0x0591('0x67')](_0x0591('0x17'),auth[_0x0591('0x9')](),controller[_0x0591('0x68')]);router[_0x0591('0x67')](_0x0591('0x28'),auth[_0x0591('0x9')](),controller[_0x0591('0x69')]);router[_0x0591('0x67')](_0x0591('0x11'),auth[_0x0591('0x9')](),controller['destroy']);router['delete']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x0591('0x6a')]);router[_0x0591('0x67')](_0x0591('0x54'),auth[_0x0591('0x9')](),controller[_0x0591('0x6b')]);router['delete']('/:id/fax_interactions',auth[_0x0591('0x9')](),controller[_0x0591('0x6c')]);router[_0x0591('0x67')](_0x0591('0x57'),auth[_0x0591('0x9')](),controller[_0x0591('0x6d')]);router[_0x0591('0x67')](_0x0591('0x6e'),auth[_0x0591('0x9')](),controller['removeOpenchannelInteractions']);router[_0x0591('0x67')]('/:id/whatsapp_interactions',auth[_0x0591('0x9')](),controller[_0x0591('0x6f')]);router[_0x0591('0x67')]('/:id/fax_accounts',auth[_0x0591('0x9')](),controller[_0x0591('0x70')]);router[_0x0591('0x67')](_0x0591('0x31'),auth[_0x0591('0x9')](),controller[_0x0591('0x71')]);router['delete'](_0x0591('0x32'),auth[_0x0591('0x9')](),controller[_0x0591('0x72')]);router[_0x0591('0x67')](_0x0591('0x5e'),auth['isAuthenticated'](),controller[_0x0591('0x73')]);router[_0x0591('0x67')](_0x0591('0x35'),auth[_0x0591('0x9')](),controller[_0x0591('0x74')]);router[_0x0591('0x67')](_0x0591('0x61'),auth['isAuthenticated'](),controller[_0x0591('0x75')]);router['delete'](_0x0591('0x37'),auth[_0x0591('0x9')](),controller[_0x0591('0x76')]);router['delete'](_0x0591('0x3a'),auth[_0x0591('0x9')](),controller['removeApiKey']);module[_0x0591('0x77')]=router; \ No newline at end of file +var _0xafbf=['fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','util','connect-timeout','express'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xafbf,0x1dd));var _0xfafb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xafbf[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0xfafb('0x0'));var path=require('path');var timeout=require(_0xfafb('0x1'));var express=require(_0xfafb('0x2'));var router=express['Router']();var fs_extra=require(_0xfafb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfafb('0x4'));var config=require(_0xfafb('0x5'));var controller=require(_0xfafb('0x6'));router[_0xfafb('0x7')]('/',auth[_0xfafb('0x8')](),controller['index']);router['get'](_0xfafb('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/whoami',auth[_0xfafb('0x8')](),controller[_0xfafb('0xa')]);router[_0xfafb('0x7')](_0xfafb('0xb'),auth['isAuthenticated'](),controller[_0xfafb('0xc')]);router[_0xfafb('0x7')](_0xfafb('0xd'),auth['isAuthenticated'](),controller[_0xfafb('0xe')]);router[_0xfafb('0x7')](_0xfafb('0xf'),controller[_0xfafb('0x10')]);router[_0xfafb('0x7')](_0xfafb('0x11'),auth[_0xfafb('0x8')](),controller['getOpenTabs']);router[_0xfafb('0x7')](_0xfafb('0x12'),auth['isAuthenticated'](),controller[_0xfafb('0x13')]);router['get'](_0xfafb('0x14'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x15')]);router[_0xfafb('0x7')]('/:id/queues_rt',auth[_0xfafb('0x8')](),controller[_0xfafb('0x16')]);router['get'](_0xfafb('0x17'),auth['isAuthenticated'](),controller[_0xfafb('0x18')]);router[_0xfafb('0x7')](_0xfafb('0x19'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x1a')]);router[_0xfafb('0x7')](_0xfafb('0x1b'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x1c')]);router[_0xfafb('0x7')](_0xfafb('0x1d'),auth[_0xfafb('0x8')](),controller['getChatInteractions']);router[_0xfafb('0x7')](_0xfafb('0x1e'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x1f')]);router[_0xfafb('0x7')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xfafb('0x20')]);router['get'](_0xfafb('0x21'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x22')]);router[_0xfafb('0x7')](_0xfafb('0x23'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x24')]);router[_0xfafb('0x7')](_0xfafb('0x25'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x26')]);router[_0xfafb('0x7')](_0xfafb('0x27'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x28')]);router['get'](_0xfafb('0x29'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x2a')]);router[_0xfafb('0x7')](_0xfafb('0x2b'),auth['isAuthenticated'](),controller[_0xfafb('0x2c')]);router[_0xfafb('0x7')](_0xfafb('0x2d'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x2e')]);router[_0xfafb('0x7')](_0xfafb('0x2f'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x30')]);router[_0xfafb('0x7')](_0xfafb('0x31'),auth['isAuthenticated'](),controller[_0xfafb('0x32')]);router[_0xfafb('0x7')](_0xfafb('0x33'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x34')]);router[_0xfafb('0x7')]('/:id/sms_accounts',auth[_0xfafb('0x8')](),controller[_0xfafb('0x35')]);router[_0xfafb('0x7')](_0xfafb('0x36'),auth[_0xfafb('0x8')](),controller['getChatWebsites']);router[_0xfafb('0x7')](_0xfafb('0x37'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x38')]);router[_0xfafb('0x7')](_0xfafb('0x39'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x3a')]);router['get'](_0xfafb('0x3b'),auth[_0xfafb('0x8')](),controller['getScheduledCalls']);router[_0xfafb('0x7')](_0xfafb('0x3c'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x3d')]);router['post']('/:id/contacts',auth[_0xfafb('0x8')](),controller[_0xfafb('0x3e')]);router[_0xfafb('0x3f')]('/',auth[_0xfafb('0x8')](),controller[_0xfafb('0x40')]);router[_0xfafb('0x3f')]('/create_many',auth[_0xfafb('0x8')](),controller[_0xfafb('0x41')]);router[_0xfafb('0x3f')](_0xfafb('0x14'),auth['isAuthenticated'](),controller[_0xfafb('0x42')]);var upload=multer({'storage':multer[_0xfafb('0x43')]({'destination':function(_0x102f02,_0x165b7f,_0xd402c2){_0xd402c2(null,path[_0xfafb('0x44')](config[_0xfafb('0x45')],_0xfafb('0x46')));},'filename':function(_0x1a4429,_0xcbdd2c,_0x5d63bb){_0x5d63bb(null,util[_0xfafb('0x47')](_0xfafb('0x48'),Date[_0xfafb('0x49')](),_0xcbdd2c[_0xfafb('0x4a')]));}})});router[_0xfafb('0x3f')]('/:id/avatar',upload[_0xfafb('0x4b')](_0xfafb('0x4c')),controller[_0xfafb('0x4d')]);router[_0xfafb('0x3f')]('/:id/login',auth[_0xfafb('0x8')](),controller[_0xfafb('0x4e')]);router[_0xfafb('0x3f')](_0xfafb('0x4f'),auth[_0xfafb('0x8')](),controller['logout']);router[_0xfafb('0x3f')](_0xfafb('0x50'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x51')]);router[_0xfafb('0x3f')](_0xfafb('0x52'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x53')]);router['post']('/:id/teams',auth[_0xfafb('0x8')](),controller[_0xfafb('0x54')]);router['post'](_0xfafb('0x55'),auth['isAuthenticated'](),controller[_0xfafb('0x56')]);router[_0xfafb('0x3f')]('/:id/mail_interactions',auth[_0xfafb('0x8')](),controller[_0xfafb('0x57')]);router[_0xfafb('0x3f')]('/:id/fax_interactions',auth[_0xfafb('0x8')](),controller[_0xfafb('0x58')]);router[_0xfafb('0x3f')]('/:id/sms_interactions',auth[_0xfafb('0x8')](),controller['addSmsInteractions']);router['post'](_0xfafb('0x59'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x5a')]);router['post'](_0xfafb('0x5b'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x5c')]);router[_0xfafb('0x3f')]('/:id/fax_accounts',auth[_0xfafb('0x8')](),controller[_0xfafb('0x5d')]);router[_0xfafb('0x3f')](_0xfafb('0x31'),auth[_0xfafb('0x8')](),controller['addMailAccounts']);router[_0xfafb('0x3f')](_0xfafb('0x33'),auth['isAuthenticated'](),controller[_0xfafb('0x5e')]);router[_0xfafb('0x3f')](_0xfafb('0x5f'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x60')]);router[_0xfafb('0x3f')](_0xfafb('0x36'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x61')]);router[_0xfafb('0x3f')](_0xfafb('0x37'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x62')]);router['post'](_0xfafb('0x39'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x63')]);router['post']('/:id/api_key',auth[_0xfafb('0x8')](),controller[_0xfafb('0x64')]);router['put'](_0xfafb('0xd'),auth[_0xfafb('0x8')](),controller['update']);router[_0xfafb('0x65')](_0xfafb('0x66'),auth[_0xfafb('0x8')](),controller['changePassword']);router[_0xfafb('0x67')](_0xfafb('0x14'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x68')]);router[_0xfafb('0x67')]('/:id/teams',auth[_0xfafb('0x8')](),controller[_0xfafb('0x69')]);router[_0xfafb('0x67')](_0xfafb('0xd'),auth['isAuthenticated'](),controller[_0xfafb('0x6a')]);router[_0xfafb('0x67')](_0xfafb('0x55'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x6b')]);router[_0xfafb('0x67')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xfafb('0x6c')]);router['delete'](_0xfafb('0x6d'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x6e')]);router['delete'](_0xfafb('0x6f'),auth['isAuthenticated'](),controller[_0xfafb('0x70')]);router[_0xfafb('0x67')](_0xfafb('0x59'),auth['isAuthenticated'](),controller[_0xfafb('0x71')]);router[_0xfafb('0x67')](_0xfafb('0x5b'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x72')]);router['delete'](_0xfafb('0x2f'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x73')]);router[_0xfafb('0x67')](_0xfafb('0x31'),auth[_0xfafb('0x8')](),controller['removeMailAccounts']);router[_0xfafb('0x67')](_0xfafb('0x33'),auth[_0xfafb('0x8')](),controller['removeOpenchannelAccounts']);router[_0xfafb('0x67')](_0xfafb('0x5f'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0xfafb('0x67')]('/:id/chat_websites',auth[_0xfafb('0x8')](),controller[_0xfafb('0x74')]);router[_0xfafb('0x67')](_0xfafb('0x37'),auth[_0xfafb('0x8')](),controller['removeWhatsappAccounts']);router[_0xfafb('0x67')]('/:id/square_projects',auth[_0xfafb('0x8')](),controller[_0xfafb('0x75')]);router[_0xfafb('0x67')](_0xfafb('0x3c'),auth[_0xfafb('0x8')](),controller[_0xfafb('0x76')]);module[_0xfafb('0x77')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c20580f..5c89afc 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 _0x130d=['screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','getDataValue','internal','email','toLowerCase','admin','user','telephone','accountcode','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','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','accept','refuse','originate','uac','uas','fingerprint','active','passive','actpass','update,nonat','TEXT','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd130('0x0'));var moment=require('moment');var util=require(_0xd130('0x1'));var _=require('lodash');module[_0xd130('0x2')]={'name':{'type':Sequelize[_0xd130('0x3')],'allowNull':![],'unique':_0xd130('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x77d691){this[_0xd130('0x5')](_0xd130('0x4'),_0x77d691);this[_0xd130('0x5')](_0xd130('0x6'),_0x77d691);},'comment':_0xd130('0x7')},'fullname':{'type':Sequelize[_0xd130('0x3')],'allowNull':![],'set':function(_0x44c215){this[_0xd130('0x5')](_0xd130('0x8'),_0x44c215);this[_0xd130('0x5')]('callerid',util[_0xd130('0x9')]('\x22%s\x22\x20<%s>',_0x44c215,this[_0xd130('0xa')](_0xd130('0xb'))));}},'alias':{'type':Sequelize[_0xd130('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd130('0xc'),'validate':{'isEmail':!![]},'set':function(_0x42411f){if(_0x42411f){this['setDataValue']('email',_0x42411f[_0xd130('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0xd130('0xe'),_0xd130('0xf'),'agent',_0xd130('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xd130('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd130('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x1f56b7){this[_0xd130('0x5')](_0xd130('0xb'),_0x1f56b7);this[_0xd130('0x5')](_0xd130('0x11'),_0x1f56b7);this['setDataValue'](_0xd130('0x12'),util[_0xd130('0x9')](_0xd130('0x13'),this[_0xd130('0xa')]('fullname'),_0x1f56b7));}},'salt':{'type':Sequelize[_0xd130('0x3')]},'phone':{'type':Sequelize[_0xd130('0x3')]},'mobile':{'type':Sequelize[_0xd130('0x3')]},'address':{'type':Sequelize[_0xd130('0x3')]},'zipcode':{'type':Sequelize[_0xd130('0x3')]},'userpic':{'type':Sequelize[_0xd130('0x3')]},'city':{'type':Sequelize[_0xd130('0x3')]},'country':{'type':Sequelize[_0xd130('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xd130('0x3')],'defaultValue':_0xd130('0x15')},'lastPauseAt':{'type':Sequelize[_0xd130('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd130('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd130('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd130('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xd130('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd130('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd130('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd130('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd130('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![],'defaultValue':_0xd130('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xd130('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x1a'),_0xd130('0xf'),_0xd130('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![],'defaultValue':_0xd130('0x1c')},'callingpres':{'type':Sequelize[_0xd130('0x19')]('ALLOWED_NOT_SCREENED',_0xd130('0x1d'),'ALLOWED_FAILED_SCREEN',_0xd130('0x1e'),'PROHIB_NOT_SCREENED',_0xd130('0x1f'),_0xd130('0x20'),_0xd130('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x37b8c9){this[_0xd130('0x5')](_0xd130('0x22'),_0x37b8c9?_0x37b8c9['join'](','):null);},'get':function(){return this[_0xd130('0xa')](_0xd130('0x22'))?this['getDataValue'](_0xd130('0x22'))[_0xd130('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x24'),_0xd130('0x25'),_0xd130('0x26'),_0xd130('0x27'),_0xd130('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no',_0xd130('0x2a'),_0xd130('0x2b'),_0xd130('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd130('0x2d'),'set':function(_0x2ca9d1){this['setDataValue'](_0xd130('0x2e'),_0x2ca9d1?_0x2ca9d1[_0xd130('0x2f')](','):null);},'get':function(){return this[_0xd130('0xa')](_0xd130('0x2e'))?this[_0xd130('0xa')]('nat')[_0xd130('0x23')](','):null;},'comment':_0xd130('0x30')},'callgroup':{'type':Sequelize[_0xd130('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xd130('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xd130('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd130('0x3')]},'disallow':{'type':Sequelize[_0xd130('0x3')],'allowNull':![],'defaultValue':_0xd130('0x31')},'allow':{'type':Sequelize[_0xd130('0x3')],'allowNull':![],'defaultValue':_0xd130('0x32'),'set':function(_0x16ed3b){this['setDataValue']('allow',_0x16ed3b?_0x16ed3b[_0xd130('0x2f')](';'):_0xd130('0x32'));},'get':function(){return this[_0xd130('0xa')]('allow')?this['getDataValue']('allow')['split'](';'):null;},'comment':_0xd130('0x33')},'autoframing':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![],'set':function(_0xe94f2a){this['setDataValue'](_0xd130('0x34'),_0xe94f2a?_0xe94f2a[_0xd130('0x2f')](','):null);},'get':function(){return this[_0xd130('0xa')](_0xd130('0x34'))?this[_0xd130('0xa')](_0xd130('0x34'))[_0xd130('0x23')](','):null;},'comment':_0xd130('0x35')},'trustrpid':{'type':Sequelize['ENUM'](_0xd130('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd130('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd130('0x19')]('yes','no',_0xd130('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd130('0x19')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd130('0x19')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![],'defaultValue':_0xd130('0x37')},'amaflags':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![],'defaultValue':_0xd130('0x29')},'busylevel':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd130('0x19')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xd130('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd130('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd130('0x39'),_0xd130('0x3a'),_0xd130('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x3c'),'uas'),'allowNull':!![],'defaultValue':_0xd130('0x3d')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xd130('0x29'),'no'),'allowNull':!![],'defaultValue':_0xd130('0x29')},'keepalive':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xd130('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xd130('0x19')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd130('0x19')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no',_0xd130('0x3e'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x3f'),_0xd130('0x40'),_0xd130('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd130('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd130('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xd130('0x19')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd130('0x19')](_0xd130('0x29'),'no','nonat',_0xd130('0x2b'),_0xd130('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd130('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xd130('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd130('0x43')]},'showWebBar':{'type':Sequelize[_0xd130('0x17')],'defaultValue':0x0,'set':function(_0x123f3e){this[_0xd130('0x5')]('showWebBar',_0x123f3e);var _0x52ddcf=this[_0xd130('0x44')]({'plain':!![]});switch(_0x123f3e){case 0x0:case 0x1:var _0x3711b0=_0x52ddcf[_0xd130('0x22')]?_[_0xd130('0x45')](_0x52ddcf[_0xd130('0x22')])?_0x52ddcf[_0xd130('0x22')][_0xd130('0x2f')]():_0x52ddcf['transport']:_0xd130('0x46');if(_0x3711b0===_0xd130('0x47')){_0x3711b0=_0xd130('0x46');}this[_0xd130('0x5')](_0xd130('0x22'),_0x3711b0);this[_0xd130('0x5')](_0xd130('0x48'),'no');this[_0xd130('0x5')](_0xd130('0x49'),null);this[_0xd130('0x5')](_0xd130('0x4a'),null);this[_0xd130('0x5')](_0xd130('0x4b'),null);this[_0xd130('0x5')](_0xd130('0x4c'),null);this[_0xd130('0x5')](_0xd130('0x4d'),null);this['setDataValue']('dtlssetup',null);this[_0xd130('0x5')]('dtlscertfile',null);this[_0xd130('0x5')](_0xd130('0x4e'),null);this[_0xd130('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue']('transport',_0xd130('0x47'));this['setDataValue'](_0xd130('0x48'),_0xd130('0x29'));this[_0xd130('0x5')](_0xd130('0x49'),_0xd130('0x29'));this[_0xd130('0x5')](_0xd130('0x4a'),_0xd130('0x29'));this['setDataValue'](_0xd130('0x4b'),_0xd130('0x29'));this['setDataValue'](_0xd130('0x4c'),_0xd130('0x29'));this[_0xd130('0x5')](_0xd130('0x4d'),'no');this[_0xd130('0x5')](_0xd130('0x4f'),_0xd130('0x41'));this['setDataValue'](_0xd130('0x50'),_0x52ddcf['dtlscertfile']||_0xd130('0x51'));this[_0xd130('0x5')](_0xd130('0x4e'),_0x52ddcf[_0xd130('0x4e')]||_0xd130('0x52'));this[_0xd130('0x5')](_0xd130('0x53'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xd130('0x43')],'set':function(_0x28f8cc){this[_0xd130('0x5')](_0xd130('0x54'),_0x28f8cc?_0x28f8cc[_0xd130('0x2f')](','):[]);},'get':function(){return this[_0xd130('0xa')](_0xd130('0x54'))?_[_0xd130('0x55')](this['getDataValue'](_0xd130('0x54'))['split'](','),function(_0x31f0b3){return parseInt(_0x31f0b3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd130('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd130('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd130('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd130('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd130('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd130('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd130('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xd130('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd130('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd130('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd130('0x56')],'get':function(){return this[_0xd130('0xa')]('phoneBarEnableScreenRecordingByAgent')?this[_0xd130('0xa')](_0xd130('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xd130('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xd130('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x7c1edf){if(typeof _0x7c1edf===_0xd130('0x58')){var _0x4cc16f=_0x7c1edf==='1'?!![]:_0x7c1edf==='0'?![]:_0x7c1edf===_0xd130('0x59')?!![]:_0x7c1edf===_0xd130('0x5a')?![]:![];this['setDataValue'](_0xd130('0x5b'),_0x4cc16f);}else{this[_0xd130('0x5')](_0xd130('0x5b'),_0x7c1edf);}}},'blocked':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![],'set':function(_0xf6eab9){this[_0xd130('0x5')](_0xd130('0x5c'),_0xf6eab9);if(_0xf6eab9===!![]){this[_0xd130('0x5')](_0xd130('0x5d'),moment());this[_0xd130('0x5')](_0xd130('0x5e'),0x0);}else{this[_0xd130('0x5')](_0xd130('0x5d'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd130('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd130('0x17')](0x5)[_0xd130('0x5f')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd130('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd130('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xd130('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0x9b67=['PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','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]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','actpass','update','update,nonat','TEXT','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','dynamic','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9b67,0xf6));var _0x79b6=function(_0x29961f,_0x1cca0d){_0x29961f=_0x29961f-0x0;var _0x237270=_0x9b67[_0x29961f];return _0x237270;};'use strict';var Sequelize=require(_0x79b6('0x0'));var moment=require(_0x79b6('0x1'));var util=require(_0x79b6('0x2'));var _=require(_0x79b6('0x3'));module[_0x79b6('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x79b6('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1aeb24){this['setDataValue']('name',_0x1aeb24);this[_0x79b6('0x6')](_0x79b6('0x7'),_0x1aeb24);},'comment':_0x79b6('0x8')},'fullname':{'type':Sequelize[_0x79b6('0x9')],'allowNull':![],'set':function(_0xfa6a05){this[_0x79b6('0x6')](_0x79b6('0xa'),_0xfa6a05);this['setDataValue'](_0x79b6('0xb'),util[_0x79b6('0xc')](_0x79b6('0xd'),_0xfa6a05,this[_0x79b6('0xe')](_0x79b6('0xf'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x79b6('0x9')],'allowNull':![],'unique':_0x79b6('0x10'),'validate':{'isEmail':!![]},'set':function(_0x3f3b44){if(_0x3f3b44){this[_0x79b6('0x6')]('email',_0x3f3b44['toLowerCase']());}}},'role':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x12'),_0x79b6('0x13'),'agent',_0x79b6('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x79b6('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x79b6('0x9')],'defaultValue':_0x79b6('0x15')},'internal':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':![],'unique':_0x79b6('0xf'),'set':function(_0x19d5b2){this[_0x79b6('0x6')](_0x79b6('0xf'),_0x19d5b2);this[_0x79b6('0x6')](_0x79b6('0x17'),_0x19d5b2);this[_0x79b6('0x6')](_0x79b6('0xb'),util['format'](_0x79b6('0xd'),this[_0x79b6('0xe')](_0x79b6('0xa')),_0x19d5b2));}},'salt':{'type':Sequelize[_0x79b6('0x9')]},'phone':{'type':Sequelize[_0x79b6('0x9')]},'mobile':{'type':Sequelize[_0x79b6('0x9')]},'address':{'type':Sequelize[_0x79b6('0x9')]},'zipcode':{'type':Sequelize[_0x79b6('0x9')]},'userpic':{'type':Sequelize[_0x79b6('0x9')]},'city':{'type':Sequelize[_0x79b6('0x9')]},'country':{'type':Sequelize[_0x79b6('0x9')]},'online':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x79b6('0x19')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x79b6('0x9')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x79b6('0x19')]},'chatCapacity':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x79b6('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'host':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![],'defaultValue':_0x79b6('0x1a')},'ipaddr':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x79b6('0x11')]('friend',_0x79b6('0x13'),_0x79b6('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![],'defaultValue':_0x79b6('0x1c')},'callingpres':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x1d'),_0x79b6('0x1e'),_0x79b6('0x1f'),'ALLOWED',_0x79b6('0x20'),_0x79b6('0x21'),_0x79b6('0x22'),_0x79b6('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![],'defaultValue':'udp','set':function(_0x533a43){this[_0x79b6('0x6')](_0x79b6('0x24'),_0x533a43?_0x533a43[_0x79b6('0x25')](','):null);},'get':function(){return this[_0x79b6('0xe')](_0x79b6('0x24'))?this[_0x79b6('0xe')]('transport')['split'](','):null;},'comment':_0x79b6('0x26')},'dtmfmode':{'type':Sequelize['ENUM'](_0x79b6('0x27'),'info',_0x79b6('0x28'),_0x79b6('0x29'),'auto'),'allowNull':!![],'defaultValue':_0x79b6('0x27')},'directmedia':{'type':Sequelize[_0x79b6('0x11')]('yes','no',_0x79b6('0x2a'),'update',_0x79b6('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![],'defaultValue':_0x79b6('0x2d'),'set':function(_0x276eb5){this[_0x79b6('0x6')](_0x79b6('0x2e'),_0x276eb5?_0x276eb5['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x79b6('0xe')](_0x79b6('0x2e'))['split'](','):null;},'comment':_0x79b6('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x79b6('0x9')]},'pickupgroup':{'type':Sequelize[_0x79b6('0x9')]},'namedpickupgroup':{'type':Sequelize[_0x79b6('0x9')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x79b6('0x9')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x79b6('0x30')},'allow':{'type':Sequelize[_0x79b6('0x9')],'allowNull':![],'defaultValue':_0x79b6('0x31'),'set':function(_0x2feeeb){this[_0x79b6('0x6')]('allow',_0x2feeeb?_0x2feeeb['join'](';'):_0x79b6('0x31'));},'get':function(){return this['getDataValue'](_0x79b6('0x32'))?this[_0x79b6('0xe')](_0x79b6('0x32'))[_0x79b6('0x33')](';'):null;},'comment':_0x79b6('0x34')},'autoframing':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x109514){this[_0x79b6('0x6')](_0x79b6('0x35'),_0x109514?_0x109514[_0x79b6('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x79b6('0x35'))?this['getDataValue']('insecure')[_0x79b6('0x33')](','):null;},'comment':_0x79b6('0x36')},'trustrpid':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x79b6('0x11')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x79b6('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![],'defaultValue':_0x79b6('0x37')},'amaflags':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x79b6('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x79b6('0x11')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no',_0x79b6('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x39'),_0x79b6('0x3a'),_0x79b6('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x3c'),_0x79b6('0x3d')),'allowNull':!![],'defaultValue':_0x79b6('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x79b6('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x79b6('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no',_0x79b6('0x3e'),_0x79b6('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x79b6('0x11')]('active','passive',_0x79b6('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x79b6('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x79b6('0x11')](_0x79b6('0x2c'),'no',_0x79b6('0x2a'),_0x79b6('0x41'),_0x79b6('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x79b6('0x19')]},'passwordResetAt':{'type':Sequelize[_0x79b6('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x79b6('0x43')]},'showWebBar':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x0,'set':function(_0xa01f94){this[_0x79b6('0x6')]('showWebBar',_0xa01f94);var _0x3a4765=this[_0x79b6('0x44')]({'plain':!![]});switch(_0xa01f94){case 0x0:case 0x1:var _0x81d4c0=_0x3a4765[_0x79b6('0x24')]?_[_0x79b6('0x45')](_0x3a4765[_0x79b6('0x24')])?_0x3a4765[_0x79b6('0x24')][_0x79b6('0x25')]():_0x3a4765['transport']:_0x79b6('0x46');if(_0x81d4c0===_0x79b6('0x47')){_0x81d4c0=_0x79b6('0x46');}this[_0x79b6('0x6')]('transport',_0x81d4c0);this[_0x79b6('0x6')](_0x79b6('0x48'),'no');this['setDataValue'](_0x79b6('0x49'),null);this['setDataValue']('force_avp',null);this[_0x79b6('0x6')](_0x79b6('0x4a'),null);this[_0x79b6('0x6')](_0x79b6('0x4b'),null);this[_0x79b6('0x6')](_0x79b6('0x4c'),null);this['setDataValue'](_0x79b6('0x4d'),null);this['setDataValue'](_0x79b6('0x4e'),null);this['setDataValue'](_0x79b6('0x4f'),null);this[_0x79b6('0x6')](_0x79b6('0x50'),'no');break;case 0x2:this[_0x79b6('0x6')](_0x79b6('0x24'),_0x79b6('0x47'));this['setDataValue']('encryption',_0x79b6('0x2c'));this[_0x79b6('0x6')](_0x79b6('0x49'),_0x79b6('0x2c'));this[_0x79b6('0x6')](_0x79b6('0x51'),'yes');this[_0x79b6('0x6')]('icesupport',_0x79b6('0x2c'));this['setDataValue'](_0x79b6('0x4b'),'yes');this[_0x79b6('0x6')](_0x79b6('0x4c'),'no');this[_0x79b6('0x6')]('dtlssetup',_0x79b6('0x40'));this[_0x79b6('0x6')](_0x79b6('0x4e'),_0x3a4765[_0x79b6('0x4e')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x79b6('0x4f'),_0x3a4765[_0x79b6('0x4f')]||_0x79b6('0x52'));this[_0x79b6('0x6')](_0x79b6('0x50'),_0x79b6('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x79b6('0x43')],'set':function(_0x3f9595){this[_0x79b6('0x6')]('permissions',_0x3f9595?_0x3f9595['join'](','):[]);},'get':function(){return this[_0x79b6('0xe')](_0x79b6('0x53'))?_[_0x79b6('0x54')](this[_0x79b6('0xe')](_0x79b6('0x53'))[_0x79b6('0x33')](','),function(_0x4adb22){return parseInt(_0x4adb22,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x79b6('0x9')]},'phoneBarBusyNumber':{'type':Sequelize[_0x79b6('0x9')]},'phoneBarUnconditional':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x79b6('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x79b6('0x9')]},'phoneBarEnableJaws':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x79b6('0x55')],'get':function(){return this[_0x79b6('0xe')]('phoneBarEnableScreenRecordingByAgent')?this[_0x79b6('0xe')](_0x79b6('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x79b6('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![],'set':function(_0x51d7f3){if(typeof _0x51d7f3==='string'){var _0x197f87=_0x51d7f3==='1'?!![]:_0x51d7f3==='0'?![]:_0x51d7f3===_0x79b6('0x57')?!![]:_0x51d7f3===_0x79b6('0x58')?![]:![];this['setDataValue'](_0x79b6('0x59'),_0x197f87);}else{this[_0x79b6('0x6')](_0x79b6('0x59'),_0x51d7f3);}}},'blocked':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![],'set':function(_0x4333bf){this[_0x79b6('0x6')](_0x79b6('0x5a'),_0x4333bf);if(_0x4333bf===!![]){this[_0x79b6('0x6')](_0x79b6('0x5b'),moment());this[_0x79b6('0x6')](_0x79b6('0x5c'),0x0);}else{this[_0x79b6('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x79b6('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x79b6('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x79b6('0x16')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x79b6('0x18')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index e0f4acc..482f3b9 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 _0x4975=['addTeams','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','flatten','getDataValue','Queue:save','TeamVoicePrefix','removeTeams','getFaxQueues','Fax','Openchannel','transaction','UserVoicePrefix','VoicePrefixId','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$gt','$gte','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','toString','asc','substring','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','offline','idle','unknown','busy','slice','charAt','toUpperCase','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','update','get','Users','Agents','agent','Telephones','filter','map','value','role','find','UserProfileResource','destroy','stack','name','send','index','User','rawAttributes','fieldName','type','key','password','salt','getOptions','where','query','includeAll','include','attributes','push','findAll','rows','openTabs','length','chat','sms','dataValues','fax','mail','whatsapp','all','params','differenceBy','keys','filters','model','intersection','fields','merge','options','includes','true','body','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','101','113','110','105','106','107','109','100','114','115','create','user','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','telephone','isEmpty','compact','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','voicePause','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','QueueId','emit','voice','VoiceQueue','interface','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','Queue:remove','addAvatar','userpic','filename','getAvatar','join','download','existsSync','root','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','CmContact','order','sort','pick','getContacts','hasOwnProperty','CmList','Tags','color','tag','nolimit','limit','getQueues','isValidChannel','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','each','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','forEach','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','openchannel','manual','set','%s%s','Pause','getTeams','Team'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x4975,0x86));var _0x5497=function(_0x259d3e,_0x9fdcf3){_0x259d3e=_0x259d3e-0x0;var _0x5dbb81=_0x4975[_0x259d3e];return _0x5dbb81;};'use strict';var moment=require(_0x5497('0x0'));var BPromise=require('bluebird');var util=require(_0x5497('0x1'));var path=require(_0x5497('0x2'));var fs=require('fs');var _=require(_0x5497('0x3'));var squel=require(_0x5497('0x4'));var jayson=require(_0x5497('0x5'));var Redis=require(_0x5497('0x6'));var authService=require(_0x5497('0x7'));var qs=require(_0x5497('0x8'));var logger=require(_0x5497('0x9'))(_0x5497('0xa'));var utils=require('../../config/utils');var config=require(_0x5497('0xb'));var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0xc'))['db'];var socket=require(_0x5497('0xd'))(new Redis(config[_0x5497('0xe')]));require('./user.socket')[_0x5497('0xf')](socket);config['redis']=_[_0x5497('0x10')](config[_0x5497('0xe')],{'host':_0x5497('0x11'),'port':0x18eb});var client=jayson[_0x5497('0x12')][_0x5497('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x425288,_0x3e7886,_0x769e11,_0x50d716){return new BPromise(function(_0x5874ef,_0x5b1162){var _0xc250bb=_0x50d716||client;return _0xc250bb[_0x5497('0x14')](_0x425288,_0x769e11)[_0x5497('0x15')](function(_0x984990){logger[_0x5497('0x16')](_0x5497('0x17'),_0x3e7886,_0x5497('0x18'));logger[_0x5497('0x19')](_0x5497('0x1a'),_0x3e7886,_0x5497('0x18'),JSON['stringify'](_0x984990));if(_0x984990[_0x5497('0x1b')]){if(_0x984990['error'][_0x5497('0x1c')]===0x1f4){logger[_0x5497('0x1b')](_0x5497('0x17'),_0x3e7886,_0x984990[_0x5497('0x1b')][_0x5497('0x1d')]);return _0x5b1162(_0x984990[_0x5497('0x1b')][_0x5497('0x1d')]);}logger['error']('User,\x20%s,\x20%s',_0x3e7886,_0x984990[_0x5497('0x1b')][_0x5497('0x1d')]);return _0x5874ef(_0x984990[_0x5497('0x1b')]['message']);}else{logger[_0x5497('0x16')](_0x5497('0x17'),_0x3e7886,_0x5497('0x18'));_0x5874ef(_0x984990[_0x5497('0x1e')][_0x5497('0x1d')]);}})[_0x5497('0x1f')](function(_0x16d378){logger[_0x5497('0x1b')](_0x5497('0x17'),_0x3e7886,_0x16d378);_0x5b1162(_0x16d378);});});}function respondWithStatusCode(_0x3f54ef,_0x186065){_0x186065=_0x186065||0xcc;return function(_0x52c049){if(_0x52c049){return _0x3f54ef[_0x5497('0x20')](_0x186065);}return _0x3f54ef['status'](_0x186065)[_0x5497('0x21')]();};}function respondWithResult(_0xd0868d,_0x44265c){_0x44265c=_0x44265c||0xc8;return function(_0x2f587d){if(_0x2f587d){return _0xd0868d[_0x5497('0x22')](_0x44265c)[_0x5497('0x23')](_0x2f587d);}};}function respondWithFilteredResult(_0x5018fa,_0x54043a){return function(_0x1eefce){if(_0x1eefce){var _0x34b97f=typeof _0x54043a[_0x5497('0x24')]===_0x5497('0x25')&&typeof _0x54043a['limit']===_0x5497('0x25');var _0x57268c=_0x1eefce[_0x5497('0x26')];var _0x16a2b4=_0x34b97f?0x0:_0x54043a[_0x5497('0x24')];var _0x34a1a5=_0x34b97f?_0x1eefce[_0x5497('0x26')]:_0x54043a[_0x5497('0x24')]+_0x54043a['limit'];var _0x4af5f4;if(_0x34a1a5>=_0x57268c){_0x34a1a5=_0x57268c;_0x4af5f4=0xc8;}else{_0x4af5f4=0xce;}_0x5018fa['status'](_0x4af5f4);return _0x5018fa['set']('Content-Range',_0x16a2b4+'-'+_0x34a1a5+'/'+_0x57268c)[_0x5497('0x23')](_0x1eefce);}return null;};}function saveUpdates(_0x48d146){return function(_0x5e9356){if(_0x5e9356){return _0x5e9356[_0x5497('0x27')](_0x48d146)[_0x5497('0x15')](function(_0x1cf908){return _0x1cf908;});}return null;};}function removeEntity(_0x4c442a){return function(_0x59380f){if(_0x59380f){return _0x59380f['destroy']()[_0x5497('0x15')](function(){var _0x471e0b=_0x59380f[_0x5497('0x28')]({'plain':!![]});if(_0x471e0b['role']==='admin')return;var _0x594866=[{'name':_0x5497('0x29'),'value':'user','ignore':!![]},{'name':_0x5497('0x2a'),'value':_0x5497('0x2b'),'ignore':![]},{'name':_0x5497('0x2c'),'value':'telephone','ignore':![]}];var _0x1d208f=_(_0x594866)[_0x5497('0x2d')]('ignore')[_0x5497('0x2e')](_0x5497('0x2f'))[_0x5497('0x2f')]();if(_['includes'](_0x1d208f,_0x471e0b[_0x5497('0x30')])){return;}var _0x2fe1f2=_[_0x5497('0x31')](_0x594866,[_0x5497('0x2f'),_0x471e0b[_0x5497('0x30')]])['name'];return db[_0x5497('0x32')][_0x5497('0x33')]({'where':{'type':_0x2fe1f2,'resourceId':_0x471e0b['id']}})['then'](function(){return _0x59380f;});})[_0x5497('0x15')](function(){_0x4c442a[_0x5497('0x22')](0xcc)[_0x5497('0x21')]();});}};}function handleEntityNotFound(_0x1b9cd8){return function(_0x1656c7){if(!_0x1656c7){_0x1b9cd8[_0x5497('0x20')](0x194);}return _0x1656c7;};}function handleError(_0x580e86,_0x14314d){_0x14314d=_0x14314d||0x1f4;return function(_0x5b3990){logger[_0x5497('0x1b')](_0x5b3990[_0x5497('0x34')]);if(_0x5b3990[_0x5497('0x35')]){delete _0x5b3990['name'];}_0x580e86['status'](_0x14314d)[_0x5497('0x36')](_0x5b3990);};}exports[_0x5497('0x37')]=function(_0x326d48,_0x429cbf){var _0x43d15f={},_0xc8a689={'count':0x0,'rows':[]};var _0x4f53c1=_(db[_0x5497('0x38')][_0x5497('0x39')])[_0x5497('0x2e')](function(_0x2bd07a){return{'name':_0x2bd07a[_0x5497('0x3a')],'type':_0x2bd07a[_0x5497('0x3b')][_0x5497('0x3c')]};})[_0x5497('0x2d')](function(_0x59627b){return!_['includes']([_0x5497('0x3d'),_0x5497('0x3e')],_0x59627b[_0x5497('0x35')]);})[_0x5497('0x2f')]();_0x43d15f=qs[_0x5497('0x3f')](_0x4f53c1,_0x326d48);var _0xa5ebe6={'where':_0x43d15f[_0x5497('0x40')]};return db['User'][_0x5497('0x26')](_0xa5ebe6)[_0x5497('0x15')](function(_0x2727a7){_0xc8a689[_0x5497('0x26')]=_0x2727a7;if(_0x326d48[_0x5497('0x41')][_0x5497('0x42')]){_0x43d15f[_0x5497('0x43')]=[{'all':!![]}];}if(!_['includes'](_0x43d15f[_0x5497('0x44')],'id')){_0x43d15f[_0x5497('0x44')][_0x5497('0x45')]('id');}return db[_0x5497('0x38')][_0x5497('0x46')](_0x43d15f);})[_0x5497('0x15')](function(_0xc1a999){_0xc8a689[_0x5497('0x47')]=_0xc1a999;if(_0x326d48[_0x5497('0x41')][_0x5497('0x48')]==='true'){var _0x2464a4=[];for(var _0x4a9fd7=0x0;_0x4a9fd7<_0xc8a689[_0x5497('0x47')][_0x5497('0x49')];_0x4a9fd7++){_0x2464a4[_0x5497('0x45')](get_open_tabs(_0x5497('0x4a'),_0xc8a689[_0x5497('0x47')][_0x4a9fd7]['dataValues']));_0x2464a4[_0x5497('0x45')](get_open_tabs(_0x5497('0x4b'),_0xc8a689['rows'][_0x4a9fd7][_0x5497('0x4c')]));_0x2464a4['push'](get_open_tabs(_0x5497('0x4d'),_0xc8a689['rows'][_0x4a9fd7][_0x5497('0x4c')]));_0x2464a4[_0x5497('0x45')](get_open_tabs(_0x5497('0x4e'),_0xc8a689[_0x5497('0x47')][_0x4a9fd7][_0x5497('0x4c')]));_0x2464a4['push'](get_open_tabs('openchannel',_0xc8a689['rows'][_0x4a9fd7]['dataValues']));_0x2464a4[_0x5497('0x45')](get_open_tabs(_0x5497('0x4f'),_0xc8a689[_0x5497('0x47')][_0x4a9fd7][_0x5497('0x4c')]));}return BPromise[_0x5497('0x50')](_0x2464a4)[_0x5497('0x15')](function(_0xc78abe){return _0xc8a689;});}else{return _0xc8a689;}})[_0x5497('0x15')](respondWithFilteredResult(_0x429cbf,_0x43d15f))[_0x5497('0x1f')](handleError(_0x429cbf,null));};exports['show']=function(_0x43ac49,_0x18db5b){var _0x1a9138={'raw':![],'where':{'id':_0x43ac49[_0x5497('0x51')]['id']}},_0x52a189={};_0x52a189['model']=_[_0x5497('0x52')](_[_0x5497('0x53')](db[_0x5497('0x38')]['rawAttributes']),[_0x5497('0x3d'),_0x5497('0x3e')]);_0x52a189['query']=_[_0x5497('0x53')](_0x43ac49['query']);_0x52a189[_0x5497('0x54')]=_['intersection'](_0x52a189[_0x5497('0x55')],_0x52a189[_0x5497('0x41')]);_0x1a9138[_0x5497('0x44')]=_[_0x5497('0x56')](_0x52a189[_0x5497('0x55')],qs[_0x5497('0x57')](_0x43ac49[_0x5497('0x41')][_0x5497('0x57')]));_0x1a9138['attributes']=_0x1a9138[_0x5497('0x44')]['length']?_0x1a9138['attributes']:_0x52a189[_0x5497('0x55')];if(_0x43ac49[_0x5497('0x41')]['includeAll']){_0x1a9138[_0x5497('0x43')]=[{'all':!![]}];}_0x1a9138=_[_0x5497('0x58')]({},_0x1a9138,_0x43ac49[_0x5497('0x59')]);if(!_[_0x5497('0x5a')](_0x1a9138['attributes'],'id')){_0x1a9138[_0x5497('0x44')]['push']('id');}return db['User'][_0x5497('0x31')](_0x1a9138)[_0x5497('0x15')](handleEntityNotFound(_0x18db5b,null))[_0x5497('0x15')](function(_0x49c85a){var _0x4b37d2=[];values=_0x49c85a;if(_0x43ac49[_0x5497('0x41')]['openTabs']===_0x5497('0x5b')){_0x4b37d2['push'](get_open_tabs(_0x5497('0x4a'),_0x49c85a['dataValues']));_0x4b37d2[_0x5497('0x45')](get_open_tabs(_0x5497('0x4b'),_0x49c85a['dataValues']));_0x4b37d2[_0x5497('0x45')](get_open_tabs('openchannel',_0x49c85a['dataValues']));_0x4b37d2[_0x5497('0x45')](get_open_tabs(_0x5497('0x4f'),_0x49c85a['dataValues']));_0x4b37d2[_0x5497('0x45')](get_open_tabs(_0x5497('0x4d'),_0x49c85a[_0x5497('0x4c')]));_0x4b37d2[_0x5497('0x45')](get_open_tabs(_0x5497('0x4e'),_0x49c85a[_0x5497('0x4c')]));return BPromise['all'](_0x4b37d2);}else{return values;}})[_0x5497('0x15')](function(_0x4916cd){return values;})['then'](respondWithResult(_0x18db5b,null))['catch'](handleError(_0x18db5b,null));};exports[_0x5497('0x27')]=function(_0x37e0b9,_0x23fd59){if(_0x37e0b9['body']['id']){delete _0x37e0b9[_0x5497('0x5c')]['id'];}delete _0x37e0b9['body']['role'];return db[_0x5497('0x38')][_0x5497('0x31')]({'where':{'id':_0x37e0b9[_0x5497('0x51')]['id']}})[_0x5497('0x15')](handleEntityNotFound(_0x23fd59,null))[_0x5497('0x15')](saveUpdates(_0x37e0b9[_0x5497('0x5c')],null))['then'](respondWithResult(_0x23fd59,null))[_0x5497('0x1f')](handleError(_0x23fd59,null));};exports[_0x5497('0x5d')]=function(_0x425995,_0xc783ce){return db['User'][_0x5497('0x5d')]()[_0x5497('0x15')](respondWithResult(_0xc783ce,null))[_0x5497('0x1f')](handleError(_0xc783ce,null));};exports[_0x5497('0x5e')]=function(_0x5823f6,_0x31271c){return db[_0x5497('0x38')][_0x5497('0x31')]({'where':{'id':_0x5823f6['params']['id']}})[_0x5497('0x15')](handleEntityNotFound(_0x31271c,null))['then'](function(_0x5b4e84){if(_0x5b4e84){return _0x5b4e84['addContacts'](_0x5823f6[_0x5497('0x5c')][_0x5497('0x5f')],_[_0x5497('0x60')](_0x5823f6['body'],[_0x5497('0x5f'),'id'])||{});}})[_0x5497('0x15')](respondWithResult(_0x31271c,null))[_0x5497('0x1f')](handleError(_0x31271c,null));};function validateUser(_0x35e75a){return new BPromise(function(_0x4fec68,_0x15f134){if(_0x35e75a[_0x5497('0x61')])return _0x4fec68(_0x35e75a);return db[_0x5497('0x62')]['findById'](0x1)[_0x5497('0x15')](function(_0x465bed){if(_0x465bed[_0x5497('0x63')])authService[_0x5497('0x64')](_0x35e75a[_0x5497('0x3d')]);db[_0x5497('0x38')][_0x5497('0x65')]('internal')[_0x5497('0x15')](function(_0x17186e){if(_[_0x5497('0x66')](_0x17186e)){_0x35e75a[_0x5497('0x61')]=_0x465bed['min_internal']||0x1;return;}if(_['isNil'](_0x465bed['min_internal'])||_0x465bed[_0x5497('0x67')]===_0x17186e){_0x35e75a[_0x5497('0x61')]=_0x17186e+0x1;return;}if(_0x465bed[_0x5497('0x67')]>_0x17186e){_0x35e75a['internal']=_0x465bed[_0x5497('0x67')];return;}return db[_0x5497('0x68')][_0x5497('0x41')](_0x5497('0x69'),{'type':db[_0x5497('0x68')][_0x5497('0x6a')][_0x5497('0x6b')]})[_0x5497('0x15')](function(_0x21da3d){if(_0x21da3d&&_0x21da3d[_0x5497('0x49')]){for(var _0x1fc6ad=0x0,_0x5a8b3a=_0x21da3d[_0x5497('0x49')];_0x1fc6ad<_0x5a8b3a&&_[_0x5497('0x66')](_0x35e75a[_0x5497('0x61')]);_0x1fc6ad++){if(_0x465bed['min_internal']<=_0x21da3d[_0x1fc6ad][_0x5497('0x6c')]){_0x35e75a['internal']=_0x21da3d[_0x1fc6ad][_0x5497('0x6c')];}else if(_0x465bed[_0x5497('0x67')]>_0x21da3d[_0x1fc6ad]['from']&&_0x465bed[_0x5497('0x67')]<=_0x21da3d[_0x1fc6ad]['to']){_0x35e75a[_0x5497('0x61')]=_0x465bed[_0x5497('0x67')];}}}if(_[_0x5497('0x66')](_0x35e75a['internal'])){_0x35e75a[_0x5497('0x61')]=_0x17186e+0x1;}return _0x4fec68(_0x35e75a);});});})[_0x5497('0x1f')](function(_0x5042c5){_0x15f134(_0x5042c5);});});}function updateUser(_0x530a44){return new BPromise(function(_0x53c450,_0x186165){try{if(_0x530a44['voicemail']){_0x530a44[_0x5497('0x6d')]=_0x530a44[_0x5497('0x61')];_0x530a44[_0x5497('0x6e')]={'mailbox':_0x530a44['internal'],'password':_0x530a44['password'],'fullname':_0x530a44[_0x5497('0x6f')],'email':_0x530a44[_0x5497('0x70')]};}if(_0x530a44[_0x5497('0x30')]===_0x5497('0x2b')){if(!_0x530a44[_0x5497('0x71')])_0x530a44[_0x5497('0x71')]=[_0x5497('0x72'),'102','103',_0x5497('0x73'),_0x5497('0x74'),'104',_0x5497('0x75'),_0x5497('0x76'),_0x5497('0x77'),'108',_0x5497('0x78'),_0x5497('0x79'),'111',_0x5497('0x7a'),_0x5497('0x7b')];}_0x53c450(_0x530a44);}catch(_0x9458d7){_0x186165(_0x9458d7);}});}exports[_0x5497('0x7c')]=function(_0x39b186,_0x552a29){if(_0x39b186[_0x5497('0x7d')][_0x5497('0x30')]===_0x5497('0x2b'))throw new Error(_0x5497('0x7e'));if(_0x39b186[_0x5497('0x5c')]['role']===_0x5497('0x7d')&&_0x39b186[_0x5497('0x7d')][_0x5497('0x30')]!==_0x5497('0x7f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x39b186[_0x5497('0x5c')][_0x5497('0x30')]==='admin'&&_0x39b186[_0x5497('0x7d')][_0x5497('0x30')]!==_0x5497('0x7f')){throw new Error(_0x5497('0x80'));}return licenseUtil['checkUserLimits']([_0x39b186['body']])['then'](function(){return validateUser(_0x39b186['body']);})['then'](function(_0x2d5543){return updateUser(_0x2d5543)[_0x5497('0x15')](function(_0x15d0da){if(_0x15d0da[_0x5497('0x30')]===_0x5497('0x7f')){_0x15d0da['settingsEnabled']=_0x39b186['user'][_0x5497('0x81')];delete _0x15d0da[_0x5497('0x82')];}return _0x15d0da;});})[_0x5497('0x15')](function(_0x2737a2){return db[_0x5497('0x38')][_0x5497('0x7c')](_0x2737a2,{'include':[{'model':db[_0x5497('0x6e')],'as':_0x5497('0x6e')}]});})[_0x5497('0x15')](function(_0x1bb9c1){if(_0x39b186['body'][_0x5497('0x30')]===_0x5497('0x7d'))return _0x1bb9c1;if(_0x39b186[_0x5497('0x7d')][_0x5497('0x30')]!==_0x5497('0x7d'))return _0x1bb9c1;return db[_0x5497('0x83')]['find']({'where':{'name':_0x1bb9c1[_0x5497('0x30')]==='agent'?_0x5497('0x2a'):_0x5497('0x2c'),'userProfileId':_0x39b186[_0x5497('0x7d')]['userProfileId']},'raw':!![]})['then'](function(_0xa6af36){if(!_0xa6af36||_0xa6af36[_0x5497('0x84')]!=0x0)return _0x1bb9c1;return db[_0x5497('0x32')][_0x5497('0x7c')]({'name':_0x1bb9c1[_0x5497('0x35')],'resourceId':_0x1bb9c1['id'],'type':_0xa6af36[_0x5497('0x35')],'sectionId':_0xa6af36['id']},{})[_0x5497('0x15')](function(){return _0x1bb9c1;});})[_0x5497('0x1f')](function(_0x5cf415){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cf415);throw _0x5cf415;});})[_0x5497('0x15')](respondWithResult(_0x552a29,0xc9))[_0x5497('0x1f')](handleError(_0x552a29,null));};exports[_0x5497('0x85')]=function(_0xc81d7d,_0x4c442f){var _0x5ba756=_0xc81d7d[_0x5497('0x5c')];var _0xf38193=[];if(_0xc81d7d['user'][_0x5497('0x30')]===_0x5497('0x2b'))throw new Error(_0x5497('0x7e'));if(_[_0x5497('0x86')](_0x5ba756,['role','user'])&&_0xc81d7d['user']['role']!=='admin'){throw new Error(_0x5497('0x87'));}if(_['some'](_0x5ba756,[_0x5497('0x30'),'admin'])&&_0xc81d7d[_0x5497('0x7d')][_0x5497('0x30')]!==_0x5497('0x7f')){throw new Error(_0x5497('0x88'));}return licenseUtil[_0x5497('0x89')](_0x5ba756)[_0x5497('0x15')](function(){return validateUser(_0x5ba756[0x0]);})['then'](function(){for(var _0x77d52c=0x1;_0x77d52c<_0x5ba756['length'];_0x77d52c++){var _0x15a67d=_0x5ba756[_0x77d52c-0x1][_0x5497('0x61')];if(!_0x5ba756[_0x77d52c][_0x5497('0x61')])_0x5ba756[_0x77d52c][_0x5497('0x61')]=_0x15a67d+0x1;_0xf38193[_0x5497('0x45')](validateUser(_0x5ba756[_0x77d52c]));}return BPromise[_0x5497('0x50')](_0xf38193);})[_0x5497('0x15')](function(){_0xf38193=[];for(var _0x21371b=0x0;_0x21371b<_0x5ba756[_0x5497('0x49')];_0x21371b++){_0xf38193[_0x5497('0x45')](updateUser(_0x5ba756[_0x21371b]));}return BPromise['all'](_0xf38193);})[_0x5497('0x15')](function(){return BPromise['each'](_0x5ba756,function(_0x41ec68){return db[_0x5497('0x38')]['create'](_0x41ec68,{'include':[{'model':db[_0x5497('0x6e')],'as':_0x5497('0x6e')}]})[_0x5497('0x15')](function(_0x16c6fb){_0x41ec68['id']=_0x16c6fb['id'];return _0x41ec68;});});})[_0x5497('0x15')](function(_0x4641ae){if(_0xc81d7d[_0x5497('0x5c')][_0x5497('0x30')]===_0x5497('0x7d'))return _0x4641ae;if(_0xc81d7d[_0x5497('0x7d')][_0x5497('0x30')]!==_0x5497('0x7d'))return _0x4641ae;var _0x38d9fe=_[_0x5497('0x86')](_0x4641ae,function(_0x5e047d){return _0x5e047d[_0x5497('0x30')]===_0x5497('0x2b')||_0x5e047d[_0x5497('0x30')]===_0x5497('0x8a');});if(!_0x38d9fe)return _0x4641ae;return db[_0x5497('0x83')]['findAll']({'where':{'name':{'$or':[_0x5497('0x2a'),_0x5497('0x2c')]},'userProfileId':_0xc81d7d['user']['userProfileId']},'raw':!![]})[_0x5497('0x15')](function(_0x208c64){if(_[_0x5497('0x8b')](_0x208c64)||!_[_0x5497('0x86')](_0x208c64,[_0x5497('0x84'),0x0]))return _0x4641ae;_0xf38193=[];var _0x585ad6=_(_0x208c64)['map'](function(_0x3344fe){if(_0x3344fe['autoAssociation']===0x1)return;return _0x3344fe[_0x5497('0x35')]===_0x5497('0x2a')?_0x5497('0x2b'):_0x5497('0x8a');})[_0x5497('0x8c')]()[_0x5497('0x2f')]();for(var _0x53acd4=0x0;_0x53acd4<_0x4641ae['length'];_0x53acd4++){if(!_[_0x5497('0x5a')](_0x585ad6,_0x4641ae[_0x53acd4][_0x5497('0x30')]))return;var _0x1fd971=_0x4641ae[_0x53acd4]['role']===_0x5497('0x2b')?'Agents':_0x5497('0x2c');_0xf38193['push'](db['UserProfileResource'][_0x5497('0x7c')]({'name':_0x4641ae[_0x53acd4][_0x5497('0x35')],'resourceId':_0x4641ae[_0x53acd4]['id'],'type':_0x1fd971,'sectionId':_['find'](_0x208c64,[_0x5497('0x35'),_0x1fd971])['id']},{}));}return BPromise[_0x5497('0x50')](_0xf38193);});})[_0x5497('0x15')](respondWithResult(_0x4c442f,0xc9))[_0x5497('0x1f')](handleError(_0x4c442f,null));};exports['changePassword']=function(_0x22a9bf,_0x26e1af){if(_0x22a9bf[_0x5497('0x5c')]['id']){delete _0x22a9bf[_0x5497('0x5c')]['id'];}return db[_0x5497('0x38')]['find']({'where':{'id':_0x22a9bf[_0x5497('0x51')]['id']}})['then'](function(_0x28aab8){if(!_0x28aab8)return null;if(_0x28aab8['id']===_0x22a9bf[_0x5497('0x7d')]['id']){if(!_0x22a9bf[_0x5497('0x5c')][_0x5497('0x8d')]||!_0x22a9bf[_0x5497('0x5c')][_0x5497('0x8e')]){throw new db[(_0x5497('0x8f'))][(_0x5497('0x90'))](_0x5497('0x91'));}if(!_0x28aab8[_0x5497('0x92')](_0x22a9bf[_0x5497('0x5c')]['oldPassword'])){throw new db[(_0x5497('0x8f'))][(_0x5497('0x90'))](_0x5497('0x93'));}if(_0x22a9bf[_0x5497('0x5c')][_0x5497('0x8d')]===_0x22a9bf[_0x5497('0x5c')][_0x5497('0x8e')]){throw new db[(_0x5497('0x8f'))][(_0x5497('0x90'))](_0x5497('0x94'));}}else if(_0x22a9bf[_0x5497('0x7d')]['role']===_0x5497('0x7f')){if(!_0x22a9bf[_0x5497('0x5c')][_0x5497('0x8e')]){throw new db[(_0x5497('0x8f'))][(_0x5497('0x90'))](_0x5497('0x95'));}}else if(_0x22a9bf[_0x5497('0x7d')][_0x5497('0x30')]===_0x5497('0x7d')){if(!_0x22a9bf[_0x5497('0x5c')][_0x5497('0x8e')]){throw new db[(_0x5497('0x8f'))][(_0x5497('0x90'))](_0x5497('0x95'));}if(_0x28aab8['role']!=='agent'){throw new db[(_0x5497('0x8f'))][(_0x5497('0x90'))](_0x5497('0x7e'));}}else{throw new db['Sequelize'][(_0x5497('0x90'))](_0x5497('0x7e'));}return _0x28aab8;})[_0x5497('0x15')](handleEntityNotFound(_0x26e1af,null))[_0x5497('0x15')](function(_0x3651ba){return db[_0x5497('0x62')][_0x5497('0x96')]({'attributes':['id',_0x5497('0x63'),'enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x1ce864){if(_0x1ce864[_0x5497('0x63')])authService['validatePasswordPattern'](_0x22a9bf[_0x5497('0x5c')][_0x5497('0x8e')]);if(!_0x1ce864[_0x5497('0x97')]||!_0x3651ba['previousPasswords'])return _0x3651ba;authService[_0x5497('0x98')](_0x22a9bf['body'][_0x5497('0x8e')],_0x3651ba[_0x5497('0x99')],_0x1ce864[_0x5497('0x9a')]);return _0x3651ba;})['then'](saveUpdates({'password':_0x22a9bf[_0x5497('0x5c')][_0x5497('0x8e')],'passwordResetAt':_0x22a9bf['user']['id']==_0x22a9bf[_0x5497('0x51')]['id']?moment():null,'previousPasswords':authService[_0x5497('0x9b')](_0x22a9bf[_0x5497('0x5c')]['newPassword'],_0x3651ba[_0x5497('0x99')])},null));})[_0x5497('0x15')](respondWithResult(_0x26e1af,null))[_0x5497('0x1f')](handleError(_0x26e1af,null));};exports[_0x5497('0x9c')]=function(_0x20a9ad,_0x2d69c1){var _0x1a87bf=_0x20a9ad[_0x5497('0x5c')][_0x5497('0x9d')];return db[_0x5497('0x38')][_0x5497('0x31')]({'where':{'id':_0x20a9ad[_0x5497('0x51')]['id']},'attributes':['id',_0x5497('0x35'),_0x5497('0x30'),_0x5497('0x9e'),'loginInPause',_0x5497('0x9f'),'interface']})[_0x5497('0x15')](handleEntityNotFound(_0x2d69c1,null))[_0x5497('0x15')](function(_0x59230a){if(_0x59230a){if(!utils['isValidChannel'](_0x1a87bf)){throw new db[(_0x5497('0x8f'))][(_0x5497('0x90'))](_0x5497('0xa0'));}return _0x59230a[_0x5497('0xa1')+_['capitalize'](_0x1a87bf[_0x5497('0xa2')]())+_0x5497('0xa3')](_0x20a9ad['body']['ids'],{'penalty':_0x20a9ad[_0x5497('0x5c')][_0x5497('0xa4')]||0x0})[_0x5497('0xa5')](function(_0x21df52){for(var _0xb95941=0x0;_0xb95941<_0x20a9ad['body']['ids'][_0x5497('0x49')];_0xb95941+=0x1){var _0x2314a1={'UserId':Number(_0x20a9ad['params']['id'])};_0x2314a1[_[_0x5497('0xa6')](_0x1a87bf[_0x5497('0xa2')]())+_0x5497('0xa7')]=Number(_0x20a9ad[_0x5497('0x5c')][_0x5497('0x5f')][_0xb95941]);socket[_0x5497('0xa8')](_0x5497('0x7d')+_[_0x5497('0xa6')](_0x1a87bf[_0x5497('0xa2')]())+'Queue:save',_0x2314a1);}return _0x21df52;})['then'](function(){if(_0x1a87bf===_0x5497('0xa9')){return db[_0x5497('0xaa')][_0x5497('0x46')]({'where':{'id':_0x20a9ad['body'][_0x5497('0x5f')]||[]},'raw':!![],'attributes':['id',_0x5497('0x35')]});}})[_0x5497('0x15')](function(_0x4844d3){var _0x1d4c76=_0x59230a[_0x5497('0x28')]({'plain':!![]});var _0x4c7c8a=[];if(_0x1a87bf==='voice'&&_0x1d4c76[_0x5497('0x30')]===_0x5497('0x2b')&&_0x1d4c76['online']){for(var _0x26b604=0x0;_0x26b604<_0x4844d3['length'];_0x26b604+=0x1){_0x4c7c8a[_0x5497('0x45')]({'membername':_0x1d4c76[_0x5497('0x35')],'UserId':_0x1d4c76['id'],'queue_name':_0x4844d3[_0x26b604][_0x5497('0x35')],'VoiceQueueId':_0x4844d3[_0x26b604]['id'],'interface':_[_0x5497('0x66')](_0x1d4c76[_0x5497('0xab')])?util[_0x5497('0xac')](_0x5497('0xad'),_0x1d4c76['name']):_0x1d4c76['interface'],'paused':_0x1d4c76[_0x5497('0x9f')]||![],'penalty':_0x20a9ad[_0x5497('0x5c')]['penalty']||0x0});}return BPromise['each'](_0x4c7c8a,function(_0x45725a){return db[_0x5497('0xae')][_0x5497('0xaf')](_0x45725a);});}return _0x59230a;});}})[_0x5497('0x15')](respondWithStatusCode(_0x2d69c1,null))[_0x5497('0x1f')](handleError(_0x2d69c1,null));};exports[_0x5497('0xb0')]=function(_0x5f08c6,_0xdbfff4){var _0x1c897e;return db[_0x5497('0x38')][_0x5497('0x31')]({'where':{'id':_0x5f08c6[_0x5497('0x51')]['id']},'attributes':['id',_0x5497('0x35'),'role']})[_0x5497('0x15')](handleEntityNotFound(_0xdbfff4,null))['then'](function(_0x2d0d8d){if(_0x2d0d8d){_0x1c897e=_0x2d0d8d;if(!_0x5f08c6[_0x5497('0x41')][_0x5497('0x9d')]||!utils['isValidChannel'](_0x5f08c6[_0x5497('0x41')]['channel'])){throw new db['Sequelize'][(_0x5497('0x90'))](_0x5497('0xa0'));}return _0x2d0d8d['remove'+_[_0x5497('0xa6')](_0x5f08c6[_0x5497('0x41')][_0x5497('0x9d')][_0x5497('0xa2')]())+_0x5497('0xa3')](_0x5f08c6[_0x5497('0x41')][_0x5497('0x5f')]);}})[_0x5497('0x15')](function(_0x2556e4){if(_['isArray'](_0x5f08c6[_0x5497('0x41')][_0x5497('0x5f')])){for(var _0xa3246f=0x0;_0xa3246f<_0x5f08c6[_0x5497('0x41')][_0x5497('0x5f')][_0x5497('0x49')];_0xa3246f+=0x1){var _0x50e63a={'UserId':Number(_0x5f08c6[_0x5497('0x51')]['id'])};_0x50e63a[_[_0x5497('0xa6')](_0x5f08c6[_0x5497('0x41')][_0x5497('0x9d')][_0x5497('0xa2')]())+_0x5497('0xa7')]=Number(_0x5f08c6[_0x5497('0x41')][_0x5497('0x5f')][_0xa3246f]);socket[_0x5497('0xa8')](_0x5497('0x7d')+_[_0x5497('0xa6')](_0x5f08c6[_0x5497('0x41')]['channel'][_0x5497('0xa2')]())+_0x5497('0xb1'),_0x50e63a);}}else{var _0x50e63a={'UserId':Number(_0x5f08c6['params']['id'])};_0x50e63a[_[_0x5497('0xa6')](_0x5f08c6['query'][_0x5497('0x9d')][_0x5497('0xa2')]())+_0x5497('0xa7')]=Number(_0x5f08c6[_0x5497('0x41')][_0x5497('0x5f')]);socket[_0x5497('0xa8')](_0x5497('0x7d')+_[_0x5497('0xa6')](_0x5f08c6[_0x5497('0x41')][_0x5497('0x9d')][_0x5497('0xa2')]())+'Queue:remove',_0x50e63a);}return _0x2556e4;})[_0x5497('0x15')](function(){if(_0x5f08c6['query'][_0x5497('0x9d')]===_0x5497('0xa9')){return db[_0x5497('0xae')][_0x5497('0x33')]({'where':{'UserId':_0x5f08c6[_0x5497('0x51')]['id'],'VoiceQueueId':_0x5f08c6[_0x5497('0x41')][_0x5497('0x5f')]},'individualHooks':!![]})[_0x5497('0x15')](function(){return _0x1c897e;});}return _0x1c897e;})['then'](respondWithStatusCode(_0xdbfff4,null))['catch'](handleError(_0xdbfff4,null));};exports[_0x5497('0xb2')]=function(_0x6329d1,_0x3c168f){_0x6329d1[_0x5497('0x5c')][_0x5497('0xb3')]=_0x6329d1['file'][_0x5497('0xb4')];return db['User']['find']({'where':{'id':_0x6329d1['params']['id']}})['then'](handleEntityNotFound(_0x3c168f,null))[_0x5497('0x15')](saveUpdates(_0x6329d1['body'],null))['then'](respondWithResult(_0x3c168f,null))[_0x5497('0x1f')](handleError(_0x3c168f,null));};exports[_0x5497('0xb5')]=function(_0x1e030c,_0x15a2d9){var _0x48ba73=path[_0x5497('0xb6')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x5497('0x38')]['find']({'where':{'id':_0x1e030c[_0x5497('0x51')]['id']},'attributes':['id',_0x5497('0xb3')],'raw':!![]})[_0x5497('0x15')](handleEntityNotFound(_0x15a2d9,null))['then'](function(_0x29292e){if(_0x29292e){if(_['isNil'](_0x29292e[_0x5497('0xb3')])){return _0x15a2d9[_0x5497('0xb7')](_0x48ba73);}else{if(!fs[_0x5497('0xb8')](path[_0x5497('0xb6')](config[_0x5497('0xb9')],_0x5497('0xba'),_0x29292e[_0x5497('0xb3')]))){return _0x15a2d9[_0x5497('0xb7')](_0x48ba73);}return _0x15a2d9[_0x5497('0xb7')](path['join'](config[_0x5497('0xb9')],_0x5497('0xba'),_0x29292e[_0x5497('0xb3')]));}}})['catch'](handleError(_0x15a2d9,null));};exports[_0x5497('0xbb')]=function(_0x42aa2e,_0x2e3fb2){return db[_0x5497('0x38')][_0x5497('0x31')]({'where':{'id':_0x42aa2e['params']['id']},'attributes':['id']})[_0x5497('0x15')](handleEntityNotFound(_0x2e3fb2,null))[_0x5497('0x15')](function(_0x335a7a){var _0x35dbe8=[];values=_0x335a7a['dataValues'];_0x35dbe8[_0x5497('0x45')](get_open_tabs(_0x5497('0x4a'),_0x335a7a[_0x5497('0x4c')]));_0x35dbe8[_0x5497('0x45')](get_open_tabs(_0x5497('0x4b'),_0x335a7a[_0x5497('0x4c')]));_0x35dbe8[_0x5497('0x45')](get_open_tabs('openchannel',_0x335a7a[_0x5497('0x4c')]));_0x35dbe8['push'](get_open_tabs(_0x5497('0x4f'),_0x335a7a[_0x5497('0x4c')]));_0x35dbe8['push'](get_open_tabs('fax',_0x335a7a['dataValues']));_0x35dbe8[_0x5497('0x45')](get_open_tabs(_0x5497('0x4e'),_0x335a7a[_0x5497('0x4c')]));return BPromise[_0x5497('0x50')](_0x35dbe8);})['then'](function(_0x2bc1c1){var _0x3653c7=[];if(_0x2bc1c1){for(var _0x390c46=0x0;_0x390c46=_0x117510){_0x41b7a2=_0x117510;_0x2730b0=0xc8;}else{_0x2730b0=0xce;}_0x2eef74['status'](_0x2730b0);return _0x2eef74[_0x0fcf('0x23')](_0x0fcf('0x24'),_0x18965e+'-'+_0x41b7a2+'/'+_0x117510)[_0x0fcf('0x25')](_0x6021b4);}return null;};}function saveUpdates(_0x35180d){return function(_0x49fd0e){if(_0x49fd0e){return _0x49fd0e['update'](_0x35180d)['then'](function(_0x428194){return _0x428194;});}return null;};}function removeEntity(_0x50b7df){return function(_0x26c3bc){if(_0x26c3bc){return _0x26c3bc[_0x0fcf('0x26')]()['then'](function(){var _0xdfd3ec=_0x26c3bc[_0x0fcf('0x27')]({'plain':!![]});if(_0xdfd3ec[_0x0fcf('0x28')]===_0x0fcf('0x29'))return;var _0xc58b86=[{'name':_0x0fcf('0x2a'),'value':'user','ignore':!![]},{'name':_0x0fcf('0x2b'),'value':_0x0fcf('0x2c'),'ignore':![]},{'name':_0x0fcf('0x2d'),'value':_0x0fcf('0x2e'),'ignore':![]}];var _0x19488a=_(_0xc58b86)[_0x0fcf('0x2f')]('ignore')[_0x0fcf('0x30')](_0x0fcf('0x31'))[_0x0fcf('0x31')]();if(_[_0x0fcf('0x32')](_0x19488a,_0xdfd3ec[_0x0fcf('0x28')])){return;}var _0x477c71=_[_0x0fcf('0x33')](_0xc58b86,[_0x0fcf('0x31'),_0xdfd3ec[_0x0fcf('0x28')]])[_0x0fcf('0x34')];return db[_0x0fcf('0x35')][_0x0fcf('0x26')]({'where':{'type':_0x477c71,'resourceId':_0xdfd3ec['id']}})[_0x0fcf('0x36')](function(){return _0x26c3bc;});})[_0x0fcf('0x36')](function(){_0x50b7df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40101a){return function(_0x4ccbdf){if(!_0x4ccbdf){_0x40101a['sendStatus'](0x194);}return _0x4ccbdf;};}function handleError(_0x1a1e07,_0x254d6a){_0x254d6a=_0x254d6a||0x1f4;return function(_0x3721ab){logger['error'](_0x3721ab['stack']);if(_0x3721ab[_0x0fcf('0x34')]){delete _0x3721ab[_0x0fcf('0x34')];}_0x1a1e07[_0x0fcf('0x1d')](_0x254d6a)['send'](_0x3721ab);};}exports[_0x0fcf('0x37')]=function(_0x1d2f3b,_0x29067e){var _0x4e139d={},_0x4c75e6={'count':0x0,'rows':[]};var _0x536d21=_(db[_0x0fcf('0x38')][_0x0fcf('0x39')])[_0x0fcf('0x30')](function(_0x3ae8fa){return{'name':_0x3ae8fa[_0x0fcf('0x3a')],'type':_0x3ae8fa['type'][_0x0fcf('0x3b')]};})[_0x0fcf('0x2f')](function(_0xb4087){return!_['includes'](['password',_0x0fcf('0x3c')],_0xb4087[_0x0fcf('0x34')]);})[_0x0fcf('0x31')]();_0x4e139d=qs[_0x0fcf('0x3d')](_0x536d21,_0x1d2f3b);var _0x43e0f9={'where':_0x4e139d['where']};return db[_0x0fcf('0x38')][_0x0fcf('0x22')](_0x43e0f9)[_0x0fcf('0x36')](function(_0x11134c){_0x4c75e6['count']=_0x11134c;if(_0x1d2f3b['query'][_0x0fcf('0x3e')]){_0x4e139d[_0x0fcf('0x3f')]=[{'all':!![]}];}if(!_['includes'](_0x4e139d[_0x0fcf('0x40')],'id')){_0x4e139d[_0x0fcf('0x40')]['push']('id');}return db[_0x0fcf('0x38')][_0x0fcf('0x41')](_0x4e139d);})[_0x0fcf('0x36')](function(_0x1f322b){_0x4c75e6[_0x0fcf('0x42')]=_0x1f322b;if(_0x1d2f3b['query'][_0x0fcf('0x43')]===_0x0fcf('0x44')){var _0x5994af=[];for(var _0x48b3f1=0x0;_0x48b3f1<_0x4c75e6[_0x0fcf('0x42')]['length'];_0x48b3f1++){_0x5994af['push'](get_open_tabs(_0x0fcf('0x45'),_0x4c75e6[_0x0fcf('0x42')][_0x48b3f1][_0x0fcf('0x46')]));_0x5994af[_0x0fcf('0x47')](get_open_tabs(_0x0fcf('0x48'),_0x4c75e6[_0x0fcf('0x42')][_0x48b3f1][_0x0fcf('0x46')]));_0x5994af[_0x0fcf('0x47')](get_open_tabs(_0x0fcf('0x49'),_0x4c75e6[_0x0fcf('0x42')][_0x48b3f1]['dataValues']));_0x5994af[_0x0fcf('0x47')](get_open_tabs(_0x0fcf('0x4a'),_0x4c75e6[_0x0fcf('0x42')][_0x48b3f1]['dataValues']));_0x5994af['push'](get_open_tabs(_0x0fcf('0x4b'),_0x4c75e6[_0x0fcf('0x42')][_0x48b3f1][_0x0fcf('0x46')]));_0x5994af[_0x0fcf('0x47')](get_open_tabs('whatsapp',_0x4c75e6['rows'][_0x48b3f1][_0x0fcf('0x46')]));}return BPromise[_0x0fcf('0x4c')](_0x5994af)[_0x0fcf('0x36')](function(_0x1fb83d){return _0x4c75e6;});}else{return _0x4c75e6;}})[_0x0fcf('0x36')](respondWithFilteredResult(_0x29067e,_0x4e139d))[_0x0fcf('0x4d')](handleError(_0x29067e,null));};exports[_0x0fcf('0x4e')]=function(_0xc7ae,_0x4c4f56){var _0x5a0ced={'raw':![],'where':{'id':_0xc7ae[_0x0fcf('0x4f')]['id']}},_0x259c91={};_0x259c91[_0x0fcf('0x50')]=_[_0x0fcf('0x51')](_[_0x0fcf('0x52')](db[_0x0fcf('0x38')]['rawAttributes']),[_0x0fcf('0x53'),_0x0fcf('0x3c')]);_0x259c91['query']=_[_0x0fcf('0x52')](_0xc7ae[_0x0fcf('0x54')]);_0x259c91[_0x0fcf('0x55')]=_[_0x0fcf('0x56')](_0x259c91['model'],_0x259c91[_0x0fcf('0x54')]);_0x5a0ced[_0x0fcf('0x40')]=_[_0x0fcf('0x56')](_0x259c91[_0x0fcf('0x50')],qs[_0x0fcf('0x57')](_0xc7ae[_0x0fcf('0x54')][_0x0fcf('0x57')]));_0x5a0ced[_0x0fcf('0x40')]=_0x5a0ced[_0x0fcf('0x40')][_0x0fcf('0x58')]?_0x5a0ced[_0x0fcf('0x40')]:_0x259c91[_0x0fcf('0x50')];if(_0xc7ae[_0x0fcf('0x54')][_0x0fcf('0x3e')]){_0x5a0ced['include']=[{'all':!![]}];}_0x5a0ced=_[_0x0fcf('0x59')]({},_0x5a0ced,_0xc7ae['options']);if(!_[_0x0fcf('0x32')](_0x5a0ced[_0x0fcf('0x40')],'id')){_0x5a0ced[_0x0fcf('0x40')][_0x0fcf('0x47')]('id');}return db[_0x0fcf('0x38')]['find'](_0x5a0ced)[_0x0fcf('0x36')](handleEntityNotFound(_0x4c4f56,null))['then'](function(_0x48b60a){var _0x2de3ef=[];values=_0x48b60a;if(_0xc7ae['query'][_0x0fcf('0x43')]===_0x0fcf('0x44')){_0x2de3ef['push'](get_open_tabs(_0x0fcf('0x45'),_0x48b60a[_0x0fcf('0x46')]));_0x2de3ef[_0x0fcf('0x47')](get_open_tabs(_0x0fcf('0x48'),_0x48b60a[_0x0fcf('0x46')]));_0x2de3ef['push'](get_open_tabs('openchannel',_0x48b60a[_0x0fcf('0x46')]));_0x2de3ef['push'](get_open_tabs(_0x0fcf('0x5a'),_0x48b60a[_0x0fcf('0x46')]));_0x2de3ef['push'](get_open_tabs('fax',_0x48b60a[_0x0fcf('0x46')]));_0x2de3ef[_0x0fcf('0x47')](get_open_tabs(_0x0fcf('0x4a'),_0x48b60a['dataValues']));return BPromise[_0x0fcf('0x4c')](_0x2de3ef);}else{return values;}})['then'](function(_0x2ed8d8){return values;})[_0x0fcf('0x36')](respondWithResult(_0x4c4f56,null))[_0x0fcf('0x4d')](handleError(_0x4c4f56,null));};exports['update']=function(_0x1362d7,_0x29c0b8){if(_0x1362d7[_0x0fcf('0x5b')]['id']){delete _0x1362d7[_0x0fcf('0x5b')]['id'];}delete _0x1362d7[_0x0fcf('0x5b')][_0x0fcf('0x28')];return db[_0x0fcf('0x38')][_0x0fcf('0x33')]({'where':{'id':_0x1362d7[_0x0fcf('0x4f')]['id']}})[_0x0fcf('0x36')](handleEntityNotFound(_0x29c0b8,null))[_0x0fcf('0x36')](saveUpdates(_0x1362d7['body'],null))[_0x0fcf('0x36')](respondWithResult(_0x29c0b8,null))[_0x0fcf('0x4d')](handleError(_0x29c0b8,null));};exports[_0x0fcf('0x5c')]=function(_0x13b5c5,_0xa42e82){return db[_0x0fcf('0x38')][_0x0fcf('0x5c')]()['then'](respondWithResult(_0xa42e82,null))['catch'](handleError(_0xa42e82,null));};exports[_0x0fcf('0x5d')]=function(_0x38c2e0,_0x58607c){return db[_0x0fcf('0x38')][_0x0fcf('0x33')]({'where':{'id':_0x38c2e0[_0x0fcf('0x4f')]['id']}})[_0x0fcf('0x36')](handleEntityNotFound(_0x58607c,null))['then'](function(_0x540859){if(_0x540859){return _0x540859[_0x0fcf('0x5d')](_0x38c2e0[_0x0fcf('0x5b')][_0x0fcf('0x5e')],_[_0x0fcf('0x5f')](_0x38c2e0[_0x0fcf('0x5b')],['ids','id'])||{});}})[_0x0fcf('0x36')](respondWithResult(_0x58607c,null))[_0x0fcf('0x4d')](handleError(_0x58607c,null));};function validateUser(_0xa634f3){return new BPromise(function(_0x3f3ad8,_0x1974e2){if(_0xa634f3['internal'])return _0x3f3ad8(_0xa634f3);return db['Setting'][_0x0fcf('0x60')](0x1)[_0x0fcf('0x36')](function(_0x8c2777){if(_0x8c2777[_0x0fcf('0x61')])authService[_0x0fcf('0x62')](_0xa634f3[_0x0fcf('0x53')]);db[_0x0fcf('0x38')][_0x0fcf('0x63')](_0x0fcf('0x64'))[_0x0fcf('0x36')](function(_0x5d54f0){if(_[_0x0fcf('0x65')](_0x5d54f0)){_0xa634f3[_0x0fcf('0x64')]=_0x8c2777[_0x0fcf('0x66')]||0x1;return;}if(_[_0x0fcf('0x65')](_0x8c2777[_0x0fcf('0x66')])||_0x8c2777[_0x0fcf('0x66')]===_0x5d54f0){_0xa634f3[_0x0fcf('0x64')]=_0x5d54f0+0x1;return;}if(_0x8c2777[_0x0fcf('0x66')]>_0x5d54f0){_0xa634f3[_0x0fcf('0x64')]=_0x8c2777['min_internal'];return;}return db['sequelize']['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x0fcf('0x67')]['QueryTypes'][_0x0fcf('0x68')]})[_0x0fcf('0x36')](function(_0x3da414){if(_0x3da414&&_0x3da414['length']){for(var _0x5ab5c6=0x0,_0x44eaac=_0x3da414[_0x0fcf('0x58')];_0x5ab5c6<_0x44eaac&&_['isNil'](_0xa634f3[_0x0fcf('0x64')]);_0x5ab5c6++){if(_0x8c2777[_0x0fcf('0x66')]<=_0x3da414[_0x5ab5c6]['from']){_0xa634f3[_0x0fcf('0x64')]=_0x3da414[_0x5ab5c6][_0x0fcf('0x69')];}else if(_0x8c2777[_0x0fcf('0x66')]>_0x3da414[_0x5ab5c6][_0x0fcf('0x69')]&&_0x8c2777[_0x0fcf('0x66')]<=_0x3da414[_0x5ab5c6]['to']){_0xa634f3[_0x0fcf('0x64')]=_0x8c2777[_0x0fcf('0x66')];}}}if(_['isNil'](_0xa634f3[_0x0fcf('0x64')])){_0xa634f3[_0x0fcf('0x64')]=_0x5d54f0+0x1;}return _0x3f3ad8(_0xa634f3);});});})[_0x0fcf('0x4d')](function(_0x41fcac){_0x1974e2(_0x41fcac);});});}function updateUser(_0x294504){return new BPromise(function(_0x31f658,_0x498d14){try{if(_0x294504['voicemail']){_0x294504[_0x0fcf('0x6a')]=_0x294504[_0x0fcf('0x64')];_0x294504[_0x0fcf('0x6b')]={'mailbox':_0x294504[_0x0fcf('0x64')],'password':_0x294504['password'],'fullname':_0x294504[_0x0fcf('0x6c')],'email':_0x294504[_0x0fcf('0x6d')]};}if(_0x294504[_0x0fcf('0x28')]===_0x0fcf('0x2c')){if(!_0x294504[_0x0fcf('0x6e')])_0x294504['permissions']=['101',_0x0fcf('0x6f'),'103',_0x0fcf('0x70'),'110',_0x0fcf('0x71'),_0x0fcf('0x72'),_0x0fcf('0x73'),_0x0fcf('0x74'),_0x0fcf('0x75'),'109',_0x0fcf('0x76'),_0x0fcf('0x77'),_0x0fcf('0x78'),_0x0fcf('0x79')];}_0x31f658(_0x294504);}catch(_0x4c7555){_0x498d14(_0x4c7555);}});}exports[_0x0fcf('0x7a')]=function(_0x5ba384,_0x2a6084){if(_0x5ba384['user'][_0x0fcf('0x28')]===_0x0fcf('0x2c'))throw new Error('Unauthorized');if(_0x5ba384[_0x0fcf('0x5b')][_0x0fcf('0x28')]===_0x0fcf('0x7b')&&_0x5ba384['user']['role']!=='admin'){throw new Error(_0x0fcf('0x7c'));}if(_0x5ba384['body'][_0x0fcf('0x28')]===_0x0fcf('0x29')&&_0x5ba384[_0x0fcf('0x7b')][_0x0fcf('0x28')]!==_0x0fcf('0x29')){throw new Error(_0x0fcf('0x7d'));}return licenseUtil[_0x0fcf('0x7e')]([_0x5ba384[_0x0fcf('0x5b')]])[_0x0fcf('0x36')](function(){return validateUser(_0x5ba384['body']);})[_0x0fcf('0x36')](function(_0x231563){return updateUser(_0x231563)[_0x0fcf('0x36')](function(_0x20cd3f){if(_0x20cd3f[_0x0fcf('0x28')]===_0x0fcf('0x29')){_0x20cd3f[_0x0fcf('0x7f')]=_0x5ba384[_0x0fcf('0x7b')]['settingsEnabled'];delete _0x20cd3f[_0x0fcf('0x80')];}return _0x20cd3f;});})[_0x0fcf('0x36')](function(_0x1da8dd){return db[_0x0fcf('0x38')][_0x0fcf('0x7a')](_0x1da8dd,{'include':[{'model':db[_0x0fcf('0x6b')],'as':_0x0fcf('0x6b')}]});})['then'](function(_0x2d9214){if(_0x5ba384['body'][_0x0fcf('0x28')]===_0x0fcf('0x7b'))return _0x2d9214;if(_0x5ba384[_0x0fcf('0x7b')]['role']!=='user')return _0x2d9214;return db['UserProfileSection']['find']({'where':{'name':_0x2d9214[_0x0fcf('0x28')]===_0x0fcf('0x2c')?_0x0fcf('0x2b'):_0x0fcf('0x2d'),'userProfileId':_0x5ba384[_0x0fcf('0x7b')][_0x0fcf('0x80')]},'raw':!![]})[_0x0fcf('0x36')](function(_0x3490eb){if(!_0x3490eb||_0x3490eb[_0x0fcf('0x81')]!=0x0)return _0x2d9214;return db[_0x0fcf('0x35')][_0x0fcf('0x7a')]({'name':_0x2d9214['name'],'resourceId':_0x2d9214['id'],'type':_0x3490eb[_0x0fcf('0x34')],'sectionId':_0x3490eb['id']},{})[_0x0fcf('0x36')](function(){return _0x2d9214;});})['catch'](function(_0x2af8de){logger['error'](_0x0fcf('0x82'),_0x2af8de);throw _0x2af8de;});})[_0x0fcf('0x36')](respondWithResult(_0x2a6084,0xc9))['catch'](handleError(_0x2a6084,null));};exports['bulkCreate']=function(_0x36d4e5,_0x3785b4){var _0x4a6adc=_0x36d4e5[_0x0fcf('0x5b')];var _0x3cf7b7=[];if(_0x36d4e5[_0x0fcf('0x7b')][_0x0fcf('0x28')]===_0x0fcf('0x2c'))throw new Error(_0x0fcf('0x83'));if(_[_0x0fcf('0x84')](_0x4a6adc,[_0x0fcf('0x28'),'user'])&&_0x36d4e5[_0x0fcf('0x7b')][_0x0fcf('0x28')]!==_0x0fcf('0x29')){throw new Error(_0x0fcf('0x7c'));}if(_['some'](_0x4a6adc,[_0x0fcf('0x28'),'admin'])&&_0x36d4e5['user']['role']!==_0x0fcf('0x29')){throw new Error(_0x0fcf('0x85'));}return licenseUtil[_0x0fcf('0x7e')](_0x4a6adc)[_0x0fcf('0x36')](function(){return validateUser(_0x4a6adc[0x0]);})[_0x0fcf('0x36')](function(){for(var _0x777b71=0x1;_0x777b71<_0x4a6adc[_0x0fcf('0x58')];_0x777b71++){var _0x31b008=_0x4a6adc[_0x777b71-0x1][_0x0fcf('0x64')];if(!_0x4a6adc[_0x777b71]['internal'])_0x4a6adc[_0x777b71][_0x0fcf('0x64')]=_0x31b008+0x1;_0x3cf7b7[_0x0fcf('0x47')](validateUser(_0x4a6adc[_0x777b71]));}return BPromise[_0x0fcf('0x4c')](_0x3cf7b7);})[_0x0fcf('0x36')](function(){_0x3cf7b7=[];for(var _0x1d83bb=0x0;_0x1d83bb<_0x4a6adc[_0x0fcf('0x58')];_0x1d83bb++){_0x3cf7b7[_0x0fcf('0x47')](updateUser(_0x4a6adc[_0x1d83bb]));}return BPromise[_0x0fcf('0x4c')](_0x3cf7b7);})[_0x0fcf('0x36')](function(){return BPromise['each'](_0x4a6adc,function(_0x56e098){return db['User'][_0x0fcf('0x7a')](_0x56e098,{'include':[{'model':db[_0x0fcf('0x6b')],'as':_0x0fcf('0x6b')}]})[_0x0fcf('0x36')](function(_0x52e2e6){_0x56e098['id']=_0x52e2e6['id'];return _0x56e098;});});})['then'](function(_0x5c7fd7){if(_0x36d4e5[_0x0fcf('0x5b')]['role']===_0x0fcf('0x7b'))return _0x5c7fd7;if(_0x36d4e5['user'][_0x0fcf('0x28')]!=='user')return _0x5c7fd7;var _0x30edd0=_['some'](_0x5c7fd7,function(_0x4f729f){return _0x4f729f[_0x0fcf('0x28')]==='agent'||_0x4f729f[_0x0fcf('0x28')]===_0x0fcf('0x2e');});if(!_0x30edd0)return _0x5c7fd7;return db[_0x0fcf('0x86')][_0x0fcf('0x41')]({'where':{'name':{'$or':[_0x0fcf('0x2b'),_0x0fcf('0x2d')]},'userProfileId':_0x36d4e5[_0x0fcf('0x7b')][_0x0fcf('0x80')]},'raw':!![]})[_0x0fcf('0x36')](function(_0x1ad06d){if(_[_0x0fcf('0x87')](_0x1ad06d)||!_[_0x0fcf('0x84')](_0x1ad06d,[_0x0fcf('0x81'),0x0]))return _0x5c7fd7;_0x3cf7b7=[];var _0x57a1c0=_(_0x1ad06d)[_0x0fcf('0x30')](function(_0x3bc4a5){if(_0x3bc4a5[_0x0fcf('0x81')]===0x1)return;return _0x3bc4a5[_0x0fcf('0x34')]===_0x0fcf('0x2b')?_0x0fcf('0x2c'):_0x0fcf('0x2e');})[_0x0fcf('0x88')]()[_0x0fcf('0x31')]();for(var _0x50a5bb=0x0;_0x50a5bb<_0x5c7fd7[_0x0fcf('0x58')];_0x50a5bb++){if(!_[_0x0fcf('0x32')](_0x57a1c0,_0x5c7fd7[_0x50a5bb][_0x0fcf('0x28')]))return;var _0x319770=_0x5c7fd7[_0x50a5bb][_0x0fcf('0x28')]===_0x0fcf('0x2c')?_0x0fcf('0x2b'):_0x0fcf('0x2d');_0x3cf7b7[_0x0fcf('0x47')](db[_0x0fcf('0x35')][_0x0fcf('0x7a')]({'name':_0x5c7fd7[_0x50a5bb][_0x0fcf('0x34')],'resourceId':_0x5c7fd7[_0x50a5bb]['id'],'type':_0x319770,'sectionId':_[_0x0fcf('0x33')](_0x1ad06d,['name',_0x319770])['id']},{}));}return BPromise[_0x0fcf('0x4c')](_0x3cf7b7);});})[_0x0fcf('0x36')](respondWithResult(_0x3785b4,0xc9))['catch'](handleError(_0x3785b4,null));};exports[_0x0fcf('0x89')]=function(_0x39b86f,_0x2b087b){if(_0x39b86f[_0x0fcf('0x5b')]['id']){delete _0x39b86f[_0x0fcf('0x5b')]['id'];}return db['User']['find']({'where':{'id':_0x39b86f['params']['id']}})[_0x0fcf('0x36')](function(_0x4b0216){if(!_0x4b0216)return null;if(_0x4b0216['id']===_0x39b86f[_0x0fcf('0x7b')]['id']){if(!_0x39b86f[_0x0fcf('0x5b')]['oldPassword']||!_0x39b86f[_0x0fcf('0x5b')][_0x0fcf('0x8a')]){throw new db[(_0x0fcf('0x8b'))][(_0x0fcf('0x8c'))](_0x0fcf('0x8d'));}if(!_0x4b0216[_0x0fcf('0x8e')](_0x39b86f[_0x0fcf('0x5b')][_0x0fcf('0x8f')])){throw new db[(_0x0fcf('0x8b'))]['ValidationError'](_0x0fcf('0x90'));}if(_0x39b86f[_0x0fcf('0x5b')][_0x0fcf('0x8f')]===_0x39b86f['body'][_0x0fcf('0x8a')]){throw new db[(_0x0fcf('0x8b'))][(_0x0fcf('0x8c'))](_0x0fcf('0x91'));}}else if(_0x39b86f[_0x0fcf('0x7b')][_0x0fcf('0x28')]===_0x0fcf('0x29')){if(!_0x39b86f['body'][_0x0fcf('0x8a')]){throw new db[(_0x0fcf('0x8b'))][(_0x0fcf('0x8c'))](_0x0fcf('0x92'));}}else if(_0x39b86f['user'][_0x0fcf('0x28')]==='user'){if(!_0x39b86f[_0x0fcf('0x5b')][_0x0fcf('0x8a')]){throw new db['Sequelize']['ValidationError'](_0x0fcf('0x92'));}if(_0x4b0216[_0x0fcf('0x28')]!==_0x0fcf('0x2c')){throw new db[(_0x0fcf('0x8b'))][(_0x0fcf('0x8c'))](_0x0fcf('0x83'));}}else{throw new db[(_0x0fcf('0x8b'))][(_0x0fcf('0x8c'))](_0x0fcf('0x83'));}return _0x4b0216;})[_0x0fcf('0x36')](handleEntityNotFound(_0x2b087b,null))['then'](function(_0x144354){return db['Setting']['findOne']({'attributes':['id',_0x0fcf('0x61'),'enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x22c9d9){if(_0x22c9d9[_0x0fcf('0x61')])authService[_0x0fcf('0x62')](_0x39b86f[_0x0fcf('0x5b')][_0x0fcf('0x8a')]);if(!_0x22c9d9[_0x0fcf('0x93')]||!_0x144354[_0x0fcf('0x94')])return _0x144354;authService[_0x0fcf('0x95')](_0x39b86f[_0x0fcf('0x5b')]['newPassword'],_0x144354[_0x0fcf('0x94')],_0x22c9d9[_0x0fcf('0x96')]);return _0x144354;})[_0x0fcf('0x36')](saveUpdates({'password':_0x39b86f[_0x0fcf('0x5b')][_0x0fcf('0x8a')],'passwordResetAt':_0x39b86f[_0x0fcf('0x7b')]['id']==_0x39b86f['params']['id']?moment():null,'previousPasswords':authService[_0x0fcf('0x97')](_0x39b86f[_0x0fcf('0x5b')][_0x0fcf('0x8a')],_0x144354[_0x0fcf('0x94')])},null));})[_0x0fcf('0x36')](respondWithResult(_0x2b087b,null))['catch'](handleError(_0x2b087b,null));};exports[_0x0fcf('0x98')]=function(_0x2476e0,_0x1e259b){var _0x3465ee=_0x2476e0[_0x0fcf('0x5b')]['channel'];return db[_0x0fcf('0x38')][_0x0fcf('0x33')]({'where':{'id':_0x2476e0[_0x0fcf('0x4f')]['id']},'attributes':['id',_0x0fcf('0x34'),'role',_0x0fcf('0x99'),_0x0fcf('0x9a'),_0x0fcf('0x9b'),'interface']})['then'](handleEntityNotFound(_0x1e259b,null))[_0x0fcf('0x36')](function(_0x16afe3){if(_0x16afe3){if(!utils[_0x0fcf('0x9c')](_0x3465ee)){throw new db[(_0x0fcf('0x8b'))][(_0x0fcf('0x8c'))]('Unknown\x20channel');}return _0x16afe3[_0x0fcf('0x9d')+_[_0x0fcf('0x9e')](_0x3465ee[_0x0fcf('0x9f')]())+'Queues'](_0x2476e0[_0x0fcf('0x5b')][_0x0fcf('0x5e')],{'penalty':_0x2476e0['body'][_0x0fcf('0xa0')]||0x0})[_0x0fcf('0xa1')](function(_0x40562e){for(var _0x449f55=0x0;_0x449f55<_0x2476e0[_0x0fcf('0x5b')]['ids'][_0x0fcf('0x58')];_0x449f55+=0x1){var _0x492839={'UserId':Number(_0x2476e0[_0x0fcf('0x4f')]['id'])};_0x492839[_['capitalize'](_0x3465ee['toLowerCase']())+_0x0fcf('0xa2')]=Number(_0x2476e0[_0x0fcf('0x5b')][_0x0fcf('0x5e')][_0x449f55]);socket[_0x0fcf('0xa3')](_0x0fcf('0x7b')+_[_0x0fcf('0x9e')](_0x3465ee[_0x0fcf('0x9f')]())+_0x0fcf('0xa4'),_0x492839);}return _0x40562e;})[_0x0fcf('0x36')](function(){if(_0x3465ee==='voice'){return db[_0x0fcf('0xa5')][_0x0fcf('0x41')]({'where':{'id':_0x2476e0[_0x0fcf('0x5b')][_0x0fcf('0x5e')]||[]},'raw':!![],'attributes':['id',_0x0fcf('0x34')]});}})[_0x0fcf('0x36')](function(_0x210aaf){var _0x4c62dd=_0x16afe3[_0x0fcf('0x27')]({'plain':!![]});var _0x12df1c=[];if(_0x3465ee==='voice'&&_0x4c62dd[_0x0fcf('0x28')]==='agent'&&_0x4c62dd[_0x0fcf('0x99')]){for(var _0x5947c5=0x0;_0x5947c5<_0x210aaf[_0x0fcf('0x58')];_0x5947c5+=0x1){_0x12df1c[_0x0fcf('0x47')]({'membername':_0x4c62dd[_0x0fcf('0x34')],'UserId':_0x4c62dd['id'],'queue_name':_0x210aaf[_0x5947c5][_0x0fcf('0x34')],'VoiceQueueId':_0x210aaf[_0x5947c5]['id'],'interface':_[_0x0fcf('0x65')](_0x4c62dd[_0x0fcf('0xa6')])?util['format'](_0x0fcf('0xa7'),_0x4c62dd[_0x0fcf('0x34')]):_0x4c62dd[_0x0fcf('0xa6')],'paused':_0x4c62dd[_0x0fcf('0x9b')]||![],'penalty':_0x2476e0[_0x0fcf('0x5b')]['penalty']||0x0});}return BPromise['each'](_0x12df1c,function(_0x3211be){return db[_0x0fcf('0xa8')][_0x0fcf('0xa9')](_0x3211be);});}return _0x16afe3;});}})[_0x0fcf('0x36')](respondWithStatusCode(_0x1e259b,null))[_0x0fcf('0x4d')](handleError(_0x1e259b,null));};exports['removeQueues']=function(_0x2d6360,_0x4297af){var _0x4919d4;return db['User'][_0x0fcf('0x33')]({'where':{'id':_0x2d6360[_0x0fcf('0x4f')]['id']},'attributes':['id',_0x0fcf('0x34'),_0x0fcf('0x28')]})[_0x0fcf('0x36')](handleEntityNotFound(_0x4297af,null))[_0x0fcf('0x36')](function(_0x38aba9){if(_0x38aba9){_0x4919d4=_0x38aba9;if(!_0x2d6360[_0x0fcf('0x54')][_0x0fcf('0xaa')]||!utils[_0x0fcf('0x9c')](_0x2d6360[_0x0fcf('0x54')][_0x0fcf('0xaa')])){throw new db[(_0x0fcf('0x8b'))][(_0x0fcf('0x8c'))](_0x0fcf('0xab'));}return _0x38aba9[_0x0fcf('0xac')+_['capitalize'](_0x2d6360['query'][_0x0fcf('0xaa')][_0x0fcf('0x9f')]())+_0x0fcf('0xad')](_0x2d6360[_0x0fcf('0x54')][_0x0fcf('0x5e')]);}})[_0x0fcf('0x36')](function(_0x518070){if(_[_0x0fcf('0xae')](_0x2d6360['query'][_0x0fcf('0x5e')])){for(var _0x5f4613=0x0;_0x5f4613<_0x2d6360['query'][_0x0fcf('0x5e')][_0x0fcf('0x58')];_0x5f4613+=0x1){var _0xe72ed8={'UserId':Number(_0x2d6360['params']['id'])};_0xe72ed8[_['capitalize'](_0x2d6360[_0x0fcf('0x54')][_0x0fcf('0xaa')][_0x0fcf('0x9f')]())+_0x0fcf('0xa2')]=Number(_0x2d6360[_0x0fcf('0x54')]['ids'][_0x5f4613]);socket[_0x0fcf('0xa3')](_0x0fcf('0x7b')+_[_0x0fcf('0x9e')](_0x2d6360[_0x0fcf('0x54')][_0x0fcf('0xaa')][_0x0fcf('0x9f')]())+_0x0fcf('0xaf'),_0xe72ed8);}}else{var _0xe72ed8={'UserId':Number(_0x2d6360[_0x0fcf('0x4f')]['id'])};_0xe72ed8[_[_0x0fcf('0x9e')](_0x2d6360[_0x0fcf('0x54')][_0x0fcf('0xaa')][_0x0fcf('0x9f')]())+_0x0fcf('0xa2')]=Number(_0x2d6360[_0x0fcf('0x54')][_0x0fcf('0x5e')]);socket['emit']('user'+_['capitalize'](_0x2d6360[_0x0fcf('0x54')]['channel'][_0x0fcf('0x9f')]())+_0x0fcf('0xaf'),_0xe72ed8);}return _0x518070;})['then'](function(){if(_0x2d6360[_0x0fcf('0x54')]['channel']===_0x0fcf('0xb0')){return db['UserVoiceQueueRt'][_0x0fcf('0x26')]({'where':{'UserId':_0x2d6360[_0x0fcf('0x4f')]['id'],'VoiceQueueId':_0x2d6360[_0x0fcf('0x54')][_0x0fcf('0x5e')]},'individualHooks':!![]})[_0x0fcf('0x36')](function(){return _0x4919d4;});}return _0x4919d4;})[_0x0fcf('0x36')](respondWithStatusCode(_0x4297af,null))['catch'](handleError(_0x4297af,null));};exports[_0x0fcf('0xb1')]=function(_0x337d09,_0x5ab604){_0x337d09[_0x0fcf('0x5b')]['userpic']=_0x337d09['file'][_0x0fcf('0xb2')];return db[_0x0fcf('0x38')][_0x0fcf('0x33')]({'where':{'id':_0x337d09[_0x0fcf('0x4f')]['id']}})[_0x0fcf('0x36')](handleEntityNotFound(_0x5ab604,null))[_0x0fcf('0x36')](saveUpdates(_0x337d09[_0x0fcf('0x5b')],null))[_0x0fcf('0x36')](respondWithResult(_0x5ab604,null))['catch'](handleError(_0x5ab604,null));};exports[_0x0fcf('0xb3')]=function(_0x35e2b0,_0x233a76){var _0x300647=path['join'](config['root'],_0x0fcf('0xb4'));return db[_0x0fcf('0x38')][_0x0fcf('0x33')]({'where':{'id':_0x35e2b0[_0x0fcf('0x4f')]['id']},'attributes':['id',_0x0fcf('0xb5')],'raw':!![]})['then'](handleEntityNotFound(_0x233a76,null))['then'](function(_0x310652){if(_0x310652){if(_[_0x0fcf('0x65')](_0x310652[_0x0fcf('0xb5')])){return _0x233a76[_0x0fcf('0xb6')](_0x300647);}else{if(!fs['existsSync'](path[_0x0fcf('0xb7')](config[_0x0fcf('0xb8')],'server/files/images/',_0x310652[_0x0fcf('0xb5')]))){return _0x233a76[_0x0fcf('0xb6')](_0x300647);}return _0x233a76['download'](path[_0x0fcf('0xb7')](config[_0x0fcf('0xb8')],_0x0fcf('0xb9'),_0x310652[_0x0fcf('0xb5')]));}}})[_0x0fcf('0x4d')](handleError(_0x233a76,null));};exports[_0x0fcf('0xba')]=function(_0x3f7a64,_0x5efa26){return db[_0x0fcf('0x38')][_0x0fcf('0x33')]({'where':{'id':_0x3f7a64[_0x0fcf('0x4f')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x5efa26,null))[_0x0fcf('0x36')](function(_0x22c391){var _0x41e1b5=[];values=_0x22c391[_0x0fcf('0x46')];_0x41e1b5[_0x0fcf('0x47')](get_open_tabs(_0x0fcf('0x45'),_0x22c391[_0x0fcf('0x46')]));_0x41e1b5[_0x0fcf('0x47')](get_open_tabs(_0x0fcf('0x48'),_0x22c391[_0x0fcf('0x46')]));_0x41e1b5[_0x0fcf('0x47')](get_open_tabs('openchannel',_0x22c391[_0x0fcf('0x46')]));_0x41e1b5['push'](get_open_tabs(_0x0fcf('0x5a'),_0x22c391[_0x0fcf('0x46')]));_0x41e1b5[_0x0fcf('0x47')](get_open_tabs('fax',_0x22c391[_0x0fcf('0x46')]));_0x41e1b5['push'](get_open_tabs(_0x0fcf('0x4a'),_0x22c391['dataValues']));return BPromise[_0x0fcf('0x4c')](_0x41e1b5);})[_0x0fcf('0x36')](function(_0x56bbcd){var _0x2003a6=[];if(_0x56bbcd){for(var _0x300d2a=0x0;_0x300d2a=_0x28f576[_0xd3c7('0x54')]){throw new Error(_0xd3c7('0x55'));}})['then'](function(){if(_0x2ecf43){return db[_0xd3c7('0x4b')][_0xd3c7('0x4e')]({'where':{'membername':_0x2ecf43[_0xd3c7('0x30')]},'individualHooks':!![]});}})[_0xd3c7('0x2d')](function(){if(_0x2ecf43){return _0x2ecf43[_0xd3c7('0x56')]({'raw':!![]});}})[_0xd3c7('0x2d')](function(_0x50751b){if(_0x2ecf43){if(_0x50751b){var _0x2cfd4a=[];_0x12b459=_0x50751b;if(_0x12b459[_0xd3c7('0x31')]){for(var _0x4da3ff=0x0;_0x4da3ff<_0x12b459[_0xd3c7('0x31')];_0x4da3ff++){_0x2cfd4a['push'](db[_0xd3c7('0x4b')][_0xd3c7('0x57')]({'membername':_0x2ecf43[_0xd3c7('0x30')],'UserId':_0x2ecf43['id'],'queue_name':_0x12b459[_0x4da3ff]['name'],'VoiceQueueId':_0x12b459[_0x4da3ff]['id'],'interface':_0x25c116,'paused':_0x2ecf43[_0xd3c7('0x58')]||![],'penalty':_0x12b459[_0x4da3ff][_0xd3c7('0x59')]||0x0}));}return BPromise[_0xd3c7('0x4c')](_0x2cfd4a);}}}})[_0xd3c7('0x2d')](function(){if(_0x2ecf43){return db['MemberReport'][_0xd3c7('0x1d')]({'where':{'membername':_0x2ecf43[_0xd3c7('0x30')],'exitAt':null}});}})['then'](function(_0x303b95){if(_0x2ecf43){if(_0x303b95&&_0x303b95['length']){var _0x237ce8=[];_0x303b95['forEach'](function(_0x34919a){_0x237ce8[_0xd3c7('0x36')](_0x34919a[_0xd3c7('0x2e')]({'exitAt':moment()[_0xd3c7('0x32')](_0xd3c7('0x39'))}));});return BPromise['all'](_0x237ce8);}}})[_0xd3c7('0x2d')](function(_0x5a521c){if(_0x2ecf43){var _0x312b8d=[];var _0x23fe90=[];var _0x55095c=utils[_0xd3c7('0x34')]();var _0x1c1042={'membername':_0x2ecf43[_0xd3c7('0x30')],'interface':_0x25c116,'enterAt':moment()[_0xd3c7('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2ecf43[_0xd3c7('0x2a')],'internal':_0x2ecf43[_0xd3c7('0x2b')]};_0x55095c['forEach'](function(_0x56a552){_0x312b8d[_0xd3c7('0x36')](_[_0xd3c7('0x5a')]({'channel':_0x56a552,'type':'LOGIN','data1':_0xd3c7('0x5b'),'data2':_0x25c116},_0x1c1042));if(_0x2ecf43[_0xd3c7('0x58')]){_0x23fe90['push'](_[_0xd3c7('0x5a')]({'channel':_0x56a552,'type':'PAUSE','data1':_0xd3c7('0x5c')},_0x1c1042));}});return db[_0xd3c7('0x2f')][_0xd3c7('0x5d')](_0x312b8d['concat'](_0x23fe90),{'individualHooks':!![]});}})[_0xd3c7('0x2d')](function(){if(_0x2ecf43){return _0x2ecf43[_0xd3c7('0x2e')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2ecf43[_0xd3c7('0x58')]||![],'mailPause':_0x2ecf43[_0xd3c7('0x58')]||![],'chatPause':_0x2ecf43[_0xd3c7('0x58')]||![],'faxPause':_0x2ecf43['loginInPause']||![],'smsPause':_0x2ecf43[_0xd3c7('0x58')]||![],'openchannelPause':_0x2ecf43[_0xd3c7('0x58')]||![],'pauseType':_0x2ecf43['loginInPause']?_0xd3c7('0x5c'):null,'lastPauseAt':moment()[_0xd3c7('0x32')](_0xd3c7('0x39')),'interface':_0x25c116});}})[_0xd3c7('0x2d')](function(_0x5c8bea){_0x1e5e83(_0x5c8bea);})[_0xd3c7('0x1b')](function(_0x83f74d){_0x439447(_0x5dc880[_0xd3c7('0x17')](0x1f4,_0x83f74d[_0xd3c7('0x19')]));});});}; \ No newline at end of file +var _0x25f9=['length','updateAttributes','getChannels','forEach','push','isNil','interface','format','PAUSE','body','type','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','User','findOne','channel','isValidChannel','Unknown\x20channel','voice','chat','sms','openchannel','whatsapp','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','SIP/%s','count','agent','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','LOGIN','merge','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetUser','findAll','options','raw','attributes','include','model','debug','find','where','map','ShowUser','PauseUser','name','role','internal','UserVoiceQueueRt','update','MemberReport','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2d79ed,_0x4dd269){var _0x34b45c=function(_0x33fa4c){while(--_0x33fa4c){_0x2d79ed['push'](_0x2d79ed['shift']());}};_0x34b45c(++_0x4dd269);}(_0x25f9,0x13e));var _0x925f=function(_0x862ac8,_0x15a139){_0x862ac8=_0x862ac8-0x0;var _0x434f56=_0x25f9[_0x862ac8];return _0x434f56;};'use strict';var _=require(_0x925f('0x0'));var util=require(_0x925f('0x1'));var moment=require(_0x925f('0x2'));var BPromise=require(_0x925f('0x3'));var rs=require(_0x925f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x925f('0x5'))['db'];var utils=require(_0x925f('0x6'));var logger=require(_0x925f('0x7'))('rpc');var config=require(_0x925f('0x8'));var jayson=require(_0x925f('0x9'));var client=jayson[_0x925f('0xa')]['http']({'port':0x232a});config[_0x925f('0xb')]=_['defaults'](config[_0x925f('0xb')],{'host':_0x925f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x925f('0xb')]));require(_0x925f('0xd'))[_0x925f('0xe')](socket);function respondWithRpcPromise(_0x580cc4,_0x4e6240,_0x598c21){return new BPromise(function(_0x3a944b,_0x2fda5c){return client[_0x925f('0xf')](_0x580cc4,_0x598c21)[_0x925f('0x10')](function(_0x14b035){logger[_0x925f('0x11')](_0x925f('0x12'),_0x4e6240,_0x925f('0x13'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x4e6240,'request\x20sent',JSON[_0x925f('0x14')](_0x14b035));if(_0x14b035[_0x925f('0x15')]){if(_0x14b035[_0x925f('0x15')][_0x925f('0x16')]===0x1f4){logger[_0x925f('0x15')](_0x925f('0x12'),_0x4e6240,_0x14b035[_0x925f('0x15')][_0x925f('0x17')]);return _0x2fda5c(_0x14b035['error'][_0x925f('0x17')]);}logger['error'](_0x925f('0x12'),_0x4e6240,_0x14b035[_0x925f('0x15')][_0x925f('0x17')]);return _0x3a944b(_0x14b035['error'][_0x925f('0x17')]);}else{logger['info']('User,\x20%s,\x20%s',_0x4e6240,'request\x20sent');_0x3a944b(_0x14b035[_0x925f('0x18')][_0x925f('0x17')]);}})[_0x925f('0x19')](function(_0x1087a4){logger['error'](_0x925f('0x12'),_0x4e6240,_0x1087a4);_0x2fda5c(_0x1087a4);});});}exports[_0x925f('0x1a')]=function(_0x1f3341){var _0x5d2c37=this;return new Promise(function(_0x4a66b6,_0x2b3a8d){return db['User'][_0x925f('0x1b')]({'raw':_0x1f3341[_0x925f('0x1c')]?_0x1f3341['options'][_0x925f('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f3341[_0x925f('0x1c')]?_0x1f3341['options']['where']||null:null,'attributes':_0x1f3341['options']?_0x1f3341['options'][_0x925f('0x1e')]||null:null,'limit':_0x1f3341[_0x925f('0x1c')]?_0x1f3341[_0x925f('0x1c')]['limit']||null:null,'include':_0x1f3341[_0x925f('0x1c')]?_0x1f3341[_0x925f('0x1c')][_0x925f('0x1f')]?_['map'](_0x1f3341[_0x925f('0x1c')][_0x925f('0x1f')],function(_0x261bf7){return{'model':db[_0x261bf7[_0x925f('0x20')]],'as':_0x261bf7['as'],'attributes':_0x261bf7[_0x925f('0x1e')],'include':_0x261bf7[_0x925f('0x1f')]?_['map'](_0x261bf7[_0x925f('0x1f')],function(_0x2b1bd1){return{'model':db[_0x2b1bd1[_0x925f('0x20')]],'as':_0x2b1bd1['as'],'attributes':_0x2b1bd1[_0x925f('0x1e')],'include':_0x2b1bd1[_0x925f('0x1f')]?_['map'](_0x2b1bd1[_0x925f('0x1f')],function(_0x11f8cb){return{'model':db[_0x11f8cb[_0x925f('0x20')]],'as':_0x11f8cb['as'],'attributes':_0x11f8cb[_0x925f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x925f('0x10')](function(_0x4e2e1a){logger[_0x925f('0x11')](_0x925f('0x1a'),_0x1f3341);logger[_0x925f('0x21')]('GetUser',_0x1f3341,JSON[_0x925f('0x14')](_0x4e2e1a));_0x4a66b6(_0x4e2e1a);})['catch'](function(_0x1e2d7f){logger[_0x925f('0x15')](_0x925f('0x1a'),_0x1e2d7f[_0x925f('0x17')],_0x1f3341);_0x2b3a8d(_0x5d2c37[_0x925f('0x15')](0x1f4,_0x1e2d7f[_0x925f('0x17')]));});});};exports['ShowUser']=function(_0x460523){var _0x2d7dcd=this;return new Promise(function(_0x581755,_0x654405){return db['User'][_0x925f('0x22')]({'raw':_0x460523[_0x925f('0x1c')]?_0x460523['options'][_0x925f('0x1d')]===undefined?!![]:![]:!![],'where':_0x460523['options']?_0x460523[_0x925f('0x1c')][_0x925f('0x23')]||null:null,'attributes':_0x460523['options']?_0x460523[_0x925f('0x1c')]['attributes']||null:null,'include':_0x460523['options']?_0x460523[_0x925f('0x1c')][_0x925f('0x1f')]?_[_0x925f('0x24')](_0x460523[_0x925f('0x1c')][_0x925f('0x1f')],function(_0x35ad62){return{'model':db[_0x35ad62[_0x925f('0x20')]],'as':_0x35ad62['as'],'attributes':_0x35ad62['attributes'],'include':_0x35ad62['include']?_[_0x925f('0x24')](_0x35ad62[_0x925f('0x1f')],function(_0x2f35ed){return{'model':db[_0x2f35ed[_0x925f('0x20')]],'as':_0x2f35ed['as'],'attributes':_0x2f35ed[_0x925f('0x1e')],'include':_0x2f35ed[_0x925f('0x1f')]?_[_0x925f('0x24')](_0x2f35ed['include'],function(_0x7cf3ac){return{'model':db[_0x7cf3ac[_0x925f('0x20')]],'as':_0x7cf3ac['as'],'attributes':_0x7cf3ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x925f('0x10')](function(_0x3507d3){logger['info'](_0x925f('0x25'),_0x460523);logger['debug']('ShowUser',_0x460523,JSON[_0x925f('0x14')](_0x3507d3));_0x581755(_0x3507d3);})['catch'](function(_0x497b97){logger[_0x925f('0x15')]('ShowUser',_0x497b97['message'],_0x460523);_0x654405(_0x2d7dcd[_0x925f('0x15')](0x1f4,_0x497b97[_0x925f('0x17')]));});});};exports[_0x925f('0x26')]=function(_0x9a6fda){var _0x3209cc=this;return new Promise(function(_0x4d74fd,_0x26053f){var _0x25757f;return db['User']['find']({'where':_0x9a6fda['options'][_0x925f('0x23')]||{},'attributes':['id',_0x925f('0x27'),_0x925f('0x28'),_0x925f('0x29'),'interface']})[_0x925f('0x10')](function(_0x32c84f){if(_0x32c84f){_0x25757f=_0x32c84f;return db[_0x925f('0x2a')][_0x925f('0x2b')]({'paused':0x1},{'where':{'UserId':_0x25757f['id']},'individualHooks':!![]});}})['then'](function(){if(_0x25757f){return db[_0x925f('0x2c')][_0x925f('0x1b')]({'where':{'membername':_0x25757f[_0x925f('0x27')],'type':'PAUSE','exitAt':null}});}})[_0x925f('0x10')](function(_0x538f3f){if(_0x25757f){if(_0x538f3f&&_0x538f3f['length']){var _0x21cf3f=moment()['format'](_0x925f('0x2d'));for(var _0x420f84=0x0,_0x26696c=_0x538f3f[_0x925f('0x2e')];_0x420f84<_0x26696c;_0x420f84++){_0x538f3f[_0x420f84][_0x925f('0x2f')]({'exitAt':_0x21cf3f});}}}})[_0x925f('0x10')](function(){if(_0x25757f){var _0x5dbb6a=[];var _0x5d9847=utils[_0x925f('0x30')]();_0x5d9847[_0x925f('0x31')](function(_0x2184cc){_0x5dbb6a[_0x925f('0x32')]({'channel':_0x2184cc,'membername':_0x25757f['name'],'interface':_[_0x925f('0x33')](_0x25757f[_0x925f('0x34')])?util[_0x925f('0x35')]('SIP/%s',_0x25757f[_0x925f('0x27')]):_0x25757f[_0x925f('0x34')],'type':_0x925f('0x36'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x9a6fda[_0x925f('0x37')][_0x925f('0x38')]||_0x925f('0x39'),'role':_0x25757f['role'],'internal':_0x25757f['internal'],'uniqueid':_0x9a6fda['body']['uniqueid']||null});});return db['MemberReport'][_0x925f('0x3a')](_0x5dbb6a,{'individualHooks':!![]});}})['then'](function(){if(_0x25757f){return _0x25757f[_0x925f('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x9a6fda['body']['type']||_0x925f('0x39'),'lastPauseAt':moment()['format'](_0x925f('0x2d'))});}})['then'](function(_0xb08d71){_0x4d74fd(_0xb08d71);})[_0x925f('0x19')](function(_0x33c782){_0x26053f(_0x3209cc[_0x925f('0x15')](0x1f4,_0x33c782[_0x925f('0x17')]));});});};exports[_0x925f('0x3b')]=function(_0x34bc53){var _0x5948f1=this;return new Promise(function(_0x4f9baf,_0xd54f17){var _0x19fed0;return db[_0x925f('0x3c')][_0x925f('0x3d')]({'where':_0x34bc53[_0x925f('0x1c')]['where']||{},'attributes':['id','name']})[_0x925f('0x10')](function(_0x565951){if(_0x565951){_0x19fed0=_0x565951;if(_0x34bc53[_0x925f('0x37')][_0x925f('0x3e')]&&!utils[_0x925f('0x3f')](_0x34bc53[_0x925f('0x37')][_0x925f('0x3e')])){throw new Error(_0x925f('0x40'));}switch(_0x34bc53['body'][_0x925f('0x3e')]){case _0x925f('0x41'):return db[_0x925f('0x2a')][_0x925f('0x2b')]({'paused':0x0},{'where':{'UserId':_0x19fed0['id']}})[_0x925f('0x10')](function(){return db[_0x925f('0x2c')][_0x925f('0x22')]({'where':{'channel':_0x34bc53['body'][_0x925f('0x3e')],'membername':_0x19fed0[_0x925f('0x27')],'type':_0x925f('0x36'),'exitAt':null}});})[_0x925f('0x10')](function(_0x1c9c0a){if(_0x1c9c0a){return _0x1c9c0a['update']({'exitAt':moment()[_0x925f('0x35')](_0x925f('0x2d')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x925f('0x10')](function(){return _0x19fed0[_0x925f('0x2b')]({'voicePause':![]});});case'mail':case _0x925f('0x42'):case'fax':case _0x925f('0x43'):case _0x925f('0x44'):case _0x925f('0x45'):return db['MemberReport'][_0x925f('0x22')]({'where':{'channel':_0x34bc53[_0x925f('0x37')][_0x925f('0x3e')],'membername':_0x19fed0[_0x925f('0x27')],'type':_0x925f('0x36'),'exitAt':null}})['then'](function(_0x521630){return _0x521630[_0x925f('0x2b')]({'exitAt':moment()[_0x925f('0x35')](_0x925f('0x2d')),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x420202={};_[_0x925f('0x46')](_0x420202,util[_0x925f('0x35')](_0x925f('0x47'),_0x34bc53[_0x925f('0x37')][_0x925f('0x3e')],_0x925f('0x48')),![]);return _0x19fed0[_0x925f('0x2b')](_0x420202);});default:return db[_0x925f('0x2a')][_0x925f('0x2b')]({'paused':0x0},{'where':{'UserId':_0x19fed0['id']}})[_0x925f('0x10')](function(){return db[_0x925f('0x2c')][_0x925f('0x1b')]({'where':{'membername':_0x19fed0[_0x925f('0x27')],'type':'PAUSE','exitAt':null}});})[_0x925f('0x10')](function(_0x4c6622){var _0x472c26=[];_0x4c6622[_0x925f('0x31')](function(_0x3aba2b){_0x472c26[_0x925f('0x32')](_0x3aba2b[_0x925f('0x2b')]({'exitAt':moment()[_0x925f('0x35')](_0x925f('0x2d')),'data2':'system'}));});return BPromise[_0x925f('0x49')](_0x472c26);})['then'](function(){return _0x19fed0['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x925f('0x10')](function(_0x7e7d2e){_0x4f9baf(_0x7e7d2e);})[_0x925f('0x19')](function(_0x1f66c7){_0xd54f17(_0x5948f1[_0x925f('0x15')](0x1f4,_0x1f66c7[_0x925f('0x17')]));});});};exports[_0x925f('0x4a')]=function(_0x5cdd2d){var _0x56e83b=this;return new Promise(function(_0x6e2a13,_0x29acbf){var _0x16c67d;return db['User']['findOne']({'where':_0x5cdd2d[_0x925f('0x1c')]['where']||{},'attributes':['id',_0x925f('0x27')]})[_0x925f('0x10')](function(_0x58f042){if(_0x58f042){_0x16c67d=_0x58f042;return db['UserVoiceQueueRt'][_0x925f('0x4b')]({'where':{'membername':_0x16c67d[_0x925f('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x16c67d){return db[_0x925f('0x2c')][_0x925f('0x1b')]({'where':{'membername':_0x16c67d['name'],'exitAt':null}});}})[_0x925f('0x10')](function(_0x3a706f){if(_0x16c67d){if(_0x3a706f&&_0x3a706f[_0x925f('0x2e')]){var _0x211488=[];_0x3a706f['forEach'](function(_0x514ac8){_0x211488[_0x925f('0x32')](_0x514ac8['update']({'exitAt':moment()[_0x925f('0x35')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x211488);}}})['then'](function(){if(_0x16c67d){return _0x16c67d[_0x925f('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x925f('0x10')](function(_0x14446a){_0x6e2a13(_0x14446a);})[_0x925f('0x19')](function(_0x515303){_0x29acbf(_0x56e83b[_0x925f('0x15')](0x1f4,_0x515303[_0x925f('0x17')]));});});};exports[_0x925f('0x4c')]=function(_0x22ff96){var _0x4d7f8c=this;return new Promise(function(_0x4da0e5,_0x229949){var _0x210a7e;var _0x4e36f7;var _0x7a2941;var _0x23b325;return db['User'][_0x925f('0x3d')]({'where':_0x22ff96['options'][_0x925f('0x23')]||{},'attributes':['id',_0x925f('0x27'),_0x925f('0x28'),_0x925f('0x4d'),_0x925f('0x4e'),_0x925f('0x29'),_0x925f('0x4f'),_0x925f('0x34')]})[_0x925f('0x10')](function(_0x558c50){if(_0x558c50){_0x210a7e=_0x558c50;_0x23b325=_0x22ff96[_0x925f('0x37')]['interface']?_0x22ff96[_0x925f('0x37')][_0x925f('0x34')]:util['format'](_0x925f('0x50'),_0x210a7e['name']);return db[_0x925f('0x3c')][_0x925f('0x51')]({'where':{'role':_0x925f('0x52'),'online':!![],'id':{'$ne':_0x210a7e['id']}}});}})['then'](function(_0x32b026){if(_0x32b026){_0x7a2941=_0x32b026;return require('../../config/license/util')['getLicense']();}})['then'](function(_0x92bbdc){if(_0x92bbdc&&_0x92bbdc[_0x925f('0x53')]&&_0x7a2941>=_0x92bbdc[_0x925f('0x53')]){throw new Error(_0x925f('0x54'));}})[_0x925f('0x10')](function(){if(_0x210a7e){return db['UserVoiceQueueRt'][_0x925f('0x4b')]({'where':{'membername':_0x210a7e['name']},'individualHooks':!![]});}})[_0x925f('0x10')](function(){if(_0x210a7e){return _0x210a7e['getVoiceQueues']({'raw':!![]});}})[_0x925f('0x10')](function(_0x21a82c){if(_0x210a7e){if(_0x21a82c){var _0x2a696b=[];_0x4e36f7=_0x21a82c;if(_0x4e36f7[_0x925f('0x2e')]){for(var _0xda26de=0x0;_0xda26de<_0x4e36f7[_0x925f('0x2e')];_0xda26de++){_0x2a696b[_0x925f('0x32')](db[_0x925f('0x2a')][_0x925f('0x55')]({'membername':_0x210a7e[_0x925f('0x27')],'UserId':_0x210a7e['id'],'queue_name':_0x4e36f7[_0xda26de][_0x925f('0x27')],'VoiceQueueId':_0x4e36f7[_0xda26de]['id'],'interface':_0x23b325,'paused':_0x210a7e['loginInPause']||![],'penalty':_0x4e36f7[_0xda26de][_0x925f('0x56')]||0x0}));}return BPromise[_0x925f('0x49')](_0x2a696b);}}}})[_0x925f('0x10')](function(){if(_0x210a7e){return db[_0x925f('0x2c')][_0x925f('0x1b')]({'where':{'membername':_0x210a7e[_0x925f('0x27')],'exitAt':null}});}})['then'](function(_0xad2c6c){if(_0x210a7e){if(_0xad2c6c&&_0xad2c6c[_0x925f('0x2e')]){var _0xb458bd=[];_0xad2c6c['forEach'](function(_0x14d668){_0xb458bd[_0x925f('0x32')](_0x14d668[_0x925f('0x2b')]({'exitAt':moment()['format'](_0x925f('0x2d'))}));});return BPromise[_0x925f('0x49')](_0xb458bd);}}})[_0x925f('0x10')](function(_0x370a47){if(_0x210a7e){var _0x2ce961=[];var _0x4d0588=[];var _0xf35f28=utils[_0x925f('0x30')]();var _0x506759={'membername':_0x210a7e[_0x925f('0x27')],'interface':_0x23b325,'enterAt':moment()[_0x925f('0x35')](_0x925f('0x2d')),'role':_0x210a7e['role'],'internal':_0x210a7e[_0x925f('0x29')]};_0xf35f28[_0x925f('0x31')](function(_0x1c9c1b){_0x2ce961['push'](_['merge']({'channel':_0x1c9c1b,'type':_0x925f('0x57'),'data1':'callysquare','data2':_0x23b325},_0x506759));if(_0x210a7e[_0x925f('0x4f')]){_0x4d0588[_0x925f('0x32')](_[_0x925f('0x58')]({'channel':_0x1c9c1b,'type':_0x925f('0x36'),'data1':_0x925f('0x59')},_0x506759));}});return db[_0x925f('0x2c')]['bulkCreate'](_0x2ce961[_0x925f('0x5a')](_0x4d0588),{'individualHooks':!![]});}})[_0x925f('0x10')](function(){if(_0x210a7e){return _0x210a7e[_0x925f('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x925f('0x35')](_0x925f('0x2d')),'voicePause':_0x210a7e[_0x925f('0x4f')]||![],'mailPause':_0x210a7e[_0x925f('0x4f')]||![],'chatPause':_0x210a7e[_0x925f('0x4f')]||![],'faxPause':_0x210a7e[_0x925f('0x4f')]||![],'smsPause':_0x210a7e['loginInPause']||![],'openchannelPause':_0x210a7e[_0x925f('0x4f')]||![],'pauseType':_0x210a7e['loginInPause']?_0x925f('0x59'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x23b325});}})[_0x925f('0x10')](function(_0x15305c){_0x4da0e5(_0x15305c);})[_0x925f('0x19')](function(_0x463a1e){_0x229949(_0x4d7f8c[_0x925f('0x15')](0x1f4,_0x463a1e[_0x925f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bb27033..f60a897 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 _0xed83=['update','emit','user:','save','remove'];(function(_0x229a03,_0x36fefc){var _0x2d6e11=function(_0x592d00){while(--_0x592d00){_0x229a03['push'](_0x229a03['shift']());}};_0x2d6e11(++_0x36fefc);}(_0xed83,0x16b));var _0x3ed8=function(_0x358df5,_0x2d31af){_0x358df5=_0x358df5-0x0;var _0x3727b2=_0xed83[_0x358df5];return _0x3727b2;};'use strict';var UserEvents=require('./user.events');var events=[_0x3ed8('0x0'),_0x3ed8('0x1'),_0x3ed8('0x2')];function createListener(_0x10f833,_0x4e8089){return function(_0x514b2d){_0x4e8089[_0x3ed8('0x3')](_0x10f833,_0x514b2d);};}function removeListener(_0x45de8e,_0x2ba867){return function(){UserEvents['removeListener'](_0x45de8e,_0x2ba867);};}exports['register']=function(_0xb5e974){for(var _0x5c94bd=0x0,_0x3bcbf7=events['length'];_0x5c94bd<_0x3bcbf7;_0x5c94bd++){var _0x8dbdd0=events[_0x5c94bd];var _0x5c2c73=createListener(_0x3ed8('0x4')+_0x8dbdd0,_0xb5e974);UserEvents['on'](_0x8dbdd0,_0x5c2c73);}}; \ No newline at end of file +var _0x17b2=['remove','update','emit','removeListener','user:','save'];(function(_0x5d2ada,_0x32f631){var _0x44769d=function(_0xe784c3){while(--_0xe784c3){_0x5d2ada['push'](_0x5d2ada['shift']());}};_0x44769d(++_0x32f631);}(_0x17b2,0x89));var _0x217b=function(_0x57a608,_0xcd52c){_0x57a608=_0x57a608-0x0;var _0x58e88e=_0x17b2[_0x57a608];return _0x58e88e;};'use strict';var UserEvents=require('./user.events');var events=[_0x217b('0x0'),_0x217b('0x1'),_0x217b('0x2')];function createListener(_0x523073,_0x526051){return function(_0x476089){_0x526051[_0x217b('0x3')](_0x523073,_0x476089);};}function removeListener(_0x5e58b4,_0xa1850b){return function(){UserEvents[_0x217b('0x4')](_0x5e58b4,_0xa1850b);};}exports['register']=function(_0x5ae451){for(var _0x2b14a0=0x0,_0x817638=events['length'];_0x2b14a0<_0x817638;_0x2b14a0++){var _0x58cfe1=events[_0x2b14a0];var _0x1bf8aa=createListener(_0x217b('0x5')+_0x58cfe1,_0x5ae451);UserEvents['on'](_0x58cfe1,_0x1bf8aa);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ed73984..f87735b 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(_0x141062,_0x261559){var _0x456761=function(_0x2e5439){while(--_0x2e5439){_0x141062['push'](_0x141062['shift']());}};_0x456761(++_0x261559);}(_0xe706,0xa3));var _0x6e70=function(_0x470170,_0x454483){_0x470170=_0x470170-0x0;var _0x2cc1cc=_0xe706[_0x470170];return _0x2cc1cc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x49b59f,_0x1f3a28){var _0x46f0de=function(_0x3841f1){while(--_0x3841f1){_0x49b59f['push'](_0x49b59f['shift']());}};_0x46f0de(++_0x1f3a28);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9ae6642..f4f5e75 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 _0x383c=['INTEGER'];(function(_0x52424b,_0xcea9bb){var _0x304083=function(_0x212f33){while(--_0x212f33){_0x52424b['push'](_0x52424b['shift']());}};_0x304083(++_0xcea9bb);}(_0x383c,0x164));var _0xc383=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x383c[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xc383('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4c9c=['INTEGER'];(function(_0x163f53,_0xc088a6){var _0x10befb=function(_0xf38ff9){while(--_0xf38ff9){_0x163f53['push'](_0x163f53['shift']());}};_0x10befb(++_0xc088a6);}(_0x4c9c,0x180));var _0xc4c9=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0x4c9c[_0xdb357c];return _0x5c8735;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xc4c9('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index cd209a9..430c74a 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 _0xf552=['UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','./userChatQueue.attributes','exports'];(function(_0x10804e,_0x3fa186){var _0xe7079b=function(_0x5ec958){while(--_0x5ec958){_0x10804e['push'](_0x10804e['shift']());}};_0xe7079b(++_0x3fa186);}(_0xf552,0x156));var _0x2f55=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xf552[_0x5f5cce];return _0x705ecf;};'use strict';var _=require(_0x2f55('0x0'));var util=require('util');var logger=require(_0x2f55('0x1'))(_0x2f55('0x2'));var moment=require(_0x2f55('0x3'));var BPromise=require(_0x2f55('0x4'));var rp=require(_0x2f55('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f55('0x6'));module[_0x2f55('0x7')]=function(_0xbbf2ed,_0x57fc58){return _0xbbf2ed['define'](_0x2f55('0x8'),attributes,{'tableName':_0x2f55('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e57=['path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x16c553,_0x5b9385){var _0x15cda5=function(_0x345227){while(--_0x345227){_0x16c553['push'](_0x16c553['shift']());}};_0x15cda5(++_0x5b9385);}(_0x4e57,0x19f));var _0x74e5=function(_0x12fd04,_0x1cac8f){_0x12fd04=_0x12fd04-0x0;var _0x187fef=_0x4e57[_0x12fd04];return _0x187fef;};'use strict';var _=require('lodash');var util=require(_0x74e5('0x0'));var logger=require(_0x74e5('0x1'))(_0x74e5('0x2'));var moment=require(_0x74e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x74e5('0x4'));var fs=require('fs');var path=require(_0x74e5('0x5'));var rimraf=require('rimraf');var config=require(_0x74e5('0x6'));var attributes=require(_0x74e5('0x7'));module[_0x74e5('0x8')]=function(_0x2c4aac,_0x37c533){return _0x2c4aac[_0x74e5('0x9')](_0x74e5('0xa'),attributes,{'tableName':_0x74e5('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 6653845..26a7b79 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 _0xfbbc=['rpc','client','request','then','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0xee3505,_0x2379c0){var _0x370ade=function(_0xa2401b){while(--_0xa2401b){_0xee3505['push'](_0xee3505['shift']());}};_0x370ade(++_0x2379c0);}(_0xfbbc,0x112));var _0xcfbb=function(_0x35d660,_0x4a3e6b){_0x35d660=_0x35d660-0x0;var _0x40422c=_0xfbbc[_0x35d660];return _0x40422c;};'use strict';var _=require('lodash');var util=require(_0xcfbb('0x0'));var moment=require(_0xcfbb('0x1'));var BPromise=require(_0xcfbb('0x2'));var rs=require(_0xcfbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfbb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfbb('0x5'))(_0xcfbb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcfbb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14e4b7,_0x46cca2,_0x2889a4){return new BPromise(function(_0x3a8d82,_0x27418e){return client[_0xcfbb('0x8')](_0x14e4b7,_0x2889a4)[_0xcfbb('0x9')](function(_0x35302c){logger['info'](_0xcfbb('0xa'),_0x46cca2,'request\x20sent');logger[_0xcfbb('0xb')](_0xcfbb('0xc'),_0x46cca2,_0xcfbb('0xd'),JSON[_0xcfbb('0xe')](_0x35302c));if(_0x35302c[_0xcfbb('0xf')]){if(_0x35302c[_0xcfbb('0xf')]['code']===0x1f4){logger[_0xcfbb('0xf')](_0xcfbb('0xa'),_0x46cca2,_0x35302c[_0xcfbb('0xf')][_0xcfbb('0x10')]);return _0x27418e(_0x35302c[_0xcfbb('0xf')][_0xcfbb('0x10')]);}logger[_0xcfbb('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x46cca2,_0x35302c[_0xcfbb('0xf')]['message']);return _0x3a8d82(_0x35302c[_0xcfbb('0xf')][_0xcfbb('0x10')]);}else{logger[_0xcfbb('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x46cca2,_0xcfbb('0xd'));_0x3a8d82(_0x35302c[_0xcfbb('0x12')][_0xcfbb('0x10')]);}})[_0xcfbb('0x13')](function(_0x23ca84){logger[_0xcfbb('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x46cca2,_0x23ca84);_0x27418e(_0x23ca84);});});} \ No newline at end of file +var _0x240d=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x240d,0x1b9));var _0xd240=function(_0x4ec12d,_0x436b6d){_0x4ec12d=_0x4ec12d-0x0;var _0x37dc32=_0x240d[_0x4ec12d];return _0x37dc32;};'use strict';var _=require(_0xd240('0x0'));var util=require(_0xd240('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd240('0x2'));var fs=require('fs');var Redis=require(_0xd240('0x3'));var db=require(_0xd240('0x4'))['db'];var utils=require(_0xd240('0x5'));var logger=require(_0xd240('0x6'))(_0xd240('0x7'));var config=require(_0xd240('0x8'));var jayson=require(_0xd240('0x9'));var client=jayson[_0xd240('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x259319,_0x53fcec,_0x475fcf){return new BPromise(function(_0x52537d,_0x3b6ae7){return client[_0xd240('0xb')](_0x259319,_0x475fcf)[_0xd240('0xc')](function(_0x580b09){logger[_0xd240('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x53fcec,_0xd240('0xe'));logger[_0xd240('0xf')](_0xd240('0x10'),_0x53fcec,_0xd240('0xe'),JSON[_0xd240('0x11')](_0x580b09));if(_0x580b09[_0xd240('0x12')]){if(_0x580b09[_0xd240('0x12')][_0xd240('0x13')]===0x1f4){logger[_0xd240('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x53fcec,_0x580b09[_0xd240('0x12')][_0xd240('0x14')]);return _0x3b6ae7(_0x580b09['error'][_0xd240('0x14')]);}logger['error'](_0xd240('0x15'),_0x53fcec,_0x580b09['error'][_0xd240('0x14')]);return _0x52537d(_0x580b09[_0xd240('0x12')][_0xd240('0x14')]);}else{logger[_0xd240('0xd')](_0xd240('0x15'),_0x53fcec,_0xd240('0xe'));_0x52537d(_0x580b09[_0xd240('0x16')][_0xd240('0x14')]);}})[_0xd240('0x17')](function(_0x5e57aa){logger[_0xd240('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x53fcec,_0x5e57aa);_0x3b6ae7(_0x5e57aa);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7b4713e..45767c6 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x430357,_0x4bb29c){var _0x30f6d9=function(_0x2c0f8e){while(--_0x2c0f8e){_0x430357['push'](_0x430357['shift']());}};_0x30f6d9(++_0x4bb29c);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f2e24,_0x5a3f7f){_0x1f2e24=_0x1f2e24-0x0;var _0x13387f=_0xedd9[_0x1f2e24];return _0x13387f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 372c2ff..e1f5932 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 _0x840e=['exports','INTEGER','sequelize'];(function(_0x8875e,_0x1fc56a){var _0x40f6b1=function(_0x264652){while(--_0x264652){_0x8875e['push'](_0x8875e['shift']());}};_0x40f6b1(++_0x1fc56a);}(_0x840e,0x1f1));var _0xe840=function(_0x3f0f2e,_0xf2b92d){_0x3f0f2e=_0x3f0f2e-0x0;var _0x49fc6f=_0x840e[_0x3f0f2e];return _0x49fc6f;};'use strict';var Sequelize=require(_0xe840('0x0'));module[_0xe840('0x1')]={'penalty':{'type':Sequelize[_0xe840('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe840('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x03d9=['INTEGER','STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x03d9,0x86));var _0x903d=function(_0x501914,_0x3b18af){_0x501914=_0x501914-0x0;var _0x423ce7=_0x03d9[_0x501914];return _0x423ce7;};'use strict';var Sequelize=require(_0x903d('0x0'));module[_0x903d('0x1')]={'penalty':{'type':Sequelize[_0x903d('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x903d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 29b9567..9e97614 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 _0x5b92=['UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x5b92,0x19a));var _0x25b9=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x5b92[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x25b9('0x0'));var util=require(_0x25b9('0x1'));var logger=require('../../config/logger')(_0x25b9('0x2'));var moment=require(_0x25b9('0x3'));var BPromise=require(_0x25b9('0x4'));var rp=require(_0x25b9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b9('0x6'));var config=require(_0x25b9('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x25b9('0x8')]=function(_0xb676cd,_0x1b9833){return _0xb676cd[_0x25b9('0x9')](_0x25b9('0xa'),attributes,{'tableName':_0x25b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf378=['bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment'];(function(_0x249dfe,_0x21f85c){var _0xc7c7be=function(_0x3d0837){while(--_0x3d0837){_0x249dfe['push'](_0x249dfe['shift']());}};_0xc7c7be(++_0x21f85c);}(_0xf378,0xbc));var _0x8f37=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xf378[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x8f37('0x0'));var util=require(_0x8f37('0x1'));var logger=require('../../config/logger')(_0x8f37('0x2'));var moment=require(_0x8f37('0x3'));var BPromise=require(_0x8f37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f37('0x5'));var rimraf=require(_0x8f37('0x6'));var config=require(_0x8f37('0x7'));var attributes=require(_0x8f37('0x8'));module[_0x8f37('0x9')]=function(_0x594fbf,_0x3805a7){return _0x594fbf['define'](_0x8f37('0xa'),attributes,{'tableName':_0x8f37('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 f0c4c87..ba2331a 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 _0x7f70=['../../config/environment','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','../../mysqldb','../../config/logger','rpc'];(function(_0x366368,_0x31d41e){var _0x43434d=function(_0x61f0d6){while(--_0x61f0d6){_0x366368['push'](_0x366368['shift']());}};_0x43434d(++_0x31d41e);}(_0x7f70,0x1f2));var _0x07f7=function(_0x58711a,_0x1839b0){_0x58711a=_0x58711a-0x0;var _0x55f4be=_0x7f70[_0x58711a];return _0x55f4be;};'use strict';var _=require(_0x07f7('0x0'));var util=require(_0x07f7('0x1'));var moment=require(_0x07f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x07f7('0x4'))(_0x07f7('0x5'));var config=require(_0x07f7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x07f7('0x7')][_0x07f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1794a7,_0x1e9b31,_0x1d379e){return new BPromise(function(_0x2c100c,_0xeea51){return client[_0x07f7('0x9')](_0x1794a7,_0x1d379e)[_0x07f7('0xa')](function(_0x1a5843){logger['info'](_0x07f7('0xb'),_0x1e9b31,_0x07f7('0xc'));logger[_0x07f7('0xd')](_0x07f7('0xe'),_0x1e9b31,_0x07f7('0xc'),JSON[_0x07f7('0xf')](_0x1a5843));if(_0x1a5843['error']){if(_0x1a5843[_0x07f7('0x10')][_0x07f7('0x11')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1e9b31,_0x1a5843[_0x07f7('0x10')][_0x07f7('0x12')]);return _0xeea51(_0x1a5843['error'][_0x07f7('0x12')]);}logger['error'](_0x07f7('0xb'),_0x1e9b31,_0x1a5843[_0x07f7('0x10')][_0x07f7('0x12')]);return _0x2c100c(_0x1a5843[_0x07f7('0x10')]['message']);}else{logger[_0x07f7('0x13')](_0x07f7('0xb'),_0x1e9b31,_0x07f7('0xc'));_0x2c100c(_0x1a5843[_0x07f7('0x14')][_0x07f7('0x12')]);}})['catch'](function(_0x2524f3){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1e9b31,_0x2524f3);_0xeea51(_0x2524f3);});});} \ No newline at end of file +var _0x6fbd=['stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x136533,_0x41cef9){var _0x2cc80c=function(_0x1169b2){while(--_0x1169b2){_0x136533['push'](_0x136533['shift']());}};_0x2cc80c(++_0x41cef9);}(_0x6fbd,0x156));var _0xd6fb=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x6fbd[_0x382a62];return _0x490a25;};'use strict';var _=require(_0xd6fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd6fb('0x1'));var rs=require(_0xd6fb('0x2'));var fs=require('fs');var Redis=require(_0xd6fb('0x3'));var db=require(_0xd6fb('0x4'))['db'];var utils=require(_0xd6fb('0x5'));var logger=require(_0xd6fb('0x6'))('rpc');var config=require(_0xd6fb('0x7'));var jayson=require(_0xd6fb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x349ea6,_0x19508c,_0x60c05f){return new BPromise(function(_0x5245a3,_0x2ad886){return client[_0xd6fb('0x9')](_0x349ea6,_0x60c05f)[_0xd6fb('0xa')](function(_0x556b23){logger[_0xd6fb('0xb')](_0xd6fb('0xc'),_0x19508c,_0xd6fb('0xd'));logger[_0xd6fb('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x19508c,_0xd6fb('0xd'),JSON[_0xd6fb('0xf')](_0x556b23));if(_0x556b23[_0xd6fb('0x10')]){if(_0x556b23[_0xd6fb('0x10')][_0xd6fb('0x11')]===0x1f4){logger['error'](_0xd6fb('0xc'),_0x19508c,_0x556b23[_0xd6fb('0x10')][_0xd6fb('0x12')]);return _0x2ad886(_0x556b23['error'][_0xd6fb('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x19508c,_0x556b23[_0xd6fb('0x10')][_0xd6fb('0x12')]);return _0x5245a3(_0x556b23[_0xd6fb('0x10')][_0xd6fb('0x12')]);}else{logger[_0xd6fb('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x19508c,_0xd6fb('0xd'));_0x5245a3(_0x556b23[_0xd6fb('0x13')][_0xd6fb('0x12')]);}})[_0xd6fb('0x14')](function(_0x423097){logger['error'](_0xd6fb('0xc'),_0x19508c,_0x423097);_0x2ad886(_0x423097);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ce967da..e7b3c84 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x7cbc3c,_0x2bad4d){var _0x4c4433=function(_0x3f6cbd){while(--_0x3f6cbd){_0x7cbc3c['push'](_0x7cbc3c['shift']());}};_0x4c4433(++_0x2bad4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x413e98,_0x474a51){var _0x4034f5=function(_0x2045ac){while(--_0x2045ac){_0x413e98['push'](_0x413e98['shift']());}};_0x4034f5(++_0x474a51);}(_0x70e0,0x17b));var _0x070e=function(_0x2bd0d6,_0x455ba9){_0x2bd0d6=_0x2bd0d6-0x0;var _0x4fa310=_0x70e0[_0x2bd0d6];return _0x4fa310;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d225442..0ba3cb4 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 _0xb694=['sequelize','exports','INTEGER'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xb694,0xed));var _0x4b69=function(_0x56c8d0,_0x165591){_0x56c8d0=_0x56c8d0-0x0;var _0x3f3021=_0xb694[_0x56c8d0];return _0x3f3021;};'use strict';var Sequelize=require(_0x4b69('0x0'));module[_0x4b69('0x1')]={'penalty':{'type':Sequelize[_0x4b69('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x44cb=['exports','INTEGER'];(function(_0x9d8759,_0x209745){var _0x1b0979=function(_0x7254e0){while(--_0x7254e0){_0x9d8759['push'](_0x9d8759['shift']());}};_0x1b0979(++_0x209745);}(_0x44cb,0xbe));var _0xb44c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x44cb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xb44c('0x0')]={'penalty':{'type':Sequelize[_0xb44c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 035db6d..3a55131 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 _0x4821=['UserMailQueue','user_has_mail_queues','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4821,0x120));var _0x1482=function(_0x528424,_0x191b3b){_0x528424=_0x528424-0x0;var _0xba8820=_0x4821[_0x528424];return _0xba8820;};'use strict';var _=require(_0x1482('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1482('0x1'));var moment=require(_0x1482('0x2'));var BPromise=require(_0x1482('0x3'));var rp=require(_0x1482('0x4'));var fs=require('fs');var path=require(_0x1482('0x5'));var rimraf=require('rimraf');var config=require(_0x1482('0x6'));var attributes=require(_0x1482('0x7'));module[_0x1482('0x8')]=function(_0x5b5bb4,_0x5155a1){return _0x5b5bb4['define'](_0x1482('0x9'),attributes,{'tableName':_0x1482('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4573=['api','moment','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x4573,0x15d));var _0x3457=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3457('0x0'));var util=require('util');var logger=require(_0x3457('0x1'))(_0x3457('0x2'));var moment=require(_0x3457('0x3'));var BPromise=require(_0x3457('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3457('0x5'));var rimraf=require(_0x3457('0x6'));var config=require(_0x3457('0x7'));var attributes=require(_0x3457('0x8'));module[_0x3457('0x9')]=function(_0x156049,_0x391d4c){return _0x156049[_0x3457('0xa')](_0x3457('0xb'),attributes,{'tableName':_0x3457('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index fdeab72..05d505f 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x238198,_0x32a62b){var _0xc8a911=function(_0x1f4d83){while(--_0x1f4d83){_0x238198['push'](_0x238198['shift']());}};_0xc8a911(++_0x32a62b);}(_0x34e8,0x12c));var _0x834e=function(_0x35664a,_0x7a3a11){_0x35664a=_0x35664a-0x0;var _0x336a76=_0x34e8[_0x35664a];return _0x336a76;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x2392ff,_0x3e6cdc){var _0x1eba2e=function(_0x5a9ae2){while(--_0x5a9ae2){_0x2392ff['push'](_0x2392ff['shift']());}};_0x1eba2e(++_0x3e6cdc);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x37ef22,_0x348c92){_0x37ef22=_0x37ef22-0x0;var _0x49eeb3=_0xf3cd[_0x37ef22];return _0x49eeb3;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 463cb28..0712267 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 _0x309c=['../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4606f4,_0x4e6fac){var _0x484323=function(_0x4da50f){while(--_0x4da50f){_0x4606f4['push'](_0x4606f4['shift']());}};_0x484323(++_0x4e6fac);}(_0x309c,0x1f4));var _0xc309=function(_0x11dd7a,_0x35dfb0){_0x11dd7a=_0x11dd7a-0x0;var _0x54aaea=_0x309c[_0x11dd7a];return _0x54aaea;};'use strict';var multer=require(_0xc309('0x0'));var util=require(_0xc309('0x1'));var path=require('path');var timeout=require(_0xc309('0x2'));var express=require(_0xc309('0x3'));var router=express[_0xc309('0x4')]();var fs_extra=require(_0xc309('0x5'));var auth=require(_0xc309('0x6'));var interaction=require(_0xc309('0x7'));var config=require(_0xc309('0x8'));var controller=require(_0xc309('0x9'));router['post']('/',auth[_0xc309('0xa')](),controller[_0xc309('0xb')]);module[_0xc309('0xc')]=router; \ No newline at end of file +var _0xe4ca=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x333f43,_0x4d0507){var _0x21a1a7=function(_0xa350d7){while(--_0xa350d7){_0x333f43['push'](_0x333f43['shift']());}};_0x21a1a7(++_0x4d0507);}(_0xe4ca,0x103));var _0xae4c=function(_0x3bc965,_0x52c306){_0x3bc965=_0x3bc965-0x0;var _0xf6fc28=_0xe4ca[_0x3bc965];return _0xf6fc28;};'use strict';var multer=require(_0xae4c('0x0'));var util=require(_0xae4c('0x1'));var path=require(_0xae4c('0x2'));var timeout=require(_0xae4c('0x3'));var express=require('express');var router=express[_0xae4c('0x4')]();var fs_extra=require(_0xae4c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xae4c('0x6'));var config=require(_0xae4c('0x7'));var controller=require(_0xae4c('0x8'));router[_0xae4c('0x9')]('/',auth[_0xae4c('0xa')](),controller[_0xae4c('0xb')]);module[_0xae4c('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 27f8308..b6ea2ab 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 _0xe2c1=['exports','TEXT','STRING','sequelize'];(function(_0x5e707a,_0x2258f7){var _0x362019=function(_0xbb1ee7){while(--_0xbb1ee7){_0x5e707a['push'](_0x5e707a['shift']());}};_0x362019(++_0x2258f7);}(_0xe2c1,0xd3));var _0x1e2c=function(_0x467e9e,_0x4a6888){_0x467e9e=_0x467e9e-0x0;var _0x10376a=_0xe2c1[_0x467e9e];return _0x10376a;};'use strict';var Sequelize=require(_0x1e2c('0x0'));module[_0x1e2c('0x1')]={'body':{'type':Sequelize[_0x1e2c('0x2')]},'senderName':{'type':Sequelize[_0x1e2c('0x3')]},'recipientsId':{'type':Sequelize[_0x1e2c('0x2')]},'recipientsDescription':{'type':Sequelize[_0x1e2c('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x5fea=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fea,0x81));var _0xa5fe=function(_0x59e7e0,_0x3ec148){_0x59e7e0=_0x59e7e0-0x0;var _0x26b058=_0x5fea[_0x59e7e0];return _0x26b058;};'use strict';var Sequelize=require(_0xa5fe('0x0'));module[_0xa5fe('0x1')]={'body':{'type':Sequelize[_0xa5fe('0x2')]},'senderName':{'type':Sequelize[_0xa5fe('0x3')]},'recipientsId':{'type':Sequelize[_0xa5fe('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa5fe('0x3')]},'beep':{'type':Sequelize[_0xa5fe('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 3d1c4a5..e3e64dc 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 _0xeb21=['Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','sendUserNotification','hasOwnProperty','body','Sequelize','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','model','User','union','queue','replace','all','map','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','end','status','offset','undefined','limit','count'];(function(_0x2423d7,_0xe6ec57){var _0x151d17=function(_0x559e15){while(--_0x559e15){_0x2423d7['push'](_0x2423d7['shift']());}};_0x151d17(++_0xe6ec57);}(_0xeb21,0x105));var _0x1eb2=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xeb21[_0x466247];return _0x4b352e;};'use strict';var emlformat=require(_0x1eb2('0x0'));var rimraf=require(_0x1eb2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1eb2('0x2'));var moment=require(_0x1eb2('0x3'));var BPromise=require(_0x1eb2('0x4'));var Mustache=require(_0x1eb2('0x5'));var util=require(_0x1eb2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1eb2('0x7'));var ejs=require(_0x1eb2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1eb2('0x9'));var squel=require(_0x1eb2('0xa'));var crypto=require(_0x1eb2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1eb2('0xc'));var toCsv=require(_0x1eb2('0x7'));var querystring=require(_0x1eb2('0xd'));var Papa=require(_0x1eb2('0xe'));var Redis=require(_0x1eb2('0xf'));var authService=require(_0x1eb2('0x10'));var qs=require(_0x1eb2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1eb2('0x12'));var logger=require(_0x1eb2('0x13'))('api');var utils=require(_0x1eb2('0x14'));var config=require(_0x1eb2('0x15'));var licenseUtil=require(_0x1eb2('0x16'));var db=require(_0x1eb2('0x17'))['db'];config[_0x1eb2('0x18')]=_[_0x1eb2('0x19')](config['redis'],{'host':_0x1eb2('0x1a'),'port':0x18eb});var socket=require(_0x1eb2('0x1b'))(new Redis(config[_0x1eb2('0x18')]));require(_0x1eb2('0x1c'))[_0x1eb2('0x1d')](socket);function respondWithStatusCode(_0x3d70ec,_0x74b8b6){_0x74b8b6=_0x74b8b6||0xcc;return function(_0x3d8314){if(_0x3d8314){return _0x3d70ec['sendStatus'](_0x74b8b6);}return _0x3d70ec['status'](_0x74b8b6)[_0x1eb2('0x1e')]();};}function respondWithResult(_0x58ae20,_0x465af2){_0x465af2=_0x465af2||0xc8;return function(_0x53ec0f){if(_0x53ec0f){return _0x58ae20[_0x1eb2('0x1f')](_0x465af2)['json'](_0x53ec0f);}};}function respondWithFilteredResult(_0x326ed9,_0x273b41){return function(_0x1b665c){if(_0x1b665c){var _0x2bc534=typeof _0x273b41[_0x1eb2('0x20')]===_0x1eb2('0x21')&&typeof _0x273b41[_0x1eb2('0x22')]===_0x1eb2('0x21');var _0x1c5b02=_0x1b665c['count'];var _0x1f35ed=_0x2bc534?0x0:_0x273b41[_0x1eb2('0x20')];var _0x5a9f79=_0x2bc534?_0x1b665c[_0x1eb2('0x23')]:_0x273b41['offset']+_0x273b41[_0x1eb2('0x22')];var _0x54e984;if(_0x5a9f79>=_0x1c5b02){_0x5a9f79=_0x1c5b02;_0x54e984=0xc8;}else{_0x54e984=0xce;}_0x326ed9[_0x1eb2('0x1f')](_0x54e984);return _0x326ed9['set'](_0x1eb2('0x24'),_0x1f35ed+'-'+_0x5a9f79+'/'+_0x1c5b02)[_0x1eb2('0x25')](_0x1b665c);}return null;};}function patchUpdates(_0x3a3742){return function(_0x1ffc0d){try{jsonpatch['apply'](_0x1ffc0d,_0x3a3742,!![]);}catch(_0x17aa75){return BPromise[_0x1eb2('0x26')](_0x17aa75);}return _0x1ffc0d[_0x1eb2('0x27')]();};}function saveUpdates(_0x38c360,_0x13f29d){return function(_0x246991){if(_0x246991){return _0x246991[_0x1eb2('0x28')](_0x38c360)[_0x1eb2('0x29')](function(_0x30bc5d){return _0x30bc5d;});}return null;};}function removeEntity(_0x1a3c59,_0x36db4a){return function(_0x53fb32){if(_0x53fb32){return _0x53fb32[_0x1eb2('0x2a')]()['then'](function(){_0x1a3c59[_0x1eb2('0x1f')](0xcc)[_0x1eb2('0x1e')]();});}};}function handleEntityNotFound(_0x684185,_0x3e1340){return function(_0x5450c5){if(!_0x5450c5){_0x684185[_0x1eb2('0x2b')](0x194);}return _0x5450c5;};}function handleError(_0x58adf1,_0x306e0b){_0x306e0b=_0x306e0b||0x1f4;return function(_0x5a7279){logger[_0x1eb2('0x2c')](_0x5a7279[_0x1eb2('0x2d')]);if(_0x5a7279['name']){delete _0x5a7279[_0x1eb2('0x2e')];}_0x58adf1[_0x1eb2('0x1f')](_0x306e0b)[_0x1eb2('0x2f')](_0x5a7279);};}exports[_0x1eb2('0x30')]=function(_0x49f8f4,_0x1753c5,_0xb355e0){if(!_0x49f8f4['body'][_0x1eb2('0x31')]('text')&&!_0x49f8f4[_0x1eb2('0x32')][_0x1eb2('0x31')]('TemplateId')){throw new db[(_0x1eb2('0x33'))][(_0x1eb2('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x49f8f4[_0x1eb2('0x32')]['hasOwnProperty'](_0x1eb2('0x35'))&&!_0x49f8f4['body'][_0x1eb2('0x31')](_0x1eb2('0x36'))){throw new db[(_0x1eb2('0x33'))][(_0x1eb2('0x34'))](_0x1eb2('0x37'));}if(!_0x49f8f4['body'][_0x1eb2('0x31')]('recipients')){throw new db[(_0x1eb2('0x33'))][(_0x1eb2('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x34b87b=JSON[_0x1eb2('0x38')](_0x49f8f4[_0x1eb2('0x32')][_0x1eb2('0x39')]);}catch(_0x349f27){logger['error'](_0x349f27);throw new db['Sequelize'][(_0x1eb2('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x34d353=[_0x1eb2('0x3a'),_0x1eb2('0x3b'),_0x1eb2('0x3c'),_0x1eb2('0x3d'),'smsqueue',_0x1eb2('0x3e'),_0x1eb2('0x3f'),_0x1eb2('0x40'),_0x1eb2('0x41')];if(_[_0x1eb2('0x42')](_0x34b87b,function(_0x561727){return!_[_0x1eb2('0x43')](_0x34d353,_0x561727['model'][_0x1eb2('0x44')]());})){throw new db[(_0x1eb2('0x33'))][(_0x1eb2('0x34'))](_0x1eb2('0x45'));}}}var _0x2706c1={};_0x2706c1[_0x1eb2('0x46')]=_0x49f8f4[_0x1eb2('0x32')][_0x1eb2('0x31')](_0x1eb2('0x46'))?_0x49f8f4[_0x1eb2('0x32')][_0x1eb2('0x46')]:_0x49f8f4['user'][_0x1eb2('0x47')];_0x2706c1[_0x1eb2('0x48')]=_[_0x1eb2('0x49')](_0x49f8f4['body'][_0x1eb2('0x48')])?null:_0x49f8f4[_0x1eb2('0x32')][_0x1eb2('0x48')];_0x2706c1[_0x1eb2('0x4a')]=_0x49f8f4[_0x1eb2('0x32')]['beep']||![];_0x2706c1['SenderId']=_0x49f8f4[_0x1eb2('0x41')]['id'];return getContent(_0x49f8f4['body'])[_0x1eb2('0x29')](function(_0x3107bb){_0x2706c1['body']=_0x3107bb;return getRecipients(_0x34b87b);})['then'](function(_0x5ac4d8){_0x2706c1[_0x1eb2('0x4b')]=_[_0x1eb2('0x4c')](_0x5ac4d8)[_0x1eb2('0x4d')](',');return db[_0x1eb2('0x4e')][_0x1eb2('0x4f')](function(_0x1dd61b){return db[_0x1eb2('0x50')][_0x1eb2('0x51')](_0x2706c1,{'raw':!![],'transaction':_0x1dd61b})['then'](function(_0xb279e6){var _0x19fe54={'sender':_0x2706c1[_0x1eb2('0x46')],'description':_0x2706c1[_0x1eb2('0x48')],'content':_0x2706c1[_0x1eb2('0x32')],'beep':_0x2706c1['beep']};_0x5ac4d8[_0x1eb2('0x52')](function(_0x4b1add){_0x19fe54['recipient']=_0x4b1add;socket['emit'](_0x1eb2('0x53'),_0x19fe54);});return _0xb279e6;});});})[_0x1eb2('0x29')](respondWithResult(_0x1753c5,0xc9))['catch'](handleError(_0x1753c5,null));};function getContent(_0x118aa5){return new BPromise(function(_0x543fce,_0x1a7fb0){if(_0x118aa5[_0x1eb2('0x54')]){_0x543fce(_0x118aa5[_0x1eb2('0x54')]);return;}return db[_0x1eb2('0x55')][_0x1eb2('0x56')]({'attributes':[_0x1eb2('0x57')],'where':{'id':_0x118aa5[_0x1eb2('0x35')]},'raw':!![]})[_0x1eb2('0x29')](function(_0x2b3043){if(!_0x2b3043)throw new db[(_0x1eb2('0x33'))][(_0x1eb2('0x34'))](_0x1eb2('0x58'));var _0x54cf44=Mustache[_0x1eb2('0x59')](_0x2b3043[_0x1eb2('0x57')],_0x118aa5[_0x1eb2('0x36')]);_0x543fce(_0x54cf44);})[_0x1eb2('0x5a')](function(_0x1de592){_0x1a7fb0(_0x1de592);});});}function getRecipients(_0x30e317){return new BPromise(function(_0x58fe07,_0x55c42c){var _0x48cff8=[];var _0x43add8=[];_0x30e317[_0x1eb2('0x52')](function(_0x3fa280){var _0x543447=_[_0x1eb2('0x5b')](_0x3fa280[_0x1eb2('0x5c')][_0x1eb2('0x44')]());if(_0x543447===_0x1eb2('0x5d')){_0x48cff8=_[_0x1eb2('0x5e')](_0x48cff8,_0x3fa280['ids']);}else{if(_[_0x1eb2('0x43')](_0x543447,_0x1eb2('0x5f')))_0x543447=_0x543447[_0x1eb2('0x60')]('queue','Queue');_0x3fa280['ids'][_0x1eb2('0x52')](function(_0x590fe2){_0x43add8['push'](getAgents(_0x543447,_0x590fe2));});}});return BPromise[_0x1eb2('0x61')](_0x43add8)[_0x1eb2('0x29')](function(_0x1f344d){_0x48cff8=_[_0x1eb2('0x5e')](_0x48cff8,_['flatten'](_0x1f344d));_0x58fe07(_0x48cff8);})[_0x1eb2('0x5a')](function(_0x5183b0){_0x55c42c(_0x5183b0);});});}function getAgents(_0x22153f,_0x5cf484){return new BPromise(function(_0x43e391,_0x46817d){return db[_0x22153f][_0x1eb2('0x56')]({'where':{'id':_0x5cf484}})['then'](function(_0x39c986){return _0x39c986['getAgents']({'attributes':['id'],'raw':!![]})[_0x1eb2('0x29')](function(_0x4ff712){var _0x2410cd=_[_0x1eb2('0x62')](_0x4ff712,'id');_0x43e391(_0x2410cd);});})[_0x1eb2('0x5a')](function(_0x5ea89e){_0x46817d(_0x5ea89e);});});} \ No newline at end of file +var _0xb029=['union','includes','queue','replace','Queue','ids','push','all','flatten','catch','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','send','sendUserNotification','text','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','voicequeue','whatsappqueue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User'];(function(_0x496689,_0x1e92ad){var _0x3badef=function(_0x2ba90c){while(--_0x2ba90c){_0x496689['push'](_0x496689['shift']());}};_0x3badef(++_0x1e92ad);}(_0xb029,0x13e));var _0x9b02=function(_0x48b6ef,_0x55bc21){_0x48b6ef=_0x48b6ef-0x0;var _0x4838cd=_0xb029[_0x48b6ef];return _0x4838cd;};'use strict';var emlformat=require(_0x9b02('0x0'));var rimraf=require(_0x9b02('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b02('0x2'));var rp=require(_0x9b02('0x3'));var moment=require(_0x9b02('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9b02('0x5'));var util=require('util');var path=require(_0x9b02('0x6'));var sox=require('sox');var csv=require(_0x9b02('0x7'));var ejs=require(_0x9b02('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b02('0x9'));var squel=require(_0x9b02('0xa'));var crypto=require(_0x9b02('0xb'));var jsforce=require(_0x9b02('0xc'));var deskjs=require(_0x9b02('0xd'));var toCsv=require(_0x9b02('0x7'));var querystring=require(_0x9b02('0xe'));var Papa=require(_0x9b02('0xf'));var Redis=require(_0x9b02('0x10'));var authService=require(_0x9b02('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9b02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b02('0x13'))('api');var utils=require(_0x9b02('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9b02('0x15'));var db=require(_0x9b02('0x16'))['db'];config[_0x9b02('0x17')]=_[_0x9b02('0x18')](config['redis'],{'host':_0x9b02('0x19'),'port':0x18eb});var socket=require(_0x9b02('0x1a'))(new Redis(config['redis']));require('./userNotification.socket')[_0x9b02('0x1b')](socket);function respondWithStatusCode(_0x1ca48a,_0x2d54b4){_0x2d54b4=_0x2d54b4||0xcc;return function(_0x46029e){if(_0x46029e){return _0x1ca48a[_0x9b02('0x1c')](_0x2d54b4);}return _0x1ca48a[_0x9b02('0x1d')](_0x2d54b4)[_0x9b02('0x1e')]();};}function respondWithResult(_0x4dd664,_0x25f53c){_0x25f53c=_0x25f53c||0xc8;return function(_0x3a9826){if(_0x3a9826){return _0x4dd664['status'](_0x25f53c)[_0x9b02('0x1f')](_0x3a9826);}};}function respondWithFilteredResult(_0x173bc5,_0x48027){return function(_0x2ebe4d){if(_0x2ebe4d){var _0x276654=typeof _0x48027[_0x9b02('0x20')]===_0x9b02('0x21')&&typeof _0x48027[_0x9b02('0x22')]===_0x9b02('0x21');var _0x470697=_0x2ebe4d['count'];var _0x2aeaa1=_0x276654?0x0:_0x48027[_0x9b02('0x20')];var _0x4d4570=_0x276654?_0x2ebe4d[_0x9b02('0x23')]:_0x48027[_0x9b02('0x20')]+_0x48027['limit'];var _0x4893f7;if(_0x4d4570>=_0x470697){_0x4d4570=_0x470697;_0x4893f7=0xc8;}else{_0x4893f7=0xce;}_0x173bc5[_0x9b02('0x1d')](_0x4893f7);return _0x173bc5[_0x9b02('0x24')]('Content-Range',_0x2aeaa1+'-'+_0x4d4570+'/'+_0x470697)[_0x9b02('0x1f')](_0x2ebe4d);}return null;};}function patchUpdates(_0x2c7be2){return function(_0x152586){try{jsonpatch[_0x9b02('0x25')](_0x152586,_0x2c7be2,!![]);}catch(_0x390067){return BPromise['reject'](_0x390067);}return _0x152586['save']();};}function saveUpdates(_0x293cb1,_0xada5fb){return function(_0x1bf6ce){if(_0x1bf6ce){return _0x1bf6ce[_0x9b02('0x26')](_0x293cb1)[_0x9b02('0x27')](function(_0x46a380){return _0x46a380;});}return null;};}function removeEntity(_0x49e3de,_0xfa06ac){return function(_0x2db152){if(_0x2db152){return _0x2db152[_0x9b02('0x28')]()[_0x9b02('0x27')](function(){_0x49e3de[_0x9b02('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1245ae,_0x143ead){return function(_0x342452){if(!_0x342452){_0x1245ae[_0x9b02('0x1c')](0x194);}return _0x342452;};}function handleError(_0x4e1271,_0x246cbd){_0x246cbd=_0x246cbd||0x1f4;return function(_0x2f0416){logger[_0x9b02('0x29')](_0x2f0416[_0x9b02('0x2a')]);if(_0x2f0416[_0x9b02('0x2b')]){delete _0x2f0416[_0x9b02('0x2b')];}_0x4e1271[_0x9b02('0x1d')](_0x246cbd)[_0x9b02('0x2c')](_0x2f0416);};}exports[_0x9b02('0x2d')]=function(_0xcc35d0,_0xa88e4f,_0x36088f){if(!_0xcc35d0['body']['hasOwnProperty'](_0x9b02('0x2e'))&&!_0xcc35d0[_0x9b02('0x2f')][_0x9b02('0x30')]('TemplateId')){throw new db[(_0x9b02('0x31'))][(_0x9b02('0x32'))](_0x9b02('0x33'));}else{if(_0xcc35d0[_0x9b02('0x2f')][_0x9b02('0x30')](_0x9b02('0x34'))&&!_0xcc35d0[_0x9b02('0x2f')][_0x9b02('0x30')](_0x9b02('0x35'))){throw new db[(_0x9b02('0x31'))][(_0x9b02('0x32'))](_0x9b02('0x36'));}if(!_0xcc35d0['body']['hasOwnProperty'](_0x9b02('0x37'))){throw new db[(_0x9b02('0x31'))]['ValidationError'](_0x9b02('0x38'));}else{try{var _0x552274=JSON[_0x9b02('0x39')](_0xcc35d0[_0x9b02('0x2f')][_0x9b02('0x37')]);}catch(_0x409ae3){logger[_0x9b02('0x29')](_0x409ae3);throw new db[(_0x9b02('0x31'))][(_0x9b02('0x32'))](_0x9b02('0x3a'));}var _0x2c01af=[_0x9b02('0x3b'),'faxqueue','mailqueue',_0x9b02('0x3c'),'smsqueue',_0x9b02('0x3d'),_0x9b02('0x3e'),'team',_0x9b02('0x3f')];if(_[_0x9b02('0x40')](_0x552274,function(_0x2ed75e){return!_['includes'](_0x2c01af,_0x2ed75e[_0x9b02('0x41')][_0x9b02('0x42')]());})){throw new db[(_0x9b02('0x31'))][(_0x9b02('0x32'))](_0x9b02('0x43'));}}}var _0x27e71d={};_0x27e71d[_0x9b02('0x44')]=_0xcc35d0[_0x9b02('0x2f')][_0x9b02('0x30')](_0x9b02('0x44'))?_0xcc35d0[_0x9b02('0x2f')][_0x9b02('0x44')]:_0xcc35d0[_0x9b02('0x3f')][_0x9b02('0x45')];_0x27e71d[_0x9b02('0x46')]=_[_0x9b02('0x47')](_0xcc35d0[_0x9b02('0x2f')][_0x9b02('0x46')])?null:_0xcc35d0['body'][_0x9b02('0x46')];_0x27e71d['beep']=_0xcc35d0[_0x9b02('0x2f')][_0x9b02('0x48')]||![];_0x27e71d[_0x9b02('0x49')]=_0xcc35d0[_0x9b02('0x3f')]['id'];return getContent(_0xcc35d0[_0x9b02('0x2f')])[_0x9b02('0x27')](function(_0x1ef56f){_0x27e71d[_0x9b02('0x2f')]=_0x1ef56f;return getRecipients(_0x552274);})[_0x9b02('0x27')](function(_0xd3ca31){_0x27e71d[_0x9b02('0x4a')]=_[_0x9b02('0x4b')](_0xd3ca31)[_0x9b02('0x4c')](',');return db[_0x9b02('0x4d')][_0x9b02('0x4e')](function(_0x4425b1){return db[_0x9b02('0x4f')][_0x9b02('0x50')](_0x27e71d,{'raw':!![],'transaction':_0x4425b1})[_0x9b02('0x27')](function(_0x16341d){var _0x1d23be={'sender':_0x27e71d[_0x9b02('0x44')],'description':_0x27e71d[_0x9b02('0x46')],'content':_0x27e71d[_0x9b02('0x2f')],'beep':_0x27e71d[_0x9b02('0x48')]};_0xd3ca31[_0x9b02('0x51')](function(_0x19936d){_0x1d23be[_0x9b02('0x52')]=_0x19936d;socket['emit'](_0x9b02('0x53'),_0x1d23be);});return _0x16341d;});});})[_0x9b02('0x27')](respondWithResult(_0xa88e4f,0xc9))['catch'](handleError(_0xa88e4f,null));};function getContent(_0x3d9608){return new BPromise(function(_0x2b9f79,_0x4c8e27){if(_0x3d9608[_0x9b02('0x2e')]){_0x2b9f79(_0x3d9608[_0x9b02('0x2e')]);return;}return db[_0x9b02('0x54')][_0x9b02('0x55')]({'attributes':[_0x9b02('0x56')],'where':{'id':_0x3d9608[_0x9b02('0x34')]},'raw':!![]})['then'](function(_0x343320){if(!_0x343320)throw new db[(_0x9b02('0x31'))][(_0x9b02('0x32'))](_0x9b02('0x57'));var _0x5c0f50=Mustache[_0x9b02('0x58')](_0x343320[_0x9b02('0x56')],_0x3d9608[_0x9b02('0x35')]);_0x2b9f79(_0x5c0f50);})['catch'](function(_0x403da2){_0x4c8e27(_0x403da2);});});}function getRecipients(_0x51433b){return new BPromise(function(_0x1ff049,_0x428da1){var _0x25a29c=[];var _0x167a0a=[];_0x51433b[_0x9b02('0x51')](function(_0xc92ef7){var _0x39040a=_['startCase'](_0xc92ef7[_0x9b02('0x41')][_0x9b02('0x42')]());if(_0x39040a===_0x9b02('0x59')){_0x25a29c=_[_0x9b02('0x5a')](_0x25a29c,_0xc92ef7['ids']);}else{if(_[_0x9b02('0x5b')](_0x39040a,_0x9b02('0x5c')))_0x39040a=_0x39040a[_0x9b02('0x5d')]('queue',_0x9b02('0x5e'));_0xc92ef7[_0x9b02('0x5f')][_0x9b02('0x51')](function(_0x4ab5bb){_0x167a0a[_0x9b02('0x60')](getAgents(_0x39040a,_0x4ab5bb));});}});return BPromise[_0x9b02('0x61')](_0x167a0a)[_0x9b02('0x27')](function(_0x32ece4){_0x25a29c=_[_0x9b02('0x5a')](_0x25a29c,_[_0x9b02('0x62')](_0x32ece4));_0x1ff049(_0x25a29c);})[_0x9b02('0x63')](function(_0x4b4af1){_0x428da1(_0x4b4af1);});});}function getAgents(_0x13fcee,_0x48b8e1){return new BPromise(function(_0x4b66a8,_0x2c875a){return db[_0x13fcee][_0x9b02('0x55')]({'where':{'id':_0x48b8e1}})[_0x9b02('0x27')](function(_0x3d7cba){return _0x3d7cba[_0x9b02('0x64')]({'attributes':['id'],'raw':!![]})[_0x9b02('0x27')](function(_0x41c936){var _0x47a748=_[_0x9b02('0x65')](_0x41c936,'id');_0x4b66a8(_0x47a748);});})[_0x9b02('0x63')](function(_0x319520){_0x2c875a(_0x319520);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 6255c42..30c9ec3 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 _0x4c56=['exports','events','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x202fbc,_0x1dc06b){var _0x26de3b=function(_0x5b9ab9){while(--_0x5b9ab9){_0x202fbc['push'](_0x202fbc['shift']());}};_0x26de3b(++_0x1dc06b);}(_0x4c56,0x149));var _0x64c5=function(_0x38bd52,_0x4dbeeb){_0x38bd52=_0x38bd52-0x0;var _0x2cedbc=_0x4c56[_0x38bd52];return _0x2cedbc;};'use strict';var EventEmitter=require(_0x64c5('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x64c5('0x1')](0x0);var events={'afterCreate':_0x64c5('0x2'),'afterUpdate':'update','afterDestroy':_0x64c5('0x3')};function emitEvent(_0x3ddf67){return function(_0x141622,_0x372d60,_0x451a72){UserNotificationEvents[_0x64c5('0x4')](_0x3ddf67+':'+_0x141622['id'],_0x141622);UserNotificationEvents[_0x64c5('0x4')](_0x3ddf67,_0x141622);_0x451a72(null);};}for(var e in events){if(events[_0x64c5('0x5')](e)){var event=events[e];UserNotification[_0x64c5('0x6')](e,emitEvent(event));}}module[_0x64c5('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x3f65=['hasOwnProperty','hook','events','UserNotification','save','update','remove','emit'];(function(_0x2e57e6,_0x1ff615){var _0x280360=function(_0x3a1fd2){while(--_0x3a1fd2){_0x2e57e6['push'](_0x2e57e6['shift']());}};_0x280360(++_0x1ff615);}(_0x3f65,0x1d2));var _0x53f6=function(_0x55ca56,_0x3c72fd){_0x55ca56=_0x55ca56-0x0;var _0x3d684e=_0x3f65[_0x55ca56];return _0x3d684e;};'use strict';var EventEmitter=require(_0x53f6('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x53f6('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53f6('0x2'),'afterUpdate':_0x53f6('0x3'),'afterDestroy':_0x53f6('0x4')};function emitEvent(_0xa49e9d){return function(_0x42a049,_0x23bab5,_0x2abffb){UserNotificationEvents[_0x53f6('0x5')](_0xa49e9d+':'+_0x42a049['id'],_0x42a049);UserNotificationEvents['emit'](_0xa49e9d,_0x42a049);_0x2abffb(null);};}for(var e in events){if(events[_0x53f6('0x6')](e)){var event=events[e];UserNotification[_0x53f6('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 8cde4c2..28e2452 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 _0xbd9a=['rimraf','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path'];(function(_0x2571c1,_0x4a2e9a){var _0x485656=function(_0x484341){while(--_0x484341){_0x2571c1['push'](_0x2571c1['shift']());}};_0x485656(++_0x4a2e9a);}(_0xbd9a,0x157));var _0xabd9=function(_0x545ed1,_0x34434f){_0x545ed1=_0x545ed1-0x0;var _0xe84d15=_0xbd9a[_0x545ed1];return _0xe84d15;};'use strict';var _=require(_0xabd9('0x0'));var util=require('util');var logger=require(_0xabd9('0x1'))('api');var moment=require(_0xabd9('0x2'));var BPromise=require('bluebird');var rp=require(_0xabd9('0x3'));var fs=require('fs');var path=require(_0xabd9('0x4'));var rimraf=require(_0xabd9('0x5'));var config=require('../../config/environment');var attributes=require(_0xabd9('0x6'));module[_0xabd9('0x7')]=function(_0x311774,_0x51c847){return _0x311774[_0xabd9('0x8')]('UserNotification',attributes,{'tableName':_0xabd9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabd9('0xa'),'collate':_0xabd9('0xb')});}; \ No newline at end of file +var _0x0ade=['define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./userNotification.attributes','exports'];(function(_0x9a0215,_0x59f457){var _0x436a17=function(_0x2555d3){while(--_0x2555d3){_0x9a0215['push'](_0x9a0215['shift']());}};_0x436a17(++_0x59f457);}(_0x0ade,0x1dc));var _0xe0ad=function(_0x2d8911,_0x3049f2){_0x2d8911=_0x2d8911-0x0;var _0x37f127=_0x0ade[_0x2d8911];return _0x37f127;};'use strict';var _=require(_0xe0ad('0x0'));var util=require('util');var logger=require(_0xe0ad('0x1'))(_0xe0ad('0x2'));var moment=require('moment');var BPromise=require(_0xe0ad('0x3'));var rp=require(_0xe0ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0ad('0x5'));var config=require('../../config/environment');var attributes=require(_0xe0ad('0x6'));module[_0xe0ad('0x7')]=function(_0x28ee64,_0x4a4d29){return _0x28ee64[_0xe0ad('0x8')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe0ad('0x9'),'collate':_0xe0ad('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 84b7ddf..b39630d 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 _0x4853=['defaults','register','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x30806e,_0x41bb0d){var _0x2777c6=function(_0x2557b6){while(--_0x2557b6){_0x30806e['push'](_0x30806e['shift']());}};_0x2777c6(++_0x41bb0d);}(_0x4853,0x12b));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3485('0x0'));var util=require(_0x3485('0x1'));var moment=require(_0x3485('0x2'));var BPromise=require(_0x3485('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3485('0x4'))['db'];var utils=require(_0x3485('0x5'));var logger=require(_0x3485('0x6'))(_0x3485('0x7'));var config=require(_0x3485('0x8'));var jayson=require(_0x3485('0x9'));var client=jayson[_0x3485('0xa')][_0x3485('0xb')]({'port':0x232a});config[_0x3485('0xc')]=_[_0x3485('0xd')](config[_0x3485('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3485('0xc')]));require('./userNotification.socket')[_0x3485('0xe')](socket);function respondWithRpcPromise(_0x1eef34,_0x424e1e,_0xd8efed){return new BPromise(function(_0x542a5f,_0xd91fed){return client['request'](_0x1eef34,_0xd8efed)[_0x3485('0xf')](function(_0x343dd5){logger[_0x3485('0x10')](_0x3485('0x11'),_0x424e1e,'request\x20sent');logger[_0x3485('0x12')](_0x3485('0x13'),_0x424e1e,_0x3485('0x14'),JSON[_0x3485('0x15')](_0x343dd5));if(_0x343dd5[_0x3485('0x16')]){if(_0x343dd5[_0x3485('0x16')]['code']===0x1f4){logger['error'](_0x3485('0x11'),_0x424e1e,_0x343dd5[_0x3485('0x16')][_0x3485('0x17')]);return _0xd91fed(_0x343dd5[_0x3485('0x16')][_0x3485('0x17')]);}logger[_0x3485('0x16')]('UserNotification,\x20%s,\x20%s',_0x424e1e,_0x343dd5['error']['message']);return _0x542a5f(_0x343dd5[_0x3485('0x16')][_0x3485('0x17')]);}else{logger[_0x3485('0x10')](_0x3485('0x11'),_0x424e1e,_0x3485('0x14'));_0x542a5f(_0x343dd5[_0x3485('0x18')][_0x3485('0x17')]);}})[_0x3485('0x19')](function(_0x105fbd){logger[_0x3485('0x16')](_0x3485('0x11'),_0x424e1e,_0x105fbd);_0xd91fed(_0x105fbd);});});} \ No newline at end of file +var _0x519a=['bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./userNotification.socket','register','then','info','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','UserNotification,\x20%s,\x20%s','catch','lodash','moment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x519a,0xda));var _0xa519=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x519a[_0x25c326];return _0x762452;};'use strict';var _=require(_0xa519('0x0'));var util=require('util');var moment=require(_0xa519('0x1'));var BPromise=require(_0xa519('0x2'));var rs=require(_0xa519('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa519('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa519('0x5'))('rpc');var config=require(_0xa519('0x6'));var jayson=require(_0xa519('0x7'));var client=jayson[_0xa519('0x8')]['http']({'port':0x232a});config[_0xa519('0x9')]=_['defaults'](config['redis'],{'host':_0xa519('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa519('0x9')]));require(_0xa519('0xb'))[_0xa519('0xc')](socket);function respondWithRpcPromise(_0x15937c,_0x36e89f,_0x26a4ec){return new BPromise(function(_0x20fe4d,_0x441357){return client['request'](_0x15937c,_0x26a4ec)[_0xa519('0xd')](function(_0x172f00){logger[_0xa519('0xe')]('UserNotification,\x20%s,\x20%s',_0x36e89f,_0xa519('0xf'));logger['debug'](_0xa519('0x10'),_0x36e89f,_0xa519('0xf'),JSON['stringify'](_0x172f00));if(_0x172f00['error']){if(_0x172f00[_0xa519('0x11')][_0xa519('0x12')]===0x1f4){logger[_0xa519('0x11')]('UserNotification,\x20%s,\x20%s',_0x36e89f,_0x172f00[_0xa519('0x11')][_0xa519('0x13')]);return _0x441357(_0x172f00[_0xa519('0x11')][_0xa519('0x13')]);}logger[_0xa519('0x11')]('UserNotification,\x20%s,\x20%s',_0x36e89f,_0x172f00[_0xa519('0x11')][_0xa519('0x13')]);return _0x20fe4d(_0x172f00[_0xa519('0x11')]['message']);}else{logger[_0xa519('0xe')](_0xa519('0x14'),_0x36e89f,'request\x20sent');_0x20fe4d(_0x172f00['result']['message']);}})[_0xa519('0x15')](function(_0x520f1c){logger[_0xa519('0x11')](_0xa519('0x14'),_0x36e89f,_0x520f1c);_0x441357(_0x520f1c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 97582a9..0c16709 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 _0xbb33=['userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2b9f2f,_0x3fdd23){var _0x2cfff5=function(_0x4c4aae){while(--_0x4c4aae){_0x2b9f2f['push'](_0x2b9f2f['shift']());}};_0x2cfff5(++_0x3fdd23);}(_0xbb33,0xa3));var _0x3bb3=function(_0x241099,_0x2997a9){_0x241099=_0x241099-0x0;var _0x164e96=_0xbb33[_0x241099];return _0x164e96;};'use strict';var UserNotificationEvents=require(_0x3bb3('0x0'));var events=[_0x3bb3('0x1'),_0x3bb3('0x2'),_0x3bb3('0x3')];function createListener(_0x1f820b,_0x4a565e){return function(_0x5e40b2){_0x4a565e[_0x3bb3('0x4')](_0x1f820b,_0x5e40b2);};}function removeListener(_0x33fabf,_0x48d074){return function(){UserNotificationEvents[_0x3bb3('0x5')](_0x33fabf,_0x48d074);};}exports[_0x3bb3('0x6')]=function(_0x3bee19){for(var _0x280166=0x0,_0x22574=events[_0x3bb3('0x7')];_0x280166<_0x22574;_0x280166++){var _0x24c865=events[_0x280166];var _0x1a55b9=createListener(_0x3bb3('0x8')+_0x24c865,_0x3bee19);UserNotificationEvents['on'](_0x24c865,_0x1a55b9);}}; \ No newline at end of file +var _0xa319=['update','emit','length','userNotification:','./userNotification.events','remove'];(function(_0x1abea2,_0x2d56bb){var _0x558b0d=function(_0x34f283){while(--_0x34f283){_0x1abea2['push'](_0x1abea2['shift']());}};_0x558b0d(++_0x2d56bb);}(_0xa319,0x1c0));var _0x9a31=function(_0x15da88,_0x3ef3f3){_0x15da88=_0x15da88-0x0;var _0x48ef1d=_0xa319[_0x15da88];return _0x48ef1d;};'use strict';var UserNotificationEvents=require(_0x9a31('0x0'));var events=['save',_0x9a31('0x1'),_0x9a31('0x2')];function createListener(_0x3a9d59,_0x10b210){return function(_0x341f54){_0x10b210[_0x9a31('0x3')](_0x3a9d59,_0x341f54);};}function removeListener(_0x49c642,_0x5bd574){return function(){UserNotificationEvents['removeListener'](_0x49c642,_0x5bd574);};}exports['register']=function(_0x592d1a){for(var _0x564be0=0x0,_0x2e7402=events[_0x9a31('0x4')];_0x564be0<_0x2e7402;_0x564be0++){var _0x1acb1c=events[_0x564be0];var _0x51cd2d=createListener(_0x9a31('0x5')+_0x1acb1c,_0x592d1a);UserNotificationEvents['on'](_0x1acb1c,_0x51cd2d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 57eeec6..9c66d88 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x53d616,_0x190b1a){var _0x136650=function(_0x2b8188){while(--_0x2b8188){_0x53d616['push'](_0x53d616['shift']());}};_0x136650(++_0x190b1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3bd961,_0x26f947){var _0xbeeb8e=function(_0x3c2a17){while(--_0x3c2a17){_0x3bd961['push'](_0x3bd961['shift']());}};_0xbeeb8e(++_0x26f947);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 e9d12a6..03e904e 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 _0x6ef0=['exports'];(function(_0x5233e9,_0xa42e8e){var _0x1f030b=function(_0x23fae8){while(--_0x23fae8){_0x5233e9['push'](_0x5233e9['shift']());}};_0x1f030b(++_0xa42e8e);}(_0x6ef0,0x100));var _0x06ef=function(_0x52a51b,_0x5be17c){_0x52a51b=_0x52a51b-0x0;var _0x25ef0f=_0x6ef0[_0x52a51b];return _0x25ef0f;};'use strict';var Sequelize=require('sequelize');module[_0x06ef('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd7ad=['sequelize','exports'];(function(_0x59fa8d,_0x26c14f){var _0x5d89e6=function(_0x4102e5){while(--_0x4102e5){_0x59fa8d['push'](_0x59fa8d['shift']());}};_0x5d89e6(++_0x26c14f);}(_0xd7ad,0x15c));var _0xdd7a=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0xd7ad[_0x5519a9];return _0x32f2cc;};'use strict';var Sequelize=require(_0xdd7a('0x0'));module[_0xdd7a('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 c59a4af..ebaf27f 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 _0xf13c=['api','moment','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x562c92,_0x3e518d){var _0x2cf254=function(_0x10e224){while(--_0x10e224){_0x562c92['push'](_0x562c92['shift']());}};_0x2cf254(++_0x3e518d);}(_0xf13c,0x1d2));var _0xcf13=function(_0xf84870,_0x4dc38f){_0xf84870=_0xf84870-0x0;var _0x4541a4=_0xf13c[_0xf84870];return _0x4541a4;};'use strict';var _=require(_0xcf13('0x0'));var util=require(_0xcf13('0x1'));var logger=require('../../config/logger')(_0xcf13('0x2'));var moment=require(_0xcf13('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf13('0x4'));var fs=require('fs');var path=require(_0xcf13('0x5'));var rimraf=require('rimraf');var config=require(_0xcf13('0x6'));var attributes=require(_0xcf13('0x7'));module[_0xcf13('0x8')]=function(_0x4c0873,_0x4685d9){return _0x4c0873[_0xcf13('0x9')](_0xcf13('0xa'),attributes,{'tableName':_0xcf13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf62e=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf62e,0x13c));var _0xef62=function(_0x2689ec,_0x5de592){_0x2689ec=_0x2689ec-0x0;var _0x1e58bf=_0xf62e[_0x2689ec];return _0x1e58bf;};'use strict';var _=require(_0xef62('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xef62('0x1'));var BPromise=require(_0xef62('0x2'));var rp=require(_0xef62('0x3'));var fs=require('fs');var path=require(_0xef62('0x4'));var rimraf=require(_0xef62('0x5'));var config=require(_0xef62('0x6'));var attributes=require(_0xef62('0x7'));module[_0xef62('0x8')]=function(_0xb90caa,_0x3cdf16){return _0xb90caa[_0xef62('0x9')](_0xef62('0xa'),attributes,{'tableName':_0xef62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index f60ed4a..ac74fc5 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 _0xd439=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x3f1385,_0x3620ff){var _0x5e13d0=function(_0x13680a){while(--_0x13680a){_0x3f1385['push'](_0x3f1385['shift']());}};_0x5e13d0(++_0x3620ff);}(_0xd439,0x1ab));var _0x9d43=function(_0x411642,_0x1b4280){_0x411642=_0x411642-0x0;var _0x3b176e=_0xd439[_0x411642];return _0x3b176e;};'use strict';var _=require('lodash');var util=require(_0x9d43('0x0'));var moment=require(_0x9d43('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d43('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d43('0x3'))['db'];var utils=require(_0x9d43('0x4'));var logger=require(_0x9d43('0x5'))('rpc');var config=require(_0x9d43('0x6'));var jayson=require(_0x9d43('0x7'));var client=jayson[_0x9d43('0x8')][_0x9d43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x227b14,_0x5d155c,_0x24cec4){return new BPromise(function(_0x2f4145,_0x23cdaa){return client[_0x9d43('0xa')](_0x227b14,_0x24cec4)[_0x9d43('0xb')](function(_0x2add14){logger[_0x9d43('0xc')](_0x9d43('0xd'),_0x5d155c,'request\x20sent');logger['debug'](_0x9d43('0xe'),_0x5d155c,_0x9d43('0xf'),JSON['stringify'](_0x2add14));if(_0x2add14[_0x9d43('0x10')]){if(_0x2add14['error'][_0x9d43('0x11')]===0x1f4){logger[_0x9d43('0x10')](_0x9d43('0xd'),_0x5d155c,_0x2add14[_0x9d43('0x10')][_0x9d43('0x12')]);return _0x23cdaa(_0x2add14['error'][_0x9d43('0x12')]);}logger[_0x9d43('0x10')](_0x9d43('0xd'),_0x5d155c,_0x2add14['error']['message']);return _0x2f4145(_0x2add14[_0x9d43('0x10')][_0x9d43('0x12')]);}else{logger[_0x9d43('0xc')](_0x9d43('0xd'),_0x5d155c,_0x9d43('0xf'));_0x2f4145(_0x2add14[_0x9d43('0x13')][_0x9d43('0x12')]);}})[_0x9d43('0x14')](function(_0x2d8bac){logger[_0x9d43('0x10')](_0x9d43('0xd'),_0x5d155c,_0x2d8bac);_0x23cdaa(_0x2d8bac);});});} \ No newline at end of file +var _0xf2c3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring'];(function(_0x5f028d,_0x58e47f){var _0x48381b=function(_0x2c97e8){while(--_0x2c97e8){_0x5f028d['push'](_0x5f028d['shift']());}};_0x48381b(++_0x58e47f);}(_0xf2c3,0x75));var _0x3f2c=function(_0x51f8ee,_0x1c1501){_0x51f8ee=_0x51f8ee-0x0;var _0x3b9072=_0xf2c3[_0x51f8ee];return _0x3b9072;};'use strict';var _=require('lodash');var util=require(_0x3f2c('0x0'));var moment=require(_0x3f2c('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f2c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f2c('0x3'))['db'];var utils=require(_0x3f2c('0x4'));var logger=require(_0x3f2c('0x5'))(_0x3f2c('0x6'));var config=require(_0x3f2c('0x7'));var jayson=require(_0x3f2c('0x8'));var client=jayson[_0x3f2c('0x9')][_0x3f2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41de63,_0x13b180,_0x3259ac){return new BPromise(function(_0x244603,_0x1d93bb){return client[_0x3f2c('0xb')](_0x41de63,_0x3259ac)[_0x3f2c('0xc')](function(_0x3cef93){logger[_0x3f2c('0xd')](_0x3f2c('0xe'),_0x13b180,_0x3f2c('0xf'));logger[_0x3f2c('0x10')](_0x3f2c('0x11'),_0x13b180,'request\x20sent',JSON[_0x3f2c('0x12')](_0x3cef93));if(_0x3cef93[_0x3f2c('0x13')]){if(_0x3cef93[_0x3f2c('0x13')][_0x3f2c('0x14')]===0x1f4){logger[_0x3f2c('0x13')](_0x3f2c('0xe'),_0x13b180,_0x3cef93[_0x3f2c('0x13')][_0x3f2c('0x15')]);return _0x1d93bb(_0x3cef93[_0x3f2c('0x13')][_0x3f2c('0x15')]);}logger[_0x3f2c('0x13')](_0x3f2c('0xe'),_0x13b180,_0x3cef93[_0x3f2c('0x13')]['message']);return _0x244603(_0x3cef93[_0x3f2c('0x13')]['message']);}else{logger[_0x3f2c('0xd')](_0x3f2c('0xe'),_0x13b180,_0x3f2c('0xf'));_0x244603(_0x3cef93[_0x3f2c('0x16')]['message']);}})[_0x3f2c('0x17')](function(_0x5c9370){logger[_0x3f2c('0x13')](_0x3f2c('0xe'),_0x13b180,_0x5c9370);_0x1d93bb(_0x5c9370);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 093ea69..b2cf0f8 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 _0x0b08=['delete','destroy','removeSections','exports','multer','util','express','Router','../../components/interaction/service','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','create','post','/:id/clone','addSections','addResources','put'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0x0b08,0x108));var _0x80b0=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x0b08[_0x1f36bb];return _0xaf97fa;};'use strict';var multer=require(_0x80b0('0x0'));var util=require(_0x80b0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x80b0('0x2'));var router=express[_0x80b0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x80b0('0x4'));var config=require('../../config/environment');var controller=require(_0x80b0('0x5'));router[_0x80b0('0x6')]('/',auth['isAuthenticated'](),controller[_0x80b0('0x7')]);router[_0x80b0('0x6')](_0x80b0('0x8'),auth[_0x80b0('0x9')](),controller[_0x80b0('0xa')]);router['get'](_0x80b0('0xb'),auth[_0x80b0('0x9')](),controller[_0x80b0('0xc')]);router['get'](_0x80b0('0xd'),auth[_0x80b0('0x9')](),controller[_0x80b0('0xe')]);router[_0x80b0('0x6')](_0x80b0('0xf'),auth[_0x80b0('0x9')](),controller['getResources']);router['post']('/',auth[_0x80b0('0x9')](),controller[_0x80b0('0x10')]);router[_0x80b0('0x11')](_0x80b0('0x12'),auth[_0x80b0('0x9')](),controller['clone']);router[_0x80b0('0x11')](_0x80b0('0xd'),auth[_0x80b0('0x9')](),controller[_0x80b0('0x13')]);router[_0x80b0('0x11')](_0x80b0('0xf'),auth[_0x80b0('0x9')](),controller[_0x80b0('0x14')]);router[_0x80b0('0x15')]('/:id',auth[_0x80b0('0x9')](),controller['update']);router[_0x80b0('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x80b0('0x17')]);router[_0x80b0('0x16')](_0x80b0('0xd'),auth[_0x80b0('0x9')](),controller[_0x80b0('0x18')]);router[_0x80b0('0x16')]('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module[_0x80b0('0x19')]=router; \ No newline at end of file +var _0x8a6c=['/:id','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','destroy','removeResources','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a6c,0x1bf));var _0xc8a6=function(_0x4a2fa6,_0x89d91){_0x4a2fa6=_0x4a2fa6-0x0;var _0x58419c=_0x8a6c[_0x4a2fa6];return _0x58419c;};'use strict';var multer=require('multer');var util=require(_0xc8a6('0x0'));var path=require(_0xc8a6('0x1'));var timeout=require(_0xc8a6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc8a6('0x3'));var interaction=require(_0xc8a6('0x4'));var config=require('../../config/environment');var controller=require(_0xc8a6('0x5'));router[_0xc8a6('0x6')]('/',auth[_0xc8a6('0x7')](),controller['index']);router[_0xc8a6('0x6')]('/describe',auth[_0xc8a6('0x7')](),controller[_0xc8a6('0x8')]);router[_0xc8a6('0x6')](_0xc8a6('0x9'),auth[_0xc8a6('0x7')](),controller['show']);router[_0xc8a6('0x6')](_0xc8a6('0xa'),auth[_0xc8a6('0x7')](),controller[_0xc8a6('0xb')]);router[_0xc8a6('0x6')](_0xc8a6('0xc'),auth[_0xc8a6('0x7')](),controller[_0xc8a6('0xd')]);router['post']('/',auth[_0xc8a6('0x7')](),controller[_0xc8a6('0xe')]);router[_0xc8a6('0xf')](_0xc8a6('0x10'),auth['isAuthenticated'](),controller[_0xc8a6('0x11')]);router[_0xc8a6('0xf')](_0xc8a6('0xa'),auth[_0xc8a6('0x7')](),controller[_0xc8a6('0x12')]);router[_0xc8a6('0xf')](_0xc8a6('0xc'),auth[_0xc8a6('0x7')](),controller[_0xc8a6('0x13')]);router[_0xc8a6('0x14')](_0xc8a6('0x9'),auth[_0xc8a6('0x7')](),controller[_0xc8a6('0x15')]);router['delete'](_0xc8a6('0x9'),auth[_0xc8a6('0x7')](),controller[_0xc8a6('0x16')]);router['delete']('/:id/sections',auth[_0xc8a6('0x7')](),controller['removeSections']);router['delete'](_0xc8a6('0xc'),auth[_0xc8a6('0x7')](),controller[_0xc8a6('0x17')]);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 de931a4..b220227 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 _0x6c97=['STRING','crudPermissions','getDataValue','split','BOOLEAN'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x6c97,0x16d));var _0x76c9=function(_0x43f5a5,_0x5846ea){_0x43f5a5=_0x43f5a5-0x0;var _0x1172cc=_0x6c97[_0x43f5a5];return _0x1172cc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x76c9('0x0')],'set':function(_0x190fe1){this['setDataValue']('crudPermissions',_0x190fe1?_0x190fe1['join'](''):[]);},'get':function(){return this['getDataValue'](_0x76c9('0x1'))?this[_0x76c9('0x2')](_0x76c9('0x1'))[_0x76c9('0x3')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x76c9('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x76c9('0x4')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x76c9('0x4')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x76c9('0x4')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x76c9('0x4')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x76c9('0x4')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x76c9('0x4')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x76c9('0x4')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x76c9('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7031=['crudPermissions','getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x3504e2,_0x4ab9be){var _0x589d87=function(_0x5965af){while(--_0x5965af){_0x3504e2['push'](_0x3504e2['shift']());}};_0x589d87(++_0x4ab9be);}(_0x7031,0x1c3));var _0x1703=function(_0x5a54f2,_0x774ad6){_0x5a54f2=_0x5a54f2-0x0;var _0x1fffe9=_0x7031[_0x5a54f2];return _0x1fffe9;};'use strict';var Sequelize=require(_0x1703('0x0'));module[_0x1703('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x1703('0x2')],'set':function(_0x35f362){this[_0x1703('0x3')](_0x1703('0x4'),_0x35f362?_0x35f362['join'](''):[]);},'get':function(){return this[_0x1703('0x5')](_0x1703('0x4'))?this[_0x1703('0x5')](_0x1703('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1703('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x1703('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x1703('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x1703('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x1703('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x1703('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1703('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x1703('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1703('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f6ee92e..f0a1b4a 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 _0xe785=['model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','create','body','clone','keys','find','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','update','describe','addSections','userProfileId','each','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','push','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','UserProfile','fieldName','type'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xe785,0x128));var _0x5e78=function(_0xb9268a,_0x1800a2){_0xb9268a=_0xb9268a-0x0;var _0x10d2f9=_0xe785[_0xb9268a];return _0x10d2f9;};'use strict';var emlformat=require(_0x5e78('0x0'));var rimraf=require(_0x5e78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e78('0x2'));var rp=require(_0x5e78('0x3'));var moment=require(_0x5e78('0x4'));var BPromise=require(_0x5e78('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5e78('0x6'));var sox=require(_0x5e78('0x7'));var csv=require(_0x5e78('0x8'));var ejs=require(_0x5e78('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5e78('0xa'));var crypto=require(_0x5e78('0xb'));var jsforce=require(_0x5e78('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5e78('0x8'));var querystring=require('querystring');var Papa=require(_0x5e78('0xd'));var Redis=require('ioredis');var authService=require(_0x5e78('0xe'));var qs=require(_0x5e78('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e78('0x10'));var logger=require(_0x5e78('0x11'))(_0x5e78('0x12'));var utils=require(_0x5e78('0x13'));var config=require(_0x5e78('0x14'));var licenseUtil=require(_0x5e78('0x15'));var db=require(_0x5e78('0x16'))['db'];config['redis']=_[_0x5e78('0x17')](config[_0x5e78('0x18')],{'host':_0x5e78('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e78('0x18')]));require(_0x5e78('0x1a'))[_0x5e78('0x1b')](socket);function respondWithStatusCode(_0x1e49bf,_0x51c20f){_0x51c20f=_0x51c20f||0xcc;return function(_0x4f125f){if(_0x4f125f){return _0x1e49bf[_0x5e78('0x1c')](_0x51c20f);}return _0x1e49bf[_0x5e78('0x1d')](_0x51c20f)[_0x5e78('0x1e')]();};}function respondWithResult(_0x399424,_0x154c7f){_0x154c7f=_0x154c7f||0xc8;return function(_0x493adc){if(_0x493adc){return _0x399424['status'](_0x154c7f)[_0x5e78('0x1f')](_0x493adc);}};}function respondWithFilteredResult(_0x263109,_0x40e31a){return function(_0x5d6063){if(_0x5d6063){var _0x5d2fb9=typeof _0x40e31a['offset']==='undefined'&&typeof _0x40e31a[_0x5e78('0x20')]===_0x5e78('0x21');var _0xe0ccf4=_0x5d6063[_0x5e78('0x22')];var _0x1b6721=_0x5d2fb9?0x0:_0x40e31a[_0x5e78('0x23')];var _0x578a61=_0x5d2fb9?_0x5d6063[_0x5e78('0x22')]:_0x40e31a[_0x5e78('0x23')]+_0x40e31a[_0x5e78('0x20')];var _0x10166e;if(_0x578a61>=_0xe0ccf4){_0x578a61=_0xe0ccf4;_0x10166e=0xc8;}else{_0x10166e=0xce;}_0x263109[_0x5e78('0x1d')](_0x10166e);return _0x263109[_0x5e78('0x24')](_0x5e78('0x25'),_0x1b6721+'-'+_0x578a61+'/'+_0xe0ccf4)[_0x5e78('0x1f')](_0x5d6063);}return null;};}function patchUpdates(_0x56a804){return function(_0x2eb71d){try{jsonpatch[_0x5e78('0x26')](_0x2eb71d,_0x56a804,!![]);}catch(_0x5d001a){return BPromise[_0x5e78('0x27')](_0x5d001a);}return _0x2eb71d[_0x5e78('0x28')]();};}function saveUpdates(_0x3e297e,_0x112773){return function(_0x352536){if(_0x352536){return _0x352536['update'](_0x3e297e)[_0x5e78('0x29')](function(_0x874a24){return _0x874a24;});}return null;};}function removeEntity(_0x454404,_0x3b39f4){return function(_0x363696){if(_0x363696){return _0x363696[_0x5e78('0x2a')]()[_0x5e78('0x29')](function(){_0x454404[_0x5e78('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250618,_0x2de40e){return function(_0x4b540c){if(!_0x4b540c){_0x250618['sendStatus'](0x194);}return _0x4b540c;};}function handleError(_0x4ff829,_0x47b385){_0x47b385=_0x47b385||0x1f4;return function(_0x8d0a4a){logger[_0x5e78('0x2b')](_0x8d0a4a['stack']);if(_0x8d0a4a[_0x5e78('0x2c')]){delete _0x8d0a4a[_0x5e78('0x2c')];}_0x4ff829['status'](_0x47b385)[_0x5e78('0x2d')](_0x8d0a4a);};}exports['index']=function(_0xdb88,_0x2b27be){var _0x2a5ad5={},_0x2c68d8={},_0x527843={'count':0x0,'rows':[]};var _0x298cc3=_['map'](db[_0x5e78('0x2e')]['rawAttributes'],function(_0x10329d){return{'name':_0x10329d[_0x5e78('0x2f')],'type':_0x10329d[_0x5e78('0x30')]['key']};});_0x2c68d8[_0x5e78('0x31')]=_[_0x5e78('0x32')](_0x298cc3,'name');_0x2c68d8[_0x5e78('0x33')]=_['keys'](_0xdb88[_0x5e78('0x33')]);_0x2c68d8[_0x5e78('0x34')]=_['intersection'](_0x2c68d8[_0x5e78('0x31')],_0x2c68d8[_0x5e78('0x33')]);_0x2a5ad5[_0x5e78('0x35')]=_[_0x5e78('0x36')](_0x2c68d8[_0x5e78('0x31')],qs[_0x5e78('0x37')](_0xdb88[_0x5e78('0x33')][_0x5e78('0x37')]));_0x2a5ad5[_0x5e78('0x35')]=_0x2a5ad5['attributes'][_0x5e78('0x38')]?_0x2a5ad5['attributes']:_0x2c68d8[_0x5e78('0x31')];if(!_0xdb88['query'][_0x5e78('0x39')]('nolimit')){_0x2a5ad5[_0x5e78('0x20')]=qs[_0x5e78('0x20')](_0xdb88[_0x5e78('0x33')]['limit']);_0x2a5ad5[_0x5e78('0x23')]=qs[_0x5e78('0x23')](_0xdb88['query']['offset']);}_0x2a5ad5[_0x5e78('0x3a')]=qs[_0x5e78('0x3b')](_0xdb88[_0x5e78('0x33')][_0x5e78('0x3b')]);_0x2a5ad5[_0x5e78('0x3c')]=qs[_0x5e78('0x34')](_[_0x5e78('0x3d')](_0xdb88[_0x5e78('0x33')],_0x2c68d8[_0x5e78('0x34')]),_0x298cc3);if(_0xdb88[_0x5e78('0x33')][_0x5e78('0x3e')]){_0x2a5ad5['where']=_[_0x5e78('0x3f')](_0x2a5ad5[_0x5e78('0x3c')],{'$or':_[_0x5e78('0x32')](_0x298cc3,function(_0x32097a){if(_0x32097a['type']!==_0x5e78('0x40')){var _0x2d3012={};_0x2d3012[_0x32097a[_0x5e78('0x2c')]]={'$like':'%'+_0xdb88[_0x5e78('0x33')][_0x5e78('0x3e')]+'%'};return _0x2d3012;}})});}_0x2a5ad5=_[_0x5e78('0x3f')]({},_0x2a5ad5,_0xdb88['options']);var _0x3311d0={'where':_0x2a5ad5[_0x5e78('0x3c')]};return db[_0x5e78('0x2e')][_0x5e78('0x22')](_0x3311d0)[_0x5e78('0x29')](function(_0x4d1ed6){_0x527843[_0x5e78('0x22')]=_0x4d1ed6;if(_0xdb88['query'][_0x5e78('0x41')]){_0x2a5ad5[_0x5e78('0x42')]=[{'all':!![]}];}return db['UserProfile'][_0x5e78('0x43')](_0x2a5ad5);})[_0x5e78('0x29')](function(_0x525a3e){_0x527843[_0x5e78('0x44')]=_0x525a3e;return _0x527843;})[_0x5e78('0x29')](respondWithFilteredResult(_0x2b27be,_0x2a5ad5))[_0x5e78('0x45')](handleError(_0x2b27be,null));};exports['show']=function(_0x64c22,_0x5856e3){var _0x13eed6={'raw':![],'where':{'id':_0x64c22[_0x5e78('0x46')]['id']}},_0x3013e9={};_0x3013e9[_0x5e78('0x31')]=_['keys'](db[_0x5e78('0x2e')][_0x5e78('0x47')]);_0x3013e9['query']=_['keys'](_0x64c22[_0x5e78('0x33')]);_0x3013e9[_0x5e78('0x34')]=_[_0x5e78('0x36')](_0x3013e9[_0x5e78('0x31')],_0x3013e9[_0x5e78('0x33')]);_0x13eed6['attributes']=_[_0x5e78('0x36')](_0x3013e9[_0x5e78('0x31')],qs[_0x5e78('0x37')](_0x64c22[_0x5e78('0x33')][_0x5e78('0x37')]));_0x13eed6['attributes']=_0x13eed6[_0x5e78('0x35')][_0x5e78('0x38')]?_0x13eed6['attributes']:_0x3013e9['model'];if(_0x64c22['query'][_0x5e78('0x41')]){_0x13eed6[_0x5e78('0x42')]=[{'all':!![]}];}_0x13eed6=_[_0x5e78('0x3f')]({},_0x13eed6,_0x64c22[_0x5e78('0x48')]);return db[_0x5e78('0x2e')]['find'](_0x13eed6)[_0x5e78('0x29')](handleEntityNotFound(_0x5856e3,null))[_0x5e78('0x29')](respondWithResult(_0x5856e3,null))[_0x5e78('0x45')](handleError(_0x5856e3,null));};exports['create']=function(_0x2ae6dd,_0xd6522e){return db[_0x5e78('0x2e')][_0x5e78('0x49')](_0x2ae6dd[_0x5e78('0x4a')],{})['then'](respondWithResult(_0xd6522e,0xc9))[_0x5e78('0x45')](handleError(_0xd6522e,null));};exports[_0x5e78('0x4b')]=function(_0x4c8a73,_0x51c807){var _0x291127={'where':{'id':_0x4c8a73[_0x5e78('0x46')]['id']}},_0x55b87c={};_0x55b87c[_0x5e78('0x31')]=_[_0x5e78('0x4c')](db[_0x5e78('0x2e')][_0x5e78('0x47')]);_0x291127[_0x5e78('0x35')]=_[_0x5e78('0x36')](_0x55b87c['model'],qs[_0x5e78('0x37')](_0x4c8a73[_0x5e78('0x33')]['fields']));_0x291127['attributes']=_0x291127[_0x5e78('0x35')][_0x5e78('0x38')]?_0x291127[_0x5e78('0x35')]:_0x55b87c[_0x5e78('0x31')];if(_0x4c8a73[_0x5e78('0x33')][_0x5e78('0x41')]){_0x291127[_0x5e78('0x42')]=[{'all':!![]}];}_0x291127=_['merge']({},_0x291127,_0x4c8a73[_0x5e78('0x48')]);return db[_0x5e78('0x2e')][_0x5e78('0x4d')](_0x291127)[_0x5e78('0x29')](handleEntityNotFound(_0x51c807,null))[_0x5e78('0x29')](function(_0xd27aba){if(_0xd27aba){var _0x47c9f5=_0xd27aba[_0x5e78('0x4e')]({'plain':!![]});_0x47c9f5=qs[_0x5e78('0x4f')](_0x47c9f5,['id',_0x5e78('0x50'),'updatedAt',_0x5e78('0x51')]);_0x4c8a73[_0x5e78('0x4a')]=_[_0x5e78('0x4f')](_0x4c8a73[_0x5e78('0x4a')],['id',_0x5e78('0x50'),_0x5e78('0x52')]);return db[_0x5e78('0x53')][_0x5e78('0x54')](function(_0x2ecd73){return db[_0x5e78('0x2e')][_0x5e78('0x49')](_[_0x5e78('0x3f')](_0x47c9f5,_0x4c8a73[_0x5e78('0x4a')]),{'include':_0x4c8a73[_0x5e78('0x33')][_0x5e78('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x2ecd73})[_0x5e78('0x29')](function(_0x172649){var _0x33cd32=_0x172649['get']({'plain':!![]});return db[_0x5e78('0x55')][_0x5e78('0x43')]({'where':{'userProfileId':_0x4c8a73[_0x5e78('0x46')]['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x15bb14){if(_0x15bb14){return BPromise['each'](_0x15bb14,function(_0x39871e){return new BPromise(function(_0x459d62,_0x53a499){if(_0x39871e[_0x5e78('0x56')]===null||_0x39871e[_0x5e78('0x56')]===0x1)_0x459d62(null);return db[_0x5e78('0x57')][_0x5e78('0x43')]({'where':{'sectionId':_0x39871e['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x3ec04c){var _0x486af0=_['map'](_0x3ec04c,function(_0x3f0dcf){return qs[_0x5e78('0x4f')](_0x3f0dcf,['id',_0x5e78('0x50'),_0x5e78('0x52'),_0x5e78('0x58')]);});_0x459d62(_0x486af0);})[_0x5e78('0x45')](function(_0x28b213){_0x53a499(_0x28b213);});})[_0x5e78('0x29')](function(_0x35fab0){var _0x23490e=qs[_0x5e78('0x4f')](_0x39871e,['id',_0x5e78('0x50'),'updatedAt']);_0x23490e['userProfileId']=_0x33cd32['id'];if(_0x35fab0)_0x23490e[_0x5e78('0x59')]=_0x35fab0;return _0x23490e;})[_0x5e78('0x29')](function(_0x5ae962){return db[_0x5e78('0x55')][_0x5e78('0x49')](_0x5ae962,{'include':[{'model':db[_0x5e78('0x57')],'as':_0x5e78('0x59')}],'raw':!![],'transaction':_0x2ecd73});});})[_0x5e78('0x29')](function(){return _0x33cd32;});}});});});}})[_0x5e78('0x29')](respondWithResult(_0x51c807,0xc9))['catch'](handleError(_0x51c807,null));};exports[_0x5e78('0x5a')]=function(_0x55badd,_0x93cd5f){if(_0x55badd['body']['id']){delete _0x55badd[_0x5e78('0x4a')]['id'];}return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x55badd[_0x5e78('0x46')]['id']}})[_0x5e78('0x29')](handleEntityNotFound(_0x93cd5f,null))['then'](saveUpdates(_0x55badd['body'],null))[_0x5e78('0x29')](respondWithResult(_0x93cd5f,null))[_0x5e78('0x45')](handleError(_0x93cd5f,null));};exports[_0x5e78('0x2a')]=function(_0x257c3d,_0x564be0){return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x257c3d[_0x5e78('0x46')]['id']}})['then'](handleEntityNotFound(_0x564be0,null))['then'](removeEntity(_0x564be0,null))[_0x5e78('0x45')](handleError(_0x564be0,null));};exports[_0x5e78('0x5b')]=function(_0x136eb4,_0x531ea4){return db[_0x5e78('0x2e')][_0x5e78('0x5b')]()[_0x5e78('0x29')](respondWithResult(_0x531ea4,null))[_0x5e78('0x45')](handleError(_0x531ea4,null));};exports[_0x5e78('0x5c')]=function(_0x16ca35,_0x190be3){var _0x337f8f=_0x16ca35[_0x5e78('0x4a')];return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x16ca35['params']['id']}})[_0x5e78('0x29')](handleEntityNotFound(_0x190be3,null))[_0x5e78('0x29')](function(_0x4ecc4c){if(_0x4ecc4c){return db[_0x5e78('0x53')][_0x5e78('0x54')](function(_0x53224d){return db[_0x5e78('0x55')]['destroy']({'where':{'userProfileId':_0x16ca35['params']['id'],'sectionId':_[_0x5e78('0x32')](_0x337f8f,function(_0x701372){return _0x701372['sectionId'];})},'transaction':_0x53224d})[_0x5e78('0x29')](function(){var _0x31bdb0=_['map'](_0x337f8f,function(_0x2f2ab5){_0x2f2ab5[_0x5e78('0x5d')]=_0x16ca35[_0x5e78('0x46')]['id'];return _0x2f2ab5;});var _0x105571=[];return BPromise[_0x5e78('0x5e')](_0x31bdb0,function(_0x1ffa99){return db[_0x5e78('0x55')][_0x5e78('0x49')](_0x1ffa99,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x53224d})[_0x5e78('0x29')](function(_0x37f933){_0x105571['push'](_0x37f933[_0x5e78('0x4e')]({'plain':!![]}));});})[_0x5e78('0x29')](function(){return _0x105571;});});});}})[_0x5e78('0x29')](function(_0x252795){return _0x252795;})[_0x5e78('0x29')](respondWithResult(_0x190be3,null))['catch'](handleError(_0x190be3,null));};exports[_0x5e78('0x5f')]=function(_0x5545bd,_0x300520){var _0x2086b3;return db['UserProfile'][_0x5e78('0x4d')]({'where':{'id':_0x5545bd[_0x5e78('0x46')]['id']},'attributes':['id',_0x5e78('0x2c')]})[_0x5e78('0x29')](handleEntityNotFound(_0x300520,null))['then'](function(_0x42049a){if(_0x42049a){_0x2086b3=_0x42049a;return db[_0x5e78('0x55')][_0x5e78('0x2a')]({'where':{'userProfileId':_0x5545bd[_0x5e78('0x46')]['id'],'sectionId':_0x5545bd[_0x5e78('0x33')]['ids']}});}})['then'](function(){return _0x2086b3;})[_0x5e78('0x29')](respondWithStatusCode(_0x300520,null))[_0x5e78('0x45')](handleError(_0x300520,null));};exports[_0x5e78('0x60')]=function(_0x55bdd0,_0x180d01){var _0xf9ac6b=[];var _0x41d98c=[];return db[_0x5e78('0x55')][_0x5e78('0x43')]({'where':{'userProfileId':_0x55bdd0[_0x5e78('0x46')]['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x20942e){_0xf9ac6b=_[_0x5e78('0x3e')](_0x20942e,function(_0x299045){return _0x299045[_0x5e78('0x61')]===0x1||_[_0x5e78('0x62')]([0x3eb,0x709],_0x299045[_0x5e78('0x58')]);});if(!_[_0x5e78('0x63')](_0xf9ac6b)){return _[_0x5e78('0x32')](_0xf9ac6b,function(_0x140e95){return _0x140e95[_0x5e78('0x58')];});}else{return;}})[_0x5e78('0x29')](function(_0xce14d2){if(_0xce14d2)_0x41d98c=_0xce14d2;if(_[_0x5e78('0x62')](_0x41d98c,0x64)){var _0x2eeb01=_[_0x5e78('0x4d')](_0xf9ac6b,{'sectionId':0x64});return hasDefaultDashboard(_0x2eeb01)[_0x5e78('0x29')](function(_0x1a9056){return _[_0x5e78('0x32')](_0xf9ac6b,function(_0x3fb4d6){if(_0x3fb4d6[_0x5e78('0x58')]===0x64){_0x3fb4d6[_0x5e78('0x64')]=_0x1a9056;}return _0x3fb4d6;});});}else{return;}})['then'](function(_0x468388){if(_0x468388)_0xf9ac6b=_0x468388;if(_[_0x5e78('0x62')](_0x41d98c,0x3eb)){var _0x5fffef=_['find'](_0xf9ac6b,{'sectionId':0x3eb});return getCustomDashboards(_0x5fffef)[_0x5e78('0x29')](function(_0x4719eb){return _[_0x5e78('0x32')](_0xf9ac6b,function(_0x1dcd69){if(_0x5fffef[_0x5e78('0x61')]){if(_0x1dcd69[_0x5e78('0x58')]===0x3eb){_0x1dcd69['subsections']=_0x4719eb;}}else{if(_0x1dcd69[_0x5e78('0x58')]===0x64){_0x1dcd69[_0x5e78('0x64')]=_0x4719eb;}}return _0x1dcd69;});});}else{return;}})[_0x5e78('0x29')](function(_0x57cd66){if(_0x57cd66)_0xf9ac6b=_0x57cd66;if(_['includes'](_0x41d98c,0x709)){var _0x3242e6=_['find'](_0xf9ac6b,{'sectionId':0x709});return getPlugins(_0x3242e6)[_0x5e78('0x29')](function(_0x5ea26f){if(_0x3242e6[_0x5e78('0x61')]){return _['map'](_0xf9ac6b,function(_0x2fc9dc){if(_0x2fc9dc['sectionId']===0x709){_0x2fc9dc[_0x5e78('0x64')]=_0x5ea26f;}return _0x2fc9dc;});}else{var _0x550a33={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5ea26f};var _0x31b01f=_[_0x5e78('0x32')](_0xf9ac6b);_0x31b01f['push'](_0x550a33);return _0x31b01f;}});}else{return;}})[_0x5e78('0x29')](function(_0x1b15a8){if(_0x1b15a8)_0xf9ac6b=_0x1b15a8;return _['filter'](_0xf9ac6b,['enabled',0x1]);})[_0x5e78('0x29')](respondWithResult(_0x180d01,null))[_0x5e78('0x45')](handleError(_0x180d01,null));};function hasDefaultDashboard(_0x209c09){var _0x343d09=[0x65];return new BPromise(function(_0x386234,_0x2a48d1){try{if(_0x209c09[_0x5e78('0x56')]){_0x386234(_0x343d09);}else{return db['UserProfileResource'][_0x5e78('0x65')]({'where':{'sectionId':_0x209c09['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x28631d){_0x28631d?_0x386234(_0x343d09):_0x386234();});}}catch(_0xd5dc3d){_0x2a48d1(_0xd5dc3d);}});}function getCustomDashboards(_0x57e2a2){var _0x1d6288=[];return new BPromise(function(_0x32044e,_0x31a807){try{if(_0x57e2a2[_0x5e78('0x56')]){return db[_0x5e78('0x66')][_0x5e78('0x43')]({'raw':!![]})['then'](function(_0x1a1c90){_0x1a1c90[_0x5e78('0x67')](function(_0x354717){_0x1d6288[_0x5e78('0x68')](_0x354717['id']+0x1869f);});_0x32044e(_0x1d6288);});}else{return db[_0x5e78('0x57')][_0x5e78('0x43')]({'where':{'sectionId':_0x57e2a2['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x2ef75d){_0x2ef75d[_0x5e78('0x67')](function(_0x40a576){_0x1d6288[_0x5e78('0x68')](_0x40a576[_0x5e78('0x69')]+0x1869f);});_0x32044e(_0x1d6288);});}}catch(_0x162778){_0x31a807(_0x162778);}});}function getPlugins(_0x63370b){var _0x266f26=[];return new BPromise(function(_0x251000,_0x57a085){try{if(_0x63370b[_0x5e78('0x56')]){return db[_0x5e78('0x6a')][_0x5e78('0x43')]({'raw':!![]})[_0x5e78('0x29')](function(_0x4d1fe7){_0x4d1fe7[_0x5e78('0x67')](function(_0x2fe3f3){_0x266f26[_0x5e78('0x68')](_0x2fe3f3['id']+0x15b38);});_0x251000(_0x266f26);});}else{return db[_0x5e78('0x57')]['findAll']({'where':{'sectionId':_0x63370b['id']},'raw':!![]})[_0x5e78('0x29')](function(_0x260373){_0x260373['forEach'](function(_0xc69f59){_0x266f26[_0x5e78('0x68')](_0xc69f59['resourceId']+0x15b38);});_0x251000(_0x266f26);});}}catch(_0x2bde45){_0x57a085(_0x2bde45);}});}exports[_0x5e78('0x6b')]=function(_0x3d60e6,_0x4d10cf){return db['UserProfile'][_0x5e78('0x4d')]({'where':{'id':_0x3d60e6[_0x5e78('0x46')]['id']}})[_0x5e78('0x29')](handleEntityNotFound(_0x4d10cf,null))[_0x5e78('0x29')](function(_0x326fbf){if(_0x326fbf){return db[_0x5e78('0x53')][_0x5e78('0x54')](function(_0x26475a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3d60e6['params']['id']},'attributes':['id'],'raw':!![]})[_0x5e78('0x29')](function(_0xc91fb2){if(_0xc91fb2){return db['UserProfileSection'][_0x5e78('0x2a')]({'where':{'userProfileId':_0x3d60e6[_0x5e78('0x46')]['id'],'id':_['map'](_0xc91fb2,function(_0x55c519){return _0x55c519['id'];})},'transaction':_0x26475a});}})[_0x5e78('0x29')](function(_0x15aff9){var _0x4d62f8=_['map'](_0x3d60e6['body'],function(_0x44bd42){_0x44bd42[_0x5e78('0x5d')]=_0x3d60e6['params']['id'];return _0x44bd42;});return db[_0x5e78('0x55')][_0x5e78('0x6c')](_0x4d62f8,{'raw':!![],'transaction':_0x26475a});})[_0x5e78('0x29')](function(_0x121c64){var _0x406c7e=_[_0x5e78('0x3e')](_[_0x5e78('0x32')](_0x121c64,function(_0x292da1){return _0x292da1[_0x5e78('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x406c7e){return db[_0x5e78('0x55')][_0x5e78('0x43')]({'where':{'userProfileId':_0x3d60e6[_0x5e78('0x46')]['id'],'sectionId':_[_0x5e78('0x32')](_0x406c7e,function(_0x4e5916){return _0x4e5916[_0x5e78('0x58')];})},'attributes':['id',_0x5e78('0x58')],'raw':!![]})[_0x5e78('0x29')](function(_0x9902f8){var _0x400bd0=_[_0x5e78('0x32')](_0x3d60e6[_0x5e78('0x4a')],function(_0x5da82e){_0x5da82e['userProfileId']=_0x3d60e6['params']['id'];return _0x5da82e;});return db['UserProfileResource']['bulkCreate'](_0x400bd0,{'raw':!![],'transaction':_0x26475a});});}})[_0x5e78('0x45')](handleError(_0x4d10cf,null));});}})[_0x5e78('0x29')](function(_0x2a4281){var _0x222154=_[_0x5e78('0x32')](_0x2a4281,function(_0x48b4bc){return _0x48b4bc[_0x5e78('0x4e')]({'plain':!![]});});})[_0x5e78('0x29')](respondWithResult(_0x4d10cf,null))[_0x5e78('0x45')](handleError(_0x4d10cf,null));};exports[_0x5e78('0x6d')]=function(_0x25264d,_0x2408f5,_0x2d4a56){return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x25264d[_0x5e78('0x46')]['id']}})['then'](handleEntityNotFound(_0x2408f5,null))[_0x5e78('0x29')](function(_0x569b91){if(_0x569b91){return _0x569b91[_0x5e78('0x6d')](_0x25264d['query'][_0x5e78('0x6e')]);}})[_0x5e78('0x29')](respondWithStatusCode(_0x2408f5,null))[_0x5e78('0x45')](handleError(_0x2408f5,null));};exports[_0x5e78('0x6f')]=function(_0x493cfa,_0x508b95){var _0xf54c18={};if(!_0x493cfa[_0x5e78('0x33')][_0x5e78('0x70')])throw new Error(_0x5e78('0x71'));if(!_0x493cfa[_0x5e78('0x33')][_0x5e78('0x39')](_0x5e78('0x72'))){_0xf54c18['limit']=qs['limit'](_0x493cfa[_0x5e78('0x33')][_0x5e78('0x20')]);_0xf54c18[_0x5e78('0x23')]=qs['offset'](_0x493cfa[_0x5e78('0x33')][_0x5e78('0x23')]);}return db[_0x5e78('0x2e')][_0x5e78('0x4d')]({'where':{'id':_0x493cfa['params']['id']}})['then'](function(_0x25bd5b){if(!_0x25bd5b)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x493cfa['params']['id']);return db[_0x5e78('0x2e')]['getResources'](_0x493cfa);})[_0x5e78('0x29')](respondWithFilteredResult(_0x508b95,_0xf54c18))[_0x5e78('0x45')](handleError(_0x508b95,null));}; \ No newline at end of file +var _0x5276=['Resources','describe','transaction','each','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','merge','find','body','get','createdAt','updatedAt','crudPermissions','sequelize','create','UserProfileSection','autoAssociation','UserProfileResource','omit','sectionId','userProfileId'];(function(_0xe44dfa,_0x37961b){var _0x7626a5=function(_0x26e25b){while(--_0x26e25b){_0xe44dfa['push'](_0xe44dfa['shift']());}};_0x7626a5(++_0x37961b);}(_0x5276,0x163));var _0x6527=function(_0x5d757a,_0x1885fa){_0x5d757a=_0x5d757a-0x0;var _0x535ada=_0x5276[_0x5d757a];return _0x535ada;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6527('0x0'));var jsonpatch=require(_0x6527('0x1'));var rp=require(_0x6527('0x2'));var moment=require(_0x6527('0x3'));var BPromise=require(_0x6527('0x4'));var Mustache=require(_0x6527('0x5'));var util=require(_0x6527('0x6'));var path=require(_0x6527('0x7'));var sox=require(_0x6527('0x8'));var csv=require(_0x6527('0x9'));var ejs=require(_0x6527('0xa'));var fs=require('fs');var fs_extra=require(_0x6527('0xb'));var _=require(_0x6527('0xc'));var squel=require('squel');var crypto=require(_0x6527('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6527('0xe'));var toCsv=require(_0x6527('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6527('0xf'));var as=require(_0x6527('0x10'));var hardwareService=require(_0x6527('0x11'));var logger=require(_0x6527('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6527('0x13'));var licenseUtil=require(_0x6527('0x14'));var db=require(_0x6527('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x6527('0x16'),'port':0x18eb});var socket=require(_0x6527('0x17'))(new Redis(config['redis']));require(_0x6527('0x18'))['register'](socket);function respondWithStatusCode(_0x3b56ee,_0x2bd94d){_0x2bd94d=_0x2bd94d||0xcc;return function(_0x27e464){if(_0x27e464){return _0x3b56ee[_0x6527('0x19')](_0x2bd94d);}return _0x3b56ee[_0x6527('0x1a')](_0x2bd94d)[_0x6527('0x1b')]();};}function respondWithResult(_0x495c14,_0x3dd2cd){_0x3dd2cd=_0x3dd2cd||0xc8;return function(_0x52a5d3){if(_0x52a5d3){return _0x495c14[_0x6527('0x1a')](_0x3dd2cd)[_0x6527('0x1c')](_0x52a5d3);}};}function respondWithFilteredResult(_0x2cb6e9,_0x12c489){return function(_0x508f67){if(_0x508f67){var _0x1dd222=typeof _0x12c489[_0x6527('0x1d')]===_0x6527('0x1e')&&typeof _0x12c489[_0x6527('0x1f')]===_0x6527('0x1e');var _0x5014b2=_0x508f67['count'];var _0x1e0a28=_0x1dd222?0x0:_0x12c489[_0x6527('0x1d')];var _0x7af757=_0x1dd222?_0x508f67[_0x6527('0x20')]:_0x12c489[_0x6527('0x1d')]+_0x12c489[_0x6527('0x1f')];var _0x3ba0e0;if(_0x7af757>=_0x5014b2){_0x7af757=_0x5014b2;_0x3ba0e0=0xc8;}else{_0x3ba0e0=0xce;}_0x2cb6e9[_0x6527('0x1a')](_0x3ba0e0);return _0x2cb6e9[_0x6527('0x21')](_0x6527('0x22'),_0x1e0a28+'-'+_0x7af757+'/'+_0x5014b2)[_0x6527('0x1c')](_0x508f67);}return null;};}function patchUpdates(_0x2e7450){return function(_0x53ebf6){try{jsonpatch[_0x6527('0x23')](_0x53ebf6,_0x2e7450,!![]);}catch(_0x7ce319){return BPromise['reject'](_0x7ce319);}return _0x53ebf6[_0x6527('0x24')]();};}function saveUpdates(_0x188c3a,_0x5986ac){return function(_0x623d35){if(_0x623d35){return _0x623d35[_0x6527('0x25')](_0x188c3a)[_0x6527('0x26')](function(_0x8341b){return _0x8341b;});}return null;};}function removeEntity(_0x2a3383,_0x553537){return function(_0x1375d7){if(_0x1375d7){return _0x1375d7[_0x6527('0x27')]()[_0x6527('0x26')](function(){_0x2a3383[_0x6527('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc7305,_0x4b2cde){return function(_0x5c69d4){if(!_0x5c69d4){_0xcc7305[_0x6527('0x19')](0x194);}return _0x5c69d4;};}function handleError(_0x38b8be,_0x3130e6){_0x3130e6=_0x3130e6||0x1f4;return function(_0x4e3616){logger[_0x6527('0x28')](_0x4e3616[_0x6527('0x29')]);if(_0x4e3616[_0x6527('0x2a')]){delete _0x4e3616[_0x6527('0x2a')];}_0x38b8be[_0x6527('0x1a')](_0x3130e6)[_0x6527('0x2b')](_0x4e3616);};}exports['index']=function(_0x25b08b,_0x19f894){var _0x1ad33c={},_0x22e2dd={},_0x99997a={'count':0x0,'rows':[]};var _0x54ec7d=_[_0x6527('0x2c')](db[_0x6527('0x2d')]['rawAttributes'],function(_0x41016f){return{'name':_0x41016f[_0x6527('0x2e')],'type':_0x41016f[_0x6527('0x2f')][_0x6527('0x30')]};});_0x22e2dd[_0x6527('0x31')]=_[_0x6527('0x2c')](_0x54ec7d,_0x6527('0x2a'));_0x22e2dd[_0x6527('0x32')]=_[_0x6527('0x33')](_0x25b08b['query']);_0x22e2dd[_0x6527('0x34')]=_[_0x6527('0x35')](_0x22e2dd[_0x6527('0x31')],_0x22e2dd[_0x6527('0x32')]);_0x1ad33c['attributes']=_['intersection'](_0x22e2dd[_0x6527('0x31')],qs['fields'](_0x25b08b[_0x6527('0x32')]['fields']));_0x1ad33c['attributes']=_0x1ad33c[_0x6527('0x36')][_0x6527('0x37')]?_0x1ad33c['attributes']:_0x22e2dd[_0x6527('0x31')];if(!_0x25b08b[_0x6527('0x32')][_0x6527('0x38')](_0x6527('0x39'))){_0x1ad33c[_0x6527('0x1f')]=qs[_0x6527('0x1f')](_0x25b08b[_0x6527('0x32')][_0x6527('0x1f')]);_0x1ad33c[_0x6527('0x1d')]=qs[_0x6527('0x1d')](_0x25b08b['query'][_0x6527('0x1d')]);}_0x1ad33c[_0x6527('0x3a')]=qs['sort'](_0x25b08b[_0x6527('0x32')][_0x6527('0x3b')]);_0x1ad33c[_0x6527('0x3c')]=qs['filters'](_[_0x6527('0x3d')](_0x25b08b[_0x6527('0x32')],_0x22e2dd[_0x6527('0x34')]),_0x54ec7d);if(_0x25b08b[_0x6527('0x32')]['filter']){_0x1ad33c['where']=_['merge'](_0x1ad33c[_0x6527('0x3c')],{'$or':_[_0x6527('0x2c')](_0x54ec7d,function(_0x49f82f){if(_0x49f82f[_0x6527('0x2f')]!==_0x6527('0x3e')){var _0xfe3517={};_0xfe3517[_0x49f82f[_0x6527('0x2a')]]={'$like':'%'+_0x25b08b['query'][_0x6527('0x3f')]+'%'};return _0xfe3517;}})});}_0x1ad33c=_['merge']({},_0x1ad33c,_0x25b08b[_0x6527('0x40')]);var _0x1e0e7c={'where':_0x1ad33c[_0x6527('0x3c')]};return db[_0x6527('0x2d')][_0x6527('0x20')](_0x1e0e7c)[_0x6527('0x26')](function(_0x280dde){_0x99997a[_0x6527('0x20')]=_0x280dde;if(_0x25b08b[_0x6527('0x32')][_0x6527('0x41')]){_0x1ad33c[_0x6527('0x42')]=[{'all':!![]}];}return db[_0x6527('0x2d')][_0x6527('0x43')](_0x1ad33c);})[_0x6527('0x26')](function(_0xa904a0){_0x99997a[_0x6527('0x44')]=_0xa904a0;return _0x99997a;})[_0x6527('0x26')](respondWithFilteredResult(_0x19f894,_0x1ad33c))[_0x6527('0x45')](handleError(_0x19f894,null));};exports[_0x6527('0x46')]=function(_0xacffe3,_0x53b432){var _0x3af50f={'raw':![],'where':{'id':_0xacffe3[_0x6527('0x47')]['id']}},_0x11b103={};_0x11b103[_0x6527('0x31')]=_[_0x6527('0x33')](db[_0x6527('0x2d')][_0x6527('0x48')]);_0x11b103[_0x6527('0x32')]=_[_0x6527('0x33')](_0xacffe3[_0x6527('0x32')]);_0x11b103[_0x6527('0x34')]=_[_0x6527('0x35')](_0x11b103[_0x6527('0x31')],_0x11b103[_0x6527('0x32')]);_0x3af50f['attributes']=_['intersection'](_0x11b103[_0x6527('0x31')],qs[_0x6527('0x49')](_0xacffe3[_0x6527('0x32')][_0x6527('0x49')]));_0x3af50f['attributes']=_0x3af50f[_0x6527('0x36')]['length']?_0x3af50f[_0x6527('0x36')]:_0x11b103[_0x6527('0x31')];if(_0xacffe3[_0x6527('0x32')]['includeAll']){_0x3af50f['include']=[{'all':!![]}];}_0x3af50f=_[_0x6527('0x4a')]({},_0x3af50f,_0xacffe3[_0x6527('0x40')]);return db[_0x6527('0x2d')][_0x6527('0x4b')](_0x3af50f)[_0x6527('0x26')](handleEntityNotFound(_0x53b432,null))['then'](respondWithResult(_0x53b432,null))['catch'](handleError(_0x53b432,null));};exports['create']=function(_0x51a105,_0x42752e){return db['UserProfile']['create'](_0x51a105[_0x6527('0x4c')],{})[_0x6527('0x26')](respondWithResult(_0x42752e,0xc9))['catch'](handleError(_0x42752e,null));};exports['clone']=function(_0x2f1eb1,_0x5dfc93){var _0x4260a3={'where':{'id':_0x2f1eb1[_0x6527('0x47')]['id']}},_0x3a33a3={};_0x3a33a3[_0x6527('0x31')]=_[_0x6527('0x33')](db[_0x6527('0x2d')][_0x6527('0x48')]);_0x4260a3[_0x6527('0x36')]=_[_0x6527('0x35')](_0x3a33a3[_0x6527('0x31')],qs['fields'](_0x2f1eb1[_0x6527('0x32')][_0x6527('0x49')]));_0x4260a3[_0x6527('0x36')]=_0x4260a3['attributes'][_0x6527('0x37')]?_0x4260a3[_0x6527('0x36')]:_0x3a33a3[_0x6527('0x31')];if(_0x2f1eb1[_0x6527('0x32')][_0x6527('0x41')]){_0x4260a3['include']=[{'all':!![]}];}_0x4260a3=_[_0x6527('0x4a')]({},_0x4260a3,_0x2f1eb1[_0x6527('0x40')]);return db['UserProfile']['find'](_0x4260a3)['then'](handleEntityNotFound(_0x5dfc93,null))[_0x6527('0x26')](function(_0x4859c6){if(_0x4859c6){var _0x303a4b=_0x4859c6[_0x6527('0x4d')]({'plain':!![]});_0x303a4b=qs['omit'](_0x303a4b,['id',_0x6527('0x4e'),_0x6527('0x4f'),_0x6527('0x50')]);_0x2f1eb1['body']=_['omit'](_0x2f1eb1[_0x6527('0x4c')],['id',_0x6527('0x4e'),_0x6527('0x4f')]);return db[_0x6527('0x51')]['transaction'](function(_0x4be945){return db[_0x6527('0x2d')][_0x6527('0x52')](_[_0x6527('0x4a')](_0x303a4b,_0x2f1eb1[_0x6527('0x4c')]),{'include':_0x2f1eb1[_0x6527('0x32')][_0x6527('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x4be945})[_0x6527('0x26')](function(_0x49dcb0){var _0x281ec8=_0x49dcb0[_0x6527('0x4d')]({'plain':!![]});return db[_0x6527('0x53')][_0x6527('0x43')]({'where':{'userProfileId':_0x2f1eb1['params']['id']},'raw':!![]})[_0x6527('0x26')](function(_0x280254){if(_0x280254){return BPromise['each'](_0x280254,function(_0x37226d){return new BPromise(function(_0x296410,_0x426fdc){if(_0x37226d[_0x6527('0x54')]===null||_0x37226d[_0x6527('0x54')]===0x1)_0x296410(null);return db[_0x6527('0x55')][_0x6527('0x43')]({'where':{'sectionId':_0x37226d['id']},'raw':!![]})[_0x6527('0x26')](function(_0x1e87c3){var _0x52c150=_[_0x6527('0x2c')](_0x1e87c3,function(_0x202cc1){return qs[_0x6527('0x56')](_0x202cc1,['id',_0x6527('0x4e'),_0x6527('0x4f'),_0x6527('0x57')]);});_0x296410(_0x52c150);})['catch'](function(_0x19b83d){_0x426fdc(_0x19b83d);});})[_0x6527('0x26')](function(_0x14963e){var _0x2f06cb=qs[_0x6527('0x56')](_0x37226d,['id',_0x6527('0x4e'),'updatedAt']);_0x2f06cb[_0x6527('0x58')]=_0x281ec8['id'];if(_0x14963e)_0x2f06cb[_0x6527('0x59')]=_0x14963e;return _0x2f06cb;})['then'](function(_0x1e9196){return db[_0x6527('0x53')][_0x6527('0x52')](_0x1e9196,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4be945});});})[_0x6527('0x26')](function(){return _0x281ec8;});}});});});}})['then'](respondWithResult(_0x5dfc93,0xc9))[_0x6527('0x45')](handleError(_0x5dfc93,null));};exports[_0x6527('0x25')]=function(_0x5814e1,_0x4c6272){if(_0x5814e1[_0x6527('0x4c')]['id']){delete _0x5814e1[_0x6527('0x4c')]['id'];}return db[_0x6527('0x2d')][_0x6527('0x4b')]({'where':{'id':_0x5814e1['params']['id']}})['then'](handleEntityNotFound(_0x4c6272,null))[_0x6527('0x26')](saveUpdates(_0x5814e1[_0x6527('0x4c')],null))[_0x6527('0x26')](respondWithResult(_0x4c6272,null))['catch'](handleError(_0x4c6272,null));};exports[_0x6527('0x27')]=function(_0x376ad9,_0x4cfb3c){return db[_0x6527('0x2d')][_0x6527('0x4b')]({'where':{'id':_0x376ad9[_0x6527('0x47')]['id']}})[_0x6527('0x26')](handleEntityNotFound(_0x4cfb3c,null))[_0x6527('0x26')](removeEntity(_0x4cfb3c,null))[_0x6527('0x45')](handleError(_0x4cfb3c,null));};exports['describe']=function(_0x431949,_0x1b4589){return db[_0x6527('0x2d')][_0x6527('0x5a')]()[_0x6527('0x26')](respondWithResult(_0x1b4589,null))['catch'](handleError(_0x1b4589,null));};exports['addSections']=function(_0x367b08,_0x1f1f1e){var _0x5e7bc5=_0x367b08[_0x6527('0x4c')];return db[_0x6527('0x2d')][_0x6527('0x4b')]({'where':{'id':_0x367b08[_0x6527('0x47')]['id']}})[_0x6527('0x26')](handleEntityNotFound(_0x1f1f1e,null))[_0x6527('0x26')](function(_0xd5cb7d){if(_0xd5cb7d){return db[_0x6527('0x51')][_0x6527('0x5b')](function(_0x119aaa){return db[_0x6527('0x53')]['destroy']({'where':{'userProfileId':_0x367b08['params']['id'],'sectionId':_['map'](_0x5e7bc5,function(_0x5681a7){return _0x5681a7[_0x6527('0x57')];})},'transaction':_0x119aaa})[_0x6527('0x26')](function(){var _0x482796=_[_0x6527('0x2c')](_0x5e7bc5,function(_0x5aeb8){_0x5aeb8[_0x6527('0x58')]=_0x367b08[_0x6527('0x47')]['id'];return _0x5aeb8;});var _0x19b8b5=[];return BPromise[_0x6527('0x5c')](_0x482796,function(_0x2a7afa){return db[_0x6527('0x53')][_0x6527('0x52')](_0x2a7afa,{'include':[{'model':db[_0x6527('0x55')],'as':_0x6527('0x59')}],'raw':!![],'transaction':_0x119aaa})[_0x6527('0x26')](function(_0x6a9fc0){_0x19b8b5[_0x6527('0x5d')](_0x6a9fc0['get']({'plain':!![]}));});})[_0x6527('0x26')](function(){return _0x19b8b5;});});});}})[_0x6527('0x26')](function(_0x2622ce){return _0x2622ce;})[_0x6527('0x26')](respondWithResult(_0x1f1f1e,null))[_0x6527('0x45')](handleError(_0x1f1f1e,null));};exports[_0x6527('0x5e')]=function(_0x5a146b,_0x3a0aca){var _0x56e162;return db[_0x6527('0x2d')][_0x6527('0x4b')]({'where':{'id':_0x5a146b['params']['id']},'attributes':['id',_0x6527('0x2a')]})[_0x6527('0x26')](handleEntityNotFound(_0x3a0aca,null))[_0x6527('0x26')](function(_0x2d0ea1){if(_0x2d0ea1){_0x56e162=_0x2d0ea1;return db[_0x6527('0x53')][_0x6527('0x27')]({'where':{'userProfileId':_0x5a146b[_0x6527('0x47')]['id'],'sectionId':_0x5a146b[_0x6527('0x32')][_0x6527('0x5f')]}});}})[_0x6527('0x26')](function(){return _0x56e162;})[_0x6527('0x26')](respondWithStatusCode(_0x3a0aca,null))[_0x6527('0x45')](handleError(_0x3a0aca,null));};exports[_0x6527('0x60')]=function(_0x402cb4,_0x4dee11){var _0x5458c9=[];var _0x17de3c=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x402cb4['params']['id']},'raw':!![]})[_0x6527('0x26')](function(_0x3b2f17){_0x5458c9=_[_0x6527('0x3f')](_0x3b2f17,function(_0x296051){return _0x296051[_0x6527('0x61')]===0x1||_[_0x6527('0x62')]([0x3eb,0x709],_0x296051['sectionId']);});if(!_[_0x6527('0x63')](_0x5458c9)){return _[_0x6527('0x2c')](_0x5458c9,function(_0x3c2495){return _0x3c2495[_0x6527('0x57')];});}else{return;}})[_0x6527('0x26')](function(_0x5178d2){if(_0x5178d2)_0x17de3c=_0x5178d2;if(_['includes'](_0x17de3c,0x64)){var _0x1a9ad2=_['find'](_0x5458c9,{'sectionId':0x64});return hasDefaultDashboard(_0x1a9ad2)[_0x6527('0x26')](function(_0x445e30){return _[_0x6527('0x2c')](_0x5458c9,function(_0x5c0387){if(_0x5c0387[_0x6527('0x57')]===0x64){_0x5c0387[_0x6527('0x64')]=_0x445e30;}return _0x5c0387;});});}else{return;}})[_0x6527('0x26')](function(_0x511800){if(_0x511800)_0x5458c9=_0x511800;if(_[_0x6527('0x62')](_0x17de3c,0x3eb)){var _0x36cef6=_[_0x6527('0x4b')](_0x5458c9,{'sectionId':0x3eb});return getCustomDashboards(_0x36cef6)[_0x6527('0x26')](function(_0x2ce6dd){return _['map'](_0x5458c9,function(_0x3d13d8){if(_0x36cef6[_0x6527('0x61')]){if(_0x3d13d8[_0x6527('0x57')]===0x3eb){_0x3d13d8[_0x6527('0x64')]=_0x2ce6dd;}}else{if(_0x3d13d8[_0x6527('0x57')]===0x64){_0x3d13d8[_0x6527('0x64')]=_0x2ce6dd;}}return _0x3d13d8;});});}else{return;}})[_0x6527('0x26')](function(_0x5210bb){if(_0x5210bb)_0x5458c9=_0x5210bb;if(_[_0x6527('0x62')](_0x17de3c,0x709)){var _0x566124=_[_0x6527('0x4b')](_0x5458c9,{'sectionId':0x709});return getPlugins(_0x566124)[_0x6527('0x26')](function(_0x2523af){if(_0x566124['enabled']){return _[_0x6527('0x2c')](_0x5458c9,function(_0x128392){if(_0x128392[_0x6527('0x57')]===0x709){_0x128392[_0x6527('0x64')]=_0x2523af;}return _0x128392;});}else{var _0x4612b0={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2523af};var _0x336d8c=_[_0x6527('0x2c')](_0x5458c9);_0x336d8c[_0x6527('0x5d')](_0x4612b0);return _0x336d8c;}});}else{return;}})[_0x6527('0x26')](function(_0x2e4fbc){if(_0x2e4fbc)_0x5458c9=_0x2e4fbc;return _[_0x6527('0x3f')](_0x5458c9,[_0x6527('0x61'),0x1]);})[_0x6527('0x26')](respondWithResult(_0x4dee11,null))[_0x6527('0x45')](handleError(_0x4dee11,null));};function hasDefaultDashboard(_0x349d97){var _0x1e0272=[0x65];return new BPromise(function(_0x4b5606,_0x57a192){try{if(_0x349d97[_0x6527('0x54')]){_0x4b5606(_0x1e0272);}else{return db[_0x6527('0x55')][_0x6527('0x65')]({'where':{'sectionId':_0x349d97['id']},'raw':!![]})[_0x6527('0x26')](function(_0x4f4ce8){_0x4f4ce8?_0x4b5606(_0x1e0272):_0x4b5606();});}}catch(_0x1c9f2b){_0x57a192(_0x1c9f2b);}});}function getCustomDashboards(_0x3b28c3){var _0x309140=[];return new BPromise(function(_0x4766d8,_0x58d325){try{if(_0x3b28c3[_0x6527('0x54')]){return db['Dashboard'][_0x6527('0x43')]({'raw':!![]})[_0x6527('0x26')](function(_0x2b1f30){_0x2b1f30[_0x6527('0x66')](function(_0x4bd25b){_0x309140[_0x6527('0x5d')](_0x4bd25b['id']+0x1869f);});_0x4766d8(_0x309140);});}else{return db[_0x6527('0x55')][_0x6527('0x43')]({'where':{'sectionId':_0x3b28c3['id']},'raw':!![]})['then'](function(_0x4ce989){_0x4ce989['forEach'](function(_0x467b63){_0x309140['push'](_0x467b63[_0x6527('0x67')]+0x1869f);});_0x4766d8(_0x309140);});}}catch(_0x589281){_0x58d325(_0x589281);}});}function getPlugins(_0x9f3d37){var _0x575cb2=[];return new BPromise(function(_0x4548d7,_0x5ccd33){try{if(_0x9f3d37[_0x6527('0x54')]){return db['Plugin'][_0x6527('0x43')]({'raw':!![]})[_0x6527('0x26')](function(_0x125cc9){_0x125cc9[_0x6527('0x66')](function(_0x13572b){_0x575cb2[_0x6527('0x5d')](_0x13572b['id']+0x15b38);});_0x4548d7(_0x575cb2);});}else{return db['UserProfileResource'][_0x6527('0x43')]({'where':{'sectionId':_0x9f3d37['id']},'raw':!![]})[_0x6527('0x26')](function(_0x5b0f4f){_0x5b0f4f['forEach'](function(_0x45a745){_0x575cb2['push'](_0x45a745[_0x6527('0x67')]+0x15b38);});_0x4548d7(_0x575cb2);});}}catch(_0xfb8663){_0x5ccd33(_0xfb8663);}});}exports[_0x6527('0x68')]=function(_0x8d10f2,_0x3d145e){return db[_0x6527('0x2d')][_0x6527('0x4b')]({'where':{'id':_0x8d10f2[_0x6527('0x47')]['id']}})[_0x6527('0x26')](handleEntityNotFound(_0x3d145e,null))[_0x6527('0x26')](function(_0x4f228c){if(_0x4f228c){return db[_0x6527('0x51')][_0x6527('0x5b')](function(_0x304a89){return db[_0x6527('0x53')][_0x6527('0x43')]({'where':{'userProfileId':_0x8d10f2[_0x6527('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x6527('0x26')](function(_0x47268a){if(_0x47268a){return db[_0x6527('0x53')]['destroy']({'where':{'userProfileId':_0x8d10f2[_0x6527('0x47')]['id'],'id':_[_0x6527('0x2c')](_0x47268a,function(_0x93e64c){return _0x93e64c['id'];})},'transaction':_0x304a89});}})[_0x6527('0x26')](function(_0x5cb20b){var _0x5377b4=_['map'](_0x8d10f2[_0x6527('0x4c')],function(_0x1d8703){_0x1d8703[_0x6527('0x58')]=_0x8d10f2[_0x6527('0x47')]['id'];return _0x1d8703;});return db[_0x6527('0x53')][_0x6527('0x69')](_0x5377b4,{'raw':!![],'transaction':_0x304a89});})[_0x6527('0x26')](function(_0x29c8ac){var _0x136111=_[_0x6527('0x3f')](_[_0x6527('0x2c')](_0x29c8ac,function(_0x4be29){return _0x4be29['get']({'plain':!![]});}),{'includeAll':![]});if(_0x136111){return db[_0x6527('0x53')][_0x6527('0x43')]({'where':{'userProfileId':_0x8d10f2['params']['id'],'sectionId':_[_0x6527('0x2c')](_0x136111,function(_0x4cb70c){return _0x4cb70c[_0x6527('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x6527('0x26')](function(_0x4bdf65){var _0x1dfdd7=_['map'](_0x8d10f2['body'],function(_0x2a08a1){_0x2a08a1[_0x6527('0x58')]=_0x8d10f2[_0x6527('0x47')]['id'];return _0x2a08a1;});return db[_0x6527('0x55')]['bulkCreate'](_0x1dfdd7,{'raw':!![],'transaction':_0x304a89});});}})[_0x6527('0x45')](handleError(_0x3d145e,null));});}})[_0x6527('0x26')](function(_0x491714){var _0x40a73c=_[_0x6527('0x2c')](_0x491714,function(_0x4ed4c7){return _0x4ed4c7['get']({'plain':!![]});});})['then'](respondWithResult(_0x3d145e,null))['catch'](handleError(_0x3d145e,null));};exports[_0x6527('0x6a')]=function(_0x4553b1,_0x344d3a,_0x580375){return db[_0x6527('0x2d')][_0x6527('0x4b')]({'where':{'id':_0x4553b1['params']['id']}})[_0x6527('0x26')](handleEntityNotFound(_0x344d3a,null))[_0x6527('0x26')](function(_0x5a87d){if(_0x5a87d){return _0x5a87d[_0x6527('0x6a')](_0x4553b1[_0x6527('0x32')]['ids']);}})[_0x6527('0x26')](respondWithStatusCode(_0x344d3a,null))[_0x6527('0x45')](handleError(_0x344d3a,null));};exports[_0x6527('0x6b')]=function(_0x342ada,_0x2c48e6){var _0x386fb8={};if(!_0x342ada[_0x6527('0x32')][_0x6527('0x6c')])throw new Error(_0x6527('0x6d'));if(!_0x342ada[_0x6527('0x32')]['hasOwnProperty'](_0x6527('0x39'))){_0x386fb8['limit']=qs[_0x6527('0x1f')](_0x342ada[_0x6527('0x32')][_0x6527('0x1f')]);_0x386fb8[_0x6527('0x1d')]=qs[_0x6527('0x1d')](_0x342ada[_0x6527('0x32')][_0x6527('0x1d')]);}return db[_0x6527('0x2d')]['find']({'where':{'id':_0x342ada[_0x6527('0x47')]['id']}})[_0x6527('0x26')](function(_0x23ac31){if(!_0x23ac31)throw new Error(_0x6527('0x6e')+_0x342ada[_0x6527('0x47')]['id']);return db['UserProfile'][_0x6527('0x6b')](_0x342ada);})[_0x6527('0x26')](respondWithFilteredResult(_0x2c48e6,_0x386fb8))[_0x6527('0x45')](handleError(_0x2c48e6,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6a4dc0a..b33f497 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 _0x8921=['exports','events','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x25e994,_0x378850){var _0x13bf72=function(_0x944eda){while(--_0x944eda){_0x25e994['push'](_0x25e994['shift']());}};_0x13bf72(++_0x378850);}(_0x8921,0x9a));var _0x1892=function(_0x2870f9,_0x3dba50){_0x2870f9=_0x2870f9-0x0;var _0x2ebb22=_0x8921[_0x2870f9];return _0x2ebb22;};'use strict';var EventEmitter=require(_0x1892('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x1892('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1892('0x2')](0x0);var events={'afterCreate':_0x1892('0x3'),'afterUpdate':_0x1892('0x4'),'afterDestroy':_0x1892('0x5')};function emitEvent(_0x110b75){return function(_0x28a89b,_0x15aa1b,_0x2790a1){UserProfileEvents[_0x1892('0x6')](_0x110b75+':'+_0x28a89b['id'],_0x28a89b);UserProfileEvents[_0x1892('0x6')](_0x110b75,_0x28a89b);_0x2790a1(null);};}for(var e in events){if(events[_0x1892('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1892('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xf06c=['../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hook','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf06c,0xc7));var _0xcf06=function(_0x877986,_0x40243f){_0x877986=_0x877986-0x0;var _0x37a7ce=_0xf06c[_0x877986];return _0x37a7ce;};'use strict';var EventEmitter=require(_0xcf06('0x0'));var UserProfile=require(_0xcf06('0x1'))['db'][_0xcf06('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcf06('0x3')](0x0);var events={'afterCreate':_0xcf06('0x4'),'afterUpdate':'update','afterDestroy':_0xcf06('0x5')};function emitEvent(_0x2b98f4){return function(_0x1d0c26,_0x49218b,_0x171d05){UserProfileEvents[_0xcf06('0x6')](_0x2b98f4+':'+_0x1d0c26['id'],_0x1d0c26);UserProfileEvents[_0xcf06('0x6')](_0x2b98f4,_0x1d0c26);_0x171d05(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcf06('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a981d25..dea0bbe 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 _0xc2c7=['voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','teams','queuecampaigns','users','agents','telephones','Users','admin','Telephones','zendeskaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','Trunk','plugins','Plugin','extractedreports','Reports','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','query','section','mergeResources','isEmpty','length','UserProfileSection','find','params','all','push','autoAssociation','rawAttributes','keys','intersection','attributes','fields','nolimit','limit','offset','order','sort','where','filters','pick','merge','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','includeAll','include','reportType','reportId','DefaultReports','CustomReports','count','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','mail','openchannel','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','map','catch','field','model','associatedResources','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','name','membername','User','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2d7ade,_0x2013c8){_0x2d7ade=_0x2d7ade-0x0;var _0x47b190=_0xc2c7[_0x2d7ade];return _0x47b190;};'use strict';var _=require('lodash');var attributes=require(_0x7c2c('0x0'));var qs=require(_0x7c2c('0x1'));var squel=require(_0x7c2c('0x2'));module[_0x7c2c('0x3')]=function(_0x380d13){var _0x237e4d=_0x380d13[_0x7c2c('0x4')];function _0x116f8a(_0x4bbc14,_0x59f346){return new Promise(function(_0x31dc4e,_0x42ecc9){if(!_0x59f346)return _0x31dc4e(null);var _0x23c038=_0x59f346['filter']?{[_0x59f346['filter']['field']]:_0x59f346[_0x7c2c('0x5')][_0x7c2c('0x6')]}:undefined;return _0x237e4d[_0x4bbc14][_0x7c2c('0x7')]({'where':_0x23c038,'raw':!![]})[_0x7c2c('0x8')](function(_0x279cff){_0x59f346['associatedResources']=_[_0x7c2c('0x9')](_0x279cff,'id');_0x31dc4e(_0x59f346);})[_0x7c2c('0xa')](function(_0x285ff6){_0x42ecc9(_0x285ff6);});});}function _0x1bfeaf(_0x2587ec,_0x1c66b4){return new Promise(function(_0x2cb057,_0x38fc25){var _0xed73e8=_0x2587ec[_0x7c2c('0x5')]?{[_0x2587ec[_0x7c2c('0x5')][_0x7c2c('0xb')]]:_0x2587ec[_0x7c2c('0x5')][_0x7c2c('0x6')]}:undefined;return _0x237e4d[_0x2587ec[_0x7c2c('0xc')]][_0x7c2c('0x7')]({'where':_0xed73e8,'raw':!![]})['then'](function(_0x5b5729){_0x1c66b4[_0x7c2c('0xd')]=_[_0x7c2c('0x9')](_0x5b5729,function(_0x4678a8){return _0x4678a8['name'];});_0x2cb057(_0x1c66b4);})[_0x7c2c('0xa')](function(_0x206ecd){_0x38fc25(_0x206ecd);});});}function _0x5e55e0(_0x88f54b,_0x5a5fe2,_0x1aa355){if(!_0x5a5fe2)return Promise['resolve'](null);return new Promise(function(_0x342ea2,_0x3c948a){return _0x237e4d[_0x7c2c('0xe')][_0x7c2c('0x7')]({'where':{'sectionId':_0x5a5fe2['id']},'raw':!![]})[_0x7c2c('0x8')](function(_0x26be0f){if(_0x88f54b[_0x7c2c('0xb')]&&_0x88f54b[_0x7c2c('0xb')]!=='id'){_0x5a5fe2[_0x7c2c('0xd')]=_[_0x7c2c('0x9')](_0x26be0f,function(_0x40eaef){return _0x40eaef[_0x88f54b[_0x7c2c('0xb')]];});}else{if(_0x1aa355==='AnalyticExtractedReport'){_0x5a5fe2[_0x7c2c('0xd')]=_['map'](_0x26be0f,function(_0x506d47){return{'id':_0x506d47[_0x7c2c('0xf')],'type':_0x506d47[_0x7c2c('0x10')]};});}else{_0x5a5fe2[_0x7c2c('0xd')]=_[_0x7c2c('0x9')](_0x26be0f,function(_0x41552f){return _0x41552f[_0x7c2c('0xf')];});}}_0x342ea2(_0x5a5fe2);})[_0x7c2c('0xa')](function(_0x541368){_0x3c948a(_0x541368);});});}function _0x10c356(_0x4dedd8,_0x302c93){var _0x57f510={'parentSections':[]};switch(_0x4dedd8[_0x7c2c('0x11')]()){case _0x7c2c('0x12'):_0x57f510[_0x7c2c('0x13')]='SquareProject';break;case'odbc':_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x14');break;case _0x7c2c('0x15'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x16');_0x57f510[_0x7c2c('0x17')]=[{'name':_0x7c2c('0x18'),'field':'name','foreignKey':_0x7c2c('0x19')}];break;case _0x7c2c('0x1a'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x1b');break;case _0x7c2c('0x1c'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x1d');_0x57f510[_0x7c2c('0x17')]=[{'name':_0x7c2c('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0x7c2c('0x1f'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x20');break;case _0x7c2c('0x21'):_0x57f510['childModel']=_0x7c2c('0x22');break;case _0x7c2c('0x23'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x24');break;case _0x7c2c('0x25'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x26');break;case'chatwebsites':_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x27');break;case _0x7c2c('0x28'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x29');break;case'faxaccounts':_0x57f510['childModel']=_0x7c2c('0x2a');break;case'inboundroutes':case'internalroutes':case _0x7c2c('0x2b'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x2c');break;case _0x7c2c('0x2d'):_0x57f510['childModel']=_0x7c2c('0x2e');break;case _0x7c2c('0x2f'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x30');break;case _0x7c2c('0x31'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x32');_0x57f510[_0x7c2c('0x17')]=[{'name':_0x7c2c('0x33'),'field':_0x7c2c('0x34'),'foreignKey':_0x7c2c('0x35'),'model':_0x7c2c('0x36'),'filter':{'field':_0x7c2c('0x37'),'value':['agent']}},{'name':'Telephones','field':_0x7c2c('0x34'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0x7c2c('0x38')]}},{'name':_0x7c2c('0x39'),'field':_0x7c2c('0x34'),'foreignKey':_0x7c2c('0x3a'),'model':_0x7c2c('0x3b'),'filter':{'field':_0x7c2c('0x10'),'value':[_0x7c2c('0x3c')]}},{'name':_0x7c2c('0x3d'),'field':_0x7c2c('0x34'),'foreignKey':_0x7c2c('0x3a'),'model':_0x7c2c('0x3b'),'filter':{'field':'type','value':['outbound']}}];break;case _0x7c2c('0x3e'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x3f');break;case _0x7c2c('0x40'):_0x57f510['childModel']=_0x7c2c('0x41');break;case _0x7c2c('0x42'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x43');break;case _0x7c2c('0x44'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x45');break;case _0x7c2c('0x46'):_0x57f510[_0x7c2c('0x13')]='MailQueue';break;case _0x7c2c('0x47'):_0x57f510['childModel']=_0x7c2c('0x48');break;case _0x7c2c('0x49'):_0x57f510['childModel']=_0x7c2c('0x4a');break;case'openchannelqueues':_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x4b');break;case _0x7c2c('0x4c'):_0x57f510[_0x7c2c('0x13')]='OpenchannelAccount';break;case _0x7c2c('0x4d'):_0x57f510['childModel']='SmsQueue';break;case _0x7c2c('0x4e'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x4f');break;case'whatsappqueues':_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x50');break;case'whatsappaccounts':_0x57f510[_0x7c2c('0x13')]='WhatsappAccount';break;case _0x7c2c('0x51'):_0x57f510[_0x7c2c('0x13')]='Team';break;case'voicequeues':case _0x7c2c('0x52'):_0x57f510[_0x7c2c('0x13')]='VoiceQueue';if(_0x302c93){_0x57f510[_0x7c2c('0x17')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x7c2c('0x53'):case _0x7c2c('0x54'):case _0x7c2c('0x55'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x36');if(_0x302c93){_0x57f510[_0x7c2c('0x17')]=[{'name':_0x7c2c('0x56'),'filter':{'field':_0x7c2c('0x37'),'value':[_0x7c2c('0x57'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x7c2c('0x58')}];}break;case _0x7c2c('0x59'):_0x57f510[_0x7c2c('0x13')]='ZendeskAccount';break;case'salesforceaccounts':_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x5a');break;case _0x7c2c('0x5b'):_0x57f510[_0x7c2c('0x13')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x57f510['childModel']=_0x7c2c('0x5c');break;case _0x7c2c('0x5d'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x5e');break;case _0x7c2c('0x5f'):_0x57f510['childModel']=_0x7c2c('0x60');break;case _0x7c2c('0x61'):_0x57f510['childModel']=_0x7c2c('0x36');break;case'cannedanswers':_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x62');break;case _0x7c2c('0x63'):_0x57f510['childModel']='Disposition';break;case _0x7c2c('0x64'):_0x57f510['childModel']=_0x7c2c('0x65');break;case _0x7c2c('0x66'):_0x57f510['childModel']=_0x7c2c('0x67');break;case _0x7c2c('0x68'):_0x57f510['childModel']=_0x7c2c('0x69');break;case _0x7c2c('0x6a'):_0x57f510['childModel']=_0x7c2c('0x6b');break;case _0x7c2c('0x6c'):_0x57f510[_0x7c2c('0x13')]='Sound';break;case _0x7c2c('0x6d'):_0x57f510['childModel']=_0x7c2c('0x6e');break;case _0x7c2c('0x6f'):_0x57f510['childModel']=_0x7c2c('0x70');break;case _0x7c2c('0x71'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x72');break;case'trunks':_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x73');break;case'variables':_0x57f510[_0x7c2c('0x13')]='Variable';break;case _0x7c2c('0x74'):_0x57f510[_0x7c2c('0x13')]=_0x7c2c('0x75');break;case _0x7c2c('0x76'):_0x57f510[_0x7c2c('0x13')]='AnalyticExtractedReport';_0x57f510[_0x7c2c('0x17')]=[{'name':_0x7c2c('0x77'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x57f510['childModel']=_0x7c2c('0x78');break;}return _0x57f510;}function _0x4ada7a(_0x1e61fe,_0x4bcef3){var _0x469515=_0x1e61fe[_0x7c2c('0x79')](0x0)[_0x7c2c('0x7a')]()+_0x1e61fe[_0x7c2c('0x7b')](0x1);var _0x3c14af={'type':_0x237e4d[_0x7c2c('0x7c')][_0x7c2c('0x7d')][_0x7c2c('0x7e')],'raw':!![]};return new Promise(function(_0x5eb300,_0x570cd3){var _0x5baee8=squel[_0x7c2c('0x7f')]()[_0x7c2c('0xb')](_0x7c2c('0x80')+_0x469515+_0x7c2c('0x81'),'id')[_0x7c2c('0xb')](_0x7c2c('0x82'))[_0x7c2c('0x83')](_0x7c2c('0x84')+_0x1e61fe+'_interactions','ui')['where'](_0x7c2c('0x85'),_0x4bcef3['id']);return _0x237e4d[_0x7c2c('0x86')]['query'](_0x5baee8[_0x7c2c('0x87')](),_0x3c14af)['then'](function(_0x4dfd03){_0x4bcef3[_0x469515+_0x7c2c('0x88')]=_0x4dfd03;_0x5eb300(_0x4dfd03);})[_0x7c2c('0xa')](function(_0x2b4b31){_0x570cd3(_0x2b4b31);});});}return _0x380d13[_0x7c2c('0x89')](_0x7c2c('0x8a'),attributes,{'tableName':_0x7c2c('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2d4459){var _0x2a4de1={'raw':![],'where':{}};var _0xf06cd1={};var _0x44b953={'count':0x0,'rows':[]};var _0xd01d59=_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0x8d')];var _0x3d44f8=_0x2d4459['query'][_0x7c2c('0x8e')]||![];var _0x5404ec=_0x10c356(_0xd01d59,_0x3d44f8);if(!_0x5404ec['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0xd01d59+'\x27');var _0x4c0d0f=[{'name':_0xd01d59}];if(!_[_0x7c2c('0x8f')](_0x5404ec[_0x7c2c('0x17')]))_0x4c0d0f=_0x5404ec[_0x7c2c('0x17')];var _0x1ecc24=[];for(var _0x3e5655=0x0;_0x3e5655<_0x4c0d0f[_0x7c2c('0x90')];_0x3e5655++){_0x1ecc24['push'](_0x237e4d[_0x7c2c('0x91')][_0x7c2c('0x92')]({'where':{'userProfileId':_0x2d4459[_0x7c2c('0x93')]['id'],'name':_0x4c0d0f[_0x3e5655][_0x7c2c('0x34')]},'raw':!![]}));}return Promise[_0x7c2c('0x94')](_0x1ecc24)[_0x7c2c('0x8')](function(_0x49f520){var _0x289091=_[_0x7c2c('0x5')](_0x49f520,function(_0x49872b){return _0x49872b?_0x49872b:undefined;});var _0x39d319=_[_0x7c2c('0x5')](_0x4c0d0f,['ignore',!![]]);var _0x419bc2=_[_0x7c2c('0x8f')](_0x289091)&&_['isEmpty'](_0x39d319)?null:_['union'](_0x39d319,_0x289091);if(!_0x419bc2)return null;var _0x3ffadc=[];for(var _0x58299c=0x0;_0x58299c<_0x419bc2[_0x7c2c('0x90')];_0x58299c++){var _0x4ee3ad=_[_0x7c2c('0x92')](_0x4c0d0f,function(_0x1e099f){return _0x419bc2[_0x58299c]?_0x1e099f['name']===_0x419bc2[_0x58299c][_0x7c2c('0x34')]:null;});if(_0x4ee3ad){if(_0x419bc2[_0x58299c]['ignore']){_0x3ffadc[_0x7c2c('0x95')](_0x116f8a(_0x5404ec[_0x7c2c('0x13')],_0x419bc2[_0x58299c]));}else{if(!_0x419bc2[_0x58299c][_0x7c2c('0x96')]){_0x3ffadc['push'](_0x5e55e0(_0x4ee3ad,_0x419bc2[_0x58299c],_0x5404ec[_0x7c2c('0x13')]));}else{if(_0x4ee3ad[_0x7c2c('0xc')]){_0x3ffadc[_0x7c2c('0x95')](_0x1bfeaf(_0x4ee3ad,_0x419bc2[_0x58299c]));}}}}}return Promise[_0x7c2c('0x94')](_0x3ffadc);})['then'](function(_0x158352){var _0x1e711e=_0x158352;var _0x3e6d51=null;if(_0x1e711e){_0x3e6d51=_0x1e711e[_0x7c2c('0x90')]===0x1?_0x1e711e[0x0]:null;}if(!_0x3e6d51&&!_0x1e711e)return _0x44b953;var _0x418aba=_0x237e4d[_0x5404ec[_0x7c2c('0x13')]][_0x7c2c('0x97')];_0xf06cd1[_0x7c2c('0xc')]=_[_0x7c2c('0x98')](_0x418aba);_0xf06cd1['query']=_[_0x7c2c('0x98')](_0x2d4459[_0x7c2c('0x8c')]);_0xf06cd1['filters']=_[_0x7c2c('0x99')](_0xf06cd1['model'],_0xf06cd1['query']);_0x2a4de1[_0x7c2c('0x9a')]=_[_0x7c2c('0x99')](_0xf06cd1[_0x7c2c('0xc')],qs['fields'](_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0x9b')]));_0x2a4de1[_0x7c2c('0x9a')]=_0x2a4de1['attributes'][_0x7c2c('0x90')]?_0x2a4de1[_0x7c2c('0x9a')]:_0xf06cd1[_0x7c2c('0xc')];if(!_0x2d4459[_0x7c2c('0x8c')]['hasOwnProperty'](_0x7c2c('0x9c'))){_0x2a4de1['limit']=qs[_0x7c2c('0x9d')](_0x2d4459['query'][_0x7c2c('0x9d')]);_0x2a4de1[_0x7c2c('0x9e')]=qs[_0x7c2c('0x9e')](_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0x9e')]);}_0x2a4de1[_0x7c2c('0x9f')]=qs[_0x7c2c('0xa0')](_0x2d4459['query'][_0x7c2c('0xa0')]);_0x2a4de1[_0x7c2c('0xa1')]=qs[_0x7c2c('0xa2')](_[_0x7c2c('0xa3')](_0x2d4459[_0x7c2c('0x8c')],_0xf06cd1[_0x7c2c('0xa2')]));if(_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0x5')]){_0x2a4de1['where']=_[_0x7c2c('0xa4')](_0x2a4de1[_0x7c2c('0xa1')],{'$or':_[_0x7c2c('0x9')](_0x418aba,function(_0x308cdc){if(_0x308cdc[_0x7c2c('0x10')]['key']!==_0x7c2c('0xa5')){var _0x3acca9={};_0x3acca9[_0x308cdc['field']]={'$like':'%'+_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0x5')]+'%'};return _0x3acca9;}})});}var _0x528e8a=[];var _0x2d8d84=null;var _0x4ed2fc={};if(_0x3e6d51){_0x2d8d84=_[_0x7c2c('0x92')](_0x4c0d0f,[_0x7c2c('0x34'),_0x3e6d51[_0x7c2c('0x34')]]);if(_0x2d8d84[_0x7c2c('0xb')]){_0x4ed2fc={};if(_0x5404ec[_0x7c2c('0x13')]===_0x7c2c('0xa6')){_0x4ed2fc[_0x2d8d84[_0x7c2c('0xa7')]]=_['map'](_0x3e6d51[_0x7c2c('0xd')],'id');}else{_0x4ed2fc[_0x2d8d84[_0x7c2c('0xa7')]]=_0x3e6d51['associatedResources'];}_0x528e8a[_0x7c2c('0x95')](_0x4ed2fc);}else{_0x2a4de1[_0x7c2c('0xa1')]['id']=_0x3e6d51[_0x7c2c('0xd')];}}else{for(var _0x46726c=0x0;_0x46726c<_0x1e711e[_0x7c2c('0x90')];_0x46726c++){_0x2d8d84=_[_0x7c2c('0x92')](_0x4c0d0f,[_0x7c2c('0x34'),_0x1e711e[_0x46726c][_0x7c2c('0x34')]]);if(_0x2d8d84[_0x7c2c('0xb')]){_0x4ed2fc={};_0x4ed2fc[_0x2d8d84[_0x7c2c('0xa7')]]=_0x1e711e[_0x46726c][_0x7c2c('0xd')];_0x528e8a[_0x7c2c('0x95')](_0x4ed2fc);}else{if(!_0x2a4de1[_0x7c2c('0xa1')]['id'])_0x2a4de1[_0x7c2c('0xa1')]['id']=[];_0x1e711e[_0x46726c]['associatedResources'][_0x7c2c('0xa8')](function(_0x2bddbc){_0x2a4de1['where']['id'][_0x7c2c('0x95')](_0x2bddbc);});}}}if(!_[_0x7c2c('0x8f')](_0x528e8a)){_0x2a4de1[_0x7c2c('0xa1')]=_[_0x7c2c('0xa4')](_0x2a4de1[_0x7c2c('0xa1')],{'$and':{'$or':_0x528e8a}});}_0x2a4de1=_['merge']({},_0x2a4de1,_0x2d4459[_0x7c2c('0xa9')]);if(_0x3e6d51&&!_0x3e6d51[_0x7c2c('0x96')]&&_0x5404ec[_0x7c2c('0x13')]==='AnalyticExtractedReport'){if(_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0xaa')]){_0x2a4de1[_0x7c2c('0xab')]=[{'all':!![]}];}return _0x237e4d[_0x5404ec['childModel']][_0x7c2c('0x7')](_0x2a4de1)['then'](function(_0x342022){var _0x5f2a6b=[];_0x342022['forEach'](function(_0x1684db){var _0x1a9698;switch(_0x1684db[_0x7c2c('0xac')]){case'default':_0x1a9698=_[_0x7c2c('0x92')](_0x3e6d51[_0x7c2c('0xd')],function(_0x1d8f70){return _0x1d8f70['id']===_0x1684db[_0x7c2c('0xad')]&&_0x1d8f70['type']===_0x7c2c('0xae');});break;case'custom':_0x1a9698=_['find'](_0x3e6d51['associatedResources'],function(_0x5eb871){return _0x5eb871['id']===_0x1684db['reportId']&&_0x5eb871[_0x7c2c('0x10')]===_0x7c2c('0xaf');});break;}if(_0x1a9698)_0x5f2a6b[_0x7c2c('0x95')](_0x1684db);});_0x44b953[_0x7c2c('0xb0')]=_0x5f2a6b[_0x7c2c('0x90')];_0x44b953['rows']=_0x5f2a6b;return _0x44b953;});}else{return _0x237e4d[_0x5404ec[_0x7c2c('0x13')]][_0x7c2c('0xb0')]({'where':_0x2a4de1[_0x7c2c('0xa1')]})[_0x7c2c('0x8')](function(_0x36cb3a){_0x44b953[_0x7c2c('0xb0')]=_0x36cb3a;if(_0x2d4459['query']['includeAll']){if(_0x5404ec[_0x7c2c('0x13')]===_0x7c2c('0x1d')){_0x2a4de1[_0x7c2c('0xab')]=[{'model':_0x237e4d[_0x7c2c('0x6e')],'as':'Tags','attributes':['id',_0x7c2c('0x34'),_0x7c2c('0xb1')],'required':_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0xb2')]?!![]:![]},{'model':_0x237e4d[_0x7c2c('0x6e')],'as':_0x7c2c('0xb3'),'attributes':['id',_0x7c2c('0x34'),_0x7c2c('0xb1')],'through':_0x2d4459[_0x7c2c('0x8c')]['tag']?{'attributes':[],'where':{'TagId':_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0xb2')]||undefined}}:{},'required':_0x2d4459['query'][_0x7c2c('0xb2')]?!![]:![]}];}else{_0x2a4de1['include']=[{'all':!![]}];}}return _0x237e4d[_0x5404ec[_0x7c2c('0x13')]]['findAll'](_0x2a4de1);})[_0x7c2c('0x8')](function(_0x2dcc86){_0x44b953[_0x7c2c('0xb4')]=_0x2dcc86;if(_0xd01d59===_0x7c2c('0x33')&&_0x2d4459[_0x7c2c('0x8c')][_0x7c2c('0xb5')]===_0x7c2c('0xb6')){var _0x1eeb00=[];for(var _0x3fd718=0x0;_0x3fd718<_0x44b953['rows'][_0x7c2c('0x90')];_0x3fd718++){_0x1eeb00[_0x7c2c('0x95')](_0x4ada7a(_0x7c2c('0xb7'),_0x44b953['rows'][_0x3fd718][_0x7c2c('0xb8')]));_0x1eeb00[_0x7c2c('0x95')](_0x4ada7a('sms',_0x44b953[_0x7c2c('0xb4')][_0x3fd718]['dataValues']));_0x1eeb00[_0x7c2c('0x95')](_0x4ada7a('fax',_0x44b953[_0x7c2c('0xb4')][_0x3fd718][_0x7c2c('0xb8')]));_0x1eeb00[_0x7c2c('0x95')](_0x4ada7a(_0x7c2c('0xb9'),_0x44b953['rows'][_0x3fd718][_0x7c2c('0xb8')]));_0x1eeb00[_0x7c2c('0x95')](_0x4ada7a(_0x7c2c('0xba'),_0x44b953[_0x7c2c('0xb4')][_0x3fd718][_0x7c2c('0xb8')]));_0x1eeb00[_0x7c2c('0x95')](_0x4ada7a('whatsapp',_0x44b953[_0x7c2c('0xb4')][_0x3fd718]['dataValues']));}return Promise[_0x7c2c('0x94')](_0x1eeb00)[_0x7c2c('0x8')](function(){return _0x44b953;});}return _0x44b953;});}});}}});}; \ No newline at end of file +var _0xfdbd=['OpenTabs','UserProfile','user_profiles','section','length','push','find','params','all','ignore','isEmpty','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','merge','foreignKey','forEach','options','includeAll','include','default','reportId','DefaultReports','custom','count','rows','CmContact','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','then','associatedResources','map','catch','field','model','findAll','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','parentSections','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','VoiceQueues','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','AnalyticMetric','charAt','toUpperCase','slice','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query'];(function(_0x455633,_0x3e63ef){var _0x3daa1b=function(_0x14d6d8){while(--_0x14d6d8){_0x455633['push'](_0x455633['shift']());}};_0x3daa1b(++_0x3e63ef);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x34af74,_0x59ab9d){_0x34af74=_0x34af74-0x0;var _0x12d74b=_0xfdbd[_0x34af74];return _0x12d74b;};'use strict';var _=require(_0xdfdb('0x0'));var attributes=require(_0xdfdb('0x1'));var qs=require(_0xdfdb('0x2'));var squel=require(_0xdfdb('0x3'));module[_0xdfdb('0x4')]=function(_0x3078f0){var _0x11218a=_0x3078f0[_0xdfdb('0x5')];function _0x330ad3(_0x5945e0,_0x3f5b2d){return new Promise(function(_0x4a4a3f,_0x453ef6){if(!_0x3f5b2d)return _0x4a4a3f(null);var _0x41bd5e=_0x3f5b2d['filter']?{[_0x3f5b2d['filter']['field']]:_0x3f5b2d[_0xdfdb('0x6')][_0xdfdb('0x7')]}:undefined;return _0x11218a[_0x5945e0]['findAll']({'where':_0x41bd5e,'raw':!![]})[_0xdfdb('0x8')](function(_0x444c19){_0x3f5b2d[_0xdfdb('0x9')]=_[_0xdfdb('0xa')](_0x444c19,'id');_0x4a4a3f(_0x3f5b2d);})[_0xdfdb('0xb')](function(_0x1ace28){_0x453ef6(_0x1ace28);});});}function _0x2bb8d4(_0x47dccc,_0x28a9f3){return new Promise(function(_0x1972db,_0x527c05){var _0x293714=_0x47dccc[_0xdfdb('0x6')]?{[_0x47dccc[_0xdfdb('0x6')][_0xdfdb('0xc')]]:_0x47dccc[_0xdfdb('0x6')][_0xdfdb('0x7')]}:undefined;return _0x11218a[_0x47dccc[_0xdfdb('0xd')]][_0xdfdb('0xe')]({'where':_0x293714,'raw':!![]})['then'](function(_0x48a66a){_0x28a9f3[_0xdfdb('0x9')]=_['map'](_0x48a66a,function(_0x471ddc){return _0x471ddc[_0xdfdb('0xf')];});_0x1972db(_0x28a9f3);})[_0xdfdb('0xb')](function(_0x40bc8a){_0x527c05(_0x40bc8a);});});}function _0x3bfd81(_0x1cdb8b,_0x54ff23,_0x4fd3d5){if(!_0x54ff23)return Promise[_0xdfdb('0x10')](null);return new Promise(function(_0x8b9193,_0x2c1070){return _0x11218a['UserProfileResource'][_0xdfdb('0xe')]({'where':{'sectionId':_0x54ff23['id']},'raw':!![]})[_0xdfdb('0x8')](function(_0x467653){if(_0x1cdb8b[_0xdfdb('0xc')]&&_0x1cdb8b[_0xdfdb('0xc')]!=='id'){_0x54ff23[_0xdfdb('0x9')]=_[_0xdfdb('0xa')](_0x467653,function(_0x29a639){return _0x29a639[_0x1cdb8b['field']];});}else{if(_0x4fd3d5===_0xdfdb('0x11')){_0x54ff23[_0xdfdb('0x9')]=_[_0xdfdb('0xa')](_0x467653,function(_0x5cc70b){return{'id':_0x5cc70b[_0xdfdb('0x12')],'type':_0x5cc70b[_0xdfdb('0x13')]};});}else{_0x54ff23[_0xdfdb('0x9')]=_['map'](_0x467653,function(_0x280e53){return _0x280e53[_0xdfdb('0x12')];});}}_0x8b9193(_0x54ff23);})[_0xdfdb('0xb')](function(_0x489fd4){_0x2c1070(_0x489fd4);});});}function _0x2a80c1(_0x526057,_0x2db1c1){var _0x145350={'parentSections':[]};switch(_0x526057[_0xdfdb('0x14')]()){case _0xdfdb('0x15'):_0x145350['childModel']=_0xdfdb('0x16');break;case _0xdfdb('0x17'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x19');break;case _0xdfdb('0x1a'):_0x145350[_0xdfdb('0x18')]='SquareRecording';_0x145350[_0xdfdb('0x1b')]=[{'name':_0xdfdb('0x1c'),'field':_0xdfdb('0xf'),'foreignKey':'projectName'}];break;case _0xdfdb('0x1d'):_0x145350['childModel']=_0xdfdb('0x1e');break;case _0xdfdb('0x1f'):_0x145350[_0xdfdb('0x18')]='CmContact';_0x145350['parentSections']=[{'name':_0xdfdb('0x20'),'field':'id','foreignKey':_0xdfdb('0x21')}];break;case _0xdfdb('0x22'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x23');break;case _0xdfdb('0x24'):_0x145350['childModel']=_0xdfdb('0x25');break;case _0xdfdb('0x26'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x27');break;case _0xdfdb('0x28'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x29');break;case _0xdfdb('0x2a'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x2b');break;case _0xdfdb('0x2c'):_0x145350['childModel']='FaxQueue';break;case _0xdfdb('0x2d'):_0x145350['childModel']=_0xdfdb('0x2e');break;case _0xdfdb('0x2f'):case _0xdfdb('0x30'):case _0xdfdb('0x31'):_0x145350['childModel']=_0xdfdb('0x32');break;case'contexts':_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x33');break;case _0xdfdb('0x34'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x35');break;case _0xdfdb('0x36'):_0x145350['childModel']=_0xdfdb('0x37');_0x145350[_0xdfdb('0x1b')]=[{'name':'Agents','field':_0xdfdb('0xf'),'foreignKey':_0xdfdb('0x38'),'model':_0xdfdb('0x39'),'filter':{'field':_0xdfdb('0x3a'),'value':[_0xdfdb('0x3b')]}},{'name':_0xdfdb('0x3c'),'field':_0xdfdb('0xf'),'foreignKey':_0xdfdb('0x38'),'model':_0xdfdb('0x39'),'filter':{'field':_0xdfdb('0x3a'),'value':[_0xdfdb('0x3d')]}},{'name':'VoiceQueues','field':_0xdfdb('0xf'),'foreignKey':_0xdfdb('0x3e'),'model':_0xdfdb('0x3f'),'filter':{'field':_0xdfdb('0x13'),'value':[_0xdfdb('0x40')]}},{'name':_0xdfdb('0x41'),'field':_0xdfdb('0xf'),'foreignKey':_0xdfdb('0x3e'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xdfdb('0x42')]}}];break;case _0xdfdb('0x43'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x44');break;case _0xdfdb('0x45'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x46');break;case _0xdfdb('0x47'):_0x145350[_0xdfdb('0x18')]='VoicePrefix';break;case _0xdfdb('0x48'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x49');break;case _0xdfdb('0x4a'):_0x145350[_0xdfdb('0x18')]='MailQueue';break;case _0xdfdb('0x4b'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x4c');break;case _0xdfdb('0x4d'):_0x145350[_0xdfdb('0x18')]='MailSubstatus';break;case _0xdfdb('0x4e'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x4f');break;case'openchannelaccounts':_0x145350[_0xdfdb('0x18')]='OpenchannelAccount';break;case _0xdfdb('0x50'):_0x145350['childModel']=_0xdfdb('0x51');break;case _0xdfdb('0x52'):_0x145350['childModel']=_0xdfdb('0x53');break;case'whatsappqueues':_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x54');break;case _0xdfdb('0x55'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x56');break;case'teams':_0x145350['childModel']=_0xdfdb('0x57');break;case _0xdfdb('0x58'):case'queuecampaigns':_0x145350[_0xdfdb('0x18')]='VoiceQueue';if(_0x2db1c1){_0x145350[_0xdfdb('0x1b')]=[{'name':_0xdfdb('0x59')},{'name':_0xdfdb('0x41')}];}break;case _0xdfdb('0x5a'):case _0xdfdb('0x5b'):case _0xdfdb('0x5c'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x39');if(_0x2db1c1){_0x145350[_0xdfdb('0x1b')]=[{'name':_0xdfdb('0x5d'),'filter':{'field':_0xdfdb('0x3a'),'value':[_0xdfdb('0x5e'),_0xdfdb('0x5f')]},'ignore':!![]},{'name':_0xdfdb('0x60')},{'name':_0xdfdb('0x3c')}];}break;case _0xdfdb('0x61'):_0x145350['childModel']='ZendeskAccount';break;case _0xdfdb('0x62'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x63');break;case'freshdeskaccounts':_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x64');break;case _0xdfdb('0x65'):_0x145350[_0xdfdb('0x18')]='SugarcrmAccount';break;case _0xdfdb('0x66'):_0x145350[_0xdfdb('0x18')]='DeskAccount';break;case _0xdfdb('0x67'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x68');break;case _0xdfdb('0x69'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x39');break;case _0xdfdb('0x6a'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x6b');break;case'dispositions':_0x145350[_0xdfdb('0x18')]='Disposition';break;case _0xdfdb('0x6c'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x6d');break;case _0xdfdb('0x6e'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x6f');break;case _0xdfdb('0x70'):_0x145350['childModel']=_0xdfdb('0x71');break;case _0xdfdb('0x72'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x73');break;case _0xdfdb('0x74'):_0x145350['childModel']=_0xdfdb('0x75');break;case'tags':_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x76');break;case _0xdfdb('0x77'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x78');break;case'triggers':_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x79');break;case'trunks':_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x7a');break;case _0xdfdb('0x7b'):_0x145350['childModel']=_0xdfdb('0x7c');break;case _0xdfdb('0x7d'):_0x145350[_0xdfdb('0x18')]=_0xdfdb('0x7e');break;case _0xdfdb('0x7f'):_0x145350[_0xdfdb('0x18')]='AnalyticExtractedReport';_0x145350['parentSections']=[{'name':_0xdfdb('0x80'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x145350['childModel']=_0xdfdb('0x81');break;}return _0x145350;}function _0x273afa(_0x1a9541,_0x1b5f17){var _0x8bd5c0=_0x1a9541[_0xdfdb('0x82')](0x0)[_0xdfdb('0x83')]()+_0x1a9541[_0xdfdb('0x84')](0x1);var _0xb43af={'type':_0x11218a['Sequelize']['QueryTypes'][_0xdfdb('0x85')],'raw':!![]};return new Promise(function(_0x4a9654,_0x3e9f7e){var _0x10fd62=squel[_0xdfdb('0x86')]()['field'](_0xdfdb('0x87')+_0x8bd5c0+_0xdfdb('0x88'),'id')[_0xdfdb('0xc')](_0xdfdb('0x89'))[_0xdfdb('0x8a')](_0xdfdb('0x8b')+_0x1a9541+_0xdfdb('0x8c'),'ui')[_0xdfdb('0x8d')]('ui.UserId\x20=\x20?',_0x1b5f17['id']);return _0x11218a[_0xdfdb('0x8e')][_0xdfdb('0x8f')](_0x10fd62['toString'](),_0xb43af)[_0xdfdb('0x8')](function(_0x425307){_0x1b5f17[_0x8bd5c0+_0xdfdb('0x90')]=_0x425307;_0x4a9654(_0x425307);})[_0xdfdb('0xb')](function(_0x4ca57b){_0x3e9f7e(_0x4ca57b);});});}return _0x3078f0['define'](_0xdfdb('0x91'),attributes,{'tableName':_0xdfdb('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4cd890){var _0x1dea5d={'raw':![],'where':{}};var _0x2b8776={};var _0x1cb63d={'count':0x0,'rows':[]};var _0x5ef75a=_0x4cd890['query'][_0xdfdb('0x93')];var _0x4f29b9=_0x4cd890['query']['mergeResources']||![];var _0x1339a9=_0x2a80c1(_0x5ef75a,_0x4f29b9);if(!_0x1339a9['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x5ef75a+'\x27');var _0x90d435=[{'name':_0x5ef75a}];if(!_['isEmpty'](_0x1339a9[_0xdfdb('0x1b')]))_0x90d435=_0x1339a9[_0xdfdb('0x1b')];var _0x59498e=[];for(var _0x4816bc=0x0;_0x4816bc<_0x90d435[_0xdfdb('0x94')];_0x4816bc++){_0x59498e[_0xdfdb('0x95')](_0x11218a['UserProfileSection'][_0xdfdb('0x96')]({'where':{'userProfileId':_0x4cd890[_0xdfdb('0x97')]['id'],'name':_0x90d435[_0x4816bc][_0xdfdb('0xf')]},'raw':!![]}));}return Promise[_0xdfdb('0x98')](_0x59498e)[_0xdfdb('0x8')](function(_0x5f2942){var _0x5eba53=_[_0xdfdb('0x6')](_0x5f2942,function(_0x2d6be9){return _0x2d6be9?_0x2d6be9:undefined;});var _0x25fd98=_[_0xdfdb('0x6')](_0x90d435,[_0xdfdb('0x99'),!![]]);var _0xe1461f=_['isEmpty'](_0x5eba53)&&_[_0xdfdb('0x9a')](_0x25fd98)?null:_[_0xdfdb('0x9b')](_0x25fd98,_0x5eba53);if(!_0xe1461f)return null;var _0x2662bf=[];for(var _0x30054b=0x0;_0x30054b<_0xe1461f[_0xdfdb('0x94')];_0x30054b++){var _0x1bcfdd=_[_0xdfdb('0x96')](_0x90d435,function(_0x4cdcdc){return _0xe1461f[_0x30054b]?_0x4cdcdc[_0xdfdb('0xf')]===_0xe1461f[_0x30054b][_0xdfdb('0xf')]:null;});if(_0x1bcfdd){if(_0xe1461f[_0x30054b]['ignore']){_0x2662bf[_0xdfdb('0x95')](_0x330ad3(_0x1339a9[_0xdfdb('0x18')],_0xe1461f[_0x30054b]));}else{if(!_0xe1461f[_0x30054b][_0xdfdb('0x9c')]){_0x2662bf[_0xdfdb('0x95')](_0x3bfd81(_0x1bcfdd,_0xe1461f[_0x30054b],_0x1339a9[_0xdfdb('0x18')]));}else{if(_0x1bcfdd['model']){_0x2662bf[_0xdfdb('0x95')](_0x2bb8d4(_0x1bcfdd,_0xe1461f[_0x30054b]));}}}}}return Promise[_0xdfdb('0x98')](_0x2662bf);})[_0xdfdb('0x8')](function(_0x1a31b9){var _0x4999c4=_0x1a31b9;var _0x4769b4=null;if(_0x4999c4){_0x4769b4=_0x4999c4[_0xdfdb('0x94')]===0x1?_0x4999c4[0x0]:null;}if(!_0x4769b4&&!_0x4999c4)return _0x1cb63d;var _0x2b4c29=_0x11218a[_0x1339a9[_0xdfdb('0x18')]][_0xdfdb('0x9d')];_0x2b8776[_0xdfdb('0xd')]=_[_0xdfdb('0x9e')](_0x2b4c29);_0x2b8776[_0xdfdb('0x8f')]=_[_0xdfdb('0x9e')](_0x4cd890[_0xdfdb('0x8f')]);_0x2b8776[_0xdfdb('0x9f')]=_['intersection'](_0x2b8776[_0xdfdb('0xd')],_0x2b8776[_0xdfdb('0x8f')]);_0x1dea5d['attributes']=_[_0xdfdb('0xa0')](_0x2b8776[_0xdfdb('0xd')],qs[_0xdfdb('0xa1')](_0x4cd890['query']['fields']));_0x1dea5d['attributes']=_0x1dea5d[_0xdfdb('0xa2')][_0xdfdb('0x94')]?_0x1dea5d[_0xdfdb('0xa2')]:_0x2b8776[_0xdfdb('0xd')];if(!_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0xa3')](_0xdfdb('0xa4'))){_0x1dea5d['limit']=qs[_0xdfdb('0xa5')](_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0xa5')]);_0x1dea5d[_0xdfdb('0xa6')]=qs[_0xdfdb('0xa6')](_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0xa6')]);}_0x1dea5d['order']=qs[_0xdfdb('0xa7')](_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0xa7')]);_0x1dea5d[_0xdfdb('0x8d')]=qs[_0xdfdb('0x9f')](_['pick'](_0x4cd890[_0xdfdb('0x8f')],_0x2b8776['filters']));if(_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0x6')]){_0x1dea5d[_0xdfdb('0x8d')]=_[_0xdfdb('0xa8')](_0x1dea5d[_0xdfdb('0x8d')],{'$or':_['map'](_0x2b4c29,function(_0x3361b1){if(_0x3361b1[_0xdfdb('0x13')]['key']!=='VIRTUAL'){var _0x284439={};_0x284439[_0x3361b1['field']]={'$like':'%'+_0x4cd890['query'][_0xdfdb('0x6')]+'%'};return _0x284439;}})});}var _0x36d46e=[];var _0x17e4d2=null;var _0x278bff={};if(_0x4769b4){_0x17e4d2=_[_0xdfdb('0x96')](_0x90d435,[_0xdfdb('0xf'),_0x4769b4[_0xdfdb('0xf')]]);if(_0x17e4d2[_0xdfdb('0xc')]){_0x278bff={};if(_0x1339a9['childModel']===_0xdfdb('0x11')){_0x278bff[_0x17e4d2['foreignKey']]=_[_0xdfdb('0xa')](_0x4769b4[_0xdfdb('0x9')],'id');}else{_0x278bff[_0x17e4d2[_0xdfdb('0xa9')]]=_0x4769b4[_0xdfdb('0x9')];}_0x36d46e[_0xdfdb('0x95')](_0x278bff);}else{_0x1dea5d['where']['id']=_0x4769b4[_0xdfdb('0x9')];}}else{for(var _0x64639f=0x0;_0x64639f<_0x4999c4[_0xdfdb('0x94')];_0x64639f++){_0x17e4d2=_[_0xdfdb('0x96')](_0x90d435,[_0xdfdb('0xf'),_0x4999c4[_0x64639f]['name']]);if(_0x17e4d2['field']){_0x278bff={};_0x278bff[_0x17e4d2[_0xdfdb('0xa9')]]=_0x4999c4[_0x64639f][_0xdfdb('0x9')];_0x36d46e['push'](_0x278bff);}else{if(!_0x1dea5d[_0xdfdb('0x8d')]['id'])_0x1dea5d['where']['id']=[];_0x4999c4[_0x64639f][_0xdfdb('0x9')][_0xdfdb('0xaa')](function(_0xeadf25){_0x1dea5d['where']['id'][_0xdfdb('0x95')](_0xeadf25);});}}}if(!_['isEmpty'](_0x36d46e)){_0x1dea5d['where']=_[_0xdfdb('0xa8')](_0x1dea5d['where'],{'$and':{'$or':_0x36d46e}});}_0x1dea5d=_[_0xdfdb('0xa8')]({},_0x1dea5d,_0x4cd890[_0xdfdb('0xab')]);if(_0x4769b4&&!_0x4769b4[_0xdfdb('0x9c')]&&_0x1339a9[_0xdfdb('0x18')]===_0xdfdb('0x11')){if(_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0xac')]){_0x1dea5d[_0xdfdb('0xad')]=[{'all':!![]}];}return _0x11218a[_0x1339a9[_0xdfdb('0x18')]][_0xdfdb('0xe')](_0x1dea5d)['then'](function(_0x5d2dc1){var _0xb48246=[];_0x5d2dc1['forEach'](function(_0x58e7ba){var _0x5542da;switch(_0x58e7ba['reportType']){case _0xdfdb('0xae'):_0x5542da=_[_0xdfdb('0x96')](_0x4769b4[_0xdfdb('0x9')],function(_0x3fe730){return _0x3fe730['id']===_0x58e7ba[_0xdfdb('0xaf')]&&_0x3fe730[_0xdfdb('0x13')]===_0xdfdb('0xb0');});break;case _0xdfdb('0xb1'):_0x5542da=_[_0xdfdb('0x96')](_0x4769b4[_0xdfdb('0x9')],function(_0x396b3a){return _0x396b3a['id']===_0x58e7ba[_0xdfdb('0xaf')]&&_0x396b3a[_0xdfdb('0x13')]==='CustomReports';});break;}if(_0x5542da)_0xb48246['push'](_0x58e7ba);});_0x1cb63d[_0xdfdb('0xb2')]=_0xb48246[_0xdfdb('0x94')];_0x1cb63d[_0xdfdb('0xb3')]=_0xb48246;return _0x1cb63d;});}else{return _0x11218a[_0x1339a9[_0xdfdb('0x18')]][_0xdfdb('0xb2')]({'where':_0x1dea5d[_0xdfdb('0x8d')]})[_0xdfdb('0x8')](function(_0x421578){_0x1cb63d[_0xdfdb('0xb2')]=_0x421578;if(_0x4cd890['query'][_0xdfdb('0xac')]){if(_0x1339a9[_0xdfdb('0x18')]===_0xdfdb('0xb4')){_0x1dea5d[_0xdfdb('0xad')]=[{'model':_0x11218a[_0xdfdb('0x76')],'as':_0xdfdb('0xb5'),'attributes':['id','name',_0xdfdb('0xb6')],'required':_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0xb7')]?!![]:![]},{'model':_0x11218a[_0xdfdb('0x76')],'as':_0xdfdb('0xb8'),'attributes':['id',_0xdfdb('0xf'),'color'],'through':_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0xb7')]?{'attributes':[],'where':{'TagId':_0x4cd890[_0xdfdb('0x8f')]['tag']||undefined}}:{},'required':_0x4cd890['query'][_0xdfdb('0xb7')]?!![]:![]}];}else{_0x1dea5d['include']=[{'all':!![]}];}}return _0x11218a[_0x1339a9['childModel']][_0xdfdb('0xe')](_0x1dea5d);})[_0xdfdb('0x8')](function(_0x57d5e3){_0x1cb63d['rows']=_0x57d5e3;if(_0x5ef75a===_0xdfdb('0x60')&&_0x4cd890[_0xdfdb('0x8f')][_0xdfdb('0xb9')]===_0xdfdb('0xba')){var _0x36b01e=[];for(var _0x5b883b=0x0;_0x5b883b<_0x1cb63d['rows'][_0xdfdb('0x94')];_0x5b883b++){_0x36b01e['push'](_0x273afa(_0xdfdb('0xbb'),_0x1cb63d[_0xdfdb('0xb3')][_0x5b883b][_0xdfdb('0xbc')]));_0x36b01e['push'](_0x273afa(_0xdfdb('0xbd'),_0x1cb63d[_0xdfdb('0xb3')][_0x5b883b][_0xdfdb('0xbc')]));_0x36b01e[_0xdfdb('0x95')](_0x273afa('fax',_0x1cb63d[_0xdfdb('0xb3')][_0x5b883b][_0xdfdb('0xbc')]));_0x36b01e[_0xdfdb('0x95')](_0x273afa(_0xdfdb('0xbe'),_0x1cb63d['rows'][_0x5b883b][_0xdfdb('0xbc')]));_0x36b01e['push'](_0x273afa('openchannel',_0x1cb63d['rows'][_0x5b883b]['dataValues']));_0x36b01e['push'](_0x273afa(_0xdfdb('0xbf'),_0x1cb63d[_0xdfdb('0xb3')][_0x5b883b][_0xdfdb('0xbc')]));}return Promise[_0xdfdb('0x98')](_0x36b01e)[_0xdfdb('0x8')](function(){return _0x1cb63d;});}return _0x1cb63d;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9ff189a..3cdfe2d 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 _0x556a=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4d4a8c,_0x7f9c1d){var _0x5c7a85=function(_0x2d464e){while(--_0x2d464e){_0x4d4a8c['push'](_0x4d4a8c['shift']());}};_0x5c7a85(++_0x7f9c1d);}(_0x556a,0x1dd));var _0xa556=function(_0x55c8e3,_0x4addd4){_0x55c8e3=_0x55c8e3-0x0;var _0x7e6c2c=_0x556a[_0x55c8e3];return _0x7e6c2c;};'use strict';var _=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var moment=require(_0xa556('0x2'));var BPromise=require(_0xa556('0x3'));var rs=require(_0xa556('0x4'));var fs=require('fs');var Redis=require(_0xa556('0x5'));var db=require(_0xa556('0x6'))['db'];var utils=require(_0xa556('0x7'));var logger=require(_0xa556('0x8'))('rpc');var config=require(_0xa556('0x9'));var jayson=require(_0xa556('0xa'));var client=jayson[_0xa556('0xb')][_0xa556('0xc')]({'port':0x232a});config[_0xa556('0xd')]=_['defaults'](config[_0xa556('0xd')],{'host':_0xa556('0xe'),'port':0x18eb});var socket=require(_0xa556('0xf'))(new Redis(config[_0xa556('0xd')]));require('./userProfile.socket')[_0xa556('0x10')](socket);function respondWithRpcPromise(_0x39f436,_0x714523,_0x309515){return new BPromise(function(_0x3beb12,_0x3a4428){return client[_0xa556('0x11')](_0x39f436,_0x309515)[_0xa556('0x12')](function(_0x5771ec){logger[_0xa556('0x13')]('UserProfile,\x20%s,\x20%s',_0x714523,_0xa556('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x714523,_0xa556('0x14'),JSON[_0xa556('0x15')](_0x5771ec));if(_0x5771ec[_0xa556('0x16')]){if(_0x5771ec[_0xa556('0x16')]['code']===0x1f4){logger[_0xa556('0x16')](_0xa556('0x17'),_0x714523,_0x5771ec[_0xa556('0x16')][_0xa556('0x18')]);return _0x3a4428(_0x5771ec[_0xa556('0x16')]['message']);}logger['error'](_0xa556('0x17'),_0x714523,_0x5771ec[_0xa556('0x16')]['message']);return _0x3beb12(_0x5771ec[_0xa556('0x16')]['message']);}else{logger['info'](_0xa556('0x17'),_0x714523,_0xa556('0x14'));_0x3beb12(_0x5771ec[_0xa556('0x19')][_0xa556('0x18')]);}})[_0xa556('0x1a')](function(_0x341e52){logger['error'](_0xa556('0x17'),_0x714523,_0x341e52);_0x3a4428(_0x341e52);});});} \ No newline at end of file +var _0x5464=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment'];(function(_0x401269,_0xfc8b27){var _0x7389b6=function(_0x501f36){while(--_0x501f36){_0x401269['push'](_0x401269['shift']());}};_0x7389b6(++_0xfc8b27);}(_0x5464,0x15d));var _0x4546=function(_0x4ac032,_0x47d235){_0x4ac032=_0x4ac032-0x0;var _0xc22a4b=_0x5464[_0x4ac032];return _0xc22a4b;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4546('0x9')](config[_0x4546('0xa')],{'host':_0x4546('0xb'),'port':0x18eb});var socket=require(_0x4546('0xc'))(new Redis(config[_0x4546('0xa')]));require(_0x4546('0xd'))[_0x4546('0xe')](socket);function respondWithRpcPromise(_0x430b2e,_0x383bf2,_0x4ac723){return new BPromise(function(_0x1dd3f5,_0x8a15e2){return client[_0x4546('0xf')](_0x430b2e,_0x4ac723)['then'](function(_0x1f82c9){logger[_0x4546('0x10')](_0x4546('0x11'),_0x383bf2,_0x4546('0x12'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x383bf2,_0x4546('0x12'),JSON['stringify'](_0x1f82c9));if(_0x1f82c9['error']){if(_0x1f82c9['error']['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x383bf2,_0x1f82c9[_0x4546('0x13')]['message']);return _0x8a15e2(_0x1f82c9[_0x4546('0x13')]['message']);}logger[_0x4546('0x13')]('UserProfile,\x20%s,\x20%s',_0x383bf2,_0x1f82c9[_0x4546('0x13')][_0x4546('0x14')]);return _0x1dd3f5(_0x1f82c9[_0x4546('0x13')][_0x4546('0x14')]);}else{logger[_0x4546('0x10')](_0x4546('0x11'),_0x383bf2,'request\x20sent');_0x1dd3f5(_0x1f82c9['result']['message']);}})[_0x4546('0x15')](function(_0x39f552){logger[_0x4546('0x13')](_0x4546('0x11'),_0x383bf2,_0x39f552);_0x8a15e2(_0x39f552);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 64b244e..991d22f 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 _0xe46a=['remove','update','removeListener','register','length','userProfile:','./userProfile.events','save'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xe46a,0x146));var _0xae46=function(_0x21f8b9,_0x5589e7){_0x21f8b9=_0x21f8b9-0x0;var _0x5d843e=_0xe46a[_0x21f8b9];return _0x5d843e;};'use strict';var UserProfileEvents=require(_0xae46('0x0'));var events=[_0xae46('0x1'),_0xae46('0x2'),_0xae46('0x3')];function createListener(_0x30ba0a,_0x4faed1){return function(_0x34b016){_0x4faed1['emit'](_0x30ba0a,_0x34b016);};}function removeListener(_0x441be9,_0x3a5e3d){return function(){UserProfileEvents[_0xae46('0x4')](_0x441be9,_0x3a5e3d);};}exports[_0xae46('0x5')]=function(_0x4b7a3d){for(var _0x1e93dd=0x0,_0x4a948d=events[_0xae46('0x6')];_0x1e93dd<_0x4a948d;_0x1e93dd++){var _0x2b96c3=events[_0x1e93dd];var _0x55a6b1=createListener(_0xae46('0x7')+_0x2b96c3,_0x4b7a3d);UserProfileEvents['on'](_0x2b96c3,_0x55a6b1);}}; \ No newline at end of file +var _0x3585=['remove','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x3585,0x186));var _0x5358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3585[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0x5358('0x0'));var events=[_0x5358('0x1'),_0x5358('0x2'),'update'];function createListener(_0x52ac40,_0x1f7e1c){return function(_0x44c6e5){_0x1f7e1c[_0x5358('0x3')](_0x52ac40,_0x44c6e5);};}function removeListener(_0x441796,_0x50e103){return function(){UserProfileEvents[_0x5358('0x4')](_0x441796,_0x50e103);};}exports['register']=function(_0x5b22d8){for(var _0x5f0c2b=0x0,_0x24091f=events[_0x5358('0x5')];_0x5f0c2b<_0x24091f;_0x5f0c2b++){var _0xa50702=events[_0x5f0c2b];var _0x4c0135=createListener(_0x5358('0x6')+_0xa50702,_0x5b22d8);UserProfileEvents['on'](_0xa50702,_0x4c0135);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 19942b8..d2a3d68 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 _0x77c4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','create','update','delete','destroy','express'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x77c4,0x167));var _0x477c=function(_0x3f52b1,_0x56a0cf){_0x3f52b1=_0x3f52b1-0x0;var _0x30333d=_0x77c4[_0x3f52b1];return _0x30333d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x477c('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x477c('0x1'));var interaction=require(_0x477c('0x2'));var config=require(_0x477c('0x3'));var controller=require(_0x477c('0x4'));router[_0x477c('0x5')]('/',auth[_0x477c('0x6')](),controller[_0x477c('0x7')]);router[_0x477c('0x5')](_0x477c('0x8'),auth[_0x477c('0x6')](),controller['describe']);router['get'](_0x477c('0x9'),auth[_0x477c('0x6')](),controller[_0x477c('0xa')]);router['post']('/',auth[_0x477c('0x6')](),controller[_0x477c('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x477c('0xc')]);router[_0x477c('0xd')](_0x477c('0x9'),auth[_0x477c('0x6')](),controller[_0x477c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb49b=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','post','update'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xb49b,0x81));var _0xbb49=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb49b[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xbb49('0x0'));var util=require(_0xbb49('0x1'));var path=require(_0xbb49('0x2'));var timeout=require(_0xbb49('0x3'));var express=require(_0xbb49('0x4'));var router=express['Router']();var fs_extra=require(_0xbb49('0x5'));var auth=require(_0xbb49('0x6'));var interaction=require(_0xbb49('0x7'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xbb49('0x8')]('/',auth[_0xbb49('0x9')](),controller['index']);router[_0xbb49('0x8')](_0xbb49('0xa'),auth[_0xbb49('0x9')](),controller['describe']);router[_0xbb49('0x8')](_0xbb49('0xb'),auth['isAuthenticated'](),controller[_0xbb49('0xc')]);router[_0xbb49('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbb49('0xb'),auth[_0xbb49('0x9')](),controller[_0xbb49('0xe')]);router[_0xbb49('0xf')](_0xbb49('0xb'),auth['isAuthenticated'](),controller[_0xbb49('0x10')]);module[_0xbb49('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 2f03414..1810740 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 _0x2dc0=['sequelize','exports'];(function(_0x4f5401,_0xd817c1){var _0x5205c3=function(_0x3d91e5){while(--_0x3d91e5){_0x4f5401['push'](_0x4f5401['shift']());}};_0x5205c3(++_0xd817c1);}(_0x2dc0,0x1ae));var _0x02dc=function(_0xf6e698,_0x1c7cc7){_0xf6e698=_0xf6e698-0x0;var _0x147aa6=_0x2dc0[_0xf6e698];return _0x147aa6;};'use strict';var Sequelize=require(_0x02dc('0x0'));module[_0x02dc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xfec5=['exports','INTEGER','STRING','sequelize'];(function(_0x3a4b6c,_0x3b8490){var _0x59b956=function(_0x4c2d88){while(--_0x4c2d88){_0x3a4b6c['push'](_0x3a4b6c['shift']());}};_0x59b956(++_0x3b8490);}(_0xfec5,0x77));var _0x5fec=function(_0x56ea50,_0x268152){_0x56ea50=_0x56ea50-0x0;var _0x1da47f=_0xfec5[_0x56ea50];return _0x1da47f;};'use strict';var Sequelize=require(_0x5fec('0x0'));module[_0x5fec('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5fec('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5fec('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 2a56808..a5a25a4 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 _0x1261=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','UserProfileResource','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x391623,_0x3b5e44){var _0x264fe2=function(_0x5d3329){while(--_0x5d3329){_0x391623['push'](_0x391623['shift']());}};_0x264fe2(++_0x3b5e44);}(_0x1261,0x144));var _0x1126=function(_0x1ebd10,_0x4914b4){_0x1ebd10=_0x1ebd10-0x0;var _0x1004d3=_0x1261[_0x1ebd10];return _0x1004d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['UserProfileResource'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['UserProfileResource']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));};exports[_0x1126('0x45')]=function(_0x52a9a4,_0x3cb44c){return db[_0x1126('0x29')][_0x1126('0x45')]()[_0x1126('0x25')](respondWithResult(_0x3cb44c,null))['catch'](handleError(_0x3cb44c,null));}; \ No newline at end of file +var _0x5f66=['bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0x2697d9,_0x26806a){var _0x25e6ae=function(_0x4ff250){while(--_0x4ff250){_0x2697d9['push'](_0x2697d9['shift']());}};_0x25e6ae(++_0x26806a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['UserProfileResource'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['UserProfileResource'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 6720806..364cbd5 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 _0xbce9=['sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x58b387,_0x5da34b){var _0x183e4d=function(_0x513b10){while(--_0x513b10){_0x58b387['push'](_0x58b387['shift']());}};_0x183e4d(++_0x5da34b);}(_0xbce9,0x144));var _0x9bce=function(_0x451735,_0x391a76){_0x451735=_0x451735-0x0;var _0x41d1e2=_0xbce9[_0x451735];return _0x41d1e2;};'use strict';var _=require(_0x9bce('0x0'));var util=require(_0x9bce('0x1'));var logger=require(_0x9bce('0x2'))(_0x9bce('0x3'));var moment=require(_0x9bce('0x4'));var BPromise=require(_0x9bce('0x5'));var rp=require(_0x9bce('0x6'));var fs=require('fs');var path=require(_0x9bce('0x7'));var rimraf=require(_0x9bce('0x8'));var config=require('../../config/environment');var attributes=require(_0x9bce('0x9'));module[_0x9bce('0xa')]=function(_0x3c1f59,_0x4c6fb1){return _0x3c1f59[_0x9bce('0xb')](_0x9bce('0xc'),attributes,{'tableName':_0x9bce('0xd'),'paranoid':![],'indexes':[{'name':_0x9bce('0xe'),'fields':[_0x9bce('0xf'),_0x9bce('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x558c=['UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x47d74e,_0x551ade){var _0x320904=function(_0x5ac5bf){while(--_0x5ac5bf){_0x47d74e['push'](_0x47d74e['shift']());}};_0x320904(++_0x551ade);}(_0x558c,0x1c6));var _0xc558=function(_0x5ab16c,_0x38fe88){_0x5ab16c=_0x5ab16c-0x0;var _0x1e0384=_0x558c[_0x5ab16c];return _0x1e0384;};'use strict';var _=require(_0xc558('0x0'));var util=require(_0xc558('0x1'));var logger=require(_0xc558('0x2'))(_0xc558('0x3'));var moment=require(_0xc558('0x4'));var BPromise=require(_0xc558('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc558('0x6'));var rimraf=require(_0xc558('0x7'));var config=require(_0xc558('0x8'));var attributes=require(_0xc558('0x9'));module[_0xc558('0xa')]=function(_0x3eacfa,_0x496eba){return _0x3eacfa['define'](_0xc558('0xb'),attributes,{'tableName':_0xc558('0xc'),'paranoid':![],'indexes':[{'name':_0xc558('0xd'),'fields':[_0xc558('0xe'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 531004c..a290503 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 _0x659b=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x455558,_0x39e78c){var _0x135a14=function(_0x5880d2){while(--_0x5880d2){_0x455558['push'](_0x455558['shift']());}};_0x135a14(++_0x39e78c);}(_0x659b,0x7a));var _0xb659=function(_0x12c32f,_0x2293d0){_0x12c32f=_0x12c32f-0x0;var _0x189c55=_0x659b[_0x12c32f];return _0x189c55;};'use strict';var _=require(_0xb659('0x0'));var util=require(_0xb659('0x1'));var moment=require(_0xb659('0x2'));var BPromise=require(_0xb659('0x3'));var rs=require(_0xb659('0x4'));var fs=require('fs');var Redis=require(_0xb659('0x5'));var db=require(_0xb659('0x6'))['db'];var utils=require(_0xb659('0x7'));var logger=require('../../config/logger')(_0xb659('0x8'));var config=require(_0xb659('0x9'));var jayson=require(_0xb659('0xa'));var client=jayson[_0xb659('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e0714,_0x4c6f84,_0x4641c0){return new BPromise(function(_0x1f52c9,_0x1f8279){return client[_0xb659('0xc')](_0x3e0714,_0x4641c0)[_0xb659('0xd')](function(_0x3a2e78){logger[_0xb659('0xe')](_0xb659('0xf'),_0x4c6f84,_0xb659('0x10'));logger['debug'](_0xb659('0x11'),_0x4c6f84,'request\x20sent',JSON[_0xb659('0x12')](_0x3a2e78));if(_0x3a2e78[_0xb659('0x13')]){if(_0x3a2e78[_0xb659('0x13')][_0xb659('0x14')]===0x1f4){logger[_0xb659('0x13')](_0xb659('0xf'),_0x4c6f84,_0x3a2e78[_0xb659('0x13')][_0xb659('0x15')]);return _0x1f8279(_0x3a2e78[_0xb659('0x13')][_0xb659('0x15')]);}logger[_0xb659('0x13')](_0xb659('0xf'),_0x4c6f84,_0x3a2e78[_0xb659('0x13')]['message']);return _0x1f52c9(_0x3a2e78[_0xb659('0x13')][_0xb659('0x15')]);}else{logger[_0xb659('0xe')](_0xb659('0xf'),_0x4c6f84,_0xb659('0x10'));_0x1f52c9(_0x3a2e78[_0xb659('0x16')][_0xb659('0x15')]);}})[_0xb659('0x17')](function(_0x160df1){logger['error'](_0xb659('0xf'),_0x4c6f84,_0x160df1);_0x1f8279(_0x160df1);});});} \ No newline at end of file +var _0x4646=['then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4646,0xd1));var _0x6464=function(_0x547cdf,_0x1cf71a){_0x547cdf=_0x547cdf-0x0;var _0x5a15d6=_0x4646[_0x547cdf];return _0x5a15d6;};'use strict';var _=require(_0x6464('0x0'));var util=require(_0x6464('0x1'));var moment=require('moment');var BPromise=require(_0x6464('0x2'));var rs=require(_0x6464('0x3'));var fs=require('fs');var Redis=require(_0x6464('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6464('0x5'));var logger=require(_0x6464('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6464('0x7'));var client=jayson[_0x6464('0x8')][_0x6464('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x323e3c,_0x3d36c2,_0x1c0751){return new BPromise(function(_0x43887c,_0x497c84){return client[_0x6464('0xa')](_0x323e3c,_0x1c0751)[_0x6464('0xb')](function(_0x26ded0){logger['info'](_0x6464('0xc'),_0x3d36c2,_0x6464('0xd'));logger[_0x6464('0xe')](_0x6464('0xf'),_0x3d36c2,_0x6464('0xd'),JSON[_0x6464('0x10')](_0x26ded0));if(_0x26ded0[_0x6464('0x11')]){if(_0x26ded0[_0x6464('0x11')][_0x6464('0x12')]===0x1f4){logger[_0x6464('0x11')](_0x6464('0xc'),_0x3d36c2,_0x26ded0[_0x6464('0x11')][_0x6464('0x13')]);return _0x497c84(_0x26ded0[_0x6464('0x11')][_0x6464('0x13')]);}logger[_0x6464('0x11')](_0x6464('0xc'),_0x3d36c2,_0x26ded0[_0x6464('0x11')][_0x6464('0x13')]);return _0x43887c(_0x26ded0['error']['message']);}else{logger[_0x6464('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x3d36c2,_0x6464('0xd'));_0x43887c(_0x26ded0['result'][_0x6464('0x13')]);}})[_0x6464('0x15')](function(_0x59f5e7){logger['error'](_0x6464('0xc'),_0x3d36c2,_0x59f5e7);_0x497c84(_0x59f5e7);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0a34cc8..ee1b91e 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 _0x848f=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41e7cc,_0x3e893e){var _0x4a79cf=function(_0x2056d7){while(--_0x2056d7){_0x41e7cc['push'](_0x41e7cc['shift']());}};_0x4a79cf(++_0x3e893e);}(_0x848f,0xf4));var _0xf848=function(_0x338e0d,_0x4d61a5){_0x338e0d=_0x338e0d-0x0;var _0x16540c=_0x848f[_0x338e0d];return _0x16540c;};'use strict';var multer=require(_0xf848('0x0'));var util=require('util');var path=require(_0xf848('0x1'));var timeout=require('connect-timeout');var express=require(_0xf848('0x2'));var router=express[_0xf848('0x3')]();var fs_extra=require(_0xf848('0x4'));var auth=require(_0xf848('0x5'));var interaction=require(_0xf848('0x6'));var config=require(_0xf848('0x7'));var controller=require(_0xf848('0x8'));router[_0xf848('0x9')]('/',auth[_0xf848('0xa')](),controller['index']);router['get'](_0xf848('0xb'),auth[_0xf848('0xa')](),controller[_0xf848('0xc')]);router['get'](_0xf848('0xd'),auth[_0xf848('0xa')](),controller[_0xf848('0xe')]);router[_0xf848('0xf')]('/',auth[_0xf848('0xa')](),controller[_0xf848('0x10')]);router[_0xf848('0x11')](_0xf848('0xd'),auth[_0xf848('0xa')](),controller[_0xf848('0x12')]);router[_0xf848('0x13')]('/:id',auth[_0xf848('0xa')](),controller['destroy']);module[_0xf848('0x14')]=router; \ No newline at end of file +var _0xee60=['delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x54aae5,_0x1779e6){var _0x431b3c=function(_0x58ab7d){while(--_0x58ab7d){_0x54aae5['push'](_0x54aae5['shift']());}};_0x431b3c(++_0x1779e6);}(_0xee60,0x120));var _0x0ee6=function(_0x144d6a,_0x1b8913){_0x144d6a=_0x144d6a-0x0;var _0x1c1b03=_0xee60[_0x144d6a];return _0x1c1b03;};'use strict';var multer=require(_0x0ee6('0x0'));var util=require(_0x0ee6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ee6('0x2'));var router=express['Router']();var fs_extra=require(_0x0ee6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0ee6('0x4'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x0ee6('0x5')]('/',auth['isAuthenticated'](),controller[_0x0ee6('0x6')]);router[_0x0ee6('0x5')](_0x0ee6('0x7'),auth[_0x0ee6('0x8')](),controller[_0x0ee6('0x9')]);router[_0x0ee6('0x5')](_0x0ee6('0xa'),auth[_0x0ee6('0x8')](),controller[_0x0ee6('0xb')]);router[_0x0ee6('0xc')]('/',auth['isAuthenticated'](),controller[_0x0ee6('0xd')]);router[_0x0ee6('0xe')](_0x0ee6('0xa'),auth[_0x0ee6('0x8')](),controller[_0x0ee6('0xf')]);router[_0x0ee6('0x10')](_0x0ee6('0xa'),auth[_0x0ee6('0x8')](),controller[_0x0ee6('0x11')]);module[_0x0ee6('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5c52dd7..c93eea6 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 _0x0713=['getDataValue','split','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x4721c7,_0xda4dff){var _0x31ddb2=function(_0x3f92cb){while(--_0x3f92cb){_0x4721c7['push'](_0x4721c7['shift']());}};_0x31ddb2(++_0xda4dff);}(_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':![]},'category':{'type':Sequelize[_0x3071('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3071('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3071('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3071('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2c547f){this[_0x3071('0x3')](_0x3071('0x4'),_0x2c547f?_0x2c547f[_0x3071('0x5')](''):[]);},'get':function(){return this[_0x3071('0x6')](_0x3071('0x4'))?this[_0x3071('0x6')](_0x3071('0x4'))[_0x3071('0x7')](''):[];}}}; \ No newline at end of file +var _0xed3c=['join','getDataValue','sequelize','exports','STRING','BOOLEAN','crudPermissions'];(function(_0x1743f4,_0x5e3d77){var _0x520515=function(_0x56d8b4){while(--_0x56d8b4){_0x1743f4['push'](_0x1743f4['shift']());}};_0x520515(++_0x5e3d77);}(_0xed3c,0x1a6));var _0xced3=function(_0x4f66ef,_0x3d47ef){_0x4f66ef=_0x4f66ef-0x0;var _0x34c6ec=_0xed3c[_0x4f66ef];return _0x34c6ec;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'name':{'type':Sequelize[_0xced3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xced3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xced3('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xced3('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xced3('0x2')],'set':function(_0x5f03e0){this['setDataValue'](_0xced3('0x4'),_0x5f03e0?_0x5f03e0[_0xced3('0x5')](''):[]);},'get':function(){return this[_0xced3('0x6')](_0xced3('0x4'))?this['getDataValue']('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 40c0a67..f2a7467 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 _0x77a5=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','set','apply','save','update','destroy','then','error','stack','name','index','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','merge','map','VIRTUAL','filter','options','includeAll','include','UserProfileSection','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x77a5,0x117));var _0x577a=function(_0x56440b,_0x4ceec2){_0x56440b=_0x56440b-0x0;var _0x237d95=_0x77a5[_0x56440b];return _0x237d95;};'use strict';var emlformat=require(_0x577a('0x0'));var rimraf=require(_0x577a('0x1'));var zipdir=require(_0x577a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x577a('0x3'));var moment=require('moment');var BPromise=require(_0x577a('0x4'));var Mustache=require(_0x577a('0x5'));var util=require(_0x577a('0x6'));var path=require('path');var sox=require(_0x577a('0x7'));var csv=require(_0x577a('0x8'));var ejs=require(_0x577a('0x9'));var fs=require('fs');var fs_extra=require(_0x577a('0xa'));var _=require(_0x577a('0xb'));var squel=require('squel');var crypto=require(_0x577a('0xc'));var jsforce=require(_0x577a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x577a('0xe'));var Papa=require(_0x577a('0xf'));var Redis=require('ioredis');var authService=require(_0x577a('0x10'));var qs=require(_0x577a('0x11'));var as=require(_0x577a('0x12'));var hardwareService=require(_0x577a('0x13'));var logger=require('../../config/logger')(_0x577a('0x14'));var utils=require('../../config/utils');var config=require(_0x577a('0x15'));var licenseUtil=require(_0x577a('0x16'));var db=require(_0x577a('0x17'))['db'];function respondWithStatusCode(_0x4e1238,_0x5e12a5){_0x5e12a5=_0x5e12a5||0xcc;return function(_0x20ee34){if(_0x20ee34){return _0x4e1238[_0x577a('0x18')](_0x5e12a5);}return _0x4e1238['status'](_0x5e12a5)[_0x577a('0x19')]();};}function respondWithResult(_0x143699,_0x133cdd){_0x133cdd=_0x133cdd||0xc8;return function(_0x5a8a40){if(_0x5a8a40){return _0x143699[_0x577a('0x1a')](_0x133cdd)[_0x577a('0x1b')](_0x5a8a40);}};}function respondWithFilteredResult(_0x3492e6,_0x29dc1c){return function(_0x52f604){if(_0x52f604){var _0x52c82b=typeof _0x29dc1c['offset']==='undefined'&&typeof _0x29dc1c[_0x577a('0x1c')]===_0x577a('0x1d');var _0x3d2ee7=_0x52f604[_0x577a('0x1e')];var _0x55d951=_0x52c82b?0x0:_0x29dc1c['offset'];var _0x52e684=_0x52c82b?_0x52f604[_0x577a('0x1e')]:_0x29dc1c['offset']+_0x29dc1c['limit'];var _0x461748;if(_0x52e684>=_0x3d2ee7){_0x52e684=_0x3d2ee7;_0x461748=0xc8;}else{_0x461748=0xce;}_0x3492e6[_0x577a('0x1a')](_0x461748);return _0x3492e6[_0x577a('0x1f')]('Content-Range',_0x55d951+'-'+_0x52e684+'/'+_0x3d2ee7)['json'](_0x52f604);}return null;};}function patchUpdates(_0x36daaa){return function(_0x451735){try{jsonpatch[_0x577a('0x20')](_0x451735,_0x36daaa,!![]);}catch(_0x3da926){return BPromise['reject'](_0x3da926);}return _0x451735[_0x577a('0x21')]();};}function saveUpdates(_0x455c08,_0x2681cd){return function(_0x10c306){if(_0x10c306){return _0x10c306[_0x577a('0x22')](_0x455c08)['then'](function(_0xce10ac){return _0xce10ac;});}return null;};}function removeEntity(_0x16a186,_0x102673){return function(_0x2ca74e){if(_0x2ca74e){return _0x2ca74e[_0x577a('0x23')]()[_0x577a('0x24')](function(){_0x16a186[_0x577a('0x1a')](0xcc)[_0x577a('0x19')]();});}};}function handleEntityNotFound(_0x15b148,_0x528e7f){return function(_0x78c83e){if(!_0x78c83e){_0x15b148[_0x577a('0x18')](0x194);}return _0x78c83e;};}function handleError(_0x4c31db,_0x205c7e){_0x205c7e=_0x205c7e||0x1f4;return function(_0x97db0f){logger[_0x577a('0x25')](_0x97db0f[_0x577a('0x26')]);if(_0x97db0f[_0x577a('0x27')]){delete _0x97db0f['name'];}_0x4c31db['status'](_0x205c7e)['send'](_0x97db0f);};}exports[_0x577a('0x28')]=function(_0x4cc507,_0x5567f8){var _0x464074={},_0x41bc53={},_0x3b8edf={'count':0x0,'rows':[]};var _0x496859=_['map'](db['UserProfileSection'][_0x577a('0x29')],function(_0x5237c9){return{'name':_0x5237c9['fieldName'],'type':_0x5237c9[_0x577a('0x2a')][_0x577a('0x2b')]};});_0x41bc53[_0x577a('0x2c')]=_['map'](_0x496859,_0x577a('0x27'));_0x41bc53['query']=_[_0x577a('0x2d')](_0x4cc507['query']);_0x41bc53['filters']=_[_0x577a('0x2e')](_0x41bc53[_0x577a('0x2c')],_0x41bc53[_0x577a('0x2f')]);_0x464074[_0x577a('0x30')]=_[_0x577a('0x2e')](_0x41bc53[_0x577a('0x2c')],qs['fields'](_0x4cc507[_0x577a('0x2f')][_0x577a('0x31')]));_0x464074[_0x577a('0x30')]=_0x464074['attributes'][_0x577a('0x32')]?_0x464074['attributes']:_0x41bc53[_0x577a('0x2c')];if(!_0x4cc507[_0x577a('0x2f')][_0x577a('0x33')](_0x577a('0x34'))){_0x464074['limit']=qs['limit'](_0x4cc507['query'][_0x577a('0x1c')]);_0x464074['offset']=qs[_0x577a('0x35')](_0x4cc507[_0x577a('0x2f')][_0x577a('0x35')]);}_0x464074['order']=qs[_0x577a('0x36')](_0x4cc507['query']['sort']);_0x464074[_0x577a('0x37')]=qs[_0x577a('0x38')](_['pick'](_0x4cc507[_0x577a('0x2f')],_0x41bc53[_0x577a('0x38')]),_0x496859);if(_0x4cc507[_0x577a('0x2f')]['filter']){_0x464074[_0x577a('0x37')]=_[_0x577a('0x39')](_0x464074[_0x577a('0x37')],{'$or':_[_0x577a('0x3a')](_0x496859,function(_0x272a04){if(_0x272a04['type']!==_0x577a('0x3b')){var _0x166c85={};_0x166c85[_0x272a04[_0x577a('0x27')]]={'$like':'%'+_0x4cc507[_0x577a('0x2f')][_0x577a('0x3c')]+'%'};return _0x166c85;}})});}_0x464074=_[_0x577a('0x39')]({},_0x464074,_0x4cc507[_0x577a('0x3d')]);var _0x422694={'where':_0x464074['where']};return db['UserProfileSection'][_0x577a('0x1e')](_0x422694)[_0x577a('0x24')](function(_0x22b0e5){_0x3b8edf[_0x577a('0x1e')]=_0x22b0e5;if(_0x4cc507[_0x577a('0x2f')][_0x577a('0x3e')]){_0x464074[_0x577a('0x3f')]=[{'all':!![]}];}return db[_0x577a('0x40')][_0x577a('0x41')](_0x464074);})[_0x577a('0x24')](function(_0x2609c0){_0x3b8edf['rows']=_0x2609c0;return _0x3b8edf;})['then'](respondWithFilteredResult(_0x5567f8,_0x464074))[_0x577a('0x42')](handleError(_0x5567f8,null));};exports[_0x577a('0x43')]=function(_0x10a8cd,_0x340ac8){var _0xcbd59e={'raw':![],'where':{'id':_0x10a8cd['params']['id']}},_0x2991ad={};_0x2991ad[_0x577a('0x2c')]=_[_0x577a('0x2d')](db['UserProfileSection']['rawAttributes']);_0x2991ad[_0x577a('0x2f')]=_[_0x577a('0x2d')](_0x10a8cd[_0x577a('0x2f')]);_0x2991ad['filters']=_[_0x577a('0x2e')](_0x2991ad[_0x577a('0x2c')],_0x2991ad['query']);_0xcbd59e[_0x577a('0x30')]=_['intersection'](_0x2991ad[_0x577a('0x2c')],qs[_0x577a('0x31')](_0x10a8cd[_0x577a('0x2f')][_0x577a('0x31')]));_0xcbd59e['attributes']=_0xcbd59e[_0x577a('0x30')]['length']?_0xcbd59e[_0x577a('0x30')]:_0x2991ad[_0x577a('0x2c')];if(_0x10a8cd[_0x577a('0x2f')][_0x577a('0x3e')]){_0xcbd59e[_0x577a('0x3f')]=[{'all':!![]}];}_0xcbd59e=_['merge']({},_0xcbd59e,_0x10a8cd[_0x577a('0x3d')]);return db['UserProfileSection'][_0x577a('0x44')](_0xcbd59e)[_0x577a('0x24')](handleEntityNotFound(_0x340ac8,null))[_0x577a('0x24')](respondWithResult(_0x340ac8,null))['catch'](handleError(_0x340ac8,null));};exports[_0x577a('0x45')]=function(_0x42914c,_0x8af084){return db[_0x577a('0x40')][_0x577a('0x45')](_0x42914c[_0x577a('0x46')],{})[_0x577a('0x24')](respondWithResult(_0x8af084,0xc9))[_0x577a('0x42')](handleError(_0x8af084,null));};exports[_0x577a('0x22')]=function(_0x2a7bc4,_0x35a607){if(_0x2a7bc4[_0x577a('0x46')]['id']){delete _0x2a7bc4[_0x577a('0x46')]['id'];}return db[_0x577a('0x40')][_0x577a('0x44')]({'where':{'id':_0x2a7bc4[_0x577a('0x47')]['id']}})[_0x577a('0x24')](handleEntityNotFound(_0x35a607,null))[_0x577a('0x24')](saveUpdates(_0x2a7bc4[_0x577a('0x46')],null))['then'](respondWithResult(_0x35a607,null))['catch'](handleError(_0x35a607,null));};exports[_0x577a('0x23')]=function(_0x5311fd,_0x29c3f6){return db['UserProfileSection'][_0x577a('0x44')]({'where':{'id':_0x5311fd[_0x577a('0x47')]['id']}})[_0x577a('0x24')](handleEntityNotFound(_0x29c3f6,null))[_0x577a('0x24')](removeEntity(_0x29c3f6,null))[_0x577a('0x42')](handleError(_0x29c3f6,null));};exports[_0x577a('0x48')]=function(_0x18abf8,_0xed9ea){return db[_0x577a('0x40')][_0x577a('0x48')]()[_0x577a('0x24')](respondWithResult(_0xed9ea,null))['catch'](handleError(_0xed9ea,null));}; \ No newline at end of file +var _0xbe6a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service'];(function(_0x3ae639,_0x2b1305){var _0x21945e=function(_0x1dcde5){while(--_0x1dcde5){_0x3ae639['push'](_0x3ae639['shift']());}};_0x21945e(++_0x2b1305);}(_0xbe6a,0x85));var _0xabe6=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0xbe6a[_0x101802];return _0x5d61ce;};'use strict';var emlformat=require(_0xabe6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabe6('0x1'));var jsonpatch=require(_0xabe6('0x2'));var rp=require('request-promise');var moment=require(_0xabe6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xabe6('0x4'));var util=require('util');var path=require(_0xabe6('0x5'));var sox=require(_0xabe6('0x6'));var csv=require('to-csv');var ejs=require(_0xabe6('0x7'));var fs=require('fs');var fs_extra=require(_0xabe6('0x8'));var _=require('lodash');var squel=require(_0xabe6('0x9'));var crypto=require(_0xabe6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xabe6('0xb'));var toCsv=require(_0xabe6('0xc'));var querystring=require(_0xabe6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xabe6('0xe'));var qs=require(_0xabe6('0xf'));var as=require(_0xabe6('0x10'));var hardwareService=require(_0xabe6('0x11'));var logger=require(_0xabe6('0x12'))(_0xabe6('0x13'));var utils=require('../../config/utils');var config=require(_0xabe6('0x14'));var licenseUtil=require(_0xabe6('0x15'));var db=require(_0xabe6('0x16'))['db'];function respondWithStatusCode(_0x57f7d5,_0x324d29){_0x324d29=_0x324d29||0xcc;return function(_0x42b012){if(_0x42b012){return _0x57f7d5['sendStatus'](_0x324d29);}return _0x57f7d5[_0xabe6('0x17')](_0x324d29)[_0xabe6('0x18')]();};}function respondWithResult(_0x53f5aa,_0x14f2e6){_0x14f2e6=_0x14f2e6||0xc8;return function(_0x4ed480){if(_0x4ed480){return _0x53f5aa[_0xabe6('0x17')](_0x14f2e6)['json'](_0x4ed480);}};}function respondWithFilteredResult(_0x599498,_0x317900){return function(_0x282d32){if(_0x282d32){var _0x135265=typeof _0x317900[_0xabe6('0x19')]===_0xabe6('0x1a')&&typeof _0x317900[_0xabe6('0x1b')]===_0xabe6('0x1a');var _0x107f4e=_0x282d32[_0xabe6('0x1c')];var _0x1dd5c7=_0x135265?0x0:_0x317900['offset'];var _0x5297e7=_0x135265?_0x282d32[_0xabe6('0x1c')]:_0x317900[_0xabe6('0x19')]+_0x317900['limit'];var _0x1212a9;if(_0x5297e7>=_0x107f4e){_0x5297e7=_0x107f4e;_0x1212a9=0xc8;}else{_0x1212a9=0xce;}_0x599498[_0xabe6('0x17')](_0x1212a9);return _0x599498[_0xabe6('0x1d')]('Content-Range',_0x1dd5c7+'-'+_0x5297e7+'/'+_0x107f4e)[_0xabe6('0x1e')](_0x282d32);}return null;};}function patchUpdates(_0x4422cb){return function(_0xe5dd70){try{jsonpatch[_0xabe6('0x1f')](_0xe5dd70,_0x4422cb,!![]);}catch(_0x5d82b1){return BPromise[_0xabe6('0x20')](_0x5d82b1);}return _0xe5dd70[_0xabe6('0x21')]();};}function saveUpdates(_0x47f377,_0x211fd9){return function(_0x3f3652){if(_0x3f3652){return _0x3f3652[_0xabe6('0x22')](_0x47f377)['then'](function(_0x3ac444){return _0x3ac444;});}return null;};}function removeEntity(_0x5935ec,_0x2e3ab9){return function(_0x337f89){if(_0x337f89){return _0x337f89[_0xabe6('0x23')]()[_0xabe6('0x24')](function(){_0x5935ec['status'](0xcc)[_0xabe6('0x18')]();});}};}function handleEntityNotFound(_0x1a6034,_0x525149){return function(_0x4d7c7d){if(!_0x4d7c7d){_0x1a6034[_0xabe6('0x25')](0x194);}return _0x4d7c7d;};}function handleError(_0x2b10bf,_0x4a4949){_0x4a4949=_0x4a4949||0x1f4;return function(_0x2046a9){logger['error'](_0x2046a9[_0xabe6('0x26')]);if(_0x2046a9[_0xabe6('0x27')]){delete _0x2046a9[_0xabe6('0x27')];}_0x2b10bf[_0xabe6('0x17')](_0x4a4949)[_0xabe6('0x28')](_0x2046a9);};}exports[_0xabe6('0x29')]=function(_0x7f1719,_0x109335){var _0x37fbf8={},_0x476765={},_0x45f0c8={'count':0x0,'rows':[]};var _0x351f38=_[_0xabe6('0x2a')](db[_0xabe6('0x2b')][_0xabe6('0x2c')],function(_0x476284){return{'name':_0x476284['fieldName'],'type':_0x476284[_0xabe6('0x2d')][_0xabe6('0x2e')]};});_0x476765['model']=_[_0xabe6('0x2a')](_0x351f38,_0xabe6('0x27'));_0x476765[_0xabe6('0x2f')]=_[_0xabe6('0x30')](_0x7f1719[_0xabe6('0x2f')]);_0x476765[_0xabe6('0x31')]=_[_0xabe6('0x32')](_0x476765[_0xabe6('0x33')],_0x476765[_0xabe6('0x2f')]);_0x37fbf8['attributes']=_[_0xabe6('0x32')](_0x476765['model'],qs[_0xabe6('0x34')](_0x7f1719[_0xabe6('0x2f')]['fields']));_0x37fbf8[_0xabe6('0x35')]=_0x37fbf8[_0xabe6('0x35')][_0xabe6('0x36')]?_0x37fbf8[_0xabe6('0x35')]:_0x476765[_0xabe6('0x33')];if(!_0x7f1719[_0xabe6('0x2f')][_0xabe6('0x37')](_0xabe6('0x38'))){_0x37fbf8[_0xabe6('0x1b')]=qs[_0xabe6('0x1b')](_0x7f1719[_0xabe6('0x2f')]['limit']);_0x37fbf8[_0xabe6('0x19')]=qs[_0xabe6('0x19')](_0x7f1719[_0xabe6('0x2f')][_0xabe6('0x19')]);}_0x37fbf8[_0xabe6('0x39')]=qs[_0xabe6('0x3a')](_0x7f1719[_0xabe6('0x2f')]['sort']);_0x37fbf8['where']=qs['filters'](_[_0xabe6('0x3b')](_0x7f1719[_0xabe6('0x2f')],_0x476765[_0xabe6('0x31')]),_0x351f38);if(_0x7f1719[_0xabe6('0x2f')][_0xabe6('0x3c')]){_0x37fbf8[_0xabe6('0x3d')]=_[_0xabe6('0x3e')](_0x37fbf8[_0xabe6('0x3d')],{'$or':_[_0xabe6('0x2a')](_0x351f38,function(_0x3ecbd1){if(_0x3ecbd1['type']!=='VIRTUAL'){var _0xcb859b={};_0xcb859b[_0x3ecbd1[_0xabe6('0x27')]]={'$like':'%'+_0x7f1719[_0xabe6('0x2f')][_0xabe6('0x3c')]+'%'};return _0xcb859b;}})});}_0x37fbf8=_['merge']({},_0x37fbf8,_0x7f1719[_0xabe6('0x3f')]);var _0x19dbde={'where':_0x37fbf8[_0xabe6('0x3d')]};return db['UserProfileSection']['count'](_0x19dbde)[_0xabe6('0x24')](function(_0x3e95af){_0x45f0c8['count']=_0x3e95af;if(_0x7f1719['query'][_0xabe6('0x40')]){_0x37fbf8[_0xabe6('0x41')]=[{'all':!![]}];}return db[_0xabe6('0x2b')][_0xabe6('0x42')](_0x37fbf8);})[_0xabe6('0x24')](function(_0x9fd873){_0x45f0c8[_0xabe6('0x43')]=_0x9fd873;return _0x45f0c8;})[_0xabe6('0x24')](respondWithFilteredResult(_0x109335,_0x37fbf8))[_0xabe6('0x44')](handleError(_0x109335,null));};exports['show']=function(_0x160784,_0x46e6eb){var _0x4ba66b={'raw':![],'where':{'id':_0x160784[_0xabe6('0x45')]['id']}},_0x141fbe={};_0x141fbe[_0xabe6('0x33')]=_[_0xabe6('0x30')](db[_0xabe6('0x2b')][_0xabe6('0x2c')]);_0x141fbe[_0xabe6('0x2f')]=_[_0xabe6('0x30')](_0x160784[_0xabe6('0x2f')]);_0x141fbe[_0xabe6('0x31')]=_['intersection'](_0x141fbe[_0xabe6('0x33')],_0x141fbe[_0xabe6('0x2f')]);_0x4ba66b[_0xabe6('0x35')]=_[_0xabe6('0x32')](_0x141fbe[_0xabe6('0x33')],qs[_0xabe6('0x34')](_0x160784['query'][_0xabe6('0x34')]));_0x4ba66b[_0xabe6('0x35')]=_0x4ba66b['attributes'][_0xabe6('0x36')]?_0x4ba66b[_0xabe6('0x35')]:_0x141fbe[_0xabe6('0x33')];if(_0x160784[_0xabe6('0x2f')]['includeAll']){_0x4ba66b[_0xabe6('0x41')]=[{'all':!![]}];}_0x4ba66b=_[_0xabe6('0x3e')]({},_0x4ba66b,_0x160784['options']);return db['UserProfileSection'][_0xabe6('0x46')](_0x4ba66b)[_0xabe6('0x24')](handleEntityNotFound(_0x46e6eb,null))[_0xabe6('0x24')](respondWithResult(_0x46e6eb,null))[_0xabe6('0x44')](handleError(_0x46e6eb,null));};exports[_0xabe6('0x47')]=function(_0x4735b8,_0x4a469a){return db[_0xabe6('0x2b')][_0xabe6('0x47')](_0x4735b8[_0xabe6('0x48')],{})[_0xabe6('0x24')](respondWithResult(_0x4a469a,0xc9))['catch'](handleError(_0x4a469a,null));};exports['update']=function(_0x5c1d12,_0x3cc7f3){if(_0x5c1d12[_0xabe6('0x48')]['id']){delete _0x5c1d12[_0xabe6('0x48')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x5c1d12[_0xabe6('0x45')]['id']}})[_0xabe6('0x24')](handleEntityNotFound(_0x3cc7f3,null))[_0xabe6('0x24')](saveUpdates(_0x5c1d12[_0xabe6('0x48')],null))[_0xabe6('0x24')](respondWithResult(_0x3cc7f3,null))[_0xabe6('0x44')](handleError(_0x3cc7f3,null));};exports[_0xabe6('0x23')]=function(_0x4d08b4,_0x539626){return db[_0xabe6('0x2b')][_0xabe6('0x46')]({'where':{'id':_0x4d08b4[_0xabe6('0x45')]['id']}})[_0xabe6('0x24')](handleEntityNotFound(_0x539626,null))[_0xabe6('0x24')](removeEntity(_0x539626,null))['catch'](handleError(_0x539626,null));};exports[_0xabe6('0x49')]=function(_0x5182aa,_0x3ab899){return db[_0xabe6('0x2b')][_0xabe6('0x49')]()['then'](respondWithResult(_0x3ab899,null))[_0xabe6('0x44')](handleError(_0x3ab899,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a3c3f2c..055327b 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 _0x3ab0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x3ab0,0xb6));var _0x03ab=function(_0x5671b9,_0x2b0e8d){_0x5671b9=_0x5671b9-0x0;var _0x4e180c=_0x3ab0[_0x5671b9];return _0x4e180c;};'use strict';var _=require(_0x03ab('0x0'));var util=require(_0x03ab('0x1'));var logger=require(_0x03ab('0x2'))(_0x03ab('0x3'));var moment=require(_0x03ab('0x4'));var BPromise=require(_0x03ab('0x5'));var rp=require(_0x03ab('0x6'));var fs=require('fs');var path=require(_0x03ab('0x7'));var rimraf=require(_0x03ab('0x8'));var config=require(_0x03ab('0x9'));var attributes=require('./userProfileSection.attributes');module[_0x03ab('0xa')]=function(_0x24e6fb,_0x367129){return _0x24e6fb[_0x03ab('0xb')](_0x03ab('0xc'),attributes,{'tableName':_0x03ab('0xd'),'paranoid':![],'indexes':[{'name':_0x03ab('0xe'),'fields':[_0x03ab('0xf'),_0x03ab('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2504=['user_profile_has_sections','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','UserProfileSection'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x2504,0x16c));var _0x4250=function(_0x34aa87,_0x5c6103){_0x34aa87=_0x34aa87-0x0;var _0xdba1df=_0x2504[_0x34aa87];return _0xdba1df;};'use strict';var _=require('lodash');var util=require(_0x4250('0x0'));var logger=require(_0x4250('0x1'))('api');var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rp=require(_0x4250('0x4'));var fs=require('fs');var path=require(_0x4250('0x5'));var rimraf=require(_0x4250('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x4250('0x7')]=function(_0x400c5c,_0x4cbeaf){return _0x400c5c[_0x4250('0x8')](_0x4250('0x9'),attributes,{'tableName':_0x4250('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','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 fd25565..8d37fb7 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 _0x7923=['randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x1ccd49,_0x29c95f){var _0x91c7d2=function(_0x2139ca){while(--_0x2139ca){_0x1ccd49['push'](_0x1ccd49['shift']());}};_0x91c7d2(++_0x29c95f);}(_0x7923,0x8f));var _0x3792=function(_0x2f73d9,_0x387f8a){_0x2f73d9=_0x2f73d9-0x0;var _0x1e9d90=_0x7923[_0x2f73d9];return _0x1e9d90;};'use strict';var _=require(_0x3792('0x0'));var util=require(_0x3792('0x1'));var moment=require(_0x3792('0x2'));var BPromise=require(_0x3792('0x3'));var rs=require(_0x3792('0x4'));var fs=require('fs');var Redis=require(_0x3792('0x5'));var db=require(_0x3792('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3792('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3792('0x8'));var client=jayson['client'][_0x3792('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18b993,_0x1e065a,_0x5b55f8){return new BPromise(function(_0x5b453a,_0x297f6f){return client[_0x3792('0xa')](_0x18b993,_0x5b55f8)['then'](function(_0x19d6e5){logger[_0x3792('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x1e065a,_0x3792('0xc'));logger[_0x3792('0xd')](_0x3792('0xe'),_0x1e065a,'request\x20sent',JSON['stringify'](_0x19d6e5));if(_0x19d6e5[_0x3792('0xf')]){if(_0x19d6e5[_0x3792('0xf')][_0x3792('0x10')]===0x1f4){logger[_0x3792('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x1e065a,_0x19d6e5['error'][_0x3792('0x11')]);return _0x297f6f(_0x19d6e5[_0x3792('0xf')][_0x3792('0x11')]);}logger[_0x3792('0xf')](_0x3792('0x12'),_0x1e065a,_0x19d6e5[_0x3792('0xf')][_0x3792('0x11')]);return _0x5b453a(_0x19d6e5[_0x3792('0xf')][_0x3792('0x11')]);}else{logger[_0x3792('0xb')](_0x3792('0x12'),_0x1e065a,_0x3792('0xc'));_0x5b453a(_0x19d6e5[_0x3792('0x13')][_0x3792('0x11')]);}})[_0x3792('0x14')](function(_0x683ede){logger[_0x3792('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x1e065a,_0x683ede);_0x297f6f(_0x683ede);});});} \ No newline at end of file +var _0xa12b=['util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4766f2,_0x38b8a1){var _0xe746c2=function(_0x27ad6d){while(--_0x27ad6d){_0x4766f2['push'](_0x4766f2['shift']());}};_0xe746c2(++_0x38b8a1);}(_0xa12b,0x175));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba12('0x0'));var util=require(_0xba12('0x1'));var moment=require('moment');var BPromise=require(_0xba12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba12('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xba12('0x4'));var logger=require('../../config/logger')(_0xba12('0x5'));var config=require(_0xba12('0x6'));var jayson=require(_0xba12('0x7'));var client=jayson[_0xba12('0x8')][_0xba12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1956bf,_0x18dfe6,_0x3732c9){return new BPromise(function(_0x50442a,_0x547c13){return client[_0xba12('0xa')](_0x1956bf,_0x3732c9)[_0xba12('0xb')](function(_0x16a59f){logger[_0xba12('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x18dfe6,_0xba12('0xd'));logger['debug'](_0xba12('0xe'),_0x18dfe6,_0xba12('0xd'),JSON[_0xba12('0xf')](_0x16a59f));if(_0x16a59f['error']){if(_0x16a59f[_0xba12('0x10')][_0xba12('0x11')]===0x1f4){logger[_0xba12('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x18dfe6,_0x16a59f[_0xba12('0x10')]['message']);return _0x547c13(_0x16a59f[_0xba12('0x10')]['message']);}logger['error'](_0xba12('0x12'),_0x18dfe6,_0x16a59f[_0xba12('0x10')][_0xba12('0x13')]);return _0x50442a(_0x16a59f['error'][_0xba12('0x13')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x18dfe6,_0xba12('0xd'));_0x50442a(_0x16a59f[_0xba12('0x14')]['message']);}})[_0xba12('0x15')](function(_0x59448b){logger[_0xba12('0x10')](_0xba12('0x12'),_0x18dfe6,_0x59448b);_0x547c13(_0x59448b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 57fdc72..d3340e1 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1fb6ff,_0x474709){var _0x339f61=function(_0x424713){while(--_0x424713){_0x1fb6ff['push'](_0x1fb6ff['shift']());}};_0x339f61(++_0x474709);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x154ad2,_0x3e510d){var _0x402c2e=function(_0x4c174e){while(--_0x4c174e){_0x154ad2['push'](_0x154ad2['shift']());}};_0x402c2e(++_0x3e510d);}(_0x70e0,0x17b));var _0x070e=function(_0x3dc587,_0x1f9539){_0x3dc587=_0x3dc587-0x0;var _0x4ef88d=_0x70e0[_0x3dc587];return _0x4ef88d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8abc914..0920aa7 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 _0x8ead=['INTEGER','sequelize','exports'];(function(_0x470687,_0x3165fe){var _0x37e897=function(_0x1a7854){while(--_0x1a7854){_0x470687['push'](_0x470687['shift']());}};_0x37e897(++_0x3165fe);}(_0x8ead,0xc4));var _0xd8ea=function(_0x2ea3a9,_0x4762f7){_0x2ea3a9=_0x2ea3a9-0x0;var _0x4bdf45=_0x8ead[_0x2ea3a9];return _0x4bdf45;};'use strict';var Sequelize=require(_0xd8ea('0x0'));module[_0xd8ea('0x1')]={'penalty':{'type':Sequelize[_0xd8ea('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfc60=['exports','sequelize'];(function(_0x6a6cc7,_0x5599d9){var _0x2b3556=function(_0xcaec3e){while(--_0xcaec3e){_0x6a6cc7['push'](_0x6a6cc7['shift']());}};_0x2b3556(++_0x5599d9);}(_0xfc60,0xb3));var _0x0fc6=function(_0x16eb19,_0x58cea4){_0x16eb19=_0x16eb19-0x0;var _0x312a25=_0xfc60[_0x16eb19];return _0x312a25;};'use strict';var Sequelize=require(_0x0fc6('0x0'));module[_0x0fc6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 3c57610..9e7730d 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 _0x77a9=['../../config/environment','./userSmsQueue.attributes','exports','user_has_sms_queues','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1ed117,_0x4e03a2){var _0x671f71=function(_0x35dd11){while(--_0x35dd11){_0x1ed117['push'](_0x1ed117['shift']());}};_0x671f71(++_0x4e03a2);}(_0x77a9,0x19e));var _0x977a=function(_0x3c1515,_0x589843){_0x3c1515=_0x3c1515-0x0;var _0x2152c6=_0x77a9[_0x3c1515];return _0x2152c6;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var logger=require(_0x977a('0x1'))('api');var moment=require(_0x977a('0x2'));var BPromise=require(_0x977a('0x3'));var rp=require(_0x977a('0x4'));var fs=require('fs');var path=require(_0x977a('0x5'));var rimraf=require('rimraf');var config=require(_0x977a('0x6'));var attributes=require(_0x977a('0x7'));module[_0x977a('0x8')]=function(_0x2b4ba5,_0x261e46){return _0x2b4ba5['define']('UserSmsQueue',attributes,{'tableName':_0x977a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x4282a7,_0x351556){var _0x5b7916=function(_0x216bac){while(--_0x216bac){_0x4282a7['push'](_0x4282a7['shift']());}};_0x5b7916(++_0x351556);}(_0x9536,0x179));var _0x6953=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x9536[_0x21b36c];return _0x236627;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'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 be9da71..757852d 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 _0x081b=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f9a8e,_0x17236b){var _0x35e142=function(_0x3d2b73){while(--_0x3d2b73){_0x1f9a8e['push'](_0x1f9a8e['shift']());}};_0x35e142(++_0x17236b);}(_0x081b,0xe3));var _0xb081=function(_0x693e69,_0x4ac0bd){_0x693e69=_0x693e69-0x0;var _0xedaaee=_0x081b[_0x693e69];return _0xedaaee;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb081('0x0'));var rs=require(_0xb081('0x1'));var fs=require('fs');var Redis=require(_0xb081('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb081('0x3'));var logger=require(_0xb081('0x4'))(_0xb081('0x5'));var config=require(_0xb081('0x6'));var jayson=require(_0xb081('0x7'));var client=jayson[_0xb081('0x8')][_0xb081('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x467842,_0x457fb6,_0x2ab929){return new BPromise(function(_0x4f411c,_0x15fcb8){return client['request'](_0x467842,_0x2ab929)[_0xb081('0xa')](function(_0x2a61d3){logger[_0xb081('0xb')](_0xb081('0xc'),_0x457fb6,_0xb081('0xd'));logger[_0xb081('0xe')](_0xb081('0xf'),_0x457fb6,_0xb081('0xd'),JSON[_0xb081('0x10')](_0x2a61d3));if(_0x2a61d3[_0xb081('0x11')]){if(_0x2a61d3[_0xb081('0x11')][_0xb081('0x12')]===0x1f4){logger[_0xb081('0x11')](_0xb081('0xc'),_0x457fb6,_0x2a61d3[_0xb081('0x11')][_0xb081('0x13')]);return _0x15fcb8(_0x2a61d3[_0xb081('0x11')][_0xb081('0x13')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x457fb6,_0x2a61d3[_0xb081('0x11')][_0xb081('0x13')]);return _0x4f411c(_0x2a61d3[_0xb081('0x11')][_0xb081('0x13')]);}else{logger[_0xb081('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x457fb6,_0xb081('0xd'));_0x4f411c(_0x2a61d3[_0xb081('0x14')][_0xb081('0x13')]);}})[_0xb081('0x15')](function(_0x21b561){logger[_0xb081('0x11')](_0xb081('0xc'),_0x457fb6,_0x21b561);_0x15fcb8(_0x21b561);});});} \ No newline at end of file +var _0xa340=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','error','code','UserSmsQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa340,0x17f));var _0x0a34=function(_0x408d95,_0x43248e){_0x408d95=_0x408d95-0x0;var _0x552bf9=_0xa340[_0x408d95];return _0x552bf9;};'use strict';var _=require(_0x0a34('0x0'));var util=require('util');var moment=require(_0x0a34('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a34('0x2'));var fs=require('fs');var Redis=require(_0x0a34('0x3'));var db=require(_0x0a34('0x4'))['db'];var utils=require(_0x0a34('0x5'));var logger=require('../../config/logger')(_0x0a34('0x6'));var config=require(_0x0a34('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0a34('0x8')][_0x0a34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ac96e,_0x2a6c05,_0x264ff1){return new BPromise(function(_0x4aa1a7,_0x4c63bb){return client[_0x0a34('0xa')](_0x1ac96e,_0x264ff1)['then'](function(_0x2d2977){logger[_0x0a34('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x2a6c05,_0x0a34('0xc'));logger[_0x0a34('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2a6c05,_0x0a34('0xc'),JSON['stringify'](_0x2d2977));if(_0x2d2977[_0x0a34('0xe')]){if(_0x2d2977['error'][_0x0a34('0xf')]===0x1f4){logger['error'](_0x0a34('0x10'),_0x2a6c05,_0x2d2977[_0x0a34('0xe')][_0x0a34('0x11')]);return _0x4c63bb(_0x2d2977['error'][_0x0a34('0x11')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x2a6c05,_0x2d2977[_0x0a34('0xe')][_0x0a34('0x11')]);return _0x4aa1a7(_0x2d2977[_0x0a34('0xe')]['message']);}else{logger[_0x0a34('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x2a6c05,'request\x20sent');_0x4aa1a7(_0x2d2977[_0x0a34('0x12')][_0x0a34('0x11')]);}})[_0x0a34('0x13')](function(_0x3e2c12){logger[_0x0a34('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x2a6c05,_0x3e2c12);_0x4c63bb(_0x3e2c12);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 0786da6..1474ee7 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 _0x0c35=['exports','sequelize'];(function(_0x59bfe5,_0x17211e){var _0x4f6f05=function(_0x44275c){while(--_0x44275c){_0x59bfe5['push'](_0x59bfe5['shift']());}};_0x4f6f05(++_0x17211e);}(_0x0c35,0x161));var _0x50c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0c35[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x50c3('0x0'));module[_0x50c3('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2c98=['INTEGER','sequelize','exports'];(function(_0x5227f2,_0x4d3d1b){var _0xd5165a=function(_0x1a111e){while(--_0x1a111e){_0x5227f2['push'](_0x5227f2['shift']());}};_0xd5165a(++_0x4d3d1b);}(_0x2c98,0xca));var _0x82c9=function(_0x556ef3,_0x2bc229){_0x556ef3=_0x556ef3-0x0;var _0x211e3c=_0x2c98[_0x556ef3];return _0x211e3c;};'use strict';var Sequelize=require(_0x82c9('0x0'));module[_0x82c9('0x1')]={'UserId':{'type':Sequelize[_0x82c9('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x82c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 0933dcd..4f3e6e5 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(_0x3c4e52,_0x19c495){var _0xaf1b55=function(_0x270fd3){while(--_0x270fd3){_0x3c4e52['push'](_0x3c4e52['shift']());}};_0xaf1b55(++_0x19c495);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2d2115,_0x5c3cd3){var _0x26f630=function(_0x373e6e){while(--_0x373e6e){_0x2d2115['push'](_0x2d2115['shift']());}};_0x26f630(++_0x5c3cd3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 46bace9..b87b2bd 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(_0x1ef911,_0x32a38b){var _0x5297f4=function(_0x3b1134){while(--_0x3b1134){_0x1ef911['push'](_0x1ef911['shift']());}};_0x5297f4(++_0x32a38b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x13bbfd,_0x2a93d2){var _0x232a7d=function(_0x4a4c47){while(--_0x4a4c47){_0x13bbfd['push'](_0x13bbfd['shift']());}};_0x232a7d(++_0x2a93d2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0xcb91[_0x28f1de];return _0x5b5dad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9050058..82e4afe 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 _0xaa73=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa73,0xe2));var _0x3aa7=function(_0x293ab8,_0x32e471){_0x293ab8=_0x293ab8-0x0;var _0x1eaa6e=_0xaa73[_0x293ab8];return _0x1eaa6e;};'use strict';var Sequelize=require(_0x3aa7('0x0'));module[_0x3aa7('0x1')]={'penalty':{'type':Sequelize[_0x3aa7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xca2a=['INTEGER','sequelize','exports'];(function(_0x494ea1,_0x1c9b3c){var _0x21a73c=function(_0x1ed0c1){while(--_0x1ed0c1){_0x494ea1['push'](_0x494ea1['shift']());}};_0x21a73c(++_0x1c9b3c);}(_0xca2a,0x8e));var _0xaca2=function(_0x297af0,_0x3f72a7){_0x297af0=_0x297af0-0x0;var _0xed8dc6=_0xca2a[_0x297af0];return _0xed8dc6;};'use strict';var Sequelize=require(_0xaca2('0x0'));module[_0xaca2('0x1')]={'penalty':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index a29008f..cef4ae0 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 _0xb203=['rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x49a3a8,_0x3c72a9){var _0x454f74=function(_0x3aacd3){while(--_0x3aacd3){_0x49a3a8['push'](_0x49a3a8['shift']());}};_0x454f74(++_0x3c72a9);}(_0xb203,0x1e7));var _0x3b20=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb203[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3b20('0x0'));var util=require(_0x3b20('0x1'));var logger=require(_0x3b20('0x2'))('api');var moment=require(_0x3b20('0x3'));var BPromise=require(_0x3b20('0x4'));var rp=require(_0x3b20('0x5'));var fs=require('fs');var path=require(_0x3b20('0x6'));var rimraf=require(_0x3b20('0x7'));var config=require(_0x3b20('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x3b20('0x9')]=function(_0x49eeb1,_0xe839c4){return _0x49eeb1[_0x3b20('0xa')](_0x3b20('0xb'),attributes,{'tableName':_0x3b20('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf99c=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues'];(function(_0x3a9d1c,_0x40805f){var _0x20ab05=function(_0x40a831){while(--_0x40a831){_0x3a9d1c['push'](_0x3a9d1c['shift']());}};_0x20ab05(++_0x40805f);}(_0xf99c,0x1f4));var _0xcf99=function(_0x108ddf,_0x439241){_0x108ddf=_0x108ddf-0x0;var _0x25109e=_0xf99c[_0x108ddf];return _0x25109e;};'use strict';var _=require(_0xcf99('0x0'));var util=require(_0xcf99('0x1'));var logger=require('../../config/logger')(_0xcf99('0x2'));var moment=require(_0xcf99('0x3'));var BPromise=require(_0xcf99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcf99('0x5'));var config=require(_0xcf99('0x6'));var attributes=require(_0xcf99('0x7'));module[_0xcf99('0x8')]=function(_0x1f6103,_0x22c350){return _0x1f6103['define']('UserVoiceQueue',attributes,{'tableName':_0xcf99('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index dffd951..1e28a44 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 _0x2d8b=['rpc','../../config/environment','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3979e9,_0x45b8e7){var _0x14a62e=function(_0x39c703){while(--_0x39c703){_0x3979e9['push'](_0x3979e9['shift']());}};_0x14a62e(++_0x45b8e7);}(_0x2d8b,0x148));var _0xb2d8=function(_0x532786,_0xbd5d8c){_0x532786=_0x532786-0x0;var _0x251519=_0x2d8b[_0x532786];return _0x251519;};'use strict';var _=require(_0xb2d8('0x0'));var util=require(_0xb2d8('0x1'));var moment=require(_0xb2d8('0x2'));var BPromise=require(_0xb2d8('0x3'));var rs=require(_0xb2d8('0x4'));var fs=require('fs');var Redis=require(_0xb2d8('0x5'));var db=require(_0xb2d8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2d8('0x7'))(_0xb2d8('0x8'));var config=require(_0xb2d8('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaa9b23,_0x729c4,_0x24f52a){return new BPromise(function(_0x27f613,_0x21d2fe){return client['request'](_0xaa9b23,_0x24f52a)[_0xb2d8('0xa')](function(_0x11c16b){logger[_0xb2d8('0xb')](_0xb2d8('0xc'),_0x729c4,'request\x20sent');logger[_0xb2d8('0xd')](_0xb2d8('0xe'),_0x729c4,_0xb2d8('0xf'),JSON['stringify'](_0x11c16b));if(_0x11c16b[_0xb2d8('0x10')]){if(_0x11c16b[_0xb2d8('0x10')][_0xb2d8('0x11')]===0x1f4){logger[_0xb2d8('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x729c4,_0x11c16b[_0xb2d8('0x10')]['message']);return _0x21d2fe(_0x11c16b[_0xb2d8('0x10')][_0xb2d8('0x12')]);}logger['error'](_0xb2d8('0xc'),_0x729c4,_0x11c16b[_0xb2d8('0x10')][_0xb2d8('0x12')]);return _0x27f613(_0x11c16b[_0xb2d8('0x10')][_0xb2d8('0x12')]);}else{logger[_0xb2d8('0xb')](_0xb2d8('0xc'),_0x729c4,_0xb2d8('0xf'));_0x27f613(_0x11c16b[_0xb2d8('0x13')][_0xb2d8('0x12')]);}})[_0xb2d8('0x14')](function(_0x5e9eee){logger[_0xb2d8('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x729c4,_0x5e9eee);_0x21d2fe(_0x5e9eee);});});} \ No newline at end of file +var _0xef6b=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','../../config/logger','rpc','client','http','then','info'];(function(_0x400d28,_0x368388){var _0x44808a=function(_0x52b747){while(--_0x52b747){_0x400d28['push'](_0x400d28['shift']());}};_0x44808a(++_0x368388);}(_0xef6b,0x117));var _0xbef6=function(_0x1934a9,_0x3a13e1){_0x1934a9=_0x1934a9-0x0;var _0x3d1dac=_0xef6b[_0x1934a9];return _0x3d1dac;};'use strict';var _=require('lodash');var util=require(_0xbef6('0x0'));var moment=require(_0xbef6('0x1'));var BPromise=require(_0xbef6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbef6('0x3'))(_0xbef6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbef6('0x5')][_0xbef6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x153cb5,_0x4cf30c,_0xf10b1a){return new BPromise(function(_0x4ced17,_0x3d4a1c){return client['request'](_0x153cb5,_0xf10b1a)[_0xbef6('0x7')](function(_0x523f46){logger[_0xbef6('0x8')](_0xbef6('0x9'),_0x4cf30c,_0xbef6('0xa'));logger[_0xbef6('0xb')](_0xbef6('0xc'),_0x4cf30c,_0xbef6('0xa'),JSON[_0xbef6('0xd')](_0x523f46));if(_0x523f46[_0xbef6('0xe')]){if(_0x523f46['error'][_0xbef6('0xf')]===0x1f4){logger[_0xbef6('0xe')](_0xbef6('0x9'),_0x4cf30c,_0x523f46[_0xbef6('0xe')][_0xbef6('0x10')]);return _0x3d4a1c(_0x523f46[_0xbef6('0xe')][_0xbef6('0x10')]);}logger[_0xbef6('0xe')](_0xbef6('0x9'),_0x4cf30c,_0x523f46[_0xbef6('0xe')][_0xbef6('0x10')]);return _0x4ced17(_0x523f46[_0xbef6('0xe')]['message']);}else{logger[_0xbef6('0x8')](_0xbef6('0x9'),_0x4cf30c,_0xbef6('0xa'));_0x4ced17(_0x523f46['result'][_0xbef6('0x10')]);}})[_0xbef6('0x11')](function(_0x159b64){logger['error'](_0xbef6('0x9'),_0x4cf30c,_0x159b64);_0x3d4a1c(_0x159b64);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3f7811b..c5cf29f 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xf8c6ae,_0x4ff1e1){var _0x152df=function(_0x13c2ff){while(--_0x13c2ff){_0xf8c6ae['push'](_0xf8c6ae['shift']());}};_0x152df(++_0x4ff1e1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0xcb91[_0x51639a];return _0x3abae4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3201c8,_0x50c2c9){var _0x2ecf11=function(_0x54dd8a){while(--_0x54dd8a){_0x3201c8['push'](_0x3201c8['shift']());}};_0x2ecf11(++_0x50c2c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 589e4e1..bb14c18 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 _0x7aee=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x367334,_0x411a81){var _0xb506e3=function(_0xd09926){while(--_0xd09926){_0x367334['push'](_0x367334['shift']());}};_0xb506e3(++_0x411a81);}(_0x7aee,0x9c));var _0xe7ae=function(_0xec58af,_0x53b63c){_0xec58af=_0xec58af-0x0;var _0x4698c9=_0x7aee[_0xec58af];return _0x4698c9;};'use strict';var Sequelize=require('sequelize');module[_0xe7ae('0x0')]={'uniqueid':{'type':Sequelize[_0xe7ae('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe7ae('0x2')},'membername':{'type':Sequelize[_0xe7ae('0x3')],'allowNull':![],'comment':_0xe7ae('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe7ae('0x3')],'allowNull':![],'unique':_0xe7ae('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xe7ae('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xe7ae('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xe7ae('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe7ae('0x2')},'paused':{'type':Sequelize[_0xe7ae('0x1')](0xb),'defaultValue':0x0,'comment':_0xe7ae('0x2')}}; \ No newline at end of file +var _0x2350=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x469fe3,_0x1c116f){var _0x323496=function(_0x5a639f){while(--_0x5a639f){_0x469fe3['push'](_0x469fe3['shift']());}};_0x323496(++_0x1c116f);}(_0x2350,0xf1));var _0x0235=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0x2350[_0x7b484];return _0x2ae1cf;};'use strict';var Sequelize=require(_0x0235('0x0'));module[_0x0235('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0235('0x2')},'membername':{'type':Sequelize[_0x0235('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x0235('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0235('0x3')],'allowNull':![],'unique':_0x0235('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x0235('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0235('0x5'),'comment':_0x0235('0x2')},'penalty':{'type':Sequelize[_0x0235('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x0235('0x4')](0xb),'defaultValue':0x0,'comment':_0x0235('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 130d423..6d080fd 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 _0x5880=['emit','hook','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove'];(function(_0x2a9a28,_0x30216f){var _0x20ac43=function(_0x182845){while(--_0x182845){_0x2a9a28['push'](_0x2a9a28['shift']());}};_0x20ac43(++_0x30216f);}(_0x5880,0x64));var _0x0588=function(_0xc54d7d,_0x1ab11b){_0xc54d7d=_0xc54d7d-0x0;var _0x3fee94=_0x5880[_0xc54d7d];return _0x3fee94;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x0588('0x0'))['db'][_0x0588('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x0588('0x2')](0x0);var events={'afterCreate':_0x0588('0x3'),'afterUpdate':'update','afterDestroy':_0x0588('0x4')};function emitEvent(_0x107ab1){return function(_0x44e886,_0x4cd189,_0x3897f6){UserVoiceQueueRtEvents[_0x0588('0x5')](_0x107ab1+':'+_0x44e886['id'],_0x44e886);UserVoiceQueueRtEvents[_0x0588('0x5')](_0x107ab1,_0x44e886);_0x3897f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x0588('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xfdd2=['events','../../mysqldb','UserVoiceQueueRt','update','emit','hook'];(function(_0x33d7e9,_0x500ef5){var _0x269ff1=function(_0x3c664d){while(--_0x3c664d){_0x33d7e9['push'](_0x33d7e9['shift']());}};_0x269ff1(++_0x500ef5);}(_0xfdd2,0x18c));var _0x2fdd=function(_0xd50b7f,_0x53c16c){_0xd50b7f=_0xd50b7f-0x0;var _0x380972=_0xfdd2[_0xd50b7f];return _0x380972;};'use strict';var EventEmitter=require(_0x2fdd('0x0'));var UserVoiceQueueRt=require(_0x2fdd('0x1'))['db'][_0x2fdd('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2fdd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4130a8){return function(_0x59f6b5,_0x21344f,_0x3a4581){UserVoiceQueueRtEvents[_0x2fdd('0x4')](_0x4130a8+':'+_0x59f6b5['id'],_0x59f6b5);UserVoiceQueueRtEvents[_0x2fdd('0x4')](_0x4130a8,_0x59f6b5);_0x3a4581(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x2fdd('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7d70e3a..301b5e4 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 _0x7350=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7350,0x181));var _0x0735=function(_0x389ed9,_0xbd0522){_0x389ed9=_0x389ed9-0x0;var _0x491550=_0x7350[_0x389ed9];return _0x491550;};'use strict';var _=require(_0x0735('0x0'));var util=require(_0x0735('0x1'));var logger=require('../../config/logger')(_0x0735('0x2'));var moment=require(_0x0735('0x3'));var BPromise=require(_0x0735('0x4'));var rp=require(_0x0735('0x5'));var fs=require('fs');var path=require(_0x0735('0x6'));var rimraf=require(_0x0735('0x7'));var config=require(_0x0735('0x8'));var attributes=require(_0x0735('0x9'));module[_0x0735('0xa')]=function(_0x399c0d,_0x3cf7c2){return _0x399c0d[_0x0735('0xb')](_0x0735('0xc'),attributes,{'tableName':_0x0735('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaaa=['moment','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xeaaa,0x1a9));var _0xaeaa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xeaaa[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xaeaa('0x0'));var util=require(_0xaeaa('0x1'));var logger=require(_0xaeaa('0x2'))(_0xaeaa('0x3'));var moment=require(_0xaeaa('0x4'));var BPromise=require('bluebird');var rp=require(_0xaeaa('0x5'));var fs=require('fs');var path=require(_0xaeaa('0x6'));var rimraf=require(_0xaeaa('0x7'));var config=require('../../config/environment');var attributes=require(_0xaeaa('0x8'));module[_0xaeaa('0x9')]=function(_0x4bf03d,_0xc04afe){return _0x4bf03d[_0xaeaa('0xa')](_0xaeaa('0xb'),attributes,{'tableName':_0xaeaa('0xc'),'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 e3f5759..07ffac1 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 _0x73e7=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x152463,_0x436cbe){var _0xe89292=function(_0x38b2bd){while(--_0x38b2bd){_0x152463['push'](_0x152463['shift']());}};_0xe89292(++_0x436cbe);}(_0x73e7,0x169));var _0x773e=function(_0x2c9d14,_0x33a5f6){_0x2c9d14=_0x2c9d14-0x0;var _0x2ad6de=_0x73e7[_0x2c9d14];return _0x2ad6de;};'use strict';var _=require(_0x773e('0x0'));var util=require(_0x773e('0x1'));var moment=require(_0x773e('0x2'));var BPromise=require('bluebird');var rs=require(_0x773e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x773e('0x4'))['db'];var utils=require(_0x773e('0x5'));var logger=require(_0x773e('0x6'))('rpc');var config=require(_0x773e('0x7'));var jayson=require(_0x773e('0x8'));var client=jayson[_0x773e('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x773e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x773e('0xb'))(new Redis(config[_0x773e('0xa')]));require(_0x773e('0xc'))[_0x773e('0xd')](socket);function respondWithRpcPromise(_0x2c129c,_0x149f7b,_0x3eb62e){return new BPromise(function(_0x417d05,_0x263634){return client['request'](_0x2c129c,_0x3eb62e)[_0x773e('0xe')](function(_0x548632){logger[_0x773e('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x149f7b,'request\x20sent');logger[_0x773e('0x10')](_0x773e('0x11'),_0x149f7b,_0x773e('0x12'),JSON[_0x773e('0x13')](_0x548632));if(_0x548632[_0x773e('0x14')]){if(_0x548632[_0x773e('0x14')][_0x773e('0x15')]===0x1f4){logger[_0x773e('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x149f7b,_0x548632[_0x773e('0x14')][_0x773e('0x16')]);return _0x263634(_0x548632['error'][_0x773e('0x16')]);}logger['error'](_0x773e('0x17'),_0x149f7b,_0x548632['error'][_0x773e('0x16')]);return _0x417d05(_0x548632[_0x773e('0x14')][_0x773e('0x16')]);}else{logger[_0x773e('0xf')](_0x773e('0x17'),_0x149f7b,_0x773e('0x12'));_0x417d05(_0x548632[_0x773e('0x18')][_0x773e('0x16')]);}})[_0x773e('0x19')](function(_0x17e459){logger['error'](_0x773e('0x17'),_0x149f7b,_0x17e459);_0x263634(_0x17e459);});});}exports[_0x773e('0x1a')]=function(_0x38e772){var _0x2385a6=this;return new Promise(function(_0x25e8cb,_0x58607a){return db[_0x773e('0x1b')][_0x773e('0x1c')]({'raw':_0x38e772[_0x773e('0x1d')]?_0x38e772[_0x773e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x38e772[_0x773e('0x1d')]?_0x38e772[_0x773e('0x1d')][_0x773e('0x1e')]||null:null,'attributes':[[db[_0x773e('0x1f')]['fn'](_0x773e('0x20'),db[_0x773e('0x1f')]['fn']('IF',db[_0x773e('0x1f')]['literal'](_0x773e('0x21')))),_0x773e('0x22')]]})[_0x773e('0xe')](function(_0xa96b62){logger['info'](_0x773e('0x1a'),_0x38e772);logger['debug'](_0x773e('0x1a'),_0x38e772,JSON[_0x773e('0x13')](_0xa96b62));_0x25e8cb(_0xa96b62);})['catch'](function(_0x56b829){logger['error'](_0x773e('0x1a'),_0x56b829['message'],_0x38e772);_0x58607a(_0x2385a6[_0x773e('0x14')](0x1f4,_0x56b829[_0x773e('0x16')]));});});}; \ No newline at end of file +var _0x5fb4=['sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','GetVoiceQueueRtPauses','options','raw','where'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0x5fb4,0xbe));var _0x45fb=function(_0x4c9ed7,_0x3e1f68){_0x4c9ed7=_0x4c9ed7-0x0;var _0x2072c8=_0x5fb4[_0x4c9ed7];return _0x2072c8;};'use strict';var _=require(_0x45fb('0x0'));var util=require(_0x45fb('0x1'));var moment=require(_0x45fb('0x2'));var BPromise=require(_0x45fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45fb('0x4'));var db=require(_0x45fb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x45fb('0x6'));var config=require(_0x45fb('0x7'));var jayson=require(_0x45fb('0x8'));var client=jayson[_0x45fb('0x9')][_0x45fb('0xa')]({'port':0x232a});config[_0x45fb('0xb')]=_['defaults'](config[_0x45fb('0xb')],{'host':_0x45fb('0xc'),'port':0x18eb});var socket=require(_0x45fb('0xd'))(new Redis(config[_0x45fb('0xb')]));require('./userVoiceQueueRt.socket')[_0x45fb('0xe')](socket);function respondWithRpcPromise(_0xa527b0,_0x335206,_0x4aaad5){return new BPromise(function(_0x53667d,_0x5b7252){return client[_0x45fb('0xf')](_0xa527b0,_0x4aaad5)[_0x45fb('0x10')](function(_0x15f062){logger['info'](_0x45fb('0x11'),_0x335206,'request\x20sent');logger[_0x45fb('0x12')](_0x45fb('0x13'),_0x335206,'request\x20sent',JSON[_0x45fb('0x14')](_0x15f062));if(_0x15f062['error']){if(_0x15f062[_0x45fb('0x15')][_0x45fb('0x16')]===0x1f4){logger[_0x45fb('0x15')](_0x45fb('0x11'),_0x335206,_0x15f062[_0x45fb('0x15')][_0x45fb('0x17')]);return _0x5b7252(_0x15f062['error']['message']);}logger[_0x45fb('0x15')](_0x45fb('0x11'),_0x335206,_0x15f062[_0x45fb('0x15')]['message']);return _0x53667d(_0x15f062[_0x45fb('0x15')]['message']);}else{logger[_0x45fb('0x18')](_0x45fb('0x11'),_0x335206,_0x45fb('0x19'));_0x53667d(_0x15f062[_0x45fb('0x1a')]['message']);}})[_0x45fb('0x1b')](function(_0x2ecabb){logger[_0x45fb('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x335206,_0x2ecabb);_0x5b7252(_0x2ecabb);});});}exports[_0x45fb('0x1c')]=function(_0x56e61f){var _0x32b3b1=this;return new Promise(function(_0x223f5e,_0x27e752){return db['UserVoiceQueueRt']['findAll']({'raw':_0x56e61f['options']?_0x56e61f[_0x45fb('0x1d')][_0x45fb('0x1e')]===undefined?!![]:![]:!![],'where':_0x56e61f[_0x45fb('0x1d')]?_0x56e61f[_0x45fb('0x1d')][_0x45fb('0x1f')]||null:null,'attributes':[[db[_0x45fb('0x20')]['fn'](_0x45fb('0x21'),db['sequelize']['fn']('IF',db[_0x45fb('0x20')][_0x45fb('0x22')](_0x45fb('0x23')))),_0x45fb('0x24')]]})[_0x45fb('0x10')](function(_0x5318a5){logger[_0x45fb('0x18')](_0x45fb('0x1c'),_0x56e61f);logger[_0x45fb('0x12')](_0x45fb('0x1c'),_0x56e61f,JSON[_0x45fb('0x14')](_0x5318a5));_0x223f5e(_0x5318a5);})[_0x45fb('0x1b')](function(_0x40c336){logger[_0x45fb('0x15')](_0x45fb('0x1c'),_0x40c336['message'],_0x56e61f);_0x27e752(_0x32b3b1[_0x45fb('0x15')](0x1f4,_0x40c336[_0x45fb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cc8fccc..159afb0 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 _0x5a99=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','removeListener','register','length'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x5a99,0xc9));var _0x95a9=function(_0x543859,_0x133445){_0x543859=_0x543859-0x0;var _0x2fbcef=_0x5a99[_0x543859];return _0x2fbcef;};'use strict';var UserVoiceQueueRtEvents=require(_0x95a9('0x0'));var events=[_0x95a9('0x1'),_0x95a9('0x2'),'update'];function createListener(_0xa50e8e,_0x285b0a){return function(_0x2bc3ed){_0x285b0a[_0x95a9('0x3')](_0xa50e8e,_0x2bc3ed);};}function removeListener(_0x4b30e2,_0x2c8e52){return function(){UserVoiceQueueRtEvents[_0x95a9('0x4')](_0x4b30e2,_0x2c8e52);};}exports[_0x95a9('0x5')]=function(_0x5195cd){for(var _0x4aecd8=0x0,_0x438069=events[_0x95a9('0x6')];_0x4aecd8<_0x438069;_0x4aecd8++){var _0x108eb6=events[_0x4aecd8];var _0x4b2d58=createListener(_0x95a9('0x7')+_0x108eb6,_0x5195cd);UserVoiceQueueRtEvents['on'](_0x108eb6,_0x4b2d58);}}; \ No newline at end of file +var _0xaa37=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x25b60d,_0x3b3a69){var _0x529af1=function(_0x55564c){while(--_0x55564c){_0x25b60d['push'](_0x25b60d['shift']());}};_0x529af1(++_0x3b3a69);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xaa37[_0x1035c1];return _0x308d67;};'use strict';var UserVoiceQueueRtEvents=require(_0x7aa3('0x0'));var events=[_0x7aa3('0x1'),_0x7aa3('0x2'),_0x7aa3('0x3')];function createListener(_0x4dcf7a,_0xa0e7e9){return function(_0x27adcf){_0xa0e7e9[_0x7aa3('0x4')](_0x4dcf7a,_0x27adcf);};}function removeListener(_0x11e64c,_0x334919){return function(){UserVoiceQueueRtEvents[_0x7aa3('0x5')](_0x11e64c,_0x334919);};}exports[_0x7aa3('0x6')]=function(_0x5b738a){for(var _0x437b90=0x0,_0xbbcc8a=events['length'];_0x437b90<_0xbbcc8a;_0x437b90++){var _0x100894=events[_0x437b90];var _0x390c82=createListener(_0x7aa3('0x7')+_0x100894,_0x5b738a);UserVoiceQueueRtEvents['on'](_0x100894,_0x390c82);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d58e3ed..f427c49 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x240355,_0x43e479){var _0x5df902=function(_0x2c5cb9){while(--_0x2c5cb9){_0x240355['push'](_0x240355['shift']());}};_0x5df902(++_0x43e479);}(_0x70e0,0x17b));var _0x070e=function(_0x4fb327,_0x179941){_0x4fb327=_0x4fb327-0x0;var _0x349105=_0x70e0[_0x4fb327];return _0x349105;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x128377,_0x1fd9d1){var _0x22a1a7=function(_0x5d633b){while(--_0x5d633b){_0x128377['push'](_0x128377['shift']());}};_0x22a1a7(++_0x1fd9d1);}(_0x70e0,0x17b));var _0x070e=function(_0x1a7156,_0x1357a3){_0x1a7156=_0x1a7156-0x0;var _0x417274=_0x70e0[_0x1a7156];return _0x417274;};'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 a9f84cb..c97f939 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 _0xe385=['exports','INTEGER'];(function(_0x421a30,_0x21dc72){var _0x83fca7=function(_0x197d31){while(--_0x197d31){_0x421a30['push'](_0x421a30['shift']());}};_0x83fca7(++_0x21dc72);}(_0xe385,0x11c));var _0x5e38=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe385[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x5e38('0x0')]={'penalty':{'type':Sequelize[_0x5e38('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe7a5=['sequelize','exports','INTEGER'];(function(_0x23787e,_0x523107){var _0x4a791a=function(_0x58c078){while(--_0x58c078){_0x23787e['push'](_0x23787e['shift']());}};_0x4a791a(++_0x523107);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe7a5[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x5e7a('0x0'));module[_0x5e7a('0x1')]={'penalty':{'type':Sequelize[_0x5e7a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 9dc5f40..700898e 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 _0xa628=['request-promise','path','rimraf','exports','UserWhatsappQueue','lodash','../../config/logger','api','bluebird'];(function(_0x3c65a0,_0x525d66){var _0x1dbe8c=function(_0x4f51b6){while(--_0x4f51b6){_0x3c65a0['push'](_0x3c65a0['shift']());}};_0x1dbe8c(++_0x525d66);}(_0xa628,0x137));var _0x8a62=function(_0x59f0f7,_0x423bc4){_0x59f0f7=_0x59f0f7-0x0;var _0xf5ef2a=_0xa628[_0x59f0f7];return _0xf5ef2a;};'use strict';var _=require(_0x8a62('0x0'));var util=require('util');var logger=require(_0x8a62('0x1'))(_0x8a62('0x2'));var moment=require('moment');var BPromise=require(_0x8a62('0x3'));var rp=require(_0x8a62('0x4'));var fs=require('fs');var path=require(_0x8a62('0x5'));var rimraf=require(_0x8a62('0x6'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x8a62('0x7')]=function(_0x51acb2,_0x35c439){return _0x51acb2['define'](_0x8a62('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda2a=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x47a503,_0x5a95da){var _0x325e25=function(_0x336819){while(--_0x336819){_0x47a503['push'](_0x47a503['shift']());}};_0x325e25(++_0x5a95da);}(_0xda2a,0x120));var _0xada2=function(_0x4685a0,_0x2f6e54){_0x4685a0=_0x4685a0-0x0;var _0x10716b=_0xda2a[_0x4685a0];return _0x10716b;};'use strict';var _=require(_0xada2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xada2('0x1'));var moment=require(_0xada2('0x2'));var BPromise=require(_0xada2('0x3'));var rp=require(_0xada2('0x4'));var fs=require('fs');var path=require(_0xada2('0x5'));var rimraf=require(_0xada2('0x6'));var config=require(_0xada2('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0xada2('0x8')]=function(_0x44858d,_0x39063a){return _0x44858d['define'](_0xada2('0x9'),attributes,{'tableName':_0xada2('0xa'),'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 d3d7b17..e81d0a5 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 _0xccea=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','../../config/utils'];(function(_0x4aa824,_0x37c967){var _0x2078d7=function(_0x1ecd28){while(--_0x1ecd28){_0x4aa824['push'](_0x4aa824['shift']());}};_0x2078d7(++_0x37c967);}(_0xccea,0x1ca));var _0xacce=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xccea[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xacce('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xacce('0x1'));var rs=require(_0xacce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacce('0x3'));var logger=require(_0xacce('0x4'))(_0xacce('0x5'));var config=require('../../config/environment');var jayson=require(_0xacce('0x6'));var client=jayson[_0xacce('0x7')][_0xacce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dc59,_0x4c84e3,_0x4a0037){return new BPromise(function(_0x3516e6,_0xacf522){return client[_0xacce('0x9')](_0x4dc59,_0x4a0037)[_0xacce('0xa')](function(_0x1232ba){logger[_0xacce('0xb')](_0xacce('0xc'),_0x4c84e3,_0xacce('0xd'));logger[_0xacce('0xe')](_0xacce('0xf'),_0x4c84e3,'request\x20sent',JSON['stringify'](_0x1232ba));if(_0x1232ba[_0xacce('0x10')]){if(_0x1232ba[_0xacce('0x10')][_0xacce('0x11')]===0x1f4){logger[_0xacce('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4c84e3,_0x1232ba[_0xacce('0x10')][_0xacce('0x12')]);return _0xacf522(_0x1232ba[_0xacce('0x10')][_0xacce('0x12')]);}logger[_0xacce('0x10')](_0xacce('0xc'),_0x4c84e3,_0x1232ba[_0xacce('0x10')]['message']);return _0x3516e6(_0x1232ba[_0xacce('0x10')][_0xacce('0x12')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x4c84e3,'request\x20sent');_0x3516e6(_0x1232ba[_0xacce('0x13')][_0xacce('0x12')]);}})[_0xacce('0x14')](function(_0x49f58f){logger[_0xacce('0x10')](_0xacce('0xc'),_0x4c84e3,_0x49f58f);_0xacf522(_0x49f58f);});});} \ No newline at end of file +var _0x4fe2=['jayson/promise','http','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','catch','util','moment','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x47267b,_0x3e82bf){var _0x58f46c=function(_0x1a119b){while(--_0x1a119b){_0x47267b['push'](_0x47267b['shift']());}};_0x58f46c(++_0x3e82bf);}(_0x4fe2,0x7f));var _0x24fe=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4fe2[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x24fe('0x0'));var moment=require(_0x24fe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fe('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x24fe('0x3'));var logger=require('../../config/logger')(_0x24fe('0x4'));var config=require(_0x24fe('0x5'));var jayson=require(_0x24fe('0x6'));var client=jayson['client'][_0x24fe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1660c7,_0x47f57f,_0x4c5e91){return new BPromise(function(_0x1f0d2a,_0x32283e){return client[_0x24fe('0x8')](_0x1660c7,_0x4c5e91)[_0x24fe('0x9')](function(_0x440b15){logger[_0x24fe('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x47f57f,_0x24fe('0xb'));logger[_0x24fe('0xc')](_0x24fe('0xd'),_0x47f57f,_0x24fe('0xb'),JSON['stringify'](_0x440b15));if(_0x440b15['error']){if(_0x440b15[_0x24fe('0xe')][_0x24fe('0xf')]===0x1f4){logger['error'](_0x24fe('0x10'),_0x47f57f,_0x440b15['error']['message']);return _0x32283e(_0x440b15[_0x24fe('0xe')][_0x24fe('0x11')]);}logger['error'](_0x24fe('0x10'),_0x47f57f,_0x440b15['error'][_0x24fe('0x11')]);return _0x1f0d2a(_0x440b15[_0x24fe('0xe')][_0x24fe('0x11')]);}else{logger[_0x24fe('0xa')](_0x24fe('0x10'),_0x47f57f,_0x24fe('0xb'));_0x1f0d2a(_0x440b15['result']['message']);}})[_0x24fe('0x12')](function(_0x2168fd){logger[_0x24fe('0xe')](_0x24fe('0x10'),_0x47f57f,_0x2168fd);_0x32283e(_0x2168fd);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9df7ec3..ac4fb45 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 _0xbd3b=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','isAuthenticated','get','/:id','post','create','put','update','delete'];(function(_0x4dbc46,_0x576c7c){var _0x54fa06=function(_0x52653b){while(--_0x52653b){_0x4dbc46['push'](_0x4dbc46['shift']());}};_0x54fa06(++_0x576c7c);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x1b70f7,_0xd1d2c8){_0x1b70f7=_0x1b70f7-0x0;var _0x18f09f=_0xbd3b[_0x1b70f7];return _0x18f09f;};'use strict';var multer=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var path=require(_0xbbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbd3('0x3'));var router=express[_0xbbd3('0x4')]();var fs_extra=require(_0xbbd3('0x5'));var auth=require(_0xbbd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd3('0x7'));var controller=require(_0xbbd3('0x8'));router['get']('/',auth[_0xbbd3('0x9')](),controller['index']);router[_0xbbd3('0xa')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller['show']);router[_0xbbd3('0xc')]('/',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xd')]);router[_0xbbd3('0xe')]('/:id',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xf')]);router[_0xbbd3('0x10')](_0xbbd3('0xb'),auth['isAuthenticated'](),controller[_0xbbd3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x84ab=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','/:id','show','post','create','isAuthenticated','update','destroy','exports','multer','util','path'];(function(_0x8b3002,_0x2c89ce){var _0x430613=function(_0x7769c6){while(--_0x7769c6){_0x8b3002['push'](_0x8b3002['shift']());}};_0x430613(++_0x2c89ce);}(_0x84ab,0x12f));var _0xb84a=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x84ab[_0x3afe18];return _0x19ed1f;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0xc')]('/',auth['isAuthenticated'](),controller[_0xb84a('0xd')]);router['put'](_0xb84a('0xa'),auth[_0xb84a('0xe')](),controller[_0xb84a('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0x10')]);module[_0xb84a('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 6b4f2a0..abf3ee8 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 _0xe364=['STRING','exports'];(function(_0x53b3bd,_0x95922){var _0x58a318=function(_0x5d260b){while(--_0x5d260b){_0x53b3bd['push'](_0x53b3bd['shift']());}};_0x58a318(++_0x95922);}(_0xe364,0x1c3));var _0x4e36=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0xe364[_0x102881];return _0x5c63d0;};'use strict';var Sequelize=require('sequelize');module[_0x4e36('0x0')]={'name':{'type':Sequelize[_0x4e36('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4e36('0x1')]}}; \ No newline at end of file +var _0x9649=['exports','STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9649,0x19f));var _0x9964=function(_0x3ba3b7,_0x645c13){_0x3ba3b7=_0x3ba3b7-0x0;var _0x215b05=_0x9649[_0x3ba3b7];return _0x215b05;};'use strict';var Sequelize=require(_0x9964('0x0'));module[_0x9964('0x1')]={'name':{'type':Sequelize[_0x9964('0x2')],'unique':_0x9964('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bfb47ac..a01736f 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 _0x4a20=['catch','show','Variable','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll'];(function(_0x3a21b7,_0x2092c4){var _0x586d11=function(_0x178935){while(--_0x178935){_0x3a21b7['push'](_0x3a21b7['shift']());}};_0x586d11(++_0x2092c4);}(_0x4a20,0x141));var _0x04a2=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x4a20[_0x1b2ff7];return _0x31656a;};'use strict';var emlformat=require(_0x04a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x04a2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04a2('0x2'));var moment=require(_0x04a2('0x3'));var BPromise=require(_0x04a2('0x4'));var Mustache=require('mustache');var util=require(_0x04a2('0x5'));var path=require(_0x04a2('0x6'));var sox=require(_0x04a2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x04a2('0x8'));var crypto=require(_0x04a2('0x9'));var jsforce=require(_0x04a2('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x04a2('0xb'));var Redis=require(_0x04a2('0xc'));var authService=require(_0x04a2('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04a2('0xe'));var logger=require('../../config/logger')(_0x04a2('0xf'));var utils=require(_0x04a2('0x10'));var config=require(_0x04a2('0x11'));var licenseUtil=require(_0x04a2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24e60c,_0x5c6153){_0x5c6153=_0x5c6153||0xcc;return function(_0x3b24b9){if(_0x3b24b9){return _0x24e60c[_0x04a2('0x13')](_0x5c6153);}return _0x24e60c['status'](_0x5c6153)[_0x04a2('0x14')]();};}function respondWithResult(_0x2e8581,_0x3df772){_0x3df772=_0x3df772||0xc8;return function(_0x29a8ac){if(_0x29a8ac){return _0x2e8581[_0x04a2('0x15')](_0x3df772)[_0x04a2('0x16')](_0x29a8ac);}};}function respondWithFilteredResult(_0x58d0b8,_0x3b2b9a){return function(_0x5af7e3){if(_0x5af7e3){var _0x18b3a7=typeof _0x3b2b9a[_0x04a2('0x17')]===_0x04a2('0x18')&&typeof _0x3b2b9a['limit']===_0x04a2('0x18');var _0x5b2389=_0x5af7e3[_0x04a2('0x19')];var _0x550cda=_0x18b3a7?0x0:_0x3b2b9a[_0x04a2('0x17')];var _0x56aee4=_0x18b3a7?_0x5af7e3[_0x04a2('0x19')]:_0x3b2b9a[_0x04a2('0x17')]+_0x3b2b9a['limit'];var _0x4a1f7f;if(_0x56aee4>=_0x5b2389){_0x56aee4=_0x5b2389;_0x4a1f7f=0xc8;}else{_0x4a1f7f=0xce;}_0x58d0b8[_0x04a2('0x15')](_0x4a1f7f);return _0x58d0b8[_0x04a2('0x1a')]('Content-Range',_0x550cda+'-'+_0x56aee4+'/'+_0x5b2389)[_0x04a2('0x16')](_0x5af7e3);}return null;};}function patchUpdates(_0x3e4f44){return function(_0x3c7854){try{jsonpatch[_0x04a2('0x1b')](_0x3c7854,_0x3e4f44,!![]);}catch(_0x4827bb){return BPromise['reject'](_0x4827bb);}return _0x3c7854[_0x04a2('0x1c')]();};}function saveUpdates(_0x599b53,_0x54208e){return function(_0x1bf62e){if(_0x1bf62e){return _0x1bf62e[_0x04a2('0x1d')](_0x599b53)['then'](function(_0x45f736){return _0x45f736;});}return null;};}function removeEntity(_0x222dbf,_0xb04a63){return function(_0xb29f61){if(_0xb29f61){return _0xb29f61[_0x04a2('0x1e')]()[_0x04a2('0x1f')](function(){var _0x29bfcf=_0xb29f61[_0x04a2('0x20')]({'plain':!![]});var _0x1bc346='Variables';return db[_0x04a2('0x21')][_0x04a2('0x1e')]({'where':{'type':_0x1bc346,'resourceId':_0x29bfcf['id']}})['then'](function(){return _0xb29f61;});})['then'](function(){_0x222dbf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15c0d2,_0x5f1e4e){return function(_0x4696a0){if(!_0x4696a0){_0x15c0d2[_0x04a2('0x13')](0x194);}return _0x4696a0;};}function handleError(_0x115c8a,_0x48b35d){_0x48b35d=_0x48b35d||0x1f4;return function(_0x1fe8ff){logger[_0x04a2('0x22')](_0x1fe8ff[_0x04a2('0x23')]);if(_0x1fe8ff[_0x04a2('0x24')]){delete _0x1fe8ff[_0x04a2('0x24')];}_0x115c8a[_0x04a2('0x15')](_0x48b35d)[_0x04a2('0x25')](_0x1fe8ff);};}exports[_0x04a2('0x26')]=function(_0x3c8bc6,_0x3a2b78){var _0x3d870b={},_0x4190ab={},_0x142500={'count':0x0,'rows':[]};var _0x49650f=_['map'](db['Variable'][_0x04a2('0x27')],function(_0x460fac){return{'name':_0x460fac[_0x04a2('0x28')],'type':_0x460fac[_0x04a2('0x29')][_0x04a2('0x2a')]};});_0x4190ab['model']=_[_0x04a2('0x2b')](_0x49650f,_0x04a2('0x24'));_0x4190ab[_0x04a2('0x2c')]=_[_0x04a2('0x2d')](_0x3c8bc6['query']);_0x4190ab[_0x04a2('0x2e')]=_['intersection'](_0x4190ab[_0x04a2('0x2f')],_0x4190ab[_0x04a2('0x2c')]);_0x3d870b['attributes']=_[_0x04a2('0x30')](_0x4190ab['model'],qs['fields'](_0x3c8bc6[_0x04a2('0x2c')][_0x04a2('0x31')]));_0x3d870b[_0x04a2('0x32')]=_0x3d870b[_0x04a2('0x32')][_0x04a2('0x33')]?_0x3d870b['attributes']:_0x4190ab['model'];if(!_0x3c8bc6[_0x04a2('0x2c')][_0x04a2('0x34')](_0x04a2('0x35'))){_0x3d870b[_0x04a2('0x36')]=qs[_0x04a2('0x36')](_0x3c8bc6[_0x04a2('0x2c')][_0x04a2('0x36')]);_0x3d870b[_0x04a2('0x17')]=qs['offset'](_0x3c8bc6[_0x04a2('0x2c')]['offset']);}_0x3d870b['order']=qs['sort'](_0x3c8bc6['query'][_0x04a2('0x37')]);_0x3d870b[_0x04a2('0x38')]=qs[_0x04a2('0x2e')](_[_0x04a2('0x39')](_0x3c8bc6[_0x04a2('0x2c')],_0x4190ab['filters']),_0x49650f);if(_0x3c8bc6[_0x04a2('0x2c')][_0x04a2('0x3a')]){_0x3d870b[_0x04a2('0x38')]=_['merge'](_0x3d870b[_0x04a2('0x38')],{'$or':_[_0x04a2('0x2b')](_0x49650f,function(_0xcd6579){if(_0xcd6579['type']!==_0x04a2('0x3b')){var _0xbeb08c={};_0xbeb08c[_0xcd6579[_0x04a2('0x24')]]={'$like':'%'+_0x3c8bc6[_0x04a2('0x2c')][_0x04a2('0x3a')]+'%'};return _0xbeb08c;}})});}_0x3d870b=_[_0x04a2('0x3c')]({},_0x3d870b,_0x3c8bc6[_0x04a2('0x3d')]);var _0x461eab={'where':_0x3d870b[_0x04a2('0x38')]};return db['Variable']['count'](_0x461eab)[_0x04a2('0x1f')](function(_0x96c87d){_0x142500[_0x04a2('0x19')]=_0x96c87d;if(_0x3c8bc6[_0x04a2('0x2c')]['includeAll']){_0x3d870b[_0x04a2('0x3e')]=[{'all':!![]}];}return db['Variable'][_0x04a2('0x3f')](_0x3d870b);})['then'](function(_0x357ff3){_0x142500['rows']=_0x357ff3;return _0x142500;})['then'](respondWithFilteredResult(_0x3a2b78,_0x3d870b))[_0x04a2('0x40')](handleError(_0x3a2b78,null));};exports[_0x04a2('0x41')]=function(_0x168635,_0x4fd9d4){var _0x20a57a={'raw':!![],'where':{'id':_0x168635['params']['id']}},_0x186670={};_0x186670[_0x04a2('0x2f')]=_['keys'](db[_0x04a2('0x42')]['rawAttributes']);_0x186670[_0x04a2('0x2c')]=_['keys'](_0x168635['query']);_0x186670[_0x04a2('0x2e')]=_['intersection'](_0x186670[_0x04a2('0x2f')],_0x186670['query']);_0x20a57a['attributes']=_[_0x04a2('0x30')](_0x186670['model'],qs[_0x04a2('0x31')](_0x168635[_0x04a2('0x2c')]['fields']));_0x20a57a[_0x04a2('0x32')]=_0x20a57a[_0x04a2('0x32')]['length']?_0x20a57a[_0x04a2('0x32')]:_0x186670[_0x04a2('0x2f')];if(_0x168635[_0x04a2('0x2c')][_0x04a2('0x43')]){_0x20a57a['include']=[{'all':!![]}];}_0x20a57a=_[_0x04a2('0x3c')]({},_0x20a57a,_0x168635[_0x04a2('0x3d')]);return db[_0x04a2('0x42')][_0x04a2('0x44')](_0x20a57a)[_0x04a2('0x1f')](handleEntityNotFound(_0x4fd9d4,null))['then'](respondWithResult(_0x4fd9d4,null))[_0x04a2('0x40')](handleError(_0x4fd9d4,null));};exports[_0x04a2('0x45')]=function(_0xa6227b,_0x3e7690){return db[_0x04a2('0x42')][_0x04a2('0x45')](_0xa6227b['body'],{})['then'](function(_0x2e2c0a){var _0x5c65b=_0xa6227b[_0x04a2('0x46')]['get']({'plain':!![]});if(!_0x5c65b)throw new Error(_0x04a2('0x47'));if(_0x5c65b[_0x04a2('0x48')]===_0x04a2('0x46')){var _0xa46ae1=_0x2e2c0a[_0x04a2('0x20')]({'plain':!![]});var _0x3a8871='Variables';return db[_0x04a2('0x49')][_0x04a2('0x44')]({'where':{'name':_0x3a8871,'userProfileId':_0x5c65b['userProfileId']},'raw':!![]})[_0x04a2('0x1f')](function(_0x4fd528){if(_0x4fd528&&_0x4fd528[_0x04a2('0x4a')]===0x0){return db[_0x04a2('0x21')][_0x04a2('0x45')]({'name':_0xa46ae1[_0x04a2('0x24')],'resourceId':_0xa46ae1['id'],'type':_0x4fd528['name'],'sectionId':_0x4fd528['id']},{})[_0x04a2('0x1f')](function(){return _0x2e2c0a;});}else{return _0x2e2c0a;}})['catch'](function(_0x17ec5e){logger['error'](_0x04a2('0x4b'),_0x17ec5e);throw _0x17ec5e;});}return _0x2e2c0a;})[_0x04a2('0x1f')](respondWithResult(_0x3e7690,0xc9))[_0x04a2('0x40')](handleError(_0x3e7690,null));};exports[_0x04a2('0x1d')]=function(_0x2ffe68,_0x41d64c){if(_0x2ffe68[_0x04a2('0x4c')]['id']){delete _0x2ffe68[_0x04a2('0x4c')]['id'];}return db[_0x04a2('0x42')]['find']({'where':{'id':_0x2ffe68['params']['id']}})[_0x04a2('0x1f')](handleEntityNotFound(_0x41d64c,null))[_0x04a2('0x1f')](saveUpdates(_0x2ffe68[_0x04a2('0x4c')],null))[_0x04a2('0x1f')](respondWithResult(_0x41d64c,null))[_0x04a2('0x40')](handleError(_0x41d64c,null));};exports[_0x04a2('0x1e')]=function(_0x487f9e,_0x235505){return db[_0x04a2('0x42')][_0x04a2('0x44')]({'where':{'id':_0x487f9e['params']['id']}})[_0x04a2('0x1f')](handleEntityNotFound(_0x235505,null))[_0x04a2('0x1f')](removeEntity(_0x235505,null))['catch'](handleError(_0x235505,null));}; \ No newline at end of file +var _0xf72e=['userProfileId','autoAssociation','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then','UserProfileResource','destroy','error','stack','name','index','Variable','rawAttributes','fieldName','type','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Variables','UserProfileSection','find'];(function(_0xadf5b5,_0x27d4f8){var _0xd00fdd=function(_0x49302a){while(--_0x49302a){_0xadf5b5['push'](_0xadf5b5['shift']());}};_0xd00fdd(++_0x27d4f8);}(_0xf72e,0x9a));var _0xef72=function(_0x222a19,_0x4679d8){_0x222a19=_0x222a19-0x0;var _0x2f2ff0=_0xf72e[_0x222a19];return _0x2f2ff0;};'use strict';var emlformat=require(_0xef72('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef72('0x1'));var moment=require('moment');var BPromise=require(_0xef72('0x2'));var Mustache=require(_0xef72('0x3'));var util=require(_0xef72('0x4'));var path=require(_0xef72('0x5'));var sox=require(_0xef72('0x6'));var csv=require(_0xef72('0x7'));var ejs=require(_0xef72('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xef72('0x9'));var crypto=require('crypto');var jsforce=require(_0xef72('0xa'));var deskjs=require(_0xef72('0xb'));var toCsv=require(_0xef72('0x7'));var querystring=require(_0xef72('0xc'));var Papa=require(_0xef72('0xd'));var Redis=require(_0xef72('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xef72('0xf'));var as=require(_0xef72('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xef72('0x11'));var licenseUtil=require(_0xef72('0x12'));var db=require(_0xef72('0x13'))['db'];function respondWithStatusCode(_0xaab125,_0x10e6ac){_0x10e6ac=_0x10e6ac||0xcc;return function(_0x18c9bf){if(_0x18c9bf){return _0xaab125[_0xef72('0x14')](_0x10e6ac);}return _0xaab125[_0xef72('0x15')](_0x10e6ac)['end']();};}function respondWithResult(_0x4e81ce,_0x55812f){_0x55812f=_0x55812f||0xc8;return function(_0x6f7860){if(_0x6f7860){return _0x4e81ce[_0xef72('0x15')](_0x55812f)['json'](_0x6f7860);}};}function respondWithFilteredResult(_0x327f2d,_0x5a6ad3){return function(_0xe1dcf2){if(_0xe1dcf2){var _0x2e7dc7=typeof _0x5a6ad3['offset']===_0xef72('0x16')&&typeof _0x5a6ad3['limit']===_0xef72('0x16');var _0x11590b=_0xe1dcf2[_0xef72('0x17')];var _0x4c9983=_0x2e7dc7?0x0:_0x5a6ad3[_0xef72('0x18')];var _0x4bacf2=_0x2e7dc7?_0xe1dcf2['count']:_0x5a6ad3[_0xef72('0x18')]+_0x5a6ad3[_0xef72('0x19')];var _0x1d43f6;if(_0x4bacf2>=_0x11590b){_0x4bacf2=_0x11590b;_0x1d43f6=0xc8;}else{_0x1d43f6=0xce;}_0x327f2d['status'](_0x1d43f6);return _0x327f2d[_0xef72('0x1a')](_0xef72('0x1b'),_0x4c9983+'-'+_0x4bacf2+'/'+_0x11590b)[_0xef72('0x1c')](_0xe1dcf2);}return null;};}function patchUpdates(_0x2153eb){return function(_0x103e65){try{jsonpatch[_0xef72('0x1d')](_0x103e65,_0x2153eb,!![]);}catch(_0x2b931d){return BPromise[_0xef72('0x1e')](_0x2b931d);}return _0x103e65['save']();};}function saveUpdates(_0x288080,_0x4c3ff0){return function(_0x32680f){if(_0x32680f){return _0x32680f[_0xef72('0x1f')](_0x288080)['then'](function(_0x37eb43){return _0x37eb43;});}return null;};}function removeEntity(_0x27b2c6,_0x5c7731){return function(_0x34edb6){if(_0x34edb6){return _0x34edb6['destroy']()[_0xef72('0x20')](function(){var _0x49febf=_0x34edb6['get']({'plain':!![]});var _0x10f0b2='Variables';return db[_0xef72('0x21')][_0xef72('0x22')]({'where':{'type':_0x10f0b2,'resourceId':_0x49febf['id']}})[_0xef72('0x20')](function(){return _0x34edb6;});})[_0xef72('0x20')](function(){_0x27b2c6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f21c6,_0x287386){return function(_0x4ede12){if(!_0x4ede12){_0x1f21c6['sendStatus'](0x194);}return _0x4ede12;};}function handleError(_0x172ee4,_0x3b4a26){_0x3b4a26=_0x3b4a26||0x1f4;return function(_0x5e5239){logger[_0xef72('0x23')](_0x5e5239[_0xef72('0x24')]);if(_0x5e5239[_0xef72('0x25')]){delete _0x5e5239[_0xef72('0x25')];}_0x172ee4[_0xef72('0x15')](_0x3b4a26)['send'](_0x5e5239);};}exports[_0xef72('0x26')]=function(_0x93afa9,_0x1c593a){var _0x46be09={},_0x203720={},_0xaa2546={'count':0x0,'rows':[]};var _0x464c17=_['map'](db[_0xef72('0x27')][_0xef72('0x28')],function(_0x219fac){return{'name':_0x219fac[_0xef72('0x29')],'type':_0x219fac[_0xef72('0x2a')]['key']};});_0x203720['model']=_[_0xef72('0x2b')](_0x464c17,_0xef72('0x25'));_0x203720[_0xef72('0x2c')]=_['keys'](_0x93afa9['query']);_0x203720[_0xef72('0x2d')]=_[_0xef72('0x2e')](_0x203720['model'],_0x203720[_0xef72('0x2c')]);_0x46be09[_0xef72('0x2f')]=_[_0xef72('0x2e')](_0x203720['model'],qs[_0xef72('0x30')](_0x93afa9['query'][_0xef72('0x30')]));_0x46be09['attributes']=_0x46be09[_0xef72('0x2f')][_0xef72('0x31')]?_0x46be09[_0xef72('0x2f')]:_0x203720[_0xef72('0x32')];if(!_0x93afa9['query'][_0xef72('0x33')](_0xef72('0x34'))){_0x46be09[_0xef72('0x19')]=qs['limit'](_0x93afa9[_0xef72('0x2c')][_0xef72('0x19')]);_0x46be09[_0xef72('0x18')]=qs['offset'](_0x93afa9[_0xef72('0x2c')][_0xef72('0x18')]);}_0x46be09[_0xef72('0x35')]=qs[_0xef72('0x36')](_0x93afa9[_0xef72('0x2c')][_0xef72('0x36')]);_0x46be09[_0xef72('0x37')]=qs[_0xef72('0x2d')](_['pick'](_0x93afa9['query'],_0x203720[_0xef72('0x2d')]),_0x464c17);if(_0x93afa9[_0xef72('0x2c')][_0xef72('0x38')]){_0x46be09[_0xef72('0x37')]=_[_0xef72('0x39')](_0x46be09[_0xef72('0x37')],{'$or':_[_0xef72('0x2b')](_0x464c17,function(_0x8011ac){if(_0x8011ac['type']!==_0xef72('0x3a')){var _0x4682a6={};_0x4682a6[_0x8011ac[_0xef72('0x25')]]={'$like':'%'+_0x93afa9[_0xef72('0x2c')][_0xef72('0x38')]+'%'};return _0x4682a6;}})});}_0x46be09=_[_0xef72('0x39')]({},_0x46be09,_0x93afa9[_0xef72('0x3b')]);var _0x3f9ad9={'where':_0x46be09['where']};return db[_0xef72('0x27')][_0xef72('0x17')](_0x3f9ad9)[_0xef72('0x20')](function(_0x276c96){_0xaa2546[_0xef72('0x17')]=_0x276c96;if(_0x93afa9[_0xef72('0x2c')]['includeAll']){_0x46be09['include']=[{'all':!![]}];}return db[_0xef72('0x27')][_0xef72('0x3c')](_0x46be09);})['then'](function(_0x355a40){_0xaa2546['rows']=_0x355a40;return _0xaa2546;})['then'](respondWithFilteredResult(_0x1c593a,_0x46be09))[_0xef72('0x3d')](handleError(_0x1c593a,null));};exports[_0xef72('0x3e')]=function(_0x42b746,_0x37c4af){var _0x107ddf={'raw':!![],'where':{'id':_0x42b746[_0xef72('0x3f')]['id']}},_0x2eafeb={};_0x2eafeb[_0xef72('0x32')]=_[_0xef72('0x40')](db[_0xef72('0x27')][_0xef72('0x28')]);_0x2eafeb[_0xef72('0x2c')]=_[_0xef72('0x40')](_0x42b746[_0xef72('0x2c')]);_0x2eafeb['filters']=_[_0xef72('0x2e')](_0x2eafeb[_0xef72('0x32')],_0x2eafeb['query']);_0x107ddf[_0xef72('0x2f')]=_['intersection'](_0x2eafeb[_0xef72('0x32')],qs[_0xef72('0x30')](_0x42b746['query'][_0xef72('0x30')]));_0x107ddf['attributes']=_0x107ddf[_0xef72('0x2f')][_0xef72('0x31')]?_0x107ddf[_0xef72('0x2f')]:_0x2eafeb['model'];if(_0x42b746[_0xef72('0x2c')]['includeAll']){_0x107ddf['include']=[{'all':!![]}];}_0x107ddf=_[_0xef72('0x39')]({},_0x107ddf,_0x42b746[_0xef72('0x3b')]);return db[_0xef72('0x27')]['find'](_0x107ddf)[_0xef72('0x20')](handleEntityNotFound(_0x37c4af,null))[_0xef72('0x20')](respondWithResult(_0x37c4af,null))[_0xef72('0x3d')](handleError(_0x37c4af,null));};exports[_0xef72('0x41')]=function(_0x32f72d,_0x10fbc5){return db[_0xef72('0x27')][_0xef72('0x41')](_0x32f72d[_0xef72('0x42')],{})['then'](function(_0x3f00c7){var _0xa2a26=_0x32f72d[_0xef72('0x43')]['get']({'plain':!![]});if(!_0xa2a26)throw new Error(_0xef72('0x44'));if(_0xa2a26[_0xef72('0x45')]===_0xef72('0x43')){var _0x1e3384=_0x3f00c7[_0xef72('0x46')]({'plain':!![]});var _0xc8e5b7=_0xef72('0x47');return db[_0xef72('0x48')][_0xef72('0x49')]({'where':{'name':_0xc8e5b7,'userProfileId':_0xa2a26[_0xef72('0x4a')]},'raw':!![]})['then'](function(_0x25aa23){if(_0x25aa23&&_0x25aa23[_0xef72('0x4b')]===0x0){return db[_0xef72('0x21')][_0xef72('0x41')]({'name':_0x1e3384[_0xef72('0x25')],'resourceId':_0x1e3384['id'],'type':_0x25aa23[_0xef72('0x25')],'sectionId':_0x25aa23['id']},{})['then'](function(){return _0x3f00c7;});}else{return _0x3f00c7;}})[_0xef72('0x3d')](function(_0x142ea8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x142ea8);throw _0x142ea8;});}return _0x3f00c7;})['then'](respondWithResult(_0x10fbc5,0xc9))['catch'](handleError(_0x10fbc5,null));};exports[_0xef72('0x1f')]=function(_0x24968c,_0x4f4dff){if(_0x24968c[_0xef72('0x42')]['id']){delete _0x24968c[_0xef72('0x42')]['id'];}return db[_0xef72('0x27')]['find']({'where':{'id':_0x24968c['params']['id']}})['then'](handleEntityNotFound(_0x4f4dff,null))[_0xef72('0x20')](saveUpdates(_0x24968c[_0xef72('0x42')],null))[_0xef72('0x20')](respondWithResult(_0x4f4dff,null))[_0xef72('0x3d')](handleError(_0x4f4dff,null));};exports[_0xef72('0x22')]=function(_0x15320e,_0x7bc457){return db[_0xef72('0x27')]['find']({'where':{'id':_0x15320e['params']['id']}})[_0xef72('0x20')](handleEntityNotFound(_0x7bc457,null))[_0xef72('0x20')](removeEntity(_0x7bc457,null))[_0xef72('0x3d')](handleError(_0x7bc457,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 52bc318..ce1e693 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 _0xf699=['../../config/environment','exports','define','Variable','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2e2eb9,_0x39d553){var _0x689bd2=function(_0x56a782){while(--_0x56a782){_0x2e2eb9['push'](_0x2e2eb9['shift']());}};_0x689bd2(++_0x39d553);}(_0xf699,0x72));var _0x9f69=function(_0x342d57,_0x1a8403){_0x342d57=_0x342d57-0x0;var _0x3a064a=_0xf699[_0x342d57];return _0x3a064a;};'use strict';var _=require(_0x9f69('0x0'));var util=require('util');var logger=require(_0x9f69('0x1'))(_0x9f69('0x2'));var moment=require(_0x9f69('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f69('0x4'));var fs=require('fs');var path=require(_0x9f69('0x5'));var rimraf=require(_0x9f69('0x6'));var config=require(_0x9f69('0x7'));var attributes=require('./variable.attributes');module[_0x9f69('0x8')]=function(_0x20d803,_0x50b20e){return _0x20d803[_0x9f69('0x9')](_0x9f69('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fb3=['moment','path','rimraf','exports','define','Variable','tools_variables','lodash','util'];(function(_0x12bfd2,_0x2079b6){var _0x2c6a25=function(_0x1ed3ee){while(--_0x1ed3ee){_0x12bfd2['push'](_0x12bfd2['shift']());}};_0x2c6a25(++_0x2079b6);}(_0x7fb3,0x14b));var _0x37fb=function(_0x2fa06e,_0x228d80){_0x2fa06e=_0x2fa06e-0x0;var _0x2df3f2=_0x7fb3[_0x2fa06e];return _0x2df3f2;};'use strict';var _=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x37fb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37fb('0x3'));var rimraf=require(_0x37fb('0x4'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x37fb('0x5')]=function(_0x143794,_0x4e2b98){return _0x143794[_0x37fb('0x6')](_0x37fb('0x7'),attributes,{'tableName':_0x37fb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index b0248c2..72320df 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x326f,0xd1));var _0xf326=function(_0x20dec5,_0x2eac0a){_0x20dec5=_0x20dec5-0x0;var _0xb274f9=_0x326f[_0x20dec5];return _0xb274f9;};'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')]('Variable,\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')]('Variable,\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')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file +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(_0x142341,_0x1720c5){var _0x2672cb=function(_0x10d155){while(--_0x10d155){_0x142341['push'](_0x142341['shift']());}};_0x2672cb(++_0x1720c5);}(_0xabce,0x103));var _0xeabc=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xabce[_0x1ddedd];return _0xa3e1ac;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index a9c9c2d..a8ef3f8 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 _0x6af0=['isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','restart','migrations','express','Router','../../components/auth/service','get','index','/fetch'];(function(_0x173eff,_0x55a7d0){var _0x119fbd=function(_0x31a223){while(--_0x31a223){_0x173eff['push'](_0x173eff['shift']());}};_0x119fbd(++_0x55a7d0);}(_0x6af0,0x90));var _0x06af=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x6af0[_0x36884e];return _0x1cc367;};'use strict';var express=require(_0x06af('0x0'));var router=express[_0x06af('0x1')]();var auth=require(_0x06af('0x2'));var controller=require('./version.controller');router[_0x06af('0x3')]('/',controller[_0x06af('0x4')]);router[_0x06af('0x3')](_0x06af('0x5'),auth[_0x06af('0x6')](),auth[_0x06af('0x7')](),controller[_0x06af('0x8')]);router[_0x06af('0x3')]('/reset',auth[_0x06af('0x6')](),auth[_0x06af('0x7')](),controller[_0x06af('0x9')]);router[_0x06af('0x3')](_0x06af('0xa'),auth['isAuthenticated'](),auth[_0x06af('0x7')](),controller[_0x06af('0xb')]);router[_0x06af('0x3')](_0x06af('0xc'),auth[_0x06af('0x6')](),controller[_0x06af('0xd')]);router['get']('/migrations',controller[_0x06af('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0dcf=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x2c3047,_0x3a0008){var _0x571ffa=function(_0x25e970){while(--_0x25e970){_0x2c3047['push'](_0x2c3047['shift']());}};_0x571ffa(++_0x3a0008);}(_0x0dcf,0x1e8));var _0xf0dc=function(_0x14d2af,_0x197c29){_0x14d2af=_0x14d2af-0x0;var _0x3707f4=_0x0dcf[_0x14d2af];return _0x3707f4;};'use strict';var express=require(_0xf0dc('0x0'));var router=express[_0xf0dc('0x1')]();var auth=require(_0xf0dc('0x2'));var controller=require(_0xf0dc('0x3'));router[_0xf0dc('0x4')]('/',controller[_0xf0dc('0x5')]);router[_0xf0dc('0x4')](_0xf0dc('0x6'),auth[_0xf0dc('0x7')](),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x9')]);router[_0xf0dc('0x4')](_0xf0dc('0xa'),auth[_0xf0dc('0x7')](),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0xb')]);router['get'](_0xf0dc('0xc'),auth[_0xf0dc('0x7')](),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0xd')]);router[_0xf0dc('0x4')]('/restart',auth[_0xf0dc('0x7')](),controller[_0xf0dc('0xe')]);router[_0xf0dc('0x4')](_0xf0dc('0xf'),controller[_0xf0dc('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 9bd6331..62c94d9 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 _0xe1ad=['Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','root','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','index','exports','query','latest','fetch','tags','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s'];(function(_0x4fb773,_0x2b00b6){var _0x3a45b8=function(_0x53a692){while(--_0x53a692){_0x4fb773['push'](_0x4fb773['shift']());}};_0x3a45b8(++_0x2b00b6);}(_0xe1ad,0x157));var _0xde1a=function(_0x5ac625,_0x49c43b){_0x5ac625=_0x5ac625-0x0;var _0x1dfed1=_0xe1ad[_0x5ac625];return _0x1dfed1;};'use strict';var Umzug=require(_0xde1a('0x0'));var path=require(_0xde1a('0x1'));var fs=require('fs');var _=require(_0xde1a('0x2'));var pkginfo=require(_0xde1a('0x3'))(module,_0xde1a('0x4'));var compareVersions=require(_0xde1a('0x5'));var exec=require(_0xde1a('0x6'))[_0xde1a('0x7')];var db=require(_0xde1a('0x8'))['db'];var config=require(_0xde1a('0x9'));var pm2=require(_0xde1a('0xa'));var logger=require(_0xde1a('0xb'))('update');var git=require(_0xde1a('0xc'))(config['root']);exports[_0xde1a('0xd')]=function(_0x1284d7,_0x2400fa){var _0x13a808={'current':module[_0xde1a('0xe')][_0xde1a('0x4')],'phonebar':0x2};if(_0x1284d7[_0xde1a('0xf')]&&_0x1284d7[_0xde1a('0xf')][_0xde1a('0x10')]){return git[_0xde1a('0x11')]()[_0xde1a('0x12')](function(_0x19100d,_0x9069e6){_0x13a808[_0xde1a('0x10')]=(_0x19100d?module[_0xde1a('0xe')][_0xde1a('0x4')]:_0x9069e6['latest'])||'2.0.0';return _0x2400fa[_0xde1a('0x13')](0xc8)[_0xde1a('0x14')](_0x13a808);});}else{return _0x2400fa[_0xde1a('0x13')](0xc8)[_0xde1a('0x14')](_0x13a808);}};exports['fetch']=function(_0x46abb9,_0x306ae1){return git[_0xde1a('0x11')]([_0xde1a('0x15'),'master'],function(_0x317672){if(_0x317672){logger[_0xde1a('0x16')](_0x317672);return _0x306ae1['status'](0x1f4)[_0xde1a('0x14')](_0x317672);}logger[_0xde1a('0x17')](_0xde1a('0x18'));return _0x306ae1[_0xde1a('0x13')](0xc8)['json']({'output':_0xde1a('0x19')});});};exports[_0xde1a('0x1a')]=function(_0x52746b,_0x1411a3){return git[_0xde1a('0x1a')]([_0xde1a('0x1b'),_0xde1a('0x1c')],function(_0x24e037){if(_0x24e037){logger[_0xde1a('0x16')](_0x24e037);return _0x1411a3[_0xde1a('0x13')](0x1f4)[_0xde1a('0x14')](_0x24e037);}logger['info'](_0xde1a('0x1d'));return _0x1411a3[_0xde1a('0x13')](0xc8)[_0xde1a('0x14')]({'output':_0xde1a('0x1e')});});};exports[_0xde1a('0x1f')]=function(_0x2e287d,_0x3c3d2c){exec('npm\x20install\x20--production',function(_0x42f9f1,_0x19c696,_0x132c8b){logger['info'](_0x19c696);logger[_0xde1a('0x17')](_0x132c8b);if(_0x42f9f1){logger[_0xde1a('0x16')](_0x42f9f1);return _0x3c3d2c[_0xde1a('0x13')](0x1f4)['json'](_0x42f9f1);}return _0x3c3d2c[_0xde1a('0x13')](0xc8)[_0xde1a('0x14')]({'output':_0x19c696});});};exports['restart']=function(_0x12a896,_0x3a2991){return pm2[_0xde1a('0x20')](_0xde1a('0x21'))['then'](function(_0x240450){logger[_0xde1a('0x17')](_0xde1a('0x22'),_0x240450);return _0x3a2991['status'](0xc8)[_0xde1a('0x14')]({'output':_0xde1a('0x23')});})['catch'](function(_0x3c59fe){logger[_0xde1a('0x16')](_0x3c59fe);return _0x3a2991['status'](0x1f4)['json'](_0x3c59fe);});};exports[_0xde1a('0x24')]=function(_0x3473e3,_0x2b6d64){var _0x9136ac=fs['readdirSync'](path[_0xde1a('0x25')](config[_0xde1a('0x26')],_0xde1a('0x27'),_0xde1a('0x24')));var _0x394aa6=[];for(var _0x14e1ce=0x0;_0x14e1ce<_0x9136ac[_0xde1a('0x28')];_0x14e1ce++){var _0x5dddff=_0x9136ac[_0x14e1ce][_0xde1a('0x29')]('.js','');if(compareVersions(module['exports'][_0xde1a('0x4')],_0x5dddff)===-0x1){_0x394aa6[_0xde1a('0x2a')](_0x5dddff);}}if(_0x394aa6[_0xde1a('0x28')]){var _0x56a7c1=_0x394aa6[_0xde1a('0x2b')](compareVersions);var _0x20ae74=new Umzug({'storage':_0xde1a('0x2c'),'storageOptions':{'model':db['Migration'],'modelName':_0xde1a('0x2d'),'columnName':'version'},'migrations':{'params':[db[_0xde1a('0x2c')][_0xde1a('0x2e')](),db[_0xde1a('0x2c')][_0xde1a('0x2f')],function(){throw new Error(_0xde1a('0x30'));}],'path':path[_0xde1a('0x25')](config[_0xde1a('0x26')],_0xde1a('0x27'),_0xde1a('0x24')),'pattern':/\.js$/}});_0x20ae74['up']({'migrations':_['map'](_0x56a7c1,function(_0x52c286){return _0x52c286+_0xde1a('0x31');})})['then'](function(){return _0x2b6d64[_0xde1a('0x13')](0xc8)['json']({'output':_0xde1a('0x32')+module[_0xde1a('0xe')][_0xde1a('0x4')]+_0xde1a('0x33')+_['last'](_0x56a7c1),'migrations':_[_0xde1a('0x25')](_0x56a7c1)});})[_0xde1a('0x34')](function(_0x5a2200){if(_0x5a2200 instanceof db[_0xde1a('0x2c')]['UniqueConstraintError']){return _0x2b6d64[_0xde1a('0x13')](0xc8)[_0xde1a('0x14')]({'output':_0xde1a('0x35')});}else{return _0x2b6d64[_0xde1a('0x13')](0x1f4)['json'](_0x5a2200);}});}else{return _0x2b6d64['status'](0xc8)[_0xde1a('0x14')]({'output':_0xde1a('0x35')});}}; \ No newline at end of file +var _0x6d0b=['server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../config/pm2','../../config/logger','root','exports','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync'];(function(_0x42195a,_0x2d59e8){var _0x4249dc=function(_0x596b08){while(--_0x596b08){_0x42195a['push'](_0x42195a['shift']());}};_0x4249dc(++_0x2d59e8);}(_0x6d0b,0x17c));var _0xb6d0=function(_0x22ec92,_0x198573){_0x22ec92=_0x22ec92-0x0;var _0x9ecb18=_0x6d0b[_0x22ec92];return _0x9ecb18;};'use strict';var Umzug=require(_0xb6d0('0x0'));var path=require(_0xb6d0('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xb6d0('0x2'))(module,_0xb6d0('0x3'));var compareVersions=require(_0xb6d0('0x4'));var exec=require(_0xb6d0('0x5'))[_0xb6d0('0x6')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xb6d0('0x7'));var logger=require(_0xb6d0('0x8'))('update');var git=require('simple-git')(config[_0xb6d0('0x9')]);exports['index']=function(_0x4c4026,_0x4cad15){var _0x2b1c00={'current':module[_0xb6d0('0xa')][_0xb6d0('0x3')],'phonebar':0x2};if(_0x4c4026['query']&&_0x4c4026['query'][_0xb6d0('0xb')]){return git[_0xb6d0('0xc')]()[_0xb6d0('0xd')](function(_0x13ac05,_0x433f40){_0x2b1c00[_0xb6d0('0xb')]=(_0x13ac05?module[_0xb6d0('0xa')][_0xb6d0('0x3')]:_0x433f40['latest'])||_0xb6d0('0xe');return _0x4cad15[_0xb6d0('0xf')](0xc8)[_0xb6d0('0x10')](_0x2b1c00);});}else{return _0x4cad15[_0xb6d0('0xf')](0xc8)['json'](_0x2b1c00);}};exports['fetch']=function(_0x4b0454,_0x4de97b){return git[_0xb6d0('0xc')]([_0xb6d0('0x11'),'master'],function(_0x8d2895){if(_0x8d2895){logger[_0xb6d0('0x12')](_0x8d2895);return _0x4de97b[_0xb6d0('0xf')](0x1f4)[_0xb6d0('0x10')](_0x8d2895);}logger[_0xb6d0('0x13')](_0xb6d0('0x14'));return _0x4de97b[_0xb6d0('0xf')](0xc8)[_0xb6d0('0x10')]({'output':_0xb6d0('0x15')});});};exports[_0xb6d0('0x16')]=function(_0x12c57b,_0x4c675f){return git['reset']([_0xb6d0('0x17'),_0xb6d0('0x18')],function(_0x3840ea){if(_0x3840ea){logger[_0xb6d0('0x12')](_0x3840ea);return _0x4c675f[_0xb6d0('0xf')](0x1f4)[_0xb6d0('0x10')](_0x3840ea);}logger[_0xb6d0('0x13')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4c675f['status'](0xc8)[_0xb6d0('0x10')]({'output':_0xb6d0('0x19')});});};exports[_0xb6d0('0x1a')]=function(_0x3f02f6,_0x4f2811){exec(_0xb6d0('0x1b'),function(_0x2dc1be,_0x1b4c20,_0x47b741){logger[_0xb6d0('0x13')](_0x1b4c20);logger['info'](_0x47b741);if(_0x2dc1be){logger['error'](_0x2dc1be);return _0x4f2811['status'](0x1f4)[_0xb6d0('0x10')](_0x2dc1be);}return _0x4f2811['status'](0xc8)[_0xb6d0('0x10')]({'output':_0x1b4c20});});};exports[_0xb6d0('0x1c')]=function(_0x43d8d7,_0x106a57){return pm2['restart'](_0xb6d0('0x1d'))[_0xb6d0('0x1e')](function(_0x2407d9){logger[_0xb6d0('0x13')](_0xb6d0('0x1f'),_0x2407d9);return _0x106a57[_0xb6d0('0xf')](0xc8)[_0xb6d0('0x10')]({'output':_0xb6d0('0x20')});})[_0xb6d0('0x21')](function(_0x26f5b0){logger[_0xb6d0('0x12')](_0x26f5b0);return _0x106a57['status'](0x1f4)[_0xb6d0('0x10')](_0x26f5b0);});};exports[_0xb6d0('0x22')]=function(_0x44acba,_0x5c247d){var _0x5c001f=fs[_0xb6d0('0x23')](path['join'](config['root'],_0xb6d0('0x24'),_0xb6d0('0x22')));var _0x2a87c3=[];for(var _0x2ab48a=0x0;_0x2ab48a<_0x5c001f[_0xb6d0('0x25')];_0x2ab48a++){var _0x30e191=_0x5c001f[_0x2ab48a][_0xb6d0('0x26')](_0xb6d0('0x27'),'');if(compareVersions(module[_0xb6d0('0xa')][_0xb6d0('0x3')],_0x30e191)===-0x1){_0x2a87c3[_0xb6d0('0x28')](_0x30e191);}}if(_0x2a87c3['length']){var _0x56d68d=_0x2a87c3[_0xb6d0('0x29')](compareVersions);var _0x7bf282=new Umzug({'storage':_0xb6d0('0x2a'),'storageOptions':{'model':db[_0xb6d0('0x2b')],'modelName':_0xb6d0('0x2b'),'columnName':_0xb6d0('0x3')},'migrations':{'params':[db[_0xb6d0('0x2a')]['getQueryInterface'](),db['sequelize'][_0xb6d0('0x2c')],function(){throw new Error(_0xb6d0('0x2d'));}],'path':path[_0xb6d0('0x2e')](config[_0xb6d0('0x9')],_0xb6d0('0x24'),_0xb6d0('0x22')),'pattern':/\.js$/}});_0x7bf282['up']({'migrations':_[_0xb6d0('0x2f')](_0x56d68d,function(_0x14efd5){return _0x14efd5+'.js';})})[_0xb6d0('0x1e')](function(){return _0x5c247d[_0xb6d0('0xf')](0xc8)['json']({'output':_0xb6d0('0x30')+module[_0xb6d0('0xa')][_0xb6d0('0x3')]+_0xb6d0('0x31')+_[_0xb6d0('0x32')](_0x56d68d),'migrations':_[_0xb6d0('0x2e')](_0x56d68d)});})[_0xb6d0('0x21')](function(_0x31d8a8){if(_0x31d8a8 instanceof db[_0xb6d0('0x2a')]['UniqueConstraintError']){return _0x5c247d[_0xb6d0('0xf')](0xc8)[_0xb6d0('0x10')]({'output':_0xb6d0('0x33')});}else{return _0x5c247d[_0xb6d0('0xf')](0x1f4)['json'](_0x31d8a8);}});}else{return _0x5c247d['status'](0xc8)['json']({'output':_0xb6d0('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3878a35..d7b5f96 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 _0x0b3d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','destroy','util','path','connect-timeout'];(function(_0xfcde60,_0x32c1d6){var _0xa6fed2=function(_0x1410d3){while(--_0x1410d3){_0xfcde60['push'](_0xfcde60['shift']());}};_0xa6fed2(++_0x32c1d6);}(_0x0b3d,0x95));var _0xd0b3=function(_0x5673c6,_0xc302ec){_0x5673c6=_0x5673c6-0x0;var _0x130bd9=_0x0b3d[_0x5673c6];return _0x130bd9;};'use strict';var multer=require('multer');var util=require(_0xd0b3('0x0'));var path=require(_0xd0b3('0x1'));var timeout=require(_0xd0b3('0x2'));var express=require(_0xd0b3('0x3'));var router=express[_0xd0b3('0x4')]();var fs_extra=require(_0xd0b3('0x5'));var auth=require(_0xd0b3('0x6'));var interaction=require(_0xd0b3('0x7'));var config=require('../../config/environment');var controller=require(_0xd0b3('0x8'));router[_0xd0b3('0x9')]('/',auth[_0xd0b3('0xa')](),controller[_0xd0b3('0xb')]);router['get'](_0xd0b3('0xc'),auth[_0xd0b3('0xa')](),controller[_0xd0b3('0xd')]);router[_0xd0b3('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd0b3('0xe')]('/',auth[_0xd0b3('0xa')](),controller[_0xd0b3('0xf')]);router[_0xd0b3('0x10')](_0xd0b3('0x11'),auth[_0xd0b3('0xa')](),controller['update']);router['delete'](_0xd0b3('0x11'),auth['isAuthenticated'](),controller[_0xd0b3('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb94f=['index','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb94f,0xab));var _0xfb94=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0xb94f[_0x422ac3];return _0x53c0d4;};'use strict';var multer=require(_0xfb94('0x0'));var util=require(_0xfb94('0x1'));var path=require(_0xfb94('0x2'));var timeout=require(_0xfb94('0x3'));var express=require(_0xfb94('0x4'));var router=express[_0xfb94('0x5')]();var fs_extra=require(_0xfb94('0x6'));var auth=require(_0xfb94('0x7'));var interaction=require(_0xfb94('0x8'));var config=require(_0xfb94('0x9'));var controller=require(_0xfb94('0xa'));router[_0xfb94('0xb')]('/',auth[_0xfb94('0xc')](),controller[_0xfb94('0xd')]);router[_0xfb94('0xb')]('/describe',auth[_0xfb94('0xc')](),controller[_0xfb94('0xe')]);router[_0xfb94('0xb')](_0xfb94('0xf'),auth[_0xfb94('0xc')](),controller['show']);router[_0xfb94('0x10')]('/',auth[_0xfb94('0xc')](),controller[_0xfb94('0x11')]);router[_0xfb94('0x12')](_0xfb94('0xf'),auth[_0xfb94('0xc')](),controller[_0xfb94('0x13')]);router[_0xfb94('0x14')](_0xfb94('0xf'),auth['isAuthenticated'](),controller[_0xfb94('0x15')]);module[_0xfb94('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 8611110..631a828 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 _0x3495=['STRING','DATE','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3495,0x1de));var _0x5349=function(_0x1a8806,_0x19ad56){_0x1a8806=_0x1a8806-0x0;var _0x504e1a=_0x3495[_0x1a8806];return _0x504e1a;};'use strict';var Sequelize=require(_0x5349('0x0'));module[_0x5349('0x1')]={'type':{'type':Sequelize[_0x5349('0x2')]},'uniqueid':{'type':Sequelize[_0x5349('0x2')]},'calleridnum':{'type':Sequelize[_0x5349('0x2')]},'calleridname':{'type':Sequelize[_0x5349('0x2')]},'queue':{'type':Sequelize[_0x5349('0x2')]},'interface':{'type':Sequelize[_0x5349('0x2')]},'membername':{'type':Sequelize[_0x5349('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x5349('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x5349('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x5349('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x5349('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5349('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x5349('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5349('0x5')]},'reason':{'type':Sequelize[_0x5349('0x2')]},'lastevent':{'type':Sequelize[_0x5349('0x2')]},'channel':{'type':Sequelize[_0x5349('0x2')]},'channelstate':{'type':Sequelize[_0x5349('0x5')]},'channelstatedesc':{'type':Sequelize[_0x5349('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5349('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5349('0x2')]},'context':{'type':Sequelize[_0x5349('0x2')]},'exten':{'type':Sequelize[_0x5349('0x2')]},'priority':{'type':Sequelize[_0x5349('0x2')]},'destchannel':{'type':Sequelize[_0x5349('0x2')]},'destchannelstate':{'type':Sequelize[_0x5349('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x5349('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5349('0x2')]},'destcalleridname':{'type':Sequelize[_0x5349('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5349('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5349('0x2')]},'destaccountcode':{'type':Sequelize[_0x5349('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5349('0x2')]},'destpriority':{'type':Sequelize[_0x5349('0x2')]},'destuniqueid':{'type':Sequelize[_0x5349('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5349('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x5349('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x5349('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x93e6=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x46855e,_0x11a634){var _0x1a9bd5=function(_0x5159e3){while(--_0x5159e3){_0x46855e['push'](_0x46855e['shift']());}};_0x1a9bd5(++_0x11a634);}(_0x93e6,0x11e));var _0x693e=function(_0x55cf9d,_0x2795b3){_0x55cf9d=_0x55cf9d-0x0;var _0x2fd425=_0x93e6[_0x55cf9d];return _0x2fd425;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x693e('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x693e('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x693e('0x1')]},'membername':{'type':Sequelize[_0x693e('0x1')]},'agentcalledAt':{'type':Sequelize[_0x693e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x693e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x693e('0x2')]},'agentdumpAt':{'type':Sequelize[_0x693e('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x693e('0x4')]},'reason':{'type':Sequelize[_0x693e('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x693e('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x693e('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x693e('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x693e('0x1')]},'exten':{'type':Sequelize[_0x693e('0x1')]},'priority':{'type':Sequelize[_0x693e('0x1')]},'destchannel':{'type':Sequelize[_0x693e('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x693e('0x1')]},'destcalleridnum':{'type':Sequelize[_0x693e('0x1')]},'destcalleridname':{'type':Sequelize[_0x693e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x693e('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x693e('0x1')]},'destlanguage':{'type':Sequelize[_0x693e('0x1')]},'destaccountcode':{'type':Sequelize[_0x693e('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x693e('0x1')]},'destpriority':{'type':Sequelize[_0x693e('0x1')]},'destuniqueid':{'type':Sequelize[_0x693e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x693e('0x1')]},'transfer':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x693e('0x1')],'comment':_0x693e('0x5')},'transferexten':{'type':Sequelize[_0x693e('0x1')]},'transferuniqueid':{'type':Sequelize[_0x693e('0x1')]},'agententerreason':{'type':Sequelize[_0x693e('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 18c6428..8e81ebf 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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 fe5c002..d7688ed 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 _0x6bdc=['define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1e65d2,_0x202fab){var _0x5953a3=function(_0x5676cc){while(--_0x5676cc){_0x1e65d2['push'](_0x1e65d2['shift']());}};_0x5953a3(++_0x202fab);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x4ebfac,_0x42be63){_0x4ebfac=_0x4ebfac-0x0;var _0x42ad58=_0x6bdc[_0x4ebfac];return _0x42ad58;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require(_0xc6bd('0x7'));var rimraf=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var attributes=require('./voiceAgentReport.attributes');module[_0xc6bd('0xa')]=function(_0x26218a,_0x158271){return _0x26218a[_0xc6bd('0xb')](_0xc6bd('0xc'),attributes,{'tableName':_0xc6bd('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc6bd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca9e=['VoiceAgentReport','report_agent','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0xca9e,0x136));var _0xeca9=function(_0xa7b3f0,_0xc550e){_0xa7b3f0=_0xa7b3f0-0x0;var _0x463ece=_0xca9e[_0xa7b3f0];return _0x463ece;};'use strict';var _=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var logger=require(_0xeca9('0x2'))(_0xeca9('0x3'));var moment=require(_0xeca9('0x4'));var BPromise=require(_0xeca9('0x5'));var rp=require(_0xeca9('0x6'));var fs=require('fs');var path=require(_0xeca9('0x7'));var rimraf=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var attributes=require(_0xeca9('0xa'));module[_0xeca9('0xb')]=function(_0x186a47,_0x305dc5){return _0x186a47['define'](_0xeca9('0xc'),attributes,{'tableName':_0xeca9('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 486362c..f8d0ba9 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 _0xeaea=['attributes','limit','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','VoiceAgentReport','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaea,0x142));var _0xaeae=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xeaea[_0x4ae829];return _0x256b31;};'use strict';var _=require('lodash');var util=require(_0xaeae('0x0'));var moment=require(_0xaeae('0x1'));var BPromise=require(_0xaeae('0x2'));var rs=require(_0xaeae('0x3'));var fs=require('fs');var Redis=require(_0xaeae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaeae('0x5'));var logger=require(_0xaeae('0x6'))(_0xaeae('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaeae('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b4c57,_0x28bc8e,_0x4a7e3e){return new BPromise(function(_0x488f15,_0x3c3a6d){return client['request'](_0x4b4c57,_0x4a7e3e)[_0xaeae('0x9')](function(_0x5b0a9e){logger[_0xaeae('0xa')](_0xaeae('0xb'),_0x28bc8e,_0xaeae('0xc'));logger[_0xaeae('0xd')](_0xaeae('0xe'),_0x28bc8e,'request\x20sent',JSON['stringify'](_0x5b0a9e));if(_0x5b0a9e[_0xaeae('0xf')]){if(_0x5b0a9e[_0xaeae('0xf')][_0xaeae('0x10')]===0x1f4){logger[_0xaeae('0xf')](_0xaeae('0xb'),_0x28bc8e,_0x5b0a9e[_0xaeae('0xf')][_0xaeae('0x11')]);return _0x3c3a6d(_0x5b0a9e[_0xaeae('0xf')][_0xaeae('0x11')]);}logger[_0xaeae('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x28bc8e,_0x5b0a9e[_0xaeae('0xf')][_0xaeae('0x11')]);return _0x488f15(_0x5b0a9e['error'][_0xaeae('0x11')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x28bc8e,'request\x20sent');_0x488f15(_0x5b0a9e['result'][_0xaeae('0x11')]);}})[_0xaeae('0x12')](function(_0x1a8406){logger[_0xaeae('0xf')](_0xaeae('0xb'),_0x28bc8e,_0x1a8406);_0x3c3a6d(_0x1a8406);});});}exports['CreateVoiceAgentReport']=function(_0x314366){var _0x1785d0=this;return new Promise(function(_0x1c9013,_0x11aa8d){return db[_0xaeae('0x13')]['create'](_0x314366['body'],{'raw':_0x314366[_0xaeae('0x14')]?_0x314366[_0xaeae('0x14')][_0xaeae('0x15')]===undefined?!![]:![]:!![]})[_0xaeae('0x9')](function(_0x2202e1){logger[_0xaeae('0xa')]('CreateVoiceAgentReport',_0x314366);logger[_0xaeae('0xd')](_0xaeae('0x16'),_0x314366,JSON['stringify'](_0x2202e1));_0x1c9013(_0x2202e1);})[_0xaeae('0x12')](function(_0xe8d559){logger[_0xaeae('0xf')]('CreateVoiceAgentReport',_0xe8d559[_0xaeae('0x11')],_0x314366);_0x11aa8d(_0x1785d0[_0xaeae('0xf')](0x1f4,_0xe8d559[_0xaeae('0x11')]));});});};exports[_0xaeae('0x17')]=function(_0x605182){var _0x12fdc7=this;return new Promise(function(_0x5b5143,_0x45665c){return db[_0xaeae('0x13')][_0xaeae('0x18')](_0x605182['body'],{'raw':_0x605182[_0xaeae('0x14')]?_0x605182[_0xaeae('0x14')][_0xaeae('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x605182['options']?_0x605182['options'][_0xaeae('0x19')]||null:null,'attributes':_0x605182[_0xaeae('0x14')]?_0x605182[_0xaeae('0x14')][_0xaeae('0x1a')]||null:null,'limit':_0x605182[_0xaeae('0x14')]?_0x605182[_0xaeae('0x14')][_0xaeae('0x1b')]||null:null})['then'](function(_0x39c589){logger['info'](_0xaeae('0x17'),_0x605182);logger[_0xaeae('0xd')](_0xaeae('0x17'),_0x605182,JSON[_0xaeae('0x1c')](_0x39c589));_0x5b5143(_0x39c589);})[_0xaeae('0x12')](function(_0x4391ba){logger['error'](_0xaeae('0x17'),_0x4391ba[_0xaeae('0x11')],_0x605182);_0x45665c(_0x12fdc7[_0xaeae('0xf')](0x1f4,_0x4391ba[_0xaeae('0x11')]));});});}; \ No newline at end of file +var _0x0c28=['info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceAgentReport,\x20%s,\x20%s','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x0c28,0x1a1));var _0x80c2=function(_0x10f365,_0x30e803){_0x10f365=_0x10f365-0x0;var _0x790308=_0x0c28[_0x10f365];return _0x790308;};'use strict';var _=require(_0x80c2('0x0'));var util=require(_0x80c2('0x1'));var moment=require(_0x80c2('0x2'));var BPromise=require(_0x80c2('0x3'));var rs=require(_0x80c2('0x4'));var fs=require('fs');var Redis=require(_0x80c2('0x5'));var db=require(_0x80c2('0x6'))['db'];var utils=require(_0x80c2('0x7'));var logger=require(_0x80c2('0x8'))(_0x80c2('0x9'));var config=require('../../config/environment');var jayson=require(_0x80c2('0xa'));var client=jayson[_0x80c2('0xb')][_0x80c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x250c33,_0x4fac7e,_0x117dc2){return new BPromise(function(_0x5eb54f,_0x4742bb){return client[_0x80c2('0xd')](_0x250c33,_0x117dc2)[_0x80c2('0xe')](function(_0x37d0fd){logger[_0x80c2('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x4fac7e,_0x80c2('0x10'));logger[_0x80c2('0x11')](_0x80c2('0x12'),_0x4fac7e,'request\x20sent',JSON[_0x80c2('0x13')](_0x37d0fd));if(_0x37d0fd['error']){if(_0x37d0fd[_0x80c2('0x14')][_0x80c2('0x15')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x4fac7e,_0x37d0fd[_0x80c2('0x14')][_0x80c2('0x16')]);return _0x4742bb(_0x37d0fd[_0x80c2('0x14')][_0x80c2('0x16')]);}logger[_0x80c2('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x4fac7e,_0x37d0fd[_0x80c2('0x14')][_0x80c2('0x16')]);return _0x5eb54f(_0x37d0fd[_0x80c2('0x14')][_0x80c2('0x16')]);}else{logger[_0x80c2('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x4fac7e,'request\x20sent');_0x5eb54f(_0x37d0fd[_0x80c2('0x17')][_0x80c2('0x16')]);}})[_0x80c2('0x18')](function(_0xa27468){logger[_0x80c2('0x14')](_0x80c2('0x19'),_0x4fac7e,_0xa27468);_0x4742bb(_0xa27468);});});}exports[_0x80c2('0x1a')]=function(_0x125010){var _0x3edbc0=this;return new Promise(function(_0x12348b,_0x4ed9bd){return db[_0x80c2('0x1b')][_0x80c2('0x1c')](_0x125010['body'],{'raw':_0x125010[_0x80c2('0x1d')]?_0x125010[_0x80c2('0x1d')][_0x80c2('0x1e')]===undefined?!![]:![]:!![]})[_0x80c2('0xe')](function(_0x5ecae1){logger[_0x80c2('0xf')]('CreateVoiceAgentReport',_0x125010);logger[_0x80c2('0x11')](_0x80c2('0x1a'),_0x125010,JSON[_0x80c2('0x13')](_0x5ecae1));_0x12348b(_0x5ecae1);})[_0x80c2('0x18')](function(_0x18789e){logger['error'](_0x80c2('0x1a'),_0x18789e[_0x80c2('0x16')],_0x125010);_0x4ed9bd(_0x3edbc0[_0x80c2('0x14')](0x1f4,_0x18789e[_0x80c2('0x16')]));});});};exports[_0x80c2('0x1f')]=function(_0x1294a8){var _0x3e3013=this;return new Promise(function(_0x13633e,_0x1e9d7f){return db[_0x80c2('0x1b')][_0x80c2('0x20')](_0x1294a8[_0x80c2('0x21')],{'raw':_0x1294a8[_0x80c2('0x1d')]?_0x1294a8[_0x80c2('0x1d')][_0x80c2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1294a8[_0x80c2('0x1d')]?_0x1294a8['options'][_0x80c2('0x22')]||null:null,'attributes':_0x1294a8[_0x80c2('0x1d')]?_0x1294a8[_0x80c2('0x1d')][_0x80c2('0x23')]||null:null,'limit':_0x1294a8[_0x80c2('0x1d')]?_0x1294a8[_0x80c2('0x1d')]['limit']||null:null})[_0x80c2('0xe')](function(_0x9afe72){logger['info'](_0x80c2('0x1f'),_0x1294a8);logger[_0x80c2('0x11')](_0x80c2('0x1f'),_0x1294a8,JSON['stringify'](_0x9afe72));_0x13633e(_0x9afe72);})[_0x80c2('0x18')](function(_0x5eb645){logger[_0x80c2('0x14')](_0x80c2('0x1f'),_0x5eb645['message'],_0x1294a8);_0x1e9d7f(_0x3e3013[_0x80c2('0x14')](0x1f4,_0x5eb645[_0x80c2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 0eeb294..702a414 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 _0xa41a=['/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','describe'];(function(_0x486c33,_0x32a769){var _0x1acbf3=function(_0x16e7f5){while(--_0x16e7f5){_0x486c33['push'](_0x486c33['shift']());}};_0x1acbf3(++_0x32a769);}(_0xa41a,0x6b));var _0xaa41=function(_0x3cf4f3,_0x39da01){_0x3cf4f3=_0x3cf4f3-0x0;var _0x56b557=_0xa41a[_0x3cf4f3];return _0x56b557;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/describe',auth[_0xaa41('0xa')](),controller[_0xaa41('0xc')]);router['get'](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xf')]('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);router[_0xaa41('0x11')](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller['update']);router[_0xaa41('0x12')](_0xaa41('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa41('0x13')]=router; \ No newline at end of file +var _0x885a=['describe','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe'];(function(_0x3e2040,_0x660381){var _0x38e3ec=function(_0x2e61bd){while(--_0x2e61bd){_0x3e2040['push'](_0x3e2040['shift']());}};_0x38e3ec(++_0x660381);}(_0x885a,0x180));var _0xa885=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x885a[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0xa885('0x0'));var path=require(_0xa885('0x1'));var timeout=require(_0xa885('0x2'));var express=require(_0xa885('0x3'));var router=express['Router']();var fs_extra=require(_0xa885('0x4'));var auth=require(_0xa885('0x5'));var interaction=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var controller=require(_0xa885('0x8'));router[_0xa885('0x9')]('/',auth['isAuthenticated'](),controller[_0xa885('0xa')]);router[_0xa885('0x9')](_0xa885('0xb'),auth['isAuthenticated'](),controller[_0xa885('0xc')]);router[_0xa885('0x9')](_0xa885('0xd'),auth['isAuthenticated'](),controller[_0xa885('0xe')]);router[_0xa885('0xf')]('/',auth[_0xa885('0x10')](),controller[_0xa885('0x11')]);router[_0xa885('0x12')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller['update']);router[_0xa885('0x13')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller[_0xa885('0x14')]);module[_0xa885('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0d3384d..a1ef187 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 _0x4cdf=['exports','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0x4cdf,0x180));var _0xf4cd=function(_0x4cfde6,_0x1654be){_0x4cfde6=_0x4cfde6-0x0;var _0x45f311=_0x4cdf[_0x4cfde6];return _0x45f311;};'use strict';var Sequelize=require(_0xf4cd('0x0'));module[_0xf4cd('0x1')]={'uniqueid':{'type':Sequelize[_0xf4cd('0x2')]},'type':{'type':Sequelize[_0xf4cd('0x3')](_0xf4cd('0x4'),_0xf4cd('0x5'),'outbound',_0xf4cd('0x6'),_0xf4cd('0x7'),'dialer')},'tag':{'type':Sequelize[_0xf4cd('0x2')]},'accountcode':{'type':Sequelize[_0xf4cd('0x2')]},'source':{'type':Sequelize[_0xf4cd('0x2')]},'destination':{'type':Sequelize[_0xf4cd('0x2')]},'destinationcontext':{'type':Sequelize[_0xf4cd('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf4cd('0x2')]},'destinationchannel':{'type':Sequelize[_0xf4cd('0x2')]},'lastapplication':{'type':Sequelize[_0xf4cd('0x2')]},'lastdata':{'type':Sequelize[_0xf4cd('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xf4cd('0x9')]},'answertime':{'type':Sequelize[_0xf4cd('0x9')]},'endtime':{'type':Sequelize[_0xf4cd('0x9')]},'duration':{'type':Sequelize[_0xf4cd('0xa')]},'billableseconds':{'type':Sequelize[_0xf4cd('0xa')]},'mohtime':{'type':Sequelize[_0xf4cd('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf4cd('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf4cd('0x2')]},'userDisposition':{'type':Sequelize[_0xf4cd('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xf4cd('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xf4cd('0x2')]},'routeid':{'type':Sequelize[_0xf4cd('0xa')]},'sipcallid':{'type':Sequelize[_0xf4cd('0x2')]}}; \ No newline at end of file +var _0xf482=['STRING','ENUM','inbound','internal','outbound','outbound-fax','dialer','DATE','INTEGER','sequelize','exports'];(function(_0x262737,_0x24f7f5){var _0x352b40=function(_0x48386a){while(--_0x48386a){_0x262737['push'](_0x262737['shift']());}};_0x352b40(++_0x24f7f5);}(_0xf482,0xf0));var _0x2f48=function(_0x522258,_0x168487){_0x522258=_0x522258-0x0;var _0x484b4b=_0xf482[_0x522258];return _0x484b4b;};'use strict';var Sequelize=require(_0x2f48('0x0'));module[_0x2f48('0x1')]={'uniqueid':{'type':Sequelize[_0x2f48('0x2')]},'type':{'type':Sequelize[_0x2f48('0x3')](_0x2f48('0x4'),_0x2f48('0x5'),_0x2f48('0x6'),'inbound-fax',_0x2f48('0x7'),_0x2f48('0x8'))},'tag':{'type':Sequelize[_0x2f48('0x2')]},'accountcode':{'type':Sequelize[_0x2f48('0x2')]},'source':{'type':Sequelize[_0x2f48('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x2f48('0x2')]},'callerid':{'type':Sequelize[_0x2f48('0x2')]},'channel':{'type':Sequelize[_0x2f48('0x2')]},'destinationchannel':{'type':Sequelize[_0x2f48('0x2')]},'lastapplication':{'type':Sequelize[_0x2f48('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x2f48('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2f48('0x9')]},'duration':{'type':Sequelize[_0x2f48('0xa')]},'billableseconds':{'type':Sequelize[_0x2f48('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2f48('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2f48('0x2')]},'userDisposition':{'type':Sequelize[_0x2f48('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2f48('0x2')]},'note':{'type':Sequelize[_0x2f48('0x2')]},'prefix':{'type':Sequelize[_0x2f48('0x2')]},'routeid':{'type':Sequelize[_0x2f48('0xa')]},'sipcallid':{'type':Sequelize[_0x2f48('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e019b14..13f44f6 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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x529472,_0x1ab233){var _0x5704df=function(_0x1e4685){while(--_0x1e4685){_0x529472['push'](_0x529472['shift']());}};_0x5704df(++_0x1ab233);}(_0xb10b,0x12a));var _0xbb10=function(_0x22aabe,_0x1667d4){_0x22aabe=_0x22aabe-0x0;var _0x7ae05=_0xb10b[_0x22aabe];return _0x7ae05;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,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(_0x5592f1,_0x43e135){var _0x50d95a=function(_0x1f3870){while(--_0x1f3870){_0x5592f1['push'](_0x5592f1['shift']());}};_0x50d95a(++_0x43e135);}(_0xdb28,0x106));var _0x8db2=function(_0xd04f76,_0x263a27){_0xd04f76=_0xd04f76-0x0;var _0x46ea61=_0xdb28[_0xd04f76];return _0x46ea61;};'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 bed2fa8..286d1dd 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 _0x9181=['VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x1e1312,_0x33fffa){var _0x1d505c=function(_0x53207f){while(--_0x53207f){_0x1e1312['push'](_0x1e1312['shift']());}};_0x1d505c(++_0x33fffa);}(_0x9181,0x182));var _0x1918=function(_0x4fa482,_0x28d3e9){_0x4fa482=_0x4fa482-0x0;var _0xab1ac=_0x9181[_0x4fa482];return _0xab1ac;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var logger=require(_0x1918('0x2'))(_0x1918('0x3'));var moment=require(_0x1918('0x4'));var BPromise=require('bluebird');var rp=require(_0x1918('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1918('0x6'));var config=require(_0x1918('0x7'));var attributes=require(_0x1918('0x8'));module[_0x1918('0x9')]=function(_0x424951,_0x4106d7){return _0x424951['define'](_0x1918('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x1918('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabae=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','../../config/logger','api','moment'];(function(_0x3ffdfa,_0x5799e6){var _0x498d2f=function(_0x1ae395){while(--_0x1ae395){_0x3ffdfa['push'](_0x3ffdfa['shift']());}};_0x498d2f(++_0x5799e6);}(_0xabae,0x1a1));var _0xeaba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeaba('0x0'))(_0xeaba('0x1'));var moment=require(_0xeaba('0x2'));var BPromise=require(_0xeaba('0x3'));var rp=require(_0xeaba('0x4'));var fs=require('fs');var path=require(_0xeaba('0x5'));var rimraf=require(_0xeaba('0x6'));var config=require(_0xeaba('0x7'));var attributes=require(_0xeaba('0x8'));module[_0xeaba('0x9')]=function(_0xe39f39,_0x37903a){return _0xe39f39['define'](_0xeaba('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xeaba('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index dd1dc62..4597980 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 _0x74ca=['create','body','update','UpdateVoiceCallReport','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport'];(function(_0x45d174,_0x47c6bb){var _0x3a0128=function(_0xdd4c62){while(--_0xdd4c62){_0x45d174['push'](_0x45d174['shift']());}};_0x3a0128(++_0x47c6bb);}(_0x74ca,0xc8));var _0xa74c=function(_0x2947ec,_0x37683e){_0x2947ec=_0x2947ec-0x0;var _0x125153=_0x74ca[_0x2947ec];return _0x125153;};'use strict';var _=require(_0xa74c('0x0'));var util=require('util');var moment=require(_0xa74c('0x1'));var BPromise=require(_0xa74c('0x2'));var rs=require(_0xa74c('0x3'));var fs=require('fs');var Redis=require(_0xa74c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa74c('0x5'))(_0xa74c('0x6'));var config=require(_0xa74c('0x7'));var jayson=require(_0xa74c('0x8'));var client=jayson[_0xa74c('0x9')][_0xa74c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4f50,_0x524c89,_0x59a2e9){return new BPromise(function(_0x368edc,_0x2af5be){return client['request'](_0x4c4f50,_0x59a2e9)[_0xa74c('0xb')](function(_0x4e1fb8){logger[_0xa74c('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x524c89,_0xa74c('0xd'));logger['debug'](_0xa74c('0xe'),_0x524c89,_0xa74c('0xd'),JSON[_0xa74c('0xf')](_0x4e1fb8));if(_0x4e1fb8[_0xa74c('0x10')]){if(_0x4e1fb8[_0xa74c('0x10')][_0xa74c('0x11')]===0x1f4){logger['error'](_0xa74c('0x12'),_0x524c89,_0x4e1fb8['error'][_0xa74c('0x13')]);return _0x2af5be(_0x4e1fb8[_0xa74c('0x10')][_0xa74c('0x13')]);}logger['error'](_0xa74c('0x12'),_0x524c89,_0x4e1fb8[_0xa74c('0x10')][_0xa74c('0x13')]);return _0x368edc(_0x4e1fb8[_0xa74c('0x10')]['message']);}else{logger['info'](_0xa74c('0x12'),_0x524c89,_0xa74c('0xd'));_0x368edc(_0x4e1fb8[_0xa74c('0x14')][_0xa74c('0x13')]);}})[_0xa74c('0x15')](function(_0x1b479b){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x524c89,_0x1b479b);_0x2af5be(_0x1b479b);});});}exports[_0xa74c('0x16')]=function(_0x1570c0){var _0x4ab1a6=this;return new Promise(function(_0x53b655,_0x2b8c1a){return db[_0xa74c('0x17')][_0xa74c('0x18')]({'raw':_0x1570c0[_0xa74c('0x19')]?_0x1570c0[_0xa74c('0x19')][_0xa74c('0x1a')]===undefined?!![]:![]:!![],'where':_0x1570c0[_0xa74c('0x19')]?_0x1570c0[_0xa74c('0x19')][_0xa74c('0x1b')]||null:null,'attributes':_0x1570c0[_0xa74c('0x19')]?_0x1570c0[_0xa74c('0x19')][_0xa74c('0x1c')]||null:null,'limit':_0x1570c0[_0xa74c('0x19')]?_0x1570c0[_0xa74c('0x19')][_0xa74c('0x1d')]||null:null,'include':_0x1570c0[_0xa74c('0x19')]?_0x1570c0[_0xa74c('0x19')][_0xa74c('0x1e')]?_[_0xa74c('0x1f')](_0x1570c0[_0xa74c('0x19')][_0xa74c('0x1e')],function(_0xca273b){return{'model':db[_0xca273b['model']],'as':_0xca273b['as'],'attributes':_0xca273b['attributes'],'include':_0xca273b[_0xa74c('0x1e')]?_['map'](_0xca273b[_0xa74c('0x1e')],function(_0x5c59dc){return{'model':db[_0x5c59dc['model']],'as':_0x5c59dc['as'],'attributes':_0x5c59dc[_0xa74c('0x1c')],'include':_0x5c59dc[_0xa74c('0x1e')]?_[_0xa74c('0x1f')](_0x5c59dc[_0xa74c('0x1e')],function(_0x21b6d8){return{'model':db[_0x21b6d8[_0xa74c('0x20')]],'as':_0x21b6d8['as'],'attributes':_0x21b6d8[_0xa74c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa74c('0xb')](function(_0x242829){logger[_0xa74c('0xc')](_0xa74c('0x16'),_0x1570c0);logger['debug'](_0xa74c('0x16'),_0x1570c0,JSON[_0xa74c('0xf')](_0x242829));_0x53b655(_0x242829);})[_0xa74c('0x15')](function(_0x4344d7){logger[_0xa74c('0x10')](_0xa74c('0x16'),_0x4344d7[_0xa74c('0x13')],_0x1570c0);_0x2b8c1a(_0x4ab1a6['error'](0x1f4,_0x4344d7[_0xa74c('0x13')]));});});};exports[_0xa74c('0x21')]=function(_0x598dac){var _0x4f0c0c=this;return new Promise(function(_0x1e7a3c,_0x3b41f9){return db[_0xa74c('0x17')][_0xa74c('0x22')](_0x598dac[_0xa74c('0x23')],{'raw':_0x598dac['options']?_0x598dac[_0xa74c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa74c('0xb')](function(_0x57ee1d){logger[_0xa74c('0xc')](_0xa74c('0x21'),_0x598dac);logger['debug'](_0xa74c('0x21'),_0x598dac,JSON[_0xa74c('0xf')](_0x57ee1d));_0x1e7a3c(_0x57ee1d);})['catch'](function(_0x5c0295){logger['error'](_0xa74c('0x21'),_0x5c0295[_0xa74c('0x13')],_0x598dac);_0x3b41f9(_0x4f0c0c['error'](0x1f4,_0x5c0295[_0xa74c('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x3ca99c){var _0x1b350c=this;return new Promise(function(_0x4029ed,_0x5232cf){return db[_0xa74c('0x17')][_0xa74c('0x24')](_0x3ca99c[_0xa74c('0x23')],{'raw':_0x3ca99c[_0xa74c('0x19')]?_0x3ca99c['options'][_0xa74c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ca99c[_0xa74c('0x19')]?_0x3ca99c[_0xa74c('0x19')][_0xa74c('0x1b')]||null:null,'attributes':_0x3ca99c[_0xa74c('0x19')]?_0x3ca99c[_0xa74c('0x19')][_0xa74c('0x1c')]||null:null,'limit':_0x3ca99c['options']?_0x3ca99c[_0xa74c('0x19')][_0xa74c('0x1d')]||null:null})[_0xa74c('0xb')](function(_0x237ea8){logger['info'](_0xa74c('0x25'),_0x3ca99c);logger[_0xa74c('0x26')](_0xa74c('0x25'),_0x3ca99c,JSON[_0xa74c('0xf')](_0x237ea8));_0x4029ed(_0x237ea8);})[_0xa74c('0x15')](function(_0x4c86af){logger[_0xa74c('0x10')](_0xa74c('0x25'),_0x4c86af[_0xa74c('0x13')],_0x3ca99c);_0x5232cf(_0x1b350c[_0xa74c('0x10')](0x1f4,_0x4c86af[_0xa74c('0x13')]));});});}; \ No newline at end of file +var _0x2944=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','map','include','attributes','model','debug','CreateVoiceCallReport','create','body','update','where','UpdateVoiceCallReport'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0x2944,0xbe));var _0x4294=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2944[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x4294('0x0'));var util=require(_0x4294('0x1'));var moment=require(_0x4294('0x2'));var BPromise=require(_0x4294('0x3'));var rs=require(_0x4294('0x4'));var fs=require('fs');var Redis=require(_0x4294('0x5'));var db=require(_0x4294('0x6'))['db'];var utils=require(_0x4294('0x7'));var logger=require(_0x4294('0x8'))('rpc');var config=require(_0x4294('0x9'));var jayson=require(_0x4294('0xa'));var client=jayson['client'][_0x4294('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3464b0,_0x5bdee2,_0x432f09){return new BPromise(function(_0x322f8e,_0x3acd86){return client['request'](_0x3464b0,_0x432f09)[_0x4294('0xc')](function(_0x50c06f){logger['info'](_0x4294('0xd'),_0x5bdee2,_0x4294('0xe'));logger['debug'](_0x4294('0xf'),_0x5bdee2,_0x4294('0xe'),JSON[_0x4294('0x10')](_0x50c06f));if(_0x50c06f[_0x4294('0x11')]){if(_0x50c06f[_0x4294('0x11')][_0x4294('0x12')]===0x1f4){logger[_0x4294('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5bdee2,_0x50c06f[_0x4294('0x11')]['message']);return _0x3acd86(_0x50c06f['error'][_0x4294('0x13')]);}logger[_0x4294('0x11')](_0x4294('0xd'),_0x5bdee2,_0x50c06f[_0x4294('0x11')][_0x4294('0x13')]);return _0x322f8e(_0x50c06f[_0x4294('0x11')][_0x4294('0x13')]);}else{logger[_0x4294('0x14')](_0x4294('0xd'),_0x5bdee2,_0x4294('0xe'));_0x322f8e(_0x50c06f['result'][_0x4294('0x13')]);}})[_0x4294('0x15')](function(_0x478257){logger[_0x4294('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5bdee2,_0x478257);_0x3acd86(_0x478257);});});}exports[_0x4294('0x16')]=function(_0x58e38f){var _0x3c2cd5=this;return new Promise(function(_0x5b15cc,_0x36451c){return db[_0x4294('0x17')][_0x4294('0x18')]({'raw':_0x58e38f[_0x4294('0x19')]?_0x58e38f[_0x4294('0x19')][_0x4294('0x1a')]===undefined?!![]:![]:!![],'where':_0x58e38f[_0x4294('0x19')]?_0x58e38f[_0x4294('0x19')]['where']||null:null,'attributes':_0x58e38f[_0x4294('0x19')]?_0x58e38f['options']['attributes']||null:null,'limit':_0x58e38f[_0x4294('0x19')]?_0x58e38f[_0x4294('0x19')]['limit']||null:null,'include':_0x58e38f[_0x4294('0x19')]?_0x58e38f[_0x4294('0x19')]['include']?_[_0x4294('0x1b')](_0x58e38f['options'][_0x4294('0x1c')],function(_0x5372cf){return{'model':db[_0x5372cf['model']],'as':_0x5372cf['as'],'attributes':_0x5372cf[_0x4294('0x1d')],'include':_0x5372cf['include']?_[_0x4294('0x1b')](_0x5372cf[_0x4294('0x1c')],function(_0x2e055){return{'model':db[_0x2e055[_0x4294('0x1e')]],'as':_0x2e055['as'],'attributes':_0x2e055[_0x4294('0x1d')],'include':_0x2e055['include']?_[_0x4294('0x1b')](_0x2e055['include'],function(_0x21e2e6){return{'model':db[_0x21e2e6['model']],'as':_0x21e2e6['as'],'attributes':_0x21e2e6[_0x4294('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4294('0xc')](function(_0x448061){logger[_0x4294('0x14')](_0x4294('0x16'),_0x58e38f);logger[_0x4294('0x1f')]('GetVoiceCallReport',_0x58e38f,JSON[_0x4294('0x10')](_0x448061));_0x5b15cc(_0x448061);})[_0x4294('0x15')](function(_0xdd5861){logger[_0x4294('0x11')](_0x4294('0x16'),_0xdd5861[_0x4294('0x13')],_0x58e38f);_0x36451c(_0x3c2cd5['error'](0x1f4,_0xdd5861[_0x4294('0x13')]));});});};exports[_0x4294('0x20')]=function(_0x2a597b){var _0x484137=this;return new Promise(function(_0x83f319,_0x1a4904){return db[_0x4294('0x17')][_0x4294('0x21')](_0x2a597b[_0x4294('0x22')],{'raw':_0x2a597b[_0x4294('0x19')]?_0x2a597b[_0x4294('0x19')][_0x4294('0x1a')]===undefined?!![]:![]:!![]})[_0x4294('0xc')](function(_0x2ef556){logger[_0x4294('0x14')](_0x4294('0x20'),_0x2a597b);logger[_0x4294('0x1f')]('CreateVoiceCallReport',_0x2a597b,JSON[_0x4294('0x10')](_0x2ef556));_0x83f319(_0x2ef556);})[_0x4294('0x15')](function(_0x35454a){logger[_0x4294('0x11')](_0x4294('0x20'),_0x35454a[_0x4294('0x13')],_0x2a597b);_0x1a4904(_0x484137[_0x4294('0x11')](0x1f4,_0x35454a[_0x4294('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0xd93caa){var _0x2768f4=this;return new Promise(function(_0x1ef72f,_0x3e1ebb){return db[_0x4294('0x17')][_0x4294('0x23')](_0xd93caa[_0x4294('0x22')],{'raw':_0xd93caa[_0x4294('0x19')]?_0xd93caa[_0x4294('0x19')][_0x4294('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd93caa['options']?_0xd93caa[_0x4294('0x19')][_0x4294('0x24')]||null:null,'attributes':_0xd93caa['options']?_0xd93caa['options'][_0x4294('0x1d')]||null:null,'limit':_0xd93caa[_0x4294('0x19')]?_0xd93caa[_0x4294('0x19')]['limit']||null:null})[_0x4294('0xc')](function(_0x10f593){logger[_0x4294('0x14')]('UpdateVoiceCallReport',_0xd93caa);logger[_0x4294('0x1f')](_0x4294('0x25'),_0xd93caa,JSON[_0x4294('0x10')](_0x10f593));_0x1ef72f(_0x10f593);})[_0x4294('0x15')](function(_0x2730b3){logger[_0x4294('0x11')](_0x4294('0x25'),_0x2730b3[_0x4294('0x13')],_0xd93caa);_0x3e1ebb(_0x2768f4[_0x4294('0x11')](0x1f4,_0x2730b3[_0x4294('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index a72dcaf..bba8700 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 _0x04fa=['create','put','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show'];(function(_0x35c2e7,_0x2c04a3){var _0x36d26d=function(_0x189dfc){while(--_0x189dfc){_0x35c2e7['push'](_0x35c2e7['shift']());}};_0x36d26d(++_0x2c04a3);}(_0x04fa,0x1d7));var _0xa04f=function(_0xd93f72,_0x3b3aa4){_0xd93f72=_0xd93f72-0x0;var _0x4bf11b=_0x04fa[_0xd93f72];return _0x4bf11b;};'use strict';var multer=require(_0xa04f('0x0'));var util=require(_0xa04f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa04f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa04f('0x3'));var interaction=require(_0xa04f('0x4'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0xa04f('0x5')](),controller[_0xa04f('0x6')]);router[_0xa04f('0x7')]('/:id',auth[_0xa04f('0x5')](),controller[_0xa04f('0x8')]);router['post']('/',auth[_0xa04f('0x5')](),controller[_0xa04f('0x9')]);router[_0xa04f('0xa')](_0xa04f('0xb'),auth[_0xa04f('0x5')](),controller[_0xa04f('0xc')]);router[_0xa04f('0xd')]('/:id',auth[_0xa04f('0x5')](),controller[_0xa04f('0xe')]);module[_0xa04f('0xf')]=router; \ No newline at end of file +var _0x5fba=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','index'];(function(_0x6e3eb3,_0x3f9c9d){var _0x2f9944=function(_0x1b39e2){while(--_0x1b39e2){_0x6e3eb3['push'](_0x6e3eb3['shift']());}};_0x2f9944(++_0x3f9c9d);}(_0x5fba,0x99));var _0xa5fb=function(_0xdc28d7,_0x40b27a){_0xdc28d7=_0xdc28d7-0x0;var _0x1d125c=_0x5fba[_0xdc28d7];return _0x1d125c;};'use strict';var multer=require(_0xa5fb('0x0'));var util=require(_0xa5fb('0x1'));var path=require('path');var timeout=require(_0xa5fb('0x2'));var express=require(_0xa5fb('0x3'));var router=express[_0xa5fb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa5fb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa5fb('0x6'));router[_0xa5fb('0x7')]('/',auth['isAuthenticated'](),controller[_0xa5fb('0x8')]);router[_0xa5fb('0x7')](_0xa5fb('0x9'),auth[_0xa5fb('0xa')](),controller[_0xa5fb('0xb')]);router[_0xa5fb('0xc')]('/',auth['isAuthenticated'](),controller[_0xa5fb('0xd')]);router['put'](_0xa5fb('0x9'),auth[_0xa5fb('0xa')](),controller[_0xa5fb('0xe')]);router[_0xa5fb('0xf')](_0xa5fb('0x9'),auth['isAuthenticated'](),controller[_0xa5fb('0x10')]);module[_0xa5fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index e75125e..6461b6e 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 _0x029b=['join','getDataValue','split','BOOLEAN','sequelize','STRING','setDataValue','options'];(function(_0x42f3a6,_0x45285c){var _0xdf3c33=function(_0x5cc2ec){while(--_0x5cc2ec){_0x42f3a6['push'](_0x42f3a6['shift']());}};_0xdf3c33(++_0x45285c);}(_0x029b,0xe4));var _0xb029=function(_0x25a89c,_0x4422ba){_0x25a89c=_0x25a89c-0x0;var _0x176c07=_0x029b[_0x25a89c];return _0x176c07;};'use strict';var Sequelize=require(_0xb029('0x0'));module['exports']={'name':{'type':Sequelize[_0xb029('0x1')]},'prefix':{'type':Sequelize[_0xb029('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xb029('0x1')],'set':function(_0x330af1){this[_0xb029('0x2')](_0xb029('0x3'),_0x330af1?_0x330af1[_0xb029('0x4')](''):[]);},'get':function(){return this[_0xb029('0x5')](_0xb029('0x3'))?this[_0xb029('0x5')]('options')[_0xb029('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb029('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xb029('0x1')]},'record':{'type':Sequelize[_0xb029('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb029('0x1')]},'description':{'type':Sequelize[_0xb029('0x1')]}}; \ No newline at end of file +var _0x92af=['join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','options'];(function(_0x45d290,_0x3fbc9b){var _0x501e8d=function(_0xc16b31){while(--_0xc16b31){_0x45d290['push'](_0x45d290['shift']());}};_0x501e8d(++_0x3fbc9b);}(_0x92af,0x151));var _0xf92a=function(_0x13595d,_0x3629f2){_0x13595d=_0x13595d-0x0;var _0x5b8311=_0x92af[_0x13595d];return _0x5b8311;};'use strict';var Sequelize=require(_0xf92a('0x0'));module[_0xf92a('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xf92a('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xf92a('0x3')],'set':function(_0x3af074){this['setDataValue'](_0xf92a('0x4'),_0x3af074?_0x3af074[_0xf92a('0x5')](''):[]);},'get':function(){return this[_0xf92a('0x6')](_0xf92a('0x4'))?this[_0xf92a('0x6')](_0xf92a('0x4'))[_0xf92a('0x7')](''):[];}},'auth':{'type':Sequelize[_0xf92a('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xf92a('0x3')]},'record':{'type':Sequelize[_0xf92a('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf92a('0x3')]},'description':{'type':Sequelize[_0xf92a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 9de898a..05df1da 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 _0x0269=['to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','type','includeAll','include','show','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','path'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x0269,0x135));var _0x9026=function(_0x58a1cd,_0x39d99d){_0x58a1cd=_0x58a1cd-0x0;var _0x571223=_0x0269[_0x58a1cd];return _0x571223;};'use strict';var emlformat=require(_0x9026('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9026('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9026('0x2'));var moment=require('moment');var BPromise=require(_0x9026('0x3'));var Mustache=require(_0x9026('0x4'));var util=require(_0x9026('0x5'));var path=require(_0x9026('0x6'));var sox=require('sox');var csv=require(_0x9026('0x7'));var ejs=require(_0x9026('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9026('0x9'));var crypto=require(_0x9026('0xa'));var jsforce=require(_0x9026('0xb'));var deskjs=require(_0x9026('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9026('0xd'));var Papa=require(_0x9026('0xe'));var Redis=require(_0x9026('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9026('0x10'));var as=require(_0x9026('0x11'));var hardwareService=require(_0x9026('0x12'));var logger=require('../../config/logger')(_0x9026('0x13'));var utils=require('../../config/utils');var config=require(_0x9026('0x14'));var licenseUtil=require(_0x9026('0x15'));var db=require(_0x9026('0x16'))['db'];function respondWithStatusCode(_0x2148f0,_0x40f526){_0x40f526=_0x40f526||0xcc;return function(_0x40b5dd){if(_0x40b5dd){return _0x2148f0[_0x9026('0x17')](_0x40f526);}return _0x2148f0['status'](_0x40f526)[_0x9026('0x18')]();};}function respondWithResult(_0x4ee699,_0x385afc){_0x385afc=_0x385afc||0xc8;return function(_0x2612cd){if(_0x2612cd){return _0x4ee699[_0x9026('0x19')](_0x385afc)[_0x9026('0x1a')](_0x2612cd);}};}function respondWithFilteredResult(_0x11c0d1,_0x421ee2){return function(_0x142465){if(_0x142465){var _0x1eb679=typeof _0x421ee2['offset']===_0x9026('0x1b')&&typeof _0x421ee2[_0x9026('0x1c')]==='undefined';var _0xc68011=_0x142465[_0x9026('0x1d')];var _0x15b3ab=_0x1eb679?0x0:_0x421ee2[_0x9026('0x1e')];var _0x1d1613=_0x1eb679?_0x142465[_0x9026('0x1d')]:_0x421ee2[_0x9026('0x1e')]+_0x421ee2[_0x9026('0x1c')];var _0x52edf1;if(_0x1d1613>=_0xc68011){_0x1d1613=_0xc68011;_0x52edf1=0xc8;}else{_0x52edf1=0xce;}_0x11c0d1[_0x9026('0x19')](_0x52edf1);return _0x11c0d1['set'](_0x9026('0x1f'),_0x15b3ab+'-'+_0x1d1613+'/'+_0xc68011)['json'](_0x142465);}return null;};}function patchUpdates(_0x2a9bf0){return function(_0x1b03af){try{jsonpatch[_0x9026('0x20')](_0x1b03af,_0x2a9bf0,!![]);}catch(_0x22a77c){return BPromise[_0x9026('0x21')](_0x22a77c);}return _0x1b03af[_0x9026('0x22')]();};}function saveUpdates(_0x71a263,_0x39f515){return function(_0x12e0b3){if(_0x12e0b3){return _0x12e0b3['update'](_0x71a263)['then'](function(_0x7b962){return _0x7b962;});}return null;};}function removeEntity(_0x134221,_0x2968fb){return function(_0x82a8e0){if(_0x82a8e0){return _0x82a8e0[_0x9026('0x23')]()[_0x9026('0x24')](function(){var _0x1c8c62=_0x82a8e0[_0x9026('0x25')]({'plain':!![]});var _0x775596=_0x9026('0x26');return db[_0x9026('0x27')][_0x9026('0x23')]({'where':{'type':_0x775596,'resourceId':_0x1c8c62['id']}})[_0x9026('0x24')](function(){return _0x82a8e0;});})[_0x9026('0x24')](function(){_0x134221[_0x9026('0x19')](0xcc)[_0x9026('0x18')]();});}};}function handleEntityNotFound(_0x1f431b,_0x9c5f39){return function(_0x2fae98){if(!_0x2fae98){_0x1f431b['sendStatus'](0x194);}return _0x2fae98;};}function handleError(_0x437f7b,_0x341d4d){_0x341d4d=_0x341d4d||0x1f4;return function(_0x30c988){logger[_0x9026('0x28')](_0x30c988[_0x9026('0x29')]);if(_0x30c988[_0x9026('0x2a')]){delete _0x30c988[_0x9026('0x2a')];}_0x437f7b[_0x9026('0x19')](_0x341d4d)[_0x9026('0x2b')](_0x30c988);};}exports[_0x9026('0x2c')]=function(_0x24fa55,_0x5d2672){var _0x1cf21f={},_0x36d6b1={},_0x3b5bfd={'count':0x0,'rows':[]};var _0x38c383=_[_0x9026('0x2d')](db[_0x9026('0x2e')][_0x9026('0x2f')],function(_0x57baf9){return{'name':_0x57baf9[_0x9026('0x30')],'type':_0x57baf9['type'][_0x9026('0x31')]};});_0x36d6b1[_0x9026('0x32')]=_[_0x9026('0x2d')](_0x38c383,_0x9026('0x2a'));_0x36d6b1[_0x9026('0x33')]=_[_0x9026('0x34')](_0x24fa55['query']);_0x36d6b1[_0x9026('0x35')]=_[_0x9026('0x36')](_0x36d6b1[_0x9026('0x32')],_0x36d6b1[_0x9026('0x33')]);_0x1cf21f['attributes']=_[_0x9026('0x36')](_0x36d6b1[_0x9026('0x32')],qs['fields'](_0x24fa55[_0x9026('0x33')][_0x9026('0x37')]));_0x1cf21f[_0x9026('0x38')]=_0x1cf21f[_0x9026('0x38')][_0x9026('0x39')]?_0x1cf21f[_0x9026('0x38')]:_0x36d6b1[_0x9026('0x32')];if(!_0x24fa55[_0x9026('0x33')]['hasOwnProperty'](_0x9026('0x3a'))){_0x1cf21f[_0x9026('0x1c')]=qs['limit'](_0x24fa55[_0x9026('0x33')][_0x9026('0x1c')]);_0x1cf21f[_0x9026('0x1e')]=qs[_0x9026('0x1e')](_0x24fa55[_0x9026('0x33')][_0x9026('0x1e')]);}_0x1cf21f[_0x9026('0x3b')]=qs[_0x9026('0x3c')](_0x24fa55['query'][_0x9026('0x3c')]);_0x1cf21f[_0x9026('0x3d')]=qs[_0x9026('0x35')](_[_0x9026('0x3e')](_0x24fa55[_0x9026('0x33')],_0x36d6b1[_0x9026('0x35')]),_0x38c383);if(_0x24fa55[_0x9026('0x33')]['filter']){_0x1cf21f[_0x9026('0x3d')]=_['merge'](_0x1cf21f[_0x9026('0x3d')],{'$or':_[_0x9026('0x2d')](_0x38c383,function(_0x3632c3){if(_0x3632c3[_0x9026('0x3f')]!=='VIRTUAL'){var _0x58cce0={};_0x58cce0[_0x3632c3[_0x9026('0x2a')]]={'$like':'%'+_0x24fa55[_0x9026('0x33')]['filter']+'%'};return _0x58cce0;}})});}_0x1cf21f=_['merge']({},_0x1cf21f,_0x24fa55['options']);var _0x18272e={'where':_0x1cf21f[_0x9026('0x3d')]};return db['VoiceChanSpy'][_0x9026('0x1d')](_0x18272e)[_0x9026('0x24')](function(_0x1a77bd){_0x3b5bfd[_0x9026('0x1d')]=_0x1a77bd;if(_0x24fa55[_0x9026('0x33')][_0x9026('0x40')]){_0x1cf21f[_0x9026('0x41')]=[{'all':!![]}];}return db[_0x9026('0x2e')]['findAll'](_0x1cf21f);})[_0x9026('0x24')](function(_0x2ece36){_0x3b5bfd['rows']=_0x2ece36;return _0x3b5bfd;})['then'](respondWithFilteredResult(_0x5d2672,_0x1cf21f))['catch'](handleError(_0x5d2672,null));};exports[_0x9026('0x42')]=function(_0x126046,_0x12ea01){var _0xc90e8b={'raw':![],'where':{'id':_0x126046['params']['id']}},_0xa3f7fe={};_0xa3f7fe[_0x9026('0x32')]=_['keys'](db[_0x9026('0x2e')][_0x9026('0x2f')]);_0xa3f7fe[_0x9026('0x33')]=_[_0x9026('0x34')](_0x126046['query']);_0xa3f7fe['filters']=_[_0x9026('0x36')](_0xa3f7fe[_0x9026('0x32')],_0xa3f7fe[_0x9026('0x33')]);_0xc90e8b[_0x9026('0x38')]=_[_0x9026('0x36')](_0xa3f7fe[_0x9026('0x32')],qs['fields'](_0x126046[_0x9026('0x33')]['fields']));_0xc90e8b[_0x9026('0x38')]=_0xc90e8b[_0x9026('0x38')]['length']?_0xc90e8b[_0x9026('0x38')]:_0xa3f7fe['model'];if(_0x126046[_0x9026('0x33')]['includeAll']){_0xc90e8b[_0x9026('0x41')]=[{'all':!![]}];}_0xc90e8b=_['merge']({},_0xc90e8b,_0x126046['options']);return db[_0x9026('0x2e')][_0x9026('0x43')](_0xc90e8b)[_0x9026('0x24')](handleEntityNotFound(_0x12ea01,null))['then'](respondWithResult(_0x12ea01,null))[_0x9026('0x44')](handleError(_0x12ea01,null));};exports[_0x9026('0x45')]=function(_0x446cd0,_0x442e5a){return db[_0x9026('0x2e')]['create'](_0x446cd0[_0x9026('0x46')],{})[_0x9026('0x24')](function(_0x24c3b1){var _0x19d870=_0x446cd0[_0x9026('0x47')][_0x9026('0x25')]({'plain':!![]});if(!_0x19d870)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19d870[_0x9026('0x48')]==='user'){var _0x2e3025=_0x24c3b1[_0x9026('0x25')]({'plain':!![]});var _0x50d424=_0x9026('0x26');return db[_0x9026('0x49')][_0x9026('0x43')]({'where':{'name':_0x50d424,'userProfileId':_0x19d870[_0x9026('0x4a')]},'raw':!![]})[_0x9026('0x24')](function(_0x271e95){if(_0x271e95&&_0x271e95[_0x9026('0x4b')]===0x0){return db[_0x9026('0x27')][_0x9026('0x45')]({'name':_0x2e3025[_0x9026('0x2a')],'resourceId':_0x2e3025['id'],'type':_0x271e95['name'],'sectionId':_0x271e95['id']},{})[_0x9026('0x24')](function(){return _0x24c3b1;});}else{return _0x24c3b1;}})[_0x9026('0x44')](function(_0x4ad73e){logger[_0x9026('0x28')](_0x9026('0x4c'),_0x4ad73e);throw _0x4ad73e;});}return _0x24c3b1;})[_0x9026('0x24')](respondWithResult(_0x442e5a,0xc9))[_0x9026('0x44')](handleError(_0x442e5a,null));};exports[_0x9026('0x4d')]=function(_0x30591f,_0x5ddb50){if(_0x30591f[_0x9026('0x46')]['id']){delete _0x30591f['body']['id'];}return db[_0x9026('0x2e')][_0x9026('0x43')]({'where':{'id':_0x30591f[_0x9026('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5ddb50,null))['then'](saveUpdates(_0x30591f[_0x9026('0x46')],null))[_0x9026('0x24')](respondWithResult(_0x5ddb50,null))[_0x9026('0x44')](handleError(_0x5ddb50,null));};exports[_0x9026('0x23')]=function(_0x3a4a30,_0x401c11){return db[_0x9026('0x2e')][_0x9026('0x43')]({'where':{'id':_0x3a4a30[_0x9026('0x4e')]['id']}})[_0x9026('0x24')](handleEntityNotFound(_0x401c11,null))['then'](removeEntity(_0x401c11,null))['catch'](handleError(_0x401c11,null));}; \ No newline at end of file +var _0x3451=['ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','VoiceChanSpy','include','findAll','catch','show','params','rawAttributes','length','includeAll','find','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x3afc1a,_0x4b9156){var _0x5ae510=function(_0x30008b){while(--_0x30008b){_0x3afc1a['push'](_0x3afc1a['shift']());}};_0x5ae510(++_0x4b9156);}(_0x3451,0x19a));var _0x1345=function(_0x31ef31,_0x195c49){_0x31ef31=_0x31ef31-0x0;var _0x876cc4=_0x3451[_0x31ef31];return _0x876cc4;};'use strict';var emlformat=require(_0x1345('0x0'));var rimraf=require(_0x1345('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1345('0x2'));var rp=require(_0x1345('0x3'));var moment=require(_0x1345('0x4'));var BPromise=require(_0x1345('0x5'));var Mustache=require(_0x1345('0x6'));var util=require(_0x1345('0x7'));var path=require(_0x1345('0x8'));var sox=require(_0x1345('0x9'));var csv=require(_0x1345('0xa'));var ejs=require(_0x1345('0xb'));var fs=require('fs');var fs_extra=require(_0x1345('0xc'));var _=require(_0x1345('0xd'));var squel=require('squel');var crypto=require(_0x1345('0xe'));var jsforce=require(_0x1345('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1345('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1345('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1345('0x11'));var as=require(_0x1345('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1345('0x13'));var utils=require('../../config/utils');var config=require(_0x1345('0x14'));var licenseUtil=require(_0x1345('0x15'));var db=require(_0x1345('0x16'))['db'];function respondWithStatusCode(_0x3e1362,_0x528692){_0x528692=_0x528692||0xcc;return function(_0x3fdff0){if(_0x3fdff0){return _0x3e1362[_0x1345('0x17')](_0x528692);}return _0x3e1362[_0x1345('0x18')](_0x528692)[_0x1345('0x19')]();};}function respondWithResult(_0x4ea08a,_0x181a2b){_0x181a2b=_0x181a2b||0xc8;return function(_0x426e00){if(_0x426e00){return _0x4ea08a[_0x1345('0x18')](_0x181a2b)[_0x1345('0x1a')](_0x426e00);}};}function respondWithFilteredResult(_0x347591,_0x959544){return function(_0x3cd49e){if(_0x3cd49e){var _0x520e6c=typeof _0x959544[_0x1345('0x1b')]===_0x1345('0x1c')&&typeof _0x959544[_0x1345('0x1d')]==='undefined';var _0x5b4d04=_0x3cd49e[_0x1345('0x1e')];var _0x1afc89=_0x520e6c?0x0:_0x959544[_0x1345('0x1b')];var _0x1db636=_0x520e6c?_0x3cd49e['count']:_0x959544[_0x1345('0x1b')]+_0x959544[_0x1345('0x1d')];var _0x1f3746;if(_0x1db636>=_0x5b4d04){_0x1db636=_0x5b4d04;_0x1f3746=0xc8;}else{_0x1f3746=0xce;}_0x347591[_0x1345('0x18')](_0x1f3746);return _0x347591[_0x1345('0x1f')](_0x1345('0x20'),_0x1afc89+'-'+_0x1db636+'/'+_0x5b4d04)[_0x1345('0x1a')](_0x3cd49e);}return null;};}function patchUpdates(_0x43d209){return function(_0x3bc681){try{jsonpatch[_0x1345('0x21')](_0x3bc681,_0x43d209,!![]);}catch(_0x265ea8){return BPromise['reject'](_0x265ea8);}return _0x3bc681[_0x1345('0x22')]();};}function saveUpdates(_0x4855d7,_0xaf6ecc){return function(_0x217712){if(_0x217712){return _0x217712[_0x1345('0x23')](_0x4855d7)[_0x1345('0x24')](function(_0x422dd9){return _0x422dd9;});}return null;};}function removeEntity(_0x2fd7ca,_0x26c2a6){return function(_0x339ea9){if(_0x339ea9){return _0x339ea9[_0x1345('0x25')]()[_0x1345('0x24')](function(){var _0x39a950=_0x339ea9['get']({'plain':!![]});var _0x346054='ChanSpies';return db[_0x1345('0x26')][_0x1345('0x25')]({'where':{'type':_0x346054,'resourceId':_0x39a950['id']}})[_0x1345('0x24')](function(){return _0x339ea9;});})[_0x1345('0x24')](function(){_0x2fd7ca[_0x1345('0x18')](0xcc)[_0x1345('0x19')]();});}};}function handleEntityNotFound(_0x3b891c,_0x25b564){return function(_0x3dcf6c){if(!_0x3dcf6c){_0x3b891c[_0x1345('0x17')](0x194);}return _0x3dcf6c;};}function handleError(_0x3d06b5,_0x2817f0){_0x2817f0=_0x2817f0||0x1f4;return function(_0x483e75){logger[_0x1345('0x27')](_0x483e75['stack']);if(_0x483e75['name']){delete _0x483e75[_0x1345('0x28')];}_0x3d06b5[_0x1345('0x18')](_0x2817f0)[_0x1345('0x29')](_0x483e75);};}exports[_0x1345('0x2a')]=function(_0x44bbba,_0x51425d){var _0x389e94={},_0x2b2be4={},_0x96c944={'count':0x0,'rows':[]};var _0x49d8e8=_[_0x1345('0x2b')](db['VoiceChanSpy']['rawAttributes'],function(_0xee1b74){return{'name':_0xee1b74[_0x1345('0x2c')],'type':_0xee1b74[_0x1345('0x2d')][_0x1345('0x2e')]};});_0x2b2be4['model']=_[_0x1345('0x2b')](_0x49d8e8,_0x1345('0x28'));_0x2b2be4[_0x1345('0x2f')]=_[_0x1345('0x30')](_0x44bbba[_0x1345('0x2f')]);_0x2b2be4[_0x1345('0x31')]=_[_0x1345('0x32')](_0x2b2be4[_0x1345('0x33')],_0x2b2be4[_0x1345('0x2f')]);_0x389e94[_0x1345('0x34')]=_[_0x1345('0x32')](_0x2b2be4['model'],qs[_0x1345('0x35')](_0x44bbba[_0x1345('0x2f')][_0x1345('0x35')]));_0x389e94[_0x1345('0x34')]=_0x389e94[_0x1345('0x34')]['length']?_0x389e94[_0x1345('0x34')]:_0x2b2be4['model'];if(!_0x44bbba['query'][_0x1345('0x36')](_0x1345('0x37'))){_0x389e94[_0x1345('0x1d')]=qs['limit'](_0x44bbba[_0x1345('0x2f')][_0x1345('0x1d')]);_0x389e94[_0x1345('0x1b')]=qs[_0x1345('0x1b')](_0x44bbba[_0x1345('0x2f')][_0x1345('0x1b')]);}_0x389e94[_0x1345('0x38')]=qs['sort'](_0x44bbba['query']['sort']);_0x389e94['where']=qs['filters'](_[_0x1345('0x39')](_0x44bbba[_0x1345('0x2f')],_0x2b2be4[_0x1345('0x31')]),_0x49d8e8);if(_0x44bbba[_0x1345('0x2f')][_0x1345('0x3a')]){_0x389e94['where']=_['merge'](_0x389e94[_0x1345('0x3b')],{'$or':_[_0x1345('0x2b')](_0x49d8e8,function(_0x14ee7c){if(_0x14ee7c[_0x1345('0x2d')]!==_0x1345('0x3c')){var _0x1eae93={};_0x1eae93[_0x14ee7c['name']]={'$like':'%'+_0x44bbba[_0x1345('0x2f')][_0x1345('0x3a')]+'%'};return _0x1eae93;}})});}_0x389e94=_[_0x1345('0x3d')]({},_0x389e94,_0x44bbba[_0x1345('0x3e')]);var _0x521cdf={'where':_0x389e94[_0x1345('0x3b')]};return db[_0x1345('0x3f')][_0x1345('0x1e')](_0x521cdf)['then'](function(_0x10f67b){_0x96c944[_0x1345('0x1e')]=_0x10f67b;if(_0x44bbba[_0x1345('0x2f')]['includeAll']){_0x389e94[_0x1345('0x40')]=[{'all':!![]}];}return db[_0x1345('0x3f')][_0x1345('0x41')](_0x389e94);})[_0x1345('0x24')](function(_0x3bbc86){_0x96c944['rows']=_0x3bbc86;return _0x96c944;})[_0x1345('0x24')](respondWithFilteredResult(_0x51425d,_0x389e94))[_0x1345('0x42')](handleError(_0x51425d,null));};exports[_0x1345('0x43')]=function(_0x1c23df,_0x4f2d65){var _0x183132={'raw':![],'where':{'id':_0x1c23df[_0x1345('0x44')]['id']}},_0x2f128c={};_0x2f128c[_0x1345('0x33')]=_[_0x1345('0x30')](db[_0x1345('0x3f')][_0x1345('0x45')]);_0x2f128c[_0x1345('0x2f')]=_[_0x1345('0x30')](_0x1c23df[_0x1345('0x2f')]);_0x2f128c[_0x1345('0x31')]=_[_0x1345('0x32')](_0x2f128c[_0x1345('0x33')],_0x2f128c[_0x1345('0x2f')]);_0x183132[_0x1345('0x34')]=_[_0x1345('0x32')](_0x2f128c['model'],qs[_0x1345('0x35')](_0x1c23df[_0x1345('0x2f')][_0x1345('0x35')]));_0x183132[_0x1345('0x34')]=_0x183132[_0x1345('0x34')][_0x1345('0x46')]?_0x183132[_0x1345('0x34')]:_0x2f128c[_0x1345('0x33')];if(_0x1c23df[_0x1345('0x2f')][_0x1345('0x47')]){_0x183132[_0x1345('0x40')]=[{'all':!![]}];}_0x183132=_[_0x1345('0x3d')]({},_0x183132,_0x1c23df[_0x1345('0x3e')]);return db['VoiceChanSpy'][_0x1345('0x48')](_0x183132)['then'](handleEntityNotFound(_0x4f2d65,null))[_0x1345('0x24')](respondWithResult(_0x4f2d65,null))[_0x1345('0x42')](handleError(_0x4f2d65,null));};exports['create']=function(_0x49b8fc,_0x27fc27){return db[_0x1345('0x3f')]['create'](_0x49b8fc['body'],{})['then'](function(_0x379a98){var _0x3f336e=_0x49b8fc['user'][_0x1345('0x49')]({'plain':!![]});if(!_0x3f336e)throw new Error(_0x1345('0x4a'));if(_0x3f336e['role']===_0x1345('0x4b')){var _0x4ce41d=_0x379a98[_0x1345('0x49')]({'plain':!![]});var _0x5aab90=_0x1345('0x4c');return db[_0x1345('0x4d')]['find']({'where':{'name':_0x5aab90,'userProfileId':_0x3f336e[_0x1345('0x4e')]},'raw':!![]})[_0x1345('0x24')](function(_0x49fda2){if(_0x49fda2&&_0x49fda2['autoAssociation']===0x0){return db[_0x1345('0x26')]['create']({'name':_0x4ce41d[_0x1345('0x28')],'resourceId':_0x4ce41d['id'],'type':_0x49fda2[_0x1345('0x28')],'sectionId':_0x49fda2['id']},{})[_0x1345('0x24')](function(){return _0x379a98;});}else{return _0x379a98;}})['catch'](function(_0x5d6526){logger['error'](_0x1345('0x4f'),_0x5d6526);throw _0x5d6526;});}return _0x379a98;})[_0x1345('0x24')](respondWithResult(_0x27fc27,0xc9))[_0x1345('0x42')](handleError(_0x27fc27,null));};exports[_0x1345('0x23')]=function(_0x52db68,_0x257009){if(_0x52db68['body']['id']){delete _0x52db68[_0x1345('0x50')]['id'];}return db[_0x1345('0x3f')][_0x1345('0x48')]({'where':{'id':_0x52db68[_0x1345('0x44')]['id']}})[_0x1345('0x24')](handleEntityNotFound(_0x257009,null))[_0x1345('0x24')](saveUpdates(_0x52db68[_0x1345('0x50')],null))[_0x1345('0x24')](respondWithResult(_0x257009,null))[_0x1345('0x42')](handleError(_0x257009,null));};exports[_0x1345('0x25')]=function(_0x5e7b35,_0x37201e){return db[_0x1345('0x3f')][_0x1345('0x48')]({'where':{'id':_0x5e7b35[_0x1345('0x44')]['id']}})[_0x1345('0x24')](handleEntityNotFound(_0x37201e,null))[_0x1345('0x24')](removeEntity(_0x37201e,null))[_0x1345('0x42')](handleError(_0x37201e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e68fdf1..4ab56b8 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 _0x5e4c=['destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','name','join','record','StopMixMonitor','concat','internal','findAll','agent','then','catch','exports','define','VoiceChanSpy','length','VoiceExtension','bulkCreate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e4c,0x18d));var _0xc5e4=function(_0x3fc622,_0x2f5ec1){_0x3fc622=_0x3fc622-0x0;var _0x182fd7=_0x5e4c[_0x3fc622];return _0x182fd7;};'use strict';var _=require(_0xc5e4('0x0'));var util=require(_0xc5e4('0x1'));var BPromise=require(_0xc5e4('0x2'));var attributes=require(_0xc5e4('0x3'));var getUserApplications=function(_0x53f8b8,_0xdf6c1d,_0x177027){var _0x5323d2=0x1;var _0x2e34c2=[];var _0x168dc1={'context':_0xdf6c1d['context']||_0xc5e4('0x4'),'exten':util[_0xc5e4('0x5')](_0xc5e4('0x6'),_0x53f8b8[_0xc5e4('0x7')],_0x177027),'type':_0xc5e4('0x8'),'isApp':![],'ChanSpyId':_0x53f8b8['id'],'UserId':_0xdf6c1d['id']};_0x2e34c2['push'](_[_0xc5e4('0x9')]({'app':_0xc5e4('0xa'),'appdata':util[_0xc5e4('0x5')](_0xc5e4('0xb'),_0xc5e4('0xc')),'priority':_0x5323d2++},_0x168dc1));if(_0x53f8b8['record']){_0x2e34c2[_0xc5e4('0xd')](_['merge']({'app':_0xc5e4('0xe'),'appdata':util[_0xc5e4('0x5')](_0xc5e4('0xf'),_0x53f8b8[_0xc5e4('0x10')]),'priority':_0x5323d2++},_0x168dc1));}if(_0x53f8b8['auth']){_0x2e34c2['push'](_[_0xc5e4('0x9')]({'app':_0xc5e4('0x11'),'appdata':_0x53f8b8[_0xc5e4('0x12')],'priority':_0x5323d2++},_0x168dc1));}_0x2e34c2[_0xc5e4('0xd')](_[_0xc5e4('0x9')]({'app':'ChanSpy','appdata':util['format']('SIP/%s,%s',_0xdf6c1d[_0xc5e4('0x13')],_0x53f8b8['options']?_0x53f8b8['options'][_0xc5e4('0x14')](''):''),'priority':_0x5323d2++},_0x168dc1));if(_0x53f8b8[_0xc5e4('0x15')]){_0x2e34c2[_0xc5e4('0xd')](_[_0xc5e4('0x9')]({'app':_0xc5e4('0x16'),'priority':_0x5323d2++},_0x168dc1));}return _0x2e34c2;};var getChanSpyApplications=function(_0x2567cd,_0x41195c){var _0x117aa2=[];for(var _0xce8561=0x0,_0x4a4c42=0x1;_0xce8561<_0x41195c['length'];_0xce8561++,_0x4a4c42=0x1){_0x117aa2=_0x117aa2[_0xc5e4('0x17')](getUserApplications(_0x2567cd,_0x41195c[_0xce8561],_0x41195c[_0xce8561][_0xc5e4('0x18')]));if(_0x41195c[_0xce8561][_0xc5e4('0x18')]!=_0x41195c[_0xce8561][_0xc5e4('0x13')]){_0x117aa2=_0x117aa2['concat'](getUserApplications(_0x2567cd,_0x41195c[_0xce8561],_0x41195c[_0xce8561][_0xc5e4('0x13')]));}}return _0x117aa2;};var getChanSpyPromise=function(_0x34920b,_0x1e1a6a){return new BPromise(function(_0x4c5d6a,_0x228111){return _0x34920b['User'][_0xc5e4('0x19')]({'attributes':['id',_0xc5e4('0x13'),'internal'],'where':{'role':_0xc5e4('0x1a'),'chanspy':!![]},'raw':!![]})[_0xc5e4('0x1b')](function(_0x24018c){if(_0x24018c){return _0x4c5d6a(getChanSpyApplications(_0x1e1a6a,_0x24018c));}return _0x4c5d6a([]);})[_0xc5e4('0x1c')](function(_0x2553e6){_0x228111(_0x2553e6);});});};module[_0xc5e4('0x1d')]=function(_0x14e8ce,_0x37a97e){var _0x23c855=_0x14e8ce['models'];return _0x14e8ce[_0xc5e4('0x1e')](_0xc5e4('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x32e8f2,_0x403bbf,_0x29840c){return getChanSpyPromise(_0x23c855,_0x32e8f2)[_0xc5e4('0x1b')](function(_0x277f88){if(_0x277f88&&_0x277f88[_0xc5e4('0x20')]){return _0x23c855[_0xc5e4('0x21')][_0xc5e4('0x22')](_0x277f88);}})[_0xc5e4('0x1b')](function(){_0x29840c();})[_0xc5e4('0x1c')](function(_0x5503ba){_0x29840c(_0x5503ba);});},'afterUpdate':function(_0x12d296,_0x8761e5,_0x2699b9){return _0x23c855[_0xc5e4('0x21')][_0xc5e4('0x23')]({'where':{'ChanSpyId':_0x12d296['id']}})[_0xc5e4('0x1b')](function(){return getChanSpyPromise(_0x23c855,_0x12d296);})['then'](function(_0x35287e){if(_0x35287e&&_0x35287e[_0xc5e4('0x20')]){return _0x23c855[_0xc5e4('0x21')][_0xc5e4('0x22')](_0x35287e);}})[_0xc5e4('0x1b')](function(){_0x2699b9();})[_0xc5e4('0x1c')](function(_0x5bc4fa){_0x2699b9(_0x5bc4fa);});},'afterDestroy':function(_0x2cd65b,_0xb6c387,_0x50b84f){return _0x23c855[_0xc5e4('0x21')][_0xc5e4('0x23')]({'where':{'ChanSpyId':_0x2cd65b['id']}})['then'](function(){_0x50b84f();})[_0xc5e4('0x1c')](function(_0x25ae85){_0x50b84f(_0x25ae85);});}}});}; \ No newline at end of file +var _0xca59=['VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','concat','findAll','internal','agent','then','catch','exports','models','define','length'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0xca59,0x69));var _0x9ca5=function(_0xa91d4f,_0x199257){_0xa91d4f=_0xa91d4f-0x0;var _0x2e4bec=_0xca59[_0xa91d4f];return _0x2e4bec;};'use strict';var _=require('lodash');var util=require(_0x9ca5('0x0'));var BPromise=require(_0x9ca5('0x1'));var attributes=require(_0x9ca5('0x2'));var getUserApplications=function(_0x5e3c85,_0x8d5abb,_0x4e36e2){var _0x31b767=0x1;var _0x4121fe=[];var _0x49b957={'context':_0x8d5abb['context']||_0x9ca5('0x3'),'exten':util[_0x9ca5('0x4')](_0x9ca5('0x5'),_0x5e3c85[_0x9ca5('0x6')],_0x4e36e2),'type':_0x9ca5('0x7'),'isApp':![],'ChanSpyId':_0x5e3c85['id'],'UserId':_0x8d5abb['id']};_0x4121fe[_0x9ca5('0x8')](_[_0x9ca5('0x9')]({'app':'Set','appdata':util['format'](_0x9ca5('0xa'),_0x9ca5('0xb')),'priority':_0x31b767++},_0x49b957));if(_0x5e3c85['record']){_0x4121fe[_0x9ca5('0x8')](_[_0x9ca5('0x9')]({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,a',_0x5e3c85['recordingFormat']),'priority':_0x31b767++},_0x49b957));}if(_0x5e3c85[_0x9ca5('0xc')]){_0x4121fe[_0x9ca5('0x8')](_['merge']({'app':_0x9ca5('0xd'),'appdata':_0x5e3c85['password'],'priority':_0x31b767++},_0x49b957));}_0x4121fe['push'](_['merge']({'app':_0x9ca5('0xe'),'appdata':util['format'](_0x9ca5('0xf'),_0x8d5abb[_0x9ca5('0x10')],_0x5e3c85['options']?_0x5e3c85[_0x9ca5('0x11')][_0x9ca5('0x12')](''):''),'priority':_0x31b767++},_0x49b957));if(_0x5e3c85[_0x9ca5('0x13')]){_0x4121fe[_0x9ca5('0x8')](_[_0x9ca5('0x9')]({'app':_0x9ca5('0x14'),'priority':_0x31b767++},_0x49b957));}return _0x4121fe;};var getChanSpyApplications=function(_0x2bf1d9,_0x3611b0){var _0x1b82ba=[];for(var _0x26e218=0x0,_0x2b1acf=0x1;_0x26e218<_0x3611b0['length'];_0x26e218++,_0x2b1acf=0x1){_0x1b82ba=_0x1b82ba[_0x9ca5('0x15')](getUserApplications(_0x2bf1d9,_0x3611b0[_0x26e218],_0x3611b0[_0x26e218]['internal']));if(_0x3611b0[_0x26e218]['internal']!=_0x3611b0[_0x26e218]['name']){_0x1b82ba=_0x1b82ba[_0x9ca5('0x15')](getUserApplications(_0x2bf1d9,_0x3611b0[_0x26e218],_0x3611b0[_0x26e218][_0x9ca5('0x10')]));}}return _0x1b82ba;};var getChanSpyPromise=function(_0x1ab45a,_0x797fe6){return new BPromise(function(_0x1f522d,_0x9b563e){return _0x1ab45a['User'][_0x9ca5('0x16')]({'attributes':['id','name',_0x9ca5('0x17')],'where':{'role':_0x9ca5('0x18'),'chanspy':!![]},'raw':!![]})[_0x9ca5('0x19')](function(_0x100962){if(_0x100962){return _0x1f522d(getChanSpyApplications(_0x797fe6,_0x100962));}return _0x1f522d([]);})[_0x9ca5('0x1a')](function(_0x482de3){_0x9b563e(_0x482de3);});});};module[_0x9ca5('0x1b')]=function(_0x2a9979,_0x5c4537){var _0x143ed8=_0x2a9979[_0x9ca5('0x1c')];return _0x2a9979[_0x9ca5('0x1d')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x556748,_0x2877b8,_0x300de3){return getChanSpyPromise(_0x143ed8,_0x556748)['then'](function(_0x582507){if(_0x582507&&_0x582507[_0x9ca5('0x1e')]){return _0x143ed8[_0x9ca5('0x1f')][_0x9ca5('0x20')](_0x582507);}})['then'](function(){_0x300de3();})['catch'](function(_0x261318){_0x300de3(_0x261318);});},'afterUpdate':function(_0x343a60,_0x588dbc,_0x47bc0f){return _0x143ed8[_0x9ca5('0x1f')][_0x9ca5('0x21')]({'where':{'ChanSpyId':_0x343a60['id']}})[_0x9ca5('0x19')](function(){return getChanSpyPromise(_0x143ed8,_0x343a60);})[_0x9ca5('0x19')](function(_0x72d335){if(_0x72d335&&_0x72d335[_0x9ca5('0x1e')]){return _0x143ed8[_0x9ca5('0x1f')][_0x9ca5('0x20')](_0x72d335);}})[_0x9ca5('0x19')](function(){_0x47bc0f();})[_0x9ca5('0x1a')](function(_0x1eec22){_0x47bc0f(_0x1eec22);});},'afterDestroy':function(_0x45e05d,_0x17e2d0,_0x161e78){return _0x143ed8['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x45e05d['id']}})[_0x9ca5('0x19')](function(){_0x161e78();})[_0x9ca5('0x1a')](function(_0x69f6f7){_0x161e78(_0x69f6f7);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index a16be75..8410e9c 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 _0x2504=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x48ee31,_0x3c8aa6){var _0x322e4e=function(_0x4bd913){while(--_0x4bd913){_0x48ee31['push'](_0x48ee31['shift']());}};_0x322e4e(++_0x3c8aa6);}(_0x2504,0xee));var _0x4250=function(_0xcad624,_0xcfaced){_0xcad624=_0xcad624-0x0;var _0x51f6bc=_0x2504[_0xcad624];return _0x51f6bc;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rs=require(_0x4250('0x4'));var fs=require('fs');var Redis=require(_0x4250('0x5'));var db=require(_0x4250('0x6'))['db'];var utils=require(_0x4250('0x7'));var logger=require(_0x4250('0x8'))(_0x4250('0x9'));var config=require(_0x4250('0xa'));var jayson=require(_0x4250('0xb'));var client=jayson['client'][_0x4250('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e177e,_0x5a5286,_0x370998){return new BPromise(function(_0x477312,_0x1a3b57){return client[_0x4250('0xd')](_0x4e177e,_0x370998)[_0x4250('0xe')](function(_0x51ea6f){logger[_0x4250('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'));logger[_0x4250('0x11')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'),JSON['stringify'](_0x51ea6f));if(_0x51ea6f['error']){if(_0x51ea6f[_0x4250('0x12')][_0x4250('0x13')]===0x1f4){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')]['message']);return _0x1a3b57(_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);}logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);return _0x477312(_0x51ea6f['error'][_0x4250('0x15')]);}else{logger[_0x4250('0xf')](_0x4250('0x14'),_0x5a5286,_0x4250('0x10'));_0x477312(_0x51ea6f[_0x4250('0x16')][_0x4250('0x15')]);}})[_0x4250('0x17')](function(_0x4e70fc){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x4e70fc);_0x1a3b57(_0x4e70fc);});});} \ No newline at end of file +var _0x44a3=['http','request','then','info','request\x20sent','debug','error','code','message','VoiceChanSpy,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5e347b,_0x59ef61){var _0x427134=function(_0x4bf78c){while(--_0x4bf78c){_0x5e347b['push'](_0x5e347b['shift']());}};_0x427134(++_0x59ef61);}(_0x44a3,0x1a9));var _0x344a=function(_0x2e0d2a,_0x8d568){_0x2e0d2a=_0x2e0d2a-0x0;var _0x4014f0=_0x44a3[_0x2e0d2a];return _0x4014f0;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 215338c..ef093a1 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 _0x0c13=['create','put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4d2ca0,_0x4382de){var _0xc5d27b=function(_0x158db9){while(--_0x158db9){_0x4d2ca0['push'](_0x4d2ca0['shift']());}};_0xc5d27b(++_0x4382de);}(_0x0c13,0x1c8));var _0x30c1=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0x0c13[_0x438912];return _0x18112f;};'use strict';var multer=require('multer');var util=require(_0x30c1('0x0'));var path=require(_0x30c1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x30c1('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x30c1('0x3'));var config=require(_0x30c1('0x4'));var controller=require(_0x30c1('0x5'));router[_0x30c1('0x6')]('/',auth[_0x30c1('0x7')](),controller[_0x30c1('0x8')]);router[_0x30c1('0x6')](_0x30c1('0x9'),auth[_0x30c1('0x7')](),controller[_0x30c1('0xa')]);router[_0x30c1('0xb')]('/',auth[_0x30c1('0x7')](),controller[_0x30c1('0xc')]);router[_0x30c1('0xd')](_0x30c1('0x9'),auth[_0x30c1('0x7')](),controller[_0x30c1('0xe')]);router[_0x30c1('0xf')](_0x30c1('0x9'),auth[_0x30c1('0x7')](),controller[_0x30c1('0x10')]);module[_0x30c1('0x11')]=router; \ No newline at end of file +var _0xa7a0=['/:id','show','post','create','update','multer','util','path','fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','index'];(function(_0x9f1aad,_0x5cdd45){var _0x5223ca=function(_0x313e14){while(--_0x313e14){_0x9f1aad['push'](_0x9f1aad['shift']());}};_0x5223ca(++_0x5cdd45);}(_0xa7a0,0xbb));var _0x0a7a=function(_0x42930c,_0x3a9d3b){_0x42930c=_0x42930c-0x0;var _0x25eec4=_0xa7a0[_0x42930c];return _0x25eec4;};'use strict';var multer=require(_0x0a7a('0x0'));var util=require(_0x0a7a('0x1'));var path=require(_0x0a7a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0a7a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a7a('0x4'));var controller=require(_0x0a7a('0x5'));router[_0x0a7a('0x6')]('/',auth[_0x0a7a('0x7')](),controller[_0x0a7a('0x8')]);router[_0x0a7a('0x6')](_0x0a7a('0x9'),auth[_0x0a7a('0x7')](),controller[_0x0a7a('0xa')]);router[_0x0a7a('0xb')]('/',auth[_0x0a7a('0x7')](),controller[_0x0a7a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a7a('0xd')]);router['delete'](_0x0a7a('0x9'),auth[_0x0a7a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 07602f4..08645cb 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 _0xfff7=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x47ca97,_0x472ada){var _0x535104=function(_0x151faf){while(--_0x151faf){_0x47ca97['push'](_0x47ca97['shift']());}};_0x535104(++_0x472ada);}(_0xfff7,0x11c));var _0x7fff=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfff7[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x7fff('0x0'));module[_0x7fff('0x1')]={'name':{'type':Sequelize[_0x7fff('0x2')],'unique':_0x7fff('0x3')},'description':{'type':Sequelize[_0x7fff('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7fff('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc82b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0xc82b,0x1ef));var _0xbc82=function(_0x33eb89,_0x24aa10){_0x33eb89=_0x33eb89-0x0;var _0x137913=_0xc82b[_0x33eb89];return _0x137913;};'use strict';var Sequelize=require(_0xbc82('0x0'));module[_0xbc82('0x1')]={'name':{'type':Sequelize[_0xbc82('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbc82('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 51d8553..9443f78 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 _0xd62e=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','Contexts','end','stack','name','send','map','VoiceContext','type','model','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','rawAttributes','keys','intersection','fields','include','find','create','body','findAll','readFileSync','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','root','chan_sip.so','writeFileSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x33e79b,_0x1a4d04){var _0x245cd7=function(_0x1d1dde){while(--_0x1d1dde){_0x33e79b['push'](_0x33e79b['shift']());}};_0x245cd7(++_0x1a4d04);}(_0xd62e,0x125));var _0xed62=function(_0x3c05b0,_0x4e6fe8){_0x3c05b0=_0x3c05b0-0x0;var _0x237510=_0xd62e[_0x3c05b0];return _0x237510;};'use strict';var emlformat=require(_0xed62('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed62('0x1'));var rp=require(_0xed62('0x2'));var moment=require(_0xed62('0x3'));var BPromise=require(_0xed62('0x4'));var Mustache=require(_0xed62('0x5'));var util=require(_0xed62('0x6'));var path=require(_0xed62('0x7'));var sox=require(_0xed62('0x8'));var csv=require(_0xed62('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed62('0xa'));var _=require(_0xed62('0xb'));var squel=require(_0xed62('0xc'));var crypto=require(_0xed62('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed62('0xe'));var Papa=require(_0xed62('0xf'));var Redis=require('ioredis');var authService=require(_0xed62('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xed62('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed62('0x12'))(_0xed62('0x13'));var utils=require(_0xed62('0x14'));var config=require(_0xed62('0x15'));var licenseUtil=require(_0xed62('0x16'));var db=require(_0xed62('0x17'))['db'];var jayson=require(_0xed62('0x18'));var client=jayson['client'][_0xed62('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x171950,_0x5bdd08,_0x5cb2c5,_0x269cb7){return new BPromise(function(_0xe448c4,_0x344e75){var _0x1df33a=_0x269cb7||client;return _0x1df33a[_0xed62('0x1a')](_0x171950,_0x5cb2c5)[_0xed62('0x1b')](function(_0x20dc93){logger[_0xed62('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x5bdd08,'request\x20sent');logger['debug'](_0xed62('0x1d'),_0x5bdd08,_0xed62('0x1e'),JSON['stringify'](_0x20dc93));if(_0x20dc93[_0xed62('0x1f')]){if(_0x20dc93[_0xed62('0x1f')][_0xed62('0x20')]===0x1f4){logger[_0xed62('0x1f')](_0xed62('0x21'),_0x5bdd08,_0x20dc93[_0xed62('0x1f')][_0xed62('0x22')]);return _0x344e75(_0x20dc93[_0xed62('0x1f')][_0xed62('0x22')]);}logger[_0xed62('0x1f')](_0xed62('0x21'),_0x5bdd08,_0x20dc93[_0xed62('0x1f')][_0xed62('0x22')]);return _0xe448c4(_0x20dc93['error'][_0xed62('0x22')]);}else{logger[_0xed62('0x1c')](_0xed62('0x21'),_0x5bdd08,_0xed62('0x1e'));_0xe448c4(_0x20dc93[_0xed62('0x23')][_0xed62('0x22')]);}})[_0xed62('0x24')](function(_0x22f21b){logger['error'](_0xed62('0x21'),_0x5bdd08,_0x22f21b);_0x344e75(_0x22f21b);});});}function respondWithStatusCode(_0x13b0cb,_0xa96541){_0xa96541=_0xa96541||0xcc;return function(_0x596460){if(_0x596460){return _0x13b0cb[_0xed62('0x25')](_0xa96541);}return _0x13b0cb[_0xed62('0x26')](_0xa96541)['end']();};}function respondWithResult(_0x505eb1,_0x21f4c4){_0x21f4c4=_0x21f4c4||0xc8;return function(_0x3d3dd7){if(_0x3d3dd7){return _0x505eb1['status'](_0x21f4c4)[_0xed62('0x27')](_0x3d3dd7);}};}function respondWithFilteredResult(_0x3422cf,_0x35eda5){return function(_0x2b6472){if(_0x2b6472){var _0x5327e5=typeof _0x35eda5['offset']===_0xed62('0x28')&&typeof _0x35eda5[_0xed62('0x29')]===_0xed62('0x28');var _0x441997=_0x2b6472['count'];var _0x354876=_0x5327e5?0x0:_0x35eda5[_0xed62('0x2a')];var _0x2e4a11=_0x5327e5?_0x2b6472[_0xed62('0x2b')]:_0x35eda5[_0xed62('0x2a')]+_0x35eda5[_0xed62('0x29')];var _0x5ce61a;if(_0x2e4a11>=_0x441997){_0x2e4a11=_0x441997;_0x5ce61a=0xc8;}else{_0x5ce61a=0xce;}_0x3422cf[_0xed62('0x26')](_0x5ce61a);return _0x3422cf[_0xed62('0x2c')]('Content-Range',_0x354876+'-'+_0x2e4a11+'/'+_0x441997)[_0xed62('0x27')](_0x2b6472);}return null;};}function patchUpdates(_0x54f0d0){return function(_0x50bd40){try{jsonpatch[_0xed62('0x2d')](_0x50bd40,_0x54f0d0,!![]);}catch(_0x9bf8e6){return BPromise[_0xed62('0x2e')](_0x9bf8e6);}return _0x50bd40[_0xed62('0x2f')]();};}function saveUpdates(_0x2084fc,_0x2d2e31){return function(_0x414754){if(_0x414754){return _0x414754[_0xed62('0x30')](_0x2084fc)['then'](function(_0x5545c6){return _0x5545c6;});}return null;};}function removeEntity(_0x3a6829,_0x576f13){return function(_0x21640b){if(_0x21640b){return _0x21640b[_0xed62('0x31')]()[_0xed62('0x1b')](function(){var _0x382aa8=_0x21640b['get']({'plain':!![]});var _0xdfb14f=_0xed62('0x32');return db['UserProfileResource'][_0xed62('0x31')]({'where':{'type':_0xdfb14f,'resourceId':_0x382aa8['id']}})[_0xed62('0x1b')](function(){return _0x21640b;});})['then'](function(){_0x3a6829['status'](0xcc)[_0xed62('0x33')]();});}};}function handleEntityNotFound(_0x1fe8c6,_0x3ea2aa){return function(_0x304db6){if(!_0x304db6){_0x1fe8c6[_0xed62('0x25')](0x194);}return _0x304db6;};}function handleError(_0x458ff9,_0x54ddce){_0x54ddce=_0x54ddce||0x1f4;return function(_0x56f3e1){logger[_0xed62('0x1f')](_0x56f3e1[_0xed62('0x34')]);if(_0x56f3e1[_0xed62('0x35')]){delete _0x56f3e1['name'];}_0x458ff9[_0xed62('0x26')](_0x54ddce)[_0xed62('0x36')](_0x56f3e1);};}exports['index']=function(_0x57a032,_0x1d3bb6){var _0x21987c={},_0xcad260={},_0x27c56d={'count':0x0,'rows':[]};var _0xd99c13=_[_0xed62('0x37')](db[_0xed62('0x38')]['rawAttributes'],function(_0x156670){return{'name':_0x156670['fieldName'],'type':_0x156670[_0xed62('0x39')]['key']};});_0xcad260[_0xed62('0x3a')]=_['map'](_0xd99c13,_0xed62('0x35'));_0xcad260[_0xed62('0x3b')]=_['keys'](_0x57a032[_0xed62('0x3b')]);_0xcad260['filters']=_['intersection'](_0xcad260[_0xed62('0x3a')],_0xcad260[_0xed62('0x3b')]);_0x21987c[_0xed62('0x3c')]=_['intersection'](_0xcad260[_0xed62('0x3a')],qs['fields'](_0x57a032[_0xed62('0x3b')]['fields']));_0x21987c['attributes']=_0x21987c[_0xed62('0x3c')][_0xed62('0x3d')]?_0x21987c[_0xed62('0x3c')]:_0xcad260['model'];if(!_0x57a032['query'][_0xed62('0x3e')](_0xed62('0x3f'))){_0x21987c[_0xed62('0x29')]=qs[_0xed62('0x29')](_0x57a032[_0xed62('0x3b')][_0xed62('0x29')]);_0x21987c['offset']=qs[_0xed62('0x2a')](_0x57a032[_0xed62('0x3b')][_0xed62('0x2a')]);}_0x21987c[_0xed62('0x40')]=qs[_0xed62('0x41')](_0x57a032[_0xed62('0x3b')][_0xed62('0x41')]);_0x21987c[_0xed62('0x42')]=qs[_0xed62('0x43')](_[_0xed62('0x44')](_0x57a032['query'],_0xcad260[_0xed62('0x43')]),_0xd99c13);if(_0x57a032[_0xed62('0x3b')][_0xed62('0x45')]){_0x21987c['where']=_['merge'](_0x21987c[_0xed62('0x42')],{'$or':_[_0xed62('0x37')](_0xd99c13,function(_0xd15cef){if(_0xd15cef[_0xed62('0x39')]!==_0xed62('0x46')){var _0x10536d={};_0x10536d[_0xd15cef[_0xed62('0x35')]]={'$like':'%'+_0x57a032['query'][_0xed62('0x45')]+'%'};return _0x10536d;}})});}_0x21987c=_[_0xed62('0x47')]({},_0x21987c,_0x57a032[_0xed62('0x48')]);var _0xd5f4c4={'where':_0x21987c[_0xed62('0x42')]};return db['VoiceContext'][_0xed62('0x2b')](_0xd5f4c4)['then'](function(_0xe0d919){_0x27c56d[_0xed62('0x2b')]=_0xe0d919;if(_0x57a032['query'][_0xed62('0x49')]){_0x21987c['include']=[{'all':!![]}];}return db[_0xed62('0x38')]['findAll'](_0x21987c);})[_0xed62('0x1b')](function(_0x2f278e){_0x27c56d[_0xed62('0x4a')]=_0x2f278e;return _0x27c56d;})['then'](respondWithFilteredResult(_0x1d3bb6,_0x21987c))['catch'](handleError(_0x1d3bb6,null));};exports[_0xed62('0x4b')]=function(_0x1b1541,_0x4daf99){var _0x2528e6={'raw':![],'where':{'id':_0x1b1541['params']['id']}},_0x2a1c20={};_0x2a1c20[_0xed62('0x3a')]=_['keys'](db['VoiceContext'][_0xed62('0x4c')]);_0x2a1c20[_0xed62('0x3b')]=_[_0xed62('0x4d')](_0x1b1541[_0xed62('0x3b')]);_0x2a1c20[_0xed62('0x43')]=_[_0xed62('0x4e')](_0x2a1c20[_0xed62('0x3a')],_0x2a1c20[_0xed62('0x3b')]);_0x2528e6['attributes']=_[_0xed62('0x4e')](_0x2a1c20[_0xed62('0x3a')],qs[_0xed62('0x4f')](_0x1b1541['query']['fields']));_0x2528e6[_0xed62('0x3c')]=_0x2528e6[_0xed62('0x3c')][_0xed62('0x3d')]?_0x2528e6[_0xed62('0x3c')]:_0x2a1c20[_0xed62('0x3a')];if(_0x1b1541['query']['includeAll']){_0x2528e6[_0xed62('0x50')]=[{'all':!![]}];}_0x2528e6=_[_0xed62('0x47')]({},_0x2528e6,_0x1b1541[_0xed62('0x48')]);return db[_0xed62('0x38')][_0xed62('0x51')](_0x2528e6)['then'](handleEntityNotFound(_0x4daf99,null))[_0xed62('0x1b')](respondWithResult(_0x4daf99,null))[_0xed62('0x24')](handleError(_0x4daf99,null));};exports[_0xed62('0x52')]=function(_0x47b682,_0x2d07a5,_0x1c47d1){var _0x2ac00e;return db[_0xed62('0x38')][_0xed62('0x52')](_0x47b682[_0xed62('0x53')],{'raw':!![]})['then'](function(_0x132bd5){_0x2ac00e=_0x132bd5;return db[_0xed62('0x38')][_0xed62('0x54')]({'raw':!![]});})[_0xed62('0x1b')](function(_0x5e6385){var _0x74d4ab=fs[_0xed62('0x55')](path[_0xed62('0x56')](config['root'],_0xed62('0x57')),_0xed62('0x58'));var _0x2fb62e=ejs[_0xed62('0x59')](_0x74d4ab,{'contexts':_0x5e6385||[]});fs['writeFileSync'](_0xed62('0x5a'),_0x2fb62e);})[_0xed62('0x1b')](function(){return respondWithRpcPromise(_0xed62('0x5b'),_0xed62('0x52'),{'module':'chan_sip.so'});})['then'](function(){var _0x14065e=_0x47b682[_0xed62('0x5c')][_0xed62('0x5d')]({'plain':!![]});if(!_0x14065e)throw new Error(_0xed62('0x5e'));if(_0x14065e[_0xed62('0x5f')]===_0xed62('0x5c')){var _0x2eb549=_0x2ac00e[_0xed62('0x5d')]({'plain':!![]});return db[_0xed62('0x60')][_0xed62('0x51')]({'where':{'name':_0xed62('0x32'),'userProfileId':_0x14065e[_0xed62('0x61')]},'raw':!![]})[_0xed62('0x1b')](function(_0x137f07){if(_0x137f07&&_0x137f07[_0xed62('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x2eb549[_0xed62('0x35')],'resourceId':_0x2eb549['id'],'type':_0x137f07[_0xed62('0x35')],'sectionId':_0x137f07['id']},{})[_0xed62('0x1b')](function(){return _0x2ac00e;});}else{return _0x2ac00e;}})[_0xed62('0x24')](function(_0x10ae9e){logger['error'](_0xed62('0x63'),_0x10ae9e);throw _0x10ae9e;});}return _0x2ac00e;})[_0xed62('0x1b')](respondWithResult(_0x2d07a5,0xc9))[_0xed62('0x24')](handleError(_0x2d07a5,null));};exports[_0xed62('0x30')]=function(_0x1b88f3,_0x385f58,_0x4980a8){var _0x260d7b;return db[_0xed62('0x38')]['find']({'where':{'id':_0x1b88f3[_0xed62('0x64')]['id']}})['then'](handleEntityNotFound(_0x385f58,null))[_0xed62('0x1b')](saveUpdates(_0x1b88f3[_0xed62('0x53')],null))[_0xed62('0x1b')](function(_0x1fbc57){if(_0x1fbc57){_0x260d7b=_0x1fbc57;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xed62('0x1b')](function(_0x20e945){var _0x43104e=fs[_0xed62('0x55')](path[_0xed62('0x56')](config[_0xed62('0x65')],_0xed62('0x57')),_0xed62('0x58'));var _0x37de3f=ejs['render'](_0x43104e,{'contexts':_0x20e945||[]});fs['writeFileSync'](_0xed62('0x5a'),_0x37de3f);})[_0xed62('0x1b')](function(){return respondWithRpcPromise('Reload',_0xed62('0x30'),{'module':_0xed62('0x66')});})[_0xed62('0x1b')](function(){return _0x260d7b;})[_0xed62('0x1b')](respondWithResult(_0x385f58,null))[_0xed62('0x24')](handleError(_0x385f58,null));};exports[_0xed62('0x31')]=function(_0x2847a3,_0x59df88,_0x5a94d9){var _0x91bdb7;return db[_0xed62('0x38')][_0xed62('0x51')]({'where':{'id':_0x2847a3['params']['id']}})[_0xed62('0x1b')](handleEntityNotFound(_0x59df88,null))[_0xed62('0x1b')](removeEntity(_0x59df88,null))[_0xed62('0x1b')](function(){return db[_0xed62('0x38')][_0xed62('0x54')]({'raw':!![]});})[_0xed62('0x1b')](function(_0x3d2169){var _0xf4bf9=fs[_0xed62('0x55')](path[_0xed62('0x56')](config['root'],'server/files/templates/context.ejs'),_0xed62('0x58'));var _0x45bf34=ejs['render'](_0xf4bf9,{'contexts':_0x3d2169});fs[_0xed62('0x67')](_0xed62('0x5a'),_0x45bf34);return respondWithRpcPromise(_0xed62('0x5b'),_0xed62('0x31'),{'module':_0xed62('0x66')});})[_0xed62('0x24')](handleError(_0x59df88,null));}; \ No newline at end of file +var _0x44e8=['filter','VoiceContext','includeAll','rows','params','keys','include','options','find','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','Contexts','UserProfileResource','end','name','map','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge'];(function(_0x335201,_0x314d57){var _0x39b053=function(_0x22d774){while(--_0x22d774){_0x335201['push'](_0x335201['shift']());}};_0x39b053(++_0x314d57);}(_0x44e8,0x86));var _0x844e=function(_0x1ebdda,_0x404420){_0x1ebdda=_0x1ebdda-0x0;var _0x594bdf=_0x44e8[_0x1ebdda];return _0x594bdf;};'use strict';var emlformat=require(_0x844e('0x0'));var rimraf=require(_0x844e('0x1'));var zipdir=require(_0x844e('0x2'));var jsonpatch=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var moment=require(_0x844e('0x5'));var BPromise=require(_0x844e('0x6'));var Mustache=require(_0x844e('0x7'));var util=require(_0x844e('0x8'));var path=require(_0x844e('0x9'));var sox=require(_0x844e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x844e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x844e('0xc'));var jsforce=require(_0x844e('0xd'));var deskjs=require(_0x844e('0xe'));var toCsv=require(_0x844e('0xf'));var querystring=require(_0x844e('0x10'));var Papa=require(_0x844e('0x11'));var Redis=require('ioredis');var authService=require(_0x844e('0x12'));var qs=require(_0x844e('0x13'));var as=require(_0x844e('0x14'));var hardwareService=require(_0x844e('0x15'));var logger=require(_0x844e('0x16'))('api');var utils=require(_0x844e('0x17'));var config=require(_0x844e('0x18'));var licenseUtil=require(_0x844e('0x19'));var db=require(_0x844e('0x1a'))['db'];var jayson=require(_0x844e('0x1b'));var client=jayson['client'][_0x844e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5be80b,_0x48448a,_0x3d2d41,_0x4257d4){return new BPromise(function(_0x1c4241,_0x36461e){var _0x347e39=_0x4257d4||client;return _0x347e39[_0x844e('0x1d')](_0x5be80b,_0x3d2d41)[_0x844e('0x1e')](function(_0x4c2139){logger[_0x844e('0x1f')](_0x844e('0x20'),_0x48448a,_0x844e('0x21'));logger['debug'](_0x844e('0x22'),_0x48448a,'request\x20sent',JSON[_0x844e('0x23')](_0x4c2139));if(_0x4c2139[_0x844e('0x24')]){if(_0x4c2139[_0x844e('0x24')][_0x844e('0x25')]===0x1f4){logger[_0x844e('0x24')]('VoiceContext,\x20%s,\x20%s',_0x48448a,_0x4c2139[_0x844e('0x24')][_0x844e('0x26')]);return _0x36461e(_0x4c2139[_0x844e('0x24')][_0x844e('0x26')]);}logger[_0x844e('0x24')](_0x844e('0x20'),_0x48448a,_0x4c2139[_0x844e('0x24')][_0x844e('0x26')]);return _0x1c4241(_0x4c2139['error'][_0x844e('0x26')]);}else{logger[_0x844e('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x48448a,'request\x20sent');_0x1c4241(_0x4c2139[_0x844e('0x27')][_0x844e('0x26')]);}})['catch'](function(_0x500968){logger['error'](_0x844e('0x20'),_0x48448a,_0x500968);_0x36461e(_0x500968);});});}function respondWithStatusCode(_0x1868f4,_0x251669){_0x251669=_0x251669||0xcc;return function(_0x32456){if(_0x32456){return _0x1868f4[_0x844e('0x28')](_0x251669);}return _0x1868f4['status'](_0x251669)['end']();};}function respondWithResult(_0x47e31e,_0x3f685a){_0x3f685a=_0x3f685a||0xc8;return function(_0x1ec84f){if(_0x1ec84f){return _0x47e31e[_0x844e('0x29')](_0x3f685a)[_0x844e('0x2a')](_0x1ec84f);}};}function respondWithFilteredResult(_0xd3cfa8,_0xd1ba84){return function(_0x5c2fdf){if(_0x5c2fdf){var _0xc35ec9=typeof _0xd1ba84[_0x844e('0x2b')]==='undefined'&&typeof _0xd1ba84[_0x844e('0x2c')]===_0x844e('0x2d');var _0x5cfd46=_0x5c2fdf['count'];var _0x2845eb=_0xc35ec9?0x0:_0xd1ba84[_0x844e('0x2b')];var _0x24da61=_0xc35ec9?_0x5c2fdf[_0x844e('0x2e')]:_0xd1ba84[_0x844e('0x2b')]+_0xd1ba84[_0x844e('0x2c')];var _0x417264;if(_0x24da61>=_0x5cfd46){_0x24da61=_0x5cfd46;_0x417264=0xc8;}else{_0x417264=0xce;}_0xd3cfa8['status'](_0x417264);return _0xd3cfa8['set'](_0x844e('0x2f'),_0x2845eb+'-'+_0x24da61+'/'+_0x5cfd46)[_0x844e('0x2a')](_0x5c2fdf);}return null;};}function patchUpdates(_0x777d77){return function(_0xacd962){try{jsonpatch[_0x844e('0x30')](_0xacd962,_0x777d77,!![]);}catch(_0x29882c){return BPromise[_0x844e('0x31')](_0x29882c);}return _0xacd962[_0x844e('0x32')]();};}function saveUpdates(_0x19ecfb,_0x232d1a){return function(_0x253f17){if(_0x253f17){return _0x253f17[_0x844e('0x33')](_0x19ecfb)[_0x844e('0x1e')](function(_0x1fe93c){return _0x1fe93c;});}return null;};}function removeEntity(_0x5632db,_0x16fec0){return function(_0x439f74){if(_0x439f74){return _0x439f74[_0x844e('0x34')]()['then'](function(){var _0x5dee19=_0x439f74['get']({'plain':!![]});var _0x373dab=_0x844e('0x35');return db[_0x844e('0x36')][_0x844e('0x34')]({'where':{'type':_0x373dab,'resourceId':_0x5dee19['id']}})[_0x844e('0x1e')](function(){return _0x439f74;});})[_0x844e('0x1e')](function(){_0x5632db[_0x844e('0x29')](0xcc)[_0x844e('0x37')]();});}};}function handleEntityNotFound(_0x18e182,_0x56263a){return function(_0x286aa5){if(!_0x286aa5){_0x18e182['sendStatus'](0x194);}return _0x286aa5;};}function handleError(_0x5704ae,_0x19b6fa){_0x19b6fa=_0x19b6fa||0x1f4;return function(_0x5277ee){logger[_0x844e('0x24')](_0x5277ee['stack']);if(_0x5277ee[_0x844e('0x38')]){delete _0x5277ee[_0x844e('0x38')];}_0x5704ae[_0x844e('0x29')](_0x19b6fa)['send'](_0x5277ee);};}exports['index']=function(_0x25d5e5,_0x2a97b6){var _0x2077bd={},_0x4b4271={},_0x5a57b1={'count':0x0,'rows':[]};var _0x453d6d=_[_0x844e('0x39')](db['VoiceContext'][_0x844e('0x3a')],function(_0x3df710){return{'name':_0x3df710[_0x844e('0x3b')],'type':_0x3df710[_0x844e('0x3c')]['key']};});_0x4b4271['model']=_[_0x844e('0x39')](_0x453d6d,_0x844e('0x38'));_0x4b4271[_0x844e('0x3d')]=_['keys'](_0x25d5e5[_0x844e('0x3d')]);_0x4b4271['filters']=_[_0x844e('0x3e')](_0x4b4271[_0x844e('0x3f')],_0x4b4271[_0x844e('0x3d')]);_0x2077bd[_0x844e('0x40')]=_[_0x844e('0x3e')](_0x4b4271[_0x844e('0x3f')],qs[_0x844e('0x41')](_0x25d5e5['query'][_0x844e('0x41')]));_0x2077bd['attributes']=_0x2077bd[_0x844e('0x40')][_0x844e('0x42')]?_0x2077bd['attributes']:_0x4b4271[_0x844e('0x3f')];if(!_0x25d5e5[_0x844e('0x3d')]['hasOwnProperty'](_0x844e('0x43'))){_0x2077bd[_0x844e('0x2c')]=qs['limit'](_0x25d5e5[_0x844e('0x3d')]['limit']);_0x2077bd[_0x844e('0x2b')]=qs[_0x844e('0x2b')](_0x25d5e5[_0x844e('0x3d')][_0x844e('0x2b')]);}_0x2077bd[_0x844e('0x44')]=qs[_0x844e('0x45')](_0x25d5e5[_0x844e('0x3d')][_0x844e('0x45')]);_0x2077bd[_0x844e('0x46')]=qs[_0x844e('0x47')](_[_0x844e('0x48')](_0x25d5e5[_0x844e('0x3d')],_0x4b4271[_0x844e('0x47')]),_0x453d6d);if(_0x25d5e5[_0x844e('0x3d')]['filter']){_0x2077bd[_0x844e('0x46')]=_[_0x844e('0x49')](_0x2077bd[_0x844e('0x46')],{'$or':_['map'](_0x453d6d,function(_0xb8652e){if(_0xb8652e[_0x844e('0x3c')]!=='VIRTUAL'){var _0x93fc8b={};_0x93fc8b[_0xb8652e[_0x844e('0x38')]]={'$like':'%'+_0x25d5e5[_0x844e('0x3d')][_0x844e('0x4a')]+'%'};return _0x93fc8b;}})});}_0x2077bd=_[_0x844e('0x49')]({},_0x2077bd,_0x25d5e5['options']);var _0x5537c1={'where':_0x2077bd['where']};return db[_0x844e('0x4b')][_0x844e('0x2e')](_0x5537c1)[_0x844e('0x1e')](function(_0x2f4bc7){_0x5a57b1[_0x844e('0x2e')]=_0x2f4bc7;if(_0x25d5e5[_0x844e('0x3d')][_0x844e('0x4c')]){_0x2077bd['include']=[{'all':!![]}];}return db[_0x844e('0x4b')]['findAll'](_0x2077bd);})[_0x844e('0x1e')](function(_0x13d9e9){_0x5a57b1[_0x844e('0x4d')]=_0x13d9e9;return _0x5a57b1;})[_0x844e('0x1e')](respondWithFilteredResult(_0x2a97b6,_0x2077bd))['catch'](handleError(_0x2a97b6,null));};exports['show']=function(_0x5081c1,_0x866a04){var _0x230146={'raw':![],'where':{'id':_0x5081c1[_0x844e('0x4e')]['id']}},_0x42b66a={};_0x42b66a[_0x844e('0x3f')]=_['keys'](db[_0x844e('0x4b')]['rawAttributes']);_0x42b66a[_0x844e('0x3d')]=_[_0x844e('0x4f')](_0x5081c1['query']);_0x42b66a[_0x844e('0x47')]=_[_0x844e('0x3e')](_0x42b66a[_0x844e('0x3f')],_0x42b66a['query']);_0x230146[_0x844e('0x40')]=_[_0x844e('0x3e')](_0x42b66a[_0x844e('0x3f')],qs[_0x844e('0x41')](_0x5081c1[_0x844e('0x3d')][_0x844e('0x41')]));_0x230146[_0x844e('0x40')]=_0x230146[_0x844e('0x40')][_0x844e('0x42')]?_0x230146[_0x844e('0x40')]:_0x42b66a['model'];if(_0x5081c1['query'][_0x844e('0x4c')]){_0x230146[_0x844e('0x50')]=[{'all':!![]}];}_0x230146=_[_0x844e('0x49')]({},_0x230146,_0x5081c1[_0x844e('0x51')]);return db[_0x844e('0x4b')][_0x844e('0x52')](_0x230146)[_0x844e('0x1e')](handleEntityNotFound(_0x866a04,null))[_0x844e('0x1e')](respondWithResult(_0x866a04,null))[_0x844e('0x53')](handleError(_0x866a04,null));};exports[_0x844e('0x54')]=function(_0x3f845a,_0x5b9832,_0x56c8b7){var _0x9588f3;return db[_0x844e('0x4b')][_0x844e('0x54')](_0x3f845a[_0x844e('0x55')],{'raw':!![]})[_0x844e('0x1e')](function(_0x363ae8){_0x9588f3=_0x363ae8;return db[_0x844e('0x4b')]['findAll']({'raw':!![]});})[_0x844e('0x1e')](function(_0x1a353b){var _0x3a3270=fs[_0x844e('0x56')](path[_0x844e('0x57')](config[_0x844e('0x58')],_0x844e('0x59')),_0x844e('0x5a'));var _0x317f8d=ejs[_0x844e('0x5b')](_0x3a3270,{'contexts':_0x1a353b||[]});fs[_0x844e('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x317f8d);})[_0x844e('0x1e')](function(){return respondWithRpcPromise(_0x844e('0x5d'),'create',{'module':_0x844e('0x5e')});})[_0x844e('0x1e')](function(){var _0x445a7e=_0x3f845a[_0x844e('0x5f')]['get']({'plain':!![]});if(!_0x445a7e)throw new Error(_0x844e('0x60'));if(_0x445a7e[_0x844e('0x61')]===_0x844e('0x5f')){var _0x2e5205=_0x9588f3[_0x844e('0x62')]({'plain':!![]});return db['UserProfileSection'][_0x844e('0x52')]({'where':{'name':_0x844e('0x35'),'userProfileId':_0x445a7e[_0x844e('0x63')]},'raw':!![]})[_0x844e('0x1e')](function(_0x1168ad){if(_0x1168ad&&_0x1168ad[_0x844e('0x64')]===0x0){return db['UserProfileResource'][_0x844e('0x54')]({'name':_0x2e5205[_0x844e('0x38')],'resourceId':_0x2e5205['id'],'type':_0x1168ad[_0x844e('0x38')],'sectionId':_0x1168ad['id']},{})[_0x844e('0x1e')](function(){return _0x9588f3;});}else{return _0x9588f3;}})[_0x844e('0x53')](function(_0x49f885){logger[_0x844e('0x24')](_0x844e('0x65'),_0x49f885);throw _0x49f885;});}return _0x9588f3;})[_0x844e('0x1e')](respondWithResult(_0x5b9832,0xc9))['catch'](handleError(_0x5b9832,null));};exports[_0x844e('0x33')]=function(_0x48df5e,_0x1ea8fa,_0x1dd937){var _0x554a62;return db['VoiceContext'][_0x844e('0x52')]({'where':{'id':_0x48df5e['params']['id']}})[_0x844e('0x1e')](handleEntityNotFound(_0x1ea8fa,null))[_0x844e('0x1e')](saveUpdates(_0x48df5e[_0x844e('0x55')],null))['then'](function(_0x4dcad0){if(_0x4dcad0){_0x554a62=_0x4dcad0;return db[_0x844e('0x4b')][_0x844e('0x66')]({'raw':!![]});}})['then'](function(_0x40fb72){var _0x2a7bd=fs[_0x844e('0x56')](path[_0x844e('0x57')](config[_0x844e('0x58')],_0x844e('0x59')),_0x844e('0x5a'));var _0x31fc14=ejs[_0x844e('0x5b')](_0x2a7bd,{'contexts':_0x40fb72||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x31fc14);})[_0x844e('0x1e')](function(){return respondWithRpcPromise('Reload',_0x844e('0x33'),{'module':_0x844e('0x5e')});})['then'](function(){return _0x554a62;})['then'](respondWithResult(_0x1ea8fa,null))[_0x844e('0x53')](handleError(_0x1ea8fa,null));};exports[_0x844e('0x34')]=function(_0x28c412,_0x22d25e,_0x3bc655){var _0x3bc675;return db[_0x844e('0x4b')]['find']({'where':{'id':_0x28c412[_0x844e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x22d25e,null))['then'](removeEntity(_0x22d25e,null))[_0x844e('0x1e')](function(){return db[_0x844e('0x4b')][_0x844e('0x66')]({'raw':!![]});})[_0x844e('0x1e')](function(_0x286bcc){var _0x9c3fa8=fs[_0x844e('0x56')](path['join'](config[_0x844e('0x58')],_0x844e('0x59')),'utf8');var _0x3e1d48=ejs[_0x844e('0x5b')](_0x9c3fa8,{'contexts':_0x286bcc});fs[_0x844e('0x5c')](_0x844e('0x67'),_0x3e1d48);return respondWithRpcPromise(_0x844e('0x5d'),_0x844e('0x34'),{'module':_0x844e('0x5e')});})[_0x844e('0x53')](handleError(_0x22d25e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 55806b7..4c9b39e 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 _0xa3df=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3df,0x144));var _0xfa3d=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa3df[_0x139a3c];return _0x2b375b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfa3d('0x0'));var moment=require(_0xfa3d('0x1'));var BPromise=require(_0xfa3d('0x2'));var rp=require(_0xfa3d('0x3'));var fs=require('fs');var path=require(_0xfa3d('0x4'));var rimraf=require(_0xfa3d('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa3d('0x6'));module[_0xfa3d('0x7')]=function(_0x4cd5df,_0x1cb368){return _0x4cd5df[_0xfa3d('0x8')](_0xfa3d('0x9'),attributes,{'tableName':_0xfa3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6730=['api','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util','../../config/logger'];(function(_0xe68a4c,_0x1cfead){var _0x492b36=function(_0x501185){while(--_0x501185){_0xe68a4c['push'](_0xe68a4c['shift']());}};_0x492b36(++_0x1cfead);}(_0x6730,0x1ab));var _0x0673=function(_0x2f202e,_0x5ed293){_0x2f202e=_0x2f202e-0x0;var _0x398ac6=_0x6730[_0x2f202e];return _0x398ac6;};'use strict';var _=require('lodash');var util=require(_0x0673('0x0'));var logger=require(_0x0673('0x1'))(_0x0673('0x2'));var moment=require('moment');var BPromise=require(_0x0673('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0673('0x4'));var rimraf=require(_0x0673('0x5'));var config=require(_0x0673('0x6'));var attributes=require(_0x0673('0x7'));module[_0x0673('0x8')]=function(_0x3029aa,_0x301b5c){return _0x3029aa['define'](_0x0673('0x9'),attributes,{'tableName':_0x0673('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 1b71f67..ec7ceb4 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 _0x342c=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x4a0940,_0xe32ca6){var _0x523eba=function(_0x8c5348){while(--_0x8c5348){_0x4a0940['push'](_0x4a0940['shift']());}};_0x523eba(++_0xe32ca6);}(_0x342c,0x149));var _0xc342=function(_0x3cf473,_0x2c9f5d){_0x3cf473=_0x3cf473-0x0;var _0x216120=_0x342c[_0x3cf473];return _0x216120;};'use strict';var _=require(_0xc342('0x0'));var util=require(_0xc342('0x1'));var moment=require('moment');var BPromise=require(_0xc342('0x2'));var rs=require(_0xc342('0x3'));var fs=require('fs');var Redis=require(_0xc342('0x4'));var db=require(_0xc342('0x5'))['db'];var utils=require(_0xc342('0x6'));var logger=require('../../config/logger')(_0xc342('0x7'));var config=require(_0xc342('0x8'));var jayson=require(_0xc342('0x9'));var client=jayson[_0xc342('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47655b,_0xac2012,_0x5e073d){return new BPromise(function(_0x3268c8,_0x32ac9c){return client['request'](_0x47655b,_0x5e073d)[_0xc342('0xb')](function(_0x36d039){logger[_0xc342('0xc')](_0xc342('0xd'),_0xac2012,'request\x20sent');logger[_0xc342('0xe')](_0xc342('0xf'),_0xac2012,_0xc342('0x10'),JSON['stringify'](_0x36d039));if(_0x36d039[_0xc342('0x11')]){if(_0x36d039[_0xc342('0x11')][_0xc342('0x12')]===0x1f4){logger[_0xc342('0x11')](_0xc342('0xd'),_0xac2012,_0x36d039['error'][_0xc342('0x13')]);return _0x32ac9c(_0x36d039[_0xc342('0x11')]['message']);}logger[_0xc342('0x11')](_0xc342('0xd'),_0xac2012,_0x36d039[_0xc342('0x11')][_0xc342('0x13')]);return _0x3268c8(_0x36d039[_0xc342('0x11')][_0xc342('0x13')]);}else{logger[_0xc342('0xc')](_0xc342('0xd'),_0xac2012,'request\x20sent');_0x3268c8(_0x36d039[_0xc342('0x14')][_0xc342('0x13')]);}})[_0xc342('0x15')](function(_0x53b2f1){logger[_0xc342('0x11')](_0xc342('0xd'),_0xac2012,_0x53b2f1);_0x32ac9c(_0x53b2f1);});});} \ No newline at end of file +var _0x53eb=['message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0x53eb,0x115));var _0xb53e=function(_0x2d4a49,_0x372662){_0x2d4a49=_0x2d4a49-0x0;var _0x301bf7=_0x53eb[_0x2d4a49];return _0x301bf7;};'use strict';var _=require(_0xb53e('0x0'));var util=require(_0xb53e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb53e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb53e('0x3'))['db'];var utils=require(_0xb53e('0x4'));var logger=require('../../config/logger')(_0xb53e('0x5'));var config=require(_0xb53e('0x6'));var jayson=require(_0xb53e('0x7'));var client=jayson['client'][_0xb53e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a116b,_0x23f47c,_0x26633f){return new BPromise(function(_0x3aa191,_0x409bcc){return client['request'](_0x3a116b,_0x26633f)[_0xb53e('0x9')](function(_0x4858b6){logger['info'](_0xb53e('0xa'),_0x23f47c,_0xb53e('0xb'));logger[_0xb53e('0xc')](_0xb53e('0xd'),_0x23f47c,_0xb53e('0xb'),JSON[_0xb53e('0xe')](_0x4858b6));if(_0x4858b6[_0xb53e('0xf')]){if(_0x4858b6[_0xb53e('0xf')][_0xb53e('0x10')]===0x1f4){logger[_0xb53e('0xf')](_0xb53e('0xa'),_0x23f47c,_0x4858b6['error'][_0xb53e('0x11')]);return _0x409bcc(_0x4858b6[_0xb53e('0xf')][_0xb53e('0x11')]);}logger['error'](_0xb53e('0xa'),_0x23f47c,_0x4858b6['error'][_0xb53e('0x11')]);return _0x3aa191(_0x4858b6[_0xb53e('0xf')]['message']);}else{logger[_0xb53e('0x12')](_0xb53e('0xa'),_0x23f47c,_0xb53e('0xb'));_0x3aa191(_0x4858b6[_0xb53e('0x13')][_0xb53e('0x11')]);}})[_0xb53e('0x14')](function(_0x34441d){logger[_0xb53e('0xf')](_0xb53e('0xa'),_0x23f47c,_0x34441d);_0x409bcc(_0x34441d);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index ec6348b..52e706f 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 _0xabe6=['/:id','post','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','describe'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xabe6,0x84));var _0x6abe=function(_0x4de27d,_0x753853){_0x4de27d=_0x4de27d-0x0;var _0x418cc4=_0xabe6[_0x4de27d];return _0x418cc4;};'use strict';var multer=require(_0x6abe('0x0'));var util=require(_0x6abe('0x1'));var path=require(_0x6abe('0x2'));var timeout=require(_0x6abe('0x3'));var express=require(_0x6abe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6abe('0x5'));var config=require(_0x6abe('0x6'));var controller=require(_0x6abe('0x7'));router[_0x6abe('0x8')]('/',auth['isAuthenticated'](),controller[_0x6abe('0x9')]);router[_0x6abe('0x8')](_0x6abe('0xa'),auth['isAuthenticated'](),controller[_0x6abe('0xb')]);router['get'](_0x6abe('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6abe('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6abe('0xc'),auth[_0x6abe('0xe')](),controller[_0x6abe('0xf')]);router[_0x6abe('0x10')](_0x6abe('0xc'),auth['isAuthenticated'](),controller[_0x6abe('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8b48=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x385eb1,_0x497a94){var _0x5d40eb=function(_0x159029){while(--_0x159029){_0x385eb1['push'](_0x385eb1['shift']());}};_0x5d40eb(++_0x497a94);}(_0x8b48,0x95));var _0x88b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b48[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x88b4('0x0'));var util=require(_0x88b4('0x1'));var path=require(_0x88b4('0x2'));var timeout=require(_0x88b4('0x3'));var express=require('express');var router=express[_0x88b4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x88b4('0x5'));var interaction=require(_0x88b4('0x6'));var config=require(_0x88b4('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x88b4('0x8')](),controller[_0x88b4('0x9')]);router[_0x88b4('0xa')]('/describe',auth[_0x88b4('0x8')](),controller[_0x88b4('0xb')]);router[_0x88b4('0xa')]('/:id',auth[_0x88b4('0x8')](),controller[_0x88b4('0xc')]);router[_0x88b4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x88b4('0xe')](_0x88b4('0xf'),auth[_0x88b4('0x8')](),controller['update']);router[_0x88b4('0x10')](_0x88b4('0xf'),auth[_0x88b4('0x8')](),controller[_0x88b4('0x11')]);module[_0x88b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3fe41f3..c97a033 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 _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x56cbb2,_0x5ccc49){var _0x385edc=function(_0x1cbcab){while(--_0x1cbcab){_0x56cbb2['push'](_0x56cbb2['shift']());}};_0x385edc(++_0x5ccc49);}(_0x55ca,0x126));var _0xa55c=function(_0x2673bb,_0x292576){_0x2673bb=_0x2673bb-0x0;var _0x3edc1c=_0x55ca[_0x2673bb];return _0x3edc1c;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9406633..3e68975 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 _0x5f89=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','then','include','VoiceDialReport','rows','catch','show','params','find'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0x5f89,0xd8));var _0x95f8=function(_0x49ba30,_0x5cb169){_0x49ba30=_0x49ba30-0x0;var _0x47d95f=_0x5f89[_0x49ba30];return _0x47d95f;};'use strict';var emlformat=require(_0x95f8('0x0'));var rimraf=require(_0x95f8('0x1'));var zipdir=require(_0x95f8('0x2'));var jsonpatch=require(_0x95f8('0x3'));var rp=require(_0x95f8('0x4'));var moment=require(_0x95f8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x95f8('0x6'));var util=require('util');var path=require(_0x95f8('0x7'));var sox=require('sox');var csv=require(_0x95f8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95f8('0x9'));var _=require('lodash');var squel=require(_0x95f8('0xa'));var crypto=require(_0x95f8('0xb'));var jsforce=require(_0x95f8('0xc'));var deskjs=require(_0x95f8('0xd'));var toCsv=require(_0x95f8('0x8'));var querystring=require(_0x95f8('0xe'));var Papa=require(_0x95f8('0xf'));var Redis=require('ioredis');var authService=require(_0x95f8('0x10'));var qs=require(_0x95f8('0x11'));var as=require(_0x95f8('0x12'));var hardwareService=require(_0x95f8('0x13'));var logger=require(_0x95f8('0x14'))(_0x95f8('0x15'));var utils=require('../../config/utils');var config=require(_0x95f8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfd4bc3,_0x270998){_0x270998=_0x270998||0xcc;return function(_0x5a448b){if(_0x5a448b){return _0xfd4bc3[_0x95f8('0x17')](_0x270998);}return _0xfd4bc3[_0x95f8('0x18')](_0x270998)[_0x95f8('0x19')]();};}function respondWithResult(_0x2e1669,_0x2d5b10){_0x2d5b10=_0x2d5b10||0xc8;return function(_0x401c05){if(_0x401c05){return _0x2e1669[_0x95f8('0x18')](_0x2d5b10)[_0x95f8('0x1a')](_0x401c05);}};}function respondWithFilteredResult(_0x55f481,_0x541fc2){return function(_0x164cbf){if(_0x164cbf){var _0x427707=typeof _0x541fc2[_0x95f8('0x1b')]===_0x95f8('0x1c')&&typeof _0x541fc2[_0x95f8('0x1d')]===_0x95f8('0x1c');var _0x504373=_0x164cbf[_0x95f8('0x1e')];var _0x2c2fde=_0x427707?0x0:_0x541fc2[_0x95f8('0x1b')];var _0x31b481=_0x427707?_0x164cbf['count']:_0x541fc2['offset']+_0x541fc2[_0x95f8('0x1d')];var _0x4e1123;if(_0x31b481>=_0x504373){_0x31b481=_0x504373;_0x4e1123=0xc8;}else{_0x4e1123=0xce;}_0x55f481[_0x95f8('0x18')](_0x4e1123);return _0x55f481['set'](_0x95f8('0x1f'),_0x2c2fde+'-'+_0x31b481+'/'+_0x504373)[_0x95f8('0x1a')](_0x164cbf);}return null;};}function patchUpdates(_0x3c9266){return function(_0x307f17){try{jsonpatch[_0x95f8('0x20')](_0x307f17,_0x3c9266,!![]);}catch(_0x381589){return BPromise[_0x95f8('0x21')](_0x381589);}return _0x307f17[_0x95f8('0x22')]();};}function saveUpdates(_0x1bc4eb,_0x17c185){return function(_0x112788){if(_0x112788){return _0x112788[_0x95f8('0x23')](_0x1bc4eb)['then'](function(_0x5da4ca){return _0x5da4ca;});}return null;};}function removeEntity(_0xf6baba,_0x552347){return function(_0x490e1f){if(_0x490e1f){return _0x490e1f[_0x95f8('0x24')]()['then'](function(){_0xf6baba[_0x95f8('0x18')](0xcc)[_0x95f8('0x19')]();});}};}function handleEntityNotFound(_0x13cc46,_0x43f27c){return function(_0x2a53f3){if(!_0x2a53f3){_0x13cc46[_0x95f8('0x17')](0x194);}return _0x2a53f3;};}function handleError(_0x45cacd,_0x2d8157){_0x2d8157=_0x2d8157||0x1f4;return function(_0xbb85bb){logger['error'](_0xbb85bb[_0x95f8('0x25')]);if(_0xbb85bb['name']){delete _0xbb85bb[_0x95f8('0x26')];}_0x45cacd[_0x95f8('0x18')](_0x2d8157)[_0x95f8('0x27')](_0xbb85bb);};}exports[_0x95f8('0x28')]=function(_0x33fb32,_0x407f90){var _0x40cf0c={},_0x3b6942={},_0x227494={'count':0x0,'rows':[]};var _0x20deb9=_[_0x95f8('0x29')](db['VoiceDialReport'][_0x95f8('0x2a')],function(_0x15b9c5){return{'name':_0x15b9c5['fieldName'],'type':_0x15b9c5[_0x95f8('0x2b')]['key']};});_0x3b6942[_0x95f8('0x2c')]=_[_0x95f8('0x29')](_0x20deb9,_0x95f8('0x26'));_0x3b6942[_0x95f8('0x2d')]=_[_0x95f8('0x2e')](_0x33fb32[_0x95f8('0x2d')]);_0x3b6942[_0x95f8('0x2f')]=_[_0x95f8('0x30')](_0x3b6942[_0x95f8('0x2c')],_0x3b6942[_0x95f8('0x2d')]);_0x40cf0c[_0x95f8('0x31')]=_[_0x95f8('0x30')](_0x3b6942['model'],qs[_0x95f8('0x32')](_0x33fb32[_0x95f8('0x2d')][_0x95f8('0x32')]));_0x40cf0c[_0x95f8('0x31')]=_0x40cf0c[_0x95f8('0x31')][_0x95f8('0x33')]?_0x40cf0c[_0x95f8('0x31')]:_0x3b6942[_0x95f8('0x2c')];if(!_0x33fb32[_0x95f8('0x2d')][_0x95f8('0x34')](_0x95f8('0x35'))){_0x40cf0c[_0x95f8('0x1d')]=qs['limit'](_0x33fb32[_0x95f8('0x2d')]['limit']);_0x40cf0c[_0x95f8('0x1b')]=qs[_0x95f8('0x1b')](_0x33fb32[_0x95f8('0x2d')][_0x95f8('0x1b')]);}_0x40cf0c[_0x95f8('0x36')]=qs['sort'](_0x33fb32['query'][_0x95f8('0x37')]);_0x40cf0c[_0x95f8('0x38')]=qs[_0x95f8('0x2f')](_[_0x95f8('0x39')](_0x33fb32[_0x95f8('0x2d')],_0x3b6942[_0x95f8('0x2f')]),_0x20deb9);if(_0x33fb32['query'][_0x95f8('0x3a')]){_0x40cf0c[_0x95f8('0x38')]=_[_0x95f8('0x3b')](_0x40cf0c[_0x95f8('0x38')],{'$or':_[_0x95f8('0x29')](_0x20deb9,function(_0x3fe418){if(_0x3fe418[_0x95f8('0x2b')]!=='VIRTUAL'){var _0x1a41fe={};_0x1a41fe[_0x3fe418[_0x95f8('0x26')]]={'$like':'%'+_0x33fb32[_0x95f8('0x2d')][_0x95f8('0x3a')]+'%'};return _0x1a41fe;}})});}_0x40cf0c=_[_0x95f8('0x3b')]({},_0x40cf0c,_0x33fb32['options']);var _0x26289d={'where':_0x40cf0c[_0x95f8('0x38')]};return db['VoiceDialReport'][_0x95f8('0x1e')](_0x26289d)[_0x95f8('0x3c')](function(_0x3d2996){_0x227494['count']=_0x3d2996;if(_0x33fb32[_0x95f8('0x2d')]['includeAll']){_0x40cf0c[_0x95f8('0x3d')]=[{'all':!![]}];}return db[_0x95f8('0x3e')]['findAll'](_0x40cf0c);})['then'](function(_0xea090b){_0x227494[_0x95f8('0x3f')]=_0xea090b;return _0x227494;})[_0x95f8('0x3c')](respondWithFilteredResult(_0x407f90,_0x40cf0c))[_0x95f8('0x40')](handleError(_0x407f90,null));};exports[_0x95f8('0x41')]=function(_0x1dc3b8,_0x563fd8){var _0x21b589={'raw':!![],'where':{'id':_0x1dc3b8[_0x95f8('0x42')]['id']}},_0x4fe335={};_0x4fe335[_0x95f8('0x2c')]=_[_0x95f8('0x2e')](db[_0x95f8('0x3e')]['rawAttributes']);_0x4fe335[_0x95f8('0x2d')]=_[_0x95f8('0x2e')](_0x1dc3b8['query']);_0x4fe335[_0x95f8('0x2f')]=_['intersection'](_0x4fe335[_0x95f8('0x2c')],_0x4fe335[_0x95f8('0x2d')]);_0x21b589[_0x95f8('0x31')]=_[_0x95f8('0x30')](_0x4fe335[_0x95f8('0x2c')],qs[_0x95f8('0x32')](_0x1dc3b8['query'][_0x95f8('0x32')]));_0x21b589[_0x95f8('0x31')]=_0x21b589[_0x95f8('0x31')][_0x95f8('0x33')]?_0x21b589[_0x95f8('0x31')]:_0x4fe335[_0x95f8('0x2c')];if(_0x1dc3b8[_0x95f8('0x2d')]['includeAll']){_0x21b589['include']=[{'all':!![]}];}_0x21b589=_[_0x95f8('0x3b')]({},_0x21b589,_0x1dc3b8['options']);return db[_0x95f8('0x3e')][_0x95f8('0x43')](_0x21b589)[_0x95f8('0x3c')](handleEntityNotFound(_0x563fd8,null))[_0x95f8('0x3c')](respondWithResult(_0x563fd8,null))[_0x95f8('0x40')](handleError(_0x563fd8,null));};exports[_0x95f8('0x44')]=function(_0x2845af,_0xede34){return db[_0x95f8('0x3e')]['create'](_0x2845af['body'],{})[_0x95f8('0x3c')](respondWithResult(_0xede34,0xc9))[_0x95f8('0x40')](handleError(_0xede34,null));};exports[_0x95f8('0x23')]=function(_0x57fe11,_0x38579){if(_0x57fe11[_0x95f8('0x45')]['id']){delete _0x57fe11[_0x95f8('0x45')]['id'];}return db[_0x95f8('0x3e')][_0x95f8('0x43')]({'where':{'id':_0x57fe11[_0x95f8('0x42')]['id']}})[_0x95f8('0x3c')](handleEntityNotFound(_0x38579,null))[_0x95f8('0x3c')](saveUpdates(_0x57fe11['body'],null))[_0x95f8('0x3c')](respondWithResult(_0x38579,null))[_0x95f8('0x40')](handleError(_0x38579,null));};exports[_0x95f8('0x24')]=function(_0x3363b2,_0x2571ac){return db[_0x95f8('0x3e')]['find']({'where':{'id':_0x3363b2[_0x95f8('0x42')]['id']}})[_0x95f8('0x3c')](handleEntityNotFound(_0x2571ac,null))[_0x95f8('0x3c')](removeEntity(_0x2571ac,null))['catch'](handleError(_0x2571ac,null));};exports['describe']=function(_0x4c485f,_0x428ca3){return db[_0x95f8('0x3e')][_0x95f8('0x46')]()[_0x95f8('0x3c')](respondWithResult(_0x428ca3,null))[_0x95f8('0x40')](handleError(_0x428ca3,null));}; \ No newline at end of file +var _0xc83b=['index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xc83b,0x164));var _0xbc83=function(_0x29c4ed,_0x2d0586){_0x29c4ed=_0x29c4ed-0x0;var _0x4fcf0c=_0xc83b[_0x29c4ed];return _0x4fcf0c;};'use strict';var emlformat=require(_0xbc83('0x0'));var rimraf=require(_0xbc83('0x1'));var zipdir=require(_0xbc83('0x2'));var jsonpatch=require(_0xbc83('0x3'));var rp=require(_0xbc83('0x4'));var moment=require(_0xbc83('0x5'));var BPromise=require(_0xbc83('0x6'));var Mustache=require(_0xbc83('0x7'));var util=require('util');var path=require(_0xbc83('0x8'));var sox=require(_0xbc83('0x9'));var csv=require(_0xbc83('0xa'));var ejs=require(_0xbc83('0xb'));var fs=require('fs');var fs_extra=require(_0xbc83('0xc'));var _=require(_0xbc83('0xd'));var squel=require('squel');var crypto=require(_0xbc83('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbc83('0xf'));var toCsv=require(_0xbc83('0xa'));var querystring=require(_0xbc83('0x10'));var Papa=require(_0xbc83('0x11'));var Redis=require(_0xbc83('0x12'));var authService=require(_0xbc83('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbc83('0x14'));var hardwareService=require(_0xbc83('0x15'));var logger=require(_0xbc83('0x16'))('api');var utils=require(_0xbc83('0x17'));var config=require(_0xbc83('0x18'));var licenseUtil=require(_0xbc83('0x19'));var db=require(_0xbc83('0x1a'))['db'];function respondWithStatusCode(_0x22380d,_0x4fb666){_0x4fb666=_0x4fb666||0xcc;return function(_0x46aacb){if(_0x46aacb){return _0x22380d[_0xbc83('0x1b')](_0x4fb666);}return _0x22380d['status'](_0x4fb666)[_0xbc83('0x1c')]();};}function respondWithResult(_0x529134,_0x141a6c){_0x141a6c=_0x141a6c||0xc8;return function(_0x1bfec2){if(_0x1bfec2){return _0x529134[_0xbc83('0x1d')](_0x141a6c)[_0xbc83('0x1e')](_0x1bfec2);}};}function respondWithFilteredResult(_0x3068fb,_0x2556d9){return function(_0x49406c){if(_0x49406c){var _0x1d6e4a=typeof _0x2556d9['offset']==='undefined'&&typeof _0x2556d9['limit']==='undefined';var _0x15745e=_0x49406c[_0xbc83('0x1f')];var _0x34833f=_0x1d6e4a?0x0:_0x2556d9[_0xbc83('0x20')];var _0x305f78=_0x1d6e4a?_0x49406c['count']:_0x2556d9[_0xbc83('0x20')]+_0x2556d9[_0xbc83('0x21')];var _0x4743f6;if(_0x305f78>=_0x15745e){_0x305f78=_0x15745e;_0x4743f6=0xc8;}else{_0x4743f6=0xce;}_0x3068fb['status'](_0x4743f6);return _0x3068fb[_0xbc83('0x22')](_0xbc83('0x23'),_0x34833f+'-'+_0x305f78+'/'+_0x15745e)[_0xbc83('0x1e')](_0x49406c);}return null;};}function patchUpdates(_0x248464){return function(_0x4f7e88){try{jsonpatch[_0xbc83('0x24')](_0x4f7e88,_0x248464,!![]);}catch(_0x2403cd){return BPromise['reject'](_0x2403cd);}return _0x4f7e88[_0xbc83('0x25')]();};}function saveUpdates(_0x3bc52d,_0x8be75){return function(_0x3d8020){if(_0x3d8020){return _0x3d8020[_0xbc83('0x26')](_0x3bc52d)[_0xbc83('0x27')](function(_0x37168a){return _0x37168a;});}return null;};}function removeEntity(_0x2e456d,_0x39486e){return function(_0xfbdd9f){if(_0xfbdd9f){return _0xfbdd9f[_0xbc83('0x28')]()[_0xbc83('0x27')](function(){_0x2e456d[_0xbc83('0x1d')](0xcc)[_0xbc83('0x1c')]();});}};}function handleEntityNotFound(_0x1ef150,_0x3c2f75){return function(_0x396922){if(!_0x396922){_0x1ef150[_0xbc83('0x1b')](0x194);}return _0x396922;};}function handleError(_0x2d7331,_0x2a1b61){_0x2a1b61=_0x2a1b61||0x1f4;return function(_0x5cb54f){logger[_0xbc83('0x29')](_0x5cb54f[_0xbc83('0x2a')]);if(_0x5cb54f[_0xbc83('0x2b')]){delete _0x5cb54f[_0xbc83('0x2b')];}_0x2d7331[_0xbc83('0x1d')](_0x2a1b61)['send'](_0x5cb54f);};}exports[_0xbc83('0x2c')]=function(_0x2ecf9b,_0x2ea85a){var _0x489111={},_0x3433b2={},_0x4928e6={'count':0x0,'rows':[]};var _0x3e3b0a=_[_0xbc83('0x2d')](db[_0xbc83('0x2e')][_0xbc83('0x2f')],function(_0x1b59fd){return{'name':_0x1b59fd[_0xbc83('0x30')],'type':_0x1b59fd[_0xbc83('0x31')][_0xbc83('0x32')]};});_0x3433b2[_0xbc83('0x33')]=_[_0xbc83('0x2d')](_0x3e3b0a,_0xbc83('0x2b'));_0x3433b2[_0xbc83('0x34')]=_['keys'](_0x2ecf9b[_0xbc83('0x34')]);_0x3433b2[_0xbc83('0x35')]=_[_0xbc83('0x36')](_0x3433b2[_0xbc83('0x33')],_0x3433b2[_0xbc83('0x34')]);_0x489111['attributes']=_[_0xbc83('0x36')](_0x3433b2[_0xbc83('0x33')],qs[_0xbc83('0x37')](_0x2ecf9b[_0xbc83('0x34')][_0xbc83('0x37')]));_0x489111[_0xbc83('0x38')]=_0x489111[_0xbc83('0x38')]['length']?_0x489111[_0xbc83('0x38')]:_0x3433b2[_0xbc83('0x33')];if(!_0x2ecf9b[_0xbc83('0x34')][_0xbc83('0x39')](_0xbc83('0x3a'))){_0x489111['limit']=qs[_0xbc83('0x21')](_0x2ecf9b[_0xbc83('0x34')][_0xbc83('0x21')]);_0x489111[_0xbc83('0x20')]=qs['offset'](_0x2ecf9b['query']['offset']);}_0x489111[_0xbc83('0x3b')]=qs[_0xbc83('0x3c')](_0x2ecf9b[_0xbc83('0x34')]['sort']);_0x489111[_0xbc83('0x3d')]=qs['filters'](_[_0xbc83('0x3e')](_0x2ecf9b[_0xbc83('0x34')],_0x3433b2['filters']),_0x3e3b0a);if(_0x2ecf9b[_0xbc83('0x34')]['filter']){_0x489111[_0xbc83('0x3d')]=_[_0xbc83('0x3f')](_0x489111[_0xbc83('0x3d')],{'$or':_['map'](_0x3e3b0a,function(_0x5da3ca){if(_0x5da3ca[_0xbc83('0x31')]!==_0xbc83('0x40')){var _0x3e3367={};_0x3e3367[_0x5da3ca[_0xbc83('0x2b')]]={'$like':'%'+_0x2ecf9b[_0xbc83('0x34')][_0xbc83('0x41')]+'%'};return _0x3e3367;}})});}_0x489111=_['merge']({},_0x489111,_0x2ecf9b[_0xbc83('0x42')]);var _0x4fe96c={'where':_0x489111['where']};return db[_0xbc83('0x2e')][_0xbc83('0x1f')](_0x4fe96c)[_0xbc83('0x27')](function(_0x4de433){_0x4928e6[_0xbc83('0x1f')]=_0x4de433;if(_0x2ecf9b[_0xbc83('0x34')][_0xbc83('0x43')]){_0x489111[_0xbc83('0x44')]=[{'all':!![]}];}return db[_0xbc83('0x2e')][_0xbc83('0x45')](_0x489111);})[_0xbc83('0x27')](function(_0x5acb06){_0x4928e6[_0xbc83('0x46')]=_0x5acb06;return _0x4928e6;})[_0xbc83('0x27')](respondWithFilteredResult(_0x2ea85a,_0x489111))[_0xbc83('0x47')](handleError(_0x2ea85a,null));};exports[_0xbc83('0x48')]=function(_0x38e59a,_0x49560d){var _0x260e4d={'raw':!![],'where':{'id':_0x38e59a['params']['id']}},_0x4dd06d={};_0x4dd06d[_0xbc83('0x33')]=_['keys'](db[_0xbc83('0x2e')]['rawAttributes']);_0x4dd06d[_0xbc83('0x34')]=_[_0xbc83('0x49')](_0x38e59a[_0xbc83('0x34')]);_0x4dd06d['filters']=_[_0xbc83('0x36')](_0x4dd06d[_0xbc83('0x33')],_0x4dd06d[_0xbc83('0x34')]);_0x260e4d[_0xbc83('0x38')]=_[_0xbc83('0x36')](_0x4dd06d['model'],qs['fields'](_0x38e59a['query'][_0xbc83('0x37')]));_0x260e4d['attributes']=_0x260e4d[_0xbc83('0x38')][_0xbc83('0x4a')]?_0x260e4d[_0xbc83('0x38')]:_0x4dd06d[_0xbc83('0x33')];if(_0x38e59a[_0xbc83('0x34')][_0xbc83('0x43')]){_0x260e4d[_0xbc83('0x44')]=[{'all':!![]}];}_0x260e4d=_[_0xbc83('0x3f')]({},_0x260e4d,_0x38e59a[_0xbc83('0x42')]);return db[_0xbc83('0x2e')][_0xbc83('0x4b')](_0x260e4d)[_0xbc83('0x27')](handleEntityNotFound(_0x49560d,null))[_0xbc83('0x27')](respondWithResult(_0x49560d,null))['catch'](handleError(_0x49560d,null));};exports['create']=function(_0x219cd4,_0x2a937a){return db[_0xbc83('0x2e')][_0xbc83('0x4c')](_0x219cd4[_0xbc83('0x4d')],{})['then'](respondWithResult(_0x2a937a,0xc9))[_0xbc83('0x47')](handleError(_0x2a937a,null));};exports[_0xbc83('0x26')]=function(_0x1f83ea,_0x1f911e){if(_0x1f83ea['body']['id']){delete _0x1f83ea[_0xbc83('0x4d')]['id'];}return db[_0xbc83('0x2e')][_0xbc83('0x4b')]({'where':{'id':_0x1f83ea['params']['id']}})[_0xbc83('0x27')](handleEntityNotFound(_0x1f911e,null))[_0xbc83('0x27')](saveUpdates(_0x1f83ea[_0xbc83('0x4d')],null))[_0xbc83('0x27')](respondWithResult(_0x1f911e,null))[_0xbc83('0x47')](handleError(_0x1f911e,null));};exports[_0xbc83('0x28')]=function(_0x643f02,_0x4387ef){return db[_0xbc83('0x2e')][_0xbc83('0x4b')]({'where':{'id':_0x643f02[_0xbc83('0x4e')]['id']}})[_0xbc83('0x27')](handleEntityNotFound(_0x4387ef,null))[_0xbc83('0x27')](removeEntity(_0x4387ef,null))[_0xbc83('0x47')](handleError(_0x4387ef,null));};exports[_0xbc83('0x4f')]=function(_0x5f1c0c,_0x5e8638){return db[_0xbc83('0x2e')][_0xbc83('0x4f')]()[_0xbc83('0x27')](respondWithResult(_0x5e8638,null))[_0xbc83('0x47')](handleError(_0x5e8638,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ed25279..c1e64f4 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 _0xbf07=['define','report_dial','lodash','util','../../config/logger','api','bluebird','request-promise','./voiceDialReport.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbf07,0x77));var _0x7bf0=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0xbf07[_0xc40b9f];return _0x535b9c;};'use strict';var _=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var logger=require(_0x7bf0('0x2'))(_0x7bf0('0x3'));var moment=require('moment');var BPromise=require(_0x7bf0('0x4'));var rp=require(_0x7bf0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7bf0('0x6'));module['exports']=function(_0x5d2b76,_0x4a925d){return _0x5d2b76[_0x7bf0('0x7')]('VoiceDialReport',attributes,{'tableName':_0x7bf0('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4971=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_dial','lodash'];(function(_0x12b6ba,_0xda3834){var _0x21c1ce=function(_0x367255){while(--_0x367255){_0x12b6ba['push'](_0x12b6ba['shift']());}};_0x21c1ce(++_0xda3834);}(_0x4971,0xa4));var _0x1497=function(_0x9489f0,_0x23eb38){_0x9489f0=_0x9489f0-0x0;var _0x845027=_0x4971[_0x9489f0];return _0x845027;};'use strict';var _=require(_0x1497('0x0'));var util=require('util');var logger=require(_0x1497('0x1'))(_0x1497('0x2'));var moment=require(_0x1497('0x3'));var BPromise=require(_0x1497('0x4'));var rp=require(_0x1497('0x5'));var fs=require('fs');var path=require(_0x1497('0x6'));var rimraf=require(_0x1497('0x7'));var config=require(_0x1497('0x8'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x57b934,_0x53edf1){return _0x57b934[_0x1497('0x9')]('VoiceDialReport',attributes,{'tableName':_0x1497('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9d81ecf..8bf863e 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 _0xb80a=['UpdateVoiceDialReport','VoiceDialReport','update','raw','where','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','create','body','options','CreateVoiceDialReport'];(function(_0x43c12f,_0x1ce427){var _0x4a4266=function(_0x305573){while(--_0x305573){_0x43c12f['push'](_0x43c12f['shift']());}};_0x4a4266(++_0x1ce427);}(_0xb80a,0x138));var _0xab80=function(_0x257911,_0x2c9bdd){_0x257911=_0x257911-0x0;var _0x442edf=_0xb80a[_0x257911];return _0x442edf;};'use strict';var _=require('lodash');var util=require(_0xab80('0x0'));var moment=require(_0xab80('0x1'));var BPromise=require(_0xab80('0x2'));var rs=require(_0xab80('0x3'));var fs=require('fs');var Redis=require(_0xab80('0x4'));var db=require(_0xab80('0x5'))['db'];var utils=require(_0xab80('0x6'));var logger=require(_0xab80('0x7'))(_0xab80('0x8'));var config=require(_0xab80('0x9'));var jayson=require(_0xab80('0xa'));var client=jayson[_0xab80('0xb')][_0xab80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50e344,_0xc2f754,_0x1560f2){return new BPromise(function(_0x2ed9b5,_0xa730fb){return client[_0xab80('0xd')](_0x50e344,_0x1560f2)['then'](function(_0x4b1a22){logger[_0xab80('0xe')](_0xab80('0xf'),_0xc2f754,'request\x20sent');logger[_0xab80('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xc2f754,_0xab80('0x11'),JSON[_0xab80('0x12')](_0x4b1a22));if(_0x4b1a22[_0xab80('0x13')]){if(_0x4b1a22[_0xab80('0x13')][_0xab80('0x14')]===0x1f4){logger[_0xab80('0x13')](_0xab80('0xf'),_0xc2f754,_0x4b1a22[_0xab80('0x13')][_0xab80('0x15')]);return _0xa730fb(_0x4b1a22[_0xab80('0x13')]['message']);}logger[_0xab80('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0xc2f754,_0x4b1a22[_0xab80('0x13')][_0xab80('0x15')]);return _0x2ed9b5(_0x4b1a22[_0xab80('0x13')][_0xab80('0x15')]);}else{logger[_0xab80('0xe')](_0xab80('0xf'),_0xc2f754,'request\x20sent');_0x2ed9b5(_0x4b1a22[_0xab80('0x16')][_0xab80('0x15')]);}})[_0xab80('0x17')](function(_0x17824c){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0xc2f754,_0x17824c);_0xa730fb(_0x17824c);});});}exports['CreateVoiceDialReport']=function(_0x3f25e3){var _0x54b29d=this;return new Promise(function(_0x55ee94,_0x4faf6c){return db['VoiceDialReport'][_0xab80('0x18')](_0x3f25e3[_0xab80('0x19')],{'raw':_0x3f25e3[_0xab80('0x1a')]?_0x3f25e3[_0xab80('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2958ff){logger[_0xab80('0xe')](_0xab80('0x1b'),_0x3f25e3);logger[_0xab80('0x10')](_0xab80('0x1b'),_0x3f25e3,JSON[_0xab80('0x12')](_0x2958ff));_0x55ee94(_0x2958ff);})['catch'](function(_0x10f58b){logger['error'](_0xab80('0x1b'),_0x10f58b['message'],_0x3f25e3);_0x4faf6c(_0x54b29d[_0xab80('0x13')](0x1f4,_0x10f58b[_0xab80('0x15')]));});});};exports[_0xab80('0x1c')]=function(_0x32f937){var _0x351837=this;return new Promise(function(_0x3107cf,_0x2374f1){return db[_0xab80('0x1d')][_0xab80('0x1e')](_0x32f937['body'],{'raw':_0x32f937[_0xab80('0x1a')]?_0x32f937[_0xab80('0x1a')][_0xab80('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32f937[_0xab80('0x1a')]?_0x32f937[_0xab80('0x1a')][_0xab80('0x20')]||null:null,'attributes':_0x32f937[_0xab80('0x1a')]?_0x32f937[_0xab80('0x1a')]['attributes']||null:null,'limit':_0x32f937['options']?_0x32f937[_0xab80('0x1a')]['limit']||null:null})[_0xab80('0x21')](function(_0x286cb1){logger[_0xab80('0xe')]('UpdateVoiceDialReport',_0x32f937);logger[_0xab80('0x10')](_0xab80('0x1c'),_0x32f937,JSON[_0xab80('0x12')](_0x286cb1));_0x3107cf(_0x286cb1);})['catch'](function(_0x248f6c){logger[_0xab80('0x13')](_0xab80('0x1c'),_0x248f6c[_0xab80('0x15')],_0x32f937);_0x2374f1(_0x351837[_0xab80('0x13')](0x1f4,_0x248f6c[_0xab80('0x15')]));});});}; \ No newline at end of file +var _0x6b36=['VoiceDialReport','create','options','catch','CreateVoiceDialReport','UpdateVoiceDialReport','update','body','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2b1df3,_0x26a5e3){var _0x513430=function(_0x1df55f){while(--_0x1df55f){_0x2b1df3['push'](_0x2b1df3['shift']());}};_0x513430(++_0x26a5e3);}(_0x6b36,0x6e));var _0x66b3=function(_0x3a2da9,_0x453dcc){_0x3a2da9=_0x3a2da9-0x0;var _0x3d275e=_0x6b36[_0x3a2da9];return _0x3d275e;};'use strict';var _=require('lodash');var util=require(_0x66b3('0x0'));var moment=require(_0x66b3('0x1'));var BPromise=require(_0x66b3('0x2'));var rs=require(_0x66b3('0x3'));var fs=require('fs');var Redis=require(_0x66b3('0x4'));var db=require(_0x66b3('0x5'))['db'];var utils=require(_0x66b3('0x6'));var logger=require('../../config/logger')(_0x66b3('0x7'));var config=require('../../config/environment');var jayson=require(_0x66b3('0x8'));var client=jayson['client'][_0x66b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1521a9,_0x5d52ee,_0x3ff77c){return new BPromise(function(_0x551688,_0x4b76f6){return client[_0x66b3('0xa')](_0x1521a9,_0x3ff77c)[_0x66b3('0xb')](function(_0xe05d2c){logger[_0x66b3('0xc')](_0x66b3('0xd'),_0x5d52ee,'request\x20sent');logger[_0x66b3('0xe')](_0x66b3('0xf'),_0x5d52ee,_0x66b3('0x10'),JSON[_0x66b3('0x11')](_0xe05d2c));if(_0xe05d2c[_0x66b3('0x12')]){if(_0xe05d2c[_0x66b3('0x12')][_0x66b3('0x13')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x5d52ee,_0xe05d2c['error'][_0x66b3('0x14')]);return _0x4b76f6(_0xe05d2c[_0x66b3('0x12')][_0x66b3('0x14')]);}logger['error'](_0x66b3('0xd'),_0x5d52ee,_0xe05d2c[_0x66b3('0x12')]['message']);return _0x551688(_0xe05d2c['error'][_0x66b3('0x14')]);}else{logger['info'](_0x66b3('0xd'),_0x5d52ee,_0x66b3('0x10'));_0x551688(_0xe05d2c[_0x66b3('0x15')][_0x66b3('0x14')]);}})['catch'](function(_0x191924){logger[_0x66b3('0x12')](_0x66b3('0xd'),_0x5d52ee,_0x191924);_0x4b76f6(_0x191924);});});}exports['CreateVoiceDialReport']=function(_0x100ded){var _0x3a1c13=this;return new Promise(function(_0x27cb25,_0x36465a){return db[_0x66b3('0x16')][_0x66b3('0x17')](_0x100ded['body'],{'raw':_0x100ded[_0x66b3('0x18')]?_0x100ded[_0x66b3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x66b3('0xb')](function(_0x3890ff){logger[_0x66b3('0xc')]('CreateVoiceDialReport',_0x100ded);logger[_0x66b3('0xe')]('CreateVoiceDialReport',_0x100ded,JSON['stringify'](_0x3890ff));_0x27cb25(_0x3890ff);})[_0x66b3('0x19')](function(_0x19d81c){logger['error'](_0x66b3('0x1a'),_0x19d81c[_0x66b3('0x14')],_0x100ded);_0x36465a(_0x3a1c13[_0x66b3('0x12')](0x1f4,_0x19d81c['message']));});});};exports[_0x66b3('0x1b')]=function(_0x23a435){var _0x35a3ce=this;return new Promise(function(_0x2a842c,_0x41824d){return db['VoiceDialReport'][_0x66b3('0x1c')](_0x23a435[_0x66b3('0x1d')],{'raw':_0x23a435[_0x66b3('0x18')]?_0x23a435[_0x66b3('0x18')][_0x66b3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23a435[_0x66b3('0x18')]?_0x23a435['options']['where']||null:null,'attributes':_0x23a435['options']?_0x23a435[_0x66b3('0x18')][_0x66b3('0x1f')]||null:null,'limit':_0x23a435[_0x66b3('0x18')]?_0x23a435[_0x66b3('0x18')][_0x66b3('0x20')]||null:null})[_0x66b3('0xb')](function(_0x298a3e){logger['info'](_0x66b3('0x1b'),_0x23a435);logger[_0x66b3('0xe')]('UpdateVoiceDialReport',_0x23a435,JSON[_0x66b3('0x11')](_0x298a3e));_0x2a842c(_0x298a3e);})[_0x66b3('0x19')](function(_0x3547ca){logger[_0x66b3('0x12')](_0x66b3('0x1b'),_0x3547ca['message'],_0x23a435);_0x41824d(_0x35a3ce[_0x66b3('0x12')](0x1f4,_0x3547ca[_0x66b3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 250283b..037941e 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 _0x92aa=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','fs-extra'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x92aa,0x98));var _0xa92a=function(_0x5dd373,_0x4bf7c3){_0x5dd373=_0x5dd373-0x0;var _0x26943c=_0x92aa[_0x5dd373];return _0x26943c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa92a('0x0'));var auth=require(_0xa92a('0x1'));var interaction=require(_0xa92a('0x2'));var config=require(_0xa92a('0x3'));var controller=require(_0xa92a('0x4'));router[_0xa92a('0x5')]('/',auth[_0xa92a('0x6')](),controller['index']);router[_0xa92a('0x5')](_0xa92a('0x7'),auth[_0xa92a('0x6')](),controller[_0xa92a('0x8')]);router[_0xa92a('0x9')]('/',auth['isAuthenticated'](),controller[_0xa92a('0xa')]);router[_0xa92a('0x9')](_0xa92a('0xb'),auth['isAuthenticated'](),controller[_0xa92a('0xc')]);router[_0xa92a('0xd')]('/:id',auth[_0xa92a('0x6')](),controller['update']);router[_0xa92a('0xe')](_0xa92a('0x7'),auth[_0xa92a('0x6')](),controller[_0xa92a('0xf')]);module[_0xa92a('0x10')]=router; \ No newline at end of file +var _0x61a2=['delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put'];(function(_0x5a76f2,_0x19b1a8){var _0x5a3485=function(_0x2f3f19){while(--_0x2f3f19){_0x5a76f2['push'](_0x5a76f2['shift']());}};_0x5a3485(++_0x19b1a8);}(_0x61a2,0x10c));var _0x261a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x61a2[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x261a('0x0'));var util=require(_0x261a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x261a('0x2'));var router=express[_0x261a('0x3')]();var fs_extra=require(_0x261a('0x4'));var auth=require(_0x261a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x261a('0x6'));var controller=require(_0x261a('0x7'));router[_0x261a('0x8')]('/',auth[_0x261a('0x9')](),controller['index']);router['get'](_0x261a('0xa'),auth[_0x261a('0x9')](),controller[_0x261a('0xb')]);router[_0x261a('0xc')]('/',auth['isAuthenticated'](),controller[_0x261a('0xd')]);router[_0x261a('0xc')](_0x261a('0xe'),auth[_0x261a('0x9')](),controller[_0x261a('0xf')]);router[_0x261a('0x10')](_0x261a('0xa'),auth[_0x261a('0x9')](),controller['update']);router[_0x261a('0x11')](_0x261a('0xa'),auth[_0x261a('0x9')](),controller[_0x261a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 1a727eb..3153ed6 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 _0xecd8=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','sequelize','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','any'];(function(_0x59cbf2,_0x13db7a){var _0x4449e6=function(_0x3d3bae){while(--_0x3d3bae){_0x59cbf2['push'](_0x59cbf2['shift']());}};_0x4449e6(++_0x13db7a);}(_0xecd8,0x15e));var _0x8ecd=function(_0x2a8122,_0x11aad9){_0x2a8122=_0x2a8122-0x0;var _0x15b84d=_0xecd8[_0x2a8122];return _0x15b84d;};'use strict';var Sequelize=require(_0x8ecd('0x0'));module['exports']={'context':{'type':Sequelize[_0x8ecd('0x1')],'allowNull':![],'unique':_0x8ecd('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x8ecd('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x8ecd('0x1')],'allowNull':![],'defaultValue':_0x8ecd('0x3')},'appdata':{'type':Sequelize[_0x8ecd('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x8ecd('0x4'),_0x8ecd('0x5'),_0x8ecd('0x6'),_0x8ecd('0x7'),_0x8ecd('0x8'),'system',_0x8ecd('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8ecd('0x1')],'allowNull':![],'defaultValue':_0x8ecd('0xa')},'IntervalId':{'type':Sequelize[_0x8ecd('0xb')]},'isApp':{'type':Sequelize[_0x8ecd('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x8ecd('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x8ecd('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x8ecd('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x8ecd('0xb')]},'recordingFormat':{'type':Sequelize[_0x8ecd('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x8ecd('0xd')],'get':function(_0x3d27e4){return this['getDataValue'](_0x8ecd('0xe'));}},'alias':{'type':Sequelize[_0x8ecd('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x43d3=['inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal'];(function(_0x103f63,_0xa7544c){var _0x21b175=function(_0x24c702){while(--_0x24c702){_0x103f63['push'](_0x103f63['shift']());}};_0x21b175(++_0xa7544c);}(_0x43d3,0xee));var _0x343d=function(_0x4d3c2a,_0x57474c){_0x4d3c2a=_0x4d3c2a-0x0;var _0x962a46=_0x43d3[_0x4d3c2a];return _0x962a46;};'use strict';var Sequelize=require(_0x343d('0x0'));module[_0x343d('0x1')]={'context':{'type':Sequelize[_0x343d('0x2')],'allowNull':![],'unique':_0x343d('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x343d('0x2')],'allowNull':![],'unique':_0x343d('0x3')},'priority':{'type':Sequelize[_0x343d('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x343d('0x3')},'tag':{'type':Sequelize[_0x343d('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x343d('0x2')],'allowNull':![],'defaultValue':_0x343d('0x4')},'appdata':{'type':Sequelize[_0x343d('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x343d('0x5')](_0x343d('0x6'),_0x343d('0x7'),_0x343d('0x8'),_0x343d('0x9'),_0x343d('0xa'),'system',_0x343d('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x343d('0x2')]},'interval':{'type':Sequelize[_0x343d('0x2')],'allowNull':![],'defaultValue':_0x343d('0xc')},'IntervalId':{'type':Sequelize[_0x343d('0xd')]},'isApp':{'type':Sequelize[_0x343d('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x343d('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x343d('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x343d('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x343d('0xd')]},'recordingFormat':{'type':Sequelize[_0x343d('0x2')],'defaultValue':_0x343d('0xf')},'answer':{'type':Sequelize[_0x343d('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x343d('0x10')],'get':function(_0x17c95f){return this[_0x343d('0x11')](_0x343d('0x12'));}},'alias':{'type':Sequelize[_0x343d('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 9b5b970..21b8e77 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 _0x0bb5=['type','find','UserProfileResource','then','error','name','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','options','includeAll','include','findAll','catch','show','merge','params','create','startsWith','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','alias','addApplications','findOne','sequelize','VoiceExtensionId','createRouting','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','json','offset','undefined','count','limit','status','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','outbound','filter','ignore','map','value','includes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0bb5,0x148));var _0x50bb=function(_0x379e09,_0x199026){_0x379e09=_0x379e09-0x0;var _0x32a654=_0x0bb5[_0x379e09];return _0x32a654;};'use strict';var _=require(_0x50bb('0x0'));var Redis=require(_0x50bb('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x50bb('0x2'));var config=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];config[_0x50bb('0x5')]=_[_0x50bb('0x6')](config[_0x50bb('0x5')],{'host':_0x50bb('0x7'),'port':0x18eb});var socket=require(_0x50bb('0x8'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x50bb('0x9')](socket);function respondWithStatusCode(_0x35de5d,_0x2e5463){_0x2e5463=_0x2e5463||0xcc;return function(_0x33ff54){if(_0x33ff54){return _0x35de5d['sendStatus'](_0x2e5463);}return _0x35de5d['status'](_0x2e5463)[_0x50bb('0xa')]();};}function respondWithResult(_0x1c2174,_0x3ae598){_0x3ae598=_0x3ae598||0xc8;return function(_0x239a89){if(_0x239a89){return _0x1c2174['status'](_0x3ae598)[_0x50bb('0xb')](_0x239a89);}};}function respondWithFilteredResult(_0x2edeeb,_0x184d06){return function(_0x41055d){if(_0x41055d){var _0x346422=typeof _0x184d06[_0x50bb('0xc')]===_0x50bb('0xd')&&typeof _0x184d06['limit']===_0x50bb('0xd');var _0x58837d=_0x41055d[_0x50bb('0xe')];var _0xd8ab27=_0x346422?0x0:_0x184d06[_0x50bb('0xc')];var _0x502250=_0x346422?_0x41055d[_0x50bb('0xe')]:_0x184d06[_0x50bb('0xc')]+_0x184d06[_0x50bb('0xf')];var _0x5244b0;if(_0x502250>=_0x58837d){_0x502250=_0x58837d;_0x5244b0=0xc8;}else{_0x5244b0=0xce;}_0x2edeeb[_0x50bb('0x10')](_0x5244b0);return _0x2edeeb['set'](_0x50bb('0x11'),_0xd8ab27+'-'+_0x502250+'/'+_0x58837d)[_0x50bb('0xb')](_0x41055d);}return null;};}function removeEntity(_0x253073){return function(_0x42ffab){if(_0x42ffab){return _0x42ffab[_0x50bb('0x12')]()['then'](function(){var _0x10a191=_0x42ffab[_0x50bb('0x13')]({'plain':!![]});var _0x4b1f5f=[{'name':_0x50bb('0x14'),'value':'inbound','ignore':![]},{'name':_0x50bb('0x15'),'value':_0x50bb('0x16'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x43465b=_(_0x4b1f5f)[_0x50bb('0x17')](_0x50bb('0x18'))[_0x50bb('0x19')]('value')[_0x50bb('0x1a')]();if(_[_0x50bb('0x1b')](_0x43465b,_0x10a191[_0x50bb('0x1c')])){return;}var _0x597e95=_[_0x50bb('0x1d')](_0x4b1f5f,[_0x50bb('0x1a'),_0x10a191[_0x50bb('0x1c')]])['name'];return db[_0x50bb('0x1e')]['destroy']({'where':{'type':_0x597e95,'resourceId':_0x10a191['id']}})[_0x50bb('0x1f')](function(){return _0x42ffab;});})[_0x50bb('0x1f')](function(){_0x253073[_0x50bb('0x10')](0xcc)[_0x50bb('0xa')]();});}};}function handleEntityNotFound(_0x846311){return function(_0x342078){if(!_0x342078){_0x846311['sendStatus'](0x194);}return _0x342078;};}function handleError(_0xad17ac,_0xee0af0){_0xee0af0=_0xee0af0||0x1f4;return function(_0x284a76){logger[_0x50bb('0x20')](_0x284a76['stack']);if(_0x284a76[_0x50bb('0x21')]){delete _0x284a76['name'];}_0xad17ac['status'](_0xee0af0)[_0x50bb('0x22')](_0x284a76);};}exports['index']=function(_0x5cfe4b,_0x41fd89){var _0x12ee2c={},_0x3004a3={},_0x1b74f9={'count':0x0,'rows':[]};var _0x17c158=_[_0x50bb('0x19')](db[_0x50bb('0x23')][_0x50bb('0x24')],function(_0x4f7514){return{'name':_0x4f7514[_0x50bb('0x25')],'type':_0x4f7514[_0x50bb('0x1c')][_0x50bb('0x26')]};});_0x3004a3[_0x50bb('0x27')]=_['map'](_0x17c158,_0x50bb('0x21'));_0x3004a3[_0x50bb('0x28')]=_[_0x50bb('0x29')](_0x5cfe4b[_0x50bb('0x28')]);_0x3004a3[_0x50bb('0x2a')]=_[_0x50bb('0x2b')](_0x3004a3[_0x50bb('0x27')],_0x3004a3[_0x50bb('0x28')]);_0x12ee2c[_0x50bb('0x2c')]=_[_0x50bb('0x2b')](_0x3004a3[_0x50bb('0x27')],qs[_0x50bb('0x2d')](_0x5cfe4b['query'][_0x50bb('0x2d')]));_0x12ee2c[_0x50bb('0x2c')]=_0x12ee2c[_0x50bb('0x2c')][_0x50bb('0x2e')]?_0x12ee2c[_0x50bb('0x2c')]:_0x3004a3[_0x50bb('0x27')];if(!_0x5cfe4b[_0x50bb('0x28')][_0x50bb('0x2f')](_0x50bb('0x30'))){_0x12ee2c[_0x50bb('0xf')]=qs[_0x50bb('0xf')](_0x5cfe4b['query'][_0x50bb('0xf')]);_0x12ee2c[_0x50bb('0xc')]=qs[_0x50bb('0xc')](_0x5cfe4b[_0x50bb('0x28')][_0x50bb('0xc')]);}_0x12ee2c[_0x50bb('0x31')]=qs['sort'](_0x5cfe4b['query'][_0x50bb('0x32')]);_0x12ee2c['where']=qs[_0x50bb('0x2a')](_[_0x50bb('0x33')](_0x5cfe4b[_0x50bb('0x28')],_0x3004a3[_0x50bb('0x2a')]),_0x17c158);if(_0x5cfe4b[_0x50bb('0x28')]['filter']){_0x12ee2c[_0x50bb('0x34')]=_['merge'](_0x12ee2c[_0x50bb('0x34')],{'$or':_[_0x50bb('0x19')](_0x17c158,function(_0x280e5a){if(_0x280e5a['type']!=='VIRTUAL'){var _0x1df163={};_0x1df163[_0x280e5a[_0x50bb('0x21')]]={'$like':'%'+_0x5cfe4b[_0x50bb('0x28')][_0x50bb('0x17')]+'%'};return _0x1df163;}})});}_0x12ee2c=_['merge']({},_0x12ee2c,_0x5cfe4b[_0x50bb('0x35')]);var _0x4b75dc={'where':_0x12ee2c['where']};return db[_0x50bb('0x23')]['count'](_0x4b75dc)[_0x50bb('0x1f')](function(_0x3d94b8){_0x1b74f9[_0x50bb('0xe')]=_0x3d94b8;if(_0x5cfe4b[_0x50bb('0x28')][_0x50bb('0x36')]){_0x12ee2c[_0x50bb('0x37')]=[{'all':!![]}];}return db[_0x50bb('0x23')][_0x50bb('0x38')](_0x12ee2c);})[_0x50bb('0x1f')](function(_0x718128){_0x1b74f9['rows']=_0x718128;return _0x1b74f9;})['then'](respondWithFilteredResult(_0x41fd89,_0x12ee2c))[_0x50bb('0x39')](handleError(_0x41fd89,null));};exports[_0x50bb('0x3a')]=function(_0x1cf062,_0x1d929d){var _0x5e8085={'raw':![],'where':{'id':_0x1cf062['params']['id']}},_0x41243a={};_0x41243a[_0x50bb('0x27')]=_[_0x50bb('0x29')](db[_0x50bb('0x23')][_0x50bb('0x24')]);_0x41243a[_0x50bb('0x28')]=_[_0x50bb('0x29')](_0x1cf062[_0x50bb('0x28')]);_0x41243a[_0x50bb('0x2a')]=_[_0x50bb('0x2b')](_0x41243a[_0x50bb('0x27')],_0x41243a[_0x50bb('0x28')]);_0x5e8085[_0x50bb('0x2c')]=_[_0x50bb('0x2b')](_0x41243a[_0x50bb('0x27')],qs[_0x50bb('0x2d')](_0x1cf062[_0x50bb('0x28')]['fields']));_0x5e8085[_0x50bb('0x2c')]=_0x5e8085['attributes'][_0x50bb('0x2e')]?_0x5e8085[_0x50bb('0x2c')]:_0x41243a[_0x50bb('0x27')];if(_0x1cf062[_0x50bb('0x28')][_0x50bb('0x36')]){_0x5e8085[_0x50bb('0x37')]=[{'all':!![]}];}_0x5e8085=_[_0x50bb('0x3b')]({},_0x5e8085,_0x1cf062[_0x50bb('0x35')]);return db[_0x50bb('0x23')][_0x50bb('0x1d')](_0x5e8085)[_0x50bb('0x1f')](handleEntityNotFound(_0x1d929d,null))[_0x50bb('0x1f')](respondWithResult(_0x1d929d,null))[_0x50bb('0x39')](handleError(_0x1d929d,null));};exports[_0x50bb('0x12')]=function(_0x5880df,_0x3eb429){return db['VoiceExtension'][_0x50bb('0x1d')]({'where':{'id':_0x5880df[_0x50bb('0x3c')]['id']}})[_0x50bb('0x1f')](handleEntityNotFound(_0x3eb429,null))[_0x50bb('0x1f')](removeEntity(_0x3eb429,null))[_0x50bb('0x39')](handleError(_0x3eb429,null));};exports[_0x50bb('0x3d')]=function(_0x133dd9,_0x358b3a){if(_0x133dd9['body'][_0x50bb('0x1c')]===_0x50bb('0x16')&&!_[_0x50bb('0x3e')](_0x133dd9[_0x50bb('0x3f')][_0x50bb('0x40')],'_')){_0x133dd9['body'][_0x50bb('0x40')]='_'[_0x50bb('0x41')](_0x133dd9[_0x50bb('0x3f')][_0x50bb('0x40')]);}return db[_0x50bb('0x23')]['create'](_0x133dd9['body'],{'raw':![]})[_0x50bb('0x1f')](function(_0x49ed8d){var _0x357d08=_0x133dd9['user'][_0x50bb('0x13')]({'plain':!![]});if(!_0x357d08)throw new Error(_0x50bb('0x42'));if(_0x357d08[_0x50bb('0x43')]==='user'){var _0x2ce0a9=_0x49ed8d[_0x50bb('0x13')]({'plain':!![]});var _0x588dfe=[{'name':_0x50bb('0x14'),'value':_0x50bb('0x44')},{'name':_0x50bb('0x15'),'value':_0x50bb('0x16')},{'name':'InternalRoutes','value':_0x50bb('0x45')}];var _0x46b51e=_[_0x50bb('0x1d')](_0x588dfe,[_0x50bb('0x1a'),_0x2ce0a9[_0x50bb('0x1c')]])['name'];return db[_0x50bb('0x46')]['find']({'where':{'name':_0x46b51e,'userProfileId':_0x357d08[_0x50bb('0x47')]},'raw':!![]})['then'](function(_0x52ea86){if(_0x52ea86&&_0x52ea86[_0x50bb('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x2ce0a9[_0x50bb('0x21')],'resourceId':_0x2ce0a9['id'],'type':_0x52ea86[_0x50bb('0x21')],'sectionId':_0x52ea86['id']},{})[_0x50bb('0x1f')](function(){return _0x49ed8d;});}else{return _0x49ed8d;}})[_0x50bb('0x39')](function(_0x3ef5d8){logger[_0x50bb('0x20')](_0x50bb('0x49'),_0x3ef5d8);throw _0x3ef5d8;});}return _0x49ed8d;})[_0x50bb('0x1f')](respondWithResult(_0x358b3a,0xc9))['catch'](handleError(_0x358b3a,null));};exports['update']=function(_0x372a06,_0x345bb5){if(_0x372a06[_0x50bb('0x3f')]['id']){delete _0x372a06[_0x50bb('0x3f')]['id'];}return db[_0x50bb('0x23')][_0x50bb('0x1d')]({'where':{'id':_0x372a06[_0x50bb('0x3c')]['id']}})['then'](handleEntityNotFound(_0x345bb5,null))[_0x50bb('0x1f')](function(_0x31cfca){if(_0x31cfca){return db[_0x50bb('0x23')][_0x50bb('0x4a')](_[_0x50bb('0x33')](_0x372a06['body'],[_0x50bb('0x40'),_0x50bb('0x4b'),_0x50bb('0x4c'),_0x50bb('0x4d'),_0x50bb('0x4e'),'mandatoryDisposition',_0x50bb('0x4f')]),{'where':{'context':_0x31cfca['context'],'exten':_0x31cfca['exten']},'individualHooks':!![]})[_0x50bb('0x1f')](function(_0x3057f2){return _0x3057f2;});}return null;})[_0x50bb('0x1f')](respondWithStatusCode(_0x345bb5,null))[_0x50bb('0x39')](handleError(_0x345bb5,null));};exports[_0x50bb('0x50')]=function(_0x20e35a,_0x15aaf8){return db[_0x50bb('0x23')][_0x50bb('0x51')]({'where':{'id':_0x20e35a[_0x50bb('0x3c')]['id']}})[_0x50bb('0x1f')](function(_0x534ebc){if(_0x534ebc){return db[_0x50bb('0x52')]['transaction'](function(_0x44b19d){return db[_0x50bb('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x20e35a[_0x50bb('0x3c')]['id']},'transaction':_0x44b19d})[_0x50bb('0x1f')](function(){var _0xafa1b7=_[_0x50bb('0x19')](_0x20e35a[_0x50bb('0x3f')],function(_0x26d188){_0x26d188[_0x50bb('0x53')]=_0x20e35a[_0x50bb('0x3c')]['id'];_0x26d188['isApp']=!![];return _0x26d188;});return _0x534ebc[_0x50bb('0x54')](_0xafa1b7);})[_0x50bb('0x1f')](function(_0x3b17c8){console['log'](_0x50bb('0x55'),_0x3b17c8);return db[_0x50bb('0x23')][_0x50bb('0x56')](_0x3b17c8,{'transaction':_0x44b19d});});})[_0x50bb('0x1f')](function(){return db[_0x50bb('0x23')][_0x50bb('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x20e35a['params']['id']},'order':_0x50bb('0x58')});});}})[_0x50bb('0x1f')](respondWithResult(_0x15aaf8,null))[_0x50bb('0x39')](handleError(_0x15aaf8,null));}; \ No newline at end of file +var _0x0b6f=['findAll','rows','catch','find','params','create','outbound','body','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','update','pick','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','createRouting','log','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','map','value','type','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x2a4bf0,_0xa0f106){var _0x3ea9f5=function(_0x540de5){while(--_0x540de5){_0x2a4bf0['push'](_0x2a4bf0['shift']());}};_0x3ea9f5(++_0xa0f106);}(_0x0b6f,0x134));var _0xf0b6=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0x0b6f[_0x333714];return _0x4c211e;};'use strict';var _=require(_0xf0b6('0x0'));var Redis=require(_0xf0b6('0x1'));var qs=require(_0xf0b6('0x2'));var logger=require(_0xf0b6('0x3'))(_0xf0b6('0x4'));var config=require(_0xf0b6('0x5'));var db=require(_0xf0b6('0x6'))['db'];config[_0xf0b6('0x7')]=_[_0xf0b6('0x8')](config[_0xf0b6('0x7')],{'host':_0xf0b6('0x9'),'port':0x18eb});var socket=require(_0xf0b6('0xa'))(new Redis(config[_0xf0b6('0x7')]));require(_0xf0b6('0xb'))['register'](socket);function respondWithStatusCode(_0x1fd6f0,_0x303333){_0x303333=_0x303333||0xcc;return function(_0x107647){if(_0x107647){return _0x1fd6f0[_0xf0b6('0xc')](_0x303333);}return _0x1fd6f0[_0xf0b6('0xd')](_0x303333)[_0xf0b6('0xe')]();};}function respondWithResult(_0x5f1976,_0x4a0da4){_0x4a0da4=_0x4a0da4||0xc8;return function(_0x9e2e1c){if(_0x9e2e1c){return _0x5f1976[_0xf0b6('0xd')](_0x4a0da4)[_0xf0b6('0xf')](_0x9e2e1c);}};}function respondWithFilteredResult(_0x110ccf,_0x461061){return function(_0xaf935c){if(_0xaf935c){var _0x359690=typeof _0x461061[_0xf0b6('0x10')]==='undefined'&&typeof _0x461061[_0xf0b6('0x11')]===_0xf0b6('0x12');var _0x12a702=_0xaf935c['count'];var _0x2d177d=_0x359690?0x0:_0x461061[_0xf0b6('0x10')];var _0x3ee732=_0x359690?_0xaf935c[_0xf0b6('0x13')]:_0x461061[_0xf0b6('0x10')]+_0x461061['limit'];var _0x1b3892;if(_0x3ee732>=_0x12a702){_0x3ee732=_0x12a702;_0x1b3892=0xc8;}else{_0x1b3892=0xce;}_0x110ccf[_0xf0b6('0xd')](_0x1b3892);return _0x110ccf[_0xf0b6('0x14')](_0xf0b6('0x15'),_0x2d177d+'-'+_0x3ee732+'/'+_0x12a702)[_0xf0b6('0xf')](_0xaf935c);}return null;};}function removeEntity(_0x335b29){return function(_0x2be350){if(_0x2be350){return _0x2be350[_0xf0b6('0x16')]()[_0xf0b6('0x17')](function(){var _0x266251=_0x2be350[_0xf0b6('0x18')]({'plain':!![]});var _0x41bb81=[{'name':_0xf0b6('0x19'),'value':_0xf0b6('0x1a'),'ignore':![]},{'name':_0xf0b6('0x1b'),'value':'outbound','ignore':![]},{'name':_0xf0b6('0x1c'),'value':_0xf0b6('0x1d'),'ignore':![]}];var _0x45b78f=_(_0x41bb81)['filter']('ignore')[_0xf0b6('0x1e')](_0xf0b6('0x1f'))[_0xf0b6('0x1f')]();if(_['includes'](_0x45b78f,_0x266251[_0xf0b6('0x20')])){return;}var _0xa7b51f=_['find'](_0x41bb81,[_0xf0b6('0x1f'),_0x266251[_0xf0b6('0x20')]])[_0xf0b6('0x21')];return db[_0xf0b6('0x22')][_0xf0b6('0x16')]({'where':{'type':_0xa7b51f,'resourceId':_0x266251['id']}})[_0xf0b6('0x17')](function(){return _0x2be350;});})[_0xf0b6('0x17')](function(){_0x335b29[_0xf0b6('0xd')](0xcc)[_0xf0b6('0xe')]();});}};}function handleEntityNotFound(_0x6a6d8a){return function(_0xda9ebd){if(!_0xda9ebd){_0x6a6d8a[_0xf0b6('0xc')](0x194);}return _0xda9ebd;};}function handleError(_0x1d78d9,_0x3cac1c){_0x3cac1c=_0x3cac1c||0x1f4;return function(_0x254946){logger['error'](_0x254946[_0xf0b6('0x23')]);if(_0x254946['name']){delete _0x254946['name'];}_0x1d78d9[_0xf0b6('0xd')](_0x3cac1c)[_0xf0b6('0x24')](_0x254946);};}exports[_0xf0b6('0x25')]=function(_0x40b369,_0x355d66){var _0xcb3452={},_0x2e80cf={},_0xb8d36a={'count':0x0,'rows':[]};var _0xac0dc1=_[_0xf0b6('0x1e')](db[_0xf0b6('0x26')][_0xf0b6('0x27')],function(_0x181a6b){return{'name':_0x181a6b[_0xf0b6('0x28')],'type':_0x181a6b['type'][_0xf0b6('0x29')]};});_0x2e80cf[_0xf0b6('0x2a')]=_[_0xf0b6('0x1e')](_0xac0dc1,_0xf0b6('0x21'));_0x2e80cf[_0xf0b6('0x2b')]=_[_0xf0b6('0x2c')](_0x40b369[_0xf0b6('0x2b')]);_0x2e80cf[_0xf0b6('0x2d')]=_[_0xf0b6('0x2e')](_0x2e80cf[_0xf0b6('0x2a')],_0x2e80cf[_0xf0b6('0x2b')]);_0xcb3452['attributes']=_['intersection'](_0x2e80cf[_0xf0b6('0x2a')],qs[_0xf0b6('0x2f')](_0x40b369[_0xf0b6('0x2b')][_0xf0b6('0x2f')]));_0xcb3452['attributes']=_0xcb3452[_0xf0b6('0x30')][_0xf0b6('0x31')]?_0xcb3452['attributes']:_0x2e80cf[_0xf0b6('0x2a')];if(!_0x40b369['query'][_0xf0b6('0x32')]('nolimit')){_0xcb3452[_0xf0b6('0x11')]=qs[_0xf0b6('0x11')](_0x40b369[_0xf0b6('0x2b')][_0xf0b6('0x11')]);_0xcb3452[_0xf0b6('0x10')]=qs[_0xf0b6('0x10')](_0x40b369['query']['offset']);}_0xcb3452[_0xf0b6('0x33')]=qs[_0xf0b6('0x34')](_0x40b369[_0xf0b6('0x2b')][_0xf0b6('0x34')]);_0xcb3452[_0xf0b6('0x35')]=qs[_0xf0b6('0x2d')](_['pick'](_0x40b369[_0xf0b6('0x2b')],_0x2e80cf[_0xf0b6('0x2d')]),_0xac0dc1);if(_0x40b369['query'][_0xf0b6('0x36')]){_0xcb3452[_0xf0b6('0x35')]=_[_0xf0b6('0x37')](_0xcb3452[_0xf0b6('0x35')],{'$or':_[_0xf0b6('0x1e')](_0xac0dc1,function(_0x1f04a6){if(_0x1f04a6[_0xf0b6('0x20')]!==_0xf0b6('0x38')){var _0x16663b={};_0x16663b[_0x1f04a6[_0xf0b6('0x21')]]={'$like':'%'+_0x40b369['query'][_0xf0b6('0x36')]+'%'};return _0x16663b;}})});}_0xcb3452=_[_0xf0b6('0x37')]({},_0xcb3452,_0x40b369[_0xf0b6('0x39')]);var _0x1f4b2a={'where':_0xcb3452[_0xf0b6('0x35')]};return db['VoiceExtension']['count'](_0x1f4b2a)[_0xf0b6('0x17')](function(_0x98d64e){_0xb8d36a[_0xf0b6('0x13')]=_0x98d64e;if(_0x40b369['query'][_0xf0b6('0x3a')]){_0xcb3452[_0xf0b6('0x3b')]=[{'all':!![]}];}return db[_0xf0b6('0x26')][_0xf0b6('0x3c')](_0xcb3452);})['then'](function(_0x21e7d8){_0xb8d36a[_0xf0b6('0x3d')]=_0x21e7d8;return _0xb8d36a;})[_0xf0b6('0x17')](respondWithFilteredResult(_0x355d66,_0xcb3452))['catch'](handleError(_0x355d66,null));};exports['show']=function(_0x5c4b3f,_0x1334f6){var _0x42ea8c={'raw':![],'where':{'id':_0x5c4b3f['params']['id']}},_0x5e3495={};_0x5e3495[_0xf0b6('0x2a')]=_[_0xf0b6('0x2c')](db['VoiceExtension']['rawAttributes']);_0x5e3495['query']=_[_0xf0b6('0x2c')](_0x5c4b3f[_0xf0b6('0x2b')]);_0x5e3495['filters']=_['intersection'](_0x5e3495[_0xf0b6('0x2a')],_0x5e3495[_0xf0b6('0x2b')]);_0x42ea8c[_0xf0b6('0x30')]=_['intersection'](_0x5e3495[_0xf0b6('0x2a')],qs[_0xf0b6('0x2f')](_0x5c4b3f[_0xf0b6('0x2b')][_0xf0b6('0x2f')]));_0x42ea8c[_0xf0b6('0x30')]=_0x42ea8c[_0xf0b6('0x30')][_0xf0b6('0x31')]?_0x42ea8c[_0xf0b6('0x30')]:_0x5e3495[_0xf0b6('0x2a')];if(_0x5c4b3f['query']['includeAll']){_0x42ea8c[_0xf0b6('0x3b')]=[{'all':!![]}];}_0x42ea8c=_['merge']({},_0x42ea8c,_0x5c4b3f[_0xf0b6('0x39')]);return db['VoiceExtension']['find'](_0x42ea8c)[_0xf0b6('0x17')](handleEntityNotFound(_0x1334f6,null))[_0xf0b6('0x17')](respondWithResult(_0x1334f6,null))[_0xf0b6('0x3e')](handleError(_0x1334f6,null));};exports['destroy']=function(_0x53ccab,_0x4c1b04){return db[_0xf0b6('0x26')][_0xf0b6('0x3f')]({'where':{'id':_0x53ccab[_0xf0b6('0x40')]['id']}})[_0xf0b6('0x17')](handleEntityNotFound(_0x4c1b04,null))[_0xf0b6('0x17')](removeEntity(_0x4c1b04,null))['catch'](handleError(_0x4c1b04,null));};exports[_0xf0b6('0x41')]=function(_0x16d489,_0x500a2d){if(_0x16d489['body'][_0xf0b6('0x20')]===_0xf0b6('0x42')&&!_['startsWith'](_0x16d489[_0xf0b6('0x43')][_0xf0b6('0x44')],'_')){_0x16d489['body'][_0xf0b6('0x44')]='_'['concat'](_0x16d489[_0xf0b6('0x43')][_0xf0b6('0x44')]);}return db[_0xf0b6('0x26')][_0xf0b6('0x41')](_0x16d489[_0xf0b6('0x43')],{'raw':![]})[_0xf0b6('0x17')](function(_0x270785){var _0x1172d4=_0x16d489['user']['get']({'plain':!![]});if(!_0x1172d4)throw new Error(_0xf0b6('0x45'));if(_0x1172d4['role']===_0xf0b6('0x46')){var _0x335e57=_0x270785[_0xf0b6('0x18')]({'plain':!![]});var _0x4c5195=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xf0b6('0x1b'),'value':_0xf0b6('0x42')},{'name':_0xf0b6('0x1c'),'value':'internal'}];var _0x3fb601=_[_0xf0b6('0x3f')](_0x4c5195,['value',_0x335e57[_0xf0b6('0x20')]])[_0xf0b6('0x21')];return db['UserProfileSection'][_0xf0b6('0x3f')]({'where':{'name':_0x3fb601,'userProfileId':_0x1172d4[_0xf0b6('0x47')]},'raw':!![]})['then'](function(_0x351e21){if(_0x351e21&&_0x351e21[_0xf0b6('0x48')]===0x0){return db[_0xf0b6('0x22')][_0xf0b6('0x41')]({'name':_0x335e57[_0xf0b6('0x21')],'resourceId':_0x335e57['id'],'type':_0x351e21['name'],'sectionId':_0x351e21['id']},{})[_0xf0b6('0x17')](function(){return _0x270785;});}else{return _0x270785;}})['catch'](function(_0x3f5edc){logger[_0xf0b6('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f5edc);throw _0x3f5edc;});}return _0x270785;})['then'](respondWithResult(_0x500a2d,0xc9))['catch'](handleError(_0x500a2d,null));};exports[_0xf0b6('0x4a')]=function(_0x24b1da,_0x5c726f){if(_0x24b1da[_0xf0b6('0x43')]['id']){delete _0x24b1da[_0xf0b6('0x43')]['id'];}return db[_0xf0b6('0x26')]['find']({'where':{'id':_0x24b1da[_0xf0b6('0x40')]['id']}})[_0xf0b6('0x17')](handleEntityNotFound(_0x5c726f,null))[_0xf0b6('0x17')](function(_0xf8f20e){if(_0xf8f20e){return db[_0xf0b6('0x26')][_0xf0b6('0x4a')](_[_0xf0b6('0x4b')](_0x24b1da[_0xf0b6('0x43')],['exten','context',_0xf0b6('0x4c'),_0xf0b6('0x4d'),_0xf0b6('0x4e'),_0xf0b6('0x4f'),_0xf0b6('0x50')]),{'where':{'context':_0xf8f20e[_0xf0b6('0x51')],'exten':_0xf8f20e[_0xf0b6('0x44')]},'individualHooks':!![]})[_0xf0b6('0x17')](function(_0x3703c4){return _0x3703c4;});}return null;})[_0xf0b6('0x17')](respondWithStatusCode(_0x5c726f,null))[_0xf0b6('0x3e')](handleError(_0x5c726f,null));};exports[_0xf0b6('0x52')]=function(_0x382976,_0x1708cd){return db[_0xf0b6('0x26')][_0xf0b6('0x53')]({'where':{'id':_0x382976['params']['id']}})['then'](function(_0x3658aa){if(_0x3658aa){return db[_0xf0b6('0x54')][_0xf0b6('0x55')](function(_0x511294){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x382976[_0xf0b6('0x40')]['id']},'transaction':_0x511294})[_0xf0b6('0x17')](function(){var _0x2e46ae=_[_0xf0b6('0x1e')](_0x382976[_0xf0b6('0x43')],function(_0x44b51f){_0x44b51f[_0xf0b6('0x56')]=_0x382976[_0xf0b6('0x40')]['id'];_0x44b51f[_0xf0b6('0x57')]=!![];return _0x44b51f;});return _0x3658aa[_0xf0b6('0x58')](_0x2e46ae);})[_0xf0b6('0x17')](function(_0x56ea52){console[_0xf0b6('0x59')](_0xf0b6('0x5a'),_0x56ea52);return db['VoiceExtension'][_0xf0b6('0x5b')](_0x56ea52,{'transaction':_0x511294});});})[_0xf0b6('0x17')](function(){return db[_0xf0b6('0x26')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x382976[_0xf0b6('0x40')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xf0b6('0x17')](respondWithResult(_0x1708cd,null))[_0xf0b6('0x3e')](handleError(_0x1708cd,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7c2318e..14575fb 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 _0x3d31=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x2ee7c3,_0x1753a5){var _0x3a1259=function(_0x53987a){while(--_0x53987a){_0x2ee7c3['push'](_0x2ee7c3['shift']());}};_0x3a1259(++_0x1753a5);}(_0x3d31,0x73));var _0x13d3=function(_0x4d53fa,_0x5626f6){_0x4d53fa=_0x4d53fa-0x0;var _0x25230a=_0x3d31[_0x4d53fa];return _0x25230a;};'use strict';var EventEmitter=require(_0x13d3('0x0'));var VoiceExtension=require(_0x13d3('0x1'))['db'][_0x13d3('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x13d3('0x3')](0x0);var events={'afterCreate':_0x13d3('0x4'),'afterUpdate':_0x13d3('0x5'),'afterDestroy':_0x13d3('0x6')};function emitEvent(_0x5a4fc3){return function(_0x238f0f,_0x13e7c1,_0x40fb31){VoiceExtensionEvents['emit'](_0x5a4fc3+':'+_0x238f0f['id'],_0x238f0f);VoiceExtensionEvents[_0x13d3('0x7')](_0x5a4fc3,_0x238f0f);_0x40fb31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x13d3('0x8')](e,emitEvent(event));}}module[_0x13d3('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3809=['exports','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xda8d0b,_0x1fe50e){var _0x5d5d42=function(_0x3530b9){while(--_0x3530b9){_0xda8d0b['push'](_0xda8d0b['shift']());}};_0x5d5d42(++_0x1fe50e);}(_0x3809,0x1ba));var _0x9380=function(_0x8ffd03,_0x45180e){_0x8ffd03=_0x8ffd03-0x0;var _0x4ca4e9=_0x3809[_0x8ffd03];return _0x4ca4e9;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x9380('0x0'))['db'][_0x9380('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9380('0x2')](0x0);var events={'afterCreate':_0x9380('0x3'),'afterUpdate':_0x9380('0x4'),'afterDestroy':_0x9380('0x5')};function emitEvent(_0x2854be){return function(_0x39fda2,_0x5ffd2a,_0x1feadc){VoiceExtensionEvents[_0x9380('0x6')](_0x2854be+':'+_0x39fda2['id'],_0x39fda2);VoiceExtensionEvents[_0x9380('0x6')](_0x2854be,_0x39fda2);_0x1feadc(null);};}for(var e in events){if(events[_0x9380('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x9380('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index b026767..7f5abc3 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 _0x562d=['outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','length','param','prefix','phone','split','${EXTEN:','${EXTEN}','SIP','none','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','hasOwnProperty','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','queue','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab'];(function(_0x28b7ab,_0x16a764){var _0x56791b=function(_0x25d20d){while(--_0x25d20d){_0x28b7ab['push'](_0x28b7ab['shift']());}};_0x56791b(++_0x16a764);}(_0x562d,0xe1));var _0xd562=function(_0x4028a5,_0x3b6c1f){_0x4028a5=_0x4028a5-0x0;var _0x3ed499=_0x562d[_0x4028a5];return _0x3ed499;};'use strict';var _=require(_0xd562('0x0'));var attributes=require(_0xd562('0x1'));module[_0xd562('0x2')]=function(_0x590061){var _0x517c30=_0x590061[_0xd562('0x3')];function _0x29f939(_0x73c3fa){var _0x4c6430=0x2;var _0xf71ee1=[{'type':_0x73c3fa['type'],'app':'Set','appdata':_0xd562('0x4')+_0x73c3fa[_0xd562('0x5')],'context':_0x73c3fa[_0xd562('0x6')],'exten':_0x73c3fa[_0xd562('0x7')],'priority':_0x4c6430++,'VoiceExtensionId':_0x73c3fa['id']},{'type':_0x73c3fa[_0xd562('0x5')],'app':_0x73c3fa[_0xd562('0x8')]?'Set':_0xd562('0x9'),'appdata':_0x73c3fa['alias']?_0xd562('0xa')+_0x73c3fa[_0xd562('0x8')]:_0xd562('0xb'),'context':_0x73c3fa[_0xd562('0x6')],'exten':_0x73c3fa[_0xd562('0x7')],'priority':_0x4c6430++,'VoiceExtensionId':_0x73c3fa['id']}];if(_0x73c3fa[_0xd562('0x5')]===_0xd562('0xc')){_0xf71ee1[_0xd562('0xd')]({'type':_0xd562('0xc'),'app':_0xd562('0xe'),'appdata':_0xd562('0xf')+_0x73c3fa['id'],'context':_0x73c3fa['context'],'exten':_0x73c3fa[_0xd562('0x7')],'priority':_0x4c6430++,'VoiceExtensionId':_0x73c3fa['id']});}_0xf71ee1['push']({'type':_0x73c3fa['type'],'app':_0xd562('0xe'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x73c3fa[_0xd562('0x6')],'exten':_0x73c3fa['exten'],'priority':_0x4c6430++,'VoiceExtensionId':_0x73c3fa['id']},{'type':_0x73c3fa['type'],'app':_0xd562('0xe'),'appdata':_0xd562('0x10'),'context':_0x73c3fa[_0xd562('0x6')],'exten':_0x73c3fa[_0xd562('0x7')],'priority':_0x4c6430++,'VoiceExtensionId':_0x73c3fa['id']},{'type':_0x73c3fa[_0xd562('0x5')],'app':'Set','appdata':_0xd562('0x11'),'context':_0x73c3fa[_0xd562('0x6')],'exten':_0x73c3fa['exten'],'priority':_0x4c6430++,'VoiceExtensionId':_0x73c3fa['id']});return _0xf71ee1;}function _0x24b1c4(_0x27de61){var _0x4a1e67=0x2;var _0x2335ff=[{'type':_0xd562('0x12'),'app':_0xd562('0xe'),'appdata':_0xd562('0x13'),'context':_0x27de61[_0xd562('0x6')],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':_0xd562('0x12'),'app':_0x27de61[_0xd562('0x8')]?_0xd562('0xe'):_0xd562('0x9'),'appdata':_0x27de61[_0xd562('0x8')]?'CDR(routeAlias)='+_0x27de61['alias']:_0xd562('0xb'),'context':_0x27de61['context'],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':_0xd562('0x12'),'app':_0xd562('0xe'),'appdata':_0xd562('0x14')+(_0x27de61['cutdigits']?'${EXTEN:'+_0x27de61[_0xd562('0x15')]+'}':'${EXTEN}'),'context':_0x27de61[_0xd562('0x6')],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':_0xd562('0x12'),'app':_0xd562('0xe'),'appdata':_0xd562('0xf')+_0x27de61['id'],'context':_0x27de61['context'],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':_0xd562('0x12'),'app':_0xd562('0x16'),'appdata':_0xd562('0x17')+(_0x4a1e67+0x2)+_0xd562('0x18')+(_0x4a1e67+0x1)+')','context':_0x27de61[_0xd562('0x6')],'exten':_0x27de61['exten'],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':'outbound','app':'Set','appdata':_0x27de61[_0xd562('0x15')]?_0xd562('0x19')+_0x27de61['cutdigits']+'}':_0xd562('0x1a'),'context':_0x27de61[_0xd562('0x6')],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':_0xd562('0x12'),'app':_0xd562('0xe'),'appdata':_0xd562('0x1b'),'context':_0x27de61[_0xd562('0x6')],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':'outbound','app':_0xd562('0xe'),'appdata':_0xd562('0x10'),'context':_0x27de61['context'],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':_0xd562('0x12'),'app':_0xd562('0xe'),'appdata':_0xd562('0x11'),'context':_0x27de61['context'],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':_0xd562('0x12'),'app':_0xd562('0xe'),'appdata':'outboundrouteid='+_0x27de61['id'],'context':_0x27de61[_0xd562('0x6')],'exten':_0x27de61['exten'],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']}];if(_0x27de61['hasOwnProperty'](_0xd562('0x1c'))&&_0x27de61[_0xd562('0x1c')]!=='none'){_0x2335ff['push']({'type':_0xd562('0x12'),'app':_0xd562('0xe'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x27de61['context'],'exten':_0x27de61[_0xd562('0x7')],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']},{'type':_0xd562('0x12'),'app':_0xd562('0xe'),'appdata':_0xd562('0x1d')+_0x27de61['recordingFormat']||_0xd562('0x1e'),'context':_0x27de61[_0xd562('0x6')],'exten':_0x27de61['exten'],'priority':_0x4a1e67++,'VoiceExtensionId':_0x27de61['id']});}return _0x2335ff;}function _0xe1af26(_0x2a235e,_0x1e406c){var _0x594006=[{'name':_0xd562('0x1f'),'param':0x0},{'name':_0xd562('0x20'),'param':0x1},{'name':_0xd562('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0xf61831={};var _0x31159c=_0x1e406c['split'](',');var _0xecf0d0=[];for(var _0x4318a5=0x0;_0x4318a5<_0x594006[_0xd562('0x22')];_0x4318a5++){switch(_0x594006[_0x4318a5]['name']){case _0xd562('0x1f'):_0xf61831[_0xd562('0x1f')]=_0x31159c[_0x594006[_0x4318a5]['param']]['split']('/')[0x1];_0xf61831['phone']=_0x31159c[_0x594006[_0x4318a5][_0xd562('0x23')]]['split']('/')[0x2];_0xf61831[_0xd562('0x24')]=_0xf61831[_0xd562('0x25')]?_0xf61831[_0xd562('0x25')][_0xd562('0x26')]('$')[0x0]:undefined;_0xf61831[_0xd562('0x25')]=_0x2a235e['cutdigits']?(_0xf61831[_0xd562('0x24')]||'')+_0xd562('0x27')+_0x2a235e[_0xd562('0x15')]+'}':(_0xf61831[_0xd562('0x24')]||'')+_0xd562('0x28');_0xecf0d0[_0x594006[_0x4318a5][_0xd562('0x23')]]=[_0xd562('0x29'),_0xf61831[_0xd562('0x1f')],_0xf61831['phone']]['join']('/');break;case _0xd562('0x21'):_0xf61831[_0xd562('0x21')]=_0x31159c[_0x594006[_0x4318a5][_0xd562('0x23')]];if(_0x2a235e[_0xd562('0x1c')]!==_0xd562('0x2a')){if(_0xf61831[_0xd562('0x21')]['indexOf'](_0xd562('0x2b'))<0x0){_0xf61831[_0xd562('0x21')]+=_0xd562('0x2b');}}else{_0xf61831[_0xd562('0x21')]=_0xf61831[_0xd562('0x21')][_0xd562('0x2c')](_0xd562('0x2b'),'');}_0xecf0d0[_0x594006[_0x4318a5]['param']]=_0xf61831[_0xd562('0x21')];break;default:_0xecf0d0[_0x594006[_0x4318a5][_0xd562('0x23')]]=_0x31159c[_0x594006[_0x4318a5][_0xd562('0x23')]];}}return _0xecf0d0[_0xd562('0x2d')](',');}function _0x321ca3(_0x10a6ac,_0x279820,_0x52dc08){return new Promise(function(_0x3e0f30,_0x4a3801){var _0x1cd34f=[];if(_[_0xd562('0x2e')](_0x279820))return _0x3e0f30(_0x1cd34f);_0x517c30[_0xd562('0x2f')][_0xd562('0x30')]({'attributes':['id',_0xd562('0x31'),_0xd562('0x32')],'raw':!![]})[_0xd562('0x33')](function(_0x562b2c){for(var _0x31aeeb=0x0,_0x15821f=0x0;_0x31aeeb<_0x279820['length'];_0x31aeeb++,_0x15821f=0x0){var _0x2ec617=_0x279820[_0x31aeeb];var _0x52f320=[];var _0x4b941d=[];delete _0x2ec617['id'];if(_0x2ec617[_0xd562('0x31')]!=='*,*,*,*'){_0x2ec617['intervals']=[_0x2ec617['interval']];}else{_0x2ec617[_0xd562('0x34')]=_0x2ec617[_0xd562('0x32')]?_[_0xd562('0x35')](_[_0xd562('0x36')](_0x562b2c,{'IntervalId':_0x2ec617['IntervalId']}),_0xd562('0x31')):[];}_0x2ec617[_0xd562('0x6')]=_0x10a6ac[_0xd562('0x6')];_0x2ec617[_0xd562('0x7')]=_0x10a6ac[_0xd562('0x7')];if(_0x2ec617['type'])_0x2ec617['type']=_0x2ec617[_0xd562('0x5')][_0xd562('0x37')]();if(_0x10a6ac['type']===_0xd562('0x12')){if(_0x2ec617[_0xd562('0x38')](_0xd562('0x39'))&&_0x2ec617[_0xd562('0x39')]&&_0x2ec617[_0xd562('0x39')]!=='--'){_0x52f320['push']({'type':_0x2ec617[_0xd562('0x5')]['toLowerCase'](),'app':'Set','appdata':'CDR(tag)='+_0x2ec617['tag'],'context':_0x10a6ac[_0xd562('0x6')],'exten':_0x10a6ac[_0xd562('0x7')],'priority':_0x2ec617['intervals']['length']+_0x52dc08+_0x15821f++,'VoiceExtensionId':_0x10a6ac['id']});}_0x52f320['push']({'type':_0x2ec617[_0xd562('0x5')][_0xd562('0x37')](),'app':_0xd562('0x16'),'appdata':_0xd562('0x3a')+(_0x2ec617[_0xd562('0x3b')]?'Set(CALLERID(all)='+_0x2ec617[_0xd562('0x3b')]+')':'NoOp(No\x20number\x20available)'),'context':_0x10a6ac[_0xd562('0x6')],'exten':_0x10a6ac['exten'],'priority':_0x2ec617[_0xd562('0x34')][_0xd562('0x22')]+_0x52dc08+_0x15821f++,'VoiceExtensionId':_0x10a6ac['id']});}else{if(_0x2ec617[_0xd562('0x38')]('answer')){if([_0xd562('0x3c'),'playback'][_0xd562('0x3d')](_0x2ec617[_0xd562('0x3e')]['toLowerCase']())&&_0x2ec617[_0xd562('0x3f')]!==_0xd562('0x40')){if(_0x2ec617[_0xd562('0x41')]){_0x52f320[_0xd562('0xd')]({'type':_0x2ec617['type'][_0xd562('0x37')](),'app':_0xd562('0x16'),'appdata':_0xd562('0x42'),'context':_0x10a6ac[_0xd562('0x6')],'exten':_0x10a6ac[_0xd562('0x7')],'priority':_0x2ec617[_0xd562('0x34')][_0xd562('0x22')]+_0x52dc08+_0x15821f++,'VoiceExtensionId':_0x10a6ac['id']});_0x52f320['push']({'type':_0x2ec617[_0xd562('0x5')][_0xd562('0x37')](),'app':_0xd562('0xe'),'appdata':_0xd562('0x43'),'context':_0x10a6ac[_0xd562('0x6')],'exten':_0x10a6ac[_0xd562('0x7')],'priority':_0x2ec617[_0xd562('0x34')]['length']+_0x52dc08+_0x15821f++,'VoiceExtensionId':_0x10a6ac['id']});}else{_0x52f320['push']({'type':_0x2ec617[_0xd562('0x5')][_0xd562('0x37')](),'app':_0xd562('0x16'),'appdata':_0xd562('0x44'),'context':_0x10a6ac[_0xd562('0x6')],'exten':_0x10a6ac['exten'],'priority':_0x2ec617[_0xd562('0x34')]['length']+_0x52dc08+_0x15821f++,'VoiceExtensionId':_0x10a6ac['id']});_0x52f320[_0xd562('0xd')]({'type':_0x2ec617[_0xd562('0x5')][_0xd562('0x37')](),'app':_0xd562('0xe'),'appdata':_0xd562('0x45'),'context':_0x10a6ac[_0xd562('0x6')],'exten':_0x10a6ac[_0xd562('0x7')],'priority':_0x2ec617[_0xd562('0x34')]['length']+_0x52dc08+_0x15821f++,'VoiceExtensionId':_0x10a6ac['id']});}}}}for(var _0x16fa4d=0x0;_0x16fa4d<_0x2ec617[_0xd562('0x34')][_0xd562('0x22')];_0x16fa4d++){var _0xe312be=_0x52dc08+_0x2ec617['intervals'][_0xd562('0x22')];var _0x19d42f=_0x16fa4d===_0x2ec617[_0xd562('0x34')]['length']-0x1?_0x52dc08+_0x52f320[_0xd562('0x22')]+_0x4b941d[_0xd562('0x22')]+0x2:_0x52dc08+_0x16fa4d+0x1;_0x52f320[_0xd562('0x46')](_0x16fa4d,0x0,{'type':_0x10a6ac[_0xd562('0x5')],'app':_0xd562('0x47'),'appdata':_0x2ec617[_0xd562('0x34')][_0x16fa4d]+'?'+_0x10a6ac['context']+_0xd562('0x48')+_0xe312be+':'+_0x10a6ac[_0xd562('0x6')]+_0xd562('0x48')+_0x19d42f,'exten':_0x10a6ac[_0xd562('0x7')],'context':_0x10a6ac[_0xd562('0x6')],'priority':_0x52dc08+_0x16fa4d,'VoiceExtensionId':_0x10a6ac['id']});}if(_0x2ec617[_0xd562('0x3f')]===_0xd562('0x49'))_0x2ec617[_0xd562('0x4a')]=_0xe1af26(_0x10a6ac,_0x2ec617[_0xd562('0x4a')]);_0x2ec617[_0xd562('0x4b')]=_0x52f320['length']?_[_0xd562('0x4c')](_0x52f320)[_0xd562('0x4b')]+0x1:_0x52dc08;_0x1cd34f=_['concat'](_0x1cd34f,_0x52f320,[_0x2ec617],_0x4b941d);_0x52dc08=_[_0xd562('0x4c')](_0x1cd34f)[_0xd562('0x4b')]+0x1;}return _0x3e0f30(_0x1cd34f);})['catch'](function(_0x363727){_0x4a3801(_0x363727);});});}return _0x590061[_0xd562('0x4d')]('VoiceExtension',attributes,{'tableName':_0xd562('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x10b427){var _0x4020ce=this[_0xd562('0x4f')]({'plain':!![]});var _0x2fd72f=_0x4020ce[_0xd562('0x5')]==='outbound'?_0x24b1c4(_0x4020ce):_0x29f939(_0x4020ce);return _0x321ca3(_0x4020ce,_0x10b427,_['last'](_0x2fd72f)[_0xd562('0x4b')]+0x1)[_0xd562('0x33')](function(_0x2dc784){var _0x4021e5=_['concat'](_0x2fd72f,_0x2dc784);_0x4021e5['push']({'type':_0x4020ce[_0xd562('0x5')],'app':_0xd562('0x50'),'exten':_0x4020ce[_0xd562('0x7')],'context':_0x4020ce['context'],'priority':_[_0xd562('0x4c')](_0x4021e5)[_0xd562('0x4b')]+0x1,'VoiceExtensionId':_0x4020ce['id']});return _0x4021e5;});}}});}; \ No newline at end of file +var _0x0c9c=['ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','split','length','name','trunk','param','phone','prefix','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','intervals','map','filter','tag','toLowerCase','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','appdata','last','priority','concat','catch','define','voice_extensions','get','then','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)='];(function(_0x4abcc1,_0x4c536f){var _0x30eb0b=function(_0x243e6c){while(--_0x243e6c){_0x4abcc1['push'](_0x4abcc1['shift']());}};_0x30eb0b(++_0x4c536f);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0c9('0x0'));var attributes=require(_0xc0c9('0x1'));module[_0xc0c9('0x2')]=function(_0x3cc26b){var _0x4abb6c=_0x3cc26b[_0xc0c9('0x3')];function _0x5bc767(_0x10d090){var _0x7f8ea1=0x2;var _0x40f245=[{'type':_0x10d090[_0xc0c9('0x4')],'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x6')+_0x10d090[_0xc0c9('0x4')],'context':_0x10d090[_0xc0c9('0x7')],'exten':_0x10d090[_0xc0c9('0x8')],'priority':_0x7f8ea1++,'VoiceExtensionId':_0x10d090['id']},{'type':_0x10d090[_0xc0c9('0x4')],'app':_0x10d090[_0xc0c9('0x9')]?'Set':_0xc0c9('0xa'),'appdata':_0x10d090[_0xc0c9('0x9')]?_0xc0c9('0xb')+_0x10d090[_0xc0c9('0x9')]:'No\x20alias\x20set','context':_0x10d090[_0xc0c9('0x7')],'exten':_0x10d090[_0xc0c9('0x8')],'priority':_0x7f8ea1++,'VoiceExtensionId':_0x10d090['id']}];if(_0x10d090['type']===_0xc0c9('0xc')){_0x40f245['push']({'type':_0xc0c9('0xc'),'app':_0xc0c9('0x5'),'appdata':'CDR(routeid)='+_0x10d090['id'],'context':_0x10d090['context'],'exten':_0x10d090[_0xc0c9('0x8')],'priority':_0x7f8ea1++,'VoiceExtensionId':_0x10d090['id']});}_0x40f245[_0xc0c9('0xd')]({'type':_0x10d090[_0xc0c9('0x4')],'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0xe'),'context':_0x10d090[_0xc0c9('0x7')],'exten':_0x10d090[_0xc0c9('0x8')],'priority':_0x7f8ea1++,'VoiceExtensionId':_0x10d090['id']},{'type':_0x10d090[_0xc0c9('0x4')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x10d090[_0xc0c9('0x7')],'exten':_0x10d090[_0xc0c9('0x8')],'priority':_0x7f8ea1++,'VoiceExtensionId':_0x10d090['id']},{'type':_0x10d090[_0xc0c9('0x4')],'app':_0xc0c9('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x10d090[_0xc0c9('0x7')],'exten':_0x10d090[_0xc0c9('0x8')],'priority':_0x7f8ea1++,'VoiceExtensionId':_0x10d090['id']});return _0x40f245;}function _0x9786eb(_0x3eb983){var _0x49045f=0x2;var _0x198c90=[{'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x10'),'context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':_0x3eb983[_0xc0c9('0x9')]?_0xc0c9('0x5'):_0xc0c9('0xa'),'appdata':_0x3eb983[_0xc0c9('0x9')]?'CDR(routeAlias)='+_0x3eb983[_0xc0c9('0x9')]:_0xc0c9('0x11'),'context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983['exten'],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x12')+(_0x3eb983[_0xc0c9('0x13')]?_0xc0c9('0x14')+_0x3eb983[_0xc0c9('0x13')]+'}':_0xc0c9('0x15')),'context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':'Set','appdata':_0xc0c9('0x16')+_0x3eb983['id'],'context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':'outbound','app':_0xc0c9('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x49045f+0x2)+'):Goto('+(_0x49045f+0x1)+')','context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':_0x3eb983[_0xc0c9('0x13')]?_0xc0c9('0x18')+_0x3eb983['cutdigits']+'}':_0xc0c9('0x19'),'context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3eb983['context'],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x1a'),'context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x1b')+_0x3eb983['id'],'context':_0x3eb983['context'],'exten':_0x3eb983[_0xc0c9('0x8')],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']}];if(_0x3eb983[_0xc0c9('0x1c')](_0xc0c9('0x1d'))&&_0x3eb983['recordingFormat']!=='none'){_0x198c90[_0xc0c9('0xd')]({'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x1e'),'context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983['exten'],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']},{'type':_0xc0c9('0xf'),'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x1f')+_0x3eb983['recordingFormat']||_0xc0c9('0x20'),'context':_0x3eb983[_0xc0c9('0x7')],'exten':_0x3eb983['exten'],'priority':_0x49045f++,'VoiceExtensionId':_0x3eb983['id']});}return _0x198c90;}function _0x2fda41(_0x4e4905,_0x1f14bb){var _0x53cb90=[{'name':'trunk','param':0x0},{'name':_0xc0c9('0x21'),'param':0x1},{'name':_0xc0c9('0x22'),'param':0x2},{'name':_0xc0c9('0x23'),'param':0x3}];var _0x240768={};var _0x1d114f=_0x1f14bb[_0xc0c9('0x24')](',');var _0x14184d=[];for(var _0x2942ec=0x0;_0x2942ec<_0x53cb90[_0xc0c9('0x25')];_0x2942ec++){switch(_0x53cb90[_0x2942ec][_0xc0c9('0x26')]){case _0xc0c9('0x27'):_0x240768[_0xc0c9('0x27')]=_0x1d114f[_0x53cb90[_0x2942ec][_0xc0c9('0x28')]][_0xc0c9('0x24')]('/')[0x1];_0x240768[_0xc0c9('0x29')]=_0x1d114f[_0x53cb90[_0x2942ec][_0xc0c9('0x28')]][_0xc0c9('0x24')]('/')[0x2];_0x240768[_0xc0c9('0x2a')]=_0x240768['phone']?_0x240768[_0xc0c9('0x29')][_0xc0c9('0x24')]('$')[0x0]:undefined;_0x240768[_0xc0c9('0x29')]=_0x4e4905[_0xc0c9('0x13')]?(_0x240768['prefix']||'')+_0xc0c9('0x14')+_0x4e4905['cutdigits']+'}':(_0x240768[_0xc0c9('0x2a')]||'')+_0xc0c9('0x15');_0x14184d[_0x53cb90[_0x2942ec][_0xc0c9('0x28')]]=['SIP',_0x240768['trunk'],_0x240768[_0xc0c9('0x29')]][_0xc0c9('0x2b')]('/');break;case _0xc0c9('0x22'):_0x240768[_0xc0c9('0x22')]=_0x1d114f[_0x53cb90[_0x2942ec][_0xc0c9('0x28')]];if(_0x4e4905[_0xc0c9('0x1d')]!==_0xc0c9('0x2c')){if(_0x240768[_0xc0c9('0x22')][_0xc0c9('0x2d')](_0xc0c9('0x2e'))<0x0){_0x240768[_0xc0c9('0x22')]+=_0xc0c9('0x2e');}}else{_0x240768[_0xc0c9('0x22')]=_0x240768['options'][_0xc0c9('0x2f')](_0xc0c9('0x2e'),'');}_0x14184d[_0x53cb90[_0x2942ec]['param']]=_0x240768['options'];break;default:_0x14184d[_0x53cb90[_0x2942ec][_0xc0c9('0x28')]]=_0x1d114f[_0x53cb90[_0x2942ec][_0xc0c9('0x28')]];}}return _0x14184d[_0xc0c9('0x2b')](',');}function _0xf6bbf0(_0x1c9565,_0x4a4818,_0x1de39d){return new Promise(function(_0x52b5e6,_0x4ba503){var _0x3696ba=[];if(_[_0xc0c9('0x30')](_0x4a4818))return _0x52b5e6(_0x3696ba);_0x4abb6c['Interval'][_0xc0c9('0x31')]({'attributes':['id',_0xc0c9('0x32'),_0xc0c9('0x33')],'raw':!![]})['then'](function(_0x53c702){for(var _0x17ff60=0x0,_0x311622=0x0;_0x17ff60<_0x4a4818[_0xc0c9('0x25')];_0x17ff60++,_0x311622=0x0){var _0x411711=_0x4a4818[_0x17ff60];var _0x392a51=[];var _0x300754=[];delete _0x411711['id'];if(_0x411711[_0xc0c9('0x32')]!=='*,*,*,*'){_0x411711[_0xc0c9('0x34')]=[_0x411711[_0xc0c9('0x32')]];}else{_0x411711[_0xc0c9('0x34')]=_0x411711['IntervalId']?_[_0xc0c9('0x35')](_[_0xc0c9('0x36')](_0x53c702,{'IntervalId':_0x411711[_0xc0c9('0x33')]}),_0xc0c9('0x32')):[];}_0x411711[_0xc0c9('0x7')]=_0x1c9565[_0xc0c9('0x7')];_0x411711[_0xc0c9('0x8')]=_0x1c9565[_0xc0c9('0x8')];if(_0x411711[_0xc0c9('0x4')])_0x411711[_0xc0c9('0x4')]=_0x411711['type']['toLowerCase']();if(_0x1c9565['type']===_0xc0c9('0xf')){if(_0x411711[_0xc0c9('0x1c')](_0xc0c9('0x37'))&&_0x411711[_0xc0c9('0x37')]&&_0x411711['tag']!=='--'){_0x392a51[_0xc0c9('0xd')]({'type':_0x411711['type'][_0xc0c9('0x38')](),'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x39')+_0x411711[_0xc0c9('0x37')],'context':_0x1c9565[_0xc0c9('0x7')],'exten':_0x1c9565[_0xc0c9('0x8')],'priority':_0x411711[_0xc0c9('0x34')][_0xc0c9('0x25')]+_0x1de39d+_0x311622++,'VoiceExtensionId':_0x1c9565['id']});}_0x392a51['push']({'type':_0x411711[_0xc0c9('0x4')][_0xc0c9('0x38')](),'app':_0xc0c9('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x411711[_0xc0c9('0x3a')]?_0xc0c9('0x3b')+_0x411711[_0xc0c9('0x3a')]+')':_0xc0c9('0x3c')),'context':_0x1c9565[_0xc0c9('0x7')],'exten':_0x1c9565['exten'],'priority':_0x411711[_0xc0c9('0x34')][_0xc0c9('0x25')]+_0x1de39d+_0x311622++,'VoiceExtensionId':_0x1c9565['id']});}else{if(_0x411711[_0xc0c9('0x1c')]('answer')){if([_0xc0c9('0x3d'),_0xc0c9('0x3e')]['includes'](_0x411711[_0xc0c9('0x3f')][_0xc0c9('0x38')]())&&_0x411711['appType']!==_0xc0c9('0x40')){if(_0x411711[_0xc0c9('0x41')]){_0x392a51[_0xc0c9('0xd')]({'type':_0x411711[_0xc0c9('0x4')][_0xc0c9('0x38')](),'app':_0xc0c9('0x17'),'appdata':_0xc0c9('0x42'),'context':_0x1c9565[_0xc0c9('0x7')],'exten':_0x1c9565[_0xc0c9('0x8')],'priority':_0x411711['intervals'][_0xc0c9('0x25')]+_0x1de39d+_0x311622++,'VoiceExtensionId':_0x1c9565['id']});_0x392a51['push']({'type':_0x411711[_0xc0c9('0x4')][_0xc0c9('0x38')](),'app':'Set','appdata':_0xc0c9('0x43'),'context':_0x1c9565[_0xc0c9('0x7')],'exten':_0x1c9565[_0xc0c9('0x8')],'priority':_0x411711[_0xc0c9('0x34')][_0xc0c9('0x25')]+_0x1de39d+_0x311622++,'VoiceExtensionId':_0x1c9565['id']});}else{_0x392a51[_0xc0c9('0xd')]({'type':_0x411711[_0xc0c9('0x4')]['toLowerCase'](),'app':_0xc0c9('0x17'),'appdata':_0xc0c9('0x44'),'context':_0x1c9565[_0xc0c9('0x7')],'exten':_0x1c9565[_0xc0c9('0x8')],'priority':_0x411711[_0xc0c9('0x34')][_0xc0c9('0x25')]+_0x1de39d+_0x311622++,'VoiceExtensionId':_0x1c9565['id']});_0x392a51[_0xc0c9('0xd')]({'type':_0x411711[_0xc0c9('0x4')]['toLowerCase'](),'app':_0xc0c9('0x5'),'appdata':_0xc0c9('0x45'),'context':_0x1c9565['context'],'exten':_0x1c9565[_0xc0c9('0x8')],'priority':_0x411711[_0xc0c9('0x34')][_0xc0c9('0x25')]+_0x1de39d+_0x311622++,'VoiceExtensionId':_0x1c9565['id']});}}}}for(var _0x1acac3=0x0;_0x1acac3<_0x411711['intervals'][_0xc0c9('0x25')];_0x1acac3++){var _0x2993d2=_0x1de39d+_0x411711[_0xc0c9('0x34')][_0xc0c9('0x25')];var _0x44a0e4=_0x1acac3===_0x411711[_0xc0c9('0x34')][_0xc0c9('0x25')]-0x1?_0x1de39d+_0x392a51['length']+_0x300754[_0xc0c9('0x25')]+0x2:_0x1de39d+_0x1acac3+0x1;_0x392a51['splice'](_0x1acac3,0x0,{'type':_0x1c9565[_0xc0c9('0x4')],'app':_0xc0c9('0x46'),'appdata':_0x411711[_0xc0c9('0x34')][_0x1acac3]+'?'+_0x1c9565[_0xc0c9('0x7')]+_0xc0c9('0x47')+_0x2993d2+':'+_0x1c9565[_0xc0c9('0x7')]+_0xc0c9('0x47')+_0x44a0e4,'exten':_0x1c9565[_0xc0c9('0x8')],'context':_0x1c9565['context'],'priority':_0x1de39d+_0x1acac3,'VoiceExtensionId':_0x1c9565['id']});}if(_0x411711[_0xc0c9('0x48')]==='outboundDial')_0x411711[_0xc0c9('0x49')]=_0x2fda41(_0x1c9565,_0x411711['appdata']);_0x411711['priority']=_0x392a51[_0xc0c9('0x25')]?_[_0xc0c9('0x4a')](_0x392a51)[_0xc0c9('0x4b')]+0x1:_0x1de39d;_0x3696ba=_[_0xc0c9('0x4c')](_0x3696ba,_0x392a51,[_0x411711],_0x300754);_0x1de39d=_[_0xc0c9('0x4a')](_0x3696ba)[_0xc0c9('0x4b')]+0x1;}return _0x52b5e6(_0x3696ba);})[_0xc0c9('0x4d')](function(_0x128017){_0x4ba503(_0x128017);});});}return _0x3cc26b[_0xc0c9('0x4e')]('VoiceExtension',attributes,{'tableName':_0xc0c9('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x17da94){var _0x255803=this[_0xc0c9('0x50')]({'plain':!![]});var _0x2ebd29=_0x255803['type']===_0xc0c9('0xf')?_0x9786eb(_0x255803):_0x5bc767(_0x255803);return _0xf6bbf0(_0x255803,_0x17da94,_[_0xc0c9('0x4a')](_0x2ebd29)['priority']+0x1)[_0xc0c9('0x51')](function(_0x3264ce){var _0x1edf4c=_[_0xc0c9('0x4c')](_0x2ebd29,_0x3264ce);_0x1edf4c['push']({'type':_0x255803['type'],'app':_0xc0c9('0x52'),'exten':_0x255803[_0xc0c9('0x8')],'context':_0x255803['context'],'priority':_[_0xc0c9('0x4a')](_0x1edf4c)[_0xc0c9('0x4b')]+0x1,'VoiceExtensionId':_0x255803['id']});return _0x1edf4c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 95c2968..b5f984a 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 _0x5c91=['raw','where','attributes','limit','include','map','model','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetVoiceExtension','VoiceExtension','options'];(function(_0x450331,_0x50de00){var _0xf1abc7=function(_0x4b3256){while(--_0x4b3256){_0x450331['push'](_0x450331['shift']());}};_0xf1abc7(++_0x50de00);}(_0x5c91,0x1e9));var _0x15c9=function(_0x21e6fe,_0x119c11){_0x21e6fe=_0x21e6fe-0x0;var _0x27644a=_0x5c91[_0x21e6fe];return _0x27644a;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var moment=require(_0x15c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x15c9('0x3'));var fs=require('fs');var Redis=require(_0x15c9('0x4'));var db=require(_0x15c9('0x5'))['db'];var utils=require(_0x15c9('0x6'));var logger=require(_0x15c9('0x7'))(_0x15c9('0x8'));var config=require('../../config/environment');var jayson=require(_0x15c9('0x9'));var client=jayson[_0x15c9('0xa')][_0x15c9('0xb')]({'port':0x232a});config[_0x15c9('0xc')]=_[_0x15c9('0xd')](config['redis'],{'host':_0x15c9('0xe'),'port':0x18eb});var socket=require(_0x15c9('0xf'))(new Redis(config[_0x15c9('0xc')]));require('./voiceExtension.socket')[_0x15c9('0x10')](socket);function respondWithRpcPromise(_0x3e45c0,_0x1aba8a,_0x5b56c4){return new BPromise(function(_0x52a1e0,_0x33bf88){return client[_0x15c9('0x11')](_0x3e45c0,_0x5b56c4)['then'](function(_0x5c1eb7){logger['info'](_0x15c9('0x12'),_0x1aba8a,_0x15c9('0x13'));logger['debug'](_0x15c9('0x14'),_0x1aba8a,_0x15c9('0x13'),JSON[_0x15c9('0x15')](_0x5c1eb7));if(_0x5c1eb7['error']){if(_0x5c1eb7['error'][_0x15c9('0x16')]===0x1f4){logger[_0x15c9('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1aba8a,_0x5c1eb7[_0x15c9('0x17')]['message']);return _0x33bf88(_0x5c1eb7[_0x15c9('0x17')][_0x15c9('0x18')]);}logger[_0x15c9('0x17')](_0x15c9('0x12'),_0x1aba8a,_0x5c1eb7[_0x15c9('0x17')][_0x15c9('0x18')]);return _0x52a1e0(_0x5c1eb7['error'][_0x15c9('0x18')]);}else{logger[_0x15c9('0x19')](_0x15c9('0x12'),_0x1aba8a,_0x15c9('0x13'));_0x52a1e0(_0x5c1eb7[_0x15c9('0x1a')][_0x15c9('0x18')]);}})[_0x15c9('0x1b')](function(_0x1382ee){logger['error'](_0x15c9('0x12'),_0x1aba8a,_0x1382ee);_0x33bf88(_0x1382ee);});});}exports[_0x15c9('0x1c')]=function(_0x3ea3df){var _0x5683ca=this;return new Promise(function(_0x29471d,_0x4539c0){return db[_0x15c9('0x1d')]['findAll']({'raw':_0x3ea3df[_0x15c9('0x1e')]?_0x3ea3df[_0x15c9('0x1e')][_0x15c9('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ea3df[_0x15c9('0x1e')]?_0x3ea3df[_0x15c9('0x1e')][_0x15c9('0x20')]||null:null,'attributes':_0x3ea3df[_0x15c9('0x1e')]?_0x3ea3df[_0x15c9('0x1e')][_0x15c9('0x21')]||null:null,'limit':_0x3ea3df[_0x15c9('0x1e')]?_0x3ea3df['options'][_0x15c9('0x22')]||null:null,'include':_0x3ea3df['options']?_0x3ea3df[_0x15c9('0x1e')][_0x15c9('0x23')]?_['map'](_0x3ea3df[_0x15c9('0x1e')][_0x15c9('0x23')],function(_0x117f99){return{'model':db[_0x117f99['model']],'as':_0x117f99['as'],'attributes':_0x117f99['attributes'],'include':_0x117f99[_0x15c9('0x23')]?_[_0x15c9('0x24')](_0x117f99[_0x15c9('0x23')],function(_0x1205e2){return{'model':db[_0x1205e2['model']],'as':_0x1205e2['as'],'attributes':_0x1205e2[_0x15c9('0x21')],'include':_0x1205e2[_0x15c9('0x23')]?_[_0x15c9('0x24')](_0x1205e2[_0x15c9('0x23')],function(_0x1ccc4b){return{'model':db[_0x1ccc4b[_0x15c9('0x25')]],'as':_0x1ccc4b['as'],'attributes':_0x1ccc4b[_0x15c9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x15c9('0x26')](function(_0x5ca63f){logger[_0x15c9('0x19')](_0x15c9('0x1c'),_0x3ea3df);logger[_0x15c9('0x27')](_0x15c9('0x1c'),_0x3ea3df,JSON[_0x15c9('0x15')](_0x5ca63f));_0x29471d(_0x5ca63f);})[_0x15c9('0x1b')](function(_0x411357){logger[_0x15c9('0x17')](_0x15c9('0x1c'),_0x411357[_0x15c9('0x18')],_0x3ea3df);_0x4539c0(_0x5683ca[_0x15c9('0x17')](0x1f4,_0x411357[_0x15c9('0x18')]));});});}; \ No newline at end of file +var _0x4312=['defaults','localhost','socket.io-emitter','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceExtension','findAll','options','where','limit','map','include','model','attributes','GetVoiceExtension','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x4312,0xaf));var _0x2431=function(_0x3c7f77,_0x50b2a2){_0x3c7f77=_0x3c7f77-0x0;var _0x7f4d0=_0x4312[_0x3c7f77];return _0x7f4d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2431('0x0'));var BPromise=require(_0x2431('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2431('0x2'));var db=require(_0x2431('0x3'))['db'];var utils=require(_0x2431('0x4'));var logger=require(_0x2431('0x5'))(_0x2431('0x6'));var config=require(_0x2431('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2431('0x8')]['http']({'port':0x232a});config[_0x2431('0x9')]=_[_0x2431('0xa')](config['redis'],{'host':_0x2431('0xb'),'port':0x18eb});var socket=require(_0x2431('0xc'))(new Redis(config[_0x2431('0x9')]));require('./voiceExtension.socket')[_0x2431('0xd')](socket);function respondWithRpcPromise(_0x26b223,_0xb751e,_0x568a96){return new BPromise(function(_0x12615b,_0x4a71f2){return client[_0x2431('0xe')](_0x26b223,_0x568a96)[_0x2431('0xf')](function(_0x384711){logger['info'](_0x2431('0x10'),_0xb751e,_0x2431('0x11'));logger[_0x2431('0x12')](_0x2431('0x13'),_0xb751e,'request\x20sent',JSON[_0x2431('0x14')](_0x384711));if(_0x384711[_0x2431('0x15')]){if(_0x384711[_0x2431('0x15')][_0x2431('0x16')]===0x1f4){logger[_0x2431('0x15')](_0x2431('0x10'),_0xb751e,_0x384711[_0x2431('0x15')][_0x2431('0x17')]);return _0x4a71f2(_0x384711[_0x2431('0x15')]['message']);}logger[_0x2431('0x15')](_0x2431('0x10'),_0xb751e,_0x384711[_0x2431('0x15')][_0x2431('0x17')]);return _0x12615b(_0x384711[_0x2431('0x15')][_0x2431('0x17')]);}else{logger[_0x2431('0x18')](_0x2431('0x10'),_0xb751e,_0x2431('0x11'));_0x12615b(_0x384711[_0x2431('0x19')][_0x2431('0x17')]);}})[_0x2431('0x1a')](function(_0x3b1776){logger[_0x2431('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xb751e,_0x3b1776);_0x4a71f2(_0x3b1776);});});}exports['GetVoiceExtension']=function(_0x3b4fa0){var _0x41b5df=this;return new Promise(function(_0x2e6b2b,_0x51d1ef){return db[_0x2431('0x1b')][_0x2431('0x1c')]({'raw':_0x3b4fa0['options']?_0x3b4fa0['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b4fa0['options']?_0x3b4fa0[_0x2431('0x1d')][_0x2431('0x1e')]||null:null,'attributes':_0x3b4fa0[_0x2431('0x1d')]?_0x3b4fa0[_0x2431('0x1d')]['attributes']||null:null,'limit':_0x3b4fa0[_0x2431('0x1d')]?_0x3b4fa0['options'][_0x2431('0x1f')]||null:null,'include':_0x3b4fa0[_0x2431('0x1d')]?_0x3b4fa0[_0x2431('0x1d')]['include']?_[_0x2431('0x20')](_0x3b4fa0[_0x2431('0x1d')][_0x2431('0x21')],function(_0x55914b){return{'model':db[_0x55914b['model']],'as':_0x55914b['as'],'attributes':_0x55914b['attributes'],'include':_0x55914b[_0x2431('0x21')]?_['map'](_0x55914b[_0x2431('0x21')],function(_0xf7afb5){return{'model':db[_0xf7afb5[_0x2431('0x22')]],'as':_0xf7afb5['as'],'attributes':_0xf7afb5[_0x2431('0x23')],'include':_0xf7afb5['include']?_['map'](_0xf7afb5[_0x2431('0x21')],function(_0x3954cc){return{'model':db[_0x3954cc['model']],'as':_0x3954cc['as'],'attributes':_0x3954cc[_0x2431('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2431('0xf')](function(_0x5842fb){logger[_0x2431('0x18')](_0x2431('0x24'),_0x3b4fa0);logger['debug'](_0x2431('0x24'),_0x3b4fa0,JSON[_0x2431('0x14')](_0x5842fb));_0x2e6b2b(_0x5842fb);})[_0x2431('0x1a')](function(_0x141478){logger[_0x2431('0x15')](_0x2431('0x24'),_0x141478[_0x2431('0x17')],_0x3b4fa0);_0x51d1ef(_0x41b5df[_0x2431('0x15')](0x1f4,_0x141478[_0x2431('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ea4fc8d..56d5836 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(_0xb0c45b,_0x5c2062){var _0xd87f1b=function(_0x4fb3e3){while(--_0x4fb3e3){_0xb0c45b['push'](_0xb0c45b['shift']());}};_0xd87f1b(++_0x5c2062);}(_0xabce,0x103));var _0xeabc=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xabce[_0x54d4fe];return _0x1ab5bb;};'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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x1e81ff,_0x17ee68){var _0x4a7c91=function(_0x47001d){while(--_0x47001d){_0x1e81ff['push'](_0x1e81ff['shift']());}};_0x4a7c91(++_0x17ee68);}(_0x4975,0x86));var _0x5497=function(_0x364266,_0x34da55){_0x364266=_0x364266-0x0;var _0x195ace=_0x4975[_0x364266];return _0x195ace;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 247c710..19613e1 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x741c=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMail.controller'];(function(_0x52bd47,_0x2f3399){var _0x3b2bad=function(_0x265004){while(--_0x265004){_0x52bd47['push'](_0x52bd47['shift']());}};_0x3b2bad(++_0x2f3399);}(_0x741c,0x196));var _0xc741=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x741c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['show']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x11')](_0xc741('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe3da=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy'];(function(_0x46b389,_0x1fc6af){var _0x3a7f6b=function(_0x110240){while(--_0x110240){_0x46b389['push'](_0x46b389['shift']());}};_0x3a7f6b(++_0x1fc6af);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router['delete'](_0xae3d('0xe'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x15')]);module[_0xae3d('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9f9e760..72673c5 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 _0xed61=['TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim','yes','ENUM'];(function(_0x1eee8b,_0x50666d){var _0x1a9e87=function(_0xc8a5f6){while(--_0xc8a5f6){_0x1eee8b['push'](_0x1eee8b['shift']());}};_0x1a9e87(++_0x50666d);}(_0xed61,0x123));var _0x1ed6=function(_0x4ddb4e,_0x38c020){_0x4ddb4e=_0x4ddb4e-0x0;var _0x1c2f4c=_0xed61[_0x4ddb4e];return _0x1c2f4c;};'use strict';var Sequelize=require(_0x1ed6('0x0'));module[_0x1ed6('0x1')]={'customer_id':{'type':Sequelize[_0x1ed6('0x2')]},'context':{'type':Sequelize[_0x1ed6('0x2')],'defaultValue':_0x1ed6('0x3'),'unique':_0x1ed6('0x4')},'mailbox':{'type':Sequelize[_0x1ed6('0x2')],'defaultValue':'','allowNull':![],'unique':_0x1ed6('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x1ed6('0x2')]},'email':{'type':Sequelize[_0x1ed6('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3b9501){this['setDataValue']('email',typeof _0x3b9501===_0x1ed6('0x5')&&_0x3b9501[_0x1ed6('0x6')]()?_0x3b9501[_0x1ed6('0x6')]():null);}},'pager':{'type':Sequelize[_0x1ed6('0x2')]},'tz':{'type':Sequelize[_0x1ed6('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x1ed6('0x7'),'no'),'defaultValue':_0x1ed6('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x1ed6('0x7'),'no'),'defaultValue':_0x1ed6('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1ed6('0x2')]},'callback':{'type':Sequelize[_0x1ed6('0x2')]},'review':{'type':Sequelize[_0x1ed6('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1ed6('0x8')](_0x1ed6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x1ed6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1ed6('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1ed6('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1ed6('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1ed6('0x8')](_0x1ed6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1ed6('0x8')](_0x1ed6('0x7'),'no'),'defaultValue':_0x1ed6('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1ed6('0x8')](_0x1ed6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1ed6('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1ed6('0x7'),'allowNull':![]},'stamp':{'type':_0x1ed6('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x1ed6('0x2')]},'maxsecs':{'type':Sequelize[_0x1ed6('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1ed6('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1ed6('0xc')](_0x1ed6('0xd'))+_0x1ed6('0xe')+this[_0x1ed6('0xc')]('mailbox');}}}; \ No newline at end of file +var _0x0bb4=['yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x0bb4,0xdf));var _0x40bb=function(_0x2ddf90,_0x66e2b4){_0x2ddf90=_0x2ddf90-0x0;var _0x263d16=_0x0bb4[_0x2ddf90];return _0x263d16;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'customer_id':{'type':Sequelize[_0x40bb('0x2')]},'context':{'type':Sequelize[_0x40bb('0x2')],'defaultValue':_0x40bb('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x40bb('0x2')],'defaultValue':'','allowNull':![],'unique':_0x40bb('0x4')},'password':{'type':Sequelize[_0x40bb('0x2')]},'fullname':{'type':Sequelize[_0x40bb('0x2')]},'email':{'type':Sequelize[_0x40bb('0x2')],'validate':{'isEmail':!![]},'set':function(_0x43fc57){this[_0x40bb('0x5')](_0x40bb('0x6'),typeof _0x43fc57===_0x40bb('0x7')&&_0x43fc57[_0x40bb('0x8')]()?_0x43fc57[_0x40bb('0x8')]():null);}},'pager':{'type':Sequelize[_0x40bb('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x40bb('0x9')},'attach':{'type':Sequelize[_0x40bb('0xa')](_0x40bb('0xb'),'no'),'defaultValue':_0x40bb('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x40bb('0xa')](_0x40bb('0xb'),'no'),'defaultValue':_0x40bb('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x40bb('0x2')]},'callback':{'type':Sequelize[_0x40bb('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x40bb('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x40bb('0xa')](_0x40bb('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x40bb('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x40bb('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x40bb('0xa')](_0x40bb('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x40bb('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x40bb('0xa')]('yes','no'),'defaultValue':_0x40bb('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x40bb('0xa')](_0x40bb('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x40bb('0xa')](_0x40bb('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x40bb('0xd')},'emailsubject':{'type':Sequelize[_0x40bb('0x2')]},'emailbody':{'type':Sequelize[_0x40bb('0x2')]},'maxsecs':{'type':Sequelize[_0x40bb('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x40bb('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x40bb('0xf')]('fullname')+_0x40bb('0x10')+this['getDataValue'](_0x40bb('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index cfdd241..34ceafe 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 _0x1339=['../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VoiceMail','count','includeAll','include','findAll','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','pick','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1339,0x1ed));var _0x9133=function(_0x100438,_0x1a6fde){_0x100438=_0x100438-0x0;var _0x4f6b9f=_0x1339[_0x100438];return _0x4f6b9f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){var _0x187e32=_0x4f26e8[_0x9133('0x22')]({'plain':!![]});var _0x3f278d=_0x9133('0x23');return db[_0x9133('0x24')][_0x9133('0x21')]({'where':{'type':_0x3f278d,'resourceId':_0x187e32['id']}})[_0x9133('0x20')](function(){return _0x4f26e8;});})[_0x9133('0x20')](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x25')]();});}};}function handleEntityNotFound(_0x51de62,_0x517e7b){return function(_0x477bf1){if(!_0x477bf1){_0x51de62[_0x9133('0x26')](0x194);}return _0x477bf1;};}function handleError(_0x428e18,_0x348486){_0x348486=_0x348486||0x1f4;return function(_0x4de894){logger['error'](_0x4de894[_0x9133('0x27')]);if(_0x4de894[_0x9133('0x28')]){delete _0x4de894[_0x9133('0x28')];}_0x428e18[_0x9133('0x1a')](_0x348486)[_0x9133('0x29')](_0x4de894);};}exports[_0x9133('0x2a')]=function(_0x48c713,_0x58afe0){var _0x5a27c1={},_0x1ad222={},_0x4a4a8e={'count':0x0,'rows':[]};var _0x43b5f3=_[_0x9133('0x2b')](db['VoiceMail'][_0x9133('0x2c')],function(_0x5dd90b){return{'name':_0x5dd90b[_0x9133('0x2d')],'type':_0x5dd90b[_0x9133('0x2e')][_0x9133('0x2f')]};});_0x1ad222['model']=_[_0x9133('0x2b')](_0x43b5f3,_0x9133('0x28'));_0x1ad222[_0x9133('0x30')]=_['keys'](_0x48c713[_0x9133('0x30')]);_0x1ad222[_0x9133('0x31')]=_[_0x9133('0x32')](_0x1ad222['model'],_0x1ad222[_0x9133('0x30')]);_0x5a27c1[_0x9133('0x33')]=_[_0x9133('0x32')](_0x1ad222[_0x9133('0x34')],qs['fields'](_0x48c713[_0x9133('0x30')][_0x9133('0x35')]));_0x5a27c1['attributes']=_0x5a27c1[_0x9133('0x33')][_0x9133('0x36')]?_0x5a27c1[_0x9133('0x33')]:_0x1ad222[_0x9133('0x34')];if(!_0x48c713[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x5a27c1[_0x9133('0x1d')]=qs[_0x9133('0x1d')](_0x48c713[_0x9133('0x30')][_0x9133('0x1d')]);_0x5a27c1['offset']=qs[_0x9133('0x1e')](_0x48c713[_0x9133('0x30')]['offset']);}_0x5a27c1[_0x9133('0x39')]=qs[_0x9133('0x3a')](_0x48c713[_0x9133('0x30')][_0x9133('0x3a')]);_0x5a27c1[_0x9133('0x3b')]=qs[_0x9133('0x31')](_['pick'](_0x48c713['query'],_0x1ad222[_0x9133('0x31')]),_0x43b5f3);if(_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]){_0x5a27c1[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x5a27c1[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x43b5f3,function(_0x2ee83e){if(_0x2ee83e[_0x9133('0x2e')]!=='VIRTUAL'){var _0xafd8f9={};_0xafd8f9[_0x2ee83e[_0x9133('0x28')]]={'$like':'%'+_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]+'%'};return _0xafd8f9;}})});}_0x5a27c1=_[_0x9133('0x3d')]({},_0x5a27c1,_0x48c713['options']);var _0x3c691e={'where':_0x5a27c1[_0x9133('0x3b')]};return db[_0x9133('0x3e')][_0x9133('0x3f')](_0x3c691e)['then'](function(_0x146734){_0x4a4a8e[_0x9133('0x3f')]=_0x146734;if(_0x48c713[_0x9133('0x30')][_0x9133('0x40')]){_0x5a27c1[_0x9133('0x41')]=[{'all':!![]}];}return db[_0x9133('0x3e')][_0x9133('0x42')](_0x5a27c1);})['then'](function(_0x7f6cd9){_0x4a4a8e['rows']=_0x7f6cd9;return _0x4a4a8e;})['then'](respondWithFilteredResult(_0x58afe0,_0x5a27c1))[_0x9133('0x43')](handleError(_0x58afe0,null));};exports[_0x9133('0x44')]=function(_0x46156d,_0x264df4){var _0xdd485f={'raw':!![],'where':{'id':_0x46156d[_0x9133('0x45')]['id']}},_0x2d2bf7={};_0x2d2bf7[_0x9133('0x34')]=_[_0x9133('0x46')](db['VoiceMail'][_0x9133('0x2c')]);_0x2d2bf7[_0x9133('0x30')]=_[_0x9133('0x46')](_0x46156d['query']);_0x2d2bf7['filters']=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],_0x2d2bf7['query']);_0xdd485f[_0x9133('0x33')]=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],qs[_0x9133('0x35')](_0x46156d[_0x9133('0x30')]['fields']));_0xdd485f[_0x9133('0x33')]=_0xdd485f[_0x9133('0x33')][_0x9133('0x36')]?_0xdd485f['attributes']:_0x2d2bf7[_0x9133('0x34')];if(_0x46156d[_0x9133('0x30')]['includeAll']){_0xdd485f['include']=[{'all':!![]}];}_0xdd485f=_[_0x9133('0x3d')]({},_0xdd485f,_0x46156d[_0x9133('0x47')]);return db[_0x9133('0x3e')][_0x9133('0x48')](_0xdd485f)[_0x9133('0x20')](handleEntityNotFound(_0x264df4,null))[_0x9133('0x20')](respondWithResult(_0x264df4,null))[_0x9133('0x43')](handleError(_0x264df4,null));};exports[_0x9133('0x49')]=function(_0x23f134,_0xf07fbb){return db[_0x9133('0x3e')][_0x9133('0x49')](_0x23f134['body'],{})['then'](function(_0xf2e098){var _0x4dc2f3=_0x23f134[_0x9133('0x4a')][_0x9133('0x22')]({'plain':!![]});if(!_0x4dc2f3)throw new Error(_0x9133('0x4b'));if(_0x4dc2f3[_0x9133('0x4c')]==='user'){var _0x2a3848=_0xf2e098[_0x9133('0x22')]({'plain':!![]});var _0x799772='Voicemails';return db[_0x9133('0x4d')][_0x9133('0x48')]({'where':{'name':_0x799772,'userProfileId':_0x4dc2f3[_0x9133('0x4e')]},'raw':!![]})['then'](function(_0x14c825){if(_0x14c825&&_0x14c825['autoAssociation']===0x0){return db[_0x9133('0x24')][_0x9133('0x49')]({'name':_0x2a3848[_0x9133('0x28')],'resourceId':_0x2a3848['id'],'type':_0x14c825[_0x9133('0x28')],'sectionId':_0x14c825['id']},{})['then'](function(){return _0xf2e098;});}else{return _0xf2e098;}})['catch'](function(_0x2f09f6){logger[_0x9133('0x4f')](_0x9133('0x50'),_0x2f09f6);throw _0x2f09f6;});}return _0xf2e098;})[_0x9133('0x20')](respondWithResult(_0xf07fbb,0xc9))[_0x9133('0x43')](handleError(_0xf07fbb,null));};exports['update']=function(_0x554bb9,_0x33599b){if(_0x554bb9[_0x9133('0x51')]['id']){delete _0x554bb9['body']['id'];}return db[_0x9133('0x3e')][_0x9133('0x48')]({'where':{'id':_0x554bb9['params']['id']}})['then'](handleEntityNotFound(_0x33599b,null))['then'](saveUpdates(_0x554bb9[_0x9133('0x51')],null))['then'](respondWithResult(_0x33599b,null))[_0x9133('0x43')](handleError(_0x33599b,null));};exports[_0x9133('0x21')]=function(_0x439258,_0x3d6daa){return db['VoiceMail'][_0x9133('0x48')]({'where':{'id':_0x439258['params']['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3d6daa,null))[_0x9133('0x20')](removeEntity(_0x3d6daa,null))[_0x9133('0x43')](handleError(_0x3d6daa,null));};exports[_0x9133('0x52')]=function(_0x3b9927,_0x3534bf,_0x56861c){return db['VoiceMail']['findOne']({'where':{'id':_0x3b9927[_0x9133('0x45')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3534bf,null))[_0x9133('0x20')](function(_0x54a330){var _0x3f4cd7;var _0x1f6684={},_0x415d55={};_0x415d55[_0x9133('0x34')]=_[_0x9133('0x46')](db[_0x9133('0x53')][_0x9133('0x2c')]);_0x415d55[_0x9133('0x30')]=_['keys'](_0x3b9927[_0x9133('0x30')]);_0x415d55['filters']=_[_0x9133('0x32')](_0x415d55['model'],_0x415d55[_0x9133('0x30')]);_0x1f6684[_0x9133('0x33')]=_['intersection'](_0x415d55['model'],qs[_0x9133('0x35')](_0x3b9927[_0x9133('0x30')][_0x9133('0x35')]));_0x1f6684[_0x9133('0x33')]=_0x1f6684[_0x9133('0x33')][_0x9133('0x36')]?_0x1f6684[_0x9133('0x33')]:_0x415d55[_0x9133('0x34')];if(!_0x3b9927[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x1f6684['limit']=qs[_0x9133('0x1d')](_0x3b9927['query'][_0x9133('0x1d')]);_0x1f6684[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x3b9927[_0x9133('0x30')][_0x9133('0x1e')]);}_0x1f6684['order']=qs[_0x9133('0x3a')](_0x3b9927[_0x9133('0x30')][_0x9133('0x3a')]);_0x1f6684[_0x9133('0x3b')]=qs['filters'](_[_0x9133('0x54')](_0x3b9927[_0x9133('0x30')],_0x415d55[_0x9133('0x31')]));if(_0x3b9927[_0x9133('0x30')]['filter']){_0x1f6684['where']=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x1f6684[_0x9133('0x33')],function(_0x28cc46){var _0x2cfaf8={};_0x2cfaf8[_0x28cc46]={'$like':'%'+_0x3b9927['query'][_0x9133('0x3c')]+'%'};return _0x2cfaf8;})});}_0x1f6684[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'mailboxuser':_0x54a330['mailbox']});_0x1f6684=_[_0x9133('0x3d')]({},_0x1f6684,_0x3b9927['options']);return db[_0x9133('0x53')][_0x9133('0x55')](_0x1f6684)[_0x9133('0x20')](respondWithFilteredResult(_0x3534bf,_0x1f6684));})[_0x9133('0x43')](handleError(_0x3534bf,null));}; \ No newline at end of file +var _0x13f6=['destroy','Voicemails','error','send','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x523507,_0x50f5b6){var _0x5eb36a=function(_0x1adfef){while(--_0x1adfef){_0x523507['push'](_0x523507['shift']());}};_0x5eb36a(++_0x50f5b6);}(_0x13f6,0x124));var _0x613f=function(_0x553ef6,_0x4db5e4){_0x553ef6=_0x553ef6-0x0;var _0x3d0e71=_0x13f6[_0x553ef6];return _0x3d0e71;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){var _0x3013a1=_0x33e0c6['get']({'plain':!![]});var _0x30fb15=_0x613f('0x25');return db['UserProfileResource'][_0x613f('0x24')]({'where':{'type':_0x30fb15,'resourceId':_0x3013a1['id']}})[_0x613f('0x23')](function(){return _0x33e0c6;});})[_0x613f('0x23')](function(){_0x51f376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4a8b,_0x379920){return function(_0x594c28){if(!_0x594c28){_0x5a4a8b[_0x613f('0x16')](0x194);}return _0x594c28;};}function handleError(_0x1767db,_0x4ca372){_0x4ca372=_0x4ca372||0x1f4;return function(_0x121241){logger[_0x613f('0x26')](_0x121241['stack']);if(_0x121241['name']){delete _0x121241['name'];}_0x1767db[_0x613f('0x17')](_0x4ca372)[_0x613f('0x27')](_0x121241);};}exports[_0x613f('0x28')]=function(_0x47f4af,_0x23eda8){var _0x439478={},_0xd335a6={},_0x19bb8f={'count':0x0,'rows':[]};var _0x4f8500=_[_0x613f('0x29')](db[_0x613f('0x2a')][_0x613f('0x2b')],function(_0x728f45){return{'name':_0x728f45[_0x613f('0x2c')],'type':_0x728f45[_0x613f('0x2d')]['key']};});_0xd335a6[_0x613f('0x2e')]=_[_0x613f('0x29')](_0x4f8500,_0x613f('0x2f'));_0xd335a6['query']=_[_0x613f('0x30')](_0x47f4af['query']);_0xd335a6[_0x613f('0x31')]=_[_0x613f('0x32')](_0xd335a6[_0x613f('0x2e')],_0xd335a6[_0x613f('0x33')]);_0x439478[_0x613f('0x34')]=_[_0x613f('0x32')](_0xd335a6['model'],qs[_0x613f('0x35')](_0x47f4af[_0x613f('0x33')][_0x613f('0x35')]));_0x439478[_0x613f('0x34')]=_0x439478[_0x613f('0x34')]['length']?_0x439478['attributes']:_0xd335a6['model'];if(!_0x47f4af[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x439478[_0x613f('0x1a')]=qs['limit'](_0x47f4af[_0x613f('0x33')][_0x613f('0x1a')]);_0x439478['offset']=qs[_0x613f('0x1d')](_0x47f4af['query'][_0x613f('0x1d')]);}_0x439478['order']=qs[_0x613f('0x38')](_0x47f4af['query'][_0x613f('0x38')]);_0x439478[_0x613f('0x39')]=qs[_0x613f('0x31')](_['pick'](_0x47f4af[_0x613f('0x33')],_0xd335a6[_0x613f('0x31')]),_0x4f8500);if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]){_0x439478[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x439478[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x4f8500,function(_0x1f71f3){if(_0x1f71f3[_0x613f('0x2d')]!=='VIRTUAL'){var _0x28b1bc={};_0x28b1bc[_0x1f71f3[_0x613f('0x2f')]]={'$like':'%'+_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x28b1bc;}})});}_0x439478=_[_0x613f('0x3b')]({},_0x439478,_0x47f4af[_0x613f('0x3c')]);var _0xa76fff={'where':_0x439478['where']};return db[_0x613f('0x2a')][_0x613f('0x1c')](_0xa76fff)[_0x613f('0x23')](function(_0x3d2d7b){_0x19bb8f[_0x613f('0x1c')]=_0x3d2d7b;if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3d')]){_0x439478['include']=[{'all':!![]}];}return db[_0x613f('0x2a')][_0x613f('0x3e')](_0x439478);})[_0x613f('0x23')](function(_0x2f584e){_0x19bb8f[_0x613f('0x3f')]=_0x2f584e;return _0x19bb8f;})[_0x613f('0x23')](respondWithFilteredResult(_0x23eda8,_0x439478))[_0x613f('0x40')](handleError(_0x23eda8,null));};exports[_0x613f('0x41')]=function(_0x403feb,_0x2d2574){var _0x12647a={'raw':!![],'where':{'id':_0x403feb[_0x613f('0x42')]['id']}},_0x258a71={};_0x258a71['model']=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x258a71[_0x613f('0x33')]=_['keys'](_0x403feb[_0x613f('0x33')]);_0x258a71[_0x613f('0x31')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],_0x258a71[_0x613f('0x33')]);_0x12647a[_0x613f('0x34')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x403feb[_0x613f('0x33')]['fields']));_0x12647a['attributes']=_0x12647a[_0x613f('0x34')][_0x613f('0x43')]?_0x12647a['attributes']:_0x258a71[_0x613f('0x2e')];if(_0x403feb[_0x613f('0x33')][_0x613f('0x3d')]){_0x12647a[_0x613f('0x44')]=[{'all':!![]}];}_0x12647a=_[_0x613f('0x3b')]({},_0x12647a,_0x403feb[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x12647a)[_0x613f('0x23')](handleEntityNotFound(_0x2d2574,null))[_0x613f('0x23')](respondWithResult(_0x2d2574,null))[_0x613f('0x40')](handleError(_0x2d2574,null));};exports[_0x613f('0x46')]=function(_0x174e22,_0x17f8e5){return db[_0x613f('0x2a')][_0x613f('0x46')](_0x174e22[_0x613f('0x47')],{})[_0x613f('0x23')](function(_0x5a4079){var _0x47c84b=_0x174e22[_0x613f('0x48')][_0x613f('0x49')]({'plain':!![]});if(!_0x47c84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47c84b['role']===_0x613f('0x48')){var _0x51729a=_0x5a4079['get']({'plain':!![]});var _0x6e006b=_0x613f('0x25');return db[_0x613f('0x4a')]['find']({'where':{'name':_0x6e006b,'userProfileId':_0x47c84b[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x4f59b6){if(_0x4f59b6&&_0x4f59b6['autoAssociation']===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x51729a[_0x613f('0x2f')],'resourceId':_0x51729a['id'],'type':_0x4f59b6[_0x613f('0x2f')],'sectionId':_0x4f59b6['id']},{})[_0x613f('0x23')](function(){return _0x5a4079;});}else{return _0x5a4079;}})[_0x613f('0x40')](function(_0x24d162){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24d162);throw _0x24d162;});}return _0x5a4079;})[_0x613f('0x23')](respondWithResult(_0x17f8e5,0xc9))['catch'](handleError(_0x17f8e5,null));};exports['update']=function(_0x387913,_0x52c2a6){if(_0x387913[_0x613f('0x47')]['id']){delete _0x387913['body']['id'];}return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x387913[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x52c2a6,null))[_0x613f('0x23')](saveUpdates(_0x387913[_0x613f('0x47')],null))[_0x613f('0x23')](respondWithResult(_0x52c2a6,null))['catch'](handleError(_0x52c2a6,null));};exports[_0x613f('0x24')]=function(_0x4ff3ad,_0x3ce3dd){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x4ff3ad[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x3ce3dd,null))[_0x613f('0x23')](removeEntity(_0x3ce3dd,null))[_0x613f('0x40')](handleError(_0x3ce3dd,null));};exports[_0x613f('0x4d')]=function(_0x214d01,_0x49637d,_0x2ebce1){return db[_0x613f('0x2a')][_0x613f('0x4e')]({'where':{'id':_0x214d01['params']['id']}})['then'](handleEntityNotFound(_0x49637d,null))[_0x613f('0x23')](function(_0x4b6eb3){var _0xcb1c9d;var _0x3c3cd7={},_0x42a72b={};_0x42a72b[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x4f')][_0x613f('0x2b')]);_0x42a72b[_0x613f('0x33')]=_[_0x613f('0x30')](_0x214d01[_0x613f('0x33')]);_0x42a72b[_0x613f('0x31')]=_['intersection'](_0x42a72b[_0x613f('0x2e')],_0x42a72b[_0x613f('0x33')]);_0x3c3cd7[_0x613f('0x34')]=_[_0x613f('0x32')](_0x42a72b['model'],qs[_0x613f('0x35')](_0x214d01[_0x613f('0x33')]['fields']));_0x3c3cd7['attributes']=_0x3c3cd7[_0x613f('0x34')]['length']?_0x3c3cd7['attributes']:_0x42a72b['model'];if(!_0x214d01[_0x613f('0x33')]['hasOwnProperty']('nolimit')){_0x3c3cd7['limit']=qs[_0x613f('0x1a')](_0x214d01[_0x613f('0x33')]['limit']);_0x3c3cd7[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x214d01[_0x613f('0x33')][_0x613f('0x1d')]);}_0x3c3cd7['order']=qs[_0x613f('0x38')](_0x214d01[_0x613f('0x33')]['sort']);_0x3c3cd7[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x50')](_0x214d01[_0x613f('0x33')],_0x42a72b[_0x613f('0x31')]));if(_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]){_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x3c3cd7[_0x613f('0x34')],function(_0x50d7ca){var _0x1c4e48={};_0x1c4e48[_0x50d7ca]={'$like':'%'+_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x1c4e48;})});}_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'mailboxuser':_0x4b6eb3['mailbox']});_0x3c3cd7=_[_0x613f('0x3b')]({},_0x3c3cd7,_0x214d01[_0x613f('0x3c')]);return db[_0x613f('0x4f')][_0x613f('0x51')](_0x3c3cd7)[_0x613f('0x23')](respondWithFilteredResult(_0x49637d,_0x3c3cd7));})[_0x613f('0x40')](handleError(_0x49637d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 092f359..d62b87f 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 _0x0844=['mailbox','context','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','VoiceMail','voice_voicemail'];(function(_0x1b425e,_0x54344a){var _0x15c399=function(_0x58b692){while(--_0x58b692){_0x1b425e['push'](_0x1b425e['shift']());}};_0x15c399(++_0x54344a);}(_0x0844,0x195));var _0x4084=function(_0x417777,_0x4010c7){_0x417777=_0x417777-0x0;var _0x8d4028=_0x0844[_0x417777];return _0x8d4028;};'use strict';var _=require(_0x4084('0x0'));var util=require(_0x4084('0x1'));var logger=require(_0x4084('0x2'))('api');var moment=require(_0x4084('0x3'));var BPromise=require(_0x4084('0x4'));var rp=require(_0x4084('0x5'));var fs=require('fs');var path=require(_0x4084('0x6'));var rimraf=require(_0x4084('0x7'));var config=require(_0x4084('0x8'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x46c65f,_0x1c8ea1){return _0x46c65f['define'](_0x4084('0x9'),attributes,{'tableName':_0x4084('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x4084('0xb'),_0x4084('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa334=['mailbox_context','mailbox','context','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceMail.attributes','exports','VoiceMail'];(function(_0x704a9,_0x63c62e){var _0x38c9eb=function(_0x5ce012){while(--_0x5ce012){_0x704a9['push'](_0x704a9['shift']());}};_0x38c9eb(++_0x63c62e);}(_0xa334,0x1cb));var _0x4a33=function(_0x2ce890,_0x5e04d2){_0x2ce890=_0x2ce890-0x0;var _0x48dee7=_0xa334[_0x2ce890];return _0x48dee7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a33('0x0'))(_0x4a33('0x1'));var moment=require(_0x4a33('0x2'));var BPromise=require(_0x4a33('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a33('0x4'));var rimraf=require('rimraf');var config=require(_0x4a33('0x5'));var attributes=require(_0x4a33('0x6'));module[_0x4a33('0x7')]=function(_0x56263f,_0x395545){return _0x56263f['define'](_0x4a33('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x4a33('0x9'),'fields':[_0x4a33('0xa'),_0x4a33('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1482525..fde4b5a 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 _0x629d=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info'];(function(_0x18e5c7,_0x392a80){var _0x55f2f0=function(_0x37b377){while(--_0x37b377){_0x18e5c7['push'](_0x18e5c7['shift']());}};_0x55f2f0(++_0x392a80);}(_0x629d,0x171));var _0xd629=function(_0x30a640,_0x300254){_0x30a640=_0x30a640-0x0;var _0x21f6b4=_0x629d[_0x30a640];return _0x21f6b4;};'use strict';var _=require('lodash');var util=require(_0xd629('0x0'));var moment=require(_0xd629('0x1'));var BPromise=require(_0xd629('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd629('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd629('0x4'));var logger=require(_0xd629('0x5'))(_0xd629('0x6'));var config=require(_0xd629('0x7'));var jayson=require(_0xd629('0x8'));var client=jayson[_0xd629('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f1f52,_0x40a47e,_0x313d74){return new BPromise(function(_0x4e77e9,_0x2fecdc){return client['request'](_0x2f1f52,_0x313d74)['then'](function(_0x385b4d){logger[_0xd629('0xa')](_0xd629('0xb'),_0x40a47e,_0xd629('0xc'));logger[_0xd629('0xd')](_0xd629('0xe'),_0x40a47e,_0xd629('0xc'),JSON[_0xd629('0xf')](_0x385b4d));if(_0x385b4d['error']){if(_0x385b4d[_0xd629('0x10')][_0xd629('0x11')]===0x1f4){logger[_0xd629('0x10')](_0xd629('0xb'),_0x40a47e,_0x385b4d['error'][_0xd629('0x12')]);return _0x2fecdc(_0x385b4d[_0xd629('0x10')][_0xd629('0x12')]);}logger[_0xd629('0x10')](_0xd629('0xb'),_0x40a47e,_0x385b4d[_0xd629('0x10')][_0xd629('0x12')]);return _0x4e77e9(_0x385b4d[_0xd629('0x10')][_0xd629('0x12')]);}else{logger[_0xd629('0xa')](_0xd629('0xb'),_0x40a47e,_0xd629('0xc'));_0x4e77e9(_0x385b4d['result'][_0xd629('0x12')]);}})[_0xd629('0x13')](function(_0x2c00ab){logger[_0xd629('0x10')]('VoiceMail,\x20%s,\x20%s',_0x40a47e,_0x2c00ab);_0x2fecdc(_0x2c00ab);});});} \ No newline at end of file +var _0xd4f8=['jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xd4f8,0x12c));var _0x8d4f=function(_0x5930c6,_0x5dd4d5){_0x5930c6=_0x5930c6-0x0;var _0x43304a=_0xd4f8[_0x5930c6];return _0x43304a;};'use strict';var _=require(_0x8d4f('0x0'));var util=require('util');var moment=require(_0x8d4f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d4f('0x2'));var db=require(_0x8d4f('0x3'))['db'];var utils=require(_0x8d4f('0x4'));var logger=require(_0x8d4f('0x5'))(_0x8d4f('0x6'));var config=require(_0x8d4f('0x7'));var jayson=require(_0x8d4f('0x8'));var client=jayson[_0x8d4f('0x9')][_0x8d4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x574128,_0x487f35,_0x1f296c){return new BPromise(function(_0xcaf4ee,_0x3693b3){return client['request'](_0x574128,_0x1f296c)[_0x8d4f('0xb')](function(_0x4ea0b8){logger[_0x8d4f('0xc')](_0x8d4f('0xd'),_0x487f35,_0x8d4f('0xe'));logger[_0x8d4f('0xf')](_0x8d4f('0x10'),_0x487f35,'request\x20sent',JSON[_0x8d4f('0x11')](_0x4ea0b8));if(_0x4ea0b8[_0x8d4f('0x12')]){if(_0x4ea0b8[_0x8d4f('0x12')][_0x8d4f('0x13')]===0x1f4){logger[_0x8d4f('0x12')](_0x8d4f('0xd'),_0x487f35,_0x4ea0b8[_0x8d4f('0x12')][_0x8d4f('0x14')]);return _0x3693b3(_0x4ea0b8[_0x8d4f('0x12')][_0x8d4f('0x14')]);}logger[_0x8d4f('0x12')](_0x8d4f('0xd'),_0x487f35,_0x4ea0b8[_0x8d4f('0x12')]['message']);return _0xcaf4ee(_0x4ea0b8[_0x8d4f('0x12')][_0x8d4f('0x14')]);}else{logger[_0x8d4f('0xc')](_0x8d4f('0xd'),_0x487f35,'request\x20sent');_0xcaf4ee(_0x4ea0b8['result'][_0x8d4f('0x14')]);}})[_0x8d4f('0x15')](function(_0x557a1f){logger[_0x8d4f('0x12')]('VoiceMail,\x20%s,\x20%s',_0x487f35,_0x557a1f);_0x3693b3(_0x557a1f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 72639cc..67b43e1 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 _0xda83=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','download','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa8f813,_0x320ecc){var _0xbf6ba6=function(_0x52e5e7){while(--_0x52e5e7){_0xa8f813['push'](_0xa8f813['shift']());}};_0xbf6ba6(++_0x320ecc);}(_0xda83,0x16c));var _0x3da8=function(_0x34528e,_0x48bfbb){_0x34528e=_0x34528e-0x0;var _0x5bbcac=_0xda83[_0x34528e];return _0x5bbcac;};'use strict';var multer=require(_0x3da8('0x0'));var util=require(_0x3da8('0x1'));var path=require(_0x3da8('0x2'));var timeout=require(_0x3da8('0x3'));var express=require(_0x3da8('0x4'));var router=express[_0x3da8('0x5')]();var fs_extra=require(_0x3da8('0x6'));var auth=require(_0x3da8('0x7'));var interaction=require(_0x3da8('0x8'));var config=require(_0x3da8('0x9'));var controller=require(_0x3da8('0xa'));router[_0x3da8('0xb')]('/',auth[_0x3da8('0xc')](),controller[_0x3da8('0xd')]);router[_0x3da8('0xb')]('/:id',auth[_0x3da8('0xc')](),controller['show']);router[_0x3da8('0xb')](_0x3da8('0xe'),auth['isAuthenticated'](),controller[_0x3da8('0xf')]);router[_0x3da8('0x10')]('/',auth[_0x3da8('0xc')](),controller['create']);router[_0x3da8('0x11')](_0x3da8('0x12'),auth[_0x3da8('0xc')](),controller[_0x3da8('0x13')]);router[_0x3da8('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3da8('0x15')]=router; \ No newline at end of file +var _0x46d5=['./voiceMailMessage.controller','get','isAuthenticated','/:id','show','download','post','create','put','update','delete','destroy','exports','path','express','../../components/auth/service','../../config/environment'];(function(_0x67f30a,_0x2e62de){var _0x59b41e=function(_0x1716a5){while(--_0x1716a5){_0x67f30a['push'](_0x67f30a['shift']());}};_0x59b41e(++_0x2e62de);}(_0x46d5,0xb7));var _0x546d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x46d5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x546d('0x0'));var timeout=require('connect-timeout');var express=require(_0x546d('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x546d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x546d('0x3'));var controller=require(_0x546d('0x4'));router[_0x546d('0x5')]('/',auth[_0x546d('0x6')](),controller['index']);router['get'](_0x546d('0x7'),auth[_0x546d('0x6')](),controller[_0x546d('0x8')]);router[_0x546d('0x5')]('/:id/download',auth[_0x546d('0x6')](),controller[_0x546d('0x9')]);router[_0x546d('0xa')]('/',auth[_0x546d('0x6')](),controller[_0x546d('0xb')]);router[_0x546d('0xc')]('/:id',auth[_0x546d('0x6')](),controller[_0x546d('0xd')]);router[_0x546d('0xe')](_0x546d('0x7'),auth[_0x546d('0x6')](),controller[_0x546d('0xf')]);module[_0x546d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9c67968..d3046f6 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 _0xb44c=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xb44c,0x154));var _0xcb44=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0xb44c[_0x58ac34];return _0x3921ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcb44('0x0')],'get':function(_0x79461d){return this[_0xcb44('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xcb44('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xcb44('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xcb44('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xcb44('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xcb44('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xcb44('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xcb44('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xcb44('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xcb44('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xcb44('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xcb44('0x5'),'defaultValue':Sequelize[_0xcb44('0x6')](_0xcb44('0x7'))}}; \ No newline at end of file +var _0xbe10=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP'];(function(_0x18c6e6,_0x137fa9){var _0x24519c=function(_0x4a7ab6){while(--_0x4a7ab6){_0x18c6e6['push'](_0x18c6e6['shift']());}};_0x24519c(++_0x137fa9);}(_0xbe10,0x1d8));var _0x0be1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbe10[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x0be1('0x0'));module[_0x0be1('0x1')]={'name':{'type':Sequelize[_0x0be1('0x2')],'get':function(_0x43ebb1){return this[_0x0be1('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0be1('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x0be1('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0be1('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x0be1('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x0be1('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0be1('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0be1('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x0be1('0x5')](_0x0be1('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x0be1('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x0be1('0x7'),'defaultValue':Sequelize[_0x0be1('0x8')](_0x0be1('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index dea60c4..eb64246 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 _0x4249=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','key','differenceBy','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','VoiceMailMessage','includeAll','include','findAll','catch','show','params','merge','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4249,0x140));var _0x9424=function(_0x1c7a78,_0x32c63f){_0x1c7a78=_0x1c7a78-0x0;var _0x2ba8b1=_0x4249[_0x1c7a78];return _0x2ba8b1;};'use strict';var emlformat=require(_0x9424('0x0'));var rimraf=require(_0x9424('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9424('0x2'));var rp=require(_0x9424('0x3'));var moment=require(_0x9424('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9424('0x5'));var util=require(_0x9424('0x6'));var path=require(_0x9424('0x7'));var sox=require(_0x9424('0x8'));var csv=require(_0x9424('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9424('0xa'));var _=require(_0x9424('0xb'));var squel=require(_0x9424('0xc'));var crypto=require(_0x9424('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9424('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9424('0xf'));var authService=require(_0x9424('0x10'));var qs=require(_0x9424('0x11'));var as=require(_0x9424('0x12'));var hardwareService=require(_0x9424('0x13'));var logger=require(_0x9424('0x14'))(_0x9424('0x15'));var utils=require(_0x9424('0x16'));var config=require(_0x9424('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c468a,_0x45a310){_0x45a310=_0x45a310||0xcc;return function(_0x1dfb68){if(_0x1dfb68){return _0x2c468a['sendStatus'](_0x45a310);}return _0x2c468a[_0x9424('0x18')](_0x45a310)[_0x9424('0x19')]();};}function respondWithResult(_0x3de887,_0x100fba){_0x100fba=_0x100fba||0xc8;return function(_0x58acfd){if(_0x58acfd){return _0x3de887[_0x9424('0x18')](_0x100fba)[_0x9424('0x1a')](_0x58acfd);}};}function respondWithFilteredResult(_0x341399,_0x548654){return function(_0x3f9d48){if(_0x3f9d48){var _0x14ac4d=typeof _0x548654[_0x9424('0x1b')]===_0x9424('0x1c')&&typeof _0x548654[_0x9424('0x1d')]===_0x9424('0x1c');var _0x593ad9=_0x3f9d48[_0x9424('0x1e')];var _0x2d4bf9=_0x14ac4d?0x0:_0x548654[_0x9424('0x1b')];var _0x5d2a27=_0x14ac4d?_0x3f9d48[_0x9424('0x1e')]:_0x548654[_0x9424('0x1b')]+_0x548654[_0x9424('0x1d')];var _0xf01961;if(_0x5d2a27>=_0x593ad9){_0x5d2a27=_0x593ad9;_0xf01961=0xc8;}else{_0xf01961=0xce;}_0x341399[_0x9424('0x18')](_0xf01961);return _0x341399[_0x9424('0x1f')](_0x9424('0x20'),_0x2d4bf9+'-'+_0x5d2a27+'/'+_0x593ad9)[_0x9424('0x1a')](_0x3f9d48);}return null;};}function patchUpdates(_0x3344c5){return function(_0x26ac85){try{jsonpatch['apply'](_0x26ac85,_0x3344c5,!![]);}catch(_0x380d91){return BPromise[_0x9424('0x21')](_0x380d91);}return _0x26ac85[_0x9424('0x22')]();};}function saveUpdates(_0x31e6e3,_0x29ade7){return function(_0x58acc8){if(_0x58acc8){return _0x58acc8[_0x9424('0x23')](_0x31e6e3)['then'](function(_0x4a5734){return _0x4a5734;});}return null;};}function removeEntity(_0x24306d,_0x9635f6){return function(_0x4efe8){if(_0x4efe8){return _0x4efe8[_0x9424('0x24')]()[_0x9424('0x25')](function(){_0x24306d[_0x9424('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46cce3,_0x126a0b){return function(_0x33ad7a){if(!_0x33ad7a){_0x46cce3['sendStatus'](0x194);}return _0x33ad7a;};}function handleError(_0x4f1782,_0x5a1dc4){_0x5a1dc4=_0x5a1dc4||0x1f4;return function(_0x461cd7){logger['error'](_0x461cd7[_0x9424('0x26')]);if(_0x461cd7[_0x9424('0x27')]){delete _0x461cd7[_0x9424('0x27')];}_0x4f1782[_0x9424('0x18')](_0x5a1dc4)[_0x9424('0x28')](_0x461cd7);};}exports[_0x9424('0x29')]=function(_0x2e0055,_0x2b0d44){var _0x47bdf9={},_0x54f42b={},_0x21eb14={'count':0x0,'rows':[]};var _0x5d6538=_['map'](db['VoiceMailMessage'][_0x9424('0x2a')],function(_0x187956){return{'name':_0x187956[_0x9424('0x2b')],'type':_0x187956['type'][_0x9424('0x2c')]};});_0x54f42b['model']=_[_0x9424('0x2d')](_['map'](_0x5d6538,_0x9424('0x27')),[_0x9424('0x27')]);_0x54f42b['query']=_[_0x9424('0x2e')](_0x2e0055[_0x9424('0x2f')]);_0x54f42b[_0x9424('0x30')]=_[_0x9424('0x31')](_0x54f42b[_0x9424('0x32')],_0x54f42b['query']);_0x47bdf9[_0x9424('0x33')]=_[_0x9424('0x31')](_0x54f42b[_0x9424('0x32')],qs['fields'](_0x2e0055['query'][_0x9424('0x34')]));_0x47bdf9[_0x9424('0x33')]=_0x47bdf9[_0x9424('0x33')][_0x9424('0x35')]?_0x47bdf9[_0x9424('0x33')]:_0x54f42b[_0x9424('0x32')];if(!_0x2e0055[_0x9424('0x2f')][_0x9424('0x36')](_0x9424('0x37'))){_0x47bdf9[_0x9424('0x1d')]=qs[_0x9424('0x1d')](_0x2e0055[_0x9424('0x2f')][_0x9424('0x1d')]);_0x47bdf9['offset']=qs[_0x9424('0x1b')](_0x2e0055['query']['offset']);}_0x47bdf9[_0x9424('0x38')]=qs[_0x9424('0x39')](_0x2e0055[_0x9424('0x2f')]['sort']);_0x47bdf9[_0x9424('0x3a')]=qs[_0x9424('0x30')](_[_0x9424('0x3b')](_0x2e0055[_0x9424('0x2f')],_0x54f42b[_0x9424('0x30')]),_0x5d6538);if(_0x2e0055[_0x9424('0x2f')]['filter']){_0x47bdf9[_0x9424('0x3a')]=_['merge'](_0x47bdf9[_0x9424('0x3a')],{'$or':_['map'](_0x5d6538,function(_0x5c6041){if(_0x5c6041['type']!==_0x9424('0x3c')){var _0xa330b0={};_0xa330b0[_0x5c6041['name']]={'$like':'%'+_0x2e0055[_0x9424('0x2f')][_0x9424('0x3d')]+'%'};return _0xa330b0;}})});}_0x47bdf9=_['merge']({},_0x47bdf9,_0x2e0055[_0x9424('0x3e')]);var _0x1fcb78={'where':_0x47bdf9['where']};return db[_0x9424('0x3f')]['count'](_0x1fcb78)[_0x9424('0x25')](function(_0x3455c8){_0x21eb14[_0x9424('0x1e')]=_0x3455c8;if(_0x2e0055[_0x9424('0x2f')][_0x9424('0x40')]){_0x47bdf9[_0x9424('0x41')]=[{'all':!![]}];}return db[_0x9424('0x3f')][_0x9424('0x42')](_0x47bdf9);})['then'](function(_0x3a8917){_0x21eb14['rows']=_0x3a8917;return _0x21eb14;})[_0x9424('0x25')](respondWithFilteredResult(_0x2b0d44,_0x47bdf9))[_0x9424('0x43')](handleError(_0x2b0d44,null));};exports[_0x9424('0x44')]=function(_0x4e371d,_0x1b58d1){var _0x5660fb={'raw':!![],'where':{'id':_0x4e371d[_0x9424('0x45')]['id']}},_0x2e5744={};_0x2e5744[_0x9424('0x32')]=_[_0x9424('0x2e')](db[_0x9424('0x3f')][_0x9424('0x2a')]);_0x2e5744['query']=_[_0x9424('0x2e')](_0x4e371d[_0x9424('0x2f')]);_0x2e5744[_0x9424('0x30')]=_[_0x9424('0x31')](_0x2e5744['model'],_0x2e5744[_0x9424('0x2f')]);_0x5660fb[_0x9424('0x33')]=_[_0x9424('0x31')](_0x2e5744[_0x9424('0x32')],qs['fields'](_0x4e371d[_0x9424('0x2f')][_0x9424('0x34')]));_0x5660fb['attributes']=_0x5660fb[_0x9424('0x33')][_0x9424('0x35')]?_0x5660fb[_0x9424('0x33')]:_0x2e5744[_0x9424('0x32')];if(_0x4e371d[_0x9424('0x2f')][_0x9424('0x40')]){_0x5660fb['include']=[{'all':!![]}];}_0x5660fb=_[_0x9424('0x46')]({},_0x5660fb,_0x4e371d['options']);return db[_0x9424('0x3f')][_0x9424('0x47')](_0x5660fb)[_0x9424('0x25')](handleEntityNotFound(_0x1b58d1,null))[_0x9424('0x25')](respondWithResult(_0x1b58d1,null))['catch'](handleError(_0x1b58d1,null));};exports[_0x9424('0x48')]=function(_0x5d6392,_0xbb7643){return db[_0x9424('0x3f')][_0x9424('0x48')](_0x5d6392[_0x9424('0x49')],{})[_0x9424('0x25')](respondWithResult(_0xbb7643,0xc9))['catch'](handleError(_0xbb7643,null));};exports[_0x9424('0x23')]=function(_0x3acb9a,_0x16f1a4){if(_0x3acb9a[_0x9424('0x49')]['id']){delete _0x3acb9a[_0x9424('0x49')]['id'];}return db['VoiceMailMessage'][_0x9424('0x47')]({'where':{'id':_0x3acb9a[_0x9424('0x45')]['id']}})['then'](handleEntityNotFound(_0x16f1a4,null))[_0x9424('0x25')](saveUpdates(_0x3acb9a[_0x9424('0x49')],null))[_0x9424('0x25')](respondWithResult(_0x16f1a4,null))[_0x9424('0x43')](handleError(_0x16f1a4,null));};exports['destroy']=function(_0x44d6a6,_0x1dea8c){return db[_0x9424('0x3f')][_0x9424('0x47')]({'where':{'id':_0x44d6a6['params']['id']}})[_0x9424('0x25')](handleEntityNotFound(_0x1dea8c,null))[_0x9424('0x25')](removeEntity(_0x1dea8c,null))[_0x9424('0x43')](handleError(_0x1dea8c,null));};exports[_0x9424('0x4a')]=function(_0x263071,_0x275e8e,_0x573d8f){return db[_0x9424('0x3f')][_0x9424('0x47')]({'where':{'id':_0x263071['params']['id']},'attributes':['id','recording','msg_id']})[_0x9424('0x25')](handleEntityNotFound(_0x275e8e,null))[_0x9424('0x25')](function(_0x3dc597){if(_0x3dc597){if(!_0x3dc597[_0x9424('0x4b')]){throw new db[(_0x9424('0x4c'))][(_0x9424('0x4d'))](_0x9424('0x4e'));}var _0xfe03b8={'Content-Type':'audio/wav','Content-Disposition':_0x9424('0x4f')};if(_0x3dc597[_0x9424('0x50')]){_0xfe03b8[_0x9424('0x51')]=_0x9424('0x52')+_0x3dc597[_0x9424('0x50')]+_0x9424('0x53');}_0x275e8e[_0x9424('0x1f')](_0xfe03b8);return _0x275e8e[_0x9424('0x28')](new Buffer(_0x3dc597[_0x9424('0x4b')]));}})[_0x9424('0x43')](handleError(_0x275e8e,null));}; \ No newline at end of file +var _0xbd17=['json','undefined','count','offset','limit','set','Content-Range','apply','save','update','sendStatus','error','stack','name','index','map','VoiceMailMessage','fieldName','type','differenceBy','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','rows','catch','show','rawAttributes','create','body','find','params','destroy','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xbd17,0x187));var _0x7bd1=function(_0x2df8f0,_0x566393){_0x2df8f0=_0x2df8f0-0x0;var _0x318ec5=_0xbd17[_0x2df8f0];return _0x318ec5;};'use strict';var emlformat=require(_0x7bd1('0x0'));var rimraf=require(_0x7bd1('0x1'));var zipdir=require(_0x7bd1('0x2'));var jsonpatch=require(_0x7bd1('0x3'));var rp=require('request-promise');var moment=require(_0x7bd1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7bd1('0x5'));var path=require(_0x7bd1('0x6'));var sox=require(_0x7bd1('0x7'));var csv=require(_0x7bd1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bd1('0x9'));var squel=require('squel');var crypto=require(_0x7bd1('0xa'));var jsforce=require(_0x7bd1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7bd1('0x8'));var querystring=require('querystring');var Papa=require(_0x7bd1('0xc'));var Redis=require(_0x7bd1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7bd1('0xe'));var as=require(_0x7bd1('0xf'));var hardwareService=require(_0x7bd1('0x10'));var logger=require('../../config/logger')(_0x7bd1('0x11'));var utils=require(_0x7bd1('0x12'));var config=require(_0x7bd1('0x13'));var licenseUtil=require(_0x7bd1('0x14'));var db=require(_0x7bd1('0x15'))['db'];function respondWithStatusCode(_0x5c0ddd,_0x561398){_0x561398=_0x561398||0xcc;return function(_0x59170f){if(_0x59170f){return _0x5c0ddd['sendStatus'](_0x561398);}return _0x5c0ddd['status'](_0x561398)[_0x7bd1('0x16')]();};}function respondWithResult(_0x68279e,_0x63597c){_0x63597c=_0x63597c||0xc8;return function(_0x4a93f7){if(_0x4a93f7){return _0x68279e[_0x7bd1('0x17')](_0x63597c)[_0x7bd1('0x18')](_0x4a93f7);}};}function respondWithFilteredResult(_0x2ac0f0,_0x55d807){return function(_0x5bf9cb){if(_0x5bf9cb){var _0x3256ac=typeof _0x55d807['offset']===_0x7bd1('0x19')&&typeof _0x55d807['limit']==='undefined';var _0xc09390=_0x5bf9cb[_0x7bd1('0x1a')];var _0x3e5392=_0x3256ac?0x0:_0x55d807[_0x7bd1('0x1b')];var _0x4f3e04=_0x3256ac?_0x5bf9cb[_0x7bd1('0x1a')]:_0x55d807[_0x7bd1('0x1b')]+_0x55d807[_0x7bd1('0x1c')];var _0x381e5a;if(_0x4f3e04>=_0xc09390){_0x4f3e04=_0xc09390;_0x381e5a=0xc8;}else{_0x381e5a=0xce;}_0x2ac0f0[_0x7bd1('0x17')](_0x381e5a);return _0x2ac0f0[_0x7bd1('0x1d')](_0x7bd1('0x1e'),_0x3e5392+'-'+_0x4f3e04+'/'+_0xc09390)[_0x7bd1('0x18')](_0x5bf9cb);}return null;};}function patchUpdates(_0x5a8c8a){return function(_0x57f27a){try{jsonpatch[_0x7bd1('0x1f')](_0x57f27a,_0x5a8c8a,!![]);}catch(_0x385d33){return BPromise['reject'](_0x385d33);}return _0x57f27a[_0x7bd1('0x20')]();};}function saveUpdates(_0x7233b1,_0x50653c){return function(_0x2180b3){if(_0x2180b3){return _0x2180b3[_0x7bd1('0x21')](_0x7233b1)['then'](function(_0x348cd4){return _0x348cd4;});}return null;};}function removeEntity(_0x39c7d2,_0x5afc91){return function(_0x77988c){if(_0x77988c){return _0x77988c['destroy']()['then'](function(){_0x39c7d2[_0x7bd1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dad1d,_0x7e8ef5){return function(_0x777d85){if(!_0x777d85){_0x5dad1d[_0x7bd1('0x22')](0x194);}return _0x777d85;};}function handleError(_0x368848,_0x418615){_0x418615=_0x418615||0x1f4;return function(_0x466eec){logger[_0x7bd1('0x23')](_0x466eec[_0x7bd1('0x24')]);if(_0x466eec[_0x7bd1('0x25')]){delete _0x466eec[_0x7bd1('0x25')];}_0x368848[_0x7bd1('0x17')](_0x418615)['send'](_0x466eec);};}exports[_0x7bd1('0x26')]=function(_0x2d809a,_0x14897b){var _0x3c63e9={},_0x3fee13={},_0x36d414={'count':0x0,'rows':[]};var _0x4a6680=_[_0x7bd1('0x27')](db[_0x7bd1('0x28')]['rawAttributes'],function(_0x221ed6){return{'name':_0x221ed6[_0x7bd1('0x29')],'type':_0x221ed6[_0x7bd1('0x2a')]['key']};});_0x3fee13['model']=_[_0x7bd1('0x2b')](_['map'](_0x4a6680,_0x7bd1('0x25')),[_0x7bd1('0x25')]);_0x3fee13['query']=_[_0x7bd1('0x2c')](_0x2d809a[_0x7bd1('0x2d')]);_0x3fee13[_0x7bd1('0x2e')]=_[_0x7bd1('0x2f')](_0x3fee13[_0x7bd1('0x30')],_0x3fee13[_0x7bd1('0x2d')]);_0x3c63e9['attributes']=_[_0x7bd1('0x2f')](_0x3fee13[_0x7bd1('0x30')],qs[_0x7bd1('0x31')](_0x2d809a[_0x7bd1('0x2d')][_0x7bd1('0x31')]));_0x3c63e9['attributes']=_0x3c63e9['attributes'][_0x7bd1('0x32')]?_0x3c63e9[_0x7bd1('0x33')]:_0x3fee13[_0x7bd1('0x30')];if(!_0x2d809a['query'][_0x7bd1('0x34')]('nolimit')){_0x3c63e9[_0x7bd1('0x1c')]=qs[_0x7bd1('0x1c')](_0x2d809a[_0x7bd1('0x2d')]['limit']);_0x3c63e9[_0x7bd1('0x1b')]=qs[_0x7bd1('0x1b')](_0x2d809a[_0x7bd1('0x2d')][_0x7bd1('0x1b')]);}_0x3c63e9[_0x7bd1('0x35')]=qs['sort'](_0x2d809a[_0x7bd1('0x2d')][_0x7bd1('0x36')]);_0x3c63e9[_0x7bd1('0x37')]=qs['filters'](_[_0x7bd1('0x38')](_0x2d809a[_0x7bd1('0x2d')],_0x3fee13['filters']),_0x4a6680);if(_0x2d809a[_0x7bd1('0x2d')][_0x7bd1('0x39')]){_0x3c63e9['where']=_['merge'](_0x3c63e9[_0x7bd1('0x37')],{'$or':_['map'](_0x4a6680,function(_0x4dc54d){if(_0x4dc54d[_0x7bd1('0x2a')]!==_0x7bd1('0x3a')){var _0x2ce72e={};_0x2ce72e[_0x4dc54d[_0x7bd1('0x25')]]={'$like':'%'+_0x2d809a[_0x7bd1('0x2d')]['filter']+'%'};return _0x2ce72e;}})});}_0x3c63e9=_[_0x7bd1('0x3b')]({},_0x3c63e9,_0x2d809a[_0x7bd1('0x3c')]);var _0x2cdec8={'where':_0x3c63e9[_0x7bd1('0x37')]};return db[_0x7bd1('0x28')][_0x7bd1('0x1a')](_0x2cdec8)[_0x7bd1('0x3d')](function(_0x209fd4){_0x36d414[_0x7bd1('0x1a')]=_0x209fd4;if(_0x2d809a[_0x7bd1('0x2d')][_0x7bd1('0x3e')]){_0x3c63e9[_0x7bd1('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x3c63e9);})[_0x7bd1('0x3d')](function(_0x236cd3){_0x36d414[_0x7bd1('0x40')]=_0x236cd3;return _0x36d414;})[_0x7bd1('0x3d')](respondWithFilteredResult(_0x14897b,_0x3c63e9))[_0x7bd1('0x41')](handleError(_0x14897b,null));};exports[_0x7bd1('0x42')]=function(_0x65526b,_0x45b839){var _0x3dfb81={'raw':!![],'where':{'id':_0x65526b['params']['id']}},_0x57f3d0={};_0x57f3d0[_0x7bd1('0x30')]=_['keys'](db[_0x7bd1('0x28')][_0x7bd1('0x43')]);_0x57f3d0[_0x7bd1('0x2d')]=_[_0x7bd1('0x2c')](_0x65526b['query']);_0x57f3d0[_0x7bd1('0x2e')]=_['intersection'](_0x57f3d0[_0x7bd1('0x30')],_0x57f3d0['query']);_0x3dfb81[_0x7bd1('0x33')]=_[_0x7bd1('0x2f')](_0x57f3d0[_0x7bd1('0x30')],qs[_0x7bd1('0x31')](_0x65526b['query']['fields']));_0x3dfb81[_0x7bd1('0x33')]=_0x3dfb81['attributes'][_0x7bd1('0x32')]?_0x3dfb81[_0x7bd1('0x33')]:_0x57f3d0[_0x7bd1('0x30')];if(_0x65526b[_0x7bd1('0x2d')][_0x7bd1('0x3e')]){_0x3dfb81[_0x7bd1('0x3f')]=[{'all':!![]}];}_0x3dfb81=_[_0x7bd1('0x3b')]({},_0x3dfb81,_0x65526b['options']);return db[_0x7bd1('0x28')]['find'](_0x3dfb81)[_0x7bd1('0x3d')](handleEntityNotFound(_0x45b839,null))[_0x7bd1('0x3d')](respondWithResult(_0x45b839,null))[_0x7bd1('0x41')](handleError(_0x45b839,null));};exports[_0x7bd1('0x44')]=function(_0x4811a,_0x51a966){return db[_0x7bd1('0x28')]['create'](_0x4811a[_0x7bd1('0x45')],{})['then'](respondWithResult(_0x51a966,0xc9))[_0x7bd1('0x41')](handleError(_0x51a966,null));};exports[_0x7bd1('0x21')]=function(_0x33a463,_0x1a5414){if(_0x33a463[_0x7bd1('0x45')]['id']){delete _0x33a463[_0x7bd1('0x45')]['id'];}return db[_0x7bd1('0x28')][_0x7bd1('0x46')]({'where':{'id':_0x33a463[_0x7bd1('0x47')]['id']}})[_0x7bd1('0x3d')](handleEntityNotFound(_0x1a5414,null))['then'](saveUpdates(_0x33a463['body'],null))[_0x7bd1('0x3d')](respondWithResult(_0x1a5414,null))[_0x7bd1('0x41')](handleError(_0x1a5414,null));};exports[_0x7bd1('0x48')]=function(_0x25f3fc,_0x16bf7c){return db[_0x7bd1('0x28')][_0x7bd1('0x46')]({'where':{'id':_0x25f3fc[_0x7bd1('0x47')]['id']}})[_0x7bd1('0x3d')](handleEntityNotFound(_0x16bf7c,null))[_0x7bd1('0x3d')](removeEntity(_0x16bf7c,null))[_0x7bd1('0x41')](handleError(_0x16bf7c,null));};exports[_0x7bd1('0x49')]=function(_0x2a9e49,_0x3bb8fd,_0x25ca9c){return db[_0x7bd1('0x28')][_0x7bd1('0x46')]({'where':{'id':_0x2a9e49[_0x7bd1('0x47')]['id']},'attributes':['id',_0x7bd1('0x4a'),_0x7bd1('0x4b')]})[_0x7bd1('0x3d')](handleEntityNotFound(_0x3bb8fd,null))['then'](function(_0xddebfd){if(_0xddebfd){if(!_0xddebfd[_0x7bd1('0x4a')]){throw new db[(_0x7bd1('0x4c'))]['ValidationError'](_0x7bd1('0x4d'));}var _0x2f6b3f={'Content-Type':_0x7bd1('0x4e'),'Content-Disposition':'attachment'};if(_0xddebfd['msg_id']){_0x2f6b3f[_0x7bd1('0x4f')]=_0x7bd1('0x50')+_0xddebfd['msg_id']+_0x7bd1('0x51');}_0x3bb8fd['set'](_0x2f6b3f);return _0x3bb8fd[_0x7bd1('0x52')](new Buffer(_0xddebfd[_0x7bd1('0x4a')]));}})[_0x7bd1('0x41')](handleError(_0x3bb8fd,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1541303..7db48e7 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 _0xf1ce=['VoiceMailMessage','voice_voicemail_messages','lodash','util','../../config/logger','api','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x46491e,_0x770203){var _0x15bf54=function(_0x3894d9){while(--_0x3894d9){_0x46491e['push'](_0x46491e['shift']());}};_0x15bf54(++_0x770203);}(_0xf1ce,0x86));var _0xef1c=function(_0x1302f2,_0x5c6700){_0x1302f2=_0x1302f2-0x0;var _0x15016a=_0xf1ce[_0x1302f2];return _0x15016a;};'use strict';var _=require(_0xef1c('0x0'));var util=require(_0xef1c('0x1'));var logger=require(_0xef1c('0x2'))(_0xef1c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xef1c('0x4'));var config=require(_0xef1c('0x5'));var attributes=require(_0xef1c('0x6'));module[_0xef1c('0x7')]=function(_0x1bfbf8,_0x6b5e35){return _0x1bfbf8[_0xef1c('0x8')](_0xef1c('0x9'),attributes,{'tableName':_0xef1c('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x442e=['dir','lodash','../../config/logger','api','moment','bluebird','path','./voiceMailMessage.attributes','define','VoiceMailMessage'];(function(_0x1cc92b,_0x306fbf){var _0x5871cc=function(_0x90f579){while(--_0x90f579){_0x1cc92b['push'](_0x1cc92b['shift']());}};_0x5871cc(++_0x306fbf);}(_0x442e,0x65));var _0xe442=function(_0x5c2438,_0x27b5c2){_0x5c2438=_0x5c2438-0x0;var _0xccc3cd=_0x442e[_0x5c2438];return _0xccc3cd;};'use strict';var _=require(_0xe442('0x0'));var util=require('util');var logger=require(_0xe442('0x1'))(_0xe442('0x2'));var moment=require(_0xe442('0x3'));var BPromise=require(_0xe442('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe442('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe442('0x6'));module['exports']=function(_0x1e79f7,_0x4f8857){return _0x1e79f7[_0xe442('0x7')](_0xe442('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xe442('0x9'),'fields':[_0xe442('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 739342c..693df82 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 _0x1dd9=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0x4729ae,_0x35a7c4){var _0x464880=function(_0x2e6d08){while(--_0x2e6d08){_0x4729ae['push'](_0x4729ae['shift']());}};_0x464880(++_0x35a7c4);}(_0x1dd9,0x1df));var _0x91dd=function(_0x3034bf,_0x2d5a3c){_0x3034bf=_0x3034bf-0x0;var _0x4c2d01=_0x1dd9[_0x3034bf];return _0x4c2d01;};'use strict';var _=require(_0x91dd('0x0'));var util=require(_0x91dd('0x1'));var moment=require(_0x91dd('0x2'));var BPromise=require(_0x91dd('0x3'));var rs=require(_0x91dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91dd('0x5'))['db'];var utils=require(_0x91dd('0x6'));var logger=require(_0x91dd('0x7'))(_0x91dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x91dd('0x9'));var client=jayson[_0x91dd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59391b,_0xf5237,_0x2878cf){return new BPromise(function(_0x4b9c55,_0x1e073b){return client[_0x91dd('0xb')](_0x59391b,_0x2878cf)[_0x91dd('0xc')](function(_0x19b1c5){logger[_0x91dd('0xd')](_0x91dd('0xe'),_0xf5237,_0x91dd('0xf'));logger[_0x91dd('0x10')](_0x91dd('0x11'),_0xf5237,_0x91dd('0xf'),JSON[_0x91dd('0x12')](_0x19b1c5));if(_0x19b1c5[_0x91dd('0x13')]){if(_0x19b1c5[_0x91dd('0x13')][_0x91dd('0x14')]===0x1f4){logger[_0x91dd('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0xf5237,_0x19b1c5['error'][_0x91dd('0x15')]);return _0x1e073b(_0x19b1c5[_0x91dd('0x13')][_0x91dd('0x15')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0xf5237,_0x19b1c5[_0x91dd('0x13')][_0x91dd('0x15')]);return _0x4b9c55(_0x19b1c5[_0x91dd('0x13')][_0x91dd('0x15')]);}else{logger[_0x91dd('0xd')](_0x91dd('0xe'),_0xf5237,_0x91dd('0xf'));_0x4b9c55(_0x19b1c5['result'][_0x91dd('0x15')]);}})['catch'](function(_0x2ee363){logger[_0x91dd('0x13')](_0x91dd('0xe'),_0xf5237,_0x2ee363);_0x1e073b(_0x2ee363);});});} \ No newline at end of file +var _0x36ac=['info','request\x20sent','debug','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x3ce6d2,_0x90364d){var _0x4c1dd4=function(_0x3b2e50){while(--_0x3b2e50){_0x3ce6d2['push'](_0x3ce6d2['shift']());}};_0x4c1dd4(++_0x90364d);}(_0x36ac,0xdc));var _0xc36a=function(_0x5d91b5,_0x585067){_0x5d91b5=_0x5d91b5-0x0;var _0x4d784b=_0x36ac[_0x5d91b5];return _0x4d784b;};'use strict';var _=require('lodash');var util=require(_0xc36a('0x0'));var moment=require(_0xc36a('0x1'));var BPromise=require(_0xc36a('0x2'));var rs=require(_0xc36a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc36a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc36a('0x5'))(_0xc36a('0x6'));var config=require('../../config/environment');var jayson=require(_0xc36a('0x7'));var client=jayson['client'][_0xc36a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x422488,_0x5af0bc,_0x212a5f){return new BPromise(function(_0x1456e5,_0x5cc560){return client[_0xc36a('0x9')](_0x422488,_0x212a5f)[_0xc36a('0xa')](function(_0x13070a){logger[_0xc36a('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x5af0bc,_0xc36a('0xc'));logger[_0xc36a('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5af0bc,_0xc36a('0xc'),JSON[_0xc36a('0xe')](_0x13070a));if(_0x13070a[_0xc36a('0xf')]){if(_0x13070a['error'][_0xc36a('0x10')]===0x1f4){logger[_0xc36a('0xf')](_0xc36a('0x11'),_0x5af0bc,_0x13070a[_0xc36a('0xf')]['message']);return _0x5cc560(_0x13070a[_0xc36a('0xf')][_0xc36a('0x12')]);}logger[_0xc36a('0xf')](_0xc36a('0x11'),_0x5af0bc,_0x13070a[_0xc36a('0xf')][_0xc36a('0x12')]);return _0x1456e5(_0x13070a[_0xc36a('0xf')]['message']);}else{logger[_0xc36a('0xb')](_0xc36a('0x11'),_0x5af0bc,'request\x20sent');_0x1456e5(_0x13070a[_0xc36a('0x13')][_0xc36a('0x12')]);}})[_0xc36a('0x14')](function(_0x4216a1){logger[_0xc36a('0xf')](_0xc36a('0x11'),_0x5af0bc,_0x4216a1);_0x5cc560(_0x4216a1);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8cc3db2..a67f3fe 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 _0x8872=['isAuthenticated','get','/:id','getSounds','post','create','/:id/sounds','addSound','put','delete','removeSound','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8872,0x1d3));var _0x2887=function(_0x3d7b67,_0x478a8d){_0x3d7b67=_0x3d7b67-0x0;var _0x5628ac=_0x8872[_0x3d7b67];return _0x5628ac;};'use strict';var multer=require(_0x2887('0x0'));var util=require('util');var path=require(_0x2887('0x1'));var timeout=require(_0x2887('0x2'));var express=require(_0x2887('0x3'));var router=express[_0x2887('0x4')]();var fs_extra=require(_0x2887('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2887('0x6'));var config=require('../../config/environment');var controller=require(_0x2887('0x7'));router['get']('/',auth[_0x2887('0x8')](),controller['index']);router[_0x2887('0x9')](_0x2887('0xa'),auth[_0x2887('0x8')](),controller['show']);router[_0x2887('0x9')]('/:id/sounds',auth[_0x2887('0x8')](),controller[_0x2887('0xb')]);router[_0x2887('0xc')]('/',auth['isAuthenticated'](),controller[_0x2887('0xd')]);router['post'](_0x2887('0xe'),auth[_0x2887('0x8')](),controller[_0x2887('0xf')]);router[_0x2887('0x10')](_0x2887('0xa'),auth[_0x2887('0x8')](),controller['update']);router['delete'](_0x2887('0xa'),auth[_0x2887('0x8')](),controller['destroy']);router[_0x2887('0x11')]('/:id/sounds/:id2',auth[_0x2887('0x8')](),controller[_0x2887('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcbee=['isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1a58ac,_0x2a3cc2){var _0xeac505=function(_0x5be42d){while(--_0x5be42d){_0x1a58ac['push'](_0x1a58ac['shift']());}};_0xeac505(++_0x2a3cc2);}(_0xcbee,0x101));var _0xecbe=function(_0xd55b08,_0x4411b6){_0xd55b08=_0xd55b08-0x0;var _0x1d3093=_0xcbee[_0xd55b08];return _0x1d3093;};'use strict';var multer=require('multer');var util=require(_0xecbe('0x0'));var path=require(_0xecbe('0x1'));var timeout=require('connect-timeout');var express=require(_0xecbe('0x2'));var router=express[_0xecbe('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xecbe('0x4'));var interaction=require(_0xecbe('0x5'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xecbe('0x6')]('/',auth[_0xecbe('0x7')](),controller[_0xecbe('0x8')]);router[_0xecbe('0x6')]('/:id',auth[_0xecbe('0x7')](),controller['show']);router['get'](_0xecbe('0x9'),auth['isAuthenticated'](),controller[_0xecbe('0xa')]);router[_0xecbe('0xb')]('/',auth[_0xecbe('0x7')](),controller[_0xecbe('0xc')]);router[_0xecbe('0xb')](_0xecbe('0x9'),auth[_0xecbe('0x7')](),controller[_0xecbe('0xd')]);router[_0xecbe('0xe')](_0xecbe('0xf'),auth['isAuthenticated'](),controller[_0xecbe('0x10')]);router[_0xecbe('0x11')](_0xecbe('0xf'),auth[_0xecbe('0x7')](),controller[_0xecbe('0x12')]);router[_0xecbe('0x11')](_0xecbe('0x13'),auth[_0xecbe('0x7')](),controller[_0xecbe('0x14')]);module[_0xecbe('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 092251a..a9b6f4c 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 _0x59f6=['files','mp3nb','quietmp3nb','mp3','STRING','TIMESTAMP','BOOLEAN','sequelize','name','ENUM','custom'];(function(_0x5a1525,_0x4cf12b){var _0x4abcd2=function(_0x5dd744){while(--_0x5dd744){_0x5a1525['push'](_0x5a1525['shift']());}};_0x4abcd2(++_0x4cf12b);}(_0x59f6,0x96));var _0x659f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x59f6[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x659f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x659f('0x1')},'mode':{'type':Sequelize[_0x659f('0x2')](_0x659f('0x3'),_0x659f('0x4'),_0x659f('0x5'),_0x659f('0x6'),'quietmp3',_0x659f('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x659f('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x659f('0x8')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x659f('0x8')],'allowNull':!![]},'stamp':{'type':_0x659f('0x9')},'defaultEntry':{'type':Sequelize[_0x659f('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc77f=['name','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0xa7b046,_0x4e06e4){var _0x16d6fe=function(_0xfc707a){while(--_0xfc707a){_0xa7b046['push'](_0xa7b046['shift']());}};_0x16d6fe(++_0x4e06e4);}(_0xc77f,0xe7));var _0xfc77=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xc77f[_0x26b80e];return _0x84a8a8;};'use strict';var Sequelize=require(_0xfc77('0x0'));module[_0xfc77('0x1')]={'name':{'type':Sequelize[_0xfc77('0x2')],'allowNull':![],'unique':_0xfc77('0x3')},'mode':{'type':Sequelize['ENUM'](_0xfc77('0x4'),_0xfc77('0x5'),_0xfc77('0x6'),_0xfc77('0x7'),_0xfc77('0x8'),_0xfc77('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xfc77('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xfc77('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xfc77('0x2')],'allowNull':!![],'defaultValue':_0xfc77('0xa')},'format':{'type':Sequelize[_0xfc77('0x2')],'allowNull':!![]},'stamp':{'type':_0xfc77('0xb')},'defaultEntry':{'type':Sequelize[_0xfc77('0xc')],'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 8ebc03e..30458b7 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 _0xb13a=['create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','findOne','createdAt','server/files/sounds/converted','%s.%s','basename','save_name','converted_format','format','symlinkSync','removeSound','id2','Sound','getSounds','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','VoiceMusicOnHold','include','findAll','rows','catch','show','params','rawAttributes','options','body'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xb13a,0x10e));var _0xab13=function(_0x55a1cc,_0x2d72ec){_0x55a1cc=_0x55a1cc-0x0;var _0x44b08e=_0xb13a[_0x55a1cc];return _0x44b08e;};'use strict';var emlformat=require(_0xab13('0x0'));var rimraf=require(_0xab13('0x1'));var zipdir=require(_0xab13('0x2'));var jsonpatch=require(_0xab13('0x3'));var rp=require('request-promise');var moment=require(_0xab13('0x4'));var BPromise=require(_0xab13('0x5'));var Mustache=require(_0xab13('0x6'));var util=require('util');var path=require(_0xab13('0x7'));var sox=require(_0xab13('0x8'));var csv=require('to-csv');var ejs=require(_0xab13('0x9'));var fs=require('fs');var fs_extra=require(_0xab13('0xa'));var _=require(_0xab13('0xb'));var squel=require(_0xab13('0xc'));var crypto=require(_0xab13('0xd'));var jsforce=require(_0xab13('0xe'));var deskjs=require(_0xab13('0xf'));var toCsv=require('to-csv');var querystring=require(_0xab13('0x10'));var Papa=require('papaparse');var Redis=require(_0xab13('0x11'));var authService=require(_0xab13('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xab13('0x13'));var hardwareService=require(_0xab13('0x14'));var logger=require('../../config/logger')(_0xab13('0x15'));var utils=require(_0xab13('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab13('0x17'))['db'];function respondWithStatusCode(_0x51e340,_0xf17ec2){_0xf17ec2=_0xf17ec2||0xcc;return function(_0x201edb){if(_0x201edb){return _0x51e340[_0xab13('0x18')](_0xf17ec2);}return _0x51e340[_0xab13('0x19')](_0xf17ec2)['end']();};}function respondWithResult(_0x1524e6,_0x2b309b){_0x2b309b=_0x2b309b||0xc8;return function(_0x200084){if(_0x200084){return _0x1524e6[_0xab13('0x19')](_0x2b309b)['json'](_0x200084);}};}function respondWithFilteredResult(_0x2d638f,_0x583a0d){return function(_0x52a5db){if(_0x52a5db){var _0x5809fb=typeof _0x583a0d[_0xab13('0x1a')]===_0xab13('0x1b')&&typeof _0x583a0d['limit']==='undefined';var _0x167e20=_0x52a5db[_0xab13('0x1c')];var _0x7dc310=_0x5809fb?0x0:_0x583a0d['offset'];var _0x1845ae=_0x5809fb?_0x52a5db['count']:_0x583a0d[_0xab13('0x1a')]+_0x583a0d[_0xab13('0x1d')];var _0x279e94;if(_0x1845ae>=_0x167e20){_0x1845ae=_0x167e20;_0x279e94=0xc8;}else{_0x279e94=0xce;}_0x2d638f[_0xab13('0x19')](_0x279e94);return _0x2d638f[_0xab13('0x1e')]('Content-Range',_0x7dc310+'-'+_0x1845ae+'/'+_0x167e20)['json'](_0x52a5db);}return null;};}function patchUpdates(_0x29a113){return function(_0x30b175){try{jsonpatch[_0xab13('0x1f')](_0x30b175,_0x29a113,!![]);}catch(_0x56232c){return BPromise[_0xab13('0x20')](_0x56232c);}return _0x30b175[_0xab13('0x21')]();};}function saveUpdates(_0x286d48,_0x2eb24d){return function(_0x2b9f11){if(_0x2b9f11){return _0x2b9f11[_0xab13('0x22')](_0x286d48)[_0xab13('0x23')](function(_0x138405){return _0x138405;});}return null;};}function removeEntity(_0x175674,_0xd6e21b){return function(_0x4009db){if(_0x4009db){return _0x4009db[_0xab13('0x24')]()['then'](function(){var _0x74b748=_0x4009db['get']({'plain':!![]});var _0x2218e6='MusicOnHolds';return db[_0xab13('0x25')][_0xab13('0x24')]({'where':{'type':_0x2218e6,'resourceId':_0x74b748['id']}})[_0xab13('0x23')](function(){return _0x4009db;});})[_0xab13('0x23')](function(){_0x175674[_0xab13('0x19')](0xcc)[_0xab13('0x26')]();});}};}function handleEntityNotFound(_0x132050,_0x55b7cb){return function(_0x5b3f68){if(!_0x5b3f68){_0x132050[_0xab13('0x18')](0x194);}return _0x5b3f68;};}function handleError(_0x1a1c63,_0x45e8d0){_0x45e8d0=_0x45e8d0||0x1f4;return function(_0x524273){logger[_0xab13('0x27')](_0x524273[_0xab13('0x28')]);if(_0x524273[_0xab13('0x29')]){delete _0x524273['name'];}_0x1a1c63[_0xab13('0x19')](_0x45e8d0)[_0xab13('0x2a')](_0x524273);};}exports['index']=function(_0x70dfc3,_0x16d857){var _0x46ca2c={},_0x5cc6fe={},_0xa56c21={'count':0x0,'rows':[]};var _0xed0a25=_[_0xab13('0x2b')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x1b4751){return{'name':_0x1b4751[_0xab13('0x2c')],'type':_0x1b4751[_0xab13('0x2d')][_0xab13('0x2e')]};});_0x5cc6fe[_0xab13('0x2f')]=_[_0xab13('0x2b')](_0xed0a25,'name');_0x5cc6fe[_0xab13('0x30')]=_[_0xab13('0x31')](_0x70dfc3[_0xab13('0x30')]);_0x5cc6fe[_0xab13('0x32')]=_[_0xab13('0x33')](_0x5cc6fe[_0xab13('0x2f')],_0x5cc6fe[_0xab13('0x30')]);_0x46ca2c[_0xab13('0x34')]=_[_0xab13('0x33')](_0x5cc6fe['model'],qs['fields'](_0x70dfc3[_0xab13('0x30')][_0xab13('0x35')]));_0x46ca2c[_0xab13('0x34')]=_0x46ca2c[_0xab13('0x34')][_0xab13('0x36')]?_0x46ca2c[_0xab13('0x34')]:_0x5cc6fe[_0xab13('0x2f')];if(!_0x70dfc3[_0xab13('0x30')]['hasOwnProperty']('nolimit')){_0x46ca2c[_0xab13('0x1d')]=qs[_0xab13('0x1d')](_0x70dfc3['query'][_0xab13('0x1d')]);_0x46ca2c['offset']=qs[_0xab13('0x1a')](_0x70dfc3['query']['offset']);}_0x46ca2c[_0xab13('0x37')]=qs[_0xab13('0x38')](_0x70dfc3[_0xab13('0x30')][_0xab13('0x38')]);delete _0x70dfc3[_0xab13('0x30')][_0xab13('0x38')];_0x46ca2c[_0xab13('0x39')]=qs[_0xab13('0x32')](_[_0xab13('0x3a')](_0x70dfc3[_0xab13('0x30')],_0x5cc6fe[_0xab13('0x32')]),_0xed0a25);if(_0x70dfc3[_0xab13('0x30')][_0xab13('0x3b')]){_0x46ca2c[_0xab13('0x39')]=_[_0xab13('0x3c')](_0x46ca2c['where'],{'$or':_[_0xab13('0x2b')](_0xed0a25,function(_0x336510){if(_0x336510['type']!==_0xab13('0x3d')){var _0x2733f3={};_0x2733f3[_0x336510[_0xab13('0x29')]]={'$like':'%'+_0x70dfc3[_0xab13('0x30')][_0xab13('0x3b')]+'%'};return _0x2733f3;}})});}_0x46ca2c=_[_0xab13('0x3c')]({},_0x46ca2c,_0x70dfc3['options']);var _0x4c89c0={'where':_0x46ca2c[_0xab13('0x39')]};return db[_0xab13('0x3e')]['count'](_0x4c89c0)[_0xab13('0x23')](function(_0x1df78b){_0xa56c21[_0xab13('0x1c')]=_0x1df78b;if(_0x70dfc3['query']['includeAll']){_0x46ca2c[_0xab13('0x3f')]=[{'all':!![]}];}return db[_0xab13('0x3e')][_0xab13('0x40')](_0x46ca2c);})[_0xab13('0x23')](function(_0x2afc13){_0xa56c21[_0xab13('0x41')]=_0x2afc13;return _0xa56c21;})[_0xab13('0x23')](respondWithFilteredResult(_0x16d857,_0x46ca2c))[_0xab13('0x42')](handleError(_0x16d857,null));};exports[_0xab13('0x43')]=function(_0x4dc48f,_0x4baaee){var _0x4f4537={'raw':![],'where':{'id':_0x4dc48f[_0xab13('0x44')]['id']}},_0x23d355={};_0x23d355[_0xab13('0x2f')]=_[_0xab13('0x31')](db[_0xab13('0x3e')][_0xab13('0x45')]);_0x23d355['query']=_[_0xab13('0x31')](_0x4dc48f[_0xab13('0x30')]);_0x23d355[_0xab13('0x32')]=_['intersection'](_0x23d355[_0xab13('0x2f')],_0x23d355[_0xab13('0x30')]);_0x4f4537['attributes']=_[_0xab13('0x33')](_0x23d355[_0xab13('0x2f')],qs[_0xab13('0x35')](_0x4dc48f[_0xab13('0x30')][_0xab13('0x35')]));_0x4f4537['attributes']=_0x4f4537[_0xab13('0x34')][_0xab13('0x36')]?_0x4f4537['attributes']:_0x23d355[_0xab13('0x2f')];if(_0x4dc48f[_0xab13('0x30')]['includeAll']){_0x4f4537['include']=[{'all':!![]}];}_0x4f4537=_[_0xab13('0x3c')]({},_0x4f4537,_0x4dc48f[_0xab13('0x46')]);return db[_0xab13('0x3e')]['find'](_0x4f4537)[_0xab13('0x23')](handleEntityNotFound(_0x4baaee,null))[_0xab13('0x23')](respondWithResult(_0x4baaee,null))[_0xab13('0x42')](handleError(_0x4baaee,null));};exports[_0xab13('0x22')]=function(_0x27f40c,_0x22a464){if(_0x27f40c[_0xab13('0x47')]['id']){delete _0x27f40c[_0xab13('0x47')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x27f40c[_0xab13('0x44')]['id']}})['then'](handleEntityNotFound(_0x22a464,null))[_0xab13('0x23')](saveUpdates(_0x27f40c['body'],null))[_0xab13('0x23')](respondWithResult(_0x22a464,null))[_0xab13('0x42')](handleError(_0x22a464,null));};exports[_0xab13('0x48')]=function(_0x433d26,_0x5e5045,_0x583528){return db[_0xab13('0x49')][_0xab13('0x4a')](function(_0x2c361a){if(_0x433d26[_0xab13('0x47')]['mode']===_0xab13('0x4b')){_0x433d26[_0xab13('0x47')][_0xab13('0x4c')]=path[_0xab13('0x4d')](config[_0xab13('0x4e')],_0xab13('0x4f'),_0x433d26[_0xab13('0x47')][_0xab13('0x29')]);}return db[_0xab13('0x3e')][_0xab13('0x48')](_0x433d26[_0xab13('0x47')],{'transaction':_0x2c361a})[_0xab13('0x23')](function(_0x5b2732){if(_0x433d26[_0xab13('0x47')][_0xab13('0x50')]===_0xab13('0x4b')){fs[_0xab13('0x51')](_0x5b2732[_0xab13('0x4c')],parseInt(_0xab13('0x52'),0x8));}var _0x147a51=_0x433d26[_0xab13('0x53')][_0xab13('0x54')]({'plain':!![]});if(!_0x147a51)throw new Error(_0xab13('0x55'));if(_0x147a51[_0xab13('0x56')]==='user'){var _0x2b244b=_0x5b2732['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xab13('0x57'),'userProfileId':_0x147a51[_0xab13('0x58')]},'raw':!![]})[_0xab13('0x23')](function(_0x4ff001){if(_0x4ff001&&_0x4ff001[_0xab13('0x59')]===0x0){return db[_0xab13('0x25')]['create']({'name':_0x2b244b[_0xab13('0x29')],'resourceId':_0x2b244b['id'],'type':_0x4ff001[_0xab13('0x29')],'sectionId':_0x4ff001['id']},{})[_0xab13('0x23')](function(){return _0x5b2732;});}else{return _0x5b2732;}})[_0xab13('0x42')](function(_0x59bf79){logger[_0xab13('0x27')](_0xab13('0x5a'),_0x59bf79);});}return _0x5b2732;});})['then'](respondWithResult(_0x5e5045,0xc9))['catch'](handleError(_0x5e5045,null));};exports[_0xab13('0x24')]=function(_0x1dc1bc,_0x5a1089,_0x44c3cc){var _0x5e694a;return db['VoiceMusicOnHold'][_0xab13('0x5b')]({'where':{'id':_0x1dc1bc['params']['id']}})[_0xab13('0x23')](function(_0x44bb44){if(_0x44bb44){return db['sequelize'][_0xab13('0x4a')](function(_0x3e404b){return _0x44bb44[_0xab13('0x24')]({'transaction':_0x3e404b,'raw':!![]})[_0xab13('0x23')](function(_0x45e314){if(_0x45e314[_0xab13('0x4c')]){fs[_0xab13('0x5c')](_0x45e314[_0xab13('0x4c')])[_0xab13('0x5d')](function(_0x42deb2){fs[_0xab13('0x5e')](path[_0xab13('0x4d')](_0x45e314[_0xab13('0x4c')],_0x42deb2));});fs[_0xab13('0x5f')](_0x45e314['directory']);}return _0x45e314;});})[_0xab13('0x42')](function(_0x30e11e){throw new db[(_0xab13('0x60'))][(_0xab13('0x61'))](_0x30e11e[_0xab13('0x62')]);});}})[_0xab13('0x23')](handleEntityNotFound(_0x5a1089,null))['then'](removeEntity(_0x5a1089,null))[_0xab13('0x42')](handleError(_0x5a1089,null));};exports['addSound']=function(_0x4ec580,_0x11a961,_0x1cac83){return db[_0xab13('0x49')][_0xab13('0x4a')](function(_0x59ceef){var _0x3d5cc4;return db[_0xab13('0x3e')][_0xab13('0x5b')]({'where':{'id':_0x4ec580[_0xab13('0x44')]['id']}})[_0xab13('0x23')](function(_0x1887f7){if(_0x1887f7){_0x3d5cc4=_0x1887f7;return _0x1887f7['addSound'](_0x4ec580[_0xab13('0x47')]['id'],{'transaction':_0x59ceef});}})[_0xab13('0x23')](function(_0x44b6f4){if(_0x44b6f4){return db['Sound'][_0xab13('0x63')]({'where':{'id':_0x4ec580[_0xab13('0x47')]['id']},'attributes':['id',_0xab13('0x29'),'save_name','converted_format',_0xab13('0x64')],'raw':!![]});}})[_0xab13('0x23')](function(_0x4d5e11){if(_0x4d5e11){var _0x513dfb=path[_0xab13('0x4d')](config[_0xab13('0x4e')],_0xab13('0x65'),util['format'](_0xab13('0x66'),path[_0xab13('0x67')](_0x4d5e11['save_name'],path['extname'](_0x4d5e11[_0xab13('0x68')])),_0x4d5e11[_0xab13('0x69')]));var _0x38e9fc=path[_0xab13('0x4d')](config['root'],'server/files/moh',_0x3d5cc4[_0xab13('0x29')],util[_0xab13('0x6a')](_0xab13('0x66'),_0x4d5e11[_0xab13('0x29')],_0x4d5e11[_0xab13('0x69')]));fs[_0xab13('0x6b')](_0x513dfb,_0x38e9fc);return _0x4d5e11;}})['catch'](function(_0x123928){throw new db[(_0xab13('0x60'))][(_0xab13('0x61'))](_0x123928[_0xab13('0x62')]);});})[_0xab13('0x23')](handleEntityNotFound(_0x11a961,null))[_0xab13('0x23')](respondWithResult(_0x11a961,0xc9))[_0xab13('0x42')](handleError(_0x11a961,null));};exports[_0xab13('0x6c')]=function(_0x122359,_0x37fffa,_0x63f86){return db[_0xab13('0x49')][_0xab13('0x4a')](function(_0x1dc7af){var _0x1600c1;return db[_0xab13('0x3e')][_0xab13('0x63')]({'where':{'id':_0x122359[_0xab13('0x44')]['id']}})[_0xab13('0x23')](handleEntityNotFound(_0x37fffa,null))[_0xab13('0x23')](function(_0x3692a5){if(_0x3692a5){_0x1600c1=_0x3692a5;return _0x3692a5[_0xab13('0x6c')](_0x122359[_0xab13('0x44')][_0xab13('0x6d')]);}})['then'](function(_0x88afa){if(_0x88afa){return db['Sound'][_0xab13('0x63')]({'where':{'id':_0x122359[_0xab13('0x44')][_0xab13('0x6d')]},'attributes':['id','name',_0xab13('0x68'),_0xab13('0x69'),_0xab13('0x64')],'raw':!![]});}})[_0xab13('0x23')](function(_0x996afc){if(_0x996afc){fs[_0xab13('0x5e')](path[_0xab13('0x4d')](_0x1600c1[_0xab13('0x4c')],util[_0xab13('0x6a')](_0xab13('0x66'),_0x996afc[_0xab13('0x29')],_0x996afc[_0xab13('0x69')])));return _0x996afc;}})[_0xab13('0x42')](function(_0x55ef6e){throw new db[(_0xab13('0x60'))][(_0xab13('0x61'))](_0x55ef6e['message']);});})[_0xab13('0x23')](handleEntityNotFound(_0x37fffa,null))[_0xab13('0x23')](respondWithStatusCode(_0x37fffa,0xcc))[_0xab13('0x42')](handleError(_0x37fffa,null));};exports['getSounds']=function(_0x401ac4,_0x420dce,_0xd6ec8d){var _0x3dc9d7={};var _0x4087c2={};var _0x58e0d3;var _0x2e3f70;return db[_0xab13('0x3e')][_0xab13('0x63')]({'where':{'id':_0x401ac4['params']['id']}})[_0xab13('0x23')](handleEntityNotFound(_0x420dce,null))[_0xab13('0x23')](function(_0x52159d){if(_0x52159d){_0x58e0d3=_0x52159d;_0x4087c2[_0xab13('0x2f')]=_[_0xab13('0x31')](db[_0xab13('0x6e')][_0xab13('0x45')]);_0x4087c2[_0xab13('0x30')]=_[_0xab13('0x31')](_0x401ac4['query']);_0x4087c2['filters']=_['intersection'](_0x4087c2[_0xab13('0x2f')],_0x4087c2[_0xab13('0x30')]);_0x3dc9d7['attributes']=_[_0xab13('0x33')](_0x4087c2[_0xab13('0x2f')],qs['fields'](_0x401ac4['query']['fields']));_0x3dc9d7[_0xab13('0x34')]=_0x3dc9d7[_0xab13('0x34')][_0xab13('0x36')]?_0x3dc9d7[_0xab13('0x34')]:_0x4087c2[_0xab13('0x2f')];_0x3dc9d7[_0xab13('0x37')]=qs[_0xab13('0x38')](_0x401ac4[_0xab13('0x30')][_0xab13('0x38')]);_0x3dc9d7[_0xab13('0x39')]=qs[_0xab13('0x32')](_[_0xab13('0x3a')](_0x401ac4[_0xab13('0x30')],_0x4087c2[_0xab13('0x32')]));if(_0x401ac4[_0xab13('0x30')][_0xab13('0x3b')]){_0x3dc9d7[_0xab13('0x39')]=_[_0xab13('0x3c')](_0x3dc9d7[_0xab13('0x39')],{'$or':_[_0xab13('0x2b')](_0x3dc9d7[_0xab13('0x34')],function(_0x5bc5bf){var _0x519adc={};_0x519adc[_0x5bc5bf]={'$like':'%'+_0x401ac4[_0xab13('0x30')]['filter']+'%'};return _0x519adc;})});}_0x3dc9d7=_[_0xab13('0x3c')]({},_0x3dc9d7,_0x401ac4['options']);return _0x58e0d3[_0xab13('0x6f')](_0x3dc9d7);}})[_0xab13('0x23')](function(_0xe508a7){if(_0xe508a7){_0x2e3f70=_0xe508a7[_0xab13('0x36')];if(!_0x401ac4[_0xab13('0x30')][_0xab13('0x70')](_0xab13('0x71'))){_0x3dc9d7[_0xab13('0x1d')]=qs['limit'](_0x401ac4['query']['limit']);_0x3dc9d7[_0xab13('0x1a')]=qs[_0xab13('0x1a')](_0x401ac4['query'][_0xab13('0x1a')]);}return _0x58e0d3['getSounds'](_0x3dc9d7);}})[_0xab13('0x23')](function(_0x421ad2){if(_0x421ad2){return _0x421ad2?{'count':_0x2e3f70,'rows':_0x421ad2}:null;}})[_0xab13('0x23')](respondWithResult(_0x420dce,null))[_0xab13('0x42')](handleError(_0x420dce,null));}; \ No newline at end of file +var _0xa208=['rows','catch','show','includeAll','options','body','find','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','message','removeSound','id2','unlinkSync','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','limit','json','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa208,0x1d6));var _0x8a20=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xa208[_0x424a9a];return _0xa7831c;};'use strict';var emlformat=require(_0x8a20('0x0'));var rimraf=require(_0x8a20('0x1'));var zipdir=require(_0x8a20('0x2'));var jsonpatch=require(_0x8a20('0x3'));var rp=require(_0x8a20('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8a20('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8a20('0x6'));var ejs=require(_0x8a20('0x7'));var fs=require('fs');var fs_extra=require(_0x8a20('0x8'));var _=require(_0x8a20('0x9'));var squel=require(_0x8a20('0xa'));var crypto=require('crypto');var jsforce=require(_0x8a20('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8a20('0x6'));var querystring=require(_0x8a20('0xc'));var Papa=require(_0x8a20('0xd'));var Redis=require(_0x8a20('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8a20('0xf'));var hardwareService=require(_0x8a20('0x10'));var logger=require(_0x8a20('0x11'))('api');var utils=require(_0x8a20('0x12'));var config=require(_0x8a20('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f15cf,_0xddc49b){_0xddc49b=_0xddc49b||0xcc;return function(_0x33e73b){if(_0x33e73b){return _0x1f15cf[_0x8a20('0x14')](_0xddc49b);}return _0x1f15cf[_0x8a20('0x15')](_0xddc49b)[_0x8a20('0x16')]();};}function respondWithResult(_0x3d39db,_0x2d6487){_0x2d6487=_0x2d6487||0xc8;return function(_0x1b909f){if(_0x1b909f){return _0x3d39db[_0x8a20('0x15')](_0x2d6487)['json'](_0x1b909f);}};}function respondWithFilteredResult(_0x3924d8,_0x3987b5){return function(_0x2b496a){if(_0x2b496a){var _0x5a49d3=typeof _0x3987b5['offset']===_0x8a20('0x17')&&typeof _0x3987b5['limit']===_0x8a20('0x17');var _0x4fc83b=_0x2b496a[_0x8a20('0x18')];var _0xe789fa=_0x5a49d3?0x0:_0x3987b5[_0x8a20('0x19')];var _0x364e69=_0x5a49d3?_0x2b496a[_0x8a20('0x18')]:_0x3987b5[_0x8a20('0x19')]+_0x3987b5[_0x8a20('0x1a')];var _0x349723;if(_0x364e69>=_0x4fc83b){_0x364e69=_0x4fc83b;_0x349723=0xc8;}else{_0x349723=0xce;}_0x3924d8[_0x8a20('0x15')](_0x349723);return _0x3924d8['set']('Content-Range',_0xe789fa+'-'+_0x364e69+'/'+_0x4fc83b)[_0x8a20('0x1b')](_0x2b496a);}return null;};}function patchUpdates(_0x1b8cd6){return function(_0x5d35ad){try{jsonpatch[_0x8a20('0x1c')](_0x5d35ad,_0x1b8cd6,!![]);}catch(_0x1f5268){return BPromise[_0x8a20('0x1d')](_0x1f5268);}return _0x5d35ad[_0x8a20('0x1e')]();};}function saveUpdates(_0x4f3de0,_0x15e161){return function(_0x22a999){if(_0x22a999){return _0x22a999[_0x8a20('0x1f')](_0x4f3de0)[_0x8a20('0x20')](function(_0x3275b4){return _0x3275b4;});}return null;};}function removeEntity(_0x7f7e12,_0x108cd8){return function(_0x273dbc){if(_0x273dbc){return _0x273dbc[_0x8a20('0x21')]()[_0x8a20('0x20')](function(){var _0x29b334=_0x273dbc[_0x8a20('0x22')]({'plain':!![]});var _0xdd9f1b=_0x8a20('0x23');return db[_0x8a20('0x24')]['destroy']({'where':{'type':_0xdd9f1b,'resourceId':_0x29b334['id']}})[_0x8a20('0x20')](function(){return _0x273dbc;});})[_0x8a20('0x20')](function(){_0x7f7e12[_0x8a20('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4ab2,_0x265169){return function(_0x5ad1de){if(!_0x5ad1de){_0x3c4ab2['sendStatus'](0x194);}return _0x5ad1de;};}function handleError(_0x329bbd,_0x4f2f70){_0x4f2f70=_0x4f2f70||0x1f4;return function(_0x2afcd7){logger['error'](_0x2afcd7[_0x8a20('0x25')]);if(_0x2afcd7['name']){delete _0x2afcd7[_0x8a20('0x26')];}_0x329bbd[_0x8a20('0x15')](_0x4f2f70)[_0x8a20('0x27')](_0x2afcd7);};}exports['index']=function(_0x5b94fa,_0x3f4fce){var _0x167b0c={},_0x4f8c18={},_0x1caf72={'count':0x0,'rows':[]};var _0x3d5626=_['map'](db[_0x8a20('0x28')][_0x8a20('0x29')],function(_0x30710d){return{'name':_0x30710d[_0x8a20('0x2a')],'type':_0x30710d[_0x8a20('0x2b')][_0x8a20('0x2c')]};});_0x4f8c18[_0x8a20('0x2d')]=_['map'](_0x3d5626,_0x8a20('0x26'));_0x4f8c18[_0x8a20('0x2e')]=_[_0x8a20('0x2f')](_0x5b94fa[_0x8a20('0x2e')]);_0x4f8c18[_0x8a20('0x30')]=_[_0x8a20('0x31')](_0x4f8c18[_0x8a20('0x2d')],_0x4f8c18[_0x8a20('0x2e')]);_0x167b0c[_0x8a20('0x32')]=_[_0x8a20('0x31')](_0x4f8c18[_0x8a20('0x2d')],qs[_0x8a20('0x33')](_0x5b94fa[_0x8a20('0x2e')]['fields']));_0x167b0c[_0x8a20('0x32')]=_0x167b0c['attributes'][_0x8a20('0x34')]?_0x167b0c['attributes']:_0x4f8c18[_0x8a20('0x2d')];if(!_0x5b94fa[_0x8a20('0x2e')][_0x8a20('0x35')](_0x8a20('0x36'))){_0x167b0c[_0x8a20('0x1a')]=qs[_0x8a20('0x1a')](_0x5b94fa[_0x8a20('0x2e')][_0x8a20('0x1a')]);_0x167b0c[_0x8a20('0x19')]=qs['offset'](_0x5b94fa[_0x8a20('0x2e')]['offset']);}_0x167b0c[_0x8a20('0x37')]=qs[_0x8a20('0x38')](_0x5b94fa['query'][_0x8a20('0x38')]);delete _0x5b94fa['query'][_0x8a20('0x38')];_0x167b0c[_0x8a20('0x39')]=qs[_0x8a20('0x30')](_[_0x8a20('0x3a')](_0x5b94fa[_0x8a20('0x2e')],_0x4f8c18[_0x8a20('0x30')]),_0x3d5626);if(_0x5b94fa[_0x8a20('0x2e')][_0x8a20('0x3b')]){_0x167b0c[_0x8a20('0x39')]=_[_0x8a20('0x3c')](_0x167b0c['where'],{'$or':_[_0x8a20('0x3d')](_0x3d5626,function(_0x37c1c7){if(_0x37c1c7[_0x8a20('0x2b')]!==_0x8a20('0x3e')){var _0x46b919={};_0x46b919[_0x37c1c7[_0x8a20('0x26')]]={'$like':'%'+_0x5b94fa['query'][_0x8a20('0x3b')]+'%'};return _0x46b919;}})});}_0x167b0c=_[_0x8a20('0x3c')]({},_0x167b0c,_0x5b94fa['options']);var _0x337ccf={'where':_0x167b0c[_0x8a20('0x39')]};return db[_0x8a20('0x28')][_0x8a20('0x18')](_0x337ccf)[_0x8a20('0x20')](function(_0x345efc){_0x1caf72[_0x8a20('0x18')]=_0x345efc;if(_0x5b94fa[_0x8a20('0x2e')]['includeAll']){_0x167b0c[_0x8a20('0x3f')]=[{'all':!![]}];}return db[_0x8a20('0x28')][_0x8a20('0x40')](_0x167b0c);})[_0x8a20('0x20')](function(_0x50b3f5){_0x1caf72[_0x8a20('0x41')]=_0x50b3f5;return _0x1caf72;})['then'](respondWithFilteredResult(_0x3f4fce,_0x167b0c))[_0x8a20('0x42')](handleError(_0x3f4fce,null));};exports[_0x8a20('0x43')]=function(_0x5598df,_0x33a5df){var _0x1ff5cc={'raw':![],'where':{'id':_0x5598df['params']['id']}},_0x3deb2b={};_0x3deb2b[_0x8a20('0x2d')]=_['keys'](db[_0x8a20('0x28')][_0x8a20('0x29')]);_0x3deb2b[_0x8a20('0x2e')]=_[_0x8a20('0x2f')](_0x5598df[_0x8a20('0x2e')]);_0x3deb2b[_0x8a20('0x30')]=_[_0x8a20('0x31')](_0x3deb2b[_0x8a20('0x2d')],_0x3deb2b[_0x8a20('0x2e')]);_0x1ff5cc[_0x8a20('0x32')]=_[_0x8a20('0x31')](_0x3deb2b[_0x8a20('0x2d')],qs[_0x8a20('0x33')](_0x5598df[_0x8a20('0x2e')][_0x8a20('0x33')]));_0x1ff5cc[_0x8a20('0x32')]=_0x1ff5cc[_0x8a20('0x32')]['length']?_0x1ff5cc[_0x8a20('0x32')]:_0x3deb2b[_0x8a20('0x2d')];if(_0x5598df[_0x8a20('0x2e')][_0x8a20('0x44')]){_0x1ff5cc[_0x8a20('0x3f')]=[{'all':!![]}];}_0x1ff5cc=_[_0x8a20('0x3c')]({},_0x1ff5cc,_0x5598df[_0x8a20('0x45')]);return db[_0x8a20('0x28')]['find'](_0x1ff5cc)[_0x8a20('0x20')](handleEntityNotFound(_0x33a5df,null))[_0x8a20('0x20')](respondWithResult(_0x33a5df,null))['catch'](handleError(_0x33a5df,null));};exports[_0x8a20('0x1f')]=function(_0x4a500a,_0x141956){if(_0x4a500a['body']['id']){delete _0x4a500a[_0x8a20('0x46')]['id'];}return db['VoiceMusicOnHold'][_0x8a20('0x47')]({'where':{'id':_0x4a500a['params']['id']}})[_0x8a20('0x20')](handleEntityNotFound(_0x141956,null))[_0x8a20('0x20')](saveUpdates(_0x4a500a['body'],null))['then'](respondWithResult(_0x141956,null))[_0x8a20('0x42')](handleError(_0x141956,null));};exports[_0x8a20('0x48')]=function(_0x3b059b,_0x3699d6,_0x3fa9bc){return db[_0x8a20('0x49')][_0x8a20('0x4a')](function(_0x487a35){if(_0x3b059b[_0x8a20('0x46')][_0x8a20('0x4b')]==='files'){_0x3b059b[_0x8a20('0x46')][_0x8a20('0x4c')]=path[_0x8a20('0x4d')](config[_0x8a20('0x4e')],_0x8a20('0x4f'),_0x3b059b[_0x8a20('0x46')][_0x8a20('0x26')]);}return db[_0x8a20('0x28')]['create'](_0x3b059b[_0x8a20('0x46')],{'transaction':_0x487a35})['then'](function(_0x3ef03c){if(_0x3b059b[_0x8a20('0x46')][_0x8a20('0x4b')]===_0x8a20('0x50')){fs[_0x8a20('0x51')](_0x3ef03c['directory'],parseInt(_0x8a20('0x52'),0x8));}var _0xef66da=_0x3b059b['user'][_0x8a20('0x22')]({'plain':!![]});if(!_0xef66da)throw new Error(_0x8a20('0x53'));if(_0xef66da['role']==='user'){var _0x418b0b=_0x3ef03c['get']({'plain':!![]});return db['UserProfileSection'][_0x8a20('0x47')]({'where':{'name':_0x8a20('0x23'),'userProfileId':_0xef66da['userProfileId']},'raw':!![]})['then'](function(_0x5da5aa){if(_0x5da5aa&&_0x5da5aa[_0x8a20('0x54')]===0x0){return db['UserProfileResource'][_0x8a20('0x48')]({'name':_0x418b0b[_0x8a20('0x26')],'resourceId':_0x418b0b['id'],'type':_0x5da5aa[_0x8a20('0x26')],'sectionId':_0x5da5aa['id']},{})[_0x8a20('0x20')](function(){return _0x3ef03c;});}else{return _0x3ef03c;}})[_0x8a20('0x42')](function(_0x22971a){logger[_0x8a20('0x55')](_0x8a20('0x56'),_0x22971a);});}return _0x3ef03c;});})[_0x8a20('0x20')](respondWithResult(_0x3699d6,0xc9))[_0x8a20('0x42')](handleError(_0x3699d6,null));};exports[_0x8a20('0x21')]=function(_0x438ccf,_0x1f2a67,_0x48ea12){var _0x1cea9b;return db[_0x8a20('0x28')][_0x8a20('0x47')]({'where':{'id':_0x438ccf[_0x8a20('0x57')]['id']}})[_0x8a20('0x20')](function(_0x1e06d0){if(_0x1e06d0){return db[_0x8a20('0x49')][_0x8a20('0x4a')](function(_0x450496){return _0x1e06d0['destroy']({'transaction':_0x450496,'raw':!![]})[_0x8a20('0x20')](function(_0x46da94){if(_0x46da94[_0x8a20('0x4c')]){fs[_0x8a20('0x58')](_0x46da94[_0x8a20('0x4c')])['forEach'](function(_0x3dab23){fs['unlinkSync'](path[_0x8a20('0x4d')](_0x46da94[_0x8a20('0x4c')],_0x3dab23));});fs['rmdirSync'](_0x46da94['directory']);}return _0x46da94;});})[_0x8a20('0x42')](function(_0x3a46d3){throw new db[(_0x8a20('0x59'))][(_0x8a20('0x5a'))](_0x3a46d3['message']);});}})['then'](handleEntityNotFound(_0x1f2a67,null))['then'](removeEntity(_0x1f2a67,null))[_0x8a20('0x42')](handleError(_0x1f2a67,null));};exports[_0x8a20('0x5b')]=function(_0x1ce47e,_0x2edb7b,_0xdaf333){return db[_0x8a20('0x49')]['transaction'](function(_0x213d57){var _0xd39d6d;return db[_0x8a20('0x28')][_0x8a20('0x47')]({'where':{'id':_0x1ce47e[_0x8a20('0x57')]['id']}})['then'](function(_0x1b8e43){if(_0x1b8e43){_0xd39d6d=_0x1b8e43;return _0x1b8e43[_0x8a20('0x5b')](_0x1ce47e[_0x8a20('0x46')]['id'],{'transaction':_0x213d57});}})[_0x8a20('0x20')](function(_0x2a9953){if(_0x2a9953){return db[_0x8a20('0x5c')][_0x8a20('0x5d')]({'where':{'id':_0x1ce47e[_0x8a20('0x46')]['id']},'attributes':['id',_0x8a20('0x26'),_0x8a20('0x5e'),'converted_format',_0x8a20('0x5f')],'raw':!![]});}})[_0x8a20('0x20')](function(_0x23df34){if(_0x23df34){var _0x1cfb12=path[_0x8a20('0x4d')](config[_0x8a20('0x4e')],_0x8a20('0x60'),util[_0x8a20('0x61')](_0x8a20('0x62'),path[_0x8a20('0x63')](_0x23df34[_0x8a20('0x5e')],path[_0x8a20('0x64')](_0x23df34['save_name'])),_0x23df34[_0x8a20('0x65')]));var _0x56827c=path[_0x8a20('0x4d')](config[_0x8a20('0x4e')],_0x8a20('0x4f'),_0xd39d6d[_0x8a20('0x26')],util[_0x8a20('0x61')]('%s.%s',_0x23df34[_0x8a20('0x26')],_0x23df34[_0x8a20('0x65')]));fs['symlinkSync'](_0x1cfb12,_0x56827c);return _0x23df34;}})[_0x8a20('0x42')](function(_0x56b803){throw new db[(_0x8a20('0x59'))][(_0x8a20('0x5a'))](_0x56b803[_0x8a20('0x66')]);});})['then'](handleEntityNotFound(_0x2edb7b,null))['then'](respondWithResult(_0x2edb7b,0xc9))[_0x8a20('0x42')](handleError(_0x2edb7b,null));};exports[_0x8a20('0x67')]=function(_0x35f3ce,_0x1d207c,_0xed9756){return db['sequelize'][_0x8a20('0x4a')](function(_0x3d8ff1){var _0x8e1c68;return db[_0x8a20('0x28')][_0x8a20('0x5d')]({'where':{'id':_0x35f3ce['params']['id']}})[_0x8a20('0x20')](handleEntityNotFound(_0x1d207c,null))[_0x8a20('0x20')](function(_0x148da8){if(_0x148da8){_0x8e1c68=_0x148da8;return _0x148da8[_0x8a20('0x67')](_0x35f3ce[_0x8a20('0x57')][_0x8a20('0x68')]);}})[_0x8a20('0x20')](function(_0x58a691){if(_0x58a691){return db[_0x8a20('0x5c')]['findOne']({'where':{'id':_0x35f3ce['params'][_0x8a20('0x68')]},'attributes':['id',_0x8a20('0x26'),_0x8a20('0x5e'),_0x8a20('0x65'),_0x8a20('0x5f')],'raw':!![]});}})[_0x8a20('0x20')](function(_0xf702fb){if(_0xf702fb){fs[_0x8a20('0x69')](path[_0x8a20('0x4d')](_0x8e1c68['directory'],util[_0x8a20('0x61')](_0x8a20('0x62'),_0xf702fb[_0x8a20('0x26')],_0xf702fb[_0x8a20('0x65')])));return _0xf702fb;}})[_0x8a20('0x42')](function(_0xfd8ae0){throw new db[(_0x8a20('0x59'))][(_0x8a20('0x5a'))](_0xfd8ae0[_0x8a20('0x66')]);});})[_0x8a20('0x20')](handleEntityNotFound(_0x1d207c,null))['then'](respondWithStatusCode(_0x1d207c,0xcc))[_0x8a20('0x42')](handleError(_0x1d207c,null));};exports[_0x8a20('0x6a')]=function(_0x2df934,_0x4635c9,_0x34a7e0){var _0x1c37c7={};var _0x2b41e8={};var _0x16c60c;var _0x1c99c1;return db[_0x8a20('0x28')][_0x8a20('0x5d')]({'where':{'id':_0x2df934[_0x8a20('0x57')]['id']}})['then'](handleEntityNotFound(_0x4635c9,null))['then'](function(_0x2a34fc){if(_0x2a34fc){_0x16c60c=_0x2a34fc;_0x2b41e8[_0x8a20('0x2d')]=_[_0x8a20('0x2f')](db[_0x8a20('0x5c')][_0x8a20('0x29')]);_0x2b41e8['query']=_[_0x8a20('0x2f')](_0x2df934['query']);_0x2b41e8[_0x8a20('0x30')]=_[_0x8a20('0x31')](_0x2b41e8[_0x8a20('0x2d')],_0x2b41e8[_0x8a20('0x2e')]);_0x1c37c7[_0x8a20('0x32')]=_[_0x8a20('0x31')](_0x2b41e8['model'],qs[_0x8a20('0x33')](_0x2df934['query'][_0x8a20('0x33')]));_0x1c37c7[_0x8a20('0x32')]=_0x1c37c7[_0x8a20('0x32')][_0x8a20('0x34')]?_0x1c37c7[_0x8a20('0x32')]:_0x2b41e8[_0x8a20('0x2d')];_0x1c37c7[_0x8a20('0x37')]=qs[_0x8a20('0x38')](_0x2df934['query'][_0x8a20('0x38')]);_0x1c37c7[_0x8a20('0x39')]=qs['filters'](_[_0x8a20('0x3a')](_0x2df934[_0x8a20('0x2e')],_0x2b41e8[_0x8a20('0x30')]));if(_0x2df934[_0x8a20('0x2e')]['filter']){_0x1c37c7[_0x8a20('0x39')]=_[_0x8a20('0x3c')](_0x1c37c7[_0x8a20('0x39')],{'$or':_['map'](_0x1c37c7[_0x8a20('0x32')],function(_0x53e842){var _0x350322={};_0x350322[_0x53e842]={'$like':'%'+_0x2df934['query'][_0x8a20('0x3b')]+'%'};return _0x350322;})});}_0x1c37c7=_['merge']({},_0x1c37c7,_0x2df934[_0x8a20('0x45')]);return _0x16c60c[_0x8a20('0x6a')](_0x1c37c7);}})[_0x8a20('0x20')](function(_0x1af4a8){if(_0x1af4a8){_0x1c99c1=_0x1af4a8[_0x8a20('0x34')];if(!_0x2df934[_0x8a20('0x2e')][_0x8a20('0x35')](_0x8a20('0x36'))){_0x1c37c7[_0x8a20('0x1a')]=qs[_0x8a20('0x1a')](_0x2df934['query'][_0x8a20('0x1a')]);_0x1c37c7['offset']=qs['offset'](_0x2df934[_0x8a20('0x2e')][_0x8a20('0x19')]);}return _0x16c60c[_0x8a20('0x6a')](_0x1c37c7);}})[_0x8a20('0x20')](function(_0xb9f816){if(_0xb9f816){return _0xb9f816?{'count':_0x1c99c1,'rows':_0xb9f816}:null;}})['then'](respondWithResult(_0x4635c9,null))['catch'](handleError(_0x4635c9,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c73d7af..24b8b5e 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 _0xd219=['define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x54f2a1,_0x4cba25){var _0x9f1f0a=function(_0x22f937){while(--_0x22f937){_0x54f2a1['push'](_0x54f2a1['shift']());}};_0x9f1f0a(++_0x4cba25);}(_0xd219,0x71));var _0x9d21=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xd219[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x9d21('0x0'));var util=require('util');var logger=require(_0x9d21('0x1'))(_0x9d21('0x2'));var moment=require('moment');var BPromise=require(_0x9d21('0x3'));var rp=require(_0x9d21('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9d21('0x5'));var attributes=require(_0x9d21('0x6'));module[_0x9d21('0x7')]=function(_0x3144d8,_0x7c04bf){return _0x3144d8[_0x9d21('0x8')](_0x9d21('0x9'),attributes,{'tableName':_0x9d21('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x914b=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','lodash','util','../../config/logger'];(function(_0xc1af5b,_0x396ee0){var _0x2a5d00=function(_0x52db0f){while(--_0x52db0f){_0xc1af5b['push'](_0xc1af5b['shift']());}};_0x2a5d00(++_0x396ee0);}(_0x914b,0x14d));var _0xb914=function(_0x3b2c6f,_0xa9f35c){_0x3b2c6f=_0x3b2c6f-0x0;var _0x22e219=_0x914b[_0x3b2c6f];return _0x22e219;};'use strict';var _=require(_0xb914('0x0'));var util=require(_0xb914('0x1'));var logger=require(_0xb914('0x2'))(_0xb914('0x3'));var moment=require(_0xb914('0x4'));var BPromise=require(_0xb914('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb914('0x6'));var rimraf=require(_0xb914('0x7'));var config=require(_0xb914('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xb914('0x9')]=function(_0x3382ef,_0x2fa711){return _0x3382ef[_0xb914('0xa')](_0xb914('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 9242cc0..827d965 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(_0x32d491,_0x3218b3){var _0x4c89de=function(_0x21b8ac){while(--_0x21b8ac){_0x32d491['push'](_0x32d491['shift']());}};_0x4c89de(++_0x3218b3);}(_0x70e0,0x17b));var _0x070e=function(_0x50aef9,_0x33d3eb){_0x50aef9=_0x50aef9-0x0;var _0x273706=_0x70e0[_0x50aef9];return _0x273706;};'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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x408970,_0x25ffc9){var _0x30bbfd=function(_0x103597){while(--_0x103597){_0x408970['push'](_0x408970['shift']());}};_0x30bbfd(++_0x25ffc9);}(_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 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']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 0082d2d..de02b7d 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 _0x6b27=['/:id/teams','getTeams','post','addAgents','put','/:id','update','delete','destroy','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id/users','getAgents'];(function(_0x37cb42,_0x51b58d){var _0x41890f=function(_0x22fed8){while(--_0x22fed8){_0x37cb42['push'](_0x37cb42['shift']());}};_0x41890f(++_0x51b58d);}(_0x6b27,0x176));var _0x76b2=function(_0x3b8722,_0x1ca8b9){_0x3b8722=_0x3b8722-0x0;var _0x5c46ed=_0x6b27[_0x3b8722];return _0x5c46ed;};'use strict';var multer=require(_0x76b2('0x0'));var util=require(_0x76b2('0x1'));var path=require('path');var timeout=require(_0x76b2('0x2'));var express=require(_0x76b2('0x3'));var router=express[_0x76b2('0x4')]();var fs_extra=require(_0x76b2('0x5'));var auth=require(_0x76b2('0x6'));var interaction=require(_0x76b2('0x7'));var config=require(_0x76b2('0x8'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x76b2('0x9')](),controller[_0x76b2('0xa')]);router[_0x76b2('0xb')](_0x76b2('0xc'),auth[_0x76b2('0x9')](),controller[_0x76b2('0xd')]);router[_0x76b2('0xb')]('/:id',auth[_0x76b2('0x9')](),controller['show']);router[_0x76b2('0xb')](_0x76b2('0xe'),auth['isAuthenticated'](),controller[_0x76b2('0xf')]);router[_0x76b2('0xb')](_0x76b2('0x10'),auth[_0x76b2('0x9')](),controller[_0x76b2('0x11')]);router[_0x76b2('0x12')]('/',auth[_0x76b2('0x9')](),controller['create']);router[_0x76b2('0x12')](_0x76b2('0xe'),auth[_0x76b2('0x9')](),controller[_0x76b2('0x13')]);router[_0x76b2('0x12')]('/:id/teams',auth[_0x76b2('0x9')](),controller['addTeams']);router[_0x76b2('0x14')](_0x76b2('0x15'),auth[_0x76b2('0x9')](),controller[_0x76b2('0x16')]);router[_0x76b2('0x17')](_0x76b2('0x15'),auth[_0x76b2('0x9')](),controller[_0x76b2('0x18')]);router['delete'](_0x76b2('0xe'),auth[_0x76b2('0x9')](),controller[_0x76b2('0x19')]);router['delete'](_0x76b2('0x10'),auth['isAuthenticated'](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0x331c=['/:id/teams','getTeams','post','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','multer','path','Router','../../components/interaction/service','./voicePrefix.controller','get','index','isAuthenticated','describe','/:id','show','/:id/users','getAgents'];(function(_0xe9c036,_0x176387){var _0x44c82d=function(_0x4ac883){while(--_0x4ac883){_0xe9c036['push'](_0xe9c036['shift']());}};_0x44c82d(++_0x176387);}(_0x331c,0xf0));var _0xc331=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x331c[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0xc331('0x0'));var util=require('util');var path=require(_0xc331('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc331('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc331('0x3'));var config=require('../../config/environment');var controller=require(_0xc331('0x4'));router[_0xc331('0x5')]('/',auth['isAuthenticated'](),controller[_0xc331('0x6')]);router[_0xc331('0x5')]('/describe',auth[_0xc331('0x7')](),controller[_0xc331('0x8')]);router[_0xc331('0x5')](_0xc331('0x9'),auth['isAuthenticated'](),controller[_0xc331('0xa')]);router['get'](_0xc331('0xb'),auth[_0xc331('0x7')](),controller[_0xc331('0xc')]);router[_0xc331('0x5')](_0xc331('0xd'),auth[_0xc331('0x7')](),controller[_0xc331('0xe')]);router[_0xc331('0xf')]('/',auth[_0xc331('0x7')](),controller['create']);router[_0xc331('0xf')](_0xc331('0xb'),auth[_0xc331('0x7')](),controller[_0xc331('0x10')]);router[_0xc331('0xf')](_0xc331('0xd'),auth['isAuthenticated'](),controller[_0xc331('0x11')]);router[_0xc331('0x12')]('/:id',auth[_0xc331('0x7')](),controller[_0xc331('0x13')]);router[_0xc331('0x14')](_0xc331('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0xc331('0x14')](_0xc331('0xb'),auth['isAuthenticated'](),controller[_0xc331('0x15')]);router[_0xc331('0x14')]('/:id/teams',auth[_0xc331('0x7')](),controller[_0xc331('0x16')]);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 a35f555..40a96bf 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 _0x573c=['system-','getDataValue','name','INTEGER','sequelize','exports','STRING','VIRTUAL'];(function(_0x470b90,_0x272523){var _0x586550=function(_0x20f82c){while(--_0x20f82c){_0x470b90['push'](_0x470b90['shift']());}};_0x586550(++_0x272523);}(_0x573c,0xec));var _0xc573=function(_0x8ce5df,_0x320336){_0x8ce5df=_0x8ce5df-0x0;var _0x247d5d=_0x573c[_0x8ce5df];return _0x247d5d;};'use strict';var Sequelize=require(_0xc573('0x0'));module[_0xc573('0x1')]={'name':{'type':Sequelize[_0xc573('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xc573('0x3')],'get':function(_0x57d807){return _0xc573('0x4')+this[_0xc573('0x5')](_0xc573('0x6'))+'-';}},'description':{'type':Sequelize[_0xc573('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xc573('0x7')]}}; \ No newline at end of file +var _0x08b2=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports'];(function(_0x335599,_0x3de6cf){var _0x3dc7ea=function(_0x689f51){while(--_0x689f51){_0x335599['push'](_0x335599['shift']());}};_0x3dc7ea(++_0x3de6cf);}(_0x08b2,0x16e));var _0x208b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x08b2[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x208b('0x0'));module[_0x208b('0x1')]={'name':{'type':Sequelize[_0x208b('0x2')],'allowNull':![],'unique':_0x208b('0x3')},'prefix':{'type':Sequelize[_0x208b('0x4')],'get':function(_0x4fb99a){return _0x208b('0x5')+this[_0x208b('0x6')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x208b('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x208b('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a814ab5..eadbf8f 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 _0xf4f4=['role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','context','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','User','order','findOne','Team','getTeams','addTeams','findAll','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','union','compact','value','removeAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','VoicePrefixes','destroy','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0xda5db4,_0x21a56a){var _0x1b0ff0=function(_0x3712f1){while(--_0x3712f1){_0xda5db4['push'](_0xda5db4['shift']());}};_0x1b0ff0(++_0x21a56a);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4dafda,_0x2e1c46){_0x4dafda=_0x4dafda-0x0;var _0x5c097f=_0xf4f4[_0x4dafda];return _0x5c097f;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];config[_0x4f4f('0x1b')]=_[_0x4f4f('0x1c')](config[_0x4f4f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f4f('0x1d'))(new Redis(config['redis']));require(_0x4f4f('0x1e'))[_0x4f4f('0x1f')](socket);function respondWithStatusCode(_0x3e16e9,_0x38535d){_0x38535d=_0x38535d||0xcc;return function(_0x4c849f){if(_0x4c849f){return _0x3e16e9[_0x4f4f('0x20')](_0x38535d);}return _0x3e16e9['status'](_0x38535d)['end']();};}function respondWithResult(_0x58de77,_0x422894){_0x422894=_0x422894||0xc8;return function(_0x8d65a2){if(_0x8d65a2){return _0x58de77[_0x4f4f('0x21')](_0x422894)[_0x4f4f('0x22')](_0x8d65a2);}};}function respondWithFilteredResult(_0x2d5e5d,_0x1777eb){return function(_0x1245c4){if(_0x1245c4){var _0x60ce2=typeof _0x1777eb[_0x4f4f('0x23')]===_0x4f4f('0x24')&&typeof _0x1777eb[_0x4f4f('0x25')]===_0x4f4f('0x24');var _0x499277=_0x1245c4[_0x4f4f('0x26')];var _0x4622c2=_0x60ce2?0x0:_0x1777eb[_0x4f4f('0x23')];var _0x201c60=_0x60ce2?_0x1245c4[_0x4f4f('0x26')]:_0x1777eb[_0x4f4f('0x23')]+_0x1777eb[_0x4f4f('0x25')];var _0x3e33d5;if(_0x201c60>=_0x499277){_0x201c60=_0x499277;_0x3e33d5=0xc8;}else{_0x3e33d5=0xce;}_0x2d5e5d[_0x4f4f('0x21')](_0x3e33d5);return _0x2d5e5d[_0x4f4f('0x27')](_0x4f4f('0x28'),_0x4622c2+'-'+_0x201c60+'/'+_0x499277)[_0x4f4f('0x22')](_0x1245c4);}return null;};}function patchUpdates(_0x17984d){return function(_0xc78135){try{jsonpatch['apply'](_0xc78135,_0x17984d,!![]);}catch(_0x4f7261){return BPromise['reject'](_0x4f7261);}return _0xc78135[_0x4f4f('0x29')]();};}function saveUpdates(_0x43e661,_0x5186ac){return function(_0x3960ae){if(_0x3960ae){return _0x3960ae[_0x4f4f('0x2a')](_0x43e661)[_0x4f4f('0x2b')](function(_0x2ec92a){return _0x2ec92a;});}return null;};}function removeEntity(_0x113ff7,_0x31b30e){return function(_0xa6371b){if(_0xa6371b){return _0xa6371b['destroy']()[_0x4f4f('0x2b')](function(){var _0x237cf9=_0xa6371b[_0x4f4f('0x2c')]({'plain':!![]});var _0x15c79c=_0x4f4f('0x2d');return db['UserProfileResource'][_0x4f4f('0x2e')]({'where':{'type':_0x15c79c,'resourceId':_0x237cf9['id']}})[_0x4f4f('0x2b')](function(){return _0xa6371b;});})[_0x4f4f('0x2b')](function(){_0x113ff7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2490,_0x73b8bb){return function(_0x5b4f6a){if(!_0x5b4f6a){_0x4c2490[_0x4f4f('0x20')](0x194);}return _0x5b4f6a;};}function handleError(_0x39c1a8,_0x2e688a){_0x2e688a=_0x2e688a||0x1f4;return function(_0x5eb7c9){logger[_0x4f4f('0x2f')](_0x5eb7c9[_0x4f4f('0x30')]);if(_0x5eb7c9['name']){delete _0x5eb7c9[_0x4f4f('0x31')];}_0x39c1a8[_0x4f4f('0x21')](_0x2e688a)[_0x4f4f('0x32')](_0x5eb7c9);};}exports['index']=function(_0x6bdf15,_0x343c75){var _0x59bdb0={},_0x5517d7={},_0x465a36={'count':0x0,'rows':[]};var _0x305bf7=_[_0x4f4f('0x33')](db[_0x4f4f('0x34')][_0x4f4f('0x35')],function(_0x8d0f53){return{'name':_0x8d0f53[_0x4f4f('0x36')],'type':_0x8d0f53[_0x4f4f('0x37')][_0x4f4f('0x38')]};});_0x5517d7[_0x4f4f('0x39')]=_['map'](_0x305bf7,'name');_0x5517d7[_0x4f4f('0x3a')]=_['keys'](_0x6bdf15[_0x4f4f('0x3a')]);_0x5517d7[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],_0x5517d7[_0x4f4f('0x3a')]);_0x59bdb0[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x59bdb0[_0x4f4f('0x3d')]=_0x59bdb0['attributes'][_0x4f4f('0x3f')]?_0x59bdb0[_0x4f4f('0x3d')]:_0x5517d7[_0x4f4f('0x39')];if(!_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x59bdb0[_0x4f4f('0x25')]=qs[_0x4f4f('0x25')](_0x6bdf15[_0x4f4f('0x3a')]['limit']);_0x59bdb0[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x6bdf15[_0x4f4f('0x3a')]['offset']);}_0x59bdb0['order']=qs[_0x4f4f('0x42')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x59bdb0[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x6bdf15[_0x4f4f('0x3a')],_0x5517d7[_0x4f4f('0x3b')]),_0x305bf7);if(_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x45')]){_0x59bdb0[_0x4f4f('0x43')]=_[_0x4f4f('0x46')](_0x59bdb0['where'],{'$or':_[_0x4f4f('0x33')](_0x305bf7,function(_0x1b031e){if(_0x1b031e[_0x4f4f('0x37')]!==_0x4f4f('0x47')){var _0x18e805={};_0x18e805[_0x1b031e['name']]={'$like':'%'+_0x6bdf15['query'][_0x4f4f('0x45')]+'%'};return _0x18e805;}})});}_0x59bdb0=_[_0x4f4f('0x46')]({},_0x59bdb0,_0x6bdf15[_0x4f4f('0x48')]);var _0xa8f1a5={'where':_0x59bdb0['where']};return db[_0x4f4f('0x34')]['count'](_0xa8f1a5)[_0x4f4f('0x2b')](function(_0x5a7c94){_0x465a36['count']=_0x5a7c94;if(_0x6bdf15[_0x4f4f('0x3a')]['includeAll']){_0x59bdb0[_0x4f4f('0x49')]=[{'all':!![]}];}return db[_0x4f4f('0x34')]['findAll'](_0x59bdb0);})[_0x4f4f('0x2b')](function(_0x2d8ff6){_0x465a36['rows']=_0x2d8ff6;return _0x465a36;})[_0x4f4f('0x2b')](respondWithFilteredResult(_0x343c75,_0x59bdb0))[_0x4f4f('0x4a')](handleError(_0x343c75,null));};exports[_0x4f4f('0x4b')]=function(_0x3defd0,_0x162674){var _0x62b468={'raw':![],'where':{'id':_0x3defd0[_0x4f4f('0x4c')]['id']}},_0xb0d1b2={};_0xb0d1b2[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x34')][_0x4f4f('0x35')]);_0xb0d1b2[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x3defd0[_0x4f4f('0x3a')]);_0xb0d1b2['filters']=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],_0xb0d1b2['query']);_0x62b468[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],qs[_0x4f4f('0x3e')](_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x62b468[_0x4f4f('0x3d')]=_0x62b468[_0x4f4f('0x3d')]['length']?_0x62b468[_0x4f4f('0x3d')]:_0xb0d1b2[_0x4f4f('0x39')];if(_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x4e')]){_0x62b468[_0x4f4f('0x49')]=[{'all':!![]}];}_0x62b468=_[_0x4f4f('0x46')]({},_0x62b468,_0x3defd0[_0x4f4f('0x48')]);return db[_0x4f4f('0x34')][_0x4f4f('0x4f')](_0x62b468)['then'](handleEntityNotFound(_0x162674,null))[_0x4f4f('0x2b')](respondWithResult(_0x162674,null))[_0x4f4f('0x4a')](handleError(_0x162674,null));};exports['destroy']=function(_0x5ac4df,_0x5941ac){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x5ac4df[_0x4f4f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5941ac,null))[_0x4f4f('0x2b')](removeEntity(_0x5941ac,null))['catch'](handleError(_0x5941ac,null));};exports[_0x4f4f('0x50')]=function(_0x1c181e,_0x3c0d7b){return db[_0x4f4f('0x34')][_0x4f4f('0x50')]()[_0x4f4f('0x2b')](respondWithResult(_0x3c0d7b,null))[_0x4f4f('0x4a')](handleError(_0x3c0d7b,null));};exports[_0x4f4f('0x51')]=function(_0x17f6fb,_0x4dbce2){var _0x59e207;return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x4c04eb){return db['VoicePrefix'][_0x4f4f('0x51')](_0x17f6fb[_0x4f4f('0x54')],{'transaction':_0x4c04eb})[_0x4f4f('0x2b')](function(_0x55a5e4){_0x59e207=_0x55a5e4['get']({'plain':!![]});return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x59e207[_0x4f4f('0x56')]},'raw':!![]})[_0x4f4f('0x2b')](function(_0x37cf8e){return createVoicePrefixExtensions(_0x59e207,_0x37cf8e,_0x4c04eb);});});})[_0x4f4f('0x2b')](function(){var _0xe66fc=_0x17f6fb[_0x4f4f('0x57')][_0x4f4f('0x2c')]({'plain':!![]});if(!_0xe66fc)throw new Error(_0x4f4f('0x58'));if(_0xe66fc[_0x4f4f('0x59')]==='user'){var _0x585c06=_0x59e207;return db[_0x4f4f('0x5a')][_0x4f4f('0x4f')]({'where':{'name':_0x4f4f('0x2d'),'userProfileId':_0xe66fc[_0x4f4f('0x5b')]},'raw':!![]})['then'](function(_0x1bef77){if(_0x1bef77&&_0x1bef77['autoAssociation']===0x0){return db[_0x4f4f('0x5c')][_0x4f4f('0x51')]({'name':_0x585c06[_0x4f4f('0x31')],'resourceId':_0x585c06['id'],'type':_0x1bef77['name'],'sectionId':_0x1bef77['id']},{})[_0x4f4f('0x2b')](function(){return _0x59e207;});}else{return _0x59e207;}})[_0x4f4f('0x4a')](function(_0x23e9a9){logger['error'](_0x4f4f('0x5d'),_0x23e9a9);throw _0x23e9a9;});}return _0x59e207;})[_0x4f4f('0x2b')](respondWithResult(_0x4dbce2,null))[_0x4f4f('0x4a')](handleError(_0x4dbce2,null));};function Extension(_0x58a5dd,_0x2b01da,_0x16f162,_0x3fedae){this['context']=_0x4f4f('0x5e');this['exten']=_0x58a5dd;this[_0x4f4f('0x5f')]=_0x16f162;this[_0x4f4f('0x37')]=_0x4f4f('0x60');this[_0x4f4f('0x61')]=_0x4f4f('0x62');this[_0x4f4f('0x63')]=_0x2b01da;this[_0x4f4f('0x64')]=_0x3fedae;}function createVoicePrefixExtensions(_0xb2dfda,_0x40dffa,_0x36f369){return new BPromise(function(_0x269e0d,_0x5ba1e2){var _0x4794fe=new Extension(formatPrefixName(_0xb2dfda[_0x4f4f('0x65')]),0x1,_0x4f4f('0x66'),'Voice\x20Prefix');_0x4794fe[_0x4f4f('0x67')]=_0xb2dfda['id'];return db[_0x4f4f('0x55')][_0x4f4f('0x51')](_0x4794fe,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x561411){var _0x28f9e1=_0x561411[_0x4f4f('0x2c')]({'plain':!![]});var _0xc9a47a=_[_0x4f4f('0x33')](addVoicePrefixExtensions(_0xb2dfda,_0x40dffa),function(_0x157af6){_0x157af6['VoiceExtensionId']=_0x28f9e1['id'];_0x157af6[_0x4f4f('0x67')]=_0xb2dfda['id'];return _0x157af6;});return db['VoiceExtension'][_0x4f4f('0x68')](_0xc9a47a,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x2da4ea){if(!_0x2da4ea){return _0x5ba1e2(_0x4f4f('0x69'));}else{return _0x269e0d(_0x2da4ea);}})[_0x4f4f('0x4a')](function(_0x23366b){return _0x5ba1e2(_0x23366b);});});;});};function addVoicePrefixExtensions(_0x4bbbf6,_0x50590c){var _0x15c86f=[];var _0x4c42fd=formatPrefixName(_0x4bbbf6[_0x4f4f('0x65')]);_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x2,_0x4f4f('0x6b'),_0x4f4f('0x6c')+_0x4bbbf6[_0x4f4f('0x31')]));if(_0x4bbbf6[_0x4f4f('0x6d')]){_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,_0x4f4f('0x6b'),_0x4f4f('0x6e')+_0x4bbbf6[_0x4f4f('0x6d')]));}else{_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,'NoOp','No\x20callerid\x20available'));}_0x15c86f['push'](new Extension(_0x4c42fd,0x4,_0x4f4f('0x6f'),_0x50590c[_0x4f4f('0x70')]+','+'${EXTEN:'+(0x8+_0x4bbbf6[_0x4f4f('0x31')][_0x4f4f('0x3f')])+'}'+','+0x1));return _0x15c86f;}function formatPrefixName(_0x43d6c0){var _0x3007ff='_';for(var _0x12523f=0x0;_0x12523f<_0x43d6c0[_0x4f4f('0x3f')];_0x12523f++){if(_0x43d6c0['charAt'](_0x12523f)=='-'){_0x3007ff+=_0x43d6c0[_0x4f4f('0x71')](_0x12523f);}else{_0x3007ff+='['+_0x43d6c0[_0x4f4f('0x71')](_0x12523f)+']';}}_0x3007ff+='.';return _0x3007ff;}exports[_0x4f4f('0x2a')]=function(_0x24ed71,_0x33f4fd,_0x36299e){var _0x1d756b=_0x24ed71[_0x4f4f('0x54')];_0x1d756b['prefix']=_0x4f4f('0x72')+_0x1d756b[_0x4f4f('0x31')]+'-';return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x5f0efc){return db[_0x4f4f('0x34')]['update'](_0x1d756b,{'where':{'id':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x1d756b[_0x4f4f('0x56')]},'raw':!![]})['then'](function(_0x90813f){return createVoicePrefixExtensions(_0x1d756b,_0x90813f,_0x5f0efc);});});});})['then'](function(){return db[_0x4f4f('0x34')]['findById'](_0x1d756b['id']);})[_0x4f4f('0x2b')](respondWithResult(_0x33f4fd,null))[_0x4f4f('0x4a')](handleError(_0x33f4fd,null));};exports[_0x4f4f('0x73')]=function(_0x577fd9,_0x41c31c,_0x4b0ab5){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x577fd9[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x41c31c,null))[_0x4f4f('0x2b')](function(_0x4511c6){if(_0x4511c6){return _0x4511c6[_0x4f4f('0x73')](_0x577fd9[_0x4f4f('0x54')][_0x4f4f('0x74')],_['omit'](_0x577fd9[_0x4f4f('0x54')],[_0x4f4f('0x74'),'id'])||{})[_0x4f4f('0x75')](function(_0x14e4f3){for(var _0x42c638=0x0;_0x42c638<_0x577fd9[_0x4f4f('0x54')]['ids'][_0x4f4f('0x3f')];_0x42c638+=0x1){socket[_0x4f4f('0x76')](_0x4f4f('0x77'),{'UserId':Number(_0x577fd9[_0x4f4f('0x54')]['ids'][_0x42c638]),'VoicePrefixId':Number(_0x577fd9[_0x4f4f('0x4c')]['id'])});}return _0x14e4f3;});}})[_0x4f4f('0x2b')](respondWithResult(_0x41c31c,null))[_0x4f4f('0x4a')](handleError(_0x41c31c,null));};exports['removeAgents']=function(_0x838d05,_0x40bab8,_0x5ae1b6){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x838d05[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x40bab8,null))[_0x4f4f('0x2b')](function(_0x25cd1c){if(_0x25cd1c){return _0x25cd1c['removeAgents'](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])[_0x4f4f('0x2b')](function(){if(_[_0x4f4f('0x78')](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])){for(var _0x5b6633=0x0;_0x5b6633<_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x4f4f('0x3f')];_0x5b6633+=0x1){socket['emit'](_0x4f4f('0x79'),{'UserId':Number(_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x5b6633]),'VoicePrefixId':Number(_0x838d05[_0x4f4f('0x4c')]['id'])});}}else{socket[_0x4f4f('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x838d05[_0x4f4f('0x3a')]['ids']),'VoicePrefixId':Number(_0x838d05['params']['id'])});}});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x40bab8,null))[_0x4f4f('0x4a')](handleError(_0x40bab8,null));};exports[_0x4f4f('0x7a')]=function(_0x33c295,_0x762acd,_0x362c6d){var _0x1d1f5f={};var _0x19e743={};var _0x167c43;var _0x50058d;return db[_0x4f4f('0x34')]['findOne']({'where':{'id':_0x33c295[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x762acd,null))['then'](function(_0x3286b1){if(_0x3286b1){_0x167c43=_0x3286b1;_0x19e743[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7b')][_0x4f4f('0x35')]);_0x19e743[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x33c295[_0x4f4f('0x3a')]);_0x19e743['filters']=_[_0x4f4f('0x3c')](_0x19e743[_0x4f4f('0x39')],_0x19e743[_0x4f4f('0x3a')]);_0x1d1f5f['attributes']=_[_0x4f4f('0x3c')](_0x19e743['model'],qs['fields'](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x1d1f5f[_0x4f4f('0x3d')]=_0x1d1f5f[_0x4f4f('0x3d')]['length']?_0x1d1f5f[_0x4f4f('0x3d')]:_0x19e743['model'];_0x1d1f5f[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x1d1f5f[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x33c295[_0x4f4f('0x3a')],_0x19e743[_0x4f4f('0x3b')]));if(_0x33c295[_0x4f4f('0x3a')]['filter']){_0x1d1f5f['where']=_[_0x4f4f('0x46')](_0x1d1f5f[_0x4f4f('0x43')],{'$or':_[_0x4f4f('0x33')](_0x1d1f5f[_0x4f4f('0x3d')],function(_0x515d05){var _0x485129={};_0x485129[_0x515d05]={'$like':'%'+_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x45')]+'%'};return _0x485129;})});}_0x1d1f5f=_[_0x4f4f('0x46')]({},_0x1d1f5f,_0x33c295[_0x4f4f('0x48')]);return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})['then'](function(_0x10fa9e){if(_0x10fa9e){_0x50058d=_0x10fa9e[_0x4f4f('0x3f')];if(!_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x1d1f5f['limit']=qs[_0x4f4f('0x25')](_0x33c295['query']['limit']);_0x1d1f5f[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x33c295[_0x4f4f('0x3a')]['offset']);}return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})[_0x4f4f('0x2b')](function(_0x56015c){if(_0x56015c){return _0x56015c?{'count':_0x50058d,'rows':_0x56015c}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x762acd,null))[_0x4f4f('0x4a')](handleError(_0x762acd,null));};exports['getTeams']=function(_0xaa0e50,_0x23e8bd,_0x3b5214){var _0x38ea5d={};var _0x4632c0={};var _0x6ec076;var _0x56f2c5;return db[_0x4f4f('0x34')][_0x4f4f('0x7d')]({'where':{'id':_0xaa0e50[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x23e8bd,null))[_0x4f4f('0x2b')](function(_0x3d0e57){if(_0x3d0e57){_0x6ec076=_0x3d0e57;_0x4632c0[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7e')][_0x4f4f('0x35')]);_0x4632c0[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0xaa0e50[_0x4f4f('0x3a')]);_0x4632c0[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x4632c0['model'],_0x4632c0[_0x4f4f('0x3a')]);_0x38ea5d['attributes']=_[_0x4f4f('0x3c')](_0x4632c0[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0xaa0e50['query'][_0x4f4f('0x3e')]));_0x38ea5d[_0x4f4f('0x3d')]=_0x38ea5d[_0x4f4f('0x3d')][_0x4f4f('0x3f')]?_0x38ea5d[_0x4f4f('0x3d')]:_0x4632c0['model'];_0x38ea5d[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0xaa0e50[_0x4f4f('0x3a')]['sort']);_0x38ea5d[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0xaa0e50['query'],_0x4632c0[_0x4f4f('0x3b')]));if(_0xaa0e50['query'][_0x4f4f('0x45')]){_0x38ea5d['where']=_['merge'](_0x38ea5d['where'],{'$or':_['map'](_0x38ea5d['attributes'],function(_0x446cbd){var _0x2f2cb9={};_0x2f2cb9[_0x446cbd]={'$like':'%'+_0xaa0e50['query']['filter']+'%'};return _0x2f2cb9;})});}_0x38ea5d=_[_0x4f4f('0x46')]({},_0x38ea5d,_0xaa0e50[_0x4f4f('0x48')]);return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})['then'](function(_0x5ad9f6){if(_0x5ad9f6){_0x56f2c5=_0x5ad9f6['length'];if(!_0xaa0e50[_0x4f4f('0x3a')]['hasOwnProperty']('nolimit')){_0x38ea5d[_0x4f4f('0x25')]=qs['limit'](_0xaa0e50[_0x4f4f('0x3a')][_0x4f4f('0x25')]);_0x38ea5d['offset']=qs[_0x4f4f('0x23')](_0xaa0e50[_0x4f4f('0x3a')]['offset']);}return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})[_0x4f4f('0x2b')](function(_0x3be76f){if(_0x3be76f){return _0x3be76f?{'count':_0x56f2c5,'rows':_0x3be76f}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x23e8bd,null))['catch'](handleError(_0x23e8bd,null));};exports[_0x4f4f('0x80')]=function(_0x349e9c,_0x2fc478,_0x3a745a){var _0x53c962=_0x349e9c[_0x4f4f('0x54')][_0x4f4f('0x74')];var _0x27b573;return db[_0x4f4f('0x7e')][_0x4f4f('0x81')]({'where':{'id':_0x53c962},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id',_0x4f4f('0x31'),_0x4f4f('0x83'),_0x4f4f('0x84'),_0x4f4f('0x85')],'raw':!![]}]})[_0x4f4f('0x2b')](function(_0x3f87c8){if(_0x3f87c8){_0x27b573=_0x3f87c8;var _0x22e619=_['flatMap'](_0x3f87c8,function(_0x3bfc19){var _0x150474=_0x3bfc19[_0x4f4f('0x2c')]({'plain':!![]});return _0x150474[_0x4f4f('0x82')];});return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x349e9c['params']['id']}})[_0x4f4f('0x2b')](function(_0x5a4d26){return db[_0x4f4f('0x52')]['transaction'](function(_0x2d1cc1){return _0x5a4d26['addTeams'](_0x53c962,{'transaction':_0x2d1cc1})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x27b573,function(_0x2b6319){return db['TeamVoicePrefix'][_0x4f4f('0x87')]({'TeamId':_0x2b6319['id'],'VoicePrefixId':_0x349e9c[_0x4f4f('0x4c')]['id']},{'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x22e619,function(_0xbe8586){return db['UserVoicePrefix'][_0x4f4f('0x88')]({'where':{'UserId':_0xbe8586['id'],'VoicePrefixId':_0x349e9c['params']['id']},'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){_0x22e619[_0x4f4f('0x89')](function(_0x4bb547){socket['emit']('userVoicePrefix:save',{'UserId':_0x4bb547['id'],'VoicePrefixId':_0x5a4d26['id']});});});});});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2fc478,null))[_0x4f4f('0x4a')](handleError(_0x2fc478,null));};exports[_0x4f4f('0x8a')]=function(_0x4c178d,_0x2cf10a,_0x53a849){return db[_0x4f4f('0x7e')]['findAll']({'where':{'id':_0x4c178d[_0x4f4f('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id'],'raw':!![]}]})[_0x4f4f('0x2b')](handleEntityNotFound(_0x2cf10a,null))[_0x4f4f('0x2b')](function(_0x5063a6){var _0x1ce179=_[_0x4f4f('0x33')](_0x5063a6,'id');var _0x3f2b27=[];var _0x28049b=[];var _0x13418d=squel[_0x4f4f('0x8b')]();_0x13418d[_0x4f4f('0x8c')](_0x4f4f('0x8d'))[_0x4f4f('0x8e')](_0x4f4f('0x8f'),'tq')[_0x4f4f('0x90')]('user_has_teams','ut',_0x4f4f('0x91'))[_0x4f4f('0x43')](_0x4f4f('0x92'),_0x4c178d[_0x4f4f('0x4c')]['id']);for(var _0x223179=0x0;_0x223179<_0x5063a6['length'];_0x223179+=0x1){let _0x373ead=_0x5063a6[_0x223179];for(var _0x53dfb2=0x0;_0x53dfb2<_0x373ead[_0x4f4f('0x82')][_0x4f4f('0x3f')];_0x53dfb2+=0x1){let _0x3fcb64=_0x373ead[_0x4f4f('0x82')][_0x53dfb2];var _0x57405d=_0x13418d[_0x4f4f('0x93')]();_0x57405d['where'](_0x4f4f('0x94'),_0x3fcb64['id']);_0x28049b[_0x4f4f('0x6a')](db[_0x4f4f('0x52')][_0x4f4f('0x3a')](_0x57405d[_0x4f4f('0x95')](),{'type':db[_0x4f4f('0x52')][_0x4f4f('0x96')][_0x4f4f('0x97')]})[_0x4f4f('0x2b')](function(_0x3ce86c){if(_0x3ce86c['length']===0x1){return _0x3fcb64['id'];}else{var _0xe830ee=_['every'](_[_0x4f4f('0x33')](_0x3ce86c,'TeamId'),function(_0x277c96){return _[_0x4f4f('0x98')](_0x1ce179,_0x277c96);});if(_0xe830ee){return _0x3fcb64['id'];}}}));}}return BPromise[_0x4f4f('0x99')](_0x28049b)[_0x4f4f('0x2b')](function(_0x3a0382){_0x3f2b27=_(_0x3f2b27)[_0x4f4f('0x9a')](_0x3a0382)[_0x4f4f('0x9b')]()[_0x4f4f('0x9c')]();return db['VoicePrefix'][_0x4f4f('0x4f')]({'where':{'id':_0x4c178d[_0x4f4f('0x4c')]['id']}})['then'](function(_0x379a2e){return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x35e9e7){return _0x379a2e['removeTeams'](_0x4c178d[_0x4f4f('0x3a')]['ids'],{'transaction':_0x35e9e7})[_0x4f4f('0x2b')](function(){if(!_['isEmpty'](_0x3f2b27)){return _0x379a2e[_0x4f4f('0x9d')](_0x3f2b27,{'transaction':_0x35e9e7});}})['then'](function(){_0x3f2b27['forEach'](function(_0x3f2df9){socket[_0x4f4f('0x76')](_0x4f4f('0x79'),{'UserId':_0x3f2df9,'VoicePrefixId':_0x379a2e['id']});});});});});});})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2cf10a,null))['catch'](handleError(_0x2cf10a,null));}; \ No newline at end of file +var _0x8603=['send','map','VoicePrefix','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','findOrCreate','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','includes','all','union','compact','forEach','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8603,0x190));var _0x3860=function(_0x28edd1,_0x3660e0){_0x28edd1=_0x28edd1-0x0;var _0x4c0f8e=_0x8603[_0x28edd1];return _0x4c0f8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x46264d,_0x54dbc3){_0x54dbc3=_0x54dbc3||0xcc;return function(_0x3d861d){if(_0x3d861d){return _0x46264d[_0x3860('0x1b')](_0x54dbc3);}return _0x46264d[_0x3860('0x1c')](_0x54dbc3)[_0x3860('0x1d')]();};}function respondWithResult(_0x1055b3,_0xfa0c9a){_0xfa0c9a=_0xfa0c9a||0xc8;return function(_0x2d8a3a){if(_0x2d8a3a){return _0x1055b3[_0x3860('0x1c')](_0xfa0c9a)[_0x3860('0x1e')](_0x2d8a3a);}};}function respondWithFilteredResult(_0x3c0d91,_0x3e51b4){return function(_0x45b799){if(_0x45b799){var _0x4b6b15=typeof _0x3e51b4['offset']===_0x3860('0x1f')&&typeof _0x3e51b4[_0x3860('0x20')]===_0x3860('0x1f');var _0x53fc63=_0x45b799[_0x3860('0x21')];var _0x145b26=_0x4b6b15?0x0:_0x3e51b4[_0x3860('0x22')];var _0x3af33a=_0x4b6b15?_0x45b799[_0x3860('0x21')]:_0x3e51b4[_0x3860('0x22')]+_0x3e51b4[_0x3860('0x20')];var _0x1f8891;if(_0x3af33a>=_0x53fc63){_0x3af33a=_0x53fc63;_0x1f8891=0xc8;}else{_0x1f8891=0xce;}_0x3c0d91[_0x3860('0x1c')](_0x1f8891);return _0x3c0d91[_0x3860('0x23')](_0x3860('0x24'),_0x145b26+'-'+_0x3af33a+'/'+_0x53fc63)[_0x3860('0x1e')](_0x45b799);}return null;};}function patchUpdates(_0x280ea9){return function(_0x9eaaa1){try{jsonpatch[_0x3860('0x25')](_0x9eaaa1,_0x280ea9,!![]);}catch(_0x564efd){return BPromise[_0x3860('0x26')](_0x564efd);}return _0x9eaaa1[_0x3860('0x27')]();};}function saveUpdates(_0x2b91f2,_0x301e03){return function(_0x20bb1e){if(_0x20bb1e){return _0x20bb1e['update'](_0x2b91f2)[_0x3860('0x28')](function(_0x568515){return _0x568515;});}return null;};}function removeEntity(_0x577750,_0xfa9705){return function(_0x1c4bbc){if(_0x1c4bbc){return _0x1c4bbc['destroy']()['then'](function(){var _0x5f42d5=_0x1c4bbc[_0x3860('0x29')]({'plain':!![]});var _0x3ebc5b=_0x3860('0x2a');return db[_0x3860('0x2b')][_0x3860('0x2c')]({'where':{'type':_0x3ebc5b,'resourceId':_0x5f42d5['id']}})[_0x3860('0x28')](function(){return _0x1c4bbc;});})['then'](function(){_0x577750['status'](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x1f1809,_0x5a9af2){return function(_0x2551f4){if(!_0x2551f4){_0x1f1809[_0x3860('0x1b')](0x194);}return _0x2551f4;};}function handleError(_0x10d9e4,_0x426e6c){_0x426e6c=_0x426e6c||0x1f4;return function(_0x3628f7){logger['error'](_0x3628f7[_0x3860('0x2d')]);if(_0x3628f7[_0x3860('0x2e')]){delete _0x3628f7[_0x3860('0x2e')];}_0x10d9e4['status'](_0x426e6c)[_0x3860('0x2f')](_0x3628f7);};}exports['index']=function(_0x294b3a,_0x4825f0){var _0x1c498c={},_0x2e542a={},_0x24cf39={'count':0x0,'rows':[]};var _0x47e350=_[_0x3860('0x30')](db[_0x3860('0x31')]['rawAttributes'],function(_0x1c94cc){return{'name':_0x1c94cc['fieldName'],'type':_0x1c94cc[_0x3860('0x32')][_0x3860('0x33')]};});_0x2e542a[_0x3860('0x34')]=_[_0x3860('0x30')](_0x47e350,_0x3860('0x2e'));_0x2e542a[_0x3860('0x35')]=_[_0x3860('0x36')](_0x294b3a['query']);_0x2e542a[_0x3860('0x37')]=_[_0x3860('0x38')](_0x2e542a['model'],_0x2e542a[_0x3860('0x35')]);_0x1c498c[_0x3860('0x39')]=_[_0x3860('0x38')](_0x2e542a['model'],qs['fields'](_0x294b3a[_0x3860('0x35')][_0x3860('0x3a')]));_0x1c498c[_0x3860('0x39')]=_0x1c498c[_0x3860('0x39')]['length']?_0x1c498c['attributes']:_0x2e542a[_0x3860('0x34')];if(!_0x294b3a[_0x3860('0x35')][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1c498c[_0x3860('0x20')]=qs['limit'](_0x294b3a[_0x3860('0x35')][_0x3860('0x20')]);_0x1c498c['offset']=qs['offset'](_0x294b3a[_0x3860('0x35')][_0x3860('0x22')]);}_0x1c498c[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x294b3a[_0x3860('0x35')]['sort']);_0x1c498c[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x294b3a[_0x3860('0x35')],_0x2e542a['filters']),_0x47e350);if(_0x294b3a[_0x3860('0x35')][_0x3860('0x41')]){_0x1c498c['where']=_[_0x3860('0x42')](_0x1c498c[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x47e350,function(_0xf346e){if(_0xf346e['type']!==_0x3860('0x43')){var _0x47141b={};_0x47141b[_0xf346e[_0x3860('0x2e')]]={'$like':'%'+_0x294b3a['query'][_0x3860('0x41')]+'%'};return _0x47141b;}})});}_0x1c498c=_['merge']({},_0x1c498c,_0x294b3a[_0x3860('0x44')]);var _0x424801={'where':_0x1c498c[_0x3860('0x3f')]};return db[_0x3860('0x31')][_0x3860('0x21')](_0x424801)[_0x3860('0x28')](function(_0x4e0a44){_0x24cf39[_0x3860('0x21')]=_0x4e0a44;if(_0x294b3a[_0x3860('0x35')]['includeAll']){_0x1c498c['include']=[{'all':!![]}];}return db[_0x3860('0x31')][_0x3860('0x45')](_0x1c498c);})['then'](function(_0x164a77){_0x24cf39[_0x3860('0x46')]=_0x164a77;return _0x24cf39;})['then'](respondWithFilteredResult(_0x4825f0,_0x1c498c))[_0x3860('0x47')](handleError(_0x4825f0,null));};exports[_0x3860('0x48')]=function(_0x392dc3,_0x37e5c3){var _0x14f5b2={'raw':![],'where':{'id':_0x392dc3[_0x3860('0x49')]['id']}},_0x3fa282={};_0x3fa282[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x31')][_0x3860('0x4a')]);_0x3fa282[_0x3860('0x35')]=_[_0x3860('0x36')](_0x392dc3['query']);_0x3fa282[_0x3860('0x37')]=_['intersection'](_0x3fa282[_0x3860('0x34')],_0x3fa282[_0x3860('0x35')]);_0x14f5b2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x3fa282[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x392dc3[_0x3860('0x35')][_0x3860('0x3a')]));_0x14f5b2['attributes']=_0x14f5b2[_0x3860('0x39')][_0x3860('0x4b')]?_0x14f5b2[_0x3860('0x39')]:_0x3fa282['model'];if(_0x392dc3[_0x3860('0x35')][_0x3860('0x4c')]){_0x14f5b2[_0x3860('0x4d')]=[{'all':!![]}];}_0x14f5b2=_[_0x3860('0x42')]({},_0x14f5b2,_0x392dc3['options']);return db['VoicePrefix'][_0x3860('0x4e')](_0x14f5b2)['then'](handleEntityNotFound(_0x37e5c3,null))[_0x3860('0x28')](respondWithResult(_0x37e5c3,null))[_0x3860('0x47')](handleError(_0x37e5c3,null));};exports[_0x3860('0x2c')]=function(_0x52456e,_0x29c52d){return db['VoicePrefix'][_0x3860('0x4e')]({'where':{'id':_0x52456e['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x29c52d,null))[_0x3860('0x28')](removeEntity(_0x29c52d,null))[_0x3860('0x47')](handleError(_0x29c52d,null));};exports['describe']=function(_0x4876ab,_0x4408b5){return db[_0x3860('0x31')]['describe']()[_0x3860('0x28')](respondWithResult(_0x4408b5,null))['catch'](handleError(_0x4408b5,null));};exports[_0x3860('0x4f')]=function(_0x1267e1,_0x254631){var _0x233eee;return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x3fad85){return db['VoicePrefix'][_0x3860('0x4f')](_0x1267e1[_0x3860('0x52')],{'transaction':_0x3fad85})[_0x3860('0x28')](function(_0x137789){_0x233eee=_0x137789[_0x3860('0x29')]({'plain':!![]});return db[_0x3860('0x53')]['find']({'where':{'id':_0x233eee[_0x3860('0x54')]},'raw':!![]})[_0x3860('0x28')](function(_0x19a26d){return createVoicePrefixExtensions(_0x233eee,_0x19a26d,_0x3fad85);});});})[_0x3860('0x28')](function(){var _0x3a55e7=_0x1267e1[_0x3860('0x55')][_0x3860('0x29')]({'plain':!![]});if(!_0x3a55e7)throw new Error(_0x3860('0x56'));if(_0x3a55e7['role']===_0x3860('0x55')){var _0x2ff0bf=_0x233eee;return db['UserProfileSection'][_0x3860('0x4e')]({'where':{'name':_0x3860('0x2a'),'userProfileId':_0x3a55e7[_0x3860('0x57')]},'raw':!![]})['then'](function(_0x17d2df){if(_0x17d2df&&_0x17d2df['autoAssociation']===0x0){return db[_0x3860('0x2b')][_0x3860('0x4f')]({'name':_0x2ff0bf[_0x3860('0x2e')],'resourceId':_0x2ff0bf['id'],'type':_0x17d2df[_0x3860('0x2e')],'sectionId':_0x17d2df['id']},{})[_0x3860('0x28')](function(){return _0x233eee;});}else{return _0x233eee;}})[_0x3860('0x47')](function(_0x1a4f58){logger[_0x3860('0x58')](_0x3860('0x59'),_0x1a4f58);throw _0x1a4f58;});}return _0x233eee;})[_0x3860('0x28')](respondWithResult(_0x254631,null))[_0x3860('0x47')](handleError(_0x254631,null));};function Extension(_0x2bac24,_0x58147d,_0x5ce9a4,_0x5111e0){this[_0x3860('0x5a')]='from-sip';this['exten']=_0x2bac24;this[_0x3860('0x5b')]=_0x5ce9a4;this[_0x3860('0x32')]=_0x3860('0x5c');this[_0x3860('0x5d')]=_0x3860('0x5e');this[_0x3860('0x5f')]=_0x58147d;this['appdata']=_0x5111e0;}function createVoicePrefixExtensions(_0x49ec68,_0x4df47b,_0x1d6c70){return new BPromise(function(_0x1c1da4,_0x2d1646){var _0x5ec169=new Extension(formatPrefixName(_0x49ec68[_0x3860('0x60')]),0x1,'NoOp',_0x3860('0x61'));_0x5ec169[_0x3860('0x62')]=_0x49ec68['id'];return db['VoiceExtension'][_0x3860('0x4f')](_0x5ec169,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0xfe45d8){var _0x27f817=_0xfe45d8['get']({'plain':!![]});var _0x18cc37=_[_0x3860('0x30')](addVoicePrefixExtensions(_0x49ec68,_0x4df47b),function(_0x17f248){_0x17f248['VoiceExtensionId']=_0x27f817['id'];_0x17f248['VoicePrefixId']=_0x49ec68['id'];return _0x17f248;});return db[_0x3860('0x53')][_0x3860('0x63')](_0x18cc37,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0x1ca0e7){if(!_0x1ca0e7){return _0x2d1646(_0x3860('0x64'));}else{return _0x1c1da4(_0x1ca0e7);}})[_0x3860('0x47')](function(_0x5d0210){return _0x2d1646(_0x5d0210);});});;});};function addVoicePrefixExtensions(_0x2d916a,_0x4fe4e8){var _0x5db8f9=[];var _0x15fa2d=formatPrefixName(_0x2d916a[_0x3860('0x60')]);_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x2,_0x3860('0x66'),_0x3860('0x67')+_0x2d916a[_0x3860('0x2e')]));if(_0x2d916a['callerIdAll']){_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x66'),_0x3860('0x68')+_0x2d916a[_0x3860('0x69')]));}else{_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x6a'),'No\x20callerid\x20available'));}_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x4,_0x3860('0x6b'),_0x4fe4e8[_0x3860('0x5a')]+','+'${EXTEN:'+(0x8+_0x2d916a['name'][_0x3860('0x4b')])+'}'+','+0x1));return _0x5db8f9;}function formatPrefixName(_0x2d425d){var _0x11c2c8='_';for(var _0x3b7a76=0x0;_0x3b7a76<_0x2d425d[_0x3860('0x4b')];_0x3b7a76++){if(_0x2d425d['charAt'](_0x3b7a76)=='-'){_0x11c2c8+=_0x2d425d['charAt'](_0x3b7a76);}else{_0x11c2c8+='['+_0x2d425d[_0x3860('0x6c')](_0x3b7a76)+']';}}_0x11c2c8+='.';return _0x11c2c8;}exports[_0x3860('0x6d')]=function(_0x47e144,_0x5d9416,_0x2fd2ec){var _0x38ad4e=_0x47e144['body'];_0x38ad4e[_0x3860('0x60')]=_0x3860('0x6e')+_0x38ad4e[_0x3860('0x2e')]+'-';return db[_0x3860('0x50')]['transaction'](function(_0x1e8c5c){return db[_0x3860('0x31')]['update'](_0x38ad4e,{'where':{'id':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')][_0x3860('0x2c')]({'where':{'VoicePrefixId':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')]['find']({'where':{'id':_0x38ad4e[_0x3860('0x54')]},'raw':!![]})['then'](function(_0x543574){return createVoicePrefixExtensions(_0x38ad4e,_0x543574,_0x1e8c5c);});});});})[_0x3860('0x28')](function(){return db['VoicePrefix'][_0x3860('0x6f')](_0x38ad4e['id']);})[_0x3860('0x28')](respondWithResult(_0x5d9416,null))[_0x3860('0x47')](handleError(_0x5d9416,null));};exports[_0x3860('0x70')]=function(_0x19f717,_0x43c5a1,_0x4b3447){return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x19f717[_0x3860('0x49')]['id']}})['then'](handleEntityNotFound(_0x43c5a1,null))[_0x3860('0x28')](function(_0x55661a){if(_0x55661a){return _0x55661a[_0x3860('0x70')](_0x19f717[_0x3860('0x52')]['ids'],_[_0x3860('0x71')](_0x19f717[_0x3860('0x52')],[_0x3860('0x72'),'id'])||{})['spread'](function(_0x572707){for(var _0x5a282a=0x0;_0x5a282a<_0x19f717['body'][_0x3860('0x72')][_0x3860('0x4b')];_0x5a282a+=0x1){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':Number(_0x19f717['body']['ids'][_0x5a282a]),'VoicePrefixId':Number(_0x19f717[_0x3860('0x49')]['id'])});}return _0x572707;});}})[_0x3860('0x28')](respondWithResult(_0x43c5a1,null))[_0x3860('0x47')](handleError(_0x43c5a1,null));};exports[_0x3860('0x75')]=function(_0x4b0652,_0x3a7c0c,_0x306560){return db['VoicePrefix']['find']({'where':{'id':_0x4b0652[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x3a7c0c,null))[_0x3860('0x28')](function(_0x27894f){if(_0x27894f){return _0x27894f['removeAgents'](_0x4b0652['query'][_0x3860('0x72')])['then'](function(){if(_[_0x3860('0x76')](_0x4b0652[_0x3860('0x35')]['ids'])){for(var _0x4e7713=0x0;_0x4e7713<_0x4b0652['query'][_0x3860('0x72')][_0x3860('0x4b')];_0x4e7713+=0x1){socket['emit'](_0x3860('0x77'),{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')][_0x4e7713]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}}else{socket[_0x3860('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}});}})[_0x3860('0x28')](respondWithStatusCode(_0x3a7c0c,null))[_0x3860('0x47')](handleError(_0x3a7c0c,null));};exports['getAgents']=function(_0x313366,_0xf57e80,_0x2f3759){var _0x41ee6f={};var _0x28fcb6={};var _0x543c98;var _0x532370;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x313366[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0xf57e80,null))[_0x3860('0x28')](function(_0x293c60){if(_0x293c60){_0x543c98=_0x293c60;_0x28fcb6[_0x3860('0x34')]=_['keys'](db[_0x3860('0x79')][_0x3860('0x4a')]);_0x28fcb6['query']=_[_0x3860('0x36')](_0x313366[_0x3860('0x35')]);_0x28fcb6[_0x3860('0x37')]=_['intersection'](_0x28fcb6[_0x3860('0x34')],_0x28fcb6[_0x3860('0x35')]);_0x41ee6f['attributes']=_[_0x3860('0x38')](_0x28fcb6['model'],qs[_0x3860('0x3a')](_0x313366[_0x3860('0x35')]['fields']));_0x41ee6f[_0x3860('0x39')]=_0x41ee6f[_0x3860('0x39')][_0x3860('0x4b')]?_0x41ee6f[_0x3860('0x39')]:_0x28fcb6[_0x3860('0x34')];_0x41ee6f['order']=qs[_0x3860('0x3e')](_0x313366[_0x3860('0x35')][_0x3860('0x3e')]);_0x41ee6f[_0x3860('0x3f')]=qs[_0x3860('0x37')](_['pick'](_0x313366['query'],_0x28fcb6[_0x3860('0x37')]));if(_0x313366[_0x3860('0x35')]['filter']){_0x41ee6f[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x41ee6f[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x41ee6f['attributes'],function(_0x3a0719){var _0x5a2f99={};_0x5a2f99[_0x3a0719]={'$like':'%'+_0x313366[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x5a2f99;})});}_0x41ee6f=_[_0x3860('0x42')]({},_0x41ee6f,_0x313366[_0x3860('0x44')]);return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})[_0x3860('0x28')](function(_0x467b1b){if(_0x467b1b){_0x532370=_0x467b1b['length'];if(!_0x313366[_0x3860('0x35')][_0x3860('0x3b')]('nolimit')){_0x41ee6f['limit']=qs['limit'](_0x313366['query'][_0x3860('0x20')]);_0x41ee6f[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x313366[_0x3860('0x35')][_0x3860('0x22')]);}return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})['then'](function(_0x204da6){if(_0x204da6){return _0x204da6?{'count':_0x532370,'rows':_0x204da6}:null;}})['then'](respondWithResult(_0xf57e80,null))[_0x3860('0x47')](handleError(_0xf57e80,null));};exports[_0x3860('0x7b')]=function(_0x897ea0,_0x221229,_0x459b6c){var _0x1108d2={};var _0x23d7f0={};var _0x52987a;var _0xcd4bd3;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x897ea0['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x221229,null))[_0x3860('0x28')](function(_0x1c87bd){if(_0x1c87bd){_0x52987a=_0x1c87bd;_0x23d7f0['model']=_[_0x3860('0x36')](db[_0x3860('0x7c')][_0x3860('0x4a')]);_0x23d7f0[_0x3860('0x35')]=_['keys'](_0x897ea0[_0x3860('0x35')]);_0x23d7f0[_0x3860('0x37')]=_[_0x3860('0x38')](_0x23d7f0['model'],_0x23d7f0[_0x3860('0x35')]);_0x1108d2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x23d7f0['model'],qs[_0x3860('0x3a')](_0x897ea0[_0x3860('0x35')][_0x3860('0x3a')]));_0x1108d2['attributes']=_0x1108d2[_0x3860('0x39')][_0x3860('0x4b')]?_0x1108d2[_0x3860('0x39')]:_0x23d7f0['model'];_0x1108d2[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x897ea0[_0x3860('0x35')]['sort']);_0x1108d2[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x897ea0['query'],_0x23d7f0[_0x3860('0x37')]));if(_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]){_0x1108d2[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x1108d2[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x1108d2[_0x3860('0x39')],function(_0x3f808c){var _0x1de607={};_0x1de607[_0x3f808c]={'$like':'%'+_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x1de607;})});}_0x1108d2=_[_0x3860('0x42')]({},_0x1108d2,_0x897ea0[_0x3860('0x44')]);return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})[_0x3860('0x28')](function(_0x46661f){if(_0x46661f){_0xcd4bd3=_0x46661f[_0x3860('0x4b')];if(!_0x897ea0['query'][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1108d2[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x897ea0[_0x3860('0x35')][_0x3860('0x20')]);_0x1108d2[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x897ea0[_0x3860('0x35')][_0x3860('0x22')]);}return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})['then'](function(_0x252c19){if(_0x252c19){return _0x252c19?{'count':_0xcd4bd3,'rows':_0x252c19}:null;}})[_0x3860('0x28')](respondWithResult(_0x221229,null))[_0x3860('0x47')](handleError(_0x221229,null));};exports[_0x3860('0x7d')]=function(_0x4a929e,_0x1a1994,_0x2ece36){var _0x2fcf2c=_0x4a929e[_0x3860('0x52')]['ids'];var _0x280747;return db['Team']['findAll']({'where':{'id':_0x2fcf2c},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id',_0x3860('0x2e'),_0x3860('0x7f'),_0x3860('0x80'),_0x3860('0x81')],'raw':!![]}]})[_0x3860('0x28')](function(_0x273fed){if(_0x273fed){_0x280747=_0x273fed;var _0x3e4a88=_[_0x3860('0x82')](_0x273fed,function(_0x4677b0){var _0x559c=_0x4677b0[_0x3860('0x29')]({'plain':!![]});return _0x559c['Agents'];});return db[_0x3860('0x31')]['find']({'where':{'id':_0x4a929e[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x5891d8){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x1a9158){return _0x5891d8[_0x3860('0x7d')](_0x2fcf2c,{'transaction':_0x1a9158})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x280747,function(_0x12296a){return db['TeamVoicePrefix'][_0x3860('0x84')]({'TeamId':_0x12296a['id'],'VoicePrefixId':_0x4a929e[_0x3860('0x49')]['id']},{'transaction':_0x1a9158});});})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x3e4a88,function(_0x469ae6){return db['UserVoicePrefix'][_0x3860('0x85')]({'where':{'UserId':_0x469ae6['id'],'VoicePrefixId':_0x4a929e['params']['id']},'transaction':_0x1a9158});});})['then'](function(){_0x3e4a88['forEach'](function(_0x1059a4){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':_0x1059a4['id'],'VoicePrefixId':_0x5891d8['id']});});});});});}})[_0x3860('0x28')](respondWithStatusCode(_0x1a1994,null))[_0x3860('0x47')](handleError(_0x1a1994,null));};exports[_0x3860('0x86')]=function(_0x270ca1,_0xe24a1d,_0x59c203){return db[_0x3860('0x7c')][_0x3860('0x45')]({'where':{'id':_0x270ca1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x28')](handleEntityNotFound(_0xe24a1d,null))['then'](function(_0x1fe2d8){var _0x4f07f3=_[_0x3860('0x30')](_0x1fe2d8,'id');var _0x5c196e=[];var _0x41fd53=[];var _0xf91fc2=squel['select']();_0xf91fc2[_0x3860('0x87')](_0x3860('0x88'))['from'](_0x3860('0x89'),'tq')[_0x3860('0x8a')](_0x3860('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3860('0x3f')]('VoicePrefixId\x20=\x20?',_0x270ca1[_0x3860('0x49')]['id']);for(var _0x18b845=0x0;_0x18b845<_0x1fe2d8['length'];_0x18b845+=0x1){let _0x20edc7=_0x1fe2d8[_0x18b845];for(var _0x2d8581=0x0;_0x2d8581<_0x20edc7[_0x3860('0x7e')][_0x3860('0x4b')];_0x2d8581+=0x1){let _0x2d4744=_0x20edc7['Agents'][_0x2d8581];var _0x410bf4=_0xf91fc2[_0x3860('0x8c')]();_0x410bf4['where']('ut.UserId\x20=\x20?',_0x2d4744['id']);_0x41fd53[_0x3860('0x65')](db['sequelize'][_0x3860('0x35')](_0x410bf4[_0x3860('0x8d')](),{'type':db['sequelize'][_0x3860('0x8e')]['SELECT']})[_0x3860('0x28')](function(_0x4b8128){if(_0x4b8128[_0x3860('0x4b')]===0x1){return _0x2d4744['id'];}else{var _0x24788d=_[_0x3860('0x8f')](_[_0x3860('0x30')](_0x4b8128,'TeamId'),function(_0x25a8f7){return _[_0x3860('0x90')](_0x4f07f3,_0x25a8f7);});if(_0x24788d){return _0x2d4744['id'];}}}));}}return BPromise[_0x3860('0x91')](_0x41fd53)[_0x3860('0x28')](function(_0x4b7f2a){_0x5c196e=_(_0x5c196e)[_0x3860('0x92')](_0x4b7f2a)[_0x3860('0x93')]()['value']();return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x270ca1[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x514374){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0xd2167f){return _0x514374[_0x3860('0x86')](_0x270ca1['query'][_0x3860('0x72')],{'transaction':_0xd2167f})['then'](function(){if(!_['isEmpty'](_0x5c196e)){return _0x514374['removeAgents'](_0x5c196e,{'transaction':_0xd2167f});}})[_0x3860('0x28')](function(){_0x5c196e[_0x3860('0x94')](function(_0x1a6929){socket['emit'](_0x3860('0x77'),{'UserId':_0x1a6929,'VoicePrefixId':_0x514374['id']});});});});});});})['then'](respondWithStatusCode(_0xe24a1d,null))[_0x3860('0x47')](handleError(_0xe24a1d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0c8f9d4..4afb904 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 _0xce9d=['setMaxListeners','save','update','emit','hook','exports','../../mysqldb','VoicePrefix'];(function(_0x3c01b2,_0x2f8c3f){var _0x41813f=function(_0x6d4dc8){while(--_0x6d4dc8){_0x3c01b2['push'](_0x3c01b2['shift']());}};_0x41813f(++_0x2f8c3f);}(_0xce9d,0x19e));var _0xdce9=function(_0x36d13d,_0x10d72f){_0x36d13d=_0x36d13d-0x0;var _0x50241b=_0xce9d[_0x36d13d];return _0x50241b;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xdce9('0x0'))['db'][_0xdce9('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xdce9('0x2')](0x0);var events={'afterCreate':_0xdce9('0x3'),'afterUpdate':_0xdce9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ba7bf){return function(_0x14b296,_0x417c2c,_0x25f1f0){VoicePrefixEvents[_0xdce9('0x5')](_0x4ba7bf+':'+_0x14b296['id'],_0x14b296);VoicePrefixEvents['emit'](_0x4ba7bf,_0x14b296);_0x25f1f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xdce9('0x6')](e,emitEvent(event));}}module[_0xdce9('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xa9f8=['remove','emit','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xa9f8,0x19b));var _0x8a9f=function(_0x19e599,_0x5c0e43){_0x19e599=_0x19e599-0x0;var _0x2ea044=_0xa9f8[_0x19e599];return _0x2ea044;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x8a9f('0x0'))['db'][_0x8a9f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x8a9f('0x2')](0x0);var events={'afterCreate':_0x8a9f('0x3'),'afterUpdate':_0x8a9f('0x4'),'afterDestroy':_0x8a9f('0x5')};function emitEvent(_0x15e2ba){return function(_0x1c8f0f,_0x20b4d1,_0x9c0466){VoicePrefixEvents[_0x8a9f('0x6')](_0x15e2ba+':'+_0x1c8f0f['id'],_0x1c8f0f);VoicePrefixEvents['emit'](_0x15e2ba,_0x1c8f0f);_0x9c0466(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x8a9f('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 32398a2..abbd418 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 _0x23ac=['rimraf','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','../../config/logger','api','bluebird','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x23ac,0x95));var _0xc23a=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x23ac[_0x3cb30b];return _0x2ca717;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc23a('0x0'))(_0xc23a('0x1'));var moment=require('moment');var BPromise=require(_0xc23a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc23a('0x3'));var rimraf=require(_0xc23a('0x4'));var config=require('../../config/environment');var attributes=require(_0xc23a('0x5'));module['exports']=function(_0xf64ec,_0x2f80fd){return _0xf64ec[_0xc23a('0x6')](_0xc23a('0x7'),attributes,{'tableName':_0xc23a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaeb7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaeb7,0x74));var _0x7aeb=function(_0xf2f2ed,_0x58daf0){_0xf2f2ed=_0xf2f2ed-0x0;var _0x1ac71d=_0xaeb7[_0xf2f2ed];return _0x1ac71d;};'use strict';var _=require(_0x7aeb('0x0'));var util=require('util');var logger=require(_0x7aeb('0x1'))(_0x7aeb('0x2'));var moment=require(_0x7aeb('0x3'));var BPromise=require(_0x7aeb('0x4'));var rp=require(_0x7aeb('0x5'));var fs=require('fs');var path=require(_0x7aeb('0x6'));var rimraf=require(_0x7aeb('0x7'));var config=require(_0x7aeb('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x7aeb('0x9')]=function(_0x2fd629,_0x1780e7){return _0x2fd629['define'](_0x7aeb('0xa'),attributes,{'tableName':_0x7aeb('0xb'),'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 853b9af..bd625d0 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 _0xe056=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0xe056,0xdb));var _0x6e05=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xe056[_0x56825b];return _0x69ce77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e05('0x0'));var BPromise=require(_0x6e05('0x1'));var rs=require(_0x6e05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e05('0x4'))(_0x6e05('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e05('0x6')]({'port':0x232a});config[_0x6e05('0x7')]=_[_0x6e05('0x8')](config['redis'],{'host':_0x6e05('0x9'),'port':0x18eb});var socket=require(_0x6e05('0xa'))(new Redis(config[_0x6e05('0x7')]));require(_0x6e05('0xb'))[_0x6e05('0xc')](socket);function respondWithRpcPromise(_0x52b72b,_0x330e12,_0x110d8e){return new BPromise(function(_0x321ee5,_0x178c9f){return client[_0x6e05('0xd')](_0x52b72b,_0x110d8e)[_0x6e05('0xe')](function(_0x4ff533){logger[_0x6e05('0xf')](_0x6e05('0x10'),_0x330e12,_0x6e05('0x11'));logger['debug'](_0x6e05('0x12'),_0x330e12,_0x6e05('0x11'),JSON[_0x6e05('0x13')](_0x4ff533));if(_0x4ff533[_0x6e05('0x14')]){if(_0x4ff533[_0x6e05('0x14')]['code']===0x1f4){logger[_0x6e05('0x14')](_0x6e05('0x10'),_0x330e12,_0x4ff533['error']['message']);return _0x178c9f(_0x4ff533[_0x6e05('0x14')][_0x6e05('0x15')]);}logger[_0x6e05('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x330e12,_0x4ff533[_0x6e05('0x14')]['message']);return _0x321ee5(_0x4ff533[_0x6e05('0x14')][_0x6e05('0x15')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x330e12,_0x6e05('0x11'));_0x321ee5(_0x4ff533[_0x6e05('0x16')][_0x6e05('0x15')]);}})[_0x6e05('0x17')](function(_0x41d22c){logger['error'](_0x6e05('0x10'),_0x330e12,_0x41d22c);_0x178c9f(_0x41d22c);});});} \ No newline at end of file +var _0xd301=['defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xd301,0x145));var _0x1d30=function(_0x1d6d2a,_0x24362e){_0x1d6d2a=_0x1d6d2a-0x0;var _0x399eb7=_0xd301[_0x1d6d2a];return _0x399eb7;};'use strict';var _=require(_0x1d30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d30('0x1'));var fs=require('fs');var Redis=require(_0x1d30('0x2'));var db=require(_0x1d30('0x3'))['db'];var utils=require(_0x1d30('0x4'));var logger=require(_0x1d30('0x5'))(_0x1d30('0x6'));var config=require(_0x1d30('0x7'));var jayson=require(_0x1d30('0x8'));var client=jayson[_0x1d30('0x9')]['http']({'port':0x232a});config[_0x1d30('0xa')]=_[_0x1d30('0xb')](config[_0x1d30('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d30('0xc'))(new Redis(config[_0x1d30('0xa')]));require(_0x1d30('0xd'))[_0x1d30('0xe')](socket);function respondWithRpcPromise(_0x2a526e,_0xbad263,_0x2bcc44){return new BPromise(function(_0x5ced3a,_0x3b65ed){return client[_0x1d30('0xf')](_0x2a526e,_0x2bcc44)[_0x1d30('0x10')](function(_0x521497){logger[_0x1d30('0x11')](_0x1d30('0x12'),_0xbad263,_0x1d30('0x13'));logger[_0x1d30('0x14')](_0x1d30('0x15'),_0xbad263,_0x1d30('0x13'),JSON[_0x1d30('0x16')](_0x521497));if(_0x521497[_0x1d30('0x17')]){if(_0x521497[_0x1d30('0x17')][_0x1d30('0x18')]===0x1f4){logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x521497[_0x1d30('0x17')][_0x1d30('0x19')]);return _0x3b65ed(_0x521497[_0x1d30('0x17')]['message']);}logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x521497[_0x1d30('0x17')][_0x1d30('0x19')]);return _0x5ced3a(_0x521497[_0x1d30('0x17')]['message']);}else{logger['info'](_0x1d30('0x12'),_0xbad263,_0x1d30('0x13'));_0x5ced3a(_0x521497[_0x1d30('0x1a')][_0x1d30('0x19')]);}})[_0x1d30('0x1b')](function(_0x458b97){logger[_0x1d30('0x17')](_0x1d30('0x12'),_0xbad263,_0x458b97);_0x3b65ed(_0x458b97);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 5d6b903..75c6cfe 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 _0xca2b=['save','remove','update','emit','removeListener','length','./voicePrefix.events'];(function(_0x18da46,_0x6935c3){var _0x4725c1=function(_0x528e66){while(--_0x528e66){_0x18da46['push'](_0x18da46['shift']());}};_0x4725c1(++_0x6935c3);}(_0xca2b,0x156));var _0xbca2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xca2b[_0x4565bf];return _0x5610ba;};'use strict';var VoicePrefixEvents=require(_0xbca2('0x0'));var events=[_0xbca2('0x1'),_0xbca2('0x2'),_0xbca2('0x3')];function createListener(_0x121ed5,_0x34a0ea){return function(_0x438250){_0x34a0ea[_0xbca2('0x4')](_0x121ed5,_0x438250);};}function removeListener(_0x48a06a,_0x24af48){return function(){VoicePrefixEvents[_0xbca2('0x5')](_0x48a06a,_0x24af48);};}exports['register']=function(_0x17439f){for(var _0x56d486=0x0,_0x3476ee=events[_0xbca2('0x6')];_0x56d486<_0x3476ee;_0x56d486++){var _0x226fca=events[_0x56d486];var _0x562cf5=createListener('voicePrefix:'+_0x226fca,_0x17439f);VoicePrefixEvents['on'](_0x226fca,_0x562cf5);}}; \ No newline at end of file +var _0xe3db=['./voicePrefix.events','save','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x4fce58,_0x45ebcd){var _0x27a0a6=function(_0x575e32){while(--_0x575e32){_0x4fce58['push'](_0x4fce58['shift']());}};_0x27a0a6(++_0x45ebcd);}(_0xe3db,0xc8));var _0xbe3d=function(_0x2f300d,_0x39f9de){_0x2f300d=_0x2f300d-0x0;var _0x5c1f61=_0xe3db[_0x2f300d];return _0x5c1f61;};'use strict';var VoicePrefixEvents=require(_0xbe3d('0x0'));var events=[_0xbe3d('0x1'),'remove',_0xbe3d('0x2')];function createListener(_0x17c43e,_0x37fcba){return function(_0x411429){_0x37fcba[_0xbe3d('0x3')](_0x17c43e,_0x411429);};}function removeListener(_0x192368,_0x30163d){return function(){VoicePrefixEvents[_0xbe3d('0x4')](_0x192368,_0x30163d);};}exports[_0xbe3d('0x5')]=function(_0xd5a81){for(var _0x2b4c19=0x0,_0x4c255b=events[_0xbe3d('0x6')];_0x2b4c19<_0x4c255b;_0x2b4c19++){var _0x90d1ab=events[_0x2b4c19];var _0x24136a=createListener(_0xbe3d('0x7')+_0x90d1ab,_0xd5a81);VoicePrefixEvents['on'](_0x90d1ab,_0x24136a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 1d62508..d2b82d9 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1ded7e,_0x4c7556){var _0x1e9c16=function(_0x7e39b2){while(--_0x7e39b2){_0x1ded7e['push'](_0x1ded7e['shift']());}};_0x1e9c16(++_0x4c7556);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _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(_0x4d759f,_0x90bd42){var _0x28c804=function(_0x36d867){while(--_0x36d867){_0x4d759f['push'](_0x4d759f['shift']());}};_0x28c804(++_0x90bd42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 1746269..91d81b4 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 _0x0b99=['dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\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','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','inbound','outbound','STRING','default','ENUM','leastrecent','fewestcalls','random','linear','wrandom','rrordered','ringall','setDataValue','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'];(function(_0x2d0de8,_0x1e9fc1){var _0x10260b=function(_0x4fa2a6){while(--_0x4fa2a6){_0x2d0de8['push'](_0x2d0de8['shift']());}};_0x10260b(++_0x1e9fc1);}(_0x0b99,0x1bc));var _0x90b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0b99[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x90b9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x90b9('0x1'),_0x90b9('0x2')),'allowNull':![],'defaultValue':_0x90b9('0x1')},'musiconhold':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':_0x90b9('0x4')},'announce':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':''},'strategy':{'type':Sequelize[_0x90b9('0x5')]('rr','ringall',_0x90b9('0x6'),_0x90b9('0x7'),_0x90b9('0x8'),'rrmemory',_0x90b9('0x9'),_0x90b9('0xa'),_0x90b9('0xb')),'allowNull':![],'defaultValue':_0x90b9('0xc'),'set':function(_0x522355){this[_0x90b9('0xd')]('strategy',_0x522355?_0x522355:_0x90b9('0xe'));},'get':function(){var _0x13fa31=this[_0x90b9('0xf')](_0x90b9('0x10'));var _0x2cbb17=this[_0x90b9('0xf')](_0x90b9('0x11'));var _0x393eb6=this[_0x90b9('0xf')]('strategy');if(_0x13fa31===_0x90b9('0x1')){return _0x393eb6;}if(_0x2cbb17===_0x90b9('0x12')&&_0x393eb6===_0x90b9('0xe')||_0x2cbb17==='booked'&&_0x393eb6===_0x90b9('0x13')){return _0x393eb6;}if(_0x2cbb17===_0x90b9('0x14')||_0x2cbb17===_0x90b9('0x15')||_0x2cbb17===_0x90b9('0x16')){return _0x393eb6;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x90b9('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x90b9('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x90b9('0x3')]},'weight':{'type':Sequelize[_0x90b9('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x90b9('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x90b9('0x5')]('yes','no'),'defaultValue':_0x90b9('0x18')},'autopause':{'type':Sequelize[_0x90b9('0x5')]('yes','no',_0x90b9('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x90b9('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x90b9('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x90b9('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x90b9('0x3')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x90b9('0x3')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x90b9('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x90b9('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x90b9('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x90b9('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x90b9('0x3')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x90b9('0x3')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x90b9('0x3')]},'queue_quantity1':{'type':Sequelize[_0x90b9('0x3')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x90b9('0x3')]},'queue_less_than':{'type':Sequelize[_0x90b9('0x3')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x384dcb){this[_0x90b9('0xd')]('periodic_announce',_0x384dcb?_0x384dcb['join'](','):[]);},'get':function(){return this[_0x90b9('0xf')](_0x90b9('0x1b'))?this[_0x90b9('0xf')](_0x90b9('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':_0x90b9('0x18'),'set':function(_0x166b0b){this['setDataValue']('joinempty',_0x166b0b?_0x166b0b[_0x90b9('0x1c')](','):undefined);},'get':function(){return this[_0x90b9('0xf')](_0x90b9('0x1d'))?this['getDataValue'](_0x90b9('0x1d'))[_0x90b9('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':'no','set':function(_0x34dcc1){this[_0x90b9('0xd')](_0x90b9('0x1f'),_0x34dcc1?_0x34dcc1['join'](','):undefined);},'get':function(){return this[_0x90b9('0xf')](_0x90b9('0x1f'))?this[_0x90b9('0xf')](_0x90b9('0x1f'))[_0x90b9('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x90b9('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x90b9('0x3')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x90b9('0x20')],'defaultValue':0x0,'set':function(_0x1618df){this[_0x90b9('0xd')](_0x90b9('0x21'),_0x1618df);if(_0x1618df){if(this['getDataValue'](_0x90b9('0x22'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x90b9('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x90b9('0x20')],'defaultValue':0x0,'comment':_0x90b9('0x23')},'dialMethod':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x24'),_0x90b9('0x14'),_0x90b9('0x16'),_0x90b9('0x15'),_0x90b9('0x12')),'defaultValue':'progressive','comment':_0x90b9('0x25')},'dialLimitChannel':{'type':Sequelize[_0x90b9('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x90b9('0x17')](0x4)[_0x90b9('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x90b9('0x27')},'dialPowerLevel':{'type':Sequelize[_0x90b9('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x90b9('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x90b9('0x5')]('agentBusyFactor',_0x90b9('0x2a')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x90b9('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x90b9('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x90b9('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x90b9('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x90b9('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b9('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x90b9('0x3')],'defaultValue':_0x90b9('0x2d'),'comment':_0x90b9('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x90b9('0x17')](0x3)[_0x90b9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b9('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b9('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x90b9('0x17')](0x5)[_0x90b9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b9('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x90b9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b9('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x90b9('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b9('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x90b9('0x26')],'defaultValue':0x3,'comment':_0x90b9('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x90b9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b9('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x90b9('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x90b9('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x90b9('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x90b9('0x5')](_0x90b9('0x38'),'never',_0x90b9('0x39')),'defaultValue':_0x90b9('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x90b9('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x90b9('0x17')](0x9)[_0x90b9('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x90b9('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x90b9('0x17')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x90b9('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x90b9('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x90b9('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x90b9('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x90b9('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x90b9('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x90b9('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x90b9('0x17')](0x5)[_0x90b9('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x90b9('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x90b9('0x17')](0x9)[_0x90b9('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x90b9('0x17')](0x5)[_0x90b9('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x90b9('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x90b9('0x20')],'defaultValue':0x0,'comment':_0x90b9('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x90b9('0x43'),_0x90b9('0x44')),'defaultValue':_0x90b9('0x43')},'dialQueueProject2':{'type':Sequelize[_0x90b9('0x3')],'comment':_0x90b9('0x45')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x90b9('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x90b9('0x17')](0x3)[_0x90b9('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x90b9('0x46')},'dialCutDigit':{'type':Sequelize[_0x90b9('0x17')](0x3)[_0x90b9('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x90b9('0x17')](0x3)[_0x90b9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b9('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x90b9('0x17')](0x5)[_0x90b9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b9('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x90b9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b9('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0x90b9('0x17')](0x5)[_0x90b9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b9('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x90b9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b9('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x90b9('0x17')](0x5)[_0x90b9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x90b9('0x17')](0x3)[_0x90b9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x90b9('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x90b9('0x17')](0x5)[_0x90b9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x90b9('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x90b9('0x17')](0x3)[_0x90b9('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x90b9('0x17')](0x5)[_0x90b9('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x90b9('0x17')],'allowNull':!![],'comment':_0x90b9('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x90b9('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x11d626){if(!_0x11d626)this['setDataValue'](_0x90b9('0x4f'),null);this[_0x90b9('0xd')](_0x90b9('0x50'),_0x11d626);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x90b9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x90b9('0x17')](0x3)[_0x90b9('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x90b9('0x20')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcc44=['Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\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','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','once','setDataValue','split','joinempty','join','leavewhenempty','acw','wrapuptime','Dial\x20Method.','UNSIGNED'];(function(_0x455c1b,_0x21b689){var _0x101805=function(_0x371c23){while(--_0x371c23){_0x455c1b['push'](_0x455c1b['shift']());}};_0x101805(++_0x21b689);}(_0xcc44,0x11d));var _0x4cc4=function(_0x205725,_0x582a1b){_0x205725=_0x205725-0x0;var _0x4c86ed=_0xcc44[_0x205725];return _0x4c86ed;};'use strict';var Sequelize=require(_0x4cc4('0x0'));module[_0x4cc4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4cc4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x4'),_0x4cc4('0x5')),'allowNull':![],'defaultValue':_0x4cc4('0x4')},'musiconhold':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':_0x4cc4('0x7')},'announce':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x4cc4('0x8'),_0x4cc4('0x9'),_0x4cc4('0xa'),_0x4cc4('0xb'),_0x4cc4('0xc'),'linear',_0x4cc4('0xd'),_0x4cc4('0xe')),'allowNull':![],'defaultValue':'ringall','set':function(_0x4f447f){this['setDataValue'](_0x4cc4('0xf'),_0x4f447f?_0x4f447f:_0x4cc4('0xc'));},'get':function(){var _0x2768d2=this[_0x4cc4('0x10')](_0x4cc4('0x11'));var _0x239982=this[_0x4cc4('0x10')](_0x4cc4('0x12'));var _0x117416=this[_0x4cc4('0x10')](_0x4cc4('0xf'));if(_0x2768d2===_0x4cc4('0x4')){return _0x117416;}if(_0x239982===_0x4cc4('0x13')&&_0x117416===_0x4cc4('0xc')||_0x239982==='booked'&&_0x117416===_0x4cc4('0x14')){return _0x117416;}if(_0x239982===_0x4cc4('0x15')||_0x239982==='predictive'||_0x239982===_0x4cc4('0x16')){return _0x117416;}return null;}},'servicelevel':{'type':Sequelize[_0x4cc4('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4cc4('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4cc4('0x6')]},'weight':{'type':Sequelize[_0x4cc4('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x4cc4('0x18'),'no'),'defaultValue':_0x4cc4('0x18')},'autopause':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x4cc4('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4cc4('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4cc4('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4cc4('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4cc4('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4cc4('0x3')]('yes','no'),'defaultValue':_0x4cc4('0x18')},'announce_holdtime':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no',_0x4cc4('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x4cc4('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4cc4('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4cc4('0x6')]},'queue_youarenext':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4cc4('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x4cc4('0x6')]},'queue_less_than':{'type':Sequelize[_0x4cc4('0x6')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x430687){this[_0x4cc4('0x1a')]('periodic_announce',_0x430687?_0x430687['join'](','):[]);},'get':function(){return this[_0x4cc4('0x10')]('periodic_announce')?this['getDataValue']('periodic_announce')[_0x4cc4('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':_0x4cc4('0x18'),'set':function(_0x1727dd){this['setDataValue'](_0x4cc4('0x1c'),_0x1727dd?_0x1727dd[_0x4cc4('0x1d')](','):undefined);},'get':function(){return this[_0x4cc4('0x10')]('joinempty')?this[_0x4cc4('0x10')](_0x4cc4('0x1c'))[_0x4cc4('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':'no','set':function(_0x5976b2){this[_0x4cc4('0x1a')](_0x4cc4('0x1e'),_0x5976b2?_0x5976b2[_0x4cc4('0x1d')](','):undefined);},'get':function(){return this[_0x4cc4('0x10')](_0x4cc4('0x1e'))?this['getDataValue']('leavewhenempty')[_0x4cc4('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4cc4('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x4cc4('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4cc4('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x56e416){this[_0x4cc4('0x1a')](_0x4cc4('0x1f'),_0x56e416);if(_0x56e416){if(this[_0x4cc4('0x10')](_0x4cc4('0x20'))<0x2){this[_0x4cc4('0x1a')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4cc4('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x4cc4('0x15'),_0x4cc4('0x16'),'predictive',_0x4cc4('0x13')),'defaultValue':_0x4cc4('0x15'),'comment':_0x4cc4('0x21')},'dialLimitChannel':{'type':Sequelize[_0x4cc4('0x17')](0x4)[_0x4cc4('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x4cc4('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4cc4('0x23')},'dialPowerLevel':{'type':Sequelize[_0x4cc4('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4cc4('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x4cc4('0x3')]('agentBusyFactor','dropRate'),'defaultValue':_0x4cc4('0x26'),'comment':_0x4cc4('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4cc4('0x24')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4cc4('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x4cc4('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4cc4('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4cc4('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4cc4('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0x4cc4('0x17')](0x3)[_0x4cc4('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cc4('0x2a')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x4cc4('0x2b')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4cc4('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cc4('0x2c')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4cc4('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cc4('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x4cc4('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x4cc4('0x17')](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cc4('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4cc4('0x17')](0x3)[_0x4cc4('0x22')],'defaultValue':0x3,'comment':_0x4cc4('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cc4('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4cc4('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':_0x4cc4('0x31')},'dialPrefix':{'type':Sequelize[_0x4cc4('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x32'),_0x4cc4('0x33'),'onlyIfOpen'),'defaultValue':_0x4cc4('0x32')},'dialAMDActive':{'type':Sequelize[_0x4cc4('0x34')],'defaultValue':0x0,'comment':_0x4cc4('0x35')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4cc4('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x4cc4('0x17')](0x9)[_0x4cc4('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4cc4('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4cc4('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4cc4('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4cc4('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4cc4('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x4cc4('0x17')](0x9)[_0x4cc4('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4cc4('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4cc4('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4cc4('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4cc4('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4cc4('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4cc4('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4cc4('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4cc4('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4cc4('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x4cc4('0x17')](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x4cc4('0x34')],'defaultValue':0x0,'comment':_0x4cc4('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4cc4('0x3')](_0x4cc4('0x40'),_0x4cc4('0x41')),'defaultValue':_0x4cc4('0x40')},'dialQueueProject2':{'type':Sequelize[_0x4cc4('0x6')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4cc4('0x34')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x4cc4('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4cc4('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x4cc4('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4cc4('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4cc4('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cc4('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cc4('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x4cc4('0x17')](0x3)[_0x4cc4('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x4cc4('0x17')](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cc4('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4cc4('0x17')](0x3)[_0x4cc4('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cc4('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4cc4('0x17')](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cc4('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x4cc4('0x17')](0x3)[_0x4cc4('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cc4('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4cc4('0x17')](0x3)[_0x4cc4('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cc4('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4cc4('0x17')](0x5)[_0x4cc4('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cc4('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4cc4('0x17')],'allowNull':!![],'comment':_0x4cc4('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x4cc4('0x34')],'defaultValue':![],'comment':_0x4cc4('0x4d'),'set':function(_0x32cbb0){if(!_0x32cbb0)this[_0x4cc4('0x1a')](_0x4cc4('0x4e'),null);this['setDataValue'](_0x4cc4('0x4f'),_0x32cbb0);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4cc4('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4cc4('0x17')](0x3)[_0x4cc4('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x4cc4('0x34')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c09e361..b22425d 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 _0x5c0c=['CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','SIP/%s','ids','User','select','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','removeTeams','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','end','status','json','undefined','limit','count','offset','set','apply','reject','update','destroy','then','get','inbound','QueueCampaigns','filter','ignore','map','includes','type','find','value','name','UserProfileResource','sendStatus','error','stack','index','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','VoiceQueue','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','include','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','outbound','userProfileId','getHoppers','findOne','VoiceQueueId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5c0c,0x106));var _0xc5c0=function(_0x5ea801,_0x5baf25){_0x5ea801=_0x5ea801-0x0;var _0x2bfc75=_0x5c0c[_0x5ea801];return _0x2bfc75;};'use strict';var emlformat=require(_0xc5c0('0x0'));var rimraf=require(_0xc5c0('0x1'));var zipdir=require(_0xc5c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc5c0('0x3'));var BPromise=require(_0xc5c0('0x4'));var Mustache=require('mustache');var util=require(_0xc5c0('0x5'));var path=require(_0xc5c0('0x6'));var sox=require('sox');var csv=require(_0xc5c0('0x7'));var ejs=require(_0xc5c0('0x8'));var fs=require('fs');var fs_extra=require(_0xc5c0('0x9'));var _=require(_0xc5c0('0xa'));var squel=require(_0xc5c0('0xb'));var crypto=require(_0xc5c0('0xc'));var jsforce=require(_0xc5c0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc5c0('0x7'));var querystring=require(_0xc5c0('0xe'));var Papa=require(_0xc5c0('0xf'));var Redis=require(_0xc5c0('0x10'));var authService=require(_0xc5c0('0x11'));var qs=require(_0xc5c0('0x12'));var as=require(_0xc5c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc5c0('0x14'));var utils=require(_0xc5c0('0x15'));var config=require(_0xc5c0('0x16'));var licenseUtil=require(_0xc5c0('0x17'));var db=require('../../mysqldb')['db'];config[_0xc5c0('0x18')]=_[_0xc5c0('0x19')](config['redis'],{'host':_0xc5c0('0x1a'),'port':0x18eb});var socket=require(_0xc5c0('0x1b'))(new Redis(config[_0xc5c0('0x18')]));require('./voiceQueue.socket')[_0xc5c0('0x1c')](socket);function respondWithStatusCode(_0x1bb948,_0xb458c3){_0xb458c3=_0xb458c3||0xcc;return function(_0x1fac67){if(_0x1fac67){return _0x1bb948['sendStatus'](_0xb458c3);}return _0x1bb948['status'](_0xb458c3)[_0xc5c0('0x1d')]();};}function respondWithResult(_0x1e1670,_0x2122ed){_0x2122ed=_0x2122ed||0xc8;return function(_0x378b96){if(_0x378b96){return _0x1e1670[_0xc5c0('0x1e')](_0x2122ed)[_0xc5c0('0x1f')](_0x378b96);}};}function respondWithFilteredResult(_0x5d86a8,_0x1b90a9){return function(_0x45415f){if(_0x45415f){var _0x45ec03=typeof _0x1b90a9['offset']===_0xc5c0('0x20')&&typeof _0x1b90a9[_0xc5c0('0x21')]===_0xc5c0('0x20');var _0x27917a=_0x45415f[_0xc5c0('0x22')];var _0x506562=_0x45ec03?0x0:_0x1b90a9[_0xc5c0('0x23')];var _0x350dc7=_0x45ec03?_0x45415f[_0xc5c0('0x22')]:_0x1b90a9[_0xc5c0('0x23')]+_0x1b90a9[_0xc5c0('0x21')];var _0x416656;if(_0x350dc7>=_0x27917a){_0x350dc7=_0x27917a;_0x416656=0xc8;}else{_0x416656=0xce;}_0x5d86a8[_0xc5c0('0x1e')](_0x416656);return _0x5d86a8[_0xc5c0('0x24')]('Content-Range',_0x506562+'-'+_0x350dc7+'/'+_0x27917a)[_0xc5c0('0x1f')](_0x45415f);}return null;};}function patchUpdates(_0x40479b){return function(_0x3d8063){try{jsonpatch[_0xc5c0('0x25')](_0x3d8063,_0x40479b,!![]);}catch(_0x3a5173){return BPromise[_0xc5c0('0x26')](_0x3a5173);}return _0x3d8063['save']();};}function saveUpdates(_0xd8b376,_0x5edde0){return function(_0x4610ce){if(_0x4610ce){return _0x4610ce[_0xc5c0('0x27')](_0xd8b376)['then'](function(_0x1e5af6){return _0x1e5af6;});}return null;};}function removeEntity(_0x251ef5,_0x57b26e){return function(_0x12ead6){if(_0x12ead6){return _0x12ead6[_0xc5c0('0x28')]()[_0xc5c0('0x29')](function(){var _0x57cf29=_0x12ead6[_0xc5c0('0x2a')]({'plain':!![]});var _0x4ff14f=[{'name':'VoiceQueues','value':_0xc5c0('0x2b'),'ignore':![]},{'name':_0xc5c0('0x2c'),'value':'outbound','ignore':![]}];var _0x129120=_(_0x4ff14f)[_0xc5c0('0x2d')](_0xc5c0('0x2e'))[_0xc5c0('0x2f')]('value')['value']();if(_[_0xc5c0('0x30')](_0x129120,_0x57cf29[_0xc5c0('0x31')])){return;}var _0x2ad2af=_[_0xc5c0('0x32')](_0x4ff14f,[_0xc5c0('0x33'),_0x57cf29['type']])[_0xc5c0('0x34')];return db[_0xc5c0('0x35')][_0xc5c0('0x28')]({'where':{'type':_0x2ad2af,'resourceId':_0x57cf29['id']}})['then'](function(){return _0x12ead6;});})[_0xc5c0('0x29')](function(){_0x251ef5[_0xc5c0('0x1e')](0xcc)[_0xc5c0('0x1d')]();});}};}function handleEntityNotFound(_0x1659ef,_0x1de248){return function(_0x2818f1){if(!_0x2818f1){_0x1659ef[_0xc5c0('0x36')](0x194);}return _0x2818f1;};}function handleError(_0x1b0b6e,_0x29529c){_0x29529c=_0x29529c||0x1f4;return function(_0x5cdea2){logger[_0xc5c0('0x37')](_0x5cdea2[_0xc5c0('0x38')]);if(_0x5cdea2['name']){delete _0x5cdea2[_0xc5c0('0x34')];}_0x1b0b6e[_0xc5c0('0x1e')](_0x29529c)['send'](_0x5cdea2);};}exports[_0xc5c0('0x39')]=function(_0x179a26,_0x5a4642){var _0x4c2bcc={},_0x368e4d={},_0x534f46={'count':0x0,'rows':[]};var _0x447dea=_[_0xc5c0('0x2f')](db['VoiceQueue']['rawAttributes'],function(_0x20787c){return{'name':_0x20787c[_0xc5c0('0x3a')],'type':_0x20787c[_0xc5c0('0x31')][_0xc5c0('0x3b')]};});_0x368e4d[_0xc5c0('0x3c')]=_['map'](_0x447dea,_0xc5c0('0x34'));_0x368e4d[_0xc5c0('0x3d')]=_['keys'](_0x179a26[_0xc5c0('0x3d')]);_0x368e4d[_0xc5c0('0x3e')]=_[_0xc5c0('0x3f')](_0x368e4d[_0xc5c0('0x3c')],_0x368e4d[_0xc5c0('0x3d')]);_0x4c2bcc[_0xc5c0('0x40')]=_[_0xc5c0('0x3f')](_0x368e4d[_0xc5c0('0x3c')],qs[_0xc5c0('0x41')](_0x179a26[_0xc5c0('0x3d')]['fields']));_0x4c2bcc[_0xc5c0('0x40')]=_0x4c2bcc[_0xc5c0('0x40')][_0xc5c0('0x42')]?_0x4c2bcc[_0xc5c0('0x40')]:_0x368e4d['model'];if(!_0x179a26[_0xc5c0('0x3d')][_0xc5c0('0x43')](_0xc5c0('0x44'))){_0x4c2bcc['limit']=qs[_0xc5c0('0x21')](_0x179a26[_0xc5c0('0x3d')]['limit']);_0x4c2bcc[_0xc5c0('0x23')]=qs[_0xc5c0('0x23')](_0x179a26['query'][_0xc5c0('0x23')]);}_0x4c2bcc[_0xc5c0('0x45')]=qs[_0xc5c0('0x46')](_0x179a26[_0xc5c0('0x3d')][_0xc5c0('0x46')]);_0x4c2bcc[_0xc5c0('0x47')]=qs[_0xc5c0('0x3e')](_[_0xc5c0('0x48')](_0x179a26['query'],_0x368e4d[_0xc5c0('0x3e')]),_0x447dea);if(_0x179a26[_0xc5c0('0x3d')][_0xc5c0('0x2d')]){_0x4c2bcc[_0xc5c0('0x47')]=_['merge'](_0x4c2bcc['where'],{'$or':_[_0xc5c0('0x2f')](_0x447dea,function(_0x33b218){if(_0x33b218[_0xc5c0('0x31')]!==_0xc5c0('0x49')){var _0x2175fb={};_0x2175fb[_0x33b218['name']]={'$like':'%'+_0x179a26[_0xc5c0('0x3d')][_0xc5c0('0x2d')]+'%'};return _0x2175fb;}})});}_0x4c2bcc=_['merge']({},_0x4c2bcc,_0x179a26[_0xc5c0('0x4a')]);var _0x1bd7ea={'where':_0x4c2bcc[_0xc5c0('0x47')]};return db[_0xc5c0('0x4b')][_0xc5c0('0x22')](_0x1bd7ea)[_0xc5c0('0x29')](function(_0x2e2ce6){_0x534f46[_0xc5c0('0x22')]=_0x2e2ce6;if(_0x179a26[_0xc5c0('0x3d')][_0xc5c0('0x4c')]){_0x4c2bcc['include']=[{'all':!![]}];}return db[_0xc5c0('0x4b')][_0xc5c0('0x4d')](_0x4c2bcc);})[_0xc5c0('0x29')](function(_0x4c34c1){_0x534f46[_0xc5c0('0x4e')]=_0x4c34c1;return _0x534f46;})['then'](respondWithFilteredResult(_0x5a4642,_0x4c2bcc))[_0xc5c0('0x4f')](handleError(_0x5a4642,null));};exports[_0xc5c0('0x50')]=function(_0x4cae06,_0x10da43){var _0x8cbb73={'raw':![],'where':{'id':_0x4cae06[_0xc5c0('0x51')]['id']}},_0x2468f8={};_0x2468f8[_0xc5c0('0x3c')]=_['keys'](db[_0xc5c0('0x4b')][_0xc5c0('0x52')]);_0x2468f8[_0xc5c0('0x3d')]=_[_0xc5c0('0x53')](_0x4cae06['query']);_0x2468f8['filters']=_[_0xc5c0('0x3f')](_0x2468f8['model'],_0x2468f8[_0xc5c0('0x3d')]);_0x8cbb73[_0xc5c0('0x40')]=_[_0xc5c0('0x3f')](_0x2468f8[_0xc5c0('0x3c')],qs[_0xc5c0('0x41')](_0x4cae06['query'][_0xc5c0('0x41')]));_0x8cbb73[_0xc5c0('0x40')]=_0x8cbb73[_0xc5c0('0x40')][_0xc5c0('0x42')]?_0x8cbb73['attributes']:_0x2468f8['model'];if(_0x4cae06['query'][_0xc5c0('0x4c')]){_0x8cbb73[_0xc5c0('0x54')]=[{'all':!![]}];}_0x8cbb73=_[_0xc5c0('0x55')]({},_0x8cbb73,_0x4cae06[_0xc5c0('0x4a')]);return db[_0xc5c0('0x4b')]['find'](_0x8cbb73)['then'](handleEntityNotFound(_0x10da43,null))[_0xc5c0('0x29')](respondWithResult(_0x10da43,null))['catch'](handleError(_0x10da43,null));};exports[_0xc5c0('0x56')]=function(_0x2b9e01,_0x1e8ae8){return db[_0xc5c0('0x4b')][_0xc5c0('0x56')](_0x2b9e01[_0xc5c0('0x57')],{})[_0xc5c0('0x29')](function(_0x3d5528){var _0x50ca70=_0x2b9e01[_0xc5c0('0x58')][_0xc5c0('0x2a')]({'plain':!![]});if(!_0x50ca70)throw new Error(_0xc5c0('0x59'));if(_0x50ca70[_0xc5c0('0x5a')]===_0xc5c0('0x58')){var _0x319726=_0x3d5528['get']({'plain':!![]});var _0x224dc8=[{'name':_0xc5c0('0x5b'),'value':_0xc5c0('0x2b')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5e269a=_[_0xc5c0('0x32')](_0x224dc8,[_0xc5c0('0x33'),_0x319726[_0xc5c0('0x31')]])['name'];return db[_0xc5c0('0x5c')][_0xc5c0('0x32')]({'where':{'name':_0x5e269a,'userProfileId':_0x50ca70['userProfileId']},'raw':!![]})['then'](function(_0x57ec25){if(_0x57ec25&&_0x57ec25[_0xc5c0('0x5d')]===0x0){return db[_0xc5c0('0x35')]['create']({'name':_0x319726[_0xc5c0('0x34')],'resourceId':_0x319726['id'],'type':_0x57ec25[_0xc5c0('0x34')],'sectionId':_0x57ec25['id']},{})[_0xc5c0('0x29')](function(){return _0x3d5528;});}else{return _0x3d5528;}})[_0xc5c0('0x4f')](function(_0x173cca){logger['error'](_0xc5c0('0x5e'),_0x173cca);throw _0x173cca;});}return _0x3d5528;})[_0xc5c0('0x29')](respondWithResult(_0x1e8ae8,0xc9))[_0xc5c0('0x4f')](handleError(_0x1e8ae8,null));};exports[_0xc5c0('0x5f')]=function(_0xe72b58,_0x47cf6b){var _0x2b7616={'where':{'id':_0xe72b58['params']['id']}},_0x445b1d={};_0x445b1d[_0xc5c0('0x3c')]=_[_0xc5c0('0x53')](db[_0xc5c0('0x4b')]['rawAttributes']);_0x2b7616[_0xc5c0('0x40')]=_[_0xc5c0('0x3f')](_0x445b1d['model'],qs[_0xc5c0('0x41')](_0xe72b58['query'][_0xc5c0('0x41')]));_0x2b7616[_0xc5c0('0x40')]=_0x2b7616[_0xc5c0('0x40')][_0xc5c0('0x42')]?_0x2b7616['attributes']:_0x445b1d['model'];if(_0xe72b58[_0xc5c0('0x3d')][_0xc5c0('0x4c')]){_0x2b7616[_0xc5c0('0x54')]=[{'all':!![]}];}_0x2b7616=_[_0xc5c0('0x55')]({},_0x2b7616,_0xe72b58[_0xc5c0('0x4a')]);return db[_0xc5c0('0x4b')][_0xc5c0('0x32')](_0x2b7616)[_0xc5c0('0x29')](handleEntityNotFound(_0x47cf6b,null))[_0xc5c0('0x29')](function(_0x59449f){if(_0x59449f){var _0x3ac2a2=_0x59449f[_0xc5c0('0x2a')]({'plain':!![]});_0x3ac2a2=qs[_0xc5c0('0x60')](_0x3ac2a2,['id',_0xc5c0('0x61'),_0xc5c0('0x62')]);_0xe72b58[_0xc5c0('0x57')]=_[_0xc5c0('0x60')](_0xe72b58[_0xc5c0('0x57')],['id','createdAt','updatedAt']);return db[_0xc5c0('0x4b')][_0xc5c0('0x56')](_[_0xc5c0('0x55')](_0x3ac2a2,_0xe72b58[_0xc5c0('0x57')]),{'include':_0xe72b58[_0xc5c0('0x3d')][_0xc5c0('0x4c')]?[{'all':!![]}]:undefined})[_0xc5c0('0x29')](function(_0x28fb0c){var _0x44700b=_0xe72b58['user'][_0xc5c0('0x2a')]({'plain':!![]});if(!_0x44700b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44700b[_0xc5c0('0x5a')]===_0xc5c0('0x58')){var _0x39ed45=_0x28fb0c[_0xc5c0('0x2a')]({'plain':!![]});var _0x511cdf=[{'name':_0xc5c0('0x5b'),'value':_0xc5c0('0x2b')},{'name':_0xc5c0('0x2c'),'value':_0xc5c0('0x63')}];var _0xb37d21=_[_0xc5c0('0x32')](_0x511cdf,[_0xc5c0('0x33'),_0x39ed45['type']])[_0xc5c0('0x34')];return db[_0xc5c0('0x5c')][_0xc5c0('0x32')]({'where':{'name':_0xb37d21,'userProfileId':_0x44700b[_0xc5c0('0x64')]},'raw':!![]})[_0xc5c0('0x29')](function(_0x8ffdac){if(_0x8ffdac&&_0x8ffdac[_0xc5c0('0x5d')]===0x0){return db[_0xc5c0('0x35')][_0xc5c0('0x56')]({'name':_0x39ed45[_0xc5c0('0x34')],'resourceId':_0x39ed45['id'],'type':_0x8ffdac[_0xc5c0('0x34')],'sectionId':_0x8ffdac['id']},{})[_0xc5c0('0x29')](function(){return _0x28fb0c;});}else{return _0x28fb0c;}})[_0xc5c0('0x4f')](function(_0x429386){logger[_0xc5c0('0x37')](_0xc5c0('0x5e'),_0x429386);throw _0x429386;});}return _0x28fb0c;});}})['then'](respondWithResult(_0x47cf6b,0xc9))['catch'](handleError(_0x47cf6b,null));};exports[_0xc5c0('0x27')]=function(_0x1a2593,_0x2314f5){if(_0x1a2593[_0xc5c0('0x57')]['id']){delete _0x1a2593[_0xc5c0('0x57')]['id'];}return db[_0xc5c0('0x4b')]['find']({'where':{'id':_0x1a2593[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x2314f5,null))[_0xc5c0('0x29')](saveUpdates(_0x1a2593[_0xc5c0('0x57')],null))[_0xc5c0('0x29')](respondWithResult(_0x2314f5,null))[_0xc5c0('0x4f')](handleError(_0x2314f5,null));};exports[_0xc5c0('0x28')]=function(_0x185190,_0x393c92){return db[_0xc5c0('0x4b')][_0xc5c0('0x32')]({'where':{'id':_0x185190[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x393c92,null))[_0xc5c0('0x29')](removeEntity(_0x393c92,null))['catch'](handleError(_0x393c92,null));};exports[_0xc5c0('0x65')]=function(_0x7412ab,_0x3559f6,_0x1a4fc4){var _0x31a20f={'raw':![],'where':{}};var _0x228bb4={};var _0x18ea02={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc5c0('0x66')]({'where':{'id':_0x7412ab[_0xc5c0('0x51')]['id']}})['then'](handleEntityNotFound(_0x3559f6,null))[_0xc5c0('0x29')](function(_0x348aa2){if(_0x348aa2){_0x228bb4[_0xc5c0('0x3c')]=_[_0xc5c0('0x53')](db['CmHopper'][_0xc5c0('0x52')]);_0x228bb4['query']=_[_0xc5c0('0x53')](_0x7412ab[_0xc5c0('0x3d')]);_0x228bb4[_0xc5c0('0x3e')]=_[_0xc5c0('0x3f')](_0x228bb4[_0xc5c0('0x3c')],_0x228bb4[_0xc5c0('0x3d')]);_0x31a20f[_0xc5c0('0x40')]=_[_0xc5c0('0x3f')](_0x228bb4[_0xc5c0('0x3c')],qs[_0xc5c0('0x41')](_0x7412ab['query']['fields']));_0x31a20f[_0xc5c0('0x40')]=_0x31a20f[_0xc5c0('0x40')][_0xc5c0('0x42')]?_0x31a20f[_0xc5c0('0x40')]:_0x228bb4['model'];if(!_0x7412ab['query'][_0xc5c0('0x43')](_0xc5c0('0x44'))){_0x31a20f[_0xc5c0('0x21')]=qs[_0xc5c0('0x21')](_0x7412ab[_0xc5c0('0x3d')][_0xc5c0('0x21')]);_0x31a20f[_0xc5c0('0x23')]=qs[_0xc5c0('0x23')](_0x7412ab[_0xc5c0('0x3d')][_0xc5c0('0x23')]);}_0x31a20f['order']=qs['sort'](_0x7412ab[_0xc5c0('0x3d')]['sort']);_0x31a20f[_0xc5c0('0x47')]=qs[_0xc5c0('0x3e')](_['pick'](_0x7412ab['query'],_0x228bb4[_0xc5c0('0x3e')]));_0x31a20f[_0xc5c0('0x47')][_0xc5c0('0x67')]=_0x348aa2['id'];if(_0x7412ab[_0xc5c0('0x3d')]['filter']){_0x31a20f['where']=_[_0xc5c0('0x55')](_0x31a20f[_0xc5c0('0x47')],{'$or':_['map'](_0x31a20f[_0xc5c0('0x40')],function(_0x29d298){var _0xb9449a={};_0xb9449a[_0x29d298]={'$like':'%'+_0x7412ab[_0xc5c0('0x3d')][_0xc5c0('0x2d')]+'%'};return _0xb9449a;})});}_0x31a20f=_['merge']({},_0x31a20f,_0x7412ab[_0xc5c0('0x4a')]);return db[_0xc5c0('0x68')][_0xc5c0('0x22')]({'where':_0x31a20f['where']})[_0xc5c0('0x29')](function(_0xfdebc5){_0x18ea02[_0xc5c0('0x22')]=_0xfdebc5;if(_0x7412ab[_0xc5c0('0x3d')][_0xc5c0('0x4c')]){_0x31a20f[_0xc5c0('0x54')]=[{'all':!![]}];}return db['CmHopper'][_0xc5c0('0x4d')](_0x31a20f);})[_0xc5c0('0x29')](function(_0x4eb322){_0x18ea02[_0xc5c0('0x4e')]=_0x4eb322;return _0x18ea02;});}})['then'](respondWithFilteredResult(_0x3559f6,_0x31a20f))[_0xc5c0('0x4f')](handleError(_0x3559f6,null));};exports[_0xc5c0('0x69')]=function(_0x48d8e9,_0x2a0a29,_0x23c2fb){var _0x53138d={'raw':!![],'where':{}};var _0x267071={};var _0x148465={'count':0x0,'rows':[]};return db[_0xc5c0('0x4b')]['findOne']({'where':{'id':_0x48d8e9[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x2a0a29,null))['then'](function(_0x290b00){if(_0x290b00){_0x267071['model']=_[_0xc5c0('0x53')](db[_0xc5c0('0x6a')][_0xc5c0('0x52')]);_0x267071[_0xc5c0('0x3d')]=_[_0xc5c0('0x53')](_0x48d8e9['query']);_0x267071[_0xc5c0('0x3e')]=_[_0xc5c0('0x3f')](_0x267071[_0xc5c0('0x3c')],_0x267071['query']);_0x53138d[_0xc5c0('0x40')]=_['intersection'](_0x267071[_0xc5c0('0x3c')],qs[_0xc5c0('0x41')](_0x48d8e9['query']['fields']));_0x53138d['attributes']=_0x53138d[_0xc5c0('0x40')]['length']?_0x53138d[_0xc5c0('0x40')]:_0x267071['model'];if(!_0x48d8e9[_0xc5c0('0x3d')][_0xc5c0('0x43')](_0xc5c0('0x44'))){_0x53138d[_0xc5c0('0x21')]=qs[_0xc5c0('0x21')](_0x48d8e9['query'][_0xc5c0('0x21')]);_0x53138d[_0xc5c0('0x23')]=qs[_0xc5c0('0x23')](_0x48d8e9['query'][_0xc5c0('0x23')]);}_0x53138d['order']=qs[_0xc5c0('0x46')](_0x48d8e9[_0xc5c0('0x3d')][_0xc5c0('0x46')]);_0x53138d['where']=qs[_0xc5c0('0x3e')](_[_0xc5c0('0x48')](_0x48d8e9[_0xc5c0('0x3d')],_0x267071[_0xc5c0('0x3e')]));_0x53138d[_0xc5c0('0x47')][_0xc5c0('0x67')]=_0x290b00['id'];if(_0x48d8e9[_0xc5c0('0x3d')][_0xc5c0('0x2d')]){_0x53138d['where']=_[_0xc5c0('0x55')](_0x53138d['where'],{'$or':_[_0xc5c0('0x2f')](_0x53138d[_0xc5c0('0x40')],function(_0x3b1868){var _0x1a465e={};_0x1a465e[_0x3b1868]={'$like':'%'+_0x48d8e9[_0xc5c0('0x3d')][_0xc5c0('0x2d')]+'%'};return _0x1a465e;})});}_0x53138d=_['merge']({},_0x53138d,_0x48d8e9[_0xc5c0('0x4a')]);return db[_0xc5c0('0x6a')][_0xc5c0('0x22')]({'where':_0x53138d[_0xc5c0('0x47')]})['then'](function(_0xe19e91){_0x148465['count']=_0xe19e91;if(_0x48d8e9[_0xc5c0('0x3d')][_0xc5c0('0x4c')]){_0x53138d['include']=[{'all':!![]}];}return db[_0xc5c0('0x6a')]['findAll'](_0x53138d);})[_0xc5c0('0x29')](function(_0x2eea2b){_0x148465['rows']=_0x2eea2b;return _0x148465;});}})[_0xc5c0('0x29')](respondWithFilteredResult(_0x2a0a29,_0x53138d))[_0xc5c0('0x4f')](handleError(_0x2a0a29,null));};exports['getHopperFinals']=function(_0x3590c6,_0x47e0c5,_0x6fffd6){var _0x2e6bba={'raw':!![],'where':{}};var _0xd5c84c={};var _0x2211e9={'count':0x0,'rows':[]};return db[_0xc5c0('0x4b')][_0xc5c0('0x66')]({'where':{'id':_0x3590c6['params']['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x47e0c5,null))[_0xc5c0('0x29')](function(_0x5db31e){if(_0x5db31e){_0xd5c84c[_0xc5c0('0x3c')]=_[_0xc5c0('0x53')](db[_0xc5c0('0x6b')][_0xc5c0('0x52')]);_0xd5c84c[_0xc5c0('0x3d')]=_['keys'](_0x3590c6[_0xc5c0('0x3d')]);_0xd5c84c[_0xc5c0('0x3e')]=_['intersection'](_0xd5c84c[_0xc5c0('0x3c')],_0xd5c84c['query']);_0x2e6bba[_0xc5c0('0x40')]=_[_0xc5c0('0x3f')](_0xd5c84c['model'],qs[_0xc5c0('0x41')](_0x3590c6[_0xc5c0('0x3d')][_0xc5c0('0x41')]));_0x2e6bba[_0xc5c0('0x40')]=_0x2e6bba[_0xc5c0('0x40')][_0xc5c0('0x42')]?_0x2e6bba['attributes']:_0xd5c84c['model'];if(!_0x3590c6[_0xc5c0('0x3d')][_0xc5c0('0x43')]('nolimit')){_0x2e6bba[_0xc5c0('0x21')]=qs['limit'](_0x3590c6[_0xc5c0('0x3d')][_0xc5c0('0x21')]);_0x2e6bba['offset']=qs['offset'](_0x3590c6['query'][_0xc5c0('0x23')]);}_0x2e6bba[_0xc5c0('0x45')]=qs['sort'](_0x3590c6[_0xc5c0('0x3d')][_0xc5c0('0x46')]);_0x2e6bba['where']=qs['filters'](_['pick'](_0x3590c6[_0xc5c0('0x3d')],_0xd5c84c[_0xc5c0('0x3e')]));_0x2e6bba[_0xc5c0('0x47')]['VoiceQueueId']=_0x5db31e['id'];if(_0x3590c6[_0xc5c0('0x3d')][_0xc5c0('0x2d')]){_0x2e6bba[_0xc5c0('0x47')]=_['merge'](_0x2e6bba[_0xc5c0('0x47')],{'$or':_[_0xc5c0('0x2f')](_0x2e6bba[_0xc5c0('0x40')],function(_0x84dddc){var _0x560a6e={};_0x560a6e[_0x84dddc]={'$like':'%'+_0x3590c6[_0xc5c0('0x3d')][_0xc5c0('0x2d')]+'%'};return _0x560a6e;})});}_0x2e6bba=_[_0xc5c0('0x55')]({},_0x2e6bba,_0x3590c6[_0xc5c0('0x4a')]);return db[_0xc5c0('0x6b')][_0xc5c0('0x22')]({'where':_0x2e6bba[_0xc5c0('0x47')]})[_0xc5c0('0x29')](function(_0xa2d08d){_0x2211e9[_0xc5c0('0x22')]=_0xa2d08d;if(_0x3590c6[_0xc5c0('0x3d')]['includeAll']){_0x2e6bba[_0xc5c0('0x54')]=[{'all':!![]}];}return db[_0xc5c0('0x6b')][_0xc5c0('0x4d')](_0x2e6bba);})[_0xc5c0('0x29')](function(_0xc186d){_0x2211e9[_0xc5c0('0x4e')]=_0xc186d;return _0x2211e9;});}})[_0xc5c0('0x29')](respondWithFilteredResult(_0x47e0c5,_0x2e6bba))['catch'](handleError(_0x47e0c5,null));};exports['getHopperBlacks']=function(_0x110f9f,_0x3b0ae2,_0x4cd46e){var _0x35ad44={'raw':!![],'where':{}};var _0x2e2668={};var _0x4fc5c8={'count':0x0,'rows':[]};return db[_0xc5c0('0x4b')][_0xc5c0('0x66')]({'where':{'id':_0x110f9f[_0xc5c0('0x51')]['id']}})['then'](handleEntityNotFound(_0x3b0ae2,null))[_0xc5c0('0x29')](function(_0x22eda3){if(_0x22eda3){_0x2e2668[_0xc5c0('0x3c')]=_[_0xc5c0('0x53')](db['CmHopperBlack']['rawAttributes']);_0x2e2668[_0xc5c0('0x3d')]=_[_0xc5c0('0x53')](_0x110f9f[_0xc5c0('0x3d')]);_0x2e2668[_0xc5c0('0x3e')]=_['intersection'](_0x2e2668[_0xc5c0('0x3c')],_0x2e2668[_0xc5c0('0x3d')]);_0x35ad44[_0xc5c0('0x40')]=_[_0xc5c0('0x3f')](_0x2e2668[_0xc5c0('0x3c')],qs[_0xc5c0('0x41')](_0x110f9f[_0xc5c0('0x3d')][_0xc5c0('0x41')]));_0x35ad44[_0xc5c0('0x40')]=_0x35ad44[_0xc5c0('0x40')]['length']?_0x35ad44[_0xc5c0('0x40')]:_0x2e2668[_0xc5c0('0x3c')];if(!_0x110f9f[_0xc5c0('0x3d')]['hasOwnProperty'](_0xc5c0('0x44'))){_0x35ad44['limit']=qs[_0xc5c0('0x21')](_0x110f9f[_0xc5c0('0x3d')][_0xc5c0('0x21')]);_0x35ad44['offset']=qs[_0xc5c0('0x23')](_0x110f9f[_0xc5c0('0x3d')][_0xc5c0('0x23')]);}_0x35ad44[_0xc5c0('0x45')]=qs[_0xc5c0('0x46')](_0x110f9f['query'][_0xc5c0('0x46')]);_0x35ad44[_0xc5c0('0x47')]=qs[_0xc5c0('0x3e')](_[_0xc5c0('0x48')](_0x110f9f[_0xc5c0('0x3d')],_0x2e2668['filters']));_0x35ad44[_0xc5c0('0x47')][_0xc5c0('0x67')]=_0x22eda3['id'];if(_0x110f9f[_0xc5c0('0x3d')]['filter']){_0x35ad44[_0xc5c0('0x47')]=_[_0xc5c0('0x55')](_0x35ad44[_0xc5c0('0x47')],{'$or':_[_0xc5c0('0x2f')](_0x35ad44['attributes'],function(_0xcd6e82){var _0xe80f29={};_0xe80f29[_0xcd6e82]={'$like':'%'+_0x110f9f[_0xc5c0('0x3d')]['filter']+'%'};return _0xe80f29;})});}_0x35ad44=_[_0xc5c0('0x55')]({},_0x35ad44,_0x110f9f[_0xc5c0('0x4a')]);return db[_0xc5c0('0x6c')]['count']({'where':_0x35ad44[_0xc5c0('0x47')]})['then'](function(_0x51be89){_0x4fc5c8[_0xc5c0('0x22')]=_0x51be89;if(_0x110f9f[_0xc5c0('0x3d')][_0xc5c0('0x4c')]){_0x35ad44[_0xc5c0('0x54')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc5c0('0x4d')](_0x35ad44);})[_0xc5c0('0x29')](function(_0x1c157e){_0x4fc5c8[_0xc5c0('0x4e')]=_0x1c157e;return _0x4fc5c8;});}})[_0xc5c0('0x29')](respondWithFilteredResult(_0x3b0ae2,_0x35ad44))[_0xc5c0('0x4f')](handleError(_0x3b0ae2,null));};exports[_0xc5c0('0x6d')]=function(_0x352d91,_0x2e2234,_0x16e03d){var _0x30ad23={};var _0x22e0d7={};var _0xfc0187;var _0xd4c0a8;return db[_0xc5c0('0x4b')][_0xc5c0('0x66')]({'where':{'id':_0x352d91[_0xc5c0('0x51')]['id']}})['then'](handleEntityNotFound(_0x2e2234,null))[_0xc5c0('0x29')](function(_0x4ac3c2){if(_0x4ac3c2){_0xfc0187=_0x4ac3c2;_0x22e0d7[_0xc5c0('0x3c')]=_[_0xc5c0('0x53')](db[_0xc5c0('0x6e')]['rawAttributes']);_0x22e0d7[_0xc5c0('0x3d')]=_['keys'](_0x352d91[_0xc5c0('0x3d')]);_0x22e0d7['filters']=_[_0xc5c0('0x3f')](_0x22e0d7['model'],_0x22e0d7[_0xc5c0('0x3d')]);_0x30ad23[_0xc5c0('0x40')]=_[_0xc5c0('0x3f')](_0x22e0d7[_0xc5c0('0x3c')],qs['fields'](_0x352d91[_0xc5c0('0x3d')][_0xc5c0('0x41')]));_0x30ad23['attributes']=_0x30ad23['attributes'][_0xc5c0('0x42')]?_0x30ad23[_0xc5c0('0x40')]:_0x22e0d7[_0xc5c0('0x3c')];_0x30ad23[_0xc5c0('0x45')]=qs[_0xc5c0('0x46')](_0x352d91[_0xc5c0('0x3d')][_0xc5c0('0x46')]);_0x30ad23['where']=qs[_0xc5c0('0x3e')](_[_0xc5c0('0x48')](_0x352d91[_0xc5c0('0x3d')],_0x22e0d7[_0xc5c0('0x3e')]));if(_0x352d91['query']['filter']){_0x30ad23[_0xc5c0('0x47')]=_['merge'](_0x30ad23[_0xc5c0('0x47')],{'$or':_[_0xc5c0('0x2f')](_0x30ad23['attributes'],function(_0x3d8581){var _0x33b6ff={};_0x33b6ff[_0x3d8581]={'$like':'%'+_0x352d91[_0xc5c0('0x3d')][_0xc5c0('0x2d')]+'%'};return _0x33b6ff;})});}_0x30ad23=_['merge']({},_0x30ad23,_0x352d91[_0xc5c0('0x4a')]);return _0xfc0187[_0xc5c0('0x6d')](_0x30ad23);}})[_0xc5c0('0x29')](function(_0x1924df){if(_0x1924df){_0xd4c0a8=_0x1924df[_0xc5c0('0x42')];if(!_0x352d91[_0xc5c0('0x3d')][_0xc5c0('0x43')](_0xc5c0('0x44'))){_0x30ad23['limit']=qs['limit'](_0x352d91[_0xc5c0('0x3d')][_0xc5c0('0x21')]);_0x30ad23[_0xc5c0('0x23')]=qs[_0xc5c0('0x23')](_0x352d91['query'][_0xc5c0('0x23')]);}return _0xfc0187['getTeams'](_0x30ad23);}})['then'](function(_0xf7b7dd){if(_0xf7b7dd){return _0xf7b7dd?{'count':_0xd4c0a8,'rows':_0xf7b7dd}:null;}})[_0xc5c0('0x29')](respondWithResult(_0x2e2234,null))[_0xc5c0('0x4f')](handleError(_0x2e2234,null));};exports[_0xc5c0('0x6f')]=function(_0x35dd91,_0xdb5367,_0x427860){var _0x4213e8=_0x35dd91[_0xc5c0('0x57')][_0xc5c0('0x70')];var _0x21af11=_[_0xc5c0('0x2f')](_0x4213e8,'id');return db[_0xc5c0('0x6e')][_0xc5c0('0x4d')]({'where':{'id':_0x21af11},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc5c0('0x71'),'attributes':['id',_0xc5c0('0x34'),_0xc5c0('0x72'),_0xc5c0('0x73'),_0xc5c0('0x74')],'raw':!![]}]})[_0xc5c0('0x29')](function(_0x5eeb61){if(_0x5eeb61){var _0x517201=_[_0xc5c0('0x75')](_0x5eeb61,function(_0x443c55){var _0x2a7712=_0x443c55['get']({'plain':!![]});_0x2a7712[_0xc5c0('0x71')][_0xc5c0('0x76')](function(_0x2eb6d1){_0x2eb6d1[_0xc5c0('0x77')]=_['find'](_0x4213e8,{'id':_0x2a7712['id']})['penalty'];});return _0x2a7712[_0xc5c0('0x71')];});return db['VoiceQueue'][_0xc5c0('0x32')]({'where':{'id':_0x35dd91[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](function(_0x4c730f){return db[_0xc5c0('0x78')][_0xc5c0('0x79')](function(_0x438ab1){return _0x4c730f[_0xc5c0('0x6f')](_0x21af11,{'transaction':_0x438ab1})[_0xc5c0('0x29')](function(){return BPromise['each'](_0x4213e8,function(_0x4f9abe){return db[_0xc5c0('0x7a')][_0xc5c0('0x7b')]({'TeamId':_0x4f9abe['id'],'VoiceQueueId':_0x35dd91[_0xc5c0('0x51')]['id'],'penalty':_0x4f9abe[_0xc5c0('0x77')]},{'transaction':_0x438ab1});});})[_0xc5c0('0x29')](function(){return BPromise[_0xc5c0('0x7c')](_0x517201,function(_0x2e66ab){return db[_0xc5c0('0x7d')]['findOrCreate']({'where':{'UserId':_0x2e66ab['id'],'VoiceQueueId':_0x35dd91[_0xc5c0('0x51')]['id']},'defaults':{'penalty':_0x2e66ab[_0xc5c0('0x77')]},'transaction':_0x438ab1});});})['then'](function(){return BPromise['each'](_['filter'](_0x517201,{'online':!![]}),function(_0x25b32a){return db[_0xc5c0('0x7e')][_0xc5c0('0x7b')]({'membername':_0x25b32a[_0xc5c0('0x34')],'UserId':_0x25b32a['id'],'queue_name':_0x4c730f[_0xc5c0('0x34')],'VoiceQueueId':_0x4c730f['id'],'interface':_[_0xc5c0('0x7f')](_0x25b32a['interface'])?util['format'](_0xc5c0('0x80'),_0x25b32a[_0xc5c0('0x34')]):_0x25b32a['interface'],'paused':_0x25b32a[_0xc5c0('0x73')]||![],'penalty':_0x25b32a[_0xc5c0('0x77')]},{'transaction':_0x438ab1});});})[_0xc5c0('0x29')](function(){_0x517201[_0xc5c0('0x76')](function(_0x10a713){socket['emit']('userVoiceQueue:save',{'UserId':_0x10a713['id'],'VoiceQueueId':_0x4c730f['id']});});});});});}})['then'](respondWithStatusCode(_0xdb5367,null))[_0xc5c0('0x4f')](handleError(_0xdb5367,null));};exports['removeTeams']=function(_0x418d6b,_0x4cb2cf,_0x33c811){return db[_0xc5c0('0x6e')][_0xc5c0('0x4d')]({'where':{'id':_0x418d6b[_0xc5c0('0x3d')][_0xc5c0('0x81')]},'attributes':['id'],'include':[{'model':db[_0xc5c0('0x82')],'as':_0xc5c0('0x71'),'attributes':['id'],'raw':!![]}]})[_0xc5c0('0x29')](handleEntityNotFound(_0x4cb2cf,null))['then'](function(_0x1a5f88){var _0x463818=_[_0xc5c0('0x2f')](_0x1a5f88,'id');var _0xf6454c=[];var _0x37b1f9=[];var _0x52daf9=squel[_0xc5c0('0x83')]();_0x52daf9[_0xc5c0('0x84')](_0xc5c0('0x85'))['from'](_0xc5c0('0x86'),'tq')['join'](_0xc5c0('0x87'),'ut',_0xc5c0('0x88'))['where'](_0xc5c0('0x89'),_0x418d6b[_0xc5c0('0x51')]['id']);for(var _0x4e6669=0x0;_0x4e6669<_0x1a5f88[_0xc5c0('0x42')];_0x4e6669+=0x1){let _0x7b45aa=_0x1a5f88[_0x4e6669];for(var _0x3aaeb7=0x0;_0x3aaeb7<_0x7b45aa[_0xc5c0('0x71')][_0xc5c0('0x42')];_0x3aaeb7+=0x1){let _0x4e0147=_0x7b45aa[_0xc5c0('0x71')][_0x3aaeb7];var _0x38cebb=_0x52daf9[_0xc5c0('0x5f')]();_0x38cebb[_0xc5c0('0x47')]('ut.UserId\x20=\x20?',_0x4e0147['id']);_0x37b1f9[_0xc5c0('0x8a')](db['sequelize'][_0xc5c0('0x3d')](_0x38cebb[_0xc5c0('0x8b')](),{'type':db[_0xc5c0('0x78')][_0xc5c0('0x8c')][_0xc5c0('0x8d')]})[_0xc5c0('0x29')](function(_0x3280ee){if(_0x3280ee[_0xc5c0('0x42')]===0x1){return _0x4e0147['id'];}else{var _0x1777b4=_['every'](_['map'](_0x3280ee,_0xc5c0('0x8e')),function(_0x2c6c79){return _['includes'](_0x463818,_0x2c6c79);});if(_0x1777b4){return _0x4e0147['id'];}}}));}}return BPromise[_0xc5c0('0x8f')](_0x37b1f9)[_0xc5c0('0x29')](function(_0xee024f){_0xf6454c=_(_0xf6454c)['union'](_0xee024f)[_0xc5c0('0x90')]()[_0xc5c0('0x33')]();return db['VoiceQueue'][_0xc5c0('0x32')]({'where':{'id':_0x418d6b[_0xc5c0('0x51')]['id']}})['then'](function(_0x5f2e87){return db[_0xc5c0('0x78')][_0xc5c0('0x79')](function(_0x26b44b){return _0x5f2e87[_0xc5c0('0x91')](_0x418d6b[_0xc5c0('0x3d')][_0xc5c0('0x81')],{'transaction':_0x26b44b})[_0xc5c0('0x29')](function(){if(!_['isEmpty'](_0xf6454c)){return _0x5f2e87[_0xc5c0('0x92')](_0xf6454c,{'transaction':_0x26b44b})[_0xc5c0('0x29')](function(){return db[_0xc5c0('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x418d6b['params']['id'],'UserId':_0xf6454c},'transaction':_0x26b44b});});}})[_0xc5c0('0x29')](function(){_0xf6454c[_0xc5c0('0x76')](function(_0x190ec0){socket[_0xc5c0('0x93')](_0xc5c0('0x94'),{'UserId':_0x190ec0,'VoiceQueueId':_0x5f2e87['id']});});});});});});})[_0xc5c0('0x29')](respondWithStatusCode(_0x4cb2cf,null))[_0xc5c0('0x4f')](handleError(_0x4cb2cf,null));};exports['addAgents']=function(_0x41934b,_0x391400,_0x4e5958){var _0xcb62a4,_0x41af88;return db[_0xc5c0('0x4b')][_0xc5c0('0x32')]({'where':{'id':_0x41934b[_0xc5c0('0x51')]['id']}})['then'](handleEntityNotFound(_0x391400,null))[_0xc5c0('0x29')](function(_0x306a61){if(_0x306a61){_0x41af88=_0x306a61;return _0x306a61[_0xc5c0('0x95')](_0x41934b['body'][_0xc5c0('0x81')],_[_0xc5c0('0x60')](_0x41934b['body'],['ids','id'])||{})[_0xc5c0('0x96')](function(_0x396c1d){for(var _0xced41b=0x0;_0xced41b<_0x41934b['body'][_0xc5c0('0x81')][_0xc5c0('0x42')];_0xced41b+=0x1){socket[_0xc5c0('0x93')]('userVoiceQueue:save',{'UserId':Number(_0x41934b[_0xc5c0('0x57')][_0xc5c0('0x81')][_0xced41b]),'VoiceQueueId':Number(_0x41934b[_0xc5c0('0x51')]['id'])});}return _0x396c1d;});}})['then'](function(_0x36065b){_0xcb62a4=_0x36065b||[];if(_0x41af88){return db[_0xc5c0('0x82')][_0xc5c0('0x4d')]({'where':{'id':_0x41934b[_0xc5c0('0x57')][_0xc5c0('0x81')]},'attributes':['id',_0xc5c0('0x34'),'online',_0xc5c0('0x73'),'interface'],'raw':!![]});}})['then'](function(_0x3236f6){if(!_['isEmpty'](_0x3236f6)){var _0x18c06a=[];for(var _0x345fe6=0x0;_0x345fe6<_0x3236f6['length'];_0x345fe6++){if(_0x3236f6[_0x345fe6]['online']){_0x18c06a[_0xc5c0('0x8a')](db[_0xc5c0('0x7e')][_0xc5c0('0x7b')]({'membername':_0x3236f6[_0x345fe6]['name'],'UserId':_0x3236f6[_0x345fe6]['id'],'queue_name':_0x41af88[_0xc5c0('0x34')],'VoiceQueueId':_0x41af88['id'],'interface':_[_0xc5c0('0x7f')](_0x3236f6[_0x345fe6][_0xc5c0('0x74')])?util['format'](_0xc5c0('0x80'),_0x3236f6[_0x345fe6][_0xc5c0('0x34')]):_0x3236f6[_0x345fe6][_0xc5c0('0x74')],'paused':_0x3236f6[_0x345fe6]['voicePause']||![],'penalty':_0x41934b[_0xc5c0('0x57')][_0xc5c0('0x77')]||0x0}));}}return BPromise['all'](_0x18c06a);}})[_0xc5c0('0x29')](function(){return _0xcb62a4;})[_0xc5c0('0x29')](respondWithResult(_0x391400,null))[_0xc5c0('0x4f')](handleError(_0x391400,null));};exports[_0xc5c0('0x92')]=function(_0x5f35c5,_0x5d92ed,_0x161c5c){return db[_0xc5c0('0x4b')][_0xc5c0('0x32')]({'where':{'id':_0x5f35c5['params']['id']}})['then'](handleEntityNotFound(_0x5d92ed,null))[_0xc5c0('0x29')](function(_0x49077b){if(_0x49077b){return _0x49077b[_0xc5c0('0x92')](_0x5f35c5[_0xc5c0('0x3d')]['ids'])[_0xc5c0('0x29')](function(){if(_[_0xc5c0('0x97')](_0x5f35c5[_0xc5c0('0x3d')][_0xc5c0('0x81')])){for(var _0x449000=0x0;_0x449000<_0x5f35c5['query']['ids'][_0xc5c0('0x42')];_0x449000+=0x1){socket[_0xc5c0('0x93')](_0xc5c0('0x94'),{'UserId':Number(_0x5f35c5[_0xc5c0('0x3d')]['ids'][_0x449000]),'VoiceQueueId':Number(_0x5f35c5[_0xc5c0('0x51')]['id'])});}}else{socket[_0xc5c0('0x93')](_0xc5c0('0x94'),{'UserId':Number(_0x5f35c5[_0xc5c0('0x3d')][_0xc5c0('0x81')]),'VoiceQueueId':Number(_0x5f35c5['params']['id'])});}});}})[_0xc5c0('0x29')](function(_0x4e3b43){return db[_0xc5c0('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x5f35c5[_0xc5c0('0x51')]['id'],'UserId':_0x5f35c5[_0xc5c0('0x3d')][_0xc5c0('0x81')]}})[_0xc5c0('0x29')](function(){return _0x4e3b43;});})[_0xc5c0('0x29')](respondWithStatusCode(_0x5d92ed,null))['catch'](handleError(_0x5d92ed,null));};exports[_0xc5c0('0x98')]=function(_0x442b37,_0x54e315,_0x2b8e23){var _0x56acd3={};var _0xf53f15={};var _0x1e6ab8;var _0x23f16f;return db['VoiceQueue'][_0xc5c0('0x66')]({'where':{'id':_0x442b37[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x54e315,null))['then'](function(_0x45cec0){if(_0x45cec0){_0x1e6ab8=_0x45cec0;_0xf53f15[_0xc5c0('0x3c')]=_[_0xc5c0('0x53')](db[_0xc5c0('0x82')][_0xc5c0('0x52')]);_0xf53f15['query']=_[_0xc5c0('0x53')](_0x442b37['query']);_0xf53f15['filters']=_[_0xc5c0('0x3f')](_0xf53f15[_0xc5c0('0x3c')],_0xf53f15[_0xc5c0('0x3d')]);_0x56acd3[_0xc5c0('0x40')]=_['intersection'](_0xf53f15['model'],qs[_0xc5c0('0x41')](_0x442b37[_0xc5c0('0x3d')]['fields']));_0x56acd3[_0xc5c0('0x40')]=_0x56acd3[_0xc5c0('0x40')]['length']?_0x56acd3[_0xc5c0('0x40')]:_0xf53f15[_0xc5c0('0x3c')];_0x56acd3['order']=qs['sort'](_0x442b37[_0xc5c0('0x3d')][_0xc5c0('0x46')]);_0x56acd3['where']=qs[_0xc5c0('0x3e')](_[_0xc5c0('0x48')](_0x442b37[_0xc5c0('0x3d')],_0xf53f15[_0xc5c0('0x3e')]));if(_0x442b37['query'][_0xc5c0('0x2d')]){_0x56acd3['where']=_[_0xc5c0('0x55')](_0x56acd3[_0xc5c0('0x47')],{'$or':_[_0xc5c0('0x2f')](_0x56acd3['attributes'],function(_0x5e9cda){var _0xd16be6={};_0xd16be6[_0x5e9cda]={'$like':'%'+_0x442b37[_0xc5c0('0x3d')][_0xc5c0('0x2d')]+'%'};return _0xd16be6;})});}_0x56acd3=_[_0xc5c0('0x55')]({},_0x56acd3,_0x442b37[_0xc5c0('0x4a')]);return _0x1e6ab8[_0xc5c0('0x98')](_0x56acd3);}})['then'](function(_0xab683d){if(_0xab683d){_0x23f16f=_0xab683d[_0xc5c0('0x42')];if(!_0x442b37['query'][_0xc5c0('0x43')](_0xc5c0('0x44'))){_0x56acd3[_0xc5c0('0x21')]=qs[_0xc5c0('0x21')](_0x442b37[_0xc5c0('0x3d')]['limit']);_0x56acd3[_0xc5c0('0x23')]=qs[_0xc5c0('0x23')](_0x442b37[_0xc5c0('0x3d')][_0xc5c0('0x23')]);}return _0x1e6ab8[_0xc5c0('0x98')](_0x56acd3);}})[_0xc5c0('0x29')](function(_0x16a5b2){if(_0x16a5b2){return _0x16a5b2?{'count':_0x23f16f,'rows':_0x16a5b2}:null;}})['then'](respondWithResult(_0x54e315,null))['catch'](handleError(_0x54e315,null));};exports[_0xc5c0('0x99')]=function(_0x3dfc6e,_0x787537,_0x5e4dac){var _0x3993e9={};var _0x50eb0d={};var _0x48e98c;var _0x50ddd0;return db[_0xc5c0('0x4b')][_0xc5c0('0x66')]({'where':{'id':_0x3dfc6e['params']['id']}})['then'](handleEntityNotFound(_0x787537,null))[_0xc5c0('0x29')](function(_0x325d54){if(_0x325d54){_0x48e98c=_0x325d54;_0x50eb0d[_0xc5c0('0x3c')]=_['keys'](db['UserVoiceQueueRt'][_0xc5c0('0x52')]);_0x50eb0d[_0xc5c0('0x3d')]=_[_0xc5c0('0x53')](_0x3dfc6e[_0xc5c0('0x3d')]);_0x50eb0d[_0xc5c0('0x3e')]=_['intersection'](_0x50eb0d[_0xc5c0('0x3c')],_0x50eb0d['query']);_0x3993e9['attributes']=_[_0xc5c0('0x3f')](_0x50eb0d['model'],qs[_0xc5c0('0x41')](_0x3dfc6e[_0xc5c0('0x3d')][_0xc5c0('0x41')]));_0x3993e9['attributes']=_0x3993e9[_0xc5c0('0x40')][_0xc5c0('0x42')]?_0x3993e9[_0xc5c0('0x40')]:_0x50eb0d['model'];_0x3993e9[_0xc5c0('0x45')]=qs['sort'](_0x3dfc6e[_0xc5c0('0x3d')][_0xc5c0('0x46')]);_0x3993e9[_0xc5c0('0x47')]=qs[_0xc5c0('0x3e')](_[_0xc5c0('0x48')](_0x3dfc6e[_0xc5c0('0x3d')],_0x50eb0d[_0xc5c0('0x3e')]));if(_0x3dfc6e['query']['filter']){_0x3993e9[_0xc5c0('0x47')]=_[_0xc5c0('0x55')](_0x3993e9[_0xc5c0('0x47')],{'$or':_[_0xc5c0('0x2f')](_0x3993e9[_0xc5c0('0x40')],function(_0x344612){var _0x438760={};_0x438760[_0x344612]={'$like':'%'+_0x3dfc6e['query'][_0xc5c0('0x2d')]+'%'};return _0x438760;})});}_0x3993e9=_[_0xc5c0('0x55')]({},_0x3993e9,_0x3dfc6e[_0xc5c0('0x4a')]);return _0x48e98c[_0xc5c0('0x99')](_0x3993e9);}})[_0xc5c0('0x29')](function(_0x4e68e5){if(_0x4e68e5){_0x50ddd0=_0x4e68e5[_0xc5c0('0x42')];if(!_0x3dfc6e['query'][_0xc5c0('0x43')](_0xc5c0('0x44'))){_0x3993e9['limit']=qs['limit'](_0x3dfc6e[_0xc5c0('0x3d')][_0xc5c0('0x21')]);_0x3993e9[_0xc5c0('0x23')]=qs['offset'](_0x3dfc6e[_0xc5c0('0x3d')]['offset']);}return _0x48e98c[_0xc5c0('0x99')](_0x3993e9);}})['then'](function(_0x50a96e){return _0x50a96e?{'count':_0x50ddd0,'rows':_0x50a96e}:null;})['then'](respondWithResult(_0x787537,null))[_0xc5c0('0x4f')](handleError(_0x787537,null));};exports[_0xc5c0('0x9a')]=function(_0x21236b,_0xdbe851,_0x128c66){var _0x3fd838={};var _0x4ea024={};var _0x29c0d8;var _0x500a0b;return db[_0xc5c0('0x4b')][_0xc5c0('0x66')]({'where':{'id':_0x21236b[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0xdbe851,null))[_0xc5c0('0x29')](function(_0x5f4de7){if(_0x5f4de7){_0x29c0d8=_0x5f4de7;_0x4ea024[_0xc5c0('0x3c')]=_[_0xc5c0('0x53')](db[_0xc5c0('0x9b')][_0xc5c0('0x52')]);_0x4ea024['query']=_[_0xc5c0('0x53')](_0x21236b['query']);_0x4ea024['filters']=_[_0xc5c0('0x3f')](_0x4ea024[_0xc5c0('0x3c')],_0x4ea024['query']);_0x3fd838[_0xc5c0('0x40')]=_['intersection'](_0x4ea024['model'],qs['fields'](_0x21236b[_0xc5c0('0x3d')][_0xc5c0('0x41')]));_0x3fd838['attributes']=_0x3fd838[_0xc5c0('0x40')][_0xc5c0('0x42')]?_0x3fd838[_0xc5c0('0x40')]:_0x4ea024[_0xc5c0('0x3c')];_0x3fd838[_0xc5c0('0x45')]=qs[_0xc5c0('0x46')](_0x21236b[_0xc5c0('0x3d')][_0xc5c0('0x46')]);_0x3fd838[_0xc5c0('0x47')]=qs[_0xc5c0('0x3e')](_[_0xc5c0('0x48')](_0x21236b['query'],_0x4ea024[_0xc5c0('0x3e')]));if(_0x21236b[_0xc5c0('0x3d')][_0xc5c0('0x2d')]){_0x3fd838['where']=_['merge'](_0x3fd838[_0xc5c0('0x47')],{'$or':_['map'](_0x3fd838[_0xc5c0('0x40')],function(_0x1aab96){var _0x1cab64={};_0x1cab64[_0x1aab96]={'$like':'%'+_0x21236b[_0xc5c0('0x3d')][_0xc5c0('0x2d')]+'%'};return _0x1cab64;})});}_0x3fd838=_[_0xc5c0('0x55')]({},_0x3fd838,_0x21236b['options']);return _0x29c0d8[_0xc5c0('0x9a')](_0x3fd838);}})[_0xc5c0('0x29')](function(_0x172d12){if(_0x172d12){_0x500a0b=_0x172d12[_0xc5c0('0x42')];if(!_0x21236b[_0xc5c0('0x3d')][_0xc5c0('0x43')]('nolimit')){_0x3fd838['limit']=qs[_0xc5c0('0x21')](_0x21236b[_0xc5c0('0x3d')][_0xc5c0('0x21')]);_0x3fd838[_0xc5c0('0x23')]=qs[_0xc5c0('0x23')](_0x21236b[_0xc5c0('0x3d')][_0xc5c0('0x23')]);}return _0x29c0d8[_0xc5c0('0x9a')](_0x3fd838);}})['then'](function(_0x38bc37){if(_0x38bc37){return _0x38bc37?{'count':_0x500a0b,'rows':_0x38bc37}:null;}})[_0xc5c0('0x29')](respondWithResult(_0xdbe851,null))['catch'](handleError(_0xdbe851,null));};exports[_0xc5c0('0x9c')]=function(_0x32ca09,_0x505ef6,_0x3d7cf5){var _0x11858c,_0x11186a;return db[_0xc5c0('0x4b')][_0xc5c0('0x32')]({'where':{'id':_0x32ca09[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x505ef6,null))['then'](function(_0x285880){if(_0x285880){_0x11186a=_0x285880;return _0x285880[_0xc5c0('0x9c')](_0x32ca09[_0xc5c0('0x57')]['ids'],_[_0xc5c0('0x60')](_0x32ca09[_0xc5c0('0x57')],[_0xc5c0('0x81'),'id'])||{});}return null;})[_0xc5c0('0x96')](function(_0x514630){var _0x1df6e1;_0x11858c=_0x514630||[];var _0x20a4b4=[];if(_0x514630){for(var _0x36f59a=0x0;_0x36f59a<_0x514630[_0xc5c0('0x42')];_0x36f59a+=0x1){var _0x2821c6=_0x514630[_0x36f59a]['get']({'plain':!![]});_0x11186a[_0xc5c0('0x9d')]=_0x32ca09['body'][_0xc5c0('0x9d')]?_0x32ca09[_0xc5c0('0x57')]['dialCheckDuplicateType']:_0x11186a[_0xc5c0('0x9d')];switch(_0x11186a['dialCheckDuplicateType']){case _0xc5c0('0x9e'):_0x1df6e1=squel['insert']()[_0xc5c0('0x9f')](_0xc5c0('0xa0'))['fromQuery']([_0xc5c0('0xa1'),_0xc5c0('0xa2'),'ContactId',_0xc5c0('0xa3'),'VoiceQueueId',_0xc5c0('0x61'),'updatedAt'],squel[_0xc5c0('0x83')]()[_0xc5c0('0x84')](_0xc5c0('0xa1'),_0xc5c0('0xa1'))[_0xc5c0('0x84')](_0xc5c0('0xa4'),_0xc5c0('0xa2'))[_0xc5c0('0x84')]('id',_0xc5c0('0xa5'))['field'](_0x2821c6[_0xc5c0('0xa6')][_0xc5c0('0x8b')](),_0xc5c0('0xa3'))[_0xc5c0('0x84')](_0x32ca09['params']['id']['toString'](),_0xc5c0('0x67'))[_0xc5c0('0x84')](_0xc5c0('0xa4'),'createdAt')[_0xc5c0('0x84')](_0xc5c0('0xa4'),_0xc5c0('0x62'))[_0xc5c0('0xa7')]('cm_contacts')[_0xc5c0('0x47')]('deletedAt\x20IS\x20NULL')[_0xc5c0('0x47')](_0xc5c0('0xa8'),_0x2821c6[_0xc5c0('0xa6')][_0xc5c0('0x8b')]())[_0xc5c0('0x47')](_0xc5c0('0xa9'))[_0xc5c0('0x47')](_0xc5c0('0xaa'),squel[_0xc5c0('0x83')]()[_0xc5c0('0x84')]('COALESCE(calleridnum,\x27\x27)')[_0xc5c0('0xa7')](_0xc5c0('0xab'))[_0xc5c0('0x47')](_0xc5c0('0x89'),_0x32ca09[_0xc5c0('0x51')]['id']['toString']()))[_0xc5c0('0x47')](_0xc5c0('0xaa'),squel[_0xc5c0('0x83')]()[_0xc5c0('0x84')](_0xc5c0('0xac'))[_0xc5c0('0xa7')](_0xc5c0('0xa0'))[_0xc5c0('0x47')]('VoiceQueueId\x20=\x20?',_0x32ca09[_0xc5c0('0x51')]['id'][_0xc5c0('0x8b')]())))[_0xc5c0('0x8b')]();break;case _0xc5c0('0xad'):_0x1df6e1=squel[_0xc5c0('0xae')]()[_0xc5c0('0x9f')](_0xc5c0('0xa0'))[_0xc5c0('0xaf')]([_0xc5c0('0xa1'),'scheduledAt',_0xc5c0('0xa5'),'ListId','VoiceQueueId','createdAt',_0xc5c0('0x62')],squel['select']()['field'](_0xc5c0('0xa1'),_0xc5c0('0xa1'))['field'](_0xc5c0('0xa4'),_0xc5c0('0xa2'))['field']('id',_0xc5c0('0xa5'))[_0xc5c0('0x84')](_0x2821c6[_0xc5c0('0xa6')][_0xc5c0('0x8b')](),_0xc5c0('0xa3'))[_0xc5c0('0x84')](_0x32ca09[_0xc5c0('0x51')]['id'][_0xc5c0('0x8b')](),_0xc5c0('0x67'))[_0xc5c0('0x84')](_0xc5c0('0xa4'),_0xc5c0('0x61'))[_0xc5c0('0x84')](_0xc5c0('0xa4'),_0xc5c0('0x62'))[_0xc5c0('0xa7')](_0xc5c0('0xb0'))['where'](_0xc5c0('0xb1'))[_0xc5c0('0x47')]('ListId\x20=\x20?',_0x2821c6['CmListId'][_0xc5c0('0x8b')]())[_0xc5c0('0x47')](_0xc5c0('0xa9'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xc5c0('0x83')]()[_0xc5c0('0x84')](_0xc5c0('0xac'))['from'](_0xc5c0('0xa0'))[_0xc5c0('0x47')](_0xc5c0('0x89'),_0x32ca09[_0xc5c0('0x51')]['id'][_0xc5c0('0x8b')]())))[_0xc5c0('0x8b')]();break;default:_0x1df6e1=squel[_0xc5c0('0xae')]()[_0xc5c0('0x9f')](_0xc5c0('0xa0'))[_0xc5c0('0xaf')](['phone',_0xc5c0('0xa2'),'ContactId','ListId',_0xc5c0('0x67'),'createdAt',_0xc5c0('0x62')],squel['select']()[_0xc5c0('0x84')](_0xc5c0('0xa1'),'phone')[_0xc5c0('0x84')]('NOW()',_0xc5c0('0xa2'))[_0xc5c0('0x84')]('id','ContactId')[_0xc5c0('0x84')](_0x2821c6[_0xc5c0('0xa6')]['toString'](),_0xc5c0('0xa3'))[_0xc5c0('0x84')](_0x32ca09[_0xc5c0('0x51')]['id'][_0xc5c0('0x8b')](),_0xc5c0('0x67'))['field'](_0xc5c0('0xa4'),_0xc5c0('0x61'))['field'](_0xc5c0('0xa4'),_0xc5c0('0x62'))['from'](_0xc5c0('0xb0'))[_0xc5c0('0x47')]('deletedAt\x20IS\x20NULL')['where'](_0xc5c0('0xa8'),_0x2821c6[_0xc5c0('0xa6')][_0xc5c0('0x8b')]())[_0xc5c0('0x47')](_0xc5c0('0xa9')))['toString']();}_0x20a4b4[_0xc5c0('0x8a')](db[_0xc5c0('0x78')]['query'](_0x1df6e1));}return BPromise[_0xc5c0('0x8f')](_0x20a4b4);}})['then'](function(){return _0x11858c;})[_0xc5c0('0x29')](respondWithResult(_0x505ef6,null))['catch'](handleError(_0x505ef6,null));};exports['removeLists']=function(_0x3a3efb,_0x58b26c,_0x169f3a){return db[_0xc5c0('0x4b')]['find']({'where':{'id':_0x3a3efb[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x58b26c,null))[_0xc5c0('0x29')](function(_0x3b6032){if(_0x3b6032){return _0x3b6032[_0xc5c0('0xb2')](_0x3a3efb['query'][_0xc5c0('0x81')]);}})[_0xc5c0('0x29')](function(_0x4e7bfb){if(_0x4e7bfb){return db[_0xc5c0('0x68')]['destroy']({'where':{'ListId':_0x3a3efb[_0xc5c0('0x3d')]['ids'],'VoiceQueueId':_0x3a3efb['params']['id']}})[_0xc5c0('0x29')](function(){return _0x4e7bfb;});}})[_0xc5c0('0x29')](respondWithStatusCode(_0x58b26c,null))[_0xc5c0('0x4f')](handleError(_0x58b26c,null));};exports[_0xc5c0('0xb3')]=function(_0xb2d282,_0x3d2e6a,_0x3f3731){var _0x5ad59f={};var _0x2bd005={};var _0x48aebc;var _0x4dd9b8;return db[_0xc5c0('0x4b')][_0xc5c0('0x66')]({'where':{'id':_0xb2d282[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x3d2e6a,null))[_0xc5c0('0x29')](function(_0x10ca5a){if(_0x10ca5a){_0x48aebc=_0x10ca5a;_0x2bd005[_0xc5c0('0x3c')]=_['keys'](db[_0xc5c0('0x9b')][_0xc5c0('0x52')]);_0x2bd005[_0xc5c0('0x3d')]=_[_0xc5c0('0x53')](_0xb2d282[_0xc5c0('0x3d')]);_0x2bd005['filters']=_[_0xc5c0('0x3f')](_0x2bd005[_0xc5c0('0x3c')],_0x2bd005[_0xc5c0('0x3d')]);_0x5ad59f[_0xc5c0('0x40')]=_[_0xc5c0('0x3f')](_0x2bd005[_0xc5c0('0x3c')],qs[_0xc5c0('0x41')](_0xb2d282['query'][_0xc5c0('0x41')]));_0x5ad59f[_0xc5c0('0x40')]=_0x5ad59f[_0xc5c0('0x40')][_0xc5c0('0x42')]?_0x5ad59f[_0xc5c0('0x40')]:_0x2bd005[_0xc5c0('0x3c')];_0x5ad59f[_0xc5c0('0x45')]=qs[_0xc5c0('0x46')](_0xb2d282['query'][_0xc5c0('0x46')]);_0x5ad59f[_0xc5c0('0x47')]=qs[_0xc5c0('0x3e')](_[_0xc5c0('0x48')](_0xb2d282[_0xc5c0('0x3d')],_0x2bd005['filters']));if(_0xb2d282[_0xc5c0('0x3d')][_0xc5c0('0x2d')]){_0x5ad59f['where']=_[_0xc5c0('0x55')](_0x5ad59f[_0xc5c0('0x47')],{'$or':_[_0xc5c0('0x2f')](_0x5ad59f[_0xc5c0('0x40')],function(_0x341cbc){var _0x3c6e3d={};_0x3c6e3d[_0x341cbc]={'$like':'%'+_0xb2d282[_0xc5c0('0x3d')][_0xc5c0('0x2d')]+'%'};return _0x3c6e3d;})});}_0x5ad59f=_['merge']({},_0x5ad59f,_0xb2d282['options']);return _0x48aebc[_0xc5c0('0xb3')](_0x5ad59f);}})[_0xc5c0('0x29')](function(_0x23377c){if(_0x23377c){_0x4dd9b8=_0x23377c['length'];if(!_0xb2d282[_0xc5c0('0x3d')][_0xc5c0('0x43')]('nolimit')){_0x5ad59f[_0xc5c0('0x21')]=qs['limit'](_0xb2d282[_0xc5c0('0x3d')][_0xc5c0('0x21')]);_0x5ad59f[_0xc5c0('0x23')]=qs[_0xc5c0('0x23')](_0xb2d282[_0xc5c0('0x3d')][_0xc5c0('0x23')]);}return _0x48aebc['getBlackLists'](_0x5ad59f);}})[_0xc5c0('0x29')](function(_0x59d3cf){if(_0x59d3cf){return _0x59d3cf?{'count':_0x4dd9b8,'rows':_0x59d3cf}:null;}})[_0xc5c0('0x29')](respondWithResult(_0x3d2e6a,null))['catch'](handleError(_0x3d2e6a,null));};exports[_0xc5c0('0xb4')]=function(_0x3010b1,_0x4b5565,_0x37269f){var _0x32de47,_0x5ec6f0;return db[_0xc5c0('0x4b')][_0xc5c0('0x32')]({'where':{'id':_0x3010b1[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0x4b5565,null))[_0xc5c0('0x29')](function(_0xa24dc1){if(_0xa24dc1){_0x5ec6f0=_0xa24dc1;return _0xa24dc1[_0xc5c0('0xb4')](_0x3010b1[_0xc5c0('0x57')]['ids'],_[_0xc5c0('0x60')](_0x3010b1[_0xc5c0('0x57')],[_0xc5c0('0x81'),'id'])||{});}return null;})[_0xc5c0('0x96')](function(_0x548d9e){var _0x1a576e;_0x32de47=_0x548d9e||[];var _0x170bb8=[];if(_0x548d9e){for(var _0x3c1424=0x0;_0x3c1424<_0x548d9e[_0xc5c0('0x42')];_0x3c1424+=0x1){var _0x392c2d=_0x548d9e[_0x3c1424]['get']({'plain':!![]});_0x1a576e=squel[_0xc5c0('0xae')]()[_0xc5c0('0x9f')](_0xc5c0('0xb5'))['fromQuery']([_0xc5c0('0xa1'),_0xc5c0('0xa5'),_0xc5c0('0xa3'),_0xc5c0('0x67'),_0xc5c0('0x61'),_0xc5c0('0x62')],squel[_0xc5c0('0x83')]()[_0xc5c0('0x84')](_0xc5c0('0xa1'),_0xc5c0('0xa1'))[_0xc5c0('0x84')]('id','ContactId')[_0xc5c0('0x84')](_0x392c2d[_0xc5c0('0xa6')][_0xc5c0('0x8b')](),_0xc5c0('0xa3'))[_0xc5c0('0x84')](_0x3010b1['params']['id'][_0xc5c0('0x8b')](),_0xc5c0('0x67'))[_0xc5c0('0x84')]('NOW()',_0xc5c0('0x61'))['field'](_0xc5c0('0xa4'),_0xc5c0('0x62'))[_0xc5c0('0xa7')](_0xc5c0('0xb0'))[_0xc5c0('0x47')](_0xc5c0('0xb1'))[_0xc5c0('0x47')](_0xc5c0('0xa8'),_0x392c2d[_0xc5c0('0xa6')][_0xc5c0('0x8b')]())[_0xc5c0('0x47')](_0xc5c0('0xa9')))[_0xc5c0('0x8b')]();_0x170bb8[_0xc5c0('0x8a')](db[_0xc5c0('0x78')][_0xc5c0('0x3d')](_0x1a576e));}return BPromise[_0xc5c0('0x8f')](_0x170bb8);}})[_0xc5c0('0x29')](function(){return _0x32de47;})['then'](respondWithResult(_0x4b5565,null))['catch'](handleError(_0x4b5565,null));};exports[_0xc5c0('0xb6')]=function(_0x11064a,_0xf579c4,_0x322738){return db[_0xc5c0('0x4b')][_0xc5c0('0x32')]({'where':{'id':_0x11064a[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](handleEntityNotFound(_0xf579c4,null))[_0xc5c0('0x29')](function(_0x4b0840){if(_0x4b0840){return _0x4b0840[_0xc5c0('0xb6')](_0x11064a[_0xc5c0('0x3d')][_0xc5c0('0x81')]);}})[_0xc5c0('0x29')](function(_0x2d730a){if(_0x2d730a){return db[_0xc5c0('0x6c')][_0xc5c0('0x28')]({'where':{'ListId':_0x11064a[_0xc5c0('0x3d')][_0xc5c0('0x81')],'VoiceQueueId':_0x11064a[_0xc5c0('0x51')]['id']}})[_0xc5c0('0x29')](function(){return _0x2d730a;});}})[_0xc5c0('0x29')](respondWithStatusCode(_0xf579c4,null))[_0xc5c0('0x4f')](handleError(_0xf579c4,null));}; \ No newline at end of file +var _0x0615=['SELECT','every','includes','all','compact','transaction','isEmpty','removeAgents','UserVoiceQueueRt','addAgents','spread','isNil','SIP/%s','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','phone','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','scheduledAt','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','QueueCampaigns','outbound','filter','ignore','map','type','find','name','destroy','error','stack','index','VoiceQueue','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','inbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','omit','createdAt','updatedAt','merge','value','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','addTeams','Team','online','voicePause','flatMap','Agents','forEach','sequelize','each','TeamVoiceQueue','penalty','UserVoiceQueue','upsert','format','interface','emit','removeTeams','ids','User','field','from','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes'];(function(_0x5c3bdd,_0x8444f9){var _0xaee41e=function(_0x50c621){while(--_0x50c621){_0x5c3bdd['push'](_0x5c3bdd['shift']());}};_0xaee41e(++_0x8444f9);}(_0x0615,0x19e));var _0x5061=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0615[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x5061('0x0'));var rimraf=require(_0x5061('0x1'));var zipdir=require(_0x5061('0x2'));var jsonpatch=require(_0x5061('0x3'));var rp=require(_0x5061('0x4'));var moment=require('moment');var BPromise=require(_0x5061('0x5'));var Mustache=require(_0x5061('0x6'));var util=require(_0x5061('0x7'));var path=require(_0x5061('0x8'));var sox=require(_0x5061('0x9'));var csv=require(_0x5061('0xa'));var ejs=require(_0x5061('0xb'));var fs=require('fs');var fs_extra=require(_0x5061('0xc'));var _=require(_0x5061('0xd'));var squel=require(_0x5061('0xe'));var crypto=require(_0x5061('0xf'));var jsforce=require(_0x5061('0x10'));var deskjs=require(_0x5061('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5061('0x12'));var Papa=require(_0x5061('0x13'));var Redis=require(_0x5061('0x14'));var authService=require(_0x5061('0x15'));var qs=require(_0x5061('0x16'));var as=require(_0x5061('0x17'));var hardwareService=require(_0x5061('0x18'));var logger=require(_0x5061('0x19'))(_0x5061('0x1a'));var utils=require(_0x5061('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x5061('0x1c'));var db=require(_0x5061('0x1d'))['db'];config[_0x5061('0x1e')]=_['defaults'](config[_0x5061('0x1e')],{'host':_0x5061('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5061('0x20'))['register'](socket);function respondWithStatusCode(_0x45df5c,_0x3be70c){_0x3be70c=_0x3be70c||0xcc;return function(_0x583b2f){if(_0x583b2f){return _0x45df5c[_0x5061('0x21')](_0x3be70c);}return _0x45df5c[_0x5061('0x22')](_0x3be70c)[_0x5061('0x23')]();};}function respondWithResult(_0x2703d9,_0x4bcda4){_0x4bcda4=_0x4bcda4||0xc8;return function(_0x3532cf){if(_0x3532cf){return _0x2703d9[_0x5061('0x22')](_0x4bcda4)['json'](_0x3532cf);}};}function respondWithFilteredResult(_0x299dcb,_0x5a55e7){return function(_0x265a8f){if(_0x265a8f){var _0x43d590=typeof _0x5a55e7[_0x5061('0x24')]===_0x5061('0x25')&&typeof _0x5a55e7[_0x5061('0x26')]===_0x5061('0x25');var _0x38e217=_0x265a8f['count'];var _0x4551c3=_0x43d590?0x0:_0x5a55e7[_0x5061('0x24')];var _0x40d0b5=_0x43d590?_0x265a8f[_0x5061('0x27')]:_0x5a55e7[_0x5061('0x24')]+_0x5a55e7['limit'];var _0x13d6ed;if(_0x40d0b5>=_0x38e217){_0x40d0b5=_0x38e217;_0x13d6ed=0xc8;}else{_0x13d6ed=0xce;}_0x299dcb['status'](_0x13d6ed);return _0x299dcb[_0x5061('0x28')]('Content-Range',_0x4551c3+'-'+_0x40d0b5+'/'+_0x38e217)[_0x5061('0x29')](_0x265a8f);}return null;};}function patchUpdates(_0xecfb82){return function(_0x5e4ddc){try{jsonpatch[_0x5061('0x2a')](_0x5e4ddc,_0xecfb82,!![]);}catch(_0x5a759b){return BPromise[_0x5061('0x2b')](_0x5a759b);}return _0x5e4ddc['save']();};}function saveUpdates(_0x260999,_0x43dbf8){return function(_0x2eed05){if(_0x2eed05){return _0x2eed05[_0x5061('0x2c')](_0x260999)[_0x5061('0x2d')](function(_0x4f79d9){return _0x4f79d9;});}return null;};}function removeEntity(_0x33c50b,_0x30ccf4){return function(_0x208c4f){if(_0x208c4f){return _0x208c4f['destroy']()[_0x5061('0x2d')](function(){var _0x27a9ca=_0x208c4f['get']({'plain':!![]});var _0x2d57ea=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x5061('0x2e'),'value':_0x5061('0x2f'),'ignore':![]}];var _0x101c2b=_(_0x2d57ea)[_0x5061('0x30')](_0x5061('0x31'))[_0x5061('0x32')]('value')['value']();if(_['includes'](_0x101c2b,_0x27a9ca[_0x5061('0x33')])){return;}var _0x3b633d=_[_0x5061('0x34')](_0x2d57ea,['value',_0x27a9ca[_0x5061('0x33')]])[_0x5061('0x35')];return db['UserProfileResource'][_0x5061('0x36')]({'where':{'type':_0x3b633d,'resourceId':_0x27a9ca['id']}})[_0x5061('0x2d')](function(){return _0x208c4f;});})[_0x5061('0x2d')](function(){_0x33c50b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b746,_0x5c4e98){return function(_0x38d749){if(!_0x38d749){_0x46b746[_0x5061('0x21')](0x194);}return _0x38d749;};}function handleError(_0xe80e08,_0x3e692a){_0x3e692a=_0x3e692a||0x1f4;return function(_0x23c331){logger[_0x5061('0x37')](_0x23c331[_0x5061('0x38')]);if(_0x23c331['name']){delete _0x23c331[_0x5061('0x35')];}_0xe80e08[_0x5061('0x22')](_0x3e692a)['send'](_0x23c331);};}exports[_0x5061('0x39')]=function(_0x3a826a,_0x138b14){var _0x322d1d={},_0x4ffc13={},_0x2d1c9b={'count':0x0,'rows':[]};var _0x2a2b6e=_[_0x5061('0x32')](db[_0x5061('0x3a')]['rawAttributes'],function(_0x418b88){return{'name':_0x418b88['fieldName'],'type':_0x418b88[_0x5061('0x33')]['key']};});_0x4ffc13[_0x5061('0x3b')]=_[_0x5061('0x32')](_0x2a2b6e,_0x5061('0x35'));_0x4ffc13[_0x5061('0x3c')]=_[_0x5061('0x3d')](_0x3a826a['query']);_0x4ffc13[_0x5061('0x3e')]=_[_0x5061('0x3f')](_0x4ffc13[_0x5061('0x3b')],_0x4ffc13[_0x5061('0x3c')]);_0x322d1d[_0x5061('0x40')]=_['intersection'](_0x4ffc13['model'],qs[_0x5061('0x41')](_0x3a826a[_0x5061('0x3c')][_0x5061('0x41')]));_0x322d1d[_0x5061('0x40')]=_0x322d1d[_0x5061('0x40')][_0x5061('0x42')]?_0x322d1d['attributes']:_0x4ffc13[_0x5061('0x3b')];if(!_0x3a826a[_0x5061('0x3c')][_0x5061('0x43')](_0x5061('0x44'))){_0x322d1d[_0x5061('0x26')]=qs['limit'](_0x3a826a['query'][_0x5061('0x26')]);_0x322d1d['offset']=qs[_0x5061('0x24')](_0x3a826a[_0x5061('0x3c')]['offset']);}_0x322d1d[_0x5061('0x45')]=qs[_0x5061('0x46')](_0x3a826a['query'][_0x5061('0x46')]);_0x322d1d[_0x5061('0x47')]=qs[_0x5061('0x3e')](_[_0x5061('0x48')](_0x3a826a[_0x5061('0x3c')],_0x4ffc13[_0x5061('0x3e')]),_0x2a2b6e);if(_0x3a826a[_0x5061('0x3c')][_0x5061('0x30')]){_0x322d1d[_0x5061('0x47')]=_['merge'](_0x322d1d[_0x5061('0x47')],{'$or':_['map'](_0x2a2b6e,function(_0x426f51){if(_0x426f51[_0x5061('0x33')]!==_0x5061('0x49')){var _0x13954a={};_0x13954a[_0x426f51[_0x5061('0x35')]]={'$like':'%'+_0x3a826a[_0x5061('0x3c')][_0x5061('0x30')]+'%'};return _0x13954a;}})});}_0x322d1d=_['merge']({},_0x322d1d,_0x3a826a[_0x5061('0x4a')]);var _0x2e13a6={'where':_0x322d1d['where']};return db[_0x5061('0x3a')]['count'](_0x2e13a6)[_0x5061('0x2d')](function(_0x4c0e1e){_0x2d1c9b[_0x5061('0x27')]=_0x4c0e1e;if(_0x3a826a[_0x5061('0x3c')][_0x5061('0x4b')]){_0x322d1d[_0x5061('0x4c')]=[{'all':!![]}];}return db['VoiceQueue'][_0x5061('0x4d')](_0x322d1d);})[_0x5061('0x2d')](function(_0x187d1b){_0x2d1c9b[_0x5061('0x4e')]=_0x187d1b;return _0x2d1c9b;})['then'](respondWithFilteredResult(_0x138b14,_0x322d1d))[_0x5061('0x4f')](handleError(_0x138b14,null));};exports[_0x5061('0x50')]=function(_0x39a849,_0x485c19){var _0x1785b4={'raw':![],'where':{'id':_0x39a849[_0x5061('0x51')]['id']}},_0x51ae2a={};_0x51ae2a['model']=_[_0x5061('0x3d')](db[_0x5061('0x3a')][_0x5061('0x52')]);_0x51ae2a['query']=_['keys'](_0x39a849[_0x5061('0x3c')]);_0x51ae2a['filters']=_['intersection'](_0x51ae2a[_0x5061('0x3b')],_0x51ae2a[_0x5061('0x3c')]);_0x1785b4[_0x5061('0x40')]=_['intersection'](_0x51ae2a[_0x5061('0x3b')],qs['fields'](_0x39a849['query'][_0x5061('0x41')]));_0x1785b4[_0x5061('0x40')]=_0x1785b4[_0x5061('0x40')][_0x5061('0x42')]?_0x1785b4[_0x5061('0x40')]:_0x51ae2a['model'];if(_0x39a849[_0x5061('0x3c')][_0x5061('0x4b')]){_0x1785b4[_0x5061('0x4c')]=[{'all':!![]}];}_0x1785b4=_['merge']({},_0x1785b4,_0x39a849['options']);return db[_0x5061('0x3a')][_0x5061('0x34')](_0x1785b4)[_0x5061('0x2d')](handleEntityNotFound(_0x485c19,null))[_0x5061('0x2d')](respondWithResult(_0x485c19,null))[_0x5061('0x4f')](handleError(_0x485c19,null));};exports[_0x5061('0x53')]=function(_0x343453,_0x1f9e0d){return db['VoiceQueue'][_0x5061('0x53')](_0x343453[_0x5061('0x54')],{})[_0x5061('0x2d')](function(_0x870866){var _0x31ba6b=_0x343453[_0x5061('0x55')][_0x5061('0x56')]({'plain':!![]});if(!_0x31ba6b)throw new Error(_0x5061('0x57'));if(_0x31ba6b[_0x5061('0x58')]==='user'){var _0x257888=_0x870866[_0x5061('0x56')]({'plain':!![]});var _0x16a917=[{'name':_0x5061('0x59'),'value':_0x5061('0x5a')},{'name':_0x5061('0x2e'),'value':'outbound'}];var _0x1ce97d=_[_0x5061('0x34')](_0x16a917,['value',_0x257888[_0x5061('0x33')]])['name'];return db[_0x5061('0x5b')][_0x5061('0x34')]({'where':{'name':_0x1ce97d,'userProfileId':_0x31ba6b[_0x5061('0x5c')]},'raw':!![]})[_0x5061('0x2d')](function(_0x42aa58){if(_0x42aa58&&_0x42aa58[_0x5061('0x5d')]===0x0){return db[_0x5061('0x5e')][_0x5061('0x53')]({'name':_0x257888[_0x5061('0x35')],'resourceId':_0x257888['id'],'type':_0x42aa58[_0x5061('0x35')],'sectionId':_0x42aa58['id']},{})['then'](function(){return _0x870866;});}else{return _0x870866;}})[_0x5061('0x4f')](function(_0x1f0f84){logger[_0x5061('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f0f84);throw _0x1f0f84;});}return _0x870866;})[_0x5061('0x2d')](respondWithResult(_0x1f9e0d,0xc9))[_0x5061('0x4f')](handleError(_0x1f9e0d,null));};exports['clone']=function(_0x182173,_0x597006){var _0x3f3500={'where':{'id':_0x182173[_0x5061('0x51')]['id']}},_0x513c37={};_0x513c37[_0x5061('0x3b')]=_[_0x5061('0x3d')](db[_0x5061('0x3a')]['rawAttributes']);_0x3f3500[_0x5061('0x40')]=_['intersection'](_0x513c37[_0x5061('0x3b')],qs[_0x5061('0x41')](_0x182173[_0x5061('0x3c')]['fields']));_0x3f3500['attributes']=_0x3f3500[_0x5061('0x40')]['length']?_0x3f3500[_0x5061('0x40')]:_0x513c37['model'];if(_0x182173[_0x5061('0x3c')][_0x5061('0x4b')]){_0x3f3500[_0x5061('0x4c')]=[{'all':!![]}];}_0x3f3500=_['merge']({},_0x3f3500,_0x182173[_0x5061('0x4a')]);return db[_0x5061('0x3a')][_0x5061('0x34')](_0x3f3500)[_0x5061('0x2d')](handleEntityNotFound(_0x597006,null))[_0x5061('0x2d')](function(_0x7a3013){if(_0x7a3013){var _0x4bddce=_0x7a3013[_0x5061('0x56')]({'plain':!![]});_0x4bddce=qs[_0x5061('0x5f')](_0x4bddce,['id',_0x5061('0x60'),_0x5061('0x61')]);_0x182173[_0x5061('0x54')]=_[_0x5061('0x5f')](_0x182173[_0x5061('0x54')],['id',_0x5061('0x60'),_0x5061('0x61')]);return db[_0x5061('0x3a')]['create'](_[_0x5061('0x62')](_0x4bddce,_0x182173[_0x5061('0x54')]),{'include':_0x182173[_0x5061('0x3c')][_0x5061('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x451482){var _0x18352e=_0x182173[_0x5061('0x55')][_0x5061('0x56')]({'plain':!![]});if(!_0x18352e)throw new Error(_0x5061('0x57'));if(_0x18352e['role']==='user'){var _0x54cc5e=_0x451482['get']({'plain':!![]});var _0x56fb1c=[{'name':_0x5061('0x59'),'value':_0x5061('0x5a')},{'name':_0x5061('0x2e'),'value':_0x5061('0x2f')}];var _0x4b3869=_[_0x5061('0x34')](_0x56fb1c,[_0x5061('0x63'),_0x54cc5e[_0x5061('0x33')]])[_0x5061('0x35')];return db[_0x5061('0x5b')]['find']({'where':{'name':_0x4b3869,'userProfileId':_0x18352e[_0x5061('0x5c')]},'raw':!![]})[_0x5061('0x2d')](function(_0x2e9c0a){if(_0x2e9c0a&&_0x2e9c0a[_0x5061('0x5d')]===0x0){return db['UserProfileResource'][_0x5061('0x53')]({'name':_0x54cc5e[_0x5061('0x35')],'resourceId':_0x54cc5e['id'],'type':_0x2e9c0a[_0x5061('0x35')],'sectionId':_0x2e9c0a['id']},{})[_0x5061('0x2d')](function(){return _0x451482;});}else{return _0x451482;}})[_0x5061('0x4f')](function(_0x2ea43f){logger[_0x5061('0x37')](_0x5061('0x64'),_0x2ea43f);throw _0x2ea43f;});}return _0x451482;});}})['then'](respondWithResult(_0x597006,0xc9))['catch'](handleError(_0x597006,null));};exports[_0x5061('0x2c')]=function(_0x38e088,_0x2f31f6){if(_0x38e088['body']['id']){delete _0x38e088[_0x5061('0x54')]['id'];}return db[_0x5061('0x3a')][_0x5061('0x34')]({'where':{'id':_0x38e088['params']['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0x2f31f6,null))[_0x5061('0x2d')](saveUpdates(_0x38e088['body'],null))[_0x5061('0x2d')](respondWithResult(_0x2f31f6,null))[_0x5061('0x4f')](handleError(_0x2f31f6,null));};exports[_0x5061('0x36')]=function(_0x14a3e7,_0x503e1d){return db[_0x5061('0x3a')]['find']({'where':{'id':_0x14a3e7[_0x5061('0x51')]['id']}})['then'](handleEntityNotFound(_0x503e1d,null))[_0x5061('0x2d')](removeEntity(_0x503e1d,null))[_0x5061('0x4f')](handleError(_0x503e1d,null));};exports[_0x5061('0x65')]=function(_0x216551,_0xcf07d9,_0x2da166){var _0x1724a1={'raw':![],'where':{}};var _0x14ce4c={};var _0x50c9a7={'count':0x0,'rows':[]};return db[_0x5061('0x3a')][_0x5061('0x66')]({'where':{'id':_0x216551[_0x5061('0x51')]['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0xcf07d9,null))['then'](function(_0x1ff243){if(_0x1ff243){_0x14ce4c[_0x5061('0x3b')]=_[_0x5061('0x3d')](db[_0x5061('0x67')][_0x5061('0x52')]);_0x14ce4c[_0x5061('0x3c')]=_['keys'](_0x216551['query']);_0x14ce4c[_0x5061('0x3e')]=_[_0x5061('0x3f')](_0x14ce4c[_0x5061('0x3b')],_0x14ce4c[_0x5061('0x3c')]);_0x1724a1[_0x5061('0x40')]=_[_0x5061('0x3f')](_0x14ce4c['model'],qs['fields'](_0x216551[_0x5061('0x3c')][_0x5061('0x41')]));_0x1724a1[_0x5061('0x40')]=_0x1724a1[_0x5061('0x40')][_0x5061('0x42')]?_0x1724a1[_0x5061('0x40')]:_0x14ce4c[_0x5061('0x3b')];if(!_0x216551[_0x5061('0x3c')][_0x5061('0x43')](_0x5061('0x44'))){_0x1724a1[_0x5061('0x26')]=qs['limit'](_0x216551[_0x5061('0x3c')][_0x5061('0x26')]);_0x1724a1[_0x5061('0x24')]=qs[_0x5061('0x24')](_0x216551[_0x5061('0x3c')]['offset']);}_0x1724a1['order']=qs['sort'](_0x216551[_0x5061('0x3c')][_0x5061('0x46')]);_0x1724a1[_0x5061('0x47')]=qs['filters'](_[_0x5061('0x48')](_0x216551[_0x5061('0x3c')],_0x14ce4c['filters']));_0x1724a1[_0x5061('0x47')][_0x5061('0x68')]=_0x1ff243['id'];if(_0x216551[_0x5061('0x3c')][_0x5061('0x30')]){_0x1724a1[_0x5061('0x47')]=_[_0x5061('0x62')](_0x1724a1['where'],{'$or':_[_0x5061('0x32')](_0x1724a1[_0x5061('0x40')],function(_0x43ab16){var _0x191c60={};_0x191c60[_0x43ab16]={'$like':'%'+_0x216551[_0x5061('0x3c')][_0x5061('0x30')]+'%'};return _0x191c60;})});}_0x1724a1=_[_0x5061('0x62')]({},_0x1724a1,_0x216551[_0x5061('0x4a')]);return db[_0x5061('0x67')][_0x5061('0x27')]({'where':_0x1724a1[_0x5061('0x47')]})[_0x5061('0x2d')](function(_0x528283){_0x50c9a7[_0x5061('0x27')]=_0x528283;if(_0x216551[_0x5061('0x3c')][_0x5061('0x4b')]){_0x1724a1[_0x5061('0x4c')]=[{'all':!![]}];}return db[_0x5061('0x67')]['findAll'](_0x1724a1);})[_0x5061('0x2d')](function(_0x49e71a){_0x50c9a7[_0x5061('0x4e')]=_0x49e71a;return _0x50c9a7;});}})[_0x5061('0x2d')](respondWithFilteredResult(_0xcf07d9,_0x1724a1))[_0x5061('0x4f')](handleError(_0xcf07d9,null));};exports[_0x5061('0x69')]=function(_0x1b7c4f,_0x31d0d7,_0x45429c){var _0x14744c={'raw':!![],'where':{}};var _0x12da19={};var _0x544d55={'count':0x0,'rows':[]};return db[_0x5061('0x3a')][_0x5061('0x66')]({'where':{'id':_0x1b7c4f[_0x5061('0x51')]['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0x31d0d7,null))[_0x5061('0x2d')](function(_0x948149){if(_0x948149){_0x12da19[_0x5061('0x3b')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x12da19['query']=_[_0x5061('0x3d')](_0x1b7c4f[_0x5061('0x3c')]);_0x12da19[_0x5061('0x3e')]=_[_0x5061('0x3f')](_0x12da19[_0x5061('0x3b')],_0x12da19[_0x5061('0x3c')]);_0x14744c['attributes']=_[_0x5061('0x3f')](_0x12da19[_0x5061('0x3b')],qs[_0x5061('0x41')](_0x1b7c4f['query']['fields']));_0x14744c[_0x5061('0x40')]=_0x14744c[_0x5061('0x40')][_0x5061('0x42')]?_0x14744c[_0x5061('0x40')]:_0x12da19[_0x5061('0x3b')];if(!_0x1b7c4f[_0x5061('0x3c')]['hasOwnProperty'](_0x5061('0x44'))){_0x14744c[_0x5061('0x26')]=qs[_0x5061('0x26')](_0x1b7c4f['query'][_0x5061('0x26')]);_0x14744c[_0x5061('0x24')]=qs[_0x5061('0x24')](_0x1b7c4f[_0x5061('0x3c')][_0x5061('0x24')]);}_0x14744c['order']=qs['sort'](_0x1b7c4f[_0x5061('0x3c')][_0x5061('0x46')]);_0x14744c[_0x5061('0x47')]=qs[_0x5061('0x3e')](_[_0x5061('0x48')](_0x1b7c4f['query'],_0x12da19[_0x5061('0x3e')]));_0x14744c['where']['VoiceQueueId']=_0x948149['id'];if(_0x1b7c4f[_0x5061('0x3c')][_0x5061('0x30')]){_0x14744c[_0x5061('0x47')]=_[_0x5061('0x62')](_0x14744c[_0x5061('0x47')],{'$or':_[_0x5061('0x32')](_0x14744c[_0x5061('0x40')],function(_0x2045a1){var _0x137a97={};_0x137a97[_0x2045a1]={'$like':'%'+_0x1b7c4f['query']['filter']+'%'};return _0x137a97;})});}_0x14744c=_[_0x5061('0x62')]({},_0x14744c,_0x1b7c4f['options']);return db[_0x5061('0x6a')][_0x5061('0x27')]({'where':_0x14744c[_0x5061('0x47')]})[_0x5061('0x2d')](function(_0x3733ba){_0x544d55['count']=_0x3733ba;if(_0x1b7c4f[_0x5061('0x3c')][_0x5061('0x4b')]){_0x14744c[_0x5061('0x4c')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x14744c);})[_0x5061('0x2d')](function(_0x1249ad){_0x544d55[_0x5061('0x4e')]=_0x1249ad;return _0x544d55;});}})[_0x5061('0x2d')](respondWithFilteredResult(_0x31d0d7,_0x14744c))[_0x5061('0x4f')](handleError(_0x31d0d7,null));};exports['getHopperFinals']=function(_0x2d3023,_0x4f8257,_0x500c42){var _0x196dd9={'raw':!![],'where':{}};var _0x5a9f98={};var _0x184928={'count':0x0,'rows':[]};return db[_0x5061('0x3a')][_0x5061('0x66')]({'where':{'id':_0x2d3023[_0x5061('0x51')]['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0x4f8257,null))[_0x5061('0x2d')](function(_0x4f4bf2){if(_0x4f4bf2){_0x5a9f98['model']=_[_0x5061('0x3d')](db[_0x5061('0x6b')][_0x5061('0x52')]);_0x5a9f98[_0x5061('0x3c')]=_[_0x5061('0x3d')](_0x2d3023[_0x5061('0x3c')]);_0x5a9f98['filters']=_['intersection'](_0x5a9f98[_0x5061('0x3b')],_0x5a9f98[_0x5061('0x3c')]);_0x196dd9[_0x5061('0x40')]=_[_0x5061('0x3f')](_0x5a9f98[_0x5061('0x3b')],qs[_0x5061('0x41')](_0x2d3023[_0x5061('0x3c')]['fields']));_0x196dd9[_0x5061('0x40')]=_0x196dd9[_0x5061('0x40')][_0x5061('0x42')]?_0x196dd9['attributes']:_0x5a9f98['model'];if(!_0x2d3023[_0x5061('0x3c')][_0x5061('0x43')]('nolimit')){_0x196dd9[_0x5061('0x26')]=qs[_0x5061('0x26')](_0x2d3023['query'][_0x5061('0x26')]);_0x196dd9['offset']=qs[_0x5061('0x24')](_0x2d3023[_0x5061('0x3c')]['offset']);}_0x196dd9[_0x5061('0x45')]=qs['sort'](_0x2d3023[_0x5061('0x3c')]['sort']);_0x196dd9[_0x5061('0x47')]=qs[_0x5061('0x3e')](_['pick'](_0x2d3023[_0x5061('0x3c')],_0x5a9f98[_0x5061('0x3e')]));_0x196dd9[_0x5061('0x47')]['VoiceQueueId']=_0x4f4bf2['id'];if(_0x2d3023[_0x5061('0x3c')][_0x5061('0x30')]){_0x196dd9[_0x5061('0x47')]=_[_0x5061('0x62')](_0x196dd9[_0x5061('0x47')],{'$or':_[_0x5061('0x32')](_0x196dd9[_0x5061('0x40')],function(_0x1df70d){var _0xd2e2e6={};_0xd2e2e6[_0x1df70d]={'$like':'%'+_0x2d3023[_0x5061('0x3c')][_0x5061('0x30')]+'%'};return _0xd2e2e6;})});}_0x196dd9=_[_0x5061('0x62')]({},_0x196dd9,_0x2d3023[_0x5061('0x4a')]);return db[_0x5061('0x6b')][_0x5061('0x27')]({'where':_0x196dd9[_0x5061('0x47')]})[_0x5061('0x2d')](function(_0x28729f){_0x184928[_0x5061('0x27')]=_0x28729f;if(_0x2d3023[_0x5061('0x3c')]['includeAll']){_0x196dd9['include']=[{'all':!![]}];}return db[_0x5061('0x6b')][_0x5061('0x4d')](_0x196dd9);})[_0x5061('0x2d')](function(_0x42a077){_0x184928[_0x5061('0x4e')]=_0x42a077;return _0x184928;});}})['then'](respondWithFilteredResult(_0x4f8257,_0x196dd9))[_0x5061('0x4f')](handleError(_0x4f8257,null));};exports['getHopperBlacks']=function(_0x13b9ef,_0x44302c,_0x25f5f5){var _0x53f275={'raw':!![],'where':{}};var _0x4cc993={};var _0x5d1a47={'count':0x0,'rows':[]};return db[_0x5061('0x3a')][_0x5061('0x66')]({'where':{'id':_0x13b9ef[_0x5061('0x51')]['id']}})['then'](handleEntityNotFound(_0x44302c,null))['then'](function(_0x29d468){if(_0x29d468){_0x4cc993[_0x5061('0x3b')]=_[_0x5061('0x3d')](db[_0x5061('0x6c')][_0x5061('0x52')]);_0x4cc993[_0x5061('0x3c')]=_[_0x5061('0x3d')](_0x13b9ef[_0x5061('0x3c')]);_0x4cc993[_0x5061('0x3e')]=_[_0x5061('0x3f')](_0x4cc993['model'],_0x4cc993[_0x5061('0x3c')]);_0x53f275['attributes']=_[_0x5061('0x3f')](_0x4cc993[_0x5061('0x3b')],qs['fields'](_0x13b9ef[_0x5061('0x3c')][_0x5061('0x41')]));_0x53f275[_0x5061('0x40')]=_0x53f275[_0x5061('0x40')][_0x5061('0x42')]?_0x53f275['attributes']:_0x4cc993[_0x5061('0x3b')];if(!_0x13b9ef[_0x5061('0x3c')][_0x5061('0x43')](_0x5061('0x44'))){_0x53f275[_0x5061('0x26')]=qs[_0x5061('0x26')](_0x13b9ef['query']['limit']);_0x53f275['offset']=qs[_0x5061('0x24')](_0x13b9ef[_0x5061('0x3c')]['offset']);}_0x53f275[_0x5061('0x45')]=qs[_0x5061('0x46')](_0x13b9ef[_0x5061('0x3c')][_0x5061('0x46')]);_0x53f275[_0x5061('0x47')]=qs[_0x5061('0x3e')](_[_0x5061('0x48')](_0x13b9ef[_0x5061('0x3c')],_0x4cc993['filters']));_0x53f275[_0x5061('0x47')][_0x5061('0x68')]=_0x29d468['id'];if(_0x13b9ef[_0x5061('0x3c')]['filter']){_0x53f275[_0x5061('0x47')]=_[_0x5061('0x62')](_0x53f275['where'],{'$or':_[_0x5061('0x32')](_0x53f275[_0x5061('0x40')],function(_0x19fba3){var _0x2cda32={};_0x2cda32[_0x19fba3]={'$like':'%'+_0x13b9ef[_0x5061('0x3c')][_0x5061('0x30')]+'%'};return _0x2cda32;})});}_0x53f275=_[_0x5061('0x62')]({},_0x53f275,_0x13b9ef[_0x5061('0x4a')]);return db['CmHopperBlack'][_0x5061('0x27')]({'where':_0x53f275[_0x5061('0x47')]})[_0x5061('0x2d')](function(_0x378322){_0x5d1a47[_0x5061('0x27')]=_0x378322;if(_0x13b9ef[_0x5061('0x3c')][_0x5061('0x4b')]){_0x53f275[_0x5061('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5061('0x4d')](_0x53f275);})[_0x5061('0x2d')](function(_0x2abf5e){_0x5d1a47[_0x5061('0x4e')]=_0x2abf5e;return _0x5d1a47;});}})[_0x5061('0x2d')](respondWithFilteredResult(_0x44302c,_0x53f275))[_0x5061('0x4f')](handleError(_0x44302c,null));};exports[_0x5061('0x6d')]=function(_0x49bef5,_0x2cee45,_0x52837b){var _0x26ab43={};var _0x41e111={};var _0x58b1a7;var _0x2e610e;return db[_0x5061('0x3a')]['findOne']({'where':{'id':_0x49bef5[_0x5061('0x51')]['id']}})['then'](handleEntityNotFound(_0x2cee45,null))[_0x5061('0x2d')](function(_0x393b51){if(_0x393b51){_0x58b1a7=_0x393b51;_0x41e111['model']=_[_0x5061('0x3d')](db['Team'][_0x5061('0x52')]);_0x41e111[_0x5061('0x3c')]=_[_0x5061('0x3d')](_0x49bef5[_0x5061('0x3c')]);_0x41e111[_0x5061('0x3e')]=_[_0x5061('0x3f')](_0x41e111[_0x5061('0x3b')],_0x41e111[_0x5061('0x3c')]);_0x26ab43[_0x5061('0x40')]=_[_0x5061('0x3f')](_0x41e111[_0x5061('0x3b')],qs[_0x5061('0x41')](_0x49bef5[_0x5061('0x3c')]['fields']));_0x26ab43[_0x5061('0x40')]=_0x26ab43[_0x5061('0x40')]['length']?_0x26ab43[_0x5061('0x40')]:_0x41e111[_0x5061('0x3b')];_0x26ab43[_0x5061('0x45')]=qs[_0x5061('0x46')](_0x49bef5[_0x5061('0x3c')][_0x5061('0x46')]);_0x26ab43[_0x5061('0x47')]=qs[_0x5061('0x3e')](_[_0x5061('0x48')](_0x49bef5['query'],_0x41e111['filters']));if(_0x49bef5[_0x5061('0x3c')]['filter']){_0x26ab43['where']=_[_0x5061('0x62')](_0x26ab43[_0x5061('0x47')],{'$or':_[_0x5061('0x32')](_0x26ab43[_0x5061('0x40')],function(_0x4ffc2b){var _0x4023b1={};_0x4023b1[_0x4ffc2b]={'$like':'%'+_0x49bef5[_0x5061('0x3c')][_0x5061('0x30')]+'%'};return _0x4023b1;})});}_0x26ab43=_['merge']({},_0x26ab43,_0x49bef5[_0x5061('0x4a')]);return _0x58b1a7['getTeams'](_0x26ab43);}})[_0x5061('0x2d')](function(_0x2e50b7){if(_0x2e50b7){_0x2e610e=_0x2e50b7['length'];if(!_0x49bef5[_0x5061('0x3c')]['hasOwnProperty'](_0x5061('0x44'))){_0x26ab43[_0x5061('0x26')]=qs['limit'](_0x49bef5[_0x5061('0x3c')][_0x5061('0x26')]);_0x26ab43[_0x5061('0x24')]=qs[_0x5061('0x24')](_0x49bef5[_0x5061('0x3c')][_0x5061('0x24')]);}return _0x58b1a7['getTeams'](_0x26ab43);}})['then'](function(_0x395608){if(_0x395608){return _0x395608?{'count':_0x2e610e,'rows':_0x395608}:null;}})['then'](respondWithResult(_0x2cee45,null))[_0x5061('0x4f')](handleError(_0x2cee45,null));};exports[_0x5061('0x6e')]=function(_0x38fd86,_0x28b5b6,_0x5bbd02){var _0x2da9bc=_0x38fd86[_0x5061('0x54')]['teams'];var _0x48c202=_[_0x5061('0x32')](_0x2da9bc,'id');return db[_0x5061('0x6f')][_0x5061('0x4d')]({'where':{'id':_0x48c202},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5061('0x35'),_0x5061('0x70'),_0x5061('0x71'),'interface'],'raw':!![]}]})['then'](function(_0x41f5e0){if(_0x41f5e0){var _0x5538f2=_[_0x5061('0x72')](_0x41f5e0,function(_0x29e7d9){var _0x4d95f1=_0x29e7d9[_0x5061('0x56')]({'plain':!![]});_0x4d95f1[_0x5061('0x73')][_0x5061('0x74')](function(_0x3e2ac5){_0x3e2ac5['penalty']=_[_0x5061('0x34')](_0x2da9bc,{'id':_0x4d95f1['id']})['penalty'];});return _0x4d95f1[_0x5061('0x73')];});return db['VoiceQueue'][_0x5061('0x34')]({'where':{'id':_0x38fd86[_0x5061('0x51')]['id']}})[_0x5061('0x2d')](function(_0x3694c9){return db[_0x5061('0x75')]['transaction'](function(_0x1901da){return _0x3694c9['addTeams'](_0x48c202,{'transaction':_0x1901da})['then'](function(){return BPromise[_0x5061('0x76')](_0x2da9bc,function(_0xc6ca0b){return db[_0x5061('0x77')]['upsert']({'TeamId':_0xc6ca0b['id'],'VoiceQueueId':_0x38fd86['params']['id'],'penalty':_0xc6ca0b[_0x5061('0x78')]},{'transaction':_0x1901da});});})[_0x5061('0x2d')](function(){return BPromise[_0x5061('0x76')](_0x5538f2,function(_0x45ae40){return db[_0x5061('0x79')]['findOrCreate']({'where':{'UserId':_0x45ae40['id'],'VoiceQueueId':_0x38fd86[_0x5061('0x51')]['id']},'defaults':{'penalty':_0x45ae40[_0x5061('0x78')]},'transaction':_0x1901da});});})[_0x5061('0x2d')](function(){return BPromise['each'](_[_0x5061('0x30')](_0x5538f2,{'online':!![]}),function(_0x42ac53){return db['UserVoiceQueueRt'][_0x5061('0x7a')]({'membername':_0x42ac53['name'],'UserId':_0x42ac53['id'],'queue_name':_0x3694c9['name'],'VoiceQueueId':_0x3694c9['id'],'interface':_['isNil'](_0x42ac53['interface'])?util[_0x5061('0x7b')]('SIP/%s',_0x42ac53[_0x5061('0x35')]):_0x42ac53[_0x5061('0x7c')],'paused':_0x42ac53[_0x5061('0x71')]||![],'penalty':_0x42ac53['penalty']},{'transaction':_0x1901da});});})[_0x5061('0x2d')](function(){_0x5538f2[_0x5061('0x74')](function(_0x3a05b2){socket[_0x5061('0x7d')]('userVoiceQueue:save',{'UserId':_0x3a05b2['id'],'VoiceQueueId':_0x3694c9['id']});});});});});}})[_0x5061('0x2d')](respondWithStatusCode(_0x28b5b6,null))[_0x5061('0x4f')](handleError(_0x28b5b6,null));};exports[_0x5061('0x7e')]=function(_0x1aa914,_0x3b7bf3,_0x43e469){return db['Team'][_0x5061('0x4d')]({'where':{'id':_0x1aa914[_0x5061('0x3c')][_0x5061('0x7f')]},'attributes':['id'],'include':[{'model':db[_0x5061('0x80')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5061('0x2d')](handleEntityNotFound(_0x3b7bf3,null))[_0x5061('0x2d')](function(_0x1f0b47){var _0x510d64=_[_0x5061('0x32')](_0x1f0b47,'id');var _0x34c421=[];var _0x54cc3b=[];var _0x1f22e8=squel['select']();_0x1f22e8[_0x5061('0x81')]('tq.TeamId')[_0x5061('0x82')]('team_has_voice_queues','tq')[_0x5061('0x83')]('user_has_teams','ut',_0x5061('0x84'))[_0x5061('0x47')](_0x5061('0x85'),_0x1aa914[_0x5061('0x51')]['id']);for(var _0x5216c7=0x0;_0x5216c7<_0x1f0b47[_0x5061('0x42')];_0x5216c7+=0x1){let _0x41eb92=_0x1f0b47[_0x5216c7];for(var _0x30bc8d=0x0;_0x30bc8d<_0x41eb92[_0x5061('0x73')][_0x5061('0x42')];_0x30bc8d+=0x1){let _0x6306ca=_0x41eb92[_0x5061('0x73')][_0x30bc8d];var _0x29e68e=_0x1f22e8[_0x5061('0x86')]();_0x29e68e[_0x5061('0x47')](_0x5061('0x87'),_0x6306ca['id']);_0x54cc3b[_0x5061('0x88')](db[_0x5061('0x75')][_0x5061('0x3c')](_0x29e68e['toString'](),{'type':db[_0x5061('0x75')][_0x5061('0x89')][_0x5061('0x8a')]})[_0x5061('0x2d')](function(_0x3f1e89){if(_0x3f1e89['length']===0x1){return _0x6306ca['id'];}else{var _0x2bc174=_[_0x5061('0x8b')](_['map'](_0x3f1e89,'TeamId'),function(_0x56b6a9){return _[_0x5061('0x8c')](_0x510d64,_0x56b6a9);});if(_0x2bc174){return _0x6306ca['id'];}}}));}}return BPromise[_0x5061('0x8d')](_0x54cc3b)[_0x5061('0x2d')](function(_0x11d349){_0x34c421=_(_0x34c421)['union'](_0x11d349)[_0x5061('0x8e')]()[_0x5061('0x63')]();return db[_0x5061('0x3a')][_0x5061('0x34')]({'where':{'id':_0x1aa914['params']['id']}})[_0x5061('0x2d')](function(_0x182d0e){return db['sequelize'][_0x5061('0x8f')](function(_0x219714){return _0x182d0e['removeTeams'](_0x1aa914[_0x5061('0x3c')][_0x5061('0x7f')],{'transaction':_0x219714})['then'](function(){if(!_[_0x5061('0x90')](_0x34c421)){return _0x182d0e[_0x5061('0x91')](_0x34c421,{'transaction':_0x219714})[_0x5061('0x2d')](function(){return db[_0x5061('0x92')]['destroy']({'where':{'VoiceQueueId':_0x1aa914[_0x5061('0x51')]['id'],'UserId':_0x34c421},'transaction':_0x219714});});}})[_0x5061('0x2d')](function(){_0x34c421[_0x5061('0x74')](function(_0x1a7e3d){socket[_0x5061('0x7d')]('userVoiceQueue:remove',{'UserId':_0x1a7e3d,'VoiceQueueId':_0x182d0e['id']});});});});});});})['then'](respondWithStatusCode(_0x3b7bf3,null))[_0x5061('0x4f')](handleError(_0x3b7bf3,null));};exports[_0x5061('0x93')]=function(_0x4e58fc,_0x1b57eb,_0x340bf7){var _0x3092d3,_0xec940d;return db['VoiceQueue'][_0x5061('0x34')]({'where':{'id':_0x4e58fc['params']['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0x1b57eb,null))[_0x5061('0x2d')](function(_0x1b40be){if(_0x1b40be){_0xec940d=_0x1b40be;return _0x1b40be[_0x5061('0x93')](_0x4e58fc['body']['ids'],_[_0x5061('0x5f')](_0x4e58fc[_0x5061('0x54')],[_0x5061('0x7f'),'id'])||{})[_0x5061('0x94')](function(_0x254eef){for(var _0x419e56=0x0;_0x419e56<_0x4e58fc[_0x5061('0x54')]['ids'][_0x5061('0x42')];_0x419e56+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x4e58fc[_0x5061('0x54')]['ids'][_0x419e56]),'VoiceQueueId':Number(_0x4e58fc[_0x5061('0x51')]['id'])});}return _0x254eef;});}})[_0x5061('0x2d')](function(_0x242035){_0x3092d3=_0x242035||[];if(_0xec940d){return db[_0x5061('0x80')]['findAll']({'where':{'id':_0x4e58fc[_0x5061('0x54')][_0x5061('0x7f')]},'attributes':['id',_0x5061('0x35'),_0x5061('0x70'),_0x5061('0x71'),_0x5061('0x7c')],'raw':!![]});}})['then'](function(_0x2a14ce){if(!_[_0x5061('0x90')](_0x2a14ce)){var _0x166e95=[];for(var _0x62a9=0x0;_0x62a9<_0x2a14ce[_0x5061('0x42')];_0x62a9++){if(_0x2a14ce[_0x62a9][_0x5061('0x70')]){_0x166e95['push'](db[_0x5061('0x92')]['upsert']({'membername':_0x2a14ce[_0x62a9][_0x5061('0x35')],'UserId':_0x2a14ce[_0x62a9]['id'],'queue_name':_0xec940d[_0x5061('0x35')],'VoiceQueueId':_0xec940d['id'],'interface':_[_0x5061('0x95')](_0x2a14ce[_0x62a9][_0x5061('0x7c')])?util[_0x5061('0x7b')](_0x5061('0x96'),_0x2a14ce[_0x62a9][_0x5061('0x35')]):_0x2a14ce[_0x62a9][_0x5061('0x7c')],'paused':_0x2a14ce[_0x62a9][_0x5061('0x71')]||![],'penalty':_0x4e58fc['body'][_0x5061('0x78')]||0x0}));}}return BPromise[_0x5061('0x8d')](_0x166e95);}})['then'](function(){return _0x3092d3;})[_0x5061('0x2d')](respondWithResult(_0x1b57eb,null))[_0x5061('0x4f')](handleError(_0x1b57eb,null));};exports[_0x5061('0x91')]=function(_0x35f519,_0x31ed92,_0x37d0ec){return db['VoiceQueue'][_0x5061('0x34')]({'where':{'id':_0x35f519['params']['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0x31ed92,null))['then'](function(_0x4d3d57){if(_0x4d3d57){return _0x4d3d57[_0x5061('0x91')](_0x35f519['query'][_0x5061('0x7f')])[_0x5061('0x2d')](function(){if(_[_0x5061('0x97')](_0x35f519[_0x5061('0x3c')][_0x5061('0x7f')])){for(var _0x235271=0x0;_0x235271<_0x35f519[_0x5061('0x3c')]['ids'][_0x5061('0x42')];_0x235271+=0x1){socket[_0x5061('0x7d')]('userVoiceQueue:remove',{'UserId':Number(_0x35f519['query'][_0x5061('0x7f')][_0x235271]),'VoiceQueueId':Number(_0x35f519[_0x5061('0x51')]['id'])});}}else{socket[_0x5061('0x7d')](_0x5061('0x98'),{'UserId':Number(_0x35f519['query'][_0x5061('0x7f')]),'VoiceQueueId':Number(_0x35f519[_0x5061('0x51')]['id'])});}});}})[_0x5061('0x2d')](function(_0x1e602f){return db[_0x5061('0x92')][_0x5061('0x36')]({'where':{'VoiceQueueId':_0x35f519['params']['id'],'UserId':_0x35f519[_0x5061('0x3c')][_0x5061('0x7f')]}})[_0x5061('0x2d')](function(){return _0x1e602f;});})[_0x5061('0x2d')](respondWithStatusCode(_0x31ed92,null))[_0x5061('0x4f')](handleError(_0x31ed92,null));};exports[_0x5061('0x99')]=function(_0x3802af,_0x5540bf,_0x3cb130){var _0x2bc273={};var _0x107527={};var _0x2a656b;var _0x58a7cd;return db[_0x5061('0x3a')][_0x5061('0x66')]({'where':{'id':_0x3802af['params']['id']}})['then'](handleEntityNotFound(_0x5540bf,null))['then'](function(_0x1f986f){if(_0x1f986f){_0x2a656b=_0x1f986f;_0x107527['model']=_[_0x5061('0x3d')](db[_0x5061('0x80')]['rawAttributes']);_0x107527[_0x5061('0x3c')]=_['keys'](_0x3802af['query']);_0x107527['filters']=_['intersection'](_0x107527[_0x5061('0x3b')],_0x107527[_0x5061('0x3c')]);_0x2bc273['attributes']=_['intersection'](_0x107527['model'],qs[_0x5061('0x41')](_0x3802af[_0x5061('0x3c')][_0x5061('0x41')]));_0x2bc273['attributes']=_0x2bc273[_0x5061('0x40')][_0x5061('0x42')]?_0x2bc273[_0x5061('0x40')]:_0x107527[_0x5061('0x3b')];_0x2bc273[_0x5061('0x45')]=qs['sort'](_0x3802af[_0x5061('0x3c')][_0x5061('0x46')]);_0x2bc273['where']=qs['filters'](_[_0x5061('0x48')](_0x3802af['query'],_0x107527[_0x5061('0x3e')]));if(_0x3802af[_0x5061('0x3c')][_0x5061('0x30')]){_0x2bc273[_0x5061('0x47')]=_[_0x5061('0x62')](_0x2bc273[_0x5061('0x47')],{'$or':_['map'](_0x2bc273[_0x5061('0x40')],function(_0x5ce3fe){var _0x9bf418={};_0x9bf418[_0x5ce3fe]={'$like':'%'+_0x3802af[_0x5061('0x3c')][_0x5061('0x30')]+'%'};return _0x9bf418;})});}_0x2bc273=_[_0x5061('0x62')]({},_0x2bc273,_0x3802af[_0x5061('0x4a')]);return _0x2a656b[_0x5061('0x99')](_0x2bc273);}})['then'](function(_0x3e6f6e){if(_0x3e6f6e){_0x58a7cd=_0x3e6f6e[_0x5061('0x42')];if(!_0x3802af[_0x5061('0x3c')]['hasOwnProperty']('nolimit')){_0x2bc273[_0x5061('0x26')]=qs[_0x5061('0x26')](_0x3802af[_0x5061('0x3c')][_0x5061('0x26')]);_0x2bc273[_0x5061('0x24')]=qs['offset'](_0x3802af['query'][_0x5061('0x24')]);}return _0x2a656b[_0x5061('0x99')](_0x2bc273);}})[_0x5061('0x2d')](function(_0x494107){if(_0x494107){return _0x494107?{'count':_0x58a7cd,'rows':_0x494107}:null;}})[_0x5061('0x2d')](respondWithResult(_0x5540bf,null))[_0x5061('0x4f')](handleError(_0x5540bf,null));};exports[_0x5061('0x9a')]=function(_0x1f7bf5,_0x4730b1,_0x32acf1){var _0x4c777e={};var _0x5654af={};var _0x2d949c;var _0x3942cc;return db[_0x5061('0x3a')][_0x5061('0x66')]({'where':{'id':_0x1f7bf5[_0x5061('0x51')]['id']}})['then'](handleEntityNotFound(_0x4730b1,null))[_0x5061('0x2d')](function(_0x3e05fc){if(_0x3e05fc){_0x2d949c=_0x3e05fc;_0x5654af[_0x5061('0x3b')]=_[_0x5061('0x3d')](db[_0x5061('0x92')]['rawAttributes']);_0x5654af[_0x5061('0x3c')]=_[_0x5061('0x3d')](_0x1f7bf5['query']);_0x5654af[_0x5061('0x3e')]=_[_0x5061('0x3f')](_0x5654af[_0x5061('0x3b')],_0x5654af['query']);_0x4c777e[_0x5061('0x40')]=_[_0x5061('0x3f')](_0x5654af[_0x5061('0x3b')],qs[_0x5061('0x41')](_0x1f7bf5[_0x5061('0x3c')][_0x5061('0x41')]));_0x4c777e['attributes']=_0x4c777e[_0x5061('0x40')][_0x5061('0x42')]?_0x4c777e[_0x5061('0x40')]:_0x5654af[_0x5061('0x3b')];_0x4c777e['order']=qs['sort'](_0x1f7bf5[_0x5061('0x3c')]['sort']);_0x4c777e[_0x5061('0x47')]=qs['filters'](_[_0x5061('0x48')](_0x1f7bf5[_0x5061('0x3c')],_0x5654af[_0x5061('0x3e')]));if(_0x1f7bf5[_0x5061('0x3c')]['filter']){_0x4c777e[_0x5061('0x47')]=_['merge'](_0x4c777e[_0x5061('0x47')],{'$or':_[_0x5061('0x32')](_0x4c777e['attributes'],function(_0x3de017){var _0x3c9c31={};_0x3c9c31[_0x3de017]={'$like':'%'+_0x1f7bf5[_0x5061('0x3c')][_0x5061('0x30')]+'%'};return _0x3c9c31;})});}_0x4c777e=_[_0x5061('0x62')]({},_0x4c777e,_0x1f7bf5[_0x5061('0x4a')]);return _0x2d949c[_0x5061('0x9a')](_0x4c777e);}})[_0x5061('0x2d')](function(_0x1bbab4){if(_0x1bbab4){_0x3942cc=_0x1bbab4['length'];if(!_0x1f7bf5[_0x5061('0x3c')]['hasOwnProperty']('nolimit')){_0x4c777e[_0x5061('0x26')]=qs[_0x5061('0x26')](_0x1f7bf5['query']['limit']);_0x4c777e[_0x5061('0x24')]=qs[_0x5061('0x24')](_0x1f7bf5[_0x5061('0x3c')][_0x5061('0x24')]);}return _0x2d949c['getMembers'](_0x4c777e);}})[_0x5061('0x2d')](function(_0x5465ca){return _0x5465ca?{'count':_0x3942cc,'rows':_0x5465ca}:null;})[_0x5061('0x2d')](respondWithResult(_0x4730b1,null))['catch'](handleError(_0x4730b1,null));};exports[_0x5061('0x9b')]=function(_0xc421c6,_0x3c807d,_0x5324a9){var _0x3bf15c={};var _0x144c5d={};var _0x4cddb2;var _0x49e3c2;return db['VoiceQueue']['findOne']({'where':{'id':_0xc421c6['params']['id']}})['then'](handleEntityNotFound(_0x3c807d,null))[_0x5061('0x2d')](function(_0x478935){if(_0x478935){_0x4cddb2=_0x478935;_0x144c5d[_0x5061('0x3b')]=_[_0x5061('0x3d')](db[_0x5061('0x9c')]['rawAttributes']);_0x144c5d['query']=_['keys'](_0xc421c6['query']);_0x144c5d[_0x5061('0x3e')]=_['intersection'](_0x144c5d[_0x5061('0x3b')],_0x144c5d[_0x5061('0x3c')]);_0x3bf15c['attributes']=_[_0x5061('0x3f')](_0x144c5d[_0x5061('0x3b')],qs['fields'](_0xc421c6[_0x5061('0x3c')][_0x5061('0x41')]));_0x3bf15c[_0x5061('0x40')]=_0x3bf15c[_0x5061('0x40')][_0x5061('0x42')]?_0x3bf15c[_0x5061('0x40')]:_0x144c5d[_0x5061('0x3b')];_0x3bf15c[_0x5061('0x45')]=qs[_0x5061('0x46')](_0xc421c6[_0x5061('0x3c')]['sort']);_0x3bf15c['where']=qs[_0x5061('0x3e')](_[_0x5061('0x48')](_0xc421c6[_0x5061('0x3c')],_0x144c5d[_0x5061('0x3e')]));if(_0xc421c6[_0x5061('0x3c')][_0x5061('0x30')]){_0x3bf15c['where']=_['merge'](_0x3bf15c[_0x5061('0x47')],{'$or':_['map'](_0x3bf15c[_0x5061('0x40')],function(_0x2bfc32){var _0x56f201={};_0x56f201[_0x2bfc32]={'$like':'%'+_0xc421c6['query'][_0x5061('0x30')]+'%'};return _0x56f201;})});}_0x3bf15c=_[_0x5061('0x62')]({},_0x3bf15c,_0xc421c6['options']);return _0x4cddb2[_0x5061('0x9b')](_0x3bf15c);}})['then'](function(_0x449e97){if(_0x449e97){_0x49e3c2=_0x449e97['length'];if(!_0xc421c6[_0x5061('0x3c')][_0x5061('0x43')](_0x5061('0x44'))){_0x3bf15c[_0x5061('0x26')]=qs['limit'](_0xc421c6[_0x5061('0x3c')]['limit']);_0x3bf15c[_0x5061('0x24')]=qs[_0x5061('0x24')](_0xc421c6['query'][_0x5061('0x24')]);}return _0x4cddb2[_0x5061('0x9b')](_0x3bf15c);}})[_0x5061('0x2d')](function(_0x3edbea){if(_0x3edbea){return _0x3edbea?{'count':_0x49e3c2,'rows':_0x3edbea}:null;}})[_0x5061('0x2d')](respondWithResult(_0x3c807d,null))[_0x5061('0x4f')](handleError(_0x3c807d,null));};exports['addLists']=function(_0x2496d8,_0x3e5464,_0x119319){var _0x1fc63f,_0x24c32e;return db['VoiceQueue'][_0x5061('0x34')]({'where':{'id':_0x2496d8[_0x5061('0x51')]['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0x3e5464,null))[_0x5061('0x2d')](function(_0x3da4ab){if(_0x3da4ab){_0x24c32e=_0x3da4ab;return _0x3da4ab[_0x5061('0x9d')](_0x2496d8[_0x5061('0x54')]['ids'],_[_0x5061('0x5f')](_0x2496d8[_0x5061('0x54')],['ids','id'])||{});}return null;})[_0x5061('0x94')](function(_0xcd4b7d){var _0x4f9eaf;_0x1fc63f=_0xcd4b7d||[];var _0x841260=[];if(_0xcd4b7d){for(var _0x53edeb=0x0;_0x53edeb<_0xcd4b7d[_0x5061('0x42')];_0x53edeb+=0x1){var _0x2fb229=_0xcd4b7d[_0x53edeb][_0x5061('0x56')]({'plain':!![]});_0x24c32e[_0x5061('0x9e')]=_0x2496d8['body']['dialCheckDuplicateType']?_0x2496d8[_0x5061('0x54')][_0x5061('0x9e')]:_0x24c32e[_0x5061('0x9e')];switch(_0x24c32e[_0x5061('0x9e')]){case _0x5061('0x9f'):_0x4f9eaf=squel[_0x5061('0xa0')]()[_0x5061('0xa1')](_0x5061('0xa2'))[_0x5061('0xa3')](['phone','scheduledAt',_0x5061('0xa4'),_0x5061('0xa5'),'VoiceQueueId',_0x5061('0x60'),_0x5061('0x61')],squel[_0x5061('0xa6')]()[_0x5061('0x81')](_0x5061('0xa7'),_0x5061('0xa7'))[_0x5061('0x81')](_0x5061('0xa8'),'scheduledAt')['field']('id',_0x5061('0xa4'))[_0x5061('0x81')](_0x2fb229[_0x5061('0xa9')][_0x5061('0xaa')](),_0x5061('0xa5'))['field'](_0x2496d8['params']['id'][_0x5061('0xaa')](),_0x5061('0x68'))[_0x5061('0x81')]('NOW()',_0x5061('0x60'))[_0x5061('0x81')](_0x5061('0xa8'),_0x5061('0x61'))[_0x5061('0x82')](_0x5061('0xab'))[_0x5061('0x47')](_0x5061('0xac'))[_0x5061('0x47')](_0x5061('0xad'),_0x2fb229[_0x5061('0xa9')][_0x5061('0xaa')]())[_0x5061('0x47')](_0x5061('0xae'))[_0x5061('0x47')](_0x5061('0xaf'),squel['select']()[_0x5061('0x81')](_0x5061('0xb0'))['from'](_0x5061('0xb1'))['where'](_0x5061('0x85'),_0x2496d8[_0x5061('0x51')]['id'][_0x5061('0xaa')]()))[_0x5061('0x47')](_0x5061('0xaf'),squel['select']()[_0x5061('0x81')](_0x5061('0xb2'))['from'](_0x5061('0xa2'))['where'](_0x5061('0x85'),_0x2496d8[_0x5061('0x51')]['id'][_0x5061('0xaa')]())))[_0x5061('0xaa')]();break;case'onlyIfOpen':_0x4f9eaf=squel['insert']()[_0x5061('0xa1')]('cm_hopper')['fromQuery']([_0x5061('0xa7'),_0x5061('0xb3'),_0x5061('0xa4'),_0x5061('0xa5'),'VoiceQueueId',_0x5061('0x60'),_0x5061('0x61')],squel['select']()[_0x5061('0x81')](_0x5061('0xa7'),_0x5061('0xa7'))[_0x5061('0x81')](_0x5061('0xa8'),_0x5061('0xb3'))[_0x5061('0x81')]('id',_0x5061('0xa4'))[_0x5061('0x81')](_0x2fb229[_0x5061('0xa9')][_0x5061('0xaa')](),_0x5061('0xa5'))[_0x5061('0x81')](_0x2496d8['params']['id'][_0x5061('0xaa')](),_0x5061('0x68'))[_0x5061('0x81')]('NOW()',_0x5061('0x60'))[_0x5061('0x81')](_0x5061('0xa8'),_0x5061('0x61'))['from'](_0x5061('0xab'))[_0x5061('0x47')]('deletedAt\x20IS\x20NULL')[_0x5061('0x47')]('ListId\x20=\x20?',_0x2fb229[_0x5061('0xa9')][_0x5061('0xaa')]())[_0x5061('0x47')](_0x5061('0xae'))[_0x5061('0x47')](_0x5061('0xaf'),squel[_0x5061('0xa6')]()['field'](_0x5061('0xb2'))[_0x5061('0x82')](_0x5061('0xa2'))['where'](_0x5061('0x85'),_0x2496d8[_0x5061('0x51')]['id']['toString']())))[_0x5061('0xaa')]();break;default:_0x4f9eaf=squel['insert']()[_0x5061('0xa1')]('cm_hopper')[_0x5061('0xa3')]([_0x5061('0xa7'),_0x5061('0xb3'),_0x5061('0xa4'),_0x5061('0xa5'),_0x5061('0x68'),'createdAt',_0x5061('0x61')],squel[_0x5061('0xa6')]()[_0x5061('0x81')](_0x5061('0xa7'),_0x5061('0xa7'))[_0x5061('0x81')](_0x5061('0xa8'),_0x5061('0xb3'))[_0x5061('0x81')]('id',_0x5061('0xa4'))[_0x5061('0x81')](_0x2fb229['CmListId'][_0x5061('0xaa')](),_0x5061('0xa5'))[_0x5061('0x81')](_0x2496d8[_0x5061('0x51')]['id'][_0x5061('0xaa')](),'VoiceQueueId')['field'](_0x5061('0xa8'),_0x5061('0x60'))['field']('NOW()',_0x5061('0x61'))[_0x5061('0x82')](_0x5061('0xab'))[_0x5061('0x47')](_0x5061('0xac'))[_0x5061('0x47')](_0x5061('0xad'),_0x2fb229[_0x5061('0xa9')][_0x5061('0xaa')]())[_0x5061('0x47')](_0x5061('0xae')))[_0x5061('0xaa')]();}_0x841260[_0x5061('0x88')](db[_0x5061('0x75')]['query'](_0x4f9eaf));}return BPromise['all'](_0x841260);}})[_0x5061('0x2d')](function(){return _0x1fc63f;})[_0x5061('0x2d')](respondWithResult(_0x3e5464,null))['catch'](handleError(_0x3e5464,null));};exports[_0x5061('0xb4')]=function(_0x335f7b,_0x2ecaf8,_0x32c055){return db[_0x5061('0x3a')][_0x5061('0x34')]({'where':{'id':_0x335f7b[_0x5061('0x51')]['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0x2ecaf8,null))[_0x5061('0x2d')](function(_0x17ef37){if(_0x17ef37){return _0x17ef37[_0x5061('0xb4')](_0x335f7b[_0x5061('0x3c')][_0x5061('0x7f')]);}})['then'](function(_0x583d19){if(_0x583d19){return db[_0x5061('0x67')]['destroy']({'where':{'ListId':_0x335f7b[_0x5061('0x3c')][_0x5061('0x7f')],'VoiceQueueId':_0x335f7b[_0x5061('0x51')]['id']}})[_0x5061('0x2d')](function(){return _0x583d19;});}})[_0x5061('0x2d')](respondWithStatusCode(_0x2ecaf8,null))[_0x5061('0x4f')](handleError(_0x2ecaf8,null));};exports['getBlackLists']=function(_0x8d4dea,_0x51634e,_0x42783d){var _0x178697={};var _0x4a9631={};var _0x167f5f;var _0x96ed93;return db[_0x5061('0x3a')][_0x5061('0x66')]({'where':{'id':_0x8d4dea[_0x5061('0x51')]['id']}})['then'](handleEntityNotFound(_0x51634e,null))[_0x5061('0x2d')](function(_0x217051){if(_0x217051){_0x167f5f=_0x217051;_0x4a9631[_0x5061('0x3b')]=_['keys'](db[_0x5061('0x9c')]['rawAttributes']);_0x4a9631[_0x5061('0x3c')]=_[_0x5061('0x3d')](_0x8d4dea[_0x5061('0x3c')]);_0x4a9631['filters']=_['intersection'](_0x4a9631[_0x5061('0x3b')],_0x4a9631[_0x5061('0x3c')]);_0x178697['attributes']=_[_0x5061('0x3f')](_0x4a9631[_0x5061('0x3b')],qs[_0x5061('0x41')](_0x8d4dea[_0x5061('0x3c')][_0x5061('0x41')]));_0x178697[_0x5061('0x40')]=_0x178697[_0x5061('0x40')]['length']?_0x178697[_0x5061('0x40')]:_0x4a9631['model'];_0x178697[_0x5061('0x45')]=qs[_0x5061('0x46')](_0x8d4dea['query'][_0x5061('0x46')]);_0x178697['where']=qs[_0x5061('0x3e')](_['pick'](_0x8d4dea[_0x5061('0x3c')],_0x4a9631[_0x5061('0x3e')]));if(_0x8d4dea[_0x5061('0x3c')]['filter']){_0x178697[_0x5061('0x47')]=_[_0x5061('0x62')](_0x178697[_0x5061('0x47')],{'$or':_[_0x5061('0x32')](_0x178697[_0x5061('0x40')],function(_0x374950){var _0x41f7ae={};_0x41f7ae[_0x374950]={'$like':'%'+_0x8d4dea['query'][_0x5061('0x30')]+'%'};return _0x41f7ae;})});}_0x178697=_[_0x5061('0x62')]({},_0x178697,_0x8d4dea[_0x5061('0x4a')]);return _0x167f5f[_0x5061('0xb5')](_0x178697);}})['then'](function(_0x3a2641){if(_0x3a2641){_0x96ed93=_0x3a2641[_0x5061('0x42')];if(!_0x8d4dea[_0x5061('0x3c')][_0x5061('0x43')](_0x5061('0x44'))){_0x178697[_0x5061('0x26')]=qs['limit'](_0x8d4dea[_0x5061('0x3c')][_0x5061('0x26')]);_0x178697['offset']=qs[_0x5061('0x24')](_0x8d4dea[_0x5061('0x3c')][_0x5061('0x24')]);}return _0x167f5f[_0x5061('0xb5')](_0x178697);}})[_0x5061('0x2d')](function(_0x3e3c0e){if(_0x3e3c0e){return _0x3e3c0e?{'count':_0x96ed93,'rows':_0x3e3c0e}:null;}})[_0x5061('0x2d')](respondWithResult(_0x51634e,null))[_0x5061('0x4f')](handleError(_0x51634e,null));};exports[_0x5061('0xb6')]=function(_0x50990d,_0x4b36e6,_0x149d97){var _0x421570,_0x1ff260;return db[_0x5061('0x3a')][_0x5061('0x34')]({'where':{'id':_0x50990d[_0x5061('0x51')]['id']}})['then'](handleEntityNotFound(_0x4b36e6,null))[_0x5061('0x2d')](function(_0x210382){if(_0x210382){_0x1ff260=_0x210382;return _0x210382['addBlackLists'](_0x50990d[_0x5061('0x54')]['ids'],_['omit'](_0x50990d[_0x5061('0x54')],[_0x5061('0x7f'),'id'])||{});}return null;})[_0x5061('0x94')](function(_0x5972c0){var _0x284344;_0x421570=_0x5972c0||[];var _0x6f5920=[];if(_0x5972c0){for(var _0x32ad16=0x0;_0x32ad16<_0x5972c0[_0x5061('0x42')];_0x32ad16+=0x1){var _0x10b2a7=_0x5972c0[_0x32ad16][_0x5061('0x56')]({'plain':!![]});_0x284344=squel['insert']()[_0x5061('0xa1')]('cm_hopper_black')[_0x5061('0xa3')](['phone',_0x5061('0xa4'),'ListId',_0x5061('0x68'),_0x5061('0x60'),_0x5061('0x61')],squel['select']()['field']('phone',_0x5061('0xa7'))[_0x5061('0x81')]('id',_0x5061('0xa4'))[_0x5061('0x81')](_0x10b2a7[_0x5061('0xa9')]['toString'](),'ListId')[_0x5061('0x81')](_0x50990d['params']['id'][_0x5061('0xaa')](),'VoiceQueueId')['field'](_0x5061('0xa8'),'createdAt')[_0x5061('0x81')]('NOW()','updatedAt')['from']('cm_contacts')[_0x5061('0x47')](_0x5061('0xac'))[_0x5061('0x47')]('ListId\x20=\x20?',_0x10b2a7['CmListId']['toString']())[_0x5061('0x47')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x6f5920[_0x5061('0x88')](db[_0x5061('0x75')][_0x5061('0x3c')](_0x284344));}return BPromise[_0x5061('0x8d')](_0x6f5920);}})[_0x5061('0x2d')](function(){return _0x421570;})[_0x5061('0x2d')](respondWithResult(_0x4b36e6,null))[_0x5061('0x4f')](handleError(_0x4b36e6,null));};exports[_0x5061('0xb7')]=function(_0x37bdd6,_0x57556d,_0x126a46){return db[_0x5061('0x3a')][_0x5061('0x34')]({'where':{'id':_0x37bdd6['params']['id']}})[_0x5061('0x2d')](handleEntityNotFound(_0x57556d,null))[_0x5061('0x2d')](function(_0x195219){if(_0x195219){return _0x195219[_0x5061('0xb7')](_0x37bdd6[_0x5061('0x3c')][_0x5061('0x7f')]);}})[_0x5061('0x2d')](function(_0x27312c){if(_0x27312c){return db[_0x5061('0x6c')][_0x5061('0x36')]({'where':{'ListId':_0x37bdd6[_0x5061('0x3c')][_0x5061('0x7f')],'VoiceQueueId':_0x37bdd6[_0x5061('0x51')]['id']}})[_0x5061('0x2d')](function(){return _0x27312c;});}})['then'](respondWithStatusCode(_0x57556d,null))[_0x5061('0x4f')](handleError(_0x57556d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index d07eead..3ddbff6 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 _0x953a=['save','emit','hook','events','../../mysqldb','setMaxListeners'];(function(_0x23cdb7,_0x349dfb){var _0x2e0fb3=function(_0x40de0e){while(--_0x40de0e){_0x23cdb7['push'](_0x23cdb7['shift']());}};_0x2e0fb3(++_0x349dfb);}(_0x953a,0x6f));var _0xa953=function(_0x5636c4,_0x539003){_0x5636c4=_0x5636c4-0x0;var _0x408044=_0x953a[_0x5636c4];return _0x408044;};'use strict';var EventEmitter=require(_0xa953('0x0'));var VoiceQueue=require(_0xa953('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa953('0x2')](0x0);var events={'afterCreate':_0xa953('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x347da9){return function(_0x2e6415,_0x1d6e2e,_0x4df97b){VoiceQueueEvents['emit'](_0x347da9+':'+_0x2e6415['id'],_0x2e6415);VoiceQueueEvents[_0xa953('0x4')](_0x347da9,_0x2e6415);_0x4df97b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xa953('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x7d85=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x413051,_0x25a3df){var _0x87ad1d=function(_0xf540de){while(--_0xf540de){_0x413051['push'](_0x413051['shift']());}};_0x87ad1d(++_0x25a3df);}(_0x7d85,0xf9));var _0x57d8=function(_0x50f1a6,_0x39c1e7){_0x50f1a6=_0x50f1a6-0x0;var _0x2018ad=_0x7d85[_0x50f1a6];return _0x2018ad;};'use strict';var EventEmitter=require(_0x57d8('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x57d8('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x57d8('0x2')](0x0);var events={'afterCreate':_0x57d8('0x3'),'afterUpdate':_0x57d8('0x4'),'afterDestroy':_0x57d8('0x5')};function emitEvent(_0x18530c){return function(_0x34b73f,_0x399333,_0x4255aa){VoiceQueueEvents[_0x57d8('0x6')](_0x18530c+':'+_0x34b73f['id'],_0x34b73f);VoiceQueueEvents[_0x57d8('0x6')](_0x18530c,_0x34b73f);_0x4255aa(null);};}for(var e in events){if(events[_0x57d8('0x7')](e)){var event=events[e];VoiceQueue[_0x57d8('0x8')](e,emitEvent(event));}}module[_0x57d8('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c6a1308..68ea157 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0x008c,0x188));var _0xc008=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0x008c[_0x3d9b04];return _0x557936;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x42d808,_0x47b4da){var _0x474874=function(_0x117c69){while(--_0x117c69){_0x42d808['push'](_0x42d808['shift']());}};_0x474874(++_0x47b4da);}(_0x34e8,0x12c));var _0x834e=function(_0x49c047,_0x59f0ea){_0x49c047=_0x49c047-0x0;var _0x31968a=_0x34e8[_0x49c047];return _0x31968a;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index c97c800..5110291 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 _0x711d=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','code','error','message','VoiceQueue,\x20%s,\x20%s','catch','VoiceQueue','findAll','options','raw','where','attributes','include','model','map','then','GetVoiceQueue','stringify','ShowVoiceQueue','find','lodash','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x711d,0x13f));var _0xd711=function(_0x52108f,_0x44a1bc){_0x52108f=_0x52108f-0x0;var _0x3f67db=_0x711d[_0x52108f];return _0x3f67db;};'use strict';var _=require(_0xd711('0x0'));var util=require('util');var moment=require(_0xd711('0x1'));var BPromise=require('bluebird');var rs=require(_0xd711('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd711('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd711('0x4'))(_0xd711('0x5'));var config=require(_0xd711('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd711('0x7')][_0xd711('0x8')]({'port':0x232a});config[_0xd711('0x9')]=_['defaults'](config[_0xd711('0x9')],{'host':_0xd711('0xa'),'port':0x18eb});var socket=require(_0xd711('0xb'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xd711('0xc')](socket);function respondWithRpcPromise(_0x429ebf,_0x56127b,_0x4b8e39){return new BPromise(function(_0x17f55b,_0x478769){return client[_0xd711('0xd')](_0x429ebf,_0x4b8e39)['then'](function(_0x5c0ed8){logger[_0xd711('0xe')]('VoiceQueue,\x20%s,\x20%s',_0x56127b,_0xd711('0xf'));logger[_0xd711('0x10')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x56127b,_0xd711('0xf'),JSON['stringify'](_0x5c0ed8));if(_0x5c0ed8['error']){if(_0x5c0ed8['error'][_0xd711('0x11')]===0x1f4){logger[_0xd711('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x56127b,_0x5c0ed8[_0xd711('0x12')]['message']);return _0x478769(_0x5c0ed8[_0xd711('0x12')][_0xd711('0x13')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x56127b,_0x5c0ed8[_0xd711('0x12')][_0xd711('0x13')]);return _0x17f55b(_0x5c0ed8[_0xd711('0x12')]['message']);}else{logger[_0xd711('0xe')](_0xd711('0x14'),_0x56127b,_0xd711('0xf'));_0x17f55b(_0x5c0ed8['result'][_0xd711('0x13')]);}})[_0xd711('0x15')](function(_0x1e6f3e){logger[_0xd711('0x12')](_0xd711('0x14'),_0x56127b,_0x1e6f3e);_0x478769(_0x1e6f3e);});});}exports['GetVoiceQueue']=function(_0x397f3a){var _0xd55d07=this;return new Promise(function(_0xe976bb,_0x27197b){return db[_0xd711('0x16')][_0xd711('0x17')]({'raw':_0x397f3a[_0xd711('0x18')]?_0x397f3a[_0xd711('0x18')][_0xd711('0x19')]===undefined?!![]:![]:!![],'where':_0x397f3a['options']?_0x397f3a[_0xd711('0x18')][_0xd711('0x1a')]||null:null,'attributes':_0x397f3a[_0xd711('0x18')]?_0x397f3a[_0xd711('0x18')][_0xd711('0x1b')]||null:null,'limit':_0x397f3a['options']?_0x397f3a[_0xd711('0x18')]['limit']||null:null,'include':_0x397f3a[_0xd711('0x18')]?_0x397f3a[_0xd711('0x18')][_0xd711('0x1c')]?_['map'](_0x397f3a[_0xd711('0x18')][_0xd711('0x1c')],function(_0x5e33be){return{'model':db[_0x5e33be[_0xd711('0x1d')]],'as':_0x5e33be['as'],'attributes':_0x5e33be[_0xd711('0x1b')],'include':_0x5e33be[_0xd711('0x1c')]?_[_0xd711('0x1e')](_0x5e33be['include'],function(_0x143405){return{'model':db[_0x143405[_0xd711('0x1d')]],'as':_0x143405['as'],'attributes':_0x143405[_0xd711('0x1b')],'include':_0x143405[_0xd711('0x1c')]?_[_0xd711('0x1e')](_0x143405[_0xd711('0x1c')],function(_0x9089f3){return{'model':db[_0x9089f3[_0xd711('0x1d')]],'as':_0x9089f3['as'],'attributes':_0x9089f3[_0xd711('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd711('0x1f')](function(_0x5a3c6d){logger['info'](_0xd711('0x20'),_0x397f3a);logger[_0xd711('0x10')](_0xd711('0x20'),_0x397f3a,JSON[_0xd711('0x21')](_0x5a3c6d));_0xe976bb(_0x5a3c6d);})[_0xd711('0x15')](function(_0x22a8a7){logger[_0xd711('0x12')](_0xd711('0x20'),_0x22a8a7[_0xd711('0x13')],_0x397f3a);_0x27197b(_0xd55d07['error'](0x1f4,_0x22a8a7[_0xd711('0x13')]));});});};exports[_0xd711('0x22')]=function(_0x10d514){var _0x2928b9=this;return new Promise(function(_0x247583,_0x22e32e){return db[_0xd711('0x16')][_0xd711('0x23')]({'raw':_0x10d514['options']?_0x10d514[_0xd711('0x18')][_0xd711('0x19')]===undefined?!![]:![]:!![],'where':_0x10d514[_0xd711('0x18')]?_0x10d514[_0xd711('0x18')]['where']||null:null,'attributes':_0x10d514[_0xd711('0x18')]?_0x10d514[_0xd711('0x18')]['attributes']||null:null,'include':_0x10d514['options']?_0x10d514[_0xd711('0x18')]['include']?_[_0xd711('0x1e')](_0x10d514[_0xd711('0x18')][_0xd711('0x1c')],function(_0x4ee0bf){return{'model':db[_0x4ee0bf[_0xd711('0x1d')]],'as':_0x4ee0bf['as'],'attributes':_0x4ee0bf['attributes'],'include':_0x4ee0bf[_0xd711('0x1c')]?_[_0xd711('0x1e')](_0x4ee0bf[_0xd711('0x1c')],function(_0x15be8e){return{'model':db[_0x15be8e['model']],'as':_0x15be8e['as'],'attributes':_0x15be8e[_0xd711('0x1b')],'include':_0x15be8e[_0xd711('0x1c')]?_[_0xd711('0x1e')](_0x15be8e[_0xd711('0x1c')],function(_0x202d71){return{'model':db[_0x202d71[_0xd711('0x1d')]],'as':_0x202d71['as'],'attributes':_0x202d71[_0xd711('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd711('0x1f')](function(_0xb6d6b2){logger[_0xd711('0xe')](_0xd711('0x22'),_0x10d514);logger['debug'](_0xd711('0x22'),_0x10d514,JSON['stringify'](_0xb6d6b2));_0x247583(_0xb6d6b2);})[_0xd711('0x15')](function(_0x1ca47a){logger[_0xd711('0x12')]('ShowVoiceQueue',_0x1ca47a[_0xd711('0x13')],_0x10d514);_0x22e32e(_0x2928b9[_0xd711('0x12')](0x1f4,_0x1ca47a[_0xd711('0x13')]));});});}; \ No newline at end of file +var _0x876b=['stringify','code','error','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2f8c63,_0x44d3e1){var _0xa88def=function(_0x6cd96d){while(--_0x6cd96d){_0x2f8c63['push'](_0x2f8c63['shift']());}};_0xa88def(++_0x44d3e1);}(_0x876b,0x115));var _0xb876=function(_0x280686,_0x5d5281){_0x280686=_0x280686-0x0;var _0x14ea13=_0x876b[_0x280686];return _0x14ea13;};'use strict';var _=require(_0xb876('0x0'));var util=require(_0xb876('0x1'));var moment=require(_0xb876('0x2'));var BPromise=require(_0xb876('0x3'));var rs=require(_0xb876('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb876('0x5'))['db'];var utils=require(_0xb876('0x6'));var logger=require('../../config/logger')(_0xb876('0x7'));var config=require(_0xb876('0x8'));var jayson=require(_0xb876('0x9'));var client=jayson[_0xb876('0xa')][_0xb876('0xb')]({'port':0x232a});config['redis']=_[_0xb876('0xc')](config[_0xb876('0xd')],{'host':_0xb876('0xe'),'port':0x18eb});var socket=require(_0xb876('0xf'))(new Redis(config[_0xb876('0xd')]));require(_0xb876('0x10'))[_0xb876('0x11')](socket);function respondWithRpcPromise(_0x1f2be1,_0x53df84,_0x2d4740){return new BPromise(function(_0x463f90,_0x32452d){return client['request'](_0x1f2be1,_0x2d4740)[_0xb876('0x12')](function(_0x59e82f){logger[_0xb876('0x13')](_0xb876('0x14'),_0x53df84,_0xb876('0x15'));logger[_0xb876('0x16')](_0xb876('0x17'),_0x53df84,_0xb876('0x15'),JSON[_0xb876('0x18')](_0x59e82f));if(_0x59e82f['error']){if(_0x59e82f['error'][_0xb876('0x19')]===0x1f4){logger[_0xb876('0x1a')](_0xb876('0x14'),_0x53df84,_0x59e82f[_0xb876('0x1a')][_0xb876('0x1b')]);return _0x32452d(_0x59e82f[_0xb876('0x1a')][_0xb876('0x1b')]);}logger[_0xb876('0x1a')](_0xb876('0x14'),_0x53df84,_0x59e82f[_0xb876('0x1a')][_0xb876('0x1b')]);return _0x463f90(_0x59e82f[_0xb876('0x1a')]['message']);}else{logger['info'](_0xb876('0x14'),_0x53df84,_0xb876('0x15'));_0x463f90(_0x59e82f[_0xb876('0x1c')][_0xb876('0x1b')]);}})[_0xb876('0x1d')](function(_0x74736e){logger['error'](_0xb876('0x14'),_0x53df84,_0x74736e);_0x32452d(_0x74736e);});});}exports['GetVoiceQueue']=function(_0x3cac3c){var _0x50e8ed=this;return new Promise(function(_0x4b525a,_0x3fb00f){return db['VoiceQueue'][_0xb876('0x1e')]({'raw':_0x3cac3c[_0xb876('0x1f')]?_0x3cac3c[_0xb876('0x1f')][_0xb876('0x20')]===undefined?!![]:![]:!![],'where':_0x3cac3c[_0xb876('0x1f')]?_0x3cac3c[_0xb876('0x1f')][_0xb876('0x21')]||null:null,'attributes':_0x3cac3c['options']?_0x3cac3c[_0xb876('0x1f')][_0xb876('0x22')]||null:null,'limit':_0x3cac3c['options']?_0x3cac3c[_0xb876('0x1f')][_0xb876('0x23')]||null:null,'include':_0x3cac3c[_0xb876('0x1f')]?_0x3cac3c[_0xb876('0x1f')][_0xb876('0x24')]?_[_0xb876('0x25')](_0x3cac3c[_0xb876('0x1f')][_0xb876('0x24')],function(_0x5516d6){return{'model':db[_0x5516d6[_0xb876('0x26')]],'as':_0x5516d6['as'],'attributes':_0x5516d6['attributes'],'include':_0x5516d6['include']?_['map'](_0x5516d6[_0xb876('0x24')],function(_0x3b457d){return{'model':db[_0x3b457d[_0xb876('0x26')]],'as':_0x3b457d['as'],'attributes':_0x3b457d['attributes'],'include':_0x3b457d['include']?_[_0xb876('0x25')](_0x3b457d[_0xb876('0x24')],function(_0x5dab3f){return{'model':db[_0x5dab3f[_0xb876('0x26')]],'as':_0x5dab3f['as'],'attributes':_0x5dab3f[_0xb876('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb876('0x12')](function(_0x5a4f52){logger[_0xb876('0x13')](_0xb876('0x27'),_0x3cac3c);logger[_0xb876('0x16')]('GetVoiceQueue',_0x3cac3c,JSON[_0xb876('0x18')](_0x5a4f52));_0x4b525a(_0x5a4f52);})[_0xb876('0x1d')](function(_0x5547df){logger[_0xb876('0x1a')]('GetVoiceQueue',_0x5547df[_0xb876('0x1b')],_0x3cac3c);_0x3fb00f(_0x50e8ed[_0xb876('0x1a')](0x1f4,_0x5547df[_0xb876('0x1b')]));});});};exports[_0xb876('0x28')]=function(_0x2be2c2){var _0x3f58b0=this;return new Promise(function(_0x108e53,_0x329299){return db[_0xb876('0x29')][_0xb876('0x2a')]({'raw':_0x2be2c2[_0xb876('0x1f')]?_0x2be2c2[_0xb876('0x1f')][_0xb876('0x20')]===undefined?!![]:![]:!![],'where':_0x2be2c2[_0xb876('0x1f')]?_0x2be2c2['options'][_0xb876('0x21')]||null:null,'attributes':_0x2be2c2[_0xb876('0x1f')]?_0x2be2c2[_0xb876('0x1f')][_0xb876('0x22')]||null:null,'include':_0x2be2c2[_0xb876('0x1f')]?_0x2be2c2[_0xb876('0x1f')][_0xb876('0x24')]?_['map'](_0x2be2c2[_0xb876('0x1f')][_0xb876('0x24')],function(_0x412a85){return{'model':db[_0x412a85[_0xb876('0x26')]],'as':_0x412a85['as'],'attributes':_0x412a85[_0xb876('0x22')],'include':_0x412a85['include']?_[_0xb876('0x25')](_0x412a85[_0xb876('0x24')],function(_0x31a9a5){return{'model':db[_0x31a9a5[_0xb876('0x26')]],'as':_0x31a9a5['as'],'attributes':_0x31a9a5[_0xb876('0x22')],'include':_0x31a9a5[_0xb876('0x24')]?_[_0xb876('0x25')](_0x31a9a5['include'],function(_0x415826){return{'model':db[_0x415826[_0xb876('0x26')]],'as':_0x415826['as'],'attributes':_0x415826[_0xb876('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb876('0x12')](function(_0x3f14fd){logger[_0xb876('0x13')]('ShowVoiceQueue',_0x2be2c2);logger['debug'](_0xb876('0x28'),_0x2be2c2,JSON['stringify'](_0x3f14fd));_0x108e53(_0x3f14fd);})[_0xb876('0x1d')](function(_0x1094cc){logger[_0xb876('0x1a')]('ShowVoiceQueue',_0x1094cc[_0xb876('0x1b')],_0x2be2c2);_0x329299(_0x3f58b0[_0xb876('0x1a')](0x1f4,_0x1094cc[_0xb876('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 53e2922..b2c3b5f 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 _0x214a=['removeListener','register','voiceQueue:','./voiceQueue.events','remove','emit'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x214a,0x195));var _0xa214=function(_0x44245f,_0x2aab46){_0x44245f=_0x44245f-0x0;var _0x223482=_0x214a[_0x44245f];return _0x223482;};'use strict';var VoiceQueueEvents=require(_0xa214('0x0'));var events=['save',_0xa214('0x1'),'update'];function createListener(_0x8fe1d1,_0x14eb5b){return function(_0x5ab399){_0x14eb5b[_0xa214('0x2')](_0x8fe1d1,_0x5ab399);};}function removeListener(_0x3957f5,_0xfe06d3){return function(){VoiceQueueEvents[_0xa214('0x3')](_0x3957f5,_0xfe06d3);};}exports[_0xa214('0x4')]=function(_0x5d9f95){for(var _0x2ca2d6=0x0,_0x395d05=events['length'];_0x2ca2d6<_0x395d05;_0x2ca2d6++){var _0x515e67=events[_0x2ca2d6];var _0x2d2e95=createListener(_0xa214('0x5')+_0x515e67,_0x5d9f95);VoiceQueueEvents['on'](_0x515e67,_0x2d2e95);}}; \ No newline at end of file +var _0x9d31=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x4fdb95,_0x217e84){var _0x22a379=function(_0x131363){while(--_0x131363){_0x4fdb95['push'](_0x4fdb95['shift']());}};_0x22a379(++_0x217e84);}(_0x9d31,0x108));var _0x19d3=function(_0xc9c2b9,_0x570606){_0xc9c2b9=_0xc9c2b9-0x0;var _0x12f9c2=_0x9d31[_0xc9c2b9];return _0x12f9c2;};'use strict';var VoiceQueueEvents=require(_0x19d3('0x0'));var events=[_0x19d3('0x1'),_0x19d3('0x2'),_0x19d3('0x3')];function createListener(_0x19d236,_0x30e760){return function(_0x79b6bb){_0x30e760[_0x19d3('0x4')](_0x19d236,_0x79b6bb);};}function removeListener(_0x28c05f,_0x3e452d){return function(){VoiceQueueEvents[_0x19d3('0x5')](_0x28c05f,_0x3e452d);};}exports[_0x19d3('0x6')]=function(_0xe5e2d6){for(var _0x2fae3b=0x0,_0x30a249=events[_0x19d3('0x7')];_0x2fae3b<_0x30a249;_0x2fae3b++){var _0x5c85e6=events[_0x2fae3b];var _0x2b6c07=createListener(_0x19d3('0x8')+_0x5c85e6,_0xe5e2d6);VoiceQueueEvents['on'](_0x5c85e6,_0x2b6c07);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 6773e8c..122a860 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 _0x0f0d=['put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create'];(function(_0x281a3d,_0x86b2ad){var _0xd5cd59=function(_0x570484){while(--_0x570484){_0x281a3d['push'](_0x281a3d['shift']());}};_0xd5cd59(++_0x86b2ad);}(_0x0f0d,0x95));var _0xd0f0=function(_0x43d0e6,_0x3c1489){_0x43d0e6=_0x43d0e6-0x0;var _0x51d841=_0x0f0d[_0x43d0e6];return _0x51d841;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd0f0('0x0'));var timeout=require('connect-timeout');var express=require(_0xd0f0('0x1'));var router=express[_0xd0f0('0x2')]();var fs_extra=require(_0xd0f0('0x3'));var auth=require(_0xd0f0('0x4'));var interaction=require(_0xd0f0('0x5'));var config=require(_0xd0f0('0x6'));var controller=require(_0xd0f0('0x7'));router[_0xd0f0('0x8')]('/',auth[_0xd0f0('0x9')](),controller[_0xd0f0('0xa')]);router[_0xd0f0('0x8')](_0xd0f0('0xb'),auth[_0xd0f0('0x9')](),controller[_0xd0f0('0xc')]);router[_0xd0f0('0x8')](_0xd0f0('0xd'),auth['isAuthenticated'](),controller[_0xd0f0('0xe')]);router['get'](_0xd0f0('0xf'),auth['isAuthenticated'](),controller[_0xd0f0('0x10')]);router[_0xd0f0('0x11')]('/',auth['isAuthenticated'](),controller[_0xd0f0('0x12')]);router[_0xd0f0('0x13')]('/:id',auth[_0xd0f0('0x9')](),controller[_0xd0f0('0x14')]);router[_0xd0f0('0x15')](_0xd0f0('0xf'),auth['isAuthenticated'](),controller[_0xd0f0('0x16')]);module[_0xd0f0('0x17')]=router; \ No newline at end of file +var _0xcd6e=['show','post','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd6e,0x1d2));var _0xecd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xecd6('0x0'));var util=require(_0xecd6('0x1'));var path=require(_0xecd6('0x2'));var timeout=require('connect-timeout');var express=require(_0xecd6('0x3'));var router=express[_0xecd6('0x4')]();var fs_extra=require(_0xecd6('0x5'));var auth=require(_0xecd6('0x6'));var interaction=require(_0xecd6('0x7'));var config=require(_0xecd6('0x8'));var controller=require(_0xecd6('0x9'));router[_0xecd6('0xa')]('/',auth[_0xecd6('0xb')](),controller[_0xecd6('0xc')]);router[_0xecd6('0xa')]('/describe',auth[_0xecd6('0xb')](),controller[_0xecd6('0xd')]);router[_0xecd6('0xa')](_0xecd6('0xe'),auth['isAuthenticated'](),controller[_0xecd6('0xf')]);router[_0xecd6('0xa')](_0xecd6('0x10'),auth[_0xecd6('0xb')](),controller[_0xecd6('0x11')]);router[_0xecd6('0x12')]('/',auth[_0xecd6('0xb')](),controller['create']);router['put'](_0xecd6('0x10'),auth[_0xecd6('0xb')](),controller[_0xecd6('0x13')]);router[_0xecd6('0x14')](_0xecd6('0x10'),auth[_0xecd6('0xb')](),controller[_0xecd6('0x15')]);module[_0xecd6('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 323237f..83e93f0 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 _0x6086=['DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6086,0x16d));var _0x6608=function(_0xbb4cb5,_0x44f47a){_0xbb4cb5=_0xbb4cb5-0x0;var _0x28a5cd=_0x6086[_0xbb4cb5];return _0x28a5cd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6608('0x0'));module[_0x6608('0x1')]={'type':{'type':Sequelize[_0x6608('0x2')]},'uniqueid':{'type':Sequelize[_0x6608('0x2')]},'calleridnum':{'type':Sequelize[_0x6608('0x2')]},'calleridname':{'type':Sequelize[_0x6608('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x6608('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x6608('0x3')],'set':function(_0x4bd45c){var _0x4a1da4=moment(_0x4bd45c);var _0x3b85f8=moment(this[_0x6608('0x4')]('queuecallerjoinAt'))[_0x6608('0x5')](_0x6608('0x6'));var _0x561dac=_0x4a1da4[_0x6608('0x7')](_0x3b85f8,_0x6608('0x8'));this[_0x6608('0x9')](_0x6608('0xa'),_0x4bd45c);this[_0x6608('0x9')](_0x6608('0xb'),_0x561dac||null);}},'position':{'type':Sequelize[_0x6608('0xc')]},'count':{'type':Sequelize[_0x6608('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x6608('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6608('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x6608('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6608('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6608('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x6608('0xe')},'originalposition':{'type':Sequelize[_0x6608('0xc')]},'channel':{'type':Sequelize[_0x6608('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6608('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6608('0x2')]},'exten':{'type':Sequelize[_0x6608('0x2')]},'priority':{'type':Sequelize[_0x6608('0x2')]},'holdtime':{'type':Sequelize[_0x6608('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6608('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6608('0x2')]},'transfer':{'type':Sequelize[_0x6608('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x6608('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x6608('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6608('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6608('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6608('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x245e=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x2578ef,_0x471939){var _0x5c1150=function(_0x432673){while(--_0x432673){_0x2578ef['push'](_0x2578ef['shift']());}};_0x5c1150(++_0x471939);}(_0x245e,0x17d));var _0xe245=function(_0x114950,_0x2c8a0c){_0x114950=_0x114950-0x0;var _0x4ce31c=_0x245e[_0x114950];return _0x4ce31c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe245('0x0'));module[_0xe245('0x1')]={'type':{'type':Sequelize[_0xe245('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe245('0x2')]},'calleridname':{'type':Sequelize[_0xe245('0x2')]},'queue':{'type':Sequelize[_0xe245('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xe245('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xe245('0x3')],'set':function(_0x26094d){var _0x19c652=moment(_0x26094d);var _0x2e3bfe=moment(this[_0xe245('0x4')](_0xe245('0x5')))[_0xe245('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x49d4bf=_0x19c652['diff'](_0x2e3bfe,'seconds');this[_0xe245('0x7')](_0xe245('0x8'),_0x26094d);this[_0xe245('0x7')](_0xe245('0x9'),_0x49d4bf||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xe245('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe245('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xe245('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe245('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe245('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xe245('0xc')},'originalposition':{'type':Sequelize[_0xe245('0xa')]},'channel':{'type':Sequelize[_0xe245('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe245('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xe245('0xa')]},'mohtime':{'type':Sequelize[_0xe245('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe245('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe245('0x2')]},'transfer':{'type':Sequelize[_0xe245('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe245('0x2')],'comment':_0xe245('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xe245('0x2')]},'disposition':{'type':Sequelize[_0xe245('0x2')]},'secondDisposition':{'type':Sequelize[_0xe245('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b3629a4..5127337 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 _0xbd82=['register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','VoiceQueueReport','include','findAll','catch','show','keys','includeAll','find','create','body','params','describe','rows','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0xa3e151,_0x24afe6){var _0x15231c=function(_0x152be){while(--_0x152be){_0xa3e151['push'](_0xa3e151['shift']());}};_0x15231c(++_0x24afe6);}(_0xbd82,0x91));var _0x2bd8=function(_0x22caa9,_0x15006d){_0x22caa9=_0x22caa9-0x0;var _0x2fdf50=_0xbd82[_0x22caa9];return _0x2fdf50;};'use strict';var emlformat=require(_0x2bd8('0x0'));var rimraf=require(_0x2bd8('0x1'));var zipdir=require(_0x2bd8('0x2'));var jsonpatch=require(_0x2bd8('0x3'));var rp=require(_0x2bd8('0x4'));var moment=require(_0x2bd8('0x5'));var BPromise=require(_0x2bd8('0x6'));var Mustache=require(_0x2bd8('0x7'));var util=require(_0x2bd8('0x8'));var path=require(_0x2bd8('0x9'));var sox=require(_0x2bd8('0xa'));var csv=require('to-csv');var ejs=require(_0x2bd8('0xb'));var fs=require('fs');var fs_extra=require(_0x2bd8('0xc'));var _=require(_0x2bd8('0xd'));var squel=require(_0x2bd8('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2bd8('0xf'));var toCsv=require(_0x2bd8('0x10'));var querystring=require(_0x2bd8('0x11'));var Papa=require(_0x2bd8('0x12'));var Redis=require(_0x2bd8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2bd8('0x14'));var as=require(_0x2bd8('0x15'));var hardwareService=require(_0x2bd8('0x16'));var logger=require(_0x2bd8('0x17'))(_0x2bd8('0x18'));var utils=require('../../config/utils');var config=require(_0x2bd8('0x19'));var licenseUtil=require(_0x2bd8('0x1a'));var db=require(_0x2bd8('0x1b'))['db'];config[_0x2bd8('0x1c')]=_[_0x2bd8('0x1d')](config[_0x2bd8('0x1c')],{'host':_0x2bd8('0x1e'),'port':0x18eb});var socket=require(_0x2bd8('0x1f'))(new Redis(config[_0x2bd8('0x1c')]));require(_0x2bd8('0x20'))[_0x2bd8('0x21')](socket);function respondWithStatusCode(_0x5777e1,_0x4c0b6c){_0x4c0b6c=_0x4c0b6c||0xcc;return function(_0x4eb3f6){if(_0x4eb3f6){return _0x5777e1[_0x2bd8('0x22')](_0x4c0b6c);}return _0x5777e1[_0x2bd8('0x23')](_0x4c0b6c)[_0x2bd8('0x24')]();};}function respondWithResult(_0x589073,_0x93e61c){_0x93e61c=_0x93e61c||0xc8;return function(_0x422867){if(_0x422867){return _0x589073[_0x2bd8('0x23')](_0x93e61c)[_0x2bd8('0x25')](_0x422867);}};}function respondWithFilteredResult(_0x33f92f,_0x36315b){return function(_0x1d4bcf){if(_0x1d4bcf){var _0x32242a=typeof _0x36315b[_0x2bd8('0x26')]===_0x2bd8('0x27')&&typeof _0x36315b[_0x2bd8('0x28')]===_0x2bd8('0x27');var _0x32bb8e=_0x1d4bcf[_0x2bd8('0x29')];var _0xf4ec2=_0x32242a?0x0:_0x36315b[_0x2bd8('0x26')];var _0x3d0baa=_0x32242a?_0x1d4bcf[_0x2bd8('0x29')]:_0x36315b[_0x2bd8('0x26')]+_0x36315b[_0x2bd8('0x28')];var _0x38c3ee;if(_0x3d0baa>=_0x32bb8e){_0x3d0baa=_0x32bb8e;_0x38c3ee=0xc8;}else{_0x38c3ee=0xce;}_0x33f92f[_0x2bd8('0x23')](_0x38c3ee);return _0x33f92f[_0x2bd8('0x2a')](_0x2bd8('0x2b'),_0xf4ec2+'-'+_0x3d0baa+'/'+_0x32bb8e)['json'](_0x1d4bcf);}return null;};}function patchUpdates(_0x2e573b){return function(_0x10930c){try{jsonpatch[_0x2bd8('0x2c')](_0x10930c,_0x2e573b,!![]);}catch(_0x2df2f7){return BPromise[_0x2bd8('0x2d')](_0x2df2f7);}return _0x10930c[_0x2bd8('0x2e')]();};}function saveUpdates(_0x599237,_0x2b4882){return function(_0x1af2b0){if(_0x1af2b0){return _0x1af2b0[_0x2bd8('0x2f')](_0x599237)[_0x2bd8('0x30')](function(_0x416f4e){return _0x416f4e;});}return null;};}function removeEntity(_0x468fbe,_0x1d0dc1){return function(_0x4cc854){if(_0x4cc854){return _0x4cc854[_0x2bd8('0x31')]()[_0x2bd8('0x30')](function(){_0x468fbe[_0x2bd8('0x23')](0xcc)[_0x2bd8('0x24')]();});}};}function handleEntityNotFound(_0x57878e,_0x43e388){return function(_0x5da41d){if(!_0x5da41d){_0x57878e[_0x2bd8('0x22')](0x194);}return _0x5da41d;};}function handleError(_0x5273b3,_0x44f385){_0x44f385=_0x44f385||0x1f4;return function(_0x27a6c8){logger[_0x2bd8('0x32')](_0x27a6c8['stack']);if(_0x27a6c8[_0x2bd8('0x33')]){delete _0x27a6c8[_0x2bd8('0x33')];}_0x5273b3['status'](_0x44f385)[_0x2bd8('0x34')](_0x27a6c8);};}exports[_0x2bd8('0x35')]=function(_0x51c5be,_0x29f195){var _0x309a6d={},_0xb5c88={},_0x1aa077={'count':0x0,'rows':[]};var _0x2d304e=_[_0x2bd8('0x36')](db['VoiceQueueReport'][_0x2bd8('0x37')],function(_0x30e7ef){return{'name':_0x30e7ef[_0x2bd8('0x38')],'type':_0x30e7ef[_0x2bd8('0x39')][_0x2bd8('0x3a')]};});_0xb5c88[_0x2bd8('0x3b')]=_[_0x2bd8('0x36')](_0x2d304e,'name');_0xb5c88[_0x2bd8('0x3c')]=_['keys'](_0x51c5be[_0x2bd8('0x3c')]);_0xb5c88['filters']=_['intersection'](_0xb5c88['model'],_0xb5c88[_0x2bd8('0x3c')]);_0x309a6d['attributes']=_[_0x2bd8('0x3d')](_0xb5c88[_0x2bd8('0x3b')],qs[_0x2bd8('0x3e')](_0x51c5be[_0x2bd8('0x3c')][_0x2bd8('0x3e')]));_0x309a6d[_0x2bd8('0x3f')]=_0x309a6d[_0x2bd8('0x3f')][_0x2bd8('0x40')]?_0x309a6d[_0x2bd8('0x3f')]:_0xb5c88[_0x2bd8('0x3b')];if(!_0x51c5be['query'][_0x2bd8('0x41')](_0x2bd8('0x42'))){_0x309a6d[_0x2bd8('0x28')]=qs['limit'](_0x51c5be[_0x2bd8('0x3c')][_0x2bd8('0x28')]);_0x309a6d[_0x2bd8('0x26')]=qs[_0x2bd8('0x26')](_0x51c5be['query'][_0x2bd8('0x26')]);}_0x309a6d[_0x2bd8('0x43')]=qs[_0x2bd8('0x44')](_0x51c5be['query'][_0x2bd8('0x44')]);_0x309a6d['where']=qs[_0x2bd8('0x45')](_[_0x2bd8('0x46')](_0x51c5be[_0x2bd8('0x3c')],_0xb5c88['filters']),_0x2d304e);if(_0x51c5be['query']['filter']){_0x309a6d[_0x2bd8('0x47')]=_[_0x2bd8('0x48')](_0x309a6d['where'],{'$or':_['map'](_0x2d304e,function(_0x125830){if(_0x125830[_0x2bd8('0x39')]!==_0x2bd8('0x49')){var _0x31b40a={};_0x31b40a[_0x125830[_0x2bd8('0x33')]]={'$like':'%'+_0x51c5be['query'][_0x2bd8('0x4a')]+'%'};return _0x31b40a;}})});}_0x309a6d=_['merge']({},_0x309a6d,_0x51c5be['options']);var _0x401b60={'where':_0x309a6d[_0x2bd8('0x47')]};return db[_0x2bd8('0x4b')][_0x2bd8('0x29')](_0x401b60)[_0x2bd8('0x30')](function(_0x388a10){_0x1aa077[_0x2bd8('0x29')]=_0x388a10;if(_0x51c5be[_0x2bd8('0x3c')]['includeAll']){_0x309a6d[_0x2bd8('0x4c')]=[{'all':!![]}];}return db[_0x2bd8('0x4b')][_0x2bd8('0x4d')](_0x309a6d);})[_0x2bd8('0x30')](function(_0x263197){_0x1aa077['rows']=_0x263197;return _0x1aa077;})[_0x2bd8('0x30')](respondWithFilteredResult(_0x29f195,_0x309a6d))[_0x2bd8('0x4e')](handleError(_0x29f195,null));};exports[_0x2bd8('0x4f')]=function(_0x29e8db,_0x56b5bf){var _0x21e7de={'raw':![],'where':{'id':_0x29e8db['params']['id']}},_0x5cf6e8={};_0x5cf6e8['model']=_[_0x2bd8('0x50')](db[_0x2bd8('0x4b')]['rawAttributes']);_0x5cf6e8[_0x2bd8('0x3c')]=_[_0x2bd8('0x50')](_0x29e8db[_0x2bd8('0x3c')]);_0x5cf6e8['filters']=_[_0x2bd8('0x3d')](_0x5cf6e8[_0x2bd8('0x3b')],_0x5cf6e8['query']);_0x21e7de[_0x2bd8('0x3f')]=_['intersection'](_0x5cf6e8[_0x2bd8('0x3b')],qs[_0x2bd8('0x3e')](_0x29e8db[_0x2bd8('0x3c')][_0x2bd8('0x3e')]));_0x21e7de[_0x2bd8('0x3f')]=_0x21e7de['attributes'][_0x2bd8('0x40')]?_0x21e7de[_0x2bd8('0x3f')]:_0x5cf6e8[_0x2bd8('0x3b')];if(_0x29e8db[_0x2bd8('0x3c')][_0x2bd8('0x51')]){_0x21e7de[_0x2bd8('0x4c')]=[{'all':!![]}];}_0x21e7de=_['merge']({},_0x21e7de,_0x29e8db['options']);return db['VoiceQueueReport'][_0x2bd8('0x52')](_0x21e7de)[_0x2bd8('0x30')](handleEntityNotFound(_0x56b5bf,null))[_0x2bd8('0x30')](respondWithResult(_0x56b5bf,null))[_0x2bd8('0x4e')](handleError(_0x56b5bf,null));};exports['create']=function(_0x434701,_0x148781){return db['VoiceQueueReport'][_0x2bd8('0x53')](_0x434701[_0x2bd8('0x54')],{})['then'](respondWithResult(_0x148781,0xc9))[_0x2bd8('0x4e')](handleError(_0x148781,null));};exports[_0x2bd8('0x2f')]=function(_0x301416,_0x2a2fb9){if(_0x301416['body']['id']){delete _0x301416[_0x2bd8('0x54')]['id'];}return db[_0x2bd8('0x4b')][_0x2bd8('0x52')]({'where':{'id':_0x301416['params']['id']}})['then'](handleEntityNotFound(_0x2a2fb9,null))[_0x2bd8('0x30')](saveUpdates(_0x301416[_0x2bd8('0x54')],null))[_0x2bd8('0x30')](respondWithResult(_0x2a2fb9,null))[_0x2bd8('0x4e')](handleError(_0x2a2fb9,null));};exports['destroy']=function(_0x2481f1,_0x129be3){return db['VoiceQueueReport'][_0x2bd8('0x52')]({'where':{'id':_0x2481f1[_0x2bd8('0x55')]['id']}})['then'](handleEntityNotFound(_0x129be3,null))[_0x2bd8('0x30')](removeEntity(_0x129be3,null))[_0x2bd8('0x4e')](handleError(_0x129be3,null));};exports[_0x2bd8('0x56')]=function(_0x16616e,_0x5a3edd){return db[_0x2bd8('0x4b')]['describe']()[_0x2bd8('0x30')](respondWithResult(_0x5a3edd,null))['catch'](handleError(_0x5a3edd,null));};exports['getVoiceQueuesReport']=function(_0x4917eb,_0x56c76a){var _0x5821b6={},_0x11bd1e={},_0xbd8c28={'count':0x0,'rows':[]};_0x11bd1e[_0x2bd8('0x3b')]=_['keys'](db[_0x2bd8('0x4b')]['rawAttributes']);_0x11bd1e[_0x2bd8('0x3c')]=_[_0x2bd8('0x50')](_0x4917eb[_0x2bd8('0x3c')]);_0x11bd1e[_0x2bd8('0x45')]=_['intersection'](_0x11bd1e[_0x2bd8('0x3b')],_0x11bd1e[_0x2bd8('0x3c')]);_0x5821b6[_0x2bd8('0x3f')]=_[_0x2bd8('0x3d')](_0x11bd1e[_0x2bd8('0x3b')],qs[_0x2bd8('0x3e')](_0x4917eb[_0x2bd8('0x3c')]['fields']));_0x5821b6[_0x2bd8('0x3f')]=_0x5821b6[_0x2bd8('0x3f')][_0x2bd8('0x40')]?_0x5821b6[_0x2bd8('0x3f')]:_0x11bd1e[_0x2bd8('0x3b')];if(!_0x4917eb[_0x2bd8('0x3c')][_0x2bd8('0x41')](_0x2bd8('0x42'))){_0x5821b6[_0x2bd8('0x28')]=qs['limit'](_0x4917eb[_0x2bd8('0x3c')]['limit']);_0x5821b6['offset']=qs[_0x2bd8('0x26')](_0x4917eb[_0x2bd8('0x3c')][_0x2bd8('0x26')]);}_0x5821b6[_0x2bd8('0x43')]=qs[_0x2bd8('0x44')](_0x4917eb[_0x2bd8('0x3c')][_0x2bd8('0x44')]);_0x5821b6[_0x2bd8('0x47')]=qs['filters'](_[_0x2bd8('0x46')](_0x4917eb[_0x2bd8('0x3c')],_0x11bd1e['filters']));if(_0x4917eb[_0x2bd8('0x3c')][_0x2bd8('0x4a')]){_0x5821b6[_0x2bd8('0x47')]=_[_0x2bd8('0x48')](_0x5821b6[_0x2bd8('0x47')],{'$or':_[_0x2bd8('0x36')](_0x5821b6[_0x2bd8('0x3f')],function(_0x5e09e7){var _0x2db367={};_0x2db367[_0x5e09e7]={'$like':'%'+_0x4917eb[_0x2bd8('0x3c')][_0x2bd8('0x4a')]+'%'};return _0x2db367;})});}_0x5821b6=_[_0x2bd8('0x48')]({},_0x5821b6,_0x4917eb['options']);var _0x7dbec1={'where':_0x5821b6[_0x2bd8('0x47')]};return db[_0x2bd8('0x4b')][_0x2bd8('0x29')](_0x7dbec1)[_0x2bd8('0x30')](function(_0x48567b){_0xbd8c28[_0x2bd8('0x29')]=_0x48567b;if(_0x4917eb[_0x2bd8('0x3c')][_0x2bd8('0x51')]){_0x5821b6[_0x2bd8('0x4c')]=[{'all':!![]}];}return db[_0x2bd8('0x4b')][_0x2bd8('0x4d')](_0x5821b6);})[_0x2bd8('0x30')](function(_0x569d90){_0xbd8c28[_0x2bd8('0x57')]=_0x569d90;return _0xbd8c28;})[_0x2bd8('0x30')](respondWithFilteredResult(_0x56c76a,_0x5821b6,_0x2bd8('0x58')))['catch'](handleError(_0x56c76a,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x2bec=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','getVoiceQueuesReport','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x588940,_0x231c54){var _0x5deea4=function(_0xd82335){while(--_0xd82335){_0x588940['push'](_0x588940['shift']());}};_0x5deea4(++_0x231c54);}(_0x2bec,0x19a));var _0xc2be=function(_0x4c3c08,_0x9918d8){_0x4c3c08=_0x4c3c08-0x0;var _0x38b931=_0x2bec[_0x4c3c08];return _0x38b931;};'use strict';var emlformat=require(_0xc2be('0x0'));var rimraf=require(_0xc2be('0x1'));var zipdir=require(_0xc2be('0x2'));var jsonpatch=require(_0xc2be('0x3'));var rp=require(_0xc2be('0x4'));var moment=require(_0xc2be('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2be('0x6'));var util=require(_0xc2be('0x7'));var path=require(_0xc2be('0x8'));var sox=require(_0xc2be('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2be('0xa'));var _=require(_0xc2be('0xb'));var squel=require(_0xc2be('0xc'));var crypto=require(_0xc2be('0xd'));var jsforce=require(_0xc2be('0xe'));var deskjs=require(_0xc2be('0xf'));var toCsv=require(_0xc2be('0x10'));var querystring=require('querystring');var Papa=require(_0xc2be('0x11'));var Redis=require(_0xc2be('0x12'));var authService=require(_0xc2be('0x13'));var qs=require(_0xc2be('0x14'));var as=require(_0xc2be('0x15'));var hardwareService=require(_0xc2be('0x16'));var logger=require(_0xc2be('0x17'))('api');var utils=require(_0xc2be('0x18'));var config=require(_0xc2be('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc2be('0x1a')]=_[_0xc2be('0x1b')](config[_0xc2be('0x1a')],{'host':_0xc2be('0x1c'),'port':0x18eb});var socket=require(_0xc2be('0x1d'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xc2be('0x1e')](socket);function respondWithStatusCode(_0x4bb205,_0xc5c9bc){_0xc5c9bc=_0xc5c9bc||0xcc;return function(_0x487251){if(_0x487251){return _0x4bb205[_0xc2be('0x1f')](_0xc5c9bc);}return _0x4bb205[_0xc2be('0x20')](_0xc5c9bc)[_0xc2be('0x21')]();};}function respondWithResult(_0x25f6a8,_0x288621){_0x288621=_0x288621||0xc8;return function(_0x1b4aa3){if(_0x1b4aa3){return _0x25f6a8[_0xc2be('0x20')](_0x288621)[_0xc2be('0x22')](_0x1b4aa3);}};}function respondWithFilteredResult(_0x432fef,_0x362787){return function(_0xe5a2a3){if(_0xe5a2a3){var _0x308e0d=typeof _0x362787['offset']===_0xc2be('0x23')&&typeof _0x362787[_0xc2be('0x24')]===_0xc2be('0x23');var _0x1d4dd4=_0xe5a2a3[_0xc2be('0x25')];var _0x30650c=_0x308e0d?0x0:_0x362787[_0xc2be('0x26')];var _0x26a47b=_0x308e0d?_0xe5a2a3['count']:_0x362787['offset']+_0x362787[_0xc2be('0x24')];var _0x482b86;if(_0x26a47b>=_0x1d4dd4){_0x26a47b=_0x1d4dd4;_0x482b86=0xc8;}else{_0x482b86=0xce;}_0x432fef[_0xc2be('0x20')](_0x482b86);return _0x432fef[_0xc2be('0x27')](_0xc2be('0x28'),_0x30650c+'-'+_0x26a47b+'/'+_0x1d4dd4)[_0xc2be('0x22')](_0xe5a2a3);}return null;};}function patchUpdates(_0x5066f2){return function(_0x8a2d6d){try{jsonpatch[_0xc2be('0x29')](_0x8a2d6d,_0x5066f2,!![]);}catch(_0x4c5dbe){return BPromise[_0xc2be('0x2a')](_0x4c5dbe);}return _0x8a2d6d[_0xc2be('0x2b')]();};}function saveUpdates(_0x1f6e18,_0x1791ed){return function(_0x2f98a7){if(_0x2f98a7){return _0x2f98a7[_0xc2be('0x2c')](_0x1f6e18)[_0xc2be('0x2d')](function(_0x108b36){return _0x108b36;});}return null;};}function removeEntity(_0x2d6ab4,_0x353e93){return function(_0x85cde){if(_0x85cde){return _0x85cde[_0xc2be('0x2e')]()[_0xc2be('0x2d')](function(){_0x2d6ab4[_0xc2be('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf22713,_0xf49440){return function(_0x4ca411){if(!_0x4ca411){_0xf22713[_0xc2be('0x1f')](0x194);}return _0x4ca411;};}function handleError(_0x1c437b,_0x3695d5){_0x3695d5=_0x3695d5||0x1f4;return function(_0x3ecf08){logger[_0xc2be('0x2f')](_0x3ecf08['stack']);if(_0x3ecf08[_0xc2be('0x30')]){delete _0x3ecf08[_0xc2be('0x30')];}_0x1c437b[_0xc2be('0x20')](_0x3695d5)[_0xc2be('0x31')](_0x3ecf08);};}exports['index']=function(_0x159ef8,_0x51b77b){var _0x3895c8={},_0xd71d28={},_0x515397={'count':0x0,'rows':[]};var _0x2cd8e6=_[_0xc2be('0x32')](db[_0xc2be('0x33')][_0xc2be('0x34')],function(_0x4bcbe7){return{'name':_0x4bcbe7[_0xc2be('0x35')],'type':_0x4bcbe7[_0xc2be('0x36')][_0xc2be('0x37')]};});_0xd71d28[_0xc2be('0x38')]=_[_0xc2be('0x32')](_0x2cd8e6,_0xc2be('0x30'));_0xd71d28[_0xc2be('0x39')]=_[_0xc2be('0x3a')](_0x159ef8['query']);_0xd71d28[_0xc2be('0x3b')]=_['intersection'](_0xd71d28[_0xc2be('0x38')],_0xd71d28[_0xc2be('0x39')]);_0x3895c8[_0xc2be('0x3c')]=_[_0xc2be('0x3d')](_0xd71d28[_0xc2be('0x38')],qs[_0xc2be('0x3e')](_0x159ef8[_0xc2be('0x39')][_0xc2be('0x3e')]));_0x3895c8[_0xc2be('0x3c')]=_0x3895c8[_0xc2be('0x3c')][_0xc2be('0x3f')]?_0x3895c8['attributes']:_0xd71d28['model'];if(!_0x159ef8['query']['hasOwnProperty'](_0xc2be('0x40'))){_0x3895c8[_0xc2be('0x24')]=qs[_0xc2be('0x24')](_0x159ef8[_0xc2be('0x39')]['limit']);_0x3895c8[_0xc2be('0x26')]=qs[_0xc2be('0x26')](_0x159ef8[_0xc2be('0x39')][_0xc2be('0x26')]);}_0x3895c8[_0xc2be('0x41')]=qs[_0xc2be('0x42')](_0x159ef8['query'][_0xc2be('0x42')]);_0x3895c8[_0xc2be('0x43')]=qs[_0xc2be('0x3b')](_[_0xc2be('0x44')](_0x159ef8[_0xc2be('0x39')],_0xd71d28[_0xc2be('0x3b')]),_0x2cd8e6);if(_0x159ef8[_0xc2be('0x39')]['filter']){_0x3895c8[_0xc2be('0x43')]=_['merge'](_0x3895c8['where'],{'$or':_[_0xc2be('0x32')](_0x2cd8e6,function(_0x503931){if(_0x503931[_0xc2be('0x36')]!==_0xc2be('0x45')){var _0xa55ae9={};_0xa55ae9[_0x503931[_0xc2be('0x30')]]={'$like':'%'+_0x159ef8[_0xc2be('0x39')]['filter']+'%'};return _0xa55ae9;}})});}_0x3895c8=_[_0xc2be('0x46')]({},_0x3895c8,_0x159ef8[_0xc2be('0x47')]);var _0x4d3fa5={'where':_0x3895c8[_0xc2be('0x43')]};return db[_0xc2be('0x33')][_0xc2be('0x25')](_0x4d3fa5)[_0xc2be('0x2d')](function(_0x130700){_0x515397[_0xc2be('0x25')]=_0x130700;if(_0x159ef8[_0xc2be('0x39')][_0xc2be('0x48')]){_0x3895c8['include']=[{'all':!![]}];}return db[_0xc2be('0x33')][_0xc2be('0x49')](_0x3895c8);})['then'](function(_0xd77fce){_0x515397[_0xc2be('0x4a')]=_0xd77fce;return _0x515397;})['then'](respondWithFilteredResult(_0x51b77b,_0x3895c8))[_0xc2be('0x4b')](handleError(_0x51b77b,null));};exports[_0xc2be('0x4c')]=function(_0x7d50a,_0x438595){var _0x46ea60={'raw':![],'where':{'id':_0x7d50a[_0xc2be('0x4d')]['id']}},_0x15f179={};_0x15f179[_0xc2be('0x38')]=_[_0xc2be('0x3a')](db['VoiceQueueReport'][_0xc2be('0x34')]);_0x15f179[_0xc2be('0x39')]=_[_0xc2be('0x3a')](_0x7d50a[_0xc2be('0x39')]);_0x15f179[_0xc2be('0x3b')]=_[_0xc2be('0x3d')](_0x15f179[_0xc2be('0x38')],_0x15f179['query']);_0x46ea60['attributes']=_[_0xc2be('0x3d')](_0x15f179['model'],qs[_0xc2be('0x3e')](_0x7d50a['query'][_0xc2be('0x3e')]));_0x46ea60['attributes']=_0x46ea60[_0xc2be('0x3c')][_0xc2be('0x3f')]?_0x46ea60['attributes']:_0x15f179[_0xc2be('0x38')];if(_0x7d50a['query'][_0xc2be('0x48')]){_0x46ea60[_0xc2be('0x4e')]=[{'all':!![]}];}_0x46ea60=_['merge']({},_0x46ea60,_0x7d50a[_0xc2be('0x47')]);return db['VoiceQueueReport']['find'](_0x46ea60)['then'](handleEntityNotFound(_0x438595,null))[_0xc2be('0x2d')](respondWithResult(_0x438595,null))['catch'](handleError(_0x438595,null));};exports[_0xc2be('0x4f')]=function(_0x291107,_0x3e5e44){return db[_0xc2be('0x33')][_0xc2be('0x4f')](_0x291107[_0xc2be('0x50')],{})['then'](respondWithResult(_0x3e5e44,0xc9))[_0xc2be('0x4b')](handleError(_0x3e5e44,null));};exports['update']=function(_0x2d6946,_0x46080a){if(_0x2d6946[_0xc2be('0x50')]['id']){delete _0x2d6946[_0xc2be('0x50')]['id'];}return db[_0xc2be('0x33')][_0xc2be('0x51')]({'where':{'id':_0x2d6946['params']['id']}})[_0xc2be('0x2d')](handleEntityNotFound(_0x46080a,null))[_0xc2be('0x2d')](saveUpdates(_0x2d6946[_0xc2be('0x50')],null))[_0xc2be('0x2d')](respondWithResult(_0x46080a,null))[_0xc2be('0x4b')](handleError(_0x46080a,null));};exports[_0xc2be('0x2e')]=function(_0x21852a,_0x21aa0f){return db['VoiceQueueReport']['find']({'where':{'id':_0x21852a['params']['id']}})['then'](handleEntityNotFound(_0x21aa0f,null))[_0xc2be('0x2d')](removeEntity(_0x21aa0f,null))[_0xc2be('0x4b')](handleError(_0x21aa0f,null));};exports['describe']=function(_0xf050c,_0x21fc31){return db[_0xc2be('0x33')][_0xc2be('0x52')]()['then'](respondWithResult(_0x21fc31,null))[_0xc2be('0x4b')](handleError(_0x21fc31,null));};exports[_0xc2be('0x53')]=function(_0x56d32,_0x4e3f3c){var _0x48e8fb={},_0x7315b6={},_0x1687ab={'count':0x0,'rows':[]};_0x7315b6[_0xc2be('0x38')]=_[_0xc2be('0x3a')](db[_0xc2be('0x33')][_0xc2be('0x34')]);_0x7315b6[_0xc2be('0x39')]=_[_0xc2be('0x3a')](_0x56d32[_0xc2be('0x39')]);_0x7315b6[_0xc2be('0x3b')]=_['intersection'](_0x7315b6[_0xc2be('0x38')],_0x7315b6['query']);_0x48e8fb[_0xc2be('0x3c')]=_[_0xc2be('0x3d')](_0x7315b6[_0xc2be('0x38')],qs[_0xc2be('0x3e')](_0x56d32[_0xc2be('0x39')][_0xc2be('0x3e')]));_0x48e8fb[_0xc2be('0x3c')]=_0x48e8fb['attributes'][_0xc2be('0x3f')]?_0x48e8fb['attributes']:_0x7315b6['model'];if(!_0x56d32[_0xc2be('0x39')]['hasOwnProperty'](_0xc2be('0x40'))){_0x48e8fb[_0xc2be('0x24')]=qs['limit'](_0x56d32[_0xc2be('0x39')][_0xc2be('0x24')]);_0x48e8fb['offset']=qs['offset'](_0x56d32[_0xc2be('0x39')][_0xc2be('0x26')]);}_0x48e8fb[_0xc2be('0x41')]=qs['sort'](_0x56d32[_0xc2be('0x39')]['sort']);_0x48e8fb[_0xc2be('0x43')]=qs[_0xc2be('0x3b')](_[_0xc2be('0x44')](_0x56d32['query'],_0x7315b6[_0xc2be('0x3b')]));if(_0x56d32['query'][_0xc2be('0x54')]){_0x48e8fb[_0xc2be('0x43')]=_[_0xc2be('0x46')](_0x48e8fb[_0xc2be('0x43')],{'$or':_[_0xc2be('0x32')](_0x48e8fb[_0xc2be('0x3c')],function(_0x56cce4){var _0x52ad84={};_0x52ad84[_0x56cce4]={'$like':'%'+_0x56d32[_0xc2be('0x39')]['filter']+'%'};return _0x52ad84;})});}_0x48e8fb=_['merge']({},_0x48e8fb,_0x56d32[_0xc2be('0x47')]);var _0x4feaf8={'where':_0x48e8fb[_0xc2be('0x43')]};return db['VoiceQueueReport'][_0xc2be('0x25')](_0x4feaf8)[_0xc2be('0x2d')](function(_0x4ebbc2){_0x1687ab[_0xc2be('0x25')]=_0x4ebbc2;if(_0x56d32[_0xc2be('0x39')][_0xc2be('0x48')]){_0x48e8fb[_0xc2be('0x4e')]=[{'all':!![]}];}return db[_0xc2be('0x33')]['findAll'](_0x48e8fb);})[_0xc2be('0x2d')](function(_0x29b1b2){_0x1687ab['rows']=_0x29b1b2;return _0x1687ab;})[_0xc2be('0x2d')](respondWithFilteredResult(_0x4e3f3c,_0x48e8fb,'getVoiceQueuesReport'))[_0xc2be('0x4b')](handleError(_0x4e3f3c,null,_0xc2be('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index efaa2e7..d5a5ca0 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 _0xc700=['../../mysqldb','VoiceQueueReport','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x16f53a,_0x34dc6a){var _0x543a52=function(_0x26a297){while(--_0x26a297){_0x16f53a['push'](_0x16f53a['shift']());}};_0x543a52(++_0x34dc6a);}(_0xc700,0xa1));var _0x0c70=function(_0x4022ba,_0x348126){_0x4022ba=_0x4022ba-0x0;var _0x4313d8=_0xc700[_0x4022ba];return _0x4313d8;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0c70('0x0'))['db'][_0x0c70('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0c70('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2afbc0){return function(_0x13b6c5,_0x495a32,_0x288528){VoiceQueueReportEvents[_0x0c70('0x3')](_0x2afbc0+':'+_0x13b6c5['id'],_0x13b6c5);VoiceQueueReportEvents['emit'](_0x2afbc0,_0x13b6c5);_0x288528(null);};}for(var e in events){if(events[_0x0c70('0x4')](e)){var event=events[e];VoiceQueueReport[_0x0c70('0x5')](e,emitEvent(event));}}module[_0x0c70('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xecac=['../../mysqldb','setMaxListeners','save','update','remove','emit','events'];(function(_0x25e616,_0x5bf1e1){var _0x146bfe=function(_0x5c6fe1){while(--_0x5c6fe1){_0x25e616['push'](_0x25e616['shift']());}};_0x146bfe(++_0x5bf1e1);}(_0xecac,0x1bf));var _0xceca=function(_0xece61a,_0x2781d9){_0xece61a=_0xece61a-0x0;var _0x338e68=_0xecac[_0xece61a];return _0x338e68;};'use strict';var EventEmitter=require(_0xceca('0x0'));var VoiceQueueReport=require(_0xceca('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xceca('0x2')](0x0);var events={'afterCreate':_0xceca('0x3'),'afterUpdate':_0xceca('0x4'),'afterDestroy':_0xceca('0x5')};function emitEvent(_0x238918){return function(_0x1a45c6,_0x3686b5,_0x532d55){VoiceQueueReportEvents['emit'](_0x238918+':'+_0x1a45c6['id'],_0x1a45c6);VoiceQueueReportEvents[_0xceca('0x6')](_0x238918,_0x1a45c6);_0x532d55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index acdcd2f..39d5c90 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 _0x750d=['path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','../../config/logger','moment','request-promise'];(function(_0x1e0bf0,_0x3000fa){var _0x489f41=function(_0xb393ef){while(--_0xb393ef){_0x1e0bf0['push'](_0x1e0bf0['shift']());}};_0x489f41(++_0x3000fa);}(_0x750d,0x158));var _0xd750=function(_0x3881ef,_0x24126f){_0x3881ef=_0x3881ef-0x0;var _0x28c83f=_0x750d[_0x3881ef];return _0x28c83f;};'use strict';var _=require(_0xd750('0x0'));var util=require('util');var logger=require(_0xd750('0x1'))('api');var moment=require(_0xd750('0x2'));var BPromise=require('bluebird');var rp=require(_0xd750('0x3'));var fs=require('fs');var path=require(_0xd750('0x4'));var rimraf=require('rimraf');var config=require(_0xd750('0x5'));var attributes=require(_0xd750('0x6'));module[_0xd750('0x7')]=function(_0x533963,_0x55aae8){return _0x533963[_0xd750('0x8')](_0xd750('0x9'),attributes,{'tableName':_0xd750('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd750('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b31=['request-promise','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment'];(function(_0x538b96,_0x2040a8){var _0x528549=function(_0x5ef6aa){while(--_0x5ef6aa){_0x538b96['push'](_0x538b96['shift']());}};_0x528549(++_0x2040a8);}(_0x2b31,0xcd));var _0x12b3=function(_0x2926ac,_0x1f9e37){_0x2926ac=_0x2926ac-0x0;var _0x41edac=_0x2b31[_0x2926ac];return _0x41edac;};'use strict';var _=require(_0x12b3('0x0'));var util=require(_0x12b3('0x1'));var logger=require(_0x12b3('0x2'))(_0x12b3('0x3'));var moment=require(_0x12b3('0x4'));var BPromise=require('bluebird');var rp=require(_0x12b3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12b3('0x6'));var config=require('../../config/environment');var attributes=require(_0x12b3('0x7'));module[_0x12b3('0x8')]=function(_0x39ea83,_0x37a375){return _0x39ea83[_0x12b3('0x9')](_0x12b3('0xa'),attributes,{'tableName':_0x12b3('0xb'),'paranoid':![],'indexes':[{'fields':[_0x12b3('0xc')]},{'fields':[_0x12b3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 65ef435..96678b0 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 _0x1ce2=['options','attributes','limit','include','map','model','info','debug','raw','CreateVoiceQueueReport','update','body','where','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll'];(function(_0x51a2ac,_0x2b0e82){var _0x1b2a60=function(_0x383c57){while(--_0x383c57){_0x51a2ac['push'](_0x51a2ac['shift']());}};_0x1b2a60(++_0x2b0e82);}(_0x1ce2,0x1bc));var _0x21ce=function(_0xcdef00,_0x316ace){_0xcdef00=_0xcdef00-0x0;var _0x5237b6=_0x1ce2[_0xcdef00];return _0x5237b6;};'use strict';var _=require(_0x21ce('0x0'));var util=require(_0x21ce('0x1'));var moment=require(_0x21ce('0x2'));var BPromise=require(_0x21ce('0x3'));var rs=require(_0x21ce('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21ce('0x5'))['db'];var utils=require(_0x21ce('0x6'));var logger=require('../../config/logger')(_0x21ce('0x7'));var config=require(_0x21ce('0x8'));var jayson=require(_0x21ce('0x9'));var client=jayson[_0x21ce('0xa')][_0x21ce('0xb')]({'port':0x232a});config[_0x21ce('0xc')]=_[_0x21ce('0xd')](config['redis'],{'host':_0x21ce('0xe'),'port':0x18eb});var socket=require(_0x21ce('0xf'))(new Redis(config[_0x21ce('0xc')]));require(_0x21ce('0x10'))['register'](socket);function respondWithRpcPromise(_0x3c4903,_0x265380,_0x30dd73){return new BPromise(function(_0x101bfa,_0x232668){return client[_0x21ce('0x11')](_0x3c4903,_0x30dd73)[_0x21ce('0x12')](function(_0x750592){logger['info'](_0x21ce('0x13'),_0x265380,_0x21ce('0x14'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x265380,_0x21ce('0x14'),JSON[_0x21ce('0x15')](_0x750592));if(_0x750592['error']){if(_0x750592[_0x21ce('0x16')][_0x21ce('0x17')]===0x1f4){logger['error'](_0x21ce('0x13'),_0x265380,_0x750592[_0x21ce('0x16')][_0x21ce('0x18')]);return _0x232668(_0x750592[_0x21ce('0x16')][_0x21ce('0x18')]);}logger[_0x21ce('0x16')](_0x21ce('0x13'),_0x265380,_0x750592[_0x21ce('0x16')]['message']);return _0x101bfa(_0x750592[_0x21ce('0x16')][_0x21ce('0x18')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x265380,_0x21ce('0x14'));_0x101bfa(_0x750592['result'][_0x21ce('0x18')]);}})[_0x21ce('0x19')](function(_0x10b6bd){logger[_0x21ce('0x16')](_0x21ce('0x13'),_0x265380,_0x10b6bd);_0x232668(_0x10b6bd);});});}exports[_0x21ce('0x1a')]=function(_0x2ace19){var _0x10b585=this;return new Promise(function(_0x5da4c6,_0x3c4d22){return db[_0x21ce('0x1b')][_0x21ce('0x1c')]({'raw':_0x2ace19[_0x21ce('0x1d')]?_0x2ace19['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ace19['options']?_0x2ace19[_0x21ce('0x1d')]['where']||null:null,'attributes':_0x2ace19[_0x21ce('0x1d')]?_0x2ace19[_0x21ce('0x1d')][_0x21ce('0x1e')]||null:null,'limit':_0x2ace19[_0x21ce('0x1d')]?_0x2ace19[_0x21ce('0x1d')][_0x21ce('0x1f')]||null:null,'include':_0x2ace19[_0x21ce('0x1d')]?_0x2ace19[_0x21ce('0x1d')][_0x21ce('0x20')]?_[_0x21ce('0x21')](_0x2ace19[_0x21ce('0x1d')][_0x21ce('0x20')],function(_0x5c7394){return{'model':db[_0x5c7394[_0x21ce('0x22')]],'as':_0x5c7394['as'],'attributes':_0x5c7394['attributes'],'include':_0x5c7394[_0x21ce('0x20')]?_[_0x21ce('0x21')](_0x5c7394[_0x21ce('0x20')],function(_0x2d32d0){return{'model':db[_0x2d32d0[_0x21ce('0x22')]],'as':_0x2d32d0['as'],'attributes':_0x2d32d0[_0x21ce('0x1e')],'include':_0x2d32d0['include']?_[_0x21ce('0x21')](_0x2d32d0[_0x21ce('0x20')],function(_0x576907){return{'model':db[_0x576907['model']],'as':_0x576907['as'],'attributes':_0x576907[_0x21ce('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x21ce('0x12')](function(_0x80fefb){logger[_0x21ce('0x23')](_0x21ce('0x1a'),_0x2ace19);logger[_0x21ce('0x24')](_0x21ce('0x1a'),_0x2ace19,JSON[_0x21ce('0x15')](_0x80fefb));_0x5da4c6(_0x80fefb);})[_0x21ce('0x19')](function(_0x3faca7){logger['error'](_0x21ce('0x1a'),_0x3faca7['message'],_0x2ace19);_0x3c4d22(_0x10b585[_0x21ce('0x16')](0x1f4,_0x3faca7['message']));});});};exports['CreateVoiceQueueReport']=function(_0x3b080d){var _0x91bbe7=this;return new Promise(function(_0x454e85,_0x418009){return db[_0x21ce('0x1b')]['create'](_0x3b080d['body'],{'raw':_0x3b080d[_0x21ce('0x1d')]?_0x3b080d[_0x21ce('0x1d')][_0x21ce('0x25')]===undefined?!![]:![]:!![]})[_0x21ce('0x12')](function(_0x46cfcc){logger[_0x21ce('0x23')]('CreateVoiceQueueReport',_0x3b080d);logger[_0x21ce('0x24')](_0x21ce('0x26'),_0x3b080d,JSON['stringify'](_0x46cfcc));_0x454e85(_0x46cfcc);})[_0x21ce('0x19')](function(_0x8d546b){logger['error'](_0x21ce('0x26'),_0x8d546b[_0x21ce('0x18')],_0x3b080d);_0x418009(_0x91bbe7[_0x21ce('0x16')](0x1f4,_0x8d546b['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x394d6a){var _0x603619=this;return new Promise(function(_0x26f229,_0x371b54){return db[_0x21ce('0x1b')][_0x21ce('0x27')](_0x394d6a[_0x21ce('0x28')],{'raw':_0x394d6a['options']?_0x394d6a[_0x21ce('0x1d')][_0x21ce('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x394d6a[_0x21ce('0x1d')]?_0x394d6a[_0x21ce('0x1d')][_0x21ce('0x29')]||null:null,'attributes':_0x394d6a[_0x21ce('0x1d')]?_0x394d6a[_0x21ce('0x1d')]['attributes']||null:null,'limit':_0x394d6a[_0x21ce('0x1d')]?_0x394d6a[_0x21ce('0x1d')][_0x21ce('0x1f')]||null:null})[_0x21ce('0x12')](function(_0x5e112a){logger[_0x21ce('0x23')](_0x21ce('0x2a'),_0x394d6a);logger['debug'](_0x21ce('0x2a'),_0x394d6a,JSON['stringify'](_0x5e112a));_0x26f229(_0x5e112a);})[_0x21ce('0x19')](function(_0x70afc9){logger[_0x21ce('0x16')](_0x21ce('0x2a'),_0x70afc9[_0x21ce('0x18')],_0x394d6a);_0x371b54(_0x603619[_0x21ce('0x16')](0x1f4,_0x70afc9[_0x21ce('0x18')]));});});}; \ No newline at end of file +var _0x14d3=['error','code','message','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c7134,_0x1eae0b){var _0x54da70=function(_0x5ebfa3){while(--_0x5ebfa3){_0x4c7134['push'](_0x4c7134['shift']());}};_0x54da70(++_0x1eae0b);}(_0x14d3,0x92));var _0x314d=function(_0x1aaef9,_0x25790e){_0x1aaef9=_0x1aaef9-0x0;var _0x2ce77f=_0x14d3[_0x1aaef9];return _0x2ce77f;};'use strict';var _=require(_0x314d('0x0'));var util=require(_0x314d('0x1'));var moment=require('moment');var BPromise=require(_0x314d('0x2'));var rs=require(_0x314d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x314d('0x4'))['db'];var utils=require(_0x314d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x314d('0x6'));var jayson=require(_0x314d('0x7'));var client=jayson[_0x314d('0x8')]['http']({'port':0x232a});config[_0x314d('0x9')]=_[_0x314d('0xa')](config['redis'],{'host':_0x314d('0xb'),'port':0x18eb});var socket=require(_0x314d('0xc'))(new Redis(config[_0x314d('0x9')]));require(_0x314d('0xd'))['register'](socket);function respondWithRpcPromise(_0x479d00,_0x1ac415,_0x556544){return new BPromise(function(_0x1c927a,_0xf332cf){return client[_0x314d('0xe')](_0x479d00,_0x556544)[_0x314d('0xf')](function(_0x4e92e3){logger[_0x314d('0x10')](_0x314d('0x11'),_0x1ac415,_0x314d('0x12'));logger[_0x314d('0x13')](_0x314d('0x14'),_0x1ac415,'request\x20sent',JSON[_0x314d('0x15')](_0x4e92e3));if(_0x4e92e3[_0x314d('0x16')]){if(_0x4e92e3[_0x314d('0x16')][_0x314d('0x17')]===0x1f4){logger[_0x314d('0x16')](_0x314d('0x11'),_0x1ac415,_0x4e92e3[_0x314d('0x16')][_0x314d('0x18')]);return _0xf332cf(_0x4e92e3['error']['message']);}logger[_0x314d('0x16')](_0x314d('0x11'),_0x1ac415,_0x4e92e3[_0x314d('0x16')]['message']);return _0x1c927a(_0x4e92e3[_0x314d('0x16')][_0x314d('0x18')]);}else{logger['info'](_0x314d('0x11'),_0x1ac415,'request\x20sent');_0x1c927a(_0x4e92e3[_0x314d('0x19')]['message']);}})[_0x314d('0x1a')](function(_0x442707){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1ac415,_0x442707);_0xf332cf(_0x442707);});});}exports['GetVoiceQueueReport']=function(_0x2f7a23){var _0x58fbc6=this;return new Promise(function(_0x2f55eb,_0x41f831){return db[_0x314d('0x1b')][_0x314d('0x1c')]({'raw':_0x2f7a23['options']?_0x2f7a23[_0x314d('0x1d')][_0x314d('0x1e')]===undefined?!![]:![]:!![],'where':_0x2f7a23[_0x314d('0x1d')]?_0x2f7a23[_0x314d('0x1d')][_0x314d('0x1f')]||null:null,'attributes':_0x2f7a23['options']?_0x2f7a23[_0x314d('0x1d')][_0x314d('0x20')]||null:null,'limit':_0x2f7a23[_0x314d('0x1d')]?_0x2f7a23['options'][_0x314d('0x21')]||null:null,'include':_0x2f7a23['options']?_0x2f7a23[_0x314d('0x1d')][_0x314d('0x22')]?_[_0x314d('0x23')](_0x2f7a23[_0x314d('0x1d')][_0x314d('0x22')],function(_0x362201){return{'model':db[_0x362201[_0x314d('0x24')]],'as':_0x362201['as'],'attributes':_0x362201[_0x314d('0x20')],'include':_0x362201[_0x314d('0x22')]?_[_0x314d('0x23')](_0x362201[_0x314d('0x22')],function(_0x1a0352){return{'model':db[_0x1a0352[_0x314d('0x24')]],'as':_0x1a0352['as'],'attributes':_0x1a0352[_0x314d('0x20')],'include':_0x1a0352[_0x314d('0x22')]?_[_0x314d('0x23')](_0x1a0352[_0x314d('0x22')],function(_0x1ce9ec){return{'model':db[_0x1ce9ec[_0x314d('0x24')]],'as':_0x1ce9ec['as'],'attributes':_0x1ce9ec[_0x314d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34f3b3){logger['info']('GetVoiceQueueReport',_0x2f7a23);logger[_0x314d('0x13')](_0x314d('0x25'),_0x2f7a23,JSON[_0x314d('0x15')](_0x34f3b3));_0x2f55eb(_0x34f3b3);})[_0x314d('0x1a')](function(_0xf764a2){logger[_0x314d('0x16')](_0x314d('0x25'),_0xf764a2[_0x314d('0x18')],_0x2f7a23);_0x41f831(_0x58fbc6['error'](0x1f4,_0xf764a2[_0x314d('0x18')]));});});};exports[_0x314d('0x26')]=function(_0x3f09fe){var _0x38a378=this;return new Promise(function(_0x56e6e2,_0x3236cd){return db['VoiceQueueReport']['create'](_0x3f09fe[_0x314d('0x27')],{'raw':_0x3f09fe['options']?_0x3f09fe['options'][_0x314d('0x1e')]===undefined?!![]:![]:!![]})[_0x314d('0xf')](function(_0x1d8ff3){logger[_0x314d('0x10')]('CreateVoiceQueueReport',_0x3f09fe);logger[_0x314d('0x13')]('CreateVoiceQueueReport',_0x3f09fe,JSON['stringify'](_0x1d8ff3));_0x56e6e2(_0x1d8ff3);})['catch'](function(_0x2ae403){logger[_0x314d('0x16')](_0x314d('0x26'),_0x2ae403[_0x314d('0x18')],_0x3f09fe);_0x3236cd(_0x38a378[_0x314d('0x16')](0x1f4,_0x2ae403[_0x314d('0x18')]));});});};exports[_0x314d('0x28')]=function(_0x342fb6){var _0x184c43=this;return new Promise(function(_0xb28720,_0x1bd911){return db[_0x314d('0x1b')][_0x314d('0x29')](_0x342fb6['body'],{'raw':_0x342fb6['options']?_0x342fb6['options'][_0x314d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x342fb6[_0x314d('0x1d')]?_0x342fb6['options']['where']||null:null,'attributes':_0x342fb6[_0x314d('0x1d')]?_0x342fb6['options'][_0x314d('0x20')]||null:null,'limit':_0x342fb6['options']?_0x342fb6['options'][_0x314d('0x21')]||null:null})[_0x314d('0xf')](function(_0x4d5e3e){logger['info'](_0x314d('0x28'),_0x342fb6);logger[_0x314d('0x13')](_0x314d('0x28'),_0x342fb6,JSON[_0x314d('0x15')](_0x4d5e3e));_0xb28720(_0x4d5e3e);})[_0x314d('0x1a')](function(_0x3f27c8){logger['error'](_0x314d('0x28'),_0x3f27c8[_0x314d('0x18')],_0x342fb6);_0x1bd911(_0x184c43[_0x314d('0x16')](0x1f4,_0x3f27c8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 79458a3..79e9b08 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 _0x252f=['length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','removeListener','register'];(function(_0x54d3b5,_0x32eb6c){var _0x1f480f=function(_0x44077c){while(--_0x44077c){_0x54d3b5['push'](_0x54d3b5['shift']());}};_0x1f480f(++_0x32eb6c);}(_0x252f,0x1e2));var _0xf252=function(_0x4474c2,_0x59cf02){_0x4474c2=_0x4474c2-0x0;var _0x435fbb=_0x252f[_0x4474c2];return _0x435fbb;};'use strict';var VoiceQueueReportEvents=require(_0xf252('0x0'));var events=['save',_0xf252('0x1'),_0xf252('0x2')];function createListener(_0x35461b,_0x30b77e){return function(_0x5961a8){_0x30b77e[_0xf252('0x3')](_0x35461b,_0x5961a8);};}function removeListener(_0x9cbc80,_0xa4c0d7){return function(){VoiceQueueReportEvents[_0xf252('0x4')](_0x9cbc80,_0xa4c0d7);};}exports[_0xf252('0x5')]=function(_0x2bb2e8){for(var _0x351b14=0x0,_0x468447=events[_0xf252('0x6')];_0x351b14<_0x468447;_0x351b14++){var _0x45abc3=events[_0x351b14];var _0x21dea3=createListener(_0xf252('0x7')+_0x45abc3,_0x2bb2e8);VoiceQueueReportEvents['on'](_0x45abc3,_0x21dea3);}}; \ No newline at end of file +var _0xaf40=['emit','removeListener','register','length','voiceQueueReport:','save','remove','update'];(function(_0x58c275,_0x519f61){var _0x30aa9e=function(_0x1612d0){while(--_0x1612d0){_0x58c275['push'](_0x58c275['shift']());}};_0x30aa9e(++_0x519f61);}(_0xaf40,0x75));var _0x0af4=function(_0x48b5a3,_0x3dd00f){_0x48b5a3=_0x48b5a3-0x0;var _0x53fa27=_0xaf40[_0x48b5a3];return _0x53fa27;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x0af4('0x0'),_0x0af4('0x1'),_0x0af4('0x2')];function createListener(_0x2221bd,_0x327a7b){return function(_0x2cf839){_0x327a7b[_0x0af4('0x3')](_0x2221bd,_0x2cf839);};}function removeListener(_0x35be09,_0x18ca82){return function(){VoiceQueueReportEvents[_0x0af4('0x4')](_0x35be09,_0x18ca82);};}exports[_0x0af4('0x5')]=function(_0x1aebbe){for(var _0x244b1b=0x0,_0x1cc59a=events[_0x0af4('0x6')];_0x244b1b<_0x1cc59a;_0x244b1b++){var _0x55570e=events[_0x244b1b];var _0x2ecd06=createListener(_0x0af4('0x7')+_0x55570e,_0x1aebbe);VoiceQueueReportEvents['on'](_0x55570e,_0x2ecd06);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 423bdb2..dca5613 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 _0x9348=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1bc592,_0x291a20){var _0x4ca0b5=function(_0x241815){while(--_0x241815){_0x1bc592['push'](_0x1bc592['shift']());}};_0x4ca0b5(++_0x291a20);}(_0x9348,0x160));var _0x8934=function(_0x2068b0,_0x5f1aca){_0x2068b0=_0x2068b0-0x0;var _0x3970d3=_0x9348[_0x2068b0];return _0x3970d3;};'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(_0x8934('0x7'));var config=require(_0x8934('0x8'));var controller=require(_0x8934('0x9'));router[_0x8934('0xa')]('/',auth[_0x8934('0xb')](),controller['index']);router[_0x8934('0xa')](_0x8934('0xc'),auth[_0x8934('0xb')](),controller['show']);router[_0x8934('0xd')]('/',auth[_0x8934('0xb')](),controller[_0x8934('0xe')]);router[_0x8934('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8934('0x10')]);router[_0x8934('0x11')](_0x8934('0xc'),auth[_0x8934('0xb')](),controller[_0x8934('0x12')]);module[_0x8934('0x13')]=router; \ No newline at end of file +var _0x8828=['show','create','put','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','index','/:id'];(function(_0x2829ea,_0x5f4281){var _0x2cacc0=function(_0x30addf){while(--_0x30addf){_0x2829ea['push'](_0x2829ea['shift']());}};_0x2cacc0(++_0x5f4281);}(_0x8828,0x1d1));var _0x8882=function(_0x5bf355,_0x56f4df){_0x5bf355=_0x5bf355-0x0;var _0x42973c=_0x8828[_0x5bf355];return _0x42973c;};'use strict';var multer=require(_0x8882('0x0'));var util=require(_0x8882('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8882('0x2'));var router=express[_0x8882('0x3')]();var fs_extra=require(_0x8882('0x4'));var auth=require(_0x8882('0x5'));var interaction=require(_0x8882('0x6'));var config=require('../../config/environment');var controller=require(_0x8882('0x7'));router[_0x8882('0x8')]('/',auth['isAuthenticated'](),controller[_0x8882('0x9')]);router['get'](_0x8882('0xa'),auth['isAuthenticated'](),controller[_0x8882('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8882('0xc')]);router[_0x8882('0xd')](_0x8882('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8882('0xa'),auth['isAuthenticated'](),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 ab1e185..7dc9a3a 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 _0x9a96=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x3570d,_0x5b49d8){var _0x458d9a=function(_0x523187){while(--_0x523187){_0x3570d['push'](_0x3570d['shift']());}};_0x458d9a(++_0x5b49d8);}(_0x9a96,0xd0));var _0x69a9=function(_0x26fbd6,_0x592913){_0x26fbd6=_0x26fbd6-0x0;var _0x1fb048=_0x9a96[_0x26fbd6];return _0x1fb048;};'use strict';var Sequelize=require(_0x69a9('0x0'));var moment=require(_0x69a9('0x1'));module[_0x69a9('0x2')]={'time':{'type':Sequelize[_0x69a9('0x3')]},'callid':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x69a9('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x69a9('0x4')],'allowNull':![],'defaultValue':moment()[_0x69a9('0x5')](_0x69a9('0x6'))}}; \ No newline at end of file +var _0x8ee8=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING'];(function(_0x3f872a,_0x3ec864){var _0x13e5fd=function(_0x1db5a6){while(--_0x1db5a6){_0x3f872a['push'](_0x3f872a['shift']());}};_0x13e5fd(++_0x3ec864);}(_0x8ee8,0x1dd));var _0x88ee=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x8ee8[_0x35007a];return _0x574f68;};'use strict';var Sequelize=require(_0x88ee('0x0'));var moment=require('moment');module[_0x88ee('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x88ee('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x88ee('0x3')],'allowNull':![],'defaultValue':moment()[_0x88ee('0x4')](_0x88ee('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1594485..173de91 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 _0x81a1=['options','includeAll','findAll','show','intersection','catch','create','update','body','find','params','eml-format','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','where','pick','VIRTUAL','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81a1,0x99));var _0x181a=function(_0x47ce60,_0xc9b2e5){_0x47ce60=_0x47ce60-0x0;var _0xaa4b35=_0x81a1[_0x47ce60];return _0xaa4b35;};'use strict';var emlformat=require(_0x181a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x181a('0x1'));var BPromise=require(_0x181a('0x2'));var Mustache=require(_0x181a('0x3'));var util=require('util');var path=require(_0x181a('0x4'));var sox=require('sox');var csv=require(_0x181a('0x5'));var ejs=require(_0x181a('0x6'));var fs=require('fs');var fs_extra=require(_0x181a('0x7'));var _=require(_0x181a('0x8'));var squel=require(_0x181a('0x9'));var crypto=require(_0x181a('0xa'));var jsforce=require(_0x181a('0xb'));var deskjs=require(_0x181a('0xc'));var toCsv=require(_0x181a('0x5'));var querystring=require(_0x181a('0xd'));var Papa=require(_0x181a('0xe'));var Redis=require('ioredis');var authService=require(_0x181a('0xf'));var qs=require(_0x181a('0x10'));var as=require(_0x181a('0x11'));var hardwareService=require(_0x181a('0x12'));var logger=require(_0x181a('0x13'))(_0x181a('0x14'));var utils=require(_0x181a('0x15'));var config=require(_0x181a('0x16'));var licenseUtil=require(_0x181a('0x17'));var db=require(_0x181a('0x18'))['db'];function respondWithStatusCode(_0x3fa00b,_0x23e50a){_0x23e50a=_0x23e50a||0xcc;return function(_0x42f4cb){if(_0x42f4cb){return _0x3fa00b[_0x181a('0x19')](_0x23e50a);}return _0x3fa00b['status'](_0x23e50a)['end']();};}function respondWithResult(_0x41ee2a,_0x5181c8){_0x5181c8=_0x5181c8||0xc8;return function(_0x500193){if(_0x500193){return _0x41ee2a['status'](_0x5181c8)[_0x181a('0x1a')](_0x500193);}};}function respondWithFilteredResult(_0x5876dd,_0x289ae9){return function(_0x16de16){if(_0x16de16){var _0x147d6f=typeof _0x289ae9['offset']==='undefined'&&typeof _0x289ae9['limit']===_0x181a('0x1b');var _0x16f5c1=_0x16de16[_0x181a('0x1c')];var _0x3fb469=_0x147d6f?0x0:_0x289ae9['offset'];var _0x1148bb=_0x147d6f?_0x16de16[_0x181a('0x1c')]:_0x289ae9[_0x181a('0x1d')]+_0x289ae9[_0x181a('0x1e')];var _0x582ca7;if(_0x1148bb>=_0x16f5c1){_0x1148bb=_0x16f5c1;_0x582ca7=0xc8;}else{_0x582ca7=0xce;}_0x5876dd[_0x181a('0x1f')](_0x582ca7);return _0x5876dd[_0x181a('0x20')](_0x181a('0x21'),_0x3fb469+'-'+_0x1148bb+'/'+_0x16f5c1)[_0x181a('0x1a')](_0x16de16);}return null;};}function patchUpdates(_0x2b2200){return function(_0x501fe9){try{jsonpatch['apply'](_0x501fe9,_0x2b2200,!![]);}catch(_0x48a086){return BPromise[_0x181a('0x22')](_0x48a086);}return _0x501fe9[_0x181a('0x23')]();};}function saveUpdates(_0x38722d,_0x3279da){return function(_0x4f48af){if(_0x4f48af){return _0x4f48af['update'](_0x38722d)[_0x181a('0x24')](function(_0x3288b9){return _0x3288b9;});}return null;};}function removeEntity(_0x31679a,_0x5b8961){return function(_0x62cdee){if(_0x62cdee){return _0x62cdee[_0x181a('0x25')]()[_0x181a('0x24')](function(){_0x31679a['status'](0xcc)[_0x181a('0x26')]();});}};}function handleEntityNotFound(_0x4fd210,_0x506a56){return function(_0x50f9df){if(!_0x50f9df){_0x4fd210[_0x181a('0x19')](0x194);}return _0x50f9df;};}function handleError(_0x5cbb1b,_0x327eaf){_0x327eaf=_0x327eaf||0x1f4;return function(_0x39ff69){logger[_0x181a('0x27')](_0x39ff69['stack']);if(_0x39ff69[_0x181a('0x28')]){delete _0x39ff69[_0x181a('0x28')];}_0x5cbb1b[_0x181a('0x1f')](_0x327eaf)[_0x181a('0x29')](_0x39ff69);};}exports[_0x181a('0x2a')]=function(_0x28c4b4,_0x5c0776){var _0xfa558e={},_0x3149b6={},_0x2353ce={'count':0x0,'rows':[]};var _0x25033e=_[_0x181a('0x2b')](db[_0x181a('0x2c')]['rawAttributes'],function(_0x16b141){return{'name':_0x16b141['fieldName'],'type':_0x16b141[_0x181a('0x2d')][_0x181a('0x2e')]};});_0x3149b6['model']=_['map'](_0x25033e,_0x181a('0x28'));_0x3149b6[_0x181a('0x2f')]=_[_0x181a('0x30')](_0x28c4b4[_0x181a('0x2f')]);_0x3149b6[_0x181a('0x31')]=_['intersection'](_0x3149b6[_0x181a('0x32')],_0x3149b6[_0x181a('0x2f')]);_0xfa558e['attributes']=_['intersection'](_0x3149b6[_0x181a('0x32')],qs[_0x181a('0x33')](_0x28c4b4[_0x181a('0x2f')]['fields']));_0xfa558e[_0x181a('0x34')]=_0xfa558e[_0x181a('0x34')][_0x181a('0x35')]?_0xfa558e['attributes']:_0x3149b6[_0x181a('0x32')];if(!_0x28c4b4['query'][_0x181a('0x36')]('nolimit')){_0xfa558e[_0x181a('0x1e')]=qs[_0x181a('0x1e')](_0x28c4b4[_0x181a('0x2f')][_0x181a('0x1e')]);_0xfa558e['offset']=qs['offset'](_0x28c4b4[_0x181a('0x2f')][_0x181a('0x1d')]);}_0xfa558e[_0x181a('0x37')]=qs['sort'](_0x28c4b4[_0x181a('0x2f')]['sort']);_0xfa558e[_0x181a('0x38')]=qs[_0x181a('0x31')](_[_0x181a('0x39')](_0x28c4b4[_0x181a('0x2f')],_0x3149b6[_0x181a('0x31')]),_0x25033e);if(_0x28c4b4[_0x181a('0x2f')]['filter']){_0xfa558e[_0x181a('0x38')]=_['merge'](_0xfa558e[_0x181a('0x38')],{'$or':_[_0x181a('0x2b')](_0x25033e,function(_0x563f39){if(_0x563f39[_0x181a('0x2d')]!==_0x181a('0x3a')){var _0xc6d467={};_0xc6d467[_0x563f39[_0x181a('0x28')]]={'$like':'%'+_0x28c4b4[_0x181a('0x2f')]['filter']+'%'};return _0xc6d467;}})});}_0xfa558e=_[_0x181a('0x3b')]({},_0xfa558e,_0x28c4b4[_0x181a('0x3c')]);var _0x3798e2={'where':_0xfa558e['where']};return db[_0x181a('0x2c')][_0x181a('0x1c')](_0x3798e2)[_0x181a('0x24')](function(_0xa60c63){_0x2353ce[_0x181a('0x1c')]=_0xa60c63;if(_0x28c4b4[_0x181a('0x2f')][_0x181a('0x3d')]){_0xfa558e['include']=[{'all':!![]}];}return db[_0x181a('0x2c')][_0x181a('0x3e')](_0xfa558e);})[_0x181a('0x24')](function(_0xb0a9d5){_0x2353ce['rows']=_0xb0a9d5;return _0x2353ce;})['then'](respondWithFilteredResult(_0x5c0776,_0xfa558e))['catch'](handleError(_0x5c0776,null));};exports[_0x181a('0x3f')]=function(_0x4bf405,_0x96b8e1){var _0x5199fd={'raw':!![],'where':{'id':_0x4bf405['params']['id']}},_0x137b66={};_0x137b66[_0x181a('0x32')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0x137b66[_0x181a('0x2f')]=_['keys'](_0x4bf405[_0x181a('0x2f')]);_0x137b66[_0x181a('0x31')]=_[_0x181a('0x40')](_0x137b66['model'],_0x137b66[_0x181a('0x2f')]);_0x5199fd[_0x181a('0x34')]=_[_0x181a('0x40')](_0x137b66[_0x181a('0x32')],qs['fields'](_0x4bf405[_0x181a('0x2f')][_0x181a('0x33')]));_0x5199fd[_0x181a('0x34')]=_0x5199fd[_0x181a('0x34')]['length']?_0x5199fd[_0x181a('0x34')]:_0x137b66[_0x181a('0x32')];if(_0x4bf405[_0x181a('0x2f')][_0x181a('0x3d')]){_0x5199fd['include']=[{'all':!![]}];}_0x5199fd=_[_0x181a('0x3b')]({},_0x5199fd,_0x4bf405[_0x181a('0x3c')]);return db[_0x181a('0x2c')]['find'](_0x5199fd)[_0x181a('0x24')](handleEntityNotFound(_0x96b8e1,null))[_0x181a('0x24')](respondWithResult(_0x96b8e1,null))[_0x181a('0x41')](handleError(_0x96b8e1,null));};exports[_0x181a('0x42')]=function(_0x105298,_0x25e0cb){return db[_0x181a('0x2c')]['create'](_0x105298['body'],{})[_0x181a('0x24')](respondWithResult(_0x25e0cb,0xc9))[_0x181a('0x41')](handleError(_0x25e0cb,null));};exports[_0x181a('0x43')]=function(_0x47faf5,_0x4952c2){if(_0x47faf5['body']['id']){delete _0x47faf5[_0x181a('0x44')]['id'];}return db[_0x181a('0x2c')][_0x181a('0x45')]({'where':{'id':_0x47faf5['params']['id']}})[_0x181a('0x24')](handleEntityNotFound(_0x4952c2,null))['then'](saveUpdates(_0x47faf5['body'],null))[_0x181a('0x24')](respondWithResult(_0x4952c2,null))[_0x181a('0x41')](handleError(_0x4952c2,null));};exports[_0x181a('0x25')]=function(_0x238d85,_0x33dd7a){return db[_0x181a('0x2c')][_0x181a('0x45')]({'where':{'id':_0x238d85[_0x181a('0x46')]['id']}})[_0x181a('0x24')](handleEntityNotFound(_0x33dd7a,null))[_0x181a('0x24')](removeEntity(_0x33dd7a,null))[_0x181a('0x41')](handleError(_0x33dd7a,null));}; \ No newline at end of file +var _0xcbd9=['VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','then','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','error','stack','name','index','map'];(function(_0x1f0024,_0x72cfd3){var _0x5a8eb5=function(_0x1b30cd){while(--_0x1b30cd){_0x1f0024['push'](_0x1f0024['shift']());}};_0x5a8eb5(++_0x72cfd3);}(_0xcbd9,0x149));var _0x9cbd=function(_0x1b2d81,_0x34bd5c){_0x1b2d81=_0x1b2d81-0x0;var _0x29a27b=_0xcbd9[_0x1b2d81];return _0x29a27b;};'use strict';var emlformat=require(_0x9cbd('0x0'));var rimraf=require(_0x9cbd('0x1'));var zipdir=require(_0x9cbd('0x2'));var jsonpatch=require(_0x9cbd('0x3'));var rp=require(_0x9cbd('0x4'));var moment=require(_0x9cbd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cbd('0x6'));var util=require(_0x9cbd('0x7'));var path=require(_0x9cbd('0x8'));var sox=require('sox');var csv=require(_0x9cbd('0x9'));var ejs=require(_0x9cbd('0xa'));var fs=require('fs');var fs_extra=require(_0x9cbd('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9cbd('0xc'));var jsforce=require(_0x9cbd('0xd'));var deskjs=require(_0x9cbd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9cbd('0xf'));var Redis=require('ioredis');var authService=require(_0x9cbd('0x10'));var qs=require(_0x9cbd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cbd('0x12'));var logger=require(_0x9cbd('0x13'))(_0x9cbd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9cbd('0x15'))['db'];function respondWithStatusCode(_0x225117,_0x1cb403){_0x1cb403=_0x1cb403||0xcc;return function(_0x309a56){if(_0x309a56){return _0x225117[_0x9cbd('0x16')](_0x1cb403);}return _0x225117['status'](_0x1cb403)[_0x9cbd('0x17')]();};}function respondWithResult(_0x53dc5e,_0x2ba2f3){_0x2ba2f3=_0x2ba2f3||0xc8;return function(_0x1ee73e){if(_0x1ee73e){return _0x53dc5e[_0x9cbd('0x18')](_0x2ba2f3)[_0x9cbd('0x19')](_0x1ee73e);}};}function respondWithFilteredResult(_0x4762e3,_0x5e0532){return function(_0x46e3e2){if(_0x46e3e2){var _0x26bbbb=typeof _0x5e0532['offset']===_0x9cbd('0x1a')&&typeof _0x5e0532[_0x9cbd('0x1b')]===_0x9cbd('0x1a');var _0x587b09=_0x46e3e2['count'];var _0x470707=_0x26bbbb?0x0:_0x5e0532[_0x9cbd('0x1c')];var _0x2b4615=_0x26bbbb?_0x46e3e2[_0x9cbd('0x1d')]:_0x5e0532[_0x9cbd('0x1c')]+_0x5e0532[_0x9cbd('0x1b')];var _0x58b7a4;if(_0x2b4615>=_0x587b09){_0x2b4615=_0x587b09;_0x58b7a4=0xc8;}else{_0x58b7a4=0xce;}_0x4762e3[_0x9cbd('0x18')](_0x58b7a4);return _0x4762e3[_0x9cbd('0x1e')](_0x9cbd('0x1f'),_0x470707+'-'+_0x2b4615+'/'+_0x587b09)[_0x9cbd('0x19')](_0x46e3e2);}return null;};}function patchUpdates(_0x4e0ac0){return function(_0x325de8){try{jsonpatch[_0x9cbd('0x20')](_0x325de8,_0x4e0ac0,!![]);}catch(_0x838935){return BPromise['reject'](_0x838935);}return _0x325de8[_0x9cbd('0x21')]();};}function saveUpdates(_0x146344,_0x5c87ff){return function(_0x2d238f){if(_0x2d238f){return _0x2d238f[_0x9cbd('0x22')](_0x146344)['then'](function(_0x37a0e6){return _0x37a0e6;});}return null;};}function removeEntity(_0x552512,_0x4508fe){return function(_0x925bb9){if(_0x925bb9){return _0x925bb9[_0x9cbd('0x23')]()['then'](function(){_0x552512[_0x9cbd('0x18')](0xcc)[_0x9cbd('0x17')]();});}};}function handleEntityNotFound(_0x576cbb,_0x52b0da){return function(_0x3c855f){if(!_0x3c855f){_0x576cbb['sendStatus'](0x194);}return _0x3c855f;};}function handleError(_0x170ed0,_0x54300b){_0x54300b=_0x54300b||0x1f4;return function(_0x369f67){logger[_0x9cbd('0x24')](_0x369f67[_0x9cbd('0x25')]);if(_0x369f67[_0x9cbd('0x26')]){delete _0x369f67[_0x9cbd('0x26')];}_0x170ed0[_0x9cbd('0x18')](_0x54300b)['send'](_0x369f67);};}exports[_0x9cbd('0x27')]=function(_0x3b16e1,_0x6add47){var _0x47881e={},_0x15a62e={},_0x11881c={'count':0x0,'rows':[]};var _0x46ba66=_[_0x9cbd('0x28')](db[_0x9cbd('0x29')][_0x9cbd('0x2a')],function(_0x3c19f7){return{'name':_0x3c19f7[_0x9cbd('0x2b')],'type':_0x3c19f7['type'][_0x9cbd('0x2c')]};});_0x15a62e[_0x9cbd('0x2d')]=_[_0x9cbd('0x28')](_0x46ba66,'name');_0x15a62e[_0x9cbd('0x2e')]=_[_0x9cbd('0x2f')](_0x3b16e1[_0x9cbd('0x2e')]);_0x15a62e[_0x9cbd('0x30')]=_['intersection'](_0x15a62e[_0x9cbd('0x2d')],_0x15a62e[_0x9cbd('0x2e')]);_0x47881e[_0x9cbd('0x31')]=_[_0x9cbd('0x32')](_0x15a62e[_0x9cbd('0x2d')],qs['fields'](_0x3b16e1[_0x9cbd('0x2e')][_0x9cbd('0x33')]));_0x47881e['attributes']=_0x47881e[_0x9cbd('0x31')][_0x9cbd('0x34')]?_0x47881e['attributes']:_0x15a62e[_0x9cbd('0x2d')];if(!_0x3b16e1[_0x9cbd('0x2e')][_0x9cbd('0x35')](_0x9cbd('0x36'))){_0x47881e[_0x9cbd('0x1b')]=qs[_0x9cbd('0x1b')](_0x3b16e1[_0x9cbd('0x2e')][_0x9cbd('0x1b')]);_0x47881e[_0x9cbd('0x1c')]=qs[_0x9cbd('0x1c')](_0x3b16e1[_0x9cbd('0x2e')][_0x9cbd('0x1c')]);}_0x47881e[_0x9cbd('0x37')]=qs[_0x9cbd('0x38')](_0x3b16e1[_0x9cbd('0x2e')][_0x9cbd('0x38')]);_0x47881e[_0x9cbd('0x39')]=qs[_0x9cbd('0x30')](_[_0x9cbd('0x3a')](_0x3b16e1['query'],_0x15a62e['filters']),_0x46ba66);if(_0x3b16e1['query']['filter']){_0x47881e[_0x9cbd('0x39')]=_[_0x9cbd('0x3b')](_0x47881e[_0x9cbd('0x39')],{'$or':_[_0x9cbd('0x28')](_0x46ba66,function(_0x4a2e21){if(_0x4a2e21[_0x9cbd('0x3c')]!==_0x9cbd('0x3d')){var _0x12e365={};_0x12e365[_0x4a2e21[_0x9cbd('0x26')]]={'$like':'%'+_0x3b16e1[_0x9cbd('0x2e')][_0x9cbd('0x3e')]+'%'};return _0x12e365;}})});}_0x47881e=_[_0x9cbd('0x3b')]({},_0x47881e,_0x3b16e1[_0x9cbd('0x3f')]);var _0x5a89d6={'where':_0x47881e['where']};return db[_0x9cbd('0x29')][_0x9cbd('0x1d')](_0x5a89d6)['then'](function(_0x474f09){_0x11881c[_0x9cbd('0x1d')]=_0x474f09;if(_0x3b16e1[_0x9cbd('0x2e')][_0x9cbd('0x40')]){_0x47881e[_0x9cbd('0x41')]=[{'all':!![]}];}return db[_0x9cbd('0x29')]['findAll'](_0x47881e);})[_0x9cbd('0x42')](function(_0xc54306){_0x11881c[_0x9cbd('0x43')]=_0xc54306;return _0x11881c;})[_0x9cbd('0x42')](respondWithFilteredResult(_0x6add47,_0x47881e))[_0x9cbd('0x44')](handleError(_0x6add47,null));};exports[_0x9cbd('0x45')]=function(_0x40d657,_0x14be17){var _0x2b52c7={'raw':!![],'where':{'id':_0x40d657[_0x9cbd('0x46')]['id']}},_0x33c2ab={};_0x33c2ab[_0x9cbd('0x2d')]=_[_0x9cbd('0x2f')](db[_0x9cbd('0x29')][_0x9cbd('0x2a')]);_0x33c2ab['query']=_['keys'](_0x40d657[_0x9cbd('0x2e')]);_0x33c2ab['filters']=_[_0x9cbd('0x32')](_0x33c2ab['model'],_0x33c2ab['query']);_0x2b52c7[_0x9cbd('0x31')]=_[_0x9cbd('0x32')](_0x33c2ab[_0x9cbd('0x2d')],qs[_0x9cbd('0x33')](_0x40d657[_0x9cbd('0x2e')]['fields']));_0x2b52c7['attributes']=_0x2b52c7[_0x9cbd('0x31')][_0x9cbd('0x34')]?_0x2b52c7[_0x9cbd('0x31')]:_0x33c2ab['model'];if(_0x40d657[_0x9cbd('0x2e')][_0x9cbd('0x40')]){_0x2b52c7['include']=[{'all':!![]}];}_0x2b52c7=_[_0x9cbd('0x3b')]({},_0x2b52c7,_0x40d657[_0x9cbd('0x3f')]);return db[_0x9cbd('0x29')][_0x9cbd('0x47')](_0x2b52c7)[_0x9cbd('0x42')](handleEntityNotFound(_0x14be17,null))[_0x9cbd('0x42')](respondWithResult(_0x14be17,null))['catch'](handleError(_0x14be17,null));};exports[_0x9cbd('0x48')]=function(_0x564fae,_0x3e3467){return db[_0x9cbd('0x29')][_0x9cbd('0x48')](_0x564fae[_0x9cbd('0x49')],{})[_0x9cbd('0x42')](respondWithResult(_0x3e3467,0xc9))[_0x9cbd('0x44')](handleError(_0x3e3467,null));};exports['update']=function(_0x37b4d2,_0x20b02c){if(_0x37b4d2['body']['id']){delete _0x37b4d2[_0x9cbd('0x49')]['id'];}return db['VoiceQueuesLog'][_0x9cbd('0x47')]({'where':{'id':_0x37b4d2[_0x9cbd('0x46')]['id']}})[_0x9cbd('0x42')](handleEntityNotFound(_0x20b02c,null))[_0x9cbd('0x42')](saveUpdates(_0x37b4d2[_0x9cbd('0x49')],null))['then'](respondWithResult(_0x20b02c,null))[_0x9cbd('0x44')](handleError(_0x20b02c,null));};exports[_0x9cbd('0x23')]=function(_0xca1dfc,_0x560761){return db['VoiceQueuesLog']['find']({'where':{'id':_0xca1dfc['params']['id']}})[_0x9cbd('0x42')](handleEntityNotFound(_0x560761,null))[_0x9cbd('0x42')](removeEntity(_0x560761,null))[_0x9cbd('0x44')](handleError(_0x560761,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c8e67fd..324d66f 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 _0x0a2a=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger'];(function(_0x1f2b93,_0x9fd7a){var _0x25e1e8=function(_0x2210df){while(--_0x2210df){_0x1f2b93['push'](_0x1f2b93['shift']());}};_0x25e1e8(++_0x9fd7a);}(_0x0a2a,0x1e8));var _0xa0a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa0a2('0x0'));var logger=require(_0xa0a2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa0a2('0x2'));var rp=require(_0xa0a2('0x3'));var fs=require('fs');var path=require(_0xa0a2('0x4'));var rimraf=require(_0xa0a2('0x5'));var config=require(_0xa0a2('0x6'));var attributes=require(_0xa0a2('0x7'));module[_0xa0a2('0x8')]=function(_0x16e502,_0x49460a){return _0x16e502[_0xa0a2('0x9')](_0xa0a2('0xa'),attributes,{'tableName':_0xa0a2('0xb'),'paranoid':![],'indexes':[{'name':_0xa0a2('0xc'),'fields':['event',_0xa0a2('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6822=['request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','api','moment'];(function(_0x239869,_0x4ec877){var _0x7577be=function(_0x47359a){while(--_0x47359a){_0x239869['push'](_0x239869['shift']());}};_0x7577be(++_0x4ec877);}(_0x6822,0x18c));var _0x2682=function(_0x53b5f9,_0x379962){_0x53b5f9=_0x53b5f9-0x0;var _0x180a6f=_0x6822[_0x53b5f9];return _0x180a6f;};'use strict';var _=require('lodash');var util=require(_0x2682('0x0'));var logger=require(_0x2682('0x1'))(_0x2682('0x2'));var moment=require(_0x2682('0x3'));var BPromise=require('bluebird');var rp=require(_0x2682('0x4'));var fs=require('fs');var path=require(_0x2682('0x5'));var rimraf=require(_0x2682('0x6'));var config=require(_0x2682('0x7'));var attributes=require(_0x2682('0x8'));module[_0x2682('0x9')]=function(_0x15040a,_0x24978b){return _0x15040a[_0x2682('0xa')](_0x2682('0xb'),attributes,{'tableName':_0x2682('0xc'),'paranoid':![],'indexes':[{'name':_0x2682('0xd'),'fields':[_0x2682('0xe'),_0x2682('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3cfe326..1f0fed4 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 _0xfccf=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfccf,0xaa));var _0xffcc=function(_0x431526,_0x229876){_0x431526=_0x431526-0x0;var _0x48ef29=_0xfccf[_0x431526];return _0x48ef29;};'use strict';var _=require(_0xffcc('0x0'));var util=require(_0xffcc('0x1'));var moment=require(_0xffcc('0x2'));var BPromise=require(_0xffcc('0x3'));var rs=require(_0xffcc('0x4'));var fs=require('fs');var Redis=require(_0xffcc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xffcc('0x6'))(_0xffcc('0x7'));var config=require(_0xffcc('0x8'));var jayson=require(_0xffcc('0x9'));var client=jayson[_0xffcc('0xa')][_0xffcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x229fe1,_0x3cf6b6,_0x5792b8){return new BPromise(function(_0x15e64c,_0x240dfe){return client['request'](_0x229fe1,_0x5792b8)[_0xffcc('0xc')](function(_0x3ceec5){logger['info'](_0xffcc('0xd'),_0x3cf6b6,_0xffcc('0xe'));logger[_0xffcc('0xf')](_0xffcc('0x10'),_0x3cf6b6,_0xffcc('0xe'),JSON[_0xffcc('0x11')](_0x3ceec5));if(_0x3ceec5[_0xffcc('0x12')]){if(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x13')]===0x1f4){logger[_0xffcc('0x12')](_0xffcc('0xd'),_0x3cf6b6,_0x3ceec5['error']['message']);return _0x240dfe(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x14')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3cf6b6,_0x3ceec5[_0xffcc('0x12')]['message']);return _0x15e64c(_0x3ceec5[_0xffcc('0x12')][_0xffcc('0x14')]);}else{logger[_0xffcc('0x15')](_0xffcc('0xd'),_0x3cf6b6,'request\x20sent');_0x15e64c(_0x3ceec5[_0xffcc('0x16')][_0xffcc('0x14')]);}})[_0xffcc('0x17')](function(_0x1fc745){logger['error'](_0xffcc('0xd'),_0x3cf6b6,_0x1fc745);_0x240dfe(_0x1fc745);});});} \ No newline at end of file +var _0x1e1a=['rpc','../../config/environment','jayson/promise','http','request','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1372ae,_0x25e4d0){var _0x490f46=function(_0xe65f40){while(--_0xe65f40){_0x1372ae['push'](_0x1372ae['shift']());}};_0x490f46(++_0x25e4d0);}(_0x1e1a,0x175));var _0xa1e1=function(_0x18aca1,_0x27937d){_0x18aca1=_0x18aca1-0x0;var _0x571c90=_0x1e1a[_0x18aca1];return _0x571c90;};'use strict';var _=require('lodash');var util=require(_0xa1e1('0x0'));var moment=require(_0xa1e1('0x1'));var BPromise=require(_0xa1e1('0x2'));var rs=require(_0xa1e1('0x3'));var fs=require('fs');var Redis=require(_0xa1e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1e1('0x5'));var logger=require(_0xa1e1('0x6'))(_0xa1e1('0x7'));var config=require(_0xa1e1('0x8'));var jayson=require(_0xa1e1('0x9'));var client=jayson['client'][_0xa1e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc7f20,_0x144740,_0x546bbc){return new BPromise(function(_0x3f3b97,_0x220472){return client[_0xa1e1('0xb')](_0xc7f20,_0x546bbc)['then'](function(_0x1d5e11){logger['info'](_0xa1e1('0xc'),_0x144740,'request\x20sent');logger[_0xa1e1('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x144740,_0xa1e1('0xe'),JSON[_0xa1e1('0xf')](_0x1d5e11));if(_0x1d5e11[_0xa1e1('0x10')]){if(_0x1d5e11['error'][_0xa1e1('0x11')]===0x1f4){logger[_0xa1e1('0x10')](_0xa1e1('0xc'),_0x144740,_0x1d5e11['error'][_0xa1e1('0x12')]);return _0x220472(_0x1d5e11[_0xa1e1('0x10')][_0xa1e1('0x12')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x144740,_0x1d5e11[_0xa1e1('0x10')]['message']);return _0x3f3b97(_0x1d5e11[_0xa1e1('0x10')]['message']);}else{logger[_0xa1e1('0x13')](_0xa1e1('0xc'),_0x144740,'request\x20sent');_0x3f3b97(_0x1d5e11['result'][_0xa1e1('0x12')]);}})['catch'](function(_0x1cc832){logger['error'](_0xa1e1('0xc'),_0x144740,_0x1cc832);_0x220472(_0x1cc832);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4fde0e3..2964112 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 _0x636e=['downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','/:id','isAuthenticated','show','download','/:id/downloads'];(function(_0x549ef2,_0x1d3776){var _0x3daec1=function(_0x57fda6){while(--_0x57fda6){_0x549ef2['push'](_0x549ef2['shift']());}};_0x3daec1(++_0x1d3776);}(_0x636e,0xda));var _0xe636=function(_0x479bf3,_0x57dcc8){_0x479bf3=_0x479bf3-0x0;var _0x2dc5d4=_0x636e[_0x479bf3];return _0x2dc5d4;};'use strict';var multer=require(_0xe636('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe636('0x1'));var express=require(_0xe636('0x2'));var router=express[_0xe636('0x3')]();var fs_extra=require(_0xe636('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe636('0x5'));var controller=require(_0xe636('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe636('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe636('0x7')](_0xe636('0x8'),auth[_0xe636('0x9')](),controller[_0xe636('0xa')]);router[_0xe636('0x7')]('/:id/download',auth[_0xe636('0x9')](),controller[_0xe636('0xb')]);router['get'](_0xe636('0xc'),controller[_0xe636('0xd')]);router[_0xe636('0x7')](_0xe636('0xe'),auth[_0xe636('0x9')](),controller[_0xe636('0xf')]);router[_0xe636('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe636('0xe'),auth[_0xe636('0x9')](),controller[_0xe636('0x11')]);router[_0xe636('0x12')](_0xe636('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xe636('0x13')]('/:id',auth[_0xe636('0x9')](),controller['destroy']);module[_0xe636('0x14')]=router; \ No newline at end of file +var _0x1f36=['download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x74547d,_0x5ca07d){var _0x136571=function(_0x48cfb8){while(--_0x48cfb8){_0x74547d['push'](_0x74547d['shift']());}};_0x136571(++_0x5ca07d);}(_0x1f36,0x98));var _0x61f3=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0x1f36[_0x42d2af];return _0x1d6d63;};'use strict';var multer=require('multer');var util=require(_0x61f3('0x0'));var path=require(_0x61f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x61f3('0x2'));var router=express[_0x61f3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x61f3('0x4'));var interaction=require(_0x61f3('0x5'));var config=require(_0x61f3('0x6'));var controller=require(_0x61f3('0x7'));router[_0x61f3('0x8')]('/',auth[_0x61f3('0x9')](),controller[_0x61f3('0xa')]);router[_0x61f3('0x8')](_0x61f3('0xb'),auth['isAuthenticated'](),controller[_0x61f3('0xc')]);router['get'](_0x61f3('0xd'),auth[_0x61f3('0x9')](),controller[_0x61f3('0xe')]);router[_0x61f3('0x8')](_0x61f3('0xf'),auth[_0x61f3('0x9')](),controller[_0x61f3('0x10')]);router[_0x61f3('0x8')](_0x61f3('0x11'),controller[_0x61f3('0x12')]);router[_0x61f3('0x8')](_0x61f3('0x13'),auth[_0x61f3('0x9')](),controller[_0x61f3('0x14')]);router['post']('/',auth[_0x61f3('0x9')](),controller[_0x61f3('0x15')]);router[_0x61f3('0x16')](_0x61f3('0x13'),auth[_0x61f3('0x9')](),controller[_0x61f3('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x61f3('0x18')]);router[_0x61f3('0x19')](_0x61f3('0xd'),auth['isAuthenticated'](),controller[_0x61f3('0x1a')]);module[_0x61f3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 102d111..ca567a6 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(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 8ae6a6b..6153a8e 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 _0x3d2b=['fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','show','params','include','create','body','catch','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','col','token','$and','push','secrets','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','createBucket','upload','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','transcribeName','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','language','updateAttributes','writeFile'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0x3d2b,0x129));var _0xb3d2=function(_0xecf4cc,_0x5e2ce8){_0xecf4cc=_0xecf4cc-0x0;var _0x56e223=_0x3d2b[_0xecf4cc];return _0x56e223;};'use strict';var emlformat=require(_0xb3d2('0x0'));var rimraf=require(_0xb3d2('0x1'));var zipdir=require(_0xb3d2('0x2'));var jsonpatch=require(_0xb3d2('0x3'));var rp=require(_0xb3d2('0x4'));var moment=require(_0xb3d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb3d2('0x6'));var util=require(_0xb3d2('0x7'));var path=require(_0xb3d2('0x8'));var sox=require(_0xb3d2('0x9'));var csv=require(_0xb3d2('0xa'));var ejs=require(_0xb3d2('0xb'));var fs=require('fs');var fs_extra=require(_0xb3d2('0xc'));var _=require('lodash');var squel=require(_0xb3d2('0xd'));var crypto=require(_0xb3d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb3d2('0xf'));var toCsv=require(_0xb3d2('0xa'));var querystring=require(_0xb3d2('0x10'));var Papa=require(_0xb3d2('0x11'));var AWS=require(_0xb3d2('0x12'));var uuidv4=require('uuid/v4');var Redis=require(_0xb3d2('0x13'));var authService=require(_0xb3d2('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3d2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb3d2('0x16'));var config=require(_0xb3d2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x345284,_0x37c27d){_0x37c27d=_0x37c27d||0xcc;return function(_0x31713a){if(_0x31713a){return _0x345284[_0xb3d2('0x18')](_0x37c27d);}return _0x345284['status'](_0x37c27d)[_0xb3d2('0x19')]();};}function respondWithResult(_0x3fd011,_0x200c3b){_0x200c3b=_0x200c3b||0xc8;return function(_0x55a159){if(_0x55a159){return _0x3fd011[_0xb3d2('0x1a')](_0x200c3b)[_0xb3d2('0x1b')](_0x55a159);}};}function respondWithFilteredResult(_0x4f8f38,_0x3ec376){return function(_0x2055df){if(_0x2055df){var _0x326fbd=typeof _0x3ec376[_0xb3d2('0x1c')]===_0xb3d2('0x1d')&&typeof _0x3ec376[_0xb3d2('0x1e')]===_0xb3d2('0x1d');var _0x19d265=_0x2055df['count'];var _0xcde11e=_0x326fbd?0x0:_0x3ec376['offset'];var _0x597292=_0x326fbd?_0x2055df[_0xb3d2('0x1f')]:_0x3ec376[_0xb3d2('0x1c')]+_0x3ec376['limit'];var _0x1980f5;if(_0x597292>=_0x19d265){_0x597292=_0x19d265;_0x1980f5=0xc8;}else{_0x1980f5=0xce;}_0x4f8f38['status'](_0x1980f5);return _0x4f8f38['set'](_0xb3d2('0x20'),_0xcde11e+'-'+_0x597292+'/'+_0x19d265)['json'](_0x2055df);}return null;};}function patchUpdates(_0x2230ca){return function(_0x2bdc5f){try{jsonpatch['apply'](_0x2bdc5f,_0x2230ca,!![]);}catch(_0x400645){return BPromise[_0xb3d2('0x21')](_0x400645);}return _0x2bdc5f['save']();};}function saveUpdates(_0x2883b7,_0x2f92b8){return function(_0xaea026){if(_0xaea026){return _0xaea026[_0xb3d2('0x22')](_0x2883b7)['then'](function(_0x5bad2d){return _0x5bad2d;});}return null;};}function removeEntity(_0x2e7f52,_0x305ff0){return function(_0x4aeedd){if(_0x4aeedd){return _0x4aeedd[_0xb3d2('0x23')]()[_0xb3d2('0x24')](function(){_0x2e7f52[_0xb3d2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549df5,_0x1df32b){return function(_0x90e521){if(!_0x90e521){_0x549df5['sendStatus'](0x194);}return _0x90e521;};}function handleError(_0x1706dc,_0x403e05){_0x403e05=_0x403e05||0x1f4;return function(_0x14d0d5){logger[_0xb3d2('0x25')](_0x14d0d5[_0xb3d2('0x26')]);if(_0x14d0d5[_0xb3d2('0x27')]){delete _0x14d0d5[_0xb3d2('0x27')];}_0x1706dc['status'](_0x403e05)[_0xb3d2('0x28')](_0x14d0d5);};}exports[_0xb3d2('0x29')]=function(_0x5d6935,_0x4c550f){var _0x33ef32={},_0x1485e6={},_0x57b6a6={'count':0x0,'rows':[]};var _0x131562=_[_0xb3d2('0x2a')](db[_0xb3d2('0x2b')][_0xb3d2('0x2c')],function(_0x4da34b){return{'name':_0x4da34b['fieldName'],'type':_0x4da34b['type'][_0xb3d2('0x2d')]};});_0x1485e6[_0xb3d2('0x2e')]=_[_0xb3d2('0x2f')](_[_0xb3d2('0x2a')](_0x131562,'name'),[_0xb3d2('0x30')]);_0x1485e6[_0xb3d2('0x31')]=_[_0xb3d2('0x32')](_0x5d6935[_0xb3d2('0x31')]);_0x1485e6[_0xb3d2('0x33')]=_[_0xb3d2('0x34')](_0x1485e6[_0xb3d2('0x2e')],_0x1485e6[_0xb3d2('0x31')]);_0x33ef32[_0xb3d2('0x35')]=_['intersection'](_0x1485e6[_0xb3d2('0x2e')],qs[_0xb3d2('0x36')](_0x5d6935[_0xb3d2('0x31')][_0xb3d2('0x36')]));_0x33ef32[_0xb3d2('0x35')]=_0x33ef32[_0xb3d2('0x35')][_0xb3d2('0x37')]?_0x33ef32[_0xb3d2('0x35')]:_0x1485e6['model'];if(!_0x5d6935['query'][_0xb3d2('0x38')](_0xb3d2('0x39'))){_0x33ef32[_0xb3d2('0x1e')]=qs[_0xb3d2('0x1e')](_0x5d6935[_0xb3d2('0x31')][_0xb3d2('0x1e')]);_0x33ef32[_0xb3d2('0x1c')]=qs[_0xb3d2('0x1c')](_0x5d6935[_0xb3d2('0x31')][_0xb3d2('0x1c')]);}_0x33ef32[_0xb3d2('0x3a')]=qs['sort'](_0x5d6935[_0xb3d2('0x31')][_0xb3d2('0x3b')]);_0x33ef32['where']=qs['filters'](_[_0xb3d2('0x3c')](_0x5d6935['query'],_0x1485e6[_0xb3d2('0x33')]),_0x131562);if(_0x5d6935[_0xb3d2('0x31')][_0xb3d2('0x3d')]){_0x33ef32[_0xb3d2('0x3e')]=_[_0xb3d2('0x3f')](_0x33ef32[_0xb3d2('0x3e')],{'$or':_[_0xb3d2('0x2a')](_0x131562,function(_0x131986){if(_0x131986[_0xb3d2('0x40')]!==_0xb3d2('0x41')){var _0x4a3ae1={};_0x4a3ae1[_0x131986[_0xb3d2('0x27')]]={'$like':'%'+_0x5d6935['query'][_0xb3d2('0x3d')]+'%'};return _0x4a3ae1;}})});}_0x33ef32=_[_0xb3d2('0x3f')]({},_0x33ef32,_0x5d6935[_0xb3d2('0x42')]);var _0x415f57={'where':_0x33ef32[_0xb3d2('0x3e')]};return db[_0xb3d2('0x2b')]['count'](_0x415f57)[_0xb3d2('0x24')](function(_0x253115){_0x57b6a6[_0xb3d2('0x1f')]=_0x253115;if(_0x5d6935[_0xb3d2('0x31')][_0xb3d2('0x43')]){_0x33ef32['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x33ef32);})[_0xb3d2('0x24')](function(_0x3a710e){_0x57b6a6['rows']=_0x3a710e;return _0x57b6a6;})[_0xb3d2('0x24')](respondWithFilteredResult(_0x4c550f,_0x33ef32))['catch'](handleError(_0x4c550f,null));};exports[_0xb3d2('0x44')]=function(_0x5de469,_0xaaee73){var _0x388c89={'raw':![],'where':{'id':_0x5de469[_0xb3d2('0x45')]['id']}},_0x3f214d={};_0x3f214d[_0xb3d2('0x2e')]=_['keys'](db[_0xb3d2('0x2b')][_0xb3d2('0x2c')]);_0x3f214d[_0xb3d2('0x31')]=_['keys'](_0x5de469[_0xb3d2('0x31')]);_0x3f214d['filters']=_[_0xb3d2('0x34')](_0x3f214d['model'],_0x3f214d['query']);_0x388c89['attributes']=_[_0xb3d2('0x34')](_0x3f214d[_0xb3d2('0x2e')],qs[_0xb3d2('0x36')](_0x5de469[_0xb3d2('0x31')][_0xb3d2('0x36')]));_0x388c89[_0xb3d2('0x35')]=_0x388c89[_0xb3d2('0x35')][_0xb3d2('0x37')]?_0x388c89[_0xb3d2('0x35')]:_0x3f214d['model'];if(_0x5de469['query'][_0xb3d2('0x43')]){_0x388c89[_0xb3d2('0x46')]=[{'all':!![]}];}_0x388c89=_[_0xb3d2('0x3f')]({},_0x388c89,_0x5de469[_0xb3d2('0x42')]);return db['VoiceRecording']['find'](_0x388c89)[_0xb3d2('0x24')](handleEntityNotFound(_0xaaee73,null))['then'](respondWithResult(_0xaaee73,null))['catch'](handleError(_0xaaee73,null));};exports[_0xb3d2('0x47')]=function(_0x194d10,_0x3175a0){return db[_0xb3d2('0x2b')][_0xb3d2('0x47')](_0x194d10[_0xb3d2('0x48')],{})[_0xb3d2('0x24')](respondWithResult(_0x3175a0,0xc9))[_0xb3d2('0x49')](handleError(_0x3175a0,null));};exports[_0xb3d2('0x22')]=function(_0x54d2d2,_0x487a55){if(_0x54d2d2[_0xb3d2('0x48')]['id']){delete _0x54d2d2['body']['id'];}return db[_0xb3d2('0x2b')][_0xb3d2('0x4a')]({'where':{'id':_0x54d2d2[_0xb3d2('0x45')]['id']}})[_0xb3d2('0x24')](handleEntityNotFound(_0x487a55,null))['then'](saveUpdates(_0x54d2d2[_0xb3d2('0x48')],null))[_0xb3d2('0x24')](respondWithResult(_0x487a55,null))['catch'](handleError(_0x487a55,null));};exports[_0xb3d2('0x4b')]=function(_0x11273c,_0x573fe0){return db[_0xb3d2('0x2b')]['describe']()[_0xb3d2('0x24')](respondWithResult(_0x573fe0,null))[_0xb3d2('0x49')](handleError(_0x573fe0,null));};exports[_0xb3d2('0x4c')]=function(_0x541d23,_0x546e7e,_0x43420d){var _0x3c9e1e=require(_0xb3d2('0x4d'));var _0xa6ba13=![];var _0x385769={};if(_0x541d23[_0xb3d2('0x31')][_0xb3d2('0x40')]&&_0x541d23['query'][_0xb3d2('0x40')]===_0xb3d2('0x4e')){_0x385769[_0xb3d2('0x4e')]=_0x541d23['params']['id'];}else{_0x385769['id']=_0x541d23[_0xb3d2('0x45')]['id'];}return db['VoiceRecording'][_0xb3d2('0x4a')]({'where':_0x385769,'attributes':['id',_0xb3d2('0x4f')],'raw':!![]})[_0xb3d2('0x24')](handleEntityNotFound(_0x546e7e,null))[_0xb3d2('0x24')](function(_0x22989e){if(_0x22989e){var _0x4b5734=_0x22989e['value'];var _0x396514=util[_0xb3d2('0x30')](_0xb3d2('0x50'),_0x4b5734);if(fs[_0xb3d2('0x51')](_0x396514)){_0xa6ba13=!![];return _0x3c9e1e[_0xb3d2('0x52')](_0x396514,_0x4b5734,config['secrets'][_0xb3d2('0x53')])[_0xb3d2('0x24')](function(){return _0x22989e;});}return _0x22989e;}})[_0xb3d2('0x24')](function(_0x567add){if(_0x567add){var _0x22917b=_0x567add[_0xb3d2('0x4f')];if(!fs[_0xb3d2('0x51')](_0x22917b)){throw new db[(_0xb3d2('0x54'))][(_0xb3d2('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x567add[_0xb3d2('0x56')]){return _0x546e7e[_0xb3d2('0x4c')](_0x22917b,_0x567add[_0xb3d2('0x56')]+path[_0xb3d2('0x57')](_0x22917b),function(){if(_0xa6ba13){fs[_0xb3d2('0x58')](_0x22917b);}});}else{return _0x546e7e[_0xb3d2('0x4c')](_0x22917b,function(_0x313452){if(_0xa6ba13){fs[_0xb3d2('0x58')](_0x22917b);}});}}})[_0xb3d2('0x49')](function(_0x1b066d){if(_0x1b066d[_0xb3d2('0x59')]===_0xb3d2('0x5a')){_0x546e7e[_0xb3d2('0x1a')](0x194)[_0xb3d2('0x28')]('Not\x20found');}else{return handleError(_0x546e7e,null);}});};exports[_0xb3d2('0x5b')]=function(_0x38734a,_0x304c9a,_0x5ef414){var _0x3d8929=require(_0xb3d2('0x4d'));var _0x523d66=![];var _0x1c31dc={'$and':[db[_0xb3d2('0x5c')][_0xb3d2('0x3e')](db['sequelize']['fn']('MD5',db['sequelize'][_0xb3d2('0x5d')]('uniqueid')),_0x38734a['query'][_0xb3d2('0x5e')])]};if(_0x38734a['query'][_0xb3d2('0x40')]&&_0x38734a[_0xb3d2('0x31')][_0xb3d2('0x40')]==='uniqueid'){_0x1c31dc[_0xb3d2('0x5f')][_0xb3d2('0x60')]({'uniqueid':_0x38734a['params']['id']});}else{_0x1c31dc[_0xb3d2('0x5f')][_0xb3d2('0x60')]({'id':_0x38734a[_0xb3d2('0x45')]['id']});}return db[_0xb3d2('0x2b')][_0xb3d2('0x4a')]({'where':_0x1c31dc,'attributes':['id',_0xb3d2('0x4f')],'raw':!![]})[_0xb3d2('0x24')](handleEntityNotFound(_0x304c9a,null))['then'](function(_0xf44fa9){if(_0xf44fa9){var _0x53f45c=util[_0xb3d2('0x30')]('%s.cypher',_0xf44fa9['value']);if(fs[_0xb3d2('0x51')](_0x53f45c)){_0x523d66=!![];return _0x3d8929[_0xb3d2('0x52')](_0x53f45c,_0xf44fa9[_0xb3d2('0x4f')],config[_0xb3d2('0x61')][_0xb3d2('0x53')])[_0xb3d2('0x24')](function(){return _0xf44fa9;});}return _0xf44fa9;}})[_0xb3d2('0x24')](function(_0x5dd9e3){if(_0x5dd9e3){if(!fs['existsSync'](_0x5dd9e3[_0xb3d2('0x4f')])){throw new db[(_0xb3d2('0x54'))][(_0xb3d2('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x5dd9e3[_0xb3d2('0x56')]){return _0x304c9a[_0xb3d2('0x4c')](_0x5dd9e3[_0xb3d2('0x4f')],_0x5dd9e3['filename']+path[_0xb3d2('0x57')](_0x5dd9e3[_0xb3d2('0x4f')]),function(){if(_0x523d66){fs['unlink'](_0x5dd9e3[_0xb3d2('0x4f')]);}});}else{return _0x304c9a[_0xb3d2('0x4c')](_0x5dd9e3[_0xb3d2('0x4f')],function(_0x370f2e){if(_0x523d66){fs[_0xb3d2('0x58')](_0x5dd9e3['value']);}});}}})[_0xb3d2('0x49')](handleError(_0x304c9a,null));};exports[_0xb3d2('0x23')]=function(_0x428011,_0x7727f9){return db[_0xb3d2('0x2b')][_0xb3d2('0x4a')]({'where':{'id':_0x428011[_0xb3d2('0x45')]['id']}})[_0xb3d2('0x24')](function(_0x945cc7){if(_[_0xb3d2('0x62')](_0x945cc7)){throw new ReferenceError(_0xb3d2('0x63'));}return _0x945cc7;})[_0xb3d2('0x24')](function(_0x5553cb){var _0xee9077=_0x5553cb['value'];logger['info'](_0xb3d2('0x64'),_0xee9077);if(!_[_0xb3d2('0x62')](_0x5553cb['value'])&&fs[_0xb3d2('0x51')](_0xee9077)){logger[_0xb3d2('0x65')](_0xb3d2('0x66')+_0xee9077+_0xb3d2('0x67'));fs['unlinkSync'](_0xee9077);}_0xee9077=_0xee9077+_0xb3d2('0x68');if(!_[_0xb3d2('0x62')](_0x5553cb[_0xb3d2('0x4f')])&&fs[_0xb3d2('0x51')](_0xee9077)){logger[_0xb3d2('0x65')](_0xb3d2('0x66')+_0xee9077+_0xb3d2('0x67'));fs['unlinkSync'](_0xee9077);}return _0x5553cb;})['then'](function(_0x5048b8){if(!_0x5048b8)throw new InternalError();return _0x5048b8[_0xb3d2('0x23')]();})['then'](function(){_0x7727f9[_0xb3d2('0x1a')](0xcc)[_0xb3d2('0x19')]();})[_0xb3d2('0x49')](handleError(_0x7727f9,null));};function getBucketslist(_0x5d7fee,_0x188ebb,_0x35d916){return new Promise(function(_0x3f7720,_0x14299d){var _0x19a1ad=new AWS['S3']({'accessKeyId':_0x188ebb,'secretAccessKey':_0x5d7fee,'region':_0x35d916});_0x19a1ad[_0xb3d2('0x69')]({},function(_0x42398a,_0x1a7661){if(_0x42398a){return _0x14299d(_0x42398a);}else{return _0x3f7720(_0x1a7661);}});});}function createBucket(_0x3b6451,_0x5945f1,_0x4d34ed,_0x4b0d0f){return new Promise(function(_0x548757,_0x416b52){var _0x40f505=new AWS['S3']({'accessKeyId':_0x5945f1,'secretAccessKey':_0x3b6451,'region':_0x4d34ed});_0x40f505[_0xb3d2('0x6a')]({'Bucket':_0x4b0d0f},function(_0x34717d,_0x3937b7){if(_0x34717d){return _0x416b52(_0x34717d);}else{return _0x548757(_0x3937b7);}});});}function uploadFile(_0x551431,_0x371270,_0x1d6ef1,_0x24c905,_0x1c27ba,_0x5ecf03){return new Promise(function(_0x3cecbf,_0x456ec9){var _0x5e3299=new AWS['S3']({'accessKeyId':_0x371270,'secretAccessKey':_0x551431,'region':_0x1d6ef1});_0x5e3299[_0xb3d2('0x6b')]({'Bucket':_0x24c905,'Key':_0x1c27ba,'Body':_0x5ecf03},function(_0x5ce446,_0x55d796){if(_0x5ce446){return _0x456ec9(_0x5ce446);}else{return _0x3cecbf(_0x55d796);}});});}function startTranscribe(_0x305803,_0x122e4d,_0x145d93,_0xb9903f,_0x312b67,_0xdba71c){return new Promise(function(_0x39602c,_0x4d85f7){var _0x59e4bd=new AWS['TranscribeService']({'accessKeyId':_0x122e4d,'secretAccessKey':_0x305803,'region':_0x145d93});_0x59e4bd['startTranscriptionJob']({'TranscriptionJobName':_0xb9903f,'LanguageCode':_0x312b67,'Media':{'MediaFileUri':_0xdba71c}},function(_0x28b121,_0x272f46){if(_0x28b121){return _0x4d85f7(_0x28b121);}else{return _0x39602c(_0x272f46);}});});}function transcribe(_0x598369,_0x4d05c0,_0x238aee,_0x35c31e,_0x2d664b,_0x457a67,_0x212c0f){return new Promise(function(_0x4bc738,_0x4fb5ec){var _0x51b308={};logger['info'](util[_0xb3d2('0x30')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x598369,_0x2d664b));return uploadFile(_0x4d05c0,_0x238aee,_0x35c31e,_0x2d664b,path[_0xb3d2('0x6c')](_0x457a67),fs[_0xb3d2('0x6d')](_0x457a67))[_0xb3d2('0x24')](function(_0x2787cb){logger[_0xb3d2('0x65')](util['format'](_0xb3d2('0x6e'),_0x598369,_0x2d664b,_0x2787cb[_0xb3d2('0x6f')]));_0x51b308[_0xb3d2('0x70')]=_0x2787cb['Bucket'];_0x51b308['location']=_0x2787cb[_0xb3d2('0x6f')];logger['info'](util[_0xb3d2('0x30')](_0xb3d2('0x71'),_0x598369));return startTranscribe(_0x4d05c0,_0x238aee,_0x35c31e,uuidv4(),_0x212c0f,_0x2787cb[_0xb3d2('0x6f')]);})[_0xb3d2('0x24')](function(_0x37818c){logger[_0xb3d2('0x65')](util[_0xb3d2('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x598369,_0x37818c[_0xb3d2('0x72')]['TranscriptionJobName']));_0x51b308[_0xb3d2('0x73')]=_0x37818c[_0xb3d2('0x72')][_0xb3d2('0x74')];_0x51b308['transcribeStatus']=_0x37818c[_0xb3d2('0x72')][_0xb3d2('0x75')];return _0x4bc738(_0x51b308);})[_0xb3d2('0x49')](function(_0x5981dd){return _0x4fb5ec(_0x5981dd);});});}exports[_0xb3d2('0x76')]=function(_0x228b5a,_0x2e42f2,_0x2396a6){var _0x5c4349;var _0x164b9b;var _0x5185ca;var _0x37ae6d=require('../../components/encryptor');return db[_0xb3d2('0x2b')][_0xb3d2('0x77')]({'where':{'id':_0x228b5a[_0xb3d2('0x45')]['id']}})[_0xb3d2('0x24')](function(_0x486ec2){if(_0x486ec2){var _0x5891f3=util[_0xb3d2('0x30')]('%s.cypher',_0x486ec2['value']);if(fs[_0xb3d2('0x51')](_0x5891f3)){cypher=!![];return _0x37ae6d[_0xb3d2('0x52')](_0x5891f3,_0x486ec2[_0xb3d2('0x4f')],config[_0xb3d2('0x61')][_0xb3d2('0x53')])['then'](function(){return _0x486ec2;});}return _0x486ec2;}})[_0xb3d2('0x24')](function(_0x5ab4c6){if(!_0x5ab4c6){throw new db[(_0xb3d2('0x54'))][(_0xb3d2('0x55'))](_0xb3d2('0x78'));}_0x164b9b=_0x5ab4c6;return db['Setting'][_0xb3d2('0x77')]({'where':{'id':0x1}});})[_0xb3d2('0x24')](handleEntityNotFound(_0x2e42f2,null))['then'](function(_0x28f3ba){if(_0x28f3ba){_0x5c4349=_0x28f3ba;if(!_0x5c4349[_0xb3d2('0x79')]||!_0x5c4349['transcribeAccountId']||!_0x5c4349['transcribeRegion']||!_0x5c4349['language']||!_0x5c4349[_0xb3d2('0x70')]){throw new db[(_0xb3d2('0x54'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x228b5a[_0xb3d2('0x48')][_0xb3d2('0x7a')]&&(!_0x5c4349[_0xb3d2('0x7b')]||!_0x5c4349['sentimentAccountId']||!_0x5c4349[_0xb3d2('0x7c')]||!_0x5c4349['language']||!_0x5c4349['bucket'])){throw new db[(_0xb3d2('0x54'))][(_0xb3d2('0x55'))](_0xb3d2('0x7d'));}return db[_0xb3d2('0x7e')][_0xb3d2('0x77')]({'where':{'id':_0x5c4349[_0xb3d2('0x7f')]}});}})[_0xb3d2('0x24')](function(_0x414105){if(!_0x414105){throw new db[(_0xb3d2('0x54'))][(_0xb3d2('0x55'))](_0xb3d2('0x80'));}if(!_0x414105[_0xb3d2('0x81')]||!_0x414105[_0xb3d2('0x82')]){throw new db[(_0xb3d2('0x54'))]['ValidationError'](_0xb3d2('0x83'));}_0x5185ca=_0x414105;return getBucketslist(_0x5185ca[_0xb3d2('0x81')],_0x5185ca['data2'],_0x5c4349[_0xb3d2('0x84')]);})[_0xb3d2('0x24')](function(_0x3d30cf){if(_0x3d30cf&&_0x3d30cf[_0xb3d2('0x85')]){var _0x5c7ebb=_[_0xb3d2('0x4a')](_0x3d30cf['Buckets'],function(_0x1a6782){return _0x1a6782['Name']===_0x5c4349[_0xb3d2('0x70')];});if(!_0x5c7ebb){logger[_0xb3d2('0x65')](util['format'](_0xb3d2('0x86'),_0x228b5a[_0xb3d2('0x45')]['id'],_0x5c4349[_0xb3d2('0x70')]));return createBucket(_0x5185ca[_0xb3d2('0x81')],_0x5185ca[_0xb3d2('0x82')],_0x5c4349[_0xb3d2('0x84')],_0x5c4349[_0xb3d2('0x70')]);}logger[_0xb3d2('0x65')](util['format'](_0xb3d2('0x87'),_0x228b5a[_0xb3d2('0x45')]['id'],_0x5c4349[_0xb3d2('0x70')]));return;}})['then'](function(_0x4c89c0){if(_0x164b9b[_0xb3d2('0x88')]===_0xb3d2('0x89')){return transcribe(_0x228b5a[_0xb3d2('0x45')]['id'],_0x5185ca[_0xb3d2('0x81')],_0x5185ca[_0xb3d2('0x82')],_0x5c4349[_0xb3d2('0x84')],_0x5c4349['bucket'],_0x164b9b[_0xb3d2('0x4f')],_0x5c4349[_0xb3d2('0x8a')]);}else{logger[_0xb3d2('0x65')](util[_0xb3d2('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x228b5a[_0xb3d2('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xb3d2('0x24')](function(_0x3a3e1f){if(_0x3a3e1f){_0x3a3e1f['tempSentiment']=_0x228b5a['body'][_0xb3d2('0x7a')];return _0x164b9b[_0xb3d2('0x8b')](_0x3a3e1f);}})['then'](respondWithResult(_0x2e42f2,null))[_0xb3d2('0x49')](handleError(_0x2e42f2,null));};function writeFile(_0x6e30aa,_0x5a735b){return new Promise(function(_0x4c47dc,_0x1737ce){fs[_0xb3d2('0x8c')](_0x5a735b,_0x6e30aa,function(_0x2edce0,_0x5eda81){if(_0x2edce0){return _0x1737ce(_0x2edce0);}else{return _0x4c47dc(_0x5eda81);}});});}exports['downloadTranscribe']=function(_0x889e7f,_0x1177b3,_0x13eb7e){return db[_0xb3d2('0x2b')]['findOne']({'where':{'id':_0x889e7f[_0xb3d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x1177b3))[_0xb3d2('0x24')](function(_0x58adba){if(_0x58adba&&_0x58adba['fileText']){var _0x3e6d29=_0x58adba[_0xb3d2('0x8d')];var _0x7bba7f=config[_0xb3d2('0x8e')]+_0xb3d2('0x8f')+_0x58adba['id']+_0xb3d2('0x90');if(fs[_0xb3d2('0x51')](_0x7bba7f)){return _0x7bba7f;}return writeFile(_0x3e6d29,_0x7bba7f)[_0xb3d2('0x24')](function(){return _0x7bba7f;});}else{throw new db[(_0xb3d2('0x54'))][(_0xb3d2('0x55'))](_0xb3d2('0x91'));}})[_0xb3d2('0x24')](function(_0x3bf22b){return _0x1177b3[_0xb3d2('0x4c')](_0x3bf22b);})['catch'](handleError(_0x1177b3));}; \ No newline at end of file +var _0x96b9=['bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','VoiceRecording','include','findAll','rows','catch','show','find','create','body','params','describe','../../components/encryptor','uniqueid','value','existsSync','secrets','recording','Sequelize','filename','download','extname','unlink','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','$and','push','decryptFile','ValidationError','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','request-promise','moment'];(function(_0x41b750,_0x3dc138){var _0x343a11=function(_0x512332){while(--_0x512332){_0x41b750['push'](_0x41b750['shift']());}};_0x343a11(++_0x3dc138);}(_0x96b9,0x123));var _0x996b=function(_0x160d00,_0x2be0fc){_0x160d00=_0x160d00-0x0;var _0xb736e7=_0x96b9[_0x160d00];return _0xb736e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x996b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x996b('0x1'));var moment=require(_0x996b('0x2'));var BPromise=require(_0x996b('0x3'));var Mustache=require('mustache');var util=require(_0x996b('0x4'));var path=require('path');var sox=require(_0x996b('0x5'));var csv=require(_0x996b('0x6'));var ejs=require(_0x996b('0x7'));var fs=require('fs');var fs_extra=require(_0x996b('0x8'));var _=require(_0x996b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x996b('0xa'));var deskjs=require(_0x996b('0xb'));var toCsv=require(_0x996b('0x6'));var querystring=require(_0x996b('0xc'));var Papa=require('papaparse');var AWS=require(_0x996b('0xd'));var uuidv4=require(_0x996b('0xe'));var Redis=require(_0x996b('0xf'));var authService=require(_0x996b('0x10'));var qs=require(_0x996b('0x11'));var as=require(_0x996b('0x12'));var hardwareService=require(_0x996b('0x13'));var logger=require(_0x996b('0x14'))(_0x996b('0x15'));var utils=require(_0x996b('0x16'));var config=require(_0x996b('0x17'));var licenseUtil=require(_0x996b('0x18'));var db=require(_0x996b('0x19'))['db'];function respondWithStatusCode(_0x2f53ab,_0x4f4e89){_0x4f4e89=_0x4f4e89||0xcc;return function(_0x12c7d3){if(_0x12c7d3){return _0x2f53ab[_0x996b('0x1a')](_0x4f4e89);}return _0x2f53ab['status'](_0x4f4e89)[_0x996b('0x1b')]();};}function respondWithResult(_0x2166f7,_0x1f91f7){_0x1f91f7=_0x1f91f7||0xc8;return function(_0x4234f1){if(_0x4234f1){return _0x2166f7[_0x996b('0x1c')](_0x1f91f7)['json'](_0x4234f1);}};}function respondWithFilteredResult(_0x1951c9,_0x264fa5){return function(_0x114db5){if(_0x114db5){var _0x57d8ea=typeof _0x264fa5[_0x996b('0x1d')]===_0x996b('0x1e')&&typeof _0x264fa5[_0x996b('0x1f')]==='undefined';var _0x31b00e=_0x114db5[_0x996b('0x20')];var _0x33e036=_0x57d8ea?0x0:_0x264fa5[_0x996b('0x1d')];var _0x453259=_0x57d8ea?_0x114db5[_0x996b('0x20')]:_0x264fa5[_0x996b('0x1d')]+_0x264fa5[_0x996b('0x1f')];var _0xc11650;if(_0x453259>=_0x31b00e){_0x453259=_0x31b00e;_0xc11650=0xc8;}else{_0xc11650=0xce;}_0x1951c9[_0x996b('0x1c')](_0xc11650);return _0x1951c9[_0x996b('0x21')]('Content-Range',_0x33e036+'-'+_0x453259+'/'+_0x31b00e)['json'](_0x114db5);}return null;};}function patchUpdates(_0x245b12){return function(_0x151607){try{jsonpatch[_0x996b('0x22')](_0x151607,_0x245b12,!![]);}catch(_0x2c0206){return BPromise[_0x996b('0x23')](_0x2c0206);}return _0x151607['save']();};}function saveUpdates(_0x365b9c,_0x26c3c5){return function(_0x14234e){if(_0x14234e){return _0x14234e[_0x996b('0x24')](_0x365b9c)['then'](function(_0x100f45){return _0x100f45;});}return null;};}function removeEntity(_0x415e84,_0x2d2955){return function(_0x54dc38){if(_0x54dc38){return _0x54dc38[_0x996b('0x25')]()[_0x996b('0x26')](function(){_0x415e84[_0x996b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a384,_0x558d02){return function(_0x2f51f1){if(!_0x2f51f1){_0x38a384[_0x996b('0x1a')](0x194);}return _0x2f51f1;};}function handleError(_0x1bacb7,_0x1e1118){_0x1e1118=_0x1e1118||0x1f4;return function(_0x114045){logger[_0x996b('0x27')](_0x114045[_0x996b('0x28')]);if(_0x114045[_0x996b('0x29')]){delete _0x114045[_0x996b('0x29')];}_0x1bacb7[_0x996b('0x1c')](_0x1e1118)[_0x996b('0x2a')](_0x114045);};}exports[_0x996b('0x2b')]=function(_0x41df40,_0x9ea4ba){var _0x57ab44={},_0x518fb0={},_0x3c9cdb={'count':0x0,'rows':[]};var _0x45aed3=_['map'](db['VoiceRecording'][_0x996b('0x2c')],function(_0x2bb5fc){return{'name':_0x2bb5fc[_0x996b('0x2d')],'type':_0x2bb5fc[_0x996b('0x2e')]['key']};});_0x518fb0[_0x996b('0x2f')]=_[_0x996b('0x30')](_['map'](_0x45aed3,'name'),[_0x996b('0x31')]);_0x518fb0[_0x996b('0x32')]=_[_0x996b('0x33')](_0x41df40['query']);_0x518fb0['filters']=_[_0x996b('0x34')](_0x518fb0['model'],_0x518fb0[_0x996b('0x32')]);_0x57ab44[_0x996b('0x35')]=_['intersection'](_0x518fb0['model'],qs[_0x996b('0x36')](_0x41df40['query'][_0x996b('0x36')]));_0x57ab44[_0x996b('0x35')]=_0x57ab44[_0x996b('0x35')][_0x996b('0x37')]?_0x57ab44[_0x996b('0x35')]:_0x518fb0[_0x996b('0x2f')];if(!_0x41df40['query'][_0x996b('0x38')](_0x996b('0x39'))){_0x57ab44[_0x996b('0x1f')]=qs['limit'](_0x41df40[_0x996b('0x32')][_0x996b('0x1f')]);_0x57ab44['offset']=qs[_0x996b('0x1d')](_0x41df40[_0x996b('0x32')][_0x996b('0x1d')]);}_0x57ab44[_0x996b('0x3a')]=qs[_0x996b('0x3b')](_0x41df40[_0x996b('0x32')][_0x996b('0x3b')]);_0x57ab44['where']=qs[_0x996b('0x3c')](_[_0x996b('0x3d')](_0x41df40[_0x996b('0x32')],_0x518fb0[_0x996b('0x3c')]),_0x45aed3);if(_0x41df40[_0x996b('0x32')][_0x996b('0x3e')]){_0x57ab44[_0x996b('0x3f')]=_[_0x996b('0x40')](_0x57ab44[_0x996b('0x3f')],{'$or':_['map'](_0x45aed3,function(_0x186c76){if(_0x186c76['type']!=='VIRTUAL'){var _0x1bd4c8={};_0x1bd4c8[_0x186c76[_0x996b('0x29')]]={'$like':'%'+_0x41df40[_0x996b('0x32')][_0x996b('0x3e')]+'%'};return _0x1bd4c8;}})});}_0x57ab44=_[_0x996b('0x40')]({},_0x57ab44,_0x41df40[_0x996b('0x41')]);var _0x358739={'where':_0x57ab44[_0x996b('0x3f')]};return db[_0x996b('0x42')][_0x996b('0x20')](_0x358739)[_0x996b('0x26')](function(_0x2c3837){_0x3c9cdb[_0x996b('0x20')]=_0x2c3837;if(_0x41df40[_0x996b('0x32')]['includeAll']){_0x57ab44[_0x996b('0x43')]=[{'all':!![]}];}return db[_0x996b('0x42')][_0x996b('0x44')](_0x57ab44);})[_0x996b('0x26')](function(_0x25d3f4){_0x3c9cdb[_0x996b('0x45')]=_0x25d3f4;return _0x3c9cdb;})['then'](respondWithFilteredResult(_0x9ea4ba,_0x57ab44))[_0x996b('0x46')](handleError(_0x9ea4ba,null));};exports[_0x996b('0x47')]=function(_0x2e965c,_0x30cf60){var _0xd174a2={'raw':![],'where':{'id':_0x2e965c['params']['id']}},_0x456994={};_0x456994[_0x996b('0x2f')]=_[_0x996b('0x33')](db[_0x996b('0x42')][_0x996b('0x2c')]);_0x456994[_0x996b('0x32')]=_['keys'](_0x2e965c[_0x996b('0x32')]);_0x456994[_0x996b('0x3c')]=_[_0x996b('0x34')](_0x456994[_0x996b('0x2f')],_0x456994[_0x996b('0x32')]);_0xd174a2[_0x996b('0x35')]=_['intersection'](_0x456994[_0x996b('0x2f')],qs['fields'](_0x2e965c[_0x996b('0x32')][_0x996b('0x36')]));_0xd174a2[_0x996b('0x35')]=_0xd174a2[_0x996b('0x35')][_0x996b('0x37')]?_0xd174a2[_0x996b('0x35')]:_0x456994['model'];if(_0x2e965c['query']['includeAll']){_0xd174a2[_0x996b('0x43')]=[{'all':!![]}];}_0xd174a2=_[_0x996b('0x40')]({},_0xd174a2,_0x2e965c[_0x996b('0x41')]);return db[_0x996b('0x42')][_0x996b('0x48')](_0xd174a2)['then'](handleEntityNotFound(_0x30cf60,null))[_0x996b('0x26')](respondWithResult(_0x30cf60,null))['catch'](handleError(_0x30cf60,null));};exports[_0x996b('0x49')]=function(_0x335065,_0x3a089c){return db[_0x996b('0x42')][_0x996b('0x49')](_0x335065['body'],{})[_0x996b('0x26')](respondWithResult(_0x3a089c,0xc9))['catch'](handleError(_0x3a089c,null));};exports[_0x996b('0x24')]=function(_0x5f31b5,_0x166527){if(_0x5f31b5[_0x996b('0x4a')]['id']){delete _0x5f31b5['body']['id'];}return db[_0x996b('0x42')][_0x996b('0x48')]({'where':{'id':_0x5f31b5[_0x996b('0x4b')]['id']}})[_0x996b('0x26')](handleEntityNotFound(_0x166527,null))[_0x996b('0x26')](saveUpdates(_0x5f31b5['body'],null))[_0x996b('0x26')](respondWithResult(_0x166527,null))['catch'](handleError(_0x166527,null));};exports[_0x996b('0x4c')]=function(_0x357168,_0x2e2859){return db['VoiceRecording'][_0x996b('0x4c')]()[_0x996b('0x26')](respondWithResult(_0x2e2859,null))[_0x996b('0x46')](handleError(_0x2e2859,null));};exports['download']=function(_0x288a73,_0x37e8e6,_0x28b417){var _0xd6c36=require(_0x996b('0x4d'));var _0xf36212=![];var _0x23bb3b={};if(_0x288a73[_0x996b('0x32')][_0x996b('0x2e')]&&_0x288a73[_0x996b('0x32')][_0x996b('0x2e')]===_0x996b('0x4e')){_0x23bb3b[_0x996b('0x4e')]=_0x288a73[_0x996b('0x4b')]['id'];}else{_0x23bb3b['id']=_0x288a73[_0x996b('0x4b')]['id'];}return db['VoiceRecording'][_0x996b('0x48')]({'where':_0x23bb3b,'attributes':['id',_0x996b('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x37e8e6,null))[_0x996b('0x26')](function(_0x534bf5){if(_0x534bf5){var _0x56ea53=_0x534bf5['value'];var _0x4804f7=util['format']('%s.cypher',_0x56ea53);if(fs[_0x996b('0x50')](_0x4804f7)){_0xf36212=!![];return _0xd6c36['decryptFile'](_0x4804f7,_0x56ea53,config[_0x996b('0x51')][_0x996b('0x52')])[_0x996b('0x26')](function(){return _0x534bf5;});}return _0x534bf5;}})[_0x996b('0x26')](function(_0x2f481c){if(_0x2f481c){var _0x578288=_0x2f481c[_0x996b('0x4f')];if(!fs[_0x996b('0x50')](_0x578288)){throw new db[(_0x996b('0x53'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2f481c[_0x996b('0x54')]){return _0x37e8e6[_0x996b('0x55')](_0x578288,_0x2f481c[_0x996b('0x54')]+path[_0x996b('0x56')](_0x578288),function(){if(_0xf36212){fs[_0x996b('0x57')](_0x578288);}});}else{return _0x37e8e6[_0x996b('0x55')](_0x578288,function(_0x308f7b){if(_0xf36212){fs['unlink'](_0x578288);}});}}})[_0x996b('0x46')](function(_0x54d642){if(_0x54d642['message']===_0x996b('0x58')){_0x37e8e6[_0x996b('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x37e8e6,null);}});};exports[_0x996b('0x59')]=function(_0x171980,_0x290b2f,_0x47b60a){var _0x1f9669=require('../../components/encryptor');var _0x175b78=![];var _0x246ca4={'$and':[db[_0x996b('0x5a')][_0x996b('0x3f')](db[_0x996b('0x5a')]['fn'](_0x996b('0x5b'),db[_0x996b('0x5a')][_0x996b('0x5c')](_0x996b('0x4e'))),_0x171980[_0x996b('0x32')]['token'])]};if(_0x171980[_0x996b('0x32')]['type']&&_0x171980['query']['type']===_0x996b('0x4e')){_0x246ca4[_0x996b('0x5d')][_0x996b('0x5e')]({'uniqueid':_0x171980[_0x996b('0x4b')]['id']});}else{_0x246ca4['$and'][_0x996b('0x5e')]({'id':_0x171980[_0x996b('0x4b')]['id']});}return db['VoiceRecording'][_0x996b('0x48')]({'where':_0x246ca4,'attributes':['id','value'],'raw':!![]})[_0x996b('0x26')](handleEntityNotFound(_0x290b2f,null))[_0x996b('0x26')](function(_0x424d39){if(_0x424d39){var _0x288b34=util[_0x996b('0x31')]('%s.cypher',_0x424d39[_0x996b('0x4f')]);if(fs[_0x996b('0x50')](_0x288b34)){_0x175b78=!![];return _0x1f9669[_0x996b('0x5f')](_0x288b34,_0x424d39[_0x996b('0x4f')],config[_0x996b('0x51')]['recording'])['then'](function(){return _0x424d39;});}return _0x424d39;}})[_0x996b('0x26')](function(_0x4ebfec){if(_0x4ebfec){if(!fs[_0x996b('0x50')](_0x4ebfec['value'])){throw new db[(_0x996b('0x53'))][(_0x996b('0x60'))](_0x996b('0x58'));}if(_0x4ebfec[_0x996b('0x54')]){return _0x290b2f[_0x996b('0x55')](_0x4ebfec[_0x996b('0x4f')],_0x4ebfec['filename']+path[_0x996b('0x56')](_0x4ebfec[_0x996b('0x4f')]),function(){if(_0x175b78){fs[_0x996b('0x57')](_0x4ebfec['value']);}});}else{return _0x290b2f['download'](_0x4ebfec[_0x996b('0x4f')],function(_0x33fe62){if(_0x175b78){fs[_0x996b('0x57')](_0x4ebfec['value']);}});}}})[_0x996b('0x46')](handleError(_0x290b2f,null));};exports[_0x996b('0x25')]=function(_0x3c88f2,_0x34b87b){return db[_0x996b('0x42')][_0x996b('0x48')]({'where':{'id':_0x3c88f2[_0x996b('0x4b')]['id']}})['then'](function(_0x386963){if(_[_0x996b('0x61')](_0x386963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x386963;})[_0x996b('0x26')](function(_0x20ffdc){var _0x2ccd0c=_0x20ffdc[_0x996b('0x4f')];logger[_0x996b('0x62')](_0x996b('0x63'),_0x2ccd0c);if(!_[_0x996b('0x61')](_0x20ffdc[_0x996b('0x4f')])&&fs[_0x996b('0x50')](_0x2ccd0c)){logger['info']('File:\x20\x22'+_0x2ccd0c+_0x996b('0x64'));fs[_0x996b('0x65')](_0x2ccd0c);}_0x2ccd0c=_0x2ccd0c+_0x996b('0x66');if(!_[_0x996b('0x61')](_0x20ffdc[_0x996b('0x4f')])&&fs[_0x996b('0x50')](_0x2ccd0c)){logger[_0x996b('0x62')](_0x996b('0x67')+_0x2ccd0c+_0x996b('0x64'));fs[_0x996b('0x65')](_0x2ccd0c);}return _0x20ffdc;})[_0x996b('0x26')](function(_0x18147a){if(!_0x18147a)throw new InternalError();return _0x18147a['destroy']();})[_0x996b('0x26')](function(){_0x34b87b[_0x996b('0x1c')](0xcc)['end']();})['catch'](handleError(_0x34b87b,null));};function getBucketslist(_0x5517b6,_0x4bc18d,_0x21ecf5){return new Promise(function(_0x4b071d,_0x163d51){var _0x295327=new AWS['S3']({'accessKeyId':_0x4bc18d,'secretAccessKey':_0x5517b6,'region':_0x21ecf5});_0x295327[_0x996b('0x68')]({},function(_0x1e0136,_0x4f4336){if(_0x1e0136){return _0x163d51(_0x1e0136);}else{return _0x4b071d(_0x4f4336);}});});}function createBucket(_0x45d25c,_0x319ea7,_0x49e038,_0x24ddcc){return new Promise(function(_0x5a87fe,_0x3bf6c8){var _0x3c1655=new AWS['S3']({'accessKeyId':_0x319ea7,'secretAccessKey':_0x45d25c,'region':_0x49e038});_0x3c1655[_0x996b('0x69')]({'Bucket':_0x24ddcc},function(_0x17f271,_0x298cbf){if(_0x17f271){return _0x3bf6c8(_0x17f271);}else{return _0x5a87fe(_0x298cbf);}});});}function uploadFile(_0x1c0e64,_0x2237c1,_0x574bd6,_0x17cb29,_0x5c543f,_0x5b03be){return new Promise(function(_0x336258,_0x36ad3f){var _0x4de3e2=new AWS['S3']({'accessKeyId':_0x2237c1,'secretAccessKey':_0x1c0e64,'region':_0x574bd6});_0x4de3e2[_0x996b('0x6a')]({'Bucket':_0x17cb29,'Key':_0x5c543f,'Body':_0x5b03be},function(_0x995f90,_0x180a2a){if(_0x995f90){return _0x36ad3f(_0x995f90);}else{return _0x336258(_0x180a2a);}});});}function startTranscribe(_0x259ba7,_0x3e91e0,_0x4eeb2b,_0xbe0f58,_0x4cb0a8,_0x55b90f){return new Promise(function(_0x2234a3,_0x525e66){var _0x10dcc6=new AWS['TranscribeService']({'accessKeyId':_0x3e91e0,'secretAccessKey':_0x259ba7,'region':_0x4eeb2b});_0x10dcc6['startTranscriptionJob']({'TranscriptionJobName':_0xbe0f58,'LanguageCode':_0x4cb0a8,'Media':{'MediaFileUri':_0x55b90f}},function(_0x847e4c,_0x315ea0){if(_0x847e4c){return _0x525e66(_0x847e4c);}else{return _0x2234a3(_0x315ea0);}});});}function transcribe(_0x41ac2a,_0x3040be,_0x50b0be,_0x125c80,_0x2f8254,_0x33826d,_0x29a524){return new Promise(function(_0x226cdc,_0x506c5d){var _0x24e3f3={};logger[_0x996b('0x62')](util['format'](_0x996b('0x6b'),_0x41ac2a,_0x2f8254));return uploadFile(_0x3040be,_0x50b0be,_0x125c80,_0x2f8254,path[_0x996b('0x6c')](_0x33826d),fs['readFileSync'](_0x33826d))[_0x996b('0x26')](function(_0x29aea7){logger[_0x996b('0x62')](util[_0x996b('0x31')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x41ac2a,_0x2f8254,_0x29aea7[_0x996b('0x6d')]));_0x24e3f3[_0x996b('0x6e')]=_0x29aea7['Bucket'];_0x24e3f3[_0x996b('0x6f')]=_0x29aea7[_0x996b('0x6d')];logger[_0x996b('0x62')](util[_0x996b('0x31')](_0x996b('0x70'),_0x41ac2a));return startTranscribe(_0x3040be,_0x50b0be,_0x125c80,uuidv4(),_0x29a524,_0x29aea7[_0x996b('0x6d')]);})['then'](function(_0x82b916){logger[_0x996b('0x62')](util[_0x996b('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x41ac2a,_0x82b916[_0x996b('0x71')][_0x996b('0x72')]));_0x24e3f3[_0x996b('0x73')]=_0x82b916[_0x996b('0x71')]['TranscriptionJobName'];_0x24e3f3['transcribeStatus']=_0x82b916['TranscriptionJob'][_0x996b('0x74')];return _0x226cdc(_0x24e3f3);})[_0x996b('0x46')](function(_0x4b36d2){return _0x506c5d(_0x4b36d2);});});}exports[_0x996b('0x75')]=function(_0x3e9969,_0x25d2ba,_0x20cd27){var _0x54f412;var _0x892791;var _0x25d04e;var _0x50e8fd=require('../../components/encryptor');return db['VoiceRecording'][_0x996b('0x76')]({'where':{'id':_0x3e9969[_0x996b('0x4b')]['id']}})[_0x996b('0x26')](function(_0x3d7c5a){if(_0x3d7c5a){var _0x405f54=util[_0x996b('0x31')]('%s.cypher',_0x3d7c5a['value']);if(fs[_0x996b('0x50')](_0x405f54)){cypher=!![];return _0x50e8fd[_0x996b('0x5f')](_0x405f54,_0x3d7c5a[_0x996b('0x4f')],config['secrets'][_0x996b('0x52')])['then'](function(){return _0x3d7c5a;});}return _0x3d7c5a;}})[_0x996b('0x26')](function(_0x4d84b2){if(!_0x4d84b2){throw new db[(_0x996b('0x53'))][(_0x996b('0x60'))](_0x996b('0x77'));}_0x892791=_0x4d84b2;return db['Setting'][_0x996b('0x76')]({'where':{'id':0x1}});})[_0x996b('0x26')](handleEntityNotFound(_0x25d2ba,null))[_0x996b('0x26')](function(_0x3e948){if(_0x3e948){_0x54f412=_0x3e948;if(!_0x54f412[_0x996b('0x78')]||!_0x54f412[_0x996b('0x79')]||!_0x54f412[_0x996b('0x7a')]||!_0x54f412[_0x996b('0x7b')]||!_0x54f412[_0x996b('0x6e')]){throw new db[(_0x996b('0x53'))][(_0x996b('0x60'))]('Transcribe\x20not\x20configured');}if(_0x3e9969[_0x996b('0x4a')]['runSentiment']&&(!_0x54f412[_0x996b('0x7c')]||!_0x54f412[_0x996b('0x7d')]||!_0x54f412[_0x996b('0x7e')]||!_0x54f412[_0x996b('0x7b')]||!_0x54f412[_0x996b('0x6e')])){throw new db[(_0x996b('0x53'))]['ValidationError'](_0x996b('0x7f'));}return db[_0x996b('0x80')][_0x996b('0x76')]({'where':{'id':_0x54f412['transcribeAccountId']}});}})['then'](function(_0x2531d8){if(!_0x2531d8){throw new db[(_0x996b('0x53'))][(_0x996b('0x60'))](_0x996b('0x81'));}if(!_0x2531d8[_0x996b('0x82')]||!_0x2531d8[_0x996b('0x83')]){throw new db[(_0x996b('0x53'))][(_0x996b('0x60'))](_0x996b('0x84'));}_0x25d04e=_0x2531d8;return getBucketslist(_0x25d04e[_0x996b('0x82')],_0x25d04e[_0x996b('0x83')],_0x54f412[_0x996b('0x7a')]);})[_0x996b('0x26')](function(_0x2557ce){if(_0x2557ce&&_0x2557ce[_0x996b('0x85')]){var _0x50b106=_['find'](_0x2557ce[_0x996b('0x85')],function(_0x41538c){return _0x41538c[_0x996b('0x86')]===_0x54f412[_0x996b('0x6e')];});if(!_0x50b106){logger[_0x996b('0x62')](util[_0x996b('0x31')](_0x996b('0x87'),_0x3e9969[_0x996b('0x4b')]['id'],_0x54f412[_0x996b('0x6e')]));return createBucket(_0x25d04e[_0x996b('0x82')],_0x25d04e['data2'],_0x54f412[_0x996b('0x7a')],_0x54f412[_0x996b('0x6e')]);}logger[_0x996b('0x62')](util[_0x996b('0x31')](_0x996b('0x88'),_0x3e9969[_0x996b('0x4b')]['id'],_0x54f412[_0x996b('0x6e')]));return;}})[_0x996b('0x26')](function(_0x1144ee){if(_0x892791[_0x996b('0x89')]==='NEW'){return transcribe(_0x3e9969[_0x996b('0x4b')]['id'],_0x25d04e[_0x996b('0x82')],_0x25d04e[_0x996b('0x83')],_0x54f412[_0x996b('0x7a')],_0x54f412[_0x996b('0x6e')],_0x892791[_0x996b('0x4f')],_0x54f412[_0x996b('0x7b')]);}else{logger[_0x996b('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3e9969[_0x996b('0x4b')]['id']));return{'transcribeStatus':_0x996b('0x8a')};}})[_0x996b('0x26')](function(_0x5daa46){if(_0x5daa46){_0x5daa46['tempSentiment']=_0x3e9969[_0x996b('0x4a')][_0x996b('0x8b')];return _0x892791[_0x996b('0x8c')](_0x5daa46);}})[_0x996b('0x26')](respondWithResult(_0x25d2ba,null))['catch'](handleError(_0x25d2ba,null));};function writeFile(_0x4de1da,_0x236708){return new Promise(function(_0x4982d9,_0x403340){fs[_0x996b('0x8d')](_0x236708,_0x4de1da,function(_0x117370,_0x1d7f3c){if(_0x117370){return _0x403340(_0x117370);}else{return _0x4982d9(_0x1d7f3c);}});});}exports[_0x996b('0x8e')]=function(_0x32af11,_0x575eb8,_0x117e83){return db[_0x996b('0x42')][_0x996b('0x76')]({'where':{'id':_0x32af11[_0x996b('0x4b')]['id']}})[_0x996b('0x26')](handleEntityNotFound(_0x575eb8))['then'](function(_0x2366c7){if(_0x2366c7&&_0x2366c7[_0x996b('0x8f')]){var _0x2c3846=_0x2366c7[_0x996b('0x8f')];var _0x30f43d=config[_0x996b('0x90')]+_0x996b('0x91')+_0x2366c7['id']+'.txt';if(fs['existsSync'](_0x30f43d)){return _0x30f43d;}return writeFile(_0x2c3846,_0x30f43d)['then'](function(){return _0x30f43d;});}else{throw new db[(_0x996b('0x53'))]['ValidationError'](_0x996b('0x92'));}})[_0x996b('0x26')](function(_0x246630){return _0x575eb8['download'](_0x246630);})['catch'](handleError(_0x575eb8));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2808ef7..c4e596a 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 _0x5523=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','voice_recordings','uniqueid','../../config/logger'];(function(_0x2c69cb,_0x25751f){var _0x559c9b=function(_0x2ff2a4){while(--_0x2ff2a4){_0x2c69cb['push'](_0x2c69cb['shift']());}};_0x559c9b(++_0x25751f);}(_0x5523,0x137));var _0x3552=function(_0x339bf6,_0xb1757f){_0x339bf6=_0x339bf6-0x0;var _0x4aa8f6=_0x5523[_0x339bf6];return _0x4aa8f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var moment=require(_0x3552('0x2'));var BPromise=require(_0x3552('0x3'));var rp=require(_0x3552('0x4'));var fs=require('fs');var path=require(_0x3552('0x5'));var rimraf=require(_0x3552('0x6'));var config=require(_0x3552('0x7'));var attributes=require(_0x3552('0x8'));module[_0x3552('0x9')]=function(_0x3225aa,_0x58385b){return _0x3225aa['define']('VoiceRecording',attributes,{'tableName':_0x3552('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3552('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e1a=['voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x496700,_0x1db257){var _0x1ef2fa=function(_0x24e109){while(--_0x24e109){_0x496700['push'](_0x496700['shift']());}};_0x1ef2fa(++_0x1db257);}(_0x9e1a,0x120));var _0xa9e1=function(_0x5af982,_0x941927){_0x5af982=_0x5af982-0x0;var _0x2738b4=_0x9e1a[_0x5af982];return _0x2738b4;};'use strict';var _=require(_0xa9e1('0x0'));var util=require(_0xa9e1('0x1'));var logger=require(_0xa9e1('0x2'))(_0xa9e1('0x3'));var moment=require(_0xa9e1('0x4'));var BPromise=require(_0xa9e1('0x5'));var rp=require(_0xa9e1('0x6'));var fs=require('fs');var path=require(_0xa9e1('0x7'));var rimraf=require('rimraf');var config=require(_0xa9e1('0x8'));var attributes=require('./voiceRecording.attributes');module[_0xa9e1('0x9')]=function(_0x1c49ca,_0x160a75){return _0x1c49ca[_0xa9e1('0xa')]('VoiceRecording',attributes,{'tableName':_0xa9e1('0xb'),'paranoid':![],'indexes':[{'name':_0xa9e1('0xc'),'fields':[_0xa9e1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 657deb0..96d0aa0 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 _0x0120=['attributes','limit','then','debug','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','format','value','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateVoiceRecording','update','body','options','raw'];(function(_0xbf9fee,_0xf34240){var _0x1ee783=function(_0x522d01){while(--_0x522d01){_0xbf9fee['push'](_0xbf9fee['shift']());}};_0x1ee783(++_0xf34240);}(_0x0120,0x6f));var _0x0012=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0120[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});}exports[_0x0012('0x16')]=function(_0x1d0423){var _0x22ded1=this;return new Promise(function(_0x1e78ee,_0x2eb3fa){return db['VoiceRecording'][_0x0012('0x17')](_0x1d0423[_0x0012('0x18')],{'raw':_0x1d0423['options']?_0x1d0423[_0x0012('0x19')][_0x0012('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d0423[_0x0012('0x19')]?_0x1d0423[_0x0012('0x19')]['where']||null:null,'attributes':_0x1d0423['options']?_0x1d0423[_0x0012('0x19')][_0x0012('0x1b')]||null:null,'limit':_0x1d0423[_0x0012('0x19')]?_0x1d0423[_0x0012('0x19')][_0x0012('0x1c')]||null:null})[_0x0012('0x1d')](function(_0x2c9a96){logger[_0x0012('0xd')]('UpdateVoiceRecording',_0x1d0423);logger[_0x0012('0x1e')](_0x0012('0x16'),_0x1d0423,JSON['stringify'](_0x2c9a96));_0x1e78ee(_0x2c9a96);})[_0x0012('0x1f')](function(_0x13a78e){logger[_0x0012('0x12')](_0x0012('0x16'),_0x13a78e[_0x0012('0x14')],_0x1d0423);_0x2eb3fa(_0x22ded1['error'](0x1f4,_0x13a78e[_0x0012('0x14')]));});});};exports[_0x0012('0x20')]=function(_0xbb5b55){var _0x2a0302=this;return new Promise(function(_0x173cb3,_0xb37ef5){var _0x15d48a=require(_0x0012('0x21'));var _0x300e13;return db[_0x0012('0x22')][_0x0012('0x23')]({'attributes':['id',_0x0012('0x24')],'where':{'id':0x1},'raw':!![]})[_0x0012('0x1d')](function(_0x3ce788){_0x300e13=_0x3ce788;return db[_0x0012('0x25')][_0x0012('0x26')](_0xbb5b55[_0x0012('0x18')]);})[_0x0012('0x1d')](function(_0x1c23e0){if(_0x300e13[_0x0012('0x24')]&&fs[_0x0012('0x27')](_0x1c23e0['value'])){var _0x283134=util[_0x0012('0x28')]('%s.cypher',_0x1c23e0[_0x0012('0x29')]);return _0x15d48a[_0x0012('0x2a')](_0x1c23e0[_0x0012('0x29')],_0x283134,config[_0x0012('0x2b')][_0x0012('0x2c')])['then'](function(){fs[_0x0012('0x2d')](_0x1c23e0[_0x0012('0x29')]);logger[_0x0012('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x1c23e0;});}return _0x1c23e0;})[_0x0012('0x1d')](function(_0x31225a){logger[_0x0012('0xd')](_0x0012('0x20'),_0xbb5b55);logger[_0x0012('0x1e')](_0x0012('0x20'),_0xbb5b55,JSON['stringify'](_0x31225a));_0x173cb3(_0x31225a);})[_0x0012('0x1f')](function(_0x30dfd8){logger[_0x0012('0x12')](_0x0012('0x20'),_0x30dfd8['message'],_0xbb5b55);_0xb37ef5(_0x2a0302['error'](0x1f4,_0x30dfd8[_0x0012('0x14')]));});});}; \ No newline at end of file +var _0x8ace=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','body','callRecordingEncryption','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x51bd64,_0x1c8850){_0x51bd64=_0x51bd64-0x0;var _0x2c7ee4=_0x8ace[_0x51bd64];return _0x2c7ee4;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require(_0xe8ac('0x3'));var rs=require(_0xe8ac('0x4'));var fs=require('fs');var Redis=require(_0xe8ac('0x5'));var db=require(_0xe8ac('0x6'))['db'];var utils=require(_0xe8ac('0x7'));var logger=require(_0xe8ac('0x8'))(_0xe8ac('0x9'));var config=require(_0xe8ac('0xa'));var jayson=require(_0xe8ac('0xb'));var client=jayson[_0xe8ac('0xc')][_0xe8ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4eb087,_0x2d56f0,_0x1357ed){return new BPromise(function(_0x4f9233,_0x5c83e1){return client[_0xe8ac('0xe')](_0x4eb087,_0x1357ed)['then'](function(_0x1b5467){logger[_0xe8ac('0xf')](_0xe8ac('0x10'),_0x2d56f0,_0xe8ac('0x11'));logger[_0xe8ac('0x12')](_0xe8ac('0x13'),_0x2d56f0,'request\x20sent',JSON[_0xe8ac('0x14')](_0x1b5467));if(_0x1b5467[_0xe8ac('0x15')]){if(_0x1b5467[_0xe8ac('0x15')]['code']===0x1f4){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467['error'][_0xe8ac('0x16')]);return _0x5c83e1(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);return _0x4f9233(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}else{logger[_0xe8ac('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x2d56f0,_0xe8ac('0x11'));_0x4f9233(_0x1b5467[_0xe8ac('0x17')]['message']);}})[_0xe8ac('0x18')](function(_0x3a7939){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x3a7939);_0x5c83e1(_0x3a7939);});});}exports[_0xe8ac('0x19')]=function(_0x36759c){var _0x4892d0=this;return new Promise(function(_0x59df3d,_0x5f3433){return db[_0xe8ac('0x1a')][_0xe8ac('0x1b')](_0x36759c['body'],{'raw':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1e')]||null:null,'attributes':_0x36759c[_0xe8ac('0x1c')]?_0x36759c[_0xe8ac('0x1c')][_0xe8ac('0x1f')]||null:null,'limit':_0x36759c['options']?_0x36759c[_0xe8ac('0x1c')]['limit']||null:null})[_0xe8ac('0x20')](function(_0x3933d2){logger[_0xe8ac('0xf')](_0xe8ac('0x19'),_0x36759c);logger[_0xe8ac('0x12')](_0xe8ac('0x19'),_0x36759c,JSON[_0xe8ac('0x14')](_0x3933d2));_0x59df3d(_0x3933d2);})['catch'](function(_0x1c3ea4){logger[_0xe8ac('0x15')](_0xe8ac('0x19'),_0x1c3ea4[_0xe8ac('0x16')],_0x36759c);_0x5f3433(_0x4892d0[_0xe8ac('0x15')](0x1f4,_0x1c3ea4[_0xe8ac('0x16')]));});});};exports[_0xe8ac('0x21')]=function(_0x3e3fc2){var _0x44b07c=this;return new Promise(function(_0x562e44,_0x5a1b69){var _0x346dcb=require(_0xe8ac('0x22'));var _0x59512c;return db[_0xe8ac('0x23')][_0xe8ac('0x24')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1f1e44){_0x59512c=_0x1f1e44;return db[_0xe8ac('0x1a')][_0xe8ac('0x25')](_0x3e3fc2[_0xe8ac('0x26')]);})[_0xe8ac('0x20')](function(_0x41ffe8){if(_0x59512c[_0xe8ac('0x27')]&&fs['existsSync'](_0x41ffe8[_0xe8ac('0x28')])){var _0x5459e5=util[_0xe8ac('0x29')]('%s.cypher',_0x41ffe8['value']);return _0x346dcb['encryptFile'](_0x41ffe8['value'],_0x5459e5,config[_0xe8ac('0x2a')][_0xe8ac('0x2b')])[_0xe8ac('0x20')](function(){fs[_0xe8ac('0x2c')](_0x41ffe8[_0xe8ac('0x28')]);logger[_0xe8ac('0xf')](_0xe8ac('0x2d'));return _0x41ffe8;});}return _0x41ffe8;})['then'](function(_0x1cacb0){logger['info']('CreateVoiceRecording',_0x3e3fc2);logger['debug'](_0xe8ac('0x21'),_0x3e3fc2,JSON[_0xe8ac('0x14')](_0x1cacb0));_0x562e44(_0x1cacb0);})[_0xe8ac('0x18')](function(_0x56feff){logger['error'](_0xe8ac('0x21'),_0x56feff[_0xe8ac('0x16')],_0x3e3fc2);_0x5a1b69(_0x44b07c[_0xe8ac('0x15')](0x1f4,_0x56feff[_0xe8ac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index fe431af..e7ea60c 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 _0xb44f=['multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x17d489,_0x2dc6f5){var _0x28bce0=function(_0x219802){while(--_0x219802){_0x17d489['push'](_0x17d489['shift']());}};_0x28bce0(++_0x2dc6f5);}(_0xb44f,0x1ee));var _0xfb44=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb44f[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xfb44('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfb44('0x1')]();var fs_extra=require(_0xfb44('0x2'));var auth=require(_0xfb44('0x3'));var interaction=require(_0xfb44('0x4'));var config=require(_0xfb44('0x5'));var controller=require(_0xfb44('0x6'));router['get']('/',auth[_0xfb44('0x7')](),controller['index']);router['get']('/describe',auth[_0xfb44('0x7')](),controller[_0xfb44('0x8')]);router[_0xfb44('0x9')](_0xfb44('0xa'),auth['isAuthenticated'](),controller[_0xfb44('0xb')]);router[_0xfb44('0xc')]('/',auth[_0xfb44('0x7')](),controller[_0xfb44('0xd')]);router[_0xfb44('0xe')](_0xfb44('0xa'),auth[_0xfb44('0x7')](),controller[_0xfb44('0xf')]);router[_0xfb44('0x10')](_0xfb44('0xa'),auth[_0xfb44('0x7')](),controller[_0xfb44('0x11')]);module[_0xfb44('0x12')]=router; \ No newline at end of file +var _0xa01d=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','show','put','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xa01d,0xeb));var _0xda01=function(_0x52eb8c,_0x1f6124){_0x52eb8c=_0x52eb8c-0x0;var _0x29943b=_0xa01d[_0x52eb8c];return _0x29943b;};'use strict';var multer=require(_0xda01('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda01('0x1'));var express=require('express');var router=express[_0xda01('0x2')]();var fs_extra=require(_0xda01('0x3'));var auth=require(_0xda01('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xda01('0x5'));var controller=require(_0xda01('0x6'));router[_0xda01('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda01('0x7')]('/describe',auth[_0xda01('0x8')](),controller[_0xda01('0x9')]);router[_0xda01('0x7')](_0xda01('0xa'),auth[_0xda01('0x8')](),controller[_0xda01('0xb')]);router['post']('/',auth[_0xda01('0x8')](),controller['create']);router[_0xda01('0xc')]('/:id',auth[_0xda01('0x8')](),controller[_0xda01('0xd')]);router['delete'](_0xda01('0xa'),auth[_0xda01('0x8')](),controller[_0xda01('0xe')]);module[_0xda01('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b167568..9470f46 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 _0x25d5=['ENUM','sequelize','exports','blind','attended','STRING'];(function(_0x52dcb4,_0x5b4df5){var _0xb70d8f=function(_0x16da03){while(--_0x16da03){_0x52dcb4['push'](_0x52dcb4['shift']());}};_0xb70d8f(++_0x5b4df5);}(_0x25d5,0x91));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x525d('0x0'));var moment=require('moment');module[_0x525d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x525d('0x2'),_0x525d('0x3'))},'result':{'type':Sequelize[_0x525d('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x525d('0x4')]},'transferercalleridname':{'type':Sequelize[_0x525d('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x525d('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x525d('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x525d('0x4')]},'transfererexten':{'type':Sequelize[_0x525d('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x525d('0x4')]},'transfereechannel':{'type':Sequelize[_0x525d('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x525d('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x525d('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x525d('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x525d('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x525d('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x525d('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x525d('0x5')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ce8=['moment','exports','blind','attended','STRING'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8ce8,0x1c7));var _0x88ce=function(_0x51b52e,_0x3c2506){_0x51b52e=_0x51b52e-0x0;var _0x59a011=_0x8ce8[_0x51b52e];return _0x59a011;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x88ce('0x0'));module[_0x88ce('0x1')]={'type':{'type':Sequelize['ENUM'](_0x88ce('0x2'),_0x88ce('0x3'))},'result':{'type':Sequelize[_0x88ce('0x4')]},'transfererchannel':{'type':Sequelize[_0x88ce('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x88ce('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x88ce('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x88ce('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x88ce('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x88ce('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x88ce('0x4')]},'transfereechannel':{'type':Sequelize[_0x88ce('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x88ce('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x88ce('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x88ce('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x88ce('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x88ce('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x88ce('0x4')]},'extension':{'type':Sequelize[_0x88ce('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 3b91961..3a76ab7 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 _0xfbe7=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x167dda,_0x372120){var _0x5713dc=function(_0x4abd4c){while(--_0x4abd4c){_0x167dda['push'](_0x167dda['shift']());}};_0x5713dc(++_0x372120);}(_0xfbe7,0x12d));var _0x7fbe=function(_0x5685fc,_0x4a57c8){_0x5685fc=_0x5685fc-0x0;var _0x3a68a1=_0xfbe7[_0x5685fc];return _0x3a68a1;};'use strict';var emlformat=require(_0x7fbe('0x0'));var rimraf=require(_0x7fbe('0x1'));var zipdir=require(_0x7fbe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fbe('0x3'));var moment=require(_0x7fbe('0x4'));var BPromise=require(_0x7fbe('0x5'));var Mustache=require(_0x7fbe('0x6'));var util=require(_0x7fbe('0x7'));var path=require(_0x7fbe('0x8'));var sox=require(_0x7fbe('0x9'));var csv=require(_0x7fbe('0xa'));var ejs=require(_0x7fbe('0xb'));var fs=require('fs');var fs_extra=require(_0x7fbe('0xc'));var _=require('lodash');var squel=require(_0x7fbe('0xd'));var crypto=require(_0x7fbe('0xe'));var jsforce=require(_0x7fbe('0xf'));var deskjs=require(_0x7fbe('0x10'));var toCsv=require(_0x7fbe('0xa'));var querystring=require(_0x7fbe('0x11'));var Papa=require(_0x7fbe('0x12'));var Redis=require('ioredis');var authService=require(_0x7fbe('0x13'));var qs=require(_0x7fbe('0x14'));var as=require(_0x7fbe('0x15'));var hardwareService=require(_0x7fbe('0x16'));var logger=require(_0x7fbe('0x17'))(_0x7fbe('0x18'));var utils=require(_0x7fbe('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7fbe('0x1a'));var db=require(_0x7fbe('0x1b'))['db'];function respondWithStatusCode(_0x269600,_0x399777){_0x399777=_0x399777||0xcc;return function(_0x3030ce){if(_0x3030ce){return _0x269600['sendStatus'](_0x399777);}return _0x269600[_0x7fbe('0x1c')](_0x399777)[_0x7fbe('0x1d')]();};}function respondWithResult(_0x3f4db4,_0x2fb891){_0x2fb891=_0x2fb891||0xc8;return function(_0x33084c){if(_0x33084c){return _0x3f4db4[_0x7fbe('0x1c')](_0x2fb891)['json'](_0x33084c);}};}function respondWithFilteredResult(_0x533c97,_0x592ca9){return function(_0x7978f1){if(_0x7978f1){var _0x124f80=typeof _0x592ca9[_0x7fbe('0x1e')]===_0x7fbe('0x1f')&&typeof _0x592ca9[_0x7fbe('0x20')]===_0x7fbe('0x1f');var _0x4a13dd=_0x7978f1[_0x7fbe('0x21')];var _0xdccdde=_0x124f80?0x0:_0x592ca9[_0x7fbe('0x1e')];var _0x52705b=_0x124f80?_0x7978f1[_0x7fbe('0x21')]:_0x592ca9[_0x7fbe('0x1e')]+_0x592ca9[_0x7fbe('0x20')];var _0x1f224e;if(_0x52705b>=_0x4a13dd){_0x52705b=_0x4a13dd;_0x1f224e=0xc8;}else{_0x1f224e=0xce;}_0x533c97['status'](_0x1f224e);return _0x533c97[_0x7fbe('0x22')](_0x7fbe('0x23'),_0xdccdde+'-'+_0x52705b+'/'+_0x4a13dd)[_0x7fbe('0x24')](_0x7978f1);}return null;};}function patchUpdates(_0x32dc59){return function(_0x389664){try{jsonpatch['apply'](_0x389664,_0x32dc59,!![]);}catch(_0x303158){return BPromise['reject'](_0x303158);}return _0x389664[_0x7fbe('0x25')]();};}function saveUpdates(_0x8fa4e2,_0x3b61ff){return function(_0x4ac10d){if(_0x4ac10d){return _0x4ac10d['update'](_0x8fa4e2)[_0x7fbe('0x26')](function(_0x3cbea0){return _0x3cbea0;});}return null;};}function removeEntity(_0x3bbef9,_0x3792b9){return function(_0x3e4678){if(_0x3e4678){return _0x3e4678['destroy']()[_0x7fbe('0x26')](function(){_0x3bbef9['status'](0xcc)[_0x7fbe('0x1d')]();});}};}function handleEntityNotFound(_0x550b82,_0x244cd4){return function(_0x33dfeb){if(!_0x33dfeb){_0x550b82['sendStatus'](0x194);}return _0x33dfeb;};}function handleError(_0x32abac,_0x617a7d){_0x617a7d=_0x617a7d||0x1f4;return function(_0x15b0f6){logger[_0x7fbe('0x27')](_0x15b0f6[_0x7fbe('0x28')]);if(_0x15b0f6[_0x7fbe('0x29')]){delete _0x15b0f6['name'];}_0x32abac[_0x7fbe('0x1c')](_0x617a7d)[_0x7fbe('0x2a')](_0x15b0f6);};}exports[_0x7fbe('0x2b')]=function(_0x3104d8,_0x2d8ee9){var _0x451a46={},_0x49a1f3={},_0x5691dc={'count':0x0,'rows':[]};var _0x5e33c4=_[_0x7fbe('0x2c')](db[_0x7fbe('0x2d')][_0x7fbe('0x2e')],function(_0xda5200){return{'name':_0xda5200[_0x7fbe('0x2f')],'type':_0xda5200['type'][_0x7fbe('0x30')]};});_0x49a1f3[_0x7fbe('0x31')]=_[_0x7fbe('0x2c')](_0x5e33c4,_0x7fbe('0x29'));_0x49a1f3[_0x7fbe('0x32')]=_[_0x7fbe('0x33')](_0x3104d8[_0x7fbe('0x32')]);_0x49a1f3['filters']=_[_0x7fbe('0x34')](_0x49a1f3[_0x7fbe('0x31')],_0x49a1f3[_0x7fbe('0x32')]);_0x451a46['attributes']=_[_0x7fbe('0x34')](_0x49a1f3['model'],qs[_0x7fbe('0x35')](_0x3104d8[_0x7fbe('0x32')][_0x7fbe('0x35')]));_0x451a46[_0x7fbe('0x36')]=_0x451a46[_0x7fbe('0x36')][_0x7fbe('0x37')]?_0x451a46[_0x7fbe('0x36')]:_0x49a1f3[_0x7fbe('0x31')];if(!_0x3104d8[_0x7fbe('0x32')][_0x7fbe('0x38')](_0x7fbe('0x39'))){_0x451a46['limit']=qs[_0x7fbe('0x20')](_0x3104d8[_0x7fbe('0x32')][_0x7fbe('0x20')]);_0x451a46['offset']=qs[_0x7fbe('0x1e')](_0x3104d8[_0x7fbe('0x32')][_0x7fbe('0x1e')]);}_0x451a46[_0x7fbe('0x3a')]=qs['sort'](_0x3104d8[_0x7fbe('0x32')][_0x7fbe('0x3b')]);_0x451a46[_0x7fbe('0x3c')]=qs[_0x7fbe('0x3d')](_[_0x7fbe('0x3e')](_0x3104d8[_0x7fbe('0x32')],_0x49a1f3['filters']),_0x5e33c4);if(_0x3104d8['query'][_0x7fbe('0x3f')]){_0x451a46['where']=_[_0x7fbe('0x40')](_0x451a46['where'],{'$or':_[_0x7fbe('0x2c')](_0x5e33c4,function(_0x38e35b){if(_0x38e35b[_0x7fbe('0x41')]!==_0x7fbe('0x42')){var _0x1975a4={};_0x1975a4[_0x38e35b[_0x7fbe('0x29')]]={'$like':'%'+_0x3104d8[_0x7fbe('0x32')][_0x7fbe('0x3f')]+'%'};return _0x1975a4;}})});}_0x451a46=_[_0x7fbe('0x40')]({},_0x451a46,_0x3104d8[_0x7fbe('0x43')]);var _0x122a74={'where':_0x451a46[_0x7fbe('0x3c')]};return db['VoiceTransferReport'][_0x7fbe('0x21')](_0x122a74)[_0x7fbe('0x26')](function(_0x5c8f8f){_0x5691dc[_0x7fbe('0x21')]=_0x5c8f8f;if(_0x3104d8[_0x7fbe('0x32')][_0x7fbe('0x44')]){_0x451a46[_0x7fbe('0x45')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x7fbe('0x46')](_0x451a46);})['then'](function(_0x5a6aeb){_0x5691dc[_0x7fbe('0x47')]=_0x5a6aeb;return _0x5691dc;})['then'](respondWithFilteredResult(_0x2d8ee9,_0x451a46))[_0x7fbe('0x48')](handleError(_0x2d8ee9,null));};exports[_0x7fbe('0x49')]=function(_0x30ddb1,_0x4410a1){var _0x20573a={'raw':!![],'where':{'id':_0x30ddb1[_0x7fbe('0x4a')]['id']}},_0x30abdb={};_0x30abdb[_0x7fbe('0x31')]=_[_0x7fbe('0x33')](db[_0x7fbe('0x2d')][_0x7fbe('0x2e')]);_0x30abdb[_0x7fbe('0x32')]=_[_0x7fbe('0x33')](_0x30ddb1[_0x7fbe('0x32')]);_0x30abdb[_0x7fbe('0x3d')]=_[_0x7fbe('0x34')](_0x30abdb['model'],_0x30abdb[_0x7fbe('0x32')]);_0x20573a[_0x7fbe('0x36')]=_[_0x7fbe('0x34')](_0x30abdb['model'],qs['fields'](_0x30ddb1[_0x7fbe('0x32')][_0x7fbe('0x35')]));_0x20573a[_0x7fbe('0x36')]=_0x20573a[_0x7fbe('0x36')][_0x7fbe('0x37')]?_0x20573a[_0x7fbe('0x36')]:_0x30abdb['model'];if(_0x30ddb1['query'][_0x7fbe('0x44')]){_0x20573a[_0x7fbe('0x45')]=[{'all':!![]}];}_0x20573a=_[_0x7fbe('0x40')]({},_0x20573a,_0x30ddb1[_0x7fbe('0x43')]);return db[_0x7fbe('0x2d')][_0x7fbe('0x4b')](_0x20573a)[_0x7fbe('0x26')](handleEntityNotFound(_0x4410a1,null))[_0x7fbe('0x26')](respondWithResult(_0x4410a1,null))[_0x7fbe('0x48')](handleError(_0x4410a1,null));};exports['create']=function(_0xd1189d,_0x4efe9f){return db['VoiceTransferReport'][_0x7fbe('0x4c')](_0xd1189d[_0x7fbe('0x4d')],{})[_0x7fbe('0x26')](respondWithResult(_0x4efe9f,0xc9))[_0x7fbe('0x48')](handleError(_0x4efe9f,null));};exports[_0x7fbe('0x4e')]=function(_0x1c0ec5,_0x377fae){if(_0x1c0ec5[_0x7fbe('0x4d')]['id']){delete _0x1c0ec5['body']['id'];}return db['VoiceTransferReport'][_0x7fbe('0x4b')]({'where':{'id':_0x1c0ec5[_0x7fbe('0x4a')]['id']}})[_0x7fbe('0x26')](handleEntityNotFound(_0x377fae,null))['then'](saveUpdates(_0x1c0ec5['body'],null))[_0x7fbe('0x26')](respondWithResult(_0x377fae,null))[_0x7fbe('0x48')](handleError(_0x377fae,null));};exports[_0x7fbe('0x4f')]=function(_0x285246,_0x262109){return db[_0x7fbe('0x2d')][_0x7fbe('0x4b')]({'where':{'id':_0x285246[_0x7fbe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x262109,null))[_0x7fbe('0x26')](removeEntity(_0x262109,null))[_0x7fbe('0x48')](handleError(_0x262109,null));};exports['describe']=function(_0x1747cd,_0x1d421e){return db[_0x7fbe('0x2d')][_0x7fbe('0x50')]()['then'](respondWithResult(_0x1d421e,null))[_0x7fbe('0x48')](handleError(_0x1d421e,null));}; \ No newline at end of file +var _0xb9f3=['crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','offset','Content-Range','save','update','then','destroy','error','name','send','map','VoiceTransferReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','where','count','includeAll','findAll','catch','show','params','rawAttributes','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x41e87f,_0x20d6c0){var _0x2b68e2=function(_0x426164){while(--_0x426164){_0x41e87f['push'](_0x41e87f['shift']());}};_0x2b68e2(++_0x20d6c0);}(_0xb9f3,0x119));var _0x3b9f=function(_0x5cddb7,_0xb48393){_0x5cddb7=_0x5cddb7-0x0;var _0x35e40d=_0xb9f3[_0x5cddb7];return _0x35e40d;};'use strict';var emlformat=require(_0x3b9f('0x0'));var rimraf=require(_0x3b9f('0x1'));var zipdir=require(_0x3b9f('0x2'));var jsonpatch=require(_0x3b9f('0x3'));var rp=require(_0x3b9f('0x4'));var moment=require(_0x3b9f('0x5'));var BPromise=require(_0x3b9f('0x6'));var Mustache=require(_0x3b9f('0x7'));var util=require(_0x3b9f('0x8'));var path=require(_0x3b9f('0x9'));var sox=require('sox');var csv=require(_0x3b9f('0xa'));var ejs=require(_0x3b9f('0xb'));var fs=require('fs');var fs_extra=require(_0x3b9f('0xc'));var _=require(_0x3b9f('0xd'));var squel=require(_0x3b9f('0xe'));var crypto=require(_0x3b9f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3b9f('0x10'));var toCsv=require(_0x3b9f('0xa'));var querystring=require(_0x3b9f('0x11'));var Papa=require('papaparse');var Redis=require(_0x3b9f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3b9f('0x13'));var as=require(_0x3b9f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b9f('0x15'))(_0x3b9f('0x16'));var utils=require(_0x3b9f('0x17'));var config=require(_0x3b9f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d218e,_0x39e642){_0x39e642=_0x39e642||0xcc;return function(_0x2a36ff){if(_0x2a36ff){return _0x4d218e['sendStatus'](_0x39e642);}return _0x4d218e[_0x3b9f('0x19')](_0x39e642)[_0x3b9f('0x1a')]();};}function respondWithResult(_0x57036c,_0x408d07){_0x408d07=_0x408d07||0xc8;return function(_0x377d6e){if(_0x377d6e){return _0x57036c[_0x3b9f('0x19')](_0x408d07)[_0x3b9f('0x1b')](_0x377d6e);}};}function respondWithFilteredResult(_0x1c4b5e,_0x216ec0){return function(_0x1f159c){if(_0x1f159c){var _0x50eeeb=typeof _0x216ec0['offset']===_0x3b9f('0x1c')&&typeof _0x216ec0[_0x3b9f('0x1d')]===_0x3b9f('0x1c');var _0x198e2a=_0x1f159c['count'];var _0x6ae858=_0x50eeeb?0x0:_0x216ec0[_0x3b9f('0x1e')];var _0x62e11a=_0x50eeeb?_0x1f159c['count']:_0x216ec0['offset']+_0x216ec0[_0x3b9f('0x1d')];var _0x112a50;if(_0x62e11a>=_0x198e2a){_0x62e11a=_0x198e2a;_0x112a50=0xc8;}else{_0x112a50=0xce;}_0x1c4b5e['status'](_0x112a50);return _0x1c4b5e['set'](_0x3b9f('0x1f'),_0x6ae858+'-'+_0x62e11a+'/'+_0x198e2a)['json'](_0x1f159c);}return null;};}function patchUpdates(_0x3aadb1){return function(_0x4cde9c){try{jsonpatch['apply'](_0x4cde9c,_0x3aadb1,!![]);}catch(_0x3d8ef5){return BPromise['reject'](_0x3d8ef5);}return _0x4cde9c[_0x3b9f('0x20')]();};}function saveUpdates(_0x23bb23,_0x6b1d9){return function(_0xea255d){if(_0xea255d){return _0xea255d[_0x3b9f('0x21')](_0x23bb23)[_0x3b9f('0x22')](function(_0x1d0c3e){return _0x1d0c3e;});}return null;};}function removeEntity(_0xef46d6,_0x5d35ef){return function(_0x2a8937){if(_0x2a8937){return _0x2a8937[_0x3b9f('0x23')]()[_0x3b9f('0x22')](function(){_0xef46d6['status'](0xcc)[_0x3b9f('0x1a')]();});}};}function handleEntityNotFound(_0x33c501,_0x3a5109){return function(_0x40d0eb){if(!_0x40d0eb){_0x33c501['sendStatus'](0x194);}return _0x40d0eb;};}function handleError(_0x1267d1,_0x5c8a83){_0x5c8a83=_0x5c8a83||0x1f4;return function(_0x4ad500){logger[_0x3b9f('0x24')](_0x4ad500['stack']);if(_0x4ad500[_0x3b9f('0x25')]){delete _0x4ad500['name'];}_0x1267d1['status'](_0x5c8a83)[_0x3b9f('0x26')](_0x4ad500);};}exports['index']=function(_0xf6a470,_0xcdd8d8){var _0x6a3ec2={},_0xb4101e={},_0x3755b7={'count':0x0,'rows':[]};var _0x274aab=_[_0x3b9f('0x27')](db[_0x3b9f('0x28')]['rawAttributes'],function(_0x5aeab6){return{'name':_0x5aeab6[_0x3b9f('0x29')],'type':_0x5aeab6['type'][_0x3b9f('0x2a')]};});_0xb4101e[_0x3b9f('0x2b')]=_[_0x3b9f('0x27')](_0x274aab,_0x3b9f('0x25'));_0xb4101e['query']=_[_0x3b9f('0x2c')](_0xf6a470[_0x3b9f('0x2d')]);_0xb4101e[_0x3b9f('0x2e')]=_[_0x3b9f('0x2f')](_0xb4101e[_0x3b9f('0x2b')],_0xb4101e[_0x3b9f('0x2d')]);_0x6a3ec2[_0x3b9f('0x30')]=_['intersection'](_0xb4101e[_0x3b9f('0x2b')],qs[_0x3b9f('0x31')](_0xf6a470[_0x3b9f('0x2d')][_0x3b9f('0x31')]));_0x6a3ec2['attributes']=_0x6a3ec2[_0x3b9f('0x30')]['length']?_0x6a3ec2[_0x3b9f('0x30')]:_0xb4101e[_0x3b9f('0x2b')];if(!_0xf6a470['query'][_0x3b9f('0x32')](_0x3b9f('0x33'))){_0x6a3ec2['limit']=qs['limit'](_0xf6a470[_0x3b9f('0x2d')][_0x3b9f('0x1d')]);_0x6a3ec2['offset']=qs[_0x3b9f('0x1e')](_0xf6a470[_0x3b9f('0x2d')][_0x3b9f('0x1e')]);}_0x6a3ec2[_0x3b9f('0x34')]=qs[_0x3b9f('0x35')](_0xf6a470[_0x3b9f('0x2d')][_0x3b9f('0x35')]);_0x6a3ec2['where']=qs[_0x3b9f('0x2e')](_[_0x3b9f('0x36')](_0xf6a470[_0x3b9f('0x2d')],_0xb4101e[_0x3b9f('0x2e')]),_0x274aab);if(_0xf6a470[_0x3b9f('0x2d')][_0x3b9f('0x37')]){_0x6a3ec2['where']=_[_0x3b9f('0x38')](_0x6a3ec2['where'],{'$or':_[_0x3b9f('0x27')](_0x274aab,function(_0x22e5bf){if(_0x22e5bf[_0x3b9f('0x39')]!==_0x3b9f('0x3a')){var _0x42314b={};_0x42314b[_0x22e5bf[_0x3b9f('0x25')]]={'$like':'%'+_0xf6a470[_0x3b9f('0x2d')][_0x3b9f('0x37')]+'%'};return _0x42314b;}})});}_0x6a3ec2=_['merge']({},_0x6a3ec2,_0xf6a470[_0x3b9f('0x3b')]);var _0x405929={'where':_0x6a3ec2[_0x3b9f('0x3c')]};return db[_0x3b9f('0x28')][_0x3b9f('0x3d')](_0x405929)[_0x3b9f('0x22')](function(_0x27a0de){_0x3755b7[_0x3b9f('0x3d')]=_0x27a0de;if(_0xf6a470[_0x3b9f('0x2d')][_0x3b9f('0x3e')]){_0x6a3ec2['include']=[{'all':!![]}];}return db[_0x3b9f('0x28')][_0x3b9f('0x3f')](_0x6a3ec2);})[_0x3b9f('0x22')](function(_0x3e9483){_0x3755b7['rows']=_0x3e9483;return _0x3755b7;})['then'](respondWithFilteredResult(_0xcdd8d8,_0x6a3ec2))[_0x3b9f('0x40')](handleError(_0xcdd8d8,null));};exports[_0x3b9f('0x41')]=function(_0x3b716e,_0xf586){var _0x3e566e={'raw':!![],'where':{'id':_0x3b716e[_0x3b9f('0x42')]['id']}},_0x37da55={};_0x37da55['model']=_[_0x3b9f('0x2c')](db['VoiceTransferReport'][_0x3b9f('0x43')]);_0x37da55[_0x3b9f('0x2d')]=_[_0x3b9f('0x2c')](_0x3b716e['query']);_0x37da55[_0x3b9f('0x2e')]=_[_0x3b9f('0x2f')](_0x37da55['model'],_0x37da55[_0x3b9f('0x2d')]);_0x3e566e[_0x3b9f('0x30')]=_[_0x3b9f('0x2f')](_0x37da55['model'],qs['fields'](_0x3b716e[_0x3b9f('0x2d')][_0x3b9f('0x31')]));_0x3e566e[_0x3b9f('0x30')]=_0x3e566e[_0x3b9f('0x30')][_0x3b9f('0x44')]?_0x3e566e[_0x3b9f('0x30')]:_0x37da55['model'];if(_0x3b716e[_0x3b9f('0x2d')][_0x3b9f('0x3e')]){_0x3e566e[_0x3b9f('0x45')]=[{'all':!![]}];}_0x3e566e=_['merge']({},_0x3e566e,_0x3b716e[_0x3b9f('0x3b')]);return db[_0x3b9f('0x28')][_0x3b9f('0x46')](_0x3e566e)[_0x3b9f('0x22')](handleEntityNotFound(_0xf586,null))[_0x3b9f('0x22')](respondWithResult(_0xf586,null))['catch'](handleError(_0xf586,null));};exports[_0x3b9f('0x47')]=function(_0x3a15fb,_0x5586d2){return db[_0x3b9f('0x28')][_0x3b9f('0x47')](_0x3a15fb['body'],{})[_0x3b9f('0x22')](respondWithResult(_0x5586d2,0xc9))['catch'](handleError(_0x5586d2,null));};exports[_0x3b9f('0x21')]=function(_0x5e65d2,_0x387071){if(_0x5e65d2['body']['id']){delete _0x5e65d2[_0x3b9f('0x48')]['id'];}return db[_0x3b9f('0x28')][_0x3b9f('0x46')]({'where':{'id':_0x5e65d2[_0x3b9f('0x42')]['id']}})['then'](handleEntityNotFound(_0x387071,null))['then'](saveUpdates(_0x5e65d2[_0x3b9f('0x48')],null))['then'](respondWithResult(_0x387071,null))['catch'](handleError(_0x387071,null));};exports['destroy']=function(_0x232600,_0x4fbf0c){return db['VoiceTransferReport'][_0x3b9f('0x46')]({'where':{'id':_0x232600['params']['id']}})['then'](handleEntityNotFound(_0x4fbf0c,null))[_0x3b9f('0x22')](removeEntity(_0x4fbf0c,null))[_0x3b9f('0x40')](handleError(_0x4fbf0c,null));};exports[_0x3b9f('0x49')]=function(_0x4b10c7,_0x2cc39c){return db[_0x3b9f('0x28')][_0x3b9f('0x49')]()[_0x3b9f('0x22')](respondWithResult(_0x2cc39c,null))['catch'](handleError(_0x2cc39c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 8c6f6ac..3487ba9 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 _0xfdb0=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdb0,0x1e1));var _0x0fdb=function(_0x54a2df,_0x376f96){_0x54a2df=_0x54a2df-0x0;var _0x42e322=_0xfdb0[_0x54a2df];return _0x42e322;};'use strict';var _=require(_0x0fdb('0x0'));var util=require(_0x0fdb('0x1'));var logger=require(_0x0fdb('0x2'))(_0x0fdb('0x3'));var moment=require('moment');var BPromise=require(_0x0fdb('0x4'));var rp=require(_0x0fdb('0x5'));var fs=require('fs');var path=require(_0x0fdb('0x6'));var rimraf=require('rimraf');var config=require(_0x0fdb('0x7'));var attributes=require(_0x0fdb('0x8'));module[_0x0fdb('0x9')]=function(_0x3b3e40,_0x8b4906){return _0x3b3e40[_0x0fdb('0xa')](_0x0fdb('0xb'),attributes,{'tableName':_0x0fdb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3540=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','util','api','moment','bluebird'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x3540,0x1dc));var _0x0354=function(_0x451ba5,_0x2f3a05){_0x451ba5=_0x451ba5-0x0;var _0x4550fb=_0x3540[_0x451ba5];return _0x4550fb;};'use strict';var _=require('lodash');var util=require(_0x0354('0x0'));var logger=require('../../config/logger')(_0x0354('0x1'));var moment=require(_0x0354('0x2'));var BPromise=require(_0x0354('0x3'));var rp=require(_0x0354('0x4'));var fs=require('fs');var path=require(_0x0354('0x5'));var rimraf=require(_0x0354('0x6'));var config=require(_0x0354('0x7'));var attributes=require(_0x0354('0x8'));module['exports']=function(_0x4ec599,_0xe2d6f6){return _0x4ec599[_0x0354('0x9')](_0x0354('0xa'),attributes,{'tableName':_0x0354('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index cfcbc65..94ffee0 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 _0xa900=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3a2ced,_0x2566d4){var _0x5e3c94=function(_0x128ed5){while(--_0x128ed5){_0x3a2ced['push'](_0x3a2ced['shift']());}};_0x5e3c94(++_0x2566d4);}(_0xa900,0x174));var _0x0a90=function(_0x25f9dc,_0x36c8e1){_0x25f9dc=_0x25f9dc-0x0;var _0x4213ec=_0xa900[_0x25f9dc];return _0x4213ec;};'use strict';var _=require(_0x0a90('0x0'));var util=require(_0x0a90('0x1'));var moment=require(_0x0a90('0x2'));var BPromise=require(_0x0a90('0x3'));var rs=require(_0x0a90('0x4'));var fs=require('fs');var Redis=require(_0x0a90('0x5'));var db=require(_0x0a90('0x6'))['db'];var utils=require(_0x0a90('0x7'));var logger=require(_0x0a90('0x8'))('rpc');var config=require(_0x0a90('0x9'));var jayson=require(_0x0a90('0xa'));var client=jayson[_0x0a90('0xb')][_0x0a90('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dcfeb,_0xd10e92,_0x34a70f){return new BPromise(function(_0x38bac4,_0x432d6d){return client[_0x0a90('0xd')](_0x2dcfeb,_0x34a70f)[_0x0a90('0xe')](function(_0x121dae){logger[_0x0a90('0xf')](_0x0a90('0x10'),_0xd10e92,_0x0a90('0x11'));logger[_0x0a90('0x12')](_0x0a90('0x13'),_0xd10e92,_0x0a90('0x11'),JSON[_0x0a90('0x14')](_0x121dae));if(_0x121dae[_0x0a90('0x15')]){if(_0x121dae[_0x0a90('0x15')][_0x0a90('0x16')]===0x1f4){logger[_0x0a90('0x15')](_0x0a90('0x10'),_0xd10e92,_0x121dae[_0x0a90('0x15')][_0x0a90('0x17')]);return _0x432d6d(_0x121dae[_0x0a90('0x15')]['message']);}logger[_0x0a90('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0xd10e92,_0x121dae[_0x0a90('0x15')][_0x0a90('0x17')]);return _0x38bac4(_0x121dae[_0x0a90('0x15')][_0x0a90('0x17')]);}else{logger[_0x0a90('0xf')](_0x0a90('0x10'),_0xd10e92,'request\x20sent');_0x38bac4(_0x121dae[_0x0a90('0x18')][_0x0a90('0x17')]);}})[_0x0a90('0x19')](function(_0x1fd98c){logger[_0x0a90('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0xd10e92,_0x1fd98c);_0x432d6d(_0x1fd98c);});});}exports[_0x0a90('0x1a')]=function(_0x5b778e){var _0x4ee9b9=this;return new Promise(function(_0x9a5468,_0x105704){return db[_0x0a90('0x1b')][_0x0a90('0x1c')](_0x5b778e['body'],{'raw':_0x5b778e[_0x0a90('0x1d')]?_0x5b778e[_0x0a90('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x0a90('0xe')](function(_0x3c9c49){logger[_0x0a90('0xf')](_0x0a90('0x1a'),_0x5b778e);logger[_0x0a90('0x12')](_0x0a90('0x1a'),_0x5b778e,JSON['stringify'](_0x3c9c49));_0x9a5468(_0x3c9c49);})[_0x0a90('0x19')](function(_0x4db24c){logger[_0x0a90('0x15')]('CreateVoiceTransferReport',_0x4db24c['message'],_0x5b778e);_0x105704(_0x4ee9b9[_0x0a90('0x15')](0x1f4,_0x4db24c[_0x0a90('0x17')]));});});}; \ No newline at end of file +var _0xbad9=['create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateVoiceTransferReport','VoiceTransferReport'];(function(_0x4986fa,_0xd4c780){var _0x2585c6=function(_0x5536b5){while(--_0x5536b5){_0x4986fa['push'](_0x4986fa['shift']());}};_0x2585c6(++_0xd4c780);}(_0xbad9,0x17d));var _0x9bad=function(_0xf49e53,_0x3e4172){_0xf49e53=_0xf49e53-0x0;var _0x2b4769=_0xbad9[_0xf49e53];return _0x2b4769;};'use strict';var _=require('lodash');var util=require(_0x9bad('0x0'));var moment=require(_0x9bad('0x1'));var BPromise=require(_0x9bad('0x2'));var rs=require(_0x9bad('0x3'));var fs=require('fs');var Redis=require(_0x9bad('0x4'));var db=require(_0x9bad('0x5'))['db'];var utils=require(_0x9bad('0x6'));var logger=require(_0x9bad('0x7'))(_0x9bad('0x8'));var config=require(_0x9bad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9bad('0xa')][_0x9bad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ed229,_0x4706ad,_0x2266a5){return new BPromise(function(_0x1ce00e,_0x449996){return client[_0x9bad('0xc')](_0x5ed229,_0x2266a5)[_0x9bad('0xd')](function(_0x1290a0){logger[_0x9bad('0xe')](_0x9bad('0xf'),_0x4706ad,_0x9bad('0x10'));logger[_0x9bad('0x11')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4706ad,'request\x20sent',JSON[_0x9bad('0x12')](_0x1290a0));if(_0x1290a0[_0x9bad('0x13')]){if(_0x1290a0['error']['code']===0x1f4){logger[_0x9bad('0x13')](_0x9bad('0xf'),_0x4706ad,_0x1290a0[_0x9bad('0x13')][_0x9bad('0x14')]);return _0x449996(_0x1290a0[_0x9bad('0x13')]['message']);}logger['error'](_0x9bad('0xf'),_0x4706ad,_0x1290a0[_0x9bad('0x13')][_0x9bad('0x14')]);return _0x1ce00e(_0x1290a0['error'][_0x9bad('0x14')]);}else{logger[_0x9bad('0xe')](_0x9bad('0xf'),_0x4706ad,_0x9bad('0x10'));_0x1ce00e(_0x1290a0[_0x9bad('0x15')]['message']);}})['catch'](function(_0x552056){logger[_0x9bad('0x13')](_0x9bad('0xf'),_0x4706ad,_0x552056);_0x449996(_0x552056);});});}exports[_0x9bad('0x16')]=function(_0x385dda){var _0x818915=this;return new Promise(function(_0x3e42ba,_0x1c8f8a){return db[_0x9bad('0x17')][_0x9bad('0x18')](_0x385dda['body'],{'raw':_0x385dda[_0x9bad('0x19')]?_0x385dda[_0x9bad('0x19')][_0x9bad('0x1a')]===undefined?!![]:![]:!![]})[_0x9bad('0xd')](function(_0x36c579){logger[_0x9bad('0xe')]('CreateVoiceTransferReport',_0x385dda);logger[_0x9bad('0x11')](_0x9bad('0x16'),_0x385dda,JSON[_0x9bad('0x12')](_0x36c579));_0x3e42ba(_0x36c579);})['catch'](function(_0x41312f){logger['error'](_0x9bad('0x16'),_0x41312f[_0x9bad('0x14')],_0x385dda);_0x1c8f8a(_0x818915[_0x9bad('0x13')](0x1f4,_0x41312f[_0x9bad('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 72397f1..8ee100b 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 _0x1930=['../../components/auth/service','./webbar.controller','canUpdate','post','/hangup','isAuthenticated','hangup','/answer','answer','hold','/unhold','unhold','/calls','calls','/transfer','Router'];(function(_0x384068,_0x2e7c2d){var _0x47e63b=function(_0x2cb4e4){while(--_0x2cb4e4){_0x384068['push'](_0x384068['shift']());}};_0x47e63b(++_0x2e7c2d);}(_0x1930,0x11f));var _0x0193=function(_0x5b2762,_0x10d6d6){_0x5b2762=_0x5b2762-0x0;var _0x14d543=_0x1930[_0x5b2762];return _0x14d543;};'use strict';var express=require('express');var router=express[_0x0193('0x0')]();var auth=require(_0x0193('0x1'));var controller=require(_0x0193('0x2'));router['post']('/originate',auth['isAuthenticated'](),auth[_0x0193('0x3')](),controller['originate']);router[_0x0193('0x4')](_0x0193('0x5'),auth[_0x0193('0x6')](),auth['canUpdate'](),controller[_0x0193('0x7')]);router[_0x0193('0x4')](_0x0193('0x8'),auth[_0x0193('0x6')](),auth[_0x0193('0x3')](),controller[_0x0193('0x9')]);router[_0x0193('0x4')]('/hold',auth[_0x0193('0x6')](),auth['canUpdate'](),controller[_0x0193('0xa')]);router[_0x0193('0x4')](_0x0193('0xb'),auth['isAuthenticated'](),auth[_0x0193('0x3')](),controller[_0x0193('0xc')]);router[_0x0193('0x4')](_0x0193('0xd'),auth[_0x0193('0x6')](),auth[_0x0193('0x3')](),controller[_0x0193('0xe')]);router[_0x0193('0x4')](_0x0193('0xf'),auth[_0x0193('0x6')](),auth[_0x0193('0x3')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0xaebf=['isAuthenticated','canUpdate','/hangup','answer','/hold','hold','unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate'];(function(_0x983648,_0x3e33b7){var _0x55c62e=function(_0x87d659){while(--_0x87d659){_0x983648['push'](_0x983648['shift']());}};_0x55c62e(++_0x3e33b7);}(_0xaebf,0xbe));var _0xfaeb=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xaebf[_0x25e7cb];return _0x375d92;};'use strict';var express=require(_0xfaeb('0x0'));var router=express['Router']();var auth=require(_0xfaeb('0x1'));var controller=require(_0xfaeb('0x2'));router[_0xfaeb('0x3')](_0xfaeb('0x4'),auth[_0xfaeb('0x5')](),auth[_0xfaeb('0x6')](),controller['originate']);router['post'](_0xfaeb('0x7'),auth[_0xfaeb('0x5')](),auth[_0xfaeb('0x6')](),controller['hangup']);router['post']('/answer',auth[_0xfaeb('0x5')](),auth[_0xfaeb('0x6')](),controller[_0xfaeb('0x8')]);router[_0xfaeb('0x3')](_0xfaeb('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xfaeb('0xa')]);router[_0xfaeb('0x3')]('/unhold',auth[_0xfaeb('0x5')](),auth[_0xfaeb('0x6')](),controller[_0xfaeb('0xb')]);router[_0xfaeb('0x3')]('/calls',auth['isAuthenticated'](),auth[_0xfaeb('0x6')](),controller[_0xfaeb('0xc')]);router['post'](_0xfaeb('0xd'),auth[_0xfaeb('0x5')](),auth[_0xfaeb('0x6')](),controller['transfer']);module[_0xfaeb('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a2700d5..2006617 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 _0x6953=['calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','transfer\x20executed!','path','lodash','bluebird','client','http','../../config/logger','ioredis','defaults','redis','localhost','socket.io-emitter','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','request','message','catch','findOne','then','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','validate','json','body','userId','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','webbar:unhold','unhold\x20executed!'];(function(_0x2447cd,_0x5adabb){var _0x24993f=function(_0x41e88d){while(--_0x41e88d){_0x2447cd['push'](_0x2447cd['shift']());}};_0x24993f(++_0x5adabb);}(_0x6953,0x91));var _0x3695=function(_0x390030,_0x29354c){_0x390030=_0x390030-0x0;var _0x24b57b=_0x6953[_0x390030];return _0x24b57b;};'use strict';var path=require(_0x3695('0x0'));var fs=require('fs');var _=require(_0x3695('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x3695('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x3695('0x3')][_0x3695('0x4')]({'port':0x232a});var logger=require(_0x3695('0x5'))('webbarapi');var Redis=require(_0x3695('0x6'));config['redis']=_[_0x3695('0x7')](config[_0x3695('0x8')],{'host':_0x3695('0x9'),'port':0x18eb});var io=require(_0x3695('0xa'))(new Redis(config[_0x3695('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x3695('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x3695('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3695('0xc'),'required':[!![],_0x3695('0xe')]},'transferNumber':{'type':_0x3695('0xc'),'required':[!![],_0x3695('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]},'sessionId':{'type':_0x3695('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x3695('0xb'),'required':[!![],_0x3695('0xd')]}});function emit(_0x2cdd3,_0x3cb320,_0x367191){logger[_0x3695('0x10')](_0x2cdd3,_0x3cb320,JSON[_0x3695('0x11')](_0x367191));io['to'](_0x2cdd3)['emit'](_0x3cb320,_0x367191);}function handleError(_0x717ee4){return function(_0x5edf8d){console[_0x3695('0x12')](_0x3695('0x13'),_0x5edf8d,_0x5edf8d instanceof RangeError);logger[_0x3695('0x14')](_0x5edf8d[_0x3695('0x15')]);if(_0x5edf8d instanceof RangeError){if(_0x5edf8d[_0x3695('0x16')]){delete _0x5edf8d['name'];}_0x717ee4[_0x3695('0x17')](0x194)[_0x3695('0x18')](_0x5edf8d);}else{if(_0x5edf8d[_0x3695('0x16')]){delete _0x5edf8d[_0x3695('0x16')];}_0x717ee4[_0x3695('0x17')](0x1f4)[_0x3695('0x18')](_0x5edf8d);}};}function checkError(){return function(_0x34b0fc){if(!_0x34b0fc){throw new RangeError(_0x3695('0x19'));}return _0x34b0fc;};}function respondWithRpcPromise(_0x1f267a,_0xbbffe2){return new BPromise(function(_0x1b97d2,_0xf2c747){var _0x459f33=amiClient;return _0x459f33[_0x3695('0x1a')](_0x1f267a,_0xbbffe2)['then'](function(_0x42648c){if(_0x42648c[_0x3695('0x14')]){if(_0x42648c['error']['code']===0x1f4){return _0xf2c747(_0x42648c[_0x3695('0x14')][_0x3695('0x1b')]);}return _0x1b97d2(_0x42648c[_0x3695('0x14')][_0x3695('0x1b')]);}else{_0x1b97d2(_0x42648c['result']);}})[_0x3695('0x1c')](function(_0x48c2fd){_0xf2c747(_0x48c2fd);});});}function getAgent(_0xeddb06){return db['User'][_0x3695('0x1d')]({'where':{'id':_0xeddb06,'role':'agent'}})[_0x3695('0x1e')](checkError());}function getAgentCheckSession(_0x19f834,_0x462ff0){return new BPromise(function(_0x18a474,_0x3d4442){var _0x31fdf3=respondWithRpcPromise('VoiceChannels');var _0x2be6ee=getAgent(_0x19f834);Promise[_0x3695('0x1f')]([_0x31fdf3,_0x2be6ee])['then'](function(_0x392107){var _0x4d0742=_0x392107[0x0];var _0x39c39f=_0x392107[0x1];var _0x399bc6=_[_0x3695('0x20')](_0x4d0742[_0x3695('0x21')],function(_0x30a5ba){return _0x30a5ba[_0x3695('0x22')]==_0x39c39f['id']&&_0x30a5ba[_0x3695('0x23')]==_0x462ff0;});if(_0x399bc6[_0x3695('0x24')]==0x1){_0x18a474(_0x39c39f);}else{_0x3d4442(new RangeError('sessionId\x20'+_0x462ff0+_0x3695('0x25')));}});});}exports[_0x3695('0x26')]=function(_0xe6455e,_0x4c604f){logger['info'](_0x3695('0x27'),_0xe6455e['body']);var _0x12dbce=originateValidation[_0x3695('0x28')](_0xe6455e['body']);if(_0x12dbce[_0x3695('0x24')]>0x0){return _0x4c604f['status'](0x190)[_0x3695('0x29')](_0x12dbce);}var _0x197396=_0xe6455e[_0x3695('0x2a')][_0x3695('0x2b')];var _0x30eab2=_0xe6455e[_0x3695('0x2a')]['callNumber'];var _0x3ab2a0=_0xe6455e[_0x3695('0x2a')]['callerId'];var _0x2e657e=_0xe6455e[_0x3695('0x2a')]['callbackUrl'];return getAgent(_0x197396)['then'](function(_0x4c359d){logger['info'](_0x3695('0x2c'),_0x4c359d[_0x3695('0x16')]);emit(util['format'](_0x3695('0x2d'),_0x4c359d[_0x3695('0x16')]),_0x3695('0x2e'),{'callNumber':_0x30eab2,'callerId':_0x3ab2a0,'callbackUrl':_0x2e657e});return _0x4c604f[_0x3695('0x17')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x3695('0x1c')](handleError(_0x4c604f));};exports[_0x3695('0x2f')]=function(_0x59c271,_0x12ebe9){logger[_0x3695('0x10')](_0x3695('0x30'),_0x59c271[_0x3695('0x2a')]);var _0xaee5e8=hangupValidation[_0x3695('0x28')](_0x59c271[_0x3695('0x2a')]);if(_0xaee5e8[_0x3695('0x24')]>0x0){return _0x12ebe9[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0xaee5e8);}var _0x460b49=_0x59c271[_0x3695('0x2a')][_0x3695('0x2b')];var _0x1d0fa0=_0x59c271[_0x3695('0x2a')][_0x3695('0x23')];return getAgent(_0x460b49)['then'](function(_0x775d39){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x775d39[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x775d39[_0x3695('0x16')]),'webbar:hangup',{'sessionId':_0x1d0fa0});return _0x12ebe9[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x32')});})['catch'](handleError(_0x12ebe9));};exports[_0x3695('0x33')]=function(_0x454e86,_0x3ffc79){logger[_0x3695('0x10')](_0x3695('0x34'),_0x454e86[_0x3695('0x2a')]);var _0x4261d1=answerValidation['validate'](_0x454e86[_0x3695('0x2a')]);if(_0x4261d1['length']>0x0){return _0x3ffc79['status'](0x190)[_0x3695('0x29')](_0x4261d1);}var _0x51f403=_0x454e86[_0x3695('0x2a')][_0x3695('0x2b')];var _0x65f4b3=_0x454e86[_0x3695('0x2a')]['sessionId'];return getAgent(_0x51f403)[_0x3695('0x1e')](function(_0x34cbd8){logger[_0x3695('0x10')]('entityFound:',_0x34cbd8[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x34cbd8[_0x3695('0x16')]),_0x3695('0x35'),{'sessionId':_0x65f4b3});return _0x3ffc79[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x36')});})[_0x3695('0x1c')](handleError(_0x3ffc79));};exports['hold']=function(_0x57bf10,_0x1a021e){logger[_0x3695('0x10')](_0x3695('0x37'),_0x57bf10['body']);var _0x1c8fc3=holdValidation[_0x3695('0x28')](_0x57bf10[_0x3695('0x2a')]);if(_0x1c8fc3['length']>0x0){return _0x1a021e[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0x1c8fc3);}var _0x3d6a61=_0x57bf10[_0x3695('0x2a')][_0x3695('0x2b')];var _0x567d5e=_0x57bf10[_0x3695('0x2a')][_0x3695('0x23')];return getAgent(_0x3d6a61)[_0x3695('0x1e')](function(_0x361a9f){logger['info'](_0x3695('0x2c'),_0x361a9f['name']);emit(util['format'](_0x3695('0x2d'),_0x361a9f[_0x3695('0x16')]),_0x3695('0x38'),{'sessionId':_0x567d5e});return _0x1a021e[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x1a021e));};exports['unhold']=function(_0x5173b8,_0x5eeaca){logger['info']('unhold\x20fired:',_0x5173b8['body']);var _0x3b1c1c=unholdValidation[_0x3695('0x28')](_0x5173b8['body']);if(_0x3b1c1c[_0x3695('0x24')]>0x0){return _0x5eeaca[_0x3695('0x17')](0x190)['json'](_0x3b1c1c);}var _0x4a0a78=_0x5173b8[_0x3695('0x2a')][_0x3695('0x2b')];var _0x1a61d6=_0x5173b8['body'][_0x3695('0x23')];return getAgent(_0x4a0a78)[_0x3695('0x1e')](function(_0x1422f0){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x1422f0[_0x3695('0x16')]);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x1422f0[_0x3695('0x16')]),_0x3695('0x39'),{'sessionId':_0x1a61d6});return _0x5eeaca[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x3a')});})[_0x3695('0x1c')](handleError(_0x5eeaca));};exports[_0x3695('0x3b')]=function(_0x63771a,_0x441997){logger[_0x3695('0x10')](_0x3695('0x3c'),_0x441997[_0x3695('0x2a')]);var _0x42a960=callsValidation[_0x3695('0x28')](_0x63771a[_0x3695('0x2a')]);if(_0x42a960['length']>0x0){return _0x441997['status'](0x190)[_0x3695('0x29')](_0x42a960);}var _0xea6f22=_0x63771a['body'][_0x3695('0x2b')];var _0x43f6f5=respondWithRpcPromise(_0x3695('0x3d'));var _0x357564=getAgent(_0xea6f22);return Promise[_0x3695('0x1f')]([_0x43f6f5,_0x357564])[_0x3695('0x1e')](function(_0x38d20c){var _0x9a8d31=_0x38d20c[0x0];var _0x520fd3=_0x38d20c[0x1];var _0x29c8a3=_['filter'](_0x9a8d31[_0x3695('0x21')],function(_0x3098f7){return _0x3098f7[_0x3695('0x22')]==_0x520fd3['id'];});return _0x441997[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'count':_0x29c8a3['length'],'rows':_0x29c8a3});})[_0x3695('0x1c')](handleError(_0x441997));};exports[_0x3695('0x3e')]=function(_0xf18f60,_0x55f673){logger[_0x3695('0x10')](_0x3695('0x3f'),_0xf18f60['body']);var _0x47cd30=conferenceValidation[_0x3695('0x28')](_0xf18f60['body']);if(_0x47cd30['length']>0x0){return _0x55f673[_0x3695('0x17')](0x190)[_0x3695('0x29')](_0x47cd30);}var _0xade517=_0xf18f60[_0x3695('0x2a')][_0x3695('0x2b')];return getAgent(_0xade517)['then'](function(_0x3250f1){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x3250f1['name']);emit(util[_0x3695('0x31')](_0x3695('0x2d'),_0x3250f1[_0x3695('0x16')]),_0x3695('0x40'));return _0x55f673[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':'conference\x20executed!'});})[_0x3695('0x1c')](handleError(_0x55f673));};exports[_0x3695('0x41')]=function(_0x41e8de,_0x2551fd){logger[_0x3695('0x10')]('transfer\x20fired:',_0x41e8de[_0x3695('0x2a')]);var _0x19b3e3=transferValidation[_0x3695('0x28')](_0x41e8de[_0x3695('0x2a')]);if(_0x19b3e3[_0x3695('0x24')]>0x0){return _0x2551fd[_0x3695('0x17')](0x190)['json'](_0x19b3e3);}var _0x1effea=_0x41e8de[_0x3695('0x2a')]['userId'];var _0x4e7d7a=_0x41e8de[_0x3695('0x2a')][_0x3695('0x23')];var _0x1b500b=_0x41e8de['body'][_0x3695('0x42')];return getAgent(_0x1effea)[_0x3695('0x1e')](function(_0x1bd95d){logger[_0x3695('0x10')](_0x3695('0x2c'),_0x1bd95d['name']);emit(util[_0x3695('0x31')]('user:%s',_0x1bd95d['name']),'webbar:transfer',{'sessionId':_0x4e7d7a,'transferNumber':_0x1b500b});return _0x2551fd[_0x3695('0x17')](0xc8)[_0x3695('0x29')]({'error':![],'message':_0x3695('0x43')});})[_0x3695('0x1c')](handleError(_0x2551fd));}; \ No newline at end of file +var _0x2dae=['format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','user:%s','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','all','filter','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','findOne','agent','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2dae,0xc3));var _0xe2da=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x2dae[_0x1064bc];return _0x5edc45;};'use strict';var path=require(_0xe2da('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xe2da('0x1'))['db'];var config=require(_0xe2da('0x2'));var util=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var jayson=require(_0xe2da('0x5'));var amiClient=jayson['client'][_0xe2da('0x6')]({'port':0x232a});var logger=require(_0xe2da('0x7'))(_0xe2da('0x8'));var Redis=require(_0xe2da('0x9'));config['redis']=_[_0xe2da('0xa')](config[_0xe2da('0xb')],{'host':_0xe2da('0xc'),'port':0x18eb});var io=require(_0xe2da('0xd'))(new Redis(config[_0xe2da('0xb')]));var Schema=require(_0xe2da('0xe'));var originateValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]},'callNumber':{'type':_0xe2da('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xe2da('0x11')},'callbackUrl':{'type':_0xe2da('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]},'sessionId':{'type':_0xe2da('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]},'sessionId':{'type':_0xe2da('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe2da('0x10')]},'sessionId':{'type':'string','required':[!![],_0xe2da('0x12')]},'transferNumber':{'type':_0xe2da('0x11'),'required':[!![],_0xe2da('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]},'sessionId':{'type':_0xe2da('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe2da('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xe2da('0xf'),'required':[!![],_0xe2da('0x10')]}});function emit(_0x33f919,_0x4dc58b,_0x25d4fa){logger[_0xe2da('0x14')](_0x33f919,_0x4dc58b,JSON[_0xe2da('0x15')](_0x25d4fa));io['to'](_0x33f919)[_0xe2da('0x16')](_0x4dc58b,_0x25d4fa);}function handleError(_0x4e1623){return function(_0x45bb92){console[_0xe2da('0x17')](_0xe2da('0x18'),_0x45bb92,_0x45bb92 instanceof RangeError);logger[_0xe2da('0x19')](_0x45bb92[_0xe2da('0x1a')]);if(_0x45bb92 instanceof RangeError){if(_0x45bb92['name']){delete _0x45bb92[_0xe2da('0x1b')];}_0x4e1623[_0xe2da('0x1c')](0x194)['send'](_0x45bb92);}else{if(_0x45bb92[_0xe2da('0x1b')]){delete _0x45bb92[_0xe2da('0x1b')];}_0x4e1623[_0xe2da('0x1c')](0x1f4)[_0xe2da('0x1d')](_0x45bb92);}};}function checkError(){return function(_0x336415){if(!_0x336415){throw new RangeError(_0xe2da('0x1e'));}return _0x336415;};}function respondWithRpcPromise(_0x5a9ffe,_0x467cd6){return new BPromise(function(_0x53cc4e,_0x30efdc){var _0x191d38=amiClient;return _0x191d38[_0xe2da('0x1f')](_0x5a9ffe,_0x467cd6)[_0xe2da('0x20')](function(_0x30dea4){if(_0x30dea4[_0xe2da('0x19')]){if(_0x30dea4[_0xe2da('0x19')][_0xe2da('0x21')]===0x1f4){return _0x30efdc(_0x30dea4['error'][_0xe2da('0x22')]);}return _0x53cc4e(_0x30dea4[_0xe2da('0x19')][_0xe2da('0x22')]);}else{_0x53cc4e(_0x30dea4[_0xe2da('0x23')]);}})[_0xe2da('0x24')](function(_0x230fb8){_0x30efdc(_0x230fb8);});});}function getAgent(_0x124d93){return db['User'][_0xe2da('0x25')]({'where':{'id':_0x124d93,'role':_0xe2da('0x26')}})[_0xe2da('0x20')](checkError());}function getAgentCheckSession(_0x38ee5e,_0x36ca43){return new BPromise(function(_0x2b6c9e,_0x1b4aff){var _0x39f60e=respondWithRpcPromise('VoiceChannels');var _0x487a7c=getAgent(_0x38ee5e);Promise['all']([_0x39f60e,_0x487a7c])[_0xe2da('0x20')](function(_0x8c91db){var _0x4146ad=_0x8c91db[0x0];var _0x1ab91a=_0x8c91db[0x1];var _0x5de7fb=_['filter'](_0x4146ad[_0xe2da('0x27')],function(_0x1ec8ca){return _0x1ec8ca[_0xe2da('0x28')]==_0x1ab91a['id']&&_0x1ec8ca[_0xe2da('0x29')]==_0x36ca43;});if(_0x5de7fb[_0xe2da('0x2a')]==0x1){_0x2b6c9e(_0x1ab91a);}else{_0x1b4aff(new RangeError(_0xe2da('0x2b')+_0x36ca43+_0xe2da('0x2c')));}});});}exports[_0xe2da('0x2d')]=function(_0x461610,_0x499400){logger['info'](_0xe2da('0x2e'),_0x461610[_0xe2da('0x2f')]);var _0x2cb457=originateValidation[_0xe2da('0xe')](_0x461610[_0xe2da('0x2f')]);if(_0x2cb457[_0xe2da('0x2a')]>0x0){return _0x499400[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x2cb457);}var _0x28e61a=_0x461610[_0xe2da('0x2f')][_0xe2da('0x31')];var _0x2386b8=_0x461610[_0xe2da('0x2f')][_0xe2da('0x32')];var _0x3649cd=_0x461610[_0xe2da('0x2f')][_0xe2da('0x33')];var _0x3a6f08=_0x461610['body'][_0xe2da('0x34')];return getAgent(_0x28e61a)[_0xe2da('0x20')](function(_0x39dae5){logger['info'](_0xe2da('0x35'),_0x39dae5[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')]('user:%s',_0x39dae5['name']),_0xe2da('0x37'),{'callNumber':_0x2386b8,'callerId':_0x3649cd,'callbackUrl':_0x3a6f08});return _0x499400[_0xe2da('0x1c')](0xc8)['json']({'error':![],'message':_0xe2da('0x38')});})[_0xe2da('0x24')](handleError(_0x499400));};exports[_0xe2da('0x39')]=function(_0x256a0c,_0x3a6ca3){logger['info'](_0xe2da('0x3a'),_0x256a0c['body']);var _0x59489e=hangupValidation[_0xe2da('0xe')](_0x256a0c['body']);if(_0x59489e[_0xe2da('0x2a')]>0x0){return _0x3a6ca3[_0xe2da('0x1c')](0x190)['json'](_0x59489e);}var _0x365968=_0x256a0c[_0xe2da('0x2f')]['userId'];var _0x4e14a6=_0x256a0c['body'][_0xe2da('0x29')];return getAgent(_0x365968)[_0xe2da('0x20')](function(_0x26ba99){logger[_0xe2da('0x14')](_0xe2da('0x35'),_0x26ba99[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')]('user:%s',_0x26ba99[_0xe2da('0x1b')]),_0xe2da('0x3b'),{'sessionId':_0x4e14a6});return _0x3a6ca3[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x3c')});})['catch'](handleError(_0x3a6ca3));};exports[_0xe2da('0x3d')]=function(_0x22d6c2,_0x3da65f){logger['info'](_0xe2da('0x3e'),_0x22d6c2[_0xe2da('0x2f')]);var _0x1529f4=answerValidation[_0xe2da('0xe')](_0x22d6c2[_0xe2da('0x2f')]);if(_0x1529f4[_0xe2da('0x2a')]>0x0){return _0x3da65f[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x1529f4);}var _0x4aec15=_0x22d6c2[_0xe2da('0x2f')][_0xe2da('0x31')];var _0x2113e8=_0x22d6c2[_0xe2da('0x2f')][_0xe2da('0x29')];return getAgent(_0x4aec15)['then'](function(_0x46b7fc){logger[_0xe2da('0x14')](_0xe2da('0x35'),_0x46b7fc[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x46b7fc[_0xe2da('0x1b')]),'webbar:answer',{'sessionId':_0x2113e8});return _0x3da65f[_0xe2da('0x1c')](0xc8)['json']({'error':![],'message':_0xe2da('0x40')});})[_0xe2da('0x24')](handleError(_0x3da65f));};exports[_0xe2da('0x41')]=function(_0x4b569e,_0x2dd7dc){logger[_0xe2da('0x14')]('hold\x20fired:',_0x4b569e[_0xe2da('0x2f')]);var _0x369dea=holdValidation[_0xe2da('0xe')](_0x4b569e['body']);if(_0x369dea[_0xe2da('0x2a')]>0x0){return _0x2dd7dc['status'](0x190)['json'](_0x369dea);}var _0x16a393=_0x4b569e['body'][_0xe2da('0x31')];var _0x422449=_0x4b569e['body'][_0xe2da('0x29')];return getAgent(_0x16a393)[_0xe2da('0x20')](function(_0x482547){logger['info'](_0xe2da('0x35'),_0x482547['name']);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x482547[_0xe2da('0x1b')]),_0xe2da('0x42'),{'sessionId':_0x422449});return _0x2dd7dc[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x43')});})[_0xe2da('0x24')](handleError(_0x2dd7dc));};exports[_0xe2da('0x44')]=function(_0x515f9b,_0x3ce9a8){logger[_0xe2da('0x14')](_0xe2da('0x45'),_0x515f9b['body']);var _0x17b64f=unholdValidation[_0xe2da('0xe')](_0x515f9b[_0xe2da('0x2f')]);if(_0x17b64f[_0xe2da('0x2a')]>0x0){return _0x3ce9a8[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x17b64f);}var _0x246384=_0x515f9b['body']['userId'];var _0x33bf4c=_0x515f9b[_0xe2da('0x2f')][_0xe2da('0x29')];return getAgent(_0x246384)['then'](function(_0x572690){logger[_0xe2da('0x14')]('entityFound:',_0x572690[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x572690[_0xe2da('0x1b')]),_0xe2da('0x46'),{'sessionId':_0x33bf4c});return _0x3ce9a8[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x47')});})[_0xe2da('0x24')](handleError(_0x3ce9a8));};exports['calls']=function(_0x26a9f0,_0x2f763b){logger[_0xe2da('0x14')](_0xe2da('0x48'),_0x2f763b['body']);var _0x25b8a7=callsValidation[_0xe2da('0xe')](_0x26a9f0[_0xe2da('0x2f')]);if(_0x25b8a7['length']>0x0){return _0x2f763b[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x25b8a7);}var _0x3e6e98=_0x26a9f0[_0xe2da('0x2f')][_0xe2da('0x31')];var _0x22a571=respondWithRpcPromise(_0xe2da('0x49'));var _0x377db9=getAgent(_0x3e6e98);return Promise[_0xe2da('0x4a')]([_0x22a571,_0x377db9])[_0xe2da('0x20')](function(_0x154877){var _0x3b4d10=_0x154877[0x0];var _0x505c24=_0x154877[0x1];var _0x2b50cb=_[_0xe2da('0x4b')](_0x3b4d10[_0xe2da('0x27')],function(_0x268052){return _0x268052[_0xe2da('0x28')]==_0x505c24['id'];});return _0x2f763b[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'count':_0x2b50cb['length'],'rows':_0x2b50cb});})[_0xe2da('0x24')](handleError(_0x2f763b));};exports['conference']=function(_0x3abde9,_0x18ff95){logger['info']('conference\x20fired:',_0x3abde9[_0xe2da('0x2f')]);var _0x5651f9=conferenceValidation[_0xe2da('0xe')](_0x3abde9['body']);if(_0x5651f9[_0xe2da('0x2a')]>0x0){return _0x18ff95[_0xe2da('0x1c')](0x190)[_0xe2da('0x30')](_0x5651f9);}var _0x4a2d10=_0x3abde9['body']['userId'];return getAgent(_0x4a2d10)[_0xe2da('0x20')](function(_0x1fa149){logger[_0xe2da('0x14')](_0xe2da('0x35'),_0x1fa149['name']);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x1fa149[_0xe2da('0x1b')]),_0xe2da('0x4c'));return _0x18ff95[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x4d')});})['catch'](handleError(_0x18ff95));};exports[_0xe2da('0x4e')]=function(_0x4666b3,_0x3f0a4b){logger[_0xe2da('0x14')](_0xe2da('0x4f'),_0x4666b3['body']);var _0x841de3=transferValidation['validate'](_0x4666b3[_0xe2da('0x2f')]);if(_0x841de3['length']>0x0){return _0x3f0a4b[_0xe2da('0x1c')](0x190)['json'](_0x841de3);}var _0x58f9db=_0x4666b3[_0xe2da('0x2f')][_0xe2da('0x31')];var _0x2cff55=_0x4666b3[_0xe2da('0x2f')][_0xe2da('0x29')];var _0x44b96e=_0x4666b3[_0xe2da('0x2f')][_0xe2da('0x50')];return getAgent(_0x58f9db)[_0xe2da('0x20')](function(_0x17af45){logger['info'](_0xe2da('0x35'),_0x17af45[_0xe2da('0x1b')]);emit(util[_0xe2da('0x36')](_0xe2da('0x3f'),_0x17af45['name']),_0xe2da('0x51'),{'sessionId':_0x2cff55,'transferNumber':_0x44b96e});return _0x3f0a4b[_0xe2da('0x1c')](0xc8)[_0xe2da('0x30')]({'error':![],'message':_0xe2da('0x52')});})['catch'](handleError(_0x3f0a4b));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 31d9264..9154fb7 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 _0x0b0e=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAgents','notify','put','update','delete','removeDispositions'];(function(_0x1102f4,_0x57adbb){var _0x11db92=function(_0x1dcf0d){while(--_0x1dcf0d){_0x1102f4['push'](_0x1102f4['shift']());}};_0x11db92(++_0x57adbb);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2cea58,_0x153c15){_0x2cea58=_0x2cea58-0x0;var _0x192933=_0x0b0e[_0x2cea58];return _0x192933;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x9')]('/:id/users',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x11')]);router[_0xe0b0('0x9')](_0xe0b0('0x12'),auth[_0xe0b0('0xa')](),controller['getApplications']);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0x15')]);router['post'](_0xe0b0('0x16'),auth[_0xe0b0('0xa')](),controller['addAnswer']);router[_0xe0b0('0x13')]('/:id/users',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x17')]);router['post']('/:id/applications',auth[_0xe0b0('0xa')](),controller['addApplications']);router['post']('/:id/notify',controller[_0xe0b0('0x18')]);router['post']('/:id/send',auth[_0xe0b0('0xa')](),controller['send']);router[_0xe0b0('0x19')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1a')]);router[_0xe0b0('0x1b')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['destroy']);router['delete'](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0x1c')]);router[_0xe0b0('0x1b')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller['removeAnswers']);router[_0xe0b0('0x1b')]('/:id/users',auth[_0xe0b0('0xa')](),controller['removeAgents']);module[_0xe0b0('0x1d')]=router; \ No newline at end of file +var _0x01d9=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x4f1e96,_0x3bd758){var _0x974e38=function(_0x470d29){while(--_0x470d29){_0x4f1e96['push'](_0x4f1e96['shift']());}};_0x974e38(++_0x3bd758);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['get'](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x18')]);router[_0x901d('0x19')]('/',auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router['post'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x1b')]);router[_0x901d('0x19')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x19')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1d')]);router[_0x901d('0x19')](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x19')](_0x901d('0x1f'),controller[_0x901d('0x20')]);router['post'](_0x901d('0x21'),auth[_0x901d('0xd')](),controller['send']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x901d('0x22')]);router[_0x901d('0x23')]('/:id',auth[_0x901d('0xd')](),controller[_0x901d('0x24')]);router['delete'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x25')]);router[_0x901d('0x23')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x26')]);router[_0x901d('0x23')]('/:id/users',auth[_0x901d('0xd')](),controller[_0x901d('0x27')]);module[_0x901d('0x28')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index e47470d..4c38b27 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 _0x6b29=['name','STRING','generate','ENUM','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x3e618a,_0x135251){var _0x1f3d61=function(_0x12131b){while(--_0x12131b){_0x3e618a['push'](_0x3e618a['shift']());}};_0x1f3d61(++_0x135251);}(_0x6b29,0xf5));var _0x96b2=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x6b29[_0x6eb833];return _0xdfc38c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x96b2('0x0'));module[_0x96b2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x96b2('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x96b2('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x96b2('0x4')]();}},'phone':{'type':Sequelize[_0x96b2('0x3')]},'type':{'type':Sequelize[_0x96b2('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0x96b2('0x3')]},'authToken':{'type':Sequelize[_0x96b2('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x96b2('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x96b2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x96b2('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x96b2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x96b2('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x96b2('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x96b2('0x7')],'comment':_0x96b2('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x96b2('0x6')],'defaultValue':![],'comment':_0x96b2('0x9'),'set':function(_0x20c107){if(!_0x20c107){this[_0x96b2('0xa')](_0x96b2('0xb'),null);}this[_0x96b2('0xa')](_0x96b2('0xc'),_0x20c107);}},'description':{'type':Sequelize[_0x96b2('0x3')]}}; \ No newline at end of file +var _0x4006=['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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x4e61dd,_0x1f5e66){var _0x11597d=function(_0x454de8){while(--_0x454de8){_0x4e61dd['push'](_0x4e61dd['shift']());}};_0x11597d(++_0x1f5e66);}(_0x4006,0x1c7));var _0x6400=function(_0xb3bf0f,_0x418c05){_0xb3bf0f=_0xb3bf0f-0x0;var _0x196b2a=_0x4006[_0xb3bf0f];return _0x196b2a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6400('0x0'));module[_0x6400('0x1')]={'name':{'type':Sequelize[_0x6400('0x2')],'unique':_0x6400('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x6400('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x6400('0x2')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0x6400('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6400('0x4')],'defaultValue':function(){return _0x6400('0x5');}},'notificationSound':{'type':Sequelize[_0x6400('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6400('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6400('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6400('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6400('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6400('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6400('0x7')],'comment':_0x6400('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6400('0x6')],'defaultValue':![],'comment':_0x6400('0x9'),'set':function(_0x237e22){if(!_0x237e22){this[_0x6400('0xa')](_0x6400('0xb'),null);}this['setDataValue'](_0x6400('0xc'),_0x237e22);}},'description':{'type':Sequelize[_0x6400('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 73a3edc..305746b 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 _0x046b=['orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','twilio','replace','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','ListId','Contacts','DESC','list','create','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','send','\x0a','CmList','List','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','get','WhatsappAccounts','UserProfileResource','end','stack','name','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappAccount','includeAll','include','rows','catch','show','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','destroy','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','account'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x046b,0x1ba));var _0xb046=function(_0x4e5564,_0x8c8c66){_0x4e5564=_0x4e5564-0x0;var _0x5ed04b=_0x046b[_0x4e5564];return _0x5ed04b;};'use strict';var emlformat=require(_0xb046('0x0'));var rimraf=require(_0xb046('0x1'));var zipdir=require(_0xb046('0x2'));var jsonpatch=require(_0xb046('0x3'));var rp=require('request-promise');var moment=require(_0xb046('0x4'));var BPromise=require(_0xb046('0x5'));var Mustache=require('mustache');var util=require(_0xb046('0x6'));var path=require(_0xb046('0x7'));var sox=require(_0xb046('0x8'));var csv=require(_0xb046('0x9'));var ejs=require(_0xb046('0xa'));var fs=require('fs');var fs_extra=require(_0xb046('0xb'));var _=require(_0xb046('0xc'));var squel=require(_0xb046('0xd'));var crypto=require(_0xb046('0xe'));var jsforce=require(_0xb046('0xf'));var deskjs=require(_0xb046('0x10'));var toCsv=require(_0xb046('0x9'));var querystring=require(_0xb046('0x11'));var Papa=require('papaparse');var Redis=require(_0xb046('0x12'));var authService=require(_0xb046('0x13'));var qs=require(_0xb046('0x14'));var as=require(_0xb046('0x15'));var hardwareService=require(_0xb046('0x16'));var logger=require('../../config/logger')(_0xb046('0x17'));var utils=require(_0xb046('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb046('0x19'))['db'];config[_0xb046('0x1a')]=_[_0xb046('0x1b')](config[_0xb046('0x1a')],{'host':_0xb046('0x1c'),'port':0x18eb});var socket=require(_0xb046('0x1d'))(new Redis(config[_0xb046('0x1a')]));require(_0xb046('0x1e'))[_0xb046('0x1f')](socket);var jayson=require(_0xb046('0x20'));var client=jayson['client'][_0xb046('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x3a8109,_0x4fd90c,_0x2b0d1e,_0x5e54c6){return new BPromise(function(_0x3880da,_0xe9da83){var _0x3199b8=_0x5e54c6||client;return _0x3199b8[_0xb046('0x22')](_0x3a8109,_0x2b0d1e)[_0xb046('0x23')](function(_0x4108e3){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4fd90c,_0xb046('0x24'));logger[_0xb046('0x25')](_0xb046('0x26'),_0x4fd90c,'request\x20sent',JSON['stringify'](_0x4108e3));if(_0x4108e3[_0xb046('0x27')]){if(_0x4108e3['error'][_0xb046('0x28')]===0x1f4){logger['error'](_0xb046('0x29'),_0x4fd90c,_0x4108e3[_0xb046('0x27')][_0xb046('0x2a')]);return _0xe9da83(_0x4108e3[_0xb046('0x27')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4fd90c,_0x4108e3[_0xb046('0x27')][_0xb046('0x2a')]);return _0x3880da(_0x4108e3[_0xb046('0x27')][_0xb046('0x2a')]);}else{logger[_0xb046('0x2b')](_0xb046('0x29'),_0x4fd90c,'request\x20sent');_0x3880da(_0x4108e3[_0xb046('0x2c')]['message']);}})['catch'](function(_0x41841e){logger[_0xb046('0x27')](_0xb046('0x29'),_0x4fd90c,_0x41841e);_0xe9da83(_0x41841e);});});}function respondWithStatusCode(_0x3779ae,_0xf1d1bd){_0xf1d1bd=_0xf1d1bd||0xcc;return function(_0x2e6c07){if(_0x2e6c07){return _0x3779ae[_0xb046('0x2d')](_0xf1d1bd);}return _0x3779ae[_0xb046('0x2e')](_0xf1d1bd)['end']();};}function respondWithResult(_0x5820f7,_0x1f8522){_0x1f8522=_0x1f8522||0xc8;return function(_0x4e35d0){if(_0x4e35d0){return _0x5820f7[_0xb046('0x2e')](_0x1f8522)[_0xb046('0x2f')](_0x4e35d0);}};}function respondWithFilteredResult(_0x114f08,_0x3db057){return function(_0x1f7306){if(_0x1f7306){var _0x39f817=typeof _0x3db057[_0xb046('0x30')]===_0xb046('0x31')&&typeof _0x3db057[_0xb046('0x32')]===_0xb046('0x31');var _0x3715ce=_0x1f7306[_0xb046('0x33')];var _0xb4b4e9=_0x39f817?0x0:_0x3db057['offset'];var _0x28b3fb=_0x39f817?_0x1f7306['count']:_0x3db057[_0xb046('0x30')]+_0x3db057[_0xb046('0x32')];var _0x28dee6;if(_0x28b3fb>=_0x3715ce){_0x28b3fb=_0x3715ce;_0x28dee6=0xc8;}else{_0x28dee6=0xce;}_0x114f08[_0xb046('0x2e')](_0x28dee6);return _0x114f08[_0xb046('0x34')]('Content-Range',_0xb4b4e9+'-'+_0x28b3fb+'/'+_0x3715ce)['json'](_0x1f7306);}return null;};}function patchUpdates(_0x46074c){return function(_0x26fdfc){try{jsonpatch[_0xb046('0x35')](_0x26fdfc,_0x46074c,!![]);}catch(_0x2feb4d){return BPromise['reject'](_0x2feb4d);}return _0x26fdfc[_0xb046('0x36')]();};}function saveUpdates(_0x478460,_0x46aac4){return function(_0x5c6870){if(_0x5c6870){return _0x5c6870[_0xb046('0x37')](_0x478460)[_0xb046('0x23')](function(_0x14ee5c){return _0x14ee5c;});}return null;};}function removeEntity(_0x293b56,_0x297e9e){return function(_0x2028d3){if(_0x2028d3){return _0x2028d3['destroy']()['then'](function(){var _0x2ffe51=_0x2028d3[_0xb046('0x38')]({'plain':!![]});var _0x2f5ef0=_0xb046('0x39');return db[_0xb046('0x3a')]['destroy']({'where':{'type':_0x2f5ef0,'resourceId':_0x2ffe51['id']}})[_0xb046('0x23')](function(){return _0x2028d3;});})['then'](function(){_0x293b56[_0xb046('0x2e')](0xcc)[_0xb046('0x3b')]();});}};}function handleEntityNotFound(_0x42976c,_0x271c14){return function(_0x3a6f1e){if(!_0x3a6f1e){_0x42976c[_0xb046('0x2d')](0x194);}return _0x3a6f1e;};}function handleError(_0x11f990,_0x9eb303){_0x9eb303=_0x9eb303||0x1f4;return function(_0x589cfb){logger[_0xb046('0x27')](_0x589cfb[_0xb046('0x3c')]);if(_0x589cfb[_0xb046('0x3d')]){delete _0x589cfb['name'];}_0x11f990['status'](_0x9eb303)['send'](_0x589cfb);};}exports['index']=function(_0x3a72c5,_0x153ad5){var _0x4c3329={'include':[{'model':db[_0xb046('0x3e')],'as':_0xb046('0x3f')}]},_0x39dab1={},_0x35d685={'count':0x0,'rows':[]};var _0x4efbf1=_[_0xb046('0x40')](db['WhatsappAccount'][_0xb046('0x41')],function(_0x11f1e1){return{'name':_0x11f1e1[_0xb046('0x42')],'type':_0x11f1e1[_0xb046('0x43')][_0xb046('0x44')]};});_0x39dab1[_0xb046('0x45')]=_[_0xb046('0x40')](_0x4efbf1,_0xb046('0x3d'));_0x39dab1[_0xb046('0x46')]=_[_0xb046('0x47')](_0x3a72c5[_0xb046('0x46')]);_0x39dab1[_0xb046('0x48')]=_[_0xb046('0x49')](_0x39dab1[_0xb046('0x45')],_0x39dab1['query']);_0x4c3329[_0xb046('0x4a')]=_[_0xb046('0x49')](_0x39dab1[_0xb046('0x45')],qs[_0xb046('0x4b')](_0x3a72c5[_0xb046('0x46')][_0xb046('0x4b')]));_0x4c3329['attributes']=_0x4c3329['attributes'][_0xb046('0x4c')]?_0x4c3329[_0xb046('0x4a')]:_0x39dab1[_0xb046('0x45')];if(!_0x3a72c5[_0xb046('0x46')][_0xb046('0x4d')](_0xb046('0x4e'))){_0x4c3329[_0xb046('0x32')]=qs['limit'](_0x3a72c5[_0xb046('0x46')][_0xb046('0x32')]);_0x4c3329['offset']=qs[_0xb046('0x30')](_0x3a72c5[_0xb046('0x46')]['offset']);}_0x4c3329[_0xb046('0x4f')]=qs['sort'](_0x3a72c5[_0xb046('0x46')][_0xb046('0x50')]);_0x4c3329[_0xb046('0x51')]=qs['filters'](_[_0xb046('0x52')](_0x3a72c5[_0xb046('0x46')],_0x39dab1[_0xb046('0x48')]),_0x4efbf1);if(_0x3a72c5[_0xb046('0x46')][_0xb046('0x53')]){_0x4c3329['where']=_['merge'](_0x4c3329['where'],{'$or':_[_0xb046('0x40')](_0x4efbf1,function(_0x7004b4){if(_0x7004b4[_0xb046('0x43')]!==_0xb046('0x54')){var _0x144e13={};_0x144e13[_0x7004b4[_0xb046('0x3d')]]={'$like':'%'+_0x3a72c5['query'][_0xb046('0x53')]+'%'};return _0x144e13;}})});}_0x4c3329=_[_0xb046('0x55')]({},_0x4c3329,_0x3a72c5[_0xb046('0x56')]);var _0x1baf61={'where':_0x4c3329[_0xb046('0x51')]};return db[_0xb046('0x57')][_0xb046('0x33')](_0x1baf61)[_0xb046('0x23')](function(_0x5910b5){_0x35d685[_0xb046('0x33')]=_0x5910b5;if(_0x3a72c5[_0xb046('0x46')][_0xb046('0x58')]){_0x4c3329[_0xb046('0x59')]=[{'all':!![]}];}return db[_0xb046('0x57')]['findAll'](_0x4c3329);})[_0xb046('0x23')](function(_0x597ab4){_0x35d685[_0xb046('0x5a')]=_0x597ab4;return _0x35d685;})[_0xb046('0x23')](respondWithFilteredResult(_0x153ad5,_0x4c3329))[_0xb046('0x5b')](handleError(_0x153ad5,null));};exports[_0xb046('0x5c')]=function(_0x51654b,_0x449646){var _0x3a237c={'raw':![],'where':{'id':_0x51654b['params']['id']},'include':[{'model':db[_0xb046('0x3e')],'as':_0xb046('0x3f')}]},_0x169a78={};_0x169a78[_0xb046('0x45')]=_[_0xb046('0x47')](db[_0xb046('0x57')][_0xb046('0x41')]);_0x169a78[_0xb046('0x46')]=_['keys'](_0x51654b[_0xb046('0x46')]);_0x169a78['filters']=_[_0xb046('0x49')](_0x169a78[_0xb046('0x45')],_0x169a78['query']);_0x3a237c['attributes']=_[_0xb046('0x49')](_0x169a78[_0xb046('0x45')],qs[_0xb046('0x4b')](_0x51654b['query'][_0xb046('0x4b')]));_0x3a237c['attributes']=_0x3a237c[_0xb046('0x4a')][_0xb046('0x4c')]?_0x3a237c['attributes']:_0x169a78[_0xb046('0x45')];if(_0x51654b[_0xb046('0x46')][_0xb046('0x58')]){_0x3a237c['include']=[{'all':!![]}];}_0x3a237c=_[_0xb046('0x55')]({},_0x3a237c,_0x51654b[_0xb046('0x56')]);return db['WhatsappAccount'][_0xb046('0x5d')](_0x3a237c)[_0xb046('0x23')](handleEntityNotFound(_0x449646,null))[_0xb046('0x23')](respondWithResult(_0x449646,null))[_0xb046('0x5b')](handleError(_0x449646,null));};exports['create']=function(_0x5e64e5,_0x309f4d){return db[_0xb046('0x57')]['create'](_0x5e64e5[_0xb046('0x5e')],{})[_0xb046('0x23')](function(_0x2c609d){var _0x52f33c=_0x5e64e5['user'][_0xb046('0x38')]({'plain':!![]});if(!_0x52f33c)throw new Error(_0xb046('0x5f'));if(_0x52f33c[_0xb046('0x60')]===_0xb046('0x61')){var _0x2b4831=_0x2c609d[_0xb046('0x38')]({'plain':!![]});var _0x13e018=_0xb046('0x39');return db[_0xb046('0x62')][_0xb046('0x5d')]({'where':{'name':_0x13e018,'userProfileId':_0x52f33c[_0xb046('0x63')]},'raw':!![]})[_0xb046('0x23')](function(_0x123ca2){if(_0x123ca2&&_0x123ca2[_0xb046('0x64')]===0x0){return db[_0xb046('0x3a')]['create']({'name':_0x2b4831['name'],'resourceId':_0x2b4831['id'],'type':_0x123ca2[_0xb046('0x3d')],'sectionId':_0x123ca2['id']},{})['then'](function(){return _0x2c609d;});}else{return _0x2c609d;}})['catch'](function(_0x43ae8c){logger[_0xb046('0x27')](_0xb046('0x65'),_0x43ae8c);throw _0x43ae8c;});}return _0x2c609d;})[_0xb046('0x23')](respondWithResult(_0x309f4d,0xc9))[_0xb046('0x5b')](handleError(_0x309f4d,null));};exports[_0xb046('0x37')]=function(_0x21735d,_0x1386a8){if(_0x21735d[_0xb046('0x5e')]['id']){delete _0x21735d[_0xb046('0x5e')]['id'];}return db[_0xb046('0x57')]['find']({'where':{'id':_0x21735d[_0xb046('0x66')]['id']},'include':[{'model':db[_0xb046('0x3e')],'as':_0xb046('0x3f')}]})[_0xb046('0x23')](handleEntityNotFound(_0x1386a8,null))[_0xb046('0x23')](saveUpdates(_0x21735d[_0xb046('0x5e')],null))[_0xb046('0x23')](respondWithResult(_0x1386a8,null))['catch'](handleError(_0x1386a8,null));};exports['destroy']=function(_0x59f401,_0x555b8a){return db[_0xb046('0x57')][_0xb046('0x5d')]({'where':{'id':_0x59f401[_0xb046('0x66')]['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x555b8a,null))['then'](removeEntity(_0x555b8a,null))[_0xb046('0x5b')](handleError(_0x555b8a,null));};exports[_0xb046('0x67')]=function(_0x52b855,_0x205277){return db[_0xb046('0x57')][_0xb046('0x67')]()[_0xb046('0x23')](respondWithResult(_0x205277,null))[_0xb046('0x5b')](handleError(_0x205277,null));};exports[_0xb046('0x68')]=function(_0x559c50,_0x3543df,_0x568554){if(_0x559c50[_0xb046('0x5e')]['id']){delete _0x559c50[_0xb046('0x5e')]['id'];}return db[_0xb046('0x57')][_0xb046('0x5d')]({'where':{'id':_0x559c50[_0xb046('0x66')]['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x3543df,null))[_0xb046('0x23')](function(_0x2d5213){if(_0x2d5213){_0x559c50[_0xb046('0x5e')][_0xb046('0x69')]=_0x2d5213['id'];return db[_0xb046('0x6a')]['create'](_0x559c50[_0xb046('0x5e')]);}})[_0xb046('0x23')](respondWithResult(_0x3543df,null))[_0xb046('0x5b')](handleError(_0x3543df,null));};exports[_0xb046('0x6b')]=function(_0x69db65,_0x329a35,_0x237e93){var _0x37e18b={'raw':![],'where':{}};var _0x144b24={};var _0x2e9557={'count':0x0,'rows':[]};return db[_0xb046('0x57')][_0xb046('0x6c')]({'where':{'id':_0x69db65['params']['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x329a35,null))[_0xb046('0x23')](function(_0x5c9d01){if(_0x5c9d01){_0x144b24['model']=_[_0xb046('0x47')](db[_0xb046('0x6a')]['rawAttributes']);_0x144b24[_0xb046('0x46')]=_[_0xb046('0x47')](_0x69db65[_0xb046('0x46')]);_0x144b24['filters']=_[_0xb046('0x49')](_0x144b24['model'],_0x144b24[_0xb046('0x46')]);_0x37e18b[_0xb046('0x4a')]=_['intersection'](_0x144b24[_0xb046('0x45')],qs['fields'](_0x69db65['query'][_0xb046('0x4b')]));_0x37e18b[_0xb046('0x4a')]=_0x37e18b[_0xb046('0x4a')]['length']?_0x37e18b['attributes']:_0x144b24[_0xb046('0x45')];if(!_0x69db65[_0xb046('0x46')][_0xb046('0x4d')](_0xb046('0x4e'))){_0x37e18b[_0xb046('0x32')]=qs[_0xb046('0x32')](_0x69db65[_0xb046('0x46')][_0xb046('0x32')]);_0x37e18b[_0xb046('0x30')]=qs[_0xb046('0x30')](_0x69db65[_0xb046('0x46')][_0xb046('0x30')]);}_0x37e18b[_0xb046('0x4f')]=qs['sort'](_0x69db65[_0xb046('0x46')][_0xb046('0x50')]);_0x37e18b[_0xb046('0x51')]=qs[_0xb046('0x48')](_[_0xb046('0x52')](_0x69db65[_0xb046('0x46')],_0x144b24[_0xb046('0x48')]));_0x37e18b[_0xb046('0x51')][_0xb046('0x69')]=_0x5c9d01['id'];if(_0x69db65[_0xb046('0x46')][_0xb046('0x53')]){_0x37e18b[_0xb046('0x51')]=_['merge'](_0x37e18b[_0xb046('0x51')],{'$or':_['map'](_0x37e18b[_0xb046('0x4a')],function(_0xb9576d){var _0x30dbe9={};_0x30dbe9[_0xb9576d]={'$like':'%'+_0x69db65[_0xb046('0x46')][_0xb046('0x53')]+'%'};return _0x30dbe9;})});}_0x37e18b=_['merge']({},_0x37e18b,_0x69db65[_0xb046('0x56')]);return db[_0xb046('0x6a')][_0xb046('0x33')]({'where':_0x37e18b[_0xb046('0x51')]})[_0xb046('0x23')](function(_0x17f1b4){_0x2e9557[_0xb046('0x33')]=_0x17f1b4;if(_0x69db65[_0xb046('0x46')]['includeAll']){_0x37e18b[_0xb046('0x59')]=[{'all':!![]}];}return db[_0xb046('0x6a')]['findAll'](_0x37e18b);})[_0xb046('0x23')](function(_0x2a6d53){_0x2e9557[_0xb046('0x5a')]=_0x2a6d53;return _0x2e9557;});}})[_0xb046('0x23')](respondWithFilteredResult(_0x329a35,_0x37e18b))[_0xb046('0x5b')](handleError(_0x329a35,null));};exports[_0xb046('0x6d')]=function(_0x4fb0eb,_0x5e32dd,_0x165aa9){return db['WhatsappAccount']['find']({'where':{'id':_0x4fb0eb[_0xb046('0x66')]['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x5e32dd,null))['then'](function(_0x4278a3){if(_0x4278a3){return _0x4278a3[_0xb046('0x6d')](_0x4fb0eb[_0xb046('0x46')][_0xb046('0x6e')]);}})['then'](respondWithStatusCode(_0x5e32dd,null))[_0xb046('0x5b')](handleError(_0x5e32dd,null));};exports[_0xb046('0x6f')]=function(_0x4037ad,_0x3b02d7,_0xe77a4e){if(_0x4037ad['body']['id']){delete _0x4037ad[_0xb046('0x5e')]['id'];}return db[_0xb046('0x57')][_0xb046('0x5d')]({'where':{'id':_0x4037ad[_0xb046('0x66')]['id']}})['then'](handleEntityNotFound(_0x3b02d7,null))['then'](function(_0x314ffb){if(_0x314ffb){_0x4037ad[_0xb046('0x5e')][_0xb046('0x69')]=_0x314ffb['id'];return db['CannedAnswer']['create'](_0x4037ad[_0xb046('0x5e')]);}})[_0xb046('0x23')](respondWithResult(_0x3b02d7,null))[_0xb046('0x5b')](handleError(_0x3b02d7,null));};exports[_0xb046('0x70')]=function(_0x3fa064,_0xd7684a,_0x38f6e5){var _0x1e3d48={'raw':![],'where':{}};var _0x4b6dfc={};var _0x17ea69={'count':0x0,'rows':[]};return db[_0xb046('0x57')]['findOne']({'where':{'id':_0x3fa064['params']['id']}})[_0xb046('0x23')](handleEntityNotFound(_0xd7684a,null))['then'](function(_0x2d1065){if(_0x2d1065){_0x4b6dfc[_0xb046('0x45')]=_[_0xb046('0x47')](db[_0xb046('0x71')][_0xb046('0x41')]);_0x4b6dfc[_0xb046('0x46')]=_[_0xb046('0x47')](_0x3fa064[_0xb046('0x46')]);_0x4b6dfc[_0xb046('0x48')]=_[_0xb046('0x49')](_0x4b6dfc['model'],_0x4b6dfc[_0xb046('0x46')]);_0x1e3d48['attributes']=_['intersection'](_0x4b6dfc[_0xb046('0x45')],qs[_0xb046('0x4b')](_0x3fa064['query'][_0xb046('0x4b')]));_0x1e3d48[_0xb046('0x4a')]=_0x1e3d48[_0xb046('0x4a')][_0xb046('0x4c')]?_0x1e3d48[_0xb046('0x4a')]:_0x4b6dfc['model'];if(!_0x3fa064[_0xb046('0x46')][_0xb046('0x4d')](_0xb046('0x4e'))){_0x1e3d48['limit']=qs[_0xb046('0x32')](_0x3fa064['query']['limit']);_0x1e3d48[_0xb046('0x30')]=qs[_0xb046('0x30')](_0x3fa064[_0xb046('0x46')][_0xb046('0x30')]);}_0x1e3d48[_0xb046('0x4f')]=qs[_0xb046('0x50')](_0x3fa064[_0xb046('0x46')][_0xb046('0x50')]);_0x1e3d48['where']=qs[_0xb046('0x48')](_[_0xb046('0x52')](_0x3fa064['query'],_0x4b6dfc[_0xb046('0x48')]));_0x1e3d48[_0xb046('0x51')][_0xb046('0x69')]=_0x2d1065['id'];if(_0x3fa064['query']['filter']){_0x1e3d48[_0xb046('0x51')]=_['merge'](_0x1e3d48['where'],{'$or':_[_0xb046('0x40')](_0x1e3d48[_0xb046('0x4a')],function(_0x4f8ced){var _0x3d6065={};_0x3d6065[_0x4f8ced]={'$like':'%'+_0x3fa064[_0xb046('0x46')][_0xb046('0x53')]+'%'};return _0x3d6065;})});}_0x1e3d48=_['merge']({},_0x1e3d48,_0x3fa064[_0xb046('0x56')]);return db['CannedAnswer'][_0xb046('0x33')]({'where':_0x1e3d48[_0xb046('0x51')]})[_0xb046('0x23')](function(_0x3bc83e){_0x17ea69['count']=_0x3bc83e;if(_0x3fa064['query'][_0xb046('0x58')]){_0x1e3d48[_0xb046('0x59')]=[{'all':!![]}];}return db[_0xb046('0x71')][_0xb046('0x72')](_0x1e3d48);})[_0xb046('0x23')](function(_0x46394a){_0x17ea69[_0xb046('0x5a')]=_0x46394a;return _0x17ea69;});}})[_0xb046('0x23')](respondWithFilteredResult(_0xd7684a,_0x1e3d48))[_0xb046('0x5b')](handleError(_0xd7684a,null));};exports[_0xb046('0x73')]=function(_0xb912ee,_0x2d5781,_0x251b63){return db[_0xb046('0x57')][_0xb046('0x5d')]({'where':{'id':_0xb912ee['params']['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x2d5781,null))[_0xb046('0x23')](function(_0x9b586a){if(_0x9b586a){return _0x9b586a[_0xb046('0x73')](_0xb912ee[_0xb046('0x46')]['ids']);}})[_0xb046('0x23')](respondWithStatusCode(_0x2d5781,null))['catch'](handleError(_0x2d5781,null));};exports[_0xb046('0x74')]=function(_0x7092b8,_0x54704d,_0x4e7eb4){return db['WhatsappAccount'][_0xb046('0x5d')]({'where':{'id':_0x7092b8[_0xb046('0x66')]['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x54704d,null))[_0xb046('0x23')](function(_0x268698){if(_0x268698){return _0x268698[_0xb046('0x74')](_0x7092b8[_0xb046('0x5e')][_0xb046('0x6e')],_[_0xb046('0x75')](_0x7092b8[_0xb046('0x5e')],[_0xb046('0x6e'),'id'])||{})[_0xb046('0x76')](function(_0x53f15f){for(var _0x3d274f=0x0;_0x3d274f<_0x7092b8[_0xb046('0x5e')][_0xb046('0x6e')]['length'];_0x3d274f+=0x1){socket['emit'](_0xb046('0x77'),{'UserId':Number(_0x7092b8[_0xb046('0x5e')][_0xb046('0x6e')][_0x3d274f]),'WhatsappAccountId':Number(_0x7092b8[_0xb046('0x66')]['id'])});}return _0x53f15f;});}})['then'](respondWithResult(_0x54704d,null))[_0xb046('0x5b')](handleError(_0x54704d,null));};exports[_0xb046('0x78')]=function(_0x239f2,_0x353ae1,_0xc87ed6){return db[_0xb046('0x57')][_0xb046('0x5d')]({'where':{'id':_0x239f2[_0xb046('0x66')]['id']}})['then'](handleEntityNotFound(_0x353ae1,null))[_0xb046('0x23')](function(_0x5171f1){if(_0x5171f1){return _0x5171f1[_0xb046('0x78')](_0x239f2[_0xb046('0x46')][_0xb046('0x6e')])['then'](function(){if(_[_0xb046('0x79')](_0x239f2[_0xb046('0x46')][_0xb046('0x6e')])){for(var _0x3d00b2=0x0;_0x3d00b2<_0x239f2[_0xb046('0x46')][_0xb046('0x6e')][_0xb046('0x4c')];_0x3d00b2+=0x1){socket[_0xb046('0x7a')](_0xb046('0x7b'),{'UserId':Number(_0x239f2[_0xb046('0x46')][_0xb046('0x6e')][_0x3d00b2]),'WhatsappAccountId':Number(_0x239f2['params']['id'])});}}else{socket['emit'](_0xb046('0x7b'),{'UserId':Number(_0x239f2[_0xb046('0x46')]['ids']),'WhatsappAccountId':Number(_0x239f2[_0xb046('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x353ae1,null))[_0xb046('0x5b')](handleError(_0x353ae1,null));};exports[_0xb046('0x7c')]=function(_0x28b11f,_0xcd490b,_0x35dbc8){var _0x1f2bd8={};var _0x3298dc={};var _0x5a8442;var _0x77a9ed;return db['WhatsappAccount'][_0xb046('0x6c')]({'where':{'id':_0x28b11f[_0xb046('0x66')]['id']}})[_0xb046('0x23')](handleEntityNotFound(_0xcd490b,null))[_0xb046('0x23')](function(_0x2ca20b){if(_0x2ca20b){_0x5a8442=_0x2ca20b;_0x3298dc[_0xb046('0x45')]=_[_0xb046('0x47')](db[_0xb046('0x7d')][_0xb046('0x41')]);_0x3298dc[_0xb046('0x46')]=_['keys'](_0x28b11f['query']);_0x3298dc[_0xb046('0x48')]=_[_0xb046('0x49')](_0x3298dc[_0xb046('0x45')],_0x3298dc[_0xb046('0x46')]);_0x1f2bd8[_0xb046('0x4a')]=_[_0xb046('0x49')](_0x3298dc[_0xb046('0x45')],qs[_0xb046('0x4b')](_0x28b11f[_0xb046('0x46')][_0xb046('0x4b')]));_0x1f2bd8['attributes']=_0x1f2bd8[_0xb046('0x4a')][_0xb046('0x4c')]?_0x1f2bd8['attributes']:_0x3298dc[_0xb046('0x45')];_0x1f2bd8[_0xb046('0x4f')]=qs[_0xb046('0x50')](_0x28b11f[_0xb046('0x46')]['sort']);_0x1f2bd8[_0xb046('0x51')]=qs['filters'](_[_0xb046('0x52')](_0x28b11f['query'],_0x3298dc[_0xb046('0x48')]));if(_0x28b11f[_0xb046('0x46')][_0xb046('0x53')]){_0x1f2bd8[_0xb046('0x51')]=_[_0xb046('0x55')](_0x1f2bd8[_0xb046('0x51')],{'$or':_[_0xb046('0x40')](_0x1f2bd8['attributes'],function(_0x5dde75){var _0x14e024={};_0x14e024[_0x5dde75]={'$like':'%'+_0x28b11f[_0xb046('0x46')][_0xb046('0x53')]+'%'};return _0x14e024;})});}_0x1f2bd8=_[_0xb046('0x55')]({},_0x1f2bd8,_0x28b11f[_0xb046('0x56')]);return _0x5a8442[_0xb046('0x7c')](_0x1f2bd8);}})['then'](function(_0x595354){if(_0x595354){_0x77a9ed=_0x595354[_0xb046('0x4c')];if(!_0x28b11f[_0xb046('0x46')][_0xb046('0x4d')](_0xb046('0x4e'))){_0x1f2bd8['limit']=qs[_0xb046('0x32')](_0x28b11f[_0xb046('0x46')][_0xb046('0x32')]);_0x1f2bd8[_0xb046('0x30')]=qs[_0xb046('0x30')](_0x28b11f[_0xb046('0x46')][_0xb046('0x30')]);}return _0x5a8442[_0xb046('0x7c')](_0x1f2bd8);}})[_0xb046('0x23')](function(_0x3d783a){if(_0x3d783a){return _0x3d783a?{'count':_0x77a9ed,'rows':_0x3d783a}:null;}})[_0xb046('0x23')](respondWithResult(_0xcd490b,null))['catch'](handleError(_0xcd490b,null));};exports[_0xb046('0x7e')]=function(_0x270224,_0x3f1213,_0x1b6418){return db[_0xb046('0x57')][_0xb046('0x6c')]({'where':{'id':_0x270224[_0xb046('0x66')]['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x3f1213,null))[_0xb046('0x23')](function(_0x423547){if(_0x423547){return db[_0xb046('0x7f')][_0xb046('0x80')](function(_0x51adbe){return db[_0xb046('0x81')][_0xb046('0x82')]({'where':{'WhatsappAccountId':_0x270224[_0xb046('0x66')]['id']},'transaction':_0x51adbe})[_0xb046('0x23')](function(_0x501dda){var _0x4fb692=_[_0xb046('0x40')](_0x270224[_0xb046('0x5e')],function(_0x3484f7){_0x3484f7[_0xb046('0x69')]=_0x270224[_0xb046('0x66')]['id'];return _0x3484f7;});return db[_0xb046('0x81')][_0xb046('0x83')](_0x4fb692,{'transaction':_0x51adbe});});})['then'](function(){return db[_0xb046('0x81')][_0xb046('0x84')]({'where':{'WhatsappAccountId':_0x270224['params']['id']},'order':_0xb046('0x85')});});}})['then'](respondWithResult(_0x3f1213,null))['catch'](handleError(_0x3f1213,null));};exports[_0xb046('0x86')]=function(_0x362878,_0x1c1443,_0x3229fe){var _0x1f4957={};var _0x2af316={};var _0x5421a7;var _0x1ef9db;return db[_0xb046('0x57')][_0xb046('0x6c')]({'where':{'id':_0x362878[_0xb046('0x66')]['id']}})[_0xb046('0x23')](handleEntityNotFound(_0x1c1443,null))[_0xb046('0x23')](function(_0x116763){if(_0x116763){_0x5421a7=_0x116763;_0x2af316['model']=_[_0xb046('0x47')](db[_0xb046('0x81')]['rawAttributes']);_0x2af316[_0xb046('0x46')]=_['keys'](_0x362878['query']);_0x2af316[_0xb046('0x48')]=_[_0xb046('0x49')](_0x2af316[_0xb046('0x45')],_0x2af316[_0xb046('0x46')]);_0x1f4957[_0xb046('0x4a')]=_[_0xb046('0x49')](_0x2af316[_0xb046('0x45')],qs[_0xb046('0x4b')](_0x362878['query'][_0xb046('0x4b')]));_0x1f4957[_0xb046('0x4a')]=_0x1f4957[_0xb046('0x4a')]['length']?_0x1f4957[_0xb046('0x4a')]:_0x2af316['model'];_0x1f4957['order']=qs[_0xb046('0x50')](_0x362878[_0xb046('0x46')][_0xb046('0x50')]);_0x1f4957[_0xb046('0x51')]=qs['filters'](_['pick'](_0x362878['query'],_0x2af316[_0xb046('0x48')]));if(_0x362878[_0xb046('0x46')]['filter']){_0x1f4957[_0xb046('0x51')]=_['merge'](_0x1f4957[_0xb046('0x51')],{'$or':_[_0xb046('0x40')](_0x1f4957[_0xb046('0x4a')],function(_0x18fb7a){var _0x21570c={};_0x21570c[_0x18fb7a]={'$like':'%'+_0x362878[_0xb046('0x46')][_0xb046('0x53')]+'%'};return _0x21570c;})});}_0x1f4957=_[_0xb046('0x55')]({},_0x1f4957,_0x362878[_0xb046('0x56')]);return _0x5421a7[_0xb046('0x86')](_0x1f4957);}})[_0xb046('0x23')](function(_0x20f2f9){if(_0x20f2f9){_0x1ef9db=_0x20f2f9['length'];if(!_0x362878['query'][_0xb046('0x4d')](_0xb046('0x4e'))){_0x1f4957['limit']=qs[_0xb046('0x32')](_0x362878[_0xb046('0x46')][_0xb046('0x32')]);_0x1f4957[_0xb046('0x30')]=qs[_0xb046('0x30')](_0x362878[_0xb046('0x46')][_0xb046('0x30')]);}return _0x5421a7[_0xb046('0x86')](_0x1f4957);}})[_0xb046('0x23')](function(_0x4e14db){if(_0x4e14db){return _0x4e14db?{'count':_0x1ef9db,'rows':_0x4e14db}:null;}})[_0xb046('0x23')](respondWithResult(_0x1c1443,null))[_0xb046('0x5b')](handleError(_0x1c1443,null));};exports['notify']=function(_0x1ad5c8,_0x2f03bf,_0x2d1cf5){var _0x310e56={'channel':_0xb046('0x87')};var _0x13c18f=[];var _0x256153=[];var _0x1ff7c7={};return db['WhatsappAccount']['find']({'where':{'id':_0x1ad5c8[_0xb046('0x66')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xb046('0x23')](handleEntityNotFound(_0x2f03bf,null))[_0xb046('0x23')](function(_0xb65332){_0x310e56[_0xb046('0x88')]=_0xb65332;_0x310e56['applications']=_[_0xb046('0x89')](_0xb65332[_0xb046('0x8a')],[_0xb046('0x85')],[_0xb046('0x8b')]);if(_0x310e56[_0xb046('0x88')][_0xb046('0x8a')]){delete _0x310e56[_0xb046('0x88')][_0xb046('0x8a')];}return db[_0xb046('0x8c')][_0xb046('0x67')]();})[_0xb046('0x23')](function(_0x4f5d78){if(!_0x4f5d78){throw new db[(_0xb046('0x8d'))][(_0xb046('0x8e'))](_0xb046('0x8f'));}_0x13c18f=_['difference'](_['keys'](_0x4f5d78),[_0xb046('0x90'),'updatedAt']);_0x256153=_[_0xb046('0x91')](_[_0xb046('0x47')](_0x4f5d78),[_0xb046('0x90'),_0xb046('0x92'),_0xb046('0x93'),'ListId']);_0x310e56['body']={'mapKey':'mobile'};if(_0x310e56[_0xb046('0x88')]['type']&&_0x310e56['account'][_0xb046('0x43')]===_0xb046('0x94')){_0x310e56['body']['from']=_0x1ad5c8[_0xb046('0x5e')]['From'][_0xb046('0x95')](_0xb046('0x96'),'');_0x310e56[_0xb046('0x5e')]['body']=_0x1ad5c8[_0xb046('0x5e')][_0xb046('0x97')];_0x310e56[_0xb046('0x5e')][_0xb046('0x98')]=_0x1ad5c8[_0xb046('0x5e')]['MessageSid'];}if(_0x310e56[_0xb046('0x5e')]['id']){delete _0x310e56['body']['id'];}if(_[_0xb046('0x99')](_0x310e56[_0xb046('0x5e')]['from'])){throw new db['Sequelize']['ValidationError'](_0xb046('0x9a'));}if(_[_0xb046('0x99')](_0x310e56[_0xb046('0x5e')][_0xb046('0x5e')])||_0x310e56['body'][_0xb046('0x5e')]===''){throw new db[(_0xb046('0x8d'))][(_0xb046('0x8e'))](_0xb046('0x9b'));}if(_['isNil'](_0x310e56['body'][_0xb046('0x9c')])){throw new db[(_0xb046('0x8d'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x256153);}if(!_[_0xb046('0x9d')](_0x256153,_0x310e56[_0xb046('0x5e')][_0xb046('0x9c')])){throw new db[(_0xb046('0x8d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x256153);}_0x1ff7c7[_0x310e56[_0xb046('0x5e')][_0xb046('0x9c')]]=_0x310e56[_0xb046('0x5e')][_0xb046('0x9e')];return db['CmList']['find']({'where':{'id':_0x310e56['account'][_0xb046('0x9f')]},'include':[{'model':db[_0xb046('0x8c')],'as':_0xb046('0xa0'),'where':_0x1ff7c7,'limit':0x1,'order':[[_0xb046('0x92'),_0xb046('0xa1')]]}]});})[_0xb046('0x23')](handleEntityNotFound(_0x2f03bf,null))[_0xb046('0x23')](function(_0xf05c73){if(_0xf05c73){_0x310e56[_0xb046('0xa2')]=_[_0xb046('0x75')](_0xf05c73,[_0xb046('0xa0')]);if(_0xf05c73[_0xb046('0xa0')][_0xb046('0x4c')]){return _0xf05c73['Contacts'][0x0];}var _0x52e7ed=_[_0xb046('0x1b')](_0x310e56['body'],{'firstName':_0x310e56['body'][_0xb046('0x9e')],'ListId':_0xf05c73['id']});_0x52e7ed[_0x310e56[_0xb046('0x5e')]['mapKey']]=_0x310e56[_0xb046('0x5e')][_0xb046('0x9e')];return db[_0xb046('0x8c')][_0xb046('0xa3')](_0x52e7ed,{'fields':_0x13c18f,'raw':!![]});}})[_0xb046('0x23')](handleEntityNotFound(_0x2f03bf,null))[_0xb046('0x23')](function(_0x2d7787){if(_0x2d7787){_0x310e56['contact']=_0x2d7787;var _0x4b1455={'ContactId':_0x2d7787['id'],'phone':_0x310e56['body'][_0xb046('0x9e')],'WhatsappAccountId':_0x1ad5c8[_0xb046('0x66')]['id']};var _0x36bc5b={'ContactId':_0x2d7787['id'],'WhatsappAccountId':_0x1ad5c8['params']['id'],'closed':![]};return db[_0xb046('0xa4')][_0xb046('0x5d')]({'where':_0x36bc5b})['then'](function(_0x3dcd2d){if(_0x3dcd2d){return[_0x3dcd2d,![]];}return db[_0xb046('0xa4')]['create'](_0x4b1455)['then'](function(_0x2c68a5){return[_0x2c68a5,!![]];});});}})[_0xb046('0x76')](function(_0x57e291,_0x12b8ed){_0x310e56[_0xb046('0xa5')]=_0x57e291[_0xb046('0x38')]({'plain':!![]});_0x310e56[_0xb046('0xa5')][_0xb046('0xa6')]=![];if(_0x12b8ed){if(_0x310e56['account'][_0xb046('0xa7')]){_0x310e56[_0xb046('0xa8')][_0xb046('0xa9')]({'id':0x0,'priority':_0x310e56[_0xb046('0xa8')][_0xb046('0x4c')]+0x1,'app':_0xb046('0xaa'),'appdata':_0xb046('0xab'),'interval':_0xb046('0xac')});}_0x310e56[_0xb046('0xa5')][_0xb046('0xa6')]=!![];}return db[_0xb046('0xad')][_0xb046('0xa3')]({'phone':_0x310e56[_0xb046('0x5e')][_0xb046('0x9e')],'messageId':_0x310e56['body'][_0xb046('0x98')],'body':_0x310e56[_0xb046('0x5e')][_0xb046('0x5e')],'WhatsappAccountId':_0x1ad5c8[_0xb046('0x66')]['id'],'WhatsappInteractionId':_0x57e291['id'],'direction':'in','ContactId':_0x57e291[_0xb046('0xae')],'AttachmentId':_0x310e56[_0xb046('0x5e')][_0xb046('0xaf')]});})[_0xb046('0x23')](function(_0x4359e9){_0x310e56[_0xb046('0x2a')]=_0x4359e9;if(_0x310e56['interaction'][_0xb046('0xb0')]){return db[_0xb046('0x7d')][_0xb046('0x5d')]({'attributes':['id',_0xb046('0x3d')],'where':{'id':_0x310e56[_0xb046('0xa5')][_0xb046('0xb0')]}})[_0xb046('0x23')](function(_0x21c412){if(_0x21c412){_0x310e56[_0xb046('0xa8')][_0xb046('0xb1')]({'id':0x0,'priority':0x0,'app':_0xb046('0xb2'),'appdata':_0x21c412[_0xb046('0x3d')]+','+(_0x310e56['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb046('0xb3'),_0xb046('0xb4'),_0x310e56);});}return respondWithRpcPromise(_0xb046('0xb3'),_0xb046('0xb4'),_0x310e56);})[_0xb046('0x23')](function(_0xdd7a00){if(_0xdd7a00){var _0xba1cc5=0xc8;var _0x19d155=_0xb046('0xb5');logger[_0xb046('0x2b')](_0xb046('0x26'),_0x19d155,_0xba1cc5,_0xb046('0xb6'));logger[_0xb046('0x25')](_0xb046('0xb7'),_0x19d155,_0xba1cc5,_0xb046('0xb6'),JSON[_0xb046('0xb8')](_0xdd7a00));if(_0x310e56[_0xb046('0x88')][_0xb046('0x43')]===_0xb046('0x94')){return _0x2f03bf[_0xb046('0x2e')](_0xba1cc5)[_0xb046('0x34')](_0xb046('0xb9'),_0xb046('0xba'))[_0xb046('0xbb')](_0xb046('0xbc'));}else{return _0x2f03bf[_0xb046('0x2e')](_0xba1cc5)['json'](_0xdd7a00);}}})[_0xb046('0x5b')](handleError(_0x2f03bf,null));};exports[_0xb046('0xbb')]=function(_0x481344,_0x146d57,_0x2e42c1){var _0x5d1306,_0x5bf413,_0x124c89;if(_['isNil'](_0x481344[_0xb046('0x5e')][_0xb046('0x5e')])||_0x481344[_0xb046('0x5e')][_0xb046('0x5e')]===''){throw new db[(_0xb046('0x8d'))][(_0xb046('0x8e'))](_0xb046('0x9b'));}if(_['isNil'](_0x481344[_0xb046('0x5e')]['to'])){throw new db[(_0xb046('0x8d'))]['ValidationError']('to\x20is\x20mandatory');}_0x5d1306=_0x481344[_0xb046('0x5e')]['to'];return db['WhatsappAccount'][_0xb046('0x5d')]({'where':{'id':_0x481344['params']['id']},'include':[{'model':db[_0xb046('0xbd')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb046('0xa0'),'where':{'mobile':_0x5d1306},'limit':0x1,'order':[['updatedAt',_0xb046('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x146d57,null))['then'](function(_0x28231b){if(_0x28231b&&_0x28231b[_0xb046('0xbe')]){_0x5bf413=_0x28231b[_0xb046('0x38')]({'plain':!![]});if(_0x5bf413[_0xb046('0xbe')]&&_0x5bf413[_0xb046('0xbe')]['Contacts'][_0xb046('0x4c')]){return _0x5bf413['List'][_0xb046('0xa0')][0x0];}return db[_0xb046('0x8c')]['create'](_[_0xb046('0x1b')](_0x481344['body'],{'firstName':_0x5d1306,'mobile':_0x5d1306,'phone':_0x5d1306,'ListId':_0x5bf413['ListId']}));}})['then'](handleEntityNotFound(_0x146d57,null))[_0xb046('0x23')](function(_0x885d39){if(_0x885d39){_0x124c89=_0x885d39;return db['WhatsappInteraction'][_0xb046('0x5d')]({'where':{'ContactId':_0x124c89['id'],'closed':![],'WhatsappAccountId':_0x5bf413['id']}})['then'](function(_0x2ccc37){if(_0x2ccc37){return[_0x2ccc37,![]];}return db[_0xb046('0xa4')][_0xb046('0xa3')]({'UserId':_0x481344[_0xb046('0x61')]['id'],'ContactId':_0x124c89['id'],'WhatsappAccountId':_0x5bf413['id'],'phone':_0x5d1306,'firstMsgDirection':'out','Messages':[_[_0xb046('0x55')](_0x481344[_0xb046('0x5e')],{'read':![],'body':_0x481344[_0xb046('0x5e')][_0xb046('0x5e')],'phone':_0x5d1306,'WhatsappAccountId':_0x5bf413['id'],'UserId':_0x481344[_0xb046('0x61')]['id'],'ContactId':_0x124c89['id']})]},{'include':[{'model':db[_0xb046('0xad')],'as':_0xb046('0xbf')}]})[_0xb046('0x23')](function(_0x461c05){return[_0x461c05,!![]];});});}})[_0xb046('0x76')](function(_0x294025,_0x2902bc){if(_0x2902bc){return _0x294025;}return db[_0xb046('0xad')][_0xb046('0xa3')](_[_0xb046('0x55')](_0x481344[_0xb046('0x5e')],{'read':![],'body':_0x481344[_0xb046('0x5e')]['body'],'phone':_0x5d1306,'WhatsappAccountId':_0x5bf413['id'],'WhatsappInteractionId':_0x294025['id'],'UserId':_0x481344['user']['id'],'ContactId':_0x124c89['id']}))[_0xb046('0x23')](function(_0x262c89){_0x294025['dataValues'][_0xb046('0xbf')]=[];_0x294025[_0xb046('0xc0')][_0xb046('0xbf')][_0xb046('0xa9')](_0x262c89[_0xb046('0xc0')]);return _0x294025;});})[_0xb046('0x23')](respondWithResult(_0x146d57,null))['catch'](handleError(_0x146d57,null));}; \ No newline at end of file +var _0x12a4=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','applications','orderBy','asc','account','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','from','From','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmContact','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','autoclose','push','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','stringify','twilio','text/xml','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','map','WhatsappAccount','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','mandatoryDispositionPause','keys','rawAttributes','includeAll','find','create','body','user'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x12a4,0x1c3));var _0x412a=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x12a4[_0x2675da];return _0x5e6153;};'use strict';var emlformat=require(_0x412a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x412a('0x1'));var rp=require('request-promise');var moment=require(_0x412a('0x2'));var BPromise=require(_0x412a('0x3'));var Mustache=require('mustache');var util=require(_0x412a('0x4'));var path=require(_0x412a('0x5'));var sox=require(_0x412a('0x6'));var csv=require(_0x412a('0x7'));var ejs=require(_0x412a('0x8'));var fs=require('fs');var fs_extra=require(_0x412a('0x9'));var _=require(_0x412a('0xa'));var squel=require('squel');var crypto=require(_0x412a('0xb'));var jsforce=require(_0x412a('0xc'));var deskjs=require(_0x412a('0xd'));var toCsv=require(_0x412a('0x7'));var querystring=require(_0x412a('0xe'));var Papa=require(_0x412a('0xf'));var Redis=require(_0x412a('0x10'));var authService=require(_0x412a('0x11'));var qs=require(_0x412a('0x12'));var as=require(_0x412a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x412a('0x14'))('api');var utils=require(_0x412a('0x15'));var config=require(_0x412a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x412a('0x17')],{'host':_0x412a('0x18'),'port':0x18eb});var socket=require(_0x412a('0x19'))(new Redis(config[_0x412a('0x17')]));require(_0x412a('0x1a'))['register'](socket);var jayson=require(_0x412a('0x1b'));var client=jayson[_0x412a('0x1c')][_0x412a('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5ad44f,_0x8a0fc7,_0x5839e9,_0x3ecdb3){return new BPromise(function(_0x3651c9,_0x5cfcbe){var _0x4748f0=_0x3ecdb3||client;return _0x4748f0[_0x412a('0x1e')](_0x5ad44f,_0x5839e9)['then'](function(_0xa362c2){logger[_0x412a('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x8a0fc7,_0x412a('0x20'));logger['debug'](_0x412a('0x21'),_0x8a0fc7,_0x412a('0x20'),JSON['stringify'](_0xa362c2));if(_0xa362c2[_0x412a('0x22')]){if(_0xa362c2[_0x412a('0x22')][_0x412a('0x23')]===0x1f4){logger[_0x412a('0x22')](_0x412a('0x24'),_0x8a0fc7,_0xa362c2['error']['message']);return _0x5cfcbe(_0xa362c2[_0x412a('0x22')][_0x412a('0x25')]);}logger[_0x412a('0x22')](_0x412a('0x24'),_0x8a0fc7,_0xa362c2[_0x412a('0x22')][_0x412a('0x25')]);return _0x3651c9(_0xa362c2[_0x412a('0x22')][_0x412a('0x25')]);}else{logger[_0x412a('0x1f')](_0x412a('0x24'),_0x8a0fc7,_0x412a('0x20'));_0x3651c9(_0xa362c2[_0x412a('0x26')][_0x412a('0x25')]);}})[_0x412a('0x27')](function(_0x17096a){logger[_0x412a('0x22')](_0x412a('0x24'),_0x8a0fc7,_0x17096a);_0x5cfcbe(_0x17096a);});});}function respondWithStatusCode(_0x18d383,_0x19b69a){_0x19b69a=_0x19b69a||0xcc;return function(_0x5aa27e){if(_0x5aa27e){return _0x18d383['sendStatus'](_0x19b69a);}return _0x18d383[_0x412a('0x28')](_0x19b69a)[_0x412a('0x29')]();};}function respondWithResult(_0x2c9c2b,_0x534542){_0x534542=_0x534542||0xc8;return function(_0x37f049){if(_0x37f049){return _0x2c9c2b[_0x412a('0x28')](_0x534542)['json'](_0x37f049);}};}function respondWithFilteredResult(_0x3a1387,_0x15ca57){return function(_0x55c651){if(_0x55c651){var _0x1150ad=typeof _0x15ca57[_0x412a('0x2a')]===_0x412a('0x2b')&&typeof _0x15ca57[_0x412a('0x2c')]==='undefined';var _0x108a02=_0x55c651[_0x412a('0x2d')];var _0x40af15=_0x1150ad?0x0:_0x15ca57[_0x412a('0x2a')];var _0x342968=_0x1150ad?_0x55c651[_0x412a('0x2d')]:_0x15ca57[_0x412a('0x2a')]+_0x15ca57[_0x412a('0x2c')];var _0x397b85;if(_0x342968>=_0x108a02){_0x342968=_0x108a02;_0x397b85=0xc8;}else{_0x397b85=0xce;}_0x3a1387[_0x412a('0x28')](_0x397b85);return _0x3a1387[_0x412a('0x2e')]('Content-Range',_0x40af15+'-'+_0x342968+'/'+_0x108a02)[_0x412a('0x2f')](_0x55c651);}return null;};}function patchUpdates(_0x2374e4){return function(_0x351629){try{jsonpatch['apply'](_0x351629,_0x2374e4,!![]);}catch(_0x11a6bd){return BPromise['reject'](_0x11a6bd);}return _0x351629[_0x412a('0x30')]();};}function saveUpdates(_0x1ba88b,_0x36f5bd){return function(_0x5a4f11){if(_0x5a4f11){return _0x5a4f11[_0x412a('0x31')](_0x1ba88b)[_0x412a('0x32')](function(_0x1d01a8){return _0x1d01a8;});}return null;};}function removeEntity(_0x441b97,_0x58ade0){return function(_0x50e7ea){if(_0x50e7ea){return _0x50e7ea[_0x412a('0x33')]()[_0x412a('0x32')](function(){var _0x32616c=_0x50e7ea[_0x412a('0x34')]({'plain':!![]});var _0x466334=_0x412a('0x35');return db[_0x412a('0x36')]['destroy']({'where':{'type':_0x466334,'resourceId':_0x32616c['id']}})['then'](function(){return _0x50e7ea;});})['then'](function(){_0x441b97[_0x412a('0x28')](0xcc)[_0x412a('0x29')]();});}};}function handleEntityNotFound(_0x4491a2,_0x376bfa){return function(_0x448805){if(!_0x448805){_0x4491a2['sendStatus'](0x194);}return _0x448805;};}function handleError(_0x2796f4,_0x30e88a){_0x30e88a=_0x30e88a||0x1f4;return function(_0x4825d6){logger[_0x412a('0x22')](_0x4825d6[_0x412a('0x37')]);if(_0x4825d6[_0x412a('0x38')]){delete _0x4825d6[_0x412a('0x38')];}_0x2796f4[_0x412a('0x28')](_0x30e88a)[_0x412a('0x39')](_0x4825d6);};}exports[_0x412a('0x3a')]=function(_0x1d799b,_0x38934a){var _0x477ba0={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xc48100={},_0x35330a={'count':0x0,'rows':[]};var _0x2af545=_[_0x412a('0x3b')](db[_0x412a('0x3c')]['rawAttributes'],function(_0x41feac){return{'name':_0x41feac[_0x412a('0x3d')],'type':_0x41feac[_0x412a('0x3e')]['key']};});_0xc48100['model']=_['map'](_0x2af545,'name');_0xc48100[_0x412a('0x3f')]=_['keys'](_0x1d799b[_0x412a('0x3f')]);_0xc48100[_0x412a('0x40')]=_[_0x412a('0x41')](_0xc48100[_0x412a('0x42')],_0xc48100['query']);_0x477ba0[_0x412a('0x43')]=_['intersection'](_0xc48100[_0x412a('0x42')],qs[_0x412a('0x44')](_0x1d799b[_0x412a('0x3f')][_0x412a('0x44')]));_0x477ba0[_0x412a('0x43')]=_0x477ba0[_0x412a('0x43')][_0x412a('0x45')]?_0x477ba0[_0x412a('0x43')]:_0xc48100[_0x412a('0x42')];if(!_0x1d799b[_0x412a('0x3f')][_0x412a('0x46')](_0x412a('0x47'))){_0x477ba0['limit']=qs['limit'](_0x1d799b['query'][_0x412a('0x2c')]);_0x477ba0[_0x412a('0x2a')]=qs['offset'](_0x1d799b[_0x412a('0x3f')][_0x412a('0x2a')]);}_0x477ba0[_0x412a('0x48')]=qs['sort'](_0x1d799b[_0x412a('0x3f')][_0x412a('0x49')]);_0x477ba0[_0x412a('0x4a')]=qs[_0x412a('0x40')](_[_0x412a('0x4b')](_0x1d799b['query'],_0xc48100[_0x412a('0x40')]),_0x2af545);if(_0x1d799b['query'][_0x412a('0x4c')]){_0x477ba0[_0x412a('0x4a')]=_[_0x412a('0x4d')](_0x477ba0['where'],{'$or':_['map'](_0x2af545,function(_0x8d0167){if(_0x8d0167[_0x412a('0x3e')]!==_0x412a('0x4e')){var _0x5b6a63={};_0x5b6a63[_0x8d0167['name']]={'$like':'%'+_0x1d799b[_0x412a('0x3f')][_0x412a('0x4c')]+'%'};return _0x5b6a63;}})});}_0x477ba0=_[_0x412a('0x4d')]({},_0x477ba0,_0x1d799b[_0x412a('0x4f')]);var _0x5e6749={'where':_0x477ba0[_0x412a('0x4a')]};return db[_0x412a('0x3c')][_0x412a('0x2d')](_0x5e6749)[_0x412a('0x32')](function(_0x1692e5){_0x35330a[_0x412a('0x2d')]=_0x1692e5;if(_0x1d799b[_0x412a('0x3f')]['includeAll']){_0x477ba0[_0x412a('0x50')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x477ba0);})['then'](function(_0x44057a){_0x35330a[_0x412a('0x51')]=_0x44057a;return _0x35330a;})[_0x412a('0x32')](respondWithFilteredResult(_0x38934a,_0x477ba0))[_0x412a('0x27')](handleError(_0x38934a,null));};exports[_0x412a('0x52')]=function(_0x127335,_0x194854){var _0x45f00c={'raw':![],'where':{'id':_0x127335[_0x412a('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x412a('0x54')}]},_0x4ba323={};_0x4ba323[_0x412a('0x42')]=_[_0x412a('0x55')](db['WhatsappAccount'][_0x412a('0x56')]);_0x4ba323[_0x412a('0x3f')]=_['keys'](_0x127335[_0x412a('0x3f')]);_0x4ba323['filters']=_[_0x412a('0x41')](_0x4ba323[_0x412a('0x42')],_0x4ba323[_0x412a('0x3f')]);_0x45f00c[_0x412a('0x43')]=_[_0x412a('0x41')](_0x4ba323[_0x412a('0x42')],qs[_0x412a('0x44')](_0x127335['query']['fields']));_0x45f00c['attributes']=_0x45f00c[_0x412a('0x43')][_0x412a('0x45')]?_0x45f00c[_0x412a('0x43')]:_0x4ba323[_0x412a('0x42')];if(_0x127335[_0x412a('0x3f')][_0x412a('0x57')]){_0x45f00c['include']=[{'all':!![]}];}_0x45f00c=_[_0x412a('0x4d')]({},_0x45f00c,_0x127335[_0x412a('0x4f')]);return db[_0x412a('0x3c')][_0x412a('0x58')](_0x45f00c)[_0x412a('0x32')](handleEntityNotFound(_0x194854,null))[_0x412a('0x32')](respondWithResult(_0x194854,null))[_0x412a('0x27')](handleError(_0x194854,null));};exports[_0x412a('0x59')]=function(_0x36e485,_0xa721f8){return db[_0x412a('0x3c')][_0x412a('0x59')](_0x36e485[_0x412a('0x5a')],{})[_0x412a('0x32')](function(_0x5705c6){var _0xba121d=_0x36e485[_0x412a('0x5b')]['get']({'plain':!![]});if(!_0xba121d)throw new Error(_0x412a('0x5c'));if(_0xba121d['role']===_0x412a('0x5b')){var _0x3e10b0=_0x5705c6['get']({'plain':!![]});var _0x5942a1=_0x412a('0x35');return db[_0x412a('0x5d')]['find']({'where':{'name':_0x5942a1,'userProfileId':_0xba121d[_0x412a('0x5e')]},'raw':!![]})[_0x412a('0x32')](function(_0xa57506){if(_0xa57506&&_0xa57506[_0x412a('0x5f')]===0x0){return db[_0x412a('0x36')]['create']({'name':_0x3e10b0['name'],'resourceId':_0x3e10b0['id'],'type':_0xa57506['name'],'sectionId':_0xa57506['id']},{})[_0x412a('0x32')](function(){return _0x5705c6;});}else{return _0x5705c6;}})[_0x412a('0x27')](function(_0x35f311){logger['error'](_0x412a('0x60'),_0x35f311);throw _0x35f311;});}return _0x5705c6;})[_0x412a('0x32')](respondWithResult(_0xa721f8,0xc9))['catch'](handleError(_0xa721f8,null));};exports[_0x412a('0x31')]=function(_0x5defb7,_0x582874){if(_0x5defb7[_0x412a('0x5a')]['id']){delete _0x5defb7[_0x412a('0x5a')]['id'];}return db[_0x412a('0x3c')][_0x412a('0x58')]({'where':{'id':_0x5defb7[_0x412a('0x53')]['id']},'include':[{'model':db[_0x412a('0x61')],'as':_0x412a('0x54')}]})[_0x412a('0x32')](handleEntityNotFound(_0x582874,null))[_0x412a('0x32')](saveUpdates(_0x5defb7['body'],null))[_0x412a('0x32')](respondWithResult(_0x582874,null))[_0x412a('0x27')](handleError(_0x582874,null));};exports[_0x412a('0x33')]=function(_0x5b8003,_0x1424e4){return db['WhatsappAccount'][_0x412a('0x58')]({'where':{'id':_0x5b8003['params']['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x1424e4,null))[_0x412a('0x32')](removeEntity(_0x1424e4,null))[_0x412a('0x27')](handleError(_0x1424e4,null));};exports[_0x412a('0x62')]=function(_0x2dd37,_0x540a0c){return db[_0x412a('0x3c')]['describe']()['then'](respondWithResult(_0x540a0c,null))['catch'](handleError(_0x540a0c,null));};exports['addDisposition']=function(_0x2ac55f,_0x4e2040,_0x120b0a){if(_0x2ac55f[_0x412a('0x5a')]['id']){delete _0x2ac55f['body']['id'];}return db[_0x412a('0x3c')][_0x412a('0x58')]({'where':{'id':_0x2ac55f['params']['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x4e2040,null))[_0x412a('0x32')](function(_0x14077b){if(_0x14077b){_0x2ac55f[_0x412a('0x5a')][_0x412a('0x63')]=_0x14077b['id'];return db[_0x412a('0x64')][_0x412a('0x59')](_0x2ac55f[_0x412a('0x5a')]);}})[_0x412a('0x32')](respondWithResult(_0x4e2040,null))[_0x412a('0x27')](handleError(_0x4e2040,null));};exports[_0x412a('0x65')]=function(_0x39556d,_0x5c90cd,_0x323011){var _0x2018eb={'raw':![],'where':{}};var _0x3f2c05={};var _0x240468={'count':0x0,'rows':[]};return db[_0x412a('0x3c')][_0x412a('0x66')]({'where':{'id':_0x39556d[_0x412a('0x53')]['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x5c90cd,null))['then'](function(_0x42b181){if(_0x42b181){_0x3f2c05[_0x412a('0x42')]=_[_0x412a('0x55')](db[_0x412a('0x64')][_0x412a('0x56')]);_0x3f2c05[_0x412a('0x3f')]=_[_0x412a('0x55')](_0x39556d[_0x412a('0x3f')]);_0x3f2c05[_0x412a('0x40')]=_[_0x412a('0x41')](_0x3f2c05['model'],_0x3f2c05[_0x412a('0x3f')]);_0x2018eb[_0x412a('0x43')]=_[_0x412a('0x41')](_0x3f2c05[_0x412a('0x42')],qs[_0x412a('0x44')](_0x39556d[_0x412a('0x3f')][_0x412a('0x44')]));_0x2018eb[_0x412a('0x43')]=_0x2018eb[_0x412a('0x43')]['length']?_0x2018eb['attributes']:_0x3f2c05[_0x412a('0x42')];if(!_0x39556d['query'][_0x412a('0x46')](_0x412a('0x47'))){_0x2018eb[_0x412a('0x2c')]=qs['limit'](_0x39556d[_0x412a('0x3f')][_0x412a('0x2c')]);_0x2018eb[_0x412a('0x2a')]=qs[_0x412a('0x2a')](_0x39556d['query']['offset']);}_0x2018eb['order']=qs['sort'](_0x39556d[_0x412a('0x3f')][_0x412a('0x49')]);_0x2018eb[_0x412a('0x4a')]=qs[_0x412a('0x40')](_[_0x412a('0x4b')](_0x39556d['query'],_0x3f2c05[_0x412a('0x40')]));_0x2018eb[_0x412a('0x4a')]['WhatsappAccountId']=_0x42b181['id'];if(_0x39556d[_0x412a('0x3f')][_0x412a('0x4c')]){_0x2018eb[_0x412a('0x4a')]=_[_0x412a('0x4d')](_0x2018eb[_0x412a('0x4a')],{'$or':_[_0x412a('0x3b')](_0x2018eb['attributes'],function(_0x5623ec){var _0x341681={};_0x341681[_0x5623ec]={'$like':'%'+_0x39556d[_0x412a('0x3f')][_0x412a('0x4c')]+'%'};return _0x341681;})});}_0x2018eb=_['merge']({},_0x2018eb,_0x39556d[_0x412a('0x4f')]);return db['Disposition'][_0x412a('0x2d')]({'where':_0x2018eb[_0x412a('0x4a')]})[_0x412a('0x32')](function(_0x475fa9){_0x240468['count']=_0x475fa9;if(_0x39556d[_0x412a('0x3f')][_0x412a('0x57')]){_0x2018eb[_0x412a('0x50')]=[{'all':!![]}];}return db[_0x412a('0x64')][_0x412a('0x67')](_0x2018eb);})['then'](function(_0x9f60){_0x240468[_0x412a('0x51')]=_0x9f60;return _0x240468;});}})[_0x412a('0x32')](respondWithFilteredResult(_0x5c90cd,_0x2018eb))[_0x412a('0x27')](handleError(_0x5c90cd,null));};exports[_0x412a('0x68')]=function(_0x3b6361,_0x224543,_0x4848cb){return db[_0x412a('0x3c')][_0x412a('0x58')]({'where':{'id':_0x3b6361[_0x412a('0x53')]['id']}})['then'](handleEntityNotFound(_0x224543,null))[_0x412a('0x32')](function(_0x57f9f1){if(_0x57f9f1){return _0x57f9f1['removeDispositions'](_0x3b6361[_0x412a('0x3f')]['ids']);}})[_0x412a('0x32')](respondWithStatusCode(_0x224543,null))[_0x412a('0x27')](handleError(_0x224543,null));};exports[_0x412a('0x69')]=function(_0x28d0b3,_0xe10025,_0x319edd){if(_0x28d0b3[_0x412a('0x5a')]['id']){delete _0x28d0b3[_0x412a('0x5a')]['id'];}return db[_0x412a('0x3c')][_0x412a('0x58')]({'where':{'id':_0x28d0b3[_0x412a('0x53')]['id']}})[_0x412a('0x32')](handleEntityNotFound(_0xe10025,null))['then'](function(_0x3f8a3f){if(_0x3f8a3f){_0x28d0b3[_0x412a('0x5a')][_0x412a('0x63')]=_0x3f8a3f['id'];return db[_0x412a('0x6a')][_0x412a('0x59')](_0x28d0b3[_0x412a('0x5a')]);}})[_0x412a('0x32')](respondWithResult(_0xe10025,null))[_0x412a('0x27')](handleError(_0xe10025,null));};exports[_0x412a('0x6b')]=function(_0x165eac,_0x3f2d16,_0x140668){var _0x299702={'raw':![],'where':{}};var _0x197b2b={};var _0x787b9d={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x165eac[_0x412a('0x53')]['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x3f2d16,null))[_0x412a('0x32')](function(_0x4616eb){if(_0x4616eb){_0x197b2b[_0x412a('0x42')]=_[_0x412a('0x55')](db[_0x412a('0x6a')][_0x412a('0x56')]);_0x197b2b['query']=_['keys'](_0x165eac[_0x412a('0x3f')]);_0x197b2b[_0x412a('0x40')]=_[_0x412a('0x41')](_0x197b2b[_0x412a('0x42')],_0x197b2b[_0x412a('0x3f')]);_0x299702[_0x412a('0x43')]=_[_0x412a('0x41')](_0x197b2b[_0x412a('0x42')],qs['fields'](_0x165eac[_0x412a('0x3f')]['fields']));_0x299702[_0x412a('0x43')]=_0x299702[_0x412a('0x43')][_0x412a('0x45')]?_0x299702['attributes']:_0x197b2b[_0x412a('0x42')];if(!_0x165eac[_0x412a('0x3f')][_0x412a('0x46')](_0x412a('0x47'))){_0x299702[_0x412a('0x2c')]=qs['limit'](_0x165eac[_0x412a('0x3f')][_0x412a('0x2c')]);_0x299702[_0x412a('0x2a')]=qs[_0x412a('0x2a')](_0x165eac[_0x412a('0x3f')]['offset']);}_0x299702[_0x412a('0x48')]=qs[_0x412a('0x49')](_0x165eac['query'][_0x412a('0x49')]);_0x299702[_0x412a('0x4a')]=qs[_0x412a('0x40')](_['pick'](_0x165eac[_0x412a('0x3f')],_0x197b2b[_0x412a('0x40')]));_0x299702[_0x412a('0x4a')][_0x412a('0x63')]=_0x4616eb['id'];if(_0x165eac[_0x412a('0x3f')][_0x412a('0x4c')]){_0x299702['where']=_['merge'](_0x299702[_0x412a('0x4a')],{'$or':_[_0x412a('0x3b')](_0x299702['attributes'],function(_0x305a6f){var _0x236dfd={};_0x236dfd[_0x305a6f]={'$like':'%'+_0x165eac[_0x412a('0x3f')][_0x412a('0x4c')]+'%'};return _0x236dfd;})});}_0x299702=_[_0x412a('0x4d')]({},_0x299702,_0x165eac[_0x412a('0x4f')]);return db['CannedAnswer']['count']({'where':_0x299702['where']})[_0x412a('0x32')](function(_0x4dc16f){_0x787b9d[_0x412a('0x2d')]=_0x4dc16f;if(_0x165eac[_0x412a('0x3f')][_0x412a('0x57')]){_0x299702[_0x412a('0x50')]=[{'all':!![]}];}return db[_0x412a('0x6a')][_0x412a('0x67')](_0x299702);})[_0x412a('0x32')](function(_0x2c39e6){_0x787b9d[_0x412a('0x51')]=_0x2c39e6;return _0x787b9d;});}})['then'](respondWithFilteredResult(_0x3f2d16,_0x299702))['catch'](handleError(_0x3f2d16,null));};exports[_0x412a('0x6c')]=function(_0x1238fb,_0x52467c,_0xb54e0e){return db[_0x412a('0x3c')][_0x412a('0x58')]({'where':{'id':_0x1238fb[_0x412a('0x53')]['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x52467c,null))[_0x412a('0x32')](function(_0x2bdf9a){if(_0x2bdf9a){return _0x2bdf9a[_0x412a('0x6c')](_0x1238fb['query'][_0x412a('0x6d')]);}})['then'](respondWithStatusCode(_0x52467c,null))[_0x412a('0x27')](handleError(_0x52467c,null));};exports['addAgents']=function(_0x2c638f,_0x1a1fac,_0x53a41b){return db[_0x412a('0x3c')][_0x412a('0x58')]({'where':{'id':_0x2c638f[_0x412a('0x53')]['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x1a1fac,null))[_0x412a('0x32')](function(_0x7b8855){if(_0x7b8855){return _0x7b8855[_0x412a('0x6e')](_0x2c638f[_0x412a('0x5a')][_0x412a('0x6d')],_[_0x412a('0x6f')](_0x2c638f[_0x412a('0x5a')],[_0x412a('0x6d'),'id'])||{})[_0x412a('0x70')](function(_0x244e4a){for(var _0x183721=0x0;_0x183721<_0x2c638f[_0x412a('0x5a')]['ids'][_0x412a('0x45')];_0x183721+=0x1){socket[_0x412a('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x2c638f[_0x412a('0x5a')][_0x412a('0x6d')][_0x183721]),'WhatsappAccountId':Number(_0x2c638f[_0x412a('0x53')]['id'])});}return _0x244e4a;});}})[_0x412a('0x32')](respondWithResult(_0x1a1fac,null))[_0x412a('0x27')](handleError(_0x1a1fac,null));};exports[_0x412a('0x72')]=function(_0x350444,_0x30b031,_0x11b0cf){return db[_0x412a('0x3c')][_0x412a('0x58')]({'where':{'id':_0x350444['params']['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x30b031,null))[_0x412a('0x32')](function(_0x4aa6cd){if(_0x4aa6cd){return _0x4aa6cd['removeAgents'](_0x350444['query'][_0x412a('0x6d')])[_0x412a('0x32')](function(){if(_['isArray'](_0x350444['query'][_0x412a('0x6d')])){for(var _0x131ae5=0x0;_0x131ae5<_0x350444[_0x412a('0x3f')]['ids']['length'];_0x131ae5+=0x1){socket[_0x412a('0x71')](_0x412a('0x73'),{'UserId':Number(_0x350444[_0x412a('0x3f')][_0x412a('0x6d')][_0x131ae5]),'WhatsappAccountId':Number(_0x350444[_0x412a('0x53')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x350444[_0x412a('0x3f')]['ids']),'WhatsappAccountId':Number(_0x350444[_0x412a('0x53')]['id'])});}});}})[_0x412a('0x32')](respondWithStatusCode(_0x30b031,null))[_0x412a('0x27')](handleError(_0x30b031,null));};exports[_0x412a('0x74')]=function(_0x1c4e59,_0x2d4fe6,_0x213b06){var _0xb1747d={};var _0x23acd4={};var _0x564a24;var _0x27b8f4;return db['WhatsappAccount'][_0x412a('0x66')]({'where':{'id':_0x1c4e59[_0x412a('0x53')]['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x2d4fe6,null))[_0x412a('0x32')](function(_0x3affce){if(_0x3affce){_0x564a24=_0x3affce;_0x23acd4['model']=_['keys'](db['User'][_0x412a('0x56')]);_0x23acd4[_0x412a('0x3f')]=_[_0x412a('0x55')](_0x1c4e59[_0x412a('0x3f')]);_0x23acd4[_0x412a('0x40')]=_[_0x412a('0x41')](_0x23acd4[_0x412a('0x42')],_0x23acd4[_0x412a('0x3f')]);_0xb1747d['attributes']=_[_0x412a('0x41')](_0x23acd4[_0x412a('0x42')],qs['fields'](_0x1c4e59['query'][_0x412a('0x44')]));_0xb1747d['attributes']=_0xb1747d[_0x412a('0x43')][_0x412a('0x45')]?_0xb1747d[_0x412a('0x43')]:_0x23acd4[_0x412a('0x42')];_0xb1747d['order']=qs[_0x412a('0x49')](_0x1c4e59['query'][_0x412a('0x49')]);_0xb1747d['where']=qs[_0x412a('0x40')](_[_0x412a('0x4b')](_0x1c4e59[_0x412a('0x3f')],_0x23acd4[_0x412a('0x40')]));if(_0x1c4e59[_0x412a('0x3f')][_0x412a('0x4c')]){_0xb1747d[_0x412a('0x4a')]=_[_0x412a('0x4d')](_0xb1747d[_0x412a('0x4a')],{'$or':_[_0x412a('0x3b')](_0xb1747d[_0x412a('0x43')],function(_0x4e5491){var _0x1bb296={};_0x1bb296[_0x4e5491]={'$like':'%'+_0x1c4e59['query'][_0x412a('0x4c')]+'%'};return _0x1bb296;})});}_0xb1747d=_[_0x412a('0x4d')]({},_0xb1747d,_0x1c4e59[_0x412a('0x4f')]);return _0x564a24['getAgents'](_0xb1747d);}})[_0x412a('0x32')](function(_0x35b84e){if(_0x35b84e){_0x27b8f4=_0x35b84e[_0x412a('0x45')];if(!_0x1c4e59[_0x412a('0x3f')][_0x412a('0x46')](_0x412a('0x47'))){_0xb1747d[_0x412a('0x2c')]=qs[_0x412a('0x2c')](_0x1c4e59[_0x412a('0x3f')][_0x412a('0x2c')]);_0xb1747d[_0x412a('0x2a')]=qs['offset'](_0x1c4e59[_0x412a('0x3f')][_0x412a('0x2a')]);}return _0x564a24[_0x412a('0x74')](_0xb1747d);}})[_0x412a('0x32')](function(_0x3b7e65){if(_0x3b7e65){return _0x3b7e65?{'count':_0x27b8f4,'rows':_0x3b7e65}:null;}})[_0x412a('0x32')](respondWithResult(_0x2d4fe6,null))['catch'](handleError(_0x2d4fe6,null));};exports[_0x412a('0x75')]=function(_0x5bb857,_0x247d78,_0xda61fc){return db['WhatsappAccount'][_0x412a('0x66')]({'where':{'id':_0x5bb857[_0x412a('0x53')]['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x247d78,null))[_0x412a('0x32')](function(_0x1a2634){if(_0x1a2634){return db[_0x412a('0x76')][_0x412a('0x77')](function(_0x15b189){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x5bb857[_0x412a('0x53')]['id']},'transaction':_0x15b189})['then'](function(_0x54752b){var _0x129565=_[_0x412a('0x3b')](_0x5bb857[_0x412a('0x5a')],function(_0x21efe5){_0x21efe5[_0x412a('0x63')]=_0x5bb857[_0x412a('0x53')]['id'];return _0x21efe5;});return db[_0x412a('0x78')][_0x412a('0x79')](_0x129565,{'transaction':_0x15b189});});})[_0x412a('0x32')](function(){return db['WhatsappApplication'][_0x412a('0x7a')]({'where':{'WhatsappAccountId':_0x5bb857[_0x412a('0x53')]['id']},'order':_0x412a('0x7b')});});}})['then'](respondWithResult(_0x247d78,null))['catch'](handleError(_0x247d78,null));};exports[_0x412a('0x7c')]=function(_0x457e45,_0x9d1488,_0x30ef31){var _0xce02e0={};var _0x33de52={};var _0x23bc19;var _0x4c9686;return db[_0x412a('0x3c')][_0x412a('0x66')]({'where':{'id':_0x457e45[_0x412a('0x53')]['id']}})[_0x412a('0x32')](handleEntityNotFound(_0x9d1488,null))[_0x412a('0x32')](function(_0x3c85e2){if(_0x3c85e2){_0x23bc19=_0x3c85e2;_0x33de52['model']=_[_0x412a('0x55')](db[_0x412a('0x78')][_0x412a('0x56')]);_0x33de52[_0x412a('0x3f')]=_[_0x412a('0x55')](_0x457e45['query']);_0x33de52['filters']=_[_0x412a('0x41')](_0x33de52[_0x412a('0x42')],_0x33de52[_0x412a('0x3f')]);_0xce02e0[_0x412a('0x43')]=_[_0x412a('0x41')](_0x33de52[_0x412a('0x42')],qs[_0x412a('0x44')](_0x457e45[_0x412a('0x3f')][_0x412a('0x44')]));_0xce02e0[_0x412a('0x43')]=_0xce02e0[_0x412a('0x43')][_0x412a('0x45')]?_0xce02e0[_0x412a('0x43')]:_0x33de52[_0x412a('0x42')];_0xce02e0['order']=qs[_0x412a('0x49')](_0x457e45['query']['sort']);_0xce02e0['where']=qs[_0x412a('0x40')](_[_0x412a('0x4b')](_0x457e45[_0x412a('0x3f')],_0x33de52[_0x412a('0x40')]));if(_0x457e45[_0x412a('0x3f')]['filter']){_0xce02e0[_0x412a('0x4a')]=_[_0x412a('0x4d')](_0xce02e0[_0x412a('0x4a')],{'$or':_[_0x412a('0x3b')](_0xce02e0[_0x412a('0x43')],function(_0x2ab7ae){var _0x1ee726={};_0x1ee726[_0x2ab7ae]={'$like':'%'+_0x457e45[_0x412a('0x3f')][_0x412a('0x4c')]+'%'};return _0x1ee726;})});}_0xce02e0=_[_0x412a('0x4d')]({},_0xce02e0,_0x457e45['options']);return _0x23bc19[_0x412a('0x7c')](_0xce02e0);}})[_0x412a('0x32')](function(_0x115b44){if(_0x115b44){_0x4c9686=_0x115b44['length'];if(!_0x457e45[_0x412a('0x3f')][_0x412a('0x46')](_0x412a('0x47'))){_0xce02e0[_0x412a('0x2c')]=qs[_0x412a('0x2c')](_0x457e45[_0x412a('0x3f')][_0x412a('0x2c')]);_0xce02e0['offset']=qs['offset'](_0x457e45['query'][_0x412a('0x2a')]);}return _0x23bc19['getApplications'](_0xce02e0);}})[_0x412a('0x32')](function(_0x43f8ca){if(_0x43f8ca){return _0x43f8ca?{'count':_0x4c9686,'rows':_0x43f8ca}:null;}})[_0x412a('0x32')](respondWithResult(_0x9d1488,null))[_0x412a('0x27')](handleError(_0x9d1488,null));};exports['notify']=function(_0x1cca7b,_0x2abb96,_0x3f44f8){var _0x131d73={'channel':_0x412a('0x7d')};var _0x1630b2=[];var _0x3ea679=[];var _0x1f01c6={};return db['WhatsappAccount'][_0x412a('0x58')]({'where':{'id':_0x1cca7b['params']['id']},'include':[{'model':db[_0x412a('0x78')],'as':_0x412a('0x7e')}]})['then'](handleEntityNotFound(_0x2abb96,null))[_0x412a('0x32')](function(_0x5e59bd){_0x131d73['account']=_0x5e59bd;_0x131d73[_0x412a('0x7f')]=_[_0x412a('0x80')](_0x5e59bd[_0x412a('0x7e')],[_0x412a('0x7b')],[_0x412a('0x81')]);if(_0x131d73[_0x412a('0x82')][_0x412a('0x7e')]){delete _0x131d73[_0x412a('0x82')][_0x412a('0x7e')];}return db['CmContact'][_0x412a('0x62')]();})[_0x412a('0x32')](function(_0x45ed5f){if(!_0x45ed5f){throw new db[(_0x412a('0x83'))]['ValidationError'](_0x412a('0x84'));}_0x1630b2=_[_0x412a('0x85')](_[_0x412a('0x55')](_0x45ed5f),['createdAt',_0x412a('0x86')]);_0x3ea679=_[_0x412a('0x85')](_[_0x412a('0x55')](_0x45ed5f),[_0x412a('0x87'),_0x412a('0x86'),'CompanyId',_0x412a('0x88')]);_0x131d73[_0x412a('0x5a')]={'mapKey':_0x412a('0x89')};if(_0x131d73[_0x412a('0x82')]['type']&&_0x131d73[_0x412a('0x82')][_0x412a('0x3e')]==='twilio'){_0x131d73[_0x412a('0x5a')][_0x412a('0x8a')]=_0x1cca7b[_0x412a('0x5a')][_0x412a('0x8b')]['replace'](_0x412a('0x8c'),'');_0x131d73[_0x412a('0x5a')][_0x412a('0x5a')]=_0x1cca7b[_0x412a('0x5a')][_0x412a('0x8d')];_0x131d73['body'][_0x412a('0x8e')]=_0x1cca7b['body'][_0x412a('0x8f')];}if(_0x131d73[_0x412a('0x5a')]['id']){delete _0x131d73[_0x412a('0x5a')]['id'];}if(_[_0x412a('0x90')](_0x131d73[_0x412a('0x5a')][_0x412a('0x8a')])){throw new db[(_0x412a('0x83'))]['ValidationError'](_0x412a('0x91'));}if(_[_0x412a('0x90')](_0x131d73[_0x412a('0x5a')]['body'])||_0x131d73[_0x412a('0x5a')][_0x412a('0x5a')]===''){throw new db[(_0x412a('0x83'))][(_0x412a('0x92'))](_0x412a('0x93'));}if(_['isNil'](_0x131d73[_0x412a('0x5a')][_0x412a('0x94')])){throw new db[(_0x412a('0x83'))][(_0x412a('0x92'))](_0x412a('0x95')+_0x3ea679);}if(!_[_0x412a('0x96')](_0x3ea679,_0x131d73[_0x412a('0x5a')][_0x412a('0x94')])){throw new db[(_0x412a('0x83'))][(_0x412a('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ea679);}_0x1f01c6[_0x131d73['body'][_0x412a('0x94')]]=_0x131d73['body'][_0x412a('0x8a')];return db['CmList']['find']({'where':{'id':_0x131d73['account'][_0x412a('0x88')]},'include':[{'model':db[_0x412a('0x97')],'as':_0x412a('0x98'),'where':_0x1f01c6,'limit':0x1,'order':[[_0x412a('0x86'),_0x412a('0x99')]]}]});})['then'](handleEntityNotFound(_0x2abb96,null))[_0x412a('0x32')](function(_0x374638){if(_0x374638){_0x131d73['list']=_[_0x412a('0x6f')](_0x374638,[_0x412a('0x98')]);if(_0x374638[_0x412a('0x98')][_0x412a('0x45')]){return _0x374638['Contacts'][0x0];}var _0x4e1de0=_[_0x412a('0x9a')](_0x131d73[_0x412a('0x5a')],{'firstName':_0x131d73['body'][_0x412a('0x8a')],'ListId':_0x374638['id']});_0x4e1de0[_0x131d73[_0x412a('0x5a')][_0x412a('0x94')]]=_0x131d73[_0x412a('0x5a')][_0x412a('0x8a')];return db[_0x412a('0x97')][_0x412a('0x59')](_0x4e1de0,{'fields':_0x1630b2,'raw':!![]});}})[_0x412a('0x32')](handleEntityNotFound(_0x2abb96,null))['then'](function(_0x51b239){if(_0x51b239){_0x131d73[_0x412a('0x9b')]=_0x51b239;var _0x154d0e={'ContactId':_0x51b239['id'],'phone':_0x131d73[_0x412a('0x5a')][_0x412a('0x8a')],'WhatsappAccountId':_0x1cca7b[_0x412a('0x53')]['id']};var _0x490950={'ContactId':_0x51b239['id'],'WhatsappAccountId':_0x1cca7b[_0x412a('0x53')]['id'],'closed':![]};return db[_0x412a('0x9c')][_0x412a('0x58')]({'where':_0x490950})[_0x412a('0x32')](function(_0x3955aa){if(_0x3955aa){return[_0x3955aa,![]];}return db[_0x412a('0x9c')][_0x412a('0x59')](_0x154d0e)[_0x412a('0x32')](function(_0x492842){return[_0x492842,!![]];});});}})['spread'](function(_0x28f605,_0x47a551){_0x131d73[_0x412a('0x9d')]=_0x28f605[_0x412a('0x34')]({'plain':!![]});_0x131d73[_0x412a('0x9d')]['created']=![];if(_0x47a551){if(_0x131d73['account'][_0x412a('0x9e')]){_0x131d73[_0x412a('0x7f')][_0x412a('0x9f')]({'id':0x0,'priority':_0x131d73[_0x412a('0x7f')][_0x412a('0x45')]+0x1,'app':'close','appdata':_0x412a('0xa0'),'interval':_0x412a('0xa1')});}_0x131d73[_0x412a('0x9d')][_0x412a('0xa2')]=!![];}return db[_0x412a('0xa3')][_0x412a('0x59')]({'phone':_0x131d73[_0x412a('0x5a')][_0x412a('0x8a')],'messageId':_0x131d73[_0x412a('0x5a')][_0x412a('0x8e')],'body':_0x131d73[_0x412a('0x5a')][_0x412a('0x5a')],'WhatsappAccountId':_0x1cca7b[_0x412a('0x53')]['id'],'WhatsappInteractionId':_0x28f605['id'],'direction':'in','ContactId':_0x28f605[_0x412a('0xa4')],'AttachmentId':_0x131d73[_0x412a('0x5a')][_0x412a('0xa5')]});})[_0x412a('0x32')](function(_0xd99734){_0x131d73['message']=_0xd99734;if(_0x131d73['interaction'][_0x412a('0xa6')]){return db['User'][_0x412a('0x58')]({'attributes':['id',_0x412a('0x38')],'where':{'id':_0x131d73[_0x412a('0x9d')][_0x412a('0xa6')]}})[_0x412a('0x32')](function(_0x389331){if(_0x389331){_0x131d73[_0x412a('0x7f')][_0x412a('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x389331[_0x412a('0x38')]+','+(_0x131d73['account'][_0x412a('0xa8')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x412a('0xa9'),'startRouting',_0x131d73);});}return respondWithRpcPromise('Start','startRouting',_0x131d73);})[_0x412a('0x32')](function(_0x502b17){if(_0x502b17){var _0x263b20=0xc8;var _0x1d488f=_0x412a('0xaa');logger[_0x412a('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1d488f,_0x263b20,_0x412a('0xab'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1d488f,_0x263b20,_0x412a('0xab'),JSON[_0x412a('0xac')](_0x502b17));if(_0x131d73[_0x412a('0x82')][_0x412a('0x3e')]===_0x412a('0xad')){return _0x2abb96[_0x412a('0x28')](_0x263b20)[_0x412a('0x2e')]('Content-Type',_0x412a('0xae'))[_0x412a('0x39')]('\x0a');}else{return _0x2abb96[_0x412a('0x28')](_0x263b20)[_0x412a('0x2f')](_0x502b17);}}})[_0x412a('0x27')](handleError(_0x2abb96,null));};exports[_0x412a('0x39')]=function(_0x2e5329,_0x3b8ea8,_0x339778){var _0x1065b8,_0x113271,_0x570ea0;if(_[_0x412a('0x90')](_0x2e5329[_0x412a('0x5a')][_0x412a('0x5a')])||_0x2e5329[_0x412a('0x5a')][_0x412a('0x5a')]===''){throw new db[(_0x412a('0x83'))]['ValidationError'](_0x412a('0x93'));}if(_[_0x412a('0x90')](_0x2e5329[_0x412a('0x5a')]['to'])){throw new db['Sequelize'][(_0x412a('0x92'))](_0x412a('0xaf'));}_0x1065b8=_0x2e5329['body']['to'];return db[_0x412a('0x3c')]['find']({'where':{'id':_0x2e5329['params']['id']},'include':[{'model':db[_0x412a('0xb0')],'as':_0x412a('0xb1'),'include':[{'model':db[_0x412a('0x97')],'as':_0x412a('0x98'),'where':{'mobile':_0x1065b8},'limit':0x1,'order':[[_0x412a('0x86'),'DESC']]}]}]})[_0x412a('0x32')](handleEntityNotFound(_0x3b8ea8,null))['then'](function(_0x4ebe25){if(_0x4ebe25&&_0x4ebe25[_0x412a('0xb1')]){_0x113271=_0x4ebe25['get']({'plain':!![]});if(_0x113271['List']&&_0x113271[_0x412a('0xb1')][_0x412a('0x98')][_0x412a('0x45')]){return _0x113271['List']['Contacts'][0x0];}return db[_0x412a('0x97')][_0x412a('0x59')](_[_0x412a('0x9a')](_0x2e5329['body'],{'firstName':_0x1065b8,'mobile':_0x1065b8,'phone':_0x1065b8,'ListId':_0x113271[_0x412a('0x88')]}));}})[_0x412a('0x32')](handleEntityNotFound(_0x3b8ea8,null))[_0x412a('0x32')](function(_0x70d999){if(_0x70d999){_0x570ea0=_0x70d999;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x570ea0['id'],'closed':![],'WhatsappAccountId':_0x113271['id']}})[_0x412a('0x32')](function(_0x2ea116){if(_0x2ea116){return[_0x2ea116,![]];}return db[_0x412a('0x9c')]['create']({'UserId':_0x2e5329['user']['id'],'ContactId':_0x570ea0['id'],'WhatsappAccountId':_0x113271['id'],'phone':_0x1065b8,'firstMsgDirection':_0x412a('0xb2'),'Messages':[_['merge'](_0x2e5329[_0x412a('0x5a')],{'read':![],'body':_0x2e5329['body'][_0x412a('0x5a')],'phone':_0x1065b8,'WhatsappAccountId':_0x113271['id'],'UserId':_0x2e5329['user']['id'],'ContactId':_0x570ea0['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x412a('0xb3')}]})[_0x412a('0x32')](function(_0x2a474f){return[_0x2a474f,!![]];});});}})[_0x412a('0x70')](function(_0x262c09,_0x399b8a){if(_0x399b8a){return _0x262c09;}return db[_0x412a('0xa3')][_0x412a('0x59')](_[_0x412a('0x4d')](_0x2e5329[_0x412a('0x5a')],{'read':![],'body':_0x2e5329[_0x412a('0x5a')][_0x412a('0x5a')],'phone':_0x1065b8,'WhatsappAccountId':_0x113271['id'],'WhatsappInteractionId':_0x262c09['id'],'UserId':_0x2e5329[_0x412a('0x5b')]['id'],'ContactId':_0x570ea0['id']}))['then'](function(_0x237867){_0x262c09[_0x412a('0xb4')]['Messages']=[];_0x262c09[_0x412a('0xb4')][_0x412a('0xb3')][_0x412a('0x9f')](_0x237867[_0x412a('0xb4')]);return _0x262c09;});})['then'](respondWithResult(_0x3b8ea8,null))[_0x412a('0x27')](handleError(_0x3b8ea8,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 92dc4a7..6fbf861 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 _0x7f54=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x34bcfa,_0x4c9d52){var _0xc35ea7=function(_0x11a93b){while(--_0x11a93b){_0x34bcfa['push'](_0x34bcfa['shift']());}};_0xc35ea7(++_0x4c9d52);}(_0x7f54,0xa5));var _0x47f5=function(_0x40ba3e,_0x3230db){_0x40ba3e=_0x40ba3e-0x0;var _0x13f246=_0x7f54[_0x40ba3e];return _0x13f246;};'use strict';var EventEmitter=require(_0x47f5('0x0'));var WhatsappAccount=require(_0x47f5('0x1'))['db'][_0x47f5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x47f5('0x3')](0x0);var events={'afterCreate':_0x47f5('0x4'),'afterUpdate':'update','afterDestroy':_0x47f5('0x5')};function emitEvent(_0x25e00c){return function(_0x129de7,_0x5b3c9b,_0x47139c){WhatsappAccountEvents['emit'](_0x25e00c+':'+_0x129de7['id'],_0x129de7);WhatsappAccountEvents[_0x47f5('0x6')](_0x25e00c,_0x129de7);_0x47139c(null);};}for(var e in events){if(events[_0x47f5('0x7')](e)){var event=events[e];WhatsappAccount[_0x47f5('0x8')](e,emitEvent(event));}}module[_0x47f5('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x3bf6=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x47cde9,_0x19d013){var _0x26fdf1=function(_0x32fb69){while(--_0x32fb69){_0x47cde9['push'](_0x47cde9['shift']());}};_0x26fdf1(++_0x19d013);}(_0x3bf6,0x15b));var _0x63bf=function(_0x5df860,_0x4c93e2){_0x5df860=_0x5df860-0x0;var _0x48cdb9=_0x3bf6[_0x5df860];return _0x48cdb9;};'use strict';var EventEmitter=require(_0x63bf('0x0'));var WhatsappAccount=require(_0x63bf('0x1'))['db'][_0x63bf('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x63bf('0x3')](0x0);var events={'afterCreate':_0x63bf('0x4'),'afterUpdate':'update','afterDestroy':_0x63bf('0x5')};function emitEvent(_0x1508b0){return function(_0x5c3876,_0x5cd11c,_0x166251){WhatsappAccountEvents[_0x63bf('0x6')](_0x1508b0+':'+_0x5c3876['id'],_0x5c3876);WhatsappAccountEvents[_0x63bf('0x6')](_0x1508b0,_0x5c3876);_0x166251(null);};}for(var e in events){if(events[_0x63bf('0x7')](e)){var event=events[e];WhatsappAccount[_0x63bf('0x8')](e,emitEvent(event));}}module[_0x63bf('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d609c98..716165c 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 _0x38d7=['request-promise','path','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','bluebird'];(function(_0x34f823,_0xaaf7ed){var _0x425a97=function(_0x4d4ba3){while(--_0x4d4ba3){_0x34f823['push'](_0x34f823['shift']());}};_0x425a97(++_0xaaf7ed);}(_0x38d7,0x1e0));var _0x738d=function(_0x2673a4,_0x4d0b8d){_0x2673a4=_0x2673a4-0x0;var _0x5e3a6a=_0x38d7[_0x2673a4];return _0x5e3a6a;};'use strict';var _=require(_0x738d('0x0'));var util=require(_0x738d('0x1'));var logger=require('../../config/logger')(_0x738d('0x2'));var moment=require('moment');var BPromise=require(_0x738d('0x3'));var rp=require(_0x738d('0x4'));var fs=require('fs');var path=require(_0x738d('0x5'));var rimraf=require('rimraf');var config=require(_0x738d('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x738d('0x7')]=function(_0xf2cee5,_0x2a8b60){return _0xf2cee5[_0x738d('0x8')](_0x738d('0x9'),attributes,{'tableName':_0x738d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x859d=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x859d,0x16b));var _0xd859=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x859d[_0xd299c3];return _0x376574;};'use strict';var _=require('lodash');var util=require(_0xd859('0x0'));var logger=require(_0xd859('0x1'))('api');var moment=require(_0xd859('0x2'));var BPromise=require(_0xd859('0x3'));var rp=require(_0xd859('0x4'));var fs=require('fs');var path=require(_0xd859('0x5'));var rimraf=require(_0xd859('0x6'));var config=require(_0xd859('0x7'));var attributes=require(_0xd859('0x8'));module['exports']=function(_0x9fde1b,_0x3a5a90){return _0x9fde1b[_0xd859('0x9')](_0xd859('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index e29321b..f7a6e99 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 _0x38a5=['debug','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','attributes','include','map','model'];(function(_0x138b2c,_0x142181){var _0xa8b921=function(_0xc1799e){while(--_0xc1799e){_0x138b2c['push'](_0x138b2c['shift']());}};_0xa8b921(++_0x142181);}(_0x38a5,0x133));var _0x538a=function(_0x36bda5,_0x6b7b82){_0x36bda5=_0x36bda5-0x0;var _0x2bccb5=_0x38a5[_0x36bda5];return _0x2bccb5;};'use strict';var _=require(_0x538a('0x0'));var util=require(_0x538a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x538a('0x2'));var logger=require(_0x538a('0x3'))(_0x538a('0x4'));var config=require(_0x538a('0x5'));var jayson=require(_0x538a('0x6'));var client=jayson['client'][_0x538a('0x7')]({'port':0x232a});config[_0x538a('0x8')]=_[_0x538a('0x9')](config['redis'],{'host':_0x538a('0xa'),'port':0x18eb});var socket=require(_0x538a('0xb'))(new Redis(config[_0x538a('0x8')]));require(_0x538a('0xc'))[_0x538a('0xd')](socket);function respondWithRpcPromise(_0x103fdf,_0x146585,_0xb05047){return new BPromise(function(_0x1f5b56,_0x63dffc){return client['request'](_0x103fdf,_0xb05047)[_0x538a('0xe')](function(_0xd744bd){logger[_0x538a('0xf')](_0x538a('0x10'),_0x146585,_0x538a('0x11'));logger['debug'](_0x538a('0x12'),_0x146585,'request\x20sent',JSON[_0x538a('0x13')](_0xd744bd));if(_0xd744bd[_0x538a('0x14')]){if(_0xd744bd[_0x538a('0x14')][_0x538a('0x15')]===0x1f4){logger[_0x538a('0x14')](_0x538a('0x10'),_0x146585,_0xd744bd[_0x538a('0x14')][_0x538a('0x16')]);return _0x63dffc(_0xd744bd[_0x538a('0x14')][_0x538a('0x16')]);}logger[_0x538a('0x14')](_0x538a('0x10'),_0x146585,_0xd744bd[_0x538a('0x14')]['message']);return _0x1f5b56(_0xd744bd[_0x538a('0x14')][_0x538a('0x16')]);}else{logger['info'](_0x538a('0x10'),_0x146585,_0x538a('0x11'));_0x1f5b56(_0xd744bd[_0x538a('0x17')][_0x538a('0x16')]);}})[_0x538a('0x18')](function(_0x4175c0){logger[_0x538a('0x14')](_0x538a('0x10'),_0x146585,_0x4175c0);_0x63dffc(_0x4175c0);});});}exports[_0x538a('0x19')]=function(_0x29b2c8){var _0xe66138=this;return new Promise(function(_0x1f29c0,_0x4bc9d8){return db[_0x538a('0x1a')]['find']({'raw':_0x29b2c8[_0x538a('0x1b')]?_0x29b2c8[_0x538a('0x1b')][_0x538a('0x1c')]===undefined?!![]:![]:!![],'where':_0x29b2c8[_0x538a('0x1b')]?_0x29b2c8[_0x538a('0x1b')]['where']||null:null,'attributes':_0x29b2c8[_0x538a('0x1b')]?_0x29b2c8['options'][_0x538a('0x1d')]||null:null,'include':_0x29b2c8[_0x538a('0x1b')]?_0x29b2c8['options'][_0x538a('0x1e')]?_[_0x538a('0x1f')](_0x29b2c8[_0x538a('0x1b')][_0x538a('0x1e')],function(_0x8f8ecb){return{'model':db[_0x8f8ecb[_0x538a('0x20')]],'as':_0x8f8ecb['as'],'attributes':_0x8f8ecb[_0x538a('0x1d')],'include':_0x8f8ecb[_0x538a('0x1e')]?_[_0x538a('0x1f')](_0x8f8ecb[_0x538a('0x1e')],function(_0x4fac21){return{'model':db[_0x4fac21[_0x538a('0x20')]],'as':_0x4fac21['as'],'attributes':_0x4fac21[_0x538a('0x1d')],'include':_0x4fac21[_0x538a('0x1e')]?_['map'](_0x4fac21['include'],function(_0x3b6a50){return{'model':db[_0x3b6a50[_0x538a('0x20')]],'as':_0x3b6a50['as'],'attributes':_0x3b6a50[_0x538a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20f869){logger[_0x538a('0xf')]('ShowWhatsappAccount',_0x29b2c8);logger[_0x538a('0x21')](_0x538a('0x19'),_0x29b2c8,JSON['stringify'](_0x20f869));_0x1f29c0(_0x20f869);})[_0x538a('0x18')](function(_0x4a7b5e){logger['error'](_0x538a('0x19'),_0x4a7b5e['message'],_0x29b2c8);_0x4bc9d8(_0xe66138[_0x538a('0x14')](0x1f4,_0x4a7b5e[_0x538a('0x16')]));});});}; \ No newline at end of file +var _0xec33=['where','include','map','model','attributes','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','WhatsappAccount','find','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec33,0x1f4));var _0x3ec3=function(_0x50c837,_0x1891fd){_0x50c837=_0x50c837-0x0;var _0x1c85e8=_0xec33[_0x50c837];return _0x1c85e8;};'use strict';var _=require(_0x3ec3('0x0'));var util=require(_0x3ec3('0x1'));var moment=require(_0x3ec3('0x2'));var BPromise=require(_0x3ec3('0x3'));var rs=require(_0x3ec3('0x4'));var fs=require('fs');var Redis=require(_0x3ec3('0x5'));var db=require(_0x3ec3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ec3('0x7'))(_0x3ec3('0x8'));var config=require(_0x3ec3('0x9'));var jayson=require(_0x3ec3('0xa'));var client=jayson['client'][_0x3ec3('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3ec3('0xc')],{'host':_0x3ec3('0xd'),'port':0x18eb});var socket=require(_0x3ec3('0xe'))(new Redis(config['redis']));require(_0x3ec3('0xf'))[_0x3ec3('0x10')](socket);function respondWithRpcPromise(_0x3be0e5,_0x4cacb1,_0x473d40){return new BPromise(function(_0x26f9e2,_0x46b024){return client[_0x3ec3('0x11')](_0x3be0e5,_0x473d40)[_0x3ec3('0x12')](function(_0xeeb4b2){logger['info'](_0x3ec3('0x13'),_0x4cacb1,_0x3ec3('0x14'));logger[_0x3ec3('0x15')](_0x3ec3('0x16'),_0x4cacb1,_0x3ec3('0x14'),JSON[_0x3ec3('0x17')](_0xeeb4b2));if(_0xeeb4b2[_0x3ec3('0x18')]){if(_0xeeb4b2[_0x3ec3('0x18')]['code']===0x1f4){logger[_0x3ec3('0x18')](_0x3ec3('0x13'),_0x4cacb1,_0xeeb4b2['error'][_0x3ec3('0x19')]);return _0x46b024(_0xeeb4b2['error'][_0x3ec3('0x19')]);}logger['error'](_0x3ec3('0x13'),_0x4cacb1,_0xeeb4b2[_0x3ec3('0x18')]['message']);return _0x26f9e2(_0xeeb4b2['error']['message']);}else{logger[_0x3ec3('0x1a')]('WhatsappAccount,\x20%s,\x20%s',_0x4cacb1,_0x3ec3('0x14'));_0x26f9e2(_0xeeb4b2[_0x3ec3('0x1b')][_0x3ec3('0x19')]);}})[_0x3ec3('0x1c')](function(_0x8e9e9a){logger[_0x3ec3('0x18')](_0x3ec3('0x13'),_0x4cacb1,_0x8e9e9a);_0x46b024(_0x8e9e9a);});});}exports['ShowWhatsappAccount']=function(_0x662b47){var _0x151127=this;return new Promise(function(_0x35f881,_0x18a5dc){return db[_0x3ec3('0x1d')][_0x3ec3('0x1e')]({'raw':_0x662b47[_0x3ec3('0x1f')]?_0x662b47[_0x3ec3('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x662b47[_0x3ec3('0x1f')]?_0x662b47['options'][_0x3ec3('0x20')]||null:null,'attributes':_0x662b47['options']?_0x662b47['options']['attributes']||null:null,'include':_0x662b47['options']?_0x662b47['options'][_0x3ec3('0x21')]?_[_0x3ec3('0x22')](_0x662b47['options'][_0x3ec3('0x21')],function(_0x37011b){return{'model':db[_0x37011b[_0x3ec3('0x23')]],'as':_0x37011b['as'],'attributes':_0x37011b[_0x3ec3('0x24')],'include':_0x37011b[_0x3ec3('0x21')]?_[_0x3ec3('0x22')](_0x37011b['include'],function(_0x4c79dd){return{'model':db[_0x4c79dd[_0x3ec3('0x23')]],'as':_0x4c79dd['as'],'attributes':_0x4c79dd['attributes'],'include':_0x4c79dd[_0x3ec3('0x21')]?_[_0x3ec3('0x22')](_0x4c79dd[_0x3ec3('0x21')],function(_0x225902){return{'model':db[_0x225902[_0x3ec3('0x23')]],'as':_0x225902['as'],'attributes':_0x225902[_0x3ec3('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ae302){logger['info'](_0x3ec3('0x25'),_0x662b47);logger[_0x3ec3('0x15')]('ShowWhatsappAccount',_0x662b47,JSON[_0x3ec3('0x17')](_0x1ae302));_0x35f881(_0x1ae302);})[_0x3ec3('0x1c')](function(_0x4c17ef){logger[_0x3ec3('0x18')](_0x3ec3('0x25'),_0x4c17ef[_0x3ec3('0x19')],_0x662b47);_0x18a5dc(_0x151127['error'](0x1f4,_0x4c17ef[_0x3ec3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 08f3643..72ae30f 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 _0x6fed=['removeListener','length','whatsappAccount:','./whatsappAccount.events','save','update','emit'];(function(_0x555eba,_0x3cbad3){var _0x5f13f8=function(_0x2b9dd3){while(--_0x2b9dd3){_0x555eba['push'](_0x555eba['shift']());}};_0x5f13f8(++_0x3cbad3);}(_0x6fed,0xb2));var _0xd6fe=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6fed[_0x397e5f];return _0x5302b8;};'use strict';var WhatsappAccountEvents=require(_0xd6fe('0x0'));var events=[_0xd6fe('0x1'),'remove',_0xd6fe('0x2')];function createListener(_0x396e8a,_0xed66e3){return function(_0x49d0c4){_0xed66e3[_0xd6fe('0x3')](_0x396e8a,_0x49d0c4);};}function removeListener(_0x2c8a5d,_0x383a6b){return function(){WhatsappAccountEvents[_0xd6fe('0x4')](_0x2c8a5d,_0x383a6b);};}exports['register']=function(_0x38285f){for(var _0x3104ed=0x0,_0x1a36fa=events[_0xd6fe('0x5')];_0x3104ed<_0x1a36fa;_0x3104ed++){var _0x3aeb2b=events[_0x3104ed];var _0x49e5b9=createListener(_0xd6fe('0x6')+_0x3aeb2b,_0x38285f);WhatsappAccountEvents['on'](_0x3aeb2b,_0x49e5b9);}}; \ No newline at end of file +var _0x3e6c=['emit','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x47fc17,_0x512985){var _0x4cc25d=function(_0x53a9c9){while(--_0x53a9c9){_0x47fc17['push'](_0x47fc17['shift']());}};_0x4cc25d(++_0x512985);}(_0x3e6c,0xa4));var _0xc3e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e6c[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require(_0xc3e6('0x0'));var events=[_0xc3e6('0x1'),_0xc3e6('0x2'),_0xc3e6('0x3')];function createListener(_0x726683,_0x4deb48){return function(_0x276a99){_0x4deb48[_0xc3e6('0x4')](_0x726683,_0x276a99);};}function removeListener(_0x5f35aa,_0x19d146){return function(){WhatsappAccountEvents['removeListener'](_0x5f35aa,_0x19d146);};}exports['register']=function(_0x38c5bb){for(var _0x1f4622=0x0,_0x309a52=events[_0xc3e6('0x5')];_0x1f4622<_0x309a52;_0x1f4622++){var _0xa30f2f=events[_0x1f4622];var _0x16f1c9=createListener(_0xc3e6('0x6')+_0xa30f2f,_0x38c5bb);WhatsappAccountEvents['on'](_0xa30f2f,_0x16f1c9);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 64160e3..98bd663 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 _0xba4a=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2ae2bc,_0x177514){var _0x53c290=function(_0x3ac4c0){while(--_0x3ac4c0){_0x2ae2bc['push'](_0x2ae2bc['shift']());}};_0x53c290(++_0x177514);}(_0xba4a,0x166));var _0xaba4=function(_0x160f42,_0x4559b5){_0x160f42=_0x160f42-0x0;var _0x238239=_0xba4a[_0x160f42];return _0x238239;};'use strict';var multer=require(_0xaba4('0x0'));var util=require(_0xaba4('0x1'));var path=require('path');var timeout=require(_0xaba4('0x2'));var express=require(_0xaba4('0x3'));var router=express[_0xaba4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaba4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaba4('0x6'));var controller=require(_0xaba4('0x7'));router[_0xaba4('0x8')]('/',auth[_0xaba4('0x9')](),controller[_0xaba4('0xa')]);router[_0xaba4('0x8')](_0xaba4('0xb'),auth[_0xaba4('0x9')](),controller[_0xaba4('0xc')]);router[_0xaba4('0xd')]('/',auth['isAuthenticated'](),controller[_0xaba4('0xe')]);router[_0xaba4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xaba4('0x10')]);router[_0xaba4('0x11')](_0xaba4('0xb'),auth[_0xaba4('0x9')](),controller[_0xaba4('0x12')]);module[_0xaba4('0x13')]=router; \ No newline at end of file +var _0xe042=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','update'];(function(_0x48a1b2,_0x41e5f5){var _0x31cff9=function(_0x5338b9){while(--_0x5338b9){_0x48a1b2['push'](_0x48a1b2['shift']());}};_0x31cff9(++_0x41e5f5);}(_0xe042,0xd5));var _0x2e04=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xe042[_0x5ce8b9];return _0xe34be0;};'use strict';var multer=require(_0x2e04('0x0'));var util=require(_0x2e04('0x1'));var path=require(_0x2e04('0x2'));var timeout=require(_0x2e04('0x3'));var express=require(_0x2e04('0x4'));var router=express[_0x2e04('0x5')]();var fs_extra=require(_0x2e04('0x6'));var auth=require(_0x2e04('0x7'));var interaction=require(_0x2e04('0x8'));var config=require(_0x2e04('0x9'));var controller=require(_0x2e04('0xa'));router[_0x2e04('0xb')]('/',auth[_0x2e04('0xc')](),controller[_0x2e04('0xd')]);router[_0x2e04('0xb')](_0x2e04('0xe'),auth[_0x2e04('0xc')](),controller[_0x2e04('0xf')]);router[_0x2e04('0x10')]('/',auth[_0x2e04('0xc')](),controller['create']);router['put'](_0x2e04('0xe'),auth[_0x2e04('0xc')](),controller[_0x2e04('0x11')]);router[_0x2e04('0x12')](_0x2e04('0xe'),auth[_0x2e04('0xc')](),controller[_0x2e04('0x13')]);module[_0x2e04('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 534ddf1..05b69a2 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 _0x1760=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x1760,0x16b));var _0x0176=function(_0x34d88e,_0x1f87c2){_0x34d88e=_0x34d88e-0x0;var _0x4da878=_0x1760[_0x34d88e];return _0x4da878;};'use strict';var Sequelize=require(_0x0176('0x0'));module[_0x0176('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0176('0x2')],'allowNull':![],'defaultValue':_0x0176('0x3')},'appdata':{'type':Sequelize[_0x0176('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0176('0x2')],'defaultValue':_0x0176('0x5')}}; \ No newline at end of file +var _0x3bfb=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x329293,_0x24e8d7){var _0x3a60fb=function(_0x1685be){while(--_0x1685be){_0x329293['push'](_0x329293['shift']());}};_0x3a60fb(++_0x24e8d7);}(_0x3bfb,0x8a));var _0xb3bf=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x3bfb[_0x33154d];return _0x3b2f03;};'use strict';var Sequelize=require(_0xb3bf('0x0'));module[_0xb3bf('0x1')]={'priority':{'type':Sequelize[_0xb3bf('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb3bf('0x3')],'allowNull':![],'defaultValue':_0xb3bf('0x4')},'appdata':{'type':Sequelize[_0xb3bf('0x5')]()},'description':{'type':Sequelize[_0xb3bf('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb3bf('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 688c36a..49691ed 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 _0xb470=['undefined','limit','set','apply','reject','save','update','then','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','catch','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x4bfb8b,_0x10b39f){var _0x48f13c=function(_0x346d11){while(--_0x346d11){_0x4bfb8b['push'](_0x4bfb8b['shift']());}};_0x48f13c(++_0x10b39f);}(_0xb470,0x75));var _0x0b47=function(_0x48c894,_0x482f0e){_0x48c894=_0x48c894-0x0;var _0xefdcab=_0xb470[_0x48c894];return _0xefdcab;};'use strict';var emlformat=require(_0x0b47('0x0'));var rimraf=require(_0x0b47('0x1'));var zipdir=require(_0x0b47('0x2'));var jsonpatch=require(_0x0b47('0x3'));var rp=require('request-promise');var moment=require(_0x0b47('0x4'));var BPromise=require(_0x0b47('0x5'));var Mustache=require(_0x0b47('0x6'));var util=require('util');var path=require(_0x0b47('0x7'));var sox=require(_0x0b47('0x8'));var csv=require(_0x0b47('0x9'));var ejs=require(_0x0b47('0xa'));var fs=require('fs');var fs_extra=require(_0x0b47('0xb'));var _=require(_0x0b47('0xc'));var squel=require(_0x0b47('0xd'));var crypto=require(_0x0b47('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b47('0xf'));var Redis=require(_0x0b47('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0b47('0x11'));var as=require(_0x0b47('0x12'));var hardwareService=require(_0x0b47('0x13'));var logger=require(_0x0b47('0x14'))(_0x0b47('0x15'));var utils=require(_0x0b47('0x16'));var config=require(_0x0b47('0x17'));var licenseUtil=require(_0x0b47('0x18'));var db=require(_0x0b47('0x19'))['db'];function respondWithStatusCode(_0x3d8949,_0x53ce05){_0x53ce05=_0x53ce05||0xcc;return function(_0x48efdd){if(_0x48efdd){return _0x3d8949[_0x0b47('0x1a')](_0x53ce05);}return _0x3d8949['status'](_0x53ce05)[_0x0b47('0x1b')]();};}function respondWithResult(_0x1e4988,_0x4d427b){_0x4d427b=_0x4d427b||0xc8;return function(_0x36fe0a){if(_0x36fe0a){return _0x1e4988[_0x0b47('0x1c')](_0x4d427b)[_0x0b47('0x1d')](_0x36fe0a);}};}function respondWithFilteredResult(_0x379c9d,_0x387084){return function(_0x1c5e68){if(_0x1c5e68){var _0x1e9588=typeof _0x387084[_0x0b47('0x1e')]===_0x0b47('0x1f')&&typeof _0x387084[_0x0b47('0x20')]==='undefined';var _0x151eb6=_0x1c5e68['count'];var _0x11f305=_0x1e9588?0x0:_0x387084[_0x0b47('0x1e')];var _0x2b1024=_0x1e9588?_0x1c5e68['count']:_0x387084[_0x0b47('0x1e')]+_0x387084['limit'];var _0x4b5bac;if(_0x2b1024>=_0x151eb6){_0x2b1024=_0x151eb6;_0x4b5bac=0xc8;}else{_0x4b5bac=0xce;}_0x379c9d[_0x0b47('0x1c')](_0x4b5bac);return _0x379c9d[_0x0b47('0x21')]('Content-Range',_0x11f305+'-'+_0x2b1024+'/'+_0x151eb6)[_0x0b47('0x1d')](_0x1c5e68);}return null;};}function patchUpdates(_0x501357){return function(_0x450f1a){try{jsonpatch[_0x0b47('0x22')](_0x450f1a,_0x501357,!![]);}catch(_0x34b129){return BPromise[_0x0b47('0x23')](_0x34b129);}return _0x450f1a[_0x0b47('0x24')]();};}function saveUpdates(_0x2c709c,_0x3bd7f1){return function(_0x2dfdb4){if(_0x2dfdb4){return _0x2dfdb4[_0x0b47('0x25')](_0x2c709c)[_0x0b47('0x26')](function(_0x3e37e8){return _0x3e37e8;});}return null;};}function removeEntity(_0x4f79d4,_0xc87cd){return function(_0x11935a){if(_0x11935a){return _0x11935a['destroy']()[_0x0b47('0x26')](function(){_0x4f79d4[_0x0b47('0x1c')](0xcc)[_0x0b47('0x1b')]();});}};}function handleEntityNotFound(_0xd9c35c,_0x59af8e){return function(_0x47d1b2){if(!_0x47d1b2){_0xd9c35c[_0x0b47('0x1a')](0x194);}return _0x47d1b2;};}function handleError(_0x4228e5,_0x5950fa){_0x5950fa=_0x5950fa||0x1f4;return function(_0x138a03){logger[_0x0b47('0x27')](_0x138a03[_0x0b47('0x28')]);if(_0x138a03[_0x0b47('0x29')]){delete _0x138a03[_0x0b47('0x29')];}_0x4228e5[_0x0b47('0x1c')](_0x5950fa)[_0x0b47('0x2a')](_0x138a03);};}exports[_0x0b47('0x2b')]=function(_0x3550cc,_0x15d877){var _0x370022={},_0x5e90f1={},_0x5bea0d={'count':0x0,'rows':[]};var _0x10c966=_['map'](db[_0x0b47('0x2c')][_0x0b47('0x2d')],function(_0x1842ec){return{'name':_0x1842ec[_0x0b47('0x2e')],'type':_0x1842ec[_0x0b47('0x2f')]['key']};});_0x5e90f1[_0x0b47('0x30')]=_[_0x0b47('0x31')](_0x10c966,_0x0b47('0x29'));_0x5e90f1['query']=_[_0x0b47('0x32')](_0x3550cc[_0x0b47('0x33')]);_0x5e90f1[_0x0b47('0x34')]=_[_0x0b47('0x35')](_0x5e90f1[_0x0b47('0x30')],_0x5e90f1[_0x0b47('0x33')]);_0x370022['attributes']=_['intersection'](_0x5e90f1[_0x0b47('0x30')],qs[_0x0b47('0x36')](_0x3550cc[_0x0b47('0x33')][_0x0b47('0x36')]));_0x370022[_0x0b47('0x37')]=_0x370022[_0x0b47('0x37')][_0x0b47('0x38')]?_0x370022[_0x0b47('0x37')]:_0x5e90f1[_0x0b47('0x30')];if(!_0x3550cc[_0x0b47('0x33')][_0x0b47('0x39')]('nolimit')){_0x370022['limit']=qs[_0x0b47('0x20')](_0x3550cc['query'][_0x0b47('0x20')]);_0x370022[_0x0b47('0x1e')]=qs[_0x0b47('0x1e')](_0x3550cc[_0x0b47('0x33')][_0x0b47('0x1e')]);}_0x370022[_0x0b47('0x3a')]=qs['sort'](_0x3550cc['query']['sort']);_0x370022[_0x0b47('0x3b')]=qs[_0x0b47('0x34')](_[_0x0b47('0x3c')](_0x3550cc[_0x0b47('0x33')],_0x5e90f1[_0x0b47('0x34')]),_0x10c966);if(_0x3550cc[_0x0b47('0x33')]['filter']){_0x370022[_0x0b47('0x3b')]=_[_0x0b47('0x3d')](_0x370022[_0x0b47('0x3b')],{'$or':_[_0x0b47('0x31')](_0x10c966,function(_0x56f92b){if(_0x56f92b['type']!==_0x0b47('0x3e')){var _0x46f0cf={};_0x46f0cf[_0x56f92b['name']]={'$like':'%'+_0x3550cc[_0x0b47('0x33')][_0x0b47('0x3f')]+'%'};return _0x46f0cf;}})});}_0x370022=_[_0x0b47('0x3d')]({},_0x370022,_0x3550cc['options']);var _0x4c724e={'where':_0x370022[_0x0b47('0x3b')]};return db[_0x0b47('0x2c')][_0x0b47('0x40')](_0x4c724e)[_0x0b47('0x26')](function(_0x166334){_0x5bea0d[_0x0b47('0x40')]=_0x166334;if(_0x3550cc[_0x0b47('0x33')][_0x0b47('0x41')]){_0x370022[_0x0b47('0x42')]=[{'all':!![]}];}return db[_0x0b47('0x2c')][_0x0b47('0x43')](_0x370022);})[_0x0b47('0x26')](function(_0x2bd25b){_0x5bea0d['rows']=_0x2bd25b;return _0x5bea0d;})['then'](respondWithFilteredResult(_0x15d877,_0x370022))[_0x0b47('0x44')](handleError(_0x15d877,null));};exports['show']=function(_0x1d424f,_0x484efb){var _0x38e02f={'raw':!![],'where':{'id':_0x1d424f[_0x0b47('0x45')]['id']}},_0x274061={};_0x274061[_0x0b47('0x30')]=_['keys'](db[_0x0b47('0x2c')][_0x0b47('0x2d')]);_0x274061['query']=_[_0x0b47('0x32')](_0x1d424f['query']);_0x274061[_0x0b47('0x34')]=_[_0x0b47('0x35')](_0x274061[_0x0b47('0x30')],_0x274061[_0x0b47('0x33')]);_0x38e02f[_0x0b47('0x37')]=_[_0x0b47('0x35')](_0x274061[_0x0b47('0x30')],qs[_0x0b47('0x36')](_0x1d424f[_0x0b47('0x33')][_0x0b47('0x36')]));_0x38e02f['attributes']=_0x38e02f['attributes']['length']?_0x38e02f['attributes']:_0x274061[_0x0b47('0x30')];if(_0x1d424f[_0x0b47('0x33')]['includeAll']){_0x38e02f[_0x0b47('0x42')]=[{'all':!![]}];}_0x38e02f=_['merge']({},_0x38e02f,_0x1d424f[_0x0b47('0x46')]);return db[_0x0b47('0x2c')]['find'](_0x38e02f)[_0x0b47('0x26')](handleEntityNotFound(_0x484efb,null))[_0x0b47('0x26')](respondWithResult(_0x484efb,null))[_0x0b47('0x44')](handleError(_0x484efb,null));};exports[_0x0b47('0x47')]=function(_0x4ef68d,_0x279665){return db[_0x0b47('0x2c')][_0x0b47('0x47')](_0x4ef68d['body'],{})[_0x0b47('0x26')](respondWithResult(_0x279665,0xc9))[_0x0b47('0x44')](handleError(_0x279665,null));};exports['update']=function(_0x1d5789,_0x5c44b9){if(_0x1d5789['body']['id']){delete _0x1d5789[_0x0b47('0x48')]['id'];}return db[_0x0b47('0x2c')]['find']({'where':{'id':_0x1d5789[_0x0b47('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c44b9,null))[_0x0b47('0x26')](saveUpdates(_0x1d5789[_0x0b47('0x48')],null))[_0x0b47('0x26')](respondWithResult(_0x5c44b9,null))['catch'](handleError(_0x5c44b9,null));};exports['destroy']=function(_0x1c222a,_0x19d635){return db[_0x0b47('0x2c')][_0x0b47('0x49')]({'where':{'id':_0x1c222a[_0x0b47('0x45')]['id']}})[_0x0b47('0x26')](handleEntityNotFound(_0x19d635,null))[_0x0b47('0x26')](removeEntity(_0x19d635,null))[_0x0b47('0x44')](handleError(_0x19d635,null));}; \ No newline at end of file +var _0xe1c4=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappApplication','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5737f2,_0x33cce0){var _0x4ad3f9=function(_0x506e8f){while(--_0x506e8f){_0x5737f2['push'](_0x5737f2['shift']());}};_0x4ad3f9(++_0x33cce0);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x2b698c,_0x5bbdd5){_0x2b698c=_0x2b698c-0x0;var _0x535317=_0xe1c4[_0x2b698c];return _0x535317;};'use strict';var emlformat=require(_0x4e1c('0x0'));var rimraf=require(_0x4e1c('0x1'));var zipdir=require(_0x4e1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e1c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4e1c('0x4'));var util=require(_0x4e1c('0x5'));var path=require(_0x4e1c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4e1c('0x7'));var fs=require('fs');var fs_extra=require(_0x4e1c('0x8'));var _=require(_0x4e1c('0x9'));var squel=require(_0x4e1c('0xa'));var crypto=require(_0x4e1c('0xb'));var jsforce=require(_0x4e1c('0xc'));var deskjs=require(_0x4e1c('0xd'));var toCsv=require(_0x4e1c('0xe'));var querystring=require(_0x4e1c('0xf'));var Papa=require(_0x4e1c('0x10'));var Redis=require(_0x4e1c('0x11'));var authService=require(_0x4e1c('0x12'));var qs=require(_0x4e1c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e1c('0x14'));var logger=require(_0x4e1c('0x15'))('api');var utils=require(_0x4e1c('0x16'));var config=require(_0x4e1c('0x17'));var licenseUtil=require(_0x4e1c('0x18'));var db=require(_0x4e1c('0x19'))['db'];function respondWithStatusCode(_0x54b2d1,_0xb4a030){_0xb4a030=_0xb4a030||0xcc;return function(_0x12178d){if(_0x12178d){return _0x54b2d1[_0x4e1c('0x1a')](_0xb4a030);}return _0x54b2d1[_0x4e1c('0x1b')](_0xb4a030)['end']();};}function respondWithResult(_0x531159,_0x550f27){_0x550f27=_0x550f27||0xc8;return function(_0x12e7fe){if(_0x12e7fe){return _0x531159[_0x4e1c('0x1b')](_0x550f27)[_0x4e1c('0x1c')](_0x12e7fe);}};}function respondWithFilteredResult(_0x201779,_0x4d47ec){return function(_0x2cd5bc){if(_0x2cd5bc){var _0x374c78=typeof _0x4d47ec[_0x4e1c('0x1d')]===_0x4e1c('0x1e')&&typeof _0x4d47ec[_0x4e1c('0x1f')]===_0x4e1c('0x1e');var _0x58d9e3=_0x2cd5bc[_0x4e1c('0x20')];var _0x399bcc=_0x374c78?0x0:_0x4d47ec[_0x4e1c('0x1d')];var _0x46a887=_0x374c78?_0x2cd5bc[_0x4e1c('0x20')]:_0x4d47ec[_0x4e1c('0x1d')]+_0x4d47ec[_0x4e1c('0x1f')];var _0x544b08;if(_0x46a887>=_0x58d9e3){_0x46a887=_0x58d9e3;_0x544b08=0xc8;}else{_0x544b08=0xce;}_0x201779[_0x4e1c('0x1b')](_0x544b08);return _0x201779[_0x4e1c('0x21')](_0x4e1c('0x22'),_0x399bcc+'-'+_0x46a887+'/'+_0x58d9e3)[_0x4e1c('0x1c')](_0x2cd5bc);}return null;};}function patchUpdates(_0x33da37){return function(_0x427cc1){try{jsonpatch[_0x4e1c('0x23')](_0x427cc1,_0x33da37,!![]);}catch(_0x53a020){return BPromise[_0x4e1c('0x24')](_0x53a020);}return _0x427cc1[_0x4e1c('0x25')]();};}function saveUpdates(_0xc57bcc,_0x169b4e){return function(_0x3dde0d){if(_0x3dde0d){return _0x3dde0d[_0x4e1c('0x26')](_0xc57bcc)[_0x4e1c('0x27')](function(_0x19ed77){return _0x19ed77;});}return null;};}function removeEntity(_0x45c13e,_0x5ada14){return function(_0x46ad33){if(_0x46ad33){return _0x46ad33[_0x4e1c('0x28')]()[_0x4e1c('0x27')](function(){_0x45c13e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f5a5,_0x551d50){return function(_0x25cc93){if(!_0x25cc93){_0x17f5a5[_0x4e1c('0x1a')](0x194);}return _0x25cc93;};}function handleError(_0x2a2ccb,_0x564b30){_0x564b30=_0x564b30||0x1f4;return function(_0x12364d){logger[_0x4e1c('0x29')](_0x12364d['stack']);if(_0x12364d[_0x4e1c('0x2a')]){delete _0x12364d[_0x4e1c('0x2a')];}_0x2a2ccb[_0x4e1c('0x1b')](_0x564b30)[_0x4e1c('0x2b')](_0x12364d);};}exports[_0x4e1c('0x2c')]=function(_0x5ef2f7,_0xeccf79){var _0x8e3e14={},_0x1b5ba8={},_0x1c4c4a={'count':0x0,'rows':[]};var _0x504259=_[_0x4e1c('0x2d')](db[_0x4e1c('0x2e')]['rawAttributes'],function(_0x46d181){return{'name':_0x46d181['fieldName'],'type':_0x46d181[_0x4e1c('0x2f')][_0x4e1c('0x30')]};});_0x1b5ba8[_0x4e1c('0x31')]=_[_0x4e1c('0x2d')](_0x504259,'name');_0x1b5ba8[_0x4e1c('0x32')]=_['keys'](_0x5ef2f7[_0x4e1c('0x32')]);_0x1b5ba8['filters']=_[_0x4e1c('0x33')](_0x1b5ba8[_0x4e1c('0x31')],_0x1b5ba8['query']);_0x8e3e14[_0x4e1c('0x34')]=_['intersection'](_0x1b5ba8[_0x4e1c('0x31')],qs[_0x4e1c('0x35')](_0x5ef2f7[_0x4e1c('0x32')][_0x4e1c('0x35')]));_0x8e3e14[_0x4e1c('0x34')]=_0x8e3e14[_0x4e1c('0x34')][_0x4e1c('0x36')]?_0x8e3e14[_0x4e1c('0x34')]:_0x1b5ba8[_0x4e1c('0x31')];if(!_0x5ef2f7[_0x4e1c('0x32')]['hasOwnProperty'](_0x4e1c('0x37'))){_0x8e3e14[_0x4e1c('0x1f')]=qs[_0x4e1c('0x1f')](_0x5ef2f7[_0x4e1c('0x32')][_0x4e1c('0x1f')]);_0x8e3e14[_0x4e1c('0x1d')]=qs['offset'](_0x5ef2f7['query'][_0x4e1c('0x1d')]);}_0x8e3e14[_0x4e1c('0x38')]=qs[_0x4e1c('0x39')](_0x5ef2f7[_0x4e1c('0x32')]['sort']);_0x8e3e14[_0x4e1c('0x3a')]=qs[_0x4e1c('0x3b')](_['pick'](_0x5ef2f7[_0x4e1c('0x32')],_0x1b5ba8[_0x4e1c('0x3b')]),_0x504259);if(_0x5ef2f7[_0x4e1c('0x32')]['filter']){_0x8e3e14[_0x4e1c('0x3a')]=_[_0x4e1c('0x3c')](_0x8e3e14['where'],{'$or':_[_0x4e1c('0x2d')](_0x504259,function(_0x128ddd){if(_0x128ddd[_0x4e1c('0x2f')]!==_0x4e1c('0x3d')){var _0x1cb1a3={};_0x1cb1a3[_0x128ddd[_0x4e1c('0x2a')]]={'$like':'%'+_0x5ef2f7['query']['filter']+'%'};return _0x1cb1a3;}})});}_0x8e3e14=_[_0x4e1c('0x3c')]({},_0x8e3e14,_0x5ef2f7[_0x4e1c('0x3e')]);var _0x390d05={'where':_0x8e3e14[_0x4e1c('0x3a')]};return db[_0x4e1c('0x2e')][_0x4e1c('0x20')](_0x390d05)[_0x4e1c('0x27')](function(_0x6838bc){_0x1c4c4a[_0x4e1c('0x20')]=_0x6838bc;if(_0x5ef2f7[_0x4e1c('0x32')][_0x4e1c('0x3f')]){_0x8e3e14['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x4e1c('0x40')](_0x8e3e14);})[_0x4e1c('0x27')](function(_0xe26367){_0x1c4c4a[_0x4e1c('0x41')]=_0xe26367;return _0x1c4c4a;})[_0x4e1c('0x27')](respondWithFilteredResult(_0xeccf79,_0x8e3e14))[_0x4e1c('0x42')](handleError(_0xeccf79,null));};exports['show']=function(_0x18d021,_0x1da617){var _0x827f0a={'raw':!![],'where':{'id':_0x18d021[_0x4e1c('0x43')]['id']}},_0xdfb6d7={};_0xdfb6d7[_0x4e1c('0x31')]=_[_0x4e1c('0x44')](db[_0x4e1c('0x2e')][_0x4e1c('0x45')]);_0xdfb6d7[_0x4e1c('0x32')]=_[_0x4e1c('0x44')](_0x18d021['query']);_0xdfb6d7[_0x4e1c('0x3b')]=_[_0x4e1c('0x33')](_0xdfb6d7[_0x4e1c('0x31')],_0xdfb6d7[_0x4e1c('0x32')]);_0x827f0a[_0x4e1c('0x34')]=_[_0x4e1c('0x33')](_0xdfb6d7[_0x4e1c('0x31')],qs[_0x4e1c('0x35')](_0x18d021['query'][_0x4e1c('0x35')]));_0x827f0a['attributes']=_0x827f0a[_0x4e1c('0x34')][_0x4e1c('0x36')]?_0x827f0a['attributes']:_0xdfb6d7[_0x4e1c('0x31')];if(_0x18d021[_0x4e1c('0x32')]['includeAll']){_0x827f0a['include']=[{'all':!![]}];}_0x827f0a=_[_0x4e1c('0x3c')]({},_0x827f0a,_0x18d021[_0x4e1c('0x3e')]);return db[_0x4e1c('0x2e')][_0x4e1c('0x46')](_0x827f0a)['then'](handleEntityNotFound(_0x1da617,null))[_0x4e1c('0x27')](respondWithResult(_0x1da617,null))[_0x4e1c('0x42')](handleError(_0x1da617,null));};exports[_0x4e1c('0x47')]=function(_0x6fae67,_0x488fe4){return db[_0x4e1c('0x2e')][_0x4e1c('0x47')](_0x6fae67[_0x4e1c('0x48')],{})[_0x4e1c('0x27')](respondWithResult(_0x488fe4,0xc9))[_0x4e1c('0x42')](handleError(_0x488fe4,null));};exports[_0x4e1c('0x26')]=function(_0x38aa72,_0x25ba45){if(_0x38aa72[_0x4e1c('0x48')]['id']){delete _0x38aa72['body']['id'];}return db[_0x4e1c('0x2e')]['find']({'where':{'id':_0x38aa72[_0x4e1c('0x43')]['id']}})[_0x4e1c('0x27')](handleEntityNotFound(_0x25ba45,null))[_0x4e1c('0x27')](saveUpdates(_0x38aa72['body'],null))['then'](respondWithResult(_0x25ba45,null))[_0x4e1c('0x42')](handleError(_0x25ba45,null));};exports[_0x4e1c('0x28')]=function(_0x4b6910,_0x304b74){return db[_0x4e1c('0x2e')]['find']({'where':{'id':_0x4b6910['params']['id']}})[_0x4e1c('0x27')](handleEntityNotFound(_0x304b74,null))['then'](removeEntity(_0x304b74,null))[_0x4e1c('0x42')](handleError(_0x304b74,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 581ee2a..7989472 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 _0x5a93=['exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a93,0xf6));var _0x35a9=function(_0x4a1fde,_0x13def6){_0x4a1fde=_0x4a1fde-0x0;var _0x42fce6=_0x5a93[_0x4a1fde];return _0x42fce6;};'use strict';var _=require('lodash');var util=require(_0x35a9('0x0'));var logger=require('../../config/logger')(_0x35a9('0x1'));var moment=require(_0x35a9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a9('0x3'));var rimraf=require(_0x35a9('0x4'));var config=require(_0x35a9('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0x35a9('0x6')]=function(_0x27ed9f,_0x2e8a14){return _0x27ed9f[_0x35a9('0x7')](_0x35a9('0x8'),attributes,{'tableName':_0x35a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35a9('0xa'),'collate':_0x35a9('0xb')});}; \ No newline at end of file +var _0xd737=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xd737,0x85));var _0x7d73=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0xd737[_0xf1af27];return _0x46b274;};'use strict';var _=require(_0x7d73('0x0'));var util=require('util');var logger=require(_0x7d73('0x1'))('api');var moment=require(_0x7d73('0x2'));var BPromise=require(_0x7d73('0x3'));var rp=require(_0x7d73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d73('0x5'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xaa37cc,_0x20b8a9){return _0xaa37cc[_0x7d73('0x6')](_0x7d73('0x7'),attributes,{'tableName':_0x7d73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d73('0x9'),'collate':_0x7d73('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 8d16390..8950425 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 _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x53a3a0,_0x4e58c0){var _0x340b4b=function(_0x5a5e9a){while(--_0x5a5e9a){_0x53a3a0['push'](_0x53a3a0['shift']());}};_0x340b4b(++_0x4e58c0);}(_0x4c4e,0x152));var _0xe4c4=function(_0x3a12f8,_0x40e461){_0x3a12f8=_0x3a12f8-0x0;var _0x4cb4b2=_0x4c4e[_0x3a12f8];return _0x4cb4b2;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result'];(function(_0xb065e3,_0x2d01cf){var _0x1db262=function(_0x7cc0ad){while(--_0x7cc0ad){_0xb065e3['push'](_0xb065e3['shift']());}};_0x1db262(++_0x2d01cf);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3422bf,_0x21b1da){_0x3422bf=_0x3422bf-0x0;var _0x4de668=_0xf3cd[_0x3422bf];return _0x4de668;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 0f93abc..c516ee5 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 _0xe2bc=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','tracked','delete','whatsappinteraction:destroy'];(function(_0x3ad17a,_0x45a6e3){var _0x1cfbe9=function(_0x333cd4){while(--_0x333cd4){_0x3ad17a['push'](_0x3ad17a['shift']());}};_0x1cfbe9(++_0x45a6e3);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xe2bc[_0x62c958];return _0x57ec61;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/describe',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['get'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xd')]);router[_0xce2b('0x8')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x8')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['download']);router[_0xce2b('0x11')]('/',auth['isAuthenticated'](),controller[_0xce2b('0x12')]);router[_0xce2b('0x11')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x13')]);router[_0xce2b('0x11')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),interaction['tracked'](_0xce2b('0x15'),_0xce2b('0x16')),controller['addTags']);router['put']('/:id',auth[_0xce2b('0x9')](),interaction[_0xce2b('0x17')](_0xce2b('0x15'),'whatsappinteraction:update'),controller['update']);router[_0xce2b('0x18')](_0xce2b('0xc'),auth[_0xce2b('0x9')](),interaction[_0xce2b('0x17')](_0xce2b('0x15'),_0xce2b('0x19')),controller[_0xce2b('0x1a')]);router[_0xce2b('0x18')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),controller['removeTags']);module[_0xce2b('0x1b')]=router; \ No newline at end of file +var _0x5fab=['/:id/messages','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create'];(function(_0x1725fb,_0x1ab651){var _0x4e652e=function(_0x26bad5){while(--_0x26bad5){_0x1725fb['push'](_0x1725fb['shift']());}};_0x4e652e(++_0x1ab651);}(_0x5fab,0x177));var _0xb5fa=function(_0x39714b,_0x5e0b0e){_0x39714b=_0x39714b-0x0;var _0x45ed60=_0x5fab[_0x39714b];return _0x45ed60;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/messages',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')]('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);router['post'](_0xb5fa('0x15'),auth[_0xb5fa('0xb')](),controller['addMessage']);router[_0xb5fa('0x13')]('/:id/tags',auth[_0xb5fa('0xb')](),interaction[_0xb5fa('0x16')](_0xb5fa('0x17'),_0xb5fa('0x18')),controller[_0xb5fa('0x19')]);router['put']('/:id',auth[_0xb5fa('0xb')](),interaction[_0xb5fa('0x16')](_0xb5fa('0x17'),_0xb5fa('0x1a')),controller['update']);router['delete'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),interaction[_0xb5fa('0x16')](_0xb5fa('0x17'),_0xb5fa('0x1b')),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1d')](_0xb5fa('0x1e'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);module[_0xb5fa('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 8622294..cdc7f09 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 _0x5697=['exports','BOOLEAN','DATE','ENUM','out','sequelize'];(function(_0x269523,_0x896c5f){var _0x2b8608=function(_0x17d4a5){while(--_0x17d4a5){_0x269523['push'](_0x269523['shift']());}};_0x2b8608(++_0x896c5f);}(_0x5697,0x1b5));var _0x7569=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0x5697[_0x3b81eb];return _0x149491;};'use strict';var Sequelize=require(_0x7569('0x0'));var moment=require('moment');module[_0x7569('0x1')]={'closed':{'type':Sequelize[_0x7569('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7569('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7569('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7569('0x4')]('in',_0x7569('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7569('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xff2a=['moment','exports','DATE','STRING','out','ENUM','BOOLEAN'];(function(_0x50450d,_0x314c15){var _0x1c391b=function(_0x3d5c86){while(--_0x3d5c86){_0x50450d['push'](_0x50450d['shift']());}};_0x1c391b(++_0x314c15);}(_0xff2a,0x93));var _0xaff2=function(_0x1c2fd7,_0x595cf1){_0x1c2fd7=_0x1c2fd7-0x0;var _0x369e9d=_0xff2a[_0x1c2fd7];return _0x369e9d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xaff2('0x0'));module[_0xaff2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaff2('0x2')]},'disposition':{'type':Sequelize[_0xaff2('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xaff2('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xaff2('0x3')]},'read1stAt':{'type':Sequelize[_0xaff2('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xaff2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaff2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xaff2('0x5')]('in',_0xaff2('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaff2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index e03c375..602359d 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 _0x4fbf=['getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','spread','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','format','transcript-%d-%s.zip','CmContact','Contact','lastName','attachments','Attachment','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','Messages','basename','createReadStream','pipe','direction','System','firstName','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send','map','fullname','TagIds','Tags','split','forEach','catch','WhatsappInteraction','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','`\x20=\x200','having','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','push','all','rows','show','params','rawAttributes','includeAll','include','options','create','body','describe','WhatsappMessage','addMessage','omit','ids'];(function(_0x239632,_0x472e6a){var _0x2fad25=function(_0x2c7e31){while(--_0x2c7e31){_0x239632['push'](_0x239632['shift']());}};_0x2fad25(++_0x472e6a);}(_0x4fbf,0x11e));var _0xf4fb=function(_0x45357b,_0x4a6c01){_0x45357b=_0x45357b-0x0;var _0x1ebb1b=_0x4fbf[_0x45357b];return _0x1ebb1b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4fb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4fb('0x1'));var rp=require(_0xf4fb('0x2'));var moment=require(_0xf4fb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf4fb('0x4'));var util=require(_0xf4fb('0x5'));var path=require(_0xf4fb('0x6'));var sox=require(_0xf4fb('0x7'));var csv=require(_0xf4fb('0x8'));var ejs=require(_0xf4fb('0x9'));var fs=require('fs');var fs_extra=require(_0xf4fb('0xa'));var _=require(_0xf4fb('0xb'));var squel=require(_0xf4fb('0xc'));var crypto=require(_0xf4fb('0xd'));var jsforce=require(_0xf4fb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf4fb('0x8'));var querystring=require(_0xf4fb('0xf'));var Papa=require(_0xf4fb('0x10'));var Redis=require(_0xf4fb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf4fb('0x12'));var as=require(_0xf4fb('0x13'));var pdf=require(_0xf4fb('0x14'));var hardwareService=require(_0xf4fb('0x15'));var logger=require('../../config/logger')(_0xf4fb('0x16'));var utils=require(_0xf4fb('0x17'));var config=require(_0xf4fb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4fb('0x19'))['db'];config[_0xf4fb('0x1a')]=_[_0xf4fb('0x1b')](config[_0xf4fb('0x1a')],{'host':_0xf4fb('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4fb('0x1a')]));require(_0xf4fb('0x1d'))['register'](socket);function respondWithStatusCode(_0xf360a9,_0x131559){_0x131559=_0x131559||0xcc;return function(_0x2b3532){if(_0x2b3532){return _0xf360a9['sendStatus'](_0x131559);}return _0xf360a9['status'](_0x131559)[_0xf4fb('0x1e')]();};}function respondWithResult(_0x2acce9,_0x1608b4){_0x1608b4=_0x1608b4||0xc8;return function(_0x5192cb){if(_0x5192cb){return _0x2acce9[_0xf4fb('0x1f')](_0x1608b4)[_0xf4fb('0x20')](_0x5192cb);}};}function respondWithFilteredResult(_0x3fc668,_0x3dd07d){return function(_0x39d1c7){if(_0x39d1c7){var _0x845736=typeof _0x3dd07d[_0xf4fb('0x21')]===_0xf4fb('0x22')&&typeof _0x3dd07d[_0xf4fb('0x23')]===_0xf4fb('0x22');var _0x453f7d=_0x39d1c7[_0xf4fb('0x24')];var _0x15a16a=_0x845736?0x0:_0x3dd07d[_0xf4fb('0x21')];var _0x142ace=_0x845736?_0x39d1c7['count']:_0x3dd07d['offset']+_0x3dd07d['limit'];var _0x258e08;if(_0x142ace>=_0x453f7d){_0x142ace=_0x453f7d;_0x258e08=0xc8;}else{_0x258e08=0xce;}_0x3fc668[_0xf4fb('0x1f')](_0x258e08);return _0x3fc668[_0xf4fb('0x25')](_0xf4fb('0x26'),_0x15a16a+'-'+_0x142ace+'/'+_0x453f7d)['json'](_0x39d1c7);}return null;};}function patchUpdates(_0x11a3ae){return function(_0x1b84db){try{jsonpatch['apply'](_0x1b84db,_0x11a3ae,!![]);}catch(_0x1adef1){return BPromise[_0xf4fb('0x27')](_0x1adef1);}return _0x1b84db[_0xf4fb('0x28')]();};}function saveUpdates(_0x159d2c,_0xe562de){return function(_0x44af7e){if(_0x44af7e){return _0x44af7e[_0xf4fb('0x29')](_0x159d2c)['then'](function(_0x42e5dd){return _0x42e5dd;});}return null;};}function removeEntity(_0x135193,_0x4e98d9){return function(_0x5a516e){if(_0x5a516e){return _0x5a516e[_0xf4fb('0x2a')]()[_0xf4fb('0x2b')](function(){_0x135193[_0xf4fb('0x1f')](0xcc)[_0xf4fb('0x1e')]();});}};}function handleEntityNotFound(_0xb23c54,_0x314be4){return function(_0x3fae40){if(!_0x3fae40){_0xb23c54[_0xf4fb('0x2c')](0x194);}return _0x3fae40;};}function handleError(_0x298b40,_0x334d56){_0x334d56=_0x334d56||0x1f4;return function(_0x55c23d){logger['error'](_0x55c23d[_0xf4fb('0x2d')]);if(_0x55c23d[_0xf4fb('0x2e')]){delete _0x55c23d[_0xf4fb('0x2e')];}_0x298b40[_0xf4fb('0x1f')](_0x334d56)[_0xf4fb('0x2f')](_0x55c23d);};}function getInteractionUsers(_0x21bab9,_0x21f933){return new BPromise(function(_0x3693e9,_0x1c85dd){try{if(_0x21f933[_0x21bab9['id']]){_0x21bab9['Users']=_[_0xf4fb('0x30')](_0x21f933[_0x21bab9['id']],function(_0x463939){return{'id':_0x463939['id'],'fullname':_0x463939[_0xf4fb('0x31')]};});}}catch(_0x5a8f64){_0x1c85dd(_0x5a8f64);}_0x3693e9(_0x21bab9);});}function getInteractionTags(_0x418ae0,_0x1b2db0){return new BPromise(function(_0x55d58c,_0x2534b9){try{if(_0x418ae0[_0xf4fb('0x32')]){_0x418ae0[_0xf4fb('0x33')]=[];_0x418ae0[_0xf4fb('0x32')][_0xf4fb('0x34')](',')[_0xf4fb('0x35')](function(_0x28734f){_0x418ae0[_0xf4fb('0x33')]['push'](_0x1b2db0[_0x28734f]);});}delete _0x418ae0[_0xf4fb('0x32')];}catch(_0x129069){_0x2534b9(_0x129069);}_0x55d58c(_0x418ae0);});}function updateWhatsappInteraction(_0x21a572,_0x3c8d2f,_0xbfc935){return new BPromise(function(_0xcd8491,_0x211750){return getInteractionUsers(_0x21a572,_0xbfc935)['then'](function(_0x4b9f14){return getInteractionTags(_0x4b9f14,_0x3c8d2f);})[_0xf4fb('0x2b')](function(_0x204352){_0xcd8491(_0x204352);})[_0xf4fb('0x36')](function(_0x396b64){_0x211750(_0x396b64);});});}exports['index']=function(_0x243490,_0x26133e){var _0xc80234={},_0x20aad0={},_0x52e591={'count':0x0,'rows':[]};var _0x26c887=_[_0xf4fb('0x30')](db[_0xf4fb('0x37')]['rawAttributes'],function(_0x46c399){return{'name':_0x46c399['fieldName'],'type':_0x46c399['type'][_0xf4fb('0x38')]};});_0x20aad0['model']=_[_0xf4fb('0x30')](_0x26c887,_0xf4fb('0x2e'));_0x20aad0[_0xf4fb('0x39')]=_['keys'](_0x243490[_0xf4fb('0x39')]);_0x20aad0[_0xf4fb('0x3a')]=_[_0xf4fb('0x3b')](_0x20aad0[_0xf4fb('0x3c')],_0x20aad0[_0xf4fb('0x39')]);_0xc80234[_0xf4fb('0x3d')]=_[_0xf4fb('0x3b')](_0x20aad0[_0xf4fb('0x3c')],qs['fields'](_0x243490[_0xf4fb('0x39')][_0xf4fb('0x3e')]));_0xc80234[_0xf4fb('0x3d')]=_0xc80234['attributes'][_0xf4fb('0x3f')]?_0xc80234[_0xf4fb('0x3d')]:_0x20aad0[_0xf4fb('0x3c')];if(!_0x243490[_0xf4fb('0x39')]['hasOwnProperty'](_0xf4fb('0x40'))){_0xc80234[_0xf4fb('0x23')]=qs[_0xf4fb('0x23')](_0x243490[_0xf4fb('0x39')]['limit']);_0xc80234['offset']=qs[_0xf4fb('0x21')](_0x243490[_0xf4fb('0x39')][_0xf4fb('0x21')]);}_0xc80234[_0xf4fb('0x41')]=qs[_0xf4fb('0x42')](_0x243490[_0xf4fb('0x39')]['sort']);_0xc80234[_0xf4fb('0x43')]=qs[_0xf4fb('0x3a')](_[_0xf4fb('0x44')](_0x243490[_0xf4fb('0x39')],_0x20aad0[_0xf4fb('0x3a')]),_0x26c887);var _0x3d1407=[];var _0x39d3cd=squel[_0xf4fb('0x45')]()['field']('id')[_0xf4fb('0x46')](_0xf4fb('0x2e'))['field'](_0xf4fb('0x47'))[_0xf4fb('0x48')]('tools_tags');var _0x15c44a=squel[_0xf4fb('0x45')]()[_0xf4fb('0x46')](_0xf4fb('0x49'))['field']('u.fullname')['field']('ui.WhatsappInteractionId')[_0xf4fb('0x48')](_0xf4fb('0x4a'),'ui')[_0xf4fb('0x4b')](_0xf4fb('0x4c'),'u',_0xf4fb('0x4d'));var _0x445f07=squel['select']()[_0xf4fb('0x48')](_0xf4fb('0x4e'),'i')[_0xf4fb('0x4b')](_0xf4fb('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf4fb('0x4b')](_0xf4fb('0x4c'),'o',_0xf4fb('0x50'))[_0xf4fb('0x4b')](_0xf4fb('0x51'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xf4fb('0x4b')]('whatsapp_messages','me',_0xf4fb('0x52'))['left_join'](_0xf4fb('0x53'),'it',_0xf4fb('0x54'))['left_join'](_0xf4fb('0x55'),'t',_0xf4fb('0x56'));var _0x3b3ba0=squel[_0xf4fb('0x57')]();var _0x20058a=[];var _0x3cc292=squel['expr']();var _0x193ad2;if(_0x243490[_0xf4fb('0x39')]['search']){_0x193ad2=as['parseSearch'](_0x243490[_0xf4fb('0x39')][_0xf4fb('0x58')]);var _0x3282c8=_0x193ad2['sqlOperator'];for(var _0xda1cb5=0x0;_0xda1cb5<_0x193ad2[_0xf4fb('0x59')][_0xf4fb('0x3f')];_0xda1cb5++){var _0x3f1970=_0x193ad2[_0xf4fb('0x59')][_0xda1cb5];var _0xe0c24d='i';var _0x570ec9=_[_0xf4fb('0x5a')](_0x26c887,[_0xf4fb('0x2e'),_0x3f1970[_0xf4fb('0x46')]]);if(!_0x570ec9){switch(_0x3f1970['field']){case _0xf4fb('0x5b'):if(_0x3f1970[_0xf4fb('0x5c')]==0x1){_0x445f07['having']('`'+_0x3f1970[_0xf4fb('0x46')]+_0xf4fb('0x5d'));}else{_0x445f07[_0xf4fb('0x5e')]('`'+_0x3f1970['field']+'`\x20>\x200');}break;case'Contact':if(_0x3f1970['operator']===_0xf4fb('0x5f')){if(_0x3f1970[_0xf4fb('0x5c')][_0xf4fb('0x34')]('\x20')[_0xf4fb('0x3f')]>0x1){_0x3b3ba0[_0x3282c8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf4fb('0x60')](_0x3f1970[_0xf4fb('0x5c')]),null);}else{var _0x2043ea='%'+_0x3f1970[_0xf4fb('0x5c')]+'%';_0x3b3ba0[_0x3282c8](_0xf4fb('0x61'),_0x2043ea,_0x2043ea,_0x2043ea);}}else{_0x570ec9=_['find'](_0x26c887,[_0xf4fb('0x2e'),_0xf4fb('0x62')]);_0x3f1970[_0xf4fb('0x46')]=_0xf4fb('0x62');_0x550afe=as[_0xf4fb('0x63')](_0xe0c24d,_0x570ec9[_0xf4fb('0x64')],_0x3f1970);_0x3b3ba0[_0x3282c8](_0x550afe[_0xf4fb('0x65')],_0x550afe[_0xf4fb('0x5c')][_0xf4fb('0x66')],_0x550afe[_0xf4fb('0x5c')][_0xf4fb('0x1e')]);}break;case _0xf4fb('0x67'):var _0x3267c2=_0x3f1970[_0xf4fb('0x5c')][_0xf4fb('0x34')](',')[_0xf4fb('0x30')](function(_0x5bb9a9){return Number(_0x5bb9a9);});_0x3267c2[_0xf4fb('0x35')](function(_0x4977f3){_0x3cc292['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4977f3+',%');});_0x20058a=_[_0xf4fb('0x68')](_0x20058a,_0x3267c2);break;case _0xf4fb('0x69'):if(_0x3f1970[_0xf4fb('0x6a')]==='$substring'){_0x3b3ba0[_0x3282c8](_0xf4fb('0x6b'),'%'+_0x3f1970['value']+'%',null);}else{_0x570ec9=_['find'](_0x26c887,[_0xf4fb('0x2e'),_0xf4fb('0x6c')]);_0x3f1970[_0xf4fb('0x46')]=_0xf4fb('0x6c');_0x550afe=as[_0xf4fb('0x63')](_0xe0c24d,_0x570ec9[_0xf4fb('0x64')],_0x3f1970);_0x3b3ba0[_0x3282c8](_0x550afe['text'],_0x550afe[_0xf4fb('0x5c')][_0xf4fb('0x66')],_0x550afe[_0xf4fb('0x5c')]['end']);}break;case'body':_0x550afe=as[_0xf4fb('0x63')]('me',null,_0x3f1970);_0x3b3ba0[_0x3282c8](_0x550afe['text'],_0x550afe[_0xf4fb('0x5c')][_0xf4fb('0x66')],_0x550afe[_0xf4fb('0x5c')][_0xf4fb('0x1e')]);break;}}else{var _0x550afe=as[_0xf4fb('0x63')](_0xe0c24d,_0x570ec9[_0xf4fb('0x64')],_0x3f1970);_0x3b3ba0[_0x3282c8](_0x550afe[_0xf4fb('0x65')],_0x550afe[_0xf4fb('0x5c')][_0xf4fb('0x66')],_0x550afe['value'][_0xf4fb('0x1e')]);}}}else{var _0x56f467=_(_0x243490['query'])[_0xf4fb('0x6d')]()[_0xf4fb('0x30')](function(_0x12235a){return _[_0xf4fb('0x6e')](_0x26c887,[_0xf4fb('0x2e'),_0x12235a])?_0x12235a:undefined;})[_0xf4fb('0x6f')]()['value']();if(!_[_0xf4fb('0x70')](_0x56f467)){_0x56f467[_0xf4fb('0x35')](function(_0x29d344){if(_0x29d344===_0xf4fb('0x71')){_0x445f07[_0xf4fb('0x43')](_0xf4fb('0x72'),[]['concat'](_0x243490[_0xf4fb('0x39')][_0x29d344]));}else if(_0x29d344===_0xf4fb('0x73')){var _0xc54e91=JSON[_0xf4fb('0x74')](_0x243490[_0xf4fb('0x39')][_0x29d344])[_0xf4fb('0x75')];var _0x142411=JSON[_0xf4fb('0x74')](_0x243490[_0xf4fb('0x39')][_0x29d344])[_0xf4fb('0x76')];_0x445f07[_0xf4fb('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc54e91,_0x142411);}else{if(_0x243490[_0xf4fb('0x39')][_0x29d344]===_0xf4fb('0x77')){_0x445f07[_0xf4fb('0x43')]('i.'+_0x29d344+_0xf4fb('0x78'));}else{_0x445f07[_0xf4fb('0x43')]('i.'+_0x29d344+_0xf4fb('0x79'),_0x243490[_0xf4fb('0x39')][_0x29d344]);}}});}if(_0x243490['query'][_0xf4fb('0x7a')]){if(_0x243490[_0xf4fb('0x39')]['read']==0x1){_0x445f07[_0xf4fb('0x5e')](_0xf4fb('0x7b'));}else{_0x445f07[_0xf4fb('0x5e')](_0xf4fb('0x7c'));}}if(_0x243490['query'][_0xf4fb('0x7d')]){_0x20058a=_[_0xf4fb('0x7e')](_0x243490[_0xf4fb('0x39')][_0xf4fb('0x7d')])?_0x243490[_0xf4fb('0x39')][_0xf4fb('0x7d')]:new Array(_0x243490[_0xf4fb('0x39')][_0xf4fb('0x7d')]);_0x20058a[_0xf4fb('0x35')](function(_0x467259){_0x3cc292['or'](_0xf4fb('0x7f'),'%,'+_0x467259+',%');});}if(_0x243490[_0xf4fb('0x39')][_0xf4fb('0x80')]){var _0x53da19=_0x243490[_0xf4fb('0x39')][_0xf4fb('0x80')]['replace']('\x5c','\x5c\x5c')[_0xf4fb('0x81')](/'/g,'\x27\x27');if(qs[_0xf4fb('0x82')](_0x53da19)){_0x3b3ba0['or']('i.id\x20LIKE\x20?',_0x53da19+'%')['or'](_0xf4fb('0x83'),_0x53da19+'%');}else{_0x3b3ba0['or'](_0xf4fb('0x84'),qs[_0xf4fb('0x60')](_0x53da19))['or'](_0xf4fb('0x85'),_0x53da19+'%');}}}_0x445f07[_0xf4fb('0x43')](_0x3b3ba0);_0x445f07[_0xf4fb('0x86')](_0xf4fb('0x87'));var _0x519c31={'type':db[_0xf4fb('0x88')][_0xf4fb('0x89')][_0xf4fb('0x8a')],'raw':!![]};var _0x3f3e2d=_0x445f07[_0xf4fb('0x8b')]();_0x3f3e2d[_0xf4fb('0x46')](_0xf4fb('0x87'));_0x3f3e2d[_0xf4fb('0x46')](_0xf4fb('0x8c'),_0xf4fb('0x5b'));if(_0xc80234[_0xf4fb('0x41')]){_0xc80234[_0xf4fb('0x41')][_0xf4fb('0x35')](function(_0x4cd9a1){var _0x73fb5c=_0x4cd9a1[0x0]===_0xf4fb('0x8d')?_0x4cd9a1[0x0]:'i.'+_0x4cd9a1[0x0];_0x445f07[_0xf4fb('0x41')](_0x73fb5c,_0x4cd9a1[0x1]===_0xf4fb('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x20058a)){_0x445f07[_0xf4fb('0x5e')](_0x3cc292);_0x3f3e2d[_0xf4fb('0x43')](_0xf4fb('0x8f'),_0x20058a);}BPromise[_0xf4fb('0x90')]()[_0xf4fb('0x2b')](function(){if(!_0x193ad2){if(_0x243490['query'][_0xf4fb('0x71')])return;_0x3f3e2d['where'](_0xf4fb('0x91'));_0x445f07['where'](_0xf4fb('0x91'));return;}if(_0x243490['user'][_0xf4fb('0x92')]!=='agent')return;return _0x243490[_0xf4fb('0x93')][_0xf4fb('0x94')]({'attributes':['id'],'raw':!![]})[_0xf4fb('0x2b')](function(_0x86099a){if(_[_0xf4fb('0x70')](_0x86099a)){_0x3f3e2d[_0xf4fb('0x43')]('i.WhatsappAccountId\x20IS\x20NULL');_0x445f07['where'](_0xf4fb('0x95'));}else{_0x3f3e2d[_0xf4fb('0x43')](_0xf4fb('0x72'),_['map'](_0x86099a,'id'));_0x445f07[_0xf4fb('0x43')](_0xf4fb('0x72'),_['map'](_0x86099a,'id'));}});})['then'](function(){if(_0x243490['user']['role']===_0xf4fb('0x96')&&!_0x193ad2&&!_0x243490[_0xf4fb('0x39')][_0xf4fb('0x71')])return[];return db[_0xf4fb('0x97')]['query'](_0x3f3e2d[_0xf4fb('0x98')](),_0x519c31);})[_0xf4fb('0x2b')](function(_0x131560){_0x52e591[_0xf4fb('0x24')]=_0x131560[_0xf4fb('0x3f')];if(_0x52e591['count']===0x0)return[];return db[_0xf4fb('0x97')][_0xf4fb('0x39')](_0x39d3cd[_0xf4fb('0x98')](),_0x519c31)[_0xf4fb('0x2b')](function(_0x17aad9){_0x3d1407=_[_0xf4fb('0x99')](_0x17aad9,'id');_0x519c31=_[_0xf4fb('0x9a')](_0x519c31,{'model':db[_0xf4fb('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x243490[_0xf4fb('0x39')]['fields']){_0xc80234[_0xf4fb('0x3d')][_0xf4fb('0x35')](function(_0x35d687){_0x445f07['field']('i.'+_0x35d687);});}else{_0x445f07['field'](_0xf4fb('0x8c'),_0xf4fb('0x5b'));_0x445f07[_0xf4fb('0x46')](_0xf4fb('0x9b'),_0xf4fb('0x9c'));_0x445f07[_0xf4fb('0x46')]('a.mandatoryDisposition',_0xf4fb('0x9d'));_0x445f07['field'](_0xf4fb('0x9e'),_0xf4fb('0x8d'));_0x445f07[_0xf4fb('0x46')]('i.*');_0x445f07[_0xf4fb('0x46')](_0xf4fb('0x9f'),'Contact.firstName');_0x445f07[_0xf4fb('0x46')](_0xf4fb('0xa0'),_0xf4fb('0xa1'));_0x445f07['field'](_0xf4fb('0xa2'),_0xf4fb('0xa3'));_0x445f07['field']('c.phone',_0xf4fb('0xa4'));_0x445f07['field']('c.mobile',_0xf4fb('0xa5'));_0x445f07[_0xf4fb('0x46')](_0xf4fb('0xa6'),_0xf4fb('0xa7'));_0x445f07[_0xf4fb('0x46')](_0xf4fb('0xa8'),'Owner.fullname');_0x445f07['field'](_0xf4fb('0xa9'),_0xf4fb('0xaa'));_0x445f07[_0xf4fb('0x46')](_0xf4fb('0xab'),'TagIds');}if(_0xc80234[_0xf4fb('0x23')])_0x445f07[_0xf4fb('0x23')](_0xc80234[_0xf4fb('0x23')]);if(_0xc80234[_0xf4fb('0x21')])_0x445f07['offset'](_0xc80234[_0xf4fb('0x21')]);return db['sequelize'][_0xf4fb('0x39')](_0x445f07[_0xf4fb('0x98')](),_0x519c31);})[_0xf4fb('0x2b')](function(_0x3a4fc0){if(_0x3a4fc0[_0xf4fb('0x3f')]>0x0)_0x15c44a[_0xf4fb('0x43')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xf4fb('0x30')](_0x3a4fc0,'id'));return db[_0xf4fb('0x97')][_0xf4fb('0x39')](_0x15c44a[_0xf4fb('0x98')](),_0x519c31)[_0xf4fb('0x2b')](function(_0x3a3f35){var _0x318867=_[_0xf4fb('0xac')](_0x3a3f35,_0xf4fb('0xad'));var _0xa30bc0=[];_0x3a4fc0[_0xf4fb('0x35')](function(_0x45b125){_0xa30bc0[_0xf4fb('0xae')](updateWhatsappInteraction(_0x45b125,_0x3d1407,_0x318867));});return BPromise[_0xf4fb('0xaf')](_0xa30bc0);});});})[_0xf4fb('0x2b')](function(_0x20a8d4){_0x52e591[_0xf4fb('0xb0')]=_0x20a8d4;return _0x52e591;})[_0xf4fb('0x2b')](respondWithFilteredResult(_0x26133e,_0xc80234))['catch'](handleError(_0x26133e,null));};exports[_0xf4fb('0xb1')]=function(_0x2b0662,_0x598796){var _0x4fdfc3={'raw':![],'where':{'id':_0x2b0662[_0xf4fb('0xb2')]['id']}},_0x53c13a={};_0x53c13a[_0xf4fb('0x3c')]=_[_0xf4fb('0x6d')](db[_0xf4fb('0x37')][_0xf4fb('0xb3')]);_0x53c13a[_0xf4fb('0x39')]=_[_0xf4fb('0x6d')](_0x2b0662['query']);_0x53c13a[_0xf4fb('0x3a')]=_[_0xf4fb('0x3b')](_0x53c13a[_0xf4fb('0x3c')],_0x53c13a['query']);_0x4fdfc3['attributes']=_['intersection'](_0x53c13a[_0xf4fb('0x3c')],qs[_0xf4fb('0x3e')](_0x2b0662[_0xf4fb('0x39')]['fields']));_0x4fdfc3[_0xf4fb('0x3d')]=_0x4fdfc3[_0xf4fb('0x3d')][_0xf4fb('0x3f')]?_0x4fdfc3[_0xf4fb('0x3d')]:_0x53c13a[_0xf4fb('0x3c')];if(_0x2b0662['query'][_0xf4fb('0xb4')]){_0x4fdfc3[_0xf4fb('0xb5')]=[{'all':!![]}];}_0x4fdfc3=_[_0xf4fb('0x9a')]({},_0x4fdfc3,_0x2b0662[_0xf4fb('0xb6')]);return db[_0xf4fb('0x37')]['find'](_0x4fdfc3)[_0xf4fb('0x2b')](handleEntityNotFound(_0x598796,null))[_0xf4fb('0x2b')](respondWithResult(_0x598796,null))[_0xf4fb('0x36')](handleError(_0x598796,null));};exports[_0xf4fb('0xb7')]=function(_0x18685f,_0x416542){return db[_0xf4fb('0x37')][_0xf4fb('0xb7')](_0x18685f[_0xf4fb('0xb8')],{})[_0xf4fb('0x2b')](respondWithResult(_0x416542,0xc9))['catch'](handleError(_0x416542,null));};exports[_0xf4fb('0x29')]=function(_0x5d1d5a,_0x57bd4b){if(_0x5d1d5a[_0xf4fb('0xb8')]['id']){delete _0x5d1d5a[_0xf4fb('0xb8')]['id'];}return db[_0xf4fb('0x37')][_0xf4fb('0x5a')]({'where':{'id':_0x5d1d5a[_0xf4fb('0xb2')]['id']}})[_0xf4fb('0x2b')](handleEntityNotFound(_0x57bd4b,null))[_0xf4fb('0x2b')](saveUpdates(_0x5d1d5a[_0xf4fb('0xb8')],null))[_0xf4fb('0x2b')](respondWithResult(_0x57bd4b,null))[_0xf4fb('0x36')](handleError(_0x57bd4b,null));};exports[_0xf4fb('0x2a')]=function(_0x3e6218,_0x2f5ce5){return db['WhatsappInteraction'][_0xf4fb('0x5a')]({'where':{'id':_0x3e6218['params']['id']}})[_0xf4fb('0x2b')](handleEntityNotFound(_0x2f5ce5,null))[_0xf4fb('0x2b')](removeEntity(_0x2f5ce5,null))['catch'](handleError(_0x2f5ce5,null));};exports[_0xf4fb('0xb9')]=function(_0x50138d,_0x547eae){return db[_0xf4fb('0x37')]['describe']()[_0xf4fb('0x2b')](respondWithResult(_0x547eae,null))[_0xf4fb('0x36')](handleError(_0x547eae,null));};exports['addMessage']=function(_0x5604e1,_0x593906,_0x48ecd4){return db[_0xf4fb('0xba')][_0xf4fb('0x5a')]({'where':{'id':_0x5604e1[_0xf4fb('0xb2')]['id']}})[_0xf4fb('0x2b')](handleEntityNotFound(_0x593906,null))[_0xf4fb('0x2b')](function(_0x4c0838){if(_0x4c0838){return _0x4c0838[_0xf4fb('0xbb')](_0x5604e1[_0xf4fb('0xb8')]['ids'],_[_0xf4fb('0xbc')](_0x5604e1['body'],[_0xf4fb('0xbd'),'id'])||{});}})[_0xf4fb('0x2b')](respondWithResult(_0x593906,null))['catch'](handleError(_0x593906,null));};exports[_0xf4fb('0xbe')]=function(_0x262a7d,_0xaef3b9,_0x40f37f){var _0x5c26e9={'raw':![],'where':{}};var _0x31a73e={};var _0x20f0a5={'count':0x0,'rows':[]};return db[_0xf4fb('0x37')][_0xf4fb('0xbf')]({'where':{'id':_0x262a7d[_0xf4fb('0xb2')]['id']}})['then'](handleEntityNotFound(_0xaef3b9,null))[_0xf4fb('0x2b')](function(_0x161e0c){if(_0x161e0c){_0x31a73e[_0xf4fb('0x3c')]=_['keys'](db[_0xf4fb('0xba')][_0xf4fb('0xb3')]);_0x31a73e[_0xf4fb('0x39')]=_[_0xf4fb('0x6d')](_0x262a7d['query']);_0x31a73e[_0xf4fb('0x3a')]=_[_0xf4fb('0x3b')](_0x31a73e[_0xf4fb('0x3c')],_0x31a73e[_0xf4fb('0x39')]);_0x5c26e9[_0xf4fb('0x3d')]=_[_0xf4fb('0x3b')](_0x31a73e[_0xf4fb('0x3c')],qs[_0xf4fb('0x3e')](_0x262a7d[_0xf4fb('0x39')][_0xf4fb('0x3e')]));_0x5c26e9[_0xf4fb('0x3d')]=_0x5c26e9[_0xf4fb('0x3d')]['length']?_0x5c26e9[_0xf4fb('0x3d')]:_0x31a73e[_0xf4fb('0x3c')];if(!_0x262a7d[_0xf4fb('0x39')][_0xf4fb('0xc0')]('nolimit')){_0x5c26e9[_0xf4fb('0x23')]=qs[_0xf4fb('0x23')](_0x262a7d[_0xf4fb('0x39')]['limit']);_0x5c26e9[_0xf4fb('0x21')]=qs[_0xf4fb('0x21')](_0x262a7d[_0xf4fb('0x39')][_0xf4fb('0x21')]);}_0x5c26e9[_0xf4fb('0x41')]=qs['sort'](_0x262a7d[_0xf4fb('0x39')][_0xf4fb('0x42')]);_0x5c26e9['where']=qs['filters'](_['pick'](_0x262a7d[_0xf4fb('0x39')],_0x31a73e[_0xf4fb('0x3a')]));_0x5c26e9[_0xf4fb('0x43')]['WhatsappInteractionId']=_0x161e0c['id'];if(_0x262a7d[_0xf4fb('0x39')][_0xf4fb('0x80')]){_0x5c26e9['where']=_[_0xf4fb('0x9a')](_0x5c26e9[_0xf4fb('0x43')],{'$or':_['map'](_0x5c26e9[_0xf4fb('0x3d')],function(_0x143191){var _0x10add3={};_0x10add3[_0x143191]={'$like':'%'+_0x262a7d[_0xf4fb('0x39')]['filter']+'%'};return _0x10add3;})});}if(_0x262a7d['query'][_0xf4fb('0x75')]){var _0x16f729=_0x262a7d[_0xf4fb('0x39')][_0xf4fb('0x75')][_0xf4fb('0x34')](',');var _0x4314ac={};_0x4314ac[_0x16f729[0x0]]={'$gte':moment(_0x16f729[0x1])['format'](_0xf4fb('0xc1'))};_0x5c26e9['where']=_['merge'](_0x5c26e9[_0xf4fb('0x43')],_0x4314ac);}_0x5c26e9=_[_0xf4fb('0x9a')]({},_0x5c26e9,_0x262a7d[_0xf4fb('0xb6')]);return db[_0xf4fb('0xba')]['count']({'where':_0x5c26e9['where']})[_0xf4fb('0x2b')](function(_0x129a55){_0x20f0a5[_0xf4fb('0x24')]=_0x129a55;if(_0x262a7d[_0xf4fb('0x39')]['includeAll']){_0x5c26e9[_0xf4fb('0xb5')]=[{'all':!![]}];}return db[_0xf4fb('0xba')]['findAll'](_0x5c26e9);})['then'](function(_0xe1485){_0x20f0a5[_0xf4fb('0xb0')]=_0xe1485;return _0x20f0a5;});}})[_0xf4fb('0x2b')](respondWithFilteredResult(_0xaef3b9,_0x5c26e9))['catch'](handleError(_0xaef3b9,null));};exports['addTags']=function(_0x2440ed,_0x174ef3,_0x221d65){return db[_0xf4fb('0x37')][_0xf4fb('0x5a')]({'where':{'id':_0x2440ed[_0xf4fb('0xb2')]['id']}})[_0xf4fb('0x2b')](handleEntityNotFound(_0x174ef3,null))['then'](function(_0x572399){if(_0x572399){return _0x572399['setTags'](_0x2440ed[_0xf4fb('0xb8')]['ids'],_[_0xf4fb('0xbc')](_0x2440ed[_0xf4fb('0xb8')],[_0xf4fb('0xbd'),'id'])||{})[_0xf4fb('0xc2')](function(){return db[_0xf4fb('0x67')][_0xf4fb('0xc3')]({'attributes':['id','name',_0xf4fb('0x47')],'where':{'id':_0x2440ed[_0xf4fb('0xb8')]['ids']}});})[_0xf4fb('0x2b')](function(_0x520151){socket[_0xf4fb('0xc4')](_0xf4fb('0xc5'),{'id':Number(_0x2440ed[_0xf4fb('0xb2')]['id']),'tags':_0x520151||[]});return{'id':Number(_0x2440ed['params']['id']),'tags':_0x520151||[]};});}})[_0xf4fb('0x2b')](respondWithResult(_0x174ef3,null))[_0xf4fb('0x36')](handleError(_0x174ef3,null));};exports[_0xf4fb('0xc6')]=function(_0x12c1b1,_0x8caa18,_0x565699){return db[_0xf4fb('0x37')][_0xf4fb('0x5a')]({'where':{'id':_0x12c1b1['params']['id']}})['then'](handleEntityNotFound(_0x8caa18,null))[_0xf4fb('0x2b')](function(_0xb70674){if(_0xb70674){return _0xb70674['removeTags'](_0x12c1b1[_0xf4fb('0x39')][_0xf4fb('0xbd')]);}})[_0xf4fb('0x2b')](respondWithStatusCode(_0x8caa18,null))[_0xf4fb('0x36')](handleError(_0x8caa18,null));};exports[_0xf4fb('0xc7')]=function(_0x58b592,_0x2b3bf7){var _0x3bc9c4=moment()[_0xf4fb('0xc8')]()['toString']();var _0x1dd9b0=path[_0xf4fb('0xc9')](config[_0xf4fb('0xca')],_0xf4fb('0xcb'),_0xf4fb('0xcc'),'tmp');var _0x301df2=path['join'](config[_0xf4fb('0xca')],_0xf4fb('0xcb'),_0xf4fb('0xcc'),'attachments');var _0x5c11fa=path[_0xf4fb('0xc9')](_0x1dd9b0,_0x3bc9c4);var _0x79fd2=util[_0xf4fb('0xcd')](_0xf4fb('0xce'),_0x58b592[_0xf4fb('0xb2')]['id'],_0x3bc9c4);var _0x4fdc21=path[_0xf4fb('0xc9')](_0x1dd9b0,_0x79fd2);var _0xbeaa0b=[];_0xbeaa0b[_0xf4fb('0xae')]({'model':db['User'],'as':_0xf4fb('0x69'),'attributes':['id',_0xf4fb('0x31')],'raw':!![]});_0xbeaa0b[_0xf4fb('0xae')]({'model':db[_0xf4fb('0xcf')],'as':_0xf4fb('0xd0'),'attributes':['id','firstName',_0xf4fb('0xd1')],'raw':!![]});if(_0x58b592['query'][_0xf4fb('0xd2')]){_0xbeaa0b['push']({'model':db[_0xf4fb('0xd3')],'as':'Attachment','raw':!![]});}var _0x14a21d=[{'model':db[_0xf4fb('0xba')],'as':'Messages','attributes':['id',_0xf4fb('0xb8'),'createdAt','direction',_0xf4fb('0xd4'),_0xf4fb('0x7a')],'include':_0xbeaa0b}];_0x14a21d[_0xf4fb('0xae')]({'model':db[_0xf4fb('0xd5')],'as':_0xf4fb('0xd6'),'attributes':['id',_0xf4fb('0x2e')]});_0x14a21d[_0xf4fb('0xae')]({'model':db[_0xf4fb('0x69')],'as':_0xf4fb('0xd7'),'attributes':['id',_0xf4fb('0x31')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x58b592['params']['id']},'include':_0x14a21d})[_0xf4fb('0x2b')](handleEntityNotFound(_0x2b3bf7,null))[_0xf4fb('0x2b')](function(_0x2da9b6){if(_0x2da9b6){var _0x220ebc=_0x2da9b6[_0xf4fb('0xd8')]({'plain':!![]});fs[_0xf4fb('0xd9')](_0x5c11fa);var _0x501d54={'channel':'Whatsapp','account':_0x220ebc['Account'][_0xf4fb('0x2e')],'agent':_0x220ebc[_0xf4fb('0xd7')]?_0x220ebc[_0xf4fb('0xd7')]['fullname']:_0xf4fb('0xda'),'createdAt':moment(_0x220ebc[_0xf4fb('0x73')])['format'](_0xf4fb('0xc1'))[_0xf4fb('0x98')](),'closedAt':_0x220ebc['closed']?moment(_0x220ebc[_0xf4fb('0xdb')])[_0xf4fb('0xcd')](_0xf4fb('0xc1'))[_0xf4fb('0x98')]():'','disposition':_0x220ebc[_0xf4fb('0xdc')],'messages':_(_0x220ebc[_0xf4fb('0xdd')])[_0xf4fb('0x80')]({'secret':![]})[_0xf4fb('0x30')](function(_0x148759){if(_0x148759[_0xf4fb('0xd3')]){var _0x7ae823=path[_0xf4fb('0xc9')](_0x301df2,_0x148759[_0xf4fb('0xd3')][_0xf4fb('0xde')]);if(fs['existsSync'](_0x7ae823)){fs[_0xf4fb('0xdf')](_0x7ae823)[_0xf4fb('0xe0')](fs['createWriteStream'](path['join'](_0x5c11fa,_0x148759[_0xf4fb('0xd3')][_0xf4fb('0xde')])));}}return{'date':moment(_0x148759[_0xf4fb('0x73')])['format'](_0xf4fb('0xc1'))[_0xf4fb('0x98')](),'sender':_0x148759[_0xf4fb('0xe1')]==='out'?_0x148759['User']?_0x148759[_0xf4fb('0x69')][_0xf4fb('0x31')]:_0xf4fb('0xe2'):_0x148759[_0xf4fb('0xd0')][_0xf4fb('0xe3')]+(_0x148759[_0xf4fb('0xd0')][_0xf4fb('0xd1')]?'\x20'+_0x148759[_0xf4fb('0xd0')][_0xf4fb('0xd1')]:''),'body':_0x148759[_0xf4fb('0xd3')]?_0x148759[_0xf4fb('0xd3')][_0xf4fb('0xde')]:_0x148759[_0xf4fb('0xb8')],'direction':_0x148759[_0xf4fb('0xe1')]===_0xf4fb('0xe4')?'A':'C','secret':_0x148759['secret'],'read':_0x148759[_0xf4fb('0x7a')],'attachment':_0x148759['Attachment']};})['value']()};return ejs[_0xf4fb('0xe5')](path[_0xf4fb('0xc9')](config[_0xf4fb('0xca')],'server',_0xf4fb('0xe6'),_0xf4fb('0xe7')),{'interaction':_0x501d54})[_0xf4fb('0x2b')](function(_0x48d2f0){var _0xabf4c6=path[_0xf4fb('0xc9')](_0x5c11fa,_0xf4fb('0xe8')+_0x220ebc['id']+'-'+_0x3bc9c4+_0xf4fb('0xe9'));var _0x1ba88f={'path':_0xabf4c6,'channel':_0xf4fb('0xea'),'interactionId':_0x220ebc['id']};return pdf[_0xf4fb('0xeb')](_0x48d2f0,_0x1ba88f);})[_0xf4fb('0x2b')](function(){return new BPromise(function(_0x653f65,_0x33fb3c){zipdir(_0x5c11fa,{'saveTo':_0x4fdc21},function(_0x138dc6,_0x9727ad){if(_0x138dc6)return _0x33fb3c(_0x138dc6);return _0x653f65(_0x9727ad);});})[_0xf4fb('0x2b')](function(){return new BPromise(function(_0x4c2ef0,_0x232644){rimraf(_0x5c11fa,function(_0x2375e1){if(_0x2375e1)_0x232644(_0x2375e1);return _0x4c2ef0();});});})[_0xf4fb('0x2b')](function(){return _0x2b3bf7[_0xf4fb('0xc7')](_0x4fdc21,_0x79fd2,function(_0x436f09){if(_0x436f09){console[_0xf4fb('0xec')](_0xf4fb('0xed'),_0x436f09);}else{fs['unlinkSync'](_0x4fdc21);}});});});}else{return _0x2b3bf7[_0xf4fb('0x2c')](0xc8);}})[_0xf4fb('0x36')](handleError(_0x2b3bf7,null));}; \ No newline at end of file +var _0x6953=['`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','agent','user','getWhatsappAccounts','role','sequelize','keyBy','merge','WhatsappInteraction','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','toString','groupBy','WhatsappInteractionId','all','rows','catch','show','params','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','color','emit','whatsappInteractionTags:save','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','disposition','basename','createReadStream','createWriteStream','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','eml-format','rimraf','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','stack','name','send','Users','fullname','TagIds','Tags','split','push','then','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having'];(function(_0x5e343c,_0x5d5c6a){var _0x497243=function(_0x49bcda){while(--_0x49bcda){_0x5e343c['push'](_0x5e343c['shift']());}};_0x497243(++_0x5d5c6a);}(_0x6953,0x91));var _0x3695=function(_0x375c32,_0x40aa91){_0x375c32=_0x375c32-0x0;var _0x1fd9b6=_0x6953[_0x375c32];return _0x1fd9b6;};'use strict';var emlformat=require(_0x3695('0x0'));var rimraf=require(_0x3695('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3695('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3695('0x3'));var util=require(_0x3695('0x4'));var path=require(_0x3695('0x5'));var sox=require('sox');var csv=require(_0x3695('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3695('0x7'));var _=require(_0x3695('0x8'));var squel=require(_0x3695('0x9'));var crypto=require(_0x3695('0xa'));var jsforce=require(_0x3695('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3695('0x6'));var querystring=require('querystring');var Papa=require(_0x3695('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3695('0xd'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x3695('0xe'));var hardwareService=require(_0x3695('0xf'));var logger=require(_0x3695('0x10'))(_0x3695('0x11'));var utils=require(_0x3695('0x12'));var config=require(_0x3695('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3695('0x14'))['db'];config[_0x3695('0x15')]=_[_0x3695('0x16')](config[_0x3695('0x15')],{'host':_0x3695('0x17'),'port':0x18eb});var socket=require(_0x3695('0x18'))(new Redis(config[_0x3695('0x15')]));require(_0x3695('0x19'))[_0x3695('0x1a')](socket);function respondWithStatusCode(_0xc5dc5,_0x1ffebd){_0x1ffebd=_0x1ffebd||0xcc;return function(_0x4ca317){if(_0x4ca317){return _0xc5dc5[_0x3695('0x1b')](_0x1ffebd);}return _0xc5dc5[_0x3695('0x1c')](_0x1ffebd)[_0x3695('0x1d')]();};}function respondWithResult(_0x3cb320,_0x367191){_0x367191=_0x367191||0xc8;return function(_0x1973ee){if(_0x1973ee){return _0x3cb320[_0x3695('0x1c')](_0x367191)['json'](_0x1973ee);}};}function respondWithFilteredResult(_0x717ee4,_0x5edf8d){return function(_0x1082db){if(_0x1082db){var _0xcc93bb=typeof _0x5edf8d[_0x3695('0x1e')]===_0x3695('0x1f')&&typeof _0x5edf8d[_0x3695('0x20')]==='undefined';var _0x1bb921=_0x1082db[_0x3695('0x21')];var _0x33901c=_0xcc93bb?0x0:_0x5edf8d[_0x3695('0x1e')];var _0xc076a9=_0xcc93bb?_0x1082db[_0x3695('0x21')]:_0x5edf8d[_0x3695('0x1e')]+_0x5edf8d[_0x3695('0x20')];var _0x1f267a;if(_0xc076a9>=_0x1bb921){_0xc076a9=_0x1bb921;_0x1f267a=0xc8;}else{_0x1f267a=0xce;}_0x717ee4[_0x3695('0x1c')](_0x1f267a);return _0x717ee4[_0x3695('0x22')](_0x3695('0x23'),_0x33901c+'-'+_0xc076a9+'/'+_0x1bb921)[_0x3695('0x24')](_0x1082db);}return null;};}function patchUpdates(_0x30d713){return function(_0x5340f2){try{jsonpatch[_0x3695('0x25')](_0x5340f2,_0x30d713,!![]);}catch(_0xdb0934){return BPromise['reject'](_0xdb0934);}return _0x5340f2['save']();};}function saveUpdates(_0x3ac6aa,_0x26d9fc){return function(_0x951370){if(_0x951370){return _0x951370[_0x3695('0x26')](_0x3ac6aa)['then'](function(_0x180f77){return _0x180f77;});}return null;};}function removeEntity(_0x48c2fd,_0xeddb06){return function(_0x5319f4){if(_0x5319f4){return _0x5319f4[_0x3695('0x27')]()['then'](function(){_0x48c2fd[_0x3695('0x1c')](0xcc)[_0x3695('0x1d')]();});}};}function handleEntityNotFound(_0x462ff0,_0x18a474){return function(_0x3d4442){if(!_0x3d4442){_0x462ff0[_0x3695('0x1b')](0x194);}return _0x3d4442;};}function handleError(_0x54b12e,_0x2be6ee){_0x2be6ee=_0x2be6ee||0x1f4;return function(_0x354ae0){logger['error'](_0x354ae0[_0x3695('0x28')]);if(_0x354ae0['name']){delete _0x354ae0[_0x3695('0x29')];}_0x54b12e[_0x3695('0x1c')](_0x2be6ee)[_0x3695('0x2a')](_0x354ae0);};}function getInteractionUsers(_0x23ac01,_0x30a5ba){return new BPromise(function(_0x21f379,_0x3a6e8e){try{if(_0x30a5ba[_0x23ac01['id']]){_0x23ac01[_0x3695('0x2b')]=_['map'](_0x30a5ba[_0x23ac01['id']],function(_0x35c67a){return{'id':_0x35c67a['id'],'fullname':_0x35c67a[_0x3695('0x2c')]};});}}catch(_0xe6455e){_0x3a6e8e(_0xe6455e);}_0x21f379(_0x23ac01);});}function getInteractionTags(_0x4c604f,_0x5d54ef){return new BPromise(function(_0xb3a62d,_0x49b42d){try{if(_0x4c604f[_0x3695('0x2d')]){_0x4c604f[_0x3695('0x2e')]=[];_0x4c604f['TagIds'][_0x3695('0x2f')](',')['forEach'](function(_0x2ad432){_0x4c604f[_0x3695('0x2e')][_0x3695('0x30')](_0x5d54ef[_0x2ad432]);});}delete _0x4c604f[_0x3695('0x2d')];}catch(_0x30eab2){_0x49b42d(_0x30eab2);}_0xb3a62d(_0x4c604f);});}function updateWhatsappInteraction(_0x3f6433,_0x47a18f,_0x3ab2a0){return new BPromise(function(_0x33043e,_0x4cd1ac){return getInteractionUsers(_0x3f6433,_0x3ab2a0)[_0x3695('0x31')](function(_0x40e356){return getInteractionTags(_0x40e356,_0x47a18f);})['then'](function(_0x507c57){_0x33043e(_0x507c57);})['catch'](function(_0x4d3b2c){_0x4cd1ac(_0x4d3b2c);});});}exports[_0x3695('0x32')]=function(_0x6e2804,_0x556ca4){var _0x415604={},_0x323e21={},_0x19d2b4={'count':0x0,'rows':[]};var _0x33d5c6=_['map'](db['WhatsappInteraction'][_0x3695('0x33')],function(_0x470907){return{'name':_0x470907['fieldName'],'type':_0x470907[_0x3695('0x34')][_0x3695('0x35')]};});_0x323e21[_0x3695('0x36')]=_[_0x3695('0x37')](_0x33d5c6,_0x3695('0x29'));_0x323e21[_0x3695('0x38')]=_[_0x3695('0x39')](_0x6e2804[_0x3695('0x38')]);_0x323e21[_0x3695('0x3a')]=_[_0x3695('0x3b')](_0x323e21[_0x3695('0x36')],_0x323e21[_0x3695('0x38')]);_0x415604[_0x3695('0x3c')]=_[_0x3695('0x3b')](_0x323e21[_0x3695('0x36')],qs[_0x3695('0x3d')](_0x6e2804['query'][_0x3695('0x3d')]));_0x415604[_0x3695('0x3c')]=_0x415604[_0x3695('0x3c')][_0x3695('0x3e')]?_0x415604[_0x3695('0x3c')]:_0x323e21[_0x3695('0x36')];if(!_0x6e2804[_0x3695('0x38')]['hasOwnProperty'](_0x3695('0x3f'))){_0x415604[_0x3695('0x20')]=qs[_0x3695('0x20')](_0x6e2804['query'][_0x3695('0x20')]);_0x415604[_0x3695('0x1e')]=qs[_0x3695('0x1e')](_0x6e2804[_0x3695('0x38')][_0x3695('0x1e')]);}_0x415604[_0x3695('0x40')]=qs[_0x3695('0x41')](_0x6e2804['query'][_0x3695('0x41')]);_0x415604['where']=qs['filters'](_[_0x3695('0x42')](_0x6e2804['query'],_0x323e21[_0x3695('0x3a')]),_0x33d5c6);var _0x30bff0=[];var _0x65f4b3=squel[_0x3695('0x43')]()['field']('id')[_0x3695('0x44')](_0x3695('0x29'))[_0x3695('0x44')]('color')[_0x3695('0x45')](_0x3695('0x46'));var _0x172855=squel[_0x3695('0x43')]()[_0x3695('0x44')](_0x3695('0x47'))[_0x3695('0x44')](_0x3695('0x48'))[_0x3695('0x44')]('ui.WhatsappInteractionId')['from'](_0x3695('0x49'),'ui')[_0x3695('0x4a')](_0x3695('0x4b'),'u','u.id\x20=\x20ui.UserId');var _0x1c8fc3=squel[_0x3695('0x43')]()[_0x3695('0x45')]('whatsapp_interactions','i')[_0x3695('0x4a')](_0x3695('0x4c'),'c',_0x3695('0x4d'))[_0x3695('0x4a')](_0x3695('0x4b'),'o','o.id\x20=\x20i.UserId')[_0x3695('0x4a')](_0x3695('0x4e'),'a',_0x3695('0x4f'))[_0x3695('0x4a')]('whatsapp_messages','me',_0x3695('0x50'))['left_join']('whatsapp_interaction_has_tags','it',_0x3695('0x51'))[_0x3695('0x4a')](_0x3695('0x46'),'t',_0x3695('0x52'));var _0xf34cc3=squel['expr']();var _0x57c0e4=[];var _0x527d89=squel[_0x3695('0x53')]();var _0x5eeaca;if(_0x6e2804['query']['search']){_0x5eeaca=as['parseSearch'](_0x6e2804[_0x3695('0x38')][_0x3695('0x54')]);var _0x5561a5=_0x5eeaca[_0x3695('0x55')];for(var _0x89c360=0x0;_0x89c360<_0x5eeaca['conditions']['length'];_0x89c360++){var _0x419ed6=_0x5eeaca[_0x3695('0x56')][_0x89c360];var _0x1a61d6='i';var _0x56f7df=_[_0x3695('0x57')](_0x33d5c6,[_0x3695('0x29'),_0x419ed6[_0x3695('0x44')]]);if(!_0x56f7df){switch(_0x419ed6[_0x3695('0x44')]){case _0x3695('0x58'):if(_0x419ed6[_0x3695('0x59')]==0x1){_0x1c8fc3[_0x3695('0x5a')]('`'+_0x419ed6[_0x3695('0x44')]+_0x3695('0x5b'));}else{_0x1c8fc3[_0x3695('0x5a')]('`'+_0x419ed6[_0x3695('0x44')]+_0x3695('0x5c'));}break;case _0x3695('0x5d'):if(_0x419ed6[_0x3695('0x5e')]===_0x3695('0x5f')){if(_0x419ed6[_0x3695('0x59')][_0x3695('0x2f')]('\x20')[_0x3695('0x3e')]>0x1){_0xf34cc3[_0x5561a5](_0x3695('0x60'),qs[_0x3695('0x61')](_0x419ed6[_0x3695('0x59')]),null);}else{var _0x4148ec='%'+_0x419ed6[_0x3695('0x59')]+'%';_0xf34cc3[_0x5561a5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4148ec,_0x4148ec,_0x4148ec);}}else{_0x56f7df=_['find'](_0x33d5c6,[_0x3695('0x29'),_0x3695('0x62')]);_0x419ed6['field']=_0x3695('0x62');_0x3f2985=as[_0x3695('0x63')](_0x1a61d6,_0x56f7df[_0x3695('0x34')],_0x419ed6);_0xf34cc3[_0x5561a5](_0x3f2985[_0x3695('0x64')],_0x3f2985[_0x3695('0x59')][_0x3695('0x65')],_0x3f2985[_0x3695('0x59')][_0x3695('0x1d')]);}break;case _0x3695('0x66'):var _0x29c8a3=_0x419ed6['value'][_0x3695('0x2f')](',')[_0x3695('0x37')](function(_0x1e101f){return Number(_0x1e101f);});_0x29c8a3[_0x3695('0x67')](function(_0x380ddc){_0x527d89['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x380ddc+',%');});_0x57c0e4=_[_0x3695('0x68')](_0x57c0e4,_0x29c8a3);break;case _0x3695('0x69'):if(_0x419ed6[_0x3695('0x5e')]==='$substring'){_0xf34cc3[_0x5561a5](_0x3695('0x6a'),'%'+_0x419ed6[_0x3695('0x59')]+'%',null);}else{_0x56f7df=_['find'](_0x33d5c6,['name',_0x3695('0x6b')]);_0x419ed6['field']='UserId';_0x3f2985=as[_0x3695('0x63')](_0x1a61d6,_0x56f7df[_0x3695('0x34')],_0x419ed6);_0xf34cc3[_0x5561a5](_0x3f2985[_0x3695('0x64')],_0x3f2985[_0x3695('0x59')][_0x3695('0x65')],_0x3f2985['value'][_0x3695('0x1d')]);}break;case _0x3695('0x6c'):_0x3f2985=as[_0x3695('0x63')]('me',null,_0x419ed6);_0xf34cc3[_0x5561a5](_0x3f2985['text'],_0x3f2985[_0x3695('0x59')][_0x3695('0x65')],_0x3f2985[_0x3695('0x59')][_0x3695('0x1d')]);break;}}else{var _0x3f2985=as[_0x3695('0x63')](_0x1a61d6,_0x56f7df['type'],_0x419ed6);_0xf34cc3[_0x5561a5](_0x3f2985[_0x3695('0x64')],_0x3f2985[_0x3695('0x59')][_0x3695('0x65')],_0x3f2985[_0x3695('0x59')][_0x3695('0x1d')]);}}}else{var _0x5147df=_(_0x6e2804[_0x3695('0x38')])[_0x3695('0x39')]()[_0x3695('0x37')](function(_0x188bdc){return _[_0x3695('0x6d')](_0x33d5c6,[_0x3695('0x29'),_0x188bdc])?_0x188bdc:undefined;})['compact']()[_0x3695('0x59')]();if(!_[_0x3695('0x6e')](_0x5147df)){_0x5147df['forEach'](function(_0x4e7d7a){if(_0x4e7d7a===_0x3695('0x6f')){_0x1c8fc3[_0x3695('0x70')](_0x3695('0x71'),[]['concat'](_0x6e2804[_0x3695('0x38')][_0x4e7d7a]));}else if(_0x4e7d7a===_0x3695('0x72')){var _0x1bd95d=JSON[_0x3695('0x73')](_0x6e2804[_0x3695('0x38')][_0x4e7d7a])['$gte'];var _0x41f968=JSON['parse'](_0x6e2804['query'][_0x4e7d7a])['$lte'];_0x1c8fc3[_0x3695('0x70')](_0x3695('0x74'),_0x1bd95d,_0x41f968);}else{if(_0x6e2804[_0x3695('0x38')][_0x4e7d7a]===_0x3695('0x75')){_0x1c8fc3[_0x3695('0x70')]('i.'+_0x4e7d7a+_0x3695('0x76'));}else{_0x1c8fc3[_0x3695('0x70')]('i.'+_0x4e7d7a+_0x3695('0x77'),_0x6e2804[_0x3695('0x38')][_0x4e7d7a]);}}});}if(_0x6e2804[_0x3695('0x38')][_0x3695('0x78')]){if(_0x6e2804[_0x3695('0x38')][_0x3695('0x78')]==0x1){_0x1c8fc3[_0x3695('0x5a')](_0x3695('0x79'));}else{_0x1c8fc3[_0x3695('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x6e2804[_0x3695('0x38')][_0x3695('0x7a')]){_0x57c0e4=_[_0x3695('0x7b')](_0x6e2804[_0x3695('0x38')][_0x3695('0x7a')])?_0x6e2804[_0x3695('0x38')]['tag']:new Array(_0x6e2804[_0x3695('0x38')][_0x3695('0x7a')]);_0x57c0e4['forEach'](function(_0x4ddb70){_0x527d89['or'](_0x3695('0x7c'),'%,'+_0x4ddb70+',%');});}if(_0x6e2804['query'][_0x3695('0x7d')]){var _0x4489c6=_0x6e2804[_0x3695('0x38')][_0x3695('0x7d')][_0x3695('0x7e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x3695('0x7f')](_0x4489c6)){_0xf34cc3['or'](_0x3695('0x80'),_0x4489c6+'%')['or'](_0x3695('0x81'),_0x4489c6+'%');}else{_0xf34cc3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4489c6))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4489c6+'%');}}}_0x1c8fc3[_0x3695('0x70')](_0xf34cc3);_0x1c8fc3[_0x3695('0x82')]('i.id');var _0x3ae26f={'type':db[_0x3695('0x83')][_0x3695('0x84')][_0x3695('0x85')],'raw':!![]};var _0x167830=_0x1c8fc3[_0x3695('0x86')]();_0x167830[_0x3695('0x44')](_0x3695('0x87'));_0x167830['field'](_0x3695('0x88'),_0x3695('0x58'));if(_0x415604[_0x3695('0x40')]){_0x415604[_0x3695('0x40')][_0x3695('0x67')](function(_0x2895e5){var _0x2fae6e=_0x2895e5[0x0]===_0x3695('0x89')?_0x2895e5[0x0]:'i.'+_0x2895e5[0x0];_0x1c8fc3['order'](_0x2fae6e,_0x2895e5[0x1]===_0x3695('0x8a')?![]:!![]);});}if(!_[_0x3695('0x6e')](_0x57c0e4)){_0x1c8fc3[_0x3695('0x5a')](_0x527d89);_0x167830[_0x3695('0x70')](_0x3695('0x8b'),_0x57c0e4);}BPromise[_0x3695('0x8c')]()[_0x3695('0x31')](function(){if(!_0x5eeaca){if(_0x6e2804[_0x3695('0x38')][_0x3695('0x6f')])return;_0x167830[_0x3695('0x70')](_0x3695('0x8d'));_0x1c8fc3[_0x3695('0x70')](_0x3695('0x8d'));return;}if(_0x6e2804['user']['role']!==_0x3695('0x8e'))return;return _0x6e2804[_0x3695('0x8f')][_0x3695('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x407888){if(_[_0x3695('0x6e')](_0x407888)){_0x167830[_0x3695('0x70')]('i.WhatsappAccountId\x20IS\x20NULL');_0x1c8fc3[_0x3695('0x70')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x167830[_0x3695('0x70')](_0x3695('0x71'),_[_0x3695('0x37')](_0x407888,'id'));_0x1c8fc3[_0x3695('0x70')](_0x3695('0x71'),_['map'](_0x407888,'id'));}});})[_0x3695('0x31')](function(){if(_0x6e2804[_0x3695('0x8f')][_0x3695('0x91')]===_0x3695('0x8e')&&!_0x5eeaca&&!_0x6e2804[_0x3695('0x38')][_0x3695('0x6f')])return[];return db[_0x3695('0x92')][_0x3695('0x38')](_0x167830['toString'](),_0x3ae26f);})[_0x3695('0x31')](function(_0x5c2b14){_0x19d2b4['count']=_0x5c2b14['length'];if(_0x19d2b4[_0x3695('0x21')]===0x0)return[];return db[_0x3695('0x92')][_0x3695('0x38')](_0x65f4b3['toString'](),_0x3ae26f)[_0x3695('0x31')](function(_0x47b55e){_0x30bff0=_[_0x3695('0x93')](_0x47b55e,'id');_0x3ae26f=_[_0x3695('0x94')](_0x3ae26f,{'model':db[_0x3695('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6e2804['query'][_0x3695('0x3d')]){_0x415604[_0x3695('0x3c')]['forEach'](function(_0x49746d){_0x1c8fc3['field']('i.'+_0x49746d);});}else{_0x1c8fc3[_0x3695('0x44')](_0x3695('0x88'),_0x3695('0x58'));_0x1c8fc3['field']('a.key','Account.key');_0x1c8fc3['field']('a.mandatoryDisposition',_0x3695('0x96'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0x97'),_0x3695('0x89'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0x98'));_0x1c8fc3['field'](_0x3695('0x99'),_0x3695('0x9a'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0x9b'),_0x3695('0x9c'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0x9d'),_0x3695('0x9e'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0x9f'),_0x3695('0xa0'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0xa1'),_0x3695('0xa2'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0xa3'),_0x3695('0xa4'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0xa5'),_0x3695('0xa6'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0xa7'),_0x3695('0xa8'));_0x1c8fc3[_0x3695('0x44')](_0x3695('0xa9'),_0x3695('0x2d'));}if(_0x415604[_0x3695('0x20')])_0x1c8fc3['limit'](_0x415604[_0x3695('0x20')]);if(_0x415604[_0x3695('0x1e')])_0x1c8fc3['offset'](_0x415604[_0x3695('0x1e')]);return db['sequelize'][_0x3695('0x38')](_0x1c8fc3['toString'](),_0x3ae26f);})[_0x3695('0x31')](function(_0x27192c){if(_0x27192c[_0x3695('0x3e')]>0x0)_0x172855[_0x3695('0x70')](_0x3695('0xaa'),_[_0x3695('0x37')](_0x27192c,'id'));return db['sequelize'][_0x3695('0x38')](_0x172855[_0x3695('0xab')](),_0x3ae26f)[_0x3695('0x31')](function(_0x1a51ea){var _0x37f30b=_[_0x3695('0xac')](_0x1a51ea,_0x3695('0xad'));var _0x48c6b1=[];_0x27192c['forEach'](function(_0x3a210d){_0x48c6b1['push'](updateWhatsappInteraction(_0x3a210d,_0x30bff0,_0x37f30b));});return BPromise[_0x3695('0xae')](_0x48c6b1);});});})[_0x3695('0x31')](function(_0x309c16){_0x19d2b4[_0x3695('0xaf')]=_0x309c16;return _0x19d2b4;})['then'](respondWithFilteredResult(_0x556ca4,_0x415604))[_0x3695('0xb0')](handleError(_0x556ca4,null));};exports[_0x3695('0xb1')]=function(_0x54593b,_0x6365d7){var _0x58a23c={'raw':![],'where':{'id':_0x54593b[_0x3695('0xb2')]['id']}},_0x19fe96={};_0x19fe96[_0x3695('0x36')]=_[_0x3695('0x39')](db[_0x3695('0x95')][_0x3695('0x33')]);_0x19fe96[_0x3695('0x38')]=_['keys'](_0x54593b[_0x3695('0x38')]);_0x19fe96[_0x3695('0x3a')]=_[_0x3695('0x3b')](_0x19fe96[_0x3695('0x36')],_0x19fe96[_0x3695('0x38')]);_0x58a23c[_0x3695('0x3c')]=_['intersection'](_0x19fe96['model'],qs[_0x3695('0x3d')](_0x54593b['query']['fields']));_0x58a23c[_0x3695('0x3c')]=_0x58a23c['attributes'][_0x3695('0x3e')]?_0x58a23c['attributes']:_0x19fe96[_0x3695('0x36')];if(_0x54593b[_0x3695('0x38')]['includeAll']){_0x58a23c[_0x3695('0xb3')]=[{'all':!![]}];}_0x58a23c=_[_0x3695('0x94')]({},_0x58a23c,_0x54593b[_0x3695('0xb4')]);return db[_0x3695('0x95')]['find'](_0x58a23c)[_0x3695('0x31')](handleEntityNotFound(_0x6365d7,null))[_0x3695('0x31')](respondWithResult(_0x6365d7,null))[_0x3695('0xb0')](handleError(_0x6365d7,null));};exports[_0x3695('0xb5')]=function(_0x42fb6f,_0xe80187){return db['WhatsappInteraction'][_0x3695('0xb5')](_0x42fb6f[_0x3695('0x6c')],{})[_0x3695('0x31')](respondWithResult(_0xe80187,0xc9))[_0x3695('0xb0')](handleError(_0xe80187,null));};exports['update']=function(_0x5c0bec,_0x3fee26){if(_0x5c0bec['body']['id']){delete _0x5c0bec[_0x3695('0x6c')]['id'];}return db[_0x3695('0x95')][_0x3695('0x57')]({'where':{'id':_0x5c0bec[_0x3695('0xb2')]['id']}})[_0x3695('0x31')](handleEntityNotFound(_0x3fee26,null))[_0x3695('0x31')](saveUpdates(_0x5c0bec[_0x3695('0x6c')],null))['then'](respondWithResult(_0x3fee26,null))[_0x3695('0xb0')](handleError(_0x3fee26,null));};exports['destroy']=function(_0x1ca8a2,_0x4e70e7){return db['WhatsappInteraction'][_0x3695('0x57')]({'where':{'id':_0x1ca8a2['params']['id']}})[_0x3695('0x31')](handleEntityNotFound(_0x4e70e7,null))[_0x3695('0x31')](removeEntity(_0x4e70e7,null))['catch'](handleError(_0x4e70e7,null));};exports[_0x3695('0xb6')]=function(_0x17f351,_0x586c3d){return db['WhatsappInteraction'][_0x3695('0xb6')]()['then'](respondWithResult(_0x586c3d,null))[_0x3695('0xb0')](handleError(_0x586c3d,null));};exports[_0x3695('0xb7')]=function(_0x286c13,_0x334d9e,_0x51bc4b){return db[_0x3695('0xb8')][_0x3695('0x57')]({'where':{'id':_0x286c13[_0x3695('0xb2')]['id']}})[_0x3695('0x31')](handleEntityNotFound(_0x334d9e,null))[_0x3695('0x31')](function(_0x1d5b35){if(_0x1d5b35){return _0x1d5b35[_0x3695('0xb7')](_0x286c13['body'][_0x3695('0xb9')],_[_0x3695('0xba')](_0x286c13[_0x3695('0x6c')],[_0x3695('0xb9'),'id'])||{});}})[_0x3695('0x31')](respondWithResult(_0x334d9e,null))[_0x3695('0xb0')](handleError(_0x334d9e,null));};exports[_0x3695('0xbb')]=function(_0x443def,_0x52ea6e,_0xfb32a2){var _0x5f3a26={'raw':![],'where':{}};var _0x2ebb55={};var _0x547433={'count':0x0,'rows':[]};return db[_0x3695('0x95')][_0x3695('0xbc')]({'where':{'id':_0x443def['params']['id']}})[_0x3695('0x31')](handleEntityNotFound(_0x52ea6e,null))['then'](function(_0x1125d9){if(_0x1125d9){_0x2ebb55[_0x3695('0x36')]=_[_0x3695('0x39')](db[_0x3695('0xb8')][_0x3695('0x33')]);_0x2ebb55[_0x3695('0x38')]=_['keys'](_0x443def[_0x3695('0x38')]);_0x2ebb55[_0x3695('0x3a')]=_['intersection'](_0x2ebb55[_0x3695('0x36')],_0x2ebb55[_0x3695('0x38')]);_0x5f3a26[_0x3695('0x3c')]=_['intersection'](_0x2ebb55['model'],qs[_0x3695('0x3d')](_0x443def['query'][_0x3695('0x3d')]));_0x5f3a26['attributes']=_0x5f3a26[_0x3695('0x3c')]['length']?_0x5f3a26[_0x3695('0x3c')]:_0x2ebb55[_0x3695('0x36')];if(!_0x443def['query']['hasOwnProperty']('nolimit')){_0x5f3a26[_0x3695('0x20')]=qs[_0x3695('0x20')](_0x443def['query']['limit']);_0x5f3a26[_0x3695('0x1e')]=qs[_0x3695('0x1e')](_0x443def['query'][_0x3695('0x1e')]);}_0x5f3a26[_0x3695('0x40')]=qs[_0x3695('0x41')](_0x443def[_0x3695('0x38')][_0x3695('0x41')]);_0x5f3a26[_0x3695('0x70')]=qs[_0x3695('0x3a')](_[_0x3695('0x42')](_0x443def['query'],_0x2ebb55[_0x3695('0x3a')]));_0x5f3a26[_0x3695('0x70')]['WhatsappInteractionId']=_0x1125d9['id'];if(_0x443def[_0x3695('0x38')][_0x3695('0x7d')]){_0x5f3a26[_0x3695('0x70')]=_[_0x3695('0x94')](_0x5f3a26[_0x3695('0x70')],{'$or':_['map'](_0x5f3a26[_0x3695('0x3c')],function(_0x467223){var _0x1208d4={};_0x1208d4[_0x467223]={'$like':'%'+_0x443def[_0x3695('0x38')]['filter']+'%'};return _0x1208d4;})});}if(_0x443def[_0x3695('0x38')][_0x3695('0xbd')]){var _0x3a7be5=_0x443def[_0x3695('0x38')][_0x3695('0xbd')]['split'](',');var _0x332663={};_0x332663[_0x3a7be5[0x0]]={'$gte':moment(_0x3a7be5[0x1])[_0x3695('0xbe')](_0x3695('0xbf'))};_0x5f3a26[_0x3695('0x70')]=_[_0x3695('0x94')](_0x5f3a26[_0x3695('0x70')],_0x332663);}_0x5f3a26=_[_0x3695('0x94')]({},_0x5f3a26,_0x443def[_0x3695('0xb4')]);return db[_0x3695('0xb8')]['count']({'where':_0x5f3a26[_0x3695('0x70')]})[_0x3695('0x31')](function(_0x482906){_0x547433['count']=_0x482906;if(_0x443def[_0x3695('0x38')][_0x3695('0xc0')]){_0x5f3a26[_0x3695('0xb3')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3695('0xc1')](_0x5f3a26);})[_0x3695('0x31')](function(_0x4ece50){_0x547433['rows']=_0x4ece50;return _0x547433;});}})[_0x3695('0x31')](respondWithFilteredResult(_0x52ea6e,_0x5f3a26))[_0x3695('0xb0')](handleError(_0x52ea6e,null));};exports[_0x3695('0xc2')]=function(_0x4c3b9d,_0x349e9e,_0x4827c5){return db[_0x3695('0x95')][_0x3695('0x57')]({'where':{'id':_0x4c3b9d['params']['id']}})[_0x3695('0x31')](handleEntityNotFound(_0x349e9e,null))[_0x3695('0x31')](function(_0x43d648){if(_0x43d648){return _0x43d648[_0x3695('0xc3')](_0x4c3b9d['body']['ids'],_['omit'](_0x4c3b9d['body'],[_0x3695('0xb9'),'id'])||{})[_0x3695('0xc4')](function(){return db[_0x3695('0x66')]['findAll']({'attributes':['id','name',_0x3695('0xc5')],'where':{'id':_0x4c3b9d[_0x3695('0x6c')][_0x3695('0xb9')]}});})['then'](function(_0x12d5ff){socket[_0x3695('0xc6')](_0x3695('0xc7'),{'id':Number(_0x4c3b9d[_0x3695('0xb2')]['id']),'tags':_0x12d5ff||[]});return{'id':Number(_0x4c3b9d[_0x3695('0xb2')]['id']),'tags':_0x12d5ff||[]};});}})['then'](respondWithResult(_0x349e9e,null))['catch'](handleError(_0x349e9e,null));};exports['removeTags']=function(_0x1a38b1,_0x4fc1e2,_0x2b347e){return db[_0x3695('0x95')][_0x3695('0x57')]({'where':{'id':_0x1a38b1['params']['id']}})[_0x3695('0x31')](handleEntityNotFound(_0x4fc1e2,null))['then'](function(_0x5227bc){if(_0x5227bc){return _0x5227bc['removeTags'](_0x1a38b1[_0x3695('0x38')][_0x3695('0xb9')]);}})[_0x3695('0x31')](respondWithStatusCode(_0x4fc1e2,null))['catch'](handleError(_0x4fc1e2,null));};exports['download']=function(_0x5ce01f,_0x3414a4){var _0x38bee4=moment()[_0x3695('0xc8')]()[_0x3695('0xab')]();var _0x409df6=path[_0x3695('0xc9')](config[_0x3695('0xca')],_0x3695('0xcb'),_0x3695('0xcc'),_0x3695('0xcd'));var _0x1f9572=path[_0x3695('0xc9')](config[_0x3695('0xca')],_0x3695('0xcb'),_0x3695('0xcc'),_0x3695('0xce'));var _0x364116=path['join'](_0x409df6,_0x38bee4);var _0x21054b=util[_0x3695('0xbe')](_0x3695('0xcf'),_0x5ce01f[_0x3695('0xb2')]['id'],_0x38bee4);var _0x569c57=path[_0x3695('0xc9')](_0x409df6,_0x21054b);var _0x241ef6=[];_0x241ef6[_0x3695('0x30')]({'model':db['User'],'as':_0x3695('0x69'),'attributes':['id',_0x3695('0x2c')],'raw':!![]});_0x241ef6[_0x3695('0x30')]({'model':db[_0x3695('0xd0')],'as':'Contact','attributes':['id',_0x3695('0xd1'),'lastName'],'raw':!![]});if(_0x5ce01f['query'][_0x3695('0xce')]){_0x241ef6[_0x3695('0x30')]({'model':db['Attachment'],'as':_0x3695('0xd2'),'raw':!![]});}var _0x41d3aa=[{'model':db['WhatsappMessage'],'as':_0x3695('0xd3'),'attributes':['id',_0x3695('0x6c'),_0x3695('0x72'),_0x3695('0xd4'),_0x3695('0xd5'),_0x3695('0x78')],'include':_0x241ef6}];_0x41d3aa[_0x3695('0x30')]({'model':db[_0x3695('0xd6')],'as':_0x3695('0xd7'),'attributes':['id',_0x3695('0x29')]});_0x41d3aa[_0x3695('0x30')]({'model':db[_0x3695('0x69')],'as':_0x3695('0xd8'),'attributes':['id',_0x3695('0x2c')]});return db['WhatsappInteraction'][_0x3695('0x57')]({'where':{'id':_0x5ce01f['params']['id']},'include':_0x41d3aa})[_0x3695('0x31')](handleEntityNotFound(_0x3414a4,null))[_0x3695('0x31')](function(_0x4b8ce8){if(_0x4b8ce8){var _0x53a5ee=_0x4b8ce8[_0x3695('0xd9')]({'plain':!![]});fs[_0x3695('0xda')](_0x364116);var _0x520cc1={'channel':_0x3695('0xdb'),'account':_0x53a5ee[_0x3695('0xd7')][_0x3695('0x29')],'agent':_0x53a5ee[_0x3695('0xd8')]?_0x53a5ee[_0x3695('0xd8')][_0x3695('0x2c')]:_0x3695('0xdc'),'createdAt':moment(_0x53a5ee[_0x3695('0x72')])[_0x3695('0xbe')](_0x3695('0xbf'))[_0x3695('0xab')](),'closedAt':_0x53a5ee[_0x3695('0xdd')]?moment(_0x53a5ee['closedAt'])[_0x3695('0xbe')](_0x3695('0xbf'))[_0x3695('0xab')]():'','disposition':_0x53a5ee[_0x3695('0xde')],'messages':_(_0x53a5ee[_0x3695('0xd3')])[_0x3695('0x7d')]({'secret':![]})[_0x3695('0x37')](function(_0x12535f){if(_0x12535f[_0x3695('0xd2')]){var _0x27e845=path[_0x3695('0xc9')](_0x1f9572,_0x12535f[_0x3695('0xd2')][_0x3695('0xdf')]);if(fs['existsSync'](_0x27e845)){fs[_0x3695('0xe0')](_0x27e845)['pipe'](fs[_0x3695('0xe1')](path[_0x3695('0xc9')](_0x364116,_0x12535f['Attachment']['basename'])));}}return{'date':moment(_0x12535f[_0x3695('0x72')])[_0x3695('0xbe')](_0x3695('0xbf'))[_0x3695('0xab')](),'sender':_0x12535f[_0x3695('0xd4')]===_0x3695('0xe2')?_0x12535f[_0x3695('0x69')]?_0x12535f['User']['fullname']:_0x3695('0xe3'):_0x12535f[_0x3695('0x5d')]['firstName']+(_0x12535f[_0x3695('0x5d')][_0x3695('0xe4')]?'\x20'+_0x12535f[_0x3695('0x5d')][_0x3695('0xe4')]:''),'body':_0x12535f[_0x3695('0xd2')]?_0x12535f['Attachment'][_0x3695('0xdf')]:_0x12535f[_0x3695('0x6c')],'direction':_0x12535f[_0x3695('0xd4')]===_0x3695('0xe2')?'A':'C','secret':_0x12535f[_0x3695('0xd5')],'read':_0x12535f[_0x3695('0x78')],'attachment':_0x12535f[_0x3695('0xd2')]};})[_0x3695('0x59')]()};return ejs[_0x3695('0xe5')](path[_0x3695('0xc9')](config[_0x3695('0xca')],_0x3695('0xcb'),_0x3695('0xe6'),_0x3695('0xe7')),{'interaction':_0x520cc1})[_0x3695('0x31')](function(_0x1a34d3){var _0x5d4959=path[_0x3695('0xc9')](_0x364116,_0x3695('0xe8')+_0x53a5ee['id']+'-'+_0x38bee4+_0x3695('0xe9'));var _0x3b9d8e={'path':_0x5d4959,'channel':_0x3695('0xdb'),'interactionId':_0x53a5ee['id']};return pdf[_0x3695('0xea')](_0x1a34d3,_0x3b9d8e);})['then'](function(){return new BPromise(function(_0x1a6289,_0x2e2499){zipdir(_0x364116,{'saveTo':_0x569c57},function(_0x2fd576,_0x504811){if(_0x2fd576)return _0x2e2499(_0x2fd576);return _0x1a6289(_0x504811);});})['then'](function(){return new BPromise(function(_0x38ba26,_0x5c598d){rimraf(_0x364116,function(_0x48dffa){if(_0x48dffa)_0x5c598d(_0x48dffa);return _0x38ba26();});});})[_0x3695('0x31')](function(){return _0x3414a4['download'](_0x569c57,_0x21054b,function(_0x1ffb98){if(_0x1ffb98){console['log'](_0x3695('0xeb'),_0x1ffb98);}else{fs['unlinkSync'](_0x569c57);}});});});}else{return _0x3414a4[_0x3695('0x1b')](0xc8);}})[_0x3695('0xb0')](handleError(_0x3414a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 838e299..aa6ee5d 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 _0x0ca5=['setMaxListeners','save','update','then','Users','setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x1e64e2,_0x3b77b4){var _0x4c4742=function(_0x13d3b6){while(--_0x13d3b6){_0x1e64e2['push'](_0x1e64e2['shift']());}};_0x4c4742(++_0x3b77b4);}(_0x0ca5,0xfc));var _0x50ca=function(_0x525850,_0x2d5b00){_0x525850=_0x525850-0x0;var _0x589e15=_0x0ca5[_0x525850];return _0x589e15;};'use strict';var EventEmitter=require(_0x50ca('0x0'));var WhatsappInteraction=require(_0x50ca('0x1'))['db'][_0x50ca('0x2')];var WhatsappMessage=require(_0x50ca('0x1'))['db'][_0x50ca('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x50ca('0x4')](0x0);var events={'afterCreate':_0x50ca('0x5'),'afterUpdate':_0x50ca('0x6'),'afterDestroy':'remove'};function emitEvent(_0x38120b){return function(_0xfb584e,_0x230ee2,_0x404ab9){_0xfb584e['getUsers']({'attributes':['id'],'raw':!![]})[_0x50ca('0x7')](function(_0x18142d){_0xfb584e['setDataValue'](_0x50ca('0x8'),_0x18142d['map'](function(_0x29392c){return{'id':_0x29392c['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xfb584e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x50ca('0x7')](function(_0x18f61c){_0xfb584e[_0x50ca('0x9')](_0x50ca('0xa'),_0x18f61c[_0x50ca('0xb')]);WhatsappInteractionEvents['emit'](_0x38120b+':'+_0xfb584e['id'],_0xfb584e);WhatsappInteractionEvents['emit'](_0x38120b,_0xfb584e);_0x404ab9(null);})[_0x50ca('0xc')](_0x404ab9(null));};}for(var e in events){if(events[_0x50ca('0xd')](e)){var event=events[e];WhatsappInteraction[_0x50ca('0xe')](e,emitEvent(event));}}module[_0x50ca('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc6d8=['unreadMessages','length','emit','catch','hook','events','WhatsappInteraction','WhatsappMessage','save','getUsers','then','Users','map','setDataValue'];(function(_0x242443,_0x1da832){var _0x3f8b58=function(_0x26abb1){while(--_0x26abb1){_0x242443['push'](_0x242443['shift']());}};_0x3f8b58(++_0x1da832);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x49748c,_0x3d2005){_0x49748c=_0x49748c-0x0;var _0xedf6b6=_0xc6d8[_0x49748c];return _0xedf6b6;};'use strict';var EventEmitter=require(_0x8c6d('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x8c6d('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x8c6d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c6d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x352b8c){return function(_0xdff6f,_0x17781d,_0x4f5e8f){_0xdff6f[_0x8c6d('0x4')]({'attributes':['id'],'raw':!![]})[_0x8c6d('0x5')](function(_0x98cae4){_0xdff6f['setDataValue'](_0x8c6d('0x6'),_0x98cae4[_0x8c6d('0x7')](function(_0x16d4b2){return{'id':_0x16d4b2['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xdff6f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c6d('0x5')](function(_0x1ec65c){_0xdff6f[_0x8c6d('0x8')](_0x8c6d('0x9'),_0x1ec65c[_0x8c6d('0xa')]);WhatsappInteractionEvents[_0x8c6d('0xb')](_0x352b8c+':'+_0xdff6f['id'],_0xdff6f);WhatsappInteractionEvents[_0x8c6d('0xb')](_0x352b8c,_0xdff6f);_0x4f5e8f(null);})[_0x8c6d('0xc')](_0x4f5e8f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x8c6d('0xd')](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 0d14d07..8598372 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 _0xacea=['../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f77d6,_0x815a1d){var _0x5bf9eb=function(_0xb05bb5){while(--_0xb05bb5){_0x2f77d6['push'](_0x2f77d6['shift']());}};_0x5bf9eb(++_0x815a1d);}(_0xacea,0x1a1));var _0xaace=function(_0x1d60b7,_0x9f70c){_0x1d60b7=_0x1d60b7-0x0;var _0x54b55b=_0xacea[_0x1d60b7];return _0x54b55b;};'use strict';var _=require(_0xaace('0x0'));var util=require(_0xaace('0x1'));var logger=require(_0xaace('0x2'))('api');var moment=require(_0xaace('0x3'));var BPromise=require(_0xaace('0x4'));var rp=require(_0xaace('0x5'));var fs=require('fs');var path=require(_0xaace('0x6'));var rimraf=require(_0xaace('0x7'));var config=require(_0xaace('0x8'));var attributes=require(_0xaace('0x9'));module['exports']=function(_0x139657,_0x2a56be){return _0x139657[_0xaace('0xa')](_0xaace('0xb'),attributes,{'tableName':_0xaace('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x507498,_0x28eb5a,_0x5a8fbe){if(_0x507498[_0xaace('0xd')]('closed')){_0x507498[_0xaace('0xe')]=moment()[_0xaace('0xf')](_0xaace('0x10'));}_0x5a8fbe(null,_0x507498);}}});}; \ No newline at end of file +var _0x4f95=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./whatsappInteraction.attributes'];(function(_0x1b166e,_0x1bd8d5){var _0x114c40=function(_0x275037){while(--_0x275037){_0x1b166e['push'](_0x1b166e['shift']());}};_0x114c40(++_0x1bd8d5);}(_0x4f95,0x117));var _0x54f9=function(_0x590737,_0x31a509){_0x590737=_0x590737-0x0;var _0x35b57a=_0x4f95[_0x590737];return _0x35b57a;};'use strict';var _=require(_0x54f9('0x0'));var util=require(_0x54f9('0x1'));var logger=require(_0x54f9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x54f9('0x3'));var rp=require(_0x54f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x54f9('0x5'));var config=require('../../config/environment');var attributes=require(_0x54f9('0x6'));module['exports']=function(_0x4ac9,_0x271ba7){return _0x4ac9['define'](_0x54f9('0x7'),attributes,{'tableName':_0x54f9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc3e817,_0x5343ba,_0x1d1e50){if(_0xc3e817[_0x54f9('0x9')](_0x54f9('0xa'))){_0xc3e817[_0x54f9('0xb')]=moment()['format'](_0x54f9('0xc'));}_0x1d1e50(null,_0xc3e817);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index fd93c11..956c4fa 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 _0xd503=['then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','ids','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request'];(function(_0x163e1c,_0x5381a6){var _0x9e68e7=function(_0x153959){while(--_0x153959){_0x163e1c['push'](_0x163e1c['shift']());}};_0x9e68e7(++_0x5381a6);}(_0xd503,0xd5));var _0x3d50=function(_0x233ca3,_0x4592e7){_0x233ca3=_0x233ca3-0x0;var _0x6acb4c=_0xd503[_0x233ca3];return _0x6acb4c;};'use strict';var _=require('lodash');var util=require(_0x3d50('0x0'));var moment=require(_0x3d50('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d50('0x2'));var fs=require('fs');var Redis=require(_0x3d50('0x3'));var db=require(_0x3d50('0x4'))['db'];var utils=require(_0x3d50('0x5'));var logger=require(_0x3d50('0x6'))(_0x3d50('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d50('0x8'));var client=jayson['client'][_0x3d50('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3d50('0xa')],{'host':_0x3d50('0xb'),'port':0x18eb});var socket=require(_0x3d50('0xc'))(new Redis(config[_0x3d50('0xa')]));require('./whatsappInteraction.socket')[_0x3d50('0xd')](socket);function respondWithRpcPromise(_0x458f56,_0x557350,_0x18bc60){return new BPromise(function(_0x5ed5e5,_0x59cfd9){return client[_0x3d50('0xe')](_0x458f56,_0x18bc60)[_0x3d50('0xf')](function(_0x3398c5){logger[_0x3d50('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x557350,'request\x20sent');logger[_0x3d50('0x11')](_0x3d50('0x12'),_0x557350,_0x3d50('0x13'),JSON[_0x3d50('0x14')](_0x3398c5));if(_0x3398c5[_0x3d50('0x15')]){if(_0x3398c5[_0x3d50('0x15')]['code']===0x1f4){logger[_0x3d50('0x15')](_0x3d50('0x16'),_0x557350,_0x3398c5[_0x3d50('0x15')]['message']);return _0x59cfd9(_0x3398c5[_0x3d50('0x15')][_0x3d50('0x17')]);}logger[_0x3d50('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x557350,_0x3398c5['error'][_0x3d50('0x17')]);return _0x5ed5e5(_0x3398c5[_0x3d50('0x15')][_0x3d50('0x17')]);}else{logger[_0x3d50('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x557350,'request\x20sent');_0x5ed5e5(_0x3398c5['result'][_0x3d50('0x17')]);}})[_0x3d50('0x18')](function(_0x926e51){logger['error'](_0x3d50('0x16'),_0x557350,_0x926e51);_0x59cfd9(_0x926e51);});});}exports[_0x3d50('0x19')]=function(_0x179ef4){var _0xc628c6=this;return new Promise(function(_0xf93b06,_0x579a09){return db[_0x3d50('0x1a')]['update'](_0x179ef4[_0x3d50('0x1b')],{'raw':_0x179ef4[_0x3d50('0x1c')]?_0x179ef4[_0x3d50('0x1c')][_0x3d50('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x179ef4[_0x3d50('0x1c')]?_0x179ef4[_0x3d50('0x1c')][_0x3d50('0x1e')]||null:null,'attributes':_0x179ef4['options']?_0x179ef4[_0x3d50('0x1c')][_0x3d50('0x1f')]||null:null,'limit':_0x179ef4['options']?_0x179ef4[_0x3d50('0x1c')][_0x3d50('0x20')]||null:null})[_0x3d50('0xf')](function(_0x21e515){logger['info']('UpdateWhatsappInteraction',_0x179ef4);logger['debug']('UpdateWhatsappInteraction',_0x179ef4,JSON[_0x3d50('0x14')](_0x21e515));_0xf93b06(_0x21e515);})[_0x3d50('0x18')](function(_0x56ffdb){logger['error'](_0x3d50('0x19'),_0x56ffdb[_0x3d50('0x17')],_0x179ef4);_0x579a09(_0xc628c6[_0x3d50('0x15')](0x1f4,_0x56ffdb['message']));});});};exports[_0x3d50('0x21')]=function(_0x3757c4){return new Promise(function(_0x1168c2,_0x1bd3c6){return db[_0x3d50('0x1a')][_0x3d50('0x22')]({'where':_0x3757c4['options']?_0x3757c4[_0x3d50('0x1c')][_0x3d50('0x1e')]||null:null})[_0x3d50('0xf')](function(_0x1aec5c){if(_0x1aec5c){return _0x1aec5c['addTags'](_0x3757c4[_0x3d50('0x1b')][_0x3d50('0x23')],_['omit'](_0x3757c4[_0x3d50('0x1b')],[_0x3d50('0x23'),'id'])||{});}})[_0x3d50('0x24')](function(_0x20d49e){logger['info']('AddTags',_0x3757c4);logger[_0x3d50('0x11')](_0x3d50('0x25'),_0x3757c4,JSON[_0x3d50('0x14')](_0x20d49e));_0x1168c2(_0x20d49e);})[_0x3d50('0x18')](function(_0x3bb448){logger[_0x3d50('0x15')](_0x3d50('0x25'),_0x3bb448[_0x3d50('0x17')],_0x3757c4);_0x1bd3c6(_this[_0x3d50('0x15')](0x1f4,_0x3bb448['message']));});});}; \ No newline at end of file +var _0xbb9e=['where','info','catch','AddTagsToWhatsappInteraction','find','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw'];(function(_0x3e255a,_0x4c7f5b){var _0x187e67=function(_0x2eb6cc){while(--_0x2eb6cc){_0x3e255a['push'](_0x3e255a['shift']());}};_0x187e67(++_0x4c7f5b);}(_0xbb9e,0x18e));var _0xebb9=function(_0x14e51f,_0x330397){_0x14e51f=_0x14e51f-0x0;var _0x461921=_0xbb9e[_0x14e51f];return _0x461921;};'use strict';var _=require(_0xebb9('0x0'));var util=require(_0xebb9('0x1'));var moment=require(_0xebb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xebb9('0x3'));var fs=require('fs');var Redis=require(_0xebb9('0x4'));var db=require(_0xebb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xebb9('0x6'))(_0xebb9('0x7'));var config=require('../../config/environment');var jayson=require(_0xebb9('0x8'));var client=jayson[_0xebb9('0x9')][_0xebb9('0xa')]({'port':0x232a});config[_0xebb9('0xb')]=_['defaults'](config['redis'],{'host':_0xebb9('0xc'),'port':0x18eb});var socket=require(_0xebb9('0xd'))(new Redis(config[_0xebb9('0xb')]));require(_0xebb9('0xe'))[_0xebb9('0xf')](socket);function respondWithRpcPromise(_0x98ba46,_0xbf5303,_0x2d1f8e){return new BPromise(function(_0x40e1db,_0xaf8dba){return client[_0xebb9('0x10')](_0x98ba46,_0x2d1f8e)[_0xebb9('0x11')](function(_0x3d2cd9){logger['info'](_0xebb9('0x12'),_0xbf5303,_0xebb9('0x13'));logger[_0xebb9('0x14')](_0xebb9('0x15'),_0xbf5303,'request\x20sent',JSON[_0xebb9('0x16')](_0x3d2cd9));if(_0x3d2cd9['error']){if(_0x3d2cd9[_0xebb9('0x17')]['code']===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xbf5303,_0x3d2cd9[_0xebb9('0x17')][_0xebb9('0x18')]);return _0xaf8dba(_0x3d2cd9[_0xebb9('0x17')][_0xebb9('0x18')]);}logger[_0xebb9('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0xbf5303,_0x3d2cd9[_0xebb9('0x17')]['message']);return _0x40e1db(_0x3d2cd9[_0xebb9('0x17')][_0xebb9('0x18')]);}else{logger['info'](_0xebb9('0x12'),_0xbf5303,_0xebb9('0x13'));_0x40e1db(_0x3d2cd9[_0xebb9('0x19')][_0xebb9('0x18')]);}})['catch'](function(_0x39d599){logger['error'](_0xebb9('0x12'),_0xbf5303,_0x39d599);_0xaf8dba(_0x39d599);});});}exports[_0xebb9('0x1a')]=function(_0x2a276a){var _0x5d66eb=this;return new Promise(function(_0x40fc93,_0x337e16){return db[_0xebb9('0x1b')]['update'](_0x2a276a[_0xebb9('0x1c')],{'raw':_0x2a276a[_0xebb9('0x1d')]?_0x2a276a['options'][_0xebb9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a276a['options']?_0x2a276a['options'][_0xebb9('0x1f')]||null:null,'attributes':_0x2a276a[_0xebb9('0x1d')]?_0x2a276a[_0xebb9('0x1d')]['attributes']||null:null,'limit':_0x2a276a[_0xebb9('0x1d')]?_0x2a276a[_0xebb9('0x1d')]['limit']||null:null})['then'](function(_0x19dd3c){logger[_0xebb9('0x20')](_0xebb9('0x1a'),_0x2a276a);logger[_0xebb9('0x14')](_0xebb9('0x1a'),_0x2a276a,JSON[_0xebb9('0x16')](_0x19dd3c));_0x40fc93(_0x19dd3c);})[_0xebb9('0x21')](function(_0xee7a4d){logger[_0xebb9('0x17')](_0xebb9('0x1a'),_0xee7a4d[_0xebb9('0x18')],_0x2a276a);_0x337e16(_0x5d66eb['error'](0x1f4,_0xee7a4d['message']));});});};exports[_0xebb9('0x22')]=function(_0x1f6518){return new Promise(function(_0x1aaef8,_0x4fd90b){return db[_0xebb9('0x1b')][_0xebb9('0x23')]({'where':_0x1f6518[_0xebb9('0x1d')]?_0x1f6518[_0xebb9('0x1d')]['where']||null:null})[_0xebb9('0x11')](function(_0x153bf7){if(_0x153bf7){return _0x153bf7['addTags'](_0x1f6518[_0xebb9('0x1c')][_0xebb9('0x24')],_[_0xebb9('0x25')](_0x1f6518[_0xebb9('0x1c')],[_0xebb9('0x24'),'id'])||{});}})['spread'](function(_0x2b1e53){logger[_0xebb9('0x20')](_0xebb9('0x26'),_0x1f6518);logger[_0xebb9('0x14')](_0xebb9('0x26'),_0x1f6518,JSON[_0xebb9('0x16')](_0x2b1e53));_0x1aaef8(_0x2b1e53);})[_0xebb9('0x21')](function(_0x2c6eda){logger[_0xebb9('0x17')]('AddTags',_0x2c6eda['message'],_0x1f6518);_0x4fd90b(_this[_0xebb9('0x17')](0x1f4,_0x2c6eda[_0xebb9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d13c606..4ee6389 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 _0x71cb=['./whatsappInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x41b369,_0x29e21f){var _0x2af633=function(_0x588c87){while(--_0x588c87){_0x41b369['push'](_0x41b369['shift']());}};_0x2af633(++_0x29e21f);}(_0x71cb,0x1b2));var _0xb71c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x71cb[_0x491a7f];return _0x3d8f44;};'use strict';var WhatsappInteractionEvents=require(_0xb71c('0x0'));var events=[_0xb71c('0x1'),_0xb71c('0x2'),_0xb71c('0x3')];function createListener(_0x443943,_0x53aa6e){return function(_0x386b1e){_0x53aa6e['emit'](_0x443943,_0x386b1e);};}function removeListener(_0x51a442,_0x197118){return function(){WhatsappInteractionEvents[_0xb71c('0x4')](_0x51a442,_0x197118);};}exports[_0xb71c('0x5')]=function(_0xd6f57){for(var _0x305cd7=0x0,_0x2f7ecc=events[_0xb71c('0x6')];_0x305cd7<_0x2f7ecc;_0x305cd7++){var _0x3a76f6=events[_0x305cd7];var _0x4d0106=createListener('whatsappInteraction:'+_0x3a76f6,_0xd6f57);WhatsappInteractionEvents['on'](_0x3a76f6,_0x4d0106);}}; \ No newline at end of file +var _0xb0d0=['update','emit','whatsappInteraction:','./whatsappInteraction.events','remove'];(function(_0x2eb320,_0x17e9ce){var _0x4a1c47=function(_0x5b9a43){while(--_0x5b9a43){_0x2eb320['push'](_0x2eb320['shift']());}};_0x4a1c47(++_0x17e9ce);}(_0xb0d0,0x7b));var _0x0b0d=function(_0x21aae6,_0x55d0fc){_0x21aae6=_0x21aae6-0x0;var _0x5e4b7e=_0xb0d0[_0x21aae6];return _0x5e4b7e;};'use strict';var WhatsappInteractionEvents=require(_0x0b0d('0x0'));var events=['save',_0x0b0d('0x1'),_0x0b0d('0x2')];function createListener(_0xe0ad0f,_0x2489dc){return function(_0x5b8643){_0x2489dc[_0x0b0d('0x3')](_0xe0ad0f,_0x5b8643);};}function removeListener(_0x4dea2a,_0x459039){return function(){WhatsappInteractionEvents['removeListener'](_0x4dea2a,_0x459039);};}exports['register']=function(_0xc34194){for(var _0x580167=0x0,_0x50cee0=events['length'];_0x580167<_0x50cee0;_0x580167++){var _0x9d753a=events[_0x580167];var _0x1c3b1b=createListener(_0x0b0d('0x4')+_0x9d753a,_0xc34194);WhatsappInteractionEvents['on'](_0x9d753a,_0x1c3b1b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f380c79..80d56fd 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 _0xea9a=['update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','tracked','whatsapp','put','/:id'];(function(_0x292fbe,_0x1148ec){var _0x53ddce=function(_0x1890e5){while(--_0x1890e5){_0x292fbe['push'](_0x292fbe['shift']());}};_0x53ddce(++_0x1148ec);}(_0xea9a,0xe8));var _0xaea9=function(_0x42563d,_0x1ce3c5){_0x42563d=_0x42563d-0x0;var _0x33b706=_0xea9a[_0x42563d];return _0x33b706;};'use strict';var multer=require(_0xaea9('0x0'));var util=require(_0xaea9('0x1'));var path=require(_0xaea9('0x2'));var timeout=require('connect-timeout');var express=require(_0xaea9('0x3'));var router=express['Router']();var fs_extra=require(_0xaea9('0x4'));var auth=require(_0xaea9('0x5'));var interaction=require(_0xaea9('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xaea9('0x7')]('/',auth[_0xaea9('0x8')](),controller[_0xaea9('0x9')]);router[_0xaea9('0x7')](_0xaea9('0xa'),auth['isAuthenticated'](),controller[_0xaea9('0xb')]);router[_0xaea9('0x7')]('/:id',auth[_0xaea9('0x8')](),controller[_0xaea9('0xc')]);router[_0xaea9('0xd')]('/',auth['isAuthenticated'](),interaction[_0xaea9('0xe')](_0xaea9('0xf'),'whatsappmessage:create'),controller['create']);router['post']('/:id/status',controller['status']);router[_0xaea9('0x10')](_0xaea9('0x11'),auth[_0xaea9('0x8')](),controller[_0xaea9('0x12')]);router['put'](_0xaea9('0x13'),auth[_0xaea9('0x8')](),controller[_0xaea9('0x14')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xaea9('0x15')]);router[_0xaea9('0x16')](_0xaea9('0x11'),auth['isAuthenticated'](),controller[_0xaea9('0x17')]);module[_0xaea9('0x18')]=router; \ No newline at end of file +var _0x43bf=['describe','/:id','show','post','tracked','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x470b39,_0xe3764){var _0x558412=function(_0xc5125){while(--_0xc5125){_0x470b39['push'](_0x470b39['shift']());}};_0x558412(++_0xe3764);}(_0x43bf,0x1ec));var _0xf43b=function(_0x192022,_0x23385c){_0x192022=_0x192022-0x0;var _0x161d8c=_0x43bf[_0x192022];return _0x161d8c;};'use strict';var multer=require(_0xf43b('0x0'));var util=require('util');var path=require(_0xf43b('0x1'));var timeout=require(_0xf43b('0x2'));var express=require('express');var router=express[_0xf43b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf43b('0x4'));var interaction=require(_0xf43b('0x5'));var config=require(_0xf43b('0x6'));var controller=require(_0xf43b('0x7'));router[_0xf43b('0x8')]('/',auth[_0xf43b('0x9')](),controller[_0xf43b('0xa')]);router['get'](_0xf43b('0xb'),auth[_0xf43b('0x9')](),controller[_0xf43b('0xc')]);router[_0xf43b('0x8')](_0xf43b('0xd'),auth[_0xf43b('0x9')](),controller[_0xf43b('0xe')]);router[_0xf43b('0xf')]('/',auth[_0xf43b('0x9')](),interaction[_0xf43b('0x10')]('whatsapp',_0xf43b('0x11')),controller[_0xf43b('0x12')]);router['post']('/:id/status',controller[_0xf43b('0x13')]);router[_0xf43b('0x14')](_0xf43b('0xd'),auth[_0xf43b('0x9')](),controller[_0xf43b('0x15')]);router['put'](_0xf43b('0x16'),auth['isAuthenticated'](),controller[_0xf43b('0x17')]);router['put'](_0xf43b('0x18'),auth[_0xf43b('0x9')](),controller[_0xf43b('0x19')]);router[_0xf43b('0x1a')]('/:id',auth[_0xf43b('0x9')](),controller['destroy']);module[_0xf43b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1bc1fa3..f3b94b5 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 _0x3ef3=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x109826,_0x2d0989){var _0x299b4b=function(_0x3ea967){while(--_0x3ea967){_0x109826['push'](_0x109826['shift']());}};_0x299b4b(++_0x2d0989);}(_0x3ef3,0x74));var _0x33ef=function(_0x452fed,_0x2873b2){_0x452fed=_0x452fed-0x0;var _0x32e65f=_0x3ef3[_0x452fed];return _0x32e65f;};'use strict';var Sequelize=require(_0x33ef('0x0'));module[_0x33ef('0x1')]={'body':{'type':Sequelize[_0x33ef('0x2')](_0x33ef('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x33ef('0x4')]('in',_0x33ef('0x5')),'defaultValue':_0x33ef('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x33ef('0x6')]},'readAt':{'type':Sequelize[_0x33ef('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x33ef('0x6')]},'providerResponse':{'type':Sequelize[_0x33ef('0x2')]}}; \ No newline at end of file +var _0x1ff2=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x13e4d6,_0x4d647f){var _0x395c06=function(_0x55ce7f){while(--_0x55ce7f){_0x13e4d6['push'](_0x13e4d6['shift']());}};_0x395c06(++_0x4d647f);}(_0x1ff2,0x141));var _0x21ff=function(_0x24f047,_0xd6513e){_0x24f047=_0x24f047-0x0;var _0x3a4d36=_0x1ff2[_0x24f047];return _0x3a4d36;};'use strict';var Sequelize=require(_0x21ff('0x0'));module[_0x21ff('0x1')]={'body':{'type':Sequelize[_0x21ff('0x2')](_0x21ff('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x21ff('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x21ff('0x5')]('in',_0x21ff('0x6')),'defaultValue':_0x21ff('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x21ff('0x7')](0xbe)},'phone':{'type':Sequelize[_0x21ff('0x7')]},'readAt':{'type':Sequelize[_0x21ff('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x21ff('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c434057..6e9c343 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 _0x3dc2=['params','intersection','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','agent','WhatsappInteraction','WhatsappInteractionId','UserId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','User','email','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','QueryTypes','SELECT','contact','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','findAll','show'];(function(_0x164e6b,_0x3b9233){var _0x2b1abb=function(_0x4b9507){while(--_0x4b9507){_0x164e6b['push'](_0x164e6b['shift']());}};_0x2b1abb(++_0x3b9233);}(_0x3dc2,0x1d5));var _0x23dc=function(_0x14a273,_0x159ff4){_0x14a273=_0x14a273-0x0;var _0x218d91=_0x3dc2[_0x14a273];return _0x218d91;};'use strict';var emlformat=require(_0x23dc('0x0'));var rimraf=require(_0x23dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23dc('0x2'));var rp=require(_0x23dc('0x3'));var moment=require(_0x23dc('0x4'));var BPromise=require(_0x23dc('0x5'));var Mustache=require(_0x23dc('0x6'));var util=require(_0x23dc('0x7'));var path=require(_0x23dc('0x8'));var sox=require(_0x23dc('0x9'));var csv=require(_0x23dc('0xa'));var ejs=require(_0x23dc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x23dc('0xc'));var jsforce=require(_0x23dc('0xd'));var deskjs=require(_0x23dc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x23dc('0xf'));var Papa=require(_0x23dc('0x10'));var Redis=require(_0x23dc('0x11'));var authService=require(_0x23dc('0x12'));var qs=require(_0x23dc('0x13'));var as=require(_0x23dc('0x14'));var hardwareService=require(_0x23dc('0x15'));var logger=require(_0x23dc('0x16'))(_0x23dc('0x17'));var utils=require(_0x23dc('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x23dc('0x19'))['db'];config[_0x23dc('0x1a')]=_[_0x23dc('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x23dc('0x1c'))(new Redis(config[_0x23dc('0x1a')]));require(_0x23dc('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x23dc('0x1e')][_0x23dc('0x1f')]({'port':0x232c});var client9002=jayson[_0x23dc('0x1e')][_0x23dc('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4ba697,_0x2a6583,_0x124ee0,_0x5c3cac){return new BPromise(function(_0x436786,_0x42f830){var _0x3e989e=_0x5c3cac||client;return _0x3e989e[_0x23dc('0x20')](_0x4ba697,_0x124ee0)['then'](function(_0x1b9212){logger[_0x23dc('0x21')](_0x23dc('0x22'),_0x2a6583,_0x23dc('0x23'));logger[_0x23dc('0x24')](_0x23dc('0x25'),_0x2a6583,_0x23dc('0x23'),JSON[_0x23dc('0x26')](_0x1b9212));if(_0x1b9212[_0x23dc('0x27')]){if(_0x1b9212['error'][_0x23dc('0x28')]===0x1f4){logger[_0x23dc('0x27')](_0x23dc('0x22'),_0x2a6583,_0x1b9212[_0x23dc('0x27')][_0x23dc('0x29')]);return _0x42f830(_0x1b9212[_0x23dc('0x27')]['message']);}logger[_0x23dc('0x27')](_0x23dc('0x22'),_0x2a6583,_0x1b9212[_0x23dc('0x27')][_0x23dc('0x29')]);return _0x436786(_0x1b9212[_0x23dc('0x27')]['message']);}else{logger['info'](_0x23dc('0x22'),_0x2a6583,_0x23dc('0x23'));_0x436786(_0x1b9212['result']['message']);}})[_0x23dc('0x2a')](function(_0x55dad4){logger['error'](_0x23dc('0x22'),_0x2a6583,_0x55dad4);_0x42f830(_0x55dad4);});});}function respondWithStatusCode(_0x441257,_0x182934){_0x182934=_0x182934||0xcc;return function(_0x287aee){if(_0x287aee){return _0x441257['sendStatus'](_0x182934);}return _0x441257[_0x23dc('0x2b')](_0x182934)['end']();};}function respondWithResult(_0x2d42d7,_0x200d5f){_0x200d5f=_0x200d5f||0xc8;return function(_0x327554){if(_0x327554){return _0x2d42d7[_0x23dc('0x2b')](_0x200d5f)['json'](_0x327554);}};}function respondWithFilteredResult(_0x1ac395,_0x10c217){return function(_0x5a0e9f){if(_0x5a0e9f){var _0x22ed2b=typeof _0x10c217[_0x23dc('0x2c')]==='undefined'&&typeof _0x10c217['limit']==='undefined';var _0x35acea=_0x5a0e9f[_0x23dc('0x2d')];var _0x48a9ee=_0x22ed2b?0x0:_0x10c217[_0x23dc('0x2c')];var _0x4bb4b8=_0x22ed2b?_0x5a0e9f[_0x23dc('0x2d')]:_0x10c217['offset']+_0x10c217['limit'];var _0x4f8549;if(_0x4bb4b8>=_0x35acea){_0x4bb4b8=_0x35acea;_0x4f8549=0xc8;}else{_0x4f8549=0xce;}_0x1ac395['status'](_0x4f8549);return _0x1ac395[_0x23dc('0x2e')](_0x23dc('0x2f'),_0x48a9ee+'-'+_0x4bb4b8+'/'+_0x35acea)[_0x23dc('0x30')](_0x5a0e9f);}return null;};}function patchUpdates(_0x315285){return function(_0x5bb0fd){try{jsonpatch[_0x23dc('0x31')](_0x5bb0fd,_0x315285,!![]);}catch(_0x449b17){return BPromise[_0x23dc('0x32')](_0x449b17);}return _0x5bb0fd[_0x23dc('0x33')]();};}function saveUpdates(_0x6baa3a,_0x4d26b4){return function(_0xde8975){if(_0xde8975){return _0xde8975[_0x23dc('0x34')](_0x6baa3a)[_0x23dc('0x35')](function(_0x1042ce){return _0x1042ce;});}return null;};}function removeEntity(_0x71b7cc,_0x2bad17){return function(_0x58ce00){if(_0x58ce00){return _0x58ce00[_0x23dc('0x36')]()[_0x23dc('0x35')](function(){_0x71b7cc[_0x23dc('0x2b')](0xcc)[_0x23dc('0x37')]();});}};}function handleEntityNotFound(_0xb98953,_0x52a6fc){return function(_0x4d640b){if(!_0x4d640b){_0xb98953['sendStatus'](0x194);}return _0x4d640b;};}function handleError(_0x4e7a62,_0x2b6d34){_0x2b6d34=_0x2b6d34||0x1f4;return function(_0x5c4542){logger[_0x23dc('0x27')](_0x5c4542['stack']);if(_0x5c4542[_0x23dc('0x38')]){delete _0x5c4542['name'];}_0x4e7a62['status'](_0x2b6d34)[_0x23dc('0x39')](_0x5c4542);};}exports[_0x23dc('0x3a')]=function(_0x1749a3,_0x39a956){var _0x3e5be8={},_0x25cbc1={},_0x117239={'count':0x0,'rows':[]};var _0x14c3eb=_['map'](db['WhatsappMessage'][_0x23dc('0x3b')],function(_0x14f3d0){return{'name':_0x14f3d0[_0x23dc('0x3c')],'type':_0x14f3d0[_0x23dc('0x3d')]['key']};});_0x25cbc1[_0x23dc('0x3e')]=_[_0x23dc('0x3f')](_0x14c3eb,_0x23dc('0x38'));_0x25cbc1['query']=_[_0x23dc('0x40')](_0x1749a3[_0x23dc('0x41')]);_0x25cbc1[_0x23dc('0x42')]=_['intersection'](_0x25cbc1[_0x23dc('0x3e')],_0x25cbc1[_0x23dc('0x41')]);_0x3e5be8['attributes']=_['intersection'](_0x25cbc1[_0x23dc('0x3e')],qs[_0x23dc('0x43')](_0x1749a3[_0x23dc('0x41')]['fields']));_0x3e5be8[_0x23dc('0x44')]=_0x3e5be8[_0x23dc('0x44')][_0x23dc('0x45')]?_0x3e5be8[_0x23dc('0x44')]:_0x25cbc1[_0x23dc('0x3e')];if(!_0x1749a3[_0x23dc('0x41')]['hasOwnProperty'](_0x23dc('0x46'))){_0x3e5be8['limit']=qs[_0x23dc('0x47')](_0x1749a3[_0x23dc('0x41')][_0x23dc('0x47')]);_0x3e5be8['offset']=qs[_0x23dc('0x2c')](_0x1749a3[_0x23dc('0x41')][_0x23dc('0x2c')]);}_0x3e5be8['order']=qs[_0x23dc('0x48')](_0x1749a3[_0x23dc('0x41')]['sort']);_0x3e5be8[_0x23dc('0x49')]=qs[_0x23dc('0x42')](_[_0x23dc('0x4a')](_0x1749a3['query'],_0x25cbc1['filters']),_0x14c3eb);if(_0x1749a3[_0x23dc('0x41')][_0x23dc('0x4b')]){_0x3e5be8[_0x23dc('0x49')]=_[_0x23dc('0x4c')](_0x3e5be8['where'],{'$or':_[_0x23dc('0x3f')](_0x14c3eb,function(_0x1462b0){if(_0x1462b0[_0x23dc('0x3d')]!==_0x23dc('0x4d')){var _0x501898={};_0x501898[_0x1462b0[_0x23dc('0x38')]]={'$like':'%'+_0x1749a3['query'][_0x23dc('0x4b')]+'%'};return _0x501898;}})});}_0x3e5be8=_[_0x23dc('0x4c')]({},_0x3e5be8,_0x1749a3[_0x23dc('0x4e')]);var _0x29c993={'where':_0x3e5be8[_0x23dc('0x49')]};return db[_0x23dc('0x4f')]['count'](_0x29c993)['then'](function(_0x207127){_0x117239[_0x23dc('0x2d')]=_0x207127;if(_0x1749a3[_0x23dc('0x41')][_0x23dc('0x50')]){_0x3e5be8['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x23dc('0x51')](_0x3e5be8);})['then'](function(_0x4bae9a){_0x117239['rows']=_0x4bae9a;return _0x117239;})[_0x23dc('0x35')](respondWithFilteredResult(_0x39a956,_0x3e5be8))[_0x23dc('0x2a')](handleError(_0x39a956,null));};exports[_0x23dc('0x52')]=function(_0x4176c5,_0x3f99a8){var _0x1f772d={'raw':!![],'where':{'id':_0x4176c5[_0x23dc('0x53')]['id']}},_0x5ca622={};_0x5ca622[_0x23dc('0x3e')]=_[_0x23dc('0x40')](db[_0x23dc('0x4f')][_0x23dc('0x3b')]);_0x5ca622['query']=_[_0x23dc('0x40')](_0x4176c5[_0x23dc('0x41')]);_0x5ca622['filters']=_[_0x23dc('0x54')](_0x5ca622[_0x23dc('0x3e')],_0x5ca622['query']);_0x1f772d[_0x23dc('0x44')]=_[_0x23dc('0x54')](_0x5ca622[_0x23dc('0x3e')],qs['fields'](_0x4176c5['query'][_0x23dc('0x43')]));_0x1f772d[_0x23dc('0x44')]=_0x1f772d[_0x23dc('0x44')][_0x23dc('0x45')]?_0x1f772d[_0x23dc('0x44')]:_0x5ca622['model'];if(_0x4176c5['query'][_0x23dc('0x50')]){_0x1f772d['include']=[{'all':!![]}];}_0x1f772d=_[_0x23dc('0x4c')]({},_0x1f772d,_0x4176c5['options']);return db[_0x23dc('0x4f')]['find'](_0x1f772d)[_0x23dc('0x35')](handleEntityNotFound(_0x3f99a8,null))[_0x23dc('0x35')](respondWithResult(_0x3f99a8,null))['catch'](handleError(_0x3f99a8,null));};exports[_0x23dc('0x55')]=function(_0x57f9d7,_0x34f963){return db['WhatsappMessage'][_0x23dc('0x55')](_0x57f9d7[_0x23dc('0x56')],{})[_0x23dc('0x35')](respondWithResult(_0x34f963,0xc9))[_0x23dc('0x2a')](handleError(_0x34f963,null));};exports['update']=function(_0x443089,_0xfa594f){if(_0x443089['body']['id']){delete _0x443089[_0x23dc('0x56')]['id'];}return db[_0x23dc('0x4f')][_0x23dc('0x57')]({'where':{'id':_0x443089[_0x23dc('0x53')]['id']}})[_0x23dc('0x35')](handleEntityNotFound(_0xfa594f,null))[_0x23dc('0x35')](saveUpdates(_0x443089[_0x23dc('0x56')],null))['then'](respondWithResult(_0xfa594f,null))[_0x23dc('0x2a')](handleError(_0xfa594f,null));};exports[_0x23dc('0x36')]=function(_0xbd31c9,_0x4e7ff4){return db[_0x23dc('0x4f')][_0x23dc('0x57')]({'where':{'id':_0xbd31c9['params']['id']}})[_0x23dc('0x35')](handleEntityNotFound(_0x4e7ff4,null))[_0x23dc('0x35')](removeEntity(_0x4e7ff4,null))['catch'](handleError(_0x4e7ff4,null));};exports[_0x23dc('0x58')]=function(_0x4dce0e,_0x41125a){return db[_0x23dc('0x4f')][_0x23dc('0x58')]()[_0x23dc('0x35')](respondWithResult(_0x41125a,null))[_0x23dc('0x2a')](handleError(_0x41125a,null));};var interaction_log=require('../../config/logger')(_0x23dc('0x59'));exports[_0x23dc('0x5a')]=function(_0x44dadc,_0x44b930,_0x375b66){var _0x14e07e={'agent':{},'channel':_0x23dc('0x5b')};if(_0x44dadc[_0x23dc('0x56')]['id']){delete _0x44dadc['body']['id'];}_0x44dadc[_0x23dc('0x56')][_0x23dc('0x5c')]=!![];_0x44dadc['body'][_0x23dc('0x5d')]=moment()['format'](_0x23dc('0x5e'));_0x44dadc[_0x23dc('0x56')]['UserId']=_0x44dadc[_0x23dc('0x56')]['UserId']||_0x44dadc[_0x23dc('0x5f')]['id'];_0x14e07e[_0x23dc('0x60')]['id']=_0x44dadc[_0x23dc('0x56')]['UserId'];return db['WhatsappMessage'][_0x23dc('0x57')]({'where':{'id':_0x44dadc['params']['id'],'UserId':null}})[_0x23dc('0x35')](handleEntityNotFound(_0x44b930,null))['then'](saveUpdates(_0x44dadc[_0x23dc('0x56')],null))[_0x23dc('0x35')](function(_0x511d84){if(_0x511d84){_0x14e07e[_0x23dc('0x29')]=_0x511d84['get']({'plain':!![]});return db[_0x23dc('0x61')]['find']({'where':{'id':_0x511d84[_0x23dc('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x44b930,null))[_0x23dc('0x35')](function(_0x4018a3){if(_0x4018a3){return _0x4018a3['update']({'UserId':_0x44dadc[_0x23dc('0x56')][_0x23dc('0x63')],'read1stAt':_[_0x23dc('0x64')](_0x4018a3[_0x23dc('0x65')])?moment()['format'](_0x23dc('0x5e')):undefined});}return null;})['then'](function(_0x46996f){if(_0x46996f){_0x14e07e[_0x23dc('0x66')]=_0x46996f['get']({'plain':!![]});interaction_log[_0x23dc('0x21')](_0x23dc('0x67'),_0x44dadc['user']['id'],_0x44dadc[_0x23dc('0x5f')][_0x23dc('0x38')],_0x44dadc[_0x23dc('0x5f')][_0x23dc('0x68')],_0x14e07e[_0x23dc('0x66')]['id'],_0x44dadc[_0x23dc('0x56')]?JSON[_0x23dc('0x26')](_0x44dadc[_0x23dc('0x56')]):_0x23dc('0x69'));return respondWithRpcPromise(_0x23dc('0x6a'),_0x23dc('0x6b'),_0x14e07e);}return null;})['then'](function(_0x4c0240){var _0x32a327=_0x23dc('0x6c')+_0x4c0240[_0x23dc('0x29')]['ContactId'];return db[_0x23dc('0x6d')][_0x23dc('0x41')](_0x32a327,{'type':db[_0x23dc('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x23dc('0x35')](function(_0x41951e){return _0x41951e;});})['then'](function(_0x1b65ef){if(_0x1b65ef){_0x14e07e[_0x23dc('0x29')]['contact']=_0x1b65ef[0x0];if(!_0x44dadc[_0x23dc('0x56')][_0x23dc('0x63')])return;return db[_0x23dc('0x6f')][_0x23dc('0x57')]({'where':{'id':_0x44dadc[_0x23dc('0x56')]['UserId'],'role':_0x23dc('0x60')},'attributes':['id',_0x23dc('0x38'),'fullname',_0x23dc('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0xa22b48){if(!_0xa22b48)return null;_0x14e07e['message'][_0x23dc('0x60')]=_0xa22b48;return _0x14e07e;})[_0x23dc('0x35')](function(_0x373921){if(_0x373921){if(_0x44dadc[_0x23dc('0x56')][_0x23dc('0x71')]){_0x14e07e['message'][_0x23dc('0x72')]=util[_0x23dc('0x73')](_0x23dc('0x74'),_0x44dadc[_0x23dc('0x5f')][_0x23dc('0x38')]);_0x14e07e[_0x23dc('0x29')][_0x23dc('0x75')]=_0x14e07e[_0x23dc('0x75')];_0x14e07e[_0x23dc('0x29')][_0x23dc('0x76')]=_0x14e07e[_0x23dc('0x75')];_0x14e07e[_0x23dc('0x29')][_0x23dc('0x77')]=_0x23dc('0x5a');return respondWithRpcPromise(_0x23dc('0x78'),_0x23dc('0x78'),{'event':_0x23dc('0x79'),'message':_0x14e07e['message']},client9002)['then'](function(){return _0x14e07e;});}return _0x14e07e;}return null;})[_0x23dc('0x35')](respondWithResult(_0x44b930,null))[_0x23dc('0x2a')](handleError(_0x44b930,null));};var interaction_log=require(_0x23dc('0x16'))(_0x23dc('0x59'));exports[_0x23dc('0x32')]=function(_0x68ae3e,_0x2a554a,_0x5b0bd7){var _0x27f18b={'agent':{},'channel':_0x23dc('0x5b')};if(_0x68ae3e[_0x23dc('0x56')]['id']){delete _0x68ae3e['body']['id'];}_0x68ae3e[_0x23dc('0x56')]['UserId']=_0x68ae3e['body']['UserId']||_0x68ae3e[_0x23dc('0x5f')]['id'];_0x27f18b[_0x23dc('0x60')]['id']=_0x68ae3e['body'][_0x23dc('0x63')];return db[_0x23dc('0x4f')][_0x23dc('0x57')]({'where':{'id':_0x68ae3e[_0x23dc('0x53')]['id'],'UserId':null}})[_0x23dc('0x35')](handleEntityNotFound(_0x2a554a,null))['then'](function(_0x3f74a3){if(_0x3f74a3){_0x27f18b[_0x23dc('0x29')]=_0x3f74a3[_0x23dc('0x7a')]({'plain':!![]});return db[_0x23dc('0x61')][_0x23dc('0x57')]({'where':{'id':_0x3f74a3['WhatsappInteractionId']}});}return null;})[_0x23dc('0x35')](handleEntityNotFound(_0x2a554a,null))[_0x23dc('0x35')](function(_0x35c014){if(_0x35c014){_0x27f18b[_0x23dc('0x66')]=_0x35c014['get']({'plain':!![]});interaction_log[_0x23dc('0x21')](_0x23dc('0x7b'),_0x68ae3e[_0x23dc('0x5f')]['id'],_0x68ae3e[_0x23dc('0x5f')]['name'],_0x68ae3e[_0x23dc('0x5f')][_0x23dc('0x68')],_0x27f18b[_0x23dc('0x66')]['id'],_0x68ae3e[_0x23dc('0x56')]?JSON[_0x23dc('0x26')](_0x68ae3e[_0x23dc('0x56')]):_0x23dc('0x69'));return respondWithRpcPromise('RejectMessage',_0x23dc('0x7c'),_0x27f18b);}return null;})[_0x23dc('0x35')](function(_0x37e484){var _0x25cb3e=_0x23dc('0x6c')+_0x37e484[_0x23dc('0x29')][_0x23dc('0x7d')];return db[_0x23dc('0x6d')]['query'](_0x25cb3e,{'type':db[_0x23dc('0x6e')][_0x23dc('0x7e')][_0x23dc('0x7f')],'raw':!![]})['then'](function(_0x45088c){return _0x45088c;});})['then'](function(_0x106e14){if(_0x106e14){_0x27f18b[_0x23dc('0x29')][_0x23dc('0x80')]=_0x106e14[0x0];if(!_0x68ae3e[_0x23dc('0x56')][_0x23dc('0x63')])return;return db['User']['find']({'where':{'id':_0x68ae3e['body'][_0x23dc('0x63')],'role':_0x23dc('0x60')},'attributes':['id',_0x23dc('0x38'),'fullname',_0x23dc('0x70'),'internal'],'raw':!![]});}return null;})[_0x23dc('0x35')](function(_0x1e66e8){if(!_0x1e66e8)return null;_0x27f18b[_0x23dc('0x29')][_0x23dc('0x60')]=_0x1e66e8;return _0x27f18b;})[_0x23dc('0x35')](function(_0x2904c6){if(_0x2904c6){_0x2904c6['message'][_0x23dc('0x72')]=util[_0x23dc('0x73')](_0x23dc('0x74'),_0x68ae3e[_0x23dc('0x5f')][_0x23dc('0x38')]);_0x2904c6[_0x23dc('0x29')][_0x23dc('0x75')]=_0x27f18b[_0x23dc('0x75')];_0x2904c6[_0x23dc('0x29')][_0x23dc('0x76')]=_0x27f18b[_0x23dc('0x75')];_0x2904c6[_0x23dc('0x29')][_0x23dc('0x77')]=_0x23dc('0x32');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x2904c6[_0x23dc('0x29')]},client9002);return _0x27f18b;}return null;})[_0x23dc('0x35')](respondWithResult(_0x2a554a,null))[_0x23dc('0x2a')](handleError(_0x2a554a,null));};exports[_0x23dc('0x2b')]=function(_0x2a2873,_0x2c659b,_0x4f2ba5){if(_0x2a2873[_0x23dc('0x56')]['id']){delete _0x2a2873[_0x23dc('0x56')]['id'];}var _0xb41dbd;return db['WhatsappMessage'][_0x23dc('0x57')]({'where':{'id':_0x2a2873[_0x23dc('0x53')]['id']}})[_0x23dc('0x35')](handleEntityNotFound(_0x2c659b,null))[_0x23dc('0x35')](function(_0x5c3c88){if(_0x5c3c88){_0xb41dbd=_0x5c3c88;return db[_0x23dc('0x81')][_0x23dc('0x57')]({'where':{'id':_0x5c3c88['WhatsappAccountId']}});}})[_0x23dc('0x35')](handleEntityNotFound(_0x2c659b,null))['then'](function(_0x4f0718){if(_0x4f0718){logger[_0x23dc('0x24')](_0x23dc('0x82'),_0x23dc('0x2b'),_0x23dc('0x83'),_0x4f0718[_0x23dc('0x3d')],util[_0x23dc('0x84')](_0x2a2873[_0x23dc('0x56')],{'showHidden':![],'depth':null}));switch(_0x4f0718['type']){case _0x23dc('0x85'):if(_0x2a2873[_0x23dc('0x56')][_0x23dc('0x86')]&&_0x2a2873['body'][_0x23dc('0x86')]===_0xb41dbd[_0x23dc('0x87')]&&_0x2a2873['body'][_0x23dc('0x88')]&&_0x2a2873[_0x23dc('0x56')]['MessageStatus']==='read'){return _0xb41dbd['update']({'read':!![]});}else{logger[_0x23dc('0x27')](_0x23dc('0x89'),_0x23dc('0x2b'),_0x23dc('0x85'),util[_0x23dc('0x84')](_0x2a2873[_0x23dc('0x56')],{'showHidden':![],'depth':null}));}break;}return _0xb41dbd;}})[_0x23dc('0x35')](respondWithResult(_0x2c659b,null))[_0x23dc('0x2a')](handleError(_0x2c659b,null));}; \ No newline at end of file +var _0xed7f=['name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','options','include','show','params','includeAll','find','create','body','describe','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','agent','get','WhatsappInteraction','WhatsappInteractionId','UserId','isNil','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','contact','SIP/%s','event','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','end','stack'];(function(_0x28f1c7,_0x3daa90){var _0x173208=function(_0x143775){while(--_0x143775){_0x28f1c7['push'](_0x28f1c7['shift']());}};_0x173208(++_0x3daa90);}(_0xed7f,0xd8));var _0xfed7=function(_0x1c83c9,_0x2a0efc){_0x1c83c9=_0x1c83c9-0x0;var _0x49c840=_0xed7f[_0x1c83c9];return _0x49c840;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfed7('0x0'));var rp=require(_0xfed7('0x1'));var moment=require(_0xfed7('0x2'));var BPromise=require(_0xfed7('0x3'));var Mustache=require(_0xfed7('0x4'));var util=require(_0xfed7('0x5'));var path=require(_0xfed7('0x6'));var sox=require(_0xfed7('0x7'));var csv=require(_0xfed7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfed7('0x9'));var squel=require(_0xfed7('0xa'));var crypto=require('crypto');var jsforce=require(_0xfed7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfed7('0x8'));var querystring=require('querystring');var Papa=require(_0xfed7('0xc'));var Redis=require(_0xfed7('0xd'));var authService=require(_0xfed7('0xe'));var qs=require(_0xfed7('0xf'));var as=require(_0xfed7('0x10'));var hardwareService=require(_0xfed7('0x11'));var logger=require(_0xfed7('0x12'))(_0xfed7('0x13'));var utils=require(_0xfed7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfed7('0x15'));var db=require(_0xfed7('0x16'))['db'];config[_0xfed7('0x17')]=_[_0xfed7('0x18')](config[_0xfed7('0x17')],{'host':_0xfed7('0x19'),'port':0x18eb});var socket=require(_0xfed7('0x1a'))(new Redis(config[_0xfed7('0x17')]));require('./whatsappMessage.socket')[_0xfed7('0x1b')](socket);var jayson=require(_0xfed7('0x1c'));var client=jayson[_0xfed7('0x1d')][_0xfed7('0x1e')]({'port':0x232c});var client9002=jayson[_0xfed7('0x1d')][_0xfed7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3bb0c7,_0x15f165,_0x5c005f,_0x100124){return new BPromise(function(_0x4761b0,_0x23c88d){var _0x318b7f=_0x100124||client;return _0x318b7f[_0xfed7('0x1f')](_0x3bb0c7,_0x5c005f)['then'](function(_0x2fab75){logger[_0xfed7('0x20')](_0xfed7('0x21'),_0x15f165,_0xfed7('0x22'));logger[_0xfed7('0x23')](_0xfed7('0x24'),_0x15f165,_0xfed7('0x22'),JSON[_0xfed7('0x25')](_0x2fab75));if(_0x2fab75['error']){if(_0x2fab75[_0xfed7('0x26')][_0xfed7('0x27')]===0x1f4){logger[_0xfed7('0x26')](_0xfed7('0x21'),_0x15f165,_0x2fab75['error']['message']);return _0x23c88d(_0x2fab75[_0xfed7('0x26')][_0xfed7('0x28')]);}logger[_0xfed7('0x26')](_0xfed7('0x21'),_0x15f165,_0x2fab75[_0xfed7('0x26')]['message']);return _0x4761b0(_0x2fab75['error'][_0xfed7('0x28')]);}else{logger[_0xfed7('0x20')](_0xfed7('0x21'),_0x15f165,'request\x20sent');_0x4761b0(_0x2fab75[_0xfed7('0x29')][_0xfed7('0x28')]);}})[_0xfed7('0x2a')](function(_0x5bae21){logger[_0xfed7('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x15f165,_0x5bae21);_0x23c88d(_0x5bae21);});});}function respondWithStatusCode(_0x27db6b,_0x3adbe8){_0x3adbe8=_0x3adbe8||0xcc;return function(_0x3d66a1){if(_0x3d66a1){return _0x27db6b[_0xfed7('0x2b')](_0x3adbe8);}return _0x27db6b[_0xfed7('0x2c')](_0x3adbe8)['end']();};}function respondWithResult(_0x1f121b,_0x5a03a8){_0x5a03a8=_0x5a03a8||0xc8;return function(_0x570dcd){if(_0x570dcd){return _0x1f121b['status'](_0x5a03a8)[_0xfed7('0x2d')](_0x570dcd);}};}function respondWithFilteredResult(_0x1e4e77,_0x41d97c){return function(_0x1f42c3){if(_0x1f42c3){var _0x287e24=typeof _0x41d97c[_0xfed7('0x2e')]===_0xfed7('0x2f')&&typeof _0x41d97c['limit']===_0xfed7('0x2f');var _0x4c1021=_0x1f42c3[_0xfed7('0x30')];var _0x51ffa4=_0x287e24?0x0:_0x41d97c[_0xfed7('0x2e')];var _0x4132dd=_0x287e24?_0x1f42c3[_0xfed7('0x30')]:_0x41d97c[_0xfed7('0x2e')]+_0x41d97c[_0xfed7('0x31')];var _0x21377d;if(_0x4132dd>=_0x4c1021){_0x4132dd=_0x4c1021;_0x21377d=0xc8;}else{_0x21377d=0xce;}_0x1e4e77[_0xfed7('0x2c')](_0x21377d);return _0x1e4e77['set'](_0xfed7('0x32'),_0x51ffa4+'-'+_0x4132dd+'/'+_0x4c1021)[_0xfed7('0x2d')](_0x1f42c3);}return null;};}function patchUpdates(_0x5ff332){return function(_0x386274){try{jsonpatch[_0xfed7('0x33')](_0x386274,_0x5ff332,!![]);}catch(_0x5bb741){return BPromise['reject'](_0x5bb741);}return _0x386274[_0xfed7('0x34')]();};}function saveUpdates(_0x1435c6,_0x19b813){return function(_0x81acd0){if(_0x81acd0){return _0x81acd0[_0xfed7('0x35')](_0x1435c6)[_0xfed7('0x36')](function(_0x8ea1cb){return _0x8ea1cb;});}return null;};}function removeEntity(_0xc80594,_0x18ccf4){return function(_0x19d6e8){if(_0x19d6e8){return _0x19d6e8[_0xfed7('0x37')]()[_0xfed7('0x36')](function(){_0xc80594['status'](0xcc)[_0xfed7('0x38')]();});}};}function handleEntityNotFound(_0x4a97e8,_0x2a1ced){return function(_0x2d2371){if(!_0x2d2371){_0x4a97e8['sendStatus'](0x194);}return _0x2d2371;};}function handleError(_0x20cd86,_0x42c139){_0x42c139=_0x42c139||0x1f4;return function(_0x4f9d30){logger[_0xfed7('0x26')](_0x4f9d30[_0xfed7('0x39')]);if(_0x4f9d30['name']){delete _0x4f9d30[_0xfed7('0x3a')];}_0x20cd86[_0xfed7('0x2c')](_0x42c139)[_0xfed7('0x3b')](_0x4f9d30);};}exports[_0xfed7('0x3c')]=function(_0x2d8294,_0x427fb9){var _0x566dc0={},_0x21a11b={},_0x4867c1={'count':0x0,'rows':[]};var _0x2ed546=_[_0xfed7('0x3d')](db[_0xfed7('0x3e')][_0xfed7('0x3f')],function(_0x1df0a7){return{'name':_0x1df0a7['fieldName'],'type':_0x1df0a7[_0xfed7('0x40')][_0xfed7('0x41')]};});_0x21a11b[_0xfed7('0x42')]=_[_0xfed7('0x3d')](_0x2ed546,'name');_0x21a11b['query']=_[_0xfed7('0x43')](_0x2d8294[_0xfed7('0x44')]);_0x21a11b['filters']=_[_0xfed7('0x45')](_0x21a11b[_0xfed7('0x42')],_0x21a11b[_0xfed7('0x44')]);_0x566dc0[_0xfed7('0x46')]=_['intersection'](_0x21a11b[_0xfed7('0x42')],qs[_0xfed7('0x47')](_0x2d8294[_0xfed7('0x44')][_0xfed7('0x47')]));_0x566dc0[_0xfed7('0x46')]=_0x566dc0[_0xfed7('0x46')][_0xfed7('0x48')]?_0x566dc0[_0xfed7('0x46')]:_0x21a11b['model'];if(!_0x2d8294[_0xfed7('0x44')]['hasOwnProperty'](_0xfed7('0x49'))){_0x566dc0[_0xfed7('0x31')]=qs['limit'](_0x2d8294[_0xfed7('0x44')][_0xfed7('0x31')]);_0x566dc0[_0xfed7('0x2e')]=qs[_0xfed7('0x2e')](_0x2d8294[_0xfed7('0x44')][_0xfed7('0x2e')]);}_0x566dc0['order']=qs[_0xfed7('0x4a')](_0x2d8294[_0xfed7('0x44')][_0xfed7('0x4a')]);_0x566dc0[_0xfed7('0x4b')]=qs[_0xfed7('0x4c')](_[_0xfed7('0x4d')](_0x2d8294['query'],_0x21a11b[_0xfed7('0x4c')]),_0x2ed546);if(_0x2d8294[_0xfed7('0x44')]['filter']){_0x566dc0[_0xfed7('0x4b')]=_['merge'](_0x566dc0[_0xfed7('0x4b')],{'$or':_[_0xfed7('0x3d')](_0x2ed546,function(_0x1421f7){if(_0x1421f7[_0xfed7('0x40')]!=='VIRTUAL'){var _0x129208={};_0x129208[_0x1421f7[_0xfed7('0x3a')]]={'$like':'%'+_0x2d8294[_0xfed7('0x44')]['filter']+'%'};return _0x129208;}})});}_0x566dc0=_[_0xfed7('0x4e')]({},_0x566dc0,_0x2d8294[_0xfed7('0x4f')]);var _0x597f3f={'where':_0x566dc0[_0xfed7('0x4b')]};return db[_0xfed7('0x3e')]['count'](_0x597f3f)[_0xfed7('0x36')](function(_0x4eeaf4){_0x4867c1[_0xfed7('0x30')]=_0x4eeaf4;if(_0x2d8294['query']['includeAll']){_0x566dc0[_0xfed7('0x50')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x566dc0);})['then'](function(_0x877e83){_0x4867c1['rows']=_0x877e83;return _0x4867c1;})[_0xfed7('0x36')](respondWithFilteredResult(_0x427fb9,_0x566dc0))[_0xfed7('0x2a')](handleError(_0x427fb9,null));};exports[_0xfed7('0x51')]=function(_0x1eaf8f,_0x14b445){var _0x186142={'raw':!![],'where':{'id':_0x1eaf8f[_0xfed7('0x52')]['id']}},_0x47d303={};_0x47d303[_0xfed7('0x42')]=_[_0xfed7('0x43')](db[_0xfed7('0x3e')][_0xfed7('0x3f')]);_0x47d303['query']=_[_0xfed7('0x43')](_0x1eaf8f[_0xfed7('0x44')]);_0x47d303[_0xfed7('0x4c')]=_[_0xfed7('0x45')](_0x47d303[_0xfed7('0x42')],_0x47d303['query']);_0x186142[_0xfed7('0x46')]=_[_0xfed7('0x45')](_0x47d303[_0xfed7('0x42')],qs[_0xfed7('0x47')](_0x1eaf8f[_0xfed7('0x44')][_0xfed7('0x47')]));_0x186142[_0xfed7('0x46')]=_0x186142['attributes'][_0xfed7('0x48')]?_0x186142[_0xfed7('0x46')]:_0x47d303['model'];if(_0x1eaf8f[_0xfed7('0x44')][_0xfed7('0x53')]){_0x186142[_0xfed7('0x50')]=[{'all':!![]}];}_0x186142=_[_0xfed7('0x4e')]({},_0x186142,_0x1eaf8f[_0xfed7('0x4f')]);return db['WhatsappMessage'][_0xfed7('0x54')](_0x186142)[_0xfed7('0x36')](handleEntityNotFound(_0x14b445,null))[_0xfed7('0x36')](respondWithResult(_0x14b445,null))[_0xfed7('0x2a')](handleError(_0x14b445,null));};exports[_0xfed7('0x55')]=function(_0x1190e,_0x28638b){return db[_0xfed7('0x3e')][_0xfed7('0x55')](_0x1190e['body'],{})[_0xfed7('0x36')](respondWithResult(_0x28638b,0xc9))[_0xfed7('0x2a')](handleError(_0x28638b,null));};exports[_0xfed7('0x35')]=function(_0x591421,_0x214e20){if(_0x591421[_0xfed7('0x56')]['id']){delete _0x591421[_0xfed7('0x56')]['id'];}return db[_0xfed7('0x3e')][_0xfed7('0x54')]({'where':{'id':_0x591421[_0xfed7('0x52')]['id']}})[_0xfed7('0x36')](handleEntityNotFound(_0x214e20,null))[_0xfed7('0x36')](saveUpdates(_0x591421[_0xfed7('0x56')],null))[_0xfed7('0x36')](respondWithResult(_0x214e20,null))['catch'](handleError(_0x214e20,null));};exports[_0xfed7('0x37')]=function(_0x1c7b59,_0x2787a0){return db[_0xfed7('0x3e')][_0xfed7('0x54')]({'where':{'id':_0x1c7b59[_0xfed7('0x52')]['id']}})['then'](handleEntityNotFound(_0x2787a0,null))['then'](removeEntity(_0x2787a0,null))[_0xfed7('0x2a')](handleError(_0x2787a0,null));};exports['describe']=function(_0x991ad2,_0x9ed956){return db[_0xfed7('0x3e')][_0xfed7('0x57')]()[_0xfed7('0x36')](respondWithResult(_0x9ed956,null))[_0xfed7('0x2a')](handleError(_0x9ed956,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['accept']=function(_0x9693f5,_0x437c10,_0x1c3400){var _0x387c80={'agent':{},'channel':_0xfed7('0x58')};if(_0x9693f5[_0xfed7('0x56')]['id']){delete _0x9693f5['body']['id'];}_0x9693f5['body'][_0xfed7('0x59')]=!![];_0x9693f5['body'][_0xfed7('0x5a')]=moment()['format'](_0xfed7('0x5b'));_0x9693f5[_0xfed7('0x56')]['UserId']=_0x9693f5[_0xfed7('0x56')]['UserId']||_0x9693f5[_0xfed7('0x5c')]['id'];_0x387c80[_0xfed7('0x5d')]['id']=_0x9693f5[_0xfed7('0x56')]['UserId'];return db[_0xfed7('0x3e')]['find']({'where':{'id':_0x9693f5[_0xfed7('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x437c10,null))[_0xfed7('0x36')](saveUpdates(_0x9693f5[_0xfed7('0x56')],null))[_0xfed7('0x36')](function(_0x260cb5){if(_0x260cb5){_0x387c80[_0xfed7('0x28')]=_0x260cb5[_0xfed7('0x5e')]({'plain':!![]});return db[_0xfed7('0x5f')][_0xfed7('0x54')]({'where':{'id':_0x260cb5[_0xfed7('0x60')]}});}return null;})[_0xfed7('0x36')](handleEntityNotFound(_0x437c10,null))[_0xfed7('0x36')](function(_0x1cd69e){if(_0x1cd69e){return _0x1cd69e[_0xfed7('0x35')]({'UserId':_0x9693f5['body'][_0xfed7('0x61')],'read1stAt':_[_0xfed7('0x62')](_0x1cd69e[_0xfed7('0x63')])?moment()[_0xfed7('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x312409){if(_0x312409){_0x387c80['interaction']=_0x312409[_0xfed7('0x5e')]({'plain':!![]});interaction_log[_0xfed7('0x20')](_0xfed7('0x65'),_0x9693f5['user']['id'],_0x9693f5[_0xfed7('0x5c')][_0xfed7('0x3a')],_0x9693f5[_0xfed7('0x5c')]['role'],_0x387c80[_0xfed7('0x66')]['id'],_0x9693f5['body']?JSON[_0xfed7('0x25')](_0x9693f5[_0xfed7('0x56')]):'null');return respondWithRpcPromise(_0xfed7('0x67'),'acceptMessage',_0x387c80);}return null;})[_0xfed7('0x36')](function(_0x59a915){var _0x274b94=_0xfed7('0x68')+_0x59a915[_0xfed7('0x28')]['ContactId'];return db['sequelize']['query'](_0x274b94,{'type':db['Sequelize'][_0xfed7('0x69')][_0xfed7('0x6a')],'raw':!![]})[_0xfed7('0x36')](function(_0x2f27ce){return _0x2f27ce;});})[_0xfed7('0x36')](function(_0x278fbc){if(_0x278fbc){_0x387c80[_0xfed7('0x28')]['contact']=_0x278fbc[0x0];if(!_0x9693f5[_0xfed7('0x56')]['UserId'])return;return db[_0xfed7('0x6b')][_0xfed7('0x54')]({'where':{'id':_0x9693f5['body']['UserId'],'role':_0xfed7('0x5d')},'attributes':['id','name',_0xfed7('0x6c'),_0xfed7('0x6d'),_0xfed7('0x6e')],'raw':!![]});}return null;})[_0xfed7('0x36')](function(_0x52f23c){if(!_0x52f23c)return null;_0x387c80[_0xfed7('0x28')][_0xfed7('0x5d')]=_0x52f23c;return _0x387c80;})[_0xfed7('0x36')](function(_0x23b154){if(_0x23b154){if(_0x9693f5['body'][_0xfed7('0x6f')]){_0x387c80[_0xfed7('0x28')][_0xfed7('0x70')]=util[_0xfed7('0x64')]('SIP/%s',_0x9693f5[_0xfed7('0x5c')][_0xfed7('0x3a')]);_0x387c80[_0xfed7('0x28')][_0xfed7('0x71')]=_0x387c80['channel'];_0x387c80[_0xfed7('0x28')][_0xfed7('0x72')]=_0x387c80['channel'];_0x387c80['message']['event']='accept';return respondWithRpcPromise(_0xfed7('0x73'),_0xfed7('0x73'),{'event':_0xfed7('0x74'),'message':_0x387c80['message']},client9002)[_0xfed7('0x36')](function(){return _0x387c80;});}return _0x387c80;}return null;})[_0xfed7('0x36')](respondWithResult(_0x437c10,null))[_0xfed7('0x2a')](handleError(_0x437c10,null));};var interaction_log=require(_0xfed7('0x12'))(_0xfed7('0x75'));exports[_0xfed7('0x76')]=function(_0x3e9c93,_0x33c783,_0x44aa48){var _0x47146d={'agent':{},'channel':_0xfed7('0x58')};if(_0x3e9c93['body']['id']){delete _0x3e9c93[_0xfed7('0x56')]['id'];}_0x3e9c93[_0xfed7('0x56')][_0xfed7('0x61')]=_0x3e9c93['body'][_0xfed7('0x61')]||_0x3e9c93['user']['id'];_0x47146d[_0xfed7('0x5d')]['id']=_0x3e9c93[_0xfed7('0x56')]['UserId'];return db['WhatsappMessage'][_0xfed7('0x54')]({'where':{'id':_0x3e9c93['params']['id'],'UserId':null}})[_0xfed7('0x36')](handleEntityNotFound(_0x33c783,null))['then'](function(_0x13498d){if(_0x13498d){_0x47146d[_0xfed7('0x28')]=_0x13498d[_0xfed7('0x5e')]({'plain':!![]});return db[_0xfed7('0x5f')][_0xfed7('0x54')]({'where':{'id':_0x13498d[_0xfed7('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x33c783,null))[_0xfed7('0x36')](function(_0x4e5ac7){if(_0x4e5ac7){_0x47146d[_0xfed7('0x66')]=_0x4e5ac7[_0xfed7('0x5e')]({'plain':!![]});interaction_log[_0xfed7('0x20')](_0xfed7('0x77'),_0x3e9c93[_0xfed7('0x5c')]['id'],_0x3e9c93[_0xfed7('0x5c')]['name'],_0x3e9c93['user']['role'],_0x47146d['interaction']['id'],_0x3e9c93[_0xfed7('0x56')]?JSON[_0xfed7('0x25')](_0x3e9c93[_0xfed7('0x56')]):'null');return respondWithRpcPromise(_0xfed7('0x78'),_0xfed7('0x79'),_0x47146d);}return null;})[_0xfed7('0x36')](function(_0x321262){var _0x44f66a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x321262[_0xfed7('0x28')][_0xfed7('0x7a')];return db[_0xfed7('0x7b')]['query'](_0x44f66a,{'type':db[_0xfed7('0x7c')][_0xfed7('0x69')][_0xfed7('0x6a')],'raw':!![]})[_0xfed7('0x36')](function(_0xc7a716){return _0xc7a716;});})[_0xfed7('0x36')](function(_0xb2b3f2){if(_0xb2b3f2){_0x47146d[_0xfed7('0x28')][_0xfed7('0x7d')]=_0xb2b3f2[0x0];if(!_0x3e9c93[_0xfed7('0x56')][_0xfed7('0x61')])return;return db['User']['find']({'where':{'id':_0x3e9c93[_0xfed7('0x56')][_0xfed7('0x61')],'role':_0xfed7('0x5d')},'attributes':['id',_0xfed7('0x3a'),_0xfed7('0x6c'),'email',_0xfed7('0x6e')],'raw':!![]});}return null;})[_0xfed7('0x36')](function(_0x1fc747){if(!_0x1fc747)return null;_0x47146d[_0xfed7('0x28')]['agent']=_0x1fc747;return _0x47146d;})[_0xfed7('0x36')](function(_0x61d77e){if(_0x61d77e){_0x61d77e[_0xfed7('0x28')][_0xfed7('0x70')]=util['format'](_0xfed7('0x7e'),_0x3e9c93[_0xfed7('0x5c')][_0xfed7('0x3a')]);_0x61d77e[_0xfed7('0x28')][_0xfed7('0x71')]=_0x47146d[_0xfed7('0x71')];_0x61d77e[_0xfed7('0x28')][_0xfed7('0x72')]=_0x47146d[_0xfed7('0x71')];_0x61d77e[_0xfed7('0x28')][_0xfed7('0x7f')]=_0xfed7('0x76');respondWithRpcPromise('EventManager',_0xfed7('0x73'),{'event':_0xfed7('0x80'),'message':_0x61d77e[_0xfed7('0x28')]},client9002);return _0x47146d;}return null;})['then'](respondWithResult(_0x33c783,null))['catch'](handleError(_0x33c783,null));};exports[_0xfed7('0x2c')]=function(_0x2ab84f,_0xc4675,_0x271686){if(_0x2ab84f[_0xfed7('0x56')]['id']){delete _0x2ab84f['body']['id'];}var _0x3d6d2e;return db['WhatsappMessage'][_0xfed7('0x54')]({'where':{'id':_0x2ab84f[_0xfed7('0x52')]['id']}})[_0xfed7('0x36')](handleEntityNotFound(_0xc4675,null))[_0xfed7('0x36')](function(_0x2350d7){if(_0x2350d7){_0x3d6d2e=_0x2350d7;return db['WhatsappAccount'][_0xfed7('0x54')]({'where':{'id':_0x2350d7[_0xfed7('0x81')]}});}})['then'](handleEntityNotFound(_0xc4675,null))[_0xfed7('0x36')](function(_0x2e0467){if(_0x2e0467){logger['debug'](_0xfed7('0x82'),'status',_0xfed7('0x83'),_0x2e0467[_0xfed7('0x40')],util[_0xfed7('0x84')](_0x2ab84f[_0xfed7('0x56')],{'showHidden':![],'depth':null}));switch(_0x2e0467[_0xfed7('0x40')]){case _0xfed7('0x85'):if(_0x2ab84f[_0xfed7('0x56')][_0xfed7('0x86')]&&_0x2ab84f[_0xfed7('0x56')][_0xfed7('0x86')]===_0x3d6d2e['messageId']&&_0x2ab84f['body'][_0xfed7('0x87')]&&_0x2ab84f[_0xfed7('0x56')][_0xfed7('0x87')]===_0xfed7('0x59')){return _0x3d6d2e['update']({'read':!![]});}else{logger[_0xfed7('0x26')](_0xfed7('0x88'),'status',_0xfed7('0x85'),util['inspect'](_0x2ab84f[_0xfed7('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x3d6d2e;}})['then'](respondWithResult(_0xc4675,null))[_0xfed7('0x2a')](handleError(_0xc4675,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 5bebf01..f5a8909 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 _0x4058=['events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x455bbf,_0x487eb1){var _0x31cc6a=function(_0x510dd8){while(--_0x510dd8){_0x455bbf['push'](_0x455bbf['shift']());}};_0x31cc6a(++_0x487eb1);}(_0x4058,0x129));var _0x8405=function(_0x48e931,_0x2a3983){_0x48e931=_0x48e931-0x0;var _0x3b153f=_0x4058[_0x48e931];return _0x3b153f;};'use strict';var EventEmitter=require(_0x8405('0x0'));var WhatsappMessage=require(_0x8405('0x1'))['db'][_0x8405('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8405('0x3')](0x0);var events={'afterCreate':_0x8405('0x4'),'afterUpdate':_0x8405('0x5'),'afterDestroy':_0x8405('0x6')};function emitEvent(_0x1f6e6e){return function(_0xf8c24c,_0x4948b2,_0x5ebf0e){WhatsappMessageEvents['emit'](_0x1f6e6e+':'+_0xf8c24c['id'],_0xf8c24c);WhatsappMessageEvents[_0x8405('0x7')](_0x1f6e6e,_0xf8c24c);_0x5ebf0e(null);};}for(var e in events){if(events[_0x8405('0x8')](e)){var event=events[e];WhatsappMessage[_0x8405('0x9')](e,emitEvent(event));}}module[_0x8405('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x6215=['events','../../mysqldb','WhatsappMessage','save','update','remove','hook','exports'];(function(_0x143c3b,_0x4aef24){var _0x534991=function(_0x1dc048){while(--_0x1dc048){_0x143c3b['push'](_0x143c3b['shift']());}};_0x534991(++_0x4aef24);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5621('0x0'));var WhatsappMessage=require(_0x5621('0x1'))['db'][_0x5621('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5621('0x3'),'afterUpdate':_0x5621('0x4'),'afterDestroy':_0x5621('0x5')};function emitEvent(_0x173213){return function(_0x204284,_0x13397a,_0x492c6d){WhatsappMessageEvents['emit'](_0x173213+':'+_0x204284['id'],_0x204284);WhatsappMessageEvents['emit'](_0x173213,_0x204284);_0x492c6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x5621('0x6')](e,emitEvent(event));}}module[_0x5621('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 5dd07d3..83f6430 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 _0xf5f9=['type','twilio','accountSid','authToken','messages','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId'];(function(_0x15275a,_0x4a9966){var _0x1ee7b2=function(_0x5a5b48){while(--_0x5a5b48){_0x15275a['push'](_0x15275a['shift']());}};_0x1ee7b2(++_0x4a9966);}(_0xf5f9,0x6a));var _0x9f5f=function(_0x19d019,_0x3326f1){_0x19d019=_0x19d019-0x0;var _0x57e19f=_0xf5f9[_0x19d019];return _0x57e19f;};'use strict';var _=require(_0x9f5f('0x0'));var util=require(_0x9f5f('0x1'));var logger=require('../../config/logger')(_0x9f5f('0x2'));var moment=require(_0x9f5f('0x3'));var BPromise=require(_0x9f5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f5f('0x5'));var rimraf=require(_0x9f5f('0x6'));var config=require(_0x9f5f('0x7'));var attributes=require(_0x9f5f('0x8'));module['exports']=function(_0x1992f6,_0x3a4855){return _0x1992f6['define'](_0x9f5f('0x9'),attributes,{'tableName':_0x9f5f('0xa'),'paranoid':![],'indexes':[{'name':_0x9f5f('0xb'),'fields':['messageId']},{'name':_0x9f5f('0xc'),'fields':[_0x9f5f('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11bc7e,_0x1f2611,_0x3c74b4){var _0x3f36de=_0x1992f6[_0x9f5f('0xe')];var _0x37d686=_0x11bc7e[_0x9f5f('0xf')]({'plain':!![]});if(_0x37d686[_0x9f5f('0x10')][_0x9f5f('0x11')]()==='in'||_0x37d686['direction'][_0x9f5f('0x11')]()===_0x9f5f('0x12')&&!_0x37d686['secret']&&!_['isNil'](_0x37d686[_0x9f5f('0x13')])){_0x3f36de[_0x9f5f('0x14')][_0x9f5f('0x15')]({'where':{'id':_0x37d686[_0x9f5f('0x16')]}})[_0x9f5f('0x17')](function(_0x43c8c2){if(_0x43c8c2){_0x43c8c2[_0x9f5f('0x18')]({'lastMsgAt':_0x37d686[_0x9f5f('0x19')],'lastMsgDirection':_0x37d686[_0x9f5f('0x10')][_0x9f5f('0x11')]()});}})[_0x9f5f('0x1a')](function(_0x273d88){console[_0x9f5f('0x1b')](_0x273d88);});}if(_0x37d686[_0x9f5f('0x10')]==='out'&&!_0x37d686[_0x9f5f('0x1c')]){var _0x5bf821;_0x3f36de[_0x9f5f('0x1d')][_0x9f5f('0x1e')]({'where':{'id':_0x37d686[_0x9f5f('0x1f')]},'raw':!![]})[_0x9f5f('0x17')](function(_0x808094){_0x5bf821=_0x808094;if(_0x5bf821&&_0x5bf821[_0x9f5f('0x20')]){switch(_0x5bf821[_0x9f5f('0x20')]){case'twilio':var _0x34bf86=require(_0x9f5f('0x21'));if(_0x5bf821[_0x9f5f('0x22')]&&_0x5bf821[_0x9f5f('0x23')]&&_0x5bf821['phone']){var _0x2efbc3=new _0x34bf86(_0x5bf821[_0x9f5f('0x22')],_0x5bf821[_0x9f5f('0x23')]);_0x2efbc3[_0x9f5f('0x24')]['create']({'body':_0x37d686[_0x9f5f('0xd')],'to':_0x9f5f('0x25')+_0x37d686['phone'],'from':_0x9f5f('0x25')+_0x5bf821['phone'],'statusCallback':_0x5bf821['remote']+_0x9f5f('0x26')+_0x37d686['id']+_0x9f5f('0x27')+_0x5bf821[_0x9f5f('0x28')]})['then'](function(_0x208edf){if(_0x208edf[_0x9f5f('0x29')]){return _0x11bc7e['update']({'messageId':_0x208edf[_0x9f5f('0x29')]});}})['catch'](function(_0x53f949){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x9f5f('0x2a'),_0x9f5f('0x21'),util[_0x9f5f('0x2b')](_0x53f949,{'showHidden':![],'depth':null}));});}else{logger[_0x9f5f('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x9f5f('0x2c'));}break;}}})['finally'](function(){_0x3c74b4();});}else{_0x3c74b4();}}},'charset':'utf8mb4','collate':_0x9f5f('0x2d')});}; \ No newline at end of file +var _0x987f=['utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','../../config/environment','define','whatsapp_messages','messageId','body','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4'];(function(_0x1e6e22,_0x1cc20b){var _0x318069=function(_0xa1f561){while(--_0xa1f561){_0x1e6e22['push'](_0x1e6e22['shift']());}};_0x318069(++_0x1cc20b);}(_0x987f,0x169));var _0xf987=function(_0x4cce8,_0x22d1fe){_0x4cce8=_0x4cce8-0x0;var _0x458440=_0x987f[_0x4cce8];return _0x458440;};'use strict';var _=require(_0xf987('0x0'));var util=require('util');var logger=require(_0xf987('0x1'))(_0xf987('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf987('0x3'));var fs=require('fs');var path=require(_0xf987('0x4'));var rimraf=require('rimraf');var config=require(_0xf987('0x5'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x4765dd,_0xc48d78){return _0x4765dd[_0xf987('0x6')]('WhatsappMessage',attributes,{'tableName':_0xf987('0x7'),'paranoid':![],'indexes':[{'name':_0xf987('0x8'),'fields':[_0xf987('0x8')]},{'name':'fti_whatsapp_messages','fields':[_0xf987('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa6b0b1,_0x42c151,_0x27113d){var _0x2a9f6c=_0x4765dd[_0xf987('0xa')];var _0x219660=_0xa6b0b1[_0xf987('0xb')]({'plain':!![]});if(_0x219660[_0xf987('0xc')][_0xf987('0xd')]()==='in'||_0x219660[_0xf987('0xc')]['toLowerCase']()===_0xf987('0xe')&&!_0x219660[_0xf987('0xf')]&&!_[_0xf987('0x10')](_0x219660['UserId'])){_0x2a9f6c[_0xf987('0x11')][_0xf987('0x12')]({'where':{'id':_0x219660[_0xf987('0x13')]}})[_0xf987('0x14')](function(_0x27cc59){if(_0x27cc59){_0x27cc59[_0xf987('0x15')]({'lastMsgAt':_0x219660['createdAt'],'lastMsgDirection':_0x219660[_0xf987('0xc')][_0xf987('0xd')]()});}})[_0xf987('0x16')](function(_0x4da4d7){console[_0xf987('0x17')](_0x4da4d7);});}if(_0x219660['direction']==='out'&&!_0x219660[_0xf987('0xf')]){var _0x2b275e;_0x2a9f6c[_0xf987('0x18')][_0xf987('0x19')]({'where':{'id':_0x219660[_0xf987('0x1a')]},'raw':!![]})[_0xf987('0x14')](function(_0x3c088a){_0x2b275e=_0x3c088a;if(_0x2b275e&&_0x2b275e[_0xf987('0x1b')]){switch(_0x2b275e['type']){case _0xf987('0x1c'):var _0x46da93=require(_0xf987('0x1c'));if(_0x2b275e['accountSid']&&_0x2b275e[_0xf987('0x1d')]&&_0x2b275e[_0xf987('0x1e')]){var _0x55fe49=new _0x46da93(_0x2b275e['accountSid'],_0x2b275e[_0xf987('0x1d')]);_0x55fe49[_0xf987('0x1f')][_0xf987('0x20')]({'body':_0x219660['body'],'to':_0xf987('0x21')+_0x219660[_0xf987('0x1e')],'from':'whatsapp:'+_0x2b275e['phone'],'statusCallback':_0x2b275e['remote']+_0xf987('0x22')+_0x219660['id']+_0xf987('0x23')+_0x2b275e[_0xf987('0x24')]})[_0xf987('0x14')](function(_0xea0093){if(_0xea0093[_0xf987('0x25')]){return _0xa6b0b1['update']({'messageId':_0xea0093['sid']});}})[_0xf987('0x16')](function(_0x12109e){logger['error'](_0xf987('0x26'),_0xf987('0x27'),_0xf987('0x1c'),util[_0xf987('0x28')](_0x12109e,{'showHidden':![],'depth':null}));});}else{logger[_0xf987('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xf987('0x27'),_0xf987('0x1c'),_0xf987('0x29'));}break;}}})[_0xf987('0x2a')](function(){_0x27113d();});}else{_0x27113d();}}},'charset':_0xf987('0x2b'),'collate':_0xf987('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 014c010..f426a78 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 _0x1c79=['result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x67049d,_0x1ca385){var _0x30ad32=function(_0x18de20){while(--_0x18de20){_0x67049d['push'](_0x67049d['shift']());}};_0x30ad32(++_0x1ca385);}(_0x1c79,0x10f));var _0x91c7=function(_0x416969,_0x40a311){_0x416969=_0x416969-0x0;var _0x585de1=_0x1c79[_0x416969];return _0x585de1;};'use strict';var _=require(_0x91c7('0x0'));var util=require(_0x91c7('0x1'));var moment=require(_0x91c7('0x2'));var BPromise=require(_0x91c7('0x3'));var rs=require(_0x91c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91c7('0x5'))['db'];var utils=require(_0x91c7('0x6'));var logger=require(_0x91c7('0x7'))(_0x91c7('0x8'));var config=require('../../config/environment');var jayson=require(_0x91c7('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x91c7('0xa')]=_['defaults'](config[_0x91c7('0xa')],{'host':_0x91c7('0xb'),'port':0x18eb});var socket=require(_0x91c7('0xc'))(new Redis(config[_0x91c7('0xa')]));require(_0x91c7('0xd'))[_0x91c7('0xe')](socket);function respondWithRpcPromise(_0x4f24ac,_0x451211,_0x5aa9ec){return new BPromise(function(_0x1504b4,_0x2f0c38){return client[_0x91c7('0xf')](_0x4f24ac,_0x5aa9ec)[_0x91c7('0x10')](function(_0x1712ed){logger[_0x91c7('0x11')](_0x91c7('0x12'),_0x451211,_0x91c7('0x13'));logger[_0x91c7('0x14')](_0x91c7('0x15'),_0x451211,_0x91c7('0x13'),JSON[_0x91c7('0x16')](_0x1712ed));if(_0x1712ed[_0x91c7('0x17')]){if(_0x1712ed[_0x91c7('0x17')][_0x91c7('0x18')]===0x1f4){logger['error'](_0x91c7('0x12'),_0x451211,_0x1712ed[_0x91c7('0x17')][_0x91c7('0x19')]);return _0x2f0c38(_0x1712ed['error'][_0x91c7('0x19')]);}logger['error'](_0x91c7('0x12'),_0x451211,_0x1712ed['error'][_0x91c7('0x19')]);return _0x1504b4(_0x1712ed[_0x91c7('0x17')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x451211,'request\x20sent');_0x1504b4(_0x1712ed[_0x91c7('0x1a')]['message']);}})[_0x91c7('0x1b')](function(_0x3c1825){logger[_0x91c7('0x17')](_0x91c7('0x12'),_0x451211,_0x3c1825);_0x2f0c38(_0x3c1825);});});}exports[_0x91c7('0x1c')]=function(_0x1f1a6b){var _0x2defd3=this;return new Promise(function(_0x4f6fb3,_0xfa226e){return db[_0x91c7('0x1d')]['create'](_0x1f1a6b[_0x91c7('0x1e')],{'raw':_0x1f1a6b[_0x91c7('0x1f')]?_0x1f1a6b['options'][_0x91c7('0x20')]===undefined?!![]:![]:!![]})[_0x91c7('0x10')](function(_0xf4d5f6){logger[_0x91c7('0x11')](_0x91c7('0x1c'),_0x1f1a6b);logger[_0x91c7('0x14')](_0x91c7('0x1c'),_0x1f1a6b,JSON['stringify'](_0xf4d5f6));_0x4f6fb3(_0xf4d5f6);})[_0x91c7('0x1b')](function(_0x4cd1a8){logger[_0x91c7('0x17')](_0x91c7('0x1c'),_0x4cd1a8[_0x91c7('0x19')],_0x1f1a6b);_0xfa226e(_0x2defd3['error'](0x1f4,_0x4cd1a8[_0x91c7('0x19')]));});});}; \ No newline at end of file +var _0x36a5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','util','moment','bluebird','randomstring'];(function(_0x1c518c,_0x383352){var _0x2650cb=function(_0x45fe77){while(--_0x45fe77){_0x1c518c['push'](_0x1c518c['shift']());}};_0x2650cb(++_0x383352);}(_0x36a5,0xd5));var _0x536a=function(_0x5e4555,_0x322a12){_0x5e4555=_0x5e4555-0x0;var _0x472f27=_0x36a5[_0x5e4555];return _0x472f27;};'use strict';var _=require('lodash');var util=require(_0x536a('0x0'));var moment=require(_0x536a('0x1'));var BPromise=require(_0x536a('0x2'));var rs=require(_0x536a('0x3'));var fs=require('fs');var Redis=require(_0x536a('0x4'));var db=require(_0x536a('0x5'))['db'];var utils=require(_0x536a('0x6'));var logger=require(_0x536a('0x7'))('rpc');var config=require(_0x536a('0x8'));var jayson=require(_0x536a('0x9'));var client=jayson[_0x536a('0xa')]['http']({'port':0x232a});config[_0x536a('0xb')]=_[_0x536a('0xc')](config[_0x536a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x536a('0xd'))(new Redis(config[_0x536a('0xb')]));require(_0x536a('0xe'))['register'](socket);function respondWithRpcPromise(_0x172f3f,_0x2d9bc4,_0x5cd27c){return new BPromise(function(_0x57e6a0,_0x5befb4){return client['request'](_0x172f3f,_0x5cd27c)[_0x536a('0xf')](function(_0x2811ab){logger[_0x536a('0x10')](_0x536a('0x11'),_0x2d9bc4,_0x536a('0x12'));logger[_0x536a('0x13')](_0x536a('0x14'),_0x2d9bc4,'request\x20sent',JSON[_0x536a('0x15')](_0x2811ab));if(_0x2811ab[_0x536a('0x16')]){if(_0x2811ab[_0x536a('0x16')][_0x536a('0x17')]===0x1f4){logger[_0x536a('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2d9bc4,_0x2811ab['error'][_0x536a('0x18')]);return _0x5befb4(_0x2811ab[_0x536a('0x16')][_0x536a('0x18')]);}logger[_0x536a('0x16')](_0x536a('0x11'),_0x2d9bc4,_0x2811ab[_0x536a('0x16')][_0x536a('0x18')]);return _0x57e6a0(_0x2811ab[_0x536a('0x16')]['message']);}else{logger[_0x536a('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x2d9bc4,_0x536a('0x12'));_0x57e6a0(_0x2811ab[_0x536a('0x19')][_0x536a('0x18')]);}})[_0x536a('0x1a')](function(_0x32112f){logger['error'](_0x536a('0x11'),_0x2d9bc4,_0x32112f);_0x5befb4(_0x32112f);});});}exports[_0x536a('0x1b')]=function(_0x5c5ea0){var _0x3e9409=this;return new Promise(function(_0x34c957,_0x36087b){return db[_0x536a('0x1c')]['create'](_0x5c5ea0[_0x536a('0x1d')],{'raw':_0x5c5ea0[_0x536a('0x1e')]?_0x5c5ea0[_0x536a('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x536a('0xf')](function(_0x4765be){logger[_0x536a('0x10')](_0x536a('0x1b'),_0x5c5ea0);logger[_0x536a('0x13')](_0x536a('0x1b'),_0x5c5ea0,JSON[_0x536a('0x15')](_0x4765be));_0x34c957(_0x4765be);})['catch'](function(_0x553c91){logger['error'](_0x536a('0x1b'),_0x553c91[_0x536a('0x18')],_0x5c5ea0);_0x36087b(_0x3e9409[_0x536a('0x16')](0x1f4,_0x553c91[_0x536a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index fd6fbdb..ffe47cf 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 _0x9b11=['save','remove','update','emit','removeListener','register','length','whatsappMessage:'];(function(_0x2db412,_0x587cb3){var _0x1e0ee7=function(_0x129df9){while(--_0x129df9){_0x2db412['push'](_0x2db412['shift']());}};_0x1e0ee7(++_0x587cb3);}(_0x9b11,0x98));var _0x19b1=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x9b11[_0x58a4ac];return _0x545810;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x19b1('0x0'),_0x19b1('0x1'),_0x19b1('0x2')];function createListener(_0x33fb28,_0x5807a3){return function(_0x159413){_0x5807a3[_0x19b1('0x3')](_0x33fb28,_0x159413);};}function removeListener(_0x2ece84,_0x537856){return function(){WhatsappMessageEvents[_0x19b1('0x4')](_0x2ece84,_0x537856);};}exports[_0x19b1('0x5')]=function(_0x30ca4d){for(var _0x3309d9=0x0,_0x58bcdf=events[_0x19b1('0x6')];_0x3309d9<_0x58bcdf;_0x3309d9++){var _0x2d03ea=events[_0x3309d9];var _0x2008a2=createListener(_0x19b1('0x7')+_0x2d03ea,_0x30ca4d);WhatsappMessageEvents['on'](_0x2d03ea,_0x2008a2);}}; \ No newline at end of file +var _0x9ba6=['register','./whatsappMessage.events','emit'];(function(_0x51ee65,_0x4df3af){var _0x175627=function(_0x5c98c0){while(--_0x5c98c0){_0x51ee65['push'](_0x51ee65['shift']());}};_0x175627(++_0x4df3af);}(_0x9ba6,0x160));var _0x69ba=function(_0x29f0b6,_0x928504){_0x29f0b6=_0x29f0b6-0x0;var _0x16c186=_0x9ba6[_0x29f0b6];return _0x16c186;};'use strict';var WhatsappMessageEvents=require(_0x69ba('0x0'));var events=['save','remove','update'];function createListener(_0x4d39e7,_0x33f946){return function(_0x5f2c42){_0x33f946[_0x69ba('0x1')](_0x4d39e7,_0x5f2c42);};}function removeListener(_0x8f2ddf,_0x2d20d9){return function(){WhatsappMessageEvents['removeListener'](_0x8f2ddf,_0x2d20d9);};}exports[_0x69ba('0x2')]=function(_0x359c36){for(var _0x36cdf5=0x0,_0x4ab3f5=events['length'];_0x36cdf5<_0x4ab3f5;_0x36cdf5++){var _0xc3d217=events[_0x36cdf5];var _0x14f63d=createListener('whatsappMessage:'+_0xc3d217,_0x359c36);WhatsappMessageEvents['on'](_0xc3d217,_0x14f63d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 7ccbd60..234268f 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 _0x1b26=['../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x1b26,0x16f));var _0x61b2=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1b26[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x61b2('0x0'));var util=require(_0x61b2('0x1'));var path=require(_0x61b2('0x2'));var timeout=require(_0x61b2('0x3'));var express=require(_0x61b2('0x4'));var router=express[_0x61b2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x61b2('0x6'));var interaction=require(_0x61b2('0x7'));var config=require(_0x61b2('0x8'));var controller=require(_0x61b2('0x9'));router[_0x61b2('0xa')]('/',auth[_0x61b2('0xb')](),controller[_0x61b2('0xc')]);router['get'](_0x61b2('0xd'),auth['isAuthenticated'](),controller[_0x61b2('0xe')]);router[_0x61b2('0xa')](_0x61b2('0xf'),auth[_0x61b2('0xb')](),controller[_0x61b2('0x10')]);router[_0x61b2('0xa')](_0x61b2('0x11'),auth[_0x61b2('0xb')](),controller[_0x61b2('0x12')]);router[_0x61b2('0xa')](_0x61b2('0x13'),auth['isAuthenticated'](),controller[_0x61b2('0x14')]);router[_0x61b2('0xa')](_0x61b2('0x15'),auth[_0x61b2('0xb')](),controller[_0x61b2('0x16')]);router['post']('/',auth[_0x61b2('0xb')](),controller[_0x61b2('0x17')]);router[_0x61b2('0x18')](_0x61b2('0x13'),auth[_0x61b2('0xb')](),controller[_0x61b2('0x19')]);router[_0x61b2('0x18')](_0x61b2('0x15'),auth[_0x61b2('0xb')](),controller[_0x61b2('0x1a')]);router[_0x61b2('0x1b')](_0x61b2('0xf'),auth[_0x61b2('0xb')](),controller[_0x61b2('0x1c')]);router[_0x61b2('0x1d')](_0x61b2('0xf'),auth[_0x61b2('0xb')](),controller[_0x61b2('0x1e')]);router[_0x61b2('0x1d')]('/:id/teams',auth[_0x61b2('0xb')](),controller[_0x61b2('0x1f')]);router['delete'](_0x61b2('0x15'),auth[_0x61b2('0xb')](),controller[_0x61b2('0x20')]);module[_0x61b2('0x21')]=router; \ No newline at end of file +var _0x37f6=['update','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','/:id'];(function(_0x18f7c6,_0x28ed55){var _0x5d28d2=function(_0x4c3dc2){while(--_0x4c3dc2){_0x18f7c6['push'](_0x18f7c6['shift']());}};_0x5d28d2(++_0x28ed55);}(_0x37f6,0xdc));var _0x637f=function(_0x4ac8ef,_0x5c2c6e){_0x4ac8ef=_0x4ac8ef-0x0;var _0x3a9239=_0x37f6[_0x4ac8ef];return _0x3a9239;};'use strict';var multer=require(_0x637f('0x0'));var util=require(_0x637f('0x1'));var path=require(_0x637f('0x2'));var timeout=require(_0x637f('0x3'));var express=require('express');var router=express[_0x637f('0x4')]();var fs_extra=require(_0x637f('0x5'));var auth=require(_0x637f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x637f('0x7')]('/',auth[_0x637f('0x8')](),controller[_0x637f('0x9')]);router[_0x637f('0x7')](_0x637f('0xa'),auth[_0x637f('0x8')](),controller[_0x637f('0xb')]);router['get']('/:id',auth[_0x637f('0x8')](),controller['show']);router[_0x637f('0x7')](_0x637f('0xc'),auth[_0x637f('0x8')](),controller[_0x637f('0xd')]);router['get'](_0x637f('0xe'),auth['isAuthenticated'](),controller[_0x637f('0xf')]);router['get']('/:id/users',auth[_0x637f('0x8')](),controller[_0x637f('0x10')]);router[_0x637f('0x11')]('/',auth[_0x637f('0x8')](),controller[_0x637f('0x12')]);router[_0x637f('0x11')]('/:id/teams',auth[_0x637f('0x8')](),controller[_0x637f('0x13')]);router['post'](_0x637f('0x14'),auth['isAuthenticated'](),controller[_0x637f('0x15')]);router['put'](_0x637f('0x16'),auth['isAuthenticated'](),controller[_0x637f('0x17')]);router[_0x637f('0x18')](_0x637f('0x16'),auth[_0x637f('0x8')](),controller['destroy']);router['delete'](_0x637f('0xe'),auth['isAuthenticated'](),controller[_0x637f('0x19')]);router[_0x637f('0x18')](_0x637f('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x637f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f06eb2f..02a7a81 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 _0xdecb=['name','ENUM','beepall','roundrobin','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdecb,0xe2));var _0xbdec=function(_0x78e6e5,_0x2792b3){_0x78e6e5=_0x78e6e5-0x0;var _0x4644a2=_0xdecb[_0x78e6e5];return _0x4644a2;};'use strict';var Sequelize=require('sequelize');module[_0xbdec('0x0')]={'name':{'type':Sequelize[_0xbdec('0x1')],'unique':_0xbdec('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbdec('0x3')]('rrmemory',_0xbdec('0x4'),_0xbdec('0x5'))},'description':{'type':Sequelize[_0xbdec('0x1')]}}; \ No newline at end of file +var _0x7ee1=['ENUM','rrmemory','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0xf02353,_0x5d599b){var _0x59f7df=function(_0x2c7eb0){while(--_0x2c7eb0){_0xf02353['push'](_0xf02353['shift']());}};_0x59f7df(++_0x5d599b);}(_0x7ee1,0xab));var _0x17ee=function(_0x33cdf0,_0x309703){_0x33cdf0=_0x33cdf0-0x0;var _0x4c8be9=_0x7ee1[_0x33cdf0];return _0x4c8be9;};'use strict';var Sequelize=require(_0x17ee('0x0'));module['exports']={'name':{'type':Sequelize[_0x17ee('0x1')],'unique':_0x17ee('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x17ee('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x17ee('0x4')](_0x17ee('0x5'),'beepall',_0x17ee('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9215cbc..4205a39 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 _0x76f1=['options','include','findAll','rows','catch','params','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','nolimit','addTeams','ids','Team','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','addAgents','spread','removeAgents','userWhatsappQueue:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','then','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x76f1,0x167));var _0x176f=function(_0xb0d06,_0x3fac33){_0xb0d06=_0xb0d06-0x0;var _0x264970=_0x76f1[_0xb0d06];return _0x264970;};'use strict';var emlformat=require(_0x176f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x176f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x176f('0x2'));var moment=require('moment');var BPromise=require(_0x176f('0x3'));var Mustache=require('mustache');var util=require(_0x176f('0x4'));var path=require(_0x176f('0x5'));var sox=require(_0x176f('0x6'));var csv=require(_0x176f('0x7'));var ejs=require(_0x176f('0x8'));var fs=require('fs');var fs_extra=require(_0x176f('0x9'));var _=require(_0x176f('0xa'));var squel=require(_0x176f('0xb'));var crypto=require(_0x176f('0xc'));var jsforce=require(_0x176f('0xd'));var deskjs=require(_0x176f('0xe'));var toCsv=require(_0x176f('0x7'));var querystring=require(_0x176f('0xf'));var Papa=require(_0x176f('0x10'));var Redis=require(_0x176f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x176f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x176f('0x13'))(_0x176f('0x14'));var utils=require(_0x176f('0x15'));var config=require(_0x176f('0x16'));var licenseUtil=require(_0x176f('0x17'));var db=require('../../mysqldb')['db'];config[_0x176f('0x18')]=_[_0x176f('0x19')](config[_0x176f('0x18')],{'host':_0x176f('0x1a'),'port':0x18eb});var socket=require(_0x176f('0x1b'))(new Redis(config[_0x176f('0x18')]));require(_0x176f('0x1c'))[_0x176f('0x1d')](socket);function respondWithStatusCode(_0x3836cc,_0x57daee){_0x57daee=_0x57daee||0xcc;return function(_0x20dbb4){if(_0x20dbb4){return _0x3836cc[_0x176f('0x1e')](_0x57daee);}return _0x3836cc[_0x176f('0x1f')](_0x57daee)[_0x176f('0x20')]();};}function respondWithResult(_0x4fb115,_0x192328){_0x192328=_0x192328||0xc8;return function(_0x35e6a2){if(_0x35e6a2){return _0x4fb115[_0x176f('0x1f')](_0x192328)[_0x176f('0x21')](_0x35e6a2);}};}function respondWithFilteredResult(_0x68a792,_0x2dbdc9){return function(_0x3cdb92){if(_0x3cdb92){var _0x45d76d=typeof _0x2dbdc9[_0x176f('0x22')]===_0x176f('0x23')&&typeof _0x2dbdc9[_0x176f('0x24')]===_0x176f('0x23');var _0x2143d5=_0x3cdb92[_0x176f('0x25')];var _0x513446=_0x45d76d?0x0:_0x2dbdc9[_0x176f('0x22')];var _0x2cc736=_0x45d76d?_0x3cdb92[_0x176f('0x25')]:_0x2dbdc9[_0x176f('0x22')]+_0x2dbdc9[_0x176f('0x24')];var _0x54a64e;if(_0x2cc736>=_0x2143d5){_0x2cc736=_0x2143d5;_0x54a64e=0xc8;}else{_0x54a64e=0xce;}_0x68a792[_0x176f('0x1f')](_0x54a64e);return _0x68a792[_0x176f('0x26')]('Content-Range',_0x513446+'-'+_0x2cc736+'/'+_0x2143d5)[_0x176f('0x21')](_0x3cdb92);}return null;};}function patchUpdates(_0x1fdd51){return function(_0x40872f){try{jsonpatch['apply'](_0x40872f,_0x1fdd51,!![]);}catch(_0x1c1e7e){return BPromise[_0x176f('0x27')](_0x1c1e7e);}return _0x40872f[_0x176f('0x28')]();};}function saveUpdates(_0x547387,_0xaeaae7){return function(_0x28228f){if(_0x28228f){return _0x28228f['update'](_0x547387)['then'](function(_0x1c3533){return _0x1c3533;});}return null;};}function removeEntity(_0x3e5313,_0x2b4560){return function(_0x5f26d7){if(_0x5f26d7){return _0x5f26d7[_0x176f('0x29')]()[_0x176f('0x2a')](function(){var _0x4a0776=_0x5f26d7['get']({'plain':!![]});var _0x2fb29a=_0x176f('0x2b');return db[_0x176f('0x2c')][_0x176f('0x29')]({'where':{'type':_0x2fb29a,'resourceId':_0x4a0776['id']}})[_0x176f('0x2a')](function(){return _0x5f26d7;});})['then'](function(){_0x3e5313['status'](0xcc)[_0x176f('0x20')]();});}};}function handleEntityNotFound(_0xa3bff3,_0x481cca){return function(_0x1b36e4){if(!_0x1b36e4){_0xa3bff3[_0x176f('0x1e')](0x194);}return _0x1b36e4;};}function handleError(_0x4630dd,_0x22180b){_0x22180b=_0x22180b||0x1f4;return function(_0x14c87a){logger['error'](_0x14c87a[_0x176f('0x2d')]);if(_0x14c87a[_0x176f('0x2e')]){delete _0x14c87a[_0x176f('0x2e')];}_0x4630dd['status'](_0x22180b)[_0x176f('0x2f')](_0x14c87a);};}exports[_0x176f('0x30')]=function(_0x29e3fd,_0x4acade){var _0x2a2fed={},_0x287cd7={},_0x47f2ac={'count':0x0,'rows':[]};var _0xbae21c=_[_0x176f('0x31')](db[_0x176f('0x32')][_0x176f('0x33')],function(_0x1e3ab9){return{'name':_0x1e3ab9[_0x176f('0x34')],'type':_0x1e3ab9[_0x176f('0x35')]['key']};});_0x287cd7[_0x176f('0x36')]=_['map'](_0xbae21c,_0x176f('0x2e'));_0x287cd7[_0x176f('0x37')]=_[_0x176f('0x38')](_0x29e3fd['query']);_0x287cd7[_0x176f('0x39')]=_[_0x176f('0x3a')](_0x287cd7[_0x176f('0x36')],_0x287cd7[_0x176f('0x37')]);_0x2a2fed[_0x176f('0x3b')]=_['intersection'](_0x287cd7[_0x176f('0x36')],qs['fields'](_0x29e3fd[_0x176f('0x37')][_0x176f('0x3c')]));_0x2a2fed['attributes']=_0x2a2fed['attributes'][_0x176f('0x3d')]?_0x2a2fed[_0x176f('0x3b')]:_0x287cd7[_0x176f('0x36')];if(!_0x29e3fd[_0x176f('0x37')][_0x176f('0x3e')]('nolimit')){_0x2a2fed['limit']=qs[_0x176f('0x24')](_0x29e3fd[_0x176f('0x37')][_0x176f('0x24')]);_0x2a2fed[_0x176f('0x22')]=qs[_0x176f('0x22')](_0x29e3fd[_0x176f('0x37')][_0x176f('0x22')]);}_0x2a2fed[_0x176f('0x3f')]=qs[_0x176f('0x40')](_0x29e3fd['query'][_0x176f('0x40')]);_0x2a2fed[_0x176f('0x41')]=qs[_0x176f('0x39')](_[_0x176f('0x42')](_0x29e3fd[_0x176f('0x37')],_0x287cd7[_0x176f('0x39')]),_0xbae21c);if(_0x29e3fd[_0x176f('0x37')][_0x176f('0x43')]){_0x2a2fed[_0x176f('0x41')]=_[_0x176f('0x44')](_0x2a2fed['where'],{'$or':_[_0x176f('0x31')](_0xbae21c,function(_0x40770a){if(_0x40770a['type']!==_0x176f('0x45')){var _0x1fed86={};_0x1fed86[_0x40770a[_0x176f('0x2e')]]={'$like':'%'+_0x29e3fd[_0x176f('0x37')][_0x176f('0x43')]+'%'};return _0x1fed86;}})});}_0x2a2fed=_['merge']({},_0x2a2fed,_0x29e3fd[_0x176f('0x46')]);var _0x5d0cee={'where':_0x2a2fed[_0x176f('0x41')]};return db[_0x176f('0x32')]['count'](_0x5d0cee)['then'](function(_0x2e8701){_0x47f2ac[_0x176f('0x25')]=_0x2e8701;if(_0x29e3fd[_0x176f('0x37')]['includeAll']){_0x2a2fed[_0x176f('0x47')]=[{'all':!![]}];}return db[_0x176f('0x32')][_0x176f('0x48')](_0x2a2fed);})['then'](function(_0xf9b928){_0x47f2ac[_0x176f('0x49')]=_0xf9b928;return _0x47f2ac;})[_0x176f('0x2a')](respondWithFilteredResult(_0x4acade,_0x2a2fed))[_0x176f('0x4a')](handleError(_0x4acade,null));};exports['show']=function(_0x308eae,_0x24d497){var _0xc1bde={'raw':!![],'where':{'id':_0x308eae[_0x176f('0x4b')]['id']}},_0x5e165e={};_0x5e165e[_0x176f('0x36')]=_[_0x176f('0x38')](db[_0x176f('0x32')][_0x176f('0x33')]);_0x5e165e[_0x176f('0x37')]=_[_0x176f('0x38')](_0x308eae[_0x176f('0x37')]);_0x5e165e[_0x176f('0x39')]=_[_0x176f('0x3a')](_0x5e165e[_0x176f('0x36')],_0x5e165e[_0x176f('0x37')]);_0xc1bde['attributes']=_['intersection'](_0x5e165e[_0x176f('0x36')],qs[_0x176f('0x3c')](_0x308eae[_0x176f('0x37')]['fields']));_0xc1bde['attributes']=_0xc1bde['attributes']['length']?_0xc1bde[_0x176f('0x3b')]:_0x5e165e[_0x176f('0x36')];if(_0x308eae['query'][_0x176f('0x4c')]){_0xc1bde[_0x176f('0x47')]=[{'all':!![]}];}_0xc1bde=_[_0x176f('0x44')]({},_0xc1bde,_0x308eae[_0x176f('0x46')]);return db[_0x176f('0x32')]['find'](_0xc1bde)[_0x176f('0x2a')](handleEntityNotFound(_0x24d497,null))[_0x176f('0x2a')](respondWithResult(_0x24d497,null))['catch'](handleError(_0x24d497,null));};exports[_0x176f('0x4d')]=function(_0x307e31,_0x32b58d){return db[_0x176f('0x32')][_0x176f('0x4d')](_0x307e31[_0x176f('0x4e')],{})[_0x176f('0x2a')](function(_0x448992){var _0xeae20f=_0x307e31[_0x176f('0x4f')][_0x176f('0x50')]({'plain':!![]});if(!_0xeae20f)throw new Error(_0x176f('0x51'));if(_0xeae20f['role']==='user'){var _0xf121ae=_0x448992[_0x176f('0x50')]({'plain':!![]});var _0x2eb9fb=_0x176f('0x2b');return db[_0x176f('0x52')]['find']({'where':{'name':_0x2eb9fb,'userProfileId':_0xeae20f[_0x176f('0x53')]},'raw':!![]})[_0x176f('0x2a')](function(_0x5394c2){if(_0x5394c2&&_0x5394c2[_0x176f('0x54')]===0x0){return db['UserProfileResource'][_0x176f('0x4d')]({'name':_0xf121ae[_0x176f('0x2e')],'resourceId':_0xf121ae['id'],'type':_0x5394c2['name'],'sectionId':_0x5394c2['id']},{})[_0x176f('0x2a')](function(){return _0x448992;});}else{return _0x448992;}})[_0x176f('0x4a')](function(_0xacfd0f){logger[_0x176f('0x55')](_0x176f('0x56'),_0xacfd0f);throw _0xacfd0f;});}return _0x448992;})[_0x176f('0x2a')](respondWithResult(_0x32b58d,0xc9))['catch'](handleError(_0x32b58d,null));};exports['update']=function(_0x4e24d0,_0x37ac3c){if(_0x4e24d0[_0x176f('0x4e')]['id']){delete _0x4e24d0['body']['id'];}return db[_0x176f('0x32')]['find']({'where':{'id':_0x4e24d0['params']['id']}})[_0x176f('0x2a')](handleEntityNotFound(_0x37ac3c,null))['then'](saveUpdates(_0x4e24d0[_0x176f('0x4e')],null))[_0x176f('0x2a')](respondWithResult(_0x37ac3c,null))[_0x176f('0x4a')](handleError(_0x37ac3c,null));};exports[_0x176f('0x29')]=function(_0xa68ee,_0x1f0433){return db[_0x176f('0x32')][_0x176f('0x57')]({'where':{'id':_0xa68ee['params']['id']}})[_0x176f('0x2a')](handleEntityNotFound(_0x1f0433,null))['then'](removeEntity(_0x1f0433,null))[_0x176f('0x4a')](handleError(_0x1f0433,null));};exports[_0x176f('0x58')]=function(_0x4d712b,_0x462d97){return db[_0x176f('0x32')][_0x176f('0x58')]()['then'](respondWithResult(_0x462d97,null))['catch'](handleError(_0x462d97,null));};exports[_0x176f('0x59')]=function(_0x281045,_0x159ee2,_0x831fcf){var _0x12e688={'raw':!![],'where':{}},_0x4f3427={},_0x2d847f;return db[_0x176f('0x32')]['findOne']({'where':{'id':_0x281045[_0x176f('0x4b')]['id']}})[_0x176f('0x2a')](handleEntityNotFound(_0x159ee2,null))[_0x176f('0x2a')](function(_0x55d9cc){if(_0x55d9cc){_0x2d847f=_0x55d9cc[_0x176f('0x50')]({'plain':!![]});_0x4f3427[_0x176f('0x36')]=_['keys'](db['UserWhatsappQueue']['rawAttributes']);_0x4f3427[_0x176f('0x37')]=_['keys'](_0x281045[_0x176f('0x37')]);_0x4f3427[_0x176f('0x39')]=_[_0x176f('0x3a')](_0x4f3427[_0x176f('0x36')],_0x4f3427[_0x176f('0x37')]);_0x12e688['attributes']=_['intersection'](_0x4f3427[_0x176f('0x36')],qs['fields'](_0x281045['query'][_0x176f('0x3c')]));_0x12e688[_0x176f('0x3b')]=_0x12e688['attributes'][_0x176f('0x3d')]?_0x12e688[_0x176f('0x3b')]:_0x4f3427[_0x176f('0x36')];if(!_0x281045[_0x176f('0x37')][_0x176f('0x3e')]('nolimit')){_0x12e688[_0x176f('0x24')]=qs[_0x176f('0x24')](_0x281045['query'][_0x176f('0x24')]);_0x12e688[_0x176f('0x22')]=qs[_0x176f('0x22')](_0x281045[_0x176f('0x37')][_0x176f('0x22')]);}_0x12e688['order']=qs[_0x176f('0x40')](_0x281045['query'][_0x176f('0x40')]);_0x12e688[_0x176f('0x41')]=qs[_0x176f('0x39')](_[_0x176f('0x42')](_0x281045[_0x176f('0x37')],_0x4f3427[_0x176f('0x39')]));_0x12e688[_0x176f('0x41')][_0x176f('0x5a')]=_0x55d9cc['id'];if(_0x281045[_0x176f('0x37')][_0x176f('0x43')]){_0x12e688[_0x176f('0x41')]=_[_0x176f('0x44')](_0x12e688[_0x176f('0x41')],{'$or':_['map'](_0x12e688['attributes'],function(_0x3a12de){var _0x38c216={};_0x38c216[_0x3a12de]={'$like':'%'+_0x281045[_0x176f('0x37')][_0x176f('0x43')]+'%'};return _0x38c216;})});}_0x12e688=_[_0x176f('0x44')]({},_0x12e688,_0x281045['options']);return db[_0x176f('0x5b')][_0x176f('0x48')](_0x12e688);}})['then'](function(_0x4984a5){if(_0x4984a5){return db[_0x176f('0x5c')][_0x176f('0x5d')]({'where':{'id':_[_0x176f('0x31')](_0x4984a5,_0x176f('0x5e')),'role':_0x176f('0x5f')},'attributes':['id',_0x176f('0x2e'),_0x176f('0x60'),_0x176f('0x61'),_0x176f('0x62')]});}})['then'](function(_0x5ee16a){if(_0x5ee16a){return{'count':_0x5ee16a[_0x176f('0x25')],'rows':_['map'](_0x5ee16a[_0x176f('0x49')],function(_0x6b4804){return{'membername':_0x6b4804[_0x176f('0x2e')],'UserId':_0x6b4804['id'],'queue_name':_0x2d847f[_0x176f('0x2e')],'WhatsappQueueId':_0x2d847f['id'],'interface':util[_0x176f('0x63')](_0x176f('0x64'),_0x176f('0x65'),_0x6b4804[_0x176f('0x2e')]),'penalty':0x0,'paused':_0x6b4804['whatsappPause'],'createdAt':_0x6b4804[_0x176f('0x62')],'updatedAt':_0x6b4804[_0x176f('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x176f('0x2a')](respondWithFilteredResult(_0x159ee2,_0x12e688))[_0x176f('0x4a')](handleError(_0x159ee2,null));};exports[_0x176f('0x66')]=function(_0x41bcf9,_0x416642,_0x288f39){var _0x1f8af4={};var _0x543c87={};var _0x331ce1;var _0x4309fc;return db[_0x176f('0x32')][_0x176f('0x67')]({'where':{'id':_0x41bcf9[_0x176f('0x4b')]['id']}})[_0x176f('0x2a')](handleEntityNotFound(_0x416642,null))['then'](function(_0x3c5981){if(_0x3c5981){_0x331ce1=_0x3c5981;_0x543c87[_0x176f('0x36')]=_['keys'](db['Team'][_0x176f('0x33')]);_0x543c87[_0x176f('0x37')]=_['keys'](_0x41bcf9['query']);_0x543c87[_0x176f('0x39')]=_[_0x176f('0x3a')](_0x543c87['model'],_0x543c87['query']);_0x1f8af4[_0x176f('0x3b')]=_[_0x176f('0x3a')](_0x543c87[_0x176f('0x36')],qs['fields'](_0x41bcf9[_0x176f('0x37')][_0x176f('0x3c')]));_0x1f8af4[_0x176f('0x3b')]=_0x1f8af4[_0x176f('0x3b')]['length']?_0x1f8af4['attributes']:_0x543c87['model'];_0x1f8af4['order']=qs[_0x176f('0x40')](_0x41bcf9[_0x176f('0x37')][_0x176f('0x40')]);_0x1f8af4[_0x176f('0x41')]=qs[_0x176f('0x39')](_[_0x176f('0x42')](_0x41bcf9[_0x176f('0x37')],_0x543c87['filters']));if(_0x41bcf9[_0x176f('0x37')][_0x176f('0x43')]){_0x1f8af4[_0x176f('0x41')]=_[_0x176f('0x44')](_0x1f8af4[_0x176f('0x41')],{'$or':_[_0x176f('0x31')](_0x1f8af4['attributes'],function(_0x84a68f){var _0x4c95a4={};_0x4c95a4[_0x84a68f]={'$like':'%'+_0x41bcf9[_0x176f('0x37')][_0x176f('0x43')]+'%'};return _0x4c95a4;})});}_0x1f8af4=_[_0x176f('0x44')]({},_0x1f8af4,_0x41bcf9['options']);return _0x331ce1[_0x176f('0x66')](_0x1f8af4);}})['then'](function(_0x280c7c){if(_0x280c7c){_0x4309fc=_0x280c7c[_0x176f('0x3d')];if(!_0x41bcf9[_0x176f('0x37')][_0x176f('0x3e')](_0x176f('0x68'))){_0x1f8af4[_0x176f('0x24')]=qs[_0x176f('0x24')](_0x41bcf9[_0x176f('0x37')][_0x176f('0x24')]);_0x1f8af4[_0x176f('0x22')]=qs[_0x176f('0x22')](_0x41bcf9['query']['offset']);}return _0x331ce1['getTeams'](_0x1f8af4);}})[_0x176f('0x2a')](function(_0x14cb02){if(_0x14cb02){return _0x14cb02?{'count':_0x4309fc,'rows':_0x14cb02}:null;}})[_0x176f('0x2a')](respondWithResult(_0x416642,null))['catch'](handleError(_0x416642,null));};exports[_0x176f('0x69')]=function(_0x3294a5,_0x2c57a6,_0x3cbafd){var _0x5aa2ab=_0x3294a5[_0x176f('0x4e')][_0x176f('0x6a')];return db[_0x176f('0x6b')][_0x176f('0x48')]({'where':{'id':_0x5aa2ab},'attributes':['id'],'include':[{'model':db[_0x176f('0x5c')],'as':'Agents','attributes':['id',_0x176f('0x2e'),_0x176f('0x6c'),_0x176f('0x6d'),_0x176f('0x6e')],'raw':!![]}]})[_0x176f('0x2a')](function(_0x1e131c){if(_0x1e131c){var _0x2a9c42=_['flatMap'](_0x1e131c,function(_0x59c809){var _0x4d3bbf=_0x59c809[_0x176f('0x50')]({'plain':!![]});return _0x4d3bbf[_0x176f('0x6f')];});return db[_0x176f('0x32')][_0x176f('0x57')]({'where':{'id':_0x3294a5[_0x176f('0x4b')]['id']}})['then'](function(_0x59d7b5){return db[_0x176f('0x70')][_0x176f('0x71')](function(_0x52a879){return _0x59d7b5['addTeams'](_0x5aa2ab,{'transaction':_0x52a879})[_0x176f('0x2a')](function(){return BPromise[_0x176f('0x72')](_0x2a9c42,function(_0x18676d){return db[_0x176f('0x5b')][_0x176f('0x73')]({'where':{'UserId':_0x18676d['id'],'WhatsappQueueId':_0x3294a5[_0x176f('0x4b')]['id']},'transaction':_0x52a879});});})[_0x176f('0x2a')](function(){_0x2a9c42[_0x176f('0x74')](function(_0x54be14){socket[_0x176f('0x75')](_0x176f('0x76'),{'UserId':_0x54be14['id'],'WhatsappQueueId':_0x59d7b5['id']});});});});});}})[_0x176f('0x2a')](respondWithStatusCode(_0x2c57a6,null))[_0x176f('0x4a')](handleError(_0x2c57a6,null));};exports[_0x176f('0x77')]=function(_0x2de11d,_0x44f667,_0x24e50d){return db[_0x176f('0x6b')][_0x176f('0x48')]({'where':{'id':_0x2de11d[_0x176f('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x176f('0x2a')](handleEntityNotFound(_0x44f667,null))[_0x176f('0x2a')](function(_0xb5d6d1){var _0x4fe45b=_[_0x176f('0x31')](_0xb5d6d1,'id');var _0x387221=[];var _0x2945c3=[];var _0x33ff0d=squel[_0x176f('0x78')]();_0x33ff0d[_0x176f('0x79')]('tq.TeamId')[_0x176f('0x7a')](_0x176f('0x7b'),'tq')[_0x176f('0x7c')](_0x176f('0x7d'),'ut',_0x176f('0x7e'))['where'](_0x176f('0x7f'),_0x2de11d[_0x176f('0x4b')]['id']);for(var _0x7426e7=0x0;_0x7426e7<_0xb5d6d1[_0x176f('0x3d')];_0x7426e7+=0x1){let _0x551529=_0xb5d6d1[_0x7426e7];for(var _0xd25654=0x0;_0xd25654<_0x551529['Agents']['length'];_0xd25654+=0x1){let _0x326d7a=_0x551529[_0x176f('0x6f')][_0xd25654];var _0x5b2bc5=_0x33ff0d[_0x176f('0x80')]();_0x5b2bc5['where'](_0x176f('0x81'),_0x326d7a['id']);_0x2945c3['push'](db[_0x176f('0x70')][_0x176f('0x37')](_0x5b2bc5['toString'](),{'type':db[_0x176f('0x70')][_0x176f('0x82')]['SELECT']})[_0x176f('0x2a')](function(_0x4a5aa0){if(_0x4a5aa0['length']===0x1){return _0x326d7a['id'];}else{var _0xcd8eaa=_[_0x176f('0x83')](_['map'](_0x4a5aa0,_0x176f('0x84')),function(_0x4ae884){return _[_0x176f('0x85')](_0x4fe45b,_0x4ae884);});if(_0xcd8eaa){return _0x326d7a['id'];}}}));}}return BPromise[_0x176f('0x86')](_0x2945c3)['then'](function(_0xa543fc){_0x387221=_(_0x387221)['union'](_0xa543fc)[_0x176f('0x87')]()[_0x176f('0x88')]();return db[_0x176f('0x32')][_0x176f('0x57')]({'where':{'id':_0x2de11d[_0x176f('0x4b')]['id']}})[_0x176f('0x2a')](function(_0xdf8983){return db[_0x176f('0x70')][_0x176f('0x71')](function(_0x2db9ae){return _0xdf8983[_0x176f('0x77')](_0x2de11d[_0x176f('0x37')]['ids'],{'transaction':_0x2db9ae})['then'](function(){if(!_[_0x176f('0x89')](_0x387221)){return _0xdf8983['removeAgents'](_0x387221,{'transaction':_0x2db9ae});}})[_0x176f('0x2a')](function(){_0x387221['forEach'](function(_0x32b0d9){socket[_0x176f('0x75')]('userWhatsappQueue:remove',{'UserId':_0x32b0d9,'WhatsappQueueId':_0xdf8983['id']});});});});});});})['then'](respondWithStatusCode(_0x44f667,null))['catch'](handleError(_0x44f667,null));};exports[_0x176f('0x8a')]=function(_0x26877e,_0xd8c9c0,_0x21ae51){return db[_0x176f('0x32')]['find']({'where':{'id':_0x26877e[_0x176f('0x4b')]['id']}})[_0x176f('0x2a')](handleEntityNotFound(_0xd8c9c0,null))[_0x176f('0x2a')](function(_0x251abf){if(_0x251abf){return _0x251abf[_0x176f('0x8a')](_0x26877e[_0x176f('0x4e')][_0x176f('0x6a')],_['omit'](_0x26877e[_0x176f('0x4e')],[_0x176f('0x6a'),'id'])||{})[_0x176f('0x8b')](function(_0xf25808){for(var _0x4d9c6e=0x0;_0x4d9c6e<_0x26877e['body'][_0x176f('0x6a')][_0x176f('0x3d')];_0x4d9c6e+=0x1){socket[_0x176f('0x75')](_0x176f('0x76'),{'UserId':Number(_0x26877e['body'][_0x176f('0x6a')][_0x4d9c6e]),'WhatsappQueueId':Number(_0x26877e[_0x176f('0x4b')]['id'])});}return _0xf25808;});}})[_0x176f('0x2a')](respondWithResult(_0xd8c9c0,null))['catch'](handleError(_0xd8c9c0,null));};exports[_0x176f('0x8c')]=function(_0x349484,_0x25c9b6,_0x153c0e){return db['WhatsappQueue'][_0x176f('0x57')]({'where':{'id':_0x349484[_0x176f('0x4b')]['id']}})[_0x176f('0x2a')](handleEntityNotFound(_0x25c9b6,null))[_0x176f('0x2a')](function(_0x3ac651){if(_0x3ac651){return _0x3ac651[_0x176f('0x8c')](_0x349484['query'][_0x176f('0x6a')])['then'](function(){if(_['isArray'](_0x349484[_0x176f('0x37')]['ids'])){for(var _0x338e61=0x0;_0x338e61<_0x349484[_0x176f('0x37')]['ids'][_0x176f('0x3d')];_0x338e61+=0x1){socket[_0x176f('0x75')](_0x176f('0x8d'),{'UserId':Number(_0x349484[_0x176f('0x37')][_0x176f('0x6a')][_0x338e61]),'WhatsappQueueId':Number(_0x349484['params']['id'])});}}else{socket[_0x176f('0x75')](_0x176f('0x8d'),{'UserId':Number(_0x349484['query']['ids']),'WhatsappQueueId':Number(_0x349484[_0x176f('0x4b')]['id'])});}});}})[_0x176f('0x2a')](respondWithStatusCode(_0x25c9b6,null))[_0x176f('0x4a')](handleError(_0x25c9b6,null));};exports[_0x176f('0x8e')]=function(_0x467c1f,_0x58f88c,_0x4b6542){var _0xdb3b2={};var _0x482d65={};var _0x56a6f8;var _0x1e802d;return db[_0x176f('0x32')][_0x176f('0x67')]({'where':{'id':_0x467c1f[_0x176f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58f88c,null))[_0x176f('0x2a')](function(_0xc63707){if(_0xc63707){_0x56a6f8=_0xc63707;_0x482d65[_0x176f('0x36')]=_['keys'](db[_0x176f('0x5c')][_0x176f('0x33')]);_0x482d65['query']=_[_0x176f('0x38')](_0x467c1f['query']);_0x482d65['filters']=_['intersection'](_0x482d65[_0x176f('0x36')],_0x482d65['query']);_0xdb3b2[_0x176f('0x3b')]=_['intersection'](_0x482d65['model'],qs['fields'](_0x467c1f['query'][_0x176f('0x3c')]));_0xdb3b2[_0x176f('0x3b')]=_0xdb3b2['attributes']['length']?_0xdb3b2[_0x176f('0x3b')]:_0x482d65[_0x176f('0x36')];_0xdb3b2[_0x176f('0x3f')]=qs['sort'](_0x467c1f[_0x176f('0x37')][_0x176f('0x40')]);_0xdb3b2['where']=qs['filters'](_['pick'](_0x467c1f[_0x176f('0x37')],_0x482d65[_0x176f('0x39')]));if(_0x467c1f[_0x176f('0x37')][_0x176f('0x43')]){_0xdb3b2[_0x176f('0x41')]=_['merge'](_0xdb3b2['where'],{'$or':_[_0x176f('0x31')](_0xdb3b2[_0x176f('0x3b')],function(_0x389ca5){var _0x2fa33e={};_0x2fa33e[_0x389ca5]={'$like':'%'+_0x467c1f['query']['filter']+'%'};return _0x2fa33e;})});}_0xdb3b2=_[_0x176f('0x44')]({},_0xdb3b2,_0x467c1f[_0x176f('0x46')]);return _0x56a6f8['getAgents'](_0xdb3b2);}})[_0x176f('0x2a')](function(_0x574c22){if(_0x574c22){_0x1e802d=_0x574c22[_0x176f('0x3d')];if(!_0x467c1f[_0x176f('0x37')][_0x176f('0x3e')](_0x176f('0x68'))){_0xdb3b2[_0x176f('0x24')]=qs[_0x176f('0x24')](_0x467c1f[_0x176f('0x37')][_0x176f('0x24')]);_0xdb3b2[_0x176f('0x22')]=qs[_0x176f('0x22')](_0x467c1f[_0x176f('0x37')]['offset']);}return _0x56a6f8[_0x176f('0x8e')](_0xdb3b2);}})['then'](function(_0x5acf2b){if(_0x5acf2b){return _0x5acf2b?{'count':_0x1e802d,'rows':_0x5acf2b}:null;}})[_0x176f('0x2a')](respondWithResult(_0x58f88c,null))[_0x176f('0x4a')](handleError(_0x58f88c,null));}; \ No newline at end of file +var _0x2348=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','where','merge','filter','WhatsappQueue','includeAll','findAll','rows','catch','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','removeAgents','getAgents','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2348,0x191));var _0x8234=function(_0x43330e,_0x3ddaae){_0x43330e=_0x43330e-0x0;var _0x9fedf4=_0x2348[_0x43330e];return _0x9fedf4;};'use strict';var emlformat=require(_0x8234('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8234('0x1'));var jsonpatch=require(_0x8234('0x2'));var rp=require(_0x8234('0x3'));var moment=require(_0x8234('0x4'));var BPromise=require(_0x8234('0x5'));var Mustache=require('mustache');var util=require(_0x8234('0x6'));var path=require(_0x8234('0x7'));var sox=require(_0x8234('0x8'));var csv=require('to-csv');var ejs=require(_0x8234('0x9'));var fs=require('fs');var fs_extra=require(_0x8234('0xa'));var _=require(_0x8234('0xb'));var squel=require(_0x8234('0xc'));var crypto=require(_0x8234('0xd'));var jsforce=require(_0x8234('0xe'));var deskjs=require(_0x8234('0xf'));var toCsv=require(_0x8234('0x10'));var querystring=require(_0x8234('0x11'));var Papa=require(_0x8234('0x12'));var Redis=require(_0x8234('0x13'));var authService=require(_0x8234('0x14'));var qs=require(_0x8234('0x15'));var as=require(_0x8234('0x16'));var hardwareService=require(_0x8234('0x17'));var logger=require('../../config/logger')(_0x8234('0x18'));var utils=require(_0x8234('0x19'));var config=require(_0x8234('0x1a'));var licenseUtil=require(_0x8234('0x1b'));var db=require(_0x8234('0x1c'))['db'];config[_0x8234('0x1d')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8234('0x1e'))(new Redis(config[_0x8234('0x1d')]));require(_0x8234('0x1f'))[_0x8234('0x20')](socket);function respondWithStatusCode(_0x4db755,_0x25b70c){_0x25b70c=_0x25b70c||0xcc;return function(_0x85b4f2){if(_0x85b4f2){return _0x4db755[_0x8234('0x21')](_0x25b70c);}return _0x4db755['status'](_0x25b70c)[_0x8234('0x22')]();};}function respondWithResult(_0x1d639c,_0x1f0c51){_0x1f0c51=_0x1f0c51||0xc8;return function(_0x969dda){if(_0x969dda){return _0x1d639c[_0x8234('0x23')](_0x1f0c51)[_0x8234('0x24')](_0x969dda);}};}function respondWithFilteredResult(_0x3ad913,_0x4a48cd){return function(_0x3723d1){if(_0x3723d1){var _0x304d56=typeof _0x4a48cd[_0x8234('0x25')]==='undefined'&&typeof _0x4a48cd[_0x8234('0x26')]===_0x8234('0x27');var _0x471559=_0x3723d1[_0x8234('0x28')];var _0x5574ef=_0x304d56?0x0:_0x4a48cd[_0x8234('0x25')];var _0x560bf0=_0x304d56?_0x3723d1[_0x8234('0x28')]:_0x4a48cd[_0x8234('0x25')]+_0x4a48cd[_0x8234('0x26')];var _0x4cc3e;if(_0x560bf0>=_0x471559){_0x560bf0=_0x471559;_0x4cc3e=0xc8;}else{_0x4cc3e=0xce;}_0x3ad913[_0x8234('0x23')](_0x4cc3e);return _0x3ad913[_0x8234('0x29')](_0x8234('0x2a'),_0x5574ef+'-'+_0x560bf0+'/'+_0x471559)['json'](_0x3723d1);}return null;};}function patchUpdates(_0x1f180d){return function(_0xe49527){try{jsonpatch[_0x8234('0x2b')](_0xe49527,_0x1f180d,!![]);}catch(_0xdfd41f){return BPromise['reject'](_0xdfd41f);}return _0xe49527[_0x8234('0x2c')]();};}function saveUpdates(_0x46b397,_0x1d4cc8){return function(_0x3aef9c){if(_0x3aef9c){return _0x3aef9c[_0x8234('0x2d')](_0x46b397)[_0x8234('0x2e')](function(_0x5e7ad9){return _0x5e7ad9;});}return null;};}function removeEntity(_0x273ed5,_0xe93fe6){return function(_0x3c8edb){if(_0x3c8edb){return _0x3c8edb[_0x8234('0x2f')]()[_0x8234('0x2e')](function(){var _0x1a8a8c=_0x3c8edb[_0x8234('0x30')]({'plain':!![]});var _0xd05ce9=_0x8234('0x31');return db[_0x8234('0x32')][_0x8234('0x2f')]({'where':{'type':_0xd05ce9,'resourceId':_0x1a8a8c['id']}})[_0x8234('0x2e')](function(){return _0x3c8edb;});})[_0x8234('0x2e')](function(){_0x273ed5[_0x8234('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1891,_0x114303){return function(_0x3977c0){if(!_0x3977c0){_0x4b1891[_0x8234('0x21')](0x194);}return _0x3977c0;};}function handleError(_0x2b121c,_0xbed5c1){_0xbed5c1=_0xbed5c1||0x1f4;return function(_0x50ab96){logger[_0x8234('0x33')](_0x50ab96['stack']);if(_0x50ab96[_0x8234('0x34')]){delete _0x50ab96[_0x8234('0x34')];}_0x2b121c[_0x8234('0x23')](_0xbed5c1)[_0x8234('0x35')](_0x50ab96);};}exports['index']=function(_0x52056e,_0x57df80){var _0x9a680e={},_0x183ca2={},_0x566148={'count':0x0,'rows':[]};var _0x25b84c=_[_0x8234('0x36')](db['WhatsappQueue'][_0x8234('0x37')],function(_0x4aed38){return{'name':_0x4aed38[_0x8234('0x38')],'type':_0x4aed38[_0x8234('0x39')]['key']};});_0x183ca2[_0x8234('0x3a')]=_['map'](_0x25b84c,_0x8234('0x34'));_0x183ca2[_0x8234('0x3b')]=_[_0x8234('0x3c')](_0x52056e[_0x8234('0x3b')]);_0x183ca2['filters']=_[_0x8234('0x3d')](_0x183ca2[_0x8234('0x3a')],_0x183ca2[_0x8234('0x3b')]);_0x9a680e[_0x8234('0x3e')]=_[_0x8234('0x3d')](_0x183ca2[_0x8234('0x3a')],qs[_0x8234('0x3f')](_0x52056e[_0x8234('0x3b')][_0x8234('0x3f')]));_0x9a680e[_0x8234('0x3e')]=_0x9a680e[_0x8234('0x3e')]['length']?_0x9a680e[_0x8234('0x3e')]:_0x183ca2[_0x8234('0x3a')];if(!_0x52056e['query']['hasOwnProperty'](_0x8234('0x40'))){_0x9a680e[_0x8234('0x26')]=qs['limit'](_0x52056e[_0x8234('0x3b')][_0x8234('0x26')]);_0x9a680e['offset']=qs[_0x8234('0x25')](_0x52056e[_0x8234('0x3b')][_0x8234('0x25')]);}_0x9a680e[_0x8234('0x41')]=qs[_0x8234('0x42')](_0x52056e['query'][_0x8234('0x42')]);_0x9a680e['where']=qs[_0x8234('0x43')](_[_0x8234('0x44')](_0x52056e[_0x8234('0x3b')],_0x183ca2[_0x8234('0x43')]),_0x25b84c);if(_0x52056e[_0x8234('0x3b')]['filter']){_0x9a680e[_0x8234('0x45')]=_[_0x8234('0x46')](_0x9a680e[_0x8234('0x45')],{'$or':_[_0x8234('0x36')](_0x25b84c,function(_0x161cce){if(_0x161cce[_0x8234('0x39')]!=='VIRTUAL'){var _0x10abef={};_0x10abef[_0x161cce[_0x8234('0x34')]]={'$like':'%'+_0x52056e[_0x8234('0x3b')][_0x8234('0x47')]+'%'};return _0x10abef;}})});}_0x9a680e=_[_0x8234('0x46')]({},_0x9a680e,_0x52056e['options']);var _0x425811={'where':_0x9a680e[_0x8234('0x45')]};return db[_0x8234('0x48')][_0x8234('0x28')](_0x425811)[_0x8234('0x2e')](function(_0x4b5a2b){_0x566148[_0x8234('0x28')]=_0x4b5a2b;if(_0x52056e[_0x8234('0x3b')][_0x8234('0x49')]){_0x9a680e['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0x8234('0x4a')](_0x9a680e);})[_0x8234('0x2e')](function(_0x344426){_0x566148[_0x8234('0x4b')]=_0x344426;return _0x566148;})[_0x8234('0x2e')](respondWithFilteredResult(_0x57df80,_0x9a680e))[_0x8234('0x4c')](handleError(_0x57df80,null));};exports['show']=function(_0xa7638b,_0x59e350){var _0x4a535a={'raw':!![],'where':{'id':_0xa7638b[_0x8234('0x4d')]['id']}},_0x5c8718={};_0x5c8718[_0x8234('0x3a')]=_[_0x8234('0x3c')](db['WhatsappQueue'][_0x8234('0x37')]);_0x5c8718[_0x8234('0x3b')]=_[_0x8234('0x3c')](_0xa7638b[_0x8234('0x3b')]);_0x5c8718[_0x8234('0x43')]=_[_0x8234('0x3d')](_0x5c8718[_0x8234('0x3a')],_0x5c8718[_0x8234('0x3b')]);_0x4a535a[_0x8234('0x3e')]=_['intersection'](_0x5c8718[_0x8234('0x3a')],qs[_0x8234('0x3f')](_0xa7638b[_0x8234('0x3b')][_0x8234('0x3f')]));_0x4a535a[_0x8234('0x3e')]=_0x4a535a[_0x8234('0x3e')][_0x8234('0x4e')]?_0x4a535a['attributes']:_0x5c8718[_0x8234('0x3a')];if(_0xa7638b[_0x8234('0x3b')][_0x8234('0x49')]){_0x4a535a['include']=[{'all':!![]}];}_0x4a535a=_[_0x8234('0x46')]({},_0x4a535a,_0xa7638b[_0x8234('0x4f')]);return db[_0x8234('0x48')]['find'](_0x4a535a)['then'](handleEntityNotFound(_0x59e350,null))[_0x8234('0x2e')](respondWithResult(_0x59e350,null))[_0x8234('0x4c')](handleError(_0x59e350,null));};exports['create']=function(_0x10f786,_0x2c9817){return db[_0x8234('0x48')][_0x8234('0x50')](_0x10f786[_0x8234('0x51')],{})[_0x8234('0x2e')](function(_0x5d90f7){var _0x2046e0=_0x10f786[_0x8234('0x52')]['get']({'plain':!![]});if(!_0x2046e0)throw new Error(_0x8234('0x53'));if(_0x2046e0['role']===_0x8234('0x52')){var _0x1ee3b3=_0x5d90f7['get']({'plain':!![]});var _0x4e43e2=_0x8234('0x31');return db[_0x8234('0x54')][_0x8234('0x55')]({'where':{'name':_0x4e43e2,'userProfileId':_0x2046e0[_0x8234('0x56')]},'raw':!![]})[_0x8234('0x2e')](function(_0x65c35a){if(_0x65c35a&&_0x65c35a[_0x8234('0x57')]===0x0){return db[_0x8234('0x32')][_0x8234('0x50')]({'name':_0x1ee3b3[_0x8234('0x34')],'resourceId':_0x1ee3b3['id'],'type':_0x65c35a[_0x8234('0x34')],'sectionId':_0x65c35a['id']},{})[_0x8234('0x2e')](function(){return _0x5d90f7;});}else{return _0x5d90f7;}})['catch'](function(_0x1cf366){logger[_0x8234('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cf366);throw _0x1cf366;});}return _0x5d90f7;})[_0x8234('0x2e')](respondWithResult(_0x2c9817,0xc9))['catch'](handleError(_0x2c9817,null));};exports['update']=function(_0x44c335,_0x38d7a4){if(_0x44c335[_0x8234('0x51')]['id']){delete _0x44c335[_0x8234('0x51')]['id'];}return db['WhatsappQueue'][_0x8234('0x55')]({'where':{'id':_0x44c335[_0x8234('0x4d')]['id']}})[_0x8234('0x2e')](handleEntityNotFound(_0x38d7a4,null))[_0x8234('0x2e')](saveUpdates(_0x44c335['body'],null))[_0x8234('0x2e')](respondWithResult(_0x38d7a4,null))[_0x8234('0x4c')](handleError(_0x38d7a4,null));};exports[_0x8234('0x2f')]=function(_0x3fbed3,_0x32fc76){return db[_0x8234('0x48')][_0x8234('0x55')]({'where':{'id':_0x3fbed3['params']['id']}})['then'](handleEntityNotFound(_0x32fc76,null))[_0x8234('0x2e')](removeEntity(_0x32fc76,null))[_0x8234('0x4c')](handleError(_0x32fc76,null));};exports[_0x8234('0x58')]=function(_0x56307d,_0x268874){return db[_0x8234('0x48')]['describe']()[_0x8234('0x2e')](respondWithResult(_0x268874,null))[_0x8234('0x4c')](handleError(_0x268874,null));};exports[_0x8234('0x59')]=function(_0xa15d63,_0xdee857,_0x497e9c){var _0x339c7f={'raw':!![],'where':{}},_0x283daf={},_0x5cab05;return db[_0x8234('0x48')]['findOne']({'where':{'id':_0xa15d63['params']['id']}})[_0x8234('0x2e')](handleEntityNotFound(_0xdee857,null))['then'](function(_0x2d4723){if(_0x2d4723){_0x5cab05=_0x2d4723[_0x8234('0x30')]({'plain':!![]});_0x283daf[_0x8234('0x3a')]=_[_0x8234('0x3c')](db[_0x8234('0x5a')][_0x8234('0x37')]);_0x283daf['query']=_['keys'](_0xa15d63['query']);_0x283daf['filters']=_[_0x8234('0x3d')](_0x283daf[_0x8234('0x3a')],_0x283daf[_0x8234('0x3b')]);_0x339c7f['attributes']=_[_0x8234('0x3d')](_0x283daf[_0x8234('0x3a')],qs[_0x8234('0x3f')](_0xa15d63[_0x8234('0x3b')][_0x8234('0x3f')]));_0x339c7f[_0x8234('0x3e')]=_0x339c7f['attributes']['length']?_0x339c7f[_0x8234('0x3e')]:_0x283daf['model'];if(!_0xa15d63[_0x8234('0x3b')]['hasOwnProperty'](_0x8234('0x40'))){_0x339c7f['limit']=qs[_0x8234('0x26')](_0xa15d63[_0x8234('0x3b')]['limit']);_0x339c7f['offset']=qs['offset'](_0xa15d63['query'][_0x8234('0x25')]);}_0x339c7f['order']=qs[_0x8234('0x42')](_0xa15d63[_0x8234('0x3b')][_0x8234('0x42')]);_0x339c7f[_0x8234('0x45')]=qs[_0x8234('0x43')](_[_0x8234('0x44')](_0xa15d63[_0x8234('0x3b')],_0x283daf[_0x8234('0x43')]));_0x339c7f[_0x8234('0x45')][_0x8234('0x5b')]=_0x2d4723['id'];if(_0xa15d63['query'][_0x8234('0x47')]){_0x339c7f[_0x8234('0x45')]=_[_0x8234('0x46')](_0x339c7f[_0x8234('0x45')],{'$or':_[_0x8234('0x36')](_0x339c7f[_0x8234('0x3e')],function(_0x3d6720){var _0x419b8a={};_0x419b8a[_0x3d6720]={'$like':'%'+_0xa15d63[_0x8234('0x3b')][_0x8234('0x47')]+'%'};return _0x419b8a;})});}_0x339c7f=_['merge']({},_0x339c7f,_0xa15d63[_0x8234('0x4f')]);return db['UserWhatsappQueue']['findAll'](_0x339c7f);}})['then'](function(_0x3a2351){if(_0x3a2351){return db[_0x8234('0x5c')][_0x8234('0x5d')]({'where':{'id':_[_0x8234('0x36')](_0x3a2351,'UserId'),'role':_0x8234('0x5e')},'attributes':['id','name',_0x8234('0x5f'),'updatedAt',_0x8234('0x60')]});}})[_0x8234('0x2e')](function(_0x49136b){if(_0x49136b){return{'count':_0x49136b[_0x8234('0x28')],'rows':_[_0x8234('0x36')](_0x49136b[_0x8234('0x4b')],function(_0x4f503c){return{'membername':_0x4f503c[_0x8234('0x34')],'UserId':_0x4f503c['id'],'queue_name':_0x5cab05[_0x8234('0x34')],'WhatsappQueueId':_0x5cab05['id'],'interface':util[_0x8234('0x61')](_0x8234('0x62'),_0x8234('0x63'),_0x4f503c[_0x8234('0x34')]),'penalty':0x0,'paused':_0x4f503c[_0x8234('0x5f')],'createdAt':_0x4f503c[_0x8234('0x60')],'updatedAt':_0x4f503c[_0x8234('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8234('0x2e')](respondWithFilteredResult(_0xdee857,_0x339c7f))[_0x8234('0x4c')](handleError(_0xdee857,null));};exports[_0x8234('0x65')]=function(_0x35e36e,_0x3064de,_0x38c739){var _0x5c63bd={};var _0x26a392={};var _0x5f2dc9;var _0x15b2b3;return db['WhatsappQueue']['findOne']({'where':{'id':_0x35e36e[_0x8234('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3064de,null))[_0x8234('0x2e')](function(_0xa6904e){if(_0xa6904e){_0x5f2dc9=_0xa6904e;_0x26a392[_0x8234('0x3a')]=_[_0x8234('0x3c')](db[_0x8234('0x66')][_0x8234('0x37')]);_0x26a392[_0x8234('0x3b')]=_[_0x8234('0x3c')](_0x35e36e[_0x8234('0x3b')]);_0x26a392[_0x8234('0x43')]=_[_0x8234('0x3d')](_0x26a392[_0x8234('0x3a')],_0x26a392[_0x8234('0x3b')]);_0x5c63bd['attributes']=_[_0x8234('0x3d')](_0x26a392[_0x8234('0x3a')],qs[_0x8234('0x3f')](_0x35e36e[_0x8234('0x3b')]['fields']));_0x5c63bd['attributes']=_0x5c63bd[_0x8234('0x3e')]['length']?_0x5c63bd[_0x8234('0x3e')]:_0x26a392[_0x8234('0x3a')];_0x5c63bd[_0x8234('0x41')]=qs[_0x8234('0x42')](_0x35e36e[_0x8234('0x3b')][_0x8234('0x42')]);_0x5c63bd[_0x8234('0x45')]=qs[_0x8234('0x43')](_[_0x8234('0x44')](_0x35e36e['query'],_0x26a392['filters']));if(_0x35e36e[_0x8234('0x3b')][_0x8234('0x47')]){_0x5c63bd[_0x8234('0x45')]=_[_0x8234('0x46')](_0x5c63bd[_0x8234('0x45')],{'$or':_[_0x8234('0x36')](_0x5c63bd['attributes'],function(_0x39e829){var _0x1c9dd7={};_0x1c9dd7[_0x39e829]={'$like':'%'+_0x35e36e['query']['filter']+'%'};return _0x1c9dd7;})});}_0x5c63bd=_[_0x8234('0x46')]({},_0x5c63bd,_0x35e36e[_0x8234('0x4f')]);return _0x5f2dc9[_0x8234('0x65')](_0x5c63bd);}})[_0x8234('0x2e')](function(_0x41cdd9){if(_0x41cdd9){_0x15b2b3=_0x41cdd9[_0x8234('0x4e')];if(!_0x35e36e[_0x8234('0x3b')][_0x8234('0x67')]('nolimit')){_0x5c63bd[_0x8234('0x26')]=qs[_0x8234('0x26')](_0x35e36e[_0x8234('0x3b')][_0x8234('0x26')]);_0x5c63bd[_0x8234('0x25')]=qs[_0x8234('0x25')](_0x35e36e[_0x8234('0x3b')][_0x8234('0x25')]);}return _0x5f2dc9[_0x8234('0x65')](_0x5c63bd);}})[_0x8234('0x2e')](function(_0x567e13){if(_0x567e13){return _0x567e13?{'count':_0x15b2b3,'rows':_0x567e13}:null;}})[_0x8234('0x2e')](respondWithResult(_0x3064de,null))[_0x8234('0x4c')](handleError(_0x3064de,null));};exports[_0x8234('0x68')]=function(_0xc31b36,_0x54cb21,_0x45796b){var _0x50bcb7=_0xc31b36[_0x8234('0x51')][_0x8234('0x69')];return db[_0x8234('0x66')][_0x8234('0x4a')]({'where':{'id':_0x50bcb7},'attributes':['id'],'include':[{'model':db[_0x8234('0x5c')],'as':'Agents','attributes':['id',_0x8234('0x34'),'online','voicePause','interface'],'raw':!![]}]})[_0x8234('0x2e')](function(_0x5cb6dc){if(_0x5cb6dc){var _0x2b0508=_[_0x8234('0x6a')](_0x5cb6dc,function(_0x3d7e70){var _0x3f0309=_0x3d7e70[_0x8234('0x30')]({'plain':!![]});return _0x3f0309[_0x8234('0x6b')];});return db['WhatsappQueue'][_0x8234('0x55')]({'where':{'id':_0xc31b36[_0x8234('0x4d')]['id']}})[_0x8234('0x2e')](function(_0x40be9a){return db[_0x8234('0x6c')][_0x8234('0x6d')](function(_0x39747f){return _0x40be9a[_0x8234('0x68')](_0x50bcb7,{'transaction':_0x39747f})[_0x8234('0x2e')](function(){return BPromise[_0x8234('0x6e')](_0x2b0508,function(_0x87b85a){return db['UserWhatsappQueue'][_0x8234('0x6f')]({'where':{'UserId':_0x87b85a['id'],'WhatsappQueueId':_0xc31b36['params']['id']},'transaction':_0x39747f});});})['then'](function(){_0x2b0508[_0x8234('0x70')](function(_0x5d84d7){socket[_0x8234('0x71')](_0x8234('0x72'),{'UserId':_0x5d84d7['id'],'WhatsappQueueId':_0x40be9a['id']});});});});});}})[_0x8234('0x2e')](respondWithStatusCode(_0x54cb21,null))[_0x8234('0x4c')](handleError(_0x54cb21,null));};exports[_0x8234('0x73')]=function(_0x48e820,_0xcd0793,_0x410415){return db[_0x8234('0x66')][_0x8234('0x4a')]({'where':{'id':_0x48e820[_0x8234('0x3b')][_0x8234('0x69')]},'attributes':['id'],'include':[{'model':db[_0x8234('0x5c')],'as':_0x8234('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x8234('0x2e')](handleEntityNotFound(_0xcd0793,null))[_0x8234('0x2e')](function(_0x3d87b6){var _0x2c7550=_[_0x8234('0x36')](_0x3d87b6,'id');var _0x3ba4f2=[];var _0x1dd2c7=[];var _0x27f1cf=squel[_0x8234('0x74')]();_0x27f1cf['field']('tq.TeamId')[_0x8234('0x75')]('team_has_whatsapp_queues','tq')[_0x8234('0x76')](_0x8234('0x77'),'ut',_0x8234('0x78'))[_0x8234('0x45')](_0x8234('0x79'),_0x48e820[_0x8234('0x4d')]['id']);for(var _0x16bb7f=0x0;_0x16bb7f<_0x3d87b6[_0x8234('0x4e')];_0x16bb7f+=0x1){let _0x38acd3=_0x3d87b6[_0x16bb7f];for(var _0x35ede1=0x0;_0x35ede1<_0x38acd3[_0x8234('0x6b')]['length'];_0x35ede1+=0x1){let _0x18e664=_0x38acd3[_0x8234('0x6b')][_0x35ede1];var _0x819479=_0x27f1cf[_0x8234('0x7a')]();_0x819479[_0x8234('0x45')](_0x8234('0x7b'),_0x18e664['id']);_0x1dd2c7[_0x8234('0x7c')](db['sequelize'][_0x8234('0x3b')](_0x819479[_0x8234('0x7d')](),{'type':db[_0x8234('0x6c')]['QueryTypes']['SELECT']})[_0x8234('0x2e')](function(_0xfc4270){if(_0xfc4270[_0x8234('0x4e')]===0x1){return _0x18e664['id'];}else{var _0x3e51a2=_[_0x8234('0x7e')](_[_0x8234('0x36')](_0xfc4270,_0x8234('0x7f')),function(_0x332318){return _[_0x8234('0x80')](_0x2c7550,_0x332318);});if(_0x3e51a2){return _0x18e664['id'];}}}));}}return BPromise[_0x8234('0x81')](_0x1dd2c7)[_0x8234('0x2e')](function(_0x87198c){_0x3ba4f2=_(_0x3ba4f2)['union'](_0x87198c)[_0x8234('0x82')]()[_0x8234('0x83')]();return db[_0x8234('0x48')][_0x8234('0x55')]({'where':{'id':_0x48e820[_0x8234('0x4d')]['id']}})[_0x8234('0x2e')](function(_0x47aff8){return db[_0x8234('0x6c')][_0x8234('0x6d')](function(_0x1ac584){return _0x47aff8[_0x8234('0x73')](_0x48e820[_0x8234('0x3b')][_0x8234('0x69')],{'transaction':_0x1ac584})[_0x8234('0x2e')](function(){if(!_[_0x8234('0x84')](_0x3ba4f2)){return _0x47aff8['removeAgents'](_0x3ba4f2,{'transaction':_0x1ac584});}})['then'](function(){_0x3ba4f2[_0x8234('0x70')](function(_0x3d32a2){socket['emit'](_0x8234('0x85'),{'UserId':_0x3d32a2,'WhatsappQueueId':_0x47aff8['id']});});});});});});})[_0x8234('0x2e')](respondWithStatusCode(_0xcd0793,null))['catch'](handleError(_0xcd0793,null));};exports[_0x8234('0x86')]=function(_0xacb0fb,_0x25de08,_0x5ce935){return db[_0x8234('0x48')][_0x8234('0x55')]({'where':{'id':_0xacb0fb['params']['id']}})[_0x8234('0x2e')](handleEntityNotFound(_0x25de08,null))[_0x8234('0x2e')](function(_0x386ece){if(_0x386ece){return _0x386ece[_0x8234('0x86')](_0xacb0fb[_0x8234('0x51')]['ids'],_['omit'](_0xacb0fb[_0x8234('0x51')],[_0x8234('0x69'),'id'])||{})['spread'](function(_0x59dc70){for(var _0x43b7aa=0x0;_0x43b7aa<_0xacb0fb[_0x8234('0x51')][_0x8234('0x69')][_0x8234('0x4e')];_0x43b7aa+=0x1){socket[_0x8234('0x71')](_0x8234('0x72'),{'UserId':Number(_0xacb0fb[_0x8234('0x51')][_0x8234('0x69')][_0x43b7aa]),'WhatsappQueueId':Number(_0xacb0fb['params']['id'])});}return _0x59dc70;});}})[_0x8234('0x2e')](respondWithResult(_0x25de08,null))[_0x8234('0x4c')](handleError(_0x25de08,null));};exports[_0x8234('0x87')]=function(_0x50540d,_0x3d82c5,_0x22f742){return db[_0x8234('0x48')][_0x8234('0x55')]({'where':{'id':_0x50540d['params']['id']}})[_0x8234('0x2e')](handleEntityNotFound(_0x3d82c5,null))[_0x8234('0x2e')](function(_0x25f98e){if(_0x25f98e){return _0x25f98e[_0x8234('0x87')](_0x50540d[_0x8234('0x3b')]['ids'])[_0x8234('0x2e')](function(){if(_['isArray'](_0x50540d[_0x8234('0x3b')][_0x8234('0x69')])){for(var _0x4ee4e0=0x0;_0x4ee4e0<_0x50540d[_0x8234('0x3b')]['ids']['length'];_0x4ee4e0+=0x1){socket[_0x8234('0x71')](_0x8234('0x85'),{'UserId':Number(_0x50540d[_0x8234('0x3b')][_0x8234('0x69')][_0x4ee4e0]),'WhatsappQueueId':Number(_0x50540d[_0x8234('0x4d')]['id'])});}}else{socket[_0x8234('0x71')](_0x8234('0x85'),{'UserId':Number(_0x50540d['query'][_0x8234('0x69')]),'WhatsappQueueId':Number(_0x50540d['params']['id'])});}});}})[_0x8234('0x2e')](respondWithStatusCode(_0x3d82c5,null))['catch'](handleError(_0x3d82c5,null));};exports[_0x8234('0x88')]=function(_0x33e08b,_0x302284,_0xb4c2e8){var _0x3e442a={};var _0x814882={};var _0x27b526;var _0x2e6611;return db[_0x8234('0x48')][_0x8234('0x89')]({'where':{'id':_0x33e08b[_0x8234('0x4d')]['id']}})['then'](handleEntityNotFound(_0x302284,null))[_0x8234('0x2e')](function(_0x5738b3){if(_0x5738b3){_0x27b526=_0x5738b3;_0x814882[_0x8234('0x3a')]=_[_0x8234('0x3c')](db['User']['rawAttributes']);_0x814882[_0x8234('0x3b')]=_[_0x8234('0x3c')](_0x33e08b[_0x8234('0x3b')]);_0x814882[_0x8234('0x43')]=_['intersection'](_0x814882[_0x8234('0x3a')],_0x814882[_0x8234('0x3b')]);_0x3e442a[_0x8234('0x3e')]=_[_0x8234('0x3d')](_0x814882[_0x8234('0x3a')],qs[_0x8234('0x3f')](_0x33e08b[_0x8234('0x3b')][_0x8234('0x3f')]));_0x3e442a[_0x8234('0x3e')]=_0x3e442a[_0x8234('0x3e')][_0x8234('0x4e')]?_0x3e442a[_0x8234('0x3e')]:_0x814882[_0x8234('0x3a')];_0x3e442a[_0x8234('0x41')]=qs['sort'](_0x33e08b[_0x8234('0x3b')]['sort']);_0x3e442a[_0x8234('0x45')]=qs[_0x8234('0x43')](_[_0x8234('0x44')](_0x33e08b[_0x8234('0x3b')],_0x814882[_0x8234('0x43')]));if(_0x33e08b[_0x8234('0x3b')][_0x8234('0x47')]){_0x3e442a['where']=_[_0x8234('0x46')](_0x3e442a[_0x8234('0x45')],{'$or':_[_0x8234('0x36')](_0x3e442a[_0x8234('0x3e')],function(_0x356766){var _0x25ab4f={};_0x25ab4f[_0x356766]={'$like':'%'+_0x33e08b[_0x8234('0x3b')][_0x8234('0x47')]+'%'};return _0x25ab4f;})});}_0x3e442a=_['merge']({},_0x3e442a,_0x33e08b[_0x8234('0x4f')]);return _0x27b526['getAgents'](_0x3e442a);}})['then'](function(_0x4e0d68){if(_0x4e0d68){_0x2e6611=_0x4e0d68['length'];if(!_0x33e08b[_0x8234('0x3b')]['hasOwnProperty'](_0x8234('0x40'))){_0x3e442a['limit']=qs['limit'](_0x33e08b[_0x8234('0x3b')][_0x8234('0x26')]);_0x3e442a['offset']=qs[_0x8234('0x25')](_0x33e08b['query'][_0x8234('0x25')]);}return _0x27b526[_0x8234('0x88')](_0x3e442a);}})[_0x8234('0x2e')](function(_0x230f8f){if(_0x230f8f){return _0x230f8f?{'count':_0x2e6611,'rows':_0x230f8f}:null;}})[_0x8234('0x2e')](respondWithResult(_0x302284,null))[_0x8234('0x4c')](handleError(_0x302284,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 289b460..420364c 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 _0xc739=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x500a5a,_0x3bbd8d){var _0x531a11=function(_0x2905a1){while(--_0x2905a1){_0x500a5a['push'](_0x500a5a['shift']());}};_0x531a11(++_0x3bbd8d);}(_0xc739,0x1ad));var _0x9c73=function(_0x427306,_0x203ab4){_0x427306=_0x427306-0x0;var _0x108fde=_0xc739[_0x427306];return _0x108fde;};'use strict';var EventEmitter=require(_0x9c73('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x9c73('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9c73('0x2')](0x0);var events={'afterCreate':_0x9c73('0x3'),'afterUpdate':_0x9c73('0x4'),'afterDestroy':_0x9c73('0x5')};function emitEvent(_0xa1e55a){return function(_0xc63044,_0x5599d1,_0x2fa034){WhatsappQueueEvents[_0x9c73('0x6')](_0xa1e55a+':'+_0xc63044['id'],_0xc63044);WhatsappQueueEvents['emit'](_0xa1e55a,_0xc63044);_0x2fa034(null);};}for(var e in events){if(events[_0x9c73('0x7')](e)){var event=events[e];WhatsappQueue[_0x9c73('0x8')](e,emitEvent(event));}}module[_0x9c73('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf782=['remove','exports','events','../../mysqldb','WhatsappQueue','save'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xf782,0x164));var _0x2f78=function(_0x924c29,_0x309120){_0x924c29=_0x924c29-0x0;var _0x24ddd6=_0xf782[_0x924c29];return _0x24ddd6;};'use strict';var EventEmitter=require(_0x2f78('0x0'));var WhatsappQueue=require(_0x2f78('0x1'))['db'][_0x2f78('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f78('0x3'),'afterUpdate':'update','afterDestroy':_0x2f78('0x4')};function emitEvent(_0x64ec5f){return function(_0x1570cc,_0x4c2807,_0x50e35f){WhatsappQueueEvents['emit'](_0x64ec5f+':'+_0x1570cc['id'],_0x1570cc);WhatsappQueueEvents['emit'](_0x64ec5f,_0x1570cc);_0x50e35f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x2f78('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index c8bd4a6..5e0b667 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 _0xf92f=['define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x8c1a94,_0x1e9391){var _0x56faf7=function(_0x64c814){while(--_0x64c814){_0x8c1a94['push'](_0x8c1a94['shift']());}};_0x56faf7(++_0x1e9391);}(_0xf92f,0x1e4));var _0xff92=function(_0x472a55,_0x4cf085){_0x472a55=_0x472a55-0x0;var _0x101d06=_0xf92f[_0x472a55];return _0x101d06;};'use strict';var _=require(_0xff92('0x0'));var util=require(_0xff92('0x1'));var logger=require(_0xff92('0x2'))(_0xff92('0x3'));var moment=require('moment');var BPromise=require(_0xff92('0x4'));var rp=require(_0xff92('0x5'));var fs=require('fs');var path=require(_0xff92('0x6'));var rimraf=require(_0xff92('0x7'));var config=require(_0xff92('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xff92('0x9')]=function(_0x5e8c98,_0x59569f){return _0x5e8c98[_0xff92('0xa')](_0xff92('0xb'),attributes,{'tableName':_0xff92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9db3=['request-promise','path','rimraf','../../config/environment','define','WhatsappQueue','util','api','bluebird'];(function(_0x354175,_0x298ec9){var _0x1ff362=function(_0xca78b6){while(--_0xca78b6){_0x354175['push'](_0x354175['shift']());}};_0x1ff362(++_0x298ec9);}(_0x9db3,0x192));var _0x39db=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9db3[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x39db('0x0'));var logger=require('../../config/logger')(_0x39db('0x1'));var moment=require('moment');var BPromise=require(_0x39db('0x2'));var rp=require(_0x39db('0x3'));var fs=require('fs');var path=require(_0x39db('0x4'));var rimraf=require(_0x39db('0x5'));var config=require(_0x39db('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x447677,_0x3e87ed){return _0x447677[_0x39db('0x7')](_0x39db('0x8'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 048b539..e88e90d 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 _0x6ca6=['map','model','attributes','find','raw','ShowWhatsappQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x6ca6,0x14e));var _0x66ca=function(_0x51f0dc,_0x5c9871){_0x51f0dc=_0x51f0dc-0x0;var _0x39f835=_0x6ca6[_0x51f0dc];return _0x39f835;};'use strict';var _=require(_0x66ca('0x0'));var util=require(_0x66ca('0x1'));var moment=require(_0x66ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x66ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66ca('0x4'))['db'];var utils=require(_0x66ca('0x5'));var logger=require(_0x66ca('0x6'))(_0x66ca('0x7'));var config=require(_0x66ca('0x8'));var jayson=require(_0x66ca('0x9'));var client=jayson['client'][_0x66ca('0xa')]({'port':0x232a});config[_0x66ca('0xb')]=_['defaults'](config['redis'],{'host':_0x66ca('0xc'),'port':0x18eb});var socket=require(_0x66ca('0xd'))(new Redis(config[_0x66ca('0xb')]));require(_0x66ca('0xe'))[_0x66ca('0xf')](socket);function respondWithRpcPromise(_0x3a4709,_0x12a44b,_0xc06b94){return new BPromise(function(_0x2ee2d9,_0x24ffb7){return client[_0x66ca('0x10')](_0x3a4709,_0xc06b94)[_0x66ca('0x11')](function(_0x57443c){logger[_0x66ca('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x12a44b,_0x66ca('0x13'));logger[_0x66ca('0x14')](_0x66ca('0x15'),_0x12a44b,'request\x20sent',JSON[_0x66ca('0x16')](_0x57443c));if(_0x57443c[_0x66ca('0x17')]){if(_0x57443c[_0x66ca('0x17')]['code']===0x1f4){logger['error'](_0x66ca('0x18'),_0x12a44b,_0x57443c[_0x66ca('0x17')]['message']);return _0x24ffb7(_0x57443c['error'][_0x66ca('0x19')]);}logger['error'](_0x66ca('0x18'),_0x12a44b,_0x57443c[_0x66ca('0x17')][_0x66ca('0x19')]);return _0x2ee2d9(_0x57443c[_0x66ca('0x17')][_0x66ca('0x19')]);}else{logger['info'](_0x66ca('0x18'),_0x12a44b,_0x66ca('0x13'));_0x2ee2d9(_0x57443c[_0x66ca('0x1a')][_0x66ca('0x19')]);}})[_0x66ca('0x1b')](function(_0x1b1260){logger['error'](_0x66ca('0x18'),_0x12a44b,_0x1b1260);_0x24ffb7(_0x1b1260);});});}exports[_0x66ca('0x1c')]=function(_0x5e4f58){var _0x3b87b9=this;return new Promise(function(_0x40c503,_0x56b209){return db[_0x66ca('0x1d')][_0x66ca('0x1e')]({'raw':_0x5e4f58[_0x66ca('0x1f')]?_0x5e4f58[_0x66ca('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5e4f58[_0x66ca('0x1f')]?_0x5e4f58[_0x66ca('0x1f')][_0x66ca('0x20')]||null:null,'attributes':_0x5e4f58[_0x66ca('0x1f')]?_0x5e4f58[_0x66ca('0x1f')]['attributes']||null:null,'limit':_0x5e4f58[_0x66ca('0x1f')]?_0x5e4f58['options'][_0x66ca('0x21')]||null:null,'include':_0x5e4f58['options']?_0x5e4f58['options'][_0x66ca('0x22')]?_[_0x66ca('0x23')](_0x5e4f58['options'][_0x66ca('0x22')],function(_0x359da3){return{'model':db[_0x359da3[_0x66ca('0x24')]],'as':_0x359da3['as'],'attributes':_0x359da3[_0x66ca('0x25')],'include':_0x359da3[_0x66ca('0x22')]?_[_0x66ca('0x23')](_0x359da3[_0x66ca('0x22')],function(_0x1ef370){return{'model':db[_0x1ef370['model']],'as':_0x1ef370['as'],'attributes':_0x1ef370[_0x66ca('0x25')],'include':_0x1ef370['include']?_[_0x66ca('0x23')](_0x1ef370[_0x66ca('0x22')],function(_0x29633a){return{'model':db[_0x29633a[_0x66ca('0x24')]],'as':_0x29633a['as'],'attributes':_0x29633a[_0x66ca('0x25')]};}):[]};}):[]};}):[]:[]})[_0x66ca('0x11')](function(_0x2dad79){logger[_0x66ca('0x12')](_0x66ca('0x1c'),_0x5e4f58);logger['debug'](_0x66ca('0x1c'),_0x5e4f58,JSON[_0x66ca('0x16')](_0x2dad79));_0x40c503(_0x2dad79);})[_0x66ca('0x1b')](function(_0x236cce){logger[_0x66ca('0x17')]('GetWhatsappQueue',_0x236cce[_0x66ca('0x19')],_0x5e4f58);_0x56b209(_0x3b87b9[_0x66ca('0x17')](0x1f4,_0x236cce[_0x66ca('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x2d7757){var _0x38b676=this;return new Promise(function(_0x559c89,_0x59493b){return db[_0x66ca('0x1d')][_0x66ca('0x26')]({'raw':_0x2d7757['options']?_0x2d7757['options'][_0x66ca('0x27')]===undefined?!![]:![]:!![],'where':_0x2d7757[_0x66ca('0x1f')]?_0x2d7757['options'][_0x66ca('0x20')]||null:null,'attributes':_0x2d7757['options']?_0x2d7757[_0x66ca('0x1f')]['attributes']||null:null,'include':_0x2d7757['options']?_0x2d7757[_0x66ca('0x1f')][_0x66ca('0x22')]?_[_0x66ca('0x23')](_0x2d7757[_0x66ca('0x1f')]['include'],function(_0x13aaad){return{'model':db[_0x13aaad['model']],'as':_0x13aaad['as'],'attributes':_0x13aaad[_0x66ca('0x25')],'include':_0x13aaad[_0x66ca('0x22')]?_[_0x66ca('0x23')](_0x13aaad[_0x66ca('0x22')],function(_0x55cea6){return{'model':db[_0x55cea6[_0x66ca('0x24')]],'as':_0x55cea6['as'],'attributes':_0x55cea6[_0x66ca('0x25')],'include':_0x55cea6['include']?_['map'](_0x55cea6[_0x66ca('0x22')],function(_0x4010f0){return{'model':db[_0x4010f0['model']],'as':_0x4010f0['as'],'attributes':_0x4010f0['attributes']};}):[]};}):[]};}):[]:[]})[_0x66ca('0x11')](function(_0x469d44){logger[_0x66ca('0x12')](_0x66ca('0x28'),_0x2d7757);logger[_0x66ca('0x14')](_0x66ca('0x28'),_0x2d7757,JSON[_0x66ca('0x16')](_0x469d44));_0x559c89(_0x469d44);})['catch'](function(_0x31254e){logger[_0x66ca('0x17')](_0x66ca('0x28'),_0x31254e[_0x66ca('0x19')],_0x2d7757);_0x59493b(_0x38b676[_0x66ca('0x17')](0x1f4,_0x31254e['message']));});});}; \ No newline at end of file +var _0x06db=['attributes','limit','include','model','map','GetWhatsappQueue','debug','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','catch','findAll','options','raw','where'];(function(_0x359e92,_0x6e6b4f){var _0x25c1fb=function(_0x456793){while(--_0x456793){_0x359e92['push'](_0x359e92['shift']());}};_0x25c1fb(++_0x6e6b4f);}(_0x06db,0xb6));var _0xb06d=function(_0x32def5,_0x8b3792){_0x32def5=_0x32def5-0x0;var _0x4546b7=_0x06db[_0x32def5];return _0x4546b7;};'use strict';var _=require(_0xb06d('0x0'));var util=require(_0xb06d('0x1'));var moment=require(_0xb06d('0x2'));var BPromise=require(_0xb06d('0x3'));var rs=require(_0xb06d('0x4'));var fs=require('fs');var Redis=require(_0xb06d('0x5'));var db=require(_0xb06d('0x6'))['db'];var utils=require(_0xb06d('0x7'));var logger=require(_0xb06d('0x8'))(_0xb06d('0x9'));var config=require(_0xb06d('0xa'));var jayson=require(_0xb06d('0xb'));var client=jayson[_0xb06d('0xc')][_0xb06d('0xd')]({'port':0x232a});config[_0xb06d('0xe')]=_[_0xb06d('0xf')](config[_0xb06d('0xe')],{'host':_0xb06d('0x10'),'port':0x18eb});var socket=require(_0xb06d('0x11'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xb06d('0x12')](socket);function respondWithRpcPromise(_0x15c89d,_0x29789f,_0x1ed471){return new BPromise(function(_0xb8319e,_0x536ac5){return client[_0xb06d('0x13')](_0x15c89d,_0x1ed471)[_0xb06d('0x14')](function(_0x49f9c5){logger[_0xb06d('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x29789f,_0xb06d('0x16'));logger['debug'](_0xb06d('0x17'),_0x29789f,'request\x20sent',JSON[_0xb06d('0x18')](_0x49f9c5));if(_0x49f9c5[_0xb06d('0x19')]){if(_0x49f9c5[_0xb06d('0x19')]['code']===0x1f4){logger[_0xb06d('0x19')](_0xb06d('0x1a'),_0x29789f,_0x49f9c5[_0xb06d('0x19')]['message']);return _0x536ac5(_0x49f9c5[_0xb06d('0x19')][_0xb06d('0x1b')]);}logger[_0xb06d('0x19')](_0xb06d('0x1a'),_0x29789f,_0x49f9c5[_0xb06d('0x19')]['message']);return _0xb8319e(_0x49f9c5[_0xb06d('0x19')][_0xb06d('0x1b')]);}else{logger[_0xb06d('0x15')](_0xb06d('0x1a'),_0x29789f,_0xb06d('0x16'));_0xb8319e(_0x49f9c5['result'][_0xb06d('0x1b')]);}})[_0xb06d('0x1c')](function(_0x13605c){logger[_0xb06d('0x19')](_0xb06d('0x1a'),_0x29789f,_0x13605c);_0x536ac5(_0x13605c);});});}exports['GetWhatsappQueue']=function(_0x387de3){var _0x538e89=this;return new Promise(function(_0x428c3e,_0xec8200){return db['WhatsappQueue'][_0xb06d('0x1d')]({'raw':_0x387de3[_0xb06d('0x1e')]?_0x387de3[_0xb06d('0x1e')][_0xb06d('0x1f')]===undefined?!![]:![]:!![],'where':_0x387de3['options']?_0x387de3[_0xb06d('0x1e')][_0xb06d('0x20')]||null:null,'attributes':_0x387de3[_0xb06d('0x1e')]?_0x387de3[_0xb06d('0x1e')][_0xb06d('0x21')]||null:null,'limit':_0x387de3[_0xb06d('0x1e')]?_0x387de3[_0xb06d('0x1e')][_0xb06d('0x22')]||null:null,'include':_0x387de3[_0xb06d('0x1e')]?_0x387de3[_0xb06d('0x1e')][_0xb06d('0x23')]?_['map'](_0x387de3[_0xb06d('0x1e')]['include'],function(_0x31be58){return{'model':db[_0x31be58[_0xb06d('0x24')]],'as':_0x31be58['as'],'attributes':_0x31be58[_0xb06d('0x21')],'include':_0x31be58['include']?_[_0xb06d('0x25')](_0x31be58[_0xb06d('0x23')],function(_0x45cdc2){return{'model':db[_0x45cdc2['model']],'as':_0x45cdc2['as'],'attributes':_0x45cdc2[_0xb06d('0x21')],'include':_0x45cdc2['include']?_[_0xb06d('0x25')](_0x45cdc2[_0xb06d('0x23')],function(_0x32c2a8){return{'model':db[_0x32c2a8[_0xb06d('0x24')]],'as':_0x32c2a8['as'],'attributes':_0x32c2a8[_0xb06d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x290329){logger['info'](_0xb06d('0x26'),_0x387de3);logger[_0xb06d('0x27')](_0xb06d('0x26'),_0x387de3,JSON[_0xb06d('0x18')](_0x290329));_0x428c3e(_0x290329);})['catch'](function(_0x9f23c0){logger[_0xb06d('0x19')](_0xb06d('0x26'),_0x9f23c0[_0xb06d('0x1b')],_0x387de3);_0xec8200(_0x538e89['error'](0x1f4,_0x9f23c0['message']));});});};exports[_0xb06d('0x28')]=function(_0x29eb7f){var _0x558ba6=this;return new Promise(function(_0x4bfc70,_0x10671f){return db[_0xb06d('0x29')][_0xb06d('0x2a')]({'raw':_0x29eb7f[_0xb06d('0x1e')]?_0x29eb7f[_0xb06d('0x1e')][_0xb06d('0x1f')]===undefined?!![]:![]:!![],'where':_0x29eb7f[_0xb06d('0x1e')]?_0x29eb7f[_0xb06d('0x1e')]['where']||null:null,'attributes':_0x29eb7f[_0xb06d('0x1e')]?_0x29eb7f[_0xb06d('0x1e')][_0xb06d('0x21')]||null:null,'include':_0x29eb7f[_0xb06d('0x1e')]?_0x29eb7f['options'][_0xb06d('0x23')]?_[_0xb06d('0x25')](_0x29eb7f[_0xb06d('0x1e')][_0xb06d('0x23')],function(_0x1a632e){return{'model':db[_0x1a632e[_0xb06d('0x24')]],'as':_0x1a632e['as'],'attributes':_0x1a632e['attributes'],'include':_0x1a632e[_0xb06d('0x23')]?_[_0xb06d('0x25')](_0x1a632e['include'],function(_0x2b2c20){return{'model':db[_0x2b2c20['model']],'as':_0x2b2c20['as'],'attributes':_0x2b2c20[_0xb06d('0x21')],'include':_0x2b2c20['include']?_['map'](_0x2b2c20['include'],function(_0x28c3fa){return{'model':db[_0x28c3fa[_0xb06d('0x24')]],'as':_0x28c3fa['as'],'attributes':_0x28c3fa[_0xb06d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a98d9){logger[_0xb06d('0x15')]('ShowWhatsappQueue',_0x29eb7f);logger[_0xb06d('0x27')](_0xb06d('0x28'),_0x29eb7f,JSON[_0xb06d('0x18')](_0x2a98d9));_0x4bfc70(_0x2a98d9);})[_0xb06d('0x1c')](function(_0x3745f0){logger['error'](_0xb06d('0x28'),_0x3745f0['message'],_0x29eb7f);_0x10671f(_0x558ba6[_0xb06d('0x19')](0x1f4,_0x3745f0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8f4d5b3..96a49c6 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 _0x5353=['length','./whatsappQueue.events','remove','update','emit','removeListener','register'];(function(_0x530d71,_0x4c13ce){var _0x16b3fc=function(_0x498b86){while(--_0x498b86){_0x530d71['push'](_0x530d71['shift']());}};_0x16b3fc(++_0x4c13ce);}(_0x5353,0xa9));var _0x3535=function(_0x38fbbe,_0x24f5de){_0x38fbbe=_0x38fbbe-0x0;var _0x297b7f=_0x5353[_0x38fbbe];return _0x297b7f;};'use strict';var WhatsappQueueEvents=require(_0x3535('0x0'));var events=['save',_0x3535('0x1'),_0x3535('0x2')];function createListener(_0x3befac,_0x4df430){return function(_0x113f74){_0x4df430[_0x3535('0x3')](_0x3befac,_0x113f74);};}function removeListener(_0x3e81a8,_0xbfe7db){return function(){WhatsappQueueEvents[_0x3535('0x4')](_0x3e81a8,_0xbfe7db);};}exports[_0x3535('0x5')]=function(_0x11b6cd){for(var _0x29881f=0x0,_0xb3bb02=events[_0x3535('0x6')];_0x29881f<_0xb3bb02;_0x29881f++){var _0x260894=events[_0x29881f];var _0x3004a2=createListener('whatsappQueue:'+_0x260894,_0x11b6cd);WhatsappQueueEvents['on'](_0x260894,_0x3004a2);}}; \ No newline at end of file +var _0x759a=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x55036a,_0x1e43dc){var _0x2ebe00=function(_0x10c3ee){while(--_0x10c3ee){_0x55036a['push'](_0x55036a['shift']());}};_0x2ebe00(++_0x1e43dc);}(_0x759a,0x7b));var _0xa759=function(_0x18e10d,_0x13ddf9){_0x18e10d=_0x18e10d-0x0;var _0x4d2053=_0x759a[_0x18e10d];return _0x4d2053;};'use strict';var WhatsappQueueEvents=require(_0xa759('0x0'));var events=[_0xa759('0x1'),_0xa759('0x2'),_0xa759('0x3')];function createListener(_0x41a502,_0x71fa60){return function(_0x25df41){_0x71fa60[_0xa759('0x4')](_0x41a502,_0x25df41);};}function removeListener(_0x114d6b,_0x5e5a05){return function(){WhatsappQueueEvents[_0xa759('0x5')](_0x114d6b,_0x5e5a05);};}exports[_0xa759('0x6')]=function(_0xaf825b){for(var _0x221032=0x0,_0x419faa=events[_0xa759('0x7')];_0x221032<_0x419faa;_0x221032++){var _0x5b956d=events[_0x221032];var _0x24abd4=createListener(_0xa759('0x8')+_0x5b956d,_0xaf825b);WhatsappQueueEvents['on'](_0x5b956d,_0x24abd4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 294388e..e4568c7 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 _0x6ab4=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','describe'];(function(_0x284359,_0x290d6e){var _0x592dc4=function(_0x15f959){while(--_0x15f959){_0x284359['push'](_0x284359['shift']());}};_0x592dc4(++_0x290d6e);}(_0x6ab4,0xb1));var _0x46ab=function(_0x1e58cf,_0x30af86){_0x1e58cf=_0x1e58cf-0x0;var _0x3e4bf1=_0x6ab4[_0x1e58cf];return _0x3e4bf1;};'use strict';var multer=require(_0x46ab('0x0'));var util=require(_0x46ab('0x1'));var path=require(_0x46ab('0x2'));var timeout=require(_0x46ab('0x3'));var express=require(_0x46ab('0x4'));var router=express[_0x46ab('0x5')]();var fs_extra=require(_0x46ab('0x6'));var auth=require(_0x46ab('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x46ab('0x8'));router[_0x46ab('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x46ab('0x9')]('/describe',auth[_0x46ab('0xa')](),controller[_0x46ab('0xb')]);router[_0x46ab('0x9')](_0x46ab('0xc'),auth[_0x46ab('0xa')](),controller[_0x46ab('0xd')]);router[_0x46ab('0xe')]('/',auth[_0x46ab('0xa')](),controller[_0x46ab('0xf')]);router[_0x46ab('0x10')](_0x46ab('0xc'),auth['isAuthenticated'](),controller[_0x46ab('0x11')]);router[_0x46ab('0x12')](_0x46ab('0xc'),auth['isAuthenticated'](),controller[_0x46ab('0x13')]);module[_0x46ab('0x14')]=router; \ No newline at end of file +var _0x0f40=['destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete'];(function(_0x1508a0,_0x301084){var _0x4eae01=function(_0x32cae1){while(--_0x32cae1){_0x1508a0['push'](_0x1508a0['shift']());}};_0x4eae01(++_0x301084);}(_0x0f40,0xdd));var _0x00f4=function(_0x5d27c3,_0x5ac158){_0x5d27c3=_0x5d27c3-0x0;var _0xed73f8=_0x0f40[_0x5d27c3];return _0xed73f8;};'use strict';var multer=require('multer');var util=require(_0x00f4('0x0'));var path=require('path');var timeout=require(_0x00f4('0x1'));var express=require(_0x00f4('0x2'));var router=express[_0x00f4('0x3')]();var fs_extra=require(_0x00f4('0x4'));var auth=require(_0x00f4('0x5'));var interaction=require(_0x00f4('0x6'));var config=require(_0x00f4('0x7'));var controller=require(_0x00f4('0x8'));router[_0x00f4('0x9')]('/',auth[_0x00f4('0xa')](),controller[_0x00f4('0xb')]);router['get'](_0x00f4('0xc'),auth[_0x00f4('0xa')](),controller['describe']);router['get'](_0x00f4('0xd'),auth[_0x00f4('0xa')](),controller[_0x00f4('0xe')]);router[_0x00f4('0xf')]('/',auth['isAuthenticated'](),controller[_0x00f4('0x10')]);router['put'](_0x00f4('0xd'),auth[_0x00f4('0xa')](),controller[_0x00f4('0x11')]);router[_0x00f4('0x12')](_0x00f4('0xd'),auth[_0x00f4('0xa')](),controller[_0x00f4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 86e014a..09311f0 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(_0x2bc74d,_0x5b3cfd){var _0x49588c=function(_0x1a072f){while(--_0x1a072f){_0x2bc74d['push'](_0x2bc74d['shift']());}};_0x49588c(++_0x5b3cfd);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3e87d1,_0x19a441){var _0x3eed06=function(_0x15af05){while(--_0x15af05){_0x3e87d1['push'](_0x3e87d1['shift']());}};_0x3eed06(++_0x19a441);}(_0x7a54,0x106));var _0x47a5=function(_0x384aec,_0x3a3ddd){_0x384aec=_0x384aec-0x0;var _0x1408f0=_0x7a54[_0x384aec];return _0x1408f0;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 49600e0..0778609 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 _0x7d25=['mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','includeAll','include','rows','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3cccdd,_0x4daa99){var _0x20c654=function(_0x498a26){while(--_0x498a26){_0x3cccdd['push'](_0x3cccdd['shift']());}};_0x20c654(++_0x4daa99);}(_0x7d25,0x8a));var _0x57d2=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7d25[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x3c7de8,_0x452d5e){return function(_0x4363b3){if(!_0x4363b3){_0x3c7de8['sendStatus'](0x194);}return _0x4363b3;};}function handleError(_0x1d203c,_0x608b10){_0x608b10=_0x608b10||0x1f4;return function(_0x995928){logger[_0x57d2('0x26')](_0x995928[_0x57d2('0x27')]);if(_0x995928[_0x57d2('0x28')]){delete _0x995928[_0x57d2('0x28')];}_0x1d203c['status'](_0x608b10)[_0x57d2('0x29')](_0x995928);};}exports[_0x57d2('0x2a')]=function(_0x277426,_0x1fe383){var _0x1957a6={},_0x7c33f3={},_0x1dd6cb={'count':0x0,'rows':[]};var _0x1d3a3a=_[_0x57d2('0x2b')](db[_0x57d2('0x2c')]['rawAttributes'],function(_0x4e9178){return{'name':_0x4e9178[_0x57d2('0x2d')],'type':_0x4e9178[_0x57d2('0x2e')][_0x57d2('0x2f')]};});_0x7c33f3['model']=_[_0x57d2('0x2b')](_0x1d3a3a,_0x57d2('0x28'));_0x7c33f3[_0x57d2('0x30')]=_[_0x57d2('0x31')](_0x277426[_0x57d2('0x30')]);_0x7c33f3[_0x57d2('0x32')]=_[_0x57d2('0x33')](_0x7c33f3[_0x57d2('0x34')],_0x7c33f3[_0x57d2('0x30')]);_0x1957a6['attributes']=_[_0x57d2('0x33')](_0x7c33f3[_0x57d2('0x34')],qs['fields'](_0x277426[_0x57d2('0x30')][_0x57d2('0x35')]));_0x1957a6['attributes']=_0x1957a6[_0x57d2('0x36')][_0x57d2('0x37')]?_0x1957a6[_0x57d2('0x36')]:_0x7c33f3[_0x57d2('0x34')];if(!_0x277426[_0x57d2('0x30')]['hasOwnProperty']('nolimit')){_0x1957a6['limit']=qs['limit'](_0x277426[_0x57d2('0x30')][_0x57d2('0x1e')]);_0x1957a6[_0x57d2('0x1d')]=qs[_0x57d2('0x1d')](_0x277426[_0x57d2('0x30')]['offset']);}_0x1957a6[_0x57d2('0x38')]=qs['sort'](_0x277426[_0x57d2('0x30')][_0x57d2('0x39')]);_0x1957a6[_0x57d2('0x3a')]=qs['filters'](_[_0x57d2('0x3b')](_0x277426[_0x57d2('0x30')],_0x7c33f3['filters']),_0x1d3a3a);if(_0x277426[_0x57d2('0x30')][_0x57d2('0x3c')]){_0x1957a6[_0x57d2('0x3a')]=_[_0x57d2('0x3d')](_0x1957a6[_0x57d2('0x3a')],{'$or':_[_0x57d2('0x2b')](_0x1d3a3a,function(_0x47f379){if(_0x47f379[_0x57d2('0x2e')]!=='VIRTUAL'){var _0x1d3303={};_0x1d3303[_0x47f379[_0x57d2('0x28')]]={'$like':'%'+_0x277426[_0x57d2('0x30')][_0x57d2('0x3c')]+'%'};return _0x1d3303;}})});}_0x1957a6=_[_0x57d2('0x3d')]({},_0x1957a6,_0x277426['options']);var _0x282e6e={'where':_0x1957a6[_0x57d2('0x3a')]};return db['WhatsappQueueReport'][_0x57d2('0x1c')](_0x282e6e)[_0x57d2('0x24')](function(_0x1713bc){_0x1dd6cb['count']=_0x1713bc;if(_0x277426[_0x57d2('0x30')][_0x57d2('0x3e')]){_0x1957a6[_0x57d2('0x3f')]=[{'all':!![]}];}return db[_0x57d2('0x2c')]['findAll'](_0x1957a6);})['then'](function(_0x11a2ec){_0x1dd6cb[_0x57d2('0x40')]=_0x11a2ec;return _0x1dd6cb;})[_0x57d2('0x24')](respondWithFilteredResult(_0x1fe383,_0x1957a6))['catch'](handleError(_0x1fe383,null));};exports['show']=function(_0xebeac5,_0x5116b5){var _0xe42c98={'raw':!![],'where':{'id':_0xebeac5[_0x57d2('0x41')]['id']}},_0x1bb8ad={};_0x1bb8ad[_0x57d2('0x34')]=_[_0x57d2('0x31')](db['WhatsappQueueReport'][_0x57d2('0x42')]);_0x1bb8ad[_0x57d2('0x30')]=_['keys'](_0xebeac5[_0x57d2('0x30')]);_0x1bb8ad['filters']=_[_0x57d2('0x33')](_0x1bb8ad[_0x57d2('0x34')],_0x1bb8ad[_0x57d2('0x30')]);_0xe42c98[_0x57d2('0x36')]=_['intersection'](_0x1bb8ad['model'],qs[_0x57d2('0x35')](_0xebeac5['query']['fields']));_0xe42c98[_0x57d2('0x36')]=_0xe42c98['attributes']['length']?_0xe42c98[_0x57d2('0x36')]:_0x1bb8ad['model'];if(_0xebeac5[_0x57d2('0x30')]['includeAll']){_0xe42c98[_0x57d2('0x3f')]=[{'all':!![]}];}_0xe42c98=_['merge']({},_0xe42c98,_0xebeac5['options']);return db[_0x57d2('0x2c')][_0x57d2('0x43')](_0xe42c98)[_0x57d2('0x24')](handleEntityNotFound(_0x5116b5,null))[_0x57d2('0x24')](respondWithResult(_0x5116b5,null))[_0x57d2('0x44')](handleError(_0x5116b5,null));};exports[_0x57d2('0x45')]=function(_0x4c88dd,_0x4541b2){return db[_0x57d2('0x2c')][_0x57d2('0x45')](_0x4c88dd[_0x57d2('0x46')],{})[_0x57d2('0x24')](respondWithResult(_0x4541b2,0xc9))[_0x57d2('0x44')](handleError(_0x4541b2,null));};exports[_0x57d2('0x23')]=function(_0x406375,_0x51f172){if(_0x406375[_0x57d2('0x46')]['id']){delete _0x406375[_0x57d2('0x46')]['id'];}return db['WhatsappQueueReport'][_0x57d2('0x43')]({'where':{'id':_0x406375['params']['id']}})['then'](handleEntityNotFound(_0x51f172,null))[_0x57d2('0x24')](saveUpdates(_0x406375[_0x57d2('0x46')],null))[_0x57d2('0x24')](respondWithResult(_0x51f172,null))[_0x57d2('0x44')](handleError(_0x51f172,null));};exports['destroy']=function(_0x265d24,_0x176e24){return db['WhatsappQueueReport']['find']({'where':{'id':_0x265d24[_0x57d2('0x41')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x176e24,null))[_0x57d2('0x24')](removeEntity(_0x176e24,null))[_0x57d2('0x44')](handleError(_0x176e24,null));};exports[_0x57d2('0x47')]=function(_0x396220,_0x5a3e86){return db['WhatsappQueueReport']['describe']()[_0x57d2('0x24')](respondWithResult(_0x5a3e86,null))['catch'](handleError(_0x5a3e86,null));}; \ No newline at end of file +var _0xae60=['../../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','Content-Range','apply','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x583089,_0x129e8e){var _0x5a8c0d=function(_0x5e08cf){while(--_0x5e08cf){_0x583089['push'](_0x583089['shift']());}};_0x5a8c0d(++_0x129e8e);}(_0xae60,0x1c7));var _0x0ae6=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xae60[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];function respondWithStatusCode(_0x3b05a4,_0x30f8f9){_0x30f8f9=_0x30f8f9||0xcc;return function(_0x1aefd5){if(_0x1aefd5){return _0x3b05a4[_0x0ae6('0x1c')](_0x30f8f9);}return _0x3b05a4[_0x0ae6('0x1d')](_0x30f8f9)[_0x0ae6('0x1e')]();};}function respondWithResult(_0x4d2da8,_0x3809c6){_0x3809c6=_0x3809c6||0xc8;return function(_0x10c3bc){if(_0x10c3bc){return _0x4d2da8[_0x0ae6('0x1d')](_0x3809c6)[_0x0ae6('0x1f')](_0x10c3bc);}};}function respondWithFilteredResult(_0xce3e23,_0x3a1e26){return function(_0x151144){if(_0x151144){var _0x3b64ac=typeof _0x3a1e26[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x3a1e26[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xa97151=_0x151144[_0x0ae6('0x23')];var _0xda4f01=_0x3b64ac?0x0:_0x3a1e26[_0x0ae6('0x20')];var _0x2fdf25=_0x3b64ac?_0x151144[_0x0ae6('0x23')]:_0x3a1e26[_0x0ae6('0x20')]+_0x3a1e26[_0x0ae6('0x22')];var _0x26b369;if(_0x2fdf25>=_0xa97151){_0x2fdf25=_0xa97151;_0x26b369=0xc8;}else{_0x26b369=0xce;}_0xce3e23[_0x0ae6('0x1d')](_0x26b369);return _0xce3e23['set'](_0x0ae6('0x24'),_0xda4f01+'-'+_0x2fdf25+'/'+_0xa97151)[_0x0ae6('0x1f')](_0x151144);}return null;};}function patchUpdates(_0x140a3b){return function(_0x1027c2){try{jsonpatch[_0x0ae6('0x25')](_0x1027c2,_0x140a3b,!![]);}catch(_0xb4e6af){return BPromise[_0x0ae6('0x26')](_0xb4e6af);}return _0x1027c2[_0x0ae6('0x27')]();};}function saveUpdates(_0x515f3d,_0x39b22e){return function(_0x2a6484){if(_0x2a6484){return _0x2a6484[_0x0ae6('0x28')](_0x515f3d)[_0x0ae6('0x29')](function(_0x31ad85){return _0x31ad85;});}return null;};}function removeEntity(_0x4eba72,_0x296a9d){return function(_0x4e1242){if(_0x4e1242){return _0x4e1242[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x4eba72[_0x0ae6('0x1d')](0xcc)[_0x0ae6('0x1e')]();});}};}function handleEntityNotFound(_0x5b86fe,_0x3630e6){return function(_0x2dcdb7){if(!_0x2dcdb7){_0x5b86fe['sendStatus'](0x194);}return _0x2dcdb7;};}function handleError(_0x55dbe1,_0x44eb95){_0x44eb95=_0x44eb95||0x1f4;return function(_0x3255a7){logger[_0x0ae6('0x2b')](_0x3255a7['stack']);if(_0x3255a7[_0x0ae6('0x2c')]){delete _0x3255a7[_0x0ae6('0x2c')];}_0x55dbe1[_0x0ae6('0x1d')](_0x44eb95)['send'](_0x3255a7);};}exports[_0x0ae6('0x2d')]=function(_0x29fef3,_0x449c33){var _0x232fbd={},_0x14eed5={},_0x257af5={'count':0x0,'rows':[]};var _0x4fc7bd=_['map'](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')],function(_0x4e6df8){return{'name':_0x4e6df8['fieldName'],'type':_0x4e6df8[_0x0ae6('0x30')][_0x0ae6('0x31')]};});_0x14eed5[_0x0ae6('0x32')]=_[_0x0ae6('0x33')](_0x4fc7bd,'name');_0x14eed5[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x29fef3[_0x0ae6('0x34')]);_0x14eed5['filters']=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],_0x14eed5[_0x0ae6('0x34')]);_0x232fbd[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0x14eed5[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x38')]));_0x232fbd[_0x0ae6('0x37')]=_0x232fbd['attributes'][_0x0ae6('0x39')]?_0x232fbd[_0x0ae6('0x37')]:_0x14eed5['model'];if(!_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3a')](_0x0ae6('0x3b'))){_0x232fbd['limit']=qs[_0x0ae6('0x22')](_0x29fef3['query']['limit']);_0x232fbd[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x20')]);}_0x232fbd[_0x0ae6('0x3c')]=qs['sort'](_0x29fef3['query'][_0x0ae6('0x3d')]);_0x232fbd['where']=qs[_0x0ae6('0x3e')](_['pick'](_0x29fef3[_0x0ae6('0x34')],_0x14eed5['filters']),_0x4fc7bd);if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x3f')]){_0x232fbd[_0x0ae6('0x40')]=_[_0x0ae6('0x41')](_0x232fbd['where'],{'$or':_['map'](_0x4fc7bd,function(_0x43414c){if(_0x43414c[_0x0ae6('0x30')]!==_0x0ae6('0x42')){var _0x59480a={};_0x59480a[_0x43414c[_0x0ae6('0x2c')]]={'$like':'%'+_0x29fef3['query'][_0x0ae6('0x3f')]+'%'};return _0x59480a;}})});}_0x232fbd=_[_0x0ae6('0x41')]({},_0x232fbd,_0x29fef3[_0x0ae6('0x43')]);var _0x19403c={'where':_0x232fbd[_0x0ae6('0x40')]};return db[_0x0ae6('0x2e')]['count'](_0x19403c)[_0x0ae6('0x29')](function(_0x601ef9){_0x257af5[_0x0ae6('0x23')]=_0x601ef9;if(_0x29fef3[_0x0ae6('0x34')][_0x0ae6('0x44')]){_0x232fbd[_0x0ae6('0x45')]=[{'all':!![]}];}return db[_0x0ae6('0x2e')][_0x0ae6('0x46')](_0x232fbd);})['then'](function(_0x38faeb){_0x257af5[_0x0ae6('0x47')]=_0x38faeb;return _0x257af5;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x449c33,_0x232fbd))[_0x0ae6('0x48')](handleError(_0x449c33,null));};exports[_0x0ae6('0x49')]=function(_0x167ed1,_0x24c021){var _0x21431e={'raw':!![],'where':{'id':_0x167ed1[_0x0ae6('0x4a')]['id']}},_0xb38cbb={};_0xb38cbb[_0x0ae6('0x32')]=_[_0x0ae6('0x35')](db[_0x0ae6('0x2e')][_0x0ae6('0x2f')]);_0xb38cbb[_0x0ae6('0x34')]=_[_0x0ae6('0x35')](_0x167ed1[_0x0ae6('0x34')]);_0xb38cbb[_0x0ae6('0x3e')]=_['intersection'](_0xb38cbb[_0x0ae6('0x32')],_0xb38cbb[_0x0ae6('0x34')]);_0x21431e[_0x0ae6('0x37')]=_[_0x0ae6('0x36')](_0xb38cbb[_0x0ae6('0x32')],qs[_0x0ae6('0x38')](_0x167ed1['query'][_0x0ae6('0x38')]));_0x21431e[_0x0ae6('0x37')]=_0x21431e[_0x0ae6('0x37')][_0x0ae6('0x39')]?_0x21431e['attributes']:_0xb38cbb['model'];if(_0x167ed1['query'][_0x0ae6('0x44')]){_0x21431e[_0x0ae6('0x45')]=[{'all':!![]}];}_0x21431e=_[_0x0ae6('0x41')]({},_0x21431e,_0x167ed1['options']);return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')](_0x21431e)['then'](handleEntityNotFound(_0x24c021,null))[_0x0ae6('0x29')](respondWithResult(_0x24c021,null))[_0x0ae6('0x48')](handleError(_0x24c021,null));};exports['create']=function(_0x354efd,_0x3d1e75){return db['WhatsappQueueReport'][_0x0ae6('0x4c')](_0x354efd[_0x0ae6('0x4d')],{})[_0x0ae6('0x29')](respondWithResult(_0x3d1e75,0xc9))['catch'](handleError(_0x3d1e75,null));};exports[_0x0ae6('0x28')]=function(_0x21de54,_0x46075a){if(_0x21de54[_0x0ae6('0x4d')]['id']){delete _0x21de54[_0x0ae6('0x4d')]['id'];}return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x21de54['params']['id']}})['then'](handleEntityNotFound(_0x46075a,null))[_0x0ae6('0x29')](saveUpdates(_0x21de54[_0x0ae6('0x4d')],null))[_0x0ae6('0x29')](respondWithResult(_0x46075a,null))['catch'](handleError(_0x46075a,null));};exports[_0x0ae6('0x2a')]=function(_0x51df5c,_0x582a5e){return db[_0x0ae6('0x2e')][_0x0ae6('0x4b')]({'where':{'id':_0x51df5c[_0x0ae6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x582a5e,null))[_0x0ae6('0x29')](removeEntity(_0x582a5e,null))[_0x0ae6('0x48')](handleError(_0x582a5e,null));};exports[_0x0ae6('0x4e')]=function(_0x327b55,_0x173acd){return db[_0x0ae6('0x2e')][_0x0ae6('0x4e')]()[_0x0ae6('0x29')](respondWithResult(_0x173acd,null))[_0x0ae6('0x48')](handleError(_0x173acd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 35826a7..7557bed 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 _0x134a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0x134a,0x133));var _0xa134=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x134a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa134('0x0'));var util=require('util');var logger=require(_0xa134('0x1'))(_0xa134('0x2'));var moment=require(_0xa134('0x3'));var BPromise=require('bluebird');var rp=require(_0xa134('0x4'));var fs=require('fs');var path=require(_0xa134('0x5'));var rimraf=require(_0xa134('0x6'));var config=require(_0xa134('0x7'));var attributes=require(_0xa134('0x8'));module[_0xa134('0x9')]=function(_0x4ca49a,_0x2a93ce){return _0x4ca49a[_0xa134('0xa')](_0xa134('0xb'),attributes,{'tableName':_0xa134('0xc'),'paranoid':![],'indexes':[{'name':_0xa134('0xd'),'fields':[_0xa134('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38cd=['../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x38cd,0x156));var _0xd38c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x38cd[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xd38c('0x0'));var util=require(_0xd38c('0x1'));var logger=require(_0xd38c('0x2'))('api');var moment=require(_0xd38c('0x3'));var BPromise=require(_0xd38c('0x4'));var rp=require(_0xd38c('0x5'));var fs=require('fs');var path=require(_0xd38c('0x6'));var rimraf=require(_0xd38c('0x7'));var config=require(_0xd38c('0x8'));var attributes=require(_0xd38c('0x9'));module['exports']=function(_0x4cf27c,_0x112011){return _0x4cf27c[_0xd38c('0xa')](_0xd38c('0xb'),attributes,{'tableName':_0xd38c('0xc'),'paranoid':![],'indexes':[{'name':_0xd38c('0xd'),'fields':[_0xd38c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 71db2e0..bb6fccb 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 _0x1596=['error','code','message','result','create','options','raw','CreateWhatsappQueueReport','stringify','catch','UpdateWhatsappQueueReport','body','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x518e48,_0x2e5dc6){var _0x5d2de4=function(_0x42516a){while(--_0x42516a){_0x518e48['push'](_0x518e48['shift']());}};_0x5d2de4(++_0x2e5dc6);}(_0x1596,0x16f));var _0x6159=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x1596[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x6159('0x0'));var util=require(_0x6159('0x1'));var moment=require(_0x6159('0x2'));var BPromise=require(_0x6159('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6159('0x4'));var db=require(_0x6159('0x5'))['db'];var utils=require(_0x6159('0x6'));var logger=require('../../config/logger')(_0x6159('0x7'));var config=require(_0x6159('0x8'));var jayson=require(_0x6159('0x9'));var client=jayson['client'][_0x6159('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f030,_0xa325fe,_0x2d530e){return new BPromise(function(_0x1784b6,_0x2bf835){return client['request'](_0x28f030,_0x2d530e)[_0x6159('0xb')](function(_0x4e6cf6){logger[_0x6159('0xc')](_0x6159('0xd'),_0xa325fe,'request\x20sent');logger[_0x6159('0xe')](_0x6159('0xf'),_0xa325fe,_0x6159('0x10'),JSON['stringify'](_0x4e6cf6));if(_0x4e6cf6['error']){if(_0x4e6cf6[_0x6159('0x11')][_0x6159('0x12')]===0x1f4){logger[_0x6159('0x11')](_0x6159('0xd'),_0xa325fe,_0x4e6cf6[_0x6159('0x11')][_0x6159('0x13')]);return _0x2bf835(_0x4e6cf6[_0x6159('0x11')][_0x6159('0x13')]);}logger[_0x6159('0x11')](_0x6159('0xd'),_0xa325fe,_0x4e6cf6[_0x6159('0x11')][_0x6159('0x13')]);return _0x1784b6(_0x4e6cf6[_0x6159('0x11')][_0x6159('0x13')]);}else{logger[_0x6159('0xc')](_0x6159('0xd'),_0xa325fe,_0x6159('0x10'));_0x1784b6(_0x4e6cf6[_0x6159('0x14')]['message']);}})['catch'](function(_0x316630){logger[_0x6159('0x11')](_0x6159('0xd'),_0xa325fe,_0x316630);_0x2bf835(_0x316630);});});}exports['CreateWhatsappQueueReport']=function(_0x368d1f){var _0x4339cf=this;return new Promise(function(_0x141199,_0x3b6e1b){return db['WhatsappQueueReport'][_0x6159('0x15')](_0x368d1f['body'],{'raw':_0x368d1f[_0x6159('0x16')]?_0x368d1f[_0x6159('0x16')][_0x6159('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x54f210){logger[_0x6159('0xc')]('CreateWhatsappQueueReport',_0x368d1f);logger[_0x6159('0xe')](_0x6159('0x18'),_0x368d1f,JSON[_0x6159('0x19')](_0x54f210));_0x141199(_0x54f210);})[_0x6159('0x1a')](function(_0x4a0863){logger[_0x6159('0x11')](_0x6159('0x18'),_0x4a0863[_0x6159('0x13')],_0x368d1f);_0x3b6e1b(_0x4339cf[_0x6159('0x11')](0x1f4,_0x4a0863[_0x6159('0x13')]));});});};exports[_0x6159('0x1b')]=function(_0x5685a7){var _0x8fbdd6=this;return new Promise(function(_0x4fa217,_0x478722){return db['WhatsappQueueReport']['update'](_0x5685a7[_0x6159('0x1c')],{'raw':_0x5685a7['options']?_0x5685a7[_0x6159('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5685a7[_0x6159('0x16')]?_0x5685a7[_0x6159('0x16')][_0x6159('0x1d')]||null:null,'attributes':_0x5685a7[_0x6159('0x16')]?_0x5685a7['options'][_0x6159('0x1e')]||null:null,'limit':_0x5685a7[_0x6159('0x16')]?_0x5685a7[_0x6159('0x16')][_0x6159('0x1f')]||null:null})['then'](function(_0x35ec60){logger['info'](_0x6159('0x1b'),_0x5685a7);logger[_0x6159('0xe')](_0x6159('0x1b'),_0x5685a7,JSON[_0x6159('0x19')](_0x35ec60));_0x4fa217(_0x35ec60);})[_0x6159('0x1a')](function(_0x16545b){logger[_0x6159('0x11')](_0x6159('0x1b'),_0x16545b[_0x6159('0x13')],_0x5685a7);_0x478722(_0x8fbdd6[_0x6159('0x11')](0x1f4,_0x16545b['message']));});});}; \ No newline at end of file +var _0xf14f=['catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2fbb95,_0x3a9af6){var _0x2b9ecb=function(_0x3f73d9){while(--_0x3f73d9){_0x2fbb95['push'](_0x2fbb95['shift']());}};_0x2b9ecb(++_0x3a9af6);}(_0xf14f,0x8a));var _0xff14=function(_0x715d76,_0x402d60){_0x715d76=_0x715d76-0x0;var _0x48fe88=_0xf14f[_0x715d76];return _0x48fe88;};'use strict';var _=require(_0xff14('0x0'));var util=require(_0xff14('0x1'));var moment=require(_0xff14('0x2'));var BPromise=require(_0xff14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff14('0x4'));var db=require(_0xff14('0x5'))['db'];var utils=require(_0xff14('0x6'));var logger=require(_0xff14('0x7'))(_0xff14('0x8'));var config=require(_0xff14('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff14('0xa')][_0xff14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b228d,_0x3d9047,_0x18e19a){return new BPromise(function(_0x323ee5,_0xa7090e){return client[_0xff14('0xc')](_0x5b228d,_0x18e19a)[_0xff14('0xd')](function(_0x1115e3){logger[_0xff14('0xe')](_0xff14('0xf'),_0x3d9047,_0xff14('0x10'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3d9047,_0xff14('0x10'),JSON[_0xff14('0x11')](_0x1115e3));if(_0x1115e3[_0xff14('0x12')]){if(_0x1115e3[_0xff14('0x12')][_0xff14('0x13')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3d9047,_0x1115e3[_0xff14('0x12')][_0xff14('0x14')]);return _0xa7090e(_0x1115e3['error'][_0xff14('0x14')]);}logger[_0xff14('0x12')](_0xff14('0xf'),_0x3d9047,_0x1115e3[_0xff14('0x12')][_0xff14('0x14')]);return _0x323ee5(_0x1115e3[_0xff14('0x12')][_0xff14('0x14')]);}else{logger[_0xff14('0xe')](_0xff14('0xf'),_0x3d9047,'request\x20sent');_0x323ee5(_0x1115e3[_0xff14('0x15')]['message']);}})[_0xff14('0x16')](function(_0x5a5845){logger[_0xff14('0x12')](_0xff14('0xf'),_0x3d9047,_0x5a5845);_0xa7090e(_0x5a5845);});});}exports[_0xff14('0x17')]=function(_0xcf3f6a){var _0x38dce6=this;return new Promise(function(_0x4d861b,_0x203d6a){return db[_0xff14('0x18')]['create'](_0xcf3f6a[_0xff14('0x19')],{'raw':_0xcf3f6a[_0xff14('0x1a')]?_0xcf3f6a['options'][_0xff14('0x1b')]===undefined?!![]:![]:!![]})[_0xff14('0xd')](function(_0x19c1d6){logger[_0xff14('0xe')](_0xff14('0x17'),_0xcf3f6a);logger['debug'](_0xff14('0x17'),_0xcf3f6a,JSON[_0xff14('0x11')](_0x19c1d6));_0x4d861b(_0x19c1d6);})[_0xff14('0x16')](function(_0x5dcf6a){logger['error'](_0xff14('0x17'),_0x5dcf6a[_0xff14('0x14')],_0xcf3f6a);_0x203d6a(_0x38dce6[_0xff14('0x12')](0x1f4,_0x5dcf6a['message']));});});};exports[_0xff14('0x1c')]=function(_0x51b6b2){var _0x23982c=this;return new Promise(function(_0x47f2aa,_0x37cbad){return db['WhatsappQueueReport'][_0xff14('0x1d')](_0x51b6b2[_0xff14('0x19')],{'raw':_0x51b6b2[_0xff14('0x1a')]?_0x51b6b2[_0xff14('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b6b2['options']?_0x51b6b2[_0xff14('0x1a')][_0xff14('0x1e')]||null:null,'attributes':_0x51b6b2[_0xff14('0x1a')]?_0x51b6b2[_0xff14('0x1a')]['attributes']||null:null,'limit':_0x51b6b2[_0xff14('0x1a')]?_0x51b6b2[_0xff14('0x1a')]['limit']||null:null})['then'](function(_0x356af1){logger[_0xff14('0xe')](_0xff14('0x1c'),_0x51b6b2);logger[_0xff14('0x1f')](_0xff14('0x1c'),_0x51b6b2,JSON[_0xff14('0x11')](_0x356af1));_0x47f2aa(_0x356af1);})[_0xff14('0x16')](function(_0x408cda){logger[_0xff14('0x12')](_0xff14('0x1c'),_0x408cda['message'],_0x51b6b2);_0x37cbad(_0x23982c[_0xff14('0x12')](0x1f4,_0x408cda[_0xff14('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 964aad5..265d333 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 _0x80c1=['post','create','/:id','update','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','show'];(function(_0x4ea490,_0x34708d){var _0x536aba=function(_0x326ba5){while(--_0x326ba5){_0x4ea490['push'](_0x4ea490['shift']());}};_0x536aba(++_0x34708d);}(_0x80c1,0x1d9));var _0x180c=function(_0x50327a,_0x1cd357){_0x50327a=_0x50327a-0x0;var _0x37dd10=_0x80c1[_0x50327a];return _0x37dd10;};'use strict';var multer=require(_0x180c('0x0'));var util=require(_0x180c('0x1'));var path=require(_0x180c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x180c('0x3'));var auth=require(_0x180c('0x4'));var interaction=require(_0x180c('0x5'));var config=require(_0x180c('0x6'));var controller=require(_0x180c('0x7'));router[_0x180c('0x8')]('/',auth['isAuthenticated'](),controller[_0x180c('0x9')]);router['get']('/describe',auth[_0x180c('0xa')](),controller[_0x180c('0xb')]);router[_0x180c('0x8')]('/:id',auth[_0x180c('0xa')](),controller[_0x180c('0xc')]);router[_0x180c('0xd')]('/',auth[_0x180c('0xa')](),controller[_0x180c('0xe')]);router['put'](_0x180c('0xf'),auth[_0x180c('0xa')](),controller[_0x180c('0x10')]);router['delete'](_0x180c('0xf'),auth[_0x180c('0xa')](),controller['destroy']);module[_0x180c('0x11')]=router; \ No newline at end of file +var _0x262d=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path'];(function(_0x525798,_0x77a707){var _0x57da9a=function(_0x20837b){while(--_0x20837b){_0x525798['push'](_0x525798['shift']());}};_0x57da9a(++_0x77a707);}(_0x262d,0xb2));var _0xd262=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x262d[_0x139a3c];return _0x2b375b;};'use strict';var multer=require('multer');var util=require(_0xd262('0x0'));var path=require(_0xd262('0x1'));var timeout=require(_0xd262('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd262('0x3'));var auth=require(_0xd262('0x4'));var interaction=require(_0xd262('0x5'));var config=require(_0xd262('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xd262('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd262('0x7')](_0xd262('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xd262('0x7')](_0xd262('0x9'),auth[_0xd262('0xa')](),controller[_0xd262('0xb')]);router[_0xd262('0xc')]('/',auth['isAuthenticated'](),controller[_0xd262('0xd')]);router[_0xd262('0xe')]('/:id',auth[_0xd262('0xa')](),controller[_0xd262('0xf')]);router[_0xd262('0x10')](_0xd262('0x9'),auth[_0xd262('0xa')](),controller['destroy']);module[_0xd262('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 8cc966b..387fe7a 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 _0xd3f5=['ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x232d11,_0x1ba2d0){var _0x1cf8f3=function(_0xf17747){while(--_0xf17747){_0x232d11['push'](_0x232d11['shift']());}};_0x1cf8f3(++_0x1ba2d0);}(_0xd3f5,0x147));var _0x5d3f=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd3f5[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x5d3f('0x0'));module[_0x5d3f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5d3f('0x2')](_0x5d3f('0x3'),_0x5d3f('0x4'),_0x5d3f('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x5d3f('0x6')]}}; \ No newline at end of file +var _0x97e6=['account','queue','DATE','sequelize','STRING','ENUM'];(function(_0x342799,_0x3b5854){var _0x137810=function(_0x48e46f){while(--_0x48e46f){_0x342799['push'](_0x342799['shift']());}};_0x137810(++_0x3b5854);}(_0x97e6,0x159));var _0x697e=function(_0x3a3d20,_0x244316){_0x3a3d20=_0x3a3d20-0x0;var _0x33bc94=_0x97e6[_0x3a3d20];return _0x33bc94;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x697e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x697e('0x2')](_0x697e('0x3'),'agent',_0x697e('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x697e('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 4edf2eb..be7ea4c 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 _0x57d5=['length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','WhatsappTransferReport','include','findAll','rows','catch','params','intersection','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x57d5,0x192));var _0x557d=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x57d5[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x557d('0x0'));var rimraf=require(_0x557d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x557d('0x2'));var rp=require(_0x557d('0x3'));var moment=require(_0x557d('0x4'));var BPromise=require(_0x557d('0x5'));var Mustache=require(_0x557d('0x6'));var util=require(_0x557d('0x7'));var path=require(_0x557d('0x8'));var sox=require(_0x557d('0x9'));var csv=require(_0x557d('0xa'));var ejs=require(_0x557d('0xb'));var fs=require('fs');var fs_extra=require(_0x557d('0xc'));var _=require(_0x557d('0xd'));var squel=require(_0x557d('0xe'));var crypto=require(_0x557d('0xf'));var jsforce=require(_0x557d('0x10'));var deskjs=require(_0x557d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x557d('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x557d('0x13'));var qs=require(_0x557d('0x14'));var as=require(_0x557d('0x15'));var hardwareService=require(_0x557d('0x16'));var logger=require(_0x557d('0x17'))('api');var utils=require(_0x557d('0x18'));var config=require(_0x557d('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f9003,_0x465cfd){_0x465cfd=_0x465cfd||0xcc;return function(_0x33a0e7){if(_0x33a0e7){return _0x3f9003[_0x557d('0x1a')](_0x465cfd);}return _0x3f9003[_0x557d('0x1b')](_0x465cfd)[_0x557d('0x1c')]();};}function respondWithResult(_0xf20ff4,_0x33634c){_0x33634c=_0x33634c||0xc8;return function(_0x31cb99){if(_0x31cb99){return _0xf20ff4[_0x557d('0x1b')](_0x33634c)[_0x557d('0x1d')](_0x31cb99);}};}function respondWithFilteredResult(_0x39f1c1,_0x4d3d7f){return function(_0x4a2101){if(_0x4a2101){var _0x2463d3=typeof _0x4d3d7f['offset']===_0x557d('0x1e')&&typeof _0x4d3d7f['limit']===_0x557d('0x1e');var _0x15b7f1=_0x4a2101[_0x557d('0x1f')];var _0x38f362=_0x2463d3?0x0:_0x4d3d7f['offset'];var _0xbf2f20=_0x2463d3?_0x4a2101['count']:_0x4d3d7f[_0x557d('0x20')]+_0x4d3d7f[_0x557d('0x21')];var _0x3c8348;if(_0xbf2f20>=_0x15b7f1){_0xbf2f20=_0x15b7f1;_0x3c8348=0xc8;}else{_0x3c8348=0xce;}_0x39f1c1['status'](_0x3c8348);return _0x39f1c1[_0x557d('0x22')](_0x557d('0x23'),_0x38f362+'-'+_0xbf2f20+'/'+_0x15b7f1)['json'](_0x4a2101);}return null;};}function patchUpdates(_0x1edf3b){return function(_0x430c58){try{jsonpatch[_0x557d('0x24')](_0x430c58,_0x1edf3b,!![]);}catch(_0x1b3871){return BPromise[_0x557d('0x25')](_0x1b3871);}return _0x430c58[_0x557d('0x26')]();};}function saveUpdates(_0x26d2e6,_0x49b9ed){return function(_0x4a8597){if(_0x4a8597){return _0x4a8597[_0x557d('0x27')](_0x26d2e6)[_0x557d('0x28')](function(_0x22c9af){return _0x22c9af;});}return null;};}function removeEntity(_0x1054a8,_0x54622e){return function(_0x1a40c8){if(_0x1a40c8){return _0x1a40c8[_0x557d('0x29')]()[_0x557d('0x28')](function(){_0x1054a8[_0x557d('0x1b')](0xcc)[_0x557d('0x1c')]();});}};}function handleEntityNotFound(_0x346b27,_0x58dae0){return function(_0x18448c){if(!_0x18448c){_0x346b27[_0x557d('0x1a')](0x194);}return _0x18448c;};}function handleError(_0x3104cd,_0x2640ff){_0x2640ff=_0x2640ff||0x1f4;return function(_0x46fc5e){logger['error'](_0x46fc5e['stack']);if(_0x46fc5e[_0x557d('0x2a')]){delete _0x46fc5e[_0x557d('0x2a')];}_0x3104cd['status'](_0x2640ff)['send'](_0x46fc5e);};}exports[_0x557d('0x2b')]=function(_0x3d1b46,_0x4fca8b){var _0x4f33d9={},_0x53a05a={},_0x4f11b5={'count':0x0,'rows':[]};var _0x2e0010=_[_0x557d('0x2c')](db['WhatsappTransferReport'][_0x557d('0x2d')],function(_0x18f29b){return{'name':_0x18f29b[_0x557d('0x2e')],'type':_0x18f29b[_0x557d('0x2f')][_0x557d('0x30')]};});_0x53a05a[_0x557d('0x31')]=_['map'](_0x2e0010,_0x557d('0x2a'));_0x53a05a[_0x557d('0x32')]=_[_0x557d('0x33')](_0x3d1b46[_0x557d('0x32')]);_0x53a05a['filters']=_['intersection'](_0x53a05a[_0x557d('0x31')],_0x53a05a[_0x557d('0x32')]);_0x4f33d9[_0x557d('0x34')]=_['intersection'](_0x53a05a[_0x557d('0x31')],qs[_0x557d('0x35')](_0x3d1b46[_0x557d('0x32')][_0x557d('0x35')]));_0x4f33d9[_0x557d('0x34')]=_0x4f33d9[_0x557d('0x34')][_0x557d('0x36')]?_0x4f33d9[_0x557d('0x34')]:_0x53a05a[_0x557d('0x31')];if(!_0x3d1b46[_0x557d('0x32')][_0x557d('0x37')](_0x557d('0x38'))){_0x4f33d9[_0x557d('0x21')]=qs[_0x557d('0x21')](_0x3d1b46['query'][_0x557d('0x21')]);_0x4f33d9[_0x557d('0x20')]=qs[_0x557d('0x20')](_0x3d1b46[_0x557d('0x32')][_0x557d('0x20')]);}_0x4f33d9[_0x557d('0x39')]=qs[_0x557d('0x3a')](_0x3d1b46[_0x557d('0x32')][_0x557d('0x3a')]);_0x4f33d9['where']=qs['filters'](_[_0x557d('0x3b')](_0x3d1b46[_0x557d('0x32')],_0x53a05a[_0x557d('0x3c')]),_0x2e0010);if(_0x3d1b46[_0x557d('0x32')][_0x557d('0x3d')]){_0x4f33d9[_0x557d('0x3e')]=_[_0x557d('0x3f')](_0x4f33d9[_0x557d('0x3e')],{'$or':_['map'](_0x2e0010,function(_0x44ad31){if(_0x44ad31[_0x557d('0x2f')]!=='VIRTUAL'){var _0x35a489={};_0x35a489[_0x44ad31[_0x557d('0x2a')]]={'$like':'%'+_0x3d1b46[_0x557d('0x32')]['filter']+'%'};return _0x35a489;}})});}_0x4f33d9=_[_0x557d('0x3f')]({},_0x4f33d9,_0x3d1b46[_0x557d('0x40')]);var _0x2d0d17={'where':_0x4f33d9[_0x557d('0x3e')]};return db[_0x557d('0x41')]['count'](_0x2d0d17)[_0x557d('0x28')](function(_0x55b53c){_0x4f11b5[_0x557d('0x1f')]=_0x55b53c;if(_0x3d1b46['query']['includeAll']){_0x4f33d9[_0x557d('0x42')]=[{'all':!![]}];}return db[_0x557d('0x41')][_0x557d('0x43')](_0x4f33d9);})[_0x557d('0x28')](function(_0x162173){_0x4f11b5[_0x557d('0x44')]=_0x162173;return _0x4f11b5;})[_0x557d('0x28')](respondWithFilteredResult(_0x4fca8b,_0x4f33d9))[_0x557d('0x45')](handleError(_0x4fca8b,null));};exports['show']=function(_0x1ef683,_0x1123e1){var _0x3a51f2={'raw':!![],'where':{'id':_0x1ef683[_0x557d('0x46')]['id']}},_0x2c35cd={};_0x2c35cd[_0x557d('0x31')]=_[_0x557d('0x33')](db[_0x557d('0x41')]['rawAttributes']);_0x2c35cd[_0x557d('0x32')]=_[_0x557d('0x33')](_0x1ef683[_0x557d('0x32')]);_0x2c35cd[_0x557d('0x3c')]=_[_0x557d('0x47')](_0x2c35cd[_0x557d('0x31')],_0x2c35cd[_0x557d('0x32')]);_0x3a51f2[_0x557d('0x34')]=_[_0x557d('0x47')](_0x2c35cd[_0x557d('0x31')],qs[_0x557d('0x35')](_0x1ef683[_0x557d('0x32')]['fields']));_0x3a51f2[_0x557d('0x34')]=_0x3a51f2[_0x557d('0x34')]['length']?_0x3a51f2[_0x557d('0x34')]:_0x2c35cd[_0x557d('0x31')];if(_0x1ef683['query']['includeAll']){_0x3a51f2[_0x557d('0x42')]=[{'all':!![]}];}_0x3a51f2=_['merge']({},_0x3a51f2,_0x1ef683[_0x557d('0x40')]);return db[_0x557d('0x41')][_0x557d('0x48')](_0x3a51f2)[_0x557d('0x28')](handleEntityNotFound(_0x1123e1,null))[_0x557d('0x28')](respondWithResult(_0x1123e1,null))[_0x557d('0x45')](handleError(_0x1123e1,null));};exports[_0x557d('0x49')]=function(_0x411601,_0x4df62f){return db['WhatsappTransferReport'][_0x557d('0x49')](_0x411601[_0x557d('0x4a')],{})[_0x557d('0x28')](respondWithResult(_0x4df62f,0xc9))['catch'](handleError(_0x4df62f,null));};exports[_0x557d('0x27')]=function(_0x39d059,_0xab8756){if(_0x39d059['body']['id']){delete _0x39d059[_0x557d('0x4a')]['id'];}return db['WhatsappTransferReport'][_0x557d('0x48')]({'where':{'id':_0x39d059[_0x557d('0x46')]['id']}})[_0x557d('0x28')](handleEntityNotFound(_0xab8756,null))[_0x557d('0x28')](saveUpdates(_0x39d059[_0x557d('0x4a')],null))[_0x557d('0x28')](respondWithResult(_0xab8756,null))['catch'](handleError(_0xab8756,null));};exports['destroy']=function(_0x4cf767,_0x10abb7){return db[_0x557d('0x41')][_0x557d('0x48')]({'where':{'id':_0x4cf767['params']['id']}})[_0x557d('0x28')](handleEntityNotFound(_0x10abb7,null))[_0x557d('0x28')](removeEntity(_0x10abb7,null))[_0x557d('0x45')](handleError(_0x10abb7,null));};exports['describe']=function(_0x49e6d4,_0x58ca41){return db[_0x557d('0x41')][_0x557d('0x4b')]()[_0x557d('0x28')](respondWithResult(_0x58ca41,null))['catch'](handleError(_0x58ca41,null));}; \ No newline at end of file +var _0x93e9=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','WhatsappTransferReport','includeAll','include','findAll','catch','show','params','keys','fields','length','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1f368a,_0x1651eb){var _0x28331b=function(_0x563709){while(--_0x563709){_0x1f368a['push'](_0x1f368a['shift']());}};_0x28331b(++_0x1651eb);}(_0x93e9,0xcc));var _0x993e=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0x93e9[_0x4605dc];return _0x5d3e81;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];function respondWithStatusCode(_0x5d5c0d,_0x4c2707){_0x4c2707=_0x4c2707||0xcc;return function(_0x31ece2){if(_0x31ece2){return _0x5d5c0d[_0x993e('0x19')](_0x4c2707);}return _0x5d5c0d[_0x993e('0x1a')](_0x4c2707)[_0x993e('0x1b')]();};}function respondWithResult(_0x3e082b,_0x397b42){_0x397b42=_0x397b42||0xc8;return function(_0x34ddda){if(_0x34ddda){return _0x3e082b[_0x993e('0x1a')](_0x397b42)[_0x993e('0x1c')](_0x34ddda);}};}function respondWithFilteredResult(_0xa43a4e,_0x1a7726){return function(_0x135771){if(_0x135771){var _0x3df0e7=typeof _0x1a7726[_0x993e('0x1d')]===_0x993e('0x1e')&&typeof _0x1a7726[_0x993e('0x1f')]===_0x993e('0x1e');var _0x526e06=_0x135771[_0x993e('0x20')];var _0x1acd21=_0x3df0e7?0x0:_0x1a7726[_0x993e('0x1d')];var _0x3d6109=_0x3df0e7?_0x135771[_0x993e('0x20')]:_0x1a7726[_0x993e('0x1d')]+_0x1a7726['limit'];var _0x11cd41;if(_0x3d6109>=_0x526e06){_0x3d6109=_0x526e06;_0x11cd41=0xc8;}else{_0x11cd41=0xce;}_0xa43a4e[_0x993e('0x1a')](_0x11cd41);return _0xa43a4e[_0x993e('0x21')](_0x993e('0x22'),_0x1acd21+'-'+_0x3d6109+'/'+_0x526e06)[_0x993e('0x1c')](_0x135771);}return null;};}function patchUpdates(_0x425ab4){return function(_0x29e48d){try{jsonpatch[_0x993e('0x23')](_0x29e48d,_0x425ab4,!![]);}catch(_0x4bbe9c){return BPromise[_0x993e('0x24')](_0x4bbe9c);}return _0x29e48d['save']();};}function saveUpdates(_0x11f6f4,_0x37ff57){return function(_0x32b09e){if(_0x32b09e){return _0x32b09e['update'](_0x11f6f4)[_0x993e('0x25')](function(_0x13db4e){return _0x13db4e;});}return null;};}function removeEntity(_0xfba00f,_0x1c52fd){return function(_0x3b45ef){if(_0x3b45ef){return _0x3b45ef[_0x993e('0x26')]()[_0x993e('0x25')](function(){_0xfba00f[_0x993e('0x1a')](0xcc)[_0x993e('0x1b')]();});}};}function handleEntityNotFound(_0x18f6ac,_0x3fe099){return function(_0x3603fa){if(!_0x3603fa){_0x18f6ac['sendStatus'](0x194);}return _0x3603fa;};}function handleError(_0x2756a7,_0x279bb8){_0x279bb8=_0x279bb8||0x1f4;return function(_0x52b727){logger[_0x993e('0x27')](_0x52b727['stack']);if(_0x52b727[_0x993e('0x28')]){delete _0x52b727[_0x993e('0x28')];}_0x2756a7[_0x993e('0x1a')](_0x279bb8)[_0x993e('0x29')](_0x52b727);};}exports['index']=function(_0x48d457,_0x32e332){var _0x466d63={},_0x4a4f00={},_0x223af0={'count':0x0,'rows':[]};var _0x46670a=_[_0x993e('0x2a')](db['WhatsappTransferReport'][_0x993e('0x2b')],function(_0x9e0309){return{'name':_0x9e0309[_0x993e('0x2c')],'type':_0x9e0309[_0x993e('0x2d')][_0x993e('0x2e')]};});_0x4a4f00['model']=_[_0x993e('0x2a')](_0x46670a,'name');_0x4a4f00[_0x993e('0x2f')]=_['keys'](_0x48d457[_0x993e('0x2f')]);_0x4a4f00['filters']=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],_0x4a4f00[_0x993e('0x2f')]);_0x466d63[_0x993e('0x32')]=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],qs['fields'](_0x48d457[_0x993e('0x2f')]['fields']));_0x466d63['attributes']=_0x466d63[_0x993e('0x32')]['length']?_0x466d63[_0x993e('0x32')]:_0x4a4f00[_0x993e('0x31')];if(!_0x48d457[_0x993e('0x2f')][_0x993e('0x33')](_0x993e('0x34'))){_0x466d63[_0x993e('0x1f')]=qs[_0x993e('0x1f')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1f')]);_0x466d63[_0x993e('0x1d')]=qs[_0x993e('0x1d')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1d')]);}_0x466d63[_0x993e('0x35')]=qs[_0x993e('0x36')](_0x48d457['query'][_0x993e('0x36')]);_0x466d63[_0x993e('0x37')]=qs[_0x993e('0x38')](_[_0x993e('0x39')](_0x48d457[_0x993e('0x2f')],_0x4a4f00[_0x993e('0x38')]),_0x46670a);if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]){_0x466d63[_0x993e('0x37')]=_['merge'](_0x466d63[_0x993e('0x37')],{'$or':_['map'](_0x46670a,function(_0xf79f29){if(_0xf79f29[_0x993e('0x2d')]!==_0x993e('0x3b')){var _0x406f14={};_0x406f14[_0xf79f29[_0x993e('0x28')]]={'$like':'%'+_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]+'%'};return _0x406f14;}})});}_0x466d63=_[_0x993e('0x3c')]({},_0x466d63,_0x48d457['options']);var _0x186d55={'where':_0x466d63['where']};return db[_0x993e('0x3d')]['count'](_0x186d55)[_0x993e('0x25')](function(_0xbd9983){_0x223af0[_0x993e('0x20')]=_0xbd9983;if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3e')]){_0x466d63[_0x993e('0x3f')]=[{'all':!![]}];}return db[_0x993e('0x3d')][_0x993e('0x40')](_0x466d63);})['then'](function(_0xe64c){_0x223af0['rows']=_0xe64c;return _0x223af0;})['then'](respondWithFilteredResult(_0x32e332,_0x466d63))[_0x993e('0x41')](handleError(_0x32e332,null));};exports[_0x993e('0x42')]=function(_0x1f058f,_0x5ed497){var _0x620b26={'raw':!![],'where':{'id':_0x1f058f[_0x993e('0x43')]['id']}},_0x40719d={};_0x40719d['model']=_['keys'](db['WhatsappTransferReport'][_0x993e('0x2b')]);_0x40719d[_0x993e('0x2f')]=_[_0x993e('0x44')](_0x1f058f['query']);_0x40719d[_0x993e('0x38')]=_[_0x993e('0x30')](_0x40719d['model'],_0x40719d[_0x993e('0x2f')]);_0x620b26[_0x993e('0x32')]=_['intersection'](_0x40719d[_0x993e('0x31')],qs[_0x993e('0x45')](_0x1f058f[_0x993e('0x2f')]['fields']));_0x620b26['attributes']=_0x620b26['attributes'][_0x993e('0x46')]?_0x620b26[_0x993e('0x32')]:_0x40719d[_0x993e('0x31')];if(_0x1f058f[_0x993e('0x2f')]['includeAll']){_0x620b26[_0x993e('0x3f')]=[{'all':!![]}];}_0x620b26=_[_0x993e('0x3c')]({},_0x620b26,_0x1f058f[_0x993e('0x47')]);return db[_0x993e('0x3d')][_0x993e('0x48')](_0x620b26)[_0x993e('0x25')](handleEntityNotFound(_0x5ed497,null))['then'](respondWithResult(_0x5ed497,null))['catch'](handleError(_0x5ed497,null));};exports[_0x993e('0x49')]=function(_0x416f9f,_0x4d560d){return db['WhatsappTransferReport'][_0x993e('0x49')](_0x416f9f[_0x993e('0x4a')],{})[_0x993e('0x25')](respondWithResult(_0x4d560d,0xc9))[_0x993e('0x41')](handleError(_0x4d560d,null));};exports[_0x993e('0x4b')]=function(_0x256ce3,_0x5b18e3){if(_0x256ce3[_0x993e('0x4a')]['id']){delete _0x256ce3['body']['id'];}return db[_0x993e('0x3d')][_0x993e('0x48')]({'where':{'id':_0x256ce3[_0x993e('0x43')]['id']}})[_0x993e('0x25')](handleEntityNotFound(_0x5b18e3,null))[_0x993e('0x25')](saveUpdates(_0x256ce3[_0x993e('0x4a')],null))[_0x993e('0x25')](respondWithResult(_0x5b18e3,null))[_0x993e('0x41')](handleError(_0x5b18e3,null));};exports['destroy']=function(_0x23f09c,_0x66ee65){return db[_0x993e('0x3d')]['find']({'where':{'id':_0x23f09c[_0x993e('0x43')]['id']}})['then'](handleEntityNotFound(_0x66ee65,null))[_0x993e('0x25')](removeEntity(_0x66ee65,null))[_0x993e('0x41')](handleError(_0x66ee65,null));};exports['describe']=function(_0xb2508b,_0xef78a1){return db['WhatsappTransferReport'][_0x993e('0x4c')]()[_0x993e('0x25')](respondWithResult(_0xef78a1,null))[_0x993e('0x41')](handleError(_0xef78a1,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a3a4d36..32619ac 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 _0x471f=['lodash','util','../../config/logger','api','moment','bluebird','path','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0x471f,0xc0));var _0xf471=function(_0x3a2e9a,_0x52f198){_0x3a2e9a=_0x3a2e9a-0x0;var _0x511b2c=_0x471f[_0x3a2e9a];return _0x511b2c;};'use strict';var _=require(_0xf471('0x0'));var util=require(_0xf471('0x1'));var logger=require(_0xf471('0x2'))(_0xf471('0x3'));var moment=require(_0xf471('0x4'));var BPromise=require(_0xf471('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf471('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf471('0x7'));module[_0xf471('0x8')]=function(_0x2cd017,_0x24c358){return _0x2cd017[_0xf471('0x9')](_0xf471('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xf471('0xb'),'fields':[_0xf471('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x819d=['../../config/logger','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x12a045,_0x557056){var _0x5b3a5e=function(_0x578299){while(--_0x578299){_0x12a045['push'](_0x12a045['shift']());}};_0x5b3a5e(++_0x557056);}(_0x819d,0xc5));var _0xd819=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x819d[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xd819('0x0'));var util=require('util');var logger=require(_0xd819('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd819('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd819('0x3'));var rimraf=require('rimraf');var config=require(_0xd819('0x4'));var attributes=require(_0xd819('0x5'));module[_0xd819('0x6')]=function(_0x245630,_0x2cbe56){return _0x245630['define']('WhatsappTransferReport',attributes,{'tableName':_0xd819('0x7'),'paranoid':![],'indexes':[{'name':_0xd819('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 824b5b0..c12ef8d 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 _0x81f8=['jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x401234,_0xfd4275){var _0x12842c=function(_0x1286df){while(--_0x1286df){_0x401234['push'](_0x401234['shift']());}};_0x12842c(++_0xfd4275);}(_0x81f8,0x186));var _0x881f=function(_0x18e51a,_0x5b4ca5){_0x18e51a=_0x18e51a-0x0;var _0x4b1d01=_0x81f8[_0x18e51a];return _0x4b1d01;};'use strict';var _=require(_0x881f('0x0'));var util=require(_0x881f('0x1'));var moment=require('moment');var BPromise=require(_0x881f('0x2'));var rs=require(_0x881f('0x3'));var fs=require('fs');var Redis=require(_0x881f('0x4'));var db=require(_0x881f('0x5'))['db'];var utils=require(_0x881f('0x6'));var logger=require('../../config/logger')(_0x881f('0x7'));var config=require(_0x881f('0x8'));var jayson=require(_0x881f('0x9'));var client=jayson[_0x881f('0xa')][_0x881f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30b48c,_0x2d93bc,_0x521af3){return new BPromise(function(_0x5b1564,_0x8ae33d){return client[_0x881f('0xc')](_0x30b48c,_0x521af3)['then'](function(_0x8d94d7){logger[_0x881f('0xd')](_0x881f('0xe'),_0x2d93bc,_0x881f('0xf'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x2d93bc,_0x881f('0xf'),JSON[_0x881f('0x10')](_0x8d94d7));if(_0x8d94d7[_0x881f('0x11')]){if(_0x8d94d7['error']['code']===0x1f4){logger[_0x881f('0x11')](_0x881f('0xe'),_0x2d93bc,_0x8d94d7['error']['message']);return _0x8ae33d(_0x8d94d7[_0x881f('0x11')][_0x881f('0x12')]);}logger[_0x881f('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2d93bc,_0x8d94d7[_0x881f('0x11')][_0x881f('0x12')]);return _0x5b1564(_0x8d94d7['error'][_0x881f('0x12')]);}else{logger[_0x881f('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2d93bc,_0x881f('0xf'));_0x5b1564(_0x8d94d7[_0x881f('0x13')][_0x881f('0x12')]);}})[_0x881f('0x14')](function(_0x278532){logger[_0x881f('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2d93bc,_0x278532);_0x8ae33d(_0x278532);});});} \ No newline at end of file +var _0xc729=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xc782ea,_0x403582){var _0x16d7c2=function(_0x25d47c){while(--_0x25d47c){_0xc782ea['push'](_0xc782ea['shift']());}};_0x16d7c2(++_0x403582);}(_0xc729,0x1a5));var _0x9c72=function(_0x4c3267,_0xf2b77){_0x4c3267=_0x4c3267-0x0;var _0xfa5c9=_0xc729[_0x4c3267];return _0xfa5c9;};'use strict';var _=require(_0x9c72('0x0'));var util=require(_0x9c72('0x1'));var moment=require('moment');var BPromise=require(_0x9c72('0x2'));var rs=require(_0x9c72('0x3'));var fs=require('fs');var Redis=require(_0x9c72('0x4'));var db=require(_0x9c72('0x5'))['db'];var utils=require(_0x9c72('0x6'));var logger=require(_0x9c72('0x7'))(_0x9c72('0x8'));var config=require(_0x9c72('0x9'));var jayson=require(_0x9c72('0xa'));var client=jayson[_0x9c72('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x393093,_0xdb1a2f,_0x169070){return new BPromise(function(_0x2ff140,_0x6f98b4){return client['request'](_0x393093,_0x169070)[_0x9c72('0xc')](function(_0x3d3203){logger[_0x9c72('0xd')](_0x9c72('0xe'),_0xdb1a2f,_0x9c72('0xf'));logger[_0x9c72('0x10')](_0x9c72('0x11'),_0xdb1a2f,_0x9c72('0xf'),JSON[_0x9c72('0x12')](_0x3d3203));if(_0x3d3203[_0x9c72('0x13')]){if(_0x3d3203[_0x9c72('0x13')]['code']===0x1f4){logger[_0x9c72('0x13')](_0x9c72('0xe'),_0xdb1a2f,_0x3d3203[_0x9c72('0x13')][_0x9c72('0x14')]);return _0x6f98b4(_0x3d3203[_0x9c72('0x13')][_0x9c72('0x14')]);}logger[_0x9c72('0x13')](_0x9c72('0xe'),_0xdb1a2f,_0x3d3203[_0x9c72('0x13')][_0x9c72('0x14')]);return _0x2ff140(_0x3d3203[_0x9c72('0x13')]['message']);}else{logger['info'](_0x9c72('0xe'),_0xdb1a2f,_0x9c72('0xf'));_0x2ff140(_0x3d3203[_0x9c72('0x15')][_0x9c72('0x14')]);}})[_0x9c72('0x16')](function(_0x5e2bda){logger[_0x9c72('0x13')](_0x9c72('0xe'),_0xdb1a2f,_0x5e2bda);_0x6f98b4(_0x5e2bda);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 343ca07..eb61de6 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb5a=['./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','sync','then','listen','info','start','Online\x20apps:','map','online','Offline\x20apps:','filter','name','None','seedDB','default'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xeb5a,0x149));var _0xaeb5=function(_0x5e78dc,_0xa69dfb){_0x5e78dc=_0x5e78dc-0x0;var _0x49921c=_0xeb5a[_0x5e78dc];return _0x49921c;};'use strict';var _=require('lodash');var mysqldb=require(_0xaeb5('0x0'));var rpc=require(_0xaeb5('0x1'));var config=require(_0xaeb5('0x2'));var logger=require('./config/logger')(_0xaeb5('0x3'));var pm2=require(_0xaeb5('0x4'));var pm2Config=require(_0xaeb5('0x5'));var schedule=require(_0xaeb5('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xaeb5('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0xaeb5('0x8')]()[_0xaeb5('0x9')](function(){return rpc[_0xaeb5('0xa')]();})[_0xaeb5('0x9')](function(_0x5ee7f6){logger[_0xaeb5('0xb')](_0x5ee7f6);return chat[_0xaeb5('0xc')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xaeb5('0xc')]();})[_0xaeb5('0x9')](function(){return transcribe['start']();})[_0xaeb5('0x9')](function(_0x546a29){logger[_0xaeb5('0xb')](_0x546a29);return pm2['start'](pm2Config);})[_0xaeb5('0x9')](function(_0x8e8fed){logger[_0xaeb5('0xb')](_0xaeb5('0xd'),_[_0xaeb5('0xe')](_['filter'](_0x8e8fed,{'status':_0xaeb5('0xf')}),'name')['join']());logger[_0xaeb5('0xb')](_0xaeb5('0x10'),_['map'](_[_0xaeb5('0x11')](_0x8e8fed,function(_0x225165){return _0x225165['status']!==_0xaeb5('0xf');}),_0xaeb5('0x12'))['join']()||_0xaeb5('0x13'));config[_0xaeb5('0x14')]&&require('./config/seedDB')[_0xaeb5('0x15')]();require(_0xaeb5('0x16'))[_0xaeb5('0x15')]();})[_0xaeb5('0x17')](function(_0x2b7b41){logger[_0xaeb5('0x18')](_0xaeb5('0x19'),_0x2b7b41);process[_0xaeb5('0x1a')](0x1);});}main(); \ No newline at end of file +var _0x5508=['info','start','Online\x20apps:','online','name','join','map','filter','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen'];(function(_0x420a56,_0x45c974){var _0x19dc8d=function(_0x4027a5){while(--_0x4027a5){_0x420a56['push'](_0x420a56['shift']());}};_0x19dc8d(++_0x45c974);}(_0x5508,0xa6));var _0x8550=function(_0x122c87,_0x16bd54){_0x122c87=_0x122c87-0x0;var _0x1a6e8a=_0x5508[_0x122c87];return _0x1a6e8a;};'use strict';var _=require(_0x8550('0x0'));var mysqldb=require(_0x8550('0x1'));var rpc=require(_0x8550('0x2'));var config=require(_0x8550('0x3'));var logger=require(_0x8550('0x4'))(_0x8550('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x8550('0x6'));var schedule=require('./config/schedule');var chat=require(_0x8550('0x7'));var whatsapp=require(_0x8550('0x8'));var transcribe=require(_0x8550('0x9'));function main(){return mysqldb['db'][_0x8550('0xa')][_0x8550('0xb')]()[_0x8550('0xc')](function(){return rpc[_0x8550('0xd')]();})[_0x8550('0xc')](function(_0x256ee5){logger[_0x8550('0xe')](_0x256ee5);return chat[_0x8550('0xf')]();})[_0x8550('0xc')](function(){return whatsapp[_0x8550('0xf')]();})[_0x8550('0xc')](function(){return schedule['start']();})[_0x8550('0xc')](function(){return transcribe[_0x8550('0xf')]();})[_0x8550('0xc')](function(_0x1e823f){logger[_0x8550('0xe')](_0x1e823f);return pm2['start'](pm2Config);})[_0x8550('0xc')](function(_0x46569f){logger['info'](_0x8550('0x10'),_['map'](_['filter'](_0x46569f,{'status':_0x8550('0x11')}),_0x8550('0x12'))[_0x8550('0x13')]());logger[_0x8550('0xe')]('Offline\x20apps:',_[_0x8550('0x14')](_[_0x8550('0x15')](_0x46569f,function(_0x4d3a3e){return _0x4d3a3e[_0x8550('0x16')]!==_0x8550('0x11');}),_0x8550('0x12'))[_0x8550('0x13')]()||_0x8550('0x17'));config[_0x8550('0x18')]&&require(_0x8550('0x19'))[_0x8550('0x1a')]();require(_0x8550('0x1b'))[_0x8550('0x1a')]();})[_0x8550('0x1c')](function(_0x58c2f7){logger[_0x8550('0x1d')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x58c2f7);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 978bd2f..e31b031 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 _0x62bd=['json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','unshift','encryptString','join','promisify','sign','payload','verify','randomBytes','toString','hex','floor','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','util','moment','secrets','session','fullname','name','email','userpic','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x62bd,0x146));var _0xd62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bd[_0x3dd15e];return _0x231fd0;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xd62b('0x0'));var hardwareConf=require(_0xd62b('0x1'));var licenseUtil=require(_0xd62b('0x2'));var encryptor=require(_0xd62b('0x3'));var _=require(_0xd62b('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xd62b('0x5'));var compose=require(_0xd62b('0x6'));var basicAuth=require(_0xd62b('0x7'));var crypto=require(_0xd62b('0x8'));var BPromise=require('bluebird');var util=require(_0xd62b('0x9'));var moment=require(_0xd62b('0xa'));var validateJwt=expressJwt({'secret':config[_0xd62b('0xb')][_0xd62b('0xc')]});var userAttributes=['id','role',_0xd62b('0xd'),_0xd62b('0xe'),'internal',_0xd62b('0xf'),_0xd62b('0x10'),'permissions',_0xd62b('0x11'),_0xd62b('0x12'),_0xd62b('0x13'),_0xd62b('0x14'),'faxPause',_0xd62b('0x15'),_0xd62b('0x16'),'pauseType',_0xd62b('0x17'),'lastLoginAt',_0xd62b('0x18'),'crudPermissions',_0xd62b('0x19'),_0xd62b('0x1a'),_0xd62b('0x1b'),_0xd62b('0x1c'),_0xd62b('0x1d'),'phoneBarDnd','phoneBarEnableRecording',_0xd62b('0x1e'),_0xd62b('0x1f'),_0xd62b('0x20'),_0xd62b('0x21'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0xd62b('0x22'),_0xd62b('0x23'),_0xd62b('0x24'),_0xd62b('0x25'),'settingsEnabled',_0xd62b('0x26'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0xd62b('0x27'),'ignorePauseForPreviewCalls',_0xd62b('0x28')];exports[_0xd62b('0x29')]=function(){return this[_0xd62b('0x2a')](!![])[_0xd62b('0x2b')](function(_0x5e9f54,_0x370c42,_0x7d9afa){if(_0x5e9f54[_0xd62b('0x2c')]){_0x7d9afa();}else{return db[_0xd62b('0x2d')][_0xd62b('0x2e')]({'where':{'id':_0x5e9f54[_0xd62b('0x2f')]['id']},'attributes':['id',_0xd62b('0x30'),_0xd62b('0x31')],'raw':!![]})[_0xd62b('0x32')](function(_0x3196cf){if(_0x3196cf&&_0x3196cf['closed']){return _0x370c42['status'](_0x3196cf[_0xd62b('0x31')]===_0xd62b('0x33')?0x195:0x193)[_0xd62b('0x34')]({'message':_0x3196cf[_0xd62b('0x31')]==='unmanaged'?_0xd62b('0x35'):_0xd62b('0x36')});}else{_0x7d9afa();}})[_0xd62b('0x37')](function(_0x338433){_0x7d9afa(_0x338433);});}});};exports[_0xd62b('0x2a')]=function isAuthenticated(_0x1d9fed){return compose()['use'](function(_0xdc6300,_0x439e3b,_0xb3b427){var _0xec6f47;if(_0xdc6300[_0xd62b('0x38')][_0xd62b('0x39')]){if(_[_0xd62b('0x3a')](_0xdc6300[_0xd62b('0x38')][_0xd62b('0x39')],_0xd62b('0x3b'))){var _0x1e500e=basicAuth(_0xdc6300);db['User'][_0xd62b('0x3c')]({'where':{'name':_0x1e500e[_0xd62b('0xe')]}})[_0xd62b('0x32')](function(_0xe38660){if(!_0xe38660||!_0xe38660[_0xd62b('0x3d')](_0x1e500e[_0xd62b('0x3e')])){return _0x439e3b['status'](0x191)[_0xd62b('0x34')]({'message':_0xd62b('0x3f')});}_0xdc6300[_0xd62b('0x2c')]={'id':_0xe38660['id']};_0xb3b427();})['catch'](function(_0x103bad){_0xb3b427(_0x103bad);});}else if(_[_0xd62b('0x3a')](_0xdc6300[_0xd62b('0x38')][_0xd62b('0x39')],_0xd62b('0x40'))){validateJwt(_0xdc6300,_0x439e3b,_0xb3b427);}else{if(_0x1d9fed){_0xb3b427();}else{return _0x439e3b[_0xd62b('0x41')](0x193)[_0xd62b('0x34')]({'message':_0xd62b('0x42')});}}}else if(_0xdc6300[_0xd62b('0x43')][_0xd62b('0x44')]){try{var _0x59ac55={'audience':hardwareConf[_0xd62b('0x45')](),'issuer':hardwareConf[_0xd62b('0x45')]()};verifyJwt(_0xdc6300[_0xd62b('0x43')][_0xd62b('0x44')],_0x59ac55)[_0xd62b('0x32')](function(_0x4b3684){return db[_0xd62b('0x46')][_0xd62b('0x3c')]({'where':{'id':_0x4b3684[_0xd62b('0x47')]}})['then'](function(_0x29c5f3){_0xec6f47=_0x29c5f3;return db[_0xd62b('0x48')][_0xd62b('0x2e')]({'where':{'id':0x1},'attributes':[_0xd62b('0x49'),_0xd62b('0x4a')],'raw':!![]});})['then'](function(_0x38d4b6){if(!_0xec6f47||!_[_0xd62b('0x4b')](_0xec6f47[_0xd62b('0x4c')],_0x4b3684[_0xd62b('0x4d')])){return _0x439e3b[_0xd62b('0x41')](0x191)[_0xd62b('0x34')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0xec6f47[_0xd62b('0x4e')]){return _0x439e3b[_0xd62b('0x41')](0x191)[_0xd62b('0x34')]({'message':_0xd62b('0x4f')});}if(_0xec6f47[_0xd62b('0x50')]){if(_0x38d4b6[_0xd62b('0x4a')]>0x0){if(moment(_0xec6f47[_0xd62b('0x51')])[_0xd62b('0x52')](_0x38d4b6[_0xd62b('0x4a')],'minutes')>moment()){return _0x439e3b[_0xd62b('0x41')](0x191)[_0xd62b('0x34')]({'message':_0xd62b('0x4f')});}}else{return _0x439e3b[_0xd62b('0x41')](0x191)[_0xd62b('0x34')]({'message':_0xd62b('0x4f')});}}_0xdc6300[_0xd62b('0x2c')]={'id':_0xec6f47['id']};_0xb3b427();});})['catch'](function(){return _0x439e3b['status'](0x191)[_0xd62b('0x34')]({'message':_0xd62b('0x4f')});});}catch(_0x105a8b){_0xb3b427(_0x105a8b);}}else if(_0x1d9fed){_0xb3b427();}else{return _0x439e3b[_0xd62b('0x41')](0x193)[_0xd62b('0x34')]({'message':_0xd62b('0x42')});}})['use'](function(_0x32b251,_0x3cc17f,_0x5ef219){if(_0x32b251[_0xd62b('0x2c')]){db[_0xd62b('0x46')][_0xd62b('0x3c')]({'where':{'id':_0x32b251[_0xd62b('0x2c')]['id']},'attributes':userAttributes})[_0xd62b('0x32')](function(_0x3296f5){if(!_0x3296f5){return _0x3cc17f['status'](0x194)[_0xd62b('0x34')]({'message':_0xd62b('0x53')});}_0x32b251[_0xd62b('0x2c')]=_0x3296f5;_0x5ef219();})[_0xd62b('0x37')](function(_0x12b934){_0x5ef219(_0x12b934);});}else if(_0x1d9fed){_0x5ef219();}else{return _0x3cc17f['status'](0x194)['json']({'message':_0xd62b('0x54')});}});};exports[_0xd62b('0x55')]=function canUpdate(){return compose()[_0xd62b('0x2b')](function(_0x542db9,_0x5db589,_0x17ca26){return licenseUtil['getLicense']()[_0xd62b('0x32')](function(_0x5361a9){if(_0x5361a9[_0xd62b('0x56')]){_0x17ca26();}else{return _0x5db589[_0xd62b('0x41')](0x193)[_0xd62b('0x34')]({'message':_0xd62b('0x57')});}})['catch'](function(_0x496e9b){_0x17ca26(_0x496e9b);});});};exports[_0xd62b('0x58')]=function(_0x2a7262,_0x155c68,_0x5e0a73){_0x2a7262[_0xd62b('0x58')]=!![];return _0x5e0a73();};exports[_0xd62b('0x59')]=function signToken(_0x32c495){return signJwt(_0x32c495);};exports[_0xd62b('0x5a')]=function(_0x24e627,_0x3d811e){if(!_0x24e627[_0xd62b('0x2c')]){return _0x3d811e[_0xd62b('0x41')](0x194)['json']({'message':_0xd62b('0x5b')});}var _0x20e510={'payload':{'id':_0x24e627[_0xd62b('0x2c')]['id'],'role':_0x24e627[_0xd62b('0x2c')][_0xd62b('0x5c')]},'options':{'expiresIn':0x15180}};return signJwt(_0x20e510)['then'](function(_0x41e440){_0x3d811e[_0xd62b('0x5d')]('motion.token',_0x41e440);_0x3d811e['redirect'](_0xd62b('0x5e'));})[_0xd62b('0x37')](function(_0x203529){return _0x3d811e[_0xd62b('0x41')](0x1f4)[_0xd62b('0x5f')](_0x203529);});};exports[_0xd62b('0x60')]=function(_0x4e5da6){if(_[_0xd62b('0x61')](_0x4e5da6[_0xd62b('0x4c')])||_[_0xd62b('0x61')](_0x4e5da6[_0xd62b('0x62')])){return null;}else{return createJwt(_0x4e5da6);}};exports[_0xd62b('0x63')]=function(_0x5dff1e){_0x5dff1e[_0xd62b('0x4c')]=generateNonce();_0x5dff1e[_0xd62b('0x62')]=generateIssuedAt();return createJwt(_0x5dff1e);};exports['regenerateApiKey']=function(_0x361a93,_0x456671){var _0x2d9ba2=_0x361a93[_0xd62b('0x43')][_0xd62b('0x44')];if(_0x2d9ba2){var _0x9b1362={'nonce':_0x456671[_0xd62b('0x4c')],'iat':_0x456671[_0xd62b('0x62')],'audience':hardwareConf[_0xd62b('0x45')](),'issuer':hardwareConf[_0xd62b('0x45')]()};return verifyJwt(_0x2d9ba2,_0x9b1362)['then'](function(){return generateApiKey(_0x456671);});}else{throw{'message':_0xd62b('0x64')};}};exports[_0xd62b('0x65')]=function(_0x2e03a8){var _0x3e7e50=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3e7e50[_0xd62b('0x66')](_0x2e03a8))throw new db[(_0xd62b('0x67'))][(_0xd62b('0x68'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xd62b('0x69')]=function(_0x52c00c,_0x5d3324,_0x3b3975){var _0x3b542c=encryptor[_0xd62b('0x6a')](_0x5d3324)['split'](',');for(var _0x51fc5b=0x0;_0x51fc5b<_0x3b3975;_0x51fc5b++){if(!_0x3b542c[_0x51fc5b])break;if(_0x52c00c[_0xd62b('0x6b')]()===_0x3b542c[_0x51fc5b][_0xd62b('0x6b')]()){var _0x51ebd8=util[_0xd62b('0x6c')](_0xd62b('0x6d'),_0x3b3975);if(_0x3b3975===0x1){_0x51ebd8=_0xd62b('0x6e');}throw new db['Sequelize'][(_0xd62b('0x68'))](_0x51ebd8);}}return;};exports[_0xd62b('0x6f')]=function(_0x395948,_0x581d53){var _0x1941a7=_0x581d53?encryptor[_0xd62b('0x6a')](_0x581d53)[_0xd62b('0x70')](','):[];if(_0x1941a7[_0xd62b('0x71')]===0x5){_0x1941a7['splice'](-0x1,0x1);}_0x1941a7[_0xd62b('0x72')](_0x395948);return encryptor[_0xd62b('0x73')](_0x1941a7[_0xd62b('0x74')](','));};function signJwt(_0x5541e8){var _0x24f1a6=BPromise[_0xd62b('0x75')](jwt[_0xd62b('0x76')],{'context':jwt});var _0x3abcbb=_0x5541e8['secret']||config[_0xd62b('0xb')]['session'];return new BPromise(function(_0x733b8c,_0x173d28){_0x24f1a6(_0x5541e8[_0xd62b('0x77')],_0x3abcbb,_0x5541e8['options'])[_0xd62b('0x32')](function(_0x44363e){_0x733b8c(_0x44363e);})[_0xd62b('0x37')](function(_0x523f74){_0x173d28(_0x523f74);});});}function verifyJwt(_0x4efd9c,_0x35571f,_0x586231){var _0x594113=BPromise[_0xd62b('0x75')](jwt[_0xd62b('0x78')],{'context':jwt});var _0x30ab39=_0x586231||config['secrets'][_0xd62b('0xc')];return new BPromise(function(_0x2d86d8,_0x403eeb){_0x594113(_0x4efd9c,_0x30ab39,_0x35571f)[_0xd62b('0x32')](function(_0x3d6c84){_0x2d86d8(_0x3d6c84);})[_0xd62b('0x37')](function(_0x31621d){_0x403eeb(_0x31621d);});});}function generateNonce(){return crypto[_0xd62b('0x79')](0x10)[_0xd62b('0x7a')](_0xd62b('0x7b'));}function generateIssuedAt(){return Math[_0xd62b('0x7c')](Date['now']()/0x3e8)[_0xd62b('0x7a')]();}function createJwt(_0x1506ed){var _0x220478={'payload':{'iat':_0x1506ed[_0xd62b('0x62')],'nonce':_0x1506ed[_0xd62b('0x4c')]},'options':{'algorithm':_0xd62b('0x7d'),'subject':_0x1506ed['id']['toString'](),'issuer':hardwareConf[_0xd62b('0x45')](),'audience':hardwareConf[_0xd62b('0x45')]()}};return signJwt(_0x220478)[_0xd62b('0x32')](function(_0x1b5b16){return{'iat':_0x1506ed[_0xd62b('0x62')],'nonce':_0x1506ed[_0xd62b('0x4c')],'token':_0x1b5b16};});} \ No newline at end of file +var _0xc539=['phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','isAuthenticated','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','getUuid','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','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','secrets','options','verify','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','crypto','bluebird','util','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay'];(function(_0x453342,_0x4a8d76){var _0x397416=function(_0xf56776){while(--_0xf56776){_0x453342['push'](_0x453342['shift']());}};_0x397416(++_0x4a8d76);}(_0xc539,0xe8));var _0x9c53=function(_0x33beb4,_0xc125cb){_0x33beb4=_0x33beb4-0x0;var _0x4da4f2=_0xc539[_0x33beb4];return _0x4da4f2;};'use strict';var db=require(_0x9c53('0x0'))['db'];var config=require(_0x9c53('0x1'));var hardwareConf=require(_0x9c53('0x2'));var licenseUtil=require(_0x9c53('0x3'));var encryptor=require(_0x9c53('0x4'));var _=require(_0x9c53('0x5'));var jwt=require(_0x9c53('0x6'));var expressJwt=require('express-jwt');var compose=require(_0x9c53('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9c53('0x8'));var BPromise=require(_0x9c53('0x9'));var util=require(_0x9c53('0xa'));var moment=require(_0x9c53('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9c53('0xc')]});var userAttributes=['id',_0x9c53('0xd'),_0x9c53('0xe'),_0x9c53('0xf'),_0x9c53('0x10'),_0x9c53('0x11'),_0x9c53('0x12'),_0x9c53('0x13'),_0x9c53('0x14'),'voicePause',_0x9c53('0x15'),'mailPause',_0x9c53('0x16'),'smsPause',_0x9c53('0x17'),_0x9c53('0x18'),'showWebBar',_0x9c53('0x19'),_0x9c53('0x1a'),_0x9c53('0x1b'),_0x9c53('0x1c'),_0x9c53('0x1d'),'alias',_0x9c53('0x1e'),_0x9c53('0x1f'),_0x9c53('0x20'),_0x9c53('0x21'),'phoneBarEnableDtmfTone',_0x9c53('0x22'),'phoneBarExpires',_0x9c53('0x23'),_0x9c53('0x24'),_0x9c53('0x25'),'hotdesk',_0x9c53('0x26'),_0x9c53('0x27'),_0x9c53('0x28'),_0x9c53('0x29'),'wssPort','downloadVoiceRecordings',_0x9c53('0x2a'),_0x9c53('0x2b'),_0x9c53('0x2c'),_0x9c53('0x2d')];exports[_0x9c53('0x2e')]=function(){return this['isAuthenticated'](!![])[_0x9c53('0x2f')](function(_0x413095,_0x347be5,_0x2adff2){if(_0x413095[_0x9c53('0x30')]){_0x2adff2();}else{return db[_0x9c53('0x31')][_0x9c53('0x32')]({'where':{'id':_0x413095[_0x9c53('0x33')]['id']},'attributes':['id',_0x9c53('0x34'),_0x9c53('0x35')],'raw':!![]})[_0x9c53('0x36')](function(_0x12173e){if(_0x12173e&&_0x12173e['closed']){return _0x347be5[_0x9c53('0x37')](_0x12173e[_0x9c53('0x35')]===_0x9c53('0x38')?0x195:0x193)[_0x9c53('0x39')]({'message':_0x12173e['disposition']==='unmanaged'?_0x9c53('0x3a'):_0x9c53('0x3b')});}else{_0x2adff2();}})['catch'](function(_0xd78b0){_0x2adff2(_0xd78b0);});}});};exports[_0x9c53('0x3c')]=function isAuthenticated(_0x5ac47a){return compose()[_0x9c53('0x2f')](function(_0x320691,_0x102039,_0xbb4a6d){var _0x33753d;if(_0x320691[_0x9c53('0x3d')][_0x9c53('0x3e')]){if(_[_0x9c53('0x3f')](_0x320691[_0x9c53('0x3d')][_0x9c53('0x3e')],_0x9c53('0x40'))){var _0x104170=basicAuth(_0x320691);db[_0x9c53('0x41')][_0x9c53('0x42')]({'where':{'name':_0x104170[_0x9c53('0xf')]}})[_0x9c53('0x36')](function(_0xcaf9fc){if(!_0xcaf9fc||!_0xcaf9fc[_0x9c53('0x43')](_0x104170[_0x9c53('0x44')])){return _0x102039[_0x9c53('0x37')](0x191)[_0x9c53('0x39')]({'message':_0x9c53('0x45')});}_0x320691[_0x9c53('0x30')]={'id':_0xcaf9fc['id']};_0xbb4a6d();})[_0x9c53('0x46')](function(_0x5f4d0b){_0xbb4a6d(_0x5f4d0b);});}else if(_[_0x9c53('0x3f')](_0x320691[_0x9c53('0x3d')][_0x9c53('0x3e')],'Bearer')){validateJwt(_0x320691,_0x102039,_0xbb4a6d);}else{if(_0x5ac47a){_0xbb4a6d();}else{return _0x102039['status'](0x193)['json']({'message':_0x9c53('0x47')});}}}else if(_0x320691[_0x9c53('0x48')][_0x9c53('0x49')]){try{var _0x3cc0ea={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x320691[_0x9c53('0x48')][_0x9c53('0x49')],_0x3cc0ea)[_0x9c53('0x36')](function(_0x3a50da){return db['User']['find']({'where':{'id':_0x3a50da[_0x9c53('0x4a')]}})[_0x9c53('0x36')](function(_0x25b3a4){_0x33753d=_0x25b3a4;return db[_0x9c53('0x4b')]['findOne']({'where':{'id':0x1},'attributes':[_0x9c53('0x4c'),_0x9c53('0x4d')],'raw':!![]});})['then'](function(_0x85c357){if(!_0x33753d||!_['isEqual'](_0x33753d[_0x9c53('0x4e')],_0x3a50da[_0x9c53('0x4f')])){return _0x102039[_0x9c53('0x37')](0x191)[_0x9c53('0x39')]({'message':_0x9c53('0x50')});}if(_0x33753d[_0x9c53('0x51')]){return _0x102039['status'](0x191)['json']({'message':_0x9c53('0x52')});}if(_0x33753d[_0x9c53('0x53')]){if(_0x85c357[_0x9c53('0x4d')]>0x0){if(moment(_0x33753d[_0x9c53('0x54')])[_0x9c53('0x55')](_0x85c357[_0x9c53('0x4d')],_0x9c53('0x56'))>moment()){return _0x102039['status'](0x191)[_0x9c53('0x39')]({'message':_0x9c53('0x52')});}}else{return _0x102039['status'](0x191)[_0x9c53('0x39')]({'message':_0x9c53('0x52')});}}_0x320691['user']={'id':_0x33753d['id']};_0xbb4a6d();});})[_0x9c53('0x46')](function(){return _0x102039[_0x9c53('0x37')](0x191)[_0x9c53('0x39')]({'message':_0x9c53('0x52')});});}catch(_0x30b507){_0xbb4a6d(_0x30b507);}}else if(_0x5ac47a){_0xbb4a6d();}else{return _0x102039['status'](0x193)[_0x9c53('0x39')]({'message':_0x9c53('0x47')});}})['use'](function(_0x485159,_0x5b12bd,_0x208588){if(_0x485159[_0x9c53('0x30')]){db[_0x9c53('0x41')][_0x9c53('0x42')]({'where':{'id':_0x485159[_0x9c53('0x30')]['id']},'attributes':userAttributes})[_0x9c53('0x36')](function(_0x28c223){if(!_0x28c223){return _0x5b12bd['status'](0x194)[_0x9c53('0x39')]({'message':_0x9c53('0x57')});}_0x485159[_0x9c53('0x30')]=_0x28c223;_0x208588();})[_0x9c53('0x46')](function(_0x33015d){_0x208588(_0x33015d);});}else if(_0x5ac47a){_0x208588();}else{return _0x5b12bd[_0x9c53('0x37')](0x194)[_0x9c53('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x9c53('0x2f')](function(_0x38c886,_0x3482bb,_0x3b378c){return licenseUtil[_0x9c53('0x58')]()[_0x9c53('0x36')](function(_0x4a6572){if(_0x4a6572[_0x9c53('0x59')]){_0x3b378c();}else{return _0x3482bb[_0x9c53('0x37')](0x193)[_0x9c53('0x39')]({'message':_0x9c53('0x5a')});}})[_0x9c53('0x46')](function(_0xd75146){_0x3b378c(_0xd75146);});});};exports[_0x9c53('0x5b')]=function(_0x5f2368,_0x48c397,_0x57e791){_0x5f2368[_0x9c53('0x5b')]=!![];return _0x57e791();};exports[_0x9c53('0x5c')]=function signToken(_0x4c1537){return signJwt(_0x4c1537);};exports[_0x9c53('0x5d')]=function(_0x40a76f,_0x151fd4){if(!_0x40a76f[_0x9c53('0x30')]){return _0x151fd4[_0x9c53('0x37')](0x194)[_0x9c53('0x39')]({'message':_0x9c53('0x5e')});}var _0x501900={'payload':{'id':_0x40a76f[_0x9c53('0x30')]['id'],'role':_0x40a76f[_0x9c53('0x30')][_0x9c53('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x501900)[_0x9c53('0x36')](function(_0x46a25f){_0x151fd4[_0x9c53('0x5f')](_0x9c53('0x60'),_0x46a25f);_0x151fd4[_0x9c53('0x61')](_0x9c53('0x62'));})[_0x9c53('0x46')](function(_0x289a15){return _0x151fd4[_0x9c53('0x37')](0x1f4)[_0x9c53('0x63')](_0x289a15);});};exports[_0x9c53('0x64')]=function(_0x11e54b){if(_['isNil'](_0x11e54b['apiKeyNonce'])||_[_0x9c53('0x65')](_0x11e54b['apiKeyIat'])){return null;}else{return createJwt(_0x11e54b);}};exports[_0x9c53('0x66')]=function(_0x5a87c6){_0x5a87c6['apiKeyNonce']=generateNonce();_0x5a87c6[_0x9c53('0x67')]=generateIssuedAt();return createJwt(_0x5a87c6);};exports[_0x9c53('0x68')]=function(_0x2f6c99,_0x1ffa57){var _0x4a5b6c=_0x2f6c99['query'][_0x9c53('0x49')];if(_0x4a5b6c){var _0x100809={'nonce':_0x1ffa57[_0x9c53('0x4e')],'iat':_0x1ffa57['apiKeyIat'],'audience':hardwareConf[_0x9c53('0x69')](),'issuer':hardwareConf[_0x9c53('0x69')]()};return verifyJwt(_0x4a5b6c,_0x100809)[_0x9c53('0x36')](function(){return generateApiKey(_0x1ffa57);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x9c53('0x6a')]=function(_0x5ce123){var _0x5404a9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5404a9[_0x9c53('0x6b')](_0x5ce123))throw new db[(_0x9c53('0x6c'))][(_0x9c53('0x6d'))](_0x9c53('0x6e'));return;};exports[_0x9c53('0x6f')]=function(_0x10af16,_0x4c92a9,_0x1ceb6a){var _0x3eeafc=encryptor['decryptString'](_0x4c92a9)[_0x9c53('0x70')](',');for(var _0x31cf0e=0x0;_0x31cf0e<_0x1ceb6a;_0x31cf0e++){if(!_0x3eeafc[_0x31cf0e])break;if(_0x10af16[_0x9c53('0x71')]()===_0x3eeafc[_0x31cf0e][_0x9c53('0x71')]()){var _0x1a04c4=util[_0x9c53('0x72')](_0x9c53('0x73'),_0x1ceb6a);if(_0x1ceb6a===0x1){_0x1a04c4=_0x9c53('0x74');}throw new db[(_0x9c53('0x6c'))]['ValidationError'](_0x1a04c4);}}return;};exports[_0x9c53('0x75')]=function(_0x4b1722,_0x321f13){var _0xe32191=_0x321f13?encryptor['decryptString'](_0x321f13)[_0x9c53('0x70')](','):[];if(_0xe32191[_0x9c53('0x76')]===0x5){_0xe32191[_0x9c53('0x77')](-0x1,0x1);}_0xe32191[_0x9c53('0x78')](_0x4b1722);return encryptor[_0x9c53('0x79')](_0xe32191[_0x9c53('0x7a')](','));};function signJwt(_0xc9d8d0){var _0x1fd623=BPromise[_0x9c53('0x7b')](jwt['sign'],{'context':jwt});var _0x30f4c6=_0xc9d8d0['secret']||config[_0x9c53('0x7c')]['session'];return new BPromise(function(_0x30d3b8,_0x292452){_0x1fd623(_0xc9d8d0['payload'],_0x30f4c6,_0xc9d8d0[_0x9c53('0x7d')])[_0x9c53('0x36')](function(_0x3def81){_0x30d3b8(_0x3def81);})[_0x9c53('0x46')](function(_0x3dc05b){_0x292452(_0x3dc05b);});});}function verifyJwt(_0x861c43,_0x5de42a,_0x19dda9){var _0x3e7175=BPromise[_0x9c53('0x7b')](jwt[_0x9c53('0x7e')],{'context':jwt});var _0x1b1ddc=_0x19dda9||config[_0x9c53('0x7c')][_0x9c53('0xc')];return new BPromise(function(_0x208748,_0x5d4003){_0x3e7175(_0x861c43,_0x1b1ddc,_0x5de42a)['then'](function(_0x4a30f0){_0x208748(_0x4a30f0);})[_0x9c53('0x46')](function(_0x5ca940){_0x5d4003(_0x5ca940);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9c53('0x7f'));}function generateIssuedAt(){return Math[_0x9c53('0x80')](Date[_0x9c53('0x81')]()/0x3e8)[_0x9c53('0x82')]();}function createJwt(_0x1a0b72){var _0xfda790={'payload':{'iat':_0x1a0b72[_0x9c53('0x67')],'nonce':_0x1a0b72[_0x9c53('0x4e')]},'options':{'algorithm':_0x9c53('0x83'),'subject':_0x1a0b72['id']['toString'](),'issuer':hardwareConf[_0x9c53('0x69')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0xfda790)['then'](function(_0x21df4f){return{'iat':_0x1a0b72[_0x9c53('0x67')],'nonce':_0x1a0b72['apiKeyNonce'],'token':_0x21df4f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 4653ad0..22d3d99 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 _0xd932=['base64','decryptString','crypto','bluebird','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','decryptFile','createDecipher','close','secret','utf8'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0xd932,0x8a));var _0x2d93=function(_0xfcf856,_0x47b5e0){_0xfcf856=_0xfcf856-0x0;var _0x1b2e7b=_0xd932[_0xfcf856];return _0x1b2e7b;};'use strict';var crypto=require(_0x2d93('0x0'));var fs=require('fs');var BPromise=require(_0x2d93('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x2d93('0x2'))(_0x2d93('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2d93('0x4')][_0x2d93('0x5')],'algorithm':_0x2d93('0x6')};const fileOptions={'algorithm':_0x2d93('0x7')};if(config['encrypt']&&config[_0x2d93('0x8')][_0x2d93('0x9')]){var isSupported=isAlgorithmSupported(config[_0x2d93('0x8')][_0x2d93('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x2d93('0x8')][_0x2d93('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2d93('0xa')](',\x20');logger[_0x2d93('0xb')](config[_0x2d93('0x8')]['algorithm'],_0x2d93('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x38ca36){return AES_SUPPORTED_RX[_0x2d93('0xd')](_0x38ca36);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x2d93('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x57e081){return getSupportedCiphers()[_0x2d93('0xf')](_0x57e081)>-0x1;}function combineOptions(_0x1754a5){var _0x36ecb9={};for(var _0x11c8e1 in fileOptions){if(fileOptions['hasOwnProperty'](_0x11c8e1)){_0x36ecb9[_0x11c8e1]=fileOptions[_0x11c8e1];}}if(_0x1754a5){for(var _0x14833e in _0x1754a5){if(_0x1754a5['hasOwnProperty'](_0x14833e)){_0x36ecb9[_0x14833e]=_0x1754a5[_0x14833e];}}}return _0x36ecb9;}exports[_0x2d93('0x10')]=function(_0x4a7780,_0x205a8e,_0x5bd572,_0x56f1e5){return new BPromise(function(_0x515a81,_0x231129){_0x56f1e5=combineOptions(_0x56f1e5);var _0x5660eb=new Buffer(_0x5bd572);var _0x307308=fs[_0x2d93('0x11')](_0x4a7780);var _0x229c86=fs[_0x2d93('0x12')](_0x205a8e);var _0x15d114=crypto[_0x2d93('0x13')](_0x56f1e5[_0x2d93('0x9')],_0x5660eb);_0x307308['on'](_0x2d93('0x14'),function(_0xab0247){var _0x1381e1=new Buffer(_0x15d114[_0x2d93('0x15')](_0xab0247),_0x2d93('0x16'));_0x229c86[_0x2d93('0x17')](_0x1381e1);});_0x307308['on'](_0x2d93('0x18'),function(){try{var _0x4bafcd=new Buffer(_0x15d114[_0x2d93('0x19')](_0x2d93('0x16')),_0x2d93('0x16'));_0x229c86[_0x2d93('0x17')](_0x4bafcd);_0x229c86[_0x2d93('0x18')]();_0x229c86['on']('close',function(){return _0x515a81(_0x205a8e);});}catch(_0x100b76){fs[_0x2d93('0x1a')](_0x205a8e);return _0x231129(_0x100b76);}});});};exports[_0x2d93('0x1b')]=function(_0x1094d9,_0x1b6843,_0x5282da,_0x392997){return new BPromise(function(_0x14ea5f,_0x14ee8c){_0x392997=combineOptions(_0x392997);var _0x179b59=new Buffer(_0x5282da);var _0x3e9e0b=fs[_0x2d93('0x11')](_0x1094d9);var _0x318deb=fs[_0x2d93('0x12')](_0x1b6843);var _0x2067c8=crypto[_0x2d93('0x1c')](_0x392997['algorithm'],_0x179b59);_0x3e9e0b['on'](_0x2d93('0x14'),function(_0x21e935){var _0x74c46b=new Buffer(_0x2067c8['update'](_0x21e935),_0x2d93('0x16'));_0x318deb[_0x2d93('0x17')](_0x74c46b);});_0x3e9e0b['on'](_0x2d93('0x18'),function(){try{var _0x2432e1=new Buffer(_0x2067c8[_0x2d93('0x19')](_0x2d93('0x16')),_0x2d93('0x16'));_0x318deb['write'](_0x2432e1);_0x318deb['end']();_0x318deb['on'](_0x2d93('0x1d'),function(){return _0x14ea5f(_0x1b6843);});}catch(_0x1e4ed6){fs[_0x2d93('0x1a')](_0x1b6843);return _0x14ee8c(_0x1e4ed6);}});});};exports['encryptString']=function(_0x351f2c,_0x2f5068,_0x4bf975){var _0x2cd2a8=_0x4bf975||stringOptions[_0x2d93('0x9')];var _0x33f48c=_0x2f5068||stringOptions[_0x2d93('0x1e')];var _0x47afc5=crypto['createCipher'](_0x2cd2a8,_0x33f48c);var _0x19547f=_0x47afc5[_0x2d93('0x15')](_0x351f2c,_0x2d93('0x1f'),_0x2d93('0x20'));_0x19547f+=_0x47afc5[_0x2d93('0x19')]('base64');return _0x19547f;};exports[_0x2d93('0x21')]=function(_0x52285d,_0x1b8e17,_0x628b50){var _0x1ed309=_0x628b50||stringOptions[_0x2d93('0x9')];var _0x1c82a2=_0x1b8e17||stringOptions[_0x2d93('0x1e')];var _0xece5cd=crypto[_0x2d93('0x1c')](_0x1ed309,_0x1c82a2);var _0x46f51a=_0xece5cd['update'](_0x52285d,_0x2d93('0x20'),_0x2d93('0x1f'));_0x46f51a+=_0xece5cd[_0x2d93('0x19')](_0x2d93('0x1f'));return _0x46f51a;}; \ No newline at end of file +var _0xcf47=['createReadStream','data','binary','write','end','decryptFile','createWriteStream','update','close','unlink','createCipher','utf8','base64','decryptString','secret','final','crypto','lodash','../../config/environment','../../config/logger','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x56ee72,_0x4e5ebe){var _0x541cb9=function(_0x3006c8){while(--_0x3006c8){_0x56ee72['push'](_0x56ee72['shift']());}};_0x541cb9(++_0x4e5ebe);}(_0xcf47,0x190));var _0x7cf4=function(_0x209581,_0x11f596){_0x209581=_0x209581-0x0;var _0x2fed45=_0xcf47[_0x209581];return _0x2fed45;};'use strict';var crypto=require(_0x7cf4('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x7cf4('0x1'));var config=require(_0x7cf4('0x2'));var logger=require(_0x7cf4('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x7cf4('0x4')};const fileOptions={'algorithm':_0x7cf4('0x5')};if(config[_0x7cf4('0x6')]&&config['encrypt'][_0x7cf4('0x7')]){var isSupported=isAlgorithmSupported(config[_0x7cf4('0x6')][_0x7cf4('0x7')]);if(isSupported){fileOptions[_0x7cf4('0x7')]=config[_0x7cf4('0x6')][_0x7cf4('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7cf4('0x8')](',\x20');logger[_0x7cf4('0x9')](config[_0x7cf4('0x6')][_0x7cf4('0x7')],_0x7cf4('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x5c8952){return AES_SUPPORTED_RX[_0x7cf4('0xb')](_0x5c8952);}function getSupportedCiphers(){return crypto[_0x7cf4('0xc')]()[_0x7cf4('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x318996){return getSupportedCiphers()[_0x7cf4('0xe')](_0x318996)>-0x1;}function combineOptions(_0x4759cf){var _0x17b257={};for(var _0x5e7836 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5e7836)){_0x17b257[_0x5e7836]=fileOptions[_0x5e7836];}}if(_0x4759cf){for(var _0x275af4 in _0x4759cf){if(_0x4759cf[_0x7cf4('0xf')](_0x275af4)){_0x17b257[_0x275af4]=_0x4759cf[_0x275af4];}}}return _0x17b257;}exports['encryptFile']=function(_0x650056,_0x1c3c97,_0x87bd16,_0x438ef8){return new BPromise(function(_0x46f72f,_0x314b59){_0x438ef8=combineOptions(_0x438ef8);var _0x2861e9=new Buffer(_0x87bd16);var _0x26dd9f=fs[_0x7cf4('0x10')](_0x650056);var _0x18a4e9=fs['createWriteStream'](_0x1c3c97);var _0x4e9981=crypto['createCipher'](_0x438ef8[_0x7cf4('0x7')],_0x2861e9);_0x26dd9f['on'](_0x7cf4('0x11'),function(_0xcee185){var _0x363d4a=new Buffer(_0x4e9981['update'](_0xcee185),_0x7cf4('0x12'));_0x18a4e9[_0x7cf4('0x13')](_0x363d4a);});_0x26dd9f['on'](_0x7cf4('0x14'),function(){try{var _0x30701a=new Buffer(_0x4e9981['final'](_0x7cf4('0x12')),_0x7cf4('0x12'));_0x18a4e9[_0x7cf4('0x13')](_0x30701a);_0x18a4e9[_0x7cf4('0x14')]();_0x18a4e9['on']('close',function(){return _0x46f72f(_0x1c3c97);});}catch(_0x556a0d){fs['unlink'](_0x1c3c97);return _0x314b59(_0x556a0d);}});});};exports[_0x7cf4('0x15')]=function(_0x2fee92,_0x38b27d,_0x5f0fe1,_0x44e384){return new BPromise(function(_0x5eb8f7,_0x4f29f5){_0x44e384=combineOptions(_0x44e384);var _0x18a6d3=new Buffer(_0x5f0fe1);var _0x4013b9=fs[_0x7cf4('0x10')](_0x2fee92);var _0x4e2c59=fs[_0x7cf4('0x16')](_0x38b27d);var _0x5d0b3a=crypto['createDecipher'](_0x44e384[_0x7cf4('0x7')],_0x18a6d3);_0x4013b9['on'](_0x7cf4('0x11'),function(_0x15f9bd){var _0x1ef4b7=new Buffer(_0x5d0b3a[_0x7cf4('0x17')](_0x15f9bd),_0x7cf4('0x12'));_0x4e2c59[_0x7cf4('0x13')](_0x1ef4b7);});_0x4013b9['on'](_0x7cf4('0x14'),function(){try{var _0x48df8e=new Buffer(_0x5d0b3a['final'](_0x7cf4('0x12')),_0x7cf4('0x12'));_0x4e2c59['write'](_0x48df8e);_0x4e2c59[_0x7cf4('0x14')]();_0x4e2c59['on'](_0x7cf4('0x18'),function(){return _0x5eb8f7(_0x38b27d);});}catch(_0x1dd88b){fs[_0x7cf4('0x19')](_0x38b27d);return _0x4f29f5(_0x1dd88b);}});});};exports['encryptString']=function(_0x2be2b8,_0x3e3dd0,_0x26e758){var _0x3693a9=_0x26e758||stringOptions[_0x7cf4('0x7')];var _0x53c1e0=_0x3e3dd0||stringOptions['secret'];var _0x146004=crypto[_0x7cf4('0x1a')](_0x3693a9,_0x53c1e0);var _0x239cef=_0x146004[_0x7cf4('0x17')](_0x2be2b8,_0x7cf4('0x1b'),'base64');_0x239cef+=_0x146004['final'](_0x7cf4('0x1c'));return _0x239cef;};exports[_0x7cf4('0x1d')]=function(_0x595c9a,_0x506351,_0x58324f){var _0x449125=_0x58324f||stringOptions['algorithm'];var _0x3f6496=_0x506351||stringOptions[_0x7cf4('0x1e')];var _0x5ca6c0=crypto['createDecipher'](_0x449125,_0x3f6496);var _0xbe55f0=_0x5ca6c0[_0x7cf4('0x17')](_0x595c9a,_0x7cf4('0x1c'),_0x7cf4('0x1b'));_0xbe55f0+=_0x5ca6c0[_0x7cf4('0x1f')](_0x7cf4('0x1b'));return _0xbe55f0;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 7ee7740..19b1abb 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 _0x49f0=['dirname','basename','join','each','%s%d.%s','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x49f0,0x6c));var _0x049f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x49f0[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x049f('0x0'));var path=require('path');var _=require(_0x049f('0x1'));var csv=require(_0x049f('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x049f('0x3'));var db=require(_0x049f('0x4'))['db'];var dbH=require(_0x049f('0x4'))['dbH'];var logger=require('../../config/logger')(_0x049f('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x049f('0x6')][0x3];var PATH=process[_0x049f('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4777d8,_0x4b755a){var _0x186db5={'status':_0x4777d8};var _0x28f469={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b755a){_0x186db5[_0x049f('0x7')]=_0x4b755a;}return db[_0x049f('0x8')]['update'](_0x186db5,_0x28f469);}function main(){var _0x16a989=0x1388;var _0x21a0db;logger[_0x049f('0x9')](util['format'](_0x049f('0xa'),EXTRACTED_REPORT_ID,_0x049f('0xb')));return db[_0x049f('0xc')][_0x049f('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x049f('0xe'),_0x049f('0xf')]})[_0x049f('0x10')](function(_0x1981bb){if(_0x1981bb){_0x21a0db=_0x1981bb;_0x16a989=_0x21a0db[_0x049f('0xf')]||0x1388;}})[_0x049f('0x10')](function(){return dbH[_0x049f('0x11')][_0x049f('0x12')](util[_0x049f('0x13')](_0x049f('0x14'),QUERY),{'type':dbH[_0x049f('0x11')]['QueryTypes']['SELECT']});})['then'](function(_0x21d3dc){if(!_0x21d3dc[0x0][_0x049f('0x15')]){return analyticExtractedReport(_0x049f('0x16'));}var _0x4a1b66=[];var _0x1a382f=0x0;if(_0x21a0db[_0x049f('0xe')]){if(_0x21d3dc&&_0x21d3dc[_0x049f('0x17')]){var _0x442907=_[_0x049f('0x18')](_0x21d3dc[0x0][_0x049f('0x15')]/_0x16a989);var _0x3696e7=Number['isInteger'](_0x21d3dc[0x0][_0x049f('0x15')]/_0x16a989)?_0x21d3dc[0x0][_0x049f('0x15')]%_0x16a989:0x0;_0x442907[_0x049f('0x19')](function(_0x23a55f){if(_0x23a55f>0x0){_0x1a382f+=_0x16a989;}_0x4a1b66['push'](dbH[_0x049f('0x11')][_0x049f('0x12')](util[_0x049f('0x13')](_0x049f('0x1a'),QUERY,_0x16a989,_0x1a382f),{'type':dbH[_0x049f('0x11')][_0x049f('0x1b')]['SELECT']}));});if(_0x3696e7>0x0){_0x1a382f+=_0x16a989;_0x4a1b66[_0x049f('0x1c')](dbH['sequelize'][_0x049f('0x12')](util[_0x049f('0x13')](_0x049f('0x1a'),QUERY,_0x3696e7,_0x1a382f),{'type':dbH[_0x049f('0x11')][_0x049f('0x1b')][_0x049f('0x1d')]}));}}}else{_0x4a1b66[_0x049f('0x1c')](dbH['sequelize'][_0x049f('0x12')](QUERY,{'type':dbH['sequelize'][_0x049f('0x1b')][_0x049f('0x1d')]}));}var _0x2a1c53=path[_0x049f('0x1e')](PATH);var _0x266ba9=path[_0x049f('0x1f')](PATH,'.csv');var _0x3cdc86=_0x21a0db['split']&&_0x4a1b66[_0x049f('0x17')]>0x1;var _0x82d50=[];if(!fs['existsSync'](path[_0x049f('0x20')](_0x2a1c53,_0x266ba9))&&_0x3cdc86){fs['mkdirSync'](path[_0x049f('0x20')](_0x2a1c53,_0x266ba9));}return BPromise[_0x049f('0x21')](_0x4a1b66,function(_0x146ff0){_0x82d50[_0x049f('0x1c')](_0x146ff0);})[_0x049f('0x10')](function(){for(var _0xae83d8=0x0;_0xae83d8<_0x82d50[_0x049f('0x17')];_0xae83d8+=0x1){var _0x3094cd;var _0x1600ac=_0x82d50[_0xae83d8];if(_0x3cdc86){_0x3094cd=path[_0x049f('0x20')](_0x2a1c53,_0x266ba9,util['format'](_0x049f('0x22'),_0x266ba9,_0xae83d8,_0x049f('0x23')));}else{_0x3094cd=path[_0x049f('0x20')](_0x2a1c53,util['format'](_0x049f('0x24'),_0x266ba9,_0x049f('0x23')));}fs['writeFileSync'](_0x3094cd,csv(_0x1600ac));}})[_0x049f('0x10')](function(){if(_0x3cdc86){return new Promise(function(_0x587416){zipdir(path[_0x049f('0x20')](_0x2a1c53,_0x266ba9),{'saveTo':path['join'](_0x2a1c53,util['format'](_0x049f('0x24'),_0x266ba9,'zip'))},function(_0x106562,_0x52b387){rimraf(path[_0x049f('0x20')](_0x2a1c53,_0x266ba9),function(){});_0x587416(_0x049f('0x25'));});});}})[_0x049f('0x10')](function(){logger[_0x049f('0x9')](util[_0x049f('0x13')](_0x049f('0x26'),EXTRACTED_REPORT_ID,_0x049f('0xb')));return analyticExtractedReport(_0x049f('0x27'),_0x3cdc86?util[_0x049f('0x13')](_0x049f('0x24'),_0x266ba9,_0x3cdc86?'zip':_0x049f('0x23')):null);});})[_0x049f('0x28')](function(_0x2ec286){logger[_0x049f('0x9')](util[_0x049f('0x13')](_0x049f('0x29'),EXTRACTED_REPORT_ID,_0x049f('0xb')),util[_0x049f('0x2a')](_0x2ec286,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x049f('0x2b'));})[_0x049f('0x2c')](function(){process[_0x049f('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x360d=['%s.%s','csv','writeFileSync','zip','zip\x20finished','Completed','catch','inspect','finally','exit','util','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','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','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x360d,0xfa));var _0xd360=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0x360d[_0x11adbd];return _0x270029;};'use strict';var util=require(_0xd360('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0xd360('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xd360('0x2'));var rimraf=require(_0xd360('0x3'));var db=require(_0xd360('0x4'))['db'];var dbH=require(_0xd360('0x4'))[_0xd360('0x5')];var logger=require(_0xd360('0x6'))(_0xd360('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xd360('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd360('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xeb519f,_0x46c15b){var _0x542b1a={'status':_0xeb519f};var _0x4259fe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x46c15b){_0x542b1a['savename']=_0x46c15b;}return db[_0xd360('0x9')]['update'](_0x542b1a,_0x4259fe);}function main(){var _0x1d847d=0x1388;var _0x1a9344;logger[_0xd360('0xa')](util[_0xd360('0xb')](_0xd360('0xc'),EXTRACTED_REPORT_ID,_0xd360('0xd')));return db[_0xd360('0xe')][_0xd360('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd360('0x10'),'splitSizeCsv']})['then'](function(_0x135768){if(_0x135768){_0x1a9344=_0x135768;_0x1d847d=_0x1a9344[_0xd360('0x11')]||0x1388;}})[_0xd360('0x12')](function(){return dbH[_0xd360('0x13')][_0xd360('0x14')](util[_0xd360('0xb')](_0xd360('0x15'),QUERY),{'type':dbH['sequelize'][_0xd360('0x16')][_0xd360('0x17')]});})[_0xd360('0x12')](function(_0x4fe3a6){if(!_0x4fe3a6[0x0][_0xd360('0x18')]){return analyticExtractedReport(_0xd360('0x19'));}var _0x4759c9=[];var _0x387099=0x0;if(_0x1a9344[_0xd360('0x10')]){if(_0x4fe3a6&&_0x4fe3a6[_0xd360('0x1a')]){var _0x295cf8=_[_0xd360('0x1b')](_0x4fe3a6[0x0]['num']/_0x1d847d);var _0x484ac6=Number['isInteger'](_0x4fe3a6[0x0][_0xd360('0x18')]/_0x1d847d)?_0x4fe3a6[0x0][_0xd360('0x18')]%_0x1d847d:0x0;_0x295cf8[_0xd360('0x1c')](function(_0x36e86f){if(_0x36e86f>0x0){_0x387099+=_0x1d847d;}_0x4759c9[_0xd360('0x1d')](dbH[_0xd360('0x13')][_0xd360('0x14')](util[_0xd360('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1d847d,_0x387099),{'type':dbH[_0xd360('0x13')][_0xd360('0x16')][_0xd360('0x17')]}));});if(_0x484ac6>0x0){_0x387099+=_0x1d847d;_0x4759c9[_0xd360('0x1d')](dbH[_0xd360('0x13')][_0xd360('0x14')](util[_0xd360('0xb')](_0xd360('0x1e'),QUERY,_0x484ac6,_0x387099),{'type':dbH[_0xd360('0x13')]['QueryTypes'][_0xd360('0x17')]}));}}}else{_0x4759c9[_0xd360('0x1d')](dbH[_0xd360('0x13')][_0xd360('0x14')](QUERY,{'type':dbH[_0xd360('0x13')][_0xd360('0x16')]['SELECT']}));}var _0xcc1e56=path[_0xd360('0x1f')](PATH);var _0x124cfd=path[_0xd360('0x20')](PATH,'.csv');var _0x4ea6a1=_0x1a9344[_0xd360('0x10')]&&_0x4759c9[_0xd360('0x1a')]>0x1;var _0x48bd2c=[];if(!fs[_0xd360('0x21')](path[_0xd360('0x22')](_0xcc1e56,_0x124cfd))&&_0x4ea6a1){fs[_0xd360('0x23')](path[_0xd360('0x22')](_0xcc1e56,_0x124cfd));}return BPromise[_0xd360('0x24')](_0x4759c9,function(_0x447628){_0x48bd2c['push'](_0x447628);})[_0xd360('0x12')](function(){for(var _0x3f534d=0x0;_0x3f534d<_0x48bd2c[_0xd360('0x1a')];_0x3f534d+=0x1){var _0x499bc6;var _0x577df2=_0x48bd2c[_0x3f534d];if(_0x4ea6a1){_0x499bc6=path[_0xd360('0x22')](_0xcc1e56,_0x124cfd,util[_0xd360('0xb')](_0xd360('0x25'),_0x124cfd,_0x3f534d,'csv'));}else{_0x499bc6=path[_0xd360('0x22')](_0xcc1e56,util[_0xd360('0xb')](_0xd360('0x26'),_0x124cfd,_0xd360('0x27')));}fs[_0xd360('0x28')](_0x499bc6,csv(_0x577df2));}})[_0xd360('0x12')](function(){if(_0x4ea6a1){return new Promise(function(_0x3c5386){zipdir(path[_0xd360('0x22')](_0xcc1e56,_0x124cfd),{'saveTo':path['join'](_0xcc1e56,util[_0xd360('0xb')](_0xd360('0x26'),_0x124cfd,_0xd360('0x29')))},function(_0xe21d2d,_0x4aeb3e){rimraf(path[_0xd360('0x22')](_0xcc1e56,_0x124cfd),function(){});_0x3c5386(_0xd360('0x2a'));});});}})[_0xd360('0x12')](function(){logger['info'](util[_0xd360('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd360('0xd')));return analyticExtractedReport(_0xd360('0x2b'),_0x4ea6a1?util[_0xd360('0xb')](_0xd360('0x26'),_0x124cfd,_0x4ea6a1?'zip':'csv'):null);});})[_0xd360('0x2c')](function(_0x411d76){logger[_0xd360('0xa')](util[_0xd360('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd360('0xd')),util[_0xd360('0x2d')](_0x411d76,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd360('0x2e')](function(){process[_0xd360('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 38ff8a9..688a905 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 _0x095e=['/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','tableHeader','toString','value','fill','auto','push','body','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','length','header','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf'];(function(_0x443410,_0x46a247){var _0x4e1253=function(_0x5dd3e5){while(--_0x5dd3e5){_0x443410['push'](_0x443410['shift']());}};_0x4e1253(++_0x46a247);}(_0x095e,0x190));var _0xe095=function(_0x3e2959,_0x1e59ce){_0x3e2959=_0x3e2959-0x0;var _0x61af6c=_0x095e[_0x3e2959];return _0x61af6c;};'use strict';var _=require(_0xe095('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xe095('0x1'));var moment=require(_0xe095('0x2'));var htmlToPdfmake=require(_0xe095('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xe095('0x4'))[_0xe095('0x5')];var window=new JSDOM('')[_0xe095('0x6')];var BPromise=require('bluebird');var db=require(_0xe095('0x7'))['db'];var dbH=require(_0xe095('0x7'))[_0xe095('0x8')];var logger=require(_0xe095('0x9'))(_0xe095('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xe095('0xb')][0x2]);var QUERY=process[_0xe095('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xe095('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x24e8b5,_0x1f8adc){var _0x4a7c62={'status':_0x24e8b5};var _0x3e9e9d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f8adc){_0x4a7c62['savename']=_0x1f8adc;}return db[_0xe095('0xd')]['update'](_0x4a7c62,_0x3e9e9d);}function getHeaders(_0x3cf679){return _[_0xe095('0xe')](_0x3cf679,function(_0x17e908){return{'text':_0x17e908,'style':_0xe095('0xf')};});}function getRows(_0x277847,_0x5ac578){return _['map'](_0x5ac578,function(_0x185155){return _(_0x185155)['pick'](_0x277847)[_0xe095('0xe')](function(_0x5787d4){return _0x5787d4?_[_0xe095('0x10')](_0x5787d4):'';})[_0xe095('0x11')]();});}function createTable(_0xdbf8cc,_0xa670ab){var _0x382fe2={'widths':_[_0xe095('0x12')](Array(_0xdbf8cc['length']),0x91),'heights':function(_0x29ffdd){return _0x29ffdd===0x0?_0xe095('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2f5f76=getHeaders(_0xdbf8cc);_0x382fe2['body'][_0xe095('0x14')](_0x2f5f76);var _0x3aae6e=getRows(_0xdbf8cc,_0xa670ab);_0x382fe2[_0xe095('0x15')]=_0x382fe2[_0xe095('0x15')][_0xe095('0x16')](_0x3aae6e);return _0x382fe2;}function createTables(_0x31f767){var _0x4aaf92=[];var _0x17442b=_[_0xe095('0x17')](Object[_0xe095('0x18')](_0x31f767[0x0]),0x5);_0x17442b[_0xe095('0x19')](function(_0x1b9373){_0x4aaf92['push'](createTable(_0x1b9373,_0x31f767));});return _0x4aaf92;}function getPDFDocDefinition(_0x5c86ca){var _0x377e2c=util['format'](_0xe095('0x1a'),NAME,EXTRACTED_REPORT[_0xe095('0x1b')],moment(EXTRACTED_REPORT[_0xe095('0x1c')])[_0xe095('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xe095('0x1e')])[_0xe095('0x1d')](FORMAT));var _0x56eacd=[];for(var _0x528adc=0x0;_0x528adc<_0x5c86ca[_0xe095('0x1f')];_0x528adc++){var _0x492e30=[];if(_0x528adc===0x0){_0x492e30[_0xe095('0x14')]({'text':_0x377e2c,'style':_0xe095('0x20')});}var _0x560e61={'table':_0x5c86ca[_0x528adc]};if(_0x528adc>0x0){_0x560e61['pageBreak']=_0xe095('0x21');_0x560e61[_0xe095('0x22')]=[0x0,0x46,0x0,0x0];}_0x492e30[_0xe095('0x14')](_0x560e61);_0x56eacd[_0xe095('0x14')](_0x492e30);}return{'pageSize':'A4','pageOrientation':_0xe095('0x23'),'content':_0x56eacd,'footer':function(_0x44f0a7,_0x226732){return{'text':_0x44f0a7[_0xe095('0x10')]()+_0xe095('0x24')+_0x226732,'style':_0xe095('0x25')};},'defaultStyle':{'font':_0xe095('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe095('0x27')},'footer':{'alignment':_0xe095('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x32b827){var _0x36ceac=0x1388;var _0x3f649f;if(!_0x32b827[0x0][_0xe095('0x29')]){return analyticExtractedReport(_0xe095('0x2a'));}return db[_0xe095('0x2b')][_0xe095('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe095('0x2d'),_0xe095('0x2e')]})[_0xe095('0x2f')](function(_0x5cf324){if(_0x5cf324){_0x3f649f=_0x5cf324;_0x36ceac=_0x3f649f[_0xe095('0x2e')]||0x3e8;}})[_0xe095('0x2f')](function(){var _0xd5a082=[];var _0x414745=0x0;if(_0x3f649f[_0xe095('0x2d')]){if(_0x32b827&&_0x32b827['length']){var _0x18a7a1=_[_0xe095('0x30')](_0x32b827[0x0][_0xe095('0x29')]/_0x36ceac);var _0x10e0c1=Number[_0xe095('0x31')](_0x32b827[0x0][_0xe095('0x29')]/_0x36ceac)?_0x32b827[0x0][_0xe095('0x29')]%_0x36ceac:0x0;_0x18a7a1[_0xe095('0x19')](function(_0x2ed811){if(_0x2ed811>0x0){_0x414745+=_0x36ceac;}_0xd5a082[_0xe095('0x14')](dbH[_0xe095('0x32')][_0xe095('0x33')](util[_0xe095('0x1d')](_0xe095('0x34'),QUERY,_0x36ceac,_0x414745),{'type':dbH[_0xe095('0x32')]['QueryTypes'][_0xe095('0x35')]}));});if(_0x10e0c1>0x0){_0x414745+=_0x36ceac;_0xd5a082[_0xe095('0x14')](dbH[_0xe095('0x32')][_0xe095('0x33')](util['format'](_0xe095('0x34'),QUERY,_0x10e0c1,_0x414745),{'type':dbH[_0xe095('0x32')][_0xe095('0x36')][_0xe095('0x35')]}));}}}else{_0xd5a082[_0xe095('0x14')](dbH[_0xe095('0x32')][_0xe095('0x33')](QUERY,{'type':dbH['sequelize'][_0xe095('0x36')]['SELECT']}));}var _0x2b385c=path[_0xe095('0x37')](PATH);var _0x30be74=path['basename'](PATH,_0xe095('0x38'));var _0x4250ab=_0x3f649f[_0xe095('0x2d')]&&_0xd5a082[_0xe095('0x1f')]>0x1;var _0xf977e0=[];if(!fs[_0xe095('0x39')](path[_0xe095('0x3a')](_0x2b385c,_0x30be74))&&_0x4250ab){fs[_0xe095('0x3b')](path[_0xe095('0x3a')](_0x2b385c,_0x30be74));}return BPromise[_0xe095('0x3c')](_0xd5a082,function(_0x336280){_0xf977e0['push'](_0x336280);})['then'](function(){var _0x149650=[];for(var _0x31d5f0=0x0;_0x31d5f0<_0xf977e0[_0xe095('0x1f')];_0x31d5f0+=0x1){var _0x396b1e=_0xf977e0[_0x31d5f0];var _0x32ba60=createTables(_[_0xe095('0x3d')](_0x396b1e));var _0x72f876;var _0x4991fa=getPDFDocDefinition(_0x32ba60);var _0x1b7f4b=getPDFPrinter();var _0x1548ff=_0x1b7f4b[_0xe095('0x3e')](_0x4991fa);if(_0x4250ab){_0x72f876=path[_0xe095('0x3a')](_0x2b385c,_0x30be74,util[_0xe095('0x1d')](_0xe095('0x3f'),_0x30be74,_0x31d5f0,_0xe095('0x40')));}else{_0x72f876=path['join'](_0x2b385c,util['format'](_0xe095('0x41'),_0x30be74,_0xe095('0x40')));}_0x149650[_0xe095('0x14')](writePDFDocument(_0x1548ff,_0x72f876));}return Promise[_0xe095('0x42')](_0x149650);})[_0xe095('0x2f')](function(){if(_0x4250ab){return new Promise(function(_0x1d0eba){zipdir(path[_0xe095('0x3a')](_0x2b385c,_0x30be74),{'saveTo':path['join'](_0x2b385c,util[_0xe095('0x1d')](_0xe095('0x41'),_0x30be74,_0xe095('0x43')))},function(){rimraf(path[_0xe095('0x3a')](_0x2b385c,_0x30be74),function(){});_0x1d0eba(_0xe095('0x44'));});});}})[_0xe095('0x2f')](function(){if(!_0x4250ab)return;rimraf(path[_0xe095('0x3a')](_0x2b385c,_0x30be74),function(){});})[_0xe095('0x2f')](function(){logger['info'](util[_0xe095('0x1d')](_0xe095('0x45'),EXTRACTED_REPORT_ID,_0xe095('0x46')));return analyticExtractedReport(_0xe095('0x47'),_0x4250ab?util['format'](_0xe095('0x41'),_0x30be74,_0x4250ab?_0xe095('0x43'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe095('0x48')](util[_0xe095('0x1d')](_0xe095('0x49'),EXTRACTED_REPORT_ID,_0xe095('0x46')));return db['AnalyticExtractedReport'][_0xe095('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x339ba2){EXTRACTED_REPORT=_0x339ba2;return dbH['sequelize'][_0xe095('0x33')](util[_0xe095('0x1d')](_0xe095('0x4b'),QUERY),{'type':dbH[_0xe095('0x32')][_0xe095('0x36')]['SELECT']});})[_0xe095('0x2f')](extractReport)[_0xe095('0x4c')](function(_0xdee40a){logger[_0xe095('0x48')](util[_0xe095('0x1d')](_0xe095('0x4d'),EXTRACTED_REPORT_ID,_0xe095('0x46')),util[_0xe095('0x4e')](_0xdee40a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe095('0x4f'));})[_0xe095('0x50')](function(){process[_0xe095('0x51')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5b30ba=new PdfPrinter({'Arial':{'normal':__dirname+_0xe095('0x52'),'bold':__dirname+_0xe095('0x53'),'italics':__dirname+_0xe095('0x54'),'bolditalics':__dirname+_0xe095('0x55')}});return _0x5b30ba;}function getPDFDocDefinitionFromHTML(_0x38bbc8,_0x2d9dd8){var _0x5e4f9d=util[_0xe095('0x1d')]('%s\x20#%d',_0x2d9dd8[_0xe095('0x56')],_0x2d9dd8[_0xe095('0x57')]);var _0x1a9826=moment()[_0xe095('0x1d')](_0xe095('0x58'))[_0xe095('0x10')]();var _0x1d5fbc=htmlToPdfmake(_0x38bbc8,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1d5fbc],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe095('0x59'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe095('0x59'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xe095('0x59')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xe095('0x20')}];},'footer':function(_0x1c9efb,_0x3ae0e7){return[{'text':util[_0xe095('0x1d')](_0xe095('0x5a'),_0x5e4f9d,_0x1c9efb,_0x3ae0e7,_0x1a9826),'style':_0xe095('0x25')}];}};}function writePDFDocument(_0x67c804,_0x4d7602){return new Promise(function(_0x3660a1,_0x28ef68){var _0x4ea009=_0x67c804[_0xe095('0x5b')](fs[_0xe095('0x5c')](_0x4d7602));_0x4ea009['on'](_0xe095('0x5d'),function(){_0x3660a1(_0xe095('0x5d'));});_0x4ea009['on'](_0xe095('0x5e'),function(_0x10e0f9){_0x28ef68(_0x10e0f9);});_0x67c804[_0xe095('0x5f')]();});}exports[_0xe095('0x60')]=function(_0x24dd66,_0x438625){var _0x273d04=getPDFPrinter();var _0x48b19b=getPDFDocDefinitionFromHTML(_0x24dd66,_0x438625);var _0x39b22a=_0x273d04[_0xe095('0x3e')](_0x48b19b);return writePDFDocument(_0x39b22a,_0x438625[_0xe095('0x1')])[_0xe095('0x4c')](function(_0x1d54c6){throw _0x1d54c6;});}; \ No newline at end of file +var _0x0281=['createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','window','bluebird','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','toString','value','length','body','push','concat','chunk','keys','name','startDate','format','endDate','header','pageBreak','before','margin','landscape','footer','Arial','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','existsSync','mkdirSync','join','flatten','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe'];(function(_0xd4b1d5,_0x3ed95f){var _0x46a928=function(_0x2fed87){while(--_0x2fed87){_0xd4b1d5['push'](_0xd4b1d5['shift']());}};_0x46a928(++_0x3ed95f);}(_0x0281,0x11a));var _0x1028=function(_0x3361db,_0x4b4f9e){_0x3361db=_0x3361db-0x0;var _0x3f4a8b=_0x0281[_0x3361db];return _0x3f4a8b;};'use strict';var _=require(_0x1028('0x0'));var fs=require('fs');var util=require(_0x1028('0x1'));var path=require(_0x1028('0x2'));var moment=require(_0x1028('0x3'));var htmlToPdfmake=require(_0x1028('0x4'));var PdfPrinter=require(_0x1028('0x5'));var zipdir=require(_0x1028('0x6'));var rimraf=require('rimraf');var JSDOM=require(_0x1028('0x7'))['JSDOM'];var window=new JSDOM('')[_0x1028('0x8')];var BPromise=require(_0x1028('0x9'));var db=require(_0x1028('0xa'))['db'];var dbH=require(_0x1028('0xa'))['dbH'];var logger=require(_0x1028('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1028('0xc')][0x2]);var QUERY=process[_0x1028('0xc')][0x3];var PATH=process[_0x1028('0xc')][0x4];var NAME=process[_0x1028('0xc')][0x5];var FORMAT=_0x1028('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x29eff5,_0x34db8e){var _0x4e5e87={'status':_0x29eff5};var _0x1802d7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x34db8e){_0x4e5e87[_0x1028('0xe')]=_0x34db8e;}return db['AnalyticExtractedReport'][_0x1028('0xf')](_0x4e5e87,_0x1802d7);}function getHeaders(_0x99a26c){return _[_0x1028('0x10')](_0x99a26c,function(_0xe4b22b){return{'text':_0xe4b22b,'style':_0x1028('0x11')};});}function getRows(_0xd86929,_0x5636b6){return _['map'](_0x5636b6,function(_0x362875){return _(_0x362875)['pick'](_0xd86929)[_0x1028('0x10')](function(_0x144e99){return _0x144e99?_[_0x1028('0x12')](_0x144e99):'';})[_0x1028('0x13')]();});}function createTable(_0x497aef,_0x10001f){var _0x36f00a={'widths':_['fill'](Array(_0x497aef[_0x1028('0x14')]),0x91),'heights':function(_0x4d4706){return _0x4d4706===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x575d73=getHeaders(_0x497aef);_0x36f00a[_0x1028('0x15')][_0x1028('0x16')](_0x575d73);var _0x14049d=getRows(_0x497aef,_0x10001f);_0x36f00a[_0x1028('0x15')]=_0x36f00a[_0x1028('0x15')][_0x1028('0x17')](_0x14049d);return _0x36f00a;}function createTables(_0x163702){var _0x36f089=[];var _0x473896=_[_0x1028('0x18')](Object[_0x1028('0x19')](_0x163702[0x0]),0x5);_0x473896['forEach'](function(_0x57a64d){_0x36f089[_0x1028('0x16')](createTable(_0x57a64d,_0x163702));});return _0x36f089;}function getPDFDocDefinition(_0x3d77ff){var _0x1e8036=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x1028('0x1a')],moment(EXTRACTED_REPORT[_0x1028('0x1b')])[_0x1028('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x1028('0x1d')])[_0x1028('0x1c')](FORMAT));var _0x398334=[];for(var _0x5dd07b=0x0;_0x5dd07b<_0x3d77ff[_0x1028('0x14')];_0x5dd07b++){var _0x115695=[];if(_0x5dd07b===0x0){_0x115695[_0x1028('0x16')]({'text':_0x1e8036,'style':_0x1028('0x1e')});}var _0x53f0f7={'table':_0x3d77ff[_0x5dd07b]};if(_0x5dd07b>0x0){_0x53f0f7[_0x1028('0x1f')]=_0x1028('0x20');_0x53f0f7[_0x1028('0x21')]=[0x0,0x46,0x0,0x0];}_0x115695['push'](_0x53f0f7);_0x398334[_0x1028('0x16')](_0x115695);}return{'pageSize':'A4','pageOrientation':_0x1028('0x22'),'content':_0x398334,'footer':function(_0x2ea8f6,_0xaa974b){return{'text':_0x2ea8f6['toString']()+'\x20/\x20'+_0xaa974b,'style':_0x1028('0x23')};},'defaultStyle':{'font':_0x1028('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x1028('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3b6d7f){var _0x239d11=0x1388;var _0x63f9ce;if(!_0x3b6d7f[0x0][_0x1028('0x26')]){return analyticExtractedReport(_0x1028('0x27'));}return db[_0x1028('0x28')][_0x1028('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x2176f5){if(_0x2176f5){_0x63f9ce=_0x2176f5;_0x239d11=_0x63f9ce[_0x1028('0x2a')]||0x3e8;}})[_0x1028('0x2b')](function(){var _0x18698a=[];var _0x1b79c7=0x0;if(_0x63f9ce[_0x1028('0x2c')]){if(_0x3b6d7f&&_0x3b6d7f[_0x1028('0x14')]){var _0x5b7062=_[_0x1028('0x2d')](_0x3b6d7f[0x0][_0x1028('0x26')]/_0x239d11);var _0x2eea80=Number[_0x1028('0x2e')](_0x3b6d7f[0x0][_0x1028('0x26')]/_0x239d11)?_0x3b6d7f[0x0][_0x1028('0x26')]%_0x239d11:0x0;_0x5b7062[_0x1028('0x2f')](function(_0x289bb0){if(_0x289bb0>0x0){_0x1b79c7+=_0x239d11;}_0x18698a[_0x1028('0x16')](dbH[_0x1028('0x30')][_0x1028('0x31')](util[_0x1028('0x1c')](_0x1028('0x32'),QUERY,_0x239d11,_0x1b79c7),{'type':dbH[_0x1028('0x30')][_0x1028('0x33')][_0x1028('0x34')]}));});if(_0x2eea80>0x0){_0x1b79c7+=_0x239d11;_0x18698a[_0x1028('0x16')](dbH[_0x1028('0x30')][_0x1028('0x31')](util[_0x1028('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2eea80,_0x1b79c7),{'type':dbH[_0x1028('0x30')][_0x1028('0x33')]['SELECT']}));}}}else{_0x18698a['push'](dbH['sequelize'][_0x1028('0x31')](QUERY,{'type':dbH[_0x1028('0x30')][_0x1028('0x33')][_0x1028('0x34')]}));}var _0x188a1a=path[_0x1028('0x35')](PATH);var _0x40c9a2=path['basename'](PATH,'.pdf');var _0x51ae7f=_0x63f9ce[_0x1028('0x2c')]&&_0x18698a[_0x1028('0x14')]>0x1;var _0x35ee7e=[];if(!fs[_0x1028('0x36')](path['join'](_0x188a1a,_0x40c9a2))&&_0x51ae7f){fs[_0x1028('0x37')](path[_0x1028('0x38')](_0x188a1a,_0x40c9a2));}return BPromise['each'](_0x18698a,function(_0x386c78){_0x35ee7e[_0x1028('0x16')](_0x386c78);})[_0x1028('0x2b')](function(){var _0x5899c0=[];for(var _0x3500dc=0x0;_0x3500dc<_0x35ee7e[_0x1028('0x14')];_0x3500dc+=0x1){var _0x2a3d19=_0x35ee7e[_0x3500dc];var _0x8ba9c5=createTables(_[_0x1028('0x39')](_0x2a3d19));var _0x35bd56;var _0x2f78dc=getPDFDocDefinition(_0x8ba9c5);var _0x5428bb=getPDFPrinter();var _0x4e84ab=_0x5428bb['createPdfKitDocument'](_0x2f78dc);if(_0x51ae7f){_0x35bd56=path[_0x1028('0x38')](_0x188a1a,_0x40c9a2,util['format'](_0x1028('0x3a'),_0x40c9a2,_0x3500dc,'pdf'));}else{_0x35bd56=path['join'](_0x188a1a,util[_0x1028('0x1c')](_0x1028('0x3b'),_0x40c9a2,_0x1028('0x3c')));}_0x5899c0[_0x1028('0x16')](writePDFDocument(_0x4e84ab,_0x35bd56));}return Promise[_0x1028('0x3d')](_0x5899c0);})[_0x1028('0x2b')](function(){if(_0x51ae7f){return new Promise(function(_0x142d8b){zipdir(path['join'](_0x188a1a,_0x40c9a2),{'saveTo':path[_0x1028('0x38')](_0x188a1a,util[_0x1028('0x1c')](_0x1028('0x3b'),_0x40c9a2,_0x1028('0x3e')))},function(){rimraf(path[_0x1028('0x38')](_0x188a1a,_0x40c9a2),function(){});_0x142d8b(_0x1028('0x3f'));});});}})['then'](function(){if(!_0x51ae7f)return;rimraf(path[_0x1028('0x38')](_0x188a1a,_0x40c9a2),function(){});})[_0x1028('0x2b')](function(){logger['info'](util[_0x1028('0x1c')](_0x1028('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x1028('0x41'),_0x51ae7f?util[_0x1028('0x1c')](_0x1028('0x3b'),_0x40c9a2,_0x51ae7f?'zip':_0x1028('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1028('0x42')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x1028('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5abebc){EXTRACTED_REPORT=_0x5abebc;return dbH['sequelize'][_0x1028('0x31')](util[_0x1028('0x1c')](_0x1028('0x44'),QUERY),{'type':dbH[_0x1028('0x30')][_0x1028('0x33')][_0x1028('0x34')]});})[_0x1028('0x2b')](extractReport)[_0x1028('0x45')](function(_0x286e4){logger[_0x1028('0x42')](util[_0x1028('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1028('0x46')),util[_0x1028('0x47')](_0x286e4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1028('0x48'));})[_0x1028('0x49')](function(){process[_0x1028('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5ac4fc=new PdfPrinter({'Arial':{'normal':__dirname+_0x1028('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x1028('0x4c'),'bolditalics':__dirname+_0x1028('0x4d')}});return _0x5ac4fc;}function getPDFDocDefinitionFromHTML(_0x15e257,_0x1dbcd1){var _0x3ed5b7=util[_0x1028('0x1c')](_0x1028('0x4e'),_0x1dbcd1[_0x1028('0x4f')],_0x1dbcd1[_0x1028('0x50')]);var _0x4c0f05=moment()['format'](_0x1028('0x51'))['toString']();var _0x56f3f9=htmlToPdfmake(_0x15e257,{'window':window,'tableAutoSize':!![]});return{'content':[_0x56f3f9],'defaultStyle':{'font':_0x1028('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1028('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1028('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1028('0x52')}},'header':function(){return[{'text':_0x1028('0x53'),'style':_0x1028('0x1e')}];},'footer':function(_0x33f80d,_0x3727ca){return[{'text':util[_0x1028('0x1c')](_0x1028('0x54'),_0x3ed5b7,_0x33f80d,_0x3727ca,_0x4c0f05),'style':_0x1028('0x23')}];}};}function writePDFDocument(_0x588f34,_0x230962){return new Promise(function(_0x593e22,_0x4ef737){var _0x41b069=_0x588f34[_0x1028('0x55')](fs[_0x1028('0x56')](_0x230962));_0x41b069['on'](_0x1028('0x57'),function(){_0x593e22('finish');});_0x41b069['on'](_0x1028('0x58'),function(_0x6283b5){_0x4ef737(_0x6283b5);});_0x588f34[_0x1028('0x59')]();});}exports[_0x1028('0x5a')]=function(_0x346ee2,_0x50e2c3){var _0x1248c3=getPDFPrinter();var _0x1c73ae=getPDFDocDefinitionFromHTML(_0x346ee2,_0x50e2c3);var _0x3be123=_0x1248c3[_0x1028('0x5b')](_0x1c73ae);return writePDFDocument(_0x3be123,_0x50e2c3[_0x1028('0x2')])[_0x1028('0x45')](function(_0x5968f7){throw _0x5968f7;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1f289cb..3ddaa53 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 _0xb77e=['../../config/logger','analytics','argv','savename','AnalyticExtractedReport','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0x56a913,_0x89382e){var _0x306a44=function(_0x2c8e48){while(--_0x2c8e48){_0x56a913['push'](_0x56a913['shift']());}};_0x306a44(++_0x89382e);}(_0xb77e,0x1e6));var _0xeb77=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb77e[_0x6cf19c];return _0xce14f3;};'use strict';var util=require(_0xeb77('0x0'));var path=require(_0xeb77('0x1'));var _=require(_0xeb77('0x2'));var fs=require('fs');var json2xls=require(_0xeb77('0x3'));var BPromise=require(_0xeb77('0x4'));var zipdir=require(_0xeb77('0x5'));var rimraf=require(_0xeb77('0x6'));var db=require(_0xeb77('0x7'))['db'];var dbH=require(_0xeb77('0x7'))[_0xeb77('0x8')];var logger=require(_0xeb77('0x9'))(_0xeb77('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xeb77('0xb')][0x2]);var QUERY=process[_0xeb77('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x25a4f4,_0x45dd88){var _0x1f5824={'status':_0x25a4f4};var _0xf71932={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x45dd88){_0x1f5824[_0xeb77('0xc')]=_0x45dd88;}return db[_0xeb77('0xd')]['update'](_0x1f5824,_0xf71932);}function main(){var _0x20d831=0x1388;var _0x9ba2d9;logger['info'](util['format'](_0xeb77('0xe'),EXTRACTED_REPORT_ID,_0xeb77('0xf')));return db[_0xeb77('0x10')][_0xeb77('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xeb77('0x12'),_0xeb77('0x13')]})['then'](function(_0x9d0a64){if(_0x9d0a64){_0x9ba2d9=_0x9d0a64;_0x20d831=_0x9ba2d9[_0xeb77('0x13')]||0x1388;}})[_0xeb77('0x14')](function(){return dbH[_0xeb77('0x15')]['query'](util[_0xeb77('0x16')](_0xeb77('0x17'),QUERY),{'type':dbH[_0xeb77('0x15')][_0xeb77('0x18')][_0xeb77('0x19')]});})[_0xeb77('0x14')](function(_0x29343f){if(!_0x29343f[0x0][_0xeb77('0x1a')]){return analyticExtractedReport(_0xeb77('0x1b'));}var _0x4ce2e0=[];var _0x3a436b=0x0;if(_0x9ba2d9['split']){if(_0x29343f&&_0x29343f['length']){var _0x5357ca=_[_0xeb77('0x1c')](_0x29343f[0x0]['num']/_0x20d831);var _0x55d485=Number[_0xeb77('0x1d')](_0x29343f[0x0][_0xeb77('0x1a')]/_0x20d831)?_0x29343f[0x0][_0xeb77('0x1a')]%_0x20d831:0x0;_0x5357ca[_0xeb77('0x1e')](function(_0x348559){if(_0x348559>0x0){_0x3a436b+=_0x20d831;}_0x4ce2e0[_0xeb77('0x1f')](dbH[_0xeb77('0x15')][_0xeb77('0x20')](util['format'](_0xeb77('0x21'),QUERY,_0x20d831,_0x3a436b),{'type':dbH['sequelize'][_0xeb77('0x18')]['SELECT']}));});if(_0x55d485>0x0){_0x3a436b+=_0x20d831;_0x4ce2e0[_0xeb77('0x1f')](dbH['sequelize']['query'](util[_0xeb77('0x16')](_0xeb77('0x21'),QUERY,_0x55d485,_0x3a436b),{'type':dbH[_0xeb77('0x15')][_0xeb77('0x18')][_0xeb77('0x19')]}));}}}else{_0x4ce2e0[_0xeb77('0x1f')](dbH[_0xeb77('0x15')][_0xeb77('0x20')](QUERY,{'type':dbH[_0xeb77('0x15')][_0xeb77('0x18')][_0xeb77('0x19')]}));}var _0x1bc3cf=path['dirname'](PATH);var _0x36a80a=path[_0xeb77('0x22')](PATH,_0xeb77('0x23'));var _0x4e793a=_0x9ba2d9[_0xeb77('0x12')]&&_0x4ce2e0[_0xeb77('0x24')]>0x1;var _0xf08c7a=[];if(!fs[_0xeb77('0x25')](path['join'](_0x1bc3cf,_0x36a80a))&&_0x4e793a){fs[_0xeb77('0x26')](path[_0xeb77('0x27')](_0x1bc3cf,_0x36a80a));}return BPromise[_0xeb77('0x28')](_0x4ce2e0,function(_0x306a95){_0xf08c7a[_0xeb77('0x1f')](_0x306a95);})['then'](function(){for(var _0x4a0d4f=0x0;_0x4a0d4f<_0xf08c7a[_0xeb77('0x24')];_0x4a0d4f+=0x1){var _0x3a4d36;var _0x455542=_0xf08c7a[_0x4a0d4f];if(_0x4e793a){_0x3a4d36=path[_0xeb77('0x27')](_0x1bc3cf,_0x36a80a,util['format'](_0xeb77('0x29'),_0x36a80a,_0x4a0d4f,_0xeb77('0x2a')));}else{_0x3a4d36=path[_0xeb77('0x27')](_0x1bc3cf,util[_0xeb77('0x16')](_0xeb77('0x2b'),_0x36a80a,'xlsx'));}fs['writeFileSync'](_0x3a4d36,json2xls(_0x455542),_0xeb77('0x2c'));}})[_0xeb77('0x14')](function(){if(_0x4e793a){return new Promise(function(_0x38ae13){zipdir(path['join'](_0x1bc3cf,_0x36a80a),{'saveTo':path[_0xeb77('0x27')](_0x1bc3cf,util[_0xeb77('0x16')](_0xeb77('0x2b'),_0x36a80a,_0xeb77('0x2d')))},function(_0x776779,_0x4eb51c){rimraf(path[_0xeb77('0x27')](_0x1bc3cf,_0x36a80a),function(){});_0x38ae13(_0xeb77('0x2e'));});});}})[_0xeb77('0x14')](function(){logger[_0xeb77('0x2f')](util[_0xeb77('0x16')](_0xeb77('0x30'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xeb77('0x31'),_0x4e793a?util[_0xeb77('0x16')]('%s.%s',_0x36a80a,_0x4e793a?_0xeb77('0x2d'):_0xeb77('0x2a')):null);});})['catch'](function(_0x138d87){logger[_0xeb77('0x2f')](util[_0xeb77('0x16')](_0xeb77('0x32'),EXTRACTED_REPORT_ID,_0xeb77('0xf')),util[_0xeb77('0x33')](_0x138d87,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xeb77('0x34'));})[_0xeb77('0x35')](function(){process[_0xeb77('0x36')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xcade=['QueryTypes','SELECT','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','split','length','existsSync','mkdirSync','join','each','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','json2xls','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xcade,0xab));var _0xecad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcade[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require(_0xecad('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xecad('0x1'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xecad('0x2'));var db=require(_0xecad('0x3'))['db'];var dbH=require('../../mysqldb')[_0xecad('0x4')];var logger=require(_0xecad('0x5'))(_0xecad('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xecad('0x7')][0x2]);var QUERY=process[_0xecad('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2a9c6d,_0x11c219){var _0x30a5c7={'status':_0x2a9c6d};var _0x24570e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11c219){_0x30a5c7[_0xecad('0x8')]=_0x11c219;}return db[_0xecad('0x9')][_0xecad('0xa')](_0x30a5c7,_0x24570e);}function main(){var _0x3e4b4d=0x1388;var _0x40d27b;logger[_0xecad('0xb')](util[_0xecad('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xecad('0xd')));return db[_0xecad('0xe')][_0xecad('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xecad('0x10')]})[_0xecad('0x11')](function(_0x4d7f97){if(_0x4d7f97){_0x40d27b=_0x4d7f97;_0x3e4b4d=_0x40d27b[_0xecad('0x10')]||0x1388;}})[_0xecad('0x11')](function(){return dbH[_0xecad('0x12')][_0xecad('0x13')](util[_0xecad('0xc')](_0xecad('0x14'),QUERY),{'type':dbH['sequelize'][_0xecad('0x15')][_0xecad('0x16')]});})['then'](function(_0xf53301){if(!_0xf53301[0x0]['num']){return analyticExtractedReport('Empty');}var _0x37f66a=[];var _0x629ff2=0x0;if(_0x40d27b['split']){if(_0xf53301&&_0xf53301['length']){var _0x13e4fc=_[_0xecad('0x17')](_0xf53301[0x0][_0xecad('0x18')]/_0x3e4b4d);var _0x5cab86=Number[_0xecad('0x19')](_0xf53301[0x0][_0xecad('0x18')]/_0x3e4b4d)?_0xf53301[0x0][_0xecad('0x18')]%_0x3e4b4d:0x0;_0x13e4fc['forEach'](function(_0x4333bb){if(_0x4333bb>0x0){_0x629ff2+=_0x3e4b4d;}_0x37f66a[_0xecad('0x1a')](dbH[_0xecad('0x12')][_0xecad('0x13')](util[_0xecad('0xc')](_0xecad('0x1b'),QUERY,_0x3e4b4d,_0x629ff2),{'type':dbH['sequelize'][_0xecad('0x15')][_0xecad('0x16')]}));});if(_0x5cab86>0x0){_0x629ff2+=_0x3e4b4d;_0x37f66a[_0xecad('0x1a')](dbH['sequelize'][_0xecad('0x13')](util[_0xecad('0xc')](_0xecad('0x1b'),QUERY,_0x5cab86,_0x629ff2),{'type':dbH[_0xecad('0x12')][_0xecad('0x15')]['SELECT']}));}}}else{_0x37f66a[_0xecad('0x1a')](dbH[_0xecad('0x12')][_0xecad('0x13')](QUERY,{'type':dbH[_0xecad('0x12')][_0xecad('0x15')][_0xecad('0x16')]}));}var _0x411e86=path[_0xecad('0x1c')](PATH);var _0x45d306=path['basename'](PATH,_0xecad('0x1d'));var _0x5b1ff8=_0x40d27b[_0xecad('0x1e')]&&_0x37f66a[_0xecad('0x1f')]>0x1;var _0x5e1e93=[];if(!fs[_0xecad('0x20')](path['join'](_0x411e86,_0x45d306))&&_0x5b1ff8){fs[_0xecad('0x21')](path[_0xecad('0x22')](_0x411e86,_0x45d306));}return BPromise[_0xecad('0x23')](_0x37f66a,function(_0x1c7bd1){_0x5e1e93[_0xecad('0x1a')](_0x1c7bd1);})[_0xecad('0x11')](function(){for(var _0x16f3d5=0x0;_0x16f3d5<_0x5e1e93[_0xecad('0x1f')];_0x16f3d5+=0x1){var _0x58fab8;var _0x347bc5=_0x5e1e93[_0x16f3d5];if(_0x5b1ff8){_0x58fab8=path['join'](_0x411e86,_0x45d306,util['format']('%s%d.%s',_0x45d306,_0x16f3d5,_0xecad('0x24')));}else{_0x58fab8=path[_0xecad('0x22')](_0x411e86,util[_0xecad('0xc')](_0xecad('0x25'),_0x45d306,_0xecad('0x24')));}fs['writeFileSync'](_0x58fab8,json2xls(_0x347bc5),_0xecad('0x26'));}})['then'](function(){if(_0x5b1ff8){return new Promise(function(_0x4ec02){zipdir(path[_0xecad('0x22')](_0x411e86,_0x45d306),{'saveTo':path[_0xecad('0x22')](_0x411e86,util[_0xecad('0xc')](_0xecad('0x25'),_0x45d306,_0xecad('0x27')))},function(_0x8e8126,_0x2b27f7){rimraf(path[_0xecad('0x22')](_0x411e86,_0x45d306),function(){});_0x4ec02(_0xecad('0x28'));});});}})[_0xecad('0x11')](function(){logger[_0xecad('0xb')](util['format'](_0xecad('0x29'),EXTRACTED_REPORT_ID,_0xecad('0xd')));return analyticExtractedReport(_0xecad('0x2a'),_0x5b1ff8?util[_0xecad('0xc')](_0xecad('0x25'),_0x45d306,_0x5b1ff8?'zip':'xlsx'):null);});})[_0xecad('0x2b')](function(_0x385cb6){logger[_0xecad('0xb')](util[_0xecad('0xc')](_0xecad('0x2c'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x385cb6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xecad('0x2d'));})[_0xecad('0x2e')](function(){process[_0xecad('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c11eb38..4a8abe3 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 _0xf0fd=['IntervalId','map','exten','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','push','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','toLowerCase','updatedAt','*,*,*,*','interval','tag','length','outbound','callerID','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xf0fd,0x1c7));var _0xdf0f=function(_0x21f620,_0x24d3fe){_0x21f620=_0x21f620-0x0;var _0x500d4a=_0xf0fd[_0x21f620];return _0x500d4a;};'use strict';var _=require('lodash');var util=require(_0xdf0f('0x0'));function rewrite(_0x26b50e,_0x40cb72){var _0x4ce166=this;return _0x26b50e[_0xdf0f('0x1')][_0xdf0f('0x2')][_0xdf0f('0x3')]({'raw':!![]})[_0xdf0f('0x4')](function(_0x2fe9d2){_0x4ce166[_0xdf0f('0x5')]=_0x2fe9d2;return _0x26b50e[_0xdf0f('0x1')][_0xdf0f('0x6')][_0xdf0f('0x3')]({'where':{'IntervalId':_0x40cb72[_0xdf0f('0x7')]},'raw':!![]});})[_0xdf0f('0x4')](function(_0x36aec1){return _0x26b50e[_0xdf0f('0x1')][_0xdf0f('0x6')][_0xdf0f('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0xdf0f('0x8')](_0x36aec1,_0xdf0f('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xdf0f('0x4')](function(_0x3cf890){var _0x30da2e=_[_0xdf0f('0xa')](_0x3cf890,{'priority':'1'});var _0x915665=_[_0xdf0f('0xa')](_0x3cf890,{'isApp':0x1});var _0x132375=_[_0xdf0f('0xb')](_0x915665,_0xdf0f('0x9'));var _0x143bdb=[_0xdf0f('0xc'),'playback'];var _0x59b991=[];var _0x88f7ac=[];for(var _0x4459f4 in _0x132375){if(_0x132375[_0xdf0f('0xd')](_0x4459f4)){_0x4ce166[_0xdf0f('0xe')]=0x2;_0x4ce166[_0xdf0f('0xf')]=[];_0x4ce166[_0xdf0f('0x10')]=_[_0xdf0f('0x11')](_0x30da2e,{'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')]});_0x4ce166['extensions']['push']({'type':_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')],'app':_0xdf0f('0x13'),'appdata':util[_0xdf0f('0x14')](_0xdf0f('0x15'),_0x132375[_0x4459f4][0x0]['type']),'context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0]['exten'],'priority':_0x4ce166[_0xdf0f('0xe')]++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});if(_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')]==='inbound'){_0x4ce166['extensions'][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0]['type'],'app':_0xdf0f('0x13'),'appdata':'CDR(routeid)='+_0x132375[_0x4459f4][0x0]['VoiceExtensionId'],'context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0]['exten'],'priority':_0x4ce166[_0xdf0f('0xe')]++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});}else if(_0x132375[_0x4459f4][0x0]['type']==='outbound'){if(_0x4ce166[_0xdf0f('0x10')]){_0x4ce166[_0xdf0f('0xf')][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')],'app':_0xdf0f('0x13'),'appdata':'CDR(destination)='+(_0x4ce166['extension']['cutdigits']?_0xdf0f('0x19')+_0x4ce166[_0xdf0f('0x10')][_0xdf0f('0x1a')]+'}':_0xdf0f('0x1b')),'context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')],'priority':_0x4ce166[_0xdf0f('0xe')]++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});}_0x4ce166[_0xdf0f('0xf')][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')],'app':_0xdf0f('0x13'),'appdata':_0xdf0f('0x1c')+_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')],'context':_0x132375[_0x4459f4][0x0]['context'],'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')],'priority':_0x4ce166[_0xdf0f('0xe')]++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});var _0x524d7e=_0x4ce166[_0xdf0f('0xe')]++;_0x4ce166[_0xdf0f('0xf')][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')],'app':_0xdf0f('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x524d7e+0x2)+'):Goto('+(_0x524d7e+0x1)+')','context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')],'priority':_0x524d7e,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});if(_0x4ce166['extension']){_0x4ce166[_0xdf0f('0xf')]['push']({'type':_0x132375[_0x4459f4][0x0]['type'],'app':'Set','appdata':_0x4ce166[_0xdf0f('0x10')]['cutdigits']?_0xdf0f('0x1e')+_0x4ce166['extension'][_0xdf0f('0x1a')]+'}':_0xdf0f('0x1f'),'context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0]['exten'],'priority':_0x4ce166['priority']++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0]['VoiceExtensionId']});}_0x4ce166[_0xdf0f('0xf')]['push']({'type':_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')],'app':_0xdf0f('0x13'),'appdata':_0xdf0f('0x20')+_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')],'context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')],'priority':_0x4ce166['priority']++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});if(_0x4ce166['extension']&&_0x4ce166[_0xdf0f('0x10')][_0xdf0f('0xd')](_0xdf0f('0x21'))&&_0x4ce166['extension']['recordingFormat']!=='none'){_0x4ce166[_0xdf0f('0xf')][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')],'app':'Set','appdata':_0xdf0f('0x22'),'context':_0x132375[_0x4459f4][0x0]['context'],'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')],'priority':_0x4ce166[_0xdf0f('0xe')]++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});_0x4ce166[_0xdf0f('0xf')][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0]['type'],'app':_0xdf0f('0x13'),'appdata':_0xdf0f('0x23')+_0x4ce166['extension'][_0xdf0f('0x21')]||_0xdf0f('0x24'),'context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')],'priority':_0x4ce166['priority']++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});}}_0x4ce166[_0xdf0f('0xf')]['push']({'type':_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')],'priority':_0x4ce166[_0xdf0f('0xe')]++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0]['VoiceExtensionId']});_0x4ce166[_0xdf0f('0xf')][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0]['type'],'app':'Set','appdata':_0xdf0f('0x25'),'context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'exten':_0x132375[_0x4459f4][0x0]['exten'],'priority':_0x4ce166[_0xdf0f('0xe')]++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0]['VoiceExtensionId']});_0x4ce166[_0xdf0f('0xf')][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0]['type'],'app':_0xdf0f('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x132375[_0x4459f4][0x0]['context'],'exten':_0x132375[_0x4459f4][0x0]['exten'],'priority':_0x4ce166[_0xdf0f('0xe')]++,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});for(var _0x554885=0x0,_0xd75d34=0x0;_0x554885<_0x132375[_0x4459f4]['length'];_0x554885+=0x1,_0xd75d34=0x0){var _0x29384b=_0x132375[_0x4459f4][_0x554885];if(_0x29384b[_0xdf0f('0x12')]){_0x29384b['type']=_0x29384b[_0xdf0f('0x12')][_0xdf0f('0x26')]();}var _0x1fb1eb=[];var _0x5e44e9=[];delete _0x29384b['id'];delete _0x29384b['createdAt'];delete _0x29384b[_0xdf0f('0x27')];var _0x2da9e0=_0x29384b['interval']!==_0xdf0f('0x28')?[_0x29384b[_0xdf0f('0x29')]]:_0x29384b['IntervalId']?_['map'](_['filter'](_0x4ce166['intervals'],{'IntervalId':_0x29384b[_0xdf0f('0x7')]}),_0xdf0f('0x29')):[];if(_0x29384b[_0xdf0f('0xd')](_0xdf0f('0x2a'))){if(_0x29384b[_0xdf0f('0x2a')]&&_0x29384b['tag']!=='--'){_0x1fb1eb['push']({'type':_0x29384b[_0xdf0f('0x12')],'app':_0xdf0f('0x13'),'appdata':'CDR(tag)='+_0x29384b[_0xdf0f('0x2a')],'context':_0x29384b[_0xdf0f('0x16')],'exten':_0x29384b[_0xdf0f('0x9')],'priority':_0x2da9e0[_0xdf0f('0x2b')]+_0x4ce166[_0xdf0f('0xe')]+_0xd75d34++,'VoiceExtensionId':_0x29384b[_0xdf0f('0x17')]});}}if(_0x29384b['type']===_0xdf0f('0x2c')&&_0x29384b['hasOwnProperty'](_0xdf0f('0x2d'))){if(_0x29384b[_0xdf0f('0x2d')]){_0x1fb1eb[_0xdf0f('0x18')]({'type':_0x29384b[_0xdf0f('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x29384b['callerID']+')','context':_0x29384b[_0xdf0f('0x16')],'exten':_0x29384b['exten'],'priority':_0x2da9e0[_0xdf0f('0x2b')]+_0x4ce166[_0xdf0f('0xe')]+_0xd75d34++,'VoiceExtensionId':_0x29384b[_0xdf0f('0x17')]});}else{_0x1fb1eb[_0xdf0f('0x18')]({'type':_0x29384b['type'],'app':_0xdf0f('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x29384b[_0xdf0f('0x16')],'exten':_0x29384b[_0xdf0f('0x9')],'priority':_0x2da9e0['length']+_0x4ce166[_0xdf0f('0xe')]+_0xd75d34++,'VoiceExtensionId':_0x29384b['VoiceExtensionId']});}}if(_0x29384b[_0xdf0f('0xd')](_0xdf0f('0x2e'))){if(_0x143bdb[_0xdf0f('0x2f')](_0x29384b[_0xdf0f('0x30')][_0xdf0f('0x26')]())>=0x0&&_0x29384b['appType']!==_0xdf0f('0x31')){if(_0x29384b[_0xdf0f('0x2e')]){_0x1fb1eb[_0xdf0f('0x18')]({'type':_0x29384b[_0xdf0f('0x12')],'app':_0xdf0f('0x1d'),'appdata':_0xdf0f('0x32'),'context':_0x29384b[_0xdf0f('0x16')],'exten':_0x29384b[_0xdf0f('0x9')],'priority':_0x2da9e0[_0xdf0f('0x2b')]+_0x4ce166[_0xdf0f('0xe')]+_0xd75d34++,'VoiceExtensionId':_0x29384b[_0xdf0f('0x17')]});_0x1fb1eb[_0xdf0f('0x18')]({'type':_0x29384b[_0xdf0f('0x12')],'app':_0xdf0f('0x13'),'appdata':_0xdf0f('0x33'),'context':_0x29384b[_0xdf0f('0x16')],'exten':_0x29384b[_0xdf0f('0x9')],'priority':_0x2da9e0[_0xdf0f('0x2b')]+_0x4ce166[_0xdf0f('0xe')]+_0xd75d34++,'VoiceExtensionId':_0x29384b[_0xdf0f('0x17')]});}else{_0x1fb1eb['push']({'type':_0x29384b[_0xdf0f('0x12')],'app':_0xdf0f('0x1d'),'appdata':_0xdf0f('0x34'),'context':_0x29384b[_0xdf0f('0x16')],'exten':_0x29384b[_0xdf0f('0x9')],'priority':_0x2da9e0[_0xdf0f('0x2b')]+_0x4ce166['priority']+_0xd75d34++,'VoiceExtensionId':_0x29384b[_0xdf0f('0x17')]});_0x1fb1eb[_0xdf0f('0x18')]({'type':_0x29384b['type'],'app':_0xdf0f('0x13'),'appdata':_0xdf0f('0x35'),'context':_0x29384b[_0xdf0f('0x16')],'exten':_0x29384b['exten'],'priority':_0x2da9e0[_0xdf0f('0x2b')]+_0x4ce166[_0xdf0f('0xe')]+_0xd75d34++,'VoiceExtensionId':_0x29384b[_0xdf0f('0x17')]});}}}for(var _0x61eb54=0x0;_0x61eb54<_0x2da9e0['length'];_0x61eb54+=0x1){var _0x16232a=_0x4ce166[_0xdf0f('0xe')]+_0x2da9e0['length'];var _0x5d4417=_0x61eb54===_0x2da9e0['length']-0x1?_0x4ce166[_0xdf0f('0xe')]+_0x1fb1eb[_0xdf0f('0x2b')]+_0x5e44e9[_0xdf0f('0x2b')]+0x2:_0x4ce166['priority']+_0x61eb54+0x1;_0x1fb1eb[_0xdf0f('0x36')](_0x61eb54,0x0,{'type':_0x29384b[_0xdf0f('0x12')],'app':_0xdf0f('0x37'),'appdata':_0x2da9e0[_0x61eb54]+'?'+_0x29384b[_0xdf0f('0x16')]+_0xdf0f('0x38')+_0x16232a+':'+_0x29384b[_0xdf0f('0x16')]+_0xdf0f('0x38')+_0x5d4417,'exten':_0x29384b['exten'],'context':_0x29384b[_0xdf0f('0x16')],'priority':_0x4ce166[_0xdf0f('0xe')]+_0x61eb54,'VoiceExtensionId':_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]});}_0x29384b['priority']=_0x1fb1eb[_0xdf0f('0x2b')]?_[_0xdf0f('0x39')](_0x1fb1eb)[_0xdf0f('0xe')]+0x1:_0x4ce166['priority'];_0x4ce166[_0xdf0f('0xe')]=(_0x5e44e9['length']?_['last'](_0x5e44e9)[_0xdf0f('0xe')]:_0x29384b[_0xdf0f('0xe')])+0x1;_0x4ce166[_0xdf0f('0xf')]=_[_0xdf0f('0x3a')](_0x4ce166[_0xdf0f('0xf')],_0x1fb1eb,[_0x29384b],_0x5e44e9);}_0x4ce166[_0xdf0f('0xf')][_0xdf0f('0x18')]({'type':_0x132375[_0x4459f4][0x0][_0xdf0f('0x12')],'app':_0xdf0f('0x3b'),'exten':_0x132375[_0x4459f4][0x0][_0xdf0f('0x9')],'context':_0x132375[_0x4459f4][0x0][_0xdf0f('0x16')],'priority':_0x4ce166[_0xdf0f('0xe')],'VoiceExtensionId':_0x132375[_0x4459f4][0x0]['VoiceExtensionId']});_0x59b991[_0xdf0f('0x18')](_0x132375[_0x4459f4][0x0][_0xdf0f('0x17')]);_0x88f7ac=_[_0xdf0f('0x3a')](_0x88f7ac,_0x4ce166[_0xdf0f('0xf')]);}}return _0x26b50e['transaction'](function(_0x1927ec){return _0x26b50e['models']['VoiceExtension'][_0xdf0f('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x59b991}},'transaction':_0x1927ec})[_0xdf0f('0x4')](function(_0x4f2f61){return _0x26b50e[_0xdf0f('0x1')][_0xdf0f('0x6')][_0xdf0f('0x3d')](_[_0xdf0f('0x3e')](_0x88f7ac,'priority'),{'transaction':_0x1927ec});});});})[_0xdf0f('0x3f')](function(_0x2019db){console[_0xdf0f('0x40')](_0x2019db);});}exports[_0xdf0f('0x41')]=rewrite; \ No newline at end of file +var _0x82aa=['format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','extensions','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','then','VoiceExtension','findAll','IntervalId','uniq','map','filter','groupBy','queue','extension','find','exten','type','Set'];(function(_0x3fb740,_0x125ec0){var _0x2e0ee9=function(_0x4edfcb){while(--_0x4edfcb){_0x3fb740['push'](_0x3fb740['shift']());}};_0x2e0ee9(++_0x125ec0);}(_0x82aa,0x1ed));var _0xa82a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x82aa[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xa82a('0x0'));var util=require(_0xa82a('0x1'));function rewrite(_0x3b7090,_0x15cc83){var _0x7b3fc1=this;return _0x3b7090[_0xa82a('0x2')][_0xa82a('0x3')]['findAll']({'raw':!![]})[_0xa82a('0x4')](function(_0x4f18ad){_0x7b3fc1['intervals']=_0x4f18ad;return _0x3b7090[_0xa82a('0x2')][_0xa82a('0x5')][_0xa82a('0x6')]({'where':{'IntervalId':_0x15cc83[_0xa82a('0x7')]},'raw':!![]});})[_0xa82a('0x4')](function(_0x2d491e){return _0x3b7090[_0xa82a('0x2')][_0xa82a('0x5')][_0xa82a('0x6')]({'where':{'exten':{'$in':_[_0xa82a('0x8')](_[_0xa82a('0x9')](_0x2d491e,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xa82a('0x4')](function(_0x5d4c95){var _0x3cb9a7=_[_0xa82a('0xa')](_0x5d4c95,{'priority':'1'});var _0x3217a2=_[_0xa82a('0xa')](_0x5d4c95,{'isApp':0x1});var _0x593a3c=_[_0xa82a('0xb')](_0x3217a2,'exten');var _0x4b3c48=[_0xa82a('0xc'),'playback'];var _0x8c56e8=[];var _0x23f93c=[];for(var _0x5e9f5d in _0x593a3c){if(_0x593a3c['hasOwnProperty'](_0x5e9f5d)){_0x7b3fc1['priority']=0x2;_0x7b3fc1['extensions']=[];_0x7b3fc1[_0xa82a('0xd')]=_[_0xa82a('0xe')](_0x3cb9a7,{'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')]});_0x7b3fc1['extensions']['push']({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':_0xa82a('0x11'),'appdata':util[_0xa82a('0x12')](_0xa82a('0x13'),_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')]),'context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'priority':_0x7b3fc1[_0xa82a('0x15')]++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});if(_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')]===_0xa82a('0x17')){_0x7b3fc1[_0xa82a('0x18')][_0xa82a('0x19')]({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x1a')+_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')],'context':_0x593a3c[_0x5e9f5d][0x0]['context'],'exten':_0x593a3c[_0x5e9f5d][0x0]['exten'],'priority':_0x7b3fc1['priority']++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0]['VoiceExtensionId']});}else if(_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')]===_0xa82a('0x1b')){if(_0x7b3fc1[_0xa82a('0xd')]){_0x7b3fc1['extensions'][_0xa82a('0x19')]({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x1c')+(_0x7b3fc1[_0xa82a('0xd')][_0xa82a('0x1d')]?_0xa82a('0x1e')+_0x7b3fc1[_0xa82a('0xd')]['cutdigits']+'}':_0xa82a('0x1f')),'context':_0x593a3c[_0x5e9f5d][0x0]['context'],'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'priority':_0x7b3fc1[_0xa82a('0x15')]++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0]['VoiceExtensionId']});}_0x7b3fc1[_0xa82a('0x18')]['push']({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':'Set','appdata':_0xa82a('0x1a')+_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')],'context':_0x593a3c[_0x5e9f5d][0x0]['context'],'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'priority':_0x7b3fc1['priority']++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});var _0x3874c6=_0x7b3fc1[_0xa82a('0x15')]++;_0x7b3fc1[_0xa82a('0x18')][_0xa82a('0x19')]({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':_0xa82a('0x20'),'appdata':_0xa82a('0x21')+(_0x3874c6+0x2)+_0xa82a('0x22')+(_0x3874c6+0x1)+')','context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'priority':_0x3874c6,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});if(_0x7b3fc1[_0xa82a('0xd')]){_0x7b3fc1[_0xa82a('0x18')]['push']({'type':_0x593a3c[_0x5e9f5d][0x0]['type'],'app':_0xa82a('0x11'),'appdata':_0x7b3fc1[_0xa82a('0xd')][_0xa82a('0x1d')]?_0xa82a('0x23')+_0x7b3fc1['extension'][_0xa82a('0x1d')]+'}':_0xa82a('0x24'),'context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'priority':_0x7b3fc1[_0xa82a('0x15')]++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});}_0x7b3fc1[_0xa82a('0x18')]['push']({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x25')+_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')],'context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'priority':_0x7b3fc1[_0xa82a('0x15')]++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0]['VoiceExtensionId']});if(_0x7b3fc1[_0xa82a('0xd')]&&_0x7b3fc1['extension'][_0xa82a('0x26')](_0xa82a('0x27'))&&_0x7b3fc1['extension'][_0xa82a('0x27')]!=='none'){_0x7b3fc1[_0xa82a('0x18')]['push']({'type':_0x593a3c[_0x5e9f5d][0x0]['type'],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x28'),'context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'exten':_0x593a3c[_0x5e9f5d][0x0]['exten'],'priority':_0x7b3fc1[_0xa82a('0x15')]++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});_0x7b3fc1[_0xa82a('0x18')]['push']({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x29')+_0x7b3fc1[_0xa82a('0xd')][_0xa82a('0x27')]||'wav','context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'priority':_0x7b3fc1[_0xa82a('0x15')]++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});}}_0x7b3fc1[_0xa82a('0x18')][_0xa82a('0x19')]({'type':_0x593a3c[_0x5e9f5d][0x0]['type'],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x2a'),'context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'exten':_0x593a3c[_0x5e9f5d][0x0]['exten'],'priority':_0x7b3fc1[_0xa82a('0x15')]++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});_0x7b3fc1['extensions']['push']({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x2b'),'context':_0x593a3c[_0x5e9f5d][0x0]['context'],'exten':_0x593a3c[_0x5e9f5d][0x0]['exten'],'priority':_0x7b3fc1[_0xa82a('0x15')]++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});_0x7b3fc1['extensions'][_0xa82a('0x19')]({'type':_0x593a3c[_0x5e9f5d][0x0]['type'],'app':_0xa82a('0x11'),'appdata':'MONITOR_OPTIONS=ab','context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'priority':_0x7b3fc1['priority']++,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});for(var _0xa628f8=0x0,_0x8c6ddf=0x0;_0xa628f8<_0x593a3c[_0x5e9f5d][_0xa82a('0x2c')];_0xa628f8+=0x1,_0x8c6ddf=0x0){var _0x45335d=_0x593a3c[_0x5e9f5d][_0xa628f8];if(_0x45335d[_0xa82a('0x10')]){_0x45335d['type']=_0x45335d[_0xa82a('0x10')]['toLowerCase']();}var _0x435d54=[];var _0x8bde6b=[];delete _0x45335d['id'];delete _0x45335d[_0xa82a('0x2d')];delete _0x45335d[_0xa82a('0x2e')];var _0x5b5c7f=_0x45335d[_0xa82a('0x2f')]!==_0xa82a('0x30')?[_0x45335d[_0xa82a('0x2f')]]:_0x45335d['IntervalId']?_[_0xa82a('0x9')](_[_0xa82a('0xa')](_0x7b3fc1[_0xa82a('0x31')],{'IntervalId':_0x45335d[_0xa82a('0x7')]}),_0xa82a('0x2f')):[];if(_0x45335d['hasOwnProperty'](_0xa82a('0x32'))){if(_0x45335d[_0xa82a('0x32')]&&_0x45335d['tag']!=='--'){_0x435d54[_0xa82a('0x19')]({'type':_0x45335d[_0xa82a('0x10')],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x33')+_0x45335d[_0xa82a('0x32')],'context':_0x45335d[_0xa82a('0x14')],'exten':_0x45335d['exten'],'priority':_0x5b5c7f[_0xa82a('0x2c')]+_0x7b3fc1[_0xa82a('0x15')]+_0x8c6ddf++,'VoiceExtensionId':_0x45335d[_0xa82a('0x16')]});}}if(_0x45335d[_0xa82a('0x10')]===_0xa82a('0x1b')&&_0x45335d[_0xa82a('0x26')]('callerID')){if(_0x45335d[_0xa82a('0x34')]){_0x435d54[_0xa82a('0x19')]({'type':_0x45335d['type'],'app':_0xa82a('0x20'),'appdata':_0xa82a('0x35')+_0x45335d[_0xa82a('0x34')]+')','context':_0x45335d['context'],'exten':_0x45335d[_0xa82a('0xf')],'priority':_0x5b5c7f[_0xa82a('0x2c')]+_0x7b3fc1[_0xa82a('0x15')]+_0x8c6ddf++,'VoiceExtensionId':_0x45335d[_0xa82a('0x16')]});}else{_0x435d54['push']({'type':_0x45335d[_0xa82a('0x10')],'app':_0xa82a('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x45335d[_0xa82a('0x14')],'exten':_0x45335d[_0xa82a('0xf')],'priority':_0x5b5c7f[_0xa82a('0x2c')]+_0x7b3fc1[_0xa82a('0x15')]+_0x8c6ddf++,'VoiceExtensionId':_0x45335d[_0xa82a('0x16')]});}}if(_0x45335d[_0xa82a('0x26')](_0xa82a('0x36'))){if(_0x4b3c48[_0xa82a('0x37')](_0x45335d[_0xa82a('0x38')][_0xa82a('0x39')]())>=0x0&&_0x45335d[_0xa82a('0x3a')]!=='custom'){if(_0x45335d[_0xa82a('0x36')]){_0x435d54[_0xa82a('0x19')]({'type':_0x45335d['type'],'app':_0xa82a('0x20'),'appdata':_0xa82a('0x3b'),'context':_0x45335d['context'],'exten':_0x45335d['exten'],'priority':_0x5b5c7f[_0xa82a('0x2c')]+_0x7b3fc1[_0xa82a('0x15')]+_0x8c6ddf++,'VoiceExtensionId':_0x45335d[_0xa82a('0x16')]});_0x435d54['push']({'type':_0x45335d[_0xa82a('0x10')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x45335d[_0xa82a('0x14')],'exten':_0x45335d[_0xa82a('0xf')],'priority':_0x5b5c7f[_0xa82a('0x2c')]+_0x7b3fc1[_0xa82a('0x15')]+_0x8c6ddf++,'VoiceExtensionId':_0x45335d['VoiceExtensionId']});}else{_0x435d54[_0xa82a('0x19')]({'type':_0x45335d[_0xa82a('0x10')],'app':_0xa82a('0x20'),'appdata':_0xa82a('0x3c'),'context':_0x45335d['context'],'exten':_0x45335d[_0xa82a('0xf')],'priority':_0x5b5c7f['length']+_0x7b3fc1[_0xa82a('0x15')]+_0x8c6ddf++,'VoiceExtensionId':_0x45335d['VoiceExtensionId']});_0x435d54[_0xa82a('0x19')]({'type':_0x45335d['type'],'app':_0xa82a('0x11'),'appdata':_0xa82a('0x3d'),'context':_0x45335d[_0xa82a('0x14')],'exten':_0x45335d[_0xa82a('0xf')],'priority':_0x5b5c7f[_0xa82a('0x2c')]+_0x7b3fc1[_0xa82a('0x15')]+_0x8c6ddf++,'VoiceExtensionId':_0x45335d[_0xa82a('0x16')]});}}}for(var _0x1c2161=0x0;_0x1c2161<_0x5b5c7f['length'];_0x1c2161+=0x1){var _0x468440=_0x7b3fc1[_0xa82a('0x15')]+_0x5b5c7f[_0xa82a('0x2c')];var _0x9afb7e=_0x1c2161===_0x5b5c7f[_0xa82a('0x2c')]-0x1?_0x7b3fc1[_0xa82a('0x15')]+_0x435d54[_0xa82a('0x2c')]+_0x8bde6b[_0xa82a('0x2c')]+0x2:_0x7b3fc1[_0xa82a('0x15')]+_0x1c2161+0x1;_0x435d54[_0xa82a('0x3e')](_0x1c2161,0x0,{'type':_0x45335d[_0xa82a('0x10')],'app':_0xa82a('0x3f'),'appdata':_0x5b5c7f[_0x1c2161]+'?'+_0x45335d['context']+',${EXTEN},'+_0x468440+':'+_0x45335d[_0xa82a('0x14')]+_0xa82a('0x40')+_0x9afb7e,'exten':_0x45335d[_0xa82a('0xf')],'context':_0x45335d[_0xa82a('0x14')],'priority':_0x7b3fc1[_0xa82a('0x15')]+_0x1c2161,'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});}_0x45335d[_0xa82a('0x15')]=_0x435d54['length']?_['last'](_0x435d54)[_0xa82a('0x15')]+0x1:_0x7b3fc1[_0xa82a('0x15')];_0x7b3fc1[_0xa82a('0x15')]=(_0x8bde6b[_0xa82a('0x2c')]?_[_0xa82a('0x41')](_0x8bde6b)['priority']:_0x45335d[_0xa82a('0x15')])+0x1;_0x7b3fc1[_0xa82a('0x18')]=_[_0xa82a('0x42')](_0x7b3fc1[_0xa82a('0x18')],_0x435d54,[_0x45335d],_0x8bde6b);}_0x7b3fc1[_0xa82a('0x18')][_0xa82a('0x19')]({'type':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x10')],'app':'Hangup','exten':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0xf')],'context':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x14')],'priority':_0x7b3fc1[_0xa82a('0x15')],'VoiceExtensionId':_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]});_0x8c56e8['push'](_0x593a3c[_0x5e9f5d][0x0][_0xa82a('0x16')]);_0x23f93c=_[_0xa82a('0x42')](_0x23f93c,_0x7b3fc1['extensions']);}}return _0x3b7090[_0xa82a('0x43')](function(_0x35e497){return _0x3b7090[_0xa82a('0x2')]['VoiceExtension'][_0xa82a('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x8c56e8}},'transaction':_0x35e497})[_0xa82a('0x4')](function(_0xd6baa9){return _0x3b7090[_0xa82a('0x2')]['VoiceExtension'][_0xa82a('0x45')](_[_0xa82a('0x46')](_0x23f93c,_0xa82a('0x15')),{'transaction':_0x35e497});});});})[_0xa82a('0x47')](function(_0x1644be){console['error'](_0x1644be);});}exports[_0xa82a('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3327572..51f8ad3 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 _0x0e3d=['cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','BlackLists','Campaign','findAll','CampaignId','all','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','../../../mysqldb','../../../config/environment','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','into'];(function(_0x2d08bd,_0x42a12c){var _0x4fbfcf=function(_0x1a533b){while(--_0x1a533b){_0x2d08bd['push'](_0x2d08bd['shift']());}};_0x4fbfcf(++_0x42a12c);}(_0x0e3d,0x1ea));var _0xd0e3=function(_0x2ffd3e,_0x48ff98){_0x2ffd3e=_0x2ffd3e-0x0;var _0x4cb1bc=_0x0e3d[_0x2ffd3e];return _0x4cb1bc;};'use strict';var BPromise=require(_0xd0e3('0x0'));var util=require(_0xd0e3('0x1'));var _=require(_0xd0e3('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xd0e3('0x3'))['db'];var config=require(_0xd0e3('0x4'));var logger=require('../../../config/logger')(_0xd0e3('0x5'));config['redis']=_[_0xd0e3('0x6')](config[_0xd0e3('0x7')],{'host':_0xd0e3('0x8'),'port':0x18eb});var socket=require(_0xd0e3('0x9'))(new Redis(config[_0xd0e3('0x7')]));require(_0xd0e3('0xa'))[_0xd0e3('0xb')](socket);try{if(!process[_0xd0e3('0xc')][0x2]||process['argv'][0x2]===_0xd0e3('0xd')||process['argv'][0x2]===_0xd0e3('0xe')){throw new Error(_0xd0e3('0xf'));}var FILEPATH=process[_0xd0e3('0xc')][0x2];if(!process[_0xd0e3('0xc')][0x3]||process[_0xd0e3('0xc')][0x3]===_0xd0e3('0xd')||process[_0xd0e3('0xc')][0x3]==='null'||!process[_0xd0e3('0xc')][0x4]||process[_0xd0e3('0xc')][0x4]===_0xd0e3('0xd')||process['argv'][0x4]==='null'){throw new Error(_0xd0e3('0x10'));}var FIELDS=_[_0xd0e3('0x11')](process[_0xd0e3('0xc')][0x3][_0xd0e3('0x12')](','),process['argv'][0x4][_0xd0e3('0x12')](','));if(!process['argv'][0x5]||process[_0xd0e3('0xc')][0x5]===_0xd0e3('0xd')||process[_0xd0e3('0xc')][0x5]==='null'){throw new Error(_0xd0e3('0x13'));}var LISTID=process[_0xd0e3('0xc')][0x5];var COMPANYID=process[_0xd0e3('0xc')][0x6]&&process['argv'][0x6]!==_0xd0e3('0xd')&&process[_0xd0e3('0xc')][0x6]!==_0xd0e3('0xe')?process[_0xd0e3('0xc')][0x6]:null;var DUPLICATES=process[_0xd0e3('0xc')][0x7]&&process['argv'][0x7]!==_0xd0e3('0xd')&&process[_0xd0e3('0xc')][0x7]!==_0xd0e3('0xe')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xd0e3('0xc')][0x8]===_0xd0e3('0xd')||process[_0xd0e3('0xc')][0x8]===_0xd0e3('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xd0e3('0xc')][0x8];}catch(_0x19ad74){logger[_0xd0e3('0x14')](_0x19ad74);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(_0x1b7496,_0x21f609,_0x208e88,_0x5132b4){var _0x309a76={'message':_0x21f609};_0x309a76[_0x1b7496]=!![];if(_0x208e88){_0x309a76[_0xd0e3('0x15')]=_0x208e88;}if(_0x5132b4){_0x309a76[_0xd0e3('0x16')]=_0x5132b4;}return _0x309a76;}function isEmail(_0x464eb2){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))*$/[_0xd0e3('0x17')](_0x464eb2);}function checkRow(_0x399237,_0xdfec15,_0x254854){return new BPromise(function(_0x289a6e,_0x4e3712){if(_['isNil'](_0x399237)){return _0x4e3712(handleCheckRowError(_0xd0e3('0x14'),_0xd0e3('0x18'),null,_0x254854));}if(_0x399237[_0xd0e3('0x19')]&&_0x399237['errors'][_0xd0e3('0x1a')]){var _0xe3c7ba=_[_0xd0e3('0x1b')](_0x399237[_0xd0e3('0x19')],_0xd0e3('0x1c'))[_0xd0e3('0x1d')](';');return _0x4e3712(handleCheckRowError(_0xd0e3('0x14'),_0xe3c7ba,null,_0x254854));}var _0x1c5130={};for(var _0x1bfd16 in FIELDS){if(FIELDS[_0xd0e3('0x1e')](_0x1bfd16)&&FIELDS[_0x1bfd16]){_0x1c5130[_0x1bfd16]=_0x399237[_0xd0e3('0x1f')][0x0][FIELDS[_0x1bfd16]]||_0x399237['data'][0x0]['\ufeff'+FIELDS[_0x1bfd16]];}}if(!_0x1c5130['firstName']){return _0x4e3712(handleCheckRowError(_0xd0e3('0x14'),'firstName\x20not\x20specified!',null,_0x254854));}if(!_0x1c5130[_0xd0e3('0x20')]){return _0x4e3712(handleCheckRowError(_0xd0e3('0x14'),'phone\x20not\x20specified!',null,_0x254854));}if(_0x1c5130[_0xd0e3('0x21')]){var _0x48d217=moment(_0x1c5130[_0xd0e3('0x21')],_0xd0e3('0x22'));if(!_0x48d217[_0xd0e3('0x23')]()){return _0x4e3712(handleCheckRowError(_0xd0e3('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x254854));}}if(_0x1c5130[_0xd0e3('0x24')]){if(!isEmail(_0x1c5130['email'])){return _0x4e3712(handleCheckRowError(_0xd0e3('0x14'),_0xd0e3('0x25'),null,_0x254854));}}_0x1c5130[_0xd0e3('0x26')]=LISTID;_0x1c5130['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0xdfec15){var _0x38c6fb={};for(var _0x35e38e=0x0,_0x24360e=DUPLICATES[_0xd0e3('0x1a')];_0x35e38e<_0x24360e;_0x35e38e+=0x1){_0x38c6fb[DUPLICATES[_0x35e38e]]=_0x1c5130[DUPLICATES[_0x35e38e]];}var _0x3331c8=_[_0xd0e3('0x27')](_0xdfec15,_0x38c6fb);if(_0x3331c8){return _0x4e3712(handleCheckRowError(_0xd0e3('0x28'),'Duplicate\x20Contact',_0x3331c8,_0x254854));}}return db['CmContact'][_0xd0e3('0x29')](_0x1c5130,{'raw':!![],'hooks':![],'fields':_[_0xd0e3('0x2a')](_0x1c5130)})[_0xd0e3('0x2b')](function(_0x28e60a){if(DUPLICATES&&DUPLICATES[_0xd0e3('0x1a')]&&_0xdfec15){_0xdfec15[_0xd0e3('0x2c')](_['pick'](_0x1c5130,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x28e60a['id'];return _0x289a6e();})[_0xd0e3('0x2d')](function(_0x41577f){return _0x4e3712(handleCheckRowError('error',_0xd0e3('0x2e')+(_0x41577f[_0xd0e3('0x1c')]||JSON[_0xd0e3('0x2f')](_0x41577f)),null,_0x254854));});});}function checkHopper(){function _0x92e594(){return function(_0x2e03c8){logger['error']('cmContact',_0xd0e3('0x30'),util['inspect'](_0x2e03c8,{'showHidden':![],'depth':null}));};}var _0x4e33f1=function(_0x658c55,_0xbbd8d0){var _0x33cd15=squel['insert']()[_0xd0e3('0x31')](_0xd0e3('0x32'))[_0xd0e3('0x33')]([_0xd0e3('0x20'),_0xd0e3('0x34'),_0xd0e3('0x35'),'ListId',_0xbbd8d0,_0xd0e3('0x36'),_0xd0e3('0x37')],squel[_0xd0e3('0x38')]()['field'](_0xd0e3('0x20'),_0xd0e3('0x20'))['field'](_0xd0e3('0x39'),_0xd0e3('0x34'))[_0xd0e3('0x3a')]('id',_0xd0e3('0x35'))[_0xd0e3('0x3a')](LISTID[_0xd0e3('0x3b')](),_0xd0e3('0x26'))[_0xd0e3('0x3a')](_0x658c55['id'][_0xd0e3('0x3b')](),_0xbbd8d0)[_0xd0e3('0x3a')](_0xd0e3('0x39'),_0xd0e3('0x36'))['field'](_0xd0e3('0x39'),'updatedAt')[_0xd0e3('0x3c')](_0xd0e3('0x3d'))[_0xd0e3('0x3e')](_0xd0e3('0x3f'))[_0xd0e3('0x3e')](_0xd0e3('0x40'),LISTID[_0xd0e3('0x3b')]())[_0xd0e3('0x3e')](_0xd0e3('0x41'))[_0xd0e3('0x3e')](_0xd0e3('0x42'),squel['select']()['field'](_0xd0e3('0x20'))[_0xd0e3('0x3c')](_0xd0e3('0x32'))['where'](_0xbbd8d0+_0xd0e3('0x43'),_0x658c55['id'][_0xd0e3('0x3b')]())))['toString']();return _0x33cd15;};var _0x358de9=function(_0x49588f,_0x15ae40){var _0x4c1447=squel[_0xd0e3('0x44')]()[_0xd0e3('0x31')]('cm_hopper')[_0xd0e3('0x33')]([_0xd0e3('0x20'),_0xd0e3('0x34'),_0xd0e3('0x35'),_0xd0e3('0x26'),_0x15ae40,_0xd0e3('0x36'),'updatedAt'],squel[_0xd0e3('0x38')]()[_0xd0e3('0x3a')](_0xd0e3('0x20'),_0xd0e3('0x20'))['field'](_0xd0e3('0x39'),'scheduledAt')[_0xd0e3('0x3a')]('id','ContactId')[_0xd0e3('0x3a')](LISTID[_0xd0e3('0x3b')](),_0xd0e3('0x26'))[_0xd0e3('0x3a')](_0x49588f['id'][_0xd0e3('0x3b')](),_0x15ae40)[_0xd0e3('0x3a')]('NOW()','createdAt')[_0xd0e3('0x3a')](_0xd0e3('0x39'),'updatedAt')['from'](_0xd0e3('0x3d'))[_0xd0e3('0x3e')](_0xd0e3('0x3f'))[_0xd0e3('0x3e')](_0xd0e3('0x40'),LISTID[_0xd0e3('0x3b')]())[_0xd0e3('0x3e')](_0xd0e3('0x45'),squel[_0xd0e3('0x46')](hopperContacts))[_0xd0e3('0x3e')](_0xd0e3('0x41'))[_0xd0e3('0x3e')](_0xd0e3('0x42'),squel[_0xd0e3('0x38')]()[_0xd0e3('0x3a')](_0xd0e3('0x47'))[_0xd0e3('0x3c')](_0xd0e3('0x48'))[_0xd0e3('0x3e')](_0x15ae40+_0xd0e3('0x43'),_0x49588f['id'][_0xd0e3('0x3b')]()))[_0xd0e3('0x3e')](_0xd0e3('0x42'),squel[_0xd0e3('0x38')]()[_0xd0e3('0x3a')](_0xd0e3('0x20'))[_0xd0e3('0x3c')]('cm_hopper')[_0xd0e3('0x3e')](_0x15ae40+'\x20=\x20?',_0x49588f['id'][_0xd0e3('0x3b')]())))[_0xd0e3('0x3b')]();return _0x4c1447;};function _0x83a1b8(_0x30acc6,_0x5daca6){var _0x2c3324=squel[_0xd0e3('0x44')]()[_0xd0e3('0x31')]('cm_hopper')[_0xd0e3('0x33')]([_0xd0e3('0x20'),'scheduledAt',_0xd0e3('0x35'),_0xd0e3('0x26'),_0x5daca6,_0xd0e3('0x36'),_0xd0e3('0x37')],squel[_0xd0e3('0x38')]()['field']('phone','phone')[_0xd0e3('0x3a')](_0xd0e3('0x39'),'scheduledAt')[_0xd0e3('0x3a')]('id',_0xd0e3('0x35'))['field'](LISTID[_0xd0e3('0x3b')](),_0xd0e3('0x26'))[_0xd0e3('0x3a')](_0x30acc6['id'][_0xd0e3('0x3b')](),_0x5daca6)[_0xd0e3('0x3a')](_0xd0e3('0x39'),_0xd0e3('0x36'))['field'](_0xd0e3('0x39'),_0xd0e3('0x37'))[_0xd0e3('0x3c')](_0xd0e3('0x3d'))[_0xd0e3('0x3e')](_0xd0e3('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0xd0e3('0x3b')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0xd0e3('0x3e')](_0xd0e3('0x41')))['toString']();return _0x2c3324;}function _0x3903dd(_0x385e1b,_0x243bd5){var _0x431d67=squel['insert']()[_0xd0e3('0x31')](_0xd0e3('0x49'))[_0xd0e3('0x33')]([_0xd0e3('0x20'),'ContactId',_0xd0e3('0x26'),_0x243bd5,_0xd0e3('0x36'),_0xd0e3('0x37')],squel[_0xd0e3('0x38')]()[_0xd0e3('0x3a')](_0xd0e3('0x20'),'phone')[_0xd0e3('0x3a')]('id',_0xd0e3('0x35'))[_0xd0e3('0x3a')](LISTID[_0xd0e3('0x3b')](),_0xd0e3('0x26'))[_0xd0e3('0x3a')](_0x385e1b['id'][_0xd0e3('0x3b')](),_0x243bd5)['field']('NOW()',_0xd0e3('0x36'))[_0xd0e3('0x3a')](_0xd0e3('0x39'),_0xd0e3('0x37'))[_0xd0e3('0x3c')](_0xd0e3('0x3d'))[_0xd0e3('0x3e')](_0xd0e3('0x3f'))[_0xd0e3('0x3e')](_0xd0e3('0x40'),LISTID[_0xd0e3('0x3b')]())['where'](_0xd0e3('0x45'),squel['str'](hopperContacts))[_0xd0e3('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xd0e3('0x3b')]();return _0x431d67;}return db[_0xd0e3('0x4a')]['findAll']({'where':{'type':_0xd0e3('0x4b')},'attributes':['id',_0xd0e3('0x4c')],'include':[{'model':db[_0xd0e3('0x4d')],'as':_0xd0e3('0x4e'),'where':{'id':LISTID}}]})[_0xd0e3('0x2b')](function(_0x3f49d8){var _0x419431=[];if(_0x3f49d8){var _0x4f3b9e;for(var _0xad6c21=0x0,_0x4738c3;_0xad6c21<_0x3f49d8['length'];_0xad6c21+=0x1){_0x4738c3=_0x3f49d8[_0xad6c21][_0xd0e3('0x4f')]({'plain':!![]});switch(_0x4738c3[_0xd0e3('0x4c')]){case _0xd0e3('0x50'):_0x419431[_0xd0e3('0x2c')](db['sequelize'][_0xd0e3('0x51')](_0x358de9(_0x4738c3,_0xd0e3('0x52')))[_0xd0e3('0x2b')](function(){})[_0xd0e3('0x2d')](_0x92e594()));break;case _0xd0e3('0x53'):_0x419431[_0xd0e3('0x2c')](db[_0xd0e3('0x54')]['query'](_0x4e33f1(_0x4738c3,_0xd0e3('0x52')))[_0xd0e3('0x2b')](function(){})[_0xd0e3('0x2d')](_0x92e594()));break;default:_0x419431[_0xd0e3('0x2c')](db[_0xd0e3('0x54')][_0xd0e3('0x51')](_0x83a1b8(_0x4738c3,_0xd0e3('0x52')))['then'](function(){})[_0xd0e3('0x2d')](_0x92e594()));}}}return _0x419431;})['all']()[_0xd0e3('0x2b')](function(){return db[_0xd0e3('0x4a')]['findAll']({'where':{'type':_0xd0e3('0x4b')},'attributes':['id'],'include':[{'model':db[_0xd0e3('0x4d')],'as':_0xd0e3('0x55'),'where':{'id':LISTID}}]})[_0xd0e3('0x2b')](function(_0x18ad7b){var _0x3dc72b=[];if(_0x18ad7b){var _0x1e656e;for(var _0x54030e=0x0,_0x185e86;_0x54030e<_0x18ad7b[_0xd0e3('0x1a')];_0x54030e+=0x1){_0x185e86=_0x18ad7b[_0x54030e][_0xd0e3('0x4f')]({'plain':!![]});_0x3dc72b['push'](db[_0xd0e3('0x54')][_0xd0e3('0x51')](_0x3903dd(_0x185e86,_0xd0e3('0x52')))[_0xd0e3('0x2b')](function(){})[_0xd0e3('0x2d')](_0x92e594()));}}return _0x3dc72b;})['all']();})['then'](function(){return db[_0xd0e3('0x56')][_0xd0e3('0x57')]({'attributes':['id',_0xd0e3('0x4c')],'include':[{'model':db[_0xd0e3('0x4d')],'as':_0xd0e3('0x4e'),'where':{'id':LISTID}}]})[_0xd0e3('0x2b')](function(_0x225687){var _0x56024e=[];if(_0x225687){for(var _0x51f562=0x0,_0x5966e3;_0x51f562<_0x225687[_0xd0e3('0x1a')];_0x51f562+=0x1){_0x5966e3=_0x225687[_0x51f562][_0xd0e3('0x4f')]({'plain':!![]});switch(_0x5966e3[_0xd0e3('0x4c')]){case'always':_0x56024e[_0xd0e3('0x2c')](db['sequelize'][_0xd0e3('0x51')](_0x358de9(_0x5966e3,_0xd0e3('0x58')))[_0xd0e3('0x2b')](function(){})['catch'](_0x92e594()));break;case'onlyIfOpen':_0x56024e['push'](db[_0xd0e3('0x54')][_0xd0e3('0x51')](_0x4e33f1(_0x5966e3,_0xd0e3('0x58')))['then'](function(){})[_0xd0e3('0x2d')](_0x92e594()));break;default:_0x56024e[_0xd0e3('0x2c')](db[_0xd0e3('0x54')][_0xd0e3('0x51')](_0x83a1b8(_0x5966e3,_0xd0e3('0x58')))[_0xd0e3('0x2b')](function(){})[_0xd0e3('0x2d')](_0x92e594()));}}}return _0x56024e;})[_0xd0e3('0x59')]();})[_0xd0e3('0x2b')](function(){return db[_0xd0e3('0x56')][_0xd0e3('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd0e3('0x2b')](function(_0x32fed5){var _0x3034d5=[];if(_0x32fed5){for(var _0x4faaba=0x0,_0x15f57e;_0x4faaba<_0x32fed5[_0xd0e3('0x1a')];_0x4faaba+=0x1){_0x15f57e=_0x32fed5[_0x4faaba][_0xd0e3('0x4f')]({'plain':!![]});_0x3034d5[_0xd0e3('0x2c')](db['sequelize'][_0xd0e3('0x51')](_0x3903dd(_0x15f57e,'CampaignId'))['then'](function(){})[_0xd0e3('0x2d')](_0x92e594()));}}return _0x3034d5;})['all']();})[_0xd0e3('0x2d')](function(_0x3477fd){logger[_0xd0e3('0x14')](_0xd0e3('0x5a'),_0xd0e3('0x5b'),_0x3477fd[_0xd0e3('0x1c')]);});}var processPromises=function(_0x2d56c5){return BPromise['all'](promises)[_0xd0e3('0x2b')](function(_0xf89146){})['catch'](function(_0x2a0fea){logger[_0xd0e3('0x14')](_0xd0e3('0x5c'),JSON['stringify'](_0x2a0fea));})[_0xd0e3('0x5d')](function(){socket[_0xd0e3('0x5e')](_0xd0e3('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2d56c5){return _0x2d56c5['resume']();}});};var endCsv=function(){return BPromise[_0xd0e3('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xd0e3('0x2b')](function(){socket[_0xd0e3('0x5e')](_0xd0e3('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd0e3('0x61')](FILEPATH);}catch(_0x423931){logger['error'](_0xd0e3('0x62'),JSON[_0xd0e3('0x2f')](_0x423931));}finally{process[_0xd0e3('0x63')](0x0);}});};process['on'](_0xd0e3('0x64'),function(){logger[_0xd0e3('0x65')](_0xd0e3('0x66'));endCsv();});function main(){return BPromise[_0xd0e3('0x60')]()[_0xd0e3('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xd0e3('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x43f566){var _0x38ed0b=fs[_0xd0e3('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x38ed0b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x34bdfb,_0x48a3e1){total+=0x1;var _0x2058df=total;promises[_0xd0e3('0x2c')](checkRow(_0x34bdfb,_0x43f566,_0x2058df)[_0xd0e3('0x2b')](function(){success+=0x1;})[_0xd0e3('0x2d')](function(_0x2ee484){if(_0x2ee484[_0xd0e3('0x14')]){errors+=0x1;delete _0x2ee484[_0xd0e3('0x14')];}else if(_0x2ee484['duplicate']){duplicates+=0x1;delete _0x2ee484[_0xd0e3('0x28')];}rows['push'](_0x2ee484);}));if(total%0xc8===0x0){_0x48a3e1[_0xd0e3('0x68')]();return processPromises(_0x48a3e1);}},'complete':function(){return processPromises()[_0xd0e3('0x2b')](function(){logger[_0xd0e3('0x65')](_0xd0e3('0x69'));endCsv();});},'error':function(_0x1c0d73,_0x49021f){logger['info'](_0xd0e3('0x6a'),JSON[_0xd0e3('0x2f')](_0x1c0d73));endCsv();}});})['catch'](function(_0x10baf4){logger[_0xd0e3('0x14')](_0xd0e3('0x6b'),JSON['stringify'](_0x10baf4));});}main(); \ No newline at end of file +var _0xbc4a=['Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','papaparse','ioredis','../../../config/environment','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','select','field','NOW()','toString','createdAt','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','scheduledAt','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','VoiceQueueId','catch','sequelize','query','all','BlackLists','Lists','CampaignId'];(function(_0x532a08,_0x1079ab){var _0xd9c5ee=function(_0x1ce50c){while(--_0x1ce50c){_0x532a08['push'](_0x532a08['shift']());}};_0xd9c5ee(++_0x1079ab);}(_0xbc4a,0x15b));var _0xabc4=function(_0x56a5a7,_0x4a34dc){_0x56a5a7=_0x56a5a7-0x0;var _0x3bba82=_0xbc4a[_0x56a5a7];return _0x3bba82;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0xabc4('0x0'));var Redis=require(_0xabc4('0x1'));var db=require('../../../mysqldb')['db'];var config=require(_0xabc4('0x2'));var logger=require('../../../config/logger')(_0xabc4('0x3'));config['redis']=_[_0xabc4('0x4')](config[_0xabc4('0x5')],{'host':_0xabc4('0x6'),'port':0x18eb});var socket=require(_0xabc4('0x7'))(new Redis(config['redis']));require(_0xabc4('0x8'))[_0xabc4('0x9')](socket);try{if(!process[_0xabc4('0xa')][0x2]||process[_0xabc4('0xa')][0x2]===_0xabc4('0xb')||process[_0xabc4('0xa')][0x2]===_0xabc4('0xc')){throw new Error(_0xabc4('0xd'));}var FILEPATH=process[_0xabc4('0xa')][0x2];if(!process[_0xabc4('0xa')][0x3]||process[_0xabc4('0xa')][0x3]==='undefined'||process[_0xabc4('0xa')][0x3]===_0xabc4('0xc')||!process[_0xabc4('0xa')][0x4]||process[_0xabc4('0xa')][0x4]===_0xabc4('0xb')||process[_0xabc4('0xa')][0x4]===_0xabc4('0xc')){throw new Error(_0xabc4('0xe'));}var FIELDS=_['zipObject'](process[_0xabc4('0xa')][0x3][_0xabc4('0xf')](','),process[_0xabc4('0xa')][0x4][_0xabc4('0xf')](','));if(!process[_0xabc4('0xa')][0x5]||process[_0xabc4('0xa')][0x5]===_0xabc4('0xb')||process[_0xabc4('0xa')][0x5]===_0xabc4('0xc')){throw new Error(_0xabc4('0x10'));}var LISTID=process[_0xabc4('0xa')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xabc4('0xa')][0x6]!==_0xabc4('0xb')&&process[_0xabc4('0xa')][0x6]!=='null'?process[_0xabc4('0xa')][0x6]:null;var DUPLICATES=process[_0xabc4('0xa')][0x7]&&process[_0xabc4('0xa')][0x7]!==_0xabc4('0xb')&&process[_0xabc4('0xa')][0x7]!=='null'?process[_0xabc4('0xa')][0x7]:null;if(!process[_0xabc4('0xa')][0x8]||process[_0xabc4('0xa')][0x8]===_0xabc4('0xb')||process[_0xabc4('0xa')][0x8]===_0xabc4('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x5d37bf){logger[_0xabc4('0x11')](_0x5d37bf);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(_0x471de1,_0x107095,_0x4475ed,_0x5cac84){var _0x4b4b52={'message':_0x107095};_0x4b4b52[_0x471de1]=!![];if(_0x4475ed){_0x4b4b52[_0xabc4('0x12')]=_0x4475ed;}if(_0x5cac84){_0x4b4b52[_0xabc4('0x13')]=_0x5cac84;}return _0x4b4b52;}function isEmail(_0x153b65){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))*$/[_0xabc4('0x14')](_0x153b65);}function checkRow(_0x4f3b32,_0x42dc5d,_0x4735e7){return new BPromise(function(_0x1d8561,_0x20568e){if(_[_0xabc4('0x15')](_0x4f3b32)){return _0x20568e(handleCheckRowError(_0xabc4('0x11'),_0xabc4('0x16'),null,_0x4735e7));}if(_0x4f3b32[_0xabc4('0x17')]&&_0x4f3b32[_0xabc4('0x17')]['length']){var _0x476949=_[_0xabc4('0x18')](_0x4f3b32[_0xabc4('0x17')],_0xabc4('0x19'))[_0xabc4('0x1a')](';');return _0x20568e(handleCheckRowError('error',_0x476949,null,_0x4735e7));}var _0x121ade={};for(var _0x1aca6e in FIELDS){if(FIELDS['hasOwnProperty'](_0x1aca6e)&&FIELDS[_0x1aca6e]){_0x121ade[_0x1aca6e]=_0x4f3b32[_0xabc4('0x1b')][0x0][FIELDS[_0x1aca6e]]||_0x4f3b32[_0xabc4('0x1b')][0x0]['\ufeff'+FIELDS[_0x1aca6e]];}}if(!_0x121ade['firstName']){return _0x20568e(handleCheckRowError(_0xabc4('0x11'),_0xabc4('0x1c'),null,_0x4735e7));}if(!_0x121ade[_0xabc4('0x1d')]){return _0x20568e(handleCheckRowError(_0xabc4('0x11'),_0xabc4('0x1e'),null,_0x4735e7));}if(_0x121ade[_0xabc4('0x1f')]){var _0xeac58e=moment(_0x121ade[_0xabc4('0x1f')],'YYYY-MM-DD');if(!_0xeac58e['isValid']()){return _0x20568e(handleCheckRowError(_0xabc4('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4735e7));}}if(_0x121ade['email']){if(!isEmail(_0x121ade[_0xabc4('0x20')])){return _0x20568e(handleCheckRowError(_0xabc4('0x11'),_0xabc4('0x21'),null,_0x4735e7));}}_0x121ade[_0xabc4('0x22')]=LISTID;_0x121ade[_0xabc4('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x42dc5d){var _0x365fd8={};for(var _0x52d525=0x0,_0x1b8f3b=DUPLICATES[_0xabc4('0x24')];_0x52d525<_0x1b8f3b;_0x52d525+=0x1){_0x365fd8[DUPLICATES[_0x52d525]]=_0x121ade[DUPLICATES[_0x52d525]];}var _0x4e2038=_[_0xabc4('0x25')](_0x42dc5d,_0x365fd8);if(_0x4e2038){return _0x20568e(handleCheckRowError(_0xabc4('0x26'),_0xabc4('0x27'),_0x4e2038,_0x4735e7));}}return db['CmContact'][_0xabc4('0x28')](_0x121ade,{'raw':!![],'hooks':![],'fields':_[_0xabc4('0x29')](_0x121ade)})[_0xabc4('0x2a')](function(_0xc9fb0b){if(DUPLICATES&&DUPLICATES[_0xabc4('0x24')]&&_0x42dc5d){_0x42dc5d[_0xabc4('0x2b')](_[_0xabc4('0x2c')](_0x121ade,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc9fb0b['id'];return _0x1d8561();})['catch'](function(_0x450db0){return _0x20568e(handleCheckRowError(_0xabc4('0x11'),_0xabc4('0x2d')+(_0x450db0[_0xabc4('0x19')]||JSON[_0xabc4('0x2e')](_0x450db0)),null,_0x4735e7));});});}function checkHopper(){function _0x854758(){return function(_0x347c5b){logger[_0xabc4('0x11')]('cmContact',_0xabc4('0x2f'),util[_0xabc4('0x30')](_0x347c5b,{'showHidden':![],'depth':null}));};}var _0x383be8=function(_0x85f1eb,_0x43e15e){var _0x1e9088=squel[_0xabc4('0x31')]()[_0xabc4('0x32')](_0xabc4('0x33'))[_0xabc4('0x34')]([_0xabc4('0x1d'),'scheduledAt',_0xabc4('0x35'),'ListId',_0x43e15e,'createdAt','updatedAt'],squel[_0xabc4('0x36')]()[_0xabc4('0x37')](_0xabc4('0x1d'),_0xabc4('0x1d'))[_0xabc4('0x37')](_0xabc4('0x38'),'scheduledAt')[_0xabc4('0x37')]('id',_0xabc4('0x35'))['field'](LISTID[_0xabc4('0x39')](),_0xabc4('0x22'))['field'](_0x85f1eb['id'][_0xabc4('0x39')](),_0x43e15e)['field'](_0xabc4('0x38'),_0xabc4('0x3a'))[_0xabc4('0x37')]('NOW()',_0xabc4('0x3b'))['from'](_0xabc4('0x3c'))[_0xabc4('0x3d')](_0xabc4('0x3e'))[_0xabc4('0x3d')](_0xabc4('0x3f'),LISTID[_0xabc4('0x39')]())[_0xabc4('0x3d')](_0xabc4('0x40'))['where'](_0xabc4('0x41'),squel['select']()[_0xabc4('0x37')](_0xabc4('0x1d'))[_0xabc4('0x42')]('cm_hopper')['where'](_0x43e15e+_0xabc4('0x43'),_0x85f1eb['id'][_0xabc4('0x39')]())))[_0xabc4('0x39')]();return _0x1e9088;};var _0x36a203=function(_0x3292ed,_0x4b047d){var _0x2d7b73=squel[_0xabc4('0x31')]()[_0xabc4('0x32')]('cm_hopper')['fromQuery']([_0xabc4('0x1d'),'scheduledAt',_0xabc4('0x35'),_0xabc4('0x22'),_0x4b047d,'createdAt',_0xabc4('0x3b')],squel[_0xabc4('0x36')]()[_0xabc4('0x37')](_0xabc4('0x1d'),_0xabc4('0x1d'))[_0xabc4('0x37')](_0xabc4('0x38'),_0xabc4('0x44'))['field']('id',_0xabc4('0x35'))[_0xabc4('0x37')](LISTID[_0xabc4('0x39')](),'ListId')[_0xabc4('0x37')](_0x3292ed['id'][_0xabc4('0x39')](),_0x4b047d)[_0xabc4('0x37')](_0xabc4('0x38'),_0xabc4('0x3a'))['field'](_0xabc4('0x38'),_0xabc4('0x3b'))['from'](_0xabc4('0x3c'))[_0xabc4('0x3d')](_0xabc4('0x3e'))['where']('ListId\x20=\x20?',LISTID[_0xabc4('0x39')]())['where']('id\x20IN\x20?',squel[_0xabc4('0x45')](hopperContacts))[_0xabc4('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xabc4('0x41'),squel[_0xabc4('0x36')]()[_0xabc4('0x37')](_0xabc4('0x46'))[_0xabc4('0x42')](_0xabc4('0x47'))[_0xabc4('0x3d')](_0x4b047d+_0xabc4('0x43'),_0x3292ed['id'][_0xabc4('0x39')]()))[_0xabc4('0x3d')](_0xabc4('0x41'),squel[_0xabc4('0x36')]()['field']('phone')[_0xabc4('0x42')]('cm_hopper')[_0xabc4('0x3d')](_0x4b047d+'\x20=\x20?',_0x3292ed['id'][_0xabc4('0x39')]())))['toString']();return _0x2d7b73;};function _0x1f04bb(_0x3bc9c2,_0x3128f9){var _0x4e9a32=squel[_0xabc4('0x31')]()['into']('cm_hopper')['fromQuery']([_0xabc4('0x1d'),_0xabc4('0x44'),_0xabc4('0x35'),_0xabc4('0x22'),_0x3128f9,_0xabc4('0x3a'),_0xabc4('0x3b')],squel[_0xabc4('0x36')]()[_0xabc4('0x37')](_0xabc4('0x1d'),'phone')[_0xabc4('0x37')]('NOW()',_0xabc4('0x44'))[_0xabc4('0x37')]('id',_0xabc4('0x35'))[_0xabc4('0x37')](LISTID[_0xabc4('0x39')](),_0xabc4('0x22'))[_0xabc4('0x37')](_0x3bc9c2['id'][_0xabc4('0x39')](),_0x3128f9)[_0xabc4('0x37')](_0xabc4('0x38'),_0xabc4('0x3a'))[_0xabc4('0x37')](_0xabc4('0x38'),_0xabc4('0x3b'))[_0xabc4('0x42')](_0xabc4('0x3c'))[_0xabc4('0x3d')](_0xabc4('0x3e'))['where'](_0xabc4('0x3f'),LISTID[_0xabc4('0x39')]())[_0xabc4('0x3d')](_0xabc4('0x48'),squel[_0xabc4('0x45')](hopperContacts))[_0xabc4('0x3d')](_0xabc4('0x40')))[_0xabc4('0x39')]();return _0x4e9a32;}function _0x115027(_0x1f749e,_0x162376){var _0x2025fe=squel['insert']()[_0xabc4('0x32')](_0xabc4('0x49'))[_0xabc4('0x34')]([_0xabc4('0x1d'),_0xabc4('0x35'),_0xabc4('0x22'),_0x162376,_0xabc4('0x3a'),_0xabc4('0x3b')],squel['select']()[_0xabc4('0x37')](_0xabc4('0x1d'),_0xabc4('0x1d'))[_0xabc4('0x37')]('id',_0xabc4('0x35'))['field'](LISTID[_0xabc4('0x39')](),_0xabc4('0x22'))['field'](_0x1f749e['id'][_0xabc4('0x39')](),_0x162376)[_0xabc4('0x37')](_0xabc4('0x38'),_0xabc4('0x3a'))['field'](_0xabc4('0x38'),_0xabc4('0x3b'))[_0xabc4('0x42')](_0xabc4('0x3c'))[_0xabc4('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xabc4('0x39')]())[_0xabc4('0x3d')](_0xabc4('0x48'),squel[_0xabc4('0x45')](hopperContacts))[_0xabc4('0x3d')](_0xabc4('0x40')))['toString']();return _0x2025fe;}return db[_0xabc4('0x4a')][_0xabc4('0x4b')]({'where':{'type':_0xabc4('0x4c')},'attributes':['id',_0xabc4('0x4d')],'include':[{'model':db[_0xabc4('0x4e')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x35b5db){var _0x9980a9=[];if(_0x35b5db){var _0x34adb7;for(var _0x3579b5=0x0,_0x1b523f;_0x3579b5<_0x35b5db[_0xabc4('0x24')];_0x3579b5+=0x1){_0x1b523f=_0x35b5db[_0x3579b5][_0xabc4('0x4f')]({'plain':!![]});switch(_0x1b523f[_0xabc4('0x4d')]){case _0xabc4('0x50'):_0x9980a9['push'](db['sequelize']['query'](_0x36a203(_0x1b523f,_0xabc4('0x51')))[_0xabc4('0x2a')](function(){})[_0xabc4('0x52')](_0x854758()));break;case'onlyIfOpen':_0x9980a9[_0xabc4('0x2b')](db[_0xabc4('0x53')][_0xabc4('0x54')](_0x383be8(_0x1b523f,_0xabc4('0x51')))[_0xabc4('0x2a')](function(){})[_0xabc4('0x52')](_0x854758()));break;default:_0x9980a9[_0xabc4('0x2b')](db['sequelize'][_0xabc4('0x54')](_0x1f04bb(_0x1b523f,_0xabc4('0x51')))[_0xabc4('0x2a')](function(){})['catch'](_0x854758()));}}}return _0x9980a9;})[_0xabc4('0x55')]()['then'](function(){return db['VoiceQueue'][_0xabc4('0x4b')]({'where':{'type':_0xabc4('0x4c')},'attributes':['id'],'include':[{'model':db[_0xabc4('0x4e')],'as':_0xabc4('0x56'),'where':{'id':LISTID}}]})[_0xabc4('0x2a')](function(_0x2e90b2){var _0x36c448=[];if(_0x2e90b2){var _0x4d1050;for(var _0x5b1b14=0x0,_0x50ef75;_0x5b1b14<_0x2e90b2[_0xabc4('0x24')];_0x5b1b14+=0x1){_0x50ef75=_0x2e90b2[_0x5b1b14]['get']({'plain':!![]});_0x36c448[_0xabc4('0x2b')](db[_0xabc4('0x53')][_0xabc4('0x54')](_0x115027(_0x50ef75,_0xabc4('0x51')))[_0xabc4('0x2a')](function(){})['catch'](_0x854758()));}}return _0x36c448;})[_0xabc4('0x55')]();})[_0xabc4('0x2a')](function(){return db['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xabc4('0x4e')],'as':_0xabc4('0x57'),'where':{'id':LISTID}}]})[_0xabc4('0x2a')](function(_0x53397d){var _0x43eb65=[];if(_0x53397d){for(var _0x2c0942=0x0,_0x5ab6e7;_0x2c0942<_0x53397d['length'];_0x2c0942+=0x1){_0x5ab6e7=_0x53397d[_0x2c0942][_0xabc4('0x4f')]({'plain':!![]});switch(_0x5ab6e7[_0xabc4('0x4d')]){case _0xabc4('0x50'):_0x43eb65[_0xabc4('0x2b')](db[_0xabc4('0x53')][_0xabc4('0x54')](_0x36a203(_0x5ab6e7,_0xabc4('0x58')))[_0xabc4('0x2a')](function(){})[_0xabc4('0x52')](_0x854758()));break;case'onlyIfOpen':_0x43eb65['push'](db[_0xabc4('0x53')]['query'](_0x383be8(_0x5ab6e7,_0xabc4('0x58')))[_0xabc4('0x2a')](function(){})[_0xabc4('0x52')](_0x854758()));break;default:_0x43eb65[_0xabc4('0x2b')](db[_0xabc4('0x53')][_0xabc4('0x54')](_0x1f04bb(_0x5ab6e7,_0xabc4('0x58')))[_0xabc4('0x2a')](function(){})['catch'](_0x854758()));}}}return _0x43eb65;})[_0xabc4('0x55')]();})[_0xabc4('0x2a')](function(){return db[_0xabc4('0x59')][_0xabc4('0x4b')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xabc4('0x56'),'where':{'id':LISTID}}]})[_0xabc4('0x2a')](function(_0x587102){var _0x437fa7=[];if(_0x587102){for(var _0x13d2d9=0x0,_0x149bd8;_0x13d2d9<_0x587102[_0xabc4('0x24')];_0x13d2d9+=0x1){_0x149bd8=_0x587102[_0x13d2d9][_0xabc4('0x4f')]({'plain':!![]});_0x437fa7[_0xabc4('0x2b')](db[_0xabc4('0x53')][_0xabc4('0x54')](_0x115027(_0x149bd8,'CampaignId'))[_0xabc4('0x2a')](function(){})['catch'](_0x854758()));}}return _0x437fa7;})[_0xabc4('0x55')]();})[_0xabc4('0x52')](function(_0x1a7364){logger['error'](_0xabc4('0x5a'),_0xabc4('0x5b'),_0x1a7364['message']);});}var processPromises=function(_0xc19e73){return BPromise[_0xabc4('0x55')](promises)[_0xabc4('0x2a')](function(_0x2dccc1){})['catch'](function(_0x4807de){logger[_0xabc4('0x11')](_0xabc4('0x5c'),JSON['stringify'](_0x4807de));})[_0xabc4('0x5d')](function(){socket[_0xabc4('0x5e')](_0xabc4('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xc19e73){return _0xc19e73[_0xabc4('0x60')]();}});};var endCsv=function(){return BPromise[_0xabc4('0x61')]()[_0xabc4('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xabc4('0x2a')](function(){socket[_0xabc4('0x5e')](_0xabc4('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xabc4('0x62')](FILEPATH);}catch(_0x471db7){logger[_0xabc4('0x11')](_0xabc4('0x63'),JSON[_0xabc4('0x2e')](_0x471db7));}finally{process[_0xabc4('0x64')](0x0);}});};process['on'](_0xabc4('0x65'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xabc4('0x61')]()[_0xabc4('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xabc4('0xf')](',');return db[_0xabc4('0x66')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x42ee19){var _0x59849d=fs[_0xabc4('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xabc4('0x68')](_0x59849d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4e8334,_0x5cdcad){total+=0x1;var _0x5fbdce=total;promises[_0xabc4('0x2b')](checkRow(_0x4e8334,_0x42ee19,_0x5fbdce)[_0xabc4('0x2a')](function(){success+=0x1;})['catch'](function(_0x3bed0f){if(_0x3bed0f[_0xabc4('0x11')]){errors+=0x1;delete _0x3bed0f[_0xabc4('0x11')];}else if(_0x3bed0f[_0xabc4('0x26')]){duplicates+=0x1;delete _0x3bed0f[_0xabc4('0x26')];}rows[_0xabc4('0x2b')](_0x3bed0f);}));if(total%0xc8===0x0){_0x5cdcad[_0xabc4('0x69')]();return processPromises(_0x5cdcad);}},'complete':function(){return processPromises()[_0xabc4('0x2a')](function(){logger[_0xabc4('0x6a')](_0xabc4('0x6b'));endCsv();});},'error':function(_0x42f49d,_0x3bddb1){logger['info'](_0xabc4('0x6c'),JSON['stringify'](_0x42f49d));endCsv();}});})[_0xabc4('0x52')](function(_0x5e8907){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xabc4('0x2e')](_0x5e8907));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e212bfc..bcf22e1 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 _0x1d13=['email','dateOfBirth','isValid','firstName','length','rows','contact:import:','abort','SystemError','message','error','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','scheduledat',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','path','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','localhost','socket.io-emitter','format','test','select','field','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','insert','into','fromQuery','phone','ListId','createdAt','updatedAt','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_hopper_black','.CmListId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','push','sequelize','query','spread','catch','main','stringify','start','binding','root','server/files/tmp','.csv','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','agent\x20not\x20exists'];(function(_0x18b007,_0x2cc6a8){var _0x28d255=function(_0x1b6c9f){while(--_0x1b6c9f){_0x18b007['push'](_0x18b007['shift']());}};_0x28d255(++_0x2cc6a8);}(_0x1d13,0x11f));var _0x31d1=function(_0x2e702a,_0x590b3b){_0x2e702a=_0x2e702a-0x0;var _0x4a73c4=_0x1d13[_0x2e702a];return _0x4a73c4;};'use strict';var fs=require('fs');var path=require(_0x31d1('0x0'));var _=require('lodash');var Papa=require(_0x31d1('0x1'));var util=require(_0x31d1('0x2'));var BPromise=require(_0x31d1('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x31d1('0x4'));var db=require(_0x31d1('0x5'))['db'];var config=require(_0x31d1('0x6'));var logger=require('../../../config/logger')('import');config[_0x31d1('0x7')]=_[_0x31d1('0x8')](config[_0x31d1('0x7')],{'host':_0x31d1('0x9'),'port':0x18eb});var socket=require(_0x31d1('0xa'))(new Redis(config[_0x31d1('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x31d1('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5e3246){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))*$/[_0x31d1('0xc')](_0x5e3246);}function selectNotIn(_0x45abcc,_0x932149,_0xfae3dd,_0x15c043,_0x434db7){return squel[_0x31d1('0xd')]()[_0x31d1('0xe')]('phone')[_0x31d1('0xf')](_0x15c043)['join'](_0x932149,null,_0x932149+_0x31d1('0x10')+_0x15c043+'.'+_0xfae3dd)['where'](_0x15c043+'.'+_0xfae3dd+_0x31d1('0x11')+_0x45abcc+'.'+_0xfae3dd)['where'](_0x932149+_0x31d1('0x12')+_0x434db7[_0x31d1('0x13')]()+')');}function insertCmHopper(_0xd20127,_0x3d8047,_0x1f44dd,_0x3df35f,_0x41c745){var _0x15c8c8=[_0x31d1('0x14'),_0x31d1('0x15'),_0x31d1('0x16'),'cm_contacts.ListId',_0x3d8047+'.'+_0x3df35f,'cm_contacts.createdAt',_0x31d1('0x17'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x41c745+'\x22'];return squel[_0x31d1('0x18')]()[_0x31d1('0x19')]('cm_hopper')[_0x31d1('0x1a')]([_0x31d1('0x1b'),'scheduledat','ContactId',_0x31d1('0x1c'),_0x3df35f,_0x31d1('0x1d'),_0x31d1('0x1e'),'priority',_0x31d1('0x1f'),'recallme'],squel[_0x31d1('0xd')]()[_0x31d1('0x20')](_0x15c8c8)[_0x31d1('0xf')](_0x3d8047)['join'](_0x31d1('0x21'),null,_0x31d1('0x22')+_0x3d8047+'.CmListId')[_0x31d1('0x13')](_0x1f44dd,null,_0x1f44dd+'.id\x20=\x20'+_0x3d8047+'.'+_0x3df35f)[_0x31d1('0x23')](_0x3d8047+_0x31d1('0x24'),_0xd20127)['where'](_0x31d1('0x25'),NOW)[_0x31d1('0x23')](_0x31d1('0x26'),selectNotIn(_0x3d8047,_0x1f44dd,_0x3df35f,'cm_hopper',[_0x31d1('0x27'),_0x31d1('0x28')]))['where'](_0x31d1('0x26'),selectNotIn(_0x3d8047,_0x1f44dd,_0x3df35f,'cm_hopper',[_0x31d1('0x27')])))[_0x31d1('0x29')]();}function insertCmHopperBlack(_0x3f6c62,_0x2e4f13,_0x210fcd,_0x4b9ed6){var _0x489edb=['cm_contacts.phone',_0x31d1('0x16'),_0x31d1('0x2a'),_0x2e4f13+'.'+_0x4b9ed6,'cm_contacts.createdAt',_0x31d1('0x17')];return squel[_0x31d1('0x18')]()[_0x31d1('0x19')](_0x31d1('0x2b'))[_0x31d1('0x1a')]([_0x31d1('0x1b'),'ContactId',_0x31d1('0x1c'),_0x4b9ed6,_0x31d1('0x1d'),_0x31d1('0x1e')],squel[_0x31d1('0xd')]()[_0x31d1('0x20')](_0x489edb)[_0x31d1('0xf')](_0x2e4f13)[_0x31d1('0x13')]('cm_contacts',null,_0x31d1('0x22')+_0x2e4f13+_0x31d1('0x2c'))[_0x31d1('0x13')](_0x210fcd,null,_0x210fcd+_0x31d1('0x10')+_0x2e4f13+'.'+_0x4b9ed6)[_0x31d1('0x23')](_0x2e4f13+_0x31d1('0x24'),_0x3f6c62)[_0x31d1('0x23')](_0x31d1('0x25'),NOW)['where'](_0x31d1('0x26'),squel[_0x31d1('0xd')]()[_0x31d1('0xe')]('phone')[_0x31d1('0xf')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x3f6c62)[_0x31d1('0x23')](_0x4b9ed6+_0x31d1('0x2d'),_0x2e4f13+'.'+_0x4b9ed6)))[_0x31d1('0x29')]();}function insertCmContact(_0x2fb81f,_0x90ad92,_0x3cad37,_0x243bb9){var _0x409b44=_[_0x31d1('0x2e')](_[_0x31d1('0x2f')](_0x243bb9),['ListId',_0x31d1('0x30'),_0x31d1('0x1d'),_0x31d1('0x1e')]);return squel[_0x31d1('0x18')]()[_0x31d1('0x19')]('cm_contacts')[_0x31d1('0x1a')](_0x409b44,squel['select']()['fields'](_0x409b44)[_0x31d1('0xf')](_0x90ad92)[_0x31d1('0x23')]('('+_0x3cad37[_0x31d1('0x13')](',')+_0x31d1('0x31'),squel['select']()[_0x31d1('0x20')](_0x3cad37)[_0x31d1('0xf')](_0x31d1('0x21'))[_0x31d1('0x23')](_0x31d1('0x32'),_0x2fb81f)[_0x31d1('0x23')]('deletedAt\x20IS\x20NULL'))[_0x31d1('0x23')](_0x31d1('0x33'),squel[_0x31d1('0xd')]()[_0x31d1('0xe')](_0x31d1('0x34'),_0x31d1('0x35'))[_0x31d1('0xf')](_0x90ad92)[_0x31d1('0x36')](_0x3cad37[_0x31d1('0x13')](','))))['toString']();}function handleStop(){logger[_0x31d1('0x37')](_0x31d1('0x38'));stopped=!![];}function handleUncaughtException(_0x53f824){logger['error'](_0x53f824['message']);process[_0x31d1('0x39')](0x1);}function handleError(_0x484615,_0x52f158){stats[_0x31d1('0x3a')][_0x31d1('0x3b')]({'name':_0x52f158['code'],'message':_0x52f158['message'],'row':_0x484615});}function handleQuery(_0x9d6074){logger['info'](_0x9d6074);return db[_0x31d1('0x3c')][_0x31d1('0x3d')](_0x9d6074)[_0x31d1('0x3e')](function(_0x3a049e){results[_0x31d1('0x3b')](_0x3a049e);})[_0x31d1('0x3f')](function(_0x140c27){logger['error'](_0x140c27['message']);});}function main(_0x868475,_0x3815e3,_0x1ca7b1,_0x3a52fe){logger[_0x31d1('0x37')](_0x31d1('0x40'),_0x868475,JSON[_0x31d1('0x41')](_0x3815e3));process['send'](_0x31d1('0x42'));var _0x6f79b6=_0x3815e3[_0x31d1('0x43')];var _0x5149a6=_0x3815e3['socket_timestamp'];var _0x29a970=path[_0x31d1('0x13')](config[_0x31d1('0x44')],_0x31d1('0x45'),_0x5149a6+_0x31d1('0x46'));var _0x25f6ac=_['keys'](_0x6f79b6)[_0x31d1('0x13')]();logger['info']('header',_0x25f6ac);fs[_0x31d1('0x47')](_0x29a970,_0x25f6ac+'\x0a');Papa[_0x31d1('0x48')](fs[_0x31d1('0x49')](_0x868475),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3bf110,_0x41f7b8){try{for(var _0x20c6c9=0x0,_0x387de7=[];_0x20c6c9<_0x3bf110[_0x31d1('0x4a')]['length'];_0x20c6c9++){stats['rows']+=0x1;if(_0x3bf110[_0x31d1('0x3a')][_0x20c6c9]){handleError(_0x3bf110['data'][_0x20c6c9],_0x3bf110[_0x31d1('0x3a')][_0x20c6c9]);}else{var _0x141d80=[];for(var _0x2bff5d in _0x6f79b6){if(_0x6f79b6[_0x31d1('0x4b')](_0x2bff5d)){if(_0x3bf110[_0x31d1('0x4a')][_0x20c6c9][_0x6f79b6[_0x2bff5d]]){var _0x2d3e2e=_[_0x31d1('0x4c')](_0x3bf110[_0x31d1('0x4a')][_0x20c6c9][_0x6f79b6[_0x2bff5d]][_0x31d1('0x4d')](/"/g,'\x27'));switch(_0x2bff5d){case'scheduledat':var _0x27b195=moment(_0x2d3e2e,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x27b195['isValid']()){_0x387de7[_0x31d1('0x3b')]('\x22'+_0x2d3e2e+'\x22');}else{_0x141d80['push'](_0x31d1('0x4e'));}break;case _0x31d1('0x4f'):var _0x459fb3=parseInt(_0x2d3e2e);_0x2d3e2e=_[_0x31d1('0x50')](_0x459fb3)||_0x459fb3<0x0||_0x459fb3>0x4?_0x3a52fe?0x3:0x2:_0x459fb3;_0x387de7[_0x31d1('0x3b')]('\x22'+_0x2d3e2e+'\x22');break;case _0x31d1('0x1f'):var _0x4d4217=parseInt(_0x2d3e2e);if(_['isNumber'](_0x4d4217)&&_['includes'](_0x1ca7b1,_0x4d4217)){_0x387de7[_0x31d1('0x3b')]('\x22'+_0x4d4217+'\x22');}else{_0x141d80['push'](_0x31d1('0x51'));}break;case _0x31d1('0x52'):if(isEmail(_0x2d3e2e)){_0x387de7[_0x31d1('0x3b')]('\x22'+_0x2d3e2e+'\x22');}else{_0x141d80[_0x31d1('0x3b')]('email\x20wrong\x20format');}break;case _0x31d1('0x53'):var _0x3e8d0b=moment(_0x2d3e2e,'YYYY-MM-DD',!![]);if(_0x3e8d0b[_0x31d1('0x54')]()){_0x387de7[_0x31d1('0x3b')]('\x22'+_0x2d3e2e+'\x22');}else{_0x141d80['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x387de7[_0x31d1('0x3b')]('\x22'+_0x2d3e2e+'\x22');}}else{switch(_0x2bff5d){case _0x31d1('0x55'):case _0x31d1('0x1b'):_0x141d80[_0x31d1('0x3b')](_0x2bff5d+'\x20not\x20specified');break;default:_0x387de7[_0x31d1('0x3b')]('\x22\x22');}}}}if(_0x141d80[_0x31d1('0x56')]){handleError(_0x3bf110[_0x31d1('0x4a')][_0x20c6c9],{'code':'SystemRow','message':_0x141d80[_0x31d1('0x13')]()});}else{fs['appendFileSync'](_0x29a970,_0x387de7[_0x31d1('0x13')]()+'\x0a');}_0x387de7=[];}if(!(stats[_0x31d1('0x57')]%0xc8)){socket['emit'](_0x31d1('0x58')+_0x5149a6,stats);stats['errors']=[];}}if(stopped){logger[_0x31d1('0x37')]('Abort\x20parser');_0x41f7b8[_0x31d1('0x59')]();}}catch(_0xe918ea){handleError(_0x3bf110[_0x31d1('0x4a')][_0x20c6c9],{'code':_0x31d1('0x5a'),'message':_0xe918ea[_0x31d1('0x5b')]});logger[_0x31d1('0x5c')](_0x31d1('0x5d'),_0xe918ea[_0x31d1('0x5b')]);}},'complete':function(){try{var _0x190fe7=[];var _0x3d6b65=_0x31d1('0x21');if(_0x3815e3[_0x31d1('0x5e')]&&_0x3815e3[_0x31d1('0x5e')][_0x31d1('0x56')]){_0x3d6b65=_0x31d1('0x5f')+_0x5149a6;_0x190fe7[_0x31d1('0x3b')](_0x31d1('0x60')+_0x3d6b65+_0x31d1('0x61'));}var _0x3c7d99=util['format'](_0x31d1('0x62'),_0x29a970,_0x3d6b65,_0x25f6ac,_0x3815e3['ListId'],_0x3815e3[_0x31d1('0x30')]||null,NOW,NOW);if(_[_0x31d1('0x63')](_0x6f79b6[_0x31d1('0x64')])){_0x3c7d99+=_0x31d1('0x65');}_0x190fe7[_0x31d1('0x3b')](_0x3c7d99);if(_0x3815e3[_0x31d1('0x5e')]&&_0x3815e3[_0x31d1('0x5e')][_0x31d1('0x56')]){_0x190fe7['push'](insertCmContact(_0x3815e3[_0x31d1('0x1c')],_0x3d6b65,_0x3815e3[_0x31d1('0x5e')],_0x6f79b6));_0x190fe7[_0x31d1('0x3b')]('DROP\x20TABLE\x20'+_0x3d6b65+';');}_0x190fe7[_0x31d1('0x3b')](insertCmHopper(_0x3815e3[_0x31d1('0x1c')],_0x31d1('0x66'),_0x31d1('0x67'),_0x31d1('0x68'),_0x3a52fe));_0x190fe7['push'](insertCmHopperBlack(_0x3815e3[_0x31d1('0x1c')],_0x31d1('0x69'),'voice_queues',_0x31d1('0x68')));_0x190fe7[_0x31d1('0x3b')](insertCmHopper(_0x3815e3[_0x31d1('0x1c')],_0x31d1('0x6a'),_0x31d1('0x6b'),_0x31d1('0x6c'),_0x3a52fe));_0x190fe7['push'](insertCmHopperBlack(_0x3815e3[_0x31d1('0x1c')],_0x31d1('0x6d'),_0x31d1('0x6b'),_0x31d1('0x6c')));BPromise[_0x31d1('0x6e')](_0x190fe7,handleQuery)[_0x31d1('0x6f')](function(_0x51caca){stats[_0x31d1('0x70')]=!![];stats['affectedRows']=_0x3815e3[_0x31d1('0x5e')]&&_0x3815e3[_0x31d1('0x5e')][_0x31d1('0x56')]?results[0x2][_0x31d1('0x71')]:results[0x0][_0x31d1('0x71')];socket['emit'](_0x31d1('0x58')+_0x5149a6,stats);fs[_0x31d1('0x72')](_0x868475);fs['unlink'](_0x29a970);process[_0x31d1('0x39')](0x0);})[_0x31d1('0x3f')](function(_0x5aae76){logger[_0x31d1('0x5c')](_0x5aae76[_0x31d1('0x5b')]);process['exit'](0x1);});}catch(_0x3e232a){logger[_0x31d1('0x5c')](_0x31d1('0x73'),_0x3e232a['message']);process[_0x31d1('0x39')](0x1);}},'error':function(_0x9f8c0c,_0x2aebd2,_0x5c272a,_0x1fd893){throw new Error(_0x1fd893);}});}function validate(){if(process[_0x31d1('0x74')]&&process[_0x31d1('0x74')][_0x31d1('0x56')]<0x4){throw new Error(_0x31d1('0x75'));}var _0xdb3a1f=path[_0x31d1('0x13')](config[_0x31d1('0x44')],_0x31d1('0x45'),process['argv'][0x2]);if(!fs['existsSync'](_0xdb3a1f)){throw new Error('file\x20doesn\x27t\x20exists');}var _0xd99fb6={};try{_0xd99fb6=JSON['parse'](process['argv'][0x3]);if(!_0xd99fb6[_0x31d1('0x43')]){throw new Error(_0x31d1('0x76'));}if(!_0xd99fb6[_0x31d1('0x43')][_0x31d1('0x1b')]){throw new Error(_0x31d1('0x77'));}if(!_0xd99fb6[_0x31d1('0x43')][_0x31d1('0x55')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5f556d=0x0;if(_0xd99fb6['binding']['UserId']){_0x5f556d=0x1;}if(!_0xd99fb6[_0x31d1('0x1c')]){throw new Error(_0x31d1('0x78'));}}catch(_0x370259){throw new Error('body\x20id\x20mandatory');}var _0x46b000=[];try{_0x46b000=_[_0x31d1('0x79')](JSON[_0x31d1('0x48')](process[_0x31d1('0x74')][0x4]),'id');}catch(_0x594c5d){logger[_0x31d1('0x37')]('No\x20agent\x20available');}main(_0xdb3a1f,_0xd99fb6,_0x46b000,_0x5f556d);}validate();process['on'](_0x31d1('0x7a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x3648=['SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','emit','unlink','catch','complete','arguments\x20\x20\x20','argv','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','cm_hopper','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','join','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.updatedAt','into','fromQuery','ContactId','cm_contacts','\x20=\x20?','concat','keys','CompanyId','createdAt',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','message','exit','code','sequelize','query','spread','push','error','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','length','rows','errors','data','hasOwnProperty','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','contact:import:','Abort\x20parser','abort'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x3648,0x13e));var _0x8364=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3648[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var path=require(_0x8364('0x0'));var _=require(_0x8364('0x1'));var Papa=require(_0x8364('0x2'));var util=require(_0x8364('0x3'));var BPromise=require(_0x8364('0x4'));var moment=require(_0x8364('0x5'));var squel=require(_0x8364('0x6'));var Redis=require('ioredis');var db=require(_0x8364('0x7'))['db'];var config=require(_0x8364('0x8'));var logger=require(_0x8364('0x9'))(_0x8364('0xa'));config[_0x8364('0xb')]=_[_0x8364('0xc')](config[_0x8364('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8364('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x8364('0xe')](_0x8364('0xf'));function isEmail(_0x4e065d){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))*$/[_0x8364('0x10')](_0x4e065d);}function selectNotIn(_0x4533ba,_0x34b720,_0x261666,_0x40963b,_0x33c072){return squel[_0x8364('0x11')]()[_0x8364('0x12')](_0x8364('0x13'))[_0x8364('0x14')](_0x40963b)['join'](_0x34b720,null,_0x34b720+_0x8364('0x15')+_0x40963b+'.'+_0x261666)[_0x8364('0x16')](_0x40963b+'.'+_0x261666+_0x8364('0x17')+_0x4533ba+'.'+_0x261666)[_0x8364('0x16')](_0x34b720+_0x8364('0x18')+_0x33c072['join']()+')');}function insertCmHopper(_0x2e1db4,_0x43e079,_0x209593,_0x3b2f5d,_0x2da14a){var _0x564a18=[_0x8364('0x19'),_0x8364('0x1a'),_0x8364('0x1b'),_0x8364('0x1c'),_0x43e079+'.'+_0x3b2f5d,_0x8364('0x1d'),'cm_contacts.updatedAt','cm_contacts.priority',_0x8364('0x1e'),'\x22'+_0x2da14a+'\x22'];return squel[_0x8364('0x1f')]()['into'](_0x8364('0x20'))['fromQuery'](['phone','scheduledat','ContactId',_0x8364('0x21'),_0x3b2f5d,'createdAt',_0x8364('0x22'),_0x8364('0x23'),_0x8364('0x24'),_0x8364('0x25')],squel[_0x8364('0x11')]()[_0x8364('0x26')](_0x564a18)[_0x8364('0x14')](_0x43e079)['join']('cm_contacts',null,_0x8364('0x27')+_0x43e079+_0x8364('0x28'))[_0x8364('0x29')](_0x209593,null,_0x209593+_0x8364('0x15')+_0x43e079+'.'+_0x3b2f5d)[_0x8364('0x16')](_0x43e079+_0x8364('0x2a'),_0x2e1db4)[_0x8364('0x16')](_0x8364('0x2b'),NOW)[_0x8364('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x43e079,_0x209593,_0x3b2f5d,_0x8364('0x20'),[_0x8364('0x2c'),_0x8364('0x2d')]))[_0x8364('0x16')](_0x8364('0x2e'),selectNotIn(_0x43e079,_0x209593,_0x3b2f5d,_0x8364('0x20'),[_0x8364('0x2c')])))[_0x8364('0x2f')]();}function insertCmHopperBlack(_0x235f7a,_0xfd5e4e,_0x581e36,_0x33dc03){var _0x1d0bfb=['cm_contacts.phone',_0x8364('0x1b'),_0x8364('0x1c'),_0xfd5e4e+'.'+_0x33dc03,_0x8364('0x1d'),_0x8364('0x30')];return squel['insert']()[_0x8364('0x31')]('cm_hopper_black')[_0x8364('0x32')]([_0x8364('0x13'),_0x8364('0x33'),_0x8364('0x21'),_0x33dc03,'createdAt',_0x8364('0x22')],squel[_0x8364('0x11')]()[_0x8364('0x26')](_0x1d0bfb)[_0x8364('0x14')](_0xfd5e4e)[_0x8364('0x29')](_0x8364('0x34'),null,_0x8364('0x27')+_0xfd5e4e+_0x8364('0x28'))[_0x8364('0x29')](_0x581e36,null,_0x581e36+'.id\x20=\x20'+_0xfd5e4e+'.'+_0x33dc03)[_0x8364('0x16')](_0xfd5e4e+'.CmListId\x20=\x20?',_0x235f7a)[_0x8364('0x16')](_0x8364('0x2b'),NOW)[_0x8364('0x16')](_0x8364('0x2e'),squel[_0x8364('0x11')]()[_0x8364('0x12')](_0x8364('0x13'))[_0x8364('0x14')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x235f7a)['where'](_0x33dc03+_0x8364('0x35'),_0xfd5e4e+'.'+_0x33dc03)))['toString']();}function insertCmContact(_0x19ccaa,_0x286dba,_0x50948a,_0x449b6a){var _0x39e018=_[_0x8364('0x36')](_[_0x8364('0x37')](_0x449b6a),[_0x8364('0x21'),_0x8364('0x38'),_0x8364('0x39'),_0x8364('0x22')]);return squel[_0x8364('0x1f')]()[_0x8364('0x31')](_0x8364('0x34'))[_0x8364('0x32')](_0x39e018,squel['select']()[_0x8364('0x26')](_0x39e018)[_0x8364('0x14')](_0x286dba)[_0x8364('0x16')]('('+_0x50948a[_0x8364('0x29')](',')+_0x8364('0x3a'),squel[_0x8364('0x11')]()['fields'](_0x50948a)['from'](_0x8364('0x34'))[_0x8364('0x16')](_0x8364('0x3b'),_0x19ccaa)[_0x8364('0x16')](_0x8364('0x3c')))['where'](_0x8364('0x3d'),squel[_0x8364('0x11')]()[_0x8364('0x12')](_0x8364('0x3e'),'min_id')[_0x8364('0x14')](_0x286dba)['group'](_0x50948a['join'](','))))[_0x8364('0x2f')]();}function handleStop(){logger[_0x8364('0x3f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3caae3){logger['error'](_0x3caae3[_0x8364('0x40')]);process[_0x8364('0x41')](0x1);}function handleError(_0x98cafa,_0x5b6628){stats['errors']['push']({'name':_0x5b6628[_0x8364('0x42')],'message':_0x5b6628[_0x8364('0x40')],'row':_0x98cafa});}function handleQuery(_0xadb5ce){logger[_0x8364('0x3f')](_0xadb5ce);return db[_0x8364('0x43')][_0x8364('0x44')](_0xadb5ce)[_0x8364('0x45')](function(_0x47ca1c){results[_0x8364('0x46')](_0x47ca1c);})['catch'](function(_0xfd5675){logger[_0x8364('0x47')](_0xfd5675['message']);});}function main(_0x2fb9ba,_0x33aded,_0x412fb4,_0x841460){logger[_0x8364('0x3f')](_0x8364('0x48'),_0x2fb9ba,JSON[_0x8364('0x49')](_0x33aded));process[_0x8364('0x4a')](_0x8364('0x4b'));var _0x140661=_0x33aded[_0x8364('0x4c')];var _0x4b20f8=_0x33aded[_0x8364('0x4d')];var _0x1b82f5=path[_0x8364('0x29')](config[_0x8364('0x4e')],_0x8364('0x4f'),_0x4b20f8+_0x8364('0x50'));var _0x55f410=_['keys'](_0x140661)[_0x8364('0x29')]();logger[_0x8364('0x3f')](_0x8364('0x51'),_0x55f410);fs[_0x8364('0x52')](_0x1b82f5,_0x55f410+'\x0a');Papa[_0x8364('0x53')](fs[_0x8364('0x54')](_0x2fb9ba),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3184c9,_0x1d6f3a){try{for(var _0x52b4f4=0x0,_0x1a7821=[];_0x52b4f4<_0x3184c9['data'][_0x8364('0x55')];_0x52b4f4++){stats[_0x8364('0x56')]+=0x1;if(_0x3184c9[_0x8364('0x57')][_0x52b4f4]){handleError(_0x3184c9[_0x8364('0x58')][_0x52b4f4],_0x3184c9[_0x8364('0x57')][_0x52b4f4]);}else{var _0x17db6b=[];for(var _0xa5d5d2 in _0x140661){if(_0x140661[_0x8364('0x59')](_0xa5d5d2)){if(_0x3184c9[_0x8364('0x58')][_0x52b4f4][_0x140661[_0xa5d5d2]]){var _0x4f0280=_[_0x8364('0x5a')](_0x3184c9[_0x8364('0x58')][_0x52b4f4][_0x140661[_0xa5d5d2]]['replace'](/"/g,'\x27'));switch(_0xa5d5d2){case _0x8364('0x5b'):var _0x47955f=moment(_0x4f0280,_0x8364('0xf'),!![]);if(_0x47955f[_0x8364('0x5c')]()){_0x1a7821[_0x8364('0x46')]('\x22'+_0x4f0280+'\x22');}else{_0x17db6b[_0x8364('0x46')](_0x8364('0x5d'));}break;case _0x8364('0x23'):var _0x3102fd=parseInt(_0x4f0280);_0x4f0280=_['isNaN'](_0x3102fd)||_0x3102fd<0x0||_0x3102fd>0x4?_0x841460?0x3:0x2:_0x3102fd;_0x1a7821['push']('\x22'+_0x4f0280+'\x22');break;case _0x8364('0x24'):var _0xd082d2=parseInt(_0x4f0280);if(_[_0x8364('0x5e')](_0xd082d2)&&_['includes'](_0x412fb4,_0xd082d2)){_0x1a7821[_0x8364('0x46')]('\x22'+_0xd082d2+'\x22');}else{_0x17db6b['push'](_0x8364('0x5f'));}break;case _0x8364('0x60'):if(isEmail(_0x4f0280)){_0x1a7821[_0x8364('0x46')]('\x22'+_0x4f0280+'\x22');}else{_0x17db6b['push'](_0x8364('0x61'));}break;case'dateOfBirth':var _0xac9820=moment(_0x4f0280,_0x8364('0x62'),!![]);if(_0xac9820[_0x8364('0x5c')]()){_0x1a7821[_0x8364('0x46')]('\x22'+_0x4f0280+'\x22');}else{_0x17db6b[_0x8364('0x46')](_0x8364('0x63'));}break;default:_0x1a7821[_0x8364('0x46')]('\x22'+_0x4f0280+'\x22');}}else{switch(_0xa5d5d2){case'firstName':case'phone':_0x17db6b[_0x8364('0x46')](_0xa5d5d2+_0x8364('0x64'));break;default:_0x1a7821[_0x8364('0x46')]('\x22\x22');}}}}if(_0x17db6b[_0x8364('0x55')]){handleError(_0x3184c9[_0x8364('0x58')][_0x52b4f4],{'code':'SystemRow','message':_0x17db6b[_0x8364('0x29')]()});}else{fs[_0x8364('0x65')](_0x1b82f5,_0x1a7821[_0x8364('0x29')]()+'\x0a');}_0x1a7821=[];}if(!(stats[_0x8364('0x56')]%0xc8)){socket['emit'](_0x8364('0x66')+_0x4b20f8,stats);stats['errors']=[];}}if(stopped){logger[_0x8364('0x3f')](_0x8364('0x67'));_0x1d6f3a[_0x8364('0x68')]();}}catch(_0x2a2bb5){handleError(_0x3184c9[_0x8364('0x58')][_0x52b4f4],{'code':_0x8364('0x69'),'message':_0x2a2bb5[_0x8364('0x40')]});logger[_0x8364('0x47')](_0x8364('0x6a'),_0x2a2bb5['message']);}},'complete':function(){try{var _0x3c2a5e=[];var _0x342a71=_0x8364('0x34');if(_0x33aded[_0x8364('0x6b')]&&_0x33aded[_0x8364('0x6b')][_0x8364('0x55')]){_0x342a71=_0x8364('0x6c')+_0x4b20f8;_0x3c2a5e['push'](_0x8364('0x6d')+_0x342a71+_0x8364('0x6e'));}var _0x4f0d71=util['format'](_0x8364('0x6f'),_0x1b82f5,_0x342a71,_0x55f410,_0x33aded['ListId'],_0x33aded[_0x8364('0x38')]||null,NOW,NOW);if(_[_0x8364('0x70')](_0x140661['scheduledat'])){_0x4f0d71+=_0x8364('0x71');}_0x3c2a5e[_0x8364('0x46')](_0x4f0d71);if(_0x33aded[_0x8364('0x6b')]&&_0x33aded[_0x8364('0x6b')][_0x8364('0x55')]){_0x3c2a5e['push'](insertCmContact(_0x33aded[_0x8364('0x21')],_0x342a71,_0x33aded[_0x8364('0x6b')],_0x140661));_0x3c2a5e[_0x8364('0x46')](_0x8364('0x72')+_0x342a71+';');}_0x3c2a5e[_0x8364('0x46')](insertCmHopper(_0x33aded[_0x8364('0x21')],'voice_queues_has_cm_lists',_0x8364('0x73'),_0x8364('0x74'),_0x841460));_0x3c2a5e[_0x8364('0x46')](insertCmHopperBlack(_0x33aded[_0x8364('0x21')],_0x8364('0x75'),_0x8364('0x73'),_0x8364('0x74')));_0x3c2a5e[_0x8364('0x46')](insertCmHopper(_0x33aded['ListId'],_0x8364('0x76'),'campaigns','CampaignId',_0x841460));_0x3c2a5e[_0x8364('0x46')](insertCmHopperBlack(_0x33aded['ListId'],_0x8364('0x77'),'campaigns',_0x8364('0x78')));BPromise[_0x8364('0x79')](_0x3c2a5e,handleQuery)[_0x8364('0x7a')](function(_0x3bf785){stats[_0x8364('0x7b')]=!![];stats['affectedRows']=_0x33aded['duplicates']&&_0x33aded['duplicates'][_0x8364('0x55')]?results[0x2]['affectedRows']:results[0x0][_0x8364('0x7c')];socket[_0x8364('0x7d')]('contact:import:'+_0x4b20f8,stats);fs[_0x8364('0x7e')](_0x2fb9ba);fs[_0x8364('0x7e')](_0x1b82f5);process[_0x8364('0x41')](0x0);})[_0x8364('0x7f')](function(_0x1f6795){logger[_0x8364('0x47')](_0x1f6795[_0x8364('0x40')]);process[_0x8364('0x41')](0x1);});}catch(_0x531118){logger[_0x8364('0x47')](_0x8364('0x80'),_0x531118[_0x8364('0x40')]);process[_0x8364('0x41')](0x1);}},'error':function(_0x327e5a,_0x2e36e5,_0x292939,_0x1ee59d){throw new Error(_0x1ee59d);}});}function validate(){if(process['argv']&&process['argv'][_0x8364('0x55')]<0x4){throw new Error(_0x8364('0x81'));}var _0x2fad34=path[_0x8364('0x29')](config[_0x8364('0x4e')],_0x8364('0x4f'),process[_0x8364('0x82')][0x2]);if(!fs['existsSync'](_0x2fad34)){throw new Error(_0x8364('0x83'));}var _0x5e795e={};try{_0x5e795e=JSON[_0x8364('0x53')](process[_0x8364('0x82')][0x3]);if(!_0x5e795e[_0x8364('0x4c')]){throw new Error(_0x8364('0x84'));}if(!_0x5e795e[_0x8364('0x4c')]['phone']){throw new Error(_0x8364('0x85'));}if(!_0x5e795e['binding'][_0x8364('0x86')]){throw new Error(_0x8364('0x87'));}var _0x251027=0x0;if(_0x5e795e[_0x8364('0x4c')]['UserId']){_0x251027=0x1;}if(!_0x5e795e[_0x8364('0x21')]){throw new Error(_0x8364('0x88'));}}catch(_0x1c88ed){throw new Error(_0x8364('0x89'));}var _0x49e85c=[];try{_0x49e85c=_['map'](JSON[_0x8364('0x53')](process[_0x8364('0x82')][0x4]),'id');}catch(_0x109a10){logger[_0x8364('0x3f')](_0x8364('0x8a'));}main(_0x2fad34,_0x5e795e,_0x49e85c,_0x251027);}validate();process['on'](_0x8364('0x8b'),handleStop);process['on'](_0x8364('0x8c'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 5daf3d9..e90cc40 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e89=['starttime','Answer\x20Time','answertime','endtime','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentcalledAt','agentconnectAt','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Member\x20Name','Date'];(function(_0xe07094,_0x1cd13b){var _0x2d447b=function(_0x417dc5){while(--_0x417dc5){_0xe07094['push'](_0xe07094['shift']());}};_0x2d447b(++_0x1cd13b);}(_0x7e89,0x103));var _0x97e8=function(_0x1728d1,_0x1994e3){_0x1728d1=_0x1728d1-0x0;var _0x3ca811=_0x7e89[_0x1728d1];return _0x3ca811;};'use strict';exports[_0x97e8('0x0')]=function(_0x269a8c,_0x368652){var _0x92a295=[{'type':_0x97e8('0x1'),'content':_0x97e8('0x2'),'variableName':null}];switch(_0x269a8c[_0x97e8('0x3')]()){case _0x97e8('0x4'):switch(_0x368652[_0x97e8('0x3')]()){case _0x97e8('0x5'):_0x92a295[_0x97e8('0x6')]({'type':_0x97e8('0x7'),'content':'','variableName':_0x97e8('0x8')});_0x92a295[_0x97e8('0x6')]({'type':_0x97e8('0x7'),'content':'','variableName':_0x97e8('0x9')});break;case _0x97e8('0xa'):_0x92a295['push']({'type':_0x97e8('0x1'),'content':_0x97e8('0xb'),'variableName':null});_0x92a295[_0x97e8('0x6')]({'type':_0x97e8('0x7'),'content':'','variableName':_0x97e8('0xc')});break;}}return _0x92a295;};exports[_0x97e8('0xd')]=function(_0x553a80,_0xc32ae9){var _0x1f3319=[];switch(_0x553a80[_0x97e8('0x3')]()){case'voice':switch(_0xc32ae9[_0x97e8('0x3')]()){case _0x97e8('0x5'):_0x1f3319=[{'type':_0x97e8('0x1'),'content':_0x97e8('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x10'),'keyType':_0x97e8('0x7'),'variableName':_0x97e8('0x9')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x97e8('0x11')},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x12'),'keyType':_0x97e8('0x7'),'variableName':_0x97e8('0x13')},{'type':_0x97e8('0xf'),'content':'','key':'Queue','keyType':_0x97e8('0x7'),'variableName':'queue'},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x14'),'keyType':_0x97e8('0x7'),'variableName':_0x97e8('0x15')},{'type':'keyValue','content':'','key':'Date','keyType':_0x97e8('0x7'),'variableName':'agentcalledAt'},{'type':_0x97e8('0x1'),'content':_0x97e8('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x17'),'keyType':'variable','variableName':_0x97e8('0x18')},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x19'),'keyType':_0x97e8('0x7'),'variableName':_0x97e8('0xc')},{'type':_0x97e8('0x1'),'content':_0x97e8('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x97e8('0xf'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x97e8('0x1b')},{'type':_0x97e8('0xf'),'content':'','key':'Agent\x20Connect','keyType':_0x97e8('0x7'),'variableName':_0x97e8('0x1c')},{'type':_0x97e8('0xf'),'content':'','key':'Agent\x20Complete','keyType':_0x97e8('0x7'),'variableName':_0x97e8('0x1d')},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x1e'),'keyType':'variable','variableName':'holdtime'},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x1f'),'keyType':_0x97e8('0x7'),'variableName':_0x97e8('0x20')}];break;case'outbound':_0x1f3319=[{'type':_0x97e8('0x1'),'content':_0x97e8('0xe'),'variableName':null},{'type':_0x97e8('0xf'),'content':'','key':'Called\x20Number','keyType':_0x97e8('0x7'),'keyContent':'','variableName':_0x97e8('0xc')},{'type':'keyValue','content':'','key':_0x97e8('0x21'),'keyType':_0x97e8('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x97e8('0xf'),'content':'','key':'UniqueId','keyType':_0x97e8('0x7'),'keyContent':'','variableName':_0x97e8('0x15')},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x22'),'keyType':_0x97e8('0x7'),'keyContent':'','variableName':_0x97e8('0x23')},{'type':'string','content':_0x97e8('0x1a')},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x24'),'keyType':_0x97e8('0x7'),'keyContent':'','variableName':_0x97e8('0x25')},{'type':_0x97e8('0xf'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0x97e8('0x26')},{'type':_0x97e8('0xf'),'content':'','key':_0x97e8('0x27'),'keyType':'variable','keyContent':'','variableName':_0x97e8('0x28')},{'type':_0x97e8('0xf'),'content':'','key':'Billable\x20Time','keyType':_0x97e8('0x7'),'keyContent':'','variableName':_0x97e8('0x29')}];break;}}return _0x1f3319;}; \ No newline at end of file +var _0xe8f9=['Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','Called\x20Number','Member\x20Name','membername','Date','Complete\x20Time','Duration','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','calleridnum','string'];(function(_0x3389fe,_0x202e25){var _0x2fadb1=function(_0xb35272){while(--_0xb35272){_0x3389fe['push'](_0x3389fe['shift']());}};_0x2fadb1(++_0x202e25);}(_0xe8f9,0xd7));var _0x9e8f=function(_0xcbb462,_0x43670c){_0xcbb462=_0xcbb462-0x0;var _0x58bd63=_0xe8f9[_0xcbb462];return _0x58bd63;};'use strict';exports[_0x9e8f('0x0')]=function(_0x3d1649,_0x514445){var _0x2cab4a=[{'type':'string','content':_0x9e8f('0x1'),'variableName':null}];switch(_0x3d1649[_0x9e8f('0x2')]()){case _0x9e8f('0x3'):switch(_0x514445[_0x9e8f('0x2')]()){case _0x9e8f('0x4'):_0x2cab4a[_0x9e8f('0x5')]({'type':'variable','content':'','variableName':_0x9e8f('0x6')});_0x2cab4a[_0x9e8f('0x5')]({'type':_0x9e8f('0x7'),'content':'','variableName':_0x9e8f('0x8')});break;case'outbound':_0x2cab4a[_0x9e8f('0x5')]({'type':_0x9e8f('0x9'),'content':_0x9e8f('0xa'),'variableName':null});_0x2cab4a[_0x9e8f('0x5')]({'type':_0x9e8f('0x7'),'content':'','variableName':_0x9e8f('0xb')});break;}}return _0x2cab4a;};exports[_0x9e8f('0xc')]=function(_0x141dca,_0xb1b01b){var _0x2e8607=[];switch(_0x141dca['toLowerCase']()){case _0x9e8f('0x3'):switch(_0xb1b01b[_0x9e8f('0x2')]()){case _0x9e8f('0x4'):_0x2e8607=[{'type':'string','content':_0x9e8f('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0xf'),'keyType':_0x9e8f('0x7'),'variableName':_0x9e8f('0x8')},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x10'),'keyType':_0x9e8f('0x7'),'variableName':_0x9e8f('0x11')},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x12'),'keyType':_0x9e8f('0x7'),'variableName':_0x9e8f('0x13')},{'type':'keyValue','content':'','key':_0x9e8f('0x14'),'keyType':_0x9e8f('0x7'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0x9e8f('0x15'),'keyType':'variable','variableName':_0x9e8f('0x16')},{'type':_0x9e8f('0xe'),'content':'','key':'Date','keyType':_0x9e8f('0x7'),'variableName':_0x9e8f('0x17')},{'type':'string','content':_0x9e8f('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x19'),'keyType':_0x9e8f('0x7'),'variableName':_0x9e8f('0x1a')},{'type':'keyValue','content':'','key':_0x9e8f('0x1b'),'keyType':_0x9e8f('0x7'),'variableName':'destcalleridnum'},{'type':_0x9e8f('0x9'),'content':_0x9e8f('0x1c'),'key':null,'keyType':null,'variableName':null},{'type':_0x9e8f('0xe'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0x9e8f('0x1d'),'keyType':_0x9e8f('0x7'),'variableName':_0x9e8f('0x1e')},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x1f'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x20'),'keyType':_0x9e8f('0x7'),'variableName':_0x9e8f('0x21')},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x22'),'keyType':_0x9e8f('0x7'),'variableName':_0x9e8f('0x23')}];break;case _0x9e8f('0x24'):_0x2e8607=[{'type':_0x9e8f('0x9'),'content':_0x9e8f('0xd'),'variableName':null},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x25'),'keyType':_0x9e8f('0x7'),'keyContent':'','variableName':_0x9e8f('0xb')},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x26'),'keyType':_0x9e8f('0x7'),'keyContent':'','variableName':_0x9e8f('0x27')},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x15'),'keyType':_0x9e8f('0x7'),'keyContent':'','variableName':_0x9e8f('0x16')},{'type':_0x9e8f('0xe'),'content':'','key':_0x9e8f('0x28'),'keyType':_0x9e8f('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0x9e8f('0x9'),'content':_0x9e8f('0x1c')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x9e8f('0x7'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x9e8f('0x29'),'keyType':_0x9e8f('0x7'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x9e8f('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x9e8f('0x2b')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0x9e8f('0x2c')}];break;}}return _0x2e8607;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 56e6212..8d5a2d7 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0230=['mobile','lodash','openchannel-interactions','mail-interactions','../../config/logger','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','error','user','clone','body','phone'];(function(_0x26b005,_0x25d9c9){var _0x1dc6a3=function(_0x32b59f){while(--_0x32b59f){_0x26b005['push'](_0x26b005['shift']());}};_0x1dc6a3(++_0x25d9c9);}(_0x0230,0x1e7));var _0x0023=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x0230[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x0023('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x0023('0x1')),'mail':require('../../config/logger')(_0x0023('0x2')),'fax':require(_0x0023('0x3'))('fax-interactions'),'sms':require(_0x0023('0x3'))(_0x0023('0x4')),'chat':require(_0x0023('0x3'))(_0x0023('0x5')),'whatsapp':require(_0x0023('0x3'))(_0x0023('0x6'))};function getInteractionId(_0x43af81,_0x478a6b,_0x3982f6){if(_0x43af81&&_0x43af81[_[_0x0023('0x7')](_0x3982f6)+_0x0023('0x8')]){return _0x43af81[_['upperFirst'](_0x3982f6)+_0x0023('0x8')];}else if(_0x43af81&&_0x43af81['id']){return _0x43af81['id'];}else if(_0x478a6b&&_0x478a6b['id']){return _0x478a6b['id'];}else{return _0x0023('0x9');}}function log(_0x56b709,_0x545a2d,_0x3be4ad,_0x4bd5fe,_0x1112f2,_0x19c1f8){loggers[_0x1112f2['toLowerCase']()][_0x56b709](_0x0023('0xa'),_0x19c1f8[_0x0023('0xb')](),_0x545a2d?_0x545a2d['id']:null,_0x545a2d?_0x545a2d[_0x0023('0xc')]:null,_0x545a2d?_0x545a2d[_0x0023('0xd')]:null,getInteractionId(_0x3be4ad,_0x4bd5fe,_0x1112f2),_0x3be4ad?JSON[_0x0023('0xe')](_0x3be4ad):_0x0023('0xf'));}function updateUser(_0x8d1e53,_0x517f95,_0x52def1,_0x335aae,_0x106c00){db[_[_0x0023('0x7')](_0x335aae)+_0x0023('0x10')][_0x0023('0x11')]({'where':{'id':getInteractionId(_0x517f95,_0x52def1,_0x335aae)}})[_0x0023('0x12')](function(_0x32d287){if(_0x32d287){return _0x32d287[_0x0023('0x13')]({'UserId':_0x8d1e53?_0x8d1e53['id']:null});}})['then'](function(_0x31424b){if(_0x31424b){log(_0x0023('0x14'),_0x8d1e53,_0x517f95,_0x52def1,_0x335aae,_0x106c00);}})['catch'](function(){log(_0x0023('0x15'),_0x8d1e53,_0x517f95,_0x52def1,_0x335aae,_0x106c00);});}exports['tracked']=function(_0x5cdf00,_0x19d151){return function(_0x44eb9e,_0x376d8b,_0x177a3f){var _0x282dec=_0x44eb9e[_0x0023('0x16')];var _0x3eb907={};var _0x4d48c2=_0x44eb9e['query'];if(_0x3eb907){_0x3eb907=_[_0x0023('0x17')](_0x44eb9e[_0x0023('0x18')]);_0x3eb907=_['omit'](_0x3eb907,['body','html',_0x0023('0x19'),'fax',_0x0023('0x1a')]);}updateUser(_0x282dec,_0x3eb907,_0x4d48c2,_0x5cdf00,_0x19d151);_0x177a3f(null);};}; \ No newline at end of file +var _0xf636=['omit','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','then','info','catch','error','tracked','user','clone','body'];(function(_0x1579f0,_0x56eb06){var _0x1743ed=function(_0x5005ca){while(--_0x5005ca){_0x1579f0['push'](_0x1579f0['shift']());}};_0x1743ed(++_0x56eb06);}(_0xf636,0x19a));var _0x6f63=function(_0x108433,_0x380bcf){_0x108433=_0x108433-0x0;var _0x4e62c0=_0xf636[_0x108433];return _0x4e62c0;};'use strict';var _=require(_0x6f63('0x0'));var db=require(_0x6f63('0x1'))['db'];var loggers={'openchannel':require(_0x6f63('0x2'))(_0x6f63('0x3')),'mail':require(_0x6f63('0x2'))('mail-interactions'),'fax':require(_0x6f63('0x2'))(_0x6f63('0x4')),'sms':require('../../config/logger')(_0x6f63('0x5')),'chat':require(_0x6f63('0x2'))(_0x6f63('0x6')),'whatsapp':require(_0x6f63('0x2'))(_0x6f63('0x7'))};function getInteractionId(_0x39b5df,_0x2cc2b5,_0x4c9725){if(_0x39b5df&&_0x39b5df[_[_0x6f63('0x8')](_0x4c9725)+_0x6f63('0x9')]){return _0x39b5df[_[_0x6f63('0x8')](_0x4c9725)+'InteractionId'];}else if(_0x39b5df&&_0x39b5df['id']){return _0x39b5df['id'];}else if(_0x2cc2b5&&_0x2cc2b5['id']){return _0x2cc2b5['id'];}else{return _0x6f63('0xa');}}function log(_0x3d64b3,_0x1246cd,_0xa9fe11,_0x333c4f,_0x5d2132,_0x57a85d){loggers[_0x5d2132[_0x6f63('0xb')]()][_0x3d64b3](_0x6f63('0xc'),_0x57a85d[_0x6f63('0xd')](),_0x1246cd?_0x1246cd['id']:null,_0x1246cd?_0x1246cd[_0x6f63('0xe')]:null,_0x1246cd?_0x1246cd[_0x6f63('0xf')]:null,getInteractionId(_0xa9fe11,_0x333c4f,_0x5d2132),_0xa9fe11?JSON['stringify'](_0xa9fe11):_0x6f63('0x10'));}function updateUser(_0x47ec0a,_0x23cb36,_0x78b67,_0x512c1d,_0xd1fc7a){db[_[_0x6f63('0x8')](_0x512c1d)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x23cb36,_0x78b67,_0x512c1d)}})['then'](function(_0x2dda24){if(_0x2dda24){return _0x2dda24['update']({'UserId':_0x47ec0a?_0x47ec0a['id']:null});}})[_0x6f63('0x11')](function(_0x9be1c3){if(_0x9be1c3){log(_0x6f63('0x12'),_0x47ec0a,_0x23cb36,_0x78b67,_0x512c1d,_0xd1fc7a);}})[_0x6f63('0x13')](function(){log(_0x6f63('0x14'),_0x47ec0a,_0x23cb36,_0x78b67,_0x512c1d,_0xd1fc7a);});}exports[_0x6f63('0x15')]=function(_0x19c7fc,_0x4d0766){return function(_0xc8e315,_0x5ab745,_0x1664cf){var _0x30d147=_0xc8e315[_0x6f63('0x16')];var _0x472e20={};var _0x33f558=_0xc8e315['query'];if(_0x472e20){_0x472e20=_[_0x6f63('0x17')](_0xc8e315[_0x6f63('0x18')]);_0x472e20=_[_0x6f63('0x19')](_0x472e20,['body','html',_0x6f63('0x1a'),_0x6f63('0x1b'),_0x6f63('0x1c')]);}updateUser(_0x30d147,_0x472e20,_0x33f558,_0x19c7fc,_0x4d0766);_0x1664cf(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index b5b9f45..070a449 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 _0xf2d3=['../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util','../../mysqldb'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xf2d3,0x84));var _0x3f2d=function(_0x164f0d,_0x2aa800){_0x164f0d=_0x164f0d-0x0;var _0x22d9df=_0xf2d3[_0x164f0d];return _0x22d9df;};'use strict';var crypto=require(_0x3f2d('0x0'));var util=require(_0x3f2d('0x1'));var compose=require('composable-middleware');var db=require(_0x3f2d('0x2'))['db'];var config=require(_0x3f2d('0x3'));function getValueFromLicense(_0x3f6e3d,_0x1c9c7f){if(_0x3f6e3d&&_0x1c9c7f){if(_0x1c9c7f[_0x3f2d('0x4')]&&_0x1c9c7f[_0x3f2d('0x5')]){var _0x345ee5=_0x1c9c7f[_0x3f2d('0x4')];var _0x54b676=_0x1c9c7f[_0x3f2d('0x5')];var _0x6e5a9=_0x345ee5[_0x3f2d('0x6')]('-')[0x4];var _0x5c98ee=_0x345ee5[_0x3f2d('0x6')]('-')[0x0];var _0x4fc438=crypto[_0x3f2d('0x7')]('aes-256-ctr',util['format'](_0x3f2d('0x8'),_0x6e5a9,_0x345ee5,_0x5c98ee));var _0x11e707=_0x4fc438[_0x3f2d('0x9')](_0x54b676,_0x3f2d('0xa'),_0x3f2d('0xb'));_0x11e707+=_0x4fc438[_0x3f2d('0xc')]('utf8');var _0x209d41=JSON[_0x3f2d('0xd')](_0x11e707);return _0x209d41[_0x3f2d('0xe')](_0x3f6e3d)?_0x209d41[_0x3f6e3d]:null;}}return null;}function isLimit(_0x288e6e,_0x1fada9,_0xa1df6d,_0x401773){var _0x127669=_0x1fada9;return compose()[_0x3f2d('0xf')](function(_0x4cd548,_0x5159ad,_0x2c2a65){return db[_0x3f2d('0x10')][_0x3f2d('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x3f2d('0x12')](function(_0x4fc0f1){var _0x1136b6=getValueFromLicense(_0x288e6e,_0x4fc0f1);return _0x1136b6?_0x1136b6:_0x127669;})[_0x3f2d('0x12')](function(_0x4f37b1){_0x127669=_0x4f37b1;return _0xa1df6d[_0x3f2d('0x13')](_0x401773);})['then'](function(_0x5644f2){if(_0x5644f2>=_0x127669){return _0x5159ad['status'](0x193)['json']({'message':util[_0x3f2d('0x14')](_0x3f2d('0x15'),_0x288e6e)});}_0x2c2a65();})[_0x3f2d('0x16')](function(_0x3e1fbe){_0x2c2a65(_0x3e1fbe);});});}function isUserLimit(){return isLimit(_0x3f2d('0x17'),0x1,db[_0x3f2d('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0x3f2d('0x19')}]}});}exports[_0x3f2d('0x1a')]=isUserLimit; \ No newline at end of file +var _0x15c9=['createDecipher','aes-256-ctr','%s:%s:%s','update','base64','final','utf8','parse','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split'];(function(_0x4277b8,_0x30ba6d){var _0x410266=function(_0x3be20d){while(--_0x3be20d){_0x4277b8['push'](_0x4277b8['shift']());}};_0x410266(++_0x30ba6d);}(_0x15c9,0x158));var _0x915c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15c9[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x915c('0x0'));var util=require(_0x915c('0x1'));var compose=require(_0x915c('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x915c('0x3'));function getValueFromLicense(_0x4b024b,_0x3388d1){if(_0x4b024b&&_0x3388d1){if(_0x3388d1[_0x915c('0x4')]&&_0x3388d1[_0x915c('0x5')]){var _0x53751e=_0x3388d1[_0x915c('0x4')];var _0x540290=_0x3388d1[_0x915c('0x5')];var _0x64b693=_0x53751e[_0x915c('0x6')]('-')[0x4];var _0x444b98=_0x53751e[_0x915c('0x6')]('-')[0x0];var _0x5a684b=crypto[_0x915c('0x7')](_0x915c('0x8'),util['format'](_0x915c('0x9'),_0x64b693,_0x53751e,_0x444b98));var _0x1fcdb5=_0x5a684b[_0x915c('0xa')](_0x540290,_0x915c('0xb'),'utf8');_0x1fcdb5+=_0x5a684b[_0x915c('0xc')](_0x915c('0xd'));var _0x463323=JSON[_0x915c('0xe')](_0x1fcdb5);return _0x463323['hasOwnProperty'](_0x4b024b)?_0x463323[_0x4b024b]:null;}}return null;}function isLimit(_0x3d7a3f,_0x2feed6,_0x28c74c,_0x3ed75d){var _0x1744dd=_0x2feed6;return compose()[_0x915c('0xf')](function(_0x184649,_0x576732,_0x269cf7){return db[_0x915c('0x10')][_0x915c('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x506e26){var _0x4a78a3=getValueFromLicense(_0x3d7a3f,_0x506e26);return _0x4a78a3?_0x4a78a3:_0x1744dd;})[_0x915c('0x12')](function(_0x50c213){_0x1744dd=_0x50c213;return _0x28c74c[_0x915c('0x13')](_0x3ed75d);})[_0x915c('0x12')](function(_0x1c7f1d){if(_0x1c7f1d>=_0x1744dd){return _0x576732[_0x915c('0x14')](0x193)[_0x915c('0x15')]({'message':util['format'](_0x915c('0x16'),_0x3d7a3f)});}_0x269cf7();})[_0x915c('0x17')](function(_0x38e08a){_0x269cf7(_0x38e08a);});});}function isUserLimit(){return isLimit(_0x915c('0x18'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x915c('0x19')}]}});}exports[_0x915c('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ec106f4..c3a167f 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 _0x3418=['and','replace','[$and]','[$or]','split','length','slice','shift','forEach','filter','indexOf','map','conditions','push','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','field','\x20AS\x20','text','$ne','$notIn','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','pop','hours','minutes','seconds','moment','startsWith'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x3418,0x196));var _0x8341=function(_0x58d344,_0x26cc34){_0x58d344=_0x58d344-0x0;var _0x2cb932=_0x3418[_0x58d344];return _0x2cb932;};'use strict';var _=require('lodash');var moment=require(_0x8341('0x0'));exports['parseSearch']=function(_0xcfd43){var _0x28e22e={'conditions':[]};_0x28e22e['sqlOperator']=_[_0x8341('0x1')](_0xcfd43,'[$or]')?'or':_0x8341('0x2');var _0x44c843=_0xcfd43[_0x8341('0x3')](_0x8341('0x4'),'')[_0x8341('0x3')](_0x8341('0x5'),'')[_0x8341('0x6')]('||');for(var _0x334761=0x0;_0x334761<_0x44c843[_0x8341('0x7')];_0x334761++){var _0x4ac9a4=_0x44c843[_0x334761][_0x8341('0x6')](':=');var _0x43d00d=_0x4ac9a4[0x0];var _0x1398d8=_0x4ac9a4[_0x8341('0x8')](0x1);_0x1398d8['forEach'](function(_0x58fc39){var _0x37b751=_0x58fc39[_0x8341('0x6')]('[')[_0x8341('0x9')]();var _0x252b3f=_0x58fc39['match'](/\[(.*?)\]/g);_0x252b3f[_0x8341('0xa')](function(_0xfe312c){var _0x518a58=_0xfe312c[_0x8341('0x6')]('[')[_0x8341('0xb')](function(_0x465138){return _0x465138[_0x8341('0xc')](']')>-0x1;})[_0x8341('0xd')](function(_0x4f1f68){return _0x4f1f68[_0x8341('0x6')](']')[0x0];})[0x0];_0x28e22e[_0x8341('0xe')][_0x8341('0xf')]({'field':_0x43d00d,'operator':_0x37b751,'value':_0x518a58});});});}return _0x28e22e;};exports['buildExpression']=function(_0x3d791f,_0x12c1c3,_0x4597c5){var _0x4e1b8c={};if(_0x12c1c3===_0x8341('0x10')){if(_0x4597c5[_0x8341('0x11')]===_0x8341('0x12')){_0x4597c5['operator']=_0x8341('0x13');_0x4597c5['value']+=','+_0x4597c5[_0x8341('0x14')];}else if(_[_0x8341('0x15')]([_0x8341('0x16'),_0x8341('0x17')],_0x4597c5[_0x8341('0x11')])){_0x4597c5[_0x8341('0x14')]=moment(_0x4597c5[_0x8341('0x14')])[_0x8341('0x18')](0x1,'days')[_0x8341('0x19')](_0x8341('0x1a'));}}if(_0x4597c5[_0x8341('0x1b')]){_0x12c1c3=_0x4597c5['castTo'];_0x4e1b8c['text']='CAST('+_0x3d791f+'.'+_0x4597c5[_0x8341('0x1c')]+_0x8341('0x1d')+_0x4597c5['castTo']+')\x20'+parseOperator(_0x4597c5[_0x8341('0x11')]);}else{_0x4e1b8c[_0x8341('0x1e')]=_0x3d791f+'.'+_0x4597c5[_0x8341('0x1c')]+'\x20'+parseOperator(_0x4597c5[_0x8341('0x11')]);}if(_[_0x8341('0x15')]([_0x8341('0x1f'),_0x8341('0x20')],_0x4597c5[_0x8341('0x11')]))_0x4e1b8c[_0x8341('0x1e')]='('+_0x4e1b8c[_0x8341('0x1e')]+'\x20OR\x20'+_0x3d791f+'.'+_0x4597c5[_0x8341('0x1c')]+_0x8341('0x21');_0x4e1b8c[_0x8341('0x14')]=parseValue(_0x12c1c3,_0x4597c5['operator'],_0x4597c5[_0x8341('0x14')]);return _0x4e1b8c;};function parseOperator(_0xe3b43d){var _0x36e048;switch(_0xe3b43d){case'$in':_0x36e048=_0x8341('0x22');break;case _0x8341('0x20'):_0x36e048=_0x8341('0x23');break;case _0x8341('0x12'):_0x36e048=_0x8341('0x24');break;case'$ne':_0x36e048=_0x8341('0x25');break;case _0x8341('0x26'):case _0x8341('0x27'):case _0x8341('0x28'):_0x36e048=_0x8341('0x29');break;case'$lt':_0x36e048='<\x20?';break;case'$gt':_0x36e048='>\x20?';break;case'$lte':_0x36e048=_0x8341('0x2a');break;case _0x8341('0x2b'):_0x36e048='>=\x20?';break;case _0x8341('0x13'):_0x36e048=_0x8341('0x2c');break;}return _0x36e048;}function parseValue(_0x52d545,_0x27a6d7,_0x3df05e){var _0x4bb479={'start':undefined,'end':undefined};switch(_0x27a6d7){case _0x8341('0x2d'):case _0x8341('0x20'):_0x4bb479['start']=_0x3df05e[_0x8341('0x6')](',');break;case _0x8341('0x26'):_0x4bb479[_0x8341('0x2e')]='%'+_0x3df05e+'%';break;case'$startsWith':_0x4bb479[_0x8341('0x2e')]=_0x3df05e+'%';break;case _0x8341('0x28'):_0x4bb479[_0x8341('0x2e')]='%'+_0x3df05e;break;case _0x8341('0x13'):var _0x1a0130=_0x3df05e[_0x8341('0x6')](',');var _0x3df05e=_0x1a0130[_0x8341('0x9')]();var _0x4d02aa=_0x1a0130[_0x8341('0x2f')]();if(_0x52d545===_0x8341('0x10')){_0x3df05e=moment(_0x3df05e)['utcOffset'](0x0,!![])[_0x8341('0x19')]();_0x4d02aa=moment(_0x4d02aa)['utcOffset'](0x0,!![])[_0x8341('0x18')](0x17,_0x8341('0x30'))[_0x8341('0x18')](0x3b,_0x8341('0x31'))[_0x8341('0x18')](0x3b,_0x8341('0x32'))[_0x8341('0x19')]();}_0x4bb479={'start':_0x3df05e,'end':_0x4d02aa};break;default:_0x4bb479['start']=_0x3df05e;break;}return _0x4bb479;} \ No newline at end of file +var _0xd32e=['text','CAST(','field','\x20AS\x20','castTo','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','start','$substring','$startsWith','utcOffset','minutes','moment','sqlOperator','startsWith','[$or]','and','replace','length','split','forEach','shift','match','filter','indexOf','push','DATE','$eq','operator','$between','value','includes','$lte','add','days','format'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xd32e,0x1e6));var _0xed32=function(_0x1bb5c3,_0x2d336f){_0x1bb5c3=_0x1bb5c3-0x0;var _0x4dccb2=_0xd32e[_0x1bb5c3];return _0x4dccb2;};'use strict';var _=require('lodash');var moment=require(_0xed32('0x0'));exports['parseSearch']=function(_0x352c39){var _0x30579f={'conditions':[]};_0x30579f[_0xed32('0x1')]=_[_0xed32('0x2')](_0x352c39,_0xed32('0x3'))?'or':_0xed32('0x4');var _0x4de016=_0x352c39[_0xed32('0x5')]('[$and]','')[_0xed32('0x5')](_0xed32('0x3'),'')['split']('||');for(var _0x2d15cf=0x0;_0x2d15cf<_0x4de016[_0xed32('0x6')];_0x2d15cf++){var _0x4f675c=_0x4de016[_0x2d15cf][_0xed32('0x7')](':=');var _0x492e89=_0x4f675c[0x0];var _0x2f0da5=_0x4f675c['slice'](0x1);_0x2f0da5[_0xed32('0x8')](function(_0x38b543){var _0x10a7fe=_0x38b543[_0xed32('0x7')]('[')[_0xed32('0x9')]();var _0x3f18bf=_0x38b543[_0xed32('0xa')](/\[(.*?)\]/g);_0x3f18bf['forEach'](function(_0x38cf19){var _0x1c2196=_0x38cf19[_0xed32('0x7')]('[')[_0xed32('0xb')](function(_0x21b95b){return _0x21b95b[_0xed32('0xc')](']')>-0x1;})['map'](function(_0x7a5dd5){return _0x7a5dd5['split'](']')[0x0];})[0x0];_0x30579f['conditions'][_0xed32('0xd')]({'field':_0x492e89,'operator':_0x10a7fe,'value':_0x1c2196});});});}return _0x30579f;};exports['buildExpression']=function(_0x66b225,_0x457a53,_0x4e34b1){var _0xc18644={};if(_0x457a53===_0xed32('0xe')){if(_0x4e34b1['operator']===_0xed32('0xf')){_0x4e34b1[_0xed32('0x10')]=_0xed32('0x11');_0x4e34b1['value']+=','+_0x4e34b1[_0xed32('0x12')];}else if(_[_0xed32('0x13')](['$gt',_0xed32('0x14')],_0x4e34b1[_0xed32('0x10')])){_0x4e34b1[_0xed32('0x12')]=moment(_0x4e34b1['value'])[_0xed32('0x15')](0x1,_0xed32('0x16'))[_0xed32('0x17')]('YYYY-MM-DD');}}if(_0x4e34b1['castTo']){_0x457a53=_0x4e34b1['castTo'];_0xc18644[_0xed32('0x18')]=_0xed32('0x19')+_0x66b225+'.'+_0x4e34b1[_0xed32('0x1a')]+_0xed32('0x1b')+_0x4e34b1[_0xed32('0x1c')]+')\x20'+parseOperator(_0x4e34b1[_0xed32('0x10')]);}else{_0xc18644[_0xed32('0x18')]=_0x66b225+'.'+_0x4e34b1[_0xed32('0x1a')]+'\x20'+parseOperator(_0x4e34b1[_0xed32('0x10')]);}if(_['includes']([_0xed32('0x1d'),_0xed32('0x1e')],_0x4e34b1[_0xed32('0x10')]))_0xc18644[_0xed32('0x18')]='('+_0xc18644[_0xed32('0x18')]+_0xed32('0x1f')+_0x66b225+'.'+_0x4e34b1[_0xed32('0x1a')]+_0xed32('0x20');_0xc18644[_0xed32('0x12')]=parseValue(_0x457a53,_0x4e34b1[_0xed32('0x10')],_0x4e34b1[_0xed32('0x12')]);return _0xc18644;};function parseOperator(_0x1e0a79){var _0x26037c;switch(_0x1e0a79){case _0xed32('0x21'):_0x26037c=_0xed32('0x22');break;case _0xed32('0x1e'):_0x26037c=_0xed32('0x23');break;case _0xed32('0xf'):_0x26037c='=\x20?';break;case _0xed32('0x1d'):_0x26037c=_0xed32('0x24');break;case'$substring':case'$startsWith':case _0xed32('0x25'):_0x26037c=_0xed32('0x26');break;case _0xed32('0x27'):_0x26037c=_0xed32('0x28');break;case _0xed32('0x29'):_0x26037c=_0xed32('0x2a');break;case _0xed32('0x14'):_0x26037c=_0xed32('0x2b');break;case _0xed32('0x2c'):_0x26037c=_0xed32('0x2d');break;case'$between':_0x26037c='BETWEEN\x20?\x20AND\x20?';break;}return _0x26037c;}function parseValue(_0x3cff1b,_0x402063,_0x11c7da){var _0x3b2a76={'start':undefined,'end':undefined};switch(_0x402063){case _0xed32('0x21'):case _0xed32('0x1e'):_0x3b2a76[_0xed32('0x2e')]=_0x11c7da[_0xed32('0x7')](',');break;case _0xed32('0x2f'):_0x3b2a76[_0xed32('0x2e')]='%'+_0x11c7da+'%';break;case _0xed32('0x30'):_0x3b2a76['start']=_0x11c7da+'%';break;case _0xed32('0x25'):_0x3b2a76[_0xed32('0x2e')]='%'+_0x11c7da;break;case _0xed32('0x11'):var _0x12b5b3=_0x11c7da[_0xed32('0x7')](',');var _0x11c7da=_0x12b5b3[_0xed32('0x9')]();var _0x26356b=_0x12b5b3['pop']();if(_0x3cff1b===_0xed32('0xe')){_0x11c7da=moment(_0x11c7da)[_0xed32('0x31')](0x0,!![])['format']();_0x26356b=moment(_0x26356b)['utcOffset'](0x0,!![])[_0xed32('0x15')](0x17,'hours')[_0xed32('0x15')](0x3b,_0xed32('0x32'))[_0xed32('0x15')](0x3b,'seconds')['format']();}_0x3b2a76={'start':_0x11c7da,'end':_0x26356b};break;default:_0x3b2a76['start']=_0x11c7da;break;}return _0x3b2a76;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index edac90a..ddf349a 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 _0x7a2c=['VIRTUAL','lower','options','sequelize','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','$gte','format','YYYY-MM-DD','utc','name','uniqueid','isArray','offset','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','replace','push','join','getOptions','query','$id','model','intersection','attributes','fields','nolimit','limit','order','where','pick','filter'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0x7a2c,0xeb));var _0xc7a2=function(_0x24ad24,_0x1d1607){_0x24ad24=_0x24ad24-0x0;var _0x3f45a5=_0x7a2c[_0x24ad24];return _0x3f45a5;};'use strict';var _=require('lodash');var sequelize=require(_0xc7a2('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x343692){var _0x3372e4=['ne'];try{var _0x95fc86=JSON[_0xc7a2('0x1')](_0x343692);var _0x355f14=Object[_0xc7a2('0x2')](_0x95fc86)[0x0];return _0x3372e4[_0xc7a2('0x3')](_0x355f14);}catch(_0x7d18fe){return![];}}function getOperatorValue(_0x3c247e){var _0x29fa16=JSON[_0xc7a2('0x1')](_0x3c247e);var _0x314630=Object[_0xc7a2('0x2')](_0x29fa16)[0x0];var _0x41fe83=_0x29fa16[_0x314630];return{['$'+_0x314630]:_0x41fe83};}exports['fields']=function(_0x2730e4){var _0x38719b=null;if(_0x2730e4){_0x38719b=_0x2730e4[_0xc7a2('0x4')](',');}return _0x38719b;};exports[_0xc7a2('0x5')]=function(_0x3784b5,_0x35ac89){var _0x586405={};if(!_[_0xc7a2('0x6')](_0x3784b5)){_[_0xc7a2('0x7')](_0x3784b5,function(_0x407fc4,_0x3f9643){try{if(_0x35ac89){var _0x1ec35c=_[_0xc7a2('0x8')](_0x35ac89,{'name':_0x3f9643})||{};if(hasSequelizeOperator(_0x407fc4)){_0x586405[_0x3f9643]=getOperatorValue(_0x407fc4);}else if(_0x1ec35c[_0xc7a2('0x9')]==='DATE'&&_['isPlainObject'](_0x407fc4)){var _0x2e5e30=JSON[_0xc7a2('0x1')](_0x407fc4);var _0x2f7f2e={'$gte':moment(moment(_0x2e5e30[_0xc7a2('0xa')])[_0xc7a2('0xb')]('YYYY-MM-DD'))['utc']()[_0xc7a2('0xb')](),'$lte':moment(moment(_0x2e5e30['$lte'])[_0xc7a2('0xb')](_0xc7a2('0xc')))[_0xc7a2('0xd')]()['subtract'](0x1,'s')['format']()};_0x586405[_0x3f9643]=_0x2f7f2e;}else if(_0x1ec35c[_0xc7a2('0xe')]===_0xc7a2('0xf')){_0x586405[_0x3f9643]=_0x407fc4;}else{_0x586405[_0x3f9643]=_[_0xc7a2('0x10')](_0x407fc4)?_0x407fc4:JSON[_0xc7a2('0x1')](_0x407fc4);}}else{_0x586405[_0x3f9643]=_[_0xc7a2('0x10')](_0x407fc4)?_0x407fc4:JSON[_0xc7a2('0x1')](_0x407fc4);}}catch(_0x5b162b){_0x586405[_0x3f9643]=_0x407fc4[_0xc7a2('0x4')](',');}});}return _0x586405;};exports['limit']=function(_0x3c8840){_0x3c8840=parseInt(_0x3c8840,0xa);if(!_0x3c8840||_0x3c8840<0x0){_0x3c8840=LIMIT_VALUE;}return _0x3c8840;};exports[_0xc7a2('0x11')]=function(_0xacef06){_0xacef06=parseInt(_0xacef06,0xa);if(!_0xacef06||_0xacef06<0x0){_0xacef06=0x0;}return _0xacef06;};exports[_0xc7a2('0x12')]=function(_0xbf3742){var _0xcbeb99,_0x6cec54=null;if(_0xbf3742){_0xcbeb99=_0xbf3742[_0xc7a2('0x4')](',');_0x6cec54=_[_0xc7a2('0x13')](_0xcbeb99,function(_0x496e5b){if(_0x496e5b[_0xc7a2('0x14')]('-')===0x0){return[_0x496e5b==='priority'?sequelize[_0xc7a2('0x15')](sequelize[_0xc7a2('0x16')](_0xc7a2('0x17')),_0xc7a2('0x18')):_0x496e5b[_0xc7a2('0x19')](0x1),_0xc7a2('0x1a')];}else{return[_0x496e5b===_0xc7a2('0x17')?sequelize['cast'](sequelize[_0xc7a2('0x16')](_0xc7a2('0x17')),'unsigned'):_0x496e5b,_0xc7a2('0x1b')];}});}return _0x6cec54;};exports[_0xc7a2('0x1c')]=function(_0x1c9f5e,_0x1151c2){if(_[_0xc7a2('0x6')](_0x1c9f5e)){return _0x1c9f5e;}if(_['isArray'](_0x1c9f5e)){for(var _0xa51c10=0x0;_0xa51c10<_0x1c9f5e['length'];_0xa51c10+=0x1){_0x1c9f5e[_0xa51c10]=this[_0xc7a2('0x1c')](_0x1c9f5e[_0xa51c10],_0x1151c2);}return _0x1c9f5e;}if(!_[_0xc7a2('0x1d')](_0x1c9f5e)){return _0x1c9f5e;}if(_[_0xc7a2('0x1e')](_0x1151c2)){_0x1151c2=[_0x1151c2];}if(!_['isArray'](_0x1151c2)){return _0x1c9f5e;}for(var _0x2042c6=0x0;_0x2042c6<_0x1151c2[_0xc7a2('0x1f')];_0x2042c6+=0x1){_[_0xc7a2('0x20')](_0x1c9f5e,_0x1151c2[_0x2042c6]);}for(var _0x536189 in _0x1c9f5e){if(_0x1c9f5e[_0xc7a2('0x21')](_0x536189)){_0x1c9f5e[_0x536189]=this[_0xc7a2('0x1c')](_0x1c9f5e[_0x536189],_0x1151c2);}}return _0x1c9f5e;};exports[_0xc7a2('0x22')]=function(_0x33b1a7){return _0x33b1a7['match'](RegExp(_0xc7a2('0x23')))?!![]:![];};exports[_0xc7a2('0x24')]=function(_0x30835c){return _0x30835c[_0xc7a2('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xc7a2('0x26')]=function(_0x4afcdf){var _0x2dfcbf=[];_0x4afcdf[_0xc7a2('0x4')](/[ ,]+/)['forEach'](function(_0x1e1328){_0x1e1328=_0x1e1328[_0xc7a2('0x27')](/([^:]")"+/g,'$1');_0x1e1328='+'+_0x1e1328+'*';if(_0x1e1328[_0xc7a2('0x3')]('@'))_0x1e1328='\x22'+_0x1e1328+'\x22';_0x2dfcbf[_0xc7a2('0x28')](_0x1e1328);});return _0x2dfcbf[_0xc7a2('0x29')]('\x20');};exports[_0xc7a2('0x2a')]=function(_0x5b0dec,_0x1a7c64,_0x4d8f4c){var _0x328b01={},_0x366518={};if(_0x1a7c64[_0xc7a2('0x2b')]['$id']){_0x1a7c64[_0xc7a2('0x2b')]['id']=_0x1a7c64[_0xc7a2('0x2b')][_0xc7a2('0x2c')];delete _0x1a7c64[_0xc7a2('0x2b')][_0xc7a2('0x2c')];}_0x328b01[_0xc7a2('0x2d')]=_['map'](_0x5b0dec,_0xc7a2('0xe'));_0x328b01['query']=_['keys'](_0x1a7c64[_0xc7a2('0x2b')]);_0x328b01['filters']=_[_0xc7a2('0x2e')](_0x328b01[_0xc7a2('0x2d')],_0x328b01[_0xc7a2('0x2b')]);_0x366518[_0xc7a2('0x2f')]=_[_0xc7a2('0x2e')](_0x328b01['model'],this[_0xc7a2('0x30')](_0x1a7c64['query'][_0xc7a2('0x30')]));_0x366518[_0xc7a2('0x2f')]=_0x366518[_0xc7a2('0x2f')]['length']?_0x366518[_0xc7a2('0x2f')]:_0x328b01['model'];if(!_0x1a7c64['query'][_0xc7a2('0x21')](_0xc7a2('0x31'))){_0x366518['limit']=this[_0xc7a2('0x32')](_0x1a7c64[_0xc7a2('0x2b')][_0xc7a2('0x32')]);_0x366518[_0xc7a2('0x11')]=this[_0xc7a2('0x11')](_0x1a7c64[_0xc7a2('0x2b')]['offset']);}_0x366518[_0xc7a2('0x33')]=this['sort'](_0x1a7c64['query'][_0xc7a2('0x12')]);_0x366518[_0xc7a2('0x34')]=this['filters'](_[_0xc7a2('0x35')](_0x1a7c64[_0xc7a2('0x2b')],_0x328b01[_0xc7a2('0x5')]),_0x5b0dec);if(_0x1a7c64[_0xc7a2('0x2b')][_0xc7a2('0x36')]){_0x366518[_0xc7a2('0x34')]=_['merge'](_0x366518[_0xc7a2('0x34')],{'$or':_[_0xc7a2('0x13')](_0x5b0dec,function(_0x2cd514){if(_0x2cd514[_0xc7a2('0x9')]!==_0xc7a2('0x37')){if(_0x4d8f4c){return sequelize[_0xc7a2('0x34')](sequelize['fn'](_0xc7a2('0x38'),sequelize[_0xc7a2('0x16')](_0x2cd514['name'])),{'$like':sequelize['fn']('lower','%'+_0x1a7c64[_0xc7a2('0x2b')]['filter']+'%')});}else{var _0x2c8b26={};_0x2c8b26[_0x2cd514[_0xc7a2('0xe')]]={'$like':'%'+_0x1a7c64[_0xc7a2('0x2b')][_0xc7a2('0x36')]+'%'};return _0x2c8b26;}}})});}_0x366518=_['merge']({},_0x366518,_0x1a7c64[_0xc7a2('0x39')]);return _0x366518;}; \ No newline at end of file +var _0xf8d1=['col','unsigned','substr','DESC','ASC','isEmpty','isString','length','unset','hasOwnProperty','omit','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','getOptions','query','$id','model','name','attributes','intersection','order','where','pick','filter','merge','type','lower','lodash','moment','parse','includes','keys','fields','filters','forOwn','find','$gte','format','utc','YYYY-MM-DD','subtract','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','cast'];(function(_0x354b5b,_0x2df4e1){var _0x456ea6=function(_0x3ea45f){while(--_0x3ea45f){_0x354b5b['push'](_0x354b5b['shift']());}};_0x456ea6(++_0x2df4e1);}(_0xf8d1,0xc4));var _0x1f8d=function(_0xe41f5a,_0x2962df){_0xe41f5a=_0xe41f5a-0x0;var _0x678310=_0xf8d1[_0xe41f5a];return _0x678310;};'use strict';var _=require(_0x1f8d('0x0'));var sequelize=require('sequelize');var moment=require(_0x1f8d('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x34927d){var _0x4e281e=['ne'];try{var _0xb404ca=JSON[_0x1f8d('0x2')](_0x34927d);var _0xfa1ad1=Object['keys'](_0xb404ca)[0x0];return _0x4e281e[_0x1f8d('0x3')](_0xfa1ad1);}catch(_0x560b44){return![];}}function getOperatorValue(_0x1181b5){var _0x26bc25=JSON['parse'](_0x1181b5);var _0x4ef517=Object[_0x1f8d('0x4')](_0x26bc25)[0x0];var _0x36915c=_0x26bc25[_0x4ef517];return{['$'+_0x4ef517]:_0x36915c};}exports[_0x1f8d('0x5')]=function(_0x3c32ac){var _0x127703=null;if(_0x3c32ac){_0x127703=_0x3c32ac['split'](',');}return _0x127703;};exports[_0x1f8d('0x6')]=function(_0x5ccf68,_0x4a3b8f){var _0x13fbdd={};if(!_['isEmpty'](_0x5ccf68)){_[_0x1f8d('0x7')](_0x5ccf68,function(_0x1136ed,_0x51fad2){try{if(_0x4a3b8f){var _0x448084=_[_0x1f8d('0x8')](_0x4a3b8f,{'name':_0x51fad2})||{};if(hasSequelizeOperator(_0x1136ed)){_0x13fbdd[_0x51fad2]=getOperatorValue(_0x1136ed);}else if(_0x448084['type']==='DATE'&&_['isPlainObject'](_0x1136ed)){var _0x2053c3=JSON[_0x1f8d('0x2')](_0x1136ed);var _0x2c7f33={'$gte':moment(moment(_0x2053c3[_0x1f8d('0x9')])[_0x1f8d('0xa')]('YYYY-MM-DD'))[_0x1f8d('0xb')]()[_0x1f8d('0xa')](),'$lte':moment(moment(_0x2053c3['$lte'])[_0x1f8d('0xa')](_0x1f8d('0xc')))[_0x1f8d('0xb')]()[_0x1f8d('0xd')](0x1,'s')[_0x1f8d('0xa')]()};_0x13fbdd[_0x51fad2]=_0x2c7f33;}else if(_0x448084['name']===_0x1f8d('0xe')){_0x13fbdd[_0x51fad2]=_0x1136ed;}else{_0x13fbdd[_0x51fad2]=_[_0x1f8d('0xf')](_0x1136ed)?_0x1136ed:JSON['parse'](_0x1136ed);}}else{_0x13fbdd[_0x51fad2]=_[_0x1f8d('0xf')](_0x1136ed)?_0x1136ed:JSON[_0x1f8d('0x2')](_0x1136ed);}}catch(_0x19f65e){_0x13fbdd[_0x51fad2]=_0x1136ed[_0x1f8d('0x10')](',');}});}return _0x13fbdd;};exports[_0x1f8d('0x11')]=function(_0x4b5703){_0x4b5703=parseInt(_0x4b5703,0xa);if(!_0x4b5703||_0x4b5703<0x0){_0x4b5703=LIMIT_VALUE;}return _0x4b5703;};exports[_0x1f8d('0x12')]=function(_0x32ccc5){_0x32ccc5=parseInt(_0x32ccc5,0xa);if(!_0x32ccc5||_0x32ccc5<0x0){_0x32ccc5=0x0;}return _0x32ccc5;};exports[_0x1f8d('0x13')]=function(_0x419924){var _0x1efb62,_0x2f25c9=null;if(_0x419924){_0x1efb62=_0x419924[_0x1f8d('0x10')](',');_0x2f25c9=_[_0x1f8d('0x14')](_0x1efb62,function(_0x23ec43){if(_0x23ec43[_0x1f8d('0x15')]('-')===0x0){return[_0x23ec43===_0x1f8d('0x16')?sequelize[_0x1f8d('0x17')](sequelize[_0x1f8d('0x18')](_0x1f8d('0x16')),_0x1f8d('0x19')):_0x23ec43[_0x1f8d('0x1a')](0x1),_0x1f8d('0x1b')];}else{return[_0x23ec43===_0x1f8d('0x16')?sequelize[_0x1f8d('0x17')](sequelize[_0x1f8d('0x18')](_0x1f8d('0x16')),_0x1f8d('0x19')):_0x23ec43,_0x1f8d('0x1c')];}});}return _0x2f25c9;};exports['omit']=function(_0x4416f2,_0x2adc34){if(_[_0x1f8d('0x1d')](_0x4416f2)){return _0x4416f2;}if(_[_0x1f8d('0xf')](_0x4416f2)){for(var _0x43adc9=0x0;_0x43adc9<_0x4416f2['length'];_0x43adc9+=0x1){_0x4416f2[_0x43adc9]=this['omit'](_0x4416f2[_0x43adc9],_0x2adc34);}return _0x4416f2;}if(!_['isObject'](_0x4416f2)){return _0x4416f2;}if(_[_0x1f8d('0x1e')](_0x2adc34)){_0x2adc34=[_0x2adc34];}if(!_['isArray'](_0x2adc34)){return _0x4416f2;}for(var _0x4e5f0c=0x0;_0x4e5f0c<_0x2adc34[_0x1f8d('0x1f')];_0x4e5f0c+=0x1){_[_0x1f8d('0x20')](_0x4416f2,_0x2adc34[_0x4e5f0c]);}for(var _0x2105f5 in _0x4416f2){if(_0x4416f2[_0x1f8d('0x21')](_0x2105f5)){_0x4416f2[_0x2105f5]=this[_0x1f8d('0x22')](_0x4416f2[_0x2105f5],_0x2adc34);}}return _0x4416f2;};exports[_0x1f8d('0x23')]=function(_0x479f8a){return _0x479f8a[_0x1f8d('0x24')](RegExp(_0x1f8d('0x25')))?!![]:![];};exports[_0x1f8d('0x26')]=function(_0x48711c){return _0x48711c[_0x1f8d('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x1f8d('0x27')]=function(_0x1437d4){var _0x55682d=[];_0x1437d4['split'](/[ ,]+/)[_0x1f8d('0x28')](function(_0x4bbfad){_0x4bbfad=_0x4bbfad['replace'](/([^:]")"+/g,'$1');_0x4bbfad='+'+_0x4bbfad+'*';if(_0x4bbfad[_0x1f8d('0x3')]('@'))_0x4bbfad='\x22'+_0x4bbfad+'\x22';_0x55682d['push'](_0x4bbfad);});return _0x55682d['join']('\x20');};exports[_0x1f8d('0x29')]=function(_0x11ca9a,_0x4c2d9a,_0x59a7a2){var _0x506617={},_0x673c2a={};if(_0x4c2d9a[_0x1f8d('0x2a')]['$id']){_0x4c2d9a[_0x1f8d('0x2a')]['id']=_0x4c2d9a[_0x1f8d('0x2a')][_0x1f8d('0x2b')];delete _0x4c2d9a[_0x1f8d('0x2a')][_0x1f8d('0x2b')];}_0x506617[_0x1f8d('0x2c')]=_[_0x1f8d('0x14')](_0x11ca9a,_0x1f8d('0x2d'));_0x506617[_0x1f8d('0x2a')]=_[_0x1f8d('0x4')](_0x4c2d9a[_0x1f8d('0x2a')]);_0x506617['filters']=_['intersection'](_0x506617['model'],_0x506617[_0x1f8d('0x2a')]);_0x673c2a[_0x1f8d('0x2e')]=_[_0x1f8d('0x2f')](_0x506617[_0x1f8d('0x2c')],this[_0x1f8d('0x5')](_0x4c2d9a['query'][_0x1f8d('0x5')]));_0x673c2a['attributes']=_0x673c2a['attributes'][_0x1f8d('0x1f')]?_0x673c2a[_0x1f8d('0x2e')]:_0x506617[_0x1f8d('0x2c')];if(!_0x4c2d9a['query'][_0x1f8d('0x21')]('nolimit')){_0x673c2a[_0x1f8d('0x11')]=this['limit'](_0x4c2d9a[_0x1f8d('0x2a')][_0x1f8d('0x11')]);_0x673c2a[_0x1f8d('0x12')]=this[_0x1f8d('0x12')](_0x4c2d9a['query']['offset']);}_0x673c2a[_0x1f8d('0x30')]=this[_0x1f8d('0x13')](_0x4c2d9a[_0x1f8d('0x2a')][_0x1f8d('0x13')]);_0x673c2a[_0x1f8d('0x31')]=this['filters'](_[_0x1f8d('0x32')](_0x4c2d9a['query'],_0x506617[_0x1f8d('0x6')]),_0x11ca9a);if(_0x4c2d9a[_0x1f8d('0x2a')][_0x1f8d('0x33')]){_0x673c2a['where']=_[_0x1f8d('0x34')](_0x673c2a[_0x1f8d('0x31')],{'$or':_[_0x1f8d('0x14')](_0x11ca9a,function(_0x57b44f){if(_0x57b44f[_0x1f8d('0x35')]!=='VIRTUAL'){if(_0x59a7a2){return sequelize['where'](sequelize['fn'](_0x1f8d('0x36'),sequelize[_0x1f8d('0x18')](_0x57b44f[_0x1f8d('0x2d')])),{'$like':sequelize['fn']('lower','%'+_0x4c2d9a[_0x1f8d('0x2a')][_0x1f8d('0x33')]+'%')});}else{var _0xabd18={};_0xabd18[_0x57b44f[_0x1f8d('0x2d')]]={'$like':'%'+_0x4c2d9a[_0x1f8d('0x2a')][_0x1f8d('0x33')]+'%'};return _0xabd18;}}})});}_0x673c2a=_[_0x1f8d('0x34')]({},_0x673c2a,_0x4c2d9a['options']);return _0x673c2a;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 901a5f9..696e3a6 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4589=['ejs','renderFile','view\x20engine','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','passport','cors','moment','./environment','../mysqldb','get','production','set','root','public','development','test','appPath','use','json\x20replacer','toISOString','split','static','views','/server/views','html'];(function(_0x1fc0c8,_0xdfb11){var _0x46a93b=function(_0x1ba19b){while(--_0x1ba19b){_0x1fc0c8['push'](_0x1fc0c8['shift']());}};_0x46a93b(++_0xdfb11);}(_0x4589,0xed));var _0x9458=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x4589[_0x88cd7b];return _0x56fcc8;};'use strict';var express=require(_0x9458('0x0'));var favicon=require(_0x9458('0x1'));var bodyParser=require(_0x9458('0x2'));var methodOverride=require(_0x9458('0x3'));var cookieParser=require(_0x9458('0x4'));var errorHandler=require(_0x9458('0x5'));var path=require('path');var passport=require(_0x9458('0x6'));var cors=require(_0x9458('0x7'));var moment=require(_0x9458('0x8'));var config=require(_0x9458('0x9'));var db=require(_0x9458('0xa'))['db'];exports['default']=function(_0x122fd6){var _0x1c1ad2=_0x122fd6[_0x9458('0xb')]('env');if(_0x1c1ad2===_0x9458('0xc')){_0x122fd6[_0x9458('0xd')]('appPath',path['join'](config[_0x9458('0xe')],_0x9458('0xf')));}if(_0x1c1ad2===_0x9458('0x10')||_0x1c1ad2===_0x9458('0x11')){_0x122fd6['set'](_0x9458('0x12'),path['join'](config[_0x9458('0xe')],'client'));_0x122fd6[_0x9458('0x13')](errorHandler());}_0x122fd6['set'](_0x9458('0x14'),function(_0x5a220,_0x4a3ae2){if(this[_0x5a220]instanceof Date){_0x4a3ae2=this[_0x5a220][_0x9458('0x15')]()[_0x9458('0x16')]('.')[0x0]+'Z';}return _0x4a3ae2;});_0x122fd6['use'](express[_0x9458('0x17')](_0x122fd6[_0x9458('0xb')](_0x9458('0x12'))));_0x122fd6['set'](_0x9458('0x18'),config[_0x9458('0xe')]+_0x9458('0x19'));_0x122fd6['engine'](_0x9458('0x1a'),require(_0x9458('0x1b'))[_0x9458('0x1c')]);_0x122fd6[_0x9458('0xd')](_0x9458('0x1d'),'html');_0x122fd6[_0x9458('0x13')](bodyParser['urlencoded']({'limit':_0x9458('0x1e'),'extended':!![]}));_0x122fd6[_0x9458('0x13')](bodyParser[_0x9458('0x1f')]({'limit':_0x9458('0x1e')}));_0x122fd6['use'](cors());_0x122fd6[_0x9458('0x13')](methodOverride());_0x122fd6['use'](cookieParser());_0x122fd6['use'](passport[_0x9458('0x20')]());}; \ No newline at end of file +var _0xd7fb=['../mysqldb','get','env','production','set','appPath','join','root','development','client','use','toISOString','static','views','/server/views','engine','html','renderFile','view\x20engine','urlencoded','json','50mb','initialize','express','body-parser','method-override','cookie-parser','errorhandler','passport'];(function(_0x1d3707,_0x20f724){var _0x3f8c7a=function(_0x509397){while(--_0x509397){_0x1d3707['push'](_0x1d3707['shift']());}};_0x3f8c7a(++_0x20f724);}(_0xd7fb,0x8b));var _0xbd7f=function(_0x1df05f,_0x17978c){_0x1df05f=_0x1df05f-0x0;var _0x350697=_0xd7fb[_0x1df05f];return _0x350697;};'use strict';var express=require(_0xbd7f('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0xbd7f('0x1'));var methodOverride=require(_0xbd7f('0x2'));var cookieParser=require(_0xbd7f('0x3'));var errorHandler=require(_0xbd7f('0x4'));var path=require('path');var passport=require(_0xbd7f('0x5'));var cors=require('cors');var moment=require('moment');var config=require('./environment');var db=require(_0xbd7f('0x6'))['db'];exports['default']=function(_0x15317e){var _0x4bfd2b=_0x15317e[_0xbd7f('0x7')](_0xbd7f('0x8'));if(_0x4bfd2b===_0xbd7f('0x9')){_0x15317e[_0xbd7f('0xa')](_0xbd7f('0xb'),path[_0xbd7f('0xc')](config[_0xbd7f('0xd')],'public'));}if(_0x4bfd2b===_0xbd7f('0xe')||_0x4bfd2b==='test'){_0x15317e[_0xbd7f('0xa')](_0xbd7f('0xb'),path['join'](config[_0xbd7f('0xd')],_0xbd7f('0xf')));_0x15317e[_0xbd7f('0x10')](errorHandler());}_0x15317e[_0xbd7f('0xa')]('json\x20replacer',function(_0x5e2196,_0xdd8cba){if(this[_0x5e2196]instanceof Date){_0xdd8cba=this[_0x5e2196][_0xbd7f('0x11')]()['split']('.')[0x0]+'Z';}return _0xdd8cba;});_0x15317e[_0xbd7f('0x10')](express[_0xbd7f('0x12')](_0x15317e[_0xbd7f('0x7')]('appPath')));_0x15317e[_0xbd7f('0xa')](_0xbd7f('0x13'),config['root']+_0xbd7f('0x14'));_0x15317e[_0xbd7f('0x15')](_0xbd7f('0x16'),require('ejs')[_0xbd7f('0x17')]);_0x15317e[_0xbd7f('0xa')](_0xbd7f('0x18'),'html');_0x15317e[_0xbd7f('0x10')](bodyParser[_0xbd7f('0x19')]({'limit':'50mb','extended':!![]}));_0x15317e[_0xbd7f('0x10')](bodyParser[_0xbd7f('0x1a')]({'limit':_0xbd7f('0x1b')}));_0x15317e['use'](cors());_0x15317e['use'](methodOverride());_0x15317e[_0xbd7f('0x10')](cookieParser());_0x15317e['use'](passport[_0xbd7f('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index ceaf025..daa6035 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 _0x5e99=['filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','platform','licenseToken','test','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5e99,0xd0));var _0x95e9=function(_0x3ecd4d,_0x23b542){_0x3ecd4d=_0x3ecd4d-0x0;var _0x2b8c67=_0x5e99[_0x3ecd4d];return _0x2b8c67;};'use strict';var _=require(_0x95e9('0x0'));var os=require('os');var crypto=require(_0x95e9('0x1'));var machine=require(_0x95e9('0x2'));var exec=require('child_process')[_0x95e9('0x3')];var config=require(_0x95e9('0x4'));function getInterfaces(){var _0x3d68e4=[];var _0x39247d=os[_0x95e9('0x5')]();var _0x595566=_[_0x95e9('0x6')](_['keys'](_0x39247d));for(var _0x317c84=0x0;_0x317c84<_0x595566[_0x95e9('0x7')];_0x317c84++){var _0x359ada=_0x39247d[_0x595566[_0x317c84]][_0x95e9('0x8')](function(_0x6e1a82){return _0x6e1a82[_0x95e9('0x9')]===_0x95e9('0xa')&&_0x6e1a82['internal']===![];});_0x3d68e4=_0x3d68e4[_0x95e9('0xb')](_0x359ada);}return _0x3d68e4;}function getFirstInterface(){var _0x3ef9a1=_[_0x95e9('0xc')](getInterfaces());return{'macAddress':_0x3ef9a1&&_0x3ef9a1[_0x95e9('0xd')]?_0x3ef9a1[_0x95e9('0xd')]:_0x95e9('0xe'),'ipAddress':_0x3ef9a1&&_0x3ef9a1['address']?_0x3ef9a1[_0x95e9('0xf')]:_0x95e9('0x10')};}exports[_0x95e9('0x11')]=getFirstInterface;function getCPUhash(){var _0x569329=_['orderBy'](os[_0x95e9('0x12')]()[_0x95e9('0x13')](function(_0x1e661c){return _0x1e661c[_0x95e9('0x14')];}))[_0x95e9('0x15')](':');return crypto[_0x95e9('0x16')](_0x95e9('0x17'))[_0x95e9('0x18')](_0x569329)[_0x95e9('0x19')](_0x95e9('0x1a'));}exports['getUuid']=function(){var _0x21f9a6=os[_0x95e9('0x1b')]();var _0x229bd7=/[0-9a-f-]{36}/;if(config[_0x95e9('0x1c')]&&_0x229bd7[_0x95e9('0x1d')](config[_0x95e9('0x1c')])){return config[_0x95e9('0x1c')];}else if(_0x21f9a6==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x95e9('0x1e')})[_0x95e9('0x1f')]('\x0d\x0a','');}else{var _0x581227=getFirstInterface();var _0x2f9a3c=getCPUhash();var _0x1cfee5=_0x2f9a3c+'|'+os[_0x95e9('0x20')]()+'|'+_0x581227[_0x95e9('0x21')]+'|'+_0x581227[_0x95e9('0x22')];var _0x32f0e6=crypto[_0x95e9('0x16')](_0x95e9('0x17'))[_0x95e9('0x18')](_0x1cfee5)['digest'](_0x95e9('0x1a'));return _0x32f0e6[_0x95e9('0x23')](0x0,0x8)+'-'+_0x32f0e6['substring'](0x8,0xc)+'-'+_0x32f0e6[_0x95e9('0x23')](0xc,0x10)+'-'+_0x32f0e6[_0x95e9('0x23')](0x10,0x14)+'-'+_0x32f0e6['substring'](0x14);}}; \ No newline at end of file +var _0x180b=['substring','lodash','crypto','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','digest'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x180b,0x182));var _0xb180=function(_0x1c3708,_0x519cbf){_0x1c3708=_0x1c3708-0x0;var _0x224854=_0x180b[_0x1c3708];return _0x224854;};'use strict';var _=require(_0xb180('0x0'));var os=require('os');var crypto=require(_0xb180('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];var config=require(_0xb180('0x2'));function getInterfaces(){var _0x5e8519=[];var _0x571805=os[_0xb180('0x3')]();var _0x4c296d=_[_0xb180('0x4')](_[_0xb180('0x5')](_0x571805));for(var _0xa874f1=0x0;_0xa874f1<_0x4c296d[_0xb180('0x6')];_0xa874f1++){var _0x42b7cc=_0x571805[_0x4c296d[_0xa874f1]][_0xb180('0x7')](function(_0x2d0c60){return _0x2d0c60[_0xb180('0x8')]===_0xb180('0x9')&&_0x2d0c60[_0xb180('0xa')]===![];});_0x5e8519=_0x5e8519['concat'](_0x42b7cc);}return _0x5e8519;}function getFirstInterface(){var _0x409434=_[_0xb180('0xb')](getInterfaces());return{'macAddress':_0x409434&&_0x409434[_0xb180('0xc')]?_0x409434[_0xb180('0xc')]:'00:00:00:00:00:00','ipAddress':_0x409434&&_0x409434[_0xb180('0xd')]?_0x409434[_0xb180('0xd')]:_0xb180('0xe')};}exports[_0xb180('0xf')]=getFirstInterface;function getCPUhash(){var _0x17495d=_[_0xb180('0x4')](os[_0xb180('0x10')]()[_0xb180('0x11')](function(_0x171f41){return _0x171f41[_0xb180('0x12')];}))[_0xb180('0x13')](':');return crypto[_0xb180('0x14')](_0xb180('0x15'))[_0xb180('0x16')](_0x17495d)['digest'](_0xb180('0x17'));}exports[_0xb180('0x18')]=function(){var _0x141761=os['platform']();var _0x145855=/[0-9a-f-]{36}/;if(config[_0xb180('0x19')]&&_0x145855[_0xb180('0x1a')](config[_0xb180('0x19')])){return config['licenseToken'];}else if(_0x141761===_0xb180('0x1b')){return exec(_0xb180('0x1c'),{'encoding':_0xb180('0x1d')})[_0xb180('0x1e')]('\x0d\x0a','');}else{var _0xcf1bd0=getFirstInterface();var _0x4280cb=getCPUhash();var _0x4746f3=_0x4280cb+'|'+os['hostname']()+'|'+_0xcf1bd0[_0xb180('0x1f')]+'|'+_0xcf1bd0[_0xb180('0x20')];var _0xf41af=crypto[_0xb180('0x14')](_0xb180('0x15'))[_0xb180('0x16')](_0x4746f3)[_0xb180('0x21')]('hex');return _0xf41af['substring'](0x0,0x8)+'-'+_0xf41af[_0xb180('0x22')](0x8,0xc)+'-'+_0xf41af[_0xb180('0x22')](0xc,0x10)+'-'+_0xf41af[_0xb180('0x22')](0x10,0x14)+'-'+_0xf41af['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7b42d12..d81ef03 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 _0x8a05=['days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','request-promise','bluebird','../../mysqldb','../../components/encryptor','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data2','data1','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','decryptString'];(function(_0xdf24d,_0x2788b3){var _0x116041=function(_0x5877ca){while(--_0x5877ca){_0xdf24d['push'](_0xdf24d['shift']());}};_0x116041(++_0x2788b3);}(_0x8a05,0x7f));var _0x58a0=function(_0x193cf9,_0x37e4d1){_0x193cf9=_0x193cf9-0x0;var _0x5cb27f=_0x8a05[_0x193cf9];return _0x5cb27f;};'use strict';var util=require(_0x58a0('0x0'));var moment=require('moment');var rp=require(_0x58a0('0x1'));var BPromise=require(_0x58a0('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0x58a0('0x3'))['db'];var encryptor=require(_0x58a0('0x4'));var hardware=require('./hardware');var logger=require('../logger')(_0x58a0('0x5'));var HOST=_0x58a0('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x45504b){return new BPromise(function(_0x1d9af0,_0x39dad2){var _0x1d3daf=util[_0x58a0('0x7')](_0x58a0('0x8'),HOST,_0x45504b,module['exports'][_0x58a0('0x9')]);if(oldToken){_0x1d3daf=util['format'](_0x58a0('0xa'),HOST,_0x45504b,module[_0x58a0('0xb')][_0x58a0('0x9')],oldToken);}var _0x43e4e1={'uri':_0x1d3daf,'method':_0x58a0('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x43e4e1)[_0x58a0('0xd')](function(_0xf5eb09){_0x1d9af0(_0xf5eb09);})[_0x58a0('0xe')](function(_0xf3a014){_0x39dad2(_0xf3a014);});});}function manageLicense(_0x33b1e5,_0x1cccf4){var _0x13eea7=_0x1cccf4[_0x58a0('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x13eea7['data1']!==_0x33b1e5&&!_0x13eea7[_0x58a0('0x10')]){oldToken=_0x13eea7[_0x58a0('0x11')];}httpRequest(_0x33b1e5)[_0x58a0('0xd')](function(_0x1b9dd3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1b9dd3['active']){isOldTokenSent=![];if(!_0x13eea7[_0x58a0('0x5')]&&_0x13eea7[_0x58a0('0x5')]!=_0x1b9dd3[_0x58a0('0x5')]||_0x13eea7[_0x58a0('0x5')]&&_0x13eea7[_0x58a0('0x10')]){logger[_0x58a0('0x12')](_0x58a0('0x13'));}if(_0x13eea7[_0x58a0('0x5')]&&!_0x13eea7[_0x58a0('0x10')]&&_0x13eea7[_0x58a0('0x5')]!=_0x1b9dd3[_0x58a0('0x5')]){logger['info'](_0x58a0('0x14'));}if(_0x13eea7[_0x58a0('0x5')]&&!_0x13eea7[_0x58a0('0x10')]&&_0x13eea7[_0x58a0('0x5')]==_0x1b9dd3[_0x58a0('0x5')]){return _0x1cccf4;}return _0x1cccf4[_0x58a0('0x15')]({'data1':_0x33b1e5,'data2':null,'license':_0x1b9dd3[_0x58a0('0x5')]});}else{if(_0x1b9dd3[_0x58a0('0x5')]||_0x13eea7['license']){if(!_0x13eea7[_0x58a0('0x10')]){if(_0x13eea7[_0x58a0('0x11')]==_0x33b1e5){GRAY_PERIOD_REASON=_0x58a0('0x16');logger[_0x58a0('0x12')](_0x58a0('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x58a0('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x13eea7[_0x58a0('0x11')],_0x33b1e5);}logger[_0x58a0('0x12')](_0x58a0('0x18'),GRAY_PERIOD_REASON[_0x58a0('0x19')](),moment()[_0x58a0('0x7')](_0x58a0('0x1a')));return _0x1cccf4['update']({'data2':encryptor[_0x58a0('0x1b')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x58a0('0x1c')](_0x13eea7[_0x58a0('0x10')]),_0x58a0('0x1d'))>DAYS){logger['info'](_0x58a0('0x1e'),moment()[_0x58a0('0x7')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x1cccf4[_0x58a0('0x15')]({'data1':_0x33b1e5,'data2':null,'license':null});}}}else{if(_0x13eea7[_0x58a0('0x11')]!=_0x33b1e5){logger[_0x58a0('0x12')](_0x58a0('0x1f'),_0x13eea7[_0x58a0('0x11')],_0x33b1e5);return _0x1cccf4['update']({'data1':_0x33b1e5,'data2':null,'license':null});}}}return _0x1cccf4;})[_0x58a0('0xd')](function(_0x316686){_0x1cccf4=_0x316686;})[_0x58a0('0xe')](function(_0x3ab71c){logger[_0x58a0('0x20')](_0x3ab71c[_0x58a0('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x58a0('0x22')](),_0x1cccf4);},TIME);});}function defaultLicense(){var _0x8ccd34=hardware[_0x58a0('0x22')]();if(_0x8ccd34){return db[_0x58a0('0x23')][_0x58a0('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x8ccd34}})[_0x58a0('0x25')](function(_0x5153d8,_0x36f87a){logger['info'](_0x58a0('0x26'),_0x8ccd34);manageLicense(_0x8ccd34,_0x5153d8);})[_0x58a0('0xe')](function(_0x5ce40a){logger['error'](_0x5ce40a['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xbdf9=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','days','catch','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','moment','request-promise','bluebird','version','../../mysqldb','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x1e96f7,_0x59125d){var _0x13aee0=function(_0x95f89d){while(--_0x95f89d){_0x1e96f7['push'](_0x1e96f7['shift']());}};_0x13aee0(++_0x59125d);}(_0xbdf9,0xd9));var _0x9bdf=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xbdf9[_0x2f57b2];return _0x5ace77;};'use strict';var util=require(_0x9bdf('0x0'));var moment=require(_0x9bdf('0x1'));var rp=require(_0x9bdf('0x2'));var BPromise=require(_0x9bdf('0x3'));var pkginfo=require('pkginfo')(module,_0x9bdf('0x4'));var db=require(_0x9bdf('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require('../logger')(_0x9bdf('0x6'));var HOST=_0x9bdf('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x40b499){return new BPromise(function(_0x3b5198,_0xb71d6f){var _0x298972=util['format'](_0x9bdf('0x8'),HOST,_0x40b499,module['exports'][_0x9bdf('0x4')]);if(oldToken){_0x298972=util[_0x9bdf('0x9')](_0x9bdf('0xa'),HOST,_0x40b499,module['exports'][_0x9bdf('0x4')],oldToken);}var _0x266af4={'uri':_0x298972,'method':_0x9bdf('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x266af4)[_0x9bdf('0xc')](function(_0x5ee03d){_0x3b5198(_0x5ee03d);})['catch'](function(_0x52123b){_0xb71d6f(_0x52123b);});});}function manageLicense(_0x567131,_0x4a4134){var _0x5a6b5a=_0x4a4134[_0x9bdf('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x5a6b5a[_0x9bdf('0xe')]!==_0x567131&&!_0x5a6b5a['data2']){oldToken=_0x5a6b5a[_0x9bdf('0xe')];}httpRequest(_0x567131)['then'](function(_0x12cf28){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x12cf28['active']){isOldTokenSent=![];if(!_0x5a6b5a[_0x9bdf('0x6')]&&_0x5a6b5a[_0x9bdf('0x6')]!=_0x12cf28['license']||_0x5a6b5a[_0x9bdf('0x6')]&&_0x5a6b5a[_0x9bdf('0xf')]){logger[_0x9bdf('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5a6b5a[_0x9bdf('0x6')]&&!_0x5a6b5a[_0x9bdf('0xf')]&&_0x5a6b5a[_0x9bdf('0x6')]!=_0x12cf28['license']){logger['info'](_0x9bdf('0x11'));}if(_0x5a6b5a[_0x9bdf('0x6')]&&!_0x5a6b5a['data2']&&_0x5a6b5a[_0x9bdf('0x6')]==_0x12cf28[_0x9bdf('0x6')]){return _0x4a4134;}return _0x4a4134[_0x9bdf('0x12')]({'data1':_0x567131,'data2':null,'license':_0x12cf28[_0x9bdf('0x6')]});}else{if(_0x12cf28['license']||_0x5a6b5a[_0x9bdf('0x6')]){if(!_0x5a6b5a[_0x9bdf('0xf')]){if(_0x5a6b5a[_0x9bdf('0xe')]==_0x567131){GRAY_PERIOD_REASON=_0x9bdf('0x13');logger['info'](_0x9bdf('0x14'));}else{GRAY_PERIOD_REASON=_0x9bdf('0x15');logger[_0x9bdf('0x10')](_0x9bdf('0x16'),_0x5a6b5a[_0x9bdf('0xe')],_0x567131);}logger[_0x9bdf('0x10')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x9bdf('0x9')](_0x9bdf('0x17')));return _0x4a4134[_0x9bdf('0x12')]({'data2':encryptor['encryptString'](moment()['format'](_0x9bdf('0x17')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x5a6b5a[_0x9bdf('0xf')]),_0x9bdf('0x18'))>DAYS){logger[_0x9bdf('0x10')]('DEMO\x20START\x20AT\x20%s',moment()[_0x9bdf('0x9')](_0x9bdf('0x17')));isOldTokenSent=![];return _0x4a4134['update']({'data1':_0x567131,'data2':null,'license':null});}}}else{if(_0x5a6b5a[_0x9bdf('0xe')]!=_0x567131){logger[_0x9bdf('0x10')](_0x9bdf('0x16'),_0x5a6b5a['data1'],_0x567131);return _0x4a4134[_0x9bdf('0x12')]({'data1':_0x567131,'data2':null,'license':null});}}}return _0x4a4134;})['then'](function(_0x51f3f3){_0x4a4134=_0x51f3f3;})[_0x9bdf('0x19')](function(_0x1e5987){logger['error'](_0x1e5987[_0x9bdf('0x1a')]);})[_0x9bdf('0x1b')](function(){setTimeout(function(){manageLicense(hardware[_0x9bdf('0x1c')](),_0x4a4134);},TIME);});}function defaultLicense(){var _0x28ea5f=hardware[_0x9bdf('0x1c')]();if(_0x28ea5f){return db[_0x9bdf('0x1d')][_0x9bdf('0x1e')]({'where':{'id':0x1},'defaults':{'data1':_0x28ea5f}})[_0x9bdf('0x1f')](function(_0x42a7d8,_0x4e4a1d){logger[_0x9bdf('0x10')](_0x9bdf('0x20'),_0x28ea5f);manageLicense(_0x28ea5f,_0x42a7d8);})[_0x9bdf('0x19')](function(_0x5398cd){logger[_0x9bdf('0x21')](_0x5398cd[_0x9bdf('0x1a')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ce4e32d..12774c9 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 _0xb8f6=['data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','gray','deadline','machineUuid','disabled','message','findAll','role','COUNT','sequelize','col','count','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','data1','license','isEmpty'];(function(_0xca212f,_0x1e1152){var _0x624483=function(_0x6b36e1){while(--_0x6b36e1){_0xca212f['push'](_0xca212f['shift']());}};_0x624483(++_0x1e1152);}(_0xb8f6,0xa7));var _0x6b8f=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xb8f6[_0x5bd426];return _0x23a7eb;};'use strict';var util=require(_0x6b8f('0x0'));var _=require('lodash');var moment=require(_0x6b8f('0x1'));var BPromise=require(_0x6b8f('0x2'));var hardware=require(_0x6b8f('0x3'));var encryptor=require(_0x6b8f('0x4'));var db=require(_0x6b8f('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6b8f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6b8f('0x7'),'machineUuid':hardware[_0x6b8f('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6b8f('0x9'),'machineUuid':hardware[_0x6b8f('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x353151){return new BPromise(function(_0x5b4aa6,_0x10514c){return db['License'][_0x6b8f('0xa')](_[_0x6b8f('0xb')](_0x353151,{'raw':!![],'where':{'id':0x1}}))[_0x6b8f('0xc')](function(_0x21f04a){return checkLicense(_0x21f04a,null);})['then'](function(_0x383f18){_0x5b4aa6(_0x383f18);return;})[_0x6b8f('0xd')](function(_0x729c84){_0x10514c(_0x729c84);});});}function checkLicense(_0x151d0d,_0x493bbf){if(!_0x151d0d){demoLicense['uuid']=_0x151d0d[_0x6b8f('0xe')];return demoLicense;}try{var _0x142725=_0x493bbf||_0x151d0d[_0x6b8f('0xf')];if(_[_0x6b8f('0x10')](_0x142725)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x26169f=_0x151d0d[_0x6b8f('0xe')];var _0x56cc11=_0x151d0d[_0x6b8f('0x11')];var _0x2c248f=_0x26169f[_0x6b8f('0x12')]('-')[0x4];var _0x23c79f=_0x26169f[_0x6b8f('0x12')]('-')[0x0];var _0x40b383=encryptor[_0x6b8f('0x13')](_0x142725,util[_0x6b8f('0x14')](_0x6b8f('0x15'),_0x2c248f,_0x26169f,_0x23c79f));var _0x37531a=JSON[_0x6b8f('0x16')](_0x40b383);_0x37531a[_0x6b8f('0x17')]=![];_0x37531a[_0x6b8f('0x18')]=_0x26169f;_0x37531a['machineUuid']=hardware[_0x6b8f('0x8')]();if(_0x56cc11){var _0x3b1aae=encryptor[_0x6b8f('0x13')](_0x56cc11);_0x37531a[_0x6b8f('0x19')]=_0x3b1aae;_0x37531a[_0x6b8f('0x1a')]=moment(_0x3b1aae)['add'](0x7,'days')[_0x6b8f('0x14')]();_0x37531a['grayReason']=_0x37531a[_0x6b8f('0x18')]!=_0x37531a[_0x6b8f('0x1b')]?'changed':_0x6b8f('0x1c');}return _0x37531a;}catch(_0x55e7e2){breakingLicense[_0x6b8f('0x18')]=_0x151d0d[_0x6b8f('0xe')];breakingLicense[_0x6b8f('0x1d')]=_0x55e7e2['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x372d76,_0x29e288){getLicense()[_0x6b8f('0xc')](function(_0x311ef2){return db['User'][_0x6b8f('0x1e')]({'attributes':[_0x6b8f('0x1f'),[db['sequelize']['fn'](_0x6b8f('0x20'),db[_0x6b8f('0x21')][_0x6b8f('0x22')](_0x6b8f('0x1f'))),_0x6b8f('0x23')]],'group':_0x6b8f('0x1f'),'where':{'role':{'$or':[_0x6b8f('0x24'),_0x6b8f('0x25'),_0x6b8f('0x26')]}},'raw':!![]})['then'](function(_0x4fb0ec){var _0x1895ce={'user':_0x311ef2['users']||0x0,'telephone':_0x311ef2[_0x6b8f('0x27')]||0x0};_0x4fb0ec[_0x6b8f('0x28')](function(_0x3ac3d6){var _0x26a55d=_0x3ac3d6[_0x6b8f('0x1f')]==='admin'?_0x6b8f('0x25'):_0x3ac3d6['role'];_0x1895ce[_0x26a55d]-=_0x3ac3d6[_0x6b8f('0x23')];if(_0x1895ce[_0x26a55d]<0x0)_0x1895ce[_0x26a55d]=0x0;});_0x372d76(_0x1895ce);return;});})[_0x6b8f('0xd')](function(_0x20f9e6){_0x29e288(_0x20f9e6);});});}function checkUserLimits(_0xe54bc0){return new BPromise(function(_0x4e8564,_0x2d2d00){getLimits()[_0x6b8f('0xc')](function(_0x10a4e3){var _0x5c0d6f=_[_0x6b8f('0x29')](_[_0x6b8f('0x2a')](_0xe54bc0,_0x6b8f('0x1f')),[_0x6b8f('0x24'),'user',_0x6b8f('0x26')]);var _0x493c18=(_0x5c0d6f['admin']||0x0)+(_0x5c0d6f[_0x6b8f('0x25')]||0x0);var _0x8db74=_0x5c0d6f['telephone']||0x0;if(_0x493c18>_0x10a4e3[_0x6b8f('0x25')])return _0x2d2d00(_0x6b8f('0x2b'));if(_0x8db74>_0x10a4e3[_0x6b8f('0x26')])return _0x2d2d00(_0x6b8f('0x2c'));return _0x4e8564();})[_0x6b8f('0xd')](function(_0x14941d){_0x2d2d00(_0x14941d);});});}module[_0x6b8f('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6466=['data1','split','decryptString','format','parse','demo','machineUuid','gray','deadline','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','users','telephones','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found'];(function(_0x1db651,_0x59a68e){var _0x3d547c=function(_0x9b4313){while(--_0x9b4313){_0x1db651['push'](_0x1db651['shift']());}};_0x3d547c(++_0x59a68e);}(_0x6466,0xad));var _0x6646=function(_0x5287df,_0x46c2b6){_0x5287df=_0x5287df-0x0;var _0x187792=_0x6466[_0x5287df];return _0x187792;};'use strict';var util=require(_0x6646('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x6646('0x1'));var encryptor=require(_0x6646('0x2'));var db=require(_0x6646('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6646('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x6646('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6646('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6646('0x6'),'machineUuid':hardware[_0x6646('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x449aad){return new BPromise(function(_0x324456,_0x11bb28){return db[_0x6646('0x7')][_0x6646('0x8')](_[_0x6646('0x9')](_0x449aad,{'raw':!![],'where':{'id':0x1}}))[_0x6646('0xa')](function(_0x23bd71){return checkLicense(_0x23bd71,null);})['then'](function(_0x72d6f3){_0x324456(_0x72d6f3);return;})[_0x6646('0xb')](function(_0x56af42){_0x11bb28(_0x56af42);});});}function checkLicense(_0x1cc0c1,_0x20a1a5){if(!_0x1cc0c1){demoLicense['uuid']=_0x1cc0c1['data1'];return demoLicense;}try{var _0x196659=_0x20a1a5||_0x1cc0c1[_0x6646('0xc')];if(_[_0x6646('0xd')](_0x196659)){throw new Error(_0x6646('0xe'));}var _0x28c106=_0x1cc0c1[_0x6646('0xf')];var _0x3a34c6=_0x1cc0c1['data2'];var _0x13654b=_0x28c106[_0x6646('0x10')]('-')[0x4];var _0x46831d=_0x28c106['split']('-')[0x0];var _0x2c563f=encryptor[_0x6646('0x11')](_0x196659,util[_0x6646('0x12')]('%s:%s:%s',_0x13654b,_0x28c106,_0x46831d));var _0x437bd1=JSON[_0x6646('0x13')](_0x2c563f);_0x437bd1[_0x6646('0x14')]=![];_0x437bd1['uuid']=_0x28c106;_0x437bd1[_0x6646('0x15')]=hardware[_0x6646('0x5')]();if(_0x3a34c6){var _0x1b1ad6=encryptor[_0x6646('0x11')](_0x3a34c6);_0x437bd1[_0x6646('0x16')]=_0x1b1ad6;_0x437bd1[_0x6646('0x17')]=moment(_0x1b1ad6)[_0x6646('0x18')](0x7,_0x6646('0x19'))[_0x6646('0x12')]();_0x437bd1[_0x6646('0x1a')]=_0x437bd1['uuid']!=_0x437bd1[_0x6646('0x15')]?'changed':_0x6646('0x1b');}return _0x437bd1;}catch(_0x8a491){breakingLicense['uuid']=_0x1cc0c1[_0x6646('0xf')];breakingLicense[_0x6646('0x1c')]=_0x8a491[_0x6646('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1c09d3,_0x59adad){getLicense()[_0x6646('0xa')](function(_0x3d1ac6){return db[_0x6646('0x1d')][_0x6646('0x1e')]({'attributes':[_0x6646('0x1f'),[db[_0x6646('0x20')]['fn'](_0x6646('0x21'),db[_0x6646('0x20')][_0x6646('0x22')](_0x6646('0x1f'))),_0x6646('0x23')]],'group':_0x6646('0x1f'),'where':{'role':{'$or':[_0x6646('0x24'),_0x6646('0x25'),'telephone']}},'raw':!![]})[_0x6646('0xa')](function(_0x5b1ffe){var _0x41d8dd={'user':_0x3d1ac6[_0x6646('0x26')]||0x0,'telephone':_0x3d1ac6[_0x6646('0x27')]||0x0};_0x5b1ffe[_0x6646('0x28')](function(_0x5c408e){var _0x2a6c87=_0x5c408e['role']===_0x6646('0x24')?_0x6646('0x25'):_0x5c408e[_0x6646('0x1f')];_0x41d8dd[_0x2a6c87]-=_0x5c408e['count'];if(_0x41d8dd[_0x2a6c87]<0x0)_0x41d8dd[_0x2a6c87]=0x0;});_0x1c09d3(_0x41d8dd);return;});})[_0x6646('0xb')](function(_0x978443){_0x59adad(_0x978443);});});}function checkUserLimits(_0x35903e){return new BPromise(function(_0x2801e2,_0x49645d){getLimits()[_0x6646('0xa')](function(_0x4a3d4a){var _0x4bf935=_[_0x6646('0x29')](_[_0x6646('0x2a')](_0x35903e,_0x6646('0x1f')),[_0x6646('0x24'),_0x6646('0x25'),_0x6646('0x2b')]);var _0x220275=(_0x4bf935[_0x6646('0x24')]||0x0)+(_0x4bf935[_0x6646('0x25')]||0x0);var _0x59fcc3=_0x4bf935['telephone']||0x0;if(_0x220275>_0x4a3d4a[_0x6646('0x25')])return _0x49645d(_0x6646('0x2c'));if(_0x59fcc3>_0x4a3d4a[_0x6646('0x2b')])return _0x49645d(_0x6646('0x2d'));return _0x2801e2();})['catch'](function(_0x34af90){_0x49645d(_0x34af90);});});}module[_0x6646('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index ef53b32..aeef79c 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 _0xe511=['app-id','exports','http://localhost:9000'];(function(_0x1c4b8d,_0x146a41){var _0x203346=function(_0x541d4d){while(--_0x541d4d){_0x1c4b8d['push'](_0x1c4b8d['shift']());}};_0x203346(++_0x146a41);}(_0xe511,0x16f));var _0x1e51=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe511[_0x465028];return _0xb783d4;};'use strict';module[_0x1e51('0x0')]={'DOMAIN':_0x1e51('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x1e51('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x5204=['http://localhost:9000','app-id','secret','exports'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x5204,0xdf));var _0x4520=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0x5204[_0x58fc2f];return _0x3a1312;};'use strict';module[_0x4520('0x0')]={'DOMAIN':_0x4520('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4520('0x2'),'GOOGLE_SECRET':_0x4520('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8421697..c4f5ef2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x695a=['INFO','join','log','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','File','%s-%s','error','transports','info','Console','debugLevel','winston','path'];(function(_0x366ef0,_0x2534b8){var _0x1e8024=function(_0x5e54cb){while(--_0x5e54cb){_0x366ef0['push'](_0x366ef0['shift']());}};_0x1e8024(++_0x2534b8);}(_0x695a,0x16e));var _0xa695=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x695a[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var winston=require(_0xa695('0x0'));var util=require('util');var path=require(_0xa695('0x1'));var debugLevel=_0xa695('0x2');function filename(_0x1420d9,_0x1146e1){return path[_0xa695('0x3')]('/var',_0xa695('0x4'),'xcally',util[_0xa695('0x5')](_0xa695('0x6'),_0x1420d9,_0x1146e1));}function formatter(_0x45a9f5,_0x444ee4){_0x444ee4[_0xa695('0x7')]=_0x444ee4[_0xa695('0x7')][_0xa695('0x8')](/@@{/g,_0xa695('0x9'))['replace'](/}@@/g,_0xa695('0xa'))['replace'](/@{/g,'{{')[_0xa695('0x8')](/}@/g,'}}');return util[_0xa695('0x5')](_0xa695('0xb'),moment()['format'](_0xa695('0xc')),_0x444ee4[_0xa695('0xd')][_0xa695('0xe')](),_0x45a9f5,_0x444ee4[_0xa695('0x7')]);}module[_0xa695('0xf')]=function(_0x10b02b){return new winston['Logger']({'transports':[new winston['transports'][(_0xa695('0x10'))]({'name':util['format'](_0xa695('0x11'),_0x10b02b,'error'),'filename':filename(_0x10b02b,_0xa695('0x12')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3eeeba){return formatter(_0x10b02b,_0x3eeeba);}}),new winston[(_0xa695('0x13'))][(_0xa695('0x10'))]({'name':util[_0xa695('0x5')]('%s-%s',_0x10b02b,'info'),'filename':filename(_0x10b02b,_0xa695('0x14')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x29d191){return formatter(_0x10b02b,_0x29d191);}}),new winston[(_0xa695('0x13'))][(_0xa695('0x15'))]({'level':process['env'][_0xa695('0x16')]||debugLevel,'json':![],'formatter':function(_0x46773e){return formatter(_0x10b02b,_0x46773e);}})]});}; \ No newline at end of file +var _0xaf21=['info','Console','env','moment','util','path','INFO','join','xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error'];(function(_0x539931,_0xa159f){var _0x20b75a=function(_0x3da683){while(--_0x3da683){_0x539931['push'](_0x539931['shift']());}};_0x20b75a(++_0xa159f);}(_0xaf21,0x12f));var _0x1af2=function(_0x291a95,_0x56569d){_0x291a95=_0x291a95-0x0;var _0x2221c6=_0xaf21[_0x291a95];return _0x2221c6;};'use strict';var moment=require(_0x1af2('0x0'));var winston=require('winston');var util=require(_0x1af2('0x1'));var path=require(_0x1af2('0x2'));var debugLevel=_0x1af2('0x3');function filename(_0x32bd1d,_0x15df5f){return path[_0x1af2('0x4')]('/var','log',_0x1af2('0x5'),util[_0x1af2('0x6')](_0x1af2('0x7'),_0x32bd1d,_0x15df5f));}function formatter(_0x3192d9,_0x26ba04){_0x26ba04[_0x1af2('0x8')]=_0x26ba04[_0x1af2('0x8')][_0x1af2('0x9')](/@@{/g,_0x1af2('0xa'))[_0x1af2('0x9')](/}@@/g,_0x1af2('0xb'))['replace'](/@{/g,'{{')[_0x1af2('0x9')](/}@/g,'}}');return util[_0x1af2('0x6')](_0x1af2('0xc'),moment()[_0x1af2('0x6')](_0x1af2('0xd')),_0x26ba04[_0x1af2('0xe')][_0x1af2('0xf')](),_0x3192d9,_0x26ba04[_0x1af2('0x8')]);}module[_0x1af2('0x10')]=function(_0x370475){return new winston[(_0x1af2('0x11'))]({'transports':[new winston[(_0x1af2('0x12'))][(_0x1af2('0x13'))]({'name':util[_0x1af2('0x6')](_0x1af2('0x14'),_0x370475,_0x1af2('0x15')),'filename':filename(_0x370475,_0x1af2('0x15')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d97db){return formatter(_0x370475,_0x5d97db);}}),new winston[(_0x1af2('0x12'))][(_0x1af2('0x13'))]({'name':util[_0x1af2('0x6')](_0x1af2('0x14'),_0x370475,'info'),'filename':filename(_0x370475,_0x1af2('0x16')),'level':_0x1af2('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x39016a){return formatter(_0x370475,_0x39016a);}}),new winston[(_0x1af2('0x12'))][(_0x1af2('0x17'))]({'level':process[_0x1af2('0x18')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x42e695){return formatter(_0x370475,_0x42e695);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 7a71f34..4d4a493 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 _0x28e4=['../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x28e4,0x16d));var _0x428e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28e4[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x428e('0x0'));var os=require('os');var config={'apps':[{'name':_0x428e('0x1'),'script':path[_0x428e('0x2')](__dirname,_0x428e('0x3'))},{'name':_0x428e('0x4'),'script':path[_0x428e('0x2')](__dirname,_0x428e('0x5'))},{'name':_0x428e('0x6'),'script':path[_0x428e('0x2')](__dirname,_0x428e('0x7'))},{'name':_0x428e('0x8'),'script':path['join'](__dirname,_0x428e('0x9'))},{'name':_0x428e('0xa'),'script':path[_0x428e('0x2')](__dirname,_0x428e('0xb'))},{'name':'xdr','script':path[_0x428e('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0xc753=['path','express','join','../../services/express/index.js','ami','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x22ce72,_0x532c20){var _0xaf0fb5=function(_0x15f37d){while(--_0x15f37d){_0x22ce72['push'](_0x22ce72['shift']());}};_0xaf0fb5(++_0x532c20);}(_0xc753,0x1c7));var _0x3c75=function(_0x22729a,_0x33b777){_0x22729a=_0x22729a-0x0;var _0x593dc6=_0xc753[_0x22729a];return _0x593dc6;};'use strict';var path=require(_0x3c75('0x0'));var os=require('os');var config={'apps':[{'name':_0x3c75('0x1'),'script':path[_0x3c75('0x2')](__dirname,_0x3c75('0x3'))},{'name':_0x3c75('0x4'),'script':path[_0x3c75('0x2')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path['join'](__dirname,_0x3c75('0x5'))},{'name':_0x3c75('0x6'),'script':path['join'](__dirname,_0x3c75('0x7'))},{'name':_0x3c75('0x8'),'script':path['join'](__dirname,_0x3c75('0x9'))},{'name':_0x3c75('0xa'),'script':path[_0x3c75('0x2')](__dirname,_0x3c75('0xb'))}]};module[_0x3c75('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f43b6de..f6b016b 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 _0x80ba=['./config','connect','start','then','stop','restart','list','describe','disconnect','delete','dump','saved','pm2','bluebird'];(function(_0x3378bd,_0x4c2a94){var _0x276df0=function(_0x3000c6){while(--_0x3000c6){_0x3378bd['push'](_0x3378bd['shift']());}};_0x276df0(++_0x4c2a94);}(_0x80ba,0x6e));var _0xa80b=function(_0x49f35b,_0x15f0a4){_0x49f35b=_0x49f35b-0x0;var _0x262b59=_0x80ba[_0x49f35b];return _0x262b59;};'use strict';var pm2=require(_0xa80b('0x0'));var BPromise=require(_0xa80b('0x1'));var config=require(_0xa80b('0x2'));function connect(){return new BPromise(function(_0x5ba03a,_0x28128c){return pm2[_0xa80b('0x3')](function(_0x6d599a){if(_0x6d599a){return _0x28128c(_0x6d599a);}return _0x5ba03a('connected');});});};exports[_0xa80b('0x4')]=function(_0x2596b5){return connect()[_0xa80b('0x5')](function(){return new BPromise(function(_0x4c3e61,_0x567ef2){return pm2[_0xa80b('0x4')](_0x2596b5,function(_0x33774a,_0x536733){if(_0x33774a){return _0x567ef2(_0x33774a);}pm2['disconnect']();return _0x4c3e61(_0x536733);});});});};exports['stop']=function(_0xe8d8b8){return connect()[_0xa80b('0x5')](function(){return new BPromise(function(_0x281852,_0x44bbdc){return pm2[_0xa80b('0x6')](_0xe8d8b8,function(_0x2dac2c,_0x448985){if(_0x2dac2c){return _0x44bbdc(_0x2dac2c);}pm2['disconnect']();return _0x281852(_0x448985);});});});};exports[_0xa80b('0x7')]=function(_0x5cabdf){return connect()[_0xa80b('0x5')](function(){return new BPromise(function(_0x2f942a,_0x1508dd){return pm2[_0xa80b('0x7')](_0x5cabdf,function(_0x2bd1dd,_0x164604){if(_0x2bd1dd){return _0x1508dd(_0x2bd1dd);}pm2['disconnect']();return _0x2f942a(_0x164604);});});});};exports['list']=function(){return connect()[_0xa80b('0x5')](function(){return new BPromise(function(_0x59086b,_0x4f809f){return pm2[_0xa80b('0x8')](function(_0x3a5e9f,_0x3f873e){if(_0x3a5e9f){return _0x4f809f(_0x3a5e9f);}pm2['disconnect']();return _0x59086b(_0x3f873e);});});});};exports[_0xa80b('0x9')]=function(_0x120ba3){return connect()[_0xa80b('0x5')](function(){return new BPromise(function(_0x5b91d7,_0x32b096){return pm2['describe'](_0x120ba3,function(_0x3fa54e,_0x450793){if(_0x3fa54e){return _0x32b096(_0x3fa54e);}pm2[_0xa80b('0xa')]();return _0x5b91d7(_0x450793);});});});};exports[_0xa80b('0xb')]=function(_0x581a2a){return connect()[_0xa80b('0x5')](function(){return new BPromise(function(_0x4d7b5f,_0x2694af){return pm2[_0xa80b('0xb')](_0x581a2a,function(_0x9beccf,_0x517e76){if(_0x9beccf){return _0x2694af(_0x9beccf);}pm2[_0xa80b('0xa')]();return _0x4d7b5f(_0x517e76);});});});};exports[_0xa80b('0xc')]=function(){return connect()[_0xa80b('0x5')](function(){return new BPromise(function(_0x29fe56,_0x30cddd){return pm2[_0xa80b('0xc')](function(_0x43e2b9){if(_0x43e2b9){return _0x30cddd(_0x43e2b9);}return _0x29fe56(_0xa80b('0xd'));});});});}; \ No newline at end of file +var _0xc938=['start','disconnect','stop','then','restart','list','describe','delete','dump','pm2','connect'];(function(_0x147218,_0x26073c){var _0x49d74f=function(_0x19e6ce){while(--_0x19e6ce){_0x147218['push'](_0x147218['shift']());}};_0x49d74f(++_0x26073c);}(_0xc938,0xf0));var _0x8c93=function(_0x164284,_0x24cdc8){_0x164284=_0x164284-0x0;var _0x5b6496=_0xc938[_0x164284];return _0x5b6496;};'use strict';var pm2=require(_0x8c93('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x4ec049,_0x100f86){return pm2[_0x8c93('0x1')](function(_0x195bd9){if(_0x195bd9){return _0x100f86(_0x195bd9);}return _0x4ec049('connected');});});};exports['start']=function(_0x43fcc0){return connect()['then'](function(){return new BPromise(function(_0x1b1154,_0x3937ab){return pm2[_0x8c93('0x2')](_0x43fcc0,function(_0x8d48f,_0x2c8140){if(_0x8d48f){return _0x3937ab(_0x8d48f);}pm2[_0x8c93('0x3')]();return _0x1b1154(_0x2c8140);});});});};exports[_0x8c93('0x4')]=function(_0x2b79bd){return connect()[_0x8c93('0x5')](function(){return new BPromise(function(_0x3d69f7,_0xae517e){return pm2[_0x8c93('0x4')](_0x2b79bd,function(_0x42e363,_0x48f779){if(_0x42e363){return _0xae517e(_0x42e363);}pm2['disconnect']();return _0x3d69f7(_0x48f779);});});});};exports[_0x8c93('0x6')]=function(_0x312a03){return connect()[_0x8c93('0x5')](function(){return new BPromise(function(_0x42c4d4,_0x4a5897){return pm2[_0x8c93('0x6')](_0x312a03,function(_0x1206a1,_0x24fa28){if(_0x1206a1){return _0x4a5897(_0x1206a1);}pm2[_0x8c93('0x3')]();return _0x42c4d4(_0x24fa28);});});});};exports[_0x8c93('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x44c755,_0x19bd20){return pm2[_0x8c93('0x7')](function(_0x46ed20,_0x5d06c5){if(_0x46ed20){return _0x19bd20(_0x46ed20);}pm2[_0x8c93('0x3')]();return _0x44c755(_0x5d06c5);});});});};exports[_0x8c93('0x8')]=function(_0x5d30c6){return connect()[_0x8c93('0x5')](function(){return new BPromise(function(_0x808874,_0x39b643){return pm2['describe'](_0x5d30c6,function(_0x2dcfb6,_0x51a0c5){if(_0x2dcfb6){return _0x39b643(_0x2dcfb6);}pm2[_0x8c93('0x3')]();return _0x808874(_0x51a0c5);});});});};exports[_0x8c93('0x9')]=function(_0xbbbdb2){return connect()['then'](function(){return new BPromise(function(_0xff70ba,_0xe65002){return pm2[_0x8c93('0x9')](_0xbbbdb2,function(_0x5852c0,_0x1c77a2){if(_0x5852c0){return _0xe65002(_0x5852c0);}pm2[_0x8c93('0x3')]();return _0xff70ba(_0x1c77a2);});});});};exports['dump']=function(){return connect()[_0x8c93('0x5')](function(){return new BPromise(function(_0x58ed44,_0x2b5fd9){return pm2[_0x8c93('0xa')](function(_0x75457c){if(_0x75457c){return _0x2b5fd9(_0x75457c);}return _0x58ed44('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b0352de..c121c00 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 _0x623e=['ChatInteraction','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x2ee34e,_0x1b531b){var _0x23b50b=function(_0xdd3bf6){while(--_0xdd3bf6){_0x2ee34e['push'](_0x2ee34e['shift']());}};_0x23b50b(++_0x1b531b);}(_0x623e,0xe3));var _0xe623=function(_0xedd1a2,_0x201c54){_0xedd1a2=_0xedd1a2-0x0;var _0x302bea=_0x623e[_0xedd1a2];return _0x302bea;};'use strict';var _=require(_0xe623('0x0'));var moment=require('moment');var Redis=require(_0xe623('0x1'));var util=require(_0xe623('0x2'));var config=require(_0xe623('0x3'));var db=require(_0xe623('0x4'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xe623('0x5')](config[_0xe623('0x6')],{'host':_0xe623('0x7'),'port':0x18eb});var io=require(_0xe623('0x8'))(new Redis(config[_0xe623('0x6')]));function closeInteractions(){var _0x4626ff=0x0;var _0x537ab2=[];return db[_0xe623('0x9')][_0xe623('0xa')]({'raw':!![],'attributes':['id',_0xe623('0xb')],'where':{'id':0x1}})[_0xe623('0xc')](function(_0x4f3025){_0x4626ff=_0x4f3025[_0xe623('0xb')];if(_0x4626ff){return db['ChatInteraction'][_0xe623('0xd')]({'raw':!![],'attributes':['id',_0xe623('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xe623('0xf')](_0x4f3025[_0xe623('0xb')],_0xe623('0x10'))}}});}else{return[];}})[_0xe623('0xc')](function(_0x30b54c){if(_0x30b54c&&_0x30b54c[_0xe623('0x11')]){_0x537ab2=_['map'](_0x30b54c||[],'id');logger[_0xe623('0x12')](_0xe623('0x13'),_0x537ab2[_0xe623('0x14')]());return db[_0xe623('0x15')]['update']({'closeReason':_0xe623('0x16'),'disposition':_0xe623('0x17'),'closed':!![],'closedAt':moment()[_0xe623('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x537ab2}});}})[_0xe623('0xc')](function(){if(_0x537ab2&&_0x537ab2[_0xe623('0x11')]){logger[_0xe623('0x12')](_0xe623('0x19'),_0x537ab2['join']());for(var _0x42a5ab=0x0;_0x42a5ab<_0x537ab2[_0xe623('0x11')];_0x42a5ab++){io[_0xe623('0x1a')](_0xe623('0x1b'),{'id':_0x537ab2[_0x42a5ab],'closed':!![]});}}})[_0xe623('0x1c')](function(_0x288e02){logger['error'](_0xe623('0x1d'),_0x288e02?util[_0xe623('0x1e')](_0x288e02,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa0b7=['length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes'];(function(_0x1894cd,_0x460529){var _0x34636a=function(_0x10a85e){while(--_0x10a85e){_0x1894cd['push'](_0x1894cd['shift']());}};_0x34636a(++_0x460529);}(_0xa0b7,0x80));var _0x7a0b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa0b7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7a0b('0x0'));var moment=require(_0x7a0b('0x1'));var Redis=require(_0x7a0b('0x2'));var util=require(_0x7a0b('0x3'));var config=require(_0x7a0b('0x4'));var db=require(_0x7a0b('0x5'))['db'];var logger=require(_0x7a0b('0x6'))(_0x7a0b('0x7'));config[_0x7a0b('0x8')]=_[_0x7a0b('0x9')](config[_0x7a0b('0x8')],{'host':_0x7a0b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a0b('0x8')]));function closeInteractions(){var _0x263250=0x0;var _0x5bc12f=[];return db[_0x7a0b('0xb')][_0x7a0b('0xc')]({'raw':!![],'attributes':['id',_0x7a0b('0xd')],'where':{'id':0x1}})[_0x7a0b('0xe')](function(_0x342a16){_0x263250=_0x342a16[_0x7a0b('0xd')];if(_0x263250){return db[_0x7a0b('0xf')][_0x7a0b('0x10')]({'raw':!![],'attributes':['id',_0x7a0b('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7a0b('0x12')](_0x342a16[_0x7a0b('0xd')],_0x7a0b('0x13'))}}});}else{return[];}})['then'](function(_0x229fe3){if(_0x229fe3&&_0x229fe3[_0x7a0b('0x14')]){_0x5bc12f=_[_0x7a0b('0x15')](_0x229fe3||[],'id');logger[_0x7a0b('0x16')](_0x7a0b('0x17'),_0x5bc12f[_0x7a0b('0x18')]());return db[_0x7a0b('0xf')][_0x7a0b('0x19')]({'closeReason':_0x7a0b('0x1a'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x7a0b('0x1b')](_0x7a0b('0x1c'))},{'where':{'id':_0x5bc12f}});}})[_0x7a0b('0xe')](function(){if(_0x5bc12f&&_0x5bc12f[_0x7a0b('0x14')]){logger[_0x7a0b('0x16')](_0x7a0b('0x1d'),_0x5bc12f[_0x7a0b('0x18')]());for(var _0x5ab49b=0x0;_0x5ab49b<_0x5bc12f[_0x7a0b('0x14')];_0x5ab49b++){io[_0x7a0b('0x1e')](_0x7a0b('0x1f'),{'id':_0x5bc12f[_0x5ab49b],'closed':!![]});}}})[_0x7a0b('0x20')](function(_0x488f23){logger[_0x7a0b('0x21')](_0x7a0b('0x22'),_0x488f23?util[_0x7a0b('0x23')](_0x488f23,{'showHidden':![],'depth':null}):'');});}exports[_0x7a0b('0x24')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5cb56ad..b08215b 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 _0xbec9=['stop\x20cron','endAt','update','update\x20cron','util','path','lodash','moment','cron-job-manager','bluebird','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','savename','%s.%s','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','length','stop','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','exists','deleteJob'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbec9,0x1cb));var _0x9bec=function(_0x29097e,_0x33308a){_0x29097e=_0x29097e-0x0;var _0x85d1e=_0xbec9[_0x29097e];return _0x85d1e;};'use strict';var fs=require('fs');var util=require(_0x9bec('0x0'));var path=require(_0x9bec('0x1'));var _=require(_0x9bec('0x2'));var moment=require(_0x9bec('0x3'));var CronJobManager=require(_0x9bec('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x9bec('0x5'));var logger=require('../logger')('schedule');var db=require(_0x9bec('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x9bec('0x7'));var client=jayson[_0x9bec('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3cef56,_0x4d2ffa){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x3cef56[_0x9bec('0x9')]);var _0x361be4=!![];var _0x2c73e0={'tls':{'rejectUnauthorized':![]}};if(_0x3cef56[_0x9bec('0xa')][_0x9bec('0xb')][_0x9bec('0xc')]){_0x2c73e0[_0x9bec('0xc')]=_0x3cef56[_0x9bec('0xa')][_0x9bec('0xb')][_0x9bec('0xc')];}else{_0x2c73e0[_0x9bec('0xd')]=_0x3cef56['MailAccount'][_0x9bec('0xb')][_0x9bec('0xd')];_0x2c73e0[_0x9bec('0xe')]=_0x3cef56['MailAccount'][_0x9bec('0xb')][_0x9bec('0xe')];_0x2c73e0[_0x9bec('0xf')]=_0x3cef56[_0x9bec('0xa')][_0x9bec('0xb')]['secure'];}if(_0x3cef56['MailAccount']['Smtp'][_0x9bec('0x10')]){_0x2c73e0[_0x9bec('0x11')]={'user':_0x3cef56[_0x9bec('0xa')]['Smtp'][_0x9bec('0x12')],'pass':_0x3cef56[_0x9bec('0xa')]['Smtp'][_0x9bec('0x13')]};}var _0xf3f296={'account':_0x2c73e0,'message':{'from':util[_0x9bec('0x14')]('\x22%s\x22\x20<%s>',_0x3cef56[_0x9bec('0xa')][_0x9bec('0x15')],_0x3cef56[_0x9bec('0xa')]['email']||_0x3cef56['MailAccount'][_0x9bec('0xb')][_0x9bec('0x12')]),'to':_0x3cef56[_0x9bec('0x9')],'cc':_0x3cef56['cc'],'bcc':_0x3cef56[_0x9bec('0x16')],'subject':util[_0x9bec('0x14')](_0x9bec('0x17'),_0x4d2ffa[_0x9bec('0x15')],_0x3cef56['subtractNumber'],_0x3cef56[_0x9bec('0x18')])}};var _0x30b267=path[_0x9bec('0x19')](__dirname,'../../files/reports');var _0x259ad2=_0x4d2ffa[_0x9bec('0x1a')];var _0x2c940e=util['format'](_0x9bec('0x1b'),path['basename'](_0x4d2ffa[_0x9bec('0x1a')],path[_0x9bec('0x1c')](_0x4d2ffa[_0x9bec('0x1a')])),_0x9bec('0x1d'));var _0xeda04a=path[_0x9bec('0x19')](_0x30b267,_0x259ad2);var _0x4cd678=path['join'](_0x30b267,_0x2c940e);if(fs[_0x9bec('0x1e')](_0xeda04a)){_0x4d2ffa[_0x9bec('0x1f')]=_0x9bec('0x20');_0xf3f296[_0x9bec('0x21')]['attachments']=[{'filename':_0x259ad2,'path':_0xeda04a}];_0xf3f296[_0x9bec('0x21')][_0x9bec('0x22')]=util[_0x9bec('0x14')](_0x9bec('0x23'),JSON[_0x9bec('0x24')](_0x4d2ffa,null,0x2));}else if(fs[_0x9bec('0x1e')](_0x4cd678)){_0x4d2ffa[_0x9bec('0x1f')]=_0x9bec('0x20');_0xf3f296[_0x9bec('0x21')][_0x9bec('0x25')]=[{'filename':_0x2c940e,'path':_0x4cd678}];}else{_0xf3f296['message'][_0x9bec('0x22')]=_0x9bec('0x26');if(!_0x3cef56[_0x9bec('0x27')]){_0x361be4=![];logger[_0x9bec('0x28')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x361be4){return client[_0x9bec('0x29')](_0x9bec('0x2a'),_0xf3f296)[_0x9bec('0x2b')](function(_0x2879f9){if(_0x2879f9[_0x9bec('0x2c')]){return logger[_0x9bec('0x2c')](_0x9bec('0x2d'),JSON[_0x9bec('0x24')](_0x2879f9));}return logger[_0x9bec('0x28')](_0x9bec('0x2e'));})[_0x9bec('0x2f')](function(_0x2b4f1d){return logger[_0x9bec('0x2c')]('error\x20mail',JSON[_0x9bec('0x24')](_0x2b4f1d));});}};}function handleError(){return function(_0x24d298){return logger[_0x9bec('0x2c')](JSON[_0x9bec('0x24')](_0x24d298));};}function handleResult(_0x223b70){return function(_0x3ddd1d){logger['info'](_0x9bec('0x30'),JSON['stringify'](_0x3ddd1d));if(_0x223b70[_0x9bec('0xa')]&&_0x223b70[_0x9bec('0xa')][_0x9bec('0xb')]&&!_['isNil'](_0x223b70['email'])){setTimeout(handleSendEmail(_0x223b70,_0x3ddd1d),0x3c*0x3e8);}};}function handleJob(_0x58a9f6){return function(){try{if(_[_0x9bec('0x31')](_0x58a9f6[_0x9bec('0x32')])){return logger[_0x9bec('0x28')](_0x9bec('0x33'));}if(_[_0x9bec('0x31')](_0x58a9f6[_0x9bec('0x18')])){return logger[_0x9bec('0x28')]('subtractUnit\x20null\x20or\x20undefined');}var _0x57e2b7={'startDate':moment()[_0x9bec('0x34')](_0x58a9f6[_0x9bec('0x32')],_0x58a9f6[_0x9bec('0x18')])[_0x9bec('0x14')](_0x9bec('0x35')),'endDate':moment()['format'](_0x9bec('0x35')),'type':_0x9bec('0x36'),'output':_0x58a9f6[_0x9bec('0x37')],'name':_0x58a9f6[_0x9bec('0x15')]};if(!_[_0x9bec('0x31')](_0x58a9f6['DefaultReportId'])){logger[_0x9bec('0x28')](_0x9bec('0x38'),_0x58a9f6[_0x9bec('0x39')]);return analyticDefaultReportController[_0x9bec('0x3a')]({'id':_0x58a9f6[_0x9bec('0x39')]},_0x57e2b7)[_0x9bec('0x2b')](handleResult(_0x58a9f6))[_0x9bec('0x2f')](handleError());}if(!_[_0x9bec('0x31')](_0x58a9f6[_0x9bec('0x3b')])){logger[_0x9bec('0x28')](_0x9bec('0x3c'),_0x58a9f6['CustomReportId']);return analyticCustomReportController[_0x9bec('0x3a')]({'id':_0x58a9f6[_0x9bec('0x3b')]},_0x57e2b7)[_0x9bec('0x2b')](handleResult(_0x58a9f6))[_0x9bec('0x2f')](handleError());}}catch(_0x2d627b){logger['error'](JSON[_0x9bec('0x24')](_0x2d627b));}return logger[_0x9bec('0x28')](_0x9bec('0x3d'));};}function getJobs(_0x5e7889){var _0x57a47b={};if(_0x5e7889){_0x57a47b['id']=_0x5e7889;}return db[_0x9bec('0x3e')][_0x9bec('0x3f')]({'where':_0x57a47b,'include':[{'model':db[_0x9bec('0xa')],'attributes':['id',_0x9bec('0x15'),_0x9bec('0x9')],'include':[{'model':db[_0x9bec('0x40')],'as':_0x9bec('0xb')}]}]})[_0x9bec('0x2b')](function(_0x46c4ec){var _0x519076=_[_0x9bec('0x41')](manager[_0x9bec('0x42')]);var _0x4aa223=_[_0x9bec('0x43')](_0x46c4ec,function(_0x478a76){return _0x478a76['id'][_0x9bec('0x44')]();});var _0x14cd20=_[_0x9bec('0x45')](_0x46c4ec,function(_0x460cf0){return _0x460cf0['id'][_0x9bec('0x44')]();});var _0x33e5af=_0x5e7889?_0x4aa223:_[_0x9bec('0x46')](_0x4aa223,_0x519076);var _0x1616a5=_['intersection'](_0x4aa223,_0x519076);var _0x3ab6b7=_[_0x9bec('0x46')](_0x519076,_0x4aa223);var _0x3d4546;var _0x539d2f;for(_0x3d4546=0x0;_0x3d4546<_0x3ab6b7[_0x9bec('0x47')]&&!_0x5e7889;_0x3d4546+=0x1){_0x539d2f=_0x3ab6b7[_0x3d4546]['toString']();if(manager['exists'](_0x539d2f)){manager[_0x9bec('0x48')](_0x539d2f);manager['deleteJob'](_0x539d2f);logger[_0x9bec('0x28')](_0x9bec('0x49'),_0x539d2f);}}logger[_0x9bec('0x28')](_0x9bec('0x4a'),JSON[_0x9bec('0x24')](_0x33e5af));for(_0x3d4546=0x0;_0x3d4546<_0x33e5af[_0x9bec('0x47')];_0x3d4546+=0x1){_0x539d2f=_0x33e5af[_0x3d4546][_0x9bec('0x44')]();logger[_0x9bec('0x28')]('index',_0x539d2f);if(_0x5e7889){logger[_0x9bec('0x28')](_0x9bec('0x4b'),_0x5e7889);logger[_0x9bec('0x28')](JSON[_0x9bec('0x24')](_0x14cd20[_0x539d2f]));BPromise[_0x9bec('0x4c')]()[_0x9bec('0x2b')](handleJob(_0x14cd20[_0x539d2f]));logger[_0x9bec('0x28')](_0x9bec('0x4d'),_0x14cd20[_0x539d2f][_0x9bec('0x15')],_0x14cd20[_0x539d2f]['cron']);}else if(_0x14cd20[_0x539d2f][_0x9bec('0x4e')]&&_0x14cd20[_0x539d2f][_0x9bec('0x4f')]&&moment()[_0x9bec('0x50')](_0x14cd20[_0x539d2f][_0x9bec('0x51')],_0x14cd20[_0x539d2f]['endAt'])){manager[_0x9bec('0x52')](_0x539d2f,_0x14cd20[_0x539d2f][_0x9bec('0x4e')],handleJob(_0x14cd20[_0x539d2f]));manager[_0x9bec('0x53')](_0x539d2f);logger[_0x9bec('0x28')](_0x9bec('0x54'),_0x14cd20[_0x539d2f][_0x9bec('0x15')],_0x14cd20[_0x539d2f]['cron']);}else if(manager[_0x9bec('0x55')](_0x539d2f)){manager[_0x9bec('0x48')](_0x539d2f);manager[_0x9bec('0x56')](_0x539d2f);logger[_0x9bec('0x28')](_0x9bec('0x57'),_0x14cd20[_0x539d2f][_0x9bec('0x15')],_0x14cd20[_0x539d2f][_0x9bec('0x4e')]);}}for(_0x3d4546=0x0,_0x539d2f;_0x3d4546<_0x1616a5['length']&&!_0x5e7889;_0x3d4546+=0x1){_0x539d2f=_0x1616a5[_0x3d4546][_0x9bec('0x44')]();if(manager[_0x9bec('0x55')](_0x539d2f)){if(_0x14cd20[_0x539d2f][_0x9bec('0x4e')]&&_0x14cd20[_0x539d2f][_0x9bec('0x4f')]&&moment()[_0x9bec('0x50')](_0x14cd20[_0x539d2f][_0x9bec('0x51')],_0x14cd20[_0x539d2f][_0x9bec('0x58')])){manager[_0x9bec('0x59')](_0x539d2f,_0x14cd20[_0x539d2f][_0x9bec('0x4e')],handleJob(_0x14cd20[_0x539d2f]));logger[_0x9bec('0x28')](_0x9bec('0x5a'),_0x14cd20[_0x539d2f][_0x9bec('0x15')],_0x14cd20[_0x539d2f][_0x9bec('0x4e')]);}else{manager[_0x9bec('0x48')](_0x539d2f);manager[_0x9bec('0x56')](_0x539d2f);logger[_0x9bec('0x28')](_0x9bec('0x57'),_0x14cd20[_0x539d2f]['name'],_0x14cd20[_0x539d2f][_0x9bec('0x4e')]);}}}})[_0x9bec('0x2f')](function(_0x103e87){logger[_0x9bec('0x2c')](JSON['stringify'](_0x103e87));});}exports['run']=function(_0x5e7277){return getJobs(_0x5e7277);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xbd20=['data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','intersection','exists','stop','toRun','length','index','run\x20job','active','isBetween','endAt','add','cron','start','deleteJob','stop\x20cron','startAt','update','update\x20cron','path','lodash','cron-job-manager','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','email','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','name','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','error\x20mail'];(function(_0x2516c0,_0x54bc6a){var _0x2fadf4=function(_0x39a97d){while(--_0x39a97d){_0x2516c0['push'](_0x2516c0['shift']());}};_0x2fadf4(++_0x54bc6a);}(_0xbd20,0xce));var _0x0bd2=function(_0x5db1a4,_0x14aa78){_0x5db1a4=_0x5db1a4-0x0;var _0x21ac3f=_0xbd20[_0x5db1a4];return _0x21ac3f;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x0bd2('0x0'));var _=require(_0x0bd2('0x1'));var moment=require('moment');var CronJobManager=require(_0x0bd2('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0x0bd2('0x3'));var logger=require('../logger')('schedule');var db=require(_0x0bd2('0x4'))['db'];var analyticCustomReportController=require(_0x0bd2('0x5'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x0bd2('0x6')][_0x0bd2('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4159fa,_0x216952){return function(){logger[_0x0bd2('0x8')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4159fa[_0x0bd2('0x9')]);var _0x45c395=!![];var _0x3ac683={'tls':{'rejectUnauthorized':![]}};if(_0x4159fa['MailAccount'][_0x0bd2('0xa')][_0x0bd2('0xb')]){_0x3ac683[_0x0bd2('0xb')]=_0x4159fa[_0x0bd2('0xc')][_0x0bd2('0xa')][_0x0bd2('0xb')];}else{_0x3ac683[_0x0bd2('0xd')]=_0x4159fa[_0x0bd2('0xc')][_0x0bd2('0xa')][_0x0bd2('0xd')];_0x3ac683[_0x0bd2('0xe')]=_0x4159fa[_0x0bd2('0xc')][_0x0bd2('0xa')][_0x0bd2('0xe')];_0x3ac683[_0x0bd2('0xf')]=_0x4159fa[_0x0bd2('0xc')][_0x0bd2('0xa')]['secure'];}if(_0x4159fa[_0x0bd2('0xc')][_0x0bd2('0xa')][_0x0bd2('0x10')]){_0x3ac683[_0x0bd2('0x11')]={'user':_0x4159fa['MailAccount'][_0x0bd2('0xa')][_0x0bd2('0x12')],'pass':_0x4159fa['MailAccount'][_0x0bd2('0xa')][_0x0bd2('0x13')]};}var _0xce68ac={'account':_0x3ac683,'message':{'from':util[_0x0bd2('0x14')](_0x0bd2('0x15'),_0x4159fa['MailAccount']['name'],_0x4159fa['MailAccount']['email']||_0x4159fa[_0x0bd2('0xc')][_0x0bd2('0xa')][_0x0bd2('0x12')]),'to':_0x4159fa[_0x0bd2('0x9')],'cc':_0x4159fa['cc'],'bcc':_0x4159fa[_0x0bd2('0x16')],'subject':util[_0x0bd2('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x216952[_0x0bd2('0x17')],_0x4159fa[_0x0bd2('0x18')],_0x4159fa[_0x0bd2('0x19')])}};var _0x3b7026=path[_0x0bd2('0x1a')](__dirname,_0x0bd2('0x1b'));var _0x4dcdef=_0x216952['savename'];var _0x2d43bf=util['format'](_0x0bd2('0x1c'),path[_0x0bd2('0x1d')](_0x216952[_0x0bd2('0x1e')],path[_0x0bd2('0x1f')](_0x216952['savename'])),_0x0bd2('0x20'));var _0x58e5c4=path['join'](_0x3b7026,_0x4dcdef);var _0x1c1a0a=path[_0x0bd2('0x1a')](_0x3b7026,_0x2d43bf);if(fs[_0x0bd2('0x21')](_0x58e5c4)){_0x216952[_0x0bd2('0x22')]=_0x0bd2('0x23');_0xce68ac[_0x0bd2('0x24')]['attachments']=[{'filename':_0x4dcdef,'path':_0x58e5c4}];_0xce68ac['message'][_0x0bd2('0x25')]=util['format'](_0x0bd2('0x26'),JSON[_0x0bd2('0x27')](_0x216952,null,0x2));}else if(fs[_0x0bd2('0x21')](_0x1c1a0a)){_0x216952[_0x0bd2('0x22')]=_0x0bd2('0x23');_0xce68ac[_0x0bd2('0x24')][_0x0bd2('0x28')]=[{'filename':_0x2d43bf,'path':_0x1c1a0a}];}else{_0xce68ac[_0x0bd2('0x24')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4159fa['sendIfEmpty']){_0x45c395=![];logger[_0x0bd2('0x8')](_0x0bd2('0x29'));}}if(_0x45c395){return client[_0x0bd2('0x2a')](_0x0bd2('0x2b'),_0xce68ac)[_0x0bd2('0x2c')](function(_0x706847){if(_0x706847[_0x0bd2('0x2d')]){return logger['error']('error\x20mail',JSON[_0x0bd2('0x27')](_0x706847));}return logger[_0x0bd2('0x8')](_0x0bd2('0x2e'));})[_0x0bd2('0x2f')](function(_0x13dca9){return logger[_0x0bd2('0x2d')](_0x0bd2('0x30'),JSON['stringify'](_0x13dca9));});}};}function handleError(){return function(_0x22def0){return logger[_0x0bd2('0x2d')](JSON[_0x0bd2('0x27')](_0x22def0));};}function handleResult(_0x8e81){return function(_0x51ea81){logger[_0x0bd2('0x8')](_0x0bd2('0x31'),JSON[_0x0bd2('0x27')](_0x51ea81));if(_0x8e81[_0x0bd2('0xc')]&&_0x8e81['MailAccount']['Smtp']&&!_[_0x0bd2('0x32')](_0x8e81[_0x0bd2('0x9')])){setTimeout(handleSendEmail(_0x8e81,_0x51ea81),0x3c*0x3e8);}};}function handleJob(_0x5cc5e3){return function(){try{if(_['isNil'](_0x5cc5e3['subtractNumber'])){return logger[_0x0bd2('0x8')](_0x0bd2('0x33'));}if(_[_0x0bd2('0x32')](_0x5cc5e3[_0x0bd2('0x19')])){return logger[_0x0bd2('0x8')](_0x0bd2('0x34'));}var _0x40b783={'startDate':moment()[_0x0bd2('0x35')](_0x5cc5e3[_0x0bd2('0x18')],_0x5cc5e3[_0x0bd2('0x19')])['format'](_0x0bd2('0x36')),'endDate':moment()[_0x0bd2('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x0bd2('0x37'),'output':_0x5cc5e3['output'],'name':_0x5cc5e3[_0x0bd2('0x17')]};if(!_['isNil'](_0x5cc5e3[_0x0bd2('0x38')])){logger[_0x0bd2('0x8')]('exec\x20defaul\x20report\x20id:%s',_0x5cc5e3[_0x0bd2('0x38')]);return analyticDefaultReportController['runReport']({'id':_0x5cc5e3['DefaultReportId']},_0x40b783)[_0x0bd2('0x2c')](handleResult(_0x5cc5e3))[_0x0bd2('0x2f')](handleError());}if(!_[_0x0bd2('0x32')](_0x5cc5e3[_0x0bd2('0x39')])){logger[_0x0bd2('0x8')]('exec\x20custom\x20report\x20id:%s',_0x5cc5e3[_0x0bd2('0x39')]);return analyticCustomReportController['runReport']({'id':_0x5cc5e3[_0x0bd2('0x39')]},_0x40b783)['then'](handleResult(_0x5cc5e3))[_0x0bd2('0x2f')](handleError());}}catch(_0x29d5dc){logger[_0x0bd2('0x2d')](JSON[_0x0bd2('0x27')](_0x29d5dc));}return logger[_0x0bd2('0x8')](_0x0bd2('0x3a'));};}function getJobs(_0x5c6cab){var _0x359206={};if(_0x5c6cab){_0x359206['id']=_0x5c6cab;}return db[_0x0bd2('0x3b')][_0x0bd2('0x3c')]({'where':_0x359206,'include':[{'model':db[_0x0bd2('0xc')],'attributes':['id',_0x0bd2('0x17'),_0x0bd2('0x9')],'include':[{'model':db[_0x0bd2('0x3d')],'as':_0x0bd2('0xa')}]}]})['then'](function(_0x308894){var _0x110556=_[_0x0bd2('0x3e')](manager[_0x0bd2('0x3f')]);var _0x1bcb6d=_[_0x0bd2('0x40')](_0x308894,function(_0x1b9364){return _0x1b9364['id'][_0x0bd2('0x41')]();});var _0xfb0c62=_['keyBy'](_0x308894,function(_0x41ae22){return _0x41ae22['id'][_0x0bd2('0x41')]();});var _0x37ed37=_0x5c6cab?_0x1bcb6d:_[_0x0bd2('0x42')](_0x1bcb6d,_0x110556);var _0x1f7a9b=_[_0x0bd2('0x43')](_0x1bcb6d,_0x110556);var _0x3d6ed5=_[_0x0bd2('0x42')](_0x110556,_0x1bcb6d);var _0x1b69d2;var _0x103b54;for(_0x1b69d2=0x0;_0x1b69d2<_0x3d6ed5['length']&&!_0x5c6cab;_0x1b69d2+=0x1){_0x103b54=_0x3d6ed5[_0x1b69d2][_0x0bd2('0x41')]();if(manager[_0x0bd2('0x44')](_0x103b54)){manager[_0x0bd2('0x45')](_0x103b54);manager['deleteJob'](_0x103b54);logger[_0x0bd2('0x8')]('delete\x20cron',_0x103b54);}}logger[_0x0bd2('0x8')](_0x0bd2('0x46'),JSON[_0x0bd2('0x27')](_0x37ed37));for(_0x1b69d2=0x0;_0x1b69d2<_0x37ed37[_0x0bd2('0x47')];_0x1b69d2+=0x1){_0x103b54=_0x37ed37[_0x1b69d2][_0x0bd2('0x41')]();logger[_0x0bd2('0x8')](_0x0bd2('0x48'),_0x103b54);if(_0x5c6cab){logger[_0x0bd2('0x8')]('my\x20id',_0x5c6cab);logger[_0x0bd2('0x8')](JSON['stringify'](_0xfb0c62[_0x103b54]));BPromise['resolve']()['then'](handleJob(_0xfb0c62[_0x103b54]));logger[_0x0bd2('0x8')](_0x0bd2('0x49'),_0xfb0c62[_0x103b54][_0x0bd2('0x17')],_0xfb0c62[_0x103b54]['cron']);}else if(_0xfb0c62[_0x103b54]['cron']&&_0xfb0c62[_0x103b54][_0x0bd2('0x4a')]&&moment()[_0x0bd2('0x4b')](_0xfb0c62[_0x103b54]['startAt'],_0xfb0c62[_0x103b54][_0x0bd2('0x4c')])){manager[_0x0bd2('0x4d')](_0x103b54,_0xfb0c62[_0x103b54][_0x0bd2('0x4e')],handleJob(_0xfb0c62[_0x103b54]));manager[_0x0bd2('0x4f')](_0x103b54);logger[_0x0bd2('0x8')]('add\x20cron',_0xfb0c62[_0x103b54][_0x0bd2('0x17')],_0xfb0c62[_0x103b54][_0x0bd2('0x4e')]);}else if(manager['exists'](_0x103b54)){manager[_0x0bd2('0x45')](_0x103b54);manager[_0x0bd2('0x50')](_0x103b54);logger['info'](_0x0bd2('0x51'),_0xfb0c62[_0x103b54]['name'],_0xfb0c62[_0x103b54][_0x0bd2('0x4e')]);}}for(_0x1b69d2=0x0,_0x103b54;_0x1b69d2<_0x1f7a9b[_0x0bd2('0x47')]&&!_0x5c6cab;_0x1b69d2+=0x1){_0x103b54=_0x1f7a9b[_0x1b69d2][_0x0bd2('0x41')]();if(manager[_0x0bd2('0x44')](_0x103b54)){if(_0xfb0c62[_0x103b54]['cron']&&_0xfb0c62[_0x103b54][_0x0bd2('0x4a')]&&moment()[_0x0bd2('0x4b')](_0xfb0c62[_0x103b54][_0x0bd2('0x52')],_0xfb0c62[_0x103b54]['endAt'])){manager[_0x0bd2('0x53')](_0x103b54,_0xfb0c62[_0x103b54][_0x0bd2('0x4e')],handleJob(_0xfb0c62[_0x103b54]));logger['info'](_0x0bd2('0x54'),_0xfb0c62[_0x103b54]['name'],_0xfb0c62[_0x103b54][_0x0bd2('0x4e')]);}else{manager[_0x0bd2('0x45')](_0x103b54);manager['deleteJob'](_0x103b54);logger[_0x0bd2('0x8')](_0x0bd2('0x51'),_0xfb0c62[_0x103b54][_0x0bd2('0x17')],_0xfb0c62[_0x103b54][_0x0bd2('0x4e')]);}}}})[_0x0bd2('0x2f')](function(_0x34d2dd){logger[_0x0bd2('0x2d')](JSON['stringify'](_0x34d2dd));});}exports['run']=function(_0x465b91){return getJobs(_0x465b91);};exports[_0x0bd2('0x4f')]=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 0398b0d..344121d 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 _0x544a=['lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','info','format','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','Mixed','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push'];(function(_0x117daf,_0x474fd0){var _0x127e86=function(_0x24dabc){while(--_0x24dabc){_0x117daf['push'](_0x117daf['shift']());}};_0x127e86(++_0x474fd0);}(_0x544a,0x118));var _0xa544=function(_0x183a7e,_0x52d0c9){_0x183a7e=_0x183a7e-0x0;var _0x1120bf=_0x544a[_0x183a7e];return _0x1120bf;};var _=require(_0xa544('0x0'));var AWS=require(_0xa544('0x1'));var rp=require(_0xa544('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xa544('0x3'))['db'];var logger=require(_0xa544('0x4'))(_0xa544('0x5'));function getTranscriptionJob(_0xf2d6a0,_0x4b4677,_0x4cfd38,_0x4ec0e3){return new Promise(function(_0x2cb8c5,_0x3690ce){var _0x9609d4=new AWS['TranscribeService']({'accessKeyId':_0x4b4677,'secretAccessKey':_0xf2d6a0,'region':_0x4cfd38});_0x9609d4[_0xa544('0x6')]({'TranscriptionJobName':_0x4ec0e3},function(_0x13ce7a,_0x35abfd){if(_0x13ce7a){return _0x3690ce(_0x13ce7a);}else{return _0x2cb8c5(_0x35abfd);}});});}function sentiment(_0x4a0b98,_0x3e48cd,_0x3066dd,_0x35abd7,_0x9e886d){return new Promise(function(_0x4d2796,_0x295267){var _0x1c961e=new AWS[(_0xa544('0x7'))]({'accessKeyId':_0x3e48cd,'secretAccessKey':_0x4a0b98,'region':_0x3066dd});_0x1c961e[_0xa544('0x8')]({'Text':_0x35abd7,'LanguageCode':_0x9e886d[_0xa544('0x9')](0x0,0x2)},function(_0x49e946,_0x36fa98){if(_0x49e946){return _0x295267(_0x49e946);}else{return _0x4d2796(_0x36fa98);}});});}function checkTranscribeJob(_0x4aa358,_0x5c5388,_0x49bdea){var _0x3de77b;return new BPromise(function(_0x4251ce,_0x498ce4){logger['info'](util['format'](_0xa544('0xa'),_0x4aa358['id'],_0x4aa358[_0xa544('0xb')]));return getTranscriptionJob(_0x49bdea[_0xa544('0xc')],_0x49bdea['data2'],_0x5c5388[_0xa544('0xd')],_0x4aa358[_0xa544('0xb')])[_0xa544('0xe')](function(_0x25c611){logger[_0xa544('0xf')](util[_0xa544('0x10')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4aa358['id'],_0x4aa358[_0xa544('0xb')],_0x25c611[_0xa544('0x11')]['TranscriptionJobStatus']));if(!_0x4aa358['fileText']){switch(_0x25c611[_0xa544('0x11')][_0xa544('0x12')]){case _0xa544('0x13'):var _0x112262={'transcribeStatus':_0x25c611[_0xa544('0x11')][_0xa544('0x12')],'fileUri':_0x25c611[_0xa544('0x11')][_0xa544('0x14')][_0xa544('0x15')]};logger[_0xa544('0xf')](util[_0xa544('0x10')](_0xa544('0x16'),_0x4aa358['id']));return rp({'uri':_0x25c611[_0xa544('0x11')][_0xa544('0x14')][_0xa544('0x15')],'json':!![]})['then'](function(_0x4d9a8f){logger[_0xa544('0xf')](util[_0xa544('0x10')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4aa358['id']));if(_0x4d9a8f&&_0x4d9a8f[_0xa544('0x17')]&&_0x4d9a8f[_0xa544('0x17')][_0xa544('0x18')]&&_0x4d9a8f[_0xa544('0x17')][_0xa544('0x18')]['length']){_0x112262['fileText']='';for(var _0xe9bea3=0x0;_0xe9bea3<_0x4d9a8f[_0xa544('0x17')][_0xa544('0x18')][_0xa544('0x19')];_0xe9bea3++){_0x112262[_0xa544('0x1a')]+=_0x4d9a8f[_0xa544('0x17')]['transcripts'][_0xe9bea3][_0xa544('0x1b')]+'';}}return _0x4aa358[_0xa544('0x1c')](_0x112262);})[_0xa544('0xe')](function(){logger[_0xa544('0xf')](util[_0xa544('0x10')](_0xa544('0x1d'),_0x4aa358['id']));if(!_0x4aa358[_0xa544('0x1e')]){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))](_0xa544('0x21'));}if(!_0x5c5388['sentiment']||!_0x5c5388['sentimentAccountId']||!_0x5c5388[_0xa544('0x22')]||!_0x5c5388[_0xa544('0x23')]||!_0x5c5388[_0xa544('0x24')]){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))](_0xa544('0x25'));}if(!_0x112262['fileText']){throw new Error(_0xa544('0x26'));}if(_0x5c5388[_0xa544('0x27')]===_0x49bdea['id']){return _0x49bdea;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xa544('0xe')](function(_0x371f4c){if(!_0x371f4c){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))](_0xa544('0x28'));}if(!_0x371f4c['data1']||!_0x371f4c[_0xa544('0x29')]){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x3de77b=_0x371f4c;logger[_0xa544('0xf')](util[_0xa544('0x10')](_0xa544('0x2a'),_0x4aa358['id']));return sentiment(_0x3de77b[_0xa544('0xc')],_0x3de77b[_0xa544('0x29')],_0x5c5388[_0xa544('0x22')],_0x112262['fileText'],_0x5c5388[_0xa544('0x23')]);})[_0xa544('0xe')](function(_0x4d3c05){logger['info'](util[_0xa544('0x10')](_0xa544('0x2b'),_0x4aa358['id']));return _0x4aa358[_0xa544('0x1c')]({'sentiment':_0x4d3c05[_0xa544('0x2c')],'sPositive':_0x4d3c05[_0xa544('0x2d')][_0xa544('0x2e')],'sNegative':_0x4d3c05[_0xa544('0x2d')][_0xa544('0x2f')],'sMixed':_0x4d3c05['SentimentScore']['Mixed'],'sNeutral':_0x4d3c05[_0xa544('0x2d')][_0xa544('0x30')]});})[_0xa544('0xe')](function(){logger[_0xa544('0xf')](util[_0xa544('0x10')](_0xa544('0x1d'),_0x4aa358['id']));_0x4251ce();});case _0xa544('0x31'):return _0x4aa358[_0xa544('0x1c')]({'transcribeStatus':_0xa544('0x31'),'failureReason':_0x25c611[_0xa544('0x11')]['FailureReason']})[_0xa544('0xe')](function(){logger['info'](util['format'](_0xa544('0x1d'),_0x4aa358['id']));_0x4251ce();});default:logger[_0xa544('0xf')](util[_0xa544('0x10')](_0xa544('0x32'),_0x4aa358['id']));break;}}else{return BPromise[_0xa544('0x33')]()[_0xa544('0xe')](function(){if(!_0x4aa358[_0xa544('0x1e')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5c5388[_0xa544('0x34')]||!_0x5c5388[_0xa544('0x27')]||!_0x5c5388['sentimentRegion']||!_0x5c5388[_0xa544('0x23')]||!_0x5c5388['bucket']){throw new db[(_0xa544('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4aa358[_0xa544('0x1a')]){throw new Error(_0xa544('0x26'));}if(_0x5c5388[_0xa544('0x27')]===_0x49bdea['id']){return _0x49bdea;}else{return db[_0xa544('0x35')][_0xa544('0x36')]({'where':{'id':_settings[_0xa544('0x27')]}});}})[_0xa544('0xe')](function(_0x9c8585){if(!_0x9c8585){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x9c8585[_0xa544('0xc')]||!_0x9c8585[_0xa544('0x29')]){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))](_0xa544('0x37'));}_0x3de77b=_0x9c8585;logger[_0xa544('0xf')](util[_0xa544('0x10')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4aa358['id']));return sentiment(_0x3de77b[_0xa544('0xc')],_0x3de77b[_0xa544('0x29')],_0x5c5388[_0xa544('0x22')],_0x4aa358['fileText'],_0x5c5388['language']);})[_0xa544('0xe')](function(_0x4ee475){logger[_0xa544('0xf')](util[_0xa544('0x10')](_0xa544('0x2b'),_0x4aa358['id']));return _0x4aa358[_0xa544('0x1c')]({'sentiment':_0x4ee475['Sentiment'],'sPositive':_0x4ee475[_0xa544('0x2d')][_0xa544('0x2e')],'sNegative':_0x4ee475['SentimentScore'][_0xa544('0x2f')],'sMixed':_0x4ee475[_0xa544('0x2d')][_0xa544('0x38')],'sNeutral':_0x4ee475[_0xa544('0x2d')][_0xa544('0x30')],'transcribeStatus':'COMPLETED'});})[_0xa544('0xe')](function(){logger[_0xa544('0xf')](util[_0xa544('0x10')](_0xa544('0x1d'),_0x4aa358['id']));_0x4251ce();});}})[_0xa544('0x39')](function(_0x571db9){if(_0x571db9){if(!_0x571db9[_0xa544('0x3a')]||_0x571db9['name']!=='SequelizeValidationError'){logger[_0xa544('0x3b')](util[_0xa544('0x10')](_0xa544('0x3c'),_0x4aa358['id']),util['inspect'](_0x571db9,{'showHidden':![],'depth':null}));}}_0x4251ce();});});}function checkTranscribe(){var _0x1e85c9;var _0x36eb24;var _0x2b0f4a;return db[_0xa544('0x3d')][_0xa544('0x3e')]({'where':{'transcribeStatus':_0xa544('0x3f')}})[_0xa544('0xe')](function(_0x4e1459){if(!_0x4e1459||!_0x4e1459[_0xa544('0x19')]){throw new db['Sequelize'][(_0xa544('0x20'))](_0xa544('0x40'));}_0x1e85c9=_0x4e1459;return db[_0xa544('0x41')]['findOne']({'where':{'id':0x1}});})[_0xa544('0xe')](function(_0x2890d2){if(!_0x2890d2){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))](_0xa544('0x42'));}_0x36eb24=_0x2890d2;if(!_0x36eb24[_0xa544('0x5')]||!_0x36eb24['transcribeAccountId']||!_0x36eb24['transcribeRegion']||!_0x36eb24[_0xa544('0x23')]||!_0x36eb24['bucket']){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))]('Transcribe\x20not\x20configured');}return db[_0xa544('0x35')][_0xa544('0x36')]({'where':{'id':_0x36eb24[_0xa544('0x43')]}});})[_0xa544('0xe')](function(_0x14cc36){if(!_0x14cc36){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))](_0xa544('0x28'));}if(!_0x14cc36[_0xa544('0xc')]||!_0x14cc36[_0xa544('0x29')]){throw new db[(_0xa544('0x1f'))][(_0xa544('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x2b0f4a=_0x14cc36;var _0x47e320=[];_0x1e85c9[_0xa544('0x44')](function(_0x222503){_0x47e320[_0xa544('0x45')](checkTranscribeJob(_0x222503,_0x36eb24,_0x2b0f4a));});return BPromise['all'](_0x47e320);})['catch'](function(_0x5e74e9){if(_0x5e74e9){if(!_0x5e74e9[_0xa544('0x3a')]||_0x5e74e9[_0xa544('0x3a')]!=='SequelizeValidationError'){logger[_0xa544('0x3b')](util['inspect'](_0x5e74e9,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x30d3=['inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','catch','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','update','Sentiment','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x30d3,0x9f));var _0x330d=function(_0x3505f0,_0x581feb){_0x3505f0=_0x3505f0-0x0;var _0x58a92d=_0x30d3[_0x3505f0];return _0x58a92d;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x330d('0x0'));var util=require(_0x330d('0x1'));var BPromise=require(_0x330d('0x2'));var db=require(_0x330d('0x3'))['db'];var logger=require(_0x330d('0x4'))(_0x330d('0x5'));function getTranscriptionJob(_0x447dbb,_0x51cee8,_0x37fe02,_0x3b3165){return new Promise(function(_0xd8503,_0x2a330f){var _0x5ee451=new AWS['TranscribeService']({'accessKeyId':_0x51cee8,'secretAccessKey':_0x447dbb,'region':_0x37fe02});_0x5ee451[_0x330d('0x6')]({'TranscriptionJobName':_0x3b3165},function(_0x410a37,_0x1342e7){if(_0x410a37){return _0x2a330f(_0x410a37);}else{return _0xd8503(_0x1342e7);}});});}function sentiment(_0x432840,_0x53bc72,_0x5f137f,_0x22a8ba,_0x151f9a){return new Promise(function(_0x39d171,_0x340980){var _0x2eb0bc=new AWS[(_0x330d('0x7'))]({'accessKeyId':_0x53bc72,'secretAccessKey':_0x432840,'region':_0x5f137f});_0x2eb0bc[_0x330d('0x8')]({'Text':_0x22a8ba,'LanguageCode':_0x151f9a['substring'](0x0,0x2)},function(_0x3b8feb,_0x548353){if(_0x3b8feb){return _0x340980(_0x3b8feb);}else{return _0x39d171(_0x548353);}});});}function checkTranscribeJob(_0x1ad0ee,_0x55eb0e,_0x416b93){var _0xb093cd;return new BPromise(function(_0x3a0f89,_0x20c90f){logger['info'](util[_0x330d('0x9')](_0x330d('0xa'),_0x1ad0ee['id'],_0x1ad0ee['transcribeName']));return getTranscriptionJob(_0x416b93[_0x330d('0xb')],_0x416b93['data2'],_0x55eb0e[_0x330d('0xc')],_0x1ad0ee[_0x330d('0xd')])[_0x330d('0xe')](function(_0x5e5baf){logger['info'](util[_0x330d('0x9')](_0x330d('0xf'),_0x1ad0ee['id'],_0x1ad0ee[_0x330d('0xd')],_0x5e5baf['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x1ad0ee['fileText']){switch(_0x5e5baf[_0x330d('0x10')]['TranscriptionJobStatus']){case'COMPLETED':var _0x435083={'transcribeStatus':_0x5e5baf[_0x330d('0x10')]['TranscriptionJobStatus'],'fileUri':_0x5e5baf[_0x330d('0x10')][_0x330d('0x11')][_0x330d('0x12')]};logger[_0x330d('0x13')](util[_0x330d('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x1ad0ee['id']));return rp({'uri':_0x5e5baf['TranscriptionJob'][_0x330d('0x11')]['TranscriptFileUri'],'json':!![]})[_0x330d('0xe')](function(_0x2e876b){logger[_0x330d('0x13')](util['format'](_0x330d('0x14'),_0x1ad0ee['id']));if(_0x2e876b&&_0x2e876b[_0x330d('0x15')]&&_0x2e876b['results']['transcripts']&&_0x2e876b[_0x330d('0x15')][_0x330d('0x16')]['length']){_0x435083[_0x330d('0x17')]='';for(var _0x19c2f2=0x0;_0x19c2f2<_0x2e876b['results']['transcripts'][_0x330d('0x18')];_0x19c2f2++){_0x435083[_0x330d('0x17')]+=_0x2e876b[_0x330d('0x15')][_0x330d('0x16')][_0x19c2f2][_0x330d('0x19')]+'';}}return _0x1ad0ee['update'](_0x435083);})['then'](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ad0ee['id']));if(!_0x1ad0ee[_0x330d('0x1a')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x1d'));}if(!_0x55eb0e[_0x330d('0x1e')]||!_0x55eb0e[_0x330d('0x1f')]||!_0x55eb0e['sentimentRegion']||!_0x55eb0e[_0x330d('0x20')]||!_0x55eb0e['bucket']){throw new db['Sequelize'][(_0x330d('0x1c'))](_0x330d('0x21'));}if(!_0x435083[_0x330d('0x17')]){throw new Error(_0x330d('0x22'));}if(_0x55eb0e[_0x330d('0x1f')]===_0x416b93['id']){return _0x416b93;}else{return db[_0x330d('0x23')][_0x330d('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x330d('0xe')](function(_0xe071ff){if(!_0xe071ff){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0xe071ff[_0x330d('0xb')]||!_0xe071ff[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0xb093cd=_0xe071ff;logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x28'),_0x1ad0ee['id']));return sentiment(_0xb093cd['data1'],_0xb093cd['data2'],_0x55eb0e[_0x330d('0x29')],_0x435083[_0x330d('0x17')],_0x55eb0e[_0x330d('0x20')]);})[_0x330d('0xe')](function(_0x456431){logger[_0x330d('0x13')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1ad0ee['id']));return _0x1ad0ee[_0x330d('0x2a')]({'sentiment':_0x456431[_0x330d('0x2b')],'sPositive':_0x456431[_0x330d('0x2c')]['Positive'],'sNegative':_0x456431[_0x330d('0x2c')]['Negative'],'sMixed':_0x456431[_0x330d('0x2c')][_0x330d('0x2d')],'sNeutral':_0x456431[_0x330d('0x2c')][_0x330d('0x2e')]});})[_0x330d('0xe')](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});case _0x330d('0x30'):return _0x1ad0ee[_0x330d('0x2a')]({'transcribeStatus':_0x330d('0x30'),'failureReason':_0x5e5baf[_0x330d('0x10')]['FailureReason']})['then'](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});default:logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x31'),_0x1ad0ee['id']));break;}}else{return BPromise[_0x330d('0x32')]()[_0x330d('0xe')](function(){if(!_0x1ad0ee['tempSentiment']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x55eb0e[_0x330d('0x1e')]||!_0x55eb0e[_0x330d('0x1f')]||!_0x55eb0e[_0x330d('0x29')]||!_0x55eb0e[_0x330d('0x20')]||!_0x55eb0e[_0x330d('0x33')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x21'));}if(!_0x1ad0ee[_0x330d('0x17')]){throw new Error(_0x330d('0x22'));}if(_0x55eb0e[_0x330d('0x1f')]===_0x416b93['id']){return _0x416b93;}else{return db[_0x330d('0x23')][_0x330d('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0xd0af59){if(!_0xd0af59){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0xd0af59[_0x330d('0xb')]||!_0xd0af59[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0xb093cd=_0xd0af59;logger['info'](util['format'](_0x330d('0x28'),_0x1ad0ee['id']));return sentiment(_0xb093cd[_0x330d('0xb')],_0xb093cd[_0x330d('0x26')],_0x55eb0e[_0x330d('0x29')],_0x1ad0ee[_0x330d('0x17')],_0x55eb0e[_0x330d('0x20')]);})[_0x330d('0xe')](function(_0x5dab16){logger['info'](util[_0x330d('0x9')](_0x330d('0x34'),_0x1ad0ee['id']));return _0x1ad0ee['update']({'sentiment':_0x5dab16[_0x330d('0x2b')],'sPositive':_0x5dab16[_0x330d('0x2c')][_0x330d('0x35')],'sNegative':_0x5dab16[_0x330d('0x2c')][_0x330d('0x36')],'sMixed':_0x5dab16['SentimentScore'][_0x330d('0x2d')],'sNeutral':_0x5dab16[_0x330d('0x2c')][_0x330d('0x2e')],'transcribeStatus':_0x330d('0x37')});})[_0x330d('0xe')](function(){logger['info'](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});}})['catch'](function(_0x3264d0){if(_0x3264d0){if(!_0x3264d0['name']||_0x3264d0[_0x330d('0x38')]!==_0x330d('0x39')){logger[_0x330d('0x3a')](util[_0x330d('0x9')](_0x330d('0x3b'),_0x1ad0ee['id']),util[_0x330d('0x3c')](_0x3264d0,{'showHidden':![],'depth':null}));}}_0x3a0f89();});});}function checkTranscribe(){var _0xa802b7;var _0x36393b;var _0x460ec4;return db[_0x330d('0x3d')][_0x330d('0x3e')]({'where':{'transcribeStatus':_0x330d('0x3f')}})[_0x330d('0xe')](function(_0xadbd06){if(!_0xadbd06||!_0xadbd06[_0x330d('0x18')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x40'));}_0xa802b7=_0xadbd06;return db[_0x330d('0x41')][_0x330d('0x24')]({'where':{'id':0x1}});})[_0x330d('0xe')](function(_0x46de6d){if(!_0x46de6d){throw new db[(_0x330d('0x1b'))]['ValidationError']('Settings\x20not\x20available');}_0x36393b=_0x46de6d;if(!_0x36393b[_0x330d('0x5')]||!_0x36393b['transcribeAccountId']||!_0x36393b[_0x330d('0xc')]||!_0x36393b[_0x330d('0x20')]||!_0x36393b['bucket']){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x42'));}return db['CloudProvider'][_0x330d('0x24')]({'where':{'id':_0x36393b[_0x330d('0x43')]}});})[_0x330d('0xe')](function(_0x47dc86){if(!_0x47dc86){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0x47dc86[_0x330d('0xb')]||!_0x47dc86[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0x460ec4=_0x47dc86;var _0xc00ee8=[];_0xa802b7[_0x330d('0x44')](function(_0x438d23){_0xc00ee8[_0x330d('0x45')](checkTranscribeJob(_0x438d23,_0x36393b,_0x460ec4));});return BPromise[_0x330d('0x46')](_0xc00ee8);})[_0x330d('0x47')](function(_0x4e1998){if(_0x4e1998){if(!_0x4e1998['name']||_0x4e1998['name']!==_0x330d('0x39')){logger[_0x330d('0x3a')](util[_0x330d('0x3c')](_0x4e1998,{'showHidden':![],'depth':null}));}}});}exports[_0x330d('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 d43d371..5ca40dd 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 _0x8b3b=['localhost','socket.io-emitter','findAll','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','redis','defaults'];(function(_0x453c52,_0x1f0e31){var _0x4d537b=function(_0x1a61db){while(--_0x1a61db){_0x453c52['push'](_0x453c52['shift']());}};_0x4d537b(++_0x1f0e31);}(_0x8b3b,0x6c));var _0xb8b3=function(_0x6620b8,_0x8b3d5e){_0x6620b8=_0x6620b8-0x0;var _0x33de50=_0x8b3b[_0x6620b8];return _0x33de50;};'use strict';var _=require(_0xb8b3('0x0'));var moment=require(_0xb8b3('0x1'));var Redis=require(_0xb8b3('0x2'));var util=require(_0xb8b3('0x3'));var config=require(_0xb8b3('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xb8b3('0x5'))('schedule');config[_0xb8b3('0x6')]=_[_0xb8b3('0x7')](config[_0xb8b3('0x6')],{'host':_0xb8b3('0x8'),'port':0x18eb});var io=require(_0xb8b3('0x9'))(new Redis(config[_0xb8b3('0x6')]));function closeInteractions(){var _0x317075=[];return db['WhatsappInteraction'][_0xb8b3('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb8b3('0xb')](0x18,'hours')}}})[_0xb8b3('0xc')](function(_0x1fb18d){if(_0x1fb18d&&_0x1fb18d[_0xb8b3('0xd')]){_0x317075=_[_0xb8b3('0xe')](_0x1fb18d||[],'id');logger[_0xb8b3('0xf')](_0xb8b3('0x10'),_0x317075[_0xb8b3('0x11')]());return db[_0xb8b3('0x12')][_0xb8b3('0x13')]({'closeReason':_0xb8b3('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb8b3('0x15')](_0xb8b3('0x16'))},{'where':{'id':_0x317075}});}})[_0xb8b3('0xc')](function(){if(_0x317075&&_0x317075['length']){logger[_0xb8b3('0xf')](_0xb8b3('0x17'),_0x317075[_0xb8b3('0x11')]());for(var _0x321c90=0x0;_0x321c90<_0x317075[_0xb8b3('0xd')];_0x321c90++){io[_0xb8b3('0x18')](_0xb8b3('0x19'),{'id':_0x317075[_0x321c90],'closed':!![]});}}})['catch'](function(_0x386681){logger['error'](_0xb8b3('0x1a'),_0x386681?util[_0xb8b3('0x1b')](_0x386681,{'showHidden':![],'depth':null}):'');});}exports[_0xb8b3('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe108=['update','system','timeout','format','length','join','emit','whatsappInteraction:update','catch','error','start','moment','util','../../mysqldb','../logger','schedule','defaults','redis','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','then','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xe108,0x6b));var _0x8e10=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xe108[_0x39d39d];return _0x577ac3;};'use strict';var _=require('lodash');var moment=require(_0x8e10('0x0'));var Redis=require('ioredis');var util=require(_0x8e10('0x1'));var config=require('../../config/environment');var db=require(_0x8e10('0x2'))['db'];var logger=require(_0x8e10('0x3'))(_0x8e10('0x4'));config['redis']=_[_0x8e10('0x5')](config[_0x8e10('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x8e10('0x7'))(new Redis(config[_0x8e10('0x6')]));function closeInteractions(){var _0x214416=[];return db[_0x8e10('0x8')]['findAll']({'raw':!![],'attributes':['id',_0x8e10('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8e10('0xa')](0x18,'hours')}}})[_0x8e10('0xb')](function(_0x205779){if(_0x205779&&_0x205779['length']){_0x214416=_['map'](_0x205779||[],'id');logger['info'](_0x8e10('0xc'),_0x214416['join']());return db[_0x8e10('0x8')][_0x8e10('0xd')]({'closeReason':_0x8e10('0xe'),'disposition':_0x8e10('0xf'),'closed':!![],'closedAt':moment()[_0x8e10('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x214416}});}})[_0x8e10('0xb')](function(){if(_0x214416&&_0x214416[_0x8e10('0x11')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x214416[_0x8e10('0x12')]());for(var _0x57957d=0x0;_0x57957d<_0x214416['length'];_0x57957d++){io[_0x8e10('0x13')](_0x8e10('0x14'),{'id':_0x214416[_0x57957d],'closed':!![]});}}})[_0x8e10('0x15')](function(_0x197077){logger[_0x8e10('0x16')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x197077?util['inspect'](_0x197077,{'showHidden':![],'depth':null}):'');});}exports[_0x8e10('0x17')]=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 b5fdfea..a15a61f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98f3=['now','innocenzo.biondo','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x24551d,_0x320ef3){var _0x167f16=function(_0xc8d718){while(--_0xc8d718){_0x24551d['push'](_0x24551d['shift']());}};_0x167f16(++_0x320ef3);}(_0x98f3,0x162));var _0x398f=function(_0x44d3d7,_0x1c6356){_0x44d3d7=_0x44d3d7-0x0;var _0x1886c0=_0x98f3[_0x44d3d7];return _0x1886c0;};'use strict';var util=require(_0x398f('0x0'));var db=require(_0x398f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x398f('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x398f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x398f('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x398f('0x3')](),'updatedAt':Date[_0x398f('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x398f('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x398f('0x4')+i+_0x398f('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x398f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x398f('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x398f('0x3')]()});}db[_0x398f('0x6')][_0x398f('0x7')]({'where':{}})[_0x398f('0x8')](function(){return db[_0x398f('0x6')][_0x398f('0x9')](contacts);})['then'](function(){console[_0x398f('0xa')](_0x398f('0xb'),'contacts1');return db[_0x398f('0xc')][_0x398f('0x7')]({'where':{}});})['then'](function(){return db[_0x398f('0xc')][_0x398f('0x9')](hopper);})[_0x398f('0x8')](function(){console[_0x398f('0xa')](_0x398f('0xb'),_0x398f('0xd'));return db[_0x398f('0x6')]['bulkCreate'](contacts2);})[_0x398f('0x8')](function(){console['log'](_0x398f('0xb'),_0x398f('0xe'));return db[_0x398f('0xc')][_0x398f('0x9')](hopper2);})[_0x398f('0x8')](function(){console[_0x398f('0xa')]('finished\x20populating',_0x398f('0xf'));})[_0x398f('0x10')](function(_0x496b57){console[_0x398f('0xa')](_0x496b57);}); \ No newline at end of file +var _0xd1ad=['contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1'];(function(_0x444812,_0x1d7924){var _0x4f9f24=function(_0x3a720c){while(--_0x3a720c){_0x444812['push'](_0x444812['shift']());}};_0x4f9f24(++_0x1d7924);}(_0xd1ad,0xb7));var _0xdd1a=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0xd1ad[_0x2eac4f];return _0x58f73b;};'use strict';var util=require(_0xdd1a('0x0'));var db=require(_0xdd1a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xdd1a('0x2')]({'id':i,'firstName':_0xdd1a('0x3')+i,'lastName':_0xdd1a('0x4')+i,'phone':0xf879fb460+i,'email':_0xdd1a('0x5')+i+_0xdd1a('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xdd1a('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xdd1a('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xdd1a('0x2')]({'id':i,'firstName':_0xdd1a('0x3')+i,'lastName':_0xdd1a('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xdd1a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xdd1a('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xdd1a('0x7')]()});}db[_0xdd1a('0x8')][_0xdd1a('0x9')]({'where':{}})[_0xdd1a('0xa')](function(){return db[_0xdd1a('0x8')][_0xdd1a('0xb')](contacts);})['then'](function(){console['log'](_0xdd1a('0xc'),_0xdd1a('0xd'));return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db[_0xdd1a('0xe')]['bulkCreate'](hopper);})['then'](function(){console[_0xdd1a('0xf')](_0xdd1a('0xc'),_0xdd1a('0x10'));return db[_0xdd1a('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0xdd1a('0xf')](_0xdd1a('0xc'),_0xdd1a('0x11'));return db[_0xdd1a('0xe')][_0xdd1a('0xb')](hopper2);})[_0xdd1a('0xa')](function(){console[_0xdd1a('0xf')](_0xdd1a('0xc'),_0xdd1a('0x12'));})[_0xdd1a('0x13')](function(_0x3301f9){console['log'](_0x3301f9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 66276c5..b74baa8 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc523=['agent','password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','then','log','catch','../mysqldb','push','format','%s%s','%s%s@xcally.com'];(function(_0x47797a,_0x15d9c5){var _0x13b73e=function(_0x44b5c7){while(--_0x44b5c7){_0x47797a['push'](_0x47797a['shift']());}};_0x13b73e(++_0x15d9c5);}(_0xc523,0x118));var _0x3c52=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xc523[_0x439d59];return _0x3670c7;};'use strict';var util=require('util');var db=require(_0x3c52('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3c52('0x1')]({'name':util[_0x3c52('0x2')](_0x3c52('0x3'),'agent',i),'fullname':util['format'](_0x3c52('0x3'),'agent',i),'email':util[_0x3c52('0x2')](_0x3c52('0x4'),_0x3c52('0x5'),i),'role':'agent','password':_0x3c52('0x6'),'internal':0xfa0+i,'type':_0x3c52('0x7'),'transport':[_0x3c52('0x8'),'ws','wss'],'disallow':[_0x3c52('0x9')],'allow':[_0x3c52('0xa')],'defaultuser':util[_0x3c52('0x2')]('%s%s',_0x3c52('0x5'),i),'encryption':_0x3c52('0xb'),'avpf':_0x3c52('0xb'),'force_avp':_0x3c52('0xb'),'icesupport':_0x3c52('0xb'),'dtlsenable':_0x3c52('0xb'),'dtlsverify':'no','dtlscertfile':_0x3c52('0xc'),'dtlsprivatekey':_0x3c52('0xd'),'dtlssetup':_0x3c52('0xe'),'callerid':util[_0x3c52('0x2')]('\x22%s\x22\x20<%s>',util[_0x3c52('0x2')]('%s%s','agent',i),0xfa0+i)});}db[_0x3c52('0xf')]['bulkCreate'](users)[_0x3c52('0x10')](function(){console[_0x3c52('0x11')]('add\x20user');})[_0x3c52('0x12')](function(_0xbb7558){console[_0x3c52('0x11')](_0xbb7558);}); \ No newline at end of file +var _0x110f=['\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','agent','format','password','friend','wss','all','%s%s','yes','/etc/pki/tls/private/motion.key'];(function(_0x468943,_0x9529ad){var _0x4aaf7f=function(_0x294192){while(--_0x294192){_0x468943['push'](_0x468943['shift']());}};_0x4aaf7f(++_0x9529ad);}(_0x110f,0x15d));var _0xf110=function(_0x4e73c2,_0x54c707){_0x4e73c2=_0x4e73c2-0x0;var _0xee0c7a=_0x110f[_0x4e73c2];return _0xee0c7a;};'use strict';var util=require(_0xf110('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf110('0x1')]({'name':util['format']('%s%s',_0xf110('0x2'),i),'fullname':util[_0xf110('0x3')]('%s%s',_0xf110('0x2'),i),'email':util[_0xf110('0x3')]('%s%s@xcally.com',_0xf110('0x2'),i),'role':_0xf110('0x2'),'password':_0xf110('0x4'),'internal':0xfa0+i,'type':_0xf110('0x5'),'transport':['udp','ws',_0xf110('0x6')],'disallow':[_0xf110('0x7')],'allow':['ulaw'],'defaultuser':util[_0xf110('0x3')](_0xf110('0x8'),_0xf110('0x2'),i),'encryption':_0xf110('0x9'),'avpf':_0xf110('0x9'),'force_avp':_0xf110('0x9'),'icesupport':_0xf110('0x9'),'dtlsenable':_0xf110('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf110('0xa'),'dtlssetup':'actpass','callerid':util['format'](_0xf110('0xb'),util[_0xf110('0x3')](_0xf110('0x8'),_0xf110('0x2'),i),0xfa0+i)});}db[_0xf110('0xc')][_0xf110('0xd')](users)[_0xf110('0xe')](function(){console[_0xf110('0xf')](_0xf110('0x10'));})[_0xf110('0x11')](function(_0x340f7e){console[_0xf110('0xf')](_0x340f7e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3fddaca..6981689 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c1d=['CONNECTED','lodash','util','bluebird','./environment','name','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','role','Campaign','where','format','%s:queue:%s','Agents','length','handshake','find','userProfileId','query','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','include','VoiceQueue','ChatQueue','push','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','VoiceQueues','OpenchannelQueue','WhatsappQueues','voice:outbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','nsp','address','disconnect','DISCONNECTED'];(function(_0x5e09f6,_0x55d913){var _0x5e39ac=function(_0x35ea20){while(--_0x35ea20){_0x5e09f6['push'](_0x5e09f6['shift']());}};_0x5e39ac(++_0x55d913);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x36b27a,_0x4eb3c1){_0x36b27a=_0x36b27a-0x0;var _0x928b26=_0x9c1d[_0x36b27a];return _0x928b26;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var BPromise=require(_0xd9c1('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xd9c1('0x3'));var queryQueues={'attributes':['id',_0xd9c1('0x4')],'include':[{'as':'Agents','model':db[_0xd9c1('0x5')],'attributes':['id',_0xd9c1('0x4'),'role'],'raw':!![],'where':{'role':_0xd9c1('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd9c1('0x4')],'where':{'role':_0xd9c1('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd9c1('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xd9c1('0x4')],'where':{'role':_0xd9c1('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd9c1('0x4'),_0xd9c1('0x8')],'where':{'type':_0xd9c1('0x9')}};function getAssociatedResources(_0x5c169e,_0x207660,_0x31c3fb){return db[_0xd9c1('0xa')][_0xd9c1('0xb')]({'where':{'name':_0x5c169e,'userProfileId':_0x207660},'raw':!![]})[_0xd9c1('0xc')](function(_0x9592c8){if(_0x9592c8){if(_0x9592c8[_0xd9c1('0xd')]){switch(_0x5c169e){case'VoiceQueues':case _0xd9c1('0xe'):case _0xd9c1('0xf'):case _0xd9c1('0x10'):case'MailQueues':case _0xd9c1('0x11'):case'WhatsappQueues':return db[_0x31c3fb][_0xd9c1('0x12')](queryQueues);case _0xd9c1('0x13'):return db[_0x31c3fb][_0xd9c1('0x12')](queryTelephones);case _0xd9c1('0x14'):return db[_0x31c3fb][_0xd9c1('0x12')](queryTrunks);case _0xd9c1('0x15'):return db[_0x31c3fb][_0xd9c1('0x12')](queryCampaigns);}}else{return db[_0xd9c1('0x16')][_0xd9c1('0x12')]({'attributes':[_0xd9c1('0x17')],'where':{'sectionId':_0x9592c8['id']},'raw':!![]})[_0xd9c1('0xc')](function(_0x41e154){if(_0x41e154){var _0x35125={'where':{'id':_[_0xd9c1('0x18')](_0x41e154,_0xd9c1('0x17'))},'raw':!![]};switch(_0x31c3fb){case'User':_0x35125['where'][_0xd9c1('0x19')]=_0xd9c1('0x7');break;case _0xd9c1('0x1a'):_0x35125[_0xd9c1('0x1b')][_0xd9c1('0x8')]=_0xd9c1('0x9');break;}return db[_0x31c3fb][_0xd9c1('0x12')](_0x35125);}else{return[];}});}}else{return[];}})[_0xd9c1('0xc')](function(_0x3a8830){return _0x3a8830;});}function joinOrLeaveQueues(_0x55c310,_0x184c4b,_0x11611d,_0x37701d){_0x55c310[_0x184c4b](util[_0xd9c1('0x1c')](_0xd9c1('0x1d'),_0x11611d,_0x37701d[_0xd9c1('0x4')]));if(_0x37701d['Agents']){for(var _0x28f523=0x0;_0x28f523<_0x37701d[_0xd9c1('0x1e')][_0xd9c1('0x1f')];_0x28f523+=0x1){_0x55c310[_0x184c4b](util['format']('user:%s',_0x37701d[_0xd9c1('0x1e')][_0x28f523][_0xd9c1('0x4')]));}}}function joinOrLeave(_0x348f78,_0x403d78,_0x18d5f3){var _0x5f6a76;if(_0x348f78[_0xd9c1('0x20')]['query']['id']){db[_0xd9c1('0x5')][_0xd9c1('0x21')]({'attributes':['id','name','role',_0xd9c1('0x22')],'where':{'id':_0x348f78[_0xd9c1('0x20')][_0xd9c1('0x23')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xd9c1('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xd9c1('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xd9c1('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xd9c1('0x27')],'as':_0xd9c1('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xd9c1('0x29')],'as':_0xd9c1('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xd9c1('0x2b')],'as':_0xd9c1('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x250527){if(_0x250527){_0x5f6a76=_0x250527;_0x348f78[_0x403d78](util[_0xd9c1('0x1c')](_0xd9c1('0x2d'),_0x250527[_0xd9c1('0x4')]));var _0x44df35=[];switch(_0x250527[_0xd9c1('0x19')]){case _0xd9c1('0x2e'):_0x348f78[_0x403d78](_0xd9c1('0x2f'));_0x348f78[_0x403d78]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0xd9c1('0x30')];}_0x44df35['push'](db[_0xd9c1('0x31')][_0xd9c1('0x12')](queryQueues));_0x44df35['push'](db[_0xd9c1('0x32')][_0xd9c1('0x12')](queryQueues));_0x44df35[_0xd9c1('0x33')](db[_0xd9c1('0x34')][_0xd9c1('0x12')](queryQueues));_0x44df35[_0xd9c1('0x33')](db[_0xd9c1('0x35')][_0xd9c1('0x12')](queryQueues));_0x44df35[_0xd9c1('0x33')](db[_0xd9c1('0x36')][_0xd9c1('0x12')](queryQueues));_0x44df35[_0xd9c1('0x33')](db['OpenchannelQueue']['findAll'](queryQueues));_0x44df35[_0xd9c1('0x33')](db[_0xd9c1('0x37')][_0xd9c1('0x12')](queryQueues));_0x44df35['push'](db[_0xd9c1('0x5')][_0xd9c1('0x12')](queryTelephones));_0x44df35['push'](db[_0xd9c1('0x38')][_0xd9c1('0x12')](queryTrunks));_0x44df35['push'](db['Campaign'][_0xd9c1('0x12')](queryCampaigns));_0x44df35[_0xd9c1('0x33')](db[_0xd9c1('0x5')][_0xd9c1('0x12')](queryAgents));break;case _0xd9c1('0x39'):_0x348f78[_0x403d78](_0xd9c1('0x2f'));_0x348f78[_0x403d78]('voice:outbound');_0x44df35[_0xd9c1('0x33')](getAssociatedResources(_0xd9c1('0x3a'),_0x250527[_0xd9c1('0x22')],'VoiceQueue'));_0x44df35[_0xd9c1('0x33')](getAssociatedResources(_0xd9c1('0xe'),_0x250527[_0xd9c1('0x22')],_0xd9c1('0x32')));_0x44df35[_0xd9c1('0x33')](getAssociatedResources(_0xd9c1('0xf'),_0x250527[_0xd9c1('0x22')],_0xd9c1('0x34')));_0x44df35[_0xd9c1('0x33')](getAssociatedResources(_0xd9c1('0x10'),_0x250527['userProfileId'],_0xd9c1('0x35')));_0x44df35[_0xd9c1('0x33')](getAssociatedResources('MailQueues',_0x250527['userProfileId'],'MailQueue'));_0x44df35[_0xd9c1('0x33')](getAssociatedResources(_0xd9c1('0x11'),_0x250527[_0xd9c1('0x22')],_0xd9c1('0x3b')));_0x44df35['push'](getAssociatedResources(_0xd9c1('0x3c'),_0x250527[_0xd9c1('0x22')],_0xd9c1('0x37')));_0x44df35['push'](getAssociatedResources('Telephones',_0x250527[_0xd9c1('0x22')],_0xd9c1('0x5')));_0x44df35[_0xd9c1('0x33')](getAssociatedResources(_0xd9c1('0x14'),_0x250527[_0xd9c1('0x22')],_0xd9c1('0x38')));_0x44df35[_0xd9c1('0x33')](getAssociatedResources(_0xd9c1('0x15'),_0x250527[_0xd9c1('0x22')],'Campaign'));_0x44df35[_0xd9c1('0x33')](db[_0xd9c1('0x5')][_0xd9c1('0x12')](queryAgents));break;case'agent':_0x348f78[_0x403d78]('voice:inbound');_0x348f78[_0x403d78](_0xd9c1('0x3d'));_0x44df35['push'](_0x250527[_0xd9c1('0x3e')]({'attributes':['id','name']}));_0x44df35['push'](_0x250527[_0xd9c1('0x3f')]({'attributes':['id',_0xd9c1('0x4')]}));_0x44df35[_0xd9c1('0x33')](_0x250527[_0xd9c1('0x40')]({'attributes':['id',_0xd9c1('0x4')]}));_0x44df35[_0xd9c1('0x33')](_0x250527[_0xd9c1('0x41')]({'attributes':['id',_0xd9c1('0x4')]}));_0x44df35[_0xd9c1('0x33')](_0x250527[_0xd9c1('0x42')]({'attributes':['id',_0xd9c1('0x4')]}));_0x44df35[_0xd9c1('0x33')](_0x250527[_0xd9c1('0x43')]({'attributes':['id',_0xd9c1('0x4')]}));_0x44df35[_0xd9c1('0x33')](_0x250527[_0xd9c1('0x44')]({'attributes':['id','name']}));break;}return BPromise[_0xd9c1('0x45')](_0x44df35);}})['then'](function(_0x4ba14f){if(_0x4ba14f&&_0x4ba14f[_0xd9c1('0x1f')]){for(var _0xcac62a=0x0;_0xcac62a<_0x4ba14f[_0xd9c1('0x1f')];_0xcac62a+=0x1){for(var _0x39d3ff=0x0;_0x39d3ff<_0x4ba14f[_0xcac62a][_0xd9c1('0x1f')];_0x39d3ff+=0x1){switch(_0xcac62a){case 0x0:joinOrLeaveQueues(_0x348f78,_0x403d78,_0xd9c1('0x46'),_0x4ba14f[_0xcac62a][_0x39d3ff]);break;case 0x1:joinOrLeaveQueues(_0x348f78,_0x403d78,_0xd9c1('0x47'),_0x4ba14f[_0xcac62a][_0x39d3ff]);break;case 0x2:joinOrLeaveQueues(_0x348f78,_0x403d78,_0xd9c1('0x48'),_0x4ba14f[_0xcac62a][_0x39d3ff]);break;case 0x3:joinOrLeaveQueues(_0x348f78,_0x403d78,_0xd9c1('0x49'),_0x4ba14f[_0xcac62a][_0x39d3ff]);break;case 0x4:joinOrLeaveQueues(_0x348f78,_0x403d78,_0xd9c1('0x4a'),_0x4ba14f[_0xcac62a][_0x39d3ff]);break;case 0x5:joinOrLeaveQueues(_0x348f78,_0x403d78,'openchannel',_0x4ba14f[_0xcac62a][_0x39d3ff]);break;case 0x6:joinOrLeaveQueues(_0x348f78,_0x403d78,_0xd9c1('0x4b'),_0x4ba14f[_0xcac62a][_0x39d3ff]);break;case 0x7:if(_0x5f6a76['role']!=='agent')_0x348f78[_0x403d78](util[_0xd9c1('0x1c')](_0xd9c1('0x4c'),_0x4ba14f[_0xcac62a][_0x39d3ff][_0xd9c1('0x4')]));break;case 0x8:if(_0x5f6a76[_0xd9c1('0x19')]!==_0xd9c1('0x6'))_0x348f78[_0x403d78](util['format'](_0xd9c1('0x4d'),_0x4ba14f[_0xcac62a][_0x39d3ff][_0xd9c1('0x4')]));break;case 0x9:if(_0x5f6a76['role']!==_0xd9c1('0x6'))_0x348f78[_0x403d78](util[_0xd9c1('0x1c')](_0xd9c1('0x4e'),_0x4ba14f[_0xcac62a][_0x39d3ff][_0xd9c1('0x8')],_0x4ba14f[_0xcac62a][_0x39d3ff][_0xd9c1('0x4')]));break;case 0xa:_0x348f78[_0x403d78](util['format'](_0xd9c1('0x2d'),_0x4ba14f[_0xcac62a][_0x39d3ff][_0xd9c1('0x4')]));break;}}}}})[_0xd9c1('0xc')](function(){if(_0x403d78===_0xd9c1('0x4f')){var _0x4a6fe2=_[_0xd9c1('0x18')](_0x5f6a76[_0xd9c1('0x24')],'id');return _0x5f6a76[_0xd9c1('0x50')](_0x4a6fe2)[_0xd9c1('0xc')](function(){for(var _0x2e0efe=0x0;_0x2e0efe<_0x4a6fe2[_0xd9c1('0x1f')];_0x2e0efe+=0x1){_0x18d5f3[_0xd9c1('0x51')](_0xd9c1('0x52'),{'ChatInteractionId':Number(_0x4a6fe2[_0x2e0efe]),'UserId':Number(_0x5f6a76['id'])});}});}})[_0xd9c1('0xc')](function(){if(_0x403d78==='leave'){var _0x209732=_[_0xd9c1('0x18')](_0x5f6a76['MailInteractions'],'id');return _0x5f6a76[_0xd9c1('0x53')](_0x209732)[_0xd9c1('0xc')](function(){for(var _0x4038f9=0x0;_0x4038f9<_0x209732[_0xd9c1('0x1f')];_0x4038f9+=0x1){_0x18d5f3[_0xd9c1('0x51')](_0xd9c1('0x54'),{'MailInteractionId':Number(_0x209732[_0x4038f9]),'UserId':Number(_0x5f6a76['id'])});}});}})[_0xd9c1('0xc')](function(){if(_0x403d78===_0xd9c1('0x4f')){var _0x1b5514=_[_0xd9c1('0x18')](_0x5f6a76['FaxInteractions'],'id');return _0x5f6a76[_0xd9c1('0x55')](_0x1b5514)[_0xd9c1('0xc')](function(){for(var _0xc06968=0x0;_0xc06968<_0x1b5514[_0xd9c1('0x1f')];_0xc06968+=0x1){_0x18d5f3[_0xd9c1('0x51')](_0xd9c1('0x56'),{'FaxInteractionId':Number(_0x1b5514[_0xc06968]),'UserId':Number(_0x5f6a76['id'])});}});}})[_0xd9c1('0xc')](function(){if(_0x403d78===_0xd9c1('0x4f')){var _0x1758fc=_[_0xd9c1('0x18')](_0x5f6a76['SmsInteractions'],'id');return _0x5f6a76[_0xd9c1('0x57')](_0x1758fc)['then'](function(){for(var _0x38a9b3=0x0;_0x38a9b3<_0x1758fc[_0xd9c1('0x1f')];_0x38a9b3+=0x1){_0x18d5f3[_0xd9c1('0x51')](_0xd9c1('0x58'),{'SmsInteractionId':Number(_0x1758fc[_0x38a9b3]),'UserId':Number(_0x5f6a76['id'])});}});}})['then'](function(){if(_0x403d78===_0xd9c1('0x4f')){var _0x148c50=_[_0xd9c1('0x18')](_0x5f6a76['OpenchannelInteractions'],'id');return _0x5f6a76[_0xd9c1('0x59')](_0x148c50)[_0xd9c1('0xc')](function(){for(var _0x5a87e5=0x0;_0x5a87e5<_0x148c50[_0xd9c1('0x1f')];_0x5a87e5+=0x1){_0x18d5f3[_0xd9c1('0x51')](_0xd9c1('0x5a'),{'OpenchannelInteractionId':Number(_0x148c50[_0x5a87e5]),'UserId':Number(_0x5f6a76['id'])});}});}})[_0xd9c1('0xc')](function(){if(_0x403d78===_0xd9c1('0x4f')){var _0x6fb91=_[_0xd9c1('0x18')](_0x5f6a76[_0xd9c1('0x2c')],'id');return _0x5f6a76['removeWhatsappInteractions'](_0x6fb91)['then'](function(){for(var _0x482366=0x0;_0x482366<_0x6fb91[_0xd9c1('0x1f')];_0x482366+=0x1){_0x18d5f3[_0xd9c1('0x51')](_0xd9c1('0x5b'),{'WhatsappInteractionId':Number(_0x6fb91[_0x482366]),'UserId':Number(_0x5f6a76['id'])});}});}})[_0xd9c1('0x5c')](function(_0x5c36f2){_0x348f78[_0xd9c1('0x5d')](_0x5c36f2);});}}function onDisconnect(_0xe912b8,_0x171034){joinOrLeave(_0xe912b8,_0xd9c1('0x4f'),_0x171034);}function onConnect(_0x2f7ea5){joinOrLeave(_0x2f7ea5,'join');}exports[_0xd9c1('0x5e')]=function(_0x53789f){_0x53789f['on'](_0xd9c1('0x5f'),function(_0x2ff787){_0x2ff787[_0xd9c1('0x60')](0x0);_0x2ff787['address']=_0x2ff787[_0xd9c1('0x61')][_0xd9c1('0x5f')][_0xd9c1('0x62')]+':'+_0x2ff787[_0xd9c1('0x61')][_0xd9c1('0x5f')][_0xd9c1('0x63')];_0x2ff787[_0xd9c1('0x64')]=new Date();_0x2ff787[_0xd9c1('0x5d')]=function(_0x5f384d){console[_0xd9c1('0x5d')]('SocketIO\x20'+_0x2ff787[_0xd9c1('0x65')][_0xd9c1('0x4')]+'['+_0x2ff787[_0xd9c1('0x66')]+']',_0x5f384d);};_0x2ff787['on'](_0xd9c1('0x67'),function(){onDisconnect(_0x2ff787,_0x53789f);_0x2ff787[_0xd9c1('0x5d')](_0xd9c1('0x68'));});onConnect(_0x2ff787);_0x2ff787[_0xd9c1('0x5d')](_0xd9c1('0x69'));});}; \ No newline at end of file +var _0xde3a=['fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','default','setMaxListeners','address','request','connection','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','where','Campaign','format','length','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:inbound','userProfileId','ChatQueues','Trunk','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice'];(function(_0x2d81de,_0x2ed903){var _0xe91fc1=function(_0x4ae7d0){while(--_0x4ae7d0){_0x2d81de['push'](_0x2d81de['shift']());}};_0xe91fc1(++_0x2ed903);}(_0xde3a,0x140));var _0xade3=function(_0x22c21b,_0x14e93f){_0x22c21b=_0x22c21b-0x0;var _0x24bdc=_0xde3a[_0x22c21b];return _0x24bdc;};'use strict';var _=require(_0xade3('0x0'));var util=require(_0xade3('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xade3('0x2')],'include':[{'as':_0xade3('0x3'),'model':db[_0xade3('0x4')],'attributes':['id',_0xade3('0x2'),_0xade3('0x5')],'raw':!![],'where':{'role':_0xade3('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xade3('0x2')],'where':{'role':_0xade3('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xade3('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xade3('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xade3('0x2'),_0xade3('0x8')],'where':{'type':_0xade3('0x9')}};function getAssociatedResources(_0x11f798,_0x145618,_0xc08245){return db['UserProfileSection'][_0xade3('0xa')]({'where':{'name':_0x11f798,'userProfileId':_0x145618},'raw':!![]})[_0xade3('0xb')](function(_0x4b2a40){if(_0x4b2a40){if(_0x4b2a40[_0xade3('0xc')]){switch(_0x11f798){case _0xade3('0xd'):case'ChatQueues':case _0xade3('0xe'):case _0xade3('0xf'):case _0xade3('0x10'):case _0xade3('0x11'):case _0xade3('0x12'):return db[_0xc08245][_0xade3('0x13')](queryQueues);case _0xade3('0x14'):return db[_0xc08245][_0xade3('0x13')](queryTelephones);case'Trunks':return db[_0xc08245][_0xade3('0x13')](queryTrunks);case'IvrCampaigns':return db[_0xc08245][_0xade3('0x13')](queryCampaigns);}}else{return db[_0xade3('0x15')][_0xade3('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x4b2a40['id']},'raw':!![]})['then'](function(_0x1afb49){if(_0x1afb49){var _0x18ce55={'where':{'id':_['map'](_0x1afb49,_0xade3('0x16'))},'raw':!![]};switch(_0xc08245){case'User':_0x18ce55[_0xade3('0x17')][_0xade3('0x5')]='telephone';break;case _0xade3('0x18'):_0x18ce55[_0xade3('0x17')]['type']=_0xade3('0x9');break;}return db[_0xc08245]['findAll'](_0x18ce55);}else{return[];}});}}else{return[];}})['then'](function(_0x9caa18){return _0x9caa18;});}function joinOrLeaveQueues(_0x1d902b,_0x2e6791,_0x179b11,_0x2a4a7c){_0x1d902b[_0x2e6791](util[_0xade3('0x19')]('%s:queue:%s',_0x179b11,_0x2a4a7c[_0xade3('0x2')]));if(_0x2a4a7c[_0xade3('0x3')]){for(var _0x11222d=0x0;_0x11222d<_0x2a4a7c[_0xade3('0x3')][_0xade3('0x1a')];_0x11222d+=0x1){_0x1d902b[_0x2e6791](util[_0xade3('0x19')]('user:%s',_0x2a4a7c[_0xade3('0x3')][_0x11222d][_0xade3('0x2')]));}}}function joinOrLeave(_0xe4109b,_0x320860,_0x421cd2){var _0xb319ea;if(_0xe4109b[_0xade3('0x1b')][_0xade3('0x1c')]['id']){db[_0xade3('0x4')]['find']({'attributes':['id','name',_0xade3('0x5'),'userProfileId'],'where':{'id':_0xe4109b['handshake'][_0xade3('0x1c')]['id']},'include':[{'model':db[_0xade3('0x1d')],'as':_0xade3('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0xade3('0x1f')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xade3('0x20')],'as':_0xade3('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xade3('0x22')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xade3('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xade3('0x24')],'as':_0xade3('0x25'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x22a949){if(_0x22a949){_0xb319ea=_0x22a949;_0xe4109b[_0x320860](util[_0xade3('0x19')](_0xade3('0x26'),_0x22a949[_0xade3('0x2')]));var _0x5aa007=[];switch(_0x22a949[_0xade3('0x5')]){case _0xade3('0x27'):_0xe4109b[_0x320860]('voice:inbound');_0xe4109b[_0x320860](_0xade3('0x28'));if(queryQueues[_0xade3('0x29')]('include')){delete queryQueues[_0xade3('0x2a')];}_0x5aa007[_0xade3('0x2b')](db[_0xade3('0x2c')][_0xade3('0x13')](queryQueues));_0x5aa007[_0xade3('0x2b')](db[_0xade3('0x2d')]['findAll'](queryQueues));_0x5aa007[_0xade3('0x2b')](db[_0xade3('0x2e')]['findAll'](queryQueues));_0x5aa007[_0xade3('0x2b')](db[_0xade3('0x2f')][_0xade3('0x13')](queryQueues));_0x5aa007[_0xade3('0x2b')](db[_0xade3('0x30')][_0xade3('0x13')](queryQueues));_0x5aa007[_0xade3('0x2b')](db[_0xade3('0x31')]['findAll'](queryQueues));_0x5aa007[_0xade3('0x2b')](db[_0xade3('0x32')][_0xade3('0x13')](queryQueues));_0x5aa007[_0xade3('0x2b')](db['User'][_0xade3('0x13')](queryTelephones));_0x5aa007[_0xade3('0x2b')](db['Trunk'][_0xade3('0x13')](queryTrunks));_0x5aa007[_0xade3('0x2b')](db['Campaign'][_0xade3('0x13')](queryCampaigns));_0x5aa007['push'](db['User'][_0xade3('0x13')](queryAgents));break;case _0xade3('0x33'):_0xe4109b[_0x320860](_0xade3('0x34'));_0xe4109b[_0x320860](_0xade3('0x28'));_0x5aa007[_0xade3('0x2b')](getAssociatedResources('VoiceQueues',_0x22a949[_0xade3('0x35')],_0xade3('0x2c')));_0x5aa007[_0xade3('0x2b')](getAssociatedResources(_0xade3('0x36'),_0x22a949['userProfileId'],'ChatQueue'));_0x5aa007[_0xade3('0x2b')](getAssociatedResources(_0xade3('0xe'),_0x22a949['userProfileId'],_0xade3('0x2e')));_0x5aa007['push'](getAssociatedResources('SmsQueues',_0x22a949[_0xade3('0x35')],'SmsQueue'));_0x5aa007['push'](getAssociatedResources(_0xade3('0x10'),_0x22a949[_0xade3('0x35')],_0xade3('0x30')));_0x5aa007[_0xade3('0x2b')](getAssociatedResources(_0xade3('0x11'),_0x22a949['userProfileId'],_0xade3('0x31')));_0x5aa007[_0xade3('0x2b')](getAssociatedResources(_0xade3('0x12'),_0x22a949[_0xade3('0x35')],_0xade3('0x32')));_0x5aa007[_0xade3('0x2b')](getAssociatedResources(_0xade3('0x14'),_0x22a949[_0xade3('0x35')],_0xade3('0x4')));_0x5aa007[_0xade3('0x2b')](getAssociatedResources('Trunks',_0x22a949['userProfileId'],_0xade3('0x37')));_0x5aa007[_0xade3('0x2b')](getAssociatedResources(_0xade3('0x38'),_0x22a949[_0xade3('0x35')],'Campaign'));_0x5aa007[_0xade3('0x2b')](db['User'][_0xade3('0x13')](queryAgents));break;case _0xade3('0x6'):_0xe4109b[_0x320860](_0xade3('0x34'));_0xe4109b[_0x320860](_0xade3('0x28'));_0x5aa007[_0xade3('0x2b')](_0x22a949[_0xade3('0x39')]({'attributes':['id',_0xade3('0x2')]}));_0x5aa007['push'](_0x22a949[_0xade3('0x3a')]({'attributes':['id',_0xade3('0x2')]}));_0x5aa007['push'](_0x22a949['getFaxQueues']({'attributes':['id',_0xade3('0x2')]}));_0x5aa007[_0xade3('0x2b')](_0x22a949[_0xade3('0x3b')]({'attributes':['id','name']}));_0x5aa007[_0xade3('0x2b')](_0x22a949[_0xade3('0x3c')]({'attributes':['id',_0xade3('0x2')]}));_0x5aa007[_0xade3('0x2b')](_0x22a949['getOpenchannelQueues']({'attributes':['id',_0xade3('0x2')]}));_0x5aa007['push'](_0x22a949[_0xade3('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0xade3('0x3e')](_0x5aa007);}})[_0xade3('0xb')](function(_0x29fe61){if(_0x29fe61&&_0x29fe61['length']){for(var _0x3650c5=0x0;_0x3650c5<_0x29fe61['length'];_0x3650c5+=0x1){for(var _0x39fafb=0x0;_0x39fafb<_0x29fe61[_0x3650c5][_0xade3('0x1a')];_0x39fafb+=0x1){switch(_0x3650c5){case 0x0:joinOrLeaveQueues(_0xe4109b,_0x320860,_0xade3('0x3f'),_0x29fe61[_0x3650c5][_0x39fafb]);break;case 0x1:joinOrLeaveQueues(_0xe4109b,_0x320860,'chat',_0x29fe61[_0x3650c5][_0x39fafb]);break;case 0x2:joinOrLeaveQueues(_0xe4109b,_0x320860,_0xade3('0x40'),_0x29fe61[_0x3650c5][_0x39fafb]);break;case 0x3:joinOrLeaveQueues(_0xe4109b,_0x320860,_0xade3('0x41'),_0x29fe61[_0x3650c5][_0x39fafb]);break;case 0x4:joinOrLeaveQueues(_0xe4109b,_0x320860,_0xade3('0x42'),_0x29fe61[_0x3650c5][_0x39fafb]);break;case 0x5:joinOrLeaveQueues(_0xe4109b,_0x320860,_0xade3('0x43'),_0x29fe61[_0x3650c5][_0x39fafb]);break;case 0x6:joinOrLeaveQueues(_0xe4109b,_0x320860,_0xade3('0x44'),_0x29fe61[_0x3650c5][_0x39fafb]);break;case 0x7:if(_0xb319ea[_0xade3('0x5')]!==_0xade3('0x6'))_0xe4109b[_0x320860](util[_0xade3('0x19')](_0xade3('0x45'),_0x29fe61[_0x3650c5][_0x39fafb][_0xade3('0x2')]));break;case 0x8:if(_0xb319ea['role']!==_0xade3('0x6'))_0xe4109b[_0x320860](util[_0xade3('0x19')]('trunk:%s',_0x29fe61[_0x3650c5][_0x39fafb][_0xade3('0x2')]));break;case 0x9:if(_0xb319ea[_0xade3('0x5')]!=='agent')_0xe4109b[_0x320860](util[_0xade3('0x19')](_0xade3('0x46'),_0x29fe61[_0x3650c5][_0x39fafb][_0xade3('0x8')],_0x29fe61[_0x3650c5][_0x39fafb][_0xade3('0x2')]));break;case 0xa:_0xe4109b[_0x320860](util[_0xade3('0x19')](_0xade3('0x26'),_0x29fe61[_0x3650c5][_0x39fafb]['name']));break;}}}}})[_0xade3('0xb')](function(){if(_0x320860===_0xade3('0x47')){var _0x568663=_[_0xade3('0x48')](_0xb319ea['ChatInteractions'],'id');return _0xb319ea[_0xade3('0x49')](_0x568663)[_0xade3('0xb')](function(){for(var _0x152525=0x0;_0x152525<_0x568663[_0xade3('0x1a')];_0x152525+=0x1){_0x421cd2[_0xade3('0x4a')](_0xade3('0x4b'),{'ChatInteractionId':Number(_0x568663[_0x152525]),'UserId':Number(_0xb319ea['id'])});}});}})['then'](function(){if(_0x320860===_0xade3('0x47')){var _0x156260=_[_0xade3('0x48')](_0xb319ea[_0xade3('0x4c')],'id');return _0xb319ea['removeMailInteractions'](_0x156260)[_0xade3('0xb')](function(){for(var _0x4cb692=0x0;_0x4cb692<_0x156260['length'];_0x4cb692+=0x1){_0x421cd2[_0xade3('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x156260[_0x4cb692]),'UserId':Number(_0xb319ea['id'])});}});}})[_0xade3('0xb')](function(){if(_0x320860===_0xade3('0x47')){var _0x52d11b=_[_0xade3('0x48')](_0xb319ea['FaxInteractions'],'id');return _0xb319ea['removeFaxInteractions'](_0x52d11b)[_0xade3('0xb')](function(){for(var _0x20018e=0x0;_0x20018e<_0x52d11b[_0xade3('0x1a')];_0x20018e+=0x1){_0x421cd2[_0xade3('0x4a')](_0xade3('0x4d'),{'FaxInteractionId':Number(_0x52d11b[_0x20018e]),'UserId':Number(_0xb319ea['id'])});}});}})[_0xade3('0xb')](function(){if(_0x320860===_0xade3('0x47')){var _0x25fd9f=_[_0xade3('0x48')](_0xb319ea['SmsInteractions'],'id');return _0xb319ea[_0xade3('0x4e')](_0x25fd9f)[_0xade3('0xb')](function(){for(var _0x49e17f=0x0;_0x49e17f<_0x25fd9f[_0xade3('0x1a')];_0x49e17f+=0x1){_0x421cd2[_0xade3('0x4a')](_0xade3('0x4f'),{'SmsInteractionId':Number(_0x25fd9f[_0x49e17f]),'UserId':Number(_0xb319ea['id'])});}});}})['then'](function(){if(_0x320860===_0xade3('0x47')){var _0x5de0f8=_[_0xade3('0x48')](_0xb319ea[_0xade3('0x23')],'id');return _0xb319ea[_0xade3('0x50')](_0x5de0f8)[_0xade3('0xb')](function(){for(var _0x91b281=0x0;_0x91b281<_0x5de0f8['length'];_0x91b281+=0x1){_0x421cd2[_0xade3('0x4a')](_0xade3('0x51'),{'OpenchannelInteractionId':Number(_0x5de0f8[_0x91b281]),'UserId':Number(_0xb319ea['id'])});}});}})['then'](function(){if(_0x320860===_0xade3('0x47')){var _0xa19ea=_['map'](_0xb319ea[_0xade3('0x25')],'id');return _0xb319ea['removeWhatsappInteractions'](_0xa19ea)[_0xade3('0xb')](function(){for(var _0x7147ec=0x0;_0x7147ec<_0xa19ea[_0xade3('0x1a')];_0x7147ec+=0x1){_0x421cd2[_0xade3('0x4a')](_0xade3('0x52'),{'WhatsappInteractionId':Number(_0xa19ea[_0x7147ec]),'UserId':Number(_0xb319ea['id'])});}});}})[_0xade3('0x53')](function(_0x33151f){_0xe4109b['log'](_0x33151f);});}}function onDisconnect(_0x118859,_0x2b8bf5){joinOrLeave(_0x118859,'leave',_0x2b8bf5);}function onConnect(_0x15597f){joinOrLeave(_0x15597f,'join');}exports[_0xade3('0x54')]=function(_0xd655f0){_0xd655f0['on']('connection',function(_0x47e921){_0x47e921[_0xade3('0x55')](0x0);_0x47e921[_0xade3('0x56')]=_0x47e921[_0xade3('0x57')][_0xade3('0x58')]['remoteAddress']+':'+_0x47e921['request'][_0xade3('0x58')]['remotePort'];_0x47e921[_0xade3('0x59')]=new Date();_0x47e921['log']=function(_0x5b0c1){console[_0xade3('0x5a')](_0xade3('0x5b')+_0x47e921[_0xade3('0x5c')]['name']+'['+_0x47e921[_0xade3('0x56')]+']',_0x5b0c1);};_0x47e921['on'](_0xade3('0x5d'),function(){onDisconnect(_0x47e921,_0xd655f0);_0x47e921[_0xade3('0x5a')](_0xade3('0x5e'));});onConnect(_0x47e921);_0x47e921['log'](_0xade3('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index af1f75d..9b00b48 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 _0xe3a9=['newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','resolve','ContactId','sequelize','query','Sequelize','SELECT','contact','UserId','User','find','name','fullname','email','internal','interface','format','SIP/%s','agent','incomingmessage','AfterCreateMessage','opened','changed','closed','substatus','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','AfterUpdate','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate'];(function(_0x562457,_0x1aea9b){var _0x490e75=function(_0x223370){while(--_0x223370){_0x562457['push'](_0x562457['shift']());}};_0x490e75(++_0x1aea9b);}(_0xe3a9,0x16f));var _0x9e3a=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xe3a9[_0x3d4876];return _0x58ca9d;};'use strict';var util=require(_0x9e3a('0x0'));var db=require(_0x9e3a('0x1'))['db'];var jayson=require(_0x9e3a('0x2'));var logger=require(_0x9e3a('0x3'))('triggers');var client=jayson[_0x9e3a('0x4')][_0x9e3a('0x5')]({'port':0x232a});var triggers=[{'channel':_0x9e3a('0x6'),'model':_0x9e3a('0x7'),'event':'afterCreate','condition':_0x9e3a('0x8'),'callback':afterCreate},{'channel':_0x9e3a('0x6'),'model':'ChatInteraction','event':_0x9e3a('0x9'),'condition':_0x9e3a('0xa'),'callback':afterUpdate},{'channel':_0x9e3a('0x6'),'model':_0x9e3a('0xb'),'event':_0x9e3a('0xc'),'condition':_0x9e3a('0xd'),'callback':afterCreateMessage},{'channel':_0x9e3a('0xe'),'model':_0x9e3a('0xf'),'event':_0x9e3a('0xc'),'condition':_0x9e3a('0x8'),'callback':afterCreate},{'channel':_0x9e3a('0xe'),'model':'SmsInteraction','event':_0x9e3a('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9e3a('0xe'),'model':_0x9e3a('0x10'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9e3a('0x11'),'model':'WhatsappInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x9e3a('0x11'),'model':_0x9e3a('0x12'),'event':'afterUpdate','condition':_0x9e3a('0xa'),'callback':afterUpdate},{'channel':_0x9e3a('0x11'),'model':_0x9e3a('0x13'),'event':_0x9e3a('0xc'),'condition':_0x9e3a('0xd'),'callback':afterCreateMessage},{'channel':_0x9e3a('0x14'),'model':_0x9e3a('0x15'),'event':_0x9e3a('0xc'),'condition':_0x9e3a('0x8'),'callback':afterCreate},{'channel':_0x9e3a('0x14'),'model':_0x9e3a('0x15'),'event':'afterUpdate','condition':_0x9e3a('0xa'),'callback':afterUpdate},{'channel':_0x9e3a('0x14'),'model':_0x9e3a('0x16'),'event':_0x9e3a('0xc'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9e3a('0x17'),'model':_0x9e3a('0x18'),'event':'afterCreate','condition':_0x9e3a('0x8'),'callback':afterCreate},{'channel':_0x9e3a('0x17'),'model':_0x9e3a('0x18'),'event':'afterUpdate','condition':_0x9e3a('0xa'),'callback':afterUpdate},{'channel':_0x9e3a('0x17'),'model':_0x9e3a('0x19'),'event':_0x9e3a('0xc'),'condition':_0x9e3a('0xd'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x9e3a('0x1a'),'event':_0x9e3a('0xc'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9e3a('0x1b'),'model':_0x9e3a('0x1a'),'event':_0x9e3a('0x9'),'condition':_0x9e3a('0xa'),'callback':afterUpdate},{'channel':_0x9e3a('0x1b'),'model':_0x9e3a('0x1c'),'event':_0x9e3a('0xc'),'condition':_0x9e3a('0xd'),'callback':afterCreateMessage}];function request(_0x2bd5be){return client[_0x9e3a('0x1d')](_0x9e3a('0x1e'),_0x2bd5be)[_0x9e3a('0x1f')](function(_0x270fca){logger[_0x9e3a('0x20')](_0x9e3a('0x21'),_0x9e3a('0x1e'),_0x270fca);if(_0x270fca['error']){if(_0x270fca[_0x9e3a('0x22')][_0x9e3a('0x23')]===0x1f4){logger[_0x9e3a('0x22')]('Trigger,\x20%s',_0x9e3a('0x1e'),_0x270fca[_0x9e3a('0x22')]);}}})[_0x9e3a('0x24')](function(_0x104b05){logger['error'](_0x9e3a('0x21'),_0x9e3a('0x1e'),_0x104b05);});}function afterCreateMessage(_0x2f72c2){return function(_0x2ad170){_0x2ad170=_0x2ad170[_0x9e3a('0x25')]({'plain':!![]});_0x2ad170[_0x9e3a('0x26')]=_0x2f72c2;_0x2ad170[_0x9e3a('0x27')]=_0x2f72c2;_0x2ad170[_0x9e3a('0x28')]=_0x2ad170[_0x9e3a('0x29')];Promise[_0x9e3a('0x2a')]()['then'](function(){if(typeof _0x2ad170[_0x9e3a('0x2b')]==='undefined')return null;var _0x5aee63='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ad170[_0x9e3a('0x2b')];return db[_0x9e3a('0x2c')][_0x9e3a('0x2d')](_0x5aee63,{'type':db[_0x9e3a('0x2e')]['QueryTypes'][_0x9e3a('0x2f')],'raw':!![]});})[_0x9e3a('0x1f')](function(_0x15de95){if(_0x15de95){_0x2ad170[_0x9e3a('0x30')]=_0x15de95[0x0];}if(_0x2ad170[_0x9e3a('0x31')]){return db[_0x9e3a('0x32')][_0x9e3a('0x33')]({'where':{'id':_0x2ad170['UserId']},'attributes':['id',_0x9e3a('0x34'),_0x9e3a('0x35'),_0x9e3a('0x36'),_0x9e3a('0x37')],'raw':!![]})[_0x9e3a('0x1f')](function(_0x5246b6){_0x2ad170[_0x9e3a('0x38')]=util[_0x9e3a('0x39')](_0x9e3a('0x3a'),_0x5246b6[_0x9e3a('0x34')]);_0x2ad170[_0x9e3a('0x26')]=_0x2f72c2;_0x2ad170[_0x9e3a('0x3b')]=_0x5246b6;return request({'event':_0x9e3a('0x3c'),'message':_0x2ad170});})[_0x9e3a('0x24')](function(_0x3369a0){logger[_0x9e3a('0x22')]('Trigger,\x20%s',_0x9e3a('0x3d'),_0x3369a0);});}else{return request({'event':'outgoingmessage','message':_0x2ad170});}});};}function afterCreate(_0x393768,_0x4b6aa6){return function(_0x947035){_0x947035=_0x947035[_0x9e3a('0x25')]({'plain':!![]});_0x947035[_0x9e3a('0x26')]=_0x393768;_0x947035[_0x9e3a('0x27')]=_0x393768;_0x947035[_0x9e3a('0x28')]=_0x9e3a('0x3e');var _0x4f8a50='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x947035[_0x9e3a('0x2b')];return db[_0x9e3a('0x2c')][_0x9e3a('0x2d')](_0x4f8a50,{'type':db['Sequelize']['QueryTypes'][_0x9e3a('0x2f')],'raw':!![]})[_0x9e3a('0x1f')](function(_0x59eb79){return _0x59eb79;})[_0x9e3a('0x1f')](function(_0x5ea360){if(_0x5ea360){_0x947035['contact']=_0x5ea360[0x0];}return request({'event':_0x4b6aa6,'message':_0x947035});});};}function afterUpdate(_0x36a818){return function(_0x1b675c){var _0x1b12b1=_0x1b675c[_0x9e3a('0x3f')](_0x9e3a('0x40'))&&_0x1b675c[_0x9e3a('0x40')];var _0x3e2452=_0x1b675c[_0x9e3a('0x3f')](_0x9e3a('0x41'));if(_0x1b12b1||_0x3e2452){var _0x1fbba1=_0x1b12b1?_0x9e3a('0xa'):'substatus';var _0x570733=_0x1b675c[_0x9e3a('0x25')]({'plain':!![]});_0x570733[_0x9e3a('0x26')]=_0x36a818;_0x570733['motionChannel']=_0x36a818;_0x570733['event']=_0x1b12b1?_0x9e3a('0x40'):_0x9e3a('0x41');var _0x3a7552=_0x9e3a('0x42')+_0x570733[_0x9e3a('0x2b')];return db[_0x9e3a('0x2c')][_0x9e3a('0x2d')](_0x3a7552,{'type':db[_0x9e3a('0x2e')][_0x9e3a('0x43')]['SELECT'],'raw':!![]})[_0x9e3a('0x1f')](function(_0x326a80){if(_0x326a80){_0x570733[_0x9e3a('0x30')]=_0x326a80[0x0];}if(_0x570733[_0x9e3a('0x31')]){return db[_0x9e3a('0x32')][_0x9e3a('0x33')]({'where':{'id':_0x570733[_0x9e3a('0x31')]},'attributes':['id',_0x9e3a('0x34'),_0x9e3a('0x35'),_0x9e3a('0x36'),_0x9e3a('0x37')],'raw':!![]})['then'](function(_0xa9b899){_0x570733[_0x9e3a('0x38')]=util[_0x9e3a('0x39')]('SIP/%s',_0xa9b899[_0x9e3a('0x34')]);_0x570733['agent']=_0xa9b899;return request({'event':_0x1fbba1,'message':_0x570733});})[_0x9e3a('0x24')](function(_0x1c4978){logger[_0x9e3a('0x22')](_0x9e3a('0x21'),_0x9e3a('0x44'),_0x1c4978);});}else{return request({'event':_0x1fbba1,'message':_0x570733});}});}};}exports[_0x9e3a('0x45')]=function(){for(var _0x35e081=0x0;_0x35e081=_0x46dd4a[_0x78dd('0x14')]){throw Error(_0x78dd('0x15'));}_0x1f3718(_0x5f5af2);})[_0x78dd('0x16')](function(_0x34c31f){_0x3cb7cf(_0x34c31f);});});}; \ No newline at end of file +var _0x0738=['then','agents','lodash','bluebird','../mysqldb','voice','mail','chat','fax','whatsapp','openchannel','getChannels','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count'];(function(_0x17bd71,_0x96efd5){var _0x509023=function(_0x47c3c9){while(--_0x47c3c9){_0x17bd71['push'](_0x17bd71['shift']());}};_0x509023(++_0x96efd5);}(_0x0738,0x152));var _0x8073=function(_0x456a84,_0x46bc0b){_0x456a84=_0x456a84-0x0;var _0x1117d6=_0x0738[_0x456a84];return _0x1117d6;};'use strict';var _=require(_0x8073('0x0'));var BPromise=require(_0x8073('0x1'));var db=require(_0x8073('0x2'))['db'];var util=require('./license/util');var channels=[_0x8073('0x3'),_0x8073('0x4'),_0x8073('0x5'),_0x8073('0x6'),'sms',_0x8073('0x7'),_0x8073('0x8')];exports[_0x8073('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0xa16642){_0xa16642=_0xa16642['toLowerCase']();return _['includes'](channels,_0xa16642);};exports[_0x8073('0xa')]=function(_0x188c90,_0x4ceb04,_0x219c2a,_0x361820){var _0x53e7c2={'loginAttempts':_0x4ceb04,'blocked':_0x219c2a};if(!_[_0x8073('0xb')](_0x361820)){_0x53e7c2[_0x8073('0xc')]=_0x361820;}return _0x188c90[_0x8073('0xd')](_0x53e7c2);};exports[_0x8073('0xe')]=function(_0x50b0c5){return new BPromise(function(_0x2ef508,_0x24df44){var _0x471950=0x0;if(_0x50b0c5[_0x8073('0xf')]!==_0x8073('0x10')){_0x2ef508(_0x50b0c5);}db[_0x8073('0x11')][_0x8073('0x12')]({'where':{'role':_0x8073('0x10'),'online':!![],'id':{'$ne':_0x50b0c5['id']}}})[_0x8073('0x13')](function(_0xb54c85){_0x471950=_0xb54c85;return util['getLicense']();})[_0x8073('0x13')](function(_0x4aaaa1){if(_0x4aaaa1&&_0x4aaaa1[_0x8073('0x14')]&&_0x471950>=_0x4aaaa1[_0x8073('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2ef508(_0x50b0c5);})['catch'](function(_0x2eb531){_0x24df44(_0x2eb531);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index e718bbb..80b775a 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0219=['status','render','json','send','exports','404'];(function(_0x197682,_0x45dc55){var _0x5a48b2=function(_0x76919){while(--_0x76919){_0x197682['push'](_0x197682['shift']());}};_0x5a48b2(++_0x45dc55);}(_0x0219,0x15a));var _0x9021=function(_0x2ff751,_0x4a9cd6){_0x2ff751=_0x2ff751-0x0;var _0x34dbf3=_0x0219[_0x2ff751];return _0x34dbf3;};'use strict';module[_0x9021('0x0')][0x194]=function pageNotFound(_0x1e1017,_0x2c71f8){var _0x2b8c39=_0x9021('0x1');var _0x263fab=0x194;var _0x256283={'status':_0x263fab};_0x2c71f8[_0x9021('0x2')](_0x256283['status']);_0x2c71f8[_0x9021('0x3')](_0x2b8c39,{},function(_0x52c43a,_0x157530){if(_0x52c43a){return _0x2c71f8[_0x9021('0x2')](_0x256283[_0x9021('0x2')])[_0x9021('0x4')](_0x256283);}_0x2c71f8[_0x9021('0x5')](_0x157530);});}; \ No newline at end of file +var _0xd1d5=['404','status','render','json','exports'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0xd1d5,0xa4));var _0x5d1d=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xd1d5[_0x4243a3];return _0x1b2a33;};'use strict';module[_0x5d1d('0x0')][0x194]=function pageNotFound(_0x1ad842,_0x16f469){var _0x5081fb=_0x5d1d('0x1');var _0x89f769=0x194;var _0x20b0a1={'status':_0x89f769};_0x16f469[_0x5d1d('0x2')](_0x20b0a1[_0x5d1d('0x2')]);_0x16f469[_0x5d1d('0x3')](_0x5081fb,{},function(_0x1686bc,_0xb52ac1){if(_0x1686bc){return _0x16f469[_0x5d1d('0x2')](_0x20b0a1[_0x5d1d('0x2')])[_0x5d1d('0x4')](_0x20b0a1);}_0x16f469['send'](_0xb52ac1);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5e03059..bf98d5b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b5=['../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','hasOne','hasMany','Recordings','UserId','UserVoiceQueueRt','VoiceQueuesRt','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','FaxQueues','SmsQueues','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','Trunk','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','CmList','voice_queues_has_cm_lists','Agents','BlackLists','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Messages','Interactions','MailApplication','ListId','TemplateId','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ChatWebsiteId','ChatOfflineMessageId','restrict','IntervalId','TagId','DashboardItem','FaxAccount','Answers','FaxAccountId','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Users','team_has_fax_queues','Teams','List','SmsMessage','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','UserChatQueue','team_has_chat_queues','ChatGroupId','Contacts','Company','CompanyId','cm_user_has_contacts','cm_contact_has_tags','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','Any','AutomationAnyId','AutomationId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Trigger','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Action','TriggerId','AnalyticFieldReport','Fields','Configurations','AccountId','SubjectId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','Subjects','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FreshsalesAccount','FreshsalesField','ChatQueueReport','FromId','SessionId','SmsQueueReport','ProjectId','team_has_mail_queues','ChatQueues','team_has_whatsapp_queues','HopperHistories','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','password','options','database','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration'];(function(_0x5d0e20,_0x10e9de){var _0x4a3720=function(_0x304269){while(--_0x304269){_0x5d0e20['push'](_0x5d0e20['shift']());}};_0x4a3720(++_0x10e9de);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0xe5b5[_0x1305e3];return _0x1068e9;};'use strict';var config=require(_0x5e5b('0x0'));var Sequelize=require(_0x5e5b('0x1'));var _=require(_0x5e5b('0x2'));var jstz=require(_0x5e5b('0x3'));var timezone=jstz[_0x5e5b('0x4')]();config[_0x5e5b('0x1')]=_[_0x5e5b('0x5')](config[_0x5e5b('0x1')],{'database':_0x5e5b('0x6'),'username':_0x5e5b('0x7'),'password':_0x5e5b('0x8'),'options':{'host':_0x5e5b('0x9'),'port':0xcea,'dialect':_0x5e5b('0xa'),'dialectOptions':{'charset':_0x5e5b('0xb')},'logging':![],'timezone':timezone[_0x5e5b('0xc')](),'define':{'charset':_0x5e5b('0xd'),'collate':_0x5e5b('0xe')}}});config[_0x5e5b('0xf')]=_[_0x5e5b('0x5')](config[_0x5e5b('0xf')],{'database':_0x5e5b('0x6'),'username':_0x5e5b('0x7'),'password':_0x5e5b('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x5e5b('0xa'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x5e5b('0xc')](),'define':{'charset':_0x5e5b('0xd'),'collate':_0x5e5b('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5e5b('0x1')]['database'],config['sequelize']['username'],config[_0x5e5b('0x1')][_0x5e5b('0x10')],config[_0x5e5b('0x1')][_0x5e5b('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5e5b('0xf')][_0x5e5b('0x12')],config[_0x5e5b('0xf')]['username'],config[_0x5e5b('0xf')][_0x5e5b('0x10')],config['sequelizeHistory'][_0x5e5b('0x11')])};db['User']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x14'));db[_0x5e5b('0x15')]=db['sequelize'][_0x5e5b('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x5e5b('0x16')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x17'));db[_0x5e5b('0x18')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x19'));db[_0x5e5b('0x1a')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x1b'));db[_0x5e5b('0x1c')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x1d'));db[_0x5e5b('0x1e')]=db[_0x5e5b('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x5e5b('0x1f')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x20'));db[_0x5e5b('0x21')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x22'));db[_0x5e5b('0x23')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x5e5b('0x24')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x5e5b('0x25')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x26'));db[_0x5e5b('0x27')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x28'));db[_0x5e5b('0x29')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x2a'));db[_0x5e5b('0x2b')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x2c'));db[_0x5e5b('0x2d')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x2e'));db['UserVoiceQueueRt']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x2f'));db[_0x5e5b('0x30')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x31'));db['UserChatQueue']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x32'));db[_0x5e5b('0x33')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x34'));db[_0x5e5b('0x35')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x36'));db[_0x5e5b('0x37')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x38'));db['UserOpenchannelQueue']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x39'));db[_0x5e5b('0x3a')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x3b'));db[_0x5e5b('0x3c')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x3d'));db[_0x5e5b('0x3e')]=db['sequelize']['import'](_0x5e5b('0x3f'));db[_0x5e5b('0x40')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x41'));db['MailQueue']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x42'));db[_0x5e5b('0x43')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x44'));db[_0x5e5b('0x45')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x5e5b('0x46')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x47'));db['MailApplication']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x48'));db[_0x5e5b('0x49')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x4a'));db[_0x5e5b('0x4b')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x4c'));db['DashboardItem']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x4d'));db['FaxAccount']=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/faxAccount/faxAccount.model');db[_0x5e5b('0x4e')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x4f'));db['FaxInteraction']=db['sequelize']['import'](_0x5e5b('0x50'));db['FaxMessage']=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x51'));db[_0x5e5b('0x52')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x53'));db[_0x5e5b('0x54')]=db[_0x5e5b('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x5e5b('0x55')]=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db[_0x5e5b('0x56')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x57'));db[_0x5e5b('0x58')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x59'));db['SmsMessage']=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/smsMessage/smsMessage.model');db[_0x5e5b('0x5a')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x5b'));db[_0x5e5b('0x5c')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x5d'));db[_0x5e5b('0x5e')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x5f'));db[_0x5e5b('0x60')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x61'));db['OpenchannelMessage']=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0x5e5b('0x62')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x5e5b('0x63')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x5e5b('0x64')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x5e5b('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0x5e5b('0x65')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x5e5b('0x66')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x67'));db[_0x5e5b('0x68')]=db[_0x5e5b('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x5e5b('0x69')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x6a'));db['ChatGroup']=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x6b'));db[_0x5e5b('0x6c')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x6d'));db[_0x5e5b('0x6e')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/cmCompany/cmCompany.model');db[_0x5e5b('0x6f')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x70'));db[_0x5e5b('0x71')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x72'));db[_0x5e5b('0x73')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x5e5b('0x74')]=db['sequelize'][_0x5e5b('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x5e5b('0x75')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x76'));db[_0x5e5b('0x77')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x78'));db[_0x5e5b('0x79')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/action/action.model');db[_0x5e5b('0x7a')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x7b'));db[_0x5e5b('0x7c')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x7d'));db['Disposition']=db['sequelize']['import'](_0x5e5b('0x7e'));db[_0x5e5b('0x7f')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x80'));db['Interval']=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/interval/interval.model');db[_0x5e5b('0x81')]=db['sequelize']['import'](_0x5e5b('0x82'));db[_0x5e5b('0x83')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x84'));db[_0x5e5b('0x85')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x86'));db[_0x5e5b('0x87')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x88'));db[_0x5e5b('0x89')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x8a'));db[_0x5e5b('0x8b')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x8c'));db[_0x5e5b('0x8d')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x8e'));db['Trigger']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x8f'));db[_0x5e5b('0x90')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/variable/variable.model');db[_0x5e5b('0x91')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/integration/integration.model');db[_0x5e5b('0x92')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x93'));db[_0x5e5b('0x94')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x95'));db[_0x5e5b('0x96')]=db['sequelize'][_0x5e5b('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x5e5b('0x97')]=db[_0x5e5b('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x5e5b('0x98')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x99'));db['AnalyticFieldReport']=db['sequelize'][_0x5e5b('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x5e5b('0x9a')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x5e5b('0x9b')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x5e5b('0x9c')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0x9d'));db['SalesforceField']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x9e'));db[_0x5e5b('0x9f')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x5e5b('0xa0')]=db[_0x5e5b('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x5e5b('0xa1')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xa2'));db[_0x5e5b('0xa3')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xa4'));db[_0x5e5b('0xa5')]=db[_0x5e5b('0x1')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x5e5b('0xa6')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/intDeskField/intDeskField.model');db[_0x5e5b('0xa7')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x5e5b('0xa8')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x5e5b('0xa9')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xaa'));db[_0x5e5b('0xab')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xac'));db[_0x5e5b('0xad')]=db['sequelize'][_0x5e5b('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x5e5b('0xae')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xaf'));db[_0x5e5b('0xb0')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xb1'));db[_0x5e5b('0xb2')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xb3'));db['FreshdeskField']=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xb4'));db[_0x5e5b('0xb5')]=db['sequelize']['import'](_0x5e5b('0xb6'));db[_0x5e5b('0xb7')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xb8'));db[_0x5e5b('0xb9')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xba'));db[_0x5e5b('0xbb')]=db['sequelize'][_0x5e5b('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db['sequelize']['import'](_0x5e5b('0xbc'));db[_0x5e5b('0xbd')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xbe'));db['Dynamics365Account']=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x5e5b('0xbf')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xc0'));db[_0x5e5b('0xc1')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xc2'));db['FreshsalesAccount']=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xc3'));db[_0x5e5b('0xc4')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xc5'));db['FreshsalesField']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xc6'));db[_0x5e5b('0x91')]=db['sequelize']['import'](_0x5e5b('0xc7'));db['Network']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xc8'));db['ChatQueueReport']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xc9'));db[_0x5e5b('0xca')]=db['sequelize'][_0x5e5b('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x5e5b('0xcb')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xcc'));db[_0x5e5b('0xcd')]=db['sequelize'][_0x5e5b('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x5e5b('0xce')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xcf'));db['SmsQueueReport']=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xd0'));db['SquareReport']=db['sequelize']['import'](_0x5e5b('0xd1'));db['SquareDetailsReport']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xd2'));db[_0x5e5b('0xd3')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xd4'));db[_0x5e5b('0xd5')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/setting/setting.model');db[_0x5e5b('0xd6')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xd7'));db[_0x5e5b('0xd8')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xd9'));db[_0x5e5b('0xda')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xdb'));db['SquareMessage']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xdc'));db[_0x5e5b('0xdd')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xde'));db[_0x5e5b('0xdf')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xe0'));db['Campaign']=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xe1'));db[_0x5e5b('0xe2')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xe3'));db[_0x5e5b('0xe4')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xe5'));db['Plugin']=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xe6'));db[_0x5e5b('0xe7')]=db[_0x5e5b('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xe8'));db[_0x5e5b('0xe9')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xea'));db[_0x5e5b('0xeb')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xec'));db['CmList']=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xed'));db[_0x5e5b('0xee')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xef'));db['UserProfile']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xf0'));db[_0x5e5b('0xf1')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xf2'));db[_0x5e5b('0xf3')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xf4'));db['UserNotification']=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xf5'));db[_0x5e5b('0xf6')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0xf7'));db[_0x5e5b('0xf8')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xf9'));db[_0x5e5b('0xfa')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0xfb'));db[_0x5e5b('0xfc')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x5e5b('0xfd')]=db[_0x5e5b('0x1')]['import'](_0x5e5b('0xfe'));db[_0x5e5b('0xff')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x100'));db[_0x5e5b('0x101')]=db['sequelize'][_0x5e5b('0x13')](_0x5e5b('0x102'));db[_0x5e5b('0x103')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x104'));db[_0x5e5b('0x105')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x106'));db[_0x5e5b('0x107')]=db['sequelize'][_0x5e5b('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x5e5b('0x108')]=db[_0x5e5b('0x1')][_0x5e5b('0x13')](_0x5e5b('0x109'));db[_0x5e5b('0x10a')][_0x5e5b('0x10b')](db[_0x5e5b('0x21')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x5e5b('0x10a')][_0x5e5b('0x10c')](db['VoiceRecording'],{'as':_0x5e5b('0x10d'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x10a')][_0x5e5b('0x10c')](db[_0x5e5b('0x10f')],{'as':_0x5e5b('0x110'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x10a')][_0x5e5b('0x10c')](db[_0x5e5b('0x18')],{'as':'Extensions','onDelete':_0x5e5b('0x111'),'hooks':!![]});db[_0x5e5b('0x10a')][_0x5e5b('0x10c')](db[_0x5e5b('0x74')],{'as':_0x5e5b('0x112'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x10a')][_0x5e5b('0x10c')](db[_0x5e5b('0x75')],{'as':_0x5e5b('0x113'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x10a')]['hasMany'](db[_0x5e5b('0x77')],{'as':_0x5e5b('0x77'),'foreignKey':_0x5e5b('0x10e')});db['User'][_0x5e5b('0x10c')](db['OpenchannelInteraction'],{'as':_0x5e5b('0x114'),'foreignKey':_0x5e5b('0x10e')});db['User'][_0x5e5b('0x10c')](db[_0x5e5b('0x65')],{'as':_0x5e5b('0x115'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x10a')][_0x5e5b('0x10c')](db[_0x5e5b('0x58')],{'as':'SmsInteractions','foreignKey':_0x5e5b('0x10e')});db['User'][_0x5e5b('0x10c')](db[_0x5e5b('0x116')],{'as':_0x5e5b('0x117'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x10a')][_0x5e5b('0x10c')](db[_0x5e5b('0x45')],{'as':_0x5e5b('0x118'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x10a')]['hasMany'](db[_0x5e5b('0xfa')],{'as':_0x5e5b('0x119'),'foreignKey':_0x5e5b('0x10e')});db['User'][_0x5e5b('0x10c')](db[_0x5e5b('0x11a')],{'as':_0x5e5b('0x11b'),'foreignKey':_0x5e5b('0x11c')});db[_0x5e5b('0x10a')][_0x5e5b('0x11d')](db['UserProfile'],{'as':_0x5e5b('0x11e'),'foreignKey':_0x5e5b('0x11f')});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0x121')],{'as':_0x5e5b('0x122'),'through':_0x5e5b('0x123')});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db['CmContact'],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db['CmList'],{'as':_0x5e5b('0x124'),'through':'cm_user_has_lists'});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0xdd')],{'through':_0x5e5b('0x125')});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db['MailInteraction'],{'as':_0x5e5b('0x118'),'through':_0x5e5b('0x126')});db['User']['belongsToMany'](db[_0x5e5b('0x65')],{'as':_0x5e5b('0x115'),'through':_0x5e5b('0x127')});db['User']['belongsToMany'](db['FaxInteraction'],{'as':_0x5e5b('0x117'),'through':_0x5e5b('0x128')});db[_0x5e5b('0x10a')]['belongsToMany'](db[_0x5e5b('0x58')],{'as':_0x5e5b('0x129'),'through':_0x5e5b('0x12a')});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0x60')],{'as':'OpenchannelInteractions','through':_0x5e5b('0x12b')});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0xfa')],{'as':_0x5e5b('0x119'),'through':_0x5e5b('0x12c')});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0x1c')],{'as':_0x5e5b('0x12d'),'through':'UserVoiceQueue','required':![]});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0xee')],{'as':_0x5e5b('0x12e'),'through':'UserVoicePrefix','required':![]});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0x12f')],{'as':_0x5e5b('0x130'),'through':_0x5e5b('0x33'),'required':![]});db['User'][_0x5e5b('0x120')](db[_0x5e5b('0x69')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x5e5b('0x120')](db['FaxQueue'],{'as':_0x5e5b('0x131'),'through':_0x5e5b('0x35'),'required':![]});db[_0x5e5b('0x10a')]['belongsToMany'](db['SmsQueue'],{'as':_0x5e5b('0x132'),'through':_0x5e5b('0x37'),'required':![]});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0x62')],{'as':'OpenchannelQueues','through':_0x5e5b('0x133'),'required':![]});db[_0x5e5b('0x10a')]['belongsToMany'](db['WhatsappQueue'],{'as':_0x5e5b('0x134'),'through':'UserWhatsappQueue','required':![]});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db['CmList'],{'through':_0x5e5b('0x135')});db['User']['belongsToMany'](db[_0x5e5b('0x63')],{'as':'ChatWebsites','through':_0x5e5b('0x136')});db[_0x5e5b('0x10a')]['belongsToMany'](db['FaxAccount'],{'as':_0x5e5b('0x137'),'through':'user_has_fax_accounts'});db[_0x5e5b('0x10a')]['belongsToMany'](db[_0x5e5b('0x40')],{'as':_0x5e5b('0x138'),'through':_0x5e5b('0x139')});db[_0x5e5b('0x10a')]['belongsToMany'](db[_0x5e5b('0x5c')],{'as':'OpenchannelAccounts','through':_0x5e5b('0x13a')});db['User'][_0x5e5b('0x120')](db[_0x5e5b('0x55')],{'as':'SmsAccounts','through':_0x5e5b('0x13b')});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0xf6')],{'as':_0x5e5b('0x13c'),'through':_0x5e5b('0x13d')});db[_0x5e5b('0x10a')][_0x5e5b('0x120')](db[_0x5e5b('0xd8')],{'as':'SquareProjects','through':_0x5e5b('0x13e')});db[_0x5e5b('0x15')]['hasMany'](db[_0x5e5b('0x18')],{'as':'SpiedAgents','onDelete':_0x5e5b('0x111'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0x5e5b('0x10c')](db['VoiceExtension'],{'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x18')]['hasMany'](db[_0x5e5b('0x18')],{'as':_0x5e5b('0x13f'),'onDelete':_0x5e5b('0x111')});db['VoiceMusicOnHold'][_0x5e5b('0x120')](db[_0x5e5b('0x89')],{'as':'Sounds','through':_0x5e5b('0x140')});db[_0x5e5b('0x1c')][_0x5e5b('0x10c')](db[_0x5e5b('0x10f')],{'as':_0x5e5b('0x141'),'foreignKey':_0x5e5b('0x142')});db[_0x5e5b('0x1c')][_0x5e5b('0x10c')](db[_0x5e5b('0x71')],{'as':_0x5e5b('0x143'),'foreignKey':'VoiceQueueId'});db[_0x5e5b('0x1c')][_0x5e5b('0x10c')](db['CmHopperFinal'],{'as':_0x5e5b('0x112'),'foreignKey':_0x5e5b('0x142')});db[_0x5e5b('0x1c')][_0x5e5b('0x10c')](db[_0x5e5b('0x75')],{'as':'HopperHistories','foreignKey':_0x5e5b('0x142')});db[_0x5e5b('0x1c')][_0x5e5b('0x10c')](db['ReportAgentPreview'],{'as':_0x5e5b('0x77'),'foreignKey':'VoiceQueueId'});db[_0x5e5b('0x1c')][_0x5e5b('0x10c')](db['CmHopperBlack'],{'as':_0x5e5b('0x144'),'foreignKey':_0x5e5b('0x142')});db[_0x5e5b('0x1c')]['hasMany'](db['JscriptySessionReport'],{'as':_0x5e5b('0x145'),'foreignKey':_0x5e5b('0x142')});db[_0x5e5b('0x1c')][_0x5e5b('0x11d')](db['Trunk'],{'as':_0x5e5b('0x146'),'foreignKey':'TrunkId'});db[_0x5e5b('0x1c')]['belongsTo'](db[_0x5e5b('0x146')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x5e5b('0x1c')][_0x5e5b('0x11d')](db['Interval'],{'as':_0x5e5b('0x147'),'foreignKey':'IntervalId'});db[_0x5e5b('0x1c')][_0x5e5b('0x11d')](db['Pause'],{'as':_0x5e5b('0x148'),'foreignKey':_0x5e5b('0x149')});db['VoiceQueue']['belongsToMany'](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x124'),'through':_0x5e5b('0x14b')});db[_0x5e5b('0x1c')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x30')});db['VoiceQueue'][_0x5e5b('0x120')](db['Team'],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x5e5b('0x1c')][_0x5e5b('0x120')](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x14d'),'through':'voice_queues_has_cm_blacklists'});db[_0x5e5b('0x1e')]['belongsTo'](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x10a'),'foreignKey':'UserId'});db[_0x5e5b('0x1f')][_0x5e5b('0x11d')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x5e5b('0x21')][_0x5e5b('0x10c')](db[_0x5e5b('0x23')],{'as':'Messages','onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x14e'),'sourceKey':_0x5e5b('0x14f')});db[_0x5e5b('0x23')][_0x5e5b('0x11d')](db['VoiceMail'],{'foreignKey':_0x5e5b('0x14e'),'targetKey':_0x5e5b('0x14f')});db[_0x5e5b('0x24')][_0x5e5b('0x10c')](db[_0x5e5b('0x29')],{'as':_0x5e5b('0x150'),'foreignKey':_0x5e5b('0x151'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x5e5b('0x27')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x5e5b('0x24')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':'User','foreignKey':_0x5e5b('0x10e')});db['VoiceCallReport']['belongsTo'](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x3c')]['belongsTo'](db[_0x5e5b('0x40')],{'as':_0x5e5b('0x40'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0x5e5b('0x11d')](db[_0x5e5b('0x40')],{'as':_0x5e5b('0x40'),'foreignKey':_0x5e5b('0x154')});db[_0x5e5b('0x40')][_0x5e5b('0x10b')](db['MailServerIn'],{'as':_0x5e5b('0x155'),'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x40')][_0x5e5b('0x10b')](db[_0x5e5b('0x3e')],{'as':_0x5e5b('0x156'),'onDelete':'cascade'});db['MailAccount'][_0x5e5b('0x10c')](db[_0x5e5b('0x157')],{'as':_0x5e5b('0x158'),'foreignKey':'MailAccountId','onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x40')][_0x5e5b('0x10c')](db[_0x5e5b('0x7c')],{'as':'Answers','foreignKey':_0x5e5b('0x154')});db['MailAccount']['hasMany'](db[_0x5e5b('0x46')],{'as':_0x5e5b('0x159'),'foreignKey':_0x5e5b('0x154')});db['MailAccount'][_0x5e5b('0x10c')](db[_0x5e5b('0x45')],{'as':_0x5e5b('0x15a')});db[_0x5e5b('0x40')][_0x5e5b('0x10c')](db[_0x5e5b('0x15b')],{'as':_0x5e5b('0x13f')});db[_0x5e5b('0x40')][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':'List','foreignKey':_0x5e5b('0x15c')});db['MailAccount'][_0x5e5b('0x11d')](db['Template'],{'as':_0x5e5b('0x8d'),'foreignKey':_0x5e5b('0x15d')});db[_0x5e5b('0x40')][_0x5e5b('0x11d')](db['Pause'],{'as':_0x5e5b('0x148'),'foreignKey':_0x5e5b('0x149')});db[_0x5e5b('0x40')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x139')});db[_0x5e5b('0x12f')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x33')});db[_0x5e5b('0x12f')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction']['hasMany'](db[_0x5e5b('0x46')],{'as':_0x5e5b('0x159'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x15e')});db[_0x5e5b('0x45')][_0x5e5b('0x11d')](db[_0x5e5b('0x40')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x154')});db['MailInteraction'][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':'ContactId'});db[_0x5e5b('0x45')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x160'),'foreignKey':'UserId'});db[_0x5e5b('0x45')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'through':'mail_interaction_has_tags','as':_0x5e5b('0x161')});db[_0x5e5b('0x45')][_0x5e5b('0x120')](db['Tag'],{'through':_0x5e5b('0x162'),'as':'ThroughTags'});db[_0x5e5b('0x45')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x5e5b('0x15e')});db[_0x5e5b('0x46')][_0x5e5b('0x10c')](db[_0x5e5b('0xe4')],{'as':'Attachments','onDelete':'cascade'});db['MailMessage'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x10a')});db[_0x5e5b('0x46')][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'onDelete':'cascade','as':_0x5e5b('0x152')});db[_0x5e5b('0x46')][_0x5e5b('0x11d')](db[_0x5e5b('0x45')],{'as':'Interaction','foreignKey':_0x5e5b('0x15e')});db[_0x5e5b('0x46')][_0x5e5b('0x11d')](db['MailAccount'],{'as':_0x5e5b('0x15f'),'foreignKey':'MailAccountId'});db[_0x5e5b('0x46')][_0x5e5b('0x11d')](db[_0x5e5b('0x63')],{'as':_0x5e5b('0x63'),'foreignKey':_0x5e5b('0x163')});db[_0x5e5b('0x46')][_0x5e5b('0x11d')](db[_0x5e5b('0x68')],{'as':_0x5e5b('0x68'),'foreignKey':_0x5e5b('0x164')});db[_0x5e5b('0x15b')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'onDelete':'restrict'});db['MailApplication'][_0x5e5b('0x11d')](db[_0x5e5b('0x12f')],{'onDelete':_0x5e5b('0x165')});db['MailApplication']['belongsTo'](db[_0x5e5b('0x40')],{'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0x15b')][_0x5e5b('0x11d')](db[_0x5e5b('0x147')],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x166')});db[_0x5e5b('0x15b')][_0x5e5b('0x11d')](db[_0x5e5b('0x8b')],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x167')});db['MailQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x40')],{});db['MailQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':'List','foreignKey':_0x5e5b('0x15c')});db[_0x5e5b('0x49')][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x49')]['belongsTo'](db[_0x5e5b('0x45')],{});db[_0x5e5b('0x49')][_0x5e5b('0x11d')](db[_0x5e5b('0x46')],{});db['MailQueueReport']['belongsTo'](db[_0x5e5b('0x10a')],{});db[_0x5e5b('0x49')][_0x5e5b('0x11d')](db[_0x5e5b('0x12f')],{});db[_0x5e5b('0x4b')][_0x5e5b('0x10c')](db[_0x5e5b('0x168')],{'as':'Items','onDelete':_0x5e5b('0x111')});db['FaxAccount'][_0x5e5b('0x10c')](db[_0x5e5b('0x157')],{'as':_0x5e5b('0x158'),'foreignKey':'FaxAccountId','onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x169')]['hasMany'](db['CannedAnswer'],{'as':_0x5e5b('0x16a'),'foreignKey':_0x5e5b('0x16b')});db[_0x5e5b('0x169')][_0x5e5b('0x10c')](db['FaxInteraction'],{'as':_0x5e5b('0x15a')});db[_0x5e5b('0x169')][_0x5e5b('0x10c')](db[_0x5e5b('0x4e')],{'as':_0x5e5b('0x13f')});db[_0x5e5b('0x169')][_0x5e5b('0x10c')](db[_0x5e5b('0x18')],{'as':'Exntensions','onDelete':_0x5e5b('0x111')});db['FaxAccount'][_0x5e5b('0x10c')](db[_0x5e5b('0x16c')],{'as':'Messages'});db[_0x5e5b('0x169')][_0x5e5b('0x11d')](db[_0x5e5b('0x146')],{'as':_0x5e5b('0x146')});db[_0x5e5b('0x169')][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':'List','foreignKey':_0x5e5b('0x15c')});db[_0x5e5b('0x169')]['belongsTo'](db[_0x5e5b('0x81')],{'as':_0x5e5b('0x148'),'foreignKey':_0x5e5b('0x149')});db[_0x5e5b('0x169')][_0x5e5b('0x120')](db['User'],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x16d')});db[_0x5e5b('0x4e')]['belongsTo'](db['User'],{'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0x4e')][_0x5e5b('0x11d')](db[_0x5e5b('0x52')],{'onDelete':'restrict'});db['FaxApplication'][_0x5e5b('0x11d')](db[_0x5e5b('0x169')],{'onDelete':_0x5e5b('0x165')});db['FaxApplication'][_0x5e5b('0x11d')](db[_0x5e5b('0x8b')],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x167')});db[_0x5e5b('0x116')][_0x5e5b('0x10c')](db['FaxMessage'],{'as':_0x5e5b('0x159'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x16e')});db[_0x5e5b('0x116')][_0x5e5b('0x11d')](db['FaxAccount'],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x16b')});db[_0x5e5b('0x116')][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x116')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x160'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x116')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'through':'fax_interaction_has_tags','as':_0x5e5b('0x161')});db[_0x5e5b('0x116')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'through':_0x5e5b('0x16f'),'as':_0x5e5b('0x170')});db[_0x5e5b('0x116')][_0x5e5b('0x120')](db['User'],{'as':_0x5e5b('0x171'),'through':_0x5e5b('0x128'),'foreignKey':'FaxInteractionId'});db[_0x5e5b('0x16c')]['belongsTo'](db[_0x5e5b('0x10a')],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x10a')});db[_0x5e5b('0x16c')]['belongsTo'](db[_0x5e5b('0x116')],{'as':'Interaction','foreignKey':_0x5e5b('0x16e')});db['FaxMessage']['belongsTo'](db[_0x5e5b('0x6f')],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x152')});db[_0x5e5b('0x16c')][_0x5e5b('0x11d')](db[_0x5e5b('0xe4')],{'as':_0x5e5b('0xe4'),'foreignKey':'AttachmentId'});db[_0x5e5b('0x16c')][_0x5e5b('0x11d')](db[_0x5e5b('0x169')],{'as':_0x5e5b('0x15f'),'foreignKey':'FaxAccountId'});db[_0x5e5b('0x52')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x35')});db[_0x5e5b('0x52')]['belongsToMany'](db['Team'],{'through':_0x5e5b('0x172'),'as':_0x5e5b('0x173')});db['FaxQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x169')],{});db[_0x5e5b('0x54')][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x174'),'foreignKey':_0x5e5b('0x15c')});db[_0x5e5b('0x54')][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x54')][_0x5e5b('0x11d')](db[_0x5e5b('0x116')],{});db[_0x5e5b('0x54')][_0x5e5b('0x11d')](db['FaxMessage'],{});db['FaxQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db[_0x5e5b('0x55')][_0x5e5b('0x10c')](db[_0x5e5b('0x157')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x55')][_0x5e5b('0x10c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x5e5b('0x55')][_0x5e5b('0x10c')](db[_0x5e5b('0x175')],{'as':'Messages','foreignKey':_0x5e5b('0x176')});db[_0x5e5b('0x55')]['hasMany'](db[_0x5e5b('0x58')],{'as':_0x5e5b('0x15a')});db['SmsAccount']['hasMany'](db[_0x5e5b('0x56')],{'as':'Applications'});db[_0x5e5b('0x55')]['belongsTo'](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x174'),'foreignKey':_0x5e5b('0x15c')});db['SmsAccount']['belongsTo'](db[_0x5e5b('0x81')],{'as':_0x5e5b('0x148'),'foreignKey':_0x5e5b('0x149')});db['SmsAccount'][_0x5e5b('0x120')](db['User'],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x13b')});db[_0x5e5b('0x56')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0x56')][_0x5e5b('0x11d')](db[_0x5e5b('0x5a')],{'onDelete':_0x5e5b('0x165')});db['SmsApplication'][_0x5e5b('0x11d')](db[_0x5e5b('0x55')],{'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0x56')]['belongsTo'](db[_0x5e5b('0x147')],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x166')});db['SmsApplication'][_0x5e5b('0x11d')](db[_0x5e5b('0x8b')],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x167')});db['SmsInteraction']['hasMany'](db[_0x5e5b('0x175')],{'as':_0x5e5b('0x159'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x177')});db['SmsInteraction'][_0x5e5b('0x11d')](db[_0x5e5b('0x55')],{'as':_0x5e5b('0x15f'),'foreignKey':'SmsAccountId'});db[_0x5e5b('0x58')]['belongsTo'](db['CmContact'],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x58')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':'Owner','foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x58')]['belongsToMany'](db[_0x5e5b('0x8b')],{'through':_0x5e5b('0x178'),'as':'Tags'});db[_0x5e5b('0x58')][_0x5e5b('0x120')](db['Tag'],{'through':_0x5e5b('0x178'),'as':_0x5e5b('0x170')});db[_0x5e5b('0x58')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':'Users','through':_0x5e5b('0x12a'),'foreignKey':_0x5e5b('0x177')});db[_0x5e5b('0x175')]['belongsTo'](db['User'],{'as':_0x5e5b('0x10a')});db[_0x5e5b('0x175')][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x152')});db[_0x5e5b('0x175')][_0x5e5b('0x11d')](db[_0x5e5b('0x58')],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x179'),'foreignKey':'SmsInteractionId'});db[_0x5e5b('0x175')][_0x5e5b('0x11d')](db[_0x5e5b('0x55')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x176')});db['SmsQueue'][_0x5e5b('0x120')](db['User'],{'as':'Agents','through':_0x5e5b('0x37'),'foreignKey':_0x5e5b('0x17a')});db[_0x5e5b('0x5a')]['belongsToMany'](db[_0x5e5b('0xdd')],{'through':_0x5e5b('0x17b'),'as':_0x5e5b('0x173')});db[_0x5e5b('0x5c')][_0x5e5b('0x10c')](db[_0x5e5b('0x157')],{'as':'Dispositions','foreignKey':_0x5e5b('0x17c'),'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x5c')]['hasMany'](db[_0x5e5b('0x7c')],{'as':_0x5e5b('0x16a'),'foreignKey':_0x5e5b('0x17c')});db['OpenchannelAccount'][_0x5e5b('0x10c')](db[_0x5e5b('0x60')],{'as':_0x5e5b('0x15a'),'foreignKey':_0x5e5b('0x17c')});db['OpenchannelAccount'][_0x5e5b('0x10c')](db[_0x5e5b('0x17d')],{'as':_0x5e5b('0x159'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x5e5b('0x10c')](db['OpenchannelApplication'],{'as':_0x5e5b('0x13f'),'foreignKey':_0x5e5b('0x17c')});db[_0x5e5b('0x5c')]['belongsTo'](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x174'),'foreignKey':_0x5e5b('0x15c')});db[_0x5e5b('0x5c')][_0x5e5b('0x11d')](db[_0x5e5b('0x81')],{'as':_0x5e5b('0x148'),'foreignKey':_0x5e5b('0x149')});db[_0x5e5b('0x5c')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x13a')});db[_0x5e5b('0x5e')]['belongsTo'](db[_0x5e5b('0x10a')],{'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0x5e')][_0x5e5b('0x11d')](db[_0x5e5b('0x62')],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x17e')});db[_0x5e5b('0x5e')][_0x5e5b('0x11d')](db[_0x5e5b('0x5c')],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x17c')});db[_0x5e5b('0x5e')]['belongsTo'](db['Interval'],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x166')});db[_0x5e5b('0x5e')]['belongsTo'](db[_0x5e5b('0x8b')],{'onDelete':'restrict','foreignKey':_0x5e5b('0x167')});db[_0x5e5b('0x60')]['hasMany'](db[_0x5e5b('0x17d')],{'as':'Messages','onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x5e5b('0x60')][_0x5e5b('0x11d')](db[_0x5e5b('0x5c')],{'as':_0x5e5b('0x15f'),'foreignKey':'OpenchannelAccountId'});db[_0x5e5b('0x60')]['belongsTo'](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x60')][_0x5e5b('0x11d')](db['User'],{'as':_0x5e5b('0x160'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0x60')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'through':_0x5e5b('0x17f'),'as':'Tags'});db[_0x5e5b('0x60')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'through':_0x5e5b('0x17f'),'as':'ThroughTags'});db['OpenchannelInteraction']['belongsToMany'](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x171'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x5e5b('0x17d')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'onDelete':_0x5e5b('0x111'),'as':'User'});db[_0x5e5b('0x17d')][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x152')});db[_0x5e5b('0x17d')][_0x5e5b('0x11d')](db['OpenchannelInteraction'],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x179'),'foreignKey':_0x5e5b('0x180')});db[_0x5e5b('0x17d')][_0x5e5b('0x11d')](db[_0x5e5b('0xe4')],{'as':_0x5e5b('0xe4'),'foreignKey':'AttachmentId'});db[_0x5e5b('0x17d')][_0x5e5b('0x11d')](db[_0x5e5b('0x5c')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x17c')});db[_0x5e5b('0x62')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x133'),'foreignKey':_0x5e5b('0x17e')});db[_0x5e5b('0x62')]['belongsToMany'](db[_0x5e5b('0xdd')],{'through':_0x5e5b('0x181'),'as':_0x5e5b('0x173')});db[_0x5e5b('0x63')][_0x5e5b('0x10c')](db[_0x5e5b('0x157')],{'as':_0x5e5b('0x158'),'foreignKey':_0x5e5b('0x163'),'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x63')]['hasMany'](db[_0x5e5b('0x7c')],{'as':'Answers','foreignKey':_0x5e5b('0x163')});db['ChatWebsite']['hasMany'](db[_0x5e5b('0x6c')],{'as':_0x5e5b('0x182')});db[_0x5e5b('0x63')][_0x5e5b('0x10c')](db[_0x5e5b('0x65')],{'as':'Interactions'});db['ChatWebsite'][_0x5e5b('0x10c')](db[_0x5e5b('0x183')],{'as':'Applications'});db[_0x5e5b('0x63')][_0x5e5b('0x10c')](db[_0x5e5b('0x66')],{'as':_0x5e5b('0x159')});db['ChatWebsite'][_0x5e5b('0x11d')](db['CmList'],{'as':_0x5e5b('0x174'),'foreignKey':_0x5e5b('0x15c')});db[_0x5e5b('0x63')][_0x5e5b('0x11d')](db[_0x5e5b('0x147')],{'as':'Interval','foreignKey':_0x5e5b('0x166')});db[_0x5e5b('0x63')][_0x5e5b('0x11d')](db['MailAccount'],{'as':_0x5e5b('0x40'),'foreignKey':_0x5e5b('0x154')});db['ChatWebsite'][_0x5e5b('0x11d')](db['Pause'],{'as':_0x5e5b('0x148'),'foreignKey':_0x5e5b('0x149')});db[_0x5e5b('0x63')]['belongsToMany'](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':'user_has_chat_websites'});db[_0x5e5b('0x64')][_0x5e5b('0x11d')](db['OpenchannelAccount'],{});db[_0x5e5b('0x64')][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x174'),'foreignKey':'ListId'});db[_0x5e5b('0x64')][_0x5e5b('0x11d')](db['CmContact'],{'as':_0x5e5b('0x152'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x60')],{});db[_0x5e5b('0x64')][_0x5e5b('0x11d')](db[_0x5e5b('0x17d')],{});db[_0x5e5b('0x64')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{});db[_0x5e5b('0x64')]['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication'][_0x5e5b('0x11d')](db['User'],{'as':_0x5e5b('0x184'),'foreignKey':_0x5e5b('0x10e'),'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0x183')][_0x5e5b('0x11d')](db[_0x5e5b('0x69')],{'as':_0x5e5b('0x185'),'foreignKey':_0x5e5b('0x186'),'onDelete':_0x5e5b('0x165')});db['ChatApplication'][_0x5e5b('0x11d')](db[_0x5e5b('0x63')],{'as':_0x5e5b('0x187'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x5e5b('0x183')][_0x5e5b('0x11d')](db[_0x5e5b('0x8b')],{'onDelete':_0x5e5b('0x165'),'foreignKey':_0x5e5b('0x167')});db['ChatInteraction'][_0x5e5b('0x10c')](db[_0x5e5b('0x66')],{'as':_0x5e5b('0x159'),'onDelete':'cascade','foreignKey':_0x5e5b('0x188')});db[_0x5e5b('0x65')][_0x5e5b('0x11d')](db['ChatWebsite'],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x163')});db['ChatInteraction']['belongsTo'](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db['ChatInteraction'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':'Owner','foreignKey':'UserId'});db[_0x5e5b('0x65')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'through':_0x5e5b('0x189'),'as':_0x5e5b('0x161')});db['ChatInteraction'][_0x5e5b('0x120')](db['Tag'],{'through':_0x5e5b('0x189'),'as':'ThroughTags'});db[_0x5e5b('0x65')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x171'),'through':_0x5e5b('0x127'),'foreignKey':_0x5e5b('0x188')});db['ChatMessage'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x10a')});db[_0x5e5b('0x66')][_0x5e5b('0x11d')](db['CmContact'],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x66')]['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':_0x5e5b('0x179'),'foreignKey':'ChatInteractionId'});db[_0x5e5b('0x66')][_0x5e5b('0x11d')](db[_0x5e5b('0xe4')],{'as':'Attachment','foreignKey':_0x5e5b('0x18a')});db['ChatMessage'][_0x5e5b('0x11d')](db[_0x5e5b('0x63')],{'as':'Account','foreignKey':_0x5e5b('0x163')});db[_0x5e5b('0x68')][_0x5e5b('0x10c')](db[_0x5e5b('0xe4')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x5e5b('0x111'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0x5e5b('0x6f')],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x68')][_0x5e5b('0x11d')](db[_0x5e5b('0x63')],{'as':'Account','foreignKey':_0x5e5b('0x163')});db[_0x5e5b('0x69')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x18b'),'hooks':!![]});db[_0x5e5b('0x69')][_0x5e5b('0x120')](db[_0x5e5b('0xdd')],{'through':_0x5e5b('0x18c'),'as':_0x5e5b('0x173')});db[_0x5e5b('0x121')][_0x5e5b('0x10c')](db[_0x5e5b('0xca')],{'as':_0x5e5b('0x159'),'foreignKey':_0x5e5b('0x18d'),'onDelete':_0x5e5b('0x111')});db['ChatGroup'][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':'Members','through':_0x5e5b('0x123')});db[_0x5e5b('0x6c')][_0x5e5b('0x11d')](db[_0x5e5b('0x63')],{'as':_0x5e5b('0x187'),'foreignKey':_0x5e5b('0x163')});db[_0x5e5b('0x6e')][_0x5e5b('0x10c')](db['CmContact'],{'as':_0x5e5b('0x18e'),'foreignKey':'CompanyId'});db['CmContact'][_0x5e5b('0x10c')](db[_0x5e5b('0x71')],{'as':_0x5e5b('0x143'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x6f')][_0x5e5b('0x10c')](db[_0x5e5b('0x74')],{'as':_0x5e5b('0x112'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x6f')][_0x5e5b('0x10c')](db[_0x5e5b('0x75')],{'as':'HopperHistories','foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x6f')][_0x5e5b('0x10c')](db[_0x5e5b('0x77')],{'as':_0x5e5b('0x77'),'foreignKey':'ContactId'});db[_0x5e5b('0x6f')]['hasMany'](db[_0x5e5b('0xce')],{'as':_0x5e5b('0x145'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x6f')][_0x5e5b('0x10c')](db[_0x5e5b('0x60')],{'as':_0x5e5b('0x114'),'foreignKey':_0x5e5b('0x153'),'onDelete':'restrict'});db[_0x5e5b('0x6f')][_0x5e5b('0x10c')](db['ChatInteraction'],{'as':_0x5e5b('0x115'),'foreignKey':_0x5e5b('0x153'),'onDelete':'restrict'});db['CmContact'][_0x5e5b('0x10c')](db['SmsInteraction'],{'as':_0x5e5b('0x129'),'foreignKey':_0x5e5b('0x153'),'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0x6f')][_0x5e5b('0x10c')](db[_0x5e5b('0x116')],{'as':'FaxInteractions','foreignKey':_0x5e5b('0x153'),'onDelete':'restrict'});db[_0x5e5b('0x6f')][_0x5e5b('0x10c')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x5e5b('0x6f')][_0x5e5b('0x11d')](db[_0x5e5b('0x6e')],{'as':_0x5e5b('0x18f'),'foreignKey':_0x5e5b('0x190')});db[_0x5e5b('0x6f')][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x174'),'foreignKey':'ListId','onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x6f')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x171'),'through':_0x5e5b('0x191')});db[_0x5e5b('0x6f')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'as':'Tags','through':_0x5e5b('0x192')});db['CmContact']['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':_0x5e5b('0x170')});db['CmHopper']['belongsTo'](db[_0x5e5b('0x6f')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x71')]['belongsTo'](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x174'),'foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x184'),'foreignKey':'UserId'});db[_0x5e5b('0x71')][_0x5e5b('0x11d')](db[_0x5e5b('0x1c')],{'as':_0x5e5b('0x185'),'foreignKey':_0x5e5b('0x142'),'onDelete':'cascade'});db['CmHopper'][_0x5e5b('0x11d')](db[_0x5e5b('0x193')],{'as':_0x5e5b('0x193'),'foreignKey':_0x5e5b('0x194'),'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x71')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x160'),'foreignKey':_0x5e5b('0x195')});db['CmHopperBlack'][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':'ContactId','onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x73')][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':'List','foreignKey':_0x5e5b('0x15c'),'onDelete':'cascade'});db[_0x5e5b('0x73')]['belongsTo'](db[_0x5e5b('0x1c')],{'as':_0x5e5b('0x185'),'foreignKey':_0x5e5b('0x142'),'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x73')][_0x5e5b('0x11d')](db['Campaign'],{'as':_0x5e5b('0x193'),'foreignKey':_0x5e5b('0x194'),'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0x7a')][_0x5e5b('0x10c')](db[_0x5e5b('0x7f')],{'as':{'plural':'All','singular':_0x5e5b('0x196')},'foreignKey':_0x5e5b('0x197'),'onDelete':'cascade','hooks':!![]});db[_0x5e5b('0x7a')][_0x5e5b('0x10c')](db[_0x5e5b('0x7f')],{'as':{'plural':_0x5e5b('0x198'),'singular':'OneAny'},'foreignKey':_0x5e5b('0x199'),'onDelete':_0x5e5b('0x111'),'hooks':!![]});db[_0x5e5b('0x7a')][_0x5e5b('0x10c')](db['Action'],{'as':'Actions','foreignKey':_0x5e5b('0x19a'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x5e5b('0x10c')](db['Disposition'],{'as':_0x5e5b('0x158'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0x5e5b('0x147')][_0x5e5b('0x10c')](db['Interval'],{'as':_0x5e5b('0x19b'),'foreignKey':_0x5e5b('0x166'),'onDelete':_0x5e5b('0x111'),'hooks':!![],'required':![]});db[_0x5e5b('0x147')][_0x5e5b('0x10c')](db[_0x5e5b('0x18')],{'as':_0x5e5b('0x19c'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x5e5b('0x147')][_0x5e5b('0x10c')](db[_0x5e5b('0x15b')],{'as':_0x5e5b('0x19d'),'foreignKey':_0x5e5b('0x166')});db[_0x5e5b('0x147')]['hasMany'](db[_0x5e5b('0x183')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x5e5b('0x147')][_0x5e5b('0x10c')](db['FaxApplication'],{'as':_0x5e5b('0x19e'),'foreignKey':_0x5e5b('0x166')});db[_0x5e5b('0x147')][_0x5e5b('0x10c')](db[_0x5e5b('0x56')],{'as':_0x5e5b('0x19f'),'foreignKey':_0x5e5b('0x166')});db[_0x5e5b('0x87')][_0x5e5b('0x11d')](db['MailAccount'],{});db[_0x5e5b('0x87')][_0x5e5b('0x11d')](db[_0x5e5b('0x96')],{'foreignKey':_0x5e5b('0x1a0')});db[_0x5e5b('0x87')][_0x5e5b('0x11d')](db[_0x5e5b('0x94')],{'foreignKey':_0x5e5b('0x1a1')});db[_0x5e5b('0x89')]['belongsToMany'](db[_0x5e5b('0x1a')],{'as':'Mohs','through':_0x5e5b('0x140'),'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0x8b')][_0x5e5b('0x120')](db[_0x5e5b('0x6f')],{'through':_0x5e5b('0x192')});db['Tag'][_0x5e5b('0x120')](db[_0x5e5b('0x65')],{'through':_0x5e5b('0x189')});db[_0x5e5b('0x8b')][_0x5e5b('0x120')](db[_0x5e5b('0x45')],{'through':_0x5e5b('0x162')});db[_0x5e5b('0x8b')][_0x5e5b('0x120')](db[_0x5e5b('0x58')],{'through':'sms_interaction_has_tags'});db[_0x5e5b('0x8b')][_0x5e5b('0x120')](db[_0x5e5b('0x116')],{'through':_0x5e5b('0x16f')});db[_0x5e5b('0x8b')][_0x5e5b('0x120')](db[_0x5e5b('0x60')],{'through':'openchannel_interaction_has_tags'});db[_0x5e5b('0x8b')]['belongsToMany'](db[_0x5e5b('0xfa')],{'through':'whatsapp_interaction_has_tags'});db[_0x5e5b('0x1a2')][_0x5e5b('0x10c')](db[_0x5e5b('0x7f')],{'as':{'plural':'AllConditions','singular':_0x5e5b('0x1a3')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x5e5b('0x1a2')]['hasMany'](db[_0x5e5b('0x7f')],{'as':{'plural':_0x5e5b('0x1a4'),'singular':_0x5e5b('0x1a5')},'foreignKey':_0x5e5b('0x1a6'),'onDelete':_0x5e5b('0x111'),'hooks':!![]});db[_0x5e5b('0x1a2')]['hasMany'](db[_0x5e5b('0x1a7')],{'as':'Actions','foreignKey':_0x5e5b('0x1a8'),'onDelete':_0x5e5b('0x111'),'hooks':!![]});db[_0x5e5b('0x94')][_0x5e5b('0x10c')](db[_0x5e5b('0x1a9')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x5e5b('0x96')][_0x5e5b('0x10c')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1a0')});db[_0x5e5b('0x98')][_0x5e5b('0x10c')](db[_0x5e5b('0x1a9')],{'as':_0x5e5b('0x1aa'),'onDelete':_0x5e5b('0x111'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x5e5b('0x11d')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x5e5b('0x9b')][_0x5e5b('0x10c')](db['SalesforceConfiguration'],{'as':_0x5e5b('0x1ab'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0x9c')][_0x5e5b('0x10c')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0x9c')][_0x5e5b('0x10c')](db[_0x5e5b('0x1ae')],{'as':_0x5e5b('0x1af'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0x9c')][_0x5e5b('0x10c')](db[_0x5e5b('0x1ae')],{'as':_0x5e5b('0x1aa'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0x9c')][_0x5e5b('0x11d')](db[_0x5e5b('0x9b')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0x1ae')]['hasMany'](db['SalesforceField'],{'as':_0x5e5b('0x1b2'),'foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0x1ae')]['hasMany'](db['SalesforceField'],{'as':_0x5e5b('0x1b3'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0x1ae')][_0x5e5b('0x10c')](db[_0x5e5b('0x1ae')],{'as':_0x5e5b('0x1b4'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0x1ae')][_0x5e5b('0x11d')](db[_0x5e5b('0x90')],{'as':_0x5e5b('0x90'),'foreignKey':_0x5e5b('0x1b5')});db[_0x5e5b('0x9f')]['hasMany'](db[_0x5e5b('0xa0')],{'as':_0x5e5b('0x1ab'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xa0')][_0x5e5b('0x10c')](db[_0x5e5b('0xa1')],{'as':_0x5e5b('0x1b6'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xa0')][_0x5e5b('0x10c')](db[_0x5e5b('0xa1')],{'as':_0x5e5b('0x1af'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0xa0')][_0x5e5b('0x10c')](db['SugarcrmField'],{'as':_0x5e5b('0x1aa'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xa0')]['belongsTo'](db[_0x5e5b('0x9f')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xa1')][_0x5e5b('0x10c')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xa1')][_0x5e5b('0x10c')](db[_0x5e5b('0xa1')],{'as':_0x5e5b('0x1b3'),'foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db[_0x5e5b('0xa1')],{'as':_0x5e5b('0x1b4'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xa1')][_0x5e5b('0x11d')](db[_0x5e5b('0x90')],{'as':_0x5e5b('0x90'),'foreignKey':'VariableId'});db['DeskAccount'][_0x5e5b('0x10c')](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x5e5b('0xa5')][_0x5e5b('0x10c')](db[_0x5e5b('0xa6')],{'as':_0x5e5b('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x5e5b('0xa5')][_0x5e5b('0x10c')](db['DeskField'],{'as':_0x5e5b('0x1af'),'onDelete':_0x5e5b('0x111'),'foreignKey':'DescriptionId'});db[_0x5e5b('0xa5')][_0x5e5b('0x10c')](db[_0x5e5b('0xa6')],{'as':_0x5e5b('0x1aa'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1b1')});db['DeskConfiguration'][_0x5e5b('0x11d')](db[_0x5e5b('0xa3')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xa5')][_0x5e5b('0x120')](db['Tag'],{'through':_0x5e5b('0x1b7')});db['DeskField'][_0x5e5b('0x10c')](db[_0x5e5b('0xa6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x5e5b('0xa6')]['hasMany'](db[_0x5e5b('0xa6')],{'as':_0x5e5b('0x1b3'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0xa6')][_0x5e5b('0x10c')](db[_0x5e5b('0xa6')],{'as':_0x5e5b('0x1b4'),'foreignKey':'FieldId'});db[_0x5e5b('0xa6')][_0x5e5b('0x11d')](db[_0x5e5b('0x90')],{'as':'Variable','foreignKey':_0x5e5b('0x1b5')});db[_0x5e5b('0xa7')][_0x5e5b('0x10c')](db['ZohoConfiguration'],{'as':_0x5e5b('0x1ab'),'onDelete':'cascade','foreignKey':_0x5e5b('0x1ac')});db['ZohoConfiguration']['hasMany'](db[_0x5e5b('0xa9')],{'as':_0x5e5b('0x1b6'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xa8')]['hasMany'](db[_0x5e5b('0xa9')],{'as':_0x5e5b('0x1af'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0xa8')][_0x5e5b('0x10c')](db[_0x5e5b('0xa9')],{'as':_0x5e5b('0x1aa'),'onDelete':'cascade','foreignKey':_0x5e5b('0x1b1')});db['ZohoConfiguration'][_0x5e5b('0x11d')](db[_0x5e5b('0xa7')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xa9')][_0x5e5b('0x10c')](db[_0x5e5b('0xa9')],{'as':_0x5e5b('0x1b2'),'foreignKey':_0x5e5b('0x1ad')});db['ZohoField'][_0x5e5b('0x10c')](db[_0x5e5b('0xa9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5e5b('0xa9')][_0x5e5b('0x10c')](db['ZohoField'],{'as':_0x5e5b('0x1b4'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xa9')][_0x5e5b('0x11d')](db['Variable'],{'as':_0x5e5b('0x90'),'foreignKey':_0x5e5b('0x1b5')});db[_0x5e5b('0xab')][_0x5e5b('0x10c')](db['ZendeskConfiguration'],{'as':_0x5e5b('0x1ab'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ac')});db['ZendeskConfiguration'][_0x5e5b('0x10c')](db[_0x5e5b('0xae')],{'as':'Subjects','foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xad')][_0x5e5b('0x10c')](db[_0x5e5b('0xae')],{'as':_0x5e5b('0x1af'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0xad')][_0x5e5b('0x10c')](db[_0x5e5b('0xae')],{'as':'Fields','foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xad')][_0x5e5b('0x11d')](db[_0x5e5b('0xab')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xad')]['belongsToMany'](db[_0x5e5b('0x8b')],{'through':_0x5e5b('0x1b8')});db[_0x5e5b('0xae')][_0x5e5b('0x10c')](db[_0x5e5b('0xae')],{'as':'Subject','foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xae')][_0x5e5b('0x10c')](db['ZendeskField'],{'as':_0x5e5b('0x1b3'),'foreignKey':'DescriptionId'});db[_0x5e5b('0xae')][_0x5e5b('0x10c')](db[_0x5e5b('0xae')],{'as':_0x5e5b('0x1b4'),'foreignKey':_0x5e5b('0x1b1')});db['ZendeskField']['belongsTo'](db['Variable'],{'as':_0x5e5b('0x90'),'foreignKey':_0x5e5b('0x1b5')});db[_0x5e5b('0xb0')]['hasMany'](db[_0x5e5b('0xb2')],{'as':_0x5e5b('0x1ab'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x5e5b('0x10c')](db[_0x5e5b('0x1b9')],{'as':_0x5e5b('0x1b6'),'onDelete':'cascade','foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xb2')]['hasMany'](db[_0x5e5b('0x1b9')],{'as':'Descriptions','onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0xb2')][_0x5e5b('0x10c')](db[_0x5e5b('0x1b9')],{'as':_0x5e5b('0x1aa'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xb2')][_0x5e5b('0x11d')](db[_0x5e5b('0xb0')],{'as':'Account','foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xb2')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'through':_0x5e5b('0x1ba')});db[_0x5e5b('0x1b9')]['hasMany'](db[_0x5e5b('0x1b9')],{'as':_0x5e5b('0x1b2'),'foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0x1b9')][_0x5e5b('0x10c')](db['FreshdeskField'],{'as':_0x5e5b('0x1b3'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0x1b9')]['hasMany'](db[_0x5e5b('0x1b9')],{'as':_0x5e5b('0x1b4'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0x1b9')][_0x5e5b('0x11d')](db[_0x5e5b('0x90')],{'as':_0x5e5b('0x90'),'foreignKey':'VariableId'});db[_0x5e5b('0xb5')][_0x5e5b('0x10c')](db[_0x5e5b('0xb7')],{'as':'Configurations','onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xb7')][_0x5e5b('0x10c')](db[_0x5e5b('0xb9')],{'as':_0x5e5b('0x1b6'),'foreignKey':'SubjectId'});db[_0x5e5b('0xb7')][_0x5e5b('0x10c')](db[_0x5e5b('0xb9')],{'as':'Descriptions','foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0xb7')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':_0x5e5b('0x1b1')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xb9')][_0x5e5b('0x10c')](db['VtigerField'],{'as':'Subject','foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xb9')]['hasMany'](db[_0x5e5b('0xb9')],{'as':_0x5e5b('0x1b3'),'foreignKey':'DescriptionId'});db[_0x5e5b('0xb9')]['hasMany'](db[_0x5e5b('0xb9')],{'as':_0x5e5b('0x1b4'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xb9')][_0x5e5b('0x11d')](db[_0x5e5b('0x90')],{'as':_0x5e5b('0x90'),'foreignKey':_0x5e5b('0x1b5')});db[_0x5e5b('0xbb')][_0x5e5b('0x10c')](db[_0x5e5b('0x1bb')],{'as':_0x5e5b('0x1ab'),'onDelete':_0x5e5b('0x111'),'foreignKey':'AccountId'});db[_0x5e5b('0x1bb')][_0x5e5b('0x10c')](db[_0x5e5b('0xbd')],{'as':'Subjects','foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0x1bb')][_0x5e5b('0x10c')](db[_0x5e5b('0xbd')],{'as':_0x5e5b('0x1af'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0x1bb')][_0x5e5b('0x10c')](db[_0x5e5b('0xbd')],{'as':_0x5e5b('0x1aa'),'foreignKey':_0x5e5b('0x1b1')});db['ServicenowConfiguration'][_0x5e5b('0x11d')](db[_0x5e5b('0xbb')],{'as':_0x5e5b('0x15f'),'foreignKey':'AccountId'});db[_0x5e5b('0xbd')][_0x5e5b('0x10c')](db[_0x5e5b('0xbd')],{'as':_0x5e5b('0x1b2'),'foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xbd')][_0x5e5b('0x10c')](db[_0x5e5b('0xbd')],{'as':_0x5e5b('0x1b3'),'foreignKey':_0x5e5b('0x1b0')});db['ServicenowField'][_0x5e5b('0x10c')](db[_0x5e5b('0xbd')],{'as':_0x5e5b('0x1b4'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xbd')][_0x5e5b('0x11d')](db[_0x5e5b('0x90')],{'as':_0x5e5b('0x90'),'foreignKey':_0x5e5b('0x1b5')});db['Dynamics365Account']['hasMany'](db[_0x5e5b('0xbf')],{'as':_0x5e5b('0x1ab'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0xbf')][_0x5e5b('0x10c')](db['Dynamics365Field'],{'as':_0x5e5b('0x1b6'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1ad')});db[_0x5e5b('0xbf')][_0x5e5b('0x10c')](db[_0x5e5b('0xc1')],{'as':_0x5e5b('0x1af'),'onDelete':_0x5e5b('0x111'),'foreignKey':'DescriptionId'});db[_0x5e5b('0xbf')][_0x5e5b('0x10c')](db[_0x5e5b('0xc1')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x5e5b('0xbf')]['belongsTo'](db['Dynamics365Account'],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x1ac')});db['Dynamics365Field'][_0x5e5b('0x10c')](db[_0x5e5b('0xc1')],{'as':_0x5e5b('0x1b2'),'foreignKey':'SubjectId'});db[_0x5e5b('0xc1')][_0x5e5b('0x10c')](db['Dynamics365Field'],{'as':_0x5e5b('0x1b3'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0xc1')][_0x5e5b('0x10c')](db['Dynamics365Field'],{'as':_0x5e5b('0x1b4'),'foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xc1')][_0x5e5b('0x11d')](db[_0x5e5b('0x90')],{'as':_0x5e5b('0x90'),'foreignKey':_0x5e5b('0x1b5')});db[_0x5e5b('0x1bc')][_0x5e5b('0x10c')](db['FreshsalesConfiguration'],{'as':_0x5e5b('0x1ab'),'onDelete':_0x5e5b('0x111'),'foreignKey':'AccountId'});db[_0x5e5b('0xc4')]['hasMany'](db[_0x5e5b('0x1bd')],{'as':_0x5e5b('0x1b6'),'foreignKey':'SubjectId'});db[_0x5e5b('0xc4')][_0x5e5b('0x10c')](db[_0x5e5b('0x1bd')],{'as':_0x5e5b('0x1af'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0xc4')]['hasMany'](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x5e5b('0x1b1')});db[_0x5e5b('0xc4')]['belongsTo'](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x5e5b('0x1ac')});db[_0x5e5b('0x1bd')][_0x5e5b('0x10c')](db[_0x5e5b('0x1bd')],{'as':_0x5e5b('0x1b2'),'foreignKey':'SubjectId'});db[_0x5e5b('0x1bd')][_0x5e5b('0x10c')](db['FreshsalesField'],{'as':_0x5e5b('0x1b3'),'foreignKey':_0x5e5b('0x1b0')});db[_0x5e5b('0x1bd')][_0x5e5b('0x10c')](db[_0x5e5b('0x1bd')],{'as':_0x5e5b('0x1b4'),'foreignKey':'FieldId'});db[_0x5e5b('0x1bd')][_0x5e5b('0x11d')](db[_0x5e5b('0x90')],{'as':_0x5e5b('0x90'),'foreignKey':_0x5e5b('0x1b5')});db['ChatQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x63')],{});db[_0x5e5b('0x1be')][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x174'),'foreignKey':_0x5e5b('0x15c')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x1be')]['belongsTo'](db[_0x5e5b('0x65')],{});db[_0x5e5b('0x1be')]['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{});db['ChatQueueReport']['belongsTo'](db[_0x5e5b('0x69')],{});db['ChatInternalMessage'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'onDelete':'cascade','foreignKey':_0x5e5b('0x1bf')});db['ChatInternalMessage'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'onDelete':_0x5e5b('0x111'),'foreignKey':'ToId'});db[_0x5e5b('0xce')][_0x5e5b('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':_0x5e5b('0x1c0'),'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0xce')][_0x5e5b('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':_0x5e5b('0x1c0'),'onDelete':'cascade'});db[_0x5e5b('0x1c1')][_0x5e5b('0x11d')](db['SmsAccount'],{});db[_0x5e5b('0x1c1')][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':'List','foreignKey':'ListId'});db[_0x5e5b('0x1c1')][_0x5e5b('0x11d')](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db[_0x5e5b('0x1c1')][_0x5e5b('0x11d')](db[_0x5e5b('0x58')],{});db[_0x5e5b('0x1c1')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport']['belongsTo'](db[_0x5e5b('0x10a')],{});db[_0x5e5b('0x1c1')][_0x5e5b('0x11d')](db[_0x5e5b('0x5a')],{});db[_0x5e5b('0xd3')][_0x5e5b('0x10c')](db[_0x5e5b('0xce')],{'foreignKey':_0x5e5b('0x1c2')});db['JscriptyProject']['hasMany'](db[_0x5e5b('0xcd')],{'foreignKey':_0x5e5b('0x1c2')});db['JscriptyProject'][_0x5e5b('0x10c')](db[_0x5e5b('0xcb')],{'foreignKey':_0x5e5b('0x1c2')});db[_0x5e5b('0xd8')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':'Users','through':_0x5e5b('0x13e')});db[_0x5e5b('0xdd')]['belongsToMany'](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x125')});db[_0x5e5b('0xdd')][_0x5e5b('0x120')](db[_0x5e5b('0x1c')],{'through':_0x5e5b('0x105'),'as':'VoiceQueues'});db[_0x5e5b('0xdd')][_0x5e5b('0x120')](db[_0x5e5b('0x12f')],{'through':_0x5e5b('0x1c3'),'as':_0x5e5b('0x130')});db[_0x5e5b('0xdd')][_0x5e5b('0x120')](db[_0x5e5b('0x69')],{'through':'team_has_chat_queues','as':_0x5e5b('0x1c4')});db['Team']['belongsToMany'](db[_0x5e5b('0x52')],{'through':_0x5e5b('0x172'),'as':'FaxQueues'});db[_0x5e5b('0xdd')][_0x5e5b('0x120')](db[_0x5e5b('0x5a')],{'through':_0x5e5b('0x17b'),'as':'SmsQueues'});db['Team']['belongsToMany'](db[_0x5e5b('0x62')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x5e5b('0xdd')][_0x5e5b('0x120')](db[_0x5e5b('0x101')],{'through':_0x5e5b('0x1c5'),'as':_0x5e5b('0x134')});db['Team'][_0x5e5b('0x120')](db[_0x5e5b('0xee')],{'through':'TeamVoicePrefix','as':_0x5e5b('0x12e')});db['Campaign']['hasMany'](db[_0x5e5b('0x71')],{'as':'Hoppers','foreignKey':_0x5e5b('0x194')});db[_0x5e5b('0x193')][_0x5e5b('0x10c')](db['CmHopperFinal'],{'as':_0x5e5b('0x112'),'foreignKey':_0x5e5b('0x194')});db[_0x5e5b('0x193')][_0x5e5b('0x10c')](db[_0x5e5b('0x75')],{'as':_0x5e5b('0x1c6'),'foreignKey':_0x5e5b('0x194')});db['Campaign'][_0x5e5b('0x10c')](db[_0x5e5b('0x73')],{'as':'HopperBlacks','foreignKey':_0x5e5b('0x194')});db['Campaign'][_0x5e5b('0x11d')](db[_0x5e5b('0x146')],{'as':'Trunk','foreignKey':_0x5e5b('0x1c7')});db[_0x5e5b('0x193')]['belongsTo'](db[_0x5e5b('0x146')],{'as':'TrunkBackup','foreignKey':_0x5e5b('0x1c8')});db[_0x5e5b('0x193')][_0x5e5b('0x11d')](db[_0x5e5b('0x147')],{'as':'Interval','foreignKey':_0x5e5b('0x166')});db['Campaign'][_0x5e5b('0x11d')](db[_0x5e5b('0xd8')],{'as':_0x5e5b('0xd8'),'foreignKey':_0x5e5b('0x1c9')});db['Campaign'][_0x5e5b('0x120')](db[_0x5e5b('0x14a')],{'as':_0x5e5b('0x124'),'through':_0x5e5b('0x1ca')});db[_0x5e5b('0x193')]['belongsToMany'](db['CmList'],{'as':_0x5e5b('0x14d'),'through':'campaigns_has_cm_blacklists'});db[_0x5e5b('0xe4')][_0x5e5b('0x11d')](db[_0x5e5b('0x68')],{'as':_0x5e5b('0x68'),'foreignKey':_0x5e5b('0x164')});db[_0x5e5b('0x1cb')][_0x5e5b('0x11d')](db[_0x5e5b('0x46')],{});db[_0x5e5b('0x1cb')][_0x5e5b('0x11d')](db[_0x5e5b('0x45')],{});db[_0x5e5b('0x1cb')][_0x5e5b('0x11d')](db[_0x5e5b('0x40')],{'foreignKey':_0x5e5b('0x1cc'),'as':_0x5e5b('0x1cd')});db[_0x5e5b('0x1cb')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1ce'),'as':_0x5e5b('0x1cf')});db[_0x5e5b('0x1cb')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1d0'),'as':_0x5e5b('0x1d1')});db['MailTransferReport'][_0x5e5b('0x11d')](db['MailQueue'],{'foreignKey':_0x5e5b('0x1d2'),'as':_0x5e5b('0x1d3')});db[_0x5e5b('0x1cb')][_0x5e5b('0x11d')](db['MailAccount'],{'foreignKey':_0x5e5b('0x1d4'),'as':_0x5e5b('0x1d5')});db['ChatTransferReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x66')],{});db[_0x5e5b('0xe7')][_0x5e5b('0x11d')](db[_0x5e5b('0x65')],{});db['ChatTransferReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x63')],{'foreignKey':_0x5e5b('0x1d6'),'as':'FromAccount'});db[_0x5e5b('0xe7')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1ce'),'as':'FromAgent'});db[_0x5e5b('0xe7')]['belongsTo'](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1d0'),'as':_0x5e5b('0x1d1')});db[_0x5e5b('0xe7')]['belongsTo'](db[_0x5e5b('0x69')],{'foreignKey':_0x5e5b('0x1d7'),'as':_0x5e5b('0x1d3')});db['ChatTransferReport']['belongsTo'](db[_0x5e5b('0x63')],{'foreignKey':'ToChatWebsiteId','as':_0x5e5b('0x1d5')});db[_0x5e5b('0x1d8')][_0x5e5b('0x11d')](db[_0x5e5b('0x16c')],{});db['FaxTransferReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x116')],{});db[_0x5e5b('0x1d8')][_0x5e5b('0x11d')](db[_0x5e5b('0x169')],{'foreignKey':_0x5e5b('0x1d9'),'as':_0x5e5b('0x1cd')});db[_0x5e5b('0x1d8')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1ce'),'as':_0x5e5b('0x1cf')});db[_0x5e5b('0x1d8')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1d0'),'as':'ToAgent'});db[_0x5e5b('0x1d8')][_0x5e5b('0x11d')](db[_0x5e5b('0x52')],{'foreignKey':_0x5e5b('0x1da'),'as':_0x5e5b('0x1d3')});db[_0x5e5b('0x1d8')][_0x5e5b('0x11d')](db['FaxAccount'],{'foreignKey':_0x5e5b('0x1db'),'as':_0x5e5b('0x1d5')});db['OpenchannelTransferReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x17d')],{});db[_0x5e5b('0xe9')]['belongsTo'](db[_0x5e5b('0x60')],{});db[_0x5e5b('0xe9')]['belongsTo'](db[_0x5e5b('0x5c')],{'foreignKey':_0x5e5b('0x1dc'),'as':_0x5e5b('0x1cd')});db[_0x5e5b('0xe9')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':'FromUserId','as':_0x5e5b('0x1cf')});db[_0x5e5b('0xe9')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1d0'),'as':'ToAgent'});db[_0x5e5b('0xe9')]['belongsTo'](db[_0x5e5b('0x62')],{'foreignKey':_0x5e5b('0x1dd'),'as':'ToQueue'});db[_0x5e5b('0xe9')][_0x5e5b('0x11d')](db['OpenchannelAccount'],{'foreignKey':_0x5e5b('0x1de'),'as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x5e5b('0x175')],{});db[_0x5e5b('0xeb')]['belongsTo'](db[_0x5e5b('0x58')],{});db[_0x5e5b('0xeb')][_0x5e5b('0x11d')](db[_0x5e5b('0x55')],{'foreignKey':_0x5e5b('0x1df'),'as':_0x5e5b('0x1cd')});db[_0x5e5b('0xeb')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1ce'),'as':_0x5e5b('0x1cf')});db[_0x5e5b('0xeb')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1d0'),'as':'ToAgent'});db[_0x5e5b('0xeb')][_0x5e5b('0x11d')](db[_0x5e5b('0x5a')],{'foreignKey':_0x5e5b('0x1e0'),'as':_0x5e5b('0x1d3')});db[_0x5e5b('0xeb')]['belongsTo'](db[_0x5e5b('0x55')],{'foreignKey':'ToSmsAccountId','as':_0x5e5b('0x1d5')});db[_0x5e5b('0x14a')][_0x5e5b('0x10c')](db[_0x5e5b('0x157')],{'as':'Dispositions','foreignKey':_0x5e5b('0x15c'),'onDelete':'cascade'});db['CmList'][_0x5e5b('0x10c')](db['CmCustomField'],{'as':_0x5e5b('0x1e1'),'foreignKey':'ListId'});db[_0x5e5b('0x14a')][_0x5e5b('0x10c')](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x18e'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x15c')});db[_0x5e5b('0x14a')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x5e5b('0x15c')});db[_0x5e5b('0x14a')][_0x5e5b('0x10c')](db[_0x5e5b('0x75')],{'as':_0x5e5b('0x113'),'foreignKey':_0x5e5b('0x15c')});db[_0x5e5b('0x14a')][_0x5e5b('0x10c')](db[_0x5e5b('0x77')],{'as':_0x5e5b('0x77'),'foreignKey':'ListId'});db['CmList']['belongsToMany'](db[_0x5e5b('0x1c')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x5e5b('0x14a')][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x135')});db[_0x5e5b('0xee')][_0x5e5b('0x10c')](db[_0x5e5b('0x18')],{'as':_0x5e5b('0x19c'),'onDelete':_0x5e5b('0x111')});db['VoicePrefix'][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':'Agents','through':_0x5e5b('0x108')});db[_0x5e5b('0xee')]['belongsToMany'](db[_0x5e5b('0xdd')],{'through':_0x5e5b('0x107'),'as':'Teams'});db[_0x5e5b('0x11e')][_0x5e5b('0x10c')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x171'),'foreignKey':_0x5e5b('0x11f')});db[_0x5e5b('0x11e')][_0x5e5b('0x10c')](db[_0x5e5b('0xf1')],{'as':_0x5e5b('0x1e2'),'foreignKey':_0x5e5b('0x11f'),'onDelete':_0x5e5b('0x111')});db[_0x5e5b('0xf1')]['hasMany'](db[_0x5e5b('0xf3')],{'as':_0x5e5b('0x1e3'),'foreignKey':'sectionId','onDelete':_0x5e5b('0x111')});db['WhatsappAccount'][_0x5e5b('0x10c')](db[_0x5e5b('0x157')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x5e5b('0x111')});db[_0x5e5b('0xf6')]['hasMany'](db[_0x5e5b('0x7c')],{'as':'Answers','foreignKey':_0x5e5b('0x1e4')});db[_0x5e5b('0xf6')][_0x5e5b('0x10c')](db[_0x5e5b('0xfc')],{'as':_0x5e5b('0x159'),'foreignKey':'WhatsappAccountId'});db[_0x5e5b('0xf6')][_0x5e5b('0x10c')](db[_0x5e5b('0xfa')],{'as':'Interactions'});db[_0x5e5b('0xf6')][_0x5e5b('0x10c')](db[_0x5e5b('0xf8')],{'as':'Applications'});db[_0x5e5b('0xf6')][_0x5e5b('0x11d')](db['CmList'],{'as':_0x5e5b('0x174'),'foreignKey':_0x5e5b('0x15c')});db['WhatsappAccount'][_0x5e5b('0x11d')](db[_0x5e5b('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x5e5b('0x149')});db['WhatsappAccount'][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x5e5b('0x11d')](db[_0x5e5b('0x101')],{'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0xf8')][_0x5e5b('0x11d')](db['WhatsappAccount'],{'onDelete':_0x5e5b('0x165')});db[_0x5e5b('0xf8')][_0x5e5b('0x11d')](db[_0x5e5b('0x147')],{'onDelete':_0x5e5b('0x165'),'foreignKey':'IntervalId'});db[_0x5e5b('0xf8')][_0x5e5b('0x11d')](db[_0x5e5b('0x8b')],{'onDelete':_0x5e5b('0x165'),'foreignKey':'TagId'});db[_0x5e5b('0xfa')][_0x5e5b('0x10c')](db[_0x5e5b('0xfc')],{'as':_0x5e5b('0x159'),'onDelete':_0x5e5b('0x111'),'foreignKey':_0x5e5b('0x1e5')});db[_0x5e5b('0xfa')][_0x5e5b('0x11d')](db[_0x5e5b('0xf6')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x5e5b('0xfa')][_0x5e5b('0x11d')](db['CmContact'],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db['WhatsappInteraction'][_0x5e5b('0x11d')](db['User'],{'as':_0x5e5b('0x160'),'foreignKey':_0x5e5b('0x10e')});db[_0x5e5b('0xfa')][_0x5e5b('0x120')](db[_0x5e5b('0x8b')],{'through':_0x5e5b('0x1e6'),'as':_0x5e5b('0x161')});db[_0x5e5b('0xfa')][_0x5e5b('0x120')](db['Tag'],{'through':_0x5e5b('0x1e6'),'as':_0x5e5b('0x170')});db[_0x5e5b('0xfa')][_0x5e5b('0x120')](db['User'],{'as':_0x5e5b('0x171'),'through':_0x5e5b('0x12c'),'foreignKey':_0x5e5b('0x1e5')});db[_0x5e5b('0xfc')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x10a')});db[_0x5e5b('0xfc')]['belongsTo'](db[_0x5e5b('0x6f')],{'onDelete':_0x5e5b('0x111'),'as':_0x5e5b('0x152')});db[_0x5e5b('0xfc')][_0x5e5b('0x11d')](db[_0x5e5b('0xfa')],{'onDelete':'cascade','as':_0x5e5b('0x179'),'foreignKey':_0x5e5b('0x1e5')});db[_0x5e5b('0xfc')][_0x5e5b('0x11d')](db[_0x5e5b('0xf6')],{'as':_0x5e5b('0x15f'),'foreignKey':_0x5e5b('0x1e4')});db[_0x5e5b('0xfd')][_0x5e5b('0x11d')](db[_0x5e5b('0xf6')],{});db['WhatsappQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x14a')],{'as':'List','foreignKey':_0x5e5b('0x15c')});db['WhatsappQueueReport']['belongsTo'](db[_0x5e5b('0x6f')],{'as':_0x5e5b('0x152'),'foreignKey':_0x5e5b('0x153')});db['WhatsappQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0xfa')],{});db['WhatsappQueueReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x101')],{});db['WhatsappQueueReport'][_0x5e5b('0x11d')](db['WhatsappMessage'],{});db[_0x5e5b('0xfd')]['belongsTo'](db['User'],{});db['WhatsappTransferReport'][_0x5e5b('0x11d')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x5e5b('0x11d')](db[_0x5e5b('0xfa')],{});db['WhatsappTransferReport'][_0x5e5b('0x11d')](db[_0x5e5b('0xf6')],{'foreignKey':_0x5e5b('0x1e7'),'as':_0x5e5b('0x1cd')});db[_0x5e5b('0xff')][_0x5e5b('0x11d')](db[_0x5e5b('0xf6')],{'foreignKey':_0x5e5b('0x1e8'),'as':_0x5e5b('0x1d5')});db['WhatsappTransferReport'][_0x5e5b('0x11d')](db[_0x5e5b('0x101')],{'foreignKey':_0x5e5b('0x1e9'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1ce'),'as':'FromAgent'});db[_0x5e5b('0xff')][_0x5e5b('0x11d')](db[_0x5e5b('0x10a')],{'foreignKey':_0x5e5b('0x1d0'),'as':_0x5e5b('0x1d1')});db['WhatsappQueue'][_0x5e5b('0x120')](db[_0x5e5b('0x10a')],{'as':_0x5e5b('0x14c'),'through':_0x5e5b('0x3a'),'foreignKey':'WhatsappQueueId'});db[_0x5e5b('0x101')][_0x5e5b('0x120')](db[_0x5e5b('0xdd')],{'through':'team_has_whatsapp_queues','as':_0x5e5b('0x173')});module[_0x5e5b('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbdb7=['JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','userProfileId','chat_group_has_users','belongsToMany','CmContact','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteraction','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','CmList','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','JscriptySessions','belongsTo','TrunkId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','Imap','hasOne','Smtp','Answers','Interactions','List','ListId','TemplateId','Agents','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','ChatOfflineMessageId','restrict','Interval','TagId','DashboardItem','FaxAccountId','Exntensions','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','Dispositions','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','ChatApplication','Agent','Queue','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','UserChatQueue','team_has_chat_queues','Website','CompanyId','CmHopper','Hoppers','HopperHistories','Company','cm_contact_has_tags','Campaign','OwnerId','CampaignId','OneAll','AutomationAllId','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','Schedule','DefaultReportId','CustomReportId','Mohs','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','AnalyticDefaultReport','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','DeskConfiguration','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','ServicenowConfiguration','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','team_has_whatsapp_queues','WhatsappQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAgent','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToAccount','CustomFields','Contacts','HopperHistory','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','utf8mb4','name','sequelizeHistory','xcall','127.0.0.1','mysql','utf8','utf8_general_ci','username','database','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Variable','../api/variable/variable.model','Integration','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport'];(function(_0x5ee0ef,_0x34f2b1){var _0x144aab=function(_0x39f698){while(--_0x39f698){_0x5ee0ef['push'](_0x5ee0ef['shift']());}};_0x144aab(++_0x34f2b1);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x59f691,_0x1b656d){_0x59f691=_0x59f691-0x0;var _0x1f80bb=_0xbdb7[_0x59f691];return _0x1f80bb;};'use strict';var config=require(_0x7bdb('0x0'));var Sequelize=require(_0x7bdb('0x1'));var _=require(_0x7bdb('0x2'));var jstz=require(_0x7bdb('0x3'));var timezone=jstz[_0x7bdb('0x4')]();config[_0x7bdb('0x1')]=_[_0x7bdb('0x5')](config[_0x7bdb('0x1')],{'database':_0x7bdb('0x6'),'username':'xcall','password':_0x7bdb('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7bdb('0x8')},'logging':![],'timezone':timezone[_0x7bdb('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x7bdb('0xa')]=_[_0x7bdb('0x5')](config['sequelizeHistory'],{'database':'motion2','username':_0x7bdb('0xb'),'password':_0x7bdb('0x7'),'options':{'host':_0x7bdb('0xc'),'port':0xcea,'dialect':_0x7bdb('0xd'),'dialectOptions':{'charset':_0x7bdb('0x8')},'logging':![],'timezone':timezone[_0x7bdb('0x9')](),'define':{'charset':_0x7bdb('0xe'),'collate':_0x7bdb('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config['sequelize'][_0x7bdb('0x10')],config[_0x7bdb('0x1')]['password'],config[_0x7bdb('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x7bdb('0x11')],config[_0x7bdb('0xa')]['username'],config['sequelizeHistory']['password'],config[_0x7bdb('0xa')][_0x7bdb('0x12')])};db[_0x7bdb('0x13')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x15'));db[_0x7bdb('0x16')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x17'));db[_0x7bdb('0x18')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/voiceContext/voiceContext.model');db[_0x7bdb('0x19')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x1a'));db[_0x7bdb('0x1b')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x1c'));db['VoiceQueue']=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x1d'));db['VoiceRecording']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x1e'));db[_0x7bdb('0x1f')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x20'));db[_0x7bdb('0x21')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x7bdb('0x1')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x22'));db[_0x7bdb('0x23')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x24'));db['VoiceAgentReport']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x25'));db[_0x7bdb('0x26')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x27'));db[_0x7bdb('0x28')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x29'));db[_0x7bdb('0x2a')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x2b'));db[_0x7bdb('0x2c')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x7bdb('0x2d')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x2e'));db['UserVoiceQueue']=db['sequelize']['import'](_0x7bdb('0x2f'));db['UserChatQueue']=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x30'));db[_0x7bdb('0x31')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x32'));db['UserFaxQueue']=db['sequelize'][_0x7bdb('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x7bdb('0x33')]=db['sequelize']['import'](_0x7bdb('0x34'));db[_0x7bdb('0x35')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x36'));db[_0x7bdb('0x37')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x38'));db[_0x7bdb('0x39')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x3a'));db[_0x7bdb('0x3b')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x3c'));db[_0x7bdb('0x3d')]=db[_0x7bdb('0x1')]['import']('../api/mailQueue/mailQueue.model');db[_0x7bdb('0x3e')]=db['sequelize'][_0x7bdb('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x7bdb('0x3f')]=db['sequelize']['import'](_0x7bdb('0x40'));db[_0x7bdb('0x41')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x42'));db[_0x7bdb('0x43')]=db[_0x7bdb('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0x7bdb('0x44')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x45'));db[_0x7bdb('0x46')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x47'));db[_0x7bdb('0x48')]=db['sequelize'][_0x7bdb('0x14')]('../api/faxAccount/faxAccount.model');db[_0x7bdb('0x49')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x4a'));db[_0x7bdb('0x4b')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x4c'));db[_0x7bdb('0x4d')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x4e'));db['FaxQueue']=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x4f'));db[_0x7bdb('0x50')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x51'));db['SmsAccount']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x52'));db[_0x7bdb('0x53')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x54'));db[_0x7bdb('0x55')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x56'));db[_0x7bdb('0x57')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x58'));db[_0x7bdb('0x59')]=db['sequelize'][_0x7bdb('0x14')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0x7bdb('0x5a')]=db[_0x7bdb('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x5b'));db[_0x7bdb('0x5c')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x5d'));db[_0x7bdb('0x5e')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x7bdb('0x5f')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x60'));db[_0x7bdb('0x61')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x62'));db['ChatApplication']=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x63'));db['ChatInteraction']=db['sequelize']['import'](_0x7bdb('0x64'));db['ChatMessage']=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x65'));db[_0x7bdb('0x66')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x67'));db['ChatQueue']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x68'));db[_0x7bdb('0x69')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/chatGroup/chatGroup.model');db[_0x7bdb('0x6a')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x7bdb('0x6b')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x6c'));db['CmContact']=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/cmHopper/cmHopper.model');db[_0x7bdb('0x6d')]=db['sequelize'][_0x7bdb('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x6e'));db[_0x7bdb('0x6f')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x70'));db[_0x7bdb('0x71')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x72'));db[_0x7bdb('0x73')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x74'));db['Action']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x75'));db[_0x7bdb('0x76')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x77'));db[_0x7bdb('0x78')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x79'));db[_0x7bdb('0x7a')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x7b'));db[_0x7bdb('0x7c')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x7d'));db['Interval']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x7e'));db[_0x7bdb('0x7f')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x80'));db[_0x7bdb('0x81')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x82'));db[_0x7bdb('0x83')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x84'));db['Schedule']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x85'));db['Sound']=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/sound/sound.model');db[_0x7bdb('0x86')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x87'));db[_0x7bdb('0x88')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x89'));db['Trigger']=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/trigger/trigger.model');db[_0x7bdb('0x8a')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x8b'));db[_0x7bdb('0x8c')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/integration/integration.model');db['IntegrationReport']=db['sequelize'][_0x7bdb('0x14')]('../api/integrationReport/integrationReport.model');db[_0x7bdb('0x8d')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x8e'));db[_0x7bdb('0x8f')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x90'));db[_0x7bdb('0x91')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x92'));db['AnalyticFieldReport']=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x93'));db['AnalyticTreeReport']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x94'));db[_0x7bdb('0x95')]=db[_0x7bdb('0x1')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x7bdb('0x96')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x97'));db[_0x7bdb('0x98')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0x99'));db['SugarcrmAccount']=db[_0x7bdb('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x7bdb('0x9a')]=db[_0x7bdb('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x7bdb('0x9b')]=db['sequelize'][_0x7bdb('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x7bdb('0x9c')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0x9d'));db['DeskConfiguration']=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x7bdb('0x9e')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0x9f'));db[_0x7bdb('0xa0')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x7bdb('0xa1')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xa2'));db[_0x7bdb('0xa3')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xa4'));db[_0x7bdb('0xa5')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xa6'));db[_0x7bdb('0xa7')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xa8'));db[_0x7bdb('0xa9')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xaa'));db[_0x7bdb('0xab')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xac'));db['FreshdeskConfiguration']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xad'));db[_0x7bdb('0xae')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xaf'));db[_0x7bdb('0xb0')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xb1'));db['VtigerConfiguration']=db['sequelize']['import'](_0x7bdb('0xb2'));db[_0x7bdb('0xb3')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xb4'));db['ServicenowAccount']=db['sequelize']['import'](_0x7bdb('0xb5'));db['ServicenowConfiguration']=db['sequelize']['import'](_0x7bdb('0xb6'));db[_0x7bdb('0xb7')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xb8'));db[_0x7bdb('0xb9')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x7bdb('0xba')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xbb'));db[_0x7bdb('0xbc')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xbd'));db[_0x7bdb('0xbe')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xbf'));db['FreshsalesConfiguration']=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x7bdb('0xc0')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xc1'));db[_0x7bdb('0x8c')]=db['sequelize'][_0x7bdb('0x14')]('../api/integration/integration.model');db[_0x7bdb('0xc2')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/network/network.model');db[_0x7bdb('0xc3')]=db['sequelize'][_0x7bdb('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x7bdb('0xc4')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xc5'));db[_0x7bdb('0xc6')]=db['sequelize']['import'](_0x7bdb('0xc7'));db[_0x7bdb('0xc8')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x7bdb('0xc9')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xca'));db[_0x7bdb('0xcb')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xcc'));db[_0x7bdb('0xcd')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xce'));db[_0x7bdb('0xcf')]=db[_0x7bdb('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x7bdb('0xd0')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xd1'));db[_0x7bdb('0xd2')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xd3'));db[_0x7bdb('0xd4')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x7bdb('0xd5')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xd6'));db[_0x7bdb('0xd7')]=db[_0x7bdb('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x7bdb('0xd8')]=db['sequelize']['import'](_0x7bdb('0xd9'));db['Team']=db[_0x7bdb('0x1')]['import']('../api/team/team.model');db[_0x7bdb('0xda')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xdb'));db['Campaign']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xdc'));db[_0x7bdb('0xdd')]=db['sequelize'][_0x7bdb('0x14')]('../api/migration/migration.model');db[_0x7bdb('0xde')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xdf'));db['Plugin']=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xe0'));db[_0x7bdb('0xe1')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xe2'));db['ChatTransferReport']=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xe3'));db[_0x7bdb('0xe4')]=db['sequelize'][_0x7bdb('0x14')](_0x7bdb('0xe5'));db[_0x7bdb('0xe6')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xe7'));db[_0x7bdb('0xe8')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xe9'));db['CmList']=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xea'));db[_0x7bdb('0xeb')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xec'));db[_0x7bdb('0xed')]=db['sequelize'][_0x7bdb('0x14')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xee'));db[_0x7bdb('0xef')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x7bdb('0xf0')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xf1'));db['WhatsappAccount']=db['sequelize'][_0x7bdb('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x7bdb('0xf2')]=db[_0x7bdb('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0x7bdb('0xf3')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xf4'));db[_0x7bdb('0xf5')]=db[_0x7bdb('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x7bdb('0xf6')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xf7'));db['WhatsappTransferReport']=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xf8'));db['WhatsappQueue']=db['sequelize']['import'](_0x7bdb('0xf9'));db[_0x7bdb('0xfa')]=db[_0x7bdb('0x1')]['import'](_0x7bdb('0xfb'));db[_0x7bdb('0xfc')]=db[_0x7bdb('0x1')][_0x7bdb('0x14')](_0x7bdb('0xfd'));db[_0x7bdb('0xfe')]=db['sequelize']['import'](_0x7bdb('0xff'));db[_0x7bdb('0x100')]=db['sequelize']['import'](_0x7bdb('0x101'));db['User']['hasOne'](db[_0x7bdb('0x21')],{'as':_0x7bdb('0x21'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x103')});db['User'][_0x7bdb('0x104')](db[_0x7bdb('0x105')],{'as':_0x7bdb('0x106'),'foreignKey':'UserId'});db[_0x7bdb('0x13')][_0x7bdb('0x104')](db[_0x7bdb('0x2d')],{'as':_0x7bdb('0x107'),'foreignKey':'UserId'});db[_0x7bdb('0x13')][_0x7bdb('0x104')](db['VoiceExtension'],{'as':_0x7bdb('0x108'),'onDelete':'cascade','hooks':!![]});db['User'][_0x7bdb('0x104')](db[_0x7bdb('0x109')],{'as':_0x7bdb('0x10a'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x13')][_0x7bdb('0x104')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x7bdb('0x103')});db['User'][_0x7bdb('0x104')](db[_0x7bdb('0x71')],{'as':_0x7bdb('0x71'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x13')][_0x7bdb('0x104')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0x7bdb('0x13')]['hasMany'](db[_0x7bdb('0x10b')],{'as':_0x7bdb('0x10c'),'foreignKey':_0x7bdb('0x103')});db['User'][_0x7bdb('0x104')](db[_0x7bdb('0x55')],{'as':_0x7bdb('0x10d'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x13')][_0x7bdb('0x104')](db['FaxInteraction'],{'as':_0x7bdb('0x10e'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x13')][_0x7bdb('0x104')](db[_0x7bdb('0x3f')],{'as':'MailInteractions','foreignKey':_0x7bdb('0x103')});db['User'][_0x7bdb('0x104')](db[_0x7bdb('0xf3')],{'as':_0x7bdb('0x10f'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x13')][_0x7bdb('0x104')](db[_0x7bdb('0xf0')],{'as':_0x7bdb('0x110'),'foreignKey':_0x7bdb('0x111')});db[_0x7bdb('0x13')]['belongsTo'](db[_0x7bdb('0xed')],{'as':_0x7bdb('0xed'),'foreignKey':_0x7bdb('0x112')});db['User']['belongsToMany'](db['ChatGroup'],{'as':'Groups','through':_0x7bdb('0x113')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x115')],{'as':'Contacts','through':_0x7bdb('0x116')});db[_0x7bdb('0x13')]['belongsToMany'](db['CmList'],{'as':_0x7bdb('0x117'),'through':_0x7bdb('0x118')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x119')],{'through':_0x7bdb('0x11a')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db['MailInteraction'],{'as':_0x7bdb('0x11b'),'through':_0x7bdb('0x11c')});db[_0x7bdb('0x13')]['belongsToMany'](db[_0x7bdb('0x10b')],{'as':'ChatInteractions','through':_0x7bdb('0x11d')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x4b')],{'as':'FaxInteractions','through':_0x7bdb('0x11e')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x55')],{'as':'SmsInteractions','through':_0x7bdb('0x11f')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x120')],{'as':_0x7bdb('0x121'),'through':_0x7bdb('0x122')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db['WhatsappInteraction'],{'as':_0x7bdb('0x10f'),'through':_0x7bdb('0x123')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x124')],{'as':_0x7bdb('0x125'),'through':_0x7bdb('0x126'),'required':![]});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db['VoicePrefix'],{'as':_0x7bdb('0x127'),'through':'UserVoicePrefix','required':![]});db['User'][_0x7bdb('0x114')](db['MailQueue'],{'as':_0x7bdb('0x128'),'through':'UserMailQueue','required':![]});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x129')],{'as':_0x7bdb('0x12a'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x7bdb('0x114')](db[_0x7bdb('0x12b')],{'as':_0x7bdb('0x12c'),'through':_0x7bdb('0x12d'),'required':![]});db[_0x7bdb('0x13')]['belongsToMany'](db['SmsQueue'],{'as':_0x7bdb('0x12e'),'through':_0x7bdb('0x33'),'required':![]});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x5e')],{'as':_0x7bdb('0x12f'),'through':'UserOpenchannelQueue','required':![]});db[_0x7bdb('0x13')]['belongsToMany'](db[_0x7bdb('0x130')],{'as':'WhatsappQueues','through':_0x7bdb('0x37'),'required':![]});db[_0x7bdb('0x13')]['belongsToMany'](db[_0x7bdb('0x131')],{'through':_0x7bdb('0x118')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x5f')],{'as':_0x7bdb('0x132'),'through':_0x7bdb('0x133')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x48')],{'as':_0x7bdb('0x134'),'through':_0x7bdb('0x135')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x136')],{'as':_0x7bdb('0x137'),'through':_0x7bdb('0x138')});db[_0x7bdb('0x13')]['belongsToMany'](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x7bdb('0x139')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x13a')],{'as':_0x7bdb('0x13b'),'through':_0x7bdb('0x13c')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0x13d')],{'as':'WhatsappAccounts','through':_0x7bdb('0x13e')});db[_0x7bdb('0x13')][_0x7bdb('0x114')](db[_0x7bdb('0xd5')],{'as':'SquareProjects','through':_0x7bdb('0x13f')});db[_0x7bdb('0x16')]['hasMany'](db[_0x7bdb('0x19')],{'as':_0x7bdb('0x140'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x141')});db['VoiceContext'][_0x7bdb('0x104')](db[_0x7bdb('0x19')],{'onDelete':_0x7bdb('0x102')});db['VoiceExtension'][_0x7bdb('0x104')](db[_0x7bdb('0x19')],{'as':_0x7bdb('0x142'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x1b')]['belongsToMany'](db[_0x7bdb('0x143')],{'as':_0x7bdb('0x144'),'through':_0x7bdb('0x145')});db[_0x7bdb('0x124')][_0x7bdb('0x104')](db[_0x7bdb('0x2d')],{'as':_0x7bdb('0x146'),'foreignKey':'VoiceQueueId'});db[_0x7bdb('0x124')][_0x7bdb('0x104')](db['CmHopper'],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x7bdb('0x124')][_0x7bdb('0x104')](db[_0x7bdb('0x109')],{'as':_0x7bdb('0x10a'),'foreignKey':'VoiceQueueId'});db[_0x7bdb('0x124')][_0x7bdb('0x104')](db[_0x7bdb('0x6f')],{'as':'HopperHistories','foreignKey':_0x7bdb('0x147')});db[_0x7bdb('0x124')][_0x7bdb('0x104')](db[_0x7bdb('0x71')],{'as':'ReportAgentPreview','foreignKey':_0x7bdb('0x147')});db[_0x7bdb('0x124')][_0x7bdb('0x104')](db['CmHopperBlack'],{'as':_0x7bdb('0x148'),'foreignKey':_0x7bdb('0x147')});db[_0x7bdb('0x124')]['hasMany'](db[_0x7bdb('0xc9')],{'as':_0x7bdb('0x149'),'foreignKey':_0x7bdb('0x147')});db[_0x7bdb('0x124')][_0x7bdb('0x14a')](db[_0x7bdb('0x2a')],{'as':_0x7bdb('0x2a'),'foreignKey':_0x7bdb('0x14b')});db[_0x7bdb('0x124')][_0x7bdb('0x14a')](db[_0x7bdb('0x2a')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x7bdb('0x124')][_0x7bdb('0x14a')](db['Interval'],{'as':'Interval','foreignKey':_0x7bdb('0x14c')});db[_0x7bdb('0x124')][_0x7bdb('0x14a')](db[_0x7bdb('0x7f')],{'as':_0x7bdb('0x14d'),'foreignKey':_0x7bdb('0x14e')});db['VoiceQueue'][_0x7bdb('0x114')](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x117'),'through':'voice_queues_has_cm_lists'});db[_0x7bdb('0x124')][_0x7bdb('0x114')](db['User'],{'as':'Agents','through':_0x7bdb('0x126')});db[_0x7bdb('0x124')]['belongsToMany'](db[_0x7bdb('0x119')],{'as':_0x7bdb('0x14f'),'through':_0x7bdb('0xfc')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x7bdb('0x150'),'through':_0x7bdb('0x151')});db['VoiceRecording'][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'as':'User','foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x1f')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x13'),'foreignKey':_0x7bdb('0x103')});db['VoiceMail'][_0x7bdb('0x104')](db['VoiceMailMessage'],{'as':_0x7bdb('0x152'),'onDelete':'cascade','foreignKey':_0x7bdb('0x153'),'sourceKey':_0x7bdb('0x154')});db[_0x7bdb('0x155')][_0x7bdb('0x14a')](db[_0x7bdb('0x21')],{'foreignKey':_0x7bdb('0x153'),'targetKey':_0x7bdb('0x154')});db[_0x7bdb('0x156')]['hasMany'](db[_0x7bdb('0x26')],{'as':_0x7bdb('0x157'),'foreignKey':_0x7bdb('0x158'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x7bdb('0x159')],{'as':_0x7bdb('0x15a'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x13'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x156')]['belongsTo'](db['CmContact'],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db['MailServerIn'][_0x7bdb('0x14a')](db[_0x7bdb('0x136')],{'as':_0x7bdb('0x136'),'foreignKey':_0x7bdb('0x15d')});db[_0x7bdb('0x3b')][_0x7bdb('0x14a')](db[_0x7bdb('0x136')],{'as':_0x7bdb('0x136'),'foreignKey':_0x7bdb('0x15d')});db[_0x7bdb('0x136')]['hasOne'](db[_0x7bdb('0x39')],{'as':_0x7bdb('0x15e'),'onDelete':'cascade'});db[_0x7bdb('0x136')][_0x7bdb('0x15f')](db[_0x7bdb('0x3b')],{'as':_0x7bdb('0x160'),'onDelete':_0x7bdb('0x102')});db['MailAccount'][_0x7bdb('0x104')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7bdb('0x15d'),'onDelete':'cascade'});db[_0x7bdb('0x136')]['hasMany'](db[_0x7bdb('0x78')],{'as':_0x7bdb('0x161'),'foreignKey':_0x7bdb('0x15d')});db[_0x7bdb('0x136')][_0x7bdb('0x104')](db[_0x7bdb('0x41')],{'as':_0x7bdb('0x152'),'foreignKey':_0x7bdb('0x15d')});db[_0x7bdb('0x136')][_0x7bdb('0x104')](db['MailInteraction'],{'as':_0x7bdb('0x162')});db[_0x7bdb('0x136')][_0x7bdb('0x104')](db[_0x7bdb('0x43')],{'as':_0x7bdb('0x142')});db[_0x7bdb('0x136')][_0x7bdb('0x14a')](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db['MailAccount'][_0x7bdb('0x14a')](db[_0x7bdb('0x88')],{'as':_0x7bdb('0x88'),'foreignKey':_0x7bdb('0x165')});db[_0x7bdb('0x136')][_0x7bdb('0x14a')](db[_0x7bdb('0x7f')],{'as':_0x7bdb('0x14d'),'foreignKey':_0x7bdb('0x14e')});db[_0x7bdb('0x136')][_0x7bdb('0x114')](db['User'],{'as':_0x7bdb('0x166'),'through':_0x7bdb('0x138')});db[_0x7bdb('0x3d')][_0x7bdb('0x114')](db['User'],{'as':_0x7bdb('0x166'),'through':_0x7bdb('0x31')});db[_0x7bdb('0x3d')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0x7bdb('0x14f')});db[_0x7bdb('0x3f')]['hasMany'](db['MailMessage'],{'as':_0x7bdb('0x152'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x167')});db[_0x7bdb('0x3f')][_0x7bdb('0x14a')](db[_0x7bdb('0x136')],{'as':_0x7bdb('0x168'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x7bdb('0x14a')](db['CmContact'],{'as':_0x7bdb('0x15b'),'foreignKey':'ContactId'});db[_0x7bdb('0x3f')][_0x7bdb('0x14a')](db['User'],{'as':_0x7bdb('0x169'),'foreignKey':'UserId'});db[_0x7bdb('0x3f')]['belongsToMany'](db['Tag'],{'through':_0x7bdb('0x16a'),'as':_0x7bdb('0x16b')});db[_0x7bdb('0x3f')][_0x7bdb('0x114')](db['Tag'],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x7bdb('0x3f')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x16c'),'through':'user_has_mail_interactions','foreignKey':_0x7bdb('0x167')});db['MailMessage'][_0x7bdb('0x104')](db[_0x7bdb('0xde')],{'as':_0x7bdb('0x16d'),'onDelete':'cascade'});db[_0x7bdb('0x41')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'as':'User'});db[_0x7bdb('0x41')]['belongsTo'](db['CmContact'],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x15b')});db[_0x7bdb('0x41')][_0x7bdb('0x14a')](db[_0x7bdb('0x3f')],{'as':_0x7bdb('0x16e'),'foreignKey':'MailInteractionId'});db[_0x7bdb('0x41')]['belongsTo'](db[_0x7bdb('0x136')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x15d')});db[_0x7bdb('0x41')][_0x7bdb('0x14a')](db[_0x7bdb('0x5f')],{'as':_0x7bdb('0x5f'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x7bdb('0x14a')](db['ChatOfflineMessage'],{'as':_0x7bdb('0x66'),'foreignKey':_0x7bdb('0x16f')});db[_0x7bdb('0x43')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x43')][_0x7bdb('0x14a')](db[_0x7bdb('0x3d')],{'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x43')][_0x7bdb('0x14a')](db[_0x7bdb('0x136')],{'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x43')][_0x7bdb('0x14a')](db[_0x7bdb('0x171')],{'onDelete':_0x7bdb('0x170'),'foreignKey':_0x7bdb('0x14c')});db[_0x7bdb('0x43')][_0x7bdb('0x14a')](db[_0x7bdb('0x86')],{'onDelete':_0x7bdb('0x170'),'foreignKey':_0x7bdb('0x172')});db[_0x7bdb('0x44')][_0x7bdb('0x14a')](db['MailAccount'],{});db[_0x7bdb('0x44')][_0x7bdb('0x14a')](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':'ListId'});db[_0x7bdb('0x44')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x44')][_0x7bdb('0x14a')](db[_0x7bdb('0x3f')],{});db[_0x7bdb('0x44')][_0x7bdb('0x14a')](db[_0x7bdb('0x41')],{});db[_0x7bdb('0x44')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{});db[_0x7bdb('0x44')]['belongsTo'](db[_0x7bdb('0x3d')],{});db[_0x7bdb('0x46')][_0x7bdb('0x104')](db[_0x7bdb('0x173')],{'as':'Items','onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x48')]['hasMany'](db[_0x7bdb('0x7a')],{'as':'Dispositions','foreignKey':_0x7bdb('0x174'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x48')][_0x7bdb('0x104')](db['CannedAnswer'],{'as':_0x7bdb('0x161'),'foreignKey':_0x7bdb('0x174')});db['FaxAccount'][_0x7bdb('0x104')](db[_0x7bdb('0x4b')],{'as':_0x7bdb('0x162')});db[_0x7bdb('0x48')][_0x7bdb('0x104')](db[_0x7bdb('0x49')],{'as':'Applications'});db[_0x7bdb('0x48')][_0x7bdb('0x104')](db[_0x7bdb('0x19')],{'as':_0x7bdb('0x175'),'onDelete':_0x7bdb('0x102')});db['FaxAccount']['hasMany'](db[_0x7bdb('0x4d')],{'as':'Messages'});db['FaxAccount'][_0x7bdb('0x14a')](db['Trunk'],{'as':_0x7bdb('0x2a')});db[_0x7bdb('0x48')][_0x7bdb('0x14a')](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0x48')]['belongsTo'](db[_0x7bdb('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x7bdb('0x14e')});db[_0x7bdb('0x48')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x166'),'through':_0x7bdb('0x135')});db[_0x7bdb('0x49')]['belongsTo'](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x170')});db['FaxApplication'][_0x7bdb('0x14a')](db[_0x7bdb('0x12b')],{'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x49')]['belongsTo'](db[_0x7bdb('0x48')],{'onDelete':'restrict'});db[_0x7bdb('0x49')]['belongsTo'](db[_0x7bdb('0x86')],{'onDelete':_0x7bdb('0x170'),'foreignKey':_0x7bdb('0x172')});db[_0x7bdb('0x4b')][_0x7bdb('0x104')](db[_0x7bdb('0x4d')],{'as':_0x7bdb('0x152'),'onDelete':_0x7bdb('0x102'),'foreignKey':'FaxInteractionId'});db[_0x7bdb('0x4b')][_0x7bdb('0x14a')](db[_0x7bdb('0x48')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x174')});db[_0x7bdb('0x4b')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x4b')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x169'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x4b')][_0x7bdb('0x114')](db[_0x7bdb('0x86')],{'through':_0x7bdb('0x176'),'as':'Tags'});db[_0x7bdb('0x4b')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x7bdb('0x4b')]['belongsToMany'](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x16c'),'through':_0x7bdb('0x11e'),'foreignKey':_0x7bdb('0x177')});db[_0x7bdb('0x4d')]['belongsTo'](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x13')});db[_0x7bdb('0x4d')]['belongsTo'](db[_0x7bdb('0x4b')],{'as':_0x7bdb('0x16e'),'foreignKey':_0x7bdb('0x177')});db[_0x7bdb('0x4d')][_0x7bdb('0x14a')](db['CmContact'],{'onDelete':_0x7bdb('0x102'),'as':'Contact'});db['FaxMessage'][_0x7bdb('0x14a')](db[_0x7bdb('0xde')],{'as':_0x7bdb('0xde'),'foreignKey':_0x7bdb('0x178')});db[_0x7bdb('0x4d')][_0x7bdb('0x14a')](db['FaxAccount'],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x174')});db['FaxQueue'][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x166'),'through':_0x7bdb('0x12d')});db['FaxQueue'][_0x7bdb('0x114')](db['Team'],{'through':_0x7bdb('0x179'),'as':'Teams'});db[_0x7bdb('0x50')][_0x7bdb('0x14a')](db[_0x7bdb('0x48')],{});db['FaxQueueReport']['belongsTo'](db[_0x7bdb('0x131')],{'as':'List','foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0x50')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x50')][_0x7bdb('0x14a')](db[_0x7bdb('0x4b')],{});db[_0x7bdb('0x50')][_0x7bdb('0x14a')](db[_0x7bdb('0x4d')],{});db[_0x7bdb('0x50')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{});db[_0x7bdb('0x50')][_0x7bdb('0x14a')](db['FaxQueue'],{});db[_0x7bdb('0x13a')][_0x7bdb('0x104')](db[_0x7bdb('0x7a')],{'as':_0x7bdb('0x17a'),'foreignKey':_0x7bdb('0x17b'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x13a')][_0x7bdb('0x104')](db[_0x7bdb('0x78')],{'as':'Answers','foreignKey':_0x7bdb('0x17b')});db[_0x7bdb('0x13a')][_0x7bdb('0x104')](db[_0x7bdb('0x57')],{'as':_0x7bdb('0x152'),'foreignKey':'SmsAccountId'});db[_0x7bdb('0x13a')][_0x7bdb('0x104')](db['SmsInteraction'],{'as':_0x7bdb('0x162')});db[_0x7bdb('0x13a')][_0x7bdb('0x104')](db[_0x7bdb('0x53')],{'as':'Applications'});db['SmsAccount']['belongsTo'](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0x13a')][_0x7bdb('0x14a')](db[_0x7bdb('0x7f')],{'as':_0x7bdb('0x14d'),'foreignKey':_0x7bdb('0x14e')});db['SmsAccount'][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x166'),'through':'user_has_sms_accounts'});db[_0x7bdb('0x53')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x53')][_0x7bdb('0x14a')](db['SmsQueue'],{'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x53')]['belongsTo'](db[_0x7bdb('0x13a')],{'onDelete':'restrict'});db['SmsApplication'][_0x7bdb('0x14a')](db[_0x7bdb('0x171')],{'onDelete':_0x7bdb('0x170'),'foreignKey':'IntervalId'});db[_0x7bdb('0x53')][_0x7bdb('0x14a')](db[_0x7bdb('0x86')],{'onDelete':'restrict','foreignKey':_0x7bdb('0x172')});db['SmsInteraction'][_0x7bdb('0x104')](db[_0x7bdb('0x57')],{'as':_0x7bdb('0x152'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x17c')});db[_0x7bdb('0x55')][_0x7bdb('0x14a')](db[_0x7bdb('0x13a')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x17b')});db[_0x7bdb('0x55')]['belongsTo'](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x55')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x169'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x55')][_0x7bdb('0x114')](db[_0x7bdb('0x86')],{'through':'sms_interaction_has_tags','as':_0x7bdb('0x16b')});db[_0x7bdb('0x55')][_0x7bdb('0x114')](db['Tag'],{'through':_0x7bdb('0x17d'),'as':_0x7bdb('0x17e')});db['SmsInteraction'][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x16c'),'through':_0x7bdb('0x11f'),'foreignKey':_0x7bdb('0x17c')});db[_0x7bdb('0x57')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x13')});db[_0x7bdb('0x57')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x15b')});db[_0x7bdb('0x57')][_0x7bdb('0x14a')](db[_0x7bdb('0x55')],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x16e'),'foreignKey':_0x7bdb('0x17c')});db[_0x7bdb('0x57')][_0x7bdb('0x14a')](db['SmsAccount'],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x17b')});db[_0x7bdb('0x59')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':'Agents','through':_0x7bdb('0x33'),'foreignKey':_0x7bdb('0x17f')});db[_0x7bdb('0x59')][_0x7bdb('0x114')](db[_0x7bdb('0x119')],{'through':_0x7bdb('0x180'),'as':_0x7bdb('0x14f')});db[_0x7bdb('0x181')][_0x7bdb('0x104')](db[_0x7bdb('0x7a')],{'as':_0x7bdb('0x17a'),'foreignKey':_0x7bdb('0x182'),'onDelete':_0x7bdb('0x102')});db['OpenchannelAccount']['hasMany'](db[_0x7bdb('0x78')],{'as':_0x7bdb('0x161'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x7bdb('0x104')](db[_0x7bdb('0x120')],{'as':_0x7bdb('0x162'),'foreignKey':_0x7bdb('0x182')});db[_0x7bdb('0x181')][_0x7bdb('0x104')](db['OpenchannelMessage'],{'as':_0x7bdb('0x152'),'foreignKey':_0x7bdb('0x182')});db['OpenchannelAccount'][_0x7bdb('0x104')](db[_0x7bdb('0x5a')],{'as':_0x7bdb('0x142'),'foreignKey':_0x7bdb('0x182')});db[_0x7bdb('0x181')]['belongsTo'](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0x181')][_0x7bdb('0x14a')](db[_0x7bdb('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x7bdb('0x14e')});db[_0x7bdb('0x181')]['belongsToMany'](db[_0x7bdb('0x13')],{'as':'Agents','through':_0x7bdb('0x139')});db[_0x7bdb('0x5a')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'onDelete':'restrict'});db[_0x7bdb('0x5a')][_0x7bdb('0x14a')](db[_0x7bdb('0x5e')],{'onDelete':'restrict','foreignKey':_0x7bdb('0x183')});db[_0x7bdb('0x5a')][_0x7bdb('0x14a')](db[_0x7bdb('0x181')],{'onDelete':_0x7bdb('0x170'),'foreignKey':_0x7bdb('0x182')});db[_0x7bdb('0x5a')]['belongsTo'](db[_0x7bdb('0x171')],{'onDelete':_0x7bdb('0x170'),'foreignKey':_0x7bdb('0x14c')});db[_0x7bdb('0x5a')]['belongsTo'](db[_0x7bdb('0x86')],{'onDelete':_0x7bdb('0x170'),'foreignKey':'TagId'});db[_0x7bdb('0x120')]['hasMany'](db[_0x7bdb('0x5c')],{'as':_0x7bdb('0x152'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x184')});db['OpenchannelInteraction'][_0x7bdb('0x14a')](db[_0x7bdb('0x181')],{'as':_0x7bdb('0x168'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':'ContactId'});db[_0x7bdb('0x120')][_0x7bdb('0x14a')](db['User'],{'as':_0x7bdb('0x169'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0x120')][_0x7bdb('0x114')](db[_0x7bdb('0x86')],{'through':_0x7bdb('0x185'),'as':'Tags'});db[_0x7bdb('0x120')][_0x7bdb('0x114')](db['Tag'],{'through':_0x7bdb('0x185'),'as':'ThroughTags'});db[_0x7bdb('0x120')]['belongsToMany'](db['User'],{'as':_0x7bdb('0x16c'),'through':_0x7bdb('0x122'),'foreignKey':_0x7bdb('0x184')});db['OpenchannelMessage'][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x102'),'as':'User'});db[_0x7bdb('0x5c')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'onDelete':'cascade','as':_0x7bdb('0x15b')});db[_0x7bdb('0x5c')][_0x7bdb('0x14a')](db[_0x7bdb('0x120')],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x16e'),'foreignKey':_0x7bdb('0x184')});db[_0x7bdb('0x5c')][_0x7bdb('0x14a')](db['Attachment'],{'as':_0x7bdb('0xde'),'foreignKey':'AttachmentId'});db[_0x7bdb('0x5c')]['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x7bdb('0x182')});db[_0x7bdb('0x5e')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x7bdb('0x183')});db[_0x7bdb('0x5e')]['belongsToMany'](db[_0x7bdb('0x119')],{'through':_0x7bdb('0x186'),'as':_0x7bdb('0x14f')});db[_0x7bdb('0x5f')][_0x7bdb('0x104')](db['Disposition'],{'as':_0x7bdb('0x17a'),'foreignKey':_0x7bdb('0x187'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x5f')][_0x7bdb('0x104')](db[_0x7bdb('0x78')],{'as':_0x7bdb('0x161'),'foreignKey':_0x7bdb('0x187')});db[_0x7bdb('0x5f')]['hasMany'](db[_0x7bdb('0x6a')],{'as':_0x7bdb('0x188')});db['ChatWebsite'][_0x7bdb('0x104')](db['ChatInteraction'],{'as':_0x7bdb('0x162')});db['ChatWebsite']['hasMany'](db['ChatApplication'],{'as':_0x7bdb('0x142')});db[_0x7bdb('0x5f')][_0x7bdb('0x104')](db[_0x7bdb('0x189')],{'as':_0x7bdb('0x152')});db[_0x7bdb('0x5f')][_0x7bdb('0x14a')](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0x5f')][_0x7bdb('0x14a')](db['Interval'],{'as':'Interval','foreignKey':_0x7bdb('0x14c')});db[_0x7bdb('0x5f')]['belongsTo'](db['MailAccount'],{'as':_0x7bdb('0x136'),'foreignKey':_0x7bdb('0x15d')});db['ChatWebsite']['belongsTo'](db[_0x7bdb('0x7f')],{'as':_0x7bdb('0x14d'),'foreignKey':_0x7bdb('0x14e')});db[_0x7bdb('0x5f')]['belongsToMany'](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x166'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x181')],{});db[_0x7bdb('0x61')]['belongsTo'](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0x61')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':'ContactId'});db['OpenchannelQueueReport']['belongsTo'](db[_0x7bdb('0x120')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x7bdb('0x5c')],{});db[_0x7bdb('0x61')][_0x7bdb('0x14a')](db['User'],{});db[_0x7bdb('0x61')][_0x7bdb('0x14a')](db[_0x7bdb('0x5e')],{});db[_0x7bdb('0x18a')][_0x7bdb('0x14a')](db['User'],{'as':_0x7bdb('0x18b'),'foreignKey':'UserId','onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x18a')][_0x7bdb('0x14a')](db['ChatQueue'],{'as':_0x7bdb('0x18c'),'foreignKey':_0x7bdb('0x18d'),'onDelete':'restrict'});db[_0x7bdb('0x18a')][_0x7bdb('0x14a')](db[_0x7bdb('0x5f')],{'as':'Website','foreignKey':_0x7bdb('0x187'),'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x18a')][_0x7bdb('0x14a')](db[_0x7bdb('0x86')],{'onDelete':_0x7bdb('0x170'),'foreignKey':_0x7bdb('0x172')});db[_0x7bdb('0x10b')][_0x7bdb('0x104')](db[_0x7bdb('0x189')],{'as':_0x7bdb('0x152'),'onDelete':_0x7bdb('0x102'),'foreignKey':'ChatInteractionId'});db['ChatInteraction']['belongsTo'](db[_0x7bdb('0x5f')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x187')});db['ChatInteraction'][_0x7bdb('0x14a')](db['CmContact'],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x10b')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x169'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x7bdb('0x18e'),'as':'Tags'});db[_0x7bdb('0x10b')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x7bdb('0x17e')});db[_0x7bdb('0x10b')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x16c'),'through':_0x7bdb('0x11d'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x13')});db[_0x7bdb('0x189')][_0x7bdb('0x14a')](db['CmContact'],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x15b'),'foreignKey':'ContactId'});db[_0x7bdb('0x189')][_0x7bdb('0x14a')](db[_0x7bdb('0x10b')],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x16e'),'foreignKey':_0x7bdb('0x18f')});db[_0x7bdb('0x189')]['belongsTo'](db[_0x7bdb('0xde')],{'as':_0x7bdb('0xde'),'foreignKey':_0x7bdb('0x178')});db['ChatMessage'][_0x7bdb('0x14a')](db[_0x7bdb('0x5f')],{'as':'Account','foreignKey':_0x7bdb('0x187')});db[_0x7bdb('0x66')][_0x7bdb('0x104')](db[_0x7bdb('0xde')],{'as':_0x7bdb('0x16d'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x7bdb('0x102'),'hooks':!![]});db['ChatOfflineMessage'][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x66')]['belongsTo'](db[_0x7bdb('0x5f')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x187')});db[_0x7bdb('0x129')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x166'),'through':_0x7bdb('0x190'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x7bdb('0x119')],{'through':_0x7bdb('0x191'),'as':'Teams'});db[_0x7bdb('0x69')]['hasMany'](db[_0x7bdb('0xc4')],{'as':_0x7bdb('0x152'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x7bdb('0x69')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x146'),'through':_0x7bdb('0x113')});db['ChatProactiveAction'][_0x7bdb('0x14a')](db['ChatWebsite'],{'as':_0x7bdb('0x192'),'foreignKey':_0x7bdb('0x187')});db[_0x7bdb('0x6b')][_0x7bdb('0x104')](db['CmContact'],{'as':'Contacts','foreignKey':_0x7bdb('0x193')});db['CmContact'][_0x7bdb('0x104')](db[_0x7bdb('0x194')],{'as':_0x7bdb('0x195'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x115')][_0x7bdb('0x104')](db[_0x7bdb('0x109')],{'as':'HopperFinals','foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x115')]['hasMany'](db[_0x7bdb('0x6f')],{'as':_0x7bdb('0x196'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x115')]['hasMany'](db[_0x7bdb('0x71')],{'as':'ReportAgentPreview','foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x115')][_0x7bdb('0x104')](db[_0x7bdb('0xc9')],{'as':_0x7bdb('0x149'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0x115')][_0x7bdb('0x104')](db[_0x7bdb('0x120')],{'as':_0x7bdb('0x121'),'foreignKey':_0x7bdb('0x15c'),'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x115')][_0x7bdb('0x104')](db[_0x7bdb('0x10b')],{'as':'ChatInteractions','foreignKey':_0x7bdb('0x15c'),'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x115')][_0x7bdb('0x104')](db[_0x7bdb('0x55')],{'as':_0x7bdb('0x10d'),'foreignKey':'ContactId','onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x115')][_0x7bdb('0x104')](db[_0x7bdb('0x4b')],{'as':_0x7bdb('0x10e'),'foreignKey':_0x7bdb('0x15c'),'onDelete':_0x7bdb('0x170')});db['CmContact'][_0x7bdb('0x104')](db[_0x7bdb('0x3f')],{'as':_0x7bdb('0x11b'),'foreignKey':_0x7bdb('0x15c'),'onDelete':_0x7bdb('0x170')});db['CmContact'][_0x7bdb('0x14a')](db['CmCompany'],{'as':_0x7bdb('0x197'),'foreignKey':'CompanyId'});db[_0x7bdb('0x115')][_0x7bdb('0x14a')](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x115')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x16c'),'through':_0x7bdb('0x116')});db[_0x7bdb('0x115')][_0x7bdb('0x114')](db['Tag'],{'as':'Tags','through':_0x7bdb('0x198')});db['CmContact'][_0x7bdb('0x114')](db['Tag'],{'through':_0x7bdb('0x198'),'as':_0x7bdb('0x17e')});db[_0x7bdb('0x194')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x194')][_0x7bdb('0x14a')](db[_0x7bdb('0x131')],{'as':'List','foreignKey':_0x7bdb('0x164'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x194')]['belongsTo'](db[_0x7bdb('0x13')],{'as':'Agent','foreignKey':_0x7bdb('0x103')});db['CmHopper'][_0x7bdb('0x14a')](db[_0x7bdb('0x124')],{'as':'Queue','foreignKey':_0x7bdb('0x147'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x194')][_0x7bdb('0x14a')](db[_0x7bdb('0x199')],{'as':_0x7bdb('0x199'),'foreignKey':'CampaignId','onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x194')]['belongsTo'](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x169'),'foreignKey':_0x7bdb('0x19a')});db['CmHopperBlack'][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c'),'onDelete':'cascade'});db[_0x7bdb('0x6d')]['belongsTo'](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x6d')][_0x7bdb('0x14a')](db[_0x7bdb('0x124')],{'as':'Queue','foreignKey':_0x7bdb('0x147'),'onDelete':'cascade'});db['CmHopperBlack'][_0x7bdb('0x14a')](db[_0x7bdb('0x199')],{'as':_0x7bdb('0x199'),'foreignKey':_0x7bdb('0x19b'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x76')][_0x7bdb('0x104')](db[_0x7bdb('0x7c')],{'as':{'plural':'All','singular':_0x7bdb('0x19c')},'foreignKey':_0x7bdb('0x19d'),'onDelete':_0x7bdb('0x102'),'hooks':!![]});db[_0x7bdb('0x76')][_0x7bdb('0x104')](db[_0x7bdb('0x7c')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x7bdb('0x19e'),'onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db[_0x7bdb('0x19f')],{'as':_0x7bdb('0x1a0'),'foreignKey':_0x7bdb('0x1a1'),'onDelete':_0x7bdb('0x102'),'hooks':!![]});db[_0x7bdb('0x7a')][_0x7bdb('0x104')](db[_0x7bdb('0x7a')],{'as':_0x7bdb('0x17a'),'foreignKey':_0x7bdb('0x1a2'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x171')][_0x7bdb('0x104')](db[_0x7bdb('0x171')],{'as':_0x7bdb('0x1a3'),'foreignKey':_0x7bdb('0x14c'),'onDelete':_0x7bdb('0x102'),'hooks':!![],'required':![]});db[_0x7bdb('0x171')]['hasMany'](db['VoiceExtension'],{'as':_0x7bdb('0x108'),'foreignKey':_0x7bdb('0x14c'),'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x171')][_0x7bdb('0x104')](db[_0x7bdb('0x43')],{'as':_0x7bdb('0x1a4'),'foreignKey':_0x7bdb('0x14c')});db[_0x7bdb('0x171')]['hasMany'](db[_0x7bdb('0x18a')],{'as':_0x7bdb('0x1a5'),'foreignKey':'IntervalId'});db[_0x7bdb('0x171')][_0x7bdb('0x104')](db[_0x7bdb('0x49')],{'as':'FaxApplications','foreignKey':_0x7bdb('0x14c')});db[_0x7bdb('0x171')][_0x7bdb('0x104')](db[_0x7bdb('0x53')],{'as':'SmsApplications','foreignKey':_0x7bdb('0x14c')});db[_0x7bdb('0x1a6')][_0x7bdb('0x14a')](db[_0x7bdb('0x136')],{});db[_0x7bdb('0x1a6')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0x7bdb('0x1a7')});db[_0x7bdb('0x1a6')][_0x7bdb('0x14a')](db[_0x7bdb('0x8d')],{'foreignKey':_0x7bdb('0x1a8')});db[_0x7bdb('0x143')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x7bdb('0x1a9'),'through':_0x7bdb('0x145'),'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0x86')][_0x7bdb('0x114')](db[_0x7bdb('0x115')],{'through':_0x7bdb('0x198')});db[_0x7bdb('0x86')][_0x7bdb('0x114')](db['ChatInteraction'],{'through':_0x7bdb('0x18e')});db[_0x7bdb('0x86')]['belongsToMany'](db[_0x7bdb('0x3f')],{'through':_0x7bdb('0x16a')});db[_0x7bdb('0x86')][_0x7bdb('0x114')](db[_0x7bdb('0x55')],{'through':_0x7bdb('0x17d')});db['Tag'][_0x7bdb('0x114')](db[_0x7bdb('0x4b')],{'through':_0x7bdb('0x176')});db[_0x7bdb('0x86')][_0x7bdb('0x114')](db[_0x7bdb('0x120')],{'through':_0x7bdb('0x185')});db[_0x7bdb('0x86')]['belongsToMany'](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x7bdb('0x1aa')][_0x7bdb('0x104')](db[_0x7bdb('0x7c')],{'as':{'plural':_0x7bdb('0x1ab'),'singular':_0x7bdb('0x1ac')},'foreignKey':_0x7bdb('0x1ad'),'onDelete':_0x7bdb('0x102'),'hooks':!![]});db[_0x7bdb('0x1aa')][_0x7bdb('0x104')](db[_0x7bdb('0x7c')],{'as':{'plural':_0x7bdb('0x1ae'),'singular':_0x7bdb('0x1af')},'foreignKey':_0x7bdb('0x1b0'),'onDelete':_0x7bdb('0x102'),'hooks':!![]});db[_0x7bdb('0x1aa')][_0x7bdb('0x104')](db['Action'],{'as':_0x7bdb('0x1a0'),'foreignKey':'TriggerId','onDelete':_0x7bdb('0x102'),'hooks':!![]});db[_0x7bdb('0x8d')]['hasMany'](db[_0x7bdb('0x1b1')],{'as':_0x7bdb('0x1b2'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1a8'),'hooks':!![]});db[_0x7bdb('0x1b3')][_0x7bdb('0x104')](db[_0x7bdb('0x1b1')],{'as':_0x7bdb('0x1b2'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1a7')});db[_0x7bdb('0x91')]['hasMany'](db[_0x7bdb('0x1b1')],{'as':_0x7bdb('0x1b2'),'onDelete':'cascade','foreignKey':_0x7bdb('0x1b4')});db[_0x7bdb('0x1b1')]['belongsTo'](db[_0x7bdb('0x91')],{'foreignKey':_0x7bdb('0x1b4')});db[_0x7bdb('0x95')][_0x7bdb('0x104')](db[_0x7bdb('0x96')],{'as':_0x7bdb('0x1b5'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0x96')]['hasMany'](db[_0x7bdb('0x98')],{'as':_0x7bdb('0x1b7'),'onDelete':'cascade','foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0x96')][_0x7bdb('0x104')](db[_0x7bdb('0x98')],{'as':_0x7bdb('0x1b9'),'onDelete':'cascade','foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0x96')]['hasMany'](db['SalesforceField'],{'as':_0x7bdb('0x1b2'),'onDelete':'cascade','foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0x96')][_0x7bdb('0x14a')](db[_0x7bdb('0x95')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0x98')][_0x7bdb('0x104')](db['SalesforceField'],{'as':_0x7bdb('0x1bc'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0x98')][_0x7bdb('0x104')](db[_0x7bdb('0x98')],{'as':_0x7bdb('0x1bd'),'foreignKey':_0x7bdb('0x1ba')});db['SalesforceField'][_0x7bdb('0x104')](db['SalesforceField'],{'as':_0x7bdb('0x1be'),'foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0x98')]['belongsTo'](db[_0x7bdb('0x8a')],{'as':_0x7bdb('0x8a'),'foreignKey':_0x7bdb('0x1bf')});db[_0x7bdb('0x1c0')][_0x7bdb('0x104')](db[_0x7bdb('0x9a')],{'as':_0x7bdb('0x1b5'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b6')});db['SugarcrmConfiguration'][_0x7bdb('0x104')](db[_0x7bdb('0x9b')],{'as':_0x7bdb('0x1b7'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0x9a')]['hasMany'](db[_0x7bdb('0x9b')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7bdb('0x9a')]['hasMany'](db[_0x7bdb('0x9b')],{'as':_0x7bdb('0x1b2'),'onDelete':'cascade','foreignKey':_0x7bdb('0x1bb')});db['SugarcrmConfiguration']['belongsTo'](db[_0x7bdb('0x1c0')],{'as':'Account','foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0x9b')][_0x7bdb('0x104')](db['SugarcrmField'],{'as':_0x7bdb('0x1bc'),'foreignKey':_0x7bdb('0x1b8')});db['SugarcrmField'][_0x7bdb('0x104')](db['SugarcrmField'],{'as':_0x7bdb('0x1bd'),'foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0x9b')][_0x7bdb('0x104')](db[_0x7bdb('0x9b')],{'as':'Field','foreignKey':_0x7bdb('0x1bb')});db['SugarcrmField'][_0x7bdb('0x14a')](db['Variable'],{'as':'Variable','foreignKey':_0x7bdb('0x1bf')});db[_0x7bdb('0x9c')][_0x7bdb('0x104')](db[_0x7bdb('0x1c1')],{'as':_0x7bdb('0x1b5'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b6')});db['DeskConfiguration'][_0x7bdb('0x104')](db[_0x7bdb('0x9e')],{'as':_0x7bdb('0x1b7'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b8')});db['DeskConfiguration'][_0x7bdb('0x104')](db['DeskField'],{'as':_0x7bdb('0x1b9'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0x1c1')][_0x7bdb('0x104')](db[_0x7bdb('0x9e')],{'as':_0x7bdb('0x1b2'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0x1c1')][_0x7bdb('0x14a')](db[_0x7bdb('0x9c')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0x1c1')][_0x7bdb('0x114')](db[_0x7bdb('0x86')],{'through':_0x7bdb('0x1c2')});db[_0x7bdb('0x9e')][_0x7bdb('0x104')](db[_0x7bdb('0x9e')],{'as':_0x7bdb('0x1bc'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0x9e')][_0x7bdb('0x104')](db['DeskField'],{'as':_0x7bdb('0x1bd'),'foreignKey':'DescriptionId'});db[_0x7bdb('0x9e')][_0x7bdb('0x104')](db[_0x7bdb('0x9e')],{'as':_0x7bdb('0x1be'),'foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0x9e')][_0x7bdb('0x14a')](db[_0x7bdb('0x8a')],{'as':_0x7bdb('0x8a'),'foreignKey':'VariableId'});db[_0x7bdb('0xa0')][_0x7bdb('0x104')](db[_0x7bdb('0xa1')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0xa1')][_0x7bdb('0x104')](db[_0x7bdb('0xa3')],{'as':_0x7bdb('0x1b7'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0xa1')][_0x7bdb('0x104')](db[_0x7bdb('0xa3')],{'as':'Descriptions','onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0xa1')]['hasMany'](db['ZohoField'],{'as':_0x7bdb('0x1b2'),'onDelete':_0x7bdb('0x102'),'foreignKey':'FieldId'});db[_0x7bdb('0xa1')]['belongsTo'](db[_0x7bdb('0xa0')],{'as':_0x7bdb('0x168'),'foreignKey':'AccountId'});db['ZohoField'][_0x7bdb('0x104')](db[_0x7bdb('0xa3')],{'as':_0x7bdb('0x1bc'),'foreignKey':'SubjectId'});db['ZohoField'][_0x7bdb('0x104')](db[_0x7bdb('0xa3')],{'as':_0x7bdb('0x1bd'),'foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0xa3')][_0x7bdb('0x104')](db[_0x7bdb('0xa3')],{'as':_0x7bdb('0x1be'),'foreignKey':_0x7bdb('0x1bb')});db['ZohoField'][_0x7bdb('0x14a')](db[_0x7bdb('0x8a')],{'as':_0x7bdb('0x8a'),'foreignKey':_0x7bdb('0x1bf')});db[_0x7bdb('0xa5')][_0x7bdb('0x104')](db[_0x7bdb('0xa7')],{'as':_0x7bdb('0x1b5'),'onDelete':_0x7bdb('0x102'),'foreignKey':'AccountId'});db[_0x7bdb('0xa7')][_0x7bdb('0x104')](db['ZendeskField'],{'as':_0x7bdb('0x1b7'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0xa7')][_0x7bdb('0x104')](db[_0x7bdb('0xa9')],{'as':_0x7bdb('0x1b9'),'foreignKey':'DescriptionId'});db[_0x7bdb('0xa7')][_0x7bdb('0x104')](db[_0x7bdb('0xa9')],{'as':'Fields','foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0xa7')][_0x7bdb('0x14a')](db[_0x7bdb('0xa5')],{'as':_0x7bdb('0x168'),'foreignKey':'AccountId'});db[_0x7bdb('0xa7')]['belongsToMany'](db[_0x7bdb('0x86')],{'through':_0x7bdb('0x1c3')});db[_0x7bdb('0xa9')]['hasMany'](db['ZendeskField'],{'as':_0x7bdb('0x1bc'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0xa9')][_0x7bdb('0x104')](db[_0x7bdb('0xa9')],{'as':_0x7bdb('0x1bd'),'foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0xa9')][_0x7bdb('0x104')](db[_0x7bdb('0xa9')],{'as':_0x7bdb('0x1be'),'foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0xa9')][_0x7bdb('0x14a')](db[_0x7bdb('0x8a')],{'as':_0x7bdb('0x8a'),'foreignKey':'VariableId'});db[_0x7bdb('0xab')][_0x7bdb('0x104')](db['FreshdeskConfiguration'],{'as':_0x7bdb('0x1b5'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0x1c4')]['hasMany'](db[_0x7bdb('0xae')],{'as':'Subjects','onDelete':_0x7bdb('0x102'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x7bdb('0x104')](db[_0x7bdb('0xae')],{'as':'Descriptions','onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0x1c4')][_0x7bdb('0x104')](db[_0x7bdb('0xae')],{'as':_0x7bdb('0x1b2'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1bb')});db['FreshdeskConfiguration'][_0x7bdb('0x14a')](db[_0x7bdb('0xab')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x1b6')});db['FreshdeskConfiguration'][_0x7bdb('0x114')](db[_0x7bdb('0x86')],{'through':_0x7bdb('0x1c5')});db['FreshdeskField'][_0x7bdb('0x104')](db[_0x7bdb('0xae')],{'as':_0x7bdb('0x1bc'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0xae')][_0x7bdb('0x104')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x7bdb('0x104')](db[_0x7bdb('0xae')],{'as':_0x7bdb('0x1be'),'foreignKey':'FieldId'});db['FreshdeskField'][_0x7bdb('0x14a')](db[_0x7bdb('0x8a')],{'as':_0x7bdb('0x8a'),'foreignKey':'VariableId'});db['VtigerAccount']['hasMany'](db[_0x7bdb('0x1c6')],{'as':_0x7bdb('0x1b5'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0x1c6')][_0x7bdb('0x104')](db[_0x7bdb('0xb3')],{'as':_0x7bdb('0x1b7'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0x1c6')]['hasMany'](db[_0x7bdb('0xb3')],{'as':_0x7bdb('0x1b9'),'foreignKey':'DescriptionId'});db[_0x7bdb('0x1c6')][_0x7bdb('0x104')](db[_0x7bdb('0xb3')],{'as':'Fields','foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0x1c6')][_0x7bdb('0x14a')](db[_0x7bdb('0xb0')],{'as':'Account','foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0xb3')][_0x7bdb('0x104')](db[_0x7bdb('0xb3')],{'as':_0x7bdb('0x1bc'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0xb3')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0x7bdb('0x104')](db[_0x7bdb('0xb3')],{'as':_0x7bdb('0x1be'),'foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0xb3')]['belongsTo'](db[_0x7bdb('0x8a')],{'as':'Variable','foreignKey':_0x7bdb('0x1bf')});db[_0x7bdb('0x1c7')][_0x7bdb('0x104')](db[_0x7bdb('0x1c8')],{'as':'Configurations','onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0x1c8')][_0x7bdb('0x104')](db[_0x7bdb('0xb7')],{'as':_0x7bdb('0x1b7'),'foreignKey':'SubjectId'});db[_0x7bdb('0x1c8')][_0x7bdb('0x104')](db[_0x7bdb('0xb7')],{'as':_0x7bdb('0x1b9'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x7bdb('0x1b2'),'foreignKey':'FieldId'});db[_0x7bdb('0x1c8')][_0x7bdb('0x14a')](db['ServicenowAccount'],{'as':_0x7bdb('0x168'),'foreignKey':'AccountId'});db[_0x7bdb('0xb7')][_0x7bdb('0x104')](db[_0x7bdb('0xb7')],{'as':_0x7bdb('0x1bc'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0xb7')][_0x7bdb('0x104')](db[_0x7bdb('0xb7')],{'as':_0x7bdb('0x1bd'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0x7bdb('0x104')](db[_0x7bdb('0xb7')],{'as':_0x7bdb('0x1be'),'foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0xb7')]['belongsTo'](db['Variable'],{'as':_0x7bdb('0x8a'),'foreignKey':_0x7bdb('0x1bf')});db[_0x7bdb('0xb9')][_0x7bdb('0x104')](db[_0x7bdb('0xba')],{'as':_0x7bdb('0x1b5'),'onDelete':_0x7bdb('0x102'),'foreignKey':'AccountId'});db['Dynamics365Configuration'][_0x7bdb('0x104')](db[_0x7bdb('0xbc')],{'as':_0x7bdb('0x1b7'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0xba')][_0x7bdb('0x104')](db[_0x7bdb('0xbc')],{'as':'Descriptions','onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1ba')});db['Dynamics365Configuration'][_0x7bdb('0x104')](db[_0x7bdb('0xbc')],{'as':_0x7bdb('0x1b2'),'onDelete':'cascade','foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0xba')]['belongsTo'](db['Dynamics365Account'],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0xbc')][_0x7bdb('0x104')](db['Dynamics365Field'],{'as':_0x7bdb('0x1bc'),'foreignKey':'SubjectId'});db[_0x7bdb('0xbc')][_0x7bdb('0x104')](db[_0x7bdb('0xbc')],{'as':_0x7bdb('0x1bd'),'foreignKey':'DescriptionId'});db[_0x7bdb('0xbc')][_0x7bdb('0x104')](db[_0x7bdb('0xbc')],{'as':_0x7bdb('0x1be'),'foreignKey':_0x7bdb('0x1bb')});db['Dynamics365Field'][_0x7bdb('0x14a')](db[_0x7bdb('0x8a')],{'as':_0x7bdb('0x8a'),'foreignKey':_0x7bdb('0x1bf')});db['FreshsalesAccount'][_0x7bdb('0x104')](db['FreshsalesConfiguration'],{'as':_0x7bdb('0x1b5'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0x1c9')][_0x7bdb('0x104')](db[_0x7bdb('0xc0')],{'as':_0x7bdb('0x1b7'),'foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0x1c9')][_0x7bdb('0x104')](db[_0x7bdb('0xc0')],{'as':_0x7bdb('0x1b9'),'foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0x1c9')][_0x7bdb('0x104')](db[_0x7bdb('0xc0')],{'as':_0x7bdb('0x1b2'),'foreignKey':_0x7bdb('0x1bb')});db['FreshsalesConfiguration'][_0x7bdb('0x14a')](db['FreshsalesAccount'],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x1b6')});db[_0x7bdb('0xc0')]['hasMany'](db['FreshsalesField'],{'as':'Subject','foreignKey':_0x7bdb('0x1b8')});db[_0x7bdb('0xc0')][_0x7bdb('0x104')](db[_0x7bdb('0xc0')],{'as':_0x7bdb('0x1bd'),'foreignKey':_0x7bdb('0x1ba')});db[_0x7bdb('0xc0')][_0x7bdb('0x104')](db[_0x7bdb('0xc0')],{'as':_0x7bdb('0x1be'),'foreignKey':_0x7bdb('0x1bb')});db[_0x7bdb('0xc0')][_0x7bdb('0x14a')](db[_0x7bdb('0x8a')],{'as':_0x7bdb('0x8a'),'foreignKey':_0x7bdb('0x1bf')});db[_0x7bdb('0xc3')][_0x7bdb('0x14a')](db[_0x7bdb('0x5f')],{});db[_0x7bdb('0xc3')][_0x7bdb('0x14a')](db['CmList'],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0xc3')]['belongsTo'](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db['ChatQueueReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x10b')],{});db[_0x7bdb('0xc3')][_0x7bdb('0x14a')](db[_0x7bdb('0x189')],{});db[_0x7bdb('0xc3')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{});db[_0x7bdb('0xc3')][_0x7bdb('0x14a')](db['ChatQueue'],{});db['ChatInternalMessage']['belongsTo'](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1ca')});db[_0x7bdb('0xc4')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x1cb')});db[_0x7bdb('0xc9')][_0x7bdb('0x104')](db[_0x7bdb('0xc8')],{'foreignKey':'SessionId','onDelete':_0x7bdb('0x102')});db[_0x7bdb('0xc9')][_0x7bdb('0x104')](db['JscriptyAnswerReport'],{'foreignKey':_0x7bdb('0x1cc'),'onDelete':'cascade'});db[_0x7bdb('0xcb')][_0x7bdb('0x14a')](db[_0x7bdb('0x13a')],{});db['SmsQueueReport']['belongsTo'](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db['SmsQueueReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db[_0x7bdb('0xcb')]['belongsTo'](db[_0x7bdb('0x55')],{});db[_0x7bdb('0xcb')]['belongsTo'](db[_0x7bdb('0x57')],{});db['SmsQueueReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{});db[_0x7bdb('0xcb')][_0x7bdb('0x14a')](db['SmsQueue'],{});db[_0x7bdb('0xd0')][_0x7bdb('0x104')](db[_0x7bdb('0xc9')],{'foreignKey':_0x7bdb('0x1cd')});db['JscriptyProject'][_0x7bdb('0x104')](db[_0x7bdb('0xc8')],{'foreignKey':_0x7bdb('0x1cd')});db['JscriptyProject'][_0x7bdb('0x104')](db[_0x7bdb('0xc6')],{'foreignKey':_0x7bdb('0x1cd')});db[_0x7bdb('0xd5')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x16c'),'through':'user_has_square_projects'});db['Team'][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':'Agents','through':_0x7bdb('0x11a')});db[_0x7bdb('0x119')][_0x7bdb('0x114')](db[_0x7bdb('0x124')],{'through':_0x7bdb('0xfc'),'as':_0x7bdb('0x125')});db['Team'][_0x7bdb('0x114')](db[_0x7bdb('0x3d')],{'through':_0x7bdb('0x1ce'),'as':_0x7bdb('0x128')});db[_0x7bdb('0x119')]['belongsToMany'](db[_0x7bdb('0x129')],{'through':'team_has_chat_queues','as':_0x7bdb('0x12a')});db[_0x7bdb('0x119')][_0x7bdb('0x114')](db[_0x7bdb('0x12b')],{'through':_0x7bdb('0x179'),'as':'FaxQueues'});db[_0x7bdb('0x119')][_0x7bdb('0x114')](db[_0x7bdb('0x59')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team']['belongsToMany'](db[_0x7bdb('0x5e')],{'through':_0x7bdb('0x186'),'as':'OpenchannelQueues'});db[_0x7bdb('0x119')][_0x7bdb('0x114')](db['WhatsappQueue'],{'through':_0x7bdb('0x1cf'),'as':_0x7bdb('0x1d0')});db[_0x7bdb('0x119')][_0x7bdb('0x114')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db['Campaign'][_0x7bdb('0x104')](db[_0x7bdb('0x194')],{'as':_0x7bdb('0x195'),'foreignKey':_0x7bdb('0x19b')});db[_0x7bdb('0x199')][_0x7bdb('0x104')](db[_0x7bdb('0x109')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x7bdb('0x199')][_0x7bdb('0x104')](db[_0x7bdb('0x6f')],{'as':'HopperHistories','foreignKey':_0x7bdb('0x19b')});db['Campaign']['hasMany'](db['CmHopperBlack'],{'as':_0x7bdb('0x148'),'foreignKey':'CampaignId'});db[_0x7bdb('0x199')][_0x7bdb('0x14a')](db[_0x7bdb('0x2a')],{'as':'Trunk','foreignKey':_0x7bdb('0x14b')});db[_0x7bdb('0x199')][_0x7bdb('0x14a')](db[_0x7bdb('0x2a')],{'as':'TrunkBackup','foreignKey':_0x7bdb('0x1d1')});db['Campaign'][_0x7bdb('0x14a')](db['Interval'],{'as':_0x7bdb('0x171'),'foreignKey':_0x7bdb('0x14c')});db[_0x7bdb('0x199')][_0x7bdb('0x14a')](db[_0x7bdb('0xd5')],{'as':_0x7bdb('0xd5'),'foreignKey':_0x7bdb('0x1d2')});db['Campaign'][_0x7bdb('0x114')](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x117'),'through':'campaigns_has_cm_lists'});db[_0x7bdb('0x199')][_0x7bdb('0x114')](db['CmList'],{'as':'BlackLists','through':_0x7bdb('0x1d3')});db[_0x7bdb('0xde')][_0x7bdb('0x14a')](db[_0x7bdb('0x66')],{'as':_0x7bdb('0x66'),'foreignKey':_0x7bdb('0x16f')});db[_0x7bdb('0xe1')][_0x7bdb('0x14a')](db[_0x7bdb('0x41')],{});db[_0x7bdb('0xe1')][_0x7bdb('0x14a')](db['MailInteraction'],{});db[_0x7bdb('0xe1')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x7bdb('0x1d4'),'as':'FromAccount'});db[_0x7bdb('0xe1')][_0x7bdb('0x14a')](db['User'],{'foreignKey':_0x7bdb('0x1d5'),'as':_0x7bdb('0x1d6')});db['MailTransferReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d7'),'as':'ToAgent'});db[_0x7bdb('0xe1')]['belongsTo'](db[_0x7bdb('0x3d')],{'foreignKey':_0x7bdb('0x1d8'),'as':'ToQueue'});db['MailTransferReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x136')],{'foreignKey':_0x7bdb('0x1d9'),'as':'ToAccount'});db[_0x7bdb('0x1da')]['belongsTo'](db[_0x7bdb('0x189')],{});db[_0x7bdb('0x1da')][_0x7bdb('0x14a')](db['ChatInteraction'],{});db[_0x7bdb('0x1da')][_0x7bdb('0x14a')](db[_0x7bdb('0x5f')],{'foreignKey':_0x7bdb('0x1db'),'as':_0x7bdb('0x1dc')});db[_0x7bdb('0x1da')][_0x7bdb('0x14a')](db['User'],{'foreignKey':_0x7bdb('0x1d5'),'as':_0x7bdb('0x1d6')});db[_0x7bdb('0x1da')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d7'),'as':'ToAgent'});db[_0x7bdb('0x1da')][_0x7bdb('0x14a')](db['ChatQueue'],{'foreignKey':_0x7bdb('0x1dd'),'as':_0x7bdb('0x1de')});db['ChatTransferReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x5f')],{'foreignKey':_0x7bdb('0x1df'),'as':'ToAccount'});db[_0x7bdb('0xe4')][_0x7bdb('0x14a')](db[_0x7bdb('0x4d')],{});db[_0x7bdb('0xe4')][_0x7bdb('0x14a')](db['FaxInteraction'],{});db[_0x7bdb('0xe4')]['belongsTo'](db[_0x7bdb('0x48')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x7bdb('0xe4')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d5'),'as':'FromAgent'});db['FaxTransferReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d7'),'as':_0x7bdb('0x1e0')});db[_0x7bdb('0xe4')][_0x7bdb('0x14a')](db[_0x7bdb('0x12b')],{'foreignKey':_0x7bdb('0x1e1'),'as':_0x7bdb('0x1de')});db[_0x7bdb('0xe4')][_0x7bdb('0x14a')](db['FaxAccount'],{'foreignKey':_0x7bdb('0x1e2'),'as':'ToAccount'});db[_0x7bdb('0xe6')][_0x7bdb('0x14a')](db[_0x7bdb('0x5c')],{});db[_0x7bdb('0xe6')][_0x7bdb('0x14a')](db[_0x7bdb('0x120')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x7bdb('0x181')],{'foreignKey':'FromOpenchannelAccountId','as':_0x7bdb('0x1dc')});db[_0x7bdb('0xe6')]['belongsTo'](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d5'),'as':_0x7bdb('0x1d6')});db[_0x7bdb('0xe6')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d7'),'as':_0x7bdb('0x1e0')});db[_0x7bdb('0xe6')][_0x7bdb('0x14a')](db[_0x7bdb('0x5e')],{'foreignKey':_0x7bdb('0x1e3'),'as':'ToQueue'});db[_0x7bdb('0xe6')][_0x7bdb('0x14a')](db[_0x7bdb('0x181')],{'foreignKey':_0x7bdb('0x1e4'),'as':'ToAccount'});db['SmsTransferReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x57')],{});db[_0x7bdb('0xe8')][_0x7bdb('0x14a')](db['SmsInteraction'],{});db['SmsTransferReport']['belongsTo'](db[_0x7bdb('0x13a')],{'foreignKey':_0x7bdb('0x1e5'),'as':'FromAccount'});db['SmsTransferReport'][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d5'),'as':_0x7bdb('0x1d6')});db[_0x7bdb('0xe8')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d7'),'as':_0x7bdb('0x1e0')});db[_0x7bdb('0xe8')][_0x7bdb('0x14a')](db[_0x7bdb('0x59')],{'foreignKey':'ToSmsQueueId','as':_0x7bdb('0x1de')});db[_0x7bdb('0xe8')][_0x7bdb('0x14a')](db[_0x7bdb('0x13a')],{'foreignKey':'ToSmsAccountId','as':_0x7bdb('0x1e6')});db[_0x7bdb('0x131')]['hasMany'](db['Disposition'],{'as':_0x7bdb('0x17a'),'foreignKey':_0x7bdb('0x164'),'onDelete':_0x7bdb('0x102')});db['CmList'][_0x7bdb('0x104')](db['CmCustomField'],{'as':_0x7bdb('0x1e7'),'foreignKey':'ListId'});db[_0x7bdb('0x131')][_0x7bdb('0x104')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x1e8'),'onDelete':_0x7bdb('0x102'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0x131')][_0x7bdb('0x104')](db[_0x7bdb('0x109')],{'as':_0x7bdb('0x10a'),'foreignKey':_0x7bdb('0x164')});db['CmList']['hasMany'](db[_0x7bdb('0x6f')],{'as':_0x7bdb('0x1e9'),'foreignKey':'ListId'});db[_0x7bdb('0x131')][_0x7bdb('0x104')](db[_0x7bdb('0x71')],{'as':_0x7bdb('0x71'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0x131')][_0x7bdb('0x114')](db['VoiceQueue'],{'as':'Queues','through':_0x7bdb('0x1ea')});db[_0x7bdb('0x131')]['belongsToMany'](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x166'),'through':_0x7bdb('0x118')});db[_0x7bdb('0xeb')][_0x7bdb('0x104')](db[_0x7bdb('0x19')],{'as':_0x7bdb('0x108'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0xeb')][_0x7bdb('0x114')](db['User'],{'as':_0x7bdb('0x166'),'through':_0x7bdb('0x100')});db[_0x7bdb('0xeb')]['belongsToMany'](db[_0x7bdb('0x119')],{'through':_0x7bdb('0xfe'),'as':_0x7bdb('0x14f')});db[_0x7bdb('0xed')]['hasMany'](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x16c'),'foreignKey':_0x7bdb('0x112')});db[_0x7bdb('0xed')][_0x7bdb('0x104')](db[_0x7bdb('0x1eb')],{'as':_0x7bdb('0x1ec'),'foreignKey':_0x7bdb('0x112'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x1eb')][_0x7bdb('0x104')](db[_0x7bdb('0xef')],{'as':_0x7bdb('0x1ed'),'foreignKey':_0x7bdb('0x1ee'),'onDelete':_0x7bdb('0x102')});db['WhatsappAccount']['hasMany'](db[_0x7bdb('0x7a')],{'as':_0x7bdb('0x17a'),'foreignKey':_0x7bdb('0x1ef'),'onDelete':_0x7bdb('0x102')});db[_0x7bdb('0x13d')]['hasMany'](db['CannedAnswer'],{'as':_0x7bdb('0x161'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0x7bdb('0xf5')],{'as':_0x7bdb('0x152'),'foreignKey':_0x7bdb('0x1ef')});db['WhatsappAccount'][_0x7bdb('0x104')](db[_0x7bdb('0xf3')],{'as':_0x7bdb('0x162')});db['WhatsappAccount'][_0x7bdb('0x104')](db['WhatsappApplication'],{'as':'Applications'});db['WhatsappAccount']['belongsTo'](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':'ListId'});db[_0x7bdb('0x13d')]['belongsTo'](db[_0x7bdb('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x7bdb('0x14e')});db[_0x7bdb('0x13d')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':'Agents','through':_0x7bdb('0x13e')});db[_0x7bdb('0xf2')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0xf2')][_0x7bdb('0x14a')](db['WhatsappQueue'],{'onDelete':_0x7bdb('0x170')});db[_0x7bdb('0xf2')][_0x7bdb('0x14a')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x7bdb('0xf2')][_0x7bdb('0x14a')](db[_0x7bdb('0x171')],{'onDelete':_0x7bdb('0x170'),'foreignKey':'IntervalId'});db[_0x7bdb('0xf2')][_0x7bdb('0x14a')](db[_0x7bdb('0x86')],{'onDelete':_0x7bdb('0x170'),'foreignKey':_0x7bdb('0x172')});db[_0x7bdb('0xf3')][_0x7bdb('0x104')](db[_0x7bdb('0xf5')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x7bdb('0x1f0')});db[_0x7bdb('0xf3')][_0x7bdb('0x14a')](db[_0x7bdb('0x13d')],{'as':_0x7bdb('0x168'),'foreignKey':_0x7bdb('0x1ef')});db['WhatsappInteraction'][_0x7bdb('0x14a')](db['CmContact'],{'as':_0x7bdb('0x15b'),'foreignKey':_0x7bdb('0x15c')});db['WhatsappInteraction'][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x169'),'foreignKey':_0x7bdb('0x103')});db[_0x7bdb('0xf3')]['belongsToMany'](db[_0x7bdb('0x86')],{'through':_0x7bdb('0x1f1'),'as':_0x7bdb('0x16b')});db[_0x7bdb('0xf3')][_0x7bdb('0x114')](db['Tag'],{'through':_0x7bdb('0x1f1'),'as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x16c'),'through':'user_has_whatsapp_interactions','foreignKey':_0x7bdb('0x1f0')});db[_0x7bdb('0xf5')]['belongsTo'](db[_0x7bdb('0x13')],{'as':'User'});db[_0x7bdb('0xf5')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x15b')});db['WhatsappMessage'][_0x7bdb('0x14a')](db['WhatsappInteraction'],{'onDelete':_0x7bdb('0x102'),'as':_0x7bdb('0x16e'),'foreignKey':_0x7bdb('0x1f0')});db[_0x7bdb('0xf5')][_0x7bdb('0x14a')](db[_0x7bdb('0x13d')],{'as':'Account','foreignKey':_0x7bdb('0x1ef')});db[_0x7bdb('0xf6')][_0x7bdb('0x14a')](db[_0x7bdb('0x13d')],{});db[_0x7bdb('0xf6')][_0x7bdb('0x14a')](db[_0x7bdb('0x131')],{'as':_0x7bdb('0x163'),'foreignKey':_0x7bdb('0x164')});db[_0x7bdb('0xf6')][_0x7bdb('0x14a')](db[_0x7bdb('0x115')],{'as':_0x7bdb('0x15b'),'foreignKey':'ContactId'});db[_0x7bdb('0xf6')][_0x7bdb('0x14a')](db[_0x7bdb('0xf3')],{});db[_0x7bdb('0xf6')][_0x7bdb('0x14a')](db['WhatsappQueue'],{});db[_0x7bdb('0xf6')][_0x7bdb('0x14a')](db[_0x7bdb('0xf5')],{});db[_0x7bdb('0xf6')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{});db[_0x7bdb('0x1f2')][_0x7bdb('0x14a')](db[_0x7bdb('0xf5')],{});db['WhatsappTransferReport'][_0x7bdb('0x14a')](db[_0x7bdb('0xf3')],{});db[_0x7bdb('0x1f2')][_0x7bdb('0x14a')](db[_0x7bdb('0x13d')],{'foreignKey':_0x7bdb('0x1f3'),'as':'FromAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x7bdb('0x13d')],{'foreignKey':_0x7bdb('0x1f4'),'as':_0x7bdb('0x1e6')});db[_0x7bdb('0x1f2')][_0x7bdb('0x14a')](db[_0x7bdb('0x130')],{'foreignKey':_0x7bdb('0x1f5'),'as':_0x7bdb('0x1de')});db[_0x7bdb('0x1f2')][_0x7bdb('0x14a')](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d5'),'as':_0x7bdb('0x1d6')});db[_0x7bdb('0x1f2')]['belongsTo'](db[_0x7bdb('0x13')],{'foreignKey':_0x7bdb('0x1d7'),'as':_0x7bdb('0x1e0')});db[_0x7bdb('0x130')][_0x7bdb('0x114')](db[_0x7bdb('0x13')],{'as':_0x7bdb('0x166'),'through':_0x7bdb('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x7bdb('0x130')][_0x7bdb('0x114')](db[_0x7bdb('0x119')],{'through':_0x7bdb('0x1cf'),'as':_0x7bdb('0x14f')});module[_0x7bdb('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0beeeca..3bb88ca 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc931=['/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.0.0','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','resolve','get','appPath','/index.html','username','password','newPassword','street','phone','mobile','fax','email','securityToken','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','@@{','replace','}@@','lodash','express','util','./errors','./config/logger','api','auth','./safe-template','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','statusCode','responseTime','user','name','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','url','other','agent_name','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','/api/templates','/api/triggers','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account'];(function(_0x566c78,_0x47bd86){var _0x397ddd=function(_0x252fc4){while(--_0x252fc4){_0x566c78['push'](_0x566c78['shift']());}};_0x397ddd(++_0x47bd86);}(_0xc931,0x8c));var _0x1c93=function(_0x5df652,_0x4edc4c){_0x5df652=_0x5df652-0x0;var _0x1a1b46=_0xc931[_0x5df652];return _0x1a1b46;};'use strict';var _=require(_0x1c93('0x0'));var path=require('path');var express=require(_0x1c93('0x1'));var ewinston=require('express-winston');var util=require(_0x1c93('0x2'));var errors=require(_0x1c93('0x3'));var config=require('./config/environment');var logger=require(_0x1c93('0x4'))(_0x1c93('0x5'));var authLogger=require(_0x1c93('0x4'))(_0x1c93('0x6'));var safeTemplate=require(_0x1c93('0x7'))[_0x1c93('0x8')];exports[_0x1c93('0x9')]=function(_0x502c9a){_0x502c9a[_0x1c93('0xa')](ewinston[_0x1c93('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x15ed1c,_0x205f3b){var _0x39141d=_0x1c93('0xc');if(!_[_0x1c93('0xd')](_0x15ed1c['body'])){_0x39141d+='\x20body=%s';var _0x1fb308=_0x15ed1c[_0x1c93('0xe')];maskSensitiveData(_0x1fb308);}return safeTemplate(util[_0x1c93('0xf')](_0x39141d,_0x15ed1c[_0x1c93('0x10')],_0x15ed1c[_0x1c93('0x11')][_0x1c93('0x12')]?_0x15ed1c['headers']['x-forwarded-for']:_0x15ed1c[_0x1c93('0x13')]['remoteAddress']||_0x15ed1c['ip'],_0x15ed1c['url'],_0x205f3b[_0x1c93('0x14')],_0x205f3b[_0x1c93('0x15')],_0x15ed1c[_0x1c93('0x16')]?_0x15ed1c[_0x1c93('0x16')]['id']:null,_0x15ed1c[_0x1c93('0x16')]?_0x15ed1c['user'][_0x1c93('0x17')]:null,_0x15ed1c[_0x1c93('0x16')]?_0x15ed1c['user']['role']:null,_0x1fb308?util['inspect'](_0x1fb308,![],null):''));}}));_0x502c9a['use'](ewinston[_0x1c93('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x27be8b,_0x12fe80){var _0x3cd813=_0x1c93('0x18');if(_0x27be8b[_0x1c93('0xe')]&&_0x27be8b[_0x1c93('0xe')][_0x1c93('0x19')]&&_0x27be8b['body'][_0x1c93('0x1a')]){_0x3cd813=_0x1c93('0x1b');}return util[_0x1c93('0xf')](_0x3cd813,_0x27be8b['method'],_0x27be8b[_0x1c93('0x11')]['x-forwarded-for']?_0x27be8b['headers'][_0x1c93('0x12')]:_0x27be8b[_0x1c93('0x13')][_0x1c93('0x1c')]||_0x27be8b['ip'],_0x27be8b[_0x1c93('0x1d')],_0x12fe80[_0x1c93('0x14')],_0x12fe80['responseTime'],_0x27be8b[_0x1c93('0x16')]?_0x27be8b[_0x1c93('0x16')]['id']:null,_0x27be8b[_0x1c93('0x16')]?_0x27be8b['user'][_0x1c93('0x17')]:null,_0x27be8b[_0x1c93('0x16')]?_0x27be8b[_0x1c93('0x16')]['role']:null,_0x27be8b[_0x1c93('0xe')]&&_0x27be8b[_0x1c93('0xe')][_0x1c93('0x19')]?_0x27be8b[_0x1c93('0xe')][_0x1c93('0x19')]:_0x1c93('0x1e'),_0x27be8b['body']&&_0x27be8b[_0x1c93('0xe')]['agent_id']?_0x27be8b[_0x1c93('0xe')][_0x1c93('0x1a')]:'',_0x27be8b[_0x1c93('0xe')]&&_0x27be8b[_0x1c93('0xe')][_0x1c93('0x1f')]?_0x27be8b[_0x1c93('0xe')]['agent_name']:'');},'ignoreRoute':function(_0x3b745f){var _0x4b6dac=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4b6dac['test'](_0x3b745f[_0x1c93('0x1d')]);}}));_0x502c9a['use'](_0x1c93('0x20'),require('./api/user'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x21'),require(_0x1c93('0x22')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x23'),require(_0x1c93('0x24')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x25'),require(_0x1c93('0x26')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x27'),require(_0x1c93('0x28')));_0x502c9a['use'](_0x1c93('0x29'),require(_0x1c93('0x2a')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x2b'),require(_0x1c93('0x2c')));_0x502c9a[_0x1c93('0xa')]('/api/screen/recordings',require(_0x1c93('0x2d')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x2e'),require('./api/voiceMail'));_0x502c9a['use'](_0x1c93('0x2f'),require(_0x1c93('0x30')));_0x502c9a['use'](_0x1c93('0x31'),require(_0x1c93('0x32')));_0x502c9a[_0x1c93('0xa')]('/api/voice/dials/reports',require(_0x1c93('0x33')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x34'),require('./api/voiceAgentReport'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x35'),require(_0x1c93('0x36')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x37'),require(_0x1c93('0x38')));_0x502c9a['use'](_0x1c93('0x39'),require('./api/trunk'));_0x502c9a[_0x1c93('0xa')]('/api/voice/transfers/reports',require(_0x1c93('0x3a')));_0x502c9a[_0x1c93('0xa')]('/api/mail/out_servers',require(_0x1c93('0x3b')));_0x502c9a[_0x1c93('0xa')]('/api/mail/accounts',require(_0x1c93('0x3c')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x3d'),require(_0x1c93('0x3e')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x3f'),require('./api/mailSubstatus'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x40'),require(_0x1c93('0x41')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x42'),require(_0x1c93('0x43')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x44'),require('./api/mailApplication'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x45'),require(_0x1c93('0x46')));_0x502c9a[_0x1c93('0xa')]('/api/dashboards',require(_0x1c93('0x47')));_0x502c9a['use'](_0x1c93('0x48'),require('./api/dashboardItem'));_0x502c9a[_0x1c93('0xa')]('/api/fax/accounts',require(_0x1c93('0x49')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x4a'),require(_0x1c93('0x4b')));_0x502c9a['use'](_0x1c93('0x4c'),require('./api/faxInteraction'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x4d'),require(_0x1c93('0x4e')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x4f'),require(_0x1c93('0x50')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x51'),require(_0x1c93('0x52')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x53'),require(_0x1c93('0x54')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x55'),require('./api/smsApplication'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x56'),require(_0x1c93('0x57')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x58'),require(_0x1c93('0x59')));_0x502c9a[_0x1c93('0xa')]('/api/sms/queues',require('./api/smsQueue'));_0x502c9a[_0x1c93('0xa')]('/api/openchannel/accounts',require(_0x1c93('0x5a')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x5b'),require('./api/openchannelApplication'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x5c'),require('./api/openchannelInteraction'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x5d'),require(_0x1c93('0x5e')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x5f'),require('./api/openchannelQueue'));_0x502c9a[_0x1c93('0xa')]('/api/chat/websites',require('./api/chatWebsite'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x60'),require('./api/openchannelQueueReport'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x61'),require(_0x1c93('0x62')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x63'),require(_0x1c93('0x64')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x65'),require(_0x1c93('0x66')));_0x502c9a[_0x1c93('0xa')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x67'),require(_0x1c93('0x68')));_0x502c9a['use']('/api/chat/groups',require(_0x1c93('0x69')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x6a'),require(_0x1c93('0x6b')));_0x502c9a[_0x1c93('0xa')]('/api/cm/companies',require(_0x1c93('0x6c')));_0x502c9a[_0x1c93('0xa')]('/api/cm/contacts',require(_0x1c93('0x6d')));_0x502c9a['use']('/api/cm/hopper',require('./api/cmHopper'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x6e'),require(_0x1c93('0x6f')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x70'),require(_0x1c93('0x71')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x72'),require(_0x1c93('0x73')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x74'),require('./api/cmCustomField'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x75'),require('./api/action'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x76'),require('./api/automation'));_0x502c9a['use'](_0x1c93('0x77'),require(_0x1c93('0x78')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x79'),require(_0x1c93('0x7a')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x7b'),require('./api/condition'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x7c'),require(_0x1c93('0x7d')));_0x502c9a[_0x1c93('0xa')]('/api/pauses',require(_0x1c93('0x7e')));_0x502c9a['use'](_0x1c93('0x7f'),require('./api/cdr'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x80'),require(_0x1c93('0x81')));_0x502c9a[_0x1c93('0xa')]('/api/schedules',require(_0x1c93('0x82')));_0x502c9a['use']('/api/sounds',require(_0x1c93('0x83')));_0x502c9a['use'](_0x1c93('0x84'),require('./api/tag'));_0x502c9a['use'](_0x1c93('0x85'),require('./api/template'));_0x502c9a['use'](_0x1c93('0x86'),require('./api/trigger'));_0x502c9a[_0x1c93('0xa')]('/api/variables',require(_0x1c93('0x87')));_0x502c9a['use'](_0x1c93('0x88'),require('./api/integration'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x89'),require(_0x1c93('0x8a')));_0x502c9a[_0x1c93('0xa')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x8b'),require('./api/analyticDefaultReport'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x8c'),require(_0x1c93('0x8d')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x8e'),require(_0x1c93('0x8f')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x90'),require('./api/analyticFieldReport'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x91'),require('./api/analyticTreeReport'));_0x502c9a['use']('/api/integrations/salesforce/accounts',require(_0x1c93('0x92')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x93'),require('./api/intSalesforceConfiguration'));_0x502c9a[_0x1c93('0xa')]('/api/integrations/salesforce/fields',require(_0x1c93('0x94')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x95'),require('./api/intSugarcrmAccount'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x96'),require(_0x1c93('0x97')));_0x502c9a[_0x1c93('0xa')]('/api/integrations/sugarcrm/fields',require(_0x1c93('0x98')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x99'),require(_0x1c93('0x9a')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x9b'),require(_0x1c93('0x9c')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x9d'),require(_0x1c93('0x9e')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x9f'),require('./api/intZohoAccount'));_0x502c9a['use'](_0x1c93('0xa0'),require('./api/intZohoConfiguration'));_0x502c9a[_0x1c93('0xa')]('/api/integrations/zoho/fields',require(_0x1c93('0xa1')));_0x502c9a['use'](_0x1c93('0xa2'),require(_0x1c93('0xa3')));_0x502c9a['use'](_0x1c93('0xa4'),require('./api/intZendeskConfiguration'));_0x502c9a[_0x1c93('0xa')]('/api/integrations/zendesk/fields',require(_0x1c93('0xa5')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xa6'),require(_0x1c93('0xa7')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xa8'),require('./api/intFreshdeskConfiguration'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xa9'),require('./api/intFreshdeskField'));_0x502c9a[_0x1c93('0xa')]('/api/integrations/vtiger/accounts',require(_0x1c93('0xaa')));_0x502c9a['use'](_0x1c93('0xab'),require(_0x1c93('0xac')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xad'),require('./api/intVtigerField'));_0x502c9a[_0x1c93('0xa')]('/api/integrations/servicenow/accounts',require(_0x1c93('0xae')));_0x502c9a['use'](_0x1c93('0xaf'),require(_0x1c93('0xb0')));_0x502c9a['use'](_0x1c93('0xb1'),require('./api/intServicenowField'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xb2'),require(_0x1c93('0xb3')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xb4'),require(_0x1c93('0xb5')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xb6'),require(_0x1c93('0xb7')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xb8'),require(_0x1c93('0xb9')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xba'),require(_0x1c93('0xbb')));_0x502c9a['use'](_0x1c93('0xbc'),require(_0x1c93('0xbd')));_0x502c9a['use'](_0x1c93('0xbe'),require(_0x1c93('0xbf')));_0x502c9a['use'](_0x1c93('0xc0'),require(_0x1c93('0xc1')));_0x502c9a['use'](_0x1c93('0xc2'),require('./api/chatInternalMessage'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xc3'),require(_0x1c93('0xc4')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xc5'),require(_0x1c93('0xc6')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xc7'),require(_0x1c93('0xc8')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xc9'),require('./api/smsQueueReport'));_0x502c9a['use'](_0x1c93('0xca'),require(_0x1c93('0xcb')));_0x502c9a['use'](_0x1c93('0xcc'),require(_0x1c93('0xcd')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xce'),require(_0x1c93('0xcf')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xd0'),require(_0x1c93('0xd1')));_0x502c9a['use']('/api/square/odbc',require('./api/squareOdbc'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xd2'),require('./api/squareProject'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xd3'),require(_0x1c93('0xd4')));_0x502c9a[_0x1c93('0xa')]('/api/square/messages',require(_0x1c93('0xd5')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xd6'),require(_0x1c93('0xd7')));_0x502c9a['use']('/api/license',require(_0x1c93('0xd8')));_0x502c9a[_0x1c93('0xa')]('/api/campaigns',require(_0x1c93('0xd9')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xda'),require('./api/migration'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xdb'),require(_0x1c93('0xdc')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xdd'),require('./api/plugin'));_0x502c9a[_0x1c93('0xa')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x502c9a['use'](_0x1c93('0xde'),require(_0x1c93('0xdf')));_0x502c9a['use'](_0x1c93('0xe0'),require(_0x1c93('0xe1')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xe2'),require(_0x1c93('0xe3')));_0x502c9a[_0x1c93('0xa')]('/api/sms/reports/transfer',require(_0x1c93('0xe4')));_0x502c9a[_0x1c93('0xa')]('/api/cm/lists',require(_0x1c93('0xe5')));_0x502c9a[_0x1c93('0xa')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xe6'),require(_0x1c93('0xe7')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xe8'),require(_0x1c93('0xe9')));_0x502c9a['use'](_0x1c93('0xea'),require(_0x1c93('0xeb')));_0x502c9a['use'](_0x1c93('0xec'),require('./api/userNotification'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xed'),require(_0x1c93('0xee')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xef'),require(_0x1c93('0xf0')));_0x502c9a['use'](_0x1c93('0xf1'),require('./api/whatsappInteraction'));_0x502c9a[_0x1c93('0xa')]('/api/whatsapp/messages',require(_0x1c93('0xf2')));_0x502c9a[_0x1c93('0xa')]('/api/whatsapp/reports/queue',require(_0x1c93('0xf3')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xf4'),require(_0x1c93('0xf5')));_0x502c9a[_0x1c93('0xa')]('/api/whatsapp/queues',require(_0x1c93('0xf6')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xf7'),require(_0x1c93('0xf8')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xf9'),require(_0x1c93('0xfa')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xfb'),require(_0x1c93('0xfc')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0xfd'),require(_0x1c93('0xfe')));_0x502c9a[_0x1c93('0xa')]('/api/jira',require(_0x1c93('0xff')));_0x502c9a['use'](_0x1c93('0x100'),require(_0x1c93('0x101')));_0x502c9a['use'](_0x1c93('0x102'),require(_0x1c93('0x103')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x104'),require(_0x1c93('0x105')));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x106'),require(_0x1c93('0x107')));_0x502c9a[_0x1c93('0xa')]('/api/webbar',require('./api/webbar'));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x108'),express['static'](path[_0x1c93('0x109')](config[_0x1c93('0x10a')],_0x1c93('0x108'))));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x10b'),express[_0x1c93('0x10c')](path[_0x1c93('0x109')](config[_0x1c93('0x10a')],_0x1c93('0x10b'))));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x10d'),express['static'](path[_0x1c93('0x109')](config[_0x1c93('0x10a')],_0x1c93('0x10d'))));_0x502c9a['use'](_0x1c93('0x10e'),express[_0x1c93('0x10c')](path[_0x1c93('0x109')](config[_0x1c93('0x10a')],_0x1c93('0x10f'),_0x1c93('0x110'))));_0x502c9a[_0x1c93('0xa')](_0x1c93('0x111'),express[_0x1c93('0x10c')](path[_0x1c93('0x109')](config[_0x1c93('0x10a')],'/server/files/plugins')));_0x502c9a['route'](_0x1c93('0x112'))['get'](errors[0x194]);_0x502c9a[_0x1c93('0x113')]('/*')['get'](function(_0x44d273,_0x2f876c){_0x2f876c['sendFile'](path[_0x1c93('0x114')](_0x502c9a[_0x1c93('0x115')](_0x1c93('0x116'))+_0x1c93('0x117')));});};var sensitiveFields=[_0x1c93('0x118'),_0x1c93('0x119'),_0x1c93('0x11a'),'apiKey','firstName','lastName',_0x1c93('0x11b'),_0x1c93('0x11c'),_0x1c93('0x11d'),_0x1c93('0x11e'),_0x1c93('0x11f'),'clientId','clientSecret',_0x1c93('0x120'),'code',_0x1c93('0x121'),_0x1c93('0x122'),_0x1c93('0x123'),_0x1c93('0x124'),_0x1c93('0x125'),_0x1c93('0x126'),_0x1c93('0x127'),_0x1c93('0x128'),_0x1c93('0x129'),'membername',_0x1c93('0x12a'),_0x1c93('0x12b'),_0x1c93('0x12c'),_0x1c93('0x12d'),_0x1c93('0x12e'),_0x1c93('0x12f'),_0x1c93('0x130'),_0x1c93('0x131'),_0x1c93('0x132'),_0x1c93('0x16'),_0x1c93('0x133'),_0x1c93('0x134'),_0x1c93('0x135'),_0x1c93('0x136'),_0x1c93('0x137'),_0x1c93('0x138'),_0x1c93('0x139')];function maskSensitiveData(_0x1fc3d7){var _0xb994e2=/(?!^)[\s\S](?!$)/g;if(!_[_0x1c93('0x13a')](_0x1fc3d7))return;for(var _0x5b34f5 in _0x1fc3d7){if(_[_0x1c93('0x13b')](_0x1fc3d7[_0x5b34f5])){for(var _0x32715f=0x0;_0x32715f<_0x1fc3d7[_0x5b34f5][_0x1c93('0x13c')];_0x32715f++){maskSensitiveData(_0x1fc3d7[_0x5b34f5][_0x32715f]);}}else if(_['isPlainObject'](_0x1fc3d7[_0x5b34f5])){maskSensitiveData(_0x1fc3d7[_0x5b34f5]);}else if(_['isString'](_0x1fc3d7[_0x5b34f5])){_0x1fc3d7[_0x5b34f5]=_0x1fc3d7[_0x5b34f5]['replace'](/{{{/g,_0x1c93('0x13d'))[_0x1c93('0x13e')](/}}}/g,_0x1c93('0x13f'))[_0x1c93('0x13e')](/{{/g,'@{')[_0x1c93('0x13e')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x5b34f5)){_0x1fc3d7[_0x5b34f5]=_0x1fc3d7[_0x5b34f5][_0x1c93('0x13e')](_0xb994e2,'*');}}}} \ No newline at end of file +var _0x90d2=['./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/webbar','/apidoc','join','/www','static','root','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','exten','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','includes','lodash','path','express','express-winston','./errors','./config/logger','api','auth','safeTemplate','default','use','logger','isEmpty','body','format','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','other','agent_id','agent_name','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/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/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams'];(function(_0x1e9bf5,_0x2b8466){var _0x3e43a0=function(_0x4f74dd){while(--_0x4f74dd){_0x1e9bf5['push'](_0x1e9bf5['shift']());}};_0x3e43a0(++_0x2b8466);}(_0x90d2,0x64));var _0x290d=function(_0x39b4fc,_0x532cdd){_0x39b4fc=_0x39b4fc-0x0;var _0x4e57c1=_0x90d2[_0x39b4fc];return _0x4e57c1;};'use strict';var _=require(_0x290d('0x0'));var path=require(_0x290d('0x1'));var express=require(_0x290d('0x2'));var ewinston=require(_0x290d('0x3'));var util=require('util');var errors=require(_0x290d('0x4'));var config=require('./config/environment');var logger=require(_0x290d('0x5'))(_0x290d('0x6'));var authLogger=require(_0x290d('0x5'))(_0x290d('0x7'));var safeTemplate=require('./safe-template')[_0x290d('0x8')];exports[_0x290d('0x9')]=function(_0x588878){_0x588878[_0x290d('0xa')](ewinston[_0x290d('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2a2ba6,_0xc3da55){var _0x2fc6f4='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x290d('0xc')](_0x2a2ba6['body'])){_0x2fc6f4+='\x20body=%s';var _0x271e88=_0x2a2ba6[_0x290d('0xd')];maskSensitiveData(_0x271e88);}return safeTemplate(util[_0x290d('0xe')](_0x2fc6f4,_0x2a2ba6['method'],_0x2a2ba6['headers'][_0x290d('0xf')]?_0x2a2ba6[_0x290d('0x10')][_0x290d('0xf')]:_0x2a2ba6[_0x290d('0x11')][_0x290d('0x12')]||_0x2a2ba6['ip'],_0x2a2ba6[_0x290d('0x13')],_0xc3da55[_0x290d('0x14')],_0xc3da55[_0x290d('0x15')],_0x2a2ba6['user']?_0x2a2ba6['user']['id']:null,_0x2a2ba6['user']?_0x2a2ba6[_0x290d('0x16')][_0x290d('0x17')]:null,_0x2a2ba6[_0x290d('0x16')]?_0x2a2ba6['user']['role']:null,_0x271e88?util[_0x290d('0x18')](_0x271e88,![],null):''));}}));_0x588878[_0x290d('0xa')](ewinston[_0x290d('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x375eef,_0xe00b3a){var _0x4b20bb=_0x290d('0x19');if(_0x375eef[_0x290d('0xd')]&&_0x375eef[_0x290d('0xd')][_0x290d('0x1a')]&&_0x375eef[_0x290d('0xd')]['agent_id']){_0x4b20bb=_0x290d('0x1b');}return util[_0x290d('0xe')](_0x4b20bb,_0x375eef[_0x290d('0x1c')],_0x375eef[_0x290d('0x10')][_0x290d('0xf')]?_0x375eef[_0x290d('0x10')][_0x290d('0xf')]:_0x375eef['connection'][_0x290d('0x12')]||_0x375eef['ip'],_0x375eef[_0x290d('0x13')],_0xe00b3a['statusCode'],_0xe00b3a[_0x290d('0x15')],_0x375eef[_0x290d('0x16')]?_0x375eef[_0x290d('0x16')]['id']:null,_0x375eef[_0x290d('0x16')]?_0x375eef[_0x290d('0x16')]['name']:null,_0x375eef[_0x290d('0x16')]?_0x375eef['user']['role']:null,_0x375eef[_0x290d('0xd')]&&_0x375eef['body']['device']?_0x375eef[_0x290d('0xd')][_0x290d('0x1a')]:_0x290d('0x1d'),_0x375eef['body']&&_0x375eef['body'][_0x290d('0x1e')]?_0x375eef[_0x290d('0xd')][_0x290d('0x1e')]:'',_0x375eef[_0x290d('0xd')]&&_0x375eef[_0x290d('0xd')][_0x290d('0x1f')]?_0x375eef[_0x290d('0xd')][_0x290d('0x1f')]:'');},'ignoreRoute':function(_0x25e5b7){var _0x3ac7ec=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3ac7ec['test'](_0x25e5b7[_0x290d('0x13')]);}}));_0x588878[_0x290d('0xa')](_0x290d('0x20'),require('./api/user'));_0x588878['use'](_0x290d('0x21'),require(_0x290d('0x22')));_0x588878['use'](_0x290d('0x23'),require(_0x290d('0x24')));_0x588878[_0x290d('0xa')](_0x290d('0x25'),require(_0x290d('0x26')));_0x588878[_0x290d('0xa')]('/api/voice/mohs',require(_0x290d('0x27')));_0x588878['use'](_0x290d('0x28'),require(_0x290d('0x29')));_0x588878[_0x290d('0xa')](_0x290d('0x2a'),require(_0x290d('0x2b')));_0x588878[_0x290d('0xa')](_0x290d('0x2c'),require(_0x290d('0x2d')));_0x588878['use'](_0x290d('0x2e'),require(_0x290d('0x2f')));_0x588878[_0x290d('0xa')](_0x290d('0x30'),require(_0x290d('0x31')));_0x588878[_0x290d('0xa')]('/api/voice/calls/reports',require(_0x290d('0x32')));_0x588878['use'](_0x290d('0x33'),require(_0x290d('0x34')));_0x588878['use']('/api/voice/agents/reports',require(_0x290d('0x35')));_0x588878['use']('/api/voice/queues/reports',require(_0x290d('0x36')));_0x588878[_0x290d('0xa')]('/api/members/reports',require(_0x290d('0x37')));_0x588878['use'](_0x290d('0x38'),require(_0x290d('0x39')));_0x588878[_0x290d('0xa')](_0x290d('0x3a'),require('./api/voiceTransferReport'));_0x588878[_0x290d('0xa')](_0x290d('0x3b'),require(_0x290d('0x3c')));_0x588878['use'](_0x290d('0x3d'),require('./api/mailAccount'));_0x588878[_0x290d('0xa')](_0x290d('0x3e'),require(_0x290d('0x3f')));_0x588878['use'](_0x290d('0x40'),require(_0x290d('0x41')));_0x588878[_0x290d('0xa')](_0x290d('0x42'),require('./api/mailInteraction'));_0x588878[_0x290d('0xa')]('/api/mail/messages',require(_0x290d('0x43')));_0x588878[_0x290d('0xa')](_0x290d('0x44'),require(_0x290d('0x45')));_0x588878['use'](_0x290d('0x46'),require(_0x290d('0x47')));_0x588878[_0x290d('0xa')](_0x290d('0x48'),require(_0x290d('0x49')));_0x588878[_0x290d('0xa')](_0x290d('0x4a'),require(_0x290d('0x4b')));_0x588878[_0x290d('0xa')](_0x290d('0x4c'),require(_0x290d('0x4d')));_0x588878[_0x290d('0xa')](_0x290d('0x4e'),require(_0x290d('0x4f')));_0x588878[_0x290d('0xa')](_0x290d('0x50'),require(_0x290d('0x51')));_0x588878['use'](_0x290d('0x52'),require(_0x290d('0x53')));_0x588878[_0x290d('0xa')](_0x290d('0x54'),require(_0x290d('0x55')));_0x588878[_0x290d('0xa')](_0x290d('0x56'),require(_0x290d('0x57')));_0x588878[_0x290d('0xa')](_0x290d('0x58'),require(_0x290d('0x59')));_0x588878[_0x290d('0xa')](_0x290d('0x5a'),require(_0x290d('0x5b')));_0x588878['use']('/api/sms/interactions',require('./api/smsInteraction'));_0x588878[_0x290d('0xa')]('/api/sms/messages',require(_0x290d('0x5c')));_0x588878['use'](_0x290d('0x5d'),require(_0x290d('0x5e')));_0x588878[_0x290d('0xa')](_0x290d('0x5f'),require(_0x290d('0x60')));_0x588878[_0x290d('0xa')](_0x290d('0x61'),require('./api/openchannelApplication'));_0x588878[_0x290d('0xa')](_0x290d('0x62'),require(_0x290d('0x63')));_0x588878['use'](_0x290d('0x64'),require(_0x290d('0x65')));_0x588878[_0x290d('0xa')]('/api/openchannel/queues',require(_0x290d('0x66')));_0x588878[_0x290d('0xa')](_0x290d('0x67'),require(_0x290d('0x68')));_0x588878[_0x290d('0xa')](_0x290d('0x69'),require(_0x290d('0x6a')));_0x588878['use'](_0x290d('0x6b'),require('./api/chatApplication'));_0x588878['use'](_0x290d('0x6c'),require(_0x290d('0x6d')));_0x588878[_0x290d('0xa')](_0x290d('0x6e'),require(_0x290d('0x6f')));_0x588878['use'](_0x290d('0x70'),require(_0x290d('0x71')));_0x588878[_0x290d('0xa')](_0x290d('0x72'),require('./api/chatQueue'));_0x588878['use'](_0x290d('0x73'),require(_0x290d('0x74')));_0x588878['use'](_0x290d('0x75'),require(_0x290d('0x76')));_0x588878[_0x290d('0xa')](_0x290d('0x77'),require(_0x290d('0x78')));_0x588878[_0x290d('0xa')](_0x290d('0x79'),require(_0x290d('0x7a')));_0x588878[_0x290d('0xa')](_0x290d('0x7b'),require(_0x290d('0x7c')));_0x588878[_0x290d('0xa')](_0x290d('0x7d'),require(_0x290d('0x7e')));_0x588878[_0x290d('0xa')](_0x290d('0x7f'),require(_0x290d('0x80')));_0x588878[_0x290d('0xa')](_0x290d('0x81'),require('./api/cmHopperHistory'));_0x588878[_0x290d('0xa')]('/api/cm/custom_fields',require(_0x290d('0x82')));_0x588878[_0x290d('0xa')](_0x290d('0x83'),require('./api/action'));_0x588878['use'](_0x290d('0x84'),require(_0x290d('0x85')));_0x588878[_0x290d('0xa')](_0x290d('0x86'),require(_0x290d('0x87')));_0x588878['use']('/api/dispositions',require(_0x290d('0x88')));_0x588878[_0x290d('0xa')](_0x290d('0x89'),require(_0x290d('0x8a')));_0x588878[_0x290d('0xa')](_0x290d('0x8b'),require('./api/interval'));_0x588878[_0x290d('0xa')](_0x290d('0x8c'),require(_0x290d('0x8d')));_0x588878[_0x290d('0xa')](_0x290d('0x8e'),require(_0x290d('0x8f')));_0x588878[_0x290d('0xa')]('/api/voiceQueuesLog',require(_0x290d('0x90')));_0x588878['use'](_0x290d('0x91'),require('./api/schedule'));_0x588878[_0x290d('0xa')](_0x290d('0x92'),require(_0x290d('0x93')));_0x588878[_0x290d('0xa')]('/api/tags',require(_0x290d('0x94')));_0x588878[_0x290d('0xa')](_0x290d('0x95'),require('./api/template'));_0x588878[_0x290d('0xa')](_0x290d('0x96'),require(_0x290d('0x97')));_0x588878[_0x290d('0xa')](_0x290d('0x98'),require(_0x290d('0x99')));_0x588878[_0x290d('0xa')](_0x290d('0x9a'),require(_0x290d('0x9b')));_0x588878[_0x290d('0xa')](_0x290d('0x9c'),require(_0x290d('0x9d')));_0x588878[_0x290d('0xa')]('/api/analytics/custom_reports',require(_0x290d('0x9e')));_0x588878[_0x290d('0xa')](_0x290d('0x9f'),require(_0x290d('0xa0')));_0x588878['use']('/api/analytics/extracted_reports',require(_0x290d('0xa1')));_0x588878['use'](_0x290d('0xa2'),require('./api/analyticMetric'));_0x588878[_0x290d('0xa')](_0x290d('0xa3'),require(_0x290d('0xa4')));_0x588878[_0x290d('0xa')](_0x290d('0xa5'),require('./api/analyticTreeReport'));_0x588878[_0x290d('0xa')](_0x290d('0xa6'),require(_0x290d('0xa7')));_0x588878[_0x290d('0xa')](_0x290d('0xa8'),require(_0x290d('0xa9')));_0x588878['use'](_0x290d('0xaa'),require(_0x290d('0xab')));_0x588878[_0x290d('0xa')](_0x290d('0xac'),require(_0x290d('0xad')));_0x588878['use'](_0x290d('0xae'),require(_0x290d('0xaf')));_0x588878[_0x290d('0xa')]('/api/integrations/sugarcrm/fields',require(_0x290d('0xb0')));_0x588878[_0x290d('0xa')]('/api/integrations/desk/accounts',require(_0x290d('0xb1')));_0x588878['use']('/api/integrations/desk/configurations',require(_0x290d('0xb2')));_0x588878[_0x290d('0xa')]('/api/integrations/desk/fields',require(_0x290d('0xb3')));_0x588878[_0x290d('0xa')](_0x290d('0xb4'),require(_0x290d('0xb5')));_0x588878['use']('/api/integrations/zoho/configurations',require(_0x290d('0xb6')));_0x588878['use']('/api/integrations/zoho/fields',require(_0x290d('0xb7')));_0x588878[_0x290d('0xa')](_0x290d('0xb8'),require('./api/intZendeskAccount'));_0x588878[_0x290d('0xa')]('/api/integrations/zendesk/configurations',require(_0x290d('0xb9')));_0x588878[_0x290d('0xa')](_0x290d('0xba'),require(_0x290d('0xbb')));_0x588878[_0x290d('0xa')](_0x290d('0xbc'),require(_0x290d('0xbd')));_0x588878[_0x290d('0xa')](_0x290d('0xbe'),require(_0x290d('0xbf')));_0x588878[_0x290d('0xa')](_0x290d('0xc0'),require(_0x290d('0xc1')));_0x588878[_0x290d('0xa')](_0x290d('0xc2'),require('./api/intVtigerAccount'));_0x588878[_0x290d('0xa')]('/api/integrations/vtiger/configurations',require(_0x290d('0xc3')));_0x588878[_0x290d('0xa')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x588878[_0x290d('0xa')](_0x290d('0xc4'),require(_0x290d('0xc5')));_0x588878[_0x290d('0xa')](_0x290d('0xc6'),require(_0x290d('0xc7')));_0x588878[_0x290d('0xa')](_0x290d('0xc8'),require(_0x290d('0xc9')));_0x588878[_0x290d('0xa')](_0x290d('0xca'),require(_0x290d('0xcb')));_0x588878[_0x290d('0xa')](_0x290d('0xcc'),require(_0x290d('0xcd')));_0x588878['use'](_0x290d('0xce'),require(_0x290d('0xcf')));_0x588878[_0x290d('0xa')](_0x290d('0xd0'),require(_0x290d('0xd1')));_0x588878['use'](_0x290d('0xd2'),require(_0x290d('0xd3')));_0x588878[_0x290d('0xa')](_0x290d('0xd4'),require('./api/intFreshsalesField'));_0x588878[_0x290d('0xa')](_0x290d('0xd5'),require('./api/network'));_0x588878[_0x290d('0xa')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x588878['use'](_0x290d('0xd6'),require(_0x290d('0xd7')));_0x588878[_0x290d('0xa')]('/api/jscripty/answers/reports',require(_0x290d('0xd8')));_0x588878[_0x290d('0xa')](_0x290d('0xd9'),require('./api/jscriptyQuestionReport'));_0x588878[_0x290d('0xa')]('/api/jscripty/sessions/reports',require(_0x290d('0xda')));_0x588878[_0x290d('0xa')](_0x290d('0xdb'),require(_0x290d('0xdc')));_0x588878[_0x290d('0xa')](_0x290d('0xdd'),require(_0x290d('0xde')));_0x588878[_0x290d('0xa')](_0x290d('0xdf'),require(_0x290d('0xe0')));_0x588878[_0x290d('0xa')](_0x290d('0xe1'),require(_0x290d('0xe2')));_0x588878['use'](_0x290d('0xe3'),require(_0x290d('0xe4')));_0x588878[_0x290d('0xa')](_0x290d('0xe5'),require(_0x290d('0xe6')));_0x588878[_0x290d('0xa')](_0x290d('0xe7'),require(_0x290d('0xe8')));_0x588878[_0x290d('0xa')](_0x290d('0xe9'),require(_0x290d('0xea')));_0x588878[_0x290d('0xa')]('/api/square/messages',require(_0x290d('0xeb')));_0x588878['use'](_0x290d('0xec'),require(_0x290d('0xed')));_0x588878[_0x290d('0xa')](_0x290d('0xee'),require(_0x290d('0xef')));_0x588878['use'](_0x290d('0xf0'),require('./api/campaign'));_0x588878[_0x290d('0xa')](_0x290d('0xf1'),require(_0x290d('0xf2')));_0x588878[_0x290d('0xa')](_0x290d('0xf3'),require('./api/attachment'));_0x588878[_0x290d('0xa')](_0x290d('0xf4'),require(_0x290d('0xf5')));_0x588878['use'](_0x290d('0xf6'),require(_0x290d('0xf7')));_0x588878[_0x290d('0xa')]('/api/chat/reports/transfer',require(_0x290d('0xf8')));_0x588878[_0x290d('0xa')](_0x290d('0xf9'),require(_0x290d('0xfa')));_0x588878[_0x290d('0xa')](_0x290d('0xfb'),require('./api/openchannelTransferReport'));_0x588878[_0x290d('0xa')](_0x290d('0xfc'),require(_0x290d('0xfd')));_0x588878[_0x290d('0xa')](_0x290d('0xfe'),require(_0x290d('0xff')));_0x588878['use']('/api/voice/prefixes',require(_0x290d('0x100')));_0x588878[_0x290d('0xa')](_0x290d('0x101'),require('./api/userProfile'));_0x588878[_0x290d('0xa')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x588878[_0x290d('0xa')](_0x290d('0x102'),require('./api/userProfileResource'));_0x588878[_0x290d('0xa')]('/api/userNotifications',require(_0x290d('0x103')));_0x588878[_0x290d('0xa')](_0x290d('0x104'),require(_0x290d('0x105')));_0x588878[_0x290d('0xa')]('/api/whatsapp/applications',require(_0x290d('0x106')));_0x588878[_0x290d('0xa')](_0x290d('0x107'),require(_0x290d('0x108')));_0x588878['use'](_0x290d('0x109'),require('./api/whatsappMessage'));_0x588878[_0x290d('0xa')](_0x290d('0x10a'),require('./api/whatsappQueueReport'));_0x588878['use'](_0x290d('0x10b'),require(_0x290d('0x10c')));_0x588878[_0x290d('0xa')](_0x290d('0x10d'),require(_0x290d('0x10e')));_0x588878[_0x290d('0xa')](_0x290d('0x10f'),require(_0x290d('0x110')));_0x588878[_0x290d('0xa')](_0x290d('0x111'),require(_0x290d('0x112')));_0x588878[_0x290d('0xa')]('/api/auth/local',require('./api/authLocal'));_0x588878[_0x290d('0xa')]('/api/auth/google',require('./api/authGoogle'));_0x588878[_0x290d('0xa')](_0x290d('0x113'),require(_0x290d('0x114')));_0x588878[_0x290d('0xa')](_0x290d('0x115'),require(_0x290d('0x116')));_0x588878['use']('/api/version',require(_0x290d('0x117')));_0x588878[_0x290d('0xa')](_0x290d('0x118'),require('./api/system'));_0x588878[_0x290d('0xa')]('/api/pm2',require('./api/pm2'));_0x588878['use']('/api/webbar',require(_0x290d('0x119')));_0x588878[_0x290d('0xa')](_0x290d('0x11a'),express['static'](path[_0x290d('0x11b')](config['root'],_0x290d('0x11a'))));_0x588878[_0x290d('0xa')](_0x290d('0x11c'),express[_0x290d('0x11d')](path[_0x290d('0x11b')](config[_0x290d('0x11e')],_0x290d('0x11c'))));_0x588878[_0x290d('0xa')]('/demo',express[_0x290d('0x11d')](path[_0x290d('0x11b')](config[_0x290d('0x11e')],'/demo')));_0x588878[_0x290d('0xa')]('/snippet',express[_0x290d('0x11d')](path[_0x290d('0x11b')](config[_0x290d('0x11e')],'snippet',_0x290d('0x11f'))));_0x588878[_0x290d('0xa')](_0x290d('0x120'),express[_0x290d('0x11d')](path[_0x290d('0x11b')](config['root'],_0x290d('0x121'))));_0x588878[_0x290d('0x122')](_0x290d('0x123'))[_0x290d('0x124')](errors[0x194]);_0x588878[_0x290d('0x122')]('/*')[_0x290d('0x124')](function(_0x794866,_0x219a67){_0x219a67[_0x290d('0x125')](path[_0x290d('0x126')](_0x588878[_0x290d('0x124')](_0x290d('0x127'))+_0x290d('0x128')));});};var sensitiveFields=[_0x290d('0x129'),_0x290d('0x12a'),_0x290d('0x12b'),'apiKey',_0x290d('0x12c'),_0x290d('0x12d'),_0x290d('0x12e'),_0x290d('0x12f'),_0x290d('0x130'),_0x290d('0x131'),_0x290d('0x132'),_0x290d('0x133'),_0x290d('0x134'),_0x290d('0x135'),_0x290d('0x136'),'accessKey',_0x290d('0x137'),_0x290d('0x138'),_0x290d('0x139'),_0x290d('0x13a'),_0x290d('0x13b'),'authToken',_0x290d('0x13c'),_0x290d('0x13d'),_0x290d('0x13e'),_0x290d('0x13f'),'calleridnum',_0x290d('0x140'),'vidaooApiKey',_0x290d('0x141'),'privateKey',_0x290d('0x142'),_0x290d('0x143'),_0x290d('0x144'),'user',_0x290d('0x145'),_0x290d('0x146'),_0x290d('0x147'),'dsn',_0x290d('0x148'),_0x290d('0x149'),_0x290d('0x14a')];function maskSensitiveData(_0xe19b32){var _0x562d50=/(?!^)[\s\S](?!$)/g;if(!_[_0x290d('0x14b')](_0xe19b32))return;for(var _0x406948 in _0xe19b32){if(_[_0x290d('0x14c')](_0xe19b32[_0x406948])){for(var _0x3fb464=0x0;_0x3fb464<_0xe19b32[_0x406948][_0x290d('0x14d')];_0x3fb464++){maskSensitiveData(_0xe19b32[_0x406948][_0x3fb464]);}}else if(_[_0x290d('0x14b')](_0xe19b32[_0x406948])){maskSensitiveData(_0xe19b32[_0x406948]);}else if(_[_0x290d('0x14e')](_0xe19b32[_0x406948])){_0xe19b32[_0x406948]=_0xe19b32[_0x406948]['replace'](/{{{/g,'@@{')[_0x290d('0x14f')](/}}}/g,'}@@')[_0x290d('0x14f')](/{{/g,'@{')[_0x290d('0x14f')](/}}/g,'}@');if(_[_0x290d('0x150')](sensitiveFields,_0x406948)){_0xe19b32[_0x406948]=_0xe19b32[_0x406948][_0x290d('0x14f')](_0x562d50,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9481c33..02748b1 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x365c=['../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.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/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.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/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../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/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x365c,0x1de));var _0xc365=function(_0x18dd91,_0x2f0900){_0x18dd91=_0x18dd91-0x0;var _0x11cd61=_0x365c[_0x18dd91];return _0x11cd61;};'use strict';var jayson=require(_0xc365('0x0'));var BPromise=require(_0xc365('0x1'));var _=require(_0xc365('0x2'));var config=require(_0xc365('0x3'));exports[_0xc365('0x4')]=function(){return new BPromise(function(_0x477a5d,_0x5e7911){var _0x2c7ecc={};_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/user/user.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/voiceExtension/voiceExtension.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x6')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/voiceRecording/voiceRecording.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x7')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x8')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x9')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0xa')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0xb')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0xc')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0xd')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0xe')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0xf')));_0x2c7ecc=_['merge'](_0x2c7ecc,require('../api/mailQueue/mailQueue.rpc'));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x10')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x11')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x12')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x13')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x14')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x15')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x16')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x17')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x18')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x19')));_0x2c7ecc=_['merge'](_0x2c7ecc,require('../api/smsAccount/smsAccount.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x1a')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/smsMessage/smsMessage.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x1b')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x1c')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x1d')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x1e')));_0x2c7ecc=_['merge'](_0x2c7ecc,require('../api/chatMessage/chatMessage.rpc'));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x1f')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x20')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x21')));_0x2c7ecc=_['merge'](_0x2c7ecc,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x22')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x23')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x24')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x25')));_0x2c7ecc=_['merge'](_0x2c7ecc,require('../api/pause/pause.rpc'));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x26')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x27')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x28')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x29')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x2a')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x2b')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x2c')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x2d')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x2e')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x2f')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x30')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x31')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x32')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x33')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/squareReport/squareReport.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x34')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x35')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x36')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x37')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x38')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x39')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x3a')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x3b')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x3c')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x3d')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x3e')));_0x2c7ecc=_['merge'](_0x2c7ecc,require(_0xc365('0x3f')));_0x2c7ecc=_[_0xc365('0x5')](_0x2c7ecc,require(_0xc365('0x40')));var _0x4e990c=jayson['server'](_0x2c7ecc)[_0xc365('0x41')]();var _0x500b6a=config[_0xc365('0x42')]['port']||config[_0xc365('0x43')]+0x1;var _0x3f6711=config[_0xc365('0x42')]['ip']||_0xc365('0x44');_0x4e990c['on'](_0xc365('0x45'),function(_0x3f0d18){return _0x5e7911(_0x3f0d18);});_0x4e990c[_0xc365('0x4')](_0x500b6a,_0x3f6711,function(){console['log'](_0xc365('0x46'),_0x3f6711,_0x500b6a);require('../config/triggers')[_0xc365('0x47')]();return _0x477a5d(_0xc365('0x48')+_0x3f6711+':'+_0x500b6a);});});}; \ No newline at end of file +var _0x4c71=['../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','port','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','merge','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.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'];(function(_0xe5a01e,_0x3b6713){var _0x2cd4f6=function(_0x306f2c){while(--_0x306f2c){_0xe5a01e['push'](_0xe5a01e['shift']());}};_0x2cd4f6(++_0x3b6713);}(_0x4c71,0x16a));var _0x14c7=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x4c71[_0x346737];return _0x1ade2e;};'use strict';var jayson=require(_0x14c7('0x0'));var BPromise=require(_0x14c7('0x1'));var _=require(_0x14c7('0x2'));var config=require(_0x14c7('0x3'));exports['listen']=function(){return new BPromise(function(_0xb46bc,_0x448ee1){var _0x541910={};_0x541910=_['merge'](_0x541910,require(_0x14c7('0x4')));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x5')));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x6')));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x7')));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x8')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0xa')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0xb')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0xc')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0xd')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0xe')));_0x541910=_['merge'](_0x541910,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x541910=_['merge'](_0x541910,require(_0x14c7('0xf')));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x10')));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x11')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x12')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/mailInteraction/mailInteraction.rpc'));_0x541910=_['merge'](_0x541910,require('../api/mailMessage/mailMessage.rpc'));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x13')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/faxAccount/faxAccount.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x14')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/faxInteraction/faxInteraction.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x15')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x16')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x17')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x18')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x19')));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x1a')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/smsQueue/smsQueue.rpc'));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x1b')));_0x541910=_['merge'](_0x541910,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x1c')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x1d')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x1e')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/chatQueue/chatQueue.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x1f')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x20')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x21')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x22')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x23')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x24')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x25')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x26')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x27')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x28')));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x29')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x2a')));_0x541910=_['merge'](_0x541910,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x2b')));_0x541910=_['merge'](_0x541910,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x2c')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x2d')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x2e')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x2f')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x30')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x31')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x32')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/setting/setting.rpc'));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x33')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x34')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x35')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x36')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/campaign/campaign.rpc'));_0x541910=_['merge'](_0x541910,require(_0x14c7('0x37')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x38')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x39')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x3a')));_0x541910=_[_0x14c7('0x9')](_0x541910,require(_0x14c7('0x3b')));_0x541910=_[_0x14c7('0x9')](_0x541910,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x541910=_['merge'](_0x541910,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x5ad243=jayson[_0x14c7('0x3c')](_0x541910)[_0x14c7('0x3d')]();var _0x42565f=config[_0x14c7('0x3e')][_0x14c7('0x3f')]||config[_0x14c7('0x3f')]+0x1;var _0x5506f1=config[_0x14c7('0x3e')]['ip']||'localhost';_0x5ad243['on'](_0x14c7('0x40'),function(_0x52866b){return _0x448ee1(_0x52866b);});_0x5ad243[_0x14c7('0x41')](_0x42565f,_0x5506f1,function(){console['log'](_0x14c7('0x42'),_0x5506f1,_0x42565f);require(_0x14c7('0x43'))[_0x14c7('0x44')]();return _0xb46bc(_0x14c7('0x45')+_0x5506f1+':'+_0x42565f);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 97ede74..fef2749 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['\x20}\x20}','string','replace','map','isPlainObject','keys','exports','safeTemplate'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x61c60c){return _0x61c60c==='{{'?'{\x20{\x20':_0x65f6('0x0');}function safeTemplate(_0x2f06ae){var _0x3461cd=_0x2f06ae;if(typeof _0x2f06ae===_0x65f6('0x1')){_0x3461cd=_0x2f06ae[_0x65f6('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x2f06ae)){_0x3461cd=_0x2f06ae[_0x65f6('0x3')](function(_0x5150c8){return safeTemplate(_0x5150c8);});}else if(_[_0x65f6('0x4')](_0x2f06ae)){_0x3461cd=Object[_0x65f6('0x5')](_0x2f06ae)['reduce'](function(_0x4ed98f,_0x1c0e12){_0x4ed98f[_0x1c0e12]=safeTemplate(_0x2f06ae[_0x1c0e12]);return _0x4ed98f;},{});}return _0x3461cd;}module[_0x65f6('0x6')][_0x65f6('0x7')]=safeTemplate; \ No newline at end of file +var _0xef0f=['lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','isPlainObject','keys','reduce','safeTemplate'];(function(_0x335dae,_0x2d9854){var _0x358893=function(_0x255937){while(--_0x255937){_0x335dae['push'](_0x335dae['shift']());}};_0x358893(++_0x2d9854);}(_0xef0f,0x168));var _0xfef0=function(_0xc10a88,_0x38b3f9){_0xc10a88=_0xc10a88-0x0;var _0x263183=_0xef0f[_0xc10a88];return _0x263183;};var _=require(_0xfef0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x581303){return _0x581303==='{{'?_0xfef0('0x1'):_0xfef0('0x2');}function safeTemplate(_0x19f865){var _0x4d29e5=_0x19f865;if(typeof _0x19f865===_0xfef0('0x3')){_0x4d29e5=_0x19f865[_0xfef0('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfef0('0x5')](_0x19f865)){_0x4d29e5=_0x19f865['map'](function(_0x2a6fcf){return safeTemplate(_0x2a6fcf);});}else if(_[_0xfef0('0x6')](_0x19f865)){_0x4d29e5=Object[_0xfef0('0x7')](_0x19f865)[_0xfef0('0x8')](function(_0xad43e,_0x11dfd7){_0xad43e[_0x11dfd7]=safeTemplate(_0x19f865[_0x11dfd7]);return _0xad43e;},{});}return _0x4d29e5;}module['exports'][_0xfef0('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 554eb64..e04d2d3 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 _0xe641=['agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','function','write','command','answer','sendRequest','ANSWER','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22'];(function(_0x2b42fc,_0x1430d6){var _0x29c048=function(_0x4bf8b4){while(--_0x4bf8b4){_0x2b42fc['push'](_0x2b42fc['shift']());}};_0x29c048(++_0x1430d6);}(_0xe641,0x1ec));var _0x1e64=function(_0x16be62,_0x524f28){_0x16be62=_0x16be62-0x0;var _0x252696=_0xe641[_0x16be62];return _0x252696;};'use strict';var util=require(_0x1e64('0x0'));var _=require(_0x1e64('0x1'));var EventEmitter=require('events')[_0x1e64('0x2')];var AGIReply=require(_0x1e64('0x3'));var AGIError=require(_0x1e64('0x4'));function AGIChannel(_0x41cb70){var _0x2cbc48=this,_0x18dd32=new AGIReply(),_0x36ab98=![],_0x402c70={};EventEmitter[_0x1e64('0x5')](_0x2cbc48);_0x41cb70[_0x1e64('0x6')](_0x1e64('0x7'));_0x41cb70['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x18dd32['setEncoding'](_0x1e64('0x7'));_0x18dd32['on'](_0x1e64('0x8'),function(_0x1fd2bb){for(var _0x279421 in _0x1fd2bb){_0x2cbc48[_0x279421]=_0x1fd2bb[_0x279421];}_0x2cbc48[_0x1e64('0x9')]('ready');});_0x18dd32['on'](_0x1e64('0xa'),function(_0x3e62d8){if(_0x3e62d8[_0x1e64('0xb')]()=='hangup'){_0x2cbc48['emit'](_0x1e64('0xc'));return;}if(_0x3e62d8[_0x1e64('0xd')](0x0,0xb)==_0x1e64('0xe')){_0x36ab98=!![];}if(_0x36ab98){_0x402c70['rx']+=_0x3e62d8+'\x0a';if(_0x3e62d8[_0x1e64('0xf')](_0x1e64('0x10'))!=-0x1){_0x36ab98=![];}}else{_0x402c70['rx']=_0x3e62d8;}if(_0x36ab98){return;}if(typeof _0x402c70['cb']=='function'){var _0x3cadce=_0x402c70['rx'][_0x1e64('0xd')](0x0,0x3),_0x39e96d=null,_0x3a8937=null;_0x3cadce=parseInt(_0x3cadce);if(isNaN(_0x3cadce)){_0x402c70['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1e64('0x11')});return;}if(_0x3cadce!=0xc8){_0x402c70['cb'](null,{'code':_0x3cadce,'result':-0x1,'extra':'KO'});return;}_0x39e96d=_0x402c70['rx'][_0x1e64('0xd')](0x4)[_0x1e64('0x12')](_0x1e64('0x13'),'');if(_0x39e96d['indexOf']('\x20')!=-0x1){_0x39e96d=_0x39e96d[_0x1e64('0x14')](0x0,_0x39e96d[_0x1e64('0x15')]('\x20'));}if(_[_0x1e64('0x16')](_0x39e96d,'-1')){_0x39e96d=parseInt(_0x39e96d);}_0x3a8937=_0x402c70['rx'][_0x1e64('0x17')]('\x20');if(_0x3a8937[_0x1e64('0x18')]==0x3){_0x3a8937=_0x3a8937[0x2][_0x1e64('0xd')](0x1,_0x3a8937[0x2]['length']-0x1);}else if(_0x3a8937['length']>0x3){var _0x4d2e35=/\((.+)\)/;var _0x7cc083=_0x402c70['rx'][_0x1e64('0x19')](_0x4d2e35);if(_0x7cc083){_0x3a8937=_0x7cc083[0x1];}else{_0x3a8937=null;}}else{_0x3a8937=null;}_0x402c70['cb'](null,{'code':_0x3cadce,'result':_0x39e96d,'extra':_0x3a8937});}});_0x41cb70['on'](_0x1e64('0x1a'),function(_0x959359){_0x2cbc48[_0x1e64('0x9')]('error',new AGIError(_0x1e64('0x1b'),_0x959359[_0x1e64('0x1c')]));});_0x41cb70['on'](_0x1e64('0x1d'),function(){_0x2cbc48[_0x1e64('0x9')]('close',new AGIError(_0x1e64('0x1e')));});_0x41cb70['on']('timeout',function(){_0x2cbc48[_0x1e64('0x9')](_0x1e64('0x1f'),new AGIError(_0x1e64('0x20')));_0x41cb70[_0x1e64('0x21')]();});_0x41cb70[_0x1e64('0x22')](_0x18dd32);this['command']=function(_0x45caa2,_0x1d32ee){var _0x45caa2=_0x45caa2||'',_0x1d32ee=typeof _0x1d32ee==_0x1e64('0x23')?_0x1d32ee:new Function();_0x402c70={'tx':_0x45caa2,'rx':'','cb':_0x1d32ee};_0x41cb70[_0x1e64('0x24')](_0x45caa2+'\x0a');},this['close']=function(){_0x41cb70[_0x1e64('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x633888){return this[_0x1e64('0x25')]['sync'](this,_0x633888);};AGIChannel['prototype'][_0x1e64('0x26')]=function(){return this[_0x1e64('0x27')](_0x1e64('0x28'));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x2a')]=function(_0x4cda06,_0x381811,_0x704a41){_0x4cda06=_0x4cda06===undefined?_0x1e64('0x2b'):_0x4cda06;_0x381811=_0x381811===undefined?'5':_0x381811;_0x704a41=_0x704a41===undefined?'1':_0x704a41;return this[_0x1e64('0x27')](util[_0x1e64('0x2c')](_0x1e64('0x2d'),_0x4cda06,_0x381811*0x3e8,_0x704a41));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x2e')]=function(_0x5d79f6){_0x5d79f6=_0x5d79f6||'NO\x20MESSAGE';return this['sendRequest'](util[_0x1e64('0x2c')](_0x1e64('0x2f'),_0x5d79f6));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x30')]=function(_0xdfc268,_0x6b94f0){if(_[_0x1e64('0x31')](_0x6b94f0)){return this['sendRequest'](util[_0x1e64('0x2c')]('EXEC\x20%s\x20%s',_0xdfc268,_0x6b94f0[_0x1e64('0x32')](',')));}return this[_0x1e64('0x27')](util[_0x1e64('0x2c')](_0x1e64('0x33'),_0xdfc268,_0x6b94f0));};AGIChannel[_0x1e64('0x29')]['setContext']=function(_0x467c49){return this['sendRequest'](util['format'](_0x1e64('0x34'),_0x467c49));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x35')]=function(_0xecee1a){return this[_0x1e64('0x27')](util[_0x1e64('0x2c')](_0x1e64('0x36'),_0xecee1a));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x37')]=function(_0x467678){return this['sendRequest'](util[_0x1e64('0x2c')](_0x1e64('0x38'),_0x467678));};AGIChannel[_0x1e64('0x29')][_0x1e64('0xc')]=function(){return this[_0x1e64('0x27')]('HANGUP');};AGIChannel[_0x1e64('0x29')][_0x1e64('0x39')]=function(_0x5b61f0,_0xda849){var _0x1571ac=_[_0x1e64('0x3a')](_0xda849)||_[_0x1e64('0x3b')](_0xda849)?_0xda849[_0x1e64('0x3c')]():_0xda849;return this[_0x1e64('0x27')](util[_0x1e64('0x2c')](_0x1e64('0x3d'),_0x5b61f0,_0x1571ac?_0x1571ac[_0x1e64('0x3c')]()[_0x1e64('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x217300,_0x24bb42){return this[_0x1e64('0x27')](util[_0x1e64('0x2c')](_0x1e64('0x3e'),_0x217300,_0x24bb42));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x3f')]=function(_0xce5931,_0x23f08d){return this[_0x1e64('0x27')](util['format'](_0x1e64('0x40'),_0xce5931,_0x23f08d));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x41')]=function(_0x5a84a4,_0x2ca54b){return this['sendRequest'](util[_0x1e64('0x2c')](_0x1e64('0x42'),_0x5a84a4,_0x2ca54b));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x43')]=function(_0x408f87,_0x4b81b6,_0x5e426b){_0x4b81b6=_0x4b81b6||this[_0x1e64('0x44')];_0x5e426b=_0x5e426b||0x1;this[_0x1e64('0x45')](_0x408f87);this[_0x1e64('0x35')](_0x4b81b6);this['setPriority'](_0x5e426b);return this[_0x1e64('0x2e')](util[_0x1e64('0x2c')](_0x1e64('0x46'),_0x408f87,_0x4b81b6,_0x5e426b));};AGIChannel[_0x1e64('0x29')]['getVariable']=function(_0x133976){return this[_0x1e64('0x27')](util[_0x1e64('0x2c')](_0x1e64('0x47'),_0x133976));};AGIChannel[_0x1e64('0x29')]['recordFile']=function(_0x33503c,_0x313ede,_0x19e738,_0x313699,_0x3d5153,_0x2dfd08){_0x313ede=_0x313ede||'wav';_0x19e738=_0x19e738||'';_0x313699=_0x313699===undefined?-0x1:_0x313699==='-1'?-0x1:_0x313699*0x3e8;_0x3d5153=_0x3d5153===undefined?'':'s='+_0x3d5153;_0x2dfd08=_0x2dfd08?_0x1e64('0x48'):'';return this['sendRequest'](util[_0x1e64('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x33503c,_0x313ede,_0x19e738,_0x313699,_0x2dfd08,_0x3d5153));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x49')]=function(_0x1e8157,_0x453cc1){_0x453cc1=_0x453cc1||'';return this[_0x1e64('0x27')](util[_0x1e64('0x2c')](_0x1e64('0x4a'),_0x1e8157,_0x453cc1));};AGIChannel[_0x1e64('0x29')][_0x1e64('0x4b')]=function(_0x5b6382){return this[_0x1e64('0x30')](_0x1e64('0x4c'),_0x5b6382);};AGIChannel['prototype'][_0x1e64('0x4d')]=function(_0x6eccf2){return this[_0x1e64('0x30')](_0x1e64('0x4e'),_0x6eccf2);};AGIChannel[_0x1e64('0x29')]['error']=function(_0xd0ee6e,_0x2c9a4f){this[_0x1e64('0x2e')](util['format'](_0x1e64('0x4f'),_0xd0ee6e['id'],_0xd0ee6e['label'],_0x2c9a4f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1e64('0x50')]=AGIChannel; \ No newline at end of file +var _0x7031=['sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','exec','AGI','wait','WAIT','label','exports','util','lodash','EventEmitter','./reply','setEncoding','setTimeout','utf8','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','pipe','command','write','destroy','inherits','prototype','sync'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7031,0x19a));var _0x1703=function(_0x488c71,_0x30c149){_0x488c71=_0x488c71-0x0;var _0x3a13ae=_0x7031[_0x488c71];return _0x3a13ae;};'use strict';var util=require(_0x1703('0x0'));var _=require(_0x1703('0x1'));var EventEmitter=require('events')[_0x1703('0x2')];var AGIReply=require(_0x1703('0x3'));var AGIError=require('./error');function AGIChannel(_0x1ac05c){var _0x193f2a=this,_0x520961=new AGIReply(),_0x1ad53b=![],_0x438115={};EventEmitter['call'](_0x193f2a);_0x1ac05c[_0x1703('0x4')]('utf8');_0x1ac05c[_0x1703('0x5')](0x8*0x3c*0x3c*0x3e8);_0x520961[_0x1703('0x4')](_0x1703('0x6'));_0x520961['on']('headers',function(_0x1cba9a){for(var _0x3acf9c in _0x1cba9a){_0x193f2a[_0x3acf9c]=_0x1cba9a[_0x3acf9c];}_0x193f2a[_0x1703('0x7')]('ready');});_0x520961['on'](_0x1703('0x8'),function(_0x3feed6){if(_0x3feed6[_0x1703('0x9')]()==_0x1703('0xa')){_0x193f2a[_0x1703('0x7')](_0x1703('0xa'));return;}if(_0x3feed6[_0x1703('0xb')](0x0,0xb)==_0x1703('0xc')){_0x1ad53b=!![];}if(_0x1ad53b){_0x438115['rx']+=_0x3feed6+'\x0a';if(_0x3feed6[_0x1703('0xd')](_0x1703('0xe'))!=-0x1){_0x1ad53b=![];}}else{_0x438115['rx']=_0x3feed6;}if(_0x1ad53b){return;}if(typeof _0x438115['cb']==_0x1703('0xf')){var _0x3cfcec=_0x438115['rx'][_0x1703('0xb')](0x0,0x3),_0x157055=null,_0x24b81e=null;_0x3cfcec=parseInt(_0x3cfcec);if(isNaN(_0x3cfcec)){_0x438115['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1703('0x10')});return;}if(_0x3cfcec!=0xc8){_0x438115['cb'](null,{'code':_0x3cfcec,'result':-0x1,'extra':'KO'});return;}_0x157055=_0x438115['rx'][_0x1703('0xb')](0x4)['replace']('result=','');if(_0x157055[_0x1703('0x11')]('\x20')!=-0x1){_0x157055=_0x157055[_0x1703('0x12')](0x0,_0x157055['indexOf']('\x20'));}if(_[_0x1703('0x13')](_0x157055,'-1')){_0x157055=parseInt(_0x157055);}_0x24b81e=_0x438115['rx'][_0x1703('0x14')]('\x20');if(_0x24b81e[_0x1703('0x15')]==0x3){_0x24b81e=_0x24b81e[0x2]['substring'](0x1,_0x24b81e[0x2][_0x1703('0x15')]-0x1);}else if(_0x24b81e[_0x1703('0x15')]>0x3){var _0x4d53d1=/\((.+)\)/;var _0x303c3b=_0x438115['rx'][_0x1703('0x16')](_0x4d53d1);if(_0x303c3b){_0x24b81e=_0x303c3b[0x1];}else{_0x24b81e=null;}}else{_0x24b81e=null;}_0x438115['cb'](null,{'code':_0x3cfcec,'result':_0x157055,'extra':_0x24b81e});}});_0x1ac05c['on'](_0x1703('0x17'),function(_0x3c0695){_0x193f2a[_0x1703('0x7')](_0x1703('0x17'),new AGIError(_0x1703('0x18'),_0x3c0695['code']));});_0x1ac05c['on']('close',function(){_0x193f2a['emit'](_0x1703('0x19'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x1ac05c['on'](_0x1703('0x1a'),function(){_0x193f2a[_0x1703('0x7')](_0x1703('0x1a'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1ac05c['destroy']();});_0x1ac05c[_0x1703('0x1b')](_0x520961);this[_0x1703('0x1c')]=function(_0x41f7b3,_0x2bf640){var _0x41f7b3=_0x41f7b3||'',_0x2bf640=typeof _0x2bf640=='function'?_0x2bf640:new Function();_0x438115={'tx':_0x41f7b3,'rx':'','cb':_0x2bf640};_0x1ac05c[_0x1703('0x1d')](_0x41f7b3+'\x0a');},this[_0x1703('0x19')]=function(){_0x1ac05c[_0x1703('0x1e')]();};}util[_0x1703('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x1703('0x20')]['sendRequest']=function(_0x4a35c2){return this[_0x1703('0x1c')][_0x1703('0x21')](this,_0x4a35c2);};AGIChannel[_0x1703('0x20')]['answer']=function(){return this[_0x1703('0x22')](_0x1703('0x23'));};AGIChannel[_0x1703('0x20')][_0x1703('0x24')]=function(_0x59b809,_0x509424,_0x38afcf){_0x59b809=_0x59b809===undefined?_0x1703('0x25'):_0x59b809;_0x509424=_0x509424===undefined?'5':_0x509424;_0x38afcf=_0x38afcf===undefined?'1':_0x38afcf;return this['sendRequest'](util[_0x1703('0x26')](_0x1703('0x27'),_0x59b809,_0x509424*0x3e8,_0x38afcf));};AGIChannel[_0x1703('0x20')][_0x1703('0x28')]=function(_0x525f06){_0x525f06=_0x525f06||'NO\x20MESSAGE';return this['sendRequest'](util[_0x1703('0x26')](_0x1703('0x29'),_0x525f06));};AGIChannel[_0x1703('0x20')]['exec']=function(_0x304968,_0x179082){if(_[_0x1703('0x2a')](_0x179082)){return this[_0x1703('0x22')](util[_0x1703('0x26')](_0x1703('0x2b'),_0x304968,_0x179082['join'](',')));}return this[_0x1703('0x22')](util[_0x1703('0x26')](_0x1703('0x2b'),_0x304968,_0x179082));};AGIChannel[_0x1703('0x20')]['setContext']=function(_0x434c7e){return this['sendRequest'](util[_0x1703('0x26')](_0x1703('0x2c'),_0x434c7e));};AGIChannel['prototype']['setExtension']=function(_0xfdc7d5){return this[_0x1703('0x22')](util['format'](_0x1703('0x2d'),_0xfdc7d5));};AGIChannel[_0x1703('0x20')][_0x1703('0x2e')]=function(_0xf76233){return this['sendRequest'](util['format'](_0x1703('0x2f'),_0xf76233));};AGIChannel[_0x1703('0x20')][_0x1703('0xa')]=function(){return this[_0x1703('0x22')](_0x1703('0x30'));};AGIChannel[_0x1703('0x20')][_0x1703('0x31')]=function(_0x5c90dc,_0x1ef4ea){var _0x5189aa=_[_0x1703('0x32')](_0x1ef4ea)||_['isNumber'](_0x1ef4ea)?_0x1ef4ea[_0x1703('0x33')]():_0x1ef4ea;return this[_0x1703('0x22')](util[_0x1703('0x26')](_0x1703('0x34'),_0x5c90dc,_0x5189aa?_0x5189aa[_0x1703('0x33')]()[_0x1703('0x35')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x1a650e,_0x30b276){return this['sendRequest'](util[_0x1703('0x26')](_0x1703('0x36'),_0x1a650e,_0x30b276));};AGIChannel[_0x1703('0x20')][_0x1703('0x37')]=function(_0x236e22,_0x1c5488){return this[_0x1703('0x22')](util[_0x1703('0x26')](_0x1703('0x38'),_0x236e22,_0x1c5488));};AGIChannel[_0x1703('0x20')][_0x1703('0x39')]=function(_0x15d9db,_0x2525bc){return this[_0x1703('0x22')](util[_0x1703('0x26')](_0x1703('0x3a'),_0x15d9db,_0x2525bc));};AGIChannel[_0x1703('0x20')]['continueAt']=function(_0x4f3dc6,_0x5afe60,_0x3e246b){_0x5afe60=_0x5afe60||this[_0x1703('0x3b')];_0x3e246b=_0x3e246b||0x1;this[_0x1703('0x3c')](_0x4f3dc6);this['setExtension'](_0x5afe60);this[_0x1703('0x2e')](_0x3e246b);return this[_0x1703('0x28')](util[_0x1703('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x4f3dc6,_0x5afe60,_0x3e246b));};AGIChannel[_0x1703('0x20')][_0x1703('0x3d')]=function(_0x37ac42){return this[_0x1703('0x22')](util[_0x1703('0x26')](_0x1703('0x3e'),_0x37ac42));};AGIChannel['prototype']['recordFile']=function(_0x2aeb10,_0x4d8eff,_0x3f8da9,_0x146fc5,_0x2b4f6d,_0x3bb49f){_0x4d8eff=_0x4d8eff||_0x1703('0x3f');_0x3f8da9=_0x3f8da9||'';_0x146fc5=_0x146fc5===undefined?-0x1:_0x146fc5==='-1'?-0x1:_0x146fc5*0x3e8;_0x2b4f6d=_0x2b4f6d===undefined?'':'s='+_0x2b4f6d;_0x3bb49f=_0x3bb49f?_0x1703('0x40'):'';return this[_0x1703('0x22')](util['format'](_0x1703('0x41'),_0x2aeb10,_0x4d8eff,_0x3f8da9,_0x146fc5,_0x3bb49f,_0x2b4f6d));};AGIChannel[_0x1703('0x20')][_0x1703('0x42')]=function(_0x212757,_0x1f05ef){_0x1f05ef=_0x1f05ef||'';return this[_0x1703('0x22')](util['format'](_0x1703('0x43'),_0x212757,_0x1f05ef));};AGIChannel[_0x1703('0x20')]['agi']=function(_0x1d0a6c){return this[_0x1703('0x44')](_0x1703('0x45'),_0x1d0a6c);};AGIChannel[_0x1703('0x20')][_0x1703('0x46')]=function(_0x3fd08f){return this['exec'](_0x1703('0x47'),_0x3fd08f);};AGIChannel['prototype'][_0x1703('0x17')]=function(_0x3ea638,_0x3682ce){this['noop'](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3ea638['id'],_0x3ea638[_0x1703('0x48')],_0x3682ce));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1703('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4f80853..1164ab8 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 _0xe7fb=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','name','exports','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x3c28f7,_0xfd0a7a){var _0x54ff3b=function(_0xb153f2){while(--_0xb153f2){_0x3c28f7['push'](_0x3c28f7['shift']());}};_0x54ff3b(++_0xfd0a7a);}(_0xe7fb,0x188));var _0xbe7f=function(_0x2acac6,_0x4aa2b9){_0x2acac6=_0x2acac6-0x0;var _0x209865=_0xe7fb[_0x2acac6];return _0x209865;};'use strict';var util=require(_0xbe7f('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xbe7f('0x1'),'E_AGI_SERVER_CLOSE':_0xbe7f('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xbe7f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xbe7f('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xbe7f('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xbe7f('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xbe7f('0x7')};function AGIError(_0x4a3a01){var _0x4a3a01=_0x4a3a01||null,_0xad61a0=_0xad61a0||[],_0x1aba56=0x1,_0x4d4a96='';if(!error[_0x4a3a01]){_0x4a3a01=_0xbe7f('0x8');}_0xad61a0['push'](error[_0x4a3a01]);while(arguments[_0x1aba56]){_0xad61a0[_0xbe7f('0x9')](arguments[_0x1aba56]);_0x1aba56++;}_0x4d4a96=util['format']['apply'](util,_0xad61a0);this['message']=_0x4d4a96;this[_0xbe7f('0xa')]=_0x4a3a01;}module[_0xbe7f('0xb')]=AGIError; \ No newline at end of file +var _0x2ef9=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x4b5b02,_0x57241b){var _0x3fc403=function(_0x494e42){while(--_0x494e42){_0x4b5b02['push'](_0x4b5b02['shift']());}};_0x3fc403(++_0x57241b);}(_0x2ef9,0x1ea));var _0x92ef=function(_0x232305,_0x650df6){_0x232305=_0x232305-0x0;var _0x336df7=_0x2ef9[_0x232305];return _0x336df7;};'use strict';var util=require(_0x92ef('0x0'));var error={'E_AGI_UNDEFINED':_0x92ef('0x1'),'E_AGI_ARGUMENT_PORT':_0x92ef('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x92ef('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x92ef('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x92ef('0x5'),'E_AGI_SOCKET_ERROR':_0x92ef('0x6'),'E_AGI_SOCKET_CLOSE':_0x92ef('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x92ef('0x8'),'E_AGI_COMMAND_EMPTY':_0x92ef('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x103abe){var _0x103abe=_0x103abe||null,_0x12a604=_0x12a604||[],_0x46a205=0x1,_0x5cac4c='';if(!error[_0x103abe]){_0x103abe='E_AGI_UNDEFINED';}_0x12a604[_0x92ef('0xa')](error[_0x103abe]);while(arguments[_0x46a205]){_0x12a604[_0x92ef('0xa')](arguments[_0x46a205]);_0x46a205++;}_0x5cac4c=util[_0x92ef('0xb')]['apply'](util,_0x12a604);this[_0x92ef('0xc')]=_0x5cac4c;this[_0x92ef('0xd')]=_0x103abe;}module[_0x92ef('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 80a4b64..444d2c4 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 _0x681a=['lodash','../../../config/logger','agi','menu','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','edges','info','no\x20edge/s\x20available','split','length','vswitch','target','agicommand','includes','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x681a,0x1e6));var _0xa681=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x681a[_0x5b13c3];return _0x3d6780;};'use strict';var _=require(_0xa681('0x0'));var logger=require(_0xa681('0x1'))(_0xa681('0x2'));var verticesWithRetry=[_0xa681('0x3'),'getdigits',_0xa681('0x4')];var Graph=function(){this[_0xa681('0x5')]={};this['edges']={};this[_0xa681('0x6')]=0x0;};Graph[_0xa681('0x7')][_0xa681('0x8')]=function(_0x74cc61){this[_0xa681('0x5')][_0x74cc61['id']]=_0x74cc61;this['edges'][_0x74cc61['id']]=[];};Graph['prototype'][_0xa681('0x9')]=function(_0x434f25,_0x10a9c1,_0x3a3b8c){this['edges'][_0x434f25]['push']({'target':_0x10a9c1,'condition':_0x3a3b8c});this[_0xa681('0x6')]+=0x1;};Graph[_0xa681('0x7')][_0xa681('0xa')]=function(){return _[_0xa681('0xa')](this[_0xa681('0x5')]);};Graph['prototype'][_0xa681('0xb')]=function(){return this[_0xa681('0x6')];};Graph[_0xa681('0x7')][_0xa681('0xc')]=function(_0x164e65){return this[_0xa681('0x5')][_0x164e65];};Graph['prototype'][_0xa681('0xd')]=function(_0x46da28,_0x20f34e){if(!this[_0xa681('0x5')][_0x46da28]){return logger['info'](_0xa681('0xe'));}var _0x34be98=_0x20f34e(this[_0xa681('0x5')][_0x46da28]);if(!_0x34be98){return logger['info']('stop\x20traverse');}if(this[_0xa681('0xf')][_0x46da28]['length']===0x0){return logger[_0xa681('0x10')](_0xa681('0x11'));}for(var _0x13e750=0x0,_0x24e04f=[],_0x37764e=![];_0x13e750\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','xml2json','lodash','util','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','message','error','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0xa3b2,0xed));var _0x2a3b=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0xa3b2[_0x1cfe2e];return _0x39233f;};'use strict';var parser=require(_0x2a3b('0x0'));var _=require(_0x2a3b('0x1'));var syncho=require('syncho');var util=require(_0x2a3b('0x2'));var moment=require(_0x2a3b('0x3'));var config=require(_0x2a3b('0x4'));var logger=require('../../config/logger')(_0x2a3b('0x5'));var utilLicense=require(_0x2a3b('0x6'));var rpc=require(_0x2a3b('0x7'));var mailRpc=require(_0x2a3b('0x8'));var Graph=require(_0x2a3b('0x9'));var Vertices=require(_0x2a3b('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x2a3b('0x5')]=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x4696c3){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4696c3);agiHandler(_0x4696c3);}catch(_0x65d079){logger['error'](_0x65d079['stack']);}});});}function listeningHandler(){console[_0x2a3b('0xb')](_0x2a3b('0xc'),config[_0x2a3b('0x5')][_0x2a3b('0xd')]);logger[_0x2a3b('0xe')](util[_0x2a3b('0xf')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x2a3b('0x5')]['ip'],config['agi'][_0x2a3b('0xd')]));}function errorHandler(_0x3899ed){if(_0x3899ed&&_0x3899ed['name']&&_0x3899ed[_0x2a3b('0x10')]){logger[_0x2a3b('0x11')](util[_0x2a3b('0xf')](_0x2a3b('0x12'),_0x3899ed['name'],_0x3899ed['message']));}else{logger['error'](util[_0x2a3b('0xf')](_0x2a3b('0x13'),_0x3899ed[_0x2a3b('0x14')]));}}function closeHandler(){logger[_0x2a3b('0xe')](util[_0x2a3b('0xf')](_0x2a3b('0x15'),this['arg_1'],this[_0x2a3b('0x16')],this[_0x2a3b('0x17')],this[_0x2a3b('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0xd5163d){logger[_0x2a3b('0x11')](_0xd5163d['stack']);}}function timeoutHandler(){logger[_0x2a3b('0xe')](util['format'](_0x2a3b('0x19'),this[_0x2a3b('0x1a')],this[_0x2a3b('0x16')],this['callerid'],this['dnid'],this[_0x2a3b('0x1b')]));}function hangupHandler(){logger[_0x2a3b('0xe')](util[_0x2a3b('0xf')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2a3b('0x1a')],this[_0x2a3b('0x16')],this[_0x2a3b('0x17')],this[_0x2a3b('0x18')],this['uniqueid']));this[_0x2a3b('0x1c')]=!![];}function getRoot(_0x4bc074){return parser['toJson'](_0x4bc074,{'object':!![]})[_0x2a3b('0x1d')][_0x2a3b('0x1e')];}function addVertex(_0x988f28,_0x49274a,_0x4aa53d){_0x49274a[_0x2a3b('0x1f')]=_0x4aa53d;if(_0x49274a[_0x2a3b('0x20')](_0x2a3b('0x21'))){_0x49274a['maxRetry']=parseInt(_0x49274a[_0x2a3b('0x21')],0xa);}_0x988f28['addVertex'](_[_0x2a3b('0x22')](_0x49274a,_0x2a3b('0x23')));}function initGraph(_0x36df88,_0x582b32){var _0x324ac9=new Graph();for(var _0x479045 in _0x36df88){if(_0x36df88[_0x2a3b('0x20')](_0x479045)){if(_[_0x2a3b('0x24')](_0x36df88[_0x479045])){for(var _0x4149e5=0x0;_0x4149e5<_0x36df88[_0x479045]['length'];_0x4149e5+=0x1){addVertex(_0x324ac9,_0x36df88[_0x479045][_0x4149e5],_0x479045);}}else{addVertex(_0x324ac9,_0x36df88[_0x479045],_0x479045);}}}for(var _0x20296e=0x0;_0x20296e<_0x582b32['length'];_0x20296e+=0x1){if(_0x582b32[_0x20296e][_0x2a3b('0x25')]&&_0x582b32[_0x20296e][_0x2a3b('0x26')]){_0x324ac9[_0x2a3b('0x27')](_0x582b32[_0x20296e][_0x2a3b('0x25')],_0x582b32[_0x20296e][_0x2a3b('0x26')],_0x582b32[_0x20296e][_0x2a3b('0x28')]);}}return _0x324ac9;}function getSquareProject(_0x3de1c,_0x3caf6b){rpc[_0x2a3b('0x29')](_0x3de1c)[_0x2a3b('0x2a')](function(_0x28487c){_0x3caf6b(null,_0x28487c);})['catch'](function(_0x3a1847){_0x3caf6b(null,_0x3a1847);});}function createSquareReport(_0x12ab5f,_0x40a36f){rpc[_0x2a3b('0x2b')](_0x12ab5f)[_0x2a3b('0x2a')](function(_0x2789c4){if(_0x40a36f){_0x40a36f(null,_0x2789c4);}})[_0x2a3b('0x2c')](function(_0x18cfc7){if(_0x40a36f){_0x40a36f(null,_0x18cfc7);}});}function setChannelVariables(_0x4f045c){for(var _0x5ccff5 in _0x4f045c){if(_0x4f045c[_0x2a3b('0x20')](_0x5ccff5)){if(_0x5ccff5[_0x2a3b('0x2d')](_0x2a3b('0x2e'))===0x0){_0x4f045c[_0x5ccff5[_0x2a3b('0x2f')](0x4)]=_0x4f045c[_0x5ccff5];delete _0x4f045c[_0x5ccff5];}}}}function getLogFromObject(_0x577a49){return util[_0x2a3b('0x30')](_0x577a49,{'showHidden':![],'depth':null});}function agiHandler(_0x3f53d6){var _0x58ae65,_0x518707,_0x4cd387,_0x4f12d3,_0x2c0cd3;logger[_0x2a3b('0x31')](_0x2a3b('0x32'),JSON[_0x2a3b('0x33')](_0x3f53d6,null,0x2));logger[_0x2a3b('0xe')](util[_0x2a3b('0xf')](_0x2a3b('0x34'),_0x3f53d6[_0x2a3b('0x1a')],_0x3f53d6[_0x2a3b('0x16')],_0x3f53d6[_0x2a3b('0x17')],_0x3f53d6['dnid'],_0x3f53d6['uniqueid']));_0x3f53d6['on'](_0x2a3b('0x11'),errorHandler);_0x3f53d6['on'](_0x2a3b('0x35'),closeHandler);_0x3f53d6['on'](_0x2a3b('0x36'),timeoutHandler);_0x3f53d6[_0x2a3b('0x1c')]=![];_0x3f53d6['on'](_0x2a3b('0x37'),hangupHandler);var _0xe46385=getSquareProject[_0x2a3b('0x38')](null,_0x3f53d6['arg_1']);if(_0xe46385){if(_0xe46385[_0x2a3b('0x39')]){_0x58ae65=getRoot(_0xe46385[_0x2a3b('0x39')]);if(_0x58ae65&&_0x58ae65[_0x2a3b('0x3a')]){logger[_0x2a3b('0x31')]('root',JSON[_0x2a3b('0x33')](_0x58ae65,null,0x2));_0x3f53d6[_0x2a3b('0x3b')]=moment()[_0x2a3b('0xf')](_0x2a3b('0x3c'));_0x518707=initGraph(_[_0x2a3b('0x22')](_0x58ae65,_0x2a3b('0x23')),_0x58ae65[_0x2a3b('0x23')]);_0x4cd387=new Vertices(_0x3f53d6,rpc,mailRpc);logger[_0x2a3b('0xe')](util[_0x2a3b('0xf')](_0x2a3b('0x3d'),_0x3f53d6[_0x2a3b('0x1a')],_0x3f53d6[_0x2a3b('0x16')],_0x3f53d6[_0x2a3b('0x17')],_0x3f53d6[_0x2a3b('0x18')],_0x3f53d6[_0x2a3b('0x1b')]));_0x518707['traverseBFS'](_0x58ae65[_0x2a3b('0x3a')]['id'],function(_0x47e849){try{_0x47e849=_0x4cd387[_0x2a3b('0x3e')](_0x47e849);logger[_0x2a3b('0x31')](_0x2a3b('0x3f'),JSON[_0x2a3b('0x33')](_0x47e849,null,0x2));if(_0x47e849['agicommand']===_0x2a3b('0x40')){logger['info'](_0x2a3b('0x41'));_0x3f53d6[_0x2a3b('0x42')]=_0x47e849[_0x2a3b('0x42')]||_0x3f53d6[_0x2a3b('0x42')];_0x3f53d6['extension']=_0x47e849[_0x2a3b('0x43')];_0x3f53d6[_0x2a3b('0x44')]=_0x47e849[_0x2a3b('0x44')]?_0x47e849[_0x2a3b('0x44')]-0x1:0x1;return null;}else if(_0x47e849&&_0x4cd387[_0x47e849[_0x2a3b('0x1f')]]){_0x2c0cd3=_0x4cd387[_0x47e849[_0x2a3b('0x1f')]](_0x47e849);logger[_0x2a3b('0xe')](_0x2a3b('0x45'),JSON[_0x2a3b('0x33')](_0x2c0cd3,null,0x2));if(_0x2c0cd3&&_0x2c0cd3[_0x2a3b('0x46')]===AGI_CODE_SUCCESS&&_0x2c0cd3['result']!==AGI_RESULT_ERROR&&!_0x3f53d6[_0x2a3b('0x1c')]){logger[_0x2a3b('0x31')](_0x2a3b('0x45'),getLogFromObject(_0x2c0cd3));return _[_0x2a3b('0x47')](_0x2c0cd3[_0x2a3b('0x48')])?null:_0x2c0cd3['result']['toString']();}else{logger[_0x2a3b('0x11')](_0x2a3b('0x45'),getLogFromObject(_0x2c0cd3));return null;}}else{logger[_0x2a3b('0x11')](_0x2a3b('0x49'));return null;}}catch(_0xf7de3){logger[_0x2a3b('0x11')](_0xf7de3[_0x2a3b('0x14')]);return null;}});if(_0x58ae65[_0x2a3b('0x4a')]){logger['info'](util['format'](_0x2a3b('0x4b'),_0x3f53d6['arg_1'],_0x3f53d6[_0x2a3b('0x16')],_0x3f53d6[_0x2a3b('0x17')],_0x3f53d6[_0x2a3b('0x18')],_0x3f53d6[_0x2a3b('0x1b')]));_0x518707['traverseBFS'](_0x58ae65[_0x2a3b('0x4a')]['id'],function(_0x480001){try{_0x480001=_0x4cd387[_0x2a3b('0x3e')](_0x480001);logger['debug'](_0x2a3b('0x3f'),JSON['stringify'](_0x480001,null,0x2));if(_0x480001&&_0x4cd387[_0x480001['agicommand']]){_0x2c0cd3=_0x4cd387[_0x480001[_0x2a3b('0x1f')]](_0x480001);if(_0x2c0cd3){logger['debug'](_0x2a3b('0x45'),getLogFromObject(_0x2c0cd3));return _[_0x2a3b('0x47')](_0x2c0cd3[_0x2a3b('0x48')])?null:_0x2c0cd3['result'][_0x2a3b('0x4c')]();}else{logger['error'](_0x2a3b('0x45'),getLogFromObject(_0x2c0cd3));return null;}}else{logger[_0x2a3b('0x11')](_0x2a3b('0x49'));return null;}}catch(_0x3d6a2f){logger['error'](_0x3d6a2f[_0x2a3b('0x14')]);return null;}});}logger[_0x2a3b('0xe')](util[_0x2a3b('0xf')](_0x2a3b('0x4d'),_0x3f53d6[_0x2a3b('0x1a')],_0x3f53d6[_0x2a3b('0x16')],_0x3f53d6[_0x2a3b('0x17')],_0x3f53d6[_0x2a3b('0x18')],_0x3f53d6[_0x2a3b('0x1b')]));logger[_0x2a3b('0xe')](util['format'](_0x2a3b('0x4e'),_0x3f53d6['context'],_0x3f53d6[_0x2a3b('0x43')],parseInt(_0x3f53d6[_0x2a3b('0x44')],0xa)+0x1));_0x3f53d6['continueAt'](_0x3f53d6[_0x2a3b('0x42')],_0x3f53d6['extension'],parseInt(_0x3f53d6['priority'],0xa)+0x1);_0x3f53d6[_0x2a3b('0x35')]();}}else{logger[_0x2a3b('0x11')](util['format'](_0x2a3b('0x4f'),_0x3f53d6['arg_1']));_0x3f53d6[_0x2a3b('0x50')](_0x3f53d6[_0x2a3b('0x42')],_0x3f53d6[_0x2a3b('0x43')],parseInt(_0x3f53d6[_0x2a3b('0x44')],0xa)+0x1);_0x3f53d6[_0x2a3b('0x35')]();}}else{logger[_0x2a3b('0x11')](util[_0x2a3b('0xf')]('Project\x20%s\x20not\x20found',_0x3f53d6[_0x2a3b('0x1a')]));_0x3f53d6['continueAt'](_0x3f53d6[_0x2a3b('0x42')],_0x3f53d6['extension'],parseInt(_0x3f53d6[_0x2a3b('0x44')],0xa)+0x1);_0x3f53d6[_0x2a3b('0x35')]();}}function main(){var _0x400c8d;return utilLicense[_0x2a3b('0x51')]()[_0x2a3b('0x2a')](function(_0x50746f){if(_0x50746f){if(_0x50746f[_0x2a3b('0x52')]){if(_0x50746f[_0x2a3b('0x53')]&&_0x50746f[_0x2a3b('0x53')]>0x0){logger['info'](util['format'](_0x2a3b('0x54'),_0x50746f[_0x2a3b('0x53')]));_0x400c8d=_0x50746f['callysquare'];}else{logger[_0x2a3b('0xe')](_0x2a3b('0x55'));}}else{logger[_0x2a3b('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x400c8d=-0x1;}}})[_0x2a3b('0x2c')](function(_0x383c6b){logger['error'](_0x2a3b('0x56'),_0x383c6b[_0x2a3b('0x14')]);})[_0x2a3b('0x4a')](function(){var _0xfeecb8=require(_0x2a3b('0x57'))(config[_0x2a3b('0x5')][_0x2a3b('0xd')],config['agi']['ip'],_0x400c8d);_0xfeecb8['on']('error',errorHandler);_0xfeecb8['on']('listening',listeningHandler);_0xfeecb8['on']('connection',connectionHandler);_0xfeecb8['on'](_0x2a3b('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0xfef2=['Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','name','message','format','[%s]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','retry','omit','mxCell','length','source','addEdge','target','getSquareProject','then','catch','createSquareReport','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','close','timeout','hangup','sync','production','debug','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','log'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xfef2,0xf8));var _0x2fef=function(_0x3566ea,_0x50e87d){_0x3566ea=_0x3566ea-0x0;var _0x24c0b9=_0xfef2[_0x3566ea];return _0x24c0b9;};'use strict';var parser=require(_0x2fef('0x0'));var _=require(_0x2fef('0x1'));var syncho=require(_0x2fef('0x2'));var util=require('util');var moment=require('moment');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2fef('0x3'));var utilLicense=require(_0x2fef('0x4'));var rpc=require(_0x2fef('0x5'));var mailRpc=require(_0x2fef('0x6'));var Graph=require('./graph');var Vertices=require(_0x2fef('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x2fef('0x8')](config[_0x2fef('0x3')],{'ip':_0x2fef('0x9'),'port':0x11dd});function connectionHandler(_0x508efe){process[_0x2fef('0xa')](function(){syncho(function(){try{setChannelVariables(_0x508efe);agiHandler(_0x508efe);}catch(_0x6fedd2){logger[_0x2fef('0xb')](_0x6fedd2['stack']);}});});}function listeningHandler(){console[_0x2fef('0xc')](_0x2fef('0xd'),config[_0x2fef('0x3')][_0x2fef('0xe')]);logger['info'](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x2fef('0x3')]['ip'],config[_0x2fef('0x3')]['port']));}function errorHandler(_0x55aaec){if(_0x55aaec&&_0x55aaec[_0x2fef('0xf')]&&_0x55aaec[_0x2fef('0x10')]){logger[_0x2fef('0xb')](util[_0x2fef('0x11')](_0x2fef('0x12'),_0x55aaec[_0x2fef('0xf')],_0x55aaec[_0x2fef('0x10')]));}else{logger[_0x2fef('0xb')](util[_0x2fef('0x11')]('[ERROR]\x20%s',_0x55aaec[_0x2fef('0x13')]));}}function closeHandler(){logger[_0x2fef('0x14')](util[_0x2fef('0x11')](_0x2fef('0x15'),this[_0x2fef('0x16')],this['calleridname'],this[_0x2fef('0x17')],this['dnid'],this[_0x2fef('0x18')]));try{createSquareReport(this);}catch(_0xc9d7d6){logger[_0x2fef('0xb')](_0xc9d7d6[_0x2fef('0x13')]);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x2fef('0x17')],this[_0x2fef('0x19')],this[_0x2fef('0x18')]));}function hangupHandler(){logger['info'](util['format'](_0x2fef('0x1a'),this[_0x2fef('0x16')],this['calleridname'],this['callerid'],this['dnid'],this[_0x2fef('0x18')]));this[_0x2fef('0x1b')]=!![];}function getRoot(_0x17bd58){return parser[_0x2fef('0x1c')](_0x17bd58,{'object':!![]})[_0x2fef('0x1d')][_0x2fef('0x1e')];}function addVertex(_0x206528,_0x20ecd7,_0x1df70e){_0x20ecd7[_0x2fef('0x1f')]=_0x1df70e;if(_0x20ecd7['hasOwnProperty']('retry')){_0x20ecd7['maxRetry']=parseInt(_0x20ecd7[_0x2fef('0x20')],0xa);}_0x206528['addVertex'](_[_0x2fef('0x21')](_0x20ecd7,_0x2fef('0x22')));}function initGraph(_0x13b7a7,_0x238465){var _0x1c39fe=new Graph();for(var _0x56fc41 in _0x13b7a7){if(_0x13b7a7['hasOwnProperty'](_0x56fc41)){if(_['isArray'](_0x13b7a7[_0x56fc41])){for(var _0x23b18f=0x0;_0x23b18f<_0x13b7a7[_0x56fc41][_0x2fef('0x23')];_0x23b18f+=0x1){addVertex(_0x1c39fe,_0x13b7a7[_0x56fc41][_0x23b18f],_0x56fc41);}}else{addVertex(_0x1c39fe,_0x13b7a7[_0x56fc41],_0x56fc41);}}}for(var _0x4df2ba=0x0;_0x4df2ba<_0x238465[_0x2fef('0x23')];_0x4df2ba+=0x1){if(_0x238465[_0x4df2ba][_0x2fef('0x24')]&&_0x238465[_0x4df2ba]['target']){_0x1c39fe[_0x2fef('0x25')](_0x238465[_0x4df2ba][_0x2fef('0x24')],_0x238465[_0x4df2ba][_0x2fef('0x26')],_0x238465[_0x4df2ba]['value']);}}return _0x1c39fe;}function getSquareProject(_0x2ae348,_0x46ad7d){rpc[_0x2fef('0x27')](_0x2ae348)[_0x2fef('0x28')](function(_0x1e03db){_0x46ad7d(null,_0x1e03db);})[_0x2fef('0x29')](function(_0xeacbe0){_0x46ad7d(null,_0xeacbe0);});}function createSquareReport(_0x50c0e4,_0x34260d){rpc[_0x2fef('0x2a')](_0x50c0e4)[_0x2fef('0x28')](function(_0x4eca09){if(_0x34260d){_0x34260d(null,_0x4eca09);}})['catch'](function(_0x3a0058){if(_0x34260d){_0x34260d(null,_0x3a0058);}});}function setChannelVariables(_0x5ea904){for(var _0x5a6a16 in _0x5ea904){if(_0x5ea904[_0x2fef('0x2b')](_0x5a6a16)){if(_0x5a6a16[_0x2fef('0x2c')](_0x2fef('0x2d'))===0x0){_0x5ea904[_0x5a6a16[_0x2fef('0x2e')](0x4)]=_0x5ea904[_0x5a6a16];delete _0x5ea904[_0x5a6a16];}}}}function getLogFromObject(_0x1d0256){return util['inspect'](_0x1d0256,{'showHidden':![],'depth':null});}function agiHandler(_0x46fe4f){var _0x51abb5,_0xa38af0,_0x1eedf0,_0x3c16d1,_0x151e37;logger['debug'](_0x2fef('0x2f'),JSON[_0x2fef('0x30')](_0x46fe4f,null,0x2));logger[_0x2fef('0x14')](util[_0x2fef('0x11')](_0x2fef('0x31'),_0x46fe4f[_0x2fef('0x16')],_0x46fe4f[_0x2fef('0x32')],_0x46fe4f[_0x2fef('0x17')],_0x46fe4f[_0x2fef('0x19')],_0x46fe4f['uniqueid']));_0x46fe4f['on'](_0x2fef('0xb'),errorHandler);_0x46fe4f['on'](_0x2fef('0x33'),closeHandler);_0x46fe4f['on'](_0x2fef('0x34'),timeoutHandler);_0x46fe4f[_0x2fef('0x1b')]=![];_0x46fe4f['on'](_0x2fef('0x35'),hangupHandler);var _0xd98142=getSquareProject[_0x2fef('0x36')](null,_0x46fe4f[_0x2fef('0x16')]);if(_0xd98142){if(_0xd98142['production']){_0x51abb5=getRoot(_0xd98142[_0x2fef('0x37')]);if(_0x51abb5&&_0x51abb5['start']){logger[_0x2fef('0x38')](_0x2fef('0x1e'),JSON['stringify'](_0x51abb5,null,0x2));_0x46fe4f[_0x2fef('0x39')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xa38af0=initGraph(_[_0x2fef('0x21')](_0x51abb5,'mxCell'),_0x51abb5[_0x2fef('0x22')]);_0x1eedf0=new Vertices(_0x46fe4f,rpc,mailRpc);logger[_0x2fef('0x14')](util['format'](_0x2fef('0x3a'),_0x46fe4f[_0x2fef('0x16')],_0x46fe4f['calleridname'],_0x46fe4f[_0x2fef('0x17')],_0x46fe4f[_0x2fef('0x19')],_0x46fe4f['uniqueid']));_0xa38af0[_0x2fef('0x3b')](_0x51abb5[_0x2fef('0x3c')]['id'],function(_0x59cd65){try{_0x59cd65=_0x1eedf0[_0x2fef('0x3d')](_0x59cd65);logger['debug'](_0x2fef('0x3e'),JSON[_0x2fef('0x30')](_0x59cd65,null,0x2));if(_0x59cd65[_0x2fef('0x1f')]===_0x2fef('0x3f')){logger[_0x2fef('0x14')](_0x2fef('0x40'));_0x46fe4f[_0x2fef('0x41')]=_0x59cd65[_0x2fef('0x41')]||_0x46fe4f[_0x2fef('0x41')];_0x46fe4f[_0x2fef('0x42')]=_0x59cd65[_0x2fef('0x42')];_0x46fe4f['priority']=_0x59cd65[_0x2fef('0x43')]?_0x59cd65[_0x2fef('0x43')]-0x1:0x1;return null;}else if(_0x59cd65&&_0x1eedf0[_0x59cd65[_0x2fef('0x1f')]]){_0x151e37=_0x1eedf0[_0x59cd65[_0x2fef('0x1f')]](_0x59cd65);logger[_0x2fef('0x14')]('response',JSON[_0x2fef('0x30')](_0x151e37,null,0x2));if(_0x151e37&&_0x151e37[_0x2fef('0x44')]===AGI_CODE_SUCCESS&&_0x151e37[_0x2fef('0x45')]!==AGI_RESULT_ERROR&&!_0x46fe4f[_0x2fef('0x1b')]){logger[_0x2fef('0x38')](_0x2fef('0x46'),getLogFromObject(_0x151e37));return _['isUndefined'](_0x151e37[_0x2fef('0x45')])?null:_0x151e37['result'][_0x2fef('0x47')]();}else{logger[_0x2fef('0xb')]('response',getLogFromObject(_0x151e37));return null;}}else{logger['error'](_0x2fef('0x48'));return null;}}catch(_0x388403){logger[_0x2fef('0xb')](_0x388403[_0x2fef('0x13')]);return null;}});if(_0x51abb5[_0x2fef('0x49')]){logger[_0x2fef('0x14')](util[_0x2fef('0x11')](_0x2fef('0x4a'),_0x46fe4f['arg_1'],_0x46fe4f['calleridname'],_0x46fe4f[_0x2fef('0x17')],_0x46fe4f[_0x2fef('0x19')],_0x46fe4f[_0x2fef('0x18')]));_0xa38af0[_0x2fef('0x3b')](_0x51abb5['finally']['id'],function(_0x309d3b){try{_0x309d3b=_0x1eedf0[_0x2fef('0x3d')](_0x309d3b);logger[_0x2fef('0x38')](_0x2fef('0x3e'),JSON[_0x2fef('0x30')](_0x309d3b,null,0x2));if(_0x309d3b&&_0x1eedf0[_0x309d3b[_0x2fef('0x1f')]]){_0x151e37=_0x1eedf0[_0x309d3b[_0x2fef('0x1f')]](_0x309d3b);if(_0x151e37){logger['debug'](_0x2fef('0x46'),getLogFromObject(_0x151e37));return _[_0x2fef('0x4b')](_0x151e37[_0x2fef('0x45')])?null:_0x151e37[_0x2fef('0x45')][_0x2fef('0x47')]();}else{logger[_0x2fef('0xb')](_0x2fef('0x46'),getLogFromObject(_0x151e37));return null;}}else{logger[_0x2fef('0xb')](_0x2fef('0x48'));return null;}}catch(_0x230d7b){logger[_0x2fef('0xb')](_0x230d7b[_0x2fef('0x13')]);return null;}});}logger['info'](util[_0x2fef('0x11')](_0x2fef('0x4c'),_0x46fe4f[_0x2fef('0x16')],_0x46fe4f[_0x2fef('0x32')],_0x46fe4f['callerid'],_0x46fe4f['dnid'],_0x46fe4f[_0x2fef('0x18')]));logger[_0x2fef('0x14')](util[_0x2fef('0x11')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x46fe4f[_0x2fef('0x41')],_0x46fe4f[_0x2fef('0x42')],parseInt(_0x46fe4f[_0x2fef('0x43')],0xa)+0x1));_0x46fe4f[_0x2fef('0x4d')](_0x46fe4f[_0x2fef('0x41')],_0x46fe4f[_0x2fef('0x42')],parseInt(_0x46fe4f['priority'],0xa)+0x1);_0x46fe4f[_0x2fef('0x33')]();}}else{logger['error'](util[_0x2fef('0x11')](_0x2fef('0x4e'),_0x46fe4f['arg_1']));_0x46fe4f[_0x2fef('0x4d')](_0x46fe4f[_0x2fef('0x41')],_0x46fe4f[_0x2fef('0x42')],parseInt(_0x46fe4f[_0x2fef('0x43')],0xa)+0x1);_0x46fe4f[_0x2fef('0x33')]();}}else{logger[_0x2fef('0xb')](util[_0x2fef('0x11')]('Project\x20%s\x20not\x20found',_0x46fe4f[_0x2fef('0x16')]));_0x46fe4f[_0x2fef('0x4d')](_0x46fe4f[_0x2fef('0x41')],_0x46fe4f[_0x2fef('0x42')],parseInt(_0x46fe4f[_0x2fef('0x43')],0xa)+0x1);_0x46fe4f[_0x2fef('0x33')]();}}function main(){var _0x34387a;return utilLicense['getLicense']()[_0x2fef('0x28')](function(_0x43aca5){if(_0x43aca5){if(_0x43aca5[_0x2fef('0x4f')]){if(_0x43aca5['callysquare']&&_0x43aca5['callysquare']>0x0){logger[_0x2fef('0x14')](util[_0x2fef('0x11')]('[LICENSE]\x20CHANNELS:\x20%s',_0x43aca5['callysquare']));_0x34387a=_0x43aca5[_0x2fef('0x50')];}else{logger[_0x2fef('0x14')](_0x2fef('0x51'));}}else{logger[_0x2fef('0x14')](_0x2fef('0x52'));_0x34387a=-0x1;}}})['catch'](function(_0x4a502e){logger[_0x2fef('0xb')](_0x2fef('0x53'),_0x4a502e['stack']);})[_0x2fef('0x49')](function(){var _0x50d7c9=require(_0x2fef('0x54'))(config[_0x2fef('0x3')][_0x2fef('0xe')],config[_0x2fef('0x3')]['ip'],_0x34387a);_0x50d7c9['on'](_0x2fef('0xb'),errorHandler);_0x50d7c9['on'](_0x2fef('0x55'),listeningHandler);_0x50d7c9['on'](_0x2fef('0x56'),connectionHandler);_0x50d7c9['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index bc3c107..9d50d18 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 _0xc130=['sendMailMessage','SendMail','bluebird','jayson/promise','http','request','result','catch'];(function(_0x211036,_0x1fb51c){var _0x20332e=function(_0x53c57e){while(--_0x53c57e){_0x211036['push'](_0x211036['shift']());}};_0x20332e(++_0x1fb51c);}(_0xc130,0x17a));var _0x0c13=function(_0x37ab20,_0x1d2b8c){_0x37ab20=_0x37ab20-0x0;var _0x33e53e=_0xc130[_0x37ab20];return _0x33e53e;};'use strict';var BPromise=require(_0x0c13('0x0'));var jayson=require(_0x0c13('0x1'));var client=jayson['client'][_0x0c13('0x2')]({'port':0x232b});function request(_0x402e51,_0x4e9128){return new BPromise(function(_0x89871f,_0x188366){return client[_0x0c13('0x3')](_0x402e51,_0x4e9128)['then'](function(_0xdb992e){if(_0xdb992e['error']){return _0x188366(_0xdb992e['error']['message']);}else{return _0x89871f(_0xdb992e[_0x0c13('0x4')]);}})[_0x0c13('0x5')](function(_0x7f2625){return _0x188366(_0x7f2625);});});}exports[_0x0c13('0x6')]=function(_0x4db06e,_0x4beadd){return request(_0x0c13('0x7'),{'account':_0x4db06e,'message':_0x4beadd});}; \ No newline at end of file +var _0x2572=['sendMailMessage','bluebird','http','request','then','error','message','catch'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x2572,0x159));var _0x2257=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2572[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x2257('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2257('0x1')]({'port':0x232b});function request(_0x730e36,_0x8a19bb){return new BPromise(function(_0x4cd994,_0x984acb){return client[_0x2257('0x2')](_0x730e36,_0x8a19bb)[_0x2257('0x3')](function(_0x1e0341){if(_0x1e0341[_0x2257('0x4')]){return _0x984acb(_0x1e0341['error'][_0x2257('0x5')]);}else{return _0x4cd994(_0x1e0341['result']);}})[_0x2257('0x6')](function(_0xc53cf2){return _0x984acb(_0xc53cf2);});});}exports[_0x2257('0x7')]=function(_0x39389a,_0x1fae3f){return request('SendMail',{'account':_0x39389a,'message':_0x1fae3f});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 79a998f..a29683a 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 _0x162d=['slice','trim','emit','headers','line','exports','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x162d,0xa8));var _0xd162=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x162d[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require('util');var Transform=require(_0xd162('0x0'))[_0xd162('0x1')];function AGIReply(_0x49584e){Transform['call'](this,_0x49584e);this[_0xd162('0x2')]='';this[_0xd162('0x3')]=![];}util[_0xd162('0x4')](AGIReply,Transform);AGIReply[_0xd162('0x5')][_0xd162('0x6')]=function(_0x38c1eb,_0x430d5f,_0x1b06ba){var _0x7afa1a='\x0a',_0x442cf0=['\x0a\x0a',_0xd162('0x7')],_0x259e9f=-0x1,_0x5489ae=-0x1,_0x2fe19e='',_0x8b59c7=0x0,_0x34419b='',_0x219fa6='';this[_0xd162('0x2')]+=_0x38c1eb[_0xd162('0x8')]();_0x34419b=this[_0xd162('0x2')];if(!this[_0xd162('0x3')]){_0x8b59c7=0x0;while(_0x442cf0[_0x8b59c7]){while((_0x5489ae=_0x34419b[_0xd162('0x9')](_0x442cf0[_0x8b59c7]))!=-0x1){_0x2fe19e=_0x442cf0[_0x8b59c7];_0x219fa6=_0x34419b[_0xd162('0xa')](0x0,_0x5489ae);_0x34419b=_0x34419b['substring'](_0x5489ae+_0x2fe19e[_0xd162('0xb')]);var _0x190880=_0x219fa6['split'](_0x7afa1a),_0x2c35a6=0x0,_0x58b6c9={},_0x205deb='',_0x4a28d2='',_0x52d333=-0x1;while(_0x190880[_0x2c35a6]){_0x52d333=_0x190880[_0x2c35a6][_0xd162('0x9')](':');if(_0x52d333!=-0x1){_0x205deb=_0x190880[_0x2c35a6][_0xd162('0xc')](0x0,_0x52d333)['trim']();_0x4a28d2=_0x190880[_0x2c35a6][_0xd162('0xc')](_0x52d333+0x1)[_0xd162('0xd')]();if(_0x205deb[_0xd162('0xb')]>0x0){_0x58b6c9[_0x205deb]=_0x4a28d2;}}else{}_0x2c35a6++;}this[_0xd162('0xe')](_0xd162('0xf'),_0x58b6c9);this[_0xd162('0x3')]=!![];}_0x8b59c7++;}this[_0xd162('0x2')]=_0x34419b;}else{while((_0x259e9f=_0x34419b[_0xd162('0x9')](_0x7afa1a))!=-0x1){_0x219fa6=_0x34419b[_0xd162('0xa')](0x0,_0x259e9f);this[_0xd162('0xe')](_0xd162('0x10'),_0x219fa6);_0x34419b=_0x34419b[_0xd162('0xa')](_0x259e9f+_0x7afa1a[_0xd162('0xb')]);}this[_0xd162('0x2')]=_0x34419b;}_0x1b06ba();};module[_0xd162('0x11')]=AGIReply; \ No newline at end of file +var _0xb1e0=['prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','util','stream','call','_localBuffer','_inBody','inherits'];(function(_0x9019f8,_0x199aaa){var _0x13b681=function(_0x43767c){while(--_0x43767c){_0x9019f8['push'](_0x9019f8['shift']());}};_0x13b681(++_0x199aaa);}(_0xb1e0,0x126));var _0x0b1e=function(_0x439f70,_0x233093){_0x439f70=_0x439f70-0x0;var _0x516649=_0xb1e0[_0x439f70];return _0x516649;};'use strict';var util=require(_0x0b1e('0x0'));var Transform=require(_0x0b1e('0x1'))['Transform'];function AGIReply(_0x1a33c9){Transform[_0x0b1e('0x2')](this,_0x1a33c9);this[_0x0b1e('0x3')]='';this[_0x0b1e('0x4')]=![];}util[_0x0b1e('0x5')](AGIReply,Transform);AGIReply[_0x0b1e('0x6')][_0x0b1e('0x7')]=function(_0x30462f,_0x22242b,_0x2d20a6){var _0x1cc263='\x0a',_0x249899=['\x0a\x0a',_0x0b1e('0x8')],_0x4d271f=-0x1,_0x2df3b2=-0x1,_0x53a184='',_0x531e18=0x0,_0x16ae6d='',_0x212412='';this[_0x0b1e('0x3')]+=_0x30462f[_0x0b1e('0x9')]();_0x16ae6d=this[_0x0b1e('0x3')];if(!this[_0x0b1e('0x4')]){_0x531e18=0x0;while(_0x249899[_0x531e18]){while((_0x2df3b2=_0x16ae6d[_0x0b1e('0xa')](_0x249899[_0x531e18]))!=-0x1){_0x53a184=_0x249899[_0x531e18];_0x212412=_0x16ae6d[_0x0b1e('0xb')](0x0,_0x2df3b2);_0x16ae6d=_0x16ae6d[_0x0b1e('0xb')](_0x2df3b2+_0x53a184[_0x0b1e('0xc')]);var _0x72ecf9=_0x212412[_0x0b1e('0xd')](_0x1cc263),_0x49035e=0x0,_0x259d8a={},_0x532d64='',_0x7e5533='',_0x2a3494=-0x1;while(_0x72ecf9[_0x49035e]){_0x2a3494=_0x72ecf9[_0x49035e][_0x0b1e('0xa')](':');if(_0x2a3494!=-0x1){_0x532d64=_0x72ecf9[_0x49035e][_0x0b1e('0xe')](0x0,_0x2a3494)[_0x0b1e('0xf')]();_0x7e5533=_0x72ecf9[_0x49035e][_0x0b1e('0xe')](_0x2a3494+0x1)[_0x0b1e('0xf')]();if(_0x532d64[_0x0b1e('0xc')]>0x0){_0x259d8a[_0x532d64]=_0x7e5533;}}else{}_0x49035e++;}this[_0x0b1e('0x10')](_0x0b1e('0x11'),_0x259d8a);this[_0x0b1e('0x4')]=!![];}_0x531e18++;}this[_0x0b1e('0x3')]=_0x16ae6d;}else{while((_0x4d271f=_0x16ae6d['indexOf'](_0x1cc263))!=-0x1){_0x212412=_0x16ae6d[_0x0b1e('0xb')](0x0,_0x4d271f);this[_0x0b1e('0x10')](_0x0b1e('0x12'),_0x212412);_0x16ae6d=_0x16ae6d[_0x0b1e('0xb')](_0x4d271f+_0x1cc263[_0x0b1e('0xc')]);}this[_0x0b1e('0x3')]=_0x16ae6d;}_0x2d20a6();};module[_0x0b1e('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7e1ae9e..99d26d0 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 _0x105a=['lodash','util','jayson/promise','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird'];(function(_0xdf6340,_0x4a4f22){var _0x2b1184=function(_0x4e457a){while(--_0x4e457a){_0xdf6340['push'](_0xdf6340['shift']());}};_0x2b1184(++_0x4a4f22);}(_0x105a,0x155));var _0xa105=function(_0x364974,_0xbe83df){_0x364974=_0x364974-0x0;var _0x1c5544=_0x105a[_0x364974];return _0x1c5544;};'use strict';var BPromise=require(_0xa105('0x0'));var moment=require('moment');var _=require(_0xa105('0x1'));var util=require(_0xa105('0x2'));var jayson=require(_0xa105('0x3'));var client=jayson['client']['http']({'port':0x2329});function request(_0x2f7d11,_0x3ab3ee){return new BPromise(function(_0x1bdf52,_0x234054){return client['request'](_0x2f7d11,_0x3ab3ee)[_0xa105('0x4')](function(_0x2bf8a0){if(_0x2bf8a0[_0xa105('0x5')]){return _0x234054(_0x2bf8a0['error']['message']);}else{return _0x1bdf52(_0x2bf8a0[_0xa105('0x6')]);}})[_0xa105('0x7')](function(_0x59fa60){return _0x234054(_0x59fa60);});});}exports[_0xa105('0x8')]=function(_0x29e75a){return request(_0xa105('0x9'),{'options':{'raw':![],'where':{'name':_0x29e75a},'attributes':[_0xa105('0xa')]}});};exports[_0xa105('0xb')]=function(_0x25d5c6){return request(_0xa105('0xc'),{'options':{'raw':![],'where':{'id':_0x25d5c6},'include':[{'model':_0xa105('0xd'),'as':_0xa105('0xe')}],'attributes':['id',_0xa105('0xf'),_0xa105('0x10')]}});};exports[_0xa105('0x11')]=function(_0x3cb613){return request(_0xa105('0x9'),{'options':{'where':{'id':_0x3cb613},'attributes':[_0xa105('0xf')]}});};exports[_0xa105('0x12')]=function(_0xab6365){return request(_0xa105('0x13'),{'options':{'where':{'id':_0xab6365},'attributes':['name']}});};exports[_0xa105('0x14')]=function(_0x181362){return request(_0xa105('0x15'),{'options':{'where':{'id':_0x181362},'attributes':[_0xa105('0xf')]}});};exports[_0xa105('0x16')]=function(_0x36bd73){return request(_0xa105('0x17'),{'options':{'where':{'id':_0x36bd73},'attributes':[_0xa105('0x18')]}});};exports['getUserById']=function(_0x2ba38b){return request('ShowUser',{'options':{'where':{'id':_0x2ba38b},'attributes':['name']}});};exports[_0xa105('0x19')]=function(_0x598051){return request(_0xa105('0x1a'),{'options':{'where':{'id':_0x598051},'attributes':[_0xa105('0xf')]}});};exports[_0xa105('0x1b')]=function(_0x2d8814){return request('ShowSound',{'options':{'where':{'id':_0x2d8814},'attributes':[_0xa105('0x1c')]}});};exports['getIntervalById']=function(_0x114b22){return request(_0xa105('0x1d'),{'options':{'raw':![],'where':{'id':_0x114b22},'include':[{'model':_0xa105('0x1e'),'as':_0xa105('0x1f')}]}});};exports[_0xa105('0x20')]=function(_0x47480e){return request(_0xa105('0x21'),{'options':{'where':{'id':_0x47480e},'attributes':['id','name']}});};exports[_0xa105('0x22')]=function(_0x157911){return request(_0xa105('0x23'),{'body':_0x157911});};exports['createSquareDetailsReport']=function(_0x5edbf9){return request(_0xa105('0x24'),{'body':_0x5edbf9});};exports[_0xa105('0x25')]=function(_0xb8d023){return request('CreateSquareReport',{'body':_['merge'](_0xb8d023,{'project_name':_0xb8d023[_0xa105('0x26')],'prev_project_name':_0xb8d023['arg_2']||'','is_subproject':_0xb8d023[_0xa105('0x27')]?!![]:![],'leaveAt':moment()[_0xa105('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xa105('0x29')]=function(_0x6dae21){return request(_0xa105('0x2a'),{'body':_0x6dae21});};exports[_0xa105('0x2b')]=function(_0x62b3ba){return request('CreateSquareMessage',{'body':_0x62b3ba});};exports['createCmContact']=function(_0x4b38b4){return request(_0xa105('0x2c'),{'options':{'raw':![],'where':{'phone':_0x4b38b4[_0xa105('0x2d')],'ListId':_0x4b38b4[_0xa105('0x2e')]}}})['then'](function(_0x558c65){if(_0x558c65){return _0x558c65;}return request(_0xa105('0x2f'),{'body':_0x4b38b4});});};exports[_0xa105('0x30')]=function(_0x10c489){return request(_0xa105('0x31'),{'options':{'where':{'id':_0x10c489},'attributes':[_0xa105('0xf')]}});};exports[_0xa105('0x32')]=function(_0x13d811,_0x33be62){return request(_0xa105('0x33'),{'body':{'interface':_0x33be62},'options':{'where':_0x13d811}});};exports[_0xa105('0x34')]=function(_0x3b9479,_0x3cd2a9,_0xf9ffb5){return request(_0xa105('0x35'),{'body':{'type':_0x3cd2a9,'uniqueid':_0xf9ffb5},'options':{'where':_0x3b9479}});};exports['agentUnpause']=function(_0x19fae4){return request(_0xa105('0x36'),{'body':{},'options':{'where':_0x19fae4}});};exports[_0xa105('0x37')]=function(_0x1a836b){return request(_0xa105('0x38'),{'body':{},'options':{'where':_0x1a836b}});}; \ No newline at end of file +var _0xb6c5=['getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','util','jayson/promise','http','then','error','message','result','catch'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xb6c5,0x9f));var _0x5b6c=function(_0x40e131,_0x19dfad){_0x40e131=_0x40e131-0x0;var _0xb5178d=_0xb6c5[_0x40e131];return _0xb5178d;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5b6c('0x0'));var _=require('lodash');var util=require(_0x5b6c('0x1'));var jayson=require(_0x5b6c('0x2'));var client=jayson['client'][_0x5b6c('0x3')]({'port':0x2329});function request(_0x4f407f,_0x208680){return new BPromise(function(_0x1baec5,_0x4806df){return client['request'](_0x4f407f,_0x208680)[_0x5b6c('0x4')](function(_0x383ec0){if(_0x383ec0[_0x5b6c('0x5')]){return _0x4806df(_0x383ec0[_0x5b6c('0x5')][_0x5b6c('0x6')]);}else{return _0x1baec5(_0x383ec0[_0x5b6c('0x7')]);}})[_0x5b6c('0x8')](function(_0x5c2121){return _0x4806df(_0x5c2121);});});}exports[_0x5b6c('0x9')]=function(_0x5a234b){return request(_0x5b6c('0xa'),{'options':{'raw':![],'where':{'name':_0x5a234b},'attributes':[_0x5b6c('0xb')]}});};exports[_0x5b6c('0xc')]=function(_0xde3c48){return request(_0x5b6c('0xd'),{'options':{'raw':![],'where':{'id':_0xde3c48},'include':[{'model':'MailServerOut','as':_0x5b6c('0xe')}],'attributes':['id',_0x5b6c('0xf'),_0x5b6c('0x10')]}});};exports[_0x5b6c('0x11')]=function(_0x37b12a){return request(_0x5b6c('0xa'),{'options':{'where':{'id':_0x37b12a},'attributes':[_0x5b6c('0xf')]}});};exports[_0x5b6c('0x12')]=function(_0x4b99b8){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4b99b8},'attributes':[_0x5b6c('0xf')]}});};exports[_0x5b6c('0x13')]=function(_0x2ee441){return request(_0x5b6c('0x14'),{'options':{'where':{'id':_0x2ee441},'attributes':['name']}});};exports[_0x5b6c('0x15')]=function(_0x137918){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x137918},'attributes':['dsn']}});};exports['getUserById']=function(_0x14b4ae){return request(_0x5b6c('0x16'),{'options':{'where':{'id':_0x14b4ae},'attributes':[_0x5b6c('0xf')]}});};exports[_0x5b6c('0x17')]=function(_0x1db8ea){return request(_0x5b6c('0x18'),{'options':{'where':{'id':_0x1db8ea},'attributes':['name']}});};exports[_0x5b6c('0x19')]=function(_0x5a06ed){return request(_0x5b6c('0x1a'),{'options':{'where':{'id':_0x5a06ed},'attributes':[_0x5b6c('0x1b')]}});};exports[_0x5b6c('0x1c')]=function(_0x56992a){return request(_0x5b6c('0x1d'),{'options':{'raw':![],'where':{'id':_0x56992a},'include':[{'model':'Interval','as':_0x5b6c('0x1e')}]}});};exports[_0x5b6c('0x1f')]=function(_0x4eb9c3){return request(_0x5b6c('0x20'),{'options':{'where':{'id':_0x4eb9c3},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x2d069d){return request(_0x5b6c('0x21'),{'body':_0x2d069d});};exports[_0x5b6c('0x22')]=function(_0x11e161){return request('CreateSquareDetailsReport',{'body':_0x11e161});};exports[_0x5b6c('0x23')]=function(_0x32692e){return request(_0x5b6c('0x24'),{'body':_[_0x5b6c('0x25')](_0x32692e,{'project_name':_0x32692e[_0x5b6c('0x26')],'prev_project_name':_0x32692e[_0x5b6c('0x27')]||'','is_subproject':_0x32692e[_0x5b6c('0x27')]?!![]:![],'leaveAt':moment()[_0x5b6c('0x28')](_0x5b6c('0x29'))})});};exports[_0x5b6c('0x2a')]=function(_0x65baaf){return request('CreateSquareRecording',{'body':_0x65baaf});};exports['createSquareMessage']=function(_0x3865e1){return request(_0x5b6c('0x2b'),{'body':_0x3865e1});};exports[_0x5b6c('0x2c')]=function(_0x574937){return request(_0x5b6c('0x2d'),{'options':{'raw':![],'where':{'phone':_0x574937['phone'],'ListId':_0x574937[_0x5b6c('0x2e')]}}})[_0x5b6c('0x4')](function(_0x20b88b){if(_0x20b88b){return _0x20b88b;}return request(_0x5b6c('0x2f'),{'body':_0x574937});});};exports[_0x5b6c('0x30')]=function(_0x1f0d32){return request(_0x5b6c('0x31'),{'options':{'where':{'id':_0x1f0d32},'attributes':[_0x5b6c('0xf')]}});};exports[_0x5b6c('0x32')]=function(_0x17cd0a,_0x5d6385){return request(_0x5b6c('0x33'),{'body':{'interface':_0x5d6385},'options':{'where':_0x17cd0a}});};exports['agentPause']=function(_0x52ea30,_0x25133a,_0x34c1a0){return request(_0x5b6c('0x34'),{'body':{'type':_0x25133a,'uniqueid':_0x34c1a0},'options':{'where':_0x52ea30}});};exports[_0x5b6c('0x35')]=function(_0xd65b76){return request(_0x5b6c('0x36'),{'body':{},'options':{'where':_0xd65b76}});};exports['agentLogout']=function(_0x1e5012){return request(_0x5b6c('0x37'),{'body':{},'options':{'where':_0x1e5012}});}; \ 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 28cfe96..b46d7e0 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 polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xe928=['exports','./polly','./lex'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0xe928,0x145));var _0x8e92=function(_0x3d30f7,_0x224f7a){_0x3d30f7=_0x3d30f7-0x0;var _0x1dc95b=_0xe928[_0x3d30f7];return _0x1dc95b;};var polly=require(_0x8e92('0x0'));var lex=require(_0x8e92('0x1'));module[_0x8e92('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index ddfaad3..1273693 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 _0x0bb5=['./lib/api','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0bb5,0x148));var _0x50bb=function(_0x3c1250,_0x24c042){_0x3c1250=_0x3c1250-0x0;var _0x4057a0=_0x0bb5[_0x3c1250];return _0x4057a0;};'use strict';var lex=require(_0x50bb('0x0'));module[_0x50bb('0x1')]=function(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36){return lex(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ 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 6b528f7..fa45b08 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(_0x2a99e0,_0x3045a6){var _0x245d14=function(_0x1f20f0){while(--_0x1f20f0){_0x2a99e0['push'](_0x2a99e0['shift']());}};_0x245d14(++_0x3045a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x53f6f1,_0x1ded62){var _0x4b1f05=function(_0x297aee){while(--_0x297aee){_0x53f6f1['push'](_0x53f6f1['shift']());}};_0x4b1f05(++_0x1ded62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 9eaaba0..a63e8f9 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 _0xeb7a=['./lib/api'];(function(_0x4c1987,_0x4c4bf2){var _0x20a56e=function(_0x1e71fd){while(--_0x1e71fd){_0x4c1987['push'](_0x4c1987['shift']());}};_0x20a56e(++_0x4c4bf2);}(_0xeb7a,0x11f));var _0xaeb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb7a[_0x3dd15e];return _0x231fd0;};'use strict';var polly=require(_0xaeb7('0x0'));module['exports']=function(_0x224d35,_0x1fbbb0,_0x481faa,_0x6196e7,_0x3f71f5,_0x1fa5c3,_0x19cc55){return polly(_0x224d35,_0x1fbbb0,_0x481faa,_0x6196e7,_0x3f71f5,_0x1fa5c3,_0x19cc55);}; \ No newline at end of file +var _0xb6bf=['./lib/api','exports'];(function(_0x15da60,_0x3661df){var _0x2709bc=function(_0x242df2){while(--_0x242df2){_0x15da60['push'](_0x15da60['shift']());}};_0x2709bc(++_0x3661df);}(_0xb6bf,0x9c));var _0xfb6b=function(_0xde20ec,_0x495adc){_0xde20ec=_0xde20ec-0x0;var _0x2160c8=_0xb6bf[_0xde20ec];return _0x2160c8;};'use strict';var polly=require(_0xfb6b('0x0'));module[_0xfb6b('0x1')]=function(_0x3e8104,_0x102fd4,_0x19c4e4,_0x25b0cb,_0x22d6dd,_0x1f1e7d,_0x528962){return polly(_0x3e8104,_0x102fd4,_0x19c4e4,_0x25b0cb,_0x22d6dd,_0x1f1e7d,_0x528962);}; \ 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 593d042..18d433a 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 _0x61c0=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x40f9ca,_0x41e00f){var _0x1d069a=function(_0xaaf47b){while(--_0xaaf47b){_0x40f9ca['push'](_0x40f9ca['shift']());}};_0x1d069a(++_0x41e00f);}(_0x61c0,0x68));var _0x061c=function(_0x447f33,_0x489af1){_0x447f33=_0x447f33-0x0;var _0x4e0bc7=_0x61c0[_0x447f33];return _0x4e0bc7;};'use strict';var fs=require('fs');var path=require(_0x061c('0x0'));var BPromise=require(_0x061c('0x1'));var rs=require('randomstring');var AWS=require(_0x061c('0x2'));function pollyResult(_0x4ec4d2,_0x33b9c1,_0x200ab3){return new BPromise(function(_0x2087e7,_0x431d48){_0x4ec4d2['synthesizeSpeech'](_0x33b9c1,function(_0x3bd2b8,_0x2e42c6){if(_0x3bd2b8){_0x431d48(_0x3bd2b8);}else if(_0x2e42c6){if(_0x2e42c6['AudioStream']instanceof Buffer){fs[_0x061c('0x3')](_0x200ab3,_0x2e42c6[_0x061c('0x4')],function(_0x22df3b){if(_0x22df3b){_0x431d48(_0x22df3b);}else{_0x2087e7();}});}else{_0x431d48(new Error(_0x061c('0x5')));}}else{_0x431d48(new Error(_0x061c('0x6')));}});});}module[_0x061c('0x7')]=function(_0x1a4ac3,_0x45c173,_0x1cb691,_0x35de0d,_0x46ee3a,_0x32a9a4,_0xa2266f){var _0x5a30a6=new AWS[(_0x061c('0x8'))]({'accessKeyId':_0x1a4ac3,'secretAccessKey':_0x45c173,'region':_0x1cb691});var _0x31f8f6={'Text':_0x46ee3a,'TextType':_0x32a9a4||_0x061c('0x9'),'OutputFormat':_0x061c('0xa'),'VoiceId':_0x35de0d};return pollyResult(_0x5a30a6,_0x31f8f6,_0xa2266f);}; \ No newline at end of file +var _0xb6c6=['No\x20data\x20response\x20from\x20aws\x20Polly!','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile'];(function(_0x4b90b7,_0x2b0ab0){var _0x36ac5f=function(_0x33662a){while(--_0x33662a){_0x4b90b7['push'](_0x4b90b7['shift']());}};_0x36ac5f(++_0x2b0ab0);}(_0xb6c6,0x14a));var _0x6b6c=function(_0x29b434,_0x211fbe){_0x29b434=_0x29b434-0x0;var _0x5b7f47=_0xb6c6[_0x29b434];return _0x5b7f47;};'use strict';var fs=require('fs');var path=require(_0x6b6c('0x0'));var BPromise=require(_0x6b6c('0x1'));var rs=require(_0x6b6c('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x4acd63,_0x221917,_0x15ba68){return new BPromise(function(_0x399740,_0x4e7f80){_0x4acd63[_0x6b6c('0x3')](_0x221917,function(_0x3e22a9,_0x4cc8ba){if(_0x3e22a9){_0x4e7f80(_0x3e22a9);}else if(_0x4cc8ba){if(_0x4cc8ba[_0x6b6c('0x4')]instanceof Buffer){fs[_0x6b6c('0x5')](_0x15ba68,_0x4cc8ba[_0x6b6c('0x4')],function(_0x481fc7){if(_0x481fc7){_0x4e7f80(_0x481fc7);}else{_0x399740();}});}else{_0x4e7f80(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4e7f80(new Error(_0x6b6c('0x6')));}});});}module['exports']=function(_0x2c8ba0,_0x2e4704,_0x599ab6,_0x294eb6,_0x4a7972,_0x16e831,_0x45bb32){var _0x79b5f9=new AWS['Polly']({'accessKeyId':_0x2c8ba0,'secretAccessKey':_0x2e4704,'region':_0x599ab6});var _0x1e581f={'Text':_0x4a7972,'TextType':_0x16e831||'text','OutputFormat':'mp3','VoiceId':_0x294eb6};return pollyResult(_0x79b5f9,_0x1e581f,_0x45bb32);}; \ 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 0507d7c..2c4399b 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 _0x9d85=['./lib/api'];(function(_0x176ce9,_0x99961b){var _0x5e8203=function(_0x985ef){while(--_0x985ef){_0x176ce9['push'](_0x176ce9['shift']());}};_0x5e8203(++_0x99961b);}(_0x9d85,0x6c));var _0x59d8=function(_0x101640,_0x3d1497){_0x101640=_0x101640-0x0;var _0x38818c=_0x9d85[_0x101640];return _0x38818c;};'use strict';var asr=require(_0x59d8('0x0'));module['exports']=function(_0x59e834,_0x33e086,_0xde13ed,_0x234d7e){return asr(_0x59e834,_0x33e086,_0xde13ed);}; \ No newline at end of file +var _0x9c3f=['exports','./lib/api'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0x9c3f,0x6d));var _0xf9c3=function(_0x2bc945,_0x8d3a5f){_0x2bc945=_0x2bc945-0x0;var _0xc28858=_0x9c3f[_0x2bc945];return _0xc28858;};'use strict';var asr=require(_0xf9c3('0x0'));module[_0xf9c3('0x1')]=function(_0x326ec0,_0x3af7df,_0x1e963e,_0x1ce2de){return asr(_0x326ec0,_0x3af7df,_0x1e963e);}; \ 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 c6bf7ff..bbad082 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 _0x8aa7=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x3f94f6,_0x4920e2){var _0x45102a=function(_0x505aaa){while(--_0x505aaa){_0x3f94f6['push'](_0x3f94f6['shift']());}};_0x45102a(++_0x4920e2);}(_0x8aa7,0xb6));var _0x78aa=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x8aa7[_0x11ce46];return _0x368a1e;};'use strict';var url=require('url');var BPromise=require(_0x78aa('0x0'));var fs=require('fs');var host=_0x78aa('0x1');module[_0x78aa('0x2')]=function(_0xa5cd25,_0x3d727e,_0x137fc0){return new BPromise(function(_0x21028b,_0x5b46d1){var _0x2b9bfa;if(typeof _0xa5cd25!==_0x78aa('0x3')||_0xa5cd25[_0x78aa('0x4')]===0x0){return _0x5b46d1(_0x78aa('0x5'));}if(typeof _0x3d727e!==_0x78aa('0x3')||_0x3d727e[_0x78aa('0x4')]===0x0){return _0x5b46d1(_0x78aa('0x6'));}if(typeof _0x137fc0!==_0x78aa('0x7')&&(typeof _0x137fc0!==_0x78aa('0x3')||_0x137fc0[_0x78aa('0x4')]===0x0)){return _0x5b46d1(_0x78aa('0x8'));}try{_0x2b9bfa=fs[_0x78aa('0x9')](_0xa5cd25)[_0x78aa('0xa')](_0x78aa('0xb'));}catch(_0x357ab1){return _0x5b46d1(_0x357ab1);}return _0x21028b({'method':_0x78aa('0xc'),'uri':host+_0x78aa('0xd')+_0x3d727e,'body':{'config':{'encoding':_0x78aa('0xe'),'sampleRateHertz':_0x78aa('0xf'),'languageCode':_0x137fc0},'audio':{'content':_0x2b9bfa}},'json':!![]});});}; \ No newline at end of file +var _0xf2cb=['string','undefined','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x2120af,_0x26b2a7){var _0x228a55=function(_0x408446){while(--_0x408446){_0x2120af['push'](_0x2120af['shift']());}};_0x228a55(++_0x26b2a7);}(_0xf2cb,0x130));var _0xbf2c=function(_0x56ef76,_0x1c5a38){_0x56ef76=_0x56ef76-0x0;var _0x407d2f=_0xf2cb[_0x56ef76];return _0x407d2f;};'use strict';var url=require('url');var BPromise=require(_0xbf2c('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xbf2c('0x1')]=function(_0x4cc874,_0x424f04,_0x5a97a1){return new BPromise(function(_0x1ecb79,_0x41c649){var _0x5abeb3;if(typeof _0x4cc874!=='string'||_0x4cc874[_0xbf2c('0x2')]===0x0){return _0x41c649(_0xbf2c('0x3'));}if(typeof _0x424f04!==_0xbf2c('0x4')||_0x424f04[_0xbf2c('0x2')]===0x0){return _0x41c649('key\x20should\x20be\x20a\x20string');}if(typeof _0x5a97a1!==_0xbf2c('0x5')&&(typeof _0x5a97a1!=='string'||_0x5a97a1[_0xbf2c('0x2')]===0x0)){return _0x41c649('lang\x20should\x20be\x20a\x20string');}try{_0x5abeb3=fs['readFileSync'](_0x4cc874)[_0xbf2c('0x6')](_0xbf2c('0x7'));}catch(_0xeb0e9d){return _0x41c649(_0xeb0e9d);}return _0x1ecb79({'method':'POST','uri':host+_0xbf2c('0x8')+_0x424f04,'body':{'config':{'encoding':_0xbf2c('0x9'),'sampleRateHertz':_0xbf2c('0xa'),'languageCode':_0x5a97a1},'audio':{'content':_0x5abeb3}},'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 c7dd748..9b014cb 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 _0xb87e=['./asr','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb87e,0x18e));var _0xeb87=function(_0x57d082,_0x4ad904){_0x57d082=_0x57d082-0x0;var _0x48d711=_0xb87e[_0x57d082];return _0x48d711;};var asr=require(_0xeb87('0x0'));module[_0xeb87('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7be5=['./asr','exports'];(function(_0x290dd0,_0x428613){var _0x270f37=function(_0x10cd1e){while(--_0x10cd1e){_0x290dd0['push'](_0x290dd0['shift']());}};_0x270f37(++_0x428613);}(_0x7be5,0x1a6));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};var asr=require(_0x57be('0x0'));module[_0x57be('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 efef51d..6a1bde7 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 _0x5fd0=['endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','text','CustomAction','channelData','CustomActionData','AudioFromTts','dirName','apiai-promise','bluebird','dialogflow','http','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','unlink','download\x20error','pipe','end','protocol','data','transcode','wav','error\x20convert','info','resolve','tmp','generate','.wav','writeFileSync','then','split','readFileSync','toString','base64','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','chmodSync','777','googleCloudTTS\x20path','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','goggleTTS\x20path','googleASR','uri','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','result','source','actionIncomplete','fulfillment','speech','score','status','code','metadata'];(function(_0x4f2944,_0x1bb10c){var _0x327d9f=function(_0x56d7ca){while(--_0x56d7ca){_0x4f2944['push'](_0x4f2944['shift']());}};_0x327d9f(++_0x1bb10c);}(_0x5fd0,0x1b8));var _0x05fd=function(_0x443614,_0x31248e){_0x443614=_0x443614-0x0;var _0xfdfbb6=_0x5fd0[_0x443614];return _0xfdfbb6;};'use strict';var apiai=require(_0x05fd('0x0'));var BPromise=require(_0x05fd('0x1'));var dialogflow=require(_0x05fd('0x2'));var fs=require('fs');var http=require(_0x05fd('0x3'));var https=require('https');var md5=require(_0x05fd('0x4'));var path=require('path');var querystring=require(_0x05fd('0x5'));var rp=require(_0x05fd('0x6'));var rs=require(_0x05fd('0x7'));var sox=require(_0x05fd('0x8'));var tts=require(_0x05fd('0x9'));var urlParse=require(_0x05fd('0xa'))[_0x05fd('0xb')];var util=require(_0x05fd('0xc'));var aws=require(_0x05fd('0xd'));var google=require(_0x05fd('0xe'));var sestek=require(_0x05fd('0xf'));var tilde=require(_0x05fd('0x10'));var logger=require(_0x05fd('0x11'))('agi');var ISPEECH_API=_0x05fd('0x12');function downloadFile(_0x18c4ae,_0x4e6446){return new BPromise(function(_0x39a544,_0x12f660){var _0x1b41b6=urlParse(_0x18c4ae);var _0xcf2f14=_0x1b41b6['protocol']===_0x05fd('0x13')?https:http;var _0x3b79d5={'host':_0x1b41b6[_0x05fd('0x14')],'path':_0x1b41b6[_0x05fd('0x15')],'headers':{'user-agent':_0x05fd('0x16')}};_0xcf2f14[_0x05fd('0x17')](_0x3b79d5,function(_0x461797){if(_0x461797[_0x05fd('0x18')]!==0xc8){logger[_0x05fd('0x19')](_0x05fd('0x1a')+_0x18c4ae+_0x05fd('0x1b')+_0x461797[_0x05fd('0x18')]+'\x20('+_0x461797[_0x05fd('0x1c')]+')');_0x12f660(new Error(_0x05fd('0x1a')+_0x18c4ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x461797['statusCode']+'\x20('+_0x461797[_0x05fd('0x1c')]+')'));return;}var _0x137cfa=fs[_0x05fd('0x1d')](_0x4e6446);_0x137cfa['on'](_0x05fd('0x1e'),function(){logger['info']('finish\x20download\x20file');_0x137cfa[_0x05fd('0x1f')](_0x39a544);});_0x137cfa['on']('error',function(_0xc49756){fs[_0x05fd('0x20')](_0x4e6446);logger[_0x05fd('0x19')](_0x05fd('0x21'),_0xc49756);_0x12f660(_0xc49756);});_0x461797[_0x05fd('0x22')](_0x137cfa);})['on']('error',function(_0x27082e){logger[_0x05fd('0x19')](_0x27082e);_0x12f660(_0x27082e);})[_0x05fd('0x23')]();});}function uploadFile(_0x5d3026){return new BPromise(function(_0x290efc,_0x54b7f7){var _0x51d227=urlParse(_0x5d3026);var _0x5b37f0=_0x51d227[_0x05fd('0x24')]===_0x05fd('0x13')?https:http;var _0x555b66={'host':_0x51d227['host'],'path':_0x51d227[_0x05fd('0x15')],'headers':{'user-agent':_0x05fd('0x16')}};_0x5b37f0[_0x05fd('0x17')](_0x555b66,function(_0x12fe91){if(_0x12fe91['statusCode']!==0xc8){_0x54b7f7(new Error(_0x05fd('0x1a')+_0x5d3026+_0x05fd('0x1b')+_0x12fe91[_0x05fd('0x18')]+'\x20('+_0x12fe91['statusMessage']+')'));return;}var _0x545a75='';_0x12fe91['on'](_0x05fd('0x25'),function(_0x44bca5){_0x545a75+=_0x44bca5;});_0x12fe91['on'](_0x05fd('0x23'),function(){_0x290efc(_0x545a75);});})['on'](_0x05fd('0x19'),function(_0x245d3e){_0x54b7f7(_0x245d3e);})['end']();});}function convertFile(_0x28d4b6,_0x177a5b){return new BPromise(function(_0x5200ee,_0x54ea64){var _0x3f558f=sox[_0x05fd('0x26')](_0x28d4b6,_0x177a5b,{'sampleRate':0x1f40,'format':_0x05fd('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3f558f['on'](_0x05fd('0x19'),function(_0x30dd6b){logger[_0x05fd('0x19')](_0x05fd('0x28'),_0x30dd6b);_0x54ea64(_0x30dd6b);});_0x3f558f['on'](_0x05fd('0x23'),function(){logger[_0x05fd('0x29')]('finish\x20to\x20convert');_0x5200ee();});_0x3f558f['start']();});}function base64Decode(_0xa6645d,_0x1bdea1){var _0x5a4f89=path[_0x05fd('0x2a')](__dirname,_0x05fd('0x2b'),rs[_0x05fd('0x2c')](0x4)+_0x05fd('0x2d'));fs[_0x05fd('0x2e')](_0x5a4f89,_0xa6645d,'base64');return convertFile(_0x5a4f89,_0x1bdea1)[_0x05fd('0x2f')](function(){try{fs[_0x05fd('0x20')](_0x5a4f89);fs['chmodSync'](_0x1bdea1,'777');}catch(_0x1b8bb2){logger['error'](_0x1b8bb2);}return _0x1bdea1[_0x05fd('0x30')]('.')[0x0];});}function base64Encode(_0x5ae553){var _0x165f57=fs[_0x05fd('0x31')](_0x5ae553);return new Buffer(_0x165f57)[_0x05fd('0x32')](_0x05fd('0x33'));}exports['googleCloudTTS']=function(_0x1ebf40,_0xf2a094,_0x19d187,_0x55f997,_0x39b932,_0x10076e){var _0x41aa67,_0x477771;var _0x36eec1='https://texttospeech.googleapis.com/v1/';var _0x435c1e=_0x05fd('0x34')+_0x1ebf40;var _0x837028={};if(_0xf2a094===_0x05fd('0x35')){_0x837028['input']={'ssml':_0x19d187};}else{_0x837028[_0x05fd('0x36')]={'text':_0x19d187};};_0x837028['voice']={'languageCode':_0x55f997,'ssmlGender':_0x39b932};_0x837028[_0x05fd('0x37')]={'audioEncoding':_0x05fd('0x38'),'sampleRateHertz':0x1f40};var _0x12888e={'url':_0x36eec1+_0x05fd('0x39')+_0x435c1e,'method':_0x05fd('0x3a'),'json':!![],'body':_0x837028};return rp(_0x12888e)['then'](function(_0x3031f4){return new BPromise(function(_0x24ec38,_0x7bf90a){_0x41aa67=path[_0x05fd('0x2a')](__dirname,_0x05fd('0x2b'),rs[_0x05fd('0x2c')](0x4)+_0x05fd('0x3b'));var _0x48b35f=Buffer['from'](_0x3031f4[_0x05fd('0x3c')],_0x05fd('0x33'));return fs['writeFile'](_0x41aa67,_0x48b35f,function(_0x3b3441){_0x7bf90a(_0x3b3441);},function(_0x2b1998){fs[_0x05fd('0x3d')](_0x41aa67,'777');_0x24ec38(_0x2b1998);});});})[_0x05fd('0x2f')](function(_0x5dc03b){_0x477771=path['resolve'](__dirname,'tmp',rs[_0x05fd('0x2c')](0x4)+_0x05fd('0x2d'));return convertFile(_0x41aa67,_0x477771);})['then'](function(){try{fs['unlink'](_0x41aa67);fs[_0x05fd('0x3d')](_0x477771,_0x05fd('0x3e'));}catch(_0x2a4152){logger[_0x05fd('0x19')](_0x2a4152);}logger[_0x05fd('0x29')](_0x05fd('0x3f'),_0x477771[_0x05fd('0x30')]('.')[0x0]);return _0x477771[_0x05fd('0x30')]('.')[0x0];});};exports['googleTTS']=function(_0x2e459d,_0x58b177){var _0x583fcb='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x338312,_0x54dc6d;var _0x1016a2;var _0x29d9a6={'encoding':'utf8','method':_0x05fd('0x3a'),'timeout':0x2710,'url':_0x583fcb,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x05fd('0x40')+encodeURIComponent(JSON[_0x05fd('0x41')]([[[_0x05fd('0x42'),JSON['stringify']([_0x2e459d,_0x58b177||'en',![],_0x05fd('0x43')]),null,_0x05fd('0x44')]]]))};return rp(_0x29d9a6)[_0x05fd('0x2f')](function(_0x5394d1){try{_0x1016a2=eval(_0x5394d1[_0x05fd('0x45')](0x5))[0x0][0x2];}catch(_0x15b593){throw new Error(_0x05fd('0x46')+_0x5394d1[_0x05fd('0x25')]);}if(!_0x1016a2){if(_0x2e459d[_0x05fd('0x47')]>0xc8){throw new Error(_0x05fd('0x48'));}else{throw new Error('lang\x20\x22'+_0x58b177+'\x22\x20might\x20not\x20exist');}}try{_0x1016a2=eval(_0x1016a2)[0x0];}catch(_0x284c30){throw new Error(_0x05fd('0x46')+res[_0x05fd('0x25')]);}const _0x23036d=_0x1016a2;_0x338312=path[_0x05fd('0x2a')](__dirname,_0x05fd('0x2b'),rs[_0x05fd('0x2c')](0x4)+_0x05fd('0x3b'));fs[_0x05fd('0x2e')](_0x338312,_0x1016a2,{'encoding':_0x05fd('0x33')});_0x54dc6d=path[_0x05fd('0x2a')](__dirname,_0x05fd('0x2b'),rs['generate'](0x4)+_0x05fd('0x2d'));return convertFile(_0x338312,_0x54dc6d);})['then'](function(){try{fs[_0x05fd('0x20')](_0x338312);fs[_0x05fd('0x3d')](_0x54dc6d,_0x05fd('0x3e'));}catch(_0x4634bd){logger['error'](_0x4634bd);}logger[_0x05fd('0x29')](_0x05fd('0x49'),_0x54dc6d[_0x05fd('0x30')]('.')[0x0]);return _0x54dc6d[_0x05fd('0x30')]('.')[0x0];});};exports[_0x05fd('0x4a')]=function(_0x3b0dcd,_0xe4479c,_0x19fd5f){return google['asr'](_0x3b0dcd,_0xe4479c,_0x19fd5f)[_0x05fd('0x2f')](function(_0x5f1f80){logger[_0x05fd('0x29')](_0x5f1f80[_0x05fd('0x4b')]);return rp(_0x5f1f80);})[_0x05fd('0x2f')](function(_0x44702d){var _0x2f1654='';var _0xbad08e=0x0;try{fs['unlink'](_0x3b0dcd);}catch(_0x3b7eab){logger[_0x05fd('0x19')](_0x3b7eab);}if(_0x44702d&&_0x44702d['results']){_0x2f1654=_0x44702d['results']['map'](function(_0x29e2e5){return _0x29e2e5&&_0x29e2e5[_0x05fd('0x4c')][0x0]&&_0x29e2e5[_0x05fd('0x4c')][0x0][_0x05fd('0x4d')]?_0x29e2e5[_0x05fd('0x4c')][0x0][_0x05fd('0x4d')]:'';})[_0x05fd('0x4e')]('\x0a');_0xbad08e=_0x44702d[_0x05fd('0x4f')]['map'](function(_0x4ba77d){return _0x4ba77d&&_0x4ba77d[_0x05fd('0x4c')][0x0]&&_0x4ba77d[_0x05fd('0x4c')][0x0][_0x05fd('0x50')]?_0x4ba77d['alternatives'][0x0][_0x05fd('0x50')]:0x0;})[_0x05fd('0x4e')]('\x0a');}logger[_0x05fd('0x29')](_0x05fd('0x51'),_0x2f1654);logger[_0x05fd('0x29')](_0x05fd('0x52'),_0xbad08e);return{'transcript':_0x2f1654,'confidence':_0xbad08e};})[_0x05fd('0x53')](function(_0x58df6a){logger['error'](_0x05fd('0x54'),_0x58df6a[_0x05fd('0x18')],_0x58df6a['name'],_0x58df6a[_0x05fd('0x55')]);});};exports[_0x05fd('0x56')]=function(_0x4df00e,_0x53349b,_0x51f04f,_0x3b7c36){var _0x20699b=apiai(_0x53349b,{'language':_0x3b7c36||'en'});return _0x20699b['textRequest'](_0x51f04f,{'sessionId':md5(_0x4df00e)})[_0x05fd('0x2f')](function(_0x1ff539){logger[_0x05fd('0x29')](JSON[_0x05fd('0x41')](_0x1ff539));return{'source':_0x1ff539[_0x05fd('0x57')][_0x05fd('0x58')],'resolvedQuery':_0x1ff539[_0x05fd('0x57')]['resolvedQuery'],'action':_0x1ff539[_0x05fd('0x57')]['action'],'actionIncomplete':_0x1ff539[_0x05fd('0x57')][_0x05fd('0x59')],'speech':_0x1ff539[_0x05fd('0x57')][_0x05fd('0x5a')][_0x05fd('0x5b')],'score':_0x1ff539[_0x05fd('0x57')][_0x05fd('0x5c')],'statusCode':_0x1ff539[_0x05fd('0x5d')][_0x05fd('0x5e')],'endConversation':_0x1ff539[_0x05fd('0x57')][_0x05fd('0x5f')][_0x05fd('0x60')]||![],'isFallbackIntent':_0x1ff539[_0x05fd('0x57')][_0x05fd('0x5f')][_0x05fd('0x61')]};});};exports['googleDialogflowV2']=function(_0x147e94,_0x51e754,_0x3ddf58,_0x4cc2b0,_0x3a9818,_0x1cd70f){var _0x1d9c52=_0x4cc2b0[_0x05fd('0x62')](/\\n/g,'\x0a');var _0x550ce5={'credentials':{'private_key':_0x1d9c52,'client_email':_0x3ddf58}};var _0x1a20b4=new dialogflow[(_0x05fd('0x63'))](_0x550ce5);var _0x46a63c=_0x1a20b4['sessionPath'](_0x51e754,md5(_0x147e94));var _0x554f9e={'session':_0x46a63c,'queryInput':{'text':{'text':_0x3a9818,'languageCode':_0x1cd70f}}};return _0x1a20b4[_0x05fd('0x64')](_0x554f9e)[_0x05fd('0x2f')](function(_0x51b733){if(_0x51b733&&_0x51b733[_0x05fd('0x47')]){logger[_0x05fd('0x29')]('Dialogflow\x20V2\x20response:',JSON[_0x05fd('0x41')](_0x51b733));var _0x274a39=_0x51b733[0x0];if(_0x274a39){var _0x480765={'action':_0x274a39[_0x05fd('0x65')][_0x05fd('0x66')],'allRequiredParamsPresent':_0x274a39['queryResult'][_0x05fd('0x67')],'endConversation':_0x274a39[_0x05fd('0x65')][_0x05fd('0x68')]&&_0x274a39[_0x05fd('0x65')][_0x05fd('0x68')]['fields']?_0x274a39[_0x05fd('0x65')][_0x05fd('0x68')][_0x05fd('0x69')][_0x05fd('0x6a')][_0x05fd('0x6b')]:![],'fulfillmentText':_0x274a39[_0x05fd('0x65')][_0x05fd('0x6c')],'intentName':_0x274a39['queryResult'][_0x05fd('0x6d')][_0x05fd('0x6e')],'intentDisplayName':_0x274a39['queryResult']['intent']['displayName'],'isFallbackIntent':_0x274a39[_0x05fd('0x65')]['intent'][_0x05fd('0x6f')],'languageCode':_0x274a39[_0x05fd('0x65')][_0x05fd('0x70')],'queryText':_0x274a39[_0x05fd('0x65')][_0x05fd('0x71')],'responseId':_0x274a39['responseId'],'score':_0x274a39[_0x05fd('0x65')][_0x05fd('0x72')],'speech':_0x274a39['queryResult'][_0x05fd('0x6c')],'providerResponse':JSON[_0x05fd('0x41')](_0x51b733)};return _0x480765;}}});};exports[_0x05fd('0x73')]=function(_0xcab8bf,_0x27c31f,_0x5a0cd6,_0x41c985){return tilde['asr'](_0xcab8bf,_0x27c31f,_0x5a0cd6,_0x41c985)[_0x05fd('0x2f')](function(_0x221b98){try{fs['unlink'](_0xcab8bf);}catch(_0x2d1302){logger[_0x05fd('0x19')](_0x2d1302);}logger[_0x05fd('0x29')](_0x05fd('0x74'),_0x221b98[_0x05fd('0x4d')]);logger['info'](_0x05fd('0x75'),_0x221b98[_0x05fd('0x50')]);return _0x221b98;});};exports[_0x05fd('0x76')]=function(_0x205541,_0x12aacb,_0x5d4472,_0x1da322,_0x1adc13,_0x3da89b){var _0x2fd531=path[_0x05fd('0x2a')](__dirname,_0x05fd('0x2b'),rs[_0x05fd('0x2c')](0x4)+_0x05fd('0x3b'));var _0x456c2a;return aws[_0x05fd('0x77')](_0x205541,_0x12aacb,_0x5d4472,_0x1da322,_0x1adc13,_0x3da89b,_0x2fd531)[_0x05fd('0x2f')](function(){_0x456c2a=path[_0x05fd('0x2a')](__dirname,_0x05fd('0x2b'),rs[_0x05fd('0x2c')](0x4)+_0x05fd('0x2d'));return convertFile(_0x2fd531,_0x456c2a);})['then'](function(){try{fs[_0x05fd('0x20')](_0x2fd531);fs[_0x05fd('0x3d')](_0x456c2a,_0x05fd('0x3e'));}catch(_0x2ed02b){logger['error'](_0x2ed02b);}return _0x456c2a['split']('.')[0x0];});};exports[_0x05fd('0x78')]=function(_0x4ff844,_0xa8e6fe,_0x3f7881,_0x445052,_0x381731,_0x219c38){return aws[_0x05fd('0x79')](_0x4ff844,_0xa8e6fe,_0x3f7881,_0x445052,_0x381731,_0x219c38)[_0x05fd('0x2f')](function(_0x1bc959){logger['info'](JSON[_0x05fd('0x41')](_0x1bc959));return _0x1bc959;});};exports[_0x05fd('0x7a')]=function(_0x51ac16,_0x5e1dff,_0xeee395,_0x503ab5){var _0x5b4a32=util[_0x05fd('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x51ac16,encodeURIComponent(_0x5e1dff),_0xeee395,_0x503ab5);var _0x1e57b7=path[_0x05fd('0x2a')](__dirname,_0x05fd('0x2b'),rs[_0x05fd('0x2c')](0x4)+'.mp3');var _0x4a648a;return downloadFile(_0x5b4a32,_0x1e57b7)[_0x05fd('0x2f')](function(){_0x4a648a=path[_0x05fd('0x2a')](__dirname,'tmp',rs[_0x05fd('0x2c')](0x4)+_0x05fd('0x2d'));return convertFile(_0x1e57b7,_0x4a648a);})[_0x05fd('0x2f')](function(){try{fs[_0x05fd('0x20')](_0x1e57b7);fs['chmodSync'](_0x4a648a,'777');}catch(_0x1261d4){logger[_0x05fd('0x19')](_0x1261d4);}return _0x4a648a['split']('.')[0x0];});};exports[_0x05fd('0x7c')]=function(_0x5934c0,_0x48a0c8,_0x56ac14,_0x6b4763){var _0x4ab825=util['format'](_0x05fd('0x7d'),ISPEECH_API,_0x48a0c8,_0x56ac14,base64Encode(_0x5934c0),_0x6b4763?util[_0x05fd('0x7b')]('model=%s',encodeURIComponent(_0x6b4763)):'freeform=3');return uploadFile(_0x4ab825)[_0x05fd('0x2f')](function(_0x3b69db){return querystring[_0x05fd('0xb')](_0x3b69db);});};exports[_0x05fd('0x7e')]=function(_0x863f82,_0x224e43){return sestek[_0x05fd('0x7f')](_0x863f82,_0x224e43)[_0x05fd('0x2f')](function(_0x1a9da9){logger[_0x05fd('0x29')](JSON[_0x05fd('0x41')](_0x1a9da9));var _0x15a212={'speech':_0x1a9da9[_0x05fd('0x80')],'action':_0x1a9da9['channelData']?_0x1a9da9['channelData'][_0x05fd('0x81')]:undefined,'actiondata':_0x1a9da9[_0x05fd('0x82')]?_0x1a9da9[_0x05fd('0x82')][_0x05fd('0x83')]:undefined};if(_0x1a9da9[_0x05fd('0x82')]&&_0x1a9da9[_0x05fd('0x82')][_0x05fd('0x84')]){return base64Decode(_0x1a9da9['channelData'][_0x05fd('0x84')]['Data'],path['resolve'](__dirname,'tmp',rs[_0x05fd('0x2c')](0x4)+'.wav'))[_0x05fd('0x2f')](function(_0x1372e0){_0x15a212['audiofile']=_0x1372e0;return _0x15a212;});}return _0x15a212;});};exports[_0x05fd('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x7140=['777','googleTTS','utf8','f.req=','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','writeFileSync','googleASR','asr','uri','results','alternatives','transcript','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','stringify','result','source','action','actionIncomplete','fulfillment','speech','score','metadata','endConversation','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','get','statusCode','error','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','https:','WHAT_EVER','request\x20to\x20','data','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent'];(function(_0x120873,_0x257146){var _0x43cda4=function(_0x4e2e57){while(--_0x4e2e57){_0x120873['push'](_0x120873['shift']());}};_0x43cda4(++_0x257146);}(_0x7140,0x161));var _0x0714=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x7140[_0x3a2e49];return _0x257140;};'use strict';var apiai=require(_0x0714('0x0'));var BPromise=require(_0x0714('0x1'));var dialogflow=require(_0x0714('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x0714('0x3'));var md5=require('md5');var path=require(_0x0714('0x4'));var querystring=require('querystring');var rp=require(_0x0714('0x5'));var rs=require(_0x0714('0x6'));var sox=require(_0x0714('0x7'));var tts=require(_0x0714('0x8'));var urlParse=require(_0x0714('0x9'))[_0x0714('0xa')];var util=require('util');var aws=require(_0x0714('0xb'));var google=require(_0x0714('0xc'));var sestek=require(_0x0714('0xd'));var tilde=require(_0x0714('0xe'));var logger=require(_0x0714('0xf'))('agi');var ISPEECH_API=_0x0714('0x10');function downloadFile(_0x1e4271,_0x37f826){return new BPromise(function(_0x45575e,_0x4c0863){var _0x29ee6d=urlParse(_0x1e4271);var _0x2cf89f=_0x29ee6d[_0x0714('0x11')]==='https:'?https:http;var _0x25a80c={'host':_0x29ee6d[_0x0714('0x12')],'path':_0x29ee6d[_0x0714('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x2cf89f[_0x0714('0x13')](_0x25a80c,function(_0x2f6a55){if(_0x2f6a55[_0x0714('0x14')]!==0xc8){logger[_0x0714('0x15')]('request\x20to\x20'+_0x1e4271+'\x20failed,\x20status\x20code\x20=\x20'+_0x2f6a55[_0x0714('0x14')]+'\x20('+_0x2f6a55[_0x0714('0x16')]+')');_0x4c0863(new Error('request\x20to\x20'+_0x1e4271+'\x20failed,\x20status\x20code\x20=\x20'+_0x2f6a55[_0x0714('0x14')]+'\x20('+_0x2f6a55[_0x0714('0x16')]+')'));return;}var _0x522259=fs[_0x0714('0x17')](_0x37f826);_0x522259['on'](_0x0714('0x18'),function(){logger[_0x0714('0x19')]('finish\x20download\x20file');_0x522259[_0x0714('0x1a')](_0x45575e);});_0x522259['on'](_0x0714('0x15'),function(_0x285c93){fs[_0x0714('0x1b')](_0x37f826);logger[_0x0714('0x15')](_0x0714('0x1c'),_0x285c93);_0x4c0863(_0x285c93);});_0x2f6a55[_0x0714('0x1d')](_0x522259);})['on']('error',function(_0x5e44e0){logger[_0x0714('0x15')](_0x5e44e0);_0x4c0863(_0x5e44e0);})['end']();});}function uploadFile(_0x192b83){return new BPromise(function(_0x1c1aee,_0x88f0ce){var _0x4ec38a=urlParse(_0x192b83);var _0x169b95=_0x4ec38a[_0x0714('0x11')]===_0x0714('0x1e')?https:http;var _0x566cc0={'host':_0x4ec38a[_0x0714('0x12')],'path':_0x4ec38a['path'],'headers':{'user-agent':_0x0714('0x1f')}};_0x169b95[_0x0714('0x13')](_0x566cc0,function(_0x52f313){if(_0x52f313[_0x0714('0x14')]!==0xc8){_0x88f0ce(new Error(_0x0714('0x20')+_0x192b83+'\x20failed,\x20status\x20code\x20=\x20'+_0x52f313[_0x0714('0x14')]+'\x20('+_0x52f313[_0x0714('0x16')]+')'));return;}var _0x38f7ca='';_0x52f313['on'](_0x0714('0x21'),function(_0x34453d){_0x38f7ca+=_0x34453d;});_0x52f313['on'](_0x0714('0x22'),function(){_0x1c1aee(_0x38f7ca);});})['on'](_0x0714('0x15'),function(_0x4e34bd){_0x88f0ce(_0x4e34bd);})[_0x0714('0x22')]();});}function convertFile(_0x2d43e9,_0x37864c){return new BPromise(function(_0xfc80d,_0x27aaa8){var _0x1f7bf4=sox[_0x0714('0x23')](_0x2d43e9,_0x37864c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f7bf4['on']('error',function(_0x1da91e){logger[_0x0714('0x15')](_0x0714('0x24'),_0x1da91e);_0x27aaa8(_0x1da91e);});_0x1f7bf4['on'](_0x0714('0x22'),function(){logger['info'](_0x0714('0x25'));_0xfc80d();});_0x1f7bf4[_0x0714('0x26')]();});}function base64Decode(_0x25660b,_0x2ba67a){var _0xb145a3=path[_0x0714('0x27')](__dirname,'tmp',rs[_0x0714('0x28')](0x4)+_0x0714('0x29'));fs['writeFileSync'](_0xb145a3,_0x25660b,_0x0714('0x2a'));return convertFile(_0xb145a3,_0x2ba67a)[_0x0714('0x2b')](function(){try{fs[_0x0714('0x1b')](_0xb145a3);fs[_0x0714('0x2c')](_0x2ba67a,'777');}catch(_0x2bdaaf){logger[_0x0714('0x15')](_0x2bdaaf);}return _0x2ba67a[_0x0714('0x2d')]('.')[0x0];});}function base64Encode(_0x56b98f){var _0x5f1bb4=fs[_0x0714('0x2e')](_0x56b98f);return new Buffer(_0x5f1bb4)[_0x0714('0x2f')](_0x0714('0x2a'));}exports[_0x0714('0x30')]=function(_0x496964,_0x464f88,_0x3fad95,_0x1d402c,_0x87be5,_0x5e3701){var _0x550439,_0x153233;var _0x109933=_0x0714('0x31');var _0x1745ba=_0x0714('0x32')+_0x496964;var _0x2e5cb0={};if(_0x464f88===_0x0714('0x33')){_0x2e5cb0[_0x0714('0x34')]={'ssml':_0x3fad95};}else{_0x2e5cb0[_0x0714('0x34')]={'text':_0x3fad95};};_0x2e5cb0['voice']={'languageCode':_0x1d402c,'ssmlGender':_0x87be5};_0x2e5cb0[_0x0714('0x35')]={'audioEncoding':_0x0714('0x36'),'sampleRateHertz':0x1f40};var _0x4de214={'url':_0x109933+_0x0714('0x37')+_0x1745ba,'method':_0x0714('0x38'),'json':!![],'body':_0x2e5cb0};return rp(_0x4de214)[_0x0714('0x2b')](function(_0x3a352e){return new BPromise(function(_0x204db1,_0x59a207){_0x550439=path[_0x0714('0x27')](__dirname,_0x0714('0x39'),rs[_0x0714('0x28')](0x4)+_0x0714('0x3a'));var _0x1df682=Buffer[_0x0714('0x3b')](_0x3a352e[_0x0714('0x3c')],'base64');return fs['writeFile'](_0x550439,_0x1df682,function(_0x2c87bc){_0x59a207(_0x2c87bc);},function(_0x256301){fs[_0x0714('0x2c')](_0x550439,'777');_0x204db1(_0x256301);});});})[_0x0714('0x2b')](function(_0x320d4f){_0x153233=path[_0x0714('0x27')](__dirname,_0x0714('0x39'),rs['generate'](0x4)+_0x0714('0x29'));return convertFile(_0x550439,_0x153233);})[_0x0714('0x2b')](function(){try{fs[_0x0714('0x1b')](_0x550439);fs[_0x0714('0x2c')](_0x153233,_0x0714('0x3d'));}catch(_0x55a678){logger[_0x0714('0x15')](_0x55a678);}logger[_0x0714('0x19')]('googleCloudTTS\x20path',_0x153233[_0x0714('0x2d')]('.')[0x0]);return _0x153233[_0x0714('0x2d')]('.')[0x0];});};exports[_0x0714('0x3e')]=function(_0x216379,_0x1ac6a2){var _0x32a63a='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1ebb42,_0x4ca7c3;var _0x15b83e;var _0x24e65e={'encoding':_0x0714('0x3f'),'method':_0x0714('0x38'),'timeout':0x2710,'url':_0x32a63a,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x0714('0x40')+encodeURIComponent(JSON['stringify']([[[_0x0714('0x41'),JSON['stringify']([_0x216379,_0x1ac6a2||'en',![],_0x0714('0x42')]),null,_0x0714('0x43')]]]))};return rp(_0x24e65e)[_0x0714('0x2b')](function(_0x37b901){try{_0x15b83e=eval(_0x37b901[_0x0714('0x44')](0x5))[0x0][0x2];}catch(_0x54934a){throw new Error('parse\x20response\x20failed:\x0a'+_0x37b901[_0x0714('0x21')]);}if(!_0x15b83e){if(_0x216379[_0x0714('0x45')]>0xc8){throw new Error(_0x0714('0x46'));}else{throw new Error(_0x0714('0x47')+_0x1ac6a2+_0x0714('0x48'));}}try{_0x15b83e=eval(_0x15b83e)[0x0];}catch(_0x131c48){throw new Error(_0x0714('0x49')+res[_0x0714('0x21')]);}const _0x9509f=_0x15b83e;_0x1ebb42=path['resolve'](__dirname,_0x0714('0x39'),rs['generate'](0x4)+_0x0714('0x3a'));fs[_0x0714('0x4a')](_0x1ebb42,_0x15b83e,{'encoding':_0x0714('0x2a')});_0x4ca7c3=path[_0x0714('0x27')](__dirname,_0x0714('0x39'),rs[_0x0714('0x28')](0x4)+_0x0714('0x29'));return convertFile(_0x1ebb42,_0x4ca7c3);})[_0x0714('0x2b')](function(){try{fs[_0x0714('0x1b')](_0x1ebb42);fs[_0x0714('0x2c')](_0x4ca7c3,_0x0714('0x3d'));}catch(_0x4b4c46){logger[_0x0714('0x15')](_0x4b4c46);}logger['info']('goggleTTS\x20path',_0x4ca7c3['split']('.')[0x0]);return _0x4ca7c3[_0x0714('0x2d')]('.')[0x0];});};exports[_0x0714('0x4b')]=function(_0x2feba3,_0x516747,_0xdeb17c){return google[_0x0714('0x4c')](_0x2feba3,_0x516747,_0xdeb17c)[_0x0714('0x2b')](function(_0xb4b80b){logger[_0x0714('0x19')](_0xb4b80b[_0x0714('0x4d')]);return rp(_0xb4b80b);})[_0x0714('0x2b')](function(_0x324813){var _0xe73222='';var _0x5aec6b=0x0;try{fs[_0x0714('0x1b')](_0x2feba3);}catch(_0x56746f){logger[_0x0714('0x15')](_0x56746f);}if(_0x324813&&_0x324813[_0x0714('0x4e')]){_0xe73222=_0x324813['results']['map'](function(_0x47adce){return _0x47adce&&_0x47adce[_0x0714('0x4f')][0x0]&&_0x47adce['alternatives'][0x0][_0x0714('0x50')]?_0x47adce[_0x0714('0x4f')][0x0][_0x0714('0x50')]:'';})['join']('\x0a');_0x5aec6b=_0x324813[_0x0714('0x4e')][_0x0714('0x51')](function(_0x5dec5f){return _0x5dec5f&&_0x5dec5f[_0x0714('0x4f')][0x0]&&_0x5dec5f[_0x0714('0x4f')][0x0][_0x0714('0x52')]?_0x5dec5f['alternatives'][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x0714('0x19')](_0x0714('0x53'),_0xe73222);logger[_0x0714('0x19')](_0x0714('0x54'),_0x5aec6b);return{'transcript':_0xe73222,'confidence':_0x5aec6b};})[_0x0714('0x55')](function(_0x4fc8bf){logger[_0x0714('0x15')](_0x0714('0x56'),_0x4fc8bf[_0x0714('0x14')],_0x4fc8bf[_0x0714('0x57')],_0x4fc8bf[_0x0714('0x58')]);});};exports[_0x0714('0x59')]=function(_0x3edb27,_0x1f73df,_0x28866e,_0x42abee){var _0x45bde5=apiai(_0x1f73df,{'language':_0x42abee||'en'});return _0x45bde5['textRequest'](_0x28866e,{'sessionId':md5(_0x3edb27)})[_0x0714('0x2b')](function(_0x52af49){logger['info'](JSON[_0x0714('0x5a')](_0x52af49));return{'source':_0x52af49[_0x0714('0x5b')][_0x0714('0x5c')],'resolvedQuery':_0x52af49[_0x0714('0x5b')]['resolvedQuery'],'action':_0x52af49[_0x0714('0x5b')][_0x0714('0x5d')],'actionIncomplete':_0x52af49[_0x0714('0x5b')][_0x0714('0x5e')],'speech':_0x52af49['result'][_0x0714('0x5f')][_0x0714('0x60')],'score':_0x52af49[_0x0714('0x5b')][_0x0714('0x61')],'statusCode':_0x52af49['status']['code'],'endConversation':_0x52af49['result'][_0x0714('0x62')][_0x0714('0x63')]||![],'isFallbackIntent':_0x52af49['result'][_0x0714('0x62')]['isFallbackIntent']};});};exports[_0x0714('0x64')]=function(_0x239e8e,_0x5a5b03,_0x24d304,_0xd76af0,_0x407bc1,_0x11ef77){var _0x57d025=_0xd76af0[_0x0714('0x65')](/\\n/g,'\x0a');var _0x36284a={'credentials':{'private_key':_0x57d025,'client_email':_0x24d304}};var _0x2a90bc=new dialogflow['SessionsClient'](_0x36284a);var _0x597c97=_0x2a90bc[_0x0714('0x66')](_0x5a5b03,md5(_0x239e8e));var _0x1b3d45={'session':_0x597c97,'queryInput':{'text':{'text':_0x407bc1,'languageCode':_0x11ef77}}};return _0x2a90bc[_0x0714('0x67')](_0x1b3d45)['then'](function(_0x2e49c3){if(_0x2e49c3&&_0x2e49c3[_0x0714('0x45')]){logger['info'](_0x0714('0x68'),JSON['stringify'](_0x2e49c3));var _0x523ce4=_0x2e49c3[0x0];if(_0x523ce4){var _0x1ebf76={'action':_0x523ce4[_0x0714('0x69')]['action'],'allRequiredParamsPresent':_0x523ce4[_0x0714('0x69')][_0x0714('0x6a')],'endConversation':_0x523ce4[_0x0714('0x69')]['diagnosticInfo']&&_0x523ce4[_0x0714('0x69')][_0x0714('0x6b')]['fields']?_0x523ce4[_0x0714('0x69')][_0x0714('0x6b')]['fields'][_0x0714('0x6c')][_0x0714('0x6d')]:![],'fulfillmentText':_0x523ce4[_0x0714('0x69')][_0x0714('0x6e')],'intentName':_0x523ce4['queryResult']['intent'][_0x0714('0x57')],'intentDisplayName':_0x523ce4[_0x0714('0x69')][_0x0714('0x6f')][_0x0714('0x70')],'isFallbackIntent':_0x523ce4[_0x0714('0x69')][_0x0714('0x6f')][_0x0714('0x71')],'languageCode':_0x523ce4[_0x0714('0x69')][_0x0714('0x72')],'queryText':_0x523ce4[_0x0714('0x69')][_0x0714('0x73')],'responseId':_0x523ce4[_0x0714('0x74')],'score':_0x523ce4[_0x0714('0x69')][_0x0714('0x75')],'speech':_0x523ce4[_0x0714('0x69')][_0x0714('0x6e')],'providerResponse':JSON[_0x0714('0x5a')](_0x2e49c3)};return _0x1ebf76;}}});};exports['tildeASR']=function(_0x4e640e,_0x120729,_0x3c103a,_0x3d01da){return tilde[_0x0714('0x4c')](_0x4e640e,_0x120729,_0x3c103a,_0x3d01da)[_0x0714('0x2b')](function(_0x5b6aaa){try{fs[_0x0714('0x1b')](_0x4e640e);}catch(_0x20c403){logger[_0x0714('0x15')](_0x20c403);}logger[_0x0714('0x19')](_0x0714('0x76'),_0x5b6aaa[_0x0714('0x50')]);logger['info'](_0x0714('0x77'),_0x5b6aaa[_0x0714('0x52')]);return _0x5b6aaa;});};exports[_0x0714('0x78')]=function(_0x2cf54c,_0x300c6d,_0x533865,_0x4bb2f6,_0x59623e,_0x3534e4){var _0x5a9acd=path['resolve'](__dirname,_0x0714('0x39'),rs[_0x0714('0x28')](0x4)+_0x0714('0x3a'));var _0x5a07fe;return aws[_0x0714('0x79')](_0x2cf54c,_0x300c6d,_0x533865,_0x4bb2f6,_0x59623e,_0x3534e4,_0x5a9acd)['then'](function(){_0x5a07fe=path[_0x0714('0x27')](__dirname,_0x0714('0x39'),rs[_0x0714('0x28')](0x4)+'.wav');return convertFile(_0x5a9acd,_0x5a07fe);})['then'](function(){try{fs[_0x0714('0x1b')](_0x5a9acd);fs[_0x0714('0x2c')](_0x5a07fe,_0x0714('0x3d'));}catch(_0x242aa2){logger[_0x0714('0x15')](_0x242aa2);}return _0x5a07fe[_0x0714('0x2d')]('.')[0x0];});};exports[_0x0714('0x7a')]=function(_0x466b17,_0x54ed51,_0x168431,_0x5d8735,_0x52eea6,_0x5ffafc){return aws[_0x0714('0x7b')](_0x466b17,_0x54ed51,_0x168431,_0x5d8735,_0x52eea6,_0x5ffafc)[_0x0714('0x2b')](function(_0x272fdb){logger[_0x0714('0x19')](JSON[_0x0714('0x5a')](_0x272fdb));return _0x272fdb;});};exports[_0x0714('0x7c')]=function(_0x24047d,_0x50de7a,_0x2aa742,_0x344843){var _0x2f0d02=util['format'](_0x0714('0x7d'),ISPEECH_API,_0x24047d,encodeURIComponent(_0x50de7a),_0x2aa742,_0x344843);var _0x14d5f1=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x0714('0x3a'));var _0x3f7d2c;return downloadFile(_0x2f0d02,_0x14d5f1)['then'](function(){_0x3f7d2c=path[_0x0714('0x27')](__dirname,'tmp',rs[_0x0714('0x28')](0x4)+_0x0714('0x29'));return convertFile(_0x14d5f1,_0x3f7d2c);})[_0x0714('0x2b')](function(){try{fs[_0x0714('0x1b')](_0x14d5f1);fs['chmodSync'](_0x3f7d2c,_0x0714('0x3d'));}catch(_0x50e14d){logger[_0x0714('0x15')](_0x50e14d);}return _0x3f7d2c[_0x0714('0x2d')]('.')[0x0];});};exports[_0x0714('0x7e')]=function(_0x4feacf,_0x102636,_0x56eda7,_0x4ffaa6){var _0x7dc32d=util['format'](_0x0714('0x7f'),ISPEECH_API,_0x102636,_0x56eda7,base64Encode(_0x4feacf),_0x4ffaa6?util[_0x0714('0x80')](_0x0714('0x81'),encodeURIComponent(_0x4ffaa6)):'freeform=3');return uploadFile(_0x7dc32d)[_0x0714('0x2b')](function(_0xf8217a){return querystring[_0x0714('0xa')](_0xf8217a);});};exports[_0x0714('0x82')]=function(_0x4b68a0,_0x2153c0){return sestek['nda'](_0x4b68a0,_0x2153c0)[_0x0714('0x2b')](function(_0x2d4e56){logger[_0x0714('0x19')](JSON[_0x0714('0x5a')](_0x2d4e56));var _0x3b85fa={'speech':_0x2d4e56[_0x0714('0x83')],'action':_0x2d4e56['channelData']?_0x2d4e56[_0x0714('0x84')][_0x0714('0x85')]:undefined,'actiondata':_0x2d4e56[_0x0714('0x84')]?_0x2d4e56['channelData'][_0x0714('0x86')]:undefined};if(_0x2d4e56[_0x0714('0x84')]&&_0x2d4e56[_0x0714('0x84')][_0x0714('0x87')]){return base64Decode(_0x2d4e56['channelData']['AudioFromTts']['Data'],path[_0x0714('0x27')](__dirname,_0x0714('0x39'),rs[_0x0714('0x28')](0x4)+_0x0714('0x29')))[_0x0714('0x2b')](function(_0x1ee533){_0x3b85fa[_0x0714('0x88')]=_0x1ee533;return _0x3b85fa;});}return _0x3b85fa;});};exports[_0x0714('0x89')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 0786b09..40e09a4 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 _0x5710=['exports'];(function(_0x541520,_0x5cfab4){var _0x18b530=function(_0x14612b){while(--_0x14612b){_0x541520['push'](_0x541520['shift']());}};_0x18b530(++_0x5cfab4);}(_0x5710,0x1d9));var _0x0571=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5710[_0x2d7f0e];return _0x110b07;};var nda=require('./nda');module[_0x0571('0x0')]={'nda':nda}; \ No newline at end of file +var _0xc688=['./nda','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xc688,0x1a2));var _0x8c68=function(_0x342b97,_0x371adb){_0x342b97=_0x342b97-0x0;var _0x171688=_0xc688[_0x342b97];return _0x171688;};var nda=require(_0x8c68('0x0'));module[_0x8c68('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index f1f9b90..1f8ac9f 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 _0xd0d5=['channelData','ProjectName','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','ndauth_url','/token','password','username','then','POST','resolve','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token'];(function(_0x417499,_0x219662){var _0x433103=function(_0x54f2f6){while(--_0x54f2f6){_0x417499['push'](_0x417499['shift']());}};_0x433103(++_0x219662);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x337c2d,_0x17cf54){_0x337c2d=_0x337c2d-0x0;var _0x604063=_0xd0d5[_0x337c2d];return _0x604063;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0x2c7013,_0x3d99f8){var _0x35cf41={'method':'POST','uri':url['resolve'](_0x3d99f8[_0x5d0d('0x0')],_0x5d0d('0x1')),'form':{'grant_type':_0x5d0d('0x2'),'username':_0x3d99f8[_0x5d0d('0x3')],'password':_0x3d99f8['password']},'json':!![]};return rp(_0x35cf41)[_0x5d0d('0x4')](function(_0xcfec38){var _0x11c549={'method':_0x5d0d('0x5'),'uri':url[_0x5d0d('0x6')](_0x3d99f8['ndassistant_url'],_0x5d0d('0x7')),'body':{'type':_0x3d99f8['ndaactivity_type']||_0x5d0d('0x8'),'channelId':_0x5d0d('0x9'),'conversation':{'id':_0x2c7013[_0x5d0d('0xa')]},'from':{'id':_0x2c7013[_0x5d0d('0xb')],'name':_0x2c7013[_0x5d0d('0xc')]},'recipient':{'id':_0x2c7013[_0x5d0d('0xd')],'name':_0x2c7013[_0x5d0d('0xe')]},'text':_0x3d99f8['text'],'channelData':{}},'headers':{'Authorization':_0x5d0d('0xf')+_0xcfec38[_0x5d0d('0x10')]},'json':!![]};if(_0x3d99f8['project']){_0x11c549['body'][_0x5d0d('0x11')][_0x5d0d('0x12')]=_0x3d99f8[_0x5d0d('0x13')];}if(_0x3d99f8[_0x5d0d('0x14')]=='1'){_0x11c549[_0x5d0d('0x15')][_0x5d0d('0x11')][_0x5d0d('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5d0d('0x17')};}if(_0x3d99f8[_0x5d0d('0x18')]){_0x11c549[_0x5d0d('0x15')][_0x5d0d('0x11')][_0x5d0d('0x19')]=_0x3d99f8[_0x5d0d('0x18')];if(_0x3d99f8[_0x5d0d('0x1a')]){_0x11c549['body'][_0x5d0d('0x11')][_0x5d0d('0x1b')]=_0x3d99f8['custom_action_data'];}}logger[_0x5d0d('0x1c')](JSON[_0x5d0d('0x1d')](_0x11c549));return rp(_0x11c549);});}; \ No newline at end of file +var _0x63c6=['custom_action','CustomAction','custom_action_data','body','CustomActionData','info','stringify','request-promise','url','exports','POST','resolve','ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','access_token','project','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x1b4264,_0x1f6663){var _0x3e667c=function(_0x3d99f5){while(--_0x3d99f5){_0x1b4264['push'](_0x1b4264['shift']());}};_0x3e667c(++_0x1f6663);}(_0x63c6,0xbb));var _0x663c=function(_0x2094eb,_0x234a56){_0x2094eb=_0x2094eb-0x0;var _0x36e9af=_0x63c6[_0x2094eb];return _0x36e9af;};'use strict';var rp=require(_0x663c('0x0'));var url=require(_0x663c('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x663c('0x2')]=function(_0x859d1d,_0x34c708){var _0x1a2514={'method':_0x663c('0x3'),'uri':url[_0x663c('0x4')](_0x34c708[_0x663c('0x5')],_0x663c('0x6')),'form':{'grant_type':_0x663c('0x7'),'username':_0x34c708['username'],'password':_0x34c708[_0x663c('0x7')]},'json':!![]};return rp(_0x1a2514)[_0x663c('0x8')](function(_0x3eb551){var _0xb32d9e={'method':'POST','uri':url[_0x663c('0x4')](_0x34c708['ndassistant_url'],_0x663c('0x9')),'body':{'type':_0x34c708['ndaactivity_type']||_0x663c('0xa'),'channelId':_0x663c('0xb'),'conversation':{'id':_0x859d1d[_0x663c('0xc')]},'from':{'id':_0x859d1d[_0x663c('0xd')],'name':_0x859d1d[_0x663c('0xe')]},'recipient':{'id':_0x859d1d[_0x663c('0xf')],'name':_0x859d1d[_0x663c('0x10')]},'text':_0x34c708['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3eb551[_0x663c('0x11')]},'json':!![]};if(_0x34c708[_0x663c('0x12')]){_0xb32d9e['body'][_0x663c('0x13')][_0x663c('0x14')]=_0x34c708[_0x663c('0x12')];}if(_0x34c708[_0x663c('0x15')]=='1'){_0xb32d9e['body'][_0x663c('0x13')][_0x663c('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x34c708[_0x663c('0x17')]){_0xb32d9e['body'][_0x663c('0x13')][_0x663c('0x18')]=_0x34c708[_0x663c('0x17')];if(_0x34c708[_0x663c('0x19')]){_0xb32d9e[_0x663c('0x1a')][_0x663c('0x13')][_0x663c('0x1b')]=_0x34c708[_0x663c('0x19')];}}logger[_0x663c('0x1c')](JSON[_0x663c('0x1d')](_0xb32d9e));return rp(_0xb32d9e);});}; \ 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 8058122..1002c0b 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 _0x5b0d=['./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b0d,0x1b7));var _0xd5b0=function(_0x44f6fb,_0x5497bd){_0x44f6fb=_0x44f6fb-0x0;var _0x4fd521=_0x5b0d[_0x44f6fb];return _0x4fd521;};'use strict';var asr=require(_0xd5b0('0x0'));module['exports']=function(_0x2587da,_0x14dc2e,_0x41a855,_0x513ffc){return asr(_0x2587da,_0x14dc2e,_0x41a855,_0x513ffc);}; \ No newline at end of file +var _0xe759=['exports','./lib/api'];(function(_0x5c8cf2,_0x663ad7){var _0x1976dc=function(_0x46cddd){while(--_0x46cddd){_0x5c8cf2['push'](_0x5c8cf2['shift']());}};_0x1976dc(++_0x663ad7);}(_0xe759,0x9f));var _0x9e75=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe759[_0x14add3];return _0x4a174f;};'use strict';var asr=require(_0x9e75('0x0'));module[_0x9e75('0x1')]=function(_0x11f2d9,_0x46cca7,_0x2d9c71,_0x43930f){return asr(_0x11f2d9,_0x46cca7,_0x2d9c71,_0x43930f);}; \ 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 4be0dd7..3800488 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 _0xc722=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','close','EOS','error','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate'];(function(_0x17b7da,_0xb0d6f8){var _0x369ffc=function(_0x4e87d2){while(--_0x4e87d2){_0x17b7da['push'](_0x17b7da['shift']());}};_0x369ffc(++_0xb0d6f8);}(_0xc722,0x17a));var _0x2c72=function(_0x3c4884,_0x4dc2da){_0x3c4884=_0x3c4884-0x0;var _0x573a6c=_0xc722[_0x3c4884];return _0x573a6c;};'use strict';var BPromise=require(_0x2c72('0x0'));var _=require(_0x2c72('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2c72('0x2'));var crypto=require(_0x2c72('0x3'));var logger=require(_0x2c72('0x4'))('agi');module[_0x2c72('0x5')]=function(_0xd6f1b4,_0x3b253a,_0x448481,_0x48b60c){return new BPromise(function(_0x508f2d,_0x232200){logger[_0x2c72('0x6')]('Tilde\x20URI',_0x48b60c||_0x2c72('0x7'));var _0xb93462=new WebSocket(_0x48b60c||_0x2c72('0x7'),{'perMessageDeflate':![]});var _0x461516='';var _0x2b88a6='0';var _0x3b9947='1';var _0x25f8e1=_0x2c72('0x8');function _0x5bf927(_0x1f26f5){var _0x1ea39b=crypto[_0x2c72('0x9')]('sha1');_0x1ea39b[_0x2c72('0xa')](_0x1f26f5);return _0x1ea39b[_0x2c72('0xb')](_0x2c72('0xc'));}function _0x2af558(){try{logger[_0x2c72('0x6')](_0x2c72('0xd'));var _0x4edf49=moment()['unix']();var _0x3de4e8=_0x5bf927(_0x4edf49+_0x3b253a+_0x448481);_0xb93462[_0x2c72('0xe')](JSON[_0x2c72('0xf')]({'appID':_0x3b253a,'timestamp':_0x4edf49,'appKey':_0x3de4e8}));var _0x5af611=fs[_0x2c72('0x10')](_0xd6f1b4);_0x5af611['on']('data',function(_0xd2b590){_0xb93462['send'](_0xd2b590);});_0x5af611['on'](_0x2c72('0x11'),function(){_0xb93462['send'](_0x2c72('0x12'));});}catch(_0x475858){logger[_0x2c72('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x2c72('0xf')](_0x475858));_0xb93462['terminate']();}}function _0x3a1773(_0x396e23){try{if(_0x396e23){var _0x55e4dc=JSON[_0x2c72('0x14')](_0x396e23);switch(_0x55e4dc[_0x2c72('0x15')]){case 0x0:if(_0x55e4dc['result']){if(_0x55e4dc[_0x2c72('0x16')]['final']){logger[_0x2c72('0x6')](_0x2c72('0x17'),JSON['stringify'](_0x55e4dc[_0x2c72('0x16')][_0x2c72('0x18')]));_0x461516=_0x55e4dc[_0x2c72('0x16')][_0x2c72('0x18')][0x0][_0x2c72('0x19')];_0x2b88a6=_0x55e4dc[_0x2c72('0x16')]['hypotheses'][0x0][_0x2c72('0x1a')];_0x3b9947='0';_0x25f8e1=_0x2c72('0x1b');_0xb93462[_0x2c72('0x1c')]();}}break;case 0x1:logger['info'](_0x2c72('0x8'));_0x3b9947='1';_0x25f8e1=_0x2c72('0x8');break;case 0x2:logger['info'](_0x2c72('0x1d'));_0x3b9947='2';_0x25f8e1=_0x2c72('0x1d');break;case 0x9:logger[_0x2c72('0x6')](_0x2c72('0x1e'));_0x3b9947='9';_0x25f8e1=_0x2c72('0x1e');break;case 0xa:logger['info'](_0x2c72('0x1f'));_0x3b9947='10';_0x25f8e1=_0x2c72('0x1f');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3b9947='11';_0x25f8e1='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x412c7a){logger['error'](_0x2c72('0x20'),JSON[_0x2c72('0xf')](_0x412c7a));_0xb93462[_0x2c72('0x1c')]();}}function _0x1a0c22(){logger[_0x2c72('0x6')](_0x2c72('0x21'));_0x508f2d({'transcript':_0x461516,'confidence':_0x2b88a6,'status':_0x3b9947,'status_message':_0x25f8e1});}function _0xde1b32(_0x179a58){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x2c72('0x22')](_0x179a58)){logger['error'](_[_0x2c72('0x23')](_0x179a58)?JSON[_0x2c72('0xf')](_0x179a58):_0x179a58);}}_0xb93462['on']('open',_0x2af558);_0xb93462['on'](_0x2c72('0x24'),_0x3a1773);_0xb93462['on'](_0x2c72('0x11'),_0x1a0c22);_0xb93462['on'](_0x2c72('0x13'),_0xde1b32);});}; \ No newline at end of file +var _0xffb8=['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','open','message','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech'];(function(_0x4bfc64,_0x25976d){var _0x5d8f2a=function(_0x5d184a){while(--_0x5d184a){_0x4bfc64['push'](_0x4bfc64['shift']());}};_0x5d8f2a(++_0x25976d);}(_0xffb8,0x1a5));var _0x8ffb=function(_0x547d74,_0x435559){_0x547d74=_0x547d74-0x0;var _0x19ecf8=_0xffb8[_0x547d74];return _0x19ecf8;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8ffb('0x0'));var crypto=require(_0x8ffb('0x1'));var logger=require(_0x8ffb('0x2'))(_0x8ffb('0x3'));module[_0x8ffb('0x4')]=function(_0x243c2b,_0x5c49b4,_0x50b503,_0x2a2b49){return new BPromise(function(_0xf0932f,_0x87f481){logger[_0x8ffb('0x5')](_0x8ffb('0x6'),_0x2a2b49||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1b80ef=new WebSocket(_0x2a2b49||_0x8ffb('0x7'),{'perMessageDeflate':![]});var _0x53bf6d='';var _0x546028='0';var _0x4c1478='1';var _0x3112c8='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2bc57e(_0x1a824b){var _0xc477a6=crypto[_0x8ffb('0x8')](_0x8ffb('0x9'));_0xc477a6[_0x8ffb('0xa')](_0x1a824b);return _0xc477a6[_0x8ffb('0xb')](_0x8ffb('0xc'));}function _0x3f417b(){try{logger[_0x8ffb('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x16e9d7=moment()['unix']();var _0x3eac74=_0x2bc57e(_0x16e9d7+_0x5c49b4+_0x50b503);_0x1b80ef[_0x8ffb('0xd')](JSON[_0x8ffb('0xe')]({'appID':_0x5c49b4,'timestamp':_0x16e9d7,'appKey':_0x3eac74}));var _0x1c2c77=fs[_0x8ffb('0xf')](_0x243c2b);_0x1c2c77['on'](_0x8ffb('0x10'),function(_0x24e56f){_0x1b80ef[_0x8ffb('0xd')](_0x24e56f);});_0x1c2c77['on'](_0x8ffb('0x11'),function(){_0x1b80ef[_0x8ffb('0xd')]('EOS');});}catch(_0x5cb2d4){logger[_0x8ffb('0x12')](_0x8ffb('0x13'),JSON['stringify'](_0x5cb2d4));_0x1b80ef[_0x8ffb('0x14')]();}}function _0x2d4176(_0x1fc8f6){try{if(_0x1fc8f6){var _0xc1d367=JSON[_0x8ffb('0x15')](_0x1fc8f6);switch(_0xc1d367[_0x8ffb('0x16')]){case 0x0:if(_0xc1d367[_0x8ffb('0x17')]){if(_0xc1d367[_0x8ffb('0x17')][_0x8ffb('0x18')]){logger[_0x8ffb('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x8ffb('0xe')](_0xc1d367['result'][_0x8ffb('0x19')]));_0x53bf6d=_0xc1d367[_0x8ffb('0x17')][_0x8ffb('0x19')][0x0][_0x8ffb('0x1a')];_0x546028=_0xc1d367[_0x8ffb('0x17')]['hypotheses'][0x0][_0x8ffb('0x1b')];_0x4c1478='0';_0x3112c8=_0x8ffb('0x1c');_0x1b80ef[_0x8ffb('0x14')]();}}break;case 0x1:logger[_0x8ffb('0x5')](_0x8ffb('0x1d'));_0x4c1478='1';_0x3112c8=_0x8ffb('0x1d');break;case 0x2:logger['info'](_0x8ffb('0x1e'));_0x4c1478='2';_0x3112c8='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x8ffb('0x5')](_0x8ffb('0x1f'));_0x4c1478='9';_0x3112c8=_0x8ffb('0x1f');break;case 0xa:logger[_0x8ffb('0x5')](_0x8ffb('0x20'));_0x4c1478='10';_0x3112c8=_0x8ffb('0x20');break;case 0xb:logger[_0x8ffb('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4c1478='11';_0x3112c8=_0x8ffb('0x21');}}}catch(_0x4a51c2){logger['error'](_0x8ffb('0x22'),JSON[_0x8ffb('0xe')](_0x4a51c2));_0x1b80ef[_0x8ffb('0x14')]();}}function _0x295601(){logger[_0x8ffb('0x5')](_0x8ffb('0x23'));_0xf0932f({'transcript':_0x53bf6d,'confidence':_0x546028,'status':_0x4c1478,'status_message':_0x3112c8});}function _0x951143(_0x1b0e44){logger['error'](_0x8ffb('0x24'));if(!_[_0x8ffb('0x25')](_0x1b0e44)){logger['error'](_[_0x8ffb('0x26')](_0x1b0e44)?JSON[_0x8ffb('0xe')](_0x1b0e44):_0x1b0e44);}}_0x1b80ef['on'](_0x8ffb('0x27'),_0x3f417b);_0x1b80ef['on'](_0x8ffb('0x28'),_0x2d4176);_0x1b80ef['on'](_0x8ffb('0x11'),_0x295601);_0x1b80ef['on'](_0x8ffb('0x12'),_0x951143);});}; \ 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 25c3f95..e22a4ab 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 _0xe54b=['./asr','exports'];(function(_0x48b805,_0xb15d3a){var _0x4cf83a=function(_0x28f149){while(--_0x28f149){_0x48b805['push'](_0x48b805['shift']());}};_0x4cf83a(++_0xb15d3a);}(_0xe54b,0x140));var _0xbe54=function(_0x158ac0,_0x371119){_0x158ac0=_0x158ac0-0x0;var _0x28d797=_0xe54b[_0x158ac0];return _0x28d797;};var asr=require(_0xbe54('0x0'));module[_0xbe54('0x1')]={'asr':asr}; \ No newline at end of file +var _0xeee6=['./asr','exports'];(function(_0x6fb9c3,_0x539a3f){var _0x2c60b2=function(_0xb0247b){while(--_0xb0247b){_0x6fb9c3['push'](_0x6fb9c3['shift']());}};_0x2c60b2(++_0x539a3f);}(_0xeee6,0xbe));var _0x6eee=function(_0x259797,_0x583ed4){_0x259797=_0x259797-0x0;var _0x1d42dd=_0xeee6[_0x259797];return _0x1d42dd;};var asr=require(_0x6eee('0x0'));module[_0x6eee('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9f00d0e..4f4155d 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 _0x9266=['emit','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listening'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9266,0xad));var _0x6926=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x9266[_0xc67528];return _0x38e26d;};'use strict';var util=require(_0x6926('0x0'));var net=require(_0x6926('0x1'));var EventEmitter=require(_0x6926('0x2'))[_0x6926('0x3')];var AGIError=require(_0x6926('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x37f383,_0xcde8a3,_0x4841aa){var _0x151595=this,_0x37f383=_0x37f383||0x11dd,_0xcde8a3=_0xcde8a3||_0x6926('0x5'),_0x183d67=null,_0xfa8b20=0x0;EventEmitter[_0x6926('0x6')](_0x151595);function _0x158456(){if(!_0x37f383){_0x151595['emit'](_0x6926('0x7'),new AGIError(_0x6926('0x8')));return![];}_0x183d67=net[_0x6926('0x9')]();_0x183d67['listen'](_0x37f383,_0xcde8a3);_0x183d67['on'](_0x6926('0xa'),function(){_0x151595[_0x6926('0xb')](_0x6926('0xa'));});_0x183d67['on']('connection',function(_0x3c7922){_0x183d67[_0x6926('0xc')](function(_0x321800,_0x1b0b7b){if(_0x321800){_0x151595[_0x6926('0xb')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x321800));}else if(_0x4841aa&&_0x4841aa<0x0){_0x151595['emit'](_0x6926('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x3c7922[_0x6926('0xd')]();}else if(_0x4841aa&&_0x4841aa>0x0&&_0x4841aa<_0x1b0b7b){_0xfa8b20+=0x1;_0x151595[_0x6926('0xb')](_0x6926('0x7'),new AGIError(_0x6926('0xe'),_0xfa8b20));_0x3c7922[_0x6926('0xd')]();}else{var _0x8a7c0c=new AGIChannel(_0x3c7922);_0x8a7c0c['on']('ready',function(){_0x151595[_0x6926('0xb')](_0x6926('0xf'),_0x8a7c0c);});}});});_0x183d67['on'](_0x6926('0x7'),function(_0x5cbf2a){_0x151595[_0x6926('0xb')](_0x6926('0x7'),new AGIError(_0x6926('0x10'),_0x5cbf2a[_0x6926('0x11')]));});_0x183d67['on'](_0x6926('0x12'),function(){_0x151595[_0x6926('0xb')](_0x6926('0x12'),new AGIError(_0x6926('0x13')));});}process[_0x6926('0x14')](function(){_0x158456();});};util[_0x6926('0x15')](AGIServer,EventEmitter);module[_0x6926('0x16')]=function(_0x387fac,_0x35bb67,_0x392c37){return new AGIServer(_0x387fac,_0x35bb67,_0x392c37);}; \ No newline at end of file +var _0xe456=['util','EventEmitter','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','E_AGI_SERVER_CLOSE','nextTick','inherits','exports'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe456,0xf2));var _0x6e45=function(_0x3bd70e,_0xd68771){_0x3bd70e=_0x3bd70e-0x0;var _0x400f98=_0xe456[_0x3bd70e];return _0x400f98;};'use strict';var util=require(_0x6e45('0x0'));var net=require('net');var EventEmitter=require('events')[_0x6e45('0x1')];var AGIError=require('./error');var AGIChannel=require(_0x6e45('0x2'));var AGIServer=function(_0x84a4e0,_0x184ce9,_0x4828b6){var _0x1b0817=this,_0x84a4e0=_0x84a4e0||0x11dd,_0x184ce9=_0x184ce9||'127.0.0.1',_0x8db4ef=null,_0x495069=0x0;EventEmitter[_0x6e45('0x3')](_0x1b0817);function _0x30797d(){if(!_0x84a4e0){_0x1b0817[_0x6e45('0x4')](_0x6e45('0x5'),new AGIError(_0x6e45('0x6')));return![];}_0x8db4ef=net[_0x6e45('0x7')]();_0x8db4ef[_0x6e45('0x8')](_0x84a4e0,_0x184ce9);_0x8db4ef['on'](_0x6e45('0x9'),function(){_0x1b0817[_0x6e45('0x4')](_0x6e45('0x9'));});_0x8db4ef['on']('connection',function(_0x91ab6d){_0x8db4ef[_0x6e45('0xa')](function(_0x2c342b,_0x328942){if(_0x2c342b){_0x1b0817['emit'](_0x6e45('0x5'),new AGIError(_0x6e45('0xb'),_0x2c342b));}else if(_0x4828b6&&_0x4828b6<0x0){_0x1b0817[_0x6e45('0x4')](_0x6e45('0x5'),new AGIError(_0x6e45('0xc')));_0x91ab6d[_0x6e45('0xd')]();}else if(_0x4828b6&&_0x4828b6>0x0&&_0x4828b6<_0x328942){_0x495069+=0x1;_0x1b0817[_0x6e45('0x4')](_0x6e45('0x5'),new AGIError(_0x6e45('0xe'),_0x495069));_0x91ab6d[_0x6e45('0xd')]();}else{var _0x5b99a7=new AGIChannel(_0x91ab6d);_0x5b99a7['on'](_0x6e45('0xf'),function(){_0x1b0817[_0x6e45('0x4')](_0x6e45('0x10'),_0x5b99a7);});}});});_0x8db4ef['on'](_0x6e45('0x5'),function(_0x5b497f){_0x1b0817[_0x6e45('0x4')](_0x6e45('0x5'),new AGIError(_0x6e45('0xb'),_0x5b497f[_0x6e45('0x11')]));});_0x8db4ef['on']('close',function(){_0x1b0817[_0x6e45('0x4')]('close',new AGIError(_0x6e45('0x12')));});}process[_0x6e45('0x13')](function(){_0x30797d();});};util[_0x6e45('0x14')](AGIServer,EventEmitter);module[_0x6e45('0x15')]=function(_0x21fbd4,_0xa74876,_0x2d1320){return new AGIServer(_0x21fbd4,_0xa74876,_0x2d1320);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a202f89..90290fb 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 _0x1472=['rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','name','getSquareProject','getSquareProjectById','dsn','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','accountcode','file','createSquareMessage','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','clear','includes','clone','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','replaceAllVariables','saveRestApiResult','%s.%s','length','setVariable','split','extra','toString','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','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','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','tildeasr','no\x20appid\x20configured','appsecret','%s/recordings/%s','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','no\x20condition\x20configured','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20%s\x20file\x20created','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','pause','pause_id','failure','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayphonetic','sayPhonetic','sendMail','account_id','Smtp','user','bcc','subject','service','host','port','secure','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','path','util','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits'];(function(_0x24f737,_0x5440d1){var _0x55ba84=function(_0xc13648){while(--_0xc13648){_0x24f737['push'](_0x24f737['shift']());}};_0x55ba84(++_0x5440d1);}(_0x1472,0x1b6));var _0x2147=function(_0x31b350,_0x5be290){_0x31b350=_0x31b350-0x0;var _0x1870dc=_0x1472[_0x31b350];return _0x1870dc;};'use strict';var fs=require('fs');var path=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var _=require('lodash');var sh=require(_0x2147('0x2'));var odbc=require(_0x2147('0x3'))();var rs=require(_0x2147('0x4'));var moment=require(_0x2147('0x5'));var Mustache=require(_0x2147('0x6'));var rp=require(_0x2147('0x7'));var logger=require('../../config/logger')(_0x2147('0x8'));var config=require(_0x2147('0x9'));var scripts=require(_0x2147('0xa'));var FILES_PATH=_0x2147('0xb');var recursiveMapAttributes=[_0x2147('0xc'),_0x2147('0xd')];var verticesWithRetry=[_0x2147('0xe'),_0x2147('0xf'),'getsecretdigits'];var AGIVertices=function(_0x40e531,_0x3bac9a,_0x14475b){this['channel']=_0x40e531;this[_0x2147('0x10')]=_0x3bac9a;this[_0x2147('0x11')]=_0x14475b;};AGIVertices[_0x2147('0x12')][_0x2147('0x13')]=function(_0x49acb5,_0x28ffa8){this[_0x2147('0x10')][_0x2147('0x14')](_0x49acb5)[_0x2147('0x15')](function(_0x2da10){_0x28ffa8(null,_0x2da10?_0x2da10['name']:![]);})[_0x2147('0x16')](function(_0x1d2044){_0x28ffa8(_0x1d2044);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x5ac16e,_0x40d006){this[_0x2147('0x10')]['getVoiceQueueById'](_0x5ac16e)[_0x2147('0x15')](function(_0x4bddd9){_0x40d006(null,_0x4bddd9?_0x4bddd9[_0x2147('0x17')]:![]);})['catch'](function(_0x50850a){_0x40d006(_0x50850a);});};AGIVertices['prototype'][_0x2147('0x18')]=function(_0x6db5a2,_0x127efe){this[_0x2147('0x10')][_0x2147('0x19')](_0x6db5a2)[_0x2147('0x15')](function(_0x5e61f7){_0x127efe(null,_0x5e61f7?_0x5e61f7[_0x2147('0x17')]:![]);})[_0x2147('0x16')](function(_0x472ba6){_0x127efe(_0x472ba6);});};AGIVertices[_0x2147('0x12')]['getSquareOdbc']=function(_0x504062,_0x2378c4){this[_0x2147('0x10')]['getSquareOdbcById'](_0x504062)[_0x2147('0x15')](function(_0x5729ea){_0x2378c4(null,_0x5729ea?_0x5729ea[_0x2147('0x1a')]:![]);})[_0x2147('0x16')](function(_0x21b6b4){_0x2378c4(_0x21b6b4);});};AGIVertices['prototype']['getUser']=function(_0x2438c0,_0x14268c){this[_0x2147('0x10')]['getUserById'](_0x2438c0)[_0x2147('0x15')](function(_0x3fa8ed){_0x14268c(null,_0x3fa8ed?_0x3fa8ed[_0x2147('0x17')]:![]);})['catch'](function(_0x4184a1){_0x14268c(_0x4184a1);});};AGIVertices[_0x2147('0x12')]['getTrunk']=function(_0x405d5d,_0x4e0ac1){this[_0x2147('0x10')]['getTrunkById'](_0x405d5d)[_0x2147('0x15')](function(_0x5dcf95){_0x4e0ac1(null,_0x5dcf95?_0x5dcf95[_0x2147('0x17')]:![]);})['catch'](function(_0x56232c){_0x4e0ac1(_0x56232c);});};AGIVertices['prototype'][_0x2147('0x1b')]=function(_0x21fce2,_0x1229d9){var _0x352556=this;this[_0x2147('0x10')][_0x2147('0x1c')](_0x21fce2)[_0x2147('0x15')](function(_0x5a9eb4){_0x1229d9(null,_0x5a9eb4?_0x352556[_0x2147('0x1d')](_0x5a9eb4[_0x2147('0x1e')]):![]);})['catch'](function(_0x4afdbb){_0x1229d9(_0x4afdbb);});};AGIVertices['prototype'][_0x2147('0x1f')]=function(_0x4508b2,_0x2e3f1c){this['rpc'][_0x2147('0x20')](_0x4508b2)['then'](function(_0x5df0ff){_0x2e3f1c(null,_0x5df0ff?_0x5df0ff:![]);})['catch'](function(_0x443345){_0x2e3f1c(_0x443345);});};AGIVertices[_0x2147('0x12')][_0x2147('0x21')]=function(_0x485566,_0x1c1580,_0x167903){this[_0x2147('0x11')][_0x2147('0x21')](_0x485566,_0x1c1580)[_0x2147('0x15')](function(){_0x167903(null);})['catch'](function(_0x390940){_0x167903(_0x390940);});};AGIVertices[_0x2147('0x12')][_0x2147('0x22')]=function(_0x5d544d,_0x53cb15){this[_0x2147('0x10')][_0x2147('0x23')](_0x5d544d)[_0x2147('0x15')](function(_0x37a6ec){if(_0x37a6ec){if(_0x37a6ec[_0x2147('0x24')]){_0x53cb15(null,[_0x37a6ec[_0x2147('0x25')]]);}else{_0x53cb15(null,_[_0x2147('0x26')](_0x37a6ec[_0x2147('0x27')],_0x2147('0x25')));}}else{_0x53cb15(null,![]);}})[_0x2147('0x16')](function(_0x251ca8){_0x53cb15(_0x251ca8);});};AGIVertices[_0x2147('0x12')][_0x2147('0x1d')]=function(_0x43794c){return util['format'](_0x2147('0x28'),FILES_PATH,_0x43794c);};AGIVertices[_0x2147('0x12')][_0x2147('0x29')]=function(_0x15d17d,_0xaca1cc,_0x270c88){odbc['open'](_0x15d17d,function(_0x3a58f1){if(_0x3a58f1){logger[_0x2147('0x2a')](_0x2147('0x2b'),_0x3a58f1);_0x270c88(_0x3a58f1);}else{logger[_0x2147('0x2c')](_0x2147('0x2d'));odbc[_0x2147('0x2e')](_0xaca1cc,function(_0x32eccc,_0x1f0cb0){if(_0x32eccc){logger[_0x2147('0x2c')]('Error\x20executing\x20query\x20%s',_0xaca1cc);_0x270c88(_0x32eccc);}else{logger[_0x2147('0x2c')](_0x2147('0x2f'),_0xaca1cc);odbc[_0x2147('0x30')](function(_0x3bdb12){if(_0x3bdb12){logger['error'](_0x2147('0x31'),_0x3bdb12);}_0x270c88(null,_0x1f0cb0);});}});}});};AGIVertices['prototype'][_0x2147('0x32')]=function(_0x3fb82f,_0x48641){this[_0x2147('0x10')][_0x2147('0x33')](_0x3fb82f)[_0x2147('0x15')](function(_0x3907fb){_0x48641(null,_0x3907fb?_0x3907fb:![]);})[_0x2147('0x16')](function(_0x3993e5){_0x48641(_0x3993e5);});};AGIVertices[_0x2147('0x12')][_0x2147('0x34')]=function(_0x449321,_0x1583f7){this[_0x2147('0x10')][_0x2147('0x34')](_0x449321)['then'](function(_0x532bfd){_0x1583f7(null,_0x532bfd);})[_0x2147('0x16')](function(_0x20c409){_0x1583f7(_0x20c409);});};AGIVertices[_0x2147('0x12')][_0x2147('0x35')]=function(_0xface5,_0x170deb,_0x5201eb){this[_0x2147('0x10')][_0x2147('0x35')]({'uniqueid':this[_0x2147('0x36')][_0x2147('0x37')],'node':_0xface5[_0x2147('0x38')],'application':_0xface5[_0x2147('0x39')],'data':_0x170deb||null,'project_name':this[_0x2147('0x36')][_0x2147('0x3a')],'callerid':this[_0x2147('0x36')][_0x2147('0x3b')]})['then'](function(_0x2c96f4){if(_0x5201eb){_0x5201eb(null,_0x2c96f4);}})['catch'](function(_0x393ffe){if(_0x5201eb){_0x5201eb(_0x393ffe);}});};AGIVertices[_0x2147('0x12')][_0x2147('0x3c')]=function(_0x155028,_0x58fc76,_0x2240bf,_0x1378da){this[_0x2147('0x10')][_0x2147('0x3c')]({'uniqueid':this[_0x2147('0x36')][_0x2147('0x37')],'callerid':this[_0x2147('0x36')][_0x2147('0x3b')],'calleridname':this['channel'][_0x2147('0x3d')],'context':this[_0x2147('0x36')]['context'],'extension':this['channel'][_0x2147('0x3e')],'priority':this[_0x2147('0x36')]['priority'],'accountcode':this['channel'][_0x2147('0x3f')],'dnid':this[_0x2147('0x36')]['dnid'],'projectName':this['channel'][_0x2147('0x3a')],'saveName':_0x58fc76,'filename':_0x155028[_0x2147('0x40')]||_0x58fc76,'savePath':_0x2240bf})[_0x2147('0x15')](function(_0x155b1b){_0x1378da(null,_0x155b1b);})['catch'](function(_0xf9d2bf){_0x1378da(_0xf9d2bf);});};AGIVertices[_0x2147('0x12')][_0x2147('0x41')]=function(_0x2b8e06,_0x476054,_0x260530,_0x10a57d,_0xb379eb){this['rpc'][_0x2147('0x41')]({'uniqueid':this[_0x2147('0x36')]['uniqueid'],'body':_0x2b8e06,'direction':_0x476054,'providerName':_0x260530,'providerResponse':_0x10a57d})[_0x2147('0x15')](function(_0x1a2b89){if(_0xb379eb){_0xb379eb(null,_0x1a2b89);}})[_0x2147('0x16')](function(_0x2a1e7a){if(_0xb379eb){_0xb379eb(_0x2a1e7a);}});};AGIVertices['prototype']['createCmContact']=function(_0x5ca9b0,_0x491aab){this[_0x2147('0x10')]['createCmContact']({'firstName':_[_0x2147('0x42')](_0x5ca9b0[_0x2147('0x17')])||_[_0x2147('0x43')](_0x5ca9b0[_0x2147('0x17')])?_0x2147('0x44')+Math['random']():_0x5ca9b0[_0x2147('0x17')],'lastName':_['isEmpty'](_0x5ca9b0[_0x2147('0x45')])||_[_0x2147('0x43')](_0x5ca9b0[_0x2147('0x45')])?null:_0x5ca9b0[_0x2147('0x45')],'phone':_0x5ca9b0[_0x2147('0x46')],'ListId':_0x5ca9b0[_0x2147('0x47')],'scheduledat':_0x5ca9b0[_0x2147('0x48')],'callbackUniqueid':this[_0x2147('0x36')][_0x2147('0x37')],'tags':'callback','description':_0x2147('0x49')+_0x5ca9b0[_0x2147('0x48')]['toString'](),'priority':_0x5ca9b0[_0x2147('0x4a')]})[_0x2147('0x15')](function(_0x4944a9){_0x491aab(null,_0x4944a9);})[_0x2147('0x16')](function(_0x128c91){_0x491aab(_0x128c91);});};AGIVertices[_0x2147('0x12')][_0x2147('0x4b')]=function(_0x3b49c7,_0x447372){this[_0x2147('0x10')][_0x2147('0x4c')](_0x3b49c7)['then'](function(_0x414cce){_0x447372(null,_0x414cce?_0x414cce[_0x2147('0x17')]:![]);})[_0x2147('0x16')](function(_0x1d3810){_0x447372(_0x1d3810);});};AGIVertices['prototype'][_0x2147('0x4d')]=function(_0x46c5e2,_0x4814aa,_0x56c023){var _0x5b9348={'role':_0x2147('0x4e')};_0x5b9348[_0x46c5e2]=this[_0x2147('0x36')][_0x2147('0x3b')];this[_0x2147('0x10')][_0x2147('0x4d')](_0x5b9348,_0x4814aa,this['channel']['uniqueid'])[_0x2147('0x15')](function(_0x34130f){_0x56c023(null,_['isNil'](_0x34130f)?![]:!![]);})[_0x2147('0x16')](function(_0x3c7322){logger[_0x2147('0x2a')](_0x3c7322);_0x56c023(null,![]);});};AGIVertices[_0x2147('0x12')][_0x2147('0x4f')]=function(_0x452417,_0x32f6a2){var _0x1ae106={'role':'agent'};_0x1ae106[_0x452417]=this[_0x2147('0x36')][_0x2147('0x3b')];this[_0x2147('0x10')][_0x2147('0x4f')](_0x1ae106)[_0x2147('0x15')](function(_0x268dff){_0x32f6a2(null,_[_0x2147('0x43')](_0x268dff)?![]:!![]);})[_0x2147('0x16')](function(_0x2bd74c){logger[_0x2147('0x2a')](_0x2bd74c);_0x32f6a2(null,![]);});};AGIVertices[_0x2147('0x12')][_0x2147('0x50')]=function(_0x1e0ae0,_0x6ba1c3){var _0x49f41b={'role':_0x2147('0x4e')};_0x49f41b[_0x1e0ae0]=this[_0x2147('0x36')][_0x2147('0x3b')];this[_0x2147('0x10')]['agentLogout'](_0x49f41b)[_0x2147('0x15')](function(_0x111c2a){_0x6ba1c3(null,_[_0x2147('0x43')](_0x111c2a)?![]:!![]);})[_0x2147('0x16')](function(_0x2c0fc0){logger[_0x2147('0x2a')](_0x2c0fc0);_0x6ba1c3(null,![]);});};AGIVertices[_0x2147('0x12')][_0x2147('0x51')]=function(_0x52bc78,_0x8ab638){var _0x4966cd={'role':_0x2147('0x4e')};_0x4966cd[_0x52bc78]=this[_0x2147('0x36')]['callerid'];var _0x174d1=_0x52bc78!=_0x2147('0x52')?util[_0x2147('0x53')](_0x2147('0x54'),'LOCAL',this[_0x2147('0x36')][_0x2147('0x3b')]):undefined;this[_0x2147('0x10')][_0x2147('0x51')](_0x4966cd,_0x174d1)['then'](function(_0x254496){_0x8ab638(null,_['isNil'](_0x254496)?![]:!![]);})[_0x2147('0x16')](function(_0xa6686d){logger['error'](_0xa6686d);_0x8ab638(null,![]);});};AGIVertices[_0x2147('0x12')][_0x2147('0x55')]=function(_0x3a47da,_0x214981){sh[_0x2147('0x56')](_[_0x2147('0x57')](_0x3a47da),function(_0x211e82,_0x29ccb6){var _0x1b17b9=_0x29ccb6[_0x2147('0x58')](/(\r\n|\n|\r)/gm,'');_0x214981(null,_0x1b17b9);});};AGIVertices[_0x2147('0x12')][_0x2147('0x59')]=function(_0x26d054,_0x160695){scripts[_0x2147('0x59')](_0x26d054['apiKey'],_0x26d054[_0x2147('0x5a')]||_0x2147('0x5b'),_0x26d054[_0x2147('0x5b')],_0x26d054[_0x2147('0x5c')]||_0x2147('0x5d'),_0x26d054[_0x2147('0x5e')]||_0x2147('0x5f'),_0x26d054[_0x2147('0x60')]||_0x2147('0x61'))['then'](function(_0x137fc1){_0x160695(null,_0x137fc1);})[_0x2147('0x16')](function(_0x45aea3){_0x160695(_0x45aea3);});};AGIVertices[_0x2147('0x12')]['googleTTS']=function(_0x20ad88,_0x356100){scripts[_0x2147('0x62')](_0x20ad88['text'],_0x20ad88[_0x2147('0x63')]||'en',0x1)[_0x2147('0x15')](function(_0x131a9d){_0x356100(null,_0x131a9d);})[_0x2147('0x16')](function(_0x730546){_0x356100(_0x730546);});};AGIVertices[_0x2147('0x12')][_0x2147('0x64')]=function(_0x21b054,_0x18cd8d){var _0x1dfaac={'uri':_0x21b054[_0x2147('0x65')],'method':_0x21b054[_0x2147('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x21b054[_0x2147('0x67')])===_0x2147('0x68')&&parseInt(_0x21b054[_0x2147('0x67')])>=0x1?parseInt(_0x21b054[_0x2147('0x67')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST','PUT'],_0x1dfaac['method'][_0x2147('0x69')]())){try{_0x1dfaac[_0x2147('0x6a')]=_0x21b054[_0x2147('0xd')]?JSON[_0x2147('0x6b')](_0x21b054[_0x2147('0xd')]):{};}catch(_0x9a3c9){logger['error'](_0x2147('0x6c'),_0x9a3c9);}}try{_0x1dfaac[_0x2147('0x6d')]=_0x21b054[_0x2147('0xc')]?JSON[_0x2147('0x6b')](_0x21b054[_0x2147('0xc')]):{};}catch(_0x8bbe34){logger[_0x2147('0x2a')](_0x2147('0x6e'),_0x8bbe34);}if(_0x21b054[_0x2147('0x6f')]){try{var _0x3bda13=require(_0x21b054[_0x2147('0x6f')])['sync'](this,_0x1dfaac);_0x1dfaac[_0x2147('0x70')]=Mustache[_0x2147('0x71')](_0x21b054['url'],_0x3bda13,{},['$$','$$']);if(_0x1dfaac[_0x2147('0x6d')]){_0x1dfaac[_0x2147('0x6d')]=JSON[_0x2147('0x6b')](Mustache[_0x2147('0x71')](JSON[_0x2147('0x72')](_0x1dfaac[_0x2147('0x6d')]),_0x3bda13,{},['$$','$$']));}if(_0x1dfaac[_0x2147('0x6a')]){_0x1dfaac[_0x2147('0x6a')]=JSON[_0x2147('0x6b')](Mustache['render'](JSON[_0x2147('0x72')](_0x1dfaac[_0x2147('0x6a')]),_0x3bda13,{},['$$','$$']));}}catch(_0x23b6a0){logger[_0x2147('0x2a')](_0x2147('0x73'),_0x23b6a0);}}rp(_0x1dfaac)[_0x2147('0x15')](function(_0x5aefbd){var _0x1d3e79={'statusCode':_0x5aefbd[_0x2147('0x74')]||0xc8,'statusMessage':_0x5aefbd[_0x2147('0x75')]||'OK','headers':_0x5aefbd[_0x2147('0x6d')]||{},'body':_0x5aefbd[_0x2147('0x6a')]||{}};_0x18cd8d(null,_0x1d3e79);})[_0x2147('0x16')](function(_0x5322db){var _0x5c8a08={'statusCode':_0x5322db[_0x2147('0x74')]||0x1f4,'statusMessage':_0x5322db[_0x2147('0x76')]||_0x2147('0x77'),'headers':_0x5322db[_0x2147('0x78')][_0x2147('0x6d')]||{},'body':_0x5322db[_0x2147('0x78')][_0x2147('0x6a')]||{}};_0x18cd8d(null,_0x5c8a08);});};AGIVertices['prototype'][_0x2147('0x79')]=function(_0x444f1a,_0x5f51b1){scripts[_0x2147('0x79')](this['channel'][_0x2147('0x37')],_0x444f1a['key'],_0x444f1a['text'],_0x444f1a[_0x2147('0x7a')]||'en')[_0x2147('0x15')](function(_0x1037f4){_0x5f51b1(null,_0x1037f4);})['catch'](function(_0x5f505d){_0x5f51b1(_0x5f505d);});};AGIVertices[_0x2147('0x12')]['googleDialogflowV2']=function(_0x306561,_0xde788f){scripts[_0x2147('0x7b')](this['channel'][_0x2147('0x37')],_0x306561[_0x2147('0x7c')],_0x306561['client_email'],_0x306561[_0x2147('0x7d')],_0x306561[_0x2147('0x5b')],_0x306561['dialogflowV2_language']||'en')[_0x2147('0x15')](function(_0x300366){_0xde788f(null,_0x300366);})[_0x2147('0x16')](function(_0x582d31){_0xde788f(_0x582d31);});};AGIVertices[_0x2147('0x12')][_0x2147('0x7e')]=function(_0xd4462c,_0x194a4f){scripts[_0x2147('0x7e')](this[_0x2147('0x36')],_0xd4462c)[_0x2147('0x15')](function(_0x39b0fe){_0x194a4f(null,_0x39b0fe);})[_0x2147('0x16')](function(_0x99a819){_0x194a4f(_0x99a819);});};AGIVertices[_0x2147('0x12')]['ispeechTTS']=function(_0xbde5b3,_0x10e75f){scripts['ispeechTTS'](_0xbde5b3[_0x2147('0x7f')],_0xbde5b3[_0x2147('0x5b')],_0xbde5b3[_0x2147('0x80')]||'en-US',_0xbde5b3['speed'])['then'](function(_0x328e44){_0x10e75f(null,_0x328e44);})[_0x2147('0x16')](function(_0xe99e98){_0x10e75f(_0xe99e98);});};AGIVertices[_0x2147('0x12')][_0x2147('0x81')]=function(_0x143910,_0x1b1f39,_0x49a7fd){scripts[_0x2147('0x81')](_0x1b1f39,_0x143910['key'],_0x143910[_0x2147('0x82')]||_0x2147('0x5d'),this[_0x2147('0x83')](_0x143910['model'])?_0x143910[_0x2147('0x84')]:undefined)[_0x2147('0x15')](function(_0x176819){_0x49a7fd(null,_0x176819);})[_0x2147('0x16')](function(_0x2f4fef){_0x49a7fd(_0x2f4fef);});};AGIVertices[_0x2147('0x12')][_0x2147('0x85')]=function(_0x3bf361,_0x3dead0){scripts[_0x2147('0x85')](_0x3bf361['aws_access_key_id'],_0x3bf361[_0x2147('0x86')],_0x3bf361[_0x2147('0x87')],_0x3bf361[_0x2147('0x88')]||'Amy',_0x3bf361[_0x2147('0x5b')],_0x3bf361[_0x2147('0x89')]||'text')[_0x2147('0x15')](function(_0x8e1472){_0x3dead0(null,_0x8e1472);})[_0x2147('0x16')](function(_0x4ce01c){_0x3dead0(_0x4ce01c);});};AGIVertices[_0x2147('0x12')][_0x2147('0x8a')]=function(_0x4c6095,_0x43b555){scripts[_0x2147('0x8a')](this['channel'][_0x2147('0x37')],_0x4c6095[_0x2147('0x8b')],_0x4c6095[_0x2147('0x86')],_0x4c6095[_0x2147('0x8c')],_0x4c6095[_0x2147('0x5b')],_0x4c6095['aws_bot_name'])['then'](function(_0x27fad7){_0x43b555(null,_0x27fad7);})[_0x2147('0x16')](function(_0x4a7ab0){_0x43b555(_0x4a7ab0);});};AGIVertices[_0x2147('0x12')][_0x2147('0x8d')]=function(_0x3ca072,_0x4f2d9c,_0x4bfa1b){scripts[_0x2147('0x8d')](_0x4f2d9c,_0x3ca072[_0x2147('0x7f')],_0x3ca072[_0x2147('0x8e')]||_0x2147('0x5d'))[_0x2147('0x15')](function(_0x4efdad){_0x4bfa1b(null,_0x4efdad);})[_0x2147('0x16')](function(_0x5da1c1){_0x4bfa1b(_0x5da1c1);});};AGIVertices['prototype'][_0x2147('0x8f')]=function(_0x35dc95,_0x262abf,_0x3e70a4){scripts[_0x2147('0x8f')](_0x262abf,_0x35dc95['appid'],_0x35dc95['appsecret'],_0x35dc95[_0x2147('0x70')])[_0x2147('0x15')](function(_0x3f948c){_0x3e70a4(null,_0x3f948c);})[_0x2147('0x16')](function(_0x4ba54d){_0x3e70a4(_0x4ba54d);});};AGIVertices[_0x2147('0x12')][_0x2147('0x90')]=function(_0x443705){var _0xf4b69c=_[_0x2147('0x91')](verticesWithRetry,_0x443705[_0x2147('0x39')])?_0x443705:_[_0x2147('0x92')](_0x443705);for(var _0xb2cd19 in _0xf4b69c){if(_0xf4b69c['hasOwnProperty'](_0xb2cd19)){if(_0xf4b69c[_0xb2cd19]&&_['isString'](_0xf4b69c[_0xb2cd19])){if(_[_0x2147('0x91')](recursiveMapAttributes,_0xb2cd19)){_0xf4b69c[_0xb2cd19]=this[_0x2147('0x93')](_0xf4b69c[_0xb2cd19]);}else{_0xf4b69c[_0xb2cd19]=this['replaceAllVariables'](_0xf4b69c[_0xb2cd19]);}}}}return _0xf4b69c;};AGIVertices['prototype'][_0x2147('0x94')]=function(_0x4f8ae5){for(var _0x18d0cf in _0x4f8ae5){if(_0x4f8ae5[_0x2147('0x95')](_0x18d0cf)){if(_[_0x2147('0x96')](_0x4f8ae5[_0x18d0cf])){this[_0x2147('0x94')](_0x4f8ae5[_0x18d0cf]);}else if(_[_0x2147('0x97')](_0x4f8ae5[_0x18d0cf])){for(var _0x257227=0x0;_0x257227<_0x4f8ae5[_0x18d0cf]['length'];_0x257227++){this['recursiveNodeIndex'](_0x4f8ae5[_0x18d0cf][_0x257227]);}}else if(_[_0x2147('0x98')](_0x4f8ae5[_0x18d0cf])){_0x4f8ae5[_0x18d0cf]=this[_0x2147('0x99')](_0x4f8ae5[_0x18d0cf]);}}}};AGIVertices['prototype'][_0x2147('0x9a')]=function(_0x27ae3f,_0x4d9db8){for(var _0x3e6f43 in _0x27ae3f){if(_0x27ae3f[_0x2147('0x95')](_0x3e6f43)){if(_['isPlainObject'](_0x27ae3f[_0x3e6f43])){if(!_['isEmpty'](_0x27ae3f[_0x3e6f43])){this[_0x2147('0x9a')](_0x27ae3f[_0x3e6f43],util[_0x2147('0x53')](_0x2147('0x9b'),_0x4d9db8,_0x3e6f43));}}else if(_[_0x2147('0x97')](_0x27ae3f[_0x3e6f43])){for(var _0x102156=0x0;_0x102156<_0x27ae3f[_0x3e6f43][_0x2147('0x9c')];_0x102156++){this['saveRestApiResult'](_0x27ae3f[_0x3e6f43][_0x102156],util[_0x2147('0x53')](_0x2147('0x9b'),_0x4d9db8,_0x3e6f43+'['+_0x102156+']'));}}else{if(!_[_0x2147('0x43')](_0x27ae3f[_0x3e6f43])){this[_0x2147('0x36')][_0x2147('0x9d')](util[_0x2147('0x53')](_0x2147('0x9b'),_0x4d9db8,_0x3e6f43),_0x27ae3f[_0x3e6f43]);}}}}};AGIVertices['prototype'][_0x2147('0x93')]=function(_0xbb42f9){try{var _0x2e8ae3=JSON['parse'](_0xbb42f9);this[_0x2147('0x94')](_0x2e8ae3);return JSON[_0x2147('0x72')](_0x2e8ae3);}catch(_0x276e81){return this[_0x2147('0x99')](_0xbb42f9);}};AGIVertices[_0x2147('0x12')][_0x2147('0x99')]=function(_0x4db093){var _0xbd2026=_0x4db093[_0x2147('0x9e')]('{');for(var _0x4b9b94=0x1;_0x4b9b94<_0xbd2026[_0x2147('0x9c')];_0x4b9b94+=0x1){var _0x57ef7c=_0xbd2026[_0x4b9b94]['split']('}');if(_0x57ef7c['length']>0x1){_0x4db093=_0x4db093['replaceAll']('{'+_0x57ef7c[0x0]+'}',this[_0x2147('0x36')][_0x2147('0x13')](_0x57ef7c[0x0])[_0x2147('0x9f')]||_0x57ef7c[0x0]);}}if(_0xbd2026[_0x2147('0x9c')]===0x1){return _0x4db093[_0x2147('0xa0')]();}return this[_0x2147('0x99')](_0x4db093);};AGIVertices['prototype']['getAndSetVariable']=function(_0x486682,_0x38107a){var _0x50eb84=this['channel'][_0x2147('0x13')](_0x486682);if(_0x50eb84['result']===-0x1){return _0x50eb84;}logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0xa1'),_0x38107a,_0x50eb84[_0x2147('0x9f')]));return this[_0x2147('0x36')][_0x2147('0x9d')](_0x38107a,_0x50eb84[_0x2147('0x9f')]);};AGIVertices[_0x2147('0x12')][_0x2147('0x83')]=function(_0x2e59ac){return _0x2e59ac&&_0x2e59ac!=='0'&&_0x2e59ac!=='-1'&&_0x2e59ac!=='';};AGIVertices['prototype']['maxRetry']=function(_0x2fbab1){this['createSquareDetailsReport'][_0x2147('0xa2')](this,_0x2fbab1,'-');_0x2fbab1[_0x2147('0xa3')]=_0x2fbab1[_0x2147('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x2147('0xa5')]=function(_0x15081d){logger['info'](util[_0x2147('0x53')](_0x2147('0xa6'),_0x15081d['label']));if(!this[_0x2147('0x83')](_0x15081d[_0x2147('0x5b')])){return this[_0x2147('0x36')][_0x2147('0xa7')]('no\x20text\x20configured');}var _0x48e3e2='\x22'+_0x15081d[_0x2147('0x5b')]+'\x22';if(this['isConfigured'](_0x15081d[_0x2147('0x78')])){_0x48e3e2+=','+_0x15081d[_0x2147('0x78')];}var _0x5cf835=this[_0x2147('0x36')]['exec'](_0x2147('0xa8'),_0x48e3e2);if(_0x5cf835[_0x2147('0xa9')]===-0x1){return _0x5cf835;}return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xaa'),_0x48e3e2));};AGIVertices[_0x2147('0x12')][_0x2147('0xab')]=function(_0x5080cb){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0xac'),_0x5080cb[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x5080cb[_0x2147('0xad')])){return this[_0x2147('0x36')]['noop'](_0x2147('0xae'));}var _0x125cf3=_0x5080cb['grammar'];if(this[_0x2147('0x83')](_0x5080cb[_0x2147('0x78')])){_0x125cf3+=','+_0x5080cb['options'];}var _0x295ef4=this[_0x2147('0x36')][_0x2147('0x56')](_0x2147('0xaf'),_0x125cf3);if(_0x295ef4[_0x2147('0xa9')]===-0x1){return _0x295ef4;}var _0x115c48=this[_0x2147('0xb0')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x115c48[_0x2147('0xa9')]===-0x1){return _0x115c48;}var _0x3a769e=this[_0x2147('0xb0')]('RECOG_INPUT()',_0x2147('0xb1'));if(_0x3a769e[_0x2147('0xa9')]===-0x1){return _0x3a769e;}var _0x174974=this[_0x2147('0xb0')](_0x2147('0xb2'),'MRCP_RECOG_INSTANCE');if(_0x174974[_0x2147('0xa9')]===-0x1){return _0x174974;}return this['channel']['noop'](util[_0x2147('0x53')]('Executed\x20command\x20MRCPRecog\x20%s',_0x125cf3));};AGIVertices[_0x2147('0x12')]['agi']=function(_0x3c57e1){logger[_0x2147('0x2c')](util['format'](_0x2147('0xb3'),_0x3c57e1[_0x2147('0x38')]));return this[_0x2147('0x36')][_0x2147('0x8')]([_0x3c57e1[_0x2147('0xb4')],_0x3c57e1['args']]);};AGIVertices[_0x2147('0x12')][_0x2147('0xb5')]=function(_0x4daa78){logger[_0x2147('0x2c')](util['format'](_0x2147('0xb6'),_0x4daa78[_0x2147('0x38')]));if(this[_0x2147('0x83')](_0x4daa78['timeout'])){logger['info'](util[_0x2147('0x53')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4daa78['timeout']));var _0x1a8667=this[_0x2147('0x36')][_0x2147('0xb7')](_0x4daa78[_0x2147('0x67')]);if(_0x1a8667[_0x2147('0xa9')]===-0x1){return _0x1a8667;}}return this[_0x2147('0x36')][_0x2147('0xb5')]();};AGIVertices[_0x2147('0x12')][_0x2147('0xb8')]=function(_0x3c5c9a){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0xb9'),_0x3c5c9a[_0x2147('0x38')]));if(!this['isConfigured'](_0x3c5c9a[_0x2147('0x47')])){return this['channel']['error'](_0x3c5c9a,_0x2147('0xba'));}_0x3c5c9a[_0x2147('0x48')]=moment();if(this[_0x2147('0x83')](_0x3c5c9a[_0x2147('0xbb')])){_0x3c5c9a[_0x2147('0x48')]=moment()[_0x2147('0xbc')](_0x3c5c9a[_0x2147('0xbb')],_0x2147('0xbd'));}if(!this[_0x2147('0x83')](_0x3c5c9a['callback_priority'])){_0x3c5c9a[_0x2147('0x4a')]=0x2;}this['createCmContact'][_0x2147('0xa2')](this,_0x3c5c9a);return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xbe'),_0x3c5c9a['phone'],_0x3c5c9a[_0x2147('0x47')],_0x3c5c9a['scheduledAt']));};AGIVertices[_0x2147('0x12')]['custom_app']=function(_0x45a14a){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0xbf'),_0x45a14a['label']));var _0x53292e=this[_0x2147('0x36')][_0x2147('0x56')](_0x45a14a['application'],_0x45a14a['options']);if(_0x53292e[_0x2147('0xa9')]===-0x1){return _0x53292e;}return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xc0'),_0x45a14a[_0x2147('0xc1')],_0x45a14a[_0x2147('0x78')]));};AGIVertices[_0x2147('0x12')]['lumenvoxtts']=function(_0x19927d){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0xc2'),_0x19927d['label']));if(!this[_0x2147('0x83')](_0x19927d['text'])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xc3'));}var _0x54004d='\x22'+_0x19927d[_0x2147('0x5b')]+'\x22';if(this[_0x2147('0x83')](_0x19927d[_0x2147('0x78')])){_0x54004d+=','+_0x19927d['options'];}var _0xa07e4d=this[_0x2147('0x36')][_0x2147('0x56')]('MRCPSynth',_0x54004d);if(_0xa07e4d['result']===-0x1){return _0xa07e4d;}return this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0xaa'),_0x54004d));};AGIVertices[_0x2147('0x12')][_0x2147('0xc4')]=function(_0x948dc8){logger['info'](util[_0x2147('0x53')](_0x2147('0xc5'),_0x948dc8[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x948dc8[_0x2147('0x5b')])){return this[_0x2147('0x36')]['noop'](_0x2147('0xc3'));}var _0x2e9347='\x22'+_0x948dc8['text']+'\x22';if(this[_0x2147('0x83')](_0x948dc8[_0x2147('0x78')])){_0x2e9347+=','+_0x948dc8['options'];}var _0x4a08fb=this[_0x2147('0x36')]['exec'](_0x2147('0xa8'),_0x2e9347);if(_0x4a08fb[_0x2147('0xa9')]===-0x1){return _0x4a08fb;}return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xaa'),_0x2e9347));};AGIVertices[_0x2147('0x12')][_0x2147('0xc6')]=function(_0x436a4b){logger['info'](util[_0x2147('0x53')](_0x2147('0xc7'),_0x436a4b[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x436a4b[_0x2147('0xad')])){return this[_0x2147('0x36')]['noop']('no\x20grammar\x20configured');}var _0x82e33=_0x436a4b['grammar'];if(this[_0x2147('0x83')](_0x436a4b[_0x2147('0x78')])){_0x82e33+=','+_0x436a4b[_0x2147('0x78')];}var _0x2857ea=this['channel'][_0x2147('0x56')](_0x2147('0xaf'),_0x82e33);if(_0x2857ea[_0x2147('0xa9')]===-0x1){return _0x2857ea;}var _0x20fe3a=this['getAndSetVariable']('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x20fe3a['result']===-0x1){return _0x20fe3a;}var _0x6f232=this[_0x2147('0xb0')](_0x2147('0xc8'),_0x2147('0xc9'));if(_0x6f232[_0x2147('0xa9')]===-0x1){return _0x6f232;}var _0x137ed9=this[_0x2147('0xb0')](_0x2147('0xb2'),_0x2147('0xca'));if(_0x137ed9['result']===-0x1){return _0x137ed9;}return this[_0x2147('0x36')]['noop'](util['format'](_0x2147('0xcb'),_0x82e33));};AGIVertices[_0x2147('0x12')]['sestekasr']=function(_0x2f6cd7){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0xcc'),_0x2f6cd7['label']));if(!this[_0x2147('0x83')](_0x2f6cd7[_0x2147('0xad')])){return this[_0x2147('0x36')][_0x2147('0xa7')]('no\x20grammar\x20configured');}var _0x430699=_0x2f6cd7['grammar'];if(this['isConfigured'](_0x2f6cd7[_0x2147('0x78')])){_0x430699+=','+_0x2f6cd7[_0x2147('0x78')];}var _0x583e88=this[_0x2147('0x36')][_0x2147('0x56')](_0x2147('0xaf'),_0x430699);if(_0x583e88['result']===-0x1){return _0x583e88;}var _0x36b3f4=this['getAndSetVariable'](_0x2147('0xcd'),_0x2147('0xce'));if(_0x36b3f4[_0x2147('0xa9')]===-0x1){return _0x36b3f4;}var _0xd4dc40=this[_0x2147('0xb0')](_0x2147('0xc8'),_0x2147('0xcf'));if(_0xd4dc40['result']===-0x1){return _0xd4dc40;}var _0x5262bc=this[_0x2147('0xb0')](_0x2147('0xb2'),_0x2147('0xd0'));if(_0x5262bc[_0x2147('0xa9')]===-0x1){return _0x5262bc;}return this[_0x2147('0x36')]['noop'](util[_0x2147('0x53')](_0x2147('0xcb'),_0x430699));};AGIVertices[_0x2147('0x12')]['database']=function(_0x492ace){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0xd1'),_0x492ace[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x492ace[_0x2147('0xd2')])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x492ace,'no\x20database\x20selected');}var _0x558386=this[_0x2147('0xd3')][_0x2147('0xa2')](this,_0x492ace['odbc_id']);if(!_0x558386){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x492ace,_0x2147('0xd4'));}if(!this[_0x2147('0x83')](_0x492ace['query'])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x492ace,_0x2147('0xd5'));}var _0x167efa=_0x492ace[_0x2147('0x2e')][_0x2147('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x2147('0x53')](_0x2147('0xd6'),_0x167efa));var _0x42855c=this[_0x2147('0x29')][_0x2147('0xa2')](this,_0x558386,_0x167efa);this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x492ace,_0x167efa);if(!this[_0x2147('0x83')](_0x492ace[_0x2147('0xd7')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xd8'));}var _0x15d150=this[_0x2147('0x13')][_0x2147('0xa2')](this,_0x492ace['variable_id']);if(!_0x15d150){return this[_0x2147('0x36')]['error'](_0x492ace,'no\x20variable\x20found');}var _0x3eba94=this;_0x42855c[_0x2147('0xd9')](function(_0x2d03d0,_0x4f2cc2){Object['keys'](_0x2d03d0)['forEach'](function(_0x4ba59e){_0x3eba94[_0x2147('0x36')][_0x2147('0x9d')](util[_0x2147('0x53')](_0x2147('0xda'),_0x15d150,_0x4f2cc2,_0x4ba59e),_0x2d03d0[_0x4ba59e]);});});this[_0x2147('0x36')]['setVariable'](util[_0x2147('0x53')](_0x2147('0xdb'),_0x15d150),_0x42855c[_0x2147('0x9c')]);return this[_0x2147('0x36')]['noop'](util['format'](_0x2147('0xdc'),_0x15d150));};AGIVertices[_0x2147('0x12')]['dial']=function(_0x194206){logger[_0x2147('0xdd')](util[_0x2147('0x53')](_0x2147('0xde'),_0x194206['label']));if(!this['isConfigured'](_0x194206[_0x2147('0xdf')])){return this['channel'][_0x2147('0x2a')](_0x194206,_0x2147('0xe0'));}var _0x44338a=this[_0x2147('0xe1')]['sync'](this,_0x194206[_0x2147('0xdf')]);if(!_0x44338a){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x194206,'no\x20user\x20found');}var _0x829c95=this[_0x2147('0x36')]['exec']('DIAL',[util[_0x2147('0x53')]('SIP/%s',_0x44338a),_0x194206[_0x2147('0x67')],_0x194206[_0x2147('0xe2')],_0x194206[_0x2147('0x65')]]);if(_0x829c95['result']===-0x1){return _0x829c95;}return this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0xe3'),_0x2147('0xe4')));};AGIVertices[_0x2147('0x12')]['dialogflow']=function(_0x23c31f){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0xe5'),_0x23c31f[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x23c31f[_0x2147('0x7f')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xe6'));}if(!this[_0x2147('0x83')](_0x23c31f[_0x2147('0x5b')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xc3'));}this[_0x2147('0x36')][_0x2147('0xe7')]=!![];this[_0x2147('0x35')](_0x23c31f);this[_0x2147('0x41')](_0x23c31f[_0x2147('0x5b')],'in','','');this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0xe8'),_0x23c31f['text']));var _0x50060=this['googleDialogflow']['sync'](this,_0x23c31f);if(_0x50060){for(var _0x3ea2f4 in _0x50060){if(_0x50060[_0x2147('0x95')](_0x3ea2f4)){this[_0x2147('0x36')]['setVariable'](util[_0x2147('0x53')](_0x2147('0xe9'),_0x3ea2f4[_0x2147('0x69')]()),_0x50060[_0x3ea2f4]);}}this[_0x2147('0x41')](_0x50060['speech'],_0x2147('0xea'),_0x2147('0xeb'),'');return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')]('Dialogflow\x20Result\x20%s',_0x50060[_0x2147('0xec')]));}return this[_0x2147('0x36')][_0x2147('0x2a')](_0x23c31f,_0x2147('0xed'));};AGIVertices['prototype'][_0x2147('0xee')]=function(_0xd5d88d){logger['info'](util[_0x2147('0x53')](_0x2147('0xef'),_0xd5d88d[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0xd5d88d[_0x2147('0x7c')])){return this['channel'][_0x2147('0xa7')](_0x2147('0xf0'));}if(!this['isConfigured'](_0xd5d88d['client_email'])){return this[_0x2147('0x36')][_0x2147('0xa7')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0xd5d88d['private_key'])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xf1'));}if(!this[_0x2147('0x83')](_0xd5d88d[_0x2147('0xf2')])){return this['channel'][_0x2147('0xa7')]('no\x20anguage\x20configured');}if(!this[_0x2147('0x83')](_0xd5d88d[_0x2147('0x5b')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xc3'));}this['channel'][_0x2147('0xe7')]=!![];this[_0x2147('0x35')](_0xd5d88d);this[_0x2147('0x41')](_0xd5d88d[_0x2147('0x5b')],'in','','');this['channel'][_0x2147('0xa7')](util['format'](_0x2147('0xf3'),_0xd5d88d['text']));var _0x4a6ea1=this[_0x2147('0x7b')][_0x2147('0xa2')](this,_0xd5d88d);if(_0x4a6ea1){for(var _0x1f4892 in _0x4a6ea1){if(_0x4a6ea1[_0x2147('0x95')](_0x1f4892)){if(_0x1f4892!=='providerResponse'){this[_0x2147('0x36')][_0x2147('0x9d')](util['format'](_0x2147('0xe9'),_0x1f4892[_0x2147('0x69')]()),_0x4a6ea1[_0x1f4892]);}}}this['createSquareMessage'](_0x4a6ea1[_0x2147('0xec')],'out',_0x2147('0xee'),_0x4a6ea1[_0x2147('0xf4')]);return this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xf5'),_0x4a6ea1[_0x2147('0xec')]));}return this[_0x2147('0x36')]['error'](_0xd5d88d,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x2147('0x12')]['sesteknda']=function(_0x4ed26e){logger['info'](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4ed26e[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x4ed26e['ndauth_url'])){return this[_0x2147('0x36')]['noop'](_0x2147('0xf6'));}if(!this[_0x2147('0x83')](_0x4ed26e[_0x2147('0xf7')])){return this['channel'][_0x2147('0xa7')](_0x2147('0xf8'));}if(!this[_0x2147('0x83')](_0x4ed26e['password'])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xf9'));}if(!this[_0x2147('0x83')](_0x4ed26e[_0x2147('0xfa')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xc3'));}this['channel'][_0x2147('0xe7')]=!![];this[_0x2147('0x35')](_0x4ed26e);this[_0x2147('0x41')](_0x4ed26e[_0x2147('0x5b')],'in','','');this[_0x2147('0x36')]['noop'](util[_0x2147('0x53')](_0x2147('0xfb'),_0x4ed26e[_0x2147('0x5b')]));var _0x3cfd12=this[_0x2147('0x7e')]['sync'](this,_0x4ed26e);if(_0x3cfd12){for(var _0x12e14d in _0x3cfd12){if(_0x3cfd12['hasOwnProperty'](_0x12e14d)){this[_0x2147('0x36')][_0x2147('0x9d')](util['format'](_0x2147('0xfc'),_0x12e14d[_0x2147('0x69')]()),_0x3cfd12[_0x12e14d]);}}this['createSquareMessage'](_0x3cfd12[_0x2147('0xec')],'out',_0x2147('0xfd'),'');if(_0x3cfd12[_0x2147('0xfe')]){this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xff'),_0x3cfd12[_0x2147('0xfe')]));var _0x28f8e8=this[_0x2147('0x36')][_0x2147('0x100')](_0x3cfd12[_0x2147('0xfe')]);try{fs['unlink'](_0x3cfd12[_0x2147('0xfe')]+_0x2147('0x101'));}catch(_0x526bbd){logger[_0x2147('0x2a')](_0x526bbd);}return _0x28f8e8;}else{return this[_0x2147('0x36')]['noop'](util[_0x2147('0x53')](_0x2147('0x102'),_0x3cfd12[_0x2147('0xec')]));}}return this[_0x2147('0x36')][_0x2147('0x2a')](_0x4ed26e,_0x2147('0x103'));};AGIVertices[_0x2147('0x12')][_0x2147('0x104')]=function(_0x539b71){logger['info'](util[_0x2147('0x53')]('Enter\x20in\x20END\x20(%s)\x20block',_0x539b71[_0x2147('0x38')]));return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0x104'));};AGIVertices[_0x2147('0x12')][_0x2147('0x105')]=function(_0x1eb639){logger['info'](util[_0x2147('0x53')](_0x2147('0x106'),_0x1eb639['label']));var _0x2b0087='';if(_0x1eb639[_0x2147('0x107')]){if(!this[_0x2147('0x83')](_0x1eb639[_0x2147('0x107')])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x1eb639,_0x2147('0x108'));}else{var _0x33ba46=parseInt(_0x1eb639[_0x2147('0x107')],0xa);if(isNaN(_0x33ba46)){_0x2b0087=_0x1eb639[_0x2147('0x107')];}else{_0x2b0087=this[_0x2147('0x109')][_0x2147('0xa2')](this,_0x1eb639['trunk_id']);if(!_0x2b0087){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x1eb639,_0x2147('0x10a'));}}}}else if(_0x1eb639[_0x2147('0x10b')]){_0x2b0087=_0x1eb639['trunk_name'];}else{return this['channel'][_0x2147('0x2a')](_0x1eb639,_0x2147('0x108'));}var _0x580a9f=this[_0x2147('0x36')]['exec'](_0x2147('0xe4'),[util['format'](_0x2147('0x10c'),_0x2b0087,_0x1eb639[_0x2147('0x46')]),_0x1eb639[_0x2147('0x67')],_0x1eb639[_0x2147('0xe2')],_0x1eb639['url']]);if(_0x580a9f[_0x2147('0xa9')]===-0x1){return _0x580a9f;}return this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xe3'),_0x2147('0xe4')));};AGIVertices['prototype'][_0x2147('0x10d')]=function(_0x1ed68c){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x10e'),_0x1ed68c[_0x2147('0x38')]));return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0x10d'));};AGIVertices[_0x2147('0x12')][_0x2147('0xf')]=function(_0x406515){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x10f'),_0x406515[_0x2147('0x38')]));if(_0x406515['retry']===0x0){return this['maxRetry'](_0x406515);}_0x406515[_0x2147('0xa3')]-=0x1;if(!this[_0x2147('0x83')](_0x406515['file_id'])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x406515,_0x2147('0x110'));}var _0x52c115=this['getSound'][_0x2147('0xa2')](this,_0x406515[_0x2147('0x111')]);if(!_0x52c115){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x406515,_0x2147('0x112'));}if(!this['isConfigured'](_0x406515[_0x2147('0xd7')])){return this['channel'][_0x2147('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x519cc0=this[_0x2147('0x36')][_0x2147('0x113')](_0x52c115,_0x406515[_0x2147('0x114')],_0x406515[_0x2147('0x115')]);var _0xea73fd=_0x519cc0['result']?_0x519cc0[_0x2147('0xa9')]['toString']():'';logger[_0x2147('0x2c')]('test',JSON[_0x2147('0x72')](_0x519cc0));if(_0x519cc0[_0x2147('0xa9')]===-0x1){this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x406515,_0xea73fd);return _0x519cc0;}else if(_0x519cc0[_0x2147('0x9f')]===_0x2147('0x67')){_0x519cc0[_0x2147('0xa9')]=_0xea73fd['length']>=parseInt(_0x406515[_0x2147('0x116')])?'x':'i';}else{_0x519cc0[_0x2147('0xa9')]=_0xea73fd[_0x2147('0x9c')]>=parseInt(_0x406515[_0x2147('0x116')])&&_0xea73fd[_0x2147('0x9c')]<=parseInt(_0x406515[_0x2147('0x115')])?'x':'i';}var _0x300557=this[_0x2147('0x13')]['sync'](this,_0x406515[_0x2147('0xd7')]);if(!_0x300557){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x406515,_0x2147('0x117'));}this[_0x2147('0x36')][_0x2147('0x9d')](_0x300557,_0xea73fd);if(this['isConfigured'](_0x406515[_0x2147('0x118')])){var _0x3382e3=parseInt(_0x406515[_0x2147('0x118')],0xa);var _0x5bb1de=rs[_0x2147('0x119')]({'charset':'*','length':_0x3382e3});var _0x3f4d01=_0xea73fd['length'];if(_0x3f4d01>0x0){if(_0x3f4d01>_0x3382e3){this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x406515,_0x406515[_0x2147('0x11a')]===_0x2147('0x11b')?_0x5bb1de+_0xea73fd[_0x2147('0x11c')](_0x3382e3):_0xea73fd[_0x2147('0x11c')](0x0,_0x3f4d01-_0x3382e3)+_0x5bb1de);}else{this['createSquareDetailsReport'][_0x2147('0xa2')](this,_0x406515,rs['generate']({'charset':'*','length':_0x3f4d01}));}}else{this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x406515,'');}}else{this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x406515,_0xea73fd);}return _0x519cc0;};AGIVertices['prototype'][_0x2147('0x11d')]=function(_0x284372){logger[_0x2147('0x2c')](util['format'](_0x2147('0x11e'),_0x284372[_0x2147('0x38')]));return this['getdigits'](_0x284372);};AGIVertices[_0x2147('0x12')][_0x2147('0x11f')]=function(_0x45d52c){logger[_0x2147('0x2c')](util[_0x2147('0x53')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x45d52c[_0x2147('0x38')]));this['createSquareDetailsReport'][_0x2147('0xa2')](this,_0x45d52c,_0x45d52c[_0x2147('0x120')]);return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x121'),_0x45d52c[_0x2147('0x120')]));};AGIVertices[_0x2147('0x12')]['awspolly']=function(_0x504e86){logger[_0x2147('0x2c')](util[_0x2147('0x53')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x504e86[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x504e86[_0x2147('0x8b')])||!this[_0x2147('0x83')](_0x504e86[_0x2147('0x86')])){return this['channel']['noop'](_0x2147('0x122'));}if(!this[_0x2147('0x83')](_0x504e86['text'])){return this['channel'][_0x2147('0xa7')](_0x2147('0xc3'));}this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')]('Trying\x20aws\x20Polly\x20%s',_0x504e86[_0x2147('0x5b')]));var _0x4d22a5=this['awsPolly']['sync'](this,_0x504e86);if(_0x4d22a5){this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x123'),_0x4d22a5));var _0x270426=this[_0x2147('0x36')][_0x2147('0x100')](_0x4d22a5);try{fs[_0x2147('0x124')](_0x4d22a5+_0x2147('0x101'));}catch(_0x11cd09){logger[_0x2147('0x2a')](_0x11cd09);}return _0x270426;}return this[_0x2147('0x36')][_0x2147('0x2a')](_0x504e86,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x2147('0x125')]=function(_0xc6ef13){logger[_0x2147('0x2c')](util['format'](_0x2147('0x126'),_0xc6ef13['label']));if(!this[_0x2147('0x83')](_0xc6ef13[_0x2147('0x8b')])||!this[_0x2147('0x83')](_0xc6ef13[_0x2147('0x86')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0x122'));}if(!this[_0x2147('0x83')](_0xc6ef13[_0x2147('0x127')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0x128'));}if(!this[_0x2147('0x83')](_0xc6ef13[_0x2147('0x5b')])){return this['channel'][_0x2147('0xa7')](_0x2147('0xc3'));}this['channel'][_0x2147('0xe7')]=!![];this[_0x2147('0x35')](_0xc6ef13);this[_0x2147('0x41')](_0xc6ef13[_0x2147('0x5b')],'in','','');this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x129'),_0xc6ef13[_0x2147('0x5b')]));var _0x199b49=this[_0x2147('0x8a')][_0x2147('0xa2')](this,_0xc6ef13);if(_0x199b49){for(var _0x3343e9 in _0x199b49){if(_0x199b49[_0x2147('0x95')](_0x3343e9)&&_['isString'](_0x199b49[_0x3343e9])){this[_0x2147('0x36')][_0x2147('0x9d')](util[_0x2147('0x53')](_0x2147('0x12a'),_0x3343e9[_0x2147('0x69')]()),_0x199b49[_0x3343e9]);}}if(_[_0x2147('0x43')](_0x199b49[_0x2147('0x76')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0x12b'));}else{this['createSquareMessage'](_0x199b49[_0x2147('0x76')],_0x2147('0xea'),'amazonlex','');return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x12c'),_0x199b49['message']));}}return this[_0x2147('0x36')][_0x2147('0x2a')](_0xc6ef13,_0x2147('0x12d'));};AGIVertices[_0x2147('0x12')][_0x2147('0x12e')]=function(_0x3c8326){logger[_0x2147('0x2c')](util['format'](_0x2147('0x12f'),_0x3c8326['label'],_0x3c8326[_0x2147('0x67')]));if(!this[_0x2147('0x83')](_0x3c8326[_0x2147('0x7f')])){return this[_0x2147('0x36')]['noop'](_0x2147('0xe6'));}var _0x4c04ed=_0x2147('0x130');var _0xc525e7=util[_0x2147('0x53')]('%s/recordings/%s',FILES_PATH,rs[_0x2147('0x119')](0x4));var _0x2f77c5=util[_0x2147('0x53')]('%s.%s',_0xc525e7,_0x4c04ed);var _0x50acc6=!![];if(_0x3c8326[_0x2147('0x131')]===_0x2147('0x132')){_0x50acc6=![];}var _0x14cad4=this['channel'][_0x2147('0x133')](_0xc525e7,_0x4c04ed,_0x3c8326[_0x2147('0x134')],_0x3c8326[_0x2147('0x67')],undefined,_0x50acc6);if(_0x14cad4['result']!==-0x1){this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0x135'),_0x2f77c5));var _0x5d40d1=this['googleASR'][_0x2147('0xa2')](this,_0x3c8326,_0x2f77c5);if(_0x5d40d1){for(var _0x5671cc in _0x5d40d1){if(_0x5d40d1[_0x2147('0x95')](_0x5671cc)){this[_0x2147('0x36')][_0x2147('0x9d')](util[_0x2147('0x53')]('GOOGLE_ASR_%s',_0x5671cc[_0x2147('0x69')]()),_0x5d40d1[_0x5671cc]);}}return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')]('GoogleASR\x20Result\x20%s',JSON[_0x2147('0x72')](_0x5d40d1)));}}return _0x14cad4;};AGIVertices[_0x2147('0x12')][_0x2147('0x136')]=function(_0x316302){logger[_0x2147('0x2c')](util[_0x2147('0x53')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x316302[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x316302['appid'])){return this['channel']['noop'](_0x2147('0x137'));}if(!this[_0x2147('0x83')](_0x316302[_0x2147('0x138')])){return this[_0x2147('0x36')][_0x2147('0xa7')]('no\x20appsecret\x20configured');}var _0x574c88=_0x2147('0x130');var _0x41bb78=util[_0x2147('0x53')](_0x2147('0x139'),FILES_PATH,rs[_0x2147('0x119')](0x4));var _0x49fa75=util[_0x2147('0x53')](_0x2147('0x9b'),_0x41bb78,_0x574c88);var _0x3ddcae=!![];if(_0x316302[_0x2147('0x131')]==='NOBEEP'){_0x3ddcae=![];}var _0x541703=this['channel'][_0x2147('0x133')](_0x41bb78,_0x574c88,_0x316302[_0x2147('0x134')],_0x316302[_0x2147('0x67')],undefined,_0x3ddcae);if(_0x541703[_0x2147('0xa9')]!==-0x1){this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')]('tilde\x20%s\x20file\x20created',_0x49fa75));var _0x3f3049=this[_0x2147('0x8f')][_0x2147('0xa2')](this,_0x316302,_0x49fa75);if(_0x3f3049){for(var _0x256b12 in _0x3f3049){if(_0x3f3049[_0x2147('0x95')](_0x256b12)){this[_0x2147('0x36')]['setVariable'](util['format'](_0x2147('0x13a'),_0x256b12[_0x2147('0x69')]()),_0x3f3049[_0x256b12]);}}return this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x13b'),JSON[_0x2147('0x72')](_0x3f3049)));}}return _0x541703;};AGIVertices[_0x2147('0x12')][_0x2147('0x13c')]=function(_0x123355){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x13d'),_0x123355[_0x2147('0x38')]));return this[_0x2147('0x36')]['continueAt'](_0x123355[_0x2147('0x13e')],_0x123355[_0x2147('0x3e')],_0x123355['priority']);};AGIVertices[_0x2147('0x12')][_0x2147('0x13f')]=function(_0x307dbf){logger['info'](util[_0x2147('0x53')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x307dbf[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x307dbf['condition'])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x307dbf,_0x2147('0x140'));}try{var _0x2a5164=eval(_0x307dbf[_0x2147('0x141')])?_0x2147('0x142'):'false';this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x143'),_0x307dbf[_0x2147('0x141')],_0x2a5164));return{'code':0xc8,'result':_0x2a5164};}catch(_0x3235ba){return{'code':0xc8,'result':_0x2147('0x144')};}};AGIVertices[_0x2147('0x12')][_0x2147('0x145')]=function(_0x1e6fd1){logger['info'](util[_0x2147('0x53')](_0x2147('0x146'),_0x1e6fd1[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x1e6fd1['interval_id'])){return this['channel'][_0x2147('0x2a')](_0x1e6fd1,'no\x20interval\x20configured');}var _0x274af2=this[_0x2147('0x22')][_0x2147('0xa2')](this,_0x1e6fd1[_0x2147('0x147')]);if(!_0x274af2){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x1e6fd1,'no\x20intervals\x20found');}for(var _0x582705=0x0;_0x582705<_0x274af2[_0x2147('0x9c')];_0x582705+=0x1){var _0x277dc1=this[_0x2147('0x36')][_0x2147('0x13')](util[_0x2147('0x53')](_0x2147('0x148'),_0x274af2[_0x582705]));if(_0x277dc1[_0x2147('0xa9')]===-0x1){return _0x277dc1;}logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x149'),_0x274af2[_0x582705],_0x277dc1['extra']));if(_0x277dc1[_0x2147('0x9f')]===_0x2147('0x142')){logger['info'](util['format'](_0x2147('0x149'),_0x274af2[_0x582705],_0x2147('0x142')));this[_0x2147('0x36')][_0x2147('0xa7')](util['format']('IFTIME\x20%s\x20%s',_0x274af2[_0x582705],_0x2147('0x142')));return{'code':0xc8,'result':_0x2147('0x142')};}else{logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x149'),_0x274af2[_0x582705],_0x2147('0x144')));this[_0x2147('0x36')]['noop'](util[_0x2147('0x53')](_0x2147('0x149'),_0x274af2[_0x582705],_0x2147('0x144')));}}return{'code':0xc8,'result':_0x2147('0x144')};};AGIVertices[_0x2147('0x12')]['hangup']=function(_0x38978c){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x14a'),_0x38978c[_0x2147('0x38')]));return this[_0x2147('0x36')][_0x2147('0x14b')]();};AGIVertices['prototype'][_0x2147('0x14c')]=function(_0x3ead17){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x14d'),_0x3ead17[_0x2147('0x38')]));if(!this['isConfigured'](_0x3ead17['key'])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xe6'));}var _0x583655=_0x2147('0x130');var _0x474223=util[_0x2147('0x53')](_0x2147('0x139'),FILES_PATH,rs[_0x2147('0x119')](0x4));var _0x5a0335=util[_0x2147('0x53')](_0x2147('0x9b'),_0x474223,_0x583655);var _0x5ce328=!![];if(_0x3ead17[_0x2147('0x131')]===_0x2147('0x132')){_0x5ce328=![];}var _0x39ee29=this[_0x2147('0x36')]['recordFile'](_0x474223,_0x583655,_0x3ead17[_0x2147('0x134')],_0x3ead17[_0x2147('0x67')],undefined,_0x5ce328);if(_0x39ee29[_0x2147('0xa9')]!==-0x1){this[_0x2147('0x36')][_0x2147('0xa7')](util['format']('ispeech\x20%s\x20file\x20created',_0x5a0335));var _0x2652df=this[_0x2147('0x81')][_0x2147('0xa2')](this,_0x3ead17,_0x5a0335);if(_0x2652df){for(var _0x29d391 in _0x2652df){if(_0x2652df[_0x2147('0x95')](_0x29d391)){this[_0x2147('0x36')][_0x2147('0x9d')](util[_0x2147('0x53')](_0x2147('0x14e'),_0x29d391['toUpperCase']()),_0x2652df[_0x29d391]);}}return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x14f'),JSON[_0x2147('0x72')](_0x2652df)));}}return _0x39ee29;};AGIVertices[_0x2147('0x12')][_0x2147('0x150')]=function(_0x4917d7){logger[_0x2147('0x2c')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4917d7[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x4917d7[_0x2147('0x7f')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xe6'));}if(!this[_0x2147('0x83')](_0x4917d7[_0x2147('0x5b')])){return this[_0x2147('0x36')]['noop'](_0x2147('0xc3'));}this['channel']['noop'](util[_0x2147('0x53')](_0x2147('0x151'),_0x4917d7[_0x2147('0x5b')]));var _0x5b11a3=this[_0x2147('0x152')][_0x2147('0xa2')](this,_0x4917d7);if(_0x5b11a3){this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0x153'),_0x5b11a3));var _0x6e8ae6=this[_0x2147('0x36')][_0x2147('0x100')](_0x5b11a3,_0x4917d7[_0x2147('0x134')]);try{fs[_0x2147('0x124')](_0x5b11a3+_0x2147('0x101'));}catch(_0x29edee){logger[_0x2147('0x2a')](_0x29edee);}return _0x6e8ae6;}return this[_0x2147('0x36')][_0x2147('0x2a')](_0x4917d7,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2147('0x12')][_0x2147('0x154')]=function(_0x4a33e0){logger[_0x2147('0x2c')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4a33e0[_0x2147('0x38')]));if(!this['isConfigured'](_0x4a33e0[_0x2147('0x155')])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x4a33e0,_0x2147('0x156'));}logger[_0x2147('0x2c')](util[_0x2147('0x53')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2147('0x36')]['callerid'],_0x4a33e0['findBy']));var _0x22f9c9=this[_0x2147('0x51')][_0x2147('0xa2')](this,_0x4a33e0['findBy']);if(_0x22f9c9){logger['info'](util['format'](_0x2147('0x157'),this[_0x2147('0x36')][_0x2147('0x3b')],_0x4a33e0[_0x2147('0x155')]));this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x157'),this[_0x2147('0x36')][_0x2147('0x3b')],_0x4a33e0['findBy']));return{'code':0xc8,'result':_0x2147('0x158')};}else{logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x159'),this['channel'][_0x2147('0x3b')],_0x4a33e0['findBy']));this['channel'][_0x2147('0xa7')](util['format'](_0x2147('0x159'),this['channel'][_0x2147('0x3b')],_0x4a33e0[_0x2147('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2147('0x12')]['logout']=function(_0x12b8a3){logger['info'](util[_0x2147('0x53')](_0x2147('0x15a'),_0x12b8a3[_0x2147('0x38')]));if(!this['isConfigured'](_0x12b8a3[_0x2147('0x155')])){return this[_0x2147('0x36')]['error'](_0x12b8a3,'no\x20find\x20by\x20configured');}logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x15b'),this[_0x2147('0x36')]['callerid'],_0x12b8a3[_0x2147('0x155')]));var _0x26787e=this['agentLogout'][_0x2147('0xa2')](this,_0x12b8a3[_0x2147('0x155')]);if(_0x26787e){logger['info'](util['format'](_0x2147('0x157'),this['channel'][_0x2147('0x3b')],_0x12b8a3['findBy']));this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x157'),this[_0x2147('0x36')][_0x2147('0x3b')],_0x12b8a3[_0x2147('0x155')]));return{'code':0xc8,'result':_0x2147('0x158')};}else{logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x159'),this['channel'][_0x2147('0x3b')],_0x12b8a3[_0x2147('0x155')]));this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0x159'),this['channel'][_0x2147('0x3b')],_0x12b8a3['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2147('0x12')][_0x2147('0x15c')]=function(_0x43e183){logger[_0x2147('0x2c')](util['format'](_0x2147('0x15d'),_0x43e183['label']));if(!this[_0x2147('0x83')](_0x43e183['operation'])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x43e183,_0x2147('0x15e'));}this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x15f'),_0x43e183['operation']));var _0x322100=eval(_0x43e183[_0x2147('0x160')]);if(!this[_0x2147('0x83')](_0x43e183[_0x2147('0xd7')])){return this[_0x2147('0x36')][_0x2147('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1a969c=this['getVariable'][_0x2147('0xa2')](this,_0x43e183[_0x2147('0xd7')]);if(!_0x1a969c){return this[_0x2147('0x36')]['error'](_0x43e183,_0x2147('0x117'));}if(_[_0x2147('0x97')](_0x322100)){var _0x372a66=this;_0x322100['forEach'](function(_0x47c010,_0x4f2f20){_0x372a66['channel'][_0x2147('0x9d')](util[_0x2147('0x53')](_0x2147('0x161'),_0x1a969c,_0x4f2f20),_0x47c010);});return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')]('variable\x20%s[key]\x20set',_0x1a969c));}else{return this[_0x2147('0x36')][_0x2147('0x9d')](_0x1a969c,_0x322100);}};AGIVertices['prototype'][_0x2147('0xe')]=function(_0x36a03c){logger[_0x2147('0x2c')](util['format'](_0x2147('0x162'),_0x36a03c[_0x2147('0x38')]));if(_0x36a03c[_0x2147('0xa3')]===0x0){return this[_0x2147('0xa4')](_0x36a03c);}_0x36a03c['retry']-=0x1;if(!this[_0x2147('0x83')](_0x36a03c['file_id'])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x36a03c,_0x2147('0x110'));}var _0x51616e=this[_0x2147('0x1b')]['sync'](this,_0x36a03c[_0x2147('0x111')]);if(!_0x51616e){return this[_0x2147('0x36')]['error'](_0x36a03c,'no\x20file\x20audio\x20found');}var _0x1ea7c5=this[_0x2147('0x36')][_0x2147('0x113')](_0x51616e,_0x36a03c[_0x2147('0x114')],_0x36a03c[_0x2147('0x163')]);var _0x13a0ee=_0x1ea7c5[_0x2147('0xa9')];if(_0x1ea7c5[_0x2147('0xa9')]===-0x1){this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x36a03c,'-1');return _0x1ea7c5;}else if(_0x1ea7c5[_0x2147('0x9f')]===_0x2147('0x67')){_0x1ea7c5['result']=_0x1ea7c5[_0x2147('0xa9')][_0x2147('0x9c')]>0x0?_0x1ea7c5[_0x2147('0xa9')]:'t';}else if(_[_0x2147('0x42')](_0x1ea7c5[_0x2147('0xa9')])){_0x1ea7c5[_0x2147('0xa9')]='#';_0x13a0ee='#';}if(!this['isConfigured'](_0x36a03c[_0x2147('0xd7')])){this['channel'][_0x2147('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x4b50ae=this['getVariable'][_0x2147('0xa2')](this,_0x36a03c[_0x2147('0xd7')]);if(!_0x4b50ae){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x36a03c,'no\x20variable\x20found');}this[_0x2147('0x36')]['setVariable'](_0x4b50ae,_0x13a0ee);}this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x36a03c,_0x13a0ee);return _0x1ea7c5;};AGIVertices[_0x2147('0x12')][_0x2147('0xa7')]=function(_0x21260e){logger[_0x2147('0x2c')](util[_0x2147('0x53')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x21260e['label']));return this[_0x2147('0x36')][_0x2147('0xa7')](_0x21260e['output']||_0x21260e['label']);};AGIVertices[_0x2147('0x12')][_0x2147('0x164')]=function(_0x43e26f){logger[_0x2147('0x2c')](util[_0x2147('0x53')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x43e26f['label']));if(!this[_0x2147('0x83')](_0x43e26f[_0x2147('0x155')])){return this['channel'][_0x2147('0x2a')](_0x43e26f,_0x2147('0x156'));}logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x15b'),this[_0x2147('0x36')][_0x2147('0x3b')],_0x43e26f[_0x2147('0x155')]));var _0x50deb7=this[_0x2147('0x4b')][_0x2147('0xa2')](this,_0x43e26f[_0x2147('0x165')]);var _0x10aa30=this[_0x2147('0x4d')][_0x2147('0xa2')](this,_0x43e26f[_0x2147('0x155')],_0x50deb7);if(_0x10aa30){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x157'),this['channel'][_0x2147('0x3b')],_0x43e26f[_0x2147('0x155')]));this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0x157'),this[_0x2147('0x36')][_0x2147('0x3b')],_0x43e26f[_0x2147('0x155')]));return{'code':0xc8,'result':_0x2147('0x158')};}else{logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x159'),this['channel'][_0x2147('0x3b')],_0x43e26f[_0x2147('0x155')]));this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x157'),this[_0x2147('0x36')][_0x2147('0x3b')],_0x43e26f['findBy']));return{'code':0xc8,'result':_0x2147('0x166')};}};AGIVertices['prototype']['playback']=function(_0x4bda6a){logger[_0x2147('0x2c')](util[_0x2147('0x53')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x4bda6a[_0x2147('0x38')]));if(!this['isConfigured'](_0x4bda6a[_0x2147('0x111')])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x4bda6a,_0x2147('0x110'));}var _0x2371e8=this[_0x2147('0x1b')][_0x2147('0xa2')](this,_0x4bda6a[_0x2147('0x111')]);if(!_0x2371e8){return this[_0x2147('0x36')]['error'](_0x4bda6a,_0x2147('0x112'));}var _0x30a997=this['channel']['exec']('PLAYBACK',[_0x2371e8,_0x4bda6a[_0x2147('0xe2')]]);if(_0x30a997['result']===-0x1){return _0x30a997;}return this[_0x2147('0x36')]['noop'](util[_0x2147('0x53')](_0x2147('0xc0'),_0x2147('0x167'),_0x2371e8));};AGIVertices['prototype'][_0x2147('0x168')]=function(_0x44f81d){logger[_0x2147('0x2c')](util['format'](_0x2147('0x169'),_0x44f81d[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x44f81d[_0x2147('0x16a')])){return this[_0x2147('0x36')]['error'](_0x44f81d,_0x2147('0x16b'));}var _0x18ae1f='';var _0x32a373=parseInt(_0x44f81d[_0x2147('0x16a')],0xa);if(isNaN(_0x32a373)){_0x18ae1f=_0x44f81d[_0x2147('0x16a')];}else{_0x18ae1f=this[_0x2147('0x16c')][_0x2147('0xa2')](this,_0x44f81d[_0x2147('0x16a')]);if(!_0x18ae1f){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x44f81d,_0x2147('0x16d'));}}var _0x252e79='';if(this[_0x2147('0x83')](_0x44f81d[_0x2147('0x111')])){var _0x192f3a=this[_0x2147('0x1b')][_0x2147('0xa2')](this,_0x44f81d[_0x2147('0x111')]);if(_0x192f3a){_0x252e79=_0x192f3a;}}this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x44f81d,_0x18ae1f);if(_0x44f81d[_0x2147('0xe2')][_0x2147('0x16e')]('x')<0x0){_0x44f81d['opts']+='x';}if(_0x44f81d['opts'][_0x2147('0x16e')]('X')<0x0){_0x44f81d[_0x2147('0xe2')]+='X';}this['channel'][_0x2147('0x9d')]('XMCS-QUEUE',_0x18ae1f?_0x18ae1f[_0x2147('0x16f')]():'');var _0x410878=this[_0x2147('0x36')][_0x2147('0x56')](_0x2147('0x170'),[_0x18ae1f,_0x44f81d[_0x2147('0xe2')],_0x44f81d[_0x2147('0x65')],_0x252e79,_0x44f81d[_0x2147('0x67')],_0x44f81d['agi'],_0x44f81d[_0x2147('0x171')],_0x44f81d[_0x2147('0x172')],'',_0x44f81d['position']]);if(_0x410878[_0x2147('0xa9')]===-0x1){return _0x410878;}return this[_0x2147('0x36')][_0x2147('0xa7')](util['format']('Executed\x20command\x20%s\x20%s','QUEUE',_0x18ae1f));};AGIVertices['prototype'][_0x2147('0x173')]=function(_0x5d4070){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x174'),_0x5d4070[_0x2147('0x38')]));var _0x30a1ef=_0x5d4070[_0x2147('0x175')]||_0x2147('0x130');var _0x5667f1=util[_0x2147('0x53')](_0x2147('0x176'),this[_0x2147('0x36')][_0x2147('0x37')],rs[_0x2147('0x119')](0x5));var _0x4da1cd=util[_0x2147('0x53')](_0x2147('0x177'),FILES_PATH,_0x5667f1,_0x30a1ef);var _0x18e1db=util['format']('%s/recordings/%s',FILES_PATH,_0x5667f1);this[_0x2147('0x3c')][_0x2147('0xa2')](this,_0x5d4070,_0x5667f1,_0x4da1cd);this[_0x2147('0x36')][_0x2147('0x9d')](_0x2147('0x178'),_0x5667f1);logger[_0x2147('0x2c')](_0x2147('0x179'),_0x18e1db,_0x30a1ef,_0x5d4070['escape_digits'],_0x5d4070['timeout']);return this[_0x2147('0x36')]['recordFile'](_0x18e1db,_0x30a1ef,_0x5d4070[_0x2147('0x17a')],_0x5d4070['timeout'],undefined,!![]);};AGIVertices[_0x2147('0x12')][_0x2147('0x17b')]=function(_0xadfa4f){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x17c'),_0xadfa4f[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0xadfa4f['url'])){return this[_0x2147('0x36')]['noop'](_0x2147('0x17d'));}var _0x1503a4=this[_0x2147('0x64')]['sync'](this,_0xadfa4f);logger['info'](util['format']('Response:',util[_0x2147('0x17e')](_0x1503a4,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xadfa4f[_0x2147('0xd7')])){return this['channel'][_0x2147('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5681f9=this['getVariable'][_0x2147('0xa2')](this,_0xadfa4f[_0x2147('0xd7')]);if(!_0x5681f9){return this[_0x2147('0x36')]['error'](_0xadfa4f,_0x2147('0x117'));}this[_0x2147('0x36')][_0x2147('0x9d')](util[_0x2147('0x53')]('%s_STATUS_CODE',_0x5681f9),_0x1503a4[_0x2147('0x74')]?_0x1503a4[_0x2147('0x74')]:_0x2147('0x17f'));this[_0x2147('0x36')][_0x2147('0x9d')](util[_0x2147('0x53')](_0x2147('0x180'),_0x5681f9),_0x1503a4[_0x2147('0x75')]?_0x1503a4[_0x2147('0x75')]:'OK');if(_0x1503a4[_0x2147('0x6a')]){try{this[_0x2147('0x9a')](_0x1503a4[_0x2147('0x6a')],_0x5681f9);}catch(_0x384486){logger[_0x2147('0x2a')](util[_0x2147('0x53')](_0x2147('0x181'),_0x5681f9));}}return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xdc'),_0x5681f9));};AGIVertices['prototype'][_0x2147('0x182')]=function(_0x1f08db){logger['info'](util[_0x2147('0x53')](_0x2147('0x183'),_0x1f08db[_0x2147('0x38')]));return this[_0x2147('0x36')][_0x2147('0x184')](_0x1f08db[_0x2147('0x185')][_0x2147('0x58')](/\s+/g,''),_0x1f08db[_0x2147('0x17a')]);};AGIVertices[_0x2147('0x12')]['saynumber']=function(_0x38d147){logger[_0x2147('0x2c')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x38d147[_0x2147('0x38')]));return this[_0x2147('0x36')]['sayNumber'](_0x38d147[_0x2147('0x68')][_0x2147('0x58')](/\s+/g,''),_0x38d147[_0x2147('0x17a')]);};AGIVertices[_0x2147('0x12')][_0x2147('0x186')]=function(_0x51e262){logger[_0x2147('0x2c')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x51e262[_0x2147('0x38')]));return this[_0x2147('0x36')][_0x2147('0x187')](_0x51e262[_0x2147('0x5b')],_0x51e262[_0x2147('0x17a')]);};AGIVertices['prototype'][_0x2147('0x188')]=function(_0x53fabf){logger[_0x2147('0x2c')](util[_0x2147('0x53')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x53fabf[_0x2147('0x38')]));if(!this['isConfigured'](_0x53fabf[_0x2147('0x189')])){return this['channel'][_0x2147('0xa7')]('no\x20mail\x20account\x20configured');}var _0x157452=this[_0x2147('0x1f')]['sync'](this,_0x53fabf['account_id']);if(!_0x157452||!_0x157452[_0x2147('0x18a')]){return this[_0x2147('0x36')]['error'](_0x53fabf,'no\x20mail\x20account\x20found');}var _0x20167b={'from':util[_0x2147('0x53')]('\x22%s\x22\x20<%s>',_0x157452[_0x2147('0x17')],_0x157452['email']||_0x157452[_0x2147('0x18a')][_0x2147('0x18b')]),'to':_0x53fabf['to']||'','cc':_0x53fabf['cc']||'','bcc':_0x53fabf[_0x2147('0x18c')]||'','subject':_0x53fabf[_0x2147('0x18d')],'html':_0x53fabf[_0x2147('0x5b')],'text':_0x53fabf[_0x2147('0x5b')]};var _0x313e41={'tls':{'rejectUnauthorized':![]}};if(_0x157452[_0x2147('0x18a')][_0x2147('0x18e')]){_0x313e41[_0x2147('0x18e')]=_0x157452[_0x2147('0x18a')][_0x2147('0x18e')];}else{_0x313e41[_0x2147('0x18f')]=_0x157452['Smtp']['host'];_0x313e41[_0x2147('0x190')]=_0x157452[_0x2147('0x18a')][_0x2147('0x190')];_0x313e41[_0x2147('0x191')]=_0x157452[_0x2147('0x18a')]['secure'];}if(_0x157452[_0x2147('0x18a')]['authentication']){_0x313e41[_0x2147('0x192')]={'user':_0x157452[_0x2147('0x18a')][_0x2147('0x18b')],'pass':_0x157452[_0x2147('0x18a')][_0x2147('0x193')]};}if(this[_0x2147('0x83')](_0x53fabf['template_id'])){}logger[_0x2147('0xdd')](_0x2147('0x194'),JSON[_0x2147('0x72')](_0x20167b));this['createSquareDetailsReport'][_0x2147('0xa2')](this,_0x53fabf,_0x53fabf[_0x2147('0x189')]);this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x195'),_0x157452[_0x2147('0x17')]));this[_0x2147('0x21')][_0x2147('0xa2')](this,_0x313e41,_0x20167b);return this[_0x2147('0x36')][_0x2147('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x2147('0x196')]=function(_0x1e76a6){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x197'),_0x1e76a6['label']));return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0x198'));};AGIVertices[_0x2147('0x12')]['sendSMS']=function(_0x376397){logger['info'](util[_0x2147('0x53')](_0x2147('0x199'),_0x376397[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0x376397[_0x2147('0x19a')])){return this['channel'][_0x2147('0xa7')]('no\x20sms\x20account\x20configured');}var _0x57a364=this[_0x2147('0x32')]['sync'](this,_0x376397['sms_account_id']);if(!_0x57a364){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x376397,_0x2147('0x19b'));}var _0x10c1a8={'body':_0x376397[_0x2147('0x19c')],'phone':_0x376397['to']||'','SmsAccountId':_0x57a364['id']};logger[_0x2147('0xdd')]('sendSMS\x20message',JSON[_0x2147('0x72')](_0x10c1a8));this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x376397,_0x376397[_0x2147('0x19a')]);this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0x19d'),_0x57a364['name']));this[_0x2147('0x34')][_0x2147('0xa2')](this,_0x10c1a8);return this[_0x2147('0x36')][_0x2147('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x2147('0x19e')]=function(_0x2f86ad){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x19f'),_0x2f86ad[_0x2147('0x38')]));if(!this['isConfigured'](_0x2f86ad[_0x2147('0xd7')])){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x2f86ad,_0x2147('0x1a0'));}var _0x3b1624=this[_0x2147('0x13')]['sync'](this,_0x2f86ad['variable_id']);if(!_0x3b1624){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x2f86ad,_0x2147('0x117'));}return this[_0x2147('0x36')][_0x2147('0x9d')](_0x3b1624,_0x2f86ad[_0x2147('0x1a1')]);};AGIVertices[_0x2147('0x12')][_0x2147('0x1a2')]=function(_0x537e0){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x1a3'),_0x537e0['label']));this[_0x2147('0x36')]['noop'](_0x2147('0x1a4'));if(_0x537e0[_0x2147('0xb5')]==='yes'){this['channel'][_0x2147('0xa7')](_0x2147('0x1a5'));return this[_0x2147('0x36')][_0x2147('0xb5')]();}return this['channel'][_0x2147('0xa7')](_0x2147('0x1a6'));};AGIVertices['prototype'][_0x2147('0x1a7')]=function(_0x1ddc2b){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x1a8'),_0x1ddc2b[_0x2147('0x38')]));if(!this['isConfigured'](_0x1ddc2b[_0x2147('0x1a9')])){return this[_0x2147('0x36')]['error'](_0x1ddc2b,_0x2147('0x1aa'));}var _0x4335fa=this[_0x2147('0x18')][_0x2147('0xa2')](this,_0x1ddc2b[_0x2147('0x1a9')]);if(!this[_0x2147('0x83')](_0x4335fa)){return this[_0x2147('0x36')][_0x2147('0x2a')](_0x1ddc2b,util[_0x2147('0x53')](_0x2147('0x1ab'),_0x1ddc2b[_0x2147('0x1a9')]));}if(_0x4335fa===this[_0x2147('0x36')][_0x2147('0x3a')]){return this['channel'][_0x2147('0x2a')](_0x1ddc2b,_0x2147('0x1ac'));}this[_0x2147('0x35')]['sync'](this,_0x1ddc2b,_0x4335fa);var _0x1d0da7=this[_0x2147('0x36')][_0x2147('0x56')](_0x2147('0x1ad'),util[_0x2147('0x53')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x2147('0x8')]['host']||_0x2147('0x1ae'),_0x4335fa,this['channel'][_0x2147('0x3a')]));if(_0x1d0da7[_0x2147('0xa9')]===-0x1){return _0x1d0da7;}return this['channel']['noop'](util[_0x2147('0x53')](_0x2147('0xc0'),'AGI',_0x4335fa));};AGIVertices[_0x2147('0x12')][_0x2147('0x1af')]=function(_0x204afe){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x1b0'),_0x204afe[_0x2147('0x38')]));var _0x1b1cca=this[_0x2147('0x55')][_0x2147('0xa2')](this,_0x204afe[_0x2147('0xb4')]);this[_0x2147('0x35')][_0x2147('0xa2')](this,_0x204afe,_0x204afe[_0x2147('0xb4')]);if(this[_0x2147('0x83')](_0x204afe[_0x2147('0xd7')])){var _0x4f6977=this[_0x2147('0x13')][_0x2147('0xa2')](this,_0x204afe[_0x2147('0xd7')]);if(_0x4f6977){this['channel'][_0x2147('0x9d')](_0x4f6977,_0x1b1cca);return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x204afe[_0x2147('0xb4')],_0x4f6977));}}return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x1b1'),_0x204afe['command']));};AGIVertices['prototype'][_0x2147('0x1b2')]=function(_0x493606){logger[_0x2147('0x2c')](util['format'](_0x2147('0x1b3'),_0x493606[_0x2147('0x38')]));_0x493606[_0x2147('0x5b')]=_0x493606['text'][_0x2147('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2147('0x83')](_0x493606[_0x2147('0x1b4')])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0x1b5'));}if(!this['isConfigured'](_0x493606[_0x2147('0x5b')])){return this['channel'][_0x2147('0xa7')](_0x2147('0xc3'));}this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0x1b6'),_0x493606['text']));var _0x267e71=this[_0x2147('0x59')][_0x2147('0xa2')](this,_0x493606);if(_0x267e71){this[_0x2147('0x36')][_0x2147('0xa7')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x267e71));var _0x22285c=this[_0x2147('0x36')]['streamFile'](_0x267e71);try{fs[_0x2147('0x124')](_0x267e71+_0x2147('0x101'));}catch(_0x4ef09b){logger[_0x2147('0x2a')](_0x4ef09b);}return _0x22285c;}return this[_0x2147('0x36')][_0x2147('0x2a')](_0x493606,_0x2147('0x1b7'));};AGIVertices[_0x2147('0x12')][_0x2147('0x1b8')]=function(_0x1261fb){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x1b9'),_0x1261fb[_0x2147('0x38')]));_0x1261fb['text']=_0x1261fb['text'][_0x2147('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1261fb['text'])){return this[_0x2147('0x36')][_0x2147('0xa7')](_0x2147('0xc3'));}this[_0x2147('0x36')]['noop'](util['format'](_0x2147('0x1ba'),_0x1261fb[_0x2147('0x5b')]));var _0xdcbc84=this[_0x2147('0x62')][_0x2147('0xa2')](this,_0x1261fb);if(_0xdcbc84){this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0x1bb'),_0xdcbc84));var _0x133b32=this[_0x2147('0x36')][_0x2147('0x100')](_0xdcbc84);try{fs['unlink'](_0xdcbc84+_0x2147('0x101'));}catch(_0x3372ab){logger['error'](_0x3372ab);}return _0x133b32;}return this[_0x2147('0x36')]['error'](_0x1261fb,_0x2147('0x1bc'));};AGIVertices[_0x2147('0x12')][_0x2147('0x1bd')]=function(_0xe591fb){logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x1be'),_0xe591fb[_0x2147('0x38')]));if(!this[_0x2147('0x83')](_0xe591fb[_0x2147('0x155')])){return this['channel'][_0x2147('0x2a')](_0xe591fb,_0x2147('0x156'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2147('0x36')][_0x2147('0x3b')],_0xe591fb[_0x2147('0x155')]));var _0x4efef5=this[_0x2147('0x4f')][_0x2147('0xa2')](this,_0xe591fb['findBy']);if(_0x4efef5){logger['info'](util['format'](_0x2147('0x157'),this[_0x2147('0x36')][_0x2147('0x3b')],_0xe591fb[_0x2147('0x155')]));this['channel'][_0x2147('0xa7')](util[_0x2147('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2147('0x36')][_0x2147('0x3b')],_0xe591fb[_0x2147('0x155')]));return{'code':0xc8,'result':_0x2147('0x158')};}else{logger[_0x2147('0x2c')](util[_0x2147('0x53')](_0x2147('0x159'),this[_0x2147('0x36')][_0x2147('0x3b')],_0xe591fb['findBy']));this[_0x2147('0x36')][_0x2147('0xa7')](util['format'](_0x2147('0x159'),this[_0x2147('0x36')][_0x2147('0x3b')],_0xe591fb[_0x2147('0x155')]));return{'code':0xc8,'result':_0x2147('0x166')};}};AGIVertices[_0x2147('0x12')]['voicemail']=function(_0x54c95f){logger['info'](util[_0x2147('0x53')](_0x2147('0x1bf'),_0x54c95f[_0x2147('0x38')]));var _0x2f8533=this[_0x2147('0x36')]['exec'](_0x2147('0x1c0'),[_0x54c95f['mailbox'],_0x54c95f['options']]);if(_0x2f8533[_0x2147('0xa9')]===-0x1){return _0x2f8533;}return this[_0x2147('0x36')][_0x2147('0xa7')](util[_0x2147('0x53')](_0x2147('0xc0'),_0x2147('0x1c0'),_0x54c95f['mailbox']));};AGIVertices['prototype'][_0x2147('0x1c1')]=function(_0x2ec6e8){logger[_0x2147('0x2c')](util['format'](_0x2147('0x1c2'),_0x2ec6e8['label']));if(!this[_0x2147('0x83')](_0x2ec6e8[_0x2147('0xd7')])){return this['channel'][_0x2147('0x2a')](_0x2ec6e8,_0x2147('0x1a0'));}var _0x2701a2=this[_0x2147('0x13')]['sync'](this,_0x2ec6e8[_0x2147('0xd7')]);if(!_0x2701a2){return this['channel'][_0x2147('0x2a')](_0x2ec6e8,'no\x20variable\x20found');}var _0x2cc6b7=this[_0x2147('0x36')][_0x2147('0x13')](_0x2701a2);return{'code':0xc8,'result':_0x2cc6b7['extra']?_0x2cc6b7[_0x2147('0x9f')]:'-'};};String[_0x2147('0x12')][_0x2147('0x1c3')]=function(_0x6cdee7,_0x568e7c){return this[_0x2147('0x9e')](_0x6cdee7)[_0x2147('0x1c4')](_0x568e7c);};module[_0x2147('0x1c5')]=AGIVertices; \ No newline at end of file +var _0x4358=['variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueueById','getSquareProject','name','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','map','Intervals','interval','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Query\x20executed\x20correctly\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','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','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','text','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','speed','ispeechASR','ispeech_asr_language','isConfigured','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','saveRestApiResult','%s.%s','length','setVariable','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','getQueryOdbc'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x4358,0xf4));var _0x8435=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0x4358[_0x1283d4];return _0x433643;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x8435('0x0'));var _=require(_0x8435('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x8435('0x2'));var Mustache=require('mustache');var rp=require(_0x8435('0x3'));var logger=require(_0x8435('0x4'))(_0x8435('0x5'));var config=require(_0x8435('0x6'));var scripts=require(_0x8435('0x7'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8435('0x8'),'rawBody'];var verticesWithRetry=[_0x8435('0x9'),'getdigits',_0x8435('0xa')];var AGIVertices=function(_0x43909b,_0x16e87e,_0x56b186){this[_0x8435('0xb')]=_0x43909b;this[_0x8435('0xc')]=_0x16e87e;this[_0x8435('0xd')]=_0x56b186;};AGIVertices[_0x8435('0xe')][_0x8435('0xf')]=function(_0x150fc9,_0x1a0011){this['rpc'][_0x8435('0x10')](_0x150fc9)[_0x8435('0x11')](function(_0x535fe0){_0x1a0011(null,_0x535fe0?_0x535fe0['name']:![]);})[_0x8435('0x12')](function(_0x527788){_0x1a0011(_0x527788);});};AGIVertices[_0x8435('0xe')]['getVoiceQueue']=function(_0x15a187,_0x1f1241){this[_0x8435('0xc')][_0x8435('0x13')](_0x15a187)[_0x8435('0x11')](function(_0x17c917){_0x1f1241(null,_0x17c917?_0x17c917['name']:![]);})[_0x8435('0x12')](function(_0x3d0c8e){_0x1f1241(_0x3d0c8e);});};AGIVertices[_0x8435('0xe')][_0x8435('0x14')]=function(_0x4785bb,_0x1db69d){this[_0x8435('0xc')]['getSquareProjectById'](_0x4785bb)['then'](function(_0x316a2a){_0x1db69d(null,_0x316a2a?_0x316a2a[_0x8435('0x15')]:![]);})['catch'](function(_0x2fbf82){_0x1db69d(_0x2fbf82);});};AGIVertices[_0x8435('0xe')][_0x8435('0x16')]=function(_0x578e70,_0x324088){this[_0x8435('0xc')][_0x8435('0x17')](_0x578e70)[_0x8435('0x11')](function(_0x3442d7){_0x324088(null,_0x3442d7?_0x3442d7['dsn']:![]);})[_0x8435('0x12')](function(_0x13b378){_0x324088(_0x13b378);});};AGIVertices[_0x8435('0xe')][_0x8435('0x18')]=function(_0x2cf4e7,_0xb59444){this['rpc'][_0x8435('0x19')](_0x2cf4e7)[_0x8435('0x11')](function(_0x3af656){_0xb59444(null,_0x3af656?_0x3af656[_0x8435('0x15')]:![]);})['catch'](function(_0x2d774c){_0xb59444(_0x2d774c);});};AGIVertices[_0x8435('0xe')][_0x8435('0x1a')]=function(_0x34a64b,_0x332608){this[_0x8435('0xc')][_0x8435('0x1b')](_0x34a64b)['then'](function(_0x465384){_0x332608(null,_0x465384?_0x465384['name']:![]);})[_0x8435('0x12')](function(_0x10c089){_0x332608(_0x10c089);});};AGIVertices[_0x8435('0xe')][_0x8435('0x1c')]=function(_0x5a6f55,_0x2b3c2c){var _0x3e438b=this;this[_0x8435('0xc')][_0x8435('0x1d')](_0x5a6f55)[_0x8435('0x11')](function(_0x122047){_0x2b3c2c(null,_0x122047?_0x3e438b[_0x8435('0x1e')](_0x122047[_0x8435('0x1f')]):![]);})[_0x8435('0x12')](function(_0x89677a){_0x2b3c2c(_0x89677a);});};AGIVertices[_0x8435('0xe')][_0x8435('0x20')]=function(_0xea765a,_0x4ae641){this[_0x8435('0xc')][_0x8435('0x21')](_0xea765a)['then'](function(_0x49b3b2){_0x4ae641(null,_0x49b3b2?_0x49b3b2:![]);})[_0x8435('0x12')](function(_0x5a354f){_0x4ae641(_0x5a354f);});};AGIVertices[_0x8435('0xe')][_0x8435('0x22')]=function(_0x34a942,_0x1e9412,_0x42c3b4){this[_0x8435('0xd')][_0x8435('0x22')](_0x34a942,_0x1e9412)[_0x8435('0x11')](function(){_0x42c3b4(null);})[_0x8435('0x12')](function(_0x526aa3){_0x42c3b4(_0x526aa3);});};AGIVertices[_0x8435('0xe')][_0x8435('0x23')]=function(_0x34803a,_0x31b176){this[_0x8435('0xc')][_0x8435('0x24')](_0x34803a)[_0x8435('0x11')](function(_0x2201a3){if(_0x2201a3){if(_0x2201a3['IntervalId']){_0x31b176(null,[_0x2201a3['interval']]);}else{_0x31b176(null,_[_0x8435('0x25')](_0x2201a3[_0x8435('0x26')],_0x8435('0x27')));}}else{_0x31b176(null,![]);}})[_0x8435('0x12')](function(_0x99346){_0x31b176(_0x99346);});};AGIVertices[_0x8435('0xe')][_0x8435('0x1e')]=function(_0x130fe9){return util[_0x8435('0x28')](_0x8435('0x29'),FILES_PATH,_0x130fe9);};AGIVertices['prototype']['getQueryOdbc']=function(_0x4938aa,_0x53319e,_0x461ef5){odbc[_0x8435('0x2a')](_0x4938aa,function(_0x2c8935){if(_0x2c8935){logger[_0x8435('0x2b')](_0x8435('0x2c'),_0x2c8935);_0x461ef5(_0x2c8935);}else{logger[_0x8435('0x2d')]('ODBC\x20connection\x20successfully');odbc['query'](_0x53319e,function(_0x12f664,_0x3f6274){if(_0x12f664){logger['info']('Error\x20executing\x20query\x20%s',_0x53319e);_0x461ef5(_0x12f664);}else{logger[_0x8435('0x2d')](_0x8435('0x2e'),_0x53319e);odbc['close'](function(_0x1e0745){if(_0x1e0745){logger[_0x8435('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1e0745);}_0x461ef5(null,_0x3f6274);});}});}});};AGIVertices[_0x8435('0xe')]['getSmsAccount']=function(_0x1fcf67,_0x34aa4c){this[_0x8435('0xc')][_0x8435('0x2f')](_0x1fcf67)[_0x8435('0x11')](function(_0x3ea2a8){_0x34aa4c(null,_0x3ea2a8?_0x3ea2a8:![]);})[_0x8435('0x12')](function(_0x4eddbc){_0x34aa4c(_0x4eddbc);});};AGIVertices['prototype'][_0x8435('0x30')]=function(_0x1ab66b,_0x8d2803){this[_0x8435('0xc')]['createSmsMessage'](_0x1ab66b)['then'](function(_0x4288fd){_0x8d2803(null,_0x4288fd);})[_0x8435('0x12')](function(_0x4c67b8){_0x8d2803(_0x4c67b8);});};AGIVertices[_0x8435('0xe')][_0x8435('0x31')]=function(_0x3fee86,_0x3df48e,_0x1b59ca){this[_0x8435('0xc')][_0x8435('0x31')]({'uniqueid':this[_0x8435('0xb')][_0x8435('0x32')],'node':_0x3fee86['label'],'application':_0x3fee86['agicommand'],'data':_0x3df48e||null,'project_name':this['channel'][_0x8435('0x33')],'callerid':this[_0x8435('0xb')][_0x8435('0x34')]})[_0x8435('0x11')](function(_0x5a9c31){if(_0x1b59ca){_0x1b59ca(null,_0x5a9c31);}})[_0x8435('0x12')](function(_0x7421da){if(_0x1b59ca){_0x1b59ca(_0x7421da);}});};AGIVertices[_0x8435('0xe')][_0x8435('0x35')]=function(_0x38806f,_0xb0b453,_0x5eda47,_0x142a13){this[_0x8435('0xc')][_0x8435('0x35')]({'uniqueid':this[_0x8435('0xb')]['uniqueid'],'callerid':this[_0x8435('0xb')][_0x8435('0x34')],'calleridname':this[_0x8435('0xb')][_0x8435('0x36')],'context':this[_0x8435('0xb')][_0x8435('0x37')],'extension':this[_0x8435('0xb')][_0x8435('0x38')],'priority':this[_0x8435('0xb')]['priority'],'accountcode':this[_0x8435('0xb')][_0x8435('0x39')],'dnid':this[_0x8435('0xb')][_0x8435('0x3a')],'projectName':this[_0x8435('0xb')][_0x8435('0x33')],'saveName':_0xb0b453,'filename':_0x38806f['file']||_0xb0b453,'savePath':_0x5eda47})[_0x8435('0x11')](function(_0x3bc132){_0x142a13(null,_0x3bc132);})['catch'](function(_0x3f152e){_0x142a13(_0x3f152e);});};AGIVertices['prototype'][_0x8435('0x3b')]=function(_0x4e30c6,_0x10fac4,_0x3697ab,_0x12c3dd,_0x9a6667){this[_0x8435('0xc')]['createSquareMessage']({'uniqueid':this[_0x8435('0xb')][_0x8435('0x32')],'body':_0x4e30c6,'direction':_0x10fac4,'providerName':_0x3697ab,'providerResponse':_0x12c3dd})[_0x8435('0x11')](function(_0x11d71a){if(_0x9a6667){_0x9a6667(null,_0x11d71a);}})[_0x8435('0x12')](function(_0x153025){if(_0x9a6667){_0x9a6667(_0x153025);}});};AGIVertices[_0x8435('0xe')][_0x8435('0x3c')]=function(_0x5c0379,_0x10f6e1){this[_0x8435('0xc')][_0x8435('0x3c')]({'firstName':_[_0x8435('0x3d')](_0x5c0379[_0x8435('0x15')])||_[_0x8435('0x3e')](_0x5c0379[_0x8435('0x15')])?'callback_'+Math[_0x8435('0x3f')]():_0x5c0379['name'],'lastName':_['isEmpty'](_0x5c0379[_0x8435('0x40')])||_[_0x8435('0x3e')](_0x5c0379['lastName'])?null:_0x5c0379[_0x8435('0x40')],'phone':_0x5c0379[_0x8435('0x41')],'ListId':_0x5c0379[_0x8435('0x42')],'scheduledat':_0x5c0379[_0x8435('0x43')],'callbackUniqueid':this[_0x8435('0xb')]['uniqueid'],'tags':_0x8435('0x44'),'description':_0x8435('0x45')+_0x5c0379['scheduledAt'][_0x8435('0x46')](),'priority':_0x5c0379[_0x8435('0x47')]})[_0x8435('0x11')](function(_0x168d11){_0x10f6e1(null,_0x168d11);})[_0x8435('0x12')](function(_0x25f25a){_0x10f6e1(_0x25f25a);});};AGIVertices[_0x8435('0xe')]['getPause']=function(_0x972624,_0x2785e8){this[_0x8435('0xc')][_0x8435('0x48')](_0x972624)[_0x8435('0x11')](function(_0x33cdc2){_0x2785e8(null,_0x33cdc2?_0x33cdc2[_0x8435('0x15')]:![]);})['catch'](function(_0x708f96){_0x2785e8(_0x708f96);});};AGIVertices['prototype']['agentPause']=function(_0x8571ce,_0x539764,_0x374446){var _0x3fcef2={'role':'agent'};_0x3fcef2[_0x8571ce]=this['channel'][_0x8435('0x34')];this[_0x8435('0xc')][_0x8435('0x49')](_0x3fcef2,_0x539764,this[_0x8435('0xb')][_0x8435('0x32')])[_0x8435('0x11')](function(_0x4c385c){_0x374446(null,_['isNil'](_0x4c385c)?![]:!![]);})[_0x8435('0x12')](function(_0x5d797b){logger['error'](_0x5d797b);_0x374446(null,![]);});};AGIVertices[_0x8435('0xe')][_0x8435('0x4a')]=function(_0x2e763b,_0x19493d){var _0x50eb49={'role':_0x8435('0x4b')};_0x50eb49[_0x2e763b]=this[_0x8435('0xb')][_0x8435('0x34')];this['rpc'][_0x8435('0x4a')](_0x50eb49)[_0x8435('0x11')](function(_0x47316){_0x19493d(null,_['isNil'](_0x47316)?![]:!![]);})[_0x8435('0x12')](function(_0x51d79c){logger['error'](_0x51d79c);_0x19493d(null,![]);});};AGIVertices[_0x8435('0xe')][_0x8435('0x4c')]=function(_0x56eea1,_0x215421){var _0x237bc1={'role':_0x8435('0x4b')};_0x237bc1[_0x56eea1]=this['channel'][_0x8435('0x34')];this['rpc'][_0x8435('0x4c')](_0x237bc1)[_0x8435('0x11')](function(_0x2ca647){_0x215421(null,_[_0x8435('0x3e')](_0x2ca647)?![]:!![]);})['catch'](function(_0xdc2161){logger[_0x8435('0x2b')](_0xdc2161);_0x215421(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x19fd6e,_0x17cbc8){var _0x5802ce={'role':_0x8435('0x4b')};_0x5802ce[_0x19fd6e]=this[_0x8435('0xb')][_0x8435('0x34')];var _0x4ae0f0=_0x19fd6e!=_0x8435('0x4d')?util['format'](_0x8435('0x4e'),_0x8435('0x4f'),this[_0x8435('0xb')][_0x8435('0x34')]):undefined;this[_0x8435('0xc')][_0x8435('0x50')](_0x5802ce,_0x4ae0f0)['then'](function(_0x3d70bc){_0x17cbc8(null,_['isNil'](_0x3d70bc)?![]:!![]);})[_0x8435('0x12')](function(_0x51dc96){logger['error'](_0x51dc96);_0x17cbc8(null,![]);});};AGIVertices[_0x8435('0xe')][_0x8435('0x51')]=function(_0x531253,_0x1614c6){sh['exec'](_[_0x8435('0x52')](_0x531253),function(_0x48d7bc,_0x328453){var _0x201262=_0x328453[_0x8435('0x53')](/(\r\n|\n|\r)/gm,'');_0x1614c6(null,_0x201262);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x2a32da,_0x404080){scripts[_0x8435('0x54')](_0x2a32da[_0x8435('0x55')],_0x2a32da[_0x8435('0x56')]||'text',_0x2a32da['text'],_0x2a32da[_0x8435('0x57')]||_0x8435('0x58'),_0x2a32da[_0x8435('0x59')]||'MALE',_0x2a32da['audioEncoding']||_0x8435('0x5a'))[_0x8435('0x11')](function(_0x172f37){_0x404080(null,_0x172f37);})[_0x8435('0x12')](function(_0x727599){_0x404080(_0x727599);});};AGIVertices[_0x8435('0xe')][_0x8435('0x5b')]=function(_0x3039e5,_0x339dbb){scripts['googleTTS'](_0x3039e5['text'],_0x3039e5[_0x8435('0x5c')]||'en',0x1)[_0x8435('0x11')](function(_0x5a6e4e){_0x339dbb(null,_0x5a6e4e);})[_0x8435('0x12')](function(_0x10baed){_0x339dbb(_0x10baed);});};AGIVertices[_0x8435('0xe')][_0x8435('0x5d')]=function(_0x2aaded,_0x31917c){var _0x57a191={'uri':_0x2aaded[_0x8435('0x5e')],'method':_0x2aaded['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2aaded[_0x8435('0x5f')])===_0x8435('0x60')&&parseInt(_0x2aaded[_0x8435('0x5f')])>=0x1?parseInt(_0x2aaded['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x8435('0x61')]([_0x8435('0x62'),_0x8435('0x63')],_0x57a191['method'][_0x8435('0x64')]())){try{_0x57a191['body']=_0x2aaded['rawBody']?JSON[_0x8435('0x65')](_0x2aaded['rawBody']):{};}catch(_0x243793){logger[_0x8435('0x2b')](_0x8435('0x66'),_0x243793);}}try{_0x57a191[_0x8435('0x67')]=_0x2aaded[_0x8435('0x8')]?JSON[_0x8435('0x65')](_0x2aaded[_0x8435('0x8')]):{};}catch(_0x48c389){logger[_0x8435('0x2b')](_0x8435('0x68'),_0x48c389);}if(_0x2aaded[_0x8435('0x69')]){try{var _0x999468=require(_0x2aaded[_0x8435('0x69')])[_0x8435('0x6a')](this,_0x57a191);_0x57a191[_0x8435('0x6b')]=Mustache[_0x8435('0x6c')](_0x2aaded[_0x8435('0x5e')],_0x999468,{},['$$','$$']);if(_0x57a191[_0x8435('0x67')]){_0x57a191['headers']=JSON[_0x8435('0x65')](Mustache[_0x8435('0x6c')](JSON[_0x8435('0x6d')](_0x57a191['headers']),_0x999468,{},['$$','$$']));}if(_0x57a191['body']){_0x57a191[_0x8435('0x6e')]=JSON[_0x8435('0x65')](Mustache[_0x8435('0x6c')](JSON[_0x8435('0x6d')](_0x57a191['body']),_0x999468,{},['$$','$$']));}}catch(_0xf1e33e){logger[_0x8435('0x2b')](_0x8435('0x6f'),_0xf1e33e);}}rp(_0x57a191)[_0x8435('0x11')](function(_0x4696a7){var _0x51974b={'statusCode':_0x4696a7[_0x8435('0x70')]||0xc8,'statusMessage':_0x4696a7[_0x8435('0x71')]||'OK','headers':_0x4696a7[_0x8435('0x67')]||{},'body':_0x4696a7[_0x8435('0x6e')]||{}};_0x31917c(null,_0x51974b);})[_0x8435('0x12')](function(_0x340d91){var _0x3b6ae6={'statusCode':_0x340d91[_0x8435('0x70')]||0x1f4,'statusMessage':_0x340d91[_0x8435('0x72')]||_0x8435('0x73'),'headers':_0x340d91[_0x8435('0x74')]['headers']||{},'body':_0x340d91[_0x8435('0x74')]['body']||{}};_0x31917c(null,_0x3b6ae6);});};AGIVertices[_0x8435('0xe')][_0x8435('0x75')]=function(_0x25e596,_0x43588e){scripts[_0x8435('0x75')](this[_0x8435('0xb')][_0x8435('0x32')],_0x25e596[_0x8435('0x76')],_0x25e596[_0x8435('0x77')],_0x25e596[_0x8435('0x78')]||'en')[_0x8435('0x11')](function(_0x5d6a74){_0x43588e(null,_0x5d6a74);})[_0x8435('0x12')](function(_0x420c0b){_0x43588e(_0x420c0b);});};AGIVertices[_0x8435('0xe')][_0x8435('0x79')]=function(_0x3de408,_0x4eedec){scripts[_0x8435('0x79')](this[_0x8435('0xb')][_0x8435('0x32')],_0x3de408[_0x8435('0x7a')],_0x3de408[_0x8435('0x7b')],_0x3de408[_0x8435('0x7c')],_0x3de408[_0x8435('0x77')],_0x3de408['dialogflowV2_language']||'en')['then'](function(_0x44f9de){_0x4eedec(null,_0x44f9de);})[_0x8435('0x12')](function(_0x494152){_0x4eedec(_0x494152);});};AGIVertices[_0x8435('0xe')]['sestekNDA']=function(_0x595d93,_0x244ef8){scripts[_0x8435('0x7d')](this[_0x8435('0xb')],_0x595d93)[_0x8435('0x11')](function(_0xff77b4){_0x244ef8(null,_0xff77b4);})[_0x8435('0x12')](function(_0x460bf1){_0x244ef8(_0x460bf1);});};AGIVertices[_0x8435('0xe')]['ispeechTTS']=function(_0xc2756a,_0x3bc23f){scripts['ispeechTTS'](_0xc2756a[_0x8435('0x76')],_0xc2756a[_0x8435('0x77')],_0xc2756a['ispeech_tts_language']||_0x8435('0x58'),_0xc2756a[_0x8435('0x7e')])[_0x8435('0x11')](function(_0x1159d0){_0x3bc23f(null,_0x1159d0);})[_0x8435('0x12')](function(_0x189540){_0x3bc23f(_0x189540);});};AGIVertices[_0x8435('0xe')][_0x8435('0x7f')]=function(_0x593956,_0x3bd4e4,_0x26a428){scripts[_0x8435('0x7f')](_0x3bd4e4,_0x593956['key'],_0x593956[_0x8435('0x80')]||_0x8435('0x58'),this[_0x8435('0x81')](_0x593956['model'])?_0x593956['model']:undefined)[_0x8435('0x11')](function(_0x50366d){_0x26a428(null,_0x50366d);})[_0x8435('0x12')](function(_0x1dffee){_0x26a428(_0x1dffee);});};AGIVertices[_0x8435('0xe')][_0x8435('0x82')]=function(_0x341df5,_0x5bae44){scripts[_0x8435('0x82')](_0x341df5[_0x8435('0x83')],_0x341df5[_0x8435('0x84')],_0x341df5[_0x8435('0x85')],_0x341df5[_0x8435('0x86')]||_0x8435('0x87'),_0x341df5[_0x8435('0x77')],_0x341df5[_0x8435('0x88')]||_0x8435('0x77'))['then'](function(_0x5bf093){_0x5bae44(null,_0x5bf093);})[_0x8435('0x12')](function(_0x21e574){_0x5bae44(_0x21e574);});};AGIVertices[_0x8435('0xe')][_0x8435('0x89')]=function(_0x5b622f,_0x56ef71){scripts[_0x8435('0x89')](this[_0x8435('0xb')][_0x8435('0x32')],_0x5b622f[_0x8435('0x83')],_0x5b622f[_0x8435('0x84')],_0x5b622f[_0x8435('0x8a')],_0x5b622f[_0x8435('0x77')],_0x5b622f[_0x8435('0x8b')])['then'](function(_0x429c10){_0x56ef71(null,_0x429c10);})[_0x8435('0x12')](function(_0x802b2f){_0x56ef71(_0x802b2f);});};AGIVertices[_0x8435('0xe')][_0x8435('0x8c')]=function(_0x48655a,_0x475ecf,_0x2ef16f){scripts[_0x8435('0x8c')](_0x475ecf,_0x48655a[_0x8435('0x76')],_0x48655a[_0x8435('0x8d')]||_0x8435('0x58'))['then'](function(_0x3fc6aa){_0x2ef16f(null,_0x3fc6aa);})[_0x8435('0x12')](function(_0x96f831){_0x2ef16f(_0x96f831);});};AGIVertices[_0x8435('0xe')][_0x8435('0x8e')]=function(_0x1a830f,_0x4d43f2,_0x34672e){scripts[_0x8435('0x8e')](_0x4d43f2,_0x1a830f[_0x8435('0x8f')],_0x1a830f[_0x8435('0x90')],_0x1a830f['uri'])['then'](function(_0xb6ad18){_0x34672e(null,_0xb6ad18);})[_0x8435('0x12')](function(_0x1c8a88){_0x34672e(_0x1c8a88);});};AGIVertices[_0x8435('0xe')][_0x8435('0x91')]=function(_0x9e0030){var _0x1464bc=_[_0x8435('0x61')](verticesWithRetry,_0x9e0030['agicommand'])?_0x9e0030:_['clone'](_0x9e0030);for(var _0x5b2799 in _0x1464bc){if(_0x1464bc[_0x8435('0x92')](_0x5b2799)){if(_0x1464bc[_0x5b2799]&&_[_0x8435('0x93')](_0x1464bc[_0x5b2799])){if(_[_0x8435('0x61')](recursiveMapAttributes,_0x5b2799)){_0x1464bc[_0x5b2799]=this[_0x8435('0x94')](_0x1464bc[_0x5b2799]);}else{_0x1464bc[_0x5b2799]=this['replaceAllVariables'](_0x1464bc[_0x5b2799]);}}}}return _0x1464bc;};AGIVertices[_0x8435('0xe')]['recursiveNodeIndex']=function(_0x2b39c3){for(var _0x29bbaf in _0x2b39c3){if(_0x2b39c3[_0x8435('0x92')](_0x29bbaf)){if(_[_0x8435('0x95')](_0x2b39c3[_0x29bbaf])){this[_0x8435('0x96')](_0x2b39c3[_0x29bbaf]);}else if(_['isArray'](_0x2b39c3[_0x29bbaf])){for(var _0xeb56a3=0x0;_0xeb56a3<_0x2b39c3[_0x29bbaf]['length'];_0xeb56a3++){this[_0x8435('0x96')](_0x2b39c3[_0x29bbaf][_0xeb56a3]);}}else if(_[_0x8435('0x93')](_0x2b39c3[_0x29bbaf])){_0x2b39c3[_0x29bbaf]=this['replaceAllVariables'](_0x2b39c3[_0x29bbaf]);}}}};AGIVertices[_0x8435('0xe')]['saveRestApiResult']=function(_0x396802,_0x494bc7){for(var _0x323b4c in _0x396802){if(_0x396802[_0x8435('0x92')](_0x323b4c)){if(_[_0x8435('0x95')](_0x396802[_0x323b4c])){if(!_[_0x8435('0x3d')](_0x396802[_0x323b4c])){this[_0x8435('0x97')](_0x396802[_0x323b4c],util[_0x8435('0x28')](_0x8435('0x98'),_0x494bc7,_0x323b4c));}}else if(_['isArray'](_0x396802[_0x323b4c])){for(var _0x4f6848=0x0;_0x4f6848<_0x396802[_0x323b4c][_0x8435('0x99')];_0x4f6848++){this['saveRestApiResult'](_0x396802[_0x323b4c][_0x4f6848],util[_0x8435('0x28')](_0x8435('0x98'),_0x494bc7,_0x323b4c+'['+_0x4f6848+']'));}}else{if(!_[_0x8435('0x3e')](_0x396802[_0x323b4c])){this[_0x8435('0xb')][_0x8435('0x9a')](util[_0x8435('0x28')](_0x8435('0x98'),_0x494bc7,_0x323b4c),_0x396802[_0x323b4c]);}}}}};AGIVertices[_0x8435('0xe')][_0x8435('0x94')]=function(_0x3d694d){try{var _0xd08df6=JSON[_0x8435('0x65')](_0x3d694d);this['recursiveNodeIndex'](_0xd08df6);return JSON[_0x8435('0x6d')](_0xd08df6);}catch(_0x408768){return this[_0x8435('0x9b')](_0x3d694d);}};AGIVertices[_0x8435('0xe')][_0x8435('0x9b')]=function(_0x1e087d){var _0x183ecc=_0x1e087d[_0x8435('0x9c')]('{');for(var _0x179783=0x1;_0x179783<_0x183ecc['length'];_0x179783+=0x1){var _0x1848c3=_0x183ecc[_0x179783][_0x8435('0x9c')]('}');if(_0x1848c3[_0x8435('0x99')]>0x1){_0x1e087d=_0x1e087d[_0x8435('0x9d')]('{'+_0x1848c3[0x0]+'}',this['channel'][_0x8435('0xf')](_0x1848c3[0x0])[_0x8435('0x9e')]||_0x1848c3[0x0]);}}if(_0x183ecc[_0x8435('0x99')]===0x1){return _0x1e087d[_0x8435('0x46')]();}return this[_0x8435('0x9b')](_0x1e087d);};AGIVertices[_0x8435('0xe')][_0x8435('0x9f')]=function(_0x5e719b,_0x1eed1f){var _0x2d3238=this[_0x8435('0xb')][_0x8435('0xf')](_0x5e719b);if(_0x2d3238[_0x8435('0xa0')]===-0x1){return _0x2d3238;}logger['info'](util[_0x8435('0x28')](_0x8435('0xa1'),_0x1eed1f,_0x2d3238['extra']));return this['channel'][_0x8435('0x9a')](_0x1eed1f,_0x2d3238[_0x8435('0x9e')]);};AGIVertices['prototype'][_0x8435('0x81')]=function(_0x3ae90b){return _0x3ae90b&&_0x3ae90b!=='0'&&_0x3ae90b!=='-1'&&_0x3ae90b!=='';};AGIVertices[_0x8435('0xe')][_0x8435('0xa2')]=function(_0x3b12d3){this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x3b12d3,'-');_0x3b12d3[_0x8435('0xa3')]=_0x3b12d3[_0x8435('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8435('0xe')][_0x8435('0xa4')]=function(_0x32279){logger['info'](util[_0x8435('0x28')](_0x8435('0xa5'),_0x32279[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x32279[_0x8435('0x77')])){return this['channel'][_0x8435('0xa7')](_0x8435('0xa8'));}var _0x310c6f='\x22'+_0x32279[_0x8435('0x77')]+'\x22';if(this[_0x8435('0x81')](_0x32279[_0x8435('0x74')])){_0x310c6f+=','+_0x32279[_0x8435('0x74')];}var _0x35c3c1=this['channel'][_0x8435('0xa9')](_0x8435('0xaa'),_0x310c6f);if(_0x35c3c1[_0x8435('0xa0')]===-0x1){return _0x35c3c1;}return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0xab'),_0x310c6f));};AGIVertices['prototype']['mrcprecog']=function(_0x265796){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xac'),_0x265796[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x265796[_0x8435('0xad')])){return this['channel'][_0x8435('0xa7')](_0x8435('0xae'));}var _0x423512=_0x265796[_0x8435('0xad')];if(this['isConfigured'](_0x265796[_0x8435('0x74')])){_0x423512+=','+_0x265796['options'];}var _0x16b066=this['channel']['exec'](_0x8435('0xaf'),_0x423512);if(_0x16b066['result']===-0x1){return _0x16b066;}var _0x5ad2cc=this[_0x8435('0x9f')](_0x8435('0xb0'),_0x8435('0xb1'));if(_0x5ad2cc[_0x8435('0xa0')]===-0x1){return _0x5ad2cc;}var _0x3ca37c=this[_0x8435('0x9f')](_0x8435('0xb2'),_0x8435('0xb3'));if(_0x3ca37c[_0x8435('0xa0')]===-0x1){return _0x3ca37c;}var _0x428cff=this[_0x8435('0x9f')](_0x8435('0xb4'),'MRCP_RECOG_INSTANCE');if(_0x428cff['result']===-0x1){return _0x428cff;}return this[_0x8435('0xb')][_0x8435('0xa7')](util['format'](_0x8435('0xb5'),_0x423512));};AGIVertices[_0x8435('0xe')]['agi']=function(_0x2953d2){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xb6'),_0x2953d2[_0x8435('0xa6')]));return this[_0x8435('0xb')][_0x8435('0x5')]([_0x2953d2[_0x8435('0xb7')],_0x2953d2['args']]);};AGIVertices['prototype']['answer']=function(_0x20d870){logger[_0x8435('0x2d')](util['format'](_0x8435('0xb8'),_0x20d870[_0x8435('0xa6')]));if(this[_0x8435('0x81')](_0x20d870[_0x8435('0x5f')])){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xb9'),_0x20d870[_0x8435('0x5f')]));var _0x1025c1=this[_0x8435('0xb')][_0x8435('0xba')](_0x20d870[_0x8435('0x5f')]);if(_0x1025c1['result']===-0x1){return _0x1025c1;}}return this[_0x8435('0xb')][_0x8435('0xbb')]();};AGIVertices[_0x8435('0xe')][_0x8435('0x44')]=function(_0x56d641){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xbc'),_0x56d641[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x56d641['list_id'])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x56d641,_0x8435('0xbd'));}_0x56d641[_0x8435('0x43')]=moment();if(this[_0x8435('0x81')](_0x56d641['delay'])){_0x56d641[_0x8435('0x43')]=moment()[_0x8435('0xbe')](_0x56d641[_0x8435('0xbf')],_0x8435('0xc0'));}if(!this[_0x8435('0x81')](_0x56d641[_0x8435('0x47')])){_0x56d641[_0x8435('0x47')]=0x2;}this[_0x8435('0x3c')][_0x8435('0x6a')](this,_0x56d641);return this['channel'][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0xc1'),_0x56d641[_0x8435('0x41')],_0x56d641[_0x8435('0x42')],_0x56d641['scheduledAt']));};AGIVertices[_0x8435('0xe')][_0x8435('0xc2')]=function(_0x402961){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xc3'),_0x402961[_0x8435('0xa6')]));var _0x2f1c4d=this[_0x8435('0xb')]['exec'](_0x402961[_0x8435('0xc4')],_0x402961[_0x8435('0x74')]);if(_0x2f1c4d[_0x8435('0xa0')]===-0x1){return _0x2f1c4d;}return this['channel']['noop'](util[_0x8435('0x28')](_0x8435('0xc5'),_0x402961[_0x8435('0xc4')],_0x402961[_0x8435('0x74')]));};AGIVertices[_0x8435('0xe')][_0x8435('0xc6')]=function(_0x1d5eb0){logger['info'](util[_0x8435('0x28')](_0x8435('0xc7'),_0x1d5eb0[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x1d5eb0[_0x8435('0x77')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xa8'));}var _0x4bef57='\x22'+_0x1d5eb0[_0x8435('0x77')]+'\x22';if(this['isConfigured'](_0x1d5eb0[_0x8435('0x74')])){_0x4bef57+=','+_0x1d5eb0[_0x8435('0x74')];}var _0x25cf49=this[_0x8435('0xb')][_0x8435('0xa9')](_0x8435('0xaa'),_0x4bef57);if(_0x25cf49[_0x8435('0xa0')]===-0x1){return _0x25cf49;}return this['channel'][_0x8435('0xa7')](util[_0x8435('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4bef57));};AGIVertices[_0x8435('0xe')][_0x8435('0xc8')]=function(_0x35f9f0){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xc9'),_0x35f9f0['label']));if(!this[_0x8435('0x81')](_0x35f9f0['text'])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xa8'));}var _0x467561='\x22'+_0x35f9f0[_0x8435('0x77')]+'\x22';if(this[_0x8435('0x81')](_0x35f9f0['options'])){_0x467561+=','+_0x35f9f0[_0x8435('0x74')];}var _0x2ce4c8=this[_0x8435('0xb')][_0x8435('0xa9')](_0x8435('0xaa'),_0x467561);if(_0x2ce4c8[_0x8435('0xa0')]===-0x1){return _0x2ce4c8;}return this['channel']['noop'](util[_0x8435('0x28')](_0x8435('0xab'),_0x467561));};AGIVertices[_0x8435('0xe')]['lumenvoxasr']=function(_0x2ed34c){logger[_0x8435('0x2d')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2ed34c[_0x8435('0xa6')]));if(!this['isConfigured'](_0x2ed34c[_0x8435('0xad')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xae'));}var _0x3f1e0e=_0x2ed34c[_0x8435('0xad')];if(this[_0x8435('0x81')](_0x2ed34c[_0x8435('0x74')])){_0x3f1e0e+=','+_0x2ed34c[_0x8435('0x74')];}var _0x2e66f3=this[_0x8435('0xb')][_0x8435('0xa9')](_0x8435('0xaf'),_0x3f1e0e);if(_0x2e66f3[_0x8435('0xa0')]===-0x1){return _0x2e66f3;}var _0x32073a=this[_0x8435('0x9f')](_0x8435('0xb0'),_0x8435('0xca'));if(_0x32073a[_0x8435('0xa0')]===-0x1){return _0x32073a;}var _0x4475a7=this[_0x8435('0x9f')](_0x8435('0xb2'),_0x8435('0xcb'));if(_0x4475a7[_0x8435('0xa0')]===-0x1){return _0x4475a7;}var _0x271ed9=this[_0x8435('0x9f')](_0x8435('0xb4'),'LUMENVOX_ASR_INSTANCE');if(_0x271ed9[_0x8435('0xa0')]===-0x1){return _0x271ed9;}return this['channel']['noop'](util[_0x8435('0x28')](_0x8435('0xb5'),_0x3f1e0e));};AGIVertices['prototype'][_0x8435('0xcc')]=function(_0x220122){logger[_0x8435('0x2d')](util['format'](_0x8435('0xcd'),_0x220122[_0x8435('0xa6')]));if(!this['isConfigured'](_0x220122['grammar'])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xae'));}var _0x2d1109=_0x220122[_0x8435('0xad')];if(this[_0x8435('0x81')](_0x220122[_0x8435('0x74')])){_0x2d1109+=','+_0x220122['options'];}var _0xbb121a=this[_0x8435('0xb')][_0x8435('0xa9')](_0x8435('0xaf'),_0x2d1109);if(_0xbb121a[_0x8435('0xa0')]===-0x1){return _0xbb121a;}var _0x22e3a6=this[_0x8435('0x9f')](_0x8435('0xb0'),_0x8435('0xce'));if(_0x22e3a6[_0x8435('0xa0')]===-0x1){return _0x22e3a6;}var _0x5dc3f2=this[_0x8435('0x9f')](_0x8435('0xb2'),_0x8435('0xcf'));if(_0x5dc3f2['result']===-0x1){return _0x5dc3f2;}var _0x962e9=this[_0x8435('0x9f')](_0x8435('0xb4'),_0x8435('0xd0'));if(_0x962e9[_0x8435('0xa0')]===-0x1){return _0x962e9;}return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0xb5'),_0x2d1109));};AGIVertices[_0x8435('0xe')]['database']=function(_0x2cd806){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xd1'),_0x2cd806['label']));if(!this[_0x8435('0x81')](_0x2cd806[_0x8435('0xd2')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x2cd806,'no\x20database\x20selected');}var _0x5ac46b=this['getSquareOdbc']['sync'](this,_0x2cd806[_0x8435('0xd2')]);if(!_0x5ac46b){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x2cd806,_0x8435('0xd3'));}if(!this[_0x8435('0x81')](_0x2cd806[_0x8435('0xd4')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x2cd806,'no\x20query\x20configured');}var _0x1ac55e=_0x2cd806[_0x8435('0xd4')][_0x8435('0x53')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')]('query:\x20%s',_0x1ac55e));var _0x15b53e=this[_0x8435('0xd5')][_0x8435('0x6a')](this,_0x5ac46b,_0x1ac55e);this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x2cd806,_0x1ac55e);if(!this[_0x8435('0x81')](_0x2cd806[_0x8435('0xd6')])){return this['channel'][_0x8435('0xa7')](_0x8435('0xd7'));}var _0x1ce7fb=this['getVariable'][_0x8435('0x6a')](this,_0x2cd806[_0x8435('0xd6')]);if(!_0x1ce7fb){return this['channel'][_0x8435('0x2b')](_0x2cd806,_0x8435('0xd8'));}var _0x4a490c=this;_0x15b53e['forEach'](function(_0x31b14a,_0x289c3e){Object[_0x8435('0xd9')](_0x31b14a)[_0x8435('0xda')](function(_0xf92d11){_0x4a490c[_0x8435('0xb')]['setVariable'](util[_0x8435('0x28')](_0x8435('0xdb'),_0x1ce7fb,_0x289c3e,_0xf92d11),_0x31b14a[_0xf92d11]);});});this[_0x8435('0xb')][_0x8435('0x9a')](util[_0x8435('0x28')]('%s_ROWS_COUNT',_0x1ce7fb),_0x15b53e[_0x8435('0x99')]);return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0xdc'),_0x1ce7fb));};AGIVertices['prototype'][_0x8435('0xdd')]=function(_0x450baf){logger[_0x8435('0xde')](util['format'](_0x8435('0xdf'),_0x450baf[_0x8435('0xa6')]));if(!this['isConfigured'](_0x450baf[_0x8435('0xe0')])){return this[_0x8435('0xb')]['error'](_0x450baf,_0x8435('0xe1'));}var _0x5ef2bc=this['getUser'][_0x8435('0x6a')](this,_0x450baf['sip_id']);if(!_0x5ef2bc){return this[_0x8435('0xb')]['error'](_0x450baf,'no\x20user\x20found');}var _0x55b3e0=this[_0x8435('0xb')][_0x8435('0xa9')](_0x8435('0xe2'),[util[_0x8435('0x28')](_0x8435('0xe3'),_0x5ef2bc),_0x450baf[_0x8435('0x5f')],_0x450baf['opts'],_0x450baf[_0x8435('0x5e')]]);if(_0x55b3e0[_0x8435('0xa0')]===-0x1){return _0x55b3e0;}return this['channel'][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0xe4'),'DIAL'));};AGIVertices['prototype'][_0x8435('0xe5')]=function(_0x42e092){logger['info'](util[_0x8435('0x28')](_0x8435('0xe6'),_0x42e092[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x42e092['key'])){return this['channel'][_0x8435('0xa7')](_0x8435('0xe7'));}if(!this[_0x8435('0x81')](_0x42e092[_0x8435('0x77')])){return this['channel'][_0x8435('0xa7')]('no\x20text\x20configured');}this[_0x8435('0xb')][_0x8435('0xe8')]=!![];this['createSquareDetailsReport'](_0x42e092);this['createSquareMessage'](_0x42e092['text'],'in','','');this['channel'][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0xe9'),_0x42e092[_0x8435('0x77')]));var _0x1817c5=this[_0x8435('0x75')][_0x8435('0x6a')](this,_0x42e092);if(_0x1817c5){for(var _0x173735 in _0x1817c5){if(_0x1817c5['hasOwnProperty'](_0x173735)){this[_0x8435('0xb')][_0x8435('0x9a')](util[_0x8435('0x28')](_0x8435('0xea'),_0x173735['toUpperCase']()),_0x1817c5[_0x173735]);}}this['createSquareMessage'](_0x1817c5[_0x8435('0xeb')],'out','dialogflow','');return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0xec'),_0x1817c5[_0x8435('0xeb')]));}return this['channel']['error'](_0x42e092,_0x8435('0xed'));};AGIVertices[_0x8435('0xe')][_0x8435('0xee')]=function(_0x7b5172){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xef'),_0x7b5172['label']));if(!this[_0x8435('0x81')](_0x7b5172['dialogflowV2_project_id'])){return this['channel'][_0x8435('0xa7')](_0x8435('0xf0'));}if(!this[_0x8435('0x81')](_0x7b5172[_0x8435('0x7b')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xf1'));}if(!this[_0x8435('0x81')](_0x7b5172['private_key'])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xf2'));}if(!this[_0x8435('0x81')](_0x7b5172[_0x8435('0xf3')])){return this[_0x8435('0xb')]['noop'](_0x8435('0xf4'));}if(!this['isConfigured'](_0x7b5172[_0x8435('0x77')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xa8'));}this[_0x8435('0xb')][_0x8435('0xe8')]=!![];this[_0x8435('0x31')](_0x7b5172);this[_0x8435('0x3b')](_0x7b5172[_0x8435('0x77')],'in','','');this[_0x8435('0xb')]['noop'](util[_0x8435('0x28')](_0x8435('0xf5'),_0x7b5172[_0x8435('0x77')]));var _0x517877=this[_0x8435('0x79')][_0x8435('0x6a')](this,_0x7b5172);if(_0x517877){for(var _0x1e4d29 in _0x517877){if(_0x517877['hasOwnProperty'](_0x1e4d29)){if(_0x1e4d29!==_0x8435('0xf6')){this[_0x8435('0xb')][_0x8435('0x9a')](util[_0x8435('0x28')](_0x8435('0xea'),_0x1e4d29[_0x8435('0x64')]()),_0x517877[_0x1e4d29]);}}}this[_0x8435('0x3b')](_0x517877[_0x8435('0xeb')],'out',_0x8435('0xee'),_0x517877[_0x8435('0xf6')]);return this[_0x8435('0xb')][_0x8435('0xa7')](util['format']('DialogflowV2\x20Result\x20%s',_0x517877[_0x8435('0xeb')]));}return this[_0x8435('0xb')][_0x8435('0x2b')](_0x7b5172,_0x8435('0xf7'));};AGIVertices[_0x8435('0xe')][_0x8435('0xf8')]=function(_0x108e19){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0xf9'),_0x108e19[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x108e19['ndauth_url'])){return this[_0x8435('0xb')]['noop'](_0x8435('0xfa'));}if(!this[_0x8435('0x81')](_0x108e19[_0x8435('0xfb')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xfc'));}if(!this[_0x8435('0x81')](_0x108e19['password'])){return this[_0x8435('0xb')][_0x8435('0xa7')]('no\x20password\x20configured');}if(!this[_0x8435('0x81')](_0x108e19[_0x8435('0xfd')])){return this[_0x8435('0xb')]['noop']('no\x20text\x20configured');}this[_0x8435('0xb')][_0x8435('0xe8')]=!![];this[_0x8435('0x31')](_0x108e19);this[_0x8435('0x3b')](_0x108e19[_0x8435('0x77')],'in','','');this[_0x8435('0xb')][_0x8435('0xa7')](util['format'](_0x8435('0xfe'),_0x108e19['text']));var _0x93a9df=this[_0x8435('0x7d')][_0x8435('0x6a')](this,_0x108e19);if(_0x93a9df){for(var _0x20f71b in _0x93a9df){if(_0x93a9df[_0x8435('0x92')](_0x20f71b)){this['channel']['setVariable'](util[_0x8435('0x28')](_0x8435('0xff'),_0x20f71b[_0x8435('0x64')]()),_0x93a9df[_0x20f71b]);}}this[_0x8435('0x3b')](_0x93a9df[_0x8435('0xeb')],_0x8435('0x100'),_0x8435('0xf8'),'');if(_0x93a9df[_0x8435('0x101')]){this[_0x8435('0xb')][_0x8435('0xa7')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x93a9df[_0x8435('0x101')]));var _0x3fe9a4=this['channel'][_0x8435('0x102')](_0x93a9df[_0x8435('0x101')]);try{fs['unlink'](_0x93a9df[_0x8435('0x101')]+_0x8435('0x103'));}catch(_0x5357d4){logger[_0x8435('0x2b')](_0x5357d4);}return _0x3fe9a4;}else{return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x104'),_0x93a9df[_0x8435('0xeb')]));}}return this[_0x8435('0xb')][_0x8435('0x2b')](_0x108e19,_0x8435('0x105'));};AGIVertices['prototype'][_0x8435('0x106')]=function(_0x17c84d){logger[_0x8435('0x2d')](util[_0x8435('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x17c84d[_0x8435('0xa6')]));return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x106'));};AGIVertices[_0x8435('0xe')][_0x8435('0x107')]=function(_0x2d94ba){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x108'),_0x2d94ba[_0x8435('0xa6')]));var _0x52a07f='';if(_0x2d94ba[_0x8435('0x109')]){if(!this[_0x8435('0x81')](_0x2d94ba[_0x8435('0x109')])){return this[_0x8435('0xb')]['error'](_0x2d94ba,'no\x20trunk\x20selected');}else{var _0x2336a0=parseInt(_0x2d94ba['trunk_id'],0xa);if(isNaN(_0x2336a0)){_0x52a07f=_0x2d94ba[_0x8435('0x109')];}else{_0x52a07f=this['getTrunk'][_0x8435('0x6a')](this,_0x2d94ba[_0x8435('0x109')]);if(!_0x52a07f){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x2d94ba,'no\x20trunk\x20found');}}}}else if(_0x2d94ba[_0x8435('0x10a')]){_0x52a07f=_0x2d94ba[_0x8435('0x10a')];}else{return this['channel'][_0x8435('0x2b')](_0x2d94ba,_0x8435('0x10b'));}var _0x4405d1=this[_0x8435('0xb')][_0x8435('0xa9')](_0x8435('0xe2'),[util[_0x8435('0x28')](_0x8435('0x10c'),_0x52a07f,_0x2d94ba[_0x8435('0x41')]),_0x2d94ba[_0x8435('0x5f')],_0x2d94ba[_0x8435('0x10d')],_0x2d94ba[_0x8435('0x5e')]]);if(_0x4405d1[_0x8435('0xa0')]===-0x1){return _0x4405d1;}return this[_0x8435('0xb')][_0x8435('0xa7')](util['format']('Executed\x20command\x20%s',_0x8435('0xe2')));};AGIVertices[_0x8435('0xe')][_0x8435('0x10e')]=function(_0x18c6c4){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x10f'),_0x18c6c4[_0x8435('0xa6')]));return this[_0x8435('0xb')][_0x8435('0xa7')]('finally');};AGIVertices[_0x8435('0xe')][_0x8435('0x110')]=function(_0x5f532c){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x111'),_0x5f532c[_0x8435('0xa6')]));if(_0x5f532c[_0x8435('0xa3')]===0x0){return this[_0x8435('0xa2')](_0x5f532c);}_0x5f532c[_0x8435('0xa3')]-=0x1;if(!this[_0x8435('0x81')](_0x5f532c[_0x8435('0x112')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x5f532c,_0x8435('0x113'));}var _0x347d90=this['getSound']['sync'](this,_0x5f532c[_0x8435('0x112')]);if(!_0x347d90){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x5f532c,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x5f532c[_0x8435('0xd6')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x8435('0xd7'));}var _0x23aab4=this[_0x8435('0xb')][_0x8435('0x114')](_0x347d90,_0x5f532c[_0x8435('0x115')],_0x5f532c[_0x8435('0x116')]);var _0x58cce9=_0x23aab4[_0x8435('0xa0')]?_0x23aab4[_0x8435('0xa0')][_0x8435('0x46')]():'';logger[_0x8435('0x2d')](_0x8435('0x117'),JSON[_0x8435('0x6d')](_0x23aab4));if(_0x23aab4[_0x8435('0xa0')]===-0x1){this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x5f532c,_0x58cce9);return _0x23aab4;}else if(_0x23aab4[_0x8435('0x9e')]===_0x8435('0x5f')){_0x23aab4[_0x8435('0xa0')]=_0x58cce9[_0x8435('0x99')]>=parseInt(_0x5f532c['mindigit'])?'x':'i';}else{_0x23aab4[_0x8435('0xa0')]=_0x58cce9[_0x8435('0x99')]>=parseInt(_0x5f532c[_0x8435('0x118')])&&_0x58cce9[_0x8435('0x99')]<=parseInt(_0x5f532c[_0x8435('0x116')])?'x':'i';}var _0x1149f9=this[_0x8435('0xf')]['sync'](this,_0x5f532c[_0x8435('0xd6')]);if(!_0x1149f9){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x5f532c,'no\x20variable\x20found');}this['channel'][_0x8435('0x9a')](_0x1149f9,_0x58cce9);if(this['isConfigured'](_0x5f532c[_0x8435('0x119')])){var _0x5917d8=parseInt(_0x5f532c[_0x8435('0x119')],0xa);var _0x4210c3=rs['generate']({'charset':'*','length':_0x5917d8});var _0x460f5e=_0x58cce9[_0x8435('0x99')];if(_0x460f5e>0x0){if(_0x460f5e>_0x5917d8){this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x5f532c,_0x5f532c[_0x8435('0x11a')]==='first'?_0x4210c3+_0x58cce9[_0x8435('0x11b')](_0x5917d8):_0x58cce9[_0x8435('0x11b')](0x0,_0x460f5e-_0x5917d8)+_0x4210c3);}else{this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x5f532c,rs[_0x8435('0x11c')]({'charset':'*','length':_0x460f5e}));}}else{this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x5f532c,'');}}else{this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x5f532c,_0x58cce9);}return _0x23aab4;};AGIVertices[_0x8435('0xe')][_0x8435('0xa')]=function(_0x40fbd3){logger[_0x8435('0x2d')](util['format'](_0x8435('0x11d'),_0x40fbd3[_0x8435('0xa6')]));return this[_0x8435('0x110')](_0x40fbd3);};AGIVertices[_0x8435('0xe')][_0x8435('0x11e')]=function(_0x20729e){logger['info'](util['format'](_0x8435('0x11f'),_0x20729e[_0x8435('0xa6')]));this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x20729e,_0x20729e[_0x8435('0x120')]);return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x121'),_0x20729e[_0x8435('0x120')]));};AGIVertices[_0x8435('0xe')][_0x8435('0x122')]=function(_0x315638){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x123'),_0x315638[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x315638[_0x8435('0x83')])||!this[_0x8435('0x81')](_0x315638[_0x8435('0x84')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x124'));}if(!this[_0x8435('0x81')](_0x315638[_0x8435('0x77')])){return this['channel'][_0x8435('0xa7')](_0x8435('0xa8'));}this[_0x8435('0xb')][_0x8435('0xa7')](util['format'](_0x8435('0x125'),_0x315638[_0x8435('0x77')]));var _0x3729a5=this[_0x8435('0x82')][_0x8435('0x6a')](this,_0x315638);if(_0x3729a5){this[_0x8435('0xb')]['noop'](util[_0x8435('0x28')](_0x8435('0x126'),_0x3729a5));var _0x323a45=this['channel']['streamFile'](_0x3729a5);try{fs[_0x8435('0x127')](_0x3729a5+_0x8435('0x103'));}catch(_0x399763){logger[_0x8435('0x2b')](_0x399763);}return _0x323a45;}return this[_0x8435('0xb')][_0x8435('0x2b')](_0x315638,_0x8435('0x128'));};AGIVertices[_0x8435('0xe')][_0x8435('0x129')]=function(_0x5ecd5a){logger['info'](util[_0x8435('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5ecd5a[_0x8435('0xa6')]));if(!this['isConfigured'](_0x5ecd5a[_0x8435('0x83')])||!this[_0x8435('0x81')](_0x5ecd5a[_0x8435('0x84')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x124'));}if(!this['isConfigured'](_0x5ecd5a[_0x8435('0x8b')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x12a'));}if(!this[_0x8435('0x81')](_0x5ecd5a[_0x8435('0x77')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xa8'));}this[_0x8435('0xb')]['bot']=!![];this['createSquareDetailsReport'](_0x5ecd5a);this['createSquareMessage'](_0x5ecd5a[_0x8435('0x77')],'in','','');this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x12b'),_0x5ecd5a['text']));var _0x7639bb=this[_0x8435('0x89')]['sync'](this,_0x5ecd5a);if(_0x7639bb){for(var _0xa05cd in _0x7639bb){if(_0x7639bb[_0x8435('0x92')](_0xa05cd)&&_['isString'](_0x7639bb[_0xa05cd])){this['channel']['setVariable'](util[_0x8435('0x28')](_0x8435('0x12c'),_0xa05cd['toUpperCase']()),_0x7639bb[_0xa05cd]);}}if(_['isNil'](_0x7639bb['message'])){return this['channel'][_0x8435('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x7639bb['message'],_0x8435('0x100'),_0x8435('0x12d'),'');return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x12e'),_0x7639bb[_0x8435('0x72')]));}}return this[_0x8435('0xb')][_0x8435('0x2b')](_0x5ecd5a,_0x8435('0x12f'));};AGIVertices['prototype']['googleasr']=function(_0x52378d){logger['info'](util[_0x8435('0x28')](_0x8435('0x130'),_0x52378d[_0x8435('0xa6')],_0x52378d[_0x8435('0x5f')]));if(!this[_0x8435('0x81')](_0x52378d[_0x8435('0x76')])){return this[_0x8435('0xb')]['noop'](_0x8435('0xe7'));}var _0x11845b=_0x8435('0x131');var _0x4a3652=util[_0x8435('0x28')](_0x8435('0x132'),FILES_PATH,rs[_0x8435('0x11c')](0x4));var _0x268fe7=util[_0x8435('0x28')](_0x8435('0x98'),_0x4a3652,_0x11845b);var _0x2b1d83=!![];if(_0x52378d['beep']===_0x8435('0x133')){_0x2b1d83=![];}var _0x5c34f8=this[_0x8435('0xb')][_0x8435('0x134')](_0x4a3652,_0x11845b,_0x52378d[_0x8435('0x135')],_0x52378d[_0x8435('0x5f')],undefined,_0x2b1d83);if(_0x5c34f8[_0x8435('0xa0')]!==-0x1){this[_0x8435('0xb')][_0x8435('0xa7')](util['format'](_0x8435('0x136'),_0x268fe7));var _0x27dfd4=this[_0x8435('0x8c')][_0x8435('0x6a')](this,_0x52378d,_0x268fe7);if(_0x27dfd4){for(var _0x423409 in _0x27dfd4){if(_0x27dfd4[_0x8435('0x92')](_0x423409)){this[_0x8435('0xb')][_0x8435('0x9a')](util[_0x8435('0x28')](_0x8435('0x137'),_0x423409[_0x8435('0x64')]()),_0x27dfd4[_0x423409]);}}return this['channel'][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x138'),JSON[_0x8435('0x6d')](_0x27dfd4)));}}return _0x5c34f8;};AGIVertices[_0x8435('0xe')][_0x8435('0x139')]=function(_0x4b6f39){logger[_0x8435('0x2d')](util[_0x8435('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4b6f39[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x4b6f39[_0x8435('0x8f')])){return this[_0x8435('0xb')][_0x8435('0xa7')]('no\x20appid\x20configured');}if(!this[_0x8435('0x81')](_0x4b6f39['appsecret'])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x210758=_0x8435('0x131');var _0x56a97d=util[_0x8435('0x28')](_0x8435('0x132'),FILES_PATH,rs[_0x8435('0x11c')](0x4));var _0x2866e0=util[_0x8435('0x28')](_0x8435('0x98'),_0x56a97d,_0x210758);var _0xfe9a34=!![];if(_0x4b6f39[_0x8435('0x13a')]===_0x8435('0x133')){_0xfe9a34=![];}var _0x3f9101=this[_0x8435('0xb')][_0x8435('0x134')](_0x56a97d,_0x210758,_0x4b6f39[_0x8435('0x135')],_0x4b6f39[_0x8435('0x5f')],undefined,_0xfe9a34);if(_0x3f9101['result']!==-0x1){this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x13b'),_0x2866e0));var _0x4a8434=this[_0x8435('0x8e')][_0x8435('0x6a')](this,_0x4b6f39,_0x2866e0);if(_0x4a8434){for(var _0xbeac54 in _0x4a8434){if(_0x4a8434['hasOwnProperty'](_0xbeac54)){this[_0x8435('0xb')]['setVariable'](util[_0x8435('0x28')](_0x8435('0x13c'),_0xbeac54[_0x8435('0x64')]()),_0x4a8434[_0xbeac54]);}}return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x13d'),JSON[_0x8435('0x6d')](_0x4a8434)));}}return _0x3f9101;};AGIVertices[_0x8435('0xe')]['gotoc']=function(_0x52dc5f){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x13e'),_0x52dc5f[_0x8435('0xa6')]));return this[_0x8435('0xb')][_0x8435('0x13f')](_0x52dc5f[_0x8435('0x37')],_0x52dc5f[_0x8435('0x38')],_0x52dc5f[_0x8435('0x140')]);};AGIVertices[_0x8435('0xe')][_0x8435('0x141')]=function(_0x1afafb){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x142'),_0x1afafb[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x1afafb['condition'])){return this[_0x8435('0xb')]['error'](_0x1afafb,_0x8435('0x143'));}try{var _0x3bb516=eval(_0x1afafb[_0x8435('0x144')])?'true':'false';this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x145'),_0x1afafb[_0x8435('0x144')],_0x3bb516));return{'code':0xc8,'result':_0x3bb516};}catch(_0x837bd8){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x8435('0x146')]=function(_0x29a80){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x147'),_0x29a80['label']));if(!this['isConfigured'](_0x29a80[_0x8435('0x148')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x29a80,_0x8435('0x149'));}var _0x46e938=this['getIntervals']['sync'](this,_0x29a80[_0x8435('0x148')]);if(!_0x46e938){return this['channel'][_0x8435('0x2b')](_0x29a80,'no\x20intervals\x20found');}for(var _0x36fbdd=0x0;_0x36fbdd<_0x46e938[_0x8435('0x99')];_0x36fbdd+=0x1){var _0x45ed5c=this[_0x8435('0xb')]['getVariable'](util[_0x8435('0x28')]('IFTIME(%s?true:false)',_0x46e938[_0x36fbdd]));if(_0x45ed5c[_0x8435('0xa0')]===-0x1){return _0x45ed5c;}logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x14a'),_0x46e938[_0x36fbdd],_0x45ed5c[_0x8435('0x9e')]));if(_0x45ed5c[_0x8435('0x9e')]===_0x8435('0x14b')){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x14a'),_0x46e938[_0x36fbdd],_0x8435('0x14b')));this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x14a'),_0x46e938[_0x36fbdd],_0x8435('0x14b')));return{'code':0xc8,'result':_0x8435('0x14b')};}else{logger['info'](util[_0x8435('0x28')]('IFTIME\x20%s\x20%s',_0x46e938[_0x36fbdd],'false'));this[_0x8435('0xb')][_0x8435('0xa7')](util['format'](_0x8435('0x14a'),_0x46e938[_0x36fbdd],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x8435('0xe')][_0x8435('0x14c')]=function(_0x34af62){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x14d'),_0x34af62[_0x8435('0xa6')]));return this[_0x8435('0xb')][_0x8435('0x14c')]();};AGIVertices[_0x8435('0xe')][_0x8435('0x14e')]=function(_0x247351){logger['info'](util[_0x8435('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x247351[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x247351[_0x8435('0x76')])){return this['channel'][_0x8435('0xa7')]('no\x20key\x20configured');}var _0x4c1adc=_0x8435('0x131');var _0x46734c=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x8435('0x11c')](0x4));var _0x59d8f8=util[_0x8435('0x28')](_0x8435('0x98'),_0x46734c,_0x4c1adc);var _0x3b3d40=!![];if(_0x247351[_0x8435('0x13a')]===_0x8435('0x133')){_0x3b3d40=![];}var _0x53dd74=this[_0x8435('0xb')][_0x8435('0x134')](_0x46734c,_0x4c1adc,_0x247351[_0x8435('0x135')],_0x247351['timeout'],undefined,_0x3b3d40);if(_0x53dd74[_0x8435('0xa0')]!==-0x1){this[_0x8435('0xb')]['noop'](util[_0x8435('0x28')](_0x8435('0x14f'),_0x59d8f8));var _0x2a8f6d=this[_0x8435('0x7f')][_0x8435('0x6a')](this,_0x247351,_0x59d8f8);if(_0x2a8f6d){for(var _0x157d36 in _0x2a8f6d){if(_0x2a8f6d['hasOwnProperty'](_0x157d36)){this[_0x8435('0xb')][_0x8435('0x9a')](util[_0x8435('0x28')]('ISPEECH_ASR_%s',_0x157d36[_0x8435('0x64')]()),_0x2a8f6d[_0x157d36]);}}return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')]('IspeechASR\x20Result\x20%s',JSON[_0x8435('0x6d')](_0x2a8f6d)));}}return _0x53dd74;};AGIVertices[_0x8435('0xe')][_0x8435('0x150')]=function(_0x4b1f5c){logger[_0x8435('0x2d')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4b1f5c[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x4b1f5c['key'])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xe7'));}if(!this[_0x8435('0x81')](_0x4b1f5c[_0x8435('0x77')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xa8'));}this['channel'][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x151'),_0x4b1f5c[_0x8435('0x77')]));var _0x4cef80=this[_0x8435('0x152')][_0x8435('0x6a')](this,_0x4b1f5c);if(_0x4cef80){this['channel'][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x14f'),_0x4cef80));var _0x3e0181=this[_0x8435('0xb')][_0x8435('0x102')](_0x4cef80,_0x4b1f5c['intKey']);try{fs['unlink'](_0x4cef80+_0x8435('0x103'));}catch(_0x413a28){logger[_0x8435('0x2b')](_0x413a28);}return _0x3e0181;}return this['channel']['error'](_0x4b1f5c,_0x8435('0x153'));};AGIVertices['prototype'][_0x8435('0x154')]=function(_0x183fce){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x155'),_0x183fce[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x183fce[_0x8435('0x156')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x183fce,_0x8435('0x157'));}logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x158'),this[_0x8435('0xb')]['callerid'],_0x183fce[_0x8435('0x156')]));var _0x4a092b=this[_0x8435('0x50')][_0x8435('0x6a')](this,_0x183fce[_0x8435('0x156')]);if(_0x4a092b){logger['info'](util[_0x8435('0x28')](_0x8435('0x159'),this[_0x8435('0xb')][_0x8435('0x34')],_0x183fce[_0x8435('0x156')]));this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x159'),this[_0x8435('0xb')]['callerid'],_0x183fce[_0x8435('0x156')]));return{'code':0xc8,'result':_0x8435('0x15a')};}else{logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x15b'),this[_0x8435('0xb')]['callerid'],_0x183fce[_0x8435('0x156')]));this['channel']['noop'](util[_0x8435('0x28')](_0x8435('0x15b'),this[_0x8435('0xb')][_0x8435('0x34')],_0x183fce['findBy']));return{'code':0xc8,'result':_0x8435('0x15c')};}};AGIVertices[_0x8435('0xe')][_0x8435('0x15d')]=function(_0x54adc7){logger[_0x8435('0x2d')](util[_0x8435('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x54adc7['label']));if(!this['isConfigured'](_0x54adc7['findBy'])){return this['channel'][_0x8435('0x2b')](_0x54adc7,_0x8435('0x157'));}logger[_0x8435('0x2d')](util['format'](_0x8435('0x158'),this['channel'][_0x8435('0x34')],_0x54adc7[_0x8435('0x156')]));var _0x546de8=this[_0x8435('0x4c')][_0x8435('0x6a')](this,_0x54adc7[_0x8435('0x156')]);if(_0x546de8){logger['info'](util[_0x8435('0x28')](_0x8435('0x159'),this[_0x8435('0xb')][_0x8435('0x34')],_0x54adc7[_0x8435('0x156')]));this[_0x8435('0xb')][_0x8435('0xa7')](util['format'](_0x8435('0x159'),this[_0x8435('0xb')][_0x8435('0x34')],_0x54adc7[_0x8435('0x156')]));return{'code':0xc8,'result':_0x8435('0x15a')};}else{logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x15b'),this[_0x8435('0xb')][_0x8435('0x34')],_0x54adc7['findBy']));this[_0x8435('0xb')]['noop'](util[_0x8435('0x28')](_0x8435('0x15b'),this[_0x8435('0xb')][_0x8435('0x34')],_0x54adc7[_0x8435('0x156')]));return{'code':0xc8,'result':_0x8435('0x15c')};}};AGIVertices[_0x8435('0xe')][_0x8435('0x15e')]=function(_0x20115b){logger[_0x8435('0x2d')](util[_0x8435('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x20115b['label']));if(!this['isConfigured'](_0x20115b[_0x8435('0x15f')])){return this['channel'][_0x8435('0x2b')](_0x20115b,_0x8435('0x160'));}this[_0x8435('0xb')]['noop'](util[_0x8435('0x28')](_0x8435('0x161'),_0x20115b[_0x8435('0x15f')]));var _0x52a021=eval(_0x20115b[_0x8435('0x15f')]);if(!this[_0x8435('0x81')](_0x20115b[_0x8435('0xd6')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xd7'));}var _0x1f5281=this[_0x8435('0xf')][_0x8435('0x6a')](this,_0x20115b['variable_id']);if(!_0x1f5281){return this[_0x8435('0xb')]['error'](_0x20115b,_0x8435('0xd8'));}if(_[_0x8435('0x162')](_0x52a021)){var _0x350360=this;_0x52a021[_0x8435('0xda')](function(_0x29d852,_0x539022){_0x350360['channel'][_0x8435('0x9a')](util['format'](_0x8435('0x163'),_0x1f5281,_0x539022),_0x29d852);});return this[_0x8435('0xb')][_0x8435('0xa7')](util['format'](_0x8435('0x164'),_0x1f5281));}else{return this[_0x8435('0xb')][_0x8435('0x9a')](_0x1f5281,_0x52a021);}};AGIVertices['prototype']['menu']=function(_0x527fad){logger[_0x8435('0x2d')](util[_0x8435('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x527fad[_0x8435('0xa6')]));if(_0x527fad[_0x8435('0xa3')]===0x0){return this[_0x8435('0xa2')](_0x527fad);}_0x527fad['retry']-=0x1;if(!this[_0x8435('0x81')](_0x527fad[_0x8435('0x112')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x527fad,_0x8435('0x113'));}var _0xbb4749=this['getSound'][_0x8435('0x6a')](this,_0x527fad['file_id']);if(!_0xbb4749){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x527fad,_0x8435('0x165'));}var _0x2b34dc=this[_0x8435('0xb')][_0x8435('0x114')](_0xbb4749,_0x527fad['response'],_0x527fad[_0x8435('0x166')]);var _0x3db995=_0x2b34dc[_0x8435('0xa0')];if(_0x2b34dc['result']===-0x1){this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x527fad,'-1');return _0x2b34dc;}else if(_0x2b34dc[_0x8435('0x9e')]===_0x8435('0x5f')){_0x2b34dc['result']=_0x2b34dc['result'][_0x8435('0x99')]>0x0?_0x2b34dc['result']:'t';}else if(_[_0x8435('0x3d')](_0x2b34dc[_0x8435('0xa0')])){_0x2b34dc[_0x8435('0xa0')]='#';_0x3db995='#';}if(!this[_0x8435('0x81')](_0x527fad['variable_id'])){this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0xd7'));}else{var _0x4b0720=this[_0x8435('0xf')][_0x8435('0x6a')](this,_0x527fad[_0x8435('0xd6')]);if(!_0x4b0720){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x527fad,_0x8435('0xd8'));}this[_0x8435('0xb')]['setVariable'](_0x4b0720,_0x3db995);}this[_0x8435('0x31')]['sync'](this,_0x527fad,_0x3db995);return _0x2b34dc;};AGIVertices[_0x8435('0xe')][_0x8435('0xa7')]=function(_0x415030){logger[_0x8435('0x2d')](util['format'](_0x8435('0x167'),_0x415030[_0x8435('0xa6')]));return this['channel'][_0x8435('0xa7')](_0x415030['output']||_0x415030[_0x8435('0xa6')]);};AGIVertices[_0x8435('0xe')][_0x8435('0x168')]=function(_0x5ecc29){logger[_0x8435('0x2d')](util['format'](_0x8435('0x169'),_0x5ecc29[_0x8435('0xa6')]));if(!this['isConfigured'](_0x5ecc29[_0x8435('0x156')])){return this[_0x8435('0xb')]['error'](_0x5ecc29,_0x8435('0x157'));}logger[_0x8435('0x2d')](util['format'](_0x8435('0x158'),this['channel'][_0x8435('0x34')],_0x5ecc29[_0x8435('0x156')]));var _0x1da168=this[_0x8435('0x16a')][_0x8435('0x6a')](this,_0x5ecc29['pause_id']);var _0x5b7c13=this[_0x8435('0x49')][_0x8435('0x6a')](this,_0x5ecc29[_0x8435('0x156')],_0x1da168);if(_0x5b7c13){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x159'),this[_0x8435('0xb')]['callerid'],_0x5ecc29[_0x8435('0x156')]));this['channel']['noop'](util[_0x8435('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8435('0x34')],_0x5ecc29[_0x8435('0x156')]));return{'code':0xc8,'result':_0x8435('0x15a')};}else{logger[_0x8435('0x2d')](util[_0x8435('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8435('0x34')],_0x5ecc29[_0x8435('0x156')]));this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x159'),this['channel'][_0x8435('0x34')],_0x5ecc29[_0x8435('0x156')]));return{'code':0xc8,'result':_0x8435('0x15c')};}};AGIVertices[_0x8435('0xe')][_0x8435('0x16b')]=function(_0x3b6f2e){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x16c'),_0x3b6f2e[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x3b6f2e[_0x8435('0x112')])){return this[_0x8435('0xb')]['error'](_0x3b6f2e,_0x8435('0x113'));}var _0x183e67=this[_0x8435('0x1c')][_0x8435('0x6a')](this,_0x3b6f2e[_0x8435('0x112')]);if(!_0x183e67){return this['channel']['error'](_0x3b6f2e,_0x8435('0x165'));}var _0x48c0df=this[_0x8435('0xb')][_0x8435('0xa9')](_0x8435('0x16d'),[_0x183e67,_0x3b6f2e[_0x8435('0x10d')]]);if(_0x48c0df[_0x8435('0xa0')]===-0x1){return _0x48c0df;}return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')]('Executed\x20command\x20%s\x20%s',_0x8435('0x16d'),_0x183e67));};AGIVertices['prototype'][_0x8435('0x16e')]=function(_0x2bdc4a){logger['info'](util[_0x8435('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2bdc4a[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x2bdc4a['queue_id'])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x2bdc4a,'no\x20queue\x20selected');}var _0x2984ba='';var _0x4d798d=parseInt(_0x2bdc4a[_0x8435('0x16f')],0xa);if(isNaN(_0x4d798d)){_0x2984ba=_0x2bdc4a['queue_id'];}else{_0x2984ba=this[_0x8435('0x170')][_0x8435('0x6a')](this,_0x2bdc4a[_0x8435('0x16f')]);if(!_0x2984ba){return this['channel'][_0x8435('0x2b')](_0x2bdc4a,_0x8435('0x171'));}}var _0x4c73a8='';if(this[_0x8435('0x81')](_0x2bdc4a['file_id'])){var _0x2b8196=this['getSound']['sync'](this,_0x2bdc4a[_0x8435('0x112')]);if(_0x2b8196){_0x4c73a8=_0x2b8196;}}this['createSquareDetailsReport'][_0x8435('0x6a')](this,_0x2bdc4a,_0x2984ba);if(_0x2bdc4a[_0x8435('0x10d')][_0x8435('0x172')]('x')<0x0){_0x2bdc4a[_0x8435('0x10d')]+='x';}if(_0x2bdc4a[_0x8435('0x10d')][_0x8435('0x172')]('X')<0x0){_0x2bdc4a[_0x8435('0x10d')]+='X';}this[_0x8435('0xb')][_0x8435('0x9a')](_0x8435('0x173'),_0x2984ba?_0x2984ba[_0x8435('0x174')]():'');var _0x368357=this['channel'][_0x8435('0xa9')](_0x8435('0x175'),[_0x2984ba,_0x2bdc4a[_0x8435('0x10d')],_0x2bdc4a['url'],_0x4c73a8,_0x2bdc4a[_0x8435('0x5f')],_0x2bdc4a[_0x8435('0x5')],_0x2bdc4a[_0x8435('0x176')],_0x2bdc4a[_0x8435('0x177')],'',_0x2bdc4a[_0x8435('0x178')]]);if(_0x368357[_0x8435('0xa0')]===-0x1){return _0x368357;}return this['channel'][_0x8435('0xa7')](util['format'](_0x8435('0xc5'),_0x8435('0x175'),_0x2984ba));};AGIVertices[_0x8435('0xe')]['record']=function(_0xe93f46){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0xe93f46[_0x8435('0xa6')]));var _0x24b0fb=_0xe93f46[_0x8435('0x179')]||_0x8435('0x131');var _0x5e7314=util[_0x8435('0x28')]('%s_%s',this[_0x8435('0xb')][_0x8435('0x32')],rs['generate'](0x5));var _0x308be8=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x5e7314,_0x24b0fb);var _0x40069f=util[_0x8435('0x28')](_0x8435('0x132'),FILES_PATH,_0x5e7314);this['createSquareRecording'][_0x8435('0x6a')](this,_0xe93f46,_0x5e7314,_0x308be8);this['channel'][_0x8435('0x9a')]('RECORDING_SAVENAME',_0x5e7314);logger[_0x8435('0x2d')](_0x8435('0x17a'),_0x40069f,_0x24b0fb,_0xe93f46['escape_digits'],_0xe93f46[_0x8435('0x5f')]);return this[_0x8435('0xb')]['recordFile'](_0x40069f,_0x24b0fb,_0xe93f46[_0x8435('0x17b')],_0xe93f46['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x8435('0x17c')]=function(_0x21aa82){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x17d'),_0x21aa82[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x21aa82[_0x8435('0x5e')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x17e'));}var _0x26c9ab=this['restAPI']['sync'](this,_0x21aa82);logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x17f'),util[_0x8435('0x180')](_0x26c9ab,{'showHidden':![],'depth':null})));if(!this[_0x8435('0x81')](_0x21aa82[_0x8435('0xd6')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x181'));}var _0x509b1a=this[_0x8435('0xf')]['sync'](this,_0x21aa82[_0x8435('0xd6')]);if(!_0x509b1a){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x21aa82,_0x8435('0xd8'));}this[_0x8435('0xb')][_0x8435('0x9a')](util[_0x8435('0x28')](_0x8435('0x182'),_0x509b1a),_0x26c9ab[_0x8435('0x70')]?_0x26c9ab[_0x8435('0x70')]:'200');this[_0x8435('0xb')][_0x8435('0x9a')](util[_0x8435('0x28')](_0x8435('0x183'),_0x509b1a),_0x26c9ab['statusMessage']?_0x26c9ab[_0x8435('0x71')]:'OK');if(_0x26c9ab['body']){try{this[_0x8435('0x97')](_0x26c9ab['body'],_0x509b1a);}catch(_0x59814b){logger[_0x8435('0x2b')](util[_0x8435('0x28')](_0x8435('0x184'),_0x509b1a));}}return this[_0x8435('0xb')][_0x8435('0xa7')](util['format'](_0x8435('0xdc'),_0x509b1a));};AGIVertices['prototype']['saydigits']=function(_0x116c46){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x185'),_0x116c46[_0x8435('0xa6')]));return this['channel'][_0x8435('0x186')](_0x116c46[_0x8435('0x187')]['replace'](/\s+/g,''),_0x116c46[_0x8435('0x17b')]);};AGIVertices[_0x8435('0xe')][_0x8435('0x188')]=function(_0x323e90){logger['info'](util[_0x8435('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x323e90[_0x8435('0xa6')]));return this[_0x8435('0xb')]['sayNumber'](_0x323e90['number'][_0x8435('0x53')](/\s+/g,''),_0x323e90['escape_digits']);};AGIVertices[_0x8435('0xe')][_0x8435('0x189')]=function(_0x44dd64){logger[_0x8435('0x2d')](util['format'](_0x8435('0x18a'),_0x44dd64[_0x8435('0xa6')]));return this['channel'][_0x8435('0x18b')](_0x44dd64['text'],_0x44dd64['escape_digits']);};AGIVertices['prototype'][_0x8435('0x18c')]=function(_0x45a149){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x18d'),_0x45a149[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x45a149[_0x8435('0x18e')])){return this['channel'][_0x8435('0xa7')](_0x8435('0x18f'));}var _0x55c3c1=this['getMailAccount'][_0x8435('0x6a')](this,_0x45a149[_0x8435('0x18e')]);if(!_0x55c3c1||!_0x55c3c1[_0x8435('0x190')]){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x45a149,_0x8435('0x191'));}var _0x375304={'from':util[_0x8435('0x28')]('\x22%s\x22\x20<%s>',_0x55c3c1['name'],_0x55c3c1[_0x8435('0x192')]||_0x55c3c1['Smtp']['user']),'to':_0x45a149['to']||'','cc':_0x45a149['cc']||'','bcc':_0x45a149[_0x8435('0x193')]||'','subject':_0x45a149[_0x8435('0x194')],'html':_0x45a149[_0x8435('0x77')],'text':_0x45a149[_0x8435('0x77')]};var _0x20f358={'tls':{'rejectUnauthorized':![]}};if(_0x55c3c1[_0x8435('0x190')][_0x8435('0x195')]){_0x20f358[_0x8435('0x195')]=_0x55c3c1[_0x8435('0x190')][_0x8435('0x195')];}else{_0x20f358[_0x8435('0x196')]=_0x55c3c1[_0x8435('0x190')][_0x8435('0x196')];_0x20f358[_0x8435('0x197')]=_0x55c3c1[_0x8435('0x190')][_0x8435('0x197')];_0x20f358[_0x8435('0x198')]=_0x55c3c1['Smtp'][_0x8435('0x198')];}if(_0x55c3c1[_0x8435('0x190')][_0x8435('0x199')]){_0x20f358[_0x8435('0x19a')]={'user':_0x55c3c1[_0x8435('0x190')]['user'],'pass':_0x55c3c1['Smtp'][_0x8435('0x19b')]};}if(this[_0x8435('0x81')](_0x45a149[_0x8435('0x19c')])){}logger[_0x8435('0xde')](_0x8435('0x19d'),JSON[_0x8435('0x6d')](_0x375304));this['createSquareDetailsReport'][_0x8435('0x6a')](this,_0x45a149,_0x45a149[_0x8435('0x18e')]);this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x19e'),_0x55c3c1[_0x8435('0x15')]));this['sendMailMessage'][_0x8435('0x6a')](this,_0x20f358,_0x375304);return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x19f'));};AGIVertices['prototype'][_0x8435('0x1a0')]=function(_0x1bbd1e){logger[_0x8435('0x2d')](util['format'](_0x8435('0x1a1'),_0x1bbd1e[_0x8435('0xa6')]));return this[_0x8435('0xb')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x8435('0x1a2')]=function(_0x2395c6){logger[_0x8435('0x2d')](util[_0x8435('0x28')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2395c6[_0x8435('0xa6')]));if(!this['isConfigured'](_0x2395c6[_0x8435('0x1a3')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x1a4'));}var _0x276065=this[_0x8435('0x1a5')]['sync'](this,_0x2395c6[_0x8435('0x1a3')]);if(!_0x276065){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x2395c6,_0x8435('0x1a6'));}var _0xef124c={'body':_0x2395c6[_0x8435('0x1a7')],'phone':_0x2395c6['to']||'','SmsAccountId':_0x276065['id']};logger[_0x8435('0xde')](_0x8435('0x1a8'),JSON[_0x8435('0x6d')](_0xef124c));this['createSquareDetailsReport'][_0x8435('0x6a')](this,_0x2395c6,_0x2395c6['sms_account_id']);this['channel']['noop'](util[_0x8435('0x28')](_0x8435('0x1a9'),_0x276065[_0x8435('0x15')]));this[_0x8435('0x30')][_0x8435('0x6a')](this,_0xef124c);return this['channel'][_0x8435('0xa7')](_0x8435('0x1aa'));};AGIVertices['prototype'][_0x8435('0x1ab')]=function(_0x151f40){logger['info'](util['format'](_0x8435('0x1ac'),_0x151f40[_0x8435('0xa6')]));if(!this['isConfigured'](_0x151f40[_0x8435('0xd6')])){return this[_0x8435('0xb')]['error'](_0x151f40,_0x8435('0x1ad'));}var _0x406c7b=this['getVariable'][_0x8435('0x6a')](this,_0x151f40[_0x8435('0xd6')]);if(!_0x406c7b){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x151f40,_0x8435('0xd8'));}return this['channel'][_0x8435('0x9a')](_0x406c7b,_0x151f40[_0x8435('0x1ae')]);};AGIVertices[_0x8435('0xe')]['start']=function(_0x120f01){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x1af'),_0x120f01['label']));this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x1b0'));if(_0x120f01[_0x8435('0xbb')]===_0x8435('0x1b1')){this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x1b2'));return this[_0x8435('0xb')][_0x8435('0xbb')]();}return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x1b3'));};AGIVertices[_0x8435('0xe')]['subproject']=function(_0x2e79ea){logger['info'](util[_0x8435('0x28')](_0x8435('0x1b4'),_0x2e79ea[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0x2e79ea[_0x8435('0x1b5')])){return this['channel'][_0x8435('0x2b')](_0x2e79ea,'no\x20subproject\x20selected');}var _0x4fad3b=this[_0x8435('0x14')][_0x8435('0x6a')](this,_0x2e79ea[_0x8435('0x1b5')]);if(!this[_0x8435('0x81')](_0x4fad3b)){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x2e79ea,util[_0x8435('0x28')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2e79ea[_0x8435('0x1b5')]));}if(_0x4fad3b===this[_0x8435('0xb')][_0x8435('0x33')]){return this[_0x8435('0xb')]['error'](_0x2e79ea,_0x8435('0x1b6'));}this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x2e79ea,_0x4fad3b);var _0x1f5d15=this[_0x8435('0xb')][_0x8435('0xa9')]('AGI',util['format'](_0x8435('0x1b7'),config[_0x8435('0x5')][_0x8435('0x196')]||_0x8435('0x1b8'),_0x4fad3b,this[_0x8435('0xb')]['arg_1']));if(_0x1f5d15[_0x8435('0xa0')]===-0x1){return _0x1f5d15;}return this['channel'][_0x8435('0xa7')](util['format'](_0x8435('0xc5'),_0x8435('0x1b9'),_0x4fad3b));};AGIVertices['prototype'][_0x8435('0x1ba')]=function(_0x4840f9){logger[_0x8435('0x2d')](util['format'](_0x8435('0x1bb'),_0x4840f9[_0x8435('0xa6')]));var _0x5a3651=this[_0x8435('0x51')][_0x8435('0x6a')](this,_0x4840f9[_0x8435('0xb7')]);this[_0x8435('0x31')][_0x8435('0x6a')](this,_0x4840f9,_0x4840f9[_0x8435('0xb7')]);if(this['isConfigured'](_0x4840f9['variable_id'])){var _0x4fbd73=this[_0x8435('0xf')]['sync'](this,_0x4840f9['variable_id']);if(_0x4fbd73){this[_0x8435('0xb')]['setVariable'](_0x4fbd73,_0x5a3651);return this['channel']['noop'](util[_0x8435('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4840f9['command'],_0x4fbd73));}}return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4840f9['command']));};AGIVertices[_0x8435('0xe')][_0x8435('0x1bc')]=function(_0x2a56bc){logger['info'](util[_0x8435('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2a56bc['label']));_0x2a56bc[_0x8435('0x77')]=_0x2a56bc['text'][_0x8435('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8435('0x81')](_0x2a56bc[_0x8435('0x55')])){return this[_0x8435('0xb')][_0x8435('0xa7')](_0x8435('0x1bd'));}if(!this[_0x8435('0x81')](_0x2a56bc['text'])){return this['channel'][_0x8435('0xa7')](_0x8435('0xa8'));}this[_0x8435('0xb')]['noop'](util[_0x8435('0x28')](_0x8435('0x1be'),_0x2a56bc['text']));var _0x5a0eb8=this[_0x8435('0x54')]['sync'](this,_0x2a56bc);if(_0x5a0eb8){this['channel']['noop'](util['format'](_0x8435('0x1bf'),_0x5a0eb8));var _0x12555b=this[_0x8435('0xb')]['streamFile'](_0x5a0eb8);try{fs[_0x8435('0x127')](_0x5a0eb8+_0x8435('0x103'));}catch(_0x2cdcb4){logger[_0x8435('0x2b')](_0x2cdcb4);}return _0x12555b;}return this[_0x8435('0xb')][_0x8435('0x2b')](_0x2a56bc,_0x8435('0x1c0'));};AGIVertices[_0x8435('0xe')][_0x8435('0x1c1')]=function(_0x594e03){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x1c2'),_0x594e03['label']));_0x594e03[_0x8435('0x77')]=_0x594e03[_0x8435('0x77')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x594e03['text'])){return this['channel'][_0x8435('0xa7')]('no\x20text\x20configured');}this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x1c3'),_0x594e03[_0x8435('0x77')]));var _0x50f479=this[_0x8435('0x5b')]['sync'](this,_0x594e03);if(_0x50f479){this['channel']['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x50f479));var _0x3ddb32=this[_0x8435('0xb')][_0x8435('0x102')](_0x50f479);try{fs['unlink'](_0x50f479+_0x8435('0x103'));}catch(_0x5b74eb){logger['error'](_0x5b74eb);}return _0x3ddb32;}return this[_0x8435('0xb')][_0x8435('0x2b')](_0x594e03,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8435('0xe')]['unpause']=function(_0xd3e90d){logger[_0x8435('0x2d')](util[_0x8435('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0xd3e90d[_0x8435('0xa6')]));if(!this[_0x8435('0x81')](_0xd3e90d[_0x8435('0x156')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0xd3e90d,'no\x20find\x20by\x20configured');}logger[_0x8435('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8435('0xb')][_0x8435('0x34')],_0xd3e90d[_0x8435('0x156')]));var _0x426453=this[_0x8435('0x4a')]['sync'](this,_0xd3e90d['findBy']);if(_0x426453){logger[_0x8435('0x2d')](util[_0x8435('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8435('0xb')]['callerid'],_0xd3e90d[_0x8435('0x156')]));this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x159'),this['channel'][_0x8435('0x34')],_0xd3e90d[_0x8435('0x156')]));return{'code':0xc8,'result':_0x8435('0x15a')};}else{logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x15b'),this[_0x8435('0xb')][_0x8435('0x34')],_0xd3e90d[_0x8435('0x156')]));this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0x15b'),this[_0x8435('0xb')][_0x8435('0x34')],_0xd3e90d[_0x8435('0x156')]));return{'code':0xc8,'result':_0x8435('0x15c')};}};AGIVertices['prototype'][_0x8435('0x1c4')]=function(_0x558c84){logger[_0x8435('0x2d')](util['format'](_0x8435('0x1c5'),_0x558c84[_0x8435('0xa6')]));var _0x1b7175=this[_0x8435('0xb')][_0x8435('0xa9')]('VOICEMAIL',[_0x558c84['mailbox'],_0x558c84[_0x8435('0x74')]]);if(_0x1b7175[_0x8435('0xa0')]===-0x1){return _0x1b7175;}return this[_0x8435('0xb')][_0x8435('0xa7')](util[_0x8435('0x28')](_0x8435('0xc5'),'VOICEMAIL',_0x558c84[_0x8435('0x1c6')]));};AGIVertices[_0x8435('0xe')][_0x8435('0x1c7')]=function(_0x34525d){logger[_0x8435('0x2d')](util[_0x8435('0x28')](_0x8435('0x1c8'),_0x34525d['label']));if(!this['isConfigured'](_0x34525d[_0x8435('0xd6')])){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x34525d,_0x8435('0x1ad'));}var _0x4b4275=this[_0x8435('0xf')][_0x8435('0x6a')](this,_0x34525d[_0x8435('0xd6')]);if(!_0x4b4275){return this[_0x8435('0xb')][_0x8435('0x2b')](_0x34525d,_0x8435('0xd8'));}var _0x43d731=this['channel'][_0x8435('0xf')](_0x4b4275);return{'code':0xc8,'result':_0x43d731['extra']?_0x43d731[_0x8435('0x9e')]:'-'};};String[_0x8435('0xe')][_0x8435('0x9d')]=function(_0x5db539,_0x239d6d){return this[_0x8435('0x9c')](_0x5db539)[_0x8435('0x1c9')](_0x239d6d);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index a8b28a0..b7acf67 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 _0x2a98=['[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally'];(function(_0x16e6db,_0x2e5a01){var _0x5a9151=function(_0x7498a4){while(--_0x7498a4){_0x16e6db['push'](_0x16e6db['shift']());}};_0x5a9151(++_0x2e5a01);}(_0x2a98,0x138));var _0x82a9=function(_0x39faa2,_0x307989){_0x39faa2=_0x39faa2-0x0;var _0x4d44dc=_0x2a98[_0x39faa2];return _0x4d44dc;};'use strict';var util=require(_0x82a9('0x0'));var _=require(_0x82a9('0x1'));var moment=require('moment');var ami=require(_0x82a9('0x2'));var logger=require(_0x82a9('0x3'))(_0x82a9('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x82a9('0x5'));function Acw(_0x23ec9d){this[_0x82a9('0x6')]=_0x23ec9d[_0x82a9('0x6')];this[_0x82a9('0x7')]=_0x23ec9d[_0x82a9('0x7')];this[_0x82a9('0x8')]=_0x23ec9d[_0x82a9('0x8')];this[_0x82a9('0x9')]={};ami['on'](_0x82a9('0xa'),this[_0x82a9('0xb')][_0x82a9('0xc')](this));ami['on'](_0x82a9('0xd'),this['syncHangupRequest'][_0x82a9('0xc')](this));ami['on'](_0x82a9('0xe'),this[_0x82a9('0xf')][_0x82a9('0xc')](this));ami['on'](_0x82a9('0x10'),this[_0x82a9('0x11')][_0x82a9('0xc')](this));ami['on']('attendedtransfer',this[_0x82a9('0x12')][_0x82a9('0xc')](this));ami['on'](_0x82a9('0x13'),this['syncBlindTransfer'][_0x82a9('0xc')](this));ami['on'](_0x82a9('0x14'),this[_0x82a9('0x15')][_0x82a9('0xc')](this));}function getDiff(_0x3704f5){var _0x57c418=moment()[_0x82a9('0x16')](0x0);var _0x393875=moment(_0x3704f5)['milliseconds'](0x0);return _0x57c418[_0x82a9('0x17')](_0x393875,_0x82a9('0x18'));}Acw[_0x82a9('0x19')][_0x82a9('0x1a')]=function(_0x370e9a){try{var _0x4255ae=this;var _0x465ee1=this['channels'][_0x370e9a][_0x82a9('0x1b')];var _0x559c88=this[_0x82a9('0x9')][_0x370e9a][_0x82a9('0x1c')];var _0x16a165=this[_0x82a9('0x6')][_0x559c88];var _0x3c8593=![];var _0x101a14=_0x82a9('0x1d');if(_0x16a165[_0x82a9('0x1e')]){if(_0x16a165['mandatoryDispositionPause'][_0x82a9('0x1f')]){_0x3c8593=!![];_0x101a14=_0x16a165[_0x82a9('0x20')][_0x82a9('0x1f')];}}ami[_0x82a9('0x21')]({'action':_0x82a9('0x22'),'interface':_0x465ee1,'paused':!![],'reason':_0x101a14})[_0x82a9('0x23')](function(_0x1672c3){if(_0x4255ae['agents'][_0x465ee1]){return RpcUser['getAgent'](_0x4255ae[_0x82a9('0x7')][_0x465ee1]['id'])[_0x82a9('0x23')](function(_0x307495){if(_0x307495&&!_0x307495[_0x82a9('0x24')]){logger[_0x82a9('0x25')](_0x82a9('0x26'),_0x370e9a,_0x465ee1,_0x559c88);var _0x4fc7dd=_0x4255ae[_0x82a9('0x9')][_0x370e9a]['attended']&&_0x4255ae[_0x82a9('0x9')][_0x370e9a][_0x82a9('0x27')]?_0x4255ae['channels'][_0x370e9a][_0x82a9('0x27')]:_0x370e9a;return RpcUser[_0x82a9('0x28')](_0x4255ae[_0x82a9('0x7')][_0x465ee1],_0x101a14,_0x4fc7dd)['then'](function(_0x11d98d){if(!_0x3c8593){_0x4255ae[_0x82a9('0x8')][_0x465ee1]={};logger[_0x82a9('0x25')](_0x82a9('0x29'),_0x370e9a,_0x4255ae[_0x82a9('0x6')][_0x559c88][_0x82a9('0x2a')],_0x465ee1,_0x559c88);_0x4255ae[_0x82a9('0x8')][_0x465ee1][_0x82a9('0x2b')]=setTimeout(_0x4255ae[_0x82a9('0x2c')][_0x82a9('0xc')](_0x4255ae,_0x465ee1),_0x4255ae['voiceQueues'][_0x559c88][_0x82a9('0x2a')]*0x3e8);_0x4255ae[_0x82a9('0x8')][_0x465ee1][_0x82a9('0x2d')]=moment()[_0x82a9('0x2e')](_0x82a9('0x2f'));_0x4255ae['timers'][_0x465ee1][_0x82a9('0x30')]=_0x370e9a;_0x4255ae[_0x82a9('0x8')][_0x465ee1][_0x82a9('0x1c')]=_0x559c88;_0x4255ae[_0x82a9('0x8')][_0x465ee1][_0x82a9('0x31')]=function(){var _0x46ce5f=getDiff(_0x4255ae[_0x82a9('0x8')][_0x465ee1][_0x82a9('0x2d')]);clearTimeout(_0x4255ae[_0x82a9('0x8')][_0x465ee1]['timer']);_0x4255ae[_0x82a9('0x8')][_0x465ee1]['timer']=![];RpcVoiceAgentReport[_0x82a9('0x32')]({'acwtime':_0x46ce5f},_0x4255ae['timers'][_0x465ee1][_0x82a9('0x30')],_0x465ee1)[_0x82a9('0x23')](function(_0x2fe164){logger['info'](_0x82a9('0x33'),_0x370e9a,_0x46ce5f,_0x2fe164);})['catch'](function(_0x11ce32){logger[_0x82a9('0x34')](_0x82a9('0x35'),_0x370e9a,_0x11ce32);});delete _0x4255ae[_0x82a9('0x8')][_0x465ee1];};}});}else{logger[_0x82a9('0x25')](_0x82a9('0x36'),_0x370e9a,_0x465ee1,_0x559c88);}});}})['catch'](function(_0x51e46f){logger[_0x82a9('0x34')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x370e9a,_0x4255ae[_0x82a9('0x6')][_0x559c88][_0x82a9('0x2a')],_0x465ee1,_0x559c88);})[_0x82a9('0x37')](function(){delete _0x4255ae['channels'][_0x370e9a];});}catch(_0x4f3b26){logger['error'](_0x82a9('0x38'),_0x4f3b26[_0x82a9('0x39')]);}};Acw[_0x82a9('0x19')][_0x82a9('0x2c')]=function(_0x5694f1){try{var _0x1669f3=this;if(_0x1669f3[_0x82a9('0x8')][_0x5694f1]){_0x1669f3[_0x82a9('0x8')][_0x5694f1][_0x82a9('0x2b')]=![];var _0x5f4ead=_0x1669f3[_0x82a9('0x8')][_0x5694f1][_0x82a9('0x30')];var _0x1e20a2=_0x1669f3['timers'][_0x5694f1][_0x82a9('0x1c')];var _0xc67ea8=_0x1669f3['voiceQueues'][_0x1e20a2]['acwTimeout'];logger['info'](_0x82a9('0x3a'),_0x5f4ead,_0x5694f1);RpcUser[_0x82a9('0x3b')](this[_0x82a9('0x7')][_0x5694f1]);RpcVoiceAgentReport[_0x82a9('0x32')]({'acwtime':_0xc67ea8,'agentacw':!![]},_0x5f4ead,_0x5694f1)['then'](function(_0x1af41a){logger['info'](_0x82a9('0x33'),_0x5f4ead,_0xc67ea8,_0x1af41a);})[_0x82a9('0x3c')](function(_0x32f690){logger[_0x82a9('0x34')](_0x82a9('0x35'),_0x5f4ead,_0x32f690);});}else{logger[_0x82a9('0x34')](_0x82a9('0x3d'),_0x5694f1);if(_0x1669f3[_0x82a9('0x8')]){logger['info'](_0x82a9('0x3e'),JSON[_0x82a9('0x3f')](_0x1669f3['timers']));}}}catch(_0x4b077d){logger[_0x82a9('0x34')]('[ACW][STOP]\x20%s',_0x4b077d['message']);}};Acw['prototype'][_0x82a9('0xb')]=function(_0x54987f){try{if(this[_0x82a9('0x6')][_0x54987f[_0x82a9('0x1c')]]&&(this['voiceQueues'][_0x54987f[_0x82a9('0x1c')]][_0x82a9('0x4')]||this[_0x82a9('0x6')][_0x54987f[_0x82a9('0x1c')]]['mandatoryDisposition'])){if(this['agents'][_0x54987f[_0x82a9('0x1b')]]){this[_0x82a9('0x9')][_0x54987f[_0x82a9('0x30')]]={'queue':_0x54987f[_0x82a9('0x1c')],'interface':_0x54987f[_0x82a9('0x1b')],'destlinkedid':_0x54987f['destlinkedid']};}}}catch(_0x4c818a){logger['error'](_0x82a9('0x40'),_0x4c818a[_0x82a9('0x39')]);}};Acw[_0x82a9('0x19')]['syncAgentConnectPreview']=function(_0x5450dd){try{if(this[_0x82a9('0x6')][_0x5450dd[_0x82a9('0x1c')]]&&(this[_0x82a9('0x6')][_0x5450dd[_0x82a9('0x1c')]]['acw']||this[_0x82a9('0x6')][_0x5450dd[_0x82a9('0x1c')]][_0x82a9('0x1e')])){if(this[_0x82a9('0x7')][_0x5450dd[_0x82a9('0x1b')]]){this[_0x82a9('0x9')][_0x5450dd['uniqueid']]={'queue':_0x5450dd[_0x82a9('0x1c')],'interface':_0x5450dd['interface']};}}}catch(_0x65f573){logger[_0x82a9('0x34')](_0x82a9('0x41'),_0x65f573[_0x82a9('0x39')]);}};Acw[_0x82a9('0x19')][_0x82a9('0x42')]=function(_0x134a14){try{if(this[_0x82a9('0x9')][_0x134a14[_0x82a9('0x30')]]&&_[_0x82a9('0x43')](this[_0x82a9('0x9')][_0x134a14[_0x82a9('0x30')]][_0x82a9('0x44')])){logger[_0x82a9('0x25')](_0x82a9('0x45'),_0x134a14[_0x82a9('0x30')]);this[_0x82a9('0x1a')](_0x134a14['uniqueid']);}else if(this[_0x82a9('0x9')][_0x134a14[_0x82a9('0x46')]]&&_[_0x82a9('0x43')](this[_0x82a9('0x9')][_0x134a14[_0x82a9('0x46')]]['attended'])){logger[_0x82a9('0x25')](_0x82a9('0x47'),_0x134a14[_0x82a9('0x46')]);this[_0x82a9('0x1a')](_0x134a14['linkedid']);}}catch(_0x82fc14){logger[_0x82a9('0x34')](_0x82a9('0x48'),_0x82fc14[_0x82a9('0x39')]);}};Acw[_0x82a9('0x19')][_0x82a9('0xf')]=function(_0x2ac361){try{if(this[_0x82a9('0x9')][_0x2ac361[_0x82a9('0x30')]]&&this[_0x82a9('0x9')][_0x2ac361['uniqueid']][_0x82a9('0x44')]){logger[_0x82a9('0x25')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2ac361[_0x82a9('0x30')]);this['startAcw'](_0x2ac361[_0x82a9('0x30')]);}else if(this['channels'][_0x2ac361[_0x82a9('0x46')]]&&this[_0x82a9('0x9')][_0x2ac361[_0x82a9('0x46')]][_0x82a9('0x44')]){logger[_0x82a9('0x25')](_0x82a9('0x49'),_0x2ac361[_0x82a9('0x46')]);this[_0x82a9('0x1a')](_0x2ac361[_0x82a9('0x46')]);}}catch(_0x414a65){logger[_0x82a9('0x34')](_0x82a9('0x4a'),_0x414a65[_0x82a9('0x39')]);}};Acw[_0x82a9('0x19')][_0x82a9('0x12')]=function(_0x5acfac){try{if(!_[_0x82a9('0x4b')](this[_0x82a9('0x9')][_0x5acfac[_0x82a9('0x4c')]])){this[_0x82a9('0x1a')](_0x5acfac[_0x82a9('0x4c')]);if(this['channels'][_0x5acfac[_0x82a9('0x4d')]]){this['channels'][_0x5acfac[_0x82a9('0x4d')]]['attended']=!![];this[_0x82a9('0x9')][_0x5acfac[_0x82a9('0x4e')]]=this[_0x82a9('0x9')][_0x5acfac['secondtransfereruniqueid']];delete this['channels'][_0x5acfac[_0x82a9('0x4d')]];}}else if(!_[_0x82a9('0x4b')](this['channels'][_0x5acfac[_0x82a9('0x4e')]])){this[_0x82a9('0x1a')](_0x5acfac[_0x82a9('0x4e')]);if(this[_0x82a9('0x9')][_0x5acfac['origtransfereruniqueid']]){this[_0x82a9('0x9')][_0x5acfac[_0x82a9('0x4f')]]['attended']=!![];this['channels'][_0x5acfac[_0x82a9('0x4c')]]=this[_0x82a9('0x9')][_0x5acfac['origtransfereruniqueid']];delete this['channels'][_0x5acfac['origtransfereruniqueid']];}}}catch(_0x5c45bc){logger[_0x82a9('0x34')](_0x82a9('0x50'),_0x5c45bc[_0x82a9('0x39')]);}};Acw[_0x82a9('0x19')][_0x82a9('0x51')]=function(_0x2524a9){try{if(this[_0x82a9('0x9')][_0x2524a9[_0x82a9('0x52')]]){logger[_0x82a9('0x25')](_0x82a9('0x53'),JSON[_0x82a9('0x3f')](_0x2524a9[_0x82a9('0x52')]));this['startAcw'](_0x2524a9[_0x82a9('0x52')]);}else if(this[_0x82a9('0x9')][_0x2524a9[_0x82a9('0x54')]]){logger['info'](_0x82a9('0x55'),JSON[_0x82a9('0x3f')](_0x2524a9['transfererlinkedid']));this[_0x82a9('0x1a')](_0x2524a9['transfererlinkedid']);}}catch(_0xd11914){logger['error'](_0x82a9('0x56'),_0xd11914[_0x82a9('0x39')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x1f169f){try{if(this['voiceQueues'][_0x1f169f[_0x82a9('0x1c')]]&&this[_0x82a9('0x6')][_0x1f169f[_0x82a9('0x1c')]][_0x82a9('0x57')]===_0x82a9('0x58')){if(this[_0x82a9('0x7')][_0x1f169f[_0x82a9('0x1b')]]){logger['info'](_0x82a9('0x59'),_0x1f169f['uniqueid'],_0x1f169f[_0x82a9('0x1b')],_0x1f169f[_0x82a9('0x1c')]);return RpcUser['savePause'](this['agents'][_0x1f169f[_0x82a9('0x1b')]],'Auto-Pause',_0x1f169f[_0x82a9('0x30')]);}}}catch(_0x27f8be){logger[_0x82a9('0x34')](_0x82a9('0x5a'),_0x27f8be[_0x82a9('0x39')]);}};module[_0x82a9('0x5b')]=Acw; \ No newline at end of file +var _0x4417=['util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','prototype','channels','interface','queue','mandatoryDispositionPause','name','QueuePause','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','[%s][HANGUP:LINKEDID]','linkedid','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','[ACW][syncAgentRingNoAnswer]\x20%s','exports'];(function(_0x4095b9,_0x17ac01){var _0x3f6909=function(_0x3c3189){while(--_0x3c3189){_0x4095b9['push'](_0x4095b9['shift']());}};_0x3f6909(++_0x17ac01);}(_0x4417,0x1ec));var _0x7441=function(_0x5d0167,_0x1da4b4){_0x5d0167=_0x5d0167-0x0;var _0x4768f7=_0x4417[_0x5d0167];return _0x4768f7;};'use strict';var util=require(_0x7441('0x0'));var _=require(_0x7441('0x1'));var moment=require(_0x7441('0x2'));var ami=require('../ami');var logger=require(_0x7441('0x3'))(_0x7441('0x4'));var RpcUser=require(_0x7441('0x5'));var RpcVoiceAgentReport=require(_0x7441('0x6'));function Acw(_0x451952){this[_0x7441('0x7')]=_0x451952[_0x7441('0x7')];this[_0x7441('0x8')]=_0x451952[_0x7441('0x8')];this[_0x7441('0x9')]=_0x451952[_0x7441('0x9')];this['channels']={};ami['on'](_0x7441('0xa'),this[_0x7441('0xb')][_0x7441('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x7441('0xc')](this));ami['on'](_0x7441('0xd'),this['syncHangup']['bind'](this));ami['on'](_0x7441('0xe'),this[_0x7441('0xf')][_0x7441('0xc')](this));ami['on']('attendedtransfer',this[_0x7441('0x10')][_0x7441('0xc')](this));ami['on'](_0x7441('0x11'),this['syncBlindTransfer'][_0x7441('0xc')](this));ami['on'](_0x7441('0x12'),this['syncAgentConnectPreview'][_0x7441('0xc')](this));}function getDiff(_0x522ea1){var _0x3b8223=moment()[_0x7441('0x13')](0x0);var _0x7f0aa0=moment(_0x522ea1)[_0x7441('0x13')](0x0);return _0x3b8223[_0x7441('0x14')](_0x7f0aa0,'seconds');}Acw[_0x7441('0x15')]['startAcw']=function(_0x17952b){try{var _0x5c49c7=this;var _0x21e031=this[_0x7441('0x16')][_0x17952b][_0x7441('0x17')];var _0x57aec4=this['channels'][_0x17952b][_0x7441('0x18')];var _0x524401=this[_0x7441('0x7')][_0x57aec4];var _0x224ab8=![];var _0x43ba57='ACW';if(_0x524401['mandatoryDisposition']){if(_0x524401[_0x7441('0x19')]['name']){_0x224ab8=!![];_0x43ba57=_0x524401[_0x7441('0x19')][_0x7441('0x1a')];}}ami['Action']({'action':_0x7441('0x1b'),'interface':_0x21e031,'paused':!![],'reason':_0x43ba57})['then'](function(_0x49aaff){if(_0x5c49c7[_0x7441('0x8')][_0x21e031]){return RpcUser[_0x7441('0x1c')](_0x5c49c7[_0x7441('0x8')][_0x21e031]['id'])['then'](function(_0x4f448e){if(_0x4f448e&&!_0x4f448e[_0x7441('0x1d')]){logger[_0x7441('0x1e')](_0x7441('0x1f'),_0x17952b,_0x21e031,_0x57aec4);var _0x19cbc1=_0x5c49c7[_0x7441('0x16')][_0x17952b][_0x7441('0x20')]&&_0x5c49c7[_0x7441('0x16')][_0x17952b][_0x7441('0x21')]?_0x5c49c7[_0x7441('0x16')][_0x17952b][_0x7441('0x21')]:_0x17952b;return RpcUser[_0x7441('0x22')](_0x5c49c7[_0x7441('0x8')][_0x21e031],_0x43ba57,_0x19cbc1)[_0x7441('0x23')](function(_0x4f1143){if(!_0x224ab8){_0x5c49c7[_0x7441('0x9')][_0x21e031]={};logger[_0x7441('0x1e')](_0x7441('0x24'),_0x17952b,_0x5c49c7[_0x7441('0x7')][_0x57aec4][_0x7441('0x25')],_0x21e031,_0x57aec4);_0x5c49c7[_0x7441('0x9')][_0x21e031][_0x7441('0x26')]=setTimeout(_0x5c49c7[_0x7441('0x27')][_0x7441('0xc')](_0x5c49c7,_0x21e031),_0x5c49c7[_0x7441('0x7')][_0x57aec4][_0x7441('0x25')]*0x3e8);_0x5c49c7[_0x7441('0x9')][_0x21e031]['lastPauseAt']=moment()[_0x7441('0x28')](_0x7441('0x29'));_0x5c49c7['timers'][_0x21e031][_0x7441('0x2a')]=_0x17952b;_0x5c49c7[_0x7441('0x9')][_0x21e031][_0x7441('0x18')]=_0x57aec4;_0x5c49c7['timers'][_0x21e031]['updateAcw']=function(){var _0xbb8926=getDiff(_0x5c49c7[_0x7441('0x9')][_0x21e031][_0x7441('0x2b')]);clearTimeout(_0x5c49c7['timers'][_0x21e031]['timer']);_0x5c49c7[_0x7441('0x9')][_0x21e031][_0x7441('0x26')]=![];RpcVoiceAgentReport[_0x7441('0x2c')]({'acwtime':_0xbb8926},_0x5c49c7['timers'][_0x21e031][_0x7441('0x2a')],_0x21e031)[_0x7441('0x23')](function(_0x1527ee){logger[_0x7441('0x1e')](_0x7441('0x2d'),_0x17952b,_0xbb8926,_0x1527ee);})['catch'](function(_0x327630){logger[_0x7441('0x2e')](_0x7441('0x2f'),_0x17952b,_0x327630);});delete _0x5c49c7['timers'][_0x21e031];};}});}else{logger['info'](_0x7441('0x30'),_0x17952b,_0x21e031,_0x57aec4);}});}})[_0x7441('0x31')](function(_0x134716){logger[_0x7441('0x2e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x17952b,_0x5c49c7[_0x7441('0x7')][_0x57aec4][_0x7441('0x25')],_0x21e031,_0x57aec4);})[_0x7441('0x32')](function(){delete _0x5c49c7['channels'][_0x17952b];});}catch(_0x55a54c){logger[_0x7441('0x2e')]('[ACW][START]\x20%s',_0x55a54c[_0x7441('0x33')]);}};Acw[_0x7441('0x15')]['stopAcw']=function(_0xd88be8){try{var _0x39350c=this;if(_0x39350c[_0x7441('0x9')][_0xd88be8]){_0x39350c[_0x7441('0x9')][_0xd88be8][_0x7441('0x26')]=![];var _0x191487=_0x39350c[_0x7441('0x9')][_0xd88be8][_0x7441('0x2a')];var _0x1fd53e=_0x39350c[_0x7441('0x9')][_0xd88be8][_0x7441('0x18')];var _0x3d1a73=_0x39350c['voiceQueues'][_0x1fd53e][_0x7441('0x25')];logger[_0x7441('0x1e')](_0x7441('0x34'),_0x191487,_0xd88be8);RpcUser[_0x7441('0x35')](this[_0x7441('0x8')][_0xd88be8]);RpcVoiceAgentReport[_0x7441('0x2c')]({'acwtime':_0x3d1a73,'agentacw':!![]},_0x191487,_0xd88be8)[_0x7441('0x23')](function(_0xa78da9){logger[_0x7441('0x1e')](_0x7441('0x2d'),_0x191487,_0x3d1a73,_0xa78da9);})[_0x7441('0x31')](function(_0xf0e116){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x191487,_0xf0e116);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0xd88be8);if(_0x39350c[_0x7441('0x9')]){logger[_0x7441('0x1e')](_0x7441('0x36'),JSON[_0x7441('0x37')](_0x39350c[_0x7441('0x9')]));}}}catch(_0x2f24cf){logger[_0x7441('0x2e')](_0x7441('0x38'),_0x2f24cf[_0x7441('0x33')]);}};Acw['prototype'][_0x7441('0xb')]=function(_0x39a55a){try{if(this['voiceQueues'][_0x39a55a[_0x7441('0x18')]]&&(this['voiceQueues'][_0x39a55a[_0x7441('0x18')]][_0x7441('0x4')]||this[_0x7441('0x7')][_0x39a55a['queue']][_0x7441('0x39')])){if(this['agents'][_0x39a55a[_0x7441('0x17')]]){this[_0x7441('0x16')][_0x39a55a[_0x7441('0x2a')]]={'queue':_0x39a55a[_0x7441('0x18')],'interface':_0x39a55a[_0x7441('0x17')],'destlinkedid':_0x39a55a['destlinkedid']};}}}catch(_0x681d93){logger[_0x7441('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x681d93['message']);}};Acw[_0x7441('0x15')][_0x7441('0x3a')]=function(_0x43a9c7){try{if(this[_0x7441('0x7')][_0x43a9c7['queue']]&&(this[_0x7441('0x7')][_0x43a9c7['queue']][_0x7441('0x4')]||this['voiceQueues'][_0x43a9c7['queue']][_0x7441('0x39')])){if(this[_0x7441('0x8')][_0x43a9c7['interface']]){this['channels'][_0x43a9c7[_0x7441('0x2a')]]={'queue':_0x43a9c7['queue'],'interface':_0x43a9c7[_0x7441('0x17')]};}}}catch(_0x45a6a2){logger[_0x7441('0x2e')](_0x7441('0x3b'),_0x45a6a2[_0x7441('0x33')]);}};Acw[_0x7441('0x15')][_0x7441('0x3c')]=function(_0x59a0e2){try{if(this['channels'][_0x59a0e2['uniqueid']]&&_[_0x7441('0x3d')](this['channels'][_0x59a0e2[_0x7441('0x2a')]][_0x7441('0x20')])){logger[_0x7441('0x1e')](_0x7441('0x3e'),_0x59a0e2[_0x7441('0x2a')]);this[_0x7441('0x3f')](_0x59a0e2[_0x7441('0x2a')]);}else if(this[_0x7441('0x16')][_0x59a0e2['linkedid']]&&_['isUndefined'](this[_0x7441('0x16')][_0x59a0e2['linkedid']][_0x7441('0x20')])){logger[_0x7441('0x1e')](_0x7441('0x40'),_0x59a0e2['linkedid']);this[_0x7441('0x3f')](_0x59a0e2[_0x7441('0x41')]);}}catch(_0x6ffdd){logger[_0x7441('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x6ffdd['message']);}};Acw['prototype'][_0x7441('0x42')]=function(_0xc53208){try{if(this[_0x7441('0x16')][_0xc53208['uniqueid']]&&this['channels'][_0xc53208[_0x7441('0x2a')]][_0x7441('0x20')]){logger['info'](_0x7441('0x43'),_0xc53208[_0x7441('0x2a')]);this[_0x7441('0x3f')](_0xc53208[_0x7441('0x2a')]);}else if(this['channels'][_0xc53208[_0x7441('0x41')]]&&this[_0x7441('0x16')][_0xc53208['linkedid']][_0x7441('0x20')]){logger[_0x7441('0x1e')](_0x7441('0x44'),_0xc53208[_0x7441('0x41')]);this[_0x7441('0x3f')](_0xc53208[_0x7441('0x41')]);}}catch(_0x2c1371){logger['error']('[ACW][syncHangup]\x20%s',_0x2c1371[_0x7441('0x33')]);}};Acw[_0x7441('0x15')][_0x7441('0x10')]=function(_0x36dd46){try{if(!_[_0x7441('0x45')](this[_0x7441('0x16')][_0x36dd46[_0x7441('0x46')]])){this[_0x7441('0x3f')](_0x36dd46['transfereeuniqueid']);if(this[_0x7441('0x16')][_0x36dd46[_0x7441('0x47')]]){this['channels'][_0x36dd46[_0x7441('0x47')]][_0x7441('0x20')]=!![];this[_0x7441('0x16')][_0x36dd46[_0x7441('0x48')]]=this['channels'][_0x36dd46[_0x7441('0x47')]];delete this['channels'][_0x36dd46['secondtransfereruniqueid']];}}else if(!_[_0x7441('0x45')](this[_0x7441('0x16')][_0x36dd46[_0x7441('0x48')]])){this[_0x7441('0x3f')](_0x36dd46[_0x7441('0x48')]);if(this[_0x7441('0x16')][_0x36dd46[_0x7441('0x49')]]){this[_0x7441('0x16')][_0x36dd46[_0x7441('0x49')]][_0x7441('0x20')]=!![];this[_0x7441('0x16')][_0x36dd46['transfereeuniqueid']]=this[_0x7441('0x16')][_0x36dd46[_0x7441('0x49')]];delete this[_0x7441('0x16')][_0x36dd46[_0x7441('0x49')]];}}}catch(_0x454b73){logger[_0x7441('0x2e')](_0x7441('0x4a'),_0x454b73[_0x7441('0x33')]);}};Acw['prototype'][_0x7441('0x4b')]=function(_0x30a23b){try{if(this[_0x7441('0x16')][_0x30a23b[_0x7441('0x4c')]]){logger[_0x7441('0x1e')](_0x7441('0x4d'),JSON[_0x7441('0x37')](_0x30a23b[_0x7441('0x4c')]));this[_0x7441('0x3f')](_0x30a23b[_0x7441('0x4c')]);}else if(this[_0x7441('0x16')][_0x30a23b[_0x7441('0x4e')]]){logger[_0x7441('0x1e')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x30a23b['transfererlinkedid']));this[_0x7441('0x3f')](_0x30a23b[_0x7441('0x4e')]);}}catch(_0x537a69){logger['error'](_0x7441('0x4f'),_0x537a69['message']);}};Acw[_0x7441('0x15')][_0x7441('0xf')]=function(_0x3f6df9){try{if(this[_0x7441('0x7')][_0x3f6df9[_0x7441('0x18')]]&&this['voiceQueues'][_0x3f6df9[_0x7441('0x18')]]['autopause']==='all'){if(this['agents'][_0x3f6df9['interface']]){logger[_0x7441('0x1e')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3f6df9[_0x7441('0x2a')],_0x3f6df9[_0x7441('0x17')],_0x3f6df9[_0x7441('0x18')]);return RpcUser[_0x7441('0x22')](this[_0x7441('0x8')][_0x3f6df9[_0x7441('0x17')]],'Auto-Pause',_0x3f6df9[_0x7441('0x2a')]);}}}catch(_0x25ba90){logger[_0x7441('0x2e')](_0x7441('0x50'),_0x25ba90[_0x7441('0x33')]);}};module[_0x7441('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ede1248..a20ffd9 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 _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x727ee4,_0x82fde0){var _0x3cc99b=function(_0x1fa359){while(--_0x1fa359){_0x727ee4['push'](_0x727ee4['shift']());}};_0x3cc99b(++_0x82fde0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x0b0e[_0x31172e];return _0x414ada;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x242f01,_0x15d59e){var _0x2bb519=function(_0x522f90){while(--_0x522f90){_0x242f01['push'](_0x242f01['shift']());}};_0x2bb519(++_0x15d59e);}(_0x757a,0xde));var _0xa757=function(_0x3792fa,_0xb22571){_0x3792fa=_0x3792fa-0x0;var _0x4d3d45=_0x757a[_0x3792fa];return _0x4d3d45;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index da719bb..5607af9 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 _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x296041,_0x48989a){var _0x4545ff=function(_0x339f17){while(--_0x339f17){_0x296041['push'](_0x296041['shift']());}};_0x4545ff(++_0x48989a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x1ab29e,_0x2058bd){var _0x401ea7=function(_0x361cca){while(--_0x361cca){_0x1ab29e['push'](_0x1ab29e['shift']());}};_0x401ea7(++_0x2058bd);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2a7192,_0x24a7ab){_0x2a7192=_0x2a7192-0x0;var _0x3b3cda=_0xf4eb[_0x2a7192];return _0x3b3cda;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index f4a9555..0d4c610 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd37=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x1f4c3c,_0x43ea33){var _0x4c8c4c=function(_0x350845){while(--_0x350845){_0x1f4c3c['push'](_0x1f4c3c['shift']());}};_0x4c8c4c(++_0x43ea33);}(_0xcd37,0xee));var _0x7cd3=function(_0x38779f,_0x5db949){_0x38779f=_0x38779f-0x0;var _0x219989=_0xcd37[_0x38779f];return _0x219989;};'use strict';var util=require(_0x7cd3('0x0'));var _=require(_0x7cd3('0x1'));var moment=require('moment');function checkNameSurname(_0x455c7a,_0x10f52e,_0x243e26){var _0x185ce6='';if(!_[_0x7cd3('0x2')](_0x10f52e)&&'string'===typeof _0x10f52e){_0x185ce6+=_0x10f52e;}if(!_[_0x7cd3('0x2')](_0x243e26)&&_0x7cd3('0x3')===typeof _0x243e26){_0x185ce6+='\x20'+_0x243e26;}if(_0x185ce6!==''){return _0x185ce6;}return _0x455c7a;}function Action(_0x15a509,_0xafd6f4,_0x5d024c){this[_0x7cd3('0x4')]=_0x15a509;this[_0x7cd3('0x5')]=_0x5d024c||undefined;this[_0x7cd3('0x6')]=checkNameSurname(_0xafd6f4[_0x7cd3('0x7')]['phone'],_0xafd6f4[_0x7cd3('0x7')][_0x7cd3('0x8')],_0xafd6f4[_0x7cd3('0x7')][_0x7cd3('0x9')]);this[_0x7cd3('0xa')]=_0xafd6f4[_0x7cd3('0x7')][_0x7cd3('0xb')];this[_0x7cd3('0xc')]=_0x15a509[_0x7cd3('0x6')];this['active']=_0xafd6f4[_0x7cd3('0xd')]||![];this[_0x7cd3('0xe')]=_0x15a509[_0x7cd3('0xe')];this[_0x7cd3('0xf')]=_0x15a509['dialQueueTimeout']||0x3;this['scheduledat']=_0xafd6f4['scheduledat'];this['countbusyretry']=_0xafd6f4[_0x7cd3('0x10')];this[_0x7cd3('0x11')]=_0xafd6f4[_0x7cd3('0x11')];this[_0x7cd3('0x12')]=_0xafd6f4['countnoanswerretry'];this[_0x7cd3('0x13')]=_0xafd6f4[_0x7cd3('0x13')];this[_0x7cd3('0x14')]=_0xafd6f4[_0x7cd3('0x14')];this[_0x7cd3('0x15')]=_0xafd6f4['countabandonedretry'];this['countmachineretry']=_0xafd6f4[_0x7cd3('0x16')];this['countagentrejectretry']=_0xafd6f4[_0x7cd3('0x17')];this[_0x7cd3('0x18')]=_0xafd6f4[_0x7cd3('0x18')];this['ListId']=_0xafd6f4[_0x7cd3('0x19')];this[_0x7cd3('0x1a')]=_0xafd6f4[_0x7cd3('0x1a')];this[_0x7cd3('0x1b')]=_0xafd6f4[_0x7cd3('0x1b')];this['CampaignId']=_0xafd6f4[_0x7cd3('0x1c')];this[_0x7cd3('0x1d')]=_0xafd6f4['id'];this[_0x7cd3('0x1e')]=_0xafd6f4[_0x7cd3('0x7')][_0x7cd3('0x8')]||'';this[_0x7cd3('0x1f')]=moment()[_0x7cd3('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7cd3('0x21')]=_0xafd6f4[_0x7cd3('0x21')];this['callbackuniqueid']=_0xafd6f4[_0x7cd3('0x22')];this[_0x7cd3('0x23')]=_0xafd6f4[_0x7cd3('0x23')];this[_0x7cd3('0x24')]=_0xafd6f4['recallme'];this[_0x7cd3('0x25')]='';this[_0x7cd3('0x26')]='';}Action[_0x7cd3('0x27')]['getCaller']=function(){return util['format'](_0x7cd3('0x28'),this[_0x7cd3('0x6')],this[_0x7cd3('0x4')][_0x7cd3('0x29')]>0x0?this[_0x7cd3('0xa')]['substring'](this[_0x7cd3('0x4')]['dialCutDigit']):this[_0x7cd3('0xa')]);};Action['prototype']['getQueue']=function(){return this[_0x7cd3('0xc')];};module[_0x7cd3('0x2a')]=Action; \ No newline at end of file +var _0x5ba4=['format','dialCutDigit','substring','prototype','getQueue','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller'];(function(_0xb926fa,_0x51641b){var _0x230934=function(_0x522aec){while(--_0x522aec){_0xb926fa['push'](_0xb926fa['shift']());}};_0x230934(++_0x51641b);}(_0x5ba4,0x148));var _0x45ba=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5ba4[_0x618414];return _0x21c19a;};'use strict';var util=require(_0x45ba('0x0'));var _=require(_0x45ba('0x1'));var moment=require(_0x45ba('0x2'));function checkNameSurname(_0x5f334d,_0x5c2cfc,_0x2d112b){var _0x194aea='';if(!_['isNil'](_0x5c2cfc)&&_0x45ba('0x3')===typeof _0x5c2cfc){_0x194aea+=_0x5c2cfc;}if(!_[_0x45ba('0x4')](_0x2d112b)&&_0x45ba('0x3')===typeof _0x2d112b){_0x194aea+='\x20'+_0x2d112b;}if(_0x194aea!==''){return _0x194aea;}return _0x5f334d;}function Action(_0x286761,_0x238d60,_0xf8e00d){this[_0x45ba('0x5')]=_0x286761;this[_0x45ba('0x6')]=_0xf8e00d||undefined;this[_0x45ba('0x7')]=checkNameSurname(_0x238d60[_0x45ba('0x8')][_0x45ba('0x9')],_0x238d60['Contact'][_0x45ba('0xa')],_0x238d60['Contact'][_0x45ba('0xb')]);this[_0x45ba('0xc')]=_0x238d60[_0x45ba('0x8')][_0x45ba('0x9')];this[_0x45ba('0xd')]=_0x286761[_0x45ba('0x7')];this[_0x45ba('0xe')]=_0x238d60['active']||![];this[_0x45ba('0xf')]=_0x286761['type'];this[_0x45ba('0x10')]=_0x286761[_0x45ba('0x10')]||0x3;this[_0x45ba('0x11')]=_0x238d60[_0x45ba('0x11')];this[_0x45ba('0x12')]=_0x238d60[_0x45ba('0x12')];this[_0x45ba('0x13')]=_0x238d60[_0x45ba('0x13')];this['countnoanswerretry']=_0x238d60['countnoanswerretry'];this[_0x45ba('0x14')]=_0x238d60[_0x45ba('0x14')];this[_0x45ba('0x15')]=_0x238d60[_0x45ba('0x15')];this[_0x45ba('0x16')]=_0x238d60[_0x45ba('0x16')];this['countmachineretry']=_0x238d60[_0x45ba('0x17')];this[_0x45ba('0x18')]=_0x238d60[_0x45ba('0x18')];this['ContactId']=_0x238d60[_0x45ba('0x19')];this[_0x45ba('0x1a')]=_0x238d60['ListId'];this[_0x45ba('0x1b')]=_0x238d60[_0x45ba('0x1b')];this[_0x45ba('0x1c')]=_0x238d60[_0x45ba('0x1c')];this[_0x45ba('0x1d')]=_0x238d60[_0x45ba('0x1d')];this['idHopper']=_0x238d60['id'];this[_0x45ba('0x1e')]=_0x238d60[_0x45ba('0x8')]['firstName']||'';this[_0x45ba('0x1f')]=moment()['format'](_0x45ba('0x20'));this[_0x45ba('0x21')]=_0x238d60['callback'];this[_0x45ba('0x22')]=_0x238d60[_0x45ba('0x22')];this[_0x45ba('0x23')]=_0x238d60[_0x45ba('0x23')];this['recallme']=_0x238d60[_0x45ba('0x24')];this[_0x45ba('0x25')]='';this[_0x45ba('0x26')]='';}Action['prototype'][_0x45ba('0x27')]=function(){return util[_0x45ba('0x28')]('\x22%s\x22\x20<%s>',this[_0x45ba('0x7')],this['voiceQueue'][_0x45ba('0x29')]>0x0?this['number'][_0x45ba('0x2a')](this[_0x45ba('0x5')][_0x45ba('0x29')]):this[_0x45ba('0xc')]);};Action[_0x45ba('0x2b')][_0x45ba('0x2c')]=function(){return this[_0x45ba('0xd')];};module[_0x45ba('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 32aaa41..30bbe04 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe290=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x2b9ce9,_0x507c08){var _0x17c113=function(_0x43bf8a){while(--_0x43bf8a){_0x2b9ce9['push'](_0x2b9ce9['shift']());}};_0x17c113(++_0x507c08);}(_0xe290,0x19c));var _0x0e29=function(_0x3b6f7e,_0x2c6e88){_0x3b6f7e=_0x3b6f7e-0x0;var _0xa6608=_0xe290[_0x3b6f7e];return _0xa6608;};'use strict';var util=require(_0x0e29('0x0'));var _=require(_0x0e29('0x1'));var moment=require(_0x0e29('0x2'));function getSeconds(_0x28da71,_0x21ba53){var _0x3d2c82=moment(_0x28da71)[_0x0e29('0x3')](0x0);var _0x44eacf=moment(_0x21ba53)[_0x0e29('0x3')](0x0);return _0x3d2c82[_0x0e29('0x4')](_0x44eacf,_0x0e29('0x5'));}function AgentComplete(_0x78480b,_0x13f8e6){this[_0x0e29('0x6')]=0x4;this[_0x0e29('0x7')]=_0x0e29('0x8');this['scheduledat']=_0x78480b[_0x0e29('0x9')];this[_0x0e29('0xa')]=_0x78480b[_0x0e29('0xa')];this['campaigntype']=_0x78480b[_0x0e29('0xa')]===_0x0e29('0xb')?_0x0e29('0xc'):_0x78480b[_0x0e29('0xa')];this[_0x0e29('0xd')]=_0x78480b[_0x0e29('0xd')];this['countcongestionretry']=_0x78480b['countcongestionretry'];this['countnoanswerretry']=_0x78480b[_0x0e29('0xe')];this[_0x0e29('0xf')]=_0x78480b[_0x0e29('0xd')]+_0x78480b['countcongestionretry']+_0x78480b[_0x0e29('0xe')]+_0x78480b['countnosuchnumberretry']+_0x78480b[_0x0e29('0x10')]+_0x78480b['countabandonedretry']+_0x78480b['countmachineretry']+_0x78480b[_0x0e29('0x11')];this[_0x0e29('0x12')]=_0x78480b[_0x0e29('0x12')];this[_0x0e29('0x10')]=_0x78480b[_0x0e29('0x10')];this[_0x0e29('0x13')]=_0x78480b[_0x0e29('0x13')];this[_0x0e29('0x14')]=_0x78480b[_0x0e29('0x14')];this[_0x0e29('0x11')]=_0x78480b['countagentrejectretry'];this[_0x0e29('0x15')]=_0x13f8e6[_0x0e29('0x15')];this[_0x0e29('0x16')]=_0x78480b[_0x0e29('0x17')];this['calleridnum']=_0x78480b['number'];this[_0x0e29('0x18')]=_0x78480b[_0x0e29('0x18')];this['responsetime']=_0x78480b['responsetime'];this[_0x0e29('0x19')]=_0x78480b[_0x0e29('0x19')];this[_0x0e29('0x1a')]=moment()['format'](_0x0e29('0x1b'));this['ringtime']=getSeconds(_0x78480b[_0x0e29('0x1c')],_0x78480b[_0x0e29('0x18')]);this[_0x0e29('0x1d')]=getSeconds(_0x78480b[_0x0e29('0x19')],_0x78480b[_0x0e29('0x1c')]);this[_0x0e29('0x1e')]=getSeconds(this[_0x0e29('0x1a')],_0x78480b[_0x0e29('0x19')]);this[_0x0e29('0xc')]=_0x13f8e6['queue'];this[_0x0e29('0x1f')]=_0x13f8e6[_0x0e29('0x1f')];this['reason']=_0x13f8e6[_0x0e29('0x20')];this[_0x0e29('0x21')]=_0x78480b[_0x0e29('0x21')];this[_0x0e29('0x22')]=_0x78480b[_0x0e29('0x22')];this[_0x0e29('0x23')]=_0x78480b[_0x0e29('0x23')];this['recallme']=_0x78480b[_0x0e29('0x24')];this[_0x0e29('0x25')]=_0x78480b[_0x0e29('0x25')];this[_0x0e29('0x26')]=_0x78480b[_0x0e29('0x26')];this[_0x0e29('0x27')]=_0x78480b[_0x0e29('0x27')];this['VoiceQueueId']=_0x78480b[_0x0e29('0x28')];this['CampaignId']=_0x78480b[_0x0e29('0x29')];this[_0x0e29('0x2a')]=_0x78480b[_0x0e29('0x2a')]||'';this[_0x0e29('0x2b')]=_0x78480b[_0x0e29('0x2b')]||'';}module[_0x0e29('0x2c')]=AgentComplete; \ No newline at end of file +var _0x6fa3=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId'];(function(_0x1494d8,_0x34ffc9){var _0x3c8b8c=function(_0x84b6f1){while(--_0x84b6f1){_0x1494d8['push'](_0x1494d8['shift']());}};_0x3c8b8c(++_0x34ffc9);}(_0x6fa3,0x1dd));var _0x36fa=function(_0x5951a7,_0x24e83f){_0x5951a7=_0x5951a7-0x0;var _0x593dcf=_0x6fa3[_0x5951a7];return _0x593dcf;};'use strict';var util=require(_0x36fa('0x0'));var _=require(_0x36fa('0x1'));var moment=require(_0x36fa('0x2'));function getSeconds(_0xa251e3,_0x565913){var _0x3c0489=moment(_0xa251e3)[_0x36fa('0x3')](0x0);var _0xb1ab79=moment(_0x565913)[_0x36fa('0x3')](0x0);return _0x3c0489['diff'](_0xb1ab79,'seconds');}function AgentComplete(_0x387a8d,_0x4cb359){this[_0x36fa('0x4')]=0x4;this[_0x36fa('0x5')]=_0x36fa('0x6');this[_0x36fa('0x7')]=_0x387a8d['scheduledat'];this[_0x36fa('0x8')]=_0x387a8d[_0x36fa('0x8')];this['campaigntype']=_0x387a8d[_0x36fa('0x8')]===_0x36fa('0x9')?'queue':_0x387a8d[_0x36fa('0x8')];this['countbusyretry']=_0x387a8d[_0x36fa('0xa')];this[_0x36fa('0xb')]=_0x387a8d[_0x36fa('0xb')];this[_0x36fa('0xc')]=_0x387a8d[_0x36fa('0xc')];this[_0x36fa('0xd')]=_0x387a8d[_0x36fa('0xa')]+_0x387a8d[_0x36fa('0xb')]+_0x387a8d[_0x36fa('0xc')]+_0x387a8d[_0x36fa('0xe')]+_0x387a8d[_0x36fa('0xf')]+_0x387a8d[_0x36fa('0x10')]+_0x387a8d[_0x36fa('0x11')]+_0x387a8d[_0x36fa('0x12')];this[_0x36fa('0xe')]=_0x387a8d[_0x36fa('0xe')];this[_0x36fa('0xf')]=_0x387a8d[_0x36fa('0xf')];this['countabandonedretry']=_0x387a8d[_0x36fa('0x10')];this['countmachineretry']=_0x387a8d[_0x36fa('0x11')];this[_0x36fa('0x12')]=_0x387a8d[_0x36fa('0x12')];this[_0x36fa('0x13')]=_0x4cb359['uniqueid'];this['calleridname']=_0x387a8d['name'];this[_0x36fa('0x14')]=_0x387a8d[_0x36fa('0x15')];this[_0x36fa('0x16')]=_0x387a8d[_0x36fa('0x16')];this[_0x36fa('0x17')]=_0x387a8d[_0x36fa('0x17')];this[_0x36fa('0x18')]=_0x387a8d[_0x36fa('0x18')];this[_0x36fa('0x19')]=moment()[_0x36fa('0x1a')](_0x36fa('0x1b'));this['ringtime']=getSeconds(_0x387a8d[_0x36fa('0x17')],_0x387a8d[_0x36fa('0x16')]);this[_0x36fa('0x1c')]=getSeconds(_0x387a8d[_0x36fa('0x18')],_0x387a8d[_0x36fa('0x17')]);this[_0x36fa('0x1d')]=getSeconds(this[_0x36fa('0x19')],_0x387a8d['answertime']);this['queue']=_0x4cb359[_0x36fa('0x1e')];this[_0x36fa('0x1f')]=_0x4cb359[_0x36fa('0x1f')];this['reason']=_0x4cb359[_0x36fa('0x20')];this[_0x36fa('0x21')]=_0x387a8d['callback'];this[_0x36fa('0x22')]=_0x387a8d[_0x36fa('0x22')];this['callbackat']=_0x387a8d[_0x36fa('0x23')];this['recallme']=_0x387a8d['recallme'];this[_0x36fa('0x24')]=_0x387a8d['ContactId'];this[_0x36fa('0x25')]=_0x387a8d[_0x36fa('0x25')];this[_0x36fa('0x26')]=_0x387a8d[_0x36fa('0x26')];this['VoiceQueueId']=_0x387a8d['VoiceQueueId'];this[_0x36fa('0x27')]=_0x387a8d[_0x36fa('0x27')];this[_0x36fa('0x28')]=_0x387a8d[_0x36fa('0x28')]||'';this[_0x36fa('0x29')]=_0x387a8d[_0x36fa('0x29')]||'';}module[_0x36fa('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 3966b46..7de41c6 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname'];(function(_0x3bd395,_0x132b83){var _0x3e5da2=function(_0x543fe3){while(--_0x543fe3){_0x3bd395['push'](_0x3bd395['shift']());}};_0x3e5da2(++_0x132b83);}(_0xabce,0x103));var _0xeabc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xabce[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0xeabc('0x0'));var _=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));function getSeconds(_0x572221,_0x49dbcc){var _0x5bd1a4=moment(_0x572221)['milliseconds'](0x0);var _0x2e01eb=moment(_0x49dbcc)[_0xeabc('0x3')](0x0);return _0x5bd1a4[_0xeabc('0x4')](_0x2e01eb,'seconds');}function Final(_0x54e4a8){this[_0xeabc('0x5')]=_0x54e4a8['uniqueid'];this[_0xeabc('0x6')]=_0x54e4a8['scheduledat'];this[_0xeabc('0x7')]=_0x54e4a8[_0xeabc('0x7')];this[_0xeabc('0x8')]=_0x54e4a8['type']===_0xeabc('0x9')?_0xeabc('0xa'):_0x54e4a8[_0xeabc('0x7')];this[_0xeabc('0xb')]=_0x54e4a8[_0xeabc('0xb')];this[_0xeabc('0xc')]=_0x54e4a8[_0xeabc('0xc')];this[_0xeabc('0xd')]=_0x54e4a8[_0xeabc('0xd')];this[_0xeabc('0xe')]=_0x54e4a8[_0xeabc('0xb')]+_0x54e4a8[_0xeabc('0xc')]+_0x54e4a8[_0xeabc('0xd')]+_0x54e4a8[_0xeabc('0xf')]+_0x54e4a8[_0xeabc('0x10')]+_0x54e4a8[_0xeabc('0x11')]+_0x54e4a8['countmachineretry']+_0x54e4a8[_0xeabc('0x12')];this[_0xeabc('0xf')]=_0x54e4a8[_0xeabc('0xf')];this['countdropretry']=_0x54e4a8['countdropretry'];this[_0xeabc('0x11')]=_0x54e4a8[_0xeabc('0x11')];this[_0xeabc('0x13')]=_0x54e4a8['countmachineretry'];this[_0xeabc('0x12')]=_0x54e4a8[_0xeabc('0x12')];this['queue']=_0x54e4a8['queue'];this[_0xeabc('0x14')]=_0x54e4a8['calleridname'];this[_0xeabc('0x15')]=_0x54e4a8[_0xeabc('0x15')];this[_0xeabc('0x16')]=_0x54e4a8[_0xeabc('0x16')];this[_0xeabc('0x17')]=_0x54e4a8[_0xeabc('0x17')];this[_0xeabc('0x18')]=_0x54e4a8[_0xeabc('0x17')];this['ringtime']=_0x54e4a8[_0xeabc('0x19')]||0x0;this['holdtime']=_0x54e4a8[_0xeabc('0x1a')]||0x0;this[_0xeabc('0x1b')]=_0x54e4a8['talktime']||0x0;this[_0xeabc('0x1c')]=_0x54e4a8[_0xeabc('0x1c')];this[_0xeabc('0x1d')]=_0x54e4a8[_0xeabc('0x1d')];this[_0xeabc('0x1e')]=_0x54e4a8['callbackat'];this[_0xeabc('0x1f')]=_0x54e4a8[_0xeabc('0x1f')];this[_0xeabc('0x20')]=_0x54e4a8['ContactId'];this[_0xeabc('0x21')]=_0x54e4a8[_0xeabc('0x21')];this[_0xeabc('0x22')]=_0x54e4a8[_0xeabc('0x22')];this['VoiceQueueId']=_0x54e4a8[_0xeabc('0x23')];this['CampaignId']=_0x54e4a8[_0xeabc('0x24')];this['originatecalleridnum']=_0x54e4a8[_0xeabc('0x25')]||'';this[_0xeabc('0x26')]=_0x54e4a8[_0xeabc('0x26')]||'';}module[_0xeabc('0x27')]=Final; \ No newline at end of file +var _0xa1f6=['ListId','UserId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x40162a,_0x265b0c){var _0x488161=function(_0x9307e6){while(--_0x9307e6){_0x40162a['push'](_0x40162a['shift']());}};_0x488161(++_0x265b0c);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xa1f6[_0x3b7a0c];return _0x3bb70f;};'use strict';var util=require(_0x6a1f('0x0'));var _=require(_0x6a1f('0x1'));var moment=require(_0x6a1f('0x2'));function getSeconds(_0x28788a,_0x198e14){var _0x123ad4=moment(_0x28788a)['milliseconds'](0x0);var _0x52b77b=moment(_0x198e14)['milliseconds'](0x0);return _0x123ad4['diff'](_0x52b77b,'seconds');}function Final(_0xc7a556){this[_0x6a1f('0x3')]=_0xc7a556[_0x6a1f('0x3')];this[_0x6a1f('0x4')]=_0xc7a556[_0x6a1f('0x4')];this[_0x6a1f('0x5')]=_0xc7a556[_0x6a1f('0x5')];this['campaigntype']=_0xc7a556[_0x6a1f('0x5')]===_0x6a1f('0x6')?_0x6a1f('0x7'):_0xc7a556[_0x6a1f('0x5')];this[_0x6a1f('0x8')]=_0xc7a556['countbusyretry'];this[_0x6a1f('0x9')]=_0xc7a556[_0x6a1f('0x9')];this[_0x6a1f('0xa')]=_0xc7a556[_0x6a1f('0xa')];this['countglobal']=_0xc7a556[_0x6a1f('0x8')]+_0xc7a556['countcongestionretry']+_0xc7a556[_0x6a1f('0xa')]+_0xc7a556[_0x6a1f('0xb')]+_0xc7a556[_0x6a1f('0xc')]+_0xc7a556[_0x6a1f('0xd')]+_0xc7a556[_0x6a1f('0xe')]+_0xc7a556[_0x6a1f('0xf')];this[_0x6a1f('0xb')]=_0xc7a556[_0x6a1f('0xb')];this[_0x6a1f('0xc')]=_0xc7a556[_0x6a1f('0xc')];this[_0x6a1f('0xd')]=_0xc7a556[_0x6a1f('0xd')];this[_0x6a1f('0xe')]=_0xc7a556[_0x6a1f('0xe')];this[_0x6a1f('0xf')]=_0xc7a556[_0x6a1f('0xf')];this[_0x6a1f('0x7')]=_0xc7a556[_0x6a1f('0x7')];this[_0x6a1f('0x10')]=_0xc7a556['calleridname'];this[_0x6a1f('0x11')]=_0xc7a556[_0x6a1f('0x11')];this[_0x6a1f('0x12')]=_0xc7a556[_0x6a1f('0x12')];this[_0x6a1f('0x13')]=_0xc7a556[_0x6a1f('0x13')];this[_0x6a1f('0x14')]=_0xc7a556[_0x6a1f('0x13')];this['ringtime']=_0xc7a556[_0x6a1f('0x15')]||0x0;this['holdtime']=_0xc7a556[_0x6a1f('0x16')]||0x0;this[_0x6a1f('0x17')]=_0xc7a556[_0x6a1f('0x17')]||0x0;this[_0x6a1f('0x18')]=_0xc7a556[_0x6a1f('0x18')];this['callbackuniqueid']=_0xc7a556[_0x6a1f('0x19')];this[_0x6a1f('0x1a')]=_0xc7a556[_0x6a1f('0x1a')];this[_0x6a1f('0x1b')]=_0xc7a556[_0x6a1f('0x1b')];this[_0x6a1f('0x1c')]=_0xc7a556[_0x6a1f('0x1c')];this[_0x6a1f('0x1d')]=_0xc7a556['ListId'];this[_0x6a1f('0x1e')]=_0xc7a556[_0x6a1f('0x1e')];this['VoiceQueueId']=_0xc7a556['VoiceQueueId'];this['CampaignId']=_0xc7a556['CampaignId'];this[_0x6a1f('0x1f')]=_0xc7a556['originatecalleridnum']||'';this['originatecalleridname']=_0xc7a556[_0x6a1f('0x20')]||'';}module[_0x6a1f('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 73370f4..ee73392 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0a6=['countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry'];(function(_0x5debc1,_0x1181e1){var _0x40f05c=function(_0x43291d){while(--_0x43291d){_0x5debc1['push'](_0x5debc1['shift']());}};_0x40f05c(++_0x1181e1);}(_0xa0a6,0x1df));var _0x6a0a=function(_0x28f483,_0x43ef0e){_0x28f483=_0x28f483-0x0;var _0x5bc122=_0xa0a6[_0x28f483];return _0x5bc122;};'use strict';var util=require(_0x6a0a('0x0'));var _=require(_0x6a0a('0x1'));var moment=require(_0x6a0a('0x2'));function getSeconds(_0xd346fc,_0x42eccc){var _0x5c3e1d=moment(_0xd346fc)[_0x6a0a('0x3')](0x0);var _0x43587e=moment(_0x42eccc)[_0x6a0a('0x3')](0x0);return _0x5c3e1d[_0x6a0a('0x4')](_0x43587e,_0x6a0a('0x5'));}function Hangup(_0x2ab866,_0x27330f){this[_0x6a0a('0x6')]=0x4;this[_0x6a0a('0x7')]=_0x6a0a('0x8');this[_0x6a0a('0x9')]=_0x2ab866[_0x6a0a('0x9')];this[_0x6a0a('0xa')]=_0x2ab866[_0x6a0a('0xa')];this[_0x6a0a('0xb')]=_0x2ab866[_0x6a0a('0xa')]===_0x6a0a('0xc')?_0x6a0a('0xd'):_0x2ab866[_0x6a0a('0xa')];this[_0x6a0a('0xe')]=_0x2ab866[_0x6a0a('0xe')];this['countcongestionretry']=_0x2ab866['countcongestionretry'];this['countnoanswerretry']=_0x2ab866[_0x6a0a('0xf')];this['countglobal']=_0x2ab866['countbusyretry']+_0x2ab866['countcongestionretry']+_0x2ab866[_0x6a0a('0xf')]+_0x2ab866['countnosuchnumberretry']+_0x2ab866[_0x6a0a('0x10')]+_0x2ab866['countabandonedretry']+_0x2ab866[_0x6a0a('0x11')]+_0x2ab866[_0x6a0a('0x12')];this[_0x6a0a('0x13')]=_0x2ab866[_0x6a0a('0x13')];this[_0x6a0a('0x10')]=_0x2ab866[_0x6a0a('0x10')];this[_0x6a0a('0x14')]=_0x2ab866[_0x6a0a('0x14')];this[_0x6a0a('0x11')]=_0x2ab866[_0x6a0a('0x11')];this[_0x6a0a('0x12')]=_0x2ab866[_0x6a0a('0x12')];this['uniqueid']=_0x27330f[_0x6a0a('0x15')];this[_0x6a0a('0x16')]=_0x2ab866['name'];this[_0x6a0a('0x17')]=_0x2ab866[_0x6a0a('0x18')];this[_0x6a0a('0x19')]=_0x2ab866['starttime'];this[_0x6a0a('0x1a')]=_0x2ab866[_0x6a0a('0x1a')];this['endtime']=moment()[_0x6a0a('0x1b')](_0x6a0a('0x1c'));this[_0x6a0a('0x1d')]=getSeconds(_0x2ab866[_0x6a0a('0x1a')],_0x2ab866[_0x6a0a('0x19')]);this[_0x6a0a('0x1e')]=0x0;this[_0x6a0a('0x1f')]=getSeconds(this[_0x6a0a('0x20')],_0x2ab866['responsetime']);this[_0x6a0a('0xd')]=_0x2ab866[_0x6a0a('0xd')];this[_0x6a0a('0x21')]=_0x6a0a('0x22');this[_0x6a0a('0x23')]=_0x27330f[_0x6a0a('0x24')];this[_0x6a0a('0x25')]=_0x2ab866[_0x6a0a('0x25')];this['callbackuniqueid']=_0x2ab866[_0x6a0a('0x26')];this[_0x6a0a('0x27')]=_0x2ab866[_0x6a0a('0x27')];this['recallme']=_0x2ab866[_0x6a0a('0x28')];this['ContactId']=_0x2ab866[_0x6a0a('0x29')];this['ListId']=_0x2ab866[_0x6a0a('0x2a')];this[_0x6a0a('0x2b')]=_0x2ab866[_0x6a0a('0x2b')];this['VoiceQueueId']=_0x2ab866['VoiceQueueId'];this['CampaignId']=_0x2ab866['CampaignId'];}module[_0x6a0a('0x2c')]=Hangup; \ No newline at end of file +var _0x802a=['calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name'];(function(_0x4c02bc,_0xddb347){var _0x3dfdf4=function(_0x1c511e){while(--_0x1c511e){_0x4c02bc['push'](_0x4c02bc['shift']());}};_0x3dfdf4(++_0xddb347);}(_0x802a,0x164));var _0xa802=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x802a[_0x4e9d3c];return _0x2d0825;};'use strict';var util=require(_0xa802('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x31a184,_0x49e466){var _0x46fce3=moment(_0x31a184)[_0xa802('0x1')](0x0);var _0x469061=moment(_0x49e466)[_0xa802('0x1')](0x0);return _0x46fce3['diff'](_0x469061,_0xa802('0x2'));}function Hangup(_0xad0af5,_0x1253e1){this['state']=0x4;this[_0xa802('0x3')]=_0xa802('0x4');this['scheduledat']=_0xad0af5[_0xa802('0x5')];this[_0xa802('0x6')]=_0xad0af5[_0xa802('0x6')];this[_0xa802('0x7')]=_0xad0af5[_0xa802('0x6')]===_0xa802('0x8')?_0xa802('0x9'):_0xad0af5[_0xa802('0x6')];this['countbusyretry']=_0xad0af5[_0xa802('0xa')];this[_0xa802('0xb')]=_0xad0af5['countcongestionretry'];this[_0xa802('0xc')]=_0xad0af5[_0xa802('0xc')];this[_0xa802('0xd')]=_0xad0af5[_0xa802('0xa')]+_0xad0af5[_0xa802('0xb')]+_0xad0af5[_0xa802('0xc')]+_0xad0af5[_0xa802('0xe')]+_0xad0af5[_0xa802('0xf')]+_0xad0af5[_0xa802('0x10')]+_0xad0af5[_0xa802('0x11')]+_0xad0af5['countagentrejectretry'];this[_0xa802('0xe')]=_0xad0af5[_0xa802('0xe')];this[_0xa802('0xf')]=_0xad0af5[_0xa802('0xf')];this[_0xa802('0x10')]=_0xad0af5['countabandonedretry'];this[_0xa802('0x11')]=_0xad0af5[_0xa802('0x11')];this[_0xa802('0x12')]=_0xad0af5[_0xa802('0x12')];this[_0xa802('0x13')]=_0x1253e1[_0xa802('0x13')];this[_0xa802('0x14')]=_0xad0af5[_0xa802('0x15')];this[_0xa802('0x16')]=_0xad0af5[_0xa802('0x17')];this[_0xa802('0x18')]=_0xad0af5[_0xa802('0x18')];this['responsetime']=_0xad0af5[_0xa802('0x19')];this[_0xa802('0x1a')]=moment()[_0xa802('0x1b')](_0xa802('0x1c'));this[_0xa802('0x1d')]=getSeconds(_0xad0af5['responsetime'],_0xad0af5[_0xa802('0x18')]);this[_0xa802('0x1e')]=0x0;this[_0xa802('0x1f')]=getSeconds(this[_0xa802('0x1a')],_0xad0af5[_0xa802('0x19')]);this[_0xa802('0x9')]=_0xad0af5[_0xa802('0x9')];this['membername']=_0xa802('0x20');this[_0xa802('0x21')]=_0x1253e1['cause-txt'];this['callback']=_0xad0af5['callback'];this['callbackuniqueid']=_0xad0af5['callbackuniqueid'];this[_0xa802('0x22')]=_0xad0af5[_0xa802('0x22')];this[_0xa802('0x23')]=_0xad0af5[_0xa802('0x23')];this[_0xa802('0x24')]=_0xad0af5[_0xa802('0x24')];this[_0xa802('0x25')]=_0xad0af5[_0xa802('0x25')];this[_0xa802('0x26')]=_0xad0af5[_0xa802('0x26')];this[_0xa802('0x27')]=_0xad0af5[_0xa802('0x27')];this['CampaignId']=_0xad0af5[_0xa802('0x28')];}module[_0xa802('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 323fcda..e18ec5f 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82ee=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x3fec30,_0x19d3e8){var _0x59a169=function(_0x245ab5){while(--_0x245ab5){_0x3fec30['push'](_0x3fec30['shift']());}};_0x59a169(++_0x19d3e8);}(_0x82ee,0xeb));var _0xe82e=function(_0x35a853,_0x2733f0){_0x35a853=_0x35a853-0x0;var _0x165c06=_0x82ee[_0x35a853];return _0x165c06;};'use strict';var util=require('util');var _=require(_0xe82e('0x0'));var moment=require(_0xe82e('0x1'));function getSeconds(_0x4ef2f5,_0x1347b8){var _0xa424e8=moment(_0x4ef2f5)[_0xe82e('0x2')](0x0);var _0x1956d1=moment(_0x1347b8)[_0xe82e('0x2')](0x0);return _0xa424e8[_0xe82e('0x3')](_0x1956d1,_0xe82e('0x4'));}function History(_0x10d486){this[_0xe82e('0x5')]=_0x10d486['uniqueid'];this[_0xe82e('0x6')]=_0x10d486[_0xe82e('0x6')]||undefined;this[_0xe82e('0x7')]=_0x10d486['type'];this[_0xe82e('0x8')]=_0x10d486[_0xe82e('0x7')]===_0xe82e('0x9')?'queue':_0x10d486[_0xe82e('0x7')];this[_0xe82e('0xa')]=_0x10d486[_0xe82e('0xa')];this['countcongestionretry']=_0x10d486[_0xe82e('0xb')];this['countnoanswerretry']=_0x10d486[_0xe82e('0xc')];this['countglobal']=_0x10d486[_0xe82e('0xa')]+_0x10d486['countcongestionretry']+_0x10d486[_0xe82e('0xc')]+_0x10d486[_0xe82e('0xd')]+_0x10d486[_0xe82e('0xe')]+_0x10d486['countabandonedretry']+_0x10d486[_0xe82e('0xf')]+_0x10d486[_0xe82e('0x10')];this[_0xe82e('0xd')]=_0x10d486[_0xe82e('0xd')];this[_0xe82e('0xe')]=_0x10d486[_0xe82e('0xe')];this[_0xe82e('0x11')]=_0x10d486[_0xe82e('0x11')];this[_0xe82e('0xf')]=_0x10d486['countmachineretry'];this[_0xe82e('0x10')]=_0x10d486['countagentrejectretry'];this[_0xe82e('0x12')]=_0x10d486[_0xe82e('0x12')];this[_0xe82e('0x13')]=_0x10d486['name'];this['calleridnum']=_0x10d486['number'];this[_0xe82e('0x14')]=_0x10d486[_0xe82e('0x14')];this[_0xe82e('0x15')]=_0x10d486[_0xe82e('0x15')];this[_0xe82e('0x16')]=_0x10d486[_0xe82e('0x15')];this[_0xe82e('0x17')]=getSeconds(_0x10d486[_0xe82e('0x15')],_0x10d486['starttime']);this[_0xe82e('0x18')]=0x0;this[_0xe82e('0x19')]=0x0;this[_0xe82e('0x1a')]=_0x10d486['callback'];this['callbackuniqueid']=_0x10d486[_0xe82e('0x1b')];this[_0xe82e('0x1c')]=_0x10d486['callbackat'];this[_0xe82e('0x1d')]=_0x10d486[_0xe82e('0x1d')];this[_0xe82e('0x1e')]=_0x10d486['ContactId'];this[_0xe82e('0x1f')]=_0x10d486[_0xe82e('0x1f')];this[_0xe82e('0x20')]=_0x10d486['UserId'];this['VoiceQueueId']=_0x10d486[_0xe82e('0x21')];this[_0xe82e('0x22')]=_0x10d486['CampaignId'];this[_0xe82e('0x23')]=_0x10d486[_0xe82e('0x23')]||'';this[_0xe82e('0x24')]=_0x10d486[_0xe82e('0x24')]||'';}module[_0xe82e('0x25')]=History; \ No newline at end of file +var _0xf889=['callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x326318,_0x35715c){var _0x432e29=function(_0x358f34){while(--_0x358f34){_0x326318['push'](_0x326318['shift']());}};_0x432e29(++_0x35715c);}(_0xf889,0x1aa));var _0x9f88=function(_0x4186f6,_0x373c4e){_0x4186f6=_0x4186f6-0x0;var _0x3ee006=_0xf889[_0x4186f6];return _0x3ee006;};'use strict';var util=require(_0x9f88('0x0'));var _=require('lodash');var moment=require(_0x9f88('0x1'));function getSeconds(_0xecacde,_0x30283d){var _0x26a484=moment(_0xecacde)['milliseconds'](0x0);var _0x4d98e5=moment(_0x30283d)['milliseconds'](0x0);return _0x26a484[_0x9f88('0x2')](_0x4d98e5,_0x9f88('0x3'));}function History(_0x30ea14){this['uniqueid']=_0x30ea14[_0x9f88('0x4')];this[_0x9f88('0x5')]=_0x30ea14[_0x9f88('0x5')]||undefined;this[_0x9f88('0x6')]=_0x30ea14[_0x9f88('0x6')];this[_0x9f88('0x7')]=_0x30ea14['type']===_0x9f88('0x8')?_0x9f88('0x9'):_0x30ea14[_0x9f88('0x6')];this[_0x9f88('0xa')]=_0x30ea14['countbusyretry'];this[_0x9f88('0xb')]=_0x30ea14[_0x9f88('0xb')];this[_0x9f88('0xc')]=_0x30ea14['countnoanswerretry'];this[_0x9f88('0xd')]=_0x30ea14[_0x9f88('0xa')]+_0x30ea14['countcongestionretry']+_0x30ea14[_0x9f88('0xc')]+_0x30ea14[_0x9f88('0xe')]+_0x30ea14['countdropretry']+_0x30ea14[_0x9f88('0xf')]+_0x30ea14[_0x9f88('0x10')]+_0x30ea14[_0x9f88('0x11')];this[_0x9f88('0xe')]=_0x30ea14['countnosuchnumberretry'];this[_0x9f88('0x12')]=_0x30ea14[_0x9f88('0x12')];this['countabandonedretry']=_0x30ea14[_0x9f88('0xf')];this[_0x9f88('0x10')]=_0x30ea14[_0x9f88('0x10')];this[_0x9f88('0x11')]=_0x30ea14[_0x9f88('0x11')];this['queue']=_0x30ea14[_0x9f88('0x9')];this['calleridname']=_0x30ea14[_0x9f88('0x13')];this[_0x9f88('0x14')]=_0x30ea14[_0x9f88('0x15')];this[_0x9f88('0x16')]=_0x30ea14[_0x9f88('0x16')];this[_0x9f88('0x17')]=_0x30ea14['responsetime'];this[_0x9f88('0x18')]=_0x30ea14['responsetime'];this[_0x9f88('0x19')]=getSeconds(_0x30ea14[_0x9f88('0x17')],_0x30ea14[_0x9f88('0x16')]);this[_0x9f88('0x1a')]=0x0;this[_0x9f88('0x1b')]=0x0;this['callback']=_0x30ea14[_0x9f88('0x1c')];this[_0x9f88('0x1d')]=_0x30ea14[_0x9f88('0x1d')];this[_0x9f88('0x1e')]=_0x30ea14[_0x9f88('0x1e')];this['recallme']=_0x30ea14[_0x9f88('0x1f')];this[_0x9f88('0x20')]=_0x30ea14['ContactId'];this[_0x9f88('0x21')]=_0x30ea14[_0x9f88('0x21')];this['UserId']=_0x30ea14[_0x9f88('0x22')];this['VoiceQueueId']=_0x30ea14['VoiceQueueId'];this[_0x9f88('0x23')]=_0x30ea14[_0x9f88('0x23')];this['originatecalleridnum']=_0x30ea14['originatecalleridnum']||'';this[_0x9f88('0x24')]=_0x30ea14['originatecalleridname']||'';}module[_0x9f88('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 46a3509..b895415 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 _0xcfac=['dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','starttime','endtime','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countglobal','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','actionid','paused','locked','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','command','iftime\x20%s,%s','interval','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-CAMPAIGNID','tags','createdAt','%s%s','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','Action','SIP/%s/%s%s','trim','dialCutDigit','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','countbusyretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','createStateFinal','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','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','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','Contact.phone','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','agents','trunks','maxNumberOriginate','uniqueId','ivrOriginated','agentconnect','syncAgentConnect','bind','queuecallerabandon','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','emit','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','voice:queue:%s','voice_queue:save','type','ivr','format','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','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','---------------------------','merge','diff','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','[actions]','undefined','channel','updateOriginated','queue','[Dialer][checkChannel]','campaigns','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','outboundAnswerCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','HANGUP','statedesc','[syncHangupInAMDIvr]','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','[syncHangupIvr]','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime'];(function(_0xad8b64,_0x33b4d0){var _0x3aabe3=function(_0x38d2ee){while(--_0x38d2ee){_0xad8b64['push'](_0xad8b64['shift']());}};_0x3aabe3(++_0x33b4d0);}(_0xcfac,0x105));var _0xccfa=function(_0x1ceea6,_0xe9b348){_0x1ceea6=_0x1ceea6-0x0;var _0x150c6c=_0xcfac[_0x1ceea6];return _0x150c6c;};'use strict';var util=require(_0xccfa('0x0'));var _=require(_0xccfa('0x1'));var BPromise=require(_0xccfa('0x2'));var uuid=require(_0xccfa('0x3'));var moment=require(_0xccfa('0x4'));var rr=require('rr');var md5=require(_0xccfa('0x5'));var Redis=require(_0xccfa('0x6'));var ut=require(_0xccfa('0x7'));var config=require(_0xccfa('0x8'));var logger=require('../../../config/logger')(_0xccfa('0x9'));var loggerBooked=require(_0xccfa('0xa'))(_0xccfa('0xb'));var loggerPredictive=require(_0xccfa('0xa'))(_0xccfa('0xc'));var loggerPredictiveCalls=require(_0xccfa('0xa'))(_0xccfa('0xd'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xccfa('0xe'));var ami=require(_0xccfa('0xf'));config[_0xccfa('0x10')]=_[_0xccfa('0x11')](config[_0xccfa('0x10')],{'host':'localhost','port':0x18eb});var io=require(_0xccfa('0x12'))(new Redis(config[_0xccfa('0x10')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xccfa('0x13'));var cmHopperBlack=require(_0xccfa('0x14'));var voiceQueueRt=require(_0xccfa('0x15'));var Action=require(_0xccfa('0x16'));var History=require(_0xccfa('0x17'));var Final=require('./final');var AgentComplete=require(_0xccfa('0x18'));var QueueCallerAbandon=require(_0xccfa('0x19'));var Hangup=require(_0xccfa('0x1a'));var ipAgi=process[_0xccfa('0x1b')][_0xccfa('0x1c')]||_0xccfa('0x1d');var strategy={'rrmemory':_0xccfa('0x1e'),'roundrobin':_0xccfa('0x1f')};var Sequence=function(){};Sequence[_0xccfa('0x20')][_0xccfa('0x21')]=function(_0x24a7ec){this[_0xccfa('0x22')]=this['tail']?this[_0xccfa('0x22')][_0xccfa('0x23')](_0x24a7ec):_0x24a7ec();};function Dialer(_0x53416b,_0x513e25){this[_0xccfa('0x24')]=new Sequence();this['preview']=_0x513e25;this[_0xccfa('0x25')]=_0x53416b[_0xccfa('0x25')];this['campaigns']=_0x53416b['campaigns'];this[_0xccfa('0x26')]=_0x53416b[_0xccfa('0x26')];this[_0xccfa('0x27')]=_0x53416b[_0xccfa('0x27')];this[_0xccfa('0x28')]=config[_0xccfa('0x28')]||0x2;this['channels']={};this['actions']={};this['contactsId']={};this[_0xccfa('0x29')]={};this['optionPredictive']={};this['startPredictive']={};this['startProgressive']={};this[_0xccfa('0x2a')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0xccfa('0x2b'),this[_0xccfa('0x2c')][_0xccfa('0x2d')](this));ami['on'](_0xccfa('0x2e'),this['syncQueueCallerAbandon'][_0xccfa('0x2d')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0xccfa('0x2f'),this[_0xccfa('0x30')][_0xccfa('0x2d')](this));ami['on']('custom:queuesummary',this[_0xccfa('0xe')][_0xccfa('0x2d')](this));ami['on'](_0xccfa('0x31'),this[_0xccfa('0x32')][_0xccfa('0x2d')](this));ami['on'](_0xccfa('0x33'),this[_0xccfa('0x34')][_0xccfa('0x2d')](this));ami['on']('varset',this[_0xccfa('0x35')][_0xccfa('0x2d')](this));ami['on'](_0xccfa('0x36'),this[_0xccfa('0x37')][_0xccfa('0x2d')](this));ami['on'](_0xccfa('0x38'),this[_0xccfa('0x39')][_0xccfa('0x2d')](this));this[_0xccfa('0x3a')]();this['loopClearZombieChannels']();}function isNotNull(_0x19fd9d){return _0x19fd9d!==null&&!_[_0xccfa('0x3b')](_0x19fd9d);}function checkIsLoggedIn(_0x28d008,_0x3b1488){return function(){if(_0x3b1488<=0x0){_0x28d008[_0xccfa('0x3c')]=_0xccfa('0x3d');throw _0x28d008[_0xccfa('0x3e')]+_0xccfa('0x3f');}};}function isActive(_0x1ab983){return _0x1ab983;}function checkIsActive(_0x44b8b9,_0x30a140){return function(){if(!isActive(_0x30a140)){_0x44b8b9[_0xccfa('0x3c')]=_0xccfa('0x40');throw _0x44b8b9[_0xccfa('0x3e')]+_0xccfa('0x41');}};}function checkInterval(_0x4c69b4){return function(){if(!isNotNull(_0x4c69b4[_0xccfa('0x42')])){_0x4c69b4[_0xccfa('0x3c')]='INTERVAL_IS_NULL';throw _0x4c69b4['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4c69b4[_0xccfa('0x42')][_0xccfa('0x43')])){_0x4c69b4[_0xccfa('0x3c')]=_0xccfa('0x44');throw _0x4c69b4['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xccfa('0x45')](_0x4c69b4[_0xccfa('0x42')]['Intervals']))){_0x4c69b4['message']='INTERVAL_IS_NULL';throw _0x4c69b4[_0xccfa('0x3e')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x5ad596,_0x437b37,_0x22a71b){return{'action':_0x5ad596,'response':_0x437b37,'message':_0x22a71b,'stack':_0x22a71b};}function myreject(_0xc91491){return function(_0x395590){return _0xc91491(msgResponse(_0xccfa('0x46'),_0xccfa('0x47'),JSON[_0xccfa('0x48')](_0x395590)));};}function getSeconds(_0x111a29,_0x244f38){var _0x2e4cb1=moment(_0x111a29)[_0xccfa('0x49')](0x0);var _0x541ac1=moment(_0x244f38)[_0xccfa('0x49')](0x0);return _0x2e4cb1['diff'](_0x541ac1,'seconds');}function emit(_0x5f0120,_0x12709f,_0x30ae4f){io['to'](_0x5f0120)[_0xccfa('0x4a')](_0x12709f,_0x30ae4f);}function emitVoiceQueueSummary(_0x4cc8e7){if(_0x4cc8e7['type']==='outbound'){var _0xb5b894={'id':_0x4cc8e7['id'],'name':_0x4cc8e7[_0xccfa('0x3e')],'strategy':_0x4cc8e7[_0xccfa('0x4b')],'answered':_0x4cc8e7[_0xccfa('0x4c')],'available':_0x4cc8e7[_0xccfa('0x4d')],'loggedIn':_0x4cc8e7[_0xccfa('0x4e')],'pTalking':_0x4cc8e7[_0xccfa('0x4f')],'sumBillable':_0x4cc8e7[_0xccfa('0x50')],'sumDuration':_0x4cc8e7[_0xccfa('0x51')],'sumHoldTime':_0x4cc8e7[_0xccfa('0x52')]||0x0,'talking':_0x4cc8e7[_0xccfa('0x53')],'total':_0x4cc8e7['total'],'type':_0x4cc8e7['type'],'unmanaged':_0x4cc8e7['unmanaged'],'abandoned':_0x4cc8e7[_0xccfa('0x54')],'waiting':_0x4cc8e7[_0xccfa('0x55')],'loggedInDb':_0x4cc8e7[_0xccfa('0x56')],'dialActive':_0x4cc8e7[_0xccfa('0x57')],'dialMethod':_0x4cc8e7[_0xccfa('0x58')],'dialOriginateCallerIdName':_0x4cc8e7['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4cc8e7[_0xccfa('0x59')],'dialOriginateTimeout':_0x4cc8e7[_0xccfa('0x5a')],'dialPrefix':_0x4cc8e7[_0xccfa('0x5b')],'outboundAnswerAgiCallsDay':_0x4cc8e7[_0xccfa('0x5c')],'outboundAnswerCallsDay':_0x4cc8e7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4cc8e7['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4cc8e7[_0xccfa('0x5d')],'outboundCongestionCallsDay':_0x4cc8e7[_0xccfa('0x5e')],'outboundDropCallsDayACS':_0x4cc8e7[_0xccfa('0x5f')],'outboundDropCallsDayCallersExit':_0x4cc8e7[_0xccfa('0x60')],'outboundDropCallsDayTimeout':_0x4cc8e7[_0xccfa('0x61')],'outboundNoAnswerCallsDay':_0x4cc8e7['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4cc8e7[_0xccfa('0x62')],'outboundOriginateFailureCallsDay':_0x4cc8e7[_0xccfa('0x63')],'outboundReCallsDay':_0x4cc8e7[_0xccfa('0x64')],'outboundRejectCallsDay':_0x4cc8e7['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4cc8e7[_0xccfa('0x65')],'predictiveIntervalAnsweredCalls':_0x4cc8e7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4cc8e7['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4cc8e7[_0xccfa('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x4cc8e7[_0xccfa('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x4cc8e7[_0xccfa('0x68')],'predictiveIntervalErlangCalls':_0x4cc8e7[_0xccfa('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x4cc8e7[_0xccfa('0x6a')],'predictiveIntervalHitRate':_0x4cc8e7[_0xccfa('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x4cc8e7['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4cc8e7[_0xccfa('0x6c')],'predictiveIntervalAvailable':_0x4cc8e7['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4cc8e7['predictiveIntervalTotalCalls'],'message':_0x4cc8e7[_0xccfa('0x3c')],'originated':_0x4cc8e7[_0xccfa('0x6d')],'erlangCalls':_0x4cc8e7[_0xccfa('0x6e')],'erlangCallToSecond':_0x4cc8e7[_0xccfa('0x6f')],'erlangAbandonmentRate':_0x4cc8e7[_0xccfa('0x70')],'erlangBusyFactor':_0x4cc8e7[_0xccfa('0x71')],'startPredictive':_0x4cc8e7[_0xccfa('0x72')],'startProgressive':_0x4cc8e7[_0xccfa('0x73')]};if(_0x4cc8e7[_0xccfa('0x74')]){_0xb5b894[_0xccfa('0x74')]={'id':_0x4cc8e7[_0xccfa('0x74')]['id'],'name':_0x4cc8e7[_0xccfa('0x74')][_0xccfa('0x3e')],'active':_0x4cc8e7[_0xccfa('0x74')]['active'],'callerid':_0x4cc8e7[_0xccfa('0x74')][_0xccfa('0x75')]};}if(_0x4cc8e7[_0xccfa('0x42')]){_0xb5b894['Interval']={'id':_0x4cc8e7['Interval']['id'],'name':_0x4cc8e7[_0xccfa('0x42')][_0xccfa('0x3e')]};}var _0x3d9d85=md5(JSON['stringify'](_0xb5b894));if(_0x4cc8e7['md5']!==_0x3d9d85){_0x4cc8e7[_0xccfa('0x5')]=_0x3d9d85;emit(util['format'](_0xccfa('0x76'),_0xb5b894['name']),_0xccfa('0x77'),_0xb5b894);}}}function emitCampaignSummary(_0x573c45){if(_0x573c45[_0xccfa('0x78')]===_0xccfa('0x79')){emit(util[_0xccfa('0x7a')](_0xccfa('0x7b'),_0x573c45[_0xccfa('0x3e')]),_0xccfa('0x7c'),_0x573c45);}}function checkGetDataPredictive(_0x2428e7){if(isNotNull(_0x2428e7)&&!_[_0xccfa('0x45')](_0x2428e7)){loggerPredictive['info'](_0xccfa('0x7d'));loggerPredictive[_0xccfa('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2428e7[_0xccfa('0x7f')]);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x80'),_0x2428e7[_0xccfa('0x81')]);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x82'),_0x2428e7[_0xccfa('0x68')]);loggerPredictive[_0xccfa('0x7e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2428e7[_0xccfa('0x67')]);loggerPredictive[_0xccfa('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2428e7[_0xccfa('0x83')]);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x84'),_0x2428e7[_0xccfa('0x66')]);loggerPredictive[_0xccfa('0x7e')]('---------------------------');if(_0x2428e7['predictiveIntervalTotalCalls']>0x0){if(!_[_0xccfa('0x3b')](_0x2428e7[_0xccfa('0x66')])&&_0x2428e7[_0xccfa('0x66')]>0x0){return!![];}loggerPredictive['info'](_0xccfa('0x85'));if(!_[_0xccfa('0x3b')](_0x2428e7['predictiveIntervalAvgHoldtime'])&&_0x2428e7[_0xccfa('0x83')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xccfa('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x86'));}return![];}function mergeDataErlangB(_0x1f8799){return function(_0x398fc9){loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x87'));loggerPredictive['info'](_0xccfa('0x88'),_0x398fc9[_0xccfa('0x6e')]);loggerPredictive[_0xccfa('0x7e')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x398fc9[_0xccfa('0x6f')]);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x89'),_0x398fc9[_0xccfa('0x70')]);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x8a'),_0x398fc9[_0xccfa('0x71')]);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x89'),_0x398fc9[_0xccfa('0x70')]);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x8b'));_[_0xccfa('0x8c')](_0x1f8799,_0x398fc9);};}function getDiff(_0x1b6515){var _0x2d43bd=moment()[_0xccfa('0x49')](0x0);var _0x177f96=moment(_0x1b6515)[_0xccfa('0x49')](0x0);return _0x2d43bd[_0xccfa('0x8d')](_0x177f96,_0xccfa('0x8e'));}function ifInterval(_0x2bf09e,_0x47586d){if(_[_0xccfa('0x3b')](_0x47586d)){return![];}return getDiff(_0x47586d)<_0x2bf09e*0x3c;}function freeVariablesPredictive(_0x46c59a){if(isNotNull(_0x46c59a)){if(!_[_0xccfa('0x3b')](_0x46c59a[_0xccfa('0x73')])){_0x46c59a['startProgressive']=undefined;loggerPredictive[_0xccfa('0x7e')](_0x46c59a[_0xccfa('0x3e')],_0xccfa('0x8f'));}if(!_[_0xccfa('0x3b')](_0x46c59a[_0xccfa('0x72')])){_0x46c59a[_0xccfa('0x72')]=undefined;loggerPredictive[_0xccfa('0x7e')](_0x46c59a[_0xccfa('0x3e')],_0xccfa('0x90'));}if(!_[_0xccfa('0x3b')](_0x46c59a[_0xccfa('0x91')])){clearInterval(_0x46c59a['handlePredictive']);_0x46c59a[_0xccfa('0x91')]=undefined;loggerPredictive[_0xccfa('0x7e')](_0x46c59a[_0xccfa('0x3e')],_0xccfa('0x92'));}}}function erlangb(_0x10d25f,_0xaa751a){if(_0xaa751a===0x0){return 0x0;}var _0x453a5=0x1;for(var _0x354553=0x1;_0x354553<=_0xaa751a;_0x354553+=0x1){_0x453a5=0x1+_0x453a5*_0x354553/_0x10d25f;}return 0x1/_0x453a5;}function isVoiceQueueOutbound(_0x26ce49){return _0x26ce49==='outbound';}function isNotPreview(_0x245609){return _0x245609!==_0xccfa('0x93');}function isCampaignIvr(_0x216fa9){return _0x216fa9==='ivr';}function getCallerId(_0x4e19af,_0x1e8fee,_0x298dd4){if(!_['isUndefined'](_0x298dd4)&&typeof _0x298dd4===_0xccfa('0x94')&&!_[_0xccfa('0x45')](_0x298dd4)){if(!_['isUndefined'](_0x1e8fee)&&typeof _0x1e8fee===_0xccfa('0x94')&&!_[_0xccfa('0x45')](_0x1e8fee)){return util[_0xccfa('0x7a')](_0xccfa('0x95'),_0x1e8fee,_0x298dd4);}return util['format'](_0xccfa('0x95'),_0x298dd4,_0x298dd4);}if(!_[_0xccfa('0x3b')](_0x4e19af)&&typeof _0x4e19af===_0xccfa('0x94')&&!_['isEmpty'](_0x4e19af)){return _0x4e19af;}return _0xccfa('0x96');}function loggerCatchQueueSummary(_0x12bd0a,_0x585005){return function(_0x3e4d8e){freeVariablesPredictive(_0x585005);emitVoiceQueueSummary(_0x585005);emitCampaignSummary(_0x585005);loggerSyncQueueSummary[_0xccfa('0x97')](_0x12bd0a,util[_0xccfa('0x98')](_0x3e4d8e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x56bd4c,_0x3b7772){return function(_0x5445ba){loggerPredictive[_0xccfa('0x97')](_0x3b7772[_0xccfa('0x3e')],_0x56bd4c);loggerPredictive[_0xccfa('0x97')](_0x5445ba[_0xccfa('0x99')]);freeVariablesPredictive(_0x3b7772);};}function loggerCatch(_0x2caf0f){return function(_0x976d37){logger[_0xccfa('0x97')](_0x2caf0f,util[_0xccfa('0x98')](_0x976d37,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x23203a){return _0x23203a&&!_[_0xccfa('0x3b')](_0x23203a)&&_0x23203a['length']>0x0;}function decremetOriginate(_0x40b7b3){if(!_[_0xccfa('0x3b')](_0x40b7b3)&&_0x40b7b3!==null){if(typeof _0x40b7b3[_0xccfa('0x6d')]!=='undefined'){if(_0x40b7b3[_0xccfa('0x6d')]>0x0){_0x40b7b3[_0xccfa('0x6d')]-=0x1;}else{logger[_0xccfa('0x97')](_0xccfa('0x9a'));}}}else{logger[_0xccfa('0x97')](_0xccfa('0x9b'));}}function checkContactLowerLimitOriginate(_0x2a5107,_0x3effb5,_0x5bb10e){if(_0x3effb5>_0x5bb10e){for(var _0x571356=0x0;_0x571356<_0x3effb5-_0x5bb10e;_0x571356+=0x1){decremetOriginate(_0x2a5107);}}}function loggerGetContactDialer(_0x440542,_0x73ae1e,_0x3dd159){return function(_0x365bd9){checkContactLowerLimitOriginate(_0x73ae1e,_0x3dd159,0x0);logger['error'](_0x440542,util[_0xccfa('0x98')](_0x365bd9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5206e0){return function(_0x5c72d3){if(isNotNull(_0x5c72d3)&&isNotNull(_0x5c72d3[0x0])){if(_0x5c72d3[0x0][_0xccfa('0x9c')]>0x0){_0x5206e0[_0xccfa('0x3c')]=_0xccfa('0x9d');logger[_0xccfa('0x7e')]('[getContactDialer2][ReScheduled]'+_0x5206e0[_0xccfa('0x3e')],_0x5c72d3[0x0][_0xccfa('0x9c')],'contacts');}else{_0x5206e0['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xccfa('0x7e')]('[getContactDialer2][Empty]'+_0x5206e0['name']);}}};}function notSendMessagesQueue(_0x3079f2){if(_0x3079f2[_0xccfa('0x9e')]){freeVariablesPredictive(_0x3079f2);if(_0x3079f2[_0xccfa('0x6d')]===0x0&&_0x3079f2[_0xccfa('0x53')]===0x0&&_0x3079f2['waiting']===0x0&&(_0x3079f2[_0xccfa('0x4f')]||0x0)===0x0){_0x3079f2['sendMessageOneNotActive']=![];_0x3079f2[_0xccfa('0x4d')]=0x0;_0x3079f2[_0xccfa('0x3c')]=_0xccfa('0x40');loggerSyncQueueSummary[_0xccfa('0x97')](_0xccfa('0x9f'),_0x3079f2[_0xccfa('0x3e')],_0xccfa('0xa0'));}else{_0x3079f2['message']=_0xccfa('0xa1');loggerSyncQueueSummary[_0xccfa('0x97')](_0xccfa('0x9f'),_0x3079f2[_0xccfa('0x3e')],_0xccfa('0xa2'));}emitVoiceQueueSummary(_0x3079f2);}}function notSendMessagesCampaign(_0x564922){if(_0x564922[_0xccfa('0x9e')]){if(_0x564922[_0xccfa('0x6d')]===0x0){_0x564922[_0xccfa('0x9e')]=![];_0x564922[_0xccfa('0x3c')]='NOT_ACTIVE';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x564922[_0xccfa('0x3e')],_0xccfa('0xa0'));}else{_0x564922['message']=_0xccfa('0xa1');loggerSyncQueueSummary[_0xccfa('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x564922[_0xccfa('0x3e')],_0xccfa('0xa2'));}emitCampaignSummary(_0x564922);}}function createObjHistory(_0x4e62a3,_0x5552ec,_0x16ee17,_0x4e4ac6,_0x42c96c){_0x4e62a3[_0xccfa('0x3c')]=_0x16ee17;var _0x19fa43=new Action(_0x4e62a3,_0x5552ec);var _0x340ee7=new History(_0x19fa43);_0x340ee7[_0xccfa('0xa3')]=_0x4e4ac6;_0x340ee7['statedesc']=_0x42c96c;_0x340ee7['endtime']=_0x19fa43['starttime'];return _0x340ee7;}Dialer[_0xccfa('0x20')][_0xccfa('0xa4')]=function(){var _0x27fd93=this;setInterval(function(){_0x27fd93[_0xccfa('0xa5')](_0x27fd93[_0xccfa('0x29')],_0xccfa('0xa6'));_0x27fd93['clearZombieChannels'](_0x27fd93[_0xccfa('0xa7')],_0xccfa('0xa8'));},0x32c8);};Dialer[_0xccfa('0x20')][_0xccfa('0xa5')]=function(_0x3ebeff,_0x54c1cf){var _0x4ac293=this;for(var _0x3b0132 in _0x3ebeff){if(typeof _0x3ebeff[_0x3b0132]!==_0xccfa('0xa9')){this['sequence'][_0xccfa('0x21')](function(){if(!_['isNil'](_0x3ebeff[_0x3b0132])){return ami['Action']({'action':'status','channel':_0x3ebeff[_0x3b0132][_0xccfa('0xaa')]})['catch'](function(_0x2aad2b){if(_0x2aad2b['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3ebeff[_0x3b0132]&&_0x3ebeff[_0x3b0132]['type']!=='ivr'){_0x4ac293[_0xccfa('0xab')](_0x4ac293[_0xccfa('0x25')][_0x3ebeff[_0x3b0132][_0xccfa('0xac')]]);logger['error'](_0xccfa('0xad'),_0x54c1cf,_0x3b0132,_0x3ebeff[_0x3b0132]['queue']);delete _0x3ebeff[_0x3b0132];}if(_0x3ebeff[_0x3b0132]&&_0x3ebeff[_0x3b0132][_0xccfa('0x78')]===_0xccfa('0x79')){_0x4ac293[_0xccfa('0xab')](_0x4ac293[_0xccfa('0xae')][_0x3ebeff[_0x3b0132]['queue']]);logger['error'](_0xccfa('0xaf'),_0x54c1cf,_0x3b0132,_0x3ebeff[_0x3b0132]['queue']);delete _0x3ebeff[_0x3b0132];}},0x2328);}});}});}}};Dialer[_0xccfa('0x20')][_0xccfa('0xb0')]=function(_0x4a3697){return BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](cmHopper[_0xccfa('0xb0')](_0x4a3697))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xb4')));};Dialer[_0xccfa('0x20')]['checkIsBlackList']=function(_0x361c67){return BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](cmHopperBlack[_0xccfa('0xb5')](_0x361c67))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xb6')));};Dialer[_0xccfa('0x20')]['checkIsBlackListIvr']=function(_0x932472){return BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](cmHopperBlack[_0xccfa('0xb7')](_0x932472))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xb8')));};Dialer[_0xccfa('0x20')][_0xccfa('0xb9')]=function(_0x23098c){return BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](cmHopperHistory['avgHandleTime'](_0x23098c))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xba')));};Dialer[_0xccfa('0x20')][_0xccfa('0xbb')]=function(_0x25d75a){return BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](cmHopper[_0xccfa('0xbb')](_0x25d75a))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xbc')));};Dialer['prototype'][_0xccfa('0xbd')]=function(_0x4b9cc2,_0x24f019,_0x4ad76b){return BPromise[_0xccfa('0xb1')]()['then'](cmHopper['unlockContact'](_0x4b9cc2,_0x24f019,_0x4ad76b))['catch'](loggerCatch(_0xccfa('0xbe')));};Dialer[_0xccfa('0x20')][_0xccfa('0xbf')]=function(_0x508b4b,_0x480b7b,_0xe7a52c,_0x13f815,_0x3f0b88){return BPromise[_0xccfa('0xb1')]()['then'](cmHopper[_0xccfa('0xbf')](_0x508b4b,_0x480b7b,_0xe7a52c,_0x13f815))[_0xccfa('0xb3')](function(_0x38160b){_0x3f0b88[_0xccfa('0xc0')]-=_0xe7a52c;_0x3f0b88[_0xccfa('0xc0')]=_0x3f0b88['temp']>0x0?_0x3f0b88[_0xccfa('0xc0')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x38160b);});};Dialer[_0xccfa('0x20')][_0xccfa('0xc1')]=function(_0x13ce37,_0x1e710e,_0x24aaf9,_0x218077){return BPromise[_0xccfa('0xb1')]()['then'](cmHopper['getContactDialerIvr'](_0x13ce37,_0x1e710e,_0x24aaf9))[_0xccfa('0xb3')](function(_0x19dc8a){_0x218077[_0xccfa('0xc0')]-=_0x1e710e;_0x218077[_0xccfa('0xc0')]=_0x218077[_0xccfa('0xc0')]>0x0?_0x218077[_0xccfa('0xc0')]:0x0;loggerCatch(_0xccfa('0xc2'))(_0x19dc8a);});};Dialer['prototype'][_0xccfa('0xc3')]=function(_0x52f7d9){return BPromise['resolve']()[_0xccfa('0xb2')](voiceQueueRt['getVoiceQueueRtPauses'](_0x52f7d9))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xc4')));};Dialer[_0xccfa('0x20')][_0xccfa('0xc5')]=function(_0x233e73){return BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](cmHopper[_0xccfa('0xc5')](_0x233e73))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xc6')));};Dialer['prototype'][_0xccfa('0xc7')]=function(_0x20d97e){return BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](cmHopperHistory[_0xccfa('0xc7')](_0x20d97e))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xc8')));};Dialer[_0xccfa('0x20')][_0xccfa('0xab')]=function(_0x2fe17d){if(!_[_0xccfa('0x3b')](_0x2fe17d)&&_0x2fe17d!==null){if(typeof _0x2fe17d[_0xccfa('0x6d')]!=='undefined'){if(_0x2fe17d[_0xccfa('0x6d')]>0x0){_0x2fe17d['originated']-=0x1;}else{logger['error'](_0xccfa('0xc9'));}}}else{logger[_0xccfa('0x97')](_0xccfa('0xca'));}};Dialer[_0xccfa('0x20')][_0xccfa('0xcb')]=function(_0x24e228,_0x10b801){var _0x2ffdf3=this;return function(_0x5813ac){_0x2ffdf3['updateOriginated'](_0x10b801);logger['error'](_0x24e228,util[_0xccfa('0x98')](_0x5813ac,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xccfa('0xcc')]=function(_0x44006d,_0x5ad735,_0x293de9){var _0xb3b04a={'state':0x19,'statedesc':_0xccfa('0xcd')};this[_0xccfa('0xab')](_0x5ad735);this[_0xccfa('0xce')](_['merge'](_0xb3b04a,_[_0xccfa('0xcf')](_0x293de9,[_0xccfa('0xd0'),_0xccfa('0xd1'),_0xccfa('0xd2'),'VoiceQueueId',_0xccfa('0xd3')])),_0xccfa('0xd4'),_0xccfa('0xd5'));logger[_0xccfa('0x97')](_0x44006d);};Dialer[_0xccfa('0x20')][_0xccfa('0xd6')]=function(_0x19eb2e){return _0x19eb2e===_0xccfa('0xd7');};Dialer['prototype'][_0xccfa('0xd8')]=function(_0x4d7b32){return!_['isUndefined'](_0x4d7b32)&&_0x4d7b32&&!_[_0xccfa('0x3b')](_0x4d7b32[_0xccfa('0x3e')])&&!_[_0xccfa('0x3b')](_0x4d7b32[_0xccfa('0xd9')])&&_0x4d7b32['active']&&(this[_0xccfa('0x27')][util[_0xccfa('0x7a')](_0xccfa('0xda'),_0x4d7b32[_0xccfa('0x3e')])][_0xccfa('0xdb')]===_0xccfa('0xdc')||this[_0xccfa('0x27')][util[_0xccfa('0x7a')](_0xccfa('0xda'),_0x4d7b32[_0xccfa('0x3e')])][_0xccfa('0xdb')]===_0xccfa('0xdd'));};Dialer[_0xccfa('0x20')][_0xccfa('0xce')]=function(_0x56ea9b,_0x420a3c,_0x46e643){this[_0xccfa('0xc7')](_0x56ea9b)['catch'](loggerCatch(_0x420a3c));this[_0xccfa('0xc5')](_0x56ea9b)[_0xccfa('0xb3')](loggerCatch(_0x46e643));};Dialer['prototype'][_0xccfa('0x35')]=function(_0xb1c00d){var _0x3137ce=this['uniqueId'][_0xb1c00d[_0xccfa('0xde')]];var _0x5672f9;if(!_[_0xccfa('0xdf')](_0xb1c00d)&&!_[_0xccfa('0xdf')](_0xb1c00d[_0xccfa('0xe0')])&&!_[_0xccfa('0xdf')](_0xb1c00d[_0xccfa('0xe0')][_0xccfa('0xe1')])&&_0xb1c00d[_0xccfa('0xe2')]===_0xccfa('0xe3')&&_0x3137ce){if(_0x3137ce[_0xccfa('0x78')]!==_0xccfa('0x79')&&this[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]]['dialAMDActive']&&_0xb1c00d['value']==='HANGUP'){delete this[_0xccfa('0x29')][_0xb1c00d[_0xccfa('0xde')]];this[_0xccfa('0xab')](this[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]]);this[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]][_0xccfa('0xe4')]+=0x1;this[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]][_0xccfa('0x5c')]+=0x1;_0x5672f9=new Hangup(_0x3137ce,_0xb1c00d);_0x5672f9[_0xccfa('0xa3')]=0x12;_0x5672f9['statedesc']=_0xccfa('0xe5');_0x5672f9[_0xccfa('0xe6')]=_0xccfa('0xe7');ami[_0xccfa('0x4a')](_0xccfa('0xe8'),ut[_0xccfa('0xe9')](_0x5672f9,_0xccfa('0xea')));this[_0xccfa('0xce')](_0x5672f9,_0xccfa('0xeb'),_0xccfa('0xec'));}if(_0x3137ce[_0xccfa('0x78')]!=='ivr'&&this[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]][_0xccfa('0xed')]&&_0xb1c00d[_0xccfa('0xee')]===_0xccfa('0xef')){var _0x27dc4e=this;return new BPromise(function(_0x5b177c,_0x2b07e2){delete _0x27dc4e[_0xccfa('0x29')][_0xb1c00d['uniqueid']];_0x27dc4e[_0xccfa('0xab')](_0x27dc4e[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]]);_0x27dc4e[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]][_0xccfa('0xe4')]+=0x1;_0x27dc4e[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]][_0xccfa('0x5c')]+=0x1;var _0x5e91fb=_0x27dc4e[_0xccfa('0x25')][_0x3137ce[_0xccfa('0xac')]];var _0x50ba5f=new Hangup(_0x3137ce,_0xb1c00d);_0x50ba5f[_0xccfa('0xa3')]=0x13;_0x50ba5f['statedesc']=_0xccfa('0xf0');_0x50ba5f[_0xccfa('0xe6')]=_0xccfa('0xe7');_0x50ba5f[_0xccfa('0xf1')]+=0x1;_0x50ba5f['countglobal']+=0x1;_0x50ba5f['amd']=!![];ami[_0xccfa('0x4a')](_0xccfa('0xe8'),ut['buildObj'](_0x50ba5f,'amd'));_0x27dc4e['createHistory'](_0x50ba5f)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xf2')));if(_0x50ba5f['countbusyretry']+_0x50ba5f[_0xccfa('0xf3')]+_0x50ba5f[_0xccfa('0xf4')]+_0x50ba5f[_0xccfa('0xf5')]+_0x50ba5f[_0xccfa('0xf6')]+_0x50ba5f[_0xccfa('0xf7')]+_0x50ba5f[_0xccfa('0xf1')]+_0x50ba5f[_0xccfa('0xf8')]>=_0x5e91fb['dialGlobalMaxRetry']){_0x27dc4e[_0xccfa('0xf9')](_0x50ba5f,_0x5b177c,_0x2b07e2,_0xccfa('0xfa'));}else{if(_0x50ba5f[_0xccfa('0xf1')]>=_0x5e91fb[_0xccfa('0xfb')]){_0x27dc4e['createStateFinal'](_0x50ba5f,_0x5b177c,_0x2b07e2,'reason\x2019\x20machine....');}else{_0x27dc4e[_0xccfa('0xbb')]({'active':![],'countmachineretry':_0x50ba5f[_0xccfa('0xf1')],'scheduledat':moment()[_0xccfa('0xfc')](_0x5e91fb[_0xccfa('0xfd')],_0xccfa('0xfe'))[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x50ba5f[_0xccfa('0xd0')],'ListId':_0x50ba5f[_0xccfa('0xd1')],'VoiceQueueId':_0x50ba5f[_0xccfa('0x100')]||undefined,'CampaignId':_0x50ba5f[_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch('[rescheduleContact][Machine]'));_0x5b177c({'reschedule':0x1});}}});}if(_0x3137ce[_0xccfa('0x78')]===_0xccfa('0x79')&&this[_0xccfa('0xae')][_0x3137ce['queue']]['dialAMDActive']&&_0xb1c00d[_0xccfa('0xee')]===_0xccfa('0x101')){delete this['uniqueId'][_0xb1c00d[_0xccfa('0xde')]];this['updateOriginated'](this[_0xccfa('0xae')][_0x3137ce['queue']]);_0x5672f9=new Hangup(_0x3137ce,_0xb1c00d);_0x5672f9[_0xccfa('0xa3')]=0x12;_0x5672f9[_0xccfa('0x102')]=_0xccfa('0xe5');_0x5672f9[_0xccfa('0xe6')]=_0xccfa('0xe7');ami['emit']('custom:amd',ut[_0xccfa('0xe9')](_0x5672f9,_0xccfa('0xea')));this[_0xccfa('0xce')](_0x5672f9,'[syncHangupInAMDIvr][createHistory]',_0xccfa('0x103'));}if(_0x3137ce[_0xccfa('0x78')]==='ivr'&&this['campaigns'][_0x3137ce['queue']][_0xccfa('0xed')]&&_0xb1c00d[_0xccfa('0xee')]==='MACHINE'){var _0x27dc4e=this;return new BPromise(function(_0x616116,_0x331440){delete _0x27dc4e['uniqueId'][_0xb1c00d[_0xccfa('0xde')]];_0x27dc4e['updateOriginated'](_0x27dc4e['campaigns'][_0x3137ce[_0xccfa('0xac')]]);_0x27dc4e[_0xccfa('0xae')][_0x3137ce['queue']][_0xccfa('0xe4')]+=0x1;_0x27dc4e[_0xccfa('0xae')][_0x3137ce['queue']][_0xccfa('0x5c')]+=0x1;var _0x2c8832=_0x27dc4e[_0xccfa('0xae')][_0x3137ce[_0xccfa('0xac')]];var _0x50dd15=new Hangup(_0x3137ce,_0xb1c00d);_0x50dd15[_0xccfa('0xa3')]=0x13;_0x50dd15[_0xccfa('0x102')]=_0xccfa('0xf0');_0x50dd15[_0xccfa('0xe6')]=_0xccfa('0xe7');_0x50dd15['countmachineretry']+=0x1;_0x50dd15['countglobal']+=0x1;_0x50dd15[_0xccfa('0xea')]=!![];ami['emit']('custom:amd',ut[_0xccfa('0xe9')](_0x50dd15,_0xccfa('0xea')));_0x27dc4e[_0xccfa('0xc7')](_0x50dd15)[_0xccfa('0xb3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x50dd15['countbusyretry']+_0x50dd15['countcongestionretry']+_0x50dd15[_0xccfa('0xf4')]+_0x50dd15[_0xccfa('0xf5')]+_0x50dd15[_0xccfa('0xf6')]+_0x50dd15['countabandonedretry']+_0x50dd15[_0xccfa('0xf1')]+_0x50dd15[_0xccfa('0xf8')]>=_0x2c8832['dialGlobalMaxRetry']){_0x27dc4e[_0xccfa('0xf9')](_0x50dd15,_0x616116,_0x331440,'reason19\x20machine....');}else{if(_0x50dd15['countmachineretry']>=_0x2c8832[_0xccfa('0xfb')]){_0x27dc4e['createStateFinal'](_0x50dd15,_0x616116,_0x331440,_0xccfa('0x104'));}else{_0x27dc4e[_0xccfa('0xbb')]({'active':![],'countmachineretry':_0x50dd15['countmachineretry'],'scheduledat':moment()[_0xccfa('0xfc')](_0x2c8832[_0xccfa('0xfd')],'minutes')[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x50dd15['ContactId'],'ListId':_0x50dd15[_0xccfa('0xd1')],'VoiceQueueId':_0x50dd15['VoiceQueueId']||undefined,'CampaignId':_0x50dd15[_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch('[rescheduleContact][Machine]'));_0x616116({'reschedule':0x1});}}});}}};Dialer[_0xccfa('0x20')]['syncHangup']=function(_0x696f80){var _0x33e09f=this[_0xccfa('0x29')][_0x696f80[_0xccfa('0xde')]];var _0x468453=this;var _0x194aea;if(_0x33e09f&&_0x33e09f[_0xccfa('0x78')]===_0xccfa('0x79')){delete this[_0xccfa('0x29')][_0x696f80[_0xccfa('0xde')]];this['updateOriginated'](this[_0xccfa('0xae')][_0x33e09f[_0xccfa('0xac')]]);this['campaigns'][_0x33e09f['queue']][_0xccfa('0x105')]+=0x1;_0x194aea=new Hangup(_0x33e09f,_0x696f80);this['createHistory'](_0x194aea)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x106')));this[_0xccfa('0xc5')](_0x194aea)[_0xccfa('0xb3')](loggerCatch('[syncHangupIvr]'));}if(_0x33e09f&&_0x33e09f['type']!==_0xccfa('0x79')&&isNotNull(this[_0xccfa('0x25')][_0x33e09f[_0xccfa('0xac')]][_0xccfa('0x107')])){delete this[_0xccfa('0x29')][_0x696f80[_0xccfa('0xde')]];this[_0xccfa('0xab')](this['voiceQueues'][_0x33e09f['queue']]);this[_0xccfa('0x25')][_0x33e09f[_0xccfa('0xac')]]['outboundAnswerCallsDay']+=0x1;this[_0xccfa('0x25')][_0x33e09f[_0xccfa('0xac')]]['outboundAnswerAgiCallsDay']+=0x1;_0x194aea=new Hangup(_0x33e09f,_0x696f80);_0x194aea['state']=0x10;_0x194aea[_0xccfa('0x102')]='AnswerAGI';_0x194aea[_0xccfa('0xe6')]='AGI';this[_0xccfa('0xc7')](_0x194aea)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x106')));this[_0xccfa('0xc5')](_0x194aea)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x108')));}if(_0x33e09f&&_0x33e09f[_0xccfa('0x78')]!=='ivr'&&!isNotNull(this[_0xccfa('0x25')][_0x33e09f['queue']][_0xccfa('0x107')])){delete this['uniqueId'][_0x696f80[_0xccfa('0xde')]];this[_0xccfa('0xab')](this[_0xccfa('0x25')][_0x33e09f[_0xccfa('0xac')]]);this[_0xccfa('0x25')][_0x33e09f[_0xccfa('0xac')]]['outboundUnknownCallsDay']+=0x1;_0x194aea=new Hangup(_0x33e09f,_0x696f80);_0x194aea['state']=0xc;_0x194aea[_0xccfa('0x102')]=_0x696f80[_0xccfa('0x109')];_0x194aea['membername']=_0xccfa('0x10a');this[_0xccfa('0xc7')](_0x194aea)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x106')));this[_0xccfa('0xc5')](_0x194aea)[_0xccfa('0xb3')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xccfa('0x20')][_0xccfa('0x30')]=function(_0x1fe31b){var _0x2d0daf=this[_0xccfa('0x29')][_0x1fe31b['uniqueid']];var _0x1d43e3=this;if(this[_0xccfa('0x25')][_0x1fe31b[_0xccfa('0xac')]]){if(_0x2d0daf&&_0x2d0daf['type']!==_0xccfa('0x79')){delete this[_0xccfa('0x29')][_0x1fe31b[_0xccfa('0xde')]];this['voiceQueues'][_0x1fe31b['queue']][_0xccfa('0xe4')]+=0x1;var _0x105357=new AgentComplete(_0x2d0daf,_0x1fe31b);if(_0x1fe31b[_0xccfa('0x10b')]==='agent'){_0x105357[_0xccfa('0x10c')]=this[_0xccfa('0x25')][_0x1fe31b[_0xccfa('0xac')]][_0xccfa('0x10d')]&&this['voiceQueues'][_0x1fe31b[_0xccfa('0xac')]][_0xccfa('0x10e')]?moment()[_0xccfa('0x7a')](_0xccfa('0xff')):undefined;}this[_0xccfa('0xc7')](_0x105357)[_0xccfa('0xb3')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xccfa('0xc5')](_0x105357)['catch'](loggerCatch(_0xccfa('0x10f')));}}};Dialer[_0xccfa('0x20')][_0xccfa('0x2c')]=function(_0x2eae24){if(this[_0xccfa('0x25')][_0x2eae24['queue']]){if(this[_0xccfa('0x29')][_0x2eae24[_0xccfa('0xde')]]&&this[_0xccfa('0x29')][_0x2eae24['uniqueid']][_0xccfa('0x78')]!==_0xccfa('0x79')){this['updateOriginated'](this['voiceQueues'][_0x2eae24[_0xccfa('0xac')]]);this['uniqueId'][_0x2eae24[_0xccfa('0xde')]][_0xccfa('0x110')]=moment()[_0xccfa('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xccfa('0x20')][_0xccfa('0x111')]=function(_0x46e29d){this[_0xccfa('0xc7')](_0x46e29d)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x112')));this[_0xccfa('0xc5')](_0x46e29d)['catch'](loggerCatch(_0xccfa('0x113')));};Dialer[_0xccfa('0x20')][_0xccfa('0x114')]=function(_0x33a78f){var _0x48473b=this[_0xccfa('0x29')][_0x33a78f[_0xccfa('0xde')]];var _0x2c5764=this;if(this[_0xccfa('0x25')][_0x33a78f[_0xccfa('0xac')]]){if(_0x48473b&&_0x48473b[_0xccfa('0x78')]!==_0xccfa('0x79')){delete this['uniqueId'][_0x33a78f[_0xccfa('0xde')]];this[_0xccfa('0xab')](this[_0xccfa('0x25')][_0x33a78f[_0xccfa('0xac')]]);_0x48473b[_0xccfa('0x115')]=moment()[_0xccfa('0x7a')](_0xccfa('0xff'));var _0x153290=new QueueCallerAbandon(_0x48473b,_0x33a78f);if(getSeconds(_0x48473b[_0xccfa('0x115')],_0x48473b['responsetime'])>=_0x48473b['dialQueueTimeout']){this[_0xccfa('0x25')][_0x33a78f[_0xccfa('0xac')]][_0xccfa('0x68')]+=0x1;this[_0xccfa('0x25')][_0x33a78f['queue']][_0xccfa('0x61')]+=0x1;this['voiceQueues'][_0x33a78f[_0xccfa('0xac')]][_0xccfa('0x6a')]+=0x1;_0x153290[_0xccfa('0xa3')]=0xa;_0x153290[_0xccfa('0x102')]='Drop';_0x153290[_0xccfa('0x116')]=_0xccfa('0x117');_0x153290[_0xccfa('0x10c')]=this[_0xccfa('0x25')][_0x33a78f['queue']][_0xccfa('0x10d')]?moment()[_0xccfa('0x7a')](_0xccfa('0xff')):undefined;_0x153290[_0xccfa('0xf6')]+=0x1;_0x153290['countglobal']+=0x1;if(_0x153290[_0xccfa('0xf6')]>=this[_0xccfa('0x25')][_0x33a78f[_0xccfa('0xac')]]['dialDropMaxRetry']){this[_0xccfa('0x111')](_0x153290);}else{this[_0xccfa('0xbb')]({'active':![],'countdropretry':_0x153290[_0xccfa('0xf6')],'scheduledat':moment()[_0xccfa('0xfc')](this['voiceQueues'][_0x33a78f[_0xccfa('0xac')]][_0xccfa('0x118')],_0xccfa('0xfe'))[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x48473b[_0xccfa('0xd0')],'ListId':_0x48473b[_0xccfa('0xd1')],'VoiceQueueId':_0x48473b[_0xccfa('0x100')]||undefined,'CampaignId':_0x48473b[_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x119')));var _0x44bad9=new History(_0x153290);_0x44bad9[_0xccfa('0xa3')]=0xa;_0x44bad9[_0xccfa('0x102')]=_0xccfa('0x11a');_0x44bad9[_0xccfa('0x11b')]=moment()[_0xccfa('0x7a')](_0xccfa('0xff'));_0x44bad9[_0xccfa('0x11c')]=_0x44bad9['starttime'];_0x44bad9['calleridname']=_0x153290['calleridname'];_0x44bad9['calleridnum']=_0x153290[_0xccfa('0x11d')];this[_0xccfa('0xc7')](_0x44bad9)['catch'](loggerCatch(_0xccfa('0x11e')));}}else{this[_0xccfa('0x25')][_0x33a78f[_0xccfa('0xac')]][_0xccfa('0x67')]+=0x1;this[_0xccfa('0x25')][_0x33a78f[_0xccfa('0xac')]]['outboundDropCallsDayCallersExit']+=0x1;_0x153290[_0xccfa('0xa3')]=0xb;_0x153290[_0xccfa('0x102')]=_0xccfa('0x11f');_0x153290['dropreason']=_0xccfa('0x120');_0x153290[_0xccfa('0xf7')]+=0x1;_0x153290[_0xccfa('0x121')]+=0x1;if(_0x153290[_0xccfa('0xf7')]>=this[_0xccfa('0x25')][_0x33a78f[_0xccfa('0xac')]]['dialAbandonedMaxRetry']){this[_0xccfa('0x111')](_0x153290);}else{this[_0xccfa('0xbb')]({'active':![],'countabandonedretry':_0x153290[_0xccfa('0xf7')],'scheduledat':moment()['add'](this['voiceQueues'][_0x33a78f[_0xccfa('0xac')]]['dialAbandonedRetryFrequency'],_0xccfa('0xfe'))[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x48473b[_0xccfa('0xd0')],'ListId':_0x48473b[_0xccfa('0xd1')],'VoiceQueueId':_0x48473b[_0xccfa('0x100')]||undefined,'CampaignId':_0x48473b[_0xccfa('0xd3')]||undefined})['catch'](loggerCatch(_0xccfa('0x122')));var _0x44bad9=new History(_0x153290);_0x44bad9[_0xccfa('0xa3')]=0xb;_0x44bad9[_0xccfa('0x102')]=_0xccfa('0x11f');_0x44bad9[_0xccfa('0x11b')]=moment()[_0xccfa('0x7a')](_0xccfa('0xff'));_0x44bad9[_0xccfa('0x11c')]=_0x44bad9['starttime'];_0x44bad9[_0xccfa('0x123')]=_0x153290['calleridname'];_0x44bad9[_0xccfa('0x11d')]=_0x153290[_0xccfa('0x11d')];this['createHistory'](_0x44bad9)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x124')));}}}}};Dialer[_0xccfa('0x20')][_0xccfa('0x34')]=function(_0xab9d5f){if(this[_0xccfa('0xa7')][_0xab9d5f[_0xccfa('0xde')]]){this['actions'][_0xab9d5f[_0xccfa('0xde')]]['channel']=_0xab9d5f[_0xccfa('0xaa')];}if(this[_0xccfa('0x29')][_0xab9d5f[_0xccfa('0xde')]]){this[_0xccfa('0x29')][_0xab9d5f[_0xccfa('0xde')]][_0xccfa('0xaa')]=_0xab9d5f[_0xccfa('0xaa')];}};Dialer[_0xccfa('0x20')][_0xccfa('0x37')]=function(_0x4e8bfa){if(strategy[this['voiceQueues'][this[_0xccfa('0xa7')][_0x4e8bfa['actionid']]['queue']][_0xccfa('0x4b')]]===_0xccfa('0x1f')){if(this[_0xccfa('0xa7')][_0x4e8bfa[_0xccfa('0x125')]]&&_[_0xccfa('0xdf')](this['actions'][_0x4e8bfa[_0xccfa('0x125')]]['locked'])&&_0x4e8bfa[_0xccfa('0xdb')]==='1'&&_0x4e8bfa[_0xccfa('0x126')]==='0'){if(this[_0xccfa('0x26')][_0x4e8bfa['stateinterface']]){if(!this['agents'][_0x4e8bfa['stateinterface']][_0xccfa('0x127')]){this[_0xccfa('0x26')][_0x4e8bfa['stateinterface']][_0xccfa('0x127')]=!![];this[_0xccfa('0xa7')][_0x4e8bfa[_0xccfa('0x125')]][_0xccfa('0x127')]=!![];this[_0xccfa('0xa7')][_0x4e8bfa[_0xccfa('0x125')]]['stateinterface']=_0x4e8bfa[_0xccfa('0x128')];}}}}else if((strategy[this[_0xccfa('0x25')][this['actions'][_0x4e8bfa['actionid']][_0xccfa('0xac')]][_0xccfa('0x4b')]]||_0xccfa('0x1e'))===_0xccfa('0x1e')){if(this[_0xccfa('0xa7')][_0x4e8bfa['actionid']]){if(this[_0xccfa('0x26')][_0x4e8bfa['stateinterface']]){this['actions'][_0x4e8bfa['actionid']]['stateinterface']=_0x4e8bfa[_0xccfa('0x128')];if(_[_0xccfa('0xdf')](this[_0xccfa('0x129')][this[_0xccfa('0xa7')][_0x4e8bfa[_0xccfa('0x125')]][_0xccfa('0xac')]])){this[_0xccfa('0x129')][this[_0xccfa('0xa7')][_0x4e8bfa[_0xccfa('0x125')]][_0xccfa('0xac')]]=[];}this['queueBooked'][this['actions'][_0x4e8bfa[_0xccfa('0x125')]][_0xccfa('0xac')]][_0xccfa('0x12a')](_[_0xccfa('0x8c')](_['pick'](this['actions'][_0x4e8bfa[_0xccfa('0x125')]],[_0xccfa('0x12b'),'stateinterface']),{'status':_0x4e8bfa[_0xccfa('0xdb')],'paused':_0x4e8bfa['paused']}));}}}};function unlockQueueStatus(_0x20fb5b,_0x3fe435){setTimeout(function(){if(_['isUndefined'](_0x20fb5b[_0xccfa('0x12c')])){loggerBooked[_0xccfa('0x97')](_0xccfa('0x12d'),_0x3fe435);}_0x20fb5b[_0xccfa('0x12c')]=!![];loggerBooked[_0xccfa('0x7e')](_0xccfa('0x12e'),_0x3fe435,JSON[_0xccfa('0x48')](_['pick'](_0x20fb5b,[_0xccfa('0x3e'),_0xccfa('0x12c')])));},0x1f3);}Dialer[_0xccfa('0x20')]['syncQueueStatusComplete']=function(_0x4f78aa){var _0x266866=this;var _0x17794b=_0x266866['voiceQueues'][_0x266866[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]];if(strategy[this['voiceQueues'][this[_0xccfa('0xa7')][_0x4f78aa['actionid']][_0xccfa('0xac')]][_0xccfa('0x4b')]]===_0xccfa('0x1f')){if(this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]]&&this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0x128')]){this[_0xccfa('0x93')][_0xccfa('0x12f')](this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0x12b')],this[_0xccfa('0xa7')][_0x4f78aa['actionid']][_0xccfa('0x128')])[_0xccfa('0xb3')](function(_0x305b1a){logger[_0xccfa('0x97')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xccfa('0x98')](_0x305b1a,{'showHidden':![],'depth':null}));})[_0xccfa('0x23')](function(){_0x266866[_0xccfa('0xab')](_0x266866['voiceQueues'][_0x266866['actions'][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]]);_0x266866[_0xccfa('0x26')][_0x266866['actions'][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0x128')]][_0xccfa('0x127')]=![];delete _0x266866[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]];unlockQueueStatus(_0x17794b);});}else{this[_0xccfa('0xab')](this[_0xccfa('0x25')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]]['ContactId'],'ListId':this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xd1')],'VoiceQueueId':this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0x100')]||undefined,'CampaignId':this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x130')));delete this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]];unlockQueueStatus(_0x17794b);}}else if((strategy[this[_0xccfa('0x25')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]][_0xccfa('0x4b')]]||_0xccfa('0x1e'))===_0xccfa('0x1e')){var _0x2bc206;if(this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]]&&!_['isEmpty'](this[_0xccfa('0x129')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]])){if(this[_0xccfa('0x131')][_0x266866[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]]){this[_0xccfa('0x131')][_0x266866[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]]=this[_0xccfa('0x131')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]]?this[_0xccfa('0x131')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]]:this[_0xccfa('0x129')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]]?this[_0xccfa('0x129')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]][_0xccfa('0x132')]||0x0:0x0;}this[_0xccfa('0x129')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]]['_rr']=this[_0xccfa('0x131')][this[_0xccfa('0xa7')][_0x4f78aa[_0xccfa('0x125')]][_0xccfa('0xac')]];for(var _0x2119df=0x0;_0x2119df=0x0;})[_0xccfa('0xb3')](myreject(_0x570174)));}}else{_0xaed532[_0xccfa('0x12a')](ami['Action']({'action':_0xccfa('0x14a'),'command':util[_0xccfa('0x7a')]('iftime\x20%s,%s',_0x543db9,!_[_0xccfa('0x3b')](config[_0xccfa('0x145')][_0x275426])?_0x275426:'')})[_0xccfa('0xb2')](function(_0x54cbda){return _0x54cbda[_0xccfa('0x14d')][_0xccfa('0x14e')]('true')>=0x0;})[_0xccfa('0xb3')](myreject(_0x570174)));}BPromise['all'](_0xaed532)[_0xccfa('0xb2')](function(_0x10ed02){var _0x750e4c=_[_0xccfa('0x150')](_0x10ed02);if(_0x750e4c){return _0x5e78ed(_0x750e4c);}else{_0x2e5c18['message']=_0x5a533d?_0xccfa('0x151'):_0xccfa('0x152');return _0x570174(msgResponse('[ifTime][promiseAll]',_0xccfa('0x143'),_0xccfa('0x153')+_0x5a533d+'\x20'+_0x380684+_0xccfa('0x154')+util[_0xccfa('0x98')](_0x543db9,{'showHidden':![],'depth':null})+_0xccfa('0x155')+_0x275426));}})[_0xccfa('0xb3')](function(_0x453d56){return _0x570174(msgResponse(_0xccfa('0x142'),'Failure',JSON['stringify'](_0x453d56)));});});};Dialer['prototype'][_0xccfa('0x156')]=function(_0x22fc75){var _0x44c6a6=this;return function(){switch(_0x22fc75[_0xccfa('0x58')]){case _0xccfa('0x157'):freeVariablesPredictive(_0x22fc75);_0x44c6a6[_0xccfa('0x158')](_0x22fc75,0x1);break;case _0xccfa('0x159'):freeVariablesPredictive(_0x22fc75);_0x44c6a6[_0xccfa('0x158')](_0x22fc75,_0x22fc75['dialPowerLevel']);break;case'predictive':_0x44c6a6[_0xccfa('0xc')](_0x22fc75);break;case _0xccfa('0xb'):freeVariablesPredictive(_0x22fc75);_0x44c6a6[_0xccfa('0x158')](_0x22fc75,0x1);break;default:freeVariablesPredictive(_0x22fc75);logger[_0xccfa('0x97')](_0xccfa('0x15a'),_0x22fc75[_0xccfa('0x3e')],_0xccfa('0x15b'));}};};Dialer[_0xccfa('0x20')][_0xccfa('0x15c')]=function(_0x1e6142){var _0x512324=this;return function(){_0x512324[_0xccfa('0x15d')](_0x1e6142);};};Dialer[_0xccfa('0x20')][_0xccfa('0xe')]=function(_0x2af6f2){var _0x452b5b=this;if(isNotPreview(_0x2af6f2[_0xccfa('0x58')])){if(isVoiceQueueOutbound(_0x2af6f2[_0xccfa('0x78')])&&isActive(_0x2af6f2[_0xccfa('0x57')])){_0x2af6f2[_0xccfa('0x9e')]=!![];BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](checkIsLoggedIn(_0x2af6f2,_0x2af6f2[_0xccfa('0x4e')]))[_0xccfa('0xb2')](checkIsActive(_0x2af6f2,_0x2af6f2[_0xccfa('0x57')]))[_0xccfa('0xb2')](checkInterval(_0x2af6f2))[_0xccfa('0xb2')](_0x452b5b[_0xccfa('0x13d')](_0x2af6f2))['then'](_0x452b5b['checkIfTime'](_0x2af6f2[_0xccfa('0x15e')],_0x2af6f2[_0xccfa('0x15f')],_0x2af6f2['name'],_0x2af6f2))[_0xccfa('0xb2')](_0x452b5b[_0xccfa('0x160')](_0x2af6f2[_0xccfa('0x42')],_0x2af6f2[_0xccfa('0x15f')],_0x2af6f2['name'],_0x2af6f2))['then'](_0x452b5b[_0xccfa('0x156')](_0x2af6f2))[_0xccfa('0xb3')](loggerCatchQueueSummary(_0xccfa('0x161'),_0x2af6f2));}else{notSendMessagesQueue(_0x2af6f2);}}else{freeVariablesPredictive(_0x2af6f2);}};Dialer[_0xccfa('0x20')][_0xccfa('0x13c')]=function(){var _0x151cc8=this;var _0x4debc0;for(var _0x148f52 in this[_0xccfa('0xae')]){if(typeof this[_0xccfa('0xae')][_0x148f52]!=='undefined'){_0x4debc0=this['campaigns'][_0x148f52];if(isCampaignIvr(_0x4debc0[_0xccfa('0x78')])&&isActive(_0x4debc0[_0xccfa('0xd9')])){_0x4debc0[_0xccfa('0x9e')]=!![];BPromise[_0xccfa('0xb1')]()[_0xccfa('0xb2')](checkIsActive(_0x4debc0,_0x4debc0[_0xccfa('0xd9')]))[_0xccfa('0xb2')](checkInterval(_0x4debc0))[_0xccfa('0xb2')](_0x151cc8[_0xccfa('0x13d')](_0x4debc0))[_0xccfa('0xb2')](_0x151cc8[_0xccfa('0x141')](_0x4debc0[_0xccfa('0x15e')],_0x4debc0[_0xccfa('0x15f')],_0x4debc0[_0xccfa('0x3e')],_0x4debc0))[_0xccfa('0xb2')](_0x151cc8[_0xccfa('0x160')](_0x4debc0[_0xccfa('0x42')],_0x4debc0[_0xccfa('0x15f')],_0x4debc0['name'],_0x4debc0))[_0xccfa('0xb2')](_0x151cc8['launchHandleIvr'](_0x4debc0))['catch'](loggerCatchQueueSummary(_0xccfa('0x162'),_0x4debc0));}else{notSendMessagesCampaign(_0x4debc0);}}}};function getCallerIdRandom(_0x2a2e40,_0x2db1c8){var _0x4905c8;var _0x2bc1ee;var _0xc45b9e;if(_0x2db1c8<=0x0){_0x2db1c8=0x1;}_0x4905c8=new RegExp('\x5cw{0,'+_0x2db1c8+'}$');_0x2bc1ee=Math['pow'](0xa,_0x2db1c8-0x1);_0xc45b9e=Math[_0xccfa('0x163')](0xa,_0x2db1c8)-0x1;return util[_0xccfa('0x7a')]('%s',_[_0xccfa('0x164')](_0x2a2e40,_0x4905c8,_[_0xccfa('0x165')](_0x2bc1ee,_0xc45b9e)));}function extractCalleridName(_0xa2671a){var _0xfa1567=_0xa2671a['match'](/"(.*?)"/);return _0xfa1567?_0xfa1567[0x1]:_0xa2671a;}function extractCalleridNumber(_0x61c663){var _0x290d46=_0x61c663[_0xccfa('0x166')](/<(.*?)>/);return _0x290d46?_0x290d46[0x1]:_0x61c663;}Dialer[_0xccfa('0x20')][_0xccfa('0x167')]=function(_0x542388,_0x3a6060){var _0x23be07=this;var _0x40a8b0=uuid['v4']();this[_0xccfa('0xa7')][_0x40a8b0]=new Action(_0x542388,_0x3a6060,_0x40a8b0);return new BPromise(function(_0x187a13,_0x30babe){if(_['isUndefined'](_0x542388)&&typeof _0x542388!=='object'){return _0x30babe(msgResponse(_0xccfa('0x168'),_0xccfa('0x143'),_0xccfa('0x169')));}if(_[_0xccfa('0x3b')](_0x3a6060[_0xccfa('0x16a')][_0xccfa('0x16b')])||_0x3a6060[_0xccfa('0x16a')][_0xccfa('0x16b')]===null){return _0x30babe(msgResponse(_0xccfa('0x168'),'Failure',_0xccfa('0x16c')));}var _0x2ce1cb={'XMD-CALLERID':_0x23be07['actions'][_0x40a8b0][_0xccfa('0x16d')](),'XMD-AGI':_0x542388['dialQueueProject']?util['format'](_0xccfa('0x16e'),ipAgi,_0x542388[_0xccfa('0x107')]):_0xccfa('0x16f'),'XMD-AGIAFTER':_0x542388[_0xccfa('0x10d')]?util[_0xccfa('0x7a')](_0xccfa('0x16e'),ipAgi,_0x542388['dialQueueProject2']):_0xccfa('0x16f'),'XMD-QUEUE':_0x542388[_0xccfa('0x78')]===_0xccfa('0x170')?util[_0xccfa('0x7a')](_0xccfa('0x171'),_0x542388[_0xccfa('0x3e')],_0x542388['dialQueueOptions']||'',_0x542388[_0xccfa('0x10e')]?'c':'',_0x542388['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x3a6060[_0xccfa('0xd0')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x23be07['actions'][_0x40a8b0]['getCaller'](),'XMD-AMD':_0x542388[_0xccfa('0xed')]?_0xccfa('0x172'):_0xccfa('0x16f'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x542388['dialAMDActive']){_0x2ce1cb['XMD-AMDINITIALSILENCE']=_0x542388[_0xccfa('0x173')]||0x9c4;_0x2ce1cb[_0xccfa('0x174')]=_0x542388['dialAMDGreeting']||0x5dc;_0x2ce1cb[_0xccfa('0x175')]=_0x542388[_0xccfa('0x176')]||0x320;_0x2ce1cb[_0xccfa('0x177')]=_0x542388[_0xccfa('0x178')]||0x1388;_0x2ce1cb[_0xccfa('0x179')]=_0x542388[_0xccfa('0x17a')]||0x64;_0x2ce1cb[_0xccfa('0x17b')]=_0x542388[_0xccfa('0x17c')]||0x32;_0x2ce1cb['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x542388[_0xccfa('0x17d')]||0x3;_0x2ce1cb[_0xccfa('0x17e')]=_0x542388[_0xccfa('0x17f')]||0x100;_0x2ce1cb['XMD-AMDMAXIMUMWORDLENGTH']=_0x542388['dialAMDMaximumWordLength']||0x1388;}if(_0x542388[_0xccfa('0x78')]===_0xccfa('0x170')){_0x2ce1cb['XMD-VOICEQUEUEID']=_0x3a6060[_0xccfa('0x100')];}else{_0x2ce1cb[_0xccfa('0x180')]=_0x3a6060['CampaignId'];}for(var _0x5b70dd in _0x3a6060[_0xccfa('0x16a')]){if(typeof _0x3a6060['Contact'][_0x5b70dd]!==_0xccfa('0xa9')){if(isNotNull(_0x3a6060['Contact'][_0x5b70dd])&&_0x5b70dd!=='id'&&_0x5b70dd!==_0xccfa('0x181')&&_0x5b70dd!==_0xccfa('0x182')&&_0x5b70dd!=='updatedAt'){_0x2ce1cb[util['format'](_0xccfa('0x183'),'XMD-',_['toUpper'](_0x5b70dd))]=_0x3a6060[_0xccfa('0x16a')][_0x5b70dd];}}}var _0x309601=_0x23be07[_0xccfa('0xd8')](_0x542388['Trunk'])?getCallerId(_0x542388[_0xccfa('0x74')][_0xccfa('0x75')],_0x542388['dialOriginateCallerIdName'],_0x542388[_0xccfa('0x184')]>0x0?getCallerIdRandom(_0x542388[_0xccfa('0x59')],_0x542388['dialRandomLastDigitCallerIdNumber']):_0x542388[_0xccfa('0x59')]):getCallerId(_['isNil'](_0x542388['TrunkBackup'])?_0x542388[_0xccfa('0x74')][_0xccfa('0x75')]:_0x542388[_0xccfa('0x13e')][_0xccfa('0x75')],_0x542388['dialOriginateCallerIdName'],_0x542388[_0xccfa('0x184')]>0x0?getCallerIdRandom(_0x542388[_0xccfa('0x59')],_0x542388[_0xccfa('0x184')]):_0x542388['dialOriginateCallerIdNumber']);if(_0x309601){_0x2ce1cb['XMD-ORIGINATECALLERIDNAME']=_0x23be07[_0xccfa('0xa7')][_0x40a8b0][_0xccfa('0x185')]=extractCalleridName(_0x309601);_0x2ce1cb[_0xccfa('0x186')]=_0x23be07[_0xccfa('0xa7')][_0x40a8b0][_0xccfa('0x187')]=extractCalleridNumber(_0x309601);}return ami[_0xccfa('0x188')]({'actionid':_0x40a8b0,'action':'originate','channel':_0x23be07[_0xccfa('0xd8')](_0x542388[_0xccfa('0x74')])?util['format'](_0xccfa('0x189'),_0x542388[_0xccfa('0x74')]['name'],isNotNull(_0x542388[_0xccfa('0x5b')])?_0x542388[_0xccfa('0x5b')][_0xccfa('0x18a')]()||'':'',_0x542388[_0xccfa('0x18b')]>0x0?_0x3a6060[_0xccfa('0x16a')]['phone']['substring'](_0x542388['dialCutDigit']):_0x3a6060[_0xccfa('0x16a')][_0xccfa('0x16b')]):util[_0xccfa('0x7a')](_0xccfa('0x189'),_['isNil'](_0x542388[_0xccfa('0x13e')])?_0x542388[_0xccfa('0x74')][_0xccfa('0x3e')]:_0x542388[_0xccfa('0x13e')][_0xccfa('0x3e')],isNotNull(_0x542388[_0xccfa('0x5b')])?_0x542388[_0xccfa('0x5b')][_0xccfa('0x18a')]()||'':'',_0x542388[_0xccfa('0x18b')]>0x0?_0x3a6060[_0xccfa('0x16a')][_0xccfa('0x16b')]['substring'](_0x542388[_0xccfa('0x18b')]):_0x3a6060[_0xccfa('0x16a')]['phone']),'callerid':_0x309601,'Exten':_0xccfa('0xe3'),'Context':'from-sip','Priority':'1','variable':_0x2ce1cb,'timeout':(_0x542388[_0xccfa('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x40a8b0})[_0xccfa('0xb2')](function(_0x27b426){return _0x187a13(_0x27b426);})[_0xccfa('0xb3')](function(_0x4d00e3){_0x542388[_0xccfa('0x63')]+=0x1;var _0x136d9c=new History(_0x23be07[_0xccfa('0xa7')][_0x40a8b0]);logger['error'](util[_0xccfa('0x7a')](_0xccfa('0x18c'),JSON['stringify'](_0x4d00e3)));_0x136d9c[_0xccfa('0xa3')]=0xe;_0x136d9c[_0xccfa('0x102')]=_0xccfa('0x18d');_0x136d9c[_0xccfa('0x11b')]=moment()[_0xccfa('0x7a')](_0xccfa('0xff'));_0x136d9c[_0xccfa('0x11c')]=_0x136d9c[_0xccfa('0x11b')];_0x23be07[_0xccfa('0xc7')](_0x136d9c)[_0xccfa('0xb3')](loggerCatch('[originate][error]'));_0x23be07[_0xccfa('0xc5')](_0x136d9c)['catch'](loggerCatch(_0xccfa('0x18e')))['finally'](function(){delete _0x23be07['actions'][_0x40a8b0];return _0x30babe(msgResponse(_0xccfa('0x168'),_0xccfa('0x47'),_0xccfa('0x18f')));});});});};Dialer[_0xccfa('0x20')]['syncOriginateResponse']=function(_0x129d4f){var _0x339a0a=this[_0xccfa('0xa7')][_0x129d4f[_0xccfa('0x125')]];if(_0x339a0a){delete this['actions'][_0x129d4f['actionid']];_0x339a0a['responsetime']=moment()[_0xccfa('0x7a')](_0xccfa('0xff'));var _0x776237=_0x339a0a[_0xccfa('0x78')]===_0xccfa('0x79')?this[_0xccfa('0xae')][_0x339a0a['queue']]:this[_0xccfa('0x25')][_0x339a0a[_0xccfa('0x190')]()];if(!this['isSuccess'](_0x129d4f[_0xccfa('0x191')])){this[_0xccfa('0xab')](_0x776237);return this[_0xccfa('0x192')](_0x339a0a,_0x776237,_0x129d4f)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x129d4f[_0xccfa('0xde')]]=_0x339a0a;}};Dialer[_0xccfa('0x20')][_0xccfa('0x193')]=function(_0x319c7b,_0x3fe160,_0x4c1441){var _0x31a8f7=new History(_0x3fe160);if(_0x31a8f7[_0xccfa('0x194')]+_0x31a8f7['countcongestionretry']+_0x31a8f7['countnoanswerretry']+_0x31a8f7[_0xccfa('0xf5')]+_0x31a8f7[_0xccfa('0xf6')]+_0x31a8f7[_0xccfa('0xf7')]+_0x31a8f7[_0xccfa('0xf1')]+_0x31a8f7[_0xccfa('0xf8')]>=_0x4c1441[_0xccfa('0x195')]-0x1){return!![];}switch(_0x319c7b){case 0x3:if(_0x31a8f7[_0xccfa('0xf4')]>=_0x4c1441[_0xccfa('0x196')]-0x1){return!![];}this[_0xccfa('0xbb')]({'active':![],'countnoanswerretry':_0x31a8f7[_0xccfa('0xf4')]+=0x1,'scheduledat':moment()[_0xccfa('0xfc')](_0x4c1441[_0xccfa('0x197')],_0xccfa('0xfe'))[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x31a8f7[_0xccfa('0xd0')],'ListId':_0x31a8f7['ListId'],'VoiceQueueId':_0x31a8f7[_0xccfa('0x100')]||undefined,'CampaignId':_0x31a8f7[_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x198')));break;case 0x5:if(_0x31a8f7[_0xccfa('0x194')]>=_0x4c1441['dialBusyMaxRetry']-0x1){return!![];}this[_0xccfa('0xbb')]({'active':![],'countbusyretry':_0x31a8f7[_0xccfa('0x194')]+=0x1,'scheduledat':moment()[_0xccfa('0xfc')](_0x4c1441[_0xccfa('0x199')],_0xccfa('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31a8f7[_0xccfa('0xd0')],'ListId':_0x31a8f7[_0xccfa('0xd1')],'VoiceQueueId':_0x31a8f7[_0xccfa('0x100')]||undefined,'CampaignId':_0x31a8f7[_0xccfa('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x31a8f7['countcongestionretry']>=_0x4c1441['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x31a8f7[_0xccfa('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x4c1441[_0xccfa('0x19a')],'minutes')[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x31a8f7[_0xccfa('0xd0')],'ListId':_0x31a8f7[_0xccfa('0xd1')],'VoiceQueueId':_0x31a8f7[_0xccfa('0x100')]||undefined,'CampaignId':_0x31a8f7[_0xccfa('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x31a8f7[_0xccfa('0xf5')]>=_0x4c1441[_0xccfa('0x19b')]-0x1){return!![];}else{this[_0xccfa('0xbb')]({'active':![],'countnosuchnumberretry':_0x31a8f7[_0xccfa('0xf5')]+=0x1,'scheduledat':moment()[_0xccfa('0xfc')](_0x4c1441[_0xccfa('0x19c')],_0xccfa('0xfe'))[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x31a8f7[_0xccfa('0xd0')],'ListId':_0x31a8f7[_0xccfa('0xd1')],'VoiceQueueId':_0x31a8f7[_0xccfa('0x100')]||undefined,'CampaignId':_0x31a8f7[_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x19d')));}break;case 0xa:if(_0x31a8f7[_0xccfa('0xf6')]>=_0x4c1441[_0xccfa('0x19e')]-0x1){return!![];}this[_0xccfa('0xbb')]({'active':![],'countdropretry':_0x31a8f7[_0xccfa('0xf6')]+=0x1,'scheduledat':moment()[_0xccfa('0xfc')](_0x4c1441['dialDropRetryFrequency'],'minutes')[_0xccfa('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31a8f7[_0xccfa('0xd0')],'ListId':_0x31a8f7[_0xccfa('0xd1')],'VoiceQueueId':_0x31a8f7[_0xccfa('0x100')]||undefined,'CampaignId':_0x31a8f7[_0xccfa('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x31a8f7[_0xccfa('0xf7')]>=_0x4c1441[_0xccfa('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x31a8f7[_0xccfa('0xf7')]+=0x1,'scheduledat':moment()[_0xccfa('0xfc')](_0x4c1441[_0xccfa('0x1a0')],_0xccfa('0xfe'))[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x31a8f7[_0xccfa('0xd0')],'ListId':_0x31a8f7[_0xccfa('0xd1')],'VoiceQueueId':_0x31a8f7['VoiceQueueId']||undefined,'CampaignId':_0x31a8f7[_0xccfa('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x31a8f7['countmachineretry']>=_0x4c1441[_0xccfa('0xfb')]-0x1){return!![];}this[_0xccfa('0xbb')]({'active':![],'countmachineretry':_0x31a8f7[_0xccfa('0xf1')]+=0x1,'scheduledat':moment()[_0xccfa('0xfc')](_0x4c1441['dialMachineRetryFrequency'],_0xccfa('0xfe'))[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x31a8f7['ContactId'],'ListId':_0x31a8f7[_0xccfa('0xd1')],'VoiceQueueId':_0x31a8f7[_0xccfa('0x100')]||undefined,'CampaignId':_0x31a8f7[_0xccfa('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x31a8f7[_0xccfa('0xf8')]>=_0x4c1441[_0xccfa('0x1a1')]-0x1){return!![];}this[_0xccfa('0xbb')]({'active':![],'countagentrejectretry':_0x31a8f7[_0xccfa('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x4c1441[_0xccfa('0x1a2')],'minutes')[_0xccfa('0x7a')](_0xccfa('0xff')),'ContactId':_0x31a8f7['ContactId'],'ListId':_0x31a8f7[_0xccfa('0xd1')],'VoiceQueueId':_0x31a8f7[_0xccfa('0x100')]||undefined,'CampaignId':_0x31a8f7[_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x1a3')));break;default:return!![];}};Dialer[_0xccfa('0x20')][_0xccfa('0x192')]=function(_0x3f97ae,_0xb0a523,_0x3b9915){var _0x111ae9=this;var _0x1825e3=new History(_0x3f97ae);return new BPromise(function(_0x493237,_0x47e624){if(_[_0xccfa('0x3b')](_0xb0a523)&&typeof _0xb0a523!==_0xccfa('0x1a4')){return _0x47e624(msgResponse(_0xccfa('0x1a5'),_0xccfa('0x143'),_0xccfa('0x1a6')));}if(_[_0xccfa('0x3b')](_0x3b9915)&&typeof _0x3b9915!==_0xccfa('0x1a4')){return _0x47e624(msgResponse('[callProgressDetecting]','Failure',_0xccfa('0x1a7')));}switch(_0x3b9915[_0xccfa('0x10b')]){case'0':_0xb0a523[_0xccfa('0x62')]+=0x1;_0x1825e3['state']=0x0;_0x1825e3[_0xccfa('0x102')]='NoSuchNumber';_0x1825e3['countnosuchnumberretry']+=0x1;_0x1825e3[_0xccfa('0x121')]+=0x1;ami[_0xccfa('0x4a')](_0xccfa('0x1a8'),ut['buildObj'](_0x3f97ae,_0xccfa('0x1a9')));_0x111ae9[_0xccfa('0xc7')](_0x1825e3)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xf2')));if(_0x111ae9['checkRetriveMax'](0x0,_0x3f97ae,_0xb0a523)){if(_0x1825e3[_0xccfa('0xf5')]>=_0xb0a523[_0xccfa('0x19b')]){_0x111ae9['createStateFinal'](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1aa'));}else{_0x111ae9[_0xccfa('0xf9')](_0x1825e3,_0x493237,_0x47e624,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xb0a523[_0xccfa('0x1ab')]+=0x1;_0x1825e3[_0xccfa('0xa3')]=0x3;_0x1825e3['statedesc']=_0xccfa('0x1ac');_0x1825e3['countnoanswerretry']+=0x1;_0x1825e3['countglobal']+=0x1;ami[_0xccfa('0x4a')](_0xccfa('0x1ad'),ut[_0xccfa('0xe9')](_0x3f97ae,'noanswer'));_0x111ae9['createHistory'](_0x1825e3)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x1ae')));if(_0x111ae9[_0xccfa('0x193')](0x3,_0x3f97ae,_0xb0a523)){if(_0x1825e3[_0xccfa('0xf4')]>=_0xb0a523['dialNoAnswerMaxRetry']){_0x111ae9[_0xccfa('0x1af')](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1b0'));}else{_0x111ae9['stateGlobal'](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1b0'));}}break;case'5':_0xb0a523['outboundBusyCallsDay']+=0x1;_0x1825e3[_0xccfa('0xa3')]=0x5;_0x1825e3[_0xccfa('0x102')]=_0xccfa('0x1b1');_0x1825e3[_0xccfa('0x194')]+=0x1;_0x1825e3['countglobal']+=0x1;ami[_0xccfa('0x4a')](_0xccfa('0x1b2'),ut[_0xccfa('0xe9')](_0x3f97ae,_0xccfa('0x1b3')));_0x111ae9[_0xccfa('0xc7')](_0x1825e3)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x1b4')));if(_0x111ae9[_0xccfa('0x193')](0x5,_0x3f97ae,_0xb0a523)){if(_0x1825e3[_0xccfa('0x194')]>=_0xb0a523['dialBusyMaxRetry']){_0x111ae9[_0xccfa('0x1af')](_0x1825e3,_0x493237,_0x47e624,'reason\x205\x20busy');}else{_0x111ae9['stateGlobal'](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1b5'));}}break;case'8':_0xb0a523['outboundCongestionCallsDay']+=0x1;_0x1825e3[_0xccfa('0xa3')]=0x8;_0x1825e3['statedesc']=_0xccfa('0x1b6');_0x1825e3['countcongestionretry']+=0x1;_0x1825e3[_0xccfa('0x121')]+=0x1;ami[_0xccfa('0x4a')](_0xccfa('0x1b7'),ut[_0xccfa('0xe9')](_0x3f97ae,_0xccfa('0x1b8')));_0x111ae9[_0xccfa('0xc7')](_0x1825e3)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x1b9')));if(_0x111ae9[_0xccfa('0x193')](0x8,_0x3f97ae,_0xb0a523)){if(_0x1825e3[_0xccfa('0xf3')]>=_0xb0a523[_0xccfa('0x1ba')]){_0x111ae9[_0xccfa('0x1af')](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1bb'));}else{_0x111ae9[_0xccfa('0xf9')](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1bb'));}}break;case'11':_0xb0a523[_0xccfa('0x1bc')]+=0x1;_0x1825e3[_0xccfa('0xa3')]=0xb;_0x1825e3['statedesc']=_0xccfa('0x11f');_0x1825e3[_0xccfa('0xf7')]+=0x1;_0x1825e3['countglobal']+=0x1;_0x111ae9[_0xccfa('0xc7')](_0x1825e3)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x124')));if(_0x111ae9[_0xccfa('0x193')](0xb,_0x3f97ae,_0xb0a523)){if(_0x1825e3['countabandonedretry']>=_0xb0a523[_0xccfa('0x19f')]){_0x111ae9['createStateFinal'](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1bd'));}else{_0x111ae9['stateGlobal'](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1bd'));}}break;case'20':_0xb0a523['outboundRejectCallsDay']+=0x1;_0x1825e3['state']=0x14;_0x1825e3[_0xccfa('0x102')]='AgentReject';_0x1825e3[_0xccfa('0xf8')]+=0x1;_0x1825e3[_0xccfa('0x121')]+=0x1;ami[_0xccfa('0x4a')](_0xccfa('0x1be'),ut[_0xccfa('0xe9')](_0x3f97ae,_0xccfa('0x1bf')));_0x111ae9[_0xccfa('0xc7')](_0x1825e3)['catch'](loggerCatch(_0xccfa('0x1c0')));if(_0x111ae9['checkRetriveMax'](0x14,_0x3f97ae,_0xb0a523)){if(_0x1825e3['countagentrejectretry']>=_0xb0a523[_0xccfa('0x1a1')]){_0x111ae9[_0xccfa('0x1af')](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1c1'));}else{_0x111ae9[_0xccfa('0xf9')](_0x1825e3,_0x493237,_0x47e624,_0xccfa('0x1c1'));}}break;default:_0xb0a523[_0xccfa('0x65')]+=0x1;_0x1825e3['state']=0xc;_0x1825e3[_0xccfa('0x102')]=_0x3b9915[_0xccfa('0x10b')];_0x111ae9[_0xccfa('0xc7')](_0x1825e3)[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x1c2')));if(_0x111ae9[_0xccfa('0x193')](_0x3b9915['reason'],_0x3f97ae,_0xb0a523)){if(_0x1825e3[_0xccfa('0x194')]+_0x1825e3[_0xccfa('0xf3')]+_0x1825e3[_0xccfa('0xf4')]+_0x1825e3['countnosuchnumberretry']+_0x1825e3['countdropretry']+_0x1825e3[_0xccfa('0xf7')]+_0x1825e3[_0xccfa('0xf1')]+_0x1825e3[_0xccfa('0xf8')]>=_0xb0a523[_0xccfa('0x195')]){_0x111ae9['stateGlobal'](_0x1825e3,_0x493237,_0x47e624,_0x3b9915['reason']);}else{_0x111ae9[_0xccfa('0x1af')](_0x1825e3,_0x493237,_0x47e624,_0x3b9915[_0xccfa('0x10b')]);}}}});};Dialer[_0xccfa('0x20')][_0xccfa('0xf9')]=function(_0x13371a,_0x22f560,_0x2c3897,_0x47bcad){var _0x368130=new Final(_0x13371a);_0x368130[_0xccfa('0xa3')]=0xf;_0x368130[_0xccfa('0x102')]=_0xccfa('0x1c3');this['createStateFinal'](_0x368130,_0x22f560,_0x2c3897,_0x47bcad);};Dialer['prototype'][_0xccfa('0x1af')]=function(_0x658082,_0x4bcf51,_0x4e49c5,_0x3a9cf4){this[_0xccfa('0xc5')](_0x658082)[_0xccfa('0xb2')](function(){return _0x4bcf51(msgResponse(_0xccfa('0x1a5'),_0xccfa('0xd7'),_0x3a9cf4));})[_0xccfa('0xb3')](function(){return _0x4e49c5(msgResponse(_0xccfa('0x1c4'),_0xccfa('0x143'),_0xccfa('0x1c5')));});};Dialer[_0xccfa('0x20')][_0xccfa('0xc')]=function(_0x29dad5){var _0x180977=_0x29dad5['dialPredictiveOptimizationPercentage']/0x64;var _0x2f28d5=_0x29dad5[_0xccfa('0x61')]/(_0x29dad5['outboundDropCallsDayTimeout']+_0x29dad5['outboundAnswerCallsDay']);var _0x5b6417=Math[_0xccfa('0x1c6')](_0x29dad5[_0xccfa('0x1c7')]*(_0x29dad5[_0xccfa('0x1c8')]/0x64));var _0x25ca48=Math['round'](_0x29dad5[_0xccfa('0x1c7')]*(_0x29dad5[_0xccfa('0x1c9')]/0x64));var _0x28b24a=_0x29dad5['available']+_0x29dad5[_0xccfa('0x53')];var _0x570bb2=Math[_0xccfa('0x1ca')](_0x29dad5[_0xccfa('0x6e')]*_0x29dad5[_0xccfa('0x70')]*_0x29dad5['predictiveIntervalHitRate']*_0x29dad5[_0xccfa('0x1cb')]);if(_['isUndefined'](_0x29dad5[_0xccfa('0x73')])){if(!_[_0xccfa('0x3b')](_0x29dad5[_0xccfa('0x72')])){_0x29dad5[_0xccfa('0x72')]=undefined;loggerPredictive[_0xccfa('0x97')](_0xccfa('0x1cc'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xccfa('0x3b')](_0x29dad5[_0xccfa('0x91')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xccfa('0x1cd'));clearInterval(_0x29dad5[_0xccfa('0x91')]);_0x29dad5['handlePredictive']=undefined;}_0x29dad5[_0xccfa('0x73')]=moment()[_0xccfa('0x7a')](_0xccfa('0xff'));loggerPredictive[_0xccfa('0x7e')](_0x29dad5[_0xccfa('0x3e')],_0xccfa('0x1ce'),_0x29dad5[_0xccfa('0x73')]);this[_0xccfa('0x158')](_0x29dad5,0x1);}else if(ifInterval(_0x29dad5[_0xccfa('0x1cf')],_0x29dad5[_0xccfa('0x73')])){this[_0xccfa('0x158')](_0x29dad5,0x1);loggerPredictiveCalls[_0xccfa('0x7e')]('[startMethodPredictive][StartProgressive][Loop]',_0x29dad5['startProgressive'],_0x29dad5[_0xccfa('0x3e')]);_0x29dad5[_0xccfa('0x6e')]=0x0;_0x29dad5[_0xccfa('0x6a')]=0x0;}else if(_0x180977<_0x2f28d5&&_0x29dad5[_0xccfa('0x1d0')]===_0xccfa('0x1d1')){freeVariablesPredictive(_0x29dad5);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x1d2'),_0xccfa('0x1d3'),_0x2f28d5,'startProgressive',_0x29dad5[_0xccfa('0x3e')]);}else if(_0x570bb2<_0x29dad5[_0xccfa('0x6a')]&&_0x29dad5['dialPredictiveOptimization']===_0xccfa('0x1d1')){freeVariablesPredictive(_0x29dad5);loggerPredictive['info'](_0xccfa('0x1d4'),_0xccfa('0x1d5'),_0x570bb2,'Drop\x20in\x20this\x20interval',_0x29dad5[_0xccfa('0x6a')],_0xccfa('0x73'),_0x29dad5[_0xccfa('0x3e')]);}else if(!ifInterval(_0x29dad5[_0xccfa('0x1cf')],_0x29dad5[_0xccfa('0x73')])&&_[_0xccfa('0x3b')](_0x29dad5[_0xccfa('0x72')])&&!_[_0xccfa('0x3b')](_0x29dad5[_0xccfa('0x73')])){_0x29dad5['startPredictive']=moment()[_0xccfa('0x7a')](_0xccfa('0xff'));loggerPredictive['info'](_0x29dad5[_0xccfa('0x3e')],_0xccfa('0x1d6'),_0x29dad5[_0xccfa('0x72')]);this[_0xccfa('0xb9')](_0x29dad5[_0xccfa('0x1cf')])[_0xccfa('0xb2')](this[_0xccfa('0x1d7')](_0x29dad5))[_0xccfa('0xb2')](mergeDataErlangB(_0x29dad5))[_0xccfa('0xb2')](this[_0xccfa('0x1d8')](_0x29dad5))[_0xccfa('0xb3')](loggerCatchPredictive(_0xccfa('0x1d9'),_0x29dad5));}else if(!ifInterval(_0x29dad5[_0xccfa('0x1cf')],_0x29dad5[_0xccfa('0x72')])){_0x29dad5[_0xccfa('0x6a')]=0x0;_0x29dad5['startPredictive']=moment()['format'](_0xccfa('0xff'));loggerPredictive[_0xccfa('0x7e')](_0x29dad5[_0xccfa('0x3e')],_0xccfa('0x1da'),_0x29dad5['startPredictive']);clearInterval(_0x29dad5[_0xccfa('0x91')]);_0x29dad5['handlePredictive']=undefined;this['averageHandleTime'](_0x29dad5[_0xccfa('0x1cf')])['then'](this[_0xccfa('0x1d7')](_0x29dad5))[_0xccfa('0xb2')](mergeDataErlangB(_0x29dad5))[_0xccfa('0xb2')](this[_0xccfa('0x1d8')](_0x29dad5))[_0xccfa('0xb3')](loggerCatchPredictive(_0xccfa('0x1db'),_0x29dad5));}else if(_0x29dad5['predictiveIntervalAvailable']&&_0x28b24a<_0x29dad5[_0xccfa('0x1c7')]-_0x25ca48){freeVariablesPredictive(_0x29dad5);loggerPredictive[_0xccfa('0x7e')](_0x29dad5[_0xccfa('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x28b24a,_0xccfa('0x1dc'),_0x29dad5['predictiveIntervalAvailable'],'-',_0x25ca48,'=',_0x29dad5[_0xccfa('0x1c7')]-_0x25ca48,')');}else if(_0x29dad5[_0xccfa('0x1c7')]&&_0x28b24a>_0x29dad5[_0xccfa('0x1c7')]+_0x5b6417){freeVariablesPredictive(_0x29dad5);loggerPredictive['info'](_0x29dad5[_0xccfa('0x3e')],_0xccfa('0x1dd'),_0x28b24a,')\x20are\x20more\x20than\x20threshold\x20(',_0x29dad5[_0xccfa('0x1c7')],'+',_0x5b6417,'=',_0x29dad5['predictiveIntervalAvailable']+_0x5b6417,')');}};Dialer[_0xccfa('0x20')]['getDataPredictive']=function(_0x1217df){var _0x314ea0=this;return function(_0x27c669){return new BPromise(function(_0x2e935b,_0xda223f){_[_0xccfa('0x8c')](_0x1217df,_0x27c669[0x0]);if(checkGetDataPredictive(_0x27c669[0x0])){var _0x7961c=_0x1217df[_0xccfa('0x1c7')]=_0x1217df[_0xccfa('0x53')]+_0x1217df[_0xccfa('0x4d')];var _0x24de43=_0x1217df[_0xccfa('0x1cf')]*0x3c;var _0x5ae11f=_0x27c669[0x0]['predictiveIntervalAvgTalktime']+_0x27c669[0x0][_0xccfa('0x83')];var _0x375325=(_0x27c669[0x0][_0xccfa('0x81')]+_0x27c669[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x27c669[0x0][_0xccfa('0x67')])/_0x27c669[0x0][_0xccfa('0x7f')];_0x1217df[_0xccfa('0x6b')]=_0x375325>0x0?_0x375325:0x1;switch(_0x1217df['dialPredictiveOptimization']){case _0xccfa('0x1d1'):var _0x32d0a6=_0x1217df[_0xccfa('0x1de')]/0x64;return _0x314ea0[_0xccfa('0x1df')](_0x7961c,_0x24de43,_0x5ae11f,_0x375325,_0x32d0a6)[_0xccfa('0xb2')](function(_0x5927ba){return _0x2e935b(_0x5927ba);});case'agentBusyFactor':var _0x12846e=_0x1217df[_0xccfa('0x1de')]/0x64;return _0x314ea0[_0xccfa('0x1e0')](_0x7961c,_0x24de43,_0x5ae11f,_0x375325,_0x12846e)[_0xccfa('0xb2')](function(_0x4683ab){return _0x2e935b(_0x4683ab);});default:return _0xda223f(msgResponse(_0xccfa('0x1e1'),'Failure',_0xccfa('0x1e2')));}}else{return _0xda223f(msgResponse(_0xccfa('0x1e1'),_0xccfa('0x143'),_0xccfa('0x1e3')));}});};};Dialer[_0xccfa('0x20')][_0xccfa('0x1e4')]=function(_0x8be7d3){var _0x453581=this;return function(_0x2e40b4){return new BPromise(function(_0x2ee7fb,_0x38a74c){_['merge'](_0x8be7d3,_0x2e40b4[0x0]);if(checkGetDataPredictive(_0x2e40b4[0x0])){loggerPredictive['info'](JSON[_0xccfa('0x48')](_0x2e40b4[0x0]));if(_0x8be7d3[_0xccfa('0x1d0')]===_0xccfa('0x1d1')){return _0x453581[_0xccfa('0xc3')](_0x8be7d3['id'])['then'](function(_0x4c82b3){var _0xe7d202=_0x8be7d3['loggedIn']-_0x4c82b3[0x0][_0xccfa('0x1e5')];var _0x5771cb=_0x8be7d3[_0xccfa('0x1cf')]*0x3c;var _0x5e54b6=_0x2e40b4[0x0]['predictiveIntervalAvgTalktime']+_0x2e40b4[0x0]['predictiveIntervalAvgHoldtime'];var _0x1858d4=(_0x2e40b4[0x0]['predictiveIntervalAnsweredCalls']+_0x2e40b4[0x0][_0xccfa('0x68')]+_0x2e40b4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2e40b4[0x0][_0xccfa('0x7f')];var _0x31fc3e=_0x8be7d3[_0xccfa('0x1de')]/0x64;_0x8be7d3[_0xccfa('0x6c')]=_0x4c82b3[0x0][_0xccfa('0x1e5')]||0x0;_0x8be7d3['predictiveIntervalHitRate']=_0x1858d4>0x0?_0x1858d4:0x1;return _0x453581['abandonmentRate'](_0xe7d202,_0x5771cb,_0x5e54b6,_0x1858d4,_0x31fc3e);})[_0xccfa('0xb2')](function(_0x57dfec){return _0x2ee7fb(_0x57dfec);})[_0xccfa('0xb3')](function(_0x2558d2){return _0x38a74c(msgResponse('[CatchErlangB]',_0xccfa('0x143'),JSON[_0xccfa('0x48')](_0x2558d2)));});}if(_0x8be7d3[_0xccfa('0x1d0')]===_0xccfa('0x1e6')){return _0x453581[_0xccfa('0xc3')](_0x8be7d3['id'])[_0xccfa('0xb2')](function(_0x4528bb){var _0x58704b=_0x8be7d3[_0xccfa('0x4e')]-_0x4528bb[0x0][_0xccfa('0x1e5')];var _0x3d7d6f=_0x8be7d3['dialPredictiveInterval']*0x3c;var _0x4b8158=_0x2e40b4[0x0]['predictiveIntervalAvgTalktime']+_0x2e40b4[0x0][_0xccfa('0x83')];var _0x3398d3=(_0x2e40b4[0x0][_0xccfa('0x81')]+_0x2e40b4[0x0][_0xccfa('0x68')]+_0x2e40b4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2e40b4[0x0][_0xccfa('0x7f')];var _0x5acf79=_0x8be7d3[_0xccfa('0x1de')]/0x64;_0x8be7d3[_0xccfa('0x6c')]=_0x4528bb[0x0][_0xccfa('0x1e5')]||0x0;_0x8be7d3[_0xccfa('0x6b')]=_0x3398d3>0x0?_0x3398d3:0x1;return _0x453581[_0xccfa('0x1e0')](_0x58704b,_0x3d7d6f,_0x4b8158,_0x3398d3,_0x5acf79);})['then'](function(_0x4a075b){return _0x2ee7fb(_0x4a075b);})[_0xccfa('0xb3')](function(_0x4dca8b){return _0x38a74c(msgResponse(_0xccfa('0x1e7'),_0xccfa('0x143'),JSON[_0xccfa('0x48')](_0x4dca8b)));});}}else{return _0x38a74c(msgResponse(_0xccfa('0x1e1'),_0xccfa('0x143'),_0xccfa('0x1e3')));}});};};Dialer['prototype'][_0xccfa('0x1d8')]=function(_0x531af0){var _0x32d47d=this;return function(){var _0x4feee5=0x0;var _0x569fd9=Math[_0xccfa('0x1ca')](_0x531af0['erlangCallToSecond']*0x3e8);if(_0x569fd9>0x0){_0x569fd9=_0x569fd9<0x64?0x64:_0x569fd9;loggerPredictive[_0xccfa('0x7e')](_0x531af0[_0xccfa('0x3e')],_0xccfa('0x1e8'),_0x569fd9,'milliseconds');_0x531af0['handlePredictive']=setInterval(function(){_0x32d47d[_0xccfa('0x91')](_0x531af0);loggerPredictiveCalls['info']('[handlePredictive]',_0x4feee5+=0x1);},_0x569fd9);}else{loggerPredictive[_0xccfa('0x7e')](_0x531af0[_0xccfa('0x3e')],_0xccfa('0x1e9'));}};};Dialer[_0xccfa('0x20')][_0xccfa('0x1ea')]=function(_0x4ca737,_0x27e208){var _0x525539=this;return function(_0x3e39d8){if(_[_0xccfa('0x45')](_0x3e39d8)){if(_[_0xccfa('0xdf')](_0x27e208['UserId'])||!_0x27e208[_0xccfa('0x1eb')]){if(_0x4ca737[_0xccfa('0x58')]===_0xccfa('0xb')){_0x4ca737['queueStatusComplete']=_['isUndefined'](_0x4ca737[_0xccfa('0x12c')])?!![]:_0x4ca737[_0xccfa('0x12c')];var _0x3dad25=uuid['v4']();_0x525539[_0xccfa('0xa7')][_0x3dad25]=new Action(_0x4ca737,_0x27e208,_0x3dad25);loggerBooked[_0xccfa('0x7e')](_0xccfa('0x1ec'),_0x3dad25,_0xccfa('0x1ed'),JSON[_0xccfa('0x48')](_0x4ca737['queueStatusComplete']),'Queue:\x20',_0x4ca737[_0xccfa('0x3e')]);if(_0x4ca737[_0xccfa('0x12c')]){_0x4ca737[_0xccfa('0x12c')]=![];_0x525539[_0xccfa('0x129')][_0x525539['actions'][_0x3dad25][_0xccfa('0xac')]]=[];ami['Action']({'actionid':_0x3dad25,'action':_0xccfa('0x1ee'),'queue':_0x4ca737[_0xccfa('0x3e')]})['catch'](function(){_0x525539[_0xccfa('0xab')](_0x4ca737);_0x525539['rescheduleContact']({'active':![],'ContactId':_0x525539[_0xccfa('0xa7')][_0x3dad25][_0xccfa('0xd0')],'ListId':_0x525539[_0xccfa('0xa7')][_0x3dad25][_0xccfa('0xd1')],'VoiceQueueId':_0x525539[_0xccfa('0xa7')][_0x3dad25]['VoiceQueueId']||undefined,'CampaignId':_0x525539[_0xccfa('0xa7')][_0x3dad25][_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x1ef')));delete _0x525539[_0xccfa('0xa7')][_0x3dad25];});}else{loggerBooked[_0xccfa('0x7e')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x4ca737[_0xccfa('0x12c')]),'Queue:\x20',_0x4ca737['name']);_0x525539[_0xccfa('0xab')](_0x4ca737);_0x525539[_0xccfa('0xbb')]({'active':![],'ContactId':_0x525539[_0xccfa('0xa7')][_0x3dad25][_0xccfa('0xd0')],'ListId':_0x525539[_0xccfa('0xa7')][_0x3dad25]['ListId'],'VoiceQueueId':_0x525539['actions'][_0x3dad25][_0xccfa('0x100')]||undefined,'CampaignId':_0x525539[_0xccfa('0xa7')][_0x3dad25][_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x1ef')));delete _0x525539[_0xccfa('0xa7')][_0x3dad25];}}else{return _0x525539[_0xccfa('0x167')](_0x4ca737,_0x27e208);}}else{if(getDiff(_0x27e208[_0xccfa('0x1f0')])<_0x4ca737[_0xccfa('0x1f1')]*0x3c){if(_0x27e208[_0xccfa('0x1f2')]&&!_0x27e208[_0xccfa('0x1f2')]['voicePause']){_0x525539[_0xccfa('0x93')]['run'](_0x27e208['id'])[_0xccfa('0x23')](function(){_0x525539[_0xccfa('0xab')](_0x4ca737);});}else{_0x525539['unlockContact']({'active':![]},_0x27e208['id'],0x1)[_0xccfa('0x23')](function(){_0x525539[_0xccfa('0xab')](_0x4ca737);});}}else{_0x4ca737[_0xccfa('0x64')]+=0x1;_0x525539[_0xccfa('0xab')](_0x4ca737);if(_0x4ca737['dialRecallInQueue']){_0x525539['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x27e208[_0xccfa('0xd0')],'ListId':_0x27e208[_0xccfa('0xd1')],'VoiceQueueId':_0x27e208['VoiceQueueId']||undefined,'CampaignId':_0x27e208[_0xccfa('0xd3')]||undefined})[_0xccfa('0xb3')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x525539[_0xccfa('0xc7')](createObjHistory(_0x4ca737,_0x27e208,_0xccfa('0x1f3'),0x17,'RecallInQueue'))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0x1f4')));}else{_0x525539['saveInDb'](createObjHistory(_0x4ca737,_0x27e208,_0xccfa('0x1f5'),0x16,_0xccfa('0x1f6')),_0xccfa('0x1f7'),_0xccfa('0x1f8'));}}}}else{_0x4ca737['outboundBlacklistCallsDay']+=0x1;_0x525539[_0xccfa('0xce')](createObjHistory(_0x4ca737,_0x27e208,_0xccfa('0x1f9'),0xd,'Blacklist'),_0xccfa('0x1fa'),'[Originate][MoveBlacklist]');throw _0xccfa('0x1fb');}};};Dialer['prototype'][_0xccfa('0x15d')]=function(_0x41654b){var _0x5882dc=this;var _0x276c2a=_0x41654b['limitCalls']-_0x41654b[_0xccfa('0x6d')]-_0x41654b[_0xccfa('0xc0')];emitCampaignSummary(_0x41654b);if(_0x276c2a>0x0){if(_0x276c2a>this[_0xccfa('0x28')]){_0x276c2a=this[_0xccfa('0x28')];}_0x41654b['temp']+=_0x276c2a;this[_0xccfa('0xc1')](_0x41654b['id'],_0x276c2a,_0x41654b[_0xccfa('0x1fc')],_0x41654b)['then'](function(_0xfaa5bb){_0x41654b[_0xccfa('0xc0')]-=_0x276c2a;_0x41654b['temp']=_0x41654b[_0xccfa('0xc0')]>0x0?_0x41654b[_0xccfa('0xc0')]:0x0;if(!checkContactEmpty(_0xfaa5bb)){_0x41654b[_0xccfa('0x3c')]=_0xccfa('0x1fd');logger['info'](_0xccfa('0x1fe')+_0x41654b['name']);}else{_0x41654b[_0xccfa('0x6d')]+=_0xfaa5bb[_0xccfa('0x149')];_0x41654b[_0xccfa('0x3c')]=_0xccfa('0x1ff');for(var _0x3fe782=0x0;_0x3fe782<_0xfaa5bb[_0xccfa('0x149')];_0x3fe782+=0x1){_0x41654b[_0xccfa('0x200')]+=0x1;if(_[_0xccfa('0xdf')](_0xfaa5bb[_0x3fe782])||_[_0xccfa('0xdf')](_0xfaa5bb[_0x3fe782][_0xccfa('0x16a')])||_[_0xccfa('0xdf')](_0xfaa5bb[_0x3fe782][_0xccfa('0x16a')]['phone'])){_0x5882dc['emptyContact'](_0xccfa('0x201'),_0x41654b,_0xfaa5bb[_0x3fe782]);}else{_0x5882dc[_0xccfa('0xb7')](_[_0xccfa('0xcf')](_0xfaa5bb[_0x3fe782],[_0xccfa('0xd3'),'Contact.phone']))[_0xccfa('0xb2')](_0x5882dc['checkContactBlack'](_0x41654b,_0xfaa5bb[_0x3fe782]))[_0xccfa('0xb3')](_0x5882dc[_0xccfa('0xcb')](_0xccfa('0x202'),_0x41654b));}}}})[_0xccfa('0xb3')](loggerGetContactDialer('[getContactCampaign2]',_0x41654b,_0x276c2a));}};Dialer[_0xccfa('0x20')][_0xccfa('0x158')]=function(_0x51018a,_0x166e46){var _0x1ff51d=this;var _0x3c42de=[];var _0x5827db=_0x166e46>=0x1?_0x166e46:0x1;if(_0x51018a[_0xccfa('0x58')]===_0xccfa('0xb')){_0x5827db=0x1;}var _0x43d1c3=Math[_0xccfa('0x1ca')](_0x51018a[_0xccfa('0x4d')]*_0x5827db)-_0x51018a[_0xccfa('0x6d')]-_0x51018a[_0xccfa('0xc0')];emitVoiceQueueSummary(_0x51018a);if(_0x51018a[_0xccfa('0x203')]>0x0){var _0x31f0ea=_0x51018a[_0xccfa('0x203')]-_0x51018a[_0xccfa('0x6d')]-_0x51018a[_0xccfa('0x53')]-_0x51018a[_0xccfa('0xc0')]-_0x51018a[_0xccfa('0x4f')];if(_0x43d1c3>_0x31f0ea){_0x43d1c3=_0x31f0ea;}}if(_0x43d1c3>0x0){if(_0x51018a[_0xccfa('0x58')]===_0xccfa('0xb')){_0x43d1c3=0x1;}if(_0x43d1c3>this['maxNumberOriginate']){_0x43d1c3=this['maxNumberOriginate'];}_0x51018a[_0xccfa('0xc0')]+=_0x43d1c3;for(var _0xccc836 in this[_0xccfa('0x26')]){if(typeof this['agents'][_0xccc836]!==_0xccfa('0xa9')){if(this[_0xccfa('0x26')][_0xccc836]['state']==='not_inuse'&&this['agents'][_0xccc836]['status']===_0xccfa('0xdc')){_0x3c42de[_0xccfa('0x12a')](this[_0xccfa('0x26')][_0xccc836]['id']);}}}this['getContactDialer'](_0x51018a['id'],_0x3c42de,_0x43d1c3,_0x51018a['dialOrderByScheduledAt'],_0x51018a)[_0xccfa('0xb2')](function(_0x37bb00){_0x51018a['temp']-=_0x43d1c3;_0x51018a[_0xccfa('0xc0')]=_0x51018a[_0xccfa('0xc0')]>0x0?_0x51018a[_0xccfa('0xc0')]:0x0;if(!checkContactEmpty(_0x37bb00)){_0x1ff51d[_0xccfa('0xb0')](_0x51018a)[_0xccfa('0xb2')](sendMessageReschedule(_0x51018a))[_0xccfa('0xb3')](loggerCatch(_0xccfa('0xb4')));}else{_0x51018a['originated']+=_0x37bb00[_0xccfa('0x149')];_0x51018a[_0xccfa('0x3c')]=_0x51018a[_0xccfa('0x58')]==='booked'?_0xccfa('0x172'):_0xccfa('0x1ff');for(var _0x524e42=0x0;_0x524e42<_0x37bb00[_0xccfa('0x149')];_0x524e42+=0x1){if(_['isNil'](_0x37bb00[_0x524e42])||_[_0xccfa('0xdf')](_0x37bb00[_0x524e42][_0xccfa('0x16a')])||_[_0xccfa('0xdf')](_0x37bb00[_0x524e42][_0xccfa('0x16a')]['phone'])){_0x1ff51d[_0xccfa('0xcc')](_0xccfa('0x201'),_0x51018a,_0x37bb00[_0x524e42]);}else{_0x1ff51d['checkIsBlackList'](_[_0xccfa('0xcf')](_0x37bb00[_0x524e42],['VoiceQueueId',_0xccfa('0x204')]))[_0xccfa('0xb2')](_0x1ff51d[_0xccfa('0x1ea')](_0x51018a,_0x37bb00[_0x524e42]))[_0xccfa('0xb3')](_0x1ff51d['loggerHandler'](_0xccfa('0x201'),_0x51018a));}}}})[_0xccfa('0xb3')](loggerGetContactDialer(_0xccfa('0x205'),_0x51018a,_0x43d1c3));}};Dialer[_0xccfa('0x20')][_0xccfa('0x91')]=function(_0x40064c){if(_0x40064c[_0xccfa('0x203')]>0x0){var _0x30250a=_0x40064c['dialLimitQueue']-_0x40064c[_0xccfa('0x6d')]-_0x40064c[_0xccfa('0x53')];if(_0x30250a>0x0){this['tryOriginatePredictive'](_0x40064c);}else{loggerPredictiveCalls['info'](_0xccfa('0x206'));}}else{this[_0xccfa('0x207')](_0x40064c);}};Dialer[_0xccfa('0x20')][_0xccfa('0x207')]=function(_0x1c2864){var _0x57a4f5=this;var _0x3381b5=[];_0x1c2864[_0xccfa('0x6d')]+=0x1;for(var _0x473fe3 in this['agents']){if(typeof this[_0xccfa('0x26')][_0x473fe3]!==_0xccfa('0xa9')){if(this[_0xccfa('0x26')][_0x473fe3][_0xccfa('0xa3')]===_0xccfa('0x208')&&this['agents'][_0x473fe3][_0xccfa('0xdb')]===_0xccfa('0xdc')){_0x3381b5[_0xccfa('0x12a')](this['agents'][_0x473fe3]['id']);}}}this['getContactDialer'](_0x1c2864['id'],_0x3381b5,0x1,_0x1c2864[_0xccfa('0x1fc')],_0x1c2864)[_0xccfa('0xb2')](function(_0x33a950){if(!checkContactEmpty(_0x33a950)){checkContactLowerLimitOriginate(_0x1c2864,0x1,0x0);_0x57a4f5[_0xccfa('0xb0')](_0x1c2864)['then'](sendMessageReschedule(_0x1c2864))['catch'](loggerCatch(_0xccfa('0xb4')));}else{_0x1c2864[_0xccfa('0x3c')]=_0xccfa('0x1ff');if(_[_0xccfa('0xdf')](_0x33a950[0x0])||_[_0xccfa('0xdf')](_0x33a950[0x0][_0xccfa('0x16a')])||_[_0xccfa('0xdf')](_0x33a950[0x0][_0xccfa('0x16a')][_0xccfa('0x16b')])){_0x57a4f5[_0xccfa('0xcc')](_0xccfa('0x201'),_0x1c2864,_0x33a950[0x0]);}else{_0x57a4f5[_0xccfa('0xb5')](_[_0xccfa('0xcf')](_0x33a950[0x0],[_0xccfa('0x100'),_0xccfa('0x204')]))['then'](_0x57a4f5[_0xccfa('0x1ea')](_0x1c2864,_0x33a950[0x0]))[_0xccfa('0xb3')](_0x57a4f5[_0xccfa('0xcb')](_0xccfa('0x209'),_0x1c2864));}}})['catch'](loggerGetContactDialer(_0xccfa('0x20a'),_0x1c2864,0x1));emitVoiceQueueSummary(_0x1c2864);};Dialer[_0xccfa('0x20')]['abandonmentRate']=function(_0x9253c9,_0x555ef7,_0x1b7e43,_0x484151,_0x1ad090,_0x10d87d){loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x20b'));loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x20c'),_0x9253c9);loggerPredictive['info'](_0xccfa('0x20d'),_0x555ef7);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x20e'),_0x1b7e43);loggerPredictive['info']('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',_0x484151);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x20f'),_0x1ad090);loggerPredictive['info'](_0xccfa('0x8b'));return new BPromise(function(_0x353fbf,_0x304f1c){if(_0x9253c9<=0x0||isNaN(_0x9253c9)){return _0x304f1c(msgResponse('[abandonmentRate]',_0xccfa('0x47'),_0xccfa('0x210')+_0x9253c9));}if(_0x1b7e43<=0x0||isNaN(_0x1b7e43)){return _0x304f1c(msgResponse(_0xccfa('0x211'),'Error',_0xccfa('0x212')+_0x1b7e43));}if(_0x484151<=0x0||isNaN(_0x484151)){return _0x304f1c(msgResponse(_0xccfa('0x211'),_0xccfa('0x47'),_0xccfa('0x213')+_0x484151));}if(_0x555ef7<=0x0||isNaN(_0x555ef7)){return _0x304f1c(msgResponse(_0xccfa('0x211'),_0xccfa('0x47'),_0xccfa('0x214')+_0x555ef7));}if(_0x1ad090<=0x0||isNaN(_0x1ad090)){return _0x304f1c(msgResponse(_0xccfa('0x211'),_0xccfa('0x47'),_0xccfa('0x215')+_0x1ad090));}_0x10d87d=_0x10d87d||0x0;var _0x5d33c4=0x1/_0x1b7e43;var _0x28a418=0x0;var _0x1e658b=0x0;var _0x3c8d34=0x0;var _0x391dc6=0x0;for(var _0x233f6a=0x0;_0x3c8d34<_0x1ad090;_0x233f6a+=0x1){_0x1e658b=_0x233f6a/_0x555ef7;_0x28a418=(_0x484151*_0x1e658b+_0x10d87d)/_0x5d33c4;_0x3c8d34=erlangb(_0x28a418,_0x9253c9);_0x391dc6=_0x28a418/_0x9253c9*(0x1-erlangb(_0x28a418,_0x9253c9));}return _0x353fbf({'erlangCalls':_0x233f6a,'erlangCallToSecond':_0x555ef7/_0x233f6a,'erlangAbandonmentRate':_0x3c8d34,'erlangBusyFactor':_0x391dc6});});};Dialer[_0xccfa('0x20')][_0xccfa('0x1e0')]=function(_0x267edb,_0x49c0cf,_0x1da7ad,_0xc5a432,_0x4c053e,_0xa7cd5c){loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x216'));loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x20c'),_0x267edb);loggerPredictive['info'](_0xccfa('0x20d'),_0x49c0cf);loggerPredictive[_0xccfa('0x7e')]('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',_0x1da7ad);loggerPredictive[_0xccfa('0x7e')]('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',_0xc5a432);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x217'),_0x4c053e);loggerPredictive[_0xccfa('0x7e')](_0xccfa('0x8b'));return new BPromise(function(_0x2c20c9,_0x3a4f00){if(_0x267edb<=0x0||isNaN(_0x267edb)){return _0x3a4f00(msgResponse('[busyFactor]',_0xccfa('0x47'),_0xccfa('0x210')+_0x267edb));}if(_0x1da7ad<=0x0||isNaN(_0x1da7ad)){return _0x3a4f00(msgResponse('[busyFactor]','Error','Ts\x20=\x20'+_0x1da7ad));}if(_0xc5a432<=0x0||isNaN(_0xc5a432)){return _0x3a4f00(msgResponse(_0xccfa('0x218'),_0xccfa('0x47'),_0xccfa('0x213')+_0xc5a432));}if(_0x49c0cf<=0x0||isNaN(_0x49c0cf)){return _0x3a4f00(msgResponse('[busyFactor]',_0xccfa('0x47'),_0xccfa('0x214')+_0x49c0cf));}if(_0x4c053e<=0x0||isNaN(_0x4c053e)){return _0x3a4f00(msgResponse('[busyFactor]','Error',_0xccfa('0x219')+_0x4c053e));}_0xa7cd5c=_0xa7cd5c||0x0;var _0x17c8da=0x1/_0x1da7ad;var _0x371160=0x0;var _0x5c7892=0x0;var _0x56c1e1=0x0;var _0x381a50=0x0;for(var _0x2a2d46=0x0;_0x381a50<_0x4c053e;_0x2a2d46+=0x1){_0x5c7892=_0x2a2d46/_0x49c0cf;_0x371160=(_0xc5a432*_0x5c7892+_0xa7cd5c)/_0x17c8da;_0x56c1e1=erlangb(_0x371160,_0x267edb);_0x381a50=_0x371160/_0x267edb*(0x1-erlangb(_0x371160,_0x267edb));}return _0x2c20c9({'erlangCalls':_0x2a2d46,'erlangCallToSecond':_0x49c0cf/_0x2a2d46,'erlangAbandonmentRate':_0x56c1e1,'erlangBusyFactor':_0x381a50});});};module[_0xccfa('0x21a')]=Dialer; \ No newline at end of file +var _0xc1c4=['type','outbound','answered','loggedIn','pTalking','sumBillable','sumDuration','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','stringify','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','starttime','clearZombieChannels','uniqueId','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','active','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','membername','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','statedesc','Machine','countglobal','amd','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncAgentComplete][createHistory][0]','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','Unknow','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','[booked][unlockQueueStatus]','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','strategy','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','iftime\x20%s,%s','interval','content','indexOf','true','command','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','predictive','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','\x5cw{0,','pow','replace','random','match','actionOriginate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','updatedAt','XMD-','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','callProgressDetecting','[callProgressDetecting]\x20','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','countagentrejectretry','object','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','reason','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryRecallClose][historyCatch]','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startPredictive','ivrOriginated','queueBooked','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','Error','milliseconds','diff','seconds','emit'];(function(_0x57ed42,_0x1eec90){var _0x34f6fb=function(_0x2dd3a6){while(--_0x2dd3a6){_0x57ed42['push'](_0x57ed42['shift']());}};_0x34f6fb(++_0x1eec90);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x358ef6,_0x3328c5){_0x358ef6=_0x358ef6-0x0;var _0x1fe44d=_0xc1c4[_0x358ef6];return _0x1fe44d;};'use strict';var util=require(_0x4c1c('0x0'));var _=require(_0x4c1c('0x1'));var BPromise=require(_0x4c1c('0x2'));var uuid=require(_0x4c1c('0x3'));var moment=require(_0x4c1c('0x4'));var rr=require('rr');var md5=require(_0x4c1c('0x5'));var Redis=require(_0x4c1c('0x6'));var ut=require('../preview/util/util');var config=require(_0x4c1c('0x7'));var logger=require(_0x4c1c('0x8'))(_0x4c1c('0x9'));var loggerBooked=require(_0x4c1c('0x8'))('booked');var loggerPredictive=require(_0x4c1c('0x8'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x4c1c('0xa'));var loggerSyncQueueSummary=require(_0x4c1c('0x8'))('syncQueueSummary');var ami=require(_0x4c1c('0xb'));config[_0x4c1c('0xc')]=_[_0x4c1c('0xd')](config[_0x4c1c('0xc')],{'host':_0x4c1c('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x4c1c('0xf'));var cmHopperHistory=require(_0x4c1c('0x10'));var cmHopperBlack=require(_0x4c1c('0x11'));var voiceQueueRt=require(_0x4c1c('0x12'));var Action=require(_0x4c1c('0x13'));var History=require(_0x4c1c('0x14'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x4c1c('0x15'));var Hangup=require(_0x4c1c('0x16'));var ipAgi=process[_0x4c1c('0x17')][_0x4c1c('0x18')]||_0x4c1c('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0x4c1c('0x1a')};var Sequence=function(){};Sequence[_0x4c1c('0x1b')]['enqueue']=function(_0x146b14){this[_0x4c1c('0x1c')]=this[_0x4c1c('0x1c')]?this[_0x4c1c('0x1c')][_0x4c1c('0x1d')](_0x146b14):_0x146b14();};function Dialer(_0x25eec0,_0x457463){this[_0x4c1c('0x1e')]=new Sequence();this[_0x4c1c('0x1f')]=_0x457463;this[_0x4c1c('0x20')]=_0x25eec0[_0x4c1c('0x20')];this['campaigns']=_0x25eec0[_0x4c1c('0x21')];this[_0x4c1c('0x22')]=_0x25eec0[_0x4c1c('0x22')];this[_0x4c1c('0x23')]=_0x25eec0[_0x4c1c('0x23')];this[_0x4c1c('0x24')]=config[_0x4c1c('0x24')]||0x2;this[_0x4c1c('0x25')]={};this[_0x4c1c('0x26')]={};this[_0x4c1c('0x27')]={};this['uniqueId']={};this['optionPredictive']={};this[_0x4c1c('0x28')]={};this['startProgressive']={};this[_0x4c1c('0x29')]={};this[_0x4c1c('0x2a')]={};this['queueBookedRR']={};ami['on'](_0x4c1c('0x2b'),this['syncAgentConnect']['bind'](this));ami['on'](_0x4c1c('0x2c'),this[_0x4c1c('0x2d')][_0x4c1c('0x2e')](this));ami['on'](_0x4c1c('0x2f'),this[_0x4c1c('0x30')]['bind'](this));ami['on'](_0x4c1c('0x31'),this[_0x4c1c('0x32')][_0x4c1c('0x2e')](this));ami['on'](_0x4c1c('0x33'),this[_0x4c1c('0x34')]['bind'](this));ami['on']('hangup',this[_0x4c1c('0x35')]['bind'](this));ami['on'](_0x4c1c('0x36'),this['syncNewExten'][_0x4c1c('0x2e')](this));ami['on'](_0x4c1c('0x37'),this[_0x4c1c('0x38')]['bind'](this));ami['on'](_0x4c1c('0x39'),this[_0x4c1c('0x3a')][_0x4c1c('0x2e')](this));ami['on'](_0x4c1c('0x3b'),this[_0x4c1c('0x3c')][_0x4c1c('0x2e')](this));this[_0x4c1c('0x3d')]();this[_0x4c1c('0x3e')]();}function isNotNull(_0x4966a0){return _0x4966a0!==null&&!_['isUndefined'](_0x4966a0);}function checkIsLoggedIn(_0x47bb26,_0x492665){return function(){if(_0x492665<=0x0){_0x47bb26['message']=_0x4c1c('0x3f');throw _0x47bb26[_0x4c1c('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x360999){return _0x360999;}function checkIsActive(_0x83912e,_0x5cbe86){return function(){if(!isActive(_0x5cbe86)){_0x83912e['message']=_0x4c1c('0x41');throw _0x83912e[_0x4c1c('0x40')]+_0x4c1c('0x42');}};}function checkInterval(_0x5cd418){return function(){if(!isNotNull(_0x5cd418['Interval'])){_0x5cd418[_0x4c1c('0x43')]=_0x4c1c('0x44');throw _0x5cd418[_0x4c1c('0x40')]+_0x4c1c('0x45');}if(!isNotNull(_0x5cd418[_0x4c1c('0x46')]['Intervals'])){_0x5cd418[_0x4c1c('0x43')]=_0x4c1c('0x44');throw _0x5cd418['name']+_0x4c1c('0x45');}if(!isNotNull(_[_0x4c1c('0x47')](_0x5cd418['Interval'][_0x4c1c('0x48')]))){_0x5cd418[_0x4c1c('0x43')]=_0x4c1c('0x44');throw _0x5cd418[_0x4c1c('0x40')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x5e0679,_0x4e0e11,_0x1b773d){return{'action':_0x5e0679,'response':_0x4e0e11,'message':_0x1b773d,'stack':_0x1b773d};}function myreject(_0x14ec9b){return function(_0x222493){return _0x14ec9b(msgResponse('[ifTime][Action]',_0x4c1c('0x49'),JSON['stringify'](_0x222493)));};}function getSeconds(_0x37cf62,_0x214bbf){var _0x259df6=moment(_0x37cf62)[_0x4c1c('0x4a')](0x0);var _0x2191d5=moment(_0x214bbf)[_0x4c1c('0x4a')](0x0);return _0x259df6[_0x4c1c('0x4b')](_0x2191d5,_0x4c1c('0x4c'));}function emit(_0x119238,_0x8e5988,_0x43bb0b){io['to'](_0x119238)[_0x4c1c('0x4d')](_0x8e5988,_0x43bb0b);}function emitVoiceQueueSummary(_0x1d8460){if(_0x1d8460[_0x4c1c('0x4e')]===_0x4c1c('0x4f')){var _0x3c4aad={'id':_0x1d8460['id'],'name':_0x1d8460['name'],'strategy':_0x1d8460['strategy'],'answered':_0x1d8460[_0x4c1c('0x50')],'available':_0x1d8460['available'],'loggedIn':_0x1d8460[_0x4c1c('0x51')],'pTalking':_0x1d8460[_0x4c1c('0x52')],'sumBillable':_0x1d8460[_0x4c1c('0x53')],'sumDuration':_0x1d8460[_0x4c1c('0x54')],'sumHoldTime':_0x1d8460['sumHoldTime']||0x0,'talking':_0x1d8460[_0x4c1c('0x55')],'total':_0x1d8460[_0x4c1c('0x56')],'type':_0x1d8460[_0x4c1c('0x4e')],'unmanaged':_0x1d8460['unmanaged'],'abandoned':_0x1d8460[_0x4c1c('0x57')],'waiting':_0x1d8460[_0x4c1c('0x58')],'loggedInDb':_0x1d8460[_0x4c1c('0x59')],'dialActive':_0x1d8460[_0x4c1c('0x5a')],'dialMethod':_0x1d8460[_0x4c1c('0x5b')],'dialOriginateCallerIdName':_0x1d8460[_0x4c1c('0x5c')],'dialOriginateCallerIdNumber':_0x1d8460[_0x4c1c('0x5d')],'dialOriginateTimeout':_0x1d8460[_0x4c1c('0x5e')],'dialPrefix':_0x1d8460['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1d8460[_0x4c1c('0x5f')],'outboundAnswerCallsDay':_0x1d8460[_0x4c1c('0x60')],'outboundBlacklistCallsDay':_0x1d8460[_0x4c1c('0x61')],'outboundBusyCallsDay':_0x1d8460[_0x4c1c('0x62')],'outboundCongestionCallsDay':_0x1d8460['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1d8460[_0x4c1c('0x63')],'outboundDropCallsDayCallersExit':_0x1d8460[_0x4c1c('0x64')],'outboundDropCallsDayTimeout':_0x1d8460[_0x4c1c('0x65')],'outboundNoAnswerCallsDay':_0x1d8460[_0x4c1c('0x66')],'outboundNoSuchCallsDay':_0x1d8460['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1d8460['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1d8460[_0x4c1c('0x67')],'outboundRejectCallsDay':_0x1d8460['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1d8460[_0x4c1c('0x68')],'predictiveIntervalAnsweredCalls':_0x1d8460[_0x4c1c('0x69')],'predictiveIntervalAvgHoldtime':_0x1d8460[_0x4c1c('0x6a')],'predictiveIntervalAvgTalktime':_0x1d8460['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1d8460[_0x4c1c('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x1d8460[_0x4c1c('0x6c')],'predictiveIntervalErlangCalls':_0x1d8460[_0x4c1c('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x1d8460['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1d8460[_0x4c1c('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x1d8460[_0x4c1c('0x6f')],'predictiveIntervalPauses':_0x1d8460[_0x4c1c('0x70')],'predictiveIntervalAvailable':_0x1d8460[_0x4c1c('0x71')],'predictiveIntervalTotalCalls':_0x1d8460[_0x4c1c('0x72')],'message':_0x1d8460['message'],'originated':_0x1d8460[_0x4c1c('0x73')],'erlangCalls':_0x1d8460['erlangCalls'],'erlangCallToSecond':_0x1d8460[_0x4c1c('0x74')],'erlangAbandonmentRate':_0x1d8460[_0x4c1c('0x75')],'erlangBusyFactor':_0x1d8460[_0x4c1c('0x76')],'startPredictive':_0x1d8460[_0x4c1c('0x28')],'startProgressive':_0x1d8460[_0x4c1c('0x77')]};if(_0x1d8460['Trunk']){_0x3c4aad[_0x4c1c('0x78')]={'id':_0x1d8460['Trunk']['id'],'name':_0x1d8460['Trunk'][_0x4c1c('0x40')],'active':_0x1d8460[_0x4c1c('0x78')]['active'],'callerid':_0x1d8460[_0x4c1c('0x78')][_0x4c1c('0x79')]};}if(_0x1d8460[_0x4c1c('0x46')]){_0x3c4aad[_0x4c1c('0x46')]={'id':_0x1d8460['Interval']['id'],'name':_0x1d8460[_0x4c1c('0x46')]['name']};}var _0x32117a=md5(JSON[_0x4c1c('0x7a')](_0x3c4aad));if(_0x1d8460[_0x4c1c('0x5')]!==_0x32117a){_0x1d8460[_0x4c1c('0x5')]=_0x32117a;emit(util['format'](_0x4c1c('0x7b'),_0x3c4aad[_0x4c1c('0x40')]),_0x4c1c('0x7c'),_0x3c4aad);}}}function emitCampaignSummary(_0x198242){if(_0x198242['type']==='ivr'){emit(util['format'](_0x4c1c('0x7d'),_0x198242[_0x4c1c('0x40')]),_0x4c1c('0x7e'),_0x198242);}}function checkGetDataPredictive(_0x25377b){if(isNotNull(_0x25377b)&&!_[_0x4c1c('0x47')](_0x25377b)){loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x80'));loggerPredictive[_0x4c1c('0x7f')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25377b[_0x4c1c('0x72')]);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x81'),_0x25377b[_0x4c1c('0x69')]);loggerPredictive[_0x4c1c('0x7f')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25377b[_0x4c1c('0x6c')]);loggerPredictive['info'](_0x4c1c('0x82'),_0x25377b[_0x4c1c('0x6b')]);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x83'),_0x25377b[_0x4c1c('0x6a')]);loggerPredictive[_0x4c1c('0x7f')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25377b['predictiveIntervalAvgTalktime']);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x84'));if(_0x25377b['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x25377b[_0x4c1c('0x85')])&&_0x25377b[_0x4c1c('0x85')]>0x0){return!![];}loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x86'));if(!_[_0x4c1c('0x87')](_0x25377b[_0x4c1c('0x6a')])&&_0x25377b[_0x4c1c('0x6a')]>0x0){return!![];}loggerPredictive[_0x4c1c('0x7f')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x4c1c('0x7f')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xbb51f4){return function(_0x5eb415){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x88'),_0x5eb415[_0x4c1c('0x89')]);loggerPredictive[_0x4c1c('0x7f')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5eb415['erlangCallToSecond']);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x8a'),_0x5eb415[_0x4c1c('0x75')]);loggerPredictive['info'](_0x4c1c('0x8b'),_0x5eb415[_0x4c1c('0x76')]);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x8a'),_0x5eb415[_0x4c1c('0x75')]);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x84'));_[_0x4c1c('0x8c')](_0xbb51f4,_0x5eb415);};}function getDiff(_0x391051){var _0x3b43db=moment()[_0x4c1c('0x4a')](0x0);var _0x3e38c9=moment(_0x391051)[_0x4c1c('0x4a')](0x0);return _0x3b43db[_0x4c1c('0x4b')](_0x3e38c9,_0x4c1c('0x4c'));}function ifInterval(_0x128834,_0x427b29){if(_['isUndefined'](_0x427b29)){return![];}return getDiff(_0x427b29)<_0x128834*0x3c;}function freeVariablesPredictive(_0x143f27){if(isNotNull(_0x143f27)){if(!_['isUndefined'](_0x143f27['startProgressive'])){_0x143f27['startProgressive']=undefined;loggerPredictive[_0x4c1c('0x7f')](_0x143f27[_0x4c1c('0x40')],_0x4c1c('0x8d'));}if(!_[_0x4c1c('0x87')](_0x143f27[_0x4c1c('0x28')])){_0x143f27[_0x4c1c('0x28')]=undefined;loggerPredictive['info'](_0x143f27[_0x4c1c('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x4c1c('0x87')](_0x143f27[_0x4c1c('0x8e')])){clearInterval(_0x143f27[_0x4c1c('0x8e')]);_0x143f27['handlePredictive']=undefined;loggerPredictive[_0x4c1c('0x7f')](_0x143f27['name'],_0x4c1c('0x8f'));}}}function erlangb(_0x58d0fd,_0x4edc48){if(_0x4edc48===0x0){return 0x0;}var _0x2c8746=0x1;for(var _0xfc3cf8=0x1;_0xfc3cf8<=_0x4edc48;_0xfc3cf8+=0x1){_0x2c8746=0x1+_0x2c8746*_0xfc3cf8/_0x58d0fd;}return 0x1/_0x2c8746;}function isVoiceQueueOutbound(_0x232b01){return _0x232b01===_0x4c1c('0x4f');}function isNotPreview(_0x4641a3){return _0x4641a3!==_0x4c1c('0x1f');}function isCampaignIvr(_0x1a1f22){return _0x1a1f22===_0x4c1c('0x90');}function getCallerId(_0x14b5c9,_0x4fe15a,_0x487b4d){if(!_[_0x4c1c('0x87')](_0x487b4d)&&typeof _0x487b4d===_0x4c1c('0x91')&&!_[_0x4c1c('0x47')](_0x487b4d)){if(!_[_0x4c1c('0x87')](_0x4fe15a)&&typeof _0x4fe15a===_0x4c1c('0x91')&&!_[_0x4c1c('0x47')](_0x4fe15a)){return util[_0x4c1c('0x92')](_0x4c1c('0x93'),_0x4fe15a,_0x487b4d);}return util[_0x4c1c('0x92')](_0x4c1c('0x93'),_0x487b4d,_0x487b4d);}if(!_[_0x4c1c('0x87')](_0x14b5c9)&&typeof _0x14b5c9===_0x4c1c('0x91')&&!_[_0x4c1c('0x47')](_0x14b5c9)){return _0x14b5c9;}return _0x4c1c('0x94');}function loggerCatchQueueSummary(_0x29edfe,_0xf18715){return function(_0x15dfea){freeVariablesPredictive(_0xf18715);emitVoiceQueueSummary(_0xf18715);emitCampaignSummary(_0xf18715);loggerSyncQueueSummary[_0x4c1c('0x95')](_0x29edfe,util[_0x4c1c('0x96')](_0x15dfea,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3bf255,_0x33c228){return function(_0x1bc57b){loggerPredictive['error'](_0x33c228[_0x4c1c('0x40')],_0x3bf255);loggerPredictive[_0x4c1c('0x95')](_0x1bc57b[_0x4c1c('0x97')]);freeVariablesPredictive(_0x33c228);};}function loggerCatch(_0x36608e){return function(_0x2115f4){logger[_0x4c1c('0x95')](_0x36608e,util[_0x4c1c('0x96')](_0x2115f4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4e9c87){return _0x4e9c87&&!_[_0x4c1c('0x87')](_0x4e9c87)&&_0x4e9c87['length']>0x0;}function decremetOriginate(_0x569da7){if(!_[_0x4c1c('0x87')](_0x569da7)&&_0x569da7!==null){if(typeof _0x569da7[_0x4c1c('0x73')]!=='undefined'){if(_0x569da7[_0x4c1c('0x73')]>0x0){_0x569da7[_0x4c1c('0x73')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4c1c('0x95')](_0x4c1c('0x98'));}}function checkContactLowerLimitOriginate(_0x50c8c9,_0x5d12e2,_0x3cb052){if(_0x5d12e2>_0x3cb052){for(var _0x450e40=0x0;_0x450e40<_0x5d12e2-_0x3cb052;_0x450e40+=0x1){decremetOriginate(_0x50c8c9);}}}function loggerGetContactDialer(_0x5b0189,_0x74a3a4,_0x2ac051){return function(_0x5a006b){checkContactLowerLimitOriginate(_0x74a3a4,_0x2ac051,0x0);logger[_0x4c1c('0x95')](_0x5b0189,util[_0x4c1c('0x96')](_0x5a006b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3c80fd){return function(_0x2ed3ea){if(isNotNull(_0x2ed3ea)&&isNotNull(_0x2ed3ea[0x0])){if(_0x2ed3ea[0x0][_0x4c1c('0x99')]>0x0){_0x3c80fd['message']=_0x4c1c('0x9a');logger[_0x4c1c('0x7f')](_0x4c1c('0x9b')+_0x3c80fd[_0x4c1c('0x40')],_0x2ed3ea[0x0][_0x4c1c('0x99')],_0x4c1c('0x9c'));}else{_0x3c80fd[_0x4c1c('0x43')]=_0x4c1c('0x9d');logger[_0x4c1c('0x7f')]('[getContactDialer2][Empty]'+_0x3c80fd[_0x4c1c('0x40')]);}}};}function notSendMessagesQueue(_0x5654d9){if(_0x5654d9[_0x4c1c('0x9e')]){freeVariablesPredictive(_0x5654d9);if(_0x5654d9[_0x4c1c('0x73')]===0x0&&_0x5654d9['talking']===0x0&&_0x5654d9[_0x4c1c('0x58')]===0x0&&(_0x5654d9[_0x4c1c('0x52')]||0x0)===0x0){_0x5654d9[_0x4c1c('0x9e')]=![];_0x5654d9[_0x4c1c('0x9f')]=0x0;_0x5654d9[_0x4c1c('0x43')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x4c1c('0x95')](_0x4c1c('0xa0'),_0x5654d9['name'],'is\x20not\x20active');}else{_0x5654d9['message']=_0x4c1c('0xa1');loggerSyncQueueSummary['error'](_0x4c1c('0xa0'),_0x5654d9[_0x4c1c('0x40')],_0x4c1c('0xa2'));}emitVoiceQueueSummary(_0x5654d9);}}function notSendMessagesCampaign(_0x36597a){if(_0x36597a['sendMessageOneNotActive']){if(_0x36597a[_0x4c1c('0x73')]===0x0){_0x36597a[_0x4c1c('0x9e')]=![];_0x36597a[_0x4c1c('0x43')]=_0x4c1c('0x41');loggerSyncQueueSummary[_0x4c1c('0x95')](_0x4c1c('0xa3'),_0x36597a[_0x4c1c('0x40')],_0x4c1c('0xa4'));}else{_0x36597a['message']=_0x4c1c('0xa1');loggerSyncQueueSummary[_0x4c1c('0x95')](_0x4c1c('0xa3'),_0x36597a['name'],'is\x20disactive');}emitCampaignSummary(_0x36597a);}}function createObjHistory(_0x2b497a,_0x4ded81,_0xb1e313,_0x2da874,_0x51614a){_0x2b497a[_0x4c1c('0x43')]=_0xb1e313;var _0x113d4b=new Action(_0x2b497a,_0x4ded81);var _0x319dbc=new History(_0x113d4b);_0x319dbc[_0x4c1c('0xa5')]=_0x2da874;_0x319dbc['statedesc']=_0x51614a;_0x319dbc['endtime']=_0x113d4b[_0x4c1c('0xa6')];return _0x319dbc;}Dialer[_0x4c1c('0x1b')][_0x4c1c('0x3e')]=function(){var _0x1284e4=this;setInterval(function(){_0x1284e4[_0x4c1c('0xa7')](_0x1284e4[_0x4c1c('0xa8')],_0x4c1c('0xa9'));_0x1284e4[_0x4c1c('0xa7')](_0x1284e4[_0x4c1c('0x26')],_0x4c1c('0xaa'));},0x32c8);};Dialer[_0x4c1c('0x1b')]['clearZombieChannels']=function(_0x35a816,_0x94a8da){var _0x2deb79=this;for(var _0x1798f9 in _0x35a816){if(typeof _0x35a816[_0x1798f9]!==_0x4c1c('0xab')){this['sequence']['enqueue'](function(){if(!_[_0x4c1c('0xac')](_0x35a816[_0x1798f9])){return ami[_0x4c1c('0xad')]({'action':_0x4c1c('0xae'),'channel':_0x35a816[_0x1798f9][_0x4c1c('0xaf')]})[_0x4c1c('0xb0')](function(_0x2536eb){if(_0x2536eb['message']===_0x4c1c('0xb1')){setTimeout(function(){if(_0x35a816[_0x1798f9]&&_0x35a816[_0x1798f9][_0x4c1c('0x4e')]!==_0x4c1c('0x90')){_0x2deb79[_0x4c1c('0xb2')](_0x2deb79[_0x4c1c('0x20')][_0x35a816[_0x1798f9][_0x4c1c('0xb3')]]);logger[_0x4c1c('0x95')](_0x4c1c('0xb4'),_0x94a8da,_0x1798f9,_0x35a816[_0x1798f9][_0x4c1c('0xb3')]);delete _0x35a816[_0x1798f9];}if(_0x35a816[_0x1798f9]&&_0x35a816[_0x1798f9][_0x4c1c('0x4e')]==='ivr'){_0x2deb79['updateOriginated'](_0x2deb79[_0x4c1c('0x21')][_0x35a816[_0x1798f9][_0x4c1c('0xb3')]]);logger[_0x4c1c('0x95')](_0x4c1c('0xb5'),_0x94a8da,_0x1798f9,_0x35a816[_0x1798f9][_0x4c1c('0xb3')]);delete _0x35a816[_0x1798f9];}},0x2328);}});}});}}};Dialer['prototype'][_0x4c1c('0xb6')]=function(_0x1bff9e){return BPromise[_0x4c1c('0xb7')]()[_0x4c1c('0xb8')](cmHopper[_0x4c1c('0xb6')](_0x1bff9e))[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0xb9')));};Dialer[_0x4c1c('0x1b')]['checkIsBlackList']=function(_0x305348){return BPromise[_0x4c1c('0xb7')]()[_0x4c1c('0xb8')](cmHopperBlack[_0x4c1c('0xba')](_0x305348))[_0x4c1c('0xb0')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x4c1c('0x1b')]['checkIsBlackListIvr']=function(_0x46363f){return BPromise[_0x4c1c('0xb7')]()[_0x4c1c('0xb8')](cmHopperBlack[_0x4c1c('0xbb')](_0x46363f))[_0x4c1c('0xb0')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xbc')]=function(_0x3d4de6){return BPromise[_0x4c1c('0xb7')]()[_0x4c1c('0xb8')](cmHopperHistory[_0x4c1c('0xbd')](_0x3d4de6))[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0xbe')));};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xbf')]=function(_0x5d6362){return BPromise[_0x4c1c('0xb7')]()[_0x4c1c('0xb8')](cmHopper[_0x4c1c('0xbf')](_0x5d6362))[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0xc0')));};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xc1')]=function(_0x5abbaa,_0x416dfe,_0x37297e){return BPromise[_0x4c1c('0xb7')]()['then'](cmHopper[_0x4c1c('0xc1')](_0x5abbaa,_0x416dfe,_0x37297e))[_0x4c1c('0xb0')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xc2')]=function(_0x3e0d49,_0xd6d748,_0xac1afe,_0x32e0c0,_0x5a85a7){return BPromise[_0x4c1c('0xb7')]()[_0x4c1c('0xb8')](cmHopper['getContactDialer'](_0x3e0d49,_0xd6d748,_0xac1afe,_0x32e0c0))[_0x4c1c('0xb0')](function(_0x5da0a7){_0x5a85a7[_0x4c1c('0xc3')]-=_0xac1afe;_0x5a85a7[_0x4c1c('0xc3')]=_0x5a85a7[_0x4c1c('0xc3')]>0x0?_0x5a85a7[_0x4c1c('0xc3')]:0x0;loggerCatch(_0x4c1c('0xc4'))(_0x5da0a7);});};Dialer['prototype'][_0x4c1c('0xc5')]=function(_0x52ff3e,_0xe8f86,_0x4fdeb1,_0x38c83b){return BPromise[_0x4c1c('0xb7')]()[_0x4c1c('0xb8')](cmHopper['getContactDialerIvr'](_0x52ff3e,_0xe8f86,_0x4fdeb1))['catch'](function(_0x21b932){_0x38c83b['temp']-=_0xe8f86;_0x38c83b[_0x4c1c('0xc3')]=_0x38c83b['temp']>0x0?_0x38c83b['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x21b932);});};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xc6')]=function(_0xe780bc){return BPromise['resolve']()['then'](voiceQueueRt[_0x4c1c('0xc6')](_0xe780bc))[_0x4c1c('0xb0')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xc7')]=function(_0x7760b4){return BPromise[_0x4c1c('0xb7')]()[_0x4c1c('0xb8')](cmHopper[_0x4c1c('0xc7')](_0x7760b4))[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0xc8')));};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xc9')]=function(_0x2a42ac){return BPromise['resolve']()[_0x4c1c('0xb8')](cmHopperHistory[_0x4c1c('0xc9')](_0x2a42ac))[_0x4c1c('0xb0')](loggerCatch('[createHistory]\x20'));};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xb2')]=function(_0xb16626){if(!_[_0x4c1c('0x87')](_0xb16626)&&_0xb16626!==null){if(typeof _0xb16626[_0x4c1c('0x73')]!==_0x4c1c('0xab')){if(_0xb16626[_0x4c1c('0x73')]>0x0){_0xb16626[_0x4c1c('0x73')]-=0x1;}else{logger[_0x4c1c('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x4c1c('0xca'));}};Dialer['prototype'][_0x4c1c('0xcb')]=function(_0x470db0,_0x52210a){var _0xe319ed=this;return function(_0x2af69e){_0xe319ed['updateOriginated'](_0x52210a);logger['error'](_0x470db0,util[_0x4c1c('0x96')](_0x2af69e,{'showHidden':![],'depth':null}));};};Dialer[_0x4c1c('0x1b')]['emptyContact']=function(_0x43fb1c,_0x164a2b,_0x4f7cc8){var _0x4fe1ed={'state':0x19,'statedesc':_0x4c1c('0xcc')};this['updateOriginated'](_0x164a2b);this[_0x4c1c('0xcd')](_[_0x4c1c('0x8c')](_0x4fe1ed,_[_0x4c1c('0xce')](_0x4f7cc8,[_0x4c1c('0xcf'),_0x4c1c('0xd0'),_0x4c1c('0xd1'),_0x4c1c('0xd2'),'CampaignId'])),_0x4c1c('0xd3'),'[emptyContact]');logger[_0x4c1c('0x95')](_0x43fb1c);};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xd4')]=function(_0x1e2812){return _0x1e2812===_0x4c1c('0xd5');};Dialer['prototype'][_0x4c1c('0xd6')]=function(_0x34d311){return!_[_0x4c1c('0x87')](_0x34d311)&&_0x34d311&&!_[_0x4c1c('0x87')](_0x34d311[_0x4c1c('0x40')])&&!_[_0x4c1c('0x87')](_0x34d311[_0x4c1c('0xd7')])&&_0x34d311[_0x4c1c('0xd7')]&&(this[_0x4c1c('0x23')][util['format'](_0x4c1c('0xd8'),_0x34d311['name'])]['status']==='reachable'||this[_0x4c1c('0x23')][util['format']('SIP/%s',_0x34d311['name'])][_0x4c1c('0xae')]==='unmonitored');};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xcd')]=function(_0x29d1e0,_0x30f1a4,_0x104e61){this['createHistory'](_0x29d1e0)[_0x4c1c('0xb0')](loggerCatch(_0x30f1a4));this['moveContactManagedDialer'](_0x29d1e0)[_0x4c1c('0xb0')](loggerCatch(_0x104e61));};Dialer['prototype']['syncVarSet']=function(_0x3c6e31){var _0x5d51ce=this['uniqueId'][_0x3c6e31[_0x4c1c('0xd9')]];var _0x258a0a;if(!_['isNil'](_0x3c6e31)&&!_[_0x4c1c('0xac')](_0x3c6e31[_0x4c1c('0xda')])&&!_[_0x4c1c('0xac')](_0x3c6e31[_0x4c1c('0xda')][_0x4c1c('0xdb')])&&_0x3c6e31[_0x4c1c('0xdc')]===_0x4c1c('0xdd')&&_0x5d51ce){if(_0x5d51ce[_0x4c1c('0x4e')]!==_0x4c1c('0x90')&&this[_0x4c1c('0x20')][_0x5d51ce[_0x4c1c('0xb3')]][_0x4c1c('0xde')]&&_0x3c6e31[_0x4c1c('0xdf')]===_0x4c1c('0xe0')){delete this['uniqueId'][_0x3c6e31['uniqueid']];this[_0x4c1c('0xb2')](this[_0x4c1c('0x20')][_0x5d51ce[_0x4c1c('0xb3')]]);this['voiceQueues'][_0x5d51ce[_0x4c1c('0xb3')]][_0x4c1c('0x60')]+=0x1;this[_0x4c1c('0x20')][_0x5d51ce[_0x4c1c('0xb3')]][_0x4c1c('0x5f')]+=0x1;_0x258a0a=new Hangup(_0x5d51ce,_0x3c6e31);_0x258a0a[_0x4c1c('0xa5')]=0x12;_0x258a0a['statedesc']='HangupInAMD';_0x258a0a[_0x4c1c('0xe1')]=_0x4c1c('0xe2');ami[_0x4c1c('0x4d')](_0x4c1c('0xe3'),ut[_0x4c1c('0xe4')](_0x258a0a,'amd'));this[_0x4c1c('0xcd')](_0x258a0a,_0x4c1c('0xe5'),_0x4c1c('0xe6'));}if(_0x5d51ce[_0x4c1c('0x4e')]!=='ivr'&&this[_0x4c1c('0x20')][_0x5d51ce['queue']][_0x4c1c('0xde')]&&_0x3c6e31[_0x4c1c('0xdf')]===_0x4c1c('0xe7')){var _0x64259b=this;return new BPromise(function(_0x31bb58,_0x27cce1){delete _0x64259b['uniqueId'][_0x3c6e31[_0x4c1c('0xd9')]];_0x64259b[_0x4c1c('0xb2')](_0x64259b[_0x4c1c('0x20')][_0x5d51ce[_0x4c1c('0xb3')]]);_0x64259b[_0x4c1c('0x20')][_0x5d51ce[_0x4c1c('0xb3')]][_0x4c1c('0x60')]+=0x1;_0x64259b[_0x4c1c('0x20')][_0x5d51ce[_0x4c1c('0xb3')]][_0x4c1c('0x5f')]+=0x1;var _0x1647fa=_0x64259b[_0x4c1c('0x20')][_0x5d51ce[_0x4c1c('0xb3')]];var _0x630818=new Hangup(_0x5d51ce,_0x3c6e31);_0x630818[_0x4c1c('0xa5')]=0x13;_0x630818[_0x4c1c('0xe8')]=_0x4c1c('0xe9');_0x630818[_0x4c1c('0xe1')]=_0x4c1c('0xe2');_0x630818['countmachineretry']+=0x1;_0x630818[_0x4c1c('0xea')]+=0x1;_0x630818[_0x4c1c('0xeb')]=!![];ami['emit'](_0x4c1c('0xe3'),ut[_0x4c1c('0xe4')](_0x630818,_0x4c1c('0xeb')));_0x64259b[_0x4c1c('0xc9')](_0x630818)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x630818[_0x4c1c('0xec')]+_0x630818['countcongestionretry']+_0x630818[_0x4c1c('0xed')]+_0x630818[_0x4c1c('0xee')]+_0x630818[_0x4c1c('0xef')]+_0x630818[_0x4c1c('0xf0')]+_0x630818[_0x4c1c('0xf1')]+_0x630818['countagentrejectretry']>=_0x1647fa[_0x4c1c('0xf2')]){_0x64259b[_0x4c1c('0xf3')](_0x630818,_0x31bb58,_0x27cce1,_0x4c1c('0xf4'));}else{if(_0x630818[_0x4c1c('0xf1')]>=_0x1647fa['dialMachineMaxRetry']){_0x64259b[_0x4c1c('0xf5')](_0x630818,_0x31bb58,_0x27cce1,_0x4c1c('0xf6'));}else{_0x64259b[_0x4c1c('0xbf')]({'active':![],'countmachineretry':_0x630818[_0x4c1c('0xf1')],'scheduledat':moment()[_0x4c1c('0xf7')](_0x1647fa[_0x4c1c('0xf8')],_0x4c1c('0xf9'))[_0x4c1c('0x92')](_0x4c1c('0xfa')),'ContactId':_0x630818['ContactId'],'ListId':_0x630818[_0x4c1c('0xd0')],'VoiceQueueId':_0x630818['VoiceQueueId']||undefined,'CampaignId':_0x630818[_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch('[rescheduleContact][Machine]'));_0x31bb58({'reschedule':0x1});}}});}if(_0x5d51ce[_0x4c1c('0x4e')]===_0x4c1c('0x90')&&this[_0x4c1c('0x21')][_0x5d51ce[_0x4c1c('0xb3')]][_0x4c1c('0xde')]&&_0x3c6e31['value']===_0x4c1c('0xe0')){delete this['uniqueId'][_0x3c6e31['uniqueid']];this['updateOriginated'](this['campaigns'][_0x5d51ce[_0x4c1c('0xb3')]]);_0x258a0a=new Hangup(_0x5d51ce,_0x3c6e31);_0x258a0a[_0x4c1c('0xa5')]=0x12;_0x258a0a[_0x4c1c('0xe8')]=_0x4c1c('0xfc');_0x258a0a[_0x4c1c('0xe1')]=_0x4c1c('0xe2');ami['emit'](_0x4c1c('0xe3'),ut['buildObj'](_0x258a0a,_0x4c1c('0xeb')));this[_0x4c1c('0xcd')](_0x258a0a,_0x4c1c('0xfd'),'[syncHangupInAMDIvr]');}if(_0x5d51ce[_0x4c1c('0x4e')]===_0x4c1c('0x90')&&this[_0x4c1c('0x21')][_0x5d51ce['queue']][_0x4c1c('0xde')]&&_0x3c6e31['value']===_0x4c1c('0xe7')){var _0x64259b=this;return new BPromise(function(_0xb4fdb9,_0x4de982){delete _0x64259b[_0x4c1c('0xa8')][_0x3c6e31['uniqueid']];_0x64259b['updateOriginated'](_0x64259b[_0x4c1c('0x21')][_0x5d51ce[_0x4c1c('0xb3')]]);_0x64259b[_0x4c1c('0x21')][_0x5d51ce[_0x4c1c('0xb3')]][_0x4c1c('0x60')]+=0x1;_0x64259b['campaigns'][_0x5d51ce[_0x4c1c('0xb3')]][_0x4c1c('0x5f')]+=0x1;var _0x5ceab8=_0x64259b['campaigns'][_0x5d51ce[_0x4c1c('0xb3')]];var _0x161376=new Hangup(_0x5d51ce,_0x3c6e31);_0x161376[_0x4c1c('0xa5')]=0x13;_0x161376[_0x4c1c('0xe8')]=_0x4c1c('0xe9');_0x161376[_0x4c1c('0xe1')]=_0x4c1c('0xe2');_0x161376[_0x4c1c('0xf1')]+=0x1;_0x161376[_0x4c1c('0xea')]+=0x1;_0x161376[_0x4c1c('0xeb')]=!![];ami[_0x4c1c('0x4d')]('custom:amd',ut['buildObj'](_0x161376,_0x4c1c('0xeb')));_0x64259b[_0x4c1c('0xc9')](_0x161376)['catch'](loggerCatch(_0x4c1c('0xfe')));if(_0x161376[_0x4c1c('0xec')]+_0x161376['countcongestionretry']+_0x161376[_0x4c1c('0xed')]+_0x161376[_0x4c1c('0xee')]+_0x161376[_0x4c1c('0xef')]+_0x161376[_0x4c1c('0xf0')]+_0x161376[_0x4c1c('0xf1')]+_0x161376['countagentrejectretry']>=_0x5ceab8[_0x4c1c('0xf2')]){_0x64259b[_0x4c1c('0xf3')](_0x161376,_0xb4fdb9,_0x4de982,_0x4c1c('0xf4'));}else{if(_0x161376[_0x4c1c('0xf1')]>=_0x5ceab8[_0x4c1c('0xff')]){_0x64259b[_0x4c1c('0xf5')](_0x161376,_0xb4fdb9,_0x4de982,_0x4c1c('0xf6'));}else{_0x64259b[_0x4c1c('0xbf')]({'active':![],'countmachineretry':_0x161376[_0x4c1c('0xf1')],'scheduledat':moment()[_0x4c1c('0xf7')](_0x5ceab8[_0x4c1c('0xf8')],_0x4c1c('0xf9'))[_0x4c1c('0x92')](_0x4c1c('0xfa')),'ContactId':_0x161376[_0x4c1c('0xcf')],'ListId':_0x161376[_0x4c1c('0xd0')],'VoiceQueueId':_0x161376[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x161376[_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch('[rescheduleContact][Machine]'));_0xb4fdb9({'reschedule':0x1});}}});}}};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x35')]=function(_0x342903){var _0x15ba75=this[_0x4c1c('0xa8')][_0x342903[_0x4c1c('0xd9')]];var _0x21b92f=this;var _0x31152d;if(_0x15ba75&&_0x15ba75[_0x4c1c('0x4e')]===_0x4c1c('0x90')){delete this[_0x4c1c('0xa8')][_0x342903[_0x4c1c('0xd9')]];this['updateOriginated'](this[_0x4c1c('0x21')][_0x15ba75[_0x4c1c('0xb3')]]);this[_0x4c1c('0x21')][_0x15ba75[_0x4c1c('0xb3')]][_0x4c1c('0x100')]+=0x1;_0x31152d=new Hangup(_0x15ba75,_0x342903);this[_0x4c1c('0xc9')](_0x31152d)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x101')));this[_0x4c1c('0xc7')](_0x31152d)['catch'](loggerCatch(_0x4c1c('0x102')));}if(_0x15ba75&&_0x15ba75[_0x4c1c('0x4e')]!==_0x4c1c('0x90')&&isNotNull(this[_0x4c1c('0x20')][_0x15ba75[_0x4c1c('0xb3')]]['dialQueueProject'])){delete this['uniqueId'][_0x342903['uniqueid']];this[_0x4c1c('0xb2')](this[_0x4c1c('0x20')][_0x15ba75['queue']]);this[_0x4c1c('0x20')][_0x15ba75['queue']][_0x4c1c('0x60')]+=0x1;this[_0x4c1c('0x20')][_0x15ba75[_0x4c1c('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x31152d=new Hangup(_0x15ba75,_0x342903);_0x31152d[_0x4c1c('0xa5')]=0x10;_0x31152d[_0x4c1c('0xe8')]=_0x4c1c('0x103');_0x31152d[_0x4c1c('0xe1')]=_0x4c1c('0x104');this['createHistory'](_0x31152d)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x101')));this[_0x4c1c('0xc7')](_0x31152d)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x15ba75&&_0x15ba75[_0x4c1c('0x4e')]!==_0x4c1c('0x90')&&!isNotNull(this[_0x4c1c('0x20')][_0x15ba75[_0x4c1c('0xb3')]][_0x4c1c('0x105')])){delete this[_0x4c1c('0xa8')][_0x342903['uniqueid']];this[_0x4c1c('0xb2')](this['voiceQueues'][_0x15ba75[_0x4c1c('0xb3')]]);this[_0x4c1c('0x20')][_0x15ba75[_0x4c1c('0xb3')]][_0x4c1c('0x68')]+=0x1;_0x31152d=new Hangup(_0x15ba75,_0x342903);_0x31152d[_0x4c1c('0xa5')]=0xc;_0x31152d[_0x4c1c('0xe8')]=_0x342903['cause-txt'];_0x31152d[_0x4c1c('0xe1')]=_0x4c1c('0x106');this[_0x4c1c('0xc9')](_0x31152d)[_0x4c1c('0xb0')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x4c1c('0xc7')](_0x31152d)['catch'](loggerCatch(_0x4c1c('0x102')));}};Dialer[_0x4c1c('0x1b')]['syncAgentComplete']=function(_0x5ea942){var _0x2e912f=this[_0x4c1c('0xa8')][_0x5ea942[_0x4c1c('0xd9')]];var _0x3629ad=this;if(this[_0x4c1c('0x20')][_0x5ea942[_0x4c1c('0xb3')]]){if(_0x2e912f&&_0x2e912f[_0x4c1c('0x4e')]!==_0x4c1c('0x90')){delete this[_0x4c1c('0xa8')][_0x5ea942['uniqueid']];this[_0x4c1c('0x20')][_0x5ea942[_0x4c1c('0xb3')]]['outboundAnswerCallsDay']+=0x1;var _0x2ed1ee=new AgentComplete(_0x2e912f,_0x5ea942);if(_0x5ea942['reason']==='agent'){_0x2ed1ee['agiafterat']=this[_0x4c1c('0x20')][_0x5ea942[_0x4c1c('0xb3')]][_0x4c1c('0x107')]&&this[_0x4c1c('0x20')][_0x5ea942[_0x4c1c('0xb3')]][_0x4c1c('0x108')]?moment()[_0x4c1c('0x92')](_0x4c1c('0xfa')):undefined;}this['createHistory'](_0x2ed1ee)[_0x4c1c('0xb0')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x2ed1ee)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x109')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x34ffc1){if(this[_0x4c1c('0x20')][_0x34ffc1[_0x4c1c('0xb3')]]){if(this[_0x4c1c('0xa8')][_0x34ffc1[_0x4c1c('0xd9')]]&&this[_0x4c1c('0xa8')][_0x34ffc1['uniqueid']][_0x4c1c('0x4e')]!==_0x4c1c('0x90')){this[_0x4c1c('0xb2')](this[_0x4c1c('0x20')][_0x34ffc1[_0x4c1c('0xb3')]]);this[_0x4c1c('0xa8')][_0x34ffc1['uniqueid']]['answertime']=moment()[_0x4c1c('0x92')](_0x4c1c('0xfa'));}}};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x10a')]=function(_0x5e4756){this[_0x4c1c('0xc9')](_0x5e4756)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x10b')));this['moveContactManagedDialer'](_0x5e4756)[_0x4c1c('0xb0')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0x4c1c('0x2d')]=function(_0x46feaa){var _0x35662d=this[_0x4c1c('0xa8')][_0x46feaa[_0x4c1c('0xd9')]];var _0x51973b=this;if(this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]]){if(_0x35662d&&_0x35662d['type']!=='ivr'){delete this[_0x4c1c('0xa8')][_0x46feaa[_0x4c1c('0xd9')]];this[_0x4c1c('0xb2')](this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]]);_0x35662d[_0x4c1c('0x10c')]=moment()[_0x4c1c('0x92')](_0x4c1c('0xfa'));var _0x5ec074=new QueueCallerAbandon(_0x35662d,_0x46feaa);if(getSeconds(_0x35662d[_0x4c1c('0x10c')],_0x35662d['responsetime'])>=_0x35662d[_0x4c1c('0x10d')]){this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]][_0x4c1c('0x65')]+=0x1;this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]][_0x4c1c('0x10e')]+=0x1;_0x5ec074['state']=0xa;_0x5ec074['statedesc']='Drop';_0x5ec074[_0x4c1c('0x10f')]='TIMEOUT';_0x5ec074['agiafterat']=this[_0x4c1c('0x20')][_0x46feaa['queue']][_0x4c1c('0x107')]?moment()[_0x4c1c('0x92')](_0x4c1c('0xfa')):undefined;_0x5ec074[_0x4c1c('0xef')]+=0x1;_0x5ec074[_0x4c1c('0xea')]+=0x1;if(_0x5ec074[_0x4c1c('0xef')]>=this['voiceQueues'][_0x46feaa[_0x4c1c('0xb3')]]['dialDropMaxRetry']){this[_0x4c1c('0x10a')](_0x5ec074);}else{this[_0x4c1c('0xbf')]({'active':![],'countdropretry':_0x5ec074[_0x4c1c('0xef')],'scheduledat':moment()[_0x4c1c('0xf7')](this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]][_0x4c1c('0x110')],_0x4c1c('0xf9'))[_0x4c1c('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35662d[_0x4c1c('0xcf')],'ListId':_0x35662d['ListId'],'VoiceQueueId':_0x35662d['VoiceQueueId']||undefined,'CampaignId':_0x35662d[_0x4c1c('0xfb')]||undefined})['catch'](loggerCatch(_0x4c1c('0x111')));var _0x3bcefe=new History(_0x5ec074);_0x3bcefe[_0x4c1c('0xa5')]=0xa;_0x3bcefe[_0x4c1c('0xe8')]=_0x4c1c('0x112');_0x3bcefe['starttime']=moment()[_0x4c1c('0x92')](_0x4c1c('0xfa'));_0x3bcefe[_0x4c1c('0x113')]=_0x3bcefe['starttime'];_0x3bcefe[_0x4c1c('0x114')]=_0x5ec074[_0x4c1c('0x114')];_0x3bcefe['calleridnum']=_0x5ec074[_0x4c1c('0x115')];this[_0x4c1c('0xc9')](_0x3bcefe)['catch'](loggerCatch(_0x4c1c('0x116')));}}else{this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]][_0x4c1c('0x6b')]+=0x1;this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]][_0x4c1c('0x64')]+=0x1;_0x5ec074[_0x4c1c('0xa5')]=0xb;_0x5ec074['statedesc']='Abandoned';_0x5ec074['dropreason']=_0x4c1c('0x117');_0x5ec074[_0x4c1c('0xf0')]+=0x1;_0x5ec074['countglobal']+=0x1;if(_0x5ec074[_0x4c1c('0xf0')]>=this[_0x4c1c('0x20')][_0x46feaa[_0x4c1c('0xb3')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x5ec074);}else{this[_0x4c1c('0xbf')]({'active':![],'countabandonedretry':_0x5ec074[_0x4c1c('0xf0')],'scheduledat':moment()['add'](this[_0x4c1c('0x20')][_0x46feaa['queue']][_0x4c1c('0x118')],_0x4c1c('0xf9'))['format'](_0x4c1c('0xfa')),'ContactId':_0x35662d[_0x4c1c('0xcf')],'ListId':_0x35662d[_0x4c1c('0xd0')],'VoiceQueueId':_0x35662d[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x35662d['CampaignId']||undefined})[_0x4c1c('0xb0')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3bcefe=new History(_0x5ec074);_0x3bcefe['state']=0xb;_0x3bcefe[_0x4c1c('0xe8')]=_0x4c1c('0x119');_0x3bcefe[_0x4c1c('0xa6')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3bcefe[_0x4c1c('0x113')]=_0x3bcefe['starttime'];_0x3bcefe[_0x4c1c('0x114')]=_0x5ec074['calleridname'];_0x3bcefe[_0x4c1c('0x115')]=_0x5ec074[_0x4c1c('0x115')];this[_0x4c1c('0xc9')](_0x3bcefe)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x11a')));}}}}};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x11b')]=function(_0xda3f35){if(this[_0x4c1c('0x26')][_0xda3f35[_0x4c1c('0xd9')]]){this[_0x4c1c('0x26')][_0xda3f35[_0x4c1c('0xd9')]]['channel']=_0xda3f35[_0x4c1c('0xaf')];}if(this[_0x4c1c('0xa8')][_0xda3f35['uniqueid']]){this[_0x4c1c('0xa8')][_0xda3f35[_0x4c1c('0xd9')]][_0x4c1c('0xaf')]=_0xda3f35[_0x4c1c('0xaf')];}};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x3a')]=function(_0x22ba9d){if(strategy[this['voiceQueues'][this['actions'][_0x22ba9d['actionid']][_0x4c1c('0xb3')]]['strategy']]==='roundrobin'){if(this[_0x4c1c('0x26')][_0x22ba9d[_0x4c1c('0x11c')]]&&_['isNil'](this['actions'][_0x22ba9d[_0x4c1c('0x11c')]][_0x4c1c('0x11d')])&&_0x22ba9d[_0x4c1c('0xae')]==='1'&&_0x22ba9d[_0x4c1c('0x11e')]==='0'){if(this['agents'][_0x22ba9d['stateinterface']]){if(!this[_0x4c1c('0x22')][_0x22ba9d[_0x4c1c('0x11f')]]['locked']){this[_0x4c1c('0x22')][_0x22ba9d[_0x4c1c('0x11f')]]['locked']=!![];this[_0x4c1c('0x26')][_0x22ba9d[_0x4c1c('0x11c')]][_0x4c1c('0x11d')]=!![];this['actions'][_0x22ba9d[_0x4c1c('0x11c')]]['stateinterface']=_0x22ba9d[_0x4c1c('0x11f')];}}}}else if((strategy[this[_0x4c1c('0x20')][this['actions'][_0x22ba9d['actionid']][_0x4c1c('0xb3')]]['strategy']]||'rrmemory')===_0x4c1c('0x120')){if(this[_0x4c1c('0x26')][_0x22ba9d[_0x4c1c('0x11c')]]){if(this[_0x4c1c('0x22')][_0x22ba9d[_0x4c1c('0x11f')]]){this[_0x4c1c('0x26')][_0x22ba9d['actionid']]['stateinterface']=_0x22ba9d[_0x4c1c('0x11f')];if(_[_0x4c1c('0xac')](this['queueBooked'][this[_0x4c1c('0x26')][_0x22ba9d['actionid']][_0x4c1c('0xb3')]])){this['queueBooked'][this[_0x4c1c('0x26')][_0x22ba9d[_0x4c1c('0x11c')]][_0x4c1c('0xb3')]]=[];}this['queueBooked'][this['actions'][_0x22ba9d[_0x4c1c('0x11c')]][_0x4c1c('0xb3')]][_0x4c1c('0x121')](_[_0x4c1c('0x8c')](_[_0x4c1c('0xce')](this[_0x4c1c('0x26')][_0x22ba9d[_0x4c1c('0x11c')]],[_0x4c1c('0x122'),'stateinterface']),{'status':_0x22ba9d['status'],'paused':_0x22ba9d[_0x4c1c('0x11e')]}));}}}};function unlockQueueStatus(_0x421538,_0x5dce75){setTimeout(function(){if(_[_0x4c1c('0x87')](_0x421538['queueStatusComplete'])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x5dce75);}_0x421538['queueStatusComplete']=!![];loggerBooked['info'](_0x4c1c('0x123'),_0x5dce75,JSON[_0x4c1c('0x7a')](_['pick'](_0x421538,[_0x4c1c('0x40'),_0x4c1c('0x124')])));},0x1f3);}Dialer[_0x4c1c('0x1b')]['syncQueueStatusComplete']=function(_0x159fc0){var _0x4aea09=this;var _0x22ae5a=_0x4aea09['voiceQueues'][_0x4aea09['actions'][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0xb3')]];if(strategy[this[_0x4c1c('0x20')][this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0xb3')]]['strategy']]==='roundrobin'){if(this[_0x4c1c('0x26')][_0x159fc0['actionid']]&&this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0x11f')]){this['preview'][_0x4c1c('0x125')](this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0x122')],this[_0x4c1c('0x26')][_0x159fc0['actionid']][_0x4c1c('0x11f')])[_0x4c1c('0xb0')](function(_0xf5d7b2){logger[_0x4c1c('0x95')](_0x4c1c('0x126'),util[_0x4c1c('0x96')](_0xf5d7b2,{'showHidden':![],'depth':null}));})[_0x4c1c('0x1d')](function(){_0x4aea09[_0x4c1c('0xb2')](_0x4aea09[_0x4c1c('0x20')][_0x4aea09[_0x4c1c('0x26')][_0x159fc0['actionid']][_0x4c1c('0xb3')]]);_0x4aea09[_0x4c1c('0x22')][_0x4aea09[_0x4c1c('0x26')][_0x159fc0['actionid']][_0x4c1c('0x11f')]][_0x4c1c('0x11d')]=![];delete _0x4aea09[_0x4c1c('0x26')][_0x159fc0['actionid']];unlockQueueStatus(_0x22ae5a);});}else{this['updateOriginated'](this[_0x4c1c('0x20')][this[_0x4c1c('0x26')][_0x159fc0['actionid']]['queue']]);this[_0x4c1c('0xbf')]({'active':![],'ContactId':this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]]['ContactId'],'ListId':this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0xd0')],'VoiceQueueId':this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x127')));delete this['actions'][_0x159fc0['actionid']];unlockQueueStatus(_0x22ae5a);}}else if((strategy[this[_0x4c1c('0x20')][this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0xb3')]][_0x4c1c('0x128')]]||_0x4c1c('0x120'))==='rrmemory'){var _0x17594f;if(this['actions'][_0x159fc0['actionid']]&&!_[_0x4c1c('0x47')](this[_0x4c1c('0x2a')][this[_0x4c1c('0x26')][_0x159fc0['actionid']]['queue']])){if(this[_0x4c1c('0x129')][_0x4aea09[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0xb3')]]){this[_0x4c1c('0x129')][_0x4aea09[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]]['queue']]=this[_0x4c1c('0x129')][this[_0x4c1c('0x26')][_0x159fc0['actionid']][_0x4c1c('0xb3')]]?this['queueBookedRR'][this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]]['queue']]:this['queueBooked'][this['actions'][_0x159fc0[_0x4c1c('0x11c')]]['queue']]?this[_0x4c1c('0x2a')][this['actions'][_0x159fc0[_0x4c1c('0x11c')]][_0x4c1c('0xb3')]][_0x4c1c('0x12a')]||0x0:0x0;}this[_0x4c1c('0x2a')][this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]]['queue']]['_rr']=this['queueBookedRR'][this[_0x4c1c('0x26')][_0x159fc0[_0x4c1c('0x11c')]]['queue']];for(var _0x324957=0x0;_0x324957=0x0;})[_0x4c1c('0xb0')](myreject(_0x5e4ca8)));}}else{_0x3d3b75[_0x4c1c('0x121')](ami[_0x4c1c('0xad')]({'action':_0x4c1c('0x147'),'command':util[_0x4c1c('0x92')](_0x4c1c('0x142'),_0x5ea972,!_[_0x4c1c('0x87')](config[_0x4c1c('0x13f')][_0x24262f])?_0x24262f:'')})[_0x4c1c('0xb8')](function(_0x5bda67){return _0x5bda67[_0x4c1c('0x144')][_0x4c1c('0x145')](_0x4c1c('0x146'))>=0x0;})[_0x4c1c('0xb0')](myreject(_0x5e4ca8)));}BPromise[_0x4c1c('0x148')](_0x3d3b75)[_0x4c1c('0xb8')](function(_0x413541){var _0x11c27b=_[_0x4c1c('0x149')](_0x413541);if(_0x11c27b){return _0x5a93df(_0x11c27b);}else{_0x1e4abb[_0x4c1c('0x43')]=_0x58c7ab?_0x4c1c('0x14a'):_0x4c1c('0x14b');return _0x5e4ca8(msgResponse('[ifTime][promiseAll]',_0x4c1c('0x13b'),'Global:\x20'+_0x58c7ab+'\x20'+_0x595f5a+_0x4c1c('0x14c')+util[_0x4c1c('0x96')](_0x5ea972,{'showHidden':![],'depth':null})+_0x4c1c('0x14d')+_0x24262f));}})[_0x4c1c('0xb0')](function(_0x2ea5a1){return _0x5e4ca8(msgResponse('ifTime',_0x4c1c('0x13b'),JSON[_0x4c1c('0x7a')](_0x2ea5a1)));});});};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x14e')]=function(_0x3e2301){var _0x16cbb3=this;return function(){switch(_0x3e2301[_0x4c1c('0x5b')]){case _0x4c1c('0x14f'):freeVariablesPredictive(_0x3e2301);_0x16cbb3[_0x4c1c('0x150')](_0x3e2301,0x1);break;case'power':freeVariablesPredictive(_0x3e2301);_0x16cbb3[_0x4c1c('0x150')](_0x3e2301,_0x3e2301['dialPowerLevel']);break;case _0x4c1c('0x151'):_0x16cbb3[_0x4c1c('0x151')](_0x3e2301);break;case'booked':freeVariablesPredictive(_0x3e2301);_0x16cbb3[_0x4c1c('0x150')](_0x3e2301,0x1);break;default:freeVariablesPredictive(_0x3e2301);logger['error'](_0x4c1c('0x152'),_0x3e2301[_0x4c1c('0x40')],_0x4c1c('0x153'));}};};Dialer[_0x4c1c('0x1b')]['launchHandleIvr']=function(_0x5c84f8){var _0x411cca=this;return function(){_0x411cca[_0x4c1c('0x154')](_0x5c84f8);};};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x34')]=function(_0x28c8c9){var _0x44398c=this;if(isNotPreview(_0x28c8c9[_0x4c1c('0x5b')])){if(isVoiceQueueOutbound(_0x28c8c9[_0x4c1c('0x4e')])&&isActive(_0x28c8c9['dialActive'])){_0x28c8c9[_0x4c1c('0x9e')]=!![];BPromise['resolve']()[_0x4c1c('0xb8')](checkIsLoggedIn(_0x28c8c9,_0x28c8c9['loggedIn']))[_0x4c1c('0xb8')](checkIsActive(_0x28c8c9,_0x28c8c9[_0x4c1c('0x5a')]))[_0x4c1c('0xb8')](checkInterval(_0x28c8c9))[_0x4c1c('0xb8')](_0x44398c[_0x4c1c('0x134')](_0x28c8c9))[_0x4c1c('0xb8')](_0x44398c[_0x4c1c('0x138')](_0x28c8c9[_0x4c1c('0x155')],_0x28c8c9[_0x4c1c('0x156')],_0x28c8c9['name'],_0x28c8c9))[_0x4c1c('0xb8')](_0x44398c[_0x4c1c('0x13a')](_0x28c8c9[_0x4c1c('0x46')],_0x28c8c9['dialTimezone'],_0x28c8c9[_0x4c1c('0x40')],_0x28c8c9))[_0x4c1c('0xb8')](_0x44398c[_0x4c1c('0x14e')](_0x28c8c9))[_0x4c1c('0xb0')](loggerCatchQueueSummary(_0x4c1c('0x157'),_0x28c8c9));}else{notSendMessagesQueue(_0x28c8c9);}}else{freeVariablesPredictive(_0x28c8c9);}};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x133')]=function(){var _0x351517=this;var _0x238f8e;for(var _0x7745e in this[_0x4c1c('0x21')]){if(typeof this['campaigns'][_0x7745e]!==_0x4c1c('0xab')){_0x238f8e=this[_0x4c1c('0x21')][_0x7745e];if(isCampaignIvr(_0x238f8e[_0x4c1c('0x4e')])&&isActive(_0x238f8e[_0x4c1c('0xd7')])){_0x238f8e[_0x4c1c('0x9e')]=!![];BPromise[_0x4c1c('0xb7')]()['then'](checkIsActive(_0x238f8e,_0x238f8e[_0x4c1c('0xd7')]))[_0x4c1c('0xb8')](checkInterval(_0x238f8e))[_0x4c1c('0xb8')](_0x351517['checkIsTrunkReachable'](_0x238f8e))[_0x4c1c('0xb8')](_0x351517['checkIfTime'](_0x238f8e[_0x4c1c('0x155')],_0x238f8e[_0x4c1c('0x156')],_0x238f8e['name'],_0x238f8e))[_0x4c1c('0xb8')](_0x351517[_0x4c1c('0x13a')](_0x238f8e[_0x4c1c('0x46')],_0x238f8e[_0x4c1c('0x156')],_0x238f8e[_0x4c1c('0x40')],_0x238f8e))[_0x4c1c('0xb8')](_0x351517[_0x4c1c('0x158')](_0x238f8e))[_0x4c1c('0xb0')](loggerCatchQueueSummary('[syncCampaigns]',_0x238f8e));}else{notSendMessagesCampaign(_0x238f8e);}}}};function getCallerIdRandom(_0xf8cb3a,_0x3a7209){var _0x120dbe;var _0x232dc0;var _0x5ef008;if(_0x3a7209<=0x0){_0x3a7209=0x1;}_0x120dbe=new RegExp(_0x4c1c('0x159')+_0x3a7209+'}$');_0x232dc0=Math[_0x4c1c('0x15a')](0xa,_0x3a7209-0x1);_0x5ef008=Math[_0x4c1c('0x15a')](0xa,_0x3a7209)-0x1;return util[_0x4c1c('0x92')]('%s',_[_0x4c1c('0x15b')](_0xf8cb3a,_0x120dbe,_[_0x4c1c('0x15c')](_0x232dc0,_0x5ef008)));}function extractCalleridName(_0x576d88){var _0x434646=_0x576d88['match'](/"(.*?)"/);return _0x434646?_0x434646[0x1]:_0x576d88;}function extractCalleridNumber(_0x2bf5bf){var _0x30100a=_0x2bf5bf[_0x4c1c('0x15d')](/<(.*?)>/);return _0x30100a?_0x30100a[0x1]:_0x2bf5bf;}Dialer[_0x4c1c('0x1b')][_0x4c1c('0x15e')]=function(_0x155eef,_0x178798){var _0x11adec=this;var _0x38db7e=uuid['v4']();this['actions'][_0x38db7e]=new Action(_0x155eef,_0x178798,_0x38db7e);return new BPromise(function(_0x1eb217,_0x250e31){if(_['isUndefined'](_0x155eef)&&typeof _0x155eef!=='object'){return _0x250e31(msgResponse('originate',_0x4c1c('0x13b'),_0x4c1c('0x15f')));}if(_[_0x4c1c('0x87')](_0x178798['Contact'][_0x4c1c('0x160')])||_0x178798[_0x4c1c('0x161')][_0x4c1c('0x160')]===null){return _0x250e31(msgResponse('originate',_0x4c1c('0x13b'),_0x4c1c('0x162')));}var _0x4ed3e3={'XMD-CALLERID':_0x11adec[_0x4c1c('0x26')][_0x38db7e][_0x4c1c('0x163')](),'XMD-AGI':_0x155eef[_0x4c1c('0x105')]?util[_0x4c1c('0x92')](_0x4c1c('0x164'),ipAgi,_0x155eef['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x155eef['dialQueueProject2']?util[_0x4c1c('0x92')](_0x4c1c('0x164'),ipAgi,_0x155eef[_0x4c1c('0x107')]):_0x4c1c('0x165'),'XMD-QUEUE':_0x155eef[_0x4c1c('0x4e')]===_0x4c1c('0x4f')?util[_0x4c1c('0x92')](_0x4c1c('0x166'),_0x155eef[_0x4c1c('0x40')],_0x155eef[_0x4c1c('0x167')]||'',_0x155eef['dialAgiAfterHangupAgent']?'c':'',_0x155eef['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x178798[_0x4c1c('0xcf')],'XMD-CDRTYPE':_0x4c1c('0x9'),'CALLERID(all)':_0x11adec[_0x4c1c('0x26')][_0x38db7e]['getCaller'](),'XMD-AMD':_0x155eef[_0x4c1c('0xde')]?_0x4c1c('0x168'):_0x4c1c('0x165'),'XMD-DESTINATION':_0x4c1c('0xdd')};if(_0x155eef[_0x4c1c('0xde')]){_0x4ed3e3[_0x4c1c('0x169')]=_0x155eef[_0x4c1c('0x16a')]||0x9c4;_0x4ed3e3[_0x4c1c('0x16b')]=_0x155eef['dialAMDGreeting']||0x5dc;_0x4ed3e3[_0x4c1c('0x16c')]=_0x155eef[_0x4c1c('0x16d')]||0x320;_0x4ed3e3[_0x4c1c('0x16e')]=_0x155eef[_0x4c1c('0x16f')]||0x1388;_0x4ed3e3['XMD-AMDMINWORDLENGTH']=_0x155eef[_0x4c1c('0x170')]||0x64;_0x4ed3e3[_0x4c1c('0x171')]=_0x155eef[_0x4c1c('0x172')]||0x32;_0x4ed3e3[_0x4c1c('0x173')]=_0x155eef[_0x4c1c('0x174')]||0x3;_0x4ed3e3[_0x4c1c('0x175')]=_0x155eef[_0x4c1c('0x176')]||0x100;_0x4ed3e3['XMD-AMDMAXIMUMWORDLENGTH']=_0x155eef[_0x4c1c('0x177')]||0x1388;}if(_0x155eef[_0x4c1c('0x4e')]===_0x4c1c('0x4f')){_0x4ed3e3[_0x4c1c('0x178')]=_0x178798[_0x4c1c('0xd2')];}else{_0x4ed3e3['XMD-CAMPAIGNID']=_0x178798[_0x4c1c('0xfb')];}for(var _0x17983a in _0x178798['Contact']){if(typeof _0x178798[_0x4c1c('0x161')][_0x17983a]!==_0x4c1c('0xab')){if(isNotNull(_0x178798[_0x4c1c('0x161')][_0x17983a])&&_0x17983a!=='id'&&_0x17983a!=='tags'&&_0x17983a!==_0x4c1c('0x179')&&_0x17983a!==_0x4c1c('0x17a')){_0x4ed3e3[util['format']('%s%s',_0x4c1c('0x17b'),_['toUpper'](_0x17983a))]=_0x178798[_0x4c1c('0x161')][_0x17983a];}}}var _0xdc5a41=_0x11adec[_0x4c1c('0xd6')](_0x155eef[_0x4c1c('0x78')])?getCallerId(_0x155eef[_0x4c1c('0x78')][_0x4c1c('0x79')],_0x155eef[_0x4c1c('0x5c')],_0x155eef['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x155eef[_0x4c1c('0x5d')],_0x155eef['dialRandomLastDigitCallerIdNumber']):_0x155eef['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x155eef[_0x4c1c('0x135')])?_0x155eef[_0x4c1c('0x78')][_0x4c1c('0x79')]:_0x155eef['TrunkBackup'][_0x4c1c('0x79')],_0x155eef[_0x4c1c('0x5c')],_0x155eef['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x155eef[_0x4c1c('0x5d')],_0x155eef['dialRandomLastDigitCallerIdNumber']):_0x155eef[_0x4c1c('0x5d')]);if(_0xdc5a41){_0x4ed3e3[_0x4c1c('0x17c')]=_0x11adec[_0x4c1c('0x26')][_0x38db7e][_0x4c1c('0x17d')]=extractCalleridName(_0xdc5a41);_0x4ed3e3[_0x4c1c('0x17e')]=_0x11adec[_0x4c1c('0x26')][_0x38db7e][_0x4c1c('0x17f')]=extractCalleridNumber(_0xdc5a41);}return ami[_0x4c1c('0xad')]({'actionid':_0x38db7e,'action':_0x4c1c('0x180'),'channel':_0x11adec[_0x4c1c('0xd6')](_0x155eef['Trunk'])?util[_0x4c1c('0x92')](_0x4c1c('0x181'),_0x155eef['Trunk'][_0x4c1c('0x40')],isNotNull(_0x155eef[_0x4c1c('0x182')])?_0x155eef[_0x4c1c('0x182')]['trim']()||'':'',_0x155eef['dialCutDigit']>0x0?_0x178798[_0x4c1c('0x161')]['phone'][_0x4c1c('0x183')](_0x155eef[_0x4c1c('0x184')]):_0x178798['Contact'][_0x4c1c('0x160')]):util[_0x4c1c('0x92')]('SIP/%s/%s%s',_['isNil'](_0x155eef[_0x4c1c('0x135')])?_0x155eef[_0x4c1c('0x78')][_0x4c1c('0x40')]:_0x155eef[_0x4c1c('0x135')][_0x4c1c('0x40')],isNotNull(_0x155eef[_0x4c1c('0x182')])?_0x155eef['dialPrefix'][_0x4c1c('0x185')]()||'':'',_0x155eef[_0x4c1c('0x184')]>0x0?_0x178798[_0x4c1c('0x161')][_0x4c1c('0x160')][_0x4c1c('0x183')](_0x155eef['dialCutDigit']):_0x178798[_0x4c1c('0x161')]['phone']),'callerid':_0xdc5a41,'Exten':_0x4c1c('0xdd'),'Context':_0x4c1c('0x186'),'Priority':'1','variable':_0x4ed3e3,'timeout':(_0x155eef[_0x4c1c('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x38db7e})['then'](function(_0x5652a5){return _0x1eb217(_0x5652a5);})[_0x4c1c('0xb0')](function(_0x54d277){_0x155eef[_0x4c1c('0x187')]+=0x1;var _0x18a222=new History(_0x11adec[_0x4c1c('0x26')][_0x38db7e]);logger['error'](util[_0x4c1c('0x92')](_0x4c1c('0x188'),JSON[_0x4c1c('0x7a')](_0x54d277)));_0x18a222[_0x4c1c('0xa5')]=0xe;_0x18a222[_0x4c1c('0xe8')]='OriginateError';_0x18a222['starttime']=moment()[_0x4c1c('0x92')](_0x4c1c('0xfa'));_0x18a222[_0x4c1c('0x113')]=_0x18a222['starttime'];_0x11adec[_0x4c1c('0xc9')](_0x18a222)['catch'](loggerCatch(_0x4c1c('0x189')));_0x11adec[_0x4c1c('0xc7')](_0x18a222)['catch'](loggerCatch(_0x4c1c('0x189')))['finally'](function(){delete _0x11adec[_0x4c1c('0x26')][_0x38db7e];return _0x250e31(msgResponse(_0x4c1c('0x180'),_0x4c1c('0x49'),_0x4c1c('0x18a')));});});});};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x30')]=function(_0x1a9f42){var _0x2edee7=this[_0x4c1c('0x26')][_0x1a9f42[_0x4c1c('0x11c')]];if(_0x2edee7){delete this[_0x4c1c('0x26')][_0x1a9f42[_0x4c1c('0x11c')]];_0x2edee7[_0x4c1c('0x18b')]=moment()['format'](_0x4c1c('0xfa'));var _0x29381e=_0x2edee7[_0x4c1c('0x4e')]===_0x4c1c('0x90')?this[_0x4c1c('0x21')][_0x2edee7[_0x4c1c('0xb3')]]:this[_0x4c1c('0x20')][_0x2edee7[_0x4c1c('0x18c')]()];if(!this[_0x4c1c('0xd4')](_0x1a9f42['response'])){this[_0x4c1c('0xb2')](_0x29381e);return this[_0x4c1c('0x18d')](_0x2edee7,_0x29381e,_0x1a9f42)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x18e')));}this[_0x4c1c('0xa8')][_0x1a9f42['uniqueid']]=_0x2edee7;}};Dialer['prototype']['checkRetriveMax']=function(_0x4549b5,_0x1fbd85,_0x184976){var _0x36b19d=new History(_0x1fbd85);if(_0x36b19d[_0x4c1c('0xec')]+_0x36b19d[_0x4c1c('0x18f')]+_0x36b19d['countnoanswerretry']+_0x36b19d[_0x4c1c('0xee')]+_0x36b19d['countdropretry']+_0x36b19d[_0x4c1c('0xf0')]+_0x36b19d[_0x4c1c('0xf1')]+_0x36b19d['countagentrejectretry']>=_0x184976[_0x4c1c('0xf2')]-0x1){return!![];}switch(_0x4549b5){case 0x3:if(_0x36b19d[_0x4c1c('0xed')]>=_0x184976[_0x4c1c('0x190')]-0x1){return!![];}this[_0x4c1c('0xbf')]({'active':![],'countnoanswerretry':_0x36b19d['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x184976[_0x4c1c('0x191')],_0x4c1c('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36b19d[_0x4c1c('0xcf')],'ListId':_0x36b19d[_0x4c1c('0xd0')],'VoiceQueueId':_0x36b19d[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x36b19d[_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x192')));break;case 0x5:if(_0x36b19d[_0x4c1c('0xec')]>=_0x184976['dialBusyMaxRetry']-0x1){return!![];}this[_0x4c1c('0xbf')]({'active':![],'countbusyretry':_0x36b19d[_0x4c1c('0xec')]+=0x1,'scheduledat':moment()[_0x4c1c('0xf7')](_0x184976['dialBusyRetryFrequency'],'minutes')[_0x4c1c('0x92')](_0x4c1c('0xfa')),'ContactId':_0x36b19d[_0x4c1c('0xcf')],'ListId':_0x36b19d[_0x4c1c('0xd0')],'VoiceQueueId':_0x36b19d[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x36b19d[_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x193')));break;case 0x8:if(_0x36b19d[_0x4c1c('0x18f')]>=_0x184976[_0x4c1c('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x36b19d[_0x4c1c('0x18f')]+=0x1,'scheduledat':moment()[_0x4c1c('0xf7')](_0x184976['dialCongestionRetryFrequency'],_0x4c1c('0xf9'))[_0x4c1c('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36b19d[_0x4c1c('0xcf')],'ListId':_0x36b19d[_0x4c1c('0xd0')],'VoiceQueueId':_0x36b19d[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x36b19d[_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x195')));break;case 0x0:if(_0x36b19d[_0x4c1c('0xee')]>=_0x184976[_0x4c1c('0x196')]-0x1){return!![];}else{this[_0x4c1c('0xbf')]({'active':![],'countnosuchnumberretry':_0x36b19d[_0x4c1c('0xee')]+=0x1,'scheduledat':moment()[_0x4c1c('0xf7')](_0x184976[_0x4c1c('0x197')],_0x4c1c('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36b19d[_0x4c1c('0xcf')],'ListId':_0x36b19d[_0x4c1c('0xd0')],'VoiceQueueId':_0x36b19d[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x36b19d[_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x198')));}break;case 0xa:if(_0x36b19d['countdropretry']>=_0x184976[_0x4c1c('0x199')]-0x1){return!![];}this[_0x4c1c('0xbf')]({'active':![],'countdropretry':_0x36b19d[_0x4c1c('0xef')]+=0x1,'scheduledat':moment()[_0x4c1c('0xf7')](_0x184976[_0x4c1c('0x110')],_0x4c1c('0xf9'))[_0x4c1c('0x92')](_0x4c1c('0xfa')),'ContactId':_0x36b19d[_0x4c1c('0xcf')],'ListId':_0x36b19d[_0x4c1c('0xd0')],'VoiceQueueId':_0x36b19d[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x36b19d[_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x111')));break;case 0xb:if(_0x36b19d[_0x4c1c('0xf0')]>=_0x184976[_0x4c1c('0x19a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x36b19d[_0x4c1c('0xf0')]+=0x1,'scheduledat':moment()[_0x4c1c('0xf7')](_0x184976['dialAbandonedRetryFrequency'],_0x4c1c('0xf9'))[_0x4c1c('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36b19d[_0x4c1c('0xcf')],'ListId':_0x36b19d[_0x4c1c('0xd0')],'VoiceQueueId':_0x36b19d[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x36b19d[_0x4c1c('0xfb')]||undefined})['catch'](loggerCatch(_0x4c1c('0x19b')));break;case 0x13:if(_0x36b19d[_0x4c1c('0xf1')]>=_0x184976[_0x4c1c('0xff')]-0x1){return!![];}this[_0x4c1c('0xbf')]({'active':![],'countmachineretry':_0x36b19d['countmachineretry']+=0x1,'scheduledat':moment()[_0x4c1c('0xf7')](_0x184976[_0x4c1c('0xf8')],'minutes')[_0x4c1c('0x92')](_0x4c1c('0xfa')),'ContactId':_0x36b19d[_0x4c1c('0xcf')],'ListId':_0x36b19d[_0x4c1c('0xd0')],'VoiceQueueId':_0x36b19d['VoiceQueueId']||undefined,'CampaignId':_0x36b19d[_0x4c1c('0xfb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x36b19d['countagentrejectretry']>=_0x184976[_0x4c1c('0x19c')]-0x1){return!![];}this[_0x4c1c('0xbf')]({'active':![],'countagentrejectretry':_0x36b19d[_0x4c1c('0x19d')]+=0x1,'scheduledat':moment()[_0x4c1c('0xf7')](_0x184976['dialAgentRejectRetryFrequency'],_0x4c1c('0xf9'))[_0x4c1c('0x92')](_0x4c1c('0xfa')),'ContactId':_0x36b19d[_0x4c1c('0xcf')],'ListId':_0x36b19d['ListId'],'VoiceQueueId':_0x36b19d[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x36b19d[_0x4c1c('0xfb')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x3f0a8d,_0x2cf0fd,_0x1a1e7f){var _0xdea291=this;var _0x3cbf61=new History(_0x3f0a8d);return new BPromise(function(_0xdfa161,_0xe8bfd1){if(_[_0x4c1c('0x87')](_0x2cf0fd)&&typeof _0x2cf0fd!==_0x4c1c('0x19e')){return _0xe8bfd1(msgResponse('[callProgressDetecting]',_0x4c1c('0x13b'),_0x4c1c('0x19f')));}if(_[_0x4c1c('0x87')](_0x1a1e7f)&&typeof _0x1a1e7f!==_0x4c1c('0x19e')){return _0xe8bfd1(msgResponse(_0x4c1c('0x1a0'),_0x4c1c('0x13b'),_0x4c1c('0x1a1')));}switch(_0x1a1e7f['reason']){case'0':_0x2cf0fd[_0x4c1c('0x1a2')]+=0x1;_0x3cbf61[_0x4c1c('0xa5')]=0x0;_0x3cbf61['statedesc']=_0x4c1c('0x1a3');_0x3cbf61[_0x4c1c('0xee')]+=0x1;_0x3cbf61['countglobal']+=0x1;ami[_0x4c1c('0x4d')]('custom:agentnosuchnumber',ut['buildObj'](_0x3f0a8d,_0x4c1c('0x1a4')));_0xdea291[_0x4c1c('0xc9')](_0x3cbf61)[_0x4c1c('0xb0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xdea291['checkRetriveMax'](0x0,_0x3f0a8d,_0x2cf0fd)){if(_0x3cbf61[_0x4c1c('0xee')]>=_0x2cf0fd[_0x4c1c('0x196')]){_0xdea291['createStateFinal'](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1a5'));}else{_0xdea291['stateGlobal'](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1a5'));}}break;case'3':_0x2cf0fd[_0x4c1c('0x66')]+=0x1;_0x3cbf61[_0x4c1c('0xa5')]=0x3;_0x3cbf61[_0x4c1c('0xe8')]=_0x4c1c('0x1a6');_0x3cbf61[_0x4c1c('0xed')]+=0x1;_0x3cbf61[_0x4c1c('0xea')]+=0x1;ami[_0x4c1c('0x4d')](_0x4c1c('0x1a7'),ut[_0x4c1c('0xe4')](_0x3f0a8d,_0x4c1c('0x1a8')));_0xdea291[_0x4c1c('0xc9')](_0x3cbf61)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x1a9')));if(_0xdea291[_0x4c1c('0x1aa')](0x3,_0x3f0a8d,_0x2cf0fd)){if(_0x3cbf61[_0x4c1c('0xed')]>=_0x2cf0fd[_0x4c1c('0x190')]){_0xdea291['createStateFinal'](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1ab'));}else{_0xdea291[_0x4c1c('0xf3')](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1ab'));}}break;case'5':_0x2cf0fd[_0x4c1c('0x62')]+=0x1;_0x3cbf61[_0x4c1c('0xa5')]=0x5;_0x3cbf61[_0x4c1c('0xe8')]=_0x4c1c('0x1ac');_0x3cbf61['countbusyretry']+=0x1;_0x3cbf61[_0x4c1c('0xea')]+=0x1;ami[_0x4c1c('0x4d')](_0x4c1c('0x1ad'),ut[_0x4c1c('0xe4')](_0x3f0a8d,_0x4c1c('0x1ae')));_0xdea291['createHistory'](_0x3cbf61)['catch'](loggerCatch(_0x4c1c('0x1af')));if(_0xdea291[_0x4c1c('0x1aa')](0x5,_0x3f0a8d,_0x2cf0fd)){if(_0x3cbf61['countbusyretry']>=_0x2cf0fd[_0x4c1c('0x1b0')]){_0xdea291[_0x4c1c('0xf5')](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1b1'));}else{_0xdea291['stateGlobal'](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1b1'));}}break;case'8':_0x2cf0fd[_0x4c1c('0x1b2')]+=0x1;_0x3cbf61[_0x4c1c('0xa5')]=0x8;_0x3cbf61[_0x4c1c('0xe8')]=_0x4c1c('0x1b3');_0x3cbf61[_0x4c1c('0x18f')]+=0x1;_0x3cbf61[_0x4c1c('0xea')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0x4c1c('0xe4')](_0x3f0a8d,_0x4c1c('0x1b4')));_0xdea291[_0x4c1c('0xc9')](_0x3cbf61)['catch'](loggerCatch(_0x4c1c('0x1b5')));if(_0xdea291['checkRetriveMax'](0x8,_0x3f0a8d,_0x2cf0fd)){if(_0x3cbf61['countcongestionretry']>=_0x2cf0fd[_0x4c1c('0x194')]){_0xdea291['createStateFinal'](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1b6'));}else{_0xdea291[_0x4c1c('0xf3')](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1b6'));}}break;case'11':_0x2cf0fd['outboundAbandonedCallsDay']+=0x1;_0x3cbf61[_0x4c1c('0xa5')]=0xb;_0x3cbf61['statedesc']='Abandoned';_0x3cbf61[_0x4c1c('0xf0')]+=0x1;_0x3cbf61[_0x4c1c('0xea')]+=0x1;_0xdea291[_0x4c1c('0xc9')](_0x3cbf61)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x11a')));if(_0xdea291[_0x4c1c('0x1aa')](0xb,_0x3f0a8d,_0x2cf0fd)){if(_0x3cbf61[_0x4c1c('0xf0')]>=_0x2cf0fd['dialAbandonedMaxRetry']){_0xdea291[_0x4c1c('0xf5')](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1b7'));}else{_0xdea291[_0x4c1c('0xf3')](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1b7'));}}break;case'20':_0x2cf0fd[_0x4c1c('0x1b8')]+=0x1;_0x3cbf61[_0x4c1c('0xa5')]=0x14;_0x3cbf61[_0x4c1c('0xe8')]='AgentReject';_0x3cbf61['countagentrejectretry']+=0x1;_0x3cbf61[_0x4c1c('0xea')]+=0x1;ami['emit']('custom:agentreject',ut['buildObj'](_0x3f0a8d,_0x4c1c('0x1b9')));_0xdea291[_0x4c1c('0xc9')](_0x3cbf61)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x1ba')));if(_0xdea291['checkRetriveMax'](0x14,_0x3f0a8d,_0x2cf0fd)){if(_0x3cbf61[_0x4c1c('0x19d')]>=_0x2cf0fd[_0x4c1c('0x19c')]){_0xdea291[_0x4c1c('0xf5')](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x4c1c('0x1bb'));}else{_0xdea291[_0x4c1c('0xf3')](_0x3cbf61,_0xdfa161,_0xe8bfd1,'reason\x2020\x20agentreject');}}break;default:_0x2cf0fd['outboundUnknownCallsDay']+=0x1;_0x3cbf61[_0x4c1c('0xa5')]=0xc;_0x3cbf61[_0x4c1c('0xe8')]=_0x1a1e7f['reason'];_0xdea291['createHistory'](_0x3cbf61)[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x1bc')));if(_0xdea291['checkRetriveMax'](_0x1a1e7f[_0x4c1c('0x1bd')],_0x3f0a8d,_0x2cf0fd)){if(_0x3cbf61[_0x4c1c('0xec')]+_0x3cbf61[_0x4c1c('0x18f')]+_0x3cbf61[_0x4c1c('0xed')]+_0x3cbf61[_0x4c1c('0xee')]+_0x3cbf61[_0x4c1c('0xef')]+_0x3cbf61['countabandonedretry']+_0x3cbf61[_0x4c1c('0xf1')]+_0x3cbf61['countagentrejectretry']>=_0x2cf0fd[_0x4c1c('0xf2')]){_0xdea291[_0x4c1c('0xf3')](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x1a1e7f[_0x4c1c('0x1bd')]);}else{_0xdea291[_0x4c1c('0xf5')](_0x3cbf61,_0xdfa161,_0xe8bfd1,_0x1a1e7f[_0x4c1c('0x1bd')]);}}}});};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xf3')]=function(_0x2c6838,_0x52e33c,_0x2ff99b,_0x263eeb){var _0x765c=new Final(_0x2c6838);_0x765c[_0x4c1c('0xa5')]=0xf;_0x765c[_0x4c1c('0xe8')]=_0x4c1c('0x1be');this['createStateFinal'](_0x765c,_0x52e33c,_0x2ff99b,_0x263eeb);};Dialer[_0x4c1c('0x1b')][_0x4c1c('0xf5')]=function(_0x318f54,_0x3a6176,_0x260ecd,_0x2e1671){this[_0x4c1c('0xc7')](_0x318f54)[_0x4c1c('0xb8')](function(){return _0x3a6176(msgResponse(_0x4c1c('0x1a0'),_0x4c1c('0xd5'),_0x2e1671));})['catch'](function(){return _0x260ecd(msgResponse(_0x4c1c('0x1bf'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x151')]=function(_0x5155ea){var _0x426038=_0x5155ea[_0x4c1c('0x1c0')]/0x64;var _0x504493=_0x5155ea[_0x4c1c('0x65')]/(_0x5155ea['outboundDropCallsDayTimeout']+_0x5155ea[_0x4c1c('0x60')]);var _0x2eb56c=Math[_0x4c1c('0x1c1')](_0x5155ea[_0x4c1c('0x71')]*(_0x5155ea['predictiveIntervalMaxThreshold']/0x64));var _0x1c4ac9=Math[_0x4c1c('0x1c1')](_0x5155ea[_0x4c1c('0x71')]*(_0x5155ea[_0x4c1c('0x1c2')]/0x64));var _0x3aa6c1=_0x5155ea[_0x4c1c('0x9f')]+_0x5155ea[_0x4c1c('0x55')];var _0x1c884e=Math[_0x4c1c('0x1c3')](_0x5155ea[_0x4c1c('0x89')]*_0x5155ea[_0x4c1c('0x75')]*_0x5155ea[_0x4c1c('0x6e')]*_0x5155ea[_0x4c1c('0x6f')]);if(_[_0x4c1c('0x87')](_0x5155ea[_0x4c1c('0x77')])){if(!_[_0x4c1c('0x87')](_0x5155ea['startPredictive'])){_0x5155ea[_0x4c1c('0x28')]=undefined;loggerPredictive[_0x4c1c('0x95')]('[startMethodPredictive][StartProgressive]',_0x4c1c('0x1c4'));}if(!_[_0x4c1c('0x87')](_0x5155ea['handlePredictive'])){loggerPredictive[_0x4c1c('0x95')](_0x4c1c('0x1c5'),_0x4c1c('0x1c6'));clearInterval(_0x5155ea['handlePredictive']);_0x5155ea['handlePredictive']=undefined;}_0x5155ea['startProgressive']=moment()[_0x4c1c('0x92')](_0x4c1c('0xfa'));loggerPredictive['info'](_0x5155ea['name'],_0x4c1c('0x1c7'),_0x5155ea[_0x4c1c('0x77')]);this[_0x4c1c('0x150')](_0x5155ea,0x1);}else if(ifInterval(_0x5155ea[_0x4c1c('0x1c8')],_0x5155ea[_0x4c1c('0x77')])){this[_0x4c1c('0x150')](_0x5155ea,0x1);loggerPredictiveCalls[_0x4c1c('0x7f')](_0x4c1c('0x1c9'),_0x5155ea[_0x4c1c('0x77')],_0x5155ea[_0x4c1c('0x40')]);_0x5155ea[_0x4c1c('0x89')]=0x0;_0x5155ea[_0x4c1c('0x10e')]=0x0;}else if(_0x426038<_0x504493&&_0x5155ea[_0x4c1c('0x1ca')]===_0x4c1c('0x1cb')){freeVariablesPredictive(_0x5155ea);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x1cc'),_0x4c1c('0x1cd'),_0x504493,_0x4c1c('0x77'),_0x5155ea['name']);}else if(_0x1c884e<_0x5155ea['predictiveIntervalErlangCallsDroppedCalls']&&_0x5155ea[_0x4c1c('0x1ca')]===_0x4c1c('0x1cb')){freeVariablesPredictive(_0x5155ea);loggerPredictive['info'](_0x4c1c('0x1ce'),_0x4c1c('0x1cf'),_0x1c884e,'Drop\x20in\x20this\x20interval',_0x5155ea[_0x4c1c('0x10e')],'startProgressive',_0x5155ea[_0x4c1c('0x40')]);}else if(!ifInterval(_0x5155ea['dialPredictiveInterval'],_0x5155ea['startProgressive'])&&_['isUndefined'](_0x5155ea[_0x4c1c('0x28')])&&!_[_0x4c1c('0x87')](_0x5155ea['startProgressive'])){_0x5155ea[_0x4c1c('0x28')]=moment()[_0x4c1c('0x92')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4c1c('0x7f')](_0x5155ea['name'],_0x4c1c('0x1d0'),_0x5155ea['startPredictive']);this[_0x4c1c('0xbc')](_0x5155ea[_0x4c1c('0x1c8')])[_0x4c1c('0xb8')](this['getDataPredictive'](_0x5155ea))['then'](mergeDataErlangB(_0x5155ea))[_0x4c1c('0xb8')](this[_0x4c1c('0x1d1')](_0x5155ea))[_0x4c1c('0xb0')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5155ea));}else if(!ifInterval(_0x5155ea['dialPredictiveInterval'],_0x5155ea[_0x4c1c('0x28')])){_0x5155ea[_0x4c1c('0x10e')]=0x0;_0x5155ea['startPredictive']=moment()['format'](_0x4c1c('0xfa'));loggerPredictive['info'](_0x5155ea[_0x4c1c('0x40')],_0x4c1c('0x1d2'),_0x5155ea[_0x4c1c('0x28')]);clearInterval(_0x5155ea[_0x4c1c('0x8e')]);_0x5155ea[_0x4c1c('0x8e')]=undefined;this[_0x4c1c('0xbc')](_0x5155ea[_0x4c1c('0x1c8')])[_0x4c1c('0xb8')](this[_0x4c1c('0x1d3')](_0x5155ea))[_0x4c1c('0xb8')](mergeDataErlangB(_0x5155ea))[_0x4c1c('0xb8')](this['startMethodPredictive'](_0x5155ea))[_0x4c1c('0xb0')](loggerCatchPredictive(_0x4c1c('0x1d4'),_0x5155ea));}else if(_0x5155ea[_0x4c1c('0x71')]&&_0x3aa6c1<_0x5155ea['predictiveIntervalAvailable']-_0x1c4ac9){freeVariablesPredictive(_0x5155ea);loggerPredictive['info'](_0x5155ea[_0x4c1c('0x40')],_0x4c1c('0x1d5'),_0x3aa6c1,_0x4c1c('0x1d6'),_0x5155ea['predictiveIntervalAvailable'],'-',_0x1c4ac9,'=',_0x5155ea[_0x4c1c('0x71')]-_0x1c4ac9,')');}else if(_0x5155ea[_0x4c1c('0x71')]&&_0x3aa6c1>_0x5155ea[_0x4c1c('0x71')]+_0x2eb56c){freeVariablesPredictive(_0x5155ea);loggerPredictive[_0x4c1c('0x7f')](_0x5155ea['name'],_0x4c1c('0x1d5'),_0x3aa6c1,_0x4c1c('0x1d7'),_0x5155ea[_0x4c1c('0x71')],'+',_0x2eb56c,'=',_0x5155ea[_0x4c1c('0x71')]+_0x2eb56c,')');}};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x1d3')]=function(_0x3af2d9){var _0x20b17d=this;return function(_0x271374){return new BPromise(function(_0x5651a3,_0x229f32){_[_0x4c1c('0x8c')](_0x3af2d9,_0x271374[0x0]);if(checkGetDataPredictive(_0x271374[0x0])){var _0xaab5c0=_0x3af2d9[_0x4c1c('0x71')]=_0x3af2d9[_0x4c1c('0x55')]+_0x3af2d9[_0x4c1c('0x9f')];var _0x42cbd1=_0x3af2d9[_0x4c1c('0x1c8')]*0x3c;var _0x31dc68=_0x271374[0x0]['predictiveIntervalAvgTalktime']+_0x271374[0x0][_0x4c1c('0x6a')];var _0x47800f=(_0x271374[0x0][_0x4c1c('0x69')]+_0x271374[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x271374[0x0][_0x4c1c('0x6b')])/_0x271374[0x0][_0x4c1c('0x72')];_0x3af2d9[_0x4c1c('0x6e')]=_0x47800f>0x0?_0x47800f:0x1;switch(_0x3af2d9[_0x4c1c('0x1ca')]){case _0x4c1c('0x1cb'):var _0x48fda7=_0x3af2d9[_0x4c1c('0x1c0')]/0x64;return _0x20b17d[_0x4c1c('0x1d8')](_0xaab5c0,_0x42cbd1,_0x31dc68,_0x47800f,_0x48fda7)[_0x4c1c('0xb8')](function(_0x49db50){return _0x5651a3(_0x49db50);});case _0x4c1c('0x1d9'):var _0x293b04=_0x3af2d9[_0x4c1c('0x1c0')]/0x64;return _0x20b17d[_0x4c1c('0x1da')](_0xaab5c0,_0x42cbd1,_0x31dc68,_0x47800f,_0x293b04)[_0x4c1c('0xb8')](function(_0x53d550){return _0x5651a3(_0x53d550);});default:return _0x229f32(msgResponse('[getDataPredictive]','Failure',_0x4c1c('0x1db')));}}else{return _0x229f32(msgResponse('[getDataPredictive]',_0x4c1c('0x13b'),_0x4c1c('0x1dc')));}});};};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x1dd')]=function(_0x1994e0){var _0x204502=this;return function(_0x51c4b){return new BPromise(function(_0x3963ec,_0x55ae8e){_['merge'](_0x1994e0,_0x51c4b[0x0]);if(checkGetDataPredictive(_0x51c4b[0x0])){loggerPredictive[_0x4c1c('0x7f')](JSON[_0x4c1c('0x7a')](_0x51c4b[0x0]));if(_0x1994e0[_0x4c1c('0x1ca')]===_0x4c1c('0x1cb')){return _0x204502['getVoiceQueueRtPauses'](_0x1994e0['id'])[_0x4c1c('0xb8')](function(_0x2ffd82){var _0xbbc828=_0x1994e0[_0x4c1c('0x51')]-_0x2ffd82[0x0][_0x4c1c('0x1de')];var _0x5b1fb0=_0x1994e0['dialPredictiveInterval']*0x3c;var _0x44fe74=_0x51c4b[0x0][_0x4c1c('0x85')]+_0x51c4b[0x0][_0x4c1c('0x6a')];var _0x4fab27=(_0x51c4b[0x0][_0x4c1c('0x69')]+_0x51c4b[0x0][_0x4c1c('0x6c')]+_0x51c4b[0x0][_0x4c1c('0x6b')])/_0x51c4b[0x0][_0x4c1c('0x72')];var _0x592a16=_0x1994e0['dialPredictiveOptimizationPercentage']/0x64;_0x1994e0[_0x4c1c('0x70')]=_0x2ffd82[0x0][_0x4c1c('0x1de')]||0x0;_0x1994e0[_0x4c1c('0x6e')]=_0x4fab27>0x0?_0x4fab27:0x1;return _0x204502[_0x4c1c('0x1d8')](_0xbbc828,_0x5b1fb0,_0x44fe74,_0x4fab27,_0x592a16);})[_0x4c1c('0xb8')](function(_0x58552a){return _0x3963ec(_0x58552a);})['catch'](function(_0x246402){return _0x55ae8e(msgResponse(_0x4c1c('0x1df'),'Failure',JSON['stringify'](_0x246402)));});}if(_0x1994e0[_0x4c1c('0x1ca')]==='agentBusyFactor'){return _0x204502[_0x4c1c('0xc6')](_0x1994e0['id'])['then'](function(_0x29591b){var _0x5e7bff=_0x1994e0[_0x4c1c('0x51')]-_0x29591b[0x0]['outboundQueuePauses'];var _0x5d340b=_0x1994e0[_0x4c1c('0x1c8')]*0x3c;var _0x1daad5=_0x51c4b[0x0][_0x4c1c('0x85')]+_0x51c4b[0x0]['predictiveIntervalAvgHoldtime'];var _0x413654=(_0x51c4b[0x0]['predictiveIntervalAnsweredCalls']+_0x51c4b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x51c4b[0x0][_0x4c1c('0x6b')])/_0x51c4b[0x0]['predictiveIntervalTotalCalls'];var _0x28e1e4=_0x1994e0[_0x4c1c('0x1c0')]/0x64;_0x1994e0[_0x4c1c('0x70')]=_0x29591b[0x0][_0x4c1c('0x1de')]||0x0;_0x1994e0[_0x4c1c('0x6e')]=_0x413654>0x0?_0x413654:0x1;return _0x204502[_0x4c1c('0x1da')](_0x5e7bff,_0x5d340b,_0x1daad5,_0x413654,_0x28e1e4);})[_0x4c1c('0xb8')](function(_0x498cb4){return _0x3963ec(_0x498cb4);})[_0x4c1c('0xb0')](function(_0x29f0d1){return _0x55ae8e(msgResponse(_0x4c1c('0x1df'),_0x4c1c('0x13b'),JSON[_0x4c1c('0x7a')](_0x29f0d1)));});}}else{return _0x55ae8e(msgResponse('[getDataPredictive]',_0x4c1c('0x13b'),_0x4c1c('0x1dc')));}});};};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x1d1')]=function(_0x30bc57){var _0x14d00f=this;return function(){var _0x49d735=0x0;var _0x313398=Math['floor'](_0x30bc57[_0x4c1c('0x74')]*0x3e8);if(_0x313398>0x0){_0x313398=_0x313398<0x64?0x64:_0x313398;loggerPredictive[_0x4c1c('0x7f')](_0x30bc57[_0x4c1c('0x40')],_0x4c1c('0x1e0'),_0x313398,'milliseconds');_0x30bc57[_0x4c1c('0x8e')]=setInterval(function(){_0x14d00f[_0x4c1c('0x8e')](_0x30bc57);loggerPredictiveCalls[_0x4c1c('0x7f')](_0x4c1c('0x1e1'),_0x49d735+=0x1);},_0x313398);}else{loggerPredictive['info'](_0x30bc57[_0x4c1c('0x40')],_0x4c1c('0x1e2'));}};};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x1e3')]=function(_0x4cfcbc,_0x14af6a){var _0xa706a7=this;return function(_0x181b8c){if(_[_0x4c1c('0x47')](_0x181b8c)){if(_[_0x4c1c('0xac')](_0x14af6a[_0x4c1c('0xd1')])||!_0x14af6a['recallme']){if(_0x4cfcbc[_0x4c1c('0x5b')]===_0x4c1c('0x1e4')){_0x4cfcbc[_0x4c1c('0x124')]=_[_0x4c1c('0x87')](_0x4cfcbc[_0x4c1c('0x124')])?!![]:_0x4cfcbc['queueStatusComplete'];var _0x3e0c42=uuid['v4']();_0xa706a7[_0x4c1c('0x26')][_0x3e0c42]=new Action(_0x4cfcbc,_0x14af6a,_0x3e0c42);loggerBooked[_0x4c1c('0x7f')](_0x4c1c('0x1e5'),_0x3e0c42,_0x4c1c('0x1e6'),JSON[_0x4c1c('0x7a')](_0x4cfcbc[_0x4c1c('0x124')]),_0x4c1c('0x1e7'),_0x4cfcbc[_0x4c1c('0x40')]);if(_0x4cfcbc[_0x4c1c('0x124')]){_0x4cfcbc[_0x4c1c('0x124')]=![];_0xa706a7['queueBooked'][_0xa706a7[_0x4c1c('0x26')][_0x3e0c42]['queue']]=[];ami[_0x4c1c('0xad')]({'actionid':_0x3e0c42,'action':_0x4c1c('0x1e8'),'queue':_0x4cfcbc[_0x4c1c('0x40')]})[_0x4c1c('0xb0')](function(){_0xa706a7['updateOriginated'](_0x4cfcbc);_0xa706a7['rescheduleContact']({'active':![],'ContactId':_0xa706a7[_0x4c1c('0x26')][_0x3e0c42]['ContactId'],'ListId':_0xa706a7[_0x4c1c('0x26')][_0x3e0c42][_0x4c1c('0xd0')],'VoiceQueueId':_0xa706a7[_0x4c1c('0x26')][_0x3e0c42][_0x4c1c('0xd2')]||undefined,'CampaignId':_0xa706a7['actions'][_0x3e0c42][_0x4c1c('0xfb')]||undefined})[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0x1e9')));delete _0xa706a7[_0x4c1c('0x26')][_0x3e0c42];});}else{loggerBooked[_0x4c1c('0x7f')]('[booked][checkContactBlack][else]',JSON[_0x4c1c('0x7a')](_0x4cfcbc[_0x4c1c('0x124')]),_0x4c1c('0x1e7'),_0x4cfcbc[_0x4c1c('0x40')]);_0xa706a7[_0x4c1c('0xb2')](_0x4cfcbc);_0xa706a7[_0x4c1c('0xbf')]({'active':![],'ContactId':_0xa706a7[_0x4c1c('0x26')][_0x3e0c42]['ContactId'],'ListId':_0xa706a7['actions'][_0x3e0c42][_0x4c1c('0xd0')],'VoiceQueueId':_0xa706a7[_0x4c1c('0x26')][_0x3e0c42][_0x4c1c('0xd2')]||undefined,'CampaignId':_0xa706a7[_0x4c1c('0x26')][_0x3e0c42]['CampaignId']||undefined})[_0x4c1c('0xb0')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xa706a7[_0x4c1c('0x26')][_0x3e0c42];}}else{return _0xa706a7[_0x4c1c('0x15e')](_0x4cfcbc,_0x14af6a);}}else{if(getDiff(_0x14af6a[_0x4c1c('0x1ea')])<_0x4cfcbc[_0x4c1c('0x1eb')]*0x3c){if(_0x14af6a[_0x4c1c('0x1ec')]&&!_0x14af6a[_0x4c1c('0x1ec')][_0x4c1c('0x1ed')]){_0xa706a7[_0x4c1c('0x1f')][_0x4c1c('0x125')](_0x14af6a['id'])[_0x4c1c('0x1d')](function(){_0xa706a7[_0x4c1c('0xb2')](_0x4cfcbc);});}else{_0xa706a7['unlockContact']({'active':![]},_0x14af6a['id'],0x1)[_0x4c1c('0x1d')](function(){_0xa706a7[_0x4c1c('0xb2')](_0x4cfcbc);});}}else{_0x4cfcbc['outboundReCallsDay']+=0x1;_0xa706a7[_0x4c1c('0xb2')](_0x4cfcbc);if(_0x4cfcbc[_0x4c1c('0x1ee')]){_0xa706a7[_0x4c1c('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x14af6a[_0x4c1c('0xcf')],'ListId':_0x14af6a[_0x4c1c('0xd0')],'VoiceQueueId':_0x14af6a[_0x4c1c('0xd2')]||undefined,'CampaignId':_0x14af6a['CampaignId']||undefined})[_0x4c1c('0xb0')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0xa706a7[_0x4c1c('0xc9')](createObjHistory(_0x4cfcbc,_0x14af6a,_0x4c1c('0x1ef'),0x17,_0x4c1c('0x1f0')))[_0x4c1c('0xb0')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xa706a7['saveInDb'](createObjHistory(_0x4cfcbc,_0x14af6a,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0x4c1c('0x1f1'),'[Originate][HistoryRecallClose]');}}}}else{_0x4cfcbc['outboundBlacklistCallsDay']+=0x1;_0xa706a7[_0x4c1c('0xcd')](createObjHistory(_0x4cfcbc,_0x14af6a,'BLACKLIST',0xd,_0x4c1c('0x1f2')),_0x4c1c('0x1f3'),'[Originate][MoveBlacklist]');throw _0x4c1c('0x1f4');}};};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x154')]=function(_0x2b0f1f){var _0x2f3e3b=this;var _0x4c25dc=_0x2b0f1f[_0x4c1c('0x1f5')]-_0x2b0f1f[_0x4c1c('0x73')]-_0x2b0f1f[_0x4c1c('0xc3')];emitCampaignSummary(_0x2b0f1f);if(_0x4c25dc>0x0){if(_0x4c25dc>this[_0x4c1c('0x24')]){_0x4c25dc=this['maxNumberOriginate'];}_0x2b0f1f['temp']+=_0x4c25dc;this['getContactDialerIvr'](_0x2b0f1f['id'],_0x4c25dc,_0x2b0f1f[_0x4c1c('0x1f6')],_0x2b0f1f)[_0x4c1c('0xb8')](function(_0x47d4e6){_0x2b0f1f['temp']-=_0x4c25dc;_0x2b0f1f[_0x4c1c('0xc3')]=_0x2b0f1f[_0x4c1c('0xc3')]>0x0?_0x2b0f1f[_0x4c1c('0xc3')]:0x0;if(!checkContactEmpty(_0x47d4e6)){_0x2b0f1f[_0x4c1c('0x43')]=_0x4c1c('0x9d');logger[_0x4c1c('0x7f')]('[getContactCampaign2][Empty]'+_0x2b0f1f[_0x4c1c('0x40')]);}else{_0x2b0f1f['originated']+=_0x47d4e6[_0x4c1c('0x12b')];_0x2b0f1f[_0x4c1c('0x43')]=_0x4c1c('0x1f7');for(var _0x3b4303=0x0;_0x3b4303<_0x47d4e6[_0x4c1c('0x12b')];_0x3b4303+=0x1){_0x2b0f1f[_0x4c1c('0x1f8')]+=0x1;if(_[_0x4c1c('0xac')](_0x47d4e6[_0x3b4303])||_[_0x4c1c('0xac')](_0x47d4e6[_0x3b4303]['Contact'])||_[_0x4c1c('0xac')](_0x47d4e6[_0x3b4303]['Contact']['phone'])){_0x2f3e3b[_0x4c1c('0x1f9')](_0x4c1c('0x1fa'),_0x2b0f1f,_0x47d4e6[_0x3b4303]);}else{_0x2f3e3b[_0x4c1c('0xbb')](_[_0x4c1c('0xce')](_0x47d4e6[_0x3b4303],[_0x4c1c('0xfb'),_0x4c1c('0x1fb')]))[_0x4c1c('0xb8')](_0x2f3e3b['checkContactBlack'](_0x2b0f1f,_0x47d4e6[_0x3b4303]))['catch'](_0x2f3e3b['loggerHandler'](_0x4c1c('0x1fc'),_0x2b0f1f));}}}})[_0x4c1c('0xb0')](loggerGetContactDialer(_0x4c1c('0x1fd'),_0x2b0f1f,_0x4c25dc));}};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x150')]=function(_0x31cc04,_0x46c383){var _0x472500=this;var _0x19549f=[];var _0x5e9534=_0x46c383>=0x1?_0x46c383:0x1;if(_0x31cc04[_0x4c1c('0x5b')]===_0x4c1c('0x1e4')){_0x5e9534=0x1;}var _0x23750e=Math[_0x4c1c('0x1c3')](_0x31cc04[_0x4c1c('0x9f')]*_0x5e9534)-_0x31cc04[_0x4c1c('0x73')]-_0x31cc04['temp'];emitVoiceQueueSummary(_0x31cc04);if(_0x31cc04[_0x4c1c('0x1fe')]>0x0){var _0x44b106=_0x31cc04['dialLimitQueue']-_0x31cc04[_0x4c1c('0x73')]-_0x31cc04[_0x4c1c('0x55')]-_0x31cc04[_0x4c1c('0xc3')]-_0x31cc04['pTalking'];if(_0x23750e>_0x44b106){_0x23750e=_0x44b106;}}if(_0x23750e>0x0){if(_0x31cc04['dialMethod']==='booked'){_0x23750e=0x1;}if(_0x23750e>this[_0x4c1c('0x24')]){_0x23750e=this['maxNumberOriginate'];}_0x31cc04[_0x4c1c('0xc3')]+=_0x23750e;for(var _0x1b1e91 in this[_0x4c1c('0x22')]){if(typeof this[_0x4c1c('0x22')][_0x1b1e91]!==_0x4c1c('0xab')){if(this[_0x4c1c('0x22')][_0x1b1e91][_0x4c1c('0xa5')]===_0x4c1c('0x1ff')&&this['agents'][_0x1b1e91][_0x4c1c('0xae')]===_0x4c1c('0x200')){_0x19549f[_0x4c1c('0x121')](this[_0x4c1c('0x22')][_0x1b1e91]['id']);}}}this['getContactDialer'](_0x31cc04['id'],_0x19549f,_0x23750e,_0x31cc04['dialOrderByScheduledAt'],_0x31cc04)['then'](function(_0xfbd2a0){_0x31cc04[_0x4c1c('0xc3')]-=_0x23750e;_0x31cc04['temp']=_0x31cc04[_0x4c1c('0xc3')]>0x0?_0x31cc04[_0x4c1c('0xc3')]:0x0;if(!checkContactEmpty(_0xfbd2a0)){_0x472500[_0x4c1c('0xb6')](_0x31cc04)[_0x4c1c('0xb8')](sendMessageReschedule(_0x31cc04))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x31cc04[_0x4c1c('0x73')]+=_0xfbd2a0[_0x4c1c('0x12b')];_0x31cc04['message']=_0x31cc04[_0x4c1c('0x5b')]===_0x4c1c('0x1e4')?'ACTIVE':'RUNNING';for(var _0x253b11=0x0;_0x253b11<_0xfbd2a0[_0x4c1c('0x12b')];_0x253b11+=0x1){if(_[_0x4c1c('0xac')](_0xfbd2a0[_0x253b11])||_[_0x4c1c('0xac')](_0xfbd2a0[_0x253b11]['Contact'])||_[_0x4c1c('0xac')](_0xfbd2a0[_0x253b11][_0x4c1c('0x161')][_0x4c1c('0x160')])){_0x472500[_0x4c1c('0x1f9')]('[actionOriginate]\x20',_0x31cc04,_0xfbd2a0[_0x253b11]);}else{_0x472500[_0x4c1c('0xba')](_[_0x4c1c('0xce')](_0xfbd2a0[_0x253b11],['VoiceQueueId','Contact.phone']))[_0x4c1c('0xb8')](_0x472500[_0x4c1c('0x1e3')](_0x31cc04,_0xfbd2a0[_0x253b11]))['catch'](_0x472500[_0x4c1c('0xcb')]('[actionOriginate]\x20',_0x31cc04));}}}})['catch'](loggerGetContactDialer(_0x4c1c('0x201'),_0x31cc04,_0x23750e));}};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x8e')]=function(_0x21704b){if(_0x21704b['dialLimitQueue']>0x0){var _0x3528cd=_0x21704b['dialLimitQueue']-_0x21704b[_0x4c1c('0x73')]-_0x21704b[_0x4c1c('0x55')];if(_0x3528cd>0x0){this[_0x4c1c('0x202')](_0x21704b);}else{loggerPredictiveCalls[_0x4c1c('0x7f')](_0x4c1c('0x203'));}}else{this[_0x4c1c('0x202')](_0x21704b);}};Dialer['prototype'][_0x4c1c('0x202')]=function(_0x11d576){var _0x20f468=this;var _0x1e057b=[];_0x11d576[_0x4c1c('0x73')]+=0x1;for(var _0x107fb5 in this['agents']){if(typeof this[_0x4c1c('0x22')][_0x107fb5]!==_0x4c1c('0xab')){if(this[_0x4c1c('0x22')][_0x107fb5][_0x4c1c('0xa5')]===_0x4c1c('0x1ff')&&this[_0x4c1c('0x22')][_0x107fb5][_0x4c1c('0xae')]==='reachable'){_0x1e057b[_0x4c1c('0x121')](this[_0x4c1c('0x22')][_0x107fb5]['id']);}}}this[_0x4c1c('0xc2')](_0x11d576['id'],_0x1e057b,0x1,_0x11d576[_0x4c1c('0x1f6')],_0x11d576)[_0x4c1c('0xb8')](function(_0x815648){if(!checkContactEmpty(_0x815648)){checkContactLowerLimitOriginate(_0x11d576,0x1,0x0);_0x20f468[_0x4c1c('0xb6')](_0x11d576)[_0x4c1c('0xb8')](sendMessageReschedule(_0x11d576))[_0x4c1c('0xb0')](loggerCatch(_0x4c1c('0xb9')));}else{_0x11d576[_0x4c1c('0x43')]=_0x4c1c('0x1f7');if(_[_0x4c1c('0xac')](_0x815648[0x0])||_[_0x4c1c('0xac')](_0x815648[0x0][_0x4c1c('0x161')])||_['isNil'](_0x815648[0x0][_0x4c1c('0x161')][_0x4c1c('0x160')])){_0x20f468['emptyContact'](_0x4c1c('0x1fa'),_0x11d576,_0x815648[0x0]);}else{_0x20f468[_0x4c1c('0xba')](_[_0x4c1c('0xce')](_0x815648[0x0],[_0x4c1c('0xd2'),'Contact.phone']))[_0x4c1c('0xb8')](_0x20f468[_0x4c1c('0x1e3')](_0x11d576,_0x815648[0x0]))[_0x4c1c('0xb0')](_0x20f468[_0x4c1c('0xcb')]('[actionOriginatePredictive]\x20',_0x11d576));}}})[_0x4c1c('0xb0')](loggerGetContactDialer(_0x4c1c('0x204'),_0x11d576,0x1));emitVoiceQueueSummary(_0x11d576);};Dialer[_0x4c1c('0x1b')][_0x4c1c('0x1d8')]=function(_0x3e244f,_0x22a62b,_0xd37c6,_0x49175f,_0x3b0dea,_0x38042e){loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x205'));loggerPredictive[_0x4c1c('0x7f')]('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',_0x3e244f);loggerPredictive['info'](_0x4c1c('0x206'),_0x22a62b);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x207'),_0xd37c6);loggerPredictive['info'](_0x4c1c('0x208'),_0x49175f);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x209'),_0x3b0dea);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x84'));return new BPromise(function(_0x4ad847,_0x1545cb){if(_0x3e244f<=0x0||isNaN(_0x3e244f)){return _0x1545cb(msgResponse(_0x4c1c('0x20a'),_0x4c1c('0x49'),_0x4c1c('0x20b')+_0x3e244f));}if(_0xd37c6<=0x0||isNaN(_0xd37c6)){return _0x1545cb(msgResponse(_0x4c1c('0x20a'),_0x4c1c('0x49'),'Ts\x20=\x20'+_0xd37c6));}if(_0x49175f<=0x0||isNaN(_0x49175f)){return _0x1545cb(msgResponse(_0x4c1c('0x20a'),'Error',_0x4c1c('0x20c')+_0x49175f));}if(_0x22a62b<=0x0||isNaN(_0x22a62b)){return _0x1545cb(msgResponse(_0x4c1c('0x20a'),'Error','interval\x20=\x20'+_0x22a62b));}if(_0x3b0dea<=0x0||isNaN(_0x3b0dea)){return _0x1545cb(msgResponse(_0x4c1c('0x20a'),'Error',_0x4c1c('0x20d')+_0x3b0dea));}_0x38042e=_0x38042e||0x0;var _0x1cba5b=0x1/_0xd37c6;var _0x2a3292=0x0;var _0x18b16e=0x0;var _0x447c6b=0x0;var _0x434767=0x0;for(var _0x2c6d4e=0x0;_0x447c6b<_0x3b0dea;_0x2c6d4e+=0x1){_0x18b16e=_0x2c6d4e/_0x22a62b;_0x2a3292=(_0x49175f*_0x18b16e+_0x38042e)/_0x1cba5b;_0x447c6b=erlangb(_0x2a3292,_0x3e244f);_0x434767=_0x2a3292/_0x3e244f*(0x1-erlangb(_0x2a3292,_0x3e244f));}return _0x4ad847({'erlangCalls':_0x2c6d4e,'erlangCallToSecond':_0x22a62b/_0x2c6d4e,'erlangAbandonmentRate':_0x447c6b,'erlangBusyFactor':_0x434767});});};Dialer['prototype']['busyFactor']=function(_0x381fb6,_0x3cb0f9,_0x4805d6,_0x531f09,_0x1d7b8b,_0x12bd60){loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x20e'));loggerPredictive['info'](_0x4c1c('0x20f'),_0x381fb6);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x206'),_0x3cb0f9);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x207'),_0x4805d6);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x208'),_0x531f09);loggerPredictive[_0x4c1c('0x7f')](_0x4c1c('0x210'),_0x1d7b8b);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x5067ef,_0x41171f){if(_0x381fb6<=0x0||isNaN(_0x381fb6)){return _0x41171f(msgResponse(_0x4c1c('0x211'),_0x4c1c('0x49'),_0x4c1c('0x20b')+_0x381fb6));}if(_0x4805d6<=0x0||isNaN(_0x4805d6)){return _0x41171f(msgResponse(_0x4c1c('0x211'),_0x4c1c('0x49'),'Ts\x20=\x20'+_0x4805d6));}if(_0x531f09<=0x0||isNaN(_0x531f09)){return _0x41171f(msgResponse(_0x4c1c('0x211'),_0x4c1c('0x49'),_0x4c1c('0x20c')+_0x531f09));}if(_0x3cb0f9<=0x0||isNaN(_0x3cb0f9)){return _0x41171f(msgResponse(_0x4c1c('0x211'),_0x4c1c('0x49'),_0x4c1c('0x212')+_0x3cb0f9));}if(_0x1d7b8b<=0x0||isNaN(_0x1d7b8b)){return _0x41171f(msgResponse(_0x4c1c('0x211'),'Error',_0x4c1c('0x213')+_0x1d7b8b));}_0x12bd60=_0x12bd60||0x0;var _0x2889d5=0x1/_0x4805d6;var _0x3bd210=0x0;var _0x150ff9=0x0;var _0x2672b2=0x0;var _0xd404e=0x0;for(var _0x2f57ed=0x0;_0xd404e<_0x1d7b8b;_0x2f57ed+=0x1){_0x150ff9=_0x2f57ed/_0x3cb0f9;_0x3bd210=(_0x531f09*_0x150ff9+_0x12bd60)/_0x2889d5;_0x2672b2=erlangb(_0x3bd210,_0x381fb6);_0xd404e=_0x3bd210/_0x381fb6*(0x1-erlangb(_0x3bd210,_0x381fb6));}return _0x5067ef({'erlangCalls':_0x2f57ed,'erlangCallToSecond':_0x3cb0f9/_0x2f57ed,'erlangAbandonmentRate':_0x2672b2,'erlangBusyFactor':_0xd404e});});};module[_0x4c1c('0x214')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index b9a2f16..801ff87 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3912=['exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x27ed41,_0xb780a1){var _0x507934=function(_0x1f09ab){while(--_0x1f09ab){_0x27ed41['push'](_0x27ed41['shift']());}};_0x507934(++_0xb780a1);}(_0x3912,0xa9));var _0x2391=function(_0x583c8a,_0x268422){_0x583c8a=_0x583c8a-0x0;var _0xd6ae67=_0x3912[_0x583c8a];return _0xd6ae67;};'use strict';var util=require(_0x2391('0x0'));var _=require(_0x2391('0x1'));var moment=require('moment');function getSeconds(_0x5b719f,_0x3837ce){var _0x1e0f94=moment(_0x5b719f)[_0x2391('0x2')](0x0);var _0x3d9a69=moment(_0x3837ce)[_0x2391('0x2')](0x0);return _0x1e0f94[_0x2391('0x3')](_0x3d9a69,_0x2391('0x4'));}function QueueCallerAbandon(_0xd5a969,_0x79b197){this[_0x2391('0x5')]=_0xd5a969[_0x2391('0x5')];this[_0x2391('0x6')]=_0xd5a969[_0x2391('0x6')];this[_0x2391('0x7')]=_0xd5a969[_0x2391('0x6')]===_0x2391('0x8')?_0x2391('0x9'):_0xd5a969[_0x2391('0x6')];this[_0x2391('0xa')]=_0xd5a969[_0x2391('0xa')];this['countcongestionretry']=_0xd5a969[_0x2391('0xb')];this[_0x2391('0xc')]=_0xd5a969[_0x2391('0xc')];this[_0x2391('0xd')]=_0xd5a969[_0x2391('0xa')]+_0xd5a969[_0x2391('0xb')]+_0xd5a969[_0x2391('0xc')]+_0xd5a969[_0x2391('0xe')]+_0xd5a969[_0x2391('0xf')]+_0xd5a969['countabandonedretry']+_0xd5a969[_0x2391('0x10')]+_0xd5a969['countagentrejectretry'];this[_0x2391('0xe')]=_0xd5a969[_0x2391('0xe')];this[_0x2391('0xf')]=_0xd5a969[_0x2391('0xf')];this['countabandonedretry']=_0xd5a969['countabandonedretry'];this[_0x2391('0x10')]=_0xd5a969[_0x2391('0x10')];this['countagentrejectretry']=_0xd5a969[_0x2391('0x11')];this[_0x2391('0x12')]=_0x79b197['uniqueid'];this[_0x2391('0x13')]=_0xd5a969[_0x2391('0x14')];this['calleridnum']=_0xd5a969['number'];this[_0x2391('0x15')]=_0xd5a969[_0x2391('0x15')];this[_0x2391('0x16')]=_0xd5a969['responsetime'];this[_0x2391('0x17')]=_0xd5a969['droptime'];this[_0x2391('0x18')]=this[_0x2391('0x17')];this[_0x2391('0x19')]=getSeconds(_0xd5a969[_0x2391('0x16')],_0xd5a969['starttime']);this[_0x2391('0x1a')]=getSeconds(this['droptime'],_0xd5a969[_0x2391('0x16')]);this[_0x2391('0x1b')]=0x0;this[_0x2391('0x9')]=_0x79b197['queue'];this['membername']=_0x79b197[_0x2391('0x1c')];this[_0x2391('0x1d')]=_0x79b197[_0x2391('0x1d')];this[_0x2391('0x1e')]=_0xd5a969[_0x2391('0x1e')];this[_0x2391('0x1f')]=_0xd5a969['callbackuniqueid'];this[_0x2391('0x20')]=_0xd5a969[_0x2391('0x20')];this['recallme']=_0xd5a969[_0x2391('0x21')];this[_0x2391('0x22')]=_0xd5a969[_0x2391('0x22')];this['ListId']=_0xd5a969[_0x2391('0x23')];this[_0x2391('0x24')]=_0xd5a969[_0x2391('0x24')];this['VoiceQueueId']=_0xd5a969[_0x2391('0x25')];this[_0x2391('0x26')]=_0xd5a969[_0x2391('0x26')];this['originatecalleridnum']=_0xd5a969[_0x2391('0x27')]||'';this['originatecalleridname']=_0xd5a969[_0x2391('0x28')]||'';}module[_0x2391('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xe5e9=['moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe5e9,0xda));var _0x9e5e=function(_0xb5c10c,_0x33d4e6){_0xb5c10c=_0xb5c10c-0x0;var _0x309636=_0xe5e9[_0xb5c10c];return _0x309636;};'use strict';var util=require(_0x9e5e('0x0'));var _=require(_0x9e5e('0x1'));var moment=require(_0x9e5e('0x2'));function getSeconds(_0x3a176f,_0x742e5d){var _0x97594=moment(_0x3a176f)[_0x9e5e('0x3')](0x0);var _0x363ecd=moment(_0x742e5d)['milliseconds'](0x0);return _0x97594[_0x9e5e('0x4')](_0x363ecd,_0x9e5e('0x5'));}function QueueCallerAbandon(_0x28e6e0,_0x53dd46){this[_0x9e5e('0x6')]=_0x28e6e0[_0x9e5e('0x6')];this[_0x9e5e('0x7')]=_0x28e6e0[_0x9e5e('0x7')];this[_0x9e5e('0x8')]=_0x28e6e0[_0x9e5e('0x7')]===_0x9e5e('0x9')?_0x9e5e('0xa'):_0x28e6e0[_0x9e5e('0x7')];this[_0x9e5e('0xb')]=_0x28e6e0['countbusyretry'];this[_0x9e5e('0xc')]=_0x28e6e0[_0x9e5e('0xc')];this['countnoanswerretry']=_0x28e6e0['countnoanswerretry'];this['countglobal']=_0x28e6e0[_0x9e5e('0xb')]+_0x28e6e0['countcongestionretry']+_0x28e6e0['countnoanswerretry']+_0x28e6e0['countnosuchnumberretry']+_0x28e6e0[_0x9e5e('0xd')]+_0x28e6e0[_0x9e5e('0xe')]+_0x28e6e0[_0x9e5e('0xf')]+_0x28e6e0[_0x9e5e('0x10')];this[_0x9e5e('0x11')]=_0x28e6e0[_0x9e5e('0x11')];this[_0x9e5e('0xd')]=_0x28e6e0[_0x9e5e('0xd')];this[_0x9e5e('0xe')]=_0x28e6e0[_0x9e5e('0xe')];this[_0x9e5e('0xf')]=_0x28e6e0['countmachineretry'];this[_0x9e5e('0x10')]=_0x28e6e0[_0x9e5e('0x10')];this[_0x9e5e('0x12')]=_0x53dd46[_0x9e5e('0x12')];this[_0x9e5e('0x13')]=_0x28e6e0[_0x9e5e('0x14')];this[_0x9e5e('0x15')]=_0x28e6e0[_0x9e5e('0x16')];this[_0x9e5e('0x17')]=_0x28e6e0[_0x9e5e('0x17')];this[_0x9e5e('0x18')]=_0x28e6e0[_0x9e5e('0x18')];this[_0x9e5e('0x19')]=_0x28e6e0['droptime'];this[_0x9e5e('0x1a')]=this[_0x9e5e('0x19')];this[_0x9e5e('0x1b')]=getSeconds(_0x28e6e0[_0x9e5e('0x18')],_0x28e6e0[_0x9e5e('0x17')]);this[_0x9e5e('0x1c')]=getSeconds(this[_0x9e5e('0x19')],_0x28e6e0[_0x9e5e('0x18')]);this[_0x9e5e('0x1d')]=0x0;this['queue']=_0x53dd46['queue'];this[_0x9e5e('0x1e')]=_0x53dd46[_0x9e5e('0x1f')];this[_0x9e5e('0x20')]=_0x53dd46[_0x9e5e('0x20')];this[_0x9e5e('0x21')]=_0x28e6e0[_0x9e5e('0x21')];this[_0x9e5e('0x22')]=_0x28e6e0['callbackuniqueid'];this['callbackat']=_0x28e6e0[_0x9e5e('0x23')];this[_0x9e5e('0x24')]=_0x28e6e0[_0x9e5e('0x24')];this['ContactId']=_0x28e6e0[_0x9e5e('0x25')];this['ListId']=_0x28e6e0['ListId'];this[_0x9e5e('0x26')]=_0x28e6e0['UserId'];this[_0x9e5e('0x27')]=_0x28e6e0[_0x9e5e('0x27')];this['CampaignId']=_0x28e6e0[_0x9e5e('0x28')];this[_0x9e5e('0x29')]=_0x28e6e0['originatecalleridnum']||'';this[_0x9e5e('0x2a')]=_0x28e6e0[_0x9e5e('0x2a')]||'';}module[_0x9e5e('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6b8ddc9..d6d3fe2 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(_0x161aa5,_0x44fbca){var _0x35ebd9=function(_0x13d376){while(--_0x13d376){_0x161aa5['push'](_0x161aa5['shift']());}};_0x35ebd9(++_0x44fbca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x29dbc4,_0x1a6f2d){var _0x1cf334=function(_0x33e4d0){while(--_0x33e4d0){_0x29dbc4['push'](_0x29dbc4['shift']());}};_0x1cf334(++_0x1a6f2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 b096310..4eb8e61 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 _0x4483=['catch','error','\x20notify\x20','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','syncNewState','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','fax'];(function(_0x3b06b0,_0x4d4db6){var _0x3a75a7=function(_0x5a37bd){while(--_0x5a37bd){_0x3b06b0['push'](_0x3b06b0['shift']());}};_0x3a75a7(++_0x4d4db6);}(_0x4483,0x1a3));var _0x3448=function(_0x324e57,_0x3053d7){_0x324e57=_0x324e57-0x0;var _0x4feb7b=_0x4483[_0x324e57];return _0x4feb7b;};'use strict';var util=require(_0x3448('0x0'));var _=require(_0x3448('0x1'));var BPromise=require(_0x3448('0x2'));var uuid=require('uuid');var moment=require(_0x3448('0x3'));var path=require(_0x3448('0x4'));var tiff2pdf=require(_0x3448('0x5'));var gs=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('fax');var ami=require(_0x3448('0x8'));var rpcDb=require(_0x3448('0x9'));var Channel=require(_0x3448('0xa'));var ut=require(_0x3448('0xb'));var Action=require(_0x3448('0xc'));var faxAccount=require(_0x3448('0xd'));var attachment=require(_0x3448('0xe'));var faxMessage=require(_0x3448('0xf'));function Fax(_0x5923ee){this['channels']={};this[_0x3448('0x10')]=_0x5923ee[_0x3448('0x10')];this[_0x3448('0x11')]=_0x5923ee[_0x3448('0x11')];this[_0x3448('0x12')]={};ami['on'](_0x3448('0x13'),this[_0x3448('0x14')][_0x3448('0x15')](this));ami['on'](_0x3448('0x16'),this[_0x3448('0x17')][_0x3448('0x15')](this));ami['on']('newstate',this['syncNewState'][_0x3448('0x15')](this));ami['on'](_0x3448('0x18'),this['syncNewExten'][_0x3448('0x15')](this));ami['on'](_0x3448('0x19'),this[_0x3448('0x1a')]['bind'](this));ami['on'](_0x3448('0x1b'),this[_0x3448('0x1c')]['bind'](this));ami['on'](_0x3448('0x1d'),this[_0x3448('0x1e')][_0x3448('0x15')](this));ami['on']('originateresponse',this[_0x3448('0x1f')][_0x3448('0x15')](this));}Fax[_0x3448('0x20')][_0x3448('0x14')]=function(_0x400af8){if(_0x400af8[_0x3448('0x21')]===_0x3448('0x22')){for(var _0x425514 in this['faxAccounts']){if(this[_0x3448('0x10')]['hasOwnProperty'](_0x425514)){if(_0x400af8['exten']===this['faxAccounts'][_0x425514][_0x3448('0x23')]){this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]={};this['channels'][_0x400af8[_0x3448('0x25')]][_0x3448('0x26')]=_0x400af8[_0x3448('0x26')];this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]['id']=this[_0x3448('0x10')][_0x425514]['id'];this['channels'][_0x400af8['uniqueid']]['name']=this[_0x3448('0x10')][_0x425514][_0x3448('0x27')];logger['info'](_0x400af8['uniqueid'],_0x3448('0x28'));}}}}if(this[_0x3448('0x12')][_0x400af8[_0x3448('0x25')]]){this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]={};this['channels'][_0x400af8[_0x3448('0x25')]][_0x3448('0x26')]=_0x400af8[_0x3448('0x26')];logger[_0x3448('0x29')](_0x400af8[_0x3448('0x25')],'\x20syncNewchannel\x20');}};Fax[_0x3448('0x20')][_0x3448('0x17')]=function(_0x52c163){if(this[_0x3448('0x24')][_0x52c163[_0x3448('0x25')]]){for(var _0x310912 in _0x52c163[_0x3448('0x2a')]){if(_0x52c163[_0x3448('0x2a')][_0x3448('0x2b')](_0x310912)){this[_0x3448('0x24')][_0x52c163[_0x3448('0x25')]][_0x310912]=_0x52c163['value'];}}}};Fax[_0x3448('0x20')][_0x3448('0x2c')]=function(_0xcfdc5){if(this['channels'][_0xcfdc5[_0x3448('0x25')]]){this['channels'][_0xcfdc5['uniqueid']]['channelstate']=_0xcfdc5[_0x3448('0x2d')];this[_0x3448('0x24')][_0xcfdc5['uniqueid']]['channelstatedesc']=_0xcfdc5[_0x3448('0x2e')];}};Fax[_0x3448('0x20')][_0x3448('0x2f')]=function(_0x1e99ff){if(this['channels'][_0x1e99ff[_0x3448('0x25')]]){for(var _0x3b6ff9 in _0x1e99ff[_0x3448('0x2a')]){if(_0x1e99ff['variable'][_0x3448('0x2b')](_0x3b6ff9)){this[_0x3448('0x24')][_0x1e99ff['uniqueid']][_0x3b6ff9]=_0x1e99ff['value'];}}}};Fax[_0x3448('0x20')][_0x3448('0x1a')]=function(_0x3c7eb1){if(this[_0x3448('0x24')][_0x3c7eb1['uniqueid']]){this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x30')]=_0x3c7eb1[_0x3448('0x30')];this['channels'][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x31')]=_0x3c7eb1['status'];this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x23')]=_0x3c7eb1[_0x3448('0x23')];this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x32')]=_0x3c7eb1[_0x3448('0x32')];logger[_0x3448('0x29')](_0x3c7eb1['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x3448('0x20')]['syncReceiveFax']=function(_0x22bb31){var _0x3048fa=this;if(this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]){var _0x5af6cd=this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['id'];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x33')]=_0x22bb31[_0x3448('0x33')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x34')]=_0x22bb31['pagestransferred'];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x23')]=_0x22bb31[_0x3448('0x23')];this[_0x3448('0x24')][_0x22bb31['uniqueid']][_0x3448('0x35')]=_0x22bb31[_0x3448('0x35')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x36')]=_0x22bb31[_0x3448('0x36')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['filename']=_0x22bb31[_0x3448('0x32')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['calleridnum']=_0x22bb31[_0x3448('0x37')];if(this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x34')]>0x0){tiff2pdf(_0x22bb31[_0x3448('0x32')],_0x3448('0x38'),function(_0x213065){logger['info'](_0x22bb31[_0x3448('0x25')],_0x3448('0x39'),_0x213065[_0x3448('0x3a')]);attachment[_0x3448('0x3b')]({'name':path[_0x3448('0x3c')](_0x22bb31[_0x3448('0x32')])['name'],'basename':path[_0x3448('0x3c')](_0x22bb31['filename'])['name']+_0x3448('0x3d'),'type':_0x3448('0x3e')})['then'](function(_0x3a700f){faxAccount[_0x3448('0x3f')](_0x5af6cd,{'from':_0x22bb31['calleridnum'],'mapKey':_0x3448('0x40'),'body':path[_0x3448('0x3c')](_0x22bb31['filename'])[_0x3448('0x27')]+_0x3448('0x3d'),'AttachmentId':_0x3a700f['id']})[_0x3448('0x41')](function(_0x2be597){logger[_0x3448('0x42')](_0x22bb31[_0x3448('0x25')],_0x3448('0x43'),JSON['stringify'](_0x2be597));});})['catch'](function(_0x38aca7){logger[_0x3448('0x42')](_0x22bb31[_0x3448('0x25')],_0x3448('0x44'),JSON['stringify'](_0x38aca7));});});}logger[_0x3448('0x29')](_0x22bb31[_0x3448('0x25')],_0x3448('0x44'));}};Fax[_0x3448('0x20')][_0x3448('0x1f')]=function(_0x5d942b){if(this[_0x3448('0x12')][_0x5d942b['uniqueid']]){_[_0x3448('0x45')](this[_0x3448('0x24')][_0x5d942b['uniqueid']],_[_0x3448('0x46')](_0x5d942b,[_0x3448('0x47'),_0x3448('0x48')]));}};function updateStatus(_0x19c283){if(_0x19c283[_0x3448('0x49')]){faxMessage[_0x3448('0x4a')](_0x19c283[_0x3448('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x3448('0x4b')](function(_0x9fbee8){ut['logger']('[Fax][Message][Error][Updated]',_0x9fbee8);})[_0x3448('0x41')](function(_0x3d6598){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x3d6598);});}else{ut[_0x3448('0x4c')](_0x3448('0x4d'));}}Fax[_0x3448('0x20')][_0x3448('0x4e')]=function(_0x176e60,_0x39db50,_0x2aea70){var _0x4c0053=this;var _0x5ee303={};if(_0x39db50){_0x5ee303={'read':_0x39db50};}else{_0x5ee303={'failMessage':_0x2aea70};}if(this['actions'][_0x176e60][_0x3448('0x49')]){faxMessage[_0x3448('0x4a')](this['actions'][_0x176e60][_0x3448('0x49')],_0x5ee303)[_0x3448('0x4b')](function(_0x5a4cde){ut[_0x3448('0x4c')](_0x3448('0x4f'),_0x5a4cde);})['catch'](function(_0x2afe2a){ut[_0x3448('0x4c')](_0x3448('0x50'),_0x2afe2a);})[_0x3448('0x51')](function(){delete _0x4c0053[_0x3448('0x24')][_0x176e60];delete _0x4c0053[_0x3448('0x12')][_0x176e60];});}else{ut[_0x3448('0x4c')](_0x3448('0x52'));delete this[_0x3448('0x24')][_0x176e60];delete this['actions'][_0x176e60];}};Fax[_0x3448('0x20')]['syncHangup']=function(_0x2991e8){var _0x108b99=this;if(this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]]){if(this[_0x3448('0x12')][_0x2991e8[_0x3448('0x25')]]){this['channels'][_0x2991e8[_0x3448('0x25')]]['id']=this['actions'][_0x2991e8[_0x3448('0x25')]]['id'];this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x27')]=this[_0x3448('0x12')][_0x2991e8['uniqueid']]['name'];}logger[_0x3448('0x29')](_0x2991e8[_0x3448('0x25')],this[_0x3448('0x12')][_0x2991e8['uniqueid']]?_0x3448('0x53'):_0x3448('0x54'),JSON[_0x3448('0x55')](this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]]));if(this[_0x3448('0x12')][_0x2991e8[_0x3448('0x25')]]){if(this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x56')]>0x0&&this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x19')]===_0x3448('0x57')){this[_0x3448('0x4e')](_0x2991e8[_0x3448('0x25')],!![]);}else{this[_0x3448('0x4e')](_0x2991e8[_0x3448('0x25')],![],this['channels'][_0x2991e8[_0x3448('0x25')]]['faxstatusstring']?_0x3448('0x58')+this['channels'][_0x2991e8[_0x3448('0x25')]][_0x3448('0x59')]:'SENDING\x20FAILED');}}}};Fax[_0x3448('0x20')][_0x3448('0x5a')]=function(_0x54cddd){var _0x4f6902=this;return new BPromise(function(_0x599350,_0x4864ae){_0x4f6902['execOriginate'](_0x54cddd,_0x4f6902[_0x3448('0x10')][_0x54cddd[_0x3448('0x5b')]])['then'](function(_0x5e1cbf){ut[_0x3448('0x4c')](_0x3448('0x5c'),_0x5e1cbf);_0x599350(ut[_0x3448('0x3a')](_0x3448('0x5d')));})[_0x3448('0x41')](function(_0x27003f){ut[_0x3448('0x4c')](_0x3448('0x5e'),_0x27003f);updateStatus(_0x54cddd);_0x4864ae(ut[_0x3448('0x3a')](_0x3448('0x5f')));});});};Fax[_0x3448('0x20')][_0x3448('0x60')]=function(_0x41f84c){var _0x387ab2=this;return new BPromise(function(_0x5476dd,_0x18c449){var _0x2dcf50=_0x387ab2['checkTrunk'](_0x387ab2[_0x3448('0x10')][_0x41f84c[_0x3448('0x5b')]]['Trunk'],_0x41f84c);if(_0x2dcf50[_0x3448('0x61')]){_0x5476dd(ut[_0x3448('0x3a')](_0x3448('0x62')));}else{_0x18c449(ut['message'](_0x2dcf50['message']));}});};function originate(_0x41d459,_0x489b70,_0x31dfc5){return new BPromise(function(_0x42c146,_0x5d952a){if(_0x31dfc5){var _0x50b81b=util[_0x3448('0x63')](_0x3448('0x64'),path[_0x3448('0x3c')](_0x41d459['path'])['name'],_0x41d459[_0x3448('0x4')]);gs[_0x3448('0x65')](_0x50b81b)[_0x3448('0x4b')](function(){_0x41d459[_0x3448('0x4')]=util[_0x3448('0x63')](_0x3448('0x66'),path['parse'](_0x41d459[_0x3448('0x4')])['dir'],path[_0x3448('0x3c')](_0x41d459[_0x3448('0x4')])['name']);_0x489b70[_0x3448('0x67')]=_0x41d459[_0x3448('0x4')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x3448('0x68')](ut[_0x3448('0x69')](_0x41d459,_0x489b70))[_0x3448('0x4b')](function(_0x392874){_0x42c146(_0x392874);})[_0x3448('0x41')](function(_0xfdd159){_0x5d952a(_0xfdd159);});})[_0x3448('0x41')](function(_0x29f39b){_0x5d952a(_0x29f39b);});}else{ami[_0x3448('0x68')](ut[_0x3448('0x69')](_0x41d459,_0x489b70))[_0x3448('0x4b')](function(_0xc0d8f1){_0x42c146(_0xc0d8f1);})[_0x3448('0x41')](function(_0x11d62f){_0x5d952a(_0x11d62f);});}});}Fax[_0x3448('0x20')][_0x3448('0x6a')]=function(_0x4cfab2,_0x4efd6c){var _0x42ac4f=this;return new BPromise(function(_0x4d2af5,_0x223a6b){var _0x155ee2=uuid['v4']();var _0x584229=ut[_0x3448('0x6b')](_0x4cfab2,_0x4efd6c);_0x42ac4f['actions'][_0x155ee2]=new Action(_0x155ee2,_0x4efd6c,_0x4cfab2);var _0x15d898=_0x42ac4f[_0x3448('0x12')][_0x155ee2];if(path[_0x3448('0x3c')](_0x4cfab2[_0x3448('0x4')])[_0x3448('0x6c')]==='.pdf'){originate(_0x15d898,_0x584229,!![])[_0x3448('0x4b')](function(_0x2e2b73){_0x4d2af5(_0x2e2b73);})[_0x3448('0x41')](function(_0x4aad6d){_0x223a6b(_0x4aad6d);});}else{originate(_0x15d898,_0x584229,![])[_0x3448('0x4b')](function(_0x15a3b2){_0x4d2af5(_0x15a3b2);})[_0x3448('0x41')](function(_0x5d14ac){_0x223a6b(_0x5d14ac);});}});};Fax[_0x3448('0x20')]['isTrunkReachable']=function(_0x48d320){return!_[_0x3448('0x6d')](_0x48d320)&&!_['isNil'](_0x48d320[_0x3448('0x27')])&&!_['isNil'](_0x48d320[_0x3448('0x6e')])&&_0x48d320[_0x3448('0x6e')]&&!_['isNil'](this['trunks'][util[_0x3448('0x63')](_0x3448('0x6f'),_0x48d320['name'])])&&!_[_0x3448('0x6d')](this[_0x3448('0x11')][util['format'](_0x3448('0x6f'),_0x48d320[_0x3448('0x27')])][_0x3448('0x31')])&&(this[_0x3448('0x11')][util['format'](_0x3448('0x6f'),_0x48d320['name'])][_0x3448('0x31')]==='reachable'||this[_0x3448('0x11')][util[_0x3448('0x63')](_0x3448('0x6f'),_0x48d320['name'])][_0x3448('0x31')]===_0x3448('0x70'));};Fax['prototype'][_0x3448('0x71')]=function(_0x51f6b0,_0x520950){if(!this[_0x3448('0x72')](_0x51f6b0)){ut['logger'](_0x3448('0x73'),_[_0x3448('0x6d')](_0x51f6b0)?'':_0x51f6b0[_0x3448('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x3448('0x74')};}if(_[_0x3448('0x6d')](_0x520950[_0x3448('0x40')])){ut[_0x3448('0x4c')](_0x3448('0x75'),JSON[_0x3448('0x55')](_0x520950));return{'isValid':![],'message':_0x3448('0x76')};}if(_[_0x3448('0x6d')](_0x520950[_0x3448('0x4')])){ut[_0x3448('0x4c')](_0x3448('0x77'),JSON[_0x3448('0x55')](_0x520950));return{'isValid':![],'message':_0x3448('0x78')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x3f8c=['faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','moment','path','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','fax','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3f8c,0x104));var _0xc3f8=function(_0x47cea9,_0x17f62b){_0x47cea9=_0x47cea9-0x0;var _0xd0848d=_0x3f8c[_0x47cea9];return _0xd0848d;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xc3f8('0x0'));var uuid=require(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var path=require(_0xc3f8('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require(_0xc3f8('0x4'));var Channel=require(_0xc3f8('0x5'));var ut=require(_0xc3f8('0x6'));var Action=require(_0xc3f8('0x7'));var faxAccount=require(_0xc3f8('0x8'));var attachment=require(_0xc3f8('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x28397e){this[_0xc3f8('0xa')]={};this[_0xc3f8('0xb')]=_0x28397e[_0xc3f8('0xb')];this[_0xc3f8('0xc')]=_0x28397e[_0xc3f8('0xc')];this[_0xc3f8('0xd')]={};ami['on']('newchannel',this[_0xc3f8('0xe')][_0xc3f8('0xf')](this));ami['on'](_0xc3f8('0x10'),this[_0xc3f8('0x11')]['bind'](this));ami['on'](_0xc3f8('0x12'),this[_0xc3f8('0x13')][_0xc3f8('0xf')](this));ami['on'](_0xc3f8('0x14'),this['syncNewExten'][_0xc3f8('0xf')](this));ami['on'](_0xc3f8('0x15'),this[_0xc3f8('0x16')][_0xc3f8('0xf')](this));ami['on'](_0xc3f8('0x17'),this[_0xc3f8('0x18')][_0xc3f8('0xf')](this));ami['on'](_0xc3f8('0x19'),this[_0xc3f8('0x1a')][_0xc3f8('0xf')](this));ami['on'](_0xc3f8('0x1b'),this[_0xc3f8('0x1c')][_0xc3f8('0xf')](this));}Fax['prototype'][_0xc3f8('0xe')]=function(_0x4ccca7){if(_0x4ccca7['context']===_0xc3f8('0x1d')){for(var _0x2e7c0f in this[_0xc3f8('0xb')]){if(this[_0xc3f8('0xb')]['hasOwnProperty'](_0x2e7c0f)){if(_0x4ccca7[_0xc3f8('0x1e')]===this[_0xc3f8('0xb')][_0x2e7c0f]['localstationid']){this[_0xc3f8('0xa')][_0x4ccca7['uniqueid']]={};this[_0xc3f8('0xa')][_0x4ccca7[_0xc3f8('0x1f')]][_0xc3f8('0x20')]=_0x4ccca7['channel'];this['channels'][_0x4ccca7[_0xc3f8('0x1f')]]['id']=this[_0xc3f8('0xb')][_0x2e7c0f]['id'];this[_0xc3f8('0xa')][_0x4ccca7[_0xc3f8('0x1f')]][_0xc3f8('0x21')]=this[_0xc3f8('0xb')][_0x2e7c0f][_0xc3f8('0x21')];logger[_0xc3f8('0x22')](_0x4ccca7['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x4ccca7[_0xc3f8('0x1f')]]){this['channels'][_0x4ccca7[_0xc3f8('0x1f')]]={};this[_0xc3f8('0xa')][_0x4ccca7['uniqueid']][_0xc3f8('0x20')]=_0x4ccca7[_0xc3f8('0x20')];logger[_0xc3f8('0x22')](_0x4ccca7[_0xc3f8('0x1f')],_0xc3f8('0x23'));}};Fax[_0xc3f8('0x24')][_0xc3f8('0x11')]=function(_0x7f14ad){if(this[_0xc3f8('0xa')][_0x7f14ad[_0xc3f8('0x1f')]]){for(var _0x22c8e6 in _0x7f14ad[_0xc3f8('0x25')]){if(_0x7f14ad[_0xc3f8('0x25')][_0xc3f8('0x26')](_0x22c8e6)){this['channels'][_0x7f14ad[_0xc3f8('0x1f')]][_0x22c8e6]=_0x7f14ad[_0xc3f8('0x27')];}}}};Fax[_0xc3f8('0x24')]['syncNewState']=function(_0x151bba){if(this['channels'][_0x151bba[_0xc3f8('0x1f')]]){this[_0xc3f8('0xa')][_0x151bba['uniqueid']]['channelstate']=_0x151bba[_0xc3f8('0x28')];this[_0xc3f8('0xa')][_0x151bba[_0xc3f8('0x1f')]][_0xc3f8('0x29')]=_0x151bba[_0xc3f8('0x29')];}};Fax[_0xc3f8('0x24')][_0xc3f8('0x2a')]=function(_0x80546a){if(this[_0xc3f8('0xa')][_0x80546a[_0xc3f8('0x1f')]]){for(var _0x52e543 in _0x80546a[_0xc3f8('0x25')]){if(_0x80546a[_0xc3f8('0x25')][_0xc3f8('0x26')](_0x52e543)){this[_0xc3f8('0xa')][_0x80546a[_0xc3f8('0x1f')]][_0x52e543]=_0x80546a['value'];}}}};Fax['prototype'][_0xc3f8('0x16')]=function(_0x8a0b00){if(this[_0xc3f8('0xa')][_0x8a0b00[_0xc3f8('0x1f')]]){this[_0xc3f8('0xa')][_0x8a0b00['uniqueid']][_0xc3f8('0x2b')]=_0x8a0b00[_0xc3f8('0x2b')];this[_0xc3f8('0xa')][_0x8a0b00['uniqueid']][_0xc3f8('0x2c')]=_0x8a0b00[_0xc3f8('0x2c')];this[_0xc3f8('0xa')][_0x8a0b00['uniqueid']][_0xc3f8('0x2d')]=_0x8a0b00[_0xc3f8('0x2d')];this['channels'][_0x8a0b00[_0xc3f8('0x1f')]][_0xc3f8('0x2e')]=_0x8a0b00[_0xc3f8('0x2e')];logger[_0xc3f8('0x22')](_0x8a0b00[_0xc3f8('0x1f')],_0xc3f8('0x2f'));}};Fax['prototype'][_0xc3f8('0x18')]=function(_0x2e4880){var _0x2d3129=this;if(this[_0xc3f8('0xa')][_0x2e4880[_0xc3f8('0x1f')]]){var _0x502293=this[_0xc3f8('0xa')][_0x2e4880[_0xc3f8('0x1f')]]['id'];this[_0xc3f8('0xa')][_0x2e4880['uniqueid']][_0xc3f8('0x30')]=_0x2e4880[_0xc3f8('0x30')];this[_0xc3f8('0xa')][_0x2e4880[_0xc3f8('0x1f')]]['pagestransferred']=_0x2e4880[_0xc3f8('0x31')];this[_0xc3f8('0xa')][_0x2e4880[_0xc3f8('0x1f')]][_0xc3f8('0x2d')]=_0x2e4880['localstationid'];this[_0xc3f8('0xa')][_0x2e4880['uniqueid']]['resolution']=_0x2e4880[_0xc3f8('0x32')];this[_0xc3f8('0xa')][_0x2e4880[_0xc3f8('0x1f')]][_0xc3f8('0x33')]=_0x2e4880['transferrate'];this['channels'][_0x2e4880[_0xc3f8('0x1f')]][_0xc3f8('0x2e')]=_0x2e4880[_0xc3f8('0x2e')];this[_0xc3f8('0xa')][_0x2e4880[_0xc3f8('0x1f')]][_0xc3f8('0x34')]=_0x2e4880[_0xc3f8('0x34')];if(this[_0xc3f8('0xa')][_0x2e4880[_0xc3f8('0x1f')]][_0xc3f8('0x31')]>0x0){tiff2pdf(_0x2e4880[_0xc3f8('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x46f902){logger[_0xc3f8('0x22')](_0x2e4880['uniqueid'],_0xc3f8('0x35'),_0x46f902[_0xc3f8('0x36')]);attachment['create']({'name':path[_0xc3f8('0x37')](_0x2e4880[_0xc3f8('0x2e')])[_0xc3f8('0x21')],'basename':path[_0xc3f8('0x37')](_0x2e4880[_0xc3f8('0x2e')])[_0xc3f8('0x21')]+_0xc3f8('0x38'),'type':_0xc3f8('0x39')})[_0xc3f8('0x3a')](function(_0x166097){faxAccount[_0xc3f8('0x3b')](_0x502293,{'from':_0x2e4880['calleridnum'],'mapKey':_0xc3f8('0x3c'),'body':path[_0xc3f8('0x37')](_0x2e4880['filename'])[_0xc3f8('0x21')]+_0xc3f8('0x38'),'AttachmentId':_0x166097['id']})[_0xc3f8('0x3d')](function(_0x425981){logger['error'](_0x2e4880['uniqueid'],_0xc3f8('0x3e'),JSON[_0xc3f8('0x3f')](_0x425981));});})[_0xc3f8('0x3d')](function(_0x5c08a9){logger[_0xc3f8('0x40')](_0x2e4880[_0xc3f8('0x1f')],_0xc3f8('0x41'),JSON[_0xc3f8('0x3f')](_0x5c08a9));});});}logger[_0xc3f8('0x22')](_0x2e4880['uniqueid'],_0xc3f8('0x41'));}};Fax[_0xc3f8('0x24')]['syncOriginateResponse']=function(_0x1becae){if(this[_0xc3f8('0xd')][_0x1becae[_0xc3f8('0x1f')]]){_[_0xc3f8('0x42')](this[_0xc3f8('0xa')][_0x1becae[_0xc3f8('0x1f')]],_[_0xc3f8('0x43')](_0x1becae,['response',_0xc3f8('0x44')]));}};function updateStatus(_0x257be1){if(_0x257be1['AttachmentId']){faxMessage[_0xc3f8('0x45')](_0x257be1[_0xc3f8('0x46')],{'failMessage':_0xc3f8('0x47')})[_0xc3f8('0x3a')](function(_0x2b0e33){ut[_0xc3f8('0x48')](_0xc3f8('0x49'),_0x2b0e33);})['catch'](function(_0x36c09a){ut[_0xc3f8('0x48')](_0xc3f8('0x4a'),_0x36c09a);});}else{ut[_0xc3f8('0x48')](_0xc3f8('0x4b'));}}Fax[_0xc3f8('0x24')][_0xc3f8('0x4c')]=function(_0x920f4b,_0x4fc02c,_0x51249a){var _0x30cec2=this;var _0x206a57={};if(_0x4fc02c){_0x206a57={'read':_0x4fc02c};}else{_0x206a57={'failMessage':_0x51249a};}if(this['actions'][_0x920f4b]['AttachmentId']){faxMessage[_0xc3f8('0x45')](this['actions'][_0x920f4b][_0xc3f8('0x46')],_0x206a57)[_0xc3f8('0x3a')](function(_0x1d95f5){ut['logger'](_0xc3f8('0x4d'),_0x1d95f5);})['catch'](function(_0x4d8436){ut[_0xc3f8('0x48')]('[Fax][Message][NoUpdate1]',_0x4d8436);})[_0xc3f8('0x4e')](function(){delete _0x30cec2[_0xc3f8('0xa')][_0x920f4b];delete _0x30cec2[_0xc3f8('0xd')][_0x920f4b];});}else{ut['logger'](_0xc3f8('0x4f'));delete this[_0xc3f8('0xa')][_0x920f4b];delete this[_0xc3f8('0xd')][_0x920f4b];}};Fax[_0xc3f8('0x24')][_0xc3f8('0x1a')]=function(_0x4e9e22){var _0x5ced29=this;if(this[_0xc3f8('0xa')][_0x4e9e22[_0xc3f8('0x1f')]]){if(this[_0xc3f8('0xd')][_0x4e9e22[_0xc3f8('0x1f')]]){this[_0xc3f8('0xa')][_0x4e9e22['uniqueid']]['id']=this[_0xc3f8('0xd')][_0x4e9e22['uniqueid']]['id'];this[_0xc3f8('0xa')][_0x4e9e22[_0xc3f8('0x1f')]][_0xc3f8('0x21')]=this[_0xc3f8('0xd')][_0x4e9e22['uniqueid']][_0xc3f8('0x21')];}logger['info'](_0x4e9e22['uniqueid'],this['actions'][_0x4e9e22['uniqueid']]?_0xc3f8('0x50'):_0xc3f8('0x51'),JSON[_0xc3f8('0x3f')](this[_0xc3f8('0xa')][_0x4e9e22[_0xc3f8('0x1f')]]));if(this[_0xc3f8('0xd')][_0x4e9e22[_0xc3f8('0x1f')]]){if(this[_0xc3f8('0xa')][_0x4e9e22['uniqueid']][_0xc3f8('0x52')]>0x0&&this[_0xc3f8('0xa')][_0x4e9e22[_0xc3f8('0x1f')]][_0xc3f8('0x15')]===_0xc3f8('0x53')){this['updateStatus'](_0x4e9e22[_0xc3f8('0x1f')],!![]);}else{this[_0xc3f8('0x4c')](_0x4e9e22[_0xc3f8('0x1f')],![],this[_0xc3f8('0xa')][_0x4e9e22[_0xc3f8('0x1f')]]['faxstatusstring']?_0xc3f8('0x54')+this[_0xc3f8('0xa')][_0x4e9e22[_0xc3f8('0x1f')]][_0xc3f8('0x55')]:_0xc3f8('0x56'));}}}};Fax[_0xc3f8('0x24')]['send']=function(_0x2f199d){var _0x4ca426=this;return new BPromise(function(_0x9c7956,_0x5e3f96){_0x4ca426[_0xc3f8('0x57')](_0x2f199d,_0x4ca426[_0xc3f8('0xb')][_0x2f199d['FaxAccountId']])['then'](function(_0xbe23b2){ut[_0xc3f8('0x48')]('[Fax][execOriginate][success]',_0xbe23b2);_0x9c7956(ut[_0xc3f8('0x36')](_0xc3f8('0x58')));})[_0xc3f8('0x3d')](function(_0x44e105){ut[_0xc3f8('0x48')](_0xc3f8('0x59'),_0x44e105);updateStatus(_0x2f199d);_0x5e3f96(ut[_0xc3f8('0x36')](_0xc3f8('0x5a')));});});};Fax['prototype']['checkAfterSend']=function(_0x228920){var _0x5cd8b4=this;return new BPromise(function(_0x4a1cf5,_0x4a8a41){var _0x504f01=_0x5cd8b4['checkTrunk'](_0x5cd8b4[_0xc3f8('0xb')][_0x228920[_0xc3f8('0x5b')]][_0xc3f8('0x5c')],_0x228920);if(_0x504f01[_0xc3f8('0x5d')]){_0x4a1cf5(ut['message'](_0xc3f8('0x5e')));}else{_0x4a8a41(ut[_0xc3f8('0x36')](_0x504f01['message']));}});};function originate(_0x3b9b47,_0x273faf,_0x104eec){return new BPromise(function(_0x531de8,_0xaedf89){if(_0x104eec){var _0x5e3125=util['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[_0xc3f8('0x37')](_0x3b9b47[_0xc3f8('0x3')])['name'],_0x3b9b47[_0xc3f8('0x3')]);gs[_0xc3f8('0x5f')](_0x5e3125)['then'](function(){_0x3b9b47[_0xc3f8('0x3')]=util[_0xc3f8('0x60')]('%s/%s.tif',path[_0xc3f8('0x37')](_0x3b9b47['path'])[_0xc3f8('0x61')],path[_0xc3f8('0x37')](_0x3b9b47['path'])['name']);_0x273faf[_0xc3f8('0x62')]=_0x3b9b47[_0xc3f8('0x3')];ut['logger'](_0xc3f8('0x63'),'');ami['Action'](ut[_0xc3f8('0x64')](_0x3b9b47,_0x273faf))['then'](function(_0x280e74){_0x531de8(_0x280e74);})[_0xc3f8('0x3d')](function(_0x2795d4){_0xaedf89(_0x2795d4);});})[_0xc3f8('0x3d')](function(_0x3042b3){_0xaedf89(_0x3042b3);});}else{ami[_0xc3f8('0x65')](ut[_0xc3f8('0x64')](_0x3b9b47,_0x273faf))[_0xc3f8('0x3a')](function(_0x3f0083){_0x531de8(_0x3f0083);})['catch'](function(_0x2bf08b){_0xaedf89(_0x2bf08b);});}});}Fax[_0xc3f8('0x24')][_0xc3f8('0x57')]=function(_0x26b994,_0x3c321d){var _0x5e3c9d=this;return new BPromise(function(_0x5c4115,_0x2609ff){var _0x1d3212=uuid['v4']();var _0x1e8685=ut[_0xc3f8('0x66')](_0x26b994,_0x3c321d);_0x5e3c9d['actions'][_0x1d3212]=new Action(_0x1d3212,_0x3c321d,_0x26b994);var _0x2f69f7=_0x5e3c9d[_0xc3f8('0xd')][_0x1d3212];if(path[_0xc3f8('0x37')](_0x26b994['path'])['ext']===_0xc3f8('0x38')){originate(_0x2f69f7,_0x1e8685,!![])[_0xc3f8('0x3a')](function(_0x1a9c33){_0x5c4115(_0x1a9c33);})[_0xc3f8('0x3d')](function(_0x4b9b3b){_0x2609ff(_0x4b9b3b);});}else{originate(_0x2f69f7,_0x1e8685,![])[_0xc3f8('0x3a')](function(_0x2a5711){_0x5c4115(_0x2a5711);})[_0xc3f8('0x3d')](function(_0x5f1fbb){_0x2609ff(_0x5f1fbb);});}});};Fax[_0xc3f8('0x24')][_0xc3f8('0x67')]=function(_0x4bb10a){return!_['isNil'](_0x4bb10a)&&!_[_0xc3f8('0x68')](_0x4bb10a[_0xc3f8('0x21')])&&!_['isNil'](_0x4bb10a[_0xc3f8('0x69')])&&_0x4bb10a[_0xc3f8('0x69')]&&!_['isNil'](this[_0xc3f8('0xc')][util['format'](_0xc3f8('0x6a'),_0x4bb10a['name'])])&&!_[_0xc3f8('0x68')](this[_0xc3f8('0xc')][util[_0xc3f8('0x60')](_0xc3f8('0x6a'),_0x4bb10a[_0xc3f8('0x21')])][_0xc3f8('0x2c')])&&(this[_0xc3f8('0xc')][util[_0xc3f8('0x60')](_0xc3f8('0x6a'),_0x4bb10a['name'])]['status']===_0xc3f8('0x6b')||this['trunks'][util[_0xc3f8('0x60')](_0xc3f8('0x6a'),_0x4bb10a[_0xc3f8('0x21')])][_0xc3f8('0x2c')]==='unmonitored');};Fax[_0xc3f8('0x24')][_0xc3f8('0x6c')]=function(_0x18f9f4,_0xb33986){if(!this[_0xc3f8('0x67')](_0x18f9f4)){ut[_0xc3f8('0x48')](_0xc3f8('0x6d'),_[_0xc3f8('0x68')](_0x18f9f4)?'':_0x18f9f4[_0xc3f8('0x21')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xc3f8('0x68')](_0xb33986[_0xc3f8('0x3c')])){ut[_0xc3f8('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xc3f8('0x3f')](_0xb33986));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xc3f8('0x68')](_0xb33986['path'])){ut[_0xc3f8('0x48')](_0xc3f8('0x6e'),JSON[_0xc3f8('0x3f')](_0xb33986));return{'isValid':![],'message':_0xc3f8('0x6f')};}return{'isValid':!![],'message':_0xc3f8('0x70')};};module[_0xc3f8('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index e928a90..5818f47 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 _0x7244=['then','notify','catch','[Notify]\x20','util','bluebird','lodash'];(function(_0x416bed,_0x276cbd){var _0x4a6935=function(_0x275aeb){while(--_0x275aeb){_0x416bed['push'](_0x416bed['shift']());}};_0x4a6935(++_0x276cbd);}(_0x7244,0x1e0));var _0x4724=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7244[_0x57b54c];return _0x59cc19;};'use strict';var util=require(_0x4724('0x0'));var BPromise=require(_0x4724('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x4724('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x367b05){return function(_0x55980a){logger['error'](_0x367b05,util['inspect'](_0x55980a,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x19a5e3,_0x571cb3){return BPromise['resolve']()[_0x4724('0x3')](faxAccount[_0x4724('0x4')](_0x19a5e3,_0x571cb3))[_0x4724('0x5')](loggerCatch(_0x4724('0x6')));}; \ No newline at end of file +var _0x1438=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','catch'];(function(_0x4f59a9,_0x5d3392){var _0x1faad8=function(_0x57db09){while(--_0x57db09){_0x4f59a9['push'](_0x4f59a9['shift']());}};_0x1faad8(++_0x5d3392);}(_0x1438,0x6f));var _0x8143=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1438[_0x5d2803];return _0xdcad2c;};'use strict';var util=require(_0x8143('0x0'));var BPromise=require(_0x8143('0x1'));var logger=require(_0x8143('0x2'))(_0x8143('0x3'));var _=require(_0x8143('0x4'));var faxAccount=require(_0x8143('0x5'));function loggerCatch(_0x2d9e1b){return function(_0x565d76){logger[_0x8143('0x6')](_0x2d9e1b,util[_0x8143('0x7')](_0x565d76,{'showHidden':![],'depth':null}));};}exports[_0x8143('0x8')]=function(_0x3b5df0,_0x46c60c){return BPromise['resolve']()['then'](faxAccount['notify'](_0x3b5df0,_0x46c60c))[_0x8143('0x9')](loggerCatch(_0x8143('0xa')));}; \ 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 ddb2ec6..12e9e64 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 _0x29d7=['child_process','exec','info','Exec\x20gs','util','../../../../config/logger','fax','bluebird'];(function(_0x45722d,_0x485dd9){var _0x29809b=function(_0x5f5058){while(--_0x5f5058){_0x45722d['push'](_0x45722d['shift']());}};_0x29809b(++_0x485dd9);}(_0x29d7,0x18c));var _0x729d=function(_0x59b1de,_0x5e5b75){_0x59b1de=_0x59b1de-0x0;var _0x5563a9=_0x29d7[_0x59b1de];return _0x5563a9;};'use strict';var util=require(_0x729d('0x0'));var logger=require(_0x729d('0x1'))(_0x729d('0x2'));var BPromise=require(_0x729d('0x3'));var exec=require(_0x729d('0x4'))[_0x729d('0x5')];exports['execute']=function(_0x32decf){return new BPromise(function(_0xc71d56,_0x3284da){exec(_0x32decf,function(_0x503bf3,_0x1d4ff9,_0x18c291){logger[_0x729d('0x6')](_0x729d('0x7'),_0x1d4ff9);if(_0x503bf3){logger[_0x729d('0x6')](_0x729d('0x7'),'\x20Error\x20:',util['inspect'](_0x503bf3,{'showHidden':![],'depth':null}),_0x1d4ff9,_0x18c291);_0x3284da(_0x503bf3);}_0xc71d56(_0x1d4ff9);});});}; \ No newline at end of file +var _0x3c73=['\x20Error\x20:','util','../../../../config/logger','bluebird','exec','execute','info','Exec\x20gs'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x3c73,0x1c9));var _0x33c7=function(_0x11af17,_0x428f0d){_0x11af17=_0x11af17-0x0;var _0x50f641=_0x3c73[_0x11af17];return _0x50f641;};'use strict';var util=require(_0x33c7('0x0'));var logger=require(_0x33c7('0x1'))('fax');var BPromise=require(_0x33c7('0x2'));var exec=require('child_process')[_0x33c7('0x3')];exports[_0x33c7('0x4')]=function(_0x3d0fa4){return new BPromise(function(_0x19ff54,_0xede71a){exec(_0x3d0fa4,function(_0x2bfa9e,_0xb112f5,_0x51ccd2){logger[_0x33c7('0x5')](_0x33c7('0x6'),_0xb112f5);if(_0x2bfa9e){logger[_0x33c7('0x5')](_0x33c7('0x6'),_0x33c7('0x7'),util['inspect'](_0x2bfa9e,{'showHidden':![],'depth':null}),_0xb112f5,_0x51ccd2);_0xede71a(_0x2bfa9e);}_0x19ff54(_0xb112f5);});});}; \ 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 6a94dee..d127d48 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 _0x5ff5=['channel','headerinfo','util','lodash','moment','fax','message','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate'];(function(_0x496f17,_0x2d3f9b){var _0x40b3a2=function(_0x21439f){while(--_0x21439f){_0x496f17['push'](_0x496f17['shift']());}};_0x40b3a2(++_0x2d3f9b);}(_0x5ff5,0x1ce));var _0x55ff=function(_0x2f8591,_0x743fcb){_0x2f8591=_0x2f8591-0x0;var _0xa527e6=_0x5ff5[_0x2f8591];return _0xa527e6;};'use strict';var util=require(_0x55ff('0x0'));var _=require(_0x55ff('0x1'));var moment=require(_0x55ff('0x2'));var logger=require('../../../../config/logger')(_0x55ff('0x3'));exports[_0x55ff('0x4')]=function(_0x1d2a28){return{'message':_0x1d2a28};};exports['logger']=function(_0x38b2d8,_0x5b0e67){logger[_0x55ff('0x5')](_0x38b2d8,util[_0x55ff('0x6')](_0x5b0e67,{'showHidden':![],'depth':null}));};exports[_0x55ff('0x7')]=function(_0x1397b6,_0x46398e){var _0x55f84e={'XMF-ECM':_0x46398e[_0x55ff('0x8')],'XMF-HEADERINFO':_0x46398e['headerinfo'],'XMF-MINRATE':_0x46398e[_0x55ff('0x9')],'XMF-MAXRATE':_0x46398e[_0x55ff('0xa')],'XMF-MODEM':util[_0x55ff('0xb')](_0x55ff('0xc'),_0x46398e[_0x55ff('0xd')]),'XMF-GATEWAY':_0x46398e['gateway'],'XMF-FAXDETECT':_0x46398e[_0x55ff('0xe')],'XMF-T38TIMEOUT':_0x46398e[_0x55ff('0xf')],'XMF-LOCALSTATIONID':_0x46398e[_0x55ff('0x10')],'XMF-PATH':_0x1397b6[_0x55ff('0x11')]};return _0x55f84e;};exports[_0x55ff('0x12')]=function(_0x4b4f2c,_0x135d9e){return{'actionid':_0x4b4f2c[_0x55ff('0x13')],'action':_0x55ff('0x14'),'channel':_0x4b4f2c[_0x55ff('0x15')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x4b4f2c['headerinfo']?_0x4b4f2c[_0x55ff('0x16')]:'',_0x4b4f2c[_0x55ff('0x10')]),'variable':_0x135d9e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4b4f2c[_0x55ff('0x13')]};}; \ No newline at end of file +var _0x354a=['originate','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','uniqueid','lodash','../../../../config/logger','fax','message','info','inspect','ecm','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction'];(function(_0x45a795,_0x41e642){var _0x2db592=function(_0x43dd36){while(--_0x43dd36){_0x45a795['push'](_0x45a795['shift']());}};_0x2db592(++_0x41e642);}(_0x354a,0xd6));var _0xa354=function(_0x5c110f,_0x3c4bd8){_0x5c110f=_0x5c110f-0x0;var _0x5ebfc5=_0x354a[_0x5c110f];return _0x5ebfc5;};'use strict';var util=require('util');var _=require(_0xa354('0x0'));var moment=require('moment');var logger=require(_0xa354('0x1'))(_0xa354('0x2'));exports[_0xa354('0x3')]=function(_0x18136e){return{'message':_0x18136e};};exports['logger']=function(_0x522622,_0x3c2664){logger[_0xa354('0x4')](_0x522622,util[_0xa354('0x5')](_0x3c2664,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2bfc3c,_0x3c10d8){var _0x4479c1={'XMF-ECM':_0x3c10d8[_0xa354('0x6')],'XMF-HEADERINFO':_0x3c10d8['headerinfo'],'XMF-MINRATE':_0x3c10d8[_0xa354('0x7')],'XMF-MAXRATE':_0x3c10d8[_0xa354('0x8')],'XMF-MODEM':util['format'](_0xa354('0x9'),_0x3c10d8[_0xa354('0xa')]),'XMF-GATEWAY':_0x3c10d8[_0xa354('0xb')],'XMF-FAXDETECT':_0x3c10d8[_0xa354('0xc')],'XMF-T38TIMEOUT':_0x3c10d8['t38timeout'],'XMF-LOCALSTATIONID':_0x3c10d8[_0xa354('0xd')],'XMF-PATH':_0x2bfc3c[_0xa354('0xe')]};return _0x4479c1;};exports[_0xa354('0xf')]=function(_0x22c990,_0xeeb9b9){return{'actionid':_0x22c990['uniqueid'],'action':_0xa354('0x10'),'channel':_0x22c990['channel'],'Exten':_0xa354('0x11'),'Context':_0xa354('0x12'),'Priority':'1','callerid':util[_0xa354('0x13')](_0xa354('0x14'),_0x22c990[_0xa354('0x15')]?_0x22c990[_0xa354('0x15')]:'',_0x22c990[_0xa354('0xd')]),'variable':_0xeeb9b9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x22c990[_0xa354('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 43d4745..2164683 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 _0x951e=['initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','bluebird','util','./report','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','getVoiceQueueReports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x951e,0x96));var _0xe951=function(_0x262a91,_0x4d3739){_0x262a91=_0x262a91-0x0;var _0x5dcb6b=_0x951e[_0x262a91];return _0x5dcb6b;};'use strict';var BPromise=require(_0xe951('0x0'));var util=require(_0xe951('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xe951('0x2'));var Acw=require(_0xe951('0x3'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0xe951('0x4'));var Fax=require(_0xe951('0x5'));var user=require(_0xe951('0x6'));var voiceQueue=require(_0xe951('0x7'));var voiceQueueReport=require(_0xe951('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xe951('0x9'));var template=require(_0xe951('0xa'));var cmHopperHistory=require(_0xe951('0xb'));var campaign=require(_0xe951('0xc'));var voiceExtension=require(_0xe951('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe951('0xe'));var salesforce=require(_0xe951('0xf'));var sugarcrm=require(_0xe951('0x10'));var freshdesk=require(_0xe951('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xe951('0x12'));var vtiger=require(_0xe951('0x13'));var freshsales=require(_0xe951('0x14'));var servicenow=require(_0xe951('0x15'));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(_0xe951('0x16'))(_0xe951('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xe951('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xe951('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe951('0x19')]()[_0xe951('0x1a')](user[_0xe951('0x1b')]())[_0xe951('0x1a')](realtime[_0xe951('0x1c')]())[_0xe951('0x1a')](user['getTelephones']())[_0xe951('0x1a')](realtime[_0xe951('0x1d')]())[_0xe951('0x1a')](trunk['getTrunks']())[_0xe951('0x1a')](realtime[_0xe951('0x1e')]())['then'](voiceQueue[_0xe951('0x1f')]())['then'](realtime[_0xe951('0x20')]())['then'](trigger['getTriggers']())[_0xe951('0x1a')](realtime[_0xe951('0x21')]())[_0xe951('0x1a')](template[_0xe951('0x22')]())[_0xe951('0x1a')](realtime[_0xe951('0x23')]())[_0xe951('0x1a')](zendesk[_0xe951('0x24')]())['then'](realtime[_0xe951('0x25')]())[_0xe951('0x1a')](salesforce[_0xe951('0x26')]())['then'](realtime[_0xe951('0x27')]())[_0xe951('0x1a')](sugarcrm[_0xe951('0x28')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xe951('0x29')]())[_0xe951('0x1a')](realtime[_0xe951('0x2a')]())[_0xe951('0x1a')](desk[_0xe951('0x2b')]())[_0xe951('0x1a')](realtime[_0xe951('0x2c')]())[_0xe951('0x1a')](zoho[_0xe951('0x2d')]())[_0xe951('0x1a')](realtime[_0xe951('0x2e')]())[_0xe951('0x1a')](vtiger[_0xe951('0x2f')]())[_0xe951('0x1a')](realtime['initVtigerAccounts']())[_0xe951('0x1a')](freshsales[_0xe951('0x30')]())[_0xe951('0x1a')](realtime[_0xe951('0x31')]())[_0xe951('0x1a')](servicenow['getServicenowAccounts']())[_0xe951('0x1a')](realtime[_0xe951('0x32')]())['then'](dynamics365[_0xe951('0x33')]())[_0xe951('0x1a')](realtime[_0xe951('0x34')]())[_0xe951('0x1a')](campaign[_0xe951('0x35')]())[_0xe951('0x1a')](realtime['initCampaigns']())['then'](voiceExtension[_0xe951('0x36')]())['then'](realtime['initVoiceExtensions']())['then'](faxAccount[_0xe951('0x37')]())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xe951('0x1a')](voiceQueueReport[_0xe951('0x38')]())[_0xe951('0x1a')](realtime[_0xe951('0x39')]())[_0xe951('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xe951('0x1a')](realtime[_0xe951('0x3a')]())[_0xe951('0x1a')](cmHopperHistory[_0xe951('0x3b')]())[_0xe951('0x1a')](realtime[_0xe951('0x3c')]())[_0xe951('0x1a')](voiceCallReport[_0xe951('0x3d')]())[_0xe951('0x1a')](realtime[_0xe951('0x3e')]())[_0xe951('0x3f')](function(_0x181f6a){logger[_0xe951('0x40')](_0xe951('0x41'),util[_0xe951('0x42')](_0x181f6a,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe951('0x43')](realtime,preview,fax)[_0xe951('0x1a')](function(_0x3367b3){return initRealtime();})[_0xe951('0x1a')](function(){return initParams();})[_0xe951('0x1a')](function(){report[_0xe951('0x44')]();setInterval(initRealtime,0x1388);})[_0xe951('0x3f')](function(_0x3de501){logger[_0xe951('0x40')]('[index.js][main]',util[_0xe951('0x42')](_0x3de501,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x90cf=['./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','then','getAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','catch','[index.js][main]','bluebird','util','./server','./realtime','./report','./trigger','./dialer','./preview'];(function(_0x53c944,_0x327afa){var _0x237bdf=function(_0x133563){while(--_0x133563){_0x53c944['push'](_0x53c944['shift']());}};_0x237bdf(++_0x327afa);}(_0x90cf,0xca));var _0xf90c=function(_0x415f6c,_0x43e569){_0x415f6c=_0x415f6c-0x0;var _0x9bd08=_0x90cf[_0x415f6c];return _0x9bd08;};'use strict';var BPromise=require(_0xf90c('0x0'));var util=require(_0xf90c('0x1'));var moment=require('moment');var server=require(_0xf90c('0x2'));var Realtime=require(_0xf90c('0x3'));var Report=require(_0xf90c('0x4'));var Acw=require('./acw');var Trigger=require(_0xf90c('0x5'));var Dialer=require(_0xf90c('0x6'));var Preview=require(_0xf90c('0x7'));var Fax=require(_0xf90c('0x8'));var user=require(_0xf90c('0x9'));var voiceQueue=require(_0xf90c('0xa'));var voiceQueueReport=require(_0xf90c('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xf90c('0xc'));var template=require(_0xf90c('0xd'));var cmHopperHistory=require(_0xf90c('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf90c('0xf'));var zendesk=require(_0xf90c('0x10'));var salesforce=require(_0xf90c('0x11'));var sugarcrm=require(_0xf90c('0x12'));var freshdesk=require(_0xf90c('0x13'));var desk=require(_0xf90c('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xf90c('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xf90c('0x16'));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(_0xf90c('0x17'))(_0xf90c('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xf90c('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf90c('0x1a')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xf90c('0x1b')](user[_0xf90c('0x1c')]())[_0xf90c('0x1b')](realtime['initAgents']())[_0xf90c('0x1b')](user[_0xf90c('0x1d')]())[_0xf90c('0x1b')](realtime['initTelephones']())[_0xf90c('0x1b')](trunk[_0xf90c('0x1e')]())['then'](realtime[_0xf90c('0x1f')]())['then'](voiceQueue['getVoiceQueues']())[_0xf90c('0x1b')](realtime[_0xf90c('0x20')]())['then'](trigger['getTriggers']())[_0xf90c('0x1b')](realtime[_0xf90c('0x21')]())[_0xf90c('0x1b')](template[_0xf90c('0x22')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x23')]())[_0xf90c('0x1b')](zendesk[_0xf90c('0x24')]())[_0xf90c('0x1b')](realtime['initZendeskAccounts']())[_0xf90c('0x1b')](salesforce[_0xf90c('0x25')]())['then'](realtime[_0xf90c('0x26')]())['then'](sugarcrm[_0xf90c('0x27')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x28')]())[_0xf90c('0x1b')](freshdesk[_0xf90c('0x29')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x2a')]())[_0xf90c('0x1b')](desk['getDeskAccounts']())[_0xf90c('0x1b')](realtime[_0xf90c('0x2b')]())[_0xf90c('0x1b')](zoho[_0xf90c('0x2c')]())[_0xf90c('0x1b')](realtime['initZohoAccounts']())[_0xf90c('0x1b')](vtiger[_0xf90c('0x2d')]())['then'](realtime[_0xf90c('0x2e')]())[_0xf90c('0x1b')](freshsales[_0xf90c('0x2f')]())['then'](realtime[_0xf90c('0x30')]())[_0xf90c('0x1b')](servicenow['getServicenowAccounts']())['then'](realtime[_0xf90c('0x31')]())['then'](dynamics365[_0xf90c('0x32')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x33')]())[_0xf90c('0x1b')](campaign['getCampaigns']())[_0xf90c('0x1b')](realtime[_0xf90c('0x34')]())['then'](voiceExtension[_0xf90c('0x35')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x36')]())[_0xf90c('0x1b')](faxAccount['getFaxAccounts']())['then'](realtime[_0xf90c('0x37')]())[_0xf90c('0x1b')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xf90c('0x1b')](voiceQueueReport[_0xf90c('0x38')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x39')]())[_0xf90c('0x1b')](cmHopperHistory[_0xf90c('0x3a')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x3b')]())[_0xf90c('0x1b')](cmHopperHistory[_0xf90c('0x3c')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x3d')]())[_0xf90c('0x1b')](voiceCallReport[_0xf90c('0x3e')]())[_0xf90c('0x1b')](realtime[_0xf90c('0x3f')]())['catch'](function(_0x4841f1){logger[_0xf90c('0x40')](_0xf90c('0x41'),util[_0xf90c('0x42')](_0x4841f1,{'showHidden':![],'depth':null}));});}function main(){return server[_0xf90c('0x43')](realtime,preview,fax)[_0xf90c('0x1b')](function(_0x27cd9c){return initRealtime();})[_0xf90c('0x1b')](function(){return initParams();})[_0xf90c('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xf90c('0x44')](function(_0xa457e0){logger[_0xf90c('0x40')](_0xf90c('0x45'),util[_0xf90c('0x42')](_0xa457e0,{'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 3243b49..51fbc8d 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x471f8f,_0x2eaaf8){var _0x31da61=function(_0x44d464){while(--_0x44d464){_0x471f8f['push'](_0x471f8f['shift']());}};_0x31da61(++_0x2eaaf8);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x93f202,_0x5d01a6){var _0x3fe427=function(_0x5215d1){while(--_0x5215d1){_0x93f202['push'](_0x93f202['shift']());}};_0x3fe427(++_0x5d01a6);}(_0xe706,0xa3));var _0x6e70=function(_0x8ae836,_0x5735d7){_0x8ae836=_0x8ae836-0x0;var _0x2f9136=_0xe706[_0x8ae836];return _0x2f9136;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 656a03b..a6842cc 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 _0xb93e=['message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays'];(function(_0x461f53,_0x449810){var _0x24a3c9=function(_0x4976a0){while(--_0x4976a0){_0x461f53['push'](_0x461f53['shift']());}};_0x24a3c9(++_0x449810);}(_0xb93e,0x131));var _0xeb93=function(_0x56d9a1,_0x5dd052){_0x56d9a1=_0x56d9a1-0x0;var _0x2280b5=_0xb93e[_0x56d9a1];return _0x2280b5;};'use strict';function Campaign(_0x5aed83){this['id']=_0x5aed83['id']||0x0;this['name']=_0x5aed83[_0xeb93('0x0')]||'';this['type']=_0x5aed83[_0xeb93('0x1')]||_0xeb93('0x2');this[_0xeb93('0x3')]=0x0;this[_0xeb93('0x4')]=0x0;this[_0xeb93('0x5')]=0x0;this[_0xeb93('0x6')]=0x0;this[_0xeb93('0x7')]='';this[_0xeb93('0x8')]=!![];this[_0xeb93('0x9')]=_0x5aed83[_0xeb93('0x9')];this[_0xeb93('0xa')]=_0x5aed83[_0xeb93('0xa')];this[_0xeb93('0xb')]=_0x5aed83[_0xeb93('0xb')]||null;this[_0xeb93('0xc')]=_0x5aed83[_0xeb93('0xc')]?_0x5aed83[_0xeb93('0xc')]:null;this[_0xeb93('0xd')]=_0x5aed83[_0xeb93('0xd')];this[_0xeb93('0xe')]=_0x5aed83[_0xeb93('0xe')];this[_0xeb93('0xf')]=_0x5aed83[_0xeb93('0xf')]||0x1e;this[_0xeb93('0x10')]=_0x5aed83[_0xeb93('0x10')];this[_0xeb93('0x11')]=_0x5aed83[_0xeb93('0x11')];this['dialBusyMaxRetry']=_0x5aed83['dialBusyMaxRetry'];this[_0xeb93('0x12')]=_0x5aed83['dialBusyRetryFrequency'];this[_0xeb93('0x13')]=_0x5aed83[_0xeb93('0x13')];this[_0xeb93('0x14')]=_0x5aed83['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x5aed83[_0xeb93('0x15')];this[_0xeb93('0x16')]=_0x5aed83[_0xeb93('0x16')]||0x3;this[_0xeb93('0x17')]=_0x5aed83[_0xeb93('0x17')]||0x96;this['dialDropMaxRetry']=_0x5aed83[_0xeb93('0x18')]||0x3;this[_0xeb93('0x19')]=_0x5aed83[_0xeb93('0x19')]||0x96;this[_0xeb93('0x1a')]=_0x5aed83[_0xeb93('0x1a')]||0x3;this[_0xeb93('0x1b')]=_0x5aed83[_0xeb93('0x1b')]||0x96;this[_0xeb93('0x1c')]=_0x5aed83[_0xeb93('0x1c')]||0x3;this[_0xeb93('0x1d')]=_0x5aed83[_0xeb93('0x1d')]||0x96;this[_0xeb93('0x1e')]=_0x5aed83[_0xeb93('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5aed83[_0xeb93('0x1f')]||0x96;this[_0xeb93('0x20')]=_0x5aed83[_0xeb93('0x20')]||_0xeb93('0x21');this[_0xeb93('0x22')]=_0x5aed83[_0xeb93('0x22')]||undefined;this[_0xeb93('0x23')]=_0x5aed83['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xeb93('0x24')]=_0x5aed83[_0xeb93('0x24')]||undefined;this['TrunkBackup']=_0x5aed83[_0xeb93('0x25')]?_0x5aed83[_0xeb93('0x25')]:undefined;this[_0xeb93('0x26')]=_0x5aed83[_0xeb93('0x26')]?_0x5aed83[_0xeb93('0x26')]:undefined;this['Interval']=_0x5aed83['Interval']?_0x5aed83[_0xeb93('0x27')]:undefined;this[_0xeb93('0x28')]=_0x5aed83[_0xeb93('0x28')]?_0x5aed83[_0xeb93('0x28')]:undefined;this[_0xeb93('0x29')]=_0x5aed83['SquareProject']?_0x5aed83[_0xeb93('0x28')]['name']:undefined;this[_0xeb93('0x2a')]=_0x5aed83['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x5aed83[_0xeb93('0x2b')];this[_0xeb93('0x2c')]=_0x5aed83[_0xeb93('0x2c')];this['dialAMDAfterGreetingSilence']=_0x5aed83[_0xeb93('0x2d')];this[_0xeb93('0x2e')]=_0x5aed83[_0xeb93('0x2e')];this['dialAMDMinWordLength']=_0x5aed83['dialAMDMinWordLength'];this[_0xeb93('0x2f')]=_0x5aed83[_0xeb93('0x2f')];this[_0xeb93('0x30')]=_0x5aed83['dialAMDMaximumNumberOfWords'];this[_0xeb93('0x31')]=_0x5aed83[_0xeb93('0x31')];this[_0xeb93('0x32')]=_0x5aed83[_0xeb93('0x32')];}module[_0xeb93('0x33')]=Campaign; \ No newline at end of file +var _0xb334=['type','ivrTotalCallsDays','sendMessageOneNotActive','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','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name'];(function(_0xf2acc0,_0x33a85a){var _0x383a9f=function(_0x1651dd){while(--_0x1651dd){_0xf2acc0['push'](_0xf2acc0['shift']());}};_0x383a9f(++_0x33a85a);}(_0xb334,0xbb));var _0x4b33=function(_0xf172b1,_0x121ecd){_0xf172b1=_0xf172b1-0x0;var _0x4a6e4e=_0xb334[_0xf172b1];return _0x4a6e4e;};'use strict';function Campaign(_0x267594){this['id']=_0x267594['id']||0x0;this[_0x4b33('0x0')]=_0x267594[_0x4b33('0x0')]||'';this[_0x4b33('0x1')]=_0x267594[_0x4b33('0x1')]||'campaign';this['originated']=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x4b33('0x2')]=0x0;this['message']='';this[_0x4b33('0x3')]=!![];this['active']=_0x267594['active'];this[_0x4b33('0x4')]=_0x267594[_0x4b33('0x4')];this['dialTimezone']=_0x267594[_0x4b33('0x5')]||null;this[_0x4b33('0x6')]=_0x267594['dialGlobalInterval']?_0x267594[_0x4b33('0x6')]:null;this[_0x4b33('0x7')]=_0x267594[_0x4b33('0x7')];this[_0x4b33('0x8')]=_0x267594[_0x4b33('0x8')];this[_0x4b33('0x9')]=_0x267594[_0x4b33('0x9')]||0x1e;this[_0x4b33('0xa')]=_0x267594[_0x4b33('0xa')];this[_0x4b33('0xb')]=_0x267594[_0x4b33('0xb')];this[_0x4b33('0xc')]=_0x267594[_0x4b33('0xc')];this[_0x4b33('0xd')]=_0x267594[_0x4b33('0xd')];this[_0x4b33('0xe')]=_0x267594['dialNoAnswerMaxRetry'];this[_0x4b33('0xf')]=_0x267594[_0x4b33('0xf')];this['dialGlobalMaxRetry']=_0x267594[_0x4b33('0x10')];this[_0x4b33('0x11')]=_0x267594[_0x4b33('0x11')]||0x3;this[_0x4b33('0x12')]=_0x267594['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x267594[_0x4b33('0x13')]||0x3;this[_0x4b33('0x14')]=_0x267594['dialDropRetryFrequency']||0x96;this[_0x4b33('0x15')]=_0x267594[_0x4b33('0x15')]||0x3;this[_0x4b33('0x16')]=_0x267594[_0x4b33('0x16')]||0x96;this[_0x4b33('0x17')]=_0x267594['dialMachineMaxRetry']||0x3;this[_0x4b33('0x18')]=_0x267594[_0x4b33('0x18')]||0x96;this['dialAgentRejectMaxRetry']=_0x267594[_0x4b33('0x19')]||0x3;this[_0x4b33('0x1a')]=_0x267594['dialAgentRejectRetryFrequency']||0x96;this[_0x4b33('0x1b')]=_0x267594[_0x4b33('0x1b')]||_0x4b33('0x1c');this[_0x4b33('0x1d')]=_0x267594['dialPrefix']||undefined;this[_0x4b33('0x1e')]=_0x267594[_0x4b33('0x1e')]||undefined;this[_0x4b33('0x1f')]=_0x267594['dialCutDigit']||undefined;this[_0x4b33('0x20')]=_0x267594['TrunkBackup']?_0x267594['TrunkBackup']:undefined;this[_0x4b33('0x21')]=_0x267594[_0x4b33('0x21')]?_0x267594[_0x4b33('0x21')]:undefined;this[_0x4b33('0x22')]=_0x267594[_0x4b33('0x22')]?_0x267594[_0x4b33('0x22')]:undefined;this['SquareProject']=_0x267594[_0x4b33('0x23')]?_0x267594[_0x4b33('0x23')]:undefined;this['dialQueueProject']=_0x267594[_0x4b33('0x23')]?_0x267594[_0x4b33('0x23')][_0x4b33('0x0')]:undefined;this[_0x4b33('0x24')]=_0x267594[_0x4b33('0x24')]||![];this[_0x4b33('0x25')]=_0x267594[_0x4b33('0x25')];this[_0x4b33('0x26')]=_0x267594[_0x4b33('0x26')];this['dialAMDAfterGreetingSilence']=_0x267594[_0x4b33('0x27')];this['dialAMDTotalAnalysisTime']=_0x267594[_0x4b33('0x28')];this[_0x4b33('0x29')]=_0x267594[_0x4b33('0x29')];this[_0x4b33('0x2a')]=_0x267594[_0x4b33('0x2a')];this['dialAMDMaximumNumberOfWords']=_0x267594[_0x4b33('0x2b')];this[_0x4b33('0x2c')]=_0x267594[_0x4b33('0x2c')];this[_0x4b33('0x2d')]=_0x267594[_0x4b33('0x2d')];}module[_0x4b33('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 82e9d6f..09e163f 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 _0x57ca=['endtime','unmanaged','abandoned','lastapplication','duration','holdtime','type','disposition','monitorFilename','queue','transfercalleridnum','transferType','mohtime','exports','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime'];(function(_0x103b46,_0x14f0ab){var _0x28a655=function(_0x398777){while(--_0x398777){_0x103b46['push'](_0x103b46['shift']());}};_0x28a655(++_0x14f0ab);}(_0x57ca,0x108));var _0xa57c=function(_0x49c088,_0x33ecac){_0x49c088=_0x49c088-0x0;var _0x1eea49=_0x57ca[_0x49c088];return _0x1eea49;};'use strict';function Channel(){this['starttime']=null;this[_0xa57c('0x0')]='';this[_0xa57c('0x1')]='';this['calleridnum']=0x0;this[_0xa57c('0x2')]='';this[_0xa57c('0x3')]=undefined;this[_0xa57c('0x4')]=undefined;this[_0xa57c('0x5')]=0x0;this[_0xa57c('0x6')]='';this['uniqueid']=0x0;this[_0xa57c('0x7')]=0x0;this[_0xa57c('0x8')]=0x0;this[_0xa57c('0x9')]=![];this[_0xa57c('0xa')]=null;this[_0xa57c('0xb')]=null;this[_0xa57c('0xc')]=![];this[_0xa57c('0xd')]=![];this[_0xa57c('0xe')]='';this['lastdata']='';this[_0xa57c('0xf')]=0x0;this['billableseconds']=0x0;this[_0xa57c('0x10')]=0x0;this[_0xa57c('0x11')]=null;this['tag']=null;this[_0xa57c('0x12')]=null;this['monitor']=![];this[_0xa57c('0x13')]=null;this[_0xa57c('0x14')]=null;this['monitors']=[];this[_0xa57c('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xa57c('0x16')]=undefined;this[_0xa57c('0x17')]=0x0;}module[_0xa57c('0x18')]=Channel; \ No newline at end of file +var _0xeec6=['calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','tag','monitor','monitorFilename','queue','transferType','starttime'];(function(_0x1aa660,_0x55cfcf){var _0x56b6f5=function(_0x54d875){while(--_0x54d875){_0x1aa660['push'](_0x1aa660['shift']());}};_0x56b6f5(++_0x55cfcf);}(_0xeec6,0x125));var _0x6eec=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xeec6[_0x4bb66f];return _0xf2772f;};'use strict';function Channel(){this[_0x6eec('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x6eec('0x1')]=0x0;this[_0x6eec('0x2')]='';this[_0x6eec('0x3')]=undefined;this[_0x6eec('0x4')]=undefined;this['accountcode']=0x0;this[_0x6eec('0x5')]='';this[_0x6eec('0x6')]=0x0;this['linkedid']=0x0;this[_0x6eec('0x7')]=0x0;this[_0x6eec('0x8')]=![];this['answertime']=null;this[_0x6eec('0x9')]=null;this[_0x6eec('0xa')]=![];this[_0x6eec('0xb')]=![];this[_0x6eec('0xc')]='';this['lastdata']='';this[_0x6eec('0xd')]=0x0;this[_0x6eec('0xe')]=0x0;this[_0x6eec('0xf')]=0x0;this['type']=null;this[_0x6eec('0x10')]=null;this['disposition']=null;this[_0x6eec('0x11')]=![];this[_0x6eec('0x12')]=null;this[_0x6eec('0x13')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x6eec('0x14')]=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 751aa6b..20d043b 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 _0x7401=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7401,0x14f));var _0x1740=function(_0x5ebe67,_0x3a80ff){_0x5ebe67=_0x5ebe67-0x0;var _0x229ca0=_0x7401[_0x5ebe67];return _0x229ca0;};'use strict';function DeskAccount(_0xea77b7){this['id']=_0xea77b7['id']||0x0;this['name']=_0xea77b7[_0x1740('0x0')]||'';this['username']=_0xea77b7[_0x1740('0x1')]||'';this[_0x1740('0x2')]=_0xea77b7[_0x1740('0x2')]||'';this[_0x1740('0x3')]=_0xea77b7[_0x1740('0x3')]||'';this[_0x1740('0x4')]=_0xea77b7['password']||'';this[_0x1740('0x5')]=_0xea77b7[_0x1740('0x5')]||'';this[_0x1740('0x6')]=_0xea77b7[_0x1740('0x6')]||'';this[_0x1740('0x7')]=_0xea77b7[_0x1740('0x7')]||'';this[_0x1740('0x8')]=_0xea77b7[_0x1740('0x8')]||'';this[_0x1740('0x9')]=_0xea77b7[_0x1740('0x9')]||'';this[_0x1740('0xa')]=_0xea77b7[_0x1740('0xa')]||'';this[_0x1740('0xb')]=_0xea77b7[_0x1740('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x713c=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','consumerKey'];(function(_0x21d1fe,_0x45eb48){var _0xef03c3=function(_0x11e9a2){while(--_0x11e9a2){_0x21d1fe['push'](_0x21d1fe['shift']());}};_0xef03c3(++_0x45eb48);}(_0x713c,0x8b));var _0xc713=function(_0xa8c29b,_0x1253bd){_0xa8c29b=_0xa8c29b-0x0;var _0x7caf1e=_0x713c[_0xa8c29b];return _0x7caf1e;};'use strict';function DeskAccount(_0x2fdbaf){this['id']=_0x2fdbaf['id']||0x0;this[_0xc713('0x0')]=_0x2fdbaf[_0xc713('0x0')]||'';this[_0xc713('0x1')]=_0x2fdbaf[_0xc713('0x1')]||'';this[_0xc713('0x2')]=_0x2fdbaf[_0xc713('0x2')]||'';this[_0xc713('0x3')]=_0x2fdbaf['authType']||'';this['password']=_0x2fdbaf['password']||'';this[_0xc713('0x4')]=_0x2fdbaf[_0xc713('0x4')]||'';this['consumerSecret']=_0x2fdbaf[_0xc713('0x5')]||'';this[_0xc713('0x6')]=_0x2fdbaf['token']||'';this[_0xc713('0x7')]=_0x2fdbaf[_0xc713('0x7')]||'';this[_0xc713('0x8')]=_0x2fdbaf[_0xc713('0x8')]||'';this[_0xc713('0x9')]=_0x2fdbaf[_0xc713('0x9')]||'';this[_0xc713('0xa')]=_0x2fdbaf['Configurations']||{};}module[_0xc713('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index e5707aa..9385ad5 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 _0x5b02=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x52e867,_0x136dd0){_0x52e867=_0x52e867-0x0;var _0x21059f=_0x5b02[_0x52e867];return _0x21059f;};'use strict';function Dynamics365Account(_0x5d3c24){this['id']=_0x5d3c24['id']||0x0;this[_0x25b0('0x0')]=_0x5d3c24[_0x25b0('0x0')]||'';this[_0x25b0('0x1')]=_0x5d3c24['username']||'';this['password']=_0x5d3c24[_0x25b0('0x2')]||'';this['remoteUri']=_0x5d3c24[_0x25b0('0x3')]||'';this[_0x25b0('0x4')]=_0x5d3c24[_0x25b0('0x4')]||'';this[_0x25b0('0x5')]=_0x5d3c24[_0x25b0('0x5')]||'';this['clientSecret']=_0x5d3c24[_0x25b0('0x6')]||{};this[_0x25b0('0x7')]=_0x5d3c24['serverUrl']||'';this[_0x25b0('0x8')]=_0x5d3c24['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x6e6c=['clientSecret','serverUrl','Configurations','name','username','remoteUri','tenantId','clientId'];(function(_0x27a67e,_0x14027a){var _0x54c72d=function(_0x14e37c){while(--_0x14e37c){_0x27a67e['push'](_0x27a67e['shift']());}};_0x54c72d(++_0x14027a);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';function Dynamics365Account(_0xc51915){this['id']=_0xc51915['id']||0x0;this[_0xc6e6('0x0')]=_0xc51915['name']||'';this[_0xc6e6('0x1')]=_0xc51915[_0xc6e6('0x1')]||'';this['password']=_0xc51915['password']||'';this[_0xc6e6('0x2')]=_0xc51915['remoteUri']||'';this[_0xc6e6('0x3')]=_0xc51915['tenantId']||'';this[_0xc6e6('0x4')]=_0xc51915[_0xc6e6('0x4')]||'';this['clientSecret']=_0xc51915[_0xc6e6('0x5')]||{};this[_0xc6e6('0x6')]=_0xc51915['serverUrl']||'';this[_0xc6e6('0x7')]=_0xc51915[_0xc6e6('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 354b805..aa574f7 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 _0x34e3=['name','description','ecm','headerinfo','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','Trunk','key','exports'];(function(_0x5c6a75,_0x531b71){var _0x5d755e=function(_0x3e2f98){while(--_0x3e2f98){_0x5c6a75['push'](_0x5c6a75['shift']());}};_0x5d755e(++_0x531b71);}(_0x34e3,0x118));var _0x334e=function(_0x4a6c7f,_0x58fc85){_0x4a6c7f=_0x4a6c7f-0x0;var _0x538b65=_0x34e3[_0x4a6c7f];return _0x538b65;};'use strict';function FaxAccount(_0x963811){this['id']=_0x963811['id']||0x0;this[_0x334e('0x0')]=_0x963811[_0x334e('0x0')]||'';this[_0x334e('0x1')]=_0x963811[_0x334e('0x1')];this[_0x334e('0x2')]=_0x963811['ecm'];this[_0x334e('0x3')]=_0x963811[_0x334e('0x3')];this['localstationid']=_0x963811['localstationid'];this[_0x334e('0x4')]=_0x963811[_0x334e('0x4')]||0x960;this['maxrate']=_0x963811[_0x334e('0x5')]||0x3840;this[_0x334e('0x6')]=_0x963811[_0x334e('0x6')]||_0x334e('0x7');this['gateway']=_0x963811['gateway']||'no';this['faxdetect']=_0x963811[_0x334e('0x8')]||'no';this[_0x334e('0x9')]=_0x963811[_0x334e('0x9')]||0x1388;this[_0x334e('0xa')]=_0x963811[_0x334e('0xa')]||'SIP';this['Trunk']=_0x963811['Trunk']?_0x963811[_0x334e('0xb')]:undefined;this['ListId']=_0x963811['ListId'];this[_0x334e('0xc')]=_0x963811['key'];}module[_0x334e('0xd')]=FaxAccount; \ No newline at end of file +var _0xd477=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','Trunk','ListId','key','exports','name'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0xd477,0xdf));var _0x7d47=function(_0x2a22eb,_0x3da482){_0x2a22eb=_0x2a22eb-0x0;var _0x427fec=_0xd477[_0x2a22eb];return _0x427fec;};'use strict';function FaxAccount(_0x4dfc41){this['id']=_0x4dfc41['id']||0x0;this[_0x7d47('0x0')]=_0x4dfc41[_0x7d47('0x0')]||'';this[_0x7d47('0x1')]=_0x4dfc41[_0x7d47('0x1')];this['ecm']=_0x4dfc41[_0x7d47('0x2')];this['headerinfo']=_0x4dfc41[_0x7d47('0x3')];this[_0x7d47('0x4')]=_0x4dfc41['localstationid'];this[_0x7d47('0x5')]=_0x4dfc41[_0x7d47('0x5')]||0x960;this[_0x7d47('0x6')]=_0x4dfc41[_0x7d47('0x6')]||0x3840;this[_0x7d47('0x7')]=_0x4dfc41[_0x7d47('0x7')]||_0x7d47('0x8');this['gateway']=_0x4dfc41[_0x7d47('0x9')]||'no';this['faxdetect']=_0x4dfc41['faxdetect']||'no';this[_0x7d47('0xa')]=_0x4dfc41[_0x7d47('0xa')]||0x1388;this[_0x7d47('0xb')]=_0x4dfc41[_0x7d47('0xb')]||'SIP';this[_0x7d47('0xc')]=_0x4dfc41[_0x7d47('0xc')]?_0x4dfc41[_0x7d47('0xc')]:undefined;this[_0x7d47('0xd')]=_0x4dfc41['ListId'];this[_0x7d47('0xe')]=_0x4dfc41[_0x7d47('0xe')];}module[_0x7d47('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 47797e6..b9be253 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 _0xed3d=['remoteUri','serverUrl','Configurations','username','apiKey','token'];(function(_0x203c97,_0x523852){var _0x54f3fb=function(_0x3f95d8){while(--_0x3f95d8){_0x203c97['push'](_0x203c97['shift']());}};_0x54f3fb(++_0x523852);}(_0xed3d,0x1e9));var _0xded3=function(_0x7105cf,_0x444d1d){_0x7105cf=_0x7105cf-0x0;var _0x53df02=_0xed3d[_0x7105cf];return _0x53df02;};'use strict';function FreshdeskAccount(_0x46a93e){this['id']=_0x46a93e['id']||0x0;this['name']=_0x46a93e['name']||'';this[_0xded3('0x0')]=_0x46a93e[_0xded3('0x0')]||'';this[_0xded3('0x1')]=_0x46a93e[_0xded3('0x2')]||'';this[_0xded3('0x3')]=_0x46a93e['remoteUri']||'';this[_0xded3('0x4')]=_0x46a93e[_0xded3('0x4')]||'';this[_0xded3('0x5')]=_0x46a93e[_0xded3('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x42a4=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x3b2524,_0x21705f){var _0x3be2ff=function(_0x4b01da){while(--_0x4b01da){_0x3b2524['push'](_0x3b2524['shift']());}};_0x3be2ff(++_0x21705f);}(_0x42a4,0xe4));var _0x442a=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x42a4[_0x310504];return _0x5b36d0;};'use strict';function FreshdeskAccount(_0x4fd10c){this['id']=_0x4fd10c['id']||0x0;this['name']=_0x4fd10c[_0x442a('0x0')]||'';this[_0x442a('0x1')]=_0x4fd10c[_0x442a('0x1')]||'';this[_0x442a('0x2')]=_0x4fd10c[_0x442a('0x3')]||'';this['remoteUri']=_0x4fd10c[_0x442a('0x4')]||'';this[_0x442a('0x5')]=_0x4fd10c['serverUrl']||'';this[_0x442a('0x6')]=_0x4fd10c['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 17e212c..1f8210a 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 _0x13f5=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x418cfe,_0x240752){var _0x2b4dff=function(_0x2a45e5){while(--_0x2a45e5){_0x418cfe['push'](_0x418cfe['shift']());}};_0x2b4dff(++_0x240752);}(_0x13f5,0xc3));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';function FreshsalesAccount(_0x4edd23){this['id']=_0x4edd23['id']||0x0;this[_0x513f('0x0')]=_0x4edd23[_0x513f('0x0')]||'';this[_0x513f('0x1')]=_0x4edd23['username']||'';this[_0x513f('0x2')]=_0x4edd23['token']||'';this['remoteUri']=_0x4edd23[_0x513f('0x3')]||'';this[_0x513f('0x4')]=_0x4edd23[_0x513f('0x4')]||'';this[_0x513f('0x5')]=_0x4edd23[_0x513f('0x5')]||{};}module[_0x513f('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xab29=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x1b83fc,_0x810a03){var _0x2cacec=function(_0x1527cd){while(--_0x1527cd){_0x1b83fc['push'](_0x1b83fc['shift']());}};_0x2cacec(++_0x810a03);}(_0xab29,0x145));var _0x9ab2=function(_0x4f6a47,_0x59fd60){_0x4f6a47=_0x4f6a47-0x0;var _0x1f8d33=_0xab29[_0x4f6a47];return _0x1f8d33;};'use strict';function FreshsalesAccount(_0x54d887){this['id']=_0x54d887['id']||0x0;this[_0x9ab2('0x0')]=_0x54d887[_0x9ab2('0x0')]||'';this[_0x9ab2('0x1')]=_0x54d887['username']||'';this[_0x9ab2('0x2')]=_0x54d887['token']||'';this[_0x9ab2('0x3')]=_0x54d887[_0x9ab2('0x3')]||'';this[_0x9ab2('0x4')]=_0x54d887[_0x9ab2('0x4')]||'';this[_0x9ab2('0x5')]=_0x54d887['Configurations']||{};}module[_0x9ab2('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 17cdc1d..a6bb676 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 _0xa42e=['type','inbound','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','channel','context','exten','priority','assigned','motionChannel','mohtime','variables'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0xa42e,0xfc));var _0xea42=function(_0x252b9f,_0x297310){_0x252b9f=_0x252b9f-0x0;var _0x3df39f=_0xa42e[_0x252b9f];return _0x3df39f;};'use strict';function QueueReport(){this[_0xea42('0x0')]=_0xea42('0x1');this['uniqueid']='';this[_0xea42('0x2')]='';this[_0xea42('0x3')]='';this['queue']='';this[_0xea42('0x4')]=null;this[_0xea42('0x5')]=null;this[_0xea42('0x6')]=0x1;this[_0xea42('0x7')]=0x1;this[_0xea42('0x8')]=![];this[_0xea42('0x9')]=null;this['queuecallercomplete']=![];this[_0xea42('0xa')]=null;this[_0xea42('0xb')]=![];this['queuecallerexitAt']=null;this[_0xea42('0xc')]=0x1;this[_0xea42('0xd')]='';this['connectedlinenum']='';this['connectedlinename']='';this['accountcode']='';this[_0xea42('0xe')]='';this[_0xea42('0xf')]='';this[_0xea42('0x10')]='';this['holdtime']=0x0;this[_0xea42('0x11')]=![];this['lastAssignedTo']='';this[_0xea42('0x12')]='voice';this[_0xea42('0x13')]=0x0;this[_0xea42('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xe003=['queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe003,0xe7));var _0x3e00=function(_0x5a68af,_0x17432c){_0x5a68af=_0x5a68af-0x0;var _0x5d7b61=_0xe003[_0x5a68af];return _0x5d7b61;};'use strict';function QueueReport(){this[_0x3e00('0x0')]=_0x3e00('0x1');this[_0x3e00('0x2')]='';this['calleridnum']='';this[_0x3e00('0x3')]='';this[_0x3e00('0x4')]='';this[_0x3e00('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x3e00('0x6')]=0x1;this[_0x3e00('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x3e00('0x8')]=null;this[_0x3e00('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x3e00('0xa')]=![];this['queuecallerexitAt']=null;this[_0x3e00('0xb')]=0x1;this[_0x3e00('0xc')]='';this[_0x3e00('0xd')]='';this[_0x3e00('0xe')]='';this[_0x3e00('0xf')]='';this['context']='';this[_0x3e00('0x10')]='';this[_0x3e00('0x11')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x3e00('0x12')]='';this[_0x3e00('0x13')]=_0x3e00('0x14');this[_0x3e00('0x15')]=0x0;this[_0x3e00('0x16')]={};}module[_0x3e00('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 3beeda9..8cfe52e 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 _0xa405=['remoteUri','password','clientId','clientSecret','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0xbbe355,_0x2c8136){var _0x1e0b45=function(_0x1ae65f){while(--_0x1ae65f){_0xbbe355['push'](_0xbbe355['shift']());}};_0x1e0b45(++_0x2c8136);}(_0xa405,0x1ca));var _0x5a40=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa405[_0x4b369d];return _0x571a98;};'use strict';function SalesforceAccount(_0x4ceefa){this['id']=_0x4ceefa['id']||0x0;this[_0x5a40('0x0')]=_0x4ceefa[_0x5a40('0x0')]||'';this['username']=_0x4ceefa[_0x5a40('0x1')]||'';this[_0x5a40('0x2')]=_0x4ceefa[_0x5a40('0x2')]||'';this[_0x5a40('0x3')]=_0x4ceefa[_0x5a40('0x3')]||'';this['clientId']=_0x4ceefa[_0x5a40('0x4')]||'';this[_0x5a40('0x5')]=_0x4ceefa[_0x5a40('0x5')]||'';this['securityToken']=_0x4ceefa['securityToken']||'';this['type']=_0x4ceefa['type']||_0x5a40('0x6');this[_0x5a40('0x7')]=_0x4ceefa[_0x5a40('0x7')]||'';this[_0x5a40('0x8')]=_0x4ceefa[_0x5a40('0x8')]||{};}module[_0x5a40('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x4436=['password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','username','remoteUri'];(function(_0x449484,_0x4afc54){var _0x3ee4d5=function(_0x2b7d48){while(--_0x2b7d48){_0x449484['push'](_0x449484['shift']());}};_0x3ee4d5(++_0x4afc54);}(_0x4436,0x7c));var _0x6443=function(_0xda60a4,_0x5702db){_0xda60a4=_0xda60a4-0x0;var _0x16b168=_0x4436[_0xda60a4];return _0x16b168;};'use strict';function SalesforceAccount(_0x540591){this['id']=_0x540591['id']||0x0;this['name']=_0x540591['name']||'';this['username']=_0x540591[_0x6443('0x0')]||'';this[_0x6443('0x1')]=_0x540591['remoteUri']||'';this['password']=_0x540591[_0x6443('0x2')]||'';this[_0x6443('0x3')]=_0x540591[_0x6443('0x3')]||'';this[_0x6443('0x4')]=_0x540591[_0x6443('0x4')]||'';this[_0x6443('0x5')]=_0x540591[_0x6443('0x5')]||'';this[_0x6443('0x6')]=_0x540591['type']||'integrationTab';this[_0x6443('0x7')]=_0x540591['serverUrl']||'';this[_0x6443('0x8')]=_0x540591[_0x6443('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 44bb9da..b20bc5e 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 _0x041b=['Configurations','exports','username','password','remoteUri','serverUrl'];(function(_0x5cbc21,_0x4b6595){var _0x28d84c=function(_0x35ba3a){while(--_0x35ba3a){_0x5cbc21['push'](_0x5cbc21['shift']());}};_0x28d84c(++_0x4b6595);}(_0x041b,0x8c));var _0xb041=function(_0x110cc6,_0x55e019){_0x110cc6=_0x110cc6-0x0;var _0x285573=_0x041b[_0x110cc6];return _0x285573;};'use strict';function ServicenowAccount(_0x185f61){this['id']=_0x185f61['id']||0x0;this['name']=_0x185f61['name']||'';this[_0xb041('0x0')]=_0x185f61[_0xb041('0x0')]||'';this['password']=_0x185f61[_0xb041('0x1')]||'';this[_0xb041('0x2')]=_0x185f61['remoteUri']||'';this[_0xb041('0x3')]=_0x185f61[_0xb041('0x3')]||'';this[_0xb041('0x4')]=_0x185f61['Configurations']||{};}module[_0xb041('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x0aac=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x441dc0,_0x1ae866){var _0x59a203=function(_0xe4cd24){while(--_0xe4cd24){_0x441dc0['push'](_0x441dc0['shift']());}};_0x59a203(++_0x1ae866);}(_0x0aac,0x1a2));var _0xc0aa=function(_0x4d9d54,_0x1b9bcf){_0x4d9d54=_0x4d9d54-0x0;var _0x489b1b=_0x0aac[_0x4d9d54];return _0x489b1b;};'use strict';function ServicenowAccount(_0x5230dd){this['id']=_0x5230dd['id']||0x0;this[_0xc0aa('0x0')]=_0x5230dd[_0xc0aa('0x0')]||'';this['username']=_0x5230dd[_0xc0aa('0x1')]||'';this[_0xc0aa('0x2')]=_0x5230dd['password']||'';this[_0xc0aa('0x3')]=_0x5230dd['remoteUri']||'';this['serverUrl']=_0x5230dd[_0xc0aa('0x4')]||'';this[_0xc0aa('0x5')]=_0x5230dd[_0xc0aa('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d0ee266..134fca0 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 _0x5ba8=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x48182a,_0x28cafd){var _0x3670b2=function(_0x35c28f){while(--_0x35c28f){_0x48182a['push'](_0x48182a['shift']());}};_0x3670b2(++_0x28cafd);}(_0x5ba8,0x13a));var _0x85ba=function(_0x543cb7,_0x2310d1){_0x543cb7=_0x543cb7-0x0;var _0x1f054e=_0x5ba8[_0x543cb7];return _0x1f054e;};'use strict';function SugarcrmAccount(_0x3b692c){this['id']=_0x3b692c['id']||0x0;this[_0x85ba('0x0')]=_0x3b692c[_0x85ba('0x0')]||'';this['username']=_0x3b692c[_0x85ba('0x1')]||'';this[_0x85ba('0x2')]=_0x3b692c['password']||'';this[_0x85ba('0x3')]=_0x3b692c[_0x85ba('0x3')]||'';this[_0x85ba('0x4')]=_0x3b692c['serverUrl']||'';this[_0x85ba('0x5')]=_0x3b692c['Configurations']||{};}module[_0x85ba('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1d19=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5f4405,_0x46aa23){var _0x348e74=function(_0xdca321){while(--_0xdca321){_0x5f4405['push'](_0x5f4405['shift']());}};_0x348e74(++_0x46aa23);}(_0x1d19,0xef));var _0x91d1=function(_0x3c9d10,_0x4233e7){_0x3c9d10=_0x3c9d10-0x0;var _0x5b52b2=_0x1d19[_0x3c9d10];return _0x5b52b2;};'use strict';function SugarcrmAccount(_0x46aca5){this['id']=_0x46aca5['id']||0x0;this['name']=_0x46aca5[_0x91d1('0x0')]||'';this[_0x91d1('0x1')]=_0x46aca5[_0x91d1('0x1')]||'';this[_0x91d1('0x2')]=_0x46aca5[_0x91d1('0x2')]||'';this[_0x91d1('0x3')]=_0x46aca5[_0x91d1('0x3')]||'';this[_0x91d1('0x4')]=_0x46aca5[_0x91d1('0x4')]||'';this[_0x91d1('0x5')]=_0x46aca5[_0x91d1('0x5')]||{};}module[_0x91d1('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 05e4ccc..e39e365 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 _0x52a6=['unknown','address','exports','name','accountcode','state','stateTime','status'];(function(_0x3cd420,_0x52fd48){var _0x4bd4d9=function(_0xb38e32){while(--_0xb38e32){_0x3cd420['push'](_0x3cd420['shift']());}};_0x4bd4d9(++_0x52fd48);}(_0x52a6,0xe3));var _0x652a=function(_0x48eecb,_0x4cc6cd){_0x48eecb=_0x48eecb-0x0;var _0x21caa9=_0x52a6[_0x48eecb];return _0x21caa9;};'use strict';function Telephone(_0x29ad81){this['id']=_0x29ad81['id']||0x0;this[_0x652a('0x0')]=_0x29ad81[_0x652a('0x0')]||'';this[_0x652a('0x1')]=_0x29ad81['accountcode']||'';this[_0x652a('0x2')]='unknown';this[_0x652a('0x3')]=0x0;this[_0x652a('0x4')]=_0x652a('0x5');this[_0x652a('0x6')]='';}module[_0x652a('0x7')]=Telephone; \ No newline at end of file +var _0x1ebd=['address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x2af261,_0x33d5ae){var _0x5e4774=function(_0x562286){while(--_0x562286){_0x2af261['push'](_0x2af261['shift']());}};_0x5e4774(++_0x33d5ae);}(_0x1ebd,0x64));var _0xd1eb=function(_0x384972,_0x3c99d3){_0x384972=_0x384972-0x0;var _0x26b729=_0x1ebd[_0x384972];return _0x26b729;};'use strict';function Telephone(_0x3bf1a6){this['id']=_0x3bf1a6['id']||0x0;this[_0xd1eb('0x0')]=_0x3bf1a6[_0xd1eb('0x0')]||'';this['accountcode']=_0x3bf1a6[_0xd1eb('0x1')]||'';this[_0xd1eb('0x2')]=_0xd1eb('0x3');this[_0xd1eb('0x4')]=0x0;this['status']='unknown';this[_0xd1eb('0x5')]='';}module[_0xd1eb('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 879ca02..904f095 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x2c5c33,_0x4ff1ba){var _0x26f7da=function(_0x49a649){while(--_0x49a649){_0x2c5c33['push'](_0x2c5c33['shift']());}};_0x26f7da(++_0x4ff1ba);}(_0xb10b,0x12a));var _0xbb10=function(_0x219e9b,_0x295d91){_0x219e9b=_0x219e9b-0x0;var _0x332e80=_0xb10b[_0x219e9b];return _0x332e80;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0xe56160,_0x1a4317){var _0x36ec60=function(_0x1cec17){while(--_0x1cec17){_0xe56160['push'](_0xe56160['shift']());}};_0x36ec60(++_0x1a4317);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 358a7b3..ad1f78e 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x554b56,_0x52fcec){var _0x3b77b9=function(_0x3708be){while(--_0x3708be){_0x554b56['push'](_0x554b56['shift']());}};_0x3b77b9(++_0x52fcec);}(_0xda3f,0xec));var _0xfda3=function(_0x4d0f20,_0x3d4689){_0x4d0f20=_0x4d0f20-0x0;var _0x2f1c4d=_0xda3f[_0x4d0f20];return _0x2f1c4d;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x24d042,_0x3ae099){var _0x2c5512=function(_0x1e9453){while(--_0x1e9453){_0x24d042['push'](_0x24d042['shift']());}};_0x2c5512(++_0x3ae099);}(_0x2032,0xd9));var _0x2203=function(_0x42cf2d,_0x5af862){_0x42cf2d=_0x42cf2d-0x0;var _0x2d68fc=_0x2032[_0x42cf2d];return _0x2d68fc;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 78c25fd..02d6632 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 _0x6d56=['status','registry','indexOf','split','host','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown'];(function(_0x3a72d7,_0x14146a){var _0x540b51=function(_0x5ce17b){while(--_0x5ce17b){_0x3a72d7['push'](_0x3a72d7['shift']());}};_0x540b51(++_0x14146a);}(_0x6d56,0xfd));var _0x66d5=function(_0x11bb22,_0x482fdd){_0x11bb22=_0x11bb22-0x0;var _0x3b0fcd=_0x6d56[_0x11bb22];return _0x3b0fcd;};'use strict';function Trunk(_0x4e77ef){this['id']=_0x4e77ef['id']||0x0;this[_0x66d5('0x0')]=_0x4e77ef[_0x66d5('0x0')]||![];this['name']=_0x4e77ef[_0x66d5('0x1')]||'';this['state']=_0x66d5('0x2');this['stateTime']=0x0;this[_0x66d5('0x3')]=_0x66d5('0x2');this[_0x66d5('0x4')]=_0x4e77ef[_0x66d5('0x4')]&&_0x4e77ef[_0x66d5('0x4')][_0x66d5('0x5')](':')?_0x4e77ef[_0x66d5('0x4')][_0x66d5('0x6')](':')[0x0]:'';this[_0x66d5('0x7')]='';this[_0x66d5('0x8')]='';this[_0x66d5('0x9')]='';this[_0x66d5('0xa')]='';this['refresh']='';this[_0x66d5('0xb')]=_0x66d5('0x2');this[_0x66d5('0xc')]='';this[_0x66d5('0xd')]='';this[_0x66d5('0xe')]=_0x4e77ef[_0x66d5('0xe')]||'';}module[_0x66d5('0xf')]=Trunk; \ No newline at end of file +var _0xde98=['defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x211eef,_0x3881c4){var _0x31948a=function(_0x462330){while(--_0x462330){_0x211eef['push'](_0x211eef['shift']());}};_0x31948a(++_0x3881c4);}(_0xde98,0xa2));var _0x8de9=function(_0x35c750,_0x4dcafe){_0x35c750=_0x35c750-0x0;var _0x916c98=_0xde98[_0x35c750];return _0x916c98;};'use strict';function Trunk(_0x1e7390){this['id']=_0x1e7390['id']||0x0;this[_0x8de9('0x0')]=_0x1e7390[_0x8de9('0x0')]||![];this[_0x8de9('0x1')]=_0x1e7390[_0x8de9('0x1')]||'';this['state']=_0x8de9('0x2');this[_0x8de9('0x3')]=0x0;this[_0x8de9('0x4')]=_0x8de9('0x2');this[_0x8de9('0x5')]=_0x1e7390[_0x8de9('0x5')]&&_0x1e7390[_0x8de9('0x5')][_0x8de9('0x6')](':')?_0x1e7390[_0x8de9('0x5')][_0x8de9('0x7')](':')[0x0]:'';this[_0x8de9('0x8')]='';this['port']='';this[_0x8de9('0x9')]='';this[_0x8de9('0xa')]='';this[_0x8de9('0xb')]='';this[_0x8de9('0xc')]=_0x8de9('0x2');this[_0x8de9('0xd')]='';this['address']='';this[_0x8de9('0xe')]=_0x1e7390[_0x8de9('0xe')]||'';}module[_0x8de9('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 47c63fb..63fddc3 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 _0xe55f=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0xe55f,0x8b));var _0xfe55=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0xe55f[_0xdb357c];return _0x5c8735;};'use strict';function voiceExtension(_0x4b0ba2){this['id']=_0x4b0ba2['id']||0x0;this[_0xfe55('0x0')]=_0x4b0ba2['exten']||'';this['recordingFormat']=_0x4b0ba2[_0xfe55('0x1')]||'none';this['mandatoryDisposition']=_0x4b0ba2[_0xfe55('0x2')]||![];}module[_0xfe55('0x3')]=voiceExtension; \ No newline at end of file +var _0xcfe3=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcfe3,0x1c8));var _0x3cfe=function(_0x24060d,_0x203042){_0x24060d=_0x24060d-0x0;var _0x5b3cd9=_0xcfe3[_0x24060d];return _0x5b3cd9;};'use strict';function voiceExtension(_0x1b10e9){this['id']=_0x1b10e9['id']||0x0;this['exten']=_0x1b10e9[_0x3cfe('0x0')]||'';this['recordingFormat']=_0x1b10e9[_0x3cfe('0x1')]||'none';this[_0x3cfe('0x2')]=_0x1b10e9['mandatoryDisposition']||![];}module[_0x3cfe('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6f3c81c..4b53883 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 _0x8a3b=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','ringing','ringinuse','onhold','gsm','rrmemory','roundrobin','name','monitor_format','talking','total','answered','sumHoldTime','sumBillable','unmanaged','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x8a3b,0x105));var _0xb8a3=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8a3b[_0x134c2e];return _0x2825db;};'use strict';var statusDesc=[_0xb8a3('0x0'),_0xb8a3('0x1'),_0xb8a3('0x2'),'busy','invalid','unavailable',_0xb8a3('0x3'),_0xb8a3('0x4'),_0xb8a3('0x5')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0xb8a3('0x6')};var strategy={'rrmemory':_0xb8a3('0x7'),'roundrobin':_0xb8a3('0x8')};function VoiceQueue(_0x297b24){this['id']=_0x297b24['id']||0x0;this[_0xb8a3('0x9')]=_0x297b24[_0xb8a3('0x9')]||'';this['monitor_format']=_0x297b24[_0xb8a3('0xa')]||'';this['type']=_0x297b24['type']||'inbound';this['waiting']=0x0;this[_0xb8a3('0xb')]=0x0;this[_0xb8a3('0xc')]=0x0;this[_0xb8a3('0xd')]=0x0;this['sumDuration']=0x0;this[_0xb8a3('0xe')]=0x0;this[_0xb8a3('0xf')]=0x0;this[_0xb8a3('0x10')]=0x0;this['abandoned']=0x0;this[_0xb8a3('0x11')]=0x0;this['available']=0x0;this[_0xb8a3('0x12')]=_0x297b24[_0xb8a3('0x12')]||![];this['acwTimeout']=_0x297b24[_0xb8a3('0x13')]||0xa;this[_0xb8a3('0x14')]=_0x297b24[_0xb8a3('0x14')]||'no';this[_0xb8a3('0x15')]=!![];this['message']='';this[_0xb8a3('0x16')]=0x0;this[_0xb8a3('0x17')]=0x0;this[_0xb8a3('0x18')]=_0x297b24[_0xb8a3('0x18')]||null;this[_0xb8a3('0x19')]=_0x297b24['dialGlobalInterval']?_0x297b24['dialGlobalInterval']:null;this[_0xb8a3('0x1a')]=_0x297b24[_0xb8a3('0x1a')];this[_0xb8a3('0x1b')]=_0x297b24[_0xb8a3('0x1b')]||'progressive';this[_0xb8a3('0x1c')]=_0x297b24[_0xb8a3('0x1c')]||0x0;this[_0xb8a3('0x1d')]=_0x297b24['dialLimitQueue']||0x0;this[_0xb8a3('0x1e')]=_0x297b24[_0xb8a3('0x1e')]||0x1;this['dialPredictiveOptimization']=_0x297b24[_0xb8a3('0x1f')]||_0xb8a3('0x20');this[_0xb8a3('0x21')]=_0x297b24[_0xb8a3('0x21')]||0.03;this[_0xb8a3('0x22')]=_0x297b24[_0xb8a3('0x22')]||0x258;this[_0xb8a3('0x23')]=_0x297b24[_0xb8a3('0x23')]||_0xb8a3('0x24');this[_0xb8a3('0x25')]=_0x297b24['dialOriginateCallerIdNumber']||_0xb8a3('0x24');this[_0xb8a3('0x26')]=_0x297b24['dialOriginateTimeout']||0x1e;this[_0xb8a3('0x27')]=_0x297b24[_0xb8a3('0x27')]||_0xb8a3('0x28');this[_0xb8a3('0x29')]=_0x297b24[_0xb8a3('0x29')]||0x3;this['dialQueueProject']=_0x297b24['dialQueueProject']||undefined;this[_0xb8a3('0x2a')]=_0x297b24[_0xb8a3('0x2a')]||0x3;this[_0xb8a3('0x2b')]=_0x297b24[_0xb8a3('0x2b')]||0x96;this[_0xb8a3('0x2c')]=_0x297b24[_0xb8a3('0x2c')]||0x3;this['dialBusyRetryFrequency']=_0x297b24[_0xb8a3('0x2d')]||0x96;this[_0xb8a3('0x2e')]=_0x297b24[_0xb8a3('0x2e')]||0x3;this[_0xb8a3('0x2f')]=_0x297b24[_0xb8a3('0x2f')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x297b24[_0xb8a3('0x30')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x297b24[_0xb8a3('0x31')]||0x96;this[_0xb8a3('0x32')]=_0x297b24['dialDropMaxRetry']||0x3;this[_0xb8a3('0x33')]=_0x297b24['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x297b24['dialAbandonedMaxRetry']||0x3;this[_0xb8a3('0x34')]=_0x297b24[_0xb8a3('0x34')]||0x96;this[_0xb8a3('0x35')]=_0x297b24[_0xb8a3('0x35')]||0x3;this[_0xb8a3('0x36')]=_0x297b24[_0xb8a3('0x36')]||0x96;this['dialAgentRejectMaxRetry']=_0x297b24[_0xb8a3('0x37')]||0x3;this[_0xb8a3('0x38')]=_0x297b24[_0xb8a3('0x38')]||0x96;this[_0xb8a3('0x39')]=_0x297b24[_0xb8a3('0x39')]||0x4;this[_0xb8a3('0x3a')]=_0x297b24['Trunk']?_0x297b24[_0xb8a3('0x3a')]:undefined;this['TrunkBackup']=_0x297b24[_0xb8a3('0x3b')]?_0x297b24[_0xb8a3('0x3b')]:undefined;this[_0xb8a3('0x3c')]=_0x297b24['dialPrefix']||undefined;this[_0xb8a3('0x3d')]=_0x297b24[_0xb8a3('0x3d')]?_0x297b24[_0xb8a3('0x3d')]:undefined;this[_0xb8a3('0x3e')]=_0x297b24[_0xb8a3('0x3e')]||_0xb8a3('0x3f');this[_0xb8a3('0x40')]=_0x297b24[_0xb8a3('0x40')]||undefined;this['dialCutDigit']=_0x297b24[_0xb8a3('0x41')]||undefined;this[_0xb8a3('0x42')]=strategy[_0x297b24[_0xb8a3('0x42')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0xb8a3('0x43')]=_0x297b24[_0xb8a3('0x43')]||![];this[_0xb8a3('0x44')]=_0x297b24['dialAMDInitialSilence'];this[_0xb8a3('0x45')]=_0x297b24[_0xb8a3('0x45')];this[_0xb8a3('0x46')]=_0x297b24[_0xb8a3('0x46')];this['dialAMDTotalAnalysisTime']=_0x297b24['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x297b24[_0xb8a3('0x47')];this[_0xb8a3('0x48')]=_0x297b24['dialAMDBetweenWordsSilence'];this[_0xb8a3('0x49')]=_0x297b24[_0xb8a3('0x49')];this[_0xb8a3('0x4a')]=_0x297b24['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x297b24[_0xb8a3('0x4b')];this[_0xb8a3('0x4c')]=0x0;this['pTalking']=0x0;this[_0xb8a3('0x4d')]=_0x297b24[_0xb8a3('0x4d')];this[_0xb8a3('0x4e')]=0x0;this[_0xb8a3('0x4f')]=0x0;this[_0xb8a3('0x50')]=0x0;this[_0xb8a3('0x51')]=0x0;this[_0xb8a3('0x52')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xb8a3('0x53')]=0x0;this[_0xb8a3('0x54')]=0x0;this[_0xb8a3('0x55')]=0x0;this[_0xb8a3('0x56')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0xb8a3('0x57')]=0x0;this['startProgressive']=undefined;this[_0xb8a3('0x58')]=undefined;this['handlePredictive']=undefined;this[_0xb8a3('0x59')]=1.05;this[_0xb8a3('0x5a')]=0x0;this[_0xb8a3('0x5b')]=0x0;this[_0xb8a3('0x5c')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xb8a3('0x5d')]=0x0;this[_0xb8a3('0x5e')]=0x0;this[_0xb8a3('0x5f')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xb8a3('0x60')]=_0x297b24[_0xb8a3('0x61')]||0x14;this['predictiveIntervalMinThreshold']=_0x297b24[_0xb8a3('0x61')]||0xa;this[_0xb8a3('0x62')]=0x0;this[_0xb8a3('0x63')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xb8a3('0x64')]=0x0;this[_0xb8a3('0x65')]=_0x297b24[_0xb8a3('0x65')]||0x1e;this[_0xb8a3('0x66')]=_0x297b24['dialRecallInQueue']||![];this[_0xb8a3('0x67')]=!!_0x297b24[_0xb8a3('0x67')]||![];this[_0xb8a3('0x68')]=_0x297b24[_0xb8a3('0x68')]||undefined;this[_0xb8a3('0x69')]=_0x297b24[_0xb8a3('0x69')]||![];this[_0xb8a3('0x6a')]=_0x297b24[_0xb8a3('0x6a')]||![];this['monitor_format']=monitorFormat[_0x297b24['monitor_format']]?monitorFormat[_0x297b24[_0xb8a3('0xa')]]:undefined;this[_0xb8a3('0x6b')]=_0x297b24[_0xb8a3('0x6b')]||![];this[_0xb8a3('0x6c')]=_0x297b24[_0xb8a3('0x6c')]?_0x297b24['mandatoryDispositionPause']:undefined;}module[_0xb8a3('0x6d')]=VoiceQueue; \ No newline at end of file +var _0x21bd=['dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization'];(function(_0x21f4f1,_0x2accb8){var _0x675c84=function(_0x55659e){while(--_0x55659e){_0x21f4f1['push'](_0x21f4f1['shift']());}};_0x675c84(++_0x2accb8);}(_0x21bd,0x1c3));var _0xd21b=function(_0x55bde5,_0x576d3c){_0x55bde5=_0x55bde5-0x0;var _0x5ca5d2=_0x21bd[_0x55bde5];return _0x5ca5d2;};'use strict';var statusDesc=[_0xd21b('0x0'),_0xd21b('0x1'),_0xd21b('0x2'),_0xd21b('0x3'),_0xd21b('0x4'),'unavailable',_0xd21b('0x5'),_0xd21b('0x6'),_0xd21b('0x7')];var monitorFormat={'wav':_0xd21b('0x8'),'wav49':_0xd21b('0x9'),'gsm':_0xd21b('0xa')};var strategy={'rrmemory':_0xd21b('0xb'),'roundrobin':_0xd21b('0xc')};function VoiceQueue(_0x2a62ee){this['id']=_0x2a62ee['id']||0x0;this['name']=_0x2a62ee[_0xd21b('0xd')]||'';this[_0xd21b('0xe')]=_0x2a62ee[_0xd21b('0xe')]||'';this['type']=_0x2a62ee[_0xd21b('0xf')]||_0xd21b('0x10');this['waiting']=0x0;this[_0xd21b('0x11')]=0x0;this[_0xd21b('0x12')]=0x0;this[_0xd21b('0x13')]=0x0;this[_0xd21b('0x14')]=0x0;this[_0xd21b('0x15')]=0x0;this[_0xd21b('0x16')]=0x0;this[_0xd21b('0x17')]=0x0;this[_0xd21b('0x18')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this['acw']=_0x2a62ee[_0xd21b('0x19')]||![];this[_0xd21b('0x1a')]=_0x2a62ee[_0xd21b('0x1a')]||0xa;this[_0xd21b('0x1b')]=_0x2a62ee[_0xd21b('0x1b')]||'no';this[_0xd21b('0x1c')]=!![];this[_0xd21b('0x1d')]='';this[_0xd21b('0x1e')]=0x0;this[_0xd21b('0x1f')]=0x0;this[_0xd21b('0x20')]=_0x2a62ee[_0xd21b('0x20')]||null;this[_0xd21b('0x21')]=_0x2a62ee[_0xd21b('0x21')]?_0x2a62ee[_0xd21b('0x21')]:null;this[_0xd21b('0x22')]=_0x2a62ee[_0xd21b('0x22')];this[_0xd21b('0x23')]=_0x2a62ee[_0xd21b('0x23')]||_0xd21b('0x24');this[_0xd21b('0x25')]=_0x2a62ee[_0xd21b('0x25')]||0x0;this[_0xd21b('0x26')]=_0x2a62ee['dialLimitQueue']||0x0;this[_0xd21b('0x27')]=_0x2a62ee['dialPowerLevel']||0x1;this[_0xd21b('0x28')]=_0x2a62ee[_0xd21b('0x28')]||_0xd21b('0x29');this[_0xd21b('0x2a')]=_0x2a62ee[_0xd21b('0x2a')]||0.03;this[_0xd21b('0x2b')]=_0x2a62ee[_0xd21b('0x2b')]||0x258;this['dialOriginateCallerIdName']=_0x2a62ee[_0xd21b('0x2c')]||'anonymous';this[_0xd21b('0x2d')]=_0x2a62ee[_0xd21b('0x2d')]||_0xd21b('0x2e');this['dialOriginateTimeout']=_0x2a62ee['dialOriginateTimeout']||0x1e;this[_0xd21b('0x2f')]=_0x2a62ee[_0xd21b('0x2f')]||'tTxX';this['dialQueueTimeout']=_0x2a62ee[_0xd21b('0x30')]||0x3;this[_0xd21b('0x31')]=_0x2a62ee[_0xd21b('0x31')]||undefined;this['dialCongestionMaxRetry']=_0x2a62ee[_0xd21b('0x32')]||0x3;this[_0xd21b('0x33')]=_0x2a62ee[_0xd21b('0x33')]||0x96;this[_0xd21b('0x34')]=_0x2a62ee['dialBusyMaxRetry']||0x3;this[_0xd21b('0x35')]=_0x2a62ee[_0xd21b('0x35')]||0x96;this[_0xd21b('0x36')]=_0x2a62ee['dialNoAnswerMaxRetry']||0x3;this[_0xd21b('0x37')]=_0x2a62ee[_0xd21b('0x37')]||0x96;this[_0xd21b('0x38')]=_0x2a62ee[_0xd21b('0x38')]||0x3;this[_0xd21b('0x39')]=_0x2a62ee[_0xd21b('0x39')]||0x96;this[_0xd21b('0x3a')]=_0x2a62ee[_0xd21b('0x3a')]||0x3;this[_0xd21b('0x3b')]=_0x2a62ee[_0xd21b('0x3b')]||0x96;this[_0xd21b('0x3c')]=_0x2a62ee[_0xd21b('0x3c')]||0x3;this[_0xd21b('0x3d')]=_0x2a62ee[_0xd21b('0x3d')]||0x96;this[_0xd21b('0x3e')]=_0x2a62ee[_0xd21b('0x3e')]||0x3;this[_0xd21b('0x3f')]=_0x2a62ee[_0xd21b('0x3f')]||0x96;this['dialAgentRejectMaxRetry']=_0x2a62ee['dialAgentRejectMaxRetry']||0x3;this[_0xd21b('0x40')]=_0x2a62ee['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x2a62ee[_0xd21b('0x41')]||0x4;this['Trunk']=_0x2a62ee[_0xd21b('0x42')]?_0x2a62ee[_0xd21b('0x42')]:undefined;this[_0xd21b('0x43')]=_0x2a62ee['TrunkBackup']?_0x2a62ee[_0xd21b('0x43')]:undefined;this[_0xd21b('0x44')]=_0x2a62ee[_0xd21b('0x44')]||undefined;this[_0xd21b('0x45')]=_0x2a62ee['Interval']?_0x2a62ee[_0xd21b('0x45')]:undefined;this[_0xd21b('0x46')]=_0x2a62ee[_0xd21b('0x46')]||_0xd21b('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x2a62ee[_0xd21b('0x48')]||undefined;this[_0xd21b('0x49')]=_0x2a62ee[_0xd21b('0x49')]||undefined;this[_0xd21b('0x4a')]=strategy[_0x2a62ee[_0xd21b('0x4a')]]||_0xd21b('0xb');this[_0xd21b('0x4b')]=!![];this[_0xd21b('0x4c')]=_0x2a62ee[_0xd21b('0x4c')]||![];this[_0xd21b('0x4d')]=_0x2a62ee[_0xd21b('0x4d')];this[_0xd21b('0x4e')]=_0x2a62ee[_0xd21b('0x4e')];this[_0xd21b('0x4f')]=_0x2a62ee['dialAMDAfterGreetingSilence'];this[_0xd21b('0x50')]=_0x2a62ee[_0xd21b('0x50')];this[_0xd21b('0x51')]=_0x2a62ee[_0xd21b('0x51')];this[_0xd21b('0x52')]=_0x2a62ee[_0xd21b('0x52')];this[_0xd21b('0x53')]=_0x2a62ee['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x2a62ee['dialAMDSilenceThreshold'];this[_0xd21b('0x54')]=_0x2a62ee['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xd21b('0x55')]=0x0;this[_0xd21b('0x56')]=_0x2a62ee[_0xd21b('0x56')];this[_0xd21b('0x57')]=0x0;this[_0xd21b('0x58')]=0x0;this[_0xd21b('0x59')]=0x0;this[_0xd21b('0x5a')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xd21b('0x5b')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xd21b('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xd21b('0x5d')]=0x0;this[_0xd21b('0x5e')]=0x0;this[_0xd21b('0x5f')]=0x0;this[_0xd21b('0x60')]=0x0;this[_0xd21b('0x61')]=0x0;this[_0xd21b('0x62')]=undefined;this[_0xd21b('0x63')]=undefined;this['handlePredictive']=undefined;this[_0xd21b('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xd21b('0x65')]=0x0;this[_0xd21b('0x66')]=0x0;this[_0xd21b('0x67')]=0x0;this[_0xd21b('0x68')]=0x0;this[_0xd21b('0x69')]=0x0;this[_0xd21b('0x6a')]=0x0;this[_0xd21b('0x6b')]=0x0;this[_0xd21b('0x6c')]=_0x2a62ee[_0xd21b('0x6d')]||0x14;this[_0xd21b('0x6e')]=_0x2a62ee[_0xd21b('0x6d')]||0xa;this[_0xd21b('0x6f')]=0x0;this[_0xd21b('0x70')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xd21b('0x71')]=0x0;this['erlangCallToSecond']=0x0;this[_0xd21b('0x72')]=0x0;this['erlangBusyFactor']=0x0;this[_0xd21b('0x73')]=_0x2a62ee[_0xd21b('0x73')]||0x1e;this[_0xd21b('0x74')]=_0x2a62ee[_0xd21b('0x74')]||![];this[_0xd21b('0x75')]=!!_0x2a62ee[_0xd21b('0x75')]||![];this[_0xd21b('0x76')]=_0x2a62ee[_0xd21b('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x2a62ee['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x2a62ee[_0xd21b('0x77')]||![];this[_0xd21b('0xe')]=monitorFormat[_0x2a62ee[_0xd21b('0xe')]]?monitorFormat[_0x2a62ee[_0xd21b('0xe')]]:undefined;this[_0xd21b('0x78')]=_0x2a62ee[_0xd21b('0x78')]||![];this[_0xd21b('0x79')]=_0x2a62ee[_0xd21b('0x79')]?_0x2a62ee[_0xd21b('0x79')]:undefined;}module[_0xd21b('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b4ecc06..726b08c 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 _0xa723=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x3c59ab,_0x338fa6){var _0x4b91c9=function(_0x122ddc){while(--_0x122ddc){_0x3c59ab['push'](_0x3c59ab['shift']());}};_0x4b91c9(++_0x338fa6);}(_0xa723,0x93));var _0x3a72=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0xa723[_0x4f0e62];return _0x117ab8;};'use strict';function VtigerAccount(_0x341732){this['id']=_0x341732['id']||0x0;this[_0x3a72('0x0')]=_0x341732['name']||'';this['username']=_0x341732[_0x3a72('0x1')]||'';this['accessKey']=_0x341732[_0x3a72('0x2')]||'';this['remoteUri']=_0x341732[_0x3a72('0x3')]||'';this['serverUrl']=_0x341732[_0x3a72('0x4')]||'';this[_0x3a72('0x5')]=_0x341732[_0x3a72('0x5')]||{};}module[_0x3a72('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe84f=['username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0xe84f,0xde));var _0xfe84=function(_0x7601ef,_0x1bfd2a){_0x7601ef=_0x7601ef-0x0;var _0x58c7d4=_0xe84f[_0x7601ef];return _0x58c7d4;};'use strict';function VtigerAccount(_0x3a4330){this['id']=_0x3a4330['id']||0x0;this['name']=_0x3a4330['name']||'';this[_0xfe84('0x0')]=_0x3a4330[_0xfe84('0x0')]||'';this['accessKey']=_0x3a4330[_0xfe84('0x1')]||'';this[_0xfe84('0x2')]=_0x3a4330[_0xfe84('0x2')]||'';this[_0xfe84('0x3')]=_0x3a4330[_0xfe84('0x3')]||'';this[_0xfe84('0x4')]=_0x3a4330[_0xfe84('0x4')]||{};}module[_0xfe84('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index fca5f26..dc5d0ac 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 _0x4ac1=['token','remoteUri','authType','type','serverUrl','Configurations','name','username','password'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4ac1,0x126));var _0x14ac=function(_0x1f275c,_0x7fc44a){_0x1f275c=_0x1f275c-0x0;var _0x3ac266=_0x4ac1[_0x1f275c];return _0x3ac266;};'use strict';function ZendeskAccount(_0x496bcc){this['id']=_0x496bcc['id']||0x0;this[_0x14ac('0x0')]=_0x496bcc[_0x14ac('0x0')]||'';this[_0x14ac('0x1')]=_0x496bcc[_0x14ac('0x1')]||'';this[_0x14ac('0x2')]=_0x496bcc['password']||'';this['token']=_0x496bcc[_0x14ac('0x3')]||'';this['remoteUri']=_0x496bcc[_0x14ac('0x4')]||'';this[_0x14ac('0x5')]=_0x496bcc[_0x14ac('0x5')]||'';this[_0x14ac('0x6')]=_0x496bcc[_0x14ac('0x6')]||'integrationTab';this['serverUrl']=_0x496bcc[_0x14ac('0x7')]||'';this[_0x14ac('0x8')]=_0x496bcc[_0x14ac('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xc60e=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc60e,0x16b));var _0xec60=function(_0x40fb00,_0x4da8f6){_0x40fb00=_0x40fb00-0x0;var _0x31754c=_0xc60e[_0x40fb00];return _0x31754c;};'use strict';function ZendeskAccount(_0x570f59){this['id']=_0x570f59['id']||0x0;this[_0xec60('0x0')]=_0x570f59[_0xec60('0x0')]||'';this['username']=_0x570f59[_0xec60('0x1')]||'';this['password']=_0x570f59[_0xec60('0x2')]||'';this[_0xec60('0x3')]=_0x570f59[_0xec60('0x3')]||'';this[_0xec60('0x4')]=_0x570f59['remoteUri']||'';this['authType']=_0x570f59[_0xec60('0x5')]||'';this['type']=_0x570f59['type']||_0xec60('0x6');this[_0xec60('0x7')]=_0x570f59[_0xec60('0x7')]||'';this['Configurations']=_0x570f59[_0xec60('0x8')]||{};}module[_0xec60('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a9bfac1..49c5dbd 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 _0x18e0=['exports','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x18e0,0x1a5));var _0x018e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x18e0[_0x5d6456];return _0x4d66c1;};'use strict';function ZohoAccount(_0x524b92){this['id']=_0x524b92['id']||0x0;this['name']=_0x524b92['name']||'';this['description']=_0x524b92[_0x018e('0x0')]||'';this[_0x018e('0x1')]=_0x524b92['host']||'';this[_0x018e('0x2')]=_0x524b92[_0x018e('0x2')]||'';this[_0x018e('0x3')]=_0x524b92[_0x018e('0x3')]||'';this['clientSecret']=_0x524b92[_0x018e('0x4')]||'';this[_0x018e('0x5')]=_0x524b92[_0x018e('0x5')]||'';this[_0x018e('0x6')]=_0x524b92[_0x018e('0x6')]||'';this['refreshToken']=_0x524b92[_0x018e('0x7')]||'';this[_0x018e('0x8')]=_0x524b92[_0x018e('0x8')]||{};}module[_0x018e('0x9')]=ZohoAccount; \ No newline at end of file +var _0x24f1=['code','refreshToken','exports','name','description','host','clientSecret','serverUrl'];(function(_0x331b91,_0x34af38){var _0x457cbb=function(_0x11b430){while(--_0x11b430){_0x331b91['push'](_0x331b91['shift']());}};_0x457cbb(++_0x34af38);}(_0x24f1,0x73));var _0x124f=function(_0x5ce10e,_0x305435){_0x5ce10e=_0x5ce10e-0x0;var _0x292382=_0x24f1[_0x5ce10e];return _0x292382;};'use strict';function ZohoAccount(_0x49f589){this['id']=_0x49f589['id']||0x0;this['name']=_0x49f589[_0x124f('0x0')]||'';this[_0x124f('0x1')]=_0x49f589[_0x124f('0x1')]||'';this[_0x124f('0x2')]=_0x49f589[_0x124f('0x2')]||'';this['zone']=_0x49f589['zone']||'';this['clientId']=_0x49f589['clientId']||'';this[_0x124f('0x3')]=_0x49f589[_0x124f('0x3')]||'';this[_0x124f('0x4')]=_0x49f589[_0x124f('0x4')]||'';this[_0x124f('0x5')]=_0x49f589['code']||'';this[_0x124f('0x6')]=_0x49f589[_0x124f('0x6')]||'';this['Configurations']=_0x49f589['Configurations']||{};}module[_0x124f('0x7')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 7abad7c..c8cae4a 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 _0x6a3e=['lodash','isNil','string','uniqueid','idContact','type','campaigntype','queue','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','util'];(function(_0x5de8bf,_0x24e115){var _0x2be3e3=function(_0x385e2c){while(--_0x385e2c){_0x5de8bf['push'](_0x5de8bf['shift']());}};_0x2be3e3(++_0x24e115);}(_0x6a3e,0x16f));var _0xe6a3=function(_0x2bc17a,_0x14052b){_0x2bc17a=_0x2bc17a-0x0;var _0x4c491e=_0x6a3e[_0x2bc17a];return _0x4c491e;};'use strict';var util=require(_0xe6a3('0x0'));var _=require(_0xe6a3('0x1'));var moment=require('moment');function checkNameSurname(_0x13b2ec,_0x5a41d4,_0x36a324){var _0x565894='';if(!_[_0xe6a3('0x2')](_0x5a41d4)&&_0xe6a3('0x3')===typeof _0x5a41d4){_0x565894+=_0x5a41d4;}if(!_[_0xe6a3('0x2')](_0x36a324)&&_0xe6a3('0x3')===typeof _0x36a324){_0x565894+='\x20'+_0x36a324;}if(_0x565894!==''){return _0x565894;}return _0x13b2ec;}function Action(_0x4e9640,_0x2cf459,_0x5dd414,_0x6a2a50,_0x34ab8f){this[_0xe6a3('0x4')]=_0x5dd414||undefined;this[_0xe6a3('0x5')]=_0x4e9640['id'];this['queue']=_0x2cf459['name'];this[_0xe6a3('0x6')]=_0x2cf459['type'];this[_0xe6a3('0x7')]=_0xe6a3('0x8');this[_0xe6a3('0x9')]=![];this['membername']=_[_0xe6a3('0x2')](_0x4e9640['Agent'])?undefined:_0x4e9640[_0xe6a3('0xa')][_0xe6a3('0xb')];this[_0xe6a3('0xc')]=this[_0xe6a3('0xd')]?util[_0xe6a3('0xe')](_0xe6a3('0xf'),this[_0xe6a3('0xd')]):_0x6a2a50||undefined;this[_0xe6a3('0x10')]=checkNameSurname(_0x4e9640['Contact'][_0xe6a3('0x11')],_0x4e9640[_0xe6a3('0x12')][_0xe6a3('0x13')],_0x4e9640[_0xe6a3('0x12')][_0xe6a3('0x14')]);this[_0xe6a3('0x15')]=_0x4e9640[_0xe6a3('0x15')]||![];this[_0xe6a3('0x16')]=_0x4e9640['Contact'][_0xe6a3('0x11')];this['scheduledat']=_0x4e9640[_0xe6a3('0x17')];this[_0xe6a3('0x18')]=_0x4e9640[_0xe6a3('0x18')]||0x0;this[_0xe6a3('0x19')]=_0x4e9640['countcongestionretry']||0x0;this[_0xe6a3('0x1a')]=_0x4e9640['countnoanswerretry']||0x0;this[_0xe6a3('0x1b')]=(_0x4e9640[_0xe6a3('0x18')]||0x0)+(_0x4e9640[_0xe6a3('0x19')]||0x0)+(_0x4e9640[_0xe6a3('0x1a')]||0x0)+(_0x4e9640['countnosuchnumberretry']||0x0)+(_0x4e9640['countdropretry']||0x0)+(_0x4e9640[_0xe6a3('0x1c')]||0x0)+(_0x4e9640[_0xe6a3('0x1d')]||0x0)+(_0x4e9640[_0xe6a3('0x1e')]||0x0);this[_0xe6a3('0x1f')]=_0x4e9640[_0xe6a3('0x1f')]||0x0;this['countdropretry']=_0x4e9640[_0xe6a3('0x20')]||0x0;this[_0xe6a3('0x1c')]=_0x4e9640[_0xe6a3('0x1c')]||0x0;this[_0xe6a3('0x1d')]=_0x4e9640['countmachineretry']||0x0;this[_0xe6a3('0x1e')]=_0x4e9640['countagentrejectretry']||0x0;this[_0xe6a3('0x21')]=_0x4e9640[_0xe6a3('0x21')];this[_0xe6a3('0x22')]=_0x4e9640[_0xe6a3('0x22')];this[_0xe6a3('0x23')]=_0x4e9640[_0xe6a3('0x23')];this[_0xe6a3('0x24')]=_0x4e9640[_0xe6a3('0x24')];this[_0xe6a3('0x25')]=_0x4e9640[_0xe6a3('0x25')];this[_0xe6a3('0x26')]=_0x4e9640[_0xe6a3('0x26')];this[_0xe6a3('0x27')]=_[_0xe6a3('0x2')](_0x4e9640[_0xe6a3('0xa')])?_0x4e9640[_0xe6a3('0x27')]:_0x4e9640[_0xe6a3('0xa')]['id'];this[_0xe6a3('0x28')]=_0x4e9640[_0xe6a3('0x28')];this[_0xe6a3('0x29')]='';this[_0xe6a3('0x2a')]='';}Action['prototype'][_0xe6a3('0x2b')]=function(){return util[_0xe6a3('0xe')](_0xe6a3('0x2c'),this[_0xe6a3('0x10')],this[_0xe6a3('0x2d')]);};module['exports']=Action; \ No newline at end of file +var _0x9dc0=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','calleridname','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','format','SIP/%s','membername','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry'];(function(_0xfac045,_0x2a52e5){var _0xf1a728=function(_0x18e91a){while(--_0x18e91a){_0xfac045['push'](_0xfac045['shift']());}};_0xf1a728(++_0x2a52e5);}(_0x9dc0,0x1cc));var _0x09dc=function(_0x4776cc,_0x3a715e){_0x4776cc=_0x4776cc-0x0;var _0x427bda=_0x9dc0[_0x4776cc];return _0x427bda;};'use strict';var util=require(_0x09dc('0x0'));var _=require(_0x09dc('0x1'));var moment=require(_0x09dc('0x2'));function checkNameSurname(_0x18389d,_0x3a03d7,_0xce32f2){var _0x3f22de='';if(!_[_0x09dc('0x3')](_0x3a03d7)&&_0x09dc('0x4')===typeof _0x3a03d7){_0x3f22de+=_0x3a03d7;}if(!_[_0x09dc('0x3')](_0xce32f2)&&_0x09dc('0x4')===typeof _0xce32f2){_0x3f22de+='\x20'+_0xce32f2;}if(_0x3f22de!==''){return _0x3f22de;}return _0x18389d;}function Action(_0xddc403,_0x763981,_0x12e3e9,_0x569ab5,_0x367697){this[_0x09dc('0x5')]=_0x12e3e9||undefined;this['idContact']=_0xddc403['id'];this[_0x09dc('0x6')]=_0x763981[_0x09dc('0x7')];this[_0x09dc('0x8')]=_0x763981['type'];this[_0x09dc('0x9')]=_0x09dc('0x6');this[_0x09dc('0xa')]=![];this['membername']=_[_0x09dc('0x3')](_0xddc403['Agent'])?undefined:_0xddc403[_0x09dc('0xb')][_0x09dc('0x7')];this[_0x09dc('0xc')]=this['membername']?util[_0x09dc('0xd')](_0x09dc('0xe'),this[_0x09dc('0xf')]):_0x569ab5||undefined;this['calleridname']=checkNameSurname(_0xddc403[_0x09dc('0x10')][_0x09dc('0x11')],_0xddc403[_0x09dc('0x10')][_0x09dc('0x12')],_0xddc403[_0x09dc('0x10')][_0x09dc('0x13')]);this[_0x09dc('0x14')]=_0xddc403[_0x09dc('0x14')]||![];this[_0x09dc('0x15')]=_0xddc403[_0x09dc('0x10')]['phone'];this['scheduledat']=_0xddc403[_0x09dc('0x16')];this['countbusyretry']=_0xddc403[_0x09dc('0x17')]||0x0;this[_0x09dc('0x18')]=_0xddc403[_0x09dc('0x18')]||0x0;this['countnoanswerretry']=_0xddc403[_0x09dc('0x19')]||0x0;this[_0x09dc('0x1a')]=(_0xddc403[_0x09dc('0x17')]||0x0)+(_0xddc403[_0x09dc('0x18')]||0x0)+(_0xddc403[_0x09dc('0x19')]||0x0)+(_0xddc403[_0x09dc('0x1b')]||0x0)+(_0xddc403[_0x09dc('0x1c')]||0x0)+(_0xddc403[_0x09dc('0x1d')]||0x0)+(_0xddc403[_0x09dc('0x1e')]||0x0)+(_0xddc403[_0x09dc('0x1f')]||0x0);this['countnosuchnumberretry']=_0xddc403[_0x09dc('0x1b')]||0x0;this['countdropretry']=_0xddc403[_0x09dc('0x1c')]||0x0;this[_0x09dc('0x1d')]=_0xddc403[_0x09dc('0x1d')]||0x0;this[_0x09dc('0x1e')]=_0xddc403['countmachineretry']||0x0;this[_0x09dc('0x1f')]=_0xddc403[_0x09dc('0x1f')]||0x0;this[_0x09dc('0x20')]=_0xddc403['callback'];this[_0x09dc('0x21')]=_0xddc403[_0x09dc('0x21')];this[_0x09dc('0x22')]=_0xddc403[_0x09dc('0x22')];this[_0x09dc('0x23')]=_0xddc403['recallme'];this[_0x09dc('0x24')]=_0xddc403['ContactId'];this[_0x09dc('0x25')]=_0xddc403['ListId'];this[_0x09dc('0x26')]=_['isNil'](_0xddc403[_0x09dc('0xb')])?_0xddc403['UserId']:_0xddc403[_0x09dc('0xb')]['id'];this[_0x09dc('0x27')]=_0xddc403[_0x09dc('0x27')];this['originatecalleridnum']='';this[_0x09dc('0x28')]='';}Action[_0x09dc('0x29')][_0x09dc('0x2a')]=function(){return util[_0x09dc('0xd')]('\x22%s\x22\x20<%s>',this[_0x09dc('0x2b')],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3595859..69b0502 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 _0xa630=['[getContactRecallMe]','IsNotLoggedIn','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','ANSWER','responsetime','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','buildObj','complete','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','countbusyretry','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','merge','toLowerVariables','[originated][increment]','actionid','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','variables','keys','variable','addVariable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangBusyFactor','startPredictive','Trunk','name','callerid','Interval','stringify','md5','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','originated','message','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','campaignsPreview','clockClearZombieChannels','hasOwnProperty','booked','outbound','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','[RecallMe]','catch','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal'];(function(_0x427cb9,_0x36c350){var _0x22ed57=function(_0x5235e9){while(--_0x5235e9){_0x427cb9['push'](_0x427cb9['shift']());}};_0x22ed57(++_0x36c350);}(_0xa630,0xbe));var _0x0a63=function(_0x152630,_0x3cb558){_0x152630=_0x152630-0x0;var _0x47ad60=_0xa630[_0x152630];return _0x47ad60;};'use strict';var util=require(_0x0a63('0x0'));var _=require(_0x0a63('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x0a63('0x2'));var md5=require('md5');var Redis=require(_0x0a63('0x3'));var config=require('../../../config/environment');var logger=require(_0x0a63('0x4'))(_0x0a63('0x5'));var loggerAction=require(_0x0a63('0x4'))(_0x0a63('0x6'));var ami=require(_0x0a63('0x7'));var rpcDb=require('./rpcDb');var Action=require(_0x0a63('0x8'));var ut=require(_0x0a63('0x9'));config[_0x0a63('0xa')]=_[_0x0a63('0xb')](config[_0x0a63('0xa')],{'host':_0x0a63('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a63('0xa')]));var Sequence=function(){};Sequence[_0x0a63('0xd')][_0x0a63('0xe')]=function(_0x218142){this[_0x0a63('0xf')]=this[_0x0a63('0xf')]?this[_0x0a63('0xf')][_0x0a63('0x10')](_0x218142):_0x218142();};function Preview(_0x258511){this[_0x0a63('0x11')]=new Sequence();this['campaignsPreview']=_0x258511[_0x0a63('0x12')];this[_0x0a63('0x13')]=_0x258511[_0x0a63('0x13')];this[_0x0a63('0x14')]={};this['agents']=_0x258511[_0x0a63('0x15')];this['clockClearZombieChannels']=0x0;ami['on'](_0x0a63('0x16'),this[_0x0a63('0x17')][_0x0a63('0x18')](this));ami['on'](_0x0a63('0x19'),this[_0x0a63('0x1a')][_0x0a63('0x18')](this));ami['on'](_0x0a63('0x1b'),this[_0x0a63('0x1c')]['bind'](this));ami['on'](_0x0a63('0x1d'),this['syncDialEnd'][_0x0a63('0x18')](this));ami['on'](_0x0a63('0x1e'),this[_0x0a63('0x1f')][_0x0a63('0x18')](this));ami['on'](_0x0a63('0x20'),this[_0x0a63('0x21')][_0x0a63('0x18')](this));ami['on'](_0x0a63('0x22'),this[_0x0a63('0x23')][_0x0a63('0x18')](this));ami['on'](_0x0a63('0x24'),this['syncBlindTransfer']['bind'](this));this[_0x0a63('0x25')](this['campaignsPreview']);}function emit(_0x2fc87c,_0x5937df,_0x58513d){io['to'](_0x2fc87c)[_0x0a63('0x26')](_0x5937df,_0x58513d);}function emitCampaignPreview(_0x145625){if(_0x145625[_0x0a63('0x27')]==='outbound'){var _0x398a16={'id':_0x145625['id'],'name':_0x145625['name'],'strategy':_0x145625[_0x0a63('0x28')],'answered':_0x145625[_0x0a63('0x29')],'available':_0x145625[_0x0a63('0x2a')],'loggedIn':_0x145625[_0x0a63('0x2b')],'pTalking':_0x145625[_0x0a63('0x2c')],'sumBillable':_0x145625[_0x0a63('0x2d')],'sumDuration':_0x145625[_0x0a63('0x2e')],'sumHoldTime':_0x145625[_0x0a63('0x2f')]||0x0,'talking':_0x145625['talking'],'total':_0x145625['total'],'type':_0x145625['type'],'unmanaged':_0x145625['unmanaged'],'abandoned':_0x145625[_0x0a63('0x30')],'waiting':_0x145625['waiting'],'loggedInDb':_0x145625['loggedInDb'],'dialActive':_0x145625[_0x0a63('0x31')],'dialMethod':_0x145625[_0x0a63('0x32')],'dialOriginateCallerIdName':_0x145625[_0x0a63('0x33')],'dialOriginateCallerIdNumber':_0x145625[_0x0a63('0x34')],'dialOriginateTimeout':_0x145625['dialOriginateTimeout'],'dialPrefix':_0x145625[_0x0a63('0x35')],'outboundAnswerAgiCallsDay':_0x145625[_0x0a63('0x36')],'outboundAnswerCallsDay':_0x145625[_0x0a63('0x37')],'outboundBlacklistCallsDay':_0x145625['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x145625[_0x0a63('0x38')],'outboundCongestionCallsDay':_0x145625[_0x0a63('0x39')],'outboundDropCallsDayACS':_0x145625[_0x0a63('0x3a')],'outboundDropCallsDayCallersExit':_0x145625[_0x0a63('0x3b')],'outboundDropCallsDayTimeout':_0x145625[_0x0a63('0x3c')],'outboundNoAnswerCallsDay':_0x145625[_0x0a63('0x3d')],'outboundNoSuchCallsDay':_0x145625[_0x0a63('0x3e')],'outboundOriginateFailureCallsDay':_0x145625[_0x0a63('0x3f')],'outboundReCallsDay':_0x145625['outboundReCallsDay'],'outboundRejectCallsDay':_0x145625[_0x0a63('0x40')],'outboundUnknownCallsDay':_0x145625['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x145625[_0x0a63('0x41')],'predictiveIntervalAnsweredCalls':_0x145625[_0x0a63('0x42')],'predictiveIntervalAvgHoldtime':_0x145625[_0x0a63('0x43')],'predictiveIntervalAvgTalktime':_0x145625[_0x0a63('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x145625[_0x0a63('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x145625['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x145625[_0x0a63('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x145625[_0x0a63('0x47')],'predictiveIntervalHitRate':_0x145625[_0x0a63('0x48')],'predictiveIntervalMultiplicativeFactor':_0x145625[_0x0a63('0x49')],'predictiveIntervalPauses':_0x145625['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x145625[_0x0a63('0x4a')],'predictiveIntervalTotalCalls':_0x145625[_0x0a63('0x4b')],'message':_0x145625['message'],'originated':_0x145625['originated'],'erlangCalls':_0x145625[_0x0a63('0x4c')],'erlangCallToSecond':_0x145625['erlangCallToSecond'],'erlangAbandonmentRate':_0x145625['erlangAbandonmentRate'],'erlangBusyFactor':_0x145625[_0x0a63('0x4d')],'startPredictive':_0x145625[_0x0a63('0x4e')],'startProgressive':_0x145625['startProgressive']};if(_0x145625[_0x0a63('0x4f')]){_0x398a16[_0x0a63('0x4f')]={'id':_0x145625[_0x0a63('0x4f')]['id'],'name':_0x145625[_0x0a63('0x4f')][_0x0a63('0x50')],'active':_0x145625['Trunk']['active'],'callerid':_0x145625[_0x0a63('0x4f')][_0x0a63('0x51')]};}if(_0x145625[_0x0a63('0x52')]){_0x398a16[_0x0a63('0x52')]={'id':_0x145625[_0x0a63('0x52')]['id'],'name':_0x145625[_0x0a63('0x52')]['name']};}var _0x307fe2=md5(JSON[_0x0a63('0x53')](_0x398a16));if(_0x145625['md5']!==_0x307fe2){_0x145625[_0x0a63('0x54')]=_0x307fe2;emit(util['format']('voice:queue:%s',_0x398a16[_0x0a63('0x50')]),_0x0a63('0x55'),_0x398a16);}}}function emitVoiceQueueChannelRemove(_0xdc602c){logger['info'](_0x0a63('0x56'),JSON[_0x0a63('0x53')](_0xdc602c));emit(util[_0x0a63('0x57')](_0x0a63('0x58'),_0xdc602c[_0x0a63('0x50')]),_0x0a63('0x59'),_0xdc602c);io[_0x0a63('0x26')]('voice_queue_presence:remove',_0xdc602c);}function notSendMessagesQueue(_0x368454){if(_0x368454[_0x0a63('0x5a')]){if(_0x368454[_0x0a63('0x5b')]===0x0&&_0x368454['pTalking']===0x0){_0x368454['sendMessageOneNotActive']=![];_0x368454[_0x0a63('0x2a')]=0x0;_0x368454['paused']=0x0;_0x368454[_0x0a63('0x5c')]=_0x0a63('0x5d');ut[_0x0a63('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x368454[_0x0a63('0x50')]+_0x0a63('0x5f'));}else{_0x368454[_0x0a63('0x5c')]=_0x0a63('0x60');ut['logger'](_0x0a63('0x61'),_0x368454[_0x0a63('0x50')]+_0x0a63('0x62'));}emitCampaignPreview(_0x368454);}}Preview[_0x0a63('0xd')][_0x0a63('0x25')]=function(){var _0x38cfe4=this;setInterval(function(){_0x38cfe4['syncCampaigns']();},0x7cf);};Preview[_0x0a63('0xd')][_0x0a63('0x63')]=function(){var _0x347a0b=this[_0x0a63('0x64')];this[_0x0a63('0x65')]+=0x1;for(var _0x2482ca in _0x347a0b){if(_0x347a0b[_0x0a63('0x66')](_0x2482ca)&&(_0x347a0b[_0x2482ca][_0x0a63('0x32')]===_0x0a63('0x5')||_0x347a0b[_0x2482ca][_0x0a63('0x32')]===_0x0a63('0x67'))&&_0x347a0b[_0x2482ca][_0x0a63('0x27')]===_0x0a63('0x68')){if(this[_0x0a63('0x65')]>0x7){this[_0x0a63('0x65')]=0x0;this[_0x0a63('0x69')]();}}if(_0x347a0b[_0x0a63('0x66')](_0x2482ca)&&_0x347a0b[_0x2482ca][_0x0a63('0x32')]==='preview'&&_0x347a0b[_0x2482ca][_0x0a63('0x27')]==='outbound'){if(_0x347a0b[_0x2482ca]['dialActive']){this[_0x0a63('0x6a')](_0x347a0b[_0x2482ca]);if(_0x347a0b[_0x2482ca][_0x0a63('0x6b')])this[_0x0a63('0x6c')](_0x347a0b[_0x2482ca]);}else{notSendMessagesQueue(_0x347a0b[_0x2482ca]);}}}};Preview[_0x0a63('0xd')][_0x0a63('0x6d')]=function(_0x9c89ed){var _0x397624=this;this[_0x0a63('0x11')][_0x0a63('0xe')](function(){if(!_[_0x0a63('0x6e')](_0x397624[_0x0a63('0x14')][_0x9c89ed])){loggerAction[_0x0a63('0x6f')](_0x0a63('0x70'),_0x9c89ed,_0x0a63('0x71'),_0x397624[_0x0a63('0x14')][_0x9c89ed][_0x0a63('0x72')],_0x0a63('0x73'),JSON[_0x0a63('0x53')](_0x397624[_0x0a63('0x64')][_0x397624[_0x0a63('0x14')][_0x9c89ed]['queue']][_0x0a63('0x5b')]),_0x0a63('0x74'),JSON['stringify'](_0x397624['campaignsPreview'][_0x397624['actions'][_0x9c89ed]['queue']][_0x0a63('0x2c')]),JSON[_0x0a63('0x53')](_0x397624['actions'][_0x9c89ed][_0x0a63('0x75')]),JSON['stringify'](_[_0x0a63('0x76')](_0x397624[_0x0a63('0x14')][_0x9c89ed],['contactId','UserId','VoiceQueueId',_0x0a63('0x77')])));return ami[_0x0a63('0x78')]({'action':_0x0a63('0x79'),'channel':_0x397624[_0x0a63('0x14')][_0x9c89ed][_0x0a63('0x7a')]})['catch'](function(_0x1d6008){if(_0x1d6008[_0x0a63('0x5c')]===_0x0a63('0x7b')){setTimeout(function(){if(_0x397624[_0x0a63('0x14')][_0x9c89ed]){ut[_0x0a63('0x7c')](_0x397624['campaignsPreview'][_0x397624[_0x0a63('0x14')][_0x9c89ed][_0x0a63('0x72')]],_0x0a63('0x7d'));if(_0x397624[_0x0a63('0x14')][_0x9c89ed]['dialAnswer']===!![]){ut[_0x0a63('0x7e')](_0x397624[_0x0a63('0x64')][_0x397624[_0x0a63('0x14')][_0x9c89ed][_0x0a63('0x72')]],_0x0a63('0x7d'));ut[_0x0a63('0x7f')]('[Dialer][checkChannel][pTalking][Preview]'+_0x9c89ed,_0x397624[_0x0a63('0x14')][_0x9c89ed][_0x0a63('0x72')]);}ut[_0x0a63('0x7f')](_0x0a63('0x80')+_0x9c89ed,_0x397624['actions'][_0x9c89ed]['queue']);delete _0x397624[_0x0a63('0x14')][_0x9c89ed];}},0x2328);}});}});};Preview[_0x0a63('0xd')][_0x0a63('0x69')]=function(){var _0x2f32ae=this;loggerAction[_0x0a63('0x6f')]('[action]',_['size'](this['actions']));for(var _0x42c1bb in this['actions']){if(_0x2f32ae[_0x0a63('0x14')][_0x0a63('0x66')](_0x42c1bb)){_0x2f32ae[_0x0a63('0x6d')](_0x42c1bb);}}};Preview['prototype']['recallMe']=function(_0x2d63c6){var _0x226279=this;rpcDb[_0x0a63('0x81')](_0x2d63c6['id'],ut[_0x0a63('0x82')](this[_0x0a63('0x15')]))[_0x0a63('0x83')](function(_0x21502e){if(!_[_0x0a63('0x6e')](_0x21502e)){for(var _0xe454ef=0x0;_0xe454ef<_0x21502e[_0x0a63('0x84')];_0xe454ef+=0x1){if(ut[_0x0a63('0x85')](_0x21502e[_0xe454ef][_0x0a63('0x86')])<_0x2d63c6[_0x0a63('0x87')]*0x3c){if(_0x21502e[_0xe454ef][_0x0a63('0x88')]&&!_0x21502e[_0xe454ef]['Agent']['voicePause']){_0x226279[_0x0a63('0x89')](_0x21502e[_0xe454ef]['id'])[_0x0a63('0x83')](ut['logger2'](_0x0a63('0x8a')))[_0x0a63('0x8b')](ut['logger2'](_0x0a63('0x8a')));}else{rpcDb[_0x0a63('0x8c')](_0x21502e[_0xe454ef]['id']);}}else{var _0x5e5495=new Action(_0x21502e[_0xe454ef],_0x2d63c6);_0x5e5495['starttime']=moment()[_0x0a63('0x57')](_0x0a63('0x8d'));_0x2d63c6[_0x0a63('0x8e')]+=0x1;ut['logCustomer'](_0x5e5495,0x17,_0x0a63('0x8f'));if(_0x2d63c6[_0x0a63('0x90')]){rpcDb[_0x0a63('0x91')](ut[_0x0a63('0x92')](_0x21502e[_0xe454ef]));rpcDb[_0x0a63('0x93')](_0x5e5495,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x0a63('0x94')](_0x5e5495,0x16,_0x0a63('0x95'));rpcDb[_0x0a63('0x93')](_0x5e5495,_0x0a63('0x96'));rpcDb[_0x0a63('0x97')](_0x5e5495,_0x0a63('0x96'));}}}}})[_0x0a63('0x8b')](ut['logger2'](_0x0a63('0x98')));};Preview[_0x0a63('0xd')][_0x0a63('0x6a')]=function(_0x1155f1){_0x1155f1[_0x0a63('0x5a')]=!![];if(ut[_0x0a63('0x99')](_0x1155f1[_0x0a63('0x2b')])){_0x1155f1[_0x0a63('0x5c')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x1155f1[_0x0a63('0x31')])){_0x1155f1[_0x0a63('0x5c')]=_0x0a63('0x5d');}else if(!this[_0x0a63('0x9a')](_0x1155f1[_0x0a63('0x4f')])){if(!this['isTrunkReachable'](_0x1155f1[_0x0a63('0x9b')])){_0x1155f1[_0x0a63('0x5c')]=_0x0a63('0x9c');}else{_0x1155f1[_0x0a63('0x5c')]=_0x0a63('0x9d');}}else{_0x1155f1[_0x0a63('0x5c')]=_0x0a63('0x9d');}emitCampaignPreview(_0x1155f1);};Preview[_0x0a63('0xd')][_0x0a63('0x9e')]=function(_0x35083d,_0x4acde8,_0x485969){var _0x25276f=this;var _0x5f33b2=this[_0x0a63('0x14')][_0x4acde8];var _0x34d88a=this['campaignsPreview'][_0x5f33b2['queue']];var _0x480acb;if(_0x34d88a){switch(_0x485969){case'1':_0x34d88a[_0x0a63('0x3e')]+=0x1;_0x5f33b2[_0x0a63('0x9f')]+=0x1;_0x5f33b2[_0x0a63('0xa0')]=ut[_0x0a63('0xa1')](_0x5f33b2);ut[_0x0a63('0x94')](_0x5f33b2,0x0,_0x0a63('0xa2'));ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x5f33b2,_0x0a63('0xa3')));rpcDb[_0x0a63('0x93')](_0x5f33b2,_0x0a63('0xa4'));if(ut[_0x0a63('0xa1')](_0x5f33b2)>=_0x34d88a['dialGlobalMaxRetry']){_0x480acb=ut[_0x0a63('0xa5')](_0x5f33b2,0xf,'Global');rpcDb['createCustomerFinal'](_0x480acb,_0x0a63('0xa6'));}else{if(_0x5f33b2['countnosuchnumberretry']>=_0x34d88a[_0x0a63('0xa7')]){rpcDb[_0x0a63('0x97')](_0x5f33b2,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x0a63('0xa8')](ut['scheduledAt'](_0x5f33b2,_0x0a63('0x9f'),_0x34d88a['dialNoSuchNumberRetryFrequency']),_0x5f33b2[_0x0a63('0xa9')],_0x5f33b2[_0x0a63('0xaa')]);}}delete this[_0x0a63('0x14')][_0x35083d['linkedid']];break;case _0x0a63('0xab'):var _0x2df35e=moment()[_0x0a63('0x57')](_0x0a63('0x8d'));_0x5f33b2[_0x0a63('0xac')]=_0x2df35e;_0x5f33b2['answertime']=_0x2df35e;_0x5f33b2['dialAnswer']=!![];_0x34d88a['pTalking']+=0x1;logger[_0x0a63('0x6f')]('[syncHangup][talking][increment]',_0x5f33b2[_0x0a63('0xad')],_0x0a63('0xae'),_0x34d88a[_0x0a63('0x50')],_0x0a63('0x74'),_0x34d88a['pTalking']);ami[_0x0a63('0x26')](_0x0a63('0xaf'),ut['buildObj'](_0x5f33b2,_0x0a63('0xb0'),this[_0x0a63('0x64')][_0x5f33b2[_0x0a63('0x72')]]));if(_0x34d88a[_0x0a63('0xb1')]){ami[_0x0a63('0x26')]('custom:agentConnectPreview',ut[_0x0a63('0xb2')](_0x5f33b2));}break;case'16':ami[_0x0a63('0x26')](_0x0a63('0xb3'),ut['buildObj'](_0x5f33b2,'complete',this['campaignsPreview'][_0x5f33b2[_0x0a63('0x72')]]));emitVoiceQueueChannelRemove(ut[_0x0a63('0xb4')](_0x5f33b2,_0x0a63('0xb5')));_0x34d88a[_0x0a63('0x37')]+=0x1;_0x34d88a[_0x0a63('0xb6')]+=0x1;_0x34d88a[_0x0a63('0x29')]+=0x1;ut[_0x0a63('0x7e')](_0x34d88a,_0x0a63('0xb7'));_0x5f33b2[_0x0a63('0xa0')]=ut[_0x0a63('0xa1')](_0x5f33b2);ut['logCustomer'](_0x5f33b2,0x4,_0x0a63('0xb8'));rpcDb[_0x0a63('0x93')](_0x5f33b2,_0x0a63('0xb9'));rpcDb[_0x0a63('0x97')](_0x5f33b2,_0x0a63('0xba'));rpcDb[_0x0a63('0xbb')](_0x5f33b2);_0x34d88a['sumDuration']+=_0x5f33b2['talktime'];_0x34d88a[_0x0a63('0x2d')]+=_0x5f33b2[_0x0a63('0xbc')];logger[_0x0a63('0x6f')](_0x0a63('0xbd'),_0x5f33b2['uniqueid'],_0x0a63('0xae'),_0x34d88a['name'],_0x0a63('0x74'),_0x34d88a[_0x0a63('0x2c')]);delete this[_0x0a63('0x14')][_0x35083d[_0x0a63('0xbe')]];break;case'BUSY':_0x34d88a[_0x0a63('0x38')]+=0x1;_0x5f33b2[_0x0a63('0xbf')]+=0x1;_0x5f33b2[_0x0a63('0xa0')]=ut[_0x0a63('0xa1')](_0x5f33b2);ut['logCustomer'](_0x5f33b2,0x5,'Busy');ami[_0x0a63('0x26')]('custom:agentbusy',ut[_0x0a63('0xb4')](_0x5f33b2,_0x0a63('0xc0')));rpcDb[_0x0a63('0x93')](_0x5f33b2,_0x0a63('0xc1'));if(ut[_0x0a63('0xa1')](_0x5f33b2)>=_0x34d88a['dialGlobalMaxRetry']){_0x480acb=ut[_0x0a63('0xa5')](_0x5f33b2,0xf,_0x0a63('0xc2'));rpcDb[_0x0a63('0x97')](_0x480acb,_0x0a63('0xc3'));}else{if(_0x5f33b2[_0x0a63('0xbf')]>=_0x34d88a[_0x0a63('0xc4')]){rpcDb[_0x0a63('0x97')](_0x5f33b2,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0a63('0xa8')](ut[_0x0a63('0xc5')](_0x5f33b2,_0x0a63('0xbf'),_0x34d88a[_0x0a63('0xc6')]),_0x5f33b2['unlockAgent'],_0x5f33b2[_0x0a63('0xaa')]);}}break;case _0x0a63('0xc7'):_0x34d88a[_0x0a63('0x3d')]+=0x1;_0x5f33b2['countnoanswerretry']+=0x1;_0x5f33b2[_0x0a63('0xa0')]=ut[_0x0a63('0xa1')](_0x5f33b2);ut[_0x0a63('0x94')](_0x5f33b2,0x3,'NoAnswer');ami[_0x0a63('0x26')](_0x0a63('0xc8'),ut[_0x0a63('0xb4')](_0x5f33b2,_0x0a63('0xc9')));rpcDb[_0x0a63('0x93')](_0x5f33b2,_0x0a63('0xca'));if(ut[_0x0a63('0xa1')](_0x5f33b2)>=_0x34d88a[_0x0a63('0xcb')]){_0x480acb=ut[_0x0a63('0xa5')](_0x5f33b2,0xf,_0x0a63('0xc2'));rpcDb[_0x0a63('0x97')](_0x480acb,_0x0a63('0xcc'));}else{if(_0x5f33b2[_0x0a63('0xcd')]>=_0x34d88a[_0x0a63('0xce')]){rpcDb[_0x0a63('0x97')](_0x5f33b2,_0x0a63('0xca'));}else{rpcDb['rescheduleContact'](ut[_0x0a63('0xc5')](_0x5f33b2,'countnoanswerretry',_0x34d88a[_0x0a63('0xcf')]),_0x5f33b2[_0x0a63('0xa9')],_0x5f33b2['activeContact']);}}break;case _0x0a63('0xd0'):_0x34d88a[_0x0a63('0x39')]+=0x1;_0x5f33b2[_0x0a63('0xd1')]+=0x1;_0x5f33b2[_0x0a63('0xa0')]=ut[_0x0a63('0xa1')](_0x5f33b2);ut[_0x0a63('0x94')](_0x5f33b2,0x8,_0x0a63('0xd2'));ami[_0x0a63('0x26')](_0x0a63('0xd3'),ut['buildObj'](_0x5f33b2,_0x0a63('0xd4')));rpcDb['createCustomerHistory'](_0x5f33b2,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x0a63('0xa1')](_0x5f33b2)>=_0x34d88a[_0x0a63('0xcb')]){_0x480acb=ut[_0x0a63('0xa5')](_0x5f33b2,0xf,_0x0a63('0xc2'));rpcDb['createCustomerFinal'](_0x480acb,_0x0a63('0xd5'));}else{if(_0x5f33b2['countcongestionretry']>=_0x34d88a['dialCongestionMaxRetry']){rpcDb[_0x0a63('0x97')](_0x5f33b2,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x0a63('0xc5')](_0x5f33b2,_0x0a63('0xd1'),_0x34d88a[_0x0a63('0xc6')]),_0x5f33b2[_0x0a63('0xa9')],_0x5f33b2['activeContact']);}}break;case _0x0a63('0xd6'):_0x34d88a['outboundRejectCallsDay']+=0x1;_0x5f33b2[_0x0a63('0xd7')]+=0x1;_0x5f33b2['countglobal']=ut[_0x0a63('0xa1')](_0x5f33b2);ut['logCustomer'](_0x5f33b2,0x14,_0x0a63('0xd8'));ami[_0x0a63('0x26')](_0x0a63('0xd9'),ut[_0x0a63('0xb4')](_0x5f33b2,_0x0a63('0xda')));rpcDb[_0x0a63('0x93')](_0x5f33b2,_0x0a63('0xdb'));if(ut[_0x0a63('0xa1')](_0x5f33b2)>=_0x34d88a[_0x0a63('0xcb')]){_0x480acb=ut['cloneAction'](_0x5f33b2,0x14,_0x0a63('0xd8'));rpcDb['createCustomerFinal'](_0x480acb,_0x0a63('0xdc'));}else{if(_0x5f33b2[_0x0a63('0xd7')]>=_0x34d88a[_0x0a63('0xdd')]){rpcDb[_0x0a63('0x97')](_0x5f33b2,_0x0a63('0xdc'));}else{rpcDb['rescheduleContact'](ut[_0x0a63('0xc5')](_0x5f33b2,_0x0a63('0xd7'),_0x34d88a[_0x0a63('0xde')]),_0x5f33b2[_0x0a63('0xa9')],_0x5f33b2['activeContact']);}}break;case _0x0a63('0xdf'):_0x34d88a[_0x0a63('0x41')]+=0x1;_0x5f33b2['countabandonedretry']+=0x1;_0x5f33b2[_0x0a63('0xa0')]=ut[_0x0a63('0xa1')](_0x5f33b2);ut['logCustomer'](_0x5f33b2,0xb,_0x0a63('0xe0'));rpcDb[_0x0a63('0x93')](_0x5f33b2,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x5f33b2)>=_0x34d88a[_0x0a63('0xcb')]){_0x480acb=ut[_0x0a63('0xa5')](_0x5f33b2,0xf,_0x0a63('0xc2'));rpcDb[_0x0a63('0x97')](_0x480acb,_0x0a63('0xe1'));}else{if(_0x5f33b2[_0x0a63('0xe2')]>=_0x34d88a[_0x0a63('0xe3')]){rpcDb['createCustomerFinal'](_0x5f33b2,_0x0a63('0xe1'));}else{rpcDb[_0x0a63('0xa8')](ut['scheduledAt'](_0x5f33b2,_0x0a63('0xe4'),_0x34d88a[_0x0a63('0xe5')]),_0x5f33b2[_0x0a63('0xa9')],_0x5f33b2[_0x0a63('0xaa')]);}}break;case'18':_0x34d88a[_0x0a63('0xe6')]+=0x1;_0x5f33b2['countmachineretry']+=0x1;_0x5f33b2['countglobal']=ut[_0x0a63('0xa1')](_0x5f33b2);ut[_0x0a63('0x94')](_0x5f33b2,0x12,_0x35083d[_0x0a63('0xe7')]||_0x35083d['dialstatus']);ami['emit'](_0x0a63('0xe8'),ut['buildObj'](_0x5f33b2,'amd'));rpcDb[_0x0a63('0x93')](_0x5f33b2,_0x0a63('0xe9'));if(ut[_0x0a63('0xa1')](_0x5f33b2)>=_0x34d88a[_0x0a63('0xcb')]){_0x480acb=ut['cloneAction'](_0x5f33b2,0xf,'Global');rpcDb[_0x0a63('0x97')](_0x480acb,_0x0a63('0xe9'));}else{rpcDb['createCustomerFinal'](_0x5f33b2,_0x0a63('0xe9'));}delete this[_0x0a63('0x14')][_0x35083d[_0x0a63('0xbe')]];break;case'19':_0x34d88a['outboundUnknownCallsDay']+=0x1;_0x5f33b2[_0x0a63('0xa0')]=ut[_0x0a63('0xa1')](_0x5f33b2);ut['logCustomer'](_0x5f33b2,0x13,_0x35083d[_0x0a63('0xe7')]||_0x35083d[_0x0a63('0xea')]);ami[_0x0a63('0x26')](_0x0a63('0xe8'),ut[_0x0a63('0xb4')](_0x5f33b2,_0x0a63('0xeb')));rpcDb[_0x0a63('0x93')](_0x5f33b2,_0x0a63('0xec'));if(ut[_0x0a63('0xa1')](_0x5f33b2)>=_0x34d88a[_0x0a63('0xcb')]){_0x480acb=ut[_0x0a63('0xa5')](_0x5f33b2,0xf,_0x0a63('0xc2'));rpcDb[_0x0a63('0x97')](_0x480acb,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x0a63('0x97')](_0x5f33b2,_0x0a63('0xec'));}delete this[_0x0a63('0x14')][_0x35083d[_0x0a63('0xbe')]];break;default:if(_0x5f33b2[_0x0a63('0x75')]){ut['decrementTalkink'](_0x34d88a,_0x0a63('0xed'));ut['loggerError'](_0x0a63('0xee')+_0x34d88a['name'],_0x35083d);}_0x34d88a['outboundUnknownCallsDay']+=0x1;_0x5f33b2['countglobal']=ut[_0x0a63('0xa1')](_0x5f33b2);ut[_0x0a63('0x94')](_0x5f33b2,0xc,_0x35083d['cause-txt']||_0x35083d[_0x0a63('0xea')]);rpcDb['createCustomerHistory'](_0x5f33b2,_0x0a63('0xef'));if(ut['totalGlobal'](_0x5f33b2)>=_0x34d88a[_0x0a63('0xcb')]){_0x480acb=ut['cloneAction'](_0x5f33b2,0xf,_0x0a63('0xc2'));rpcDb[_0x0a63('0x97')](_0x480acb,_0x0a63('0xf0'));}else{rpcDb[_0x0a63('0x97')](_0x5f33b2,_0x0a63('0xf0'));}delete this[_0x0a63('0x14')][_0x35083d[_0x0a63('0xbe')]];}if(!(_0x5f33b2['dialAnswer']&&_0x485969==='16')){ut['updateOriginated'](_0x34d88a,_0x0a63('0xf1'));logger[_0x0a63('0x6f')](_0x0a63('0xf2'),_0x5f33b2[_0x0a63('0xad')],_0x0a63('0xae'),_0x34d88a['name'],_0x0a63('0x73'),_0x34d88a['originated']);}if(_0x485969!==_0x0a63('0xab')){delete this[_0x0a63('0x14')][_0x35083d[_0x0a63('0xbe')]];delete this['actions'][_0x35083d[_0x0a63('0xf3')]];}}};Preview['prototype'][_0x0a63('0xf4')]=function(_0x427188,_0x12a8cd,_0x4d6476){if(_[_0x0a63('0xf5')](_0x12a8cd)&&_0x0a63('0xf6')!==typeof _0x12a8cd){return;}if(_[_0x0a63('0xf5')](_0x4d6476)&&_0x0a63('0xf6')!==typeof _0x4d6476){return;}switch(_0x4d6476[_0x0a63('0xf7')]){case'0':ut[_0x0a63('0xf8')](_0x427188,0x0,'NoSuchNumber');rpcDb[_0x0a63('0xf9')](_0x427188,_0x0a63('0xfa'));break;case'3':ut[_0x0a63('0xf8')](_0x427188,0x3,'NoAnswer');rpcDb[_0x0a63('0xf9')](_0x427188,_0x0a63('0xfb'));break;case'5':ut['logAgent'](_0x427188,0x5,_0x0a63('0xfc'));rpcDb[_0x0a63('0xf9')](_0x427188,_0x0a63('0xfd'));break;case'8':ut[_0x0a63('0xf8')](_0x427188,0x8,_0x0a63('0xd2'));rpcDb[_0x0a63('0xf9')](_0x427188,_0x0a63('0xfe'));break;case'22':ut[_0x0a63('0xf8')](_0x427188,0x16,'AnswerAGI');rpcDb[_0x0a63('0xf9')](_0x427188,_0x0a63('0xff'));break;default:ut[_0x0a63('0xf8')](_0x427188,0xc,_0x4d6476[_0x0a63('0xf7')]);rpcDb[_0x0a63('0xf9')](_0x427188,'[callProgressDetectingAgent][logCongestion]');}ut[_0x0a63('0x7c')](_0x12a8cd,_0x0a63('0x100'));logger[_0x0a63('0x6f')](_0x0a63('0x101'),_0x427188[_0x0a63('0xad')],_0x0a63('0xae'),_0x12a8cd['name'],'originated:\x20',_0x12a8cd[_0x0a63('0x5b')]);delete this['actions'][_0x427188['uniqueid']];};Preview[_0x0a63('0xd')][_0x0a63('0x102')]=function(_0x49e374,_0x2d6918,_0x85bc7d,_0x2827ba,_0x1e6ce9){var _0x2f3999=this;return new BPromise(function(_0x2d9cca,_0x2fac62){if(_[_0x0a63('0x6e')](_0x2d6918)||_[_0x0a63('0x6e')](_0x2d6918[_0x0a63('0x103')])||_['isNil'](_0x2d6918[_0x0a63('0x103')][_0x0a63('0x104')])||_[_0x0a63('0x6e')](_0x2d6918[_0x0a63('0x105')])){_0x2fac62(ut['message'](_0x0a63('0x106'),_0x2827ba,_0x1e6ce9));return;}var _0x35becd=uuid['v4']();var _0x5d98e2=_0x2f3999[_0x0a63('0x64')][_0x2d6918[_0x0a63('0x71')][_0x0a63('0x50')]];var _0x495c5e=_0x85bc7d?_0x2f3999[_0x0a63('0x15')][_0x85bc7d]['id']:undefined;_0x2f3999[_0x0a63('0x14')][_0x35becd]=new Action(_0x2d6918,_0x5d98e2,_0x35becd,_0x85bc7d,_0x495c5e);var _0x304326=_0x2f3999[_0x0a63('0x14')][_0x35becd];_0x304326[_0x0a63('0xa9')]=_0x2827ba;_0x304326[_0x0a63('0xaa')]=_0x1e6ce9;_0x304326['lookAgent']=_0x85bc7d;if(_[_0x0a63('0x107')](_0x49e374)){_0x2f3999[_0x0a63('0x108')](_0x304326,_0x5d98e2,_0x2d6918,_0x85bc7d)[_0x0a63('0x83')](function(_0x2dc71a){logger[_0x0a63('0x6f')](_0x0a63('0x109'),'Queue:\x20'+_0x304326[_0x0a63('0x72')]+_0x0a63('0x10a')+_0x304326[_0x0a63('0x10b')],JSON['stringify'](_0x2dc71a));ami[_0x0a63('0x26')](_0x0a63('0x10c'),ut[_0x0a63('0xb4')](_0x304326,_0x0a63('0x10d'),_0x2f3999['campaignsPreview'][_0x304326[_0x0a63('0x72')]]));_0x2d9cca(ut[_0x0a63('0x5c')]('Calling'));})[_0x0a63('0x8b')](function(_0x36114e){ut[_0x0a63('0x5e')]('[Preview][execCall][failure]',_0x36114e);_0x2fac62(ut[_0x0a63('0x5c')](_0x0a63('0x10e'),_0x2827ba,_0x1e6ce9));});}else{_0x5d98e2[_0x0a63('0x10f')]+=0x1;ut[_0x0a63('0x110')](_0x304326);rpcDb['createHistory'](_0x304326,_0x0a63('0x111'));delete _0x2f3999['actions'][_0x35becd];_0x2fac62(ut[_0x0a63('0x5c')](_0x0a63('0x112'),_0x2827ba,_0x1e6ce9));}});};Preview[_0x0a63('0xd')]['isTrunkReachable']=function(_0x34de1c){return!_['isNil'](_0x34de1c)&&!_['isNil'](_0x34de1c[_0x0a63('0x50')])&&!_['isNil'](_0x34de1c[_0x0a63('0x113')])&&_0x34de1c[_0x0a63('0x113')]&&!_[_0x0a63('0x6e')](this[_0x0a63('0x13')][util[_0x0a63('0x57')](_0x0a63('0x114'),_0x34de1c['name'])])&&!_[_0x0a63('0x6e')](this[_0x0a63('0x13')][util[_0x0a63('0x57')](_0x0a63('0x114'),_0x34de1c[_0x0a63('0x50')])][_0x0a63('0x79')])&&(this[_0x0a63('0x13')][util[_0x0a63('0x57')](_0x0a63('0x114'),_0x34de1c[_0x0a63('0x50')])][_0x0a63('0x79')]===_0x0a63('0x115')||this[_0x0a63('0x13')][util[_0x0a63('0x57')](_0x0a63('0x114'),_0x34de1c[_0x0a63('0x50')])][_0x0a63('0x79')]===_0x0a63('0x116'));};Preview[_0x0a63('0xd')][_0x0a63('0x89')]=function(_0x5df424,_0x136618){var _0x590930=this;return new BPromise(function(_0x78b19f,_0x490556){_0x590930[_0x0a63('0x117')](_0x5df424,_0x136618)[_0x0a63('0x83')](function(_0x1f4881){_0x78b19f(_['pick'](_0x1f4881,['message']));})[_0x0a63('0x8b')](function(_0x526f8f){if(_0x526f8f[_0x0a63('0x118')]){rpcDb[_0x0a63('0x119')](_0x5df424);}if(_0x526f8f[_0x0a63('0x113')]){rpcDb['disableContact'](_0x5df424);}_0x490556(_[_0x0a63('0x76')](_0x526f8f,['message']));});});};Preview[_0x0a63('0xd')][_0x0a63('0x117')]=function(_0x135fc4,_0x279a38){var _0x53e677=this;return new BPromise(function(_0x372bf7,_0x4ff767){var _0xa3cfd5,_0x3f1428;rpcDb[_0x0a63('0x11a')](_0x135fc4)[_0x0a63('0x83')](function(_0x2e6dd3){if(!_[_0x0a63('0x6e')](_0x2e6dd3[0x0])){_0x3f1428=_0x2e6dd3[0x0][_0x0a63('0x11b')]?![]:!![];_0xa3cfd5=_0x2e6dd3[0x0][_0x0a63('0x11b')]?!![]:![];_0xa3cfd5=_0x279a38?!![]:_0xa3cfd5;}var _0xf94da0=_0x53e677[_0x0a63('0x11c')](_0x2e6dd3);if(_0xf94da0['isValid']){rpcDb[_0x0a63('0x11d')](_[_0x0a63('0x76')](_0x2e6dd3[0x0],['VoiceQueueId',_0x0a63('0x11e')]))['then'](function(_0x670e91){_0x53e677[_0x0a63('0x102')](_0x670e91,_0x2e6dd3[0x0],_0x279a38,_0x3f1428,_0xa3cfd5)[_0x0a63('0x83')](function(_0x4fa910){_0x372bf7(_0x4fa910);})[_0x0a63('0x8b')](function(_0x1f9ca6){_0x4ff767(_0x1f9ca6);});})[_0x0a63('0x8b')](function(_0xfd34d4){ut[_0x0a63('0x5e')]('[Preview][checkIsBlackList]',_0xfd34d4);_0x4ff767(ut['message'](_0x0a63('0x11f'),_0x3f1428,_0xa3cfd5));});}else{_0x4ff767(ut[_0x0a63('0x5c')](_0xf94da0[_0x0a63('0x5c')],_0x3f1428,_0xa3cfd5));}})['catch'](function(_0x2ca8a9){ut[_0x0a63('0x5e')](_0x0a63('0x120'),_0x2ca8a9);_0x4ff767(ut[_0x0a63('0x5c')](_0x0a63('0x11f'),![],!![]));});});};Preview[_0x0a63('0xd')][_0x0a63('0x11c')]=function(_0x584cbc){if(_[_0x0a63('0x6e')](_0x584cbc)||_[_0x0a63('0x107')](_0x584cbc)||!_['isNil'](_0x584cbc[0x0]['Agent'])&&_[_0x0a63('0x6e')](_0x584cbc[0x0][_0x0a63('0x88')][_0x0a63('0x50')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x584cbc);return{'isValid':![],'message':_0x0a63('0x121')};}var _0x2d40a2=this[_0x0a63('0x64')][_0x584cbc[0x0]['Queue']['name']];_0x2d40a2[_0x0a63('0x5c')]=_0x0a63('0x9d');if(_[_0x0a63('0x6e')](_0x2d40a2)){ut['logger'](_0x0a63('0x122'),_0x2d40a2);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x0a63('0x9a')](_0x2d40a2[_0x0a63('0x4f')])){ut['logger'](_0x0a63('0x123'),_0x0a63('0x124')+_0x2d40a2[_0x0a63('0x50')]+_0x0a63('0x125'));if(!this[_0x0a63('0x9a')](_0x2d40a2['TrunkBackup'])){ut[_0x0a63('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x2d40a2[_0x0a63('0x50')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x0a63('0x126')};}}if(!ut[_0x0a63('0x127')](_0x2d40a2[_0x0a63('0x31')])){ut[_0x0a63('0x5e')](_0x0a63('0x128'),_0x2d40a2[_0x0a63('0x50')]+_0x0a63('0x129'));return{'isValid':![],'message':_0x0a63('0x124')+_0x2d40a2[_0x0a63('0x50')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x0a63('0x12a')};};Preview[_0x0a63('0xd')]['execCall']=function(_0x276050,_0x2ffef0,_0x63755e,_0xf9a532){var _0x547032=this;return new BPromise(function(_0x392c07,_0x523a7e){var _0x58fc99=_0x276050[_0x0a63('0xad')];var _0x38f1d7=_0x547032[_0x0a63('0x9a')](_0x2ffef0[_0x0a63('0x4f')])?util[_0x0a63('0x57')](_0x0a63('0x12b'),_0x2ffef0['Trunk'][_0x0a63('0x50')],_[_0x0a63('0x6e')](_0x2ffef0[_0x0a63('0x35')])?'':_0x2ffef0[_0x0a63('0x35')][_0x0a63('0x12c')]()||'',_0x2ffef0['dialCutDigit']>0x0?_0x63755e[_0x0a63('0x103')][_0x0a63('0x104')][_0x0a63('0x12d')](_0x2ffef0[_0x0a63('0x12e')]):_0x63755e['Contact'][_0x0a63('0x104')]):util['format'](_0x0a63('0x12b'),_['isNil'](_0x2ffef0[_0x0a63('0x9b')])?_0x2ffef0[_0x0a63('0x4f')][_0x0a63('0x50')]:_0x2ffef0['TrunkBackup'][_0x0a63('0x50')],_[_0x0a63('0x6e')](_0x2ffef0[_0x0a63('0x35')])?'':_0x2ffef0['dialPrefix'][_0x0a63('0x12c')]()||'',_0x2ffef0[_0x0a63('0x12e')]>0x0?_0x63755e[_0x0a63('0x103')][_0x0a63('0x104')][_0x0a63('0x12d')](_0x2ffef0[_0x0a63('0x12e')]):_0x63755e[_0x0a63('0x103')][_0x0a63('0x104')]);var _0x1251df=_0x547032[_0x0a63('0x9a')](_0x2ffef0[_0x0a63('0x4f')])?ut['getCallerId'](_0x2ffef0[_0x0a63('0x4f')][_0x0a63('0x51')],_0x2ffef0['dialOriginateCallerIdName'],_0x2ffef0[_0x0a63('0x12f')]>0x0?ut['getCallerIdRandom'](_0x2ffef0[_0x0a63('0x34')],_0x2ffef0[_0x0a63('0x12f')]):_0x2ffef0[_0x0a63('0x34')]):ut[_0x0a63('0x130')](_[_0x0a63('0x6e')](_0x2ffef0[_0x0a63('0x9b')])?_0x2ffef0[_0x0a63('0x4f')][_0x0a63('0x51')]:_0x2ffef0[_0x0a63('0x9b')]['callerid'],_0x2ffef0[_0x0a63('0x33')],_0x2ffef0[_0x0a63('0x12f')]>0x0?ut[_0x0a63('0x131')](_0x2ffef0[_0x0a63('0x34')],_0x2ffef0[_0x0a63('0x12f')]):_0x2ffef0[_0x0a63('0x34')]);if(_0x1251df){_0x276050[_0x0a63('0x132')]=ut[_0x0a63('0x133')](_0x1251df);_0x276050['originatecalleridnum']=ut[_0x0a63('0x134')](_0x1251df);}var _0x28e34e=ut['addVariables'](_0x2ffef0,_0x63755e,_0x38f1d7,_0x1251df,_0x58fc99,_0x276050);_[_0x0a63('0x135')](_0x276050,ut[_0x0a63('0x136')](_0x28e34e));_0x276050['starttime']=moment()[_0x0a63('0x57')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut['variablesAction'](_0x276050,_0x2ffef0,_0x28e34e,_0x276050[_0x0a63('0xaa')],_0xf9a532))[_0x0a63('0x83')](function(_0xfe9f3d){_0x2ffef0['originated']+=0x1;logger['info'](_0x0a63('0x137'),_0x58fc99,_0x0a63('0xae'),_0x2ffef0[_0x0a63('0x50')],_0x0a63('0x73'),_0x2ffef0['originated']);_0x392c07(_0xfe9f3d);})[_0x0a63('0x8b')](function(_0x340389){ut[_0x0a63('0xf8')](_0x276050,0xe,'OriginateError');rpcDb[_0x0a63('0xf9')](_0x276050,'[originateFailure][logOriginateFailure]');_0x523a7e(_0x340389);});});};Preview[_0x0a63('0xd')][_0x0a63('0x1f')]=function(_0x5d7b3d){if(this['actions'][_0x5d7b3d[_0x0a63('0xbe')]]){this[_0x0a63('0x14')][_0x5d7b3d['linkedid']][_0x0a63('0x7a')]=_0x5d7b3d[_0x0a63('0x7a')];}};Preview[_0x0a63('0xd')][_0x0a63('0x17')]=function(_0x1db9db){var _0x434e20=this;var _0x52b861=this[_0x0a63('0x14')][_0x1db9db[_0x0a63('0x138')]];if(_0x52b861){if(_0x52b861[_0x0a63('0x139')]&&this[_0x0a63('0x15')][_0x52b861[_0x0a63('0x139')]]){ut[_0x0a63('0x13a')](_0x52b861,this[_0x0a63('0x15')][_0x52b861[_0x0a63('0x139')]][_0x0a63('0x50')],this['agents'][_0x52b861[_0x0a63('0x139')]]['id']);}var _0x52c170=_[_0x0a63('0x13b')](_0x52b861);_0x52c170[_0x0a63('0xac')]=moment()['format'](_0x0a63('0x8d'));var _0x578422=_0x434e20[_0x0a63('0x64')][_0x52b861['queue']];if(ut[_0x0a63('0x13c')](_0x1db9db[_0x0a63('0x13d')])){if(_0x52b861['unlockAgent']){rpcDb['unlockContact'](_0x52b861[_0x0a63('0x10b')]);}if(_0x52b861['activeContact']){rpcDb[_0x0a63('0x8c')](_0x52b861['idContact']);}ami[_0x0a63('0x26')](_0x0a63('0x13e'),ut[_0x0a63('0xb4')](_0x52b861,_0x0a63('0x13f'),this[_0x0a63('0x64')][_0x52b861['queue']]));this['callProgressDetectingAgent'](_0x52c170,_0x578422,_0x1db9db);}else{_0x52b861[_0x0a63('0x140')]=moment()[_0x0a63('0x57')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x0a63('0xf8')](_0x52c170,0x4,'Answer');rpcDb['createAgentHistory'](_0x52c170,_0x0a63('0x141'));}}};Preview[_0x0a63('0xd')]['syncHangup']=function(_0x1f6d7d){var _0x49a5bc=this;var _0x47095b=this[_0x0a63('0x14')][_0x1f6d7d[_0x0a63('0xbe')]];var _0x587823;if(_0x47095b){_0x587823=this[_0x0a63('0x64')][_0x47095b[_0x0a63('0x72')]];logger['info'](_0x0a63('0x142'),_0x1f6d7d[_0x0a63('0xbe')],_0x0a63('0xae'),_0x587823[_0x0a63('0x50')],_0x0a63('0x74'),_0x587823[_0x0a63('0x2c')]);}if(this[_0x0a63('0x14')][_0x1f6d7d[_0x0a63('0xbe')]]&&_0x1f6d7d[_0x0a63('0xbe')]!==_0x1f6d7d['uniqueid']){if(_0x1f6d7d[_0x0a63('0x143')]==='16'&&this[_0x0a63('0x14')][_0x1f6d7d['linkedid']][_0x0a63('0x75')]){this[_0x0a63('0x9e')](_0x1f6d7d,_0x1f6d7d[_0x0a63('0xbe')],_0x1f6d7d[_0x0a63('0x143')]);}else if(this['actions'][_0x1f6d7d['linkedid']][_0x0a63('0x75')]){logger['info'](_0x0a63('0x144'),_0x1f6d7d[_0x0a63('0xbe')],_0x1f6d7d['cause'],_0x0a63('0xae'),_0x587823[_0x0a63('0x50')],'pTalking:\x20',_0x587823[_0x0a63('0x2c')]);this[_0x0a63('0x9e')](_0x1f6d7d,_0x1f6d7d['linkedid'],_0x1f6d7d[_0x0a63('0x143')]);}}else if(_0x47095b&&_[_0x0a63('0x6e')](_0x47095b[_0x0a63('0x145')])&&_0x587823[_0x0a63('0x146')]&&_0x1f6d7d[_0x0a63('0xbe')]===_0x1f6d7d[_0x0a63('0xad')]&&_[_0x0a63('0x6e')](_0x1f6d7d[_0x0a63('0xf7')])&&_0x1f6d7d[_0x0a63('0x143')]==='16'&&_0x1f6d7d[_0x0a63('0x147')]==='6'&&_[_0x0a63('0xf5')](_0x47095b[_0x0a63('0x148')])){if(_0x47095b[_0x0a63('0xa9')]){rpcDb['unlockContact'](_0x47095b[_0x0a63('0x10b')]);}if(_0x47095b[_0x0a63('0xaa')]){rpcDb[_0x0a63('0x8c')](_0x47095b[_0x0a63('0x10b')]);}_0x1f6d7d[_0x0a63('0xf7')]='22';this[_0x0a63('0xf4')](_0x47095b,_0x587823,_0x1f6d7d);}else if(_0x47095b&&_0x47095b[_0x0a63('0x148')]){if(_0x1f6d7d[_0x0a63('0x143')]==='16'&&this[_0x0a63('0x14')][_0x1f6d7d['linkedid']][_0x0a63('0x75')]){logger[_0x0a63('0x6f')](_0x0a63('0x149'),_0x1f6d7d[_0x0a63('0xbe')],_0x1f6d7d['cause'],_0x0a63('0xae'),_0x587823[_0x0a63('0x50')],'pTalking:\x20',_0x587823['pTalking']);this['callProgressDetectingCustomer'](_0x1f6d7d,_0x1f6d7d[_0x0a63('0xbe')],_0x1f6d7d[_0x0a63('0x143')]);}else if(this[_0x0a63('0x14')][_0x1f6d7d[_0x0a63('0xbe')]][_0x0a63('0x75')]){logger['info'](_0x0a63('0x144'),_0x1f6d7d[_0x0a63('0xbe')],_0x1f6d7d[_0x0a63('0x143')],_0x0a63('0xae'),_0x587823[_0x0a63('0x50')],'pTalking:\x20',_0x587823[_0x0a63('0x2c')]);this[_0x0a63('0x9e')](_0x1f6d7d,_0x1f6d7d[_0x0a63('0xbe')],_0x1f6d7d['cause']);}}};Preview['prototype'][_0x0a63('0x14a')]=function(_0x39db5f){if(this[_0x0a63('0x14')][_0x39db5f[_0x0a63('0xf3')]]&&_0x39db5f[_0x0a63('0xf3')]!==_0x39db5f['destuniqueid']){this[_0x0a63('0x9e')](_0x39db5f,_0x39db5f[_0x0a63('0xf3')],_0x39db5f[_0x0a63('0xea')]);}};Preview[_0x0a63('0xd')][_0x0a63('0x1c')]=function(_0x5d48bd){if(this[_0x0a63('0x14')][_0x5d48bd[_0x0a63('0xbe')]]&&_0x5d48bd[_0x0a63('0xbe')]!==_0x5d48bd['uniqueid']&&!this['actions'][_0x5d48bd[_0x0a63('0xbe')]][_0x0a63('0x75')]){if(_0x5d48bd[_0x0a63('0x143')]==='1'){this[_0x0a63('0x9e')](_0x5d48bd,_0x5d48bd[_0x0a63('0xbe')],_0x5d48bd['cause']);}}};Preview['prototype']['addVariable']=function(_0x399edb,_0x50478c,_0x31db12){if(this[_0x0a63('0x14')][_0x399edb]){if(_['isNil'](this['actions'][_0x399edb][_0x0a63('0x14b')])){this[_0x0a63('0x14')][_0x399edb]['variables']={};}this[_0x0a63('0x14')][_0x399edb][_0x0a63('0x14b')][_0x50478c]=_0x31db12;}};Preview[_0x0a63('0xd')]['syncVarSet']=function(_0x52f729){try{if(!_['isNil'](_0x52f729)){if(ut['filterKey'](_[_0x0a63('0x14c')](_0x52f729[_0x0a63('0x14d')])[0x0])){this[_0x0a63('0x14e')](_0x52f729[_0x0a63('0xad')],_[_0x0a63('0x14c')](_0x52f729[_0x0a63('0x14d')])[0x0],_0x52f729['value']);}}}catch(_0x37fa44){logger[_0x0a63('0x14f')](_0x0a63('0x150'),util[_0x0a63('0x151')](_0x37fa44,{'showHidden':![],'depth':null}));}};Preview[_0x0a63('0xd')][_0x0a63('0x23')]=function(_0x1f12af){if(_0x1f12af){if(this[_0x0a63('0x14')][_0x1f12af[_0x0a63('0x152')]]){this['actions'][_0x1f12af[_0x0a63('0x152')]]['transfer']=!![];}}};Preview['prototype'][_0x0a63('0x153')]=function(_0x5b110b){if(_0x5b110b){if(this[_0x0a63('0x14')][_0x5b110b['transfererlinkedid']]){this['actions'][_0x5b110b[_0x0a63('0x154')]][_0x0a63('0x148')]=!![];}}};module[_0x0a63('0x155')]=Preview; \ No newline at end of file +var _0x8958=['Busy','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countglobal','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','phone','trim','getCallerId','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridnum','extractCalleridNumber','addVariables','variablesAction','[originated][increment]','OriginateError','syncOriginateResponse','actionid','logLookAgent','responsetime','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','filterKey','addVariable','keys','value','[syncVarSet][Preview]','inspect','transfererlinkedid','exports','lodash','ioredis','../../../config/logger','preview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','bind','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','hasOwnProperty','dialMethod','booked','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','actions','queue','pick','UserId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','buildObj','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry'];(function(_0x4f8716,_0x3212a9){var _0x6b8c27=function(_0x433323){while(--_0x433323){_0x4f8716['push'](_0x4f8716['shift']());}};_0x6b8c27(++_0x3212a9);}(_0x8958,0x93));var _0x8895=function(_0x9c6ac9,_0x3d5d4c){_0x9c6ac9=_0x9c6ac9-0x0;var _0x1cba69=_0x8958[_0x9c6ac9];return _0x1cba69;};'use strict';var util=require('util');var _=require(_0x8895('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require('md5');var Redis=require(_0x8895('0x1'));var config=require('../../../config/environment');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var loggerAction=require(_0x8895('0x2'))('actionPreview');var ami=require(_0x8895('0x4'));var rpcDb=require(_0x8895('0x5'));var Action=require(_0x8895('0x6'));var ut=require(_0x8895('0x7'));config[_0x8895('0x8')]=_['defaults'](config[_0x8895('0x8')],{'host':_0x8895('0x9'),'port':0x18eb});var io=require(_0x8895('0xa'))(new Redis(config[_0x8895('0x8')]));var Sequence=function(){};Sequence[_0x8895('0xb')][_0x8895('0xc')]=function(_0x22a12b){this[_0x8895('0xd')]=this[_0x8895('0xd')]?this[_0x8895('0xd')]['finally'](_0x22a12b):_0x22a12b();};function Preview(_0x1cf600){this[_0x8895('0xe')]=new Sequence();this[_0x8895('0xf')]=_0x1cf600[_0x8895('0x10')];this[_0x8895('0x11')]=_0x1cf600[_0x8895('0x11')];this['actions']={};this[_0x8895('0x12')]=_0x1cf600[_0x8895('0x12')];this[_0x8895('0x13')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x8895('0x14')](this));ami['on']('hangup',this[_0x8895('0x15')][_0x8895('0x14')](this));ami['on'](_0x8895('0x16'),this[_0x8895('0x17')][_0x8895('0x14')](this));ami['on']('dialend',this[_0x8895('0x18')][_0x8895('0x14')](this));ami['on'](_0x8895('0x19'),this[_0x8895('0x1a')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1b'),this[_0x8895('0x1c')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1d'),this[_0x8895('0x1e')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1f'),this[_0x8895('0x20')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x3daf43,_0x456282,_0x2d189c){io['to'](_0x3daf43)[_0x8895('0x21')](_0x456282,_0x2d189c);}function emitCampaignPreview(_0x3f7d5a){if(_0x3f7d5a[_0x8895('0x22')]===_0x8895('0x23')){var _0xc1ce17={'id':_0x3f7d5a['id'],'name':_0x3f7d5a['name'],'strategy':_0x3f7d5a[_0x8895('0x24')],'answered':_0x3f7d5a[_0x8895('0x25')],'available':_0x3f7d5a[_0x8895('0x26')],'loggedIn':_0x3f7d5a[_0x8895('0x27')],'pTalking':_0x3f7d5a[_0x8895('0x28')],'sumBillable':_0x3f7d5a['sumBillable'],'sumDuration':_0x3f7d5a['sumDuration'],'sumHoldTime':_0x3f7d5a[_0x8895('0x29')]||0x0,'talking':_0x3f7d5a[_0x8895('0x2a')],'total':_0x3f7d5a[_0x8895('0x2b')],'type':_0x3f7d5a[_0x8895('0x22')],'unmanaged':_0x3f7d5a['unmanaged'],'abandoned':_0x3f7d5a[_0x8895('0x2c')],'waiting':_0x3f7d5a[_0x8895('0x2d')],'loggedInDb':_0x3f7d5a[_0x8895('0x2e')],'dialActive':_0x3f7d5a['dialActive'],'dialMethod':_0x3f7d5a['dialMethod'],'dialOriginateCallerIdName':_0x3f7d5a[_0x8895('0x2f')],'dialOriginateCallerIdNumber':_0x3f7d5a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3f7d5a[_0x8895('0x30')],'dialPrefix':_0x3f7d5a[_0x8895('0x31')],'outboundAnswerAgiCallsDay':_0x3f7d5a[_0x8895('0x32')],'outboundAnswerCallsDay':_0x3f7d5a[_0x8895('0x33')],'outboundBlacklistCallsDay':_0x3f7d5a[_0x8895('0x34')],'outboundBusyCallsDay':_0x3f7d5a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3f7d5a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3f7d5a[_0x8895('0x35')],'outboundDropCallsDayCallersExit':_0x3f7d5a[_0x8895('0x36')],'outboundDropCallsDayTimeout':_0x3f7d5a[_0x8895('0x37')],'outboundNoAnswerCallsDay':_0x3f7d5a[_0x8895('0x38')],'outboundNoSuchCallsDay':_0x3f7d5a[_0x8895('0x39')],'outboundOriginateFailureCallsDay':_0x3f7d5a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3f7d5a['outboundReCallsDay'],'outboundRejectCallsDay':_0x3f7d5a[_0x8895('0x3a')],'outboundUnknownCallsDay':_0x3f7d5a[_0x8895('0x3b')],'outboundAbandonedCallsDay':_0x3f7d5a[_0x8895('0x3c')],'predictiveIntervalAnsweredCalls':_0x3f7d5a[_0x8895('0x3d')],'predictiveIntervalAvgHoldtime':_0x3f7d5a[_0x8895('0x3e')],'predictiveIntervalAvgTalktime':_0x3f7d5a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3f7d5a[_0x8895('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x3f7d5a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3f7d5a[_0x8895('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f7d5a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3f7d5a[_0x8895('0x41')],'predictiveIntervalMultiplicativeFactor':_0x3f7d5a[_0x8895('0x42')],'predictiveIntervalPauses':_0x3f7d5a[_0x8895('0x43')],'predictiveIntervalAvailable':_0x3f7d5a[_0x8895('0x44')],'predictiveIntervalTotalCalls':_0x3f7d5a[_0x8895('0x45')],'message':_0x3f7d5a['message'],'originated':_0x3f7d5a[_0x8895('0x46')],'erlangCalls':_0x3f7d5a[_0x8895('0x47')],'erlangCallToSecond':_0x3f7d5a[_0x8895('0x48')],'erlangAbandonmentRate':_0x3f7d5a[_0x8895('0x49')],'erlangBusyFactor':_0x3f7d5a[_0x8895('0x4a')],'startPredictive':_0x3f7d5a['startPredictive'],'startProgressive':_0x3f7d5a[_0x8895('0x4b')]};if(_0x3f7d5a['Trunk']){_0xc1ce17[_0x8895('0x4c')]={'id':_0x3f7d5a['Trunk']['id'],'name':_0x3f7d5a[_0x8895('0x4c')][_0x8895('0x4d')],'active':_0x3f7d5a[_0x8895('0x4c')][_0x8895('0x4e')],'callerid':_0x3f7d5a[_0x8895('0x4c')]['callerid']};}if(_0x3f7d5a[_0x8895('0x4f')]){_0xc1ce17['Interval']={'id':_0x3f7d5a[_0x8895('0x4f')]['id'],'name':_0x3f7d5a[_0x8895('0x4f')][_0x8895('0x4d')]};}var _0x9297ea=md5(JSON[_0x8895('0x50')](_0xc1ce17));if(_0x3f7d5a[_0x8895('0x51')]!==_0x9297ea){_0x3f7d5a['md5']=_0x9297ea;emit(util[_0x8895('0x52')](_0x8895('0x53'),_0xc1ce17['name']),_0x8895('0x54'),_0xc1ce17);}}}function emitVoiceQueueChannelRemove(_0x54ca09){logger[_0x8895('0x55')](_0x8895('0x56'),JSON['stringify'](_0x54ca09));emit(util[_0x8895('0x52')](_0x8895('0x53'),_0x54ca09['name']),'voice_queue_channel:remove',_0x54ca09);io[_0x8895('0x21')](_0x8895('0x57'),_0x54ca09);}function notSendMessagesQueue(_0x55aacc){if(_0x55aacc[_0x8895('0x58')]){if(_0x55aacc[_0x8895('0x46')]===0x0&&_0x55aacc['pTalking']===0x0){_0x55aacc[_0x8895('0x58')]=![];_0x55aacc[_0x8895('0x26')]=0x0;_0x55aacc[_0x8895('0x59')]=0x0;_0x55aacc[_0x8895('0x5a')]=_0x8895('0x5b');ut[_0x8895('0x5c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x55aacc[_0x8895('0x4d')]+'\x20is\x20not\x20active');}else{_0x55aacc[_0x8895('0x5a')]=_0x8895('0x5d');ut['logger'](_0x8895('0x5e'),_0x55aacc['name']+_0x8895('0x5f'));}emitCampaignPreview(_0x55aacc);}}Preview['prototype']['loopCampaigns']=function(){var _0x51277b=this;setInterval(function(){_0x51277b['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x447ed6=this[_0x8895('0xf')];this['clockClearZombieChannels']+=0x1;for(var _0x4835d7 in _0x447ed6){if(_0x447ed6[_0x8895('0x60')](_0x4835d7)&&(_0x447ed6[_0x4835d7][_0x8895('0x61')]==='preview'||_0x447ed6[_0x4835d7][_0x8895('0x61')]===_0x8895('0x62'))&&_0x447ed6[_0x4835d7][_0x8895('0x22')]===_0x8895('0x23')){if(this[_0x8895('0x13')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x447ed6['hasOwnProperty'](_0x4835d7)&&_0x447ed6[_0x4835d7][_0x8895('0x61')]==='preview'&&_0x447ed6[_0x4835d7][_0x8895('0x22')]===_0x8895('0x23')){if(_0x447ed6[_0x4835d7][_0x8895('0x63')]){this[_0x8895('0x64')](_0x447ed6[_0x4835d7]);if(_0x447ed6[_0x4835d7]['dialPreviewAutoRecallMe'])this[_0x8895('0x65')](_0x447ed6[_0x4835d7]);}else{notSendMessagesQueue(_0x447ed6[_0x4835d7]);}}}};Preview[_0x8895('0xb')][_0x8895('0x66')]=function(_0x167302){var _0x2d585c=this;this[_0x8895('0xe')][_0x8895('0xc')](function(){if(!_[_0x8895('0x67')](_0x2d585c['actions'][_0x167302])){loggerAction[_0x8895('0x55')](_0x8895('0x68'),_0x167302,'Queue',_0x2d585c[_0x8895('0x69')][_0x167302]['queue'],'originated:\x20',JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302]['queue']][_0x8895('0x46')]),'pTalking:\x20',JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]][_0x8895('0x28')]),JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0x69')][_0x167302]['dialAnswer']),JSON['stringify'](_[_0x8895('0x6b')](_0x2d585c[_0x8895('0x69')][_0x167302],['contactId',_0x8895('0x6c'),'VoiceQueueId','ListId'])));return ami[_0x8895('0x6d')]({'action':'status','channel':_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6e')]})[_0x8895('0x6f')](function(_0x459e1a){if(_0x459e1a[_0x8895('0x5a')]===_0x8895('0x70')){setTimeout(function(){if(_0x2d585c[_0x8895('0x69')][_0x167302]){ut[_0x8895('0x71')](_0x2d585c['campaignsPreview'][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]],_0x8895('0x72'));if(_0x2d585c['actions'][_0x167302][_0x8895('0x73')]===!![]){ut[_0x8895('0x74')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]],_0x8895('0x72'));ut[_0x8895('0x75')](_0x8895('0x76')+_0x167302,_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]);}ut['loggerError'](_0x8895('0x77')+_0x167302,_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]);delete _0x2d585c[_0x8895('0x69')][_0x167302];}},0x2328);}});}});};Preview[_0x8895('0xb')]['clearZombieChannels']=function(){var _0x1b3c99=this;loggerAction[_0x8895('0x55')](_0x8895('0x78'),_[_0x8895('0x79')](this[_0x8895('0x69')]));for(var _0x58dd6c in this[_0x8895('0x69')]){if(_0x1b3c99[_0x8895('0x69')][_0x8895('0x60')](_0x58dd6c)){_0x1b3c99['clearZombieChannel'](_0x58dd6c);}}};Preview[_0x8895('0xb')][_0x8895('0x65')]=function(_0x2c777b){var _0x4ec8eb=this;rpcDb[_0x8895('0x7a')](_0x2c777b['id'],ut[_0x8895('0x7b')](this['agents']))[_0x8895('0x7c')](function(_0x26f68c){if(!_['isNil'](_0x26f68c)){for(var _0x2f990a=0x0;_0x2f990a<_0x26f68c[_0x8895('0x7d')];_0x2f990a+=0x1){if(ut[_0x8895('0x7e')](_0x26f68c[_0x2f990a][_0x8895('0x7f')])<_0x2c777b['dialRecallMeTimeout']*0x3c){if(_0x26f68c[_0x2f990a]['Agent']&&!_0x26f68c[_0x2f990a][_0x8895('0x80')][_0x8895('0x81')]){_0x4ec8eb[_0x8895('0x82')](_0x26f68c[_0x2f990a]['id'])['then'](ut[_0x8895('0x83')](_0x8895('0x84')))['catch'](ut[_0x8895('0x83')]('[RecallMe]'));}else{rpcDb[_0x8895('0x85')](_0x26f68c[_0x2f990a]['id']);}}else{var _0x2bd955=new Action(_0x26f68c[_0x2f990a],_0x2c777b);_0x2bd955[_0x8895('0x86')]=moment()[_0x8895('0x52')](_0x8895('0x87'));_0x2c777b['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x2bd955,0x17,_0x8895('0x88'));if(_0x2c777b[_0x8895('0x89')]){rpcDb['rescheduleContactInQueue'](ut[_0x8895('0x8a')](_0x26f68c[_0x2f990a]));rpcDb[_0x8895('0x8b')](_0x2bd955,_0x8895('0x8c'));}else{ut[_0x8895('0x8d')](_0x2bd955,0x16,'RecallFailedTimeout');rpcDb[_0x8895('0x8b')](_0x2bd955,_0x8895('0x8e'));rpcDb[_0x8895('0x8f')](_0x2bd955,_0x8895('0x8e'));}}}}})[_0x8895('0x6f')](ut[_0x8895('0x83')](_0x8895('0x90')));};Preview[_0x8895('0xb')][_0x8895('0x64')]=function(_0x21c7bb){_0x21c7bb[_0x8895('0x58')]=!![];if(ut[_0x8895('0x91')](_0x21c7bb[_0x8895('0x27')])){_0x21c7bb[_0x8895('0x5a')]=_0x8895('0x92');}else if(!ut['isActive'](_0x21c7bb['dialActive'])){_0x21c7bb['message']=_0x8895('0x5b');}else if(!this[_0x8895('0x93')](_0x21c7bb[_0x8895('0x4c')])){if(!this[_0x8895('0x93')](_0x21c7bb[_0x8895('0x94')])){_0x21c7bb['message']=_0x8895('0x95');}else{_0x21c7bb[_0x8895('0x5a')]='ACTIVE';}}else{_0x21c7bb[_0x8895('0x5a')]=_0x8895('0x96');}emitCampaignPreview(_0x21c7bb);};Preview[_0x8895('0xb')][_0x8895('0x97')]=function(_0x3ee89e,_0x526ac9,_0x6440ea){var _0x3c318c=this;var _0x119624=this[_0x8895('0x69')][_0x526ac9];var _0x113ac4=this[_0x8895('0xf')][_0x119624[_0x8895('0x6a')]];var _0x5e7048;if(_0x113ac4){switch(_0x6440ea){case'1':_0x113ac4[_0x8895('0x39')]+=0x1;_0x119624[_0x8895('0x98')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x0,_0x8895('0x9a'));ami[_0x8895('0x21')](_0x8895('0x9b'),ut['buildObj'](_0x119624,_0x8895('0x9c')));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0x9d'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xa0'));}else{if(_0x119624['countnosuchnumberretry']>=_0x113ac4[_0x8895('0xa1')]){rpcDb['createCustomerFinal'](_0x119624,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0x98'),_0x113ac4['dialNoSuchNumberRetryFrequency']),_0x119624[_0x8895('0xa4')],_0x119624['activeContact']);}}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;case _0x8895('0xa6'):var _0x42d342=moment()[_0x8895('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x119624['responsetime']=_0x42d342;_0x119624[_0x8895('0xa7')]=_0x42d342;_0x119624['dialAnswer']=!![];_0x113ac4[_0x8895('0x28')]+=0x1;logger[_0x8895('0x55')]('[syncHangup][talking][increment]',_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],_0x8895('0xaa'),_0x113ac4[_0x8895('0x28')]);ami['emit'](_0x8895('0xab'),ut['buildObj'](_0x119624,'connect',this[_0x8895('0xf')][_0x119624['queue']]));if(_0x113ac4[_0x8895('0xac')]){ami[_0x8895('0x21')](_0x8895('0xad'),ut[_0x8895('0xae')](_0x119624));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x119624,_0x8895('0xaf'),this[_0x8895('0xf')][_0x119624[_0x8895('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x8895('0xb0')](_0x119624,_0x8895('0xaf')));_0x113ac4[_0x8895('0x33')]+=0x1;_0x113ac4['total']+=0x1;_0x113ac4[_0x8895('0x25')]+=0x1;ut[_0x8895('0x74')](_0x113ac4,_0x8895('0xb1'));_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut['logCustomer'](_0x119624,0x4,_0x8895('0xb2'));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0xb3'));rpcDb[_0x8895('0x8f')](_0x119624,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8895('0xb4')](_0x119624);_0x113ac4[_0x8895('0xb5')]+=_0x119624['talktime'];_0x113ac4[_0x8895('0xb6')]+=_0x119624[_0x8895('0xb7')];logger[_0x8895('0x55')](_0x8895('0xb8'),_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],'pTalking:\x20',_0x113ac4[_0x8895('0x28')]);delete this['actions'][_0x3ee89e[_0x8895('0xa5')]];break;case _0x8895('0xb9'):_0x113ac4[_0x8895('0xba')]+=0x1;_0x119624[_0x8895('0xbb')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x5,_0x8895('0xbc'));ami[_0x8895('0x21')](_0x8895('0xbd'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xbe')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0xf,'Global');rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xc0'));}else{if(_0x119624[_0x8895('0xbb')]>=_0x113ac4[_0x8895('0xc1')]){rpcDb['createCustomerFinal'](_0x119624,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xbb'),_0x113ac4[_0x8895('0xc2')]),_0x119624[_0x8895('0xa4')],_0x119624['activeContact']);}}break;case _0x8895('0xc3'):_0x113ac4[_0x8895('0x38')]+=0x1;_0x119624['countnoanswerretry']+=0x1;_0x119624[_0x8895('0xc4')]=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x3,_0x8895('0xc5'));ami[_0x8895('0x21')](_0x8895('0xc6'),ut['buildObj'](_0x119624,_0x8895('0xc7')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xc8'));}else{if(_0x119624['countnoanswerretry']>=_0x113ac4['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xc9'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xca'),_0x113ac4[_0x8895('0xcb')]),_0x119624['unlockAgent'],_0x119624[_0x8895('0xcc')]);}}break;case _0x8895('0xcd'):_0x113ac4[_0x8895('0xce')]+=0x1;_0x119624['countcongestionretry']+=0x1;_0x119624['countglobal']=ut['totalGlobal'](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x8,_0x8895('0xcf'));ami[_0x8895('0x21')](_0x8895('0xd0'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xd1')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,'Global');rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xd2'));}else{if(_0x119624[_0x8895('0xd3')]>=_0x113ac4[_0x8895('0xd4')]){rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xd5'));}else{rpcDb[_0x8895('0xa2')](ut['scheduledAt'](_0x119624,_0x8895('0xd3'),_0x113ac4[_0x8895('0xc2')]),_0x119624[_0x8895('0xa4')],_0x119624[_0x8895('0xcc')]);}}break;case _0x8895('0xd6'):_0x113ac4['outboundRejectCallsDay']+=0x1;_0x119624[_0x8895('0xd7')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x14,_0x8895('0xd8'));ami[_0x8895('0x21')](_0x8895('0xd9'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xda')));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xdb'));if(ut['totalGlobal'](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0x14,_0x8895('0xd8'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xdc'));}else{if(_0x119624['countagentrejectretry']>=_0x113ac4[_0x8895('0xdd')]){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xdc'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xd7'),_0x113ac4['dialAgentRejectRetryFrequency']),_0x119624['unlockAgent'],_0x119624[_0x8895('0xcc')]);}}break;case'ABANDONED':_0x113ac4['outboundAbandonedCallsDay']+=0x1;_0x119624[_0x8895('0xde')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0xb,_0x8895('0xdf'));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xe0'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xe0'));}else{if(_0x119624[_0x8895('0xe1')]>=_0x113ac4[_0x8895('0xe2')]){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xe0'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,'countabandonedretry',_0x113ac4[_0x8895('0xe3')]),_0x119624[_0x8895('0xa4')],_0x119624[_0x8895('0xcc')]);}}break;case'18':_0x113ac4[_0x8895('0x3b')]+=0x1;_0x119624[_0x8895('0xe4')]+=0x1;_0x119624[_0x8895('0xc4')]=ut[_0x8895('0x99')](_0x119624);ut['logCustomer'](_0x119624,0x12,_0x3ee89e[_0x8895('0xe5')]||_0x3ee89e[_0x8895('0xe6')]);ami[_0x8895('0x21')](_0x8895('0xe7'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xe8')));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0xe9'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut['cloneAction'](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xe9'));}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;case'19':_0x113ac4[_0x8895('0x3b')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x13,_0x3ee89e[_0x8895('0xe5')]||_0x3ee89e[_0x8895('0xe6')]);ami[_0x8895('0x21')](_0x8895('0xe7'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xe8')));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xea'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xea'));}else{rpcDb[_0x8895('0x8f')](_0x119624,'[callProgressDetectingCustomer][machine]');}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;default:if(_0x119624['dialAnswer']){ut['decrementTalkink'](_0x113ac4,_0x8895('0xeb'));ut['loggerError'](_0x8895('0xec')+_0x113ac4['name'],_0x3ee89e);}_0x113ac4['outboundUnknownCallsDay']+=0x1;_0x119624[_0x8895('0xc4')]=ut['totalGlobal'](_0x119624);ut[_0x8895('0x8d')](_0x119624,0xc,_0x3ee89e['cause-txt']||_0x3ee89e[_0x8895('0xe6')]);rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,'Global');rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xed'));}else{rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xed'));}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];}if(!(_0x119624[_0x8895('0x73')]&&_0x6440ea==='16')){ut[_0x8895('0x71')](_0x113ac4,_0x8895('0xee'));logger[_0x8895('0x55')](_0x8895('0xef'),_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],_0x8895('0xf0'),_0x113ac4['originated']);}if(_0x6440ea!==_0x8895('0xa6')){delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];delete this[_0x8895('0x69')][_0x3ee89e['destlinkedid']];}}};Preview[_0x8895('0xb')][_0x8895('0xf1')]=function(_0xf3b3e5,_0x20752d,_0x124e1b){if(_[_0x8895('0xf2')](_0x20752d)&&_0x8895('0xf3')!==typeof _0x20752d){return;}if(_[_0x8895('0xf2')](_0x124e1b)&&_0x8895('0xf3')!==typeof _0x124e1b){return;}switch(_0x124e1b[_0x8895('0xf4')]){case'0':ut[_0x8895('0xf5')](_0xf3b3e5,0x0,_0x8895('0x9a'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xf7'));break;case'3':ut[_0x8895('0xf5')](_0xf3b3e5,0x3,_0x8895('0xc5'));rpcDb['createAgentHistory'](_0xf3b3e5,_0x8895('0xf8'));break;case'5':ut['logAgent'](_0xf3b3e5,0x5,_0x8895('0xbc'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xf9'));break;case'8':ut['logAgent'](_0xf3b3e5,0x8,_0x8895('0xcf'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8895('0xf5')](_0xf3b3e5,0x16,'AnswerAGI');rpcDb[_0x8895('0xf6')](_0xf3b3e5,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xf3b3e5,0xc,_0x124e1b[_0x8895('0xf4')]);rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xfa'));}ut[_0x8895('0x71')](_0x20752d,_0x8895('0xfb'));logger['info'](_0x8895('0xfc'),_0xf3b3e5['uniqueid'],'\x20Queue',_0x20752d[_0x8895('0x4d')],_0x8895('0xf0'),_0x20752d['originated']);delete this[_0x8895('0x69')][_0xf3b3e5[_0x8895('0xa8')]];};Preview[_0x8895('0xb')]['checkInBlack']=function(_0x3816b4,_0x431b18,_0x114200,_0x54e1b5,_0x465c2b){var _0x34a3c9=this;return new BPromise(function(_0x87bfe4,_0x3a1882){if(_[_0x8895('0x67')](_0x431b18)||_[_0x8895('0x67')](_0x431b18[_0x8895('0xfd')])||_[_0x8895('0x67')](_0x431b18['Contact']['phone'])||_[_0x8895('0x67')](_0x431b18['VoiceQueueId'])){_0x3a1882(ut[_0x8895('0x5a')](_0x8895('0xfe'),_0x54e1b5,_0x465c2b));return;}var _0x270a6e=uuid['v4']();var _0x21d14b=_0x34a3c9[_0x8895('0xf')][_0x431b18[_0x8895('0xff')][_0x8895('0x4d')]];var _0x44951a=_0x114200?_0x34a3c9[_0x8895('0x12')][_0x114200]['id']:undefined;_0x34a3c9[_0x8895('0x69')][_0x270a6e]=new Action(_0x431b18,_0x21d14b,_0x270a6e,_0x114200,_0x44951a);var _0x119bf3=_0x34a3c9[_0x8895('0x69')][_0x270a6e];_0x119bf3['unlockAgent']=_0x54e1b5;_0x119bf3[_0x8895('0xcc')]=_0x465c2b;_0x119bf3[_0x8895('0x100')]=_0x114200;if(_[_0x8895('0x101')](_0x3816b4)){_0x34a3c9[_0x8895('0x102')](_0x119bf3,_0x21d14b,_0x431b18,_0x114200)[_0x8895('0x7c')](function(_0x3c68a9){logger[_0x8895('0x55')](_0x8895('0x103'),_0x8895('0x104')+_0x119bf3[_0x8895('0x6a')]+_0x8895('0x105')+_0x119bf3[_0x8895('0x106')],JSON[_0x8895('0x50')](_0x3c68a9));ami[_0x8895('0x21')]('custom:agentcalled',ut[_0x8895('0xb0')](_0x119bf3,'called',_0x34a3c9['campaignsPreview'][_0x119bf3['queue']]));_0x87bfe4(ut[_0x8895('0x5a')](_0x8895('0x107')));})[_0x8895('0x6f')](function(_0x560732){ut[_0x8895('0x5c')](_0x8895('0x108'),_0x560732);_0x3a1882(ut[_0x8895('0x5a')]('Call\x20failed',_0x54e1b5,_0x465c2b));});}else{_0x21d14b[_0x8895('0x34')]+=0x1;ut[_0x8895('0x109')](_0x119bf3);rpcDb[_0x8895('0x10a')](_0x119bf3,'[Blacklist][error]');delete _0x34a3c9[_0x8895('0x69')][_0x270a6e];_0x3a1882(ut[_0x8895('0x5a')](_0x8895('0x10b'),_0x54e1b5,_0x465c2b));}});};Preview[_0x8895('0xb')][_0x8895('0x93')]=function(_0x3273c1){return!_['isNil'](_0x3273c1)&&!_[_0x8895('0x67')](_0x3273c1[_0x8895('0x4d')])&&!_['isNil'](_0x3273c1[_0x8895('0x4e')])&&_0x3273c1[_0x8895('0x4e')]&&!_[_0x8895('0x67')](this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1[_0x8895('0x4d')])])&&!_[_0x8895('0x67')](this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1['name'])]['status'])&&(this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1[_0x8895('0x4d')])][_0x8895('0x10d')]===_0x8895('0x10e')||this[_0x8895('0x11')][util['format']('SIP/%s',_0x3273c1[_0x8895('0x4d')])][_0x8895('0x10d')]===_0x8895('0x10f'));};Preview[_0x8895('0xb')][_0x8895('0x82')]=function(_0x3b465c,_0x28aeb9){var _0x2ff7e6=this;return new BPromise(function(_0x1be275,_0x8f1f00){_0x2ff7e6['execRun'](_0x3b465c,_0x28aeb9)[_0x8895('0x7c')](function(_0x5033d6){_0x1be275(_[_0x8895('0x6b')](_0x5033d6,[_0x8895('0x5a')]));})[_0x8895('0x6f')](function(_0x5e109c){if(_0x5e109c['unlock']){rpcDb['unlockContact'](_0x3b465c);}if(_0x5e109c[_0x8895('0x4e')]){rpcDb['disableContact'](_0x3b465c);}_0x8f1f00(_[_0x8895('0x6b')](_0x5e109c,[_0x8895('0x5a')]));});});};Preview[_0x8895('0xb')]['execRun']=function(_0x3ccf2a,_0x3a348d){var _0x50136b=this;return new BPromise(function(_0x2bd804,_0x564234){var _0x9ce4f5,_0xa87a01;rpcDb[_0x8895('0x110')](_0x3ccf2a)[_0x8895('0x7c')](function(_0x1d5fd7){if(!_['isNil'](_0x1d5fd7[0x0])){_0xa87a01=_0x1d5fd7[0x0]['recallme']?![]:!![];_0x9ce4f5=_0x1d5fd7[0x0][_0x8895('0x111')]?!![]:![];_0x9ce4f5=_0x3a348d?!![]:_0x9ce4f5;}var _0x41d7f9=_0x50136b[_0x8895('0x112')](_0x1d5fd7);if(_0x41d7f9[_0x8895('0x113')]){rpcDb[_0x8895('0x114')](_[_0x8895('0x6b')](_0x1d5fd7[0x0],['VoiceQueueId','Contact.phone']))[_0x8895('0x7c')](function(_0x3a6226){_0x50136b[_0x8895('0x115')](_0x3a6226,_0x1d5fd7[0x0],_0x3a348d,_0xa87a01,_0x9ce4f5)[_0x8895('0x7c')](function(_0x448496){_0x2bd804(_0x448496);})['catch'](function(_0x50baed){_0x564234(_0x50baed);});})[_0x8895('0x6f')](function(_0x4f0a55){ut['logger'](_0x8895('0x116'),_0x4f0a55);_0x564234(ut[_0x8895('0x5a')]('Call\x20unsuccessful',_0xa87a01,_0x9ce4f5));});}else{_0x564234(ut[_0x8895('0x5a')](_0x41d7f9['message'],_0xa87a01,_0x9ce4f5));}})[_0x8895('0x6f')](function(_0x242a19){ut[_0x8895('0x5c')](_0x8895('0x117'),_0x242a19);_0x564234(ut[_0x8895('0x5a')](_0x8895('0x118'),![],!![]));});});};Preview['prototype'][_0x8895('0x112')]=function(_0x3ecc83){if(_[_0x8895('0x67')](_0x3ecc83)||_[_0x8895('0x101')](_0x3ecc83)||!_[_0x8895('0x67')](_0x3ecc83[0x0][_0x8895('0x80')])&&_['isNil'](_0x3ecc83[0x0][_0x8895('0x80')][_0x8895('0x4d')])){ut[_0x8895('0x5c')](_0x8895('0x119'),_0x3ecc83);return{'isValid':![],'message':_0x8895('0x11a')};}var _0x57230f=this['campaignsPreview'][_0x3ecc83[0x0]['Queue'][_0x8895('0x4d')]];_0x57230f[_0x8895('0x5a')]=_0x8895('0x96');if(_['isNil'](_0x57230f)){ut['logger'](_0x8895('0x11b'),_0x57230f);return{'isValid':![],'message':_0x8895('0x11c')};}if(!this[_0x8895('0x93')](_0x57230f[_0x8895('0x4c')])){ut[_0x8895('0x5c')](_0x8895('0x11d'),'campaign\x20Name:\x20'+_0x57230f['name']+_0x8895('0x11e'));if(!this[_0x8895('0x93')](_0x57230f['TrunkBackup'])){ut[_0x8895('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x57230f['name']+_0x8895('0x11f'));return{'isValid':![],'message':_0x8895('0x120')};}}if(!ut[_0x8895('0x121')](_0x57230f['dialActive'])){ut[_0x8895('0x5c')]('[Preview][validateContact][Campaign\x20Active]',_0x57230f[_0x8895('0x4d')]+_0x8895('0x122'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x57230f[_0x8895('0x4d')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x8895('0x123')};};Preview[_0x8895('0xb')][_0x8895('0x102')]=function(_0x20f05c,_0x5eca7f,_0x4036ab,_0x4bf06a){var _0x2f2490=this;return new BPromise(function(_0x28506a,_0x30baea){var _0x2ecc8b=_0x20f05c[_0x8895('0xa8')];var _0x1f5eb7=_0x2f2490[_0x8895('0x93')](_0x5eca7f[_0x8895('0x4c')])?util[_0x8895('0x52')](_0x8895('0x124'),_0x5eca7f[_0x8895('0x4c')]['name'],_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x31')])?'':_0x5eca7f[_0x8895('0x31')]['trim']()||'',_0x5eca7f[_0x8895('0x125')]>0x0?_0x4036ab[_0x8895('0xfd')]['phone'][_0x8895('0x126')](_0x5eca7f[_0x8895('0x125')]):_0x4036ab[_0x8895('0xfd')][_0x8895('0x127')]):util[_0x8895('0x52')](_0x8895('0x124'),_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x94')])?_0x5eca7f[_0x8895('0x4c')]['name']:_0x5eca7f['TrunkBackup'][_0x8895('0x4d')],_['isNil'](_0x5eca7f[_0x8895('0x31')])?'':_0x5eca7f[_0x8895('0x31')][_0x8895('0x128')]()||'',_0x5eca7f['dialCutDigit']>0x0?_0x4036ab[_0x8895('0xfd')]['phone'][_0x8895('0x126')](_0x5eca7f[_0x8895('0x125')]):_0x4036ab['Contact'][_0x8895('0x127')]);var _0x30e5a2=_0x2f2490[_0x8895('0x93')](_0x5eca7f[_0x8895('0x4c')])?ut[_0x8895('0x129')](_0x5eca7f['Trunk'][_0x8895('0x12a')],_0x5eca7f[_0x8895('0x2f')],_0x5eca7f['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x5eca7f[_0x8895('0x12b')],_0x5eca7f['dialRandomLastDigitCallerIdNumber']):_0x5eca7f[_0x8895('0x12b')]):ut[_0x8895('0x129')](_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x94')])?_0x5eca7f[_0x8895('0x4c')][_0x8895('0x12a')]:_0x5eca7f['TrunkBackup'][_0x8895('0x12a')],_0x5eca7f[_0x8895('0x2f')],_0x5eca7f[_0x8895('0x12c')]>0x0?ut[_0x8895('0x12d')](_0x5eca7f[_0x8895('0x12b')],_0x5eca7f[_0x8895('0x12c')]):_0x5eca7f[_0x8895('0x12b')]);if(_0x30e5a2){_0x20f05c['originatecalleridname']=ut['extractCalleridName'](_0x30e5a2);_0x20f05c[_0x8895('0x12e')]=ut[_0x8895('0x12f')](_0x30e5a2);}var _0x43523c=ut[_0x8895('0x130')](_0x5eca7f,_0x4036ab,_0x1f5eb7,_0x30e5a2,_0x2ecc8b,_0x20f05c);_['merge'](_0x20f05c,ut['toLowerVariables'](_0x43523c));_0x20f05c[_0x8895('0x86')]=moment()[_0x8895('0x52')](_0x8895('0x87'));ami[_0x8895('0x6d')](ut[_0x8895('0x131')](_0x20f05c,_0x5eca7f,_0x43523c,_0x20f05c[_0x8895('0xcc')],_0x4bf06a))['then'](function(_0x4c4148){_0x5eca7f[_0x8895('0x46')]+=0x1;logger[_0x8895('0x55')](_0x8895('0x132'),_0x2ecc8b,_0x8895('0xa9'),_0x5eca7f[_0x8895('0x4d')],_0x8895('0xf0'),_0x5eca7f[_0x8895('0x46')]);_0x28506a(_0x4c4148);})[_0x8895('0x6f')](function(_0x18a523){ut['logAgent'](_0x20f05c,0xe,_0x8895('0x133'));rpcDb[_0x8895('0xf6')](_0x20f05c,'[originateFailure][logOriginateFailure]');_0x30baea(_0x18a523);});});};Preview[_0x8895('0xb')][_0x8895('0x1a')]=function(_0x3ff7fa){if(this[_0x8895('0x69')][_0x3ff7fa[_0x8895('0xa5')]]){this[_0x8895('0x69')][_0x3ff7fa[_0x8895('0xa5')]][_0x8895('0x6e')]=_0x3ff7fa['channel'];}};Preview['prototype'][_0x8895('0x134')]=function(_0xc93e09){var _0x398041=this;var _0xc35be9=this[_0x8895('0x69')][_0xc93e09[_0x8895('0x135')]];if(_0xc35be9){if(_0xc35be9['lookAgent']&&this[_0x8895('0x12')][_0xc35be9[_0x8895('0x100')]]){ut[_0x8895('0x136')](_0xc35be9,this['agents'][_0xc35be9[_0x8895('0x100')]][_0x8895('0x4d')],this[_0x8895('0x12')][_0xc35be9['lookAgent']]['id']);}var _0x1a62b4=_['clone'](_0xc35be9);_0x1a62b4[_0x8895('0x137')]=moment()[_0x8895('0x52')](_0x8895('0x87'));var _0x447dc0=_0x398041[_0x8895('0xf')][_0xc35be9['queue']];if(ut['isFailure'](_0xc93e09[_0x8895('0x138')])){if(_0xc35be9['unlockAgent']){rpcDb[_0x8895('0x139')](_0xc35be9[_0x8895('0x106')]);}if(_0xc35be9[_0x8895('0xcc')]){rpcDb[_0x8895('0x85')](_0xc35be9[_0x8895('0x106')]);}ami[_0x8895('0x21')](_0x8895('0x13a'),ut[_0x8895('0xb0')](_0xc35be9,'rejected',this[_0x8895('0xf')][_0xc35be9[_0x8895('0x6a')]]));this[_0x8895('0xf1')](_0x1a62b4,_0x447dc0,_0xc93e09);}else{_0xc35be9['starttime']=moment()[_0x8895('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x8895('0xf5')](_0x1a62b4,0x4,_0x8895('0xb2'));rpcDb[_0x8895('0xf6')](_0x1a62b4,_0x8895('0x13b'));}}};Preview[_0x8895('0xb')][_0x8895('0x15')]=function(_0x55d290){var _0x1186fa=this;var _0x466d3a=this[_0x8895('0x69')][_0x55d290['linkedid']];var _0x268d3c;if(_0x466d3a){_0x268d3c=this['campaignsPreview'][_0x466d3a[_0x8895('0x6a')]];logger[_0x8895('0x55')](_0x8895('0x13c'),_0x55d290[_0x8895('0xa5')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],_0x8895('0xaa'),_0x268d3c[_0x8895('0x28')]);}if(this[_0x8895('0x69')][_0x55d290[_0x8895('0xa5')]]&&_0x55d290[_0x8895('0xa5')]!==_0x55d290['uniqueid']){if(_0x55d290['cause']==='16'&&this[_0x8895('0x69')][_0x55d290[_0x8895('0xa5')]][_0x8895('0x73')]){this['callProgressDetectingCustomer'](_0x55d290,_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')]);}else if(this['actions'][_0x55d290[_0x8895('0xa5')]]['dialAnswer']){logger[_0x8895('0x55')](_0x8895('0x13e'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],'pTalking:\x20',_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')]);}}else if(_0x466d3a&&_[_0x8895('0x67')](_0x466d3a[_0x8895('0x13f')])&&_0x268d3c[_0x8895('0x140')]&&_0x55d290[_0x8895('0xa5')]===_0x55d290['uniqueid']&&_[_0x8895('0x67')](_0x55d290[_0x8895('0xf4')])&&_0x55d290[_0x8895('0x13d')]==='16'&&_0x55d290[_0x8895('0x141')]==='6'&&_[_0x8895('0xf2')](_0x466d3a[_0x8895('0x142')])){if(_0x466d3a['unlockAgent']){rpcDb['unlockContact'](_0x466d3a[_0x8895('0x106')]);}if(_0x466d3a[_0x8895('0xcc')]){rpcDb[_0x8895('0x85')](_0x466d3a[_0x8895('0x106')]);}_0x55d290[_0x8895('0xf4')]='22';this[_0x8895('0xf1')](_0x466d3a,_0x268d3c,_0x55d290);}else if(_0x466d3a&&_0x466d3a[_0x8895('0x142')]){if(_0x55d290['cause']==='16'&&this['actions'][_0x55d290[_0x8895('0xa5')]]['dialAnswer']){logger[_0x8895('0x55')](_0x8895('0x143'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],'\x20Queue',_0x268d3c[_0x8895('0x4d')],_0x8895('0xaa'),_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290['linkedid'],_0x55d290[_0x8895('0x13d')]);}else if(this[_0x8895('0x69')][_0x55d290['linkedid']][_0x8895('0x73')]){logger[_0x8895('0x55')](_0x8895('0x13e'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],'pTalking:\x20',_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290['linkedid'],_0x55d290[_0x8895('0x13d')]);}}};Preview[_0x8895('0xb')]['syncDialEnd']=function(_0x4c4240){if(this[_0x8895('0x69')][_0x4c4240[_0x8895('0x144')]]&&_0x4c4240[_0x8895('0x144')]!==_0x4c4240[_0x8895('0x145')]){this[_0x8895('0x97')](_0x4c4240,_0x4c4240[_0x8895('0x144')],_0x4c4240[_0x8895('0xe6')]);}};Preview[_0x8895('0xb')]['syncHangupRequest']=function(_0x28ec87){if(this['actions'][_0x28ec87[_0x8895('0xa5')]]&&_0x28ec87[_0x8895('0xa5')]!==_0x28ec87[_0x8895('0xa8')]&&!this[_0x8895('0x69')][_0x28ec87[_0x8895('0xa5')]]['dialAnswer']){if(_0x28ec87[_0x8895('0x13d')]==='1'){this[_0x8895('0x97')](_0x28ec87,_0x28ec87[_0x8895('0xa5')],_0x28ec87[_0x8895('0x13d')]);}}};Preview[_0x8895('0xb')]['addVariable']=function(_0x419702,_0x3a7d70,_0x4b937f){if(this['actions'][_0x419702]){if(_[_0x8895('0x67')](this[_0x8895('0x69')][_0x419702][_0x8895('0x146')])){this[_0x8895('0x69')][_0x419702][_0x8895('0x146')]={};}this[_0x8895('0x69')][_0x419702][_0x8895('0x146')][_0x3a7d70]=_0x4b937f;}};Preview['prototype'][_0x8895('0x1c')]=function(_0x49928b){try{if(!_[_0x8895('0x67')](_0x49928b)){if(ut[_0x8895('0x147')](_['keys'](_0x49928b['variable'])[0x0])){this[_0x8895('0x148')](_0x49928b[_0x8895('0xa8')],_[_0x8895('0x149')](_0x49928b['variable'])[0x0],_0x49928b[_0x8895('0x14a')]);}}}catch(_0x47837c){logger['error'](_0x8895('0x14b'),util[_0x8895('0x14c')](_0x47837c,{'showHidden':![],'depth':null}));}};Preview[_0x8895('0xb')][_0x8895('0x1e')]=function(_0x592e3b){if(_0x592e3b){if(this[_0x8895('0x69')][_0x592e3b['transfertargetlinkedid']]){this[_0x8895('0x69')][_0x592e3b['transfertargetlinkedid']][_0x8895('0x142')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0xe5a83a){if(_0xe5a83a){if(this[_0x8895('0x69')][_0xe5a83a[_0x8895('0x14d')]]){this[_0x8895('0x69')][_0xe5a83a[_0x8895('0x14d')]][_0x8895('0x142')]=!![];}}};module[_0x8895('0x14e')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 5ecf0f0..f54b4ec 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 _0x1fe3=['crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','then','[createHistory]\x20','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20'];(function(_0x6f3196,_0xd9920a){var _0x58ccc5=function(_0x4feae2){while(--_0x4feae2){_0x6f3196['push'](_0x6f3196['shift']());}};_0x58ccc5(++_0xd9920a);}(_0x1fe3,0xcb));var _0x31fe=function(_0x107cc0,_0x45f01e){_0x107cc0=_0x107cc0-0x0;var _0x103eee=_0x1fe3[_0x107cc0];return _0x103eee;};'use strict';var util=require(_0x31fe('0x0'));var BPromise=require(_0x31fe('0x1'));var logger=require('../../../config/logger')(_0x31fe('0x2'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x31fe('0x3'));var cmHopperHistory=require(_0x31fe('0x4'));var cmHopperBlack=require(_0x31fe('0x5'));var voiceQueueRt=require(_0x31fe('0x6'));var agentReportPreview=require(_0x31fe('0x7'));var voiceQueueReport=require(_0x31fe('0x8'));function loggerCatch(_0x5e0bc2){return function(_0x475ad7){logger[_0x31fe('0x9')](_0x5e0bc2,util[_0x31fe('0xa')](_0x475ad7,{'showHidden':![],'depth':null}));};}function create(_0x5aa461){return BPromise[_0x31fe('0xb')]()['then'](cmHopperHistory[_0x31fe('0xc')](_0x5aa461))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x365004){return BPromise['resolve']()[_0x31fe('0xd')](agentReportPreview[_0x31fe('0xc')](_0x365004))['catch'](loggerCatch(_0x31fe('0xe')));}function moveContact(_0x42f3e2){return BPromise[_0x31fe('0xb')]()['then'](cmHopper[_0x31fe('0xf')](_0x42f3e2,!![]))[_0x31fe('0x10')](loggerCatch(_0x31fe('0x11')));}exports[_0x31fe('0x12')]=function(_0x8e3823){return BPromise[_0x31fe('0xb')]()['then'](cmHopperBlack[_0x31fe('0x12')](_0x8e3823))[_0x31fe('0x10')](loggerCatch(_0x31fe('0x13')));};exports[_0x31fe('0x14')]=function(_0x475943){return BPromise['resolve']()['then'](cmHopper[_0x31fe('0x14')](_0x475943))[_0x31fe('0x10')](loggerCatch(_0x31fe('0x15')));};exports['createHistory']=function(_0x2b8e72,_0x268a29){create(_0x2b8e72)['catch'](loggerCatch(_0x268a29));moveContact(_0x2b8e72)[_0x31fe('0x10')](loggerCatch(_0x268a29));};exports[_0x31fe('0x16')]=function(_0x51eae7,_0x45ed7e){createAgent(_0x51eae7)[_0x31fe('0x10')](loggerCatch(_0x45ed7e));};exports['createCustomerHistory']=function(_0x5d8cee,_0x552889){create(_0x5d8cee)[_0x31fe('0x10')](loggerCatch(_0x552889));};exports[_0x31fe('0x17')]=function(_0x21a62d,_0xbfde30){moveContact(_0x21a62d)[_0x31fe('0x10')](loggerCatch(_0xbfde30));};exports[_0x31fe('0x18')]=function(_0x2444df,_0x484ee2,_0x134935){if(_0x484ee2){_0x2444df[_0x31fe('0x19')]=null;}if(_0x134935){_0x2444df[_0x31fe('0x1a')]=![];}return BPromise[_0x31fe('0xb')]()[_0x31fe('0xd')](cmHopper['rescheduleContact'](_0x2444df))[_0x31fe('0x10')](loggerCatch(_0x31fe('0x1b')));};exports['countReScheduled']=function(_0x29259e){return BPromise[_0x31fe('0xb')]()['then'](cmHopper[_0x31fe('0x1c')](_0x29259e))['catch'](loggerCatch(_0x31fe('0x1d')));};exports[_0x31fe('0x1e')]=function(_0x1fec52){return BPromise[_0x31fe('0xb')]()[_0x31fe('0xd')](cmHopper[_0x31fe('0x1e')]({'UserId':null},_0x1fec52,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x31fe('0x1f')]=function(_0x3c7623){return BPromise[_0x31fe('0xb')]()[_0x31fe('0xd')](cmHopper[_0x31fe('0x1e')]({'active':![]},_0x3c7623,0x1))[_0x31fe('0x10')](loggerCatch(_0x31fe('0x20')));};exports[_0x31fe('0x21')]=function(_0x30309d){var _0x19723d={};_0x19723d['type']=_0x30309d[_0x31fe('0x22')];_0x19723d[_0x31fe('0x23')]=_0x30309d[_0x31fe('0x23')];_0x19723d[_0x31fe('0x24')]=_0x30309d['calleridnum'];_0x19723d[_0x31fe('0x25')]=_0x30309d['calleridname'];_0x19723d[_0x31fe('0x26')]=_0x30309d[_0x31fe('0x26')];_0x19723d[_0x31fe('0x27')]=_0x30309d[_0x31fe('0x28')];_0x19723d[_0x31fe('0x29')]=_0x30309d['answertime'];_0x19723d[_0x31fe('0x2a')]=0x1;_0x19723d[_0x31fe('0x2b')]=_0x30309d[_0x31fe('0x2c')];_0x19723d['connectedlinename']=_0x30309d[_0x31fe('0x2d')];_0x19723d['context']=_0x31fe('0x2e');_0x19723d[_0x31fe('0x2f')]=_0x31fe('0x30');_0x19723d[_0x31fe('0x31')]=0x0;_0x19723d['assigned']=0x1;_0x19723d[_0x31fe('0x32')]=_0x30309d['membername'];_0x19723d[_0x31fe('0x33')]=_0x31fe('0x34');return BPromise[_0x31fe('0xb')]()[_0x31fe('0xd')](voiceQueueReport[_0x31fe('0x35')](_0x19723d))['catch'](loggerCatch(_0x31fe('0x36')));};exports[_0x31fe('0x37')]=function(_0x5b7b62,_0x1dd65c){return BPromise[_0x31fe('0xb')]()[_0x31fe('0xd')](cmHopper[_0x31fe('0x37')](_0x5b7b62,_0x1dd65c))['catch'](loggerCatch(_0x31fe('0x38')));};exports[_0x31fe('0x39')]=function(_0x561eb0){return BPromise[_0x31fe('0xb')]()[_0x31fe('0xd')](cmHopper[_0x31fe('0x18')](_0x561eb0,!![],!![]))['catch'](loggerCatch(_0x31fe('0x3a')));}; \ No newline at end of file +var _0xfb43=['queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueReport','resolve','then','createHistory','catch','[createHistory]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallerleaveAt'];(function(_0x1ce8c8,_0x27a81b){var _0x462090=function(_0x564bd4){while(--_0x564bd4){_0x1ce8c8['push'](_0x1ce8c8['shift']());}};_0x462090(++_0x27a81b);}(_0xfb43,0xc8));var _0x3fb4=function(_0x56f856,_0x20d5bb){_0x56f856=_0x56f856-0x0;var _0x1855f7=_0xfb43[_0x56f856];return _0x1855f7;};'use strict';var util=require(_0x3fb4('0x0'));var BPromise=require('bluebird');var logger=require(_0x3fb4('0x1'))(_0x3fb4('0x2'));var _=require(_0x3fb4('0x3'));var cmHopper=require(_0x3fb4('0x4'));var cmHopperFinal=require(_0x3fb4('0x5'));var cmHopperHistory=require(_0x3fb4('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x3fb4('0x7'));function loggerCatch(_0x264120){return function(_0x33396e){logger['error'](_0x264120,util['inspect'](_0x33396e,{'showHidden':![],'depth':null}));};}function create(_0x2a9516){return BPromise[_0x3fb4('0x8')]()[_0x3fb4('0x9')](cmHopperHistory[_0x3fb4('0xa')](_0x2a9516))[_0x3fb4('0xb')](loggerCatch(_0x3fb4('0xc')));}function createAgent(_0x2920b4){return BPromise[_0x3fb4('0x8')]()['then'](agentReportPreview[_0x3fb4('0xa')](_0x2920b4))[_0x3fb4('0xb')](loggerCatch(_0x3fb4('0xc')));}function moveContact(_0x542e2e){return BPromise['resolve']()[_0x3fb4('0x9')](cmHopper['moveContactManagedDialer'](_0x542e2e,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x3fb4('0xd')]=function(_0x2cb5e4){return BPromise[_0x3fb4('0x8')]()[_0x3fb4('0x9')](cmHopperBlack[_0x3fb4('0xd')](_0x2cb5e4))[_0x3fb4('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x100eed){return BPromise[_0x3fb4('0x8')]()['then'](cmHopper[_0x3fb4('0xe')](_0x100eed))[_0x3fb4('0xb')](loggerCatch(_0x3fb4('0xf')));};exports['createHistory']=function(_0x4de678,_0x280d03){create(_0x4de678)[_0x3fb4('0xb')](loggerCatch(_0x280d03));moveContact(_0x4de678)[_0x3fb4('0xb')](loggerCatch(_0x280d03));};exports['createAgentHistory']=function(_0xe3421f,_0x2d32f3){createAgent(_0xe3421f)[_0x3fb4('0xb')](loggerCatch(_0x2d32f3));};exports['createCustomerHistory']=function(_0x472fca,_0x47b77e){create(_0x472fca)[_0x3fb4('0xb')](loggerCatch(_0x47b77e));};exports[_0x3fb4('0x10')]=function(_0x484341,_0x33362e){moveContact(_0x484341)[_0x3fb4('0xb')](loggerCatch(_0x33362e));};exports[_0x3fb4('0x11')]=function(_0x38d63d,_0x3b474b,_0x5d8640){if(_0x3b474b){_0x38d63d['UserId']=null;}if(_0x5d8640){_0x38d63d['active']=![];}return BPromise[_0x3fb4('0x8')]()[_0x3fb4('0x9')](cmHopper[_0x3fb4('0x11')](_0x38d63d))[_0x3fb4('0xb')](loggerCatch(_0x3fb4('0x12')));};exports['countReScheduled']=function(_0x2ed899){return BPromise[_0x3fb4('0x8')]()[_0x3fb4('0x9')](cmHopper[_0x3fb4('0x13')](_0x2ed899))['catch'](loggerCatch(_0x3fb4('0x14')));};exports[_0x3fb4('0x15')]=function(_0x41bd0f){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'UserId':null},_0x41bd0f,0x1))[_0x3fb4('0xb')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x2dc1c6){return BPromise[_0x3fb4('0x8')]()['then'](cmHopper[_0x3fb4('0x15')]({'active':![]},_0x2dc1c6,0x1))[_0x3fb4('0xb')](loggerCatch(_0x3fb4('0x16')));};exports['crateCustomerReportQueue']=function(_0x4b55cb){var _0x19d049={};_0x19d049[_0x3fb4('0x17')]=_0x4b55cb['type'];_0x19d049[_0x3fb4('0x18')]=_0x4b55cb['uniqueid'];_0x19d049[_0x3fb4('0x19')]=_0x4b55cb['calleridnum'];_0x19d049['calleridname']=_0x4b55cb['calleridname'];_0x19d049[_0x3fb4('0x1a')]=_0x4b55cb['queue'];_0x19d049[_0x3fb4('0x1b')]=_0x4b55cb[_0x3fb4('0x1c')];_0x19d049[_0x3fb4('0x1d')]=_0x4b55cb[_0x3fb4('0x1c')];_0x19d049[_0x3fb4('0x1e')]=0x1;_0x19d049[_0x3fb4('0x1f')]=_0x4b55cb[_0x3fb4('0x20')];_0x19d049[_0x3fb4('0x21')]=_0x4b55cb[_0x3fb4('0x22')];_0x19d049[_0x3fb4('0x23')]='from-sip';_0x19d049['exten']=_0x3fb4('0x24');_0x19d049[_0x3fb4('0x25')]=0x0;_0x19d049[_0x3fb4('0x26')]=0x1;_0x19d049[_0x3fb4('0x27')]=_0x4b55cb['membername'];_0x19d049[_0x3fb4('0x28')]=_0x3fb4('0x29');return BPromise['resolve']()[_0x3fb4('0x9')](voiceQueueReport['create'](_0x19d049))[_0x3fb4('0xb')](loggerCatch(_0x3fb4('0x2a')));};exports['getContactRecallMe']=function(_0x2fd866,_0x5c03c3){return BPromise[_0x3fb4('0x8')]()[_0x3fb4('0x9')](cmHopper[_0x3fb4('0x2b')](_0x2fd866,_0x5c03c3))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x3fb4('0x2c')]=function(_0x2a5af2){return BPromise['resolve']()[_0x3fb4('0x9')](cmHopper[_0x3fb4('0x11')](_0x2a5af2,!![],!![]))['catch'](loggerCatch(_0x3fb4('0x2d')));}; \ 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 cb80aa6..e12b2d4 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 _0xcb6a=['127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','membername','UserId','state','ringtime','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','scheduledAt','active','scheduledat','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','channelAgent','agentReadyId','not_inuse','status','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countbusyretry','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb6a,0x1aa));var _0xacb6=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xcb6a[_0x3e44fa];return _0x2a0aba;};'use strict';var util=require(_0xacb6('0x0'));var _=require(_0xacb6('0x1'));var moment=require(_0xacb6('0x2'));var logger=require(_0xacb6('0x3'))('preview');var ipAgi=process[_0xacb6('0x4')][_0xacb6('0x5')]||_0xacb6('0x6');function getSeconds(_0x3fa326,_0x46d2a4){var _0x485dc2=moment(_0x3fa326)[_0xacb6('0x7')](0x0);var _0x5b5909=moment(_0x46d2a4)[_0xacb6('0x7')](0x0);return _0x485dc2[_0xacb6('0x8')](_0x5b5909,_0xacb6('0x9'));}exports[_0xacb6('0xa')]=function(_0x201d66){return function(_0x146c80){logger[_0xacb6('0xb')](_0x201d66,util[_0xacb6('0xc')](_0x146c80,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2b2da5,_0x47f4e4){logger[_0xacb6('0xd')](_0x2b2da5,util[_0xacb6('0xc')](_0x47f4e4,{'showHidden':![],'depth':null}));};exports[_0xacb6('0xe')]=function(_0x3b03ec,_0x3c8252){logger['error'](_0x3b03ec,util[_0xacb6('0xc')](_0x3c8252,{'showHidden':![],'depth':null}));};exports[_0xacb6('0xf')]=function(_0x1d9fbf){return function(_0x30546c){logger['info'](_0x1d9fbf,util['inspect'](_0x30546c,{'showHidden':![],'depth':null}));};};exports[_0xacb6('0x10')]=function(_0x4a2a71,_0xfa1b7c,_0x17b6c7){return{'message':_0x4a2a71,'unlock':_0xfa1b7c,'active':_0x17b6c7};};exports['getCallerId']=function(_0x323fc8,_0x3887c6,_0x26c487){if(!_['isUndefined'](_0x26c487)&&_0xacb6('0x11')===typeof _0x26c487&&!_[_0xacb6('0x12')](_0x26c487)){if(!_[_0xacb6('0x13')](_0x3887c6)&&_0xacb6('0x11')===typeof _0x3887c6&&!_[_0xacb6('0x12')](_0x3887c6)){return util[_0xacb6('0x14')](_0xacb6('0x15'),_0x3887c6,_0x26c487);}return util[_0xacb6('0x14')](_0xacb6('0x15'),_0x26c487,_0x26c487);}if(!_[_0xacb6('0x13')](_0x323fc8)&&'string'===typeof _0x323fc8&&!_[_0xacb6('0x12')](_0x323fc8)){return _0x323fc8;}return _0xacb6('0x16');};exports[_0xacb6('0x17')]=function(_0x1293c7){if(_[_0xacb6('0x18')](_0x1293c7)){return![];}return _0x1293c7;};exports[_0xacb6('0x19')]=function(_0x1307b5,_0x327716,_0x467cdc,_0x388b59,_0x1d97d8,_0x242a97){var _0xdf3691={'XMD-QUEUE':_0x327716[_0xacb6('0x1a')]?_0x327716[_0xacb6('0x1a')][_0xacb6('0x1b')]:'','XMD-CALLERID':_0x388b59,'XMD-CALLERID-PREVIEW':_0x242a97?util[_0xacb6('0x14')]('\x22%s\x22\x20<%s>',_0x242a97[_0xacb6('0x1c')],_0x242a97[_0xacb6('0x1d')]):_0x388b59,'XMD-DIALID':_0x1d97d8,'XMD-CONTACTID':_0x327716['ContactId'],'XMD-CDRTYPE':_0xacb6('0x1e'),'CALLERID(all)':_0x388b59,'XMD-VOICEQUEUEID':_0x327716[_0xacb6('0x1f')],'XMD-DIALCHANNEL':_0x467cdc,'XMD-DIALTIMEOUT':_0x1307b5[_0xacb6('0x20')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xacb6('0x21'),_0x1307b5[_0xacb6('0x22')]?'g':'',_[_0xacb6('0x12')](_0x1307b5[_0xacb6('0x23')])?'':_0xacb6('0x24')),'XMD-DIALURL':_0x1307b5['dialPreviewUrl']||'','XMD-AGI':_0x1307b5[_0xacb6('0x25')]?util['format'](_0xacb6('0x26'),ipAgi,_0x1307b5[_0xacb6('0x25')]):_0xacb6('0x27'),'XMD-AGIAFTER':_0x1307b5['dialQueueProject2']?util[_0xacb6('0x14')](_0xacb6('0x26'),ipAgi,_0x1307b5['dialQueueProject2']):_0xacb6('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x242a97?_0x242a97[_0xacb6('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x242a97?_0x242a97[_0xacb6('0x29')]:'','XMD-DESTINATION':_0xacb6('0x2a'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xacb6('0x12')](_0x1307b5[_0xacb6('0x23')])){_0xdf3691[util[_0xacb6('0x14')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x1307b5['monitor_format'];_0xdf3691[util[_0xacb6('0x14')]('%s',_0xacb6('0x2b'))]=_0x1d97d8;}if(_0x327716&&_0x327716[_0xacb6('0x2c')]){for(var _0x174464 in _0x327716[_0xacb6('0x2c')]){if(_0x327716['Contact'][_0xacb6('0x2d')](_0x174464)){if(!_[_0xacb6('0x18')](_0x327716[_0xacb6('0x2c')][_0x174464])&&_0x174464!=='id'&&_0x174464!==_0xacb6('0x2e')&&_0x174464!==_0xacb6('0x2f')&&_0x174464!==_0xacb6('0x30')){_0xdf3691[util[_0xacb6('0x14')](_0xacb6('0x31'),_0xacb6('0x32'),_[_0xacb6('0x33')](_0x174464))]=_0x327716[_0xacb6('0x2c')][_0x174464];}}}}return _0xdf3691;};exports[_0xacb6('0x34')]=function(_0x38a459){var _0x33280d={};for(var _0x5cf36d in _0x38a459){if(_0x38a459[_0xacb6('0x2d')](_0x5cf36d)){_0x33280d[util[_0xacb6('0x14')]('%s',_[_0xacb6('0x35')](_0x5cf36d))]=_0x38a459[_0x5cf36d];}}return{'variables':_0x33280d};};exports[_0xacb6('0x36')]=function(_0x164f22,_0x39e50e){if(!_[_0xacb6('0x18')](_0x164f22)){if(_0x164f22['hasOwnProperty'](_0xacb6('0x37'))){if(_0x164f22[_0xacb6('0x37')]>0x0){_0x164f22[_0xacb6('0x37')]-=0x1;}else{logger[_0xacb6('0xb')](_0xacb6('0x38'),_0x39e50e);}}}else{logger[_0xacb6('0xb')](_0xacb6('0x39'),_0x39e50e);}};exports[_0xacb6('0x3a')]=function(_0x2c7444){var _0x35b164=moment()['format'](_0xacb6('0x3b'));_0x2c7444['state']=0xd;_0x2c7444[_0xacb6('0x3c')]=_0xacb6('0x3d');_0x2c7444[_0xacb6('0x3e')]=_0x35b164;_0x2c7444[_0xacb6('0x3f')]=_0x35b164;_0x2c7444[_0xacb6('0x40')]=_0x35b164;};exports[_0xacb6('0x41')]=function(_0x241fab,_0x305a9a,_0x14bb63){var _0x53f749=moment()[_0xacb6('0x14')](_0xacb6('0x3b'));_0x241fab['state']=_0x305a9a;_0x241fab[_0xacb6('0x3c')]=_0x14bb63;_0x241fab[_0xacb6('0x3f')]=_0x53f749;_0x241fab['ringtime']=getSeconds(_0x241fab[_0xacb6('0x3f')],_0x241fab[_0xacb6('0x3e')]);};exports['logLookAgent']=function(_0x2c4252,_0x48d6c2,_0x50db27){_0x2c4252[_0xacb6('0x42')]=_0x48d6c2;_0x2c4252[_0xacb6('0x43')]=_0x50db27;};exports['logCustomer']=function(_0x43072d,_0x376786,_0x1ce299){var _0x1f1248=moment()[_0xacb6('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x43072d[_0xacb6('0x44')]=_0x376786;_0x43072d[_0xacb6('0x3c')]=_0x1ce299;_0x43072d[_0xacb6('0x3f')]=_0x43072d['responsetime']?_0x43072d[_0xacb6('0x3f')]:_0x1f1248;_0x43072d['endtime']=_0x43072d[_0xacb6('0x40')]?_0x43072d[_0xacb6('0x40')]:_0x1f1248;_0x43072d[_0xacb6('0x45')]=getSeconds(_0x43072d['responsetime']||0x0,_0x43072d[_0xacb6('0x3e')]||0x0);_0x43072d[_0xacb6('0x46')]=_0x43072d[_0xacb6('0x47')]?getSeconds(_0x43072d[_0xacb6('0x40')],_0x43072d[_0xacb6('0x47')]):0x0;};exports[_0xacb6('0x48')]=function(_0x11dc40){return _0x11dc40==='Failure';};exports['variablesAction']=function(_0x14e47c,_0x400354,_0x2744b7,_0x4485c8,_0x288aa0){var _0x8d2ec3=_0x4485c8?_0xacb6('0x49'):_0x14e47c['calleridname'];_0x8d2ec3=_0x288aa0?_0xacb6('0x4a'):_0x8d2ec3;return{'actionid':_0x14e47c[_0xacb6('0x4b')],'action':_0xacb6('0x4c'),'channel':_0x14e47c['channelAgent'],'callerid':util[_0xacb6('0x14')]('\x22%s\x22\x20<%s>',_0x8d2ec3,_0x14e47c[_0xacb6('0x1d')]),'Exten':_0xacb6('0x2a'),'Context':_0xacb6('0x4d'),'Priority':'1','variable':_0x2744b7,'timeout':(_0x400354[_0xacb6('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x14e47c[_0xacb6('0x4b')]};};exports[_0xacb6('0x4f')]=function(_0x18fc03){return _0x18fc03['countbusyretry']+_0x18fc03[_0xacb6('0x50')]+_0x18fc03[_0xacb6('0x51')]+_0x18fc03[_0xacb6('0x52')]+_0x18fc03[_0xacb6('0x53')];};exports['cloneAction']=function(_0x25e9f2){var _0x4d9a9a=_['clone'](_0x25e9f2);_0x4d9a9a[_0xacb6('0x44')]=0xf;_0x4d9a9a[_0xacb6('0x3c')]='Global';return _0x4d9a9a;};exports[_0xacb6('0x54')]=function(_0x178e77,_0x4e8c7e,_0x563e29){var _0x5ad1f0={};_0x5ad1f0[_0x4e8c7e]=_0x178e77[_0x4e8c7e];_0x5ad1f0[_0xacb6('0x55')]=![];_0x5ad1f0[_0xacb6('0x56')]=moment()['add'](_0x563e29,'minutes')[_0xacb6('0x14')](_0xacb6('0x3b'));_0x5ad1f0[_0xacb6('0x57')]=_0x178e77[_0xacb6('0x57')];_0x5ad1f0[_0xacb6('0x58')]=_0x178e77[_0xacb6('0x58')];_0x5ad1f0[_0xacb6('0x1f')]=_0x178e77[_0xacb6('0x1f')]||undefined;return _0x5ad1f0;};exports[_0xacb6('0x59')]=function(_0x30133e,_0x7f0756){if(!_[_0xacb6('0x18')](_0x30133e)){if(_0x30133e[_0xacb6('0x5a')]>0x0){_0x30133e['pTalking']-=0x1;}else{logger['error'](_0x7f0756,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x7f0756,_0xacb6('0x5b'));}};exports['IsNotLoggedIn']=function(_0x3a1305){if(_0x3a1305<=0x0){return!![];}return![];};exports[_0xacb6('0x5c')]=function(_0xfa235,_0xe64130,_0x1272a){_0xfa235[_0xacb6('0x5d')]=_0xe64130;_0xfa235[_0xacb6('0x1b')]=_0xfa235[_0xacb6('0x5e')];_0xfa235['interface']=_0xfa235['channelAgent'];_0xfa235[_0xacb6('0x5f')]=_0xacb6('0x60');if(_0x1272a){_0xfa235[_0xacb6('0x61')]=_0x1272a[_0xacb6('0x61')];}return _0xfa235;};exports[_0xacb6('0x62')]=function(_0x2d147a){var _0x2fba53={};_0x2fba53['queue']=_0x2d147a['queue'];_0x2fba53[_0xacb6('0x63')]=_0x2d147a[_0xacb6('0x64')];_0x2fba53[_0xacb6('0x4b')]=_0x2d147a[_0xacb6('0x4b')];return _0x2fba53;};exports[_0xacb6('0x65')]=function(_0x13a667){var _0x3b3d3b=[];for(var _0x51551d in _0x13a667){if(_0x13a667['hasOwnProperty'](_0x51551d)){if(!_[_0xacb6('0x18')](_0x13a667[_0x51551d])&&_0x13a667[_0x51551d][_0xacb6('0x44')]===_0xacb6('0x66')&&_0x13a667[_0x51551d][_0xacb6('0x67')]==='reachable'){_0x3b3d3b['push'](_0x13a667[_0x51551d]['id']);}}}return _0x3b3d3b;};exports[_0xacb6('0x68')]=function(_0x3c279b){var _0x33e267=moment()[_0xacb6('0x7')](0x0);var _0x550c81=moment(_0x3c279b)[_0xacb6('0x7')](0x0);return _0x33e267['diff'](_0x550c81,_0xacb6('0x9'));};exports[_0xacb6('0x69')]=function(_0x5e89c4){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e89c4['ContactId'],'ListId':_0x5e89c4[_0xacb6('0x58')],'VoiceQueueId':_0x5e89c4[_0xacb6('0x1f')]||undefined,'CampaignId':_0x5e89c4[_0xacb6('0x6a')]||undefined};};exports[_0xacb6('0x6b')]=function(_0x488e13){if(_0x488e13===_0xacb6('0x4b')||_0x488e13===_0xacb6('0x6c')||_0x488e13===_0xacb6('0x5e')||_0x488e13==='type'||_0x488e13===_0xacb6('0x6d')||_0x488e13===_0xacb6('0x6e')||_0x488e13===_0xacb6('0x42')||_0x488e13===_0xacb6('0x64')||_0x488e13===_0xacb6('0x1c')||_0x488e13==='active'||_0x488e13===_0xacb6('0x1d')||_0x488e13===_0xacb6('0x56')||_0x488e13===_0xacb6('0x6f')||_0x488e13==='countcongestionretry'||_0x488e13===_0xacb6('0x51')||_0x488e13==='countglobal'||_0x488e13==='callback'||_0x488e13===_0xacb6('0x70')||_0x488e13===_0xacb6('0x71')||_0x488e13===_0xacb6('0x72')||_0x488e13===_0xacb6('0x57')||_0x488e13===_0xacb6('0x58')||_0x488e13===_0xacb6('0x43')||_0x488e13===_0xacb6('0x1f')||_0x488e13===_0xacb6('0x73')||_0x488e13===_0xacb6('0x74')||_0x488e13===_0xacb6('0x75')||_0x488e13===_0xacb6('0x76')||_0x488e13===_0xacb6('0x77')||_0x488e13===_0xacb6('0x78')||_0x488e13===_0xacb6('0x79')||_0x488e13===_0xacb6('0x7a')||_0x488e13===_0xacb6('0x7b')||_0x488e13==='xmd-dialchannel'||_0x488e13===_0xacb6('0x7c')||_0x488e13===_0xacb6('0x7d')||_0x488e13===_0xacb6('0x7e')||_0x488e13==='xmd-agiafter'||_0x488e13===_0xacb6('0x7f')||_0x488e13==='rtpaudioqos'||_0x488e13===_0xacb6('0x80')||_0x488e13===_0xacb6('0x81')||_0x488e13===_0xacb6('0x82')||_0x488e13===_0xacb6('0x83')||_0x488e13===_0xacb6('0x84')||_0x488e13==='rtpaudioqosrtt'||_0x488e13===_0xacb6('0x85')||_0x488e13===_0xacb6('0x86')||_0x488e13===_0xacb6('0x80')||_0x488e13==='rtpaudioqosjitter'||_0x488e13===_0xacb6('0x82')||_0x488e13===_0xacb6('0x83')||_0x488e13===_0xacb6('0x84')||_0x488e13===_0xacb6('0x87')||_0x488e13==='rtpaudioqosrttbridged'||_0x488e13==='bridgepeer'||_0x488e13===_0xacb6('0x88')||_0x488e13===_0xacb6('0x44')||_0x488e13===_0xacb6('0x3c')){return![];}return!![];};exports[_0xacb6('0x89')]=function(_0x30a3fa,_0x5835a3){var _0x41d29a,_0x1f8f1d,_0x2a7883;if(_0x5835a3<=0x0){_0x5835a3=0x1;}_0x41d29a=new RegExp(_0xacb6('0x8a')+_0x5835a3+'}$');_0x1f8f1d=Math[_0xacb6('0x8b')](0xa,_0x5835a3-0x1);_0x2a7883=Math[_0xacb6('0x8b')](0xa,_0x5835a3)-0x1;return util['format']('%s',_[_0xacb6('0x8c')](_0x30a3fa,_0x41d29a,_[_0xacb6('0x8d')](_0x1f8f1d,_0x2a7883)));};exports[_0xacb6('0x8e')]=function(_0x55f911){var _0x5845d7=_0x55f911[_0xacb6('0x8f')](/"(.*?)"/);return _0x5845d7?_0x5845d7[0x1]:_0x55f911;};exports['extractCalleridNumber']=function(_0x23c400){var _0x4ecf4d=_0x23c400['match'](/<(.*?)>/);return _0x4ecf4d?_0x4ecf4d[0x1]:_0x23c400;}; \ No newline at end of file +var _0xc3f8=['YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','logCustomer','endtime','talktime','answertime','isFailure','Failure','calleridname','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','calleridnum','callbackuniqueid','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','isNil','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','logAgent'];(function(_0x1dbbce,_0x48410a){var _0x30b20d=function(_0x239d3e){while(--_0x239d3e){_0x1dbbce['push'](_0x1dbbce['shift']());}};_0x30b20d(++_0x48410a);}(_0xc3f8,0xdf));var _0x8c3f=function(_0x384d91,_0xedbef1){_0x384d91=_0x384d91-0x0;var _0x415b03=_0xc3f8[_0x384d91];return _0x415b03;};'use strict';var util=require(_0x8c3f('0x0'));var _=require(_0x8c3f('0x1'));var moment=require(_0x8c3f('0x2'));var logger=require(_0x8c3f('0x3'))(_0x8c3f('0x4'));var ipAgi=process[_0x8c3f('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x442839,_0x5a4797){var _0x1d6084=moment(_0x442839)['milliseconds'](0x0);var _0xa4d9e6=moment(_0x5a4797)[_0x8c3f('0x6')](0x0);return _0x1d6084[_0x8c3f('0x7')](_0xa4d9e6,_0x8c3f('0x8'));}exports[_0x8c3f('0x9')]=function(_0xb6c6b6){return function(_0xb36768){logger[_0x8c3f('0xa')](_0xb6c6b6,util[_0x8c3f('0xb')](_0xb36768,{'showHidden':![],'depth':null}));};};exports[_0x8c3f('0xc')]=function(_0x5eea2e,_0x1e1f93){logger[_0x8c3f('0xd')](_0x5eea2e,util['inspect'](_0x1e1f93,{'showHidden':![],'depth':null}));};exports[_0x8c3f('0xe')]=function(_0x387a80,_0x558f9b){logger[_0x8c3f('0xa')](_0x387a80,util[_0x8c3f('0xb')](_0x558f9b,{'showHidden':![],'depth':null}));};exports[_0x8c3f('0xf')]=function(_0x5a7563){return function(_0x48c827){logger[_0x8c3f('0xd')](_0x5a7563,util['inspect'](_0x48c827,{'showHidden':![],'depth':null}));};};exports[_0x8c3f('0x10')]=function(_0xda4bae,_0x1eeca6,_0x448ed5){return{'message':_0xda4bae,'unlock':_0x1eeca6,'active':_0x448ed5};};exports[_0x8c3f('0x11')]=function(_0x5f3610,_0x316f4d,_0x1995dd){if(!_[_0x8c3f('0x12')](_0x1995dd)&&_0x8c3f('0x13')===typeof _0x1995dd&&!_['isEmpty'](_0x1995dd)){if(!_[_0x8c3f('0x12')](_0x316f4d)&&'string'===typeof _0x316f4d&&!_[_0x8c3f('0x14')](_0x316f4d)){return util[_0x8c3f('0x15')]('\x22%s\x22\x20<%s>',_0x316f4d,_0x1995dd);}return util['format'](_0x8c3f('0x16'),_0x1995dd,_0x1995dd);}if(!_[_0x8c3f('0x12')](_0x5f3610)&&_0x8c3f('0x13')===typeof _0x5f3610&&!_[_0x8c3f('0x14')](_0x5f3610)){return _0x5f3610;}return _0x8c3f('0x17');};exports['isActive']=function(_0x4f9b37){if(_['isNil'](_0x4f9b37)){return![];}return _0x4f9b37;};exports[_0x8c3f('0x18')]=function(_0x4b6540,_0x1f2f1c,_0x724770,_0x341c7c,_0x49a310,_0x43ec72){var _0x195afc={'XMD-QUEUE':_0x1f2f1c[_0x8c3f('0x19')]?_0x1f2f1c[_0x8c3f('0x19')][_0x8c3f('0x1a')]:'','XMD-CALLERID':_0x341c7c,'XMD-CALLERID-PREVIEW':_0x43ec72?util[_0x8c3f('0x15')](_0x8c3f('0x16'),_0x43ec72['calleridname'],_0x43ec72['calleridnum']):_0x341c7c,'XMD-DIALID':_0x49a310,'XMD-CONTACTID':_0x1f2f1c['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x341c7c,'XMD-VOICEQUEUEID':_0x1f2f1c[_0x8c3f('0x1b')],'XMD-DIALCHANNEL':_0x724770,'XMD-DIALTIMEOUT':_0x4b6540[_0x8c3f('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x8c3f('0x15')]('\x22rtTxX%s%s\x22',_0x4b6540[_0x8c3f('0x1d')]?'g':'',_[_0x8c3f('0x14')](_0x4b6540['monitor_format'])?'':_0x8c3f('0x1e')),'XMD-DIALURL':_0x4b6540[_0x8c3f('0x1f')]||'','XMD-AGI':_0x4b6540['dialQueueProject']?util['format'](_0x8c3f('0x20'),ipAgi,_0x4b6540[_0x8c3f('0x21')]):_0x8c3f('0x22'),'XMD-AGIAFTER':_0x4b6540['dialQueueProject2']?util[_0x8c3f('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4b6540[_0x8c3f('0x1d')]):_0x8c3f('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x43ec72?_0x43ec72['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x43ec72?_0x43ec72[_0x8c3f('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x8c3f('0x14')](_0x4b6540[_0x8c3f('0x24')])){_0x195afc[util[_0x8c3f('0x15')]('%s',_0x8c3f('0x25'))]=_0x4b6540[_0x8c3f('0x24')];_0x195afc[util[_0x8c3f('0x15')]('%s',_0x8c3f('0x26'))]=_0x49a310;}if(_0x1f2f1c&&_0x1f2f1c[_0x8c3f('0x27')]){for(var _0x4aafdf in _0x1f2f1c[_0x8c3f('0x27')]){if(_0x1f2f1c[_0x8c3f('0x27')]['hasOwnProperty'](_0x4aafdf)){if(!_['isNil'](_0x1f2f1c[_0x8c3f('0x27')][_0x4aafdf])&&_0x4aafdf!=='id'&&_0x4aafdf!==_0x8c3f('0x28')&&_0x4aafdf!==_0x8c3f('0x29')&&_0x4aafdf!==_0x8c3f('0x2a')){_0x195afc[util['format'](_0x8c3f('0x2b'),_0x8c3f('0x2c'),_[_0x8c3f('0x2d')](_0x4aafdf))]=_0x1f2f1c[_0x8c3f('0x27')][_0x4aafdf];}}}}return _0x195afc;};exports[_0x8c3f('0x2e')]=function(_0x491519){var _0x4b883b={};for(var _0x2e2b30 in _0x491519){if(_0x491519[_0x8c3f('0x2f')](_0x2e2b30)){_0x4b883b[util[_0x8c3f('0x15')]('%s',_['toLower'](_0x2e2b30))]=_0x491519[_0x2e2b30];}}return{'variables':_0x4b883b};};exports[_0x8c3f('0x30')]=function(_0x1c6714,_0x4b0992){if(!_[_0x8c3f('0x31')](_0x1c6714)){if(_0x1c6714[_0x8c3f('0x2f')](_0x8c3f('0x32'))){if(_0x1c6714[_0x8c3f('0x32')]>0x0){_0x1c6714['originated']-=0x1;}else{logger[_0x8c3f('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x4b0992);}}}else{logger[_0x8c3f('0xa')](_0x8c3f('0x33'),_0x4b0992);}};exports[_0x8c3f('0x34')]=function(_0x23a7a6){var _0x4832ae=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x23a7a6[_0x8c3f('0x35')]=0xd;_0x23a7a6[_0x8c3f('0x36')]=_0x8c3f('0x37');_0x23a7a6[_0x8c3f('0x38')]=_0x4832ae;_0x23a7a6[_0x8c3f('0x39')]=_0x4832ae;_0x23a7a6['endtime']=_0x4832ae;};exports[_0x8c3f('0x3a')]=function(_0x10c014,_0x2c6305,_0x2ed5f8){var _0x1400a4=moment()[_0x8c3f('0x15')](_0x8c3f('0x3b'));_0x10c014['state']=_0x2c6305;_0x10c014[_0x8c3f('0x36')]=_0x2ed5f8;_0x10c014[_0x8c3f('0x39')]=_0x1400a4;_0x10c014[_0x8c3f('0x3c')]=getSeconds(_0x10c014[_0x8c3f('0x39')],_0x10c014['starttime']);};exports[_0x8c3f('0x3d')]=function(_0x249bea,_0x25dd30,_0x145b19){_0x249bea[_0x8c3f('0x3e')]=_0x25dd30;_0x249bea['UserId']=_0x145b19;};exports[_0x8c3f('0x3f')]=function(_0x1a1cd2,_0x3693a4,_0xc2efd){var _0x175481=moment()['format'](_0x8c3f('0x3b'));_0x1a1cd2[_0x8c3f('0x35')]=_0x3693a4;_0x1a1cd2[_0x8c3f('0x36')]=_0xc2efd;_0x1a1cd2[_0x8c3f('0x39')]=_0x1a1cd2['responsetime']?_0x1a1cd2[_0x8c3f('0x39')]:_0x175481;_0x1a1cd2[_0x8c3f('0x40')]=_0x1a1cd2['endtime']?_0x1a1cd2[_0x8c3f('0x40')]:_0x175481;_0x1a1cd2['ringtime']=getSeconds(_0x1a1cd2['responsetime']||0x0,_0x1a1cd2[_0x8c3f('0x38')]||0x0);_0x1a1cd2[_0x8c3f('0x41')]=_0x1a1cd2['answertime']?getSeconds(_0x1a1cd2[_0x8c3f('0x40')],_0x1a1cd2[_0x8c3f('0x42')]):0x0;};exports[_0x8c3f('0x43')]=function(_0x599eb7){return _0x599eb7===_0x8c3f('0x44');};exports['variablesAction']=function(_0x52f874,_0x30feac,_0x26bb2d,_0x14ad71,_0x19f4ba){var _0x47e1a1=_0x14ad71?'RECALL':_0x52f874[_0x8c3f('0x45')];_0x47e1a1=_0x19f4ba?_0x8c3f('0x46'):_0x47e1a1;return{'actionid':_0x52f874[_0x8c3f('0x47')],'action':_0x8c3f('0x48'),'channel':_0x52f874['channelAgent'],'callerid':util[_0x8c3f('0x15')](_0x8c3f('0x16'),_0x47e1a1,_0x52f874['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x8c3f('0x49'),'Priority':'1','variable':_0x26bb2d,'timeout':(_0x30feac[_0x8c3f('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x52f874[_0x8c3f('0x47')]};};exports[_0x8c3f('0x4b')]=function(_0x40a72a){return _0x40a72a[_0x8c3f('0x4c')]+_0x40a72a[_0x8c3f('0x4d')]+_0x40a72a[_0x8c3f('0x4e')]+_0x40a72a['countagentrejectretry']+_0x40a72a[_0x8c3f('0x4f')];};exports[_0x8c3f('0x50')]=function(_0xf13740){var _0x3cb608=_[_0x8c3f('0x51')](_0xf13740);_0x3cb608[_0x8c3f('0x35')]=0xf;_0x3cb608['statedesc']=_0x8c3f('0x52');return _0x3cb608;};exports[_0x8c3f('0x53')]=function(_0x5e8d5f,_0x423225,_0x4fab73){var _0x4d4824={};_0x4d4824[_0x423225]=_0x5e8d5f[_0x423225];_0x4d4824[_0x8c3f('0x54')]=![];_0x4d4824[_0x8c3f('0x55')]=moment()[_0x8c3f('0x56')](_0x4fab73,_0x8c3f('0x57'))[_0x8c3f('0x15')](_0x8c3f('0x3b'));_0x4d4824[_0x8c3f('0x58')]=_0x5e8d5f[_0x8c3f('0x58')];_0x4d4824[_0x8c3f('0x59')]=_0x5e8d5f[_0x8c3f('0x59')];_0x4d4824[_0x8c3f('0x1b')]=_0x5e8d5f[_0x8c3f('0x1b')]||undefined;return _0x4d4824;};exports[_0x8c3f('0x5a')]=function(_0x5a7964,_0x3135d5){if(!_['isNil'](_0x5a7964)){if(_0x5a7964['pTalking']>0x0){_0x5a7964[_0x8c3f('0x5b')]-=0x1;}else{logger['error'](_0x3135d5,_0x8c3f('0x5c'));}}else{logger[_0x8c3f('0xa')](_0x3135d5,_0x8c3f('0x5d'));}};exports[_0x8c3f('0x5e')]=function(_0xfd93d3){if(_0xfd93d3<=0x0){return!![];}return![];};exports['buildObj']=function(_0xd08e35,_0x144206,_0xf1980a){_0xd08e35['lastevent']=_0x144206;_0xd08e35[_0x8c3f('0x1a')]=_0xd08e35[_0x8c3f('0x5f')];_0xd08e35[_0x8c3f('0x60')]=_0xd08e35[_0x8c3f('0x61')];_0xd08e35[_0x8c3f('0x62')]=_0x8c3f('0x63');if(_0xf1980a){_0xd08e35['mandatoryDisposition']=_0xf1980a[_0x8c3f('0x64')];}return _0xd08e35;};exports[_0x8c3f('0x65')]=function(_0x57b734){var _0x33ccdf={};_0x33ccdf[_0x8c3f('0x5f')]=_0x57b734[_0x8c3f('0x5f')];_0x33ccdf['interface']=_0x57b734[_0x8c3f('0x61')];_0x33ccdf[_0x8c3f('0x47')]=_0x57b734[_0x8c3f('0x47')];return _0x33ccdf;};exports[_0x8c3f('0x66')]=function(_0x174d44){var _0x27f233=[];for(var _0x202406 in _0x174d44){if(_0x174d44['hasOwnProperty'](_0x202406)){if(!_[_0x8c3f('0x31')](_0x174d44[_0x202406])&&_0x174d44[_0x202406][_0x8c3f('0x35')]===_0x8c3f('0x67')&&_0x174d44[_0x202406][_0x8c3f('0x68')]===_0x8c3f('0x69')){_0x27f233[_0x8c3f('0x6a')](_0x174d44[_0x202406]['id']);}}}return _0x27f233;};exports[_0x8c3f('0x6b')]=function(_0x1b622c){var _0x5bef4=moment()['milliseconds'](0x0);var _0x1fa4b9=moment(_0x1b622c)[_0x8c3f('0x6')](0x0);return _0x5bef4[_0x8c3f('0x7')](_0x1fa4b9,_0x8c3f('0x8'));};exports[_0x8c3f('0x6c')]=function(_0x5802c9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5802c9[_0x8c3f('0x58')],'ListId':_0x5802c9[_0x8c3f('0x59')],'VoiceQueueId':_0x5802c9['VoiceQueueId']||undefined,'CampaignId':_0x5802c9[_0x8c3f('0x6d')]||undefined};};exports['filterKey']=function(_0x3ef82b){if(_0x3ef82b==='uniqueid'||_0x3ef82b===_0x8c3f('0x6e')||_0x3ef82b===_0x8c3f('0x5f')||_0x3ef82b===_0x8c3f('0x6f')||_0x3ef82b===_0x8c3f('0x70')||_0x3ef82b===_0x8c3f('0x71')||_0x3ef82b===_0x8c3f('0x3e')||_0x3ef82b===_0x8c3f('0x61')||_0x3ef82b==='calleridname'||_0x3ef82b===_0x8c3f('0x54')||_0x3ef82b===_0x8c3f('0x72')||_0x3ef82b===_0x8c3f('0x55')||_0x3ef82b===_0x8c3f('0x4c')||_0x3ef82b===_0x8c3f('0x4d')||_0x3ef82b==='countnoanswerretry'||_0x3ef82b==='countglobal'||_0x3ef82b==='callback'||_0x3ef82b===_0x8c3f('0x73')||_0x3ef82b==='callbackat'||_0x3ef82b==='recallme'||_0x3ef82b===_0x8c3f('0x58')||_0x3ef82b===_0x8c3f('0x59')||_0x3ef82b==='UserId'||_0x3ef82b===_0x8c3f('0x1b')||_0x3ef82b===_0x8c3f('0x74')||_0x3ef82b==='xmd-voicequeueid'||_0x3ef82b===_0x8c3f('0x75')||_0x3ef82b===_0x8c3f('0x76')||_0x3ef82b===_0x8c3f('0x77')||_0x3ef82b===_0x8c3f('0x78')||_0x3ef82b==='xmd-dialtimeout'||_0x3ef82b===_0x8c3f('0x79')||_0x3ef82b==='xmd-dialid'||_0x3ef82b===_0x8c3f('0x7a')||_0x3ef82b===_0x8c3f('0x7b')||_0x3ef82b===_0x8c3f('0x7c')||_0x3ef82b==='xmd-callerid'||_0x3ef82b===_0x8c3f('0x7d')||_0x3ef82b===_0x8c3f('0x7e')||_0x3ef82b==='rtpaudioqos'||_0x3ef82b==='rtpaudioqosbridged'||_0x3ef82b==='rtpaudioqosjitter'||_0x3ef82b==='rtpaudioqosjitterbridged'||_0x3ef82b===_0x8c3f('0x7f')||_0x3ef82b==='rtpaudioqoslossbridged'||_0x3ef82b==='rtpaudioqosrtt'||_0x3ef82b===_0x8c3f('0x80')||_0x3ef82b==='rtpaudioqos'||_0x3ef82b===_0x8c3f('0x81')||_0x3ef82b===_0x8c3f('0x82')||_0x3ef82b==='rtpaudioqosjitterbridged'||_0x3ef82b===_0x8c3f('0x7f')||_0x3ef82b===_0x8c3f('0x83')||_0x3ef82b===_0x8c3f('0x84')||_0x3ef82b===_0x8c3f('0x80')||_0x3ef82b===_0x8c3f('0x85')||_0x3ef82b==='bridgepvtcallid'||_0x3ef82b===_0x8c3f('0x35')||_0x3ef82b===_0x8c3f('0x36')){return![];}return!![];};exports[_0x8c3f('0x86')]=function(_0x21040c,_0x275a2f){var _0xa2fe3c,_0x2c224f,_0x1183c7;if(_0x275a2f<=0x0){_0x275a2f=0x1;}_0xa2fe3c=new RegExp(_0x8c3f('0x87')+_0x275a2f+'}$');_0x2c224f=Math[_0x8c3f('0x88')](0xa,_0x275a2f-0x1);_0x1183c7=Math[_0x8c3f('0x88')](0xa,_0x275a2f)-0x1;return util['format']('%s',_['replace'](_0x21040c,_0xa2fe3c,_[_0x8c3f('0x89')](_0x2c224f,_0x1183c7)));};exports[_0x8c3f('0x8a')]=function(_0x5c6347){var _0x348cb2=_0x5c6347[_0x8c3f('0x8b')](/"(.*?)"/);return _0x348cb2?_0x348cb2[0x1]:_0x5c6347;};exports[_0x8c3f('0x8c')]=function(_0x1d6e3b){var _0xec19d2=_0x1d6e3b[_0x8c3f('0x8b')](/<(.*?)>/);return _0xec19d2?_0xec19d2[0x1]:_0x1d6e3b;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e00dc47..bfac067 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 _0x7f0e=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','voicequeuechannel'];(function(_0x57a183,_0x410924){var _0xec8c5a=function(_0x5c27b2){while(--_0x5c27b2){_0x57a183['push'](_0x57a183['shift']());}};_0xec8c5a(++_0x410924);}(_0x7f0e,0x19d));var _0xe7f0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7f0e[_0x14add3];return _0x4a174f;};'use strict';exports[_0xe7f0('0x0')]={'queue':{'type':_0xe7f0('0x1'),'required':!![]},'interface':{'type':_0xe7f0('0x1'),'required':!![]},'membername':{'type':_0xe7f0('0x1'),'required':!![]},'penalty':{'type':_0xe7f0('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xe7f0('0x3')]={'queue':{'type':_0xe7f0('0x1'),'required':!![]},'interface':{'type':_0xe7f0('0x1'),'required':!![]}};exports[_0xe7f0('0x4')]={'interface':{'type':_0xe7f0('0x1'),'required':!![]},'paused':{'type':_0xe7f0('0x5')},'reason':{'type':_0xe7f0('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xe7f0('0x1'),'required':![]}};exports[_0xe7f0('0x6')]={'uniqueid':{'type':_0xe7f0('0x1'),'required':!![]}};exports[_0xe7f0('0x7')]={'uniqueid':{'type':_0xe7f0('0x1'),'required':!![]},'filename':{'type':_0xe7f0('0x1')},'format':{'type':_0xe7f0('0x1')},'mixmonitorid':{'type':_0xe7f0('0x1')}};exports[_0xe7f0('0x8')]={'uniqueid':{'type':_0xe7f0('0x1'),'required':!![]}};exports[_0xe7f0('0x9')]={'uniqueid':{'type':_0xe7f0('0x1'),'required':!![]},'exten':{'type':_0xe7f0('0x1'),'required':!![]},'context':{'type':_0xe7f0('0x1')}}; \ No newline at end of file +var _0x7d8d=['queueadd','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x101fb8,_0x2de1ad){var _0x13aa8f=function(_0x4b0a14){while(--_0x4b0a14){_0x101fb8['push'](_0x101fb8['shift']());}};_0x13aa8f(++_0x2de1ad);}(_0x7d8d,0x134));var _0xd7d8=function(_0x5045d5,_0x5194e7){_0x5045d5=_0x5045d5-0x0;var _0x41e862=_0x7d8d[_0x5045d5];return _0x41e862;};'use strict';exports[_0xd7d8('0x0')]={'queue':{'type':_0xd7d8('0x1'),'required':!![]},'interface':{'type':_0xd7d8('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xd7d8('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xd7d8('0x3')]={'queue':{'type':_0xd7d8('0x1'),'required':!![]},'interface':{'type':_0xd7d8('0x1'),'required':!![]}};exports[_0xd7d8('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xd7d8('0x5')},'reason':{'type':_0xd7d8('0x1'),'required':![]}};exports[_0xd7d8('0x6')]={'module':{'type':_0xd7d8('0x1'),'required':![]}};exports[_0xd7d8('0x7')]={'uniqueid':{'type':_0xd7d8('0x1'),'required':!![]}};exports[_0xd7d8('0x8')]={'uniqueid':{'type':_0xd7d8('0x1'),'required':!![]},'filename':{'type':_0xd7d8('0x1')},'format':{'type':_0xd7d8('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xd7d8('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xd7d8('0xa')]={'uniqueid':{'type':_0xd7d8('0x1'),'required':!![]},'exten':{'type':_0xd7d8('0x1'),'required':!![]},'context':{'type':_0xd7d8('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 30ba5a6..2a1b1f1 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 _0x489c=['diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','outbound','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','trunks','voiceQueues','triggers','templates','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','format','SIP/%s','name','mapKeys','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isUndefined','prototype','initTelephones','telephones','initTrunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt'];(function(_0x3c568b,_0x3a364c){var _0x282ed0=function(_0x2ab80e){while(--_0x2ab80e){_0x3c568b['push'](_0x3c568b['shift']());}};_0x282ed0(++_0x3a364c);}(_0x489c,0xe8));var _0xc489=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x489c[_0x1505e5];return _0x5b1dcd;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0xc489('0x0'));var Trunk=require(_0xc489('0x1'));var VoiceQueue=require(_0xc489('0x2'));var Trigger=require(_0xc489('0x3'));var Template=require(_0xc489('0x4'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xc489('0x5'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xc489('0x6'));var FreshdeskAccount=require(_0xc489('0x7'));var SugarcrmAccount=require(_0xc489('0x8'));var ZohoAccount=require(_0xc489('0x9'));var DeskAccount=require(_0xc489('0xa'));var VtigerAccount=require(_0xc489('0xb'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xc489('0xc'));var FreshsalesAccount=require(_0xc489('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xc489('0xe')]={};this['telephones']={};this[_0xc489('0xf')]={};this[_0xc489('0x10')]={};this[_0xc489('0x11')]={};this['campaigns']={};this[_0xc489('0x12')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xc489('0x13')]={};this[_0xc489('0x14')]={};this[_0xc489('0x15')]={};this[_0xc489('0x16')]={};this[_0xc489('0x17')]={};this[_0xc489('0x18')]={};this[_0xc489('0x19')]={};this[_0xc489('0x1a')]={};this[_0xc489('0x1b')]={};this[_0xc489('0x1c')]={};this[_0xc489('0x1d')]={};this[_0xc489('0x1e')]={};this[_0xc489('0x1f')]={};this[_0xc489('0x20')]={};this[_0xc489('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0x5b49e8,_0x5a5fbd,_0x47c89f){var _0x4b2668=_['mapKeys'](_0x5b49e8,function(_0x337b66,_0x5b80af){return _0x337b66[_0x47c89f];});for(var _0xfacf56 in _0x5a5fbd){if(_0x5a5fbd[_0xc489('0x22')](_0xfacf56)){if(!_0x4b2668[_0xfacf56]){delete _0x5a5fbd[_0xfacf56];}}}}function freeIsNotKeySip(_0x4bd6ff,_0x3efa20){var _0x2bdaed=_['mapKeys'](_0x4bd6ff,function(_0x25a2bf,_0xa3691d){return util[_0xc489('0x23')](_0xc489('0x24'),_0x25a2bf[_0xc489('0x25')]);});for(var _0x5b7928 in _0x3efa20){if(_0x3efa20[_0xc489('0x22')](_0x5b7928)){if(!_0x2bdaed[_0x5b7928]){delete _0x3efa20[_0x5b7928];}}}}function freeIsNotKeyAgent(_0x1b5e51,_0x3f88a7){var _0x55e3c3=_[_0xc489('0x26')](_0x1b5e51,function(_0x54f74c,_0x4bc40f){var _0x9c610b=_[_0xc489('0x27')](_0x54f74c[_0xc489('0x28')])?util[_0xc489('0x23')](_0xc489('0x24'),_0x54f74c[_0xc489('0x25')]):_0x54f74c['interface'];return _0x9c610b;});for(var _0x3b349e in _0x3f88a7){if(_0x3f88a7[_0xc489('0x22')](_0x3b349e)){if(!_0x55e3c3[_0x3b349e]){delete _0x3f88a7[_0x3b349e];}}}}function clearVoiceCallReports(_0x20000c){_0x20000c[_0xc489('0x29')]=0x0;_0x20000c['answered']=0x0;_0x20000c[_0xc489('0x2a')]=0x0;_0x20000c[_0xc489('0x2b')]=0x0;_0x20000c[_0xc489('0x2c')]=0x0;}function clearCampaigns(_0x139425){if(!_[_0xc489('0x2d')](_0x139425)){for(var _0x1ad2b3 in _0x139425){if(_0x139425[_0xc489('0x22')](_0x1ad2b3)){_0x139425[_0x1ad2b3]['ivrTotalCallsDays']=0x0;_0x139425[_0x1ad2b3][_0xc489('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x5a2e23){if(!_[_0xc489('0x2d')](_0x5a2e23)){for(var _0x1c0353 in _0x5a2e23){if(_0x5a2e23[_0xc489('0x22')](_0x1c0353)){_0x5a2e23[_0x1c0353][_0xc489('0x29')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x2f')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x30')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x31')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x2a')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x2b')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x2c')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x32')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x33')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x34')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x35')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x36')]=0x0;_0x5a2e23[_0x1c0353]['outboundUnknownCallsDay']=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x37')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x38')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x39')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x3a')]=0x0;_0x5a2e23[_0x1c0353]['outboundRejectCallsDay']=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x3b')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x32')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x3c')]=0x0;_0x5a2e23[_0x1c0353][_0xc489('0x3d')]=!![];}}}}Realtime['prototype'][_0xc489('0x3e')]=function(_0xd6c383,_0x259fb9){for(var _0x2a2c9e in _0x259fb9){if(_0xd6c383[_0xc489('0x22')](_0x2a2c9e)){_0xd6c383[_0x2a2c9e]=_0x259fb9[_0x2a2c9e];}}};Realtime['prototype'][_0xc489('0x3f')]=function(){var _0x542933=this;return function(_0x7d6671){if(_0x7d6671){freeIsNotKeyAgent(_0x7d6671,_0x542933['agents']);for(var _0x33986c=0x0,_0x58b4cc={},_0x24e08f={};_0x33986c<_0x7d6671[_0xc489('0x40')];_0x33986c+=0x1){_0x58b4cc=_0x7d6671[_0x33986c];var _0x5cf1f0=_['isNil'](_0x58b4cc['interface'])?util[_0xc489('0x23')](_0xc489('0x24'),_0x58b4cc['name']):_0x58b4cc[_0xc489('0x28')];if(_[_0xc489('0x41')](_0x542933[_0xc489('0xe')][_0x5cf1f0])){_0x542933[_0xc489('0xe')][_0x5cf1f0]=new Agent(_0x58b4cc);}else{_0x542933[_0xc489('0x3e')](_0x542933[_0xc489('0xe')][_0x5cf1f0],_0x58b4cc);}}}return _0x542933[_0xc489('0xe')];};};Realtime[_0xc489('0x42')][_0xc489('0x43')]=function(){var _0xba5ff7=this;return function(_0x3c09d8){if(_0x3c09d8){freeIsNotKeySip(_0x3c09d8,_0xba5ff7[_0xc489('0x44')]);for(var _0x4e6270=0x0,_0x3acb71={},_0x38664c={};_0x4e6270<_0x3c09d8[_0xc489('0x40')];_0x4e6270+=0x1){_0x3acb71=_0x3c09d8[_0x4e6270];if(_[_0xc489('0x41')](_0xba5ff7['telephones'][util[_0xc489('0x23')](_0xc489('0x24'),_0x3acb71['name'])])){_0xba5ff7['telephones'][util['format'](_0xc489('0x24'),_0x3acb71[_0xc489('0x25')])]=new Telephone(_0x3acb71);}else{_0xba5ff7[_0xc489('0x3e')](_0xba5ff7[_0xc489('0x44')][util[_0xc489('0x23')](_0xc489('0x24'),_0x3acb71[_0xc489('0x25')])],_0x3acb71);}}}return _0xba5ff7[_0xc489('0x44')];};};Realtime[_0xc489('0x42')][_0xc489('0x45')]=function(){var _0x269d4f=this;return function(_0x39df5a){if(_0x39df5a){freeIsNotKeySip(_0x39df5a,_0x269d4f['trunks']);for(var _0x1a4b08=0x0,_0x2e61fc={},_0x167e80={};_0x1a4b08<_0x39df5a[_0xc489('0x40')];_0x1a4b08+=0x1){_0x2e61fc=_0x39df5a[_0x1a4b08];if(_[_0xc489('0x41')](_0x269d4f[_0xc489('0xf')][util[_0xc489('0x23')]('SIP/%s',_0x2e61fc['name'])])){_0x269d4f[_0xc489('0xf')][util[_0xc489('0x23')](_0xc489('0x24'),_0x2e61fc[_0xc489('0x25')])]=new Trunk(_0x2e61fc);}else{_0x269d4f['mergeFromDatabase'](_0x269d4f['trunks'][util['format'](_0xc489('0x24'),_0x2e61fc['name'])],_0x2e61fc);}}}return _0x269d4f[_0xc489('0xf')];};};Realtime[_0xc489('0x42')]['initVoiceQueues']=function(){var _0x1e61c6=this;return function(_0x10419c){if(_0x10419c){freeIsNotKey(_0x10419c,_0x1e61c6[_0xc489('0x10')],_0xc489('0x25'));for(var _0x41bc3e=0x0,_0x2c54cf={},_0x897582={};_0x41bc3e<_0x10419c['length'];_0x41bc3e+=0x1){_0x2c54cf=_0x10419c[_0x41bc3e];if(_[_0xc489('0x41')](_0x1e61c6['voiceQueues'][_0x2c54cf['name']])){_0x1e61c6[_0xc489('0x10')][_0x2c54cf['name']]=new VoiceQueue(_0x2c54cf);}else{_0x1e61c6[_0xc489('0x3e')](_0x1e61c6['voiceQueues'][_0x2c54cf[_0xc489('0x25')]],_0x2c54cf);}}}return _0x1e61c6[_0xc489('0x10')];};};Realtime[_0xc489('0x42')]['initTriggers']=function(){var _0x4123b0=this;return function(_0x9446ee){if(_0x9446ee){freeIsNotKey(_0x9446ee,_0x4123b0[_0xc489('0x11')],'id');for(var _0x254814=0x0,_0x160029={},_0x51a95e={};_0x254814<_0x9446ee[_0xc489('0x40')];_0x254814+=0x1){_0x160029=_0x9446ee[_0x254814];if(_[_0xc489('0x41')](_0x4123b0['triggers'][_0x160029['id']])){_0x4123b0['triggers'][_0x160029['id']]=new Trigger(_0x160029);}else{_0x4123b0[_0xc489('0x3e')](_0x4123b0['triggers'][_0x160029['id']],_0x160029);}}}return _0x4123b0[_0xc489('0x11')];};};Realtime[_0xc489('0x42')][_0xc489('0x46')]=function(){var _0x5891e4=this;return function(_0x209d1e){if(_0x209d1e){freeIsNotKey(_0x209d1e,_0x5891e4[_0xc489('0x12')],'id');for(var _0x29dbf7=0x0,_0x30331b={},_0x2517cb={};_0x29dbf7<_0x209d1e[_0xc489('0x40')];_0x29dbf7+=0x1){_0x30331b=_0x209d1e[_0x29dbf7];if(_[_0xc489('0x41')](_0x5891e4[_0xc489('0x12')][_0x30331b['id']])){_0x5891e4[_0xc489('0x12')][_0x30331b['id']]=new Template(_0x30331b);}else{_0x5891e4[_0xc489('0x3e')](_0x5891e4['templates'][_0x30331b['id']],_0x30331b);}}}return _0x5891e4[_0xc489('0x12')];};};Realtime[_0xc489('0x42')][_0xc489('0x47')]=function(){var _0x4dbed2=this;return function(_0x1a2b91){if(_0x1a2b91){freeIsNotKey(_0x1a2b91,_0x4dbed2['zendeskAccounts'],'id');for(var _0x292bac=0x0,_0x3ea280={},_0x19957a={};_0x292bac<_0x1a2b91[_0xc489('0x40')];_0x292bac+=0x1){_0x3ea280=_0x1a2b91[_0x292bac];if(_[_0xc489('0x41')](_0x4dbed2[_0xc489('0x18')][_0x3ea280['id']])){_0x4dbed2[_0xc489('0x18')][_0x3ea280['id']]=new ZendeskAccount(_0x3ea280);}else{_0x4dbed2[_0xc489('0x3e')](_0x4dbed2[_0xc489('0x18')][_0x3ea280['id']],_0x3ea280);}}}return _0x4dbed2[_0xc489('0x18')];};};Realtime[_0xc489('0x42')][_0xc489('0x48')]=function(){var _0x3f6922=this;return function(_0x2c5f94){if(_0x2c5f94){freeIsNotKey(_0x2c5f94,_0x3f6922[_0xc489('0x19')],'id');for(var _0x191dea=0x0,_0x4e9b32={},_0x3242c7={};_0x191dea<_0x2c5f94[_0xc489('0x40')];_0x191dea+=0x1){_0x4e9b32=_0x2c5f94[_0x191dea];if(_[_0xc489('0x41')](_0x3f6922[_0xc489('0x19')][_0x4e9b32['id']])){_0x3f6922[_0xc489('0x19')][_0x4e9b32['id']]=new SalesforceAccount(_0x4e9b32);}else{_0x3f6922[_0xc489('0x3e')](_0x3f6922[_0xc489('0x19')][_0x4e9b32['id']],_0x4e9b32);}}}return _0x3f6922[_0xc489('0x19')];};};Realtime[_0xc489('0x42')][_0xc489('0x49')]=function(){var _0x59295e=this;return function(_0x4de6b0){if(_0x4de6b0){freeIsNotKey(_0x4de6b0,_0x59295e[_0xc489('0x1b')],'id');for(var _0x529a41=0x0,_0x134640={},_0x17d804={};_0x529a41<_0x4de6b0[_0xc489('0x40')];_0x529a41+=0x1){_0x134640=_0x4de6b0[_0x529a41];if(_[_0xc489('0x41')](_0x59295e[_0xc489('0x1b')][_0x134640['id']])){_0x59295e['freshdeskAccounts'][_0x134640['id']]=new FreshdeskAccount(_0x134640);}else{_0x59295e[_0xc489('0x3e')](_0x59295e[_0xc489('0x1b')][_0x134640['id']],_0x134640);}}}return _0x59295e['freshdeskAccounts'];};};Realtime[_0xc489('0x42')][_0xc489('0x4a')]=function(){var _0x58f6e0=this;return function(_0x171ecc){if(_0x171ecc){freeIsNotKey(_0x171ecc,_0x58f6e0[_0xc489('0x1c')],'id');for(var _0x3ee6b6=0x0,_0x4ab126={},_0x416e3d={};_0x3ee6b6<_0x171ecc[_0xc489('0x40')];_0x3ee6b6+=0x1){_0x4ab126=_0x171ecc[_0x3ee6b6];if(_[_0xc489('0x41')](_0x58f6e0[_0xc489('0x1c')][_0x4ab126['id']])){_0x58f6e0[_0xc489('0x1c')][_0x4ab126['id']]=new ZohoAccount(_0x4ab126);}else{_0x58f6e0[_0xc489('0x3e')](_0x58f6e0[_0xc489('0x1c')][_0x4ab126['id']],_0x4ab126);}}}return _0x58f6e0[_0xc489('0x1c')];};};Realtime[_0xc489('0x42')][_0xc489('0x4b')]=function(){var _0x3a3e69=this;return function(_0x5a471e){if(_0x5a471e){freeIsNotKey(_0x5a471e,_0x3a3e69[_0xc489('0x1d')],'id');for(var _0x1b4f7b=0x0,_0x5ea61d={},_0x15ca80={};_0x1b4f7b<_0x5a471e[_0xc489('0x40')];_0x1b4f7b+=0x1){_0x5ea61d=_0x5a471e[_0x1b4f7b];if(_[_0xc489('0x41')](_0x3a3e69[_0xc489('0x1d')][_0x5ea61d['id']])){_0x3a3e69['deskAccounts'][_0x5ea61d['id']]=new DeskAccount(_0x5ea61d);}else{_0x3a3e69[_0xc489('0x3e')](_0x3a3e69[_0xc489('0x1d')][_0x5ea61d['id']],_0x5ea61d);}}}return _0x3a3e69[_0xc489('0x1d')];};};Realtime[_0xc489('0x42')][_0xc489('0x4c')]=function(){var _0xb9709f=this;return function(_0x5dfa08){if(_0x5dfa08){freeIsNotKey(_0x5dfa08,_0xb9709f['sugarcrmAccounts'],'id');for(var _0x31797d=0x0,_0x1eef0f={},_0x4ae83c={};_0x31797d<_0x5dfa08[_0xc489('0x40')];_0x31797d+=0x1){_0x1eef0f=_0x5dfa08[_0x31797d];if(_['isUndefined'](_0xb9709f[_0xc489('0x1a')][_0x1eef0f['id']])){_0xb9709f[_0xc489('0x1a')][_0x1eef0f['id']]=new SugarcrmAccount(_0x1eef0f);}else{_0xb9709f[_0xc489('0x3e')](_0xb9709f['sugarcrmAccounts'][_0x1eef0f['id']],_0x1eef0f);}}}return _0xb9709f[_0xc489('0x1a')];};};Realtime[_0xc489('0x42')]['initVtigerAccounts']=function(){var _0x2a5636=this;return function(_0x2c0e21){if(_0x2c0e21){freeIsNotKey(_0x2c0e21,_0x2a5636[_0xc489('0x1e')],'id');for(var _0x3cd736=0x0,_0x34a766={},_0x3f426e={};_0x3cd736<_0x2c0e21[_0xc489('0x40')];_0x3cd736+=0x1){_0x34a766=_0x2c0e21[_0x3cd736];if(_[_0xc489('0x41')](_0x2a5636[_0xc489('0x1e')][_0x34a766['id']])){_0x2a5636[_0xc489('0x1e')][_0x34a766['id']]=new VtigerAccount(_0x34a766);}else{_0x2a5636['mergeFromDatabase'](_0x2a5636[_0xc489('0x1e')][_0x34a766['id']],_0x34a766);}}}return _0x2a5636[_0xc489('0x1e')];};};Realtime[_0xc489('0x42')]['initServicenowAccounts']=function(){var _0x1d271b=this;return function(_0x1cf6b4){if(_0x1cf6b4){freeIsNotKey(_0x1cf6b4,_0x1d271b[_0xc489('0x1f')],'id');for(var _0x48efe7=0x0,_0x1fab87={},_0x3ada2e={};_0x48efe7<_0x1cf6b4[_0xc489('0x40')];_0x48efe7+=0x1){_0x1fab87=_0x1cf6b4[_0x48efe7];if(_['isUndefined'](_0x1d271b[_0xc489('0x1f')][_0x1fab87['id']])){_0x1d271b[_0xc489('0x1f')][_0x1fab87['id']]=new ServicenowAccount(_0x1fab87);}else{_0x1d271b[_0xc489('0x3e')](_0x1d271b['servicenowAccounts'][_0x1fab87['id']],_0x1fab87);}}}return _0x1d271b[_0xc489('0x1f')];};};Realtime[_0xc489('0x42')][_0xc489('0x4d')]=function(){var _0x3c6d74=this;return function(_0x1f59a8){if(_0x1f59a8){freeIsNotKey(_0x1f59a8,_0x3c6d74[_0xc489('0x20')],'id');for(var _0x9258ec=0x0,_0x440d7b={},_0x412749={};_0x9258ec<_0x1f59a8['length'];_0x9258ec+=0x1){_0x440d7b=_0x1f59a8[_0x9258ec];if(_[_0xc489('0x41')](_0x3c6d74[_0xc489('0x20')][_0x440d7b['id']])){_0x3c6d74[_0xc489('0x20')][_0x440d7b['id']]=new Dynamics365Account(_0x440d7b);}else{_0x3c6d74[_0xc489('0x3e')](_0x3c6d74['dynamics365Accounts'][_0x440d7b['id']],_0x440d7b);}}}return _0x3c6d74[_0xc489('0x20')];};};Realtime[_0xc489('0x42')]['initFreshsalesAccounts']=function(){var _0x24f47a=this;return function(_0x245603){if(_0x245603){freeIsNotKey(_0x245603,_0x24f47a[_0xc489('0x21')],'id');for(var _0x45c3ce=0x0,_0x57d769={},_0x4c8304={};_0x45c3ce<_0x245603['length'];_0x45c3ce+=0x1){_0x57d769=_0x245603[_0x45c3ce];if(_[_0xc489('0x41')](_0x24f47a[_0xc489('0x21')][_0x57d769['id']])){_0x24f47a[_0xc489('0x21')][_0x57d769['id']]=new FreshsalesAccount(_0x57d769);}else{_0x24f47a[_0xc489('0x3e')](_0x24f47a[_0xc489('0x21')][_0x57d769['id']],_0x57d769);}}}return _0x24f47a[_0xc489('0x21')];};};Realtime[_0xc489('0x42')][_0xc489('0x4e')]=function(){var _0x58633b=this;return function(_0x416976){for(var _0x4f11e7=0x0;_0x4f11e7<_0x416976[_0xc489('0x40')];_0x4f11e7+=0x1){_[_0xc489('0x4f')](_0x58633b['voiceQueues'][_0x416976[_0x4f11e7]['name']],_0x416976[_0x4f11e7]);}return _0x58633b[_0xc489('0x10')];};};Realtime[_0xc489('0x42')][_0xc489('0x50')]=function(){var _0x221366=this;return function(_0x336d90){clearVoiceQueues(_0x221366[_0xc489('0x10')]);if(_0x336d90){_0x336d90=_[_0xc489('0x51')](_0x336d90,_0xc489('0x52'));for(var _0x105cfe in _0x336d90){if(_0x336d90[_0xc489('0x22')](_0x105cfe)){var _0x5a8f39={};for(var _0x1a0cc7=0x0;_0x1a0cc7<_0x336d90[_0x105cfe][_0xc489('0x40')];_0x1a0cc7+=0x1){var _0xdfdab=_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x53')];if(_0x221366[_0xc489('0x10')][_0xdfdab]){if(_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x54')]){_0x221366[_0xc489('0x10')][_0xdfdab][_0xc489('0x30')]+=0x1;}if(_0x336d90[_0x105cfe][_0x1a0cc7]['queuecallerabandon']){_0x221366[_0xc489('0x10')][_0xdfdab][_0xc489('0x31')]+=0x1;}_0x221366[_0xc489('0x10')][_0xdfdab]['sumHoldTime']+=moment(_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x55')])[_0xc489('0x56')](moment(_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x57')]),_0xc489('0x58'))||0x0;if(_0x1a0cc7===_0x336d90[_0x105cfe][_0xc489('0x40')]-0x1){_0x221366[_0xc489('0x10')][_0xdfdab]['sumDuration']+=moment(_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x59')]||_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x5a')]||_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x5b')])[_0xc489('0x56')](moment(_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x57')]),_0xc489('0x58'))||0x0;_0x221366[_0xc489('0x10')][_0xdfdab]['total']+=0x1;if(_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x5c')]){_0x221366[_0xc489('0x10')][_0xdfdab][_0xc489('0x2f')]+=0x1;_0x221366[_0xc489('0x10')][_0xdfdab][_0xc489('0x2c')]+=moment(_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x59')])['diff'](moment(_0x336d90[_0x105cfe][_0x1a0cc7][_0xc489('0x55')]),'seconds')||0x0;}}else{_0x221366[_0xc489('0x10')][_0xdfdab][_0xc489('0x2b')]+=_0x221366[_0xc489('0x10')][_0xdfdab][_0xc489('0x2a')]||0x0;}}}}}}return _0x221366['voiceQueues'];};};Realtime[_0xc489('0x42')]['initVoiceCallReports']=function(){var _0x50934b=this;return function(_0x352ef8){clearVoiceCallReports(_0x50934b[_0xc489('0x5d')]);if(_0x352ef8){for(var _0x377f2b=0x0;_0x377f2b<_0x352ef8['length'];_0x377f2b+=0x1){_0x50934b['outbound']['total']+=0x1;_0x50934b[_0xc489('0x5d')][_0xc489('0x2b')]+=_0x352ef8[_0x377f2b]['duration'];if(_0x352ef8[_0x377f2b]['disposition']===_0xc489('0x5e')){_0x50934b[_0xc489('0x5d')][_0xc489('0x2f')]+=0x1;_0x50934b['outbound'][_0xc489('0x2a')]+=_0x352ef8[_0x377f2b]['duration']-_0x352ef8[_0x377f2b][_0xc489('0x5f')]||0x0;_0x50934b['outbound'][_0xc489('0x2c')]+=_0x352ef8[_0x377f2b][_0xc489('0x5f')];}}}return _0x50934b[_0xc489('0x5d')];};};Realtime['prototype'][_0xc489('0x60')]=function(){var _0x2aff25=this;return function(_0x379c6c){if(_0x379c6c){freeIsNotKey(_0x379c6c,_0x2aff25['campaigns'],_0xc489('0x25'));for(var _0x4ed62a=0x0,_0x50a6f2={};_0x4ed62a<_0x379c6c[_0xc489('0x40')];_0x4ed62a+=0x1){_0x50a6f2=_0x379c6c[_0x4ed62a];if(_[_0xc489('0x41')](_0x2aff25[_0xc489('0x61')][_0x50a6f2[_0xc489('0x25')]])){_0x2aff25[_0xc489('0x61')][_0x50a6f2[_0xc489('0x25')]]=new Campaign(_0x50a6f2);}else{_0x2aff25[_0xc489('0x3e')](_0x2aff25[_0xc489('0x61')][_0x50a6f2['name']],_0x50a6f2);_0x2aff25[_0xc489('0x61')][_0x50a6f2[_0xc489('0x25')]][_0xc489('0x62')]=_0x50a6f2[_0xc489('0x63')]?_0x50a6f2['SquareProject'][_0xc489('0x25')]:undefined;}}}return _0x2aff25[_0xc489('0x61')];};};Realtime['prototype'][_0xc489('0x64')]=function(){var _0xdc467a=this;return function(_0xdc081f){if(_0xdc081f){freeIsNotKey(_0xdc081f,_0xdc467a[_0xc489('0x65')],'id');for(var _0x4a6295=0x0,_0x3dbec2={};_0x4a6295<_0xdc081f['length'];_0x4a6295+=0x1){_0x3dbec2=_0xdc081f[_0x4a6295];if(_['isUndefined'](_0xdc467a[_0xc489('0x65')][_0x3dbec2['id']])){_0xdc467a[_0xc489('0x65')][_0x3dbec2['id']]=new VoiceExtension(_0x3dbec2);}else{_0xdc467a[_0xc489('0x3e')](_0xdc467a['voiceExtensions'][_0x3dbec2['id']],_0x3dbec2);}}}return _0xdc467a[_0xc489('0x65')];};};Realtime[_0xc489('0x42')][_0xc489('0x66')]=function(){var _0x4c3ed2=this;return function(_0x2f48a8){clearCampaigns(_0x4c3ed2[_0xc489('0x61')]);for(var _0x426dc9=0x0;_0x426dc9<_0x2f48a8[_0xc489('0x40')];_0x426dc9+=0x1){_[_0xc489('0x4f')](_0x4c3ed2[_0xc489('0x61')][_0x2f48a8[_0x426dc9]['name']],_0x2f48a8[_0x426dc9]);}return _0x4c3ed2['campaigns'];};};Realtime['prototype'][_0xc489('0x67')]=function(){var _0x563b94=this;return function(_0x37ecd1){if(_0x37ecd1){freeIsNotKey(_0x37ecd1,_0x563b94[_0xc489('0x68')],'id');for(var _0x1375e9=0x0,_0x556828={},_0x2e0882={};_0x1375e9<_0x37ecd1['length'];_0x1375e9+=0x1){_0x556828=_0x37ecd1[_0x1375e9];if(_[_0xc489('0x41')](_0x563b94['faxAccounts'][_0x556828['id']])){_0x563b94[_0xc489('0x68')][_0x556828['id']]=new FaxAccount(_0x556828);}else{_0x563b94['mergeFromDatabase'](_0x563b94[_0xc489('0x68')][_0x556828['id']],_0x556828);}}}return _0x563b94['faxAccounts'];};};module[_0xc489('0x69')]=Realtime; \ No newline at end of file +var _0x1ea0=['mergeFromDatabase','initTriggers','zendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','unmanaged','queuecallerabandon','diff','seconds','sumDuration','queuecallercompleteAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','mapKeys','format','SIP/%s','name','interface','hasOwnProperty','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isNil','isUndefined'];(function(_0x547d1f,_0x5218e4){var _0x47ffc1=function(_0xd6ee5a){while(--_0xd6ee5a){_0x547d1f['push'](_0x547d1f['shift']());}};_0x47ffc1(++_0x5218e4);}(_0x1ea0,0x158));var _0x01ea=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1ea0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x01ea('0x0'));var util=require('util');var _=require(_0x01ea('0x1'));var moment=require(_0x01ea('0x2'));var Agent=require(_0x01ea('0x3'));var Telephone=require(_0x01ea('0x4'));var Trunk=require(_0x01ea('0x5'));var VoiceQueue=require(_0x01ea('0x6'));var Trigger=require(_0x01ea('0x7'));var Template=require(_0x01ea('0x8'));var Campaign=require(_0x01ea('0x9'));var VoiceExtension=require(_0x01ea('0xa'));var ZendeskAccount=require(_0x01ea('0xb'));var SalesforceAccount=require(_0x01ea('0xc'));var FreshdeskAccount=require(_0x01ea('0xd'));var SugarcrmAccount=require(_0x01ea('0xe'));var ZohoAccount=require(_0x01ea('0xf'));var DeskAccount=require(_0x01ea('0x10'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x01ea('0x11'));var Dynamics365Account=require(_0x01ea('0x12'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x01ea('0x13'));var Realtime=function(){this[_0x01ea('0x14')]={};this[_0x01ea('0x15')]={};this[_0x01ea('0x16')]={};this[_0x01ea('0x17')]={};this[_0x01ea('0x18')]={};this[_0x01ea('0x19')]={};this[_0x01ea('0x1a')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x01ea('0x1b')]={};this['channels']={};this[_0x01ea('0x1c')]={};this[_0x01ea('0x1d')]={};this[_0x01ea('0x1e')]={};this[_0x01ea('0x1f')]={};this['zendeskAccounts']={};this[_0x01ea('0x20')]={};this[_0x01ea('0x21')]={};this[_0x01ea('0x22')]={};this[_0x01ea('0x23')]={};this['deskAccounts']={};this[_0x01ea('0x24')]={};this[_0x01ea('0x25')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0xb59d92,_0x2be326,_0x1f31aa){var _0x51b9fe=_[_0x01ea('0x26')](_0xb59d92,function(_0x5a7bbb,_0x54bbae){return _0x5a7bbb[_0x1f31aa];});for(var _0xde0a28 in _0x2be326){if(_0x2be326['hasOwnProperty'](_0xde0a28)){if(!_0x51b9fe[_0xde0a28]){delete _0x2be326[_0xde0a28];}}}}function freeIsNotKeySip(_0x3f8c4a,_0x2fae37){var _0x23293d=_['mapKeys'](_0x3f8c4a,function(_0xaee574,_0x18133e){return util[_0x01ea('0x27')](_0x01ea('0x28'),_0xaee574[_0x01ea('0x29')]);});for(var _0x387003 in _0x2fae37){if(_0x2fae37['hasOwnProperty'](_0x387003)){if(!_0x23293d[_0x387003]){delete _0x2fae37[_0x387003];}}}}function freeIsNotKeyAgent(_0x33078e,_0x4d21b3){var _0x199fd3=_[_0x01ea('0x26')](_0x33078e,function(_0x15b5ba,_0x5e90f7){var _0x4449d7=_['isNil'](_0x15b5ba[_0x01ea('0x2a')])?util[_0x01ea('0x27')](_0x01ea('0x28'),_0x15b5ba[_0x01ea('0x29')]):_0x15b5ba['interface'];return _0x4449d7;});for(var _0x26aad0 in _0x4d21b3){if(_0x4d21b3[_0x01ea('0x2b')](_0x26aad0)){if(!_0x199fd3[_0x26aad0]){delete _0x4d21b3[_0x26aad0];}}}}function clearVoiceCallReports(_0x3e6cef){_0x3e6cef[_0x01ea('0x2c')]=0x0;_0x3e6cef[_0x01ea('0x2d')]=0x0;_0x3e6cef[_0x01ea('0x2e')]=0x0;_0x3e6cef['sumDuration']=0x0;_0x3e6cef[_0x01ea('0x2f')]=0x0;}function clearCampaigns(_0x338db5){if(!_[_0x01ea('0x30')](_0x338db5)){for(var _0x27c514 in _0x338db5){if(_0x338db5[_0x01ea('0x2b')](_0x27c514)){_0x338db5[_0x27c514][_0x01ea('0x31')]=0x0;_0x338db5[_0x27c514]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xcf4d72){if(!_[_0x01ea('0x30')](_0xcf4d72)){for(var _0x439a23 in _0xcf4d72){if(_0xcf4d72['hasOwnProperty'](_0x439a23)){_0xcf4d72[_0x439a23][_0x01ea('0x2c')]=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x2d')]=0x0;_0xcf4d72[_0x439a23]['unmanaged']=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x32')]=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x2e')]=0x0;_0xcf4d72[_0x439a23]['sumDuration']=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x2f')]=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x33')]=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x34')]=0x0;_0xcf4d72[_0x439a23]['outboundBusyCallsDay']=0x0;_0xcf4d72[_0x439a23]['outboundCongestionCallsDay']=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x35')]=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x36')]=0x0;_0xcf4d72[_0x439a23]['outboundDropCallsDayTimeout']=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x37')]=0x0;_0xcf4d72[_0x439a23]['outboundBlacklistCallsDay']=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x38')]=0x0;_0xcf4d72[_0x439a23]['outboundRejectCallsDay']=0x0;_0xcf4d72[_0x439a23]['outboundReCallsDay']=0x0;_0xcf4d72[_0x439a23]['outboundAnswerAgiCallsDay']=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x39')]=0x0;_0xcf4d72[_0x439a23][_0x01ea('0x3a')]=!![];}}}}Realtime[_0x01ea('0x3b')]['mergeFromDatabase']=function(_0x15f62f,_0x395aa8){for(var _0xe7af5b in _0x395aa8){if(_0x15f62f[_0x01ea('0x2b')](_0xe7af5b)){_0x15f62f[_0xe7af5b]=_0x395aa8[_0xe7af5b];}}};Realtime[_0x01ea('0x3b')][_0x01ea('0x3c')]=function(){var _0x3147f6=this;return function(_0x507988){if(_0x507988){freeIsNotKeyAgent(_0x507988,_0x3147f6[_0x01ea('0x14')]);for(var _0x925416=0x0,_0x2c2128={},_0x44dba5={};_0x925416<_0x507988[_0x01ea('0x3d')];_0x925416+=0x1){_0x2c2128=_0x507988[_0x925416];var _0x1c2381=_[_0x01ea('0x3e')](_0x2c2128['interface'])?util['format'](_0x01ea('0x28'),_0x2c2128[_0x01ea('0x29')]):_0x2c2128[_0x01ea('0x2a')];if(_[_0x01ea('0x3f')](_0x3147f6[_0x01ea('0x14')][_0x1c2381])){_0x3147f6[_0x01ea('0x14')][_0x1c2381]=new Agent(_0x2c2128);}else{_0x3147f6[_0x01ea('0x40')](_0x3147f6[_0x01ea('0x14')][_0x1c2381],_0x2c2128);}}}return _0x3147f6[_0x01ea('0x14')];};};Realtime['prototype']['initTelephones']=function(){var _0x4cc172=this;return function(_0x2b153a){if(_0x2b153a){freeIsNotKeySip(_0x2b153a,_0x4cc172[_0x01ea('0x15')]);for(var _0x5eef98=0x0,_0x47da2f={},_0x1bdc0e={};_0x5eef98<_0x2b153a['length'];_0x5eef98+=0x1){_0x47da2f=_0x2b153a[_0x5eef98];if(_[_0x01ea('0x3f')](_0x4cc172[_0x01ea('0x15')][util[_0x01ea('0x27')](_0x01ea('0x28'),_0x47da2f[_0x01ea('0x29')])])){_0x4cc172[_0x01ea('0x15')][util[_0x01ea('0x27')](_0x01ea('0x28'),_0x47da2f[_0x01ea('0x29')])]=new Telephone(_0x47da2f);}else{_0x4cc172[_0x01ea('0x40')](_0x4cc172[_0x01ea('0x15')][util[_0x01ea('0x27')]('SIP/%s',_0x47da2f[_0x01ea('0x29')])],_0x47da2f);}}}return _0x4cc172[_0x01ea('0x15')];};};Realtime[_0x01ea('0x3b')]['initTrunks']=function(){var _0x524d4b=this;return function(_0xdfcec7){if(_0xdfcec7){freeIsNotKeySip(_0xdfcec7,_0x524d4b['trunks']);for(var _0x510adb=0x0,_0x519684={},_0x28ed34={};_0x510adb<_0xdfcec7[_0x01ea('0x3d')];_0x510adb+=0x1){_0x519684=_0xdfcec7[_0x510adb];if(_['isUndefined'](_0x524d4b['trunks'][util[_0x01ea('0x27')]('SIP/%s',_0x519684[_0x01ea('0x29')])])){_0x524d4b[_0x01ea('0x16')][util[_0x01ea('0x27')](_0x01ea('0x28'),_0x519684[_0x01ea('0x29')])]=new Trunk(_0x519684);}else{_0x524d4b[_0x01ea('0x40')](_0x524d4b['trunks'][util[_0x01ea('0x27')]('SIP/%s',_0x519684['name'])],_0x519684);}}}return _0x524d4b[_0x01ea('0x16')];};};Realtime[_0x01ea('0x3b')]['initVoiceQueues']=function(){var _0x1a1993=this;return function(_0x3e2c07){if(_0x3e2c07){freeIsNotKey(_0x3e2c07,_0x1a1993['voiceQueues'],_0x01ea('0x29'));for(var _0x7fe986=0x0,_0x54e1bc={},_0x428936={};_0x7fe986<_0x3e2c07[_0x01ea('0x3d')];_0x7fe986+=0x1){_0x54e1bc=_0x3e2c07[_0x7fe986];if(_[_0x01ea('0x3f')](_0x1a1993[_0x01ea('0x17')][_0x54e1bc[_0x01ea('0x29')]])){_0x1a1993[_0x01ea('0x17')][_0x54e1bc['name']]=new VoiceQueue(_0x54e1bc);}else{_0x1a1993[_0x01ea('0x40')](_0x1a1993[_0x01ea('0x17')][_0x54e1bc['name']],_0x54e1bc);}}}return _0x1a1993['voiceQueues'];};};Realtime['prototype'][_0x01ea('0x41')]=function(){var _0x3c7fd5=this;return function(_0x34c66b){if(_0x34c66b){freeIsNotKey(_0x34c66b,_0x3c7fd5['triggers'],'id');for(var _0x5192e2=0x0,_0x3b714c={},_0x36b47b={};_0x5192e2<_0x34c66b[_0x01ea('0x3d')];_0x5192e2+=0x1){_0x3b714c=_0x34c66b[_0x5192e2];if(_['isUndefined'](_0x3c7fd5[_0x01ea('0x18')][_0x3b714c['id']])){_0x3c7fd5[_0x01ea('0x18')][_0x3b714c['id']]=new Trigger(_0x3b714c);}else{_0x3c7fd5[_0x01ea('0x40')](_0x3c7fd5[_0x01ea('0x18')][_0x3b714c['id']],_0x3b714c);}}}return _0x3c7fd5[_0x01ea('0x18')];};};Realtime[_0x01ea('0x3b')]['initTemplates']=function(){var _0x1d14a5=this;return function(_0x34fe3c){if(_0x34fe3c){freeIsNotKey(_0x34fe3c,_0x1d14a5[_0x01ea('0x1a')],'id');for(var _0x3f4b36=0x0,_0x501ec8={},_0x125b3f={};_0x3f4b36<_0x34fe3c[_0x01ea('0x3d')];_0x3f4b36+=0x1){_0x501ec8=_0x34fe3c[_0x3f4b36];if(_['isUndefined'](_0x1d14a5[_0x01ea('0x1a')][_0x501ec8['id']])){_0x1d14a5[_0x01ea('0x1a')][_0x501ec8['id']]=new Template(_0x501ec8);}else{_0x1d14a5[_0x01ea('0x40')](_0x1d14a5['templates'][_0x501ec8['id']],_0x501ec8);}}}return _0x1d14a5[_0x01ea('0x1a')];};};Realtime[_0x01ea('0x3b')]['initZendeskAccounts']=function(){var _0x56713d=this;return function(_0x587912){if(_0x587912){freeIsNotKey(_0x587912,_0x56713d[_0x01ea('0x42')],'id');for(var _0x45e737=0x0,_0x1f6e7c={},_0x259cf8={};_0x45e737<_0x587912['length'];_0x45e737+=0x1){_0x1f6e7c=_0x587912[_0x45e737];if(_['isUndefined'](_0x56713d[_0x01ea('0x42')][_0x1f6e7c['id']])){_0x56713d[_0x01ea('0x42')][_0x1f6e7c['id']]=new ZendeskAccount(_0x1f6e7c);}else{_0x56713d[_0x01ea('0x40')](_0x56713d[_0x01ea('0x42')][_0x1f6e7c['id']],_0x1f6e7c);}}}return _0x56713d[_0x01ea('0x42')];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x43')]=function(){var _0x26f4c3=this;return function(_0xb912e6){if(_0xb912e6){freeIsNotKey(_0xb912e6,_0x26f4c3[_0x01ea('0x20')],'id');for(var _0x34c7cf=0x0,_0x263269={},_0x23b12f={};_0x34c7cf<_0xb912e6['length'];_0x34c7cf+=0x1){_0x263269=_0xb912e6[_0x34c7cf];if(_[_0x01ea('0x3f')](_0x26f4c3[_0x01ea('0x20')][_0x263269['id']])){_0x26f4c3[_0x01ea('0x20')][_0x263269['id']]=new SalesforceAccount(_0x263269);}else{_0x26f4c3[_0x01ea('0x40')](_0x26f4c3[_0x01ea('0x20')][_0x263269['id']],_0x263269);}}}return _0x26f4c3[_0x01ea('0x20')];};};Realtime[_0x01ea('0x3b')]['initFreshdeskAccounts']=function(){var _0x4b20a6=this;return function(_0x2a0799){if(_0x2a0799){freeIsNotKey(_0x2a0799,_0x4b20a6[_0x01ea('0x22')],'id');for(var _0x69dc77=0x0,_0x215f7a={},_0x4aec6e={};_0x69dc77<_0x2a0799[_0x01ea('0x3d')];_0x69dc77+=0x1){_0x215f7a=_0x2a0799[_0x69dc77];if(_[_0x01ea('0x3f')](_0x4b20a6[_0x01ea('0x22')][_0x215f7a['id']])){_0x4b20a6[_0x01ea('0x22')][_0x215f7a['id']]=new FreshdeskAccount(_0x215f7a);}else{_0x4b20a6[_0x01ea('0x40')](_0x4b20a6['freshdeskAccounts'][_0x215f7a['id']],_0x215f7a);}}}return _0x4b20a6['freshdeskAccounts'];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x44')]=function(){var _0x3dcbd3=this;return function(_0x1fd6f3){if(_0x1fd6f3){freeIsNotKey(_0x1fd6f3,_0x3dcbd3['zohoAccounts'],'id');for(var _0x25e91d=0x0,_0x468250={},_0x406a1c={};_0x25e91d<_0x1fd6f3[_0x01ea('0x3d')];_0x25e91d+=0x1){_0x468250=_0x1fd6f3[_0x25e91d];if(_[_0x01ea('0x3f')](_0x3dcbd3[_0x01ea('0x23')][_0x468250['id']])){_0x3dcbd3[_0x01ea('0x23')][_0x468250['id']]=new ZohoAccount(_0x468250);}else{_0x3dcbd3[_0x01ea('0x40')](_0x3dcbd3[_0x01ea('0x23')][_0x468250['id']],_0x468250);}}}return _0x3dcbd3[_0x01ea('0x23')];};};Realtime['prototype'][_0x01ea('0x45')]=function(){var _0x43bc79=this;return function(_0x3413d4){if(_0x3413d4){freeIsNotKey(_0x3413d4,_0x43bc79['deskAccounts'],'id');for(var _0x4e7399=0x0,_0x4a3f4f={},_0xf11c4d={};_0x4e7399<_0x3413d4[_0x01ea('0x3d')];_0x4e7399+=0x1){_0x4a3f4f=_0x3413d4[_0x4e7399];if(_['isUndefined'](_0x43bc79[_0x01ea('0x46')][_0x4a3f4f['id']])){_0x43bc79[_0x01ea('0x46')][_0x4a3f4f['id']]=new DeskAccount(_0x4a3f4f);}else{_0x43bc79[_0x01ea('0x40')](_0x43bc79[_0x01ea('0x46')][_0x4a3f4f['id']],_0x4a3f4f);}}}return _0x43bc79[_0x01ea('0x46')];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x47')]=function(){var _0x5a25b0=this;return function(_0x219975){if(_0x219975){freeIsNotKey(_0x219975,_0x5a25b0[_0x01ea('0x21')],'id');for(var _0x30c5ec=0x0,_0x49df9d={},_0x1c1ad1={};_0x30c5ec<_0x219975[_0x01ea('0x3d')];_0x30c5ec+=0x1){_0x49df9d=_0x219975[_0x30c5ec];if(_['isUndefined'](_0x5a25b0[_0x01ea('0x21')][_0x49df9d['id']])){_0x5a25b0[_0x01ea('0x21')][_0x49df9d['id']]=new SugarcrmAccount(_0x49df9d);}else{_0x5a25b0[_0x01ea('0x40')](_0x5a25b0[_0x01ea('0x21')][_0x49df9d['id']],_0x49df9d);}}}return _0x5a25b0[_0x01ea('0x21')];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x48')]=function(){var _0x2961a3=this;return function(_0x28841f){if(_0x28841f){freeIsNotKey(_0x28841f,_0x2961a3['vtigerAccounts'],'id');for(var _0x14f22d=0x0,_0x487ae5={},_0xd48d3={};_0x14f22d<_0x28841f['length'];_0x14f22d+=0x1){_0x487ae5=_0x28841f[_0x14f22d];if(_['isUndefined'](_0x2961a3[_0x01ea('0x24')][_0x487ae5['id']])){_0x2961a3[_0x01ea('0x24')][_0x487ae5['id']]=new VtigerAccount(_0x487ae5);}else{_0x2961a3[_0x01ea('0x40')](_0x2961a3[_0x01ea('0x24')][_0x487ae5['id']],_0x487ae5);}}}return _0x2961a3[_0x01ea('0x24')];};};Realtime[_0x01ea('0x3b')]['initServicenowAccounts']=function(){var _0xc22213=this;return function(_0x3c3451){if(_0x3c3451){freeIsNotKey(_0x3c3451,_0xc22213[_0x01ea('0x25')],'id');for(var _0x28711a=0x0,_0x3a5242={},_0x2b2833={};_0x28711a<_0x3c3451['length'];_0x28711a+=0x1){_0x3a5242=_0x3c3451[_0x28711a];if(_['isUndefined'](_0xc22213[_0x01ea('0x25')][_0x3a5242['id']])){_0xc22213[_0x01ea('0x25')][_0x3a5242['id']]=new ServicenowAccount(_0x3a5242);}else{_0xc22213['mergeFromDatabase'](_0xc22213['servicenowAccounts'][_0x3a5242['id']],_0x3a5242);}}}return _0xc22213[_0x01ea('0x25')];};};Realtime['prototype'][_0x01ea('0x49')]=function(){var _0xea6d23=this;return function(_0xd9c2d4){if(_0xd9c2d4){freeIsNotKey(_0xd9c2d4,_0xea6d23[_0x01ea('0x4a')],'id');for(var _0x592693=0x0,_0x20bc34={},_0x10e0aa={};_0x592693<_0xd9c2d4[_0x01ea('0x3d')];_0x592693+=0x1){_0x20bc34=_0xd9c2d4[_0x592693];if(_['isUndefined'](_0xea6d23[_0x01ea('0x4a')][_0x20bc34['id']])){_0xea6d23[_0x01ea('0x4a')][_0x20bc34['id']]=new Dynamics365Account(_0x20bc34);}else{_0xea6d23['mergeFromDatabase'](_0xea6d23[_0x01ea('0x4a')][_0x20bc34['id']],_0x20bc34);}}}return _0xea6d23[_0x01ea('0x4a')];};};Realtime[_0x01ea('0x3b')]['initFreshsalesAccounts']=function(){var _0xd5cf02=this;return function(_0x41171d){if(_0x41171d){freeIsNotKey(_0x41171d,_0xd5cf02['freshsalesAccounts'],'id');for(var _0x215b24=0x0,_0x5bf190={},_0x2c6490={};_0x215b24<_0x41171d[_0x01ea('0x3d')];_0x215b24+=0x1){_0x5bf190=_0x41171d[_0x215b24];if(_['isUndefined'](_0xd5cf02[_0x01ea('0x4b')][_0x5bf190['id']])){_0xd5cf02['freshsalesAccounts'][_0x5bf190['id']]=new FreshsalesAccount(_0x5bf190);}else{_0xd5cf02[_0x01ea('0x40')](_0xd5cf02['freshsalesAccounts'][_0x5bf190['id']],_0x5bf190);}}}return _0xd5cf02[_0x01ea('0x4b')];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x4c')]=function(){var _0x428634=this;return function(_0x38175d){for(var _0x46d68a=0x0;_0x46d68a<_0x38175d[_0x01ea('0x3d')];_0x46d68a+=0x1){_[_0x01ea('0x4d')](_0x428634['voiceQueues'][_0x38175d[_0x46d68a][_0x01ea('0x29')]],_0x38175d[_0x46d68a]);}return _0x428634[_0x01ea('0x17')];};};Realtime['prototype'][_0x01ea('0x4e')]=function(){var _0x2dd5d3=this;return function(_0xb2365f){clearVoiceQueues(_0x2dd5d3[_0x01ea('0x17')]);if(_0xb2365f){_0xb2365f=_[_0x01ea('0x4f')](_0xb2365f,'uniqueid');for(var _0x3b1641 in _0xb2365f){if(_0xb2365f[_0x01ea('0x2b')](_0x3b1641)){var _0x3ccd49={};for(var _0x2722f9=0x0;_0x2722f9<_0xb2365f[_0x3b1641]['length'];_0x2722f9+=0x1){var _0x453876=_0xb2365f[_0x3b1641][_0x2722f9]['queue'];if(_0x2dd5d3[_0x01ea('0x17')][_0x453876]){if(_0xb2365f[_0x3b1641][_0x2722f9]['queuecallerexit']){_0x2dd5d3['voiceQueues'][_0x453876][_0x01ea('0x50')]+=0x1;}if(_0xb2365f[_0x3b1641][_0x2722f9][_0x01ea('0x51')]){_0x2dd5d3['voiceQueues'][_0x453876][_0x01ea('0x32')]+=0x1;}_0x2dd5d3[_0x01ea('0x17')][_0x453876][_0x01ea('0x2e')]+=moment(_0xb2365f[_0x3b1641][_0x2722f9]['queuecallerleaveAt'])[_0x01ea('0x52')](moment(_0xb2365f[_0x3b1641][_0x2722f9]['queuecallerjoinAt']),_0x01ea('0x53'))||0x0;if(_0x2722f9===_0xb2365f[_0x3b1641][_0x01ea('0x3d')]-0x1){_0x2dd5d3[_0x01ea('0x17')][_0x453876][_0x01ea('0x54')]+=moment(_0xb2365f[_0x3b1641][_0x2722f9][_0x01ea('0x55')]||_0xb2365f[_0x3b1641][_0x2722f9]['queuecallerabandonAt']||_0xb2365f[_0x3b1641][_0x2722f9][_0x01ea('0x56')])[_0x01ea('0x52')](moment(_0xb2365f[_0x3b1641][_0x2722f9][_0x01ea('0x57')]),_0x01ea('0x53'))||0x0;_0x2dd5d3[_0x01ea('0x17')][_0x453876][_0x01ea('0x2c')]+=0x1;if(_0xb2365f[_0x3b1641][_0x2722f9][_0x01ea('0x58')]){_0x2dd5d3['voiceQueues'][_0x453876]['answered']+=0x1;_0x2dd5d3[_0x01ea('0x17')][_0x453876][_0x01ea('0x2f')]+=moment(_0xb2365f[_0x3b1641][_0x2722f9][_0x01ea('0x55')])[_0x01ea('0x52')](moment(_0xb2365f[_0x3b1641][_0x2722f9][_0x01ea('0x59')]),_0x01ea('0x53'))||0x0;}}else{_0x2dd5d3[_0x01ea('0x17')][_0x453876]['sumDuration']+=_0x2dd5d3['voiceQueues'][_0x453876]['sumHoldTime']||0x0;}}}}}}return _0x2dd5d3[_0x01ea('0x17')];};};Realtime['prototype'][_0x01ea('0x5a')]=function(){var _0x1e2924=this;return function(_0x1f11d9){clearVoiceCallReports(_0x1e2924['outbound']);if(_0x1f11d9){for(var _0x52a5d9=0x0;_0x52a5d9<_0x1f11d9[_0x01ea('0x3d')];_0x52a5d9+=0x1){_0x1e2924[_0x01ea('0x5b')][_0x01ea('0x2c')]+=0x1;_0x1e2924[_0x01ea('0x5b')][_0x01ea('0x54')]+=_0x1f11d9[_0x52a5d9]['duration'];if(_0x1f11d9[_0x52a5d9]['disposition']==='ANSWERED'){_0x1e2924[_0x01ea('0x5b')][_0x01ea('0x2d')]+=0x1;_0x1e2924['outbound'][_0x01ea('0x2e')]+=_0x1f11d9[_0x52a5d9][_0x01ea('0x5c')]-_0x1f11d9[_0x52a5d9][_0x01ea('0x5d')]||0x0;_0x1e2924['outbound'][_0x01ea('0x2f')]+=_0x1f11d9[_0x52a5d9]['billableseconds'];}}}return _0x1e2924['outbound'];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x5e')]=function(){var _0x449120=this;return function(_0x530696){if(_0x530696){freeIsNotKey(_0x530696,_0x449120[_0x01ea('0x19')],_0x01ea('0x29'));for(var _0x5a0c1c=0x0,_0x1ae27c={};_0x5a0c1c<_0x530696[_0x01ea('0x3d')];_0x5a0c1c+=0x1){_0x1ae27c=_0x530696[_0x5a0c1c];if(_[_0x01ea('0x3f')](_0x449120[_0x01ea('0x19')][_0x1ae27c[_0x01ea('0x29')]])){_0x449120['campaigns'][_0x1ae27c[_0x01ea('0x29')]]=new Campaign(_0x1ae27c);}else{_0x449120[_0x01ea('0x40')](_0x449120[_0x01ea('0x19')][_0x1ae27c[_0x01ea('0x29')]],_0x1ae27c);_0x449120[_0x01ea('0x19')][_0x1ae27c['name']][_0x01ea('0x5f')]=_0x1ae27c[_0x01ea('0x60')]?_0x1ae27c[_0x01ea('0x60')][_0x01ea('0x29')]:undefined;}}}return _0x449120[_0x01ea('0x19')];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x61')]=function(){var _0x13db23=this;return function(_0x4156c0){if(_0x4156c0){freeIsNotKey(_0x4156c0,_0x13db23[_0x01ea('0x1b')],'id');for(var _0x2bb974=0x0,_0xceb12b={};_0x2bb974<_0x4156c0[_0x01ea('0x3d')];_0x2bb974+=0x1){_0xceb12b=_0x4156c0[_0x2bb974];if(_[_0x01ea('0x3f')](_0x13db23[_0x01ea('0x1b')][_0xceb12b['id']])){_0x13db23['voiceExtensions'][_0xceb12b['id']]=new VoiceExtension(_0xceb12b);}else{_0x13db23[_0x01ea('0x40')](_0x13db23[_0x01ea('0x1b')][_0xceb12b['id']],_0xceb12b);}}}return _0x13db23['voiceExtensions'];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x62')]=function(){var _0x474afe=this;return function(_0x73310b){clearCampaigns(_0x474afe[_0x01ea('0x19')]);for(var _0x23b0dc=0x0;_0x23b0dc<_0x73310b[_0x01ea('0x3d')];_0x23b0dc+=0x1){_[_0x01ea('0x4d')](_0x474afe[_0x01ea('0x19')][_0x73310b[_0x23b0dc][_0x01ea('0x29')]],_0x73310b[_0x23b0dc]);}return _0x474afe[_0x01ea('0x19')];};};Realtime[_0x01ea('0x3b')][_0x01ea('0x63')]=function(){var _0x13f747=this;return function(_0x5b03db){if(_0x5b03db){freeIsNotKey(_0x5b03db,_0x13f747[_0x01ea('0x64')],'id');for(var _0x147f9f=0x0,_0x149de3={},_0x52d709={};_0x147f9f<_0x5b03db['length'];_0x147f9f+=0x1){_0x149de3=_0x5b03db[_0x147f9f];if(_[_0x01ea('0x3f')](_0x13f747[_0x01ea('0x64')][_0x149de3['id']])){_0x13f747[_0x01ea('0x64')][_0x149de3['id']]=new FaxAccount(_0x149de3);}else{_0x13f747[_0x01ea('0x40')](_0x13f747[_0x01ea('0x64')][_0x149de3['id']],_0x149de3);}}}return _0x13f747[_0x01ea('0x64')];};};module[_0x01ea('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index cd12493..11b0be9 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 _0x9bb1=['lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','Local','substring','indexOf','mobile','phone','blindTransfer','transfererlinkedid','lodash','moment','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','voiceAgentReport','bind','voiceDialReport','blindtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x9bb1,0x85));var _0x19bb=function(_0x41b050,_0x3d4758){_0x41b050=_0x41b050-0x0;var _0x55968d=_0x9bb1[_0x41b050];return _0x55968d;};'use strict';var _=require(_0x19bb('0x0'));var moment=require(_0x19bb('0x1'));var util=require(_0x19bb('0x2'));var config=require('../../../config/environment');var ami=require(_0x19bb('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x19bb('0x4'));var RpcVoiceDialReport=require(_0x19bb('0x5'));var RpcMemberReport=require(_0x19bb('0x6'));var RpcVoiceQueueReport=require(_0x19bb('0x7'));var RpcVoiceRecording=require(_0x19bb('0x8'));var RpcVoiceTransferReport=require(_0x19bb('0x9'));var VoiceQueueReport=require(_0x19bb('0xa'));var VoiceCallReport=require(_0x19bb('0xb'));var VoiceAgentReport=require(_0x19bb('0xc'));var VoiceDialReport=require(_0x19bb('0xd'));var UserReport=require('./userReport');function Report(_0x36e091){this[_0x19bb('0xe')]=_0x36e091;this[_0x19bb('0xf')]=_0x36e091[_0x19bb('0xf')];this[_0x19bb('0x10')]=_0x36e091['telephones'];}Report[_0x19bb('0x11')]['sync']=function(_0x2ef84d){var _0x107535=new VoiceQueueReport(this['realtime']);var _0x211e5e=new VoiceAgentReport(this['realtime']);var _0x100a8b=new VoiceDialReport(this['realtime']);var _0x446c31=new VoiceCallReport(this[_0x19bb('0xe')]);var _0xf4f125=new UserReport(this['realtime']);if(config[_0x19bb('0x12')]&&config[_0x19bb('0x12')][_0x19bb('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x19bb('0x14')]['bind'](this));ami['on'](_0x19bb('0x15'),this[_0x19bb('0x16')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x19bb('0x17')][_0x19bb('0x18')](this));ami['on']('custom:voiceDialReport',this[_0x19bb('0x19')][_0x19bb('0x18')](this));ami['on'](_0x19bb('0x1a'),this['blindTransfer'][_0x19bb('0x18')](this));ami['on']('attendedtransfer',this[_0x19bb('0x1b')][_0x19bb('0x18')](this));}};Report[_0x19bb('0x11')][_0x19bb('0x1c')]=function(_0x2fb5f8){var _0x1c6545;_0x1c6545=_[_0x19bb('0x1d')](this[_0x19bb('0xf')],function(_0x480502){return _0x480502[_0x19bb('0x1e')]==_0x2fb5f8||_0x480502[_0x19bb('0x1f')]==_0x2fb5f8;});if(_['isNil'](_0x1c6545)){var _0x3964c6=_[_0x19bb('0x1d')](this[_0x19bb('0x10')],function(_0x4d0787){return _0x4d0787[_0x19bb('0x1e')]==_0x2fb5f8||_0x4d0787[_0x19bb('0x1f')]==_0x2fb5f8;});if(_0x3964c6){_0x1c6545=_[_0x19bb('0x1d')](this[_0x19bb('0xf')],function(_0xe70f20){return _0xe70f20[_0x19bb('0x20')]==util[_0x19bb('0x21')](_0x19bb('0x22'),_0x3964c6[_0x19bb('0x1f')]);});}}return _0x1c6545;};Report['prototype']['voiceQueueReport']=function(_0x21d81b){for(var _0x160fef=0x0;_0x160fef<_0x21d81b[_0x19bb('0x23')];_0x160fef+=0x1){var _0x103292=this[_0x19bb('0x1c')](_0x21d81b[_0x160fef][_0x19bb('0x24')]);if(_0x103292){_0x21d81b[_0x160fef][_0x19bb('0x1e')]=_0x103292[_0x19bb('0x1e')];_0x21d81b[_0x160fef]['assigned']=!![];_0x21d81b[_0x160fef][_0x19bb('0x25')]=_0x103292['name'];_0x21d81b[_0x160fef][_0x19bb('0x20')]=_[_0x19bb('0x26')](_0x103292['interface'])?util[_0x19bb('0x21')](_0x19bb('0x22'),_0x103292[_0x19bb('0x1f')]):_0x103292[_0x19bb('0x20')];if(_0x21d81b[_0x160fef][_0x19bb('0x27')]){_0x21d81b[_0x160fef][_0x19bb('0x28')]=moment()[_0x19bb('0x21')](_0x19bb('0x29'));}if(_0x21d81b[_0x160fef][_0x19bb('0x2a')]){_0x21d81b[_0x160fef][_0x19bb('0x2b')]=moment()['format'](_0x19bb('0x29'));}RpcMemberReport[_0x19bb('0x14')](_0x21d81b[_0x160fef]);}RpcVoiceQueueReport[_0x19bb('0x2c')](_0x21d81b[_0x160fef]);}};function extractCalleridNumber(_0xa084a2){var _0x1d1bb5=_0xa084a2[_0x19bb('0x2d')](/<(.*?)>/);return _0x1d1bb5?_0x1d1bb5[0x1]:_0xa084a2;}Report['prototype'][_0x19bb('0x16')]=function(_0x18177c){_0x18177c['destination']=_0x18177c[_0x19bb('0x2e')]||_0x18177c['exten'];if(_0x18177c['type']==_0x19bb('0x2f')){_0x18177c[_0x19bb('0x30')]=_0x19bb('0x31');_0x18177c[_0x19bb('0x32')]=_0x18177c[_0x19bb('0x31')];if(_0x18177c['context']==_0x19bb('0x33')){_0x18177c[_0x19bb('0x1e')]='';_0x18177c[_0x19bb('0x2e')]=extractCalleridNumber(_0x18177c[_0x19bb('0x34')]);}else if(_0x18177c['context']==_0x19bb('0x35')){if(_0x18177c[_0x19bb('0x2e')]==_0x19bb('0x36')){_0x18177c['destination']=extractCalleridNumber(_0x18177c[_0x19bb('0x37')]);_0x18177c[_0x19bb('0x38')]=_0x18177c[_0x19bb('0x39')];_0x18177c[_0x19bb('0x3a')]=[_0x18177c[_0x19bb('0x3b')],_0x18177c[_0x19bb('0x3b')]=_0x18177c['destinationchannel']][0x0];_0x18177c[_0x19bb('0x34')]=_0x18177c['calleridpreview'];}else{_0x18177c['destination']=_0x18177c['calleridnum'];_0x18177c[_0x19bb('0x38')]=_0x18177c[_0x19bb('0x39')];if(_0x18177c[_0x19bb('0x3c')]==_0x19bb('0x3d')){_0x18177c['accountcode']=_0x18177c[_0x19bb('0x24')];}else{_0x18177c[_0x19bb('0x1e')]='';}}}}else{_0x18177c[_0x19bb('0x34')]=util[_0x19bb('0x21')]('\x22%s\x22\x20<%s>',_0x18177c[_0x19bb('0x3e')],_0x18177c[_0x19bb('0x38')]);}if(RpcVoiceTransferReport[_0x19bb('0x3f')][_0x18177c[_0x19bb('0x40')]]){var _0x54dc44=RpcVoiceTransferReport[_0x19bb('0x3f')][_0x18177c[_0x19bb('0x40')]];_0x54dc44[_0x19bb('0x41')]=_0x18177c[_0x19bb('0x42')];RpcVoiceTransferReport['blindTransfer'](_0x54dc44);delete RpcVoiceTransferReport[_0x19bb('0x3f')][_0x18177c[_0x19bb('0x40')]];}RpcVoiceCallReport[_0x19bb('0x2c')](_0x18177c);if(_0x18177c[_0x19bb('0x43')]){for(var _0x11e956=0x0;_0x11e956<_0x18177c[_0x19bb('0x44')][_0x19bb('0x23')];_0x11e956+=0x1){_0x18177c[_0x19bb('0x45')]=_0x18177c[_0x19bb('0x44')][_0x11e956][_0x19bb('0x46')];_0x18177c[_0x19bb('0x47')]=_0x18177c['monitors'][_0x11e956][_0x19bb('0x47')];if(_0x18177c[_0x19bb('0x48')]==_0x19bb('0x36')){_0x18177c['calleridnum']=_0x18177c[_0x19bb('0x24')];_0x18177c[_0x19bb('0x3e')]=_0x18177c['connectedlinename'];_0x18177c[_0x19bb('0x24')]=_0x18177c[_0x19bb('0x1e')];_0x18177c[_0x19bb('0x49')]=_0x18177c[_0x19bb('0x4a')];_0x18177c[_0x19bb('0x48')]=_0x18177c[_0x19bb('0x39')];}else if(_0x18177c[_0x19bb('0x48')]==_0x19bb('0x4b')){_0x18177c[_0x19bb('0x38')]=_0x18177c[_0x19bb('0x2e')];_0x18177c['exten']=_0x18177c[_0x19bb('0x39')];}RpcVoiceRecording[_0x19bb('0x2c')](_0x18177c);}}};Report['prototype'][_0x19bb('0x17')]=function(_0x21ae6e){if(_[_0x19bb('0x4c')](_0x21ae6e)){_0x21ae6e['forEach'](function(_0x2d3251){RpcVoiceAgentReport[_0x19bb('0x2c')](_0x2d3251);});}else{RpcVoiceAgentReport['create'](_0x21ae6e);}};Report[_0x19bb('0x11')][_0x19bb('0x19')]=function(_0x37f4d0){RpcVoiceDialReport[_0x19bb('0x2c')](_0x37f4d0);var _0x516cb9;var _0x31b5ed;var _0x2f8a65=_0x37f4d0[_0x19bb('0x3b')];if(_[_0x19bb('0x4d')](_0x2f8a65,_0x19bb('0x4e'))){_0x31b5ed=_0x2f8a65[_0x19bb('0x4f')](_0x2f8a65[_0x19bb('0x50')]('/')+0x1,_0x2f8a65[_0x19bb('0x50')]('@'));_0x516cb9=_[_0x19bb('0x1d')](this[_0x19bb('0xf')],function(_0x4aef37){return _0x4aef37[_0x19bb('0x51')]==_0x31b5ed||_0x4aef37[_0x19bb('0x52')]==_0x31b5ed||_0x4aef37[_0x19bb('0x1e')]==_0x31b5ed;});}else{_0x31b5ed=_0x2f8a65[_0x19bb('0x4f')](_0x2f8a65['indexOf']('/')+0x1,_0x2f8a65['lastIndexOf']('-'));_0x516cb9=this[_0x19bb('0x1c')](_0x31b5ed);}if(_0x516cb9){_0x37f4d0[_0x19bb('0x20')]=_['isNil'](_0x516cb9[_0x19bb('0x20')])?util[_0x19bb('0x21')]('SIP/%s',_0x516cb9[_0x19bb('0x1f')]):_0x516cb9[_0x19bb('0x20')];_0x37f4d0[_0x19bb('0x4a')]=_0x516cb9[_0x19bb('0x1f')];_0x37f4d0[_0x19bb('0x1e')]=_0x516cb9[_0x19bb('0x1e')];RpcMemberReport[_0x19bb('0x19')](_0x37f4d0);}};Report['prototype'][_0x19bb('0x53')]=function(_0x264b2d){RpcVoiceTransferReport[_0x19bb('0x3f')][_0x264b2d[_0x19bb('0x54')]]=_0x264b2d;};Report['prototype'][_0x19bb('0x1b')]=function(_0x2e03b9){RpcVoiceTransferReport[_0x19bb('0x1b')](_0x2e03b9);};module['exports']=Report; \ No newline at end of file +var _0xae80=['../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','voiceQueueReport','length','assigned','queuecallerexit','queuecallerexitAt','create','match','destination','exten','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitors','filename','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport'];(function(_0x24fa88,_0x4007b2){var _0x2a7377=function(_0x32b955){while(--_0x32b955){_0x24fa88['push'](_0x24fa88['shift']());}};_0x2a7377(++_0x4007b2);}(_0xae80,0x1e8));var _0x0ae8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xae80[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0ae8('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x0ae8('0x1'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x0ae8('0x2'));var RpcVoiceCallReport=require(_0x0ae8('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x0ae8('0x4'));var RpcVoiceQueueReport=require(_0x0ae8('0x5'));var RpcVoiceRecording=require(_0x0ae8('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x0ae8('0x7'));var VoiceAgentReport=require(_0x0ae8('0x8'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x0ae8('0x9'));function Report(_0x574315){this[_0x0ae8('0xa')]=_0x574315;this[_0x0ae8('0xb')]=_0x574315[_0x0ae8('0xb')];this['telephones']=_0x574315[_0x0ae8('0xc')];}Report[_0x0ae8('0xd')][_0x0ae8('0xe')]=function(_0x19568d){var _0x4de79a=new VoiceQueueReport(this[_0x0ae8('0xa')]);var _0x2de591=new VoiceAgentReport(this[_0x0ae8('0xa')]);var _0x48bb48=new VoiceDialReport(this['realtime']);var _0x9fbf02=new VoiceCallReport(this['realtime']);var _0x1fdc99=new UserReport(this[_0x0ae8('0xa')]);if(config['xdr']&&config[_0x0ae8('0xf')][_0x0ae8('0x10')]){ami['on'](_0x0ae8('0x11'),this['voiceQueueReport'][_0x0ae8('0x12')](this));ami['on'](_0x0ae8('0x13'),this[_0x0ae8('0x14')]['bind'](this));ami['on'](_0x0ae8('0x15'),this['voiceAgentReport']['bind'](this));ami['on'](_0x0ae8('0x16'),this['voiceDialReport']['bind'](this));ami['on'](_0x0ae8('0x17'),this[_0x0ae8('0x18')][_0x0ae8('0x12')](this));ami['on'](_0x0ae8('0x19'),this[_0x0ae8('0x1a')][_0x0ae8('0x12')](this));}};Report[_0x0ae8('0xd')][_0x0ae8('0x1b')]=function(_0xa49733){var _0x3c3138;_0x3c3138=_[_0x0ae8('0x1c')](this['agents'],function(_0x5cf81b){return _0x5cf81b['accountcode']==_0xa49733||_0x5cf81b[_0x0ae8('0x1d')]==_0xa49733;});if(_[_0x0ae8('0x1e')](_0x3c3138)){var _0x55c38e=_[_0x0ae8('0x1c')](this[_0x0ae8('0xc')],function(_0x3b8ab2){return _0x3b8ab2[_0x0ae8('0x1f')]==_0xa49733||_0x3b8ab2[_0x0ae8('0x1d')]==_0xa49733;});if(_0x55c38e){_0x3c3138=_[_0x0ae8('0x1c')](this[_0x0ae8('0xb')],function(_0x410ff5){return _0x410ff5[_0x0ae8('0x20')]==util[_0x0ae8('0x21')](_0x0ae8('0x22'),_0x55c38e[_0x0ae8('0x1d')]);});}}return _0x3c3138;};Report[_0x0ae8('0xd')][_0x0ae8('0x23')]=function(_0x430bfb){for(var _0xf40d07=0x0;_0xf40d07<_0x430bfb[_0x0ae8('0x24')];_0xf40d07+=0x1){var _0x41aa52=this['findAgent'](_0x430bfb[_0xf40d07]['connectedlinenum']);if(_0x41aa52){_0x430bfb[_0xf40d07][_0x0ae8('0x1f')]=_0x41aa52[_0x0ae8('0x1f')];_0x430bfb[_0xf40d07][_0x0ae8('0x25')]=!![];_0x430bfb[_0xf40d07]['lastAssignedTo']=_0x41aa52['name'];_0x430bfb[_0xf40d07]['interface']=_[_0x0ae8('0x1e')](_0x41aa52[_0x0ae8('0x20')])?util[_0x0ae8('0x21')](_0x0ae8('0x22'),_0x41aa52['name']):_0x41aa52[_0x0ae8('0x20')];if(_0x430bfb[_0xf40d07]['queuecallercomplete']){_0x430bfb[_0xf40d07]['queuecallercompleteAt']=moment()[_0x0ae8('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x430bfb[_0xf40d07][_0x0ae8('0x26')]){_0x430bfb[_0xf40d07][_0x0ae8('0x27')]=moment()[_0x0ae8('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x430bfb[_0xf40d07]);}RpcVoiceQueueReport[_0x0ae8('0x28')](_0x430bfb[_0xf40d07]);}};function extractCalleridNumber(_0xad4622){var _0x366d0f=_0xad4622[_0x0ae8('0x29')](/<(.*?)>/);return _0x366d0f?_0x366d0f[0x1]:_0xad4622;}Report[_0x0ae8('0xd')][_0x0ae8('0x14')]=function(_0x31e7bc){_0x31e7bc[_0x0ae8('0x2a')]=_0x31e7bc[_0x0ae8('0x2a')]||_0x31e7bc[_0x0ae8('0x2b')];if(_0x31e7bc['type']==_0x0ae8('0x2c')){_0x31e7bc[_0x0ae8('0x2d')]=_0x0ae8('0x2e');_0x31e7bc['lastdata']=_0x31e7bc[_0x0ae8('0x2e')];if(_0x31e7bc[_0x0ae8('0x2f')]==_0x0ae8('0x30')){_0x31e7bc[_0x0ae8('0x1f')]='';_0x31e7bc['destination']=extractCalleridNumber(_0x31e7bc[_0x0ae8('0x31')]);}else if(_0x31e7bc[_0x0ae8('0x2f')]==_0x0ae8('0x32')){if(_0x31e7bc['destination']==_0x0ae8('0x33')){_0x31e7bc[_0x0ae8('0x2a')]=extractCalleridNumber(_0x31e7bc['calleridpreview']);_0x31e7bc[_0x0ae8('0x34')]=_0x31e7bc[_0x0ae8('0x35')];_0x31e7bc[_0x0ae8('0x36')]=[_0x31e7bc[_0x0ae8('0x37')],_0x31e7bc['channel']=_0x31e7bc[_0x0ae8('0x36')]][0x0];_0x31e7bc[_0x0ae8('0x31')]=_0x31e7bc[_0x0ae8('0x38')];}else{_0x31e7bc['destination']=_0x31e7bc['calleridnum'];_0x31e7bc[_0x0ae8('0x34')]=_0x31e7bc['originatecalleridnum'];if(_0x31e7bc[_0x0ae8('0x39')]==_0x0ae8('0x3a')){_0x31e7bc[_0x0ae8('0x1f')]=_0x31e7bc[_0x0ae8('0x3b')];}else{_0x31e7bc[_0x0ae8('0x1f')]='';}}}}else{_0x31e7bc['callerid']=util[_0x0ae8('0x21')](_0x0ae8('0x3c'),_0x31e7bc[_0x0ae8('0x3d')],_0x31e7bc[_0x0ae8('0x34')]);}if(RpcVoiceTransferReport[_0x0ae8('0x3e')][_0x31e7bc[_0x0ae8('0x3f')]]){var _0x6170a=RpcVoiceTransferReport['transfers'][_0x31e7bc[_0x0ae8('0x3f')]];_0x6170a[_0x0ae8('0x40')]=_0x31e7bc[_0x0ae8('0x41')];RpcVoiceTransferReport[_0x0ae8('0x18')](_0x6170a);delete RpcVoiceTransferReport[_0x0ae8('0x3e')][_0x31e7bc[_0x0ae8('0x3f')]];}RpcVoiceCallReport[_0x0ae8('0x28')](_0x31e7bc);if(_0x31e7bc['monitor']){for(var _0x1ad800=0x0;_0x1ad800<_0x31e7bc[_0x0ae8('0x42')][_0x0ae8('0x24')];_0x1ad800+=0x1){_0x31e7bc['monitorFilename']=_0x31e7bc[_0x0ae8('0x42')][_0x1ad800][_0x0ae8('0x43')];_0x31e7bc['createdAt']=_0x31e7bc[_0x0ae8('0x42')][_0x1ad800]['createdAt'];if(_0x31e7bc[_0x0ae8('0x2b')]==_0x0ae8('0x33')){_0x31e7bc[_0x0ae8('0x34')]=_0x31e7bc['connectedlinenum'];_0x31e7bc[_0x0ae8('0x3d')]=_0x31e7bc[_0x0ae8('0x44')];_0x31e7bc[_0x0ae8('0x3b')]=_0x31e7bc[_0x0ae8('0x1f')];_0x31e7bc['connectedlinename']=_0x31e7bc[_0x0ae8('0x45')];_0x31e7bc[_0x0ae8('0x2b')]=_0x31e7bc[_0x0ae8('0x35')];}else if(_0x31e7bc[_0x0ae8('0x2b')]==_0x0ae8('0x46')){_0x31e7bc[_0x0ae8('0x34')]=_0x31e7bc[_0x0ae8('0x2a')];_0x31e7bc[_0x0ae8('0x2b')]=_0x31e7bc[_0x0ae8('0x35')];}RpcVoiceRecording[_0x0ae8('0x28')](_0x31e7bc);}}};Report[_0x0ae8('0xd')]['voiceAgentReport']=function(_0x54d33a){if(_[_0x0ae8('0x47')](_0x54d33a)){_0x54d33a[_0x0ae8('0x48')](function(_0x15fc21){RpcVoiceAgentReport[_0x0ae8('0x28')](_0x15fc21);});}else{RpcVoiceAgentReport['create'](_0x54d33a);}};Report[_0x0ae8('0xd')][_0x0ae8('0x49')]=function(_0x1f3f9b){RpcVoiceDialReport[_0x0ae8('0x28')](_0x1f3f9b);var _0x30430b;var _0x5354e9;var _0x1f8d82=_0x1f3f9b['channel'];if(_[_0x0ae8('0x4a')](_0x1f8d82,_0x0ae8('0x4b'))){_0x5354e9=_0x1f8d82[_0x0ae8('0x4c')](_0x1f8d82['indexOf']('/')+0x1,_0x1f8d82[_0x0ae8('0x4d')]('@'));_0x30430b=_['find'](this[_0x0ae8('0xb')],function(_0xd7e253){return _0xd7e253[_0x0ae8('0x4e')]==_0x5354e9||_0xd7e253[_0x0ae8('0x4f')]==_0x5354e9||_0xd7e253[_0x0ae8('0x1f')]==_0x5354e9;});}else{_0x5354e9=_0x1f8d82[_0x0ae8('0x4c')](_0x1f8d82[_0x0ae8('0x4d')]('/')+0x1,_0x1f8d82[_0x0ae8('0x50')]('-'));_0x30430b=this['findAgent'](_0x5354e9);}if(_0x30430b){_0x1f3f9b[_0x0ae8('0x20')]=_[_0x0ae8('0x1e')](_0x30430b[_0x0ae8('0x20')])?util[_0x0ae8('0x21')](_0x0ae8('0x22'),_0x30430b[_0x0ae8('0x1d')]):_0x30430b[_0x0ae8('0x20')];_0x1f3f9b[_0x0ae8('0x45')]=_0x30430b[_0x0ae8('0x1d')];_0x1f3f9b['accountcode']=_0x30430b[_0x0ae8('0x1f')];RpcMemberReport[_0x0ae8('0x49')](_0x1f3f9b);}};Report[_0x0ae8('0xd')][_0x0ae8('0x18')]=function(_0x37a680){RpcVoiceTransferReport[_0x0ae8('0x3e')][_0x37a680[_0x0ae8('0x51')]]=_0x37a680;};Report[_0x0ae8('0xd')]['attendedTransfer']=function(_0x466bbc){RpcVoiceTransferReport[_0x0ae8('0x1a')](_0x466bbc);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index fcaec33..c192c3f 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d2a=['[userReport][devicestatechange]','local','toLowerCase','toNumber','updateStatusRealtime','stateTime','format','name','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','trunk:save','startsWith','Local','substring','indexOf','mobile','phone','peer','peerstatus','[userReport][peerstatus]','registered','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','ioredis','bluebird','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','registry','syncRegistry','bind','devicestatechange','syncDeviceState','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','error','inspect','actionDeviceStateList','catch','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','then','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','isNotNull','info','device'];(function(_0x1734ab,_0x254bb2){var _0x41008e=function(_0x131727){while(--_0x131727){_0x1734ab['push'](_0x1734ab['shift']());}};_0x41008e(++_0x254bb2);}(_0x0d2a,0x64));var _0xa0d2=function(_0x145dab,_0x327d02){_0x145dab=_0x145dab-0x0;var _0x10d0c5=_0x0d2a[_0x145dab];return _0x10d0c5;};'use strict';var _=require(_0xa0d2('0x0'));var moment=require(_0xa0d2('0x1'));var util=require(_0xa0d2('0x2'));var Redis=require(_0xa0d2('0x3'));var BPromise=require(_0xa0d2('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0xa0d2('0x5')]=_[_0xa0d2('0x6')](config[_0xa0d2('0x5')],{'host':_0xa0d2('0x7'),'port':0x18eb});var io=require(_0xa0d2('0x8'))(new Redis(config[_0xa0d2('0x5')]));function UserReport(_0x400b98){this['trunks']=_0x400b98[_0xa0d2('0x9')];this[_0xa0d2('0xa')]=_0x400b98[_0xa0d2('0xa')];this[_0xa0d2('0xb')]=_0x400b98[_0xa0d2('0xb')];ami['on'](_0xa0d2('0xc'),this['syncRegistry']['bind'](this));ami['on'](_0xa0d2('0xd'),this[_0xa0d2('0xe')][_0xa0d2('0xf')](this));ami['on'](_0xa0d2('0x10'),this[_0xa0d2('0x11')][_0xa0d2('0xf')](this));ami['on']('peerstatus',this[_0xa0d2('0x12')]['bind'](this));return this[_0xa0d2('0x13')]();}function showSipRegistrations(){Promise[_0xa0d2('0x14')]()['then'](ami[_0xa0d2('0x15')]())['catch'](function(_0x3d57e5){logger[_0xa0d2('0x16')]('[userReport][sipshowregistry]',util[_0xa0d2('0x17')](_0x3d57e5,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xa0d2('0x14')]()['then'](ami[_0xa0d2('0x18')]())[_0xa0d2('0x19')](function(_0xc7c4ff){logger['error']('[userReport][devicestatelist]',util[_0xa0d2('0x17')](_0xc7c4ff,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xa0d2('0x14')]()['then'](ami[_0xa0d2('0x1a')]())[_0xa0d2('0x19')](function(_0x67a12c){logger['error'](_0xa0d2('0x1b'),util['inspect'](_0x67a12c,{'showHidden':![],'depth':null}));});}UserReport[_0xa0d2('0x1c')][_0xa0d2('0x13')]=function(){setInterval(function(){BPromise[_0xa0d2('0x14')]()['then'](showSipRegistrations())[_0xa0d2('0x1d')](listDeviceStates())[_0xa0d2('0x1d')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x10ee17){return _0x10ee17!==null&&!_[_0xa0d2('0x1e')](_0x10ee17);};UserReport['prototype'][_0xa0d2('0x1f')]=function(_0x1b13b9,_0x3ef9d8,_0x2581f2){io['to'](_0x1b13b9)[_0xa0d2('0x1f')](_0x3ef9d8,_0x2581f2);};UserReport['prototype']['syncRegistry']=function(_0x37748f){try{if(this['isNotNull'](_0x37748f)){logger['info'](_0xa0d2('0x20'),_0x37748f['username'],_0x37748f[_0xa0d2('0x21')]);logger[_0xa0d2('0x22')](_0xa0d2('0x23'),util[_0xa0d2('0x17')](_0x37748f,{'showHidden':![],'depth':null}));var _0x154a5a=_[_0xa0d2('0x24')](this[_0xa0d2('0x9')],{'defaultuser':_0x37748f[_0xa0d2('0x25')]});if(_0x154a5a){_0x37748f[_0xa0d2('0x26')]=_0x37748f['state'];_[_0xa0d2('0x27')](_0x154a5a,_[_0xa0d2('0x28')](_0x37748f,[_0xa0d2('0x29'),'actionid','username',_0xa0d2('0x21')]));logger[_0xa0d2('0x22')](_0xa0d2('0x2a'),util['inspect'](_0x154a5a,{'showHidden':![],'depth':null}));this[_0xa0d2('0x1f')](util['format']('trunk:%s',_0x154a5a['name']),'trunk:save',_0x154a5a);}}}catch(_0x5ad046){logger[_0xa0d2('0x16')](_0xa0d2('0x23'),util['inspect'](_0x5ad046,{'showHidden':![],'depth':null}));}};UserReport[_0xa0d2('0x1c')][_0xa0d2('0x11')]=function(_0x5258e3){try{if(this[_0xa0d2('0x2b')](_0x5258e3)){logger[_0xa0d2('0x2c')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x5258e3[_0xa0d2('0x2d')],_0x5258e3['state']);logger[_0xa0d2('0x22')](_0xa0d2('0x2e'),util['inspect'](_0x5258e3,{'showHidden':![],'depth':null}));if(this['agents'][_0x5258e3[_0xa0d2('0x2d')]]){if(!this[_0xa0d2('0xa')][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x2f')]||_0x5258e3[_0xa0d2('0x21')][_0xa0d2('0x30')]()=='inuse'){this[_0xa0d2('0xa')][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x2f')]=![];if(this[_0xa0d2('0xa')][_0x5258e3['device']][_0xa0d2('0x21')]!==_0x5258e3[_0xa0d2('0x21')]['toLowerCase']()){this[_0xa0d2('0xa')][_0x5258e3[_0xa0d2('0x2d')]]['stateTime']=_[_0xa0d2('0x31')](moment()['format']('x'));}this[_0xa0d2('0xa')][_0x5258e3[_0xa0d2('0x2d')]]['state']=_0x5258e3[_0xa0d2('0x21')][_0xa0d2('0x30')]();this[_0xa0d2('0xa')][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x32')](_0x5258e3);}}else if(this['telephones'][_0x5258e3[_0xa0d2('0x2d')]]){if(this[_0xa0d2('0xb')][_0x5258e3[_0xa0d2('0x2d')]]['state']!==_0x5258e3[_0xa0d2('0x21')][_0xa0d2('0x30')]()){this[_0xa0d2('0xb')][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x33')]=_[_0xa0d2('0x31')](moment()[_0xa0d2('0x34')]('x'));}this[_0xa0d2('0xb')][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x21')]=_0x5258e3['state'][_0xa0d2('0x30')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xa0d2('0x17')](this[_0xa0d2('0xb')][_0x5258e3[_0xa0d2('0x2d')]],{'showHidden':![],'depth':null}));this[_0xa0d2('0x1f')](util[_0xa0d2('0x34')]('telephone:%s',this[_0xa0d2('0xb')][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x35')]),'telephone:save',this[_0xa0d2('0xb')][_0x5258e3[_0xa0d2('0x2d')]]);}else if(this[_0xa0d2('0x9')][_0x5258e3[_0xa0d2('0x2d')]]){if(this['trunks'][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x21')]!==_0x5258e3['state'][_0xa0d2('0x30')]()){this['trunks'][_0x5258e3[_0xa0d2('0x2d')]]['stateTime']=_[_0xa0d2('0x31')](moment()[_0xa0d2('0x34')]('x'));}this['trunks'][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x21')]=_0x5258e3[_0xa0d2('0x21')][_0xa0d2('0x30')]();logger[_0xa0d2('0x22')](_0xa0d2('0x36'),util[_0xa0d2('0x17')](this[_0xa0d2('0x9')][_0x5258e3[_0xa0d2('0x2d')]],{'showHidden':![],'depth':null}));this[_0xa0d2('0x1f')](util[_0xa0d2('0x34')](_0xa0d2('0x37'),this['trunks'][_0x5258e3[_0xa0d2('0x2d')]][_0xa0d2('0x35')]),_0xa0d2('0x38'),this[_0xa0d2('0x9')][_0x5258e3[_0xa0d2('0x2d')]]);}else if(_[_0xa0d2('0x39')](_0x5258e3[_0xa0d2('0x2d')],_0xa0d2('0x3a'))){var _0x5024b2=_0x5258e3[_0xa0d2('0x2d')];var _0x3af464=_0x5024b2[_0xa0d2('0x3b')](_0x5024b2[_0xa0d2('0x3c')]('/')+0x1,_0x5024b2[_0xa0d2('0x3c')]('@'));var _0x2ef6d2=_[_0xa0d2('0x24')](this[_0xa0d2('0xa')],function(_0x7e5353){return _0x7e5353[_0xa0d2('0x3d')]==_0x3af464||_0x7e5353[_0xa0d2('0x3e')]==_0x3af464||_0x7e5353['accountcode']==_0x3af464;});if(_0x2ef6d2){if(_0x2ef6d2['state']!==_0x5258e3[_0xa0d2('0x21')][_0xa0d2('0x30')]()){_0x2ef6d2[_0xa0d2('0x33')]=_[_0xa0d2('0x31')](moment()[_0xa0d2('0x34')]('x'));}_0x2ef6d2[_0xa0d2('0x21')]=_0x5258e3[_0xa0d2('0x21')]['toLowerCase']();_0x2ef6d2[_0xa0d2('0x2f')]=!![];_0x2ef6d2['updateStatusRealtime'](_0x5258e3);}}}}catch(_0x22a902){logger[_0xa0d2('0x16')](_0xa0d2('0x2e'),util[_0xa0d2('0x17')](_0x22a902,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xa0d2('0x12')]=function(_0x62113c){try{if(this[_0xa0d2('0x2b')](_0x62113c)&&this[_0xa0d2('0x2b')](_0x62113c['peerstatus'])){logger[_0xa0d2('0x2c')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x62113c[_0xa0d2('0x3f')],_0x62113c['address'],_0x62113c[_0xa0d2('0x40')]);logger[_0xa0d2('0x22')](_0xa0d2('0x41'),util[_0xa0d2('0x17')](_0x62113c,{'showHidden':![],'depth':null}));if(this[_0xa0d2('0xa')][_0x62113c[_0xa0d2('0x3f')]]){if(!this[_0xa0d2('0xa')][_0x62113c[_0xa0d2('0x3f')]][_0xa0d2('0x2f')]||_0x62113c[_0xa0d2('0x40')][_0xa0d2('0x30')]()==_0xa0d2('0x42')){this[_0xa0d2('0xa')][_0x62113c[_0xa0d2('0x3f')]][_0xa0d2('0x2f')]=![];this[_0xa0d2('0xa')][_0x62113c[_0xa0d2('0x3f')]]['status']=_0x62113c[_0xa0d2('0x40')][_0xa0d2('0x30')]();this[_0xa0d2('0xa')][_0x62113c['peer']][_0xa0d2('0x43')]=_0x62113c[_0xa0d2('0x43')];this[_0xa0d2('0xa')][_0x62113c[_0xa0d2('0x3f')]]['updateStatusRealtime'](_0x62113c);}}else if(this[_0xa0d2('0xb')][_0x62113c[_0xa0d2('0x3f')]]){this[_0xa0d2('0xb')][_0x62113c[_0xa0d2('0x3f')]]['status']=_0x62113c['peerstatus'][_0xa0d2('0x30')]();this[_0xa0d2('0xb')][_0x62113c[_0xa0d2('0x3f')]]['address']=_0x62113c['address'];logger[_0xa0d2('0x22')](_0xa0d2('0x44'),util[_0xa0d2('0x17')](this[_0xa0d2('0xb')][_0x62113c[_0xa0d2('0x3f')]],{'showHidden':![],'depth':null}));this[_0xa0d2('0x1f')](util['format'](_0xa0d2('0x45'),this[_0xa0d2('0xb')][_0x62113c[_0xa0d2('0x3f')]][_0xa0d2('0x35')]),_0xa0d2('0x46'),this['telephones'][_0x62113c[_0xa0d2('0x3f')]]);}else if(this[_0xa0d2('0x9')][_0x62113c[_0xa0d2('0x3f')]]){this[_0xa0d2('0x9')][_0x62113c[_0xa0d2('0x3f')]][_0xa0d2('0x47')]=_0x62113c[_0xa0d2('0x40')][_0xa0d2('0x30')]();this[_0xa0d2('0x9')][_0x62113c['peer']]['address']=_0x62113c[_0xa0d2('0x43')];logger['debug'](_0xa0d2('0x48'),util[_0xa0d2('0x17')](this[_0xa0d2('0x9')][_0x62113c[_0xa0d2('0x3f')]],{'showHidden':![],'depth':null}));this[_0xa0d2('0x1f')](util[_0xa0d2('0x34')]('trunk:%s',this['trunks'][_0x62113c[_0xa0d2('0x3f')]][_0xa0d2('0x35')]),'trunk:save',this[_0xa0d2('0x9')][_0x62113c[_0xa0d2('0x3f')]]);}}}catch(_0xb92db9){logger[_0xa0d2('0x16')](_0xa0d2('0x41'),util[_0xa0d2('0x17')](_0xb92db9,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xedf7=['actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','emit','format','trunk:%s','name','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','substring','indexOf','find','mobile','accountcode','updateStatusRealtime','[userReport][devicestatechange]','peer','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../ami','defaults','redis','localhost','trunks','agents','telephones','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]'];(function(_0x4f21cd,_0x30f06f){var _0x1af331=function(_0x51145e){while(--_0x51145e){_0x4f21cd['push'](_0x4f21cd['shift']());}};_0x1af331(++_0x30f06f);}(_0xedf7,0x15d));var _0x7edf=function(_0x5aad20,_0x185dcb){_0x5aad20=_0x5aad20-0x0;var _0x589727=_0xedf7[_0x5aad20];return _0x589727;};'use strict';var _=require(_0x7edf('0x0'));var moment=require(_0x7edf('0x1'));var util=require(_0x7edf('0x2'));var Redis=require(_0x7edf('0x3'));var BPromise=require(_0x7edf('0x4'));var config=require(_0x7edf('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x7edf('0x6'));config['redis']=_[_0x7edf('0x7')](config[_0x7edf('0x8')],{'host':_0x7edf('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7edf('0x8')]));function UserReport(_0x16e1c9){this[_0x7edf('0xa')]=_0x16e1c9[_0x7edf('0xa')];this['agents']=_0x16e1c9[_0x7edf('0xb')];this[_0x7edf('0xc')]=_0x16e1c9['telephones'];ami['on']('registryentry',this[_0x7edf('0xd')]['bind'](this));ami['on']('registry',this[_0x7edf('0xd')][_0x7edf('0xe')](this));ami['on'](_0x7edf('0xf'),this['syncDeviceState']['bind'](this));ami['on'](_0x7edf('0x10'),this[_0x7edf('0x11')][_0x7edf('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x7edf('0x12')]()[_0x7edf('0x13')](ami[_0x7edf('0x14')]())['catch'](function(_0x4b6dd4){logger['error'](_0x7edf('0x15'),util[_0x7edf('0x16')](_0x4b6dd4,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x7edf('0x12')]()[_0x7edf('0x13')](ami[_0x7edf('0x17')]())['catch'](function(_0x14c431){logger[_0x7edf('0x18')](_0x7edf('0x19'),util[_0x7edf('0x16')](_0x14c431,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x7edf('0x13')](ami[_0x7edf('0x1a')]())[_0x7edf('0x1b')](function(_0xdaa6c4){logger[_0x7edf('0x18')](_0x7edf('0x1c'),util['inspect'](_0xdaa6c4,{'showHidden':![],'depth':null}));});}UserReport[_0x7edf('0x1d')][_0x7edf('0x1e')]=function(){setInterval(function(){BPromise[_0x7edf('0x12')]()[_0x7edf('0x13')](showSipRegistrations())['then'](listDeviceStates())[_0x7edf('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x7edf('0x1d')][_0x7edf('0x1f')]=function(_0x65c99d){return _0x65c99d!==null&&!_[_0x7edf('0x20')](_0x65c99d);};UserReport[_0x7edf('0x1d')]['emit']=function(_0x15151b,_0x404881,_0xcd4a0){io['to'](_0x15151b)['emit'](_0x404881,_0xcd4a0);};UserReport[_0x7edf('0x1d')][_0x7edf('0xd')]=function(_0x403aa6){try{if(this['isNotNull'](_0x403aa6)){logger[_0x7edf('0x21')](_0x7edf('0x22'),_0x403aa6[_0x7edf('0x23')],_0x403aa6[_0x7edf('0x24')]);logger[_0x7edf('0x25')](_0x7edf('0x26'),util[_0x7edf('0x16')](_0x403aa6,{'showHidden':![],'depth':null}));var _0x215cda=_['find'](this[_0x7edf('0xa')],{'defaultuser':_0x403aa6[_0x7edf('0x23')]});if(_0x215cda){_0x403aa6['stateRegistry']=_0x403aa6[_0x7edf('0x24')];_['merge'](_0x215cda,_[_0x7edf('0x27')](_0x403aa6,[_0x7edf('0x28'),_0x7edf('0x29'),_0x7edf('0x23'),'state']));logger['debug'](_0x7edf('0x2a'),util[_0x7edf('0x16')](_0x215cda,{'showHidden':![],'depth':null}));this[_0x7edf('0x2b')](util[_0x7edf('0x2c')](_0x7edf('0x2d'),_0x215cda[_0x7edf('0x2e')]),'trunk:save',_0x215cda);}}}catch(_0x47b01c){logger[_0x7edf('0x18')](_0x7edf('0x26'),util[_0x7edf('0x16')](_0x47b01c,{'showHidden':![],'depth':null}));}};UserReport[_0x7edf('0x1d')][_0x7edf('0x2f')]=function(_0xc91d9c){try{if(this[_0x7edf('0x1f')](_0xc91d9c)){logger[_0x7edf('0x21')](_0x7edf('0x30'),_0xc91d9c[_0x7edf('0x31')],_0xc91d9c['state']);logger[_0x7edf('0x25')]('[userReport][devicestatechange]',util[_0x7edf('0x16')](_0xc91d9c,{'showHidden':![],'depth':null}));if(this[_0x7edf('0xb')][_0xc91d9c[_0x7edf('0x31')]]){if(!this[_0x7edf('0xb')][_0xc91d9c['device']][_0x7edf('0x32')]||_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]()==_0x7edf('0x34')){this[_0x7edf('0xb')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x32')]=![];if(this['agents'][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x24')]!==_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]()){this[_0x7edf('0xb')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x35')]=_[_0x7edf('0x36')](moment()[_0x7edf('0x2c')]('x'));}this[_0x7edf('0xb')][_0xc91d9c['device']]['state']=_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]();this[_0x7edf('0xb')][_0xc91d9c['device']]['updateStatusRealtime'](_0xc91d9c);}}else if(this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]]){if(this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x24')]!==_0xc91d9c[_0x7edf('0x24')]['toLowerCase']()){this['telephones'][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x35')]=_[_0x7edf('0x36')](moment()[_0x7edf('0x2c')]('x'));}this[_0x7edf('0xc')][_0xc91d9c['device']]['state']=_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]();logger[_0x7edf('0x25')](_0x7edf('0x37'),util[_0x7edf('0x16')](this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]],{'showHidden':![],'depth':null}));this[_0x7edf('0x2b')](util[_0x7edf('0x2c')](_0x7edf('0x38'),this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x2e')]),_0x7edf('0x39'),this[_0x7edf('0xc')][_0xc91d9c[_0x7edf('0x31')]]);}else if(this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]]){if(this['trunks'][_0xc91d9c[_0x7edf('0x31')]]['state']!==_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]()){this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x35')]=_[_0x7edf('0x36')](moment()[_0x7edf('0x2c')]('x'));}this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]]['state']=_0xc91d9c['state'][_0x7edf('0x33')]();logger[_0x7edf('0x25')](_0x7edf('0x3a'),util[_0x7edf('0x16')](this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7edf('0x2c')]('trunk:%s',this['trunks'][_0xc91d9c[_0x7edf('0x31')]][_0x7edf('0x2e')]),_0x7edf('0x3b'),this[_0x7edf('0xa')][_0xc91d9c[_0x7edf('0x31')]]);}else if(_['startsWith'](_0xc91d9c[_0x7edf('0x31')],_0x7edf('0x3c'))){var _0x4f9231=_0xc91d9c[_0x7edf('0x31')];var _0x448259=_0x4f9231[_0x7edf('0x3d')](_0x4f9231[_0x7edf('0x3e')]('/')+0x1,_0x4f9231[_0x7edf('0x3e')]('@'));var _0x398643=_[_0x7edf('0x3f')](this[_0x7edf('0xb')],function(_0x3b509d){return _0x3b509d[_0x7edf('0x40')]==_0x448259||_0x3b509d['phone']==_0x448259||_0x3b509d[_0x7edf('0x41')]==_0x448259;});if(_0x398643){if(_0x398643[_0x7edf('0x24')]!==_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]()){_0x398643[_0x7edf('0x35')]=_['toNumber'](moment()[_0x7edf('0x2c')]('x'));}_0x398643[_0x7edf('0x24')]=_0xc91d9c[_0x7edf('0x24')][_0x7edf('0x33')]();_0x398643[_0x7edf('0x32')]=!![];_0x398643[_0x7edf('0x42')](_0xc91d9c);}}}}catch(_0xcbc056){logger[_0x7edf('0x18')](_0x7edf('0x43'),util[_0x7edf('0x16')](_0xcbc056,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x7edf('0x11')]=function(_0x49f159){try{if(this[_0x7edf('0x1f')](_0x49f159)&&this[_0x7edf('0x1f')](_0x49f159[_0x7edf('0x10')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x49f159[_0x7edf('0x44')],_0x49f159[_0x7edf('0x45')],_0x49f159[_0x7edf('0x10')]);logger[_0x7edf('0x25')]('[userReport][peerstatus]',util[_0x7edf('0x16')](_0x49f159,{'showHidden':![],'depth':null}));if(this['agents'][_0x49f159['peer']]){if(!this[_0x7edf('0xb')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x32')]||_0x49f159[_0x7edf('0x10')][_0x7edf('0x33')]()=='registered'){this[_0x7edf('0xb')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x32')]=![];this[_0x7edf('0xb')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x46')]=_0x49f159['peerstatus'][_0x7edf('0x33')]();this[_0x7edf('0xb')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x45')]=_0x49f159[_0x7edf('0x45')];this['agents'][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x42')](_0x49f159);}}else if(this[_0x7edf('0xc')][_0x49f159[_0x7edf('0x44')]]){this[_0x7edf('0xc')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x46')]=_0x49f159[_0x7edf('0x10')][_0x7edf('0x33')]();this['telephones'][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x45')]=_0x49f159[_0x7edf('0x45')];logger['debug'](_0x7edf('0x47'),util[_0x7edf('0x16')](this[_0x7edf('0xc')][_0x49f159['peer']],{'showHidden':![],'depth':null}));this[_0x7edf('0x2b')](util[_0x7edf('0x2c')](_0x7edf('0x38'),this[_0x7edf('0xc')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x2e')]),_0x7edf('0x39'),this['telephones'][_0x49f159[_0x7edf('0x44')]]);}else if(this[_0x7edf('0xa')][_0x49f159['peer']]){this[_0x7edf('0xa')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x46')]=_0x49f159[_0x7edf('0x10')][_0x7edf('0x33')]();this[_0x7edf('0xa')][_0x49f159[_0x7edf('0x44')]]['address']=_0x49f159[_0x7edf('0x45')];logger[_0x7edf('0x25')](_0x7edf('0x48'),util['inspect'](this['trunks'][_0x49f159[_0x7edf('0x44')]],{'showHidden':![],'depth':null}));this[_0x7edf('0x2b')](util[_0x7edf('0x2c')]('trunk:%s',this[_0x7edf('0xa')][_0x49f159[_0x7edf('0x44')]][_0x7edf('0x2e')]),_0x7edf('0x3b'),this[_0x7edf('0xa')][_0x49f159[_0x7edf('0x44')]]);}}}catch(_0x87f141){logger[_0x7edf('0x18')](_0x7edf('0x49'),util[_0x7edf('0x16')](_0x87f141,{'showHidden':![],'depth':null}));}};module[_0x7edf('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 9123009..da5dee2 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x140ad0,_0x46361e){var _0x2c4ca3=function(_0x319223){while(--_0x319223){_0x140ad0['push'](_0x140ad0['shift']());}};_0x2c4ca3(++_0x46361e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x42ed1a,_0x29a397){var _0x482252=function(_0xaac024){while(--_0xaac024){_0x42ed1a['push'](_0x42ed1a['shift']());}};_0x482252(++_0x29a397);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 0e9ecbc..9e6b8aa 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc504=['syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','linkedid','isUndefined','merge','channels','pick','keys','channel','split','xcally-motion-preview','agents','destconnectedlinenum','connectedlinenum','user:%s','user:agentconnect','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','exten','accountcode','[%s][voiceCallReport][newchannel]','isNotNull','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','match','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','connectedlinename','UserId','membername','name','routealias','syncMixMonitorFilename','endsWith','.wav49','replace','monitorFilename','find','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','answertime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','then','transferType','undefined','isEmpty','getSettings','Action','catch','StopMixMonitor','destinationchannel','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','lodash','moment','path','ioredis','../../../config/logger','../ami','../model/channel','../rpc/setting','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncVarSet','hangup','syncHangup','newcallerid'];(function(_0x4ab44b,_0xe18add){var _0x37f82d=function(_0x2d087d){while(--_0x2d087d){_0x4ab44b['push'](_0x4ab44b['shift']());}};_0x37f82d(++_0xe18add);}(_0xc504,0x16d));var _0x4c50=function(_0x4499f6,_0x3321d3){_0x4499f6=_0x4499f6-0x0;var _0x1ff241=_0xc504[_0x4499f6];return _0x1ff241;};'use strict';var _=require(_0x4c50('0x0'));var moment=require(_0x4c50('0x1'));var util=require('util');var path=require(_0x4c50('0x2'));var Redis=require(_0x4c50('0x3'));var config=require('../../../config/environment');var logger=require(_0x4c50('0x4'))('ami');var ami=require(_0x4c50('0x5'));var Channel=require(_0x4c50('0x6'));var RpcSetting=require(_0x4c50('0x7'));var applications=[_0x4c50('0x8'),'queue',_0x4c50('0x9'),_0x4c50('0xa'),_0x4c50('0xb'),_0x4c50('0xc')];var dispositions=[_0x4c50('0xd'),_0x4c50('0xe'),_0x4c50('0xe'),'NO\x20ANSWER',_0x4c50('0xd'),_0x4c50('0xd'),_0x4c50('0xf'),_0x4c50('0x10'),_0x4c50('0xe'),_0x4c50('0xe'),'FAILED'];config[_0x4c50('0x11')]=_['defaults'](config[_0x4c50('0x11')],{'host':_0x4c50('0x12'),'port':0x18eb});var io=require(_0x4c50('0x13'))(new Redis(config[_0x4c50('0x11')]));function VoiceCallReport(_0x171bc6){this['channels']=_0x171bc6['channels'];this['agents']=_0x171bc6['agents'];this[_0x4c50('0x14')]={};ami['on'](_0x4c50('0x15'),this[_0x4c50('0x16')]['bind'](this));ami['on']('newexten',this[_0x4c50('0x16')][_0x4c50('0x17')](this));ami['on'](_0x4c50('0x18'),this[_0x4c50('0x19')][_0x4c50('0x17')](this));ami['on'](_0x4c50('0x1a'),this['syncNewState'][_0x4c50('0x17')](this));ami['on']('varset',this[_0x4c50('0x1b')][_0x4c50('0x17')](this));ami['on'](_0x4c50('0x1c'),this[_0x4c50('0x1d')]['bind'](this));ami['on'](_0x4c50('0x1e'),this[_0x4c50('0x1f')][_0x4c50('0x17')](this));ami['on'](_0x4c50('0x20'),this[_0x4c50('0x21')][_0x4c50('0x17')](this));ami['on'](_0x4c50('0x22'),this['syncBlindTransfer'][_0x4c50('0x17')](this));ami['on'](_0x4c50('0x23'),this[_0x4c50('0x24')][_0x4c50('0x17')](this));ami['on']('musiconholdstop',this[_0x4c50('0x25')]['bind'](this));try{logger[_0x4c50('0x26')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x4c50('0x27')]();}catch(_0x3318f0){logger[_0x4c50('0x28')](_0x4c50('0x29'),util[_0x4c50('0x2a')](_0x3318f0,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x4c50('0x2b')]['isNotNull']=function(_0x5d6ae6){return _0x5d6ae6!==null&&!_['isUndefined'](_0x5d6ae6);};VoiceCallReport[_0x4c50('0x2b')][_0x4c50('0x2c')]=function(_0x452a5b,_0x13fcc2,_0x59ebfe){io['to'](_0x452a5b)['emit'](_0x13fcc2,_0x59ebfe);};VoiceCallReport[_0x4c50('0x2b')][_0x4c50('0x1f')]=function(_0x4cc131){try{if(this['isNotNull'](_0x4cc131)){logger['info'](_0x4c50('0x2d'),_0x4cc131[_0x4c50('0x2e')],_0x4cc131[_0x4c50('0x2f')],_0x4cc131['calleridnum']);logger[_0x4c50('0x30')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x4cc131[_0x4c50('0x2e')],util[_0x4c50('0x2a')](_0x4cc131,{'showHidden':![],'depth':null}));if(_0x4cc131[_0x4c50('0x2e')]===_0x4cc131[_0x4c50('0x31')]){if(!_[_0x4c50('0x32')](this['channels'][_0x4cc131[_0x4c50('0x2e')]])){_[_0x4c50('0x33')](this[_0x4c50('0x34')][_0x4cc131['uniqueid']],_[_0x4c50('0x35')](_0x4cc131,_[_0x4c50('0x36')](this['channels'][_0x4cc131[_0x4c50('0x2e')]])));}}if(_0x4cc131['context']==='from-sip'){if(this['agents'][_0x4cc131[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]]){if(_0x4cc131['exten']==_0x4c50('0x39')){this[_0x4c50('0x3a')][_0x4cc131[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]][_0x4c50('0x3b')]=_0x4cc131[_0x4c50('0x3c')];this[_0x4c50('0x2c')](util['format'](_0x4c50('0x3d'),this[_0x4c50('0x3a')][_0x4cc131['channel']['split']('-')[0x0]]['name']),_0x4c50('0x3e'),{'destaccountcode':this[_0x4c50('0x3a')][_0x4cc131[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x4cc131[_0x4c50('0x3c')]});}}}}}catch(_0x80dd7c){logger[_0x4c50('0x28')](_0x4c50('0x3f'),_0x4cc131[_0x4c50('0x2e')],util[_0x4c50('0x2a')](_0x80dd7c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4c50('0x2b')][_0x4c50('0x19')]=function(_0xc22423){try{if(this['isNotNull'](_0xc22423)){logger[_0x4c50('0x30')]('[%s][voiceCallReport][newchannel]\x20event:',_0xc22423[_0x4c50('0x2e')],util[_0x4c50('0x2a')](_0xc22423,{'showHidden':![],'depth':null}));if(_0xc22423['uniqueid']===_0xc22423['linkedid']&&_0xc22423[_0x4c50('0x37')]!=_0x4c50('0x40')){if(_[_0x4c50('0x32')](this['channels'][_0xc22423['uniqueid']])){logger[_0x4c50('0x26')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0xc22423[_0x4c50('0x2e')],_0xc22423[_0x4c50('0x41')],_0xc22423['exten']);this['channels'][_0xc22423['uniqueid']]=new Channel();this[_0x4c50('0x34')][_0xc22423[_0x4c50('0x2e')]][_0x4c50('0x42')]=moment()[_0x4c50('0x43')](_0x4c50('0x44'));this['channels'][_0xc22423[_0x4c50('0x2e')]][_0x4c50('0x45')]=dispositions[_[_0x4c50('0x46')](_0xc22423[_0x4c50('0x47')])];_[_0x4c50('0x33')](this[_0x4c50('0x34')][_0xc22423[_0x4c50('0x2e')]],_[_0x4c50('0x35')](_0xc22423,_['keys'](this['channels'][_0xc22423[_0x4c50('0x2e')]])));if(_0xc22423[_0x4c50('0x41')]===_0x4c50('0x48')){if(this[_0x4c50('0x3a')][_0xc22423[_0x4c50('0x37')]['split']('-')[0x0]]){if(_[_0x4c50('0x32')](this['agents'][_0xc22423[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]][_0x4c50('0x3b')])){this[_0x4c50('0x3a')][_0xc22423['channel'][_0x4c50('0x38')]('-')[0x0]][_0x4c50('0x3b')]=_0xc22423[_0x4c50('0x49')];logger[_0x4c50('0x30')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0xc22423[_0x4c50('0x2e')],util['inspect']({'id':this[_0x4c50('0x3a')][_0xc22423['channel'][_0x4c50('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x4c50('0x3a')][_0xc22423[_0x4c50('0x37')]['split']('-')[0x0]][_0x4c50('0x4a')],'destconnectedlinenum':_0xc22423[_0x4c50('0x49')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x4c50('0x43')](_0x4c50('0x3d'),this[_0x4c50('0x3a')][_0xc22423['channel'][_0x4c50('0x38')]('-')[0x0]]['name']),'user:agentconnect',{'id':this[_0x4c50('0x3a')][_0xc22423[_0x4c50('0x37')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x4c50('0x3a')][_0xc22423[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]][_0x4c50('0x4a')],'destconnectedlinenum':_0xc22423[_0x4c50('0x49')]});}}}}}}}catch(_0x431c65){logger[_0x4c50('0x28')](_0x4c50('0x4b'),_0xc22423[_0x4c50('0x2e')],util['inspect'](_0x431c65,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x484ce4){try{if(this[_0x4c50('0x4c')](_0x484ce4)){logger['debug'](_0x4c50('0x4d'),_0x484ce4[_0x4c50('0x2e')],util[_0x4c50('0x2a')](_0x484ce4,{'showHidden':![],'depth':null}));if(_0x484ce4[_0x4c50('0x2e')]===_0x484ce4[_0x4c50('0x31')]&&_0x484ce4['exten']!='h'&&_0x484ce4[_0x4c50('0x37')]!=_0x4c50('0x40')){_0x484ce4[_0x4c50('0x4e')]=_0x484ce4[_0x4c50('0x4e')][_0x4c50('0x4f')]();_0x484ce4[_0x4c50('0x50')]=_0x484ce4[_0x4c50('0x51')]&&_0x484ce4[_0x4c50('0x51')][_0x4c50('0x52')]('CDR(routeAlias)')?_0x484ce4[_0x4c50('0x51')]:(_0x484ce4['appdata']||_0x484ce4[_0x4c50('0x50')])[_0x4c50('0x4f')]();logger['info'](_0x4c50('0x53'),_0x484ce4['uniqueid'],_0x484ce4[_0x4c50('0x4e')],_0x484ce4[_0x4c50('0x50')]);if(_[_0x4c50('0x32')](this[_0x4c50('0x34')][_0x484ce4[_0x4c50('0x2e')]])){this['channels'][_0x484ce4['uniqueid']]=new Channel();this[_0x4c50('0x34')][_0x484ce4[_0x4c50('0x2e')]][_0x4c50('0x42')]=_0x484ce4[_0x4c50('0x54')]?moment()[_0x4c50('0x55')](moment['duration'](_0x484ce4['duration'])[_0x4c50('0x56')](),_0x4c50('0x56'))['format'](_0x4c50('0x44')):moment()[_0x4c50('0x43')](_0x4c50('0x44'));this[_0x4c50('0x34')][_0x484ce4['uniqueid']]['disposition']=_0x4c50('0xd');}_['merge'](this['channels'][_0x484ce4[_0x4c50('0x2e')]],_[_0x4c50('0x35')](_0x484ce4,_[_0x4c50('0x36')](this[_0x4c50('0x34')][_0x484ce4[_0x4c50('0x2e')]])));if(_[_0x4c50('0x57')](applications,_0x484ce4['application'])){this[_0x4c50('0x34')][_0x484ce4['uniqueid']][_0x4c50('0x58')]=_0x484ce4[_0x4c50('0x4e')];this[_0x4c50('0x34')][_0x484ce4[_0x4c50('0x2e')]][_0x4c50('0x59')]=_0x484ce4['applicationdata'];if(_0x484ce4['application']===_0x4c50('0x8')&&_['startsWith'](_0x484ce4[_0x4c50('0x50')][_0x4c50('0x4f')](),_0x4c50('0x5a'))){var _0x55646d=_0x484ce4[_0x4c50('0x50')]['split']('=');var _0x180161=_0x55646d[0x0]['toLowerCase']()[_0x4c50('0x5b')](/cdr\((.*)\)/);if(_0x180161){this[_0x4c50('0x34')][_0x484ce4['uniqueid']][_0x180161[0x1]]=_0x55646d[0x1];}}else if(_0x484ce4[_0x4c50('0x4e')]==='queue'){this['channels'][_0x484ce4[_0x4c50('0x2e')]][_0x4c50('0x5c')]=_0x484ce4[_0x4c50('0x50')][_0x4c50('0x38')](',')[0x0];}}}}}catch(_0x27c3e0){logger[_0x4c50('0x28')](_0x4c50('0x5d'),_0x484ce4[_0x4c50('0x2e')],util[_0x4c50('0x2a')](_0x27c3e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4c50('0x2b')][_0x4c50('0x5e')]=function(_0x5b0d77){try{if(this[_0x4c50('0x4c')](_0x5b0d77)){logger[_0x4c50('0x26')](_0x4c50('0x5f'),_0x5b0d77[_0x4c50('0x2e')],_0x5b0d77[_0x4c50('0x31')],_0x5b0d77[_0x4c50('0x2f')],_0x5b0d77[_0x4c50('0x60')]);logger[_0x4c50('0x30')](_0x4c50('0x61'),_0x5b0d77[_0x4c50('0x2e')],util[_0x4c50('0x2a')](_0x5b0d77,{'showHidden':![],'depth':null}));if(_0x5b0d77[_0x4c50('0x2e')]!==_0x5b0d77['linkedid']){if(this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]]){if(_0x5b0d77['channelstate']==='6'){if(!this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]]['answered']){var _0x3073a3=moment();this['channels'][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x62')]=!![];this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]]['answertime']=_0x3073a3['format'](_0x4c50('0x44'));if(this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x42')]){this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x63')]=_0x3073a3[_0x4c50('0x64')](this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x42')],_0x4c50('0x56'));}}this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x31')]=_0x5b0d77[_0x4c50('0x2e')];if(_0x5b0d77[_0x4c50('0x60')]!=='xcally-motion-preview'){this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x3c')]=_0x5b0d77[_0x4c50('0x60')];}this[_0x4c50('0x34')][_0x5b0d77['linkedid']][_0x4c50('0x65')]=_0x5b0d77[_0x4c50('0x2f')];this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]]['destinationchannel']=_0x5b0d77['channel'];this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]]['disposition']=dispositions[_[_0x4c50('0x46')](_0x5b0d77[_0x4c50('0x47')])];if(this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')]['split']('-')[0x0]]){this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x66')]=this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')]['split']('-')[0x0]]['id'];this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x67')]=this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]][_0x4c50('0x68')];}}}}else{if(this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x2e')]]){if(_0x5b0d77[_0x4c50('0x47')]==='6'){if(this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')]['split']('-')[0x0]]){this['channels'][_0x5b0d77[_0x4c50('0x2e')]]['UserId']=this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')]['split']('-')[0x0]]['id'];this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x2e')]]['membername']=this[_0x4c50('0x3a')][_0x5b0d77['channel'][_0x4c50('0x38')]('-')[0x0]][_0x4c50('0x68')];}}}}if(_0x5b0d77[_0x4c50('0x47')]==='6'&&_0x5b0d77['context']===_0x4c50('0x48')){if(this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]]){this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]][_0x4c50('0x3b')]=_0x5b0d77['exten'];var _0x5a1279,_0x1aada8;if(this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x2e')]]){_0x5a1279=this['channels'][_0x5b0d77['uniqueid']][_0x4c50('0x69')];_0x1aada8=this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x2e')]]['queue'];}else if(this['channels'][_0x5b0d77[_0x4c50('0x31')]]){_0x5a1279=this[_0x4c50('0x34')][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x69')];_0x1aada8=this['channels'][_0x5b0d77[_0x4c50('0x31')]][_0x4c50('0x5c')];}logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x5b0d77[_0x4c50('0x2e')],util[_0x4c50('0x2a')]({'id':this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x4c50('0x3a')][_0x5b0d77['channel'][_0x4c50('0x38')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5b0d77[_0x4c50('0x49')],'routealias':_0x5a1279,'queue':_0x1aada8||undefined},{'showHidden':![],'depth':null}));this[_0x4c50('0x2c')](util[_0x4c50('0x43')](_0x4c50('0x3d'),this[_0x4c50('0x3a')][_0x5b0d77['channel']['split']('-')[0x0]][_0x4c50('0x68')]),_0x4c50('0x3e'),{'id':this[_0x4c50('0x3a')][_0x5b0d77[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x4c50('0x3a')][_0x5b0d77['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5b0d77[_0x4c50('0x49')],'routealias':_0x5a1279,'queue':_0x1aada8||undefined});}}}}catch(_0x3a42e8){logger[_0x4c50('0x28')]('[%s][voiceCallReport][newstate]',_0x5b0d77[_0x4c50('0x2e')],util['inspect'](_0x3a42e8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4c50('0x2b')][_0x4c50('0x6a')]=function(_0x452cb7,_0x448486){try{if(this[_0x4c50('0x34')][_0x452cb7]){logger[_0x4c50('0x26')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x452cb7,_0x448486);this[_0x4c50('0x34')][_0x452cb7]['monitor']=!![];if(_[_0x4c50('0x6b')](_0x448486,_0x4c50('0x6c'))){_0x448486=_0x448486[_0x4c50('0x6d')](_0x4c50('0x6c'),'.WAV');}this['channels'][_0x452cb7][_0x4c50('0x6e')]=_0x448486;var _0x35ca58=_[_0x4c50('0x6f')](this[_0x4c50('0x34')][_0x452cb7][_0x4c50('0x70')],{'filename':_0x448486});if(_[_0x4c50('0x71')](_0x35ca58)){this[_0x4c50('0x34')][_0x452cb7][_0x4c50('0x70')]['push']({'filename':_0x448486,'createdAt':moment()['format'](_0x4c50('0x44')),'mixmonitorid':'','status':_0x4c50('0x72')});}}}catch(_0x480f9f){logger[_0x4c50('0x28')](_0x4c50('0x73'),_0x452cb7,util[_0x4c50('0x2a')](_0x480f9f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4c50('0x1b')]=function(_0x271871){try{if(this[_0x4c50('0x4c')](_0x271871)){logger['debug'](_0x4c50('0x74'),_0x271871['uniqueid'],util[_0x4c50('0x2a')](_0x271871,{'showHidden':![],'depth':null}));if(this['channels'][_0x271871[_0x4c50('0x2e')]]&&_0x271871[_0x4c50('0x37')]!=_0x4c50('0x40')){if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')])){if(this['isNotNull'](_0x271871[_0x4c50('0x75')]['mixmonitor_filename'])){logger[_0x4c50('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x271871[_0x4c50('0x2e')],_0x271871[_0x4c50('0x76')]);this[_0x4c50('0x6a')](_0x271871[_0x4c50('0x2e')],_0x271871['value']);}else if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')][_0x4c50('0x77')])){logger[_0x4c50('0x26')](_0x4c50('0x78'),_0x271871[_0x4c50('0x2e')],_0x271871[_0x4c50('0x76')]);this[_0x4c50('0x34')][_0x271871['uniqueid']]['calleridnum']=_0x271871[_0x4c50('0x76')];}else if(this['isNotNull'](_0x271871[_0x4c50('0x75')]['xmd-callerid'])){logger[_0x4c50('0x26')](_0x4c50('0x79'),_0x271871['uniqueid'],_0x271871[_0x4c50('0x76')]);this[_0x4c50('0x34')][_0x271871[_0x4c50('0x2e')]][_0x4c50('0x7a')]=_0x271871[_0x4c50('0x76')];}else if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')][_0x4c50('0x7b')])){logger[_0x4c50('0x26')](_0x4c50('0x7c'),_0x271871[_0x4c50('0x2e')],_0x271871[_0x4c50('0x76')]);this[_0x4c50('0x34')][_0x271871[_0x4c50('0x2e')]][_0x4c50('0x7d')]=_0x271871[_0x4c50('0x76')];}else if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')][_0x4c50('0x7e')])){logger[_0x4c50('0x26')](_0x4c50('0x7f'),_0x271871[_0x4c50('0x2e')],_0x271871['value']['split'](',')[0x0]);this[_0x4c50('0x34')][_0x271871['uniqueid']][_0x4c50('0x5c')]=_0x271871['value']['split'](',')[0x0];}else if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')]['xmd-originatecalleridnum'])){logger[_0x4c50('0x26')](_0x4c50('0x80'),_0x271871['uniqueid'],_0x271871[_0x4c50('0x76')]);this['channels'][_0x271871['uniqueid']][_0x4c50('0x81')]=_0x271871['value'];}else if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')]['xmd-destination'])){logger[_0x4c50('0x26')](_0x4c50('0x82'),_0x271871[_0x4c50('0x2e')],_0x271871[_0x4c50('0x76')]);this[_0x4c50('0x34')][_0x271871[_0x4c50('0x2e')]]['destination']=_0x271871[_0x4c50('0x76')];}else if(this[_0x4c50('0x4c')](_0x271871['variable'][_0x4c50('0x83')])){logger[_0x4c50('0x26')](_0x4c50('0x84'),_0x271871[_0x4c50('0x2e')],_0x271871[_0x4c50('0x76')]);this[_0x4c50('0x34')][_0x271871[_0x4c50('0x2e')]][_0x4c50('0x85')]=_0x271871[_0x4c50('0x76')];}else if(this['isNotNull'](_0x271871[_0x4c50('0x75')][_0x4c50('0x86')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x271871[_0x4c50('0x2e')],_0x271871[_0x4c50('0x76')]);this['channels'][_0x271871[_0x4c50('0x2e')]][_0x4c50('0x5c')]=_0x271871[_0x4c50('0x76')];}else if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')][_0x4c50('0x87')])){logger[_0x4c50('0x26')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x271871[_0x4c50('0x2e')],_0x271871['value']);this[_0x4c50('0x34')][_0x271871[_0x4c50('0x2e')]][_0x4c50('0x88')]=_0x271871[_0x4c50('0x76')];}}}else if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')][_0x4c50('0x89')])){if(_0x271871['value']){var _0x477384=path['parse'](_0x271871['value'])[_0x4c50('0x68')];logger[_0x4c50('0x26')](_0x4c50('0x8a'),_0x477384,_0x271871[_0x4c50('0x76')]);this[_0x4c50('0x6a')](_0x477384,_0x271871[_0x4c50('0x76')]);}}else if(this[_0x4c50('0x34')][_0x271871[_0x4c50('0x31')]]){if(this[_0x4c50('0x4c')](_0x271871[_0x4c50('0x75')])){if(this['isNotNull'](_0x271871[_0x4c50('0x75')][_0x4c50('0x87')])){logger['info'](_0x4c50('0x8b'),_0x271871[_0x4c50('0x31')],_0x271871['value']);this[_0x4c50('0x34')][_0x271871[_0x4c50('0x31')]][_0x4c50('0x8c')]=_0x271871[_0x4c50('0x76')];}}}}}catch(_0x558698){logger[_0x4c50('0x28')](_0x4c50('0x8d'),_0x271871['uniqueid'],util[_0x4c50('0x2a')](_0x558698,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4c50('0x2b')][_0x4c50('0x1d')]=function(_0x5b8c34){try{if(this[_0x4c50('0x4c')](_0x5b8c34)){logger[_0x4c50('0x30')](_0x4c50('0x8e'),_0x5b8c34[_0x4c50('0x2e')],util[_0x4c50('0x2a')](_0x5b8c34,{'showHidden':![],'depth':null}));if(this[_0x4c50('0x34')][_0x5b8c34['uniqueid']]){logger[_0x4c50('0x26')](_0x4c50('0x8f'),_0x5b8c34[_0x4c50('0x2e')],_0x5b8c34[_0x4c50('0x90')]);var _0x4ac6cd=moment();this[_0x4c50('0x34')][_0x5b8c34[_0x4c50('0x2e')]][_0x4c50('0x91')]=_0x4ac6cd[_0x4c50('0x43')](_0x4c50('0x44'));this[_0x4c50('0x34')][_0x5b8c34[_0x4c50('0x2e')]]['duration']=_0x4ac6cd[_0x4c50('0x64')](this[_0x4c50('0x34')][_0x5b8c34[_0x4c50('0x2e')]][_0x4c50('0x42')],'seconds');if(this[_0x4c50('0x34')][_0x5b8c34[_0x4c50('0x2e')]]['answered']){this['channels'][_0x5b8c34[_0x4c50('0x2e')]][_0x4c50('0x92')]=_0x4ac6cd[_0x4c50('0x64')](this[_0x4c50('0x34')][_0x5b8c34[_0x4c50('0x2e')]][_0x4c50('0x93')],'seconds');this[_0x4c50('0x34')][_0x5b8c34[_0x4c50('0x2e')]][_0x4c50('0x63')]=this[_0x4c50('0x34')][_0x5b8c34[_0x4c50('0x2e')]][_0x4c50('0x54')]-this[_0x4c50('0x34')][_0x5b8c34[_0x4c50('0x2e')]][_0x4c50('0x92')];}if(_0x5b8c34[_0x4c50('0x41')]==='from-sip'){if(this[_0x4c50('0x3a')][_0x5b8c34[_0x4c50('0x37')]['split']('-')[0x0]]){this[_0x4c50('0x3a')][_0x5b8c34[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]]=_[_0x4c50('0x94')](this[_0x4c50('0x3a')][_0x5b8c34[_0x4c50('0x37')]['split']('-')[0x0]],[_0x4c50('0x3b')]);logger['debug'](_0x4c50('0x95'),_0x5b8c34[_0x4c50('0x2e')],util[_0x4c50('0x2a')]({'id':this[_0x4c50('0x3a')][_0x5b8c34[_0x4c50('0x37')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x4c50('0x3a')][_0x5b8c34['channel']['split']('-')[0x0]][_0x4c50('0x4a')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x4c50('0x43')](_0x4c50('0x3d'),this[_0x4c50('0x3a')][_0x5b8c34[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]]['name']),_0x4c50('0x96'),{'id':this[_0x4c50('0x3a')][_0x5b8c34[_0x4c50('0x37')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x4c50('0x3a')][_0x5b8c34[_0x4c50('0x37')][_0x4c50('0x38')]('-')[0x0]][_0x4c50('0x4a')]});for(var _0x1d228f=0x0;_0x1d228f0x0?_0x13b8a2:0x0;this[_0xacb8('0x14')][_0x357736['queue']][_0xacb8('0x59')]=this[_0xacb8('0x14')][_0x357736[_0xacb8('0x6c')]][_0xacb8('0x59')]>_[_0xacb8('0x72')](_0x357736['loggedin'])?_[_0xacb8('0x72')](_0x357736['loggedin']):this[_0xacb8('0x14')][_0x357736[_0xacb8('0x6c')]][_0xacb8('0x59')];this[_0xacb8('0x74')](this[_0xacb8('0x14')][_0x357736[_0xacb8('0x6c')]],_0xacb8('0x16'));}logger[_0xacb8('0x48')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xacb8('0x3f')](this['voiceQueues'][_0x357736[_0xacb8('0x6c')]],{'showHidden':![],'depth':null}));ami[_0xacb8('0x46')](_0xacb8('0x75'),this['voiceQueues'][_0x357736['queue']]);}}}catch(_0xc22f1e){logger[_0xacb8('0x3c')](_0xacb8('0x76'),util['inspect'](_0xc22f1e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xacb8('0xe')][_0xacb8('0x77')]=function(_0x179f57){logger[_0xacb8('0x48')](_0xacb8('0x78'),util['inspect'](_0x179f57,{'showHidden':![],'depth':null}));this[_0xacb8('0x6a')]=!![];};VoiceQueueReport[_0xacb8('0xe')]['syncQueueCallerJoin']=function(_0x49a749){try{if(this[_0xacb8('0x65')](_0x49a749)){logger[_0xacb8('0x48')](_0xacb8('0x79'),_0x49a749[_0xacb8('0x4a')],util[_0xacb8('0x3f')](_0x49a749,{'showHidden':![],'depth':null}));if(_[_0xacb8('0x66')](this[_0xacb8('0x11')][_0x49a749['uniqueid']]))this[_0xacb8('0x11')][_0x49a749['uniqueid']]=[];if(_[_0xacb8('0x66')](this[_0xacb8('0x13')][_0x49a749['uniqueid']]))this[_0xacb8('0x13')][_0x49a749[_0xacb8('0x4a')]]={};var _0x1458d5=new QueueReport();_0x1458d5[_0xacb8('0x4d')]=_0x49a749[_0xacb8('0x6c')];_0x1458d5[_0xacb8('0x51')]=this[_0xacb8('0x14')][_0x1458d5['name']]&&this[_0xacb8('0x14')][_0x1458d5[_0xacb8('0x4d')]][_0xacb8('0x51')]?this[_0xacb8('0x14')][_0x1458d5[_0xacb8('0x4d')]][_0xacb8('0x51')]||_0xacb8('0x52'):'inbound';_0x1458d5[_0xacb8('0x6c')]=_0x49a749['queue'];_0x1458d5[_0xacb8('0x7a')]=moment()[_0xacb8('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1458d5[_0xacb8('0x7b')]=_0x49a749['position'];_0x1458d5[_0xacb8('0x7c')]=_0x49a749['count'];_0x1458d5[_0xacb8('0x4a')]=_0x49a749['uniqueid'];_0x1458d5['routealias']=this[_0xacb8('0x13')][_0x49a749['uniqueid']][_0xacb8('0x7d')];logger[_0xacb8('0x6e')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1458d5['name'],_0x1458d5[_0xacb8('0x51')]);_[_0xacb8('0x7e')](_0x1458d5,_['pick'](_0x49a749,_[_0xacb8('0x7f')](_0x1458d5)));this[_0xacb8('0x11')][_0x49a749['uniqueid']][_0xacb8('0x80')](_0x1458d5);this[_0xacb8('0x13')][_0x49a749[_0xacb8('0x4a')]]=_0x1458d5;this[_0xacb8('0x47')](_0x1458d5,_0xacb8('0x1a'));}}catch(_0x37e0da){logger[_0xacb8('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x49a749['uniqueid'],util['inspect'](_0x37e0da,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xacb8('0xe')][_0xacb8('0x1d')]=function(_0x22e2ef){try{if(this[_0xacb8('0x65')](_0x22e2ef)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x22e2ef['uniqueid'],util[_0xacb8('0x3f')](_0x22e2ef,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x22e2ef[_0xacb8('0x4a')]]){var _0x1dc7de=_[_0xacb8('0x81')](this[_0xacb8('0x11')][_0x22e2ef[_0xacb8('0x4a')]]);_0x1dc7de[_0xacb8('0x82')]=![];_0x1dc7de[_0xacb8('0x83')]=null;_0x1dc7de[_0xacb8('0x84')]=_0x22e2ef['holdtime'];_0x1dc7de[_0xacb8('0x85')]=_0x22e2ef[_0xacb8('0x85')];_0x1dc7de[_0xacb8('0x1c')]=!![];_0x1dc7de['queuecallerabandonAt']=moment()[_0xacb8('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1dc7de['queuecallerexitreason']=_0xacb8('0x86');_0x1dc7de[_0xacb8('0x87')]=null;logger[_0xacb8('0x6e')](_0xacb8('0x88'),_0x1dc7de['name'],_0x1dc7de[_0xacb8('0x51')]);this[_0xacb8('0x13')][_0x22e2ef[_0xacb8('0x4a')]]=_0x1dc7de;this['emitVoiceQueueChannelRemove'](_0x1dc7de,_0xacb8('0x1c'));}}}catch(_0x122983){logger[_0xacb8('0x3c')](_0xacb8('0x89'),_0x22e2ef['uniqueid'],util[_0xacb8('0x3f')](_0x122983,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xacb8('0xe')][_0xacb8('0x1f')]=function(_0x134054){try{if(this[_0xacb8('0x65')](_0x134054)){logger['debug'](_0xacb8('0x8a'),_0x134054[_0xacb8('0x4a')],util['inspect'](_0x134054,{'showHidden':![],'depth':null}));if(this[_0xacb8('0x11')][_0x134054[_0xacb8('0x4a')]]){var _0x5b479f=_[_0xacb8('0x81')](this[_0xacb8('0x11')][_0x134054[_0xacb8('0x4a')]]);_0x5b479f['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5b479f['connectedlinenum']=_0x134054['connectedlinenum'];_0x5b479f[_0xacb8('0x8b')]=_0x134054[_0xacb8('0x8b')];logger[_0xacb8('0x6e')](_0xacb8('0x8c'),_0x5b479f[_0xacb8('0x4d')],_0x5b479f[_0xacb8('0x51')],_0x134054['connectedlinenum'],_0x134054['connectedlinename']);this[_0xacb8('0x13')][_0x134054[_0xacb8('0x4a')]]=_0x5b479f;this['emitVoiceQueueChannelSave'](_0x5b479f,'queuecallerleave');}}}catch(_0x4c4d69){logger[_0xacb8('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x134054[_0xacb8('0x4a')],util['inspect'](_0x4c4d69,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xacb8('0xe')][_0xacb8('0x23')]=function(_0x2fe9f2){try{if(this[_0xacb8('0x65')](_0x2fe9f2)){logger[_0xacb8('0x48')](_0xacb8('0x8d'),_0x2fe9f2[_0xacb8('0x4a')],util[_0xacb8('0x3f')](_0x2fe9f2,{'showHidden':![],'depth':null}));if(this[_0xacb8('0x11')][_0x2fe9f2['uniqueid']]){var _0x19a665=_['last'](this[_0xacb8('0x11')][_0x2fe9f2[_0xacb8('0x4a')]]);_0x19a665[_0xacb8('0x82')]=!![];_0x19a665[_0xacb8('0x8e')]=_0xacb8('0x8f');logger[_0xacb8('0x6e')](_0xacb8('0x90'),_0x19a665[_0xacb8('0x4d')],_0x19a665['type']);}}}catch(_0x5e5d55){logger[_0xacb8('0x3c')](_0xacb8('0x8d'),_0x2fe9f2[_0xacb8('0x4a')],util[_0xacb8('0x3f')](_0x5e5d55,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xacb8('0xe')]['syncAgentComplete']=function(_0x203a94){try{if(this[_0xacb8('0x65')](_0x203a94)){logger[_0xacb8('0x48')]('[%s][voiceQueueReport][agentcomplete]',_0x203a94['uniqueid'],util[_0xacb8('0x3f')](_0x203a94,{'showHidden':![],'depth':null}));if(this[_0xacb8('0x11')][_0x203a94[_0xacb8('0x4a')]]){var _0x15a875=_[_0xacb8('0x81')](this[_0xacb8('0x11')][_0x203a94[_0xacb8('0x4a')]]);_0x15a875['queuecallerabandon']=![];_0x15a875[_0xacb8('0x91')]=null;_0x15a875['assigned']=!![];_0x15a875['lastAssignedTo']=_0x203a94[_0xacb8('0x92')];_0x15a875[_0xacb8('0x84')]=_0x203a94[_0xacb8('0x84')];_0x15a875['queuecallercomplete']=!![];_0x15a875[_0xacb8('0x93')]=![];_0x15a875['queuecallerexitAt']=null;if(!_0x15a875[_0xacb8('0x94')]){if(_0x203a94[_0xacb8('0x95')]=='transfer'){_0x15a875[_0xacb8('0x8e')]=_0xacb8('0x96');logger[_0xacb8('0x6e')](_0xacb8('0x97'),_0x15a875[_0xacb8('0x4d')],_0x15a875[_0xacb8('0x51')]);}else{if(_[_0xacb8('0x98')](_0x203a94[_0xacb8('0x99')][_0xacb8('0x9a')](),_0xacb8('0x9b'))){if(this['queueReports'][_0x203a94[_0xacb8('0x9c')]]){var _0x316c60=_['last'](this[_0xacb8('0x11')][_0x203a94[_0xacb8('0x9c')]]);_0x316c60[_0xacb8('0x82')]=![];_0x316c60['queuecallerexit']=!![];_0x316c60[_0xacb8('0x9d')]=moment(_0x15a875['queuecallerjoinAt'])[_0xacb8('0x9e')](_0x203a94[_0xacb8('0x84')],_0xacb8('0x9f'))[_0xacb8('0x4b')](_0xacb8('0xa0'));_0x316c60[_0xacb8('0x8e')]=_0xacb8('0xa1');_0x316c60[_0xacb8('0x94')]=!![];_0x316c60[_0xacb8('0xa2')]=_0xacb8('0xa3');_0x316c60['transferexten']=_0x203a94[_0xacb8('0xa4')];_0x316c60[_0xacb8('0xa5')]=_0x203a94[_0xacb8('0x4a')];logger[_0xacb8('0x6e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x316c60[_0xacb8('0x4d')],_0x316c60['type']);var _0x3d2285=this[_0xacb8('0x11')][_0x203a94['linkedid']];this[_0xacb8('0x11')][_0x203a94[_0xacb8('0x9c')]]=this['queueReports'][_0x203a94[_0xacb8('0x4a')]];this['queueReports'][_0x203a94[_0xacb8('0x4a')]]=_0x3d2285;}}else{_0x15a875['queuecallerexitreason']=_0xacb8('0xa6')+_0x203a94[_0xacb8('0x95')][_0xacb8('0xa7')]();logger[_0xacb8('0x6e')](_0xacb8('0xa8'),_0x15a875[_0xacb8('0x4d')],_0x15a875[_0xacb8('0x51')],_0x15a875['queuecallerexitreason']);}}}this[_0xacb8('0x13')][_0x203a94[_0xacb8('0x4a')]]=_0x15a875;this[_0xacb8('0x44')](_0x15a875,_0xacb8('0x20'));}}}catch(_0x3342b1){logger[_0xacb8('0x3c')](_0xacb8('0xa9'),_0x203a94[_0xacb8('0x4a')],util[_0xacb8('0x3f')](_0x3342b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xacb8('0xe')]['syncVarSet']=function(_0x312537){try{if(this['isNotNull'](_0x312537)){logger['debug'](_0xacb8('0xaa'),_0x312537[_0xacb8('0x4a')],util[_0xacb8('0x3f')](_0x312537,{'showHidden':![],'depth':null}));this[_0xacb8('0xab')](_0x312537[_0xacb8('0x4a')],_['keys'](_0x312537[_0xacb8('0xac')])[0x0],_0x312537[_0xacb8('0xad')]);if(this[_0xacb8('0x11')][_0x312537[_0xacb8('0x4a')]]){var _0x3732a6=_[_0xacb8('0x81')](this[_0xacb8('0x11')][_0x312537[_0xacb8('0x4a')]]);if(_0x3732a6){if(this['isNotNull'](_0x312537[_0xacb8('0xac')])&&this[_0xacb8('0x65')](_0x312537[_0xacb8('0xac')][_0xacb8('0xae')])){switch(_0x312537[_0xacb8('0xad')]){case _0xacb8('0xaf'):_0x3732a6[_0xacb8('0x93')]=![];_0x3732a6['queuecallerexitAt']=null;break;case _0xacb8('0xb0'):_0x3732a6['lastevent']=_0xacb8('0xb1');_0x3732a6['queuecallerexit']=!![];_0x3732a6[_0xacb8('0x9d')]=moment()['format'](_0xacb8('0xa0'));_0x3732a6['queuecallerleaveAt']=moment()['format'](_0xacb8('0xa0'));logger[_0xacb8('0x48')](_0xacb8('0xb2'),_0x312537[_0xacb8('0x4a')],util[_0xacb8('0x3f')](_0x3732a6,{'showHidden':![],'depth':null}));ami[_0xacb8('0x46')](_0xacb8('0xb3'),_0x3732a6);break;default:_0x3732a6['queuecallerexit']=!![];_0x3732a6[_0xacb8('0x9d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3732a6[_0xacb8('0xb4')]=moment()[_0xacb8('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3732a6[_0xacb8('0x1c')]=![];_0x3732a6[_0xacb8('0x91')]=null;_0x3732a6['queuecallerexitreason']=_0x312537['value'];this[_0xacb8('0x13')][_0x312537[_0xacb8('0x4a')]]=_0x3732a6;this[_0xacb8('0x44')](_0x3732a6,_0xacb8('0x24'));}else if(this['isNotNull'](_0x312537[_0xacb8('0xac')])&&this[_0xacb8('0x65')](_0x312537[_0xacb8('0xac')]['queueposition'])){if(!_0x3732a6[_0xacb8('0x1c')]){_0x3732a6[_0xacb8('0x93')]=!![];_0x3732a6[_0xacb8('0x9d')]=moment()[_0xacb8('0x4b')](_0xacb8('0xa0'));_0x3732a6[_0xacb8('0x8e')]=_0xacb8('0xb5');_0x3732a6['queuecallerleaveAt']=moment()[_0xacb8('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xacb8('0x13')][_0x312537[_0xacb8('0x4a')]]=_0x3732a6;}}logger['info'](_0xacb8('0xb6'),_0x312537[_0xacb8('0x4a')],_0x3732a6[_0xacb8('0x4d')],_0x3732a6[_0xacb8('0x51')],_[_0xacb8('0x7f')](_0x312537[_0xacb8('0xac')])[0x0],_0x312537['value']);_0x3732a6[_0xacb8('0x40')]=this[_0xacb8('0x40')][_0x312537['uniqueid']];}}}}catch(_0x3867e8){logger[_0xacb8('0x3c')](_0xacb8('0xaa'),_0x312537[_0xacb8('0x4a')],util[_0xacb8('0x3f')](_0x3867e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xacb8('0xe')]['addVariable']=function(_0xc52608,_0xd30f2c,_0x41217e){var _0x541151=[_0xacb8('0xb7'),_0xacb8('0xb8'),_0xacb8('0xb9'),_0xacb8('0xba'),'rtpaudioqosloss',_0xacb8('0xbb'),_0xacb8('0xbc'),_0xacb8('0xbd'),_0xacb8('0xbe'),'sipuri',_0xacb8('0xbf'),'bridgepvtcallid',_0xacb8('0xc0'),_0xacb8('0xc1'),_0xacb8('0xc2'),_0xacb8('0xc3'),_0xacb8('0x92'),_0xacb8('0xc4'),'memberrealtime'];if(!_['isNil'](_0xd30f2c)&&!_[_0xacb8('0xc5')](_0x541151,_0xd30f2c)){if(_['isUndefined'](this[_0xacb8('0x40')][_0xc52608])){this[_0xacb8('0x40')][_0xc52608]={};}this[_0xacb8('0x40')][_0xc52608][_0xd30f2c]=_0x41217e;}};VoiceQueueReport[_0xacb8('0xe')][_0xacb8('0xc6')]=function(_0x57bcb3){try{if(this[_0xacb8('0x65')](_0x57bcb3)){logger[_0xacb8('0x48')](_0xacb8('0xc7'),_0x57bcb3['uniqueid'],util[_0xacb8('0x3f')](_0x57bcb3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x57bcb3['uniqueid']]){for(var _0x26b207=0x0,_0x276035={};_0x26b2070x0?_0x3d75e0:0x0;this[_0x642f('0x13')][_0x4f6cb6['queue']]['talking']=this['voiceQueues'][_0x4f6cb6[_0x642f('0x69')]][_0x642f('0x30')]>_[_0x642f('0x6e')](_0x4f6cb6[_0x642f('0x70')])?_[_0x642f('0x6e')](_0x4f6cb6[_0x642f('0x70')]):this[_0x642f('0x13')][_0x4f6cb6[_0x642f('0x69')]][_0x642f('0x30')];this[_0x642f('0x72')](this['voiceQueues'][_0x4f6cb6[_0x642f('0x69')]],_0x642f('0x67'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x642f('0x40')](this[_0x642f('0x13')][_0x4f6cb6['queue']],{'showHidden':![],'depth':null}));ami[_0x642f('0x47')](_0x642f('0x73'),this[_0x642f('0x13')][_0x4f6cb6['queue']]);}}}catch(_0x5a33c4){logger['error'](_0x642f('0x68'),util['inspect'](_0x5a33c4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x642f('0xd')]['syncQueueSummaryComplete']=function(_0x1f79e2){logger[_0x642f('0x50')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x1f79e2,{'showHidden':![],'depth':null}));this[_0x642f('0x14')]=!![];};VoiceQueueReport['prototype'][_0x642f('0x1c')]=function(_0x2cbec8){try{if(this['isNotNull'](_0x2cbec8)){logger[_0x642f('0x50')](_0x642f('0x74'),_0x2cbec8[_0x642f('0x4b')],util[_0x642f('0x40')](_0x2cbec8,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x2cbec8[_0x642f('0x4b')]]))this[_0x642f('0x10')][_0x2cbec8[_0x642f('0x4b')]]=[];if(_[_0x642f('0x75')](this[_0x642f('0x35')][_0x2cbec8[_0x642f('0x4b')]]))this['channels'][_0x2cbec8[_0x642f('0x4b')]]={};var _0x37e76e=new QueueReport();_0x37e76e[_0x642f('0x4e')]=_0x2cbec8[_0x642f('0x69')];_0x37e76e['type']=this[_0x642f('0x13')][_0x37e76e[_0x642f('0x4e')]]&&this['voiceQueues'][_0x37e76e[_0x642f('0x4e')]][_0x642f('0x5a')]?this['voiceQueues'][_0x37e76e['name']][_0x642f('0x5a')]||_0x642f('0x54'):_0x642f('0x54');_0x37e76e['queue']=_0x2cbec8[_0x642f('0x69')];_0x37e76e[_0x642f('0x76')]=moment()[_0x642f('0x4c')](_0x642f('0x77'));_0x37e76e['position']=_0x2cbec8[_0x642f('0x78')];_0x37e76e[_0x642f('0x79')]=_0x2cbec8[_0x642f('0x79')];_0x37e76e[_0x642f('0x4b')]=_0x2cbec8['uniqueid'];_0x37e76e[_0x642f('0x7a')]=this[_0x642f('0x35')][_0x2cbec8[_0x642f('0x4b')]][_0x642f('0x7a')];logger[_0x642f('0x7b')](_0x642f('0x7c'),_0x37e76e[_0x642f('0x4e')],_0x37e76e[_0x642f('0x5a')]);_[_0x642f('0x7d')](_0x37e76e,_[_0x642f('0x7e')](_0x2cbec8,_[_0x642f('0x7f')](_0x37e76e)));this[_0x642f('0x10')][_0x2cbec8[_0x642f('0x4b')]][_0x642f('0x80')](_0x37e76e);this[_0x642f('0x35')][_0x2cbec8['uniqueid']]=_0x37e76e;this['emitVoiceQueueChannelSave'](_0x37e76e,_0x642f('0x1b'));}}catch(_0x37f62f){logger[_0x642f('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2cbec8[_0x642f('0x4b')],util[_0x642f('0x40')](_0x37f62f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x642f('0x1e')]=function(_0x11ca18){try{if(this[_0x642f('0x63')](_0x11ca18)){logger[_0x642f('0x50')](_0x642f('0x81'),_0x11ca18['uniqueid'],util[_0x642f('0x40')](_0x11ca18,{'showHidden':![],'depth':null}));if(this[_0x642f('0x10')][_0x11ca18[_0x642f('0x4b')]]){var _0x26df7d=_[_0x642f('0x82')](this[_0x642f('0x10')][_0x11ca18[_0x642f('0x4b')]]);_0x26df7d[_0x642f('0x83')]=![];_0x26df7d['queuecallercompleteAt']=null;_0x26df7d[_0x642f('0x84')]=_0x11ca18[_0x642f('0x84')];_0x26df7d[_0x642f('0x85')]=_0x11ca18[_0x642f('0x85')];_0x26df7d['queuecallerabandon']=!![];_0x26df7d[_0x642f('0x86')]=moment()[_0x642f('0x4c')](_0x642f('0x77'));_0x26df7d[_0x642f('0x87')]='ABANDONED';_0x26df7d[_0x642f('0x88')]=null;logger[_0x642f('0x7b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x26df7d['name'],_0x26df7d['type']);this[_0x642f('0x35')][_0x11ca18[_0x642f('0x4b')]]=_0x26df7d;this[_0x642f('0x45')](_0x26df7d,_0x642f('0x1d'));}}}catch(_0x222e35){logger[_0x642f('0x3f')](_0x642f('0x81'),_0x11ca18['uniqueid'],util[_0x642f('0x40')](_0x222e35,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x642f('0xd')]['syncQueueCallerLeave']=function(_0xfc48fa){try{if(this[_0x642f('0x63')](_0xfc48fa)){logger[_0x642f('0x50')](_0x642f('0x89'),_0xfc48fa[_0x642f('0x4b')],util[_0x642f('0x40')](_0xfc48fa,{'showHidden':![],'depth':null}));if(this[_0x642f('0x10')][_0xfc48fa['uniqueid']]){var _0x30f4b7=_[_0x642f('0x82')](this[_0x642f('0x10')][_0xfc48fa['uniqueid']]);_0x30f4b7[_0x642f('0x8a')]=moment()[_0x642f('0x4c')](_0x642f('0x77'));_0x30f4b7[_0x642f('0x8b')]=_0xfc48fa[_0x642f('0x8b')];_0x30f4b7[_0x642f('0x8c')]=_0xfc48fa['connectedlinename'];logger[_0x642f('0x7b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x30f4b7['name'],_0x30f4b7['type'],_0xfc48fa['connectedlinenum'],_0xfc48fa[_0x642f('0x8c')]);this['channels'][_0xfc48fa[_0x642f('0x4b')]]=_0x30f4b7;this[_0x642f('0x48')](_0x30f4b7,_0x642f('0x1f'));}}}catch(_0x1d81b4){logger[_0x642f('0x3f')](_0x642f('0x89'),_0xfc48fa[_0x642f('0x4b')],util[_0x642f('0x40')](_0x1d81b4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x642f('0xd')][_0x642f('0x8d')]=function(_0x9939ae){try{if(this[_0x642f('0x63')](_0x9939ae)){logger[_0x642f('0x50')](_0x642f('0x8e'),_0x9939ae[_0x642f('0x4b')],util[_0x642f('0x40')](_0x9939ae,{'showHidden':![],'depth':null}));if(this[_0x642f('0x10')][_0x9939ae[_0x642f('0x4b')]]){var _0x3a07a9=_[_0x642f('0x82')](this['queueReports'][_0x9939ae['uniqueid']]);_0x3a07a9[_0x642f('0x83')]=!![];_0x3a07a9[_0x642f('0x87')]=_0x642f('0x8f');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3a07a9['name'],_0x3a07a9[_0x642f('0x5a')]);}}}catch(_0x51a5ae){logger[_0x642f('0x3f')](_0x642f('0x8e'),_0x9939ae[_0x642f('0x4b')],util['inspect'](_0x51a5ae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x642f('0xd')]['syncAgentComplete']=function(_0x4a3378){try{if(this[_0x642f('0x63')](_0x4a3378)){logger['debug'](_0x642f('0x90'),_0x4a3378['uniqueid'],util[_0x642f('0x40')](_0x4a3378,{'showHidden':![],'depth':null}));if(this[_0x642f('0x10')][_0x4a3378[_0x642f('0x4b')]]){var _0xd3322e=_['last'](this['queueReports'][_0x4a3378[_0x642f('0x4b')]]);_0xd3322e['queuecallerabandon']=![];_0xd3322e['queuecallerabandonAt']=null;_0xd3322e[_0x642f('0x91')]=!![];_0xd3322e[_0x642f('0x88')]=_0x4a3378[_0x642f('0x92')];_0xd3322e['holdtime']=_0x4a3378[_0x642f('0x84')];_0xd3322e['queuecallercomplete']=!![];_0xd3322e[_0x642f('0x93')]=![];_0xd3322e['queuecallerexitAt']=null;if(!_0xd3322e['transfer']){if(_0x4a3378[_0x642f('0x94')]==_0x642f('0x95')){_0xd3322e[_0x642f('0x87')]=_0x642f('0x96');logger[_0x642f('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0xd3322e[_0x642f('0x4e')],_0xd3322e[_0x642f('0x5a')]);}else{if(_[_0x642f('0x97')](_0x4a3378[_0x642f('0x3b')]['toLowerCase'](),_0x642f('0x98'))){if(this[_0x642f('0x10')][_0x4a3378[_0x642f('0x99')]]){var _0x5a9252=_['last'](this[_0x642f('0x10')][_0x4a3378['linkedid']]);_0x5a9252[_0x642f('0x83')]=![];_0x5a9252['queuecallerexit']=!![];_0x5a9252[_0x642f('0x9a')]=moment(_0xd3322e[_0x642f('0x76')])['add'](_0x4a3378['holdtime'],_0x642f('0x9b'))[_0x642f('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a9252['queuecallerexitreason']='FORWARDTRANSFER';_0x5a9252[_0x642f('0x95')]=!![];_0x5a9252[_0x642f('0x9c')]=_0x642f('0x9d');_0x5a9252[_0x642f('0x9e')]=_0x4a3378['destexten'];_0x5a9252[_0x642f('0x9f')]=_0x4a3378['uniqueid'];logger['info'](_0x642f('0xa0'),_0x5a9252[_0x642f('0x4e')],_0x5a9252[_0x642f('0x5a')]);var _0x51ddd0=this[_0x642f('0x10')][_0x4a3378[_0x642f('0x99')]];this['queueReports'][_0x4a3378[_0x642f('0x99')]]=this[_0x642f('0x10')][_0x4a3378[_0x642f('0x4b')]];this[_0x642f('0x10')][_0x4a3378[_0x642f('0x4b')]]=_0x51ddd0;}}else{_0xd3322e['queuecallerexitreason']=_0x642f('0xa1')+_0x4a3378['reason'][_0x642f('0xa2')]();logger[_0x642f('0x7b')](_0x642f('0xa3'),_0xd3322e[_0x642f('0x4e')],_0xd3322e[_0x642f('0x5a')],_0xd3322e[_0x642f('0x87')]);}}}this['channels'][_0x4a3378[_0x642f('0x4b')]]=_0xd3322e;this['emitVoiceQueueChannelRemove'](_0xd3322e,'agentcomplete');}}}catch(_0x3f288b){logger[_0x642f('0x3f')](_0x642f('0x90'),_0x4a3378[_0x642f('0x4b')],util['inspect'](_0x3f288b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x642f('0xd')][_0x642f('0xa4')]=function(_0x2e98d3){try{if(this['isNotNull'](_0x2e98d3)){logger[_0x642f('0x50')](_0x642f('0xa5'),_0x2e98d3['uniqueid'],util['inspect'](_0x2e98d3,{'showHidden':![],'depth':null}));this[_0x642f('0xa6')](_0x2e98d3[_0x642f('0x4b')],_[_0x642f('0x7f')](_0x2e98d3[_0x642f('0xa7')])[0x0],_0x2e98d3[_0x642f('0xa8')]);if(this[_0x642f('0x10')][_0x2e98d3[_0x642f('0x4b')]]){var _0x3d7216=_['last'](this[_0x642f('0x10')][_0x2e98d3[_0x642f('0x4b')]]);if(_0x3d7216){if(this['isNotNull'](_0x2e98d3[_0x642f('0xa7')])&&this[_0x642f('0x63')](_0x2e98d3[_0x642f('0xa7')][_0x642f('0xa9')])){switch(_0x2e98d3[_0x642f('0xa8')]){case _0x642f('0xaa'):_0x3d7216[_0x642f('0x93')]=![];_0x3d7216[_0x642f('0x9a')]=null;break;case _0x642f('0xab'):_0x3d7216[_0x642f('0xac')]='timeout';_0x3d7216[_0x642f('0x93')]=!![];_0x3d7216['queuecallerexitAt']=moment()[_0x642f('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d7216[_0x642f('0x8a')]=moment()[_0x642f('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x642f('0x50')](_0x642f('0xad'),_0x2e98d3['uniqueid'],util[_0x642f('0x40')](_0x3d7216,{'showHidden':![],'depth':null}));ami[_0x642f('0x47')](_0x642f('0xae'),_0x3d7216);break;default:_0x3d7216['queuecallerexit']=!![];_0x3d7216[_0x642f('0x9a')]=moment()[_0x642f('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d7216[_0x642f('0x8a')]=moment()[_0x642f('0x4c')](_0x642f('0x77'));}_0x3d7216[_0x642f('0x1d')]=![];_0x3d7216[_0x642f('0x86')]=null;_0x3d7216['queuecallerexitreason']=_0x2e98d3[_0x642f('0xa8')];this[_0x642f('0x35')][_0x2e98d3['uniqueid']]=_0x3d7216;this['emitVoiceQueueChannelRemove'](_0x3d7216,'varset');}else if(this['isNotNull'](_0x2e98d3['variable'])&&this[_0x642f('0x63')](_0x2e98d3['variable'][_0x642f('0xaf')])){if(!_0x3d7216['queuecallerabandon']){_0x3d7216[_0x642f('0x93')]=!![];_0x3d7216[_0x642f('0x9a')]=moment()[_0x642f('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d7216[_0x642f('0x87')]='EXITWITHKEY';_0x3d7216[_0x642f('0x8a')]=moment()[_0x642f('0x4c')](_0x642f('0x77'));this['channels'][_0x2e98d3[_0x642f('0x4b')]]=_0x3d7216;}}logger['info'](_0x642f('0xb0'),_0x2e98d3[_0x642f('0x4b')],_0x3d7216[_0x642f('0x4e')],_0x3d7216[_0x642f('0x5a')],_[_0x642f('0x7f')](_0x2e98d3['variable'])[0x0],_0x2e98d3[_0x642f('0xa8')]);_0x3d7216[_0x642f('0x16')]=this[_0x642f('0x16')][_0x2e98d3['uniqueid']];}}}}catch(_0x34ada3){logger[_0x642f('0x3f')](_0x642f('0xa5'),_0x2e98d3['uniqueid'],util['inspect'](_0x34ada3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x642f('0xa6')]=function(_0x16a6eb,_0x54bc3b,_0x3fdf7a){var _0x48753c=['rtpaudioqos',_0x642f('0xb1'),_0x642f('0xb2'),'rtpaudioqosjitterbridged',_0x642f('0xb3'),_0x642f('0xb4'),_0x642f('0xb5'),'rtpaudioqosrttbridged',_0x642f('0xb6'),_0x642f('0xb7'),'bridgepeer',_0x642f('0xb8'),_0x642f('0xb9'),'memberdynamic',_0x642f('0xba'),_0x642f('0xbb'),_0x642f('0x92'),_0x642f('0xbc'),_0x642f('0xbd')];if(!_[_0x642f('0x38')](_0x54bc3b)&&!_[_0x642f('0xbe')](_0x48753c,_0x54bc3b)){if(_[_0x642f('0x75')](this[_0x642f('0x16')][_0x16a6eb])){this['variables'][_0x16a6eb]={};}this[_0x642f('0x16')][_0x16a6eb][_0x54bc3b]=_0x3fdf7a;}};VoiceQueueReport[_0x642f('0xd')][_0x642f('0x24')]=function(_0x51f545){try{if(this[_0x642f('0x63')](_0x51f545)){logger[_0x642f('0x50')]('[%s][voiceQueueReport][hangup]',_0x51f545[_0x642f('0x4b')],util['inspect'](_0x51f545,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x51f545[_0x642f('0x4b')]]){for(var _0x132cb2=0x0,_0x422fb8={};_0x132cb2=0x0?moment(_0x51fef3[_0xe850('0x16')])['diff'](_0x51fef3[_0xe850('0x17')],_0xe850('0x18')):null,'data1':'outbound','data2':_0x51fef3[_0xe850('0x12')],'data3':_0x51fef3['exten'],'data4':_0x51fef3[_0xe850('0x19')]||null,'role':_0xe850('0x10'),'internal':_0x51fef3['accountcode']?_['toNumber'](_0x51fef3[_0xe850('0x12')]):undefined,'uniqueid':_0x51fef3[_0xe850('0x13')]},'log':_0xe850('0x7')});}; \ No newline at end of file +var _0xa179=['diff','seconds','exten','queue','accountcode','uniqueid','voice','membername','endtime','starttime','outbound','agent','toNumber','moment','../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt'];(function(_0x4be6f4,_0x385b23){var _0x3e9098=function(_0x17ff9a){while(--_0x17ff9a){_0x4be6f4['push'](_0x4be6f4['shift']());}};_0x3e9098(++_0x385b23);}(_0xa179,0x8a));var _0x9a17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa179[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9a17('0x0'));var _=require('lodash');var util=require('util');var client=require(_0x9a17('0x1'));exports[_0x9a17('0x2')]=function(_0x2d520a){var _0x27b144=_0x2d520a[_0x9a17('0x3')]||_0x2d520a['queuecallerexitAt'];return client['Request'](_0x9a17('0x4'),{'body':{'channel':'voice','membername':_0x2d520a['lastAssignedTo'],'interface':_[_0x9a17('0x5')](_0x2d520a[_0x9a17('0x6')])?util[_0x9a17('0x7')](_0x9a17('0x8'),_0x2d520a[_0x9a17('0x9')]):_0x2d520a[_0x9a17('0x6')],'type':_0x9a17('0xa'),'enterAt':_0x2d520a[_0x9a17('0xb')],'exitAt':_0x27b144,'duration':moment(_0x27b144)[_0x9a17('0xc')](_0x2d520a['queuecallerleaveAt'],_0x9a17('0xd')),'data1':'inbound','data2':_0x2d520a['calleridnum'],'data3':_0x2d520a[_0x9a17('0xe')],'data4':null,'data5':_0x2d520a[_0x9a17('0xf')],'role':'agent','internal':_0x2d520a[_0x9a17('0x10')]?_['toNumber'](_0x2d520a[_0x9a17('0x10')]):undefined,'uniqueid':_0x2d520a[_0x9a17('0x11')]},'log':_0x9a17('0x4')});};exports['voiceDialReport']=function(_0xe0d423){return client['Request'](_0x9a17('0x4'),{'body':{'channel':_0x9a17('0x12'),'membername':_0xe0d423[_0x9a17('0x13')],'interface':_0xe0d423[_0x9a17('0x6')],'type':_0x9a17('0xa'),'enterAt':_0xe0d423['starttime'],'exitAt':_0xe0d423[_0x9a17('0x14')],'duration':moment(_0xe0d423[_0x9a17('0x14')])['diff'](_0xe0d423[_0x9a17('0x15')],_0x9a17('0xd'))>=0x0?moment(_0xe0d423[_0x9a17('0x14')])['diff'](_0xe0d423[_0x9a17('0x15')],'seconds'):null,'data1':_0x9a17('0x16'),'data2':_0xe0d423[_0x9a17('0x10')],'data3':_0xe0d423['exten'],'data4':_0xe0d423['dialstring']||null,'role':_0x9a17('0x17'),'internal':_0xe0d423[_0x9a17('0x10')]?_[_0x9a17('0x18')](_0xe0d423[_0x9a17('0x10')]):undefined,'uniqueid':_0xe0d423[_0x9a17('0x11')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2712904..c7ec163 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 _0xe348=['GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x1c87d7,_0x3f3fcb){var _0x23107e=function(_0x30139f){while(--_0x30139f){_0x1c87d7['push'](_0x1c87d7['shift']());}};_0x23107e(++_0x3f3fcb);}(_0xe348,0x137));var _0x8e34=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xe348[_0x32b542];return _0x554d54;};'use strict';var client=require(_0x8e34('0x0'));exports[_0x8e34('0x1')]=function(){return client['Request'](_0x8e34('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8e34('0x3')]},'log':_0x8e34('0x4')});}; \ No newline at end of file +var _0x6505=['stopRecordingOnTransfer','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x222e2d,_0x4cff0c){var _0x3dbbac=function(_0x13ccbb){while(--_0x13ccbb){_0x222e2d['push'](_0x222e2d['shift']());}};_0x3dbbac(++_0x4cff0c);}(_0x6505,0x8c));var _0x5650=function(_0x3ef527,_0x497b1d){_0x3ef527=_0x3ef527-0x0;var _0xbf2e75=_0x6505[_0x3ef527];return _0xbf2e75;};'use strict';var client=require(_0x5650('0x0'));exports[_0x5650('0x1')]=function(){return client[_0x5650('0x2')](_0x5650('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5650('0x4')]},'log':_0x5650('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a18d290..6105062 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 _0x1fda=['html','../client','getTemplates','Request','name'];(function(_0x36d8d9,_0x17b58a){var _0x1ac3a2=function(_0x392196){while(--_0x392196){_0x36d8d9['push'](_0x36d8d9['shift']());}};_0x1ac3a2(++_0x17b58a);}(_0x1fda,0x74));var _0xa1fd=function(_0x20b418,_0x5dd584){_0x20b418=_0x20b418-0x0;var _0x698bdc=_0x1fda[_0x20b418];return _0x698bdc;};'use strict';var client=require(_0xa1fd('0x0'));exports[_0xa1fd('0x1')]=function(_0x577d07){return function(_0x52c188){return client[_0xa1fd('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xa1fd('0x3'),_0xa1fd('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x3b99=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x3b99,0x161));var _0x93b9=function(_0x3a9ae8,_0x6fab6e){_0x3a9ae8=_0x3a9ae8-0x0;var _0x1ac58c=_0x3b99[_0x3a9ae8];return _0x1ac58c;};'use strict';var client=require(_0x93b9('0x0'));exports[_0x93b9('0x1')]=function(_0x33c48c){return function(_0x3751fe){return client[_0x93b9('0x2')](_0x93b9('0x3'),{'options':{'raw':!![],'attributes':['id',_0x93b9('0x4'),_0x93b9('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8dfd747..cca4936 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 _0x3149=['Action','data1','data2','data3','data4','data5','data6','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','value','operator'];(function(_0x18d40f,_0xdb3c13){var _0xd1300=function(_0x42e024){while(--_0x42e024){_0x18d40f['push'](_0x18d40f['shift']());}};_0xd1300(++_0xdb3c13);}(_0x3149,0x14b));var _0x9314=function(_0x45ea8c,_0x8190b7){_0x45ea8c=_0x45ea8c-0x0;var _0x2614f3=_0x3149[_0x45ea8c];return _0x2614f3;};'use strict';var client=require(_0x9314('0x0'));exports[_0x9314('0x1')]=function(_0x393397){return function(_0x2e52e5){return client[_0x9314('0x2')](_0x9314('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9314('0x4'),_0x9314('0x5')],'include':[{'model':_0x9314('0x6'),'as':_0x9314('0x7'),'attributes':['id',_0x9314('0x8'),'operator',_0x9314('0x9')]},{'model':_0x9314('0x6'),'as':'AnyConditions','attributes':['id','field',_0x9314('0xa'),'value']},{'model':_0x9314('0xb'),'as':'Actions','attributes':['id','action',_0x9314('0xc'),_0x9314('0xd'),_0x9314('0xe'),_0x9314('0xf'),_0x9314('0x10'),_0x9314('0x11'),'data7']}]},'log':_0x9314('0x3')});};}; \ No newline at end of file +var _0x606f=['../client','getTriggers','GetTrigger','name','channel','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data2','data3','data6','data7'];(function(_0x26185e,_0xa003bd){var _0x4d925b=function(_0x3d5f4f){while(--_0x3d5f4f){_0x26185e['push'](_0x26185e['shift']());}};_0x4d925b(++_0xa003bd);}(_0x606f,0x1b5));var _0xf606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x606f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf606('0x0'));exports[_0xf606('0x1')]=function(_0xf6b2af){return function(_0x5baadb){return client['Request'](_0xf606('0x2'),{'options':{'raw':![],'attributes':['id',_0xf606('0x3'),_0xf606('0x4'),'status'],'include':[{'model':_0xf606('0x5'),'as':_0xf606('0x6'),'attributes':['id','field',_0xf606('0x7'),_0xf606('0x8')]},{'model':_0xf606('0x5'),'as':_0xf606('0x9'),'attributes':['id',_0xf606('0xa'),_0xf606('0x7'),_0xf606('0x8')]},{'model':_0xf606('0xb'),'as':_0xf606('0xc'),'attributes':['id',_0xf606('0xd'),_0xf606('0xe'),_0xf606('0xf'),_0xf606('0x10'),'data4','data5',_0xf606('0x11'),_0xf606('0x12')]}]},'log':_0xf606('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index bdf0d08..8813021 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 _0xdc8c=['GetTrunk','../client','getTrunks','Request','name','defaultuser'];(function(_0x26ccb0,_0x6d551b){var _0x2a7d5f=function(_0x572533){while(--_0x572533){_0x26ccb0['push'](_0x26ccb0['shift']());}};_0x2a7d5f(++_0x6d551b);}(_0xdc8c,0xd9));var _0xcdc8=function(_0x5ecc1b,_0x537be5){_0x5ecc1b=_0x5ecc1b-0x0;var _0x3f9382=_0xdc8c[_0x5ecc1b];return _0x3f9382;};'use strict';var client=require(_0xcdc8('0x0'));exports[_0xcdc8('0x1')]=function(_0x58f444){return function(_0x5c1a2a){return client[_0xcdc8('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcdc8('0x3'),'registry',_0xcdc8('0x4')]},'log':_0xcdc8('0x5')});};}; \ No newline at end of file +var _0x23bb=['GetTrunk','../client','getTrunks','Request','name','defaultuser'];(function(_0x39c5fd,_0x375e45){var _0x420c3f=function(_0x4823f4){while(--_0x4823f4){_0x39c5fd['push'](_0x39c5fd['shift']());}};_0x420c3f(++_0x375e45);}(_0x23bb,0xc1));var _0xb23b=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x23bb[_0x120123];return _0x3bec4c;};'use strict';var client=require(_0xb23b('0x0'));exports[_0xb23b('0x1')]=function(_0x2f2f1a){return function(_0x385a98){return client[_0xb23b('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb23b('0x3'),'registry',_0xb23b('0x4')]},'log':_0xb23b('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e55fa29..d1a3243 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0xa5a04,_0x47952f){var _0xf2fb82=function(_0x3f91ff){while(--_0x3f91ff){_0xa5a04['push'](_0xa5a04['shift']());}};_0xf2fb82(++_0x47952f);}(_0x34e8,0x12c));var _0x834e=function(_0x433d53,_0x22da79){_0x433d53=_0x433d53-0x0;var _0x1968b9=_0x34e8[_0x433d53];return _0x1968b9;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f20a8cc..6d0a247 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 _0x68eb=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x13a212,_0x187979){var _0xf1e7b4=function(_0x286e8b){while(--_0x286e8b){_0x13a212['push'](_0x13a212['shift']());}};_0xf1e7b4(++_0x187979);}(_0x68eb,0x77));var _0xb68e=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0x68eb[_0x291d3f];return _0x242080;};'use strict';var client=require('../client');exports[_0xb68e('0x0')]=function(_0x5c4497){return client[_0xb68e('0x1')]('CreateVoiceAgentReport',{'body':_0x5c4497,'log':_0xb68e('0x2')});};exports[_0xb68e('0x3')]=function(_0x1ba968,_0x565c2b,_0x541b54){return client[_0xb68e('0x1')](_0xb68e('0x4'),{'body':_0x1ba968,'options':{'where':{'uniqueid':_0x565c2b,'interface':_0x541b54,'agentcomplete':!![]}},'log':_0xb68e('0x4')});}; \ No newline at end of file +var _0xb030=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x2e8349,_0x84c5ac){var _0x9c2cd5=function(_0x11e01f){while(--_0x11e01f){_0x2e8349['push'](_0x2e8349['shift']());}};_0x9c2cd5(++_0x84c5ac);}(_0xb030,0x84));var _0x0b03=function(_0x56dd58,_0xb1287d){_0x56dd58=_0x56dd58-0x0;var _0x103e75=_0xb030[_0x56dd58];return _0x103e75;};'use strict';var client=require(_0x0b03('0x0'));exports[_0x0b03('0x1')]=function(_0x5b6a76){return client[_0x0b03('0x2')]('CreateVoiceAgentReport',{'body':_0x5b6a76,'log':_0x0b03('0x3')});};exports['update']=function(_0x59a0d8,_0x425364,_0x7d7797){return client[_0x0b03('0x2')](_0x0b03('0x4'),{'body':_0x59a0d8,'options':{'where':{'uniqueid':_0x425364,'interface':_0x7d7797,'agentcomplete':!![]}},'log':_0x0b03('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2443ec0..7e00e11 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 _0x6bb4=['calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','format','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge'];(function(_0x53fac4,_0x374d42){var _0x1ab0fd=function(_0x4282e9){while(--_0x4282e9){_0x53fac4['push'](_0x53fac4['shift']());}};_0x1ab0fd(++_0x374d42);}(_0x6bb4,0x19d));var _0x46bb=function(_0x4a6704,_0x2a8683){_0x4a6704=_0x4a6704-0x0;var _0x487fcc=_0x6bb4[_0x4a6704];return _0x487fcc;};'use strict';var moment=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var _=require(_0x46bb('0x2'));var client=require(_0x46bb('0x3'));exports[_0x46bb('0x4')]=function(_0x3c0b71){return client['Request'](_0x46bb('0x5'),{'body':_[_0x46bb('0x6')](_0x3c0b71,{'source':_0x3c0b71[_0x46bb('0x7')],'destinationcontext':_0x3c0b71[_0x46bb('0x8')],'callerid':_0x3c0b71[_0x46bb('0x9')],'amaflags':_0x46bb('0xa')}),'log':_0x46bb('0x5')});};exports[_0x46bb('0xb')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x46bb('0xc')],'createdAt':{'$between':[moment()[_0x46bb('0xd')](_0x46bb('0xe'))['format'](_0x46bb('0xf')),moment()['endOf'](_0x46bb('0xe'))[_0x46bb('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x46bb('0x11'),'disposition',_0x46bb('0x12'),_0x46bb('0x13')]},'log':_0x46bb('0x14')});};}; \ No newline at end of file +var _0x1690=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x1690,0xc0));var _0x0169=function(_0x32b63b,_0x109f65){_0x32b63b=_0x32b63b-0x0;var _0x1bbfca=_0x1690[_0x32b63b];return _0x1bbfca;};'use strict';var moment=require(_0x0169('0x0'));var util=require(_0x0169('0x1'));var _=require(_0x0169('0x2'));var client=require(_0x0169('0x3'));exports[_0x0169('0x4')]=function(_0x3cb393){return client['Request'](_0x0169('0x5'),{'body':_[_0x0169('0x6')](_0x3cb393,{'source':_0x3cb393[_0x0169('0x7')],'destinationcontext':_0x3cb393[_0x0169('0x8')],'callerid':_0x3cb393['callerid'],'amaflags':_0x0169('0x9')}),'log':_0x0169('0x5')});};exports[_0x0169('0xa')]=function(){return function(){return client[_0x0169('0xb')](_0x0169('0xc'),{'options':{'where':{'type':[_0x0169('0xd')],'createdAt':{'$between':[moment()[_0x0169('0xe')]('day')[_0x0169('0xf')](_0x0169('0x10')),moment()[_0x0169('0x11')](_0x0169('0x12'))[_0x0169('0xf')](_0x0169('0x10'))]}},'attributes':[_0x0169('0x13'),'disposition',_0x0169('0x14'),_0x0169('0x15')]},'log':_0x0169('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 327a36c..ceb656c 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 _0x7dfb=['CreateVoiceDialReport','../client'];(function(_0x3fe720,_0x22664a){var _0x17c702=function(_0xf3ea7b){while(--_0xf3ea7b){_0x3fe720['push'](_0x3fe720['shift']());}};_0x17c702(++_0x22664a);}(_0x7dfb,0xa9));var _0xb7df=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x7dfb[_0x31cb5f];return _0x586042;};'use strict';var client=require(_0xb7df('0x0'));exports['create']=function(_0x1f3805){return client['Request'](_0xb7df('0x1'),{'body':_0x1f3805,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xf55b=['../client','create','Request','CreateVoiceDialReport'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0xf55b,0xb8));var _0xbf55=function(_0x4c2620,_0x27992c){_0x4c2620=_0x4c2620-0x0;var _0x23afc6=_0xf55b[_0x4c2620];return _0x23afc6;};'use strict';var client=require(_0xbf55('0x0'));exports[_0xbf55('0x1')]=function(_0x2b109b){return client[_0xbf55('0x2')]('CreateVoiceDialReport',{'body':_0x2b109b,'log':_0xbf55('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 50934c3..0ae4ced 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 _0x7af2=['exten','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x39a04c,_0x2b4002){var _0x580cb0=function(_0x138902){while(--_0x138902){_0x39a04c['push'](_0x39a04c['shift']());}};_0x580cb0(++_0x2b4002);}(_0x7af2,0x119));var _0x27af=function(_0x2c2fc6,_0x355d2b){_0x2c2fc6=_0x2c2fc6-0x0;var _0x16d14a=_0x7af2[_0x2c2fc6];return _0x16d14a;};'use strict';var client=require('../client');exports[_0x27af('0x0')]=function(){return function(){return client[_0x27af('0x1')](_0x27af('0x2'),{'options':{'raw':!![],'attributes':['id',_0x27af('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x27af('0x0')});};}; \ No newline at end of file +var _0xb84e=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x30e7c1,_0x5d63b8){var _0x18b293=function(_0x2d7469){while(--_0x2d7469){_0x30e7c1['push'](_0x30e7c1['shift']());}};_0x18b293(++_0x5d63b8);}(_0xb84e,0xbf));var _0xeb84=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb84e[_0x3b0731];return _0x4204d7;};'use strict';var client=require('../client');exports[_0xeb84('0x0')]=function(){return function(){return client[_0xeb84('0x1')](_0xeb84('0x2'),{'options':{'raw':!![],'attributes':['id',_0xeb84('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index e1495c2..4885631 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 _0x4ca4=['dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout'];(function(_0xdb46f3,_0x7126c0){var _0x5914b8=function(_0x32ba6b){while(--_0x32ba6b){_0xdb46f3['push'](_0xdb46f3['shift']());}};_0x5914b8(++_0x7126c0);}(_0x4ca4,0x100));var _0x44ca=function(_0x59cac4,_0x3ada9f){_0x59cac4=_0x59cac4-0x0;var _0x207520=_0x4ca4[_0x59cac4];return _0x207520;};'use strict';var client=require(_0x44ca('0x0'));exports[_0x44ca('0x1')]=function(){return function(){return client[_0x44ca('0x2')](_0x44ca('0x3'),{'options':{'raw':![],'attributes':['id',_0x44ca('0x4'),_0x44ca('0x5'),_0x44ca('0x6'),_0x44ca('0x7'),'monitor_format',_0x44ca('0x8'),_0x44ca('0x9'),_0x44ca('0xa'),_0x44ca('0xb'),_0x44ca('0xc'),_0x44ca('0xd'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x44ca('0xe'),_0x44ca('0xf'),'dialOriginateTimeout',_0x44ca('0x10'),'dialQueueTimeout','dialQueueProject',_0x44ca('0x11'),_0x44ca('0x12'),_0x44ca('0x13'),_0x44ca('0x14'),_0x44ca('0x15'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x44ca('0x16'),_0x44ca('0x17'),'dialPrefix','dialCheckDuplicateType',_0x44ca('0x18'),_0x44ca('0x19'),_0x44ca('0x1a'),_0x44ca('0x1b'),_0x44ca('0x1c'),_0x44ca('0x1d'),_0x44ca('0x1e'),_0x44ca('0x1f'),'dialAMDSilenceThreshold',_0x44ca('0x20'),_0x44ca('0x21'),'dialRecallMeTimeout',_0x44ca('0x22'),_0x44ca('0x23'),'dialAgiAfterHangupAgent',_0x44ca('0x24'),_0x44ca('0x25'),_0x44ca('0x26'),_0x44ca('0x27'),_0x44ca('0x28'),_0x44ca('0x29'),_0x44ca('0x2a'),_0x44ca('0x2b'),_0x44ca('0x2c'),'dialDropRetryFrequency',_0x44ca('0x2d'),_0x44ca('0x2e'),_0x44ca('0x2f'),_0x44ca('0x30'),'dialAgentRejectMaxRetry',_0x44ca('0x31'),'mandatoryDisposition',_0x44ca('0x32'),_0x44ca('0x33'),'dialPreviewAutoRecallMe'],'include':[{'model':_0x44ca('0x34'),'as':_0x44ca('0x34'),'attributes':['id',_0x44ca('0x4'),_0x44ca('0x35'),'active']},{'model':_0x44ca('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0x44ca('0x4')]},{'model':_0x44ca('0x34'),'as':'TrunkBackup','attributes':['id','name','callerid','active']},{'model':_0x44ca('0x37'),'as':_0x44ca('0x37'),'attributes':['id','name'],'include':[{'model':_0x44ca('0x37'),'as':_0x44ca('0x38'),'attributes':['id',_0x44ca('0x4'),_0x44ca('0x39')]}]}]},'log':_0x44ca('0x1')});};}; \ No newline at end of file +var _0x04cc=['dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x04cc,0x11a));var _0xc04c=function(_0x1181f3,_0xf81baa){_0x1181f3=_0x1181f3-0x0;var _0x37abb6=_0x04cc[_0x1181f3];return _0x37abb6;};'use strict';var client=require(_0xc04c('0x0'));exports[_0xc04c('0x1')]=function(){return function(){return client[_0xc04c('0x2')](_0xc04c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc04c('0x4'),'acwTimeout','autopause',_0xc04c('0x5'),_0xc04c('0x6'),_0xc04c('0x7'),_0xc04c('0x8'),_0xc04c('0x9'),_0xc04c('0xa'),_0xc04c('0xb'),'dialPredictiveOptimization',_0xc04c('0xc'),_0xc04c('0xd'),_0xc04c('0xe'),_0xc04c('0xf'),_0xc04c('0x10'),_0xc04c('0x11'),_0xc04c('0x12'),_0xc04c('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0xc04c('0x14'),_0xc04c('0x15'),_0xc04c('0x16'),_0xc04c('0x17'),_0xc04c('0x18'),_0xc04c('0x19'),_0xc04c('0x1a'),'dialPrefix','dialCheckDuplicateType',_0xc04c('0x1b'),'dialAMDInitialSilence',_0xc04c('0x1c'),_0xc04c('0x1d'),_0xc04c('0x1e'),_0xc04c('0x1f'),'dialAMDBetweenWordsSilence',_0xc04c('0x20'),_0xc04c('0x21'),_0xc04c('0x22'),_0xc04c('0x23'),'dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt',_0xc04c('0x24'),_0xc04c('0x25'),'dialQueueProject2',_0xc04c('0x5'),'strategy',_0xc04c('0x26'),_0xc04c('0x27'),'dialNoSuchNumberMaxRetry',_0xc04c('0x28'),_0xc04c('0x29'),_0xc04c('0x2a'),_0xc04c('0x2b'),_0xc04c('0x2c'),_0xc04c('0x2d'),_0xc04c('0x2e'),_0xc04c('0x2f'),_0xc04c('0x30'),_0xc04c('0x31'),_0xc04c('0x32'),'dialPredictiveIntervalMinThreshold',_0xc04c('0x33')],'include':[{'model':_0xc04c('0x34'),'as':_0xc04c('0x34'),'attributes':['id',_0xc04c('0x35'),_0xc04c('0x36'),_0xc04c('0x37')]},{'model':_0xc04c('0x38'),'as':_0xc04c('0x39'),'attributes':['id',_0xc04c('0x35')]},{'model':_0xc04c('0x34'),'as':'TrunkBackup','attributes':['id',_0xc04c('0x35'),'callerid',_0xc04c('0x37')]},{'model':_0xc04c('0x3a'),'as':_0xc04c('0x3a'),'attributes':['id',_0xc04c('0x35')],'include':[{'model':_0xc04c('0x3a'),'as':'Intervals','attributes':['id',_0xc04c('0x35'),_0xc04c('0x3b')]}]}]},'log':_0xc04c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 2789e8e..12a9aea 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(_0x476568,_0x1b8686){var _0x17e269=function(_0x1c9302){while(--_0x1c9302){_0x476568['push'](_0x476568['shift']());}};_0x17e269(++_0x1b8686);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x18dffd,_0x47963c){var _0x23f419=function(_0x3702ef){while(--_0x3702ef){_0x18dffd['push'](_0x18dffd['shift']());}};_0x23f419(++_0x47963c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 a62d4a4..e3e41d4 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 _0x2b64=['getVoiceQueueRtPauses','../client','GetVoiceQueueRtPauses'];(function(_0x1e3059,_0x5d008a){var _0x3e981a=function(_0x4f814a){while(--_0x4f814a){_0x1e3059['push'](_0x1e3059['shift']());}};_0x3e981a(++_0x5d008a);}(_0x2b64,0x136));var _0x42b6=function(_0x165430,_0x45cce0){_0x165430=_0x165430-0x0;var _0x7fc920=_0x2b64[_0x165430];return _0x7fc920;};'use strict';var client=require(_0x42b6('0x0'));exports['getVoiceQueueRtPauses']=function(_0x29bb78){return function(){return client['Request'](_0x42b6('0x1'),{'options':{'where':{'VoiceQueueId':_0x29bb78,'paused':!![]},'raw':!![]},'log':_0x42b6('0x2')});};}; \ No newline at end of file +var _0x8f91=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0xfde968,_0x3f9dfc){var _0x4038bd=function(_0x3fac38){while(--_0x3fac38){_0xfde968['push'](_0xfde968['shift']());}};_0x4038bd(++_0x3f9dfc);}(_0x8f91,0x1e8));var _0x18f9=function(_0x31c638,_0x189036){_0x31c638=_0x31c638-0x0;var _0x50a81e=_0x8f91[_0x31c638];return _0x50a81e;};'use strict';var client=require(_0x18f9('0x0'));exports[_0x18f9('0x1')]=function(_0x1165ce){return function(){return client['Request'](_0x18f9('0x2'),{'options':{'where':{'VoiceQueueId':_0x1165ce,'paused':!![]},'raw':!![]},'log':_0x18f9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4d7f8bd..53a7936 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x1a5a13,_0x17d5c3){var _0x25c1b2=function(_0x1a68e4){while(--_0x1a68e4){_0x1a5a13['push'](_0x1a5a13['shift']());}};_0x25c1b2(++_0x17d5c3);}(_0x7a54,0x106));var _0x47a5=function(_0xa8961f,_0x1e3298){_0xa8961f=_0xa8961f-0x0;var _0x30875c=_0x7a54[_0xa8961f];return _0x30875c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2c1b31,_0x43dacf){var _0x425fed=function(_0x7dcf0c){while(--_0x7dcf0c){_0x2c1b31['push'](_0x2c1b31['shift']());}};_0x425fed(++_0x43dacf);}(_0x7a54,0x106));var _0x47a5=function(_0x2fea1d,_0x3bb886){_0x2fea1d=_0x2fea1d-0x0;var _0x3b0f4b=_0x7a54[_0x2fea1d];return _0x3b0f4b;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index f1f6d03..925c31b 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 _0xc9f2=['transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','isexternal','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x282ef,_0x2fd66f){var _0x982112=function(_0xe98a6){while(--_0xe98a6){_0x282ef['push'](_0x282ef['shift']());}};_0x982112(++_0x2fd66f);}(_0xc9f2,0x6a));var _0x2c9f=function(_0xc8f2,_0x3dc9d5){_0xc8f2=_0xc8f2-0x0;var _0x3391fd=_0xc9f2[_0xc8f2];return _0x3391fd;};'use strict';var client=require(_0x2c9f('0x0'));exports[_0x2c9f('0x1')]={};exports[_0x2c9f('0x2')]=function(_0x39e5af){return client[_0x2c9f('0x3')](_0x2c9f('0x4'),{'body':{'result':_0x39e5af['result'],'transfererchannel':_0x39e5af[_0x2c9f('0x5')],'transferercalleridnum':_0x39e5af[_0x2c9f('0x6')],'transferercalleridname':_0x39e5af['transferercalleridname'],'transfererconnectedlinenum':_0x39e5af[_0x2c9f('0x7')],'transfererconnectedlinename':_0x39e5af[_0x2c9f('0x8')],'transfereraccountcode':_0x39e5af[_0x2c9f('0x9')],'transferercontext':_0x39e5af[_0x2c9f('0xa')],'transfererexten':_0x39e5af['transfererexten'],'transfererlinkedid':_0x39e5af['transfererlinkedid'],'transfereechannel':_0x39e5af[_0x2c9f('0xb')],'transfereecalleridnum':_0x39e5af['transfereecalleridnum'],'transfereecalleridname':_0x39e5af['transfereecalleridname'],'transfereeconnectedlinenum':_0x39e5af[_0x2c9f('0xc')],'transfereeconnectedlinename':_0x39e5af[_0x2c9f('0xd')],'transfereeaccountcode':_0x39e5af[_0x2c9f('0xe')],'transfereecontext':_0x39e5af[_0x2c9f('0xf')],'transfereeexten':_0x39e5af['transfereeexten'],'transfereelinkedid':_0x39e5af['transfereelinkedid'],'isexternal':_0x39e5af[_0x2c9f('0x10')],'context':_0x39e5af['context'],'extension':_0x39e5af['extension'],'type':_0x2c9f('0x11')},'log':'CreateVoiceTransferReport'});};exports[_0x2c9f('0x12')]=function(_0x28c9b2){return client['Request'](_0x2c9f('0x4'),{'body':{'result':_0x28c9b2[_0x2c9f('0x13')],'transfererchannel':_0x28c9b2[_0x2c9f('0x14')],'transferercalleridnum':_0x28c9b2[_0x2c9f('0x15')],'transferercalleridname':_0x28c9b2[_0x2c9f('0x16')],'transfererconnectedlinenum':_0x28c9b2[_0x2c9f('0x17')],'transfererconnectedlinename':_0x28c9b2[_0x2c9f('0x18')],'transfereraccountcode':_0x28c9b2['origtransfereraccountcode'],'transferercontext':_0x28c9b2[_0x2c9f('0x19')],'transfererexten':_0x28c9b2[_0x2c9f('0x1a')],'transfererlinkedid':_0x28c9b2[_0x2c9f('0x1b')],'transfereechannel':_0x28c9b2[_0x2c9f('0x1c')],'transfereecalleridnum':_0x28c9b2[_0x2c9f('0x1d')],'transfereecalleridname':_0x28c9b2[_0x2c9f('0x1e')],'transfereeconnectedlinenum':_0x28c9b2[_0x2c9f('0x1f')],'transfereeconnectedlinename':_0x28c9b2['transfertargetconnectedlinename'],'transfereeaccountcode':_0x28c9b2['transfertargetaccountcode'],'transfereecontext':_0x28c9b2[_0x2c9f('0x20')],'transfereeexten':_0x28c9b2[_0x2c9f('0x21')],'transfereelinkedid':_0x28c9b2[_0x2c9f('0x22')],'isexternal':_0x28c9b2[_0x2c9f('0x10')],'context':_0x28c9b2[_0x2c9f('0x23')],'extension':_0x28c9b2['origtransfererexten'],'type':_0x2c9f('0x24')},'log':_0x2c9f('0x4')});}; \ No newline at end of file +var _0xe07b=['transfereeexten','transfereelinkedid','context','extension','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0xd2e00c,_0x218b36){var _0x5e7688=function(_0x29b51a){while(--_0x29b51a){_0xd2e00c['push'](_0xd2e00c['shift']());}};_0x5e7688(++_0x218b36);}(_0xe07b,0x164));var _0xbe07=function(_0x29dadd,_0x26b6e0){_0x29dadd=_0x29dadd-0x0;var _0x12e802=_0xe07b[_0x29dadd];return _0x12e802;};'use strict';var client=require('../client');exports[_0xbe07('0x0')]={};exports[_0xbe07('0x1')]=function(_0x4b759d){return client[_0xbe07('0x2')](_0xbe07('0x3'),{'body':{'result':_0x4b759d['result'],'transfererchannel':_0x4b759d[_0xbe07('0x4')],'transferercalleridnum':_0x4b759d[_0xbe07('0x5')],'transferercalleridname':_0x4b759d[_0xbe07('0x6')],'transfererconnectedlinenum':_0x4b759d['transfererconnectedlinenum'],'transfererconnectedlinename':_0x4b759d['transfererconnectedlinename'],'transfereraccountcode':_0x4b759d['transfereraccountcode'],'transferercontext':_0x4b759d[_0xbe07('0x7')],'transfererexten':_0x4b759d[_0xbe07('0x8')],'transfererlinkedid':_0x4b759d[_0xbe07('0x9')],'transfereechannel':_0x4b759d['transfereechannel'],'transfereecalleridnum':_0x4b759d[_0xbe07('0xa')],'transfereecalleridname':_0x4b759d['transfereecalleridname'],'transfereeconnectedlinenum':_0x4b759d[_0xbe07('0xb')],'transfereeconnectedlinename':_0x4b759d[_0xbe07('0xc')],'transfereeaccountcode':_0x4b759d[_0xbe07('0xd')],'transfereecontext':_0x4b759d['transfereecontext'],'transfereeexten':_0x4b759d[_0xbe07('0xe')],'transfereelinkedid':_0x4b759d[_0xbe07('0xf')],'isexternal':_0x4b759d['isexternal'],'context':_0x4b759d[_0xbe07('0x10')],'extension':_0x4b759d[_0xbe07('0x11')],'type':'blind'},'log':_0xbe07('0x3')});};exports[_0xbe07('0x12')]=function(_0xf1d6c5){return client[_0xbe07('0x2')](_0xbe07('0x3'),{'body':{'result':_0xf1d6c5[_0xbe07('0x13')],'transfererchannel':_0xf1d6c5[_0xbe07('0x14')],'transferercalleridnum':_0xf1d6c5[_0xbe07('0x15')],'transferercalleridname':_0xf1d6c5[_0xbe07('0x16')],'transfererconnectedlinenum':_0xf1d6c5['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xf1d6c5[_0xbe07('0x17')],'transfereraccountcode':_0xf1d6c5[_0xbe07('0x18')],'transferercontext':_0xf1d6c5[_0xbe07('0x19')],'transfererexten':_0xf1d6c5[_0xbe07('0x1a')],'transfererlinkedid':_0xf1d6c5[_0xbe07('0x1b')],'transfereechannel':_0xf1d6c5['transfertargetchannel'],'transfereecalleridnum':_0xf1d6c5[_0xbe07('0x1c')],'transfereecalleridname':_0xf1d6c5[_0xbe07('0x1d')],'transfereeconnectedlinenum':_0xf1d6c5['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xf1d6c5[_0xbe07('0x1e')],'transfereeaccountcode':_0xf1d6c5[_0xbe07('0x1f')],'transfereecontext':_0xf1d6c5[_0xbe07('0x20')],'transfereeexten':_0xf1d6c5[_0xbe07('0x21')],'transfereelinkedid':_0xf1d6c5['transfertargetlinkedid'],'isexternal':_0xf1d6c5[_0xbe07('0x22')],'context':_0xf1d6c5['origtransferercontext'],'extension':_0xf1d6c5[_0xbe07('0x23')],'type':_0xbe07('0x24')},'log':_0xbe07('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ecc13eb..0656727 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 _0x83d0=['%s.%s','filename','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec','status','uniqueid','MixMonitor\x20Success','StopMixMonitor','destinationchannel','wav','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../properties','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','username','ami\x20disconnected','join','pick','keys','action','Action','then','message','catch','asterisk','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','isConnected','voicechannel','map','channel','format'];(function(_0x5b0592,_0x4fcc0c){var _0x47e842=function(_0x137900){while(--_0x137900){_0x5b0592['push'](_0x5b0592['shift']());}};_0x47e842(++_0x4fcc0c);}(_0x83d0,0xb7));var _0x083d=function(_0x44a99a,_0x35ae67){_0x44a99a=_0x44a99a-0x0;var _0x500d57=_0x83d0[_0x44a99a];return _0x500d57;};'use strict';var _=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var jayson=require(_0x083d('0x2'));var schema=require(_0x083d('0x3'));var BPromise=require(_0x083d('0x4'));var moment=require(_0x083d('0x5'));var config=require('../../../config/environment');var properties=require(_0x083d('0x6'));var ami=require('../ami');exports['listen']=function(_0x404d77,_0x143ec8,_0x3c4b8c){return new BPromise(function(_0x2e75e8,_0x472c6b){var _0x52a3e7={'QueuePause':function(_0x4ec2e7){return new Promise(function(_0xddbf58,_0x32fa2c){var _0x3000d7=util['format'](_0x083d('0x7'),_0x083d('0x8'),_0x4ec2e7[_0x083d('0x9')]);if(_0x404d77[_0x083d('0xa')]&&_0x404d77['timers'][_0x3000d7]&&_0x404d77[_0x083d('0xa')][_0x3000d7]['timer']){_0x404d77[_0x083d('0xa')][_0x3000d7][_0x083d('0xb')]();}if(_0x404d77['agents'][_0x3000d7]){_0x404d77[_0x083d('0xc')][_0x3000d7][_0x083d('0xd')]({'statePause':_0x4ec2e7[_0x083d('0xe')]?!![]:![]});}_0xddbf58({'code':0xc8,'message':_0x083d('0xf')});});},'Reload':function(_0x3dfe4a){var _0x59fd41=this;return new Promise(function(_0xeb0ac2,_0x2266b2){if(ami['isConnected']()==![]){return _0x2266b2(_0x59fd41[_0x083d('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x083d('0x11')],_0x083d('0x12')][_0x083d('0x13')]('\x20')));}_0x3dfe4a=_[_0x083d('0x14')](_0x3dfe4a,_[_0x083d('0x15')](properties['module']));_0x3dfe4a[_0x083d('0x16')]='Reload';return ami[_0x083d('0x17')](_0x3dfe4a)[_0x083d('0x18')](function(_0x24708d){_0xeb0ac2({'code':0xc8,'message':_0x24708d[_0x083d('0x19')]});})[_0x083d('0x1a')](function(_0x63c0b6){_0x2266b2(_0x59fd41[_0x083d('0x10')](0x1f5,_0x63c0b6[_0x083d('0x19')]));});});},'Command':function(_0x160afb){var _0x2cb79c=this;return new Promise(function(_0x3ae260,_0xb8a16f){if(ami['isConnected']()==![]){return _0xb8a16f(_0x2cb79c[_0x083d('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x083d('0x1b')][_0x083d('0x11')],'ami\x20disconnected'][_0x083d('0x13')]('\x20')));}_0x160afb=_['pick'](_0x160afb,'command');_0x160afb['action']=_0x083d('0x1c');return ami[_0x083d('0x17')](_0x160afb)[_0x083d('0x18')](function(_0x2669b6){_0x3ae260({'code':0xc8,'message':_0x2669b6[_0x083d('0x1d')]});})[_0x083d('0x1a')](function(_0x5d8397){_0xb8a16f(_0x2cb79c[_0x083d('0x10')](0x1f5,_0x5d8397[_0x083d('0x19')]));});});},'VoiceQueues':function(_0x5e6e43){return new Promise(function(_0x3a0ce2,_0x38ca23){var _0x33d32a=[];for(var _0x3117af in _0x404d77[_0x083d('0x1e')]){if(_0x404d77[_0x083d('0x1e')][_0x083d('0x1f')](_0x3117af)){var _0x3923ff=_0x404d77['voiceQueues'][_0x3117af];var _0x6bccbd={'id':_0x3923ff['id'],'name':_0x3923ff['name'],'strategy':_0x3923ff[_0x083d('0x20')],'answered':_0x3923ff[_0x083d('0x21')],'available':_0x3923ff[_0x083d('0x22')],'loggedIn':_0x3923ff[_0x083d('0x23')],'pTalking':_0x3923ff[_0x083d('0x24')],'sumBillable':_0x3923ff[_0x083d('0x25')],'sumDuration':_0x3923ff[_0x083d('0x26')],'sumHoldTime':_0x3923ff[_0x083d('0x27')]||0x0,'talking':_0x3923ff[_0x083d('0x28')],'total':_0x3923ff[_0x083d('0x29')],'type':_0x3923ff[_0x083d('0x2a')],'unmanaged':_0x3923ff[_0x083d('0x2b')],'abandoned':_0x3923ff[_0x083d('0x2c')],'waiting':_0x3923ff[_0x083d('0x2d')],'loggedInDb':_0x3923ff[_0x083d('0x2e')]};if(_0x3923ff['type']===_0x083d('0x2f')){_0x6bccbd[_0x083d('0x30')]=_0x3923ff['dialActive'];_0x6bccbd['dialMethod']=_0x3923ff[_0x083d('0x31')];_0x6bccbd['dialOriginateCallerIdName']=_0x3923ff[_0x083d('0x32')];_0x6bccbd['dialOriginateCallerIdNumber']=_0x3923ff[_0x083d('0x33')];_0x6bccbd['dialOriginateTimeout']=_0x3923ff[_0x083d('0x34')];_0x6bccbd[_0x083d('0x35')]=_0x3923ff[_0x083d('0x35')];_0x6bccbd['temp']=_0x3923ff['temp'];_0x6bccbd[_0x083d('0x36')]=_0x3923ff['outboundAnswerAgiCallsDay'];_0x6bccbd[_0x083d('0x37')]=_0x3923ff[_0x083d('0x37')];_0x6bccbd[_0x083d('0x38')]=_0x3923ff[_0x083d('0x38')];_0x6bccbd['outboundBusyCallsDay']=_0x3923ff[_0x083d('0x39')];_0x6bccbd[_0x083d('0x3a')]=_0x3923ff[_0x083d('0x3a')];_0x6bccbd[_0x083d('0x3b')]=_0x3923ff['outboundDropCallsDayACS'];_0x6bccbd[_0x083d('0x3c')]=_0x3923ff[_0x083d('0x3c')];_0x6bccbd[_0x083d('0x3d')]=_0x3923ff[_0x083d('0x3d')];_0x6bccbd['outboundNoAnswerCallsDay']=_0x3923ff['outboundNoAnswerCallsDay'];_0x6bccbd[_0x083d('0x3e')]=_0x3923ff[_0x083d('0x3e')];_0x6bccbd[_0x083d('0x3f')]=_0x3923ff[_0x083d('0x3f')];_0x6bccbd[_0x083d('0x40')]=_0x3923ff['outboundReCallsDay'];_0x6bccbd[_0x083d('0x41')]=_0x3923ff[_0x083d('0x41')];_0x6bccbd['outboundUnknownCallsDay']=_0x3923ff[_0x083d('0x42')];_0x6bccbd['predictiveIntervalAnsweredCalls']=_0x3923ff['predictiveIntervalAnsweredCalls'];_0x6bccbd[_0x083d('0x43')]=_0x3923ff[_0x083d('0x43')];_0x6bccbd['predictiveIntervalAvgTalktime']=_0x3923ff[_0x083d('0x44')];_0x6bccbd[_0x083d('0x45')]=_0x3923ff[_0x083d('0x45')];_0x6bccbd['predictiveIntervalDroppedCallsTimeout']=_0x3923ff['predictiveIntervalDroppedCallsTimeout'];_0x6bccbd['predictiveIntervalErlangCalls']=_0x3923ff['predictiveIntervalErlangCalls'];_0x6bccbd[_0x083d('0x46')]=_0x3923ff[_0x083d('0x46')];_0x6bccbd[_0x083d('0x47')]=_0x3923ff[_0x083d('0x47')];_0x6bccbd['predictiveIntervalMultiplicativeFactor']=_0x3923ff[_0x083d('0x48')];_0x6bccbd[_0x083d('0x49')]=_0x3923ff['predictiveIntervalPauses'];_0x6bccbd[_0x083d('0x4a')]=_0x3923ff[_0x083d('0x4a')];_0x6bccbd[_0x083d('0x4b')]=_0x3923ff[_0x083d('0x4b')];_0x6bccbd[_0x083d('0x19')]=_0x3923ff[_0x083d('0x19')];_0x6bccbd[_0x083d('0x4c')]=_0x3923ff[_0x083d('0x4c')];_0x6bccbd['erlangCalls']=_0x3923ff[_0x083d('0x4d')];_0x6bccbd[_0x083d('0x4e')]=_0x3923ff[_0x083d('0x4e')];_0x6bccbd[_0x083d('0x4f')]=_0x3923ff[_0x083d('0x4f')];_0x6bccbd[_0x083d('0x50')]=_0x3923ff[_0x083d('0x50')];_0x6bccbd['startPredictive']=_0x3923ff[_0x083d('0x51')];_0x6bccbd[_0x083d('0x52')]=_0x3923ff['startProgressive'];}if(_0x3923ff[_0x083d('0x53')]){_0x6bccbd[_0x083d('0x53')]={'id':_0x3923ff[_0x083d('0x53')]['id'],'name':_0x3923ff[_0x083d('0x53')][_0x083d('0x9')],'active':_0x3923ff['Trunk'][_0x083d('0x54')],'callerid':_0x3923ff[_0x083d('0x53')][_0x083d('0x55')]};}if(_0x3923ff[_0x083d('0x56')]){_0x6bccbd[_0x083d('0x56')]={'id':_0x3923ff['Interval']['id'],'name':_0x3923ff[_0x083d('0x56')][_0x083d('0x9')]};}_0x33d32a[_0x083d('0x57')](_0x6bccbd);}}_0x3a0ce2({'count':_0x33d32a[_0x083d('0x58')],'rows':_0x33d32a});});},'UpdateVoiceQueue':function(_0x1d45a1){return new Promise(function(_0x15232f,_0x592d1a){var _0xd1f130=_[_0x083d('0x59')](_0x404d77[_0x083d('0x1e')],{'id':parseInt(_0x1d45a1['id'])});var _0x1bdafc=_[_0x083d('0x5a')](_0x1d45a1,['id']);if(_0xd1f130){for(var _0x1faad5 in _0x1bdafc){if(typeof _0x1bdafc[_0x1faad5]!==_0x083d('0x5b')&&typeof _0xd1f130[_0x1faad5]!=='undefined'){_0xd1f130[_0x1faad5]=_0x1bdafc[_0x1faad5];}}_0x15232f(_0xd1f130);}else{_0x592d1a();}});},'VoiceChannels':function(_0x515b43){return new Promise(function(_0x5c3258,_0x1dee34){var _0x509b72=_[_0x083d('0x5c')](_0x404d77[_0x083d('0x5d')]);_0x5c3258({'count':_0x509b72[_0x083d('0x58')],'rows':_0x509b72});});},'VoiceChannelMixMonitor':function(_0x1bc090){var _0x525dd9=this;return new Promise(function(_0x117601,_0x410fb7){if(ami[_0x083d('0x5e')]()==![]){return _0x410fb7(_0x525dd9[_0x083d('0x10')](0x1f4,[config[_0x083d('0x1b')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x083d('0x13')]('\x20')));}var _0x34ed6c=schema(properties[_0x083d('0x5f')])[_0x083d('0x3')](_0x1bc090);if(_0x34ed6c[_0x083d('0x58')]>0x0){return _0x410fb7(_0x525dd9[_0x083d('0x10')](0x1f4,_[_0x083d('0x60')](_0x34ed6c,_0x083d('0x19'))[_0x083d('0x13')](',\x20')));}var _0x5a8620=_['find'](_0x404d77[_0x083d('0x5d')],{'uniqueid':_0x1bc090['uniqueid']});if(_0x5a8620&&_0x5a8620[_0x083d('0x61')]){var _0x2dd4f5=util[_0x083d('0x62')](_0x083d('0x63'),_0x1bc090[_0x083d('0x64')]||_0x1bc090['uniqueid'],_0x1bc090[_0x083d('0x62')]||'wav');return ami['Action']({'action':_0x083d('0x65'),'channel':_0x5a8620[_0x083d('0x61')],'file':_0x2dd4f5,'options':_0x083d('0x66')})[_0x083d('0x18')](function(_0x10db3e){var _0x2d26c4=_[_0x083d('0x59')](_0x5a8620['monitors'],{'filename':_0x083d('0x67')+_0x2dd4f5[_0x083d('0x68')]()});if(_[_0x083d('0x69')](_0x2d26c4)){_0x5a8620[_0x083d('0x6a')][_0x083d('0x57')]({'filename':_0x083d('0x67')+_0x2dd4f5[_0x083d('0x68')](),'createdAt':moment()[_0x083d('0x62')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x10db3e[_0x083d('0x6b')],'status':_0x083d('0x6c')});}else{_0x2d26c4[_0x083d('0x6b')]=_0x10db3e[_0x083d('0x6b')];_0x2d26c4[_0x083d('0x6d')]=_0x083d('0x6c');}_0x117601({'code':0xc8,'message':[_0x1bc090[_0x083d('0x6e')],_0x083d('0x6f'),_0x10db3e[_0x083d('0x6b')]][_0x083d('0x13')]('\x20'),'mixmonitorid':_0x10db3e[_0x083d('0x6b')]});})[_0x083d('0x1a')](function(_0x475ac6){_0x410fb7(_0x525dd9['error'](0x1f5,[_0x1bc090['uniqueid'],_0x475ac6[_0x083d('0x19')][_0x083d('0x68')]()][_0x083d('0x13')]('\x20')));});}else{return _0x410fb7(_0x525dd9[_0x083d('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2ea876){var _0x14918f=this;return new Promise(function(_0x3aa5dc,_0x3c305e){if(ami[_0x083d('0x5e')]()==![]){return _0x3c305e(_0x14918f['error'](0x1f4,[config['asterisk']['ip'],config[_0x083d('0x1b')][_0x083d('0x11')],_0x083d('0x12')]['join']('\x20')));}var _0x39ca60=schema(properties[_0x083d('0x5f')])['validate'](_0x2ea876);if(_0x39ca60[_0x083d('0x58')]>0x0){return _0x3c305e(_0x14918f[_0x083d('0x10')](0x1f4,_['map'](_0x39ca60,_0x083d('0x19'))[_0x083d('0x13')](',\x20')));}var _0x533dbc=_[_0x083d('0x59')](_0x404d77[_0x083d('0x5d')],{'uniqueid':_0x2ea876['uniqueid']});if(_0x533dbc){return BPromise['resolve']()[_0x083d('0x18')](function(){if(_0x533dbc[_0x083d('0x61')]){return ami[_0x083d('0x17')]({'action':_0x083d('0x70'),'channel':_0x533dbc['channel'],'mixmonitorid':_0x2ea876[_0x083d('0x6b')]})[_0x083d('0x1a')](function(_0x33c209){});}})['then'](function(){if(_0x533dbc[_0x083d('0x71')]){return ami[_0x083d('0x17')]({'action':_0x083d('0x70'),'channel':_0x533dbc[_0x083d('0x71')],'mixmonitorid':_0x2ea876['mixmonitorid']})['catch'](function(_0xd6e7d9){});}})[_0x083d('0x18')](function(_0x5acf5d){var _0x20f921=_[_0x083d('0x59')](_0x533dbc[_0x083d('0x6a')],{'mixmonitorid':_0x2ea876[_0x083d('0x6b')]});if(_0x20f921){_0x20f921[_0x083d('0x6d')]='stop';}})[_0x083d('0x18')](function(){var _0x3bec08=util[_0x083d('0x62')](_0x083d('0x63'),_0x2ea876[_0x083d('0x64')]||_0x2ea876[_0x083d('0x6e')],_0x2ea876[_0x083d('0x62')]||_0x083d('0x72'));var _0x4e4543=_[_0x083d('0x59')](_0x533dbc[_0x083d('0x6a')],{'filename':_0x083d('0x67')+_0x3bec08['toLowerCase']()});if(_0x4e4543){_0x4e4543['status']=_0x083d('0x73');}})[_0x083d('0x18')](function(){_0x3aa5dc({'code':0xc8,'message':[_0x2ea876[_0x083d('0x6e')],_0x083d('0x74')]['join']('\x20')});})[_0x083d('0x1a')](function(_0x5b116b){_0x3c305e(_0x14918f['error'](0x1f5,[_0x2ea876[_0x083d('0x6e')],_0x5b116b[_0x083d('0x19')][_0x083d('0x68')]()][_0x083d('0x13')]('\x20')));});}else{return _0x3c305e(_0x14918f[_0x083d('0x10')](0x1f5,_0x083d('0x75')));}});},'VoiceQueuesChannels':function(_0xa2afc){return new Promise(function(_0x135171,_0xca6924){var _0x2fdb74=_[_0x083d('0x5c')](_0x404d77['queueChannels']);_0x135171({'count':_0x2fdb74[_0x083d('0x58')],'rows':_0x2fdb74});});},'VoiceQueuesChannel':function(_0x565080){var _0x5ea764=this;return new Promise(function(_0x413a23,_0x18c0b6){var _0x3afabf=schema(properties[_0x083d('0x76')])['validate'](_0x565080);if(_0x3afabf['length']>0x0){return _0x18c0b6(_0x5ea764[_0x083d('0x10')](0x1f4,_[_0x083d('0x60')](_0x3afabf,_0x083d('0x19'))['join'](',\x20')));}var _0x27c6dc=_[_0x083d('0x59')](_0x404d77['queueChannels'],{'uniqueid':_0x565080[_0x083d('0x6e')]});if(_0x27c6dc){_0x413a23(_0x27c6dc);}else{return _0x18c0b6(_0x5ea764[_0x083d('0x10')](0x1f5,_0x083d('0x75')));}});},'VoiceQueuesChannelHangup':function(_0x2c9fb5){var _0x36605d=this;return new Promise(function(_0x3a9f3f,_0x5359f0){if(ami[_0x083d('0x5e')]()==![]){return _0x5359f0(_0x36605d['error'](0x1f4,[config[_0x083d('0x1b')]['ip'],config['asterisk']['username'],_0x083d('0x12')]['join']('\x20')));}var _0x1d4add=schema(properties[_0x083d('0x77')])[_0x083d('0x3')](_0x2c9fb5);if(_0x1d4add[_0x083d('0x58')]>0x0){return _0x5359f0(_0x36605d['error'](0x1f4,_[_0x083d('0x60')](_0x1d4add,_0x083d('0x19'))[_0x083d('0x13')](',\x20')));}var _0x18c422=_[_0x083d('0x59')](_0x404d77[_0x083d('0x78')],{'uniqueid':_0x2c9fb5['uniqueid']});if(_0x18c422&&_0x18c422[_0x083d('0x61')]){return ami[_0x083d('0x17')]({'action':_0x083d('0x79'),'channel':_0x18c422['channel']})[_0x083d('0x18')](function(_0x13f487){_0x3a9f3f({'code':0xc8,'message':[_0x2c9fb5[_0x083d('0x6e')],_0x13f487[_0x083d('0x19')][_0x083d('0x68')]()][_0x083d('0x13')]('\x20')});})['catch'](function(_0x24b593){_0x5359f0(_0x36605d[_0x083d('0x10')](0x1f5,[_0x2c9fb5['uniqueid'],_0x24b593[_0x083d('0x19')][_0x083d('0x68')]()][_0x083d('0x13')]('\x20')));});}else{return _0x5359f0(_0x36605d['error'](0x1f5,_0x083d('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x3ce6bf){var _0x5c3e46=this;return new Promise(function(_0x460ae3,_0x4d52e0){if(ami[_0x083d('0x5e')]()==![]){return _0x4d52e0(_0x5c3e46[_0x083d('0x10')](0x1f4,[config[_0x083d('0x1b')]['ip'],config[_0x083d('0x1b')]['username'],_0x083d('0x12')]['join']('\x20')));}var _0x3f75a4=schema(properties[_0x083d('0x7a')])['validate'](_0x3ce6bf);if(_0x3f75a4[_0x083d('0x58')]>0x0){return _0x4d52e0(_0x5c3e46[_0x083d('0x10')](0x1f4,_[_0x083d('0x60')](_0x3f75a4,_0x083d('0x19'))['join'](',\x20')));}var _0x4a9f1e=_['find'](_0x404d77[_0x083d('0x78')],{'uniqueid':_0x3ce6bf['uniqueid']});if(_0x4a9f1e&&_0x4a9f1e[_0x083d('0x61')]){return ami['Action']({'action':_0x083d('0x7b'),'channel':_0x4a9f1e[_0x083d('0x61')],'exten':_0x3ce6bf[_0x083d('0x7c')],'context':_0x3ce6bf[_0x083d('0x7d')]||_0x4a9f1e[_0x083d('0x7d')],'priority':0x1})[_0x083d('0x18')](function(_0x2b2562){_0x460ae3({'code':0xc8,'message':[_0x3ce6bf[_0x083d('0x6e')],_0x2b2562['message'][_0x083d('0x68')]()][_0x083d('0x13')]('\x20')});})['catch'](function(_0x1e0cae){_0x4d52e0(_0x5c3e46[_0x083d('0x10')](0x1f5,[_0x3ce6bf[_0x083d('0x6e')],_0x1e0cae[_0x083d('0x19')][_0x083d('0x68')]()][_0x083d('0x13')]('\x20')));});}else{return _0x4d52e0(_0x5c3e46['error'](0x1f5,_0x083d('0x75')));}});},'Agents':function(_0x19259b){return new Promise(function(_0x5120a1,_0x55f34a){var _0x28ff6b=_[_0x083d('0x5c')](_0x404d77[_0x083d('0xc')]);_0x5120a1({'count':_0x28ff6b[_0x083d('0x58')],'rows':_0x28ff6b});});},'Telephones':function(_0x4889aa){return new Promise(function(_0x214a98,_0x23c8cd){var _0x2acf74=_[_0x083d('0x5c')](_0x404d77['telephones']);_0x214a98({'count':_0x2acf74['length'],'rows':_0x2acf74});});},'Trunks':function(_0x586a14){return new Promise(function(_0x5d9253,_0x3cae5c){var _0x12cf61=_[_0x083d('0x5c')](_0x404d77[_0x083d('0x7e')]);_0x5d9253({'count':_0x12cf61[_0x083d('0x58')],'rows':_0x12cf61});});},'OutboundChannels':function(_0x12f8dd){return new Promise(function(_0x181a7a,_0x17cf6d){var _0x5164ea=_['values'](_0x404d77[_0x083d('0x7f')]);_0x181a7a({'count':_0x5164ea[_0x083d('0x58')],'rows':_0x5164ea});});},'Outbound':function(_0x28aa94){return new Promise(function(_0x26f7ec,_0x279355){_0x26f7ec(_0x404d77[_0x083d('0x2f')]);});},'Campaigns':function(_0x4feb9d){return new Promise(function(_0x21a44e,_0xedd308){var _0x1ad23d=_[_0x083d('0x5c')](_0x404d77[_0x083d('0x80')]);_0x21a44e({'count':_0x1ad23d[_0x083d('0x58')],'rows':_0x1ad23d});});},'VoiceQueuesPreview':function(_0x1e75d9){var _0x356fef=this;return new Promise(function(_0x1966af,_0x381299){_0x143ec8[_0x083d('0x81')](_0x1e75d9['id'])['then'](function(_0x4ae132){_0x1966af({'code':0xc8,'message':_0x4ae132[_0x083d('0x19')]});})['catch'](function(_0x2afcd9){_0x381299(_0x356fef[_0x083d('0x10')](0x1f4,_0x2afcd9[_0x083d('0x19')]));});});},'EventManager':function(_0x310c32){var _0x517b26=this;return new Promise(function(_0x573ac7,_0x5ac7ae){if(!_0x310c32['event']){return _0x5ac7ae(_0x517b26[_0x083d('0x10')](0x1f4,_0x083d('0x82')));}ami[_0x083d('0x83')](_0x083d('0x84')+_0x310c32[_0x083d('0x85')],_0x310c32[_0x083d('0x19')]);_0x573ac7({'code':0xc8,'message':_0x310c32});});},'FaxAccounts':function(_0x1e4508){return new Promise(function(_0x5efbe6,_0x1f12e6){var _0x54cee3=_[_0x083d('0x5c')](_0x404d77[_0x083d('0x86')]);_0x5efbe6({'count':_0x54cee3[_0x083d('0x58')],'rows':_0x54cee3});});},'SendFax':function(_0x40cd0){var _0x5e227b=this;return new Promise(function(_0x5260a1,_0x1cbed9){_0x3c4b8c[_0x083d('0x87')](_0x40cd0)[_0x083d('0x18')](function(_0x90f46){_0x5260a1({'code':0xc8,'message':_0x90f46['message']});})[_0x083d('0x1a')](function(_0x1bb396){_0x1cbed9(_0x5e227b[_0x083d('0x10')](0x1f4,_0x1bb396['message']));});});},'CheckAfterSend':function(_0x518628){var _0x2a862d=this;return new Promise(function(_0x302332,_0x37fccc){_0x3c4b8c[_0x083d('0x88')](_0x518628)['then'](function(_0x4d37f9){_0x302332({'code':0xc8,'message':_0x4d37f9[_0x083d('0x19')]});})[_0x083d('0x1a')](function(_0x41fb77){_0x37fccc(_0x2a862d[_0x083d('0x10')](0x1f4,_0x41fb77[_0x083d('0x19')]));});});}};var _0x135509=jayson['server'](_0x52a3e7)['http']();_0x135509['on'](_0x083d('0x10'),function(_0x281096){return _0x472c6b(_0x281096);});_0x135509[_0x083d('0x89')](0x232a,_0x083d('0x8a'),function(){console[_0x083d('0x8b')](_0x083d('0x8c'),0x232a);return _0x2e75e8('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xb091=['outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','filename','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','isConnected','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','agents','telephones','outboundChannels','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','../../../config/environment','listen','format','%s/%s','SIP','name','timers','updateAcw','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','command','content','catch','voiceQueues','hasOwnProperty','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xb091,0x16e));var _0x1b09=function(_0x562cf8,_0x2d96b4){_0x562cf8=_0x562cf8-0x0;var _0x46ff17=_0xb091[_0x562cf8];return _0x46ff17;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var jayson=require(_0x1b09('0x1'));var schema=require(_0x1b09('0x2'));var BPromise=require(_0x1b09('0x3'));var moment=require('moment');var config=require(_0x1b09('0x4'));var properties=require('../properties');var ami=require('../ami');exports[_0x1b09('0x5')]=function(_0x24d22c,_0x4e252c,_0xda8caa){return new BPromise(function(_0x5fa348,_0x2bf4f6){var _0x5ce726={'QueuePause':function(_0x142c33){return new Promise(function(_0x8c26a5,_0x2f359f){var _0x328815=util[_0x1b09('0x6')](_0x1b09('0x7'),_0x1b09('0x8'),_0x142c33[_0x1b09('0x9')]);if(_0x24d22c[_0x1b09('0xa')]&&_0x24d22c[_0x1b09('0xa')][_0x328815]&&_0x24d22c[_0x1b09('0xa')][_0x328815]['timer']){_0x24d22c[_0x1b09('0xa')][_0x328815][_0x1b09('0xb')]();}if(_0x24d22c['agents'][_0x328815]){_0x24d22c['agents'][_0x328815][_0x1b09('0xc')]({'statePause':_0x142c33[_0x1b09('0xd')]?!![]:![]});}_0x8c26a5({'code':0xc8,'message':_0x1b09('0xe')});});},'Reload':function(_0x1046f8){var _0x428cc5=this;return new Promise(function(_0x3a44f1,_0x1fd3bc){if(ami['isConnected']()==![]){return _0x1fd3bc(_0x428cc5[_0x1b09('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x1b09('0x10')][_0x1b09('0x11')],_0x1b09('0x12')][_0x1b09('0x13')]('\x20')));}_0x1046f8=_[_0x1b09('0x14')](_0x1046f8,_[_0x1b09('0x15')](properties[_0x1b09('0x16')]));_0x1046f8[_0x1b09('0x17')]=_0x1b09('0x18');return ami[_0x1b09('0x19')](_0x1046f8)[_0x1b09('0x1a')](function(_0x231ef6){_0x3a44f1({'code':0xc8,'message':_0x231ef6[_0x1b09('0x1b')]});})['catch'](function(_0x214c6b){_0x1fd3bc(_0x428cc5[_0x1b09('0xf')](0x1f5,_0x214c6b['message']));});});},'Command':function(_0x5cf855){var _0xe93ac4=this;return new Promise(function(_0x5debd9,_0x267b5e){if(ami['isConnected']()==![]){return _0x267b5e(_0xe93ac4[_0x1b09('0xf')](0x1f4,[config[_0x1b09('0x10')]['ip'],config[_0x1b09('0x10')][_0x1b09('0x11')],_0x1b09('0x12')][_0x1b09('0x13')]('\x20')));}_0x5cf855=_[_0x1b09('0x14')](_0x5cf855,_0x1b09('0x1c'));_0x5cf855['action']='Command';return ami[_0x1b09('0x19')](_0x5cf855)[_0x1b09('0x1a')](function(_0x4ce7dc){_0x5debd9({'code':0xc8,'message':_0x4ce7dc[_0x1b09('0x1d')]});})[_0x1b09('0x1e')](function(_0x6e132c){_0x267b5e(_0xe93ac4[_0x1b09('0xf')](0x1f5,_0x6e132c['message']));});});},'VoiceQueues':function(_0xe0d931){return new Promise(function(_0x15be49,_0x4936d0){var _0x2d3b86=[];for(var _0x472d30 in _0x24d22c['voiceQueues']){if(_0x24d22c[_0x1b09('0x1f')][_0x1b09('0x20')](_0x472d30)){var _0xa71272=_0x24d22c[_0x1b09('0x1f')][_0x472d30];var _0x547fbb={'id':_0xa71272['id'],'name':_0xa71272[_0x1b09('0x9')],'strategy':_0xa71272[_0x1b09('0x21')],'answered':_0xa71272['answered'],'available':_0xa71272[_0x1b09('0x22')],'loggedIn':_0xa71272[_0x1b09('0x23')],'pTalking':_0xa71272[_0x1b09('0x24')],'sumBillable':_0xa71272[_0x1b09('0x25')],'sumDuration':_0xa71272[_0x1b09('0x26')],'sumHoldTime':_0xa71272[_0x1b09('0x27')]||0x0,'talking':_0xa71272[_0x1b09('0x28')],'total':_0xa71272['total'],'type':_0xa71272[_0x1b09('0x29')],'unmanaged':_0xa71272[_0x1b09('0x2a')],'abandoned':_0xa71272['abandoned'],'waiting':_0xa71272[_0x1b09('0x2b')],'loggedInDb':_0xa71272[_0x1b09('0x2c')]};if(_0xa71272[_0x1b09('0x29')]===_0x1b09('0x2d')){_0x547fbb[_0x1b09('0x2e')]=_0xa71272['dialActive'];_0x547fbb[_0x1b09('0x2f')]=_0xa71272['dialMethod'];_0x547fbb[_0x1b09('0x30')]=_0xa71272['dialOriginateCallerIdName'];_0x547fbb[_0x1b09('0x31')]=_0xa71272[_0x1b09('0x31')];_0x547fbb[_0x1b09('0x32')]=_0xa71272[_0x1b09('0x32')];_0x547fbb[_0x1b09('0x33')]=_0xa71272[_0x1b09('0x33')];_0x547fbb[_0x1b09('0x34')]=_0xa71272[_0x1b09('0x34')];_0x547fbb[_0x1b09('0x35')]=_0xa71272[_0x1b09('0x35')];_0x547fbb['outboundAnswerCallsDay']=_0xa71272[_0x1b09('0x36')];_0x547fbb[_0x1b09('0x37')]=_0xa71272[_0x1b09('0x37')];_0x547fbb['outboundBusyCallsDay']=_0xa71272[_0x1b09('0x38')];_0x547fbb[_0x1b09('0x39')]=_0xa71272[_0x1b09('0x39')];_0x547fbb[_0x1b09('0x3a')]=_0xa71272[_0x1b09('0x3a')];_0x547fbb[_0x1b09('0x3b')]=_0xa71272[_0x1b09('0x3b')];_0x547fbb[_0x1b09('0x3c')]=_0xa71272['outboundDropCallsDayTimeout'];_0x547fbb[_0x1b09('0x3d')]=_0xa71272['outboundNoAnswerCallsDay'];_0x547fbb[_0x1b09('0x3e')]=_0xa71272['outboundNoSuchCallsDay'];_0x547fbb[_0x1b09('0x3f')]=_0xa71272[_0x1b09('0x3f')];_0x547fbb[_0x1b09('0x40')]=_0xa71272[_0x1b09('0x40')];_0x547fbb[_0x1b09('0x41')]=_0xa71272[_0x1b09('0x41')];_0x547fbb[_0x1b09('0x42')]=_0xa71272[_0x1b09('0x42')];_0x547fbb[_0x1b09('0x43')]=_0xa71272[_0x1b09('0x43')];_0x547fbb[_0x1b09('0x44')]=_0xa71272[_0x1b09('0x44')];_0x547fbb[_0x1b09('0x45')]=_0xa71272['predictiveIntervalAvgTalktime'];_0x547fbb['predictiveIntervalDroppedCallsCallersExit']=_0xa71272[_0x1b09('0x46')];_0x547fbb[_0x1b09('0x47')]=_0xa71272[_0x1b09('0x47')];_0x547fbb[_0x1b09('0x48')]=_0xa71272[_0x1b09('0x48')];_0x547fbb[_0x1b09('0x49')]=_0xa71272[_0x1b09('0x49')];_0x547fbb[_0x1b09('0x4a')]=_0xa71272['predictiveIntervalHitRate'];_0x547fbb['predictiveIntervalMultiplicativeFactor']=_0xa71272[_0x1b09('0x4b')];_0x547fbb['predictiveIntervalPauses']=_0xa71272[_0x1b09('0x4c')];_0x547fbb[_0x1b09('0x4d')]=_0xa71272[_0x1b09('0x4d')];_0x547fbb['predictiveIntervalTotalCalls']=_0xa71272[_0x1b09('0x4e')];_0x547fbb[_0x1b09('0x1b')]=_0xa71272[_0x1b09('0x1b')];_0x547fbb['originated']=_0xa71272[_0x1b09('0x4f')];_0x547fbb[_0x1b09('0x50')]=_0xa71272[_0x1b09('0x50')];_0x547fbb[_0x1b09('0x51')]=_0xa71272['erlangCallToSecond'];_0x547fbb[_0x1b09('0x52')]=_0xa71272[_0x1b09('0x52')];_0x547fbb['erlangBusyFactor']=_0xa71272[_0x1b09('0x53')];_0x547fbb[_0x1b09('0x54')]=_0xa71272['startPredictive'];_0x547fbb['startProgressive']=_0xa71272['startProgressive'];}if(_0xa71272['Trunk']){_0x547fbb[_0x1b09('0x55')]={'id':_0xa71272[_0x1b09('0x55')]['id'],'name':_0xa71272[_0x1b09('0x55')]['name'],'active':_0xa71272[_0x1b09('0x55')][_0x1b09('0x56')],'callerid':_0xa71272['Trunk'][_0x1b09('0x57')]};}if(_0xa71272[_0x1b09('0x58')]){_0x547fbb[_0x1b09('0x58')]={'id':_0xa71272[_0x1b09('0x58')]['id'],'name':_0xa71272[_0x1b09('0x58')][_0x1b09('0x9')]};}_0x2d3b86[_0x1b09('0x59')](_0x547fbb);}}_0x15be49({'count':_0x2d3b86[_0x1b09('0x5a')],'rows':_0x2d3b86});});},'UpdateVoiceQueue':function(_0x3b03c9){return new Promise(function(_0x176c2f,_0x5750f9){var _0xd23fa2=_[_0x1b09('0x5b')](_0x24d22c[_0x1b09('0x1f')],{'id':parseInt(_0x3b03c9['id'])});var _0x5bbfef=_[_0x1b09('0x5c')](_0x3b03c9,['id']);if(_0xd23fa2){for(var _0x4bf205 in _0x5bbfef){if(typeof _0x5bbfef[_0x4bf205]!==_0x1b09('0x5d')&&typeof _0xd23fa2[_0x4bf205]!==_0x1b09('0x5d')){_0xd23fa2[_0x4bf205]=_0x5bbfef[_0x4bf205];}}_0x176c2f(_0xd23fa2);}else{_0x5750f9();}});},'VoiceChannels':function(_0x4aac72){return new Promise(function(_0x10a248,_0x9be1a){var _0x3732fb=_[_0x1b09('0x5e')](_0x24d22c[_0x1b09('0x5f')]);_0x10a248({'count':_0x3732fb[_0x1b09('0x5a')],'rows':_0x3732fb});});},'VoiceChannelMixMonitor':function(_0x51402f){var _0x479dfc=this;return new Promise(function(_0x5df547,_0x35d9ee){if(ami['isConnected']()==![]){return _0x35d9ee(_0x479dfc['error'](0x1f4,[config[_0x1b09('0x10')]['ip'],config[_0x1b09('0x10')][_0x1b09('0x11')],_0x1b09('0x12')][_0x1b09('0x13')]('\x20')));}var _0x3e7046=schema(properties[_0x1b09('0x60')])[_0x1b09('0x2')](_0x51402f);if(_0x3e7046['length']>0x0){return _0x35d9ee(_0x479dfc[_0x1b09('0xf')](0x1f4,_[_0x1b09('0x61')](_0x3e7046,_0x1b09('0x1b'))['join'](',\x20')));}var _0x55df13=_[_0x1b09('0x5b')](_0x24d22c['channels'],{'uniqueid':_0x51402f[_0x1b09('0x62')]});if(_0x55df13&&_0x55df13[_0x1b09('0x63')]){var _0x49b051=util[_0x1b09('0x6')](_0x1b09('0x64'),_0x51402f['filename']||_0x51402f[_0x1b09('0x62')],_0x51402f[_0x1b09('0x6')]||_0x1b09('0x65'));return ami[_0x1b09('0x19')]({'action':_0x1b09('0x66'),'channel':_0x55df13['channel'],'file':_0x49b051,'options':_0x1b09('0x67')})[_0x1b09('0x1a')](function(_0x408d50){var _0x337777=_[_0x1b09('0x5b')](_0x55df13[_0x1b09('0x68')],{'filename':_0x1b09('0x69')+_0x49b051['toLowerCase']()});if(_['isNil'](_0x337777)){_0x55df13[_0x1b09('0x68')][_0x1b09('0x59')]({'filename':_0x1b09('0x69')+_0x49b051['toLowerCase'](),'createdAt':moment()[_0x1b09('0x6')](_0x1b09('0x6a')),'mixmonitorid':_0x408d50[_0x1b09('0x6b')],'status':'rec'});}else{_0x337777[_0x1b09('0x6b')]=_0x408d50[_0x1b09('0x6b')];_0x337777[_0x1b09('0x6c')]=_0x1b09('0x6d');}_0x5df547({'code':0xc8,'message':[_0x51402f[_0x1b09('0x62')],_0x1b09('0x6e'),_0x408d50[_0x1b09('0x6b')]][_0x1b09('0x13')]('\x20'),'mixmonitorid':_0x408d50[_0x1b09('0x6b')]});})[_0x1b09('0x1e')](function(_0x1e618e){_0x35d9ee(_0x479dfc[_0x1b09('0xf')](0x1f5,[_0x51402f[_0x1b09('0x62')],_0x1e618e[_0x1b09('0x1b')][_0x1b09('0x6f')]()]['join']('\x20')));});}else{return _0x35d9ee(_0x479dfc['error'](0x1f5,_0x1b09('0x70')));}});},'VoiceChannelStopMixMonitor':function(_0x54efba){var _0x315fe3=this;return new Promise(function(_0x4468f6,_0x246134){if(ami['isConnected']()==![]){return _0x246134(_0x315fe3['error'](0x1f4,[config[_0x1b09('0x10')]['ip'],config[_0x1b09('0x10')]['username'],_0x1b09('0x12')][_0x1b09('0x13')]('\x20')));}var _0x1ba539=schema(properties[_0x1b09('0x60')])[_0x1b09('0x2')](_0x54efba);if(_0x1ba539[_0x1b09('0x5a')]>0x0){return _0x246134(_0x315fe3[_0x1b09('0xf')](0x1f4,_['map'](_0x1ba539,_0x1b09('0x1b'))['join'](',\x20')));}var _0x34c0d2=_[_0x1b09('0x5b')](_0x24d22c[_0x1b09('0x5f')],{'uniqueid':_0x54efba[_0x1b09('0x62')]});if(_0x34c0d2){return BPromise[_0x1b09('0x71')]()[_0x1b09('0x1a')](function(){if(_0x34c0d2[_0x1b09('0x63')]){return ami[_0x1b09('0x19')]({'action':_0x1b09('0x72'),'channel':_0x34c0d2[_0x1b09('0x63')],'mixmonitorid':_0x54efba[_0x1b09('0x6b')]})[_0x1b09('0x1e')](function(_0x517e2d){});}})['then'](function(){if(_0x34c0d2[_0x1b09('0x73')]){return ami[_0x1b09('0x19')]({'action':_0x1b09('0x72'),'channel':_0x34c0d2['destinationchannel'],'mixmonitorid':_0x54efba[_0x1b09('0x6b')]})[_0x1b09('0x1e')](function(_0x2b422c){});}})['then'](function(_0x28d473){var _0x103d7e=_[_0x1b09('0x5b')](_0x34c0d2['monitors'],{'mixmonitorid':_0x54efba[_0x1b09('0x6b')]});if(_0x103d7e){_0x103d7e['status']='stop';}})[_0x1b09('0x1a')](function(){var _0x439880=util[_0x1b09('0x6')]('%s.%s',_0x54efba[_0x1b09('0x74')]||_0x54efba['uniqueid'],_0x54efba[_0x1b09('0x6')]||_0x1b09('0x65'));var _0x4931ca=_[_0x1b09('0x5b')](_0x34c0d2['monitors'],{'filename':_0x1b09('0x69')+_0x439880[_0x1b09('0x6f')]()});if(_0x4931ca){_0x4931ca['status']=_0x1b09('0x75');}})[_0x1b09('0x1a')](function(){_0x4468f6({'code':0xc8,'message':[_0x54efba[_0x1b09('0x62')],_0x1b09('0x76')][_0x1b09('0x13')]('\x20')});})[_0x1b09('0x1e')](function(_0x2570e9){_0x246134(_0x315fe3['error'](0x1f5,[_0x54efba[_0x1b09('0x62')],_0x2570e9[_0x1b09('0x1b')][_0x1b09('0x6f')]()]['join']('\x20')));});}else{return _0x246134(_0x315fe3[_0x1b09('0xf')](0x1f5,_0x1b09('0x70')));}});},'VoiceQueuesChannels':function(_0x29cf4e){return new Promise(function(_0x28b0c5,_0x25fca8){var _0x5051dc=_[_0x1b09('0x5e')](_0x24d22c['queueChannels']);_0x28b0c5({'count':_0x5051dc[_0x1b09('0x5a')],'rows':_0x5051dc});});},'VoiceQueuesChannel':function(_0x417875){var _0x22b1a9=this;return new Promise(function(_0x1fd5cd,_0x45526d){var _0x28a677=schema(properties[_0x1b09('0x77')])[_0x1b09('0x2')](_0x417875);if(_0x28a677['length']>0x0){return _0x45526d(_0x22b1a9[_0x1b09('0xf')](0x1f4,_[_0x1b09('0x61')](_0x28a677,'message')[_0x1b09('0x13')](',\x20')));}var _0xf7a8c8=_[_0x1b09('0x5b')](_0x24d22c[_0x1b09('0x78')],{'uniqueid':_0x417875[_0x1b09('0x62')]});if(_0xf7a8c8){_0x1fd5cd(_0xf7a8c8);}else{return _0x45526d(_0x22b1a9[_0x1b09('0xf')](0x1f5,_0x1b09('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x3dbe9a){var _0x20818a=this;return new Promise(function(_0x59fba4,_0x68f83b){if(ami[_0x1b09('0x79')]()==![]){return _0x68f83b(_0x20818a[_0x1b09('0xf')](0x1f4,[config[_0x1b09('0x10')]['ip'],config[_0x1b09('0x10')]['username'],_0x1b09('0x12')][_0x1b09('0x13')]('\x20')));}var _0x5736c5=schema(properties[_0x1b09('0x7a')])['validate'](_0x3dbe9a);if(_0x5736c5[_0x1b09('0x5a')]>0x0){return _0x68f83b(_0x20818a[_0x1b09('0xf')](0x1f4,_[_0x1b09('0x61')](_0x5736c5,'message')['join'](',\x20')));}var _0x51ed71=_[_0x1b09('0x5b')](_0x24d22c[_0x1b09('0x78')],{'uniqueid':_0x3dbe9a[_0x1b09('0x62')]});if(_0x51ed71&&_0x51ed71[_0x1b09('0x63')]){return ami[_0x1b09('0x19')]({'action':_0x1b09('0x7b'),'channel':_0x51ed71[_0x1b09('0x63')]})[_0x1b09('0x1a')](function(_0x4560e3){_0x59fba4({'code':0xc8,'message':[_0x3dbe9a[_0x1b09('0x62')],_0x4560e3[_0x1b09('0x1b')][_0x1b09('0x6f')]()]['join']('\x20')});})['catch'](function(_0x33a78e){_0x68f83b(_0x20818a[_0x1b09('0xf')](0x1f5,[_0x3dbe9a[_0x1b09('0x62')],_0x33a78e[_0x1b09('0x1b')][_0x1b09('0x6f')]()][_0x1b09('0x13')]('\x20')));});}else{return _0x68f83b(_0x20818a[_0x1b09('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2fbbaf){var _0x23ab6d=this;return new Promise(function(_0x2b2220,_0x4f777b){if(ami[_0x1b09('0x79')]()==![]){return _0x4f777b(_0x23ab6d[_0x1b09('0xf')](0x1f4,[config[_0x1b09('0x10')]['ip'],config[_0x1b09('0x10')][_0x1b09('0x11')],'ami\x20disconnected']['join']('\x20')));}var _0x3ea535=schema(properties[_0x1b09('0x7c')])['validate'](_0x2fbbaf);if(_0x3ea535[_0x1b09('0x5a')]>0x0){return _0x4f777b(_0x23ab6d['error'](0x1f4,_[_0x1b09('0x61')](_0x3ea535,_0x1b09('0x1b'))[_0x1b09('0x13')](',\x20')));}var _0x595a32=_[_0x1b09('0x5b')](_0x24d22c['queueChannels'],{'uniqueid':_0x2fbbaf['uniqueid']});if(_0x595a32&&_0x595a32[_0x1b09('0x63')]){return ami['Action']({'action':'Redirect','channel':_0x595a32['channel'],'exten':_0x2fbbaf[_0x1b09('0x7d')],'context':_0x2fbbaf[_0x1b09('0x7e')]||_0x595a32[_0x1b09('0x7e')],'priority':0x1})[_0x1b09('0x1a')](function(_0x589b8b){_0x2b2220({'code':0xc8,'message':[_0x2fbbaf[_0x1b09('0x62')],_0x589b8b[_0x1b09('0x1b')][_0x1b09('0x6f')]()][_0x1b09('0x13')]('\x20')});})[_0x1b09('0x1e')](function(_0x4e1562){_0x4f777b(_0x23ab6d[_0x1b09('0xf')](0x1f5,[_0x2fbbaf[_0x1b09('0x62')],_0x4e1562[_0x1b09('0x1b')][_0x1b09('0x6f')]()]['join']('\x20')));});}else{return _0x4f777b(_0x23ab6d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x4750df){return new Promise(function(_0x419add,_0x1aa510){var _0x371943=_[_0x1b09('0x5e')](_0x24d22c[_0x1b09('0x7f')]);_0x419add({'count':_0x371943['length'],'rows':_0x371943});});},'Telephones':function(_0x258a26){return new Promise(function(_0x1d4834,_0x57a953){var _0x56be94=_[_0x1b09('0x5e')](_0x24d22c[_0x1b09('0x80')]);_0x1d4834({'count':_0x56be94[_0x1b09('0x5a')],'rows':_0x56be94});});},'Trunks':function(_0x49a600){return new Promise(function(_0x5c0c7a,_0x20bd49){var _0x58ff42=_[_0x1b09('0x5e')](_0x24d22c['trunks']);_0x5c0c7a({'count':_0x58ff42['length'],'rows':_0x58ff42});});},'OutboundChannels':function(_0x24a450){return new Promise(function(_0xbd17f8,_0x40f6bf){var _0x47fa0f=_[_0x1b09('0x5e')](_0x24d22c[_0x1b09('0x81')]);_0xbd17f8({'count':_0x47fa0f[_0x1b09('0x5a')],'rows':_0x47fa0f});});},'Outbound':function(_0x3ad51b){return new Promise(function(_0x2d0639,_0x315303){_0x2d0639(_0x24d22c[_0x1b09('0x2d')]);});},'Campaigns':function(_0x520076){return new Promise(function(_0x3b8864,_0x4da93e){var _0x2d7faa=_[_0x1b09('0x5e')](_0x24d22c['campaigns']);_0x3b8864({'count':_0x2d7faa[_0x1b09('0x5a')],'rows':_0x2d7faa});});},'VoiceQueuesPreview':function(_0x2f2306){var _0x597643=this;return new Promise(function(_0x4ef2e5,_0x292517){_0x4e252c[_0x1b09('0x82')](_0x2f2306['id'])[_0x1b09('0x1a')](function(_0x266139){_0x4ef2e5({'code':0xc8,'message':_0x266139[_0x1b09('0x1b')]});})[_0x1b09('0x1e')](function(_0xb9f0b0){_0x292517(_0x597643[_0x1b09('0xf')](0x1f4,_0xb9f0b0[_0x1b09('0x1b')]));});});},'EventManager':function(_0x1822ef){var _0xa9ee8=this;return new Promise(function(_0x2eb447,_0x44e8f9){if(!_0x1822ef['event']){return _0x44e8f9(_0xa9ee8[_0x1b09('0xf')](0x1f4,_0x1b09('0x83')));}ami[_0x1b09('0x84')](_0x1b09('0x85')+_0x1822ef[_0x1b09('0x86')],_0x1822ef[_0x1b09('0x1b')]);_0x2eb447({'code':0xc8,'message':_0x1822ef});});},'FaxAccounts':function(_0x2efd5a){return new Promise(function(_0x266117,_0x1b934){var _0x3c6ebe=_[_0x1b09('0x5e')](_0x24d22c[_0x1b09('0x87')]);_0x266117({'count':_0x3c6ebe[_0x1b09('0x5a')],'rows':_0x3c6ebe});});},'SendFax':function(_0x3d6333){var _0x406f46=this;return new Promise(function(_0x2ab5e5,_0x590266){_0xda8caa['send'](_0x3d6333)['then'](function(_0x4aad75){_0x2ab5e5({'code':0xc8,'message':_0x4aad75['message']});})[_0x1b09('0x1e')](function(_0x29b1b4){_0x590266(_0x406f46['error'](0x1f4,_0x29b1b4['message']));});});},'CheckAfterSend':function(_0x145efe){var _0x25d450=this;return new Promise(function(_0x36bee8,_0x2713a2){_0xda8caa[_0x1b09('0x88')](_0x145efe)[_0x1b09('0x1a')](function(_0x3f7a46){_0x36bee8({'code':0xc8,'message':_0x3f7a46[_0x1b09('0x1b')]});})[_0x1b09('0x1e')](function(_0x5d1fa3){_0x2713a2(_0x25d450[_0x1b09('0xf')](0x1f4,_0x5d1fa3[_0x1b09('0x1b')]));});});}};var _0x19266a=jayson['server'](_0x5ce726)[_0x1b09('0x89')]();_0x19266a['on'](_0x1b09('0xf'),function(_0x41ec2b){return _0x2bf4f6(_0x41ec2b);});_0x19266a[_0x1b09('0x5')](0x232a,_0x1b09('0x8a'),function(){console[_0x1b09('0x8b')](_0x1b09('0x8c'),0x232a);return _0x5fa348(_0x1b09('0x8d')+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 2d9be5e..67fd224 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 _0xed1f=['trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','ListId','data3','phone','map','routeId','destcalleridnum','lastName','mobile','fax','createdAt','scheduledAt','union','resolve','then','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger'];(function(_0x37b113,_0x26061a){var _0x7afe2c=function(_0x302cf3){while(--_0x302cf3){_0x37b113['push'](_0x37b113['shift']());}};_0x7afe2c(++_0x26061a);}(_0xed1f,0x6a));var _0xfed1=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xed1f[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0xfed1('0x0'));var BPromise=require(_0xfed1('0x1'));var Redis=require(_0xfed1('0x2'));var util=require(_0xfed1('0x3'));var config=require(_0xfed1('0x4'));var logger=require(_0xfed1('0x5'))(_0xfed1('0x6'));var cmContactRpc=require(_0xfed1('0x7'));config[_0xfed1('0x8')]=_[_0xfed1('0x9')](config[_0xfed1('0x8')],{'host':_0xfed1('0xa'),'port':0x18eb});var io=require(_0xfed1('0xb'))(new Redis(config[_0xfed1('0x8')]));function emit(_0x380e18,_0x612b38,_0x2a6082,_0x2967ef,_0x568d48){logger[_0xfed1('0xc')](_0xfed1('0xd'),_0x380e18,_0x612b38['id'],_0x2a6082,_0x2967ef,JSON['stringify'](_0x568d48));io['to'](_0x2a6082)[_0xfed1('0xe')](_0x2967ef,_0x568d48);}exports[_0xfed1('0xf')]=function(_0x4a564e,_0x3ce017,_0x48c338,_0x1c3f40){var _0x234f4e,_0x4a8369;var _0x5c0b5f={};var _0x3d1891=Number(_0x48c338[_0xfed1('0x10')]);var _0x569a6e=_0x48c338[_0xfed1('0x11')]?Boolean(Number(_0x48c338['data2'])):![];var _0x529b3d;var _0x3f6555=![];if(!_[_0xfed1('0x12')](_0x48c338['data5'])){if(_0x48c338[_0xfed1('0x13')]=='1')_0x3f6555=!![];}if(!_0x3f6555){if(_0x1c3f40['xmd-contactid']){_0x5c0b5f['id']=_0x1c3f40['xmd-contactid'];}}if(!_0x5c0b5f['id']){_0x5c0b5f[_0xfed1('0x14')]=_0x3d1891;_0x529b3d=_0x48c338[_0xfed1('0x15')]&&_0x48c338[_0xfed1('0x15')]!=='0'?_0x48c338[_0xfed1('0x15')]['split'](','):[_0xfed1('0x16')];_0x5c0b5f['$or']=_[_0xfed1('0x17')](_0x529b3d,function(_0x29a32f){var _0x489a0f={};_0x489a0f[_0x29a32f]=_0x1c3f40[_0xfed1('0x18')]?_0x1c3f40[_0xfed1('0x19')]:_0x1c3f40['calleridnum'];return _0x489a0f;});}var _0x59509b=['id','firstName',_0xfed1('0x1a'),'phone',_0xfed1('0x1b'),_0xfed1('0x1c'),'ListId',_0xfed1('0x1d'),_0xfed1('0x1e'),'updatedAt'];var _0x3ce944=_[_0xfed1('0x1f')](_0x59509b,_0x529b3d);BPromise[_0xfed1('0x20')]()[_0xfed1('0x21')](cmContactRpc['getContacts']({'attributes':_0x3ce944,'where':_0x5c0b5f}))[_0xfed1('0x21')](function(_0x59333e){_0x4a8369=_0x59333e;if(!_[_0xfed1('0x22')](_0x4a8369)){if(_0x4a8369[_0xfed1('0x23')]===0x1){_0x234f4e=_0x4a8369[0x0];logger[_0xfed1('0xc')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id'],_0x234f4e['id']);}else{logger['info'](_0xfed1('0x25'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id'],_[_0xfed1('0x17')](_0x4a8369,'id')[_0xfed1('0x26')](','));}return;}else{logger[_0xfed1('0xc')](_0xfed1('0x27'),_0x1c3f40['uniqueid'],_0x3ce017['id']);var _0x465ce6={'ListId':_0x3d1891};var _0xcb1cdc=_0x48c338['data4']&&_0x48c338[_0xfed1('0x28')]!=='0'?_0x48c338[_0xfed1('0x28')]:_0xfed1('0x16');if(_0x569a6e){logger[_0xfed1('0xc')](_0xfed1('0x29'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id']);_0x465ce6[_0xcb1cdc]=_['isNil'](_0x1c3f40[_0xfed1('0x18')])?_0x1c3f40['calleridnum']:_0x1c3f40[_0xfed1('0x19')];if(_['isNil'](_0x1c3f40['routeId'])){_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2b')]&&_0x1c3f40[_0xfed1('0x2b')]!==''?_0x1c3f40[_0xfed1('0x2b')]:_0xfed1('0x2c');}else{_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2d')]&&_0x1c3f40[_0xfed1('0x2d')]!==_0xfed1('0x2e')?_0x1c3f40['destcalleridname']:_0xfed1('0x2c');}return BPromise[_0xfed1('0x20')]()['then'](cmContactRpc['createContact'](_0x465ce6))[_0xfed1('0x21')](function(_0x2d10f5){_0x234f4e=_0x2d10f5;_0x4a8369[_0xfed1('0x2f')](_0x2d10f5);if(_0x234f4e){logger[_0xfed1('0xc')](_0xfed1('0x30'),_0x1c3f40['uniqueid'],_0x3ce017['id'],_0x234f4e['id']);}return;});}else{logger[_0xfed1('0xc')](_0xfed1('0x31'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id']);_0x465ce6[_0xcb1cdc]=_[_0xfed1('0x12')](_0x1c3f40[_0xfed1('0x18')])?_0x1c3f40['calleridnum']:_0x1c3f40[_0xfed1('0x19')];if(_['isNil'](_0x1c3f40[_0xfed1('0x18')])){_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2b')]&&_0x1c3f40[_0xfed1('0x2b')]!==_0xfed1('0x2e')?_0x1c3f40[_0xfed1('0x2b')]:_0xfed1('0x2c');}else{_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40['destcalleridname']&&_0x1c3f40[_0xfed1('0x2d')]!==_0xfed1('0x2e')?_0x1c3f40[_0xfed1('0x2d')]:_0xfed1('0x2c');}_0x234f4e=_0x465ce6;_0x4a8369['push'](_0x465ce6);return;}}})['then'](function(){if(_0x4a564e){emit(_0x1c3f40[_0xfed1('0x24')],_0x3ce017,util[_0xfed1('0x32')](_0xfed1('0x33'),_0x4a564e[_0xfed1('0x34')]),util[_0xfed1('0x32')](_0xfed1('0x35'),_0x48c338[_0xfed1('0x36')][_0xfed1('0x37')]()),{'evt':_['merge'](_0x1c3f40,{'autoCreate':_0x569a6e}),'contact':_0x234f4e===undefined?{}:_0x234f4e,'contacts':_0x4a8369['length']===0x0?undefined:_0x4a8369});}});}; \ No newline at end of file +var _0x3e74=['scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','merge','lodash','ioredis','util','../../../../config/environment','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','data1','data2','isNil','data5','ListId','data3','$or','map','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt'];(function(_0x485677,_0x3993bf){var _0x560810=function(_0x33f3a4){while(--_0x33f3a4){_0x485677['push'](_0x485677['shift']());}};_0x560810(++_0x3993bf);}(_0x3e74,0x175));var _0x43e7=function(_0x298157,_0x4ca2a8){_0x298157=_0x298157-0x0;var _0x68965f=_0x3e74[_0x298157];return _0x68965f;};'use strict';var _=require(_0x43e7('0x0'));var BPromise=require('bluebird');var Redis=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var config=require(_0x43e7('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x43e7('0x4'));config['redis']=_[_0x43e7('0x5')](config[_0x43e7('0x6')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config[_0x43e7('0x6')]));function emit(_0x503698,_0x45a0d1,_0x3491d6,_0x2ede2d,_0x8528fc){logger[_0x43e7('0x9')]('[CM][%s][%s]',_0x503698,_0x45a0d1['id'],_0x3491d6,_0x2ede2d,JSON[_0x43e7('0xa')](_0x8528fc));io['to'](_0x3491d6)['emit'](_0x2ede2d,_0x8528fc);}exports['exec']=function(_0x39c8bd,_0x4139c9,_0x5c34f4,_0x2803d9){var _0x513707,_0xf7c520;var _0x37302c={};var _0x4ebc8e=Number(_0x5c34f4[_0x43e7('0xb')]);var _0xc960ea=_0x5c34f4[_0x43e7('0xc')]?Boolean(Number(_0x5c34f4[_0x43e7('0xc')])):![];var _0x4e008c;var _0x583d85=![];if(!_[_0x43e7('0xd')](_0x5c34f4[_0x43e7('0xe')])){if(_0x5c34f4[_0x43e7('0xe')]=='1')_0x583d85=!![];}if(!_0x583d85){if(_0x2803d9['xmd-contactid']){_0x37302c['id']=_0x2803d9['xmd-contactid'];}}if(!_0x37302c['id']){_0x37302c[_0x43e7('0xf')]=_0x4ebc8e;_0x4e008c=_0x5c34f4[_0x43e7('0x10')]&&_0x5c34f4[_0x43e7('0x10')]!=='0'?_0x5c34f4[_0x43e7('0x10')]['split'](','):['phone'];_0x37302c[_0x43e7('0x11')]=_[_0x43e7('0x12')](_0x4e008c,function(_0x273a32){var _0x5d346f={};_0x5d346f[_0x273a32]=_0x2803d9['routeId']?_0x2803d9[_0x43e7('0x13')]:_0x2803d9[_0x43e7('0x14')];return _0x5d346f;});}var _0x9037d3=['id',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),_0x43e7('0x19'),_0x43e7('0xf'),_0x43e7('0x1a'),_0x43e7('0x1b'),_0x43e7('0x1c')];var _0x4b5d64=_[_0x43e7('0x1d')](_0x9037d3,_0x4e008c);BPromise[_0x43e7('0x1e')]()['then'](cmContactRpc[_0x43e7('0x1f')]({'attributes':_0x4b5d64,'where':_0x37302c}))[_0x43e7('0x20')](function(_0x3945bb){_0xf7c520=_0x3945bb;if(!_[_0x43e7('0x21')](_0xf7c520)){if(_0xf7c520[_0x43e7('0x22')]===0x1){_0x513707=_0xf7c520[0x0];logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_0x513707['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_[_0x43e7('0x12')](_0xf7c520,'id')['join'](','));}return;}else{logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id']);var _0x5c5e67={'ListId':_0x4ebc8e};var _0x1af208=_0x5c34f4[_0x43e7('0x24')]&&_0x5c34f4[_0x43e7('0x24')]!=='0'?_0x5c34f4[_0x43e7('0x24')]:'phone';if(_0xc960ea){logger['info'](_0x43e7('0x25'),_0x2803d9['uniqueid'],_0x4139c9['id']);_0x5c5e67[_0x1af208]=_[_0x43e7('0xd')](_0x2803d9[_0x43e7('0x26')])?_0x2803d9[_0x43e7('0x14')]:_0x2803d9[_0x43e7('0x13')];if(_['isNil'](_0x2803d9[_0x43e7('0x26')])){_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x27')]&&_0x2803d9[_0x43e7('0x27')]!==_0x43e7('0x28')?_0x2803d9[_0x43e7('0x27')]:_0x43e7('0x29');}else{_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x2a')]&&_0x2803d9[_0x43e7('0x2a')]!==_0x43e7('0x28')?_0x2803d9[_0x43e7('0x2a')]:_0x43e7('0x29');}return BPromise[_0x43e7('0x1e')]()['then'](cmContactRpc[_0x43e7('0x2b')](_0x5c5e67))[_0x43e7('0x20')](function(_0x3b8f78){_0x513707=_0x3b8f78;_0xf7c520[_0x43e7('0x2c')](_0x3b8f78);if(_0x513707){logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_0x513707['id']);}return;});}else{logger[_0x43e7('0x9')](_0x43e7('0x2d'),_0x2803d9[_0x43e7('0x23')],_0x4139c9['id']);_0x5c5e67[_0x1af208]=_['isNil'](_0x2803d9['routeId'])?_0x2803d9['calleridnum']:_0x2803d9[_0x43e7('0x13')];if(_[_0x43e7('0xd')](_0x2803d9[_0x43e7('0x26')])){_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x27')]&&_0x2803d9[_0x43e7('0x27')]!==''?_0x2803d9['calleridname']:'Unknown';}else{_0x5c5e67['firstName']=_0x2803d9['destcalleridname']&&_0x2803d9['destcalleridname']!==''?_0x2803d9[_0x43e7('0x2a')]:'Unknown';}_0x513707=_0x5c5e67;_0xf7c520[_0x43e7('0x2c')](_0x5c5e67);return;}}})[_0x43e7('0x20')](function(){if(_0x39c8bd){emit(_0x2803d9[_0x43e7('0x23')],_0x4139c9,util[_0x43e7('0x2e')](_0x43e7('0x2f'),_0x39c8bd[_0x43e7('0x30')]),util[_0x43e7('0x2e')]('trigger:%s',_0x5c34f4['action']['toLowerCase']()),{'evt':_[_0x43e7('0x31')](_0x2803d9,{'autoCreate':_0xc960ea}),'contact':_0x513707===undefined?{}:_0x513707,'contacts':_0xf7c520[_0x43e7('0x22')]===0x0?undefined:_0xf7c520});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6a88914..4c37cb2 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 _0xd73f=['exec','accounts','queue','routeId','urlforward','script','parse','query','search','checkTrigger','channel','AllConditions','length','every','checkConditions','AnyConditions','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','exports','lodash','url','mustache','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','localhost','socket.io-emitter','redis','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialend','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','voice','checkTriggers','interface','hasOwnProperty','merge','variables','Actions','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data4','location','uriLocation','data5','windowHeight','data6','600','winApplication','winArguments','render','format','user:%s','name','toLowerCase','jscripty'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xd73f,0x90));var _0xfd73=function(_0x1b3e32,_0x49ad74){_0x1b3e32=_0x1b3e32-0x0;var _0x4796e3=_0xd73f[_0x1b3e32];return _0x4796e3;};'use strict';var util=require('util');var _=require(_0xfd73('0x0'));var url=require(_0xfd73('0x1'));var Mustache=require(_0xfd73('0x2'));var Redis=require('ioredis');var urlforward=require(_0xfd73('0x3'));var integration=require('./integration');var cmContact=require(_0xfd73('0x4'));var script=require(_0xfd73('0x5'));var config=require(_0xfd73('0x6'));var logger=require(_0xfd73('0x7'))(_0xfd73('0x8'));var ami=require(_0xfd73('0x9'));config['redis']=_[_0xfd73('0xa')](config['redis'],{'host':_0xfd73('0xb'),'port':0x18eb});var io=require(_0xfd73('0xc'))(new Redis(config[_0xfd73('0xd')]));var operators={'equals':function(_0x3dc28b,_0x3fd9dc){return _0x3dc28b==_0x3fd9dc;},'not_equals':function(_0x5162a5,_0x1f0dc2){return _0x5162a5!=_0x1f0dc2;}};var barAndWebActions=[_0xfd73('0xe'),_0xfd73('0x1'),'winapp'];function Trigger(_0x39a587){this['triggers']=_0x39a587[_0xfd73('0xf')];this[_0xfd73('0x10')]=_0x39a587[_0xfd73('0x10')];this[_0xfd73('0x11')]=_0x39a587[_0xfd73('0x11')];this['templates']=_0x39a587[_0xfd73('0x12')];this['voiceExtensions']=_0x39a587[_0xfd73('0x13')];this[_0xfd73('0x14')]=_0x39a587[_0xfd73('0x14')];this[_0xfd73('0x15')]=_0x39a587[_0xfd73('0x15')];this[_0xfd73('0x16')]=_0x39a587[_0xfd73('0x16')];this[_0xfd73('0x17')]=_0x39a587['sugarcrmAccounts'];this[_0xfd73('0x18')]=_0x39a587[_0xfd73('0x18')];this[_0xfd73('0x19')]=_0x39a587[_0xfd73('0x19')];this['vtigerAccounts']=_0x39a587[_0xfd73('0x1a')];this['servicenowAccounts']=_0x39a587[_0xfd73('0x1b')];this['dynamics365Accounts']=_0x39a587[_0xfd73('0x1c')];this[_0xfd73('0x1d')]=_0x39a587[_0xfd73('0x1d')];this['accounts']={'zendesk':this[_0xfd73('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xfd73('0x17')],'zoho':this[_0xfd73('0x18')],'desk':this[_0xfd73('0x19')],'vtiger':this[_0xfd73('0x1a')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xfd73('0x1d')],'servicenow':this[_0xfd73('0x1b')]};ami['on'](_0xfd73('0x1e'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on']('custom:agentconnect',this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x21'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x22'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x23'),this[_0xfd73('0x1f')]['bind'](this));ami['on'](_0xfd73('0x24'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on']('custom:agentbusy',this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x25'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x26'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on']('custom:amd',this[_0xfd73('0x1f')]['bind'](this));ami['on'](_0xfd73('0x27'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on']('custom:timeout',this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x28'),this['syncAgentDial'][_0xfd73('0x20')](this));ami['on']('custom:dialconnect',this[_0xfd73('0x29')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x2a'),this[_0xfd73('0x29')]['bind'](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0xfd73('0x20')](this));ami['on']('custom:closedinteraction',this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x2b'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x2c'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfd73('0x2d'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x2e'),this[_0xfd73('0x1f')][_0xfd73('0x20')](this));ami['on'](_0xfd73('0x2f'),this['syncCustomEvent']['bind'](this));}Trigger[_0xfd73('0x30')][_0xfd73('0x31')]=function(_0x3f1cba,_0x7dd4a9,_0x3e32fe){logger[_0xfd73('0x32')](_0x3f1cba,_0x7dd4a9,JSON[_0xfd73('0x33')](_0x3e32fe));io['to'](_0x3f1cba)['emit'](_0x7dd4a9,_0x3e32fe);};Trigger[_0xfd73('0x30')][_0xfd73('0x1f')]=function(_0x320823){var _0x202f06=_[_0xfd73('0x34')](_0x320823);if(typeof _0x202f06[_0xfd73('0x35')]==='undefined'){_0x202f06[_0xfd73('0x35')]=_0xfd73('0x36');}this[_0xfd73('0x37')](_0x202f06);};Trigger[_0xfd73('0x30')][_0xfd73('0x29')]=function(_0x3081d6){if(this[_0xfd73('0x10')][_0x3081d6[_0xfd73('0x38')]]){this[_0xfd73('0x1f')](_0x3081d6);}};Trigger[_0xfd73('0x30')][_0xfd73('0x37')]=function(_0x447c2d){var _0x53a9fe;for(var _0x4b13b0 in this[_0xfd73('0xf')]){if(this[_0xfd73('0xf')][_0xfd73('0x39')](_0x4b13b0)){if(this[_0xfd73('0xf')][_0x4b13b0]['status']){_0x53a9fe=this['checkTrigger'](this[_0xfd73('0xf')][_0x4b13b0],_0x447c2d);if(_0x53a9fe){_[_0xfd73('0x3a')](_0x447c2d,_0x447c2d[_0xfd73('0x3b')]);for(var _0x546981=0x0,_0x3d380c,_0x584d95,_0x3edb47;_0x5469810x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x46678a,_0x5ec1a6){var _0x212d45=function(_0x49d3d2){while(--_0x49d3d2){_0x46678a['push'](_0x46678a['shift']());}};_0x212d45(++_0x5ec1a6);}(_0x3e74,0x175));var _0x43e7=function(_0x57c319,_0x477442){_0x57c319=_0x57c319-0x0;var _0x21cba1=_0x3e74[_0x57c319];return _0x21cba1;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 886eeb2..c8a310c 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 _0xc530=['queue','Fields','substring','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','serverUrl','callDirection','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','redis','POST','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info','username','internalemailaddress','toLowerCase','outbound','calleridnum','contacts','/systemusers(','odata-entityid','lastIndexOf','destcalleridnum','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','phonecall','phonecalls','Subjects','Descriptions','/contacts('];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc530,0x189));var _0x0c53=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0xc530[_0x33c637];return _0x14aa20;};'use strict';var _=require('lodash');var BPromise=require(_0x0c53('0x0'));var rp=require(_0x0c53('0x1'));var util=require(_0x0c53('0x2'));var intUtil=require(_0x0c53('0x3'));var md5=require('md5');var Redis=require(_0x0c53('0x4'));var logger=require(_0x0c53('0x5'))('dynamics365');var config=require('../../../../config/environment');config[_0x0c53('0x6')]=_['defaults'](config[_0x0c53('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0c53('0x6')]));function getAuthToken(_0x54dc31,_0x48764c,_0x1d740e){var _0x2a94c4={'method':_0x0c53('0x7'),'uri':_0x48764c,'form':{'client_id':_0x54dc31[_0x0c53('0x8')],'resource':_0x54dc31[_0x0c53('0x9')],'username':_0x54dc31['username'],'password':_0x54dc31['password'],'grant_type':_0x0c53('0xa'),'client_secret':_0x54dc31[_0x0c53('0xb')]},'json':!![]};return rp(_0x2a94c4)[_0x0c53('0xc')](function(_0x3e1f3d){return _0x3e1f3d[_0x0c53('0xd')];})[_0x0c53('0xe')](function(_0x5d6ee7){logger[_0x0c53('0xf')]('['+[_0x1d740e[_0x0c53('0x10')]()]+_0x0c53('0x11'));return _0x5d6ee7[_0x0c53('0x12')];});}function getUser(_0x1df83e,_0x2ea7ce,_0x31ce99,_0x33b46a,_0x307463,_0x36c5de){return new BPromise(function(_0x3a2da1,_0x1e068c){return getAuthToken(_0x2ea7ce,_0x33b46a,_0x36c5de)[_0x0c53('0xc')](function(_0x269ed4){var _0x58d604={'method':'GET','uri':_0x307463+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x0c53('0x13')+_0x269ed4,'OData-Version':_0x0c53('0x14')},'json':!![]};return rp(_0x58d604);})['then'](function(_0x499ac4){var _0x9a0c9f=_0x499ac4[_0x0c53('0x15')];var _0xc63d83=![];var _0x565fa0=null;if(!_['isNil'](_0x31ce99)){if(intUtil[_0x0c53('0x16')](_0x31ce99[_0x0c53('0x17')])){_0x1df83e[_0x0c53('0x18')]=_0x31ce99[_0x0c53('0x17')];for(_0x565fa0=0x0;_0x565fa0<_0x9a0c9f[_0x0c53('0x19')];_0x565fa0++){if(_0x9a0c9f[_0x565fa0]['internalemailaddress']===_0x31ce99[_0x0c53('0x17')]&&!_0x9a0c9f[_0x565fa0][_0x0c53('0x1a')]){_0xc63d83=!![];logger['info']('['+[_0x36c5de[_0x0c53('0x10')]()]+_0x0c53('0x1b')+_0x9a0c9f[_0x565fa0]['systemuserid']+'!');_0x1df83e[_0x0c53('0x1c')]=_0x9a0c9f[_0x565fa0][_0x0c53('0x1d')];}}}}if(!_0xc63d83){logger[_0x0c53('0x1e')]('['+[_0x36c5de[_0x0c53('0x10')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1df83e[_0x0c53('0x18')]=_0x2ea7ce[_0x0c53('0x1f')];for(_0x565fa0=0x0;_0x565fa0<_0x9a0c9f[_0x0c53('0x19')];_0x565fa0++){if(_0x9a0c9f[_0x565fa0][_0x0c53('0x20')]===_0x2ea7ce[_0x0c53('0x1f')]){_0x1df83e[_0x0c53('0x1c')]=_0x9a0c9f[_0x565fa0][_0x0c53('0x1d')];}}}_0x3a2da1(_0x1df83e);})[_0x0c53('0xe')](function(_0x172bfe){_0x1e068c(_0x172bfe[_0x0c53('0x12')]);});});}function createEndUser(_0x1aab6a,_0x18f253,_0x2f046c,_0x54bf2c,_0x7bc6ae,_0x1290c8){return new BPromise(function(_0x59bf2d,_0x428f6d){return getAuthToken(_0x18f253,_0x2f046c,_0x1290c8)[_0x0c53('0xc')](function(_0x13d72a){var _0x50137c=_0x1290c8[_0x0c53('0x21')]()===_0x0c53('0x22')?_0x7bc6ae['destcalleridnum']:_0x7bc6ae[_0x0c53('0x23')];var _0x235f69={'method':_0x0c53('0x7'),'uri':_0x54bf2c+_0x0c53('0x24'),'body':{'telephone1':_0x50137c,'fullname':_0x50137c,'firstname':_0x50137c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0c53('0x25')+_0x1aab6a[_0x0c53('0x1c')]+')'},'headers':{'Authorization':_0x0c53('0x13')+_0x13d72a,'OData-Version':_0x0c53('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x235f69);})['then'](function(_0x3bc14a){var _0x24b363=_0x3bc14a['headers'][_0x0c53('0x26')];var _0x45bed0=_0x24b363['substring'](_0x24b363[_0x0c53('0x27')]('(')+0x1,_0x24b363[_0x0c53('0x27')](')'));_0x1aab6a['enduserId']=_0x45bed0;_0x59bf2d(_0x1aab6a);})[_0x0c53('0xe')](function(_0x28c66d){_0x428f6d(_0x28c66d[_0x0c53('0x12')]);});});}function getEndUser(_0x3cc961,_0x5f339a,_0x110bcb,_0xe86e81,_0x389bed,_0x531004){return new BPromise(function(_0x237efb,_0x21d719){var _0x186dbe=_0x531004[_0x0c53('0x21')]()===_0x0c53('0x22')?_0x389bed[_0x0c53('0x28')]:_0x389bed[_0x0c53('0x23')];return getAuthToken(_0x5f339a,_0x110bcb,_0x531004)['then'](function(_0x3facd0){var _0x18353f={'method':_0x0c53('0x29'),'uri':_0xe86e81+_0x0c53('0x2a')+_0x186dbe[_0x0c53('0x2b')]('+',_0x0c53('0x2c'))+'\x27','headers':{'Authorization':_0x0c53('0x13')+_0x3facd0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18353f);})[_0x0c53('0xc')](function(_0x194ef1){var _0xfed136=null;if(_0x194ef1){var _0x24e288=_0x194ef1[_0x0c53('0x15')];var _0x39c46f=![];for(_0xfed136=0x0;_0xfed136<_0x24e288['length'];_0xfed136++){if(_0x24e288[_0xfed136]['telephone1']===_0x186dbe){_0x39c46f=!![];_0x3cc961[_0x0c53('0x2d')]=_0x24e288[_0xfed136][_0x0c53('0x2e')];}}if(_0x39c46f){_0x237efb(_0x3cc961);}else{return createEndUser(_0x3cc961,_0x5f339a,_0x110bcb,_0xe86e81,_0x389bed,_0x531004)[_0x0c53('0xc')](function(_0x24ceec){logger[_0x0c53('0x1e')]('['+[_0x531004[_0x0c53('0x10')]()]+_0x0c53('0x2f'),_0x24ceec[_0x0c53('0x2d')]);_0x237efb(_0x24ceec);});}}else{return createEndUser(_0x3cc961,_0x5f339a,_0x110bcb,_0xe86e81,_0x389bed,_0x531004)[_0x0c53('0xc')](function(_0x1e07a8){logger[_0x0c53('0x1e')]('['+[_0x531004[_0x0c53('0x10')]()]+_0x0c53('0x30'),_0x1e07a8['enduserId']);_0x237efb(_0x1e07a8);});}});});}function getCustomFields(_0x13135e,_0xef970e,_0x493510){var _0x4e2175={};if(_0x13135e[_0x0c53('0x19')]>0x0){_[_0x0c53('0x31')](_0x13135e,function(_0x1864c0){if(_[_0x0c53('0x32')](['string',_0x0c53('0x33')],_0x1864c0['type'])&&_0x1864c0[_0x0c53('0x34')]&&!_0x1864c0[_0x0c53('0x35')]){var _0x32612e=_0x1864c0[_0x0c53('0x36')][_0x0c53('0x21')]();var _0x19be94=_0x32612e['substring'](0x0,_0x32612e[_0x0c53('0x37')]('_'));var _0x26e03b=_0x32612e['substring'](_0x32612e[_0x0c53('0x37')]('_')+0x1);if(_0x19be94===_0x493510){_0x4e2175[_0x26e03b]=_0x1864c0[_0x0c53('0x38')];}}});}return _0x4e2175;}function getTicket(_0x2afb81,_0x37a485,_0x5656c6,_0x42b85f,_0x2e1f91,_0x515531,_0x44c691){return new BPromise(function(_0x9136ac,_0x3fc96a){var _0x5cca17;return getAuthToken(_0x37a485,_0x5656c6,_0x44c691)[_0x0c53('0xc')](function(_0x15a2e1){if(_0x515531[_0x0c53('0x39')]===_0x0c53('0x3a')){_0x5cca17={'method':'POST','uri':_0x42b85f+_0x0c53('0x3b'),'body':Object[_0x0c53('0x3c')]({},{'title':intUtil[_0x0c53('0x3d')](_0x515531['Subjects'],_0x2e1f91,'\x20'),'description':intUtil[_0x0c53('0x3d')](_0x515531['Descriptions'],_0x2e1f91,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x2afb81[_0x0c53('0x2d')]+')','ownerid@odata.bind':_0x0c53('0x25')+_0x2afb81[_0x0c53('0x1c')]+')','caseorigincode':'1'},getCustomFields(_0x515531['Fields'],_0x2e1f91,_0x515531[_0x0c53('0x39')])),'headers':{'Authorization':_0x0c53('0x13')+_0x15a2e1,'OData-Version':_0x0c53('0x14')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x515531['ticketType']===_0x0c53('0x3e')){_0x5cca17={'method':_0x0c53('0x7'),'uri':_0x42b85f+_0x0c53('0x3f'),'body':Object[_0x0c53('0x3c')]({},{'subject':intUtil[_0x0c53('0x3d')](_0x515531[_0x0c53('0x40')],_0x2e1f91,'\x20'),'phonenumber':String(_0x2e1f91['calleridnum']),'description':intUtil[_0x0c53('0x3d')](_0x515531[_0x0c53('0x41')],_0x2e1f91,'\x0a'),'regardingobjectid_contact@odata.bind':_0x0c53('0x42')+_0x2afb81['enduserId']+')','ownerid@odata.bind':_0x0c53('0x25')+_0x2afb81['userId']+')','directioncode':_0x2afb81['callDirection']===_0x0c53('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x0c53('0x25')+_0x2afb81[_0x0c53('0x1c')]+')','participationtypemask':_0x2afb81['callDirection']===_0x0c53('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0x0c53('0x42')+_0x2afb81[_0x0c53('0x2d')]+')','participationtypemask':_0x2afb81['callDirection']===_0x0c53('0x43')?0x1:0x2}]},getCustomFields(_0x515531[_0x0c53('0x44')],_0x2e1f91,_0x515531[_0x0c53('0x39')])),'headers':{'Authorization':_0x0c53('0x13')+_0x15a2e1,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5cca17);})[_0x0c53('0xc')](function(_0x37ad51){var _0x4ccdcb=_0x37ad51['headers'][_0x0c53('0x26')];var _0x5e09b9=_0x4ccdcb[_0x0c53('0x45')](_0x4ccdcb[_0x0c53('0x27')]('(')+0x1,_0x4ccdcb[_0x0c53('0x27')](')'));_0x2afb81[_0x0c53('0x46')]=_0x5e09b9;_0x9136ac(_0x2afb81);})['catch'](function(_0xfae1e4){_0x3fc96a(_0xfae1e4['message']);});});}function emit(_0x15206b,_0x201629,_0x1c6700,_0x3d479c){var _0x5374f5={'uri':util[_0x0c53('0x47')](_0x0c53('0x48'),_0x15206b,_0x1c6700,_0x3d479c)};io['to'](util[_0x0c53('0x47')](_0x0c53('0x49'),_0x201629))['emit']('trigger:browser:url',_0x5374f5);}exports['cs']=function(_0x4dee3a,_0x3f6ed5,_0x141d71,_0x503c1c,_0x4b898e,_0x3d5e48,_0x393e76,_0x4e6387){var _0x5035c7={};_0x3d5e48[_0x0c53('0x9')]=intUtil['stripTrailingSlash'](_0x3d5e48[_0x0c53('0x9')]);_0x3d5e48[_0x0c53('0x4a')]=intUtil['stripTrailingSlash'](_0x3d5e48['serverUrl']);_0x5035c7[_0x0c53('0x4b')]=_0x4e6387===_0x0c53('0x43')||_0x4e6387===_0x0c53('0x4c')?_0x0c53('0x43'):_0x0c53('0x22');var _0x53902b=util['format'](_0x0c53('0x4d'),_0x3d5e48[_0x0c53('0x9')]);var _0x2c8d7c=util[_0x0c53('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3d5e48[_0x0c53('0x4e')]);var _0x10a86b=util[_0x0c53('0x47')](_0x0c53('0x4f'),_0x3d5e48[_0x0c53('0x4a')],_0x3f6ed5['uniqueid'],md5(_0x3f6ed5['uniqueid']));if(_0x4b898e&&_0x4b898e[_0x0c53('0x50')]){logger[_0x0c53('0x1e')](_0x0c53('0x51'),'Recording\x20is\x20enabled!');_0x3f6ed5[_0x0c53('0x52')]=_0x10a86b;}else if(_0x393e76&&_0x393e76[_0x0c53('0x53')]&&_0x393e76[_0x0c53('0x53')]!=='none'){logger[_0x0c53('0x1e')](_0x0c53('0x54'),'Recording\x20is\x20enabled!');_0x3f6ed5['recordingURL']=_0x10a86b;}else{_0x3f6ed5[_0x0c53('0x52')]='';}return getUser(_0x5035c7,_0x3d5e48,_0x503c1c,_0x2c8d7c,_0x53902b,_0x4e6387)[_0x0c53('0xc')](function(_0x1e5e80){logger[_0x0c53('0x1e')]('['+_0x4e6387[_0x0c53('0x10')]()+_0x0c53('0x55'),_0x1e5e80[_0x0c53('0x1c')]);logger[_0x0c53('0x1e')]('['+_0x4e6387[_0x0c53('0x10')]()+_0x0c53('0x56'),_0x1e5e80['userEmail']);return getEndUser(_0x1e5e80,_0x3d5e48,_0x2c8d7c,_0x53902b,_0x3f6ed5,_0x4e6387);})[_0x0c53('0xc')](function(_0x164ef4){logger[_0x0c53('0x1e')]('['+_0x4e6387[_0x0c53('0x10')]()+_0x0c53('0x57'),_0x164ef4[_0x0c53('0x2d')]);logger[_0x0c53('0x1e')]('['+_0x4e6387[_0x0c53('0x10')]()+_0x0c53('0x58'),_0x3f6ed5[_0x0c53('0x23')]);return getTicket(_0x164ef4,_0x3d5e48,_0x2c8d7c,_0x53902b,_0x3f6ed5,_0x141d71,_0x4e6387);})['then'](function(_0x478181){logger['info'](util[_0x0c53('0x47')]('['+_0x4e6387[_0x0c53('0x10')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x141d71['ticketType'],_0x478181['ticketId']));logger[_0x0c53('0x1e')](util[_0x0c53('0x47')]('['+_0x4e6387[_0x0c53('0x10')]()+_0x0c53('0x59'),_0x4e6387));if(_0x4e6387!==_0x0c53('0x4c')){logger['info']('['+_0x4e6387[_0x0c53('0x10')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3d5e48[_0x0c53('0x9')],_0x503c1c[_0x0c53('0x5a')],_0x141d71['ticketType'],_0x478181[_0x0c53('0x46')]);}})['catch'](function(_0x31adad){logger[_0x0c53('0xf')]('['+_0x4e6387[_0x0c53('0x10')]()+_0x0c53('0x5b'),util['inspect'](_0x31adad,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x75a8=['name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','then','access_token','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled',']\x20Agent\x20found\x20',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','userId','systemuserid','message','outbound','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','telephone1','info','forEach','includes','string','picklist','nameField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','/contacts(','callDirection','queue','ticketId','format','user:%s','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!','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...'];(function(_0x19488e,_0x20ae6b){var _0x255e3d=function(_0x1ca994){while(--_0x1ca994){_0x19488e['push'](_0x19488e['shift']());}};_0x255e3d(++_0x20ae6b);}(_0x75a8,0x1f2));var _0x875a=function(_0x41b667,_0x560d84){_0x41b667=_0x41b667-0x0;var _0x37cca7=_0x75a8[_0x41b667];return _0x37cca7;};'use strict';var _=require(_0x875a('0x0'));var BPromise=require('bluebird');var rp=require(_0x875a('0x1'));var util=require(_0x875a('0x2'));var intUtil=require(_0x875a('0x3'));var md5=require(_0x875a('0x4'));var Redis=require(_0x875a('0x5'));var logger=require(_0x875a('0x6'))(_0x875a('0x7'));var config=require(_0x875a('0x8'));config[_0x875a('0x9')]=_['defaults'](config[_0x875a('0x9')],{'host':_0x875a('0xa'),'port':0x18eb});var io=require(_0x875a('0xb'))(new Redis(config[_0x875a('0x9')]));function getAuthToken(_0x288a46,_0x530839,_0x1f9002){var _0x313c21={'method':_0x875a('0xc'),'uri':_0x530839,'form':{'client_id':_0x288a46[_0x875a('0xd')],'resource':_0x288a46[_0x875a('0xe')],'username':_0x288a46[_0x875a('0xf')],'password':_0x288a46[_0x875a('0x10')],'grant_type':_0x875a('0x10'),'client_secret':_0x288a46['clientSecret']},'json':!![]};return rp(_0x313c21)[_0x875a('0x11')](function(_0x351f07){return _0x351f07[_0x875a('0x12')];})[_0x875a('0x13')](function(_0x1be538){logger[_0x875a('0x14')]('['+[_0x1f9002[_0x875a('0x15')]()]+']\x20Wrong\x20credentials!');return _0x1be538['message'];});}function getUser(_0x2e676b,_0xe5789f,_0x1bbab0,_0x5afdc2,_0x2712e4,_0x52efd3){return new BPromise(function(_0x374209,_0x12a975){return getAuthToken(_0xe5789f,_0x5afdc2,_0x52efd3)[_0x875a('0x11')](function(_0x12971e){var _0x1e1965={'method':_0x875a('0x16'),'uri':_0x2712e4+_0x875a('0x17'),'headers':{'Authorization':_0x875a('0x18')+_0x12971e,'OData-Version':_0x875a('0x19')},'json':!![]};return rp(_0x1e1965);})['then'](function(_0x37cb2c){var _0x564613=_0x37cb2c[_0x875a('0x1a')];var _0x44e2bd=![];var _0x5a1e52=null;if(!_[_0x875a('0x1b')](_0x1bbab0)){if(intUtil[_0x875a('0x1c')](_0x1bbab0[_0x875a('0x1d')])){_0x2e676b[_0x875a('0x1e')]=_0x1bbab0[_0x875a('0x1d')];for(_0x5a1e52=0x0;_0x5a1e52<_0x564613['length'];_0x5a1e52++){if(_0x564613[_0x5a1e52][_0x875a('0x1f')]===_0x1bbab0['email']&&!_0x564613[_0x5a1e52][_0x875a('0x20')]){_0x44e2bd=!![];logger['info']('['+[_0x52efd3[_0x875a('0x15')]()]+_0x875a('0x21')+_0x564613[_0x5a1e52]['systemuserid']+'!');_0x2e676b['userId']=_0x564613[_0x5a1e52]['systemuserid'];}}}}if(!_0x44e2bd){logger['info']('['+[_0x52efd3[_0x875a('0x15')]()]+_0x875a('0x22'));_0x2e676b[_0x875a('0x1e')]=_0xe5789f[_0x875a('0xf')];for(_0x5a1e52=0x0;_0x5a1e52<_0x564613[_0x875a('0x23')];_0x5a1e52++){if(_0x564613[_0x5a1e52][_0x875a('0x1f')]===_0xe5789f['username']){_0x2e676b[_0x875a('0x24')]=_0x564613[_0x5a1e52][_0x875a('0x25')];}}}_0x374209(_0x2e676b);})['catch'](function(_0x166366){_0x12a975(_0x166366[_0x875a('0x26')]);});});}function createEndUser(_0x28dfb8,_0x309629,_0xc0edc9,_0xb8ca26,_0x201795,_0x3fd154){return new BPromise(function(_0xe647b8,_0x52927e){return getAuthToken(_0x309629,_0xc0edc9,_0x3fd154)[_0x875a('0x11')](function(_0x419f7d){var _0x1baf1d=_0x3fd154['toLowerCase']()===_0x875a('0x27')?_0x201795[_0x875a('0x28')]:_0x201795[_0x875a('0x29')];var _0x364406={'method':_0x875a('0xc'),'uri':_0xb8ca26+'contacts','body':{'telephone1':_0x1baf1d,'fullname':_0x1baf1d,'firstname':_0x1baf1d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x875a('0x2a')+_0x28dfb8[_0x875a('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x419f7d,'OData-Version':_0x875a('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x364406);})['then'](function(_0x1661fa){var _0x5d2f49=_0x1661fa[_0x875a('0x2b')][_0x875a('0x2c')];var _0x45ae31=_0x5d2f49[_0x875a('0x2d')](_0x5d2f49[_0x875a('0x2e')]('(')+0x1,_0x5d2f49[_0x875a('0x2e')](')'));_0x28dfb8[_0x875a('0x2f')]=_0x45ae31;_0xe647b8(_0x28dfb8);})['catch'](function(_0x165699){_0x52927e(_0x165699[_0x875a('0x26')]);});});}function getEndUser(_0x2f2e3d,_0x16b457,_0x128fd1,_0x50712b,_0x4d01c9,_0x286498){return new BPromise(function(_0x32278d,_0x2d0765){var _0x342e8e=_0x286498[_0x875a('0x30')]()===_0x875a('0x27')?_0x4d01c9[_0x875a('0x28')]:_0x4d01c9['calleridnum'];return getAuthToken(_0x16b457,_0x128fd1,_0x286498)[_0x875a('0x11')](function(_0x2fecc2){var _0x2101f6={'method':_0x875a('0x16'),'uri':_0x50712b+_0x875a('0x31')+_0x342e8e[_0x875a('0x32')]('+','%2b')+'\x27','headers':{'Authorization':_0x875a('0x18')+_0x2fecc2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2101f6);})['then'](function(_0x29dbe5){var _0x4ee13e=null;if(_0x29dbe5){var _0x2bb4fc=_0x29dbe5[_0x875a('0x1a')];var _0x3c6638=![];for(_0x4ee13e=0x0;_0x4ee13e<_0x2bb4fc[_0x875a('0x23')];_0x4ee13e++){if(_0x2bb4fc[_0x4ee13e][_0x875a('0x33')]===_0x342e8e){_0x3c6638=!![];_0x2f2e3d[_0x875a('0x2f')]=_0x2bb4fc[_0x4ee13e]['contactid'];}}if(_0x3c6638){_0x32278d(_0x2f2e3d);}else{return createEndUser(_0x2f2e3d,_0x16b457,_0x128fd1,_0x50712b,_0x4d01c9,_0x286498)[_0x875a('0x11')](function(_0x21669d){logger[_0x875a('0x34')]('['+[_0x286498[_0x875a('0x15')]()]+']\x20Enduser\x20created!',_0x21669d[_0x875a('0x2f')]);_0x32278d(_0x21669d);});}}else{return createEndUser(_0x2f2e3d,_0x16b457,_0x128fd1,_0x50712b,_0x4d01c9,_0x286498)[_0x875a('0x11')](function(_0x521140){logger[_0x875a('0x34')]('['+[_0x286498['toUpperCase']()]+']\x20Enduser\x20Created!',_0x521140['enduserId']);_0x32278d(_0x521140);});}});});}function getCustomFields(_0x1b177d,_0x344fc4,_0x2a2251){var _0x25e1bb={};if(_0x1b177d['length']>0x0){_[_0x875a('0x35')](_0x1b177d,function(_0x46e7c1){if(_[_0x875a('0x36')]([_0x875a('0x37'),_0x875a('0x38')],_0x46e7c1['type'])&&_0x46e7c1[_0x875a('0x39')]&&!_0x46e7c1['customField']){var _0x5dd2fb=_0x46e7c1['idField'][_0x875a('0x30')]();var _0x1fdd3d=_0x5dd2fb[_0x875a('0x2d')](0x0,_0x5dd2fb[_0x875a('0x3a')]('_'));var _0x31ea36=_0x5dd2fb[_0x875a('0x2d')](_0x5dd2fb['indexOf']('_')+0x1);if(_0x1fdd3d===_0x2a2251){_0x25e1bb[_0x31ea36]=_0x46e7c1[_0x875a('0x3b')];}}});}return _0x25e1bb;}function getTicket(_0x572969,_0x1a10ba,_0x531946,_0x4facf7,_0x14e99b,_0x158190,_0x1ba1b5){return new BPromise(function(_0x3e2ec6,_0x1c5002){var _0x22564e;return getAuthToken(_0x1a10ba,_0x531946,_0x1ba1b5)[_0x875a('0x11')](function(_0x408e96){if(_0x158190[_0x875a('0x3c')]===_0x875a('0x3d')){_0x22564e={'method':_0x875a('0xc'),'uri':_0x4facf7+_0x875a('0x3e'),'body':Object[_0x875a('0x3f')]({},{'title':intUtil[_0x875a('0x40')](_0x158190[_0x875a('0x41')],_0x14e99b,'\x20'),'description':intUtil['getString'](_0x158190[_0x875a('0x42')],_0x14e99b,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x572969[_0x875a('0x2f')]+')','ownerid@odata.bind':_0x875a('0x2a')+_0x572969[_0x875a('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x158190[_0x875a('0x43')],_0x14e99b,_0x158190[_0x875a('0x3c')])),'headers':{'Authorization':_0x875a('0x18')+_0x408e96,'OData-Version':_0x875a('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x158190[_0x875a('0x3c')]===_0x875a('0x44')){_0x22564e={'method':_0x875a('0xc'),'uri':_0x4facf7+_0x875a('0x45'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x158190[_0x875a('0x41')],_0x14e99b,'\x20'),'phonenumber':String(_0x14e99b[_0x875a('0x29')]),'description':intUtil[_0x875a('0x40')](_0x158190[_0x875a('0x42')],_0x14e99b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x875a('0x46')+_0x572969[_0x875a('0x2f')]+')','ownerid@odata.bind':_0x875a('0x2a')+_0x572969[_0x875a('0x24')]+')','directioncode':_0x572969[_0x875a('0x47')]===_0x875a('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x572969[_0x875a('0x24')]+')','participationtypemask':_0x572969[_0x875a('0x47')]===_0x875a('0x48')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x572969[_0x875a('0x2f')]+')','participationtypemask':_0x572969[_0x875a('0x47')]===_0x875a('0x48')?0x1:0x2}]},getCustomFields(_0x158190[_0x875a('0x43')],_0x14e99b,_0x158190[_0x875a('0x3c')])),'headers':{'Authorization':_0x875a('0x18')+_0x408e96,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x22564e);})[_0x875a('0x11')](function(_0xb48472){var _0xbbf07f=_0xb48472[_0x875a('0x2b')][_0x875a('0x2c')];var _0x51dc42=_0xbbf07f[_0x875a('0x2d')](_0xbbf07f[_0x875a('0x2e')]('(')+0x1,_0xbbf07f[_0x875a('0x2e')](')'));_0x572969[_0x875a('0x49')]=_0x51dc42;_0x3e2ec6(_0x572969);})[_0x875a('0x13')](function(_0x20ef99){_0x1c5002(_0x20ef99['message']);});});}function emit(_0x2272d8,_0x133f1e,_0x4f00da,_0x2ceffb){var _0x41a8b8={'uri':util[_0x875a('0x4a')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x2272d8,_0x4f00da,_0x2ceffb)};io['to'](util[_0x875a('0x4a')](_0x875a('0x4b'),_0x133f1e))['emit'](_0x875a('0x4c'),_0x41a8b8);}exports['cs']=function(_0xe6fa9,_0x1f7f18,_0x1f1c9c,_0x2f8a51,_0x4048db,_0x589219,_0x250656,_0x18a939){var _0x961d64={};_0x589219['remoteUri']=intUtil[_0x875a('0x4d')](_0x589219[_0x875a('0xe')]);_0x589219[_0x875a('0x4e')]=intUtil[_0x875a('0x4d')](_0x589219[_0x875a('0x4e')]);_0x961d64['callDirection']=_0x18a939==='queue'||_0x18a939==='unmanaged'?_0x875a('0x48'):_0x875a('0x27');var _0x3f0beb=util[_0x875a('0x4a')](_0x875a('0x4f'),_0x589219['remoteUri']);var _0x400b58=util['format'](_0x875a('0x50'),_0x589219[_0x875a('0x51')]);var _0x1330cf=util[_0x875a('0x4a')](_0x875a('0x52'),_0x589219[_0x875a('0x4e')],_0x1f7f18['uniqueid'],md5(_0x1f7f18['uniqueid']));if(_0x4048db&&_0x4048db[_0x875a('0x53')]){logger[_0x875a('0x34')](_0x875a('0x54'),_0x875a('0x55'));_0x1f7f18['recordingURL']=_0x1330cf;}else if(_0x250656&&_0x250656[_0x875a('0x56')]&&_0x250656[_0x875a('0x56')]!==_0x875a('0x57')){logger[_0x875a('0x34')](_0x875a('0x58'),'Recording\x20is\x20enabled!');_0x1f7f18['recordingURL']=_0x1330cf;}else{_0x1f7f18['recordingURL']='';}return getUser(_0x961d64,_0x589219,_0x2f8a51,_0x400b58,_0x3f0beb,_0x18a939)['then'](function(_0x23eb2d){logger[_0x875a('0x34')]('['+_0x18a939[_0x875a('0x15')]()+_0x875a('0x59'),_0x23eb2d[_0x875a('0x24')]);logger['info']('['+_0x18a939[_0x875a('0x15')]()+_0x875a('0x5a'),_0x23eb2d[_0x875a('0x1e')]);return getEndUser(_0x23eb2d,_0x589219,_0x400b58,_0x3f0beb,_0x1f7f18,_0x18a939);})[_0x875a('0x11')](function(_0x5e6694){logger[_0x875a('0x34')]('['+_0x18a939[_0x875a('0x15')]()+_0x875a('0x5b'),_0x5e6694[_0x875a('0x2f')]);logger[_0x875a('0x34')]('['+_0x18a939['toUpperCase']()+_0x875a('0x5c'),_0x1f7f18[_0x875a('0x29')]);return getTicket(_0x5e6694,_0x589219,_0x400b58,_0x3f0beb,_0x1f7f18,_0x1f1c9c,_0x18a939);})[_0x875a('0x11')](function(_0x5c821e){logger[_0x875a('0x34')](util[_0x875a('0x4a')]('['+_0x18a939[_0x875a('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x1f1c9c[_0x875a('0x3c')],_0x5c821e['ticketId']));logger['info'](util[_0x875a('0x4a')]('['+_0x18a939[_0x875a('0x15')]()+_0x875a('0x5d'),_0x18a939));if(_0x18a939!==_0x875a('0x5e')){logger[_0x875a('0x34')]('['+_0x18a939['toUpperCase']()+']',_0x875a('0x5f'));emit(_0x589219['remoteUri'],_0x2f8a51[_0x875a('0x60')],_0x1f1c9c[_0x875a('0x3c')],_0x5c821e[_0x875a('0x49')]);}})[_0x875a('0x13')](function(_0x37e91f){logger['error']('['+_0x18a939[_0x875a('0x15')]()+_0x875a('0x61'),util[_0x875a('0x62')](_0x37e91f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index b3a4a64..3521f2b 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 _0x25de=['Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','debug','stringify','GET','map','forEach','string','customField','nameField','toLowerCase','content','picklist','type','idField','push','variable','variableName','Variable','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','
'];(function(_0x882014,_0x4774d5){var _0x34aa1f=function(_0x2405e2){while(--_0x2405e2){_0x882014['push'](_0x882014['shift']());}};_0x34aa1f(++_0x4774d5);}(_0x25de,0xa4));var _0xe25d=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x25de[_0x44c974];return _0x5214c6;};'use strict';var _=require(_0xe25d('0x0'));var rp=require('request-promise');var md5=require(_0xe25d('0x1'));var util=require(_0xe25d('0x2'));var Redis=require(_0xe25d('0x3'));var intUtil=require(_0xe25d('0x4'));var config=require('../../../../config/environment');var logger=require(_0xe25d('0x5'))(_0xe25d('0x6'));config[_0xe25d('0x7')]=_['defaults'](config[_0xe25d('0x7')],{'host':_0xe25d('0x8'),'port':0x18eb});var io=require(_0xe25d('0x9'))(new Redis(config[_0xe25d('0x7')]));var headers={'Content-Type':'application/json','Accept':_0xe25d('0xa')};function emit(_0x24780d,_0x493fa6,_0x546a54){io['to'](_0x24780d)[_0xe25d('0xb')](_0x493fa6,_0x546a54);}function getTicket(_0x39d203,_0x5b863a,_0x4175bc,_0x297754,_0x127f1a){logger[_0xe25d('0xc')](_0xe25d('0xd'));var _0x4a89be=_[_0xe25d('0xe')]({'responder_id':_0x5b863a['id'],'requester_id':_0x4175bc['id'],'name':util[_0xe25d('0xf')](_0xe25d('0x10'),_0x127f1a['calleridname']),'phone':_0x127f1a[_0xe25d('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x297754[_0xe25d('0x12')],_0x127f1a,'\x20'),'description':intUtil[_0xe25d('0x13')](_0x297754[_0xe25d('0x14')],_0x127f1a,_0xe25d('0x15')),'tags':getTags(_0x297754[_0xe25d('0x16')],_0xe25d('0x17'))},getCustomFields(_0x297754[_0xe25d('0x18')],_0x127f1a));_0x4a89be[_0xe25d('0x19')]=_[_0xe25d('0x1a')](_[_0xe25d('0x1b')](_0x4a89be['custom_fields'],'id'),_0xe25d('0x1c'));return request({'uri':util[_0xe25d('0xf')](_0xe25d('0x1d'),_0x39d203[_0xe25d('0x1e')]),'method':_0xe25d('0x1f'),'body':_0x4a89be})[_0xe25d('0x20')](function(_0x22e4c4){logger[_0xe25d('0xc')](_0xe25d('0x21'));return _0x22e4c4;});}function getUser(_0x317374,_0x4fffc7){if(intUtil['validateEmail'](_0x4fffc7)){return request({'uri':util[_0xe25d('0xf')](_0xe25d('0x22'),_0x317374[_0xe25d('0x1e')]),'qs':{'email':_0x4fffc7}})[_0xe25d('0x20')](function(_0x583c66){if(_0x583c66[_0xe25d('0x23')]){logger[_0xe25d('0xc')]('Agent\x20found!');return _[_0xe25d('0x24')](_0x583c66,function(_0x40ea50){return _0x40ea50[_0xe25d('0x25')][_0xe25d('0x26')]===_0x4fffc7;});}else{logger[_0xe25d('0xc')](_0xe25d('0x27'));return request({'uri':util[_0xe25d('0xf')]('%s/api/v2/agents/me',_0x317374[_0xe25d('0x1e')])})[_0xe25d('0x20')](function(_0x329083){logger[_0xe25d('0xc')](_0xe25d('0x28'));return _0x329083;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe25d('0xf')](_0xe25d('0x29'),_0x317374[_0xe25d('0x1e')])})[_0xe25d('0x20')](function(_0x2586d9){logger[_0xe25d('0xc')](_0xe25d('0x28'));return _0x2586d9;});}}function getEndUser(_0x5a8da1,_0x22632b,_0x5523b2){logger[_0xe25d('0xc')]('Searching\x20enduser\x20with\x20phone',_0x5523b2);return request({'uri':util['format']('%s/api/v2/contacts',_0x5a8da1[_0xe25d('0x1e')]),'qs':{'phone':_0x5523b2}})[_0xe25d('0x20')](function(_0x434465){if(_0x434465[_0xe25d('0x23')]){logger[_0xe25d('0xc')](_0xe25d('0x2a'));return _[_0xe25d('0x24')](_0x434465,{'phone':_0x5523b2});}else{logger[_0xe25d('0xc')](_0xe25d('0x2b'));return request({'uri':util[_0xe25d('0xf')]('%s/api/v2/contacts',_0x5a8da1[_0xe25d('0x1e')]),'method':'POST','body':{'name':_0x22632b,'phone':_0x5523b2}})['then'](function(_0x190a85){logger[_0xe25d('0xc')]('Enduser\x20created.');return _0x190a85;});}});}function getAuth(_0x530187){return util['format'](_0xe25d('0x2c'),new Buffer(_0x530187[_0xe25d('0x2d')]+':X')[_0xe25d('0x2e')]('base64'));}function request(_0x35ac88){logger[_0xe25d('0x2f')]('[HTTP]',JSON[_0xe25d('0x30')](_0x35ac88));return rp(_['defaults'](_0x35ac88,{'method':_0xe25d('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x263ba4,_0x1784bf){var _0x23eba9=[];if(_0x263ba4&&_0x263ba4[_0xe25d('0x23')]>0x0){_0x23eba9=_[_0xe25d('0x32')](_0x263ba4,_0x1784bf);}return _0x23eba9;}function getCustomFields(_0x752101,_0x444cd9){var _0x102ebd=[];var _0x4796d6={'custom_fields':[]};if(_0x752101[_0xe25d('0x23')]>0x0){_[_0xe25d('0x33')](_0x752101,function(_0x153bef){if(_['includes']([_0xe25d('0x34'),'picklist'],_0x153bef['type'])&&_0x153bef['nameField']&&!_0x153bef[_0xe25d('0x35')]){_0x4796d6[_0x153bef[_0xe25d('0x36')][_0xe25d('0x37')]()]=_0x153bef[_0xe25d('0x38')][_0xe25d('0x2e')]();}else if(_['includes']([_0xe25d('0x34'),_0xe25d('0x39')],_0x153bef[_0xe25d('0x3a')])&&_0x153bef[_0xe25d('0x3b')]&&_0x153bef[_0xe25d('0x35')]){_0x4796d6[_0xe25d('0x19')][_0xe25d('0x3c')]({'id':_0x153bef[_0xe25d('0x3b')],'value':_0x153bef['content'][_0xe25d('0x2e')]()});}else if(_0x153bef[_0xe25d('0x3a')]===_0xe25d('0x3d')&&_0x153bef['variableName']&&_0x153bef[_0xe25d('0x3b')]&&_0x153bef[_0xe25d('0x35')]){_0x444cd9[_0x153bef[_0xe25d('0x3e')]]&&_0x4796d6[_0xe25d('0x19')][_0xe25d('0x3c')]({'id':_0x153bef[_0xe25d('0x3b')],'value':_0x444cd9[_0x153bef[_0xe25d('0x3e')]][_0xe25d('0x2e')]()});}else if(_0x153bef[_0xe25d('0x3a')]==='customVariable'&&_0x153bef[_0xe25d('0x3f')]&&_0x153bef[_0xe25d('0x3f')][_0xe25d('0x17')]&&_0x153bef[_0xe25d('0x3b')]&&_0x153bef[_0xe25d('0x35')]){_0x444cd9[_0x153bef[_0xe25d('0x3f')][_0xe25d('0x17')][_0xe25d('0x37')]()]&&_0x4796d6[_0xe25d('0x19')][_0xe25d('0x3c')]({'id':_0x153bef['idField'],'value':_0x444cd9[_0x153bef[_0xe25d('0x3f')][_0xe25d('0x17')][_0xe25d('0x37')]()]['toString']()});}});}return _0x4796d6;}exports[_0xe25d('0x40')]=function(_0x523bda,_0x4cca7b,_0x5613ec,_0x20cd35,_0x2803f2,_0x24d1b0){var _0x2ac814,_0x29b040;_0x24d1b0['remoteUri']=intUtil['stripTrailingSlash'](_0x24d1b0['remoteUri']);_0x24d1b0['serverUrl']=intUtil['stripTrailingSlash'](_0x24d1b0[_0xe25d('0x41')]);if(_0x2803f2&&_0x2803f2[_0xe25d('0x42')]){logger[_0xe25d('0xc')](_0xe25d('0x43'),_0xe25d('0x44'));_0x4cca7b[_0xe25d('0x45')]=util[_0xe25d('0xf')](_0xe25d('0x46'),_0x24d1b0[_0xe25d('0x41')],_0x4cca7b[_0xe25d('0x47')],md5(_0x4cca7b['uniqueid']));}else{_0x4cca7b[_0xe25d('0x45')]='';}headers[_0xe25d('0x48')]=getAuth(_0x24d1b0);return getUser(_0x24d1b0,_0x20cd35[_0xe25d('0x26')])[_0xe25d('0x20')](function(_0x9e4ea0){_0x2ac814=_0x9e4ea0;logger[_0xe25d('0xc')](_0xe25d('0x49'),_0x2ac814['id']);return getEndUser(_0x24d1b0,_0x4cca7b[_0xe25d('0x4a')],_0x4cca7b['calleridnum']);})[_0xe25d('0x20')](function(_0x5dbd53){_0x29b040=_0x5dbd53;logger[_0xe25d('0xc')](_0xe25d('0x4b'),_0x29b040['id']);return getTicket(_0x24d1b0,_0x2ac814,_0x29b040,_0x5613ec,_0x4cca7b);})['then'](function(_0x17567d){if(_0x17567d&&_0x17567d['id']){logger['info'](_0xe25d('0x21'));logger[_0xe25d('0xc')](_0xe25d('0x4c'),_0x17567d['id']);logger['info']('[QUEUE]',_0xe25d('0x4d'));emit(util[_0xe25d('0xf')](_0xe25d('0x4e'),_0x20cd35[_0xe25d('0x17')]),_0xe25d('0x4f'),{'uri':util[_0xe25d('0xf')](_0xe25d('0x50'),_0x24d1b0[_0xe25d('0x1e')],_0x17567d['id'])});}})[_0xe25d('0x51')](function(_0x1d7aa5){logger[_0xe25d('0x52')](_0xe25d('0x43'),JSON[_0xe25d('0x30')](_0x1d7aa5));});};exports[_0xe25d('0x53')]=function(_0x2d6233,_0x5a94a6,_0x2008be,_0xce4575,_0x295901,_0x4fa85b,_0x88ac2e){var _0x233201,_0x11aedd;_0x4fa85b[_0xe25d('0x1e')]=intUtil[_0xe25d('0x54')](_0x4fa85b[_0xe25d('0x1e')]);_0x4fa85b[_0xe25d('0x41')]=intUtil[_0xe25d('0x54')](_0x4fa85b[_0xe25d('0x41')]);if(_0x88ac2e&&_0x88ac2e[_0xe25d('0x55')]&&_0x88ac2e[_0xe25d('0x55')]!==_0xe25d('0x56')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5a94a6['recordingURL']=util[_0xe25d('0xf')](_0xe25d('0x46'),_0x4fa85b['serverUrl'],_0x5a94a6['uniqueid'],md5(_0x5a94a6[_0xe25d('0x47')]));}headers['Authorization']=getAuth(_0x4fa85b);return getUser(_0x4fa85b,_0xce4575['email'])['then'](function(_0x565c4a){_0x233201=_0x565c4a;logger[_0xe25d('0xc')](_0xe25d('0x49'),_0x233201['id']);return getEndUser(_0x4fa85b,_0x5a94a6[_0xe25d('0x57')],_0x5a94a6[_0xe25d('0x58')]);})[_0xe25d('0x20')](function(_0x3fb9c4){_0x11aedd=_0x3fb9c4;logger['info']('The\x20Enduser\x20ID\x20is:',_0x11aedd['id']);return getTicket(_0x4fa85b,_0x233201,_0x11aedd,_0x2008be,_0x5a94a6);})[_0xe25d('0x20')](function(_0x11e260){if(_0x11e260&&_0x11e260['id']){logger['info']('Ticket\x20created!');logger[_0xe25d('0xc')](_0xe25d('0x4c'),_0x11e260['id']);logger[_0xe25d('0xc')](_0xe25d('0x59'),_0xe25d('0x4d'));emit(util[_0xe25d('0xf')]('user:%s',_0xce4575[_0xe25d('0x17')]),_0xe25d('0x4f'),{'uri':util[_0xe25d('0xf')](_0xe25d('0x50'),_0x4fa85b[_0xe25d('0x1e')],_0x11e260['id'])});}})[_0xe25d('0x51')](function(_0x3823c2){logger[_0xe25d('0x52')](_0xe25d('0x59'),JSON[_0xe25d('0x30')](_0x3823c2));});};exports[_0xe25d('0x5a')]=function(_0x3ccddc,_0x2cfbaa,_0x223eea,_0x3c4edd,_0x35bc09,_0x562b01){var _0x39d371,_0x7a9b81;_0x562b01['remoteUri']=intUtil['stripTrailingSlash'](_0x562b01['remoteUri']);_0x562b01[_0xe25d('0x41')]=intUtil[_0xe25d('0x54')](_0x562b01['serverUrl']);if(_0x35bc09&&_0x35bc09[_0xe25d('0x42')]){logger[_0xe25d('0xc')]('['+_0x2cfbaa[_0xe25d('0x5b')][_0xe25d('0x5c')]()+']','Recording\x20is\x20enabled!');_0x2cfbaa[_0xe25d('0x45')]=util['format'](_0xe25d('0x46'),_0x562b01[_0xe25d('0x41')],_0x2cfbaa[_0xe25d('0x47')],md5(_0x2cfbaa['uniqueid']));}else{_0x2cfbaa[_0xe25d('0x45')]='';}headers['Authorization']=getAuth(_0x562b01);return getUser(_0x562b01,'')[_0xe25d('0x20')](function(_0x4f3bbc){_0x39d371=_0x4f3bbc;logger[_0xe25d('0xc')](_0xe25d('0x49'),_0x39d371['id']);return getEndUser(_0x562b01,_0x2cfbaa[_0xe25d('0x4a')],_0x2cfbaa[_0xe25d('0x11')]);})[_0xe25d('0x20')](function(_0xb5cba7){_0x7a9b81=_0xb5cba7;logger[_0xe25d('0xc')](_0xe25d('0x4b'),_0x7a9b81['id']);return getTicket(_0x562b01,_0x39d371,_0x7a9b81,_0x223eea,_0x2cfbaa);})[_0xe25d('0x20')](function(_0x5ebc44){if(_0x5ebc44){logger[_0xe25d('0xc')]('Ticket\x20created!');logger[_0xe25d('0xc')](_0xe25d('0x4c'),_0x5ebc44['id']);}})['catch'](function(_0x187982){logger['error']('['+_0x2cfbaa[_0xe25d('0x5b')][_0xe25d('0x5c')]()+']',JSON[_0xe25d('0x30')](_0x187982));});}; \ No newline at end of file +var _0xb139=['destcalleridnum','trigger:browser:url','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','info','Agent\x20found!','contact','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','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','picklist','type','nameField','customField','content','includes','push','variable','idField','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname'];(function(_0x1488e0,_0x2081ff){var _0x9ca7a=function(_0x26b430){while(--_0x26b430){_0x1488e0['push'](_0x1488e0['shift']());}};_0x9ca7a(++_0x2081ff);}(_0xb139,0x11d));var _0x9b13=function(_0x5fcd80,_0x1d6165){_0x5fcd80=_0x5fcd80-0x0;var _0x401201=_0xb139[_0x5fcd80];return _0x401201;};'use strict';var _=require(_0x9b13('0x0'));var rp=require(_0x9b13('0x1'));var md5=require(_0x9b13('0x2'));var util=require(_0x9b13('0x3'));var Redis=require(_0x9b13('0x4'));var intUtil=require(_0x9b13('0x5'));var config=require('../../../../config/environment');var logger=require(_0x9b13('0x6'))(_0x9b13('0x7'));config[_0x9b13('0x8')]=_[_0x9b13('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9b13('0xa'))(new Redis(config[_0x9b13('0x8')]));var headers={'Content-Type':_0x9b13('0xb'),'Accept':_0x9b13('0xb')};function emit(_0x36a370,_0x97ccb3,_0x4fc19a){io['to'](_0x36a370)['emit'](_0x97ccb3,_0x4fc19a);}function getTicket(_0x2682e6,_0x22cbd5,_0x19b17f,_0x570fbb,_0x1cdbda){logger['info'](_0x9b13('0xc'));var _0x136d5a=_[_0x9b13('0xd')]({'responder_id':_0x22cbd5['id'],'requester_id':_0x19b17f['id'],'name':util[_0x9b13('0xe')]('Caller\x20-\x20%s',_0x1cdbda[_0x9b13('0xf')]),'phone':_0x1cdbda[_0x9b13('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9b13('0x11')](_0x570fbb[_0x9b13('0x12')],_0x1cdbda,'\x20'),'description':intUtil[_0x9b13('0x11')](_0x570fbb[_0x9b13('0x13')],_0x1cdbda,_0x9b13('0x14')),'tags':getTags(_0x570fbb[_0x9b13('0x15')],_0x9b13('0x16'))},getCustomFields(_0x570fbb[_0x9b13('0x17')],_0x1cdbda));_0x136d5a['custom_fields']=_['mapValues'](_['keyBy'](_0x136d5a[_0x9b13('0x18')],'id'),'value');return request({'uri':util[_0x9b13('0xe')]('%s/api/v2/tickets',_0x2682e6[_0x9b13('0x19')]),'method':_0x9b13('0x1a'),'body':_0x136d5a})[_0x9b13('0x1b')](function(_0x4e6130){logger['info'](_0x9b13('0x1c'));return _0x4e6130;});}function getUser(_0x8a5242,_0x29ed47){if(intUtil[_0x9b13('0x1d')](_0x29ed47)){return request({'uri':util[_0x9b13('0xe')]('%s/api/v2/agents',_0x8a5242[_0x9b13('0x19')]),'qs':{'email':_0x29ed47}})[_0x9b13('0x1b')](function(_0x13f9db){if(_0x13f9db[_0x9b13('0x1e')]){logger[_0x9b13('0x1f')](_0x9b13('0x20'));return _['find'](_0x13f9db,function(_0x41ac8d){return _0x41ac8d[_0x9b13('0x21')][_0x9b13('0x22')]===_0x29ed47;});}else{logger[_0x9b13('0x1f')](_0x9b13('0x23'));return request({'uri':util['format'](_0x9b13('0x24'),_0x8a5242[_0x9b13('0x19')])})[_0x9b13('0x1b')](function(_0x4a160b){logger[_0x9b13('0x1f')](_0x9b13('0x25'));return _0x4a160b;});}});}else{logger[_0x9b13('0x1f')](_0x9b13('0x26'));return request({'uri':util[_0x9b13('0xe')]('%s/api/v2/agents/me',_0x8a5242[_0x9b13('0x19')])})[_0x9b13('0x1b')](function(_0x2cda59){logger[_0x9b13('0x1f')]('Admin\x20account\x20selected.');return _0x2cda59;});}}function getEndUser(_0x5e8669,_0x29c4e6,_0xca8974){logger['info'](_0x9b13('0x27'),_0xca8974);return request({'uri':util[_0x9b13('0xe')](_0x9b13('0x28'),_0x5e8669[_0x9b13('0x19')]),'qs':{'phone':_0xca8974}})['then'](function(_0x393f59){if(_0x393f59[_0x9b13('0x1e')]){logger[_0x9b13('0x1f')](_0x9b13('0x29'));return _['find'](_0x393f59,{'phone':_0xca8974});}else{logger[_0x9b13('0x1f')](_0x9b13('0x2a'));return request({'uri':util[_0x9b13('0xe')](_0x9b13('0x28'),_0x5e8669[_0x9b13('0x19')]),'method':'POST','body':{'name':_0x29c4e6,'phone':_0xca8974}})['then'](function(_0x25f1fa){logger[_0x9b13('0x1f')](_0x9b13('0x2b'));return _0x25f1fa;});}});}function getAuth(_0x4dd7cc){return util[_0x9b13('0xe')](_0x9b13('0x2c'),new Buffer(_0x4dd7cc['apiKey']+':X')[_0x9b13('0x2d')](_0x9b13('0x2e')));}function request(_0x3a2835){logger[_0x9b13('0x2f')](_0x9b13('0x30'),JSON[_0x9b13('0x31')](_0x3a2835));return rp(_[_0x9b13('0x9')](_0x3a2835,{'method':_0x9b13('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x11220d,_0x3946e3){var _0x2a58ab=[];if(_0x11220d&&_0x11220d[_0x9b13('0x1e')]>0x0){_0x2a58ab=_[_0x9b13('0x33')](_0x11220d,_0x3946e3);}return _0x2a58ab;}function getCustomFields(_0x55c056,_0x380bfa){var _0x1cec27=[];var _0xc2e4ac={'custom_fields':[]};if(_0x55c056[_0x9b13('0x1e')]>0x0){_[_0x9b13('0x34')](_0x55c056,function(_0x15f1e4){if(_['includes'](['string',_0x9b13('0x35')],_0x15f1e4[_0x9b13('0x36')])&&_0x15f1e4[_0x9b13('0x37')]&&!_0x15f1e4[_0x9b13('0x38')]){_0xc2e4ac[_0x15f1e4[_0x9b13('0x37')]['toLowerCase']()]=_0x15f1e4[_0x9b13('0x39')][_0x9b13('0x2d')]();}else if(_[_0x9b13('0x3a')](['string',_0x9b13('0x35')],_0x15f1e4[_0x9b13('0x36')])&&_0x15f1e4['idField']&&_0x15f1e4[_0x9b13('0x38')]){_0xc2e4ac[_0x9b13('0x18')][_0x9b13('0x3b')]({'id':_0x15f1e4['idField'],'value':_0x15f1e4[_0x9b13('0x39')][_0x9b13('0x2d')]()});}else if(_0x15f1e4['type']===_0x9b13('0x3c')&&_0x15f1e4['variableName']&&_0x15f1e4[_0x9b13('0x3d')]&&_0x15f1e4[_0x9b13('0x38')]){_0x380bfa[_0x15f1e4[_0x9b13('0x3e')]]&&_0xc2e4ac['custom_fields'][_0x9b13('0x3b')]({'id':_0x15f1e4[_0x9b13('0x3d')],'value':_0x380bfa[_0x15f1e4[_0x9b13('0x3e')]][_0x9b13('0x2d')]()});}else if(_0x15f1e4[_0x9b13('0x36')]==='customVariable'&&_0x15f1e4['Variable']&&_0x15f1e4[_0x9b13('0x3f')][_0x9b13('0x16')]&&_0x15f1e4['idField']&&_0x15f1e4['customField']){_0x380bfa[_0x15f1e4[_0x9b13('0x3f')][_0x9b13('0x16')][_0x9b13('0x40')]()]&&_0xc2e4ac['custom_fields'][_0x9b13('0x3b')]({'id':_0x15f1e4[_0x9b13('0x3d')],'value':_0x380bfa[_0x15f1e4[_0x9b13('0x3f')][_0x9b13('0x16')][_0x9b13('0x40')]()][_0x9b13('0x2d')]()});}});}return _0xc2e4ac;}exports[_0x9b13('0x41')]=function(_0x1d0914,_0x43b28b,_0x4c8f58,_0xa265ac,_0x3b55ab,_0x8df00f){var _0x3415e5,_0x3dc2cc;_0x8df00f[_0x9b13('0x19')]=intUtil[_0x9b13('0x42')](_0x8df00f[_0x9b13('0x19')]);_0x8df00f['serverUrl']=intUtil[_0x9b13('0x42')](_0x8df00f[_0x9b13('0x43')]);if(_0x3b55ab&&_0x3b55ab[_0x9b13('0x44')]){logger[_0x9b13('0x1f')](_0x9b13('0x45'),_0x9b13('0x46'));_0x43b28b['recordingURL']=util[_0x9b13('0xe')](_0x9b13('0x47'),_0x8df00f[_0x9b13('0x43')],_0x43b28b[_0x9b13('0x48')],md5(_0x43b28b['uniqueid']));}else{_0x43b28b[_0x9b13('0x49')]='';}headers[_0x9b13('0x4a')]=getAuth(_0x8df00f);return getUser(_0x8df00f,_0xa265ac[_0x9b13('0x22')])['then'](function(_0x30de54){_0x3415e5=_0x30de54;logger[_0x9b13('0x1f')](_0x9b13('0x4b'),_0x3415e5['id']);return getEndUser(_0x8df00f,_0x43b28b[_0x9b13('0xf')],_0x43b28b[_0x9b13('0x10')]);})[_0x9b13('0x1b')](function(_0x559547){_0x3dc2cc=_0x559547;logger[_0x9b13('0x1f')]('The\x20Enduser\x20ID\x20is:',_0x3dc2cc['id']);return getTicket(_0x8df00f,_0x3415e5,_0x3dc2cc,_0x4c8f58,_0x43b28b);})['then'](function(_0x243ea9){if(_0x243ea9&&_0x243ea9['id']){logger[_0x9b13('0x1f')](_0x9b13('0x1c'));logger[_0x9b13('0x1f')](_0x9b13('0x4c'),_0x243ea9['id']);logger[_0x9b13('0x1f')](_0x9b13('0x45'),_0x9b13('0x4d'));emit(util[_0x9b13('0xe')](_0x9b13('0x4e'),_0xa265ac['name']),'trigger:browser:url',{'uri':util[_0x9b13('0xe')](_0x9b13('0x4f'),_0x8df00f[_0x9b13('0x19')],_0x243ea9['id'])});}})[_0x9b13('0x50')](function(_0x3f66dc){logger[_0x9b13('0x51')](_0x9b13('0x45'),JSON[_0x9b13('0x31')](_0x3f66dc));});};exports[_0x9b13('0x52')]=function(_0x50e761,_0x5cc002,_0x30d71c,_0x387b32,_0x49bf5a,_0x4ac287,_0xc999da){var _0x32f01b,_0x5d244a;_0x4ac287[_0x9b13('0x19')]=intUtil[_0x9b13('0x42')](_0x4ac287[_0x9b13('0x19')]);_0x4ac287[_0x9b13('0x43')]=intUtil[_0x9b13('0x42')](_0x4ac287[_0x9b13('0x43')]);if(_0xc999da&&_0xc999da[_0x9b13('0x53')]&&_0xc999da[_0x9b13('0x53')]!==_0x9b13('0x54')){logger[_0x9b13('0x1f')](_0x9b13('0x55'),'Recording\x20is\x20enabled!');_0x5cc002[_0x9b13('0x49')]=util[_0x9b13('0xe')](_0x9b13('0x47'),_0x4ac287[_0x9b13('0x43')],_0x5cc002['uniqueid'],md5(_0x5cc002[_0x9b13('0x48')]));}headers[_0x9b13('0x4a')]=getAuth(_0x4ac287);return getUser(_0x4ac287,_0x387b32[_0x9b13('0x22')])[_0x9b13('0x1b')](function(_0x3029c5){_0x32f01b=_0x3029c5;logger[_0x9b13('0x1f')]('The\x20User\x20ID\x20is:',_0x32f01b['id']);return getEndUser(_0x4ac287,_0x5cc002[_0x9b13('0x56')],_0x5cc002[_0x9b13('0x57')]);})[_0x9b13('0x1b')](function(_0x4ed024){_0x5d244a=_0x4ed024;logger[_0x9b13('0x1f')]('The\x20Enduser\x20ID\x20is:',_0x5d244a['id']);return getTicket(_0x4ac287,_0x32f01b,_0x5d244a,_0x30d71c,_0x5cc002);})[_0x9b13('0x1b')](function(_0x298c9f){if(_0x298c9f&&_0x298c9f['id']){logger[_0x9b13('0x1f')](_0x9b13('0x1c'));logger[_0x9b13('0x1f')](_0x9b13('0x4c'),_0x298c9f['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9b13('0xe')](_0x9b13('0x4e'),_0x387b32[_0x9b13('0x16')]),_0x9b13('0x58'),{'uri':util[_0x9b13('0xe')](_0x9b13('0x4f'),_0x4ac287[_0x9b13('0x19')],_0x298c9f['id'])});}})[_0x9b13('0x50')](function(_0x3a03fb){logger[_0x9b13('0x51')](_0x9b13('0x55'),JSON[_0x9b13('0x31')](_0x3a03fb));});};exports[_0x9b13('0x59')]=function(_0x43b993,_0x5367f0,_0x2e39ac,_0x367918,_0x34b088,_0x552df1){var _0x454e0c,_0x254c26;_0x552df1[_0x9b13('0x19')]=intUtil[_0x9b13('0x42')](_0x552df1[_0x9b13('0x19')]);_0x552df1['serverUrl']=intUtil[_0x9b13('0x42')](_0x552df1[_0x9b13('0x43')]);if(_0x34b088&&_0x34b088[_0x9b13('0x44')]){logger[_0x9b13('0x1f')]('['+_0x5367f0[_0x9b13('0x5a')][_0x9b13('0x5b')]()+']',_0x9b13('0x46'));_0x5367f0[_0x9b13('0x49')]=util[_0x9b13('0xe')](_0x9b13('0x47'),_0x552df1['serverUrl'],_0x5367f0['uniqueid'],md5(_0x5367f0[_0x9b13('0x48')]));}else{_0x5367f0[_0x9b13('0x49')]='';}headers[_0x9b13('0x4a')]=getAuth(_0x552df1);return getUser(_0x552df1,'')['then'](function(_0x44279a){_0x454e0c=_0x44279a;logger[_0x9b13('0x1f')](_0x9b13('0x4b'),_0x454e0c['id']);return getEndUser(_0x552df1,_0x5367f0['calleridname'],_0x5367f0[_0x9b13('0x10')]);})[_0x9b13('0x1b')](function(_0x535e79){_0x254c26=_0x535e79;logger['info'](_0x9b13('0x5c'),_0x254c26['id']);return getTicket(_0x552df1,_0x454e0c,_0x254c26,_0x2e39ac,_0x5367f0);})[_0x9b13('0x1b')](function(_0x4a5666){if(_0x4a5666){logger[_0x9b13('0x1f')](_0x9b13('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4a5666['id']);}})[_0x9b13('0x50')](function(_0x421c2d){logger[_0x9b13('0x51')]('['+_0x5367f0[_0x9b13('0x5a')][_0x9b13('0x5b')]()+']',JSON[_0x9b13('0x31')](_0x421c2d));});}; \ 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 726df04..0903d06 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 _0x3213=['toUpperCase','message','agentEmail','userId','User\x20found:','userEmail','adminEmail','/api/lookup?q=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','info','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error'];(function(_0x2d4b9a,_0x40c61f){var _0x567911=function(_0x47c8b0){while(--_0x47c8b0){_0x2d4b9a['push'](_0x2d4b9a['shift']());}};_0x567911(++_0x40c61f);}(_0x3213,0x173));var _0x3321=function(_0x9ace37,_0x4d1159){_0x9ace37=_0x9ace37-0x0;var _0x23ecc0=_0x3213[_0x9ace37];return _0x23ecc0;};'use strict';var _=require(_0x3321('0x0'));var rp=require(_0x3321('0x1'));var md5=require(_0x3321('0x2'));var util=require(_0x3321('0x3'));var moment=require(_0x3321('0x4'));var Promise=require(_0x3321('0x5'));var Redis=require(_0x3321('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x3321('0x7'));config['redis']=_[_0x3321('0x8')](config[_0x3321('0x9')],{'host':_0x3321('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3321('0x9')]));function getAdminId(_0x4bf3e3,_0xd814ba,_0x562d42,_0x3331c8){return new Promise(function(_0x4d9196,_0x2bdcf9){var _0x73fa13=![];var _0x482fa8={'method':_0x3321('0xb'),'uri':_0x3331c8+_0x3321('0xc'),'json':!![]};_0x482fa8[_0x3321('0xd')]=_0x562d42;logger[_0x3321('0xe')]('Getting\x20admin\x20information');return rp(_0x482fa8)[_0x3321('0xf')](function(_0x5a9144){if(_0x5a9144){var _0x27e1aa=_0x5a9144[_0x3321('0x10')];var _0x501ca6=null;for(_0x501ca6=0x0;_0x501ca6<_0x27e1aa[_0x3321('0x11')];_0x501ca6++){if(_0x27e1aa[_0x501ca6][_0x3321('0x12')]===_0x4bf3e3['adminEmail']){_0x4bf3e3[_0x3321('0x13')]=_0x27e1aa[_0x501ca6]['id'];_0x73fa13=!![];}}if(_0x73fa13){logger[_0x3321('0xe')](_0x3321('0x14'),_0x4bf3e3[_0x3321('0x13')]);_0x4d9196(_0x4bf3e3);}else{_0x2bdcf9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2bdcf9({'statusCode':0x194,'message':_0x3321('0x15')});}})[_0x3321('0x16')](function(_0x2ee83f){logger[_0x3321('0x17')]('['+[_0xd814ba[_0x3321('0x18')]()]+']',_0x2ee83f[_0x3321('0x19')]);_0x2bdcf9(_0x2ee83f);});});}function getUser(_0x336a3d,_0x2dd313,_0x3f2243){return function(_0x44f5d7){return new Promise(function(_0x46403f,_0x48dfa1){var _0x4698e9={'method':_0x3321('0xb'),'uri':_0x3f2243+_0x3321('0xc'),'json':!![]};_0x4698e9[_0x3321('0xd')]=_0x2dd313;logger[_0x3321('0xe')]('Getting\x20user\x20list');return rp(_0x4698e9)[_0x3321('0xf')](function(_0x4ed766){if(_0x4ed766){var _0x56473b=_0x4ed766[_0x3321('0x10')];var _0x54e8d5=![];var _0x3c7958=null;if(_0x44f5d7[_0x3321('0x1a')]!==null){logger[_0x3321('0xe')]('Getting\x20user\x20with\x20email',_0x44f5d7['agentEmail']);_0x44f5d7['userEmail']=_0x44f5d7['agentEmail'];for(_0x3c7958=0x0;_0x3c7958<_0x56473b[_0x3321('0x11')];_0x3c7958++){if(_0x56473b[_0x3c7958][_0x3321('0x12')]===_0x44f5d7[_0x3321('0x1a')]){_0x54e8d5=!![];_0x44f5d7[_0x3321('0x1b')]=_0x56473b[_0x3c7958]['id'];logger['info'](_0x3321('0x1c'),_0x44f5d7[_0x3321('0x1b')]);}}}if(!_0x54e8d5){logger[_0x3321('0xe')]('Admin\x20selected');_0x44f5d7[_0x3321('0x1d')]=_0x44f5d7[_0x3321('0x1e')];_0x44f5d7[_0x3321('0x1b')]=_0x44f5d7[_0x3321('0x13')];_0x54e8d5=!![];}if(_0x54e8d5){_0x46403f(_0x44f5d7);}else{_0x48dfa1({'statusCode':0x194,'message':_0x3321('0x15')});}}else{_0x48dfa1({'statusCode':0x194,'message':_0x3321('0x15')});}})['catch'](function(_0x3c21d4){logger['error']('['+[_0x336a3d[_0x3321('0x18')]()]+']',_0x3c21d4[_0x3321('0x19')]);_0x48dfa1(_0x3c21d4);});});};}function searchContact(_0x256515,_0x4a8026,_0x4e5f2b,_0x331219){return new Promise(function(_0x18127e,_0x423e7b){var _0x17b69c={'method':'GET','headers':_0x4a8026,'uri':_0x256515+_0x3321('0x1f')+_0x331219+'&f='+_0x4e5f2b+'&entities=contact','json':!![]};rp(_0x17b69c)[_0x3321('0xf')](function(_0xa87f5a){var _0x15ca69=_[_0x3321('0x20')](_0xa87f5a[_0x3321('0x21')][_0x3321('0x21')],[_0x4e5f2b,_0x331219]);_0x18127e(_0x15ca69);})['catch'](function(_0x2b4523){_0x423e7b(_0x2b4523);});});}function getEndUser(_0x17df3f,_0x21133e,_0x13ce93){return function(_0x452a25){return new Promise(function(_0x7c032e,_0x1e331f){logger[_0x3321('0xe')](util[_0x3321('0x22')](_0x3321('0x23'),_0x452a25['contactNumber']));searchContact(_0x13ce93,_0x21133e,'mobile_number',_0x452a25[_0x3321('0x24')])['then'](function(_0x2d484c){if(_0x2d484c){_0x452a25[_0x3321('0x25')]=_0x2d484c['id'];logger[_0x3321('0xe')](_0x3321('0x26'),_0x452a25[_0x3321('0x25')]);return _0x7c032e(_0x452a25);}searchContact(_0x13ce93,_0x21133e,'work_number',_0x452a25[_0x3321('0x24')])[_0x3321('0xf')](function(_0x172431){if(_0x172431){_0x452a25[_0x3321('0x25')]=_0x172431['id'];logger['info']('Contact\x20found\x20work_number:',_0x452a25[_0x3321('0x25')]);return _0x7c032e(_0x452a25);}createEndUser(_0x452a25,_0x17df3f,_0x21133e,_0x13ce93)[_0x3321('0xf')](function(_0x36d8fe){logger[_0x3321('0xe')]('Contact\x20created:',_0x36d8fe[_0x3321('0x25')]);return _0x7c032e(_0x36d8fe);});});})[_0x3321('0x16')](function(_0x55a855){_0x1e331f(_0x55a855);});});};}function createEndUser(_0x296de3,_0x191a76,_0x5950db,_0x1d8c4f){return new Promise(function(_0x501616,_0x59b3b4){var _0x51b699=moment();var _0x3712ea={'method':_0x3321('0x27'),'uri':_0x1d8c4f+_0x3321('0x28'),'body':{'contact':{'last_name':_0x296de3[_0x3321('0x24')],'work_number':_0x296de3[_0x3321('0x24')],'mobile_number':_0x296de3[_0x3321('0x24')],'owner_id':_0x296de3[_0x3321('0x1b')],'created_at':_0x51b699[_0x3321('0x22')](_0x3321('0x29'))}},'json':!![]};_0x3712ea[_0x3321('0xd')]=_0x5950db;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3712ea)[_0x3321('0xf')](function(_0x46a013){_0x296de3[_0x3321('0x25')]=_0x46a013[_0x3321('0x2a')]['id'];_0x501616(_0x296de3);})[_0x3321('0x16')](function(_0x3967f2){logger[_0x3321('0x17')]('['+[_0x191a76['toUpperCase']()]+']',_0x3967f2[_0x3321('0x19')]);_0x59b3b4(_0x3967f2['message']);});});}function getTicket(_0x451a9,_0x2374c2,_0x3a1783,_0x4c716a,_0x57f4c8){return function(_0x20e2ec){logger['info'](_0x3321('0x2b'));return new Promise(function(_0x1c7ea5,_0x49e98e){var _0xad721=moment();var _0x1619a4={'method':_0x3321('0x27'),'uri':_0x3a1783+'/api/tasks','body':{'title':intUtil[_0x3321('0x2c')](_0x4c716a[_0x3321('0x2d')],_0x57f4c8,'\x20'),'description':intUtil[_0x3321('0x2c')](_0x4c716a['Descriptions'],_0x57f4c8,'\x0a'),'owner_id':_0x20e2ec['userId'],'creater_id':_0x20e2ec[_0x3321('0x13')],'targetable_id':_0x20e2ec[_0x3321('0x25')],'targetable_type':_0x3321('0x2e'),'created_at':_0xad721[_0x3321('0x22')](_0x3321('0x29')),'due_date':_0xad721[_0x3321('0x2f')](0x1e,'m')[_0x3321('0x22')](_0x3321('0x29'))},'json':!![]};_0x1619a4['headers']=_0x2374c2;return rp(_0x1619a4)['then'](function(_0x58481a){_0x20e2ec[_0x3321('0x30')]=_0x58481a[_0x3321('0x31')]['id'];logger['info'](_0x3321('0x32'),_0x20e2ec['ticketId']);_0x1c7ea5(_0x20e2ec);})[_0x3321('0x16')](function(_0x4f2318){logger[_0x3321('0x17')]('['+[_0x451a9[_0x3321('0x18')]()]+']',_0x4f2318[_0x3321('0x19')]);_0x49e98e(_0x4f2318['message']);});});};}function emit(_0x3567ca,_0x22f76a,_0x28d9aa){var _0x39c087={'uri':_0x3567ca+_0x3321('0x33')+_0x28d9aa};io['to'](util[_0x3321('0x22')](_0x3321('0x34'),_0x22f76a))[_0x3321('0x35')](_0x3321('0x36'),_0x39c087);}exports['cs']=function(_0x17aba3,_0x101df3,_0x1ec221,_0x2b4369,_0x4ac8a8,_0xec6e8c,_0x5dcd17,_0x27a131){var _0x38910c={};var _0x223909={'Authorization':_0x3321('0x37')+_0xec6e8c[_0x3321('0x38')]};_0xec6e8c[_0x3321('0x39')]=intUtil[_0x3321('0x3a')](_0xec6e8c[_0x3321('0x39')]);_0xec6e8c[_0x3321('0x3b')]=intUtil[_0x3321('0x3a')](_0xec6e8c[_0x3321('0x3b')]);var _0x43874f=_0xec6e8c[_0x3321('0x39')];_0x38910c[_0x3321('0x1e')]=_0xec6e8c[_0x3321('0x3c')];_0x38910c[_0x3321('0x24')]=_0x27a131['toLowerCase']()===_0x3321('0x3d')?_0x101df3[_0x3321('0x3e')]:_0x101df3[_0x3321('0x3f')];_0x38910c[_0x3321('0x40')]=_0x27a131===_0x3321('0x41')||_0x27a131===_0x3321('0x42')?'queue':'outbound';if(_0x2b4369){_0x38910c['agentEmail']=_0x2b4369[_0x3321('0x12')];}var _0x184cd6=util[_0x3321('0x22')](_0x3321('0x43'),_0xec6e8c['serverUrl'],_0x101df3[_0x3321('0x44')],md5(_0x101df3[_0x3321('0x44')]));if(_0x4ac8a8&&_0x4ac8a8['monitor_format']){logger[_0x3321('0xe')](_0x3321('0x45'),'Recording\x20is\x20enabled!');_0x101df3[_0x3321('0x46')]=_0x184cd6;}else if(_0x5dcd17&&_0x5dcd17[_0x3321('0x47')]&&_0x5dcd17[_0x3321('0x47')]!==_0x3321('0x48')){logger[_0x3321('0xe')](_0x3321('0x49'),'Recording\x20is\x20enabled!');_0x101df3[_0x3321('0x46')]=_0x184cd6;}else{_0x101df3[_0x3321('0x46')]='';}return getAdminId(_0x38910c,_0x27a131,_0x223909,_0x43874f)[_0x3321('0xf')](getUser(_0x27a131,_0x223909,_0x43874f))[_0x3321('0xf')](getEndUser(_0x27a131,_0x223909,_0x43874f))[_0x3321('0xf')](getTicket(_0x27a131,_0x223909,_0x43874f,_0x1ec221,_0x101df3))['then'](function(_0x3baed2){logger[_0x3321('0xe')](util['format'](_0x3321('0x4a'),_0x3baed2['ticketId']));if(_0x27a131!=='unmanaged'){logger[_0x3321('0xe')]('['+[_0x27a131[_0x3321('0x18')]()]+']',_0x3321('0x4b'));emit(_0x43874f,_0x2b4369[_0x3321('0x4c')],_0x3baed2[_0x3321('0x25')]);}})[_0x3321('0x16')](function(_0x18799d){logger['error']('['+[_0x27a131['toUpperCase']()]+_0x3321('0x4d'),util[_0x3321('0x4e')](_0x18799d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x40ca=['[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','ioredis','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','email','userId','Admin\x20selected','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x40ca,0x19f));var _0xa40c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x40ca[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xa40c('0x0'));var rp=require(_0xa40c('0x1'));var md5=require(_0xa40c('0x2'));var util=require(_0xa40c('0x3'));var moment=require(_0xa40c('0x4'));var Promise=require('bluebird');var Redis=require(_0xa40c('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa40c('0x6'))(_0xa40c('0x7'));config[_0xa40c('0x8')]=_[_0xa40c('0x9')](config['redis'],{'host':_0xa40c('0xa'),'port':0x18eb});var io=require(_0xa40c('0xb'))(new Redis(config[_0xa40c('0x8')]));function getAdminId(_0x4b0cfe,_0x78003f,_0x1bca84,_0x113eb3){return new Promise(function(_0x96582c,_0xae9129){var _0x17c89c=![];var _0x2f3b65={'method':_0xa40c('0xc'),'uri':_0x113eb3+_0xa40c('0xd'),'json':!![]};_0x2f3b65[_0xa40c('0xe')]=_0x1bca84;logger[_0xa40c('0xf')](_0xa40c('0x10'));return rp(_0x2f3b65)[_0xa40c('0x11')](function(_0x4d82d7){if(_0x4d82d7){var _0x1f7bdf=_0x4d82d7[_0xa40c('0x12')];var _0x55788c=null;for(_0x55788c=0x0;_0x55788c<_0x1f7bdf[_0xa40c('0x13')];_0x55788c++){if(_0x1f7bdf[_0x55788c]['email']===_0x4b0cfe[_0xa40c('0x14')]){_0x4b0cfe[_0xa40c('0x15')]=_0x1f7bdf[_0x55788c]['id'];_0x17c89c=!![];}}if(_0x17c89c){logger[_0xa40c('0xf')](_0xa40c('0x16'),_0x4b0cfe['adminId']);_0x96582c(_0x4b0cfe);}else{_0xae9129({'statusCode':0x194,'message':_0xa40c('0x17')});}}else{_0xae9129({'statusCode':0x194,'message':_0xa40c('0x17')});}})[_0xa40c('0x18')](function(_0x5d10b1){logger[_0xa40c('0x19')]('['+[_0x78003f[_0xa40c('0x1a')]()]+']',_0x5d10b1[_0xa40c('0x1b')]);_0xae9129(_0x5d10b1);});});}function getUser(_0x5e92f4,_0x3fd4e8,_0x404ed4){return function(_0x202eaa){return new Promise(function(_0x41711c,_0x194598){var _0x18e31e={'method':_0xa40c('0xc'),'uri':_0x404ed4+'/api/selector/owners','json':!![]};_0x18e31e['headers']=_0x3fd4e8;logger['info'](_0xa40c('0x1c'));return rp(_0x18e31e)[_0xa40c('0x11')](function(_0x3e7a54){if(_0x3e7a54){var _0x71489a=_0x3e7a54[_0xa40c('0x12')];var _0x41135a=![];var _0x5de0ee=null;if(_0x202eaa[_0xa40c('0x1d')]!==null){logger[_0xa40c('0xf')]('Getting\x20user\x20with\x20email',_0x202eaa['agentEmail']);_0x202eaa[_0xa40c('0x1e')]=_0x202eaa[_0xa40c('0x1d')];for(_0x5de0ee=0x0;_0x5de0ee<_0x71489a[_0xa40c('0x13')];_0x5de0ee++){if(_0x71489a[_0x5de0ee][_0xa40c('0x1f')]===_0x202eaa[_0xa40c('0x1d')]){_0x41135a=!![];_0x202eaa[_0xa40c('0x20')]=_0x71489a[_0x5de0ee]['id'];logger['info']('User\x20found:',_0x202eaa[_0xa40c('0x20')]);}}}if(!_0x41135a){logger[_0xa40c('0xf')](_0xa40c('0x21'));_0x202eaa['userEmail']=_0x202eaa[_0xa40c('0x14')];_0x202eaa[_0xa40c('0x20')]=_0x202eaa[_0xa40c('0x15')];_0x41135a=!![];}if(_0x41135a){_0x41711c(_0x202eaa);}else{_0x194598({'statusCode':0x194,'message':_0xa40c('0x17')});}}else{_0x194598({'statusCode':0x194,'message':_0xa40c('0x17')});}})[_0xa40c('0x18')](function(_0x361c5e){logger[_0xa40c('0x19')]('['+[_0x5e92f4['toUpperCase']()]+']',_0x361c5e[_0xa40c('0x1b')]);_0x194598(_0x361c5e);});});};}function searchContact(_0x4db106,_0x460728,_0x172101,_0x5446fe){return new Promise(function(_0x480985,_0x2becd0){var _0x22768d={'method':'GET','headers':_0x460728,'uri':_0x4db106+'/api/lookup?q='+_0x5446fe+'&f='+_0x172101+_0xa40c('0x22'),'json':!![]};rp(_0x22768d)[_0xa40c('0x11')](function(_0x28589f){var _0xd6fc60=_[_0xa40c('0x23')](_0x28589f[_0xa40c('0x24')][_0xa40c('0x24')],[_0x172101,_0x5446fe]);_0x480985(_0xd6fc60);})[_0xa40c('0x18')](function(_0x77d582){_0x2becd0(_0x77d582);});});}function getEndUser(_0x535fd7,_0x52e4b5,_0x2d2c86){return function(_0x9e83ab){return new Promise(function(_0x30a648,_0x4306b9){logger['info'](util['format'](_0xa40c('0x25'),_0x9e83ab[_0xa40c('0x26')]));searchContact(_0x2d2c86,_0x52e4b5,_0xa40c('0x27'),_0x9e83ab[_0xa40c('0x26')])[_0xa40c('0x11')](function(_0x5732ab){if(_0x5732ab){_0x9e83ab['endUserId']=_0x5732ab['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x9e83ab[_0xa40c('0x28')]);return _0x30a648(_0x9e83ab);}searchContact(_0x2d2c86,_0x52e4b5,_0xa40c('0x29'),_0x9e83ab['contactNumber'])[_0xa40c('0x11')](function(_0x41b57c){if(_0x41b57c){_0x9e83ab[_0xa40c('0x28')]=_0x41b57c['id'];logger['info']('Contact\x20found\x20work_number:',_0x9e83ab['endUserId']);return _0x30a648(_0x9e83ab);}createEndUser(_0x9e83ab,_0x535fd7,_0x52e4b5,_0x2d2c86)['then'](function(_0x51a3e0){logger['info'](_0xa40c('0x2a'),_0x51a3e0['endUserId']);return _0x30a648(_0x51a3e0);});});})['catch'](function(_0x3c6322){_0x4306b9(_0x3c6322);});});};}function createEndUser(_0x207864,_0x3cbbea,_0x143011,_0x430d66){return new Promise(function(_0x5344da,_0x2d7249){var _0xdc45a2=moment();var _0xe03c18={'method':_0xa40c('0x2b'),'uri':_0x430d66+_0xa40c('0x2c'),'body':{'contact':{'last_name':_0x207864['contactNumber'],'work_number':_0x207864[_0xa40c('0x26')],'mobile_number':_0x207864[_0xa40c('0x26')],'owner_id':_0x207864[_0xa40c('0x20')],'created_at':_0xdc45a2[_0xa40c('0x2d')](_0xa40c('0x2e'))}},'json':!![]};_0xe03c18['headers']=_0x143011;logger[_0xa40c('0xf')](_0xa40c('0x2f'));return rp(_0xe03c18)[_0xa40c('0x11')](function(_0x292aac){_0x207864[_0xa40c('0x28')]=_0x292aac[_0xa40c('0x30')]['id'];_0x5344da(_0x207864);})[_0xa40c('0x18')](function(_0x3b19ce){logger[_0xa40c('0x19')]('['+[_0x3cbbea[_0xa40c('0x1a')]()]+']',_0x3b19ce[_0xa40c('0x1b')]);_0x2d7249(_0x3b19ce['message']);});});}function getTicket(_0x2c056d,_0x5ac57d,_0x1778f5,_0x345988,_0x364b47){return function(_0x499f3a){logger[_0xa40c('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x38a325,_0x565ce4){var _0x1e7048=moment();var _0x46c27f={'method':_0xa40c('0x2b'),'uri':_0x1778f5+'/api/tasks','body':{'title':intUtil[_0xa40c('0x31')](_0x345988[_0xa40c('0x32')],_0x364b47,'\x20'),'description':intUtil[_0xa40c('0x31')](_0x345988[_0xa40c('0x33')],_0x364b47,'\x0a'),'owner_id':_0x499f3a[_0xa40c('0x20')],'creater_id':_0x499f3a[_0xa40c('0x15')],'targetable_id':_0x499f3a['endUserId'],'targetable_type':_0xa40c('0x34'),'created_at':_0x1e7048[_0xa40c('0x2d')](_0xa40c('0x2e')),'due_date':_0x1e7048[_0xa40c('0x35')](0x1e,'m')[_0xa40c('0x2d')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x46c27f[_0xa40c('0xe')]=_0x5ac57d;return rp(_0x46c27f)['then'](function(_0xa121cb){_0x499f3a[_0xa40c('0x36')]=_0xa121cb['task']['id'];logger[_0xa40c('0xf')](_0xa40c('0x37'),_0x499f3a[_0xa40c('0x36')]);_0x38a325(_0x499f3a);})[_0xa40c('0x18')](function(_0x5a1899){logger[_0xa40c('0x19')]('['+[_0x2c056d[_0xa40c('0x1a')]()]+']',_0x5a1899[_0xa40c('0x1b')]);_0x565ce4(_0x5a1899[_0xa40c('0x1b')]);});});};}function emit(_0x330d83,_0x39b63a,_0x3cd7e0){var _0x16e1d5={'uri':_0x330d83+_0xa40c('0x38')+_0x3cd7e0};io['to'](util[_0xa40c('0x2d')]('user:%s',_0x39b63a))[_0xa40c('0x39')](_0xa40c('0x3a'),_0x16e1d5);}exports['cs']=function(_0xde370c,_0x3a230a,_0x3205e7,_0x43cd15,_0x18236d,_0x5285ba,_0x106878,_0x1e2a83){var _0x45ce36={};var _0x38637e={'Authorization':_0xa40c('0x3b')+_0x5285ba[_0xa40c('0x3c')]};_0x5285ba[_0xa40c('0x3d')]=intUtil[_0xa40c('0x3e')](_0x5285ba[_0xa40c('0x3d')]);_0x5285ba[_0xa40c('0x3f')]=intUtil[_0xa40c('0x3e')](_0x5285ba[_0xa40c('0x3f')]);var _0x4b6553=_0x5285ba[_0xa40c('0x3d')];_0x45ce36[_0xa40c('0x14')]=_0x5285ba['username'];_0x45ce36[_0xa40c('0x26')]=_0x1e2a83['toLowerCase']()==='outbound'?_0x3a230a[_0xa40c('0x40')]:_0x3a230a[_0xa40c('0x41')];_0x45ce36[_0xa40c('0x42')]=_0x1e2a83===_0xa40c('0x43')||_0x1e2a83==='unmanaged'?_0xa40c('0x43'):_0xa40c('0x44');if(_0x43cd15){_0x45ce36[_0xa40c('0x1d')]=_0x43cd15['email'];}var _0x128c13=util['format'](_0xa40c('0x45'),_0x5285ba[_0xa40c('0x3f')],_0x3a230a[_0xa40c('0x46')],md5(_0x3a230a[_0xa40c('0x46')]));if(_0x18236d&&_0x18236d[_0xa40c('0x47')]){logger[_0xa40c('0xf')](_0xa40c('0x48'),_0xa40c('0x49'));_0x3a230a[_0xa40c('0x4a')]=_0x128c13;}else if(_0x106878&&_0x106878[_0xa40c('0x4b')]&&_0x106878['recordingFormat']!==_0xa40c('0x4c')){logger['info'](_0xa40c('0x4d'),_0xa40c('0x49'));_0x3a230a['recordingURL']=_0x128c13;}else{_0x3a230a[_0xa40c('0x4a')]='';}return getAdminId(_0x45ce36,_0x1e2a83,_0x38637e,_0x4b6553)[_0xa40c('0x11')](getUser(_0x1e2a83,_0x38637e,_0x4b6553))[_0xa40c('0x11')](getEndUser(_0x1e2a83,_0x38637e,_0x4b6553))[_0xa40c('0x11')](getTicket(_0x1e2a83,_0x38637e,_0x4b6553,_0x3205e7,_0x3a230a))[_0xa40c('0x11')](function(_0x16d324){logger[_0xa40c('0xf')](util[_0xa40c('0x2d')](_0xa40c('0x4e'),_0x16d324[_0xa40c('0x36')]));if(_0x1e2a83!=='unmanaged'){logger[_0xa40c('0xf')]('['+[_0x1e2a83['toUpperCase']()]+']',_0xa40c('0x4f'));emit(_0x4b6553,_0x43cd15[_0xa40c('0x50')],_0x16d324[_0xa40c('0x28')]);}})[_0xa40c('0x18')](function(_0x25a080){logger['error']('['+[_0x1e2a83[_0xa40c('0x1a')]()]+_0xa40c('0x51'),util['inspect'](_0x25a080,{'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 5814664..377c8b0 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 _0xbb12=['./freshsales','zendesk','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','zoho','unknown\x20integration','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365'];(function(_0x37fcda,_0x2f5aa1){var _0xf5ed91=function(_0x3c3241){while(--_0x3c3241){_0x37fcda['push'](_0x37fcda['shift']());}};_0xf5ed91(++_0x2f5aa1);}(_0xbb12,0x145));var _0x2bb1=function(_0x34731e,_0x4075f2){_0x34731e=_0x34731e-0x0;var _0x40e995=_0xbb12[_0x34731e];return _0x40e995;};'use strict';var _=require('lodash');var util=require(_0x2bb1('0x0'));var zendesk=require(_0x2bb1('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x2bb1('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x2bb1('0x3'));var desk=require(_0x2bb1('0x4'));var vtiger=require(_0x2bb1('0x5'));var servicenow=require(_0x2bb1('0x6'));var dynamics365=require(_0x2bb1('0x7'));var freshsales=require(_0x2bb1('0x8'));var integrations=[_0x2bb1('0x9'),'salesforce','sugarcrm',_0x2bb1('0xa'),'zoho',_0x2bb1('0xb'),_0x2bb1('0xc'),_0x2bb1('0xd'),_0x2bb1('0xe'),_0x2bb1('0xf')];exports[_0x2bb1('0x10')]=function(_0x1cf1b7,_0x4e9314,_0x321545,_0x4f34aa,_0x2f545c,_0x2edd81){if(_0x321545){if(_[_0x2bb1('0x11')](integrations,_0x1cf1b7[_0x2bb1('0x12')][_0x2bb1('0x13')]())){try{var _0x101ec6=null;var _0x5cc313='';var _0x2a96e1=_0x321545[_0x1cf1b7[_0x2bb1('0x12')][_0x2bb1('0x13')]()];if(_0x2a96e1){var _0x158bf0=_0x2a96e1[_0x1cf1b7[_0x2bb1('0x14')]];if(_0x158bf0){var _0x4f225f=_[_0x2bb1('0x15')](_0x158bf0['Configurations'],{'id':parseInt(_0x1cf1b7[_0x2bb1('0x16')],0xa)});if(_0x4f225f){if(_0x4f34aa){if(_0x2f545c&&_0x4e9314[_0x2bb1('0x17')]){_0x5cc313=_0x2bb1('0x17');}else if(_0x4e9314[_0x2bb1('0x18')]){_0x5cc313=_0x2bb1('0x19');}else{console[_0x2bb1('0x1a')](_0x2bb1('0x1b'),_0x4e9314);}}else{_0x5cc313=_0x2bb1('0x1c');}switch(_0x1cf1b7['data1'][_0x2bb1('0x13')]()){case _0x2bb1('0x9'):zendesk[_0x5cc313](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81);break;case'salesforce':salesforce[_0x5cc313](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81);break;case _0x2bb1('0x1d'):sugarcrm[_0x5cc313](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81);break;case _0x2bb1('0xa'):freshdesk[_0x5cc313](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81);break;case _0x2bb1('0x1e'):zoho[_0x5cc313](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81);break;case _0x2bb1('0xb'):desk[_0x5cc313](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81);break;case _0x2bb1('0xc'):vtiger[_0x5cc313](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81);break;case'freshsales':freshsales['cs'](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81,_0x5cc313);break;case _0x2bb1('0xf'):servicenow['cs'](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81,_0x5cc313);break;case _0x2bb1('0xd'):dynamics365['cs'](_0x1cf1b7,_0x4e9314,_0x4f225f,_0x4f34aa,_0x2f545c,_0x158bf0,_0x2edd81,_0x5cc313);break;default:console['log'](_0x2bb1('0x1f'));}}else{_0x101ec6=require(_0x2bb1('0x20'))(_0x1cf1b7[_0x2bb1('0x12')]['toLowerCase']());_0x101ec6[_0x2bb1('0x21')]('[EXEC]',util['format'](_0x2bb1('0x22'),_0x1cf1b7[_0x2bb1('0x12')]['toLowerCase'](),_0x1cf1b7[_0x2bb1('0x16')]));}}else{_0x101ec6=require(_0x2bb1('0x20'))(_0x1cf1b7[_0x2bb1('0x12')]['toLowerCase']());_0x101ec6[_0x2bb1('0x21')]('[EXEC]',util[_0x2bb1('0x23')](_0x2bb1('0x24'),_0x1cf1b7[_0x2bb1('0x12')][_0x2bb1('0x13')](),_0x1cf1b7[_0x2bb1('0x14')]));}}else{}}catch(_0x4507c3){console['error'](_0x4507c3);}}}}; \ No newline at end of file +var _0xdc3c=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','vtiger','freshsales','dynamics365','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x32087a,_0x16349b){_0x32087a=_0x32087a-0x0;var _0x144d02=_0xdc3c[_0x32087a];return _0x144d02;};'use strict';var _=require(_0xcdc3('0x0'));var util=require('util');var zendesk=require(_0xcdc3('0x1'));var salesforce=require(_0xcdc3('0x2'));var sugarcrm=require(_0xcdc3('0x3'));var freshdesk=require(_0xcdc3('0x4'));var zoho=require(_0xcdc3('0x5'));var desk=require(_0xcdc3('0x6'));var vtiger=require(_0xcdc3('0x7'));var servicenow=require(_0xcdc3('0x8'));var dynamics365=require(_0xcdc3('0x9'));var freshsales=require(_0xcdc3('0xa'));var integrations=[_0xcdc3('0xb'),_0xcdc3('0xc'),_0xcdc3('0xd'),_0xcdc3('0xe'),_0xcdc3('0xf'),_0xcdc3('0x10'),'vtiger','dynamics365','freshsales',_0xcdc3('0x11')];exports[_0xcdc3('0x12')]=function(_0x1900a2,_0x14478e,_0x18ba5f,_0x3c8a53,_0x358771,_0x64c9af){if(_0x18ba5f){if(_[_0xcdc3('0x13')](integrations,_0x1900a2['data1']['toLowerCase']())){try{var _0x6cf272=null;var _0x1ea112='';var _0x1c22c5=_0x18ba5f[_0x1900a2[_0xcdc3('0x14')][_0xcdc3('0x15')]()];if(_0x1c22c5){var _0x20cf7c=_0x1c22c5[_0x1900a2[_0xcdc3('0x16')]];if(_0x20cf7c){var _0x359598=_['find'](_0x20cf7c[_0xcdc3('0x17')],{'id':parseInt(_0x1900a2['data3'],0xa)});if(_0x359598){if(_0x3c8a53){if(_0x358771&&_0x14478e[_0xcdc3('0x18')]){_0x1ea112='queue';}else if(_0x14478e[_0xcdc3('0x19')]){_0x1ea112=_0xcdc3('0x1a');}else{console[_0xcdc3('0x1b')](_0xcdc3('0x1c'),_0x14478e);}}else{_0x1ea112=_0xcdc3('0x1d');}switch(_0x1900a2[_0xcdc3('0x14')][_0xcdc3('0x15')]()){case _0xcdc3('0xb'):zendesk[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0xc'):salesforce[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0xd'):sugarcrm[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0xe'):freshdesk[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case'zoho':zoho[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0x10'):desk[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0x1e'):vtiger[_0x1ea112](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af);break;case _0xcdc3('0x1f'):freshsales['cs'](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af,_0x1ea112);break;case _0xcdc3('0x11'):servicenow['cs'](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af,_0x1ea112);break;case _0xcdc3('0x20'):dynamics365['cs'](_0x1900a2,_0x14478e,_0x359598,_0x3c8a53,_0x358771,_0x20cf7c,_0x64c9af,_0x1ea112);break;default:console[_0xcdc3('0x1b')]('unknown\x20integration');}}else{_0x6cf272=require('../../../../config/logger')(_0x1900a2['data1'][_0xcdc3('0x15')]());_0x6cf272['error'](_0xcdc3('0x21'),util[_0xcdc3('0x22')](_0xcdc3('0x23'),_0x1900a2[_0xcdc3('0x14')][_0xcdc3('0x15')](),_0x1900a2[_0xcdc3('0x24')]));}}else{_0x6cf272=require(_0xcdc3('0x25'))(_0x1900a2['data1']['toLowerCase']());_0x6cf272[_0xcdc3('0x26')](_0xcdc3('0x21'),util[_0xcdc3('0x22')](_0xcdc3('0x27'),_0x1900a2['data1'][_0xcdc3('0x15')](),_0x1900a2[_0xcdc3('0x16')]));}}else{}}catch(_0x499d63){console[_0xcdc3('0x26')](_0x499d63);}}}}; \ 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 f4f05d4..02da925 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 _0x1e08=['jsforce','util','ioredis','./util','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','ticketType','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','clientSecret','login','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.','request-promise','moment','bluebird'];(function(_0xeee8f2,_0x351024){var _0x16102b=function(_0x1617cc){while(--_0x1617cc){_0xeee8f2['push'](_0xeee8f2['shift']());}};_0x16102b(++_0x351024);}(_0x1e08,0x7d));var _0x81e0=function(_0x32a22d,_0x17b134){_0x32a22d=_0x32a22d-0x0;var _0x302d10=_0x1e08[_0x32a22d];return _0x302d10;};'use strict';var _=require('lodash');var rp=require(_0x81e0('0x0'));var moment=require(_0x81e0('0x1'));var BPromise=require(_0x81e0('0x2'));var md5=require('md5');var jsforce=require(_0x81e0('0x3'));var util=require(_0x81e0('0x4'));var Redis=require(_0x81e0('0x5'));var intUtil=require(_0x81e0('0x6'));var config=require('../../../../config/environment');var logger=require(_0x81e0('0x7'))(_0x81e0('0x8'));config['redis']=_[_0x81e0('0x9')](config[_0x81e0('0xa')],{'host':_0x81e0('0xb'),'port':0x18eb});var io=require(_0x81e0('0xc'))(new Redis(config[_0x81e0('0xa')]));function emit(_0x338d2b,_0xc9680c,_0x54a913){io['to'](_0x338d2b)[_0x81e0('0xd')](_0xc9680c,_0x54a913);}function getTicket(_0x493dbe,_0x447283,_0x2ed6e4,_0x3d19b4,_0x1069f1,_0x56ba53,_0x19e8a5,_0x59500d){var _0x3dac9d=Object[_0x81e0('0xe')]({},{'OwnerId':_0x447283['id'],'Subject':intUtil['getString'](_0x3d19b4['Subjects'],_0x1069f1,'\x20'),'Description':intUtil[_0x81e0('0xf')](_0x3d19b4['Descriptions'],_0x1069f1,'\x0a')},getCustomFields(_0x56ba53,_0x1069f1));if(_0x2ed6e4){if(_0x3d19b4[_0x81e0('0x10')]==='Task'){_0x3dac9d['ActivityDate']=moment['utc']();_0x3dac9d[_0x81e0('0x11')]=![];_0x3dac9d[_0x81e0('0x12')]=![];if(_0x2ed6e4[_0x81e0('0x13')]===_0x81e0('0x14')||_0x2ed6e4[_0x81e0('0x13')]===_0x81e0('0x15')){_0x3dac9d[_0x81e0('0x16')]=_0x2ed6e4['id'];}else if(_0x2ed6e4[_0x81e0('0x13')]===_0x81e0('0x17')){_0x3dac9d[_0x81e0('0x18')]=_0x2ed6e4['id'];}}else if(_0x3d19b4[_0x81e0('0x10')]==='Case'){if(_0x2ed6e4[_0x81e0('0x13')]==='contact'){_0x3dac9d['ContactId']=_0x2ed6e4['id'];}else if(_0x2ed6e4[_0x81e0('0x13')]===_0x81e0('0x17')){_0x3dac9d['AccountId']=_0x2ed6e4['id'];}else if(_0x2ed6e4[_0x81e0('0x13')]==='lead'&&_0x3d19b4['leadId']){_0x3dac9d[_0x3d19b4[_0x81e0('0x19')]]=_0x2ed6e4['id'];}else{logger[_0x81e0('0x1a')](_0x81e0('0x1b'));}}}return _0x19e8a5[_0x81e0('0x1c')](_0x3d19b4[_0x81e0('0x10')])[_0x81e0('0x1d')](_0x3dac9d);}function getUser(_0x1e9ae7,_0x4ebf95,_0x49aff1){if(!_[_0x81e0('0x1e')](_0x4ebf95)&&intUtil[_0x81e0('0x1f')](_0x4ebf95)){var _0x3e740d={'Email':_0x4ebf95};var _0x5d9acc={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x49aff1['sobject'](_0x81e0('0x20'))[_0x81e0('0x21')](_0x3e740d,_0x5d9acc)[_0x81e0('0x22')]()[_0x81e0('0x23')](function(_0x109d3a){if(_0x109d3a[_0x81e0('0x24')]){var _0x33ce54=_[_0x81e0('0x21')](_0x109d3a,function(_0x50a8f6){return _0x50a8f6[_0x81e0('0x25')]===_0x4ebf95;});if(_0x33ce54){logger[_0x81e0('0x1a')](_0x81e0('0x26'),_0x4ebf95);return BPromise[_0x81e0('0x27')]({'id':_0x33ce54['Id'],'name':_0x33ce54[_0x81e0('0x28')]});}}else{logger['info'](_0x81e0('0x29'),_0x4ebf95);return _0x49aff1['identity']()[_0x81e0('0x23')](function(_0x26463a){return BPromise[_0x81e0('0x27')]({'id':_0x26463a[_0x81e0('0x2a')],'name':_0x26463a['display_name']});});}});}else{logger['info'](_0x81e0('0x29'),_0x4ebf95);return _0x49aff1[_0x81e0('0x2b')]()[_0x81e0('0x23')](function(_0x358c2a){return BPromise[_0x81e0('0x27')]({'id':_0x358c2a[_0x81e0('0x2a')],'name':_0x358c2a['display_name']});});}}function getEndUser(_0x5d1ed7,_0x278744,_0x4e8191,_0x55a2d2,_0x16e3dd){var _0x5b9b75={'$or':{'Phone':_0x55a2d2}};var _0x43ead3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x81e0('0x27')]()[_0x81e0('0x23')](function(){logger[_0x81e0('0x1a')](_0x81e0('0x2c'),_0x55a2d2,_0x278744[_0x81e0('0x2d')]);switch(_0x278744[_0x81e0('0x2d')]){case _0x81e0('0x2e'):var _0x2ffbbe=_[_0x81e0('0x2f')](_0x5b9b75);if(_0x278744[_0x81e0('0x30')]){var _0x2e0497={};_0x2e0497[_0x278744[_0x81e0('0x30')]]=_0x55a2d2;_[_0x81e0('0x31')](_0x2ffbbe[_0x81e0('0x32')],_0x2e0497);}return _0x16e3dd['sobject'](_0x81e0('0x33'))[_0x81e0('0x21')](_0x2ffbbe,_0x43ead3)[_0x81e0('0x22')]()[_0x81e0('0x23')](function(_0x468373){if(_0x468373&&_0x468373[_0x81e0('0x24')]){return _0x468373;}else{var _0x2aba61=_[_0x81e0('0x2f')](_0x5b9b75);if(_0x278744[_0x81e0('0x34')]){var _0x2ef098={};_0x2ef098[_0x278744[_0x81e0('0x34')]]=_0x55a2d2;_['merge'](_0x2aba61[_0x81e0('0x32')],_0x2ef098);}return _0x16e3dd[_0x81e0('0x1c')]('Lead')[_0x81e0('0x21')](_0x2aba61,_0x43ead3);}});case _0x81e0('0x35'):var _0x4a9af3=_[_0x81e0('0x2f')](_0x5b9b75);if(_0x278744[_0x81e0('0x36')]){var _0x2e0497={};_0x2e0497[_0x278744['additionalSearchAccount']]=_0x55a2d2;_[_0x81e0('0x31')](_0x4a9af3[_0x81e0('0x32')],_0x2e0497);}return _0x16e3dd[_0x81e0('0x1c')](_0x81e0('0x37'))[_0x81e0('0x21')](_0x4a9af3,_0x43ead3)[_0x81e0('0x22')]()[_0x81e0('0x23')](function(_0x5d0f95){if(_0x5d0f95&&_0x5d0f95[_0x81e0('0x24')]){return _0x5d0f95;}else{var _0x4a9cfb=_['cloneDeep'](_0x5b9b75);if(_0x278744[_0x81e0('0x30')]){var _0x1c3c8b={};_0x1c3c8b[_0x278744['additionalSearchContact']]=_0x55a2d2;_['merge'](_0x4a9cfb[_0x81e0('0x32')],_0x1c3c8b);}return _0x16e3dd[_0x81e0('0x1c')](_0x81e0('0x33'))['find'](_0x4a9cfb,_0x43ead3)['then'](function(_0x30ffbf){if(_0x30ffbf&&_0x30ffbf[_0x81e0('0x24')]){return _0x30ffbf;}else{var _0x580e4c=_['cloneDeep'](_0x5b9b75);if(_0x278744[_0x81e0('0x34')]){var _0x4723fa={};_0x4723fa[_0x278744[_0x81e0('0x34')]]=_0x55a2d2;_[_0x81e0('0x31')](_0x580e4c[_0x81e0('0x32')],_0x4723fa);}return _0x16e3dd[_0x81e0('0x1c')](_0x81e0('0x38'))[_0x81e0('0x21')](_0x580e4c,_0x43ead3);}});}});case _0x81e0('0x14'):var _0x2ffbbe=_[_0x81e0('0x2f')](_0x5b9b75);if(_0x278744[_0x81e0('0x30')]){var _0x2e0497={};_0x2e0497[_0x278744[_0x81e0('0x30')]]=_0x55a2d2;_['merge'](_0x2ffbbe[_0x81e0('0x32')],_0x2e0497);}return _0x16e3dd[_0x81e0('0x1c')](_0x81e0('0x33'))[_0x81e0('0x21')](_0x2ffbbe,_0x43ead3)['execute']();case _0x81e0('0x15'):var _0x36ee34=_[_0x81e0('0x2f')](_0x5b9b75);if(_0x278744[_0x81e0('0x34')]){var _0x2e0497={};_0x2e0497[_0x278744[_0x81e0('0x34')]]=_0x55a2d2;_[_0x81e0('0x31')](_0x36ee34[_0x81e0('0x32')],_0x2e0497);}return _0x16e3dd[_0x81e0('0x1c')](_0x81e0('0x38'))['find'](_0x36ee34,_0x43ead3);case _0x81e0('0x17'):var _0x4a9af3=_[_0x81e0('0x2f')](_0x5b9b75);if(_0x278744[_0x81e0('0x36')]){var _0x2e0497={};_0x2e0497[_0x278744[_0x81e0('0x36')]]=_0x55a2d2;_[_0x81e0('0x31')](_0x4a9af3[_0x81e0('0x32')],_0x2e0497);}return _0x16e3dd[_0x81e0('0x1c')](_0x81e0('0x37'))[_0x81e0('0x21')](_0x4a9af3,_0x43ead3);default:return null;}})[_0x81e0('0x23')](function(_0x3e7f13){if(_0x3e7f13&&_0x3e7f13[_0x81e0('0x24')]){var _0x4e2911=_[_0x81e0('0x39')](_0x3e7f13);if(_0x4e2911){return BPromise[_0x81e0('0x27')]({'id':_0x4e2911['Id'],'name':_0x4e2911['Name'],'phone':_0x4e2911[_0x81e0('0x3a')],'endUserType':_0x4e2911[_0x81e0('0x3b')][_0x81e0('0x3c')][_0x81e0('0x3d')]()});}}})['then'](function(_0x184509){if(_0x184509){logger['info'](_0x81e0('0x3e'),_0x184509[_0x81e0('0x13')],_0x55a2d2);return BPromise['resolve'](_0x184509);}else{logger[_0x81e0('0x1a')](_0x81e0('0x3f'),_0x55a2d2);var _0x4e2d9b={'Phone':_0x55a2d2};if(_0x278744['moduleCreate']){if(_0x278744[_0x81e0('0x40')]==='contact'){logger[_0x81e0('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x55a2d2,_0x278744[_0x81e0('0x40')]);_0x4e2d9b[_0x81e0('0x41')]=_0x4e8191!==_0x81e0('0x42')?_0x4e8191:util[_0x81e0('0x43')](_0x81e0('0x44'),_0x55a2d2);}else if(_0x278744['moduleCreate']===_0x81e0('0x15')){logger['info'](_0x81e0('0x45'),_0x55a2d2,_0x278744[_0x81e0('0x40')]);_0x4e2d9b[_0x81e0('0x41')]=_0x4e8191!==_0x81e0('0x42')?_0x4e8191:util[_0x81e0('0x43')](_0x81e0('0x44'),_0x55a2d2);_0x4e2d9b[_0x81e0('0x46')]=_0x81e0('0x47');}else if(_0x278744[_0x81e0('0x40')]===_0x81e0('0x17')){logger['info'](_0x81e0('0x45'),_0x55a2d2,_0x278744['moduleCreate']);_0x4e2d9b[_0x81e0('0x28')]=_0x4e8191!==''?_0x4e8191:util[_0x81e0('0x43')](_0x81e0('0x44'),_0x55a2d2);}else{return null;}}return _0x16e3dd[_0x81e0('0x1c')](_[_0x81e0('0x48')](_0x278744['moduleCreate']))[_0x81e0('0x1d')](_0x4e2d9b)['then'](function(_0x518765){return BPromise['resolve']({'id':_0x518765['id'],'endUserType':_0x278744[_0x81e0('0x40')]});});}});}function getCustomFields(_0x29f87d,_0x2838fc){var _0x203ba7={};if(_0x29f87d[_0x81e0('0x24')]>0x0){_[_0x81e0('0x49')](_0x29f87d,function(_0x82cf67){if(_[_0x81e0('0x4a')]([_0x81e0('0x4b'),_0x81e0('0x4c')],_0x82cf67['type'])&&_0x82cf67[_0x81e0('0x4d')]){_0x203ba7[_0x82cf67[_0x81e0('0x4d')]]=_0x82cf67[_0x81e0('0x4e')][_0x81e0('0x4f')]();}else if(_0x82cf67[_0x81e0('0x3c')]===_0x81e0('0x50')&&_0x82cf67[_0x81e0('0x51')]&&_0x82cf67['idField']){_0x2838fc[_0x82cf67[_0x81e0('0x51')]]&&(_0x203ba7[_0x82cf67[_0x81e0('0x4d')]]=_0x2838fc[_0x82cf67[_0x81e0('0x51')]]['toString']());}else if(_0x82cf67[_0x81e0('0x3c')]===_0x81e0('0x52')&&_0x82cf67[_0x81e0('0x53')]&&_0x82cf67[_0x81e0('0x53')][_0x81e0('0x54')]&&_0x82cf67[_0x81e0('0x4d')]){_0x2838fc[_0x82cf67[_0x81e0('0x53')][_0x81e0('0x54')]['toLowerCase']()]&&(_0x203ba7[_0x82cf67['idField']]=_0x2838fc[_0x82cf67['Variable'][_0x81e0('0x54')][_0x81e0('0x3d')]()]['toString']());}});}return _0x203ba7;}function getConnection(_0x6f036f){var _0x30d67b=_0x6f036f[_0x81e0('0x55')][_0x81e0('0x56')](_0x6f036f['securityToken']);var _0x268e31=new jsforce[(_0x81e0('0x57'))]({'oauth2':{'loginUrl':_0x6f036f[_0x81e0('0x58')]||'https://login.salesforce.com','clientId':_0x6f036f['clientId'],'clientSecret':_0x6f036f[_0x81e0('0x59')]}});return _0x268e31[_0x81e0('0x5a')](_0x6f036f['username'],_0x30d67b)[_0x81e0('0x23')](function(){logger[_0x81e0('0x1a')]('Connection\x20established.');return _0x268e31;});}exports[_0x81e0('0x5b')]=function(_0x5184d3,_0x41671b,_0x351cfa,_0x463b3b,_0xcb7d5a,_0x166be2){var _0x9d0824,_0x336f4b,_0x1469ad,_0x5517a7;_0x166be2[_0x81e0('0x5c')]=intUtil[_0x81e0('0x5d')](_0x166be2[_0x81e0('0x5c')]);_0x166be2[_0x81e0('0x58')]=intUtil['stripTrailingSlash'](_0x166be2[_0x81e0('0x58')]);if(_0xcb7d5a&&_0xcb7d5a['monitor_format']){logger[_0x81e0('0x1a')](_0x81e0('0x5e'),_0x81e0('0x5f'));_0x41671b[_0x81e0('0x60')]=util[_0x81e0('0x43')](_0x81e0('0x61'),_0x166be2[_0x81e0('0x5c')],_0x41671b[_0x81e0('0x62')],md5(_0x41671b[_0x81e0('0x62')]));}else{_0x41671b[_0x81e0('0x60')]='';}return getConnection(_0x166be2)[_0x81e0('0x23')](function(_0x3f08f0){_0x5517a7=_0x3f08f0;return getUser(_0x166be2,_0x463b3b[_0x81e0('0x63')],_0x5517a7);})[_0x81e0('0x23')](function(_0x423316){_0x9d0824=_0x423316;return getEndUser(_0x166be2,_0x351cfa,_0x41671b[_0x81e0('0x64')],_0x41671b['calleridnum'],_0x5517a7);})[_0x81e0('0x23')](function(_0x50dce5){_0x336f4b=_0x50dce5;return getTicket(_0x166be2,_0x9d0824,_0x336f4b,_0x351cfa,_0x41671b,_0x351cfa[_0x81e0('0x65')],_0x5517a7,'queue');})['then'](function(_0x1ec878){_0x1469ad=_0x1ec878;logger[_0x81e0('0x1a')](_0x81e0('0x66'),_0x1469ad['id']);logger[_0x81e0('0x1a')](_0x81e0('0x67'),_0x1469ad['id'],_0x463b3b[_0x81e0('0x54')],_0x166be2[_0x81e0('0x3c')]);switch(_0x166be2[_0x81e0('0x3c')]){case _0x81e0('0x68'):emit(util['format'](_0x81e0('0x69'),_0x463b3b[_0x81e0('0x54')]),'trigger:salesforce:display',{'recordId':_0x1469ad['id']});break;case _0x81e0('0x6a'):emit(util[_0x81e0('0x43')](_0x81e0('0x69'),_0x463b3b[_0x81e0('0x54')]),_0x81e0('0x6b'),{'uri':util[_0x81e0('0x43')]('%s/%s/e',_0x5517a7[_0x81e0('0x6c')],_0x1469ad['id'])});break;default:logger[_0x81e0('0x6d')](_0x81e0('0x6e'));}})[_0x81e0('0x6f')](function(_0x14c13d){logger[_0x81e0('0x6d')]('[QUEUE]',_0x14c13d);});};exports[_0x81e0('0x70')]=function(_0x2ca4ad,_0x2fe581,_0x4e0d00,_0x5458d5,_0x2aaeef,_0x21a556,_0x2d12f0){var _0x5b0c94,_0x3530fd,_0x2a3250,_0x5ad407;_0x21a556[_0x81e0('0x5c')]=intUtil[_0x81e0('0x5d')](_0x21a556['serverUrl']);_0x21a556[_0x81e0('0x58')]=intUtil[_0x81e0('0x5d')](_0x21a556['remoteUri']);if(_0x2d12f0&&_0x2d12f0[_0x81e0('0x71')]&&_0x2d12f0[_0x81e0('0x71')]!=='none'){logger['info'](_0x81e0('0x72'),_0x81e0('0x5f'));_0x2fe581[_0x81e0('0x60')]=util[_0x81e0('0x43')](_0x81e0('0x61'),_0x21a556[_0x81e0('0x5c')],_0x2fe581[_0x81e0('0x62')],md5(_0x2fe581[_0x81e0('0x62')]));}return getConnection(_0x21a556)[_0x81e0('0x23')](function(_0x11e7a3){_0x5ad407=_0x11e7a3;return getUser(_0x21a556,_0x5458d5[_0x81e0('0x63')],_0x5ad407);})[_0x81e0('0x23')](function(_0x2c255a){_0x5b0c94=_0x2c255a;return getEndUser(_0x21a556,_0x4e0d00,_0x2fe581[_0x81e0('0x73')],_0x2fe581[_0x81e0('0x74')],_0x5ad407);})[_0x81e0('0x23')](function(_0x3c4789){_0x3530fd=_0x3c4789;return getTicket(_0x21a556,_0x5b0c94,_0x3530fd,_0x4e0d00,_0x2fe581,_0x4e0d00[_0x81e0('0x65')],_0x5ad407,'outbound');})[_0x81e0('0x23')](function(_0x3d3680){_0x2a3250=_0x3d3680;logger[_0x81e0('0x1a')](_0x81e0('0x75'),_0x2a3250['id']);logger[_0x81e0('0x1a')](_0x81e0('0x76'),_0x2a3250['id'],_0x5458d5[_0x81e0('0x54')],_0x21a556[_0x81e0('0x3c')]);switch(_0x21a556['type']){case _0x81e0('0x68'):emit(util['format'](_0x81e0('0x69'),_0x5458d5['name']),_0x81e0('0x77'),{'recordId':_0x2a3250['id']});break;case'newTab':emit(util[_0x81e0('0x43')]('user:%s',_0x5458d5[_0x81e0('0x54')]),_0x81e0('0x6b'),{'uri':util[_0x81e0('0x43')](_0x81e0('0x78'),_0x5ad407[_0x81e0('0x6c')],_0x2a3250['id'])});break;default:logger[_0x81e0('0x6d')]('[OUTBOUND]',_0x81e0('0x79'));}})[_0x81e0('0x6f')](function(_0x267fd0){logger[_0x81e0('0x6d')](_0x81e0('0x72'),_0x267fd0);});};exports[_0x81e0('0x7a')]=function(_0x41113b,_0x1543e3,_0x45b139,_0x43be25,_0x1db53b,_0x3582d5){var _0x25895f,_0x3fe1a6,_0x4d0b21,_0x101bfc;_0x3582d5[_0x81e0('0x5c')]=intUtil[_0x81e0('0x5d')](_0x3582d5['serverUrl']);_0x3582d5[_0x81e0('0x58')]=intUtil[_0x81e0('0x5d')](_0x3582d5[_0x81e0('0x58')]);if(_0x1db53b&&_0x1db53b[_0x81e0('0x7b')]){logger[_0x81e0('0x1a')]('['+_0x1543e3[_0x81e0('0x7c')][_0x81e0('0x7d')]()+']',_0x81e0('0x5f'));_0x1543e3['recordingURL']=util[_0x81e0('0x43')](_0x81e0('0x61'),_0x3582d5['serverUrl'],_0x1543e3['uniqueid'],md5(_0x1543e3[_0x81e0('0x62')]));}else{_0x1543e3[_0x81e0('0x60')]='';}return getConnection(_0x3582d5)[_0x81e0('0x23')](function(_0x312749){_0x101bfc=_0x312749;if(!_[_0x81e0('0x1e')](_0x43be25)){return getUser(_0x3582d5,_0x43be25[_0x81e0('0x54')],_0x101bfc);}else{return getUser(_0x3582d5,null,_0x101bfc);}})['then'](function(_0x39bec7){_0x25895f=_0x39bec7;return getEndUser(_0x3582d5,_0x45b139,_0x1543e3[_0x81e0('0x64')],_0x1543e3[_0x81e0('0x7e')],_0x101bfc);})['then'](function(_0xfc70b4){_0x3fe1a6=_0xfc70b4;return getTicket(_0x3582d5,_0x25895f,_0x3fe1a6,_0x45b139,_0x1543e3,_0x45b139[_0x81e0('0x65')],_0x101bfc);})[_0x81e0('0x23')](function(_0x218c40){_0x4d0b21=_0x218c40;logger['info']('['+_0x1543e3[_0x81e0('0x7c')][_0x81e0('0x7d')]()+_0x81e0('0x7f'),_0x4d0b21['id']);logger[_0x81e0('0x1a')]('['+_0x1543e3[_0x81e0('0x7c')][_0x81e0('0x7d')]()+']\x20Integration\x20account\x20type\x20%s.',_0x3582d5['type']);})[_0x81e0('0x6f')](function(_0xf1d37){logger['error']('['+_0x1543e3[_0x81e0('0x7c')][_0x81e0('0x7d')]()+']',_0xf1d37);});}; \ No newline at end of file +var _0x7033=['Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','Contact','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','moduleCreate','Company','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','toString','variable','variableName','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','lead','Case','contact','account','AccountId','leadId','info'];(function(_0x5a9130,_0x57fb4a){var _0x4a3d77=function(_0x2e645e){while(--_0x2e645e){_0x5a9130['push'](_0x5a9130['shift']());}};_0x4a3d77(++_0x57fb4a);}(_0x7033,0x1df));var _0x3703=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7033[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x3703('0x0'));var rp=require(_0x3703('0x1'));var moment=require(_0x3703('0x2'));var BPromise=require('bluebird');var md5=require(_0x3703('0x3'));var jsforce=require(_0x3703('0x4'));var util=require(_0x3703('0x5'));var Redis=require('ioredis');var intUtil=require(_0x3703('0x6'));var config=require(_0x3703('0x7'));var logger=require(_0x3703('0x8'))(_0x3703('0x9'));config[_0x3703('0xa')]=_[_0x3703('0xb')](config[_0x3703('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x3703('0xc'))(new Redis(config[_0x3703('0xa')]));function emit(_0x26acbe,_0x541115,_0x34de60){io['to'](_0x26acbe)[_0x3703('0xd')](_0x541115,_0x34de60);}function getTicket(_0x598463,_0x5fba3d,_0x60e914,_0x486281,_0x1cf45e,_0x5bc7d1,_0x436836,_0x23923f){var _0x356e50=Object[_0x3703('0xe')]({},{'OwnerId':_0x5fba3d['id'],'Subject':intUtil[_0x3703('0xf')](_0x486281['Subjects'],_0x1cf45e,'\x20'),'Description':intUtil['getString'](_0x486281[_0x3703('0x10')],_0x1cf45e,'\x0a')},getCustomFields(_0x5bc7d1,_0x1cf45e));if(_0x60e914){if(_0x486281[_0x3703('0x11')]==='Task'){_0x356e50['ActivityDate']=moment[_0x3703('0x12')]();_0x356e50[_0x3703('0x13')]=![];_0x356e50[_0x3703('0x14')]=![];if(_0x60e914[_0x3703('0x15')]==='contact'||_0x60e914[_0x3703('0x15')]===_0x3703('0x16')){_0x356e50['WhoId']=_0x60e914['id'];}else if(_0x60e914[_0x3703('0x15')]==='account'){_0x356e50['WhatId']=_0x60e914['id'];}}else if(_0x486281[_0x3703('0x11')]===_0x3703('0x17')){if(_0x60e914[_0x3703('0x15')]===_0x3703('0x18')){_0x356e50['ContactId']=_0x60e914['id'];}else if(_0x60e914[_0x3703('0x15')]===_0x3703('0x19')){_0x356e50[_0x3703('0x1a')]=_0x60e914['id'];}else if(_0x60e914[_0x3703('0x15')]===_0x3703('0x16')&&_0x486281[_0x3703('0x1b')]){_0x356e50[_0x486281[_0x3703('0x1b')]]=_0x60e914['id'];}else{logger[_0x3703('0x1c')](_0x3703('0x1d'));}}}return _0x436836[_0x3703('0x1e')](_0x486281['ticketType'])[_0x3703('0x1f')](_0x356e50);}function getUser(_0x1e2b27,_0xf603f9,_0x420940){if(!_[_0x3703('0x20')](_0xf603f9)&&intUtil['validateEmail'](_0xf603f9)){var _0x561462={'Email':_0xf603f9};var _0x98b4fe={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x420940[_0x3703('0x1e')](_0x3703('0x21'))[_0x3703('0x22')](_0x561462,_0x98b4fe)['execute']()[_0x3703('0x23')](function(_0x53e7d7){if(_0x53e7d7[_0x3703('0x24')]){var _0x14e964=_['find'](_0x53e7d7,function(_0x1ef3d0){return _0x1ef3d0[_0x3703('0x25')]===_0xf603f9;});if(_0x14e964){logger[_0x3703('0x1c')](_0x3703('0x26'),_0xf603f9);return BPromise[_0x3703('0x27')]({'id':_0x14e964['Id'],'name':_0x14e964[_0x3703('0x28')]});}}else{logger[_0x3703('0x1c')](_0x3703('0x29'),_0xf603f9);return _0x420940[_0x3703('0x2a')]()['then'](function(_0x8f32cb){return BPromise['resolve']({'id':_0x8f32cb['user_id'],'name':_0x8f32cb[_0x3703('0x2b')]});});}});}else{logger[_0x3703('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xf603f9);return _0x420940['identity']()[_0x3703('0x23')](function(_0x5173ba){return BPromise[_0x3703('0x27')]({'id':_0x5173ba[_0x3703('0x2c')],'name':_0x5173ba['display_name']});});}}function getEndUser(_0x2e81ce,_0x4d184a,_0x949fa0,_0x11f5ca,_0x1019f2){var _0x1695b1={'$or':{'Phone':_0x11f5ca}};var _0x552074={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3703('0x27')]()[_0x3703('0x23')](function(){logger[_0x3703('0x1c')](_0x3703('0x2d'),_0x11f5ca,_0x4d184a[_0x3703('0x2e')]);switch(_0x4d184a[_0x3703('0x2e')]){case _0x3703('0x2f'):var _0x41f091=_[_0x3703('0x30')](_0x1695b1);if(_0x4d184a[_0x3703('0x31')]){var _0x197eb2={};_0x197eb2[_0x4d184a[_0x3703('0x31')]]=_0x11f5ca;_[_0x3703('0x32')](_0x41f091['$or'],_0x197eb2);}return _0x1019f2['sobject']('Contact')[_0x3703('0x22')](_0x41f091,_0x552074)[_0x3703('0x33')]()['then'](function(_0x3eb0a1){if(_0x3eb0a1&&_0x3eb0a1[_0x3703('0x24')]){return _0x3eb0a1;}else{var _0x4d12c2=_[_0x3703('0x30')](_0x1695b1);if(_0x4d184a[_0x3703('0x34')]){var _0x243178={};_0x243178[_0x4d184a[_0x3703('0x34')]]=_0x11f5ca;_[_0x3703('0x32')](_0x4d12c2['$or'],_0x243178);}return _0x1019f2[_0x3703('0x1e')](_0x3703('0x35'))[_0x3703('0x22')](_0x4d12c2,_0x552074);}});case _0x3703('0x36'):var _0x29a226=_['cloneDeep'](_0x1695b1);if(_0x4d184a[_0x3703('0x37')]){var _0x197eb2={};_0x197eb2[_0x4d184a['additionalSearchAccount']]=_0x11f5ca;_[_0x3703('0x32')](_0x29a226[_0x3703('0x38')],_0x197eb2);}return _0x1019f2[_0x3703('0x1e')](_0x3703('0x39'))['find'](_0x29a226,_0x552074)[_0x3703('0x33')]()[_0x3703('0x23')](function(_0x1047d5){if(_0x1047d5&&_0x1047d5['length']){return _0x1047d5;}else{var _0x1fc1ca=_[_0x3703('0x30')](_0x1695b1);if(_0x4d184a[_0x3703('0x31')]){var _0x4bfbce={};_0x4bfbce[_0x4d184a[_0x3703('0x31')]]=_0x11f5ca;_[_0x3703('0x32')](_0x1fc1ca[_0x3703('0x38')],_0x4bfbce);}return _0x1019f2[_0x3703('0x1e')](_0x3703('0x3a'))[_0x3703('0x22')](_0x1fc1ca,_0x552074)[_0x3703('0x23')](function(_0x18e56f){if(_0x18e56f&&_0x18e56f['length']){return _0x18e56f;}else{var _0x4c00f8=_[_0x3703('0x30')](_0x1695b1);if(_0x4d184a['additionalSearchLead']){var _0x33f067={};_0x33f067[_0x4d184a[_0x3703('0x34')]]=_0x11f5ca;_[_0x3703('0x32')](_0x4c00f8[_0x3703('0x38')],_0x33f067);}return _0x1019f2[_0x3703('0x1e')](_0x3703('0x35'))[_0x3703('0x22')](_0x4c00f8,_0x552074);}});}});case'contact':var _0x41f091=_['cloneDeep'](_0x1695b1);if(_0x4d184a[_0x3703('0x31')]){var _0x197eb2={};_0x197eb2[_0x4d184a[_0x3703('0x31')]]=_0x11f5ca;_[_0x3703('0x32')](_0x41f091['$or'],_0x197eb2);}return _0x1019f2[_0x3703('0x1e')](_0x3703('0x3a'))[_0x3703('0x22')](_0x41f091,_0x552074)['execute']();case _0x3703('0x16'):var _0x9e466c=_[_0x3703('0x30')](_0x1695b1);if(_0x4d184a[_0x3703('0x34')]){var _0x197eb2={};_0x197eb2[_0x4d184a[_0x3703('0x34')]]=_0x11f5ca;_['merge'](_0x9e466c['$or'],_0x197eb2);}return _0x1019f2['sobject']('Lead')[_0x3703('0x22')](_0x9e466c,_0x552074);case'account':var _0x29a226=_['cloneDeep'](_0x1695b1);if(_0x4d184a[_0x3703('0x37')]){var _0x197eb2={};_0x197eb2[_0x4d184a[_0x3703('0x37')]]=_0x11f5ca;_[_0x3703('0x32')](_0x29a226[_0x3703('0x38')],_0x197eb2);}return _0x1019f2[_0x3703('0x1e')]('Account')[_0x3703('0x22')](_0x29a226,_0x552074);default:return null;}})[_0x3703('0x23')](function(_0x2b8737){if(_0x2b8737&&_0x2b8737[_0x3703('0x24')]){var _0xd33844=_[_0x3703('0x3b')](_0x2b8737);if(_0xd33844){return BPromise[_0x3703('0x27')]({'id':_0xd33844['Id'],'name':_0xd33844[_0x3703('0x28')],'phone':_0xd33844[_0x3703('0x3c')],'endUserType':_0xd33844[_0x3703('0x3d')][_0x3703('0x3e')][_0x3703('0x3f')]()});}}})[_0x3703('0x23')](function(_0x48f074){if(_0x48f074){logger['info'](_0x3703('0x40'),_0x48f074[_0x3703('0x15')],_0x11f5ca);return BPromise[_0x3703('0x27')](_0x48f074);}else{logger[_0x3703('0x1c')](_0x3703('0x41'),_0x11f5ca);var _0x38bb4c={'Phone':_0x11f5ca};if(_0x4d184a['moduleCreate']){if(_0x4d184a['moduleCreate']===_0x3703('0x18')){logger[_0x3703('0x1c')](_0x3703('0x42'),_0x11f5ca,_0x4d184a['moduleCreate']);_0x38bb4c[_0x3703('0x43')]=_0x949fa0!==_0x3703('0x44')?_0x949fa0:util[_0x3703('0x45')](_0x3703('0x46'),_0x11f5ca);}else if(_0x4d184a[_0x3703('0x47')]==='lead'){logger['info'](_0x3703('0x42'),_0x11f5ca,_0x4d184a[_0x3703('0x47')]);_0x38bb4c[_0x3703('0x43')]=_0x949fa0!==''?_0x949fa0:util[_0x3703('0x45')](_0x3703('0x46'),_0x11f5ca);_0x38bb4c[_0x3703('0x48')]=_0x3703('0x49');}else if(_0x4d184a[_0x3703('0x47')]===_0x3703('0x19')){logger['info'](_0x3703('0x42'),_0x11f5ca,_0x4d184a[_0x3703('0x47')]);_0x38bb4c['Name']=_0x949fa0!==''?_0x949fa0:util[_0x3703('0x45')](_0x3703('0x46'),_0x11f5ca);}else{return null;}}return _0x1019f2[_0x3703('0x1e')](_[_0x3703('0x4a')](_0x4d184a[_0x3703('0x47')]))[_0x3703('0x1f')](_0x38bb4c)[_0x3703('0x23')](function(_0x583d1e){return BPromise[_0x3703('0x27')]({'id':_0x583d1e['id'],'endUserType':_0x4d184a[_0x3703('0x47')]});});}});}function getCustomFields(_0x57f028,_0x2b4975){var _0x46f6df={};if(_0x57f028[_0x3703('0x24')]>0x0){_[_0x3703('0x4b')](_0x57f028,function(_0x368cef){if(_[_0x3703('0x4c')](['string',_0x3703('0x4d')],_0x368cef[_0x3703('0x3e')])&&_0x368cef[_0x3703('0x4e')]){_0x46f6df[_0x368cef[_0x3703('0x4e')]]=_0x368cef[_0x3703('0x4f')][_0x3703('0x50')]();}else if(_0x368cef[_0x3703('0x3e')]===_0x3703('0x51')&&_0x368cef[_0x3703('0x52')]&&_0x368cef[_0x3703('0x4e')]){_0x2b4975[_0x368cef['variableName']]&&(_0x46f6df[_0x368cef['idField']]=_0x2b4975[_0x368cef['variableName']][_0x3703('0x50')]());}else if(_0x368cef[_0x3703('0x3e')]==='customVariable'&&_0x368cef[_0x3703('0x53')]&&_0x368cef[_0x3703('0x53')][_0x3703('0x54')]&&_0x368cef[_0x3703('0x4e')]){_0x2b4975[_0x368cef['Variable'][_0x3703('0x54')]['toLowerCase']()]&&(_0x46f6df[_0x368cef[_0x3703('0x4e')]]=_0x2b4975[_0x368cef[_0x3703('0x53')][_0x3703('0x54')]['toLowerCase']()]['toString']());}});}return _0x46f6df;}function getConnection(_0x23abe4){var _0x29401c=_0x23abe4[_0x3703('0x55')][_0x3703('0x56')](_0x23abe4['securityToken']);var _0x18ab9c=new jsforce[(_0x3703('0x57'))]({'oauth2':{'loginUrl':_0x23abe4[_0x3703('0x58')]||_0x3703('0x59'),'clientId':_0x23abe4[_0x3703('0x5a')],'clientSecret':_0x23abe4[_0x3703('0x5b')]}});return _0x18ab9c[_0x3703('0x5c')](_0x23abe4['username'],_0x29401c)[_0x3703('0x23')](function(){logger[_0x3703('0x1c')](_0x3703('0x5d'));return _0x18ab9c;});}exports['queue']=function(_0x401dba,_0x1c0846,_0x10fe81,_0x17ca60,_0x53a19c,_0x24c4e0){var _0x2e61f5,_0x4efac1,_0x54e4b8,_0x40fc09;_0x24c4e0[_0x3703('0x5e')]=intUtil['stripTrailingSlash'](_0x24c4e0[_0x3703('0x5e')]);_0x24c4e0[_0x3703('0x58')]=intUtil['stripTrailingSlash'](_0x24c4e0['remoteUri']);if(_0x53a19c&&_0x53a19c[_0x3703('0x5f')]){logger[_0x3703('0x1c')](_0x3703('0x60'),_0x3703('0x61'));_0x1c0846[_0x3703('0x62')]=util[_0x3703('0x45')](_0x3703('0x63'),_0x24c4e0[_0x3703('0x5e')],_0x1c0846[_0x3703('0x64')],md5(_0x1c0846[_0x3703('0x64')]));}else{_0x1c0846['recordingURL']='';}return getConnection(_0x24c4e0)[_0x3703('0x23')](function(_0x519bf8){_0x40fc09=_0x519bf8;return getUser(_0x24c4e0,_0x17ca60[_0x3703('0x65')],_0x40fc09);})[_0x3703('0x23')](function(_0x98674f){_0x2e61f5=_0x98674f;return getEndUser(_0x24c4e0,_0x10fe81,_0x1c0846[_0x3703('0x66')],_0x1c0846[_0x3703('0x67')],_0x40fc09);})[_0x3703('0x23')](function(_0x2acade){_0x4efac1=_0x2acade;return getTicket(_0x24c4e0,_0x2e61f5,_0x4efac1,_0x10fe81,_0x1c0846,_0x10fe81['Fields'],_0x40fc09,'queue');})[_0x3703('0x23')](function(_0x2fdae5){_0x54e4b8=_0x2fdae5;logger[_0x3703('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x54e4b8['id']);logger[_0x3703('0x1c')](_0x3703('0x68'),_0x54e4b8['id'],_0x17ca60['name'],_0x24c4e0[_0x3703('0x3e')]);switch(_0x24c4e0['type']){case _0x3703('0x69'):emit(util[_0x3703('0x45')]('user:%s',_0x17ca60[_0x3703('0x54')]),_0x3703('0x6a'),{'recordId':_0x54e4b8['id']});break;case _0x3703('0x6b'):emit(util[_0x3703('0x45')]('user:%s',_0x17ca60[_0x3703('0x54')]),_0x3703('0x6c'),{'uri':util[_0x3703('0x45')](_0x3703('0x6d'),_0x40fc09[_0x3703('0x6e')],_0x54e4b8['id'])});break;default:logger[_0x3703('0x6f')](_0x3703('0x70'));}})[_0x3703('0x71')](function(_0x5667d5){logger[_0x3703('0x6f')](_0x3703('0x60'),_0x5667d5);});};exports[_0x3703('0x72')]=function(_0x76da5a,_0x17cfed,_0x24510b,_0x2e820d,_0x279550,_0x15b16e,_0x88ce46){var _0x77c30f,_0x20aba3,_0x19c625,_0x1da67b;_0x15b16e[_0x3703('0x5e')]=intUtil[_0x3703('0x73')](_0x15b16e[_0x3703('0x5e')]);_0x15b16e[_0x3703('0x58')]=intUtil[_0x3703('0x73')](_0x15b16e[_0x3703('0x58')]);if(_0x88ce46&&_0x88ce46[_0x3703('0x74')]&&_0x88ce46[_0x3703('0x74')]!==_0x3703('0x75')){logger[_0x3703('0x1c')](_0x3703('0x76'),_0x3703('0x61'));_0x17cfed['recordingURL']=util[_0x3703('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15b16e[_0x3703('0x5e')],_0x17cfed['uniqueid'],md5(_0x17cfed[_0x3703('0x64')]));}return getConnection(_0x15b16e)[_0x3703('0x23')](function(_0x2f813c){_0x1da67b=_0x2f813c;return getUser(_0x15b16e,_0x2e820d['email'],_0x1da67b);})[_0x3703('0x23')](function(_0x187412){_0x77c30f=_0x187412;return getEndUser(_0x15b16e,_0x24510b,_0x17cfed['destcalleridname'],_0x17cfed['destcalleridnum'],_0x1da67b);})[_0x3703('0x23')](function(_0x590b80){_0x20aba3=_0x590b80;return getTicket(_0x15b16e,_0x77c30f,_0x20aba3,_0x24510b,_0x17cfed,_0x24510b['Fields'],_0x1da67b,_0x3703('0x72'));})[_0x3703('0x23')](function(_0x3df7f2){_0x19c625=_0x3df7f2;logger[_0x3703('0x1c')](_0x3703('0x77'),_0x19c625['id']);logger['info'](_0x3703('0x78'),_0x19c625['id'],_0x2e820d[_0x3703('0x54')],_0x15b16e[_0x3703('0x3e')]);switch(_0x15b16e[_0x3703('0x3e')]){case _0x3703('0x69'):emit(util['format']('user:%s',_0x2e820d[_0x3703('0x54')]),'trigger:salesforce:display',{'recordId':_0x19c625['id']});break;case _0x3703('0x6b'):emit(util['format']('user:%s',_0x2e820d['name']),'trigger:browser:url',{'uri':util[_0x3703('0x45')]('%s/%s/e',_0x1da67b[_0x3703('0x6e')],_0x19c625['id'])});break;default:logger['error'](_0x3703('0x76'),_0x3703('0x79'));}})[_0x3703('0x71')](function(_0x207c88){logger[_0x3703('0x6f')]('[OUTBOUND]',_0x207c88);});};exports[_0x3703('0x7a')]=function(_0xf93ea6,_0x3a67cd,_0x22c525,_0x522c92,_0x498287,_0x527ca0){var _0x4cf63a,_0x3964d0,_0x1fd1f2,_0x620d3;_0x527ca0[_0x3703('0x5e')]=intUtil['stripTrailingSlash'](_0x527ca0[_0x3703('0x5e')]);_0x527ca0[_0x3703('0x58')]=intUtil[_0x3703('0x73')](_0x527ca0[_0x3703('0x58')]);if(_0x498287&&_0x498287['monitor_format']){logger[_0x3703('0x1c')]('['+_0x3a67cd[_0x3703('0x7b')][_0x3703('0x7c')]()+']','Recording\x20is\x20enabled!');_0x3a67cd[_0x3703('0x62')]=util[_0x3703('0x45')](_0x3703('0x63'),_0x527ca0['serverUrl'],_0x3a67cd[_0x3703('0x64')],md5(_0x3a67cd['uniqueid']));}else{_0x3a67cd[_0x3703('0x62')]='';}return getConnection(_0x527ca0)[_0x3703('0x23')](function(_0x5f03a4){_0x620d3=_0x5f03a4;if(!_[_0x3703('0x20')](_0x522c92)){return getUser(_0x527ca0,_0x522c92['name'],_0x620d3);}else{return getUser(_0x527ca0,null,_0x620d3);}})[_0x3703('0x23')](function(_0x39dc65){_0x4cf63a=_0x39dc65;return getEndUser(_0x527ca0,_0x22c525,_0x3a67cd[_0x3703('0x66')],_0x3a67cd['calleridnum'],_0x620d3);})[_0x3703('0x23')](function(_0x1ccc55){_0x3964d0=_0x1ccc55;return getTicket(_0x527ca0,_0x4cf63a,_0x3964d0,_0x22c525,_0x3a67cd,_0x22c525['Fields'],_0x620d3);})['then'](function(_0x5e2e68){_0x1fd1f2=_0x5e2e68;logger['info']('['+_0x3a67cd[_0x3703('0x7b')][_0x3703('0x7c')]()+_0x3703('0x7d'),_0x1fd1f2['id']);logger['info']('['+_0x3a67cd[_0x3703('0x7b')][_0x3703('0x7c')]()+_0x3703('0x7e'),_0x527ca0[_0x3703('0x3e')]);})[_0x3703('0x71')](function(_0x40c42f){logger[_0x3703('0x6f')]('['+_0x3a67cd[_0x3703('0x7b')]['toUpperCase']()+']',_0x40c42f);});}; \ 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 4c82d91..547bd20 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 _0xf85c=['forEach','push','all','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','format','user:%s','emit','trigger:browser:url','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','outbound','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','error','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','ticketId','Incident\x20-\x20','ticketNumber'];(function(_0xd745e9,_0x537598){var _0x5f02a2=function(_0x475271){while(--_0x475271){_0xd745e9['push'](_0xd745e9['shift']());}};_0x5f02a2(++_0x537598);}(_0xf85c,0x89));var _0xcf85=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xf85c[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var Promise=require(_0xcf85('0x0'));var rp=require(_0xcf85('0x1'));var util=require(_0xcf85('0x2'));var md5=require('md5');var Redis=require(_0xcf85('0x3'));var intUtil=require(_0xcf85('0x4'));var config=require(_0xcf85('0x5'));var logger=require(_0xcf85('0x6'))(_0xcf85('0x7'));config[_0xcf85('0x8')]=_[_0xcf85('0x9')](config[_0xcf85('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xcf85('0xa'))(new Redis(config[_0xcf85('0x8')]));function getAdminUser(_0xf3410c,_0x569505,_0x25be05,_0x16c616,_0x578a18,_0x112b9d){return new Promise(function(_0x5d4724,_0x1176d7){var _0x3d9e79={'method':_0xcf85('0xb'),'uri':_0x16c616+_0xcf85('0xc')+'&'+_0x578a18+'&'+_0x112b9d,'auth':_0x569505,'json':!![]};return rp(_0x3d9e79)[_0xcf85('0xd')](function(_0x32d672){if(_0x32d672['result'][_0xcf85('0xe')]>0x0){_0x25be05[_0xcf85('0xf')]=_0x32d672[_0xcf85('0x10')][0x0][_0xcf85('0x11')];}logger[_0xcf85('0x12')]('['+[_0xf3410c[_0xcf85('0x13')]()]+'],\x20getAdminUser\x20crm',_0x25be05);_0x5d4724(_0x25be05);})[_0xcf85('0x14')](function(_0x55027a){logger['error']('['+[_0xf3410c[_0xcf85('0x13')]()]+']',_0x55027a['message']);_0x1176d7(_0x55027a[_0xcf85('0x15')]);});});}function getUser(_0x324add,_0x1ccf7d,_0x508f17,_0x13ebe5,_0x5c1a6d){return function(_0x7784f){logger[_0xcf85('0x12')]('['+[_0x324add[_0xcf85('0x13')]()]+_0xcf85('0x16'),_0x7784f);return new Promise(function(_0x30790d,_0x4a6220){if(intUtil[_0xcf85('0x17')](_0x7784f['userEmail'])){var _0x141df3={'method':'GET','uri':_0x508f17+_0xcf85('0x18')+_0x7784f[_0xcf85('0x19')]+'&'+_0x13ebe5+'&'+_0x5c1a6d,'auth':_0x1ccf7d,'json':!![]};logger[_0xcf85('0x12')]('['+[_0x324add[_0xcf85('0x13')]()]+_0xcf85('0x1a'),_0x141df3);return rp(_0x141df3)['then'](function(_0x32e73f){logger['info']('['+[_0x324add[_0xcf85('0x13')]()]+_0xcf85('0x1b'),_0x32e73f);if(_0x32e73f['result'][_0xcf85('0xe')]>0x0&&String(_0x32e73f[_0xcf85('0x10')][0x0][_0xcf85('0x1c')])===_0xcf85('0x1d')){_0x7784f[_0xcf85('0x1e')]=_0x32e73f[_0xcf85('0x10')][0x0][_0xcf85('0x11')];}else{_0x7784f[_0xcf85('0x1e')]=_0x7784f[_0xcf85('0xf')];_0x7784f[_0xcf85('0x19')]=_0x7784f['adminEmail'];}logger[_0xcf85('0x12')]('['+[_0x324add['toUpperCase']()]+'],\x20getUser\x20crm',_0x7784f);_0x30790d(_0x7784f);})['catch'](function(_0x419003){logger['error']('['+[_0x324add[_0xcf85('0x13')]()]+']',_0x419003[_0xcf85('0x15')]);_0x4a6220(_0x419003['message']);});}else{logger[_0xcf85('0x12')]('['+[_0x324add[_0xcf85('0x13')]()]+_0xcf85('0x1f'));_0x7784f[_0xcf85('0x1e')]=_0x7784f['adminId'];_0x7784f[_0xcf85('0x19')]=_0x7784f[_0xcf85('0x20')];_0x30790d(_0x7784f);}});};}function createEndUser(_0x427e18,_0x5090be,_0x371bfb,_0x1ff4d6,_0x4e0067){logger[_0xcf85('0x12')]('['+[_0x427e18[_0xcf85('0x13')]()]+_0xcf85('0x21'),_0x371bfb);return new Promise(function(_0xe5297e,_0x2123e9){var _0x33d6a8={'method':'POST','uri':_0x1ff4d6+'sys_user?'+_0x4e0067,'body':{'user_name':_0x371bfb[_0xcf85('0x22')],'roles':_0xcf85('0x23'),'first_name':_0x371bfb[_0xcf85('0x22')],'active':_0xcf85('0x1d'),'date_format':_0xcf85('0x24'),'phone':_0x371bfb[_0xcf85('0x22')]},'auth':_0x5090be,'json':!![]};return rp(_0x33d6a8)[_0xcf85('0xd')](function(_0x51d9d2){logger['info']('['+[_0x427e18[_0xcf85('0x13')]()]+_0xcf85('0x25'),_0x51d9d2[_0xcf85('0x10')]);_0x371bfb[_0xcf85('0x26')]=_0x51d9d2[_0xcf85('0x10')][_0xcf85('0x11')];_0xe5297e(_0x371bfb);})[_0xcf85('0x14')](function(_0x4ca2ad){logger[_0xcf85('0x27')]('['+[_0x427e18[_0xcf85('0x13')]()]+']',_0x4ca2ad[_0xcf85('0x15')]);_0x2123e9(_0x4ca2ad[_0xcf85('0x15')]);});});}function getEndUser(_0x4b62ed,_0x3ca270,_0x502bdb,_0x55f406,_0x1e9e6f){return function(_0x53f989){logger[_0xcf85('0x12')]('['+[_0x4b62ed['toUpperCase']()]+_0xcf85('0x28'),_0x53f989);return new Promise(function(_0x1c727f,_0x23428e){var _0x126ebb={'method':'GET','uri':_0x502bdb+_0xcf85('0x29')+_0x53f989[_0xcf85('0x22')]+'&'+_0x55f406+'&'+_0x1e9e6f,'auth':_0x3ca270,'json':!![]};return rp(_0x126ebb)[_0xcf85('0xd')](function(_0x2d88f0){if(_0x2d88f0['result'][_0xcf85('0xe')]>0x0){_0x53f989['endUserId']=_0x2d88f0[_0xcf85('0x10')][0x0][_0xcf85('0x11')];logger[_0xcf85('0x12')]('['+[_0x4b62ed[_0xcf85('0x13')]()]+'],\x20getEndUser\x20crm',_0x53f989);_0x1c727f(_0x53f989);}else{return createEndUser(_0x4b62ed,_0x3ca270,_0x53f989,_0x502bdb,_0x55f406)[_0xcf85('0xd')](function(_0x4074f2){logger[_0xcf85('0x12')]('['+[_0x4b62ed[_0xcf85('0x13')]()]+'],\x20createEndUser\x20crm',_0x4074f2);_0x1c727f(_0x4074f2);});}})[_0xcf85('0x14')](function(_0x127379){logger[_0xcf85('0x27')]('['+[_0x4b62ed[_0xcf85('0x13')]()]+']',_0x127379['message']);_0x23428e(_0x127379['message']);});});};}function getCustomFields(_0x29802a,_0x2f3cb0){var _0x5144a9={};if(_0x29802a['length']>0x0){_['forEach'](_0x29802a,function(_0x2c3396){if(_[_0xcf85('0x2a')]([_0xcf85('0x2b'),_0xcf85('0x2c')],_0x2c3396['type'])&&_0x2c3396[_0xcf85('0x2d')]&&!_0x2c3396[_0xcf85('0x2e')]){_0x5144a9[_0x2c3396[_0xcf85('0x2d')][_0xcf85('0x2f')]()]=_0x2c3396[_0xcf85('0x30')][_0xcf85('0x31')]();}else if(_['includes']([_0xcf85('0x2b'),'picklist'],_0x2c3396[_0xcf85('0x32')])&&_0x2c3396[_0xcf85('0x33')]&&_0x2c3396[_0xcf85('0x2e')]){_0x5144a9[_0x2c3396['idField']['toLowerCase']()]=_0x2c3396[_0xcf85('0x30')]['toString']();}else if(_0x2c3396[_0xcf85('0x32')]==='variable'&&_0x2c3396['variableName']&&_0x2c3396[_0xcf85('0x33')]&&_0x2c3396['customField']){_0x5144a9[_0x2c3396[_0xcf85('0x33')][_0xcf85('0x2f')]()]=_0x2f3cb0[_0x2c3396[_0xcf85('0x34')]]['toString']();}else if(_0x2c3396[_0xcf85('0x32')]==='customVariable'&&_0x2c3396[_0xcf85('0x35')]&&_0x2c3396[_0xcf85('0x35')]['name']&&_0x2c3396[_0xcf85('0x33')]&&_0x2c3396['customField']){_0x5144a9[_0x2c3396[_0xcf85('0x33')][_0xcf85('0x2f')]()]=_0x2f3cb0[_0x2c3396[_0xcf85('0x35')][_0xcf85('0x36')][_0xcf85('0x2f')]()][_0xcf85('0x31')]();}});}return _0x5144a9;}function getTicket(_0x3accfc,_0xb5b46f,_0x1819b1,_0x1ce1c9,_0x4c304e,_0x2bc111){return function(_0x172467){logger[_0xcf85('0x12')]('['+[_0x3accfc[_0xcf85('0x13')]()]+_0xcf85('0x37'),_0x172467);return new Promise(function(_0x533b13,_0x465fc5){var _0x5ba50a=_0x3accfc[_0xcf85('0x2f')]()==='outbound'?_0x172467['userId']:_0x172467[_0xcf85('0x26')];var _0x14cd07={'method':_0xcf85('0x38'),'uri':_0x1819b1+_0xcf85('0x39')+'?'+_0x2bc111,'body':Object[_0xcf85('0x3a')]({},{'active':_0xcf85('0x1d'),'caller_id':_0x5ba50a,'assigned_to':_0x172467['userId'],'short_description':intUtil[_0xcf85('0x3b')](_0x1ce1c9[_0xcf85('0x3c')],_0x4c304e,'\x20'),'description':intUtil[_0xcf85('0x3b')](_0x1ce1c9[_0xcf85('0x3d')],_0x4c304e,'\x0a')},getCustomFields(_0x1ce1c9[_0xcf85('0x3e')],_0x4c304e)),'auth':_0xb5b46f,'json':!![]};return rp(_0x14cd07)[_0xcf85('0xd')](function(_0x494e75){logger[_0xcf85('0x12')]('['+[_0x3accfc[_0xcf85('0x13')]()]+_0xcf85('0x3f'),_0x494e75[_0xcf85('0x10')]);_0x172467['ticketId']=_0x494e75['result'][_0xcf85('0x11')];_0x172467['ticketNumber']=_0x494e75[_0xcf85('0x10')]['number'];logger[_0xcf85('0x12')]('['+[_0x3accfc[_0xcf85('0x13')]()]+_0xcf85('0x40'),_0x172467);_0x533b13(_0x172467);})['catch'](function(_0x4ef5ba){logger['error']('['+[_0x3accfc[_0xcf85('0x13')]()]+']',_0x4ef5ba[_0xcf85('0x15')]);_0x465fc5(_0x4ef5ba[_0xcf85('0x15')]);});});};}function createRemoteTag(_0x51b722,_0x227d86,_0x466301,_0x17bb7d){return new Promise(function(_0x317edc,_0x332407){var _0x5ed6a7={'method':_0xcf85('0x38'),'uri':_0x466301+_0xcf85('0x41')+'?'+_0x17bb7d,'body':{'short_description':_0x51b722,'global':!![],'active':!![],'name':_0x51b722},'auth':_0x227d86,'json':!![]};return rp(_0x5ed6a7)[_0xcf85('0xd')](function(_0x109b3f){var _0x3d53a1=_0x109b3f[_0xcf85('0x10')]['sys_id'];_0x317edc(_0x3d53a1);});});}function getRemoteTag(_0x122a1f,_0x3e9fb2,_0x466fa8,_0x516112,_0x3b7d90){return new Promise(function(_0x4c4d87,_0x15c7ab){var _0x421de3={'method':_0xcf85('0xb'),'uri':_0x466fa8+'label'+_0xcf85('0x42')+_0x122a1f+'&'+_0x516112,'auth':_0x3e9fb2,'json':!![]};return rp(_0x421de3)[_0xcf85('0xd')](function(_0x4e70f3){if(_0x4e70f3[_0xcf85('0x10')][_0xcf85('0xe')]>0x0){var _0x10b716=_0x4e70f3[_0xcf85('0x10')][0x0][_0xcf85('0x11')];_0x4c4d87(_0x10b716);}else{return createRemoteTag(_0x122a1f,_0x3e9fb2,_0x466fa8,_0x516112)[_0xcf85('0xd')](function(_0x320057){_0x4c4d87(_0x320057);});}});});}function assignTagToIncident(_0xb45004,_0x23d9d7,_0x10445e,_0x778418,_0x312197){return new Promise(function(_0x8ac95e,_0x5f3737){var _0x18cce6={'method':_0xcf85('0x38'),'uri':_0x10445e+_0xcf85('0x43')+'?'+_0x312197,'body':{'label':_0xb45004,'table':_0xcf85('0x39'),'id_type':'Incident','table_key':_0x778418[_0xcf85('0x44')],'title':_0xcf85('0x45')+_0x778418[_0xcf85('0x46')],'id_display':_0x778418[_0xcf85('0x46')]},'auth':_0x23d9d7,'json':!![]};return rp(_0x18cce6)['then'](function(_0x28a294){_0x8ac95e();})[_0xcf85('0x14')](function(){_0x8ac95e();});});}function manageTags(_0x33a9ed,_0x5de355,_0x4be4a4,_0x2ee0ca,_0x1491a9,_0x3b3d5f,_0x2f4f06){return new Promise(function(_0x10f0f2,_0x4073c3){var _0x14af25=[];_0x5de355[_0xcf85('0x47')](function(_0x3a05f6){_0x14af25[_0xcf85('0x48')](getRemoteTag(_0x3a05f6,_0x4be4a4,_0x2ee0ca,_0x3b3d5f,_0x2f4f06));});return Promise[_0xcf85('0x49')](_0x14af25)[_0xcf85('0xd')](function(_0x4021c9){if(_0x4021c9[_0xcf85('0xe')]){logger[_0xcf85('0x12')]('['+[_0x33a9ed[_0xcf85('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4021c9);var _0x481513=[];_0x4021c9['forEach'](function(_0x48910a){_0x481513['push'](assignTagToIncident(_0x48910a,_0x4be4a4,_0x2ee0ca,_0x1491a9,_0x3b3d5f));});return Promise[_0xcf85('0x49')](_0x481513)[_0xcf85('0xd')](function(){_0x10f0f2();})[_0xcf85('0x14')](function(){_0x10f0f2();});}else{_0x10f0f2();}});});}function getTags(_0x1bc49a,_0x182baf,_0x3741ec,_0x2c6ad2,_0x38f96b,_0x2db193){return function(_0x5a19df){return new Promise(function(_0xe3585f,_0x33fc4d){var _0x701e1a=[];var _0x1bdfe7=_0x2c6ad2[_0xcf85('0x4a')];if(_0x1bdfe7&&_0x1bdfe7[_0xcf85('0xe')]>0x0){_0x701e1a=_['map'](_0x1bdfe7,_0xcf85('0x36'));}if(_0x701e1a[_0xcf85('0xe')]>0x0){return manageTags(_0x1bc49a,_0x701e1a,_0x182baf,_0x3741ec,_0x5a19df,_0x38f96b,_0x2db193)[_0xcf85('0xd')](function(){_0xe3585f(_0x5a19df);});}else{_0xe3585f(_0x5a19df);}});};}function emit(_0xeccf39,_0x2c2eb2,_0x192389){var _0x7c7e6f='%26sysparm_record_target%3Dincident'+_0xcf85('0x4b')+_0xcf85('0x4c')+'%255EORDERBYDESCnumber';var _0x86a72a={'uri':_0xeccf39+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x192389+_0x7c7e6f};io['to'](util[_0xcf85('0x4d')](_0xcf85('0x4e'),_0x2c2eb2))[_0xcf85('0x4f')](_0xcf85('0x50'),_0x86a72a);}exports['cs']=function(_0x5e3d7f,_0x2aab39,_0x101d95,_0x20e9b3,_0x45543f,_0x21c8e8,_0x2be4fd,_0x5ea1a){var _0x115ebd={};var _0x2b8c1b={'user':_0x21c8e8['username'],'pass':_0x21c8e8[_0xcf85('0x51')]};var _0x3061bb='sysparm_limit=1';var _0x2af8d9=_0xcf85('0x52');_0x21c8e8[_0xcf85('0x53')]=intUtil['stripTrailingSlash'](_0x21c8e8[_0xcf85('0x53')]);_0x21c8e8['serverUrl']=intUtil[_0xcf85('0x54')](_0x21c8e8[_0xcf85('0x55')]);var _0x28fe6c=util['format'](_0xcf85('0x56'),_0x21c8e8['remoteUri']);_0x115ebd[_0xcf85('0x19')]=!_['isNil'](_0x20e9b3)?_0x20e9b3['email']:null;_0x115ebd[_0xcf85('0x20')]=_0x21c8e8[_0xcf85('0x57')];_0x115ebd[_0xcf85('0x22')]=_0x5ea1a['toLowerCase']()===_0xcf85('0x58')?_0x2aab39['destcalleridnum']:_0x2aab39[_0xcf85('0x59')];_0x115ebd['callDirection']=_0x5ea1a===_0xcf85('0x5a')||_0x5ea1a==='unmanaged'?_0xcf85('0x5a'):'outbound';var _0x123ebf=util[_0xcf85('0x4d')](_0xcf85('0x5b'),_0x21c8e8[_0xcf85('0x55')],_0x2aab39['uniqueid'],md5(_0x2aab39[_0xcf85('0x5c')]));if(_0x45543f&&_0x45543f['monitor_format']){logger[_0xcf85('0x12')](_0xcf85('0x5d'),_0xcf85('0x5e'));_0x2aab39[_0xcf85('0x5f')]=_0x123ebf;}else if(_0x2be4fd&&_0x2be4fd[_0xcf85('0x60')]&&_0x2be4fd['recordingFormat']!=='none'){logger[_0xcf85('0x12')](_0xcf85('0x61'),_0xcf85('0x5e'));_0x2aab39[_0xcf85('0x5f')]=_0x123ebf;}else{_0x2aab39[_0xcf85('0x5f')]='';}return getAdminUser(_0x5ea1a,_0x2b8c1b,_0x115ebd,_0x28fe6c,_0x2af8d9,_0x3061bb)[_0xcf85('0xd')](getUser(_0x5ea1a,_0x2b8c1b,_0x28fe6c,_0x2af8d9,_0x3061bb))[_0xcf85('0xd')](getEndUser(_0x5ea1a,_0x2b8c1b,_0x28fe6c,_0x2af8d9,_0x3061bb))[_0xcf85('0xd')](getTicket(_0x5ea1a,_0x2b8c1b,_0x28fe6c,_0x101d95,_0x2aab39,_0x2af8d9))[_0xcf85('0xd')](function(_0x2fbd64){logger[_0xcf85('0x12')](util[_0xcf85('0x4d')](_0xcf85('0x62'),_0x2fbd64['ticketId']));logger[_0xcf85('0x12')](util['format'](_0xcf85('0x63'),_0x5ea1a));if(_0x5ea1a!==_0xcf85('0x64')){logger[_0xcf85('0x12')]('['+[_0x5ea1a['toUpperCase']()]+']',_0xcf85('0x65'));emit(_0x21c8e8['remoteUri'],_0x20e9b3[_0xcf85('0x36')],_0x2fbd64[_0xcf85('0x44')]);}})[_0xcf85('0x14')](function(_0x9f52aa){logger[_0xcf85('0x27')]('['+[_0x5ea1a[_0xcf85('0x13')]()]+_0xcf85('0x66'),util[_0xcf85('0x67')](_0x9f52aa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbfc2=['Incident','ticketId','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','email','outbound','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','info','toUpperCase','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','picklist','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','label_entry'];(function(_0x139b63,_0x389ca8){var _0x2493f2=function(_0x137a08){while(--_0x137a08){_0x139b63['push'](_0x139b63['shift']());}};_0x2493f2(++_0x389ca8);}(_0xbfc2,0x1e3));var _0x2bfc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xbfc2[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2bfc('0x0'));var Promise=require(_0x2bfc('0x1'));var rp=require(_0x2bfc('0x2'));var util=require(_0x2bfc('0x3'));var md5=require(_0x2bfc('0x4'));var Redis=require(_0x2bfc('0x5'));var intUtil=require(_0x2bfc('0x6'));var config=require(_0x2bfc('0x7'));var logger=require(_0x2bfc('0x8'))(_0x2bfc('0x9'));config[_0x2bfc('0xa')]=_[_0x2bfc('0xb')](config['redis'],{'host':_0x2bfc('0xc'),'port':0x18eb});var io=require(_0x2bfc('0xd'))(new Redis(config[_0x2bfc('0xa')]));function getAdminUser(_0x2b00a7,_0x1af245,_0x2ac148,_0x4b0254,_0x260a23,_0x43cf70){return new Promise(function(_0xb70aea,_0x3aa33b){var _0x3c888f={'method':_0x2bfc('0xe'),'uri':_0x4b0254+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x260a23+'&'+_0x43cf70,'auth':_0x1af245,'json':!![]};return rp(_0x3c888f)[_0x2bfc('0xf')](function(_0xbc29a){if(_0xbc29a[_0x2bfc('0x10')]['length']>0x0){_0x2ac148[_0x2bfc('0x11')]=_0xbc29a[_0x2bfc('0x10')][0x0][_0x2bfc('0x12')];}logger[_0x2bfc('0x13')]('['+[_0x2b00a7[_0x2bfc('0x14')]()]+'],\x20getAdminUser\x20crm',_0x2ac148);_0xb70aea(_0x2ac148);})[_0x2bfc('0x15')](function(_0x4b4dd2){logger[_0x2bfc('0x16')]('['+[_0x2b00a7[_0x2bfc('0x14')]()]+']',_0x4b4dd2[_0x2bfc('0x17')]);_0x3aa33b(_0x4b4dd2[_0x2bfc('0x17')]);});});}function getUser(_0x38f099,_0x89f39e,_0x3ad75b,_0x2d91ce,_0x52c276){return function(_0x207de4){logger[_0x2bfc('0x13')]('['+[_0x38f099['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x207de4);return new Promise(function(_0x16b568,_0x5d5353){if(intUtil[_0x2bfc('0x18')](_0x207de4[_0x2bfc('0x19')])){var _0x19f460={'method':'GET','uri':_0x3ad75b+_0x2bfc('0x1a')+_0x207de4[_0x2bfc('0x19')]+'&'+_0x2d91ce+'&'+_0x52c276,'auth':_0x89f39e,'json':!![]};logger[_0x2bfc('0x13')]('['+[_0x38f099[_0x2bfc('0x14')]()]+'],\x20getUser\x20rp\x20obj',_0x19f460);return rp(_0x19f460)[_0x2bfc('0xf')](function(_0x2e0717){logger[_0x2bfc('0x13')]('['+[_0x38f099['toUpperCase']()]+_0x2bfc('0x1b'),_0x2e0717);if(_0x2e0717[_0x2bfc('0x10')]['length']>0x0&&String(_0x2e0717[_0x2bfc('0x10')][0x0][_0x2bfc('0x1c')])===_0x2bfc('0x1d')){_0x207de4[_0x2bfc('0x1e')]=_0x2e0717['result'][0x0][_0x2bfc('0x12')];}else{_0x207de4[_0x2bfc('0x1e')]=_0x207de4[_0x2bfc('0x11')];_0x207de4[_0x2bfc('0x19')]=_0x207de4[_0x2bfc('0x1f')];}logger['info']('['+[_0x38f099[_0x2bfc('0x14')]()]+_0x2bfc('0x20'),_0x207de4);_0x16b568(_0x207de4);})['catch'](function(_0x497a8c){logger[_0x2bfc('0x16')]('['+[_0x38f099['toUpperCase']()]+']',_0x497a8c[_0x2bfc('0x17')]);_0x5d5353(_0x497a8c[_0x2bfc('0x17')]);});}else{logger[_0x2bfc('0x13')]('['+[_0x38f099[_0x2bfc('0x14')]()]+_0x2bfc('0x21'));_0x207de4[_0x2bfc('0x1e')]=_0x207de4[_0x2bfc('0x11')];_0x207de4[_0x2bfc('0x19')]=_0x207de4[_0x2bfc('0x1f')];_0x16b568(_0x207de4);}});};}function createEndUser(_0x4a83f7,_0x40e008,_0x413228,_0x5751ac,_0x1c772d){logger[_0x2bfc('0x13')]('['+[_0x4a83f7['toUpperCase']()]+_0x2bfc('0x22'),_0x413228);return new Promise(function(_0x81ed57,_0x562508){var _0x18df61={'method':_0x2bfc('0x23'),'uri':_0x5751ac+_0x2bfc('0x24')+_0x1c772d,'body':{'user_name':_0x413228['endUserNumber'],'roles':'user','first_name':_0x413228['endUserNumber'],'active':_0x2bfc('0x1d'),'date_format':_0x2bfc('0x25'),'phone':_0x413228[_0x2bfc('0x26')]},'auth':_0x40e008,'json':!![]};return rp(_0x18df61)['then'](function(_0x153be6){logger[_0x2bfc('0x13')]('['+[_0x4a83f7[_0x2bfc('0x14')]()]+_0x2bfc('0x27'),_0x153be6[_0x2bfc('0x10')]);_0x413228[_0x2bfc('0x28')]=_0x153be6['result']['sys_id'];_0x81ed57(_0x413228);})[_0x2bfc('0x15')](function(_0x3c49f){logger['error']('['+[_0x4a83f7[_0x2bfc('0x14')]()]+']',_0x3c49f[_0x2bfc('0x17')]);_0x562508(_0x3c49f[_0x2bfc('0x17')]);});});}function getEndUser(_0x439c69,_0x3262e4,_0x2db64a,_0x4bacc0,_0x1199ee){return function(_0x291adf){logger[_0x2bfc('0x13')]('['+[_0x439c69[_0x2bfc('0x14')]()]+_0x2bfc('0x29'),_0x291adf);return new Promise(function(_0x286b19,_0x222a63){var _0x562fed={'method':_0x2bfc('0xe'),'uri':_0x2db64a+_0x2bfc('0x2a')+_0x291adf[_0x2bfc('0x26')]+'&'+_0x4bacc0+'&'+_0x1199ee,'auth':_0x3262e4,'json':!![]};return rp(_0x562fed)[_0x2bfc('0xf')](function(_0xa77ac1){if(_0xa77ac1[_0x2bfc('0x10')][_0x2bfc('0x2b')]>0x0){_0x291adf[_0x2bfc('0x28')]=_0xa77ac1['result'][0x0]['sys_id'];logger[_0x2bfc('0x13')]('['+[_0x439c69['toUpperCase']()]+_0x2bfc('0x2c'),_0x291adf);_0x286b19(_0x291adf);}else{return createEndUser(_0x439c69,_0x3262e4,_0x291adf,_0x2db64a,_0x4bacc0)[_0x2bfc('0xf')](function(_0x4a5752){logger[_0x2bfc('0x13')]('['+[_0x439c69[_0x2bfc('0x14')]()]+'],\x20createEndUser\x20crm',_0x4a5752);_0x286b19(_0x4a5752);});}})[_0x2bfc('0x15')](function(_0x5b8264){logger[_0x2bfc('0x16')]('['+[_0x439c69[_0x2bfc('0x14')]()]+']',_0x5b8264['message']);_0x222a63(_0x5b8264[_0x2bfc('0x17')]);});});};}function getCustomFields(_0x1c6555,_0x32cd54){var _0x494b97={};if(_0x1c6555[_0x2bfc('0x2b')]>0x0){_[_0x2bfc('0x2d')](_0x1c6555,function(_0x4e615b){if(_[_0x2bfc('0x2e')]([_0x2bfc('0x2f'),'picklist'],_0x4e615b[_0x2bfc('0x30')])&&_0x4e615b[_0x2bfc('0x31')]&&!_0x4e615b[_0x2bfc('0x32')]){_0x494b97[_0x4e615b[_0x2bfc('0x31')][_0x2bfc('0x33')]()]=_0x4e615b[_0x2bfc('0x34')][_0x2bfc('0x35')]();}else if(_[_0x2bfc('0x2e')]([_0x2bfc('0x2f'),_0x2bfc('0x36')],_0x4e615b[_0x2bfc('0x30')])&&_0x4e615b[_0x2bfc('0x37')]&&_0x4e615b['customField']){_0x494b97[_0x4e615b[_0x2bfc('0x37')][_0x2bfc('0x33')]()]=_0x4e615b[_0x2bfc('0x34')][_0x2bfc('0x35')]();}else if(_0x4e615b[_0x2bfc('0x30')]==='variable'&&_0x4e615b[_0x2bfc('0x38')]&&_0x4e615b[_0x2bfc('0x37')]&&_0x4e615b['customField']){_0x494b97[_0x4e615b[_0x2bfc('0x37')][_0x2bfc('0x33')]()]=_0x32cd54[_0x4e615b[_0x2bfc('0x38')]][_0x2bfc('0x35')]();}else if(_0x4e615b['type']===_0x2bfc('0x39')&&_0x4e615b[_0x2bfc('0x3a')]&&_0x4e615b['Variable'][_0x2bfc('0x3b')]&&_0x4e615b[_0x2bfc('0x37')]&&_0x4e615b['customField']){_0x494b97[_0x4e615b[_0x2bfc('0x37')][_0x2bfc('0x33')]()]=_0x32cd54[_0x4e615b['Variable'][_0x2bfc('0x3b')][_0x2bfc('0x33')]()][_0x2bfc('0x35')]();}});}return _0x494b97;}function getTicket(_0x48d6b2,_0x55685c,_0x717501,_0x92d43b,_0x5b2fbc,_0x2a9ae3){return function(_0x24f9fb){logger[_0x2bfc('0x13')]('['+[_0x48d6b2[_0x2bfc('0x14')]()]+_0x2bfc('0x3c'),_0x24f9fb);return new Promise(function(_0x4398c9,_0x1f6a4c){var _0x5f56db=_0x48d6b2[_0x2bfc('0x33')]()==='outbound'?_0x24f9fb[_0x2bfc('0x1e')]:_0x24f9fb[_0x2bfc('0x28')];var _0x31ba37={'method':_0x2bfc('0x23'),'uri':_0x717501+_0x2bfc('0x3d')+'?'+_0x2a9ae3,'body':Object['assign']({},{'active':_0x2bfc('0x1d'),'caller_id':_0x5f56db,'assigned_to':_0x24f9fb['userId'],'short_description':intUtil[_0x2bfc('0x3e')](_0x92d43b[_0x2bfc('0x3f')],_0x5b2fbc,'\x20'),'description':intUtil[_0x2bfc('0x3e')](_0x92d43b[_0x2bfc('0x40')],_0x5b2fbc,'\x0a')},getCustomFields(_0x92d43b[_0x2bfc('0x41')],_0x5b2fbc)),'auth':_0x55685c,'json':!![]};return rp(_0x31ba37)[_0x2bfc('0xf')](function(_0x281a2f){logger[_0x2bfc('0x13')]('['+[_0x48d6b2[_0x2bfc('0x14')]()]+_0x2bfc('0x42'),_0x281a2f['result']);_0x24f9fb['ticketId']=_0x281a2f[_0x2bfc('0x10')][_0x2bfc('0x12')];_0x24f9fb[_0x2bfc('0x43')]=_0x281a2f['result'][_0x2bfc('0x44')];logger[_0x2bfc('0x13')]('['+[_0x48d6b2[_0x2bfc('0x14')]()]+']\x20getTicket\x20crm',_0x24f9fb);_0x4398c9(_0x24f9fb);})[_0x2bfc('0x15')](function(_0x1eb5ab){logger['error']('['+[_0x48d6b2['toUpperCase']()]+']',_0x1eb5ab[_0x2bfc('0x17')]);_0x1f6a4c(_0x1eb5ab['message']);});});};}function createRemoteTag(_0x2f6fd5,_0x3a53b6,_0x78ba3c,_0x5628b7){return new Promise(function(_0x9a0bec,_0x6fb442){var _0x3cea64={'method':_0x2bfc('0x23'),'uri':_0x78ba3c+_0x2bfc('0x45')+'?'+_0x5628b7,'body':{'short_description':_0x2f6fd5,'global':!![],'active':!![],'name':_0x2f6fd5},'auth':_0x3a53b6,'json':!![]};return rp(_0x3cea64)[_0x2bfc('0xf')](function(_0x9b5dd2){var _0x32cf81=_0x9b5dd2[_0x2bfc('0x10')][_0x2bfc('0x12')];_0x9a0bec(_0x32cf81);});});}function getRemoteTag(_0x5063b8,_0x3773e7,_0x4791bf,_0x20aa8c,_0x3abb27){return new Promise(function(_0x4915bb,_0x2ca44a){var _0x5a7dcb={'method':_0x2bfc('0xe'),'uri':_0x4791bf+_0x2bfc('0x45')+_0x2bfc('0x46')+_0x5063b8+'&'+_0x20aa8c,'auth':_0x3773e7,'json':!![]};return rp(_0x5a7dcb)[_0x2bfc('0xf')](function(_0x4e623d){if(_0x4e623d[_0x2bfc('0x10')][_0x2bfc('0x2b')]>0x0){var _0x2a0ed1=_0x4e623d['result'][0x0][_0x2bfc('0x12')];_0x4915bb(_0x2a0ed1);}else{return createRemoteTag(_0x5063b8,_0x3773e7,_0x4791bf,_0x20aa8c)['then'](function(_0x46613){_0x4915bb(_0x46613);});}});});}function assignTagToIncident(_0x2ec454,_0x3e0e70,_0x284247,_0x1d6d55,_0x35f3a1){return new Promise(function(_0x37631b,_0x433614){var _0x540c4a={'method':'POST','uri':_0x284247+_0x2bfc('0x47')+'?'+_0x35f3a1,'body':{'label':_0x2ec454,'table':_0x2bfc('0x3d'),'id_type':_0x2bfc('0x48'),'table_key':_0x1d6d55[_0x2bfc('0x49')],'title':'Incident\x20-\x20'+_0x1d6d55['ticketNumber'],'id_display':_0x1d6d55[_0x2bfc('0x43')]},'auth':_0x3e0e70,'json':!![]};return rp(_0x540c4a)[_0x2bfc('0xf')](function(_0x25d06f){_0x37631b();})[_0x2bfc('0x15')](function(){_0x37631b();});});}function manageTags(_0x1c2261,_0x43a0cd,_0x8287f0,_0x520fa3,_0x12df78,_0xb90b80,_0x346d7a){return new Promise(function(_0x1eb7f8,_0xdcb401){var _0x21fb3d=[];_0x43a0cd[_0x2bfc('0x2d')](function(_0x4e705c){_0x21fb3d[_0x2bfc('0x4a')](getRemoteTag(_0x4e705c,_0x8287f0,_0x520fa3,_0xb90b80,_0x346d7a));});return Promise['all'](_0x21fb3d)[_0x2bfc('0xf')](function(_0x2b5cb6){if(_0x2b5cb6[_0x2bfc('0x2b')]){logger[_0x2bfc('0x13')]('['+[_0x1c2261[_0x2bfc('0x14')]()]+_0x2bfc('0x4b'),_0x2b5cb6);var _0x3ffcf7=[];_0x2b5cb6[_0x2bfc('0x2d')](function(_0x2805a4){_0x3ffcf7['push'](assignTagToIncident(_0x2805a4,_0x8287f0,_0x520fa3,_0x12df78,_0xb90b80));});return Promise[_0x2bfc('0x4c')](_0x3ffcf7)['then'](function(){_0x1eb7f8();})[_0x2bfc('0x15')](function(){_0x1eb7f8();});}else{_0x1eb7f8();}});});}function getTags(_0x354cfa,_0x1731bb,_0x361dc3,_0x240850,_0x7ce391,_0x2ebfe1){return function(_0xfdf6ba){return new Promise(function(_0x4d45c0,_0x238831){var _0x21ec22=[];var _0x3a37ec=_0x240850[_0x2bfc('0x4d')];if(_0x3a37ec&&_0x3a37ec[_0x2bfc('0x2b')]>0x0){_0x21ec22=_['map'](_0x3a37ec,_0x2bfc('0x3b'));}if(_0x21ec22[_0x2bfc('0x2b')]>0x0){return manageTags(_0x354cfa,_0x21ec22,_0x1731bb,_0x361dc3,_0xfdf6ba,_0x7ce391,_0x2ebfe1)[_0x2bfc('0xf')](function(){_0x4d45c0(_0xfdf6ba);});}else{_0x4d45c0(_0xfdf6ba);}});};}function emit(_0x2e620c,_0x4ef0db,_0x680d63){var _0x382ea2=_0x2bfc('0x4e')+_0x2bfc('0x4f')+_0x2bfc('0x50')+_0x2bfc('0x51');var _0x1cda15={'uri':_0x2e620c+_0x2bfc('0x52')+_0x680d63+_0x382ea2};io['to'](util[_0x2bfc('0x53')](_0x2bfc('0x54'),_0x4ef0db))['emit'](_0x2bfc('0x55'),_0x1cda15);}exports['cs']=function(_0xc056b8,_0x2e9098,_0x3e3eed,_0x2dcfd3,_0x43a67d,_0x535210,_0x168c8b,_0xdd3203){var _0x461a73={};var _0x209db5={'user':_0x535210['username'],'pass':_0x535210[_0x2bfc('0x56')]};var _0x33d6e2=_0x2bfc('0x57');var _0x1a09be='sysparm_display_value=true';_0x535210[_0x2bfc('0x58')]=intUtil[_0x2bfc('0x59')](_0x535210[_0x2bfc('0x58')]);_0x535210[_0x2bfc('0x5a')]=intUtil[_0x2bfc('0x59')](_0x535210[_0x2bfc('0x5a')]);var _0x4f781c=util[_0x2bfc('0x53')]('%s/api/now/table/',_0x535210['remoteUri']);_0x461a73[_0x2bfc('0x19')]=!_['isNil'](_0x2dcfd3)?_0x2dcfd3[_0x2bfc('0x5b')]:null;_0x461a73[_0x2bfc('0x1f')]=_0x535210[_0x2bfc('0x5b')];_0x461a73['endUserNumber']=_0xdd3203[_0x2bfc('0x33')]()===_0x2bfc('0x5c')?_0x2e9098[_0x2bfc('0x5d')]:_0x2e9098[_0x2bfc('0x5e')];_0x461a73[_0x2bfc('0x5f')]=_0xdd3203==='queue'||_0xdd3203==='unmanaged'?'queue':_0x2bfc('0x5c');var _0x5e0b85=util[_0x2bfc('0x53')](_0x2bfc('0x60'),_0x535210['serverUrl'],_0x2e9098[_0x2bfc('0x61')],md5(_0x2e9098[_0x2bfc('0x61')]));if(_0x43a67d&&_0x43a67d[_0x2bfc('0x62')]){logger[_0x2bfc('0x13')](_0x2bfc('0x63'),_0x2bfc('0x64'));_0x2e9098[_0x2bfc('0x65')]=_0x5e0b85;}else if(_0x168c8b&&_0x168c8b[_0x2bfc('0x66')]&&_0x168c8b['recordingFormat']!==_0x2bfc('0x67')){logger['info'](_0x2bfc('0x68'),_0x2bfc('0x64'));_0x2e9098['recordingURL']=_0x5e0b85;}else{_0x2e9098['recordingURL']='';}return getAdminUser(_0xdd3203,_0x209db5,_0x461a73,_0x4f781c,_0x1a09be,_0x33d6e2)[_0x2bfc('0xf')](getUser(_0xdd3203,_0x209db5,_0x4f781c,_0x1a09be,_0x33d6e2))[_0x2bfc('0xf')](getEndUser(_0xdd3203,_0x209db5,_0x4f781c,_0x1a09be,_0x33d6e2))[_0x2bfc('0xf')](getTicket(_0xdd3203,_0x209db5,_0x4f781c,_0x3e3eed,_0x2e9098,_0x1a09be))[_0x2bfc('0xf')](function(_0x38c015){logger[_0x2bfc('0x13')](util['format'](_0x2bfc('0x69'),_0x38c015['ticketId']));logger[_0x2bfc('0x13')](util[_0x2bfc('0x53')](_0x2bfc('0x6a'),_0xdd3203));if(_0xdd3203!==_0x2bfc('0x6b')){logger[_0x2bfc('0x13')]('['+[_0xdd3203[_0x2bfc('0x14')]()]+']',_0x2bfc('0x6c'));emit(_0x535210['remoteUri'],_0x2dcfd3[_0x2bfc('0x3b')],_0x38c015['ticketId']);}})['catch'](function(_0x1cd031){logger['error']('['+[_0xdd3203['toUpperCase']()]+_0x2bfc('0x6d'),util[_0x2bfc('0x6e')](_0x1cd031,{'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 8de90fb..93a0ba5 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 _0x2bb0=['%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','unmanaged','toUpperCase','lastevent','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','variableName','push','idField','set_entry','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','JSON','isNil','get_entry_list','Employees','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','forEach','string','nameField','customField','content','custom_fields','toString','variable','type','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','destcalleridnum','Outbound','Ticket\x20created!'];(function(_0x59d585,_0x5831bc){var _0x4bf345=function(_0x490e9f){while(--_0x490e9f){_0x59d585['push'](_0x59d585['shift']());}};_0x4bf345(++_0x5831bc);}(_0x2bb0,0x1e9));var _0x02bb=function(_0x397c65,_0xfc408f){_0x397c65=_0x397c65-0x0;var _0x424bef=_0x2bb0[_0x397c65];return _0x424bef;};'use strict';var _=require(_0x02bb('0x0'));var rp=require('request-promise');var BPromise=require(_0x02bb('0x1'));var md5=require(_0x02bb('0x2'));var util=require(_0x02bb('0x3'));var Redis=require(_0x02bb('0x4'));var intUtil=require(_0x02bb('0x5'));var config=require(_0x02bb('0x6'));var logger=require(_0x02bb('0x7'))(_0x02bb('0x8'));config[_0x02bb('0x9')]=_[_0x02bb('0xa')](config[_0x02bb('0x9')],{'host':_0x02bb('0xb'),'port':0x18eb});var io=require(_0x02bb('0xc'))(new Redis(config[_0x02bb('0x9')]));var def={'method':_0x02bb('0xd'),'json':!![]};function emit(_0x207b27,_0x56d54b,_0x28ede2){io['to'](_0x207b27)[_0x02bb('0xe')](_0x56d54b,_0x28ede2);}function getTicket(_0x2d0fb6,_0x1b403e,_0x2f6173,_0x22af1c,_0x28e157,_0x292c25,_0x5a9374,_0x4ce69a){logger[_0x02bb('0xf')](_0x02bb('0x10'));var _0xbcd8c7=new Date();var _0x56bf09=[{'name':_0x02bb('0x11'),'value':intUtil[_0x02bb('0x12')](_0x22af1c['Subjects'],_0x28e157,'\x20')},{'name':_0x02bb('0x13'),'value':_0x1b403e['id']},{'name':_0x02bb('0x14'),'value':_0x1b403e['id']},{'name':_0x02bb('0x15'),'value':intUtil[_0x02bb('0x12')](_0x22af1c[_0x02bb('0x16')],_0x28e157,'\x0a')},{'name':'date_start','value':_0xbcd8c7[_0x02bb('0x17')]()[_0x02bb('0x18')](0x0,0x13)[_0x02bb('0x19')]('T','\x20')},{'name':_0x02bb('0x1a'),'value':'0'},{'name':_0x02bb('0x1b'),'value':'15'},{'name':_0x02bb('0x1c'),'value':_0x2f6173['id']},{'name':_0x02bb('0x1d'),'value':'Contacts'},{'name':_0x02bb('0x1e'),'value':_0x2f6173[_0x02bb('0x11')]},{'name':_0x02bb('0x1f'),'value':_0x4ce69a}];if(_0x292c25[_0x02bb('0x20')]){_['forEach'](_0x292c25,function(_0x13c05b){if(_0x28e157[_0x13c05b[_0x02bb('0x21')]]){_0x56bf09[_0x02bb('0x22')]({'name':_0x13c05b[_0x02bb('0x23')],'value':_0x28e157[_0x13c05b[_0x02bb('0x21')]]});}});}return request({'form':{'method':_0x02bb('0x24'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x02bb('0x25')]({'session':_0x5a9374['id'],'module_name':'Calls','name_value_list':_0x56bf09})}});}function getAuth(_0x295bbe){return util[_0x02bb('0x26')](_0x02bb('0x27'),new Buffer(_0x295bbe[_0x02bb('0x28')]+':X')['toString'](_0x02bb('0x29')));}function getServerInfo(_0x28c50a){return request({'form':{'method':_0x02bb('0x2a'),'input_type':_0x02bb('0x2b'),'response_type':_0x02bb('0x2b'),'rest_data':JSON[_0x02bb('0x25')]({'session':_0x28c50a['id']})}});}function getUser(_0x1b0778,_0xd86e51,_0x5f0319){if(!_[_0x02bb('0x2c')](_0xd86e51)){logger[_0x02bb('0xf')]('Getting\x20agent\x20with\x20name',_0xd86e51);return request({'form':{'method':_0x02bb('0x2d'),'input_type':_0x02bb('0x2b'),'response_type':_0x02bb('0x2b'),'rest_data':JSON[_0x02bb('0x25')]({'session':_0x5f0319['id'],'module_name':_0x02bb('0x2e'),'query':util[_0x02bb('0x26')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xd86e51),'order_by':'','offset':'0','select_fields':['id',_0x02bb('0x11'),_0x02bb('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x02bb('0x30')](function(_0x10e37b){if(_0x10e37b[_0x02bb('0x31')]['length']){var _0x7add0f=_[_0x02bb('0x32')](_0x10e37b[_0x02bb('0x31')],function(_0x41c28e){return _0x41c28e['name_value_list'][_0x02bb('0x2f')][_0x02bb('0x33')]===_0xd86e51;});if(_0x7add0f){logger[_0x02bb('0xf')](_0x02bb('0x34'));return BPromise[_0x02bb('0x35')]({'id':_0x7add0f[_0x02bb('0x36')]['id'][_0x02bb('0x33')],'name':_0x7add0f[_0x02bb('0x36')][_0x02bb('0x11')][_0x02bb('0x33')]});}}logger[_0x02bb('0xf')](_0x02bb('0x37'));return BPromise[_0x02bb('0x35')]({'id':_0x5f0319[_0x02bb('0x36')]['user_id'][_0x02bb('0x33')],'name':_0x5f0319[_0x02bb('0x36')]['user_name']['value']});});}else{logger['info'](_0x02bb('0x38'));return BPromise[_0x02bb('0x35')]({'id':_0x5f0319[_0x02bb('0x36')][_0x02bb('0x39')][_0x02bb('0x33')],'name':_0x5f0319[_0x02bb('0x36')][_0x02bb('0x2f')][_0x02bb('0x33')]});}}function getEndUser(_0x4e12c6,_0x422d66,_0x4e408e,_0x5dcd4f){logger[_0x02bb('0xf')]('Searching\x20enduser\x20with\x20phone',_0x4e408e);return request({'form':{'method':'get_entry_list','input_type':_0x02bb('0x2b'),'response_type':_0x02bb('0x2b'),'rest_data':JSON['stringify']({'session':_0x5dcd4f['id'],'module_name':_0x02bb('0x3a'),'query':util['format'](_0x02bb('0x3b'),_0x4e408e),'order_by':'','offset':'0','select_fields':['id',_0x02bb('0x11'),_0x02bb('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1f9247){if(_0x1f9247[_0x02bb('0x31')]['length']){var _0x14d591=_['find'](_0x1f9247['entry_list'],function(_0x2a58c0){return _0x2a58c0[_0x02bb('0x36')]['phone_home'][_0x02bb('0x33')]===_0x4e408e;});if(_0x14d591){logger[_0x02bb('0xf')](_0x02bb('0x3d'));return BPromise[_0x02bb('0x35')]({'id':_0x14d591[_0x02bb('0x36')]['id'][_0x02bb('0x33')],'name':_0x14d591['name_value_list']['name'][_0x02bb('0x33')],'phone':_0x14d591['name_value_list'][_0x02bb('0x3c')]['value']});}}else{logger[_0x02bb('0xf')](_0x02bb('0x3e'));return request({'form':{'method':_0x02bb('0x24'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x02bb('0x25')]({'session':_0x5dcd4f['id'],'module_name':_0x02bb('0x3a'),'name_value_list':[{'name':_0x02bb('0x3f'),'value':_0x422d66!==''?_0x422d66:util[_0x02bb('0x26')](_0x02bb('0x40'),_0x4e408e)},{'name':_0x02bb('0x3c'),'value':_0x4e408e}]})}})[_0x02bb('0x30')](function(_0xe8541b){logger['info'](_0x02bb('0x41'));return BPromise[_0x02bb('0x35')]({'id':_0xe8541b['id'],'name':_0xe8541b['entry_list'][_0x02bb('0x3f')]['value'],'phone':_0xe8541b['entry_list'][_0x02bb('0x3c')]['value']});});}});}function request(_0x364813){logger[_0x02bb('0x42')]('[HTTP]',JSON[_0x02bb('0x25')](_0x364813));return rp(_[_0x02bb('0x43')](def,_0x364813));}function getTags(_0x589f1e,_0x5c86d1){var _0xd58e72=[];if(_0x589f1e&&_0x589f1e[_0x02bb('0x20')]>0x0){_0xd58e72=_['map'](_0x589f1e,_0x5c86d1);}return _0xd58e72;}function getCustomFields(_0x1d88ea,_0xc53879){var _0x184ffc=[];var _0x383b02={'custom_fields':[]};if(_0x1d88ea[_0x02bb('0x20')]>0x0){_[_0x02bb('0x44')](_0x1d88ea,function(_0x4eda77){if(_0x4eda77['type']===_0x02bb('0x45')&&_0x4eda77[_0x02bb('0x46')]&&!_0x4eda77[_0x02bb('0x47')]){_0x383b02[_0x4eda77['nameField']['toLowerCase']()]=_0x4eda77[_0x02bb('0x48')]['toString']();}else if(_0x4eda77['type']===_0x02bb('0x45')&&_0x4eda77[_0x02bb('0x23')]&&_0x4eda77[_0x02bb('0x47')]){_0x383b02[_0x02bb('0x49')]['push']({'id':_0x4eda77[_0x02bb('0x23')],'value':_0x4eda77['content'][_0x02bb('0x4a')]()});}else if(_0x4eda77['type']===_0x02bb('0x4b')&&_0x4eda77[_0x02bb('0x21')]&&_0x4eda77['idField']&&_0x4eda77[_0x02bb('0x47')]){_0xc53879[_0x4eda77['variableName']]&&_0x383b02[_0x02bb('0x49')]['push']({'id':_0x4eda77[_0x02bb('0x23')],'value':_0xc53879[_0x4eda77[_0x02bb('0x21')]][_0x02bb('0x4a')]()});}else if(_0x4eda77[_0x02bb('0x4c')]===_0x02bb('0x4d')&&_0x4eda77[_0x02bb('0x4e')]&&_0x4eda77[_0x02bb('0x4e')][_0x02bb('0x11')]&&_0x4eda77[_0x02bb('0x23')]&&_0x4eda77[_0x02bb('0x47')]){_0xc53879[_0x4eda77['Variable'][_0x02bb('0x11')]['toLowerCase']()]&&_0x383b02['custom_fields'][_0x02bb('0x22')]({'id':_0x4eda77[_0x02bb('0x23')],'value':_0xc53879[_0x4eda77[_0x02bb('0x4e')][_0x02bb('0x11')]['toLowerCase']()][_0x02bb('0x4a')]()});}});}return _0x383b02;}function getConnection(_0x128c6c){return request({'method':_0x02bb('0xd'),'form':{'method':_0x02bb('0x4f'),'input_type':_0x02bb('0x2b'),'response_type':_0x02bb('0x2b'),'rest_data':JSON[_0x02bb('0x25')]({'user_auth':{'user_name':_0x128c6c[_0x02bb('0x50')],'password':_0x128c6c['password'],'encryption':_0x02bb('0x51')},'application':_0x02bb('0x52')})}})[_0x02bb('0x30')](function(_0x53bfd7){var _0x13227d=_0x53bfd7;if(_0x13227d['id']){def[_0x02bb('0x53')]=_0x13227d['id'];return BPromise[_0x02bb('0x35')](_0x13227d);}else{throw new Error(util[_0x02bb('0x26')]('Account\x20%d\x20is\x20not\x20valid',_0x128c6c['id']));}});}function setRelationship(_0x2d5b51,_0x47d1f2,_0xee3869,_0x28ade9){return request({'form':{'method':_0x02bb('0x54'),'input_type':'JSON','response_type':_0x02bb('0x2b'),'rest_data':JSON[_0x02bb('0x25')]({'session':_0x2d5b51['id'],'module_name':_0x02bb('0x55'),'module_id':_0xee3869['id'],'link_field_name':_0x28ade9,'related_ids':[_0x47d1f2['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x185e9a,_0x4360b1,_0x2d69a1,_0xbd4731,_0x361e4e,_0x592d4c){var _0x419074,_0x5bd3ef,_0x138f88,_0x189b66;_0x592d4c[_0x02bb('0x56')]=intUtil['stripTrailingSlash'](_0x592d4c[_0x02bb('0x56')]);_0x592d4c['serverUrl']=intUtil[_0x02bb('0x57')](_0x592d4c[_0x02bb('0x58')]);def[_0x02bb('0x59')]=util[_0x02bb('0x26')](_0x02bb('0x5a'),_0x592d4c[_0x02bb('0x56')]);if(_0x361e4e&&_0x361e4e[_0x02bb('0x5b')]){logger[_0x02bb('0xf')](_0x02bb('0x5c'),_0x02bb('0x5d'));_0x4360b1[_0x02bb('0x5e')]=util[_0x02bb('0x26')](_0x02bb('0x5f'),_0x592d4c['serverUrl'],_0x4360b1[_0x02bb('0x60')],md5(_0x4360b1[_0x02bb('0x60')]));}else{_0x4360b1['recordingURL']='';}return getConnection(_0x592d4c)['then'](function(_0x327634){_0x189b66=_0x327634;return getUser(_0x592d4c,_0xbd4731[_0x02bb('0x11')],_0x189b66);})[_0x02bb('0x30')](function(_0x1fb709){_0x419074=_0x1fb709;logger[_0x02bb('0xf')](_0x02bb('0x61'),_0x419074['id']);return getEndUser(_0x592d4c,_0x4360b1[_0x02bb('0x62')],_0x4360b1['calleridnum'],_0x189b66);})[_0x02bb('0x30')](function(_0x427d8f){_0x5bd3ef=_0x427d8f;logger[_0x02bb('0xf')](_0x02bb('0x63'),_0x5bd3ef['id']);return getTicket(_0x592d4c,_0x419074,_0x5bd3ef,_0x2d69a1,_0x4360b1,_0x2d69a1[_0x02bb('0x64')],_0x189b66,_0x02bb('0x65'));})[_0x02bb('0x30')](function(_0x190d4a){_0x138f88=_0x190d4a;logger[_0x02bb('0xf')]('Ticket\x20created!');logger[_0x02bb('0xf')](_0x02bb('0x66'),_0x138f88['id']);return setRelationship(_0x189b66,_0x419074,_0x138f88,'users');})['then'](function(){return setRelationship(_0x189b66,_0x5bd3ef,_0x138f88,_0x02bb('0x67'));})[_0x02bb('0x30')](function(){return getServerInfo(_0x189b66);})[_0x02bb('0x30')](function(_0x15bd11){var _0x5c778d=parseInt(_0x15bd11[_0x02bb('0x68')][_0x02bb('0x69')](0x0));var _0x58f166=util[_0x02bb('0x26')](_0x02bb('0x6a'),_0x592d4c['remoteUri'],_0x138f88['id']);if(_0x5c778d>0x6){_0x58f166=util[_0x02bb('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x592d4c['remoteUri'],_0x138f88['id']);}logger[_0x02bb('0xf')](_0x02bb('0x5c'),_0x02bb('0x6b'));emit(util['format']('user:%s',_0xbd4731[_0x02bb('0x11')]),_0x02bb('0x6c'),{'uri':_0x58f166});})[_0x02bb('0x6d')](function(_0x2deb92){logger[_0x02bb('0x6e')](_0x02bb('0x5c'),JSON[_0x02bb('0x25')](_0x2deb92));});};exports[_0x02bb('0x6f')]=function(_0x2c085f,_0x560ce7,_0x2ea004,_0x21e108,_0x425020,_0x1c2d11,_0x11aa86){var _0x40fce2,_0x53e60d,_0x54ba95,_0x4d0f22;_0x1c2d11[_0x02bb('0x56')]=intUtil[_0x02bb('0x57')](_0x1c2d11[_0x02bb('0x56')]);_0x1c2d11[_0x02bb('0x58')]=intUtil[_0x02bb('0x57')](_0x1c2d11['serverUrl']);def['uri']=util['format'](_0x02bb('0x5a'),_0x1c2d11[_0x02bb('0x56')]);if(_0x11aa86&&_0x11aa86[_0x02bb('0x70')]&&_0x11aa86[_0x02bb('0x70')]!=='none'){logger[_0x02bb('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x560ce7[_0x02bb('0x5e')]=util[_0x02bb('0x26')](_0x02bb('0x5f'),_0x1c2d11[_0x02bb('0x58')],_0x560ce7[_0x02bb('0x60')],md5(_0x560ce7[_0x02bb('0x60')]));}return getConnection(_0x1c2d11)[_0x02bb('0x30')](function(_0x3fabe1){_0x4d0f22=_0x3fabe1;return getUser(_0x1c2d11,_0x21e108[_0x02bb('0x11')],_0x4d0f22);})['then'](function(_0xf81ac9){_0x40fce2=_0xf81ac9;logger[_0x02bb('0xf')](_0x02bb('0x61'),_0x40fce2['id']);return getEndUser(_0x1c2d11,_0x560ce7['destcalleridname'],_0x560ce7[_0x02bb('0x71')],_0x4d0f22);})[_0x02bb('0x30')](function(_0x47c9a8){_0x53e60d=_0x47c9a8;logger[_0x02bb('0xf')](_0x02bb('0x63'),_0x53e60d['id']);return getTicket(_0x1c2d11,_0x40fce2,_0x53e60d,_0x2ea004,_0x560ce7,_0x2ea004[_0x02bb('0x64')],_0x4d0f22,_0x02bb('0x72'));})[_0x02bb('0x30')](function(_0x42775c){_0x54ba95=_0x42775c;logger[_0x02bb('0xf')](_0x02bb('0x73'));logger[_0x02bb('0xf')](_0x02bb('0x66'),_0x54ba95['id']);return setRelationship(_0x4d0f22,_0x40fce2,_0x54ba95,'users');})[_0x02bb('0x30')](function(){return setRelationship(_0x4d0f22,_0x53e60d,_0x54ba95,_0x02bb('0x67'));})['then'](function(){return getServerInfo(_0x4d0f22);})['then'](function(_0x1a8c1b){var _0x2fea5d=parseInt(_0x1a8c1b[_0x02bb('0x68')][_0x02bb('0x69')](0x0));var _0x45760f=util['format'](_0x02bb('0x6a'),_0x1c2d11[_0x02bb('0x56')],_0x54ba95['id']);if(_0x2fea5d>0x6){_0x45760f=util[_0x02bb('0x26')](_0x02bb('0x74'),_0x1c2d11[_0x02bb('0x56')],_0x54ba95['id']);}logger[_0x02bb('0xf')](_0x02bb('0x75'),_0x02bb('0x6b'));emit(util['format']('user:%s',_0x21e108[_0x02bb('0x11')]),_0x02bb('0x6c'),{'uri':_0x45760f});})[_0x02bb('0x6d')](function(_0x1e7289){logger[_0x02bb('0x6e')]('[OUTBOUND]',JSON[_0x02bb('0x25')](_0x1e7289));});};exports[_0x02bb('0x76')]=function(_0x2e9101,_0x2e5bd3,_0x4bee29,_0x59e6d4,_0x530811,_0x430bcb){var _0x4eadfe,_0x341a6f,_0x5d5fb7,_0x4aa45c;_0x430bcb[_0x02bb('0x56')]=intUtil[_0x02bb('0x57')](_0x430bcb[_0x02bb('0x56')]);_0x430bcb[_0x02bb('0x58')]=intUtil[_0x02bb('0x57')](_0x430bcb['serverUrl']);def[_0x02bb('0x59')]=util[_0x02bb('0x26')](_0x02bb('0x5a'),_0x430bcb[_0x02bb('0x56')]);if(_0x530811&&_0x530811[_0x02bb('0x5b')]){logger[_0x02bb('0xf')]('['+_0x2e5bd3['lastevent'][_0x02bb('0x77')]()+']',_0x02bb('0x5d'));_0x2e5bd3[_0x02bb('0x5e')]=util[_0x02bb('0x26')](_0x02bb('0x5f'),_0x430bcb['serverUrl'],_0x2e5bd3[_0x02bb('0x60')],md5(_0x2e5bd3[_0x02bb('0x60')]));}else{_0x2e5bd3[_0x02bb('0x5e')]='';}return getConnection(_0x430bcb)[_0x02bb('0x30')](function(_0xac6970){_0x4aa45c=_0xac6970;if(!_['isNil'](_0x59e6d4)){return getUser(_0x430bcb,_0x59e6d4[_0x02bb('0x11')],_0x4aa45c);}else{return getUser(_0x430bcb,null,_0x4aa45c);}})[_0x02bb('0x30')](function(_0x162314){_0x4eadfe=_0x162314;logger['info'](_0x02bb('0x61'),_0x4eadfe['id']);return getEndUser(_0x430bcb,_0x2e5bd3['calleridname'],_0x2e5bd3['calleridnum'],_0x4aa45c);})[_0x02bb('0x30')](function(_0x3ec15d){_0x341a6f=_0x3ec15d;logger[_0x02bb('0xf')]('The\x20Enduser\x20ID\x20is:',_0x341a6f['id']);return getTicket(_0x430bcb,_0x4eadfe,_0x341a6f,_0x4bee29,_0x2e5bd3,_0x4bee29['Fields'],_0x4aa45c,_0x02bb('0x65'));})['then'](function(_0x36a3b7){_0x5d5fb7=_0x36a3b7;logger[_0x02bb('0xf')]('Ticket\x20created!');logger[_0x02bb('0xf')]('The\x20Ticket\x20ID\x20is:',_0x5d5fb7['id']);return setRelationship(_0x4aa45c,_0x4eadfe,_0x5d5fb7,'users');})[_0x02bb('0x30')](function(){return setRelationship(_0x4aa45c,_0x341a6f,_0x5d5fb7,'contacts');})[_0x02bb('0x30')](function(){return getServerInfo(_0x4aa45c);})[_0x02bb('0x6d')](function(_0x1332df){logger[_0x02bb('0x6e')]('['+_0x2e5bd3[_0x02bb('0x78')][_0x02bb('0x77')]()+']',JSON['stringify'](_0x1332df));});}; \ No newline at end of file +var _0x1521=['merge','map','type','string','nameField','customField','content','Variable','custom_fields','toLowerCase','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','uri','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','Outbound','trigger:browser:url','catch','unmanaged','lastevent','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s'];(function(_0xb55fdc,_0x307914){var _0x163b2b=function(_0x17e909){while(--_0x17e909){_0xb55fdc['push'](_0xb55fdc['shift']());}};_0x163b2b(++_0x307914);}(_0x1521,0xad));var _0x1152=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x1521[_0x4cbf20];return _0x582ae4;};'use strict';var _=require('lodash');var rp=require(_0x1152('0x0'));var BPromise=require('bluebird');var md5=require(_0x1152('0x1'));var util=require(_0x1152('0x2'));var Redis=require(_0x1152('0x3'));var intUtil=require(_0x1152('0x4'));var config=require(_0x1152('0x5'));var logger=require(_0x1152('0x6'))(_0x1152('0x7'));config['redis']=_['defaults'](config[_0x1152('0x8')],{'host':_0x1152('0x9'),'port':0x18eb});var io=require(_0x1152('0xa'))(new Redis(config[_0x1152('0x8')]));var def={'method':_0x1152('0xb'),'json':!![]};function emit(_0x350f23,_0x4a48c6,_0x5174a3){io['to'](_0x350f23)['emit'](_0x4a48c6,_0x5174a3);}function getTicket(_0x5b21eb,_0x2b6607,_0x573bfc,_0x46e72b,_0x4e11b9,_0x53bf57,_0x4c01ba,_0x466116){logger['info']('Creating\x20new\x20ticket...');var _0x14c1ff=new Date();var _0x4f6f32=[{'name':_0x1152('0xc'),'value':intUtil['getString'](_0x46e72b[_0x1152('0xd')],_0x4e11b9,'\x20')},{'name':_0x1152('0xe'),'value':_0x2b6607['id']},{'name':_0x1152('0xf'),'value':_0x2b6607['id']},{'name':'description','value':intUtil[_0x1152('0x10')](_0x46e72b[_0x1152('0x11')],_0x4e11b9,'\x0a')},{'name':_0x1152('0x12'),'value':_0x14c1ff[_0x1152('0x13')]()[_0x1152('0x14')](0x0,0x13)[_0x1152('0x15')]('T','\x20')},{'name':_0x1152('0x16'),'value':'0'},{'name':_0x1152('0x17'),'value':'15'},{'name':'parent_id','value':_0x573bfc['id']},{'name':_0x1152('0x18'),'value':_0x1152('0x19')},{'name':_0x1152('0x1a'),'value':_0x573bfc[_0x1152('0xc')]},{'name':_0x1152('0x1b'),'value':_0x466116}];if(_0x53bf57['length']){_[_0x1152('0x1c')](_0x53bf57,function(_0x1ca9e1){if(_0x4e11b9[_0x1ca9e1[_0x1152('0x1d')]]){_0x4f6f32[_0x1152('0x1e')]({'name':_0x1ca9e1[_0x1152('0x1f')],'value':_0x4e11b9[_0x1ca9e1[_0x1152('0x1d')]]});}});}return request({'form':{'method':_0x1152('0x20'),'input_type':_0x1152('0x21'),'response_type':_0x1152('0x21'),'rest_data':JSON[_0x1152('0x22')]({'session':_0x4c01ba['id'],'module_name':_0x1152('0x23'),'name_value_list':_0x4f6f32})}});}function getAuth(_0x35c6ff){return util['format'](_0x1152('0x24'),new Buffer(_0x35c6ff[_0x1152('0x25')]+':X')[_0x1152('0x26')](_0x1152('0x27')));}function getServerInfo(_0x4ca7cf){return request({'form':{'method':_0x1152('0x28'),'input_type':_0x1152('0x21'),'response_type':_0x1152('0x21'),'rest_data':JSON['stringify']({'session':_0x4ca7cf['id']})}});}function getUser(_0x126762,_0x5e00a9,_0x33366b){if(!_[_0x1152('0x29')](_0x5e00a9)){logger[_0x1152('0x2a')]('Getting\x20agent\x20with\x20name',_0x5e00a9);return request({'form':{'method':_0x1152('0x2b'),'input_type':_0x1152('0x21'),'response_type':_0x1152('0x21'),'rest_data':JSON[_0x1152('0x22')]({'session':_0x33366b['id'],'module_name':'Employees','query':util[_0x1152('0x2c')](_0x1152('0x2d'),_0x5e00a9),'order_by':'','offset':'0','select_fields':['id',_0x1152('0xc'),_0x1152('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1152('0x2f')](function(_0x6a011e){if(_0x6a011e[_0x1152('0x30')][_0x1152('0x31')]){var _0x1d59b4=_['find'](_0x6a011e[_0x1152('0x30')],function(_0x4bf360){return _0x4bf360[_0x1152('0x32')][_0x1152('0x2e')][_0x1152('0x33')]===_0x5e00a9;});if(_0x1d59b4){logger[_0x1152('0x2a')](_0x1152('0x34'));return BPromise[_0x1152('0x35')]({'id':_0x1d59b4['name_value_list']['id'][_0x1152('0x33')],'name':_0x1d59b4[_0x1152('0x32')][_0x1152('0xc')][_0x1152('0x33')]});}}logger[_0x1152('0x2a')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1152('0x35')]({'id':_0x33366b['name_value_list']['user_id'][_0x1152('0x33')],'name':_0x33366b[_0x1152('0x32')][_0x1152('0x2e')][_0x1152('0x33')]});});}else{logger[_0x1152('0x2a')](_0x1152('0x36'));return BPromise[_0x1152('0x35')]({'id':_0x33366b[_0x1152('0x32')][_0x1152('0x37')][_0x1152('0x33')],'name':_0x33366b[_0x1152('0x32')]['user_name'][_0x1152('0x33')]});}}function getEndUser(_0x56726e,_0x34fc41,_0x35189b,_0x2d6577){logger[_0x1152('0x2a')](_0x1152('0x38'),_0x35189b);return request({'form':{'method':'get_entry_list','input_type':_0x1152('0x21'),'response_type':_0x1152('0x21'),'rest_data':JSON[_0x1152('0x22')]({'session':_0x2d6577['id'],'module_name':_0x1152('0x19'),'query':util[_0x1152('0x2c')](_0x1152('0x39'),_0x35189b),'order_by':'','offset':'0','select_fields':['id','name',_0x1152('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1152('0x2f')](function(_0x566923){if(_0x566923[_0x1152('0x30')][_0x1152('0x31')]){var _0x3acf9f=_[_0x1152('0x3b')](_0x566923['entry_list'],function(_0x218e7e){return _0x218e7e[_0x1152('0x32')][_0x1152('0x3a')][_0x1152('0x33')]===_0x35189b;});if(_0x3acf9f){logger[_0x1152('0x2a')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x3acf9f['name_value_list']['id'][_0x1152('0x33')],'name':_0x3acf9f[_0x1152('0x32')]['name'][_0x1152('0x33')],'phone':_0x3acf9f[_0x1152('0x32')]['phone_home'][_0x1152('0x33')]});}}else{logger[_0x1152('0x2a')](_0x1152('0x3c'));return request({'form':{'method':_0x1152('0x20'),'input_type':_0x1152('0x21'),'response_type':_0x1152('0x21'),'rest_data':JSON['stringify']({'session':_0x2d6577['id'],'module_name':_0x1152('0x19'),'name_value_list':[{'name':_0x1152('0x3d'),'value':_0x34fc41!==''?_0x34fc41:util['format'](_0x1152('0x3e'),_0x35189b)},{'name':_0x1152('0x3a'),'value':_0x35189b}]})}})[_0x1152('0x2f')](function(_0x4c371b){logger['info']('Enduser\x20created.');return BPromise[_0x1152('0x35')]({'id':_0x4c371b['id'],'name':_0x4c371b[_0x1152('0x30')][_0x1152('0x3d')][_0x1152('0x33')],'phone':_0x4c371b[_0x1152('0x30')]['phone_home']['value']});});}});}function request(_0x4a7e15){logger['debug']('[HTTP]',JSON[_0x1152('0x22')](_0x4a7e15));return rp(_[_0x1152('0x3f')](def,_0x4a7e15));}function getTags(_0x5d077f,_0x3a9732){var _0x4ac52f=[];if(_0x5d077f&&_0x5d077f['length']>0x0){_0x4ac52f=_[_0x1152('0x40')](_0x5d077f,_0x3a9732);}return _0x4ac52f;}function getCustomFields(_0x198f94,_0x2f5f33){var _0x4c8fe0=[];var _0x213cb8={'custom_fields':[]};if(_0x198f94['length']>0x0){_[_0x1152('0x1c')](_0x198f94,function(_0x13de0d){if(_0x13de0d[_0x1152('0x41')]===_0x1152('0x42')&&_0x13de0d[_0x1152('0x43')]&&!_0x13de0d[_0x1152('0x44')]){_0x213cb8[_0x13de0d['nameField']['toLowerCase']()]=_0x13de0d['content'][_0x1152('0x26')]();}else if(_0x13de0d[_0x1152('0x41')]===_0x1152('0x42')&&_0x13de0d[_0x1152('0x1f')]&&_0x13de0d['customField']){_0x213cb8['custom_fields'][_0x1152('0x1e')]({'id':_0x13de0d[_0x1152('0x1f')],'value':_0x13de0d[_0x1152('0x45')][_0x1152('0x26')]()});}else if(_0x13de0d[_0x1152('0x41')]==='variable'&&_0x13de0d[_0x1152('0x1d')]&&_0x13de0d[_0x1152('0x1f')]&&_0x13de0d[_0x1152('0x44')]){_0x2f5f33[_0x13de0d[_0x1152('0x1d')]]&&_0x213cb8['custom_fields']['push']({'id':_0x13de0d[_0x1152('0x1f')],'value':_0x2f5f33[_0x13de0d['variableName']][_0x1152('0x26')]()});}else if(_0x13de0d['type']==='customVariable'&&_0x13de0d[_0x1152('0x46')]&&_0x13de0d[_0x1152('0x46')][_0x1152('0xc')]&&_0x13de0d[_0x1152('0x1f')]&&_0x13de0d[_0x1152('0x44')]){_0x2f5f33[_0x13de0d['Variable'][_0x1152('0xc')]['toLowerCase']()]&&_0x213cb8[_0x1152('0x47')]['push']({'id':_0x13de0d[_0x1152('0x1f')],'value':_0x2f5f33[_0x13de0d[_0x1152('0x46')][_0x1152('0xc')][_0x1152('0x48')]()][_0x1152('0x26')]()});}});}return _0x213cb8;}function getConnection(_0x22aace){return request({'method':_0x1152('0xb'),'form':{'method':'login','input_type':_0x1152('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x22aace[_0x1152('0x49')],'password':_0x22aace[_0x1152('0x4a')],'encryption':_0x1152('0x4b')},'application':_0x1152('0x4c')})}})[_0x1152('0x2f')](function(_0x3eb24e){var _0x2cfc69=_0x3eb24e;if(_0x2cfc69['id']){def[_0x1152('0x4d')]=_0x2cfc69['id'];return BPromise[_0x1152('0x35')](_0x2cfc69);}else{throw new Error(util[_0x1152('0x2c')]('Account\x20%d\x20is\x20not\x20valid',_0x22aace['id']));}});}function setRelationship(_0x4a0cd9,_0x5b017d,_0x5dec4d,_0x81903a){return request({'form':{'method':_0x1152('0x4e'),'input_type':_0x1152('0x21'),'response_type':_0x1152('0x21'),'rest_data':JSON[_0x1152('0x22')]({'session':_0x4a0cd9['id'],'module_name':'Calls','module_id':_0x5dec4d['id'],'link_field_name':_0x81903a,'related_ids':[_0x5b017d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1152('0x4f')]=function(_0x1b12e9,_0x55e7f4,_0x590f06,_0x37649a,_0x3ee896,_0x14c22c){var _0x2c8517,_0x398f6b,_0x5a7733,_0x32bd5d;_0x14c22c[_0x1152('0x50')]=intUtil['stripTrailingSlash'](_0x14c22c['remoteUri']);_0x14c22c[_0x1152('0x51')]=intUtil[_0x1152('0x52')](_0x14c22c[_0x1152('0x51')]);def['uri']=util['format'](_0x1152('0x53'),_0x14c22c['remoteUri']);if(_0x3ee896&&_0x3ee896['monitor_format']){logger[_0x1152('0x2a')]('[QUEUE]',_0x1152('0x54'));_0x55e7f4['recordingURL']=util[_0x1152('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14c22c['serverUrl'],_0x55e7f4[_0x1152('0x55')],md5(_0x55e7f4[_0x1152('0x55')]));}else{_0x55e7f4[_0x1152('0x56')]='';}return getConnection(_0x14c22c)[_0x1152('0x2f')](function(_0x1acb0d){_0x32bd5d=_0x1acb0d;return getUser(_0x14c22c,_0x37649a[_0x1152('0xc')],_0x32bd5d);})[_0x1152('0x2f')](function(_0x5adcc1){_0x2c8517=_0x5adcc1;logger[_0x1152('0x2a')](_0x1152('0x57'),_0x2c8517['id']);return getEndUser(_0x14c22c,_0x55e7f4[_0x1152('0x58')],_0x55e7f4[_0x1152('0x59')],_0x32bd5d);})[_0x1152('0x2f')](function(_0x4e42ff){_0x398f6b=_0x4e42ff;logger[_0x1152('0x2a')]('The\x20Enduser\x20ID\x20is:',_0x398f6b['id']);return getTicket(_0x14c22c,_0x2c8517,_0x398f6b,_0x590f06,_0x55e7f4,_0x590f06['Fields'],_0x32bd5d,_0x1152('0x5a'));})['then'](function(_0x59f0d7){_0x5a7733=_0x59f0d7;logger[_0x1152('0x2a')](_0x1152('0x5b'));logger[_0x1152('0x2a')](_0x1152('0x5c'),_0x5a7733['id']);return setRelationship(_0x32bd5d,_0x2c8517,_0x5a7733,_0x1152('0x5d'));})['then'](function(){return setRelationship(_0x32bd5d,_0x398f6b,_0x5a7733,_0x1152('0x5e'));})[_0x1152('0x2f')](function(){return getServerInfo(_0x32bd5d);})[_0x1152('0x2f')](function(_0x578546){var _0x1b9958=parseInt(_0x578546[_0x1152('0x5f')][_0x1152('0x60')](0x0));var _0x2ecac2=util['format'](_0x1152('0x61'),_0x14c22c[_0x1152('0x50')],_0x5a7733['id']);if(_0x1b9958>0x6){_0x2ecac2=util['format'](_0x1152('0x62'),_0x14c22c['remoteUri'],_0x5a7733['id']);}logger[_0x1152('0x2a')](_0x1152('0x63'),_0x1152('0x64'));emit(util[_0x1152('0x2c')](_0x1152('0x65'),_0x37649a[_0x1152('0xc')]),'trigger:browser:url',{'uri':_0x2ecac2});})['catch'](function(_0x582c54){logger[_0x1152('0x66')](_0x1152('0x63'),JSON['stringify'](_0x582c54));});};exports[_0x1152('0x67')]=function(_0x46a2ec,_0x24daaf,_0x8871b8,_0x51deb4,_0x4bd3f9,_0x1571e0,_0x55e611){var _0x586658,_0x28d79f,_0x8715a7,_0x14c6d0;_0x1571e0[_0x1152('0x50')]=intUtil[_0x1152('0x52')](_0x1571e0[_0x1152('0x50')]);_0x1571e0[_0x1152('0x51')]=intUtil[_0x1152('0x52')](_0x1571e0[_0x1152('0x51')]);def[_0x1152('0x68')]=util['format'](_0x1152('0x53'),_0x1571e0[_0x1152('0x50')]);if(_0x55e611&&_0x55e611[_0x1152('0x69')]&&_0x55e611['recordingFormat']!==_0x1152('0x6a')){logger[_0x1152('0x2a')](_0x1152('0x6b'),_0x1152('0x54'));_0x24daaf[_0x1152('0x56')]=util[_0x1152('0x2c')](_0x1152('0x6c'),_0x1571e0[_0x1152('0x51')],_0x24daaf[_0x1152('0x55')],md5(_0x24daaf[_0x1152('0x55')]));}return getConnection(_0x1571e0)[_0x1152('0x2f')](function(_0x2db318){_0x14c6d0=_0x2db318;return getUser(_0x1571e0,_0x51deb4[_0x1152('0xc')],_0x14c6d0);})[_0x1152('0x2f')](function(_0x12f071){_0x586658=_0x12f071;logger[_0x1152('0x2a')]('The\x20User\x20ID\x20is:',_0x586658['id']);return getEndUser(_0x1571e0,_0x24daaf[_0x1152('0x6d')],_0x24daaf[_0x1152('0x6e')],_0x14c6d0);})[_0x1152('0x2f')](function(_0x39272f){_0x28d79f=_0x39272f;logger[_0x1152('0x2a')](_0x1152('0x6f'),_0x28d79f['id']);return getTicket(_0x1571e0,_0x586658,_0x28d79f,_0x8871b8,_0x24daaf,_0x8871b8[_0x1152('0x70')],_0x14c6d0,_0x1152('0x71'));})[_0x1152('0x2f')](function(_0x457c03){_0x8715a7=_0x457c03;logger[_0x1152('0x2a')](_0x1152('0x5b'));logger['info'](_0x1152('0x5c'),_0x8715a7['id']);return setRelationship(_0x14c6d0,_0x586658,_0x8715a7,_0x1152('0x5d'));})['then'](function(){return setRelationship(_0x14c6d0,_0x28d79f,_0x8715a7,_0x1152('0x5e'));})['then'](function(){return getServerInfo(_0x14c6d0);})[_0x1152('0x2f')](function(_0x54df29){var _0x3ec561=parseInt(_0x54df29['version'][_0x1152('0x60')](0x0));var _0x3b7af1=util['format'](_0x1152('0x61'),_0x1571e0[_0x1152('0x50')],_0x8715a7['id']);if(_0x3ec561>0x6){_0x3b7af1=util[_0x1152('0x2c')](_0x1152('0x62'),_0x1571e0[_0x1152('0x50')],_0x8715a7['id']);}logger[_0x1152('0x2a')](_0x1152('0x6b'),_0x1152('0x64'));emit(util['format'](_0x1152('0x65'),_0x51deb4[_0x1152('0xc')]),_0x1152('0x72'),{'uri':_0x3b7af1});})[_0x1152('0x73')](function(_0x26233e){logger[_0x1152('0x66')](_0x1152('0x6b'),JSON['stringify'](_0x26233e));});};exports[_0x1152('0x74')]=function(_0x4fe719,_0x20582e,_0x1f6104,_0x2e8ffe,_0x578f6d,_0x146e83){var _0x91659a,_0x77e9b,_0x4eec3e,_0x15de05;_0x146e83[_0x1152('0x50')]=intUtil[_0x1152('0x52')](_0x146e83['remoteUri']);_0x146e83[_0x1152('0x51')]=intUtil[_0x1152('0x52')](_0x146e83[_0x1152('0x51')]);def['uri']=util['format'](_0x1152('0x53'),_0x146e83[_0x1152('0x50')]);if(_0x578f6d&&_0x578f6d['monitor_format']){logger[_0x1152('0x2a')]('['+_0x20582e[_0x1152('0x75')]['toUpperCase']()+']',_0x1152('0x54'));_0x20582e['recordingURL']=util[_0x1152('0x2c')](_0x1152('0x6c'),_0x146e83[_0x1152('0x51')],_0x20582e['uniqueid'],md5(_0x20582e[_0x1152('0x55')]));}else{_0x20582e[_0x1152('0x56')]='';}return getConnection(_0x146e83)['then'](function(_0x56e42f){_0x15de05=_0x56e42f;if(!_[_0x1152('0x29')](_0x2e8ffe)){return getUser(_0x146e83,_0x2e8ffe[_0x1152('0xc')],_0x15de05);}else{return getUser(_0x146e83,null,_0x15de05);}})[_0x1152('0x2f')](function(_0xcd55f4){_0x91659a=_0xcd55f4;logger[_0x1152('0x2a')](_0x1152('0x57'),_0x91659a['id']);return getEndUser(_0x146e83,_0x20582e[_0x1152('0x58')],_0x20582e[_0x1152('0x59')],_0x15de05);})[_0x1152('0x2f')](function(_0x51f32b){_0x77e9b=_0x51f32b;logger[_0x1152('0x2a')]('The\x20Enduser\x20ID\x20is:',_0x77e9b['id']);return getTicket(_0x146e83,_0x91659a,_0x77e9b,_0x1f6104,_0x20582e,_0x1f6104[_0x1152('0x70')],_0x15de05,_0x1152('0x5a'));})[_0x1152('0x2f')](function(_0x15b78a){_0x4eec3e=_0x15b78a;logger[_0x1152('0x2a')]('Ticket\x20created!');logger[_0x1152('0x2a')](_0x1152('0x5c'),_0x4eec3e['id']);return setRelationship(_0x15de05,_0x91659a,_0x4eec3e,'users');})[_0x1152('0x2f')](function(){return setRelationship(_0x15de05,_0x77e9b,_0x4eec3e,'contacts');})['then'](function(){return getServerInfo(_0x15de05);})[_0x1152('0x73')](function(_0x833465){logger[_0x1152('0x66')]('['+_0x20582e[_0x1152('0x75')]['toUpperCase']()+']',JSON[_0x1152('0x22')](_0x833465));});}; \ 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 bcbbd45..2c6cd8a 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 _0xc14e=['test','lodash','util','getString','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','lastIndexOf','validateEmail'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xc14e,0x119));var _0xec14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc14e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec14('0x0'));var util=require(_0xec14('0x1'));exports[_0xec14('0x2')]=function(_0x1c22a0,_0x5dc512,_0x1fcd80){var _0xb65a55=[];if(_0x1c22a0[_0xec14('0x3')]>0x0){var _0x728ef9=_[_0xec14('0x4')](_0x1c22a0,['id']);for(var _0x22de3b=0x0;_0x22de3b<_0x728ef9['length'];_0x22de3b++){var _0x27ee07=_0x728ef9[_0x22de3b];if(_0x27ee07['type']==='string'){_0xb65a55[_0xec14('0x5')](_0x27ee07[_0xec14('0x6')]);}else if(_0x27ee07[_0xec14('0x7')]===_0xec14('0x8')&&_0x27ee07[_0xec14('0x9')]){_0x5dc512[_0x27ee07[_0xec14('0x9')]]&&_0xb65a55[_0xec14('0x5')](_0x5dc512[_0x27ee07[_0xec14('0x9')]][_0xec14('0xa')]());}else if(_0x27ee07[_0xec14('0x7')]===_0xec14('0xb')&&_0x27ee07[_0xec14('0xc')]&&_0x27ee07['Variable'][_0xec14('0xd')]){_0x5dc512[_0x27ee07[_0xec14('0xc')][_0xec14('0xd')][_0xec14('0xe')]()]&&_0xb65a55[_0xec14('0x5')](_0x5dc512[_0x27ee07[_0xec14('0xc')]['name'][_0xec14('0xe')]()][_0xec14('0xa')]());}else if(_0x27ee07[_0xec14('0x7')]===_0xec14('0xf')){if(_0x27ee07[_0xec14('0x10')]===_0xec14('0x11')&&_0x27ee07[_0xec14('0x12')]){_0xb65a55[_0xec14('0x5')](util[_0xec14('0x13')](_0xec14('0x14'),_0x27ee07[_0xec14('0x12')],_0x27ee07[_0xec14('0x15')]));}else if(_0x27ee07[_0xec14('0x10')]===_0xec14('0x8')&&_0x27ee07['variableName']&&_0x27ee07[_0xec14('0x12')]){_0x5dc512[_0x27ee07['variableName']]&&_0xb65a55[_0xec14('0x5')](util['format'](_0xec14('0x14'),_0x27ee07[_0xec14('0x12')],_0x5dc512[_0x27ee07[_0xec14('0x9')]]));}else if(_0x27ee07[_0xec14('0x10')]==='customVariable'&&_0x27ee07[_0xec14('0xc')]&&_0x27ee07[_0xec14('0xc')][_0xec14('0xd')]&&_0x27ee07[_0xec14('0x12')]){_0x5dc512[_0x27ee07[_0xec14('0xc')]['name'][_0xec14('0xe')]()]&&_0xb65a55[_0xec14('0x5')](util[_0xec14('0x13')](_0xec14('0x14'),_0x27ee07['key'],_0x5dc512[_0x27ee07[_0xec14('0xc')][_0xec14('0xd')][_0xec14('0xe')]()]));}}}}return _0xb65a55[_0xec14('0x16')](_0x1fcd80);};exports[_0xec14('0x17')]=function(_0x39fa30){var _0x49881d=_0x39fa30[_0xec14('0x18')](-0x1);if(_0x49881d==='/'){_0x39fa30=_0x39fa30['substring'](0x0,_0x39fa30[_0xec14('0x19')](_0x49881d));}return _0x39fa30;};exports[_0xec14('0x1a')]=function(_0x560718){if(!_['isNil'](_0x560718)&&_0x560718!==''){var _0x48a1a6=/^(([^<>()\[\]\\.,;:\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 _0x48a1a6[_0xec14('0x1b')](String(_0x560718)[_0xec14('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xa27e=['%s:\x20%s','keyContent','variable','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','length','sortBy','push','content','type','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa27e,0xb2));var _0xea27=function(_0x5b154e,_0x32a2f4){_0x5b154e=_0x5b154e-0x0;var _0x5357e6=_0xa27e[_0x5b154e];return _0x5357e6;};'use strict';var _=require(_0xea27('0x0'));var util=require(_0xea27('0x1'));exports['getString']=function(_0x33bc8b,_0x11ab97,_0x55d101){var _0x5027a4=[];if(_0x33bc8b[_0xea27('0x2')]>0x0){var _0x25496e=_[_0xea27('0x3')](_0x33bc8b,['id']);for(var _0x1894ed=0x0;_0x1894ed<_0x25496e[_0xea27('0x2')];_0x1894ed++){var _0x6b8bc6=_0x25496e[_0x1894ed];if(_0x6b8bc6['type']==='string'){_0x5027a4[_0xea27('0x4')](_0x6b8bc6[_0xea27('0x5')]);}else if(_0x6b8bc6[_0xea27('0x6')]==='variable'&&_0x6b8bc6[_0xea27('0x7')]){_0x11ab97[_0x6b8bc6[_0xea27('0x7')]]&&_0x5027a4[_0xea27('0x4')](_0x11ab97[_0x6b8bc6['variableName']][_0xea27('0x8')]());}else if(_0x6b8bc6['type']===_0xea27('0x9')&&_0x6b8bc6[_0xea27('0xa')]&&_0x6b8bc6[_0xea27('0xa')][_0xea27('0xb')]){_0x11ab97[_0x6b8bc6[_0xea27('0xa')][_0xea27('0xb')][_0xea27('0xc')]()]&&_0x5027a4[_0xea27('0x4')](_0x11ab97[_0x6b8bc6[_0xea27('0xa')]['name'][_0xea27('0xc')]()][_0xea27('0x8')]());}else if(_0x6b8bc6['type']===_0xea27('0xd')){if(_0x6b8bc6[_0xea27('0xe')]===_0xea27('0xf')&&_0x6b8bc6[_0xea27('0x10')]){_0x5027a4[_0xea27('0x4')](util[_0xea27('0x11')](_0xea27('0x12'),_0x6b8bc6[_0xea27('0x10')],_0x6b8bc6[_0xea27('0x13')]));}else if(_0x6b8bc6['keyType']===_0xea27('0x14')&&_0x6b8bc6[_0xea27('0x7')]&&_0x6b8bc6[_0xea27('0x10')]){_0x11ab97[_0x6b8bc6[_0xea27('0x7')]]&&_0x5027a4['push'](util[_0xea27('0x11')]('%s:\x20%s',_0x6b8bc6[_0xea27('0x10')],_0x11ab97[_0x6b8bc6[_0xea27('0x7')]]));}else if(_0x6b8bc6[_0xea27('0xe')]===_0xea27('0x9')&&_0x6b8bc6[_0xea27('0xa')]&&_0x6b8bc6['Variable']['name']&&_0x6b8bc6['key']){_0x11ab97[_0x6b8bc6['Variable']['name'][_0xea27('0xc')]()]&&_0x5027a4[_0xea27('0x4')](util[_0xea27('0x11')](_0xea27('0x12'),_0x6b8bc6[_0xea27('0x10')],_0x11ab97[_0x6b8bc6[_0xea27('0xa')]['name'][_0xea27('0xc')]()]));}}}}return _0x5027a4[_0xea27('0x15')](_0x55d101);};exports[_0xea27('0x16')]=function(_0x7779f6){var _0xa1fb99=_0x7779f6[_0xea27('0x17')](-0x1);if(_0xa1fb99==='/'){_0x7779f6=_0x7779f6[_0xea27('0x18')](0x0,_0x7779f6['lastIndexOf'](_0xa1fb99));}return _0x7779f6;};exports[_0xea27('0x19')]=function(_0x8807c0){if(!_[_0xea27('0x1a')](_0x8807c0)&&_0x8807c0!==''){var _0x361e83=/^(([^<>()\[\]\\.,;:\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 _0x361e83[_0xea27('0x1b')](String(_0x8807c0)[_0xea27('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 bc779a1..1d91653 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x1ad6df,_0x2123a9){var _0x5b4708=function(_0x28625){while(--_0x28625){_0x1ad6df['push'](_0x1ad6df['shift']());}};_0x5b4708(++_0x2123a9);}(_0x34e8,0x12c));var _0x834e=function(_0x32ce5c,_0x4f232a){_0x32ce5c=_0x32ce5c-0x0;var _0x505b72=_0x34e8[_0x32ce5c];return _0x505b72;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 7c06e78..cdd08ca 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 _0xa18f=['customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','getString','Descriptions','Fields','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','filter','length','first','Enduser\x20found!','POST','end-user','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','toString','base64','debug','[HTTP]','defaults','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','customField','custom_fields','push','idField','variableName'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xa18f,0x106));var _0xfa18=function(_0x5d9a09,_0x3f84dc){_0x5d9a09=_0x5d9a09-0x0;var _0x379cf3=_0xa18f[_0x5d9a09];return _0x379cf3;};'use strict';var _=require('lodash');var rp=require(_0xfa18('0x0'));var md5=require(_0xfa18('0x1'));var util=require(_0xfa18('0x2'));var Redis=require(_0xfa18('0x3'));var intUtil=require(_0xfa18('0x4'));var config=require(_0xfa18('0x5'));var logger=require(_0xfa18('0x6'))(_0xfa18('0x7'));config[_0xfa18('0x8')]=_['defaults'](config['redis'],{'host':_0xfa18('0x9'),'port':0x18eb});var io=require(_0xfa18('0xa'))(new Redis(config[_0xfa18('0x8')]));function emit(_0x562983,_0x583655,_0x1a2859){io['to'](_0x562983)['emit'](_0x583655,_0x1a2859);}var headers={'Content-Type':'application/json','Accept':_0xfa18('0xb')};function getTicket(_0x53c222,_0x4bc09f,_0x40ae69,_0x5c7a49,_0x6b28b0){logger[_0xfa18('0xc')](_0xfa18('0xd'));return request({'uri':util[_0xfa18('0xe')](_0xfa18('0xf'),_0x53c222[_0xfa18('0x10')]),'method':'POST','body':{'ticket':_[_0xfa18('0x11')]({'requester_id':_0x40ae69['id'],'submitter_id':_0x4bc09f?_0x4bc09f['id']:undefined,'assignee_id':_0x4bc09f?_0x4bc09f['id']:undefined,'tags':getTags(_0x5c7a49['Tags'],'name'),'subject':intUtil[_0xfa18('0x12')](_0x5c7a49['Subjects'],_0x6b28b0,'\x20'),'description':intUtil[_0xfa18('0x12')](_0x5c7a49['Descriptions'],_0x6b28b0,'\x0a'),'comment':{'public':![],'body':intUtil[_0xfa18('0x12')](_0x5c7a49[_0xfa18('0x13')],_0x6b28b0,'\x0a')}},getCustomFields(_0x5c7a49[_0xfa18('0x14')],_0x6b28b0))}})['then'](function(_0x2829ee){logger['info']('Ticket\x20created!');return _0x2829ee[_0xfa18('0x15')];});}function getUser(_0x42512a,_0x16cd7a){if(intUtil[_0xfa18('0x16')](_0x16cd7a)){logger[_0xfa18('0xc')](_0xfa18('0x17'),_0x16cd7a);return request({'uri':util['format'](_0xfa18('0x18'),_0x42512a[_0xfa18('0x10')]),'qs':{'query':util[_0xfa18('0xe')]('type:user\x20role:agent\x20email:%s',_0x16cd7a)}})[_0xfa18('0x19')](function(_0x5a8a9a){if(_0x5a8a9a['count']){logger[_0xfa18('0xc')](_0xfa18('0x1a'));return _[_0xfa18('0x1b')](_0x5a8a9a[_0xfa18('0x1c')],{'email':_0x16cd7a,'role':_0xfa18('0x1d')});}else{logger[_0xfa18('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfa18('0xe')](_0xfa18('0x1e'),_0x42512a[_0xfa18('0x10')])})[_0xfa18('0x19')](function(_0x54ba89){logger[_0xfa18('0xc')](_0xfa18('0x1f'));return _0x54ba89[_0xfa18('0x20')];});}});}else{logger[_0xfa18('0xc')](_0xfa18('0x21'));return request({'uri':util['format'](_0xfa18('0x1e'),_0x42512a[_0xfa18('0x10')])})[_0xfa18('0x19')](function(_0x2abba4){logger[_0xfa18('0xc')]('Admin\x20account\x20selected.');return _0x2abba4[_0xfa18('0x20')];});}}function getEndUser(_0x1d6ab2,_0x67a1c9,_0x3a33c2){logger[_0xfa18('0xc')](_0xfa18('0x22'),_0x3a33c2);return request({'uri':util[_0xfa18('0xe')](_0xfa18('0x18'),_0x1d6ab2['remoteUri']),'qs':{'query':util[_0xfa18('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x3a33c2)}})[_0xfa18('0x19')](function(_0x3b6ad8){var _0x4302e3;if(_0x3b6ad8['results']['length']){_0x3b6ad8[_0xfa18('0x1c')]=_[_0xfa18('0x23')](_0x3b6ad8[_0xfa18('0x1c')],{'suspended':![],'role':'end-user'});if(_0x3b6ad8['results'][_0xfa18('0x24')]){_0x4302e3=_[_0xfa18('0x25')](_0x3b6ad8[_0xfa18('0x1c')]);}}if(_0x4302e3){logger[_0xfa18('0xc')](_0xfa18('0x26'));return _0x4302e3;}else{logger[_0xfa18('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x1d6ab2[_0xfa18('0x10')]),'method':_0xfa18('0x27'),'body':{'user':{'role':_0xfa18('0x28'),'name':util[_0xfa18('0xe')](_0xfa18('0x29'),_0x67a1c9||_0x3a33c2),'phone':_0x3a33c2}}})[_0xfa18('0x19')](function(_0x56b6d7){logger[_0xfa18('0xc')](_0xfa18('0x2a'));return _0x56b6d7[_0xfa18('0x20')];});}});}function getAuth(_0x450f26){var _0x4c9b0b;if(_0x450f26['authType']===_0xfa18('0x2b')){_0x4c9b0b=util[_0xfa18('0xe')](_0xfa18('0x2c'),_0x450f26[_0xfa18('0x2d')],_0x450f26[_0xfa18('0x2b')]);}else if(_0x450f26[_0xfa18('0x2e')]===_0xfa18('0x2f')){_0x4c9b0b=util[_0xfa18('0xe')](_0xfa18('0x30'),_0x450f26[_0xfa18('0x2d')],_0x450f26['token']);}return util[_0xfa18('0xe')]('Basic\x20%s',new Buffer(_0x4c9b0b)[_0xfa18('0x31')](_0xfa18('0x32')));}function request(_0x9a9134){logger[_0xfa18('0x33')](_0xfa18('0x34'),JSON['stringify'](_0x9a9134));return rp(_[_0xfa18('0x35')](_0x9a9134,{'method':_0xfa18('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4731da,_0x1989e8){var _0xf9921c=[];if(_0x4731da&&_0x4731da[_0xfa18('0x24')]>0x0){_0xf9921c=_[_0xfa18('0x37')](_0x4731da,_0x1989e8);}return _0xf9921c;}function getCustomFields(_0xae9bee,_0x3481e7){var _0x338470=[];var _0xa491e4={'custom_fields':[]};if(_0xae9bee[_0xfa18('0x24')]>0x0){_['forEach'](_0xae9bee,function(_0x3d0d45){if(_[_0xfa18('0x38')]([_0xfa18('0x39'),_0xfa18('0x3a')],_0x3d0d45[_0xfa18('0x3b')])&&_0x3d0d45[_0xfa18('0x3c')]&&!_0x3d0d45['customField']){_0xa491e4[_0x3d0d45['nameField'][_0xfa18('0x3d')]()]=_0x3d0d45[_0xfa18('0x3e')][_0xfa18('0x31')]();}else if(_['includes']([_0xfa18('0x39'),_0xfa18('0x3a')],_0x3d0d45[_0xfa18('0x3b')])&&_0x3d0d45['idField']&&_0x3d0d45[_0xfa18('0x3f')]){_0xa491e4[_0xfa18('0x40')][_0xfa18('0x41')]({'id':_0x3d0d45[_0xfa18('0x42')],'value':_0x3d0d45[_0xfa18('0x3e')][_0xfa18('0x31')]()});}else if(_0x3d0d45['type']==='variable'&&_0x3d0d45[_0xfa18('0x43')]&&_0x3d0d45[_0xfa18('0x42')]&&_0x3d0d45['customField']){_0x3481e7[_0x3d0d45[_0xfa18('0x43')]]&&_0xa491e4['custom_fields']['push']({'id':_0x3d0d45[_0xfa18('0x42')],'value':_0x3481e7[_0x3d0d45[_0xfa18('0x43')]][_0xfa18('0x31')]()});}else if(_0x3d0d45[_0xfa18('0x3b')]===_0xfa18('0x44')&&_0x3d0d45['Variable']&&_0x3d0d45[_0xfa18('0x45')][_0xfa18('0x46')]&&_0x3d0d45[_0xfa18('0x42')]&&_0x3d0d45[_0xfa18('0x3f')]){_0x3481e7[_0x3d0d45[_0xfa18('0x45')][_0xfa18('0x46')][_0xfa18('0x3d')]()]&&_0xa491e4[_0xfa18('0x40')][_0xfa18('0x41')]({'id':_0x3d0d45[_0xfa18('0x42')],'value':_0x3481e7[_0x3d0d45[_0xfa18('0x45')][_0xfa18('0x46')][_0xfa18('0x3d')]()][_0xfa18('0x31')]()});}});}return _0xa491e4;}exports['queue']=function(_0x45dbe0,_0x3aade6,_0x2863e9,_0x3e1b32,_0x2053d0,_0xa2d2d1){var _0xa54da3,_0x2327c6;_0xa2d2d1[_0xfa18('0x10')]=intUtil[_0xfa18('0x47')](_0xa2d2d1[_0xfa18('0x10')]);_0xa2d2d1[_0xfa18('0x48')]=intUtil[_0xfa18('0x47')](_0xa2d2d1[_0xfa18('0x48')]);if(_0x2053d0&&_0x2053d0[_0xfa18('0x49')]){logger[_0xfa18('0xc')](_0xfa18('0x4a'),_0xfa18('0x4b'));_0x3aade6['recordingURL']=util[_0xfa18('0xe')](_0xfa18('0x4c'),_0xa2d2d1[_0xfa18('0x48')],_0x3aade6[_0xfa18('0x4d')],md5(_0x3aade6[_0xfa18('0x4d')]));}else{_0x3aade6[_0xfa18('0x4e')]='';}headers['Authorization']=getAuth(_0xa2d2d1);return getUser(_0xa2d2d1,_0x3e1b32['email'])[_0xfa18('0x19')](function(_0x4fac49){_0xa54da3=_0x4fac49;logger[_0xfa18('0xc')](_0xfa18('0x4f'),_0xa54da3['id']);return getEndUser(_0xa2d2d1,_0x3aade6[_0xfa18('0x50')],_0x3aade6['calleridnum']);})['then'](function(_0x4c161a){_0x2327c6=_0x4c161a;logger[_0xfa18('0xc')](_0xfa18('0x51'),_0x2327c6['id']);return getTicket(_0xa2d2d1,_0xa54da3,_0x2327c6,_0x2863e9,_0x3aade6);})[_0xfa18('0x19')](function(_0x27bc66){if(_0x27bc66){logger['info'](_0xfa18('0x52'),_0x27bc66['id']);switch(_0xa2d2d1['type']){case'integrationTab':logger[_0xfa18('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xfa18('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xa2d2d1['remoteUri'],_0xa54da3['id'],_0x27bc66['id']),'method':_0xfa18('0x27')});case _0xfa18('0x53'):logger['info'](_0xfa18('0x4a'),_0xfa18('0x54'));emit(util[_0xfa18('0xe')](_0xfa18('0x55'),_0x3e1b32['name']),_0xfa18('0x56'),{'uri':util[_0xfa18('0xe')]('%s/agent/tickets/%s',_0xa2d2d1[_0xfa18('0x10')]['replace'](_0xfa18('0x57'),''),_0x27bc66['id'])});break;default:logger[_0xfa18('0x58')](_0xfa18('0x4a'),_0xfa18('0x59'));}}})[_0xfa18('0x5a')](function(_0x44488c){logger[_0xfa18('0x58')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xfa18('0x5b')](_0x44488c,{'showHidden':!![],'depth':null}));});};exports[_0xfa18('0x5c')]=function(_0x485af1,_0x2ecf31,_0x34b4cb,_0x38c064,_0x1a6abc,_0x53d4a5,_0x13c135){var _0x455d10,_0x7d2c43;_0x53d4a5['remoteUri']=intUtil[_0xfa18('0x47')](_0x53d4a5['remoteUri']);_0x53d4a5[_0xfa18('0x48')]=intUtil[_0xfa18('0x47')](_0x53d4a5[_0xfa18('0x48')]);if(_0x13c135&&_0x13c135[_0xfa18('0x5d')]&&_0x13c135[_0xfa18('0x5d')]!==_0xfa18('0x5e')){logger[_0xfa18('0xc')](_0xfa18('0x5f'),'Recording\x20is\x20enabled!');_0x2ecf31[_0xfa18('0x4e')]=util['format'](_0xfa18('0x4c'),_0x53d4a5[_0xfa18('0x48')],_0x2ecf31[_0xfa18('0x4d')],md5(_0x2ecf31[_0xfa18('0x4d')]));}headers[_0xfa18('0x60')]=getAuth(_0x53d4a5);return getUser(_0x53d4a5,_0x38c064[_0xfa18('0x61')])[_0xfa18('0x19')](function(_0x8c5086){_0x455d10=_0x8c5086;logger[_0xfa18('0xc')](_0xfa18('0x4f'),_0x455d10['id']);return getEndUser(_0x53d4a5,_0x2ecf31[_0xfa18('0x62')],_0x2ecf31[_0xfa18('0x63')]);})[_0xfa18('0x19')](function(_0x5850b6){_0x7d2c43=_0x5850b6;logger[_0xfa18('0xc')](_0xfa18('0x51'),_0x7d2c43['id']);return getTicket(_0x53d4a5,_0x455d10,_0x7d2c43,_0x34b4cb,_0x2ecf31);})[_0xfa18('0x19')](function(_0x2d6d29){if(_0x2d6d29){logger['info'](_0xfa18('0x52'),_0x2d6d29['id']);switch(_0x53d4a5[_0xfa18('0x3b')]){case'integrationTab':logger[_0xfa18('0xc')](_0xfa18('0x5f'),_0xfa18('0x64'));return request({'uri':util[_0xfa18('0xe')](_0xfa18('0x65'),_0x53d4a5['remoteUri'],_0x455d10['id'],_0x2d6d29['id']),'method':_0xfa18('0x27')});case'newTab':logger[_0xfa18('0xc')](_0xfa18('0x5f'),_0xfa18('0x54'));emit(util[_0xfa18('0xe')]('user:%s',_0x38c064[_0xfa18('0x46')]),_0xfa18('0x56'),{'uri':util[_0xfa18('0xe')](_0xfa18('0x66'),_0x53d4a5[_0xfa18('0x10')][_0xfa18('0x67')]('/api/v2',''),_0x2d6d29['id'])});break;default:logger['error'](_0xfa18('0x5f'),_0xfa18('0x59'));}}})[_0xfa18('0x5a')](function(_0x417c7a){logger[_0xfa18('0x58')](_0xfa18('0x68'),util[_0xfa18('0x5b')](_0x417c7a,{'showHidden':!![],'depth':null}));});};exports[_0xfa18('0x69')]=function(_0x23503e,_0x5f176a,_0x1c7387,_0x4b6fa1,_0x5d7145,_0x2579fb){var _0x16203c,_0x25c764;_0x2579fb[_0xfa18('0x10')]=intUtil[_0xfa18('0x47')](_0x2579fb['remoteUri']);_0x2579fb[_0xfa18('0x48')]=intUtil[_0xfa18('0x47')](_0x2579fb[_0xfa18('0x48')]);if(_0x5d7145&&_0x5d7145[_0xfa18('0x49')]){logger[_0xfa18('0xc')]('['+_0x5f176a['lastevent'][_0xfa18('0x6a')]()+']','Recording\x20is\x20enabled!');_0x5f176a[_0xfa18('0x4e')]=util[_0xfa18('0xe')](_0xfa18('0x4c'),_0x2579fb[_0xfa18('0x48')],_0x5f176a['uniqueid'],md5(_0x5f176a[_0xfa18('0x4d')]));}else{_0x5f176a[_0xfa18('0x4e')]='';}headers['Authorization']=getAuth(_0x2579fb);return getUser(_0x2579fb)['then'](function(_0x2a2613){_0x16203c=_0x2a2613;logger[_0xfa18('0xc')](_0xfa18('0x4f'),_0x16203c['id']);return getEndUser(_0x2579fb,_0x5f176a['calleridname'],_0x5f176a[_0xfa18('0x6b')]);})['then'](function(_0x3b1a3d){_0x25c764=_0x3b1a3d;logger[_0xfa18('0xc')]('The\x20Enduser\x20ID\x20is:',_0x25c764['id']);return getTicket(_0x2579fb,_0x16203c,_0x25c764,_0x1c7387,_0x5f176a);})[_0xfa18('0x19')](function(_0x4afd4d){if(_0x4afd4d){logger['info'](_0xfa18('0x52'),_0x4afd4d['id']);}})[_0xfa18('0x5a')](function(_0x51c7c1){logger['error']('['+_0x5f176a[_0xfa18('0x6c')][_0xfa18('0x6a')]()+']'+_0xfa18('0x6d'),util[_0xfa18('0x5b')](_0x51c7c1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xead2=['idField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string'];(function(_0x3b0268,_0x7ae2ee){var _0x429c10=function(_0x461d95){while(--_0x461d95){_0x3b0268['push'](_0x3b0268['shift']());}};_0x429c10(++_0x7ae2ee);}(_0xead2,0x112));var _0x2ead=function(_0x4bb0a9,_0x3b1191){_0x4bb0a9=_0x4bb0a9-0x0;var _0x38449d=_0xead2[_0x4bb0a9];return _0x38449d;};'use strict';var _=require(_0x2ead('0x0'));var rp=require('request-promise');var md5=require(_0x2ead('0x1'));var util=require(_0x2ead('0x2'));var Redis=require(_0x2ead('0x3'));var intUtil=require(_0x2ead('0x4'));var config=require('../../../../config/environment');var logger=require(_0x2ead('0x5'))(_0x2ead('0x6'));config[_0x2ead('0x7')]=_[_0x2ead('0x8')](config[_0x2ead('0x7')],{'host':_0x2ead('0x9'),'port':0x18eb});var io=require(_0x2ead('0xa'))(new Redis(config['redis']));function emit(_0x536719,_0x1284ae,_0x47780e){io['to'](_0x536719)[_0x2ead('0xb')](_0x1284ae,_0x47780e);}var headers={'Content-Type':_0x2ead('0xc'),'Accept':'application/json'};function getTicket(_0x183c16,_0x50a383,_0x23b4c9,_0x4fb8b8,_0x5d3d82){logger[_0x2ead('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x2ead('0xe'),_0x183c16['remoteUri']),'method':_0x2ead('0xf'),'body':{'ticket':_[_0x2ead('0x10')]({'requester_id':_0x23b4c9['id'],'submitter_id':_0x50a383?_0x50a383['id']:undefined,'assignee_id':_0x50a383?_0x50a383['id']:undefined,'tags':getTags(_0x4fb8b8[_0x2ead('0x11')],_0x2ead('0x12')),'subject':intUtil[_0x2ead('0x13')](_0x4fb8b8[_0x2ead('0x14')],_0x5d3d82,'\x20'),'description':intUtil[_0x2ead('0x13')](_0x4fb8b8['Descriptions'],_0x5d3d82,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4fb8b8[_0x2ead('0x15')],_0x5d3d82,'\x0a')}},getCustomFields(_0x4fb8b8[_0x2ead('0x16')],_0x5d3d82))}})[_0x2ead('0x17')](function(_0x32a1f6){logger[_0x2ead('0xd')](_0x2ead('0x18'));return _0x32a1f6['ticket'];});}function getUser(_0xc6f65,_0x3c6127){if(intUtil[_0x2ead('0x19')](_0x3c6127)){logger[_0x2ead('0xd')](_0x2ead('0x1a'),_0x3c6127);return request({'uri':util['format'](_0x2ead('0x1b'),_0xc6f65[_0x2ead('0x1c')]),'qs':{'query':util['format'](_0x2ead('0x1d'),_0x3c6127)}})['then'](function(_0x1f3223){if(_0x1f3223['count']){logger['info'](_0x2ead('0x1e'));return _[_0x2ead('0x1f')](_0x1f3223['results'],{'email':_0x3c6127,'role':_0x2ead('0x20')});}else{logger['info'](_0x2ead('0x21'));return request({'uri':util[_0x2ead('0x22')](_0x2ead('0x23'),_0xc6f65['remoteUri'])})[_0x2ead('0x17')](function(_0x7610ae){logger[_0x2ead('0xd')](_0x2ead('0x24'));return _0x7610ae[_0x2ead('0x25')];});}});}else{logger[_0x2ead('0xd')](_0x2ead('0x21'));return request({'uri':util['format']('%s/users/me.json',_0xc6f65[_0x2ead('0x1c')])})[_0x2ead('0x17')](function(_0x467ab9){logger['info'](_0x2ead('0x24'));return _0x467ab9[_0x2ead('0x25')];});}}function getEndUser(_0x2e2088,_0x44f394,_0x757261){logger['info'](_0x2ead('0x26'),_0x757261);return request({'uri':util[_0x2ead('0x22')]('%s/search.json',_0x2e2088[_0x2ead('0x1c')]),'qs':{'query':util[_0x2ead('0x22')](_0x2ead('0x27'),_0x757261)}})[_0x2ead('0x17')](function(_0x1cbd66){var _0x4008a1;if(_0x1cbd66[_0x2ead('0x28')]['length']){_0x1cbd66[_0x2ead('0x28')]=_['filter'](_0x1cbd66[_0x2ead('0x28')],{'suspended':![],'role':_0x2ead('0x29')});if(_0x1cbd66[_0x2ead('0x28')][_0x2ead('0x2a')]){_0x4008a1=_[_0x2ead('0x2b')](_0x1cbd66[_0x2ead('0x28')]);}}if(_0x4008a1){logger[_0x2ead('0xd')](_0x2ead('0x2c'));return _0x4008a1;}else{logger[_0x2ead('0xd')](_0x2ead('0x2d'));return request({'uri':util['format']('%s/users.json',_0x2e2088[_0x2ead('0x1c')]),'method':_0x2ead('0xf'),'body':{'user':{'role':_0x2ead('0x29'),'name':util[_0x2ead('0x22')](_0x2ead('0x2e'),_0x44f394||_0x757261),'phone':_0x757261}}})['then'](function(_0x4299e2){logger[_0x2ead('0xd')](_0x2ead('0x2f'));return _0x4299e2[_0x2ead('0x25')];});}});}function getAuth(_0x5e68ad){var _0xd196ff;if(_0x5e68ad[_0x2ead('0x30')]===_0x2ead('0x31')){_0xd196ff=util[_0x2ead('0x22')]('%s:%s',_0x5e68ad['username'],_0x5e68ad[_0x2ead('0x31')]);}else if(_0x5e68ad['authType']===_0x2ead('0x32')){_0xd196ff=util['format'](_0x2ead('0x33'),_0x5e68ad[_0x2ead('0x34')],_0x5e68ad[_0x2ead('0x32')]);}return util[_0x2ead('0x22')](_0x2ead('0x35'),new Buffer(_0xd196ff)[_0x2ead('0x36')](_0x2ead('0x37')));}function request(_0x466b75){logger['debug'](_0x2ead('0x38'),JSON[_0x2ead('0x39')](_0x466b75));return rp(_[_0x2ead('0x8')](_0x466b75,{'method':_0x2ead('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x47622a,_0x78e0b){var _0x16d329=[];if(_0x47622a&&_0x47622a[_0x2ead('0x2a')]>0x0){_0x16d329=_['map'](_0x47622a,_0x78e0b);}return _0x16d329;}function getCustomFields(_0x31b3d7,_0x24347a){var _0x3a15b6=[];var _0x46a8c1={'custom_fields':[]};if(_0x31b3d7[_0x2ead('0x2a')]>0x0){_[_0x2ead('0x3b')](_0x31b3d7,function(_0x4ec35c){if(_[_0x2ead('0x3c')](['string',_0x2ead('0x3d')],_0x4ec35c[_0x2ead('0x3e')])&&_0x4ec35c[_0x2ead('0x3f')]&&!_0x4ec35c[_0x2ead('0x40')]){_0x46a8c1[_0x4ec35c['nameField'][_0x2ead('0x41')]()]=_0x4ec35c[_0x2ead('0x42')][_0x2ead('0x36')]();}else if(_['includes']([_0x2ead('0x43'),_0x2ead('0x3d')],_0x4ec35c[_0x2ead('0x3e')])&&_0x4ec35c[_0x2ead('0x44')]&&_0x4ec35c[_0x2ead('0x40')]){_0x46a8c1[_0x2ead('0x45')]['push']({'id':_0x4ec35c[_0x2ead('0x44')],'value':_0x4ec35c[_0x2ead('0x42')][_0x2ead('0x36')]()});}else if(_0x4ec35c['type']===_0x2ead('0x46')&&_0x4ec35c[_0x2ead('0x47')]&&_0x4ec35c[_0x2ead('0x44')]&&_0x4ec35c[_0x2ead('0x40')]){_0x24347a[_0x4ec35c[_0x2ead('0x47')]]&&_0x46a8c1[_0x2ead('0x45')][_0x2ead('0x48')]({'id':_0x4ec35c[_0x2ead('0x44')],'value':_0x24347a[_0x4ec35c[_0x2ead('0x47')]]['toString']()});}else if(_0x4ec35c[_0x2ead('0x3e')]===_0x2ead('0x49')&&_0x4ec35c['Variable']&&_0x4ec35c[_0x2ead('0x4a')][_0x2ead('0x12')]&&_0x4ec35c[_0x2ead('0x44')]&&_0x4ec35c['customField']){_0x24347a[_0x4ec35c[_0x2ead('0x4a')][_0x2ead('0x12')]['toLowerCase']()]&&_0x46a8c1[_0x2ead('0x45')][_0x2ead('0x48')]({'id':_0x4ec35c[_0x2ead('0x44')],'value':_0x24347a[_0x4ec35c[_0x2ead('0x4a')][_0x2ead('0x12')][_0x2ead('0x41')]()][_0x2ead('0x36')]()});}});}return _0x46a8c1;}exports[_0x2ead('0x4b')]=function(_0x4a21d9,_0x29855e,_0x526e1f,_0x4c5d37,_0x44341e,_0x14f582){var _0x5bd9a2,_0x2005f5;_0x14f582[_0x2ead('0x1c')]=intUtil[_0x2ead('0x4c')](_0x14f582[_0x2ead('0x1c')]);_0x14f582[_0x2ead('0x4d')]=intUtil['stripTrailingSlash'](_0x14f582[_0x2ead('0x4d')]);if(_0x44341e&&_0x44341e[_0x2ead('0x4e')]){logger[_0x2ead('0xd')](_0x2ead('0x4f'),_0x2ead('0x50'));_0x29855e[_0x2ead('0x51')]=util[_0x2ead('0x22')](_0x2ead('0x52'),_0x14f582[_0x2ead('0x4d')],_0x29855e[_0x2ead('0x53')],md5(_0x29855e[_0x2ead('0x53')]));}else{_0x29855e[_0x2ead('0x51')]='';}headers[_0x2ead('0x54')]=getAuth(_0x14f582);return getUser(_0x14f582,_0x4c5d37['email'])[_0x2ead('0x17')](function(_0x3dc712){_0x5bd9a2=_0x3dc712;logger[_0x2ead('0xd')](_0x2ead('0x55'),_0x5bd9a2['id']);return getEndUser(_0x14f582,_0x29855e[_0x2ead('0x56')],_0x29855e[_0x2ead('0x57')]);})[_0x2ead('0x17')](function(_0x38925e){_0x2005f5=_0x38925e;logger[_0x2ead('0xd')](_0x2ead('0x58'),_0x2005f5['id']);return getTicket(_0x14f582,_0x5bd9a2,_0x2005f5,_0x526e1f,_0x29855e);})[_0x2ead('0x17')](function(_0xbb6275){if(_0xbb6275){logger[_0x2ead('0xd')](_0x2ead('0x59'),_0xbb6275['id']);switch(_0x14f582['type']){case _0x2ead('0x5a'):logger[_0x2ead('0xd')](_0x2ead('0x4f'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2ead('0x22')](_0x2ead('0x5b'),_0x14f582['remoteUri'],_0x5bd9a2['id'],_0xbb6275['id']),'method':_0x2ead('0xf')});case _0x2ead('0x5c'):logger[_0x2ead('0xd')]('[QUEUE]',_0x2ead('0x5d'));emit(util['format'](_0x2ead('0x5e'),_0x4c5d37[_0x2ead('0x12')]),_0x2ead('0x5f'),{'uri':util[_0x2ead('0x22')](_0x2ead('0x60'),_0x14f582[_0x2ead('0x1c')][_0x2ead('0x61')]('/api/v2',''),_0xbb6275['id'])});break;default:logger['error'](_0x2ead('0x4f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2ead('0x62')](function(_0x3f7936){logger['error'](_0x2ead('0x63'),util[_0x2ead('0x64')](_0x3f7936,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0xb0fe9a,_0x5a8a14,_0x244adc,_0x497a50,_0x2a938d,_0x2d6b97,_0x42dd05){var _0x2ffc87,_0x32136a;_0x2d6b97[_0x2ead('0x1c')]=intUtil[_0x2ead('0x4c')](_0x2d6b97[_0x2ead('0x1c')]);_0x2d6b97[_0x2ead('0x4d')]=intUtil[_0x2ead('0x4c')](_0x2d6b97[_0x2ead('0x4d')]);if(_0x42dd05&&_0x42dd05[_0x2ead('0x65')]&&_0x42dd05[_0x2ead('0x65')]!==_0x2ead('0x66')){logger[_0x2ead('0xd')](_0x2ead('0x67'),_0x2ead('0x50'));_0x5a8a14['recordingURL']=util[_0x2ead('0x22')](_0x2ead('0x52'),_0x2d6b97[_0x2ead('0x4d')],_0x5a8a14[_0x2ead('0x53')],md5(_0x5a8a14[_0x2ead('0x53')]));}headers[_0x2ead('0x54')]=getAuth(_0x2d6b97);return getUser(_0x2d6b97,_0x497a50[_0x2ead('0x68')])['then'](function(_0x1c0967){_0x2ffc87=_0x1c0967;logger[_0x2ead('0xd')](_0x2ead('0x55'),_0x2ffc87['id']);return getEndUser(_0x2d6b97,_0x5a8a14[_0x2ead('0x69')],_0x5a8a14[_0x2ead('0x6a')]);})[_0x2ead('0x17')](function(_0x1e017c){_0x32136a=_0x1e017c;logger[_0x2ead('0xd')](_0x2ead('0x58'),_0x32136a['id']);return getTicket(_0x2d6b97,_0x2ffc87,_0x32136a,_0x244adc,_0x5a8a14);})[_0x2ead('0x17')](function(_0x2f66b8){if(_0x2f66b8){logger[_0x2ead('0xd')](_0x2ead('0x59'),_0x2f66b8['id']);switch(_0x2d6b97[_0x2ead('0x3e')]){case _0x2ead('0x5a'):logger[_0x2ead('0xd')](_0x2ead('0x67'),_0x2ead('0x6b'));return request({'uri':util[_0x2ead('0x22')](_0x2ead('0x5b'),_0x2d6b97[_0x2ead('0x1c')],_0x2ffc87['id'],_0x2f66b8['id']),'method':_0x2ead('0xf')});case _0x2ead('0x5c'):logger[_0x2ead('0xd')](_0x2ead('0x67'),_0x2ead('0x5d'));emit(util[_0x2ead('0x22')](_0x2ead('0x5e'),_0x497a50[_0x2ead('0x12')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x2d6b97[_0x2ead('0x1c')][_0x2ead('0x61')]('/api/v2',''),_0x2f66b8['id'])});break;default:logger[_0x2ead('0x6c')](_0x2ead('0x67'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2ead('0x62')](function(_0x14f480){logger[_0x2ead('0x6c')](_0x2ead('0x6d'),util['inspect'](_0x14f480,{'showHidden':!![],'depth':null}));});};exports[_0x2ead('0x6e')]=function(_0xeb27c4,_0x16efe9,_0x3b7f3c,_0x418dc1,_0x1487b5,_0x245191){var _0x207a8d,_0x271ff9;_0x245191['remoteUri']=intUtil[_0x2ead('0x4c')](_0x245191[_0x2ead('0x1c')]);_0x245191[_0x2ead('0x4d')]=intUtil[_0x2ead('0x4c')](_0x245191[_0x2ead('0x4d')]);if(_0x1487b5&&_0x1487b5['monitor_format']){logger[_0x2ead('0xd')]('['+_0x16efe9[_0x2ead('0x6f')][_0x2ead('0x70')]()+']',_0x2ead('0x50'));_0x16efe9['recordingURL']=util[_0x2ead('0x22')](_0x2ead('0x52'),_0x245191[_0x2ead('0x4d')],_0x16efe9[_0x2ead('0x53')],md5(_0x16efe9['uniqueid']));}else{_0x16efe9[_0x2ead('0x51')]='';}headers[_0x2ead('0x54')]=getAuth(_0x245191);return getUser(_0x245191)[_0x2ead('0x17')](function(_0x223fd2){_0x207a8d=_0x223fd2;logger[_0x2ead('0xd')]('The\x20User\x20ID\x20is:',_0x207a8d['id']);return getEndUser(_0x245191,_0x16efe9['calleridname'],_0x16efe9[_0x2ead('0x57')]);})[_0x2ead('0x17')](function(_0x1b12e5){_0x271ff9=_0x1b12e5;logger[_0x2ead('0xd')](_0x2ead('0x58'),_0x271ff9['id']);return getTicket(_0x245191,_0x207a8d,_0x271ff9,_0x3b7f3c,_0x16efe9);})['then'](function(_0x4828c0){if(_0x4828c0){logger['info'](_0x2ead('0x59'),_0x4828c0['id']);}})[_0x2ead('0x62')](function(_0x3964df){logger[_0x2ead('0x6c')]('['+_0x16efe9[_0x2ead('0x6f')]['toUpperCase']()+']'+_0x2ead('0x71'),util[_0x2ead('0x64')](_0x3964df,{'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 f72a5c9..44b6a75 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 _0xe492=['What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Call_Result','complete','connect','Answered','rejected','abandoned','Abandoned','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','SUCCESS','Call\x20created!','err','stack','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','destcalleridnum','Outbound','[OUTBOUND]','toUpperCase','/downloads?type=uniqueid&token=','lodash','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','[HTTP]','stringify','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientId','clientSecret','refresh_token','then','add','seconds','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','error','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','details','moduleCreate','log','moduleSearch','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','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name'];(function(_0x1ee7f7,_0x4345d5){var _0x619787=function(_0xb34ae8){while(--_0xb34ae8){_0x1ee7f7['push'](_0x1ee7f7['shift']());}};_0x619787(++_0x4345d5);}(_0xe492,0x169));var _0x2e49=function(_0xa6953d,_0x3cdd33){_0xa6953d=_0xa6953d-0x0;var _0x381ccc=_0xe492[_0xa6953d];return _0x381ccc;};'use strict';var _=require(_0x2e49('0x0'));var rp=require(_0x2e49('0x1'));var md5=require(_0x2e49('0x2'));var util=require(_0x2e49('0x3'));var intUtil=require('./util');var moment=require(_0x2e49('0x4'));var Redis=require('ioredis');var BPromise=require(_0x2e49('0x5'));var config=require(_0x2e49('0x6'));var logger=require(_0x2e49('0x7'))('zoho');config[_0x2e49('0x8')]=_[_0x2e49('0x9')](config[_0x2e49('0x8')],{'host':_0x2e49('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2e49('0x8')]));function emit(_0x331e05,_0x4f0132,_0x55e0e1){io['to'](_0x331e05)[_0x2e49('0xb')](_0x4f0132,_0x55e0e1);}function request(_0x11559f){logger['debug'](_0x2e49('0xc'),JSON[_0x2e49('0xd')](_0x11559f));return rp(_0x11559f);}function getCustomFields(_0x4e070d,_0x2e743f){var _0x53eb0d={};if(_0x4e070d['length']>0x0){_['forEach'](_0x4e070d,function(_0x1edcf2){if(_[_0x2e49('0xe')](['string',_0x2e49('0xf')],_0x1edcf2[_0x2e49('0x10')])&&_0x1edcf2[_0x2e49('0x11')]){_0x53eb0d[_0x1edcf2['idField']]=_0x1edcf2[_0x2e49('0x12')][_0x2e49('0x13')]();}else if(_0x1edcf2[_0x2e49('0x10')]===_0x2e49('0x14')&&_0x1edcf2[_0x2e49('0x15')]&&_0x1edcf2['idField']&&_0x2e743f[_0x1edcf2[_0x2e49('0x15')]]){_0x53eb0d[_0x1edcf2[_0x2e49('0x11')]]=_0x2e743f[_0x1edcf2[_0x2e49('0x15')]][_0x2e49('0x13')]();}else if(_0x1edcf2[_0x2e49('0x10')]===_0x2e49('0x16')&&_0x1edcf2['Variable']&&_0x1edcf2[_0x2e49('0x17')]['name']&&_0x1edcf2[_0x2e49('0x11')]&&_0x2e743f[_0x1edcf2[_0x2e49('0x17')][_0x2e49('0x18')][_0x2e49('0x19')]()]){_0x53eb0d[_0x1edcf2[_0x2e49('0x11')]]=_0x2e743f[_0x1edcf2['Variable']['name'][_0x2e49('0x19')]()][_0x2e49('0x13')]();}});}return _0x53eb0d;}function getName(_0x47c94f){if(_0x47c94f[_0x2e49('0x1a')]('\x20')>0x0){var _0x41dfda=_0x47c94f['split'](/ (.+)/);if(_0x41dfda[0x1]){return _0x41dfda;}}return[_0x47c94f,_0x47c94f];}var accountsTokens={};function getAccessToken(_0xd21fa9){return new Promise(function(_0x470fc5,_0x26a451){if(!_[_0x2e49('0x1b')](accountsTokens[_0xd21fa9['id']])&&!_[_0x2e49('0x1b')](accountsTokens[_0xd21fa9['id']][_0x2e49('0x1c')])){if(moment()[_0x2e49('0x1d')](accountsTokens[_0xd21fa9['id']][_0x2e49('0x1e')])){_0x470fc5(accountsTokens[_0xd21fa9['id']]['access_token']);}}var _0xcf4cca;switch(_0xd21fa9['zone']){case'US':_0xcf4cca='https://accounts.zoho.com';break;case'AU':_0xcf4cca=_0x2e49('0x1f');break;case'EU':_0xcf4cca='https://accounts.zoho.eu';break;case'IN':_0xcf4cca=_0x2e49('0x20');break;case'CN':_0xcf4cca=_0x2e49('0x21');break;default:_0xcf4cca=_0x2e49('0x22');break;}var _0x3ce933={'method':_0x2e49('0x23'),'uri':_0xcf4cca+'/oauth/v2/token','qs':{'refresh_token':_0xd21fa9['refreshToken'],'client_id':_0xd21fa9[_0x2e49('0x24')],'client_secret':_0xd21fa9[_0x2e49('0x25')],'grant_type':_0x2e49('0x26')},'json':!![]};return rp(_0x3ce933)[_0x2e49('0x27')](function(_0x497440){accountsTokens[_0xd21fa9['id']]={'access_token':_0x497440[_0x2e49('0x1c')],'expires_in':moment()[_0x2e49('0x28')](_0x497440[_0x2e49('0x1e')],_0x2e49('0x29'))};_0x470fc5(_0x497440[_0x2e49('0x1c')]);})['catch'](function(_0x2d1945){logger['error'](_0x2e49('0x2a'),_0x2d1945['stack']);_0x26a451(_0x2d1945);});});}function getUser(_0x1fdc1a,_0x2dd33d,_0x5a1ae0,_0x378f95){logger[_0x2e49('0x2b')](_0x2e49('0x2c'));return request({'method':_0x2e49('0x2d'),'uri':util[_0x2e49('0x2e')](_0x2e49('0x2f'),_0x2dd33d),'qs':{'type':_0x2e49('0x30')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1fdc1a},'json':!![]})[_0x2e49('0x27')](function(_0xa0e5b9){if(_0xa0e5b9[_0x2e49('0x31')]){var _0xfaca7d=-0x1;if(_[_0x2e49('0x32')](_0xa0e5b9[_0x2e49('0x31')])){if(!_['isNil'](_0x378f95)){_0xfaca7d=_[_0x2e49('0x33')](_0xa0e5b9[_0x2e49('0x31')],function(_0x375185){return _0x375185[_0x2e49('0x34')]===_0x378f95;});}if(_0xfaca7d>=0x0){logger['info'](_0x2e49('0x35'));}else{logger[_0x2e49('0x2b')](_0x2e49('0x36'));_0xfaca7d=_['findIndex'](_0xa0e5b9[_0x2e49('0x31')],function(_0x5a2747){return _0x5a2747[_0x2e49('0x37')][_0x2e49('0x18')]===_0x2e49('0x38');});}return _0xa0e5b9[_0x2e49('0x31')][_0xfaca7d];}else{if(_0xa0e5b9[_0x2e49('0x39')][_0x2e49('0x37')][_0x2e49('0x18')]===_0x2e49('0x38')){logger[_0x2e49('0x2b')](_0x2e49('0x36'));user=_0xa0e5b9[_0x2e49('0x39')];return user;}else{logger['error'](_0x2e49('0x3a'),JSON[_0x2e49('0xd')](_0xa0e5b9));throw new Error(_0x2e49('0x3b')+JSON[_0x2e49('0xd')](_0xa0e5b9));}}}else{logger['error'](_0x2e49('0x3a'),JSON[_0x2e49('0xd')](_0xa0e5b9));throw new Error(_0x2e49('0x3b')+JSON['stringify'](_0xa0e5b9));}})[_0x2e49('0x3c')](function(_0xe6f39f){console[_0x2e49('0x3d')](_0xe6f39f);});}function getZohoUser(_0x55bbf8,_0x37b76c){return new BPromise(function(_0x52e547,_0x584d4b){request(_0x55bbf8)[_0x2e49('0x27')](function(_0x4e6b8c){var _0x37dcfa=null;if(_0x4e6b8c){_0x37dcfa=_0x4e6b8c[_0x2e49('0x3e')][0x0];_0x37dcfa[_0x2e49('0x3f')]=_0x37b76c;}_0x52e547(_0x37dcfa);})[_0x2e49('0x3c')](function(_0x2d1546){_0x584d4b(_0x2d1546);});});}function createEndUser(_0x40f89e,_0x3f8047,_0x3800a3,_0x2093e0,_0x1c4b00,_0x2b09c8){var _0x3800a3=getName(_0x3800a3);return request({'method':_0x2e49('0x23'),'uri':_0x2e49('0x40')+_0x3f8047+_0x2e49('0x41')+_[_0x2e49('0x42')](_0x2b09c8['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x3800a3[0x1],'First_Name':_0x3800a3[0x0],'Phone':_0x2093e0,'Owner':{'name':!_[_0x2e49('0x1b')](_0x1c4b00[_0x2e49('0x43')][_0x2e49('0x18')])?_0x1c4b00[_0x2e49('0x43')][_0x2e49('0x18')]:!_[_0x2e49('0x1b')](_0x1c4b00['first_name'])?_0x1c4b00[_0x2e49('0x44')]+'\x20'+_0x1c4b00['last_name']:_0x1c4b00[_0x2e49('0x45')],'id':_0x1c4b00['id']}}]},'headers':{'Authorization':_0x2e49('0x46')+_0x40f89e},'json':!![]})[_0x2e49('0x27')](function(_0x3a64ae){if(_0x3a64ae&&_0x3a64ae[_0x2e49('0x3e')][0x0][_0x2e49('0x47')]==='SUCCESS'){var _0x451d8b=_0x3a64ae['data'][0x0][_0x2e49('0x48')];_0x451d8b[_0x2e49('0x3f')]=_[_0x2e49('0x42')](_0x2b09c8[_0x2e49('0x49')])+'s';return _0x451d8b;}logger[_0x2e49('0x3d')](_0x2e49('0x3a'),JSON[_0x2e49('0xd')](data));throw new Error('Error:\x20'+JSON[_0x2e49('0xd')](data));})[_0x2e49('0x3c')](function(_0x1d98c8){console[_0x2e49('0x4a')]('CREATE\x20ERROR',_0x1d98c8);});}function getEndUser(_0x497d69,_0x502366,_0x4797d0,_0x56fac4,_0x2eb775,_0x521401,_0x5d735b){var _0x3104eb={'method':_0x2e49('0x2d'),'uri':'','headers':{'Authorization':_0x2e49('0x46')+_0x497d69},'json':!![]};switch(_0x5d735b[_0x2e49('0x4b')]){case _0x2e49('0x4c'):_0x3104eb[_0x2e49('0x4d')]=_0x2e49('0x40')+_0x502366+_0x2e49('0x4e')+_0x2eb775+'))';return getZohoUser(_0x3104eb,_0x2e49('0x4f'))['then'](function(_0x13c2c1){if(_0x13c2c1)return _0x13c2c1;_0x3104eb['uri']=_0x2e49('0x40')+_0x502366+_0x2e49('0x50')+_0x2eb775+'))';return getZohoUser(_0x3104eb,'Leads')['then'](function(_0x576752){if(_0x576752)return _0x576752;if(_0x5d735b[_0x2e49('0x49')]!=_0x2e49('0x51')){return createEndUser(_0x497d69,_0x502366,_0x56fac4,_0x2eb775,_0x521401,_0x5d735b);}else{return{};}});});break;case _0x2e49('0x52'):_0x3104eb[_0x2e49('0x4d')]=_0x2e49('0x40')+_0x502366+_0x2e49('0x4e')+_0x2eb775+'))';return getZohoUser(_0x3104eb,_0x2e49('0x4f'))[_0x2e49('0x27')](function(_0x28f5f6){if(_0x28f5f6)return _0x28f5f6;if(_0x5d735b[_0x2e49('0x49')]!='nothing'){return createEndUser(_0x497d69,_0x502366,_0x56fac4,_0x2eb775,_0x521401,_0x5d735b);}else{return{};}});break;case _0x2e49('0x53'):_0x3104eb['uri']='https://www.zohoapis.'+_0x502366+_0x2e49('0x50')+_0x2eb775+'))';return getZohoUser(_0x3104eb,_0x2e49('0x54'))[_0x2e49('0x27')](function(_0x2c2bbd){if(_0x2c2bbd)return _0x2c2bbd;if(_0x5d735b['moduleCreate']!=_0x2e49('0x51')){return createEndUser(_0x497d69,_0x502366,_0x56fac4,_0x2eb775,_0x521401,_0x5d735b);}else{return{};}});break;}}function getCall(_0x4c8fc7,_0x9fad32,_0x28c4db,_0x55bea2,_0x112618,_0x496b6d,_0x599d32,_0x66c35b){logger[_0x2e49('0x2b')](_0x2e49('0x55'));var _0x461615={};_0x461615[_0x2e49('0x56')]={'name':!_[_0x2e49('0x1b')](_0x55bea2[_0x2e49('0x43')][_0x2e49('0x18')])&&!_[_0x2e49('0x1b')](_0x55bea2['profile'][_0x2e49('0x18')])&&_0x55bea2[_0x2e49('0x37')][_0x2e49('0x18')]==='administrator'?_0x55bea2[_0x2e49('0x43')]['name']:!_[_0x2e49('0x1b')](_0x55bea2['first_name'])?_0x55bea2[_0x2e49('0x44')]+'\x20'+_0x55bea2[_0x2e49('0x45')]:_0x55bea2[_0x2e49('0x45')],'id':_0x55bea2['id']};_0x461615[_0x2e49('0x57')]=intUtil['getString'](_0x496b6d[_0x2e49('0x58')],_0x599d32,'\x20');_0x461615[_0x2e49('0x59')]=intUtil['getString'](_0x496b6d[_0x2e49('0x5a')],_0x599d32,'\x0a');if(_0x112618[_0x2e49('0x3f')]==='Contacts'){_0x461615[_0x2e49('0x5b')]={'name':!_[_0x2e49('0x1b')](_0x112618[_0x2e49('0x5c')])?_0x112618[_0x2e49('0x5c')]:!_[_0x2e49('0x1b')](_0x112618[_0x2e49('0x5d')])?_0x112618[_0x2e49('0x5d')]+'\x20'+_0x112618[_0x2e49('0x5e')]:_0x112618['Last_Name'],'id':_0x112618['id']};}if(_0x112618['enduserType']===_0x2e49('0x54')){_0x461615[_0x2e49('0x5f')]={'name':!_['isNil'](_0x112618['Full_Name'])?_0x112618[_0x2e49('0x5c')]:!_[_0x2e49('0x1b')](_0x112618[_0x2e49('0x5d')])?_0x112618[_0x2e49('0x5d')]+'\x20'+_0x112618[_0x2e49('0x5e')]:_0x112618['Last_Name'],'id':_0x112618['id']};_0x461615[_0x2e49('0x60')]=_[_0x2e49('0x42')](_0x112618[_0x2e49('0x3f')]);}if(_0x599d32[_0x2e49('0x61')]){_0x461615[_0x2e49('0x62')]=moment[_0x2e49('0x63')](parseInt(_0x599d32[_0x2e49('0x61')])*0x3e8)['format']('mm:ss');}else if(_0x599d32[_0x2e49('0x64')]&&_0x599d32[_0x2e49('0x65')]){_0x461615[_0x2e49('0x62')]=moment[_0x2e49('0x63')](moment(_0x599d32[_0x2e49('0x65')],_0x2e49('0x66'))['diff'](moment(_0x599d32[_0x2e49('0x67')],_0x2e49('0x66'))))[_0x2e49('0x2e')](_0x2e49('0x68'));}switch(_0x599d32[_0x2e49('0x69')]){case _0x2e49('0x6a'):_0x461615[_0x2e49('0x6b')]='Called';break;case _0x2e49('0x6c'):case _0x2e49('0x6d'):_0x461615[_0x2e49('0x6b')]=_0x2e49('0x6e');break;case _0x2e49('0x6f'):_0x461615[_0x2e49('0x6b')]='Rejected';break;case _0x2e49('0x70'):_0x461615[_0x2e49('0x6b')]=_0x2e49('0x71');break;case'timeout':_0x461615['Call_Result']='Timeout';default:}_0x461615[_0x2e49('0x72')]=(_0x66c35b===_0x2e49('0x73')?moment(_0x599d32[_0x2e49('0x67')])['format'](_0x2e49('0x66')):moment(_0x599d32[_0x2e49('0x74')])[_0x2e49('0x2e')](_0x2e49('0x66')))||moment()[_0x2e49('0x2e')]('YYYY-MM-DDTHH:mm:ss');_0x461615[_0x2e49('0x75')]=_0x66c35b||'Inbound';_0x461615=_[_0x2e49('0x76')](_0x461615,getCustomFields(_0x496b6d[_0x2e49('0x77')],_0x599d32));return request({'method':'POST','uri':_0x2e49('0x40')+_0x9fad32+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4c8fc7},'body':{'data':[_0x461615]},'json':!![]})[_0x2e49('0x27')](function(_0x2d8aa3){if(_0x2d8aa3&&_0x2d8aa3[_0x2e49('0x3e')][0x0][_0x2e49('0x47')]===_0x2e49('0x78')){logger['info'](_0x2e49('0x79'));return{'id':_0x2d8aa3[_0x2e49('0x3e')][0x0][_0x2e49('0x48')]['id']};}})[_0x2e49('0x3c')](function(_0xd7458f){logger['info'](_0x2e49('0x7a'),_0xd7458f[_0x2e49('0x7b')]);console[_0x2e49('0x4a')]('err',_0xd7458f);});}exports[_0x2e49('0x7c')]=function(_0x3f5e78,_0x2946f1,_0x1b56cc,_0x1cf102,_0x16fa3d,_0x38cbc2){var _0x45a592,_0x3a9c5f,_0x36dcc7;_0x38cbc2['host']=intUtil[_0x2e49('0x7d')](_0x38cbc2[_0x2e49('0x7e')]);_0x38cbc2['serverUrl']=intUtil[_0x2e49('0x7d')](_0x38cbc2[_0x2e49('0x7f')]);if(_0x16fa3d&&_0x16fa3d[_0x2e49('0x80')]){logger[_0x2e49('0x2b')]('[QUEUE]',_0x2e49('0x81'));_0x2946f1[_0x2e49('0x82')]=_0x38cbc2[_0x2e49('0x7f')]+_0x2e49('0x83')+_0x2946f1[_0x2e49('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x2946f1['uniqueid']);}else{_0x2946f1['recordingURL']='';}var _0x5211bf=_0x38cbc2['host']===_0x2e49('0x85')?'eu':_0x2e49('0x86');return getAccessToken(_0x38cbc2)[_0x2e49('0x27')](function(_0x193792){_0x36dcc7=_0x193792;return getUser(_0x36dcc7,_0x5211bf,_0x38cbc2,_0x1cf102[_0x2e49('0x34')]);})[_0x2e49('0x27')](function(_0x5797ab){_0x45a592=_0x5797ab;logger[_0x2e49('0x2b')](_0x2e49('0x87'),_0x45a592['id']);return getEndUser(_0x36dcc7,_0x5211bf,_0x38cbc2,_0x2946f1[_0x2e49('0x88')],_0x2946f1[_0x2e49('0x89')],_0x45a592,_0x1b56cc);})[_0x2e49('0x27')](function(_0x45caf3){_0x3a9c5f=_0x45caf3;return getCall(_0x36dcc7,_0x5211bf,_0x38cbc2,_0x45a592,_0x3a9c5f,_0x1b56cc,_0x2946f1,_0x2e49('0x8a'));})['then'](function(_0x36fefe){if(_0x36fefe){logger[_0x2e49('0x2b')](_0x2e49('0x8b'),_0x36fefe['id']);logger[_0x2e49('0x2b')](_0x2e49('0x8c'),_0x2e49('0x8d'));emit(util['format'](_0x2e49('0x8e'),_0x1cf102[_0x2e49('0x18')]),_0x2e49('0x8f'),{'uri':_0x2e49('0x90')+_0x38cbc2[_0x2e49('0x7e')]+_0x2e49('0x91')+_0x36fefe['id']});}})[_0x2e49('0x3c')](function(_0xa8c330){logger[_0x2e49('0x3d')](_0x2e49('0x8c'),JSON['stringify'](_0xa8c330));});};exports['outbound']=function(_0x38aede,_0x152f39,_0x595c88,_0x5be750,_0xb0a8c,_0x40eeec,_0x2a878a){var _0x52d682,_0x1d1877,_0x265e14;_0x40eeec['host']=intUtil[_0x2e49('0x7d')](_0x40eeec[_0x2e49('0x7e')]);_0x40eeec['serverUrl']=intUtil[_0x2e49('0x7d')](_0x40eeec[_0x2e49('0x7f')]);if(_0x2a878a&&_0x2a878a[_0x2e49('0x92')]&&_0x2a878a[_0x2e49('0x92')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x152f39[_0x2e49('0x82')]=_0x40eeec[_0x2e49('0x7f')]+'/api/voice/recordings/'+_0x152f39[_0x2e49('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x152f39[_0x2e49('0x84')]);}var _0x1752f2=_0x40eeec[_0x2e49('0x7e')]==='zoho.eu'?'eu':_0x2e49('0x86');return getAccessToken(_0x40eeec)[_0x2e49('0x27')](function(_0x283092){_0x265e14=_0x283092;return getUser(_0x265e14,_0x1752f2,_0x40eeec,_0x5be750[_0x2e49('0x34')]);})[_0x2e49('0x27')](function(_0x58ae79){_0x52d682=_0x58ae79;logger['info']('The\x20User\x20ID\x20is:',_0x52d682['id']);return getEndUser(_0x265e14,_0x1752f2,_0x40eeec,_0x152f39['destcalleridname'],_0x152f39[_0x2e49('0x93')],_0x52d682,_0x595c88);})[_0x2e49('0x27')](function(_0x3f14c3){_0x1d1877=_0x3f14c3;return getCall(_0x265e14,_0x1752f2,_0x40eeec,_0x52d682,_0x1d1877,_0x595c88,_0x152f39,_0x2e49('0x94'));})[_0x2e49('0x27')](function(_0x33299d){if(_0x33299d){logger[_0x2e49('0x2b')](_0x2e49('0x8b'),_0x33299d['id']);logger[_0x2e49('0x2b')](_0x2e49('0x95'),_0x2e49('0x8d'));emit(util[_0x2e49('0x2e')](_0x2e49('0x8e'),_0x5be750[_0x2e49('0x18')]),_0x2e49('0x8f'),{'uri':_0x2e49('0x90')+_0x40eeec['host']+_0x2e49('0x91')+_0x33299d['id']});}})['catch'](function(_0x506290){logger[_0x2e49('0x3d')]('[OUTBOUND]',JSON[_0x2e49('0xd')](_0x506290));});};exports['unmanaged']=function(_0x23a364,_0x17be7a,_0x3145be,_0x5e9ec6,_0x1afc39,_0x152b5e){var _0xe0a1a3,_0x112f72,_0x152581;_0x152b5e[_0x2e49('0x7e')]=intUtil[_0x2e49('0x7d')](_0x152b5e[_0x2e49('0x7e')]);_0x152b5e['serverUrl']=intUtil['stripTrailingSlash'](_0x152b5e[_0x2e49('0x7f')]);if(_0x1afc39&&_0x1afc39[_0x2e49('0x80')]){logger['info']('['+_0x17be7a[_0x2e49('0x69')][_0x2e49('0x96')]()+']','Recording\x20is\x20enabled!');_0x17be7a[_0x2e49('0x82')]=_0x152b5e[_0x2e49('0x7f')]+_0x2e49('0x83')+_0x17be7a[_0x2e49('0x84')]+_0x2e49('0x97')+md5(_0x17be7a['uniqueid']);}else{_0x17be7a[_0x2e49('0x82')]='';}var _0x4ac99f=_0x152b5e['host']===_0x2e49('0x85')?'eu':'com';return getAccessToken(_0x152b5e)['then'](function(_0x51a03c){_0x152581=_0x51a03c;return getUser(_0x152581,_0x4ac99f,_0x152b5e);})[_0x2e49('0x27')](function(_0x3dcf53){_0xe0a1a3=_0x3dcf53;logger[_0x2e49('0x2b')](_0x2e49('0x87'),_0xe0a1a3['id']);return getEndUser(_0x152581,_0x4ac99f,_0x152b5e,_0x17be7a['calleridname'],_0x17be7a[_0x2e49('0x89')],_0xe0a1a3,_0x3145be);})[_0x2e49('0x27')](function(_0x1bd510){_0x112f72=_0x1bd510;return getCall(_0x152581,_0x4ac99f,_0x152b5e,_0xe0a1a3,_0x112f72,_0x3145be,_0x17be7a,_0x2e49('0x8a'));})[_0x2e49('0x27')](function(_0x23e154){if(_0x23e154){logger[_0x2e49('0x2b')](_0x2e49('0x8b'),_0x23e154['id']);}})[_0x2e49('0x3c')](function(_0x284e1f){logger[_0x2e49('0x3d')]('['+_0x17be7a[_0x2e49('0x69')][_0x2e49('0x96')]()+']',JSON[_0x2e49('0xd')](_0x284e1f));});}; \ No newline at end of file +var _0x5bc5=['trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','unmanaged','monitor_format','toUpperCase','/downloads?type=uniqueid&token=','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','type','idField','toString','variable','variableName','customVariable','name','Variable','toLowerCase','split','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Called','complete','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','host','com','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x504e64,_0x52692c){var _0x1a0520=function(_0x54d98d){while(--_0x54d98d){_0x504e64['push'](_0x504e64['shift']());}};_0x1a0520(++_0x52692c);}(_0x5bc5,0xb2));var _0x55bc=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x5bc5[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0x55bc('0x0'));var rp=require(_0x55bc('0x1'));var md5=require(_0x55bc('0x2'));var util=require(_0x55bc('0x3'));var intUtil=require(_0x55bc('0x4'));var moment=require(_0x55bc('0x5'));var Redis=require(_0x55bc('0x6'));var BPromise=require(_0x55bc('0x7'));var config=require(_0x55bc('0x8'));var logger=require(_0x55bc('0x9'))(_0x55bc('0xa'));config[_0x55bc('0xb')]=_[_0x55bc('0xc')](config['redis'],{'host':_0x55bc('0xd'),'port':0x18eb});var io=require(_0x55bc('0xe'))(new Redis(config[_0x55bc('0xb')]));function emit(_0x38839e,_0x4d0610,_0x1d6e72){io['to'](_0x38839e)[_0x55bc('0xf')](_0x4d0610,_0x1d6e72);}function request(_0xc535ac){logger[_0x55bc('0x10')](_0x55bc('0x11'),JSON[_0x55bc('0x12')](_0xc535ac));return rp(_0xc535ac);}function getCustomFields(_0x72a619,_0x718891){var _0x4b905d={};if(_0x72a619[_0x55bc('0x13')]>0x0){_[_0x55bc('0x14')](_0x72a619,function(_0x41f298){if(_['includes']([_0x55bc('0x15'),'picklist'],_0x41f298[_0x55bc('0x16')])&&_0x41f298[_0x55bc('0x17')]){_0x4b905d[_0x41f298[_0x55bc('0x17')]]=_0x41f298['content'][_0x55bc('0x18')]();}else if(_0x41f298['type']===_0x55bc('0x19')&&_0x41f298[_0x55bc('0x1a')]&&_0x41f298[_0x55bc('0x17')]&&_0x718891[_0x41f298['variableName']]){_0x4b905d[_0x41f298[_0x55bc('0x17')]]=_0x718891[_0x41f298[_0x55bc('0x1a')]]['toString']();}else if(_0x41f298['type']===_0x55bc('0x1b')&&_0x41f298['Variable']&&_0x41f298['Variable'][_0x55bc('0x1c')]&&_0x41f298[_0x55bc('0x17')]&&_0x718891[_0x41f298[_0x55bc('0x1d')]['name'][_0x55bc('0x1e')]()]){_0x4b905d[_0x41f298[_0x55bc('0x17')]]=_0x718891[_0x41f298[_0x55bc('0x1d')]['name'][_0x55bc('0x1e')]()]['toString']();}});}return _0x4b905d;}function getName(_0x29f969){if(_0x29f969['indexOf']('\x20')>0x0){var _0x53f103=_0x29f969[_0x55bc('0x1f')](/ (.+)/);if(_0x53f103[0x1]){return _0x53f103;}}return[_0x29f969,_0x29f969];}var accountsTokens={};function getAccessToken(_0x390af6){return new Promise(function(_0x2dbfaf,_0x5781f2){if(!_['isNil'](accountsTokens[_0x390af6['id']])&&!_['isNil'](accountsTokens[_0x390af6['id']][_0x55bc('0x20')])){if(moment()[_0x55bc('0x21')](accountsTokens[_0x390af6['id']]['expires_in'])){_0x2dbfaf(accountsTokens[_0x390af6['id']]['access_token']);}}var _0x384433;switch(_0x390af6[_0x55bc('0x22')]){case'US':_0x384433=_0x55bc('0x23');break;case'AU':_0x384433=_0x55bc('0x24');break;case'EU':_0x384433='https://accounts.zoho.eu';break;case'IN':_0x384433=_0x55bc('0x25');break;case'CN':_0x384433='https://accounts.zoho.com.cn';break;default:_0x384433='https://accounts.zoho.eu';break;}var _0x3e6254={'method':_0x55bc('0x26'),'uri':_0x384433+_0x55bc('0x27'),'qs':{'refresh_token':_0x390af6[_0x55bc('0x28')],'client_id':_0x390af6[_0x55bc('0x29')],'client_secret':_0x390af6['clientSecret'],'grant_type':_0x55bc('0x2a')},'json':!![]};return rp(_0x3e6254)[_0x55bc('0x2b')](function(_0xa649a3){accountsTokens[_0x390af6['id']]={'access_token':_0xa649a3[_0x55bc('0x20')],'expires_in':moment()[_0x55bc('0x2c')](_0xa649a3[_0x55bc('0x2d')],'seconds')};_0x2dbfaf(_0xa649a3[_0x55bc('0x20')]);})[_0x55bc('0x2e')](function(_0x4227be){logger[_0x55bc('0x2f')](_0x55bc('0x30'),_0x4227be[_0x55bc('0x31')]);_0x5781f2(_0x4227be);});});}function getUser(_0x1268ac,_0x29cf97,_0x1d840f,_0x409295){logger[_0x55bc('0x32')](_0x55bc('0x33'));return request({'method':'GET','uri':util[_0x55bc('0x34')](_0x55bc('0x35'),_0x29cf97),'qs':{'type':_0x55bc('0x36')},'headers':{'Authorization':_0x55bc('0x37')+_0x1268ac},'json':!![]})[_0x55bc('0x2b')](function(_0x497681){if(_0x497681[_0x55bc('0x38')]){var _0x412d57=-0x1;if(_[_0x55bc('0x39')](_0x497681[_0x55bc('0x38')])){if(!_[_0x55bc('0x3a')](_0x409295)){_0x412d57=_[_0x55bc('0x3b')](_0x497681[_0x55bc('0x38')],function(_0x33ee3a){return _0x33ee3a[_0x55bc('0x3c')]===_0x409295;});}if(_0x412d57>=0x0){logger['info'](_0x55bc('0x3d'));}else{logger[_0x55bc('0x32')](_0x55bc('0x3e'));_0x412d57=_[_0x55bc('0x3b')](_0x497681[_0x55bc('0x38')],function(_0x2f7beb){return _0x2f7beb[_0x55bc('0x3f')]['name']===_0x55bc('0x40');});}return _0x497681[_0x55bc('0x38')][_0x412d57];}else{if(_0x497681['user'][_0x55bc('0x3f')][_0x55bc('0x1c')]===_0x55bc('0x40')){logger[_0x55bc('0x32')](_0x55bc('0x3e'));user=_0x497681['user'];return user;}else{logger['error'](_0x55bc('0x41'),JSON[_0x55bc('0x12')](_0x497681));throw new Error(_0x55bc('0x42')+JSON[_0x55bc('0x12')](_0x497681));}}}else{logger[_0x55bc('0x2f')](_0x55bc('0x41'),JSON[_0x55bc('0x12')](_0x497681));throw new Error(_0x55bc('0x42')+JSON['stringify'](_0x497681));}})[_0x55bc('0x2e')](function(_0x224342){console[_0x55bc('0x2f')](_0x224342);});}function getZohoUser(_0x53ae76,_0x5661de){return new BPromise(function(_0x32c468,_0x58b58d){request(_0x53ae76)[_0x55bc('0x2b')](function(_0x69d8b1){var _0x4c1e8e=null;if(_0x69d8b1){_0x4c1e8e=_0x69d8b1[_0x55bc('0x43')][0x0];_0x4c1e8e[_0x55bc('0x44')]=_0x5661de;}_0x32c468(_0x4c1e8e);})[_0x55bc('0x2e')](function(_0x1f8c9c){_0x58b58d(_0x1f8c9c);});});}function createEndUser(_0x26ae3e,_0x3bb55a,_0x334e24,_0x3e5b7c,_0x5ebce8,_0x339704){var _0x334e24=getName(_0x334e24);return request({'method':_0x55bc('0x26'),'uri':_0x55bc('0x45')+_0x3bb55a+_0x55bc('0x46')+_[_0x55bc('0x47')](_0x339704[_0x55bc('0x48')])+'s','body':{'data':[{'Last_Name':_0x334e24[0x1],'First_Name':_0x334e24[0x0],'Phone':_0x3e5b7c,'Owner':{'name':!_[_0x55bc('0x3a')](_0x5ebce8['role'][_0x55bc('0x1c')])?_0x5ebce8[_0x55bc('0x49')]['name']:!_[_0x55bc('0x3a')](_0x5ebce8[_0x55bc('0x4a')])?_0x5ebce8[_0x55bc('0x4a')]+'\x20'+_0x5ebce8[_0x55bc('0x4b')]:_0x5ebce8[_0x55bc('0x4b')],'id':_0x5ebce8['id']}}]},'headers':{'Authorization':_0x55bc('0x37')+_0x26ae3e},'json':!![]})[_0x55bc('0x2b')](function(_0x54e4f6){if(_0x54e4f6&&_0x54e4f6[_0x55bc('0x43')][0x0][_0x55bc('0x4c')]===_0x55bc('0x4d')){var _0x57c4e9=_0x54e4f6[_0x55bc('0x43')][0x0][_0x55bc('0x4e')];_0x57c4e9[_0x55bc('0x44')]=_[_0x55bc('0x47')](_0x339704['moduleCreate'])+'s';return _0x57c4e9;}logger[_0x55bc('0x2f')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x55bc('0x4f')+JSON['stringify'](data));})[_0x55bc('0x2e')](function(_0x41a2db){console[_0x55bc('0x50')](_0x55bc('0x51'),_0x41a2db);});}function getEndUser(_0x5f361d,_0x5894d9,_0x509c62,_0x5e2aea,_0x18f6f9,_0x1359a6,_0x55eaa7){var _0x37ff3e={'method':_0x55bc('0x52'),'uri':'','headers':{'Authorization':_0x55bc('0x37')+_0x5f361d},'json':!![]};switch(_0x55eaa7[_0x55bc('0x53')]){case'contact_lead':_0x37ff3e[_0x55bc('0x54')]=_0x55bc('0x45')+_0x5894d9+_0x55bc('0x55')+_0x18f6f9+'))';return getZohoUser(_0x37ff3e,_0x55bc('0x56'))[_0x55bc('0x2b')](function(_0x5bebda){if(_0x5bebda)return _0x5bebda;_0x37ff3e[_0x55bc('0x54')]=_0x55bc('0x45')+_0x5894d9+_0x55bc('0x57')+_0x18f6f9+'))';return getZohoUser(_0x37ff3e,_0x55bc('0x58'))[_0x55bc('0x2b')](function(_0x44d617){if(_0x44d617)return _0x44d617;if(_0x55eaa7[_0x55bc('0x48')]!='nothing'){return createEndUser(_0x5f361d,_0x5894d9,_0x5e2aea,_0x18f6f9,_0x1359a6,_0x55eaa7);}else{return{};}});});break;case _0x55bc('0x59'):_0x37ff3e[_0x55bc('0x54')]=_0x55bc('0x45')+_0x5894d9+_0x55bc('0x55')+_0x18f6f9+'))';return getZohoUser(_0x37ff3e,_0x55bc('0x56'))[_0x55bc('0x2b')](function(_0x3f77a8){if(_0x3f77a8)return _0x3f77a8;if(_0x55eaa7[_0x55bc('0x48')]!=_0x55bc('0x5a')){return createEndUser(_0x5f361d,_0x5894d9,_0x5e2aea,_0x18f6f9,_0x1359a6,_0x55eaa7);}else{return{};}});break;case _0x55bc('0x5b'):_0x37ff3e[_0x55bc('0x54')]=_0x55bc('0x45')+_0x5894d9+_0x55bc('0x57')+_0x18f6f9+'))';return getZohoUser(_0x37ff3e,_0x55bc('0x58'))['then'](function(_0x56dc07){if(_0x56dc07)return _0x56dc07;if(_0x55eaa7[_0x55bc('0x48')]!=_0x55bc('0x5a')){return createEndUser(_0x5f361d,_0x5894d9,_0x5e2aea,_0x18f6f9,_0x1359a6,_0x55eaa7);}else{return{};}});break;}}function getCall(_0x3de9b4,_0x4c161c,_0x42847b,_0x5b7ec0,_0x212560,_0x496448,_0x104960,_0x566be2){logger[_0x55bc('0x32')](_0x55bc('0x5c'));var _0x2630fa={};_0x2630fa['Owner']={'name':!_[_0x55bc('0x3a')](_0x5b7ec0[_0x55bc('0x49')][_0x55bc('0x1c')])&&!_[_0x55bc('0x3a')](_0x5b7ec0[_0x55bc('0x3f')]['name'])&&_0x5b7ec0[_0x55bc('0x3f')]['name']===_0x55bc('0x5d')?_0x5b7ec0[_0x55bc('0x49')][_0x55bc('0x1c')]:!_[_0x55bc('0x3a')](_0x5b7ec0[_0x55bc('0x4a')])?_0x5b7ec0[_0x55bc('0x4a')]+'\x20'+_0x5b7ec0[_0x55bc('0x4b')]:_0x5b7ec0[_0x55bc('0x4b')],'id':_0x5b7ec0['id']};_0x2630fa[_0x55bc('0x5e')]=intUtil[_0x55bc('0x5f')](_0x496448[_0x55bc('0x60')],_0x104960,'\x20');_0x2630fa[_0x55bc('0x61')]=intUtil[_0x55bc('0x5f')](_0x496448[_0x55bc('0x62')],_0x104960,'\x0a');if(_0x212560[_0x55bc('0x44')]==='Contacts'){_0x2630fa[_0x55bc('0x63')]={'name':!_['isNil'](_0x212560[_0x55bc('0x64')])?_0x212560[_0x55bc('0x64')]:!_[_0x55bc('0x3a')](_0x212560[_0x55bc('0x65')])?_0x212560[_0x55bc('0x65')]+'\x20'+_0x212560[_0x55bc('0x66')]:_0x212560['Last_Name'],'id':_0x212560['id']};}if(_0x212560['enduserType']===_0x55bc('0x58')){_0x2630fa[_0x55bc('0x67')]={'name':!_[_0x55bc('0x3a')](_0x212560['Full_Name'])?_0x212560[_0x55bc('0x64')]:!_[_0x55bc('0x3a')](_0x212560['First_Name'])?_0x212560[_0x55bc('0x65')]+'\x20'+_0x212560[_0x55bc('0x66')]:_0x212560['Last_Name'],'id':_0x212560['id']};_0x2630fa[_0x55bc('0x68')]=_[_0x55bc('0x47')](_0x212560[_0x55bc('0x44')]);}if(_0x104960['talktime']){_0x2630fa[_0x55bc('0x69')]=moment[_0x55bc('0x6a')](parseInt(_0x104960[_0x55bc('0x6b')])*0x3e8)[_0x55bc('0x34')](_0x55bc('0x6c'));}else if(_0x104960[_0x55bc('0x6d')]&&_0x104960[_0x55bc('0x6e')]){_0x2630fa[_0x55bc('0x69')]=moment[_0x55bc('0x6a')](moment(_0x104960[_0x55bc('0x6e')],_0x55bc('0x6f'))[_0x55bc('0x70')](moment(_0x104960['starttime'],_0x55bc('0x6f'))))['format']('mm:ss');}switch(_0x104960[_0x55bc('0x71')]){case'called':_0x2630fa['Call_Result']=_0x55bc('0x72');break;case _0x55bc('0x73'):case'connect':_0x2630fa[_0x55bc('0x74')]=_0x55bc('0x75');break;case _0x55bc('0x76'):_0x2630fa[_0x55bc('0x74')]=_0x55bc('0x77');break;case _0x55bc('0x78'):_0x2630fa['Call_Result']=_0x55bc('0x79');break;case _0x55bc('0x7a'):_0x2630fa[_0x55bc('0x74')]=_0x55bc('0x7b');default:}_0x2630fa[_0x55bc('0x7c')]=(_0x566be2===_0x55bc('0x7d')?moment(_0x104960[_0x55bc('0x7e')])[_0x55bc('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x104960[_0x55bc('0x7f')])[_0x55bc('0x34')](_0x55bc('0x6f')))||moment()[_0x55bc('0x34')]('YYYY-MM-DDTHH:mm:ss');_0x2630fa[_0x55bc('0x80')]=_0x566be2||_0x55bc('0x81');_0x2630fa=_[_0x55bc('0x82')](_0x2630fa,getCustomFields(_0x496448[_0x55bc('0x83')],_0x104960));return request({'method':_0x55bc('0x26'),'uri':_0x55bc('0x45')+_0x4c161c+_0x55bc('0x84'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3de9b4},'body':{'data':[_0x2630fa]},'json':!![]})[_0x55bc('0x2b')](function(_0x1c127a){if(_0x1c127a&&_0x1c127a['data'][0x0][_0x55bc('0x4c')]===_0x55bc('0x4d')){logger[_0x55bc('0x32')](_0x55bc('0x85'));return{'id':_0x1c127a[_0x55bc('0x43')][0x0][_0x55bc('0x4e')]['id']};}})[_0x55bc('0x2e')](function(_0x845f2f){logger[_0x55bc('0x32')](_0x55bc('0x86'),_0x845f2f[_0x55bc('0x31')]);console[_0x55bc('0x50')](_0x55bc('0x86'),_0x845f2f);});}exports[_0x55bc('0x87')]=function(_0x27a66d,_0x55c509,_0xbf17b,_0x3a3e85,_0x56629f,_0x6faa0a){var _0x1d7981,_0x19e8d5,_0x4a4251;_0x6faa0a['host']=intUtil['stripTrailingSlash'](_0x6faa0a['host']);_0x6faa0a[_0x55bc('0x88')]=intUtil[_0x55bc('0x89')](_0x6faa0a[_0x55bc('0x88')]);if(_0x56629f&&_0x56629f['monitor_format']){logger[_0x55bc('0x32')](_0x55bc('0x8a'),_0x55bc('0x8b'));_0x55c509[_0x55bc('0x8c')]=_0x6faa0a[_0x55bc('0x88')]+_0x55bc('0x8d')+_0x55c509['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x55c509[_0x55bc('0x8e')]);}else{_0x55c509['recordingURL']='';}var _0x815490=_0x6faa0a[_0x55bc('0x8f')]==='zoho.eu'?'eu':_0x55bc('0x90');return getAccessToken(_0x6faa0a)[_0x55bc('0x2b')](function(_0x3857be){_0x4a4251=_0x3857be;return getUser(_0x4a4251,_0x815490,_0x6faa0a,_0x3a3e85[_0x55bc('0x3c')]);})[_0x55bc('0x2b')](function(_0x3937f0){_0x1d7981=_0x3937f0;logger[_0x55bc('0x32')]('The\x20User\x20ID\x20is:',_0x1d7981['id']);return getEndUser(_0x4a4251,_0x815490,_0x6faa0a,_0x55c509[_0x55bc('0x91')],_0x55c509['calleridnum'],_0x1d7981,_0xbf17b);})['then'](function(_0x5d94a9){_0x19e8d5=_0x5d94a9;return getCall(_0x4a4251,_0x815490,_0x6faa0a,_0x1d7981,_0x19e8d5,_0xbf17b,_0x55c509,_0x55bc('0x81'));})['then'](function(_0x9a802b){if(_0x9a802b){logger[_0x55bc('0x32')]('The\x20Call\x20ID\x20is:',_0x9a802b['id']);logger['info'](_0x55bc('0x8a'),_0x55bc('0x92'));emit(util[_0x55bc('0x34')](_0x55bc('0x93'),_0x3a3e85[_0x55bc('0x1c')]),_0x55bc('0x94'),{'uri':_0x55bc('0x95')+_0x6faa0a[_0x55bc('0x8f')]+_0x55bc('0x96')+_0x9a802b['id']});}})[_0x55bc('0x2e')](function(_0x3c24ba){logger['error'](_0x55bc('0x8a'),JSON['stringify'](_0x3c24ba));});};exports[_0x55bc('0x7d')]=function(_0x3266c5,_0x25a212,_0x22ffba,_0x524b0e,_0x494bf7,_0x26c677,_0x3d0a42){var _0x20dca2,_0xbb0d71,_0x5f4872;_0x26c677[_0x55bc('0x8f')]=intUtil['stripTrailingSlash'](_0x26c677[_0x55bc('0x8f')]);_0x26c677[_0x55bc('0x88')]=intUtil[_0x55bc('0x89')](_0x26c677[_0x55bc('0x88')]);if(_0x3d0a42&&_0x3d0a42[_0x55bc('0x97')]&&_0x3d0a42[_0x55bc('0x97')]!=='none'){logger['info'](_0x55bc('0x98'),_0x55bc('0x8b'));_0x25a212[_0x55bc('0x8c')]=_0x26c677['serverUrl']+_0x55bc('0x8d')+_0x25a212[_0x55bc('0x8e')]+'/downloads?type=uniqueid&token='+md5(_0x25a212[_0x55bc('0x8e')]);}var _0x283e74=_0x26c677[_0x55bc('0x8f')]===_0x55bc('0x99')?'eu':_0x55bc('0x90');return getAccessToken(_0x26c677)[_0x55bc('0x2b')](function(_0x26217e){_0x5f4872=_0x26217e;return getUser(_0x5f4872,_0x283e74,_0x26c677,_0x524b0e[_0x55bc('0x3c')]);})[_0x55bc('0x2b')](function(_0x89a067){_0x20dca2=_0x89a067;logger[_0x55bc('0x32')](_0x55bc('0x9a'),_0x20dca2['id']);return getEndUser(_0x5f4872,_0x283e74,_0x26c677,_0x25a212[_0x55bc('0x9b')],_0x25a212[_0x55bc('0x9c')],_0x20dca2,_0x22ffba);})[_0x55bc('0x2b')](function(_0x34d8b2){_0xbb0d71=_0x34d8b2;return getCall(_0x5f4872,_0x283e74,_0x26c677,_0x20dca2,_0xbb0d71,_0x22ffba,_0x25a212,'Outbound');})[_0x55bc('0x2b')](function(_0x3a673a){if(_0x3a673a){logger['info'](_0x55bc('0x9d'),_0x3a673a['id']);logger[_0x55bc('0x32')](_0x55bc('0x98'),_0x55bc('0x92'));emit(util[_0x55bc('0x34')](_0x55bc('0x93'),_0x524b0e['name']),_0x55bc('0x94'),{'uri':_0x55bc('0x95')+_0x26c677[_0x55bc('0x8f')]+_0x55bc('0x96')+_0x3a673a['id']});}})['catch'](function(_0x3067ba){logger[_0x55bc('0x2f')](_0x55bc('0x98'),JSON[_0x55bc('0x12')](_0x3067ba));});};exports[_0x55bc('0x9e')]=function(_0x510e30,_0x2bb33b,_0x5b8d5f,_0x126a1a,_0x400ad4,_0x953f62){var _0x50cfb5,_0x2c227b,_0x4d8bd0;_0x953f62['host']=intUtil[_0x55bc('0x89')](_0x953f62[_0x55bc('0x8f')]);_0x953f62[_0x55bc('0x88')]=intUtil[_0x55bc('0x89')](_0x953f62[_0x55bc('0x88')]);if(_0x400ad4&&_0x400ad4[_0x55bc('0x9f')]){logger[_0x55bc('0x32')]('['+_0x2bb33b[_0x55bc('0x71')][_0x55bc('0xa0')]()+']',_0x55bc('0x8b'));_0x2bb33b['recordingURL']=_0x953f62[_0x55bc('0x88')]+_0x55bc('0x8d')+_0x2bb33b['uniqueid']+_0x55bc('0xa1')+md5(_0x2bb33b[_0x55bc('0x8e')]);}else{_0x2bb33b['recordingURL']='';}var _0x1fab56=_0x953f62[_0x55bc('0x8f')]==='zoho.eu'?'eu':_0x55bc('0x90');return getAccessToken(_0x953f62)[_0x55bc('0x2b')](function(_0x1fa595){_0x4d8bd0=_0x1fa595;return getUser(_0x4d8bd0,_0x1fab56,_0x953f62);})[_0x55bc('0x2b')](function(_0x15c846){_0x50cfb5=_0x15c846;logger[_0x55bc('0x32')](_0x55bc('0x9a'),_0x50cfb5['id']);return getEndUser(_0x4d8bd0,_0x1fab56,_0x953f62,_0x2bb33b[_0x55bc('0x91')],_0x2bb33b[_0x55bc('0xa2')],_0x50cfb5,_0x5b8d5f);})[_0x55bc('0x2b')](function(_0x32b9d0){_0x2c227b=_0x32b9d0;return getCall(_0x4d8bd0,_0x1fab56,_0x953f62,_0x50cfb5,_0x2c227b,_0x5b8d5f,_0x2bb33b,'Inbound');})[_0x55bc('0x2b')](function(_0x1fd72c){if(_0x1fd72c){logger[_0x55bc('0x32')](_0x55bc('0x9d'),_0x1fd72c['id']);}})[_0x55bc('0x2e')](function(_0x552247){logger[_0x55bc('0x2f')]('['+_0x2bb33b[_0x55bc('0x71')][_0x55bc('0xa0')]()+']',JSON[_0x55bc('0x12')](_0x552247));});}; \ 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 fb70358..be75ca8 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 _0x1ef7=['data2','Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x438077,_0x3aeb8){var _0x4255b2=function(_0x5d02f2){while(--_0x5d02f2){_0x438077['push'](_0x438077['shift']());}};_0x4255b2(++_0x3aeb8);}(_0x1ef7,0x97));var _0x71ef=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x1ef7[_0x870b62];return _0x2dcb39;};'use strict';var util=require('util');var sh=require(_0x71ef('0x0'));var Mustache=require(_0x71ef('0x1'));var logger=require(_0x71ef('0x2'))(_0x71ef('0x3'));exports[_0x71ef('0x4')]=function(_0x173ad9,_0x2ab533){var _0x147f72=_0x173ad9[_0x71ef('0x5')]?_0x173ad9[_0x71ef('0x5')]:_0x71ef('0x6');var _0x1ba2c6=_0x173ad9[_0x71ef('0x7')]?Mustache[_0x71ef('0x8')](_0x173ad9[_0x71ef('0x7')],_0x2ab533):_0x2ab533;sh['exec'](_0x1ba2c6,function(_0x3ba38e,_0x560de5,_0x430fe1){if(_0x3ba38e!==0x0){logger[_0x71ef('0x9')](util['format'](_0x71ef('0xa'),_0x147f72,_0x1ba2c6,_0x3ba38e,_0x430fe1));}else{logger[_0x71ef('0xb')](util[_0x71ef('0xc')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x147f72,_0x1ba2c6,_0x560de5));}});}; \ No newline at end of file +var _0xd1c8=['mustache','../../../../config/logger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x59c427,_0x377cba){var _0x547bf5=function(_0x3e9557){while(--_0x3e9557){_0x59c427['push'](_0x59c427['shift']());}};_0x547bf5(++_0x377cba);}(_0xd1c8,0xdb));var _0x8d1c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd1c8[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x8d1c('0x0'));var sh=require(_0x8d1c('0x1'));var Mustache=require(_0x8d1c('0x2'));var logger=require(_0x8d1c('0x3'))('trigger');exports[_0x8d1c('0x4')]=function(_0x1fc6c1,_0x32e4c1){var _0x313ac2=_0x1fc6c1[_0x8d1c('0x5')]?_0x1fc6c1['data2']:_0x8d1c('0x6');var _0x4fc0de=_0x1fc6c1[_0x8d1c('0x7')]?Mustache[_0x8d1c('0x8')](_0x1fc6c1[_0x8d1c('0x7')],_0x32e4c1):_0x32e4c1;sh[_0x8d1c('0x4')](_0x4fc0de,function(_0x4b3fb7,_0x308432,_0x1283db){if(_0x4b3fb7!==0x0){logger[_0x8d1c('0x9')](util[_0x8d1c('0xa')](_0x8d1c('0xb'),_0x313ac2,_0x4fc0de,_0x4b3fb7,_0x1283db));}else{logger['info'](util[_0x8d1c('0xa')](_0x8d1c('0xc'),_0x313ac2,_0x4fc0de,_0x308432));}});}; \ 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 459eb95..5957cf1 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 _0x1e69=['POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','data5','number','headers','data6','parse','error','stack','toUpperCase','GET'];(function(_0x157d28,_0x21b007){var _0x89219c=function(_0x5dd407){while(--_0x5dd407){_0x157d28['push'](_0x157d28['shift']());}};_0x89219c(++_0x21b007);}(_0x1e69,0x1c2));var _0x91e6=function(_0xf1a516,_0x4b7594){_0xf1a516=_0xf1a516-0x0;var _0x6792d2=_0x1e69[_0xf1a516];return _0x6792d2;};'use strict';var rp=require('request-promise');var util=require(_0x91e6('0x0'));var _=require(_0x91e6('0x1'));var Mustache=require(_0x91e6('0x2'));var logger=require(_0x91e6('0x3'))(_0x91e6('0x4'));exports[_0x91e6('0x5')]=function(_0x88ab2,_0x282d2b){var _0x5a37d1,_0x2f7cdc;var _0x192704={'method':_0x88ab2[_0x91e6('0x6')]['toUpperCase'](),'uri':Mustache[_0x91e6('0x7')](_0x88ab2[_0x91e6('0x8')],_0x282d2b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x88ab2[_0x91e6('0x9')])===_0x91e6('0xa')&&parseInt(_0x88ab2['data5'])>=0x1&&parseInt(_0x88ab2[_0x91e6('0x9')])<=0xa?parseInt(_0x88ab2[_0x91e6('0x9')])*0x3e8:0x5*0x3e8};try{_0x192704[_0x91e6('0xb')]=_0x88ab2[_0x91e6('0xc')]?JSON[_0x91e6('0xd')](Mustache[_0x91e6('0x7')](_0x88ab2[_0x91e6('0xc')],_0x282d2b)):{};}catch(_0x1e4bce){logger[_0x91e6('0xe')](_0x1e4bce[_0x91e6('0xf')]);}switch(_0x88ab2[_0x91e6('0x6')][_0x91e6('0x10')]()){case _0x91e6('0x11'):case'DELETE':_0x5a37d1=null;_0x192704['qs']=_0x282d2b;break;case _0x91e6('0x12'):case _0x91e6('0x13'):if(_0x88ab2[_0x91e6('0x14')]){try{_0x5a37d1=JSON[_0x91e6('0xd')](Mustache[_0x91e6('0x7')](_0x88ab2[_0x91e6('0x14')],_0x282d2b));_0x192704['body']=_0x5a37d1;}catch(_0x2722bb){logger[_0x91e6('0xe')](_0x2722bb['stack']);logger['error'](_0x91e6('0x15'));}}else{_0x5a37d1=_0x282d2b;_0x192704[_0x91e6('0x16')]=_0x5a37d1;}break;}logger[_0x91e6('0x17')](util[_0x91e6('0x18')](_0x91e6('0x19'),_0x88ab2['data1'],_0x88ab2['data2'],JSON['stringify'](_0x192704)));rp(_0x192704)[_0x91e6('0x1a')](function(_0x4406a7){_0x5a37d1=!_['isNil'](_0x5a37d1)?_0x91e6('0x1b')+_0x5a37d1:'';_0x2f7cdc=typeof _0x4406a7[_0x91e6('0x16')]===_0x91e6('0x1c')?JSON[_0x91e6('0x1d')](_0x4406a7[_0x91e6('0x16')]):_0x4406a7[_0x91e6('0x16')];logger['info'](util[_0x91e6('0x18')](_0x91e6('0x1e'),_0x88ab2[_0x91e6('0x6')],_0x88ab2[_0x91e6('0x8')],_0x4406a7['statusCode'],_0x2f7cdc));})[_0x91e6('0x1f')](function(_0x7a7fc2){logger[_0x91e6('0xe')](util[_0x91e6('0x18')](_0x91e6('0x20'),_0x88ab2[_0x91e6('0x6')],_0x88ab2[_0x91e6('0x8')],_0x7a7fc2[_0x91e6('0x21')],_0x7a7fc2[_0x91e6('0x22')],_0x7a7fc2[_0x91e6('0x23')]));});}; \ No newline at end of file +var _0x9a09=['data2','data5','headers','data6','stack','data1','GET','DELETE','PUT','data7','parse','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','toUpperCase','render'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0x9a09,0x88));var _0x99a0=function(_0x2c9d5f,_0x2a04a7){_0x2c9d5f=_0x2c9d5f-0x0;var _0x10173e=_0x9a09[_0x2c9d5f];return _0x10173e;};'use strict';var rp=require(_0x99a0('0x0'));var util=require(_0x99a0('0x1'));var _=require(_0x99a0('0x2'));var Mustache=require(_0x99a0('0x3'));var logger=require(_0x99a0('0x4'))(_0x99a0('0x5'));exports['exec']=function(_0x45f3f6,_0x5d0e80){var _0x360008,_0x41415b;var _0x1f346f={'method':_0x45f3f6['data1'][_0x99a0('0x6')](),'uri':Mustache[_0x99a0('0x7')](_0x45f3f6[_0x99a0('0x8')],_0x5d0e80),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x45f3f6['data5'])==='number'&&parseInt(_0x45f3f6[_0x99a0('0x9')])>=0x1&&parseInt(_0x45f3f6['data5'])<=0xa?parseInt(_0x45f3f6[_0x99a0('0x9')])*0x3e8:0x5*0x3e8};try{_0x1f346f[_0x99a0('0xa')]=_0x45f3f6[_0x99a0('0xb')]?JSON['parse'](Mustache['render'](_0x45f3f6['data6'],_0x5d0e80)):{};}catch(_0xc40b07){logger['error'](_0xc40b07[_0x99a0('0xc')]);}switch(_0x45f3f6[_0x99a0('0xd')][_0x99a0('0x6')]()){case _0x99a0('0xe'):case _0x99a0('0xf'):_0x360008=null;_0x1f346f['qs']=_0x5d0e80;break;case'POST':case _0x99a0('0x10'):if(_0x45f3f6[_0x99a0('0x11')]){try{_0x360008=JSON[_0x99a0('0x12')](Mustache['render'](_0x45f3f6[_0x99a0('0x11')],_0x5d0e80));_0x1f346f['body']=_0x360008;}catch(_0x2e5c27){logger[_0x99a0('0x13')](_0x2e5c27[_0x99a0('0xc')]);logger[_0x99a0('0x13')](_0x99a0('0x14'));}}else{_0x360008=_0x5d0e80;_0x1f346f[_0x99a0('0x15')]=_0x360008;}break;}logger[_0x99a0('0x16')](util[_0x99a0('0x17')](_0x99a0('0x18'),_0x45f3f6[_0x99a0('0xd')],_0x45f3f6[_0x99a0('0x8')],JSON['stringify'](_0x1f346f)));rp(_0x1f346f)[_0x99a0('0x19')](function(_0x10e147){_0x360008=!_[_0x99a0('0x1a')](_0x360008)?_0x99a0('0x1b')+_0x360008:'';_0x41415b=typeof _0x10e147[_0x99a0('0x15')]===_0x99a0('0x1c')?JSON[_0x99a0('0x1d')](_0x10e147[_0x99a0('0x15')]):_0x10e147[_0x99a0('0x15')];logger[_0x99a0('0x16')](util[_0x99a0('0x17')](_0x99a0('0x1e'),_0x45f3f6['data1'],_0x45f3f6[_0x99a0('0x8')],_0x10e147[_0x99a0('0x1f')],_0x41415b));})[_0x99a0('0x20')](function(_0xdc5eb8){logger[_0x99a0('0x13')](util[_0x99a0('0x17')](_0x99a0('0x21'),_0x45f3f6[_0x99a0('0xd')],_0x45f3f6[_0x99a0('0x8')],_0xdc5eb8['statusCode'],_0xdc5eb8[_0x99a0('0x22')],_0xdc5eb8[_0x99a0('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 30beadd..76aa8fc 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 _0xbdac=['jayson/promise','bluebird','../../config/logger','client','http','request','then','debug','routing','error','rpc','message','result','catch','exports'];(function(_0x99d005,_0x18baf7){var _0x168788=function(_0x95b60f){while(--_0x95b60f){_0x99d005['push'](_0x99d005['shift']());}};_0x168788(++_0x18baf7);}(_0xbdac,0x159));var _0xcbda=function(_0x578caa,_0xa312ac){_0x578caa=_0x578caa-0x0;var _0x43353e=_0xbdac[_0x578caa];return _0x43353e;};'use strict';var jayson=require(_0xcbda('0x0'));var BPromise=require(_0xcbda('0x1'));var logger=require(_0xcbda('0x2'))('routing');var client=jayson[_0xcbda('0x3')][_0xcbda('0x4')]({'port':0x2329});client['Request']=function(_0x1fc801,_0x3664c4){return new BPromise(function(_0x19adc1,_0x496b06){return client[_0xcbda('0x5')](_0x1fc801,_0x3664c4)[_0xcbda('0x6')](function(_0xc8a372){logger[_0xcbda('0x7')]('rpc',_0xcbda('0x8'),_0x1fc801,_0x3664c4,_0xc8a372);if(_0xc8a372[_0xcbda('0x9')]){logger[_0xcbda('0x9')](_0xcbda('0xa'),_0xcbda('0x8'),_0x1fc801,_0xc8a372[_0xcbda('0x9')][_0xcbda('0xb')],_0x3664c4);return _0x496b06(_0xc8a372[_0xcbda('0x9')][_0xcbda('0xb')]);}else{return _0x19adc1(_0xc8a372[_0xcbda('0xc')]);}})[_0xcbda('0xd')](function(_0x4101d2){logger[_0xcbda('0x9')](_0xcbda('0xa'),_0xcbda('0x8'),_0x1fc801,_0x4101d2,_0x3664c4);return _0x496b06(_0x4101d2);});});};module[_0xcbda('0xe')]=client; \ No newline at end of file +var _0x86f8=['routing','exports','jayson/promise','../../config/logger','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x4b1408,_0x113e90){var _0x2696e7=function(_0x4fbb18){while(--_0x4fbb18){_0x4b1408['push'](_0x4b1408['shift']());}};_0x2696e7(++_0x113e90);}(_0x86f8,0x147));var _0x886f=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x86f8[_0xbb9dbf];return _0x30223c;};'use strict';var jayson=require(_0x886f('0x0'));var BPromise=require('bluebird');var logger=require(_0x886f('0x1'))('routing');var client=jayson['client'][_0x886f('0x2')]({'port':0x2329});client[_0x886f('0x3')]=function(_0x37812c,_0x1e4506){return new BPromise(function(_0x2e8752,_0x1e9f6a){return client[_0x886f('0x4')](_0x37812c,_0x1e4506)[_0x886f('0x5')](function(_0x1588b2){logger[_0x886f('0x6')](_0x886f('0x7'),'routing',_0x37812c,_0x1e4506,_0x1588b2);if(_0x1588b2[_0x886f('0x8')]){logger[_0x886f('0x8')](_0x886f('0x7'),'routing',_0x37812c,_0x1588b2[_0x886f('0x8')]['message'],_0x1e4506);return _0x1e9f6a(_0x1588b2['error'][_0x886f('0x9')]);}else{return _0x2e8752(_0x1588b2[_0x886f('0xa')]);}})['catch'](function(_0x2cbbc7){logger[_0x886f('0x8')](_0x886f('0x7'),_0x886f('0xb'),_0x37812c,_0x2cbbc7,_0x1e4506);return _0x1e9f6a(_0x2cbbc7);});});};module[_0x886f('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ea01ff3..9213423 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 _0x71f6=['./lib/email','./rpc/mailAccount','./rpc/setting','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','log','./server'];(function(_0x48ba6a,_0x41a599){var _0x1a318a=function(_0x38ab43){while(--_0x38ab43){_0x48ba6a['push'](_0x48ba6a['shift']());}};_0x1a318a(++_0x41a599);}(_0x71f6,0x1ac));var _0x671f=function(_0x36fadd,_0x4e383c){_0x36fadd=_0x36fadd-0x0;var _0x19474f=_0x71f6[_0x36fadd];return _0x19474f;};'use strict';var BPromise=require('bluebird');var server=require(_0x671f('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x671f('0x1'));var mailAccount=require(_0x671f('0x2'));var setting=require(_0x671f('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x671f('0x4')](mailAccount[_0x671f('0x5')]())[_0x671f('0x4')](realtime[_0x671f('0x6')]())[_0x671f('0x4')](function(){email[_0x671f('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x671f('0x8')](realtime,email)[_0x671f('0x4')](function(){return initRealtime();})[_0x671f('0x4')](function(){return setting[_0x671f('0x9')]();})[_0x671f('0x4')](function(_0x59fb01){return setInterval(initRealtime,_0x59fb01[_0x671f('0xa')]*0x3e8);})[_0x671f('0xb')](function(_0x475334){console[_0x671f('0xc')](_0x475334);});}main(); \ No newline at end of file +var _0x97dd=['log','bluebird','./server','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','getMailAccounts','initMailAccounts','then','mailAccounts','listen','getSettings','catch'];(function(_0x2b7ba3,_0x3eb26a){var _0x2d189f=function(_0x29678e){while(--_0x29678e){_0x2b7ba3['push'](_0x2b7ba3['shift']());}};_0x2d189f(++_0x3eb26a);}(_0x97dd,0xef));var _0xd97d=function(_0xf9bc,_0x572260){_0xf9bc=_0xf9bc-0x0;var _0x3822c9=_0x97dd[_0xf9bc];return _0x3822c9;};'use strict';var BPromise=require(_0xd97d('0x0'));var server=require(_0xd97d('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0xd97d('0x2'));var mailAccount=require(_0xd97d('0x3'));var setting=require(_0xd97d('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xd97d('0x5')]()['then'](mailAccount[_0xd97d('0x6')]())['then'](realtime[_0xd97d('0x7')]())[_0xd97d('0x8')](function(){email['refresh'](realtime[_0xd97d('0x9')]);return realtime;});}function main(){return server[_0xd97d('0xa')](realtime,email)[_0xd97d('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0xd97d('0xb')]();})[_0xd97d('0x8')](function(_0x385860){return setInterval(initRealtime,_0x385860['loginMailFrequency']*0x3e8);})[_0xd97d('0xc')](function(_0x3ce705){console[_0xd97d('0xd')](_0x3ce705);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c2e5a72..3e62c38 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 _0xb647=['from','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','Smtp','verify','then','catch','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName'];(function(_0x47c67d,_0x35ba8a){var _0x3ce67b=function(_0x3c66e3){while(--_0x3c66e3){_0x47c67d['push'](_0x47c67d['shift']());}};_0x3ce67b(++_0x35ba8a);}(_0xb647,0x74));var _0x7b64=function(_0x665a14,_0x50a993){_0x665a14=_0x665a14-0x0;var _0x214b72=_0xb647[_0x665a14];return _0x214b72;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x7b64('0x0'));var md5=require(_0x7b64('0x1'));var Redis=require(_0x7b64('0x2'));var config=require(_0x7b64('0x3'));var logger=require(_0x7b64('0x4'))(_0x7b64('0x5'));config['redis']=_[_0x7b64('0x6')](config['redis'],{'host':_0x7b64('0x7'),'port':0x18eb});var io=require(_0x7b64('0x8'))(new Redis(config[_0x7b64('0x9')]));var EmailImap=require(_0x7b64('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x7b64('0xb'));var md5Accounts={};function EmailChannel(_0x1866ec){logger[_0x7b64('0xc')]('start\x20email\x20channel');this['mailAccounts']=_0x1866ec[_0x7b64('0xd')];this[_0x7b64('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7b64('0xf')][_0x7b64('0x10')]=function(_0x5e20c3){var _0x3834a2=this[_0x7b64('0xd')][_0x5e20c3];var _0x1657fd={'id':_0x3834a2['id'],'name':_0x3834a2[_0x7b64('0x11')],'key':_0x3834a2[_0x7b64('0x12')],'active':_0x3834a2[_0x7b64('0x13')],'Imap':{'status':_0x3834a2[_0x7b64('0x14')][_0x7b64('0x15')],'messageStatus':_0x3834a2[_0x7b64('0x14')][_0x7b64('0x16')],'total':_0x3834a2[_0x7b64('0x14')][_0x7b64('0x17')]}};if(_[_0x7b64('0x18')](md5Accounts[_0x5e20c3])){md5Accounts[_0x5e20c3]={};}var _0x17824a=md5(JSON[_0x7b64('0x19')](_0x1657fd));if(md5Accounts[_0x5e20c3][_0x7b64('0x1')]!==_0x17824a){md5Accounts[_0x5e20c3][_0x7b64('0x1')]=_0x17824a;io[_0x7b64('0x10')](_0x7b64('0x1a'),_0x1657fd);}};EmailChannel['prototype'][_0x7b64('0x1b')]=function(_0x588a1a){for(var _0x13a350 in _0x588a1a){if(_0x588a1a[_0x7b64('0x1c')](_0x13a350)){if(_0x588a1a[_0x13a350][_0x7b64('0x14')]&&_0x588a1a[_0x13a350][_0x7b64('0x13')]){var _0x13b27c=_0x588a1a[_0x13a350][_0x7b64('0x14')];if(!this[_0x7b64('0xe')]['hasOwnProperty'](_0x13b27c['id'])){this['imapAccounts'][_0x13b27c['id']]=new EmailImap(_0x13b27c,_0x588a1a[_0x13a350][_0x7b64('0x5')]);this['imapAccounts'][_0x13b27c['id']]['on'](_0x7b64('0x1d'),this[_0x7b64('0x1e')][_0x7b64('0x1f')](this,_0x13a350));this[_0x7b64('0xe')][_0x13b27c['id']]['on']('email',this['handleImapEmail'][_0x7b64('0x1f')](this,_0x13a350));this['imapAccounts'][_0x13b27c['id']]['on'](_0x7b64('0x20'),this[_0x7b64('0x21')][_0x7b64('0x1f')](this,_0x13a350));this[_0x7b64('0xe')][_0x13b27c['id']]['on'](_0x7b64('0x22'),this[_0x7b64('0x23')][_0x7b64('0x1f')](this,_0x13a350));}}else{if(_['isNil'](this[_0x7b64('0xd')][_0x13a350][_0x7b64('0x14')])){this['mailAccounts'][_0x13a350][_0x7b64('0x14')]={};}this[_0x7b64('0xd')][_0x13a350][_0x7b64('0x14')]['status']=_0x7b64('0x24');this[_0x7b64('0xd')][_0x13a350][_0x7b64('0x14')][_0x7b64('0x16')]='';this['emit'](_0x13a350);}}}};EmailChannel['prototype'][_0x7b64('0x1e')]=function(_0x51b10f,_0x279443){if(this['mailAccounts'][_0x51b10f]){this[_0x7b64('0xd')][_0x51b10f]['Imap']['status']=_0x7b64('0x25');this['mailAccounts'][_0x51b10f][_0x7b64('0x14')]['messageStatus']=_0x279443[_0x7b64('0x11')];if(_0x279443[_0x7b64('0x26')]){this[_0x7b64('0xd')][_0x51b10f][_0x7b64('0x14')]['total']=_0x279443[_0x7b64('0x26')][_0x7b64('0x17')];}return this['emit'](_0x51b10f);}};EmailChannel[_0x7b64('0xf')][_0x7b64('0x27')]=function(_0x560f8f,_0x140a6a){logger[_0x7b64('0xc')](_0x7b64('0x28'),_0x140a6a[_0x7b64('0x29')],_0x140a6a[_0x7b64('0x2a')],_0x140a6a[_0x7b64('0x2b')],_0x560f8f);if(this[_0x7b64('0xd')][_0x560f8f]){return mailAccount['notify'](_0x560f8f,_0x140a6a)['then'](function(_0x5cc604){if(_0x5cc604){logger[_0x7b64('0xc')](_0x7b64('0x2c'));}})['catch'](function(_0x448a55){logger[_0x7b64('0x22')](_0x7b64('0x2d'),JSON[_0x7b64('0x19')](_0x448a55));});}};EmailChannel['prototype'][_0x7b64('0x21')]=function(_0x23d861){if(this[_0x7b64('0xd')][_0x23d861]&&this[_0x7b64('0xd')][_0x23d861][_0x7b64('0x14')]){if(this[_0x7b64('0xe')][this['mailAccounts'][_0x23d861][_0x7b64('0x14')]['id']]){delete this[_0x7b64('0xe')][this[_0x7b64('0xd')][_0x23d861][_0x7b64('0x14')]['id']];}this[_0x7b64('0xd')][_0x23d861][_0x7b64('0x14')][_0x7b64('0x2e')]=moment();this['emit'](_0x23d861);}};EmailChannel[_0x7b64('0xf')][_0x7b64('0x23')]=function(_0x50ca1c,_0x35b91f){if(this['mailAccounts'][_0x50ca1c]){this[_0x7b64('0xd')][_0x50ca1c][_0x7b64('0x14')][_0x7b64('0x15')]=_0x7b64('0x22');this[_0x7b64('0xd')][_0x50ca1c]['Imap'][_0x7b64('0x16')]=_0x35b91f;return this[_0x7b64('0x10')](_0x50ca1c);}};EmailChannel[_0x7b64('0xf')][_0x7b64('0x2f')]=function(_0x150db0,_0x240d33){return this[_0x7b64('0x30')]['send'](_0x150db0,_0x240d33);};EmailChannel['prototype']['verifySmtp']=function(_0x3d5364){var _0x18569b=this;if(this['mailAccounts'][_0x3d5364['id']]){if(_[_0x7b64('0x18')](this[_0x7b64('0xd')][_0x3d5364['id']]['Smtp'])){this[_0x7b64('0xd')][_0x3d5364['id']][_0x7b64('0x31')]={};}this[_0x7b64('0xd')][_0x3d5364['id']][_0x7b64('0x31')][_0x7b64('0x2e')]=moment();return new BPromise(function(_0x2add12,_0x3ab529){return _0x18569b[_0x7b64('0x30')][_0x7b64('0x32')](_0x3d5364)[_0x7b64('0x33')](function(_0x8396e8){_0x18569b[_0x7b64('0xd')][_0x3d5364['id']]['Smtp'][_0x7b64('0x15')]='verified';_0x18569b[_0x7b64('0xd')][_0x3d5364['id']][_0x7b64('0x31')][_0x7b64('0x16')]='';_0x18569b[_0x7b64('0x10')](_0x3d5364['id']);_0x2add12(_0x8396e8);})[_0x7b64('0x34')](function(_0x2db4ad){_0x18569b[_0x7b64('0xd')][_0x3d5364['id']][_0x7b64('0x31')][_0x7b64('0x15')]=_0x7b64('0x22');_0x18569b[_0x7b64('0xd')][_0x3d5364['id']][_0x7b64('0x31')][_0x7b64('0x16')]=_0x2db4ad;_0x18569b[_0x7b64('0x10')](_0x3d5364['id']);_0x3ab529(_0x2db4ad);});});}return this['smtp'][_0x7b64('0x32')](_0x3d5364);};module['exports']=EmailChannel; \ No newline at end of file +var _0xe197=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','Imap','messageStatus','isNil','stringify','emit','refresh','hasOwnProperty','active','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','handleImapError','status','disabled','prototype','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','sendMail','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe197,0x68));var _0x7e19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe197[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7e19('0x0'));var moment=require(_0x7e19('0x1'));var BPromise=require(_0x7e19('0x2'));var md5=require(_0x7e19('0x3'));var Redis=require(_0x7e19('0x4'));var config=require(_0x7e19('0x5'));var logger=require(_0x7e19('0x6'))(_0x7e19('0x7'));config[_0x7e19('0x8')]=_[_0x7e19('0x9')](config[_0x7e19('0x8')],{'host':_0x7e19('0xa'),'port':0x18eb});var io=require(_0x7e19('0xb'))(new Redis(config[_0x7e19('0x8')]));var EmailImap=require(_0x7e19('0xc'));var EmailSmtp=require(_0x7e19('0xd'));var mailAccount=require(_0x7e19('0xe'));var md5Accounts={};function EmailChannel(_0x5c1cf7){logger[_0x7e19('0xf')](_0x7e19('0x10'));this['mailAccounts']=_0x5c1cf7[_0x7e19('0x11')];this[_0x7e19('0x12')]={};this[_0x7e19('0x13')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x5513d6){var _0x1b4375=this[_0x7e19('0x11')][_0x5513d6];var _0x399b3c={'id':_0x1b4375['id'],'name':_0x1b4375[_0x7e19('0x14')],'key':_0x1b4375[_0x7e19('0x15')],'active':_0x1b4375['active'],'Imap':{'status':_0x1b4375[_0x7e19('0x16')]['status'],'messageStatus':_0x1b4375['Imap'][_0x7e19('0x17')],'total':_0x1b4375[_0x7e19('0x16')]['total']}};if(_[_0x7e19('0x18')](md5Accounts[_0x5513d6])){md5Accounts[_0x5513d6]={};}var _0x58aced=md5(JSON[_0x7e19('0x19')](_0x399b3c));if(md5Accounts[_0x5513d6][_0x7e19('0x3')]!==_0x58aced){md5Accounts[_0x5513d6][_0x7e19('0x3')]=_0x58aced;io[_0x7e19('0x1a')]('mailAccount:update',_0x399b3c);}};EmailChannel['prototype'][_0x7e19('0x1b')]=function(_0x3fd5f6){for(var _0x13b52e in _0x3fd5f6){if(_0x3fd5f6[_0x7e19('0x1c')](_0x13b52e)){if(_0x3fd5f6[_0x13b52e][_0x7e19('0x16')]&&_0x3fd5f6[_0x13b52e][_0x7e19('0x1d')]){var _0x4e20a2=_0x3fd5f6[_0x13b52e][_0x7e19('0x16')];if(!this['imapAccounts']['hasOwnProperty'](_0x4e20a2['id'])){this['imapAccounts'][_0x4e20a2['id']]=new EmailImap(_0x4e20a2,_0x3fd5f6[_0x13b52e][_0x7e19('0x7')]);this[_0x7e19('0x12')][_0x4e20a2['id']]['on'](_0x7e19('0x1e'),this[_0x7e19('0x1f')]['bind'](this,_0x13b52e));this[_0x7e19('0x12')][_0x4e20a2['id']]['on'](_0x7e19('0x7'),this[_0x7e19('0x20')][_0x7e19('0x21')](this,_0x13b52e));this[_0x7e19('0x12')][_0x4e20a2['id']]['on'](_0x7e19('0x22'),this[_0x7e19('0x23')][_0x7e19('0x21')](this,_0x13b52e));this[_0x7e19('0x12')][_0x4e20a2['id']]['on']('error',this[_0x7e19('0x24')]['bind'](this,_0x13b52e));}}else{if(_[_0x7e19('0x18')](this['mailAccounts'][_0x13b52e][_0x7e19('0x16')])){this[_0x7e19('0x11')][_0x13b52e][_0x7e19('0x16')]={};}this[_0x7e19('0x11')][_0x13b52e][_0x7e19('0x16')][_0x7e19('0x25')]=_0x7e19('0x26');this['mailAccounts'][_0x13b52e][_0x7e19('0x16')][_0x7e19('0x17')]='';this[_0x7e19('0x1a')](_0x13b52e);}}}};EmailChannel[_0x7e19('0x27')][_0x7e19('0x1f')]=function(_0x1a85c1,_0x4a6a92){if(this['mailAccounts'][_0x1a85c1]){this[_0x7e19('0x11')][_0x1a85c1]['Imap']['status']=_0x7e19('0x28');this[_0x7e19('0x11')][_0x1a85c1][_0x7e19('0x16')][_0x7e19('0x17')]=_0x4a6a92[_0x7e19('0x14')];if(_0x4a6a92[_0x7e19('0x29')]){this['mailAccounts'][_0x1a85c1][_0x7e19('0x16')][_0x7e19('0x2a')]=_0x4a6a92[_0x7e19('0x29')][_0x7e19('0x2a')];}return this['emit'](_0x1a85c1);}};EmailChannel[_0x7e19('0x27')][_0x7e19('0x20')]=function(_0x569ac6,_0x1799ea){logger['info'](_0x7e19('0x2b'),_0x1799ea[_0x7e19('0x2c')],_0x1799ea[_0x7e19('0x2d')],_0x1799ea[_0x7e19('0x2e')],_0x569ac6);if(this[_0x7e19('0x11')][_0x569ac6]){return mailAccount[_0x7e19('0x2f')](_0x569ac6,_0x1799ea)['then'](function(_0xea5efc){if(_0xea5efc){logger[_0x7e19('0xf')](_0x7e19('0x30'));}})[_0x7e19('0x31')](function(_0x1dc748){logger['error'](_0x7e19('0x32'),JSON[_0x7e19('0x19')](_0x1dc748));});}};EmailChannel['prototype'][_0x7e19('0x23')]=function(_0x314f85){if(this[_0x7e19('0x11')][_0x314f85]&&this[_0x7e19('0x11')][_0x314f85]['Imap']){if(this[_0x7e19('0x12')][this['mailAccounts'][_0x314f85][_0x7e19('0x16')]['id']]){delete this[_0x7e19('0x12')][this[_0x7e19('0x11')][_0x314f85][_0x7e19('0x16')]['id']];}this[_0x7e19('0x11')][_0x314f85]['Imap'][_0x7e19('0x33')]=moment();this['emit'](_0x314f85);}};EmailChannel['prototype'][_0x7e19('0x24')]=function(_0x59a520,_0x19f4db){if(this['mailAccounts'][_0x59a520]){this[_0x7e19('0x11')][_0x59a520][_0x7e19('0x16')][_0x7e19('0x25')]=_0x7e19('0x34');this[_0x7e19('0x11')][_0x59a520][_0x7e19('0x16')]['messageStatus']=_0x19f4db;return this['emit'](_0x59a520);}};EmailChannel[_0x7e19('0x27')][_0x7e19('0x35')]=function(_0x523a10,_0x14052c){return this[_0x7e19('0x13')]['send'](_0x523a10,_0x14052c);};EmailChannel[_0x7e19('0x27')][_0x7e19('0x36')]=function(_0x5aad56){var _0x3020ad=this;if(this[_0x7e19('0x11')][_0x5aad56['id']]){if(_[_0x7e19('0x18')](this[_0x7e19('0x11')][_0x5aad56['id']][_0x7e19('0x37')])){this['mailAccounts'][_0x5aad56['id']][_0x7e19('0x37')]={};}this[_0x7e19('0x11')][_0x5aad56['id']][_0x7e19('0x37')][_0x7e19('0x33')]=moment();return new BPromise(function(_0x596fbf,_0x3cc545){return _0x3020ad[_0x7e19('0x13')][_0x7e19('0x38')](_0x5aad56)['then'](function(_0x4b4e69){_0x3020ad[_0x7e19('0x11')][_0x5aad56['id']][_0x7e19('0x37')][_0x7e19('0x25')]=_0x7e19('0x39');_0x3020ad[_0x7e19('0x11')][_0x5aad56['id']][_0x7e19('0x37')][_0x7e19('0x17')]='';_0x3020ad[_0x7e19('0x1a')](_0x5aad56['id']);_0x596fbf(_0x4b4e69);})[_0x7e19('0x31')](function(_0x16036e){_0x3020ad[_0x7e19('0x11')][_0x5aad56['id']][_0x7e19('0x37')][_0x7e19('0x25')]=_0x7e19('0x34');_0x3020ad[_0x7e19('0x11')][_0x5aad56['id']][_0x7e19('0x37')]['messageStatus']=_0x16036e;_0x3020ad[_0x7e19('0x1a')](_0x5aad56['id']);_0x3cc545(_0x16036e);});});}return this[_0x7e19('0x13')][_0x7e19('0x38')](_0x5aad56);};module[_0x7e19('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 6da765f..fad75ee 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 _0xcd5e=['EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','error','handleError','prototype','connTimeout','authTimeout','isNil','service','authentication','user','host','port','tls','autotls','required','password','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','closeBox','stringify','upperFirst','exports','randomstring','simpleParser','Iconv','events'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0xcd5e,0xb3));var _0xecd5=function(_0x4755de,_0x52bf73){_0x4755de=_0x4755de-0x0;var _0x3ba0ca=_0xcd5e[_0x4755de];return _0x3ba0ca;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require('imap');var _=require('lodash');var rs=require(_0xecd5('0x0'));var simpleParser=require('mailparser')[_0xecd5('0x1')];var Iconv=require('iconv')[_0xecd5('0x2')];var EventEmitter=require(_0xecd5('0x3'))[_0xecd5('0x4')];var utils=require(_0xecd5('0x5'));var logger=require(_0xecd5('0x6'))(_0xecd5('0x7'));function EmailImap(_0x555904,_0x326d2d){this[_0xecd5('0x8')]=_0xecd5('0x9');this[_0xecd5('0xa')]=this[_0xecd5('0xb')](_0x555904,_0x326d2d);this[_0xecd5('0xc')]=new Imap(this['account']);this['imap'][_0xecd5('0xd')](_0xecd5('0xe'),this[_0xecd5('0xf')][_0xecd5('0x10')](this));this['imap']['once']('end',this[_0xecd5('0x11')][_0xecd5('0x10')](this));this[_0xecd5('0xc')]['on'](_0xecd5('0x12'),this[_0xecd5('0x13')][_0xecd5('0x10')](this));this['imap']['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xecd5('0x14')][_0xecd5('0xb')]=function(_0x397cc1,_0x210482){var _0x27b1c9={'connTimeout':_0x397cc1[_0xecd5('0x15')]?_0x397cc1[_0xecd5('0x15')]*0x3e8:0x2710,'authTimeout':_0x397cc1[_0xecd5('0x16')]?_0x397cc1[_0xecd5('0x16')]*0x3e8:0x1388};if(_[_0xecd5('0x17')](_0x397cc1[_0xecd5('0x18')])){if(_0x397cc1[_0xecd5('0x19')]){_0x27b1c9[_0xecd5('0x1a')]=_0x397cc1[_0xecd5('0x1a')];_0x27b1c9['password']=_0x397cc1['password'];}_0x27b1c9['host']=_0x397cc1[_0xecd5('0x1b')];_0x27b1c9[_0xecd5('0x1c')]=_0x397cc1[_0xecd5('0x1c')]||0x3e1;if(_0x397cc1[_0xecd5('0x1d')]){_0x27b1c9[_0xecd5('0x1d')]=!![];}else{_0x27b1c9[_0xecd5('0x1d')]=![];_0x27b1c9[_0xecd5('0x1e')]=_0xecd5('0x1f');}}else{_0x27b1c9[_0xecd5('0x1a')]=_0x397cc1[_0xecd5('0x1a')];_0x27b1c9[_0xecd5('0x20')]=_0x397cc1[_0xecd5('0x20')];_0x27b1c9['host']=utils['getHost'](_0x397cc1[_0xecd5('0x18')]);_0x27b1c9[_0xecd5('0x1c')]=0x3e1;_0x27b1c9[_0xecd5('0x1d')]=!![];}_0x27b1c9[_0xecd5('0x7')]=_0x210482||_0x397cc1[_0xecd5('0x1a')]||_0xecd5('0x21');return _0x27b1c9;};EmailImap['prototype'][_0xecd5('0xf')]=function(){this[_0xecd5('0xc')][_0xecd5('0x22')](this[_0xecd5('0x8')],![],this[_0xecd5('0x23')][_0xecd5('0x10')](this));};EmailImap[_0xecd5('0x14')]['handleOpenBox']=function(_0x33592b,_0x277f54){if(_0x33592b){this[_0xecd5('0x13')](_0x33592b,!![]);}else{this['emit'](_0xecd5('0x24'),_0x277f54);this[_0xecd5('0x25')]();}};EmailImap[_0xecd5('0x14')]['handleCloseBox']=function(_0x471d91){if(_0x471d91){this[_0xecd5('0x13')](_0x471d91,!![]);}else{this[_0xecd5('0xc')][_0xecd5('0x26')]();}};EmailImap[_0xecd5('0x14')][_0xecd5('0x25')]=function(){this[_0xecd5('0xc')][_0xecd5('0x27')]([_0xecd5('0x28')],this[_0xecd5('0x29')][_0xecd5('0x10')](this));};EmailImap['prototype'][_0xecd5('0x29')]=function(_0x4383a1,_0x51a85a){if(_0x4383a1){this['handleError'](_0x4383a1,!![]);}else{if(_0x51a85a[_0xecd5('0x2a')]){try{var _0x36c392=this[_0xecd5('0xc')][_0xecd5('0x2b')](_0x51a85a,{'bodies':'','markSeen':!![]});_0x36c392['on'](_0xecd5('0x2c'),this[_0xecd5('0x2d')][_0xecd5('0x10')](this));_0x36c392['once'](_0xecd5('0x12'),this[_0xecd5('0x2e')][_0xecd5('0x10')](this));_0x36c392[_0xecd5('0xd')](_0xecd5('0x26'),this[_0xecd5('0x2f')][_0xecd5('0x10')](this));}catch(_0x583c1e){logger[_0xecd5('0x12')](_0x583c1e);}}else{this[_0xecd5('0xc')]['closeBox'](!![],this[_0xecd5('0x30')][_0xecd5('0x10')](this));}}};EmailImap[_0xecd5('0x14')]['handleFetchMessage']=function(_0x58d06c,_0x1d8feb){_0x58d06c['on'](_0xecd5('0x31'),this[_0xecd5('0x32')][_0xecd5('0x10')](this));_0x58d06c[_0xecd5('0xd')](_0xecd5('0x33'),this[_0xecd5('0x34')][_0xecd5('0x10')](this));_0x58d06c[_0xecd5('0xd')](_0xecd5('0x26'),this[_0xecd5('0x35')][_0xecd5('0x10')](this));};EmailImap[_0xecd5('0x14')][_0xecd5('0x32')]=function(_0x53229b,_0x54191d){simpleParser(_0x53229b,{'Iconv':Iconv},this['handleSimpleParser'][_0xecd5('0x10')](this));};EmailImap[_0xecd5('0x14')][_0xecd5('0x34')]=function(_0x3c7e36){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xecd5('0x14')][_0xecd5('0x36')]=function(_0x33d30d,_0x19c090){if(_0x33d30d){logger[_0xecd5('0x12')](_0x33d30d);}else{var _0x159094=this;utils[_0xecd5('0x37')](this[_0xecd5('0xa')],_0x19c090,function(_0x51a4e2){_0x159094[_0xecd5('0x38')](_0xecd5('0x7'),_0x51a4e2);});}};EmailImap[_0xecd5('0x14')]['handleFetchEnd']=function(){this[_0xecd5('0xc')]['closeBox'](!![],this[_0xecd5('0x30')]['bind'](this));};EmailImap[_0xecd5('0x14')]['handleFetchError']=function(_0x3e390a){this['handleError'](_0x3e390a);this[_0xecd5('0xc')][_0xecd5('0x39')](!![],this[_0xecd5('0x30')]['bind'](this));};EmailImap[_0xecd5('0x14')][_0xecd5('0x11')]=function(){this['emit'](_0xecd5('0x26'));};EmailImap[_0xecd5('0x14')][_0xecd5('0x13')]=function(_0x5373da,_0x4ef28e){logger['error'](_0xecd5('0x13'),this[_0xecd5('0xa')]['email'],JSON[_0xecd5('0x3a')](_0x5373da));var _0x5ddbd2='';if(_0x5373da){if(_0x5373da['textCode']){_0x5ddbd2=_0x5373da['textCode'];}else{for(var _0xf7147c in _0x5373da){if(_0x5373da['hasOwnProperty'](_0xf7147c)){_0x5ddbd2+=_[_0xecd5('0x3b')](_0xf7147c)+':\x20'+_0x5373da[_0xf7147c]+'\x0a';}}}}if(_0x4ef28e){this[_0xecd5('0xc')][_0xecd5('0x26')]();}else{this[_0xecd5('0x38')](_0xecd5('0x12'),_0x5ddbd2);this[_0xecd5('0x38')]('end');}};module[_0xecd5('0x3c')]=EmailImap; \ No newline at end of file +var _0x20cb=['lodash','randomstring','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','once','end','handleEnd','bind','error','handleError','connect','prototype','connTimeout','authTimeout','isNil','authentication','user','host','port','tls','autotls','required','password','getHost','email','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','util','imap'];(function(_0x13950d,_0xe828fe){var _0x37013b=function(_0x17d355){while(--_0x17d355){_0x13950d['push'](_0x13950d['shift']());}};_0x37013b(++_0xe828fe);}(_0x20cb,0x12a));var _0xb20c=function(_0x1f0345,_0x554d63){_0x1f0345=_0x1f0345-0x0;var _0x232157=_0x20cb[_0x1f0345];return _0x232157;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xb20c('0x0'));var Imap=require(_0xb20c('0x1'));var _=require(_0xb20c('0x2'));var rs=require(_0xb20c('0x3'));var simpleParser=require('mailparser')[_0xb20c('0x4')];var Iconv=require(_0xb20c('0x5'))[_0xb20c('0x6')];var EventEmitter=require(_0xb20c('0x7'))[_0xb20c('0x8')];var utils=require(_0xb20c('0x9'));var logger=require(_0xb20c('0xa'))('email');function EmailImap(_0x5bfbe7,_0x188769){this[_0xb20c('0xb')]=_0xb20c('0xc');this[_0xb20c('0xd')]=this[_0xb20c('0xe')](_0x5bfbe7,_0x188769);this[_0xb20c('0x1')]=new Imap(this[_0xb20c('0xd')]);this['imap']['once']('ready',this['handleReady']['bind'](this));this[_0xb20c('0x1')][_0xb20c('0xf')](_0xb20c('0x10'),this[_0xb20c('0x11')][_0xb20c('0x12')](this));this[_0xb20c('0x1')]['on'](_0xb20c('0x13'),this[_0xb20c('0x14')]['bind'](this));this[_0xb20c('0x1')][_0xb20c('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xb20c('0x16')][_0xb20c('0xe')]=function(_0x1b42c2,_0x2f4314){var _0x378962={'connTimeout':_0x1b42c2[_0xb20c('0x17')]?_0x1b42c2['connTimeout']*0x3e8:0x2710,'authTimeout':_0x1b42c2[_0xb20c('0x18')]?_0x1b42c2[_0xb20c('0x18')]*0x3e8:0x1388};if(_[_0xb20c('0x19')](_0x1b42c2['service'])){if(_0x1b42c2[_0xb20c('0x1a')]){_0x378962[_0xb20c('0x1b')]=_0x1b42c2[_0xb20c('0x1b')];_0x378962['password']=_0x1b42c2['password'];}_0x378962[_0xb20c('0x1c')]=_0x1b42c2[_0xb20c('0x1c')];_0x378962[_0xb20c('0x1d')]=_0x1b42c2[_0xb20c('0x1d')]||0x3e1;if(_0x1b42c2[_0xb20c('0x1e')]){_0x378962[_0xb20c('0x1e')]=!![];}else{_0x378962[_0xb20c('0x1e')]=![];_0x378962[_0xb20c('0x1f')]=_0xb20c('0x20');}}else{_0x378962[_0xb20c('0x1b')]=_0x1b42c2[_0xb20c('0x1b')];_0x378962[_0xb20c('0x21')]=_0x1b42c2[_0xb20c('0x21')];_0x378962[_0xb20c('0x1c')]=utils[_0xb20c('0x22')](_0x1b42c2['service']);_0x378962[_0xb20c('0x1d')]=0x3e1;_0x378962[_0xb20c('0x1e')]=!![];}_0x378962[_0xb20c('0x23')]=_0x2f4314||_0x1b42c2[_0xb20c('0x1b')]||_0xb20c('0x24');return _0x378962;};EmailImap[_0xb20c('0x16')]['handleReady']=function(){this[_0xb20c('0x1')][_0xb20c('0x25')](this['mailbox'],![],this[_0xb20c('0x26')]['bind'](this));};EmailImap[_0xb20c('0x16')][_0xb20c('0x26')]=function(_0x8a6529,_0x1ddf3a){if(_0x8a6529){this[_0xb20c('0x14')](_0x8a6529,!![]);}else{this[_0xb20c('0x27')](_0xb20c('0x28'),_0x1ddf3a);this[_0xb20c('0x29')]();}};EmailImap[_0xb20c('0x16')][_0xb20c('0x2a')]=function(_0x12608d){if(_0x12608d){this['handleError'](_0x12608d,!![]);}else{this[_0xb20c('0x1')]['end']();}};EmailImap[_0xb20c('0x16')]['readUnseen']=function(){this[_0xb20c('0x1')][_0xb20c('0x2b')]([_0xb20c('0x2c')],this[_0xb20c('0x2d')][_0xb20c('0x12')](this));};EmailImap['prototype'][_0xb20c('0x2d')]=function(_0x3402f6,_0x2038c2){if(_0x3402f6){this[_0xb20c('0x14')](_0x3402f6,!![]);}else{if(_0x2038c2[_0xb20c('0x2e')]){try{var _0x1c592c=this[_0xb20c('0x1')]['fetch'](_0x2038c2,{'bodies':'','markSeen':!![]});_0x1c592c['on'](_0xb20c('0x2f'),this[_0xb20c('0x30')][_0xb20c('0x12')](this));_0x1c592c[_0xb20c('0xf')]('error',this['handleFetchError'][_0xb20c('0x12')](this));_0x1c592c['once']('end',this[_0xb20c('0x31')]['bind'](this));}catch(_0x13d2b2){logger[_0xb20c('0x13')](_0x13d2b2);}}else{this[_0xb20c('0x1')]['closeBox'](!![],this[_0xb20c('0x2a')][_0xb20c('0x12')](this));}}};EmailImap[_0xb20c('0x16')][_0xb20c('0x30')]=function(_0x4f34e3,_0x5c7533){_0x4f34e3['on'](_0xb20c('0x32'),this[_0xb20c('0x33')][_0xb20c('0x12')](this));_0x4f34e3['once'](_0xb20c('0x34'),this[_0xb20c('0x35')][_0xb20c('0x12')](this));_0x4f34e3[_0xb20c('0xf')](_0xb20c('0x10'),this[_0xb20c('0x36')][_0xb20c('0x12')](this));};EmailImap[_0xb20c('0x16')]['handleMessageBody']=function(_0x553d6e,_0x4cf42b){simpleParser(_0x553d6e,{'Iconv':Iconv},this['handleSimpleParser'][_0xb20c('0x12')](this));};EmailImap[_0xb20c('0x16')][_0xb20c('0x35')]=function(_0x300570){};EmailImap[_0xb20c('0x16')][_0xb20c('0x36')]=function(){};EmailImap[_0xb20c('0x16')][_0xb20c('0x37')]=function(_0x5a63f6,_0x379097){if(_0x5a63f6){logger[_0xb20c('0x13')](_0x5a63f6);}else{var _0x9fbafd=this;utils[_0xb20c('0x38')](this[_0xb20c('0xd')],_0x379097,function(_0x48f487){_0x9fbafd[_0xb20c('0x27')]('email',_0x48f487);});}};EmailImap['prototype'][_0xb20c('0x31')]=function(){this[_0xb20c('0x1')][_0xb20c('0x39')](!![],this[_0xb20c('0x2a')]['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x5ac43a){this['handleError'](_0x5ac43a);this[_0xb20c('0x1')][_0xb20c('0x39')](!![],this['handleCloseBox'][_0xb20c('0x12')](this));};EmailImap[_0xb20c('0x16')]['handleEnd']=function(){this[_0xb20c('0x27')](_0xb20c('0x10'));};EmailImap['prototype'][_0xb20c('0x14')]=function(_0x1b2448,_0x155ae2){logger[_0xb20c('0x13')](_0xb20c('0x14'),this['account'][_0xb20c('0x23')],JSON[_0xb20c('0x3a')](_0x1b2448));var _0x516dc9='';if(_0x1b2448){if(_0x1b2448['textCode']){_0x516dc9=_0x1b2448[_0xb20c('0x3b')];}else{for(var _0x1685cf in _0x1b2448){if(_0x1b2448['hasOwnProperty'](_0x1685cf)){_0x516dc9+=_['upperFirst'](_0x1685cf)+':\x20'+_0x1b2448[_0x1685cf]+'\x0a';}}}}if(_0x155ae2){this[_0xb20c('0x1')][_0xb20c('0x10')]();}else{this['emit'](_0xb20c('0x13'),_0x516dc9);this['emit'](_0xb20c('0x10'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index b796683..ecd8789 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 _0xbf29=['compile','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x3e9800,_0x54ec64){var _0x31d038=function(_0x568420){while(--_0x568420){_0x3e9800['push'](_0x3e9800['shift']());}};_0x31d038(++_0x54ec64);}(_0xbf29,0x12e));var _0x9bf2=function(_0x535e73,_0x5d397f){_0x535e73=_0x535e73-0x0;var _0x316665=_0xbf29[_0x535e73];return _0x316665;};'use strict';var nodemailer=require(_0x9bf2('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x9bf2('0x1'));function EmailSmtp(){}EmailSmtp[_0x9bf2('0x2')][_0x9bf2('0x3')]=function(_0x9321d1,_0x3476c8){return new BPromise(function(_0x13cc30,_0x1be65c){var _0x241068=nodemailer[_0x9bf2('0x4')](_0x9321d1);_0x241068[_0x9bf2('0x5')](_0x9bf2('0x6'),inlineBase64());_0x241068['sendMail'](_0x3476c8,function(_0x2d8873,_0xf41fc0){if(_0x2d8873){_0x1be65c(_0x2d8873[_0x9bf2('0x7')]());}else{_0x13cc30(_0xf41fc0);}});});};EmailSmtp['prototype'][_0x9bf2('0x8')]=function(_0x36a8d9){return new BPromise(function(_0x1ad475,_0x4b5f16){var _0x1bcd2d=nodemailer[_0x9bf2('0x4')](_0x36a8d9);_0x1bcd2d[_0x9bf2('0x8')](function(_0x90d426,_0x51d611){if(_0x90d426){_0x4b5f16(_0x90d426[_0x9bf2('0x7')]());}else{if(_0x51d611){_0x1ad475(_0x51d611);}else{_0x4b5f16(_0x9bf2('0x9'));}}});});};module[_0x9bf2('0xa')]=EmailSmtp; \ No newline at end of file +var _0x3492=['toString','verify','Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail'];(function(_0x12aaff,_0x371ff6){var _0x2395f4=function(_0x3b7cfd){while(--_0x3b7cfd){_0x12aaff['push'](_0x12aaff['shift']());}};_0x2395f4(++_0x371ff6);}(_0x3492,0x123));var _0x2349=function(_0x2d23ec,_0x3a76c9){_0x2d23ec=_0x2d23ec-0x0;var _0x45f263=_0x3492[_0x2d23ec];return _0x45f263;};'use strict';var nodemailer=require(_0x2349('0x0'));var BPromise=require(_0x2349('0x1'));var inlineBase64=require(_0x2349('0x2'));function EmailSmtp(){}EmailSmtp[_0x2349('0x3')][_0x2349('0x4')]=function(_0x15c0cf,_0x48b97d){return new BPromise(function(_0x1ed0a6,_0x59b77e){var _0x5a141f=nodemailer[_0x2349('0x5')](_0x15c0cf);_0x5a141f[_0x2349('0x6')](_0x2349('0x7'),inlineBase64());_0x5a141f[_0x2349('0x8')](_0x48b97d,function(_0x3a9579,_0x3fbf39){if(_0x3a9579){_0x59b77e(_0x3a9579[_0x2349('0x9')]());}else{_0x1ed0a6(_0x3fbf39);}});});};EmailSmtp['prototype'][_0x2349('0xa')]=function(_0x40314d){return new BPromise(function(_0xfb0627,_0x581773){var _0x262fce=nodemailer['createTransport'](_0x40314d);_0x262fce['verify'](function(_0x4c512e,_0x237466){if(_0x4c512e){_0x581773(_0x4c512e[_0x2349('0x9')]());}else{if(_0x237466){_0xfb0627(_0x237466);}else{_0x581773(_0x2349('0xb'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 96211bf..0a2ff70 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 _0xa93a=['\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','randomstring','node-tnef','email','head','value','address','anonymous','generate','name','indexOf','length','join','Anonymous','split','isEmpty','html','test','includes','0x1?_0x35e162['slice'](0x0,-0x1)[_0xaa93('0xb')]('\x20'):_0x4bb171['name'];}return _0xaa93('0xc');}function getLastName(_0x4169bf){var _0x2e2307=_[_0xaa93('0x3')](_0x4169bf[_0xaa93('0x4')]);if(_0x2e2307&&_0x2e2307['name']){var _0x2ac2f5=_0x2e2307['name'][_0xaa93('0xd')](/\s+/);return _0x2ac2f5[_0xaa93('0xa')]>0x1?_0x2ac2f5['pop']():'';}return'';}function getMails(_0x543a57,_0x1394d5){var _0x665c32='';for(var _0x1cc0bc=0x0;_0x1cc0bc<_0x1394d5[_0xaa93('0x4')][_0xaa93('0xa')];_0x1cc0bc+=0x1){if(_0x1394d5[_0xaa93('0x4')][_0x1cc0bc][_0xaa93('0x5')]!==_0x543a57){if(!_[_0xaa93('0xe')](_0x665c32)){_0x665c32+=',';}_0x665c32+=_0x1394d5[_0xaa93('0x4')][_0x1cc0bc]['name']||_0x1394d5[_0xaa93('0x4')][_0x1cc0bc][_0xaa93('0x5')]||'';_0x665c32+='\x20<';_0x665c32+=_0x1394d5[_0xaa93('0x4')][_0x1cc0bc]['address']?_0x1394d5[_0xaa93('0x4')][_0x1cc0bc][_0xaa93('0x5')]:'anonymous'+random[_0xaa93('0x7')](0x6)+'@xcally.com';_0x665c32+='>';}}return _0x665c32;}function parseEmail(_0x7fc9be,_0x5b7735,_0x20e2d0){if(_0x5b7735[_0xaa93('0xf')]){var _0x4d6a45=/)<[^<]*)*<\/script>/gi;while(_0x4d6a45[_0xaa93('0x10')](_0x5b7735['html'])){_0x5b7735[_0xaa93('0xf')]=_0x5b7735[_0xaa93('0xf')]['replace'](_0x4d6a45,'');}if(_0x5b7735['html'][_0xaa93('0x11')](_0xaa93('0x12'))){var _0x23d1c8=[];_0x5b7735['attachments']['forEach'](_0x234f62=>{_0x23d1c8['push'](_0x234f62[_0xaa93('0x13')]);});var _0x1e7e97=/]+>/g;var _0x1941b8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x584059=_0x5b7735[_0xaa93('0xf')][_0xaa93('0x14')](_0x1941b8,_0xaa93('0x15'));var _0x400527=_0x584059['replace'](_0x1e7e97,_0xaa93('0x16'));for(let _0x592f06=0x0;_0x592f06<_0x23d1c8['length'];_0x592f06++){var _0x51fd9a=_0x400527['replace'](_0xaa93('0x16'),_0xaa93('0x17')+_0x23d1c8[_0x592f06]+_0xaa93('0x18'));_0x400527=_0x51fd9a;}_0x5b7735[_0xaa93('0xf')]=_0x400527;}_0x20e2d0['body']=_0x5b7735[_0xaa93('0xf')];}else{_0x20e2d0[_0xaa93('0x19')]=_0x5b7735[_0xaa93('0x1a')];}if(_0x20e2d0[_0xaa93('0x19')]){_0x20e2d0[_0xaa93('0x19')]=_0x20e2d0[_0xaa93('0x19')][_0xaa93('0x14')](/0x0){var _0x1e361f=[_0xaa93('0x2c'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x144ce5=0x0;_0x144ce5<_0x5b7735[_0xaa93('0x2b')]['length'];_0x144ce5++){var _0x397d39=_['indexOf'](_0x1e361f,_0x5b7735[_0xaa93('0x2b')][_0x144ce5]['line']);if(_0x397d39>=0x0){_0x20e2d0['isAutoreply']=!![];}}}return _0x20e2d0;}exports[_0xaa93('0x2d')]=function(_0x242d7a,_0x59d92e,_0x7c463a){var _0x3f7705={'from':getAddress(_0x59d92e[_0xaa93('0x2e')]),'firstName':getFirstName(_0x59d92e[_0xaa93('0x2e')]),'lastName':getLastName(_0x59d92e[_0xaa93('0x2e')]),'mapKey':_0xaa93('0x2'),'message':{'from':getMails(_0x242d7a[_0xaa93('0x2')],_0x59d92e[_0xaa93('0x2e')]),'to':_0x242d7a[_0xaa93('0x2')],'cc':'','subject':_0x59d92e['subject']||'','messageId':_0x59d92e[_0xaa93('0x2f')],'inReplyTo':_0x59d92e[_0xaa93('0x30')],'sentAt':moment(_0x59d92e['date'])['format'](_0xaa93('0x31')),'attach':![],'attachments':[]}};if(!_0x59d92e[_0xaa93('0xf')]&&!_0x59d92e[_0xaa93('0x1a')]){var _0xaa2387=_[_0xaa93('0x32')](_0x59d92e['attachments'],{'contentType':'application/ms-tnef'});if(_0xaa2387['length']){logger[_0xaa93('0x33')](util['format'](_0xaa93('0x34'),_0x59d92e[_0xaa93('0x2f')]));tnef[_0xaa93('0x35')](_[_0xaa93('0x36')](_0xaa2387)[_0xaa93('0x37')],function(_0x2a8c09,_0x163acf){if(_0x163acf){_0x59d92e[_0xaa93('0xf')]=_0x163acf[_0xaa93('0x38')]||_0xaa93('0x39');if(_0x163acf[_0xaa93('0x3a')]){for(var _0x5bfdcf=0x0;_0x5bfdcf<_0x163acf[_0xaa93('0x3a')]['length'];_0x5bfdcf++){var _0x140cb3=_0x163acf[_0xaa93('0x3a')][_0x5bfdcf];_0x3f7705[_0xaa93('0x1c')][_0xaa93('0x1f')][_0xaa93('0x29')]({'filename':_0x140cb3[_0xaa93('0x3b')],'content':Buffer[_0xaa93('0x2e')](_0x140cb3[_0xaa93('0x3c')])});}}}_0x7c463a(parseEmail(_0x242d7a,_0x59d92e,_0x3f7705));});}else{_0x59d92e['html']=_0xaa93('0x39');_0x7c463a(parseEmail(_0x242d7a,_0x59d92e,_0x3f7705));}}else{_0x7c463a(parseEmail(_0x242d7a,_0x59d92e,_0x3f7705));}};exports[_0xaa93('0x3d')]=function(_0x43e476){switch(_0x43e476){case _0xaa93('0x3e'):return _0xaa93('0x3f');case _0xaa93('0x40'):return'imap.mail.yahoo.com';case _0xaa93('0x41'):return _0xaa93('0x42');case _0xaa93('0x43'):return _0xaa93('0x44');}return'127.0.0.1';}; \ No newline at end of file +var _0x2cf5=['\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Data','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','path','node-tnef','../../../config/logger','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','isEmpty','html','test','replace','includes','0x1?_0x54806d[_0x52cf('0x10')](0x0,-0x1)[_0x52cf('0x11')]('\x20'):_0x17e1b0[_0x52cf('0xb')];}return'Anonymous';}function getLastName(_0x4a5547){var _0x2bff22=_[_0x52cf('0x5')](_0x4a5547[_0x52cf('0x6')]);if(_0x2bff22&&_0x2bff22[_0x52cf('0xb')]){var _0x294b83=_0x2bff22[_0x52cf('0xb')][_0x52cf('0xe')](/\s+/);return _0x294b83[_0x52cf('0xf')]>0x1?_0x294b83['pop']():'';}return'';}function getMails(_0x3c6283,_0x3a2492){var _0x31099e='';for(var _0x580154=0x0;_0x580154<_0x3a2492[_0x52cf('0x6')]['length'];_0x580154+=0x1){if(_0x3a2492[_0x52cf('0x6')][_0x580154][_0x52cf('0x7')]!==_0x3c6283){if(!_[_0x52cf('0x12')](_0x31099e)){_0x31099e+=',';}_0x31099e+=_0x3a2492[_0x52cf('0x6')][_0x580154]['name']||_0x3a2492[_0x52cf('0x6')][_0x580154][_0x52cf('0x7')]||'';_0x31099e+='\x20<';_0x31099e+=_0x3a2492[_0x52cf('0x6')][_0x580154][_0x52cf('0x7')]?_0x3a2492['value'][_0x580154][_0x52cf('0x7')]:'anonymous'+random[_0x52cf('0x9')](0x6)+_0x52cf('0xa');_0x31099e+='>';}}return _0x31099e;}function parseEmail(_0x2d3edf,_0x556e07,_0x538a28){if(_0x556e07[_0x52cf('0x13')]){var _0x32abd7=/)<[^<]*)*<\/script>/gi;while(_0x32abd7[_0x52cf('0x14')](_0x556e07[_0x52cf('0x13')])){_0x556e07[_0x52cf('0x13')]=_0x556e07[_0x52cf('0x13')][_0x52cf('0x15')](_0x32abd7,'');}if(_0x556e07[_0x52cf('0x13')][_0x52cf('0x16')](_0x52cf('0x17'))){var _0x57e910=[];_0x556e07['attachments'][_0x52cf('0x18')](_0x122817=>{_0x57e910[_0x52cf('0x19')](_0x122817[_0x52cf('0x1a')]);});var _0x499ac7=/]+>/g;var _0x47a610=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x40eec3=_0x556e07[_0x52cf('0x13')][_0x52cf('0x15')](_0x47a610,_0x52cf('0x1b'));var _0x42132c=_0x40eec3[_0x52cf('0x15')](_0x499ac7,_0x52cf('0x1c'));for(let _0x1f6b75=0x0;_0x1f6b75<_0x57e910[_0x52cf('0xf')];_0x1f6b75++){var _0x4cc1d4=_0x42132c['replace'](_0x52cf('0x1c'),_0x52cf('0x1d')+_0x57e910[_0x1f6b75]+_0x52cf('0x1e'));_0x42132c=_0x4cc1d4;}_0x556e07[_0x52cf('0x13')]=_0x42132c;}_0x538a28['body']=_0x556e07[_0x52cf('0x13')];}else{_0x538a28[_0x52cf('0x1f')]=_0x556e07[_0x52cf('0x20')];}if(_0x538a28[_0x52cf('0x1f')]){_0x538a28[_0x52cf('0x1f')]=_0x538a28[_0x52cf('0x1f')]['replace'](/0x0){var _0x20ca56=[_0x52cf('0x32'),_0x52cf('0x33'),_0x52cf('0x34')];for(var _0x4375ae=0x0;_0x4375ae<_0x556e07[_0x52cf('0x31')][_0x52cf('0xf')];_0x4375ae++){var _0x55f081=_[_0x52cf('0xd')](_0x20ca56,_0x556e07['headerLines'][_0x4375ae][_0x52cf('0x35')]);if(_0x55f081>=0x0){_0x538a28['isAutoreply']=!![];}}}return _0x538a28;}exports[_0x52cf('0x36')]=function(_0x160d32,_0x4e2f99,_0x25e084){var _0x4a49f0={'from':getAddress(_0x4e2f99[_0x52cf('0x37')]),'firstName':getFirstName(_0x4e2f99[_0x52cf('0x37')]),'lastName':getLastName(_0x4e2f99[_0x52cf('0x37')]),'mapKey':'email','message':{'from':getMails(_0x160d32[_0x52cf('0x25')],_0x4e2f99['from']),'to':_0x160d32['email'],'cc':'','subject':_0x4e2f99['subject']||'','messageId':_0x4e2f99['messageId'],'inReplyTo':_0x4e2f99['inReplyTo'],'sentAt':moment(_0x4e2f99[_0x52cf('0x38')])[_0x52cf('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4e2f99[_0x52cf('0x13')]&&!_0x4e2f99[_0x52cf('0x20')]){var _0x39b56a=_[_0x52cf('0x3a')](_0x4e2f99[_0x52cf('0x27')],{'contentType':'application/ms-tnef'});if(_0x39b56a[_0x52cf('0xf')]){logger[_0x52cf('0x3b')](util[_0x52cf('0x39')](_0x52cf('0x3c'),_0x4e2f99[_0x52cf('0x3d')]));tnef['parseBuffer'](_[_0x52cf('0x3e')](_0x39b56a)[_0x52cf('0x2f')],function(_0x51ca3e,_0x44c324){if(_0x44c324){_0x4e2f99['html']=_0x44c324[_0x52cf('0x3f')]||_0x52cf('0x40');if(_0x44c324[_0x52cf('0x41')]){for(var _0x476085=0x0;_0x476085<_0x44c324[_0x52cf('0x41')][_0x52cf('0xf')];_0x476085++){var _0x43acf8=_0x44c324['Attachments'][_0x476085];_0x4a49f0['message']['attachments'][_0x52cf('0x19')]({'filename':_0x43acf8['Title'],'content':Buffer['from'](_0x43acf8[_0x52cf('0x42')])});}}}_0x25e084(parseEmail(_0x160d32,_0x4e2f99,_0x4a49f0));});}else{_0x4e2f99[_0x52cf('0x13')]='

Empty\x20message

';_0x25e084(parseEmail(_0x160d32,_0x4e2f99,_0x4a49f0));}}else{_0x25e084(parseEmail(_0x160d32,_0x4e2f99,_0x4a49f0));}};exports['getHost']=function(_0x30f142){switch(_0x30f142){case _0x52cf('0x43'):return _0x52cf('0x44');case'yahoo':return _0x52cf('0x45');case _0x52cf('0x46'):return _0x52cf('0x47');case _0x52cf('0x48'):return _0x52cf('0x49');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 47c187f..68b83fb 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 _0x3d5a=['Smtp','exports','lodash','name','Service','key','SERV','Imap'];(function(_0x59ad60,_0x526caa){var _0x10ea96=function(_0x2261a7){while(--_0x2261a7){_0x59ad60['push'](_0x59ad60['shift']());}};_0x10ea96(++_0x526caa);}(_0x3d5a,0x10a));var _0xa3d5=function(_0xf427da,_0x2ed980){_0xf427da=_0xf427da-0x0;var _0x2408e9=_0x3d5a[_0xf427da];return _0x2408e9;};'use strict';var _=require(_0xa3d5('0x0'));function MailAccount(_0x55e17c){this['id']=_0x55e17c['id']||0x0;this[_0xa3d5('0x1')]=_0x55e17c[_0xa3d5('0x1')]||_0xa3d5('0x2');this[_0xa3d5('0x3')]=_0x55e17c[_0xa3d5('0x3')]||_0xa3d5('0x4');this['active']=_0x55e17c['active']||![];this[_0xa3d5('0x5')]=_0x55e17c[_0xa3d5('0x5')]||[];this[_0xa3d5('0x6')]=_0x55e17c[_0xa3d5('0x6')]||[];}module[_0xa3d5('0x7')]=MailAccount; \ No newline at end of file +var _0xf92d=['Service','key','SERV','Imap','Smtp','exports','lodash','name'];(function(_0x264747,_0x4569f4){var _0x47c3be=function(_0x2bfe6d){while(--_0x2bfe6d){_0x264747['push'](_0x264747['shift']());}};_0x47c3be(++_0x4569f4);}(_0xf92d,0x13e));var _0xdf92=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xf92d[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xdf92('0x0'));function MailAccount(_0x365507){this['id']=_0x365507['id']||0x0;this[_0xdf92('0x1')]=_0x365507['name']||_0xdf92('0x2');this[_0xdf92('0x3')]=_0x365507[_0xdf92('0x3')]||_0xdf92('0x4');this['active']=_0x365507['active']||![];this[_0xdf92('0x5')]=_0x365507['Imap']||[];this[_0xdf92('0x6')]=_0x365507[_0xdf92('0x6')]||[];}module[_0xdf92('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 8037b10..fdb332e 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 _0xe6b1=['merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined'];(function(_0x7a29b7,_0x2e44fe){var _0x3bdfdf=function(_0x4927a4){while(--_0x4927a4){_0x7a29b7['push'](_0x7a29b7['shift']());}};_0x3bdfdf(++_0x2e44fe);}(_0xe6b1,0xde));var _0x1e6b=function(_0x2e0e8e,_0x8c261c){_0x2e0e8e=_0x2e0e8e-0x0;var _0x460e9c=_0xe6b1[_0x2e0e8e];return _0x460e9c;};'use strict';var _=require(_0x1e6b('0x0'));var MailAccount=require(_0x1e6b('0x1'));var Realtime=function(){this[_0x1e6b('0x2')]={};};function freeIsNotKey(_0x5e0c42,_0x38fac1,_0x4cb940){var _0x5ce30e=_[_0x1e6b('0x3')](_0x5e0c42,function(_0x1198eb,_0x44000e){return _0x1198eb[_0x4cb940];});for(var _0x547b8b in _0x38fac1){if(_0x38fac1['hasOwnProperty'](_0x547b8b)){if(!_0x5ce30e[_0x547b8b]){delete _0x38fac1[_0x547b8b];}}}}Realtime[_0x1e6b('0x4')][_0x1e6b('0x5')]=function(_0x3df9ae,_0x210588){for(var _0x2b6a5f in _0x210588){if(_0x3df9ae['hasOwnProperty'](_0x2b6a5f)){_0x3df9ae[_0x2b6a5f]=_0x210588[_0x2b6a5f];}}};Realtime[_0x1e6b('0x4')][_0x1e6b('0x6')]=function(){var _0x184443=this;return function(_0x3a9617){if(_0x3a9617){freeIsNotKey(_0x3a9617,_0x184443[_0x1e6b('0x2')],'id');for(var _0x5332de=0x0,_0x2995f5={},_0x56c648={};_0x5332de<_0x3a9617[_0x1e6b('0x7')];_0x5332de+=0x1){_0x2995f5=_0x3a9617[_0x5332de];if(_[_0x1e6b('0x8')](_0x184443[_0x1e6b('0x2')][_0x2995f5['id']])){_0x184443[_0x1e6b('0x2')][_0x2995f5['id']]=new MailAccount(_0x2995f5);}else{_[_0x1e6b('0x9')](_0x184443['mailAccounts'][_0x2995f5['id']],_0x2995f5);}}}return _0x184443[_0x1e6b('0x2')];};};module[_0x1e6b('0xa')]=Realtime; \ No newline at end of file +var _0x861e=['isUndefined','merge','exports','lodash','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length'];(function(_0x45c8d8,_0x432aa9){var _0x355fa0=function(_0xb13007){while(--_0xb13007){_0x45c8d8['push'](_0x45c8d8['shift']());}};_0x355fa0(++_0x432aa9);}(_0x861e,0x12f));var _0xe861=function(_0x58be73,_0x2118fc){_0x58be73=_0x58be73-0x0;var _0x28c3f1=_0x861e[_0x58be73];return _0x28c3f1;};'use strict';var _=require(_0xe861('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xe861('0x1')]={};};function freeIsNotKey(_0x23d734,_0x3e2375,_0x5537c5){var _0x1d02df=_[_0xe861('0x2')](_0x23d734,function(_0x11d26c,_0x3ee004){return _0x11d26c[_0x5537c5];});for(var _0x2e2c94 in _0x3e2375){if(_0x3e2375['hasOwnProperty'](_0x2e2c94)){if(!_0x1d02df[_0x2e2c94]){delete _0x3e2375[_0x2e2c94];}}}}Realtime[_0xe861('0x3')][_0xe861('0x4')]=function(_0x3ea6cc,_0x37020f){for(var _0x3f10de in _0x37020f){if(_0x3ea6cc[_0xe861('0x5')](_0x3f10de)){_0x3ea6cc[_0x3f10de]=_0x37020f[_0x3f10de];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x3219bf=this;return function(_0x11ae3c){if(_0x11ae3c){freeIsNotKey(_0x11ae3c,_0x3219bf[_0xe861('0x1')],'id');for(var _0x1f4eac=0x0,_0x14d677={},_0x5514d2={};_0x1f4eac<_0x11ae3c[_0xe861('0x6')];_0x1f4eac+=0x1){_0x14d677=_0x11ae3c[_0x1f4eac];if(_[_0xe861('0x7')](_0x3219bf[_0xe861('0x1')][_0x14d677['id']])){_0x3219bf[_0xe861('0x1')][_0x14d677['id']]=new MailAccount(_0x14d677);}else{_[_0xe861('0x8')](_0x3219bf[_0xe861('0x1')][_0x14d677['id']],_0x14d677);}}}return _0x3219bf[_0xe861('0x1')];};};module[_0xe861('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 268f0a8..0a4888c 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 _0xdc9e=['service','email','active','TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request'];(function(_0x3175d2,_0x2053e8){var _0x33b306=function(_0x546220){while(--_0x546220){_0x3175d2['push'](_0x3175d2['shift']());}};_0x33b306(++_0x2053e8);}(_0xdc9e,0x76));var _0xedc9=function(_0x2c9268,_0x10e7bf){_0x2c9268=_0x2c9268-0x0;var _0x429be3=_0xdc9e[_0x2c9268];return _0x429be3;};'use strict';var client=require('../client');exports[_0xedc9('0x0')]=function(){return function(){return client[_0xedc9('0x1')]('GetMailAccount',{'options':{'attributes':['id','name',_0xedc9('0x2'),_0xedc9('0x3'),_0xedc9('0x4'),'key','ListId',_0xedc9('0x5')],'raw':![],'include':[{'model':_0xedc9('0x6'),'as':_0xedc9('0x7')},{'model':'MailServerOut','as':_0xedc9('0x8')}]},'log':_0xedc9('0x9')});};};exports[_0xedc9('0xa')]=function(_0x335de4,_0x1e727d){return client['Request']('NotifyMailAccount',{'account':{'id':_0x335de4},'body':_0x1e727d,'log':_0xedc9('0xb')});}; \ No newline at end of file +var _0xfd2e=['../client','Request','name','email','active','key','ListId','TemplateId','MailServerOut','notify','NotifyMailAccount'];(function(_0x4ed9c9,_0x1b9648){var _0x591fc0=function(_0x11c379){while(--_0x11c379){_0x4ed9c9['push'](_0x4ed9c9['shift']());}};_0x591fc0(++_0x1b9648);}(_0xfd2e,0x6e));var _0xefd2=function(_0xcfd9d,_0x51f18e){_0xcfd9d=_0xcfd9d-0x0;var _0x595c5f=_0xfd2e[_0xcfd9d];return _0x595c5f;};'use strict';var client=require(_0xefd2('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xefd2('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0xefd2('0x2'),'service',_0xefd2('0x3'),_0xefd2('0x4'),_0xefd2('0x5'),_0xefd2('0x6'),_0xefd2('0x7')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap'},{'model':_0xefd2('0x8'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0xefd2('0x9')]=function(_0x50dd63,_0x440d11){return client[_0xefd2('0x1')](_0xefd2('0xa'),{'account':{'id':_0x50dd63},'body':_0x440d11,'log':_0xefd2('0xa')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9f68aed..5b3b8c0 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 _0xd305=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x5d9dc4,_0x3385c6){var _0x490164=function(_0xda2c5b){while(--_0xda2c5b){_0x5d9dc4['push'](_0x5d9dc4['shift']());}};_0x490164(++_0x3385c6);}(_0xd305,0x165));var _0x5d30=function(_0x4690f1,_0x10f22f){_0x4690f1=_0x4690f1-0x0;var _0x5c2b55=_0xd305[_0x4690f1];return _0x5c2b55;};'use strict';var client=require(_0x5d30('0x0'));exports[_0x5d30('0x1')]=function(){return client[_0x5d30('0x2')](_0x5d30('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5d30('0x4')]},'log':_0x5d30('0x5')});}; \ No newline at end of file +var _0x1fa4=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x50aae2,_0x437f60){var _0x6fc938=function(_0x3bc8ca){while(--_0x3bc8ca){_0x50aae2['push'](_0x50aae2['shift']());}};_0x6fc938(++_0x437f60);}(_0x1fa4,0x1bc));var _0x41fa=function(_0x3a8897,_0x259a0a){_0x3a8897=_0x3a8897-0x0;var _0x1ebf21=_0x1fa4[_0x3a8897];return _0x1ebf21;};'use strict';var client=require(_0x41fa('0x0'));exports[_0x41fa('0x1')]=function(){return client['Request'](_0x41fa('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x41fa('0x3')]},'log':_0x41fa('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 9cb0ed5..d6dea78 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 7668d14..c7d056e 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 _0xfff5=['default','../../config/socketio','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers'];(function(_0x22ef9f,_0x431ba5){var _0xc03655=function(_0x360970){while(--_0x360970){_0x22ef9f['push'](_0x22ef9f['shift']());}};_0xc03655(++_0x431ba5);}(_0xfff5,0x167));var _0x5fff=function(_0x37feef,_0xefd821){_0x37feef=_0x37feef-0x0;var _0xc4622b=_0xfff5[_0x37feef];return _0xc4622b;};'use strict';var _=require(_0x5fff('0x0'));var http=require(_0x5fff('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x5fff('0x2'));var config=require(_0x5fff('0x3'));var app=express();var server=http[_0x5fff('0x4')](app);server[_0x5fff('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0x5fff('0x6')])){var socketio=require(_0x5fff('0x7'))(server,{'transports':[_0x5fff('0x8'),_0x5fff('0x9')]});config[_0x5fff('0xa')]=_[_0x5fff('0xb')](config[_0x5fff('0xa')],{'host':_0x5fff('0xc'),'port':0x18eb});socketio['adapter'](require(_0x5fff('0xd'))({'pubClient':new Redis(config[_0x5fff('0xa')]),'subClient':new Redis(config[_0x5fff('0xa')])}));require(_0x5fff('0xe'))[_0x5fff('0xf')]();require(_0x5fff('0x10'))[_0x5fff('0xf')](socketio);require('../../config/express')[_0x5fff('0xf')](app);require(_0x5fff('0x11'))[_0x5fff('0xf')](app);}else{server[_0x5fff('0x12')]('listening',function(){console[_0x5fff('0x13')](_0x5fff('0x14'),config[_0x5fff('0x6')]);});}exports=module[_0x5fff('0x15')]=app; \ No newline at end of file +var _0x5d4c=['default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','ioredis','../../config/environment','timeout','listen','socket.io','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers'];(function(_0x2b4f64,_0x5508b8){var _0x4bb12c=function(_0x40332a){while(--_0x40332a){_0x2b4f64['push'](_0x2b4f64['shift']());}};_0x4bb12c(++_0x5508b8);}(_0x5d4c,0x195));var _0xc5d4=function(_0x304ab3,_0x593ab3){_0x304ab3=_0x304ab3-0x0;var _0x44a9cc=_0x5d4c[_0x304ab3];return _0x44a9cc;};'use strict';var _=require(_0xc5d4('0x0'));var http=require('http');var express=require(_0xc5d4('0x1'));var sticky=require('sticky-session');var Redis=require(_0xc5d4('0x2'));var config=require(_0xc5d4('0x3'));var app=express();var server=http['createServer'](app);server[_0xc5d4('0x4')]=0xdbba0;if(sticky[_0xc5d4('0x5')](server,config['port'])){var socketio=require(_0xc5d4('0x6'))(server,{'transports':['websocket',_0xc5d4('0x7')]});config[_0xc5d4('0x8')]=_[_0xc5d4('0x9')](config['redis'],{'host':_0xc5d4('0xa'),'port':0x18eb});socketio['adapter'](require(_0xc5d4('0xb'))({'pubClient':new Redis(config[_0xc5d4('0x8')]),'subClient':new Redis(config[_0xc5d4('0x8')])}));require(_0xc5d4('0xc'))[_0xc5d4('0xd')]();require('../../config/socketio')[_0xc5d4('0xd')](socketio);require(_0xc5d4('0xe'))[_0xc5d4('0xd')](app);require(_0xc5d4('0xf'))[_0xc5d4('0xd')](app);}else{server[_0xc5d4('0x10')](_0xc5d4('0x11'),function(){console[_0xc5d4('0x12')](_0xc5d4('0x13'),config[_0xc5d4('0x14')]);});}exports=module[_0xc5d4('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 213fa84..58b70be 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 _0xd926=['then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x4024ca,_0x318053){var _0x489730=function(_0x5273b8){while(--_0x5273b8){_0x4024ca['push'](_0x4024ca['shift']());}};_0x489730(++_0x318053);}(_0xd926,0xcb));var _0x6d92=function(_0x56be74,_0x207a86){_0x56be74=_0x56be74-0x0;var _0x5c22af=_0xd926[_0x56be74];return _0x5c22af;};'use strict';var jayson=require(_0x6d92('0x0'));var BPromise=require(_0x6d92('0x1'));var logger=require(_0x6d92('0x2'))(_0x6d92('0x3'));var client=jayson[_0x6d92('0x4')][_0x6d92('0x5')]({'port':0x2329});client[_0x6d92('0x6')]=function(_0x1ea4b4,_0x3b957d){return new BPromise(function(_0x21fac7,_0x4189df){return client['request'](_0x1ea4b4,_0x3b957d)[_0x6d92('0x7')](function(_0x1f680a){logger[_0x6d92('0x8')](_0x6d92('0x9'),'routing',_0x1ea4b4,_0x3b957d,_0x1f680a);if(_0x1f680a[_0x6d92('0xa')]){logger[_0x6d92('0xa')](_0x6d92('0x9'),_0x6d92('0x3'),_0x1ea4b4,_0x1f680a['error'][_0x6d92('0xb')],_0x3b957d);return _0x4189df(_0x1f680a[_0x6d92('0xa')][_0x6d92('0xb')]);}else{return _0x21fac7(_0x1f680a[_0x6d92('0xc')]);}})[_0x6d92('0xd')](function(_0xc151cc){logger['error'](_0x6d92('0x9'),_0x6d92('0x3'),_0x1ea4b4,_0xc151cc,_0x3b957d);return _0x4189df(_0xc151cc);});});};module[_0x6d92('0xe')]=client; \ No newline at end of file +var _0xc76d=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc76d,0x1b3));var _0xdc76=function(_0x170cbb,_0x9093e){_0x170cbb=_0x170cbb-0x0;var _0x39fae4=_0xc76d[_0x170cbb];return _0x39fae4;};'use strict';var jayson=require(_0xdc76('0x0'));var BPromise=require(_0xdc76('0x1'));var logger=require(_0xdc76('0x2'))(_0xdc76('0x3'));var client=jayson[_0xdc76('0x4')][_0xdc76('0x5')]({'port':0x2329});client[_0xdc76('0x6')]=function(_0x28c3d9,_0x3ed724){return new BPromise(function(_0x195346,_0x1f77ba){return client[_0xdc76('0x7')](_0x28c3d9,_0x3ed724)[_0xdc76('0x8')](function(_0xf66155){logger[_0xdc76('0x9')](_0xdc76('0xa'),_0xdc76('0x3'),_0x28c3d9,_0x3ed724,_0xf66155);if(_0xf66155[_0xdc76('0xb')]){logger[_0xdc76('0xb')](_0xdc76('0xa'),_0xdc76('0x3'),_0x28c3d9,_0xf66155['error'][_0xdc76('0xc')],_0x3ed724);return _0x1f77ba(_0xf66155['error']['message']);}else{return _0x195346(_0xf66155[_0xdc76('0xd')]);}})['catch'](function(_0xc0482a){logger['error'](_0xdc76('0xa'),_0xdc76('0x3'),_0x28c3d9,_0xc0482a,_0x3ed724);return _0x1f77ba(_0xc0482a);});});};module[_0xdc76('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index fa44b55..6cb60c5 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 _0x5c29=['./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x3c762b,_0x356aaa){var _0x3a6ee3=function(_0x24cec6){while(--_0x24cec6){_0x3c762b['push'](_0x3c762b['shift']());}};_0x3a6ee3(++_0x356aaa);}(_0x5c29,0x1f3));var _0x95c2=function(_0x172395,_0x589008){_0x172395=_0x172395-0x0;var _0x31dd4b=_0x5c29[_0x172395];return _0x31dd4b;};'use strict';var BPromise=require(_0x95c2('0x0'));var server=require(_0x95c2('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0x95c2('0x2'));var chatQueue=require(_0x95c2('0x3'));var smsQueue=require(_0x95c2('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x95c2('0x5'));var whatsappQueue=require(_0x95c2('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x95c2('0x7')]()[_0x95c2('0x8')](user[_0x95c2('0x9')]())['then'](realtime['initAgents']())[_0x95c2('0x8')](interval['getIntervals']())[_0x95c2('0x8')](realtime['initIntervals']())[_0x95c2('0x8')](openchannelQueue[_0x95c2('0xa')]())['then'](realtime[_0x95c2('0xb')]())[_0x95c2('0x8')](chatQueue[_0x95c2('0xc')]())[_0x95c2('0x8')](realtime['initChatQueues']())[_0x95c2('0x8')](smsQueue[_0x95c2('0xd')]())[_0x95c2('0x8')](realtime['initSmsQueues']())[_0x95c2('0x8')](mailQueue[_0x95c2('0xe')]())['then'](realtime[_0x95c2('0xf')]())[_0x95c2('0x8')](faxQueue['getFaxQueues']())['then'](realtime[_0x95c2('0x10')]())[_0x95c2('0x8')](whatsappQueue[_0x95c2('0x11')]())[_0x95c2('0x8')](realtime[_0x95c2('0x12')]())[_0x95c2('0x8')](function(){return realtime;});}function main(){return server[_0x95c2('0x13')](realtime)[_0x95c2('0x8')](function(_0x10f61e){return initRealtime();})[_0x95c2('0x8')](function(_0xa27144){return setInterval(initRealtime,0x1388);})[_0x95c2('0x14')](function(_0x441cea){console['log'](_0x441cea);});}main(); \ No newline at end of file +var _0xe618=['initIntervals','getOpenchannelQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents'];(function(_0x3e9364,_0x4620e5){var _0xb837f1=function(_0x161062){while(--_0x161062){_0x3e9364['push'](_0x3e9364['shift']());}};_0xb837f1(++_0x4620e5);}(_0xe618,0x17b));var _0x8e61=function(_0x4601f3,_0x4d2401){_0x4601f3=_0x4601f3-0x0;var _0x2afb49=_0xe618[_0x4601f3];return _0x2afb49;};'use strict';var BPromise=require('bluebird');var server=require(_0x8e61('0x0'));var Realtime=require('./realtime');var user=require(_0x8e61('0x1'));var interval=require(_0x8e61('0x2'));var openchannelQueue=require(_0x8e61('0x3'));var chatQueue=require(_0x8e61('0x4'));var smsQueue=require(_0x8e61('0x5'));var mailQueue=require(_0x8e61('0x6'));var faxQueue=require(_0x8e61('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x8e61('0x8')]()[_0x8e61('0x9')](user[_0x8e61('0xa')]())[_0x8e61('0x9')](realtime[_0x8e61('0xb')]())[_0x8e61('0x9')](interval['getIntervals']())[_0x8e61('0x9')](realtime[_0x8e61('0xc')]())[_0x8e61('0x9')](openchannelQueue[_0x8e61('0xd')]())[_0x8e61('0x9')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())[_0x8e61('0x9')](realtime['initChatQueues']())[_0x8e61('0x9')](smsQueue[_0x8e61('0xe')]())[_0x8e61('0x9')](realtime['initSmsQueues']())['then'](mailQueue[_0x8e61('0xf')]())[_0x8e61('0x9')](realtime[_0x8e61('0x10')]())[_0x8e61('0x9')](faxQueue[_0x8e61('0x11')]())[_0x8e61('0x9')](realtime[_0x8e61('0x12')]())[_0x8e61('0x9')](whatsappQueue[_0x8e61('0x13')]())[_0x8e61('0x9')](realtime['initWhatsappQueues']())[_0x8e61('0x9')](function(){return realtime;});}function main(){return server[_0x8e61('0x14')](realtime)[_0x8e61('0x9')](function(_0x2cd741){return initRealtime();})['then'](function(_0x46a538){return setInterval(initRealtime,0x1388);})[_0x8e61('0x15')](function(_0x3a93ea){console[_0x8e61('0x16')](_0x3a93ea);});}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 7846e3b..3d35c59 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x871ef5,_0x58880b){var _0x1f62ea=function(_0x13934c){while(--_0x13934c){_0x871ef5['push'](_0x871ef5['shift']());}};_0x1f62ea(++_0x58880b);}(_0x326f,0xd1));var _0xf326=function(_0x3c6d92,_0x5d72e7){_0x3c6d92=_0x3c6d92-0x0;var _0x287ca8=_0x326f[_0x3c6d92];return _0x287ca8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x411871,_0x3f6641){var _0x2ab4fc=function(_0x5c6919){while(--_0x5c6919){_0x411871['push'](_0x411871['shift']());}};_0x2ab4fc(++_0x3f6641);}(_0x5fc3,0xa8));var _0x35fc=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x5fc3[_0x506d2f];return _0x101255;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index fbd8482..405b6d1 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 _0xa2b0=['error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2b0,0x131));var _0x0a2b=function(_0x5dbcf8,_0x474412){_0x5dbcf8=_0x5dbcf8-0x0;var _0xaa762a=_0xa2b0[_0x5dbcf8];return _0xaa762a;};'use strict';var BPromise=require(_0x0a2b('0x0'));var jayson=require(_0x0a2b('0x1'));var client=jayson[_0x0a2b('0x2')][_0x0a2b('0x3')]({'port':0x232b});function request(_0x417152,_0x5ed92e){return new BPromise(function(_0x2e7a86,_0x5a05d1){return client['request'](_0x417152,_0x5ed92e)[_0x0a2b('0x4')](function(_0x1b63fd){if(_0x1b63fd[_0x0a2b('0x5')]){return _0x5a05d1(_0x1b63fd[_0x0a2b('0x5')]['message']);}else{return _0x2e7a86(_0x1b63fd[_0x0a2b('0x6')]);}})[_0x0a2b('0x7')](function(_0x2d80a9){return _0x5a05d1(_0x2d80a9);});});}exports[_0x0a2b('0x8')]=function(_0xe977bb,_0x25d778){return request(_0x0a2b('0x9'),{'account':_0xe977bb,'message':_0x25d778});}; \ No newline at end of file +var _0xe604=['SendMail','bluebird','jayson/promise','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe604,0x7a));var _0x4e60=function(_0x3d67f5,_0x45379f){_0x3d67f5=_0x3d67f5-0x0;var _0x225ce9=_0xe604[_0x3d67f5];return _0x225ce9;};'use strict';var BPromise=require(_0x4e60('0x0'));var jayson=require(_0x4e60('0x1'));var client=jayson['client'][_0x4e60('0x2')]({'port':0x232b});function request(_0x3a4677,_0x30e7ce){return new BPromise(function(_0x43b8ae,_0x2a3517){return client[_0x4e60('0x3')](_0x3a4677,_0x30e7ce)[_0x4e60('0x4')](function(_0x170b37){if(_0x170b37[_0x4e60('0x5')]){return _0x2a3517(_0x170b37[_0x4e60('0x5')][_0x4e60('0x6')]);}else{return _0x43b8ae(_0x170b37[_0x4e60('0x7')]);}})[_0x4e60('0x8')](function(_0x20a36e){return _0x2a3517(_0x20a36e);});});}exports[_0x4e60('0x9')]=function(_0xf2b757,_0xb563cd){return request(_0x4e60('0xa'),{'account':_0xf2b757,'message':_0xb563cd});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 454911b..0d60e52 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 _0x9e63=['mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','unknown','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','whatsapp','Status','StatusTime','format','faxStatus','openchannelStatusTime','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x9e63,0x65));var _0x39e6=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x9e63[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x39e6('0x0'));var moment=require(_0x39e6('0x1'));var md5=require(_0x39e6('0x2'));var Redis=require('ioredis');var config=require(_0x39e6('0x3'));config[_0x39e6('0x4')]=_[_0x39e6('0x5')](config[_0x39e6('0x4')],{'host':_0x39e6('0x6'),'port':0x18eb});var io=require(_0x39e6('0x7'))(new Redis(config[_0x39e6('0x4')]));function Agent(_0x15f77c){this['id']=_0x15f77c['id']||0x0;this['name']=_0x15f77c[_0x39e6('0x8')]||'';this[_0x39e6('0x9')]=_0x15f77c[_0x39e6('0x9')]||!![];this['voicePause']=_0x15f77c[_0x39e6('0xa')]||![];this[_0x39e6('0xb')]=_0x15f77c['chatPause']||![];this[_0x39e6('0xc')]=_0x15f77c['mailPause']||![];this['faxPause']=_0x15f77c[_0x39e6('0xd')]||![];this[_0x39e6('0xe')]=_0x15f77c[_0x39e6('0xe')]||![];this[_0x39e6('0xf')]=_0x15f77c[_0x39e6('0xf')]||![];this['chatStatus']='unknown';this[_0x39e6('0x10')]=0x0;this[_0x39e6('0x11')]=_0x15f77c[_0x39e6('0x11')]||0x0;this[_0x39e6('0x12')]=0x0;this[_0x39e6('0x13')]='unknown';this[_0x39e6('0x14')]=0x0;this[_0x39e6('0x15')]=_0x15f77c[_0x39e6('0x15')]||0x0;this[_0x39e6('0x16')]=0x0;this['faxStatus']='unknown';this[_0x39e6('0x17')]=0x0;this[_0x39e6('0x18')]=_0x15f77c[_0x39e6('0x18')]||0x0;this[_0x39e6('0x19')]=0x0;this[_0x39e6('0x1a')]='unknown';this[_0x39e6('0x1b')]=0x0;this[_0x39e6('0x1c')]=_0x15f77c[_0x39e6('0x1c')]||0x0;this[_0x39e6('0x1d')]=0x0;this[_0x39e6('0x1e')]=_0x39e6('0x1f');this[_0x39e6('0x20')]=0x0;this['whatsappCapacity']=_0x15f77c[_0x39e6('0x21')]||0x0;this[_0x39e6('0x22')]=0x0;this[_0x39e6('0x23')]='unknown';this['openchannelStatusTime']=0x0;this[_0x39e6('0x24')]=_0x15f77c[_0x39e6('0x24')]||0x0;this[_0x39e6('0x25')]=0x0;this[_0x39e6('0x26')]=![];this[_0x39e6('0x27')]=undefined;this['md5']='';this[_0x39e6('0x28')]();}Agent['prototype'][_0x39e6('0x29')]=function(_0x3f1f6e){if(this[_0x3f1f6e+'CurrentCapacity']>0x0){if(this[_0x3f1f6e+_0x39e6('0x2a')]>0x0&&this[_0x3f1f6e+_0x39e6('0x2b')]>=this[_0x3f1f6e+_0x39e6('0x2a')]){return _0x39e6('0x2c');}else{return _0x39e6('0x2d');}}else{return _0x39e6('0x2e');}};Agent[_0x39e6('0x2f')][_0x39e6('0x28')]=function(){var _0x302f77=[_0x39e6('0x30'),_0x39e6('0x31'),_0x39e6('0x32'),_0x39e6('0x33'),'sms',_0x39e6('0x34')];for(var _0x5e45cd=0x0;_0x5e45cd<_0x302f77['length'];_0x5e45cd+=0x1){var _0x48fdb=this[_0x39e6('0x29')](_0x302f77[_0x5e45cd]);if(this[_0x302f77[_0x5e45cd]+_0x39e6('0x35')]!==_0x48fdb){this[_0x302f77[_0x5e45cd]+_0x39e6('0x36')]=_['toNumber'](moment()[_0x39e6('0x37')]('x'));}this[_0x302f77[_0x5e45cd]+_0x39e6('0x35')]=_0x48fdb;}var _0x59ea28={'id':this['id'],'name':this[_0x39e6('0x8')],'online':this[_0x39e6('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x39e6('0xb')],'mailPause':this[_0x39e6('0xc')],'smsPause':this[_0x39e6('0xe')],'faxPause':this[_0x39e6('0xd')],'openchannelPause':this[_0x39e6('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x39e6('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x39e6('0x12')],'mailStatus':this[_0x39e6('0x13')],'mailStatusTime':this[_0x39e6('0x14')],'mailCapacity':this[_0x39e6('0x15')],'mailCurrentCapacity':this[_0x39e6('0x16')],'faxStatus':this[_0x39e6('0x38')],'faxStatusTime':this[_0x39e6('0x17')],'faxCapacity':this[_0x39e6('0x18')],'faxCurrentCapacity':this[_0x39e6('0x19')],'smsStatus':this[_0x39e6('0x1a')],'smsStatusTime':this[_0x39e6('0x1b')],'smsCapacity':this[_0x39e6('0x1c')],'smsCurrentCapacity':this[_0x39e6('0x1d')],'whatsappStatus':this[_0x39e6('0x1e')],'whatsappStatusTime':this[_0x39e6('0x20')],'whatsappCapacity':this[_0x39e6('0x21')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x39e6('0x23')],'openchannelStatusTime':this[_0x39e6('0x39')],'openchannelCapacity':this[_0x39e6('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x39e6('0x26')],'busyQueue':this[_0x39e6('0x27')]};var _0x20d48c=md5(JSON['stringify'](_0x59ea28));if(this[_0x39e6('0x2')]!==_0x20d48c){this['md5']=_0x20d48c;io[_0x39e6('0x3a')](_0x39e6('0x3b'),_0x59ea28);}};module[_0x39e6('0x3c')]=Agent; \ No newline at end of file +var _0x72f6=['smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','working','idle','mail','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','chatStatusTime','mailStatusTime','faxStatus','smsStatus','stringify','emit','lodash','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity'];(function(_0x221923,_0x16aab4){var _0x2c7d9b=function(_0x3398d9){while(--_0x3398d9){_0x221923['push'](_0x221923['shift']());}};_0x2c7d9b(++_0x16aab4);}(_0x72f6,0x1a9));var _0x672f=function(_0x5143ec,_0xde026){_0x5143ec=_0x5143ec-0x0;var _0x9d7439=_0x72f6[_0x5143ec];return _0x9d7439;};'use strict';var _=require(_0x672f('0x0'));var moment=require(_0x672f('0x1'));var md5=require(_0x672f('0x2'));var Redis=require('ioredis');var config=require(_0x672f('0x3'));config[_0x672f('0x4')]=_[_0x672f('0x5')](config[_0x672f('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x672f('0x6'))(new Redis(config[_0x672f('0x4')]));function Agent(_0x307451){this['id']=_0x307451['id']||0x0;this['name']=_0x307451[_0x672f('0x7')]||'';this[_0x672f('0x8')]=_0x307451[_0x672f('0x8')]||!![];this[_0x672f('0x9')]=_0x307451[_0x672f('0x9')]||![];this['chatPause']=_0x307451[_0x672f('0xa')]||![];this[_0x672f('0xb')]=_0x307451['mailPause']||![];this['faxPause']=_0x307451[_0x672f('0xc')]||![];this['smsPause']=_0x307451[_0x672f('0xd')]||![];this['openchannelPause']=_0x307451['openchannelPause']||![];this[_0x672f('0xe')]=_0x672f('0xf');this['chatStatusTime']=0x0;this[_0x672f('0x10')]=_0x307451[_0x672f('0x10')]||0x0;this[_0x672f('0x11')]=0x0;this['mailStatus']=_0x672f('0xf');this['mailStatusTime']=0x0;this[_0x672f('0x12')]=_0x307451['mailCapacity']||0x0;this[_0x672f('0x13')]=0x0;this['faxStatus']=_0x672f('0xf');this[_0x672f('0x14')]=0x0;this[_0x672f('0x15')]=_0x307451[_0x672f('0x15')]||0x0;this[_0x672f('0x16')]=0x0;this['smsStatus']=_0x672f('0xf');this[_0x672f('0x17')]=0x0;this[_0x672f('0x18')]=_0x307451[_0x672f('0x18')]||0x0;this[_0x672f('0x19')]=0x0;this[_0x672f('0x1a')]=_0x672f('0xf');this[_0x672f('0x1b')]=0x0;this[_0x672f('0x1c')]=_0x307451[_0x672f('0x1c')]||0x0;this[_0x672f('0x1d')]=0x0;this[_0x672f('0x1e')]=_0x672f('0xf');this[_0x672f('0x1f')]=0x0;this[_0x672f('0x20')]=_0x307451[_0x672f('0x20')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x672f('0x21')]=![];this[_0x672f('0x22')]=undefined;this[_0x672f('0x2')]='';this[_0x672f('0x23')]();}Agent[_0x672f('0x24')][_0x672f('0x25')]=function(_0x14f85f){if(this[_0x14f85f+'CurrentCapacity']>0x0){if(this[_0x14f85f+_0x672f('0x26')]>0x0&&this[_0x14f85f+_0x672f('0x27')]>=this[_0x14f85f+_0x672f('0x26')]){return'maxcapacity';}else{return _0x672f('0x28');}}else{return _0x672f('0x29');}};Agent[_0x672f('0x24')][_0x672f('0x23')]=function(){var _0x27134d=[_0x672f('0x2a'),'chat',_0x672f('0x2b'),'fax',_0x672f('0x2c'),_0x672f('0x2d')];for(var _0x42b018=0x0;_0x42b018<_0x27134d[_0x672f('0x2e')];_0x42b018+=0x1){var _0x3964d0=this[_0x672f('0x25')](_0x27134d[_0x42b018]);if(this[_0x27134d[_0x42b018]+_0x672f('0x2f')]!==_0x3964d0){this[_0x27134d[_0x42b018]+_0x672f('0x30')]=_[_0x672f('0x31')](moment()['format']('x'));}this[_0x27134d[_0x42b018]+_0x672f('0x2f')]=_0x3964d0;}var _0x8be90b={'id':this['id'],'name':this[_0x672f('0x7')],'online':this[_0x672f('0x8')],'voicePause':this[_0x672f('0x9')],'chatPause':this[_0x672f('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x672f('0xd')],'faxPause':this[_0x672f('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x672f('0xe')],'chatStatusTime':this[_0x672f('0x32')],'chatCapacity':this[_0x672f('0x10')],'chatCurrentCapacity':this[_0x672f('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x672f('0x33')],'mailCapacity':this[_0x672f('0x12')],'mailCurrentCapacity':this[_0x672f('0x13')],'faxStatus':this[_0x672f('0x34')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x672f('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x672f('0x35')],'smsStatusTime':this[_0x672f('0x17')],'smsCapacity':this[_0x672f('0x18')],'smsCurrentCapacity':this[_0x672f('0x19')],'whatsappStatus':this[_0x672f('0x1a')],'whatsappStatusTime':this[_0x672f('0x1b')],'whatsappCapacity':this[_0x672f('0x1c')],'whatsappCurrentCapacity':this[_0x672f('0x1d')],'openchannelStatus':this[_0x672f('0x1e')],'openchannelStatusTime':this[_0x672f('0x1f')],'openchannelCapacity':this[_0x672f('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x672f('0x21')],'busyQueue':this[_0x672f('0x22')]};var _0x516ff4=md5(JSON[_0x672f('0x36')](_0x8be90b));if(this[_0x672f('0x2')]!==_0x516ff4){this[_0x672f('0x2')]=_0x516ff4;io[_0x672f('0x37')]('user:save',_0x8be90b);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a6c9c2d..127c669 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 _0x961c=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x961c,0xd8));var _0xc961=function(_0x1f07e4,_0x24e995){_0x1f07e4=_0x1f07e4-0x0;var _0x2bceff=_0x961c[_0x1f07e4];return _0x2bceff;};'use strict';var _=require(_0xc961('0x0'));var md5=require('md5');var util=require(_0xc961('0x1'));var Redis=require(_0xc961('0x2'));var config=require(_0xc961('0x3'));config[_0xc961('0x4')]=_[_0xc961('0x5')](config[_0xc961('0x4')],{'host':_0xc961('0x6'),'port':0x18eb});var io=require(_0xc961('0x7'))(new Redis(config[_0xc961('0x4')]));function ChatQueue(_0x29d5a1){this['id']=_0x29d5a1['id']||0x0;this[_0xc961('0x8')]=_0x29d5a1['name']||'';this[_0xc961('0x9')]=_0x29d5a1[_0xc961('0x9')]||0xa;this[_0xc961('0xa')]=_0x29d5a1[_0xc961('0xa')]||_0xc961('0xb');this[_0xc961('0xc')]=_0x29d5a1[_0xc961('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xc961('0xd')]='';this[_0xc961('0xe')]();this[_0xc961('0xf')]();}ChatQueue[_0xc961('0x10')][_0xc961('0xe')]=function(){var _0x35e7de=this['mapAgentsId']['_rr'];this[_0xc961('0x11')]=_[_0xc961('0x12')](this[_0xc961('0xc')],'id');this[_0xc961('0x11')][_0xc961('0x13')]=_0x35e7de;};ChatQueue[_0xc961('0x10')][_0xc961('0xf')]=function(){this['loggedIn']=0x0;this[_0xc961('0x14')]=0x0;for(var _0xa5defe=0x0;_0xa5defe=0x0?this[_0xc961('0x18')]:0x0;var _0x37e837={'id':this['id'],'available':this[_0xc961('0x18')],'loggedIn':this[_0xc961('0x16')],'name':this[_0xc961('0x8')],'paused':this[_0xc961('0x14')],'waiting':this[_0xc961('0x19')]};var _0x450ee2=md5(JSON[_0xc961('0x1a')](_0x37e837));if(this[_0xc961('0xd')]!==_0x450ee2){this[_0xc961('0xd')]=_0x450ee2;io['to'](util[_0xc961('0x1b')](_0xc961('0x1c'),_0x37e837['name']))['emit'](_0xc961('0x1d'),_0x37e837);}};module[_0xc961('0x1e')]=ChatQueue; \ No newline at end of file +var _0xeb03=['paused','length','online','available','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','updateRealtime','loggedIn'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0xeb03,0xb7));var _0x3eb0=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xeb03[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x3eb0('0x0'));var md5=require(_0x3eb0('0x1'));var util=require(_0x3eb0('0x2'));var Redis=require('ioredis');var config=require(_0x3eb0('0x3'));config[_0x3eb0('0x4')]=_[_0x3eb0('0x5')](config[_0x3eb0('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x3eb0('0x6'))(new Redis(config['redis']));function ChatQueue(_0x1f0dbe){this['id']=_0x1f0dbe['id']||0x0;this[_0x3eb0('0x7')]=_0x1f0dbe['name']||'';this[_0x3eb0('0x8')]=_0x1f0dbe['timeout']||0xa;this['strategy']=_0x1f0dbe[_0x3eb0('0x9')]||'beepall';this[_0x3eb0('0xa')]=_0x1f0dbe[_0x3eb0('0xa')];this[_0x3eb0('0xb')]={};this[_0x3eb0('0xc')]=0x0;this[_0x3eb0('0x1')]='';this[_0x3eb0('0xd')]();this['updateRealtime']();}ChatQueue[_0x3eb0('0xe')][_0x3eb0('0xd')]=function(){var _0xc8d741=this[_0x3eb0('0xb')]['_rr'];this[_0x3eb0('0xb')]=_['map'](this[_0x3eb0('0xa')],'id');this[_0x3eb0('0xb')]['_rr']=_0xc8d741;};ChatQueue['prototype'][_0x3eb0('0xf')]=function(){this[_0x3eb0('0x10')]=0x0;this[_0x3eb0('0x11')]=0x0;for(var _0x352512=0x0;_0x352512=0x0?this[_0x3eb0('0x14')]:0x0;var _0x59b32a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3eb0('0x10')],'name':this['name'],'paused':this[_0x3eb0('0x11')],'waiting':this[_0x3eb0('0xc')]};var _0x4c0faa=md5(JSON['stringify'](_0x59b32a));if(this[_0x3eb0('0x1')]!==_0x4c0faa){this['md5']=_0x4c0faa;io['to'](util['format'](_0x3eb0('0x15'),_0x59b32a[_0x3eb0('0x7')]))[_0x3eb0('0x16')](_0x3eb0('0x17'),_0x59b32a);}};module[_0x3eb0('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index bdd0b24..6d631c5 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 _0xa1eb=['updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','faxPause','available','waiting','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x4945e8,_0x597c5e){var _0x4300ca=function(_0x50c331){while(--_0x50c331){_0x4945e8['push'](_0x4945e8['shift']());}};_0x4300ca(++_0x597c5e);}(_0xa1eb,0x1c9));var _0xba1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba1e('0x0'));var md5=require(_0xba1e('0x1'));var util=require(_0xba1e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xba1e('0x3')]=_[_0xba1e('0x4')](config[_0xba1e('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xba1e('0x5'))(new Redis(config['redis']));function FaxQueue(_0x3a7e67){this['id']=_0x3a7e67['id']||0x0;this[_0xba1e('0x6')]=_0x3a7e67[_0xba1e('0x6')]||'';this[_0xba1e('0x7')]=_0x3a7e67['timeout']||0xa;this[_0xba1e('0x8')]=_0x3a7e67[_0xba1e('0x8')]||'beepall';this['Agents']=_0x3a7e67[_0xba1e('0x9')];this[_0xba1e('0xa')]={};this['waiting']=0x0;this[_0xba1e('0x1')]='';this[_0xba1e('0xb')]();this[_0xba1e('0xc')]();}FaxQueue[_0xba1e('0xd')][_0xba1e('0xb')]=function(){var _0x1173fe=this[_0xba1e('0xa')]['_rr'];this[_0xba1e('0xa')]=_[_0xba1e('0xe')](this[_0xba1e('0x9')],'id');this[_0xba1e('0xa')][_0xba1e('0xf')]=_0x1173fe;};FaxQueue['prototype']['updateRealtime']=function(){this[_0xba1e('0x10')]=0x0;this[_0xba1e('0x11')]=0x0;for(var _0x10230f=0x0;_0x10230f=0x0?this[_0xba1e('0x13')]:0x0;var _0x350b1b={'id':this['id'],'available':this[_0xba1e('0x13')],'loggedIn':this[_0xba1e('0x10')],'name':this['name'],'paused':this[_0xba1e('0x11')],'waiting':this[_0xba1e('0x14')]};var _0x5684b7=md5(JSON[_0xba1e('0x15')](_0x350b1b));if(this[_0xba1e('0x1')]!==_0x5684b7){this['md5']=_0x5684b7;io['to'](util[_0xba1e('0x16')](_0xba1e('0x17'),_0x350b1b['name']))['emit'](_0xba1e('0x18'),_0x350b1b);}};module[_0xba1e('0x19')]=FaxQueue; \ No newline at end of file +var _0x4af1=['updateRouting','updateRealtime','map','prototype','loggedIn','paused','length','online','available','stringify','md5','format','emit','fax_queue:save','exports','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x16a64e,_0x4b3491){var _0x29a6e4=function(_0x3a81b8){while(--_0x3a81b8){_0x16a64e['push'](_0x16a64e['shift']());}};_0x29a6e4(++_0x4b3491);}(_0x4af1,0x91));var _0x14af=function(_0x58df5d,_0xd74e9f){_0x58df5d=_0x58df5d-0x0;var _0x482294=_0x4af1[_0x58df5d];return _0x482294;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x14af('0x0'));var Redis=require('ioredis');var config=require(_0x14af('0x1'));config[_0x14af('0x2')]=_['defaults'](config['redis'],{'host':_0x14af('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x14af('0x2')]));function FaxQueue(_0x4554ed){this['id']=_0x4554ed['id']||0x0;this[_0x14af('0x4')]=_0x4554ed[_0x14af('0x4')]||'';this[_0x14af('0x5')]=_0x4554ed[_0x14af('0x5')]||0xa;this[_0x14af('0x6')]=_0x4554ed[_0x14af('0x6')]||_0x14af('0x7');this[_0x14af('0x8')]=_0x4554ed[_0x14af('0x8')];this[_0x14af('0x9')]={};this[_0x14af('0xa')]=0x0;this['md5']='';this[_0x14af('0xb')]();this[_0x14af('0xc')]();}FaxQueue['prototype'][_0x14af('0xb')]=function(){var _0x94d835=this['mapAgentsId']['_rr'];this[_0x14af('0x9')]=_[_0x14af('0xd')](this[_0x14af('0x8')],'id');this[_0x14af('0x9')]['_rr']=_0x94d835;};FaxQueue[_0x14af('0xe')][_0x14af('0xc')]=function(){this[_0x14af('0xf')]=0x0;this[_0x14af('0x10')]=0x0;for(var _0x1c00b3=0x0;_0x1c00b3=0x0?this['available']:0x0;var _0x543fef={'id':this['id'],'available':this[_0x14af('0x13')],'loggedIn':this[_0x14af('0xf')],'name':this['name'],'paused':this[_0x14af('0x10')],'waiting':this[_0x14af('0xa')]};var _0x437c74=md5(JSON[_0x14af('0x14')](_0x543fef));if(this[_0x14af('0x15')]!==_0x437c74){this['md5']=_0x437c74;io['to'](util[_0x14af('0x16')]('fax:queue:%s',_0x543fef[_0x14af('0x4')]))[_0x14af('0x17')](_0x14af('0x18'),_0x543fef);}};module[_0x14af('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index fb7fc6f..838593f 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 _0x438d=['name','Intervals','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x438d,0x168));var _0xd438=function(_0x3831ed,_0x5e88ce){_0x3831ed=_0x3831ed-0x0;var _0x5521ce=_0x438d[_0x3831ed];return _0x5521ce;};'use strict';function Interval(_0x58445a){this['id']=_0x58445a['id']||0x0;this[_0xd438('0x0')]=_0x58445a[_0xd438('0x0')]||'';this[_0xd438('0x1')]=_0x58445a[_0xd438('0x1')]||{};}module[_0xd438('0x2')]=Interval; \ No newline at end of file +var _0x3955=['exports','name','Intervals'];(function(_0x1cd5b3,_0x288f7d){var _0x3a93ac=function(_0x2f5bc7){while(--_0x2f5bc7){_0x1cd5b3['push'](_0x1cd5b3['shift']());}};_0x3a93ac(++_0x288f7d);}(_0x3955,0xa6));var _0x5395=function(_0x499b0a,_0x49fd69){_0x499b0a=_0x499b0a-0x0;var _0x4cde14=_0x3955[_0x499b0a];return _0x4cde14;};'use strict';function Interval(_0x11bc57){this['id']=_0x11bc57['id']||0x0;this[_0x5395('0x0')]=_0x11bc57[_0x5395('0x0')]||'';this[_0x5395('0x1')]=_0x11bc57[_0x5395('0x1')]||{};}module[_0x5395('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index abd5288..56d42ad 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 _0x0c08=['_rr','loggedIn','paused','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','prototype','mapAgentsId'];(function(_0x586cdb,_0x32a931){var _0x2fcd64=function(_0x1ef9b7){while(--_0x1ef9b7){_0x586cdb['push'](_0x586cdb['shift']());}};_0x2fcd64(++_0x32a931);}(_0x0c08,0x14f));var _0x80c0=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x0c08[_0x7e918f];return _0x5b35ab;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x80c0('0x0'));var config=require('../../../config/environment');config[_0x80c0('0x1')]=_[_0x80c0('0x2')](config[_0x80c0('0x1')],{'host':_0x80c0('0x3'),'port':0x18eb});var io=require(_0x80c0('0x4'))(new Redis(config[_0x80c0('0x1')]));function MailQueue(_0x5eed32){this['id']=_0x5eed32['id']||0x0;this[_0x80c0('0x5')]=_0x5eed32[_0x80c0('0x5')]||'';this[_0x80c0('0x6')]=_0x5eed32[_0x80c0('0x6')]||0xa;this[_0x80c0('0x7')]=_0x5eed32[_0x80c0('0x7')]||_0x80c0('0x8');this[_0x80c0('0x9')]=_0x5eed32[_0x80c0('0x9')];this['mapAgentsId']={};this[_0x80c0('0xa')]=0x0;this[_0x80c0('0xb')]='';this[_0x80c0('0xc')]();this['updateRealtime']();}MailQueue[_0x80c0('0xd')][_0x80c0('0xc')]=function(){var _0x359de5=this[_0x80c0('0xe')][_0x80c0('0xf')];this[_0x80c0('0xe')]=_['map'](this[_0x80c0('0x9')],'id');this['mapAgentsId'][_0x80c0('0xf')]=_0x359de5;};MailQueue[_0x80c0('0xd')]['updateRealtime']=function(){this[_0x80c0('0x10')]=0x0;this[_0x80c0('0x11')]=0x0;for(var _0x32e829=0x0;_0x32e829=0x0?this['available']:0x0;var _0x20e5c5={'id':this['id'],'available':this['available'],'loggedIn':this[_0x80c0('0x10')],'name':this[_0x80c0('0x5')],'paused':this[_0x80c0('0x11')],'waiting':this[_0x80c0('0xa')]};var _0x4fd5b1=md5(JSON[_0x80c0('0x14')](_0x20e5c5));if(this[_0x80c0('0xb')]!==_0x4fd5b1){this[_0x80c0('0xb')]=_0x4fd5b1;io['to'](util[_0x80c0('0x15')](_0x80c0('0x16'),_0x20e5c5[_0x80c0('0x5')]))['emit'](_0x80c0('0x17'),_0x20e5c5);}};module[_0x80c0('0x18')]=MailQueue; \ No newline at end of file +var _0x7b0a=['prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x31b448,_0x179c65){var _0x3a9497=function(_0x4c28e7){while(--_0x4c28e7){_0x31b448['push'](_0x31b448['shift']());}};_0x3a9497(++_0x179c65);}(_0x7b0a,0xca));var _0xa7b0=function(_0x419763,_0x48ae33){_0x419763=_0x419763-0x0;var _0x44a255=_0x7b0a[_0x419763];return _0x44a255;};'use strict';var _=require(_0xa7b0('0x0'));var md5=require(_0xa7b0('0x1'));var util=require(_0xa7b0('0x2'));var Redis=require(_0xa7b0('0x3'));var config=require(_0xa7b0('0x4'));config[_0xa7b0('0x5')]=_[_0xa7b0('0x6')](config[_0xa7b0('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xa7b0('0x7'))(new Redis(config[_0xa7b0('0x5')]));function MailQueue(_0x55dbd0){this['id']=_0x55dbd0['id']||0x0;this[_0xa7b0('0x8')]=_0x55dbd0[_0xa7b0('0x8')]||'';this[_0xa7b0('0x9')]=_0x55dbd0[_0xa7b0('0x9')]||0xa;this['strategy']=_0x55dbd0[_0xa7b0('0xa')]||_0xa7b0('0xb');this[_0xa7b0('0xc')]=_0x55dbd0[_0xa7b0('0xc')];this[_0xa7b0('0xd')]={};this['waiting']=0x0;this[_0xa7b0('0x1')]='';this[_0xa7b0('0xe')]();this['updateRealtime']();}MailQueue[_0xa7b0('0xf')][_0xa7b0('0xe')]=function(){var _0x5e85fc=this['mapAgentsId'][_0xa7b0('0x10')];this[_0xa7b0('0xd')]=_[_0xa7b0('0x11')](this[_0xa7b0('0xc')],'id');this['mapAgentsId'][_0xa7b0('0x10')]=_0x5e85fc;};MailQueue[_0xa7b0('0xf')]['updateRealtime']=function(){this[_0xa7b0('0x12')]=0x0;this[_0xa7b0('0x13')]=0x0;for(var _0xb2475=0x0;_0xb2475=0x0?this['available']:0x0;var _0x14c4a9={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa7b0('0x12')],'name':this[_0xa7b0('0x8')],'paused':this[_0xa7b0('0x13')],'waiting':this[_0xa7b0('0x18')]};var _0x4de2b8=md5(JSON[_0xa7b0('0x19')](_0x14c4a9));if(this[_0xa7b0('0x1')]!==_0x4de2b8){this['md5']=_0x4de2b8;io['to'](util[_0xa7b0('0x1a')](_0xa7b0('0x1b'),_0x14c4a9[_0xa7b0('0x8')]))[_0xa7b0('0x1c')](_0xa7b0('0x1d'),_0x14c4a9);}};module[_0xa7b0('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5338db8..1421300 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x1261,0x144));var _0x1126=function(_0x2df4cc,_0x1233c6){_0x2df4cc=_0x2df4cc-0x0;var _0x40af8d=_0x1261[_0x2df4cc];return _0x40af8d;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x2ef3,0xba));var _0x32ef=function(_0x889323,_0x246ce8){_0x889323=_0x889323-0x0;var _0xe7fddf=_0x2ef3[_0x889323];return _0xe7fddf;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f8a05d1..0a54b65 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 _0xb6b1=['sms_queue:save','exports','lodash','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','smsPause','available','waiting','stringify','md5','format','emit'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0xb6b1[_0x3d9176];return _0x12adc5;};'use strict';var _=require(_0x1b6b('0x0'));var md5=require('md5');var util=require(_0x1b6b('0x1'));var Redis=require('ioredis');var config=require(_0x1b6b('0x2'));config[_0x1b6b('0x3')]=_['defaults'](config[_0x1b6b('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x1b6b('0x4'))(new Redis(config[_0x1b6b('0x3')]));function SmsQueue(_0x2c4040){this['id']=_0x2c4040['id']||0x0;this[_0x1b6b('0x5')]=_0x2c4040['name']||'';this[_0x1b6b('0x6')]=_0x2c4040['timeout']||0xa;this[_0x1b6b('0x7')]=_0x2c4040['strategy']||_0x1b6b('0x8');this[_0x1b6b('0x9')]=_0x2c4040[_0x1b6b('0x9')];this[_0x1b6b('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x1b6b('0xb')]();this[_0x1b6b('0xc')]();}SmsQueue[_0x1b6b('0xd')][_0x1b6b('0xb')]=function(){var _0x2f06f6=this[_0x1b6b('0xa')][_0x1b6b('0xe')];this['mapAgentsId']=_[_0x1b6b('0xf')](this[_0x1b6b('0x9')],'id');this[_0x1b6b('0xa')]['_rr']=_0x2f06f6;};SmsQueue[_0x1b6b('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x1b6b('0x10')]=0x0;for(var _0x20a2d7=0x0;_0x20a2d7=0x0?this[_0x1b6b('0x15')]:0x0;var _0x59e671={'id':this['id'],'available':this[_0x1b6b('0x15')],'loggedIn':this[_0x1b6b('0x13')],'name':this[_0x1b6b('0x5')],'paused':this[_0x1b6b('0x10')],'waiting':this[_0x1b6b('0x16')]};var _0xe720e7=md5(JSON[_0x1b6b('0x17')](_0x59e671));if(this[_0x1b6b('0x18')]!==_0xe720e7){this[_0x1b6b('0x18')]=_0xe720e7;io['to'](util[_0x1b6b('0x19')]('sms:queue:%s',_0x59e671[_0x1b6b('0x5')]))[_0x1b6b('0x1a')](_0x1b6b('0x1b'),_0x59e671);}};module[_0x1b6b('0x1c')]=SmsQueue; \ No newline at end of file +var _0x46fc=['prototype','updateRealtime','length','smsPause','paused','available','loggedIn','stringify','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x3ce67,_0x5f50f7){var _0x31d4fe=function(_0xd3c390){while(--_0xd3c390){_0x3ce67['push'](_0x3ce67['shift']());}};_0x31d4fe(++_0x5f50f7);}(_0x46fc,0x103));var _0xc46f=function(_0x2d77e1,_0xac474b){_0x2d77e1=_0x2d77e1-0x0;var _0x13781a=_0x46fc[_0x2d77e1];return _0x13781a;};'use strict';var _=require(_0xc46f('0x0'));var md5=require(_0xc46f('0x1'));var util=require(_0xc46f('0x2'));var Redis=require(_0xc46f('0x3'));var config=require(_0xc46f('0x4'));config[_0xc46f('0x5')]=_[_0xc46f('0x6')](config[_0xc46f('0x5')],{'host':_0xc46f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x46315d){this['id']=_0x46315d['id']||0x0;this[_0xc46f('0x8')]=_0x46315d[_0xc46f('0x8')]||'';this[_0xc46f('0x9')]=_0x46315d[_0xc46f('0x9')]||0xa;this[_0xc46f('0xa')]=_0x46315d[_0xc46f('0xa')]||_0xc46f('0xb');this[_0xc46f('0xc')]=_0x46315d[_0xc46f('0xc')];this[_0xc46f('0xd')]={};this[_0xc46f('0xe')]=0x0;this[_0xc46f('0x1')]='';this[_0xc46f('0xf')]();this['updateRealtime']();}SmsQueue[_0xc46f('0x10')][_0xc46f('0xf')]=function(){var _0x32e9fe=this[_0xc46f('0xd')]['_rr'];this['mapAgentsId']=_['map'](this[_0xc46f('0xc')],'id');this[_0xc46f('0xd')]['_rr']=_0x32e9fe;};SmsQueue[_0xc46f('0x10')][_0xc46f('0x11')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1e3575=0x0;_0x1e3575=0x0?this['available']:0x0;var _0x4740b3={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc46f('0x16')],'name':this[_0xc46f('0x8')],'paused':this[_0xc46f('0x14')],'waiting':this['waiting']};var _0x474af7=md5(JSON[_0xc46f('0x17')](_0x4740b3));if(this[_0xc46f('0x1')]!==_0x474af7){this[_0xc46f('0x1')]=_0x474af7;io['to'](util['format']('sms:queue:%s',_0x4740b3['name']))['emit']('sms_queue:save',_0x4740b3);}};module[_0xc46f('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3fb18b1..bfa5c61 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 _0x9b44=['length','online','loggedIn','paused','available','waiting','stringify','emit','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','updateRealtime','mapAgentsId','map','_rr'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0x9b44,0x1b1));var _0x49b4=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x9b44[_0x44c974];return _0x5214c6;};'use strict';var _=require(_0x49b4('0x0'));var md5=require(_0x49b4('0x1'));var util=require(_0x49b4('0x2'));var Redis=require(_0x49b4('0x3'));var config=require(_0x49b4('0x4'));config['redis']=_[_0x49b4('0x5')](config[_0x49b4('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x49b4('0x7'))(new Redis(config[_0x49b4('0x6')]));function WhatsappQueue(_0x17341e){this['id']=_0x17341e['id']||0x0;this[_0x49b4('0x8')]=_0x17341e['name']||'';this[_0x49b4('0x9')]=_0x17341e[_0x49b4('0x9')]||0xa;this[_0x49b4('0xa')]=_0x17341e['strategy']||'beepall';this[_0x49b4('0xb')]=_0x17341e[_0x49b4('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x49b4('0x1')]='';this[_0x49b4('0xc')]();this[_0x49b4('0xd')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x1f1cd9=this[_0x49b4('0xe')]['_rr'];this[_0x49b4('0xe')]=_[_0x49b4('0xf')](this['Agents'],'id');this[_0x49b4('0xe')][_0x49b4('0x10')]=_0x1f1cd9;};WhatsappQueue['prototype'][_0x49b4('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x47fc1d=0x0;_0x47fc1d=0x0?this[_0x49b4('0x15')]:0x0;var _0x571a84={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x49b4('0x8')],'paused':this['paused'],'waiting':this[_0x49b4('0x16')]};var _0x399c36=md5(JSON[_0x49b4('0x17')](_0x571a84));if(this[_0x49b4('0x1')]!==_0x399c36){this['md5']=_0x399c36;io['to'](util['format']('whatsapp:queue:%s',_0x571a84[_0x49b4('0x8')]))[_0x49b4('0x18')]('whatsapp_queue:save',_0x571a84);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xede5=['exports','lodash','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','_rr','map','prototype','paused','online','loggedIn','whatsappPause','available','stringify','format'];(function(_0x3957c6,_0x6e9e2a){var _0x58cddb=function(_0x1b50b8){while(--_0x1b50b8){_0x3957c6['push'](_0x3957c6['shift']());}};_0x58cddb(++_0x6e9e2a);}(_0xede5,0xbe));var _0x5ede=function(_0x2ad8f8,_0x35c53e){_0x2ad8f8=_0x2ad8f8-0x0;var _0x35d59e=_0xede5[_0x2ad8f8];return _0x35d59e;};'use strict';var _=require(_0x5ede('0x0'));var md5=require('md5');var util=require(_0x5ede('0x1'));var Redis=require('ioredis');var config=require(_0x5ede('0x2'));config[_0x5ede('0x3')]=_[_0x5ede('0x4')](config[_0x5ede('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x5ede('0x5'))(new Redis(config[_0x5ede('0x3')]));function WhatsappQueue(_0x6c3eca){this['id']=_0x6c3eca['id']||0x0;this[_0x5ede('0x6')]=_0x6c3eca['name']||'';this[_0x5ede('0x7')]=_0x6c3eca[_0x5ede('0x7')]||0xa;this[_0x5ede('0x8')]=_0x6c3eca[_0x5ede('0x8')]||_0x5ede('0x9');this[_0x5ede('0xa')]=_0x6c3eca[_0x5ede('0xa')];this[_0x5ede('0xb')]={};this[_0x5ede('0xc')]=0x0;this[_0x5ede('0xd')]='';this['updateRouting']();this[_0x5ede('0xe')]();}WhatsappQueue['prototype'][_0x5ede('0xf')]=function(){var _0x177e0a=this[_0x5ede('0xb')][_0x5ede('0x10')];this[_0x5ede('0xb')]=_[_0x5ede('0x11')](this[_0x5ede('0xa')],'id');this['mapAgentsId']['_rr']=_0x177e0a;};WhatsappQueue[_0x5ede('0x12')][_0x5ede('0xe')]=function(){this['loggedIn']=0x0;this[_0x5ede('0x13')]=0x0;for(var _0x35093a=0x0;_0x35093a=0x0?this[_0x5ede('0x17')]:0x0;var _0x12cdc1={'id':this['id'],'available':this[_0x5ede('0x17')],'loggedIn':this[_0x5ede('0x15')],'name':this[_0x5ede('0x6')],'paused':this['paused'],'waiting':this[_0x5ede('0xc')]};var _0x4b0f65=md5(JSON[_0x5ede('0x18')](_0x12cdc1));if(this['md5']!==_0x4b0f65){this[_0x5ede('0xd')]=_0x4b0f65;io['to'](util[_0x5ede('0x19')]('whatsapp:queue:%s',_0x12cdc1[_0x5ede('0x6')]))['emit']('whatsapp_queue:save',_0x12cdc1);}};module[_0x5ede('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8cf068f..d3bce2d 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(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x443242,_0x4d9878){var _0x2c7479=function(_0xa1a7b6){while(--_0xa1a7b6){_0x443242['push'](_0x443242['shift']());}};_0x2c7479(++_0x4d9878);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fbd74,_0x3dc5ba){_0x4fbd74=_0x4fbd74-0x0;var _0x45bdc7=_0xb10b[_0x4fbd74];return _0x45bdc7;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 3c73574..ef54c40 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 _0x9a3e=['addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a3e,0x1e1));var _0xe9a3=function(_0x4b4f94,_0x4edd6f){_0x4b4f94=_0x4b4f94-0x0;var _0x540462=_0x9a3e[_0x4b4f94];return _0x540462;};'use strict';var client=require(_0xe9a3('0x0'));exports['update']=function(_0x336765,_0x478a99){return client[_0xe9a3('0x1')](_0xe9a3('0x2'),{'body':_0x478a99,'options':{'where':{'id':_0x336765}},'log':_0xe9a3('0x3')});};exports['addTags']=function(_0x136c2d,_0xd3b49){return client[_0xe9a3('0x1')]('AddTagsToChatInteraction',{'body':_0xd3b49,'options':{'where':{'id':_0x136c2d}},'log':_0xe9a3('0x4')});}; \ No newline at end of file +var _0xa9c3=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x5cb622,_0x47da28){var _0x3a083d=function(_0x34ef2d){while(--_0x34ef2d){_0x5cb622['push'](_0x5cb622['shift']());}};_0x3a083d(++_0x47da28);}(_0xa9c3,0x8d));var _0x3a9c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa9c3[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x3a9c('0x0'));exports[_0x3a9c('0x1')]=function(_0x48df85,_0x461042){return client[_0x3a9c('0x2')](_0x3a9c('0x3'),{'body':_0x461042,'options':{'where':{'id':_0x48df85}},'log':_0x3a9c('0x4')});};exports[_0x3a9c('0x5')]=function(_0x4a88cf,_0x24cf0d){return client[_0x3a9c('0x2')](_0x3a9c('0x6'),{'body':_0x24cf0d,'options':{'where':{'id':_0x4a88cf}},'log':_0x3a9c('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 9bc1a24..3691357 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 _0x3bfc=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x2e3c69,_0x24edb0){var _0x2ab912=function(_0x4f0f97){while(--_0x4f0f97){_0x2e3c69['push'](_0x2e3c69['shift']());}};_0x2ab912(++_0x24edb0);}(_0x3bfc,0x1f2));var _0xc3bf=function(_0xc471d2,_0x26ab16){_0xc471d2=_0xc471d2-0x0;var _0x334c68=_0x3bfc[_0xc471d2];return _0x334c68;};'use strict';var client=require(_0xc3bf('0x0'));exports[_0xc3bf('0x1')]=function(_0x1edd67){return client[_0xc3bf('0x2')](_0xc3bf('0x3'),{'body':_0x1edd67,'log':_0xc3bf('0x4')});}; \ No newline at end of file +var _0x47be=['CreateChatMessage','createChatMessage','Request'];(function(_0x47b605,_0x5c837f){var _0x35dcc8=function(_0x53d666){while(--_0x53d666){_0x47b605['push'](_0x47b605['shift']());}};_0x35dcc8(++_0x5c837f);}(_0x47be,0x122));var _0xe47b=function(_0x317b63,_0x2acf92){_0x317b63=_0x317b63-0x0;var _0x36a2e2=_0x47be[_0x317b63];return _0x36a2e2;};'use strict';var client=require('../client');exports['create']=function(_0x4c1b92){return client[_0xe47b('0x0')](_0xe47b('0x1'),{'body':_0x4c1b92,'log':_0xe47b('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 93078fd..7a5b658 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 _0x3351=['User','Agents','chatPause','getChatQueues','../client','GetChatQueue','name','timeout','strategy'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x3351,0x1b4));var _0x1335=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x3351[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x1335('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x1335('0x1'),{'options':{'raw':![],'attributes':['id',_0x1335('0x2'),_0x1335('0x3'),_0x1335('0x4')],'include':[{'model':_0x1335('0x5'),'as':_0x1335('0x6'),'attributes':['id',_0x1335('0x2'),'online',_0x1335('0x7')]}]},'log':_0x1335('0x8')});};}; \ No newline at end of file +var _0x4fde=['strategy','Agents','name','online','chatPause','../client','getChatQueues','Request','GetChatQueue','timeout'];(function(_0x4f6f13,_0x1c3bd0){var _0x10d5f7=function(_0x31c5fc){while(--_0x31c5fc){_0x4f6f13['push'](_0x4f6f13['shift']());}};_0x10d5f7(++_0x1c3bd0);}(_0x4fde,0x19f));var _0xe4fd=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x4fde[_0x4dbaad];return _0x226c72;};'use strict';var client=require(_0xe4fd('0x0'));exports[_0xe4fd('0x1')]=function(){return function(){return client[_0xe4fd('0x2')](_0xe4fd('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe4fd('0x4'),_0xe4fd('0x5')],'include':[{'model':'User','as':_0xe4fd('0x6'),'attributes':['id',_0xe4fd('0x7'),_0xe4fd('0x8'),_0xe4fd('0x9')]}]},'log':_0xe4fd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 1452526..4eb3def 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 _0x593e=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x49a9bc,_0x57d8d7){var _0x546fce=function(_0x9a6811){while(--_0x9a6811){_0x49a9bc['push'](_0x49a9bc['shift']());}};_0x546fce(++_0x57d8d7);}(_0x593e,0xcb));var _0xe593=function(_0x30087a,_0x348f65){_0x30087a=_0x30087a-0x0;var _0x431192=_0x593e[_0x30087a];return _0x431192;};'use strict';var client=require(_0xe593('0x0'));exports[_0xe593('0x1')]=function(_0x12f6de){return client[_0xe593('0x2')](_0xe593('0x3'),{'body':_0x12f6de,'log':_0xe593('0x3')});};exports[_0xe593('0x4')]=function(_0x2fa3a7,_0x550574){return client[_0xe593('0x2')](_0xe593('0x5'),{'body':_0x550574,'options':{'where':{'uniqueid':_0x2fa3a7},'order':[['id',_0xe593('0x6')]],'limit':0x1},'log':_0xe593('0x5')});}; \ No newline at end of file +var _0x2333=['../client','create','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0x2333,0x11a));var _0x3233=function(_0x4dd021,_0x21fe94){_0x4dd021=_0x4dd021-0x0;var _0x71eadf=_0x2333[_0x4dd021];return _0x71eadf;};'use strict';var client=require(_0x3233('0x0'));exports[_0x3233('0x1')]=function(_0x4c4ec0){return client['Request'](_0x3233('0x2'),{'body':_0x4c4ec0,'log':_0x3233('0x2')});};exports['update']=function(_0x8fdc58,_0x1c473f){return client[_0x3233('0x3')](_0x3233('0x4'),{'body':_0x1c473f,'options':{'where':{'uniqueid':_0x8fdc58},'order':[['id',_0x3233('0x5')]],'limit':0x1},'log':_0x3233('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c2efd8c..1ddb447 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0x7a54,0x106));var _0x47a5=function(_0x5aa5ae,_0x372da5){_0x5aa5ae=_0x5aa5ae-0x0;var _0x6c4f=_0x7a54[_0x5aa5ae];return _0x6c4f;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x7d7d53,_0x150b52){var _0x28d9ff=function(_0x3b1c1b){while(--_0x3b1c1b){_0x7d7d53['push'](_0x7d7d53['shift']());}};_0x28d9ff(++_0x150b52);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 8b25279..64694af 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 _0x03c7=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x4e18a9,_0x262d65){var _0xa29fbd=function(_0x50e57a){while(--_0x50e57a){_0x4e18a9['push'](_0x4e18a9['shift']());}};_0xa29fbd(++_0x262d65);}(_0x03c7,0x137));var _0x703c=function(_0x5b0399,_0x566ed2){_0x5b0399=_0x5b0399-0x0;var _0x262915=_0x03c7[_0x5b0399];return _0x262915;};'use strict';var client=require(_0x703c('0x0'));exports[_0x703c('0x1')]=function(_0x26b306){return client[_0x703c('0x2')](_0x703c('0x3'),{'body':_0x26b306,'log':_0x703c('0x4')});}; \ No newline at end of file +var _0x9680=['createFaxMessage','Request','CreateFaxMessage'];(function(_0x583142,_0x294774){var _0x554e92=function(_0x3a75ac){while(--_0x3a75ac){_0x583142['push'](_0x583142['shift']());}};_0x554e92(++_0x294774);}(_0x9680,0x1c3));var _0x0968=function(_0x416941,_0x478f9b){_0x416941=_0x416941-0x0;var _0x206f04=_0x9680[_0x416941];return _0x206f04;};'use strict';var client=require('../client');exports['create']=function(_0x2a67aa){return client[_0x0968('0x0')](_0x0968('0x1'),{'body':_0x2a67aa,'log':_0x0968('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 3c20cc9..ffdd7f6 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 _0x3e26=['GetFaxQueue','name','timeout','strategy','User','../client','getFaxQueues'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3e26,0x75));var _0x63e2=function(_0x179b90,_0x4417bd){_0x179b90=_0x179b90-0x0;var _0x2ffa9d=_0x3e26[_0x179b90];return _0x2ffa9d;};'use strict';var client=require(_0x63e2('0x0'));exports[_0x63e2('0x1')]=function(){return function(){return client['Request'](_0x63e2('0x2'),{'options':{'raw':![],'attributes':['id',_0x63e2('0x3'),_0x63e2('0x4'),_0x63e2('0x5')],'include':[{'model':_0x63e2('0x6'),'as':'Agents','attributes':['id',_0x63e2('0x3'),'online','faxPause']}]},'log':_0x63e2('0x1')});};}; \ No newline at end of file +var _0xa728=['timeout','strategy','User','online','faxPause','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa728,0x11d));var _0x8a72=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0xa728[_0x1dac7a];return _0x4cb363;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x8a72('0x0')](_0x8a72('0x1'),{'options':{'raw':![],'attributes':['id',_0x8a72('0x2'),_0x8a72('0x3'),_0x8a72('0x4')],'include':[{'model':_0x8a72('0x5'),'as':'Agents','attributes':['id','name',_0x8a72('0x6'),_0x8a72('0x7')]}]},'log':_0x8a72('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d42aa12..97b2847 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 _0x5f73=['UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','Request'];(function(_0x18ae6d,_0x255d00){var _0x3deb94=function(_0x44b04c){while(--_0x44b04c){_0x18ae6d['push'](_0x18ae6d['shift']());}};_0x3deb94(++_0x255d00);}(_0x5f73,0x18e));var _0x35f7=function(_0x3b65cc,_0x46639b){_0x3b65cc=_0x3b65cc-0x0;var _0x42e8c5=_0x5f73[_0x3b65cc];return _0x42e8c5;};'use strict';var client=require(_0x35f7('0x0'));exports[_0x35f7('0x1')]=function(_0x4b0fef){return client['Request']('CreateFaxQueueReport',{'body':_0x4b0fef,'log':_0x35f7('0x2')});};exports['update']=function(_0x13adbf,_0x1c47c5){return client[_0x35f7('0x3')](_0x35f7('0x4'),{'body':_0x1c47c5,'options':{'where':{'uniqueid':_0x13adbf},'order':[['id',_0x35f7('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x1849=['update','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x2620fb,_0x48846f){var _0x71c456=function(_0x270b98){while(--_0x270b98){_0x2620fb['push'](_0x2620fb['shift']());}};_0x71c456(++_0x48846f);}(_0x1849,0x8c));var _0x9184=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1849[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x9184('0x0'));exports[_0x9184('0x1')]=function(_0x22f903){return client[_0x9184('0x2')]('CreateFaxQueueReport',{'body':_0x22f903,'log':_0x9184('0x3')});};exports[_0x9184('0x4')]=function(_0x17db5f,_0xb470c9){return client[_0x9184('0x2')](_0x9184('0x5'),{'body':_0xb470c9,'options':{'where':{'uniqueid':_0x17db5f},'order':[['id','DESC']],'limit':0x1},'log':_0x9184('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d7a3a81..6a2fd52 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 _0x834a=['GetInterval','name','Intervals','interval','getIntervals','../client','Request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x834a,0x1cc));var _0xa834=function(_0x54a57f,_0x30d98a){_0x54a57f=_0x54a57f-0x0;var _0x30231d=_0x834a[_0x54a57f];return _0x30231d;};'use strict';var client=require(_0xa834('0x0'));exports['getIntervals']=function(){return function(){return client[_0xa834('0x1')](_0xa834('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa834('0x3')],'include':[{'model':'Interval','as':_0xa834('0x4'),'attributes':['id',_0xa834('0x3'),_0xa834('0x5')]}]},'log':_0xa834('0x6')});};}; \ No newline at end of file +var _0x95ae=['Intervals','interval','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0xdc8dc7,_0x128ad6){var _0xd21432=function(_0x5bf3a7){while(--_0x5bf3a7){_0xdc8dc7['push'](_0xdc8dc7['shift']());}};_0xd21432(++_0x128ad6);}(_0x95ae,0x16a));var _0xe95a=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x95ae[_0x1cb18a];return _0x22442e;};'use strict';var client=require(_0xe95a('0x0'));exports[_0xe95a('0x1')]=function(){return function(){return client[_0xe95a('0x2')](_0xe95a('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe95a('0x4')],'include':[{'model':_0xe95a('0x5'),'as':_0xe95a('0x6'),'attributes':['id',_0xe95a('0x4'),_0xe95a('0x7')]}]},'log':_0xe95a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 7269d27..5d87b8b 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 _0x0120=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x3e259e,_0x5cf64b){var _0x586201=function(_0x167fd3){while(--_0x167fd3){_0x3e259e['push'](_0x3e259e['shift']());}};_0x586201(++_0x5cf64b);}(_0x0120,0x6f));var _0x0012=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x0120[_0x297fd3];return _0x2af381;};'use strict';var client=require(_0x0012('0x0'));exports[_0x0012('0x1')]=function(_0x3d23e7,_0xb8d57c){return client[_0x0012('0x2')](_0x0012('0x3'),{'body':_0xb8d57c,'options':{'where':{'id':_0x3d23e7}},'log':_0x0012('0x4')});};exports[_0x0012('0x5')]=function(_0x357f77,_0x302029){return client[_0x0012('0x2')](_0x0012('0x6'),{'body':_0x302029,'options':{'where':{'id':_0x357f77}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x056b=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x4bd6d3,_0x3a7e64){var _0x3e663c=function(_0x23f1d6){while(--_0x23f1d6){_0x4bd6d3['push'](_0x4bd6d3['shift']());}};_0x3e663c(++_0x3a7e64);}(_0x056b,0xb6));var _0xb056=function(_0x5a3785,_0x2de636){_0x5a3785=_0x5a3785-0x0;var _0x4d058a=_0x056b[_0x5a3785];return _0x4d058a;};'use strict';var client=require('../client');exports[_0xb056('0x0')]=function(_0x556e84,_0xed6810){return client[_0xb056('0x1')](_0xb056('0x2'),{'body':_0xed6810,'options':{'where':{'id':_0x556e84}},'log':_0xb056('0x3')});};exports[_0xb056('0x4')]=function(_0x4157e0,_0x343d88){return client[_0xb056('0x1')](_0xb056('0x5'),{'body':_0x343d88,'options':{'where':{'id':_0x4157e0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5b74a32..7f6575f 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 _0xdc5c=['create','Request','createMailMessage','../client'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0xdc5c,0x1c3));var _0xcdc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc5c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xcdc5('0x0'));exports[_0xcdc5('0x1')]=function(_0x4cf613){return client[_0xcdc5('0x2')]('CreateMailMessage',{'body':_0x4cf613,'log':_0xcdc5('0x3')});}; \ No newline at end of file +var _0x2d3f=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x324002,_0x59f3e7){var _0x3f43ab=function(_0xacc1b1){while(--_0xacc1b1){_0x324002['push'](_0x324002['shift']());}};_0x3f43ab(++_0x59f3e7);}(_0x2d3f,0x11b));var _0xf2d3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2d3f[_0x160c73];return _0xd9302;};'use strict';var client=require(_0xf2d3('0x0'));exports[_0xf2d3('0x1')]=function(_0x38dd22){return client[_0xf2d3('0x2')](_0xf2d3('0x3'),{'body':_0x38dd22,'log':_0xf2d3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a284989..b2866a5 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 _0x876b=['strategy','User','Agents','online','../client','getMailQueues','Request','name','timeout'];(function(_0x3b5f66,_0x1dbfc5){var _0x4aa1a8=function(_0x57c05c){while(--_0x57c05c){_0x3b5f66['push'](_0x3b5f66['shift']());}};_0x4aa1a8(++_0x1dbfc5);}(_0x876b,0xa6));var _0xb876=function(_0x3b0c1a,_0x2753c2){_0x3b0c1a=_0x3b0c1a-0x0;var _0x5cb7a6=_0x876b[_0x3b0c1a];return _0x5cb7a6;};'use strict';var client=require(_0xb876('0x0'));exports[_0xb876('0x1')]=function(){return function(){return client[_0xb876('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xb876('0x3'),_0xb876('0x4'),_0xb876('0x5')],'include':[{'model':_0xb876('0x6'),'as':_0xb876('0x7'),'attributes':['id','name',_0xb876('0x8'),'mailPause']}]},'log':_0xb876('0x1')});};}; \ No newline at end of file +var _0x0f2c=['name','timeout','strategy','User','Agents','online','../client','Request','GetMailQueue'];(function(_0x11b1e0,_0x329362){var _0x3f1b14=function(_0x473b49){while(--_0x473b49){_0x11b1e0['push'](_0x11b1e0['shift']());}};_0x3f1b14(++_0x329362);}(_0x0f2c,0x192));var _0xc0f2=function(_0x2cd0c3,_0x1488b4){_0x2cd0c3=_0x2cd0c3-0x0;var _0x3fc793=_0x0f2c[_0x2cd0c3];return _0x3fc793;};'use strict';var client=require(_0xc0f2('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xc0f2('0x1')](_0xc0f2('0x2'),{'options':{'raw':![],'attributes':['id',_0xc0f2('0x3'),_0xc0f2('0x4'),_0xc0f2('0x5')],'include':[{'model':_0xc0f2('0x6'),'as':_0xc0f2('0x7'),'attributes':['id',_0xc0f2('0x3'),_0xc0f2('0x8'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c41c56d..f80547f 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 _0xa68b=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x1b83e0,_0x1739cc){var _0x21765c=function(_0x288a21){while(--_0x288a21){_0x1b83e0['push'](_0x1b83e0['shift']());}};_0x21765c(++_0x1739cc);}(_0xa68b,0x6d));var _0xba68=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xa68b[_0x4dcc2d];return _0x1bbd79;};'use strict';var client=require(_0xba68('0x0'));exports[_0xba68('0x1')]=function(_0x21dc0e){return client[_0xba68('0x2')]('CreateMailQueueReport',{'body':_0x21dc0e,'log':_0xba68('0x3')});};exports[_0xba68('0x4')]=function(_0x507cd5,_0x5a0f1b){return client[_0xba68('0x2')](_0xba68('0x5'),{'body':_0x5a0f1b,'options':{'where':{'uniqueid':_0x507cd5},'order':[['id',_0xba68('0x6')]],'limit':0x1},'log':_0xba68('0x5')});}; \ No newline at end of file +var _0xe285=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client','create'];(function(_0x5901cb,_0x33f8aa){var _0x4ba75f=function(_0x278d05){while(--_0x278d05){_0x5901cb['push'](_0x5901cb['shift']());}};_0x4ba75f(++_0x33f8aa);}(_0xe285,0x76));var _0x5e28=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xe285[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x5e28('0x0'));exports[_0x5e28('0x1')]=function(_0x4ff0a1){return client[_0x5e28('0x2')](_0x5e28('0x3'),{'body':_0x4ff0a1,'log':_0x5e28('0x3')});};exports[_0x5e28('0x4')]=function(_0x5cd7cb,_0x40a78a){return client[_0x5e28('0x2')](_0x5e28('0x5'),{'body':_0x40a78a,'options':{'where':{'uniqueid':_0x5cd7cb},'order':[['id','DESC']],'limit':0x1},'log':_0x5e28('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e9ff5d9..ee4d30b 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 _0xcebd=['../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x45f00c,_0x35dac0){var _0x4e6781=function(_0x3f9424){while(--_0x3f9424){_0x45f00c['push'](_0x45f00c['shift']());}};_0x4e6781(++_0x35dac0);}(_0xcebd,0x9c));var _0xdceb=function(_0x300862,_0x2285ff){_0x300862=_0x300862-0x0;var _0x97b0f5=_0xcebd[_0x300862];return _0x97b0f5;};'use strict';var client=require(_0xdceb('0x0'));exports['update']=function(_0x1f6cc9,_0x278365){return client['Request'](_0xdceb('0x1'),{'body':_0x278365,'options':{'where':{'id':_0x1f6cc9}},'log':_0xdceb('0x2')});};exports[_0xdceb('0x3')]=function(_0x292e37,_0x3e6adb){return client[_0xdceb('0x4')]('AddTagsToOpenchannelInteraction',{'body':_0x3e6adb,'options':{'where':{'id':_0x292e37}},'log':_0xdceb('0x5')});}; \ No newline at end of file +var _0x0042=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0x0042,0x165));var _0x2004=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x0042[_0x5e42a7];return _0x36d21b;};'use strict';var client=require(_0x2004('0x0'));exports[_0x2004('0x1')]=function(_0x445cb3,_0x23811a){return client[_0x2004('0x2')](_0x2004('0x3'),{'body':_0x23811a,'options':{'where':{'id':_0x445cb3}},'log':_0x2004('0x4')});};exports[_0x2004('0x5')]=function(_0x5c0d6f,_0x43994a){return client[_0x2004('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x43994a,'options':{'where':{'id':_0x5c0d6f}},'log':_0x2004('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index fc4a6f9..00e900b 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 _0xf10e=['../client','Request','CreateOpenchannelMessage'];(function(_0x15a192,_0x470afc){var _0x554446=function(_0x2ceea8){while(--_0x2ceea8){_0x15a192['push'](_0x15a192['shift']());}};_0x554446(++_0x470afc);}(_0xf10e,0x132));var _0xef10=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xf10e[_0x1b7368];return _0x25d54c;};'use strict';var client=require(_0xef10('0x0'));exports['create']=function(_0x599798){return client[_0xef10('0x1')](_0xef10('0x2'),{'body':_0x599798,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xa290=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x21b4cb,_0x2bd0c3){var _0x21318b=function(_0x4bf488){while(--_0x4bf488){_0x21b4cb['push'](_0x21b4cb['shift']());}};_0x21318b(++_0x2bd0c3);}(_0xa290,0x1e4));var _0x0a29=function(_0x220a4d,_0x4f5876){_0x220a4d=_0x220a4d-0x0;var _0x11e8ab=_0xa290[_0x220a4d];return _0x11e8ab;};'use strict';var client=require(_0x0a29('0x0'));exports[_0x0a29('0x1')]=function(_0x26616f){return client['Request'](_0x0a29('0x2'),{'body':_0x26616f,'log':_0x0a29('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7b8aec3..06266a0 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 _0x37bc=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents'];(function(_0x25ab04,_0x3c0229){var _0x2681ce=function(_0x1022f1){while(--_0x1022f1){_0x25ab04['push'](_0x25ab04['shift']());}};_0x2681ce(++_0x3c0229);}(_0x37bc,0x1da));var _0xc37b=function(_0x2748c1,_0x2557ea){_0x2748c1=_0x2748c1-0x0;var _0x67939e=_0x37bc[_0x2748c1];return _0x67939e;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xc37b('0x0')](_0xc37b('0x1'),{'options':{'raw':![],'attributes':['id',_0xc37b('0x2'),'timeout',_0xc37b('0x3')],'include':[{'model':_0xc37b('0x4'),'as':_0xc37b('0x5'),'attributes':['id',_0xc37b('0x2'),'online',_0xc37b('0x6')]}]},'log':_0xc37b('0x7')});};}; \ No newline at end of file +var _0x62d2=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents','openchannelPause','../client'];(function(_0x3ed2a9,_0x1db7d0){var _0x51bc6d=function(_0xe4c76e){while(--_0xe4c76e){_0x3ed2a9['push'](_0x3ed2a9['shift']());}};_0x51bc6d(++_0x1db7d0);}(_0x62d2,0xce));var _0x262d=function(_0xbd4254,_0x31c08b){_0xbd4254=_0xbd4254-0x0;var _0x46c0f3=_0x62d2[_0xbd4254];return _0x46c0f3;};'use strict';var client=require(_0x262d('0x0'));exports[_0x262d('0x1')]=function(){return function(){return client[_0x262d('0x2')](_0x262d('0x3'),{'options':{'raw':![],'attributes':['id',_0x262d('0x4'),_0x262d('0x5'),'strategy'],'include':[{'model':_0x262d('0x6'),'as':_0x262d('0x7'),'attributes':['id','name','online',_0x262d('0x8')]}]},'log':_0x262d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 541480e..1375748 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 _0xc6fe=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x2cfed2,_0x13f9e2){var _0x347d4c=function(_0x3b9f1c){while(--_0x3b9f1c){_0x2cfed2['push'](_0x2cfed2['shift']());}};_0x347d4c(++_0x13f9e2);}(_0xc6fe,0xbc));var _0xec6f=function(_0x53be93,_0x4f74a9){_0x53be93=_0x53be93-0x0;var _0x1e9a3f=_0xc6fe[_0x53be93];return _0x1e9a3f;};'use strict';var client=require(_0xec6f('0x0'));exports[_0xec6f('0x1')]=function(_0x480e7c){return client[_0xec6f('0x2')](_0xec6f('0x3'),{'body':_0x480e7c,'log':_0xec6f('0x3')});};exports['update']=function(_0x41ed86,_0x540732){return client[_0xec6f('0x2')](_0xec6f('0x4'),{'body':_0x540732,'options':{'where':{'uniqueid':_0x41ed86},'order':[['id',_0xec6f('0x5')]],'limit':0x1},'log':_0xec6f('0x4')});}; \ No newline at end of file +var _0x4a29=['update','DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x4a29,0x18b));var _0x94a2=function(_0x3b5ebb,_0x44546e){_0x3b5ebb=_0x3b5ebb-0x0;var _0xe64cdb=_0x4a29[_0x3b5ebb];return _0xe64cdb;};'use strict';var client=require(_0x94a2('0x0'));exports[_0x94a2('0x1')]=function(_0x55ae8f){return client[_0x94a2('0x2')]('CreateOpenchannelQueueReport',{'body':_0x55ae8f,'log':_0x94a2('0x3')});};exports[_0x94a2('0x4')]=function(_0x4ccdea,_0x27948d){return client[_0x94a2('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x27948d,'options':{'where':{'uniqueid':_0x4ccdea},'order':[['id',_0x94a2('0x5')]],'limit':0x1},'log':_0x94a2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 9be6cdf..63cdf60 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 _0xfd2f=['../client','update','Request','updateSmsInteraction','addTags'];(function(_0x132ba0,_0x40d952){var _0x48fff6=function(_0x39ab2c){while(--_0x39ab2c){_0x132ba0['push'](_0x132ba0['shift']());}};_0x48fff6(++_0x40d952);}(_0xfd2f,0x14a));var _0xffd2=function(_0x383ae8,_0x3d0519){_0x383ae8=_0x383ae8-0x0;var _0x57345b=_0xfd2f[_0x383ae8];return _0x57345b;};'use strict';var client=require(_0xffd2('0x0'));exports[_0xffd2('0x1')]=function(_0x296e43,_0x5204b6){return client[_0xffd2('0x2')]('UpdateSmsInteraction',{'body':_0x5204b6,'options':{'where':{'id':_0x296e43}},'log':_0xffd2('0x3')});};exports[_0xffd2('0x4')]=function(_0x492c33,_0x983987){return client[_0xffd2('0x2')]('AddTagsToSmsInteraction',{'body':_0x983987,'options':{'where':{'id':_0x492c33}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x41f2=['update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41f2,0x14f));var _0x241f=function(_0x41341c,_0x51f9fa){_0x41341c=_0x41341c-0x0;var _0x23d163=_0x41f2[_0x41341c];return _0x23d163;};'use strict';var client=require(_0x241f('0x0'));exports[_0x241f('0x1')]=function(_0x5736b8,_0x462fef){return client[_0x241f('0x2')](_0x241f('0x3'),{'body':_0x462fef,'options':{'where':{'id':_0x5736b8}},'log':_0x241f('0x4')});};exports['addTags']=function(_0x1a7e43,_0x106ee3){return client['Request'](_0x241f('0x5'),{'body':_0x106ee3,'options':{'where':{'id':_0x1a7e43}},'log':_0x241f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c07bef5..eb74d95 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 _0x6401=['create','Request','createSmsMessage'];(function(_0x257331,_0x3333bd){var _0x1fbbff=function(_0x850310){while(--_0x850310){_0x257331['push'](_0x257331['shift']());}};_0x1fbbff(++_0x3333bd);}(_0x6401,0x180));var _0x1640=function(_0x322f27,_0x295b2e){_0x322f27=_0x322f27-0x0;var _0x4c18d4=_0x6401[_0x322f27];return _0x4c18d4;};'use strict';var client=require('../client');exports[_0x1640('0x0')]=function(_0x568872){return client[_0x1640('0x1')]('CreateSmsMessage',{'body':_0x568872,'log':_0x1640('0x2')});}; \ No newline at end of file +var _0x0a74=['create','Request','../client'];(function(_0x48f106,_0x26405c){var _0x561294=function(_0x1d6968){while(--_0x1d6968){_0x48f106['push'](_0x48f106['shift']());}};_0x561294(++_0x26405c);}(_0x0a74,0x1ac));var _0x40a7=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0x0a74[_0x4456a2];return _0xf36b56;};'use strict';var client=require(_0x40a7('0x0'));exports[_0x40a7('0x1')]=function(_0x5614b8){return client[_0x40a7('0x2')]('CreateSmsMessage',{'body':_0x5614b8,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 086d4cf..ce0745e 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2cf666,_0x390bfa){var _0x4748bd=function(_0x4d0cd){while(--_0x4d0cd){_0x2cf666['push'](_0x2cf666['shift']());}};_0x4748bd(++_0x390bfa);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x37c7c0,_0x49fde0){var _0x2021d0=function(_0x38344e){while(--_0x38344e){_0x37c7c0['push'](_0x37c7c0['shift']());}};_0x2021d0(++_0x49fde0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 95e27e5..d4048a3 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(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0xedd9,0xfc));var _0x9edd=function(_0x3ce865,_0xb4581d){_0x3ce865=_0x3ce865-0x0;var _0x50de2d=_0xedd9[_0x3ce865];return _0x50de2d;};'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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x3b74fb,_0x68a121){var _0x144977=function(_0x20eac5){while(--_0x20eac5){_0x3b74fb['push'](_0x3b74fb['shift']());}};_0x144977(++_0x68a121);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index cced4b0..4dd5a36 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(_0x5cb0d3,_0x24cb0b){var _0x169499=function(_0x3a05e9){while(--_0x3a05e9){_0x5cb0d3['push'](_0x5cb0d3['shift']());}};_0x169499(++_0x24cb0b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x3d208c,_0x489cc3){var _0x4789c0=function(_0x1219c3){while(--_0x1219c3){_0x3d208c['push'](_0x3d208c['shift']());}};_0x4789c0(++_0x489cc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 9c5182c..d34e372 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 _0x6011=['addTagsToWhatsappInteraction','UpdateWhatsappInteraction','updateWhatsappInteraction','Request','AddTagsToWhatsappInteraction'];(function(_0x361e10,_0x384f22){var _0x5f31b4=function(_0x328ea2){while(--_0x328ea2){_0x361e10['push'](_0x361e10['shift']());}};_0x5f31b4(++_0x384f22);}(_0x6011,0x196));var _0x1601=function(_0x5820f2,_0x5925ae){_0x5820f2=_0x5820f2-0x0;var _0x203d51=_0x6011[_0x5820f2];return _0x203d51;};'use strict';var client=require('../client');exports['update']=function(_0x48defa,_0x55f0f0){return client['Request'](_0x1601('0x0'),{'body':_0x55f0f0,'options':{'where':{'id':_0x48defa}},'log':_0x1601('0x1')});};exports['addTags']=function(_0x23ed9e,_0x2ede55){return client[_0x1601('0x2')](_0x1601('0x3'),{'body':_0x2ede55,'options':{'where':{'id':_0x23ed9e}},'log':_0x1601('0x4')});}; \ No newline at end of file +var _0x4f0d=['addTags','addTagsToWhatsappInteraction','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x5f124a,_0x34e5d2){var _0x3717c1=function(_0x16e713){while(--_0x16e713){_0x5f124a['push'](_0x5f124a['shift']());}};_0x3717c1(++_0x34e5d2);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0x4f0d[_0x191154];return _0x3dcd73;};'use strict';var client=require('../client');exports['update']=function(_0x4c1091,_0x5290b6){return client['Request'](_0xd4f0('0x0'),{'body':_0x5290b6,'options':{'where':{'id':_0x4c1091}},'log':_0xd4f0('0x1')});};exports[_0xd4f0('0x2')]=function(_0x577c8f,_0xb1db5){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0xb1db5,'options':{'where':{'id':_0x577c8f}},'log':_0xd4f0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 707e7b5..a3900a5 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 _0xd065=['CreateWhatsappMessage','../client','create','Request'];(function(_0x1903f3,_0x2e93e8){var _0x375395=function(_0x49fab9){while(--_0x49fab9){_0x1903f3['push'](_0x1903f3['shift']());}};_0x375395(++_0x2e93e8);}(_0xd065,0x141));var _0x5d06=function(_0x550bf5,_0x749509){_0x550bf5=_0x550bf5-0x0;var _0x297e5f=_0xd065[_0x550bf5];return _0x297e5f;};'use strict';var client=require(_0x5d06('0x0'));exports[_0x5d06('0x1')]=function(_0x27e948){return client[_0x5d06('0x2')](_0x5d06('0x3'),{'body':_0x27e948,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x6683=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x6683,0x129));var _0x3668=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x6683[_0x154940];return _0x401409;};'use strict';var client=require(_0x3668('0x0'));exports[_0x3668('0x1')]=function(_0x2eb547){return client[_0x3668('0x2')](_0x3668('0x3'),{'body':_0x2eb547,'log':_0x3668('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 1276a6e..71df314 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 _0x6bd1=['Request','GetWhatsappQueue','name','timeout','User','Agents','whatsappPause','../client','getWhatsappQueues'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x6bd1,0xe8));var _0x16bd=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x6bd1[_0x5d6456];return _0x4d66c1;};'use strict';var client=require(_0x16bd('0x0'));exports[_0x16bd('0x1')]=function(){return function(){return client[_0x16bd('0x2')](_0x16bd('0x3'),{'options':{'raw':![],'attributes':['id',_0x16bd('0x4'),_0x16bd('0x5'),'strategy'],'include':[{'model':_0x16bd('0x6'),'as':_0x16bd('0x7'),'attributes':['id',_0x16bd('0x4'),'online',_0x16bd('0x8')]}]},'log':_0x16bd('0x1')});};}; \ No newline at end of file +var _0xba79=['getWhatsappQueues','../client','Request','GetWhatsappQueue','name','User','Agents','whatsappPause'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xba79,0x101));var _0x9ba7=function(_0x2d6ab8,_0x1b6b82){_0x2d6ab8=_0x2d6ab8-0x0;var _0x339c56=_0xba79[_0x2d6ab8];return _0x339c56;};'use strict';var client=require(_0x9ba7('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x9ba7('0x1')](_0x9ba7('0x2'),{'options':{'raw':![],'attributes':['id',_0x9ba7('0x3'),'timeout','strategy'],'include':[{'model':_0x9ba7('0x4'),'as':_0x9ba7('0x5'),'attributes':['id','name','online',_0x9ba7('0x6')]}]},'log':_0x9ba7('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 68bd9c4..6614559 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 _0x24e7=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','create'];(function(_0x5b6937,_0x53154f){var _0x26c339=function(_0x20400d){while(--_0x20400d){_0x5b6937['push'](_0x5b6937['shift']());}};_0x26c339(++_0x53154f);}(_0x24e7,0xc3));var _0x724e=function(_0x34b75b,_0x3c358a){_0x34b75b=_0x34b75b-0x0;var _0xbc57d7=_0x24e7[_0x34b75b];return _0xbc57d7;};'use strict';var client=require('../client');exports[_0x724e('0x0')]=function(_0x265354){return client[_0x724e('0x1')](_0x724e('0x2'),{'body':_0x265354,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x52c389,_0x517158){return client[_0x724e('0x1')](_0x724e('0x3'),{'body':_0x517158,'options':{'where':{'uniqueid':_0x52c389},'order':[['id','DESC']],'limit':0x1},'log':_0x724e('0x3')});}; \ No newline at end of file +var _0xd815=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport'];(function(_0x4f48a7,_0x19156d){var _0x38c82a=function(_0x4caa2d){while(--_0x4caa2d){_0x4f48a7['push'](_0x4f48a7['shift']());}};_0x38c82a(++_0x19156d);}(_0xd815,0x177));var _0x5d81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd815[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5d81('0x0'));exports[_0x5d81('0x1')]=function(_0x27eab8){return client[_0x5d81('0x2')](_0x5d81('0x3'),{'body':_0x27eab8,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x1d1792,_0x2eac82){return client[_0x5d81('0x2')](_0x5d81('0x4'),{'body':_0x2eac82,'options':{'where':{'uniqueid':_0x1d1792},'order':[['id','DESC']],'limit':0x1},'log':_0x5d81('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 08cbf14..787c746 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 _0x534d=['[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','complete','info','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','length','error'];(function(_0x9fb35a,_0x1dcf54){var _0x4eb463=function(_0x85a6f3){while(--_0x85a6f3){_0x9fb35a['push'](_0x9fb35a['shift']());}};_0x4eb463(++_0x1dcf54);}(_0x534d,0x127));var _0xd534=function(_0x54e721,_0x285783){_0x54e721=_0x54e721-0x0;var _0x23374d=_0x534d[_0x54e721];return _0x23374d;};'use strict';var schema=require(_0xd534('0x0'));var _=require(_0xd534('0x1'));var util=require(_0xd534('0x2'));var seqqueue=require(_0xd534('0x3'));var logger=require(_0xd534('0x4'))(_0xd534('0x5'));var strategy=require(_0xd534('0x6'));var queue=schema({'name':{'type':_0xd534('0x7'),'required':!![],'message':_0xd534('0x8')},'timeout':{'type':_0xd534('0x9'),'message':_0xd534('0xa')}});function writeLog(_0x1cf03a,_0x2eddc7,_0x1f6bb5){return logger['info'](util[_0xd534('0xb')](_0xd534('0xc'),_0x1cf03a,_0x2eddc7[_0xd534('0xd')],_0x1f6bb5));}function handleFindAgent(_0xf3d14){return function(_0xeb029f){return _0xeb029f[_0xd534('0xd')]['toLowerCase']()===_0xf3d14['toLowerCase']();};}exports[_0xd534('0xe')]=function(_0x2ec21c,_0x579334,_0x3f2bf7,_0x311ae1){return function(_0x563bc2){try{var _0x3b1146={'name':_0x579334[0x0],'timeout':_0x579334[0x1]};var _0x361381=queue['validate'](_0x3b1146,{'typecast':!![]});if(_0x361381[_0xd534('0xf')]){logger[_0xd534('0x10')](_0xd534('0x11'),_0x2ec21c,_[_0xd534('0x12')](_0x361381,_0xd534('0x13'))[_0xd534('0x14')](',\x20'));_0x563bc2[_0xd534('0x15')]();}else{var _0x221868=_[_0xd534('0x16')](_0x3f2bf7['agents'],handleFindAgent(_0x3b1146[_0xd534('0xd')]));if(_0x221868){var _0x24eb2a=(_0x3b1146[_0xd534('0x17')]||0xa)*0x3e8;var _0x457166,_0x153561;var _0x337e08=seqqueue[_0xd534('0x18')](_0x24eb2a);_0x337e08['id']=_0x2ec21c;_0x337e08[_0xd534('0x19')]=_0x24eb2a;_0x337e08[_0xd534('0x1a')]=_0x311ae1[_0xd534('0x1a')];writeLog(_0x2ec21c,_0x221868,util[_0xd534('0xb')](_0xd534('0x1b'),_0x24eb2a));_0x3f2bf7[_0xd534('0x1c')][_0x2ec21c]['on'](_0xd534('0x1d'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x2ec21c);clearTimeout(_0x153561);_0x153561=undefined;_0x337e08['close']();if(_0x3f2bf7[_0xd534('0x1c')][_0x2ec21c]){delete _0x3f2bf7['rules'][_0x2ec21c];}_0x563bc2[_0xd534('0x15')]();});_0x3f2bf7[_0xd534('0x1c')][_0x2ec21c]['on'](_0xd534('0x1e'),function(){if(_0x3f2bf7[_0xd534('0x1c')][_0x2ec21c]){delete _0x3f2bf7['rules'][_0x2ec21c];}});_0x153561=setTimeout(function(){logger[_0xd534('0x1f')]('[%s][AGENT]\x20ROUTING\x20END',_0x2ec21c);clearTimeout(_0x153561);_0x337e08[_0xd534('0x20')]();_0x563bc2[_0xd534('0x21')]();},_0x24eb2a);strategy[_0xd534('0x22')](_0x337e08,_0x221868,_0x3f2bf7,_0x311ae1);}else{logger[_0xd534('0x10')](_0xd534('0x23'),_0x2ec21c,_0x3b1146[_0xd534('0xd')]);_0x563bc2['stop']();}}}catch(_0x5cc5a5){console[_0xd534('0x24')](_0x5cc5a5);logger[_0xd534('0x10')](_0xd534('0x25'),_0x2ec21c,_0x5cc5a5[_0xd534('0x26')]);_0x563bc2[_0xd534('0x15')]();}};}; \ No newline at end of file +var _0x15c9=['atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','error','stack','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue'];(function(_0x590ef7,_0x175f08){var _0x4c2634=function(_0xf94570){while(--_0xf94570){_0x590ef7['push'](_0x590ef7['shift']());}};_0x4c2634(++_0x175f08);}(_0x15c9,0xcc));var _0x915c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x15c9[_0x2641f9];return _0x585741;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x915c('0x0'));var seqqueue=require(_0x915c('0x1'));var logger=require(_0x915c('0x2'))(_0x915c('0x3'));var strategy=require(_0x915c('0x4'));var queue=schema({'name':{'type':_0x915c('0x5'),'required':!![],'message':_0x915c('0x6')},'timeout':{'type':_0x915c('0x7'),'message':_0x915c('0x8')}});function writeLog(_0x22aa78,_0x19be1b,_0x21169d){return logger[_0x915c('0x9')](util[_0x915c('0xa')](_0x915c('0xb'),_0x22aa78,_0x19be1b[_0x915c('0xc')],_0x21169d));}function handleFindAgent(_0x3b2a9c){return function(_0x55a31a){return _0x55a31a[_0x915c('0xc')]['toLowerCase']()===_0x3b2a9c[_0x915c('0xd')]();};}exports[_0x915c('0xe')]=function(_0x40e079,_0x180b8d,_0x1e785,_0x1536ee){return function(_0x5df353){try{var _0x4ada8f={'name':_0x180b8d[0x0],'timeout':_0x180b8d[0x1]};var _0x3b08e3=queue[_0x915c('0xf')](_0x4ada8f,{'typecast':!![]});if(_0x3b08e3['length']){logger['error'](_0x915c('0x10'),_0x40e079,_[_0x915c('0x11')](_0x3b08e3,_0x915c('0x12'))[_0x915c('0x13')](',\x20'));_0x5df353[_0x915c('0x14')]();}else{var _0x593ffb=_['find'](_0x1e785[_0x915c('0x15')],handleFindAgent(_0x4ada8f['name']));if(_0x593ffb){var _0x26407e=(_0x4ada8f[_0x915c('0x16')]||0xa)*0x3e8;var _0x5d0689,_0x40372f;var _0x10afb6=seqqueue[_0x915c('0x17')](_0x26407e);_0x10afb6['id']=_0x40e079;_0x10afb6[_0x915c('0x18')]=_0x26407e;_0x10afb6['channel']=_0x1536ee[_0x915c('0x19')];writeLog(_0x40e079,_0x593ffb,util[_0x915c('0xa')](_0x915c('0x1a'),_0x26407e));_0x1e785[_0x915c('0x1b')][_0x40e079]['on'](_0x915c('0x1c'),function(){logger[_0x915c('0x9')](_0x915c('0x1d'),_0x40e079);clearTimeout(_0x40372f);_0x40372f=undefined;_0x10afb6[_0x915c('0x1e')]();if(_0x1e785['rules'][_0x40e079]){delete _0x1e785[_0x915c('0x1b')][_0x40e079];}_0x5df353['stop']();});_0x1e785[_0x915c('0x1b')][_0x40e079]['on'](_0x915c('0x1f'),function(){if(_0x1e785[_0x915c('0x1b')][_0x40e079]){delete _0x1e785['rules'][_0x40e079];}});_0x40372f=setTimeout(function(){logger[_0x915c('0x9')](_0x915c('0x20'),_0x40e079);clearTimeout(_0x40372f);_0x10afb6[_0x915c('0x1e')]();_0x5df353[_0x915c('0x21')]();},_0x26407e);strategy[_0x915c('0x22')](_0x10afb6,_0x593ffb,_0x1e785,_0x1536ee);}else{logger['error'](_0x915c('0x23'),_0x40e079,_0x4ada8f[_0x915c('0xc')]);_0x5df353['stop']();}}}catch(_0x1e5452){console['log'](_0x1e5452);logger[_0x915c('0x24')]('[%s][QUEUE]\x20%s',_0x40e079,_0x1e5452[_0x915c('0x25')]);_0x5df353['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 62d9bdd..c36b34e 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 _0xda1d=['aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','amazonlex','providerName','providerResponse','dialogState','moment'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0xda1d,0x80));var _0xdda1=function(_0x4053cf,_0x14397f){_0x4053cf=_0x4053cf-0x0;var _0x3bf960=_0xda1d[_0x4053cf];return _0x3bf960;};'use strict';var _=require('lodash');var moment=require(_0xdda1('0x0'));var AWS=require(_0xdda1('0x1'));var utils=require(_0xdda1('0x2'));var logger=require(_0xdda1('0x3'))(_0xdda1('0x4'));var rpc={'chatMessage':require(_0xdda1('0x5')),'openchannelMessage':require(_0xdda1('0x6')),'mailMessage':require(_0xdda1('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdda1('0x8')),'whatsappMessage':require(_0xdda1('0x9'))};exports[_0xdda1('0xa')]=function(_0x1edcee,_0x4973ac){return function(_0x46c3dc){try{if(!_['isNil'](this[_0xdda1('0xb')][_0xdda1('0xc')])){logger[_0xdda1('0xd')](_0xdda1('0xe'),_0x1edcee,_0xdda1('0xf'));return _0x46c3dc[_0xdda1('0x10')]();}var _0x53e276={'ContactId':this[_0xdda1('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdda1('0x12')};if(this[_0xdda1('0x13')]==='sms'||this[_0xdda1('0x13')]===_0xdda1('0x14')){_0x53e276[_0xdda1('0x15')]=this[_0xdda1('0xb')][_0xdda1('0x15')];}var _0x1ad265=this[_0xdda1('0x13')];if(_0x1ad265==='chat'){_0x53e276[_0xdda1('0x16')]=this[_0xdda1('0x17')]['id'];}else{_0x53e276[_[_0xdda1('0x18')](_0x1ad265)+'AccountId']=this[_0xdda1('0x17')]['id'];}_0x53e276[_[_0xdda1('0x18')](_0x1ad265)+_0xdda1('0x19')]=this[_0xdda1('0xb')]['id'];if(this['interaction'][_0xdda1('0x1a')]){var _0x5545b7=_0x4973ac[0x4];if(!_[_0xdda1('0x1b')](_0x5545b7)){_0x53e276[_0xdda1('0x1c')]=utils[_0xdda1('0x1d')](_0x5545b7,this);return rpc[_0x1ad265+_0xdda1('0x1e')][_0xdda1('0x1f')](_0x53e276)[_0xdda1('0x20')](function(_0x43a1b6){logger[_0xdda1('0xd')](_0xdda1('0xe'),_0x1edcee,_0x53e276[_0xdda1('0x1c')]);})[_0xdda1('0x21')](function(_0xa74204){logger[_0xdda1('0x22')](_0xdda1('0xe'),_0x1edcee,JSON[_0xdda1('0x23')](_0xa74204));})['finally'](function(){logger[_0xdda1('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1edcee);_0x46c3dc[_0xdda1('0x24')]();});}else{logger[_0xdda1('0xd')](_0xdda1('0x25'),_0x1edcee);_0x46c3dc[_0xdda1('0x24')]();}}else{var _0x230ba2=this;var _0x363cb2=new AWS['LexRuntime']({'accessKeyId':_0x4973ac[0x0],'secretAccessKey':_0x4973ac[0x1],'region':_0x4973ac[0x2]});var _0x6a14c5={'botAlias':'$LATEST','botName':_0x4973ac[0x3],'inputText':this[_0xdda1('0x26')][_0xdda1('0x1c')],'userId':this[_0xdda1('0x13')]+':'+this[_0xdda1('0xb')]['id']['toString']()};_0x363cb2['postText'](_0x6a14c5,function(_0x47518b,_0x5d4f63){if(_0x47518b){logger['error'](_0xdda1('0xe'),_0x1edcee,_0x47518b[_0xdda1('0x26')]);_0x46c3dc[_0xdda1('0x10')]();}else if(_0x5d4f63&&_0x5d4f63['message']){_0x230ba2[_0xdda1('0x1c')][_0xdda1('0x27')]=_0x5d4f63;_0x53e276[_0xdda1('0x1c')]=_0x5d4f63[_0xdda1('0x26')];_0x53e276[_0xdda1('0x28')]=_0xdda1('0x27');_0x53e276[_0xdda1('0x29')]=JSON['stringify'](_0x5d4f63);return rpc[_0x1ad265+_0xdda1('0x1e')][_0xdda1('0x1f')](_0x53e276)[_0xdda1('0x20')](function(_0x1ef32b){logger[_0xdda1('0xd')](_0xdda1('0xe'),_0x1edcee,_0x53e276[_0xdda1('0x1c')]);if(_0x5d4f63[_0xdda1('0x2a')]=='Failed'){_0x46c3dc[_0xdda1('0x10')]();}else{_0x46c3dc[_0xdda1('0x24')]();}})[_0xdda1('0x21')](function(_0x348fdf){logger[_0xdda1('0x22')](_0xdda1('0xe'),_0x1edcee,JSON[_0xdda1('0x23')](_0x348fdf));_0x46c3dc['next']();});}else{_0x46c3dc['next']();}});}}catch(_0x4af372){logger[_0xdda1('0x22')](_0xdda1('0xe'),_0x1edcee,JSON['stringify'](_0x4af372));_0x46c3dc['stop']();}};}; \ No newline at end of file +var _0x1c63=['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','postText','amazonlex','providerName','providerResponse','Message','dialogState','Failed','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','stringify'];(function(_0x1ca12d,_0x2bb976){var _0x3dc560=function(_0x237ce2){while(--_0x237ce2){_0x1ca12d['push'](_0x1ca12d['shift']());}};_0x3dc560(++_0x2bb976);}(_0x1c63,0x134));var _0x31c6=function(_0x58dc03,_0x1c0b28){_0x58dc03=_0x58dc03-0x0;var _0x2f14bb=_0x1c63[_0x58dc03];return _0x2f14bb;};'use strict';var _=require('lodash');var moment=require(_0x31c6('0x0'));var AWS=require(_0x31c6('0x1'));var utils=require(_0x31c6('0x2'));var logger=require('../../../../config/logger')(_0x31c6('0x3'));var rpc={'chatMessage':require(_0x31c6('0x4')),'openchannelMessage':require(_0x31c6('0x5')),'mailMessage':require(_0x31c6('0x6')),'smsMessage':require(_0x31c6('0x7')),'faxMessage':require(_0x31c6('0x8')),'whatsappMessage':require(_0x31c6('0x9'))};exports[_0x31c6('0xa')]=function(_0x2c82f0,_0x39c6cb){return function(_0x4accb5){try{if(!_['isNil'](this[_0x31c6('0xb')][_0x31c6('0xc')])){logger[_0x31c6('0xd')](_0x31c6('0xe'),_0x2c82f0,_0x31c6('0xf'));return _0x4accb5[_0x31c6('0x10')]();}var _0x3edebb={'ContactId':this[_0x31c6('0x11')]['id'],'sentAt':moment()[_0x31c6('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x31c6('0x13')||this['channel']===_0x31c6('0x14')){_0x3edebb[_0x31c6('0x15')]=this['interaction']['phone'];}var _0x58664e=this[_0x31c6('0x16')];if(_0x58664e===_0x31c6('0x17')){_0x3edebb[_0x31c6('0x18')]=this[_0x31c6('0x19')]['id'];}else{_0x3edebb[_['upperFirst'](_0x58664e)+'AccountId']=this[_0x31c6('0x19')]['id'];}_0x3edebb[_['upperFirst'](_0x58664e)+_0x31c6('0x1a')]=this[_0x31c6('0xb')]['id'];if(this[_0x31c6('0xb')]['created']){var _0x29bc41=_0x39c6cb[0x4];if(!_[_0x31c6('0x1b')](_0x29bc41)){_0x3edebb[_0x31c6('0x1c')]=utils[_0x31c6('0x1d')](_0x29bc41,this);return rpc[_0x58664e+'Message'][_0x31c6('0x1e')](_0x3edebb)[_0x31c6('0x1f')](function(_0xe4f51){logger[_0x31c6('0xd')](_0x31c6('0xe'),_0x2c82f0,_0x3edebb[_0x31c6('0x1c')]);})[_0x31c6('0x20')](function(_0x520e8c){logger[_0x31c6('0x21')](_0x31c6('0xe'),_0x2c82f0,JSON[_0x31c6('0x22')](_0x520e8c));})[_0x31c6('0x23')](function(){logger[_0x31c6('0xd')](_0x31c6('0x24'),_0x2c82f0);_0x4accb5[_0x31c6('0x25')]();});}else{logger[_0x31c6('0xd')](_0x31c6('0x26'),_0x2c82f0);_0x4accb5[_0x31c6('0x25')]();}}else{var _0x3d3dcb=this;var _0x1b81c5=new AWS[(_0x31c6('0x27'))]({'accessKeyId':_0x39c6cb[0x0],'secretAccessKey':_0x39c6cb[0x1],'region':_0x39c6cb[0x2]});var _0x53469f={'botAlias':_0x31c6('0x28'),'botName':_0x39c6cb[0x3],'inputText':this[_0x31c6('0x29')][_0x31c6('0x1c')],'userId':this[_0x31c6('0x16')]+':'+this[_0x31c6('0xb')]['id']['toString']()};_0x1b81c5[_0x31c6('0x2a')](_0x53469f,function(_0x4f4c3c,_0x7aed75){if(_0x4f4c3c){logger[_0x31c6('0x21')](_0x31c6('0xe'),_0x2c82f0,_0x4f4c3c[_0x31c6('0x29')]);_0x4accb5[_0x31c6('0x10')]();}else if(_0x7aed75&&_0x7aed75[_0x31c6('0x29')]){_0x3d3dcb[_0x31c6('0x1c')][_0x31c6('0x2b')]=_0x7aed75;_0x3edebb[_0x31c6('0x1c')]=_0x7aed75[_0x31c6('0x29')];_0x3edebb[_0x31c6('0x2c')]=_0x31c6('0x2b');_0x3edebb[_0x31c6('0x2d')]=JSON[_0x31c6('0x22')](_0x7aed75);return rpc[_0x58664e+_0x31c6('0x2e')][_0x31c6('0x1e')](_0x3edebb)[_0x31c6('0x1f')](function(_0x1f14d1){logger['info'](_0x31c6('0xe'),_0x2c82f0,_0x3edebb[_0x31c6('0x1c')]);if(_0x7aed75[_0x31c6('0x2f')]==_0x31c6('0x30')){_0x4accb5[_0x31c6('0x10')]();}else{_0x4accb5['stop']();}})[_0x31c6('0x20')](function(_0x11bedb){logger[_0x31c6('0x21')](_0x31c6('0xe'),_0x2c82f0,JSON[_0x31c6('0x22')](_0x11bedb));_0x4accb5[_0x31c6('0x10')]();});}else{_0x4accb5['next']();}});}}catch(_0xee6a0a){logger['error'](_0x31c6('0xe'),_0x2c82f0,JSON[_0x31c6('0x22')](_0xee6a0a));_0x4accb5[_0x31c6('0x25')]();}};}; \ 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 08d6ccc..cf6c3ac 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 _0x574f=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','autoreplyExecuted','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','Smtp','service','host','port','secure','auth','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','then','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x574f,0x8e));var _0xf574=function(_0x20cfdb,_0x9f1186){_0x20cfdb=_0x20cfdb-0x0;var _0x931c65=_0x574f[_0x20cfdb];return _0x931c65;};'use strict';var _=require(_0xf574('0x0'));var moment=require('moment');var utils=require(_0xf574('0x1'));var logger=require(_0xf574('0x2'))(_0xf574('0x3'));var rpc={'chatMessage':require(_0xf574('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf574('0x5')),'smsMessage':require(_0xf574('0x6')),'faxMessage':require(_0xf574('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xf574('0x8')),'openchannelInteraction':require(_0xf574('0x9')),'mailInteraction':require(_0xf574('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xf574('0xb')),'whatsappInteraction':require(_0xf574('0xc'))};var mailRpc=require(_0xf574('0xd'));exports[_0xf574('0xe')]=function(_0x403e03,_0x3acbca,_0x4b65a0,_0x3b9a32){return function(_0x127dbe){try{var _0x24c89c=this['channel'];if(_0x24c89c==='mail'&&_0x3b9a32['body'][_0xf574('0xf')]){logger[_0xf574('0x10')](_0xf574('0x11'),_0x403e03,_0xf574('0x12'));return _0x127dbe['next']();}if(_0x3acbca[0x0]==='1'&&(_[_0xf574('0x13')](this[_0xf574('0x14')]['created'])||!this['interaction'][_0xf574('0x15')])){logger[_0xf574('0x10')]('[%s][AUTOREPLY]\x20%s',_0x403e03,'Autoreply\x20already\x20sent');return _0x127dbe['next']();}if(_0x3acbca[0x0]==='2'&&this[_0xf574('0x14')][_0xf574('0x16')]){logger[_0xf574('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x403e03,'One\x20Time\x20already\x20sent');return _0x127dbe[_0xf574('0x17')]();}var _0x2c670b={'ContactId':this[_0xf574('0x18')]['id'],'sentAt':moment()[_0xf574('0x19')](_0xf574('0x1a')),'direction':_0xf574('0x1b')};if(this[_0xf574('0x1c')]===_0xf574('0x1d')){_0x2c670b[_0xf574('0x1e')]=utils[_0xf574('0x1f')](_0x3acbca[0x2],this);}else{_0x2c670b[_0xf574('0x1e')]=utils[_0xf574('0x1f')](_0x3acbca[0x1],this);}if(this[_0xf574('0x20')]){_0x2c670b['to']=this[_0xf574('0x20')][_0xf574('0x21')]||'';if(this[_0xf574('0x1c')]===_0xf574('0x1d')&&_0x3acbca[0x1]==='1'){_0x2c670b['cc']=this['message']['cc']||'';}_0x2c670b[_0xf574('0x21')]=this[_0xf574('0x20')]['to']||'';_0x2c670b[_0xf574('0x22')]=this[_0xf574('0x20')][_0xf574('0x22')]||'';_0x2c670b[_0xf574('0x23')]=!![];if(this[_0xf574('0x20')]['subject']){_0x2c670b[_0xf574('0x24')]='';_0x2c670b[_0xf574('0x24')]+=_[_0xf574('0x25')](this[_0xf574('0x20')][_0xf574('0x24')],_0xf574('0x26'))?'':_0xf574('0x27');_0x2c670b[_0xf574('0x24')]+=this[_0xf574('0x20')]['subject'];}}if(this[_0xf574('0x1c')]==='chat'){_0x2c670b['ChatWebsiteId']=this[_0xf574('0x28')]['id'];}else{_0x2c670b[_[_0xf574('0x29')](this[_0xf574('0x1c')])+_0xf574('0x2a')]=this['account']['id'];}_0x2c670b[_[_0xf574('0x29')](this[_0xf574('0x1c')])+_0xf574('0x2b')]=this[_0xf574('0x14')]['id'];var _0x4674f3=this[_0xf574('0x14')];if(rpc[this['channel']+'Message']){if(this[_0xf574('0x1c')]===_0xf574('0x1d')){var _0x41a7e2={'tls':{'rejectUnauthorized':![]}};if(this[_0xf574('0x28')][_0xf574('0x2c')][_0xf574('0x2d')]){_0x41a7e2[_0xf574('0x2d')]=this[_0xf574('0x28')][_0xf574('0x2c')][_0xf574('0x2d')];}else{_0x41a7e2[_0xf574('0x2e')]=this[_0xf574('0x28')][_0xf574('0x2c')]['host'];_0x41a7e2[_0xf574('0x2f')]=this[_0xf574('0x28')][_0xf574('0x2c')][_0xf574('0x2f')];_0x41a7e2[_0xf574('0x30')]=this[_0xf574('0x28')][_0xf574('0x2c')][_0xf574('0x30')];}if(this['account'][_0xf574('0x2c')]['authentication']){_0x41a7e2[_0xf574('0x31')]={'user':this['account']['Smtp']['user'],'pass':this[_0xf574('0x28')]['Smtp']['pass']};}_0x2c670b[_0xf574('0x32')]=this[_0xf574('0x20')][_0xf574('0x33')];_0x2c670b[_0xf574('0x34')]=_0xf574('0x35')+_[_0xf574('0x36')](_0x2c670b[_0xf574('0x1e')],_0xf574('0x37'),_0xf574('0x38'))+_0xf574('0x39');_0x2c670b[_0xf574('0x3a')]={'Auto-Submitted':_0xf574('0x3b'),'X-Auto-Response-Suppress':_0xf574('0x3c'),'Precedence':_0xf574('0x3d')};return mailRpc[_0xf574('0x3e')](_0x41a7e2,_0x2c670b)['then'](function(_0x2320e5){logger[_0xf574('0x10')](_0xf574('0x3f'),_0x403e03);_0x2c670b['messageId']=_0x2320e5['message'][_0xf574('0x33')];return rpc[_0x24c89c+_0xf574('0x40')]['create'](_0x2c670b);})['then'](function(_0x4d4362){logger[_0xf574('0x10')]('[%s][AUTOREPLY]\x20%s',_0x403e03,JSON[_0xf574('0x41')](_0x4d4362));})['catch'](function(_0x34320e){logger[_0xf574('0x42')](_0xf574('0x43'),_0x403e03,JSON['stringify'](_0x34320e));})['finally'](function(){Promise[_0xf574('0x44')]()[_0xf574('0x45')](function(){if(_0x3acbca[0x0]!=='2'||_0x4674f3['autoreplyExecuted'])return;return rpc[_0x24c89c+_0xf574('0x46')][_0xf574('0x47')](_0x4674f3['id'],{'autoreplyExecuted':!![]})[_0xf574('0x45')](function(_0x57f6dd){logger[_0xf574('0x10')](_0xf574('0x48'),_0x403e03,JSON[_0xf574('0x41')](_0x57f6dd));})[_0xf574('0x49')](function(_0x131439){logger[_0xf574('0x42')](_0xf574('0x4a'),_0x403e03,JSON[_0xf574('0x41')](_0x131439));});})[_0xf574('0x45')](function(){_0x127dbe[_0xf574('0x17')]();});});}else{return rpc[this[_0xf574('0x1c')]+'Message']['create'](_0x2c670b)[_0xf574('0x45')](function(_0x53ddd2){logger[_0xf574('0x10')](_0xf574('0x11'),_0x403e03,_0x2c670b[_0xf574('0x1e')]);})[_0xf574('0x49')](function(_0x524ef6){logger['error'](_0xf574('0x11'),_0x403e03,JSON[_0xf574('0x41')](_0x524ef6));})[_0xf574('0x4b')](function(){Promise[_0xf574('0x44')]()[_0xf574('0x45')](function(){if(_0x3acbca[0x0]!=='2'||_0x4674f3[_0xf574('0x16')])return;return rpc[_0x24c89c+_0xf574('0x46')][_0xf574('0x47')](_0x4674f3['id'],{'autoreplyExecuted':!![]})[_0xf574('0x45')](function(_0x253097){logger[_0xf574('0x10')](_0xf574('0x48'),_0x403e03,JSON['stringify'](_0x253097));})[_0xf574('0x49')](function(_0x11edd3){logger['error'](_0xf574('0x4a'),_0x403e03,JSON[_0xf574('0x41')](_0x11edd3));});})[_0xf574('0x45')](function(){_0x127dbe[_0xf574('0x17')]();});});}}}catch(_0xf95b92){logger[_0xf574('0x42')]('[%s][AUTOREPLY]\x20%s',_0x403e03,JSON['stringify'](_0xf95b92));_0x127dbe['stop']();}};}; \ No newline at end of file +var _0xef38=['../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','InteractionId','Message','Smtp','service','account','host','port','secure','pass','inReplyTo','','','headers','auto-replied','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x32d8a4,_0x5436c8){var _0x30e62c=function(_0x20fbc6){while(--_0x20fbc6){_0x32d8a4['push'](_0x32d8a4['shift']());}};_0x30e62c(++_0x5436c8);}(_0xef38,0x16f));var _0x8ef3=function(_0x5e009f,_0xa51ac5){_0x5e009f=_0x5e009f-0x0;var _0x7e50a0=_0xef38[_0x5e009f];return _0x7e50a0;};'use strict';var _=require('lodash');var moment=require(_0x8ef3('0x0'));var utils=require(_0x8ef3('0x1'));var logger=require(_0x8ef3('0x2'))('routing');var rpc={'chatMessage':require(_0x8ef3('0x3')),'openchannelMessage':require(_0x8ef3('0x4')),'mailMessage':require(_0x8ef3('0x5')),'smsMessage':require(_0x8ef3('0x6')),'faxMessage':require(_0x8ef3('0x7')),'whatsappMessage':require(_0x8ef3('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8ef3('0x9')),'mailInteraction':require(_0x8ef3('0xa')),'smsInteraction':require(_0x8ef3('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8ef3('0xc'))};var mailRpc=require(_0x8ef3('0xd'));exports[_0x8ef3('0xe')]=function(_0x5cc0ef,_0x160389,_0x1453ff,_0xe417f1){return function(_0x115ecc){try{var _0x2eea1c=this[_0x8ef3('0xf')];if(_0x2eea1c===_0x8ef3('0x10')&&_0xe417f1[_0x8ef3('0x11')][_0x8ef3('0x12')]){logger['info'](_0x8ef3('0x13'),_0x5cc0ef,_0x8ef3('0x14'));return _0x115ecc[_0x8ef3('0x15')]();}if(_0x160389[0x0]==='1'&&(_[_0x8ef3('0x16')](this[_0x8ef3('0x17')]['created'])||!this['interaction'][_0x8ef3('0x18')])){logger[_0x8ef3('0x19')]('[%s][AUTOREPLY]\x20%s',_0x5cc0ef,_0x8ef3('0x1a'));return _0x115ecc[_0x8ef3('0x15')]();}if(_0x160389[0x0]==='2'&&this[_0x8ef3('0x17')]['autoreplyExecuted']){logger[_0x8ef3('0x19')](_0x8ef3('0x1b'),_0x5cc0ef,_0x8ef3('0x1c'));return _0x115ecc['next']();}var _0x2184f2={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8ef3('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8ef3('0x1e')};if(this[_0x8ef3('0xf')]===_0x8ef3('0x10')){_0x2184f2[_0x8ef3('0x11')]=utils['getMustacheRender'](_0x160389[0x2],this);}else{_0x2184f2['body']=utils[_0x8ef3('0x1f')](_0x160389[0x1],this);}if(this[_0x8ef3('0x20')]){_0x2184f2['to']=this[_0x8ef3('0x20')][_0x8ef3('0x21')]||'';if(this[_0x8ef3('0xf')]===_0x8ef3('0x10')&&_0x160389[0x1]==='1'){_0x2184f2['cc']=this[_0x8ef3('0x20')]['cc']||'';}_0x2184f2['from']=this['message']['to']||'';_0x2184f2[_0x8ef3('0x22')]=this[_0x8ef3('0x20')][_0x8ef3('0x22')]||'';_0x2184f2['read']=!![];if(this[_0x8ef3('0x20')]['subject']){_0x2184f2[_0x8ef3('0x23')]='';_0x2184f2[_0x8ef3('0x23')]+=_[_0x8ef3('0x24')](this[_0x8ef3('0x20')]['subject'],_0x8ef3('0x25'))?'':_0x8ef3('0x26');_0x2184f2[_0x8ef3('0x23')]+=this[_0x8ef3('0x20')][_0x8ef3('0x23')];}}if(this[_0x8ef3('0xf')]===_0x8ef3('0x27')){_0x2184f2[_0x8ef3('0x28')]=this['account']['id'];}else{_0x2184f2[_['upperFirst'](this[_0x8ef3('0xf')])+'AccountId']=this['account']['id'];}_0x2184f2[_[_0x8ef3('0x29')](this[_0x8ef3('0xf')])+_0x8ef3('0x2a')]=this[_0x8ef3('0x17')]['id'];var _0x41fc7b=this['interaction'];if(rpc[this[_0x8ef3('0xf')]+_0x8ef3('0x2b')]){if(this[_0x8ef3('0xf')]===_0x8ef3('0x10')){var _0x20537e={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x8ef3('0x2c')]['service']){_0x20537e[_0x8ef3('0x2d')]=this[_0x8ef3('0x2e')][_0x8ef3('0x2c')]['service'];}else{_0x20537e[_0x8ef3('0x2f')]=this[_0x8ef3('0x2e')]['Smtp']['host'];_0x20537e[_0x8ef3('0x30')]=this[_0x8ef3('0x2e')]['Smtp'][_0x8ef3('0x30')];_0x20537e[_0x8ef3('0x31')]=this[_0x8ef3('0x2e')]['Smtp']['secure'];}if(this['account'][_0x8ef3('0x2c')]['authentication']){_0x20537e['auth']={'user':this['account'][_0x8ef3('0x2c')]['user'],'pass':this[_0x8ef3('0x2e')][_0x8ef3('0x2c')][_0x8ef3('0x32')]};}_0x2184f2[_0x8ef3('0x33')]=this[_0x8ef3('0x20')]['messageId'];_0x2184f2['html']=_0x8ef3('0x34')+_['replace'](_0x2184f2[_0x8ef3('0x11')],_0x8ef3('0x35'),_0x8ef3('0x36'))+_0x8ef3('0x37');_0x2184f2[_0x8ef3('0x38')]={'Auto-Submitted':_0x8ef3('0x39'),'X-Auto-Response-Suppress':'All','Precedence':_0x8ef3('0x3a')};return mailRpc[_0x8ef3('0x3b')](_0x20537e,_0x2184f2)['then'](function(_0x21a8c7){logger[_0x8ef3('0x19')](_0x8ef3('0x3c'),_0x5cc0ef);_0x2184f2[_0x8ef3('0x3d')]=_0x21a8c7[_0x8ef3('0x20')][_0x8ef3('0x3d')];return rpc[_0x2eea1c+_0x8ef3('0x2b')][_0x8ef3('0x3e')](_0x2184f2);})[_0x8ef3('0x3f')](function(_0x1d3398){logger[_0x8ef3('0x19')]('[%s][AUTOREPLY]\x20%s',_0x5cc0ef,JSON[_0x8ef3('0x40')](_0x1d3398));})[_0x8ef3('0x41')](function(_0xdb3607){logger['error'](_0x8ef3('0x42'),_0x5cc0ef,JSON[_0x8ef3('0x40')](_0xdb3607));})[_0x8ef3('0x43')](function(){Promise[_0x8ef3('0x44')]()[_0x8ef3('0x3f')](function(){if(_0x160389[0x0]!=='2'||_0x41fc7b[_0x8ef3('0x45')])return;return rpc[_0x2eea1c+_0x8ef3('0x46')][_0x8ef3('0x47')](_0x41fc7b['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4ec569){logger[_0x8ef3('0x19')](_0x8ef3('0x1b'),_0x5cc0ef,JSON[_0x8ef3('0x40')](_0x4ec569));})['catch'](function(_0x2b949b){logger[_0x8ef3('0x48')](_0x8ef3('0x49'),_0x5cc0ef,JSON[_0x8ef3('0x40')](_0x2b949b));});})['then'](function(){_0x115ecc[_0x8ef3('0x15')]();});});}else{return rpc[this['channel']+'Message']['create'](_0x2184f2)[_0x8ef3('0x3f')](function(_0x57d9c3){logger[_0x8ef3('0x19')]('[%s][AUTOREPLY]\x20%s',_0x5cc0ef,_0x2184f2[_0x8ef3('0x11')]);})[_0x8ef3('0x41')](function(_0xc6367e){logger['error']('[%s][AUTOREPLY]\x20%s',_0x5cc0ef,JSON[_0x8ef3('0x40')](_0xc6367e));})[_0x8ef3('0x43')](function(){Promise[_0x8ef3('0x44')]()[_0x8ef3('0x3f')](function(){if(_0x160389[0x0]!=='2'||_0x41fc7b[_0x8ef3('0x45')])return;return rpc[_0x2eea1c+'Interaction'][_0x8ef3('0x47')](_0x41fc7b['id'],{'autoreplyExecuted':!![]})[_0x8ef3('0x3f')](function(_0x46f8f9){logger[_0x8ef3('0x19')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5cc0ef,JSON[_0x8ef3('0x40')](_0x46f8f9));})[_0x8ef3('0x41')](function(_0x28454e){logger[_0x8ef3('0x48')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5cc0ef,JSON[_0x8ef3('0x40')](_0x28454e));});})['then'](function(){_0x115ecc['next']();});});}}}catch(_0x5d971c){logger['error']('[%s][AUTOREPLY]\x20%s',_0x5cc0ef,JSON[_0x8ef3('0x40')](_0x5d971c));_0x115ecc[_0x8ef3('0x4a')]();}};}; \ 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 4aa0a56..7a66de9 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 _0x066a=['channel','Interaction','update','interaction','then','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x324e12,_0x271de5){var _0x4fa70e=function(_0x216879){while(--_0x216879){_0x324e12['push'](_0x324e12['shift']());}};_0x4fa70e(++_0x271de5);}(_0x066a,0xb2));var _0xa066=function(_0x2f805e,_0x41b2b1){_0x2f805e=_0x2f805e-0x0;var _0x6a4230=_0x066a[_0x2f805e];return _0x6a4230;};'use strict';var moment=require(_0xa066('0x0'));var logger=require(_0xa066('0x1'))(_0xa066('0x2'));var rpc={'chatInteraction':require(_0xa066('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa066('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xa066('0x5')),'whatsappInteraction':require(_0xa066('0x6'))};exports[_0xa066('0x7')]=function(_0x39e241,_0xb9b538,_0x1797d3,_0x3f6f64){return function(_0x4615d3){try{logger[_0xa066('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x39e241,_0xb9b538[0x0]);var _0x5bf3c6={'closed':0x1,'closedAt':moment()[_0xa066('0x9')](_0xa066('0xa')),'closeReason':'system','disposition':_0xb9b538[0x0]};if(rpc[_0x3f6f64[_0xa066('0xb')]+_0xa066('0xc')]){rpc[_0x3f6f64['channel']+_0xa066('0xc')][_0xa066('0xd')](_0x3f6f64[_0xa066('0xe')]['id'],_0x5bf3c6)[_0xa066('0xf')](function(_0xac49b3){logger[_0xa066('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x39e241,_0x3f6f64[_0xa066('0xe')]['id']);})['catch'](function(_0x4688a8){logger[_0xa066('0x10')]('[%s][CLOSE]\x20%s',_0x39e241,JSON[_0xa066('0x11')](_0x4688a8));})[_0xa066('0x12')](function(){_0x4615d3[_0xa066('0x13')]();});}}catch(_0x172541){logger[_0xa066('0x10')](_0xa066('0x14'),_0x39e241,JSON[_0xa066('0x11')](_0x172541));_0x4615d3['stop']();}};}; \ No newline at end of file +var _0x842d=['../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction'];(function(_0x2f622e,_0x4d7a29){var _0x30bd5c=function(_0xbd8c45){while(--_0xbd8c45){_0x2f622e['push'](_0x2f622e['shift']());}};_0x30bd5c(++_0x4d7a29);}(_0x842d,0x104));var _0xd842=function(_0x3238bd,_0x4ea3ef){_0x3238bd=_0x3238bd-0x0;var _0xdc7a7e=_0x842d[_0x3238bd];return _0xdc7a7e;};'use strict';var moment=require(_0xd842('0x0'));var logger=require(_0xd842('0x1'))(_0xd842('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd842('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xd842('0x4')),'faxInteraction':require(_0xd842('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xd842('0x6')]=function(_0x5b9df3,_0x4d0328,_0x13b297,_0x25e79c){return function(_0x3ec395){try{logger[_0xd842('0x7')](_0xd842('0x8'),_0x5b9df3,_0x4d0328[0x0]);var _0x55ec4e={'closed':0x1,'closedAt':moment()[_0xd842('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xd842('0xa'),'disposition':_0x4d0328[0x0]};if(rpc[_0x25e79c[_0xd842('0xb')]+_0xd842('0xc')]){rpc[_0x25e79c['channel']+_0xd842('0xc')]['update'](_0x25e79c[_0xd842('0xd')]['id'],_0x55ec4e)[_0xd842('0xe')](function(_0x391832){logger['info'](_0xd842('0xf'),_0x5b9df3,_0x25e79c[_0xd842('0xd')]['id']);})[_0xd842('0x10')](function(_0x365dde){logger[_0xd842('0x11')](_0xd842('0x12'),_0x5b9df3,JSON[_0xd842('0x13')](_0x365dde));})[_0xd842('0x14')](function(){_0x3ec395[_0xd842('0x15')]();});}}catch(_0xd3e813){logger['error']('[%s][CLOSE]\x20%s',_0x5b9df3,JSON['stringify'](_0xd3e813));_0x3ec395[_0xd842('0x15')]();}};}; \ 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 56e305d..f14d74e 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 _0xea4e=['phone','interaction','channel','chat','ChatWebsiteId','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','fulfillment','providerResponse','stringify','metadata','endConversation','error','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xea4e,0x10c));var _0xeea4=function(_0x24df34,_0x50aa1a){_0x24df34=_0x24df34-0x0;var _0x3980e8=_0xea4e[_0x24df34];return _0x3980e8;};'use strict';var _=require(_0xeea4('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xeea4('0x1'));var logger=require('../../../../config/logger')(_0xeea4('0x2'));var rpc={'chatMessage':require(_0xeea4('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xeea4('0x4')),'smsMessage':require(_0xeea4('0x5')),'faxMessage':require(_0xeea4('0x6')),'whatsappMessage':require(_0xeea4('0x7'))};exports[_0xeea4('0x8')]=function(_0x26d41b,_0x1bf7d2){return function(_0x44113d){try{if(!_[_0xeea4('0x9')](this['interaction'][_0xeea4('0xa')])){logger['info'](_0xeea4('0xb'),_0x26d41b,_0xeea4('0xc'));return _0x44113d[_0xeea4('0xd')]();}var _0x367d41={'ContactId':this[_0xeea4('0xe')]['id'],'sentAt':moment()[_0xeea4('0xf')](_0xeea4('0x10')),'direction':_0xeea4('0x11')};if(this['channel']===_0xeea4('0x12')||this['channel']===_0xeea4('0x13')){_0x367d41[_0xeea4('0x14')]=this[_0xeea4('0x15')][_0xeea4('0x14')];}var _0x137086=this[_0xeea4('0x16')];if(_0x137086===_0xeea4('0x17')){_0x367d41[_0xeea4('0x18')]=this['account']['id'];}else{_0x367d41[_[_0xeea4('0x19')](_0x137086)+_0xeea4('0x1a')]=this['account']['id'];}_0x367d41[_[_0xeea4('0x19')](_0x137086)+'InteractionId']=this[_0xeea4('0x15')]['id'];if(this[_0xeea4('0x15')][_0xeea4('0x1b')]){var _0x12f574=_0x1bf7d2[0x2];if(!_[_0xeea4('0x1c')](_0x12f574)){_0x367d41[_0xeea4('0x1d')]=utils[_0xeea4('0x1e')](_0x12f574,this);return rpc[_0x137086+_0xeea4('0x1f')][_0xeea4('0x20')](_0x367d41)[_0xeea4('0x21')](function(_0x4ae372){logger[_0xeea4('0x22')](_0xeea4('0xb'),_0x26d41b,_0x367d41['body']);})[_0xeea4('0x23')](function(_0x472803){logger['error'](_0xeea4('0xb'),_0x26d41b,JSON['stringify'](_0x472803));})[_0xeea4('0x24')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x26d41b);_0x44113d[_0xeea4('0x25')]();});}else{logger['info'](_0xeea4('0x26'),_0x26d41b);_0x44113d[_0xeea4('0x25')]();}}else{var _0x3e162c=this;var _0x19b2a8=apiai(_0x1bf7d2[0x0],{'language':_0x1bf7d2[0x1]||'en'});return _0x19b2a8[_0xeea4('0x27')](this['message'][_0xeea4('0x1d')],{'sessionId':md5(this[_0xeea4('0x15')]['id'])})[_0xeea4('0x21')](function(_0x31dab){_0x3e162c['body'][_0xeea4('0x28')]=_0x31dab;_0x367d41[_0xeea4('0x1d')]=_0x31dab[_0xeea4('0x29')][_0xeea4('0x2a')]['speech'];_0x367d41['providerName']=_0xeea4('0x28');_0x367d41[_0xeea4('0x2b')]=JSON[_0xeea4('0x2c')](_0x31dab);return rpc[_0x137086+_0xeea4('0x1f')][_0xeea4('0x20')](_0x367d41)['then'](function(_0x15aaa4){logger[_0xeea4('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x26d41b,_0x367d41[_0xeea4('0x1d')]);if(_0x31dab['result'][_0xeea4('0x2d')][_0xeea4('0x2e')]){_0x44113d[_0xeea4('0xd')]();}else{_0x44113d[_0xeea4('0x25')]();}})[_0xeea4('0x23')](function(_0x5b651f){logger[_0xeea4('0x2f')]('[%s][DIALOGFLOW]\x20%s',_0x26d41b,JSON[_0xeea4('0x2c')](_0x5b651f));_0x44113d[_0xeea4('0xd')]();});})['catch'](function(_0x48a047){logger['error'](_0xeea4('0xb'),_0x26d41b,_0x48a047['message']);_0x44113d[_0xeea4('0xd')]();});}}catch(_0x5793ed){logger[_0xeea4('0x2f')](_0xeea4('0xb'),_0x26d41b,JSON[_0xeea4('0x2c')](_0x5793ed));_0x44113d['stop']();}};}; \ No newline at end of file +var _0x6657=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','providerResponse','stringify','result','metadata','endConversation','message','lodash','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x6657,0x17f));var _0x7665=function(_0x291b7e,_0x1d92d6){_0x291b7e=_0x291b7e-0x0;var _0x502780=_0x6657[_0x291b7e];return _0x502780;};'use strict';var _=require(_0x7665('0x0'));var moment=require('moment');var apiai=require(_0x7665('0x1'));var md5=require(_0x7665('0x2'));var utils=require(_0x7665('0x3'));var logger=require(_0x7665('0x4'))('routing');var rpc={'chatMessage':require(_0x7665('0x5')),'openchannelMessage':require(_0x7665('0x6')),'mailMessage':require(_0x7665('0x7')),'smsMessage':require(_0x7665('0x8')),'faxMessage':require(_0x7665('0x9')),'whatsappMessage':require(_0x7665('0xa'))};exports[_0x7665('0xb')]=function(_0x3387d8,_0x4c0b5c){return function(_0x31da89){try{if(!_[_0x7665('0xc')](this[_0x7665('0xd')][_0x7665('0xe')])){logger[_0x7665('0xf')](_0x7665('0x10'),_0x3387d8,_0x7665('0x11'));return _0x31da89[_0x7665('0x12')]();}var _0x5ca72e={'ContactId':this[_0x7665('0x13')]['id'],'sentAt':moment()[_0x7665('0x14')](_0x7665('0x15')),'direction':'out'};if(this[_0x7665('0x16')]==='sms'||this[_0x7665('0x16')]===_0x7665('0x17')){_0x5ca72e['phone']=this[_0x7665('0xd')][_0x7665('0x18')];}var _0x4dd9aa=this[_0x7665('0x16')];if(_0x4dd9aa===_0x7665('0x19')){_0x5ca72e['ChatWebsiteId']=this[_0x7665('0x1a')]['id'];}else{_0x5ca72e[_[_0x7665('0x1b')](_0x4dd9aa)+_0x7665('0x1c')]=this[_0x7665('0x1a')]['id'];}_0x5ca72e[_[_0x7665('0x1b')](_0x4dd9aa)+_0x7665('0x1d')]=this[_0x7665('0xd')]['id'];if(this[_0x7665('0xd')][_0x7665('0x1e')]){var _0x334ee6=_0x4c0b5c[0x2];if(!_[_0x7665('0x1f')](_0x334ee6)){_0x5ca72e[_0x7665('0x20')]=utils[_0x7665('0x21')](_0x334ee6,this);return rpc[_0x4dd9aa+_0x7665('0x22')][_0x7665('0x23')](_0x5ca72e)[_0x7665('0x24')](function(_0x522944){logger[_0x7665('0xf')](_0x7665('0x10'),_0x3387d8,_0x5ca72e['body']);})[_0x7665('0x25')](function(_0x2033a5){logger[_0x7665('0x26')](_0x7665('0x10'),_0x3387d8,JSON['stringify'](_0x2033a5));})[_0x7665('0x27')](function(){logger[_0x7665('0xf')](_0x7665('0x28'),_0x3387d8);_0x31da89[_0x7665('0x29')]();});}else{logger[_0x7665('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3387d8);_0x31da89[_0x7665('0x29')]();}}else{var _0x51d577=this;var _0x37be5d=apiai(_0x4c0b5c[0x0],{'language':_0x4c0b5c[0x1]||'en'});return _0x37be5d[_0x7665('0x2a')](this['message']['body'],{'sessionId':md5(this[_0x7665('0xd')]['id'])})[_0x7665('0x24')](function(_0x4a9a25){_0x51d577[_0x7665('0x20')][_0x7665('0x2b')]=_0x4a9a25;_0x5ca72e[_0x7665('0x20')]=_0x4a9a25['result']['fulfillment']['speech'];_0x5ca72e['providerName']=_0x7665('0x2b');_0x5ca72e[_0x7665('0x2c')]=JSON[_0x7665('0x2d')](_0x4a9a25);return rpc[_0x4dd9aa+'Message'][_0x7665('0x23')](_0x5ca72e)[_0x7665('0x24')](function(_0x50bfa5){logger['info'](_0x7665('0x10'),_0x3387d8,_0x5ca72e[_0x7665('0x20')]);if(_0x4a9a25[_0x7665('0x2e')][_0x7665('0x2f')][_0x7665('0x30')]){_0x31da89[_0x7665('0x12')]();}else{_0x31da89['stop']();}})[_0x7665('0x25')](function(_0x55d046){logger['error'](_0x7665('0x10'),_0x3387d8,JSON[_0x7665('0x2d')](_0x55d046));_0x31da89[_0x7665('0x12')]();});})[_0x7665('0x25')](function(_0x264b6e){logger[_0x7665('0x26')](_0x7665('0x10'),_0x3387d8,_0x264b6e[_0x7665('0x31')]);_0x31da89[_0x7665('0x12')]();});}}catch(_0x415cb8){logger[_0x7665('0x26')](_0x7665('0x10'),_0x3387d8,JSON[_0x7665('0x2d')](_0x415cb8));_0x31da89[_0x7665('0x29')]();}};}; \ 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 6d2431d..c0f5c26 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 _0xfa57=['bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','error','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_LANGUAGECODE','languageCode','providerName','providerResponse','fulfillmentText','push','all','lodash','dialogflow'];(function(_0x12c88c,_0x1ab861){var _0x535ca3=function(_0x26bc5c){while(--_0x26bc5c){_0x12c88c['push'](_0x12c88c['shift']());}};_0x535ca3(++_0x1ab861);}(_0xfa57,0x1da));var _0x7fa5=function(_0x5d5fdc,_0xadc1a4){_0x5d5fdc=_0x5d5fdc-0x0;var _0xbf5d76=_0xfa57[_0x5d5fdc];return _0xbf5d76;};'use strict';var _=require(_0x7fa5('0x0'));var dialogflow=require(_0x7fa5('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x7fa5('0x2'));var logger=require(_0x7fa5('0x3'))(_0x7fa5('0x4'));var utils=require(_0x7fa5('0x5'));var rpc={'chatMessage':require(_0x7fa5('0x6')),'openchannelMessage':require(_0x7fa5('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7fa5('0x8')),'faxMessage':require(_0x7fa5('0x9')),'whatsappMessage':require(_0x7fa5('0xa'))};function createMessage(_0x43f6ad,_0x4177be,_0xa4cf1d,_0x3dc793){return new Promise(function(_0x45a9d8,_0x40483d){var _0x50e196=_[_0x7fa5('0xb')](_0xa4cf1d);_0x50e196[_0x7fa5('0xc')]=_0x3dc793;return rpc[_0x4177be+_0x7fa5('0xd')][_0x7fa5('0xe')](_0x50e196)[_0x7fa5('0xf')](function(){logger[_0x7fa5('0x10')](_0x7fa5('0x11'),_0x43f6ad,_0x50e196[_0x7fa5('0xc')]);_0x45a9d8();})[_0x7fa5('0x12')](function(_0x410f2b){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x43f6ad,JSON[_0x7fa5('0x13')](_0x410f2b));_0x40483d(_0x410f2b);});});}exports[_0x7fa5('0x14')]=function(_0xbe30a4,_0x4accf1){return function(_0x37f1ac){try{if(!_[_0x7fa5('0x15')](this[_0x7fa5('0x16')][_0x7fa5('0x17')])){logger[_0x7fa5('0x10')](_0x7fa5('0x11'),_0xbe30a4,_0x7fa5('0x18'));return _0x37f1ac[_0x7fa5('0x19')]();}var _0x5f1d31={'ContactId':this[_0x7fa5('0x1a')]['id'],'sentAt':moment()[_0x7fa5('0x1b')](_0x7fa5('0x1c')),'direction':_0x7fa5('0x1d')};if(this[_0x7fa5('0x1e')]==='sms'||this[_0x7fa5('0x1e')]==='whatsapp'){_0x5f1d31[_0x7fa5('0x1f')]=this[_0x7fa5('0x16')]['phone'];}var _0xc40051=this[_0x7fa5('0x1e')];if(_0xc40051===_0x7fa5('0x20')){_0x5f1d31[_0x7fa5('0x21')]=this[_0x7fa5('0x22')]['id'];}else{_0x5f1d31[_['upperFirst'](_0xc40051)+_0x7fa5('0x23')]=this[_0x7fa5('0x22')]['id'];}_0x5f1d31[_[_0x7fa5('0x24')](_0xc40051)+_0x7fa5('0x25')]=this[_0x7fa5('0x16')]['id'];if(this[_0x7fa5('0x16')]['created']){var _0x35903d=_0x4accf1[0x4];if(!_[_0x7fa5('0x26')](_0x35903d)){_0x5f1d31[_0x7fa5('0xc')]=utils['getMustacheRender'](_0x35903d,this);return rpc[_0xc40051+_0x7fa5('0xd')][_0x7fa5('0xe')](_0x5f1d31)[_0x7fa5('0xf')](function(_0x34ac8f){logger['info'](_0x7fa5('0x11'),_0xbe30a4,_0x5f1d31[_0x7fa5('0xc')]);})[_0x7fa5('0x12')](function(_0x464112){logger[_0x7fa5('0x27')]('[%s][DIALOGFLOWV2]\x20%s',_0xbe30a4,JSON['stringify'](_0x464112));})['finally'](function(){logger[_0x7fa5('0x10')](_0x7fa5('0x28'),_0xbe30a4);_0x37f1ac[_0x7fa5('0x29')]();});}else{logger[_0x7fa5('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xbe30a4);_0x37f1ac[_0x7fa5('0x29')]();}}else{var _0x2021b8=this;var _0x1f61f7=_0x4accf1[0x2][_0x7fa5('0x2a')](/\\n/g,'\x0a');var _0x26ebf6={'credentials':{'private_key':_0x1f61f7,'client_email':_0x4accf1[0x1]}};var _0x1d56d8=new dialogflow[(_0x7fa5('0x2b'))](_0x26ebf6);var _0xa55d8a=_0x1d56d8[_0x7fa5('0x2c')](_0x4accf1[0x0],md5(_0x2021b8[_0x7fa5('0x16')]['id']));var _0x2e9d92={'session':_0xa55d8a,'queryInput':{'text':{'text':_0x2021b8[_0x7fa5('0x2d')][_0x7fa5('0xc')],'languageCode':_0x4accf1[0x3]||'en'}}};return _0x1d56d8[_0x7fa5('0x2e')](_0x2e9d92)[_0x7fa5('0xf')](function(_0x5a0db6){if(_0x5a0db6&&_0x5a0db6[_0x7fa5('0x2f')]){_0x2021b8[_0x7fa5('0xc')][_0x7fa5('0x30')]=_0x5a0db6;var _0x4d3035=_0x5a0db6[0x0];var _0x41b353=_0x4d3035[_0x7fa5('0x31')]['diagnosticInfo']&&_0x4d3035[_0x7fa5('0x31')][_0x7fa5('0x32')][_0x7fa5('0x33')]?_0x4d3035[_0x7fa5('0x31')][_0x7fa5('0x32')][_0x7fa5('0x33')]['end_conversation']['boolValue']:![];_0x2021b8['body']['DIALOGFLOWV2_ACTION']=_0x4d3035[_0x7fa5('0x31')][_0x7fa5('0x34')];_0x2021b8['body'][_0x7fa5('0x35')]=_0x4d3035[_0x7fa5('0x31')]['allRequiredParamsPresent'];_0x2021b8[_0x7fa5('0xc')][_0x7fa5('0x36')]=_0x4d3035['queryResult'][_0x7fa5('0x32')]&&_0x4d3035[_0x7fa5('0x31')][_0x7fa5('0x32')]['fields']?_0x4d3035[_0x7fa5('0x31')]['diagnosticInfo'][_0x7fa5('0x33')][_0x7fa5('0x37')]['boolValue']:![];_0x2021b8['body'][_0x7fa5('0x38')]=_0x4d3035[_0x7fa5('0x31')][_0x7fa5('0x39')][_0x7fa5('0x3a')];_0x2021b8[_0x7fa5('0xc')][_0x7fa5('0x3b')]=_0x4d3035[_0x7fa5('0x31')][_0x7fa5('0x39')][_0x7fa5('0x3c')];_0x2021b8[_0x7fa5('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x4d3035[_0x7fa5('0x31')][_0x7fa5('0x39')]['isFallback'];_0x2021b8[_0x7fa5('0xc')][_0x7fa5('0x3d')]=_0x4d3035[_0x7fa5('0x31')][_0x7fa5('0x3e')];_0x2021b8['body']['DIALOGFLOWV2_QUERYTEXT']=_0x4d3035['queryResult']['queryText'];_0x2021b8[_0x7fa5('0xc')]['DIALOGFLOWV2_SCORE']=_0x4d3035[_0x7fa5('0x31')]['intentDetectionConfidence'];_0x5f1d31[_0x7fa5('0x3f')]=_0x7fa5('0x30');_0x5f1d31[_0x7fa5('0x40')]=JSON[_0x7fa5('0x13')](_0x5a0db6);var _0x307c3f=[];for(var _0x171b7d=0x0;_0x171b7d<_0x5a0db6[_0x7fa5('0x2f')];_0x171b7d++){var _0x2249b7=_0x5a0db6[_0x171b7d];if(_0x2249b7&&_0x2249b7['queryResult']&&_0x2249b7['queryResult'][_0x7fa5('0x41')]){_0x307c3f[_0x7fa5('0x42')](createMessage(_0xbe30a4,_0xc40051,_0x5f1d31,_0x2249b7[_0x7fa5('0x31')]['fulfillmentText']));}}return Promise[_0x7fa5('0x43')](_0x307c3f)['then'](function(){if(_0x41b353){_0x37f1ac[_0x7fa5('0x19')]();}else{_0x37f1ac[_0x7fa5('0x29')]();}})[_0x7fa5('0x12')](function(_0x547d2c){logger['error'](_0x7fa5('0x11'),_0xbe30a4,JSON[_0x7fa5('0x13')](_0x547d2c));_0x37f1ac[_0x7fa5('0x19')]();});}})['catch'](function(_0x3862d2){logger[_0x7fa5('0x27')](_0x7fa5('0x11'),_0xbe30a4,_0x3862d2[_0x7fa5('0x2d')]);_0x37f1ac[_0x7fa5('0x19')]();});}}catch(_0x179d3d){logger[_0x7fa5('0x27')]('[%s][DIALOGFLOWV2]\x20%s',_0xbe30a4,JSON['stringify'](_0x179d3d));_0x37f1ac[_0x7fa5('0x29')]();}};}; \ No newline at end of file +var _0xc2e5=['created','isEmpty','getMustacheRender','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','length','fulfillmentText','all','stop','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','whatsapp','phone','chat','account','AccountId','upperFirst','InteractionId'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xc2e5,0x6f));var _0x5c2e=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0xc2e5[_0x2c5255];return _0x30d0ea;};'use strict';var _=require('lodash');var dialogflow=require(_0x5c2e('0x0'));var md5=require(_0x5c2e('0x1'));var moment=require(_0x5c2e('0x2'));var Promise=require(_0x5c2e('0x3'));var logger=require(_0x5c2e('0x4'))(_0x5c2e('0x5'));var utils=require(_0x5c2e('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5c2e('0x7')),'mailMessage':require(_0x5c2e('0x8')),'smsMessage':require(_0x5c2e('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5c2e('0xa'))};function createMessage(_0x5316f3,_0x3f34d9,_0x461b83,_0x11782c){return new Promise(function(_0xb70b30,_0x1ed0d6){var _0x572bc9=_[_0x5c2e('0xb')](_0x461b83);_0x572bc9[_0x5c2e('0xc')]=_0x11782c;return rpc[_0x3f34d9+_0x5c2e('0xd')][_0x5c2e('0xe')](_0x572bc9)[_0x5c2e('0xf')](function(){logger[_0x5c2e('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x5316f3,_0x572bc9[_0x5c2e('0xc')]);_0xb70b30();})[_0x5c2e('0x11')](function(_0xd5e670){logger[_0x5c2e('0x12')](_0x5c2e('0x13'),_0x5316f3,JSON[_0x5c2e('0x14')](_0xd5e670));_0x1ed0d6(_0xd5e670);});});}exports['consequence']=function(_0x1ba5ad,_0x507482){return function(_0x5dd5b4){try{if(!_[_0x5c2e('0x15')](this[_0x5c2e('0x16')][_0x5c2e('0x17')])){logger[_0x5c2e('0x10')](_0x5c2e('0x13'),_0x1ba5ad,_0x5c2e('0x18'));return _0x5dd5b4[_0x5c2e('0x19')]();}var _0x33601e={'ContactId':this[_0x5c2e('0x1a')]['id'],'sentAt':moment()[_0x5c2e('0x1b')](_0x5c2e('0x1c')),'direction':_0x5c2e('0x1d')};if(this['channel']==='sms'||this['channel']===_0x5c2e('0x1e')){_0x33601e[_0x5c2e('0x1f')]=this['interaction']['phone'];}var _0x17750f=this['channel'];if(_0x17750f===_0x5c2e('0x20')){_0x33601e['ChatWebsiteId']=this[_0x5c2e('0x21')]['id'];}else{_0x33601e[_['upperFirst'](_0x17750f)+_0x5c2e('0x22')]=this['account']['id'];}_0x33601e[_[_0x5c2e('0x23')](_0x17750f)+_0x5c2e('0x24')]=this['interaction']['id'];if(this[_0x5c2e('0x16')][_0x5c2e('0x25')]){var _0x11c755=_0x507482[0x4];if(!_[_0x5c2e('0x26')](_0x11c755)){_0x33601e[_0x5c2e('0xc')]=utils[_0x5c2e('0x27')](_0x11c755,this);return rpc[_0x17750f+_0x5c2e('0xd')]['create'](_0x33601e)[_0x5c2e('0xf')](function(_0x3e9535){logger[_0x5c2e('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1ba5ad,_0x33601e[_0x5c2e('0xc')]);})['catch'](function(_0x52e283){logger[_0x5c2e('0x12')](_0x5c2e('0x13'),_0x1ba5ad,JSON[_0x5c2e('0x14')](_0x52e283));})['finally'](function(){logger['info'](_0x5c2e('0x28'),_0x1ba5ad);_0x5dd5b4['stop']();});}else{logger[_0x5c2e('0x10')](_0x5c2e('0x29'),_0x1ba5ad);_0x5dd5b4['stop']();}}else{var _0x2e85ff=this;var _0x2de98f=_0x507482[0x2][_0x5c2e('0x2a')](/\\n/g,'\x0a');var _0x5b8b81={'credentials':{'private_key':_0x2de98f,'client_email':_0x507482[0x1]}};var _0x2e45ba=new dialogflow[(_0x5c2e('0x2b'))](_0x5b8b81);var _0x13b0d8=_0x2e45ba['sessionPath'](_0x507482[0x0],md5(_0x2e85ff[_0x5c2e('0x16')]['id']));var _0x515427={'session':_0x13b0d8,'queryInput':{'text':{'text':_0x2e85ff[_0x5c2e('0x2c')][_0x5c2e('0xc')],'languageCode':_0x507482[0x3]||'en'}}};return _0x2e45ba[_0x5c2e('0x2d')](_0x515427)['then'](function(_0xc2b38a){if(_0xc2b38a&&_0xc2b38a['length']){_0x2e85ff[_0x5c2e('0xc')]['dialogflowV2']=_0xc2b38a;var _0x3ba5b6=_0xc2b38a[0x0];var _0x4fa15=_0x3ba5b6['queryResult'][_0x5c2e('0x2e')]&&_0x3ba5b6[_0x5c2e('0x2f')]['diagnosticInfo']['fields']?_0x3ba5b6['queryResult']['diagnosticInfo'][_0x5c2e('0x30')][_0x5c2e('0x31')][_0x5c2e('0x32')]:![];_0x2e85ff[_0x5c2e('0xc')][_0x5c2e('0x33')]=_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x34')];_0x2e85ff[_0x5c2e('0xc')][_0x5c2e('0x35')]=_0x3ba5b6['queryResult'][_0x5c2e('0x36')];_0x2e85ff['body'][_0x5c2e('0x37')]=_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x2e')]&&_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x2e')][_0x5c2e('0x30')]?_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x2e')]['fields'][_0x5c2e('0x31')][_0x5c2e('0x32')]:![];_0x2e85ff[_0x5c2e('0xc')][_0x5c2e('0x38')]=_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x39')][_0x5c2e('0x3a')];_0x2e85ff[_0x5c2e('0xc')][_0x5c2e('0x3b')]=_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x39')]['displayName'];_0x2e85ff['body'][_0x5c2e('0x3c')]=_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x39')]['isFallback'];_0x2e85ff[_0x5c2e('0xc')][_0x5c2e('0x3d')]=_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x3e')];_0x2e85ff[_0x5c2e('0xc')][_0x5c2e('0x3f')]=_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x40')];_0x2e85ff[_0x5c2e('0xc')][_0x5c2e('0x41')]=_0x3ba5b6[_0x5c2e('0x2f')][_0x5c2e('0x42')];_0x33601e[_0x5c2e('0x43')]=_0x5c2e('0x44');_0x33601e[_0x5c2e('0x45')]=JSON['stringify'](_0xc2b38a);var _0xd39d71=[];for(var _0x49882d=0x0;_0x49882d<_0xc2b38a[_0x5c2e('0x46')];_0x49882d++){var _0x397ba3=_0xc2b38a[_0x49882d];if(_0x397ba3&&_0x397ba3[_0x5c2e('0x2f')]&&_0x397ba3[_0x5c2e('0x2f')]['fulfillmentText']){_0xd39d71['push'](createMessage(_0x1ba5ad,_0x17750f,_0x33601e,_0x397ba3['queryResult'][_0x5c2e('0x47')]));}}return Promise[_0x5c2e('0x48')](_0xd39d71)[_0x5c2e('0xf')](function(){if(_0x4fa15){_0x5dd5b4[_0x5c2e('0x19')]();}else{_0x5dd5b4[_0x5c2e('0x49')]();}})['catch'](function(_0x2b269c){logger[_0x5c2e('0x12')](_0x5c2e('0x13'),_0x1ba5ad,JSON[_0x5c2e('0x14')](_0x2b269c));_0x5dd5b4[_0x5c2e('0x19')]();});}})[_0x5c2e('0x11')](function(_0x2dd263){logger[_0x5c2e('0x12')](_0x5c2e('0x13'),_0x1ba5ad,_0x2dd263[_0x5c2e('0x2c')]);_0x5dd5b4['next']();});}}catch(_0x38a653){logger[_0x5c2e('0x12')](_0x5c2e('0x13'),_0x1ba5ad,JSON[_0x5c2e('0x14')](_0x38a653));_0x5dd5b4[_0x5c2e('0x49')]();}};}; \ 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 4b4ec71..5f3746b 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 _0xb3d0=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','validate','length','[%s][GOTOIF]\x20%s','message','join','priorityTrue','priorityFalse','info'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xb3d0,0x9a));var _0x0b3d=function(_0x54025c,_0x2dfb5c){_0x54025c=_0x54025c-0x0;var _0x64e49b=_0xb3d0[_0x54025c];return _0x64e49b;};'use strict';var schema=require('validate');var _=require(_0x0b3d('0x0'));var htmlToText=require(_0x0b3d('0x1'));var utils=require(_0x0b3d('0x2'));var logger=require('../../../../config/logger')(_0x0b3d('0x3'));var gotoif=schema({'condition':{'type':_0x0b3d('0x4'),'required':!![],'message':_0x0b3d('0x5')},'priorityTrue':{'type':_0x0b3d('0x6'),'message':_0x0b3d('0x7')},'priorityFalse':{'type':_0x0b3d('0x6'),'message':_0x0b3d('0x8')}});exports[_0x0b3d('0x9')]=function(_0x23c2e5,_0xb12c60){return function(_0x4c3dea){try{var _0x1f6c23={'condition':htmlToText[_0x0b3d('0xa')](utils['getMustacheRender'](_0xb12c60[0x0],this),{'wordwrap':![]})[_0x0b3d('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xb12c60[0x1],'priorityFalse':_0xb12c60[0x2]};var _0x250fb7=gotoif[_0x0b3d('0xc')](_0x1f6c23,{'typecast':!![]});if(_0x250fb7[_0x0b3d('0xd')]){logger['error'](_0x0b3d('0xe'),_0x23c2e5,_['map'](_0x250fb7,_0x0b3d('0xf'))[_0x0b3d('0x10')](',\x20'));_0x4c3dea['stop']();}else{try{var _0x2484ba=eval('('+_0x1f6c23['condition']+')');var _0xc43ed9=_0x2484ba?_0x1f6c23[_0x0b3d('0x11')]:_0x1f6c23[_0x0b3d('0x12')];logger[_0x0b3d('0x13')](_0x0b3d('0x14'),_0x23c2e5,_0x1f6c23[_0x0b3d('0x15')],_0x2484ba,_0xc43ed9||_0x0b3d('0x16'));if(_0xc43ed9){var _0x346613=_['findIndex'](_0x4c3dea['rules'](),{'p':_0xc43ed9});if(_0x346613>=0x0){logger[_0x0b3d('0x13')](_0x0b3d('0x17'),_0x23c2e5,_0xc43ed9||_0x0b3d('0x16'),_0x346613);_0x4c3dea['next'](_0x346613);}else{logger[_0x0b3d('0x13')](_0x0b3d('0x18'),_0x23c2e5,_0xc43ed9||_0x0b3d('0x16'));_0x4c3dea[_0x0b3d('0x19')]();}}else{_0x4c3dea['next']();}}catch(_0x3dfcfa){logger[_0x0b3d('0x1a')](_0x0b3d('0x1b'),_0x23c2e5,_0x3dfcfa['message']);_0x4c3dea[_0x0b3d('0x19')]();}}}catch(_0x39e198){logger[_0x0b3d('0x1a')]('[%s][GOTOIF]\x20%s',_0x23c2e5,JSON[_0x0b3d('0x1c')](_0x39e198));_0x4c3dea[_0x0b3d('0x19')]();}};}; \ No newline at end of file +var _0xd97d=['stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x4a6f9b,_0x241606){var _0x32fdb2=function(_0x5548fa){while(--_0x5548fa){_0x4a6f9b['push'](_0x4a6f9b['shift']());}};_0x32fdb2(++_0x241606);}(_0xd97d,0x1dd));var _0xdd97=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xd97d[_0x125ff8];return _0x2d9ef;};'use strict';var schema=require(_0xdd97('0x0'));var _=require(_0xdd97('0x1'));var htmlToText=require(_0xdd97('0x2'));var utils=require(_0xdd97('0x3'));var logger=require(_0xdd97('0x4'))(_0xdd97('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xdd97('0x6')},'priorityTrue':{'type':'number','message':_0xdd97('0x7')},'priorityFalse':{'type':_0xdd97('0x8'),'message':_0xdd97('0x9')}});exports[_0xdd97('0xa')]=function(_0x2e2d0f,_0x43ec2c){return function(_0x14bcee){try{var _0x55ad46={'condition':htmlToText[_0xdd97('0xb')](utils[_0xdd97('0xc')](_0x43ec2c[0x0],this),{'wordwrap':![]})[_0xdd97('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x43ec2c[0x1],'priorityFalse':_0x43ec2c[0x2]};var _0x5d26e5=gotoif[_0xdd97('0x0')](_0x55ad46,{'typecast':!![]});if(_0x5d26e5['length']){logger[_0xdd97('0xe')](_0xdd97('0xf'),_0x2e2d0f,_[_0xdd97('0x10')](_0x5d26e5,_0xdd97('0x11'))[_0xdd97('0x12')](',\x20'));_0x14bcee[_0xdd97('0x13')]();}else{try{var _0x34ed53=eval('('+_0x55ad46[_0xdd97('0x14')]+')');var _0x53cd73=_0x34ed53?_0x55ad46[_0xdd97('0x15')]:_0x55ad46['priorityFalse'];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2e2d0f,_0x55ad46[_0xdd97('0x14')],_0x34ed53,_0x53cd73||'next');if(_0x53cd73){var _0x5f5a59=_['findIndex'](_0x14bcee[_0xdd97('0x16')](),{'p':_0x53cd73});if(_0x5f5a59>=0x0){logger[_0xdd97('0x17')](_0xdd97('0x18'),_0x2e2d0f,_0x53cd73||'next',_0x5f5a59);_0x14bcee[_0xdd97('0x19')](_0x5f5a59);}else{logger[_0xdd97('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2e2d0f,_0x53cd73||_0xdd97('0x19'));_0x14bcee[_0xdd97('0x13')]();}}else{_0x14bcee['next']();}}catch(_0x51efcb){logger[_0xdd97('0xe')](_0xdd97('0x1a'),_0x2e2d0f,_0x51efcb[_0xdd97('0x11')]);_0x14bcee[_0xdd97('0x13')]();}}}catch(_0x19f920){logger[_0xdd97('0xe')](_0xdd97('0xf'),_0x2e2d0f,JSON[_0xdd97('0x1b')](_0x19f920));_0x14bcee['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 4993428..4ef88e1 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 _0xb237=['[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x5b474c,_0x426d87){var _0x273b2c=function(_0x2a3fcf){while(--_0x2a3fcf){_0x5b474c['push'](_0x5b474c['shift']());}};_0x273b2c(++_0x426d87);}(_0xb237,0x1d5));var _0x7b23=function(_0x617b49,_0x39d42c){_0x617b49=_0x617b49-0x0;var _0xb725f8=_0xb237[_0x617b49];return _0xb725f8;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x7b23('0x0'))(_0x7b23('0x1'));var gotop=schema({'priority':{'type':_0x7b23('0x2'),'required':!![],'message':_0x7b23('0x3')}});exports[_0x7b23('0x4')]=function(_0x46cdd8,_0x158ad5){return function(_0x2f2ba4){try{var _0x41d90d={'priority':_0x158ad5[0x0]};var _0xb08d33=gotop['validate'](_0x41d90d,{'typecast':!![]});if(_0xb08d33[_0x7b23('0x5')]){logger[_0x7b23('0x6')](_0x7b23('0x7'),_0x46cdd8,_[_0x7b23('0x8')](_0xb08d33,_0x7b23('0x9'))[_0x7b23('0xa')](',\x20'));_0x2f2ba4[_0x7b23('0xb')]();}else{logger[_0x7b23('0xc')](_0x7b23('0xd'),_0x46cdd8,_0x41d90d[_0x7b23('0xe')]);if(_0x41d90d[_0x7b23('0xe')]){var _0x53aeb0=_['findIndex'](_0x2f2ba4['rules'](),{'p':_0x41d90d[_0x7b23('0xe')]});if(_0x53aeb0>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x46cdd8,_0x41d90d[_0x7b23('0xe')]||_0x7b23('0xf'),_0x53aeb0);_0x2f2ba4[_0x7b23('0xf')](_0x53aeb0);}else{logger[_0x7b23('0xc')](_0x7b23('0x10'),_0x46cdd8,_0x41d90d[_0x7b23('0xe')]||'next');_0x2f2ba4[_0x7b23('0xb')]();}}else{_0x2f2ba4[_0x7b23('0xf')]();}}}catch(_0xf78ece){logger[_0x7b23('0x6')](_0x7b23('0x7'),_0x46cdd8,JSON['stringify'](_0xf78ece));_0x2f2ba4[_0x7b23('0xb')]();}};}; \ No newline at end of file +var _0xab48=['rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x497911,_0x16e1fd){var _0x483442=function(_0x23f8d7){while(--_0x23f8d7){_0x497911['push'](_0x497911['shift']());}};_0x483442(++_0x16e1fd);}(_0xab48,0x121));var _0x8ab4=function(_0x4e82ff,_0x3cbf4b){_0x4e82ff=_0x4e82ff-0x0;var _0x495205=_0xab48[_0x4e82ff];return _0x495205;};'use strict';var schema=require(_0x8ab4('0x0'));var _=require(_0x8ab4('0x1'));var logger=require(_0x8ab4('0x2'))(_0x8ab4('0x3'));var gotop=schema({'priority':{'type':_0x8ab4('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x8ab4('0x5')]=function(_0x5eafec,_0x2ee7d8){return function(_0x254b32){try{var _0x10ce5c={'priority':_0x2ee7d8[0x0]};var _0x331dee=gotop[_0x8ab4('0x0')](_0x10ce5c,{'typecast':!![]});if(_0x331dee[_0x8ab4('0x6')]){logger[_0x8ab4('0x7')]('[%s][GOTOP]\x20%s',_0x5eafec,_['map'](_0x331dee,_0x8ab4('0x8'))[_0x8ab4('0x9')](',\x20'));_0x254b32[_0x8ab4('0xa')]();}else{logger[_0x8ab4('0xb')](_0x8ab4('0xc'),_0x5eafec,_0x10ce5c[_0x8ab4('0xd')]);if(_0x10ce5c[_0x8ab4('0xd')]){var _0x1e9b14=_[_0x8ab4('0xe')](_0x254b32[_0x8ab4('0xf')](),{'p':_0x10ce5c[_0x8ab4('0xd')]});if(_0x1e9b14>=0x0){logger[_0x8ab4('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5eafec,_0x10ce5c['priority']||_0x8ab4('0x10'),_0x1e9b14);_0x254b32[_0x8ab4('0x10')](_0x1e9b14);}else{logger[_0x8ab4('0xb')](_0x8ab4('0x11'),_0x5eafec,_0x10ce5c[_0x8ab4('0xd')]||_0x8ab4('0x10'));_0x254b32['stop']();}}else{_0x254b32[_0x8ab4('0x10')]();}}}catch(_0x542279){logger['error']('[%s][GOTOP]\x20%s',_0x5eafec,JSON[_0x8ab4('0x12')](_0x542279));_0x254b32['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index a2ec375..36185c1 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 _0x233e=['channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact'];(function(_0x5481ce,_0x48929e){var _0x4df4a3=function(_0x4cb41a){while(--_0x4cb41a){_0x5481ce['push'](_0x5481ce['shift']());}};_0x4df4a3(++_0x48929e);}(_0x233e,0x1dd));var _0xe233=function(_0xd81a01,_0x296c7e){_0xd81a01=_0xd81a01-0x0;var _0x5a4e48=_0x233e[_0xd81a01];return _0x5a4e48;};'use strict';var _=require('lodash');var utils=require(_0xe233('0x0'));var logger=require(_0xe233('0x1'))('routing');var rpc={'chatMessage':require(_0xe233('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe233('0x3')),'faxMessage':require(_0xe233('0x4')),'whatsappMessage':require(_0xe233('0x5'))};exports[_0xe233('0x6')]=function(_0x3a8662,_0x488c8f){return function(_0x4e0c5b){try{var _0x74df9a={'body':utils[_0xe233('0x7')](_0x488c8f[0x0],this),'ContactId':this[_0xe233('0x8')]['id']};if(this[_0xe233('0x9')]===_0xe233('0xa')){_0x74df9a[_0xe233('0xb')]=this[_0xe233('0xc')]['id'];}else{_0x74df9a[_['upperFirst'](this['channel'])+_0xe233('0xd')]=this[_0xe233('0xc')]['id'];}_0x74df9a[_[_0xe233('0xe')](this[_0xe233('0x9')])+_0xe233('0xf')]=this['interaction']['id'];if(rpc[this[_0xe233('0x9')]+_0xe233('0x10')]){return rpc[this[_0xe233('0x9')]+_0xe233('0x10')][_0xe233('0x11')](_0x74df9a)[_0xe233('0x12')](function(_0x380e94){logger[_0xe233('0x13')](_0xe233('0x14'),_0x3a8662,_0x74df9a[_0xe233('0x15')]);_0x4e0c5b[_0xe233('0x16')]();})[_0xe233('0x17')](function(_0x22f469){logger[_0xe233('0x18')](_0xe233('0x14'),_0x3a8662,JSON[_0xe233('0x19')](_0x22f469));_0x4e0c5b['stop']();});}}catch(_0x561655){logger['error'](_0xe233('0x14'),_0x3a8662,JSON[_0xe233('0x19')](_0x561655));_0x4e0c5b[_0xe233('0x1a')]();}};}; \ No newline at end of file +var _0xa664=['then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa664,0x132));var _0x4a66=function(_0x12542a,_0x220a0d){_0x12542a=_0x12542a-0x0;var _0x1cd15b=_0xa664[_0x12542a];return _0x1cd15b;};'use strict';var _=require('lodash');var utils=require(_0x4a66('0x0'));var logger=require(_0x4a66('0x1'))(_0x4a66('0x2'));var rpc={'chatMessage':require(_0x4a66('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4a66('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4a66('0x5'))};exports[_0x4a66('0x6')]=function(_0x47372d,_0x2661f8){return function(_0x3dd553){try{var _0x3fe28c={'body':utils[_0x4a66('0x7')](_0x2661f8[0x0],this),'ContactId':this['contact']['id']};if(this[_0x4a66('0x8')]===_0x4a66('0x9')){_0x3fe28c[_0x4a66('0xa')]=this[_0x4a66('0xb')]['id'];}else{_0x3fe28c[_['upperFirst'](this[_0x4a66('0x8')])+_0x4a66('0xc')]=this['account']['id'];}_0x3fe28c[_[_0x4a66('0xd')](this[_0x4a66('0x8')])+_0x4a66('0xe')]=this[_0x4a66('0xf')]['id'];if(rpc[this[_0x4a66('0x8')]+_0x4a66('0x10')]){return rpc[this[_0x4a66('0x8')]+_0x4a66('0x10')][_0x4a66('0x11')](_0x3fe28c)[_0x4a66('0x12')](function(_0x177bf1){logger[_0x4a66('0x13')](_0x4a66('0x14'),_0x47372d,_0x3fe28c[_0x4a66('0x15')]);_0x3dd553[_0x4a66('0x16')]();})[_0x4a66('0x17')](function(_0x11f34f){logger['error'](_0x4a66('0x14'),_0x47372d,JSON[_0x4a66('0x18')](_0x11f34f));_0x3dd553[_0x4a66('0x19')]();});}}catch(_0x4208f9){logger[_0x4a66('0x1a')](_0x4a66('0x14'),_0x47372d,JSON[_0x4a66('0x18')](_0x4208f9));_0x3dd553[_0x4a66('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 802fc3e..a0cf76c 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 _0x8205=['next','error','stop','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0x8205,0x12f));var _0x5820=function(_0x4e1efb,_0x358508){_0x4e1efb=_0x4e1efb-0x0;var _0x1f5d97=_0x8205[_0x4e1efb];return _0x1f5d97;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5820('0x0'));exports[_0x5820('0x1')]=function(_0x596947,_0x1b9b46){return function(_0x1bfdb7){try{logger['info'](_0x5820('0x2'),_0x596947,utils['getMustacheRender'](_0x1b9b46[0x0],this));_0x1bfdb7[_0x5820('0x3')]();}catch(_0x248f63){logger[_0x5820('0x4')]('[%s][NOOP]\x20%s',_0x596947,JSON['stringify'](_0x248f63));_0x1bfdb7[_0x5820('0x5')]();}};}; \ No newline at end of file +var _0x2c3c=['getMustacheRender','next','error','stop','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s'];(function(_0x2ff127,_0x3d6e2b){var _0x53af48=function(_0x4a0c47){while(--_0x4a0c47){_0x2ff127['push'](_0x2ff127['shift']());}};_0x53af48(++_0x3d6e2b);}(_0x2c3c,0x134));var _0xc2c3=function(_0xde27cc,_0xb99d9f){_0xde27cc=_0xde27cc-0x0;var _0x23e45e=_0x2c3c[_0xde27cc];return _0x23e45e;};'use strict';var utils=require('./utils');var logger=require(_0xc2c3('0x0'))('routing');exports[_0xc2c3('0x1')]=function(_0x40f63c,_0x5aec34){return function(_0x3c178e){try{logger[_0xc2c3('0x2')](_0xc2c3('0x3'),_0x40f63c,utils[_0xc2c3('0x4')](_0x5aec34[0x0],this));_0x3c178e[_0xc2c3('0x5')]();}catch(_0x4b5592){logger[_0xc2c3('0x6')](_0xc2c3('0x3'),_0x40f63c,JSON['stringify'](_0x4b5592));_0x3c178e[_0xc2c3('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 4ce680b..fa8e00f 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 _0x90fd=['timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','info','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','queue_id','joinAt','emit','clone','queue','account','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update'];(function(_0xee9ecf,_0x1819a8){var _0x1e448c=function(_0x402111){while(--_0x402111){_0xee9ecf['push'](_0xee9ecf['shift']());}};_0x1e448c(++_0x1819a8);}(_0x90fd,0x1a9));var _0xd90f=function(_0x275ff4,_0x3f085e){_0x275ff4=_0x275ff4-0x0;var _0x21cbf7=_0x90fd[_0x275ff4];return _0x21cbf7;};'use strict';var schema=require(_0xd90f('0x0'));var _=require(_0xd90f('0x1'));var util=require(_0xd90f('0x2'));var seqqueue=require(_0xd90f('0x3'));var moment=require(_0xd90f('0x4'));var Redis=require(_0xd90f('0x5'));var config=require(_0xd90f('0x6'));var logger=require(_0xd90f('0x7'))('routing');var strategy=require(_0xd90f('0x8'));config['redis']=_['defaults'](config[_0xd90f('0x9')],{'host':_0xd90f('0xa'),'port':0x18eb});var io=require(_0xd90f('0xb'))(new Redis(config[_0xd90f('0x9')]));var attributes=['id',_0xd90f('0xc'),'account','queue','from',_0xd90f('0xd')];function emit(_0x266385,_0x272fe8,_0x5d8f3d){io['to'](_0x266385)[_0xd90f('0xe')](_0x272fe8,_0x5d8f3d);}function emitChannelQueueInteraction(_0x3a9259,_0x58a0d7,_0x56e1e0,_0xe33b8b,_0x4f9e44,_0x18c992,_0x13855f,_0x47e0e3){var _0x38763f=_[_0xd90f('0xf')](_0x56e1e0);_0x38763f['queue_id']=_0x47e0e3;_0x38763f[_0xd90f('0x10')]=_0x58a0d7;_0x38763f[_0xd90f('0x11')]=_0xe33b8b;_0x38763f['id']=_0x4f9e44;if(_0x18c992){_0x13855f[util['format'](_0xd90f('0x12'),_0x3a9259)][_0x4f9e44]=_[_0xd90f('0x13')](_0x38763f,attributes);}else{delete _0x13855f[util[_0xd90f('0x14')](_0xd90f('0x12'),_0x3a9259)][_0x4f9e44];}emit(util[_0xd90f('0x14')]('%s:queue:%s',_0x3a9259,_0x58a0d7),util['format'](_0xd90f('0x15'),_0x3a9259,_0x18c992?_0xd90f('0x16'):_0xd90f('0x17')),_['pick'](_0x38763f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xd90f('0x18')),'chatQueueReport':require(_0xd90f('0x19')),'smsQueueReport':require(_0xd90f('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xd90f('0x1b'))};var queue=schema({'name':{'type':_0xd90f('0x1c'),'required':!![],'message':_0xd90f('0x1d')},'timeout':{'type':_0xd90f('0x1e'),'message':_0xd90f('0x1f')}});function startRouting(_0x26b33d,_0x1127b8,_0x276162,_0x200fbe){if(_0x26b33d&&_0x1127b8&&_0x276162){_0x1127b8[_0xd90f('0x20')]+=0x1;var _0x29834c={'uniqueid':_0x26b33d,'from':_0x276162[_0xd90f('0x21')]?_0x276162['body'][_0xd90f('0x22')]:'','joinAt':moment()[_0xd90f('0x14')](_0xd90f('0x23')),'ContactId':_0x276162['contact']?_0x276162[_0xd90f('0x24')]['id']:null,'ListId':_0x276162['list']?_0x276162['list']['id']:null};_0x29834c[_[_0xd90f('0x25')](_0x276162['channel'])+_0xd90f('0x26')]=_0x1127b8['id']||null;_0x29834c[_[_0xd90f('0x25')](_0x276162[_0xd90f('0x27')])+_0xd90f('0x28')]=_0x276162[_0xd90f('0x29')]?_0x276162[_0xd90f('0x29')]['id']:null;_0x29834c[_[_0xd90f('0x25')](_0x276162[_0xd90f('0x27')])+_0xd90f('0x2a')]=_0x276162[_0xd90f('0x2b')]?_0x276162[_0xd90f('0x2b')]['id']:null;_0x29834c[_[_0xd90f('0x25')](_0x276162['channel'])+(_0x276162[_0xd90f('0x27')]!==_0xd90f('0x2c')?_0xd90f('0x2d'):_0xd90f('0x2e'))]=_0x276162[_0xd90f('0x11')]?_0x276162[_0xd90f('0x11')]['id']:null;logger['info'](util[_0xd90f('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x26b33d,_0x1127b8[_0xd90f('0x2f')]));emitChannelQueueInteraction(_0x276162[_0xd90f('0x27')],_0x1127b8[_0xd90f('0x2f')],_0x29834c,_0x276162[_0xd90f('0x11')][_0xd90f('0x2f')],_0x276162['message']['id'],!![],_0x200fbe,_0x1127b8['id']);if(rpc[_0x276162['channel']+_0xd90f('0x30')]){return rpc[_0x276162[_0xd90f('0x27')]+_0xd90f('0x30')]['create'](_0x29834c)[_0xd90f('0x31')](function(_0x4fd643){logger[_0xd90f('0x32')](_0xd90f('0x33'));});}}}function stopRouting(_0x14bc3b,_0x13ff90,_0x29a56f,_0x207c25){if(_0x14bc3b&&_0x13ff90){_0x13ff90[_0xd90f('0x20')]-=0x1;var _0x4011b2={'leaveAt':moment()[_0xd90f('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xd90f('0x14')](_0xd90f('0x23')),'reason':_0xd90f('0x34')};logger['info'](util[_0xd90f('0x14')](_0xd90f('0x35'),_0x14bc3b,_0x13ff90[_0xd90f('0x2f')]));emitChannelQueueInteraction(_0x29a56f[_0xd90f('0x27')],_0x13ff90[_0xd90f('0x2f')],_0x29a56f['body'],_0x29a56f[_0xd90f('0x11')][_0xd90f('0x2f')],_0x29a56f[_0xd90f('0x2b')]['id'],![],_0x207c25,_0x13ff90['id']);if(rpc[_0x29a56f['channel']+'QueueReport']){return rpc[_0x29a56f[_0xd90f('0x27')]+_0xd90f('0x30')][_0xd90f('0x36')](_0x14bc3b,_0x4011b2)['catch'](function(_0x41aa5d){logger[_0xd90f('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x24cc70,_0x5eac1f,_0x124249,_0x1b0115){if(_0x24cc70&&_0x5eac1f){_0x5eac1f[_0xd90f('0x20')]-=0x1;var _0x4f8a69={'leaveAt':moment()[_0xd90f('0x14')](_0xd90f('0x23')),'exitAt':moment()[_0xd90f('0x14')](_0xd90f('0x23')),'reason':_0xd90f('0x37')};logger['info'](util[_0xd90f('0x14')](_0xd90f('0x38'),_0x24cc70,_0x5eac1f[_0xd90f('0x2f')]));emitChannelQueueInteraction(_0x124249[_0xd90f('0x27')],_0x5eac1f['name'],_0x124249[_0xd90f('0x21')],_0x124249[_0xd90f('0x11')][_0xd90f('0x2f')],_0x124249[_0xd90f('0x2b')]['id'],![],_0x1b0115);if(rpc[_0x124249[_0xd90f('0x27')]+_0xd90f('0x30')]){return rpc[_0x124249[_0xd90f('0x27')]+_0xd90f('0x30')]['update'](_0x24cc70,_0x4f8a69)['catch'](function(_0x555f79){logger[_0xd90f('0x32')](_0xd90f('0x39'));});}}}function handleFindQueue(_0x4ed93d){return function(_0x18386e){return _0x18386e[_0xd90f('0x2f')]['toLowerCase']()===_0x4ed93d['toLowerCase']();};}exports[_0xd90f('0x3a')]=function(_0x30493c,_0x46d44b,_0x10052b,_0x2cb646){return function(_0x13d611){try{var _0x128cd1={'name':_0x46d44b[0x0],'timeout':_0x46d44b[0x1]};var _0x2d5b15=queue[_0xd90f('0x0')](_0x128cd1,{'typecast':!![]});if(_0x2d5b15[_0xd90f('0x3b')]){logger[_0xd90f('0x32')](_0xd90f('0x3c'),_0x30493c,_[_0xd90f('0x3d')](_0x2d5b15,'message')[_0xd90f('0x3e')](',\x20'));_0x13d611[_0xd90f('0x3f')]();}else{var _0x36121b=_['find'](_0x10052b[_0x2cb646[_0xd90f('0x27')]+'Queues'],handleFindQueue(_0x128cd1['name']));if(_0x36121b){startRouting(_0x30493c,_0x36121b,_0x2cb646,_0x10052b);var _0x2b60fc=(_0x36121b[_0xd90f('0x37')]||0xa)*0x3e8;var _0x2475b7=(_0x128cd1[_0xd90f('0x37')]||0x14)*0x3e8;var _0x17a2a2,_0x584070;if(_0x2b60fc>_0x2475b7){_0x2475b7=_0x2b60fc;}var _0x350ec5=seqqueue[_0xd90f('0x40')](_0x2b60fc);_0x350ec5['id']=_0x30493c;_0x350ec5[_0xd90f('0x41')]=_0x2b60fc;_0x350ec5[_0xd90f('0x42')]=_0x2475b7;_0x350ec5['channel']=_0x2cb646[_0xd90f('0x27')];_0x10052b[_0xd90f('0x43')][_0x30493c]['on'](_0xd90f('0x44'),function(){logger['info'](_0xd90f('0x45'),_0x30493c);stopRouting(_0x30493c,_0x36121b,_0x2cb646,_0x10052b);clearTimeout(_0x17a2a2);_0x17a2a2=undefined;_0x350ec5[_0xd90f('0x46')](!![]);if(_0x10052b[_0xd90f('0x43')][_0x30493c]){delete _0x10052b[_0xd90f('0x43')][_0x30493c];}_0x13d611[_0xd90f('0x3f')]();});_0x10052b[_0xd90f('0x43')][_0x30493c]['on'](_0xd90f('0x47'),function(){if(_0x10052b[_0xd90f('0x43')][_0x30493c]){delete _0x10052b[_0xd90f('0x43')][_0x30493c];}});_0x17a2a2=setTimeout(function(){logger[_0xd90f('0x48')](_0xd90f('0x49'),_0x30493c);endRouting(_0x30493c,_0x36121b,_0x2cb646,_0x10052b);clearTimeout(_0x17a2a2);_0x350ec5[_0xd90f('0x46')](!![]);_0x13d611[_0xd90f('0x4a')]();},_0x2475b7);switch(_0x36121b[_0xd90f('0x4b')]){case _0xd90f('0x4c'):strategy[_0xd90f('0x4c')](_0x350ec5,_0x36121b,_0x10052b,_0x2cb646);break;default:strategy[_0xd90f('0x4d')](_0x350ec5,_0x36121b,_0x10052b,_0x2cb646);}}else{logger[_0xd90f('0x32')](_0xd90f('0x4e'),_0x30493c,_0x128cd1[_0xd90f('0x2f')]);_0x13d611[_0xd90f('0x3f')]();}}}catch(_0x3eb85c){console[_0xd90f('0x4f')](_0x3eb85c);logger[_0xd90f('0x32')](_0xd90f('0x3c'),_0x30493c,_0x3eb85c['stack']);_0x13d611[_0xd90f('0x3f')]();}};}; \ No newline at end of file +var _0x71f6=['timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','interaction','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','update','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','log','stack','lodash','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x39853d,_0x2501bf){var _0x5864ca=function(_0xbc99d5){while(--_0xbc99d5){_0x39853d['push'](_0x39853d['shift']());}};_0x5864ca(++_0x2501bf);}(_0x71f6,0x1ac));var _0x671f=function(_0x545c00,_0x5f026e){_0x545c00=_0x545c00-0x0;var _0x3f0f48=_0x71f6[_0x545c00];return _0x3f0f48;};'use strict';var schema=require('validate');var _=require(_0x671f('0x0'));var util=require('util');var seqqueue=require(_0x671f('0x1'));var moment=require(_0x671f('0x2'));var Redis=require(_0x671f('0x3'));var config=require('../../../../config/environment');var logger=require(_0x671f('0x4'))(_0x671f('0x5'));var strategy=require(_0x671f('0x6'));config[_0x671f('0x7')]=_[_0x671f('0x8')](config[_0x671f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x671f('0x9'))(new Redis(config[_0x671f('0x7')]));var attributes=['id',_0x671f('0xa'),_0x671f('0xb'),_0x671f('0xc'),'from',_0x671f('0xd')];function emit(_0x337ebd,_0x475334,_0x3f0204){io['to'](_0x337ebd)[_0x671f('0xe')](_0x475334,_0x3f0204);}function emitChannelQueueInteraction(_0x5e633b,_0x578f1b,_0x1bdde2,_0x2b0960,_0x340808,_0x5eb7d7,_0x45a059,_0x4e93aa){var _0x590d83=_[_0x671f('0xf')](_0x1bdde2);_0x590d83['queue_id']=_0x4e93aa;_0x590d83['queue']=_0x578f1b;_0x590d83[_0x671f('0xb')]=_0x2b0960;_0x590d83['id']=_0x340808;if(_0x5eb7d7){_0x45a059[util[_0x671f('0x10')](_0x671f('0x11'),_0x5e633b)][_0x340808]=_[_0x671f('0x12')](_0x590d83,attributes);}else{delete _0x45a059[util['format'](_0x671f('0x11'),_0x5e633b)][_0x340808];}emit(util[_0x671f('0x10')](_0x671f('0x13'),_0x5e633b,_0x578f1b),util['format']('%s_queue_waiting_interaction:%s',_0x5e633b,_0x5eb7d7?_0x671f('0x14'):_0x671f('0x15')),_[_0x671f('0x12')](_0x590d83,attributes));}var rpc={'openchannelQueueReport':require(_0x671f('0x16')),'mailQueueReport':require(_0x671f('0x17')),'chatQueueReport':require(_0x671f('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x671f('0x19'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x671f('0x1a')},'timeout':{'type':_0x671f('0x1b'),'message':_0x671f('0x1c')}});function startRouting(_0x518c36,_0x4465d2,_0x41e04c,_0x49d9b6){if(_0x518c36&&_0x4465d2&&_0x41e04c){_0x4465d2[_0x671f('0x1d')]+=0x1;var _0xcdd791={'uniqueid':_0x518c36,'from':_0x41e04c[_0x671f('0x1e')]?_0x41e04c[_0x671f('0x1e')][_0x671f('0x1f')]:'','joinAt':moment()[_0x671f('0x10')](_0x671f('0x20')),'ContactId':_0x41e04c['contact']?_0x41e04c[_0x671f('0x21')]['id']:null,'ListId':_0x41e04c['list']?_0x41e04c['list']['id']:null};_0xcdd791[_[_0x671f('0x22')](_0x41e04c[_0x671f('0x23')])+_0x671f('0x24')]=_0x4465d2['id']||null;_0xcdd791[_[_0x671f('0x22')](_0x41e04c[_0x671f('0x23')])+'InteractionId']=_0x41e04c[_0x671f('0x25')]?_0x41e04c[_0x671f('0x25')]['id']:null;_0xcdd791[_[_0x671f('0x22')](_0x41e04c[_0x671f('0x23')])+'MessageId']=_0x41e04c[_0x671f('0x26')]?_0x41e04c[_0x671f('0x26')]['id']:null;_0xcdd791[_[_0x671f('0x22')](_0x41e04c[_0x671f('0x23')])+(_0x41e04c[_0x671f('0x23')]!==_0x671f('0x27')?_0x671f('0x28'):'WebsiteId')]=_0x41e04c[_0x671f('0xb')]?_0x41e04c['account']['id']:null;logger[_0x671f('0x29')](util[_0x671f('0x10')](_0x671f('0x2a'),_0x518c36,_0x4465d2[_0x671f('0x2b')]));emitChannelQueueInteraction(_0x41e04c['channel'],_0x4465d2[_0x671f('0x2b')],_0xcdd791,_0x41e04c[_0x671f('0xb')][_0x671f('0x2b')],_0x41e04c[_0x671f('0x26')]['id'],!![],_0x49d9b6,_0x4465d2['id']);if(rpc[_0x41e04c['channel']+_0x671f('0x2c')]){return rpc[_0x41e04c['channel']+_0x671f('0x2c')]['create'](_0xcdd791)[_0x671f('0x2d')](function(_0xea441f){logger[_0x671f('0x2e')](_0x671f('0x2f'));});}}}function stopRouting(_0x2d6ada,_0x4402aa,_0x473b45,_0x3fe654){if(_0x2d6ada&&_0x4402aa){_0x4402aa[_0x671f('0x1d')]-=0x1;var _0x2582dd={'leaveAt':moment()[_0x671f('0x10')](_0x671f('0x20')),'acceptAt':moment()[_0x671f('0x10')](_0x671f('0x20')),'reason':_0x671f('0x30')};logger[_0x671f('0x29')](util[_0x671f('0x10')](_0x671f('0x31'),_0x2d6ada,_0x4402aa['name']));emitChannelQueueInteraction(_0x473b45[_0x671f('0x23')],_0x4402aa[_0x671f('0x2b')],_0x473b45[_0x671f('0x1e')],_0x473b45[_0x671f('0xb')][_0x671f('0x2b')],_0x473b45[_0x671f('0x26')]['id'],![],_0x3fe654,_0x4402aa['id']);if(rpc[_0x473b45[_0x671f('0x23')]+_0x671f('0x2c')]){return rpc[_0x473b45['channel']+_0x671f('0x2c')]['update'](_0x2d6ada,_0x2582dd)['catch'](function(_0x1b473a){logger[_0x671f('0x2e')](_0x671f('0x32'));});}}}function endRouting(_0x338f87,_0x46ae59,_0x1ac9c3,_0xe240ef){if(_0x338f87&&_0x46ae59){_0x46ae59[_0x671f('0x1d')]-=0x1;var _0xfba2c6={'leaveAt':moment()[_0x671f('0x10')](_0x671f('0x20')),'exitAt':moment()[_0x671f('0x10')](_0x671f('0x20')),'reason':_0x671f('0x33')};logger['info'](util['format']('[%s][END:QUEUE][NAME:%s]',_0x338f87,_0x46ae59[_0x671f('0x2b')]));emitChannelQueueInteraction(_0x1ac9c3['channel'],_0x46ae59[_0x671f('0x2b')],_0x1ac9c3[_0x671f('0x1e')],_0x1ac9c3['account'][_0x671f('0x2b')],_0x1ac9c3[_0x671f('0x26')]['id'],![],_0xe240ef);if(rpc[_0x1ac9c3[_0x671f('0x23')]+_0x671f('0x2c')]){return rpc[_0x1ac9c3[_0x671f('0x23')]+_0x671f('0x2c')][_0x671f('0x34')](_0x338f87,_0xfba2c6)[_0x671f('0x2d')](function(_0x2b29c5){logger[_0x671f('0x2e')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x3334aa){return function(_0x16d77f){return _0x16d77f[_0x671f('0x2b')][_0x671f('0x35')]()===_0x3334aa[_0x671f('0x35')]();};}exports[_0x671f('0x36')]=function(_0x568815,_0x2860ec,_0x233499,_0x3b2c3b){return function(_0x41c11f){try{var _0x3cc39b={'name':_0x2860ec[0x0],'timeout':_0x2860ec[0x1]};var _0x4cde8a=queue[_0x671f('0x37')](_0x3cc39b,{'typecast':!![]});if(_0x4cde8a[_0x671f('0x38')]){logger[_0x671f('0x2e')](_0x671f('0x39'),_0x568815,_[_0x671f('0x3a')](_0x4cde8a,_0x671f('0x26'))[_0x671f('0x3b')](',\x20'));_0x41c11f[_0x671f('0x3c')]();}else{var _0x4f06c2=_['find'](_0x233499[_0x3b2c3b[_0x671f('0x23')]+_0x671f('0x3d')],handleFindQueue(_0x3cc39b[_0x671f('0x2b')]));if(_0x4f06c2){startRouting(_0x568815,_0x4f06c2,_0x3b2c3b,_0x233499);var _0x59f340=(_0x4f06c2[_0x671f('0x33')]||0xa)*0x3e8;var _0x4d9484=(_0x3cc39b[_0x671f('0x33')]||0x14)*0x3e8;var _0x362489,_0x14330a;if(_0x59f340>_0x4d9484){_0x4d9484=_0x59f340;}var _0x28deab=seqqueue[_0x671f('0x3e')](_0x59f340);_0x28deab['id']=_0x568815;_0x28deab[_0x671f('0x3f')]=_0x59f340;_0x28deab[_0x671f('0x40')]=_0x4d9484;_0x28deab[_0x671f('0x23')]=_0x3b2c3b[_0x671f('0x23')];_0x233499[_0x671f('0x41')][_0x568815]['on']('end',function(){logger[_0x671f('0x29')](_0x671f('0x42'),_0x568815);stopRouting(_0x568815,_0x4f06c2,_0x3b2c3b,_0x233499);clearTimeout(_0x362489);_0x362489=undefined;_0x28deab[_0x671f('0x43')](!![]);if(_0x233499[_0x671f('0x41')][_0x568815]){delete _0x233499[_0x671f('0x41')][_0x568815];}_0x41c11f[_0x671f('0x3c')]();});_0x233499[_0x671f('0x41')][_0x568815]['on'](_0x671f('0x44'),function(){if(_0x233499[_0x671f('0x41')][_0x568815]){delete _0x233499[_0x671f('0x41')][_0x568815];}});_0x362489=setTimeout(function(){logger[_0x671f('0x29')](_0x671f('0x45'),_0x568815);endRouting(_0x568815,_0x4f06c2,_0x3b2c3b,_0x233499);clearTimeout(_0x362489);_0x28deab[_0x671f('0x43')](!![]);_0x41c11f[_0x671f('0x46')]();},_0x4d9484);switch(_0x4f06c2[_0x671f('0x47')]){case'rrmemory':strategy[_0x671f('0x48')](_0x28deab,_0x4f06c2,_0x233499,_0x3b2c3b);break;default:strategy[_0x671f('0x49')](_0x28deab,_0x4f06c2,_0x233499,_0x3b2c3b);}}else{logger[_0x671f('0x2e')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x568815,_0x3cc39b[_0x671f('0x2b')]);_0x41c11f[_0x671f('0x3c')]();}}}catch(_0x3add15){console[_0x671f('0x4a')](_0x3add15);logger[_0x671f('0x2e')](_0x671f('0x39'),_0x568815,_0x3add15[_0x671f('0x4b')]);_0x41c11f['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 a162266..eda15c9 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 _0x799b=['push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','RINGING','routing',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','notificationId','squeue','agent','realtime'];(function(_0x3b5ae3,_0x21b49c){var _0x27e9f7=function(_0x32b5d5){while(--_0x32b5d5){_0x3b5ae3['push'](_0x3b5ae3['shift']());}};_0x27e9f7(++_0x21b49c);}(_0x799b,0xcb));var _0xb799=function(_0x588a02,_0x5bbc44){_0x588a02=_0x588a02-0x0;var _0x324657=_0x799b[_0x588a02];return _0x324657;};'use strict';var _=require(_0xb799('0x0'));var uuid=require(_0xb799('0x1'));var util=require(_0xb799('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x5e0d8d,_0x15941d,_0x539a78,_0x3307bb){this[_0xb799('0x3')]=uuid['v4']();this[_0xb799('0x4')]=_0x5e0d8d;this[_0xb799('0x5')]=_0x15941d;this[_0xb799('0x6')]=_0x539a78;this['routing']=_0x3307bb;this[_0xb799('0x4')][_0xb799('0x7')](this[_0xb799('0x8')]['bind'](this),this[_0xb799('0x9')]['bind'](this));this['squeue']['on'](_0xb799('0xa'),this[_0xb799('0x9')]['bind'](this));this['squeue']['on'](_0xb799('0xb'),this[_0xb799('0xc')][_0xb799('0xd')](this));};Agent[_0xb799('0xe')]['push']=function(){this[_0xb799('0x4')][_0xb799('0x7')](this[_0xb799('0x8')][_0xb799('0xd')](this),this[_0xb799('0x9')][_0xb799('0xd')](this));};Agent[_0xb799('0xe')]['handleDrained']=function(){this[_0xb799('0x9')](!![]);};Agent[_0xb799('0xe')][_0xb799('0x8')]=function(_0x29f7a9){logger[_0xb799('0xf')](_0xb799('0x10'),this[_0xb799('0x4')]['id'],this[_0xb799('0x5')]['id']);if(_[_0xb799('0x11')](this[_0xb799('0x6')][_0xb799('0x12')][this['agent']['id']])){logger[_0xb799('0xf')](_0xb799('0x13'),this[_0xb799('0x4')]['id'],this[_0xb799('0x5')]['id']);setTimeout(this[_0xb799('0x7')]['bind'](this),0x3e8);}else{if(this['routing'][_0xb799('0x14')]||util[_0xb799('0x15')](this[_0xb799('0x4')]['id'],this[_0xb799('0x6')][_0xb799('0x12')][this['agent']['id']],this[_0xb799('0x4')][_0xb799('0x16')],![])){this[_0xb799('0x6')]['agents'][this[_0xb799('0x5')]['id']][_0xb799('0x17')]=!![];this['realtime'][_0xb799('0x12')][this[_0xb799('0x5')]['id']][_0xb799('0x18')]=undefined;util['showNotification'](this['notificationId'],this[_0xb799('0x4')]['id'],this[_0xb799('0x6')][_0xb799('0x12')][this['agent']['id']],null,this['routing']);util['writeLog'](this[_0xb799('0x4')]['id'],this[_0xb799('0x6')]['agents'][this[_0xb799('0x5')]['id']],_0xb799('0x19')+(this[_0xb799('0x1a')]['forcedOwnership']?_0xb799('0x1b'):''));}else{logger['info'](_0xb799('0x1c'),this[_0xb799('0x4')]['id'],this[_0xb799('0x5')]['id']);setTimeout(this[_0xb799('0x7')]['bind'](this),0x3e8);}}};Agent[_0xb799('0xe')][_0xb799('0x9')]=function(_0x252ef4){if(_[_0xb799('0x11')](this['realtime'][_0xb799('0x12')][this[_0xb799('0x5')]['id']])){return logger[_0xb799('0xf')](_0xb799('0x13'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xb799('0xf')](_0xb799('0x1d'),this[_0xb799('0x4')]['id'],this['agent']['id']);util[_0xb799('0x1e')](this[_0xb799('0x3')],this[_0xb799('0x4')]['id'],this[_0xb799('0x6')][_0xb799('0x12')][this[_0xb799('0x5')]['id']],null,this[_0xb799('0x1a')]);this[_0xb799('0x6')]['agents'][this[_0xb799('0x5')]['id']]['busy']=![];this['realtime'][_0xb799('0x12')][this[_0xb799('0x5')]['id']][_0xb799('0x18')]=undefined;util[_0xb799('0x1f')](this[_0xb799('0x4')]['id'],this[_0xb799('0x6')][_0xb799('0x12')][this[_0xb799('0x5')]['id']],_0x252ef4?_0xb799('0x20'):_0xb799('0x21'));}if(!_0x252ef4){setTimeout(this[_0xb799('0x7')][_0xb799('0xd')](this),0x3e8);}};function agent(_0x247e9a,_0x2b2ab4,_0x5e1355,_0x3bf893){return new Agent(_0x247e9a,_0x2b2ab4,_0x5e1355,_0x3bf893);}module[_0xb799('0x22')]=agent; \ No newline at end of file +var _0xf98c=['drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','realtime','squeue','push','bind','timeout','handleTimeout'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf98c,0x10e));var _0xcf98=function(_0xa3c5b7,_0x16ddeb){_0xa3c5b7=_0xa3c5b7-0x0;var _0x4e200a=_0xf98c[_0xa3c5b7];return _0x4e200a;};'use strict';var _=require('lodash');var uuid=require(_0xcf98('0x0'));var util=require(_0xcf98('0x1'));var logger=require(_0xcf98('0x2'))(_0xcf98('0x3'));var Agent=function(_0x3b2ded,_0x17a3b8,_0x4ef097,_0xed043f){this['notificationId']=uuid['v4']();this['squeue']=_0x3b2ded;this['agent']=_0x17a3b8;this[_0xcf98('0x4')]=_0x4ef097;this['routing']=_0xed043f;this[_0xcf98('0x5')][_0xcf98('0x6')](this['handleRun'][_0xcf98('0x7')](this),this['handleTimeout'][_0xcf98('0x7')](this));this[_0xcf98('0x5')]['on'](_0xcf98('0x8'),this[_0xcf98('0x9')][_0xcf98('0x7')](this));this[_0xcf98('0x5')]['on'](_0xcf98('0xa'),this[_0xcf98('0xb')][_0xcf98('0x7')](this));};Agent[_0xcf98('0xc')][_0xcf98('0x6')]=function(){this[_0xcf98('0x5')][_0xcf98('0x6')](this[_0xcf98('0xd')][_0xcf98('0x7')](this),this[_0xcf98('0x9')][_0xcf98('0x7')](this));};Agent[_0xcf98('0xc')][_0xcf98('0xb')]=function(){this[_0xcf98('0x9')](!![]);};Agent['prototype']['handleRun']=function(_0x33966c){logger[_0xcf98('0xe')](_0xcf98('0xf'),this[_0xcf98('0x5')]['id'],this[_0xcf98('0x10')]['id']);if(_[_0xcf98('0x11')](this['realtime'][_0xcf98('0x12')][this[_0xcf98('0x10')]['id']])){logger[_0xcf98('0xe')](_0xcf98('0x13'),this[_0xcf98('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xcf98('0x6')][_0xcf98('0x7')](this),0x3e8);}else{if(this[_0xcf98('0x3')][_0xcf98('0x14')]||util[_0xcf98('0x15')](this[_0xcf98('0x5')]['id'],this[_0xcf98('0x4')]['agents'][this['agent']['id']],this[_0xcf98('0x5')][_0xcf98('0x16')],![])){this['realtime'][_0xcf98('0x12')][this[_0xcf98('0x10')]['id']][_0xcf98('0x17')]=!![];this['realtime'][_0xcf98('0x12')][this[_0xcf98('0x10')]['id']][_0xcf98('0x18')]=undefined;util[_0xcf98('0x19')](this[_0xcf98('0x1a')],this[_0xcf98('0x5')]['id'],this['realtime'][_0xcf98('0x12')][this[_0xcf98('0x10')]['id']],null,this[_0xcf98('0x3')]);util[_0xcf98('0x1b')](this[_0xcf98('0x5')]['id'],this[_0xcf98('0x4')][_0xcf98('0x12')][this[_0xcf98('0x10')]['id']],_0xcf98('0x1c')+(this[_0xcf98('0x3')]['forcedOwnership']?_0xcf98('0x1d'):''));}else{logger['info'](_0xcf98('0x1e'),this[_0xcf98('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xcf98('0x6')][_0xcf98('0x7')](this),0x3e8);}}};Agent['prototype'][_0xcf98('0x9')]=function(_0x12daa6){if(_[_0xcf98('0x11')](this[_0xcf98('0x4')]['agents'][this[_0xcf98('0x10')]['id']])){return logger[_0xcf98('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xcf98('0x5')]['id'],this[_0xcf98('0x10')]['id']);}else{logger[_0xcf98('0xe')](_0xcf98('0x1f'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0xcf98('0x1a')],this['squeue']['id'],this[_0xcf98('0x4')][_0xcf98('0x12')][this['agent']['id']],null,this[_0xcf98('0x3')]);this['realtime'][_0xcf98('0x12')][this[_0xcf98('0x10')]['id']]['busy']=![];this['realtime'][_0xcf98('0x12')][this[_0xcf98('0x10')]['id']][_0xcf98('0x18')]=undefined;util[_0xcf98('0x1b')](this[_0xcf98('0x5')]['id'],this[_0xcf98('0x4')][_0xcf98('0x12')][this[_0xcf98('0x10')]['id']],_0x12daa6?_0xcf98('0x20'):_0xcf98('0x21'));}if(!_0x12daa6){setTimeout(this[_0xcf98('0x6')][_0xcf98('0x7')](this),0x3e8);}};function agent(_0x4ea333,_0x4a14ec,_0x303858,_0x1114b1){return new Agent(_0x4ea333,_0x4a14ec,_0x303858,_0x1114b1);}module[_0xcf98('0x22')]=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 76d3bb2..cc80b01 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 _0xf1c6=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','queue','realtime','push','bind','handleTimeout','timeout','squeue','handleDrained','handleRun','prototype','isNil','Agents','length','agents','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','showNotification','info','[%s][QUEUE]\x20EMPTY'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf1c6,0x145));var _0x6f1c=function(_0x21a503,_0xf02ff8){_0x21a503=_0x21a503-0x0;var _0x45b707=_0xf1c6[_0x21a503];return _0x45b707;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x6f1c('0x0'));var logger=require(_0x6f1c('0x1'))(_0x6f1c('0x2'));var Beepall=function(_0x405b3c,_0xc393e2,_0x5daa45,_0x5f0d77){this[_0x6f1c('0x3')]=uuid['v4']();this['squeue']=_0x405b3c;this[_0x6f1c('0x4')]=_0xc393e2;this[_0x6f1c('0x5')]=_0x5daa45;this[_0x6f1c('0x2')]=_0x5f0d77;this['squeue'][_0x6f1c('0x6')](this['handleRun'][_0x6f1c('0x7')](this),this[_0x6f1c('0x8')][_0x6f1c('0x7')](this));this['squeue']['on'](_0x6f1c('0x9'),this['handleTimeout'][_0x6f1c('0x7')](this));this[_0x6f1c('0xa')]['on']('drained',this[_0x6f1c('0xb')][_0x6f1c('0x7')](this));};Beepall['prototype']['push']=function(){this['squeue']['push'](this[_0x6f1c('0xc')]['bind'](this),this['handleTimeout']['bind'](this));};Beepall['prototype']['handleDrained']=function(_0x38d780){this[_0x6f1c('0x8')](!![]);};Beepall[_0x6f1c('0xd')]['handleRun']=function(_0x82203a){var _0x238c62=!![];if(!_[_0x6f1c('0xe')](this['queue'])&&!_[_0x6f1c('0xe')](this[_0x6f1c('0x4')]['Agents'])&&this[_0x6f1c('0x4')][_0x6f1c('0xf')][_0x6f1c('0x10')]>0x0){for(var _0x6e2d39=0x0,_0x3c3e21;_0x6e2d390x0){for(var _0x1181a1=0x0,_0x23fbfc;_0x1181a10x0&&_0x53640a[_0x37f339+_0x6953('0x25')]>=_0x53640a[_0x37f339+_0x6953('0x24')]){writeLog(_0x171dd8,_0x53640a,_0x37f339[_0x6953('0x26')]()+_0x6953('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x3dd890,_0x3c1075,_0x527b9a,_0x3be82d,_0x4af39d){return sendNotification(!![],_0x3dd890,_0x3c1075,_0x527b9a,_0x3be82d,_0x4af39d);};exports[_0x6953('0x28')]=function(_0x3b1175,_0x426c7c,_0x4b0325,_0x131992,_0x3d7b04){return sendNotification(![],_0x3b1175,_0x426c7c,_0x4b0325,_0x131992,_0x3d7b04);};exports[_0x6953('0x29')]=writeLog; \ No newline at end of file +var _0xd8fb=['mustache','routing','redis','localhost','emit','user:%s','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','msg','error','format','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','lodash','util','../utils'];(function(_0x23607a,_0x229343){var _0x2c5df2=function(_0x1c3858){while(--_0x1c3858){_0x23607a['push'](_0x23607a['shift']());}};_0x2c5df2(++_0x229343);}(_0xd8fb,0x99));var _0xbd8f=function(_0x48d896,_0x4d5d5e){_0x48d896=_0x48d896-0x0;var _0x5c4d1e=_0xd8fb[_0x48d896];return _0x5c4d1e;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var utils=require(_0xbd8f('0x2'));var Mustache=require(_0xbd8f('0x3'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0xbd8f('0x4'));config[_0xbd8f('0x5')]=_['defaults'](config[_0xbd8f('0x5')],{'host':_0xbd8f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd8f('0x5')]));function emit(_0x4e97cf,_0xf503c4,_0x578499){io['to'](_0x4e97cf)[_0xbd8f('0x7')](_0xf503c4,_0x578499);}function sendNotification(_0x403edc,_0x493298,_0x5697bd,_0x3caa93,_0x2393a9,_0x2a55b5){io['to'](util['format'](_0xbd8f('0x8'),_0x3caa93[_0xbd8f('0x9')]))['emit']('user:save',_0x3caa93);var _0x342bcb=_0x2a55b5||{};var _0x40a5bc=_0x5697bd[_0xbd8f('0xa')]('.');var _0x5d5705={'uniqueid':_0x493298,'channel':_0x40a5bc[0x0],'id':_0x40a5bc[0x1],'title':_0x40a5bc[0x0]+_0xbd8f('0xb'),'interactionId':_0x40a5bc[0x2],'queue':_0x2393a9?_0x2393a9[_0xbd8f('0x9')]:null,'sound':_0x342bcb[_0xbd8f('0xc')][_0xbd8f('0xd')],'shake':_0x342bcb[_0xbd8f('0xc')][_0xbd8f('0xe')]};try{if(!_0x342bcb[_0xbd8f('0xf')]){_0x342bcb[_0xbd8f('0xf')]={};}if(_0x2393a9){_0x342bcb[_0xbd8f('0xf')]['queue']=_0x2393a9;}else if(_0x342bcb[_0xbd8f('0xf')][_0xbd8f('0x10')]){delete _0x342bcb[_0xbd8f('0xf')][_0xbd8f('0x10')];}_0x5d5705['msg']=utils[_0xbd8f('0x11')](_0x342bcb[_0xbd8f('0xc')]['notificationTemplate'],_0x342bcb);}catch(_0x15be97){_0x5d5705[_0xbd8f('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xbd8f('0x13')](util[_0xbd8f('0x14')]('[%s][QUEUE]\x20%s',_0x493298,_0x15be97['message']));}io['to'](util[_0xbd8f('0x14')]('user:%s',_0x3caa93['name']))[_0xbd8f('0x7')](util['format'](_0xbd8f('0x15'),_0x403edc?_0xbd8f('0x16'):_0xbd8f('0x17')),_0x5d5705);}function writeLog(_0x897f25,_0xdc11cc,_0x20cab7){return logger[_0xbd8f('0x18')](util[_0xbd8f('0x14')](_0xbd8f('0x19'),_0x897f25,_0xdc11cc[_0xbd8f('0x9')],_0x20cab7));}exports[_0xbd8f('0x1a')]=function(_0x1628f5,_0x2f7c45,_0x15c4a9,_0x320ede){if(_0x2f7c45[_0xbd8f('0x1b')]){writeLog(_0x1628f5,_0x2f7c45,_0xbd8f('0x1c'));return![];}if(!_0x2f7c45['online']){writeLog(_0x1628f5,_0x2f7c45,_0xbd8f('0x1d'));return![];}if(_0x2f7c45[_0x15c4a9+_0xbd8f('0x1e')]){writeLog(_0x1628f5,_0x2f7c45,_0xbd8f('0x1f'));return![];}if(_0x320ede&&_0x2f7c45[_0xbd8f('0x20')](_0x15c4a9+_0xbd8f('0x21'))&&_0x2f7c45[_0xbd8f('0x20')](_0x15c4a9+_0xbd8f('0x22'))){if(_0x2f7c45[_0x15c4a9+_0xbd8f('0x21')]>0x0&&_0x2f7c45[_0x15c4a9+'CurrentCapacity']>=_0x2f7c45[_0x15c4a9+_0xbd8f('0x21')]){writeLog(_0x1628f5,_0x2f7c45,_0x15c4a9[_0xbd8f('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xbd8f('0x24')]=function(_0x557daa,_0x41b2a6,_0x30d62e,_0x991401,_0x202126){return sendNotification(!![],_0x557daa,_0x41b2a6,_0x30d62e,_0x991401,_0x202126);};exports[_0xbd8f('0x25')]=function(_0x247b07,_0x4c4431,_0x166de7,_0x14f3cb,_0x39714d){return sendNotification(![],_0x247b07,_0x4c4431,_0x166de7,_0x14f3cb,_0x39714d);};exports[_0xbd8f('0x26')]=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 cc96ffc..56ee7af 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 _0xcc1b=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0xd61222,_0x417e58){var _0x6c56db=function(_0x12ec4e){while(--_0x12ec4e){_0xd61222['push'](_0xd61222['shift']());}};_0x6c56db(++_0x417e58);}(_0xcc1b,0x8c));var _0xbcc1=function(_0x584d79,_0x145074){_0x584d79=_0x584d79-0x0;var _0x599576=_0xcc1b[_0x584d79];return _0x599576;};'use strict';var schema=require(_0xbcc1('0x0'));var sh=require('shelljs');var _=require(_0xbcc1('0x1'));var utils=require('./utils');var logger=require(_0xbcc1('0x2'))(_0xbcc1('0x3'));var system=schema({'command':{'type':_0xbcc1('0x4'),'required':!![],'message':_0xbcc1('0x5')}});exports[_0xbcc1('0x6')]=function(_0x184998,_0x1af07d){return function(_0x4c3dc4){try{var _0x3497dc={'command':_0x1af07d[0x0]};var _0x23c6a2=system[_0xbcc1('0x0')](_0x3497dc,{'typecast':!![]});if(_0x23c6a2['length']){logger[_0xbcc1('0x7')](_0xbcc1('0x8'),_0x184998,_[_0xbcc1('0x9')](_0x23c6a2,_0xbcc1('0xa'))[_0xbcc1('0xb')](',\x20'));logger[_0xbcc1('0xc')](_0xbcc1('0xd'),_0x184998);_0x4c3dc4[_0xbcc1('0xe')]();}else{var _0x5d7a70=this;var _0x4b4af7=utils['getMustacheRender'](_0x1af07d[0x0],this);logger[_0xbcc1('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x184998,_0x4b4af7);sh[_0xbcc1('0xf')](_[_0xbcc1('0x10')](_0x4b4af7),function(_0x3d578b,_0x288acf){logger[_0xbcc1('0xc')](_0xbcc1('0x11'),_0x184998,_0x3d578b);if(_0x3d578b==0x0){var _0x1e22bf=_0x288acf[_0xbcc1('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xbcc1('0x13')](_0x1af07d[0x1])||_[_0xbcc1('0x14')](_0x1af07d[0x1])){logger['info'](_0xbcc1('0x15'),_0x184998);_0x5d7a70[_0xbcc1('0x16')][_0x1af07d[0x1]]=_0x1e22bf;}else{logger[_0xbcc1('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x184998,_0x1af07d[0x1],_0x1e22bf);_0x5d7a70[_0xbcc1('0x16')][_0x1af07d[0x1]]=_0x1e22bf;}}_0x4c3dc4[_0xbcc1('0xe')]();});}}catch(_0x42e18c){logger['error'](_0xbcc1('0x8'),_0x184998,_['isObject'](_0x42e18c)?JSON[_0xbcc1('0x17')](_0x42e18c):_0x42e18c);logger['info'](_0xbcc1('0xd'),_0x184998);_0x4c3dc4[_0xbcc1('0xe')]();}};}; \ No newline at end of file +var _0x08d2=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','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','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','./utils','../../../../config/logger','routing'];(function(_0x422186,_0x542b0e){var _0x2fbc1a=function(_0x22ab0b){while(--_0x22ab0b){_0x422186['push'](_0x422186['shift']());}};_0x2fbc1a(++_0x542b0e);}(_0x08d2,0x182));var _0x208d=function(_0x2600fc,_0x51522f){_0x2600fc=_0x2600fc-0x0;var _0x5ade65=_0x08d2[_0x2600fc];return _0x5ade65;};'use strict';var schema=require(_0x208d('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x208d('0x1'));var logger=require(_0x208d('0x2'))(_0x208d('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x208d('0x4')}});exports[_0x208d('0x5')]=function(_0x4df5c5,_0x767054){return function(_0x295cbe){try{var _0x21e29b={'command':_0x767054[0x0]};var _0x502760=system[_0x208d('0x0')](_0x21e29b,{'typecast':!![]});if(_0x502760[_0x208d('0x6')]){logger[_0x208d('0x7')](_0x208d('0x8'),_0x4df5c5,_[_0x208d('0x9')](_0x502760,_0x208d('0xa'))[_0x208d('0xb')](',\x20'));logger[_0x208d('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4df5c5);_0x295cbe[_0x208d('0xd')]();}else{var _0x51d6d3=this;var _0x319561=utils['getMustacheRender'](_0x767054[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x4df5c5,_0x319561);sh[_0x208d('0xe')](_[_0x208d('0xf')](_0x319561),function(_0x159009,_0x2698a1){logger[_0x208d('0xc')](_0x208d('0x10'),_0x4df5c5,_0x159009);if(_0x159009==0x0){var _0x6a6204=_0x2698a1[_0x208d('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x208d('0x12')](_0x767054[0x1])||_[_0x208d('0x13')](_0x767054[0x1])){logger[_0x208d('0xc')](_0x208d('0x14'),_0x4df5c5);_0x51d6d3[_0x208d('0x15')][_0x767054[0x1]]=_0x6a6204;}else{logger[_0x208d('0xc')](_0x208d('0x16'),_0x4df5c5,_0x767054[0x1],_0x6a6204);_0x51d6d3['body'][_0x767054[0x1]]=_0x6a6204;}}_0x295cbe[_0x208d('0xd')]();});}}catch(_0x3521e5){logger['error']('[%s][SYSTEM]\x20%s',_0x4df5c5,_[_0x208d('0x17')](_0x3521e5)?JSON[_0x208d('0x18')](_0x3521e5):_0x3521e5);logger['info'](_0x208d('0x19'),_0x4df5c5);_0x295cbe[_0x208d('0xd')]();}};}; \ 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 d852711..6118756 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 _0x27dc=['lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join','info','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate'];(function(_0x5c1832,_0x315115){var _0x409252=function(_0x12f1ea){while(--_0x12f1ea){_0x5c1832['push'](_0x5c1832['shift']());}};_0x409252(++_0x315115);}(_0x27dc,0xf9));var _0xc27d=function(_0x1d9531,_0x575e80){_0x1d9531=_0x1d9531-0x0;var _0x1caff9=_0x27dc[_0x1d9531];return _0x1caff9;};'use strict';var schema=require(_0xc27d('0x0'));var _=require(_0xc27d('0x1'));var rpc={'chatInteraction':require(_0xc27d('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xc27d('0x3')),'mailInteraction':require(_0xc27d('0x4')),'faxInteraction':require(_0xc27d('0x5')),'whatsappInteraction':require(_0xc27d('0x6'))};var logger=require('../../../../config/logger')(_0xc27d('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xc27d('0x8')}});exports['consequence']=function(_0x2a7848,_0x39c5a0,_0x320b18,_0x5d45d5){return function(_0x224635){try{var _0x17b2b8={'tag':_0x39c5a0[0x0]};var _0x483616=tag['validate'](_0x17b2b8,{'typecast':!![]});if(_0x483616['length']){logger[_0xc27d('0x9')](_0xc27d('0xa'),_0x2a7848,_[_0xc27d('0xb')](_0x483616,_0xc27d('0xc'))[_0xc27d('0xd')](',\x20'));logger[_0xc27d('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2a7848);_0x224635[_0xc27d('0xf')]();}else{var _0x290b4e={'ids':[_0x39c5a0[0x0]]};if(rpc[_0x5d45d5[_0xc27d('0x10')]+_0xc27d('0x11')]){rpc[_0x5d45d5['channel']+_0xc27d('0x11')][_0xc27d('0x12')](_0x5d45d5[_0xc27d('0x13')]['id'],_0x290b4e)['then'](function(_0x285188){logger[_0xc27d('0xe')](_0xc27d('0x14'),_0x2a7848,_0x39c5a0[0x1],_0x5d45d5['channel'],_0x5d45d5[_0xc27d('0x13')]['id']);})[_0xc27d('0x15')](function(_0x3d0dc4){logger[_0xc27d('0x9')](_0xc27d('0xa'),_0x2a7848,JSON[_0xc27d('0x16')](_0x3d0dc4));logger['info'](_0xc27d('0x17'),_0x2a7848);})[_0xc27d('0x18')](function(){_0x224635[_0xc27d('0xf')]();});}}}catch(_0xf77736){logger['error'](_0xc27d('0xa'),_0x2a7848,_['isObject'](_0xf77736)?JSON[_0xc27d('0x16')](_0xf77736):_0xf77736);logger[_0xc27d('0xe')](_0xc27d('0x17'),_0x2a7848);_0x224635['next']();}};}; \ No newline at end of file +var _0xde2d=['../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','message','join','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x5d42fe,_0x5071ff){var _0x5b4597=function(_0x3ac70c){while(--_0x3ac70c){_0x5d42fe['push'](_0x5d42fe['shift']());}};_0x5b4597(++_0x5071ff);}(_0xde2d,0x1ea));var _0xdde2=function(_0x3cb7c1,_0x1bde10){_0x3cb7c1=_0x3cb7c1-0x0;var _0x3f6ffc=_0xde2d[_0x3cb7c1];return _0x3f6ffc;};'use strict';var schema=require(_0xdde2('0x0'));var _=require(_0xdde2('0x1'));var rpc={'chatInteraction':require(_0xdde2('0x2')),'openchannelInteraction':require(_0xdde2('0x3')),'smsInteraction':require(_0xdde2('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xdde2('0x5'))};var logger=require(_0xdde2('0x6'))('routing');var tag=schema({'tag':{'type':_0xdde2('0x7'),'required':!![],'message':_0xdde2('0x8')}});exports[_0xdde2('0x9')]=function(_0x3a4185,_0x478b87,_0x4f6e4f,_0x146212){return function(_0x10434d){try{var _0xd9aaf9={'tag':_0x478b87[0x0]};var _0x39eb06=tag[_0xdde2('0x0')](_0xd9aaf9,{'typecast':!![]});if(_0x39eb06[_0xdde2('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x3a4185,_['map'](_0x39eb06,_0xdde2('0xb'))[_0xdde2('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a4185);_0x10434d['next']();}else{var _0x7d84e4={'ids':[_0x478b87[0x0]]};if(rpc[_0x146212[_0xdde2('0xd')]+_0xdde2('0xe')]){rpc[_0x146212['channel']+_0xdde2('0xe')][_0xdde2('0xf')](_0x146212[_0xdde2('0x10')]['id'],_0x7d84e4)['then'](function(_0x588748){logger[_0xdde2('0x11')](_0xdde2('0x12'),_0x3a4185,_0x478b87[0x1],_0x146212[_0xdde2('0xd')],_0x146212[_0xdde2('0x10')]['id']);})['catch'](function(_0x5ab5ca){logger[_0xdde2('0x13')](_0xdde2('0x14'),_0x3a4185,JSON[_0xdde2('0x15')](_0x5ab5ca));logger[_0xdde2('0x11')](_0xdde2('0x16'),_0x3a4185);})[_0xdde2('0x17')](function(){_0x10434d[_0xdde2('0x18')]();});}}}catch(_0x4541ce){logger[_0xdde2('0x13')]('[%s][TAG]\x20%s',_0x3a4185,_[_0xdde2('0x19')](_0x4541ce)?JSON['stringify'](_0x4541ce):_0x4541ce);logger[_0xdde2('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a4185);_0x10434d[_0xdde2('0x18')]();}};}; \ 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 0baf318..58e89fb 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x7b9dc8,_0xb6da5c){var _0x541c0c=function(_0x2d4490){while(--_0x2d4490){_0x7b9dc8['push'](_0x7b9dc8['shift']());}};_0x541c0c(++_0xb6da5c);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x175178,_0xc1f0f0){var _0x5bc4b9=function(_0x5c8b20){while(--_0x5c8b20){_0x175178['push'](_0x175178['shift']());}};_0x5bc4b9(++_0xc1f0f0);}(_0xe706,0xa3));var _0x6e70=function(_0x14110b,_0x3ce4f6){_0x14110b=_0x14110b-0x0;var _0x33d8db=_0xe706[_0x14110b];return _0x33d8db;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 4fed234..21ec39b 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 _0x3d73=['end','QueueReport','update','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','.js','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','busyQueue'];(function(_0x4bb93d,_0x1cda9a){var _0x106b4f=function(_0x4aa8d1){while(--_0x4aa8d1){_0x4bb93d['push'](_0x4bb93d['shift']());}};_0x106b4f(++_0x1cda9a);}(_0x3d73,0xe6));var _0x33d7=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x3d73[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x33d7('0x0'));var path=require(_0x33d7('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x33d7('0x2'));var uuid=require(_0x33d7('0x3'));var config=require(_0x33d7('0x4'));var logger=require(_0x33d7('0x5'))(_0x33d7('0x6'));var rpc={'openchannelQueueReport':require(_0x33d7('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x33d7('0x8')),'smsQueueReport':require(_0x33d7('0x9')),'faxQueueReport':require(_0x33d7('0xa')),'whatsappQueueReport':require(_0x33d7('0xb'))};var RuleEngine=require(_0x33d7('0xc'));function getId(_0x351fb3,_0x11bf99,_0x2d574d){return util[_0x33d7('0xd')](_0x33d7('0xe'),_0x351fb3,_0x11bf99||0x0,_0x2d574d||0x0);}function getIntervals(_0x18f267,_0x56db4b){var _0x4ec346=[];if(!_['isNil'](_0x56db4b[_0x33d7('0xf')])&&!_[_0x33d7('0x10')](_0x18f267[_0x56db4b[_0x33d7('0xf')]])&&!_[_0x33d7('0x10')](_0x18f267[_0x56db4b[_0x33d7('0xf')]][_0x33d7('0x11')])){_0x4ec346=_[_0x33d7('0x12')](_0x18f267[_0x56db4b['IntervalId']][_0x33d7('0x11')],_0x33d7('0x13'));}else if(!_[_0x33d7('0x10')](_0x56db4b[_0x33d7('0x13')])){_0x4ec346=[_0x56db4b['interval']];}return _0x4ec346;}exports[_0x33d7('0x14')]=function(_0x156cb7){_0x156cb7[_0x33d7('0x15')]={};return new BPromise(function(_0x469b48,_0x17fcd0){var _0x323b74={'Start':function(_0x2730ae){var _0x39f73e=this;return new Promise(function(_0x2b79df,_0x1a069f){if(_0x2730ae){try{var _0x3d7bfd=[];var _0x1ca851=getId(_0x2730ae[_0x33d7('0x16')],_0x2730ae[_0x33d7('0x17')]?_0x2730ae['message']['id']:0x0,_0x2730ae[_0x33d7('0x18')]?_0x2730ae[_0x33d7('0x18')]['id']:0x0);if(_0x2730ae[_0x33d7('0x19')]&&_['isArray'](_0x2730ae[_0x33d7('0x19')])&&_0x2730ae[_0x33d7('0x19')][_0x33d7('0x1a')]){for(var _0x23f3a7=0x0;_0x23f3a7<_0x2730ae[_0x33d7('0x19')][_0x33d7('0x1a')];_0x23f3a7+=0x1){var _0x4740e5=_0x2730ae[_0x33d7('0x19')][_0x23f3a7];if(fs[_0x33d7('0x1b')](path[_0x33d7('0x1c')](__dirname,_0x33d7('0x19'),_0x4740e5[_0x33d7('0x1d')]+'.js'))){var _0x5b1601=[];switch(_0x4740e5[_0x33d7('0x1d')][_0x33d7('0x1e')]()){case _0x33d7('0x1f'):var _0x4bb4a2=_0x4740e5[_0x33d7('0x20')][_0x33d7('0x21')](',');if(_0x2730ae[_0x33d7('0x16')]===_0x33d7('0x22')){_0x5b1601['push'](_0x4bb4a2[0x0]);_0x5b1601[_0x33d7('0x23')](_0x4bb4a2[0x1]);_0x5b1601[_0x33d7('0x23')](_0x4bb4a2[_0x33d7('0x24')](0x2,_0x4bb4a2['length'])[_0x33d7('0x1c')](','));}else{_0x5b1601[_0x33d7('0x23')](_0x4bb4a2[0x0]);_0x5b1601['push'](_0x4bb4a2[_0x33d7('0x24')](0x1,_0x4bb4a2[_0x33d7('0x1a')])[_0x33d7('0x1c')](','));}break;case _0x33d7('0x25'):var _0x3a9d9d=_0x4740e5[_0x33d7('0x20')]['split'](',');_0x5b1601['push'](_0x3a9d9d[0x0]);_0x5b1601[_0x33d7('0x23')](_0x3a9d9d[0x1]);_0x5b1601[_0x33d7('0x23')](_0x3a9d9d[_0x33d7('0x24')](0x2,_0x3a9d9d[_0x33d7('0x1a')])['join'](','));break;case _0x33d7('0x26'):var _0x6037bc=_0x4740e5[_0x33d7('0x20')]['split'](',');_0x5b1601['push'](_0x6037bc[0x0]);_0x5b1601[_0x33d7('0x23')](_0x6037bc[0x1]);_0x5b1601['push'](_0x6037bc[0x2]);_0x5b1601[_0x33d7('0x23')](_0x6037bc[0x3]);_0x5b1601[_0x33d7('0x23')](_0x6037bc[_0x33d7('0x24')](0x4,_0x6037bc[_0x33d7('0x1a')])[_0x33d7('0x1c')](','));break;case _0x33d7('0x27'):var _0x21aa5f=_0x4740e5[_0x33d7('0x20')][_0x33d7('0x21')](',');_0x5b1601[_0x33d7('0x23')](_0x21aa5f[0x0]);_0x5b1601[_0x33d7('0x23')](_0x21aa5f[0x1]);_0x5b1601[_0x33d7('0x23')](_0x21aa5f[0x2]);_0x5b1601[_0x33d7('0x23')](_0x21aa5f[0x3]);_0x5b1601[_0x33d7('0x23')](_0x21aa5f['slice'](0x4,_0x21aa5f[_0x33d7('0x1a')])[_0x33d7('0x1c')](','));break;case'message':_0x5b1601[_0x33d7('0x23')](_0x4740e5['appdata']);break;case _0x33d7('0x28'):_0x5b1601[_0x33d7('0x23')](_0x4740e5[_0x33d7('0x29')]);_0x5b1601[_0x33d7('0x23')](_0x4740e5[_0x33d7('0x20')]);break;default:_0x5b1601=_[_0x33d7('0x10')](_0x4740e5[_0x33d7('0x20')])?[]:_0x4740e5[_0x33d7('0x20')][_0x33d7('0x21')](',');}var _0xdc20a9={'id':util[_0x33d7('0xd')](_0x33d7('0x2a'),_0x1ca851,_0x4740e5['id'],_0x4740e5[_0x33d7('0x1d')]),'condition':require(_0x33d7('0x2b'))[_0x33d7('0x2c')](_0x1ca851,getIntervals(_0x156cb7['intervals'],_0x4740e5),_0x156cb7),'consequence':require('./applications/'+_0x4740e5[_0x33d7('0x1d')])[_0x33d7('0x2d')](_0x1ca851,_0x5b1601,_0x156cb7,_0x2730ae),'p':_0x4740e5[_0x33d7('0x2e')]||0x0};logger[_0x33d7('0x2f')](_0x33d7('0x30'),_0xdc20a9['id'],_0x33d7('0x31'),getIntervals(_0x156cb7[_0x33d7('0x32')],_0x4740e5)[_0x33d7('0x1c')](_0x33d7('0x33')));_0x3d7bfd[_0x33d7('0x23')](_0xdc20a9);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x33d7('0x1c')](__dirname,_0x33d7('0x19'),_0x4740e5[_0x33d7('0x1d')]+_0x33d7('0x34')));}}_0x156cb7[_0x33d7('0x15')][_0x1ca851]=new RuleEngine(_0x3d7bfd);_0x156cb7['rules'][_0x1ca851]['execute'](_0x2730ae,function(_0x1019b1){logger[_0x33d7('0x2f')](_0x33d7('0x35'),JSON[_0x33d7('0x36')](_0x1019b1[_0x33d7('0x37')]));if(_0x156cb7[_0x33d7('0x15')][_0x1ca851]){_0x156cb7[_0x33d7('0x15')][_0x1ca851]['emit'](_0x33d7('0x38'));}});return _0x2b79df({'code':0xc8,'message':_0x2730ae});}else{logger[_0x33d7('0x2f')](_0x33d7('0x39'));return _0x2b79df({'code':0xc8,'message':_0x2730ae});}}catch(_0x29bda4){logger[_0x33d7('0x3a')](_0x29bda4['stack']);return _0x1a069f(_0x39f73e[_0x33d7('0x3a')](0x1f4,_0x29bda4));}}return _0x1a069f(_0x33d7('0x3b'));});},'AcceptMessage':function(_0xb11758){var _0x581d24=this;return new Promise(function(_0x3e1e20,_0x5c86cd){if(_0xb11758[_0x33d7('0x3c')]&&_0xb11758[_0x33d7('0x3c')]['id']){if(_0x156cb7['agents'][_0xb11758[_0x33d7('0x3c')]['id']]){_0x156cb7[_0x33d7('0x3d')][_0xb11758['agent']['id']][_0x33d7('0x3e')]=![];_0x156cb7[_0x33d7('0x3d')][_0xb11758['agent']['id']][_0x33d7('0x3f')]=undefined;}}if(_0xb11758[_0x33d7('0x17')]&&_0xb11758['message']['id']){try{var _0x3693f4=getId(_0xb11758[_0x33d7('0x16')],_0xb11758[_0x33d7('0x17')]?_0xb11758[_0x33d7('0x17')]['id']:0x0,_0xb11758[_0x33d7('0x18')]?_0xb11758[_0x33d7('0x18')]['id']:0x0);if(_0x156cb7[_0x33d7('0x15')][_0x3693f4]){_0x156cb7[_0x33d7('0x15')][_0x3693f4]['emit'](_0x33d7('0x40'));if(rpc[_0xb11758['channel']+_0x33d7('0x41')]){rpc[_0xb11758[_0x33d7('0x16')]+_0x33d7('0x41')][_0x33d7('0x42')](_0x3693f4,{'UserId':_0xb11758[_0x33d7('0x17')]['UserId']})[_0x33d7('0x43')](function(_0x4cbf1f){logger[_0x33d7('0x3a')](_0x33d7('0x44'));});}}return _0x3e1e20({'code':0xc8,'message':_0xb11758});}catch(_0xbfa125){logger[_0x33d7('0x3a')](_0xbfa125[_0x33d7('0x45')]);return _0x5c86cd(_0x581d24[_0x33d7('0x3a')](0x1f4,_0xbfa125));}}logger[_0x33d7('0x3a')](_0x33d7('0x46'));return _0x5c86cd(_0x581d24['error'](0x1f4,_0x33d7('0x46')));});},'RejectMessage':function(_0x138ac0){var _0x3bfc12=this;return new Promise(function(_0x4f8ce1,_0x489dd8){if(_0x138ac0[_0x33d7('0x3c')]&&_0x138ac0['agent']['id']){try{if(_0x156cb7[_0x33d7('0x3d')][_0x138ac0['agent']['id']]){_0x156cb7['agents'][_0x138ac0['agent']['id']][_0x33d7('0x3e')]=![];_0x156cb7[_0x33d7('0x3d')][_0x138ac0['agent']['id']]['busyQueue']=undefined;}return _0x4f8ce1({'code':0xc8,'message':_0x138ac0});}catch(_0x437a4a){logger[_0x33d7('0x3a')](_0x437a4a[_0x33d7('0x45')]);return _0x489dd8(_0x3bfc12['error'](0x1f4,_0x437a4a));}}logger[_0x33d7('0x3a')](_0x33d7('0x46'));return _0x489dd8(_0x3bfc12['error'](0x1f4,_0x33d7('0x46')));});},'AbandonInteraction':function(_0x4982ed){var _0xc1016e=this;return new Promise(function(_0x824e76,_0x324928){if(_0x4982ed[_0x33d7('0x16')]&&_0x4982ed[_0x33d7('0x18')]&&_0x4982ed[_0x33d7('0x18')]['id']){try{var _0x4b9428=getId(_0x4982ed['channel'],_0x4982ed[_0x33d7('0x17')]?_0x4982ed[_0x33d7('0x17')]['id']:0x0,_0x4982ed[_0x33d7('0x18')]?_0x4982ed['interaction']['id']:0x0);if(_0x156cb7[_0x33d7('0x15')][_0x4b9428]){_0x156cb7['rules'][_0x4b9428][_0x33d7('0x47')](_0x33d7('0x40'));}return _0x824e76({'code':0xc8,'message':_0x4982ed});}catch(_0x3fcad5){logger[_0x33d7('0x3a')](_0x3fcad5['stack']);return _0x324928(_0xc1016e[_0x33d7('0x3a')](0x1f4,_0x3fcad5));}}logger['error'](_0x33d7('0x46'));return _0x324928(_0xc1016e[_0x33d7('0x3a')](0x1f4,_0x33d7('0x46')));});},'AgentCapacity':function(_0x52b840){var _0x5e6815=this;return new Promise(function(_0x45cc8f,_0x281ba3){if(_0x156cb7[_0x33d7('0x3d')][_0x33d7('0x48')](_0x52b840['id'])){for(var _0x14c194 in _0x52b840[_0x33d7('0x49')]){if(_0x52b840['capacity'][_0x33d7('0x48')](_0x14c194)){if(_0x156cb7[_0x33d7('0x3d')][_0x52b840['id']][_0x33d7('0x48')](_0x14c194+_0x33d7('0x4a'))){_0x156cb7[_0x33d7('0x3d')][_0x52b840['id']][_0x14c194+_0x33d7('0x4a')]=parseInt(_0x52b840[_0x33d7('0x49')][_0x14c194],0xa);}}}_0x156cb7[_0x33d7('0x3d')][_0x52b840['id']][_0x33d7('0x4b')]();return _0x45cc8f({'code':0xc8,'message':_0x156cb7[_0x33d7('0x3d')][_0x52b840['id']]});}else{return _0x281ba3(_0x5e6815[_0x33d7('0x3a')](0x1f4,_0x33d7('0x4c')));}});},'Agents':function(_0x58d303){return new Promise(function(_0x403b24,_0x44a9ff){var _0x418fe5=_[_0x33d7('0x4d')](_0x156cb7['agents']);_0x403b24({'count':_0x418fe5[_0x33d7('0x1a')],'rows':_0x418fe5});});},'ChatQueues':function(_0x1fb631){return new Promise(function(_0x2266b9,_0x1fe3b7){var _0x424517=[];for(var _0x21afeb in _0x156cb7[_0x33d7('0x4e')]){if(_0x156cb7[_0x33d7('0x4e')]['hasOwnProperty'](_0x21afeb)){var _0x689ed0=_0x156cb7['chatQueues'][_0x21afeb];var _0x38b8f8={'id':_0x689ed0['id'],'available':_0x689ed0[_0x33d7('0x4f')],'loggedIn':_0x689ed0['loggedIn'],'name':_0x689ed0[_0x33d7('0x50')],'paused':_0x689ed0[_0x33d7('0x51')],'waiting':_0x689ed0['waiting']};_0x424517['push'](_0x38b8f8);}}_0x2266b9({'count':_0x424517[_0x33d7('0x1a')],'rows':_0x424517});});},'MailQueues':function(_0xa7de99){return new Promise(function(_0x361893,_0x185db3){var _0x4b6aea=[];for(var _0x8d5181 in _0x156cb7[_0x33d7('0x52')]){if(_0x156cb7[_0x33d7('0x52')]['hasOwnProperty'](_0x8d5181)){var _0x505670=_0x156cb7[_0x33d7('0x52')][_0x8d5181];var _0x193d52={'id':_0x505670['id'],'available':_0x505670[_0x33d7('0x4f')],'loggedIn':_0x505670[_0x33d7('0x53')],'name':_0x505670['name'],'paused':_0x505670[_0x33d7('0x51')],'waiting':_0x505670[_0x33d7('0x54')]};_0x4b6aea[_0x33d7('0x23')](_0x193d52);}}_0x361893({'count':_0x4b6aea[_0x33d7('0x1a')],'rows':_0x4b6aea});});},'OpenchannelQueues':function(_0x5e75cc){return new Promise(function(_0x122ce8,_0x41437d){var _0x745b02=[];for(var _0x25bc40 in _0x156cb7[_0x33d7('0x55')]){if(_0x156cb7[_0x33d7('0x55')]['hasOwnProperty'](_0x25bc40)){var _0x8cbef1=_0x156cb7[_0x33d7('0x55')][_0x25bc40];var _0x403fe4={'id':_0x8cbef1['id'],'available':_0x8cbef1[_0x33d7('0x4f')],'loggedIn':_0x8cbef1[_0x33d7('0x53')],'name':_0x8cbef1['name'],'paused':_0x8cbef1[_0x33d7('0x51')],'waiting':_0x8cbef1[_0x33d7('0x54')]};_0x745b02[_0x33d7('0x23')](_0x403fe4);}}_0x122ce8({'count':_0x745b02[_0x33d7('0x1a')],'rows':_0x745b02});});},'SmsQueues':function(_0xc3fb2c){return new Promise(function(_0x23c77f,_0x52e67c){var _0x377e6b=[];for(var _0x5af1f6 in _0x156cb7[_0x33d7('0x56')]){if(_0x156cb7['smsQueues'][_0x33d7('0x48')](_0x5af1f6)){var _0x2eeb3a=_0x156cb7[_0x33d7('0x56')][_0x5af1f6];var _0xac9d53={'id':_0x2eeb3a['id'],'available':_0x2eeb3a[_0x33d7('0x4f')],'loggedIn':_0x2eeb3a[_0x33d7('0x53')],'name':_0x2eeb3a['name'],'paused':_0x2eeb3a[_0x33d7('0x51')],'waiting':_0x2eeb3a[_0x33d7('0x54')]};_0x377e6b['push'](_0xac9d53);}}_0x23c77f({'count':_0x377e6b['length'],'rows':_0x377e6b});});},'FaxQueues':function(_0x4dcd83){return new Promise(function(_0x22dfdb,_0x37383e){var _0x418a2a=[];for(var _0x425be6 in _0x156cb7['faxQueues']){if(_0x156cb7['faxQueues'][_0x33d7('0x48')](_0x425be6)){var _0xe81f74=_0x156cb7[_0x33d7('0x57')][_0x425be6];var _0x405dbe={'id':_0xe81f74['id'],'available':_0xe81f74['available'],'loggedIn':_0xe81f74[_0x33d7('0x53')],'name':_0xe81f74[_0x33d7('0x50')],'paused':_0xe81f74[_0x33d7('0x51')],'waiting':_0xe81f74['waiting']};_0x418a2a[_0x33d7('0x23')](_0x405dbe);}}_0x22dfdb({'count':_0x418a2a[_0x33d7('0x1a')],'rows':_0x418a2a});});},'WhatsappQueues':function(_0xff8ded){return new Promise(function(_0x5ca0fe,_0x2f74d6){var _0x2ecd97=[];for(var _0x3fe87a in _0x156cb7[_0x33d7('0x58')]){if(_0x156cb7['whatsappQueues'][_0x33d7('0x48')](_0x3fe87a)){var _0xe904ee=_0x156cb7[_0x33d7('0x58')][_0x3fe87a];var _0x2dcdb1={'id':_0xe904ee['id'],'available':_0xe904ee[_0x33d7('0x4f')],'loggedIn':_0xe904ee['loggedIn'],'name':_0xe904ee[_0x33d7('0x50')],'paused':_0xe904ee[_0x33d7('0x51')],'waiting':_0xe904ee[_0x33d7('0x54')]};_0x2ecd97[_0x33d7('0x23')](_0x2dcdb1);}}_0x5ca0fe({'count':_0x2ecd97[_0x33d7('0x1a')],'rows':_0x2ecd97});});},'ChatQueuesWaitingInteractions':function(_0x445d40){return new Promise(function(_0x261eac,_0x405967){var _0x2fd69c=_[_0x33d7('0x4d')](_0x156cb7[_0x33d7('0x59')]);_0x261eac({'count':_0x2fd69c[_0x33d7('0x1a')],'rows':_0x2fd69c});});},'MailQueuesWaitingInteractions':function(_0x189f22){return new Promise(function(_0xf3f1cb,_0x50567a){var _0x59be42=_[_0x33d7('0x4d')](_0x156cb7['mailQueuesWaitingInteractions']);_0xf3f1cb({'count':_0x59be42[_0x33d7('0x1a')],'rows':_0x59be42});});},'OpenchannelQueuesWaitingInteractions':function(_0x5a161e){return new Promise(function(_0xf31825,_0x15a2a1){var _0x145683=_[_0x33d7('0x4d')](_0x156cb7['openchannelQueuesWaitingInteractions']);_0xf31825({'count':_0x145683['length'],'rows':_0x145683});});},'SmsQueuesWaitingInteractions':function(_0x30aa96){return new Promise(function(_0x3c4df4,_0x4862da){var _0x5f6294=_[_0x33d7('0x4d')](_0x156cb7[_0x33d7('0x5a')]);_0x3c4df4({'count':_0x5f6294[_0x33d7('0x1a')],'rows':_0x5f6294});});},'FaxQueuesWaitingInteractions':function(_0x1a57eb){return new Promise(function(_0x41b6b9,_0x579477){var _0x428dbf=_[_0x33d7('0x4d')](_0x156cb7[_0x33d7('0x5b')]);_0x41b6b9({'count':_0x428dbf['length'],'rows':_0x428dbf});});},'WhatsappQueuesWaitingInteractions':function(_0x5d5e5c){return new Promise(function(_0x54f90a,_0x50b357){var _0x24d926=_['values'](_0x156cb7[_0x33d7('0x5c')]);_0x54f90a({'count':_0x24d926[_0x33d7('0x1a')],'rows':_0x24d926});});}};var _0x428d37=jayson['server'](_0x323b74)[_0x33d7('0x5d')]();_0x428d37['on']('error',function(_0x344f1e){logger[_0x33d7('0x3a')](JSON[_0x33d7('0x36')](_0x344f1e));return _0x17fcd0(_0x344f1e);});_0x428d37[_0x33d7('0x14')](0x232c,_0x33d7('0x5e'),function(){console[_0x33d7('0x5f')](_0x33d7('0x60'),0x232c);return _0x469b48(_0x33d7('0x61')+0x232c);});});}; \ No newline at end of file +var _0xef4f=['split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','complete','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','waiting','mailQueues','available','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','stringify','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xef4f,0x105));var _0xfef4=function(_0x3f8e91,_0x2c9737){_0x3f8e91=_0x3f8e91-0x0;var _0x59ff00=_0xef4f[_0x3f8e91];return _0x59ff00;};'use strict';var _=require('lodash');var util=require(_0xfef4('0x0'));var path=require(_0xfef4('0x1'));var fs=require('fs');var jayson=require(_0xfef4('0x2'));var BPromise=require('bluebird');var uuid=require(_0xfef4('0x3'));var config=require(_0xfef4('0x4'));var logger=require(_0xfef4('0x5'))(_0xfef4('0x6'));var rpc={'openchannelQueueReport':require(_0xfef4('0x7')),'mailQueueReport':require(_0xfef4('0x8')),'chatQueueReport':require(_0xfef4('0x9')),'smsQueueReport':require(_0xfef4('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xfef4('0xb'))};var RuleEngine=require(_0xfef4('0xc'));function getId(_0x519aaa,_0x4bd2fe,_0x26fe33){return util[_0xfef4('0xd')]('%s.%s.%s',_0x519aaa,_0x4bd2fe||0x0,_0x26fe33||0x0);}function getIntervals(_0x5dff51,_0x2942ba){var _0x157157=[];if(!_[_0xfef4('0xe')](_0x2942ba[_0xfef4('0xf')])&&!_[_0xfef4('0xe')](_0x5dff51[_0x2942ba[_0xfef4('0xf')]])&&!_[_0xfef4('0xe')](_0x5dff51[_0x2942ba[_0xfef4('0xf')]][_0xfef4('0x10')])){_0x157157=_['map'](_0x5dff51[_0x2942ba['IntervalId']]['Intervals'],_0xfef4('0x11'));}else if(!_[_0xfef4('0xe')](_0x2942ba[_0xfef4('0x11')])){_0x157157=[_0x2942ba[_0xfef4('0x11')]];}return _0x157157;}exports[_0xfef4('0x12')]=function(_0x33a619){_0x33a619[_0xfef4('0x13')]={};return new BPromise(function(_0x396051,_0x54d514){var _0x58c7a9={'Start':function(_0x45dde9){var _0x17210f=this;return new Promise(function(_0x1c43d1,_0x5387ee){if(_0x45dde9){try{var _0xc6fc0d=[];var _0x1e27a3=getId(_0x45dde9[_0xfef4('0x14')],_0x45dde9['message']?_0x45dde9[_0xfef4('0x15')]['id']:0x0,_0x45dde9[_0xfef4('0x16')]?_0x45dde9[_0xfef4('0x16')]['id']:0x0);if(_0x45dde9['applications']&&_[_0xfef4('0x17')](_0x45dde9[_0xfef4('0x18')])&&_0x45dde9[_0xfef4('0x18')][_0xfef4('0x19')]){for(var _0x1b898f=0x0;_0x1b898f<_0x45dde9[_0xfef4('0x18')][_0xfef4('0x19')];_0x1b898f+=0x1){var _0x1ba827=_0x45dde9[_0xfef4('0x18')][_0x1b898f];if(fs[_0xfef4('0x1a')](path[_0xfef4('0x1b')](__dirname,_0xfef4('0x18'),_0x1ba827[_0xfef4('0x1c')]+_0xfef4('0x1d')))){var _0x518e5a=[];switch(_0x1ba827[_0xfef4('0x1c')][_0xfef4('0x1e')]()){case _0xfef4('0x1f'):var _0x2d766e=_0x1ba827[_0xfef4('0x20')][_0xfef4('0x21')](',');if(_0x45dde9['channel']===_0xfef4('0x22')){_0x518e5a['push'](_0x2d766e[0x0]);_0x518e5a[_0xfef4('0x23')](_0x2d766e[0x1]);_0x518e5a[_0xfef4('0x23')](_0x2d766e[_0xfef4('0x24')](0x2,_0x2d766e[_0xfef4('0x19')])[_0xfef4('0x1b')](','));}else{_0x518e5a['push'](_0x2d766e[0x0]);_0x518e5a[_0xfef4('0x23')](_0x2d766e[_0xfef4('0x24')](0x1,_0x2d766e[_0xfef4('0x19')])[_0xfef4('0x1b')](','));}break;case'dialogflow':var _0x3f8309=_0x1ba827[_0xfef4('0x20')]['split'](',');_0x518e5a['push'](_0x3f8309[0x0]);_0x518e5a['push'](_0x3f8309[0x1]);_0x518e5a[_0xfef4('0x23')](_0x3f8309['slice'](0x2,_0x3f8309[_0xfef4('0x19')])[_0xfef4('0x1b')](','));break;case _0xfef4('0x25'):var _0x9fe015=_0x1ba827['appdata'][_0xfef4('0x21')](',');_0x518e5a[_0xfef4('0x23')](_0x9fe015[0x0]);_0x518e5a['push'](_0x9fe015[0x1]);_0x518e5a[_0xfef4('0x23')](_0x9fe015[0x2]);_0x518e5a[_0xfef4('0x23')](_0x9fe015[0x3]);_0x518e5a[_0xfef4('0x23')](_0x9fe015['slice'](0x4,_0x9fe015[_0xfef4('0x19')])['join'](','));break;case _0xfef4('0x26'):var _0x442685=_0x1ba827[_0xfef4('0x20')][_0xfef4('0x21')](',');_0x518e5a[_0xfef4('0x23')](_0x442685[0x0]);_0x518e5a[_0xfef4('0x23')](_0x442685[0x1]);_0x518e5a[_0xfef4('0x23')](_0x442685[0x2]);_0x518e5a[_0xfef4('0x23')](_0x442685[0x3]);_0x518e5a['push'](_0x442685[_0xfef4('0x24')](0x4,_0x442685[_0xfef4('0x19')])[_0xfef4('0x1b')](','));break;case _0xfef4('0x15'):_0x518e5a[_0xfef4('0x23')](_0x1ba827['appdata']);break;case _0xfef4('0x27'):_0x518e5a[_0xfef4('0x23')](_0x1ba827[_0xfef4('0x28')]);_0x518e5a[_0xfef4('0x23')](_0x1ba827[_0xfef4('0x20')]);break;default:_0x518e5a=_['isNil'](_0x1ba827[_0xfef4('0x20')])?[]:_0x1ba827[_0xfef4('0x20')]['split'](',');}var _0x34fc37={'id':util['format'](_0xfef4('0x29'),_0x1e27a3,_0x1ba827['id'],_0x1ba827[_0xfef4('0x1c')]),'condition':require(_0xfef4('0x2a'))[_0xfef4('0x2b')](_0x1e27a3,getIntervals(_0x33a619['intervals'],_0x1ba827),_0x33a619),'consequence':require(_0xfef4('0x2c')+_0x1ba827['app'])[_0xfef4('0x2d')](_0x1e27a3,_0x518e5a,_0x33a619,_0x45dde9),'p':_0x1ba827[_0xfef4('0x2e')]||0x0};logger[_0xfef4('0x2f')](_0xfef4('0x30'),_0x34fc37['id'],_0xfef4('0x31'),getIntervals(_0x33a619[_0xfef4('0x32')],_0x1ba827)[_0xfef4('0x1b')](_0xfef4('0x33')));_0xc6fc0d[_0xfef4('0x23')](_0x34fc37);}else{logger['error'](_0xfef4('0x34'),path[_0xfef4('0x1b')](__dirname,_0xfef4('0x18'),_0x1ba827[_0xfef4('0x1c')]+_0xfef4('0x1d')));}}_0x33a619[_0xfef4('0x13')][_0x1e27a3]=new RuleEngine(_0xc6fc0d);_0x33a619[_0xfef4('0x13')][_0x1e27a3][_0xfef4('0x35')](_0x45dde9,function(_0x378e08){logger['info'](_0xfef4('0x36'),JSON['stringify'](_0x378e08[_0xfef4('0x37')]));if(_0x33a619['rules'][_0x1e27a3]){_0x33a619['rules'][_0x1e27a3][_0xfef4('0x38')](_0xfef4('0x39'));}});return _0x1c43d1({'code':0xc8,'message':_0x45dde9});}else{logger[_0xfef4('0x2f')]('No\x20applications\x20to\x20execute');return _0x1c43d1({'code':0xc8,'message':_0x45dde9});}}catch(_0x3e8727){logger[_0xfef4('0x3a')](_0x3e8727[_0xfef4('0x3b')]);return _0x5387ee(_0x17210f[_0xfef4('0x3a')](0x1f4,_0x3e8727));}}return _0x5387ee(_0xfef4('0x3c'));});},'AcceptMessage':function(_0x513598){var _0x193567=this;return new Promise(function(_0x580434,_0x94e543){if(_0x513598[_0xfef4('0x3d')]&&_0x513598[_0xfef4('0x3d')]['id']){if(_0x33a619['agents'][_0x513598[_0xfef4('0x3d')]['id']]){_0x33a619[_0xfef4('0x3e')][_0x513598[_0xfef4('0x3d')]['id']][_0xfef4('0x3f')]=![];_0x33a619[_0xfef4('0x3e')][_0x513598['agent']['id']][_0xfef4('0x40')]=undefined;}}if(_0x513598[_0xfef4('0x15')]&&_0x513598[_0xfef4('0x15')]['id']){try{var _0x19b6cc=getId(_0x513598[_0xfef4('0x14')],_0x513598[_0xfef4('0x15')]?_0x513598[_0xfef4('0x15')]['id']:0x0,_0x513598[_0xfef4('0x16')]?_0x513598[_0xfef4('0x16')]['id']:0x0);if(_0x33a619[_0xfef4('0x13')][_0x19b6cc]){_0x33a619[_0xfef4('0x13')][_0x19b6cc]['emit'](_0xfef4('0x41'));if(rpc[_0x513598[_0xfef4('0x14')]+_0xfef4('0x42')]){rpc[_0x513598[_0xfef4('0x14')]+_0xfef4('0x42')][_0xfef4('0x43')](_0x19b6cc,{'UserId':_0x513598['message'][_0xfef4('0x44')]})[_0xfef4('0x45')](function(_0x3095e1){logger[_0xfef4('0x3a')](_0xfef4('0x46'));});}}return _0x580434({'code':0xc8,'message':_0x513598});}catch(_0x5d66a3){logger['error'](_0x5d66a3[_0xfef4('0x3b')]);return _0x94e543(_0x193567[_0xfef4('0x3a')](0x1f4,_0x5d66a3));}}logger[_0xfef4('0x3a')]('message\x20is\x20empty');return _0x94e543(_0x193567[_0xfef4('0x3a')](0x1f4,_0xfef4('0x47')));});},'RejectMessage':function(_0x5a9828){var _0x10a0d1=this;return new Promise(function(_0x310ef4,_0xf4006a){if(_0x5a9828[_0xfef4('0x3d')]&&_0x5a9828[_0xfef4('0x3d')]['id']){try{if(_0x33a619[_0xfef4('0x3e')][_0x5a9828[_0xfef4('0x3d')]['id']]){_0x33a619[_0xfef4('0x3e')][_0x5a9828[_0xfef4('0x3d')]['id']][_0xfef4('0x3f')]=![];_0x33a619[_0xfef4('0x3e')][_0x5a9828[_0xfef4('0x3d')]['id']][_0xfef4('0x40')]=undefined;}return _0x310ef4({'code':0xc8,'message':_0x5a9828});}catch(_0x4e1b35){logger['error'](_0x4e1b35['stack']);return _0xf4006a(_0x10a0d1[_0xfef4('0x3a')](0x1f4,_0x4e1b35));}}logger[_0xfef4('0x3a')](_0xfef4('0x47'));return _0xf4006a(_0x10a0d1['error'](0x1f4,_0xfef4('0x47')));});},'AbandonInteraction':function(_0x4ab9fa){var _0x5147d0=this;return new Promise(function(_0xcfef5a,_0x33e950){if(_0x4ab9fa[_0xfef4('0x14')]&&_0x4ab9fa['interaction']&&_0x4ab9fa[_0xfef4('0x16')]['id']){try{var _0x1b5afe=getId(_0x4ab9fa[_0xfef4('0x14')],_0x4ab9fa[_0xfef4('0x15')]?_0x4ab9fa[_0xfef4('0x15')]['id']:0x0,_0x4ab9fa[_0xfef4('0x16')]?_0x4ab9fa[_0xfef4('0x16')]['id']:0x0);if(_0x33a619[_0xfef4('0x13')][_0x1b5afe]){_0x33a619['rules'][_0x1b5afe][_0xfef4('0x38')](_0xfef4('0x41'));}return _0xcfef5a({'code':0xc8,'message':_0x4ab9fa});}catch(_0x463593){logger[_0xfef4('0x3a')](_0x463593[_0xfef4('0x3b')]);return _0x33e950(_0x5147d0[_0xfef4('0x3a')](0x1f4,_0x463593));}}logger['error'](_0xfef4('0x47'));return _0x33e950(_0x5147d0['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x592468){var _0x1778b4=this;return new Promise(function(_0x210a4c,_0x11de7a){if(_0x33a619[_0xfef4('0x3e')][_0xfef4('0x48')](_0x592468['id'])){for(var _0x4a4395 in _0x592468[_0xfef4('0x49')]){if(_0x592468[_0xfef4('0x49')][_0xfef4('0x48')](_0x4a4395)){if(_0x33a619[_0xfef4('0x3e')][_0x592468['id']][_0xfef4('0x48')](_0x4a4395+_0xfef4('0x4a'))){_0x33a619[_0xfef4('0x3e')][_0x592468['id']][_0x4a4395+_0xfef4('0x4a')]=parseInt(_0x592468[_0xfef4('0x49')][_0x4a4395],0xa);}}}_0x33a619[_0xfef4('0x3e')][_0x592468['id']][_0xfef4('0x4b')]();return _0x210a4c({'code':0xc8,'message':_0x33a619[_0xfef4('0x3e')][_0x592468['id']]});}else{return _0x11de7a(_0x1778b4[_0xfef4('0x3a')](0x1f4,_0xfef4('0x4c')));}});},'Agents':function(_0x297d89){return new Promise(function(_0x1dbf6d,_0x244f80){var _0x19bf43=_[_0xfef4('0x4d')](_0x33a619[_0xfef4('0x3e')]);_0x1dbf6d({'count':_0x19bf43['length'],'rows':_0x19bf43});});},'ChatQueues':function(_0x151de5){return new Promise(function(_0x508ca1,_0x230d02){var _0xf9a5c9=[];for(var _0x1e6f88 in _0x33a619[_0xfef4('0x4e')]){if(_0x33a619[_0xfef4('0x4e')][_0xfef4('0x48')](_0x1e6f88)){var _0xdfcc45=_0x33a619[_0xfef4('0x4e')][_0x1e6f88];var _0x43d976={'id':_0xdfcc45['id'],'available':_0xdfcc45['available'],'loggedIn':_0xdfcc45[_0xfef4('0x4f')],'name':_0xdfcc45[_0xfef4('0x50')],'paused':_0xdfcc45['paused'],'waiting':_0xdfcc45[_0xfef4('0x51')]};_0xf9a5c9[_0xfef4('0x23')](_0x43d976);}}_0x508ca1({'count':_0xf9a5c9[_0xfef4('0x19')],'rows':_0xf9a5c9});});},'MailQueues':function(_0x4d6bfd){return new Promise(function(_0x23fd12,_0x41ac53){var _0x257757=[];for(var _0x21a783 in _0x33a619[_0xfef4('0x52')]){if(_0x33a619[_0xfef4('0x52')][_0xfef4('0x48')](_0x21a783)){var _0x493f9d=_0x33a619[_0xfef4('0x52')][_0x21a783];var _0x50fdf8={'id':_0x493f9d['id'],'available':_0x493f9d[_0xfef4('0x53')],'loggedIn':_0x493f9d['loggedIn'],'name':_0x493f9d[_0xfef4('0x50')],'paused':_0x493f9d[_0xfef4('0x54')],'waiting':_0x493f9d['waiting']};_0x257757['push'](_0x50fdf8);}}_0x23fd12({'count':_0x257757[_0xfef4('0x19')],'rows':_0x257757});});},'OpenchannelQueues':function(_0x11e7d6){return new Promise(function(_0x4ff9bd,_0x56fb84){var _0x1e032f=[];for(var _0x7dcf41 in _0x33a619['openchannelQueues']){if(_0x33a619[_0xfef4('0x55')][_0xfef4('0x48')](_0x7dcf41)){var _0x413b74=_0x33a619[_0xfef4('0x55')][_0x7dcf41];var _0x27c3c5={'id':_0x413b74['id'],'available':_0x413b74[_0xfef4('0x53')],'loggedIn':_0x413b74[_0xfef4('0x4f')],'name':_0x413b74['name'],'paused':_0x413b74[_0xfef4('0x54')],'waiting':_0x413b74[_0xfef4('0x51')]};_0x1e032f[_0xfef4('0x23')](_0x27c3c5);}}_0x4ff9bd({'count':_0x1e032f['length'],'rows':_0x1e032f});});},'SmsQueues':function(_0x30c9db){return new Promise(function(_0x3a4daf,_0x306603){var _0x244c06=[];for(var _0x15ef48 in _0x33a619[_0xfef4('0x56')]){if(_0x33a619[_0xfef4('0x56')][_0xfef4('0x48')](_0x15ef48)){var _0x2121da=_0x33a619[_0xfef4('0x56')][_0x15ef48];var _0x4cb563={'id':_0x2121da['id'],'available':_0x2121da[_0xfef4('0x53')],'loggedIn':_0x2121da[_0xfef4('0x4f')],'name':_0x2121da['name'],'paused':_0x2121da[_0xfef4('0x54')],'waiting':_0x2121da[_0xfef4('0x51')]};_0x244c06[_0xfef4('0x23')](_0x4cb563);}}_0x3a4daf({'count':_0x244c06[_0xfef4('0x19')],'rows':_0x244c06});});},'FaxQueues':function(_0x20df85){return new Promise(function(_0x102f03,_0x1c15f0){var _0x43e982=[];for(var _0x3ccc5b in _0x33a619[_0xfef4('0x57')]){if(_0x33a619[_0xfef4('0x57')][_0xfef4('0x48')](_0x3ccc5b)){var _0xbd0229=_0x33a619[_0xfef4('0x57')][_0x3ccc5b];var _0x212e86={'id':_0xbd0229['id'],'available':_0xbd0229[_0xfef4('0x53')],'loggedIn':_0xbd0229[_0xfef4('0x4f')],'name':_0xbd0229[_0xfef4('0x50')],'paused':_0xbd0229[_0xfef4('0x54')],'waiting':_0xbd0229[_0xfef4('0x51')]};_0x43e982[_0xfef4('0x23')](_0x212e86);}}_0x102f03({'count':_0x43e982[_0xfef4('0x19')],'rows':_0x43e982});});},'WhatsappQueues':function(_0x5a611d){return new Promise(function(_0x2c05ab,_0x34c247){var _0xd8bba1=[];for(var _0x326f95 in _0x33a619[_0xfef4('0x58')]){if(_0x33a619[_0xfef4('0x58')][_0xfef4('0x48')](_0x326f95)){var _0x223853=_0x33a619[_0xfef4('0x58')][_0x326f95];var _0x657c13={'id':_0x223853['id'],'available':_0x223853[_0xfef4('0x53')],'loggedIn':_0x223853[_0xfef4('0x4f')],'name':_0x223853['name'],'paused':_0x223853[_0xfef4('0x54')],'waiting':_0x223853[_0xfef4('0x51')]};_0xd8bba1['push'](_0x657c13);}}_0x2c05ab({'count':_0xd8bba1[_0xfef4('0x19')],'rows':_0xd8bba1});});},'ChatQueuesWaitingInteractions':function(_0x5bc914){return new Promise(function(_0xe26b19,_0x5bd1ae){var _0x2d1490=_['values'](_0x33a619[_0xfef4('0x59')]);_0xe26b19({'count':_0x2d1490[_0xfef4('0x19')],'rows':_0x2d1490});});},'MailQueuesWaitingInteractions':function(_0x241da4){return new Promise(function(_0x5a8b64,_0x5cb4b8){var _0x1e750e=_[_0xfef4('0x4d')](_0x33a619[_0xfef4('0x5a')]);_0x5a8b64({'count':_0x1e750e[_0xfef4('0x19')],'rows':_0x1e750e});});},'OpenchannelQueuesWaitingInteractions':function(_0x2ffe1d){return new Promise(function(_0x4c21dd,_0x47b3a5){var _0x491372=_['values'](_0x33a619[_0xfef4('0x5b')]);_0x4c21dd({'count':_0x491372[_0xfef4('0x19')],'rows':_0x491372});});},'SmsQueuesWaitingInteractions':function(_0x29fa37){return new Promise(function(_0x9fdf7,_0x344570){var _0xdec84d=_[_0xfef4('0x4d')](_0x33a619['smsQueuesWaitingInteractions']);_0x9fdf7({'count':_0xdec84d[_0xfef4('0x19')],'rows':_0xdec84d});});},'FaxQueuesWaitingInteractions':function(_0x366877){return new Promise(function(_0x4702d0,_0x165123){var _0x1515b0=_[_0xfef4('0x4d')](_0x33a619[_0xfef4('0x5c')]);_0x4702d0({'count':_0x1515b0[_0xfef4('0x19')],'rows':_0x1515b0});});},'WhatsappQueuesWaitingInteractions':function(_0x2897cc){return new Promise(function(_0x220bb3,_0xd50069){var _0x3f12b8=_[_0xfef4('0x4d')](_0x33a619['whatsappQueuesWaitingInteractions']);_0x220bb3({'count':_0x3f12b8[_0xfef4('0x19')],'rows':_0x3f12b8});});}};var _0x1022ac=jayson[_0xfef4('0x5d')](_0x58c7a9)[_0xfef4('0x5e')]();_0x1022ac['on'](_0xfef4('0x3a'),function(_0x4deb96){logger[_0xfef4('0x3a')](JSON[_0xfef4('0x5f')](_0x4deb96));return _0x54d514(_0x4deb96);});_0x1022ac[_0xfef4('0x12')](0x232c,_0xfef4('0x60'),function(){console['log'](_0xfef4('0x61'),0x232c);return _0x396051('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 8d382fc..31fcc9e 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 _0xcdf4=['join','\x20|\x20','stack','util','jayson/promise','lodash','../../../config/logger','http','then','error','message','result','catch','condition','rules','info','stop','length','push','Command','iftime\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','log'];(function(_0x131634,_0x3bf8b7){var _0x476289=function(_0x13312f){while(--_0x13312f){_0x131634['push'](_0x131634['shift']());}};_0x476289(++_0x3bf8b7);}(_0xcdf4,0x10b));var _0x4cdf=function(_0x2401c1,_0x2d25b9){_0x2401c1=_0x2401c1-0x0;var _0x32d665=_0xcdf4[_0x2401c1];return _0x32d665;};'use strict';var util=require(_0x4cdf('0x0'));var BPromise=require('bluebird');var jayson=require(_0x4cdf('0x1'));var _=require(_0x4cdf('0x2'));var logger=require(_0x4cdf('0x3'))('routing');var client=jayson['client'][_0x4cdf('0x4')]({'port':0x232a});function request(_0x4a9bdc,_0x5a328a){return new BPromise(function(_0x578237,_0x23960b){return client['request'](_0x4a9bdc,_0x5a328a)[_0x4cdf('0x5')](function(_0xbb5d5f){if(_0xbb5d5f[_0x4cdf('0x6')]){return _0x23960b(_0xbb5d5f[_0x4cdf('0x6')][_0x4cdf('0x7')]);}else{return _0x578237(_0xbb5d5f[_0x4cdf('0x8')]);}})[_0x4cdf('0x9')](function(_0xece58e){return _0x23960b(_0xece58e);});});}exports[_0x4cdf('0xa')]=function(_0x2ee438,_0x5e99e0,_0x427be0){return function(_0xacc13){if(_0x427be0[_0x4cdf('0xb')]&&!_0x427be0[_0x4cdf('0xb')][_0x2ee438]){logger[_0x4cdf('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2ee438);return _0xacc13[_0x4cdf('0xd')]();}var _0x310f72=[];for(var _0x4427ae=0x0;_0x4427ae<_0x5e99e0[_0x4cdf('0xe')];_0x4427ae+=0x1){_0x310f72[_0x4cdf('0xf')](request(_0x4cdf('0x10'),{'command':util['format'](_0x4cdf('0x11'),_0x5e99e0[_0x4427ae])})[_0x4cdf('0x5')](function(_0x2d5055){return _0x2d5055&&_0x2d5055[_0x4cdf('0x7')]&&_0x2d5055[_0x4cdf('0x7')]['indexOf']('true')>=0x0?!![]:![];})[_0x4cdf('0x9')](function(_0x52884d){logger[_0x4cdf('0x6')]('[%s][INTERVAL]\x20%s',_0x2ee438,_0x5e99e0[_0x4427ae]);}));}BPromise['all'](_0x310f72)['then'](function(_0x5f429e){var _0x1e833a=_[_0x4cdf('0x12')](_0x5f429e);logger['info'](_0x4cdf('0x13'),_0x2ee438,_0x5e99e0['join']('\x20|\x20'),_0x1e833a);_0xacc13['when'](_0x1e833a);})[_0x4cdf('0x9')](function(_0x4a7d0f){console[_0x4cdf('0x14')](_0x4a7d0f);logger['error'](_0x4cdf('0x13'),_0x2ee438,_0x5e99e0[_0x4cdf('0x15')](_0x4cdf('0x16')),_0x4a7d0f[_0x4cdf('0x17')]);_0xacc13[_0x4cdf('0xd')]();});};}; \ No newline at end of file +var _0x3184=['jayson/promise','../../../config/logger','routing','http','then','error','message','result','condition','length','push','Command','iftime\x20%s','indexOf','true','catch','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','bluebird'];(function(_0xaa661c,_0x4ca3e4){var _0x9f75a3=function(_0x3c95f0){while(--_0x3c95f0){_0xaa661c['push'](_0xaa661c['shift']());}};_0x9f75a3(++_0x4ca3e4);}(_0x3184,0x186));var _0x4318=function(_0x6b23f3,_0x4189c9){_0x6b23f3=_0x6b23f3-0x0;var _0x473e8f=_0x3184[_0x6b23f3];return _0x473e8f;};'use strict';var util=require(_0x4318('0x0'));var BPromise=require(_0x4318('0x1'));var jayson=require(_0x4318('0x2'));var _=require('lodash');var logger=require(_0x4318('0x3'))(_0x4318('0x4'));var client=jayson['client'][_0x4318('0x5')]({'port':0x232a});function request(_0x2ecb53,_0x5364e6){return new BPromise(function(_0x306d76,_0x5a24a2){return client['request'](_0x2ecb53,_0x5364e6)[_0x4318('0x6')](function(_0x5bef59){if(_0x5bef59[_0x4318('0x7')]){return _0x5a24a2(_0x5bef59['error'][_0x4318('0x8')]);}else{return _0x306d76(_0x5bef59[_0x4318('0x9')]);}})['catch'](function(_0x2b7a07){return _0x5a24a2(_0x2b7a07);});});}exports[_0x4318('0xa')]=function(_0x1af914,_0x591f31,_0xf711ac){return function(_0x339e96){if(_0xf711ac['rules']&&!_0xf711ac['rules'][_0x1af914]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1af914);return _0x339e96['stop']();}var _0x5556ae=[];for(var _0x569108=0x0;_0x569108<_0x591f31[_0x4318('0xb')];_0x569108+=0x1){_0x5556ae[_0x4318('0xc')](request(_0x4318('0xd'),{'command':util['format'](_0x4318('0xe'),_0x591f31[_0x569108])})[_0x4318('0x6')](function(_0x3b9090){return _0x3b9090&&_0x3b9090['message']&&_0x3b9090[_0x4318('0x8')][_0x4318('0xf')](_0x4318('0x10'))>=0x0?!![]:![];})[_0x4318('0x11')](function(_0x1ea4f3){logger['error']('[%s][INTERVAL]\x20%s',_0x1af914,_0x591f31[_0x569108]);}));}BPromise[_0x4318('0x12')](_0x5556ae)[_0x4318('0x6')](function(_0x5b957a){var _0x49368b=_[_0x4318('0x13')](_0x5b957a);logger[_0x4318('0x14')](_0x4318('0x15'),_0x1af914,_0x591f31[_0x4318('0x16')](_0x4318('0x17')),_0x49368b);_0x339e96[_0x4318('0x18')](_0x49368b);})[_0x4318('0x11')](function(_0x1aecb9){console[_0x4318('0x19')](_0x1aecb9);logger['error'](_0x4318('0x15'),_0x1af914,_0x591f31[_0x4318('0x16')](_0x4318('0x17')),_0x1aecb9[_0x4318('0x1a')]);_0x339e96[_0x4318('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 73e3eaa..d2e3575 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 _0x373d=['transfereruniqueid','transfer','blind','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s'];(function(_0x428d83,_0x177637){var _0x181681=function(_0x33a10d){while(--_0x33a10d){_0x428d83['push'](_0x428d83['shift']());}};_0x181681(++_0x177637);}(_0x373d,0x1e2));var _0xd373=function(_0x5d80e7,_0x57d877){_0x5d80e7=_0x5d80e7-0x0;var _0x5dea17=_0x373d[_0x5d80e7];return _0x5dea17;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var utils=require(_0xd373('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x53f3b7,_0x30e9ce){utils[_0xd373('0x2')](util['format'](_0xd373('0x3'),_0x53f3b7[_0xd373('0x4')],_0x53f3b7[_0xd373('0x5')],_0x53f3b7['queue'],_0x53f3b7['membername'],_0x53f3b7[_0xd373('0x6')],_0x53f3b7[_0xd373('0x7')],_0x53f3b7[_0xd373('0x8')],_0x53f3b7[_0xd373('0x9')]));if(_0x53f3b7['queue']){utils[_0xd373('0xa')](_0x53f3b7['queue'])['then'](function(_0x59ed5e){if(_0x59ed5e){_0x53f3b7[_0xd373('0xb')]=_0x59ed5e[_0xd373('0xb')];_0x53f3b7['agentacw']=_0x53f3b7[_0xd373('0xc')]?_0x59ed5e[_0xd373('0xd')]:![];_0x53f3b7['acwtime']=_0x53f3b7['agentacw']?_0x59ed5e[_0xd373('0xe')]:0x0;}utils[_0xd373('0xf')](_0xd373('0x10'),_0x53f3b7);});}else{utils[_0xd373('0xf')]('CreateVoiceAgentReport',_0x53f3b7);}if(_0x30e9ce){delete transfers[_0x53f3b7['uniqueid']];}else{delete agents[_0x53f3b7['destuniqueid']];}}exports[_0xd373('0x11')]=function(_0x14a0ee){try{utils['debug'](util[_0xd373('0x12')](_0xd373('0x13'),_0x14a0ee[_0xd373('0x4')]),_0x14a0ee);agents[_0x14a0ee[_0xd373('0x14')]]=_0x14a0ee;agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x15')]=utils[_0xd373('0x16')]();agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x17');agents[_0x14a0ee[_0xd373('0x14')]][_0xd373('0x8')]=null;agents[_0x14a0ee[_0xd373('0x14')]]['connectedlinename']=null;utils[_0xd373('0x2')](util['format'](_0xd373('0x18'),_0x14a0ee[_0xd373('0x4')],agents[_0x14a0ee['destuniqueid']][_0xd373('0x19')],_0x14a0ee['destuniqueid']));}catch(_0x4d7d72){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x13'),_0x14a0ee[_0xd373('0x4')]),_0x4d7d72);}};exports[_0xd373('0x1b')]=function(_0x181eb2){try{if(!_['isNil'](agents[_0x181eb2[_0xd373('0x14')]])){utils[_0xd373('0x1c')](util[_0xd373('0x12')](_0xd373('0x1d'),_0x181eb2[_0xd373('0x4')]),_0x181eb2);utils[_0xd373('0x2')](util['format'](_0xd373('0x1e'),_0x181eb2[_0xd373('0x4')],agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x19')],_0x181eb2[_0xd373('0x14')]));agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x1b')]=!![];agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x1f')]=utils[_0xd373('0x16')]();agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x20');agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x21')]=_0xd373('0x20');agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x22')]=_0x181eb2[_0xd373('0x23')]?parseInt(_0x181eb2[_0xd373('0x23')])/0x3e8:0x0;agents[_0x181eb2[_0xd373('0x14')]][_0xd373('0x24')]=0x0;unanswered[_0xd373('0x25')](_0x181eb2[_0xd373('0x14')]);}}catch(_0xf85ca8){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x1d'),_0x181eb2[_0xd373('0x4')]),_0xf85ca8);}};exports[_0xd373('0x26')]=function(_0x5287e7){try{_[_0xd373('0x27')](agents,function(_0x490842,_0x498aaa){if(_0x490842[_0xd373('0x4')]==_0x5287e7[_0xd373('0x4')]&&!_[_0xd373('0x28')](unanswered,_0x490842[_0xd373('0x14')])){utils[_0xd373('0x1c')](util['format'](_0xd373('0x29'),_0x5287e7[_0xd373('0x4')]),_0x5287e7);utils['info'](util[_0xd373('0x12')](_0xd373('0x2a'),_0x5287e7[_0xd373('0x4')],_0x490842[_0xd373('0x19')],_0x490842[_0xd373('0x14')]));_0x490842[_0xd373('0x1b')]=!![];_0x490842[_0xd373('0x1f')]=utils[_0xd373('0x16')]();_0x490842[_0xd373('0x9')]='abandoned';_0x490842[_0xd373('0x21')]=_0xd373('0x2b');_0x490842[_0xd373('0x22')]=_0x5287e7[_0xd373('0x22')];_0x490842[_0xd373('0x24')]=0x0;writeDB(_0x490842);}});}catch(_0x28da03){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x29'),_0x5287e7[_0xd373('0x4')]),_0x28da03);}};exports[_0xd373('0x2c')]=function(_0x13a1cd){try{if(agents[_0x13a1cd[_0xd373('0x14')]]){utils[_0xd373('0x1c')](util[_0xd373('0x12')]('[%s][agents][agentconnect]',_0x13a1cd[_0xd373('0x4')]),_0x13a1cd);utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x2d'),_0x13a1cd['uniqueid'],agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x19')],_0x13a1cd[_0xd373('0x14')]));agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x2e')]=utils[_0xd373('0x16')]();agents[_0x13a1cd['destuniqueid']]['connectedlinenum']=_0x13a1cd[_0xd373('0x8')];agents[_0x13a1cd['destuniqueid']][_0xd373('0x2f')]=_0x13a1cd[_0xd373('0x2f')];agents[_0x13a1cd[_0xd373('0x14')]]['holdtime']=_0x13a1cd[_0xd373('0x23')];agents[_0x13a1cd[_0xd373('0x14')]][_0xd373('0x9')]=_0xd373('0x30');_['forIn'](agents,function(_0x513038,_0x5de74e){if(_0x513038[_0xd373('0x14')]!=_0x13a1cd['destuniqueid']&&_0x513038[_0xd373('0x4')]==_0x13a1cd[_0xd373('0x4')]){_0x513038['talktime']=0x0;_0x513038['holdtime']=_0x13a1cd['ringtime'];_0x513038[_0xd373('0x1b')]=!![];_0x513038[_0xd373('0x1f')]=utils[_0xd373('0x16')]();_0x513038['lastevent']='answered_elsewhere';_0x513038[_0xd373('0x21')]=_0xd373('0x31');_0x513038['answeredelsewheredestinationuniqueid']=_0x13a1cd[_0xd373('0x14')];_0x513038[_0xd373('0x32')]=_0x13a1cd[_0xd373('0x19')];writeDB(_0x513038);}});}}catch(_0x9989e4){utils[_0xd373('0x1a')](util['format']('[%s][agents][agentconnect]',_0x13a1cd[_0xd373('0x4')]),_0x9989e4);}};exports[_0xd373('0xc')]=function(_0x30b423){try{if(!_[_0xd373('0x33')](agents[_0x30b423['destuniqueid']])){utils[_0xd373('0x1c')](util['format'](_0xd373('0x34'),_0x30b423[_0xd373('0x4')]),_0x30b423);utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x35'),_0x30b423['uniqueid'],agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x19')],_0x30b423['destuniqueid']));agents[_0x30b423[_0xd373('0x14')]][_0xd373('0xc')]=!![];agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x36')]=utils[_0xd373('0x16')]();agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x24')]=utils[_0xd373('0x37')](agents[_0x30b423[_0xd373('0x14')]][_0xd373('0x36')],agents[_0x30b423['destuniqueid']]['agentconnectAt']);agents[_0x30b423[_0xd373('0x14')]]['reason']=_0x30b423[_0xd373('0x21')];agents[_0x30b423['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x30b423[_0xd373('0x14')]]);}}catch(_0x39d995){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x34'),_0x30b423[_0xd373('0x4')]),_0x39d995);}};exports[_0xd373('0x38')]=function(_0x4d1088){try{if(!_[_0xd373('0x33')](agents[_0x4d1088['transfereruniqueid']])){utils[_0xd373('0x1c')](util[_0xd373('0x12')]('[%s][agents][blindtransfer]',_0x4d1088[_0xd373('0x4')]),_0x4d1088);utils['info'](util[_0xd373('0x12')](_0xd373('0x39'),_0x4d1088[_0xd373('0x4')],agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x19')],agents[_0x4d1088['transfereruniqueid']]['uniqueid']));agents[_0x4d1088['transfereruniqueid']][_0xd373('0x3b')]=!![];agents[_0x4d1088[_0xd373('0x3a')]]['transfertype']=_0xd373('0x3c');agents[_0x4d1088[_0xd373('0x3a')]]['transferexten']=_0x4d1088[_0xd373('0x3d')];agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x3e')]=agents[_0x4d1088[_0xd373('0x3a')]][_0xd373('0x4')];}}catch(_0xa2758){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x3f'),_0x4d1088[_0xd373('0x4')]),_0xa2758);}};exports[_0xd373('0x40')]=function(_0x5b88ea){try{utils['debug'](util['format']('[%s][agents][attendedtransfer]',_0x5b88ea['origtransfereruniqueid']),_0x5b88ea);if(_0x5b88ea['origtransfereruniqueid']==_0x5b88ea[_0xd373('0x41')]){if(!_[_0xd373('0x33')](agents[_0x5b88ea['secondtransfereruniqueid']])){utils['info'](util['format'](_0xd373('0x42'),_0x5b88ea[_0xd373('0x43')],agents[_0x5b88ea['secondtransfereruniqueid']]['membername']));agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x3b')]=!![];agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x45')]=_0xd373('0x46');agents[_0x5b88ea['secondtransfereruniqueid']][_0xd373('0x47')]=_0x5b88ea[_0xd373('0x48')];agents[_0x5b88ea[_0xd373('0x44')]][_0xd373('0x3e')]=_0x5b88ea[_0xd373('0x43')];}if(_0x5b88ea[_0xd373('0x49')]&&agents[_0x5b88ea[_0xd373('0x49')]]){agents[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4a')]=0x1;transfers[_0x5b88ea[_0xd373('0x49')]]=_[_0xd373('0x4b')](agents[_0x5b88ea[_0xd373('0x49')]]);transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x7')]=agents[_0x5b88ea[_0xd373('0x44')]]['calleridnum'];transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4c')]=agents[_0x5b88ea[_0xd373('0x44')]]['calleridname'];transfers[_0x5b88ea[_0xd373('0x49')]]['agentcalledAt']=utils[_0xd373('0x16')]();transfers[_0x5b88ea['transfereeuniqueid']][_0xd373('0x2e')]=utils[_0xd373('0x16')]();transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x22')]=0x0;transfers[_0x5b88ea[_0xd373('0x49')]][_0xd373('0x4a')]=0x2;}}else if(_0x5b88ea[_0xd373('0x44')]==_0x5b88ea[_0xd373('0x4d')]){if(!_[_0xd373('0x33')](agents[_0x5b88ea[_0xd373('0x43')]])){utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x42'),_0x5b88ea[_0xd373('0x43')],agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x19')]));agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x3b')]=!![];agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x45')]=_0xd373('0x46');agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x47')]=_0x5b88ea[_0xd373('0x4e')];agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x3e')]=_0x5b88ea['secondtransfereruniqueid'];}if(_0x5b88ea[_0xd373('0x4f')]&&agents[_0x5b88ea[_0xd373('0x4f')]]){agents[_0x5b88ea[_0xd373('0x4f')]]['agententerreason']=0x1;transfers[_0x5b88ea[_0xd373('0x4f')]]=_[_0xd373('0x4b')](agents[_0x5b88ea[_0xd373('0x4f')]]);transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x7')]=agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x7')];transfers[_0x5b88ea['transfertargetuniqueid']][_0xd373('0x4c')]=agents[_0x5b88ea[_0xd373('0x43')]][_0xd373('0x4c')];transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x15')]=utils[_0xd373('0x16')]();transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x2e')]=utils['now']();transfers[_0x5b88ea[_0xd373('0x4f')]]['holdtime']=0x0;transfers[_0x5b88ea[_0xd373('0x4f')]][_0xd373('0x4a')]=0x2;}}}catch(_0x1337c4){utils[_0xd373('0x1a')](util[_0xd373('0x12')](_0xd373('0x50'),_0x5b88ea[_0xd373('0x43')]),_0x1337c4);}};exports[_0xd373('0x51')]=function(_0x5f1bfd){try{utils[_0xd373('0x1c')](util['format'](_0xd373('0x52'),_0x5f1bfd[_0xd373('0x4')]),_0x5f1bfd);if(agents[_0x5f1bfd[_0xd373('0x4')]]&&agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')]===_0xd373('0x20')){if(_0x5f1bfd[_0xd373('0x53')]==='21'){agents[_0x5f1bfd['uniqueid']][_0xd373('0x21')]=_0xd373('0x54');agents[_0x5f1bfd[_0xd373('0x4')]]['lastevent']=_0xd373('0x54');}utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x55'),_0x5f1bfd[_0xd373('0x4')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x19')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(agents[_0x5f1bfd[_0xd373('0x4')]]);var _0x5bbea5=unanswered[_0xd373('0x56')](_0x5f1bfd[_0xd373('0x4')]);if(_0x5bbea5>-0x1){unanswered[_0xd373('0x57')](_0x5bbea5,0x1);}}if(transfers[_0x5f1bfd['uniqueid']]){transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0xc')]=!![];transfers[_0x5f1bfd[_0xd373('0x4')]]['agentcompleteAt']=utils[_0xd373('0x16')]();transfers[_0x5f1bfd['uniqueid']][_0xd373('0x24')]=utils[_0xd373('0x37')](transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x36')],transfers[_0x5f1bfd['uniqueid']][_0xd373('0x2e')]);transfers[_0x5f1bfd['uniqueid']][_0xd373('0x21')]=_0xd373('0x58');transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]=_0xd373('0x59');utils[_0xd373('0x2')](util['format'](_0xd373('0x55'),_0x5f1bfd['uniqueid'],transfers[_0x5f1bfd[_0xd373('0x4')]]['membername'],transfers[_0x5f1bfd['uniqueid']][_0xd373('0x21')],transfers[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(transfers[_0x5f1bfd[_0xd373('0x4')]],!![]);}if(agents[_0x5f1bfd['uniqueid']]&&agents[_0x5f1bfd['uniqueid']][_0xd373('0x2e')]){agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0xc')]=!![];agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x36')]=utils[_0xd373('0x16')]();agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x24')]=utils[_0xd373('0x37')](agents[_0x5f1bfd[_0xd373('0x4')]]['agentcompleteAt'],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x2e')]);agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x21')]=agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x3b')]?_0xd373('0x3b'):'agent';agents[_0x5f1bfd[_0xd373('0x4')]]['lastevent']='complete';utils[_0xd373('0x2')](util[_0xd373('0x12')](_0xd373('0x55'),_0x5f1bfd[_0xd373('0x4')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x19')],agents[_0x5f1bfd['uniqueid']][_0xd373('0x21')],agents[_0x5f1bfd[_0xd373('0x4')]][_0xd373('0x9')]));writeDB(agents[_0x5f1bfd['uniqueid']]);}}catch(_0x467ac8){utils[_0xd373('0x1a')](util[_0xd373('0x12')]('[%s][agents][hangup]',_0x5f1bfd[_0xd373('0x4')]),_0x467ac8);}}; \ No newline at end of file +var _0x0972=['clone','calleridname','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0972,0x64));var _0x2097=function(_0x236f14,_0xbbaf6a){_0x236f14=_0x236f14-0x0;var _0x3eccb4=_0x0972[_0x236f14];return _0x3eccb4;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1c7a40,_0x4ec7aa){utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c7a40[_0x2097('0x3')],_0x1c7a40[_0x2097('0x4')],_0x1c7a40[_0x2097('0x5')],_0x1c7a40[_0x2097('0x6')],_0x1c7a40[_0x2097('0x7')],_0x1c7a40[_0x2097('0x8')],_0x1c7a40[_0x2097('0x9')],_0x1c7a40['lastevent']));if(_0x1c7a40[_0x2097('0x5')]){utils[_0x2097('0xa')](_0x1c7a40[_0x2097('0x5')])[_0x2097('0xb')](function(_0x3b8fac){if(_0x3b8fac){_0x1c7a40['type']=_0x3b8fac[_0x2097('0xc')];_0x1c7a40[_0x2097('0xd')]=_0x1c7a40[_0x2097('0xe')]?_0x3b8fac[_0x2097('0xf')]:![];_0x1c7a40[_0x2097('0x10')]=_0x1c7a40[_0x2097('0xd')]?_0x3b8fac[_0x2097('0x11')]:0x0;}utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);});}else{utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);}if(_0x4ec7aa){delete transfers[_0x1c7a40[_0x2097('0x3')]];}else{delete agents[_0x1c7a40[_0x2097('0x14')]];}}exports[_0x2097('0x15')]=function(_0x24ca42){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x24ca42);agents[_0x24ca42[_0x2097('0x14')]]=_0x24ca42;agents[_0x24ca42['destuniqueid']][_0x2097('0x18')]=utils[_0x2097('0x19')]();agents[_0x24ca42['destuniqueid']]['lastevent']='called';agents[_0x24ca42[_0x2097('0x14')]]['connectedlinenum']=null;agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x1a')]=null;utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x1b'),_0x24ca42['uniqueid'],agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x6')],_0x24ca42[_0x2097('0x14')]));}catch(_0x34654a){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x34654a);}};exports['agentringnoanswer']=function(_0x4d957e){try{if(!_[_0x2097('0x1d')](agents[_0x4d957e['destuniqueid']])){utils[_0x2097('0x16')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x4d957e);utils['info'](util[_0x2097('0x2')](_0x2097('0x1e'),_0x4d957e[_0x2097('0x3')],agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x6')],_0x4d957e[_0x2097('0x14')]));agents[_0x4d957e['destuniqueid']][_0x2097('0x1f')]=!![];agents[_0x4d957e['destuniqueid']][_0x2097('0x20')]=utils[_0x2097('0x19')]();agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x21')]='timeout';agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x22')]='timeout';agents[_0x4d957e[_0x2097('0x14')]]['holdtime']=_0x4d957e[_0x2097('0x23')]?parseInt(_0x4d957e['ringtime'])/0x3e8:0x0;agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x24')]=0x0;unanswered[_0x2097('0x25')](_0x4d957e[_0x2097('0x14')]);}}catch(_0x410afa){utils[_0x2097('0x1c')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x410afa);}};exports[_0x2097('0x26')]=function(_0x5cce55){try{_[_0x2097('0x27')](agents,function(_0x41487d,_0x59fb84){if(_0x41487d['uniqueid']==_0x5cce55[_0x2097('0x3')]&&!_[_0x2097('0x28')](unanswered,_0x41487d[_0x2097('0x14')])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x5cce55);utils[_0x2097('0x1')](util['format'](_0x2097('0x2a'),_0x5cce55[_0x2097('0x3')],_0x41487d[_0x2097('0x6')],_0x41487d[_0x2097('0x14')]));_0x41487d[_0x2097('0x1f')]=!![];_0x41487d[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x41487d[_0x2097('0x21')]=_0x2097('0x2b');_0x41487d['reason']=_0x2097('0x2b');_0x41487d[_0x2097('0x2c')]=_0x5cce55[_0x2097('0x2c')];_0x41487d['talktime']=0x0;writeDB(_0x41487d);}});}catch(_0x3d97ee){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x3d97ee);}};exports['agentconnect']=function(_0x5689f6){try{if(agents[_0x5689f6[_0x2097('0x14')]]){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x5689f6);utils[_0x2097('0x1')](util['format'](_0x2097('0x2e'),_0x5689f6[_0x2097('0x3')],agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x6')],_0x5689f6[_0x2097('0x14')]));agents[_0x5689f6[_0x2097('0x14')]]['agentconnectAt']=utils[_0x2097('0x19')]();agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x9')]=_0x5689f6['connectedlinenum'];agents[_0x5689f6['destuniqueid']][_0x2097('0x1a')]=_0x5689f6[_0x2097('0x1a')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x2c')]=_0x5689f6[_0x2097('0x23')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x21')]=_0x2097('0x2f');_[_0x2097('0x27')](agents,function(_0x3bfb5c,_0x337979){if(_0x3bfb5c[_0x2097('0x14')]!=_0x5689f6['destuniqueid']&&_0x3bfb5c[_0x2097('0x3')]==_0x5689f6[_0x2097('0x3')]){_0x3bfb5c[_0x2097('0x24')]=0x0;_0x3bfb5c['holdtime']=_0x5689f6[_0x2097('0x23')];_0x3bfb5c[_0x2097('0x1f')]=!![];_0x3bfb5c[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x3bfb5c[_0x2097('0x21')]=_0x2097('0x30');_0x3bfb5c[_0x2097('0x22')]=_0x2097('0x30');_0x3bfb5c['answeredelsewheredestinationuniqueid']=_0x5689f6[_0x2097('0x14')];_0x3bfb5c[_0x2097('0x31')]=_0x5689f6[_0x2097('0x6')];writeDB(_0x3bfb5c);}});}}catch(_0x3288ae){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x3288ae);}};exports['agentcomplete']=function(_0x3fc3fe){try{if(!_['isNil'](agents[_0x3fc3fe[_0x2097('0x14')]])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x32'),_0x3fc3fe[_0x2097('0x3')]),_0x3fc3fe);utils['info'](util[_0x2097('0x2')](_0x2097('0x33'),_0x3fc3fe[_0x2097('0x3')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x6')],_0x3fc3fe['destuniqueid']));agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0xe')]=!![];agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x34')]=utils[_0x2097('0x19')]();agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x3fc3fe['destuniqueid']][_0x2097('0x34')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x36')]);agents[_0x3fc3fe[_0x2097('0x14')]]['reason']=_0x3fc3fe['reason'];agents[_0x3fc3fe['destuniqueid']][_0x2097('0x21')]=_0x2097('0x37');writeDB(agents[_0x3fc3fe['destuniqueid']]);}}catch(_0x10577d){utils[_0x2097('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x3fc3fe[_0x2097('0x3')]),_0x10577d);}};exports[_0x2097('0x38')]=function(_0x1b4de6){try{if(!_['isNil'](agents[_0x1b4de6[_0x2097('0x39')]])){utils[_0x2097('0x16')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x1b4de6);utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x3b'),_0x1b4de6['uniqueid'],agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x6')],agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3')]));agents[_0x1b4de6['transfereruniqueid']]['transfer']=!![];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3c')]='blind';agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3d')]=_0x1b4de6[_0x2097('0x3e')];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3f')]=agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x3')];}}catch(_0x228b60){utils[_0x2097('0x1c')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x228b60);}};exports['attendedtransfer']=function(_0x12ba76){try{utils['debug'](util[_0x2097('0x2')]('[%s][agents][attendedtransfer]',_0x12ba76['origtransfereruniqueid']),_0x12ba76);if(_0x12ba76['origtransfereruniqueid']==_0x12ba76[_0x2097('0x40')]){if(!_['isNil'](agents[_0x12ba76['secondtransfereruniqueid']])){utils[_0x2097('0x1')](util['format'](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76['secondtransfereruniqueid']][_0x2097('0x6')]));agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3c')]='ATTENDED';agents[_0x12ba76[_0x2097('0x43')]]['transferexten']=_0x12ba76[_0x2097('0x45')];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3f')]=_0x12ba76['origtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x46')]&&agents[_0x12ba76[_0x2097('0x46')]]){agents[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x46')]]=_['clone'](agents[_0x12ba76['transfereeuniqueid']]);transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x8')]=agents[_0x12ba76['secondtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76['transfereeuniqueid']]['calleridname']=agents[_0x12ba76[_0x2097('0x43')]]['calleridname'];transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x2c')]=0x0;transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x2;}}else if(_0x12ba76[_0x2097('0x43')]==_0x12ba76[_0x2097('0x48')]){if(!_['isNil'](agents[_0x12ba76[_0x2097('0x42')]])){utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76[_0x2097('0x42')]]['membername']));agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x3c')]=_0x2097('0x49');agents[_0x12ba76['origtransfereruniqueid']][_0x2097('0x3d')]=_0x12ba76[_0x2097('0x4a')];agents[_0x12ba76['origtransfereruniqueid']]['transferuniqueid']=_0x12ba76['secondtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x4b')]&&agents[_0x12ba76[_0x2097('0x4b')]]){agents[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x4b')]]=_[_0x2097('0x4c')](agents[_0x12ba76[_0x2097('0x4b')]]);transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x8')]=agents[_0x12ba76['origtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x4d')]=agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x4d')];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x4b')]]['holdtime']=0x0;transfers[_0x12ba76['transfertargetuniqueid']][_0x2097('0x47')]=0x2;}}}catch(_0x345a12){utils['error'](util[_0x2097('0x2')](_0x2097('0x4e'),_0x12ba76[_0x2097('0x42')]),_0x345a12);}};exports[_0x2097('0x4f')]=function(_0x1f824f){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f['uniqueid']),_0x1f824f);if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f[_0x2097('0x3')]]['reason']===_0x2097('0x51')){if(_0x1f824f[_0x2097('0x52')]==='21'){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x53');agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x53');}utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f['uniqueid'],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f[_0x2097('0x3')]]);var _0x2a950f=unanswered[_0x2097('0x55')](_0x1f824f['uniqueid']);if(_0x2a950f>-0x1){unanswered[_0x2097('0x56')](_0x2a950f,0x1);}}if(transfers[_0x1f824f['uniqueid']]){transfers[_0x1f824f[_0x2097('0x3')]]['agentcomplete']=!![];transfers[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();transfers[_0x1f824f['uniqueid']][_0x2097('0x24')]=utils[_0x2097('0x35')](transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x34')],transfers[_0x1f824f[_0x2097('0x3')]]['agentconnectAt']);transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x57');transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f[_0x2097('0x3')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]));writeDB(transfers[_0x1f824f['uniqueid']],!![]);}if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f['uniqueid']]['agentconnectAt']){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0xe')]=!![];agents[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x1f824f['uniqueid']][_0x2097('0x34')],agents[_0x1f824f['uniqueid']][_0x2097('0x36')]);agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=agents[_0x1f824f[_0x2097('0x3')]]['transfer']?_0x2097('0x44'):_0x2097('0x57');agents[_0x1f824f[_0x2097('0x3')]]['lastevent']=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1f824f[_0x2097('0x3')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f['uniqueid']]);}}catch(_0xc7481d){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f[_0x2097('0x3')]),_0xc7481d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index dd264c3..deee0d4 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 _0x4dc2=['\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr','substring','includes','hangup','noop','execif','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','starttime','billableseconds','debug','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0x4dc2,0x1cd));var _0x24dc=function(_0x2b5c7e,_0x4ac5a9){_0x2b5c7e=_0x2b5c7e-0x0;var _0x190216=_0x4dc2[_0x2b5c7e];return _0x190216;};'use strict';var _=require(_0x24dc('0x0'));var util=require(_0x24dc('0x1'));var utils=require(_0x24dc('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x24dc('0x3'),'FAILED','FAILED',_0x24dc('0x3'),_0x24dc('0x3'),'NO\x20ANSWER',_0x24dc('0x4'),_0x24dc('0x5'),_0x24dc('0x6'),'FAILED',_0x24dc('0x6')];var channels={};function writeDB(_0x20d448){var _0x4f6fdb;if(transfers[_0x24dc('0x7')][_0x20d448[_0x24dc('0x8')]]){_0x4f6fdb=_0x20d448[_0x24dc('0x8')];_0x20d448[_0x24dc('0x8')]=transfers[_0x24dc('0x7')][_0x20d448['uniqueid']][_0x24dc('0x9')];}utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0xc'),_0x20d448['uniqueid'],_0x20d448['channel'],_0x20d448[_0x24dc('0xd')],_0x20d448[_0x24dc('0xe')],_0x20d448[_0x24dc('0xf')],_0x20d448['calleridnum'],_0x20d448['connectedlinenum'],_0x20d448[_0x24dc('0x10')]));if(_0x20d448[_0x24dc('0x11')]){utils[_0x24dc('0x12')](_0x20d448[_0x24dc('0x11')])['then'](function(_0x1d8d5e){if(_0x1d8d5e){_0x20d448['UserId']=_0x1d8d5e['id'];}utils[_0x24dc('0x13')](_0x24dc('0x14'),_0x20d448);});}else{utils[_0x24dc('0x13')](_0x24dc('0x14'),_0x20d448);}if(channels[_0x20d448[_0x24dc('0x8')]]){delete channels[_0x20d448[_0x24dc('0x8')]];}else if(_0x4f6fdb&&channels[_0x4f6fdb]){delete transfers['blinds'][_0x4f6fdb];delete channels[_0x4f6fdb];}}exports[_0x24dc('0x15')]=function(_0x4f0c4e){try{utils['debug'](util[_0x24dc('0xb')](_0x24dc('0x16'),_0x4f0c4e[_0x24dc('0x8')]),_0x4f0c4e);if(_0x4f0c4e[_0x24dc('0x8')]==_0x4f0c4e[_0x24dc('0x17')]&&_0x4f0c4e[_0x24dc('0x18')]!=_0x24dc('0x19')){utils[_0x24dc('0xa')](util['format'](_0x24dc('0x1a'),_0x4f0c4e[_0x24dc('0x8')],_0x4f0c4e[_0x24dc('0x1b')],_0x4f0c4e[_0x24dc('0x1c')]));channels[_0x4f0c4e[_0x24dc('0x8')]]={'uniqueid':_0x4f0c4e[_0x24dc('0x8')],'accountcode':_0x4f0c4e[_0x24dc('0x11')],'source':_0x4f0c4e[_0x24dc('0x1d')],'destination':_0x4f0c4e['exten'],'destinationcontext':_0x4f0c4e[_0x24dc('0x1b')],'channel':_0x4f0c4e[_0x24dc('0x18')],'starttime':utils[_0x24dc('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x24dc('0x3'),'amaflags':_0x24dc('0x1f')};}}catch(_0x3e7cc5){utils[_0x24dc('0x20')](util['format'](_0x24dc('0x16'),_0x4f0c4e[_0x24dc('0x8')]),_0x3e7cc5);}};exports[_0x24dc('0x21')]=function(_0x507c91){try{utils['debug'](util[_0x24dc('0xb')](_0x24dc('0x22'),_0x507c91['uniqueid']),_0x507c91);if(!_[_0x24dc('0x23')](channels[_0x507c91[_0x24dc('0x8')]])&&_0x507c91['channelstate']==0x6){utils['info'](util[_0x24dc('0xb')](_0x24dc('0x24'),_0x507c91[_0x24dc('0x8')],_0x507c91[_0x24dc('0x1b')],_0x507c91[_0x24dc('0x18')]));if(_[_0x24dc('0x23')](channels[_0x507c91['uniqueid']][_0x24dc('0x25')])){channels[_0x507c91['uniqueid']][_0x24dc('0x25')]=utils[_0x24dc('0x1e')]();}}else if(!_[_0x24dc('0x23')](channels[_0x507c91[_0x24dc('0x17')]])&&_0x507c91[_0x24dc('0x26')]==0x6&&_0x507c91['context']!=_0x24dc('0x27')){utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0x28'),_0x507c91['uniqueid'],_0x507c91[_0x24dc('0x17')],_0x507c91['context'],_0x507c91[_0x24dc('0x18')]));channels[_0x507c91[_0x24dc('0x17')]]['accountcode']=_0x507c91[_0x24dc('0x11')];channels[_0x507c91[_0x24dc('0x17')]][_0x24dc('0x29')]=_0x507c91['channel'];if(_['isNil'](channels[_0x507c91['linkedid']]['answertime'])){channels[_0x507c91[_0x24dc('0x17')]][_0x24dc('0x2a')]=utils[_0x24dc('0x1e')]();}channels[_0x507c91[_0x24dc('0x17')]][_0x24dc('0x2b')]=dispositions[_[_0x24dc('0x2c')](_0x507c91['channelstate'])]||_0x24dc('0x4');}}catch(_0x427f58){utils[_0x24dc('0x20')](util[_0x24dc('0xb')](_0x24dc('0x22'),_0x507c91['uniqueid']),_0x427f58);}};exports['hangup']=function(_0x305d88){try{if(!_['isNil'](channels[_0x305d88[_0x24dc('0x8')]])){utils['debug'](util[_0x24dc('0xb')](_0x24dc('0x2d'),_0x305d88['uniqueid']),_0x305d88);if(_[_0x24dc('0x23')](channels[_0x305d88[_0x24dc('0x8')]]['callerid'])){channels[_0x305d88[_0x24dc('0x8')]][_0x24dc('0x2e')]=_0x305d88[_0x24dc('0x2f')]+'\x20<'+_0x305d88[_0x24dc('0x1d')]+'>';}utils[_0x24dc('0xa')](util[_0x24dc('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x305d88[_0x24dc('0x8')],channels[_0x305d88[_0x24dc('0x8')]]['callerid'],_0x305d88[_0x24dc('0x30')]));channels[_0x305d88['uniqueid']][_0x24dc('0x31')]=utils[_0x24dc('0x1e')]();channels[_0x305d88['uniqueid']][_0x24dc('0x32')]=utils['diffTime'](channels[_0x305d88['uniqueid']][_0x24dc('0x31')],channels[_0x305d88['uniqueid']][_0x24dc('0x33')]);channels[_0x305d88[_0x24dc('0x8')]][_0x24dc('0x34')]=channels[_0x305d88[_0x24dc('0x8')]][_0x24dc('0x2a')]?utils['diffTime'](channels[_0x305d88[_0x24dc('0x8')]]['endtime'],channels[_0x305d88[_0x24dc('0x8')]]['answertime']):0x0;writeDB(channels[_0x305d88[_0x24dc('0x8')]]);}}catch(_0x312860){utils[_0x24dc('0x20')](util[_0x24dc('0xb')]('[%s][calls][hangup]',_0x305d88[_0x24dc('0x8')]),_0x312860);}};exports['attendedtransfer']=function(_0x3b3ef2){try{if(!_[_0x24dc('0x23')](channels[_0x3b3ef2['localtwolinkedid']])){utils[_0x24dc('0x35')](util[_0x24dc('0xb')](_0x24dc('0x36'),_0x3b3ef2['origtransfereruniqueid']),_0x3b3ef2);if(channels[_0x3b3ef2[_0x24dc('0x37')]][_0x24dc('0x18')]==_0x3b3ef2[_0x24dc('0x38')]){utils[_0x24dc('0xa')](util['format'](_0x24dc('0x39'),_0x3b3ef2['origtransfereruniqueid'],_0x3b3ef2[_0x24dc('0x37')],_0x3b3ef2[_0x24dc('0x3a')]));channels[_0x3b3ef2[_0x24dc('0x37')]][_0x24dc('0x29')]=_0x3b3ef2['secondtransfererchannel'];channels[_0x3b3ef2['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x3b3ef2[_0x24dc('0x37')]]['channel']=_0x3b3ef2[_0x24dc('0x3b')]){utils[_0x24dc('0xa')](util['format'](_0x24dc('0x39'),_0x3b3ef2[_0x24dc('0x3c')],_0x3b3ef2[_0x24dc('0x37')],_0x3b3ef2['origtransfererchannel']));channels[_0x3b3ef2[_0x24dc('0x37')]][_0x24dc('0x29')]=_0x3b3ef2[_0x24dc('0x3d')];channels[_0x3b3ef2[_0x24dc('0x37')]][_0x24dc('0x3e')]=_0x24dc('0x3f');}}}catch(_0x12b1e9){utils[_0x24dc('0x20')](util['format'](_0x24dc('0x36'),_0x3b3ef2[_0x24dc('0x3c')]),_0x12b1e9);}};exports[_0x24dc('0x40')]=function(_0x5bccfd){try{if(!_[_0x24dc('0x23')](channels[_0x5bccfd[_0x24dc('0x8')]])){utils['debug'](util[_0x24dc('0xb')](_0x24dc('0x41'),_0x5bccfd[_0x24dc('0x8')]),_0x5bccfd);channels[_0x5bccfd['uniqueid']][_0x24dc('0x42')]=utils['now']();utils[_0x24dc('0xa')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5bccfd[_0x24dc('0x8')],channels[_0x5bccfd[_0x24dc('0x8')]][_0x24dc('0x42')]));}}catch(_0x329e08){utils[_0x24dc('0x20')](util[_0x24dc('0xb')](_0x24dc('0x41'),_0x5bccfd[_0x24dc('0x8')]),_0x329e08);}};exports['musiconholdstop']=function(_0x7248e2){try{if(!_[_0x24dc('0x23')](channels[_0x7248e2['uniqueid']])){utils['debug'](util['format'](_0x24dc('0x43'),_0x7248e2[_0x24dc('0x8')]),_0x7248e2);if(!_[_0x24dc('0x23')](channels[_0x7248e2[_0x24dc('0x8')]][_0x24dc('0x42')])){channels[_0x7248e2[_0x24dc('0x8')]]['mohtime']+=utils[_0x24dc('0x44')](utils[_0x24dc('0x1e')](),channels[_0x7248e2[_0x24dc('0x8')]][_0x24dc('0x42')]);utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0x45'),_0x7248e2[_0x24dc('0x8')],channels[_0x7248e2[_0x24dc('0x8')]][_0x24dc('0x46')]));delete channels[_0x7248e2[_0x24dc('0x8')]][_0x24dc('0x42')];}}}catch(_0xdc3785){utils['error'](util['format'](_0x24dc('0x43'),_0x7248e2[_0x24dc('0x8')]),_0xdc3785);}};exports[_0x24dc('0x47')]=function(_0x4fbbb4){try{if(!_[_0x24dc('0x23')](channels[_0x4fbbb4[_0x24dc('0x8')]])){utils[_0x24dc('0x35')](util[_0x24dc('0xb')]('[%s][calls][varset]',_0x4fbbb4[_0x24dc('0x8')]),_0x4fbbb4);if(!_['isNil'](_0x4fbbb4[_0x24dc('0x48')][_0x24dc('0x49')])){utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0x4a'),_0x4fbbb4[_0x24dc('0x8')],_0x4fbbb4[_0x24dc('0x4b')]));channels[_0x4fbbb4[_0x24dc('0x8')]][_0x24dc('0x4c')]=_0x4fbbb4[_0x24dc('0x4b')];}if(!_[_0x24dc('0x23')](_0x4fbbb4['variable'][_0x24dc('0x4d')])){utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0x4e'),_0x4fbbb4[_0x24dc('0x8')],_0x4fbbb4['value']));channels[_0x4fbbb4[_0x24dc('0x8')]]['destination']=_0x4fbbb4['value'];channels[_0x4fbbb4[_0x24dc('0x8')]][_0x24dc('0x2e')]='\x22'+_0x4fbbb4[_0x24dc('0x4b')]+_0x24dc('0x4f')+_0x4fbbb4[_0x24dc('0x4b')]+'>';}if(!_[_0x24dc('0x23')](_0x4fbbb4[_0x24dc('0x48')][_0x24dc('0x50')])||!_[_0x24dc('0x23')](_0x4fbbb4['variable'][_0x24dc('0x51')])){utils[_0x24dc('0xa')](util[_0x24dc('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4fbbb4[_0x24dc('0x8')],!_[_0x24dc('0x23')](_0x4fbbb4[_0x24dc('0x48')][_0x24dc('0x50')])?'xmd-callerid-preview':_0x24dc('0x51'),_0x4fbbb4[_0x24dc('0x4b')]));channels[_0x4fbbb4[_0x24dc('0x8')]][_0x24dc('0x2e')]=_0x4fbbb4[_0x24dc('0x4b')];}if(!_[_0x24dc('0x23')](_0x4fbbb4[_0x24dc('0x48')][_0x24dc('0x52')])||!_[_0x24dc('0x23')](_0x4fbbb4[_0x24dc('0x48')]['xmcs-queue'])){utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0x53'),_0x4fbbb4[_0x24dc('0x8')],!_[_0x24dc('0x23')](_0x4fbbb4[_0x24dc('0x48')]['xmd-queue'])?_0x24dc('0x52'):'xmcs-queue',_0x4fbbb4[_0x24dc('0x4b')]));channels[_0x4fbbb4['uniqueid']][_0x24dc('0x54')]=_0x24dc('0x55');channels[_0x4fbbb4['uniqueid']][_0x24dc('0x56')]=_0x4fbbb4[_0x24dc('0x4b')];channels[_0x4fbbb4['uniqueid']][_0x24dc('0xd')]=!![];}if(!_[_0x24dc('0x23')](_0x4fbbb4[_0x24dc('0x48')]['xmd-contactid'])){utils[_0x24dc('0xa')](util[_0x24dc('0xb')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4fbbb4[_0x24dc('0x8')],_0x4fbbb4['value']));channels[_0x4fbbb4['uniqueid']][_0x24dc('0x57')]=_0x4fbbb4[_0x24dc('0x4b')];}if(!_['isNil'](_0x4fbbb4['variable'][_0x24dc('0x58')])){utils[_0x24dc('0xa')](util[_0x24dc('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4fbbb4[_0x24dc('0x8')],_0x4fbbb4['value']));channels[_0x4fbbb4[_0x24dc('0x8')]]['type']=_0x4fbbb4['value'];}if(!_[_0x24dc('0x23')](_0x4fbbb4['variable'][_0x24dc('0x59')])){utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0x5a'),_0x4fbbb4[_0x24dc('0x8')],_0x4fbbb4[_0x24dc('0x4b')]));channels[_0x4fbbb4[_0x24dc('0x8')]][_0x24dc('0x5b')]=_0x4fbbb4[_0x24dc('0x4b')];}if(!_[_0x24dc('0x23')](_0x4fbbb4[_0x24dc('0x48')][_0x24dc('0x5c')])){utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0x5d'),_0x4fbbb4[_0x24dc('0x8')],_0x4fbbb4[_0x24dc('0x4b')]));channels[_0x4fbbb4[_0x24dc('0x8')]][_0x24dc('0x5c')]=_0x4fbbb4[_0x24dc('0x4b')];}}}catch(_0x39924b){utils[_0x24dc('0x20')](util[_0x24dc('0xb')](_0x24dc('0x5e'),_0x4fbbb4['uniqueid']),_0x39924b);}};exports[_0x24dc('0x5f')]=function(_0x186fcb){try{if(!_[_0x24dc('0x23')](channels[_0x186fcb[_0x24dc('0x8')]])){utils[_0x24dc('0x35')](util[_0x24dc('0xb')](_0x24dc('0x60'),_0x186fcb[_0x24dc('0x8')]),_0x186fcb);utils[_0x24dc('0xa')](util[_0x24dc('0xb')](_0x24dc('0x61'),_0x186fcb[_0x24dc('0x8')],_0x186fcb['application'],_0x186fcb['appdata']));if(_0x186fcb[_0x24dc('0x62')][_0x24dc('0x63')]()==_0x24dc('0x64')&&_['startsWith'](_0x186fcb[_0x24dc('0x65')][_0x24dc('0x63')](),_0x24dc('0x66'))){var _0x1b5023=_0x186fcb[_0x24dc('0x65')]['split']('=');var _0x191c59=_0x1b5023[0x0][_0x24dc('0x67')](_0x1b5023[0x0]['lastIndexOf']('(')+0x1,_0x1b5023[0x0]['lastIndexOf'](')'));var _0x1afa3f=_0x1b5023[0x1];channels[_0x186fcb[_0x24dc('0x8')]][_0x191c59]=_0x1afa3f;}if(!_[_0x24dc('0x68')]([_0x24dc('0x69'),_0x24dc('0x6a'),_0x24dc('0x6b'),_0x24dc('0x64'),'gotoif'],_0x186fcb[_0x24dc('0x62')][_0x24dc('0x63')]())){channels[_0x186fcb['uniqueid']][_0x24dc('0x54')]=_0x186fcb['application'];channels[_0x186fcb[_0x24dc('0x8')]][_0x24dc('0x56')]=_0x186fcb['appdata'];}}}catch(_0x2389ef){utils[_0x24dc('0x20')](util[_0x24dc('0xb')](_0x24dc('0x60'),_0x186fcb[_0x24dc('0x8')]),_0x2389ef);}}; \ No newline at end of file +var _0xd6aa=['secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','includes','hangup','noop','execif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','blinds','uniqueid','transfereeuniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','format','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','error','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd6aa,0x9e));var _0xad6a=function(_0x430d21,_0x2fdf27){_0x430d21=_0x430d21-0x0;var _0x24e924=_0xd6aa[_0x430d21];return _0x24e924;};'use strict';var _=require(_0xad6a('0x0'));var util=require(_0xad6a('0x1'));var utils=require(_0xad6a('0x2'));var transfers=require(_0xad6a('0x3'));var dispositions=[_0xad6a('0x4'),_0xad6a('0x5'),'FAILED','NO\x20ANSWER',_0xad6a('0x4'),_0xad6a('0x4'),'ANSWERED','BUSY',_0xad6a('0x5'),_0xad6a('0x5'),_0xad6a('0x5')];var channels={};function writeDB(_0x2bd917){var _0x39cae4;if(transfers[_0xad6a('0x6')][_0x2bd917['uniqueid']]){_0x39cae4=_0x2bd917[_0xad6a('0x7')];_0x2bd917[_0xad6a('0x7')]=transfers[_0xad6a('0x6')][_0x2bd917['uniqueid']][_0xad6a('0x8')];}utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2bd917['uniqueid'],_0x2bd917['channel'],_0x2bd917[_0xad6a('0x9')],_0x2bd917[_0xad6a('0xa')],_0x2bd917[_0xad6a('0xb')],_0x2bd917[_0xad6a('0xc')],_0x2bd917[_0xad6a('0xd')],_0x2bd917[_0xad6a('0xe')]));if(_0x2bd917[_0xad6a('0xf')]){utils[_0xad6a('0x10')](_0x2bd917['accountcode'])['then'](function(_0x48c9cd){if(_0x48c9cd){_0x2bd917[_0xad6a('0x11')]=_0x48c9cd['id'];}utils[_0xad6a('0x12')](_0xad6a('0x13'),_0x2bd917);});}else{utils[_0xad6a('0x12')](_0xad6a('0x13'),_0x2bd917);}if(channels[_0x2bd917[_0xad6a('0x7')]]){delete channels[_0x2bd917[_0xad6a('0x7')]];}else if(_0x39cae4&&channels[_0x39cae4]){delete transfers[_0xad6a('0x6')][_0x39cae4];delete channels[_0x39cae4];}}exports[_0xad6a('0x14')]=function(_0x156926){try{utils['debug'](util[_0xad6a('0x15')]('[%s][calls][newchannel]',_0x156926['uniqueid']),_0x156926);if(_0x156926[_0xad6a('0x7')]==_0x156926[_0xad6a('0x16')]&&_0x156926[_0xad6a('0x17')]!=_0xad6a('0x18')){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x1a'),_0x156926['uniqueid'],_0x156926[_0xad6a('0x1b')],_0x156926[_0xad6a('0x1c')]));channels[_0x156926[_0xad6a('0x7')]]={'uniqueid':_0x156926[_0xad6a('0x7')],'accountcode':_0x156926[_0xad6a('0xf')],'source':_0x156926['calleridnum'],'destination':_0x156926[_0xad6a('0x1c')],'destinationcontext':_0x156926[_0xad6a('0x1b')],'channel':_0x156926[_0xad6a('0x17')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xad6a('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x3802da){utils['error'](util[_0xad6a('0x15')](_0xad6a('0x1d'),_0x156926[_0xad6a('0x7')]),_0x3802da);}};exports[_0xad6a('0x1e')]=function(_0x250e9c){try{utils[_0xad6a('0x1f')](util['format'](_0xad6a('0x20'),_0x250e9c[_0xad6a('0x7')]),_0x250e9c);if(!_[_0xad6a('0x21')](channels[_0x250e9c['uniqueid']])&&_0x250e9c[_0xad6a('0x22')]==0x6){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x23'),_0x250e9c[_0xad6a('0x7')],_0x250e9c[_0xad6a('0x1b')],_0x250e9c[_0xad6a('0x17')]));if(_[_0xad6a('0x21')](channels[_0x250e9c['uniqueid']][_0xad6a('0x24')])){channels[_0x250e9c[_0xad6a('0x7')]][_0xad6a('0x24')]=utils[_0xad6a('0x25')]();}}else if(!_[_0xad6a('0x21')](channels[_0x250e9c[_0xad6a('0x16')]])&&_0x250e9c['channelstate']==0x6&&_0x250e9c[_0xad6a('0x1b')]!=_0xad6a('0x26')){utils['info'](util[_0xad6a('0x15')](_0xad6a('0x27'),_0x250e9c[_0xad6a('0x7')],_0x250e9c[_0xad6a('0x16')],_0x250e9c[_0xad6a('0x1b')],_0x250e9c[_0xad6a('0x17')]));channels[_0x250e9c[_0xad6a('0x16')]][_0xad6a('0xf')]=_0x250e9c[_0xad6a('0xf')];channels[_0x250e9c[_0xad6a('0x16')]][_0xad6a('0x28')]=_0x250e9c[_0xad6a('0x17')];if(_[_0xad6a('0x21')](channels[_0x250e9c[_0xad6a('0x16')]]['answertime'])){channels[_0x250e9c[_0xad6a('0x16')]][_0xad6a('0x29')]=utils[_0xad6a('0x25')]();}channels[_0x250e9c[_0xad6a('0x16')]][_0xad6a('0x2a')]=dispositions[_[_0xad6a('0x2b')](_0x250e9c[_0xad6a('0x22')])]||_0xad6a('0x2c');}}catch(_0x136f11){utils[_0xad6a('0x2d')](util['format'](_0xad6a('0x20'),_0x250e9c[_0xad6a('0x7')]),_0x136f11);}};exports['hangup']=function(_0x4cb603){try{if(!_[_0xad6a('0x21')](channels[_0x4cb603[_0xad6a('0x7')]])){utils[_0xad6a('0x1f')](util[_0xad6a('0x15')](_0xad6a('0x2e'),_0x4cb603[_0xad6a('0x7')]),_0x4cb603);if(_[_0xad6a('0x21')](channels[_0x4cb603[_0xad6a('0x7')]][_0xad6a('0x2f')])){channels[_0x4cb603[_0xad6a('0x7')]][_0xad6a('0x2f')]=_0x4cb603[_0xad6a('0x30')]+'\x20<'+_0x4cb603[_0xad6a('0xc')]+'>';}utils['info'](util[_0xad6a('0x15')](_0xad6a('0x31'),_0x4cb603['uniqueid'],channels[_0x4cb603[_0xad6a('0x7')]][_0xad6a('0x2f')],_0x4cb603[_0xad6a('0x32')]));channels[_0x4cb603['uniqueid']][_0xad6a('0x33')]=utils[_0xad6a('0x25')]();channels[_0x4cb603[_0xad6a('0x7')]][_0xad6a('0x34')]=utils['diffTime'](channels[_0x4cb603['uniqueid']][_0xad6a('0x33')],channels[_0x4cb603[_0xad6a('0x7')]][_0xad6a('0x35')]);channels[_0x4cb603[_0xad6a('0x7')]]['billableseconds']=channels[_0x4cb603['uniqueid']][_0xad6a('0x29')]?utils[_0xad6a('0x36')](channels[_0x4cb603[_0xad6a('0x7')]]['endtime'],channels[_0x4cb603['uniqueid']][_0xad6a('0x29')]):0x0;writeDB(channels[_0x4cb603[_0xad6a('0x7')]]);}}catch(_0xe23333){utils['error'](util['format'](_0xad6a('0x2e'),_0x4cb603['uniqueid']),_0xe23333);}};exports[_0xad6a('0x37')]=function(_0x30f601){try{if(!_[_0xad6a('0x21')](channels[_0x30f601[_0xad6a('0x38')]])){utils[_0xad6a('0x1f')](util['format'](_0xad6a('0x39'),_0x30f601[_0xad6a('0x3a')]),_0x30f601);if(channels[_0x30f601[_0xad6a('0x38')]][_0xad6a('0x17')]==_0x30f601['transfereechannel']){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x3b'),_0x30f601[_0xad6a('0x3a')],_0x30f601[_0xad6a('0x38')],_0x30f601[_0xad6a('0x3c')]));channels[_0x30f601[_0xad6a('0x38')]]['destinationchannel']=_0x30f601['secondtransfererchannel'];channels[_0x30f601[_0xad6a('0x38')]][_0xad6a('0x3d')]=_0xad6a('0x3e');}else if(channels[_0x30f601[_0xad6a('0x38')]][_0xad6a('0x17')]=_0x30f601[_0xad6a('0x3f')]){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x3b'),_0x30f601['origtransfereruniqueid'],_0x30f601[_0xad6a('0x38')],_0x30f601[_0xad6a('0x40')]));channels[_0x30f601[_0xad6a('0x38')]]['destinationchannel']=_0x30f601[_0xad6a('0x40')];channels[_0x30f601[_0xad6a('0x38')]][_0xad6a('0x3d')]=_0xad6a('0x3e');}}}catch(_0x13be99){utils[_0xad6a('0x2d')](util[_0xad6a('0x15')](_0xad6a('0x39'),_0x30f601['origtransfereruniqueid']),_0x13be99);}};exports[_0xad6a('0x41')]=function(_0x402a6b){try{if(!_[_0xad6a('0x21')](channels[_0x402a6b[_0xad6a('0x7')]])){utils[_0xad6a('0x1f')](util[_0xad6a('0x15')](_0xad6a('0x42'),_0x402a6b[_0xad6a('0x7')]),_0x402a6b);channels[_0x402a6b[_0xad6a('0x7')]][_0xad6a('0x43')]=utils['now']();utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x44'),_0x402a6b[_0xad6a('0x7')],channels[_0x402a6b[_0xad6a('0x7')]][_0xad6a('0x43')]));}}catch(_0x117431){utils[_0xad6a('0x2d')](util['format'](_0xad6a('0x42'),_0x402a6b['uniqueid']),_0x117431);}};exports['musiconholdstop']=function(_0x37e2d5){try{if(!_[_0xad6a('0x21')](channels[_0x37e2d5[_0xad6a('0x7')]])){utils[_0xad6a('0x1f')](util[_0xad6a('0x15')]('[%s][calls][musiconholdstop]',_0x37e2d5[_0xad6a('0x7')]),_0x37e2d5);if(!_[_0xad6a('0x21')](channels[_0x37e2d5['uniqueid']]['musiconholdstartAt'])){channels[_0x37e2d5['uniqueid']][_0xad6a('0x45')]+=utils[_0xad6a('0x36')](utils[_0xad6a('0x25')](),channels[_0x37e2d5[_0xad6a('0x7')]][_0xad6a('0x43')]);utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x46'),_0x37e2d5[_0xad6a('0x7')],channels[_0x37e2d5[_0xad6a('0x7')]][_0xad6a('0x45')]));delete channels[_0x37e2d5[_0xad6a('0x7')]][_0xad6a('0x43')];}}}catch(_0x1c063e){utils['error'](util[_0xad6a('0x15')](_0xad6a('0x47'),_0x37e2d5[_0xad6a('0x7')]),_0x1c063e);}};exports[_0xad6a('0x48')]=function(_0x450049){try{if(!_[_0xad6a('0x21')](channels[_0x450049[_0xad6a('0x7')]])){utils[_0xad6a('0x1f')](util[_0xad6a('0x15')](_0xad6a('0x49'),_0x450049[_0xad6a('0x7')]),_0x450049);if(!_['isNil'](_0x450049[_0xad6a('0x4a')]['xmd-originatecalleridnum'])){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x4b'),_0x450049[_0xad6a('0x7')],_0x450049[_0xad6a('0x4c')]));channels[_0x450049[_0xad6a('0x7')]][_0xad6a('0x4d')]=_0x450049['value'];}if(!_[_0xad6a('0x21')](_0x450049['variable'][_0xad6a('0x4e')])){utils[_0xad6a('0x19')](util[_0xad6a('0x15')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x450049[_0xad6a('0x7')],_0x450049[_0xad6a('0x4c')]));channels[_0x450049[_0xad6a('0x7')]]['destination']=_0x450049[_0xad6a('0x4c')];channels[_0x450049['uniqueid']][_0xad6a('0x2f')]='\x22'+_0x450049[_0xad6a('0x4c')]+_0xad6a('0x4f')+_0x450049[_0xad6a('0x4c')]+'>';}if(!_['isNil'](_0x450049['variable'][_0xad6a('0x50')])||!_[_0xad6a('0x21')](_0x450049[_0xad6a('0x4a')]['xmd-callerid'])){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x51'),_0x450049[_0xad6a('0x7')],!_['isNil'](_0x450049[_0xad6a('0x4a')]['xmd-callerid-preview'])?_0xad6a('0x50'):_0xad6a('0x52'),_0x450049[_0xad6a('0x4c')]));channels[_0x450049['uniqueid']][_0xad6a('0x2f')]=_0x450049['value'];}if(!_[_0xad6a('0x21')](_0x450049['variable']['xmd-queue'])||!_[_0xad6a('0x21')](_0x450049[_0xad6a('0x4a')][_0xad6a('0x53')])){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x51'),_0x450049[_0xad6a('0x7')],!_['isNil'](_0x450049[_0xad6a('0x4a')]['xmd-queue'])?'xmd-queue':_0xad6a('0x53'),_0x450049[_0xad6a('0x4c')]));channels[_0x450049['uniqueid']][_0xad6a('0x54')]='Queue';channels[_0x450049[_0xad6a('0x7')]][_0xad6a('0x55')]=_0x450049[_0xad6a('0x4c')];channels[_0x450049[_0xad6a('0x7')]][_0xad6a('0x9')]=!![];}if(!_[_0xad6a('0x21')](_0x450049[_0xad6a('0x4a')][_0xad6a('0x56')])){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x57'),_0x450049[_0xad6a('0x7')],_0x450049[_0xad6a('0x4c')]));channels[_0x450049[_0xad6a('0x7')]][_0xad6a('0x58')]=_0x450049[_0xad6a('0x4c')];}if(!_[_0xad6a('0x21')](_0x450049['variable'][_0xad6a('0x59')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x450049['uniqueid'],_0x450049[_0xad6a('0x4c')]));channels[_0x450049['uniqueid']][_0xad6a('0x5a')]=_0x450049['value'];}if(!_[_0xad6a('0x21')](_0x450049[_0xad6a('0x4a')][_0xad6a('0x5b')])){utils[_0xad6a('0x19')](util[_0xad6a('0x15')](_0xad6a('0x5c'),_0x450049['uniqueid'],_0x450049[_0xad6a('0x4c')]));channels[_0x450049['uniqueid']][_0xad6a('0x5d')]=_0x450049[_0xad6a('0x4c')];}if(!_[_0xad6a('0x21')](_0x450049[_0xad6a('0x4a')][_0xad6a('0x5e')])){utils['info'](util[_0xad6a('0x15')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x450049[_0xad6a('0x7')],_0x450049[_0xad6a('0x4c')]));channels[_0x450049[_0xad6a('0x7')]][_0xad6a('0x5e')]=_0x450049[_0xad6a('0x4c')];}}}catch(_0x465dd6){utils[_0xad6a('0x2d')](util['format']('[%s][calls][varset]',_0x450049['uniqueid']),_0x465dd6);}};exports['newexten']=function(_0xd09cf){try{if(!_[_0xad6a('0x21')](channels[_0xd09cf[_0xad6a('0x7')]])){utils['debug'](util['format'](_0xad6a('0x5f'),_0xd09cf['uniqueid']),_0xd09cf);utils['info'](util[_0xad6a('0x15')](_0xad6a('0x60'),_0xd09cf[_0xad6a('0x7')],_0xd09cf[_0xad6a('0x61')],_0xd09cf['appdata']));if(_0xd09cf[_0xad6a('0x61')][_0xad6a('0x62')]()==_0xad6a('0x63')&&_[_0xad6a('0x64')](_0xd09cf[_0xad6a('0x65')][_0xad6a('0x62')](),'cdr')){var _0xcda3af=_0xd09cf['appdata'][_0xad6a('0x66')]('=');var _0xe79256=_0xcda3af[0x0][_0xad6a('0x67')](_0xcda3af[0x0]['lastIndexOf']('(')+0x1,_0xcda3af[0x0][_0xad6a('0x68')](')'));var _0x2b3530=_0xcda3af[0x1];channels[_0xd09cf['uniqueid']][_0xe79256]=_0x2b3530;}if(!_[_0xad6a('0x69')]([_0xad6a('0x6a'),_0xad6a('0x6b'),_0xad6a('0x6c'),_0xad6a('0x63'),'gotoif'],_0xd09cf[_0xad6a('0x61')][_0xad6a('0x62')]())){channels[_0xd09cf['uniqueid']][_0xad6a('0x54')]=_0xd09cf['application'];channels[_0xd09cf[_0xad6a('0x7')]]['lastdata']=_0xd09cf[_0xad6a('0x65')];}}}catch(_0x3deb75){utils['error'](util[_0xad6a('0x15')]('[%s][calls][newexten]',_0xd09cf[_0xad6a('0x7')]),_0x3deb75);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a8dad9e..6551210 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 _0xec18=['managerevent','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close'];(function(_0x13df38,_0x24d840){var _0x55a541=function(_0x29c084){while(--_0x29c084){_0x13df38['push'](_0x13df38['shift']());}};_0x55a541(++_0x24d840);}(_0xec18,0x191));var _0x8ec1=function(_0x15165a,_0x3c7f98){_0x15165a=_0x15165a-0x0;var _0x30d744=_0xec18[_0x15165a];return _0x30d744;};'use strict';var utils=require('./utils');exports[_0x8ec1('0x0')]=function(){utils[_0x8ec1('0x1')]('[core]\x20connected');};exports['shutdown']=function(){utils['info'](_0x8ec1('0x2'));};exports[_0x8ec1('0x3')]=function(){utils[_0x8ec1('0x1')](_0x8ec1('0x4'));};exports[_0x8ec1('0x5')]=function(_0x3e8bb9){utils['error']('[core]\x20error',_0x3e8bb9);};exports[_0x8ec1('0x6')]=function(){utils['info']('[core]\x20close');};exports[_0x8ec1('0x7')]=function(_0x244576){}; \ No newline at end of file +var _0xe880=['./utils','connect','[core]\x20connected','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x4e0d9f,_0x16b2af){var _0x7509b2=function(_0x464ba3){while(--_0x464ba3){_0x4e0d9f['push'](_0x4e0d9f['shift']());}};_0x7509b2(++_0x16b2af);}(_0xe880,0x1d6));var _0x0e88=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe880[_0x122ef9];return _0x42fba0;};'use strict';var utils=require(_0x0e88('0x0'));exports[_0x0e88('0x1')]=function(){utils['info'](_0x0e88('0x2'));};exports['shutdown']=function(){utils['info']('[core]\x20shutdown');};exports[_0x0e88('0x3')]=function(){utils[_0x0e88('0x4')](_0x0e88('0x5'));};exports['error']=function(_0x47cea1){utils[_0x0e88('0x6')](_0x0e88('0x7'),_0x47cea1);};exports[_0x0e88('0x8')]=function(){utils[_0x0e88('0x4')](_0x0e88('0x9'));};exports['managerevent']=function(_0x5d5329){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ac07171..f5a558b 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 _0x7e9b=['outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','answertime','lodash','util','./utils','info','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','debug','isNil'];(function(_0x2cd7b4,_0xdb13fa){var _0x17db53=function(_0x4b1df2){while(--_0x4b1df2){_0x2cd7b4['push'](_0x2cd7b4['shift']());}};_0x17db53(++_0xdb13fa);}(_0x7e9b,0x73));var _0xb7e9=function(_0x45a82a,_0xb6ea08){_0x45a82a=_0x45a82a-0x0;var _0x875436=_0x7e9b[_0x45a82a];return _0x875436;};'use strict';var _=require(_0xb7e9('0x0'));var util=require(_0xb7e9('0x1'));var utils=require(_0xb7e9('0x2'));var dials={};function writeDB(_0x11c2e7){utils[_0xb7e9('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x11c2e7[_0xb7e9('0x4')],_0x11c2e7[_0xb7e9('0x5')],_0x11c2e7['dialstring'],_0x11c2e7[_0xb7e9('0x6')],_0x11c2e7['connectedlinenum'],_0x11c2e7[_0xb7e9('0x7')]));utils[_0xb7e9('0x8')](_0xb7e9('0x9'),_0x11c2e7);delete dials[_0x11c2e7[_0xb7e9('0x4')]];}exports['newexten']=function(_0x398b07){try{utils['debug'](util['format'](_0xb7e9('0xa'),_0x398b07[_0xb7e9('0x4')]),_0x398b07);utils[_0xb7e9('0x3')](util[_0xb7e9('0xb')](_0xb7e9('0xc'),_0x398b07[_0xb7e9('0x4')],_0x398b07[_0xb7e9('0xd')],_0x398b07[_0xb7e9('0xe')]));if(_0x398b07[_0xb7e9('0xd')][_0xb7e9('0xf')]()==_0xb7e9('0x10')&&_[_0xb7e9('0x11')](_0x398b07[_0xb7e9('0xe')][_0xb7e9('0xf')](),_0xb7e9('0x12'))){var _0x343daa=_0x398b07[_0xb7e9('0xe')][_0xb7e9('0x13')]('=');dials[_0x398b07[_0xb7e9('0x4')]]={'routeId':_0x343daa[0x1]};}}catch(_0x31a0a7){utils[_0xb7e9('0x14')](util[_0xb7e9('0xb')]('[%s][dials][newexten]',_0x398b07['uniqueid']),_0x31a0a7);}};exports['varset']=function(_0xe262b4){try{utils[_0xb7e9('0x15')](util[_0xb7e9('0xb')]('[%s][dials][varset]',_0xe262b4[_0xb7e9('0x4')]),_0xe262b4);if(!_[_0xb7e9('0x16')](_0xe262b4['variable'][_0xb7e9('0x17')])){utils[_0xb7e9('0x3')](util['format'](_0xb7e9('0x18'),_0xe262b4[_0xb7e9('0x4')],_0xe262b4[_0xb7e9('0x19')]));dials[_0xe262b4[_0xb7e9('0x4')]]={'routeId':_0xe262b4[_0xb7e9('0x19')]};}}catch(_0x34ef02){utils[_0xb7e9('0x14')](util[_0xb7e9('0xb')](_0xb7e9('0x1a'),_0xe262b4[_0xb7e9('0x4')]),_0x34ef02);}};exports[_0xb7e9('0x1b')]=function(_0x3878eb){try{if(!_[_0xb7e9('0x16')](dials[_0x3878eb[_0xb7e9('0x4')]])){utils[_0xb7e9('0x15')](util[_0xb7e9('0xb')]('[%s][dials][dialbegin]',_0x3878eb[_0xb7e9('0x4')]),_0x3878eb);dials[_0x3878eb['uniqueid']]=_[_0xb7e9('0x1c')](dials[_0x3878eb[_0xb7e9('0x4')]],_0x3878eb);dials[_0x3878eb[_0xb7e9('0x4')]][_0xb7e9('0x1d')]=utils[_0xb7e9('0x1e')]();dials[_0x3878eb[_0xb7e9('0x4')]]['lastevent']=_0xb7e9('0x1f');utils['info'](util[_0xb7e9('0xb')](_0xb7e9('0x20'),_0x3878eb[_0xb7e9('0x4')],dials[_0x3878eb[_0xb7e9('0x4')]][_0xb7e9('0x1d')]));}}catch(_0x287a47){utils[_0xb7e9('0x14')](util[_0xb7e9('0xb')]('[%s][dials][dialbegin]',_0x3878eb['uniqueid']),_0x287a47);}};exports['dialend']=function(_0x55b8d3){try{if(!_[_0xb7e9('0x16')](dials[_0x55b8d3[_0xb7e9('0x4')]])){utils[_0xb7e9('0x15')](util['format'](_0xb7e9('0x21'),_0x55b8d3[_0xb7e9('0x4')]),_0x55b8d3);dials[_0x55b8d3[_0xb7e9('0x4')]][_0xb7e9('0x7')]=_0x55b8d3[_0xb7e9('0x7')];if(_0x55b8d3[_0xb7e9('0x7')]==_0xb7e9('0x22')){dials[_0x55b8d3[_0xb7e9('0x4')]]=_['assign'](dials[_0x55b8d3[_0xb7e9('0x4')]],_0x55b8d3);dials[_0x55b8d3[_0xb7e9('0x4')]]['answertime']=utils[_0xb7e9('0x1e')]();dials[_0x55b8d3[_0xb7e9('0x4')]]['lastevent']='connect';utils[_0xb7e9('0x3')](util[_0xb7e9('0xb')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x55b8d3[_0xb7e9('0x4')],_0x55b8d3[_0xb7e9('0x7')],dials[_0x55b8d3['uniqueid']]['answertime']));}else{utils[_0xb7e9('0x3')](util['format'](_0xb7e9('0x23'),_0x55b8d3['uniqueid'],_0x55b8d3[_0xb7e9('0x7')]));}}}catch(_0x1f3e7c){utils[_0xb7e9('0x14')](util[_0xb7e9('0xb')]('[%s][dials][dialend]',_0x55b8d3['uniqueid']),_0x1f3e7c);}};exports[_0xb7e9('0x24')]=function(_0x2c9695){try{if(!_[_0xb7e9('0x16')](dials[_0x2c9695[_0xb7e9('0x4')]])){utils[_0xb7e9('0x15')](util[_0xb7e9('0xb')](_0xb7e9('0x25'),_0x2c9695[_0xb7e9('0x4')]),_0x2c9695);utils['info'](util['format'](_0xb7e9('0x26'),_0x2c9695['uniqueid'],_0x2c9695[_0xb7e9('0x6')],_0x2c9695[_0xb7e9('0x27')],_0x2c9695['cause-txt']));dials[_0x2c9695[_0xb7e9('0x4')]]=_[_0xb7e9('0x1c')](dials[_0x2c9695[_0xb7e9('0x4')]],{'endtime':utils['now'](),'lastevent':_0xb7e9('0x28')});dials[_0x2c9695[_0xb7e9('0x4')]][_0xb7e9('0x29')]=utils[_0xb7e9('0x2a')](dials[_0x2c9695[_0xb7e9('0x4')]][_0xb7e9('0x2b')],dials[_0x2c9695[_0xb7e9('0x4')]]['starttime']);dials[_0x2c9695['uniqueid']][_0xb7e9('0x2c')]=utils[_0xb7e9('0x2a')](dials[_0x2c9695[_0xb7e9('0x4')]][_0xb7e9('0x2d')]||dials[_0x2c9695[_0xb7e9('0x4')]][_0xb7e9('0x2b')],dials[_0x2c9695[_0xb7e9('0x4')]][_0xb7e9('0x1d')]);dials[_0x2c9695[_0xb7e9('0x4')]]['billableseconds']=dials[_0x2c9695[_0xb7e9('0x4')]][_0xb7e9('0x2d')]?utils['diffTime'](dials[_0x2c9695['uniqueid']][_0xb7e9('0x2b')],dials[_0x2c9695[_0xb7e9('0x4')]]['answertime']):0x0;writeDB(dials[_0x2c9695[_0xb7e9('0x4')]]);}}catch(_0x155787){utils[_0xb7e9('0x14')](util[_0xb7e9('0xb')](_0xb7e9('0x25'),_0x2c9695[_0xb7e9('0x4')]),_0x155787);}}; \ No newline at end of file +var _0x817b=['called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','assign','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','uniqueid','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','varset','debug','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent'];(function(_0x48fbac,_0xf85b17){var _0x5db70e=function(_0x72b0cb){while(--_0x72b0cb){_0x48fbac['push'](_0x48fbac['shift']());}};_0x5db70e(++_0xf85b17);}(_0x817b,0x13d));var _0xb817=function(_0x15a562,_0x205ef8){_0x15a562=_0x15a562-0x0;var _0x39af1b=_0x817b[_0x15a562];return _0x39af1b;};'use strict';var _=require('lodash');var util=require(_0xb817('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x245491){utils[_0xb817('0x1')](util['format'](_0xb817('0x2'),_0x245491['uniqueid'],_0x245491[_0xb817('0x3')],_0x245491[_0xb817('0x4')],_0x245491[_0xb817('0x5')],_0x245491[_0xb817('0x6')],_0x245491[_0xb817('0x7')]));utils[_0xb817('0x8')]('CreateVoiceDialReport',_0x245491);delete dials[_0x245491[_0xb817('0x9')]];}exports[_0xb817('0xa')]=function(_0x554733){try{utils['debug'](util[_0xb817('0xb')](_0xb817('0xc'),_0x554733[_0xb817('0x9')]),_0x554733);utils['info'](util[_0xb817('0xb')](_0xb817('0xd'),_0x554733['uniqueid'],_0x554733[_0xb817('0xe')],_0x554733[_0xb817('0xf')]));if(_0x554733['application'][_0xb817('0x10')]()=='set'&&_[_0xb817('0x11')](_0x554733['appdata']['toLowerCase'](),_0xb817('0x12'))){var _0x3261c2=_0x554733[_0xb817('0xf')][_0xb817('0x13')]('=');dials[_0x554733['uniqueid']]={'routeId':_0x3261c2[0x1]};}}catch(_0x36e31b){utils['error'](util[_0xb817('0xb')](_0xb817('0xc'),_0x554733[_0xb817('0x9')]),_0x36e31b);}};exports[_0xb817('0x14')]=function(_0x197808){try{utils[_0xb817('0x15')](util[_0xb817('0xb')](_0xb817('0x16'),_0x197808[_0xb817('0x9')]),_0x197808);if(!_[_0xb817('0x17')](_0x197808['variable'][_0xb817('0x18')])){utils[_0xb817('0x1')](util[_0xb817('0xb')](_0xb817('0x19'),_0x197808[_0xb817('0x9')],_0x197808['value']));dials[_0x197808[_0xb817('0x9')]]={'routeId':_0x197808[_0xb817('0x1a')]};}}catch(_0x3409dd){utils[_0xb817('0x1b')](util[_0xb817('0xb')](_0xb817('0x16'),_0x197808['uniqueid']),_0x3409dd);}};exports[_0xb817('0x1c')]=function(_0x473af6){try{if(!_[_0xb817('0x17')](dials[_0x473af6[_0xb817('0x9')]])){utils[_0xb817('0x15')](util[_0xb817('0xb')](_0xb817('0x1d'),_0x473af6[_0xb817('0x9')]),_0x473af6);dials[_0x473af6[_0xb817('0x9')]]=_['assign'](dials[_0x473af6[_0xb817('0x9')]],_0x473af6);dials[_0x473af6[_0xb817('0x9')]][_0xb817('0x1e')]=utils[_0xb817('0x1f')]();dials[_0x473af6[_0xb817('0x9')]][_0xb817('0x20')]=_0xb817('0x21');utils[_0xb817('0x1')](util['format'](_0xb817('0x22'),_0x473af6['uniqueid'],dials[_0x473af6[_0xb817('0x9')]][_0xb817('0x1e')]));}}catch(_0x2d424c){utils[_0xb817('0x1b')](util[_0xb817('0xb')]('[%s][dials][dialbegin]',_0x473af6[_0xb817('0x9')]),_0x2d424c);}};exports['dialend']=function(_0x298566){try{if(!_['isNil'](dials[_0x298566['uniqueid']])){utils[_0xb817('0x15')](util[_0xb817('0xb')](_0xb817('0x23'),_0x298566[_0xb817('0x9')]),_0x298566);dials[_0x298566[_0xb817('0x9')]][_0xb817('0x7')]=_0x298566[_0xb817('0x7')];if(_0x298566[_0xb817('0x7')]==_0xb817('0x24')){dials[_0x298566[_0xb817('0x9')]]=_[_0xb817('0x25')](dials[_0x298566[_0xb817('0x9')]],_0x298566);dials[_0x298566['uniqueid']]['answertime']=utils[_0xb817('0x1f')]();dials[_0x298566[_0xb817('0x9')]][_0xb817('0x20')]=_0xb817('0x26');utils[_0xb817('0x1')](util[_0xb817('0xb')](_0xb817('0x27'),_0x298566[_0xb817('0x9')],_0x298566[_0xb817('0x7')],dials[_0x298566['uniqueid']][_0xb817('0x28')]));}else{utils[_0xb817('0x1')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x298566[_0xb817('0x9')],_0x298566[_0xb817('0x7')]));}}}catch(_0x4eac86){utils[_0xb817('0x1b')](util['format'](_0xb817('0x23'),_0x298566['uniqueid']),_0x4eac86);}};exports[_0xb817('0x29')]=function(_0x3ca0b2){try{if(!_['isNil'](dials[_0x3ca0b2[_0xb817('0x9')]])){utils[_0xb817('0x15')](util['format']('[%s][dials][hangup]',_0x3ca0b2['uniqueid']),_0x3ca0b2);utils[_0xb817('0x1')](util[_0xb817('0xb')](_0xb817('0x2a'),_0x3ca0b2[_0xb817('0x9')],_0x3ca0b2[_0xb817('0x5')],_0x3ca0b2[_0xb817('0x2b')],_0x3ca0b2['cause-txt']));dials[_0x3ca0b2[_0xb817('0x9')]]=_['assign'](dials[_0x3ca0b2['uniqueid']],{'endtime':utils['now'](),'lastevent':_0xb817('0x2c')});dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x2d')]=utils[_0xb817('0x2e')](dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x2f')],dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x1e')]);dials[_0x3ca0b2['uniqueid']]['holdtime']=utils['diffTime'](dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x28')]||dials[_0x3ca0b2[_0xb817('0x9')]]['endtime'],dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x1e')]);dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x30')]=dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x28')]?utils[_0xb817('0x2e')](dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x2f')],dials[_0x3ca0b2[_0xb817('0x9')]][_0xb817('0x28')]):0x0;writeDB(dials[_0x3ca0b2[_0xb817('0x9')]]);}}catch(_0x5a104d){utils[_0xb817('0x1b')](util['format'](_0xb817('0x31'),_0x3ca0b2['uniqueid']),_0x5a104d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 69801f1..ec96c36 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 _0x8001=['uniqueid','agentcalled','agentringnoanswer','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','username','password','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','device','format','[%s][index][agentcalled]'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x8001,0x66));var _0x1800=function(_0x281ad0,_0x46a7c7){_0x281ad0=_0x281ad0-0x0;var _0x4e95b2=_0x8001[_0x281ad0];return _0x4e95b2;};var AsteriskManager=require(_0x1800('0x0'));var config=require(_0x1800('0x1'));var utils=require(_0x1800('0x2'));var util=require(_0x1800('0x3'));var ami=new AsteriskManager(config['asterisk']['port'],config[_0x1800('0x4')]['ip'],config['asterisk'][_0x1800('0x5')],config[_0x1800('0x4')][_0x1800('0x6')],!![]);ami[_0x1800('0x7')]();if(config[_0x1800('0x8')]&&config['xdr'][_0x1800('0x9')]){utils[_0x1800('0xa')]('XDR\x20DISABLED');}else{var agents=require(_0x1800('0xb'));var calls=require(_0x1800('0xc'));var queues=require(_0x1800('0xd'));var recordings=require(_0x1800('0xe'));var members=require(_0x1800('0xf'));var dials=require(_0x1800('0x10'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on']('connect',core[_0x1800('0x11')]);ami['on']('shutdown',core[_0x1800('0x12')]);ami['on'](_0x1800('0x13'),core['fullybooted']);ami['on'](_0x1800('0x14'),core[_0x1800('0x14')]);ami['on'](_0x1800('0x15'),core[_0x1800('0x15')]);ami['on']('managerevent',core[_0x1800('0x16')]);ami['on'](_0x1800('0x17'),function(_0x46b128){try{utils[_0x1800('0x18')](util['format']('[%s][index][devicestatechange]',_0x46b128[_0x1800('0x19')]),_0x46b128);members[_0x1800('0x17')](_0x46b128);}catch(_0x14b9be){utils[_0x1800('0x14')](util[_0x1800('0x1a')]('[%s][index][devicestatechange]',_0x46b128[_0x1800('0x19')]),_0x14b9be);}});ami['on']('agentcalled',function(_0x75c7e2){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')](_0x1800('0x1b'),_0x75c7e2[_0x1800('0x1c')]),_0x75c7e2);agents[_0x1800('0x1d')](_0x75c7e2);}catch(_0xc67118){utils[_0x1800('0x14')](util[_0x1800('0x1a')]('[%s][index][agentcalled]',_0x75c7e2[_0x1800('0x1c')]),_0xc67118);}});ami['on'](_0x1800('0x1e'),function(_0x2577e4){try{utils[_0x1800('0x18')](util['format']('[%s][index][agentringnoanswer]',_0x2577e4[_0x1800('0x1c')]),_0x2577e4);agents[_0x1800('0x1e')](_0x2577e4);}catch(_0xea4c2d){utils[_0x1800('0x14')](util[_0x1800('0x1a')]('[%s][index][agentringnoanswer]',_0x2577e4[_0x1800('0x1c')]),_0xea4c2d);}});ami['on'](_0x1800('0x1f'),function(_0x2638de){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')]('[%s][index][agentconnect]',_0x2638de['uniqueid']),_0x2638de);agents[_0x1800('0x1f')](_0x2638de);queues[_0x1800('0x1f')](_0x2638de);}catch(_0x12b029){utils[_0x1800('0x14')](util[_0x1800('0x1a')]('[%s][index][agentconnect]',_0x2638de[_0x1800('0x1c')]),_0x12b029);}});ami['on'](_0x1800('0x20'),function(_0x2f135b){try{utils[_0x1800('0x18')](util['format'](_0x1800('0x21'),_0x2f135b[_0x1800('0x1c')]),_0x2f135b);agents[_0x1800('0x20')](_0x2f135b);queues[_0x1800('0x20')](_0x2f135b);members[_0x1800('0x20')](_0x2f135b);}catch(_0x294cc1){utils[_0x1800('0x14')](util['format'](_0x1800('0x21'),_0x2f135b[_0x1800('0x1c')]),_0x294cc1);}});ami['on'](_0x1800('0x22'),function(_0x378a39){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')](_0x1800('0x23'),_0x378a39['uniqueid']),_0x378a39);agents[_0x1800('0x22')](_0x378a39);queues[_0x1800('0x22')](_0x378a39);}catch(_0x22c623){utils[_0x1800('0x14')](util[_0x1800('0x1a')](_0x1800('0x23'),_0x378a39[_0x1800('0x1c')]),_0x22c623);}});ami['on'](_0x1800('0x24'),function(_0x21ef3d){try{utils[_0x1800('0x18')](util['format'](_0x1800('0x25'),_0x21ef3d[_0x1800('0x1c')]),_0x21ef3d);queues[_0x1800('0x24')](_0x21ef3d);recordings[_0x1800('0x24')](_0x21ef3d);}catch(_0x4b0fbe){utils[_0x1800('0x14')](util[_0x1800('0x1a')](_0x1800('0x25'),_0x21ef3d[_0x1800('0x1c')]),_0x4b0fbe);}});ami['on'](_0x1800('0x26'),function(_0x1a489a){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')](_0x1800('0x27'),_0x1a489a[_0x1800('0x1c')]),_0x1a489a);queues[_0x1800('0x26')](_0x1a489a);}catch(_0x1b84f4){utils[_0x1800('0x14')](util[_0x1800('0x1a')](_0x1800('0x27'),_0x1a489a[_0x1800('0x1c')]),_0x1b84f4);}});ami['on']('musiconholdstart',function(_0x1d2088){try{utils[_0x1800('0x18')](util['format']('[%s][index][musiconholdstart]',_0x1d2088['uniqueid']),_0x1d2088);queues[_0x1800('0x28')](_0x1d2088);calls[_0x1800('0x28')](_0x1d2088);}catch(_0x2a8441){utils[_0x1800('0x14')](util[_0x1800('0x1a')](_0x1800('0x29'),_0x1d2088[_0x1800('0x1c')]),_0x2a8441);}});ami['on'](_0x1800('0x2a'),function(_0x1ac633){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')]('[%s][index][musiconholdstop]',_0x1ac633[_0x1800('0x1c')]),_0x1ac633);queues[_0x1800('0x2a')](_0x1ac633);calls[_0x1800('0x2a')](_0x1ac633);}catch(_0x5e53fd){utils[_0x1800('0x14')](util[_0x1800('0x1a')](_0x1800('0x2b'),_0x1ac633['uniqueid']),_0x5e53fd);}});ami['on']('newstate',function(_0x32af6d){try{utils['debug'](util[_0x1800('0x1a')](_0x1800('0x2c'),_0x32af6d[_0x1800('0x1c')]),_0x32af6d);calls[_0x1800('0x2d')](_0x32af6d);recordings['newstate'](_0x32af6d);}catch(_0x386351){utils[_0x1800('0x14')](util['format'](_0x1800('0x2c'),_0x32af6d[_0x1800('0x1c')]),_0x386351);}});ami['on']('hangup',function(_0x29d60c){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')](_0x1800('0x2e'),_0x29d60c['uniqueid']),_0x29d60c);calls[_0x1800('0x2f')](_0x29d60c);recordings[_0x1800('0x2f')](_0x29d60c);dials['hangup'](_0x29d60c);agents[_0x1800('0x2f')](_0x29d60c);queues[_0x1800('0x2f')](_0x29d60c);}catch(_0x3fdf7f){utils['error'](util['format']('[%s][index][hangup]',_0x29d60c[_0x1800('0x1c')]),_0x3fdf7f);}});ami['on'](_0x1800('0x30'),function(_0x9cd033){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')](_0x1800('0x31'),_0x9cd033['uniqueid']),_0x9cd033);members[_0x1800('0x30')](_0x9cd033);}catch(_0x2571d9){utils[_0x1800('0x14')](util[_0x1800('0x1a')]('[%s][index][cdr]',_0x9cd033[_0x1800('0x1c')]),_0x2571d9);}});ami['on'](_0x1800('0x32'),function(_0x100e84){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')](_0x1800('0x33'),_0x100e84['uniqueid']),_0x100e84);queues['blindtransfer'](_0x100e84);agents[_0x1800('0x32')](_0x100e84);transfers[_0x1800('0x32')](_0x100e84);}catch(_0x280f3f){utils[_0x1800('0x14')](util[_0x1800('0x1a')]('[%s][index][blindtransfer]',_0x100e84[_0x1800('0x1c')]),_0x280f3f);}});ami['on']('attendedtransfer',function(_0x33a331){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')](_0x1800('0x34'),_0x33a331[_0x1800('0x35')]),_0x33a331);queues[_0x1800('0x36')](_0x33a331);transfers[_0x1800('0x36')](_0x33a331);agents[_0x1800('0x36')](_0x33a331);calls['attendedtransfer'](_0x33a331);}catch(_0xabf9c5){utils[_0x1800('0x14')](util[_0x1800('0x1a')](_0x1800('0x34'),_0x33a331['origtransfereruniqueid']),_0xabf9c5);}});ami['on']('varset',function(_0x22f271){try{utils['debug'](util[_0x1800('0x1a')]('[%s][index][varset]',_0x22f271['uniqueid']),_0x22f271);queues[_0x1800('0x37')](_0x22f271);recordings[_0x1800('0x37')](_0x22f271);calls[_0x1800('0x37')](_0x22f271);dials[_0x1800('0x37')](_0x22f271);}catch(_0x163fb7){utils[_0x1800('0x14')](util[_0x1800('0x1a')]('[%s][index][varset]',_0x22f271[_0x1800('0x1c')]),_0x163fb7);}});ami['on'](_0x1800('0x38'),function(_0x106fd5){try{utils[_0x1800('0x18')](util['format'](_0x1800('0x39'),_0x106fd5[_0x1800('0x1c')]),_0x106fd5);calls[_0x1800('0x38')](_0x106fd5);recordings['newexten'](_0x106fd5);dials['newexten'](_0x106fd5);}catch(_0x50a1bc){utils['error'](util[_0x1800('0x1a')](_0x1800('0x39'),_0x106fd5[_0x1800('0x1c')]),_0x50a1bc);}});ami['on'](_0x1800('0x3a'),function(_0x3986f9){try{utils[_0x1800('0x18')](util[_0x1800('0x1a')](_0x1800('0x3b'),_0x3986f9[_0x1800('0x1c')]),_0x3986f9);calls[_0x1800('0x3a')](_0x3986f9);recordings[_0x1800('0x3a')](_0x3986f9);}catch(_0x196fba){utils['error'](util['format'](_0x1800('0x3b'),_0x3986f9['uniqueid']),_0x196fba);}});ami['on'](_0x1800('0x3c'),function(_0xb4c6aa){try{utils['debug'](util[_0x1800('0x1a')](_0x1800('0x3d'),_0xb4c6aa[_0x1800('0x1c')]),_0xb4c6aa);dials[_0x1800('0x3c')](_0xb4c6aa);}catch(_0x2bb8cd){utils['error'](util['format'](_0x1800('0x3e'),_0xb4c6aa[_0x1800('0x1c')]),_0x2bb8cd);}});ami['on'](_0x1800('0x3f'),function(_0x4260c3){try{utils['debug'](util[_0x1800('0x1a')](_0x1800('0x40'),_0x4260c3[_0x1800('0x1c')]),_0x4260c3);dials['dialend'](_0x4260c3);}catch(_0x3bfe67){utils['error'](util[_0x1800('0x1a')](_0x1800('0x40'),_0x4260c3[_0x1800('0x1c')]),_0x3bfe67);}});} \ No newline at end of file +var _0x7b91=['shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','port','username','password','keepConnected','xdr','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7b91,0xfa));var _0x17b9=function(_0x2bfdde,_0x5dd690){_0x2bfdde=_0x2bfdde-0x0;var _0x70d8eb=_0x7b91[_0x2bfdde];return _0x70d8eb;};var AsteriskManager=require(_0x17b9('0x0'));var config=require(_0x17b9('0x1'));var utils=require(_0x17b9('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0x17b9('0x3')][_0x17b9('0x4')],config[_0x17b9('0x3')]['ip'],config[_0x17b9('0x3')][_0x17b9('0x5')],config[_0x17b9('0x3')][_0x17b9('0x6')],!![]);ami[_0x17b9('0x7')]();if(config[_0x17b9('0x8')]&&config[_0x17b9('0x8')]['disabled']){utils['info'](_0x17b9('0x9'));}else{var agents=require(_0x17b9('0xa'));var calls=require(_0x17b9('0xb'));var queues=require('./queues.controller');var recordings=require(_0x17b9('0xc'));var members=require(_0x17b9('0xd'));var dials=require(_0x17b9('0xe'));var transfers=require(_0x17b9('0xf'));var core=require(_0x17b9('0x10'));ami['on'](_0x17b9('0x11'),core['connect']);ami['on'](_0x17b9('0x12'),core['shutdown']);ami['on'](_0x17b9('0x13'),core[_0x17b9('0x13')]);ami['on'](_0x17b9('0x14'),core[_0x17b9('0x14')]);ami['on'](_0x17b9('0x15'),core[_0x17b9('0x15')]);ami['on'](_0x17b9('0x16'),core['managerevent']);ami['on'](_0x17b9('0x17'),function(_0x259331){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')]('[%s][index][devicestatechange]',_0x259331[_0x17b9('0x1a')]),_0x259331);members[_0x17b9('0x17')](_0x259331);}catch(_0x5cca1a){utils[_0x17b9('0x14')](util['format'](_0x17b9('0x1b'),_0x259331[_0x17b9('0x1a')]),_0x5cca1a);}});ami['on'](_0x17b9('0x1c'),function(_0x527d5e){try{utils[_0x17b9('0x18')](util['format'](_0x17b9('0x1d'),_0x527d5e['uniqueid']),_0x527d5e);agents[_0x17b9('0x1c')](_0x527d5e);}catch(_0x49da8e){utils[_0x17b9('0x14')](util[_0x17b9('0x19')]('[%s][index][agentcalled]',_0x527d5e[_0x17b9('0x1e')]),_0x49da8e);}});ami['on'](_0x17b9('0x1f'),function(_0x517eca){try{utils[_0x17b9('0x18')](util['format'](_0x17b9('0x20'),_0x517eca[_0x17b9('0x1e')]),_0x517eca);agents['agentringnoanswer'](_0x517eca);}catch(_0x21e04c){utils[_0x17b9('0x14')](util[_0x17b9('0x19')]('[%s][index][agentringnoanswer]',_0x517eca['uniqueid']),_0x21e04c);}});ami['on'](_0x17b9('0x21'),function(_0x160238){try{utils['debug'](util[_0x17b9('0x19')](_0x17b9('0x22'),_0x160238[_0x17b9('0x1e')]),_0x160238);agents[_0x17b9('0x21')](_0x160238);queues[_0x17b9('0x21')](_0x160238);}catch(_0x22b3b1){utils[_0x17b9('0x14')](util[_0x17b9('0x19')]('[%s][index][agentconnect]',_0x160238[_0x17b9('0x1e')]),_0x22b3b1);}});ami['on']('agentcomplete',function(_0x4863ee){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')](_0x17b9('0x23'),_0x4863ee[_0x17b9('0x1e')]),_0x4863ee);agents[_0x17b9('0x24')](_0x4863ee);queues['agentcomplete'](_0x4863ee);members[_0x17b9('0x24')](_0x4863ee);}catch(_0x888e76){utils['error'](util[_0x17b9('0x19')](_0x17b9('0x23'),_0x4863ee[_0x17b9('0x1e')]),_0x888e76);}});ami['on'](_0x17b9('0x25'),function(_0x4a8c77){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')](_0x17b9('0x26'),_0x4a8c77[_0x17b9('0x1e')]),_0x4a8c77);agents[_0x17b9('0x25')](_0x4a8c77);queues['queuecallerabandon'](_0x4a8c77);}catch(_0x1246f2){utils['error'](util[_0x17b9('0x19')](_0x17b9('0x26'),_0x4a8c77['uniqueid']),_0x1246f2);}});ami['on'](_0x17b9('0x27'),function(_0x5d4404){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')](_0x17b9('0x28'),_0x5d4404['uniqueid']),_0x5d4404);queues[_0x17b9('0x27')](_0x5d4404);recordings[_0x17b9('0x27')](_0x5d4404);}catch(_0x2a3cc6){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x28'),_0x5d4404[_0x17b9('0x1e')]),_0x2a3cc6);}});ami['on'](_0x17b9('0x29'),function(_0xa7ec45){try{utils[_0x17b9('0x18')](util['format'](_0x17b9('0x2a'),_0xa7ec45[_0x17b9('0x1e')]),_0xa7ec45);queues['queuecallerleave'](_0xa7ec45);}catch(_0x46efed){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x2a'),_0xa7ec45[_0x17b9('0x1e')]),_0x46efed);}});ami['on'](_0x17b9('0x2b'),function(_0xc28f62){try{utils['debug'](util[_0x17b9('0x19')]('[%s][index][musiconholdstart]',_0xc28f62['uniqueid']),_0xc28f62);queues['musiconholdstart'](_0xc28f62);calls[_0x17b9('0x2b')](_0xc28f62);}catch(_0x40551d){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x2c'),_0xc28f62[_0x17b9('0x1e')]),_0x40551d);}});ami['on']('musiconholdstop',function(_0x4af5ba){try{utils['debug'](util[_0x17b9('0x19')](_0x17b9('0x2d'),_0x4af5ba[_0x17b9('0x1e')]),_0x4af5ba);queues[_0x17b9('0x2e')](_0x4af5ba);calls[_0x17b9('0x2e')](_0x4af5ba);}catch(_0x550094){utils['error'](util[_0x17b9('0x19')](_0x17b9('0x2d'),_0x4af5ba[_0x17b9('0x1e')]),_0x550094);}});ami['on'](_0x17b9('0x2f'),function(_0x2ed363){try{utils['debug'](util[_0x17b9('0x19')](_0x17b9('0x30'),_0x2ed363['uniqueid']),_0x2ed363);calls['newstate'](_0x2ed363);recordings[_0x17b9('0x2f')](_0x2ed363);}catch(_0x4a011c){utils[_0x17b9('0x14')](util[_0x17b9('0x19')]('[%s][index][newstate]',_0x2ed363['uniqueid']),_0x4a011c);}});ami['on'](_0x17b9('0x31'),function(_0x52b274){try{utils['debug'](util[_0x17b9('0x19')]('[%s][index][hangup]',_0x52b274[_0x17b9('0x1e')]),_0x52b274);calls['hangup'](_0x52b274);recordings[_0x17b9('0x31')](_0x52b274);dials[_0x17b9('0x31')](_0x52b274);agents[_0x17b9('0x31')](_0x52b274);queues['hangup'](_0x52b274);}catch(_0x5e57f5){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x32'),_0x52b274[_0x17b9('0x1e')]),_0x5e57f5);}});ami['on'](_0x17b9('0x33'),function(_0x10e2bd){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')](_0x17b9('0x34'),_0x10e2bd[_0x17b9('0x1e')]),_0x10e2bd);members[_0x17b9('0x33')](_0x10e2bd);}catch(_0x4fe250){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x34'),_0x10e2bd[_0x17b9('0x1e')]),_0x4fe250);}});ami['on'](_0x17b9('0x35'),function(_0x1e88da){try{utils[_0x17b9('0x18')](util['format'](_0x17b9('0x36'),_0x1e88da[_0x17b9('0x1e')]),_0x1e88da);queues[_0x17b9('0x35')](_0x1e88da);agents[_0x17b9('0x35')](_0x1e88da);transfers[_0x17b9('0x35')](_0x1e88da);}catch(_0x381648){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x36'),_0x1e88da[_0x17b9('0x1e')]),_0x381648);}});ami['on']('attendedtransfer',function(_0xf9bfbc){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')](_0x17b9('0x37'),_0xf9bfbc[_0x17b9('0x38')]),_0xf9bfbc);queues[_0x17b9('0x39')](_0xf9bfbc);transfers[_0x17b9('0x39')](_0xf9bfbc);agents[_0x17b9('0x39')](_0xf9bfbc);calls[_0x17b9('0x39')](_0xf9bfbc);}catch(_0x3180fd){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x37'),_0xf9bfbc[_0x17b9('0x38')]),_0x3180fd);}});ami['on'](_0x17b9('0x3a'),function(_0x1f6eae){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')](_0x17b9('0x3b'),_0x1f6eae['uniqueid']),_0x1f6eae);queues['varset'](_0x1f6eae);recordings[_0x17b9('0x3a')](_0x1f6eae);calls[_0x17b9('0x3a')](_0x1f6eae);dials[_0x17b9('0x3a')](_0x1f6eae);}catch(_0x10858a){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x3b'),_0x1f6eae[_0x17b9('0x1e')]),_0x10858a);}});ami['on'](_0x17b9('0x3c'),function(_0x2bbb7e){try{utils[_0x17b9('0x18')](util['format']('[%s][index][newexten]',_0x2bbb7e[_0x17b9('0x1e')]),_0x2bbb7e);calls['newexten'](_0x2bbb7e);recordings['newexten'](_0x2bbb7e);dials[_0x17b9('0x3c')](_0x2bbb7e);}catch(_0x1315a4){utils['error'](util[_0x17b9('0x19')]('[%s][index][newexten]',_0x2bbb7e[_0x17b9('0x1e')]),_0x1315a4);}});ami['on']('newchannel',function(_0x5474b1){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')]('[%s][index][newchannel]',_0x5474b1[_0x17b9('0x1e')]),_0x5474b1);calls[_0x17b9('0x3d')](_0x5474b1);recordings[_0x17b9('0x3d')](_0x5474b1);}catch(_0x28a848){utils[_0x17b9('0x14')](util[_0x17b9('0x19')](_0x17b9('0x3e'),_0x5474b1['uniqueid']),_0x28a848);}});ami['on'](_0x17b9('0x3f'),function(_0xa27b2d){try{utils[_0x17b9('0x18')](util[_0x17b9('0x19')](_0x17b9('0x40'),_0xa27b2d['uniqueid']),_0xa27b2d);dials[_0x17b9('0x3f')](_0xa27b2d);}catch(_0x6d5afb){utils[_0x17b9('0x14')](util['format']('[%s]dialbegin',_0xa27b2d[_0x17b9('0x1e')]),_0x6d5afb);}});ami['on'](_0x17b9('0x41'),function(_0x22bbb0){try{utils[_0x17b9('0x18')](util['format'](_0x17b9('0x42'),_0x22bbb0['uniqueid']),_0x22bbb0);dials[_0x17b9('0x41')](_0x22bbb0);}catch(_0x56f7ae){utils[_0x17b9('0x14')](util['format'](_0x17b9('0x42'),_0x22bbb0[_0x17b9('0x1e')]),_0x56f7ae);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4c57233..e1d774a 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 _0xccef=['[%s][members][devicestatechange]','agentcomplete','queue','assign','cdr','[%s][members][cdr]','isNil','data1','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','membername','type','getUserByInterface','name','internal','CreateMemberReport','split','request','catch','error','some','devicestatechange','debug','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','enterAt'];(function(_0x48c600,_0x275103){var _0x26b913=function(_0x2932de){while(--_0x2932de){_0x48c600['push'](_0x48c600['shift']());}};_0x26b913(++_0x275103);}(_0xccef,0x1ee));var _0xfcce=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xccef[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var utils=require('./utils');var members={};var exclude=[_0xfcce('0x1'),_0xfcce('0x2')];function writeDB(_0x4a8b8b){utils[_0xfcce('0x3')](util[_0xfcce('0x4')](_0xfcce('0x5'),_0x4a8b8b['uniqueid'],_0x4a8b8b[_0xfcce('0x6')],_0x4a8b8b[_0xfcce('0x7')],_0x4a8b8b['data2'],_0x4a8b8b[_0xfcce('0x8')],_0x4a8b8b[_0xfcce('0x9')]));if(_0x4a8b8b['interface']){utils[_0xfcce('0xa')](_0x4a8b8b[_0xfcce('0x6')])['then'](function(_0x5ec4b1){if(_0x5ec4b1){_0x4a8b8b[_0xfcce('0x8')]=_0x5ec4b1[_0xfcce('0xb')];_0x4a8b8b[_0xfcce('0xc')]=_0x5ec4b1[_0xfcce('0xc')];utils['request'](_0xfcce('0xd'),_0x4a8b8b);}else{utils['getUserByName'](_0x4a8b8b[_0xfcce('0x6')][_0xfcce('0xe')]('/')[0x1])['then'](function(_0x14c8f1){if(_0x14c8f1){_0x4a8b8b['membername']=_0x14c8f1[_0xfcce('0xb')];_0x4a8b8b[_0xfcce('0xc')]=_0x14c8f1[_0xfcce('0xc')];utils[_0xfcce('0xf')]('CreateMemberReport',_0x4a8b8b);}});}})[_0xfcce('0x10')](function(_0x2281ad){utils[_0xfcce('0x11')](util[_0xfcce('0x4')]('[%s][members][writeDB]',_0x4a8b8b['uniqueid']),_0x2281ad);});}delete members[_0x4a8b8b[_0xfcce('0x6')]];}function startsWith(_0x12ed33,_0x4c5f3d){return _[_0xfcce('0x12')](_0x12ed33,function(_0x368621){return _['startsWith'](_0x4c5f3d,_0x368621);});}exports[_0xfcce('0x13')]=function(_0x5b7b9b){try{utils[_0xfcce('0x14')](util[_0xfcce('0x4')]('[%s][members][devicestatechange]',members[_0x5b7b9b[_0xfcce('0x15')]]?members[_0x5b7b9b[_0xfcce('0x15')]][_0xfcce('0x16')]:_0x5b7b9b[_0xfcce('0x15')]),_0x5b7b9b);utils[_0xfcce('0x3')](util['format'](_0xfcce('0x17'),members[_0x5b7b9b[_0xfcce('0x15')]]?members[_0x5b7b9b[_0xfcce('0x15')]][_0xfcce('0x16')]:_0x5b7b9b[_0xfcce('0x15')],_0x5b7b9b[_0xfcce('0x18')],_0x5b7b9b[_0xfcce('0x15')]));switch(_0x5b7b9b[_0xfcce('0x18')]){case'INUSE':case _0xfcce('0x19'):if(!startsWith(exclude,_0x5b7b9b[_0xfcce('0x15')])){members[_0x5b7b9b[_0xfcce('0x15')]]={'channel':_0xfcce('0x1a'),'interface':_0x5b7b9b[_0xfcce('0x15')],'type':_0xfcce('0x1b'),'enterAt':utils[_0xfcce('0x1c')](),'role':_0xfcce('0x1d')};}break;case _0xfcce('0x1e'):if(!_['isNil'](members[_0x5b7b9b['device']])){members[_0x5b7b9b[_0xfcce('0x15')]][_0xfcce('0x1f')]=utils[_0xfcce('0x1c')]();members[_0x5b7b9b['device']][_0xfcce('0x20')]=utils['diffTime'](members[_0x5b7b9b[_0xfcce('0x15')]][_0xfcce('0x1f')],members[_0x5b7b9b[_0xfcce('0x15')]][_0xfcce('0x21')]);if(members[_0x5b7b9b['device']][_0xfcce('0x16')]){writeDB(members[_0x5b7b9b[_0xfcce('0x15')]]);}}break;default:break;}}catch(_0x477fde){utils[_0xfcce('0x11')](util['format'](_0xfcce('0x22'),members[_0x5b7b9b['device']]?members[_0x5b7b9b[_0xfcce('0x15')]][_0xfcce('0x16')]:_0x5b7b9b[_0xfcce('0x15')]),_0x477fde);}};exports[_0xfcce('0x23')]=function(_0xa720a3){try{if(!_['isNil'](members[_0xa720a3[_0xfcce('0x6')]])){utils[_0xfcce('0x14')](util[_0xfcce('0x4')]('[%s][members][agentcomplete]',_0xa720a3[_0xfcce('0x16')]),_0xa720a3);utils[_0xfcce('0x3')](util[_0xfcce('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0xa720a3['uniqueid'],_0xa720a3[_0xfcce('0x6')],_0xa720a3[_0xfcce('0x24')]));members[_0xa720a3[_0xfcce('0x6')]]=_[_0xfcce('0x25')](members[_0xa720a3[_0xfcce('0x6')]],{'data4':_0xa720a3[_0xfcce('0x24')],'uniqueid':_0xa720a3[_0xfcce('0x16')]});}}catch(_0x4974ab){utils[_0xfcce('0x11')](util[_0xfcce('0x4')]('[%s][members][agentcomplete]',_0xa720a3[_0xfcce('0x16')]),_0x4974ab);}};exports[_0xfcce('0x26')]=function(_0x999fab){try{utils['debug'](util[_0xfcce('0x4')](_0xfcce('0x27'),_0x999fab['uniqueid']),_0x999fab);if(_0x999fab[_0xfcce('0x7')]){var _0xd981e2=_0x999fab[_0xfcce('0x7')][_0xfcce('0xe')]('-')[0x0];if(!_[_0xfcce('0x28')](members[_0xd981e2])){members[_0xd981e2]=_[_0xfcce('0x25')](members[_0xd981e2],{'data1':members[_0xd981e2][_0xfcce('0x29')]||_0x999fab[_0xfcce('0x9')],'data2':members[_0xd981e2][_0xfcce('0x2a')]||_0x999fab['source'],'data3':members[_0xd981e2][_0xfcce('0x2b')]||_0x999fab[_0xfcce('0x2c')],'uniqueid':members[_0xd981e2]['uniqueid']||_0x999fab[_0xfcce('0x16')]});utils[_0xfcce('0x3')](util[_0xfcce('0x4')](_0xfcce('0x2d'),_0x999fab['uniqueid'],members[_0xd981e2][_0xfcce('0x29')],members[_0xd981e2]['data2'],members[_0xd981e2][_0xfcce('0x2b')]));if(members[_0xd981e2][_0xfcce('0x1f')]){writeDB(members[_0xd981e2]);}}}if(_0x999fab[_0xfcce('0x2e')]){var _0x7a9f78=_0x999fab[_0xfcce('0x2e')][_0xfcce('0xe')]('-')[0x0];if(!_['isNil'](members[_0x7a9f78])){members[_0x7a9f78]=_['assign'](members[_0x7a9f78],{'data1':members[_0x7a9f78][_0xfcce('0x29')]||_0x999fab['type'],'data2':members[_0x7a9f78][_0xfcce('0x2a')]||_0x999fab[_0xfcce('0x2f')],'data3':members[_0x7a9f78]['data3']||_0x999fab['destination'],'uniqueid':members[_0x7a9f78][_0xfcce('0x16')]||_0x999fab['uniqueid']});utils['info'](util[_0xfcce('0x4')](_0xfcce('0x2d'),_0x999fab[_0xfcce('0x16')],members[_0x7a9f78][_0xfcce('0x29')],members[_0x7a9f78]['data2'],members[_0x7a9f78][_0xfcce('0x2b')]));if(members[_0x7a9f78][_0xfcce('0x1f')]){writeDB(members[_0x7a9f78]);}}}}catch(_0x58e127){utils['error'](util[_0xfcce('0x4')]('[%s][members][cdr]',_0x999fab[_0xfcce('0x16')]),_0x58e127);}}; \ No newline at end of file +var _0x331c=['membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','format','[%s][members][writeDB]','some','devicestatechange','[%s][members][devicestatechange]','device','uniqueid','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','TALKING','agent','now','duration','diffTime','exitAt','error','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','./utils','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel'];(function(_0x3a1844,_0x2d0387){var _0x38440c=function(_0xe9d295){while(--_0xe9d295){_0x3a1844['push'](_0x3a1844['shift']());}};_0x38440c(++_0x2d0387);}(_0x331c,0xf0));var _0xc331=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x331c[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xc331('0x0'));var util=require('util');var utils=require(_0xc331('0x1'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x15f272){utils['info'](util['format'](_0xc331('0x2'),_0x15f272['uniqueid'],_0x15f272[_0xc331('0x3')],_0x15f272[_0xc331('0x4')],_0x15f272['data2'],_0x15f272[_0xc331('0x5')],_0x15f272[_0xc331('0x6')]));if(_0x15f272['interface']){utils[_0xc331('0x7')](_0x15f272[_0xc331('0x3')])[_0xc331('0x8')](function(_0x336c30){if(_0x336c30){_0x15f272['membername']=_0x336c30[_0xc331('0x9')];_0x15f272['internal']=_0x336c30[_0xc331('0xa')];utils[_0xc331('0xb')](_0xc331('0xc'),_0x15f272);}else{utils[_0xc331('0xd')](_0x15f272[_0xc331('0x3')][_0xc331('0xe')]('/')[0x1])[_0xc331('0x8')](function(_0x25ac6e){if(_0x25ac6e){_0x15f272[_0xc331('0x5')]=_0x25ac6e['name'];_0x15f272[_0xc331('0xa')]=_0x25ac6e[_0xc331('0xa')];utils[_0xc331('0xb')](_0xc331('0xc'),_0x15f272);}});}})[_0xc331('0xf')](function(_0x149caf){utils['error'](util[_0xc331('0x10')](_0xc331('0x11'),_0x15f272['uniqueid']),_0x149caf);});}delete members[_0x15f272[_0xc331('0x3')]];}function startsWith(_0x47639c,_0x297418){return _[_0xc331('0x12')](_0x47639c,function(_0x5265b5){return _['startsWith'](_0x297418,_0x5265b5);});}exports[_0xc331('0x13')]=function(_0x18e6df){try{utils['debug'](util[_0xc331('0x10')](_0xc331('0x14'),members[_0x18e6df['device']]?members[_0x18e6df[_0xc331('0x15')]][_0xc331('0x16')]:_0x18e6df['device']),_0x18e6df);utils[_0xc331('0x17')](util[_0xc331('0x10')](_0xc331('0x18'),members[_0x18e6df[_0xc331('0x15')]]?members[_0x18e6df[_0xc331('0x15')]]['uniqueid']:_0x18e6df[_0xc331('0x15')],_0x18e6df['state'],_0x18e6df[_0xc331('0x15')]));switch(_0x18e6df[_0xc331('0x19')]){case'INUSE':case _0xc331('0x1a'):if(!startsWith(exclude,_0x18e6df[_0xc331('0x15')])){members[_0x18e6df[_0xc331('0x15')]]={'channel':'voice','interface':_0x18e6df[_0xc331('0x15')],'type':_0xc331('0x1b'),'enterAt':utils['now'](),'role':_0xc331('0x1c')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x18e6df['device']])){members[_0x18e6df[_0xc331('0x15')]]['exitAt']=utils[_0xc331('0x1d')]();members[_0x18e6df[_0xc331('0x15')]][_0xc331('0x1e')]=utils[_0xc331('0x1f')](members[_0x18e6df['device']][_0xc331('0x20')],members[_0x18e6df['device']]['enterAt']);if(members[_0x18e6df['device']][_0xc331('0x16')]){writeDB(members[_0x18e6df[_0xc331('0x15')]]);}}break;default:break;}}catch(_0x38c1e7){utils[_0xc331('0x21')](util[_0xc331('0x10')](_0xc331('0x14'),members[_0x18e6df[_0xc331('0x15')]]?members[_0x18e6df[_0xc331('0x15')]][_0xc331('0x16')]:_0x18e6df[_0xc331('0x15')]),_0x38c1e7);}};exports[_0xc331('0x22')]=function(_0x2a1fbd){try{if(!_['isNil'](members[_0x2a1fbd[_0xc331('0x3')]])){utils[_0xc331('0x23')](util['format'](_0xc331('0x24'),_0x2a1fbd['uniqueid']),_0x2a1fbd);utils[_0xc331('0x17')](util['format'](_0xc331('0x25'),_0x2a1fbd['uniqueid'],_0x2a1fbd[_0xc331('0x3')],_0x2a1fbd[_0xc331('0x26')]));members[_0x2a1fbd[_0xc331('0x3')]]=_[_0xc331('0x27')](members[_0x2a1fbd[_0xc331('0x3')]],{'data4':_0x2a1fbd[_0xc331('0x26')],'uniqueid':_0x2a1fbd['uniqueid']});}}catch(_0x5d35f4){utils[_0xc331('0x21')](util['format'](_0xc331('0x24'),_0x2a1fbd['uniqueid']),_0x5d35f4);}};exports[_0xc331('0x28')]=function(_0x1bab6d){try{utils['debug'](util[_0xc331('0x10')](_0xc331('0x29'),_0x1bab6d[_0xc331('0x16')]),_0x1bab6d);if(_0x1bab6d[_0xc331('0x4')]){var _0x3c75b=_0x1bab6d[_0xc331('0x4')][_0xc331('0xe')]('-')[0x0];if(!_['isNil'](members[_0x3c75b])){members[_0x3c75b]=_[_0xc331('0x27')](members[_0x3c75b],{'data1':members[_0x3c75b][_0xc331('0x2a')]||_0x1bab6d['type'],'data2':members[_0x3c75b][_0xc331('0x2b')]||_0x1bab6d[_0xc331('0x2c')],'data3':members[_0x3c75b][_0xc331('0x2d')]||_0x1bab6d[_0xc331('0x2e')],'uniqueid':members[_0x3c75b][_0xc331('0x16')]||_0x1bab6d[_0xc331('0x16')]});utils['info'](util['format'](_0xc331('0x2f'),_0x1bab6d['uniqueid'],members[_0x3c75b]['data1'],members[_0x3c75b][_0xc331('0x2b')],members[_0x3c75b]['data3']));if(members[_0x3c75b]['exitAt']){writeDB(members[_0x3c75b]);}}}if(_0x1bab6d[_0xc331('0x30')]){var _0x36d4ac=_0x1bab6d[_0xc331('0x30')]['split']('-')[0x0];if(!_['isNil'](members[_0x36d4ac])){members[_0x36d4ac]=_[_0xc331('0x27')](members[_0x36d4ac],{'data1':members[_0x36d4ac][_0xc331('0x2a')]||_0x1bab6d[_0xc331('0x6')],'data2':members[_0x36d4ac][_0xc331('0x2b')]||_0x1bab6d['source'],'data3':members[_0x36d4ac][_0xc331('0x2d')]||_0x1bab6d[_0xc331('0x2e')],'uniqueid':members[_0x36d4ac]['uniqueid']||_0x1bab6d[_0xc331('0x16')]});utils[_0xc331('0x17')](util[_0xc331('0x10')](_0xc331('0x2f'),_0x1bab6d['uniqueid'],members[_0x36d4ac][_0xc331('0x2a')],members[_0x36d4ac][_0xc331('0x2b')],members[_0x36d4ac][_0xc331('0x2d')]));if(members[_0x36d4ac]['exitAt']){writeDB(members[_0x36d4ac]);}}}}catch(_0x21d5ce){utils[_0xc331('0x21')](util['format'](_0xc331('0x29'),_0x1bab6d[_0xc331('0x16')]),_0x21d5ce);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2275b27..bae9637 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 _0x32c4=['[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','queuecallercomplete','transfer','reason','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','format','uniqueid','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','variable','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED'];(function(_0x399d73,_0x82c142){var _0x1c63c7=function(_0x3be431){while(--_0x3be431){_0x399d73['push'](_0x399d73['shift']());}};_0x1c63c7(++_0x82c142);}(_0x32c4,0x109));var _0x432c=function(_0x24d8dd,_0x103354){_0x24d8dd=_0x24d8dd-0x0;var _0x126a6d=_0x32c4[_0x24d8dd];return _0x126a6d;};'use strict';var _=require(_0x432c('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x496a02){utils['info'](util[_0x432c('0x1')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x496a02[_0x432c('0x2')],_0x496a02[_0x432c('0x3')],_0x496a02['queue'],_0x496a02[_0x432c('0x4')],_0x496a02['calleridnum'],_0x496a02[_0x432c('0x5')],_0x496a02[_0x432c('0x6')]));if(_0x496a02[_0x432c('0x7')]){utils[_0x432c('0x8')](_0x496a02[_0x432c('0x7')])[_0x432c('0x9')](function(_0x2b235c){if(_0x2b235c){_0x496a02['type']=_0x2b235c[_0x432c('0xa')];}utils[_0x432c('0xb')]('CreateVoiceQueueReport',_0x496a02);});}else{utils[_0x432c('0xb')](_0x432c('0xc'),_0x496a02);}if(_0x496a02[_0x432c('0xd')]){delete queues[_0x496a02['transfereduniqueid']];}else{delete queues[_0x496a02[_0x432c('0x2')]];}}exports[_0x432c('0xe')]=function(_0x34618a){try{utils[_0x432c('0xf')](util[_0x432c('0x1')](_0x432c('0x10'),_0x34618a[_0x432c('0x2')]),_0x34618a);utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x12'),_0x34618a[_0x432c('0x2')],_0x34618a[_0x432c('0x7')],_0x34618a[_0x432c('0x13')]));queues[_0x34618a['uniqueid']]=_[_0x432c('0x14')](_0x34618a,{'originalposition':_0x34618a[_0x432c('0x13')],'queuecallerjoinAt':utils[_0x432c('0x15')](),'mohtime':0x0});}catch(_0x12ff07){utils[_0x432c('0x16')](util[_0x432c('0x1')]('[%s][queues][queuecallerjoin]',_0x34618a[_0x432c('0x2')]),_0x12ff07);}};exports[_0x432c('0x17')]=function(_0x3054c6){try{if(!_[_0x432c('0x18')](queues[_0x3054c6[_0x432c('0x2')]])){utils[_0x432c('0xf')](util[_0x432c('0x1')]('[%s][queues][hangup]',_0x3054c6[_0x432c('0x2')]),_0x3054c6);if(queues[_0x3054c6[_0x432c('0x2')]][_0x432c('0x19')]){if(!queues[_0x3054c6[_0x432c('0x2')]]['queuecallerabandon']&&!queues[_0x3054c6[_0x432c('0x2')]][_0x432c('0x1a')]){queues[_0x3054c6['uniqueid']]['queuecallercomplete']=!![];queues[_0x3054c6['uniqueid']][_0x432c('0x1b')]=utils[_0x432c('0x15')]();queues[_0x3054c6[_0x432c('0x2')]][_0x432c('0x6')]=_0x432c('0x1c');}utils['info'](util[_0x432c('0x1')](_0x432c('0x1d'),_0x3054c6['uniqueid'],queues[_0x3054c6['uniqueid']][_0x432c('0x1e')],queues[_0x3054c6[_0x432c('0x2')]][_0x432c('0x6')]));writeDB(queues[_0x3054c6[_0x432c('0x2')]]);}else if(queues[_0x3054c6[_0x432c('0x2')]][_0x432c('0xd')]){utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x1f'),_0x3054c6[_0x432c('0x2')],queues[_0x3054c6[_0x432c('0x2')]]['name'],queues[_0x3054c6[_0x432c('0x2')]]['transfereduniqueid']));queues[queues[_0x3054c6[_0x432c('0x2')]]['transfereduniqueid']]=queues[_0x3054c6[_0x432c('0x2')]];queues[queues[_0x3054c6[_0x432c('0x2')]][_0x432c('0xd')]][_0x432c('0x20')]=0x2;delete queues[_0x3054c6[_0x432c('0x2')]];}}}catch(_0x3d6705){utils['error'](util[_0x432c('0x1')]('[%s][queues][hangup]',_0x3054c6['uniqueid']),_0x3d6705);}};exports['varset']=function(_0x3d71be){try{utils[_0x432c('0xf')](util['format']('[%s][queues][varset]',_0x3d71be[_0x432c('0x2')]),_0x3d71be);if(!_[_0x432c('0x18')](_0x3d71be[_0x432c('0x21')][_0x432c('0x22')])&&_0x3d71be['value']['toUpperCase']()!==_0x432c('0x23')){if(!_[_0x432c('0x18')](queues[_0x3d71be[_0x432c('0x2')]])){queues[_0x3d71be[_0x432c('0x2')]]['queuecallerabandon']=![];queues[_0x3d71be[_0x432c('0x2')]][_0x432c('0x24')]=null;queues[_0x3d71be[_0x432c('0x2')]]['queuecallerexit']=!![];queues[_0x3d71be[_0x432c('0x2')]][_0x432c('0x25')]=utils[_0x432c('0x15')]();queues[_0x3d71be[_0x432c('0x2')]][_0x432c('0x6')]=_0x3d71be['value']['toUpperCase']();utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x26'),_0x3d71be[_0x432c('0x2')],queues[_0x3d71be[_0x432c('0x2')]]['name'],_0x3d71be[_0x432c('0x27')],queues[_0x3d71be[_0x432c('0x2')]][_0x432c('0x6')]));writeDB(queues[_0x3d71be[_0x432c('0x2')]]);}}else if(!_[_0x432c('0x18')](_0x3d71be[_0x432c('0x21')][_0x432c('0x28')])){if(!_[_0x432c('0x18')](queues[_0x3d71be['uniqueid']])&&!queues[_0x3d71be['uniqueid']][_0x432c('0x29')]){queues[_0x3d71be['uniqueid']][_0x432c('0x29')]=![];queues[_0x3d71be['uniqueid']][_0x432c('0x24')]=null;queues[_0x3d71be[_0x432c('0x2')]][_0x432c('0x1a')]=!![];queues[_0x3d71be[_0x432c('0x2')]]['queuecallerexitAt']=utils[_0x432c('0x15')]();queues[_0x3d71be[_0x432c('0x2')]][_0x432c('0x6')]=_0x432c('0x2a');utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x2b'),_0x3d71be['uniqueid'],queues[_0x3d71be[_0x432c('0x2')]]['name'],_0x3d71be[_0x432c('0x27')],queues[_0x3d71be['uniqueid']][_0x432c('0x6')]));}}}catch(_0x4859ad){utils['error'](util['format'](_0x432c('0x2c'),_0x3d71be[_0x432c('0x2')]),_0x4859ad);}};exports[_0x432c('0x29')]=function(_0x337ef9){try{if(!_['isNil'](queues[_0x337ef9[_0x432c('0x2')]])){utils[_0x432c('0xf')](util[_0x432c('0x1')](_0x432c('0x2d'),_0x337ef9['uniqueid']),_0x337ef9);queues[_0x337ef9[_0x432c('0x2')]][_0x432c('0x1a')]=![];queues[_0x337ef9['uniqueid']][_0x432c('0x25')]=null;queues[_0x337ef9[_0x432c('0x2')]][_0x432c('0x29')]=!![];queues[_0x337ef9[_0x432c('0x2')]][_0x432c('0x24')]=utils[_0x432c('0x15')]();queues[_0x337ef9['uniqueid']][_0x432c('0x6')]=_0x432c('0x2e');utils[_0x432c('0x11')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x337ef9[_0x432c('0x2')],queues[_0x337ef9[_0x432c('0x2')]]['name'],queues[_0x337ef9[_0x432c('0x2')]]['queuecallerexitreason']));}}catch(_0x46316e){utils[_0x432c('0x16')](util[_0x432c('0x1')]('[%s][queues][queuecallerabandon]',_0x337ef9[_0x432c('0x2')]),_0x46316e);}};exports['queuecallerleave']=function(_0x3c3bd0){try{if(!_['isNil'](queues[_0x3c3bd0[_0x432c('0x2')]])){utils['debug'](util[_0x432c('0x1')](_0x432c('0x2f'),_0x3c3bd0[_0x432c('0x2')]),_0x3c3bd0);utils['info'](util[_0x432c('0x1')](_0x432c('0x30'),_0x3c3bd0[_0x432c('0x2')],queues[_0x3c3bd0[_0x432c('0x2')]][_0x432c('0x1e')],_0x3c3bd0[_0x432c('0x31')],_0x3c3bd0[_0x432c('0x32')]));queues[_0x3c3bd0['uniqueid']][_0x432c('0x33')]=!![];queues[_0x3c3bd0[_0x432c('0x2')]][_0x432c('0x19')]=utils[_0x432c('0x15')]();queues[_0x3c3bd0[_0x432c('0x2')]]['holdtime']=utils[_0x432c('0x34')](queues[_0x3c3bd0[_0x432c('0x2')]][_0x432c('0x19')],queues[_0x3c3bd0[_0x432c('0x2')]][_0x432c('0x35')]);queues[_0x3c3bd0[_0x432c('0x2')]][_0x432c('0x13')]=_0x3c3bd0['position'];queues[_0x3c3bd0[_0x432c('0x2')]][_0x432c('0x36')]=_0x3c3bd0[_0x432c('0x36')];queues[_0x3c3bd0[_0x432c('0x2')]][_0x432c('0x31')]=_0x3c3bd0[_0x432c('0x31')];queues[_0x3c3bd0[_0x432c('0x2')]][_0x432c('0x32')]=_0x3c3bd0[_0x432c('0x32')];}}catch(_0x276288){utils['error'](util[_0x432c('0x1')](_0x432c('0x2f'),_0x3c3bd0[_0x432c('0x2')]),_0x276288);}};exports[_0x432c('0x37')]=function(_0xf1ac60){try{if(!_['isNil'](queues[_0xf1ac60['uniqueid']])){utils[_0x432c('0xf')](util[_0x432c('0x1')](_0x432c('0x38'),_0xf1ac60['uniqueid']),_0xf1ac60);utils[_0x432c('0x11')](util[_0x432c('0x1')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xf1ac60[_0x432c('0x2')],queues[_0xf1ac60[_0x432c('0x2')]][_0x432c('0x1e')],_0xf1ac60[_0x432c('0x39')],_0xf1ac60[_0x432c('0x3a')]));queues[_0xf1ac60[_0x432c('0x2')]][_0x432c('0x29')]=![];queues[_0xf1ac60['uniqueid']][_0x432c('0x29')]=![];queues[_0xf1ac60[_0x432c('0x2')]][_0x432c('0x24')]=null;queues[_0xf1ac60[_0x432c('0x2')]][_0x432c('0x1a')]=![];queues[_0xf1ac60[_0x432c('0x2')]]['queuecallerexitreason']=null;queues[_0xf1ac60[_0x432c('0x2')]][_0x432c('0x25')]=null;queues[_0xf1ac60['uniqueid']][_0x432c('0x3b')]=!![];queues[_0xf1ac60['uniqueid']][_0x432c('0x5')]=_0xf1ac60['destaccountcode'];queues[_0xf1ac60[_0x432c('0x2')]][_0x432c('0x4')]=_0xf1ac60['membername'];}}catch(_0x37d5af){utils[_0x432c('0x16')](util[_0x432c('0x1')](_0x432c('0x38'),_0xf1ac60[_0x432c('0x2')]),_0x37d5af);}};exports['agentcomplete']=function(_0x568be1){try{if(!_[_0x432c('0x18')](queues[_0x568be1['uniqueid']])){if(queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x19')]){utils[_0x432c('0xf')](util[_0x432c('0x1')](_0x432c('0x3c'),_0x568be1[_0x432c('0x2')]),_0x568be1);queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x29')]=![];queues[_0x568be1[_0x432c('0x2')]]['queuecallerabandon']=![];queues[_0x568be1[_0x432c('0x2')]]['queuecallerabandonAt']=null;queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x1a')]=![];queues[_0x568be1[_0x432c('0x2')]]['queuecallerexitAt']=null;queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x3b')]=!![];queues[_0x568be1['uniqueid']][_0x432c('0x4')]=_0x568be1[_0x432c('0x39')];queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x3d')]=!![];queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x1b')]=utils[_0x432c('0x15')]();if(_0x568be1['reason']==_0x432c('0x3e')){if(!queues[_0x568be1[_0x432c('0x2')]]['transfer']){queues[_0x568be1['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x6')]='COMPLETEDBY'+_0x568be1[_0x432c('0x3f')][_0x432c('0x40')]();}utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x41'),_0x568be1[_0x432c('0x2')],queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x1e')],_0x568be1['membername'],queues[_0x568be1[_0x432c('0x2')]][_0x432c('0x6')]));writeDB(queues[_0x568be1['uniqueid']]);}}}catch(_0xd2ed4e){utils['error'](util['format'](_0x432c('0x3c'),_0x568be1[_0x432c('0x2')]),_0xd2ed4e);}};exports['blindtransfer']=function(_0x271bee){try{if(!_['isNil'](queues[_0x271bee['transfereeuniqueid']])){utils['debug'](util[_0x432c('0x1')](_0x432c('0x42'),_0x271bee['uniqueid']),_0x271bee);queues[_0x271bee[_0x432c('0x43')]][_0x432c('0x3e')]=!![];queues[_0x271bee[_0x432c('0x43')]][_0x432c('0x44')]=_0x432c('0x45');queues[_0x271bee['transfereeuniqueid']]['transferexten']=_0x271bee[_0x432c('0x46')];queues[_0x271bee[_0x432c('0x43')]][_0x432c('0x47')]=_0x271bee[_0x432c('0x43')];queues[_0x271bee['transfereeuniqueid']]['queuecallerexitreason']=_0x432c('0x48');utils['info'](util[_0x432c('0x1')](_0x432c('0x49'),_0x271bee['uniqueid'],queues[_0x271bee[_0x432c('0x43')]][_0x432c('0x1e')],_0x271bee[_0x432c('0x43')],_0x271bee['extension']));}}catch(_0x4e2edd){utils['error'](util['format'](_0x432c('0x42'),_0x271bee[_0x432c('0x2')]),_0x4e2edd);}};exports[_0x432c('0x4a')]=function(_0x26c630){try{utils['debug'](util[_0x432c('0x1')](_0x432c('0x4b'),_0x26c630['origtransfereruniqueid']),_0x26c630);if(_0x26c630[_0x432c('0x4c')]==_0x26c630[_0x432c('0x4d')]){if(!_[_0x432c('0x18')](queues[_0x26c630[_0x432c('0x4e')]])){utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x4f'),_0x26c630[_0x432c('0x4c')],queues[_0x26c630[_0x432c('0x4e')]][_0x432c('0x1e')],_0x26c630['origtransfererexten']));queues[_0x26c630[_0x432c('0x4e')]][_0x432c('0x3e')]=!![];queues[_0x26c630['secondtransfererlinkedid']][_0x432c('0x44')]=_0x432c('0x50');queues[_0x26c630['secondtransfererlinkedid']][_0x432c('0x51')]=_0x26c630['origtransfererexten'];queues[_0x26c630[_0x432c('0x4e')]][_0x432c('0x47')]=_0x26c630['origtransfereruniqueid'];queues[_0x26c630[_0x432c('0x4e')]][_0x432c('0x6')]=_0x432c('0x52');}if(!_[_0x432c('0x18')](queues[_0x26c630['origtransfererlinkedid']])){if(_0x26c630[_0x432c('0x53')]&&queues[_0x26c630[_0x432c('0x53')]]){queues[_0x26c630[_0x432c('0x53')]][_0x432c('0x20')]=0x1;queues[_0x26c630[_0x432c('0x43')]]=_[_0x432c('0x54')](queues[_0x26c630[_0x432c('0x53')]]);queues[_0x26c630['transfereeuniqueid']]['transfereduniqueid']=_0x26c630[_0x432c('0x55')];queues[_0x26c630['transfereeuniqueid']][_0x432c('0x20')]=0x2;queues[_0x26c630[_0x432c('0x43')]][_0x432c('0x56')]=queues[_0x26c630[_0x432c('0x4e')]][_0x432c('0x56')];queues[_0x26c630[_0x432c('0x43')]][_0x432c('0x57')]=queues[_0x26c630['secondtransfererlinkedid']][_0x432c('0x57')];queues[_0x26c630[_0x432c('0x43')]]['queuecallerjoinAt']=utils['now']();queues[_0x26c630[_0x432c('0x43')]][_0x432c('0x19')]=utils[_0x432c('0x15')]();queues[_0x26c630['transfereeuniqueid']]['holdtime']=0x0;queues[_0x26c630[_0x432c('0x43')]]['mohtime']=0x0;utils['info'](util[_0x432c('0x1')](_0x432c('0x58'),_0x26c630[_0x432c('0x4c')],queues[_0x26c630[_0x432c('0x43')]][_0x432c('0x1e')],queues[_0x26c630[_0x432c('0x43')]][_0x432c('0x56')],queues[_0x26c630[_0x432c('0x43')]][_0x432c('0x57')]));}else{utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x59'),_0x26c630[_0x432c('0x4c')],queues[_0x26c630[_0x432c('0x4d')]][_0x432c('0x1e')],_0x26c630['secondtransfererlinkedid']));queues[_0x26c630[_0x432c('0x4d')]][_0x432c('0xd')]=_0x26c630[_0x432c('0x4e')];}}}else if(_0x26c630[_0x432c('0x5a')]==_0x26c630[_0x432c('0x4e')]){if(!_['isNil'](queues[_0x26c630['origtransfererlinkedid']])){utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x5b'),_0x26c630[_0x432c('0x4c')],queues[_0x26c630['origtransfererlinkedid']][_0x432c('0x1e')],_0x26c630[_0x432c('0x5a')],_0x26c630['secondtransfererexten']));queues[_0x26c630[_0x432c('0x4d')]][_0x432c('0x3e')]=!![];queues[_0x26c630[_0x432c('0x4d')]][_0x432c('0x44')]='ATTENDED';queues[_0x26c630[_0x432c('0x4d')]][_0x432c('0x51')]=_0x26c630[_0x432c('0x5c')];queues[_0x26c630[_0x432c('0x4d')]]['transferuniqueid']=_0x26c630[_0x432c('0x5a')];queues[_0x26c630[_0x432c('0x4d')]]['queuecallerexitreason']=_0x432c('0x52');}if(!_['isNil'](queues[_0x26c630['secondtransfererlinkedid']])){if(_0x26c630[_0x432c('0x5d')]&&queues[_0x26c630[_0x432c('0x5d')]]){queues[_0x26c630['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x26c630[_0x432c('0x55')]]=_['clone'](queues[_0x26c630[_0x432c('0x5d')]]);queues[_0x26c630[_0x432c('0x55')]]['transfereduniqueid']=_0x26c630[_0x432c('0x55')];queues[_0x26c630[_0x432c('0x55')]][_0x432c('0x20')]=0x2;queues[_0x26c630[_0x432c('0x55')]][_0x432c('0x56')]=queues[_0x26c630[_0x432c('0x4d')]][_0x432c('0x56')];queues[_0x26c630['transfertargetuniqueid']]['calleridname']=queues[_0x26c630[_0x432c('0x4d')]][_0x432c('0x57')];queues[_0x26c630['transfertargetuniqueid']][_0x432c('0x35')]=utils[_0x432c('0x15')]();queues[_0x26c630[_0x432c('0x55')]][_0x432c('0x19')]=utils[_0x432c('0x15')]();queues[_0x26c630['transfertargetuniqueid']][_0x432c('0x5e')]=0x0;queues[_0x26c630[_0x432c('0x55')]][_0x432c('0x5f')]=0x0;utils['info'](util[_0x432c('0x1')](_0x432c('0x60'),_0x26c630['origtransfereruniqueid'],queues[_0x26c630['transfertargetuniqueid']][_0x432c('0x1e')],queues[_0x26c630[_0x432c('0x55')]]['transfereduniqueid'],queues[_0x26c630[_0x432c('0x55')]]['calleridnum'],queues[_0x26c630[_0x432c('0x55')]][_0x432c('0x57')]));}else{utils[_0x432c('0x11')](util[_0x432c('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x26c630[_0x432c('0x4c')],queues[_0x26c630[_0x432c('0x4e')]][_0x432c('0x1e')],_0x26c630['origtransfererlinkedid']));queues[_0x26c630[_0x432c('0x4e')]][_0x432c('0xd')]=_0x26c630[_0x432c('0x4d')];}}}}catch(_0x1797c1){utils[_0x432c('0x16')](util[_0x432c('0x1')](_0x432c('0x4b'),_0x26c630[_0x432c('0x4c')]),_0x1797c1);}};exports[_0x432c('0x61')]=function(_0x30259){try{if(!_[_0x432c('0x18')](queues[_0x30259[_0x432c('0x2')]])){utils[_0x432c('0xf')](util[_0x432c('0x1')]('[%s][queues][musiconholdstart]',_0x30259['uniqueid']),_0x30259);queues[_0x30259[_0x432c('0x2')]][_0x432c('0x62')]=utils[_0x432c('0x15')]();utils[_0x432c('0x11')](util['format'](_0x432c('0x63'),_0x30259['uniqueid'],queues[_0x30259['uniqueid']][_0x432c('0x1e')],queues[_0x30259[_0x432c('0x2')]][_0x432c('0x62')]));}}catch(_0x1b1f5d){utils['error'](util[_0x432c('0x1')](_0x432c('0x64'),_0x30259[_0x432c('0x2')]),_0x1b1f5d);}};exports[_0x432c('0x65')]=function(_0x3b4daa){try{if(!_[_0x432c('0x18')](queues[_0x3b4daa[_0x432c('0x2')]])){if(!_[_0x432c('0x18')](queues[_0x3b4daa['uniqueid']][_0x432c('0x62')])){utils['debug'](util[_0x432c('0x1')](_0x432c('0x66'),_0x3b4daa[_0x432c('0x2')]),_0x3b4daa);queues[_0x3b4daa['uniqueid']]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x3b4daa[_0x432c('0x2')]][_0x432c('0x62')]);utils[_0x432c('0x11')](util[_0x432c('0x1')](_0x432c('0x67'),_0x3b4daa[_0x432c('0x2')],queues[_0x3b4daa[_0x432c('0x2')]][_0x432c('0x1e')],queues[_0x3b4daa[_0x432c('0x2')]][_0x432c('0x5f')]));delete queues[_0x3b4daa[_0x432c('0x2')]][_0x432c('0x62')];}}}catch(_0x1880d1){utils[_0x432c('0x16')](util[_0x432c('0x1')](_0x432c('0x66'),_0x3b4daa['uniqueid']),_0x1880d1);}}; \ No newline at end of file +var _0x3574=['holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','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','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','isNil','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x3574,0x9e));var _0x4357=function(_0x2e50bc,_0x391ad9){_0x2e50bc=_0x2e50bc-0x0;var _0x4e2fea=_0x3574[_0x2e50bc];return _0x4e2fea;};'use strict';var _=require(_0x4357('0x0'));var util=require('util');var utils=require(_0x4357('0x1'));var queues={};function writeDB(_0xfe5300){utils[_0x4357('0x2')](util[_0x4357('0x3')](_0x4357('0x4'),_0xfe5300['uniqueid'],_0xfe5300['channel'],_0xfe5300[_0x4357('0x5')],_0xfe5300[_0x4357('0x6')],_0xfe5300['calleridnum'],_0xfe5300['accountcode'],_0xfe5300[_0x4357('0x7')]));if(_0xfe5300[_0x4357('0x5')]){utils[_0x4357('0x8')](_0xfe5300[_0x4357('0x5')])[_0x4357('0x9')](function(_0x161695){if(_0x161695){_0xfe5300[_0x4357('0xa')]=_0x161695[_0x4357('0xa')];}utils[_0x4357('0xb')]('CreateVoiceQueueReport',_0xfe5300);});}else{utils[_0x4357('0xb')](_0x4357('0xc'),_0xfe5300);}if(_0xfe5300[_0x4357('0xd')]){delete queues[_0xfe5300[_0x4357('0xd')]];}else{delete queues[_0xfe5300[_0x4357('0xe')]];}}exports[_0x4357('0xf')]=function(_0x4da387){try{utils[_0x4357('0x10')](util[_0x4357('0x3')](_0x4357('0x11'),_0x4da387[_0x4357('0xe')]),_0x4da387);utils['info'](util[_0x4357('0x3')](_0x4357('0x12'),_0x4da387[_0x4357('0xe')],_0x4da387[_0x4357('0x5')],_0x4da387[_0x4357('0x13')]));queues[_0x4da387[_0x4357('0xe')]]=_[_0x4357('0x14')](_0x4da387,{'originalposition':_0x4da387[_0x4357('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x444fe3){utils[_0x4357('0x15')](util[_0x4357('0x3')](_0x4357('0x11'),_0x4da387[_0x4357('0xe')]),_0x444fe3);}};exports[_0x4357('0x16')]=function(_0x57e5e8){try{if(!_['isNil'](queues[_0x57e5e8[_0x4357('0xe')]])){utils[_0x4357('0x10')](util[_0x4357('0x3')]('[%s][queues][hangup]',_0x57e5e8[_0x4357('0xe')]),_0x57e5e8);if(queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0x17')]){if(!queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0x18')]&&!queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0x19')]){queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0x1a')]=!![];queues[_0x57e5e8[_0x4357('0xe')]]['queuecallercompleteAt']=utils[_0x4357('0x1b')]();queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0x7')]=_0x4357('0x1c');}utils[_0x4357('0x2')](util['format'](_0x4357('0x1d'),_0x57e5e8[_0x4357('0xe')],queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0x1e')],queues[_0x57e5e8[_0x4357('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x57e5e8[_0x4357('0xe')]]);}else if(queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0xd')]){utils['info'](util[_0x4357('0x3')](_0x4357('0x1f'),_0x57e5e8[_0x4357('0xe')],queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0x1e')],queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0xd')]));queues[queues[_0x57e5e8[_0x4357('0xe')]][_0x4357('0xd')]]=queues[_0x57e5e8[_0x4357('0xe')]];queues[queues[_0x57e5e8['uniqueid']][_0x4357('0xd')]][_0x4357('0x20')]=0x2;delete queues[_0x57e5e8['uniqueid']];}}}catch(_0x1e3fb4){utils[_0x4357('0x15')](util[_0x4357('0x3')](_0x4357('0x21'),_0x57e5e8[_0x4357('0xe')]),_0x1e3fb4);}};exports['varset']=function(_0x208bd3){try{utils[_0x4357('0x10')](util[_0x4357('0x3')](_0x4357('0x22'),_0x208bd3['uniqueid']),_0x208bd3);if(!_['isNil'](_0x208bd3[_0x4357('0x23')][_0x4357('0x24')])&&_0x208bd3[_0x4357('0x25')][_0x4357('0x26')]()!==_0x4357('0x27')){if(!_[_0x4357('0x28')](queues[_0x208bd3['uniqueid']])){queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x18')]=![];queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x29')]=null;queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x19')]=!![];queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x2a')]=utils[_0x4357('0x1b')]();queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x7')]=_0x208bd3[_0x4357('0x25')][_0x4357('0x26')]();utils[_0x4357('0x2')](util[_0x4357('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x208bd3['uniqueid'],queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x1e')],_0x208bd3[_0x4357('0x25')],queues[_0x208bd3['uniqueid']][_0x4357('0x7')]));writeDB(queues[_0x208bd3[_0x4357('0xe')]]);}}else if(!_[_0x4357('0x28')](_0x208bd3['variable'][_0x4357('0x2b')])){if(!_[_0x4357('0x28')](queues[_0x208bd3['uniqueid']])&&!queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x18')]){queues[_0x208bd3['uniqueid']]['queuecallerabandon']=![];queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x29')]=null;queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x19')]=!![];queues[_0x208bd3['uniqueid']][_0x4357('0x2a')]=utils[_0x4357('0x1b')]();queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x7')]=_0x4357('0x2c');utils[_0x4357('0x2')](util[_0x4357('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x208bd3[_0x4357('0xe')],queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x1e')],_0x208bd3[_0x4357('0x25')],queues[_0x208bd3[_0x4357('0xe')]][_0x4357('0x7')]));}}}catch(_0x1b0dbc){utils[_0x4357('0x15')](util[_0x4357('0x3')](_0x4357('0x22'),_0x208bd3[_0x4357('0xe')]),_0x1b0dbc);}};exports[_0x4357('0x18')]=function(_0x2632b2){try{if(!_[_0x4357('0x28')](queues[_0x2632b2[_0x4357('0xe')]])){utils[_0x4357('0x10')](util[_0x4357('0x3')](_0x4357('0x2d'),_0x2632b2[_0x4357('0xe')]),_0x2632b2);queues[_0x2632b2['uniqueid']][_0x4357('0x19')]=![];queues[_0x2632b2[_0x4357('0xe')]][_0x4357('0x2a')]=null;queues[_0x2632b2[_0x4357('0xe')]]['queuecallerabandon']=!![];queues[_0x2632b2[_0x4357('0xe')]]['queuecallerabandonAt']=utils[_0x4357('0x1b')]();queues[_0x2632b2['uniqueid']][_0x4357('0x7')]=_0x4357('0x2e');utils['info'](util[_0x4357('0x3')](_0x4357('0x2f'),_0x2632b2[_0x4357('0xe')],queues[_0x2632b2['uniqueid']][_0x4357('0x1e')],queues[_0x2632b2[_0x4357('0xe')]][_0x4357('0x7')]));}}catch(_0x557f74){utils[_0x4357('0x15')](util[_0x4357('0x3')](_0x4357('0x2d'),_0x2632b2['uniqueid']),_0x557f74);}};exports['queuecallerleave']=function(_0x50b382){try{if(!_[_0x4357('0x28')](queues[_0x50b382['uniqueid']])){utils['debug'](util[_0x4357('0x3')](_0x4357('0x30'),_0x50b382[_0x4357('0xe')]),_0x50b382);utils[_0x4357('0x2')](util['format'](_0x4357('0x31'),_0x50b382['uniqueid'],queues[_0x50b382[_0x4357('0xe')]][_0x4357('0x1e')],_0x50b382[_0x4357('0x32')],_0x50b382[_0x4357('0x33')]));queues[_0x50b382['uniqueid']]['queuecallerleave']=!![];queues[_0x50b382[_0x4357('0xe')]][_0x4357('0x17')]=utils[_0x4357('0x1b')]();queues[_0x50b382[_0x4357('0xe')]][_0x4357('0x34')]=utils[_0x4357('0x35')](queues[_0x50b382['uniqueid']][_0x4357('0x17')],queues[_0x50b382[_0x4357('0xe')]][_0x4357('0x36')]);queues[_0x50b382['uniqueid']]['position']=_0x50b382[_0x4357('0x13')];queues[_0x50b382[_0x4357('0xe')]]['count']=_0x50b382[_0x4357('0x37')];queues[_0x50b382[_0x4357('0xe')]][_0x4357('0x32')]=_0x50b382['connectedlinenum'];queues[_0x50b382['uniqueid']]['connectedlinename']=_0x50b382[_0x4357('0x33')];}}catch(_0x47ae1e){utils[_0x4357('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x50b382[_0x4357('0xe')]),_0x47ae1e);}};exports[_0x4357('0x38')]=function(_0x2e10e1){try{if(!_[_0x4357('0x28')](queues[_0x2e10e1[_0x4357('0xe')]])){utils[_0x4357('0x10')](util[_0x4357('0x3')](_0x4357('0x39'),_0x2e10e1[_0x4357('0xe')]),_0x2e10e1);utils[_0x4357('0x2')](util[_0x4357('0x3')](_0x4357('0x3a'),_0x2e10e1[_0x4357('0xe')],queues[_0x2e10e1[_0x4357('0xe')]][_0x4357('0x1e')],_0x2e10e1[_0x4357('0x3b')],_0x2e10e1[_0x4357('0x3c')]));queues[_0x2e10e1[_0x4357('0xe')]]['queuecallerabandon']=![];queues[_0x2e10e1[_0x4357('0xe')]][_0x4357('0x18')]=![];queues[_0x2e10e1[_0x4357('0xe')]]['queuecallerabandonAt']=null;queues[_0x2e10e1[_0x4357('0xe')]]['queuecallerexit']=![];queues[_0x2e10e1[_0x4357('0xe')]]['queuecallerexitreason']=null;queues[_0x2e10e1[_0x4357('0xe')]]['queuecallerexitAt']=null;queues[_0x2e10e1[_0x4357('0xe')]][_0x4357('0x3d')]=!![];queues[_0x2e10e1['uniqueid']]['accountcode']=_0x2e10e1[_0x4357('0x3c')];queues[_0x2e10e1[_0x4357('0xe')]][_0x4357('0x6')]=_0x2e10e1['membername'];}}catch(_0x39ef09){utils['error'](util[_0x4357('0x3')]('[%s][queues][agentconnect]',_0x2e10e1['uniqueid']),_0x39ef09);}};exports[_0x4357('0x3e')]=function(_0x6d03f6){try{if(!_[_0x4357('0x28')](queues[_0x6d03f6[_0x4357('0xe')]])){if(queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x17')]){utils[_0x4357('0x10')](util[_0x4357('0x3')](_0x4357('0x3f'),_0x6d03f6[_0x4357('0xe')]),_0x6d03f6);queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x18')]=![];queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x18')]=![];queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x29')]=null;queues[_0x6d03f6['uniqueid']]['queuecallerexit']=![];queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x2a')]=null;queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x3d')]=!![];queues[_0x6d03f6[_0x4357('0xe')]]['lastAssignedTo']=_0x6d03f6[_0x4357('0x3b')];queues[_0x6d03f6[_0x4357('0xe')]]['queuecallercomplete']=!![];queues[_0x6d03f6['uniqueid']][_0x4357('0x40')]=utils[_0x4357('0x1b')]();if(_0x6d03f6[_0x4357('0x41')]==_0x4357('0x42')){if(!queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x42')]){queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x7')]='TRANSFER';}}else{queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x7')]=_0x4357('0x43')+_0x6d03f6['reason'][_0x4357('0x26')]();}utils['info'](util[_0x4357('0x3')](_0x4357('0x44'),_0x6d03f6[_0x4357('0xe')],queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x1e')],_0x6d03f6[_0x4357('0x3b')],queues[_0x6d03f6[_0x4357('0xe')]][_0x4357('0x7')]));writeDB(queues[_0x6d03f6[_0x4357('0xe')]]);}}}catch(_0x548a34){utils[_0x4357('0x15')](util[_0x4357('0x3')](_0x4357('0x3f'),_0x6d03f6[_0x4357('0xe')]),_0x548a34);}};exports[_0x4357('0x45')]=function(_0x585797){try{if(!_['isNil'](queues[_0x585797[_0x4357('0x46')]])){utils[_0x4357('0x10')](util[_0x4357('0x3')](_0x4357('0x47'),_0x585797[_0x4357('0xe')]),_0x585797);queues[_0x585797[_0x4357('0x46')]][_0x4357('0x42')]=!![];queues[_0x585797[_0x4357('0x46')]][_0x4357('0x48')]=_0x4357('0x49');queues[_0x585797['transfereeuniqueid']][_0x4357('0x4a')]=_0x585797[_0x4357('0x4b')];queues[_0x585797[_0x4357('0x46')]][_0x4357('0x4c')]=_0x585797[_0x4357('0x46')];queues[_0x585797[_0x4357('0x46')]]['queuecallerexitreason']='BLINDTRANSFER';utils['info'](util[_0x4357('0x3')](_0x4357('0x4d'),_0x585797[_0x4357('0xe')],queues[_0x585797[_0x4357('0x46')]]['name'],_0x585797[_0x4357('0x46')],_0x585797[_0x4357('0x4b')]));}}catch(_0x56d01e){utils[_0x4357('0x15')](util[_0x4357('0x3')](_0x4357('0x47'),_0x585797[_0x4357('0xe')]),_0x56d01e);}};exports[_0x4357('0x4e')]=function(_0x4ec2e7){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x4ec2e7[_0x4357('0x4f')]),_0x4ec2e7);if(_0x4ec2e7[_0x4357('0x4f')]==_0x4ec2e7[_0x4357('0x50')]){if(!_[_0x4357('0x28')](queues[_0x4ec2e7[_0x4357('0x51')]])){utils['info'](util[_0x4357('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4ec2e7[_0x4357('0x4f')],queues[_0x4ec2e7['secondtransfererlinkedid']][_0x4357('0x1e')],_0x4ec2e7['origtransfererexten']));queues[_0x4ec2e7[_0x4357('0x51')]][_0x4357('0x42')]=!![];queues[_0x4ec2e7['secondtransfererlinkedid']][_0x4357('0x48')]='ATTENDED';queues[_0x4ec2e7[_0x4357('0x51')]][_0x4357('0x4a')]=_0x4ec2e7['origtransfererexten'];queues[_0x4ec2e7[_0x4357('0x51')]]['transferuniqueid']=_0x4ec2e7['origtransfereruniqueid'];queues[_0x4ec2e7['secondtransfererlinkedid']][_0x4357('0x7')]=_0x4357('0x52');}if(!_['isNil'](queues[_0x4ec2e7[_0x4357('0x50')]])){if(_0x4ec2e7[_0x4357('0x53')]&&queues[_0x4ec2e7[_0x4357('0x53')]]){queues[_0x4ec2e7['transfereelinkedid']][_0x4357('0x20')]=0x1;queues[_0x4ec2e7[_0x4357('0x46')]]=_[_0x4357('0x54')](queues[_0x4ec2e7['transfereelinkedid']]);queues[_0x4ec2e7[_0x4357('0x46')]][_0x4357('0xd')]=_0x4ec2e7['transfertargetuniqueid'];queues[_0x4ec2e7['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x4ec2e7[_0x4357('0x46')]][_0x4357('0x55')]=queues[_0x4ec2e7[_0x4357('0x51')]][_0x4357('0x55')];queues[_0x4ec2e7[_0x4357('0x46')]][_0x4357('0x56')]=queues[_0x4ec2e7[_0x4357('0x51')]][_0x4357('0x56')];queues[_0x4ec2e7[_0x4357('0x46')]]['queuecallerjoinAt']=utils[_0x4357('0x1b')]();queues[_0x4ec2e7[_0x4357('0x46')]]['queuecallerleaveAt']=utils[_0x4357('0x1b')]();queues[_0x4ec2e7[_0x4357('0x46')]]['holdtime']=0x0;queues[_0x4ec2e7[_0x4357('0x46')]][_0x4357('0x57')]=0x0;utils['info'](util[_0x4357('0x3')](_0x4357('0x58'),_0x4ec2e7['origtransfereruniqueid'],queues[_0x4ec2e7[_0x4357('0x46')]][_0x4357('0x1e')],queues[_0x4ec2e7[_0x4357('0x46')]][_0x4357('0x55')],queues[_0x4ec2e7[_0x4357('0x46')]][_0x4357('0x56')]));}else{utils[_0x4357('0x2')](util['format'](_0x4357('0x59'),_0x4ec2e7[_0x4357('0x4f')],queues[_0x4ec2e7[_0x4357('0x50')]]['name'],_0x4ec2e7[_0x4357('0x51')]));queues[_0x4ec2e7[_0x4357('0x50')]][_0x4357('0xd')]=_0x4ec2e7[_0x4357('0x51')];}}}else if(_0x4ec2e7[_0x4357('0x5a')]==_0x4ec2e7[_0x4357('0x51')]){if(!_['isNil'](queues[_0x4ec2e7['origtransfererlinkedid']])){utils['info'](util[_0x4357('0x3')](_0x4357('0x5b'),_0x4ec2e7[_0x4357('0x4f')],queues[_0x4ec2e7[_0x4357('0x50')]][_0x4357('0x1e')],_0x4ec2e7[_0x4357('0x5a')],_0x4ec2e7[_0x4357('0x5c')]));queues[_0x4ec2e7['origtransfererlinkedid']][_0x4357('0x42')]=!![];queues[_0x4ec2e7[_0x4357('0x50')]][_0x4357('0x48')]=_0x4357('0x5d');queues[_0x4ec2e7[_0x4357('0x50')]][_0x4357('0x4a')]=_0x4ec2e7[_0x4357('0x5c')];queues[_0x4ec2e7[_0x4357('0x50')]][_0x4357('0x4c')]=_0x4ec2e7['secondtransfereruniqueid'];queues[_0x4ec2e7[_0x4357('0x50')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x4ec2e7[_0x4357('0x51')]])){if(_0x4ec2e7[_0x4357('0x5e')]&&queues[_0x4ec2e7[_0x4357('0x5e')]]){queues[_0x4ec2e7[_0x4357('0x5e')]][_0x4357('0x20')]=0x1;queues[_0x4ec2e7[_0x4357('0x5f')]]=_[_0x4357('0x54')](queues[_0x4ec2e7[_0x4357('0x5e')]]);queues[_0x4ec2e7[_0x4357('0x5f')]]['transfereduniqueid']=_0x4ec2e7[_0x4357('0x5f')];queues[_0x4ec2e7[_0x4357('0x5f')]][_0x4357('0x20')]=0x2;queues[_0x4ec2e7[_0x4357('0x5f')]][_0x4357('0x55')]=queues[_0x4ec2e7[_0x4357('0x50')]][_0x4357('0x55')];queues[_0x4ec2e7[_0x4357('0x5f')]][_0x4357('0x56')]=queues[_0x4ec2e7[_0x4357('0x50')]]['calleridname'];queues[_0x4ec2e7[_0x4357('0x5f')]][_0x4357('0x36')]=utils[_0x4357('0x1b')]();queues[_0x4ec2e7[_0x4357('0x5f')]]['queuecallerleaveAt']=utils[_0x4357('0x1b')]();queues[_0x4ec2e7[_0x4357('0x5f')]][_0x4357('0x34')]=0x0;queues[_0x4ec2e7[_0x4357('0x5f')]][_0x4357('0x57')]=0x0;utils[_0x4357('0x2')](util[_0x4357('0x3')](_0x4357('0x60'),_0x4ec2e7[_0x4357('0x4f')],queues[_0x4ec2e7[_0x4357('0x5f')]]['name'],queues[_0x4ec2e7[_0x4357('0x5f')]][_0x4357('0xd')],queues[_0x4ec2e7[_0x4357('0x5f')]][_0x4357('0x55')],queues[_0x4ec2e7['transfertargetuniqueid']][_0x4357('0x56')]));}else{utils['info'](util[_0x4357('0x3')](_0x4357('0x59'),_0x4ec2e7[_0x4357('0x4f')],queues[_0x4ec2e7['secondtransfererlinkedid']][_0x4357('0x1e')],_0x4ec2e7['origtransfererlinkedid']));queues[_0x4ec2e7[_0x4357('0x51')]][_0x4357('0xd')]=_0x4ec2e7[_0x4357('0x50')];}}}}catch(_0x1cf6da){utils['error'](util['format'](_0x4357('0x61'),_0x4ec2e7[_0x4357('0x4f')]),_0x1cf6da);}};exports[_0x4357('0x62')]=function(_0x27cc65){try{if(!_[_0x4357('0x28')](queues[_0x27cc65['uniqueid']])){utils[_0x4357('0x10')](util[_0x4357('0x3')](_0x4357('0x63'),_0x27cc65['uniqueid']),_0x27cc65);queues[_0x27cc65[_0x4357('0xe')]][_0x4357('0x64')]=utils[_0x4357('0x1b')]();utils[_0x4357('0x2')](util[_0x4357('0x3')](_0x4357('0x65'),_0x27cc65[_0x4357('0xe')],queues[_0x27cc65[_0x4357('0xe')]][_0x4357('0x1e')],queues[_0x27cc65['uniqueid']][_0x4357('0x64')]));}}catch(_0x2654e5){utils['error'](util[_0x4357('0x3')]('[%s][queues][musiconholdstart]',_0x27cc65[_0x4357('0xe')]),_0x2654e5);}};exports[_0x4357('0x66')]=function(_0xaf9509){try{if(!_[_0x4357('0x28')](queues[_0xaf9509[_0x4357('0xe')]])){if(!_[_0x4357('0x28')](queues[_0xaf9509['uniqueid']][_0x4357('0x64')])){utils[_0x4357('0x10')](util['format'](_0x4357('0x67'),_0xaf9509[_0x4357('0xe')]),_0xaf9509);queues[_0xaf9509[_0x4357('0xe')]][_0x4357('0x57')]+=utils[_0x4357('0x35')](utils[_0x4357('0x1b')](),queues[_0xaf9509['uniqueid']][_0x4357('0x64')]);utils[_0x4357('0x2')](util['format'](_0x4357('0x68'),_0xaf9509['uniqueid'],queues[_0xaf9509[_0x4357('0xe')]]['name'],queues[_0xaf9509[_0x4357('0xe')]][_0x4357('0x57')]));delete queues[_0xaf9509[_0x4357('0xe')]][_0x4357('0x64')];}}}catch(_0x5edee9){utils['error'](util[_0x4357('0x3')](_0x4357('0x67'),_0xaf9509[_0x4357('0xe')]),_0x5edee9);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 1babc4f..fa3c4c3 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 _0x4d4a=['name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','newstate','debug','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','error','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername'];(function(_0x1bcfff,_0x3ccb9b){var _0x5e74f5=function(_0x289945){while(--_0x289945){_0x1bcfff['push'](_0x1bcfff['shift']());}};_0x5e74f5(++_0x3ccb9b);}(_0x4d4a,0x166));var _0xa4d4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x4d4a[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xa4d4('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x38af69){utils[_0xa4d4('0x1')](util[_0xa4d4('0x2')](_0xa4d4('0x3'),_0x38af69[_0xa4d4('0x4')]));if(_0x38af69[_0xa4d4('0x5')]){utils['getUserByInternal'](_0x38af69[_0xa4d4('0x5')])[_0xa4d4('0x6')](function(_0x10808d){if(_0x10808d){_0x38af69[_0xa4d4('0x7')]=_0x10808d[_0xa4d4('0x8')];_0x38af69[_0xa4d4('0x9')]=_0x10808d['id'];}utils[_0xa4d4('0xa')]('CreateVoiceRecording',_0x38af69);});}else{utils[_0xa4d4('0xa')](_0xa4d4('0xb'),_0x38af69);}}exports[_0xa4d4('0xc')]=function(_0x20d441){try{utils['debug'](util[_0xa4d4('0x2')](_0xa4d4('0xd'),_0x20d441[_0xa4d4('0x4')]),_0x20d441);if(_0x20d441['uniqueid']==_0x20d441[_0xa4d4('0xe')]){utils[_0xa4d4('0x1')](util[_0xa4d4('0x2')](_0xa4d4('0xf'),_0x20d441[_0xa4d4('0x4')],_0x20d441['context'],_0x20d441['exten']));recordings[_0x20d441[_0xa4d4('0x4')]]={'uniqueid':_0x20d441['uniqueid'],'accountcode':_0x20d441[_0xa4d4('0x5')],'exten':_0x20d441['exten'],'context':_0x20d441[_0xa4d4('0x10')],'channel':_0x20d441[_0xa4d4('0x11')],'monitors':[]};}}catch(_0x374f0d){utils['error'](util['format'](_0xa4d4('0xd'),_0x20d441[_0xa4d4('0x4')]),_0x374f0d);}};exports[_0xa4d4('0x12')]=function(_0xd7d774){try{utils[_0xa4d4('0x13')](util[_0xa4d4('0x2')]('[%s][recordings][newstate]',_0xd7d774[_0xa4d4('0x4')]),_0xd7d774);if(!_[_0xa4d4('0x14')](recordings[_0xd7d774[_0xa4d4('0x4')]])&&_0xd7d774['channelstate']==0x6){utils[_0xa4d4('0x1')](util[_0xa4d4('0x2')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0xd7d774[_0xa4d4('0x4')],_0xd7d774[_0xa4d4('0x10')],_0xd7d774['channel']));}else if(!_[_0xa4d4('0x14')](recordings[_0xd7d774['linkedid']])&&_0xd7d774[_0xa4d4('0x15')]==0x6&&_0xd7d774['context']!=_0xa4d4('0x16')){utils['info'](util[_0xa4d4('0x2')](_0xa4d4('0x17'),_0xd7d774[_0xa4d4('0x4')],_0xd7d774[_0xa4d4('0xe')],_0xd7d774[_0xa4d4('0x10')],_0xd7d774[_0xa4d4('0x11')]));recordings[_0xd7d774[_0xa4d4('0xe')]][_0xa4d4('0x5')]=_0xd7d774['accountcode'];}}catch(_0x53c183){utils['error'](util[_0xa4d4('0x2')](_0xa4d4('0x18'),_0xd7d774[_0xa4d4('0x4')]),_0x53c183);}};exports[_0xa4d4('0x19')]=function(_0x44246b){try{if(!_[_0xa4d4('0x14')](_0x44246b['variable'])&&!_[_0xa4d4('0x14')](_0x44246b[_0xa4d4('0x1a')]['mixmonitor_filename'])){utils['debug'](util['format']('[%s][recordings][varset]',_0x44246b[_0xa4d4('0x4')]),_0x44246b);utils[_0xa4d4('0x1')](util[_0xa4d4('0x2')](_0xa4d4('0x1b'),_0x44246b[_0xa4d4('0x4')],_0x44246b[_0xa4d4('0x1a')],_0x44246b[_0xa4d4('0x1c')]));if(_['endsWith'](_0x44246b[_0xa4d4('0x1c')],_0xa4d4('0x1d'))){_0x44246b[_0xa4d4('0x1c')]=_0x44246b[_0xa4d4('0x1c')][_0xa4d4('0x1e')](_0xa4d4('0x1d'),_0xa4d4('0x1f'));}if(recordings[_0x44246b[_0xa4d4('0xe')]]){var _0x420749=_[_0xa4d4('0x20')](recordings[_0x44246b['linkedid']][_0xa4d4('0x21')],{'value':_0x44246b[_0xa4d4('0x1c')]});if(_[_0xa4d4('0x14')](_0x420749)){recordings[_0x44246b['linkedid']][_0xa4d4('0x21')][_0xa4d4('0x22')]({'value':_0x44246b[_0xa4d4('0x1c')]});}}}}catch(_0x41394c){utils[_0xa4d4('0x23')](util['format'](_0xa4d4('0x24'),_0x44246b[_0xa4d4('0x4')]),_0x41394c);}};exports[_0xa4d4('0x25')]=function(_0x213f25){try{if(!_[_0xa4d4('0x14')](recordings[_0x213f25[_0xa4d4('0x4')]])){utils[_0xa4d4('0x13')](util[_0xa4d4('0x2')]('[%s][recordings][hangup]',_0x213f25['uniqueid']),_0x213f25);utils[_0xa4d4('0x1')](util[_0xa4d4('0x2')](_0xa4d4('0x26'),_0x213f25[_0xa4d4('0x4')],_0x213f25[_0xa4d4('0x27')],_0x213f25[_0xa4d4('0x28')],_0x213f25['cause-txt']));recordings[_0x213f25[_0xa4d4('0x4')]]['calleridnum']=_0x213f25[_0xa4d4('0x27')];recordings[_0x213f25[_0xa4d4('0x4')]][_0xa4d4('0x28')]=_0x213f25[_0xa4d4('0x28')];recordings[_0x213f25['uniqueid']][_0xa4d4('0x29')]=_0x213f25[_0xa4d4('0x29')];recordings[_0x213f25[_0xa4d4('0x4')]]['connectedlinename']=_0x213f25[_0xa4d4('0x2a')];if(recordings[_0x213f25[_0xa4d4('0x4')]][_0xa4d4('0x2b')]==_0xa4d4('0x2c')&&recordings[_0x213f25[_0xa4d4('0x4')]][_0xa4d4('0x5')]){recordings[_0x213f25[_0xa4d4('0x4')]]['connectedlinenum']=recordings[_0x213f25[_0xa4d4('0x4')]][_0xa4d4('0x5')];recordings[_0x213f25['uniqueid']]['connectedlinename']='';}recordings[_0x213f25['uniqueid']][_0xa4d4('0x21')][_0xa4d4('0x2d')](function(_0x1ae1b7){var _0xabc110=_['clone'](recordings[_0x213f25[_0xa4d4('0x4')]]);_0xabc110[_0xa4d4('0x1c')]=_0x1ae1b7[_0xa4d4('0x1c')];writeDB(_0xabc110);});delete recordings[_0x213f25[_0xa4d4('0x4')]];}}catch(_0x17b7f0){utils[_0xa4d4('0x23')](util[_0xa4d4('0x2')](_0xa4d4('0x2e'),_0x213f25[_0xa4d4('0x4')]),_0x17b7f0);}};exports['newexten']=function(_0x1ffac6){try{if(!_[_0xa4d4('0x14')](recordings[_0x1ffac6[_0xa4d4('0x4')]])){utils[_0xa4d4('0x13')](util[_0xa4d4('0x2')](_0xa4d4('0x2f'),_0x1ffac6[_0xa4d4('0x4')]),_0x1ffac6);utils['info'](util[_0xa4d4('0x2')](_0xa4d4('0x30'),_0x1ffac6[_0xa4d4('0x4')],_0x1ffac6[_0xa4d4('0x31')],_0x1ffac6[_0xa4d4('0x32')]));if(_0x1ffac6['application']['toLowerCase']()==_0xa4d4('0x33')&&_['startsWith'](_0x1ffac6[_0xa4d4('0x32')][_0xa4d4('0x34')](),_0xa4d4('0x35'))){var _0x277474=_0x1ffac6[_0xa4d4('0x32')][_0xa4d4('0x36')]('=');var _0x3eb956=_0x277474[0x0][_0xa4d4('0x37')](_0x277474[0x0]['lastIndexOf']('(')+0x1,_0x277474[0x0][_0xa4d4('0x38')](')'));var _0x373899=_0x277474[0x1];recordings[_0x1ffac6[_0xa4d4('0x4')]][_0x3eb956]=_0x373899;}}}catch(_0x2ea167){utils[_0xa4d4('0x23')](util[_0xa4d4('0x2')](_0xa4d4('0x2f'),_0x1ffac6[_0xa4d4('0x4')]),_0x2ea167);}};exports[_0xa4d4('0x39')]=function(_0x49b0ef){try{if(!_[_0xa4d4('0x14')](recordings[_0x49b0ef[_0xa4d4('0x4')]])){utils[_0xa4d4('0x13')](util[_0xa4d4('0x2')]('[%s][recordings][queuecallerjoin]',_0x49b0ef[_0xa4d4('0x4')]),_0x49b0ef);utils[_0xa4d4('0x1')](util[_0xa4d4('0x2')](_0xa4d4('0x3a'),_0x49b0ef[_0xa4d4('0x4')],_0x49b0ef[_0xa4d4('0x3b')]));recordings[_0x49b0ef[_0xa4d4('0x4')]][_0xa4d4('0x3b')]=_0x49b0ef[_0xa4d4('0x3b')];}}catch(_0x25bd5f){utils[_0xa4d4('0x23')](util[_0xa4d4('0x2')](_0xa4d4('0x3c'),_0x49b0ef[_0xa4d4('0x4')]),_0x25bd5f);}}; \ No newline at end of file +var _0x0f4d=['channel','error','newstate','debug','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','calleridname','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','util','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f4d,0xde));var _0xd0f4=function(_0x2b77c0,_0x1219f8){_0x2b77c0=_0x2b77c0-0x0;var _0x2e0bf3=_0x0f4d[_0x2b77c0];return _0x2e0bf3;};'use strict';var _=require('lodash');var util=require(_0xd0f4('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x278c60){utils[_0xd0f4('0x1')](util['format'](_0xd0f4('0x2'),_0x278c60['uniqueid']));if(_0x278c60[_0xd0f4('0x3')]){utils[_0xd0f4('0x4')](_0x278c60[_0xd0f4('0x3')])[_0xd0f4('0x5')](function(_0x1ebdbb){if(_0x1ebdbb){_0x278c60[_0xd0f4('0x6')]=_0x1ebdbb[_0xd0f4('0x7')];_0x278c60[_0xd0f4('0x8')]=_0x1ebdbb['id'];}utils[_0xd0f4('0x9')](_0xd0f4('0xa'),_0x278c60);});}else{utils['request'](_0xd0f4('0xa'),_0x278c60);}}exports[_0xd0f4('0xb')]=function(_0x4521b0){try{utils['debug'](util[_0xd0f4('0xc')](_0xd0f4('0xd'),_0x4521b0['uniqueid']),_0x4521b0);if(_0x4521b0[_0xd0f4('0xe')]==_0x4521b0[_0xd0f4('0xf')]){utils[_0xd0f4('0x1')](util[_0xd0f4('0xc')](_0xd0f4('0x10'),_0x4521b0['uniqueid'],_0x4521b0['context'],_0x4521b0[_0xd0f4('0x11')]));recordings[_0x4521b0[_0xd0f4('0xe')]]={'uniqueid':_0x4521b0['uniqueid'],'accountcode':_0x4521b0['accountcode'],'exten':_0x4521b0[_0xd0f4('0x11')],'context':_0x4521b0['context'],'channel':_0x4521b0[_0xd0f4('0x12')],'monitors':[]};}}catch(_0x3d627b){utils[_0xd0f4('0x13')](util[_0xd0f4('0xc')](_0xd0f4('0xd'),_0x4521b0[_0xd0f4('0xe')]),_0x3d627b);}};exports[_0xd0f4('0x14')]=function(_0x4c8ee0){try{utils[_0xd0f4('0x15')](util['format'](_0xd0f4('0x16'),_0x4c8ee0[_0xd0f4('0xe')]),_0x4c8ee0);if(!_['isNil'](recordings[_0x4c8ee0[_0xd0f4('0xe')]])&&_0x4c8ee0[_0xd0f4('0x17')]==0x6){utils[_0xd0f4('0x1')](util['format'](_0xd0f4('0x18'),_0x4c8ee0['uniqueid'],_0x4c8ee0[_0xd0f4('0x19')],_0x4c8ee0['channel']));}else if(!_['isNil'](recordings[_0x4c8ee0['linkedid']])&&_0x4c8ee0[_0xd0f4('0x17')]==0x6&&_0x4c8ee0[_0xd0f4('0x19')]!=_0xd0f4('0x1a')){utils[_0xd0f4('0x1')](util[_0xd0f4('0xc')](_0xd0f4('0x1b'),_0x4c8ee0[_0xd0f4('0xe')],_0x4c8ee0[_0xd0f4('0xf')],_0x4c8ee0[_0xd0f4('0x19')],_0x4c8ee0[_0xd0f4('0x12')]));recordings[_0x4c8ee0[_0xd0f4('0xf')]][_0xd0f4('0x3')]=_0x4c8ee0['accountcode'];}}catch(_0x2b5d30){utils['error'](util['format'](_0xd0f4('0x16'),_0x4c8ee0[_0xd0f4('0xe')]),_0x2b5d30);}};exports[_0xd0f4('0x1c')]=function(_0x78e692){try{if(!_[_0xd0f4('0x1d')](_0x78e692[_0xd0f4('0x1e')])&&!_[_0xd0f4('0x1d')](_0x78e692[_0xd0f4('0x1e')][_0xd0f4('0x1f')])){utils['debug'](util[_0xd0f4('0xc')](_0xd0f4('0x20'),_0x78e692['uniqueid']),_0x78e692);utils[_0xd0f4('0x1')](util[_0xd0f4('0xc')](_0xd0f4('0x21'),_0x78e692[_0xd0f4('0xe')],_0x78e692[_0xd0f4('0x1e')],_0x78e692[_0xd0f4('0x22')]));if(_['endsWith'](_0x78e692['value'],_0xd0f4('0x23'))){_0x78e692['value']=_0x78e692[_0xd0f4('0x22')][_0xd0f4('0x24')](_0xd0f4('0x23'),_0xd0f4('0x25'));}if(recordings[_0x78e692[_0xd0f4('0xf')]]){var _0x2bc944=_[_0xd0f4('0x26')](recordings[_0x78e692['linkedid']][_0xd0f4('0x27')],{'value':_0x78e692[_0xd0f4('0x22')]});if(_[_0xd0f4('0x1d')](_0x2bc944)){recordings[_0x78e692[_0xd0f4('0xf')]]['monitors'][_0xd0f4('0x28')]({'value':_0x78e692[_0xd0f4('0x22')]});}}}}catch(_0x5c35be){utils[_0xd0f4('0x13')](util['format']('[%s][recordings][varset]',_0x78e692['uniqueid']),_0x5c35be);}};exports['hangup']=function(_0x11fb52){try{if(!_['isNil'](recordings[_0x11fb52[_0xd0f4('0xe')]])){utils[_0xd0f4('0x15')](util['format']('[%s][recordings][hangup]',_0x11fb52[_0xd0f4('0xe')]),_0x11fb52);utils[_0xd0f4('0x1')](util[_0xd0f4('0xc')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x11fb52[_0xd0f4('0xe')],_0x11fb52['calleridnum'],_0x11fb52[_0xd0f4('0x29')],_0x11fb52['cause-txt']));recordings[_0x11fb52[_0xd0f4('0xe')]][_0xd0f4('0x2a')]=_0x11fb52[_0xd0f4('0x2a')];recordings[_0x11fb52[_0xd0f4('0xe')]][_0xd0f4('0x29')]=_0x11fb52[_0xd0f4('0x29')];recordings[_0x11fb52['uniqueid']][_0xd0f4('0x2b')]=_0x11fb52[_0xd0f4('0x2b')];recordings[_0x11fb52['uniqueid']][_0xd0f4('0x2c')]=_0x11fb52['connectedlinename'];if(recordings[_0x11fb52[_0xd0f4('0xe')]]['type']==_0xd0f4('0x2d')&&recordings[_0x11fb52[_0xd0f4('0xe')]][_0xd0f4('0x3')]){recordings[_0x11fb52[_0xd0f4('0xe')]]['connectedlinenum']=recordings[_0x11fb52[_0xd0f4('0xe')]][_0xd0f4('0x3')];recordings[_0x11fb52[_0xd0f4('0xe')]]['connectedlinename']='';}recordings[_0x11fb52['uniqueid']][_0xd0f4('0x27')][_0xd0f4('0x2e')](function(_0x55643e){var _0x288c32=_[_0xd0f4('0x2f')](recordings[_0x11fb52[_0xd0f4('0xe')]]);_0x288c32[_0xd0f4('0x22')]=_0x55643e['value'];writeDB(_0x288c32);});delete recordings[_0x11fb52['uniqueid']];}}catch(_0x4f1493){utils[_0xd0f4('0x13')](util[_0xd0f4('0xc')]('[%s][recordings][hangup]',_0x11fb52[_0xd0f4('0xe')]),_0x4f1493);}};exports[_0xd0f4('0x30')]=function(_0x1739a0){try{if(!_['isNil'](recordings[_0x1739a0['uniqueid']])){utils[_0xd0f4('0x15')](util[_0xd0f4('0xc')](_0xd0f4('0x31'),_0x1739a0['uniqueid']),_0x1739a0);utils['info'](util[_0xd0f4('0xc')](_0xd0f4('0x32'),_0x1739a0['uniqueid'],_0x1739a0['application'],_0x1739a0[_0xd0f4('0x33')]));if(_0x1739a0[_0xd0f4('0x34')][_0xd0f4('0x35')]()=='set'&&_['startsWith'](_0x1739a0['appdata'][_0xd0f4('0x35')](),'cdr')){var _0x33f41f=_0x1739a0[_0xd0f4('0x33')][_0xd0f4('0x36')]('=');var _0x458e2f=_0x33f41f[0x0][_0xd0f4('0x37')](_0x33f41f[0x0][_0xd0f4('0x38')]('(')+0x1,_0x33f41f[0x0]['lastIndexOf'](')'));var _0x4d12e0=_0x33f41f[0x1];recordings[_0x1739a0[_0xd0f4('0xe')]][_0x458e2f]=_0x4d12e0;}}}catch(_0x4e4e5b){utils[_0xd0f4('0x13')](util['format'](_0xd0f4('0x31'),_0x1739a0[_0xd0f4('0xe')]),_0x4e4e5b);}};exports[_0xd0f4('0x39')]=function(_0x12ced8){try{if(!_[_0xd0f4('0x1d')](recordings[_0x12ced8['uniqueid']])){utils['debug'](util['format'](_0xd0f4('0x3a'),_0x12ced8[_0xd0f4('0xe')]),_0x12ced8);utils[_0xd0f4('0x1')](util[_0xd0f4('0xc')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x12ced8[_0xd0f4('0xe')],_0x12ced8[_0xd0f4('0x3b')]));recordings[_0x12ced8[_0xd0f4('0xe')]][_0xd0f4('0x3b')]=_0x12ced8[_0xd0f4('0x3b')];}}catch(_0x49ce1d){utils[_0xd0f4('0x13')](util[_0xd0f4('0xc')]('[%s][recordings][queuecallerjoin]',_0x12ced8[_0xd0f4('0xe')]),_0x49ce1d);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b17bc4a..6c4295b 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 _0x46c2=['origtransfererexten','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransferercontext'];(function(_0x129b5f,_0xe23ff2){var _0x163673=function(_0x4838db){while(--_0x4838db){_0x129b5f['push'](_0x129b5f['shift']());}};_0x163673(++_0xe23ff2);}(_0x46c2,0x1c1));var _0x246c=function(_0x106615,_0x544379){_0x106615=_0x106615-0x0;var _0x161b65=_0x46c2[_0x106615];return _0x161b65;};'use strict';var _=require(_0x246c('0x0'));var util=require(_0x246c('0x1'));var utils=require(_0x246c('0x2'));function writeDB(_0x117d43){utils[_0x246c('0x3')](util[_0x246c('0x4')](_0x246c('0x5'),_0x117d43['type']===_0x246c('0x6')?_0x117d43[_0x246c('0x7')]:_0x117d43[_0x246c('0x8')],_0x117d43[_0x246c('0x9')]));utils[_0x246c('0xa')]('CreateVoiceTransferReport',_0x117d43);}exports[_0x246c('0xb')]={};exports[_0x246c('0xc')]=function(_0x4406cd){try{utils['debug'](util[_0x246c('0x4')](_0x246c('0xd'),_0x4406cd[_0x246c('0x8')]),_0x4406cd);utils[_0x246c('0x3')](util[_0x246c('0x4')](_0x246c('0xe'),_0x4406cd['uniqueid'],_0x4406cd['transferercalleridnum'],_0x4406cd[_0x246c('0xf')],_0x4406cd[_0x246c('0x10')],_0x4406cd[_0x246c('0x11')]));_0x4406cd['type']=_0x246c('0x12');exports[_0x246c('0xb')][_0x4406cd[_0x246c('0x13')]]=_0x4406cd;writeDB(_0x4406cd);}catch(_0x538a2a){utils['error'](util[_0x246c('0x4')](_0x246c('0xd'),_0x4406cd[_0x246c('0x8')]),_0x538a2a);}};exports[_0x246c('0x14')]=function(_0x4d2597){try{utils[_0x246c('0x15')](util['format']('[%s][transfers][attendedtransfer]',_0x4d2597['origtransfereruniqueid']),_0x4d2597);utils[_0x246c('0x3')](util['format'](_0x246c('0x16'),_0x4d2597[_0x246c('0x7')],_0x4d2597[_0x246c('0x17')],_0x4d2597[_0x246c('0x18')],_0x4d2597[_0x246c('0x19')],_0x4d2597['transfertargetcalleridname']));_0x4d2597=_[_0x246c('0x1a')](_0x4d2597,{'transfererchannel':_0x4d2597['origtransfererchannel'],'transferercalleridnum':_0x4d2597[_0x246c('0x17')],'transferercalleridname':_0x4d2597[_0x246c('0x18')],'transfererconnectedlinenum':_0x4d2597[_0x246c('0x1b')],'transfererconnectedlinename':_0x4d2597[_0x246c('0x1c')],'transfereraccountcode':_0x4d2597['origtransfereraccountcode'],'transferercontext':_0x4d2597[_0x246c('0x1d')],'transfererexten':_0x4d2597['secondtransfererexten'],'transfererlinkedid':_0x4d2597['origtransfererlinkedid'],'context':_0x4d2597[_0x246c('0x1e')],'extension':_0x4d2597[_0x246c('0x1f')],'type':_0x246c('0x6')});if(_['isNil'](_0x4d2597[_0x246c('0x20')])){_0x4d2597=_[_0x246c('0x1a')](_0x4d2597,{'transfereechannel':_0x4d2597['transfertargetchannel'],'transfereecalleridnum':_0x4d2597[_0x246c('0x19')],'transfereecalleridname':_0x4d2597[_0x246c('0x21')],'transfereeconnectedlinenum':_0x4d2597[_0x246c('0x22')],'transfereeconnectedlinename':_0x4d2597[_0x246c('0x23')],'transfereeaccountcode':_0x4d2597['transfertargetaccountcode'],'transfereecontext':_0x4d2597['transfertargetcontext'],'transfereeexten':_0x4d2597[_0x246c('0x24')],'transfereelinkedid':_0x4d2597[_0x246c('0x25')]});}writeDB(_0x4d2597);}catch(_0x5b9a5){utils[_0x246c('0x26')](util['format'](_0x246c('0x27'),_0x4d2597[_0x246c('0x7')]),_0x5b9a5);}}; \ No newline at end of file +var _0x493b=['[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridname','transfereecalleridnum','transfereruniqueid','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format'];(function(_0x2bf3ef,_0x4f7929){var _0x5f274f=function(_0x2b00f0){while(--_0x2b00f0){_0x2bf3ef['push'](_0x2bf3ef['shift']());}};_0x5f274f(++_0x4f7929);}(_0x493b,0x113));var _0xb493=function(_0xacda67,_0x10877d){_0xacda67=_0xacda67-0x0;var _0x967dd9=_0x493b[_0xacda67];return _0x967dd9;};'use strict';var _=require(_0xb493('0x0'));var util=require(_0xb493('0x1'));var utils=require(_0xb493('0x2'));function writeDB(_0x2afb2a){utils[_0xb493('0x3')](util[_0xb493('0x4')](_0xb493('0x5'),_0x2afb2a[_0xb493('0x6')]===_0xb493('0x7')?_0x2afb2a[_0xb493('0x8')]:_0x2afb2a['uniqueid'],_0x2afb2a['type']));utils[_0xb493('0x9')](_0xb493('0xa'),_0x2afb2a);}exports['blinds']={};exports[_0xb493('0xb')]=function(_0x841f6a){try{utils[_0xb493('0xc')](util['format'](_0xb493('0xd'),_0x841f6a[_0xb493('0xe')]),_0x841f6a);utils['info'](util[_0xb493('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x841f6a[_0xb493('0xe')],_0x841f6a['transferercalleridnum'],_0x841f6a[_0xb493('0xf')],_0x841f6a[_0xb493('0x10')],_0x841f6a['transfereecalleridname']));_0x841f6a[_0xb493('0x6')]='blind';exports['blinds'][_0x841f6a[_0xb493('0x11')]]=_0x841f6a;writeDB(_0x841f6a);}catch(_0xe5ceab){utils[_0xb493('0x12')](util[_0xb493('0x4')](_0xb493('0xd'),_0x841f6a[_0xb493('0xe')]),_0xe5ceab);}};exports['attendedtransfer']=function(_0x4e2f07){try{utils['debug'](util[_0xb493('0x4')](_0xb493('0x13'),_0x4e2f07[_0xb493('0x8')]),_0x4e2f07);utils['info'](util[_0xb493('0x4')](_0xb493('0x14'),_0x4e2f07[_0xb493('0x8')],_0x4e2f07['origtransferercalleridnum'],_0x4e2f07[_0xb493('0x15')],_0x4e2f07[_0xb493('0x16')],_0x4e2f07[_0xb493('0x17')]));_0x4e2f07=_[_0xb493('0x18')](_0x4e2f07,{'transfererchannel':_0x4e2f07[_0xb493('0x19')],'transferercalleridnum':_0x4e2f07[_0xb493('0x1a')],'transferercalleridname':_0x4e2f07[_0xb493('0x15')],'transfererconnectedlinenum':_0x4e2f07[_0xb493('0x1b')],'transfererconnectedlinename':_0x4e2f07[_0xb493('0x1c')],'transfereraccountcode':_0x4e2f07['origtransfereraccountcode'],'transferercontext':_0x4e2f07['secondtransferercontext'],'transfererexten':_0x4e2f07['secondtransfererexten'],'transfererlinkedid':_0x4e2f07['origtransfererlinkedid'],'context':_0x4e2f07[_0xb493('0x1d')],'extension':_0x4e2f07[_0xb493('0x1e')],'type':'attended'});if(_[_0xb493('0x1f')](_0x4e2f07[_0xb493('0x20')])){_0x4e2f07=_[_0xb493('0x18')](_0x4e2f07,{'transfereechannel':_0x4e2f07[_0xb493('0x21')],'transfereecalleridnum':_0x4e2f07[_0xb493('0x16')],'transfereecalleridname':_0x4e2f07['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4e2f07[_0xb493('0x22')],'transfereeconnectedlinename':_0x4e2f07[_0xb493('0x23')],'transfereeaccountcode':_0x4e2f07[_0xb493('0x24')],'transfereecontext':_0x4e2f07[_0xb493('0x25')],'transfereeexten':_0x4e2f07[_0xb493('0x26')],'transfereelinkedid':_0x4e2f07[_0xb493('0x27')]});}writeDB(_0x4e2f07);}catch(_0x60436d){utils[_0xb493('0x12')](util[_0xb493('0x4')](_0xb493('0x13'),_0x4e2f07['origtransfereruniqueid']),_0x60436d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4b9c4c0..99a99d5 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 _0xe376=['request','[utils][request]\x20name:%s','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error'];(function(_0x1563da,_0x362606){var _0x55bc38=function(_0x2d13b5){while(--_0x2d13b5){_0x1563da['push'](_0x1563da['shift']());}};_0x55bc38(++_0x362606);}(_0xe376,0x194));var _0x6e37=function(_0x1190c2,_0x2c078b){_0x1190c2=_0x1190c2-0x0;var _0x6ec988=_0xe376[_0x1190c2];return _0x6ec988;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x6e37('0x0'));var util=require(_0x6e37('0x1'));var client=jayson[_0x6e37('0x2')][_0x6e37('0x3')]({'port':0x2329});var logger=require(_0x6e37('0x4'))(_0x6e37('0x5'));exports[_0x6e37('0x6')]=function(_0x1988e3,_0x2d209a){logger[_0x6e37('0x6')](_0x1988e3,_0x2d209a?util[_0x6e37('0x7')](_0x2d209a,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x4d47be,_0x344140){logger[_0x6e37('0x8')](_0x4d47be,_0x344140?util['inspect'](_0x344140,{'showHidden':![],'depth':null}):'');};exports[_0x6e37('0x9')]=function(_0x109d52,_0x4b1251){logger[_0x6e37('0x9')](_0x109d52,_0x4b1251?util[_0x6e37('0x7')](_0x4b1251,{'showHidden':![],'depth':null}):'');};exports[_0x6e37('0xa')]=function(_0x57df3f,_0x53b779){return client[_0x6e37('0xa')](_0x57df3f,{'body':_0x53b779})['then'](function(_0x29cc0e){logger['debug'](_0x6e37('0xb'),_0x57df3f,_0x29cc0e?util['inspect'](_0x29cc0e,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1d5aa1){logger['error']('[utils][request]\x20name:%s',_0x57df3f,_0x1d5aa1?util[_0x6e37('0x7')](_0x1d5aa1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1109f9){return client[_0x6e37('0xa')](_0x6e37('0xc'),{'options':{'raw':!![],'attributes':['id',_0x6e37('0xd'),'name',_0x6e37('0xe')],'where':_0x1109f9,'limit':0x1}})[_0x6e37('0xf')](function(_0x3df06f){logger['debug'](_0x6e37('0x10'),JSON['stringify'](_0x1109f9),_0x3df06f?util[_0x6e37('0x7')](_0x3df06f,{'showHidden':![],'depth':null}):'');return _0x3df06f['result'][_0x6e37('0x11')]?_0x3df06f[_0x6e37('0x12')][0x0]:null;});}exports[_0x6e37('0x13')]=function(_0x21057e){return new BPromise(function(_0x5b30e6,_0x218553){if(_0x21057e){return getUser({'internal':_0x21057e})[_0x6e37('0xf')](function(_0x57f603){logger['info'](_0x6e37('0x14'),_0x21057e,_0x57f603?_0x6e37('0x15'):_0x6e37('0x16'));return _0x5b30e6(_0x57f603);})['catch'](function(_0x33e390){logger[_0x6e37('0x9')](_0x6e37('0x17'),_0x33e390?util[_0x6e37('0x7')](_0x33e390,{'showHidden':![],'depth':null}):'');return _0x5b30e6(null);});}return _0x5b30e6(null);});};exports[_0x6e37('0x18')]=function(_0x5b715d){return new BPromise(function(_0x49bd28,_0x3dc74f){if(_0x5b715d){return getUser({'interface':_0x5b715d})['then'](function(_0x152da9){logger[_0x6e37('0x6')](_0x6e37('0x19'),_0x5b715d,_0x152da9?_0x6e37('0x15'):_0x6e37('0x16'));return _0x49bd28(_0x152da9);})[_0x6e37('0x1a')](function(_0xa77423){logger[_0x6e37('0x9')]('[utils][getUserByInterface]',_0xa77423?util['inspect'](_0xa77423,{'showHidden':![],'depth':null}):'');return _0x49bd28(null);});}return _0x49bd28(null);});};exports[_0x6e37('0x1b')]=function(_0x584318){return new BPromise(function(_0x1bbe54,_0x1cf072){if(_0x584318){return getUser({'name':_0x584318})[_0x6e37('0xf')](function(_0x281849){logger[_0x6e37('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x584318,_0x281849?_0x6e37('0x15'):_0x6e37('0x16'));return _0x1bbe54(_0x281849);})[_0x6e37('0x1a')](function(_0x2606c5){logger[_0x6e37('0x9')]('[utils][getUserByName]',_0x2606c5?util[_0x6e37('0x7')](_0x2606c5,{'showHidden':![],'depth':null}):'');return _0x1bbe54(null);});}return _0x1bbe54(null);});};exports[_0x6e37('0x1c')]=function(_0x24853d){return new BPromise(function(_0x4df15e,_0x15da0b){if(_0x24853d){return client[_0x6e37('0xa')](_0x6e37('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0x6e37('0x1e'),_0x6e37('0x1f'),_0x6e37('0x20')],'where':{'name':_0x24853d},'limit':0x1}})[_0x6e37('0xf')](function(_0x55827a){logger['debug'](_0x6e37('0x21'),_0x24853d,_0x55827a?util['inspect'](_0x55827a,{'showHidden':![],'depth':null}):'');logger[_0x6e37('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x24853d,_0x55827a?_0x6e37('0x15'):'notfound');return _0x4df15e(_0x55827a['result'][_0x6e37('0x11')]?_0x55827a[_0x6e37('0x12')][0x0]:null);})['catch'](function(_0x1addda){logger['error']('[utils][getVoiceQueueByName]',_0x1addda?util[_0x6e37('0x7')](_0x1addda,{'showHidden':![],'depth':null}):'');return _0x4df15e(null);});}return _0x4df15e(null);});};exports[_0x6e37('0x22')]=function(_0x10f064,_0x6fb1d4){return moment(_0x10f064)[_0x6e37('0x23')](_0x6fb1d4,_0x6e37('0x24'))[_0x6e37('0x25')](_0x6e37('0x26'));};exports['subtractTime']=function(_0x3e9219,_0x489b87){return moment(_0x3e9219)[_0x6e37('0x27')](_0x489b87,_0x6e37('0x24'))['format'](_0x6e37('0x26'));};exports[_0x6e37('0x28')]=function(_0x20e011,_0x33c1ca){return moment(_0x20e011)[_0x6e37('0x29')](moment(_0x33c1ca),'seconds');};exports[_0x6e37('0x2a')]=function(_0x36bc73,_0x1db996){return parseInt(_0x36bc73,0xa)+parseInt(_0x1db996,0xa);};exports[_0x6e37('0x2b')]=function(){return moment()[_0x6e37('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6e37('0x2c')]=function(_0x256216,_0x135a26){if(_0x135a26){return moment(_0x256216)['isAfter'](_0x135a26);}return!![];};exports[_0x6e37('0x2d')]=function(_0x5db0f7,_0x5f4663){if(_0x5f4663){return moment(_0x5db0f7)['isBefore'](_0x5f4663);}else if(_0x5db0f7){return!![];}return![];}; \ No newline at end of file +var _0xd2d9=['now','format','isAfter','isBefore','bluebird','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','stringify','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','notfound','result','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime'];(function(_0x473a8a,_0x22858b){var _0x192b62=function(_0x23408b){while(--_0x23408b){_0x473a8a['push'](_0x473a8a['shift']());}};_0x192b62(++_0x22858b);}(_0xd2d9,0x16c));var _0x9d2d=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0xd2d9[_0x1529a3];return _0x1a0d4b;};'use strict';var BPromise=require(_0x9d2d('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x9d2d('0x1'));var client=jayson['client'][_0x9d2d('0x2')]({'port':0x2329});var logger=require(_0x9d2d('0x3'))(_0x9d2d('0x4'));exports[_0x9d2d('0x5')]=function(_0x4b4189,_0x9430a8){logger[_0x9d2d('0x5')](_0x4b4189,_0x9430a8?util[_0x9d2d('0x6')](_0x9430a8,{'showHidden':![],'depth':null}):'');};exports[_0x9d2d('0x7')]=function(_0x19ad18,_0x2a1bc2){logger[_0x9d2d('0x7')](_0x19ad18,_0x2a1bc2?util['inspect'](_0x2a1bc2,{'showHidden':![],'depth':null}):'');};exports[_0x9d2d('0x8')]=function(_0x3f9474,_0x1a723d){logger['error'](_0x3f9474,_0x1a723d?util[_0x9d2d('0x6')](_0x1a723d,{'showHidden':![],'depth':null}):'');};exports[_0x9d2d('0x9')]=function(_0x448e3e,_0x124eaf){return client['request'](_0x448e3e,{'body':_0x124eaf})[_0x9d2d('0xa')](function(_0x3de70c){logger['debug'](_0x9d2d('0xb'),_0x448e3e,_0x3de70c?util[_0x9d2d('0x6')](_0x3de70c,{'showHidden':![],'depth':null}):'');})[_0x9d2d('0xc')](function(_0x946cc4){logger['error'](_0x9d2d('0xb'),_0x448e3e,_0x946cc4?util[_0x9d2d('0x6')](_0x946cc4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x239e83){return client[_0x9d2d('0x9')](_0x9d2d('0xd'),{'options':{'raw':!![],'attributes':['id',_0x9d2d('0xe'),_0x9d2d('0xf'),'interface'],'where':_0x239e83,'limit':0x1}})['then'](function(_0x5dfea3){logger[_0x9d2d('0x7')]('[utils][getUser]\x20where:%s',JSON[_0x9d2d('0x10')](_0x239e83),_0x5dfea3?util[_0x9d2d('0x6')](_0x5dfea3,{'showHidden':![],'depth':null}):'');return _0x5dfea3['result'][_0x9d2d('0x11')]?_0x5dfea3['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x1768a9){return new BPromise(function(_0x3686d9,_0x5ab68a){if(_0x1768a9){return getUser({'internal':_0x1768a9})[_0x9d2d('0xa')](function(_0x53ea08){logger['info'](_0x9d2d('0x12'),_0x1768a9,_0x53ea08?_0x9d2d('0x13'):'notfound');return _0x3686d9(_0x53ea08);})[_0x9d2d('0xc')](function(_0x4708b8){logger[_0x9d2d('0x8')]('[utils][getUserByInternal]',_0x4708b8?util['inspect'](_0x4708b8,{'showHidden':![],'depth':null}):'');return _0x3686d9(null);});}return _0x3686d9(null);});};exports[_0x9d2d('0x14')]=function(_0x5ea924){return new BPromise(function(_0x7a7afc,_0x2ec8c2){if(_0x5ea924){return getUser({'interface':_0x5ea924})[_0x9d2d('0xa')](function(_0xeaf613){logger[_0x9d2d('0x5')](_0x9d2d('0x15'),_0x5ea924,_0xeaf613?_0x9d2d('0x13'):'notfound');return _0x7a7afc(_0xeaf613);})[_0x9d2d('0xc')](function(_0x745d72){logger[_0x9d2d('0x8')](_0x9d2d('0x16'),_0x745d72?util[_0x9d2d('0x6')](_0x745d72,{'showHidden':![],'depth':null}):'');return _0x7a7afc(null);});}return _0x7a7afc(null);});};exports[_0x9d2d('0x17')]=function(_0xca2c20){return new BPromise(function(_0x5610f1,_0x4854b9){if(_0xca2c20){return getUser({'name':_0xca2c20})['then'](function(_0x3215a1){logger[_0x9d2d('0x5')](_0x9d2d('0x18'),_0xca2c20,_0x3215a1?_0x9d2d('0x13'):'notfound');return _0x5610f1(_0x3215a1);})['catch'](function(_0x226cd6){logger['error']('[utils][getUserByName]',_0x226cd6?util[_0x9d2d('0x6')](_0x226cd6,{'showHidden':![],'depth':null}):'');return _0x5610f1(null);});}return _0x5610f1(null);});};exports[_0x9d2d('0x19')]=function(_0x86970d){return new BPromise(function(_0x423113,_0x35d31f){if(_0x86970d){return client[_0x9d2d('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x9d2d('0xf'),_0x9d2d('0x1a'),'acw',_0x9d2d('0x1b')],'where':{'name':_0x86970d},'limit':0x1}})['then'](function(_0x3b7d49){logger[_0x9d2d('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x86970d,_0x3b7d49?util[_0x9d2d('0x6')](_0x3b7d49,{'showHidden':![],'depth':null}):'');logger[_0x9d2d('0x5')](_0x9d2d('0x1c'),_0x86970d,_0x3b7d49?_0x9d2d('0x13'):_0x9d2d('0x1d'));return _0x423113(_0x3b7d49[_0x9d2d('0x1e')]['length']?_0x3b7d49[_0x9d2d('0x1e')][0x0]:null);})[_0x9d2d('0xc')](function(_0x5de56d){logger[_0x9d2d('0x8')](_0x9d2d('0x1f'),_0x5de56d?util['inspect'](_0x5de56d,{'showHidden':![],'depth':null}):'');return _0x423113(null);});}return _0x423113(null);});};exports[_0x9d2d('0x20')]=function(_0x22fbdb,_0x2acb02){return moment(_0x22fbdb)[_0x9d2d('0x21')](_0x2acb02,_0x9d2d('0x22'))['format'](_0x9d2d('0x23'));};exports[_0x9d2d('0x24')]=function(_0x47b97c,_0x317e19){return moment(_0x47b97c)[_0x9d2d('0x25')](_0x317e19,_0x9d2d('0x22'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x9d2d('0x26')]=function(_0x464088,_0x2ec778){return moment(_0x464088)[_0x9d2d('0x27')](moment(_0x2ec778),_0x9d2d('0x22'));};exports[_0x9d2d('0x28')]=function(_0x45041e,_0x2d116b){return parseInt(_0x45041e,0xa)+parseInt(_0x2d116b,0xa);};exports[_0x9d2d('0x29')]=function(){return moment()[_0x9d2d('0x2a')](_0x9d2d('0x23'));};exports[_0x9d2d('0x2b')]=function(_0x38d928,_0x5a034c){if(_0x5a034c){return moment(_0x38d928)['isAfter'](_0x5a034c);}return!![];};exports[_0x9d2d('0x2c')]=function(_0x260dda,_0x38740b){if(_0x38740b){return moment(_0x260dda)[_0x9d2d('0x2c')](_0x38740b);}else if(_0x260dda){return!![];}return![];}; \ No newline at end of file